Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Leicht Vogt2012-11-02 15:25:23 +0000
committerStephan Leicht Vogt2012-11-02 15:25:23 +0000
commit54b9fc18cbdc68137ee856f5cae75d61d07eab87 (patch)
treeed27ea08f49de5c376fe4f5e3c8cd4b75d843456
parent7a9f8f812ce1b7c5c1c40ebfbfe841bb6cdd20d3 (diff)
downloadorg.eclipse.scout.rt-54b9fc18cbdc68137ee856f5cae75d61d07eab87.tar.gz
org.eclipse.scout.rt-54b9fc18cbdc68137ee856f5cae75d61d07eab87.tar.xz
org.eclipse.scout.rt-54b9fc18cbdc68137ee856f5cae75d61d07eab87.zip
Normalize line endings
-rw-r--r--org.eclipse.scout.commons.test/.project68
-rw-r--r--org.eclipse.scout.commons.test/.settings/de.loskutov.anyedit.AnyEditTools.prefs30
-rw-r--r--org.eclipse.scout.commons.test/.settings/org.eclipse.core.resources.prefs4
-rw-r--r--org.eclipse.scout.commons.test/.settings/org.eclipse.jdt.core.prefs742
-rw-r--r--org.eclipse.scout.commons.test/.settings/org.eclipse.jdt.ui.prefs230
-rw-r--r--org.eclipse.scout.commons.test/.settings/org.eclipse.m2e.core.prefs8
-rw-r--r--org.eclipse.scout.commons.test/.settings/org.eclipse.pde.core.prefs6
-rw-r--r--org.eclipse.scout.commons.test/about.html54
-rw-r--r--org.eclipse.scout.commons.test/build.properties24
-rw-r--r--org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/BeanUtilityTest.java716
-rw-r--r--org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/CompareUtilityTest.java70
-rw-r--r--org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/CsvHelperTest.java120
-rw-r--r--org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/DateUtilityTest.java704
-rw-r--r--org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/FormattingUtilityTest.java418
-rw-r--r--org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/ListUtilityTest.java70
-rw-r--r--org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/MailUtilityTest.java82
-rw-r--r--org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/MatrixUtilityTest.java254
-rw-r--r--org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/StringUtilityTest.java330
-rw-r--r--org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/TypeCastUtilityTest.java234
-rw-r--r--org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/UriBuilderTest.java392
-rw-r--r--org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/UriUtilityTest.java162
-rw-r--r--org.eclipse.scout.commons/.settings/org.eclipse.pde.core.prefs6
-rw-r--r--org.eclipse.scout.commons/Release Notes.txt578
-rw-r--r--org.eclipse.scout.commons/eclipse-scout-code-style.xml538
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/AbstractDynamicHashMap.java480
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/ArrayComparator.java148
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/Base64Utility.java204
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/BeanUtility.java806
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/BooleanUtility.java68
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/BundleContextUtility.java156
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/CSSPatch.java448
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/CellRange.java472
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/CharsetSafeMimeMessage.java272
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/ClassIdentifier.java232
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/CloneUtility.java198
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/CollationRulesPatch.java196
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/CollectionUtility.java608
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/ColorUtility.java82
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/CompareUtility.java180
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/CompositeLong.java184
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/CompositeObject.java210
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/CompressedObjectReader.java134
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/CompressedObjectWriter.java182
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/ConfigIniProperty.java122
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/ConfigIniUtility.java496
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/ConfigurationUtility.java528
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/DateUtility.java1074
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/EncryptionUtility.java210
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/EventListenerList.java506
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/FileUtility.java1050
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/FormattingUtility.java174
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/HTMLUtility.java1882
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/IOUtility.java1084
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/LRUCache.java630
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/ListUtility.java490
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/LocaleThreadLocal.java74
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/LocaleUtility.java72
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/MailUtility.java1582
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/MatrixUtility.java580
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/NumberUtility.java650
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/OptimisticLock.java114
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/PublicKeyUtility.java252
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/RFCWrapperPart.java324
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/ReflectionUtility.java82
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/RunnableWithData.java160
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/RunnableWithException.java30
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/SecurePreferencesUtility.java136
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/SoapHandlingUtility.java244
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/StoppableThread.java112
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/StreamDumper.java88
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/StringUtility.java3170
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/TTLCache.java394
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/TriState.java314
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/TuningUtility.java506
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/TypeCastUtility.java4076
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/UTCDate.java58
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/UriBuilder.java402
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/UriUtility.java414
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/VerboseUtility.java420
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/WeakEventListener.java50
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/ConfigOperation.java50
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/ConfigProperty.java400
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/ConfigPropertyValue.java44
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/Doc.java24
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/FormData.java292
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/FormDataChecksum.java44
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/IOrdered.java56
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/InjectFieldTo.java104
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/Order.java54
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/OrderComparator.java120
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/Priority.java68
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/PriorityComparator.java128
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/SqlBindingIgnoreValidation.java64
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/beans/AbstractPropertyObserver.java78
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/beans/BasicPropertySupport.java906
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/beans/FastBeanInfo.java132
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/beans/FastBeanUtility.java306
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/beans/FastPropertyDescriptor.java292
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/beans/IPropertyFilter.java50
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/beans/IPropertyObserver.java48
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/csv/ArrayConsumer.java82
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/csv/CsvHelper.java1166
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/csv/IDataConsumer.java38
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/dnd/FileListTransferObject.java146
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/dnd/ImageTransferObject.java76
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/dnd/JavaTransferObject.java74
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/dnd/TextTransferObject.java112
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/dnd/TransferObject.java88
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/dnd/TransferObjectRequest.java68
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/eventlistprofiler/EventListenerProfiler.java232
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/eventlistprofiler/EventListenerSnapshot.java134
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/eventlistprofiler/IEventListenerSnapshot.java34
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/eventlistprofiler/IEventListenerSource.java34
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/exception/IProcessingStatus.java70
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/exception/PlaceholderException.java362
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/exception/ProcessingException.java236
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/exception/ProcessingStatus.java670
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/exception/VetoException.java150
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/BeanArrayHolder.java256
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/BeanArrayHolderFilter.java74
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/BigDecimalArrayHolder.java60
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/BigDecimalHolder.java60
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/BooleanArrayHolder.java56
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/BooleanHolder.java56
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/ByteArrayHolder.java56
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/DateArrayHolder.java60
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/DateHolder.java60
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/DoubleArrayHolder.java56
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/DoubleHolder.java56
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/FloatArrayHolder.java56
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/FloatHolder.java56
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/Holder.java110
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/HolderUtility.java108
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/IBeanArrayHolder.java192
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/IHolder.java50
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/ITableHolder.java158
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/IntegerArrayHolder.java56
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/IntegerHolder.java56
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/LongArrayHolder.java68
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/LongHolder.java64
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/NVPair.java104
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/ObjectArrayHolder.java56
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/ObjectHolder.java56
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/StringArrayHolder.java56
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/StringHolder.java64
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/TableHolderFilter.java94
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/html/tests/TestHTMLUtility.java78
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/internal/Activator.java94
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/internal/test/TestPublicKeyUtility.java68
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/internal/tripledes/TripleDES.java548
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/job/JobEx.java326
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/EclipseLogUtility.java132
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/IScoutLogManager.java164
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/IScoutLogger.java806
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/JavaLogUtility.java282
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/ScoutLogManager.java416
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/analysis/AbstractLogFilter.java408
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/analysis/ILogFilter.java70
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/analysis/LogAnalyzer.java304
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/analysis/LogCategory.java218
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/analysis/LogEntry.java44
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/internal/AbstractScoutLogger.java446
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/internal/eclipse/EclipseLogWrapper.java214
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/internal/eclipse/EclipseScoutLogManager.java408
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/internal/java/JavaLogFormatter.java146
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/internal/java/JavaLogWrapper.java118
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/internal/java/JavaScoutLogManager.java448
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/internal/java/LogRecorderHandler.java96
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/nls/DynamicNls.java262
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/nls/NlsLocale.java188
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/nls/NlsResourceBundle.java318
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/nls/NlsResourceBundleCache.java112
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/nls/NlsUtility.java346
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/osgi/BundleClassDescriptor.java184
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/osgi/BundleInspector.java670
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/osgi/BundleObjectInputStream.java306
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/osgi/BundleObjectOutputStream.java58
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/osgi/ContextFinderBasedObjectInputStream.java208
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/BindModel.java136
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/BindParser.java1188
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/IntoModel.java62
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/IntoParser.java682
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/sql/SqlFormatter.java822
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/sql/SqlParser.java1756
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/sql/SqlParserToken.java438
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/token/DatabaseSpecificToken.java118
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/token/FunctionInputToken.java192
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/token/IToken.java48
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/token/TextToken.java98
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/token/ValueInputToken.java320
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/token/ValueOutputToken.java202
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/prefs/AbstractPreferences.java552
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/prefs/UserPreferences.java176
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/prefs/UserScope.java160
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/runtime/BundleBrowser.java338
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/runtime/ClasspathBrowser.java626
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/runtime/ExtensionPointTracker.java366
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/runtime/internal/TestClasspathBrowser.java102
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/security/SimplePrincipal.java114
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/xmlparser/ScoutXmlDocument.java5822
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/xmlparser/ScoutXmlException.java66
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/xmlparser/ScoutXmlParser.java1170
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/xmlparser/ScoutXmlQName.java450
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/xmlparser/SimpleXmlElement.java2562
-rw-r--r--org.eclipse.scout.commons/src/org/eclipse/scout/commons/xmlparser/internal/TestScoutXml.java320
-rw-r--r--org.eclipse.scout.http.servletfilter/.settings/org.eclipse.pde.core.prefs6
-rw-r--r--org.eclipse.scout.http.servletfilter/ReleseNotes.txt34
-rw-r--r--org.eclipse.scout.http.servletfilter/plugin.xml12
-rw-r--r--org.eclipse.scout.http.servletfilter/schema/filters.exsd318
-rw-r--r--org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/FilterConfigInjection.java372
-rw-r--r--org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/HttpServletEx.java96
-rw-r--r--org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/ServletFilterDelegate.java118
-rw-r--r--org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/helper/DevelopmentAuthFilter.java246
-rw-r--r--org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/helper/HttpAuthJaasFilter.java292
-rw-r--r--org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/internal/Activator.java130
-rw-r--r--org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/internal/FilterChainImpl.java96
-rw-r--r--org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/internal/FilterConfigImpl.java284
-rw-r--r--org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/internal/ServletFilterExtensionPoint.java210
-rw-r--r--org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/security/AbstractChainableSecurityFilter.java462
-rw-r--r--org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/security/AnonymousSecurityFilter.java66
-rw-r--r--org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/security/BasicSecurityFilter.java216
-rw-r--r--org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/security/DataSourceSecurityFilter.java542
-rw-r--r--org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/security/LDAPSecurityFilter.java474
-rw-r--r--org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/security/PrincipalHolder.java62
-rw-r--r--org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/security/SecureHttpServletRequestWrapper.java120
-rw-r--r--org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/security/TomcatSecurityFilter.java280
-rw-r--r--org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/security/WrappedServletResponse.java210
-rw-r--r--org.eclipse.scout.jaxws216/.settings/org.eclipse.pde.core.prefs6
-rw-r--r--org.eclipse.scout.jaxws216/README.txt46
-rw-r--r--org.eclipse.scout.jaxws216/Release Notes.txt444
-rw-r--r--org.eclipse.scout.jaxws216/plugin.xml34
-rw-r--r--org.eclipse.scout.jaxws216/resources/html/jaxws-services.html280
-rw-r--r--org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/Activator.java110
-rw-r--r--org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/JaxWsServlet.java184
-rw-r--r--org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/adapters/CalendarAdapter.java186
-rw-r--r--org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/adapters/DefaultTimezoneDateAdapter.java198
-rw-r--r--org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/adapters/UtcDateAdapter.java274
-rw-r--r--org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/annotation/ScoutTransaction.java64
-rw-r--r--org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/annotation/ScoutWebService.java122
-rw-r--r--org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/annotation/ScoutWebServiceClient.java58
-rw-r--r--org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/handler/LogHandler.java228
-rw-r--r--org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/handler/internal/IScoutTransactionHandlerWrapper.java38
-rw-r--r--org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/handler/internal/ScoutTransactionLogicalHandlerWrapper.java154
-rw-r--r--org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/handler/internal/ScoutTransactionMessageHandlerWrapper.java172
-rw-r--r--org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/handler/internal/ScoutTransactionSOAPHandlerWrapper.java170
-rw-r--r--org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/ContextHelper.java212
-rw-r--r--org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/JaxWsEndpointService.java576
-rw-r--r--org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/ScoutTransactionDelegate.java222
-rw-r--r--org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/SessionContextBean.java80
-rw-r--r--org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/SessionHelper.java174
-rw-r--r--org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/adapter/ResourceLoaderAdapterFactory.java70
-rw-r--r--org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/resolver/ScoutInstanceResolver.java412
-rw-r--r--org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/resources/AbstractResolver.java126
-rw-r--r--org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/resources/BundleProxyClassLoader.java410
-rw-r--r--org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/resources/BundleProxyResourceLoader.java276
-rw-r--r--org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/resources/SunJaxWsXml.java66
-rw-r--r--org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/resources/SunJaxWsXmlFinder.java118
-rw-r--r--org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/servlet/EndpointServlet.java300
-rw-r--r--org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/servlet/JaxWsHelper.java124
-rw-r--r--org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/servlet/ServletAdapter.java176
-rw-r--r--org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/servlet/ServletAdapterFactory.java50
-rw-r--r--org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/servlet/ServletConnection.java422
-rw-r--r--org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/servlet/ServletContainer.java114
-rw-r--r--org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/servlet/ServletContextDelegate.java136
-rw-r--r--org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/tube/ScoutTubelineAssembler.java528
-rw-r--r--org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/tube/ScoutTubelineAssemblerFactory.java54
-rw-r--r--org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/security/Authenticator.java176
-rw-r--r--org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/security/GlobalTrustManagerService.java510
-rw-r--r--org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/security/consumer/BasicAuthenticationHandler.java246
-rw-r--r--org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/security/consumer/IAuthenticationHandler.java134
-rw-r--r--org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/security/consumer/WsseUsernameTokenAuthenticationHandler.java250
-rw-r--r--org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/security/provider/BasicAuthenticationHandler.java410
-rw-r--r--org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/security/provider/ConfigIniCredentialValidationStrategy.java198
-rw-r--r--org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/security/provider/IAuthenticationHandler.java156
-rw-r--r--org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/security/provider/ICredentialValidationStrategy.java60
-rw-r--r--org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/security/provider/WsseUsernameTokenAuthenticationHandler.java358
-rw-r--r--org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/service/AbstractWebServiceClient.java896
-rw-r--r--org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/service/IJaxWsEndpointService.java122
-rw-r--r--org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/service/IWebServiceClient.java100
-rw-r--r--org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/session/DefaultServerSessionFactory.java204
-rw-r--r--org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/session/IServerSessionFactory.java50
-rw-r--r--org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/session/ServerSessionClassFinder.java328
-rw-r--r--org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/tool/JaxWsStubGenerator.java1044
-rw-r--r--org.eclipse.scout.net/.settings/org.eclipse.pde.core.prefs6
-rw-r--r--org.eclipse.scout.net/plugin.xml34
-rw-r--r--org.eclipse.scout.net/src/org/eclipse/scout/net/EclipseAuthenticator.java66
-rw-r--r--org.eclipse.scout.net/src/org/eclipse/scout/net/EclipseProxySelector.java380
-rw-r--r--org.eclipse.scout.net/src/org/eclipse/scout/net/NetActivator.java212
-rw-r--r--org.eclipse.scout.net/src/org/eclipse/scout/net/internal/EclipseAuthenticatorLocator.java100
-rw-r--r--org.eclipse.scout.net/src/org/eclipse/scout/net/internal/InternalEclipseAuthenticator.java172
-rw-r--r--org.eclipse.scout.net/src/org/eclipse/scout/net/internal/TTLCache.java384
-rw-r--r--org.eclipse.scout.net/src/org/eclipse/scout/net/tests/TestApplication.java82
-rw-r--r--org.eclipse.scout.net/src/org/eclipse/scout/net/tests/tests.product84
-rw-r--r--org.eclipse.scout.rt.client.mobile/.settings/org.eclipse.pde.core.prefs6
-rw-r--r--org.eclipse.scout.rt.client.mobile/plugin.xml52
-rw-r--r--org.eclipse.scout.rt.client.mobile/resources/html/MobileTableCellContent.html30
-rw-r--r--org.eclipse.scout.rt.client.mobile/resources/html/MobileTableDrillDown.html16
-rw-r--r--org.eclipse.scout.rt.client.mobile/resources/html/MobileTableDrillDownButton.html24
-rw-r--r--org.eclipse.scout.rt.client.mobile/resources/texts/Texts.properties22
-rw-r--r--org.eclipse.scout.rt.client.mobile/resources/texts/Texts_de.properties22
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/Activator.java122
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/Icons.java64
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/navigation/AbstractMobileBackAction.java86
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/navigation/AbstractMobileHomeAction.java100
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/navigation/BreadCrumb.java188
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/navigation/BreadCrumbsEvent.java68
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/navigation/BreadCrumbsListener.java40
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/navigation/BreadCrumbsNavigation.java784
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/navigation/BreadCrumbsNavigationService.java98
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/navigation/IBreadCrumb.java52
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/navigation/IBreadCrumbsNavigation.java94
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/navigation/IBreadCrumbsNavigationService.java50
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/navigation/OutlineChooserBreadCrumb.java80
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/services/MobileClientServiceFactory.java86
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/transformation/DeviceTransformationService.java104
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/transformation/IDeviceTransformationService.java46
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/transformation/IDeviceTransformer.java104
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/transformation/MobileDeviceTransformer.java820
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/transformation/TabletDeviceTransformer.java220
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/transformation/ToolFormCloseAction.java50
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/transformation/ToolFormHandler.java272
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/action/ActionButtonBarUtility.java176
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/action/ActionToButtonPropertyDelegator.java130
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/action/ButtonToActionPropertyDelegator.java132
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/action/ButtonWrappingAction.java98
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/AbstractMobileTable.java294
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/ClearTableSelectionFormCloseListener.java86
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/DrillDownStyleMap.java66
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/IMobileTable.java80
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/MobileTable.java972
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/MobileTablePropertyDelegator.java118
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/TablePropertyDelegator.java172
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/columns/AbstractRowSummaryColumn.java974
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/columns/IRowSummaryColumn.java60
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/TableRowForm.java438
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/TableRowFormHeaderActionFetcher.java106
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/BigDecimalColumnField.java78
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/BigDecimalColumnFieldPropertyDelegator.java74
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/BooleanColumnField.java80
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/ColumnFieldBuilder.java210
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/ColumnFieldPropertyDelegator.java94
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/DateColumnField.java78
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/DateColumnFieldPropertyDelegator.java68
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/DoubleColumnField.java78
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/DoubleColumnFieldPropertyDelegator.java74
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/IColumnWrapper.java40
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/IntegerColumnField.java78
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/IntegerColumnFieldPropertyDelegator.java66
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/LongColumnField.java78
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/LongColumnFieldPropertyDelegator.java66
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/SmartColumnField.java88
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/SmartColumnFieldPropertyDelegator.java66
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/StringColumnField.java100
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/StringColumnFieldPropertyDelegator.java76
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/desktop/ActiveOutlineObserver.java414
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/desktop/DeviceTransformationDesktopExtension.java382
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/desktop/MobileDesktopUtility.java450
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/desktop/MultiPageChangeStrategy.java248
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/AbstractFormActionFetcher.java86
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/AbstractMobileAction.java116
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/AbstractMobileForm.java194
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/FormFooterActionFetcher.java98
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/FormHeaderActionFetcher.java292
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/IActionFetcher.java44
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/IMobileAction.java64
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/IMobileForm.java68
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/FormFieldPropertyDelegator.java106
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/IWrapper.java40
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/PropertyBucket.java186
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/PropertyDelegator.java140
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/PropertyMap.java196
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/button/AbstractBackButton.java94
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/button/IMobileButton.java34
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/groupbox/GroupBoxPropertyDelegator.java114
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/smartfield/CustomTextLookupRow.java46
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/smartfield/MobileSmartFieldProposalFormProvider.java74
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/smartfield/MobileSmartTableForm.java530
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/smartfield/MobileSmartTreeForm.java522
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/tabbox/TabBoxGroupBox.java132
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/tabbox/TabBoxTableField.java338
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/tabbox/TabForm.java164
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/table/AbstractMobileTableField.java84
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/table/IMobileTableField.java50
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/AutoLeafPageWithNodes.java180
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/AutoOutline.java76
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/DefaultOutlineChooserForm.java372
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/IMainPageForm.java30
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/IMobileOutlineTableForm.java40
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/IOutlineChooserForm.java40
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/IPageForm.java52
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/MainPageForm.java68
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/PageForm.java1484
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/PageFormConfig.java100
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/PageFormFooterActionFetcher.java100
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/PageFormHeaderActionFetcher.java100
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/PageFormManager.java1060
-rw-r--r--org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/PageFormMap.java208
-rw-r--r--org.eclipse.scout.rt.client/.settings/org.eclipse.pde.core.prefs6
-rw-r--r--org.eclipse.scout.rt.client/Release Notes.txt1714
-rw-r--r--org.eclipse.scout.rt.client/resources/html/defaultWizardStatus.html156
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/AbstractClientSession.java1056
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/AbstractMemoryPolicy.java542
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/Activator.java88
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/BlockingCondition.java174
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ClientAsyncJob.java106
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ClientJob.java684
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ClientRule.java144
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ClientSessionThreadLocal.java60
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ClientSyncJob.java94
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ForceGCJob.java82
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/IClientSession.java294
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/IClientSessionProvider.java34
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/IJobChangeListenerEx.java72
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ILocaleListener.java40
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/IMemoryPolicy.java150
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/JobChangeAdapterEx.java50
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/LargeMemoryPolicy.java266
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/LocaleChangeEvent.java72
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/MediumMemoryPolicy.java400
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/SmallMemoryPolicy.java130
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/busy/AbstractBusyHandler.java510
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/busy/BusyJob.java226
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/busy/BusyManagerService.java408
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/busy/IBusyHandler.java114
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/busy/IBusyManagerService.java62
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/internal/TestLock.java140
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/ClientProxyServiceFactory.java324
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/ClientServiceFactory.java288
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/bookmark/BookmarkServiceEvent.java70
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/bookmark/BookmarkServiceListener.java38
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/bookmark/IBookmarkService.java134
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/bookmark/internal/BookmarkService.java486
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/bookmark/internal/BookmarkUtility.java1542
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/bookmark/internal/TestBookmarkUtility.java76
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/clientnotification/ClientNotificationConsumerEvent.java102
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/clientnotification/IClientNotificationConsumerListener.java82
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/clientnotification/IClientNotificationConsumerService.java146
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/clientnotification/internal/ClientNotificationConsumerService.java272
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/clipboard/IClipboardConsumer.java60
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/clipboard/IClipboardService.java114
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/code/CodeServiceClientProxy.java796
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/exceptionhandler/ClientExceptionHandlerService.java58
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/exceptionhandler/ErrorHandler.java498
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/exceptionhandler/UserInterruptedException.java46
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/exceptionhandler/internal/InternalClientExceptionHandlerService.java270
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/file/FileService.java588
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/file/IFileService.java126
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/icon/AbstractIconProviderService.java294
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/icon/IIconProviderService.java72
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/icon/IconProviderService.java136
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/icon/IconSpec.java98
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/perf/IPerformanceAnalyzerService.java58
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/perf/internal/PerformanceAnalyzerService.java182
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/perf/internal/PerformanceSampleSet.java118
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/platform/IPlatformService.java60
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/platform/PlatformService.java234
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/prefs/FileSystemUserPreferencesStorageService.java68
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/progress/ISimpleProgress.java46
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/progress/ISimpleProgressService.java70
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/progress/internal/SimpleProgress.java172
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/progress/internal/SimpleProgressService.java186
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/pwd/PasswordPolicyVerifier.java222
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/search/DefaultSearchFilterService.java252
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/search/ISearchFilterService.java56
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/search/LegacySearchFilterService.java204
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/search/TokenBasedSearchFilterService.java156
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/security/AccessControlServiceClientProxy.java454
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/security/PermissionServiceClientProxy.java162
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/session/DefaultClientSessionService.java146
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/session/IClientSessionRegistryService.java194
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/session/internal/ClientSessionRegistryService.java310
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/shell/DefaultShellService.java180
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/spellchecker/BundleResourceLocator.java112
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/spellchecker/IResourceLocator.java46
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/spellchecker/ISpellCheckerService.java600
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/spellchecker/ISpellingMonitor.java74
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/spellchecker/IUserDictionary.java48
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/spellchecker/RemoteFileResourceLocator.java72
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/spellchecker/forms/SpellCheckerLanguageLookupCall.java104
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/spellchecker/forms/SpellCheckerOptionsForm.java976
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/spellchecker/forms/SpellCheckerShortcutLookupCall.java86
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/test/AbstractClientTest.java68
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/test/ClientTestUtility.java506
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/useractivity/UserActivityEvent.java72
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/useractivity/UserActivityListener.java38
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/useractivity/UserActivityManager.java308
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/lookup/BatchLookupServiceClientProxy.java256
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/lookup/BatchSplit.java230
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/lookup/DefaultLookupCallProvisioningService.java56
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/lookup/FormFieldProvisioningContext.java50
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/lookup/ILookupCallProvisioningService.java80
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/lookup/IProvisioningContext.java36
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/lookup/TableProvisioningContext.java78
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/servicetunnel/AbstractServiceTunnel.java470
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/servicetunnel/IServiceTunnel.java124
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/servicetunnel/ServiceTunnelInvocationHandler.java108
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/servicetunnel/ServiceTunnelUtility.java94
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/servicetunnel/http/HttpServiceTunnel.java302
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/servicetunnel/http/internal/ClientNotificationPollingJob.java138
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/servicetunnel/http/internal/HttpBackgroundJob.java260
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/servicetunnel/http/internal/InternalHttpServiceTunnel.java568
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/servicetunnel/http/internal/TestSoapXml.java136
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/servicetunnel/http/tests/TestHttpServiceTunnel.java98
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/CurrentOutlineSearchFormUnitTest.java66
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/DefaultClientTestForm.java1310
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/DrilldownOutlineUnitTest.java848
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/DuplicateKeyStrokeUnitTest.java118
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/DuplicateMnemonicUnitTest.java112
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/ExistsLabelFieldsUnitTest.java114
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/ExistsMnemonicUnitTest.java92
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/FormBasedTestContext.java146
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/IPageTest.java86
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/LengthStringFieldsUnitTest.java132
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/UppercaseMnemonicUnitTest.java92
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/VisibleColumnLabelUnitTest.java132
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/VisibleFieldLabelUnitTest.java128
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/AbstractEventHistory.java100
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/BundleIconLocator.java100
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/ClientUIPreferences.java1756
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/DataChangeListener.java54
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/IDNDSupport.java134
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/IEventHistory.java92
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/IIconLocator.java52
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/IconLocator.java204
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/WeakDataChangeListener.java40
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/AbstractAction.java1280
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/ActionFinder.java136
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/IAction.java436
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/IActionUIFacade.java38
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/IActionVisitor.java68
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/keystroke/AbstractKeyStroke.java72
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/keystroke/DefaultFormEnterKeyStroke.java154
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/keystroke/DefaultFormEscapeKeyStroke.java150
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/keystroke/IKeyStroke.java46
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/keystroke/KeyStroke.java118
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/menu/AbstractMenu.java50
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/menu/IMenu.java40
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/menu/MenuSeparator.java74
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/menu/checkbox/AbstractCheckBoxMenu.java68
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/menu/checkbox/ICheckBoxMenu.java34
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/print/PrintApplicationAction.java586
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/print/PrintEvent.java72
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/print/PrintFormsAction.java562
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/print/PrintListener.java42
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/tool/AbstractToolButton.java48
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/tool/IToolButton.java42
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/tool/ToolButtonSeparator.java74
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/tree/AbstractActionNode.java320
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/tree/IActionNode.java104
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/view/AbstractViewButton.java48
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/view/IViewButton.java40
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/ActivityCell.java662
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/ActivityMapEvent.java444
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/ActivityMapListener.java38
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/IActivityCellObserver.java32
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/IActivityMap.java672
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/IActivityMapUIFacade.java86
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/IntradayTimeScale.java90
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/MajorTimeColumn.java224
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/MinorTimeColumn.java234
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/MultiTimeRange.java500
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/TestTimeScaleBuilder.java60
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/TimeRange.java102
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/TimeScale.java618
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/TimeScaleBuilder.java466
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/calendar/CalendarAdapter.java58
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/calendar/CalendarComponent.java446
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/calendar/CalendarEvent.java290
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/calendar/CalendarItemConflict.java120
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/calendar/CalendarListener.java46
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/calendar/DateTimeFormatFactory.java112
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/calendar/ICalendar.java328
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/calendar/ICalendarUIFacade.java70
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/calendar/provider/AbstractCalendarItemProvider.java900
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/calendar/provider/AbstractHolidayItemProvider.java122
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/calendar/provider/ICalendarItemProvider.java146
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/cell/Cell.java586
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/cell/CellExtension.java266
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/cell/CellStyle.java390
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/cell/ICell.java116
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/cell/ICellObserver.java58
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/cell/ICellSpecialization.java140
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/filechooser/FileChooser.java334
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/filechooser/IFileChooser.java108
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/AbstractCheckableTable.java410
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/AbstractSortOrderColumn.java42
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/AbstractTable.java8674
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/AbstractTableRowBuilder.java314
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/ColumnSet.java2026
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/DefaultTableEventHistory.java96
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/HeaderCell.java312
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/ICheckableTable.java74
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/IHeaderCell.java114
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/ISortOrderColumn.java40
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/ITable.java1686
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/ITableRow.java374
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/ITableRowFilter.java44
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/ITableUIFacade.java206
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/KeyStrokeBuffer.java80
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/OrganizeColumnsForm.java2382
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/RowIndexComparator.java64
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/TableAdapter.java58
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/TableEvent.java716
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/TableListener.java46
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/TableRow.java770
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/TableRowComparator.java100
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/TableRowMapper.java200
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/TableUtility.java746
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/TestMemoryUsage.java112
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columnfilter/BooleanColumnFilter.java198
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columnfilter/ColumnFilterForm.java1146
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columnfilter/ColumnFilterMenu.java94
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columnfilter/ComparableColumnFilter.java278
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columnfilter/DefaultTableColumnFilterManager.java606
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columnfilter/ITableColumnFilter.java74
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columnfilter/ITableColumnFilterManager.java162
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columnfilter/SmartColumnFilter.java226
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columnfilter/StringColumnFilter.java274
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columnfilter/TableColumnFilterEvent.java186
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columnfilter/TableColumnFilterListener.java46
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractBigDecimalColumn.java616
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractBooleanColumn.java206
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractColumn.java2838
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractDateColumn.java426
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractDateTimeColumn.java60
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractDoubleColumn.java602
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractIntegerColumn.java338
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractLongColumn.java338
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractObjectColumn.java102
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractSmartColumn.java540
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractStringColumn.java412
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractTimeColumn.java72
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/DefaultCellEditorForm.java94
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/DefaultCellEditorMainBox.java82
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/IBigDecimalColumn.java88
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/IBooleanColumn.java56
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/IColumn.java800
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/IDateColumn.java60
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/IDoubleColumn.java84
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/IIntegerColumn.java52
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/ILongColumn.java52
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/IObjectColumn.java30
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/ISmartColumn.java102
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/IStringColumn.java76
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/customizer/AbstractTableCustomizer.java104
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/customizer/AddCustomColumnMenu.java98
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/customizer/ICustomColumn.java40
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/customizer/ITableCustomizer.java122
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/customizer/ModifyCustomColumnMenu.java108
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/customizer/RemoveCustomColumnMenu.java116
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/internal/HolderToRowMapper.java64
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/internal/InternalTableRow.java1052
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/internal/RowToHolderMapper.java62
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/menus/CopyWidthsOfColumnsMenu.java160
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/menus/OrganizeColumnsMenu.java100
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/menus/ResetColumnsMenu.java288
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/AbstractTreeNode.java1922
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/AbstractTreeNodeBuilder.java196
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/DefaultTreeEventHistory.java100
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/ITree.java956
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/ITreeNode.java664
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/ITreeNodeFilter.java48
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/ITreeUIFacade.java98
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/ITreeVisitor.java34
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/IVirtualTreeNode.java78
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/TreeAdapter.java58
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/TreeEvent.java714
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/TreeListener.java46
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/TreeUtility.java234
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/VirtualTreeNode.java952
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/AbstractDesktop.java3762
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/AbstractDesktopExtension.java758
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/ContributionCommand.java54
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/DesktopEvent.java526
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/DesktopListener.java34
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/IDesktop.java878
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/IDesktopExtension.java430
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/IDesktopUIFacade.java128
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/AbstractBookmarkTreeField.java1980
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/BookmarkFolderForm.java204
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/BookmarkFolderLookupCall.java140
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/BookmarkForm.java476
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/IBookmarkForm.java140
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/IBookmarkNode.java66
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/KeyStrokeLookupCall.java166
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/internal/ManageBookmarksForm.java424
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/menu/AbstractBookmarkMenu.java600
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/menu/ActivateBookmarkKeyStroke.java92
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/menu/ActivateBookmarkMenu.java124
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/view/BookmarkViewForm.java756
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/view/IOpenBookmarkCommand.java58
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/view/IPublishBookmarkCommand.java64
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/internal/VirtualDesktop.java1066
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/navigation/INavigationHistoryService.java162
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/navigation/NavigationHistoryEvent.java98
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/navigation/NavigationHistoryListener.java38
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/navigation/internal/ActivateNavigationHistoryMenu.java92
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/navigation/internal/NavigationHistoryService.java250
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/navigation/internal/UserNavigationHistory.java796
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/AbstractFormToolButton.java270
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/AbstractOutline.java1126
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/AbstractOutlineButton.java326
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/AbstractOutlineTableField.java190
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/AbstractOutlineToolButton.java56
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/AbstractOutlineTreeField.java182
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/AbstractOutlineViewButton.java292
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/DefaultPageChangeStrategy.java178
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/IFormToolButton.java74
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/IOutline.java246
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/IOutlineTableForm.java54
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/IOutlineTreeForm.java44
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/IPageChangeStrategy.java42
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/ISearchFormToolButton.java38
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/OutlineMediator.java396
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/pages/AbstractPage.java1164
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/pages/AbstractPageWithTable.java1908
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/pages/AbstractSearchForm.java100
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/pages/IPage.java270
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/pages/IPageWithNodes.java96
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/pages/IPageWithTable.java170
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/pages/ISearchForm.java48
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/pages/VirtualPage.java232
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/AbstractForm.java5492
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/AbstractFormHandler.java538
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/DefaultFormEventHistory.java106
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/DefaultFormFieldInjection.java154
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/FormEvent.java322
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/FormFieldInjectionThreadLocal.java194
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/FormListener.java54
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/FormUtility.java366
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/IForm.java1196
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/IFormFieldInjection.java72
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/IFormFieldVisitor.java34
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/IFormHandler.java218
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/IFormUIFacade.java76
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/NullFormHandler.java30
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/PrintDevice.java84
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/ScoutInfoForm.java572
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/AbstractCompositeField.java752
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/AbstractFormField.java162
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/AbstractValueField.java1164
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/GridData.java148
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/ICompositeField.java148
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/IFormField.java1256
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/IValidateContentDescriptor.java68
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/IValueField.java220
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/MasterListener.java34
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/ParsingFailedStatus.java60
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/ScoutFieldStatus.java108
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/ValidateFormFieldDescriptor.java114
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/ValidationFailedStatus.java60
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/bigdecimalfield/AbstractBigDecimalField.java214
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/bigdecimalfield/IBigDecimalField.java38
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/bigintegerfield/AbstractBigIntegerField.java166
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/bigintegerfield/IBigIntegerField.java38
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/booleanfield/AbstractBooleanField.java222
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/booleanfield/IBooleanField.java50
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/booleanfield/IBooleanFieldUIFacade.java32
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/browserfield/AbstractBrowserField.java326
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/browserfield/IBrowserField.java116
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/browserfield/IBrowserFieldUIFacade.java44
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractButton.java952
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractCancelButton.java102
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractCloseButton.java102
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractFormStateButton.java150
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractLinkButton.java60
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractNonFocusableButton.java66
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractNonFocusableRadioButton.java78
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractOkButton.java102
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractRadioButton.java66
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractResetButton.java102
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractSaveButton.java102
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractSearchButton.java102
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/ButtonEvent.java154
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/ButtonListener.java34
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/IButton.java248
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/IButtonUIFacade.java64
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/calendarfield/AbstractCalendarField.java312
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/calendarfield/ICalendarField.java56
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/chartbox/AbstractChartBox.java216
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/chartbox/ChartBoxEvent.java66
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/chartbox/ChartBoxListener.java34
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/chartbox/IChartBox.java68
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/chartbox/IChartBoxUIFacade.java30
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/checkbox/AbstractCheckBox.java58
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/checkbox/ICheckBox.java44
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/AbstractComposerField.java1792
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/AbstractComposerValueBox.java2604
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/AbstractDataModelAggregationField.java228
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/AbstractDataModelOperatorField.java162
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/ComposerFieldDataModel.java138
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/DataModelAggregationLookupCall.java276
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/DataModelOperatorLookupCall.java124
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/IComposerField.java112
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/IComposerFieldUIFacade.java30
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/IComposerValueField.java92
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/attribute/AbstractComposerAttribute.java224
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/attribute/IComposerAttribute.java72
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/attribute/LegacyComposerAttributeInjector.java416
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/entity/AbstractComposerEntity.java164
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/entity/IComposerEntity.java68
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/internal/ComposerAttributeForm.java792
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/internal/ComposerDisplayTextBuilder.java152
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/internal/LegacyComposerStatementBuilder.java466
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/internal/TokenBasedComposerStatementBuilder.java238
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/node/AbstractAddAttributeMenu.java176
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/node/AbstractComposerNode.java212
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/node/AddEntityMenu.java104
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/node/AttributeNode.java360
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/node/EitherOrNode.java366
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/node/EntityNode.java350
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/node/RootNode.java170
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/customfield/AbstractCustomField.java80
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/customfield/ICustomField.java56
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/datefield/AbstractDateField.java2156
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/datefield/AbstractDateTimeField.java72
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/datefield/AbstractTimeField.java82
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/datefield/AbstractUTCDateField.java78
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/datefield/IDateField.java140
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/datefield/IDateFieldUIFacade.java78
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/datefield/IUTCDateField.java40
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/decimalfield/AbstractDecimalField.java730
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/decimalfield/IDecimalField.java118
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/decimalfield/IDecimalFieldUIFacade.java34
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/documentfield/AbstractDocumentField.java418
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/documentfield/DocumentFieldEvent.java190
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/documentfield/DocumentFieldListener.java38
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/documentfield/IDocumentField.java124
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/documentfield/IDocumentFieldUIFacade.java40
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/documentfield/eventdata/SaveAsData.java82
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/doublefield/AbstractDoubleField.java212
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/doublefield/IDoubleField.java34
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/filechooserfield/AbstractFileChooserField.java998
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/filechooserfield/IFileChooserField.java176
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/filechooserfield/IFileChooserFieldUIFacade.java42
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/groupbox/AbstractGroupBox.java1062
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/groupbox/IGroupBox.java322
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/groupbox/IGroupBoxUIFacade.java40
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/groupbox/internal/GridCell.java362
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/groupbox/internal/GroupBoxBodyGrid.java450
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/groupbox/internal/GroupBoxProcessButtonGrid.java146
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/htmlfield/AbstractHtmlField.java578
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/htmlfield/IHtmlField.java170
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/htmlfield/IHtmlFieldUIFacade.java50
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/imagebox/AbstractImageField.java968
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/imagebox/IImageField.java244
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/imagebox/IImageFieldUIFacade.java58
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/imagebox/ImageFieldEvent.java204
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/imagebox/ImageFieldListener.java38
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/integerfield/AbstractIntegerField.java166
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/integerfield/IIntegerField.java34
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/internal/GridDataBuilder.java54
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/internal/TestHolder.java56
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/labelfield/AbstractLabelField.java172
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/labelfield/ILabelField.java46
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/labelfield/ILabelFieldUIFacade.java30
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/listbox/AbstractListBox.java2082
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/listbox/AbstractListBoxFilterBox.java696
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/listbox/ActiveOrCheckedRowsFilter.java86
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/listbox/CheckedRowsFilter.java64
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/listbox/IListBox.java330
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/listbox/IListBoxUIFacade.java30
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/longfield/AbstractLongField.java164
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/longfield/ILongField.java34
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/mailfield/AbstractMailField.java480
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/mailfield/IMailField.java104
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/mailfield/IMailFieldUIFacade.java58
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/matrixfield/AbstractMatrixField.java70
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/matrixfield/IMatrixField.java42
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/numberfield/AbstractNumberField.java440
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/numberfield/INumberField.java84
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/numberfield/INumberFieldUIFacade.java34
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/pagefield/AbstractPageField.java384
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/pagefield/IPageField.java70
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/placeholder/AbstractPlaceholderField.java66
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/placeholder/IPlaceholderField.java34
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/plannerfield/AbstractPlannerField.java840
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/plannerfield/IPlannerField.java184
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/plannerfield/IPlannerFieldUIFacade.java34
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/radiobuttongroup/AbstractRadioButtonGroup.java1288
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/radiobuttongroup/IRadioButtonGroup.java98
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/radiobuttongroup/internal/RadioButtonGroupGrid.java190
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/sequencebox/AbstractSequenceBox.java828
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/sequencebox/ISequenceBox.java50
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/sequencebox/InvalidSequenceStatus.java66
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/sequencebox/internal/SequenceBoxGrid.java170
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/smartfield/AbstractSmartFieldProposalForm.java116
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/smartfield/DefaultSmartFieldProposalFormProvider.java68
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/smartfield/ISmartField.java504
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/smartfield/ISmartFieldProposalForm.java110
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/smartfield/ISmartFieldProposalFormProvider.java44
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/smartfield/ISmartFieldUIFacade.java60
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/smartfield/SmartFieldEvent.java62
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/smartfield/SmartFieldListener.java34
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/smartfield/SmartTableForm.java1144
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/smartfield/SmartTreeForm.java1704
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/snapbox/AbstractSnapBox.java126
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/snapbox/ISnapBox.java34
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/snapbox/internal/SnapBoxGrid.java152
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/splitbox/AbstractSplitBox.java360
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/splitbox/ISplitBox.java126
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/splitbox/ISplitboxUIFacade.java30
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/splitbox/internal/SplitBoxGrid.java158
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/stringfield/AbstractStringField.java1022
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/stringfield/IStringField.java226
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/stringfield/IStringFieldUIFacade.java78
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/tabbox/AbstractTabBox.java352
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/tabbox/ITabBox.java68
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/tabbox/ITabBoxUIFacade.java34
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/tabbox/internal/TabBoxGrid.java154
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/tablefield/AbstractTableField.java1474
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/tablefield/ITableField.java262
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/tablefield/ValidateTableFieldDescriptor.java140
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/textfield/AbstractTextField.java58
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/textfield/ITextField.java42
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/treebox/AbstractTreeBox.java2248
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/treebox/AbstractTreeBoxFilterBox.java772
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/treebox/ActiveOrCheckedNodesFilter.java82
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/treebox/CheckedNodesFilter.java64
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/treebox/ITreeBox.java314
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/treebox/ITreeBoxUIFacade.java30
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/treefield/AbstractTreeField.java862
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/treefield/ITreeField.java104
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/wrappedform/AbstractWrappedFormField.java450
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/wrappedform/IWrappedFormField.java72
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/internal/FindFieldByFormDataIdVisitor.java214
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/internal/FindFieldBySimpleClassNameVisitor.java72
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/internal/FindFieldByXmlIdsVisitor.java286
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/internal/FormDataPropertyFilter.java104
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/outline/DefaultOutlineTableForm.java340
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/outline/DefaultOutlineTreeForm.java290
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/useradmin/DefaultPasswordForm.java400
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/messagebox/IMessageBox.java190
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/messagebox/IMessageBoxUIFacade.java34
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/messagebox/MessageBox.java984
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/messagebox/MessageBoxEvent.java128
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/messagebox/MessageBoxListener.java34
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/profiler/DesktopProfiler.java490
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/AbstractWizard.java2410
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/AbstractWizardContainerForm.java302
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/AbstractWizardStatusField.java388
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/AbstractWizardStep.java768
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/DefaultWizardContainerForm.java832
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/DefaultWizardStatusHtmlProvider.java380
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/IWizard.java732
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/IWizardContainerForm.java74
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/IWizardStatusHtmlProvider.java88
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/IWizardStep.java188
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/WizardEvent.java92
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/WizardListener.java36
-rw-r--r--org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/WrappedWizardWizardStep.java128
-rw-r--r--org.eclipse.scout.rt.extension.client.test.fragment/.settings/org.eclipse.pde.core.prefs6
-rw-r--r--org.eclipse.scout.rt.extension.client.test.fragment/fragment.xml306
-rw-r--r--org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/EnclosingObjectFixture.java172
-rw-r--r--org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/internal/CompositeExtensionFilterTest.java116
-rw-r--r--org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/action/menu/CompositeMenuFilterTest.java190
-rw-r--r--org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/action/menu/internal/MenuAnchorFilterTest.java188
-rw-r--r--org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/action/menu/internal/MenuContributionExtensionTest.java388
-rw-r--r--org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/action/menu/internal/MenuExtensionTest.java148
-rw-r--r--org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/basic/table/ExtensibleTableTest.java154
-rw-r--r--org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/CompositePageFilterTest.java212
-rw-r--r--org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/PageContributionIntegrationTest.java234
-rw-r--r--org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/PageExtensionUtilityTest.java670
-rw-r--r--org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/PageModificationIntegrationTest.java284
-rw-r--r--org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/PageRemovalIntegrationTest.java240
-rw-r--r--org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/APageFilter.java52
-rw-r--r--org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/BPageFilter.java52
-rw-r--r--org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/DynamicOutline.java72
-rw-r--r--org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/contribution/AContributionPageWithNodes.java40
-rw-r--r--org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/contribution/BContributionPageWithNodes.java40
-rw-r--r--org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/contribution/CContributionPageWithNodes.java40
-rw-r--r--org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/contribution/DContributionPageWithNodes.java40
-rw-r--r--org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/contribution/PageContributionNodePage.java66
-rw-r--r--org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/contribution/PageContributionOutline.java66
-rw-r--r--org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/modification/AModificationPageWithNodes.java62
-rw-r--r--org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/modification/AbstractCModificationPageWithNodes.java62
-rw-r--r--org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/modification/BModificationPageWithNodes.java62
-rw-r--r--org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/modification/C1ModificationPageWithNodes.java58
-rw-r--r--org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/modification/C2ModificationPageWithNodes.java58
-rw-r--r--org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/modification/IModifiablePage.java46
-rw-r--r--org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/modification/MarkingPageModification.java54
-rw-r--r--org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/modification/PageModificationNodePage.java62
-rw-r--r--org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/modification/PageModificationOutline.java62
-rw-r--r--org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/modification/PageModificationTablePage.java102
-rw-r--r--org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/remove/ARemovePageWithNodes.java40
-rw-r--r--org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/remove/AbstractCRemovePageWithNodes.java40
-rw-r--r--org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/remove/BRemovePageWithNodes.java40
-rw-r--r--org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/remove/C1RemovePageWithNodes.java40
-rw-r--r--org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/remove/C2RemovePageWithNodes.java38
-rw-r--r--org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/remove/PageRemoveNodePage.java62
-rw-r--r--org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/remove/PageRemoveOutline.java62
-rw-r--r--org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/internal/PageAnchorFilterTest.java164
-rw-r--r--org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/internal/PageContributionExtensionTest.java532
-rw-r--r--org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/internal/PageExtensionTest.java206
-rw-r--r--org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/internal/PageModificationExtensionTest.java280
-rw-r--r--org.eclipse.scout.rt.extension.client/.settings/org.eclipse.pde.core.prefs6
-rw-r--r--org.eclipse.scout.rt.extension.client/schema/desktopExtensions.exsd228
-rw-r--r--org.eclipse.scout.rt.extension.client/schema/pages.exsd524
-rw-r--r--org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/IExtensibleScoutObject.java40
-rw-r--r--org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/IWrappedObject.java52
-rw-r--r--org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/Replace.java64
-rw-r--r--org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/internal/AbstractCompositeExtensionFilter.java142
-rw-r--r--org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/internal/IExtensionProcessor.java74
-rw-r--r--org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/action/menu/CompositeMenuFilter.java84
-rw-r--r--org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/action/menu/IMenuExtensionFilter.java108
-rw-r--r--org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/action/menu/IMenuModifier.java90
-rw-r--r--org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/action/menu/internal/AbstractMenuExtension.java98
-rw-r--r--org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/action/menu/internal/MenuAnchorFilter.java82
-rw-r--r--org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/action/menu/internal/MenuContributionExtension.java152
-rw-r--r--org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/action/menu/internal/MenuModificationExtension.java136
-rw-r--r--org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/action/menu/internal/MenuRemoveExtension.java72
-rw-r--r--org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/AbstractExtensibleDesktop.java78
-rw-r--r--org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/internal/DesktopExtensionManager.java156
-rw-r--r--org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/internal/DesktopMenuInjectingDesktopExtension.java256
-rw-r--r--org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/internal/OrderedMenuWrapper.java646
-rw-r--r--org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/AbstractExtensibleOutline.java72
-rw-r--r--org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/AbstractExtensiblePageWithNodes.java144
-rw-r--r--org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/AbstractExtensiblePageWithTable.java130
-rw-r--r--org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/CompositePageFilter.java86
-rw-r--r--org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/IPageExtensionFilter.java80
-rw-r--r--org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/IPageModifier.java76
-rw-r--r--org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/PageExtensionUtility.java390
-rw-r--r--org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/internal/AbstractPageExtension.java122
-rw-r--r--org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/internal/PageAnchorFilter.java96
-rw-r--r--org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/internal/PageContributionExtension.java226
-rw-r--r--org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/internal/PageModificationExtension.java160
-rw-r--r--org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/internal/PageRemoveExtension.java100
-rw-r--r--org.eclipse.scout.rt.feature.about/about.ini56
-rw-r--r--org.eclipse.scout.rt.jdbc.derby/.settings/org.eclipse.pde.core.prefs6
-rw-r--r--org.eclipse.scout.rt.jdbc.derby/src/org/eclipse/scout/rt/services/common/jdbc/AbstractDerbySqlService.java134
-rw-r--r--org.eclipse.scout.rt.jdbc.derby/src/org/eclipse/scout/rt/services/common/jdbc/style/DerbySqlStyle.java514
-rw-r--r--org.eclipse.scout.rt.server/.settings/org.eclipse.pde.core.prefs6
-rw-r--r--org.eclipse.scout.rt.server/Release Notes.txt808
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/AbstractServerSession.java512
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/BusinessOperationDispatcher.java56
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/DefaultTransactionDelegate.java1042
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/IServerSession.java90
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/IServerSessionProvider.java34
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/RemoteFileServlet.java382
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/ResourceServlet.java456
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/ServerApplication.java92
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/ServerJob.java646
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/ServerJobServletFilter.java300
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/ServiceTunnelServlet.java894
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/SoapWsseJaasFilter.java740
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/ThreadContext.java186
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/ThreadContextLegacy.java378
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/VirtualSessionCache.java124
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/AbstractHtmlAction.java142
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/AdminSession.java208
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/IHtmlEmitter.java40
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/IView.java48
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/view/CallsView.java664
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/view/DefaultView.java90
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/view/GeneralView.java548
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/view/MessagesView.java168
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/view/ServicesView.java854
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/view/SessionsView.java368
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/view/TopView.java232
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/widget/table/HtmlComponent.java666
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/widget/table/HtmlTable.java238
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/widget/table/SortInfo.java64
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/widget/table/VirtualRow.java100
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/inspector/CallInspector.java154
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/inspector/ProcessInspector.java298
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/inspector/ReflectServiceInventory.java268
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/inspector/ServiceInspector.java118
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/inspector/SessionInspector.java230
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/inspector/info/CallInfo.java226
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/inspector/info/SessionInfo.java152
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/internal/Activator.java276
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/internal/ServerApplicationContext.java134
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/AbstractSchedulerJob.java208
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/AbstractSchedulerJobWithFormula.java176
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/IScheduler.java208
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/ISchedulerJob.java108
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/ISchedulingFormula.java40
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/Scheduler.java860
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/SchedulerAccessor.java246
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/TickSignal.java222
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/Ticker.java290
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/FormulaParser.java1160
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/SchedulingFormula.java76
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/AbstractNode.java30
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/AbstractOperation.java102
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/ArgRef.java94
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/BooleanAtom.java74
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/FormulaRoot.java70
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/INode.java44
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/IntegerAtom.java74
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/NotToken.java78
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/NullAtom.java62
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/Op.java676
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/SignalRef.java266
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/StringAtom.java82
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/WrappedToken.java78
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/visitor/DefaultEvalVisitor.java106
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/visitor/DefaultFormatVisitor.java76
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/visitor/IEvalVisitor.java48
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/visitor/IFormatVisitor.java46
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/ServerServiceFactory.java298
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/bookmark/AbstractBookmarkStorageService.java314
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/bookmark/AbstractSqlBookmarkStorageService.java540
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/bookmark/FileSystemBookmarkStorageService.java420
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/calendar/HolidayCalendarService.java132
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/clientnotification/AllUserFilter.java128
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/clientnotification/ClientNotificationQueueEvent.java86
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/clientnotification/IClientNotificationFilter.java122
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/clientnotification/IClientNotificationQueueListener.java38
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/clientnotification/IClientNotificationService.java80
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/clientnotification/PrincipalNameFilter.java204
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/clientnotification/SessionFilter.java156
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/clientnotification/SingleUserFilter.java152
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/clientnotification/internal/ClientNotificationQueue.java382
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/clientnotification/internal/ClientNotificationService.java108
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/code/CodeService.java434
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/code/CodeTypeCache.java266
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/code/CodeTypeStore.java272
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/csv/CsvSqlAdapter.java744
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/csv/CsvSqlSettings.java364
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/file/RemoteFileService.java708
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/imap/AbstractIMAPService.java596
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/imap/IIMAPService.java60
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/imap/ImapAdapter.java690
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/AbstractSqlService.java1862
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/AbstractSqlTransactionMember.java166
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/ByteArrayRowVisitor.java124
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/ISelectStreamHandler.java52
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/ISqlService.java632
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/IStatementCache.java56
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/IStatementProcessor.java72
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/IStatementProcessorMonitor.java66
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/SQL.java384
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/SqlBind.java108
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/AliasMapper.java500
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/BasicPartDefinition.java562
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/ComposerAttributePartDefinition.java92
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/ComposerEntityPartDefinition.java74
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/DataModelAttributePartDefinition.java320
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/DataModelEntityPartDefinition.java290
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/EntityContribution.java470
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/EntityContributionUtility.java756
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/ExampleFullTextPartDefinition.java90
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/FormDataStatementBuilder.java4092
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/FormDataStatementBuilderCheck.java586
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/FormDataStatementBuilderInjectionAdapter.java76
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/IFormDataStatementBuilderInjection.java114
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/LegacyFormDataStatementBuilder.java240
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/TokenBasedStatementBuilder.java794
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/ValuePartDefinition.java346
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/dict/ColumnDesc.java186
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/dict/CongruencyFilter.java440
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/dict/DataDictionary.java256
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/dict/IndexDesc.java116
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/dict/OracleCongruencyFilter.java174
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/dict/OracleDataDictionaryBuilder.java454
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/dict/PrimaryKeyDesc.java102
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/dict/SequenceDesc.java160
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/dict/TableDesc.java302
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/dict/TableGrantDesc.java102
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/dict/ViewDesc.java146
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/AbstractBeanPropertyOutput.java296
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/ArrayHolderOutput.java186
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/ArrayInput.java294
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/BeanArrayHolderInput.java144
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/BeanArrayHolderOutput.java188
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/BeanPropertyInput.java374
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/FunctionInput.java254
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/IBindInput.java78
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/IBindOutput.java88
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/MapOutput.java202
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/PreparedStatementCache.java284
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/SingleHolderOutput.java194
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/SingleInput.java200
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/StatementProcessor.java2806
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/TableHolderInput.java234
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/TableHolderOutput.java224
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/TestStatementProcessor.java356
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/TriStateInput.java144
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/legacy/LegacyStatementBuilder.java646
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/pool/ConnectionCloseThread.java84
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/pool/PoolEntry.java40
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/pool/SqlConnectionBuilder.java254
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/pool/SqlConnectionPool.java552
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/style/AbstractSqlStyle.java2054
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/style/DB2OracleModeSqlStyle.java76
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/style/DB2SqlStyle.java132
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/style/ISqlStyle.java2232
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/style/MSSQLSqlStyle.java152
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/style/OracleSqlStyle.java298
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jms/AbstractJmsConsumerService.java372
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jms/IJmsCallback.java62
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jms/IJmsConsumerService.java46
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jms/JmsJndiConfig.java382
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jms/JmsObserver.java610
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jms/internal/ExampleJmsConsumer.java76
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jms/internal/JmsTransactionMember.java964
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/offline/OfflineDispatcherService.java492
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/ping/PingService.java56
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/pop3/IPOP3MessageVisitor.java46
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/pop3/POP3Adapter.java632
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/processing/ServerProcessingCancelService.java50
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/pwd/AbstractPasswordManagementService.java144
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/pwd/DefaultPasswordPolicy.java118
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/pwd/IPasswordPolicy.java80
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/security/AbstractAccessControlService.java540
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/security/LogoutService.java84
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/security/PermissionService.java200
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/security/internal/AccessControlStore.java304
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/session/DefaultServerSessionService.java144
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/session/IServerSessionRegistryService.java76
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/session/ServerSessionRegistryService.java128
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/smtp/AbstractSMTPService.java650
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/smtp/ISMTPService.java258
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/test/AbstractServerTest.java68
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/test/DefaultLookupServicesTest.java140
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/test/ServerTestUtility.java96
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/useractivity/AbstractUserActivityStateService.java118
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/workflow/AbstractWorkflowService.java704
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/workflow/AbstractWorkflowStep.java204
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/workflow/IWorkflowService.java178
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/workflow/IWorkflowStep.java80
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/workflow/WorkflowProviderService.java182
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/lookup/AbstractLookupService.java154
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/lookup/AbstractSqlLookupService.java338
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/lookup/BatchLookupService.java144
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/servlet/filter/AbstractChainableSecurityFilter.java40
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/servlet/filter/AnonymousSecurityFilter.java40
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/servlet/filter/BasicSecurityFilter.java40
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/servlet/filter/DataSourceSecurityFilter.java38
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/servlet/filter/LDAPSecurityFilter.java40
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/servlet/filter/TomcatSecurityFilter.java38
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/servlet/test/TestServlet.java442
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/servlet/test/TestSoapWsseJaasFilter.java74
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/servlet/test/test-request.xml24
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/transaction/AbstractTransactionMember.java66
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/transaction/BasicTransaction.java508
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/transaction/ITransaction.java220
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/transaction/ITransactionMember.java110
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/transaction/internal/ActiveTransactionRegistry.java206
-rw-r--r--org.eclipse.scout.rt.shared.legacy.texts.fragment/fragment.xml28
-rw-r--r--org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts.properties594
-rw-r--r--org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_bg.properties16
-rw-r--r--org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_cs.properties4
-rw-r--r--org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_da.properties4
-rw-r--r--org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_de.properties584
-rw-r--r--org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_el.properties178
-rw-r--r--org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_es.properties320
-rw-r--r--org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_fi.properties16
-rw-r--r--org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_fr.properties584
-rw-r--r--org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_fr_BE.properties18
-rw-r--r--org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_hr.properties16
-rw-r--r--org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_hu.properties16
-rw-r--r--org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_it.properties596
-rw-r--r--org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_ja.properties330
-rw-r--r--org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_nl.properties20
-rw-r--r--org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_nl_BE.properties18
-rw-r--r--org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_no.properties16
-rw-r--r--org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_pl.properties16
-rw-r--r--org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_pt_br.properties320
-rw-r--r--org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_ru.properties16
-rw-r--r--org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_se.properties16
-rw-r--r--org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_sk.properties172
-rw-r--r--org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_sl.properties2
-rw-r--r--org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_sr.properties16
-rw-r--r--org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_tr.properties18
-rw-r--r--org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_zh.properties16
-rw-r--r--org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_zh_TW.properties16
-rw-r--r--org.eclipse.scout.rt.shared.legacy.texts.fragment/src/org/eclipse/scout/rt/shared/legacy/texts/services/common/text/ScoutLegacyTextProviderService.java46
-rw-r--r--org.eclipse.scout.rt.shared.test/.project68
-rw-r--r--org.eclipse.scout.rt.shared.test/.settings/de.loskutov.anyedit.AnyEditTools.prefs30
-rw-r--r--org.eclipse.scout.rt.shared.test/.settings/org.eclipse.core.resources.prefs4
-rw-r--r--org.eclipse.scout.rt.shared.test/.settings/org.eclipse.jdt.core.prefs742
-rw-r--r--org.eclipse.scout.rt.shared.test/.settings/org.eclipse.jdt.ui.prefs230
-rw-r--r--org.eclipse.scout.rt.shared.test/.settings/org.eclipse.m2e.core.prefs8
-rw-r--r--org.eclipse.scout.rt.shared.test/.settings/org.eclipse.pde.core.prefs6
-rw-r--r--org.eclipse.scout.rt.shared.test/about.html54
-rw-r--r--org.eclipse.scout.rt.shared.test/build.properties24
-rw-r--r--org.eclipse.scout.rt.shared.test/src/org/eclipse/scout/rt/shared/services/lookup/LookupRowTest.java90
-rw-r--r--org.eclipse.scout.rt.shared/.settings/org.eclipse.pde.core.prefs6
-rw-r--r--org.eclipse.scout.rt.shared/ReleaseNotes.txt376
-rw-r--r--org.eclipse.scout.rt.shared/resources/texts/ScoutTexts.properties1002
-rw-r--r--org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_bg.properties448
-rw-r--r--org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_cs.properties322
-rw-r--r--org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_da.properties194
-rw-r--r--org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_de.properties996
-rw-r--r--org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_el.properties568
-rw-r--r--org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_es.properties544
-rw-r--r--org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_fi.properties440
-rw-r--r--org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_fr.properties944
-rw-r--r--org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_fr_BE.properties778
-rw-r--r--org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_hr.properties532
-rw-r--r--org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_hu.properties444
-rw-r--r--org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_it.properties944
-rw-r--r--org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_ja.properties274
-rw-r--r--org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_nl.properties774
-rw-r--r--org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_nl_BE.properties772
-rw-r--r--org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_no.properties448
-rw-r--r--org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_pl.properties448
-rw-r--r--org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_pt_br.properties504
-rw-r--r--org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_ru.properties446
-rw-r--r--org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_se.properties452
-rw-r--r--org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_sk.properties468
-rw-r--r--org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_sl.properties76
-rw-r--r--org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_sr.properties434
-rw-r--r--org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_tr.properties448
-rw-r--r--org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_zh.properties440
-rw-r--r--org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_zh_TW.properties448
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/AbstractIcons.java132
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/Activator.java90
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/ContextMap.java150
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/ISession.java134
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/OfficialVersion.java52
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/OfflineState.java128
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/ScoutTexts.java208
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/TEXTS.java158
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/TextsThreadLocal.java60
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/TierState.java156
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/WebClientState.java150
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/basic/AffineTransformSpec.java88
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/basic/BoundsSpec.java62
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/basic/FontSpec.java318
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/basic/MemoryOptimizedObject.java204
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/basic/table/SortSpec.java164
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/AbstractFormData.java692
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/FormDataUtility.java88
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/ValidationRule.java398
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/fields/AbstractFormFieldData.java340
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/fields/AbstractUTCFieldData.java40
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/fields/AbstractValueFieldData.java126
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/fields/composer/AbstractComposerData.java54
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/fields/composer/ComposerAttributeNodeData.java146
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/fields/composer/ComposerConstants.java42
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/fields/composer/ComposerEitherOrNodeData.java84
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/fields/composer/ComposerEntityNodeData.java140
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/fields/tablefield/AbstractTableFieldData.java288
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/fields/treefield/AbstractTreeFieldData.java88
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/fields/treefield/TreeNodeData.java172
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/properties/AbstractPropertyData.java160
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/AbstractDataModel.java292
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/AbstractDataModelAttribute.java1358
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/AbstractDataModelEntity.java726
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/AttributePath.java154
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/DataModelAttributeInjector.java524
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/DataModelAttributeOp.java2758
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/DataModelConstants.java1358
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/DataModelUtility.java1012
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/EntityPath.java438
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/IDataModel.java54
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/IDataModelAttribute.java310
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/IDataModelAttributeOp.java78
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/IDataModelEntity.java234
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/BasicHierarchyPermission.java418
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/CopyToClipboardPermission.java42
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/CreateCustomColumnPermission.java42
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/CreateGlobalBookmarkPermission.java44
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/CreateUserBookmarkPermission.java44
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/DeleteCustomColumnPermission.java42
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/DeleteGlobalBookmarkPermission.java44
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/DeleteUserBookmarkPermission.java44
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/FineGrainedAccessCheckRequiredException.java52
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/NoAccessPermission.java60
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/PublishUserBookmarkPermission.java44
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/ReadGlobalBookmarkPermission.java44
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/ReadUserBookmarkPermission.java44
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/RemoteServiceAccessPermission.java134
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/ServicePermission.java60
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/UpdateCustomColumnPermission.java42
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/UpdateGlobalBookmarkPermission.java44
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/UpdateServiceConfigurationPermission.java44
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/UpdateUserBookmarkPermission.java44
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/bookmark/AbstractPageState.java136
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/bookmark/Bookmark.java530
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/bookmark/BookmarkChangedClientNotification.java52
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/bookmark/BookmarkData.java142
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/bookmark/BookmarkFolder.java468
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/bookmark/IBookmarkStorageService.java112
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/bookmark/IBookmarkVisitor.java56
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/bookmark/NodePageState.java60
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/bookmark/TableColumnState.java200
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/bookmark/TablePageState.java370
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/AbstractCalendarItem.java354
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/CalendarAppointment.java464
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/CalendarTask.java352
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/HolidayCalendarItemParser.java538
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/HolidayItem.java50
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/ICalendarAppointment.java114
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/ICalendarItem.java140
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/ICalendarService.java68
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/ICalendarTask.java66
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/IHolidayCalendarService.java62
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/RecurrenceException.java106
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/RecurrencePattern.java1344
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/clientnotification/AbstractClientNotification.java80
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/clientnotification/IClientNotification.java118
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/code/AbstractCode.java784
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/code/AbstractCodeType.java1044
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/code/CODES.java132
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/code/CodeRow.java544
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/code/CodeTypeChangedNotification.java128
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/code/ICode.java178
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/code/ICodeService.java146
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/code/ICodeType.java164
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/code/ICodeVisitor.java40
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/code/MutableCode.java38
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/context/SharedContextChangedNotification.java84
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/context/SharedVariableMap.java332
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/exceptionhandler/IExceptionHandlerService.java50
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/exceptionhandler/LogExceptionHandlerService.java160
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/file/CompressedOutputStream.java150
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/file/CompressedWriter.java164
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/file/DecompressedInputStream.java108
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/file/DecompressedReader.java126
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/file/IRemoteFileService.java156
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/file/RemoteFile.java1248
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/jdbc/ILegacySqlQueryService.java76
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/jdbc/LegacySearchFilter.java546
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/jdbc/LegacySearchUtility.java226
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/jdbc/SearchFilter.java230
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/jdbc/TokenBasedSearchFilter.java422
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/offline/IOfflineDispatcherService.java74
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/ping/IPingService.java48
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/prefs/IUserPreferencesStorageService.java66
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/processing/IServerProcessingCancelService.java62
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/pwd/IPasswordManagementService.java116
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/security/ACCESS.java144
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/security/AccessControlChangedNotification.java80
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/security/AccessControlUtility.java210
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/security/IAccessControlService.java168
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/security/ILogoutService.java62
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/security/IPermissionService.java58
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/security/ResetAccessControlChangedNotification.java60
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/session/IJobRunnable.java64
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/session/ISessionService.java104
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/shell/IShellService.java68
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/test/AbstractTest.java550
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/test/BasicTestContext.java112
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/test/HudsonTestContext.java58
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/test/ITest.java110
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/test/ITestContext.java80
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/test/TestStatus.java170
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/test/TestUtility.java140
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/text/AbstractDynamicNlsDocumentationTextProviderService.java16
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/text/AbstractDynamicNlsTextProviderService.java106
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/text/IDocumentationTextProviderService.java40
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/text/ITextProviderService.java104
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/text/ScoutTextProviderService.java48
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/useractivity/IUserActivityProvider.java70
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/useractivity/IUserActivityStateService.java72
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/useractivity/UserActivityClientNotification.java68
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/useractivity/UserStatusMap.java76
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/workflow/AbstractWorkflowData.java688
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/workflow/AbstractWorkflowStepData.java344
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/workflow/IWorkflowProviderService.java192
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/AbstractCodeTypeLookupCall.java130
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/BatchLookupCall.java82
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/BatchLookupNormalizer.java220
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/BatchLookupResultCache.java340
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/CodeLookupCall.java616
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/DefaultCodeLookupCallFactoryService.java56
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/IBatchLookupService.java86
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/ICodeLookupCallFactoryService.java62
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/ICodeLookupCallVisitor.java44
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/ILookupCallFetcher.java74
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/ILookupService.java78
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/LocalLookupCall.java290
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/LookupCall.java1094
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/LookupRow.java582
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/DebugInputStream.java178
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/DebugOutputStream.java136
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/DefaultServiceTunnelContentHandler.java1000
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/HttpException.java162
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/IServiceTunnelContentHandler.java82
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/LenientPermissionWrapper.java182
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/LenientPermissionsWrapper.java144
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/RemoteServiceAccessDenied.java64
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/ServiceTunnelAccessDenied.java50
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/ServiceTunnelInputStream.java80
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/ServiceTunnelOutputStream.java90
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/ServiceTunnelRequest.java412
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/ServiceTunnelResponse.java222
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/StaticDate.java146
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/VersionMismatchException.java86
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/ui/DefaultUserAgentParser.java138
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/ui/IUiDeviceType.java40
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/ui/IUiLayer.java40
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/ui/IUserAgentParser.java48
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/ui/UiDeviceType.java92
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/ui/UiLayer.java100
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/ui/UserAgent.java248
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/DefaultValidator.java864
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/IValidationStrategy.java152
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/IValidator.java64
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/InputValidation.java66
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/OutputValidation.java66
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/ValidateCheckSet.java160
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/ValidationUtility.java1234
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/annotations/CodeValue.java82
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/annotations/FieldReference.java82
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/annotations/LookupValue.java82
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/annotations/Mandatory.java78
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/annotations/MaxLength.java72
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/annotations/MaxValue.java74
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/annotations/MinLength.java72
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/annotations/MinValue.java74
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/annotations/RegexMatch.java78
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/annotations/Treat0AsNull.java52
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/annotations/ValidateAnnotationMarker.java48
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/checks/CodeValueCheck.java106
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/checks/IValidateCheck.java72
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/checks/LookupValueCheck.java108
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/checks/MandatoryCheck.java110
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/checks/MasterValueRequiredCheck.java128
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/checks/MaxLengthCheck.java126
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/checks/MaxLengthGenericCheck.java156
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/checks/MaxValueCheck.java100
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/checks/MinLengthCheck.java126
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/checks/MinValueCheck.java100
-rw-r--r--org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/checks/RegexMatchCheck.java134
-rw-r--r--org.eclipse.scout.rt.shared/translation.nls12
-rw-r--r--org.eclipse.scout.rt.testing.client/.settings/org.eclipse.pde.core.prefs6
-rw-r--r--org.eclipse.scout.rt.testing.client/Release Notes.txt42
-rw-r--r--org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/AbstractTestWithGuiScript.java410
-rw-r--r--org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/Activator.java124
-rw-r--r--org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/DefaultTestClientSessionProvider.java298
-rw-r--r--org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/IGuiMock.java662
-rw-r--r--org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/IGuiMockService.java56
-rw-r--r--org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/ITestClientSessionProvider.java74
-rw-r--r--org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/ScoutClientAssert.java576
-rw-r--r--org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/TestingClientSessionRegistryService.java262
-rw-r--r--org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/form/DynamicCancelButton.java60
-rw-r--r--org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/form/DynamicForm.java90
-rw-r--r--org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/form/DynamicGroupBox.java82
-rw-r--r--org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/form/DynamicOkButton.java60
-rw-r--r--org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/form/DynamicStringField.java62
-rw-r--r--org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/form/FormHandler.java38
-rw-r--r--org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/legacy/AbstractClientJUnitTest.java374
-rw-r--r--org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/robot/JavaRobot.java518
-rw-r--r--org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/runner/ScoutClientJobWrapperStatement.java138
-rw-r--r--org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/runner/ScoutClientTestRunner.java482
-rw-r--r--org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/servicetunnel/http/MultiClientAuthenticator.java172
-rw-r--r--org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/servicetunnel/http/MultiClientSessionCookieStore.java158
-rw-r--r--org.eclipse.scout.rt.testing.server/.settings/org.eclipse.pde.core.prefs6
-rw-r--r--org.eclipse.scout.rt.testing.server/Release Notes.txt44
-rw-r--r--org.eclipse.scout.rt.testing.server/src/org/eclipse/scout/rt/testing/server/Activator.java124
-rw-r--r--org.eclipse.scout.rt.testing.server/src/org/eclipse/scout/rt/testing/server/DefaultTestServerSessionProvider.java160
-rw-r--r--org.eclipse.scout.rt.testing.server/src/org/eclipse/scout/rt/testing/server/ITestServerSessionProvider.java70
-rw-r--r--org.eclipse.scout.rt.testing.server/src/org/eclipse/scout/rt/testing/server/JUnitServerJob.java86
-rw-r--r--org.eclipse.scout.rt.testing.server/src/org/eclipse/scout/rt/testing/server/runner/ScoutServerJobWrapperStatement.java174
-rw-r--r--org.eclipse.scout.rt.testing.server/src/org/eclipse/scout/rt/testing/server/runner/ScoutServerTestRunner.java594
-rw-r--r--org.eclipse.scout.rt.testing.shared/.settings/org.eclipse.pde.core.prefs6
-rw-r--r--org.eclipse.scout.rt.testing.shared/Release Notes.txt24
-rw-r--r--org.eclipse.scout.rt.testing.shared/plugin.xml34
-rw-r--r--org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/Activator.java124
-rw-r--r--org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/DevTestMarker.java62
-rw-r--r--org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/JUnitTestClassBrowser.java600
-rw-r--r--org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/OsUtility.java82
-rw-r--r--org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/ScoutAssert.java206
-rw-r--r--org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/ScoutJUnitPluginTestApplication.java58
-rw-r--r--org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/ScoutJUnitPluginTestExecutor.java750
-rw-r--r--org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/TestingUtility.java266
-rw-r--r--org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/WaitCondition.java42
-rw-r--r--org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/runner/AbstractRunAftersInSeparateScoutSession.java182
-rw-r--r--org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/runner/AbstractRunBeforesInSeparateScoutSession.java114
-rw-r--r--org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/services/common/code/TestingCodeService.java444
-rw-r--r--org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/services/common/exceptionhandler/ProcessingRuntimeExceptionUnwrappingStatement.java76
-rw-r--r--org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/services/common/exceptionhandler/WrappedProcessingRuntimeException.java54
-rw-r--r--org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/services/common/exceptionhandler/WrappingProcessingRuntimeExceptionHandlerService.java56
-rw-r--r--org.eclipse.scout.rt.testing.ui.rap/.settings/org.eclipse.pde.core.prefs6
-rw-r--r--org.eclipse.scout.rt.testing.ui.rap/plugin.xml52
-rw-r--r--org.eclipse.scout.rt.testing.ui.rap/src/org/eclipse/scout/rt/testing/ui/rap/Activator.java124
-rw-r--r--org.eclipse.scout.rt.testing.ui.rap/src/org/eclipse/scout/rt/testing/ui/rap/JUnitRAPJob.java118
-rw-r--r--org.eclipse.scout.rt.testing.ui.rap/src/org/eclipse/scout/rt/testing/ui/rap/RAPSelenium.java106
-rw-r--r--org.eclipse.scout.rt.testing.ui.rap/src/org/eclipse/scout/rt/testing/ui/rap/RapMock.java2790
-rw-r--r--org.eclipse.scout.rt.testing.ui.rap/src/org/eclipse/scout/rt/testing/ui/rap/RapMockService.java104
-rw-r--r--org.eclipse.scout.rt.testing.ui.swing/.settings/org.eclipse.pde.core.prefs6
-rw-r--r--org.eclipse.scout.rt.testing.ui.swing/plugin.xml36
-rw-r--r--org.eclipse.scout.rt.testing.ui.swing/src/org/eclipse/scout/rt/testing/ui/swing/Activator.java124
-rw-r--r--org.eclipse.scout.rt.testing.ui.swing/src/org/eclipse/scout/rt/testing/ui/swing/JUnitSwingJob.java170
-rw-r--r--org.eclipse.scout.rt.testing.ui.swing/src/org/eclipse/scout/rt/testing/ui/swing/SwingMock.java2330
-rw-r--r--org.eclipse.scout.rt.testing.ui.swing/src/org/eclipse/scout/rt/testing/ui/swing/SwingMockService.java76
-rw-r--r--org.eclipse.scout.rt.testing.ui.swt/.settings/org.eclipse.pde.core.prefs6
-rw-r--r--org.eclipse.scout.rt.testing.ui.swt/plugin.xml24
-rw-r--r--org.eclipse.scout.rt.testing.ui.swt/src/org/eclipse/scout/rt/testing/ui/swt/Activator.java124
-rw-r--r--org.eclipse.scout.rt.testing.ui.swt/src/org/eclipse/scout/rt/testing/ui/swt/JUnitSWTJob.java180
-rw-r--r--org.eclipse.scout.rt.testing.ui.swt/src/org/eclipse/scout/rt/testing/ui/swt/SwtMock.java2264
-rw-r--r--org.eclipse.scout.rt.testing.ui.swt/src/org/eclipse/scout/rt/testing/ui/swt/SwtMockService.java70
-rw-r--r--org.eclipse.scout.rt.ui.rap.mobile/.settings/org.eclipse.pde.core.prefs6
-rw-r--r--org.eclipse.scout.rt.ui.rap.mobile/plugin.xml236
-rw-r--r--org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/Activator.java86
-rw-r--r--org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/MobileFormToolkit.java70
-rw-r--r--org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/MobileScoutFormToolkit.java140
-rw-r--r--org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/action/AbstractRwtScoutActionBar.java650
-rw-r--r--org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/action/ActionButtonBar.java1160
-rw-r--r--org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/action/IRwtScoutActionButton.java66
-rw-r--r--org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/action/RwtScoutActionButton.java768
-rw-r--r--org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/busy/BusyBlockDialog.java244
-rw-r--r--org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/busy/BusyBlockDialogJob.java150
-rw-r--r--org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/busy/MobileWaitForBlockingJob.java58
-rw-r--r--org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/busy/RwtMobileBusyHandler.java72
-rw-r--r--org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/AbstractRwtScoutFormHeader.java206
-rw-r--r--org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/RwtScoutMobileForm.java54
-rw-r--r--org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/RwtScoutMobileFormFooter.java222
-rw-r--r--org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/RwtScoutMobileFormHeader.java268
-rw-r--r--org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/RwtScoutMobileOutlineFormHeader.java134
-rw-r--r--org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/RwtScoutMobileToolButtonBar.java58
-rw-r--r--org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/datefield/MobileDateFieldFactory.java110
-rw-r--r--org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/datefield/RwtScoutMobileDateField.java90
-rw-r--r--org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/datefield/RwtScoutMobileDateTimeCompositeField.java64
-rw-r--r--org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/datefield/RwtScoutMobileTimeField.java90
-rw-r--r--org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/datefield/chooser/MobileDateChooserDialog.java152
-rw-r--r--org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/datefield/chooser/MobileTimeChooser.java62
-rw-r--r--org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/datefield/chooser/MobileTimeChooserDialog.java118
-rw-r--r--org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/groupbox/MobileGroupBoxFieldFactory.java90
-rw-r--r--org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/groupbox/RwtScoutMobileGroupBox.java60
-rw-r--r--org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/smartfield/MobileSmartFieldFactory.java90
-rw-r--r--org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/smartfield/RwtScoutMobileSmartField.java340
-rw-r--r--org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/tabbox/MobileTabBoxFactory.java156
-rw-r--r--org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/tabbox/RwtScoutMobileTabBox.java146
-rw-r--r--org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/tablefield/IRwtScoutList.java42
-rw-r--r--org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/tablefield/IRwtScoutListModel.java52
-rw-r--r--org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/tablefield/ListEx.java98
-rw-r--r--org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/tablefield/MobileTableFieldFactory.java90
-rw-r--r--org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/tablefield/RwtMobileTableStatus.java84
-rw-r--r--org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/tablefield/RwtScoutList.java1222
-rw-r--r--org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/tablefield/RwtScoutListModel.java382
-rw-r--r--org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/tablefield/RwtScoutMobileTableField.java346
-rw-r--r--org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/tablefield/RwtScoutTableActionBar.java340
-rw-r--r--org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/treefield/MobileTreeFieldFactory.java90
-rw-r--r--org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/treefield/RwtScoutMobileTreeField.java54
-rw-r--r--org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/treefield/RwtScoutTreeActionBar.java308
-rw-r--r--org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/window/MobileBrowserWindowHandler.java86
-rw-r--r--org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/window/desktop/FormBasedDesktopFormBoundsProvider.java124
-rw-r--r--org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/window/desktop/MobileViewArea.java154
-rw-r--r--org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/window/desktop/RwtScoutMobileDesktop.java72
-rw-r--r--org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/window/desktop/RwtScoutMobileDesktopForm.java54
-rw-r--r--org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/window/desktop/RwtScoutMobileViewStack.java122
-rw-r--r--org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/window/desktop/SimpleSash.java82
-rw-r--r--org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/window/dialog/FixedSizeDialogBoundsProvider.java126
-rw-r--r--org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/window/dialog/RwtScoutMobileDialog.java180
-rw-r--r--org.eclipse.scout.rt.ui.rap.theme.rayo.mobile/.settings/org.eclipse.pde.core.prefs6
-rw-r--r--org.eclipse.scout.rt.ui.rap.theme.rayo.mobile/fragment.xml24
-rw-r--r--org.eclipse.scout.rt.ui.rap.theme.rayo/.settings/org.eclipse.pde.core.prefs6
-rw-r--r--org.eclipse.scout.rt.ui.rap.theme.rayo/plugin.xml24
-rw-r--r--org.eclipse.scout.rt.ui.rap.theme.rayo/src/org/eclipse/scout/rt/ui/rap/rayo/Activator.java86
-rw-r--r--org.eclipse.scout.rt.ui.rap.workbench/.settings/org.eclipse.pde.core.prefs6
-rw-r--r--org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/AbstractRwtWorkbenchEnvironment.java1110
-rw-r--r--org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/AbstractWorkbenchEntryPoint.java72
-rw-r--r--org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/Activator.java86
-rw-r--r--org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/IRwtWorkbenchEnvironment.java54
-rw-r--r--org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/ScoutApplicationStartup.java244
-rw-r--r--org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/util/listener/DndAdapter.java124
-rw-r--r--org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/util/listener/PartListener.java104
-rw-r--r--org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/util/listener/WindowListener.java72
-rw-r--r--org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/window/editor/AbstractScoutEditorPart.java922
-rw-r--r--org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/window/editor/ScoutEditorMatchingStrategy.java70
-rw-r--r--org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/window/editor/ScoutFormEditorInput.java210
-rw-r--r--org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/window/view/AbstractScoutView.java954
-rw-r--r--org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/window/view/ViewStackLayout.java172
-rw-r--r--org.eclipse.scout.rt.ui.rap/.settings/org.eclipse.pde.core.prefs6
-rw-r--r--org.eclipse.scout.rt.ui.rap/Release Notes.txt116
-rw-r--r--org.eclipse.scout.rt.ui.rap/plugin.xml786
-rw-r--r--org.eclipse.scout.rt.ui.rap/schema/formfields.exsd388
-rw-r--r--org.eclipse.scout.rt.ui.rap/schema/lookAndFeel.exsd652
-rw-r--r--org.eclipse.scout.rt.ui.rap/schema/scouticons.exsd424
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/AbstractRwtEnvironment.java2694
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/AbstractStandaloneRwtEnvironment.java602
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/Activator.java142
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/DefaultValidateRoot.java68
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/FormFieldFactory.java448
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ILogicalGridLayout.java80
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ILogicalGridLayoutInfo.java84
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/IRwtEnvironment.java472
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/IRwtEnvironmentListener.java38
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/IRwtStandaloneEnvironment.java38
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/IValidateRoot.java46
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/LayoutValidateManager.java148
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/LogicalGridData.java136
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/LogicalGridLayout.java560
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/LogicalGridLayoutInfo.java1044
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/RwtApplication.java52
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/RwtEnvironmentEvent.java86
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/RwtIcons.java40
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/RwtMenuUtility.java704
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/RwtShellValidateRoot.java124
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/action/AbstractRwtMenuAction.java526
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/action/RwtScoutAction.java276
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/action/RwtScoutCheckboxMenu.java108
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/action/RwtScoutMenuAction.java72
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/action/RwtScoutMenuGroup.java70
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/AbstractOpenMenuJob.java192
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/IRwtScoutComposite.java80
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/IconGroup.java226
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/RwtScoutComposite.java882
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/WidgetPrinter.java314
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/comp/CLabelEx.java296
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/comp/HyperlinkEx.java318
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/AbstractTableKeyboardNavigationSupport.java450
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/IRwtScoutTable.java68
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/IRwtScoutTableForPatch.java98
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/RwtScoutTable.java2744
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/RwtScoutTableEvent.java30
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/RwtScoutTableModel.java202
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/RwtScoutTooltipSupport.java208
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/TableColumnManager.java148
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/celleditor/FormFieldPopupEvent.java84
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/celleditor/IFormFieldPopupEventListener.java36
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/celleditor/RwtScoutFormFieldPopup.java876
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/celleditor/RwtScoutTableCellEditor.java1600
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/internal/SnippetForTableEditor.java454
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/internal/SnippetForTableHeaderMenu.java306
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/tree/IRwtScoutTree.java52
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/tree/RwtScoutTree.java1780
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/tree/RwtScoutTreeModel.java446
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/busy/BlockPartsJob.java226
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/busy/RwtBusyHandler.java124
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/busy/RwtScoutPartBlockingDecorator.java274
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/busy/WaitForBlockingJob.java282
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/concurrency/ConcurrencyQueue.java368
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/concurrency/LoopDetector.java136
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/concurrency/RwtScoutSynchronizer.java210
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/ButtonEx.java462
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/DropDownButton.java564
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/DropDownFileUpload.java438
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/IDropDownButtonForPatch.java150
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/IDropDownButtonListener.java46
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/IDropDownFileUploadForPatch.java178
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/ILabelComposite.java110
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/ImageViewer.java326
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/MenuAdapterEx.java206
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/ScrolledFormEx.java112
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/SectionContent.java62
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/SnapButtonMaximized.java480
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/StatusLabelEx.java814
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/StatusLabelTop.java204
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/StyledTextEx.java124
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/TextEx.java114
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/WizardStatusButton.java592
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/browser/BrowserExtension.java508
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/custom/StyledText.java56
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/gc/AdvancedGC.java272
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/gc/Transform.java160
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/tabfolder/CTabItemEx.java114
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/table/TableEx.java212
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/table/TableViewerEx.java114
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/table/util/TableCellRolloverSupport.java312
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/table/util/TableRolloverSupport.java210
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/tree/TreeEx.java242
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/util/RadioButtonGroup.java150
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/extension/FormFieldsExtensionPoint.java164
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/extension/IFormFieldExtension.java192
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/extension/IFormFieldFactory.java40
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/extension/ILookAndFeelDecorations.java62
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/extension/ILookAndFeelProperties.java106
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/extension/IUiDecoration.java144
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/extension/UiDecorationExtensionPoint.java704
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/extension/internal/FormFieldExtension.java184
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/extension/internal/LookAndFeelDecorations.java154
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/extension/internal/LookAndFeelProperties.java194
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/extension/internal/UiDecoration.java582
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/IRwtScoutForm.java46
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/RwtScoutForm.java558
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/AbstractRwtScoutDndSupport.java534
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/IPopupSupport.java96
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/IRwtScoutDndSupport.java36
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/IRwtScoutFormField.java52
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/LogicalGridDataBuilder.java180
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/OnFieldLabelDecorator.java208
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/RwtScoutFieldComposite.java1110
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/RwtScoutFormFieldGridData.java234
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/RwtScoutUnknownControl.java74
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/RwtScoutValueFieldComposite.java164
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/browserfield/IRwtScoutBrowserField.java50
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/browserfield/RwtScoutBrowserField.java414
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/button/ButtonFieldFactory.java94
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/button/IRwtScoutButton.java50
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/button/RwtScoutButton.java816
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/checkbox/IRwtScoutCheckbox.java56
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/checkbox/RwtScoutCheckbox.java392
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/composer/IRwtScoutComposerField.java36
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/composer/RwtScoutComposerField.java132
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/datefield/DateFieldFactory.java114
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/datefield/IRwtScoutDateField.java62
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/datefield/IRwtScoutTimeField.java62
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/datefield/RwtScoutDateField.java1140
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/datefield/RwtScoutDateTimeCompositeField.java254
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/datefield/RwtScoutTimeField.java1080
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/datefield/chooser/DateChooserDialog.java658
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/datefield/chooser/DateRow.java82
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/datefield/chooser/DatefieldTableModel.java370
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/datefield/chooser/TimeChooser.java370
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/datefield/chooser/TimeChooserDialog.java330
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/decimalfield/IRwtScoutDecimalField.java50
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/decimalfield/RwtScoutDecimalField.java248
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/groupbox/IRwtScoutGroupBox.java46
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/groupbox/IRwtScoutGroupBoxButtonbar.java36
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/groupbox/RwtScoutGroupBox.java864
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/groupbox/RwtScoutGroupBoxButtonbar.java238
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/groupbox/layout/ButtonBarLayout.java358
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/groupbox/layout/ButtonBarLayoutData.java54
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/htmlfield/IRwtScoutHtmlField.java50
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/htmlfield/RwtScoutHtmlField.java346
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/imagebox/IRwtScoutImageBox.java34
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/imagebox/RwtScoutImageField.java452
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/labelfield/IRwtScoutLabelField.java44
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/labelfield/RwtScoutLabelField.java156
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/listbox/IRwtScoutListBox.java36
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/listbox/RwtScoutListBox.java182
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/numberfield/IRwtScoutNumberField.java44
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/internal/servletfilter/LogoutFilter.java174
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/util/BrowserInfoBuilder.java582
1811 files changed, 254098 insertions, 254098 deletions
diff --git a/org.eclipse.scout.commons.test/.project b/org.eclipse.scout.commons.test/.project
index 250f5c7b98..285f6262d2 100644
--- a/org.eclipse.scout.commons.test/.project
+++ b/org.eclipse.scout.commons.test/.project
@@ -1,34 +1,34 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.scout.commons.test</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>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>
- </natures>
-</projectDescription>
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.scout.commons.test</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>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>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.scout.commons.test/.settings/de.loskutov.anyedit.AnyEditTools.prefs b/org.eclipse.scout.commons.test/.settings/de.loskutov.anyedit.AnyEditTools.prefs
index 855107fbda..a651cd29e7 100644
--- a/org.eclipse.scout.commons.test/.settings/de.loskutov.anyedit.AnyEditTools.prefs
+++ b/org.eclipse.scout.commons.test/.settings/de.loskutov.anyedit.AnyEditTools.prefs
@@ -1,15 +1,15 @@
-activeContentFilterList=*.makefile,makefile,*.Makefile,Makefile,Makefile.*,*.mk,MANIFEST.MF
-addNewLine=true
-convertActionOnSaave=AnyEdit.CnvrtTabToSpaces
-eclipse.preferences.version=1
-inActiveContentFilterList=
-javaTabWidthForJava=true
-org.eclipse.jdt.ui.editor.tab.width=2
-projectPropsEnabled=true
-removeTrailingSpaces=true
-replaceAllSpaces=false
-replaceAllTabs=true
-saveAndAddLine=true
-saveAndConvert=true
-saveAndTrim=true
-useModulo4Tabs=false
+activeContentFilterList=*.makefile,makefile,*.Makefile,Makefile,Makefile.*,*.mk,MANIFEST.MF
+addNewLine=true
+convertActionOnSaave=AnyEdit.CnvrtTabToSpaces
+eclipse.preferences.version=1
+inActiveContentFilterList=
+javaTabWidthForJava=true
+org.eclipse.jdt.ui.editor.tab.width=2
+projectPropsEnabled=true
+removeTrailingSpaces=true
+replaceAllSpaces=false
+replaceAllTabs=true
+saveAndAddLine=true
+saveAndConvert=true
+saveAndTrim=true
+useModulo4Tabs=false
diff --git a/org.eclipse.scout.commons.test/.settings/org.eclipse.core.resources.prefs b/org.eclipse.scout.commons.test/.settings/org.eclipse.core.resources.prefs
index 4824b80263..99f26c0203 100644
--- a/org.eclipse.scout.commons.test/.settings/org.eclipse.core.resources.prefs
+++ b/org.eclipse.scout.commons.test/.settings/org.eclipse.core.resources.prefs
@@ -1,2 +1,2 @@
-eclipse.preferences.version=1
-encoding/<project>=UTF-8
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/org.eclipse.scout.commons.test/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.scout.commons.test/.settings/org.eclipse.jdt.core.prefs
index 891b4633a6..61b49c5b93 100644
--- a/org.eclipse.scout.commons.test/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.scout.commons.test/.settings/org.eclipse.jdt.core.prefs
@@ -1,371 +1,371 @@
-eclipse.preferences.version=1
-org.eclipse.jdt.core.codeComplete.argumentPrefixes=
-org.eclipse.jdt.core.codeComplete.argumentSuffixes=
-org.eclipse.jdt.core.codeComplete.fieldPrefixes=m_
-org.eclipse.jdt.core.codeComplete.fieldSuffixes=
-org.eclipse.jdt.core.codeComplete.localPrefixes=
-org.eclipse.jdt.core.codeComplete.localSuffixes=
-org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
-org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
-org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
-org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.6
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
-org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
-org.eclipse.jdt.core.compiler.problem.deadCode=warning
-org.eclipse.jdt.core.compiler.problem.deprecation=warning
-org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=enabled
-org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
-org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
-org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
-org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
-org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
-org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
-org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
-org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
-org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
-org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
-org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
-org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
-org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
-org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
-org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
-org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
-org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
-org.eclipse.jdt.core.compiler.problem.nullReference=warning
-org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
-org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
-org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
-org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
-org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
-org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
-org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
-org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
-org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
-org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
-org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
-org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
-org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
-org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
-org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.unusedImport=warning
-org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
-org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
-org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=disabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
-org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=ignore
-org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.6
-org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=0
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=0
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=0
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=0
-org.eclipse.jdt.core.formatter.alignment_for_assignment=0
-org.eclipse.jdt.core.formatter.alignment_for_binary_expression=0
-org.eclipse.jdt.core.formatter.alignment_for_compact_if=0
-org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0
-org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
-org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=0
-org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
-org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0
-org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
-org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
-org.eclipse.jdt.core.formatter.blank_lines_after_package=1
-org.eclipse.jdt.core.formatter.blank_lines_before_field=0
-org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
-org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
-org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
-org.eclipse.jdt.core.formatter.blank_lines_before_method=1
-org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
-org.eclipse.jdt.core.formatter.blank_lines_before_package=0
-org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
-org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
-org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=true
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=true
-org.eclipse.jdt.core.formatter.comment.format_block_comments=false
-org.eclipse.jdt.core.formatter.comment.format_header=false
-org.eclipse.jdt.core.formatter.comment.format_html=true
-org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
-org.eclipse.jdt.core.formatter.comment.format_line_comments=false
-org.eclipse.jdt.core.formatter.comment.format_source_code=true
-org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
-org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
-org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
-org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
-org.eclipse.jdt.core.formatter.comment.line_length=120
-org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
-org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
-org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
-org.eclipse.jdt.core.formatter.compact_else_if=true
-org.eclipse.jdt.core.formatter.continuation_indentation=2
-org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
-org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
-org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
-org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
-org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
-org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_empty_lines=false
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
-org.eclipse.jdt.core.formatter.indentation.size=2
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
-org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
-org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.join_lines_in_comments=false
-org.eclipse.jdt.core.formatter.join_wrapped_lines=false
-org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=true
-org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=true
-org.eclipse.jdt.core.formatter.lineSplit=9999
-org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true
-org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true
-org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
-org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
-org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
-org.eclipse.jdt.core.formatter.tabulation.char=space
-org.eclipse.jdt.core.formatter.tabulation.size=2
-org.eclipse.jdt.core.formatter.use_on_off_tags=false
-org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=true
-org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
-org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
-org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
+eclipse.preferences.version=1
+org.eclipse.jdt.core.codeComplete.argumentPrefixes=
+org.eclipse.jdt.core.codeComplete.argumentSuffixes=
+org.eclipse.jdt.core.codeComplete.fieldPrefixes=m_
+org.eclipse.jdt.core.codeComplete.fieldSuffixes=
+org.eclipse.jdt.core.codeComplete.localPrefixes=
+org.eclipse.jdt.core.codeComplete.localSuffixes=
+org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
+org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
+org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
+org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=enabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=ignore
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=0
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=0
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=0
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=0
+org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=true
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=true
+org.eclipse.jdt.core.formatter.comment.format_block_comments=false
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
+org.eclipse.jdt.core.formatter.comment.format_line_comments=false
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
+org.eclipse.jdt.core.formatter.comment.line_length=120
+org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
+org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
+org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
+org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
+org.eclipse.jdt.core.formatter.indentation.size=2
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.join_lines_in_comments=false
+org.eclipse.jdt.core.formatter.join_wrapped_lines=false
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=true
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=true
+org.eclipse.jdt.core.formatter.lineSplit=9999
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
+org.eclipse.jdt.core.formatter.tabulation.char=space
+org.eclipse.jdt.core.formatter.tabulation.size=2
+org.eclipse.jdt.core.formatter.use_on_off_tags=false
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=true
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
diff --git a/org.eclipse.scout.commons.test/.settings/org.eclipse.jdt.ui.prefs b/org.eclipse.scout.commons.test/.settings/org.eclipse.jdt.ui.prefs
index 4fc999886d..acde688805 100644
--- a/org.eclipse.scout.commons.test/.settings/org.eclipse.jdt.ui.prefs
+++ b/org.eclipse.scout.commons.test/.settings/org.eclipse.jdt.ui.prefs
@@ -1,115 +1,115 @@
-cleanup.add_default_serial_version_id=true
-cleanup.add_generated_serial_version_id=false
-cleanup.add_missing_annotations=true
-cleanup.add_missing_deprecated_annotations=false
-cleanup.add_missing_methods=false
-cleanup.add_missing_nls_tags=false
-cleanup.add_missing_override_annotations=true
-cleanup.add_missing_override_annotations_interface_methods=true
-cleanup.add_serial_version_id=false
-cleanup.always_use_blocks=true
-cleanup.always_use_parentheses_in_expressions=false
-cleanup.always_use_this_for_non_static_field_access=false
-cleanup.always_use_this_for_non_static_method_access=false
-cleanup.convert_to_enhanced_for_loop=false
-cleanup.correct_indentation=true
-cleanup.format_source_code=true
-cleanup.format_source_code_changes_only=false
-cleanup.make_local_variable_final=true
-cleanup.make_parameters_final=false
-cleanup.make_private_fields_final=true
-cleanup.make_type_abstract_if_missing_method=false
-cleanup.make_variable_declarations_final=false
-cleanup.never_use_blocks=false
-cleanup.never_use_parentheses_in_expressions=true
-cleanup.organize_imports=true
-cleanup.qualify_static_field_accesses_with_declaring_class=false
-cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
-cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=false
-cleanup.qualify_static_member_accesses_with_declaring_class=false
-cleanup.qualify_static_method_accesses_with_declaring_class=false
-cleanup.remove_private_constructors=true
-cleanup.remove_trailing_whitespaces=true
-cleanup.remove_trailing_whitespaces_all=true
-cleanup.remove_trailing_whitespaces_ignore_empty=false
-cleanup.remove_unnecessary_casts=false
-cleanup.remove_unnecessary_nls_tags=false
-cleanup.remove_unused_imports=true
-cleanup.remove_unused_local_variables=false
-cleanup.remove_unused_private_fields=true
-cleanup.remove_unused_private_members=false
-cleanup.remove_unused_private_methods=true
-cleanup.remove_unused_private_types=true
-cleanup.sort_members=false
-cleanup.sort_members_all=false
-cleanup.use_blocks=false
-cleanup.use_blocks_only_for_return_and_throw=false
-cleanup.use_parentheses_in_expressions=false
-cleanup.use_this_for_non_static_field_access=false
-cleanup.use_this_for_non_static_field_access_only_if_necessary=true
-cleanup.use_this_for_non_static_method_access=false
-cleanup.use_this_for_non_static_method_access_only_if_necessary=true
-cleanup_profile=_Eclipse Scout
-cleanup_settings_version=2
-eclipse.preferences.version=1
-editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
-formatter_profile=_Eclipse Scout
-formatter_settings_version=12
-org.eclipse.jdt.ui.exception.name=e
-org.eclipse.jdt.ui.gettersetter.use.is=true
-org.eclipse.jdt.ui.javadoc=true
-org.eclipse.jdt.ui.keywordthis=false
-org.eclipse.jdt.ui.overrideannotation=true
-org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="false" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment"/><template autoinsert\="false" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment"/><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*******************************************************************************&\#13;\r\n * Copyright (c) 2010 BSI Business Systems Integration AG.&\#13;\r\n * All rights reserved. This program and the accompanying materials&\#13;\r\n * are made available under the terms of the Eclipse Public License v1.0&\#13;\r\n * which accompanies this distribution, and is available at&\#13;\r\n * http\://www.eclipse.org/legal/epl-v10.html&\#13;\r\n * &\#13;\r\n * Contributors\:&\#13;\r\n * BSI Business Systems Integration AG - initial API and implementation&\#13;\r\n ******************************************************************************/</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment"/><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="false" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">${body_statement}</template><template autoinsert\="false" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template><template autoinsert\="false" context\="gettercomment_context" deleted\="false" description\="Comment for getter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.gettercomment" name\="gettercomment"/><template autoinsert\="false" context\="settercomment_context" deleted\="false" description\="Comment for setter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.settercomment" name\="settercomment"/><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created JavaScript files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="fieldcomment_context" deleted\="false" description\="Comment for vars" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment"/><template autoinsert\="false" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="false" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.catchblock" name\="catchblock">${exception_var}.printStackTrace();</template><template autoinsert\="false" context\="methodbody_context" deleted\="false" description\="Code in created function stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodbody" name\="methodbody">${body_statement}</template><template autoinsert\="false" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
-sp_cleanup.add_default_serial_version_id=true
-sp_cleanup.add_generated_serial_version_id=false
-sp_cleanup.add_missing_annotations=false
-sp_cleanup.add_missing_deprecated_annotations=false
-sp_cleanup.add_missing_methods=false
-sp_cleanup.add_missing_nls_tags=false
-sp_cleanup.add_missing_override_annotations=false
-sp_cleanup.add_missing_override_annotations_interface_methods=true
-sp_cleanup.add_serial_version_id=false
-sp_cleanup.always_use_blocks=true
-sp_cleanup.always_use_parentheses_in_expressions=false
-sp_cleanup.always_use_this_for_non_static_field_access=false
-sp_cleanup.always_use_this_for_non_static_method_access=false
-sp_cleanup.convert_to_enhanced_for_loop=false
-sp_cleanup.correct_indentation=true
-sp_cleanup.format_source_code=true
-sp_cleanup.format_source_code_changes_only=false
-sp_cleanup.make_local_variable_final=false
-sp_cleanup.make_parameters_final=false
-sp_cleanup.make_private_fields_final=true
-sp_cleanup.make_type_abstract_if_missing_method=false
-sp_cleanup.make_variable_declarations_final=false
-sp_cleanup.never_use_blocks=false
-sp_cleanup.never_use_parentheses_in_expressions=true
-sp_cleanup.on_save_use_additional_actions=true
-sp_cleanup.organize_imports=true
-sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
-sp_cleanup.remove_private_constructors=true
-sp_cleanup.remove_trailing_whitespaces=true
-sp_cleanup.remove_trailing_whitespaces_all=true
-sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
-sp_cleanup.remove_unnecessary_casts=false
-sp_cleanup.remove_unnecessary_nls_tags=true
-sp_cleanup.remove_unused_imports=true
-sp_cleanup.remove_unused_local_variables=false
-sp_cleanup.remove_unused_private_fields=true
-sp_cleanup.remove_unused_private_members=false
-sp_cleanup.remove_unused_private_methods=true
-sp_cleanup.remove_unused_private_types=true
-sp_cleanup.sort_members=false
-sp_cleanup.sort_members_all=false
-sp_cleanup.use_blocks=true
-sp_cleanup.use_blocks_only_for_return_and_throw=false
-sp_cleanup.use_parentheses_in_expressions=false
-sp_cleanup.use_this_for_non_static_field_access=false
-sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
-sp_cleanup.use_this_for_non_static_method_access=false
-sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+cleanup.add_default_serial_version_id=true
+cleanup.add_generated_serial_version_id=false
+cleanup.add_missing_annotations=true
+cleanup.add_missing_deprecated_annotations=false
+cleanup.add_missing_methods=false
+cleanup.add_missing_nls_tags=false
+cleanup.add_missing_override_annotations=true
+cleanup.add_missing_override_annotations_interface_methods=true
+cleanup.add_serial_version_id=false
+cleanup.always_use_blocks=true
+cleanup.always_use_parentheses_in_expressions=false
+cleanup.always_use_this_for_non_static_field_access=false
+cleanup.always_use_this_for_non_static_method_access=false
+cleanup.convert_to_enhanced_for_loop=false
+cleanup.correct_indentation=true
+cleanup.format_source_code=true
+cleanup.format_source_code_changes_only=false
+cleanup.make_local_variable_final=true
+cleanup.make_parameters_final=false
+cleanup.make_private_fields_final=true
+cleanup.make_type_abstract_if_missing_method=false
+cleanup.make_variable_declarations_final=false
+cleanup.never_use_blocks=false
+cleanup.never_use_parentheses_in_expressions=true
+cleanup.organize_imports=true
+cleanup.qualify_static_field_accesses_with_declaring_class=false
+cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=false
+cleanup.qualify_static_member_accesses_with_declaring_class=false
+cleanup.qualify_static_method_accesses_with_declaring_class=false
+cleanup.remove_private_constructors=true
+cleanup.remove_trailing_whitespaces=true
+cleanup.remove_trailing_whitespaces_all=true
+cleanup.remove_trailing_whitespaces_ignore_empty=false
+cleanup.remove_unnecessary_casts=false
+cleanup.remove_unnecessary_nls_tags=false
+cleanup.remove_unused_imports=true
+cleanup.remove_unused_local_variables=false
+cleanup.remove_unused_private_fields=true
+cleanup.remove_unused_private_members=false
+cleanup.remove_unused_private_methods=true
+cleanup.remove_unused_private_types=true
+cleanup.sort_members=false
+cleanup.sort_members_all=false
+cleanup.use_blocks=false
+cleanup.use_blocks_only_for_return_and_throw=false
+cleanup.use_parentheses_in_expressions=false
+cleanup.use_this_for_non_static_field_access=false
+cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+cleanup.use_this_for_non_static_method_access=false
+cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+cleanup_profile=_Eclipse Scout
+cleanup_settings_version=2
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_Eclipse Scout
+formatter_settings_version=12
+org.eclipse.jdt.ui.exception.name=e
+org.eclipse.jdt.ui.gettersetter.use.is=true
+org.eclipse.jdt.ui.javadoc=true
+org.eclipse.jdt.ui.keywordthis=false
+org.eclipse.jdt.ui.overrideannotation=true
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="false" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment"/><template autoinsert\="false" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment"/><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*******************************************************************************&\#13;\r\n * Copyright (c) 2010 BSI Business Systems Integration AG.&\#13;\r\n * All rights reserved. This program and the accompanying materials&\#13;\r\n * are made available under the terms of the Eclipse Public License v1.0&\#13;\r\n * which accompanies this distribution, and is available at&\#13;\r\n * http\://www.eclipse.org/legal/epl-v10.html&\#13;\r\n * &\#13;\r\n * Contributors\:&\#13;\r\n * BSI Business Systems Integration AG - initial API and implementation&\#13;\r\n ******************************************************************************/</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment"/><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="false" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">${body_statement}</template><template autoinsert\="false" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template><template autoinsert\="false" context\="gettercomment_context" deleted\="false" description\="Comment for getter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.gettercomment" name\="gettercomment"/><template autoinsert\="false" context\="settercomment_context" deleted\="false" description\="Comment for setter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.settercomment" name\="settercomment"/><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created JavaScript files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="fieldcomment_context" deleted\="false" description\="Comment for vars" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment"/><template autoinsert\="false" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="false" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.catchblock" name\="catchblock">${exception_var}.printStackTrace();</template><template autoinsert\="false" context\="methodbody_context" deleted\="false" description\="Code in created function stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodbody" name\="methodbody">${body_statement}</template><template autoinsert\="false" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=false
+sp_cleanup.add_missing_deprecated_annotations=false
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=false
+sp_cleanup.add_missing_override_annotations_interface_methods=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=true
+sp_cleanup.format_source_code=true
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=true
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=false
+sp_cleanup.remove_unnecessary_nls_tags=true
+sp_cleanup.remove_unused_imports=true
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=true
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/org.eclipse.scout.commons.test/.settings/org.eclipse.m2e.core.prefs b/org.eclipse.scout.commons.test/.settings/org.eclipse.m2e.core.prefs
index 14b697b7bb..f897a7f1cb 100644
--- a/org.eclipse.scout.commons.test/.settings/org.eclipse.m2e.core.prefs
+++ b/org.eclipse.scout.commons.test/.settings/org.eclipse.m2e.core.prefs
@@ -1,4 +1,4 @@
-activeProfiles=
-eclipse.preferences.version=1
-resolveWorkspaceProjects=true
-version=1
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
diff --git a/org.eclipse.scout.commons.test/.settings/org.eclipse.pde.core.prefs b/org.eclipse.scout.commons.test/.settings/org.eclipse.pde.core.prefs
index baef13dd8c..a3a50fc8da 100644
--- a/org.eclipse.scout.commons.test/.settings/org.eclipse.pde.core.prefs
+++ b/org.eclipse.scout.commons.test/.settings/org.eclipse.pde.core.prefs
@@ -1,3 +1,3 @@
-#Mon Jul 11 16:16:00 CEST 2011
-eclipse.preferences.version=1
-pluginProject.extensions=true
+#Mon Jul 11 16:16:00 CEST 2011
+eclipse.preferences.version=1
+pluginProject.extensions=true
diff --git a/org.eclipse.scout.commons.test/about.html b/org.eclipse.scout.commons.test/about.html
index f47dbddbb8..c258ef55d8 100644
--- a/org.eclipse.scout.commons.test/about.html
+++ b/org.eclipse.scout.commons.test/about.html
@@ -1,28 +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 5, 2006</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>
+<!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 5, 2006</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.scout.commons.test/build.properties b/org.eclipse.scout.commons.test/build.properties
index cbe439e7b5..b3615c7b47 100644
--- a/org.eclipse.scout.commons.test/build.properties
+++ b/org.eclipse.scout.commons.test/build.properties
@@ -1,12 +1,12 @@
-###############################################################################
-# Copyright (c) 2010, 2012 BSI Business Systems Integration AG.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-###############################################################################
-source.. = src/
-bin.includes = META-INF/,\
- .,\
- about.html
-src.includes = about.html
+###############################################################################
+# Copyright (c) 2010, 2012 BSI Business Systems Integration AG.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+###############################################################################
+source.. = src/
+bin.includes = META-INF/,\
+ .,\
+ about.html
+src.includes = about.html
diff --git a/org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/BeanUtilityTest.java b/org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/BeanUtilityTest.java
index 1500ae0796..7f49e2d85a 100644
--- a/org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/BeanUtilityTest.java
+++ b/org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/BeanUtilityTest.java
@@ -1,358 +1,358 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.lang.reflect.Constructor;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.junit.Test;
-
-/**
- * @since 3.8.1
- */
-public class BeanUtilityTest {
-
- @Test
- public void testGetConstructorNullAndDefault() throws Exception {
- assertNull(BeanUtility.findConstructor(null));
- //
- assertEquals(1, OnlyDefalutConstructor.class.getConstructors().length);
- Constructor<OnlyDefalutConstructor> expected = OnlyDefalutConstructor.class.getConstructor((Class<?>[]) null);
- assertEquals(expected, BeanUtility.findConstructor(OnlyDefalutConstructor.class));
- assertEquals(expected, BeanUtility.findConstructor(OnlyDefalutConstructor.class, (Class<?>[]) null));
- //
- assertNull(BeanUtility.findConstructor(OnlyPrivateDefalutConstructor.class));
- }
-
- @Test
- public void testGetConstructorInvisibleClass() throws Exception {
- assertNull(BeanUtility.findConstructor(InvisibleClass.class));
- }
-
- @Test
- public void testGetConstructorNonStaticClass() throws Exception {
- assertNull(BeanUtility.findConstructor(NonStaticInnerClass.class));
- assertEquals(NonStaticInnerClass.class.getConstructor(BeanUtilityTest.class), BeanUtility.findConstructor(NonStaticInnerClass.class, BeanUtilityTest.class));
- }
-
- @Test
- public void testGetConstructorPolymorphism() throws Exception {
- assertNull(BeanUtility.findConstructor(ParamConstructor.class));
- assertNull(BeanUtility.findConstructor(ParamConstructor.class, String.class));
- //
- Constructor<ParamConstructor> expected = ParamConstructor.class.getConstructor(A.class);
- assertEquals(expected, BeanUtility.findConstructor(ParamConstructor.class, A.class));
- assertEquals(expected, BeanUtility.findConstructor(ParamConstructor.class, AExt.class));
- }
-
- @Test
- public void testGetConstructorPolymorphismOverloadedConstructors() throws Exception {
- assertEquals(MultyParamConstructor.class.getConstructor(), BeanUtility.findConstructor(MultyParamConstructor.class));
- assertEquals(MultyParamConstructor.class.getConstructor(A.class), BeanUtility.findConstructor(MultyParamConstructor.class, A.class));
- assertEquals(MultyParamConstructor.class.getConstructor(AExt.class), BeanUtility.findConstructor(MultyParamConstructor.class, AExt.class));
- assertEquals(MultyParamConstructor.class.getConstructor(A.class), BeanUtility.findConstructor(MultyParamConstructor.class, AExt2.class));
- assertEquals(MultyParamConstructor.class.getConstructor(AExt.class), BeanUtility.findConstructor(MultyParamConstructor.class, AExtExt.class));
- }
-
- @Test
- public void testGetConstructorAmbiguousSignatures() throws Exception {
- assertEquals(AmbiguousSignaturesConstructor.class.getConstructor(A.class, B.class), BeanUtility.findConstructor(AmbiguousSignaturesConstructor.class, A.class, B.class));
- assertEquals(AmbiguousSignaturesConstructor.class.getConstructor(AExt.class, B.class), BeanUtility.findConstructor(AmbiguousSignaturesConstructor.class, AExt.class, B.class));
- assertEquals(AmbiguousSignaturesConstructor.class.getConstructor(A.class, BExt.class), BeanUtility.findConstructor(AmbiguousSignaturesConstructor.class, A.class, BExt.class));
- try {
- Constructor<AmbiguousSignaturesConstructor> ctor = BeanUtility.findConstructor(AmbiguousSignaturesConstructor.class, AExt.class, BExt.class);
- fail("Expected ambiguous constructor but got '" + ctor.toString() + "'");
- }
- catch (ProcessingException e) {
- // ok
- }
- }
-
- @Test
- public void testGetConstructorPrimitiveAndComplexType() throws Exception {
- assertEquals(PrimitiveAndComplexTypeConstructor.class.getConstructor(long.class), BeanUtility.findConstructor(PrimitiveAndComplexTypeConstructor.class, long.class));
- assertEquals(PrimitiveAndComplexTypeConstructor.class.getConstructor(Long.class), BeanUtility.findConstructor(PrimitiveAndComplexTypeConstructor.class, Long.class));
- assertEquals(PrimitiveAndComplexTypeConstructor.class.getConstructor(Long.class), BeanUtility.findConstructor(PrimitiveAndComplexTypeConstructor.class, new Class<?>[]{null}));
- }
-
- @Test
- public void testGetConstructorComplexType() throws Exception {
- assertEquals(ComplexTypeConstructor.class.getConstructor(Long.class), BeanUtility.findConstructor(ComplexTypeConstructor.class, Long.class));
- // auto-boxing
- assertEquals(ComplexTypeConstructor.class.getConstructor(Long.class), BeanUtility.findConstructor(ComplexTypeConstructor.class, long.class));
- }
-
- @Test
- public void testGetConstructorPrimitiveType() throws Exception {
- assertEquals(PrimitiveTypeConstructor.class.getConstructor(long.class), BeanUtility.findConstructor(PrimitiveTypeConstructor.class, long.class));
- // auto-unboxing
- assertEquals(PrimitiveTypeConstructor.class.getConstructor(long.class), BeanUtility.findConstructor(PrimitiveTypeConstructor.class, Long.class));
- }
-
- @Test
- public void testGetConstructorArray() throws Exception {
- assertEquals(ArrayConstructor.class.getConstructor(String[].class), BeanUtility.findConstructor(ArrayConstructor.class, String[].class));
- }
-
- @Test
- public void testCreateInstanceNullAndEmpty() throws Exception {
- assertNull(BeanUtility.createInstance(null));
- assertNull(BeanUtility.createInstance(null, null, null));
- //
- assertTrue(BeanUtility.createInstance(OnlyDefalutConstructor.class) instanceof OnlyDefalutConstructor);
- assertTrue(BeanUtility.createInstance(OnlyDefalutConstructor.class, (Object[]) null) instanceof OnlyDefalutConstructor);
- assertTrue(BeanUtility.createInstance(OnlyDefalutConstructor.class, null, null) instanceof OnlyDefalutConstructor);
- }
-
- @Test
- public void testCreateInstanceInvisibleClass() throws Exception {
- assertNull(BeanUtility.createInstance(InvisibleClass.class));
- }
-
- @Test
- public void testCreateInstanceNonStaticClass() throws Exception {
- assertNull(BeanUtility.createInstance(NonStaticInnerClass.class));
- }
-
- @Test
- public void testCreateInstanceNonStaticClassWithThisArgument() throws Exception {
- assertNotNull(BeanUtility.createInstance(NonStaticInnerClass.class, this));
- }
-
- @Test
- public void testCreateInstancePrimitiveType() throws Exception {
- {
- PrimitiveTypeConstructor obj = BeanUtility.createInstance(PrimitiveTypeConstructor.class, new Class<?>[]{long.class}, new Object[]{42L});
- assertNotNull(obj);
- assertEquals("Expected constructor with primitive type long", 42L, obj.getLong());
- }
- {
- PrimitiveTypeConstructor obj = BeanUtility.createInstance(PrimitiveTypeConstructor.class, new Class<?>[]{Long.class}, new Object[]{42L});
- assertNotNull(obj);
- assertEquals("Expected constructor with primitive type long", 42L, obj.getLong());
- }
- {
- PrimitiveTypeConstructor obj = BeanUtility.createInstance(PrimitiveTypeConstructor.class, 42L);
- assertNotNull(obj);
- assertEquals("Expected constructor with complex type java.lang.Long", 42L, obj.getLong());
- }
- {
- PrimitiveTypeConstructor obj = BeanUtility.createInstance(PrimitiveTypeConstructor.class, new Object[]{null});
- assertNull(obj);
- }
- }
-
- @Test
- public void testCreateInstanceComplexType() throws Exception {
- {
- ComplexTypeConstructor obj = BeanUtility.createInstance(ComplexTypeConstructor.class, new Class<?>[]{Long.class}, new Object[]{42L});
- assertNotNull(obj);
- assertEquals("Expected constructor with primitive type long", 42L, obj.getLong());
- }
- {
- ComplexTypeConstructor obj = BeanUtility.createInstance(ComplexTypeConstructor.class, new Class<?>[]{long.class}, new Object[]{42L});
- assertNotNull(obj);
- assertEquals("Expected constructor with primitive type long", 42L, obj.getLong());
- }
- {
- ComplexTypeConstructor obj = BeanUtility.createInstance(ComplexTypeConstructor.class, 42L);
- assertNotNull(obj);
- assertEquals("Expected constructor with complex type java.lang.Long", 42L, obj.getLong());
- }
- {
- ComplexTypeConstructor obj = BeanUtility.createInstance(ComplexTypeConstructor.class, new Object[]{null});
- assertNotNull(obj);
- assertEquals("Expected constructor with complex type java.lang.Long", Long.MAX_VALUE, obj.getLong());
- }
- }
-
- @Test
- public void testCreateInstancePrimitiveAndComplexType() throws Exception {
- {
- PrimitiveAndComplexTypeConstructor obj = BeanUtility.createInstance(PrimitiveAndComplexTypeConstructor.class, new Class<?>[]{long.class}, new Object[]{42L});
- assertNotNull(obj);
- assertEquals("Expected constructor with primitive type long", 42L, obj.getLong());
- }
- {
- PrimitiveAndComplexTypeConstructor obj = BeanUtility.createInstance(PrimitiveAndComplexTypeConstructor.class, new Class<?>[]{Long.class}, new Object[]{42L});
- assertNotNull(obj);
- assertEquals("Expected constructor with primitive type long", -42L, obj.getLong());
- }
- {
- PrimitiveAndComplexTypeConstructor obj = BeanUtility.createInstance(PrimitiveAndComplexTypeConstructor.class, 42L);
- assertNotNull(obj);
- assertEquals("Expected constructor with complex type java.lang.Long", -42L, obj.getLong());
- }
- {
- PrimitiveAndComplexTypeConstructor obj = BeanUtility.createInstance(PrimitiveAndComplexTypeConstructor.class, new Object[]{null});
- assertNotNull(obj);
- assertEquals("Expected constructor with complex type java.lang.Long", Long.MAX_VALUE, obj.getLong());
- }
- }
-
- @Test
- public void testCreateInstanceArray() throws Exception {
- {
- ArrayConstructor obj = BeanUtility.createInstance(ArrayConstructor.class, new Class<?>[]{String[].class}, new Object[]{new String[]{"hello", "world"}});
- assertNotNull(obj);
- assertArrayEquals(new String[]{"hello", "world"}, obj.getStringArray());
- }
- {
- ArrayConstructor obj = BeanUtility.createInstance(ArrayConstructor.class, (Object) new String[]{"hello", "world"});
- assertNotNull(obj);
- assertArrayEquals(new String[]{"hello", "world"}, obj.getStringArray());
- }
- }
-
- @Test
- public void testCreateInstanceVararg() throws Exception {
- {
- VarargConstructor obj = BeanUtility.createInstance(VarargConstructor.class, new Class<?>[]{String[].class}, new Object[]{new String[]{"hello", "world"}});
- assertNotNull(obj);
- assertArrayEquals(new String[]{"hello", "world"}, obj.getStringArray());
- }
- {
- VarargConstructor obj = BeanUtility.createInstance(VarargConstructor.class, (Object) new String[]{"hello", "world"});
- assertNotNull(obj);
- assertArrayEquals(new String[]{"hello", "world"}, obj.getStringArray());
- }
- }
-
- public static class OnlyDefalutConstructor {
- }
-
- public static class OnlyPrivateDefalutConstructor {
- private OnlyPrivateDefalutConstructor() {
- }
- }
-
- public static class ParamConstructor {
- public ParamConstructor(A paramA) {
- }
- }
-
- public static class MultyParamConstructor {
- public MultyParamConstructor() {
- }
-
- public MultyParamConstructor(A paramA) {
- }
-
- public MultyParamConstructor(AExt paramAExt) {
- }
- }
-
- public static class AmbiguousSignaturesConstructor {
- public AmbiguousSignaturesConstructor(A a, B b) {
- }
-
- public AmbiguousSignaturesConstructor(AExt aExt, B b) {
- }
-
- public AmbiguousSignaturesConstructor(A a, BExt bExt) {
- }
- }
-
- public static class PrimitiveTypeConstructor {
- private final long m_long;
-
- public PrimitiveTypeConstructor(long l) {
- m_long = l;
- }
-
- public long getLong() {
- return m_long;
- }
- }
-
- public static class ComplexTypeConstructor {
- private final long m_long;
-
- public ComplexTypeConstructor(Long l) {
- m_long = (l == null ? Long.MAX_VALUE : l.longValue());
- }
-
- public long getLong() {
- return m_long;
- }
- }
-
- public static class PrimitiveAndComplexTypeConstructor {
- private final long m_long;
-
- public PrimitiveAndComplexTypeConstructor(long l) {
- m_long = l;
- }
-
- public PrimitiveAndComplexTypeConstructor(Long l) {
- m_long = (l == null ? Long.MAX_VALUE : -l.longValue());
- }
-
- public long getLong() {
- return m_long;
- }
- }
-
- public static class ArrayConstructor {
- private final String[] m_stringArray;
-
- public ArrayConstructor(String[] stringArray) {
- m_stringArray = stringArray;
- }
-
- public String[] getStringArray() {
- return m_stringArray;
- }
- }
-
- public static class VarargConstructor {
- private final String[] m_stringArray;
-
- public VarargConstructor(String... stringArray) {
- m_stringArray = stringArray;
- }
-
- public String[] getStringArray() {
- return m_stringArray;
- }
- }
-
- public static class A {
- }
-
- public static class AExt extends A {
- }
-
- public static class AExt2 extends A {
- }
-
- public static class AExtExt extends AExt {
- }
-
- public static class B {
- }
-
- public static class BExt extends B {
- }
-
- private static class InvisibleClass {
- }
-
- public class NonStaticInnerClass {
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.lang.reflect.Constructor;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.junit.Test;
+
+/**
+ * @since 3.8.1
+ */
+public class BeanUtilityTest {
+
+ @Test
+ public void testGetConstructorNullAndDefault() throws Exception {
+ assertNull(BeanUtility.findConstructor(null));
+ //
+ assertEquals(1, OnlyDefalutConstructor.class.getConstructors().length);
+ Constructor<OnlyDefalutConstructor> expected = OnlyDefalutConstructor.class.getConstructor((Class<?>[]) null);
+ assertEquals(expected, BeanUtility.findConstructor(OnlyDefalutConstructor.class));
+ assertEquals(expected, BeanUtility.findConstructor(OnlyDefalutConstructor.class, (Class<?>[]) null));
+ //
+ assertNull(BeanUtility.findConstructor(OnlyPrivateDefalutConstructor.class));
+ }
+
+ @Test
+ public void testGetConstructorInvisibleClass() throws Exception {
+ assertNull(BeanUtility.findConstructor(InvisibleClass.class));
+ }
+
+ @Test
+ public void testGetConstructorNonStaticClass() throws Exception {
+ assertNull(BeanUtility.findConstructor(NonStaticInnerClass.class));
+ assertEquals(NonStaticInnerClass.class.getConstructor(BeanUtilityTest.class), BeanUtility.findConstructor(NonStaticInnerClass.class, BeanUtilityTest.class));
+ }
+
+ @Test
+ public void testGetConstructorPolymorphism() throws Exception {
+ assertNull(BeanUtility.findConstructor(ParamConstructor.class));
+ assertNull(BeanUtility.findConstructor(ParamConstructor.class, String.class));
+ //
+ Constructor<ParamConstructor> expected = ParamConstructor.class.getConstructor(A.class);
+ assertEquals(expected, BeanUtility.findConstructor(ParamConstructor.class, A.class));
+ assertEquals(expected, BeanUtility.findConstructor(ParamConstructor.class, AExt.class));
+ }
+
+ @Test
+ public void testGetConstructorPolymorphismOverloadedConstructors() throws Exception {
+ assertEquals(MultyParamConstructor.class.getConstructor(), BeanUtility.findConstructor(MultyParamConstructor.class));
+ assertEquals(MultyParamConstructor.class.getConstructor(A.class), BeanUtility.findConstructor(MultyParamConstructor.class, A.class));
+ assertEquals(MultyParamConstructor.class.getConstructor(AExt.class), BeanUtility.findConstructor(MultyParamConstructor.class, AExt.class));
+ assertEquals(MultyParamConstructor.class.getConstructor(A.class), BeanUtility.findConstructor(MultyParamConstructor.class, AExt2.class));
+ assertEquals(MultyParamConstructor.class.getConstructor(AExt.class), BeanUtility.findConstructor(MultyParamConstructor.class, AExtExt.class));
+ }
+
+ @Test
+ public void testGetConstructorAmbiguousSignatures() throws Exception {
+ assertEquals(AmbiguousSignaturesConstructor.class.getConstructor(A.class, B.class), BeanUtility.findConstructor(AmbiguousSignaturesConstructor.class, A.class, B.class));
+ assertEquals(AmbiguousSignaturesConstructor.class.getConstructor(AExt.class, B.class), BeanUtility.findConstructor(AmbiguousSignaturesConstructor.class, AExt.class, B.class));
+ assertEquals(AmbiguousSignaturesConstructor.class.getConstructor(A.class, BExt.class), BeanUtility.findConstructor(AmbiguousSignaturesConstructor.class, A.class, BExt.class));
+ try {
+ Constructor<AmbiguousSignaturesConstructor> ctor = BeanUtility.findConstructor(AmbiguousSignaturesConstructor.class, AExt.class, BExt.class);
+ fail("Expected ambiguous constructor but got '" + ctor.toString() + "'");
+ }
+ catch (ProcessingException e) {
+ // ok
+ }
+ }
+
+ @Test
+ public void testGetConstructorPrimitiveAndComplexType() throws Exception {
+ assertEquals(PrimitiveAndComplexTypeConstructor.class.getConstructor(long.class), BeanUtility.findConstructor(PrimitiveAndComplexTypeConstructor.class, long.class));
+ assertEquals(PrimitiveAndComplexTypeConstructor.class.getConstructor(Long.class), BeanUtility.findConstructor(PrimitiveAndComplexTypeConstructor.class, Long.class));
+ assertEquals(PrimitiveAndComplexTypeConstructor.class.getConstructor(Long.class), BeanUtility.findConstructor(PrimitiveAndComplexTypeConstructor.class, new Class<?>[]{null}));
+ }
+
+ @Test
+ public void testGetConstructorComplexType() throws Exception {
+ assertEquals(ComplexTypeConstructor.class.getConstructor(Long.class), BeanUtility.findConstructor(ComplexTypeConstructor.class, Long.class));
+ // auto-boxing
+ assertEquals(ComplexTypeConstructor.class.getConstructor(Long.class), BeanUtility.findConstructor(ComplexTypeConstructor.class, long.class));
+ }
+
+ @Test
+ public void testGetConstructorPrimitiveType() throws Exception {
+ assertEquals(PrimitiveTypeConstructor.class.getConstructor(long.class), BeanUtility.findConstructor(PrimitiveTypeConstructor.class, long.class));
+ // auto-unboxing
+ assertEquals(PrimitiveTypeConstructor.class.getConstructor(long.class), BeanUtility.findConstructor(PrimitiveTypeConstructor.class, Long.class));
+ }
+
+ @Test
+ public void testGetConstructorArray() throws Exception {
+ assertEquals(ArrayConstructor.class.getConstructor(String[].class), BeanUtility.findConstructor(ArrayConstructor.class, String[].class));
+ }
+
+ @Test
+ public void testCreateInstanceNullAndEmpty() throws Exception {
+ assertNull(BeanUtility.createInstance(null));
+ assertNull(BeanUtility.createInstance(null, null, null));
+ //
+ assertTrue(BeanUtility.createInstance(OnlyDefalutConstructor.class) instanceof OnlyDefalutConstructor);
+ assertTrue(BeanUtility.createInstance(OnlyDefalutConstructor.class, (Object[]) null) instanceof OnlyDefalutConstructor);
+ assertTrue(BeanUtility.createInstance(OnlyDefalutConstructor.class, null, null) instanceof OnlyDefalutConstructor);
+ }
+
+ @Test
+ public void testCreateInstanceInvisibleClass() throws Exception {
+ assertNull(BeanUtility.createInstance(InvisibleClass.class));
+ }
+
+ @Test
+ public void testCreateInstanceNonStaticClass() throws Exception {
+ assertNull(BeanUtility.createInstance(NonStaticInnerClass.class));
+ }
+
+ @Test
+ public void testCreateInstanceNonStaticClassWithThisArgument() throws Exception {
+ assertNotNull(BeanUtility.createInstance(NonStaticInnerClass.class, this));
+ }
+
+ @Test
+ public void testCreateInstancePrimitiveType() throws Exception {
+ {
+ PrimitiveTypeConstructor obj = BeanUtility.createInstance(PrimitiveTypeConstructor.class, new Class<?>[]{long.class}, new Object[]{42L});
+ assertNotNull(obj);
+ assertEquals("Expected constructor with primitive type long", 42L, obj.getLong());
+ }
+ {
+ PrimitiveTypeConstructor obj = BeanUtility.createInstance(PrimitiveTypeConstructor.class, new Class<?>[]{Long.class}, new Object[]{42L});
+ assertNotNull(obj);
+ assertEquals("Expected constructor with primitive type long", 42L, obj.getLong());
+ }
+ {
+ PrimitiveTypeConstructor obj = BeanUtility.createInstance(PrimitiveTypeConstructor.class, 42L);
+ assertNotNull(obj);
+ assertEquals("Expected constructor with complex type java.lang.Long", 42L, obj.getLong());
+ }
+ {
+ PrimitiveTypeConstructor obj = BeanUtility.createInstance(PrimitiveTypeConstructor.class, new Object[]{null});
+ assertNull(obj);
+ }
+ }
+
+ @Test
+ public void testCreateInstanceComplexType() throws Exception {
+ {
+ ComplexTypeConstructor obj = BeanUtility.createInstance(ComplexTypeConstructor.class, new Class<?>[]{Long.class}, new Object[]{42L});
+ assertNotNull(obj);
+ assertEquals("Expected constructor with primitive type long", 42L, obj.getLong());
+ }
+ {
+ ComplexTypeConstructor obj = BeanUtility.createInstance(ComplexTypeConstructor.class, new Class<?>[]{long.class}, new Object[]{42L});
+ assertNotNull(obj);
+ assertEquals("Expected constructor with primitive type long", 42L, obj.getLong());
+ }
+ {
+ ComplexTypeConstructor obj = BeanUtility.createInstance(ComplexTypeConstructor.class, 42L);
+ assertNotNull(obj);
+ assertEquals("Expected constructor with complex type java.lang.Long", 42L, obj.getLong());
+ }
+ {
+ ComplexTypeConstructor obj = BeanUtility.createInstance(ComplexTypeConstructor.class, new Object[]{null});
+ assertNotNull(obj);
+ assertEquals("Expected constructor with complex type java.lang.Long", Long.MAX_VALUE, obj.getLong());
+ }
+ }
+
+ @Test
+ public void testCreateInstancePrimitiveAndComplexType() throws Exception {
+ {
+ PrimitiveAndComplexTypeConstructor obj = BeanUtility.createInstance(PrimitiveAndComplexTypeConstructor.class, new Class<?>[]{long.class}, new Object[]{42L});
+ assertNotNull(obj);
+ assertEquals("Expected constructor with primitive type long", 42L, obj.getLong());
+ }
+ {
+ PrimitiveAndComplexTypeConstructor obj = BeanUtility.createInstance(PrimitiveAndComplexTypeConstructor.class, new Class<?>[]{Long.class}, new Object[]{42L});
+ assertNotNull(obj);
+ assertEquals("Expected constructor with primitive type long", -42L, obj.getLong());
+ }
+ {
+ PrimitiveAndComplexTypeConstructor obj = BeanUtility.createInstance(PrimitiveAndComplexTypeConstructor.class, 42L);
+ assertNotNull(obj);
+ assertEquals("Expected constructor with complex type java.lang.Long", -42L, obj.getLong());
+ }
+ {
+ PrimitiveAndComplexTypeConstructor obj = BeanUtility.createInstance(PrimitiveAndComplexTypeConstructor.class, new Object[]{null});
+ assertNotNull(obj);
+ assertEquals("Expected constructor with complex type java.lang.Long", Long.MAX_VALUE, obj.getLong());
+ }
+ }
+
+ @Test
+ public void testCreateInstanceArray() throws Exception {
+ {
+ ArrayConstructor obj = BeanUtility.createInstance(ArrayConstructor.class, new Class<?>[]{String[].class}, new Object[]{new String[]{"hello", "world"}});
+ assertNotNull(obj);
+ assertArrayEquals(new String[]{"hello", "world"}, obj.getStringArray());
+ }
+ {
+ ArrayConstructor obj = BeanUtility.createInstance(ArrayConstructor.class, (Object) new String[]{"hello", "world"});
+ assertNotNull(obj);
+ assertArrayEquals(new String[]{"hello", "world"}, obj.getStringArray());
+ }
+ }
+
+ @Test
+ public void testCreateInstanceVararg() throws Exception {
+ {
+ VarargConstructor obj = BeanUtility.createInstance(VarargConstructor.class, new Class<?>[]{String[].class}, new Object[]{new String[]{"hello", "world"}});
+ assertNotNull(obj);
+ assertArrayEquals(new String[]{"hello", "world"}, obj.getStringArray());
+ }
+ {
+ VarargConstructor obj = BeanUtility.createInstance(VarargConstructor.class, (Object) new String[]{"hello", "world"});
+ assertNotNull(obj);
+ assertArrayEquals(new String[]{"hello", "world"}, obj.getStringArray());
+ }
+ }
+
+ public static class OnlyDefalutConstructor {
+ }
+
+ public static class OnlyPrivateDefalutConstructor {
+ private OnlyPrivateDefalutConstructor() {
+ }
+ }
+
+ public static class ParamConstructor {
+ public ParamConstructor(A paramA) {
+ }
+ }
+
+ public static class MultyParamConstructor {
+ public MultyParamConstructor() {
+ }
+
+ public MultyParamConstructor(A paramA) {
+ }
+
+ public MultyParamConstructor(AExt paramAExt) {
+ }
+ }
+
+ public static class AmbiguousSignaturesConstructor {
+ public AmbiguousSignaturesConstructor(A a, B b) {
+ }
+
+ public AmbiguousSignaturesConstructor(AExt aExt, B b) {
+ }
+
+ public AmbiguousSignaturesConstructor(A a, BExt bExt) {
+ }
+ }
+
+ public static class PrimitiveTypeConstructor {
+ private final long m_long;
+
+ public PrimitiveTypeConstructor(long l) {
+ m_long = l;
+ }
+
+ public long getLong() {
+ return m_long;
+ }
+ }
+
+ public static class ComplexTypeConstructor {
+ private final long m_long;
+
+ public ComplexTypeConstructor(Long l) {
+ m_long = (l == null ? Long.MAX_VALUE : l.longValue());
+ }
+
+ public long getLong() {
+ return m_long;
+ }
+ }
+
+ public static class PrimitiveAndComplexTypeConstructor {
+ private final long m_long;
+
+ public PrimitiveAndComplexTypeConstructor(long l) {
+ m_long = l;
+ }
+
+ public PrimitiveAndComplexTypeConstructor(Long l) {
+ m_long = (l == null ? Long.MAX_VALUE : -l.longValue());
+ }
+
+ public long getLong() {
+ return m_long;
+ }
+ }
+
+ public static class ArrayConstructor {
+ private final String[] m_stringArray;
+
+ public ArrayConstructor(String[] stringArray) {
+ m_stringArray = stringArray;
+ }
+
+ public String[] getStringArray() {
+ return m_stringArray;
+ }
+ }
+
+ public static class VarargConstructor {
+ private final String[] m_stringArray;
+
+ public VarargConstructor(String... stringArray) {
+ m_stringArray = stringArray;
+ }
+
+ public String[] getStringArray() {
+ return m_stringArray;
+ }
+ }
+
+ public static class A {
+ }
+
+ public static class AExt extends A {
+ }
+
+ public static class AExt2 extends A {
+ }
+
+ public static class AExtExt extends AExt {
+ }
+
+ public static class B {
+ }
+
+ public static class BExt extends B {
+ }
+
+ private static class InvisibleClass {
+ }
+
+ public class NonStaticInnerClass {
+ }
+}
diff --git a/org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/CompareUtilityTest.java b/org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/CompareUtilityTest.java
index 6609f66b34..0c537a38f2 100644
--- a/org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/CompareUtilityTest.java
+++ b/org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/CompareUtilityTest.java
@@ -1,35 +1,35 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Test;
-
-/**
- * @since 3.8.1
- */
-public class CompareUtilityTest {
-
- @Test
- public void testIsOneOf() {
- assertFalse(CompareUtility.isOneOf("test", (Object[]) null));
- assertFalse(CompareUtility.isOneOf("test", new Object[0]));
- assertFalse(CompareUtility.isOneOf("test", "foo", "bar"));
- assertFalse(CompareUtility.isOneOf("test", "foo", 12L));
- assertFalse(CompareUtility.isOneOf(null, "foo", 12L));
- assertFalse(CompareUtility.isOneOf(null, (Object[]) null));
- assertTrue(CompareUtility.isOneOf("test", "test", 12L));
- assertTrue(CompareUtility.isOneOf(null, "test", 12L, null));
- assertTrue(CompareUtility.isOneOf(null, (Object) null));
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+/**
+ * @since 3.8.1
+ */
+public class CompareUtilityTest {
+
+ @Test
+ public void testIsOneOf() {
+ assertFalse(CompareUtility.isOneOf("test", (Object[]) null));
+ assertFalse(CompareUtility.isOneOf("test", new Object[0]));
+ assertFalse(CompareUtility.isOneOf("test", "foo", "bar"));
+ assertFalse(CompareUtility.isOneOf("test", "foo", 12L));
+ assertFalse(CompareUtility.isOneOf(null, "foo", 12L));
+ assertFalse(CompareUtility.isOneOf(null, (Object[]) null));
+ assertTrue(CompareUtility.isOneOf("test", "test", 12L));
+ assertTrue(CompareUtility.isOneOf(null, "test", 12L, null));
+ assertTrue(CompareUtility.isOneOf(null, (Object) null));
+ }
+}
diff --git a/org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/CsvHelperTest.java b/org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/CsvHelperTest.java
index c898568c13..3f01299a5f 100644
--- a/org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/CsvHelperTest.java
+++ b/org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/CsvHelperTest.java
@@ -1,60 +1,60 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import junit.framework.Assert;
-
-import org.eclipse.scout.commons.csv.CsvHelper;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.junit.Test;
-
-public class CsvHelperTest {
-
- /**
- * ticket 89708
- */
- @Test
- public void testExportData() throws ProcessingException, IOException {
-
- CsvHelper helper = new CsvHelper();
-
- Object[][] data = new Object[][]{
- {"a", "a", "a", "a", "a"},
- {"b", "b", "b", "b", "b"},
- {"c", "c", "c", "c", "c"},
- {"d", "d", "d", "d", "d"}
- };
-
- List<String> columnNames = new ArrayList<String>();
- columnNames = Arrays.asList(new String[]{"col1", "col2", "col3", "col4", "col5"});
-
- File testFile = File.createTempFile("CSV_TEST", ".csv");
-
- helper.exportData(data, testFile, "UTF-8", columnNames, true, null, false);
-
- String content = IOUtility.getContent(new FileReader(testFile));
- String[] lines = content.split("\n");
-
- Assert.assertEquals(lines.length, 5);
-
- for (String line : lines) {
- String[] x = line.split(",");
- Assert.assertEquals(x.length, 5);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import junit.framework.Assert;
+
+import org.eclipse.scout.commons.csv.CsvHelper;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.junit.Test;
+
+public class CsvHelperTest {
+
+ /**
+ * ticket 89708
+ */
+ @Test
+ public void testExportData() throws ProcessingException, IOException {
+
+ CsvHelper helper = new CsvHelper();
+
+ Object[][] data = new Object[][]{
+ {"a", "a", "a", "a", "a"},
+ {"b", "b", "b", "b", "b"},
+ {"c", "c", "c", "c", "c"},
+ {"d", "d", "d", "d", "d"}
+ };
+
+ List<String> columnNames = new ArrayList<String>();
+ columnNames = Arrays.asList(new String[]{"col1", "col2", "col3", "col4", "col5"});
+
+ File testFile = File.createTempFile("CSV_TEST", ".csv");
+
+ helper.exportData(data, testFile, "UTF-8", columnNames, true, null, false);
+
+ String content = IOUtility.getContent(new FileReader(testFile));
+ String[] lines = content.split("\n");
+
+ Assert.assertEquals(lines.length, 5);
+
+ for (String line : lines) {
+ String[] x = line.split(",");
+ Assert.assertEquals(x.length, 5);
+ }
+ }
+}
diff --git a/org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/DateUtilityTest.java b/org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/DateUtilityTest.java
index 3e1a72b61b..477b07392d 100644
--- a/org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/DateUtilityTest.java
+++ b/org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/DateUtilityTest.java
@@ -1,352 +1,352 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import java.util.Calendar;
-import java.util.Date;
-
-import junit.framework.Assert;
-
-import org.junit.Test;
-
-public class DateUtilityTest {
-
- @Test
- public void testIsInDateRange() {
- Date from = DateUtility.parse("01-02-2011 00:00", "dd-MM-yyyy HH:mm");
- Date d = DateUtility.parse("09-02-2011 00:00", "dd-MM-yyyy HH:mm");
- Assert.assertFalse(DateUtility.isInDateRange(from, d, DateUtility.parse("08-02-2011 14:52", "dd-MM-yyyy HH:mm")));
- Assert.assertFalse(DateUtility.isInDateRange(from, d, DateUtility.parse("08-02-2011 23:59", "dd-MM-yyyy HH:mm")));
- Assert.assertTrue(DateUtility.isInDateRange(from, d, DateUtility.parse("09-02-2011 00:00", "dd-MM-yyyy HH:mm")));
- Assert.assertTrue(DateUtility.isInDateRange(from, d, DateUtility.parse("09-02-2011 00:01", "dd-MM-yyyy HH:mm")));
- }
-
- @Test
- public void testConvertDoubleTimeToDate() {
- //TimeField selector values:
- testConvertDoubleTimeToDate(0.0, "1970-01-01_00:00:00.000");
- testConvertDoubleTimeToDate(0.020833333, "1970-01-01_00:30:00.000");
- testConvertDoubleTimeToDate(0.041666667, "1970-01-01_01:00:00.000");
- testConvertDoubleTimeToDate(0.0625, "1970-01-01_01:30:00.000");
- testConvertDoubleTimeToDate(0.083333333, "1970-01-01_02:00:00.000");
- testConvertDoubleTimeToDate(0.104166667, "1970-01-01_02:30:00.000");
- testConvertDoubleTimeToDate(0.125, "1970-01-01_03:00:00.000");
- testConvertDoubleTimeToDate(0.145833333, "1970-01-01_03:30:00.000");
- testConvertDoubleTimeToDate(0.166666667, "1970-01-01_04:00:00.000");
- testConvertDoubleTimeToDate(0.1875, "1970-01-01_04:30:00.000");
- testConvertDoubleTimeToDate(0.208333333, "1970-01-01_05:00:00.000");
- testConvertDoubleTimeToDate(0.229166667, "1970-01-01_05:30:00.000");
- testConvertDoubleTimeToDate(0.25, "1970-01-01_06:00:00.000");
- testConvertDoubleTimeToDate(0.270833333, "1970-01-01_06:30:00.000");
- testConvertDoubleTimeToDate(0.291666667, "1970-01-01_07:00:00.000");
- testConvertDoubleTimeToDate(0.3125, "1970-01-01_07:30:00.000");
- testConvertDoubleTimeToDate(0.333333333, "1970-01-01_08:00:00.000");
- testConvertDoubleTimeToDate(0.354166667, "1970-01-01_08:30:00.000");
- testConvertDoubleTimeToDate(0.375, "1970-01-01_09:00:00.000");
- testConvertDoubleTimeToDate(0.395833333, "1970-01-01_09:30:00.000");
- testConvertDoubleTimeToDate(0.416666667, "1970-01-01_10:00:00.000");
- testConvertDoubleTimeToDate(0.4375, "1970-01-01_10:30:00.000");
- testConvertDoubleTimeToDate(0.458333333, "1970-01-01_11:00:00.000");
- testConvertDoubleTimeToDate(0.479166667, "1970-01-01_11:30:00.000");
- testConvertDoubleTimeToDate(0.5, "1970-01-01_12:00:00.000");
- testConvertDoubleTimeToDate(0.520833333, "1970-01-01_12:30:00.000");
- testConvertDoubleTimeToDate(0.541666667, "1970-01-01_13:00:00.000");
- testConvertDoubleTimeToDate(0.5625, "1970-01-01_13:30:00.000");
- testConvertDoubleTimeToDate(0.583333333, "1970-01-01_14:00:00.000");
- testConvertDoubleTimeToDate(0.604166667, "1970-01-01_14:30:00.000");
- testConvertDoubleTimeToDate(0.625, "1970-01-01_15:00:00.000");
- testConvertDoubleTimeToDate(0.645833333, "1970-01-01_15:30:00.000");
- testConvertDoubleTimeToDate(0.666666667, "1970-01-01_16:00:00.000");
- testConvertDoubleTimeToDate(0.6875, "1970-01-01_16:30:00.000");
- testConvertDoubleTimeToDate(0.708333333, "1970-01-01_17:00:00.000");
- testConvertDoubleTimeToDate(0.729166667, "1970-01-01_17:30:00.000");
- testConvertDoubleTimeToDate(0.75, "1970-01-01_18:00:00.000");
- testConvertDoubleTimeToDate(0.770833333, "1970-01-01_18:30:00.000");
- testConvertDoubleTimeToDate(0.791666667, "1970-01-01_19:00:00.000");
- testConvertDoubleTimeToDate(0.8125, "1970-01-01_19:30:00.000");
- testConvertDoubleTimeToDate(0.833333333, "1970-01-01_20:00:00.000");
- testConvertDoubleTimeToDate(0.854166667, "1970-01-01_20:30:00.000");
- testConvertDoubleTimeToDate(0.875, "1970-01-01_21:00:00.000");
- testConvertDoubleTimeToDate(0.895833333, "1970-01-01_21:30:00.000");
- testConvertDoubleTimeToDate(0.916666667, "1970-01-01_22:00:00.000");
- testConvertDoubleTimeToDate(0.9375, "1970-01-01_22:30:00.000");
- testConvertDoubleTimeToDate(0.958333333, "1970-01-01_23:00:00.000");
- testConvertDoubleTimeToDate(0.979166667, "1970-01-01_23:30:00.000");
-
- //Limit condition:
- testConvertDoubleTimeToDate(0.999988425925926, "1970-01-01_23:59:59.000");
-
- //Out of definition Range:
- testConvertDoubleTimeToDate(1.0, "1970-01-01_00:00:00.000");
- testConvertDoubleTimeToDate(1.25, "1970-01-01_06:00:00.000");
- testConvertDoubleTimeToDate(1.875, "1970-01-01_21:00:00.000");
- testConvertDoubleTimeToDate(9.0, "1970-01-01_00:00:00.000");
- testConvertDoubleTimeToDate(9.25, "1970-01-01_06:00:00.000");
- testConvertDoubleTimeToDate(9.875, "1970-01-01_21:00:00.000");
-
- testConvertDoubleTimeToDate(-0.125, "1970-01-01_21:00:00.000");
- testConvertDoubleTimeToDate(-0.25, "1970-01-01_18:00:00.000");
- testConvertDoubleTimeToDate(-0.5, "1970-01-01_12:00:00.000");
- testConvertDoubleTimeToDate(-0.75, "1970-01-01_06:00:00.000");
- testConvertDoubleTimeToDate(-1.0, "1970-01-01_00:00:00.000");
- testConvertDoubleTimeToDate(-7.125, "1970-01-01_21:00:00.000");
- testConvertDoubleTimeToDate(-7.25, "1970-01-01_18:00:00.000");
- testConvertDoubleTimeToDate(-7.75, "1970-01-01_06:00:00.000");
- }
-
- /**
- * @param input
- * Double to be converted
- * @param expectedDate
- * with the Pattern 'yyyy-MM-dd_HH:mm:ss.SSS'
- */
- private void testConvertDoubleTimeToDate(Double input, String expectedDate) {
- Date expected = DateUtility.parse(expectedDate, "yyyy-MM-dd_HH:mm:ss.SSS");
- Date value = DateUtility.convertDoubleTimeToDate(input);
-
- String message = "Conversion DoubleTime <" + input + "> to Date";
- assertDateEquals(message, expected, value);
- }
-
- @Test
- public void testConvertDateToDoubleTime() {
- //TimeField selector values:
- testConvertDateToDoubleTime("1970-01-01_00:00:00.000", 0.0);
- testConvertDateToDoubleTime("1970-01-01_00:30:00.000", 0.020833333333333332);
- testConvertDateToDoubleTime("1970-01-01_01:00:00.000", 0.041666666666666664);
- testConvertDateToDoubleTime("1970-01-01_01:30:00.000", 0.0625);
- testConvertDateToDoubleTime("1970-01-01_02:00:00.000", 0.083333333333333332);
- testConvertDateToDoubleTime("1970-01-01_02:30:00.000", 0.104166666666666667);
- testConvertDateToDoubleTime("1970-01-01_03:00:00.000", 0.125);
- testConvertDateToDoubleTime("1970-01-01_03:30:00.000", 0.145833333333333332);
- testConvertDateToDoubleTime("1970-01-01_04:00:00.000", 0.166666666666666664);
- testConvertDateToDoubleTime("1970-01-01_04:30:00.000", 0.1875);
- testConvertDateToDoubleTime("1970-01-01_05:00:00.000", 0.208333333333333332);
- testConvertDateToDoubleTime("1970-01-01_05:30:00.000", 0.229166666666666664);
- testConvertDateToDoubleTime("1970-01-01_06:00:00.000", 0.25);
- testConvertDateToDoubleTime("1970-01-01_06:30:00.000", 0.270833333333333332);
- testConvertDateToDoubleTime("1970-01-01_07:00:00.000", 0.291666666666666664);
- testConvertDateToDoubleTime("1970-01-01_07:30:00.000", 0.3125);
- testConvertDateToDoubleTime("1970-01-01_08:00:00.000", 0.333333333333333332);
- testConvertDateToDoubleTime("1970-01-01_08:30:00.000", 0.354166666666666664);
- testConvertDateToDoubleTime("1970-01-01_09:00:00.000", 0.375);
- testConvertDateToDoubleTime("1970-01-01_09:30:00.000", 0.395833333333333332);
- testConvertDateToDoubleTime("1970-01-01_10:00:00.000", 0.416666666666666664);
- testConvertDateToDoubleTime("1970-01-01_10:30:00.000", 0.4375);
- testConvertDateToDoubleTime("1970-01-01_11:00:00.000", 0.458333333333333332);
- testConvertDateToDoubleTime("1970-01-01_11:30:00.000", 0.479166666666666664);
- testConvertDateToDoubleTime("1970-01-01_12:00:00.000", 0.5);
- testConvertDateToDoubleTime("1970-01-01_12:30:00.000", 0.520833333333333332);
- testConvertDateToDoubleTime("1970-01-01_13:00:00.000", 0.541666666666666664);
- testConvertDateToDoubleTime("1970-01-01_13:30:00.000", 0.5625);
- testConvertDateToDoubleTime("1970-01-01_14:00:00.000", 0.583333333333333332);
- testConvertDateToDoubleTime("1970-01-01_14:30:00.000", 0.604166666666666664);
- testConvertDateToDoubleTime("1970-01-01_15:00:00.000", 0.625);
- testConvertDateToDoubleTime("1970-01-01_15:30:00.000", 0.645833333333333332);
- testConvertDateToDoubleTime("1970-01-01_16:00:00.000", 0.666666666666666664);
- testConvertDateToDoubleTime("1970-01-01_16:30:00.000", 0.6875);
- testConvertDateToDoubleTime("1970-01-01_17:00:00.000", 0.708333333333333332);
- testConvertDateToDoubleTime("1970-01-01_17:30:00.000", 0.729166666666666664);
- testConvertDateToDoubleTime("1970-01-01_18:00:00.000", 0.75);
- testConvertDateToDoubleTime("1970-01-01_18:30:00.000", 0.770833333333333332);
- testConvertDateToDoubleTime("1970-01-01_19:00:00.000", 0.791666666666666664);
- testConvertDateToDoubleTime("1970-01-01_19:30:00.000", 0.8125);
- testConvertDateToDoubleTime("1970-01-01_20:00:00.000", 0.833333333333333332);
- testConvertDateToDoubleTime("1970-01-01_20:30:00.000", 0.854166666666666664);
- testConvertDateToDoubleTime("1970-01-01_21:00:00.000", 0.875);
- testConvertDateToDoubleTime("1970-01-01_21:30:00.000", 0.895833333333333332);
- testConvertDateToDoubleTime("1970-01-01_22:00:00.000", 0.916666666666666664);
- testConvertDateToDoubleTime("1970-01-01_22:30:00.000", 0.9375);
- testConvertDateToDoubleTime("1970-01-01_23:00:00.000", 0.958333333333333332);
- testConvertDateToDoubleTime("1970-01-01_23:30:00.000", 0.979166666666666664);
-
- //Limit condition:
- testConvertDateToDoubleTime("1970-01-01_23:59:59.000", 0.999988425925926);
-
- //Out of definition Range:
- testConvertDateToDoubleTime("1970-01-02_00:00:00.000", 0.0);
- testConvertDateToDoubleTime("1970-01-02_06:00:00.000", 0.25);
-
- testConvertDateToDoubleTime("1970-01-15_00:00:00.000", 0.0);
- testConvertDateToDoubleTime("1970-01-15_06:00:00.000", 0.25);
-
- testConvertDateToDoubleTime("1969-12-31_00:00:00.000", 0.0);
- testConvertDateToDoubleTime("1969-12-31_18:00:00.000", 0.75);
-
- testConvertDateToDoubleTime("1969-12-05_00:00:00.000", 0.0);
- testConvertDateToDoubleTime("1969-12-05_18:00:00.000", 0.75);
-
- }
-
- /**
- * @param input
- * Date defined with the Pattern 'yyyy-MM-dd_HH:mm:ss.SSS'
- * @param expected
- * Double DoubleTime as defined in {@link DateUtility#convertDateToDoubleTime(java.util.Date)}
- */
- private void testConvertDateToDoubleTime(String input, Double expected) {
- Assert.assertEquals("Conversion Date <" + input + "> to DoubleTime", expected, DateUtility.convertDateToDoubleTime(DateUtility.parse(input, "yyyy-MM-dd_HH:mm:ss.SSS")));
- }
-
- @Test
- public void testConvertDateToDoubleTimeToDate() {
- //TimeField selector values:
- testConvertDateToDoubleTimeToDate("1970-01-01_00:00:00.000");
- testConvertDateToDoubleTimeToDate("1970-01-01_00:30:00.000");
- testConvertDateToDoubleTimeToDate("1970-01-01_01:00:00.000");
- testConvertDateToDoubleTimeToDate("1970-01-01_01:30:00.000");
- testConvertDateToDoubleTimeToDate("1970-01-01_02:00:00.000");
- testConvertDateToDoubleTimeToDate("1970-01-01_02:30:00.000");
- testConvertDateToDoubleTimeToDate("1970-01-01_03:00:00.000");
- testConvertDateToDoubleTimeToDate("1970-01-01_03:30:00.000");
- testConvertDateToDoubleTimeToDate("1970-01-01_04:00:00.000");
- testConvertDateToDoubleTimeToDate("1970-01-01_04:30:00.000");
- testConvertDateToDoubleTimeToDate("1970-01-01_05:00:00.000");
- testConvertDateToDoubleTimeToDate("1970-01-01_05:30:00.000");
- testConvertDateToDoubleTimeToDate("1970-01-01_06:00:00.000");
- testConvertDateToDoubleTimeToDate("1970-01-01_06:30:00.000");
- testConvertDateToDoubleTimeToDate("1970-01-01_07:00:00.000");
- testConvertDateToDoubleTimeToDate("1970-01-01_07:30:00.000");
- testConvertDateToDoubleTimeToDate("1970-01-01_08:00:00.000");
- testConvertDateToDoubleTimeToDate("1970-01-01_08:30:00.000");
- testConvertDateToDoubleTimeToDate("1970-01-01_09:00:00.000");
- testConvertDateToDoubleTimeToDate("1970-01-01_09:30:00.000");
- testConvertDateToDoubleTimeToDate("1970-01-01_10:00:00.000");
- testConvertDateToDoubleTimeToDate("1970-01-01_10:30:00.000");
- testConvertDateToDoubleTimeToDate("1970-01-01_11:00:00.000");
- testConvertDateToDoubleTimeToDate("1970-01-01_11:30:00.000");
- testConvertDateToDoubleTimeToDate("1970-01-01_12:00:00.000");
- testConvertDateToDoubleTimeToDate("1970-01-01_12:30:00.000");
- testConvertDateToDoubleTimeToDate("1970-01-01_13:00:00.000");
- testConvertDateToDoubleTimeToDate("1970-01-01_13:30:00.000");
- testConvertDateToDoubleTimeToDate("1970-01-01_14:00:00.000");
- testConvertDateToDoubleTimeToDate("1970-01-01_14:30:00.000");
- testConvertDateToDoubleTimeToDate("1970-01-01_15:00:00.000");
- testConvertDateToDoubleTimeToDate("1970-01-01_15:30:00.000");
- testConvertDateToDoubleTimeToDate("1970-01-01_16:00:00.000");
- testConvertDateToDoubleTimeToDate("1970-01-01_16:30:00.000");
- testConvertDateToDoubleTimeToDate("1970-01-01_17:00:00.000");
- testConvertDateToDoubleTimeToDate("1970-01-01_17:30:00.000");
- testConvertDateToDoubleTimeToDate("1970-01-01_18:00:00.000");
- testConvertDateToDoubleTimeToDate("1970-01-01_18:30:00.000");
- testConvertDateToDoubleTimeToDate("1970-01-01_19:00:00.000");
- testConvertDateToDoubleTimeToDate("1970-01-01_19:30:00.000");
- testConvertDateToDoubleTimeToDate("1970-01-01_20:00:00.000");
- testConvertDateToDoubleTimeToDate("1970-01-01_20:30:00.000");
- testConvertDateToDoubleTimeToDate("1970-01-01_21:00:00.000");
- testConvertDateToDoubleTimeToDate("1970-01-01_21:30:00.000");
- testConvertDateToDoubleTimeToDate("1970-01-01_22:00:00.000");
- testConvertDateToDoubleTimeToDate("1970-01-01_22:30:00.000");
- testConvertDateToDoubleTimeToDate("1970-01-01_23:00:00.000");
- testConvertDateToDoubleTimeToDate("1970-01-01_23:30:00.000");
-
- //Limit condition:
- testConvertDateToDoubleTimeToDate("1970-01-01_23:59:59.000");
- }
-
- /**
- * @param input
- * Date defined with the Pattern 'yyyy-MM-dd_HH:mm:ss.SSS'
- */
- private void testConvertDateToDoubleTimeToDate(String input) {
- Assert.assertEquals("Conversion Date <" + input + "> to DoubleTime and to Date", DateUtility.parse(input, "yyyy-MM-dd_HH:mm:ss.SSS"), DateUtility.convertDoubleTimeToDate(DateUtility.convertDateToDoubleTime(DateUtility.parse(input, "yyyy-MM-dd_HH:mm:ss.SSS"))));
- }
-
- @Test
- public void testConvertDoubleTimeToDateToDoubleTime() {
- //TimeField selector values:
- testConvertDoubleTimeToDateToDoubleTime(0.0);
- testConvertDoubleTimeToDateToDoubleTime(0.020833333333333332);
- testConvertDoubleTimeToDateToDoubleTime(0.041666666666666664);
- testConvertDoubleTimeToDateToDoubleTime(0.0625);
- testConvertDoubleTimeToDateToDoubleTime(0.083333333333333332);
- testConvertDoubleTimeToDateToDoubleTime(0.104166666666666667);
- testConvertDoubleTimeToDateToDoubleTime(0.125);
- testConvertDoubleTimeToDateToDoubleTime(0.145833333333333332);
- testConvertDoubleTimeToDateToDoubleTime(0.166666666666666664);
- testConvertDoubleTimeToDateToDoubleTime(0.1875);
- testConvertDoubleTimeToDateToDoubleTime(0.208333333333333332);
- testConvertDoubleTimeToDateToDoubleTime(0.229166666666666664);
- testConvertDoubleTimeToDateToDoubleTime(0.25);
- testConvertDoubleTimeToDateToDoubleTime(0.270833333333333332);
- testConvertDoubleTimeToDateToDoubleTime(0.291666666666666664);
- testConvertDoubleTimeToDateToDoubleTime(0.3125);
- testConvertDoubleTimeToDateToDoubleTime(0.333333333333333332);
- testConvertDoubleTimeToDateToDoubleTime(0.354166666666666664);
- testConvertDoubleTimeToDateToDoubleTime(0.375);
- testConvertDoubleTimeToDateToDoubleTime(0.395833333333333332);
- testConvertDoubleTimeToDateToDoubleTime(0.416666666666666664);
- testConvertDoubleTimeToDateToDoubleTime(0.4375);
- testConvertDoubleTimeToDateToDoubleTime(0.458333333333333332);
- testConvertDoubleTimeToDateToDoubleTime(0.479166666666666664);
- testConvertDoubleTimeToDateToDoubleTime(0.5);
- testConvertDoubleTimeToDateToDoubleTime(0.520833333333333332);
- testConvertDoubleTimeToDateToDoubleTime(0.541666666666666664);
- testConvertDoubleTimeToDateToDoubleTime(0.5625);
- testConvertDoubleTimeToDateToDoubleTime(0.583333333333333332);
- testConvertDoubleTimeToDateToDoubleTime(0.604166666666666664);
- testConvertDoubleTimeToDateToDoubleTime(0.625);
- testConvertDoubleTimeToDateToDoubleTime(0.645833333333333332);
- testConvertDoubleTimeToDateToDoubleTime(0.666666666666666664);
- testConvertDoubleTimeToDateToDoubleTime(0.6875);
- testConvertDoubleTimeToDateToDoubleTime(0.708333333333333332);
- testConvertDoubleTimeToDateToDoubleTime(0.729166666666666664);
- testConvertDoubleTimeToDateToDoubleTime(0.75);
- testConvertDoubleTimeToDateToDoubleTime(0.770833333333333332);
- testConvertDoubleTimeToDateToDoubleTime(0.791666666666666664);
- testConvertDoubleTimeToDateToDoubleTime(0.8125);
- testConvertDoubleTimeToDateToDoubleTime(0.833333333333333332);
- testConvertDoubleTimeToDateToDoubleTime(0.854166666666666664);
- testConvertDoubleTimeToDateToDoubleTime(0.875);
- testConvertDoubleTimeToDateToDoubleTime(0.895833333333333332);
- testConvertDoubleTimeToDateToDoubleTime(0.916666666666666664);
- testConvertDoubleTimeToDateToDoubleTime(0.9375);
- testConvertDoubleTimeToDateToDoubleTime(0.958333333333333332);
- testConvertDoubleTimeToDateToDoubleTime(0.979166666666666664);
-
- //Limit condition:
- testConvertDoubleTimeToDateToDoubleTime(0.999988425925926);
- }
-
- /**
- * @param input
- * Double DoubleTime as defined in {@link DateUtility#convertDateToDoubleTime(java.util.Date)}
- */
- private void testConvertDoubleTimeToDateToDoubleTime(Double input) {
- Assert.assertEquals("Conversion Date <" + input + "> to DoubleTime and to Date", input, DateUtility.convertDateToDoubleTime(DateUtility.convertDoubleTimeToDate(input)));
- }
-
- /**
- * @param message
- * @param expected
- * @param value
- */
- public static void assertDateEquals(String message, Date expected, Date value) {
- Calendar v = Calendar.getInstance();
- v.clear();
- v.setTime(value);
-
- Calendar e = Calendar.getInstance();
- e.clear();
- e.setTime(expected);
-
- Assert.assertEquals(message + "[MILLIS]", e.get(Calendar.MILLISECOND), v.get(Calendar.MILLISECOND));
- Assert.assertEquals(message + "[SEC]", e.get(Calendar.SECOND), v.get(Calendar.SECOND));
- Assert.assertEquals(message + "[MIN]", e.get(Calendar.MINUTE), v.get(Calendar.MINUTE));
- Assert.assertEquals(message + "[HOURS]", e.get(Calendar.HOUR_OF_DAY), v.get(Calendar.HOUR_OF_DAY));
-
- Assert.assertEquals(message + "[DAY]", e.get(Calendar.DAY_OF_MONTH), v.get(Calendar.DAY_OF_MONTH));
- Assert.assertEquals(message + "[MONTH]", e.get(Calendar.MONTH), v.get(Calendar.MONTH));
- Assert.assertEquals(message + "[YEAR]", e.get(Calendar.YEAR), v.get(Calendar.YEAR));
-
- Assert.assertEquals(message + "(DATE)", expected, value);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import java.util.Calendar;
+import java.util.Date;
+
+import junit.framework.Assert;
+
+import org.junit.Test;
+
+public class DateUtilityTest {
+
+ @Test
+ public void testIsInDateRange() {
+ Date from = DateUtility.parse("01-02-2011 00:00", "dd-MM-yyyy HH:mm");
+ Date d = DateUtility.parse("09-02-2011 00:00", "dd-MM-yyyy HH:mm");
+ Assert.assertFalse(DateUtility.isInDateRange(from, d, DateUtility.parse("08-02-2011 14:52", "dd-MM-yyyy HH:mm")));
+ Assert.assertFalse(DateUtility.isInDateRange(from, d, DateUtility.parse("08-02-2011 23:59", "dd-MM-yyyy HH:mm")));
+ Assert.assertTrue(DateUtility.isInDateRange(from, d, DateUtility.parse("09-02-2011 00:00", "dd-MM-yyyy HH:mm")));
+ Assert.assertTrue(DateUtility.isInDateRange(from, d, DateUtility.parse("09-02-2011 00:01", "dd-MM-yyyy HH:mm")));
+ }
+
+ @Test
+ public void testConvertDoubleTimeToDate() {
+ //TimeField selector values:
+ testConvertDoubleTimeToDate(0.0, "1970-01-01_00:00:00.000");
+ testConvertDoubleTimeToDate(0.020833333, "1970-01-01_00:30:00.000");
+ testConvertDoubleTimeToDate(0.041666667, "1970-01-01_01:00:00.000");
+ testConvertDoubleTimeToDate(0.0625, "1970-01-01_01:30:00.000");
+ testConvertDoubleTimeToDate(0.083333333, "1970-01-01_02:00:00.000");
+ testConvertDoubleTimeToDate(0.104166667, "1970-01-01_02:30:00.000");
+ testConvertDoubleTimeToDate(0.125, "1970-01-01_03:00:00.000");
+ testConvertDoubleTimeToDate(0.145833333, "1970-01-01_03:30:00.000");
+ testConvertDoubleTimeToDate(0.166666667, "1970-01-01_04:00:00.000");
+ testConvertDoubleTimeToDate(0.1875, "1970-01-01_04:30:00.000");
+ testConvertDoubleTimeToDate(0.208333333, "1970-01-01_05:00:00.000");
+ testConvertDoubleTimeToDate(0.229166667, "1970-01-01_05:30:00.000");
+ testConvertDoubleTimeToDate(0.25, "1970-01-01_06:00:00.000");
+ testConvertDoubleTimeToDate(0.270833333, "1970-01-01_06:30:00.000");
+ testConvertDoubleTimeToDate(0.291666667, "1970-01-01_07:00:00.000");
+ testConvertDoubleTimeToDate(0.3125, "1970-01-01_07:30:00.000");
+ testConvertDoubleTimeToDate(0.333333333, "1970-01-01_08:00:00.000");
+ testConvertDoubleTimeToDate(0.354166667, "1970-01-01_08:30:00.000");
+ testConvertDoubleTimeToDate(0.375, "1970-01-01_09:00:00.000");
+ testConvertDoubleTimeToDate(0.395833333, "1970-01-01_09:30:00.000");
+ testConvertDoubleTimeToDate(0.416666667, "1970-01-01_10:00:00.000");
+ testConvertDoubleTimeToDate(0.4375, "1970-01-01_10:30:00.000");
+ testConvertDoubleTimeToDate(0.458333333, "1970-01-01_11:00:00.000");
+ testConvertDoubleTimeToDate(0.479166667, "1970-01-01_11:30:00.000");
+ testConvertDoubleTimeToDate(0.5, "1970-01-01_12:00:00.000");
+ testConvertDoubleTimeToDate(0.520833333, "1970-01-01_12:30:00.000");
+ testConvertDoubleTimeToDate(0.541666667, "1970-01-01_13:00:00.000");
+ testConvertDoubleTimeToDate(0.5625, "1970-01-01_13:30:00.000");
+ testConvertDoubleTimeToDate(0.583333333, "1970-01-01_14:00:00.000");
+ testConvertDoubleTimeToDate(0.604166667, "1970-01-01_14:30:00.000");
+ testConvertDoubleTimeToDate(0.625, "1970-01-01_15:00:00.000");
+ testConvertDoubleTimeToDate(0.645833333, "1970-01-01_15:30:00.000");
+ testConvertDoubleTimeToDate(0.666666667, "1970-01-01_16:00:00.000");
+ testConvertDoubleTimeToDate(0.6875, "1970-01-01_16:30:00.000");
+ testConvertDoubleTimeToDate(0.708333333, "1970-01-01_17:00:00.000");
+ testConvertDoubleTimeToDate(0.729166667, "1970-01-01_17:30:00.000");
+ testConvertDoubleTimeToDate(0.75, "1970-01-01_18:00:00.000");
+ testConvertDoubleTimeToDate(0.770833333, "1970-01-01_18:30:00.000");
+ testConvertDoubleTimeToDate(0.791666667, "1970-01-01_19:00:00.000");
+ testConvertDoubleTimeToDate(0.8125, "1970-01-01_19:30:00.000");
+ testConvertDoubleTimeToDate(0.833333333, "1970-01-01_20:00:00.000");
+ testConvertDoubleTimeToDate(0.854166667, "1970-01-01_20:30:00.000");
+ testConvertDoubleTimeToDate(0.875, "1970-01-01_21:00:00.000");
+ testConvertDoubleTimeToDate(0.895833333, "1970-01-01_21:30:00.000");
+ testConvertDoubleTimeToDate(0.916666667, "1970-01-01_22:00:00.000");
+ testConvertDoubleTimeToDate(0.9375, "1970-01-01_22:30:00.000");
+ testConvertDoubleTimeToDate(0.958333333, "1970-01-01_23:00:00.000");
+ testConvertDoubleTimeToDate(0.979166667, "1970-01-01_23:30:00.000");
+
+ //Limit condition:
+ testConvertDoubleTimeToDate(0.999988425925926, "1970-01-01_23:59:59.000");
+
+ //Out of definition Range:
+ testConvertDoubleTimeToDate(1.0, "1970-01-01_00:00:00.000");
+ testConvertDoubleTimeToDate(1.25, "1970-01-01_06:00:00.000");
+ testConvertDoubleTimeToDate(1.875, "1970-01-01_21:00:00.000");
+ testConvertDoubleTimeToDate(9.0, "1970-01-01_00:00:00.000");
+ testConvertDoubleTimeToDate(9.25, "1970-01-01_06:00:00.000");
+ testConvertDoubleTimeToDate(9.875, "1970-01-01_21:00:00.000");
+
+ testConvertDoubleTimeToDate(-0.125, "1970-01-01_21:00:00.000");
+ testConvertDoubleTimeToDate(-0.25, "1970-01-01_18:00:00.000");
+ testConvertDoubleTimeToDate(-0.5, "1970-01-01_12:00:00.000");
+ testConvertDoubleTimeToDate(-0.75, "1970-01-01_06:00:00.000");
+ testConvertDoubleTimeToDate(-1.0, "1970-01-01_00:00:00.000");
+ testConvertDoubleTimeToDate(-7.125, "1970-01-01_21:00:00.000");
+ testConvertDoubleTimeToDate(-7.25, "1970-01-01_18:00:00.000");
+ testConvertDoubleTimeToDate(-7.75, "1970-01-01_06:00:00.000");
+ }
+
+ /**
+ * @param input
+ * Double to be converted
+ * @param expectedDate
+ * with the Pattern 'yyyy-MM-dd_HH:mm:ss.SSS'
+ */
+ private void testConvertDoubleTimeToDate(Double input, String expectedDate) {
+ Date expected = DateUtility.parse(expectedDate, "yyyy-MM-dd_HH:mm:ss.SSS");
+ Date value = DateUtility.convertDoubleTimeToDate(input);
+
+ String message = "Conversion DoubleTime <" + input + "> to Date";
+ assertDateEquals(message, expected, value);
+ }
+
+ @Test
+ public void testConvertDateToDoubleTime() {
+ //TimeField selector values:
+ testConvertDateToDoubleTime("1970-01-01_00:00:00.000", 0.0);
+ testConvertDateToDoubleTime("1970-01-01_00:30:00.000", 0.020833333333333332);
+ testConvertDateToDoubleTime("1970-01-01_01:00:00.000", 0.041666666666666664);
+ testConvertDateToDoubleTime("1970-01-01_01:30:00.000", 0.0625);
+ testConvertDateToDoubleTime("1970-01-01_02:00:00.000", 0.083333333333333332);
+ testConvertDateToDoubleTime("1970-01-01_02:30:00.000", 0.104166666666666667);
+ testConvertDateToDoubleTime("1970-01-01_03:00:00.000", 0.125);
+ testConvertDateToDoubleTime("1970-01-01_03:30:00.000", 0.145833333333333332);
+ testConvertDateToDoubleTime("1970-01-01_04:00:00.000", 0.166666666666666664);
+ testConvertDateToDoubleTime("1970-01-01_04:30:00.000", 0.1875);
+ testConvertDateToDoubleTime("1970-01-01_05:00:00.000", 0.208333333333333332);
+ testConvertDateToDoubleTime("1970-01-01_05:30:00.000", 0.229166666666666664);
+ testConvertDateToDoubleTime("1970-01-01_06:00:00.000", 0.25);
+ testConvertDateToDoubleTime("1970-01-01_06:30:00.000", 0.270833333333333332);
+ testConvertDateToDoubleTime("1970-01-01_07:00:00.000", 0.291666666666666664);
+ testConvertDateToDoubleTime("1970-01-01_07:30:00.000", 0.3125);
+ testConvertDateToDoubleTime("1970-01-01_08:00:00.000", 0.333333333333333332);
+ testConvertDateToDoubleTime("1970-01-01_08:30:00.000", 0.354166666666666664);
+ testConvertDateToDoubleTime("1970-01-01_09:00:00.000", 0.375);
+ testConvertDateToDoubleTime("1970-01-01_09:30:00.000", 0.395833333333333332);
+ testConvertDateToDoubleTime("1970-01-01_10:00:00.000", 0.416666666666666664);
+ testConvertDateToDoubleTime("1970-01-01_10:30:00.000", 0.4375);
+ testConvertDateToDoubleTime("1970-01-01_11:00:00.000", 0.458333333333333332);
+ testConvertDateToDoubleTime("1970-01-01_11:30:00.000", 0.479166666666666664);
+ testConvertDateToDoubleTime("1970-01-01_12:00:00.000", 0.5);
+ testConvertDateToDoubleTime("1970-01-01_12:30:00.000", 0.520833333333333332);
+ testConvertDateToDoubleTime("1970-01-01_13:00:00.000", 0.541666666666666664);
+ testConvertDateToDoubleTime("1970-01-01_13:30:00.000", 0.5625);
+ testConvertDateToDoubleTime("1970-01-01_14:00:00.000", 0.583333333333333332);
+ testConvertDateToDoubleTime("1970-01-01_14:30:00.000", 0.604166666666666664);
+ testConvertDateToDoubleTime("1970-01-01_15:00:00.000", 0.625);
+ testConvertDateToDoubleTime("1970-01-01_15:30:00.000", 0.645833333333333332);
+ testConvertDateToDoubleTime("1970-01-01_16:00:00.000", 0.666666666666666664);
+ testConvertDateToDoubleTime("1970-01-01_16:30:00.000", 0.6875);
+ testConvertDateToDoubleTime("1970-01-01_17:00:00.000", 0.708333333333333332);
+ testConvertDateToDoubleTime("1970-01-01_17:30:00.000", 0.729166666666666664);
+ testConvertDateToDoubleTime("1970-01-01_18:00:00.000", 0.75);
+ testConvertDateToDoubleTime("1970-01-01_18:30:00.000", 0.770833333333333332);
+ testConvertDateToDoubleTime("1970-01-01_19:00:00.000", 0.791666666666666664);
+ testConvertDateToDoubleTime("1970-01-01_19:30:00.000", 0.8125);
+ testConvertDateToDoubleTime("1970-01-01_20:00:00.000", 0.833333333333333332);
+ testConvertDateToDoubleTime("1970-01-01_20:30:00.000", 0.854166666666666664);
+ testConvertDateToDoubleTime("1970-01-01_21:00:00.000", 0.875);
+ testConvertDateToDoubleTime("1970-01-01_21:30:00.000", 0.895833333333333332);
+ testConvertDateToDoubleTime("1970-01-01_22:00:00.000", 0.916666666666666664);
+ testConvertDateToDoubleTime("1970-01-01_22:30:00.000", 0.9375);
+ testConvertDateToDoubleTime("1970-01-01_23:00:00.000", 0.958333333333333332);
+ testConvertDateToDoubleTime("1970-01-01_23:30:00.000", 0.979166666666666664);
+
+ //Limit condition:
+ testConvertDateToDoubleTime("1970-01-01_23:59:59.000", 0.999988425925926);
+
+ //Out of definition Range:
+ testConvertDateToDoubleTime("1970-01-02_00:00:00.000", 0.0);
+ testConvertDateToDoubleTime("1970-01-02_06:00:00.000", 0.25);
+
+ testConvertDateToDoubleTime("1970-01-15_00:00:00.000", 0.0);
+ testConvertDateToDoubleTime("1970-01-15_06:00:00.000", 0.25);
+
+ testConvertDateToDoubleTime("1969-12-31_00:00:00.000", 0.0);
+ testConvertDateToDoubleTime("1969-12-31_18:00:00.000", 0.75);
+
+ testConvertDateToDoubleTime("1969-12-05_00:00:00.000", 0.0);
+ testConvertDateToDoubleTime("1969-12-05_18:00:00.000", 0.75);
+
+ }
+
+ /**
+ * @param input
+ * Date defined with the Pattern 'yyyy-MM-dd_HH:mm:ss.SSS'
+ * @param expected
+ * Double DoubleTime as defined in {@link DateUtility#convertDateToDoubleTime(java.util.Date)}
+ */
+ private void testConvertDateToDoubleTime(String input, Double expected) {
+ Assert.assertEquals("Conversion Date <" + input + "> to DoubleTime", expected, DateUtility.convertDateToDoubleTime(DateUtility.parse(input, "yyyy-MM-dd_HH:mm:ss.SSS")));
+ }
+
+ @Test
+ public void testConvertDateToDoubleTimeToDate() {
+ //TimeField selector values:
+ testConvertDateToDoubleTimeToDate("1970-01-01_00:00:00.000");
+ testConvertDateToDoubleTimeToDate("1970-01-01_00:30:00.000");
+ testConvertDateToDoubleTimeToDate("1970-01-01_01:00:00.000");
+ testConvertDateToDoubleTimeToDate("1970-01-01_01:30:00.000");
+ testConvertDateToDoubleTimeToDate("1970-01-01_02:00:00.000");
+ testConvertDateToDoubleTimeToDate("1970-01-01_02:30:00.000");
+ testConvertDateToDoubleTimeToDate("1970-01-01_03:00:00.000");
+ testConvertDateToDoubleTimeToDate("1970-01-01_03:30:00.000");
+ testConvertDateToDoubleTimeToDate("1970-01-01_04:00:00.000");
+ testConvertDateToDoubleTimeToDate("1970-01-01_04:30:00.000");
+ testConvertDateToDoubleTimeToDate("1970-01-01_05:00:00.000");
+ testConvertDateToDoubleTimeToDate("1970-01-01_05:30:00.000");
+ testConvertDateToDoubleTimeToDate("1970-01-01_06:00:00.000");
+ testConvertDateToDoubleTimeToDate("1970-01-01_06:30:00.000");
+ testConvertDateToDoubleTimeToDate("1970-01-01_07:00:00.000");
+ testConvertDateToDoubleTimeToDate("1970-01-01_07:30:00.000");
+ testConvertDateToDoubleTimeToDate("1970-01-01_08:00:00.000");
+ testConvertDateToDoubleTimeToDate("1970-01-01_08:30:00.000");
+ testConvertDateToDoubleTimeToDate("1970-01-01_09:00:00.000");
+ testConvertDateToDoubleTimeToDate("1970-01-01_09:30:00.000");
+ testConvertDateToDoubleTimeToDate("1970-01-01_10:00:00.000");
+ testConvertDateToDoubleTimeToDate("1970-01-01_10:30:00.000");
+ testConvertDateToDoubleTimeToDate("1970-01-01_11:00:00.000");
+ testConvertDateToDoubleTimeToDate("1970-01-01_11:30:00.000");
+ testConvertDateToDoubleTimeToDate("1970-01-01_12:00:00.000");
+ testConvertDateToDoubleTimeToDate("1970-01-01_12:30:00.000");
+ testConvertDateToDoubleTimeToDate("1970-01-01_13:00:00.000");
+ testConvertDateToDoubleTimeToDate("1970-01-01_13:30:00.000");
+ testConvertDateToDoubleTimeToDate("1970-01-01_14:00:00.000");
+ testConvertDateToDoubleTimeToDate("1970-01-01_14:30:00.000");
+ testConvertDateToDoubleTimeToDate("1970-01-01_15:00:00.000");
+ testConvertDateToDoubleTimeToDate("1970-01-01_15:30:00.000");
+ testConvertDateToDoubleTimeToDate("1970-01-01_16:00:00.000");
+ testConvertDateToDoubleTimeToDate("1970-01-01_16:30:00.000");
+ testConvertDateToDoubleTimeToDate("1970-01-01_17:00:00.000");
+ testConvertDateToDoubleTimeToDate("1970-01-01_17:30:00.000");
+ testConvertDateToDoubleTimeToDate("1970-01-01_18:00:00.000");
+ testConvertDateToDoubleTimeToDate("1970-01-01_18:30:00.000");
+ testConvertDateToDoubleTimeToDate("1970-01-01_19:00:00.000");
+ testConvertDateToDoubleTimeToDate("1970-01-01_19:30:00.000");
+ testConvertDateToDoubleTimeToDate("1970-01-01_20:00:00.000");
+ testConvertDateToDoubleTimeToDate("1970-01-01_20:30:00.000");
+ testConvertDateToDoubleTimeToDate("1970-01-01_21:00:00.000");
+ testConvertDateToDoubleTimeToDate("1970-01-01_21:30:00.000");
+ testConvertDateToDoubleTimeToDate("1970-01-01_22:00:00.000");
+ testConvertDateToDoubleTimeToDate("1970-01-01_22:30:00.000");
+ testConvertDateToDoubleTimeToDate("1970-01-01_23:00:00.000");
+ testConvertDateToDoubleTimeToDate("1970-01-01_23:30:00.000");
+
+ //Limit condition:
+ testConvertDateToDoubleTimeToDate("1970-01-01_23:59:59.000");
+ }
+
+ /**
+ * @param input
+ * Date defined with the Pattern 'yyyy-MM-dd_HH:mm:ss.SSS'
+ */
+ private void testConvertDateToDoubleTimeToDate(String input) {
+ Assert.assertEquals("Conversion Date <" + input + "> to DoubleTime and to Date", DateUtility.parse(input, "yyyy-MM-dd_HH:mm:ss.SSS"), DateUtility.convertDoubleTimeToDate(DateUtility.convertDateToDoubleTime(DateUtility.parse(input, "yyyy-MM-dd_HH:mm:ss.SSS"))));
+ }
+
+ @Test
+ public void testConvertDoubleTimeToDateToDoubleTime() {
+ //TimeField selector values:
+ testConvertDoubleTimeToDateToDoubleTime(0.0);
+ testConvertDoubleTimeToDateToDoubleTime(0.020833333333333332);
+ testConvertDoubleTimeToDateToDoubleTime(0.041666666666666664);
+ testConvertDoubleTimeToDateToDoubleTime(0.0625);
+ testConvertDoubleTimeToDateToDoubleTime(0.083333333333333332);
+ testConvertDoubleTimeToDateToDoubleTime(0.104166666666666667);
+ testConvertDoubleTimeToDateToDoubleTime(0.125);
+ testConvertDoubleTimeToDateToDoubleTime(0.145833333333333332);
+ testConvertDoubleTimeToDateToDoubleTime(0.166666666666666664);
+ testConvertDoubleTimeToDateToDoubleTime(0.1875);
+ testConvertDoubleTimeToDateToDoubleTime(0.208333333333333332);
+ testConvertDoubleTimeToDateToDoubleTime(0.229166666666666664);
+ testConvertDoubleTimeToDateToDoubleTime(0.25);
+ testConvertDoubleTimeToDateToDoubleTime(0.270833333333333332);
+ testConvertDoubleTimeToDateToDoubleTime(0.291666666666666664);
+ testConvertDoubleTimeToDateToDoubleTime(0.3125);
+ testConvertDoubleTimeToDateToDoubleTime(0.333333333333333332);
+ testConvertDoubleTimeToDateToDoubleTime(0.354166666666666664);
+ testConvertDoubleTimeToDateToDoubleTime(0.375);
+ testConvertDoubleTimeToDateToDoubleTime(0.395833333333333332);
+ testConvertDoubleTimeToDateToDoubleTime(0.416666666666666664);
+ testConvertDoubleTimeToDateToDoubleTime(0.4375);
+ testConvertDoubleTimeToDateToDoubleTime(0.458333333333333332);
+ testConvertDoubleTimeToDateToDoubleTime(0.479166666666666664);
+ testConvertDoubleTimeToDateToDoubleTime(0.5);
+ testConvertDoubleTimeToDateToDoubleTime(0.520833333333333332);
+ testConvertDoubleTimeToDateToDoubleTime(0.541666666666666664);
+ testConvertDoubleTimeToDateToDoubleTime(0.5625);
+ testConvertDoubleTimeToDateToDoubleTime(0.583333333333333332);
+ testConvertDoubleTimeToDateToDoubleTime(0.604166666666666664);
+ testConvertDoubleTimeToDateToDoubleTime(0.625);
+ testConvertDoubleTimeToDateToDoubleTime(0.645833333333333332);
+ testConvertDoubleTimeToDateToDoubleTime(0.666666666666666664);
+ testConvertDoubleTimeToDateToDoubleTime(0.6875);
+ testConvertDoubleTimeToDateToDoubleTime(0.708333333333333332);
+ testConvertDoubleTimeToDateToDoubleTime(0.729166666666666664);
+ testConvertDoubleTimeToDateToDoubleTime(0.75);
+ testConvertDoubleTimeToDateToDoubleTime(0.770833333333333332);
+ testConvertDoubleTimeToDateToDoubleTime(0.791666666666666664);
+ testConvertDoubleTimeToDateToDoubleTime(0.8125);
+ testConvertDoubleTimeToDateToDoubleTime(0.833333333333333332);
+ testConvertDoubleTimeToDateToDoubleTime(0.854166666666666664);
+ testConvertDoubleTimeToDateToDoubleTime(0.875);
+ testConvertDoubleTimeToDateToDoubleTime(0.895833333333333332);
+ testConvertDoubleTimeToDateToDoubleTime(0.916666666666666664);
+ testConvertDoubleTimeToDateToDoubleTime(0.9375);
+ testConvertDoubleTimeToDateToDoubleTime(0.958333333333333332);
+ testConvertDoubleTimeToDateToDoubleTime(0.979166666666666664);
+
+ //Limit condition:
+ testConvertDoubleTimeToDateToDoubleTime(0.999988425925926);
+ }
+
+ /**
+ * @param input
+ * Double DoubleTime as defined in {@link DateUtility#convertDateToDoubleTime(java.util.Date)}
+ */
+ private void testConvertDoubleTimeToDateToDoubleTime(Double input) {
+ Assert.assertEquals("Conversion Date <" + input + "> to DoubleTime and to Date", input, DateUtility.convertDateToDoubleTime(DateUtility.convertDoubleTimeToDate(input)));
+ }
+
+ /**
+ * @param message
+ * @param expected
+ * @param value
+ */
+ public static void assertDateEquals(String message, Date expected, Date value) {
+ Calendar v = Calendar.getInstance();
+ v.clear();
+ v.setTime(value);
+
+ Calendar e = Calendar.getInstance();
+ e.clear();
+ e.setTime(expected);
+
+ Assert.assertEquals(message + "[MILLIS]", e.get(Calendar.MILLISECOND), v.get(Calendar.MILLISECOND));
+ Assert.assertEquals(message + "[SEC]", e.get(Calendar.SECOND), v.get(Calendar.SECOND));
+ Assert.assertEquals(message + "[MIN]", e.get(Calendar.MINUTE), v.get(Calendar.MINUTE));
+ Assert.assertEquals(message + "[HOURS]", e.get(Calendar.HOUR_OF_DAY), v.get(Calendar.HOUR_OF_DAY));
+
+ Assert.assertEquals(message + "[DAY]", e.get(Calendar.DAY_OF_MONTH), v.get(Calendar.DAY_OF_MONTH));
+ Assert.assertEquals(message + "[MONTH]", e.get(Calendar.MONTH), v.get(Calendar.MONTH));
+ Assert.assertEquals(message + "[YEAR]", e.get(Calendar.YEAR), v.get(Calendar.YEAR));
+
+ Assert.assertEquals(message + "(DATE)", expected, value);
+ }
+}
diff --git a/org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/FormattingUtilityTest.java b/org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/FormattingUtilityTest.java
index af075b9bc6..d657048b59 100644
--- a/org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/FormattingUtilityTest.java
+++ b/org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/FormattingUtilityTest.java
@@ -1,209 +1,209 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.util.Date;
-import java.util.Locale;
-
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * Tests for the {@link FormattingUtility}.
- */
-public class FormattingUtilityTest {
-
- private static Locale deChLocale;
- private static Locale deDeLocale;
- private static Locale enUsLocale;
-
- @BeforeClass
- public static void beforeClass() {
- deChLocale = new Locale("de", "CH");
- deDeLocale = new Locale("de", "DE");
- enUsLocale = new Locale("en", "US");
- }
-
- @Test
- public void testFormatNull() {
- assertFormat(deChLocale, "", null);
- }
-
- @Test
- public void testFormatBoolean() {
- assertFormat(deChLocale, "X", Boolean.TRUE);
- assertFormat(deChLocale, "", Boolean.FALSE);
- }
-
- @Test
- public void testFormatDate() {
- Date date = DateUtility.parse("20.03.2012", "dd.MM.yyyy");
- assertFormat(deChLocale, "20.03.2012", date);
- assertFormat(enUsLocale, "Mar 20, 2012", date);
- }
-
- @Test
- public void testFormatDateTime() {
- Date dateTime = DateUtility.parse("20.03.2012 14:06:56", "dd.MM.yyyy hh:mm:ss");
- assertFormat(deChLocale, "20.03.12 14:06", dateTime);
- assertFormat(enUsLocale, "3/20/12 2:06 PM", dateTime);
- }
-
- @Test
- public void testFormatTime() {
- Date time = DateUtility.parse("14:06:56", "hh:mm:ss");
- assertFormat(deChLocale, "01.01.70 14:06", time);
- assertFormat(enUsLocale, "1/1/70 2:06 PM", time);
- }
-
- @Test
- public void testFormatInteger() {
- assertFormat(deChLocale, "100", Integer.valueOf(100));
- assertFormat(deChLocale, "1'000", Integer.valueOf(1000));
- assertFormat(deChLocale, "1'000'000", Integer.valueOf(1000000));
- assertFormat(deChLocale, "-1'000", Integer.valueOf(-1000));
-
- assertFormat(deDeLocale, "100", Integer.valueOf(100));
- assertFormat(deDeLocale, "1.000", Integer.valueOf(1000));
- assertFormat(deDeLocale, "1.000.000", Integer.valueOf(1000000));
- assertFormat(deDeLocale, "-1.000", Integer.valueOf(-1000));
-
- assertFormat(deChLocale, "100", Integer.valueOf(100));
- assertFormat(deChLocale, "1'000", Integer.valueOf(1000));
- assertFormat(deChLocale, "1'000'000", Integer.valueOf(1000000));
- assertFormat(deChLocale, "-1'000", Integer.valueOf(-1000));
- }
-
- @Test
- public void testFormatLong() {
- assertFormat(deChLocale, "100", Long.valueOf(100));
- assertFormat(deChLocale, "1'000", Long.valueOf(1000));
- assertFormat(deChLocale, "1'000'000", Long.valueOf(1000000));
- assertFormat(deChLocale, "-1'000", Long.valueOf(-1000));
-
- assertFormat(deDeLocale, "100", Long.valueOf(100));
- assertFormat(deDeLocale, "1.000", Long.valueOf(1000));
- assertFormat(deDeLocale, "1.000.000", Long.valueOf(1000000));
- assertFormat(deDeLocale, "-1.000", Long.valueOf(-1000));
-
- assertFormat(enUsLocale, "100", Long.valueOf(100));
- assertFormat(enUsLocale, "1,000", Long.valueOf(1000));
- assertFormat(enUsLocale, "1,000,000", Long.valueOf(1000000));
- assertFormat(enUsLocale, "-1,000", Long.valueOf(-1000));
- }
-
- @Test
- public void testFormatBigInteger() {
- assertFormat(deChLocale, "100", BigInteger.valueOf(100));
- assertFormat(deChLocale, "1'000", BigInteger.valueOf(1000));
- assertFormat(deChLocale, "1'000'000", BigInteger.valueOf(1000000));
- assertFormat(deChLocale, "-1'000", BigInteger.valueOf(-1000));
-
- assertFormat(deDeLocale, "100", BigInteger.valueOf(100));
- assertFormat(deDeLocale, "1.000", BigInteger.valueOf(1000));
- assertFormat(deDeLocale, "1.000.000", BigInteger.valueOf(1000000));
- assertFormat(deDeLocale, "-1.000", BigInteger.valueOf(-1000));
-
- assertFormat(enUsLocale, "100", BigInteger.valueOf(100));
- assertFormat(enUsLocale, "1,000", BigInteger.valueOf(1000));
- assertFormat(enUsLocale, "1,000,000", BigInteger.valueOf(1000000));
- assertFormat(enUsLocale, "-1,000", BigInteger.valueOf(-1000));
- }
-
- @Test
- public void testFormatFloat() {
- assertFormat(deChLocale, "0.00", Float.valueOf(0f));
- assertFormat(deChLocale, "0.25", Float.valueOf(0.25f));
- assertFormat(deChLocale, "0.25", Float.valueOf(0.24879f));
- assertFormat(deChLocale, "1'000.00", Float.valueOf(1000f));
- assertFormat(deChLocale, "-1'000.46", Float.valueOf(-1000.456789f));
-
- assertFormat(deDeLocale, "0,00", Float.valueOf(0f));
- assertFormat(deDeLocale, "0,25", Float.valueOf(0.25f));
- assertFormat(deDeLocale, "0,25", Float.valueOf(0.24879f));
- assertFormat(deDeLocale, "1.000,00", Float.valueOf(1000f));
- assertFormat(deDeLocale, "-1.000,46", Float.valueOf(-1000.456789f));
-
- assertFormat(enUsLocale, "0.00", Float.valueOf(0f));
- assertFormat(enUsLocale, "0.25", Float.valueOf(0.25f));
- assertFormat(enUsLocale, "0.25", Float.valueOf(0.24879f));
- assertFormat(enUsLocale, "1,000.00", Float.valueOf(1000f));
- assertFormat(enUsLocale, "-1,000.46", Float.valueOf(-1000.456789f));
- }
-
- @Test
- public void testFormatDouble() {
- assertFormat(deChLocale, "0.00", Double.valueOf(0));
- assertFormat(deChLocale, "0.25", Double.valueOf(0.25));
- assertFormat(deChLocale, "0.25", Double.valueOf(0.24879));
- assertFormat(deChLocale, "1'000.00", Double.valueOf(1000));
- assertFormat(deChLocale, "-1'000.46", Double.valueOf(-1000.456789));
-
- assertFormat(deDeLocale, "0,00", Double.valueOf(0));
- assertFormat(deDeLocale, "0,25", Double.valueOf(0.25));
- assertFormat(deDeLocale, "0,25", Double.valueOf(0.24879));
- assertFormat(deDeLocale, "1.000,00", Double.valueOf(1000));
- assertFormat(deDeLocale, "-1.000,46", Double.valueOf(-1000.456789));
-
- assertFormat(enUsLocale, "0.00", Double.valueOf(0));
- assertFormat(enUsLocale, "0.25", Double.valueOf(0.25));
- assertFormat(enUsLocale, "0.25", Double.valueOf(0.24879));
- assertFormat(enUsLocale, "1,000.00", Double.valueOf(1000));
- assertFormat(enUsLocale, "-1,000.46", Double.valueOf(-1000.456789));
- }
-
- @Test
- public void testFormatBigDecimal() {
- assertFormat(deChLocale, "0.00", BigDecimal.valueOf(0));
- assertFormat(deChLocale, "0.25", BigDecimal.valueOf(0.25));
- assertFormat(deChLocale, "0.25", BigDecimal.valueOf(0.24879));
- assertFormat(deChLocale, "1'000.00", BigDecimal.valueOf(1000));
- assertFormat(deChLocale, "-1'000.46", BigDecimal.valueOf(-1000.456789));
-
- assertFormat(deDeLocale, "0,00", BigDecimal.valueOf(0));
- assertFormat(deDeLocale, "0,25", BigDecimal.valueOf(0.25));
- assertFormat(deDeLocale, "0,25", BigDecimal.valueOf(0.24879));
- assertFormat(deDeLocale, "1.000,00", BigDecimal.valueOf(1000));
- assertFormat(deDeLocale, "-1.000,46", BigDecimal.valueOf(-1000.456789));
-
- assertFormat(enUsLocale, "0.00", BigDecimal.valueOf(0));
- assertFormat(enUsLocale, "0.25", BigDecimal.valueOf(0.25));
- assertFormat(enUsLocale, "0.25", BigDecimal.valueOf(0.24879));
- assertFormat(enUsLocale, "1,000.00", BigDecimal.valueOf(1000));
- assertFormat(enUsLocale, "-1,000.46", BigDecimal.valueOf(-1000.456789));
- }
-
- @Test
- public void testFormatString() {
- assertFormat(deChLocale, "\ttest 123 ", "\ttest 123 ");
- assertFormat(deDeLocale, "\ttest 123 ", "\ttest 123 ");
- assertFormat(enUsLocale, "\ttest 123 ", "\ttest 123 ");
- }
-
- private static void assertFormat(Locale locale, String expected, Object o) {
- Locale oldLocale = LocaleThreadLocal.get();
- try {
- if (locale == null) {
- fail("locale must not be null");
- }
- LocaleThreadLocal.set(locale);
- assertEquals(expected, FormattingUtility.formatObject(o));
- }
- finally {
- LocaleThreadLocal.set(oldLocale);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.Date;
+import java.util.Locale;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Tests for the {@link FormattingUtility}.
+ */
+public class FormattingUtilityTest {
+
+ private static Locale deChLocale;
+ private static Locale deDeLocale;
+ private static Locale enUsLocale;
+
+ @BeforeClass
+ public static void beforeClass() {
+ deChLocale = new Locale("de", "CH");
+ deDeLocale = new Locale("de", "DE");
+ enUsLocale = new Locale("en", "US");
+ }
+
+ @Test
+ public void testFormatNull() {
+ assertFormat(deChLocale, "", null);
+ }
+
+ @Test
+ public void testFormatBoolean() {
+ assertFormat(deChLocale, "X", Boolean.TRUE);
+ assertFormat(deChLocale, "", Boolean.FALSE);
+ }
+
+ @Test
+ public void testFormatDate() {
+ Date date = DateUtility.parse("20.03.2012", "dd.MM.yyyy");
+ assertFormat(deChLocale, "20.03.2012", date);
+ assertFormat(enUsLocale, "Mar 20, 2012", date);
+ }
+
+ @Test
+ public void testFormatDateTime() {
+ Date dateTime = DateUtility.parse("20.03.2012 14:06:56", "dd.MM.yyyy hh:mm:ss");
+ assertFormat(deChLocale, "20.03.12 14:06", dateTime);
+ assertFormat(enUsLocale, "3/20/12 2:06 PM", dateTime);
+ }
+
+ @Test
+ public void testFormatTime() {
+ Date time = DateUtility.parse("14:06:56", "hh:mm:ss");
+ assertFormat(deChLocale, "01.01.70 14:06", time);
+ assertFormat(enUsLocale, "1/1/70 2:06 PM", time);
+ }
+
+ @Test
+ public void testFormatInteger() {
+ assertFormat(deChLocale, "100", Integer.valueOf(100));
+ assertFormat(deChLocale, "1'000", Integer.valueOf(1000));
+ assertFormat(deChLocale, "1'000'000", Integer.valueOf(1000000));
+ assertFormat(deChLocale, "-1'000", Integer.valueOf(-1000));
+
+ assertFormat(deDeLocale, "100", Integer.valueOf(100));
+ assertFormat(deDeLocale, "1.000", Integer.valueOf(1000));
+ assertFormat(deDeLocale, "1.000.000", Integer.valueOf(1000000));
+ assertFormat(deDeLocale, "-1.000", Integer.valueOf(-1000));
+
+ assertFormat(deChLocale, "100", Integer.valueOf(100));
+ assertFormat(deChLocale, "1'000", Integer.valueOf(1000));
+ assertFormat(deChLocale, "1'000'000", Integer.valueOf(1000000));
+ assertFormat(deChLocale, "-1'000", Integer.valueOf(-1000));
+ }
+
+ @Test
+ public void testFormatLong() {
+ assertFormat(deChLocale, "100", Long.valueOf(100));
+ assertFormat(deChLocale, "1'000", Long.valueOf(1000));
+ assertFormat(deChLocale, "1'000'000", Long.valueOf(1000000));
+ assertFormat(deChLocale, "-1'000", Long.valueOf(-1000));
+
+ assertFormat(deDeLocale, "100", Long.valueOf(100));
+ assertFormat(deDeLocale, "1.000", Long.valueOf(1000));
+ assertFormat(deDeLocale, "1.000.000", Long.valueOf(1000000));
+ assertFormat(deDeLocale, "-1.000", Long.valueOf(-1000));
+
+ assertFormat(enUsLocale, "100", Long.valueOf(100));
+ assertFormat(enUsLocale, "1,000", Long.valueOf(1000));
+ assertFormat(enUsLocale, "1,000,000", Long.valueOf(1000000));
+ assertFormat(enUsLocale, "-1,000", Long.valueOf(-1000));
+ }
+
+ @Test
+ public void testFormatBigInteger() {
+ assertFormat(deChLocale, "100", BigInteger.valueOf(100));
+ assertFormat(deChLocale, "1'000", BigInteger.valueOf(1000));
+ assertFormat(deChLocale, "1'000'000", BigInteger.valueOf(1000000));
+ assertFormat(deChLocale, "-1'000", BigInteger.valueOf(-1000));
+
+ assertFormat(deDeLocale, "100", BigInteger.valueOf(100));
+ assertFormat(deDeLocale, "1.000", BigInteger.valueOf(1000));
+ assertFormat(deDeLocale, "1.000.000", BigInteger.valueOf(1000000));
+ assertFormat(deDeLocale, "-1.000", BigInteger.valueOf(-1000));
+
+ assertFormat(enUsLocale, "100", BigInteger.valueOf(100));
+ assertFormat(enUsLocale, "1,000", BigInteger.valueOf(1000));
+ assertFormat(enUsLocale, "1,000,000", BigInteger.valueOf(1000000));
+ assertFormat(enUsLocale, "-1,000", BigInteger.valueOf(-1000));
+ }
+
+ @Test
+ public void testFormatFloat() {
+ assertFormat(deChLocale, "0.00", Float.valueOf(0f));
+ assertFormat(deChLocale, "0.25", Float.valueOf(0.25f));
+ assertFormat(deChLocale, "0.25", Float.valueOf(0.24879f));
+ assertFormat(deChLocale, "1'000.00", Float.valueOf(1000f));
+ assertFormat(deChLocale, "-1'000.46", Float.valueOf(-1000.456789f));
+
+ assertFormat(deDeLocale, "0,00", Float.valueOf(0f));
+ assertFormat(deDeLocale, "0,25", Float.valueOf(0.25f));
+ assertFormat(deDeLocale, "0,25", Float.valueOf(0.24879f));
+ assertFormat(deDeLocale, "1.000,00", Float.valueOf(1000f));
+ assertFormat(deDeLocale, "-1.000,46", Float.valueOf(-1000.456789f));
+
+ assertFormat(enUsLocale, "0.00", Float.valueOf(0f));
+ assertFormat(enUsLocale, "0.25", Float.valueOf(0.25f));
+ assertFormat(enUsLocale, "0.25", Float.valueOf(0.24879f));
+ assertFormat(enUsLocale, "1,000.00", Float.valueOf(1000f));
+ assertFormat(enUsLocale, "-1,000.46", Float.valueOf(-1000.456789f));
+ }
+
+ @Test
+ public void testFormatDouble() {
+ assertFormat(deChLocale, "0.00", Double.valueOf(0));
+ assertFormat(deChLocale, "0.25", Double.valueOf(0.25));
+ assertFormat(deChLocale, "0.25", Double.valueOf(0.24879));
+ assertFormat(deChLocale, "1'000.00", Double.valueOf(1000));
+ assertFormat(deChLocale, "-1'000.46", Double.valueOf(-1000.456789));
+
+ assertFormat(deDeLocale, "0,00", Double.valueOf(0));
+ assertFormat(deDeLocale, "0,25", Double.valueOf(0.25));
+ assertFormat(deDeLocale, "0,25", Double.valueOf(0.24879));
+ assertFormat(deDeLocale, "1.000,00", Double.valueOf(1000));
+ assertFormat(deDeLocale, "-1.000,46", Double.valueOf(-1000.456789));
+
+ assertFormat(enUsLocale, "0.00", Double.valueOf(0));
+ assertFormat(enUsLocale, "0.25", Double.valueOf(0.25));
+ assertFormat(enUsLocale, "0.25", Double.valueOf(0.24879));
+ assertFormat(enUsLocale, "1,000.00", Double.valueOf(1000));
+ assertFormat(enUsLocale, "-1,000.46", Double.valueOf(-1000.456789));
+ }
+
+ @Test
+ public void testFormatBigDecimal() {
+ assertFormat(deChLocale, "0.00", BigDecimal.valueOf(0));
+ assertFormat(deChLocale, "0.25", BigDecimal.valueOf(0.25));
+ assertFormat(deChLocale, "0.25", BigDecimal.valueOf(0.24879));
+ assertFormat(deChLocale, "1'000.00", BigDecimal.valueOf(1000));
+ assertFormat(deChLocale, "-1'000.46", BigDecimal.valueOf(-1000.456789));
+
+ assertFormat(deDeLocale, "0,00", BigDecimal.valueOf(0));
+ assertFormat(deDeLocale, "0,25", BigDecimal.valueOf(0.25));
+ assertFormat(deDeLocale, "0,25", BigDecimal.valueOf(0.24879));
+ assertFormat(deDeLocale, "1.000,00", BigDecimal.valueOf(1000));
+ assertFormat(deDeLocale, "-1.000,46", BigDecimal.valueOf(-1000.456789));
+
+ assertFormat(enUsLocale, "0.00", BigDecimal.valueOf(0));
+ assertFormat(enUsLocale, "0.25", BigDecimal.valueOf(0.25));
+ assertFormat(enUsLocale, "0.25", BigDecimal.valueOf(0.24879));
+ assertFormat(enUsLocale, "1,000.00", BigDecimal.valueOf(1000));
+ assertFormat(enUsLocale, "-1,000.46", BigDecimal.valueOf(-1000.456789));
+ }
+
+ @Test
+ public void testFormatString() {
+ assertFormat(deChLocale, "\ttest 123 ", "\ttest 123 ");
+ assertFormat(deDeLocale, "\ttest 123 ", "\ttest 123 ");
+ assertFormat(enUsLocale, "\ttest 123 ", "\ttest 123 ");
+ }
+
+ private static void assertFormat(Locale locale, String expected, Object o) {
+ Locale oldLocale = LocaleThreadLocal.get();
+ try {
+ if (locale == null) {
+ fail("locale must not be null");
+ }
+ LocaleThreadLocal.set(locale);
+ assertEquals(expected, FormattingUtility.formatObject(o));
+ }
+ finally {
+ LocaleThreadLocal.set(oldLocale);
+ }
+ }
+}
diff --git a/org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/ListUtilityTest.java b/org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/ListUtilityTest.java
index 4661bb0fa4..8886a48783 100644
--- a/org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/ListUtilityTest.java
+++ b/org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/ListUtilityTest.java
@@ -1,35 +1,35 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-/**
- * tests the {@link ListUtility}
- */
-public class ListUtilityTest extends Assert {
-
- @Test
- public void testLength() throws Exception {
- assertEquals(-1, ListUtility.length(null));
- assertEquals(3, ListUtility.length(new int[3]));
- assertEquals(3, ListUtility.length(new int[3][4]));
- assertEquals(3, ListUtility.length(new String[3]));
- assertEquals(3, ListUtility.length(new String[3][4]));
- assertEquals(3, ListUtility.length(new ArrayList<String>(Arrays.asList(new String[]{"a", "b", "c"}))));
- assertEquals(0, ListUtility.length(new HashMap<String, String>()));
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * tests the {@link ListUtility}
+ */
+public class ListUtilityTest extends Assert {
+
+ @Test
+ public void testLength() throws Exception {
+ assertEquals(-1, ListUtility.length(null));
+ assertEquals(3, ListUtility.length(new int[3]));
+ assertEquals(3, ListUtility.length(new int[3][4]));
+ assertEquals(3, ListUtility.length(new String[3]));
+ assertEquals(3, ListUtility.length(new String[3][4]));
+ assertEquals(3, ListUtility.length(new ArrayList<String>(Arrays.asList(new String[]{"a", "b", "c"}))));
+ assertEquals(0, ListUtility.length(new HashMap<String, String>()));
+ }
+}
diff --git a/org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/MailUtilityTest.java b/org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/MailUtilityTest.java
index 7a39138f1b..a5331c88c2 100644
--- a/org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/MailUtilityTest.java
+++ b/org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/MailUtilityTest.java
@@ -1,41 +1,41 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import javax.mail.MessagingException;
-import javax.mail.internet.MimeMessage;
-
-import junit.framework.Assert;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.junit.Test;
-
-/**
- *
- */
-public class MailUtilityTest {
-
- /**
- * ticket 91844
- * <p>
- * Message without sender can be created
- *
- * @throws ProcessingException
- * ,MessagingException
- */
- @Test
- public void testMimeMessageWithoutSender() throws ProcessingException, MessagingException {
- MimeMessage message = MailUtility.createMimeMessage("Body", null, null);
- Assert.assertNotNull(message);
- message = MailUtility.createMimeMessage(null, null, "Subject", "Body", null);
- Assert.assertNotNull(message);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import javax.mail.MessagingException;
+import javax.mail.internet.MimeMessage;
+
+import junit.framework.Assert;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.junit.Test;
+
+/**
+ *
+ */
+public class MailUtilityTest {
+
+ /**
+ * ticket 91844
+ * <p>
+ * Message without sender can be created
+ *
+ * @throws ProcessingException
+ * ,MessagingException
+ */
+ @Test
+ public void testMimeMessageWithoutSender() throws ProcessingException, MessagingException {
+ MimeMessage message = MailUtility.createMimeMessage("Body", null, null);
+ Assert.assertNotNull(message);
+ message = MailUtility.createMimeMessage(null, null, "Subject", "Body", null);
+ Assert.assertNotNull(message);
+ }
+}
diff --git a/org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/MatrixUtilityTest.java b/org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/MatrixUtilityTest.java
index 8ea87df4b4..abc695ced3 100644
--- a/org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/MatrixUtilityTest.java
+++ b/org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/MatrixUtilityTest.java
@@ -1,127 +1,127 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import java.util.Locale;
-
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-public class MatrixUtilityTest {
-
- private static final Object[] E1 = new Object[]{1L, "a", 30L, null};
- private static final Object[] E2 = new Object[]{2L, "b", 29L, "a"};
- private static final Object[] E3 = new Object[]{3L, "ö", 10L, "z"};
- private static final Object[] E4 = new Object[]{4L, "c", 10L, "ñ"};
- private static final Object[] E5 = new Object[]{5L, "ä", 10L, "ë"};
-
- private Object[][] m_array;
-
- @Before
- public void setUp() {
- m_array = new Object[][]{E1, E2, E3, E4, E5};
- }
-
- /**
- * ticket 87801
- */
- @Test
- public void testSort() {
- Object[][] data = new Object[][]{
- {"Aac"},
- {"ab"},
- {"äab"},
- {"Äaa"}};
- MatrixUtility.sort(Locale.GERMAN, data, 0);
- Assert.assertEquals("Äaa", data[0][0]);
- Assert.assertEquals("äab", data[1][0]);
- Assert.assertEquals("Aac", data[2][0]);
- Assert.assertEquals("ab", data[3][0]);
- }
-
- @Test
- public void testSortNullMatrix() {
- MatrixUtility.sort(null, 0);
- }
-
- @Test
- public void testSortEmptyMatrix() {
- MatrixUtility.sort(new Object[0][], 0);
- }
-
- @Test(expected = ArrayIndexOutOfBoundsException.class)
- public void testSortLowerBounds() {
- MatrixUtility.sort(m_array, -1);
- }
-
- @Test
- public void testSortUpperBounds() {
- MatrixUtility.sort(m_array, m_array.length);
- }
-
- @Test
- public void testSortUsingDeChLocale() {
- MatrixUtility.sort(new Locale("de", "CH"), m_array, 1);
- Assert.assertArrayEquals(new Object[][]{E1, E5, E2, E4, E3}, m_array);
- }
-
- @Test
- public void testSortUsingEnUsLocale() {
- MatrixUtility.sort(new Locale("en", "US"), m_array, 1);
- Assert.assertArrayEquals(new Object[][]{E1, E5, E2, E4, E3}, m_array);
- }
-
- @Test
- public void testSortTwoSortColumns() {
- MatrixUtility.sort(new Locale("de", "CH"), m_array, 2, 1);
- Assert.assertArrayEquals(new Object[][]{E5, E4, E3, E2, E1}, m_array);
- }
-
- @Test
- public void testSortNullSortValues() {
- MatrixUtility.sort(m_array, 3);
- Assert.assertArrayEquals(new Object[][]{E1, E2, E5, E4, E3}, m_array);
- }
-
- @Test
- public void testSortSwedish() {
- String[][] data = {
- {"Aa"},
- {"Æ"},
- {"B"},
- {"Ö"},
- {"Ø"},
- {"Z"},
- {"Ã…"},
- {"Ä"},
- {"Ae"},
- {"A"},
- {"Ü"}};
-
- MatrixUtility.sort(new Locale("sv", "SE"), data, 0);
-
- String[][] expected = {
- {"A"},
- {"Aa"},
- {"Ae"},
- {"B"},
- {"Ü"},
- {"Z"},
- {"Ã…"},
- {"Ä"},
- {"Æ"},
- {"Ö"},
- {"Ø"}};
-
- Assert.assertArrayEquals(expected, data);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import java.util.Locale;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class MatrixUtilityTest {
+
+ private static final Object[] E1 = new Object[]{1L, "a", 30L, null};
+ private static final Object[] E2 = new Object[]{2L, "b", 29L, "a"};
+ private static final Object[] E3 = new Object[]{3L, "ö", 10L, "z"};
+ private static final Object[] E4 = new Object[]{4L, "c", 10L, "ñ"};
+ private static final Object[] E5 = new Object[]{5L, "ä", 10L, "ë"};
+
+ private Object[][] m_array;
+
+ @Before
+ public void setUp() {
+ m_array = new Object[][]{E1, E2, E3, E4, E5};
+ }
+
+ /**
+ * ticket 87801
+ */
+ @Test
+ public void testSort() {
+ Object[][] data = new Object[][]{
+ {"Aac"},
+ {"ab"},
+ {"äab"},
+ {"Äaa"}};
+ MatrixUtility.sort(Locale.GERMAN, data, 0);
+ Assert.assertEquals("Äaa", data[0][0]);
+ Assert.assertEquals("äab", data[1][0]);
+ Assert.assertEquals("Aac", data[2][0]);
+ Assert.assertEquals("ab", data[3][0]);
+ }
+
+ @Test
+ public void testSortNullMatrix() {
+ MatrixUtility.sort(null, 0);
+ }
+
+ @Test
+ public void testSortEmptyMatrix() {
+ MatrixUtility.sort(new Object[0][], 0);
+ }
+
+ @Test(expected = ArrayIndexOutOfBoundsException.class)
+ public void testSortLowerBounds() {
+ MatrixUtility.sort(m_array, -1);
+ }
+
+ @Test
+ public void testSortUpperBounds() {
+ MatrixUtility.sort(m_array, m_array.length);
+ }
+
+ @Test
+ public void testSortUsingDeChLocale() {
+ MatrixUtility.sort(new Locale("de", "CH"), m_array, 1);
+ Assert.assertArrayEquals(new Object[][]{E1, E5, E2, E4, E3}, m_array);
+ }
+
+ @Test
+ public void testSortUsingEnUsLocale() {
+ MatrixUtility.sort(new Locale("en", "US"), m_array, 1);
+ Assert.assertArrayEquals(new Object[][]{E1, E5, E2, E4, E3}, m_array);
+ }
+
+ @Test
+ public void testSortTwoSortColumns() {
+ MatrixUtility.sort(new Locale("de", "CH"), m_array, 2, 1);
+ Assert.assertArrayEquals(new Object[][]{E5, E4, E3, E2, E1}, m_array);
+ }
+
+ @Test
+ public void testSortNullSortValues() {
+ MatrixUtility.sort(m_array, 3);
+ Assert.assertArrayEquals(new Object[][]{E1, E2, E5, E4, E3}, m_array);
+ }
+
+ @Test
+ public void testSortSwedish() {
+ String[][] data = {
+ {"Aa"},
+ {"Æ"},
+ {"B"},
+ {"Ö"},
+ {"Ø"},
+ {"Z"},
+ {"Ã…"},
+ {"Ä"},
+ {"Ae"},
+ {"A"},
+ {"Ü"}};
+
+ MatrixUtility.sort(new Locale("sv", "SE"), data, 0);
+
+ String[][] expected = {
+ {"A"},
+ {"Aa"},
+ {"Ae"},
+ {"B"},
+ {"Ü"},
+ {"Z"},
+ {"Ã…"},
+ {"Ä"},
+ {"Æ"},
+ {"Ö"},
+ {"Ø"}};
+
+ Assert.assertArrayEquals(expected, data);
+ }
+}
diff --git a/org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/StringUtilityTest.java b/org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/StringUtilityTest.java
index 0892435473..6587dbd76b 100644
--- a/org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/StringUtilityTest.java
+++ b/org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/StringUtilityTest.java
@@ -1,165 +1,165 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import java.math.BigDecimal;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-/**
- *
- */
-public class StringUtilityTest extends Assert {
-
- @Test
- public void testImplodeDelimiters() {
- String a = "a";
- String b = "b";
- String c = "cccccc";
- String del1 = ";";
- String del2 = ",";
- String del3 = "";
- String delnil = null;
- String res1 = StringUtility.join(del1, a, b, c);
- assertEquals(a + del1 + b + del1 + c, res1);
- String res2 = StringUtility.join(del2, a, b, c);
- assertEquals(a + del2 + b + del2 + c, res2);
- String res3 = StringUtility.join(del3, a, b, c);
- assertEquals(a + b + c, res3);
- String res4 = StringUtility.join(delnil, a, b, c);
- assertEquals(a + b + c, res4);
- }
-
- @Test
- public void testImplodeNullInput() {
- String a = "a";
- String b = "b";
- String c = "cccccc";
- String del1 = ";";
- String res1 = StringUtility.join(del1);
- assertEquals("", res1);
- String res2 = StringUtility.join(del1, (String) null);
- assertEquals("", res2);
- String res3 = StringUtility.join(del1, a, (String) null, c);
- assertEquals(a + del1 + c, res3);
- String res4 = StringUtility.join(del1, (String) null, b, c);
- assertEquals(b + del1 + c, res4);
- }
-
- @Test
- public void testImplodeLong() {
- Long[] longs1 = new Long[]{15L, 4L};
- Long[] longs2 = new Long[]{};
- Long[] longs3 = new Long[]{34L, 340283503853L, null, -3431L};
- Long[] longs4 = new Long[]{null};
- String del1 = "'";
- String res1 = StringUtility.join(del1, longs1);
- assertEquals("15'4", res1);
- String res2 = StringUtility.join(del1, longs2);
- assertEquals("", res2);
- String res3 = StringUtility.join(del1, longs3);
- assertEquals("34'340283503853'-3431", res3);
- String res4 = StringUtility.join(del1, longs4);
- assertEquals("", res4);
- }
-
- @Test
- public void testJoinVararg() {
- assertEquals("", StringUtility.join(null));
- assertEquals("ab", StringUtility.join(null, "a", "b"));
- assertEquals("ab", StringUtility.join(null, "a", null, "b"));
- assertEquals("", StringUtility.join(null, (Object[]) null));
- assertEquals("1, true", StringUtility.join(", ", BigDecimal.ONE, Boolean.TRUE));
- }
-
- @Test
- public void testJoinStringArray() {
- assertEquals("", StringUtility.join(null, (String[]) null));
- assertEquals("ab", StringUtility.join(null, new String[]{"a", "b"}));
- assertEquals("a, b", StringUtility.join(", ", new String[]{"a", "b"}));
- assertEquals("a, b", StringUtility.join(", ", new String[]{"a", null, "b"}));
- }
-
- @Test
- public void testJoinLongArray() {
- assertEquals("", StringUtility.join(null, (Long[]) null));
- assertEquals("12", StringUtility.join(null, new Long[]{Long.valueOf(1), Long.valueOf(2)}));
- assertEquals("1, 2", StringUtility.join(", ", new Long[]{Long.valueOf(1), Long.valueOf(2)}));
- assertEquals("1, 2", StringUtility.join(", ", new Long[]{Long.valueOf(1), null, Long.valueOf(2)}));
- }
-
- /**
- * ticket 88592
- */
- @Test
- public void testMnemonics() {
- String s = "Button &Test";
- Assert.assertEquals('T', StringUtility.getMnemonic(s));
- Assert.assertEquals("Button Test", StringUtility.removeMnemonic(s));
- s = "Button & Test";
- Assert.assertEquals(0x00, StringUtility.getMnemonic(s));
- Assert.assertEquals(s, StringUtility.removeMnemonic(s));
- s = "&test";
- Assert.assertEquals('t', StringUtility.getMnemonic(s));
- Assert.assertEquals("test", StringUtility.removeMnemonic(s));
- s = "test &";
- Assert.assertEquals(0x00, StringUtility.getMnemonic(s));
- Assert.assertEquals(s, StringUtility.removeMnemonic(s));
- }
-
- /**
- * ticket 90988
- */
- @Test
- public void testDecompress_umlauts() throws Exception {
- // UTF-8 length is 13 to avoid accidental buffer size matches
- final String CHARACTERS = "aou�����";
-
- StringBuilder builder = new StringBuilder();
- for (int i = 0; i < 100000; i++) {
- builder.append(CHARACTERS);
- }
-
- String original = builder.toString();
- String decompressed = StringUtility.decompress(StringUtility.compress(original));
-
- Assert.assertEquals(original, decompressed);
- }
-
- @Test
- public void testTags() throws Exception {
- String s;
- s = "foo <a>text</a> bar";
- Assert.assertEquals("foo bar", StringUtility.removeTag(s, "a"));
- s = "foo <a>text</a> <a>text</a> bar";
- Assert.assertEquals("foo bar", StringUtility.removeTag(s, "a"));
- s = "foo <a>text</a> <a>bar";
- Assert.assertEquals("foo <a>bar", StringUtility.removeTag(s, "a"));
- s = "foo <a>text</a> </a>bar";
- Assert.assertEquals("foo </a>bar", StringUtility.removeTag(s, "a"));
- s = "foo <a/> bar";
- Assert.assertEquals("foo bar", StringUtility.removeTag(s, "a"));
- }
-
- @Test
- public void testRegExPattern() throws Exception {
- String s;
- s = "test*";
- Assert.assertEquals("test.*", StringUtility.toRegExPattern(s));
-
- s = "test?";
- Assert.assertEquals("test.", StringUtility.toRegExPattern(s));
-
- s = "com.test.*";
- Assert.assertEquals("com\\.test\\..*", StringUtility.toRegExPattern(s));
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import java.math.BigDecimal;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ *
+ */
+public class StringUtilityTest extends Assert {
+
+ @Test
+ public void testImplodeDelimiters() {
+ String a = "a";
+ String b = "b";
+ String c = "cccccc";
+ String del1 = ";";
+ String del2 = ",";
+ String del3 = "";
+ String delnil = null;
+ String res1 = StringUtility.join(del1, a, b, c);
+ assertEquals(a + del1 + b + del1 + c, res1);
+ String res2 = StringUtility.join(del2, a, b, c);
+ assertEquals(a + del2 + b + del2 + c, res2);
+ String res3 = StringUtility.join(del3, a, b, c);
+ assertEquals(a + b + c, res3);
+ String res4 = StringUtility.join(delnil, a, b, c);
+ assertEquals(a + b + c, res4);
+ }
+
+ @Test
+ public void testImplodeNullInput() {
+ String a = "a";
+ String b = "b";
+ String c = "cccccc";
+ String del1 = ";";
+ String res1 = StringUtility.join(del1);
+ assertEquals("", res1);
+ String res2 = StringUtility.join(del1, (String) null);
+ assertEquals("", res2);
+ String res3 = StringUtility.join(del1, a, (String) null, c);
+ assertEquals(a + del1 + c, res3);
+ String res4 = StringUtility.join(del1, (String) null, b, c);
+ assertEquals(b + del1 + c, res4);
+ }
+
+ @Test
+ public void testImplodeLong() {
+ Long[] longs1 = new Long[]{15L, 4L};
+ Long[] longs2 = new Long[]{};
+ Long[] longs3 = new Long[]{34L, 340283503853L, null, -3431L};
+ Long[] longs4 = new Long[]{null};
+ String del1 = "'";
+ String res1 = StringUtility.join(del1, longs1);
+ assertEquals("15'4", res1);
+ String res2 = StringUtility.join(del1, longs2);
+ assertEquals("", res2);
+ String res3 = StringUtility.join(del1, longs3);
+ assertEquals("34'340283503853'-3431", res3);
+ String res4 = StringUtility.join(del1, longs4);
+ assertEquals("", res4);
+ }
+
+ @Test
+ public void testJoinVararg() {
+ assertEquals("", StringUtility.join(null));
+ assertEquals("ab", StringUtility.join(null, "a", "b"));
+ assertEquals("ab", StringUtility.join(null, "a", null, "b"));
+ assertEquals("", StringUtility.join(null, (Object[]) null));
+ assertEquals("1, true", StringUtility.join(", ", BigDecimal.ONE, Boolean.TRUE));
+ }
+
+ @Test
+ public void testJoinStringArray() {
+ assertEquals("", StringUtility.join(null, (String[]) null));
+ assertEquals("ab", StringUtility.join(null, new String[]{"a", "b"}));
+ assertEquals("a, b", StringUtility.join(", ", new String[]{"a", "b"}));
+ assertEquals("a, b", StringUtility.join(", ", new String[]{"a", null, "b"}));
+ }
+
+ @Test
+ public void testJoinLongArray() {
+ assertEquals("", StringUtility.join(null, (Long[]) null));
+ assertEquals("12", StringUtility.join(null, new Long[]{Long.valueOf(1), Long.valueOf(2)}));
+ assertEquals("1, 2", StringUtility.join(", ", new Long[]{Long.valueOf(1), Long.valueOf(2)}));
+ assertEquals("1, 2", StringUtility.join(", ", new Long[]{Long.valueOf(1), null, Long.valueOf(2)}));
+ }
+
+ /**
+ * ticket 88592
+ */
+ @Test
+ public void testMnemonics() {
+ String s = "Button &Test";
+ Assert.assertEquals('T', StringUtility.getMnemonic(s));
+ Assert.assertEquals("Button Test", StringUtility.removeMnemonic(s));
+ s = "Button & Test";
+ Assert.assertEquals(0x00, StringUtility.getMnemonic(s));
+ Assert.assertEquals(s, StringUtility.removeMnemonic(s));
+ s = "&test";
+ Assert.assertEquals('t', StringUtility.getMnemonic(s));
+ Assert.assertEquals("test", StringUtility.removeMnemonic(s));
+ s = "test &";
+ Assert.assertEquals(0x00, StringUtility.getMnemonic(s));
+ Assert.assertEquals(s, StringUtility.removeMnemonic(s));
+ }
+
+ /**
+ * ticket 90988
+ */
+ @Test
+ public void testDecompress_umlauts() throws Exception {
+ // UTF-8 length is 13 to avoid accidental buffer size matches
+ final String CHARACTERS = "aou�����";
+
+ StringBuilder builder = new StringBuilder();
+ for (int i = 0; i < 100000; i++) {
+ builder.append(CHARACTERS);
+ }
+
+ String original = builder.toString();
+ String decompressed = StringUtility.decompress(StringUtility.compress(original));
+
+ Assert.assertEquals(original, decompressed);
+ }
+
+ @Test
+ public void testTags() throws Exception {
+ String s;
+ s = "foo <a>text</a> bar";
+ Assert.assertEquals("foo bar", StringUtility.removeTag(s, "a"));
+ s = "foo <a>text</a> <a>text</a> bar";
+ Assert.assertEquals("foo bar", StringUtility.removeTag(s, "a"));
+ s = "foo <a>text</a> <a>bar";
+ Assert.assertEquals("foo <a>bar", StringUtility.removeTag(s, "a"));
+ s = "foo <a>text</a> </a>bar";
+ Assert.assertEquals("foo </a>bar", StringUtility.removeTag(s, "a"));
+ s = "foo <a/> bar";
+ Assert.assertEquals("foo bar", StringUtility.removeTag(s, "a"));
+ }
+
+ @Test
+ public void testRegExPattern() throws Exception {
+ String s;
+ s = "test*";
+ Assert.assertEquals("test.*", StringUtility.toRegExPattern(s));
+
+ s = "test?";
+ Assert.assertEquals("test.", StringUtility.toRegExPattern(s));
+
+ s = "com.test.*";
+ Assert.assertEquals("com\\.test\\..*", StringUtility.toRegExPattern(s));
+ }
+}
diff --git a/org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/TypeCastUtilityTest.java b/org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/TypeCastUtilityTest.java
index 4fadc9a694..5c18cd3166 100644
--- a/org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/TypeCastUtilityTest.java
+++ b/org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/TypeCastUtilityTest.java
@@ -1,117 +1,117 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import junit.framework.Assert;
-
-import org.eclipse.scout.commons.holders.IHolder;
-import org.eclipse.scout.commons.holders.LongArrayHolder;
-import org.junit.Test;
-
-public class TypeCastUtilityTest extends Assert {
-
- @Test
- public void testGetGenericsParameterClass() {
- /*
- Logger.getLogger("").setLevel(Level.FINEST);
- for (Handler handler : Logger.getLogger("").getHandlers()) {
- handler.setLevel(Level.FINEST);
- }
- */
- Class<?> T;
- //
- T = TypeCastUtility.getGenericsParameterClass(LongArrayHolder.class, IHolder.class, 0);
- assertEquals(Long[].class, T);
- //
- try {
- TypeCastUtility.getGenericsParameterClass(X0.class, X0.class, 0);
- fail("no specific parametrized type defined, must fail");
- }
- catch (IllegalArgumentException t) {
- //nop
- }
- try {
- TypeCastUtility.getGenericsParameterClass(X1.class, X0.class, 0);
- fail("no specific parametrized type defined, must fail");
- }
- catch (IllegalArgumentException t) {
- //nop
- }
- T = TypeCastUtility.getGenericsParameterClass(X2.class, X0.class, 0);
- assertEquals(Data2.class, T);
- //
- T = TypeCastUtility.getGenericsParameterClass(Y3.class, Y0.class, 0);
- assertEquals(Data3.class, T);
- //
- T = TypeCastUtility.getGenericsParameterClass(Y3.class, Y0.class, 1);
- assertEquals(Flavor3.class, T);
- }
-
- static class Data0 {
-
- }
-
- static class Data1 extends Data0 {
-
- }
-
- static class Data2 extends Data1 {
-
- }
-
- static class Data3 extends Data2 {
-
- }
-
- static class Flavor0 {
-
- }
-
- static class Flavor1 extends Flavor0 {
-
- }
-
- static class Flavor2 extends Flavor1 {
-
- }
-
- static class Flavor3 extends Flavor2 {
-
- }
-
- static class X0<D0 extends Data0> {
-
- }
-
- static class X1<D1 extends Data1> extends X0<D1> {
-
- }
-
- static class X2 extends X0<Data2> {
-
- }
-
- static class Y0<D0 extends Data0, F0> {
-
- }
-
- static class Y1<F1 extends Flavor1, D1 extends Data1> extends Y0<D1, F1> {
-
- }
-
- static class Y2<F2 extends Flavor2, D2 extends Data2> extends Y1<F2, D2> {
-
- }
-
- static class Y3 extends Y2<Flavor3, Data3> {
-
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import junit.framework.Assert;
+
+import org.eclipse.scout.commons.holders.IHolder;
+import org.eclipse.scout.commons.holders.LongArrayHolder;
+import org.junit.Test;
+
+public class TypeCastUtilityTest extends Assert {
+
+ @Test
+ public void testGetGenericsParameterClass() {
+ /*
+ Logger.getLogger("").setLevel(Level.FINEST);
+ for (Handler handler : Logger.getLogger("").getHandlers()) {
+ handler.setLevel(Level.FINEST);
+ }
+ */
+ Class<?> T;
+ //
+ T = TypeCastUtility.getGenericsParameterClass(LongArrayHolder.class, IHolder.class, 0);
+ assertEquals(Long[].class, T);
+ //
+ try {
+ TypeCastUtility.getGenericsParameterClass(X0.class, X0.class, 0);
+ fail("no specific parametrized type defined, must fail");
+ }
+ catch (IllegalArgumentException t) {
+ //nop
+ }
+ try {
+ TypeCastUtility.getGenericsParameterClass(X1.class, X0.class, 0);
+ fail("no specific parametrized type defined, must fail");
+ }
+ catch (IllegalArgumentException t) {
+ //nop
+ }
+ T = TypeCastUtility.getGenericsParameterClass(X2.class, X0.class, 0);
+ assertEquals(Data2.class, T);
+ //
+ T = TypeCastUtility.getGenericsParameterClass(Y3.class, Y0.class, 0);
+ assertEquals(Data3.class, T);
+ //
+ T = TypeCastUtility.getGenericsParameterClass(Y3.class, Y0.class, 1);
+ assertEquals(Flavor3.class, T);
+ }
+
+ static class Data0 {
+
+ }
+
+ static class Data1 extends Data0 {
+
+ }
+
+ static class Data2 extends Data1 {
+
+ }
+
+ static class Data3 extends Data2 {
+
+ }
+
+ static class Flavor0 {
+
+ }
+
+ static class Flavor1 extends Flavor0 {
+
+ }
+
+ static class Flavor2 extends Flavor1 {
+
+ }
+
+ static class Flavor3 extends Flavor2 {
+
+ }
+
+ static class X0<D0 extends Data0> {
+
+ }
+
+ static class X1<D1 extends Data1> extends X0<D1> {
+
+ }
+
+ static class X2 extends X0<Data2> {
+
+ }
+
+ static class Y0<D0 extends Data0, F0> {
+
+ }
+
+ static class Y1<F1 extends Flavor1, D1 extends Data1> extends Y0<D1, F1> {
+
+ }
+
+ static class Y2<F2 extends Flavor2, D2 extends Data2> extends Y1<F2, D2> {
+
+ }
+
+ static class Y3 extends Y2<Flavor3, Data3> {
+
+ }
+}
diff --git a/org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/UriBuilderTest.java b/org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/UriBuilderTest.java
index c1a6895133..35626eeda7 100644
--- a/org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/UriBuilderTest.java
+++ b/org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/UriBuilderTest.java
@@ -1,196 +1,196 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import static org.junit.Assert.assertEquals;
-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.net.URI;
-
-import org.junit.Test;
-
-/**
- * @since 3.8.1
- */
-public class UriBuilderTest {
-
- @Test
- public void testScheme() throws Exception {
- UriBuilder builder = new UriBuilder();
- assertNull(builder.getScheme());
- //
- assertSame(builder, builder.scheme(null));
- //
- builder.scheme("ftp");
- assertEquals("ftp", builder.getScheme());
- //
- builder = new UriBuilder("http://acme.com:1234/scout");
- assertEquals("http", builder.getScheme());
- }
-
- @Test
- public void testHost() throws Exception {
- UriBuilder builder = new UriBuilder();
- assertNull(builder.getHost());
- //
- assertSame(builder, builder.host(null));
- //
- String host = "www.eclipse.org";
- builder.host(host);
- assertEquals(host, builder.getHost());
- //
- builder = new UriBuilder("http://acme.com:1234/scout");
- assertEquals("acme.com", builder.getHost());
- }
-
- @Test
- public void testPort() throws Exception {
- UriBuilder builder = new UriBuilder();
- assertEquals(-1, builder.getPort());
- //
- assertSame(builder, builder.port(-1));
- //
- builder.port(433);
- assertEquals(433, builder.getPort());
- //
- builder.port(1);
- assertEquals(1, builder.getPort());
- //
- builder.port(0);
- assertEquals(-1, builder.getPort());
- //
- builder.port(-15);
- assertEquals(-1, builder.getPort());
- //
- builder = new UriBuilder("http://www.ecipse.org:1234/scout");
- assertEquals(1234, builder.getPort());
- //
- builder.port(42);
- assertEquals(42, builder.getPort());
- }
-
- @Test
- public void testPath() throws Exception {
- UriBuilder builder = new UriBuilder();
- assertNull(builder.getPath());
- //
- assertSame(builder, builder.path(null));
- //
- String path = "scout/foo";
- builder.path(path);
- assertEquals(path, builder.getPath());
- //
- builder = new UriBuilder("http://acme.com:1234/scout/test/3");
- assertEquals("/scout/test/3", builder.getPath());
- }
-
- @Test
- public void testAddPath() throws Exception {
- UriBuilder builder = new UriBuilder();
- assertNull(builder.getPath());
- //
- builder.addPath(null);
- assertNull(builder.getPath());
- //
- assertSame(builder, builder.addPath(null));
- //
- String path = "scout/foo";
- builder.addPath(path);
- assertEquals(path, builder.getPath());
- //
- builder = new UriBuilder("http://acme.com:1234/scout/test/3");
- builder.addPath("test");
- assertEquals("/scout/test/3/test", builder.getPath());
- //
- builder = new UriBuilder("http://acme.com:1234");
- builder.addPath("test");
- assertEquals("test", builder.getPath());
- }
-
- @Test
- public void testFragment() throws Exception {
- UriBuilder builder = new UriBuilder();
- assertNull(builder.getFragment());
- //
- assertSame(builder, builder.fragment(null));
- //
- String fragment = "anchor";
- builder.fragment(fragment);
- assertEquals(fragment, builder.getFragment());
- //
- builder = new UriBuilder("http://acme.com:1234/scout/test/3#bottomPart");
- assertEquals("bottomPart", builder.getFragment());
- }
-
- @Test
- public void testParamenter() throws Exception {
- UriBuilder builder = new UriBuilder();
- assertNotNull(builder.getParameters());
- assertTrue(builder.getParameters().isEmpty());
- //
- builder.parameter(null, null);
- builder.parameter("name1", null);
- builder.parameter(null, "value1");
- builder.parameter("name2", "value2");
- assertEquals(1, builder.getParameters().size());
- assertEquals("value2", builder.getParameters().get("name2"));
- builder.parameter("name2", null);
- assertTrue(builder.getParameters().isEmpty());
- //
- assertSame(builder, builder.parameter(null, null));
- //
- builder = new UriBuilder("http://acme.com:1234/scout?name1=value1&name2=value2");
- assertEquals(2, builder.getParameters().size());
- assertEquals("value1", builder.getParameters().get("name1"));
- assertEquals("value2", builder.getParameters().get("name2"));
- }
-
- @Test
- public void testCreateUri() throws Exception {
- UriBuilder builder = new UriBuilder();
- assertEquals(URI.create(""), builder.createURI());
- //
- builder = new UriBuilder();
- builder.scheme("scheme").host("host");
- assertEquals(URI.create("scheme://host"), builder.createURI());
- //
- builder = new UriBuilder();
- builder.scheme("scheme").path("/path/to");
- assertEquals(URI.create("scheme:/path/to"), builder.createURI());
- //
- builder = new UriBuilder();
- builder.scheme("scheme").host("host").path("/path/to");
- assertEquals(URI.create("scheme://host/path/to"), builder.createURI());
- //
- builder = new UriBuilder();
- builder.scheme("scheme").host("host").path("/path/to").fragment("anchor");
- assertEquals(URI.create("scheme://host/path/to#anchor"), builder.createURI());
- //
- builder = new UriBuilder();
- builder.scheme("scheme").host("host").path("/path/to").fragment("anchor").parameter("key", "value");
- assertEquals(URI.create("scheme://host/path/to?key=value#anchor"), builder.createURI());
- //
- builder = new UriBuilder();
- builder.scheme("scheme").host("host").path("/path/to").fragment("anchor").parameter("key", "äöü");
- assertEquals("scheme://host/path/to?key=%25E4%25F6%25FC#anchor", builder.createURI().toASCIIString());
- //
- builder = new UriBuilder();
- builder.scheme("scheme").host("host").path("/path/to").fragment("anchor").parameter("key", "äöü");
- assertEquals("scheme://host/path/to?key=%25C3%25A4%25C3%25B6%25C3%25BC#anchor", builder.createURI("UTF-8").toASCIIString());
- //
- URI baseUri = new URI("http://www.eclipse.org/scout");
- builder = new UriBuilder(baseUri);
- assertEquals(baseUri, builder.createURI());
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import static org.junit.Assert.assertEquals;
+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.net.URI;
+
+import org.junit.Test;
+
+/**
+ * @since 3.8.1
+ */
+public class UriBuilderTest {
+
+ @Test
+ public void testScheme() throws Exception {
+ UriBuilder builder = new UriBuilder();
+ assertNull(builder.getScheme());
+ //
+ assertSame(builder, builder.scheme(null));
+ //
+ builder.scheme("ftp");
+ assertEquals("ftp", builder.getScheme());
+ //
+ builder = new UriBuilder("http://acme.com:1234/scout");
+ assertEquals("http", builder.getScheme());
+ }
+
+ @Test
+ public void testHost() throws Exception {
+ UriBuilder builder = new UriBuilder();
+ assertNull(builder.getHost());
+ //
+ assertSame(builder, builder.host(null));
+ //
+ String host = "www.eclipse.org";
+ builder.host(host);
+ assertEquals(host, builder.getHost());
+ //
+ builder = new UriBuilder("http://acme.com:1234/scout");
+ assertEquals("acme.com", builder.getHost());
+ }
+
+ @Test
+ public void testPort() throws Exception {
+ UriBuilder builder = new UriBuilder();
+ assertEquals(-1, builder.getPort());
+ //
+ assertSame(builder, builder.port(-1));
+ //
+ builder.port(433);
+ assertEquals(433, builder.getPort());
+ //
+ builder.port(1);
+ assertEquals(1, builder.getPort());
+ //
+ builder.port(0);
+ assertEquals(-1, builder.getPort());
+ //
+ builder.port(-15);
+ assertEquals(-1, builder.getPort());
+ //
+ builder = new UriBuilder("http://www.ecipse.org:1234/scout");
+ assertEquals(1234, builder.getPort());
+ //
+ builder.port(42);
+ assertEquals(42, builder.getPort());
+ }
+
+ @Test
+ public void testPath() throws Exception {
+ UriBuilder builder = new UriBuilder();
+ assertNull(builder.getPath());
+ //
+ assertSame(builder, builder.path(null));
+ //
+ String path = "scout/foo";
+ builder.path(path);
+ assertEquals(path, builder.getPath());
+ //
+ builder = new UriBuilder("http://acme.com:1234/scout/test/3");
+ assertEquals("/scout/test/3", builder.getPath());
+ }
+
+ @Test
+ public void testAddPath() throws Exception {
+ UriBuilder builder = new UriBuilder();
+ assertNull(builder.getPath());
+ //
+ builder.addPath(null);
+ assertNull(builder.getPath());
+ //
+ assertSame(builder, builder.addPath(null));
+ //
+ String path = "scout/foo";
+ builder.addPath(path);
+ assertEquals(path, builder.getPath());
+ //
+ builder = new UriBuilder("http://acme.com:1234/scout/test/3");
+ builder.addPath("test");
+ assertEquals("/scout/test/3/test", builder.getPath());
+ //
+ builder = new UriBuilder("http://acme.com:1234");
+ builder.addPath("test");
+ assertEquals("test", builder.getPath());
+ }
+
+ @Test
+ public void testFragment() throws Exception {
+ UriBuilder builder = new UriBuilder();
+ assertNull(builder.getFragment());
+ //
+ assertSame(builder, builder.fragment(null));
+ //
+ String fragment = "anchor";
+ builder.fragment(fragment);
+ assertEquals(fragment, builder.getFragment());
+ //
+ builder = new UriBuilder("http://acme.com:1234/scout/test/3#bottomPart");
+ assertEquals("bottomPart", builder.getFragment());
+ }
+
+ @Test
+ public void testParamenter() throws Exception {
+ UriBuilder builder = new UriBuilder();
+ assertNotNull(builder.getParameters());
+ assertTrue(builder.getParameters().isEmpty());
+ //
+ builder.parameter(null, null);
+ builder.parameter("name1", null);
+ builder.parameter(null, "value1");
+ builder.parameter("name2", "value2");
+ assertEquals(1, builder.getParameters().size());
+ assertEquals("value2", builder.getParameters().get("name2"));
+ builder.parameter("name2", null);
+ assertTrue(builder.getParameters().isEmpty());
+ //
+ assertSame(builder, builder.parameter(null, null));
+ //
+ builder = new UriBuilder("http://acme.com:1234/scout?name1=value1&name2=value2");
+ assertEquals(2, builder.getParameters().size());
+ assertEquals("value1", builder.getParameters().get("name1"));
+ assertEquals("value2", builder.getParameters().get("name2"));
+ }
+
+ @Test
+ public void testCreateUri() throws Exception {
+ UriBuilder builder = new UriBuilder();
+ assertEquals(URI.create(""), builder.createURI());
+ //
+ builder = new UriBuilder();
+ builder.scheme("scheme").host("host");
+ assertEquals(URI.create("scheme://host"), builder.createURI());
+ //
+ builder = new UriBuilder();
+ builder.scheme("scheme").path("/path/to");
+ assertEquals(URI.create("scheme:/path/to"), builder.createURI());
+ //
+ builder = new UriBuilder();
+ builder.scheme("scheme").host("host").path("/path/to");
+ assertEquals(URI.create("scheme://host/path/to"), builder.createURI());
+ //
+ builder = new UriBuilder();
+ builder.scheme("scheme").host("host").path("/path/to").fragment("anchor");
+ assertEquals(URI.create("scheme://host/path/to#anchor"), builder.createURI());
+ //
+ builder = new UriBuilder();
+ builder.scheme("scheme").host("host").path("/path/to").fragment("anchor").parameter("key", "value");
+ assertEquals(URI.create("scheme://host/path/to?key=value#anchor"), builder.createURI());
+ //
+ builder = new UriBuilder();
+ builder.scheme("scheme").host("host").path("/path/to").fragment("anchor").parameter("key", "äöü");
+ assertEquals("scheme://host/path/to?key=%25E4%25F6%25FC#anchor", builder.createURI().toASCIIString());
+ //
+ builder = new UriBuilder();
+ builder.scheme("scheme").host("host").path("/path/to").fragment("anchor").parameter("key", "äöü");
+ assertEquals("scheme://host/path/to?key=%25C3%25A4%25C3%25B6%25C3%25BC#anchor", builder.createURI("UTF-8").toASCIIString());
+ //
+ URI baseUri = new URI("http://www.eclipse.org/scout");
+ builder = new UriBuilder(baseUri);
+ assertEquals(baseUri, builder.createURI());
+ }
+}
diff --git a/org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/UriUtilityTest.java b/org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/UriUtilityTest.java
index ad32949f77..4eef64e603 100644
--- a/org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/UriUtilityTest.java
+++ b/org.eclipse.scout.commons.test/src/org/eclipse/scout/commons/UriUtilityTest.java
@@ -1,81 +1,81 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.fail;
-
-import java.net.URI;
-import java.net.URL;
-import java.util.Collections;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.junit.Test;
-
-/**
- * @since 3.8.1
- */
-public class UriUtilityTest {
-
- @Test
- public void testGetQueryParametersNull() throws Exception {
- assertEquals(Collections.emptyMap(), UriUtility.getQueryParameters((URI) null));
- assertEquals(Collections.emptyMap(), UriUtility.getQueryParameters((URI) null, null));
- assertEquals(Collections.emptyMap(), UriUtility.getQueryParameters((URI) null, "UTF-8"));
- assertEquals(Collections.singletonMap("value", "1"), UriUtility.getQueryParameters(URI.create("scheme://test.com/path?value=1"), null));
- assertEquals(Collections.emptyMap(), UriUtility.getQueryParameters((URL) null));
- assertEquals(Collections.emptyMap(), UriUtility.getQueryParameters((URL) null, null));
- assertEquals(Collections.emptyMap(), UriUtility.getQueryParameters((URL) null, "UTF-8"));
- assertEquals(Collections.singletonMap("value", "1"), UriUtility.getQueryParameters(new URL("http://test.com/path?value=1"), null));
- }
-
- @Test
- public void testGetPath() throws Exception {
- assertArrayEquals(new String[0], UriUtility.getPath(null));
- assertArrayEquals(new String[0], UriUtility.getPath(new URI("")));
- assertArrayEquals(new String[0], UriUtility.getPath(new URI("scheme://host#anchor")));
- assertArrayEquals(new String[]{"path", "to"}, UriUtility.getPath(new URI("scheme://host/path/to#anchor")));
- }
-
- @Test
- public void testGetQueryparameters() throws Exception {
- UriBuilder builder = new UriBuilder("scheme://host/path/to#anchor").parameter("key", "äöü");
- URI uri = builder.createURI();
- assertEquals(Collections.singletonMap("key", "äöü"), UriUtility.getQueryParameters(uri));
- //
- URI utfUri = builder.createURI("UTF-8");
- assertEquals(Collections.singletonMap("key", "äöü"), UriUtility.getQueryParameters(utfUri, "UTF-8"));
- }
-
- @Test
- public void testUrlToUri() throws Exception {
- assertNull(UriUtility.urlToUri(null));
- String s = "http://host/path/to?test=foo#anchor";
- assertEquals(new URI(s), UriUtility.urlToUri(new URL(s)));
- }
-
- @Test
- public void testUriToUrl() throws Exception {
- assertNull(UriUtility.uriToUrl(null));
- String s = "http://host/path/to?test=foo#anchor";
- assertEquals(new URL(s), UriUtility.uriToUrl(new URI(s)));
- //
- try {
- UriUtility.uriToUrl(new URI("scheme://host"));
- fail("scheme is not supported by java.lang.URL");
- }
- catch (ProcessingException e) {
- // ok
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
+
+import java.net.URI;
+import java.net.URL;
+import java.util.Collections;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.junit.Test;
+
+/**
+ * @since 3.8.1
+ */
+public class UriUtilityTest {
+
+ @Test
+ public void testGetQueryParametersNull() throws Exception {
+ assertEquals(Collections.emptyMap(), UriUtility.getQueryParameters((URI) null));
+ assertEquals(Collections.emptyMap(), UriUtility.getQueryParameters((URI) null, null));
+ assertEquals(Collections.emptyMap(), UriUtility.getQueryParameters((URI) null, "UTF-8"));
+ assertEquals(Collections.singletonMap("value", "1"), UriUtility.getQueryParameters(URI.create("scheme://test.com/path?value=1"), null));
+ assertEquals(Collections.emptyMap(), UriUtility.getQueryParameters((URL) null));
+ assertEquals(Collections.emptyMap(), UriUtility.getQueryParameters((URL) null, null));
+ assertEquals(Collections.emptyMap(), UriUtility.getQueryParameters((URL) null, "UTF-8"));
+ assertEquals(Collections.singletonMap("value", "1"), UriUtility.getQueryParameters(new URL("http://test.com/path?value=1"), null));
+ }
+
+ @Test
+ public void testGetPath() throws Exception {
+ assertArrayEquals(new String[0], UriUtility.getPath(null));
+ assertArrayEquals(new String[0], UriUtility.getPath(new URI("")));
+ assertArrayEquals(new String[0], UriUtility.getPath(new URI("scheme://host#anchor")));
+ assertArrayEquals(new String[]{"path", "to"}, UriUtility.getPath(new URI("scheme://host/path/to#anchor")));
+ }
+
+ @Test
+ public void testGetQueryparameters() throws Exception {
+ UriBuilder builder = new UriBuilder("scheme://host/path/to#anchor").parameter("key", "äöü");
+ URI uri = builder.createURI();
+ assertEquals(Collections.singletonMap("key", "äöü"), UriUtility.getQueryParameters(uri));
+ //
+ URI utfUri = builder.createURI("UTF-8");
+ assertEquals(Collections.singletonMap("key", "äöü"), UriUtility.getQueryParameters(utfUri, "UTF-8"));
+ }
+
+ @Test
+ public void testUrlToUri() throws Exception {
+ assertNull(UriUtility.urlToUri(null));
+ String s = "http://host/path/to?test=foo#anchor";
+ assertEquals(new URI(s), UriUtility.urlToUri(new URL(s)));
+ }
+
+ @Test
+ public void testUriToUrl() throws Exception {
+ assertNull(UriUtility.uriToUrl(null));
+ String s = "http://host/path/to?test=foo#anchor";
+ assertEquals(new URL(s), UriUtility.uriToUrl(new URI(s)));
+ //
+ try {
+ UriUtility.uriToUrl(new URI("scheme://host"));
+ fail("scheme is not supported by java.lang.URL");
+ }
+ catch (ProcessingException e) {
+ // ok
+ }
+ }
+}
diff --git a/org.eclipse.scout.commons/.settings/org.eclipse.pde.core.prefs b/org.eclipse.scout.commons/.settings/org.eclipse.pde.core.prefs
index baef13dd8c..a3a50fc8da 100644
--- a/org.eclipse.scout.commons/.settings/org.eclipse.pde.core.prefs
+++ b/org.eclipse.scout.commons/.settings/org.eclipse.pde.core.prefs
@@ -1,3 +1,3 @@
-#Mon Jul 11 16:16:00 CEST 2011
-eclipse.preferences.version=1
-pluginProject.extensions=true
+#Mon Jul 11 16:16:00 CEST 2011
+eclipse.preferences.version=1
+pluginProject.extensions=true
diff --git a/org.eclipse.scout.commons/Release Notes.txt b/org.eclipse.scout.commons/Release Notes.txt
index e7c587fdcc..aa4553952c 100644
--- a/org.eclipse.scout.commons/Release Notes.txt
+++ b/org.eclipse.scout.commons/Release Notes.txt
@@ -1,290 +1,290 @@
-16.08.2010 abr
-merged org.eclipse.scout.nls classes into org.eclipse.scout.commons bundle
-moved public static methods from org.eclipse.scout.nls.NlsPlugin to org.eclipse.scout.nls.sdk.operations.AbstractCreateNlsProjectOperation
-REMOVE dependencies on org.eclipse.scout.nls from MANIFEST.MF, feature.xml and product files
-RENAME import org.eclipse.scout.nls. TO import org.eclipse.scout.commons.nls.
-
-08.09.20101 imo
-Since slf4j and logback is highly fragmented without any benefit, merged all slf4j and logback to one plugin "ch.qos.logback.all" at
-https://svn.bsiag.com/tools/internal/logback.bsi/trunk/ch.qos.logback.all
-
-Migration is optional
-1. In the *.product files remove the following plugins
-ch.qos.logback.core
-ch.qos.logback.slf4j
-org.slf4j.api
-org.slf4j.ext
-org.slf4j.jcl
-org.slf4j.jul
-org.slf4j.log4j
-2. Add only the plugin
-ch.qos.logback.all
-3. In the project-specific fragment containing the logback.xml change the bundle-host in the MANIFEST.mf to "ch.qos.logback.all"
-
-03.11.2010 abr
-Modified MatrixUtility.sort: use NLSLocale instead of the formatting locale (i.e. Locale.getDefault()) for sorting arrays if
-the sort method without a Locale is used: org.eclipse.scout.commons.MatrixUtility.sort(Object[][], int...)
-Migration: none. If really the formatting Locale is required switch to MatrixUtility.sort(Locale.getDefault(), ...)
-
-16.11.2010 imo
-Since slf4j and logback is sometimes hiding log entries and due to the fact that scout must not support these out of the box,
-reverted basic log handling to only supporting java and eclipse log out of the box.
-Scout therefore supports classic eclipse log (using IStatus) and java log (using java.util.logging.Logger).
-Details can be found in javadoc of org.eclipse.scout.commons.logger.ScoutLogManager
-
-Migration: It is recommended NOT to use slf4j and logback with eclipse scout projects, it is too complex.
-Remove all "ch.qos.logback*" "org.slf4j*" and log4j plugins from your product configurations and dependencies.
-Remove the project-specific logback fragments from the project.
-When using special logging filters, rollover logs etc. configure this in the standard java logger.properties in the project.
-Details can be found in the google: "java util logger config"
-*** Settings in config.ini for using classic eclipse log, this is normally used only in client appliactions on swt:
-eclipse.consoleLog=true
-org.eclipse.scout.log=eclipse
-org.eclipse.scout.log.level=WARNING
-
-*** Settings in config.ini for using java standard log, this is the recommended usage:
-eclipse.consoleLog=false
-org.eclipse.scout.log=java
-
-05.01.2011 imo
-Eliminated javax.mail and javax.jms plugins due to severe issues in sun's handling of javamail and mailcap configuration.
-jax-ws interferes with javamail in a global static way which is dependent on which classloader initiates the factory.
-The result is a lucky guess which class loader context loads the mailcap resources.
-Migration:
-* the endorsed jars are at O:\Scout SDK\Releases\Head\jre-lib-endorsed
-* when using JRE 1.5: copy javax.mail.jre15_1.4.1.jar and javax.jms_1.1.0.jar to the jre\lib\endorsed folder of the JRE.
-* when using JRE 1.6: copy javax.mail.jre16_1.4.3.jar and javax.jms_1.1.0.jar to the jre\lib\endorsed folder of the JRE.
-* restart eclipse, check installed jre's eventually press the button "Restore Defaults"
-* remove the plugins from the IDE, the trunk IDE is automatically updated
-* remove all import dependencies to javax.jms, javax.mail, javax.activation and com.sun
-* remove all references to javax.mail, javax.activation, javax.jms and com.sun in *.product, *.xml and MANIFEST.MF files
-* for every project using javax.* open project properties:
-Build Path
- Libraries
- JRE System Library
- Access Rule
- Button "Edit..."
- Button "Add"
- add a new entry with "Accessible" javax/**
-
-27.04.2011 dwi
-Problem:
-There was a need to
- - set dynamically a global log level
- - record log messages
- - add custom log implementations
-Solution:
-- The log level can be set dynamically using IScoutLogManager#setGlobalLogLevel(Integer globalLogLevel)
-- log messages can be recorded by using IScoutLogManager#startRecording() and IScoutLogManager#stopRecording()
-- other logging implementations can be installed by creating a fragment to the host Plug-In 'org.eclipse.scout.commons' with the class 'org.eclipse.scout.commons.logger.CustomLogManager' placed in it.
-Migration: None
-
-24.05.2011 hmu
-Ticket: 102'394
-Bugzilla – Bug 346619
-Bugzilla – Bug 346190
-Problem: Sending of MimeMessages with LotusNotes failed
-Solution:
-- MailUtility.createMimeMessageFromWordArchiveInternal changed
-- MailUtility.writeHtmlBody added
-- MailUtility.writePlainBody added
-Migration: None
-
-10.06.2011 imo
-Internal BSI security audit
-The legacy functionality of using &...& sql binds (instead of :abc or #abc#) can lead to sql injection if not used carefully.
-Added warning whenever such code is used.
-Support is eliminated in future release.
-To disable warnings (not recommended) set the server-side config.ini property org.eclipse.scout.commons.sqlplainbind=true
-To enable strict mode (recommended) set the server-side config.ini property org.eclipse.scout.commons.sqlplainbind=false
-Strict mode throws an exception on usages of &..&
-Migration:
-Remove all occurrences and usages of &...& binds.
-Use regex "&[\{\[]*[a-zA-Z]+[a-zA-Z0-9._\[\]\{\}]*&" to find occurrences.
-When statement part composition is really needed, use string concatenation instead.
-
-04.08.2011 abr
-Bugzilla - Bug: 353924
-DynamicNLS and its extensions can now be used outside a running Eclipse (e.g. in a plain JUnit test).
-Migration: None
-
-22.08.2011 dwi
-BSI ticket #105'026, #104'976
-Problem:
-- Failed to display corrupt HTML pages (e.g. if missing closing quote in style definition)
-- In HTML editor, no cleanup (auto-correction) should be applied to the given HTML. That is because if the user did some modifications in the HTML source and reloads the HTML in the editor anew, unwanted auto-corrections would be applied.
-Solution:
-- Accomplish consistency concerning HTML styling (cleanup) in between of Swing and SWT in regard of ScoutHtmlField and ScoutHmtEditor.
- In more detail, this entails the following:
- - Before passing the HTML to the respective widget (ScoutHtmlEditor, ScoutHtmlField), Abstract[Swing|Swt]Environment#styleHtmlText() is called to cleanup the given HTML.
- - In case of HTML editor mode, no modifications are applied to the given HTML in both, Swing and SWT, respectively.
- - However, in non-editor mode, some intelligence is applied to the HTML to ensure proper display of the HTML document.
- - In Swing, cleanup of HTML structure and CSS definitions is done. That is crucial as Swing HTML viewer has some problems with some CSS constructs.
- - In SWT, OS default browser is used. That is why cleanup of CSS is not necessary as done by browser itself.
- But, because the HTML is provided as file to the browser, proper encoding and charset must be set.
-- Failsafe: if HTML text cannot be parsed for cleanup, the raw HTML text is used instead of an exception thrown.
-- Consolidation of HTML cleanup functionality in HTMLUtility for plain and simple use that is applicable for both, SWT and Swing, respectively. That is why various methods in HtmlUtility are removed.
-Plug-Ins affected:
-- org.eclipse.scout.commons (HTMLUtility
-- org.eclipse.scout.rt.client (AbstractHtmlField)
-- org.eclipse.scout.rt.ui.swing (AbstractSwingEnvironment, SwingScoutHtmlField, SwingScoutMailField)
-- org.eclipse.scout.rt.ui.swing.bsi.fragment (SwingScoutHtmlEditor)
-- org.eclipse.scout.rt.ui.swt (AbstractSwtEnvironment, SwtScoutHtmlField)
-- org.eclipse.scout.rt.ui.swt.bsi.fragment (SwtScoutHtmlEditor)
-Migration Swing / SWT:
-- In HTMLUtility, the following methods are removed.
- - HTMLUtility#parseDocument(String) to be replaced by HTMLUtility.toHtmlDocument(String)
- - HTMLUtility#formatDocument(String) to be replaced by HTMLUtility.toHtmlText(HTMLDocument)
- - HTMLUtility#cleanupDocument(HTMLDocument, String, int) to be replaced by HTMLUtility.cleanupHtml(String, boolean,boolean, DefaultFont)
- - HTMLUtility#wellformDocument(HTMLDocument, String, int) to be replaced by HTMLUtility.cleanupHtml(String, boolean,boolean, DefaultFont)
-Migration SWT:
-- In AbstractSwtEnvironment, the following methods are removed as not required anymore because logic is encapsulated in HTMLUtility.
- - AbstractSwtEnvironment#styleHtmlText(Control, String)
- - AbstractSwtEnvironment#createCSS(Control)
- - AbstractSwtEnvironment#createHtmlDocument(String, String)
-
-25.08.2011 dwi
-BSI ticket #105'026
-Problem:
-Default font specific issues in HTML cleanup which is applied to the HTML text prior being provided to AbstractHtmlField:
- - Application specific default font settings should always be applied to body style definition if not specified yet
- - default font size unit on SWT should be pt instead of px
- - precedence of font-families should be supported in default font settings
-Solution:
-- Changed HTMLUtility#cleanupHtml(..) to ensure default font settings to be contained in CSS style definition
-- changed default font size unit in AbstractSwtEnvironment#createDefaultFontSettings(Control) to pt
-Plug-Ins changed:
-- org.eclipse.scout.commons
-- org.eclipse.scout.rt.ui.swt
-- org.eclipse.scout.rt.ui.swing
-- org.eclipse.scout.rt.ui.rap
-Migration:
-None
-
-30.09.2011 dwi [patch provided by dbu, BSI Business Systems Integration AG]
-BSI ticket #106'584
-Bugzilla 359358
-Problem:
-The HTML created from within a Microsoft Word file contains user-specific, unnecessary information.
-Also, not referenced attachments are included which unnecessarily increase the size of the MIME-message.
-Solution:
-Removed user-specific data and redundant attachments
-Plug-Ins changed:
-- org.eclipse.scout.commons [MailUtility.class]
-Migration:
-None
-
-18.10.2011 aho
-bugzilla ticket: 361256
-To make reuse of the ServletFilters in RAP projects. The following classes
-should be moved to the 'org.eclipse.scout.http.servletfilter' bundle:
-- org.eclipse.scout.rt.server.servlet.filter.AbstractChainableSecurityFilter
-- org.eclipse.scout.rt.server.servlet.filter.AnonymousSecurityFilter
-- org.eclipse.scout.rt.server.servlet.filter.BasicSecurityFilter
-- org.eclipse.scout.rt.server.servlet.filter.DataSourceSecurityFilter
-- org.eclipse.scout.rt.server.servlet.filter.LDAPSecurityFilter
-- org.eclipse.scout.rt.server.servlet.filter.TomcatSecurityFilter
-All servlet filters in the 'org.eclipse.scout.rt.server' bundle were kept as @deprecated subclasses of the moved ones.
-Furthermore the
-'org.eclipse.scout.rt.shared.services.common.security.SimplePrincipal' should
-be moved to the 'org.eclipse.scout.commons' bundle.
-Migration: change all 'org.eclipse.scout.rt.shared.services.common.security.SimplePrincipal' imports to 'org.eclipse.scout.commons.security.SimplePrincipal'.
-
-26.10.2011 dwi
-Bugzilla ticket 361795
-Problem:
-Decorating a Date or a Number has to use NlsLocale-Settings.
-Currently, Locale.getLocal() is used which may contradict with user-settings.
-Solution:
-In Java 6 it is possible to contribute custom Locales (e.g. en_CH) to the JRE. That is why Scout NlsLocale is not used anymore and therefore marked as deprecated.
-The user's locale is accessed as follows:
-- On client side, the user's locale is accessed by Locale.getDefault()
-- On server side the request's locale is accessed by LocaleThreadLocal.get() (convenience accessor: ServerSession.get().getLocale())
-Eventhough the class NlsLocale is marked as deprecated for legacy support, its constructor 'NlsLocale(Locale)' was removed because NlsLocale was changed to only act as delegate to the thread's locale (if applicable) or default locale otherwise.
-Please note: A locale consists of its language and country. The country is mainly responsible for format settings as for instance the grouping separator of numbers. A very few locales already exist in the JRE. But if you like to have the application in the English language with Switzerland as its region, you have to contribute your own locale-implementation 'en_CH'. Please see Migration section for detailed instructions to extend JRE with a custom locale.
-Plug-Ins changed:
-- org.eclipse.scout.commons
-- org.eclipse.scout.rt.client
-- org.eclipse.scout.rt.server
-- org.eclipse.scout.rt.shared
-- org.eclipse.scout.rt.ui.swing
-- org.eclipse.scout.rt.oraclelite10g.core
-- org.eclipse.scout.rt.xstream.shared
-Migration:
-- removed NlsLocale(Locale) (constructor): use Locale instead of NlsLocale
-- removed IServerSession#getNlsLocale(): use IServerSession#getLocale() instead (e.g. replace all ServerSession.get().getNlsLocale().getLocale() by ServerSession.get().getLocale())
-- In client Plug-Ins: replace NlsLocale.getDefault().getLocale() by Locale.getDefault()
-- In server Plug-Ins: replace NlsLocale.getThreadDefault().getLocale() by LocaleThreadLocal.get()
-- In shared Plug-Ins: replace NlsLocale.getDefault().getLocale() by NlsUtility.getDefaultLocale()
-Contribution of custom locales to the JRE:
-1. Create a plain Java project, e.g. x.y.localeprovider.en.ch
-2. Create two classes that inherit from {@link DateFormatProvider} and {@link NumberFormatProvider} and implement the method stubs specific to your locale
-3. Create the folder META-INF/services with two files java.text.spi.DateFormatProvider and java.text.spi.NumberFormatProvider
-4. In those files, simply put the the fully qualified name to your date/number provider
-5. Export project as JAR file and put it into \lib\ext of your JRE
-
-24.11.2011 dwi
-Bugzilla ticket 364545
-BSI ticket 108'224
-Problem:
-In table cells, tabulators are not rendered correctly namely as non-breaking spaces.
-Solution:
-Tabs are only to be interpreted as real tabs in multiline tables. If non-HTML text is content of a cell, its content is encoded to be printed as HTML.
->In StringUtility#htmlEncode, tabs are to be converted into HTML tabs in the form of <span style=\"white-space:pre\">&#9;</span>
->In StringUtility#htmlDecode, HTML tabs and HTML breaks are to be converted into \t and \n, respectively.
-Migration:
-None
-
-24.11.2011 dwi
-Bugzilla ticket 360195
-BSI ticket 105'945
-Problem:
-If creating a MIME-message from within a Word archive, files like item0001.xml und props0002.xml should also be filtered.
-Solution:
-Files with the following names are excluded:
-- filelist.xml
-- colorschememapping.xml
-- themedata.thmx
-- header.html
-- editdata.mso
-- item\\d{4}\\.xml [regex]
-- props\\d{4}\\.xml [regex]
-Migration:
-None
-
-28.11.2011 dwi
-Bugzilla: 364019
-Problem:
-There has to be a possibility to disable the behaviour of Ctrl+C on tables. A use case for this would be an application
-with sensitive information (e.g. address data) that should not be allowed to be exported, only to be displayed to the user.
-Solution:
-> Added the method 'AbstractTable#execCopy(ITableRow[])' to return a transfer object to be put into the clipboard
-> By default, a TextTransferObject is returned with a text/plain and text/html representation of the selected rows.
- That means that if the target understands HTML, the HTML representation is used over the plain-text representation.
-> In SWT, added copy support on tables (not implemented yet)
-> Added permission 'CopyToClipboardPermission' to enable / disable the copy functionality
-Migration Swing:
-> So far, the copy functionality was enabled by default. Because protected by a permission, it is disabled by default as of now.
- To enable the CTRL-C behavior on tables, add the permission 'CopyToClipboardPermission' to the permission-set in AbstractAccessControlService#execLoadPermissions
- or directly grant it to specific user roles in your database script.
-Migration SWT:
-> None because not supported yet. To enable the copy functionality, see migration notes for Swing.
-
-29.11.2011 dwi/imo
-Bugzilla: 358369 (bug-fix)
-Problem:
-BeanArrayHolder should implement Serializable to be used as transfer object in client-server communication.
-However, the wrapped type must not necessarily be serializable to also be used as holder for any beans (e.g. beans of a webservice stub)
-Solution:
-Changed BeanArrayHolder to implement Serializable. This only applies to the holder, not the wrapped type.
-Migration: None
-
-03.01.2012 dwi
-Bugzilla: 367507
-Problem:
-When having a single line textfield (getConfiguredMultilineText=false), leading and trailing newlines should not be replaced by spaces but omitted insted.
-Solution:
-Leading and trailing newlines are trimmed prior to replacing them by spaces.
-Plug-Ins changed:
-org.eclipse.scout.commons [StringUtility], org.eclipse.scout.rt.ui.swing [SwingScoutTextFieldComposite#P_SwingDocumentFilter], org.eclipse.scout.rt.client [SwingScoutTextFieldComposite]
+16.08.2010 abr
+merged org.eclipse.scout.nls classes into org.eclipse.scout.commons bundle
+moved public static methods from org.eclipse.scout.nls.NlsPlugin to org.eclipse.scout.nls.sdk.operations.AbstractCreateNlsProjectOperation
+REMOVE dependencies on org.eclipse.scout.nls from MANIFEST.MF, feature.xml and product files
+RENAME import org.eclipse.scout.nls. TO import org.eclipse.scout.commons.nls.
+
+08.09.20101 imo
+Since slf4j and logback is highly fragmented without any benefit, merged all slf4j and logback to one plugin "ch.qos.logback.all" at
+https://svn.bsiag.com/tools/internal/logback.bsi/trunk/ch.qos.logback.all
+
+Migration is optional
+1. In the *.product files remove the following plugins
+ch.qos.logback.core
+ch.qos.logback.slf4j
+org.slf4j.api
+org.slf4j.ext
+org.slf4j.jcl
+org.slf4j.jul
+org.slf4j.log4j
+2. Add only the plugin
+ch.qos.logback.all
+3. In the project-specific fragment containing the logback.xml change the bundle-host in the MANIFEST.mf to "ch.qos.logback.all"
+
+03.11.2010 abr
+Modified MatrixUtility.sort: use NLSLocale instead of the formatting locale (i.e. Locale.getDefault()) for sorting arrays if
+the sort method without a Locale is used: org.eclipse.scout.commons.MatrixUtility.sort(Object[][], int...)
+Migration: none. If really the formatting Locale is required switch to MatrixUtility.sort(Locale.getDefault(), ...)
+
+16.11.2010 imo
+Since slf4j and logback is sometimes hiding log entries and due to the fact that scout must not support these out of the box,
+reverted basic log handling to only supporting java and eclipse log out of the box.
+Scout therefore supports classic eclipse log (using IStatus) and java log (using java.util.logging.Logger).
+Details can be found in javadoc of org.eclipse.scout.commons.logger.ScoutLogManager
+
+Migration: It is recommended NOT to use slf4j and logback with eclipse scout projects, it is too complex.
+Remove all "ch.qos.logback*" "org.slf4j*" and log4j plugins from your product configurations and dependencies.
+Remove the project-specific logback fragments from the project.
+When using special logging filters, rollover logs etc. configure this in the standard java logger.properties in the project.
+Details can be found in the google: "java util logger config"
+*** Settings in config.ini for using classic eclipse log, this is normally used only in client appliactions on swt:
+eclipse.consoleLog=true
+org.eclipse.scout.log=eclipse
+org.eclipse.scout.log.level=WARNING
+
+*** Settings in config.ini for using java standard log, this is the recommended usage:
+eclipse.consoleLog=false
+org.eclipse.scout.log=java
+
+05.01.2011 imo
+Eliminated javax.mail and javax.jms plugins due to severe issues in sun's handling of javamail and mailcap configuration.
+jax-ws interferes with javamail in a global static way which is dependent on which classloader initiates the factory.
+The result is a lucky guess which class loader context loads the mailcap resources.
+Migration:
+* the endorsed jars are at O:\Scout SDK\Releases\Head\jre-lib-endorsed
+* when using JRE 1.5: copy javax.mail.jre15_1.4.1.jar and javax.jms_1.1.0.jar to the jre\lib\endorsed folder of the JRE.
+* when using JRE 1.6: copy javax.mail.jre16_1.4.3.jar and javax.jms_1.1.0.jar to the jre\lib\endorsed folder of the JRE.
+* restart eclipse, check installed jre's eventually press the button "Restore Defaults"
+* remove the plugins from the IDE, the trunk IDE is automatically updated
+* remove all import dependencies to javax.jms, javax.mail, javax.activation and com.sun
+* remove all references to javax.mail, javax.activation, javax.jms and com.sun in *.product, *.xml and MANIFEST.MF files
+* for every project using javax.* open project properties:
+Build Path
+ Libraries
+ JRE System Library
+ Access Rule
+ Button "Edit..."
+ Button "Add"
+ add a new entry with "Accessible" javax/**
+
+27.04.2011 dwi
+Problem:
+There was a need to
+ - set dynamically a global log level
+ - record log messages
+ - add custom log implementations
+Solution:
+- The log level can be set dynamically using IScoutLogManager#setGlobalLogLevel(Integer globalLogLevel)
+- log messages can be recorded by using IScoutLogManager#startRecording() and IScoutLogManager#stopRecording()
+- other logging implementations can be installed by creating a fragment to the host Plug-In 'org.eclipse.scout.commons' with the class 'org.eclipse.scout.commons.logger.CustomLogManager' placed in it.
+Migration: None
+
+24.05.2011 hmu
+Ticket: 102'394
+Bugzilla – Bug 346619
+Bugzilla – Bug 346190
+Problem: Sending of MimeMessages with LotusNotes failed
+Solution:
+- MailUtility.createMimeMessageFromWordArchiveInternal changed
+- MailUtility.writeHtmlBody added
+- MailUtility.writePlainBody added
+Migration: None
+
+10.06.2011 imo
+Internal BSI security audit
+The legacy functionality of using &...& sql binds (instead of :abc or #abc#) can lead to sql injection if not used carefully.
+Added warning whenever such code is used.
+Support is eliminated in future release.
+To disable warnings (not recommended) set the server-side config.ini property org.eclipse.scout.commons.sqlplainbind=true
+To enable strict mode (recommended) set the server-side config.ini property org.eclipse.scout.commons.sqlplainbind=false
+Strict mode throws an exception on usages of &..&
+Migration:
+Remove all occurrences and usages of &...& binds.
+Use regex "&[\{\[]*[a-zA-Z]+[a-zA-Z0-9._\[\]\{\}]*&" to find occurrences.
+When statement part composition is really needed, use string concatenation instead.
+
+04.08.2011 abr
+Bugzilla - Bug: 353924
+DynamicNLS and its extensions can now be used outside a running Eclipse (e.g. in a plain JUnit test).
+Migration: None
+
+22.08.2011 dwi
+BSI ticket #105'026, #104'976
+Problem:
+- Failed to display corrupt HTML pages (e.g. if missing closing quote in style definition)
+- In HTML editor, no cleanup (auto-correction) should be applied to the given HTML. That is because if the user did some modifications in the HTML source and reloads the HTML in the editor anew, unwanted auto-corrections would be applied.
+Solution:
+- Accomplish consistency concerning HTML styling (cleanup) in between of Swing and SWT in regard of ScoutHtmlField and ScoutHmtEditor.
+ In more detail, this entails the following:
+ - Before passing the HTML to the respective widget (ScoutHtmlEditor, ScoutHtmlField), Abstract[Swing|Swt]Environment#styleHtmlText() is called to cleanup the given HTML.
+ - In case of HTML editor mode, no modifications are applied to the given HTML in both, Swing and SWT, respectively.
+ - However, in non-editor mode, some intelligence is applied to the HTML to ensure proper display of the HTML document.
+ - In Swing, cleanup of HTML structure and CSS definitions is done. That is crucial as Swing HTML viewer has some problems with some CSS constructs.
+ - In SWT, OS default browser is used. That is why cleanup of CSS is not necessary as done by browser itself.
+ But, because the HTML is provided as file to the browser, proper encoding and charset must be set.
+- Failsafe: if HTML text cannot be parsed for cleanup, the raw HTML text is used instead of an exception thrown.
+- Consolidation of HTML cleanup functionality in HTMLUtility for plain and simple use that is applicable for both, SWT and Swing, respectively. That is why various methods in HtmlUtility are removed.
+Plug-Ins affected:
+- org.eclipse.scout.commons (HTMLUtility
+- org.eclipse.scout.rt.client (AbstractHtmlField)
+- org.eclipse.scout.rt.ui.swing (AbstractSwingEnvironment, SwingScoutHtmlField, SwingScoutMailField)
+- org.eclipse.scout.rt.ui.swing.bsi.fragment (SwingScoutHtmlEditor)
+- org.eclipse.scout.rt.ui.swt (AbstractSwtEnvironment, SwtScoutHtmlField)
+- org.eclipse.scout.rt.ui.swt.bsi.fragment (SwtScoutHtmlEditor)
+Migration Swing / SWT:
+- In HTMLUtility, the following methods are removed.
+ - HTMLUtility#parseDocument(String) to be replaced by HTMLUtility.toHtmlDocument(String)
+ - HTMLUtility#formatDocument(String) to be replaced by HTMLUtility.toHtmlText(HTMLDocument)
+ - HTMLUtility#cleanupDocument(HTMLDocument, String, int) to be replaced by HTMLUtility.cleanupHtml(String, boolean,boolean, DefaultFont)
+ - HTMLUtility#wellformDocument(HTMLDocument, String, int) to be replaced by HTMLUtility.cleanupHtml(String, boolean,boolean, DefaultFont)
+Migration SWT:
+- In AbstractSwtEnvironment, the following methods are removed as not required anymore because logic is encapsulated in HTMLUtility.
+ - AbstractSwtEnvironment#styleHtmlText(Control, String)
+ - AbstractSwtEnvironment#createCSS(Control)
+ - AbstractSwtEnvironment#createHtmlDocument(String, String)
+
+25.08.2011 dwi
+BSI ticket #105'026
+Problem:
+Default font specific issues in HTML cleanup which is applied to the HTML text prior being provided to AbstractHtmlField:
+ - Application specific default font settings should always be applied to body style definition if not specified yet
+ - default font size unit on SWT should be pt instead of px
+ - precedence of font-families should be supported in default font settings
+Solution:
+- Changed HTMLUtility#cleanupHtml(..) to ensure default font settings to be contained in CSS style definition
+- changed default font size unit in AbstractSwtEnvironment#createDefaultFontSettings(Control) to pt
+Plug-Ins changed:
+- org.eclipse.scout.commons
+- org.eclipse.scout.rt.ui.swt
+- org.eclipse.scout.rt.ui.swing
+- org.eclipse.scout.rt.ui.rap
+Migration:
+None
+
+30.09.2011 dwi [patch provided by dbu, BSI Business Systems Integration AG]
+BSI ticket #106'584
+Bugzilla 359358
+Problem:
+The HTML created from within a Microsoft Word file contains user-specific, unnecessary information.
+Also, not referenced attachments are included which unnecessarily increase the size of the MIME-message.
+Solution:
+Removed user-specific data and redundant attachments
+Plug-Ins changed:
+- org.eclipse.scout.commons [MailUtility.class]
+Migration:
+None
+
+18.10.2011 aho
+bugzilla ticket: 361256
+To make reuse of the ServletFilters in RAP projects. The following classes
+should be moved to the 'org.eclipse.scout.http.servletfilter' bundle:
+- org.eclipse.scout.rt.server.servlet.filter.AbstractChainableSecurityFilter
+- org.eclipse.scout.rt.server.servlet.filter.AnonymousSecurityFilter
+- org.eclipse.scout.rt.server.servlet.filter.BasicSecurityFilter
+- org.eclipse.scout.rt.server.servlet.filter.DataSourceSecurityFilter
+- org.eclipse.scout.rt.server.servlet.filter.LDAPSecurityFilter
+- org.eclipse.scout.rt.server.servlet.filter.TomcatSecurityFilter
+All servlet filters in the 'org.eclipse.scout.rt.server' bundle were kept as @deprecated subclasses of the moved ones.
+Furthermore the
+'org.eclipse.scout.rt.shared.services.common.security.SimplePrincipal' should
+be moved to the 'org.eclipse.scout.commons' bundle.
+Migration: change all 'org.eclipse.scout.rt.shared.services.common.security.SimplePrincipal' imports to 'org.eclipse.scout.commons.security.SimplePrincipal'.
+
+26.10.2011 dwi
+Bugzilla ticket 361795
+Problem:
+Decorating a Date or a Number has to use NlsLocale-Settings.
+Currently, Locale.getLocal() is used which may contradict with user-settings.
+Solution:
+In Java 6 it is possible to contribute custom Locales (e.g. en_CH) to the JRE. That is why Scout NlsLocale is not used anymore and therefore marked as deprecated.
+The user's locale is accessed as follows:
+- On client side, the user's locale is accessed by Locale.getDefault()
+- On server side the request's locale is accessed by LocaleThreadLocal.get() (convenience accessor: ServerSession.get().getLocale())
+Eventhough the class NlsLocale is marked as deprecated for legacy support, its constructor 'NlsLocale(Locale)' was removed because NlsLocale was changed to only act as delegate to the thread's locale (if applicable) or default locale otherwise.
+Please note: A locale consists of its language and country. The country is mainly responsible for format settings as for instance the grouping separator of numbers. A very few locales already exist in the JRE. But if you like to have the application in the English language with Switzerland as its region, you have to contribute your own locale-implementation 'en_CH'. Please see Migration section for detailed instructions to extend JRE with a custom locale.
+Plug-Ins changed:
+- org.eclipse.scout.commons
+- org.eclipse.scout.rt.client
+- org.eclipse.scout.rt.server
+- org.eclipse.scout.rt.shared
+- org.eclipse.scout.rt.ui.swing
+- org.eclipse.scout.rt.oraclelite10g.core
+- org.eclipse.scout.rt.xstream.shared
+Migration:
+- removed NlsLocale(Locale) (constructor): use Locale instead of NlsLocale
+- removed IServerSession#getNlsLocale(): use IServerSession#getLocale() instead (e.g. replace all ServerSession.get().getNlsLocale().getLocale() by ServerSession.get().getLocale())
+- In client Plug-Ins: replace NlsLocale.getDefault().getLocale() by Locale.getDefault()
+- In server Plug-Ins: replace NlsLocale.getThreadDefault().getLocale() by LocaleThreadLocal.get()
+- In shared Plug-Ins: replace NlsLocale.getDefault().getLocale() by NlsUtility.getDefaultLocale()
+Contribution of custom locales to the JRE:
+1. Create a plain Java project, e.g. x.y.localeprovider.en.ch
+2. Create two classes that inherit from {@link DateFormatProvider} and {@link NumberFormatProvider} and implement the method stubs specific to your locale
+3. Create the folder META-INF/services with two files java.text.spi.DateFormatProvider and java.text.spi.NumberFormatProvider
+4. In those files, simply put the the fully qualified name to your date/number provider
+5. Export project as JAR file and put it into \lib\ext of your JRE
+
+24.11.2011 dwi
+Bugzilla ticket 364545
+BSI ticket 108'224
+Problem:
+In table cells, tabulators are not rendered correctly namely as non-breaking spaces.
+Solution:
+Tabs are only to be interpreted as real tabs in multiline tables. If non-HTML text is content of a cell, its content is encoded to be printed as HTML.
+>In StringUtility#htmlEncode, tabs are to be converted into HTML tabs in the form of <span style=\"white-space:pre\">&#9;</span>
+>In StringUtility#htmlDecode, HTML tabs and HTML breaks are to be converted into \t and \n, respectively.
+Migration:
+None
+
+24.11.2011 dwi
+Bugzilla ticket 360195
+BSI ticket 105'945
+Problem:
+If creating a MIME-message from within a Word archive, files like item0001.xml und props0002.xml should also be filtered.
+Solution:
+Files with the following names are excluded:
+- filelist.xml
+- colorschememapping.xml
+- themedata.thmx
+- header.html
+- editdata.mso
+- item\\d{4}\\.xml [regex]
+- props\\d{4}\\.xml [regex]
+Migration:
+None
+
+28.11.2011 dwi
+Bugzilla: 364019
+Problem:
+There has to be a possibility to disable the behaviour of Ctrl+C on tables. A use case for this would be an application
+with sensitive information (e.g. address data) that should not be allowed to be exported, only to be displayed to the user.
+Solution:
+> Added the method 'AbstractTable#execCopy(ITableRow[])' to return a transfer object to be put into the clipboard
+> By default, a TextTransferObject is returned with a text/plain and text/html representation of the selected rows.
+ That means that if the target understands HTML, the HTML representation is used over the plain-text representation.
+> In SWT, added copy support on tables (not implemented yet)
+> Added permission 'CopyToClipboardPermission' to enable / disable the copy functionality
+Migration Swing:
+> So far, the copy functionality was enabled by default. Because protected by a permission, it is disabled by default as of now.
+ To enable the CTRL-C behavior on tables, add the permission 'CopyToClipboardPermission' to the permission-set in AbstractAccessControlService#execLoadPermissions
+ or directly grant it to specific user roles in your database script.
+Migration SWT:
+> None because not supported yet. To enable the copy functionality, see migration notes for Swing.
+
+29.11.2011 dwi/imo
+Bugzilla: 358369 (bug-fix)
+Problem:
+BeanArrayHolder should implement Serializable to be used as transfer object in client-server communication.
+However, the wrapped type must not necessarily be serializable to also be used as holder for any beans (e.g. beans of a webservice stub)
+Solution:
+Changed BeanArrayHolder to implement Serializable. This only applies to the holder, not the wrapped type.
+Migration: None
+
+03.01.2012 dwi
+Bugzilla: 367507
+Problem:
+When having a single line textfield (getConfiguredMultilineText=false), leading and trailing newlines should not be replaced by spaces but omitted insted.
+Solution:
+Leading and trailing newlines are trimmed prior to replacing them by spaces.
+Plug-Ins changed:
+org.eclipse.scout.commons [StringUtility], org.eclipse.scout.rt.ui.swing [SwingScoutTextFieldComposite#P_SwingDocumentFilter], org.eclipse.scout.rt.client [SwingScoutTextFieldComposite]
Migration: None \ No newline at end of file
diff --git a/org.eclipse.scout.commons/eclipse-scout-code-style.xml b/org.eclipse.scout.commons/eclipse-scout-code-style.xml
index ed16aec845..1bb92fa6a6 100644
--- a/org.eclipse.scout.commons/eclipse-scout-code-style.xml
+++ b/org.eclipse.scout.commons/eclipse-scout-code-style.xml
@@ -1,269 +1,269 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<profiles version="11">
-<profile kind="CodeFormatterProfile" name="Eclipse Scout" version="11">
-<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="end_of_line"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="0"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="0"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_binary_operator" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer" value="end_of_line"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="2"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="0"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_binary_operator" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="0"/>
-<setting id="org.eclipse.jdt.core.compiler.source" value="1.5"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="false"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="0"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="1"/>
-<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="0"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="80"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="0"/>
-<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="4"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="0"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="0"/>
-<setting id="org.eclipse.jdt.core.compiler.problem.assertIdentifier" value="error"/>
-<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="tab"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/>
-<setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="false"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="0"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value="end_of_line"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch" value="end_of_line"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.compiler.problem.enumIdentifier" value="error"/>
-<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="end_of_line"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="end_of_line"/>
-<setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant" value="end_of_line"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="2"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="0"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.indent_empty_lines" value="false"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value="end_of_line"/>
-<setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="1"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="0"/>
-<setting id="org.eclipse.jdt.core.compiler.compliance" value="1.5"/>
-<setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="2"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="0"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="false"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="false"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value="0"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_binary_expression" value="0"/>
-<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="end_of_line"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode" value="enabled"/>
-<setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="0"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="80"/>
-<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups" value="1"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="end_of_line"/>
-<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.wrap_before_binary_operator" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="1"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="0"/>
-<setting id="org.eclipse.jdt.core.formatter.join_lines_in_comments" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="0"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="1"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="0"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="0"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.compiler.codegen.targetPlatform" value="1.5"/>
-<setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="0"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value="end_of_line"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" value="false"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/>
-<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="true"/>
-</profile>
-</profiles>
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<profiles version="11">
+<profile kind="CodeFormatterProfile" name="Eclipse Scout" version="11">
+<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_binary_operator" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="2"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_binary_operator" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="0"/>
+<setting id="org.eclipse.jdt.core.compiler.source" value="1.5"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="80"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="4"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="0"/>
+<setting id="org.eclipse.jdt.core.compiler.problem.assertIdentifier" value="error"/>
+<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="tab"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.compiler.problem.enumIdentifier" value="error"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="2"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_empty_lines" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="0"/>
+<setting id="org.eclipse.jdt.core.compiler.compliance" value="1.5"/>
+<setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="2"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_binary_expression" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode" value="enabled"/>
+<setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="80"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.wrap_before_binary_operator" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.join_lines_in_comments" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.compiler.codegen.targetPlatform" value="1.5"/>
+<setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="true"/>
+</profile>
+</profiles>
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/AbstractDynamicHashMap.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/AbstractDynamicHashMap.java
index 9bc79c8aa2..92c92813ec 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/AbstractDynamicHashMap.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/AbstractDynamicHashMap.java
@@ -1,240 +1,240 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import java.util.WeakHashMap;
-
-/**
- * Implementation of a time-dynamic map that supports the dynamic removal of items due to a dynamic condition.
- * <p>
- * This is a generalization of for example {@link WeakHashMap} that discards items due to garbage collection.
- * <p>
- * The condition that controls keep/discard of contained items can be applied by overriding the method
- * {@link #isEntryValid(DynamicEntry)}.
- * <p>
- * You may use {@link #touch(Object)} to update the cache state of an entry
- */
-public abstract class AbstractDynamicHashMap<K, V> implements Map<K, V>, Serializable {
- private static final long serialVersionUID = 1L;
-
- protected final Long internalMapLock;
- protected final Map<K, DynamicEntry<V>> internalMap;
-
- public AbstractDynamicHashMap() {
- internalMapLock = new Long(1L);
- internalMap = new HashMap<K, DynamicEntry<V>>();
- }
-
- /**
- * This method is called inside the internal map lock before every access to the internal map.
- * <p>
- * This may (but needs not) update the map. It can depend on performance or other optimization strategies.
- */
- protected void beforeAccessToInternalMap() {
- }
-
- /**
- * verifies all entries in the internal map and makes it valid
- */
- protected void validateInternalMap() {
- for (Iterator<Map.Entry<K, DynamicEntry<V>>> it = internalMap.entrySet().iterator(); it.hasNext();) {
- Map.Entry<K, DynamicEntry<V>> e = it.next();
- DynamicEntry<V> entry = e.getValue();
- if (!isEntryValid(entry)) {
- it.remove();
- removeNotify(entry);
- }
- }
- }
-
- /**
- * creates a {@link DynamicEntry} or a subclass of it
- */
- protected DynamicEntry<V> createDynamicEntry(V value) {
- return new DynamicEntry<V>(value);
- }
-
- /**
- * this method is called when an entry is removed
- */
- protected void removeNotify(DynamicEntry<V> entry) {
- }
-
- /**
- * This method is called inside the internal map lock whenever a dynamic entry has been accessed. It is therefore safe
- * to manipulate and change the contents of
- * the internal map
- */
- protected abstract boolean isEntryValid(DynamicEntry<V> e);
-
- @Override
- public V get(Object key) {
- synchronized (internalMapLock) {
- beforeAccessToInternalMap();
- DynamicEntry<V> entry = internalMap.get(key);
- if (entry != null && isEntryValid(entry)) {
- return entry.getValue();
- }
- return null;
- }
- }
-
- @Override
- public V put(K key, V value) {
- synchronized (internalMapLock) {
- beforeAccessToInternalMap();
- DynamicEntry<V> entry = internalMap.put(key, createDynamicEntry(value));
- if (entry != null && isEntryValid(entry)) {
- return entry.getValue();
- }
- return null;
- }
- }
-
- @Override
- public void putAll(Map<? extends K, ? extends V> m) {
- synchronized (internalMapLock) {
- beforeAccessToInternalMap();
- for (Map.Entry<? extends K, ? extends V> e : m.entrySet()) {
- internalMap.put(e.getKey(), createDynamicEntry(e.getValue()));
- }
- }
- }
-
- public V touch(K key) {
- synchronized (internalMapLock) {
- beforeAccessToInternalMap();
- DynamicEntry<V> entry = internalMap.get(key);
- if (entry != null) {
- entry.touch();
- return entry.getValue();
- }
- return null;
- }
- }
-
- @Override
- public boolean containsKey(Object key) {
- synchronized (internalMapLock) {
- beforeAccessToInternalMap();
- DynamicEntry<V> entry = internalMap.get(key);
- if (entry != null && isEntryValid(entry)) {
- return true;
- }
- return false;
- }
- }
-
- @Override
- public boolean containsValue(Object value) {
- synchronized (internalMapLock) {
- validateInternalMap();
- for (Map.Entry<K, DynamicEntry<V>> e : internalMap.entrySet()) {
- Object existingValue = e.getValue().getValue();
- if (value == existingValue || (value != null && value.equals(existingValue))) {
- return true;
- }
- }
- return false;
- }
- }
-
- @Override
- public V remove(Object key) {
- synchronized (internalMapLock) {
- beforeAccessToInternalMap();
- DynamicEntry<V> entry = internalMap.remove(key);
- if (entry != null && isEntryValid(entry)) {
- return entry.getValue();
- }
- return null;
- }
- }
-
- @Override
- public void clear() {
- synchronized (internalMapLock) {
- internalMap.clear();
- }
- }
-
- @Override
- public int size() {
- synchronized (internalMapLock) {
- validateInternalMap();
- return internalMap.size();
- }
- }
-
- @Override
- public boolean isEmpty() {
- synchronized (internalMapLock) {
- validateInternalMap();
- return internalMap.isEmpty();
- }
- }
-
- @Override
- public Set<K> keySet() {
- synchronized (internalMapLock) {
- validateInternalMap();
- return new HashSet<K>(internalMap.keySet());
- }
- }
-
- @Override
- public Collection<V> values() {
- synchronized (internalMapLock) {
- validateInternalMap();
- ArrayList<V> list = new ArrayList<V>(internalMap.size());
- for (Map.Entry<K, DynamicEntry<V>> e : internalMap.entrySet()) {
- list.add(e.getValue().getValue());
- }
- return list;
- }
- }
-
- @Override
- public Set<Map.Entry<K, V>> entrySet() {
- synchronized (internalMapLock) {
- validateInternalMap();
- HashMap<K, V> map = new HashMap<K, V>();
- for (Map.Entry<K, DynamicEntry<V>> e : internalMap.entrySet()) {
- map.put(e.getKey(), e.getValue().getValue());
- }
- return map.entrySet();
- }
- }
-
- public static class DynamicEntry<T> {
- private final T m_value;
-
- public DynamicEntry(T value) {
- m_value = value;
- }
-
- public void touch() {
- }
-
- public T getValue() {
- return m_value;
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.WeakHashMap;
+
+/**
+ * Implementation of a time-dynamic map that supports the dynamic removal of items due to a dynamic condition.
+ * <p>
+ * This is a generalization of for example {@link WeakHashMap} that discards items due to garbage collection.
+ * <p>
+ * The condition that controls keep/discard of contained items can be applied by overriding the method
+ * {@link #isEntryValid(DynamicEntry)}.
+ * <p>
+ * You may use {@link #touch(Object)} to update the cache state of an entry
+ */
+public abstract class AbstractDynamicHashMap<K, V> implements Map<K, V>, Serializable {
+ private static final long serialVersionUID = 1L;
+
+ protected final Long internalMapLock;
+ protected final Map<K, DynamicEntry<V>> internalMap;
+
+ public AbstractDynamicHashMap() {
+ internalMapLock = new Long(1L);
+ internalMap = new HashMap<K, DynamicEntry<V>>();
+ }
+
+ /**
+ * This method is called inside the internal map lock before every access to the internal map.
+ * <p>
+ * This may (but needs not) update the map. It can depend on performance or other optimization strategies.
+ */
+ protected void beforeAccessToInternalMap() {
+ }
+
+ /**
+ * verifies all entries in the internal map and makes it valid
+ */
+ protected void validateInternalMap() {
+ for (Iterator<Map.Entry<K, DynamicEntry<V>>> it = internalMap.entrySet().iterator(); it.hasNext();) {
+ Map.Entry<K, DynamicEntry<V>> e = it.next();
+ DynamicEntry<V> entry = e.getValue();
+ if (!isEntryValid(entry)) {
+ it.remove();
+ removeNotify(entry);
+ }
+ }
+ }
+
+ /**
+ * creates a {@link DynamicEntry} or a subclass of it
+ */
+ protected DynamicEntry<V> createDynamicEntry(V value) {
+ return new DynamicEntry<V>(value);
+ }
+
+ /**
+ * this method is called when an entry is removed
+ */
+ protected void removeNotify(DynamicEntry<V> entry) {
+ }
+
+ /**
+ * This method is called inside the internal map lock whenever a dynamic entry has been accessed. It is therefore safe
+ * to manipulate and change the contents of
+ * the internal map
+ */
+ protected abstract boolean isEntryValid(DynamicEntry<V> e);
+
+ @Override
+ public V get(Object key) {
+ synchronized (internalMapLock) {
+ beforeAccessToInternalMap();
+ DynamicEntry<V> entry = internalMap.get(key);
+ if (entry != null && isEntryValid(entry)) {
+ return entry.getValue();
+ }
+ return null;
+ }
+ }
+
+ @Override
+ public V put(K key, V value) {
+ synchronized (internalMapLock) {
+ beforeAccessToInternalMap();
+ DynamicEntry<V> entry = internalMap.put(key, createDynamicEntry(value));
+ if (entry != null && isEntryValid(entry)) {
+ return entry.getValue();
+ }
+ return null;
+ }
+ }
+
+ @Override
+ public void putAll(Map<? extends K, ? extends V> m) {
+ synchronized (internalMapLock) {
+ beforeAccessToInternalMap();
+ for (Map.Entry<? extends K, ? extends V> e : m.entrySet()) {
+ internalMap.put(e.getKey(), createDynamicEntry(e.getValue()));
+ }
+ }
+ }
+
+ public V touch(K key) {
+ synchronized (internalMapLock) {
+ beforeAccessToInternalMap();
+ DynamicEntry<V> entry = internalMap.get(key);
+ if (entry != null) {
+ entry.touch();
+ return entry.getValue();
+ }
+ return null;
+ }
+ }
+
+ @Override
+ public boolean containsKey(Object key) {
+ synchronized (internalMapLock) {
+ beforeAccessToInternalMap();
+ DynamicEntry<V> entry = internalMap.get(key);
+ if (entry != null && isEntryValid(entry)) {
+ return true;
+ }
+ return false;
+ }
+ }
+
+ @Override
+ public boolean containsValue(Object value) {
+ synchronized (internalMapLock) {
+ validateInternalMap();
+ for (Map.Entry<K, DynamicEntry<V>> e : internalMap.entrySet()) {
+ Object existingValue = e.getValue().getValue();
+ if (value == existingValue || (value != null && value.equals(existingValue))) {
+ return true;
+ }
+ }
+ return false;
+ }
+ }
+
+ @Override
+ public V remove(Object key) {
+ synchronized (internalMapLock) {
+ beforeAccessToInternalMap();
+ DynamicEntry<V> entry = internalMap.remove(key);
+ if (entry != null && isEntryValid(entry)) {
+ return entry.getValue();
+ }
+ return null;
+ }
+ }
+
+ @Override
+ public void clear() {
+ synchronized (internalMapLock) {
+ internalMap.clear();
+ }
+ }
+
+ @Override
+ public int size() {
+ synchronized (internalMapLock) {
+ validateInternalMap();
+ return internalMap.size();
+ }
+ }
+
+ @Override
+ public boolean isEmpty() {
+ synchronized (internalMapLock) {
+ validateInternalMap();
+ return internalMap.isEmpty();
+ }
+ }
+
+ @Override
+ public Set<K> keySet() {
+ synchronized (internalMapLock) {
+ validateInternalMap();
+ return new HashSet<K>(internalMap.keySet());
+ }
+ }
+
+ @Override
+ public Collection<V> values() {
+ synchronized (internalMapLock) {
+ validateInternalMap();
+ ArrayList<V> list = new ArrayList<V>(internalMap.size());
+ for (Map.Entry<K, DynamicEntry<V>> e : internalMap.entrySet()) {
+ list.add(e.getValue().getValue());
+ }
+ return list;
+ }
+ }
+
+ @Override
+ public Set<Map.Entry<K, V>> entrySet() {
+ synchronized (internalMapLock) {
+ validateInternalMap();
+ HashMap<K, V> map = new HashMap<K, V>();
+ for (Map.Entry<K, DynamicEntry<V>> e : internalMap.entrySet()) {
+ map.put(e.getKey(), e.getValue().getValue());
+ }
+ return map.entrySet();
+ }
+ }
+
+ public static class DynamicEntry<T> {
+ private final T m_value;
+
+ public DynamicEntry(T value) {
+ m_value = value;
+ }
+
+ public void touch() {
+ }
+
+ public T getValue() {
+ return m_value;
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/ArrayComparator.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/ArrayComparator.java
index c86f4274bd..7faa51b2fa 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/ArrayComparator.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/ArrayComparator.java
@@ -1,74 +1,74 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import java.util.Comparator;
-import java.util.Locale;
-
-public class ArrayComparator implements Comparator<Object[]> {
- private Locale m_locale;
- private int[] m_sortColumns;
-
- public ArrayComparator(Locale locale, int... sortCols) {
- m_locale = locale;
- m_sortColumns = sortCols;
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public int compare(Object[] a, Object[] b) {
- if (m_sortColumns == null || m_sortColumns.length == 0) {
- return 0;
- }
- if (a == null && b == null) {
- return 0;
- }
- if (a == null) {
- return -1;
- }
- if (b == null) {
- return 1;
- }
- for (int i = 0; i < m_sortColumns.length && m_sortColumns[i] < a.length && m_sortColumns[i] < b.length; i++) {
- Object o1 = a[m_sortColumns[i]];
- Object o2 = b[m_sortColumns[i]];
- int c = 0;
- if (o1 == null && o2 == null) {
- c = 0;
- }
- else if (o1 == null) {
- c = -1;
- }
- else if (o2 == null && o2 == null) {
- c = 1;
- }
- else if ((o1 instanceof String) && (o2 instanceof String)) {
- c = StringUtility.compareIgnoreCase(m_locale, (String) o1, (String) o2);
- }
- else if ((o1 instanceof Comparable) && (o2 instanceof Comparable)) {
- c = ((Comparable) o1).compareTo(o2);
- }
- else {
- c = StringUtility.compareIgnoreCase(m_locale, o1.toString(), o2.toString());
- }
- if (c != 0) {
- return c;
- }
- }
- if (a.length < b.length) {
- return -1;
- }
- if (a.length > b.length) {
- return 1;
- }
- return 0;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import java.util.Comparator;
+import java.util.Locale;
+
+public class ArrayComparator implements Comparator<Object[]> {
+ private Locale m_locale;
+ private int[] m_sortColumns;
+
+ public ArrayComparator(Locale locale, int... sortCols) {
+ m_locale = locale;
+ m_sortColumns = sortCols;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public int compare(Object[] a, Object[] b) {
+ if (m_sortColumns == null || m_sortColumns.length == 0) {
+ return 0;
+ }
+ if (a == null && b == null) {
+ return 0;
+ }
+ if (a == null) {
+ return -1;
+ }
+ if (b == null) {
+ return 1;
+ }
+ for (int i = 0; i < m_sortColumns.length && m_sortColumns[i] < a.length && m_sortColumns[i] < b.length; i++) {
+ Object o1 = a[m_sortColumns[i]];
+ Object o2 = b[m_sortColumns[i]];
+ int c = 0;
+ if (o1 == null && o2 == null) {
+ c = 0;
+ }
+ else if (o1 == null) {
+ c = -1;
+ }
+ else if (o2 == null && o2 == null) {
+ c = 1;
+ }
+ else if ((o1 instanceof String) && (o2 instanceof String)) {
+ c = StringUtility.compareIgnoreCase(m_locale, (String) o1, (String) o2);
+ }
+ else if ((o1 instanceof Comparable) && (o2 instanceof Comparable)) {
+ c = ((Comparable) o1).compareTo(o2);
+ }
+ else {
+ c = StringUtility.compareIgnoreCase(m_locale, o1.toString(), o2.toString());
+ }
+ if (c != 0) {
+ return c;
+ }
+ }
+ if (a.length < b.length) {
+ return -1;
+ }
+ if (a.length > b.length) {
+ return 1;
+ }
+ return 0;
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/Base64Utility.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/Base64Utility.java
index 7a9170cc8d..fe155c2704 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/Base64Utility.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/Base64Utility.java
@@ -1,102 +1,102 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-public final class Base64Utility {
-
- private Base64Utility() {
- }
-
- private static final String ALPHABET =
- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-
- /**
- * Base-64 encodes the supplied block of data. Line wrapping is not applied on
- * output.
- *
- * @param bytes
- * The block of data that is to be Base-64 encoded.
- * @return A <code>String</code> containing the encoded data.
- */
- public static String encode(byte[] bytes) {
- int length = bytes.length;
- if (length == 0) {
- return "";
- }
- StringBuffer buffer =
- new StringBuffer((int) Math.ceil(length / 3d) * 4);
- int remainder = length % 3;
- length -= remainder;
- int block;
- int i = 0;
- while (i < length) {
- block = ((bytes[i++] & 0xff) << 16) | ((bytes[i++] & 0xff) << 8) |
- (bytes[i++] & 0xff);
- buffer.append(ALPHABET.charAt(block >>> 18));
- buffer.append(ALPHABET.charAt((block >>> 12) & 0x3f));
- buffer.append(ALPHABET.charAt((block >>> 6) & 0x3f));
- buffer.append(ALPHABET.charAt(block & 0x3f));
- }
- if (remainder == 0) {
- return buffer.toString();
- }
- if (remainder == 1) {
- block = (bytes[i] & 0xff) << 4;
- buffer.append(ALPHABET.charAt(block >>> 6));
- buffer.append(ALPHABET.charAt(block & 0x3f));
- buffer.append("==");
- return buffer.toString();
- }
- block = (((bytes[i++] & 0xff) << 8) | ((bytes[i]) & 0xff)) << 2;
- buffer.append(ALPHABET.charAt(block >>> 12));
- buffer.append(ALPHABET.charAt((block >>> 6) & 0x3f));
- buffer.append(ALPHABET.charAt(block & 0x3f));
- buffer.append("=");
- return buffer.toString();
- }
-
- /**
- * Decodes the supplied Base-64 encoded string.
- *
- * @param string
- * The Base-64 encoded string that is to be decoded.
- * @return A <code>byte[]</code> containing the decoded data block.
- */
- public static byte[] decode(String string) {
- string = string.replaceAll("[^A-Za-z0-9+/=]", "");
- int length = string.length();
- if (length == 0) {
- return new byte[0];
- }
- int pad = (string.charAt(length - 2) == '=') ? 2 :
- (string.charAt(length - 1) == '=') ? 1 : 0;
- int size = length * 3 / 4 - pad;
- byte[] buffer = new byte[size];
- int block;
- int i = 0;
- int index = 0;
- while (i < length) {
- block = (ALPHABET.indexOf(string.charAt(i++)) & 0xff) << 18 |
- (ALPHABET.indexOf(string.charAt(i++)) & 0xff) << 12 |
- (ALPHABET.indexOf(string.charAt(i++)) & 0xff) << 6 |
- (ALPHABET.indexOf(string.charAt(i++)) & 0xff);
- buffer[index++] = (byte) (block >>> 16);
- if (index < size) {
- buffer[index++] = (byte) ((block >>> 8) & 0xff);
- }
- if (index < size) {
- buffer[index++] = (byte) (block & 0xff);
- }
- }
- return buffer;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+public final class Base64Utility {
+
+ private Base64Utility() {
+ }
+
+ private static final String ALPHABET =
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+
+ /**
+ * Base-64 encodes the supplied block of data. Line wrapping is not applied on
+ * output.
+ *
+ * @param bytes
+ * The block of data that is to be Base-64 encoded.
+ * @return A <code>String</code> containing the encoded data.
+ */
+ public static String encode(byte[] bytes) {
+ int length = bytes.length;
+ if (length == 0) {
+ return "";
+ }
+ StringBuffer buffer =
+ new StringBuffer((int) Math.ceil(length / 3d) * 4);
+ int remainder = length % 3;
+ length -= remainder;
+ int block;
+ int i = 0;
+ while (i < length) {
+ block = ((bytes[i++] & 0xff) << 16) | ((bytes[i++] & 0xff) << 8) |
+ (bytes[i++] & 0xff);
+ buffer.append(ALPHABET.charAt(block >>> 18));
+ buffer.append(ALPHABET.charAt((block >>> 12) & 0x3f));
+ buffer.append(ALPHABET.charAt((block >>> 6) & 0x3f));
+ buffer.append(ALPHABET.charAt(block & 0x3f));
+ }
+ if (remainder == 0) {
+ return buffer.toString();
+ }
+ if (remainder == 1) {
+ block = (bytes[i] & 0xff) << 4;
+ buffer.append(ALPHABET.charAt(block >>> 6));
+ buffer.append(ALPHABET.charAt(block & 0x3f));
+ buffer.append("==");
+ return buffer.toString();
+ }
+ block = (((bytes[i++] & 0xff) << 8) | ((bytes[i]) & 0xff)) << 2;
+ buffer.append(ALPHABET.charAt(block >>> 12));
+ buffer.append(ALPHABET.charAt((block >>> 6) & 0x3f));
+ buffer.append(ALPHABET.charAt(block & 0x3f));
+ buffer.append("=");
+ return buffer.toString();
+ }
+
+ /**
+ * Decodes the supplied Base-64 encoded string.
+ *
+ * @param string
+ * The Base-64 encoded string that is to be decoded.
+ * @return A <code>byte[]</code> containing the decoded data block.
+ */
+ public static byte[] decode(String string) {
+ string = string.replaceAll("[^A-Za-z0-9+/=]", "");
+ int length = string.length();
+ if (length == 0) {
+ return new byte[0];
+ }
+ int pad = (string.charAt(length - 2) == '=') ? 2 :
+ (string.charAt(length - 1) == '=') ? 1 : 0;
+ int size = length * 3 / 4 - pad;
+ byte[] buffer = new byte[size];
+ int block;
+ int i = 0;
+ int index = 0;
+ while (i < length) {
+ block = (ALPHABET.indexOf(string.charAt(i++)) & 0xff) << 18 |
+ (ALPHABET.indexOf(string.charAt(i++)) & 0xff) << 12 |
+ (ALPHABET.indexOf(string.charAt(i++)) & 0xff) << 6 |
+ (ALPHABET.indexOf(string.charAt(i++)) & 0xff);
+ buffer[index++] = (byte) (block >>> 16);
+ if (index < size) {
+ buffer[index++] = (byte) ((block >>> 8) & 0xff);
+ }
+ if (index < size) {
+ buffer[index++] = (byte) (block & 0xff);
+ }
+ }
+ return buffer;
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/BeanUtility.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/BeanUtility.java
index ca869d1fc2..a55f376497 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/BeanUtility.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/BeanUtility.java
@@ -1,403 +1,403 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import java.beans.IntrospectionException;
-import java.beans.Introspector;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeMap;
-
-import org.eclipse.scout.commons.beans.FastBeanInfo;
-import org.eclipse.scout.commons.beans.FastPropertyDescriptor;
-import org.eclipse.scout.commons.beans.IPropertyFilter;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-
-public final class BeanUtility {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(BeanUtility.class);
-
- private static final Object BEAN_INFO_CACHE_LOCK;
- private static final Map<CompositeObject/*Class,Class*/, FastBeanInfo> BEAN_INFO_CACHE;
- private static final Map<Class, Class> PRIMITIVE_COMPLEX_CLASS_MAP;
- private static final Map<Class, Class> COMPLEX_PRIMITIVE_CLASS_MAP;
-
- static {
- BEAN_INFO_CACHE_LOCK = new Object();
- BEAN_INFO_CACHE = new HashMap<CompositeObject, FastBeanInfo>();
- // primitive -> complex classes mappings
- PRIMITIVE_COMPLEX_CLASS_MAP = new HashMap<Class, Class>();
- PRIMITIVE_COMPLEX_CLASS_MAP.put(boolean.class, Boolean.class);
- PRIMITIVE_COMPLEX_CLASS_MAP.put(byte.class, Byte.class);
- PRIMITIVE_COMPLEX_CLASS_MAP.put(char.class, Character.class);
- PRIMITIVE_COMPLEX_CLASS_MAP.put(short.class, Short.class);
- PRIMITIVE_COMPLEX_CLASS_MAP.put(int.class, Integer.class);
- PRIMITIVE_COMPLEX_CLASS_MAP.put(long.class, Long.class);
- PRIMITIVE_COMPLEX_CLASS_MAP.put(float.class, Float.class);
- PRIMITIVE_COMPLEX_CLASS_MAP.put(double.class, Double.class);
- // complex -> primitive classes mappings
- COMPLEX_PRIMITIVE_CLASS_MAP = new HashMap<Class, Class>();
- for (Map.Entry<Class, Class> entry : PRIMITIVE_COMPLEX_CLASS_MAP.entrySet()) {
- COMPLEX_PRIMITIVE_CLASS_MAP.put(entry.getValue(), entry.getKey());
- }
- }
-
- private BeanUtility() {
- }
-
- /**
- * @return all properties of from up to (and excluding) to stopClazz, filtering with filter
- */
- public static Map<String, Object> getProperties(Object from, Class<?> stopClazz, IPropertyFilter filter) throws ProcessingException {
- HashMap<String, Object> map = new HashMap<String, Object>();
- try {
- FastPropertyDescriptor[] props = getFastPropertyDescriptors(from.getClass(), stopClazz, filter);
- for (int i = 0; i < props.length; i++) {
- FastPropertyDescriptor fromProp = props[i];
- Method readMethod = fromProp.getReadMethod();
- if (readMethod != null) {
- Object value = readMethod.invoke(from, (Object[]) null);
- map.put(fromProp.getName(), value);
- }
- }
- }
- catch (Exception e) {
- throw new ProcessingException("object: " + from, e);
- }
- return map;
- }
-
- /**
- * @param lenient
- * true just logs warnings on exceptions, false throws exceptions
- * set all properties on to, filtering with filter
- */
- public static void setProperties(Object to, Map<String, Object> map, boolean lenient, IPropertyFilter filter) throws ProcessingException {
- FastBeanInfo toInfo = getFastBeanInfo(to.getClass(), null);
- for (Iterator<Map.Entry<String, Object>> it = map.entrySet().iterator(); it.hasNext();) {
- Map.Entry<String, Object> entry = it.next();
- String name = entry.getKey();
- Object value = entry.getValue();
- try {
- FastPropertyDescriptor desc = toInfo.getPropertyDescriptor(name);
- if (desc != null && (filter == null || filter.accept(desc))) {
- Method writeMethod = desc.getWriteMethod();
- if (writeMethod != null) {
- writeMethod.invoke(to, new Object[]{TypeCastUtility.castValue(value, writeMethod.getParameterTypes()[0])});
- }
- }
- }
- catch (Exception e) {
- if (lenient) {
- LOG.warn("property " + name + " with value " + value, e);
- }
- else {
- throw new ProcessingException("property " + name + " with value " + value, e);
- }
- }
- }
- }
-
- /**
- * Get all property descriptors from this class up to (and excluding) stopClazz
- * <p>
- * Getting bean properties using {@link Introspector} can be very slow and time consuming.
- * <p>
- * This hi-speed property introspector only inspects bean names, types and read/write methods.
- * <p>
- * The results are cached for further speed optimization.
- */
- public static FastBeanInfo getFastBeanInfo(Class<?> beanClass, Class<?> stopClass) {
- if (beanClass == null) {
- return new FastBeanInfo(beanClass, stopClass);
- }
- synchronized (BEAN_INFO_CACHE_LOCK) {
- CompositeObject key = new CompositeObject(beanClass, stopClass);
- FastBeanInfo info = BEAN_INFO_CACHE.get(key);
- if (info == null) {
- info = new FastBeanInfo(beanClass, stopClass);
- BEAN_INFO_CACHE.put(key, info);
- }
- return info;
- }
- }
-
- /**
- * Clear the cache used by {@link #getBeanInfoEx(Class, Class)}
- */
- public static void clearFastBeanInfoCache() {
- synchronized (BEAN_INFO_CACHE_LOCK) {
- BEAN_INFO_CACHE.clear();
- }
- }
-
- /**
- * Get all properties from this class up to (and excluding) stopClazz
- *
- * @param filter
- * @throws IntrospectionException
- */
- public static FastPropertyDescriptor[] getFastPropertyDescriptors(Class<?> clazz, Class<?> stopClazz, IPropertyFilter filter) throws IntrospectionException {
- FastBeanInfo info = getFastBeanInfo(clazz, stopClazz);
- FastPropertyDescriptor[] a = info.getPropertyDescriptors();
- ArrayList<FastPropertyDescriptor> filteredProperties = new ArrayList<FastPropertyDescriptor>(a.length);
- for (int i = 0; i < a.length; i++) {
- FastPropertyDescriptor pd = a[i];
- if (filter != null && !(filter.accept(pd))) {
- // ignore it
- }
- else {
- filteredProperties.add(pd);
- }
- }
- return filteredProperties.toArray(new FastPropertyDescriptor[filteredProperties.size()]);
- }
-
- /**
- * Creates a new instance of the given class and init parameters. The constructor is derived from the parameter types.
- *
- * @param <T>
- * @param c
- * The class a new instance is created for.
- * @param parameterTypes
- * The parameter types used for determining the constructor used for creating the new instance.
- * @param parameters
- * The parameter objects the new instance is initialized with.
- * @return Returns a new instance of the given class or <code>null</code>, if no matching constructor can be found.
- * @throws ProcessingException
- * @since 3.8.1
- */
- public static <T> T createInstance(Class<T> c, Object... parameters) throws ProcessingException {
- if (parameters == null || parameters.length == 0) {
- return createInstance(c, null, null);
- }
- Class<?>[] parameterTypes = new Class<?>[parameters.length];
- for (int i = 0; i < parameters.length; i++) {
- if (parameters[i] != null) {
- parameterTypes[i] = parameters[i].getClass();
- }
- }
- return createInstance(c, parameterTypes, parameters);
- }
-
- /**
- * Creates a new instance of the given class using the constructor that matches the given parameter types. The
- * resulting object is initialized with the given parameters.
- *
- * @param <T>
- * @param c
- * The class a new instance is created for.
- * @param parameterTypes
- * The parameter types used for determining the constructor used for creating the new instance.
- * @param parameters
- * The parameter objects the new instance is initialized with.
- * @return Returns a new instance of the given class or <code>null</code>, if no matching constructor can be found.
- * @throws ProcessingException
- * @since 3.8.1
- */
- public static <T> T createInstance(Class<T> c, Class<?>[] parameterTypes, Object[] parameters) throws ProcessingException {
- Constructor<T> ctor = findConstructor(c, parameterTypes);
- if (ctor != null) {
- try {
- return ctor.newInstance(parameters);
- }
- catch (Throwable t) {
- if (LOG.isInfoEnabled()) {
- LOG.info("Exception while instantiating new object [class=" + c + ", parameterTypes=" + Arrays.toString(parameterTypes)
- + ", parameters=" + Arrays.toString(parameters) + "]", t);
- }
- throw new ProcessingException("Exception while instantiating new object", t);
- }
- }
- return null;
- }
-
- /**
- * Finds the best matching constructor in the given class having the given parameter types or superclasses of them.
- *
- * @param c
- * The class the constructor is searched for.
- * @param parameterTypes
- * A possibly empty varag list of required constructor parameter types.
- * @return Returns the exact constructor of the given class and the given list of parameter types, the best matching
- * one or <code>null</code>, if none can be found.
- * @throws ProcessingException
- * A {@link ProcessingException} is thrown if there are multiple constructors satisfying the given
- * constructor specification.
- * @since 3.8.1
- */
- public static <T> Constructor<T> findConstructor(Class<T> c, Class<?>... parameterTypes) throws ProcessingException {
- if (c == null) {
- return null;
- }
- // find exact constructor
- try {
- Constructor<T> ctor = c.getConstructor(parameterTypes);
- if (ctor != null) {
- return ctor;
- }
- }
- catch (NoSuchMethodException e) {
- LOG.debug("exact constructor does not exist");
- }
- // default constructor is not available
- if (parameterTypes == null || parameterTypes.length == 0) {
- return null;
- }
- // find best matching constructor
- TreeMap<Integer, Set<Constructor<T>>> candidates = new TreeMap<Integer, Set<Constructor<T>>>();
- for (Constructor<?> ctor : c.getConstructors()) {
- int distance = 0;
- Class<?>[] ctorParameters = ctor.getParameterTypes();
- if (ctorParameters.length == parameterTypes.length) {
- // check parameters
- for (int i = 0; i < parameterTypes.length; i++) {
- int currentParamDistance = computeTypeDistance(ctorParameters[i], parameterTypes[i]);
- if (currentParamDistance == -1 && parameterTypes[i] != null) {
- if (parameterTypes[i].isPrimitive()) {
- // try auto-boxing
- currentParamDistance = computeTypeDistance(ctorParameters[i], PRIMITIVE_COMPLEX_CLASS_MAP.get(parameterTypes[i]));
- }
- else if (COMPLEX_PRIMITIVE_CLASS_MAP.containsKey(parameterTypes[i])) {
- // try auto-unboxing
- currentParamDistance = computeTypeDistance(ctorParameters[i], COMPLEX_PRIMITIVE_CLASS_MAP.get(parameterTypes[i]));
- }
- }
- if (currentParamDistance == -1) {
- distance = -1;
- break;
- }
- distance += currentParamDistance;
- }
- if (distance >= 0) {
- // collect candidates
- @SuppressWarnings("unchecked")
- Constructor<T> candidate = (Constructor<T>) ctor;
- Set<Constructor<T>> rankedCtors = candidates.get(distance);
- if (rankedCtors == null) {
- rankedCtors = new HashSet<Constructor<T>>();
- candidates.put(distance, rankedCtors);
- }
- rankedCtors.add(candidate);
- }
- }
- }
- //
- if (candidates.isEmpty()) {
- return null;
- }
- // check ambiguity
- Set<Constructor<T>> ctors = candidates.firstEntry().getValue();
- if (ctors.isEmpty()) {
- return null;
- }
- if (ctors.size() == 1) {
- return CollectionUtility.firstElement(ctors);
- }
- throw new ProcessingException("More than one constructors found due to ambiguous parameter types [class=" + c + ", parameterTypes=" + Arrays.toString(parameterTypes) + "]");
- }
-
- /**
- * Computes the distance between the given two types.
- * <p/>
- * <table border="0" cellpadding="1" cellspacing="2">
- * <tr align="left">
- * <th align="left">Value</th>
- * <th align="left">Description</th>
- * </tr>
- * <tr>
- * <td align="center" valign="top">-1</td>
- * <td>the type distance cannot be computed. Possible problems are that the <code>declaredType</code> is not
- * assignable from the <code>actualType</code>.</td>
- * </tr>
- * <tr>
- * <td align="center" valign="top">0</td>
- * <td>perfect match (i.e. <code>declaredType == actualType</code>)</td>
- * </tr>
- * <tr>
- * <td align="center" valign="top">&gt;1 (<em>n</em>)</td>
- * <td>the <code>declaredType</code> is a superclass of <code>actualType</code>. The distance between the two types is
- * <em>n</em></td>
- * </tr>
- * </table>
- *
- * @param declaredType
- * The method parameter's declared type.
- * @param actualType
- * The type of the object used in the actual method invocation.
- * @return Returns -1 if the distance cannot be computed or the declared type is not assignable from the actual type.
- * It
- * returns 0 for a perfect match (i.e. <code>declaredType == actualType</code> and a number &gt;0 otherwise.
- * @since 3.8.1
- */
- public static int computeTypeDistance(Class<?> declaredType, Class<?> actualType) {
- if (declaredType == null) {
- return -1;
- }
- if (actualType == null) {
- // a null type is treated like a null-object method invocation. Hence the actualType null matches all parameter
- // types except primitive (since auto-unboxing would throw a NPE)
- return declaredType.isPrimitive() ? -1 : 0;
- }
- if (declaredType == actualType) {
- // perfect match
- return 0;
- }
- if (!declaredType.isAssignableFrom(actualType)) {
- // declaredType is not a superclass of actualType
- return -1;
- }
- // compute type distance
- // 1. collect super classes
- Class<?> superClass = actualType.getSuperclass();
- Class<?>[] interfaces = actualType.getInterfaces();
- Class<?>[] superClasses;
- if (superClass == null) {
- superClasses = interfaces;
- }
- else {
- superClasses = new Class<?>[interfaces.length + 1];
- superClasses[0] = superClass;
- System.arraycopy(interfaces, 0, superClasses, 1, interfaces.length);
- }
- // 2. compute minimal superclass distance by recursion
- int minSuperClassesDistance = -1;
- for (Class<?> c : superClasses) {
- int distance = computeTypeDistance(declaredType, c);
- if (distance == 0) {
- // super class is perfect parameter match
- minSuperClassesDistance = 0;
- break;
- }
- else if (distance > 0) {
- if (minSuperClassesDistance == -1) {
- minSuperClassesDistance = distance;
- }
- else {
- minSuperClassesDistance = Math.min(minSuperClassesDistance, distance);
- }
- }
- }
- // 3. evaluate result
- if (minSuperClassesDistance == -1) {
- return -1;
- }
- return minSuperClassesDistance + 1;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import java.beans.IntrospectionException;
+import java.beans.Introspector;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+
+import org.eclipse.scout.commons.beans.FastBeanInfo;
+import org.eclipse.scout.commons.beans.FastPropertyDescriptor;
+import org.eclipse.scout.commons.beans.IPropertyFilter;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+
+public final class BeanUtility {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(BeanUtility.class);
+
+ private static final Object BEAN_INFO_CACHE_LOCK;
+ private static final Map<CompositeObject/*Class,Class*/, FastBeanInfo> BEAN_INFO_CACHE;
+ private static final Map<Class, Class> PRIMITIVE_COMPLEX_CLASS_MAP;
+ private static final Map<Class, Class> COMPLEX_PRIMITIVE_CLASS_MAP;
+
+ static {
+ BEAN_INFO_CACHE_LOCK = new Object();
+ BEAN_INFO_CACHE = new HashMap<CompositeObject, FastBeanInfo>();
+ // primitive -> complex classes mappings
+ PRIMITIVE_COMPLEX_CLASS_MAP = new HashMap<Class, Class>();
+ PRIMITIVE_COMPLEX_CLASS_MAP.put(boolean.class, Boolean.class);
+ PRIMITIVE_COMPLEX_CLASS_MAP.put(byte.class, Byte.class);
+ PRIMITIVE_COMPLEX_CLASS_MAP.put(char.class, Character.class);
+ PRIMITIVE_COMPLEX_CLASS_MAP.put(short.class, Short.class);
+ PRIMITIVE_COMPLEX_CLASS_MAP.put(int.class, Integer.class);
+ PRIMITIVE_COMPLEX_CLASS_MAP.put(long.class, Long.class);
+ PRIMITIVE_COMPLEX_CLASS_MAP.put(float.class, Float.class);
+ PRIMITIVE_COMPLEX_CLASS_MAP.put(double.class, Double.class);
+ // complex -> primitive classes mappings
+ COMPLEX_PRIMITIVE_CLASS_MAP = new HashMap<Class, Class>();
+ for (Map.Entry<Class, Class> entry : PRIMITIVE_COMPLEX_CLASS_MAP.entrySet()) {
+ COMPLEX_PRIMITIVE_CLASS_MAP.put(entry.getValue(), entry.getKey());
+ }
+ }
+
+ private BeanUtility() {
+ }
+
+ /**
+ * @return all properties of from up to (and excluding) to stopClazz, filtering with filter
+ */
+ public static Map<String, Object> getProperties(Object from, Class<?> stopClazz, IPropertyFilter filter) throws ProcessingException {
+ HashMap<String, Object> map = new HashMap<String, Object>();
+ try {
+ FastPropertyDescriptor[] props = getFastPropertyDescriptors(from.getClass(), stopClazz, filter);
+ for (int i = 0; i < props.length; i++) {
+ FastPropertyDescriptor fromProp = props[i];
+ Method readMethod = fromProp.getReadMethod();
+ if (readMethod != null) {
+ Object value = readMethod.invoke(from, (Object[]) null);
+ map.put(fromProp.getName(), value);
+ }
+ }
+ }
+ catch (Exception e) {
+ throw new ProcessingException("object: " + from, e);
+ }
+ return map;
+ }
+
+ /**
+ * @param lenient
+ * true just logs warnings on exceptions, false throws exceptions
+ * set all properties on to, filtering with filter
+ */
+ public static void setProperties(Object to, Map<String, Object> map, boolean lenient, IPropertyFilter filter) throws ProcessingException {
+ FastBeanInfo toInfo = getFastBeanInfo(to.getClass(), null);
+ for (Iterator<Map.Entry<String, Object>> it = map.entrySet().iterator(); it.hasNext();) {
+ Map.Entry<String, Object> entry = it.next();
+ String name = entry.getKey();
+ Object value = entry.getValue();
+ try {
+ FastPropertyDescriptor desc = toInfo.getPropertyDescriptor(name);
+ if (desc != null && (filter == null || filter.accept(desc))) {
+ Method writeMethod = desc.getWriteMethod();
+ if (writeMethod != null) {
+ writeMethod.invoke(to, new Object[]{TypeCastUtility.castValue(value, writeMethod.getParameterTypes()[0])});
+ }
+ }
+ }
+ catch (Exception e) {
+ if (lenient) {
+ LOG.warn("property " + name + " with value " + value, e);
+ }
+ else {
+ throw new ProcessingException("property " + name + " with value " + value, e);
+ }
+ }
+ }
+ }
+
+ /**
+ * Get all property descriptors from this class up to (and excluding) stopClazz
+ * <p>
+ * Getting bean properties using {@link Introspector} can be very slow and time consuming.
+ * <p>
+ * This hi-speed property introspector only inspects bean names, types and read/write methods.
+ * <p>
+ * The results are cached for further speed optimization.
+ */
+ public static FastBeanInfo getFastBeanInfo(Class<?> beanClass, Class<?> stopClass) {
+ if (beanClass == null) {
+ return new FastBeanInfo(beanClass, stopClass);
+ }
+ synchronized (BEAN_INFO_CACHE_LOCK) {
+ CompositeObject key = new CompositeObject(beanClass, stopClass);
+ FastBeanInfo info = BEAN_INFO_CACHE.get(key);
+ if (info == null) {
+ info = new FastBeanInfo(beanClass, stopClass);
+ BEAN_INFO_CACHE.put(key, info);
+ }
+ return info;
+ }
+ }
+
+ /**
+ * Clear the cache used by {@link #getBeanInfoEx(Class, Class)}
+ */
+ public static void clearFastBeanInfoCache() {
+ synchronized (BEAN_INFO_CACHE_LOCK) {
+ BEAN_INFO_CACHE.clear();
+ }
+ }
+
+ /**
+ * Get all properties from this class up to (and excluding) stopClazz
+ *
+ * @param filter
+ * @throws IntrospectionException
+ */
+ public static FastPropertyDescriptor[] getFastPropertyDescriptors(Class<?> clazz, Class<?> stopClazz, IPropertyFilter filter) throws IntrospectionException {
+ FastBeanInfo info = getFastBeanInfo(clazz, stopClazz);
+ FastPropertyDescriptor[] a = info.getPropertyDescriptors();
+ ArrayList<FastPropertyDescriptor> filteredProperties = new ArrayList<FastPropertyDescriptor>(a.length);
+ for (int i = 0; i < a.length; i++) {
+ FastPropertyDescriptor pd = a[i];
+ if (filter != null && !(filter.accept(pd))) {
+ // ignore it
+ }
+ else {
+ filteredProperties.add(pd);
+ }
+ }
+ return filteredProperties.toArray(new FastPropertyDescriptor[filteredProperties.size()]);
+ }
+
+ /**
+ * Creates a new instance of the given class and init parameters. The constructor is derived from the parameter types.
+ *
+ * @param <T>
+ * @param c
+ * The class a new instance is created for.
+ * @param parameterTypes
+ * The parameter types used for determining the constructor used for creating the new instance.
+ * @param parameters
+ * The parameter objects the new instance is initialized with.
+ * @return Returns a new instance of the given class or <code>null</code>, if no matching constructor can be found.
+ * @throws ProcessingException
+ * @since 3.8.1
+ */
+ public static <T> T createInstance(Class<T> c, Object... parameters) throws ProcessingException {
+ if (parameters == null || parameters.length == 0) {
+ return createInstance(c, null, null);
+ }
+ Class<?>[] parameterTypes = new Class<?>[parameters.length];
+ for (int i = 0; i < parameters.length; i++) {
+ if (parameters[i] != null) {
+ parameterTypes[i] = parameters[i].getClass();
+ }
+ }
+ return createInstance(c, parameterTypes, parameters);
+ }
+
+ /**
+ * Creates a new instance of the given class using the constructor that matches the given parameter types. The
+ * resulting object is initialized with the given parameters.
+ *
+ * @param <T>
+ * @param c
+ * The class a new instance is created for.
+ * @param parameterTypes
+ * The parameter types used for determining the constructor used for creating the new instance.
+ * @param parameters
+ * The parameter objects the new instance is initialized with.
+ * @return Returns a new instance of the given class or <code>null</code>, if no matching constructor can be found.
+ * @throws ProcessingException
+ * @since 3.8.1
+ */
+ public static <T> T createInstance(Class<T> c, Class<?>[] parameterTypes, Object[] parameters) throws ProcessingException {
+ Constructor<T> ctor = findConstructor(c, parameterTypes);
+ if (ctor != null) {
+ try {
+ return ctor.newInstance(parameters);
+ }
+ catch (Throwable t) {
+ if (LOG.isInfoEnabled()) {
+ LOG.info("Exception while instantiating new object [class=" + c + ", parameterTypes=" + Arrays.toString(parameterTypes)
+ + ", parameters=" + Arrays.toString(parameters) + "]", t);
+ }
+ throw new ProcessingException("Exception while instantiating new object", t);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Finds the best matching constructor in the given class having the given parameter types or superclasses of them.
+ *
+ * @param c
+ * The class the constructor is searched for.
+ * @param parameterTypes
+ * A possibly empty varag list of required constructor parameter types.
+ * @return Returns the exact constructor of the given class and the given list of parameter types, the best matching
+ * one or <code>null</code>, if none can be found.
+ * @throws ProcessingException
+ * A {@link ProcessingException} is thrown if there are multiple constructors satisfying the given
+ * constructor specification.
+ * @since 3.8.1
+ */
+ public static <T> Constructor<T> findConstructor(Class<T> c, Class<?>... parameterTypes) throws ProcessingException {
+ if (c == null) {
+ return null;
+ }
+ // find exact constructor
+ try {
+ Constructor<T> ctor = c.getConstructor(parameterTypes);
+ if (ctor != null) {
+ return ctor;
+ }
+ }
+ catch (NoSuchMethodException e) {
+ LOG.debug("exact constructor does not exist");
+ }
+ // default constructor is not available
+ if (parameterTypes == null || parameterTypes.length == 0) {
+ return null;
+ }
+ // find best matching constructor
+ TreeMap<Integer, Set<Constructor<T>>> candidates = new TreeMap<Integer, Set<Constructor<T>>>();
+ for (Constructor<?> ctor : c.getConstructors()) {
+ int distance = 0;
+ Class<?>[] ctorParameters = ctor.getParameterTypes();
+ if (ctorParameters.length == parameterTypes.length) {
+ // check parameters
+ for (int i = 0; i < parameterTypes.length; i++) {
+ int currentParamDistance = computeTypeDistance(ctorParameters[i], parameterTypes[i]);
+ if (currentParamDistance == -1 && parameterTypes[i] != null) {
+ if (parameterTypes[i].isPrimitive()) {
+ // try auto-boxing
+ currentParamDistance = computeTypeDistance(ctorParameters[i], PRIMITIVE_COMPLEX_CLASS_MAP.get(parameterTypes[i]));
+ }
+ else if (COMPLEX_PRIMITIVE_CLASS_MAP.containsKey(parameterTypes[i])) {
+ // try auto-unboxing
+ currentParamDistance = computeTypeDistance(ctorParameters[i], COMPLEX_PRIMITIVE_CLASS_MAP.get(parameterTypes[i]));
+ }
+ }
+ if (currentParamDistance == -1) {
+ distance = -1;
+ break;
+ }
+ distance += currentParamDistance;
+ }
+ if (distance >= 0) {
+ // collect candidates
+ @SuppressWarnings("unchecked")
+ Constructor<T> candidate = (Constructor<T>) ctor;
+ Set<Constructor<T>> rankedCtors = candidates.get(distance);
+ if (rankedCtors == null) {
+ rankedCtors = new HashSet<Constructor<T>>();
+ candidates.put(distance, rankedCtors);
+ }
+ rankedCtors.add(candidate);
+ }
+ }
+ }
+ //
+ if (candidates.isEmpty()) {
+ return null;
+ }
+ // check ambiguity
+ Set<Constructor<T>> ctors = candidates.firstEntry().getValue();
+ if (ctors.isEmpty()) {
+ return null;
+ }
+ if (ctors.size() == 1) {
+ return CollectionUtility.firstElement(ctors);
+ }
+ throw new ProcessingException("More than one constructors found due to ambiguous parameter types [class=" + c + ", parameterTypes=" + Arrays.toString(parameterTypes) + "]");
+ }
+
+ /**
+ * Computes the distance between the given two types.
+ * <p/>
+ * <table border="0" cellpadding="1" cellspacing="2">
+ * <tr align="left">
+ * <th align="left">Value</th>
+ * <th align="left">Description</th>
+ * </tr>
+ * <tr>
+ * <td align="center" valign="top">-1</td>
+ * <td>the type distance cannot be computed. Possible problems are that the <code>declaredType</code> is not
+ * assignable from the <code>actualType</code>.</td>
+ * </tr>
+ * <tr>
+ * <td align="center" valign="top">0</td>
+ * <td>perfect match (i.e. <code>declaredType == actualType</code>)</td>
+ * </tr>
+ * <tr>
+ * <td align="center" valign="top">&gt;1 (<em>n</em>)</td>
+ * <td>the <code>declaredType</code> is a superclass of <code>actualType</code>. The distance between the two types is
+ * <em>n</em></td>
+ * </tr>
+ * </table>
+ *
+ * @param declaredType
+ * The method parameter's declared type.
+ * @param actualType
+ * The type of the object used in the actual method invocation.
+ * @return Returns -1 if the distance cannot be computed or the declared type is not assignable from the actual type.
+ * It
+ * returns 0 for a perfect match (i.e. <code>declaredType == actualType</code> and a number &gt;0 otherwise.
+ * @since 3.8.1
+ */
+ public static int computeTypeDistance(Class<?> declaredType, Class<?> actualType) {
+ if (declaredType == null) {
+ return -1;
+ }
+ if (actualType == null) {
+ // a null type is treated like a null-object method invocation. Hence the actualType null matches all parameter
+ // types except primitive (since auto-unboxing would throw a NPE)
+ return declaredType.isPrimitive() ? -1 : 0;
+ }
+ if (declaredType == actualType) {
+ // perfect match
+ return 0;
+ }
+ if (!declaredType.isAssignableFrom(actualType)) {
+ // declaredType is not a superclass of actualType
+ return -1;
+ }
+ // compute type distance
+ // 1. collect super classes
+ Class<?> superClass = actualType.getSuperclass();
+ Class<?>[] interfaces = actualType.getInterfaces();
+ Class<?>[] superClasses;
+ if (superClass == null) {
+ superClasses = interfaces;
+ }
+ else {
+ superClasses = new Class<?>[interfaces.length + 1];
+ superClasses[0] = superClass;
+ System.arraycopy(interfaces, 0, superClasses, 1, interfaces.length);
+ }
+ // 2. compute minimal superclass distance by recursion
+ int minSuperClassesDistance = -1;
+ for (Class<?> c : superClasses) {
+ int distance = computeTypeDistance(declaredType, c);
+ if (distance == 0) {
+ // super class is perfect parameter match
+ minSuperClassesDistance = 0;
+ break;
+ }
+ else if (distance > 0) {
+ if (minSuperClassesDistance == -1) {
+ minSuperClassesDistance = distance;
+ }
+ else {
+ minSuperClassesDistance = Math.min(minSuperClassesDistance, distance);
+ }
+ }
+ }
+ // 3. evaluate result
+ if (minSuperClassesDistance == -1) {
+ return -1;
+ }
+ return minSuperClassesDistance + 1;
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/BooleanUtility.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/BooleanUtility.java
index 06a6fc1445..f207eb6e6f 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/BooleanUtility.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/BooleanUtility.java
@@ -1,34 +1,34 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-/**
- * Title: BSI Scout V3 Copyright:
- *
- * @version 3.x
- */
-
-public final class BooleanUtility {
-
- private BooleanUtility() {
- }
-
- public static boolean nvl(Boolean b) {
- return nvl(b, false);
- }
-
- public static boolean nvl(Boolean b, boolean defaultValue) {
- if (b == null) {
- return defaultValue;
- }
- return b.booleanValue();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+/**
+ * Title: BSI Scout V3 Copyright:
+ *
+ * @version 3.x
+ */
+
+public final class BooleanUtility {
+
+ private BooleanUtility() {
+ }
+
+ public static boolean nvl(Boolean b) {
+ return nvl(b, false);
+ }
+
+ public static boolean nvl(Boolean b, boolean defaultValue) {
+ if (b == null) {
+ return defaultValue;
+ }
+ return b.booleanValue();
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/BundleContextUtility.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/BundleContextUtility.java
index f02df14c96..b8b59d9b9c 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/BundleContextUtility.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/BundleContextUtility.java
@@ -1,78 +1,78 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import java.io.File;
-import java.net.URL;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.scout.commons.internal.Activator;
-import org.osgi.framework.BundleContext;
-
-/**
- * Utility to replace ${name} variables in strings. The values are retrieved
- * using {@link BundleContext#getProperty(String)}
- */
-public final class BundleContextUtility {
- private static final Pattern VARIABLE_PATTERN = Pattern.compile("\\$\\{([^\\}]+)\\}");
-
- private BundleContextUtility() {
- }
-
- /**
- * @return s with all variables ${...} resolved using {@link BundleContext#getProperty(String)} One special variable
- * is
- * included: ${workspace_loc} is the workspace location when running
- * in development mode, and it is only supported in {@link Platform#inDevelopmentMode()}
- */
- public static String resolve(String s) {
- if (s == null || s.length() == 0) {
- return s;
- }
- String t = s;
- Matcher m = VARIABLE_PATTERN.matcher(t);
- while (m.find()) {
- String key = m.group(1);
- String value = null;
- if (key.equals("workspace_loc")) {
- if (!Platform.inDevelopmentMode()) {
- if (value == null) {
- throw new IllegalArgumentException("resolving expression \"" + s + "\": variable ${" + key + "} is not supported in production mode");
- }
- }
- try {
- String dev = new URL(Activator.getDefault().getBundle().getBundleContext().getProperty("osgi.dev")).getFile();
- value = new File(dev.substring(0, dev.indexOf("/.metadata/"))).getAbsolutePath();
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- }
- else {
- value = Activator.getDefault().getBundle().getBundleContext().getProperty(key);
- try {
- value = new File(new URL(value).getFile()).getAbsolutePath();
- }
- catch (Exception e) {
- }
- }
- if (value == null) {
- throw new IllegalArgumentException("resolving expression \"" + s + "\": variable ${" + key + "} is not defined in the bundle context");
- }
- t = t.substring(0, m.start()) + value + t.substring(m.end());
- // next
- m = VARIABLE_PATTERN.matcher(t);
- }
- return t;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import java.io.File;
+import java.net.URL;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.scout.commons.internal.Activator;
+import org.osgi.framework.BundleContext;
+
+/**
+ * Utility to replace ${name} variables in strings. The values are retrieved
+ * using {@link BundleContext#getProperty(String)}
+ */
+public final class BundleContextUtility {
+ private static final Pattern VARIABLE_PATTERN = Pattern.compile("\\$\\{([^\\}]+)\\}");
+
+ private BundleContextUtility() {
+ }
+
+ /**
+ * @return s with all variables ${...} resolved using {@link BundleContext#getProperty(String)} One special variable
+ * is
+ * included: ${workspace_loc} is the workspace location when running
+ * in development mode, and it is only supported in {@link Platform#inDevelopmentMode()}
+ */
+ public static String resolve(String s) {
+ if (s == null || s.length() == 0) {
+ return s;
+ }
+ String t = s;
+ Matcher m = VARIABLE_PATTERN.matcher(t);
+ while (m.find()) {
+ String key = m.group(1);
+ String value = null;
+ if (key.equals("workspace_loc")) {
+ if (!Platform.inDevelopmentMode()) {
+ if (value == null) {
+ throw new IllegalArgumentException("resolving expression \"" + s + "\": variable ${" + key + "} is not supported in production mode");
+ }
+ }
+ try {
+ String dev = new URL(Activator.getDefault().getBundle().getBundleContext().getProperty("osgi.dev")).getFile();
+ value = new File(dev.substring(0, dev.indexOf("/.metadata/"))).getAbsolutePath();
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ else {
+ value = Activator.getDefault().getBundle().getBundleContext().getProperty(key);
+ try {
+ value = new File(new URL(value).getFile()).getAbsolutePath();
+ }
+ catch (Exception e) {
+ }
+ }
+ if (value == null) {
+ throw new IllegalArgumentException("resolving expression \"" + s + "\": variable ${" + key + "} is not defined in the bundle context");
+ }
+ t = t.substring(0, m.start()) + value + t.substring(m.end());
+ // next
+ m = VARIABLE_PATTERN.matcher(t);
+ }
+ return t;
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/CSSPatch.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/CSSPatch.java
index 0693d5cd47..af0ab69a88 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/CSSPatch.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/CSSPatch.java
@@ -1,224 +1,224 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.util.Hashtable;
-
-import javax.swing.text.StyleContext;
-import javax.swing.text.html.CSS;
-import javax.swing.text.html.CSS.Attribute;
-
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-
-/**
- * Patch for CSS class. The patch is applied as soon as this class is accessed.
- */
-public final class CSSPatch {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(CSSPatch.class);
-
- private CSSPatch() {
- }
-
- public static final Attribute AZIMUTH = createAttribute("azimuth", null, false);
- public static final Attribute BORDER_BOTTOM_COLOR = createAttribute("border-bottom-color", null, false);
- public static final Attribute BORDER_BOTTOM_STYLE = createAttribute("border-bottom-style", null, false);
- public static final Attribute BORDER_COLLAPSE = createAttribute("border-collapse", null, false);
- public static final Attribute BORDER_LEFT_COLOR = createAttribute("border-left-color", null, false);
- public static final Attribute BORDER_LEFT_STYLE = createAttribute("border-left-style", null, false);
- public static final Attribute BORDER_RIGHT_COLOR = createAttribute("border-right-color", null, false);
- public static final Attribute BORDER_RIGHT_STYLE = createAttribute("border-right-style", null, false);
- public static final Attribute BORDER_SPACING = createAttribute("border-spacing", null, false);
- public static final Attribute BORDER_TOP_COLOR = createAttribute("border-top-color", null, false);
- public static final Attribute BORDER_TOP_STYLE = createAttribute("border-top-style", null, false);
- public static final Attribute BOTTOM = createAttribute("bottom", null, false);
- public static final Attribute CAPTION_SIDE = createAttribute("caption-side", null, false);
- public static final Attribute CLIP = createAttribute("clip", null, false);
- public static final Attribute CONTENT = createAttribute("content", null, false);
- public static final Attribute COUNTER_INCREMENT = createAttribute("counter-increment", null, false);
- public static final Attribute COUNTER_RESET = createAttribute("counter-reset", null, false);
- public static final Attribute CUE = createAttribute("cue", null, false);
- public static final Attribute CUE_AFTER = createAttribute("cue-after", null, false);
- public static final Attribute CUE_BEFORE = createAttribute("cue-before", null, false);
- public static final Attribute CURSOR = createAttribute("cursor", null, false);
- public static final Attribute DIRECTION = createAttribute("direction", null, false);
- public static final Attribute ELEVATION = createAttribute("elevation", null, false);
- public static final Attribute EMPTY_CELLS = createAttribute("empty-cells", null, false);
- public static final Attribute LEFT = createAttribute("left", null, false);
- public static final Attribute MAX_HEIGHT = createAttribute("max-height", null, false);
- public static final Attribute MAX_WIDTH = createAttribute("max-width", null, false);
- public static final Attribute MIN_HEIGHT = createAttribute("min-height", null, false);
- public static final Attribute MIN_WIDTH = createAttribute("min-width", null, false);
- public static final Attribute ORPHANS = createAttribute("orphans", null, false);
- public static final Attribute OUTLINE = createAttribute("outline", null, false);
- public static final Attribute OUTLINE_COLOR = createAttribute("outline-color", null, false);
- public static final Attribute OUTLINE_STYLE = createAttribute("outline-style", null, false);
- public static final Attribute OUTLINE_WIDTH = createAttribute("outline-width", null, false);
- public static final Attribute OVERFLOW = createAttribute("overflow", null, false);
- public static final Attribute PAGE_BREAK_AFTER = createAttribute("page-break-after", null, false);
- public static final Attribute PAGE_BREAK_BEFORE = createAttribute("page-break-before", null, false);
- public static final Attribute PAGE_BREAK_INSIDE = createAttribute("page-break-inside", null, false);
- public static final Attribute PAUSE = createAttribute("pause", null, false);
- public static final Attribute PAUSE_AFTER = createAttribute("pause-after", null, false);
- public static final Attribute PAUSE_BEFORE = createAttribute("pause-before", null, false);
- public static final Attribute PITCH = createAttribute("pitch", null, false);
- public static final Attribute PITCH_RANGE = createAttribute("pitch-range", null, false);
- public static final Attribute PLAY_DURING = createAttribute("play-during", null, false);
- public static final Attribute POSITION = createAttribute("position", null, false);
- public static final Attribute QUOTES = createAttribute("quotes", null, false);
- public static final Attribute RICHNESS = createAttribute("richness", null, false);
- public static final Attribute RIGHT = createAttribute("right", null, false);
- public static final Attribute SPEAK = createAttribute("speak", null, false);
- public static final Attribute SPEAK_HEADER = createAttribute("speak-header", null, false);
- public static final Attribute SPEAK_NUMERAL = createAttribute("speak-numeral", null, false);
- public static final Attribute SPEAK_PUNCTUATION = createAttribute("speak-punctuation", null, false);
- public static final Attribute SPEECH_RATE = createAttribute("speech-rate", null, false);
- public static final Attribute STRESS = createAttribute("stress", null, false);
- public static final Attribute TABLE_LAYOUT = createAttribute("table-layout", null, false);
- public static final Attribute TOP = createAttribute("top", null, false);
- public static final Attribute UNICODE_BIDI = createAttribute("unicode-bidi", null, false);
- public static final Attribute VISIBILITY = createAttribute("visibility", null, false);
- public static final Attribute VOICE_FAMILY = createAttribute("voice-family", null, false);
- public static final Attribute VOLUME = createAttribute("volume", null, false);
- public static final Attribute WIDOWS = createAttribute("widows", null, false);
- public static final Attribute Z_INDEX = createAttribute("z-index", null, false);
-
- public static void apply() {
- //dummy method to kick class initialization
- }
-
- static {
- try {
- patchCSSClass();
- }
- catch (Throwable t) {
- LOG.error("Failed patching CSS class", t);
- }
- }
-
- @SuppressWarnings("unchecked")
- private static void patchCSSClass() throws Throwable {
- Attribute[] additionalAttributes = new Attribute[]{
- AZIMUTH,
- BORDER_BOTTOM_COLOR,
- BORDER_BOTTOM_STYLE,
- BORDER_COLLAPSE,
- BORDER_LEFT_COLOR,
- BORDER_LEFT_STYLE,
- BORDER_RIGHT_COLOR,
- BORDER_RIGHT_STYLE,
- BORDER_SPACING,
- BORDER_TOP_COLOR,
- BORDER_TOP_STYLE,
- BOTTOM,
- CAPTION_SIDE,
- CLIP,
- CONTENT,
- COUNTER_INCREMENT,
- COUNTER_RESET,
- CUE,
- CUE_AFTER,
- CUE_BEFORE,
- CURSOR,
- DIRECTION,
- ELEVATION,
- EMPTY_CELLS,
- LEFT,
- MAX_HEIGHT,
- MAX_WIDTH,
- MIN_HEIGHT,
- MIN_WIDTH,
- ORPHANS,
- OUTLINE,
- OUTLINE_COLOR,
- OUTLINE_STYLE,
- OUTLINE_WIDTH,
- OVERFLOW,
- PAGE_BREAK_AFTER,
- PAGE_BREAK_BEFORE,
- PAGE_BREAK_INSIDE,
- PAUSE,
- PAUSE_AFTER,
- PAUSE_BEFORE,
- PITCH,
- PITCH_RANGE,
- PLAY_DURING,
- POSITION,
- QUOTES,
- RICHNESS,
- RIGHT,
- SPEAK,
- SPEAK_HEADER,
- SPEAK_NUMERAL,
- SPEAK_PUNCTUATION,
- SPEECH_RATE,
- STRESS,
- TABLE_LAYOUT,
- TOP,
- UNICODE_BIDI,
- VISIBILITY,
- VOICE_FAMILY,
- VOLUME,
- WIDOWS,
- Z_INDEX,
- };
- for (Attribute key : additionalAttributes) {
- if (key == null) {
- throw new Exception("Attribute is null");
- }
- }
- //extends CSS.Attribute.allAttributes
- Field f = Attribute.class.getDeclaredField("allAttributes");
- ReflectionUtility.removeFinalFlagOnField(f);
- f.setAccessible(true);
- Attribute[] allAttributes = (Attribute[]) f.get(null);
- Attribute[] newArray = new Attribute[allAttributes.length + additionalAttributes.length];
- System.arraycopy(allAttributes, 0, newArray, 0, allAttributes.length);
- System.arraycopy(additionalAttributes, 0, newArray, allAttributes.length, additionalAttributes.length);
- f.set(null, newArray);
- //extends CSS.attributeMap
- f = CSS.class.getDeclaredField("attributeMap");
- f.setAccessible(true);
- Hashtable attributeMap = (Hashtable) f.get(null);
- for (Attribute key : additionalAttributes) {
- attributeMap.put(key.toString(), key);
- }
- //extends StyleContext
- for (Attribute key : additionalAttributes) {
- try {
- StyleContext.registerStaticAttributeKey(key);
- }
- catch (Throwable t) {
- LOG.error("Failed registering CSS.Attribute '" + key + "' on StyleContext", t);
- }
- }
- }
-
- private static Attribute createAttribute(String s1, String s2, boolean b) {
- try {
- Constructor<Attribute> c = Attribute.class.getDeclaredConstructor(String.class, String.class, boolean.class);
- c.setAccessible(true);
- return c.newInstance(s1, s2, b);
- }
- catch (Throwable t) {
- LOG.error("Failed patching CSS by adding key '" + s1 + "'", t);
- return null;
- }
- }
-
- private static Object createCssValue() throws Exception {
- Constructor<?> c = Class.forName(CSS.class.getName() + "$CssValue", true, CSS.class.getClassLoader()).getDeclaredConstructor();
- c.setAccessible(true);
- return c.newInstance();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.util.Hashtable;
+
+import javax.swing.text.StyleContext;
+import javax.swing.text.html.CSS;
+import javax.swing.text.html.CSS.Attribute;
+
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+
+/**
+ * Patch for CSS class. The patch is applied as soon as this class is accessed.
+ */
+public final class CSSPatch {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(CSSPatch.class);
+
+ private CSSPatch() {
+ }
+
+ public static final Attribute AZIMUTH = createAttribute("azimuth", null, false);
+ public static final Attribute BORDER_BOTTOM_COLOR = createAttribute("border-bottom-color", null, false);
+ public static final Attribute BORDER_BOTTOM_STYLE = createAttribute("border-bottom-style", null, false);
+ public static final Attribute BORDER_COLLAPSE = createAttribute("border-collapse", null, false);
+ public static final Attribute BORDER_LEFT_COLOR = createAttribute("border-left-color", null, false);
+ public static final Attribute BORDER_LEFT_STYLE = createAttribute("border-left-style", null, false);
+ public static final Attribute BORDER_RIGHT_COLOR = createAttribute("border-right-color", null, false);
+ public static final Attribute BORDER_RIGHT_STYLE = createAttribute("border-right-style", null, false);
+ public static final Attribute BORDER_SPACING = createAttribute("border-spacing", null, false);
+ public static final Attribute BORDER_TOP_COLOR = createAttribute("border-top-color", null, false);
+ public static final Attribute BORDER_TOP_STYLE = createAttribute("border-top-style", null, false);
+ public static final Attribute BOTTOM = createAttribute("bottom", null, false);
+ public static final Attribute CAPTION_SIDE = createAttribute("caption-side", null, false);
+ public static final Attribute CLIP = createAttribute("clip", null, false);
+ public static final Attribute CONTENT = createAttribute("content", null, false);
+ public static final Attribute COUNTER_INCREMENT = createAttribute("counter-increment", null, false);
+ public static final Attribute COUNTER_RESET = createAttribute("counter-reset", null, false);
+ public static final Attribute CUE = createAttribute("cue", null, false);
+ public static final Attribute CUE_AFTER = createAttribute("cue-after", null, false);
+ public static final Attribute CUE_BEFORE = createAttribute("cue-before", null, false);
+ public static final Attribute CURSOR = createAttribute("cursor", null, false);
+ public static final Attribute DIRECTION = createAttribute("direction", null, false);
+ public static final Attribute ELEVATION = createAttribute("elevation", null, false);
+ public static final Attribute EMPTY_CELLS = createAttribute("empty-cells", null, false);
+ public static final Attribute LEFT = createAttribute("left", null, false);
+ public static final Attribute MAX_HEIGHT = createAttribute("max-height", null, false);
+ public static final Attribute MAX_WIDTH = createAttribute("max-width", null, false);
+ public static final Attribute MIN_HEIGHT = createAttribute("min-height", null, false);
+ public static final Attribute MIN_WIDTH = createAttribute("min-width", null, false);
+ public static final Attribute ORPHANS = createAttribute("orphans", null, false);
+ public static final Attribute OUTLINE = createAttribute("outline", null, false);
+ public static final Attribute OUTLINE_COLOR = createAttribute("outline-color", null, false);
+ public static final Attribute OUTLINE_STYLE = createAttribute("outline-style", null, false);
+ public static final Attribute OUTLINE_WIDTH = createAttribute("outline-width", null, false);
+ public static final Attribute OVERFLOW = createAttribute("overflow", null, false);
+ public static final Attribute PAGE_BREAK_AFTER = createAttribute("page-break-after", null, false);
+ public static final Attribute PAGE_BREAK_BEFORE = createAttribute("page-break-before", null, false);
+ public static final Attribute PAGE_BREAK_INSIDE = createAttribute("page-break-inside", null, false);
+ public static final Attribute PAUSE = createAttribute("pause", null, false);
+ public static final Attribute PAUSE_AFTER = createAttribute("pause-after", null, false);
+ public static final Attribute PAUSE_BEFORE = createAttribute("pause-before", null, false);
+ public static final Attribute PITCH = createAttribute("pitch", null, false);
+ public static final Attribute PITCH_RANGE = createAttribute("pitch-range", null, false);
+ public static final Attribute PLAY_DURING = createAttribute("play-during", null, false);
+ public static final Attribute POSITION = createAttribute("position", null, false);
+ public static final Attribute QUOTES = createAttribute("quotes", null, false);
+ public static final Attribute RICHNESS = createAttribute("richness", null, false);
+ public static final Attribute RIGHT = createAttribute("right", null, false);
+ public static final Attribute SPEAK = createAttribute("speak", null, false);
+ public static final Attribute SPEAK_HEADER = createAttribute("speak-header", null, false);
+ public static final Attribute SPEAK_NUMERAL = createAttribute("speak-numeral", null, false);
+ public static final Attribute SPEAK_PUNCTUATION = createAttribute("speak-punctuation", null, false);
+ public static final Attribute SPEECH_RATE = createAttribute("speech-rate", null, false);
+ public static final Attribute STRESS = createAttribute("stress", null, false);
+ public static final Attribute TABLE_LAYOUT = createAttribute("table-layout", null, false);
+ public static final Attribute TOP = createAttribute("top", null, false);
+ public static final Attribute UNICODE_BIDI = createAttribute("unicode-bidi", null, false);
+ public static final Attribute VISIBILITY = createAttribute("visibility", null, false);
+ public static final Attribute VOICE_FAMILY = createAttribute("voice-family", null, false);
+ public static final Attribute VOLUME = createAttribute("volume", null, false);
+ public static final Attribute WIDOWS = createAttribute("widows", null, false);
+ public static final Attribute Z_INDEX = createAttribute("z-index", null, false);
+
+ public static void apply() {
+ //dummy method to kick class initialization
+ }
+
+ static {
+ try {
+ patchCSSClass();
+ }
+ catch (Throwable t) {
+ LOG.error("Failed patching CSS class", t);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private static void patchCSSClass() throws Throwable {
+ Attribute[] additionalAttributes = new Attribute[]{
+ AZIMUTH,
+ BORDER_BOTTOM_COLOR,
+ BORDER_BOTTOM_STYLE,
+ BORDER_COLLAPSE,
+ BORDER_LEFT_COLOR,
+ BORDER_LEFT_STYLE,
+ BORDER_RIGHT_COLOR,
+ BORDER_RIGHT_STYLE,
+ BORDER_SPACING,
+ BORDER_TOP_COLOR,
+ BORDER_TOP_STYLE,
+ BOTTOM,
+ CAPTION_SIDE,
+ CLIP,
+ CONTENT,
+ COUNTER_INCREMENT,
+ COUNTER_RESET,
+ CUE,
+ CUE_AFTER,
+ CUE_BEFORE,
+ CURSOR,
+ DIRECTION,
+ ELEVATION,
+ EMPTY_CELLS,
+ LEFT,
+ MAX_HEIGHT,
+ MAX_WIDTH,
+ MIN_HEIGHT,
+ MIN_WIDTH,
+ ORPHANS,
+ OUTLINE,
+ OUTLINE_COLOR,
+ OUTLINE_STYLE,
+ OUTLINE_WIDTH,
+ OVERFLOW,
+ PAGE_BREAK_AFTER,
+ PAGE_BREAK_BEFORE,
+ PAGE_BREAK_INSIDE,
+ PAUSE,
+ PAUSE_AFTER,
+ PAUSE_BEFORE,
+ PITCH,
+ PITCH_RANGE,
+ PLAY_DURING,
+ POSITION,
+ QUOTES,
+ RICHNESS,
+ RIGHT,
+ SPEAK,
+ SPEAK_HEADER,
+ SPEAK_NUMERAL,
+ SPEAK_PUNCTUATION,
+ SPEECH_RATE,
+ STRESS,
+ TABLE_LAYOUT,
+ TOP,
+ UNICODE_BIDI,
+ VISIBILITY,
+ VOICE_FAMILY,
+ VOLUME,
+ WIDOWS,
+ Z_INDEX,
+ };
+ for (Attribute key : additionalAttributes) {
+ if (key == null) {
+ throw new Exception("Attribute is null");
+ }
+ }
+ //extends CSS.Attribute.allAttributes
+ Field f = Attribute.class.getDeclaredField("allAttributes");
+ ReflectionUtility.removeFinalFlagOnField(f);
+ f.setAccessible(true);
+ Attribute[] allAttributes = (Attribute[]) f.get(null);
+ Attribute[] newArray = new Attribute[allAttributes.length + additionalAttributes.length];
+ System.arraycopy(allAttributes, 0, newArray, 0, allAttributes.length);
+ System.arraycopy(additionalAttributes, 0, newArray, allAttributes.length, additionalAttributes.length);
+ f.set(null, newArray);
+ //extends CSS.attributeMap
+ f = CSS.class.getDeclaredField("attributeMap");
+ f.setAccessible(true);
+ Hashtable attributeMap = (Hashtable) f.get(null);
+ for (Attribute key : additionalAttributes) {
+ attributeMap.put(key.toString(), key);
+ }
+ //extends StyleContext
+ for (Attribute key : additionalAttributes) {
+ try {
+ StyleContext.registerStaticAttributeKey(key);
+ }
+ catch (Throwable t) {
+ LOG.error("Failed registering CSS.Attribute '" + key + "' on StyleContext", t);
+ }
+ }
+ }
+
+ private static Attribute createAttribute(String s1, String s2, boolean b) {
+ try {
+ Constructor<Attribute> c = Attribute.class.getDeclaredConstructor(String.class, String.class, boolean.class);
+ c.setAccessible(true);
+ return c.newInstance(s1, s2, b);
+ }
+ catch (Throwable t) {
+ LOG.error("Failed patching CSS by adding key '" + s1 + "'", t);
+ return null;
+ }
+ }
+
+ private static Object createCssValue() throws Exception {
+ Constructor<?> c = Class.forName(CSS.class.getName() + "$CssValue", true, CSS.class.getClassLoader()).getDeclaredConstructor();
+ c.setAccessible(true);
+ return c.newInstance();
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/CellRange.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/CellRange.java
index fdcbcabcdd..b046962c1f 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/CellRange.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/CellRange.java
@@ -1,236 +1,236 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import java.io.Serializable;
-
-public class CellRange implements Serializable {
- private static final long serialVersionUID = 1L;
-
- private int m_row1, m_col1, m_row2, m_col2;
-
- public CellRange(String cells) {
- parse(cells);
- }
-
- public CellRange(int row, int col) {
- rangeCheck(row, col);
- m_row1 = row;
- m_col1 = col;
- m_row2 = row;
- m_col2 = col;
- }
-
- public CellRange(int row1, int col1, int row2, int col2) {
- rangeCheck(row1, col1);
- rangeCheck(row2, col2);
- m_row1 = row1;
- m_col1 = col1;
- m_row2 = row2;
- m_col2 = col2;
- rangeOrder();
- }
-
- public boolean isRowsOnly() {
- return m_col1 < 0 && m_col2 < 0;
- }
-
- public boolean isColumnsOnly() {
- return m_row1 < 0 && m_row2 < 0;
- }
-
- public int getFirstRow() {
- return m_row1;
- }
-
- public int getLastRow() {
- return m_row2;
- }
-
- public int getFirstColumn() {
- return m_col1;
- }
-
- public int getLastColumn() {
- return m_col2;
- }
-
- public int getColumnCount() {
- if (isColumnsOnly()) {
- return -1;
- }
- else {
- return m_col2 - m_col1 + 1;
- }
- }
-
- public int getRowCount() {
- if (isRowsOnly()) {
- return -1;
- }
- else {
- return m_row2 - m_row1 + 1;
- }
- }
-
- public CellRange normalize(int rowCount, int colCount) {
- boolean rowOnly = isRowsOnly();
- boolean colOnly = isColumnsOnly();
- if (rowOnly || colOnly) {
- CellRange x = new CellRange(m_row1, m_col1, m_row2, m_col2);
- if (rowOnly) {
- x.m_col1 = 1;
- x.m_col2 = colCount;
- }
- if (colOnly) {
- x.m_row1 = 1;
- x.m_row2 = rowCount;
- }
- return x;
- }
- else {
- return this;
- }
- }
-
- public String toRangeString() {
- return format();
- }
-
- @Override
- public String toString() {
- return format();
- }
-
- private String toString(int val) {
- if (val <= 0) {
- return " *";
- }
- else if (val <= 9) {
- return "0" + val;
- }
- else {
- return "" + val;
- }
- }
-
- public String format() {
- if (m_row1 == m_row2 && m_col1 == m_col2) {
- return formatItem(m_row1, m_col1);
- }
- else {
- return formatItem(m_row1, m_col1) + ":" + formatItem(m_row2, m_col2);
- }
- }
-
- public static String toRangeString(int row, int col) {
- return new CellRange(row, col).format();
- }
-
- public static String toRangeString(int row1, int col1, int row2, int col2) {
- return new CellRange(row1, col1, row2, col2).format();
- }
-
- public static CellRange toRange(String s) {
- return new CellRange(s);
- }
-
- private String formatItem(int row, int col) {
- String s = "";
- while (col >= 0) {
- int n = col % 26;
- if (n == 0 && col >= 26) {
- n = 26;
- }
- if (n > 0) {
- char ch = (char) ('A' + n - 1);
- s = ch + s;
- }
- if (col == 0) {
- col = -1;
- }
- else {
- col = (col - n) / 26;
- }
- }
- if (row > 0) {
- s = s + row;
- }
- return s;
- }
-
- public void parse(String s) {// A4:C5
- int p;
- if ((p = s.indexOf(':')) >= 0) {
- int[] a = parseItem(s.substring(0, p));
- m_row1 = a[0];
- m_col1 = a[1];
- a = parseItem(s.substring(p + 1));
- m_row2 = a[0];
- m_col2 = a[1];
- }
- else {
- int[] a = parseItem(s);
- m_row1 = a[0];
- m_col1 = a[1];
- m_row2 = m_row1;
- m_col2 = m_col1;
- }
- rangeOrder();
- }
-
- private int[] parseItem(String s) {// A4
- s = s.toUpperCase();
- char ch;
- int[] a = new int[2];
- int i = 0;
- for (; i < s.length(); i++) {
- ch = s.charAt(i);
- if (ch >= 'A' && ch <= 'Z') {
- a[1] = a[1] * 26 + ((ch - 'A' + 1));
- }
- else {
- break;
- }
- }
- if (a[1] == 0) {
- a[1] = -1;
- }
- //
- if (i < s.length()) {
- a[0] = Integer.parseInt(s.substring(i));
- }
- if (a[0] == 0) {
- a[0] = -1;
- }
- return a;
- }
-
- private void rangeCheck(int row, int col) {
- if (row == 0 || row < -1 || col == 0 || col < -1) {
- throw new IllegalArgumentException("value must be at least 1 or -1 for wildcards: " + row + "," + col);
- }
- }
-
- private void rangeOrder() {
- if (m_row2 < m_row1) {
- int t = m_row2;
- m_row2 = m_row1;
- m_row1 = t;
- }
- if (m_col2 < m_col1) {
- int t = m_col2;
- m_col2 = m_col1;
- m_col1 = t;
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import java.io.Serializable;
+
+public class CellRange implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private int m_row1, m_col1, m_row2, m_col2;
+
+ public CellRange(String cells) {
+ parse(cells);
+ }
+
+ public CellRange(int row, int col) {
+ rangeCheck(row, col);
+ m_row1 = row;
+ m_col1 = col;
+ m_row2 = row;
+ m_col2 = col;
+ }
+
+ public CellRange(int row1, int col1, int row2, int col2) {
+ rangeCheck(row1, col1);
+ rangeCheck(row2, col2);
+ m_row1 = row1;
+ m_col1 = col1;
+ m_row2 = row2;
+ m_col2 = col2;
+ rangeOrder();
+ }
+
+ public boolean isRowsOnly() {
+ return m_col1 < 0 && m_col2 < 0;
+ }
+
+ public boolean isColumnsOnly() {
+ return m_row1 < 0 && m_row2 < 0;
+ }
+
+ public int getFirstRow() {
+ return m_row1;
+ }
+
+ public int getLastRow() {
+ return m_row2;
+ }
+
+ public int getFirstColumn() {
+ return m_col1;
+ }
+
+ public int getLastColumn() {
+ return m_col2;
+ }
+
+ public int getColumnCount() {
+ if (isColumnsOnly()) {
+ return -1;
+ }
+ else {
+ return m_col2 - m_col1 + 1;
+ }
+ }
+
+ public int getRowCount() {
+ if (isRowsOnly()) {
+ return -1;
+ }
+ else {
+ return m_row2 - m_row1 + 1;
+ }
+ }
+
+ public CellRange normalize(int rowCount, int colCount) {
+ boolean rowOnly = isRowsOnly();
+ boolean colOnly = isColumnsOnly();
+ if (rowOnly || colOnly) {
+ CellRange x = new CellRange(m_row1, m_col1, m_row2, m_col2);
+ if (rowOnly) {
+ x.m_col1 = 1;
+ x.m_col2 = colCount;
+ }
+ if (colOnly) {
+ x.m_row1 = 1;
+ x.m_row2 = rowCount;
+ }
+ return x;
+ }
+ else {
+ return this;
+ }
+ }
+
+ public String toRangeString() {
+ return format();
+ }
+
+ @Override
+ public String toString() {
+ return format();
+ }
+
+ private String toString(int val) {
+ if (val <= 0) {
+ return " *";
+ }
+ else if (val <= 9) {
+ return "0" + val;
+ }
+ else {
+ return "" + val;
+ }
+ }
+
+ public String format() {
+ if (m_row1 == m_row2 && m_col1 == m_col2) {
+ return formatItem(m_row1, m_col1);
+ }
+ else {
+ return formatItem(m_row1, m_col1) + ":" + formatItem(m_row2, m_col2);
+ }
+ }
+
+ public static String toRangeString(int row, int col) {
+ return new CellRange(row, col).format();
+ }
+
+ public static String toRangeString(int row1, int col1, int row2, int col2) {
+ return new CellRange(row1, col1, row2, col2).format();
+ }
+
+ public static CellRange toRange(String s) {
+ return new CellRange(s);
+ }
+
+ private String formatItem(int row, int col) {
+ String s = "";
+ while (col >= 0) {
+ int n = col % 26;
+ if (n == 0 && col >= 26) {
+ n = 26;
+ }
+ if (n > 0) {
+ char ch = (char) ('A' + n - 1);
+ s = ch + s;
+ }
+ if (col == 0) {
+ col = -1;
+ }
+ else {
+ col = (col - n) / 26;
+ }
+ }
+ if (row > 0) {
+ s = s + row;
+ }
+ return s;
+ }
+
+ public void parse(String s) {// A4:C5
+ int p;
+ if ((p = s.indexOf(':')) >= 0) {
+ int[] a = parseItem(s.substring(0, p));
+ m_row1 = a[0];
+ m_col1 = a[1];
+ a = parseItem(s.substring(p + 1));
+ m_row2 = a[0];
+ m_col2 = a[1];
+ }
+ else {
+ int[] a = parseItem(s);
+ m_row1 = a[0];
+ m_col1 = a[1];
+ m_row2 = m_row1;
+ m_col2 = m_col1;
+ }
+ rangeOrder();
+ }
+
+ private int[] parseItem(String s) {// A4
+ s = s.toUpperCase();
+ char ch;
+ int[] a = new int[2];
+ int i = 0;
+ for (; i < s.length(); i++) {
+ ch = s.charAt(i);
+ if (ch >= 'A' && ch <= 'Z') {
+ a[1] = a[1] * 26 + ((ch - 'A' + 1));
+ }
+ else {
+ break;
+ }
+ }
+ if (a[1] == 0) {
+ a[1] = -1;
+ }
+ //
+ if (i < s.length()) {
+ a[0] = Integer.parseInt(s.substring(i));
+ }
+ if (a[0] == 0) {
+ a[0] = -1;
+ }
+ return a;
+ }
+
+ private void rangeCheck(int row, int col) {
+ if (row == 0 || row < -1 || col == 0 || col < -1) {
+ throw new IllegalArgumentException("value must be at least 1 or -1 for wildcards: " + row + "," + col);
+ }
+ }
+
+ private void rangeOrder() {
+ if (m_row2 < m_row1) {
+ int t = m_row2;
+ m_row2 = m_row1;
+ m_row1 = t;
+ }
+ if (m_col2 < m_col1) {
+ int t = m_col2;
+ m_col2 = m_col1;
+ m_col1 = t;
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/CharsetSafeMimeMessage.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/CharsetSafeMimeMessage.java
index dd230e0afd..8534c4abf1 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/CharsetSafeMimeMessage.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/CharsetSafeMimeMessage.java
@@ -1,136 +1,136 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import java.io.UnsupportedEncodingException;
-
-import javax.mail.Address;
-import javax.mail.Message;
-import javax.mail.MessagingException;
-import javax.mail.Session;
-import javax.mail.internet.InternetAddress;
-import javax.mail.internet.MimeMessage;
-import javax.mail.internet.MimeUtility;
-
-public class CharsetSafeMimeMessage extends MimeMessage {
- private String m_charset;
-
- public CharsetSafeMimeMessage() {
- super((Session) null);
- m_charset = "UTF-8";
- }
-
- public CharsetSafeMimeMessage(String charset) {
- super((Session) null);
- m_charset = charset;
- }
-
- @Override
- public void setFrom(Address address) throws MessagingException {
- super.setFrom(encodeAddress(address));
- }
-
- @Override
- public void addFrom(Address[] addresses) throws MessagingException {
- super.addFrom(encodeAddresses(addresses));
- }
-
- @Override
- public void addRecipients(Message.RecipientType type, Address[] addresses) throws MessagingException {
- super.addRecipients(type, encodeAddresses(addresses));
- }
-
- @Override
- public void addRecipients(Message.RecipientType type, String addresses) throws MessagingException {
- if (type == RecipientType.NEWSGROUPS) {
- super.addRecipients(type, addresses);
- }
- else {
- addRecipients(type, InternetAddress.parse(addresses));
- }
- }
-
- @Override
- public void setDescription(String description) throws MessagingException {
- super.setDescription(description, m_charset);
- }
-
- @Override
- public void setFrom() throws MessagingException {
- InternetAddress me = InternetAddress.getLocalAddress(session);
- if (me != null) {
- setFrom(encodeAddress(me));
- }
- else {
- throw new MessagingException("No From address");
- }
- }
-
- @Override
- public void setRecipients(Message.RecipientType type, Address[] addresses) throws MessagingException {
- super.setRecipients(type, encodeAddresses(addresses));
- }
-
- @Override
- public void setRecipients(Message.RecipientType type, String addresses) throws MessagingException {
- if (type == RecipientType.NEWSGROUPS) {
- super.setRecipients(type, addresses);
- }
- else {
- setRecipients(type, InternetAddress.parse(addresses));
- }
- }
-
- @Override
- public void setReplyTo(Address[] addresses) throws MessagingException {
- super.setReplyTo(encodeAddresses(addresses));
- }
-
- @Override
- public void setSender(Address address) throws MessagingException {
- super.setSender(encodeAddress(address));
- }
-
- @Override
- public void setSubject(String subject) throws MessagingException {
- super.setSubject(subject, m_charset);
- }
-
- @Override
- public void setText(String text) throws MessagingException {
- super.setText(text, m_charset);
- }
-
- private Address encodeAddress(Address address) throws MessagingException {
- if (address instanceof InternetAddress) {
- InternetAddress inet = (InternetAddress) address;
- if (inet.getPersonal() != null && inet.getPersonal().length() > 0) {
- try {
- inet.setPersonal(MimeUtility.encodeText(inet.getPersonal(), m_charset, "Q"));
- }
- catch (UnsupportedEncodingException e) {
- throw new MessagingException("Unable to encode from address", e);
- }
- }
- return inet;
- }
- return address;
- }
-
- private Address[] encodeAddresses(Address[] addresses) throws MessagingException {
- if (addresses != null && addresses.length > 0) {
- for (Address a : addresses) {
- encodeAddress(a);
- }
- }
- return addresses;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import java.io.UnsupportedEncodingException;
+
+import javax.mail.Address;
+import javax.mail.Message;
+import javax.mail.MessagingException;
+import javax.mail.Session;
+import javax.mail.internet.InternetAddress;
+import javax.mail.internet.MimeMessage;
+import javax.mail.internet.MimeUtility;
+
+public class CharsetSafeMimeMessage extends MimeMessage {
+ private String m_charset;
+
+ public CharsetSafeMimeMessage() {
+ super((Session) null);
+ m_charset = "UTF-8";
+ }
+
+ public CharsetSafeMimeMessage(String charset) {
+ super((Session) null);
+ m_charset = charset;
+ }
+
+ @Override
+ public void setFrom(Address address) throws MessagingException {
+ super.setFrom(encodeAddress(address));
+ }
+
+ @Override
+ public void addFrom(Address[] addresses) throws MessagingException {
+ super.addFrom(encodeAddresses(addresses));
+ }
+
+ @Override
+ public void addRecipients(Message.RecipientType type, Address[] addresses) throws MessagingException {
+ super.addRecipients(type, encodeAddresses(addresses));
+ }
+
+ @Override
+ public void addRecipients(Message.RecipientType type, String addresses) throws MessagingException {
+ if (type == RecipientType.NEWSGROUPS) {
+ super.addRecipients(type, addresses);
+ }
+ else {
+ addRecipients(type, InternetAddress.parse(addresses));
+ }
+ }
+
+ @Override
+ public void setDescription(String description) throws MessagingException {
+ super.setDescription(description, m_charset);
+ }
+
+ @Override
+ public void setFrom() throws MessagingException {
+ InternetAddress me = InternetAddress.getLocalAddress(session);
+ if (me != null) {
+ setFrom(encodeAddress(me));
+ }
+ else {
+ throw new MessagingException("No From address");
+ }
+ }
+
+ @Override
+ public void setRecipients(Message.RecipientType type, Address[] addresses) throws MessagingException {
+ super.setRecipients(type, encodeAddresses(addresses));
+ }
+
+ @Override
+ public void setRecipients(Message.RecipientType type, String addresses) throws MessagingException {
+ if (type == RecipientType.NEWSGROUPS) {
+ super.setRecipients(type, addresses);
+ }
+ else {
+ setRecipients(type, InternetAddress.parse(addresses));
+ }
+ }
+
+ @Override
+ public void setReplyTo(Address[] addresses) throws MessagingException {
+ super.setReplyTo(encodeAddresses(addresses));
+ }
+
+ @Override
+ public void setSender(Address address) throws MessagingException {
+ super.setSender(encodeAddress(address));
+ }
+
+ @Override
+ public void setSubject(String subject) throws MessagingException {
+ super.setSubject(subject, m_charset);
+ }
+
+ @Override
+ public void setText(String text) throws MessagingException {
+ super.setText(text, m_charset);
+ }
+
+ private Address encodeAddress(Address address) throws MessagingException {
+ if (address instanceof InternetAddress) {
+ InternetAddress inet = (InternetAddress) address;
+ if (inet.getPersonal() != null && inet.getPersonal().length() > 0) {
+ try {
+ inet.setPersonal(MimeUtility.encodeText(inet.getPersonal(), m_charset, "Q"));
+ }
+ catch (UnsupportedEncodingException e) {
+ throw new MessagingException("Unable to encode from address", e);
+ }
+ }
+ return inet;
+ }
+ return address;
+ }
+
+ private Address[] encodeAddresses(Address[] addresses) throws MessagingException {
+ if (addresses != null && addresses.length > 0) {
+ for (Address a : addresses) {
+ encodeAddress(a);
+ }
+ }
+ return addresses;
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/ClassIdentifier.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/ClassIdentifier.java
index 6475eb4409..325b573788 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/ClassIdentifier.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/ClassIdentifier.java
@@ -1,116 +1,116 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Arrays;
-
-/**
- * A class identifier holds the static information of how a class is embedded within other classes. This information is
- * especially required to identify extended template classes.
- * <p>
- * <b>Example</b>:
- *
- * <pre>
- * public abstract class Template {
- * public class InnerClass {
- * }
- * }
- *
- * public class Foo {
- * public class A extends Template {
- * }
- *
- * public class B extends Template {
- * }
- * }
- * </pre>
- *
- * A class identifier distinguishes between the <code>InnerClass</code> used within <code>Foo.A</code> and the one used
- * within <code>Foo.B</code>. I.e <code>new ClassIdentifier(Foo.A.class, Foo.A.InnerClass.class)</code> is not the same
- * as <code>new ClassIdentifier(Foo.B.class, Foo.B.InnerClass.class)</code>, whereas
- * <code>Foo.A.InnerClass.class == Foo.B.InnerClass.class</code>. Therefore,
- * <code>new InnerClass(Foo.A.class, Foo.A.InnerClass.class)</code> identifies the same class as
- * <code>new InnerClass(Foo.A.class, Template.InnerClass.class)</code>.
- */
-public class ClassIdentifier implements Serializable {
- private static final long serialVersionUID = 1L;
-
- private final Class<?>[] m_segments;
-
- public ClassIdentifier(Class<?>... segments) throws IllegalArgumentException {
- if (segments == null || segments.length == 0) {
- throw new IllegalArgumentException("The given classes array must not be null or empty");
- }
- m_segments = segments;
- }
-
- /**
- * @return Returns the array of segments represented by this class identifier.
- */
- public Class<?>[] getClasses() {
- return m_segments;
- }
-
- /**
- * @return Returns the last segment of this class identifier.
- */
- public Class<?> getLastSegment() {
- return m_segments[m_segments.length - 1];
- }
-
- /**
- * Converts the given array of classes into an array of {@link ClassIdentifier}s. The method returns always a non-null
- * result. Null entries in the given class array are not transformed into a class identifier.
- *
- * @param classes
- * @return
- */
- public static ClassIdentifier[] convertClassArrayToClassIdentifierArray(Class<?>... classes) {
- if (classes == null || classes.length == 0) {
- return new ClassIdentifier[0];
- }
- ArrayList<ClassIdentifier> result = new ArrayList<ClassIdentifier>();
- for (Class<?> c : classes) {
- if (c != null) {
- result.add(new ClassIdentifier(c));
- }
- }
- return result.toArray(new ClassIdentifier[result.size()]);
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + Arrays.hashCode(m_segments);
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- ClassIdentifier other = (ClassIdentifier) obj;
- if (!Arrays.equals(m_segments, other.m_segments)) {
- return false;
- }
- return true;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Arrays;
+
+/**
+ * A class identifier holds the static information of how a class is embedded within other classes. This information is
+ * especially required to identify extended template classes.
+ * <p>
+ * <b>Example</b>:
+ *
+ * <pre>
+ * public abstract class Template {
+ * public class InnerClass {
+ * }
+ * }
+ *
+ * public class Foo {
+ * public class A extends Template {
+ * }
+ *
+ * public class B extends Template {
+ * }
+ * }
+ * </pre>
+ *
+ * A class identifier distinguishes between the <code>InnerClass</code> used within <code>Foo.A</code> and the one used
+ * within <code>Foo.B</code>. I.e <code>new ClassIdentifier(Foo.A.class, Foo.A.InnerClass.class)</code> is not the same
+ * as <code>new ClassIdentifier(Foo.B.class, Foo.B.InnerClass.class)</code>, whereas
+ * <code>Foo.A.InnerClass.class == Foo.B.InnerClass.class</code>. Therefore,
+ * <code>new InnerClass(Foo.A.class, Foo.A.InnerClass.class)</code> identifies the same class as
+ * <code>new InnerClass(Foo.A.class, Template.InnerClass.class)</code>.
+ */
+public class ClassIdentifier implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private final Class<?>[] m_segments;
+
+ public ClassIdentifier(Class<?>... segments) throws IllegalArgumentException {
+ if (segments == null || segments.length == 0) {
+ throw new IllegalArgumentException("The given classes array must not be null or empty");
+ }
+ m_segments = segments;
+ }
+
+ /**
+ * @return Returns the array of segments represented by this class identifier.
+ */
+ public Class<?>[] getClasses() {
+ return m_segments;
+ }
+
+ /**
+ * @return Returns the last segment of this class identifier.
+ */
+ public Class<?> getLastSegment() {
+ return m_segments[m_segments.length - 1];
+ }
+
+ /**
+ * Converts the given array of classes into an array of {@link ClassIdentifier}s. The method returns always a non-null
+ * result. Null entries in the given class array are not transformed into a class identifier.
+ *
+ * @param classes
+ * @return
+ */
+ public static ClassIdentifier[] convertClassArrayToClassIdentifierArray(Class<?>... classes) {
+ if (classes == null || classes.length == 0) {
+ return new ClassIdentifier[0];
+ }
+ ArrayList<ClassIdentifier> result = new ArrayList<ClassIdentifier>();
+ for (Class<?> c : classes) {
+ if (c != null) {
+ result.add(new ClassIdentifier(c));
+ }
+ }
+ return result.toArray(new ClassIdentifier[result.size()]);
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + Arrays.hashCode(m_segments);
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ ClassIdentifier other = (ClassIdentifier) obj;
+ if (!Arrays.equals(m_segments, other.m_segments)) {
+ return false;
+ }
+ return true;
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/CloneUtility.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/CloneUtility.java
index bb7a94bf5e..39b7b5bbfe 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/CloneUtility.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/CloneUtility.java
@@ -1,99 +1,99 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.ObjectStreamClass;
-import java.io.OutputStream;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-
-public final class CloneUtility {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(CloneUtility.class);
-
- private CloneUtility() {
- }
-
- /**
- * Creates a deep copy of the object using serialize/deserialize.
- * Other than Object.clone this will create a correct copy of the object and all its references.
- */
- public static Object createDeepCopyBySerializing(Object obj) throws Exception {
- ByteArrayOutputStream o = new ByteArrayOutputStream();
- DeepCopyObjectWriter oo = new DeepCopyObjectWriter(o);
- oo.writeObject(obj);
- oo.close();
- DeepCopyObjectReader oi = new DeepCopyObjectReader(new ByteArrayInputStream(o.toByteArray()), oo.getUsedClassLoaders());
- Object copy = oi.readObject();
- oi.close();
- return copy;
- }
-
- private static class DeepCopyObjectWriter extends ObjectOutputStream {
- private Set<ClassLoader> m_usedClassLoaders = new HashSet<ClassLoader>();
-
- public DeepCopyObjectWriter(OutputStream out) throws IOException {
- super(out);
- enableReplaceObject(true);
- }
-
- @Override
- protected Object replaceObject(Object obj) throws IOException {
- if (obj != null) {
- ClassLoader cl = obj.getClass().getClassLoader();
- if (cl != null) {
- m_usedClassLoaders.add(cl);
- }
- }
- return obj;
- }
-
- public Set<ClassLoader> getUsedClassLoaders() {
- return m_usedClassLoaders;
- }
- }
-
- private static class DeepCopyObjectReader extends ObjectInputStream {
- private Set<ClassLoader> m_classLoaders;
-
- public DeepCopyObjectReader(InputStream in, Set<ClassLoader> classLoaders) throws IOException {
- super(in);
- m_classLoaders = classLoaders;
- }
-
- @Override
- protected Class<?> resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException {
- try {
- return super.resolveClass(desc);
- }
- catch (Exception e1) {
- for (ClassLoader cl : m_classLoaders) {
- try {
- return Class.forName(desc.getName(), true, cl);
- }
- catch (Exception e2) {
- //nop
- }
- }
- }
- //repeat original path
- return super.resolveClass(desc);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.ObjectStreamClass;
+import java.io.OutputStream;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+
+public final class CloneUtility {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(CloneUtility.class);
+
+ private CloneUtility() {
+ }
+
+ /**
+ * Creates a deep copy of the object using serialize/deserialize.
+ * Other than Object.clone this will create a correct copy of the object and all its references.
+ */
+ public static Object createDeepCopyBySerializing(Object obj) throws Exception {
+ ByteArrayOutputStream o = new ByteArrayOutputStream();
+ DeepCopyObjectWriter oo = new DeepCopyObjectWriter(o);
+ oo.writeObject(obj);
+ oo.close();
+ DeepCopyObjectReader oi = new DeepCopyObjectReader(new ByteArrayInputStream(o.toByteArray()), oo.getUsedClassLoaders());
+ Object copy = oi.readObject();
+ oi.close();
+ return copy;
+ }
+
+ private static class DeepCopyObjectWriter extends ObjectOutputStream {
+ private Set<ClassLoader> m_usedClassLoaders = new HashSet<ClassLoader>();
+
+ public DeepCopyObjectWriter(OutputStream out) throws IOException {
+ super(out);
+ enableReplaceObject(true);
+ }
+
+ @Override
+ protected Object replaceObject(Object obj) throws IOException {
+ if (obj != null) {
+ ClassLoader cl = obj.getClass().getClassLoader();
+ if (cl != null) {
+ m_usedClassLoaders.add(cl);
+ }
+ }
+ return obj;
+ }
+
+ public Set<ClassLoader> getUsedClassLoaders() {
+ return m_usedClassLoaders;
+ }
+ }
+
+ private static class DeepCopyObjectReader extends ObjectInputStream {
+ private Set<ClassLoader> m_classLoaders;
+
+ public DeepCopyObjectReader(InputStream in, Set<ClassLoader> classLoaders) throws IOException {
+ super(in);
+ m_classLoaders = classLoaders;
+ }
+
+ @Override
+ protected Class<?> resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException {
+ try {
+ return super.resolveClass(desc);
+ }
+ catch (Exception e1) {
+ for (ClassLoader cl : m_classLoaders) {
+ try {
+ return Class.forName(desc.getName(), true, cl);
+ }
+ catch (Exception e2) {
+ //nop
+ }
+ }
+ }
+ //repeat original path
+ return super.resolveClass(desc);
+ }
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/CollationRulesPatch.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/CollationRulesPatch.java
index 3016af997d..83bb25ce51 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/CollationRulesPatch.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/CollationRulesPatch.java
@@ -1,98 +1,98 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.text.Collator;
-
-/**
- * Patch for Collator to consider space and hyphen characters while sorting strings.
- *
- * @see Bugzilla 390097
- */
-public class CollationRulesPatch {
-
- private CollationRulesPatch() {
- }
-
- public static void patchDefaultCollationRules() {
- try {
- changeDefaultCollationRules();
- clearCollatorCache();
- }
- catch (Throwable t) {
- // nop
- }
- }
-
- public static void revertPatchDefaultCollationRules() {
- try {
- revertDefaultCollationRules();
- clearCollatorCache();
- }
- catch (Throwable t) {
- // nop
- }
- }
-
- private static void changeDefaultCollationRules() throws Exception {
- Field defaultRulesField = getDefaultCollationRulesField();
- replaceDefaultCollationRules(defaultRulesField, "<'\u005f'", "<'\u0020','\u002D'<'\u005f'");
- ReflectionUtility.setFinalFlagOnField(defaultRulesField);
- }
-
- private static void revertDefaultCollationRules() throws Exception {
- Field defaultRulesField = getDefaultCollationRulesField();
- replaceDefaultCollationRules(defaultRulesField, "<'\u0020','\u002D'<'\u005f'", "<'\u005f'");
- ReflectionUtility.setFinalFlagOnField(defaultRulesField);
- }
-
- private static Field getDefaultCollationRulesField() throws Exception {
- Class collationRulesClass = Class.forName("java.text.CollationRules");
- Field defaultRulesField = collationRulesClass.getDeclaredField("DEFAULTRULES");
- ReflectionUtility.removeFinalFlagOnField(defaultRulesField);
- return defaultRulesField;
- }
-
- private static void replaceDefaultCollationRules(Field defaultRulesField, String oldRule, String newRule) throws Exception {
- defaultRulesField.setAccessible(true);
- String defaultRules = (String) defaultRulesField.get(null);
- if (defaultRules.contains(newRule) && !defaultRules.contains(oldRule)) {
- return;
- }
- String newRules = defaultRules.replaceAll(oldRule, newRule);
- defaultRulesField.set(null, newRules);
- defaultRulesField.setAccessible(false);
- }
-
- private static void clearCollatorCache() throws Exception {
- Field cacheField = getAccessibleCollatorCacheField();
- clearCollatorCacheField(cacheField);
- cacheField.setAccessible(false);
- }
-
- private static Field getAccessibleCollatorCacheField() throws Exception {
- Field cacheField = Collator.class.getDeclaredField("cache");
- cacheField.setAccessible(true);
- return cacheField;
- }
-
- private static void clearCollatorCacheField(Field cacheField) throws Exception {
- Object softCache = cacheField.get(null);
- if (softCache != null) {
- Class<?> softcacheClass = cacheField.getType();
- Method cacheClearMethod = softcacheClass.getDeclaredMethod("clear");
- cacheClearMethod.invoke(softCache);
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.text.Collator;
+
+/**
+ * Patch for Collator to consider space and hyphen characters while sorting strings.
+ *
+ * @see Bugzilla 390097
+ */
+public class CollationRulesPatch {
+
+ private CollationRulesPatch() {
+ }
+
+ public static void patchDefaultCollationRules() {
+ try {
+ changeDefaultCollationRules();
+ clearCollatorCache();
+ }
+ catch (Throwable t) {
+ // nop
+ }
+ }
+
+ public static void revertPatchDefaultCollationRules() {
+ try {
+ revertDefaultCollationRules();
+ clearCollatorCache();
+ }
+ catch (Throwable t) {
+ // nop
+ }
+ }
+
+ private static void changeDefaultCollationRules() throws Exception {
+ Field defaultRulesField = getDefaultCollationRulesField();
+ replaceDefaultCollationRules(defaultRulesField, "<'\u005f'", "<'\u0020','\u002D'<'\u005f'");
+ ReflectionUtility.setFinalFlagOnField(defaultRulesField);
+ }
+
+ private static void revertDefaultCollationRules() throws Exception {
+ Field defaultRulesField = getDefaultCollationRulesField();
+ replaceDefaultCollationRules(defaultRulesField, "<'\u0020','\u002D'<'\u005f'", "<'\u005f'");
+ ReflectionUtility.setFinalFlagOnField(defaultRulesField);
+ }
+
+ private static Field getDefaultCollationRulesField() throws Exception {
+ Class collationRulesClass = Class.forName("java.text.CollationRules");
+ Field defaultRulesField = collationRulesClass.getDeclaredField("DEFAULTRULES");
+ ReflectionUtility.removeFinalFlagOnField(defaultRulesField);
+ return defaultRulesField;
+ }
+
+ private static void replaceDefaultCollationRules(Field defaultRulesField, String oldRule, String newRule) throws Exception {
+ defaultRulesField.setAccessible(true);
+ String defaultRules = (String) defaultRulesField.get(null);
+ if (defaultRules.contains(newRule) && !defaultRules.contains(oldRule)) {
+ return;
+ }
+ String newRules = defaultRules.replaceAll(oldRule, newRule);
+ defaultRulesField.set(null, newRules);
+ defaultRulesField.setAccessible(false);
+ }
+
+ private static void clearCollatorCache() throws Exception {
+ Field cacheField = getAccessibleCollatorCacheField();
+ clearCollatorCacheField(cacheField);
+ cacheField.setAccessible(false);
+ }
+
+ private static Field getAccessibleCollatorCacheField() throws Exception {
+ Field cacheField = Collator.class.getDeclaredField("cache");
+ cacheField.setAccessible(true);
+ return cacheField;
+ }
+
+ private static void clearCollatorCacheField(Field cacheField) throws Exception {
+ Object softCache = cacheField.get(null);
+ if (softCache != null) {
+ Class<?> softcacheClass = cacheField.getType();
+ Method cacheClearMethod = softcacheClass.getDeclaredMethod("clear");
+ cacheClearMethod.invoke(softCache);
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/CollectionUtility.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/CollectionUtility.java
index 435ef93a53..007cbef10a 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/CollectionUtility.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/CollectionUtility.java
@@ -1,304 +1,304 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.SortedMap;
-import java.util.TreeMap;
-
-public final class CollectionUtility {
- private CollectionUtility() {
- }
-
- /*
- * Collection/List handling
- */
- public static <T> T firstElement(Collection<T> c) {
- if (c == null || c.size() == 0) {
- return null;
- }
- else {
- return c.iterator().next();
- }
- }
-
- public static <T> T lastElement(List<T> c) {
- if (c == null || c.size() == 0) {
- return null;
- }
- else {
- return c.get(c.size() - 1);
- }
- }
-
- public static <T> List<T> copyList(Collection<T> c) {
- if (c == null || c.size() == 0) {
- return new ArrayList<T>(0);
- }
- else {
- return new ArrayList<T>(c);
- }
- }
-
- @SuppressWarnings("unchecked")
- public static <T> T[] toArray(Collection<T> c, Class<T> clazz) {
- if (c == null || c.size() == 0) {
- T[] a = (T[]) java.lang.reflect.Array.newInstance(clazz, 0);
- return Collections.<T> emptyList().toArray(a);
- }
- else {
- T[] a = (T[]) java.lang.reflect.Array.newInstance(clazz, c.size());
- return c.toArray(a);
- }
- }
-
- public static <T, V extends T> List<T> appendList(List<T> list, V o) {
- if (list == null) {
- list = new ArrayList<T>(1);
- }
- list.add(o);
- return list;
- }
-
- public static <T, V extends T> List<T> appendList(List<T> list, int index, V o) {
- if (list == null) {
- list = new ArrayList<T>(1);
- }
- if (index > list.size()) {
- for (int i = list.size(); i < index; i++) {
- list.add(i, null);
- }
- }
- list.add(index, o);
- return list;
- }
-
- public static <T> List<T> appendAllList(List<T> list, Collection<? extends T> c) {
- if (list == null) {
- list = new ArrayList<T>(1);
- }
- if (c != null && c.size() > 0) {
- list.addAll(c);
- }
- return list;
- }
-
- public static <T, V extends T> List<T> removeObjectList(List<T> list, V o) {
- if (list == null) {
- list = new ArrayList<T>(1);
- }
- list.remove(o);
- return list;
- }
-
- public static <T> List<T> removeObjectList(List<T> list, int i) {
- if (list == null) {
- list = new ArrayList<T>(1);
- }
- list.remove(i);
- return list;
- }
-
- public static <T, V extends T> Set<T> removeObjectSet(Set<T> set, V o) {
- if (set == null) {
- set = new HashSet<T>(1);
- }
- set.remove(o);
- return set;
- }
-
- public static <T> Set<T> removeObjectSet(Set<T> set, int i) {
- if (set == null) {
- set = new HashSet<T>(1);
- }
- set.remove(i);
- return set;
- }
-
- public static <T> int size(List<T> list) {
- if (list == null) {
- return 0;
- }
- return list.size();
- }
-
- /*
- * Default Map handling
- */
-
- @SuppressWarnings("unchecked")
- public static <T, U> U[] getValueArray(Map<T, U> m, Class<U> clazz) {
- if (m == null || m.size() == 0) {
- U[] a = (U[]) java.lang.reflect.Array.newInstance(clazz, 0);
- return Collections.<U> emptyList().toArray(a);
- }
- else {
- U[] a = (U[]) java.lang.reflect.Array.newInstance(clazz, m.size());
- return m.values().toArray(a);
- }
- }
-
- @SuppressWarnings("unchecked")
- public static <T, U> T[] getKeyArray(Map<T, U> m, Class<T> clazz) {
- if (m == null || m.size() == 0) {
- T[] a = (T[]) java.lang.reflect.Array.newInstance(clazz, 0);
- return Collections.<T> emptyList().toArray(a);
- }
- else {
- T[] a = (T[]) java.lang.reflect.Array.newInstance(clazz, m.size());
- return m.keySet().toArray(a);
- }
- }
-
- public static <T, U> Map<T, U> copyMap(Map<T, U> m) {
- if (m == null || m.size() == 0) {
- return new HashMap<T, U>();
- }
- else {
- return new HashMap<T, U>(m);
- }
- }
-
- public static <T, U, V extends T, W extends U> Map<T, U> putObject(Map<T, U> map, V key, W value) {
- if (map == null) {
- map = new HashMap<T, U>();
- }
- map.put(key, value);
- return map;
- }
-
- public static <T, U> U getObject(Map<T, U> map, T key) {
- if (map == null) {
- map = new HashMap<T, U>();
- }
- return map.get(key);
- }
-
- public static <T, U> Map<T, U> removeObject(Map<T, U> map, T key) {
- if (map == null) {
- map = new HashMap<T, U>();
- }
- map.remove(key);
- return map;
- }
-
- public static <T, U> boolean containsValue(Map<T, U> map, U value) {
- if (map == null) {
- return false;
- }
- return map.containsValue(value);
- }
-
- public static <T, U> boolean containsKey(Map<T, U> map, T key) {
- if (map == null) {
- return false;
- }
- return map.containsKey(key);
- }
-
- public static <T, U> Map<T, U> putAllObjects(Map<T, U> targetMap, Map<T, U> sourceMap) {
- if (targetMap == null) {
- targetMap = new HashMap<T, U>();
- }
- targetMap.putAll(sourceMap);
- return targetMap;
- }
-
- public static <T, U> Map<T, U> getEmptyMap(Map<T, U> m) {
- return new HashMap<T, U>();
- }
-
- /*
- * Sort Map handling
- */
-
- @SuppressWarnings("unchecked")
- public static <T, U> U[] getSortedValueArray(SortedMap<T, U> m, Class<U> clazz) {
- if (m == null || m.size() == 0) {
- U[] a = (U[]) java.lang.reflect.Array.newInstance(clazz, 0);
- return Collections.<U> emptyList().toArray(a);
- }
- else {
- U[] a = (U[]) java.lang.reflect.Array.newInstance(clazz, m.size());
- return m.values().toArray(a);
- }
- }
-
- public static <T, U> SortedMap<T, U> copySortedMap(SortedMap<T, U> m) {
- if (m == null || m.size() == 0) {
- return new TreeMap<T, U>();
- }
- else {
- return new TreeMap<T, U>(m);
- }
- }
-
- public static <T extends Comparable, U> SortedMap<T, U> putObjectSortedMap(SortedMap<T, U> map, T key, U value) {
- if (map == null) {
- map = new TreeMap<T, U>();
- }
- map.put(key, value);
- return map;
- }
-
- public static <T extends Comparable, U> U getObjectSortedMap(SortedMap<T, U> map, T key) {
- if (map == null) {
- map = new TreeMap<T, U>();
- }
- return map.get(key);
- }
-
- public static <T extends Comparable, U> SortedMap<T, U> removeObjectSortedMap(SortedMap<T, U> map, T key) {
- if (map == null) {
- map = new TreeMap<T, U>();
- }
- map.remove(key);
- return map;
- }
-
- public static <T extends Comparable, U> SortedMap<T, U> putAllObjectsSortedMap(SortedMap<T, U> targetMap, Map<T, U> sourceMap) {
- if (targetMap == null) {
- targetMap = new TreeMap<T, U>();
- }
- targetMap.putAll(sourceMap);
- return targetMap;
- }
-
- public static <T, U> SortedMap<T, U> getEmptySortedMap(SortedMap<T, U> m) {
- return new TreeMap<T, U>();
- }
-
- public static <T, U> U lastElement(SortedMap<T, U> m) {
- return m.get(m.lastKey());
- }
-
- public static <T, U> U firstElement(SortedMap<T, U> m) {
- return m.get(m.firstKey());
- }
-
- /**
- * Set factory
- */
- public static <T> HashSet<T> hashSet(T... values) {
- HashSet<T> set = new HashSet<T>();
- for (T v : values) {
- set.add(v);
- }
- return set;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.SortedMap;
+import java.util.TreeMap;
+
+public final class CollectionUtility {
+ private CollectionUtility() {
+ }
+
+ /*
+ * Collection/List handling
+ */
+ public static <T> T firstElement(Collection<T> c) {
+ if (c == null || c.size() == 0) {
+ return null;
+ }
+ else {
+ return c.iterator().next();
+ }
+ }
+
+ public static <T> T lastElement(List<T> c) {
+ if (c == null || c.size() == 0) {
+ return null;
+ }
+ else {
+ return c.get(c.size() - 1);
+ }
+ }
+
+ public static <T> List<T> copyList(Collection<T> c) {
+ if (c == null || c.size() == 0) {
+ return new ArrayList<T>(0);
+ }
+ else {
+ return new ArrayList<T>(c);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public static <T> T[] toArray(Collection<T> c, Class<T> clazz) {
+ if (c == null || c.size() == 0) {
+ T[] a = (T[]) java.lang.reflect.Array.newInstance(clazz, 0);
+ return Collections.<T> emptyList().toArray(a);
+ }
+ else {
+ T[] a = (T[]) java.lang.reflect.Array.newInstance(clazz, c.size());
+ return c.toArray(a);
+ }
+ }
+
+ public static <T, V extends T> List<T> appendList(List<T> list, V o) {
+ if (list == null) {
+ list = new ArrayList<T>(1);
+ }
+ list.add(o);
+ return list;
+ }
+
+ public static <T, V extends T> List<T> appendList(List<T> list, int index, V o) {
+ if (list == null) {
+ list = new ArrayList<T>(1);
+ }
+ if (index > list.size()) {
+ for (int i = list.size(); i < index; i++) {
+ list.add(i, null);
+ }
+ }
+ list.add(index, o);
+ return list;
+ }
+
+ public static <T> List<T> appendAllList(List<T> list, Collection<? extends T> c) {
+ if (list == null) {
+ list = new ArrayList<T>(1);
+ }
+ if (c != null && c.size() > 0) {
+ list.addAll(c);
+ }
+ return list;
+ }
+
+ public static <T, V extends T> List<T> removeObjectList(List<T> list, V o) {
+ if (list == null) {
+ list = new ArrayList<T>(1);
+ }
+ list.remove(o);
+ return list;
+ }
+
+ public static <T> List<T> removeObjectList(List<T> list, int i) {
+ if (list == null) {
+ list = new ArrayList<T>(1);
+ }
+ list.remove(i);
+ return list;
+ }
+
+ public static <T, V extends T> Set<T> removeObjectSet(Set<T> set, V o) {
+ if (set == null) {
+ set = new HashSet<T>(1);
+ }
+ set.remove(o);
+ return set;
+ }
+
+ public static <T> Set<T> removeObjectSet(Set<T> set, int i) {
+ if (set == null) {
+ set = new HashSet<T>(1);
+ }
+ set.remove(i);
+ return set;
+ }
+
+ public static <T> int size(List<T> list) {
+ if (list == null) {
+ return 0;
+ }
+ return list.size();
+ }
+
+ /*
+ * Default Map handling
+ */
+
+ @SuppressWarnings("unchecked")
+ public static <T, U> U[] getValueArray(Map<T, U> m, Class<U> clazz) {
+ if (m == null || m.size() == 0) {
+ U[] a = (U[]) java.lang.reflect.Array.newInstance(clazz, 0);
+ return Collections.<U> emptyList().toArray(a);
+ }
+ else {
+ U[] a = (U[]) java.lang.reflect.Array.newInstance(clazz, m.size());
+ return m.values().toArray(a);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public static <T, U> T[] getKeyArray(Map<T, U> m, Class<T> clazz) {
+ if (m == null || m.size() == 0) {
+ T[] a = (T[]) java.lang.reflect.Array.newInstance(clazz, 0);
+ return Collections.<T> emptyList().toArray(a);
+ }
+ else {
+ T[] a = (T[]) java.lang.reflect.Array.newInstance(clazz, m.size());
+ return m.keySet().toArray(a);
+ }
+ }
+
+ public static <T, U> Map<T, U> copyMap(Map<T, U> m) {
+ if (m == null || m.size() == 0) {
+ return new HashMap<T, U>();
+ }
+ else {
+ return new HashMap<T, U>(m);
+ }
+ }
+
+ public static <T, U, V extends T, W extends U> Map<T, U> putObject(Map<T, U> map, V key, W value) {
+ if (map == null) {
+ map = new HashMap<T, U>();
+ }
+ map.put(key, value);
+ return map;
+ }
+
+ public static <T, U> U getObject(Map<T, U> map, T key) {
+ if (map == null) {
+ map = new HashMap<T, U>();
+ }
+ return map.get(key);
+ }
+
+ public static <T, U> Map<T, U> removeObject(Map<T, U> map, T key) {
+ if (map == null) {
+ map = new HashMap<T, U>();
+ }
+ map.remove(key);
+ return map;
+ }
+
+ public static <T, U> boolean containsValue(Map<T, U> map, U value) {
+ if (map == null) {
+ return false;
+ }
+ return map.containsValue(value);
+ }
+
+ public static <T, U> boolean containsKey(Map<T, U> map, T key) {
+ if (map == null) {
+ return false;
+ }
+ return map.containsKey(key);
+ }
+
+ public static <T, U> Map<T, U> putAllObjects(Map<T, U> targetMap, Map<T, U> sourceMap) {
+ if (targetMap == null) {
+ targetMap = new HashMap<T, U>();
+ }
+ targetMap.putAll(sourceMap);
+ return targetMap;
+ }
+
+ public static <T, U> Map<T, U> getEmptyMap(Map<T, U> m) {
+ return new HashMap<T, U>();
+ }
+
+ /*
+ * Sort Map handling
+ */
+
+ @SuppressWarnings("unchecked")
+ public static <T, U> U[] getSortedValueArray(SortedMap<T, U> m, Class<U> clazz) {
+ if (m == null || m.size() == 0) {
+ U[] a = (U[]) java.lang.reflect.Array.newInstance(clazz, 0);
+ return Collections.<U> emptyList().toArray(a);
+ }
+ else {
+ U[] a = (U[]) java.lang.reflect.Array.newInstance(clazz, m.size());
+ return m.values().toArray(a);
+ }
+ }
+
+ public static <T, U> SortedMap<T, U> copySortedMap(SortedMap<T, U> m) {
+ if (m == null || m.size() == 0) {
+ return new TreeMap<T, U>();
+ }
+ else {
+ return new TreeMap<T, U>(m);
+ }
+ }
+
+ public static <T extends Comparable, U> SortedMap<T, U> putObjectSortedMap(SortedMap<T, U> map, T key, U value) {
+ if (map == null) {
+ map = new TreeMap<T, U>();
+ }
+ map.put(key, value);
+ return map;
+ }
+
+ public static <T extends Comparable, U> U getObjectSortedMap(SortedMap<T, U> map, T key) {
+ if (map == null) {
+ map = new TreeMap<T, U>();
+ }
+ return map.get(key);
+ }
+
+ public static <T extends Comparable, U> SortedMap<T, U> removeObjectSortedMap(SortedMap<T, U> map, T key) {
+ if (map == null) {
+ map = new TreeMap<T, U>();
+ }
+ map.remove(key);
+ return map;
+ }
+
+ public static <T extends Comparable, U> SortedMap<T, U> putAllObjectsSortedMap(SortedMap<T, U> targetMap, Map<T, U> sourceMap) {
+ if (targetMap == null) {
+ targetMap = new TreeMap<T, U>();
+ }
+ targetMap.putAll(sourceMap);
+ return targetMap;
+ }
+
+ public static <T, U> SortedMap<T, U> getEmptySortedMap(SortedMap<T, U> m) {
+ return new TreeMap<T, U>();
+ }
+
+ public static <T, U> U lastElement(SortedMap<T, U> m) {
+ return m.get(m.lastKey());
+ }
+
+ public static <T, U> U firstElement(SortedMap<T, U> m) {
+ return m.get(m.firstKey());
+ }
+
+ /**
+ * Set factory
+ */
+ public static <T> HashSet<T> hashSet(T... values) {
+ HashSet<T> set = new HashSet<T>();
+ for (T v : values) {
+ set.add(v);
+ }
+ return set;
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/ColorUtility.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/ColorUtility.java
index 3aa02e0f6d..a114af7fbd 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/ColorUtility.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/ColorUtility.java
@@ -1,41 +1,41 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import java.awt.Color;
-
-public final class ColorUtility {
-
- // public constants
- public static final String RED = "ff0000";
- public static final String GREEN = "00ff00";
- public static final String BLUE = "0000ff";
- public static final String BLACK = "000000";
- public static final String WHITE = "ffffff";
- public static final String CYAN = "00ffff";
- public static final String YELLOW = "ffff00";
- public static final String MAGENTA = "ff00ff";
-
- private ColorUtility() {
- }
-
- public static int hsb2rgb(int hsbHex) {
- int hue = (hsbHex >> 16) & 0xff;
- int saturation = (hsbHex >> 8) & 0xff;
- int brightness = (hsbHex) & 0xff;
- return hsb2rgb(hue, saturation, brightness);
- }
-
- public static int hsb2rgb(float hue, float saturation, float brightness) {
- return Color.HSBtoRGB(hue, saturation, brightness);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import java.awt.Color;
+
+public final class ColorUtility {
+
+ // public constants
+ public static final String RED = "ff0000";
+ public static final String GREEN = "00ff00";
+ public static final String BLUE = "0000ff";
+ public static final String BLACK = "000000";
+ public static final String WHITE = "ffffff";
+ public static final String CYAN = "00ffff";
+ public static final String YELLOW = "ffff00";
+ public static final String MAGENTA = "ff00ff";
+
+ private ColorUtility() {
+ }
+
+ public static int hsb2rgb(int hsbHex) {
+ int hue = (hsbHex >> 16) & 0xff;
+ int saturation = (hsbHex >> 8) & 0xff;
+ int brightness = (hsbHex) & 0xff;
+ return hsb2rgb(hue, saturation, brightness);
+ }
+
+ public static int hsb2rgb(float hue, float saturation, float brightness) {
+ return Color.HSBtoRGB(hue, saturation, brightness);
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/CompareUtility.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/CompareUtility.java
index 40b7397845..24055532ff 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/CompareUtility.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/CompareUtility.java
@@ -1,90 +1,90 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import java.lang.reflect.Array;
-
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-
-public final class CompareUtility {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(CompareUtility.class);
-
- private CompareUtility() {
- }
-
- public static <T> boolean equals(T a, T b) {
- // object level check
- if (a == null && b == null) {
- return true;
- }
- else if (a == null) {
- return false;
- }
- else if (b == null) {
- return false;
- }
- if (a.equals(b)) {
- return true;
- }
- // array check
- if (a.getClass().isArray() && b.getClass().isArray()) {
- int na = Array.getLength(a);
- int nb = Array.getLength(b);
- if (na != nb) {
- return false;
- }
- for (int i = 0; i < na; i++) {
- if (!equals(Array.get(a, i), Array.get(b, i))) {
- return false;
- }
- }
- return true;
- }
- return false;
- }
-
- public static <T> boolean notEquals(T a, T b) {
- return !equals(a, b);
- }
-
- public static <T extends Comparable<T>> int compareTo(T a, T b) {
- if (a == null && b == null) {
- return 0;
- }
- else if (a == null) {
- return -1;
- }
- else if (b == null) {
- return 1;
- }
- else {
- return a.compareTo(b);
- }
- }
-
- /**
- * @return Returns <code>true</code> if the given object is in the list of the given elements. The objects are
- * compared using {@link #equals(Object)}.
- * @since 3.8.1
- */
- public static boolean isOneOf(Object o, Object... elements) {
- if (elements == null || elements.length == 0) {
- return false;
- }
- for (Object e : elements) {
- if (CompareUtility.equals(o, e)) {
- return true;
- }
- }
- return false;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import java.lang.reflect.Array;
+
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+
+public final class CompareUtility {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(CompareUtility.class);
+
+ private CompareUtility() {
+ }
+
+ public static <T> boolean equals(T a, T b) {
+ // object level check
+ if (a == null && b == null) {
+ return true;
+ }
+ else if (a == null) {
+ return false;
+ }
+ else if (b == null) {
+ return false;
+ }
+ if (a.equals(b)) {
+ return true;
+ }
+ // array check
+ if (a.getClass().isArray() && b.getClass().isArray()) {
+ int na = Array.getLength(a);
+ int nb = Array.getLength(b);
+ if (na != nb) {
+ return false;
+ }
+ for (int i = 0; i < na; i++) {
+ if (!equals(Array.get(a, i), Array.get(b, i))) {
+ return false;
+ }
+ }
+ return true;
+ }
+ return false;
+ }
+
+ public static <T> boolean notEquals(T a, T b) {
+ return !equals(a, b);
+ }
+
+ public static <T extends Comparable<T>> int compareTo(T a, T b) {
+ if (a == null && b == null) {
+ return 0;
+ }
+ else if (a == null) {
+ return -1;
+ }
+ else if (b == null) {
+ return 1;
+ }
+ else {
+ return a.compareTo(b);
+ }
+ }
+
+ /**
+ * @return Returns <code>true</code> if the given object is in the list of the given elements. The objects are
+ * compared using {@link #equals(Object)}.
+ * @since 3.8.1
+ */
+ public static boolean isOneOf(Object o, Object... elements) {
+ if (elements == null || elements.length == 0) {
+ return false;
+ }
+ for (Object e : elements) {
+ if (CompareUtility.equals(o, e)) {
+ return true;
+ }
+ }
+ return false;
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/CompositeLong.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/CompositeLong.java
index d7eb06ca62..fbbaa1ba82 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/CompositeLong.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/CompositeLong.java
@@ -1,92 +1,92 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import java.io.Serializable;
-
-/**
- * used in sorted maps and sets when dealing with composite sorting criteria
- */
-public class CompositeLong implements Comparable, Serializable {
- private static final long serialVersionUID = 0L;
- private long[] m_value;
-
- public CompositeLong(long[] a) {
- m_value = a;
- }
-
- public CompositeLong(long a) {
- m_value = new long[]{a};
- }
-
- public CompositeLong(long a, long b) {
- m_value = new long[]{a, b};
- }
-
- public CompositeLong(long a, long b, long c) {
- m_value = new long[]{a, b, c};
- }
-
- public CompositeLong(long a, long b, long c, long d) {
- m_value = new long[]{a, b, c, d};
- }
-
- @Override
- public int hashCode() {
- long h = 0;
- for (int i = 0; i < m_value.length; i++) {
- h = h ^ m_value[i];
- }
- return (int) h;
- }
-
- @Override
- public boolean equals(Object o) {
- if (o == null) {
- return false;
- }
- return compareTo(o) == 0;
- }
-
- @Override
- public int compareTo(Object o) {
- long[] me = this.m_value;
- long[] other = ((CompositeLong) o).m_value;
- for (int i = 0; i < me.length && i < other.length; i++) {
- if (me[i] < other[i]) {
- return -1;
- }
- if (me[i] > other[i]) {
- return 1;
- }
- }
- if (me.length < other.length) {
- return -1;
- }
- if (me.length > other.length) {
- return 1;
- }
- return 0;
- }
-
- @Override
- public String toString() {
- String s = "[";
- for (int i = 0; i < m_value.length; i++) {
- s += String.valueOf(m_value[i]);
- if (i + 1 < m_value.length) {
- s += ",";
- }
- }
- s += "]";
- return s;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import java.io.Serializable;
+
+/**
+ * used in sorted maps and sets when dealing with composite sorting criteria
+ */
+public class CompositeLong implements Comparable, Serializable {
+ private static final long serialVersionUID = 0L;
+ private long[] m_value;
+
+ public CompositeLong(long[] a) {
+ m_value = a;
+ }
+
+ public CompositeLong(long a) {
+ m_value = new long[]{a};
+ }
+
+ public CompositeLong(long a, long b) {
+ m_value = new long[]{a, b};
+ }
+
+ public CompositeLong(long a, long b, long c) {
+ m_value = new long[]{a, b, c};
+ }
+
+ public CompositeLong(long a, long b, long c, long d) {
+ m_value = new long[]{a, b, c, d};
+ }
+
+ @Override
+ public int hashCode() {
+ long h = 0;
+ for (int i = 0; i < m_value.length; i++) {
+ h = h ^ m_value[i];
+ }
+ return (int) h;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o == null) {
+ return false;
+ }
+ return compareTo(o) == 0;
+ }
+
+ @Override
+ public int compareTo(Object o) {
+ long[] me = this.m_value;
+ long[] other = ((CompositeLong) o).m_value;
+ for (int i = 0; i < me.length && i < other.length; i++) {
+ if (me[i] < other[i]) {
+ return -1;
+ }
+ if (me[i] > other[i]) {
+ return 1;
+ }
+ }
+ if (me.length < other.length) {
+ return -1;
+ }
+ if (me.length > other.length) {
+ return 1;
+ }
+ return 0;
+ }
+
+ @Override
+ public String toString() {
+ String s = "[";
+ for (int i = 0; i < m_value.length; i++) {
+ s += String.valueOf(m_value[i]);
+ if (i + 1 < m_value.length) {
+ s += ",";
+ }
+ }
+ s += "]";
+ return s;
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/CompositeObject.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/CompositeObject.java
index 0229b4a768..6a52a142d5 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/CompositeObject.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/CompositeObject.java
@@ -1,105 +1,105 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import java.io.Serializable;
-
-/**
- * used in sorted maps and sets when dealing with composite sorting criteria
- */
-public class CompositeObject implements Comparable<CompositeObject>, Serializable {
- private static final long serialVersionUID = 0L;
- private Object[] m_value;
-
- public CompositeObject(Object... a) {
- m_value = a;
- }
-
- @Override
- public int hashCode() {
- long h = 0;
- for (Object v : m_value) {
- if (v != null) {
- h = h ^ v.hashCode();
- }
- }
- return (int) h;
- }
-
- @Override
- public boolean equals(Object o) {
- if (!(o instanceof CompositeObject)) {
- return false;
- }
- return compareTo((CompositeObject) o) == 0;
- }
-
- public int getComponentCount() {
- return m_value.length;
- }
-
- public Object getComponent(int index) {
- return m_value[index];
- }
-
- public Object[] getComponents() {
- return m_value;
- }
-
- @Override
- public int compareTo(CompositeObject o) {
- Object[] me = this.m_value;
- Object[] other = o.m_value;
- for (int i = 0; i < me.length && i < other.length; i++) {
- int c = compareImpl(me[i], other[i]);
- if (c != 0) {
- return c;
- }
- }
- if (me.length < other.length) {
- return -1;
- }
- if (me.length > other.length) {
- return 1;
- }
- return 0;
- }
-
- @SuppressWarnings("unchecked")
- private int compareImpl(Object a, Object b) {
- if (a == null && b == null) {
- return 0;
- }
- if (a == null) {
- return -1;
- }
- if (b == null) {
- return 1;
- }
- if ((a instanceof Comparable) && (b instanceof Comparable)) {
- return ((Comparable) a).compareTo(b);
- }
- return a.toString().compareTo(b.toString());
- }
-
- @Override
- public String toString() {
- String s = "[";
- for (int i = 0; i < m_value.length; i++) {
- s += String.valueOf(m_value[i]);
- if (i + 1 < m_value.length) {
- s += ",";
- }
- }
- s += "]";
- return s;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import java.io.Serializable;
+
+/**
+ * used in sorted maps and sets when dealing with composite sorting criteria
+ */
+public class CompositeObject implements Comparable<CompositeObject>, Serializable {
+ private static final long serialVersionUID = 0L;
+ private Object[] m_value;
+
+ public CompositeObject(Object... a) {
+ m_value = a;
+ }
+
+ @Override
+ public int hashCode() {
+ long h = 0;
+ for (Object v : m_value) {
+ if (v != null) {
+ h = h ^ v.hashCode();
+ }
+ }
+ return (int) h;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (!(o instanceof CompositeObject)) {
+ return false;
+ }
+ return compareTo((CompositeObject) o) == 0;
+ }
+
+ public int getComponentCount() {
+ return m_value.length;
+ }
+
+ public Object getComponent(int index) {
+ return m_value[index];
+ }
+
+ public Object[] getComponents() {
+ return m_value;
+ }
+
+ @Override
+ public int compareTo(CompositeObject o) {
+ Object[] me = this.m_value;
+ Object[] other = o.m_value;
+ for (int i = 0; i < me.length && i < other.length; i++) {
+ int c = compareImpl(me[i], other[i]);
+ if (c != 0) {
+ return c;
+ }
+ }
+ if (me.length < other.length) {
+ return -1;
+ }
+ if (me.length > other.length) {
+ return 1;
+ }
+ return 0;
+ }
+
+ @SuppressWarnings("unchecked")
+ private int compareImpl(Object a, Object b) {
+ if (a == null && b == null) {
+ return 0;
+ }
+ if (a == null) {
+ return -1;
+ }
+ if (b == null) {
+ return 1;
+ }
+ if ((a instanceof Comparable) && (b instanceof Comparable)) {
+ return ((Comparable) a).compareTo(b);
+ }
+ return a.toString().compareTo(b.toString());
+ }
+
+ @Override
+ public String toString() {
+ String s = "[";
+ for (int i = 0; i < m_value.length; i++) {
+ s += String.valueOf(m_value[i]);
+ if (i + 1 < m_value.length) {
+ s += ",";
+ }
+ }
+ s += "]";
+ return s;
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/CompressedObjectReader.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/CompressedObjectReader.java
index c7eb149dc0..89717a36ee 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/CompressedObjectReader.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/CompressedObjectReader.java
@@ -1,67 +1,67 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import java.io.ByteArrayInputStream;
-import java.io.EOFException;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.util.zip.InflaterInputStream;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-
-/**
- * Class to get java instances from a compressed byte array created with
- * CompressedObjectWriter.
- */
-public class CompressedObjectReader {
-
- private ObjectInputStream in;
- private Object currentObject;
-
- public CompressedObjectReader(byte[] data) throws ProcessingException {
- try {
- currentObject = null;
- InflaterInputStream iis = new InflaterInputStream(new ByteArrayInputStream(data));
- in = new ObjectInputStream(iis);
- }
- catch (IOException e) {
- throw new ProcessingException(e.getMessage(), e);
- }
- }
-
- public boolean next() throws ProcessingException {
- try {
- currentObject = in.readObject();
- return true;
- }
- catch (EOFException e) {
- currentObject = null;
- return false;
- }
- catch (Exception e) {
- currentObject = null;
- throw new ProcessingException(e.getMessage(), e);
- }
- }
-
- public Object getCurrentObject() {
- return currentObject;
- }
-
- public void close() {
- try {
- in.close();
- }
- catch (IOException e) {
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import java.io.ByteArrayInputStream;
+import java.io.EOFException;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.util.zip.InflaterInputStream;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+
+/**
+ * Class to get java instances from a compressed byte array created with
+ * CompressedObjectWriter.
+ */
+public class CompressedObjectReader {
+
+ private ObjectInputStream in;
+ private Object currentObject;
+
+ public CompressedObjectReader(byte[] data) throws ProcessingException {
+ try {
+ currentObject = null;
+ InflaterInputStream iis = new InflaterInputStream(new ByteArrayInputStream(data));
+ in = new ObjectInputStream(iis);
+ }
+ catch (IOException e) {
+ throw new ProcessingException(e.getMessage(), e);
+ }
+ }
+
+ public boolean next() throws ProcessingException {
+ try {
+ currentObject = in.readObject();
+ return true;
+ }
+ catch (EOFException e) {
+ currentObject = null;
+ return false;
+ }
+ catch (Exception e) {
+ currentObject = null;
+ throw new ProcessingException(e.getMessage(), e);
+ }
+ }
+
+ public Object getCurrentObject() {
+ return currentObject;
+ }
+
+ public void close() {
+ try {
+ in.close();
+ }
+ catch (IOException e) {
+ }
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/CompressedObjectWriter.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/CompressedObjectWriter.java
index 4a77259d06..5eec5ff0db 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/CompressedObjectWriter.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/CompressedObjectWriter.java
@@ -1,91 +1,91 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectOutputStream;
-import java.util.zip.Deflater;
-import java.util.zip.DeflaterOutputStream;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-
-/**
- * Class to write java instances into a compressed byte array. Use
- * CompressedObjectReader to unpack the byte array back into instances.
- */
-public class CompressedObjectWriter {
- private ObjectOutputStream out;
- private DeflaterOutputStream zipOut;
- private ByteArrayOutputStream bytesOut;
-
- public CompressedObjectWriter(int outputBufferSize, int zipBufferSize) throws ProcessingException {
- try {
- Deflater d = new Deflater();
- d.setLevel(Deflater.BEST_COMPRESSION);
-
- bytesOut = new ByteArrayOutputStream(outputBufferSize);
- zipOut = new DeflaterOutputStream(bytesOut, d, zipBufferSize);
- out = new ObjectOutputStream(zipOut);
- }
- catch (IOException e) {
- throw new ProcessingException(e.getMessage(), e);
- }
- }
-
- public void compress(Object o) throws ProcessingException {
- try {
- out.writeObject(o);
- }
- catch (IOException e) {
- throw new ProcessingException(e.getMessage(), e);
- }
- }
-
- public byte[] getCompressedBytes() throws ProcessingException {
- try {
- out.flush();
- zipOut.finish();
- zipOut.flush();
- return bytesOut.toByteArray();
- }
- catch (IOException e) {
- throw new ProcessingException(e.getMessage(), e);
- }
- }
-
- public void close() {
- try {
- out.close();
- }
- catch (IOException e) {
- }
-
- try {
- zipOut.close();
- }
- catch (IOException e) {
- }
- }
-
- /**
- * @see java.io.ObjectOutputStream#reset()
- * @throws ProcessingException
- */
- public void resetWrittenObjectCache() throws ProcessingException {
- try {
- out.reset();
- }
- catch (IOException e) {
- throw new ProcessingException(e.getMessage(), e);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+import java.util.zip.Deflater;
+import java.util.zip.DeflaterOutputStream;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+
+/**
+ * Class to write java instances into a compressed byte array. Use
+ * CompressedObjectReader to unpack the byte array back into instances.
+ */
+public class CompressedObjectWriter {
+ private ObjectOutputStream out;
+ private DeflaterOutputStream zipOut;
+ private ByteArrayOutputStream bytesOut;
+
+ public CompressedObjectWriter(int outputBufferSize, int zipBufferSize) throws ProcessingException {
+ try {
+ Deflater d = new Deflater();
+ d.setLevel(Deflater.BEST_COMPRESSION);
+
+ bytesOut = new ByteArrayOutputStream(outputBufferSize);
+ zipOut = new DeflaterOutputStream(bytesOut, d, zipBufferSize);
+ out = new ObjectOutputStream(zipOut);
+ }
+ catch (IOException e) {
+ throw new ProcessingException(e.getMessage(), e);
+ }
+ }
+
+ public void compress(Object o) throws ProcessingException {
+ try {
+ out.writeObject(o);
+ }
+ catch (IOException e) {
+ throw new ProcessingException(e.getMessage(), e);
+ }
+ }
+
+ public byte[] getCompressedBytes() throws ProcessingException {
+ try {
+ out.flush();
+ zipOut.finish();
+ zipOut.flush();
+ return bytesOut.toByteArray();
+ }
+ catch (IOException e) {
+ throw new ProcessingException(e.getMessage(), e);
+ }
+ }
+
+ public void close() {
+ try {
+ out.close();
+ }
+ catch (IOException e) {
+ }
+
+ try {
+ zipOut.close();
+ }
+ catch (IOException e) {
+ }
+ }
+
+ /**
+ * @see java.io.ObjectOutputStream#reset()
+ * @throws ProcessingException
+ */
+ public void resetWrittenObjectCache() throws ProcessingException {
+ try {
+ out.reset();
+ }
+ catch (IOException e) {
+ throw new ProcessingException(e.getMessage(), e);
+ }
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/ConfigIniProperty.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/ConfigIniProperty.java
index c96c1ad2a2..9e862fa0f1 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/ConfigIniProperty.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/ConfigIniProperty.java
@@ -1,61 +1,61 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-/**
- * A config bean property is a config.ini entry in the format
- * beanName#propertyName=value Example config.ini entries:
- * com.myapp.MyService#realm=MyRealm
- * <p>
- * realm=MyRealm2 com.myapp.MyService#realm=${realm}
- */
-public class ConfigIniProperty {
- private String beanName;
- private String filter;
- private String propertyName;
- private String value;
-
- public ConfigIniProperty(String beanName, String filter, String propertyName, String value) {
- this.beanName = beanName;
- this.filter = filter;
- this.propertyName = propertyName;
- this.value = value;
- }
-
- /**
- * Examples<br>
- * <li>com.mypackage.MyService</li> <li>com.mypackage.MyFilter, com.mypackage.MyBean</li>
- */
- public String getBeanName() {
- return beanName;
- }
-
- /**
- * Examples<br>
- * <li>/process</li> <li>/query</li>
- */
- public String getFilter() {
- return filter;
- }
-
- /**
- * Examples<br>
- * <li>name</li> <li>realm</li> <li>username</li>
- */
- public String getPropertyName() {
- return propertyName;
- }
-
- public String getValue() {
- return value;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+/**
+ * A config bean property is a config.ini entry in the format
+ * beanName#propertyName=value Example config.ini entries:
+ * com.myapp.MyService#realm=MyRealm
+ * <p>
+ * realm=MyRealm2 com.myapp.MyService#realm=${realm}
+ */
+public class ConfigIniProperty {
+ private String beanName;
+ private String filter;
+ private String propertyName;
+ private String value;
+
+ public ConfigIniProperty(String beanName, String filter, String propertyName, String value) {
+ this.beanName = beanName;
+ this.filter = filter;
+ this.propertyName = propertyName;
+ this.value = value;
+ }
+
+ /**
+ * Examples<br>
+ * <li>com.mypackage.MyService</li> <li>com.mypackage.MyFilter, com.mypackage.MyBean</li>
+ */
+ public String getBeanName() {
+ return beanName;
+ }
+
+ /**
+ * Examples<br>
+ * <li>/process</li> <li>/query</li>
+ */
+ public String getFilter() {
+ return filter;
+ }
+
+ /**
+ * Examples<br>
+ * <li>name</li> <li>realm</li> <li>username</li>
+ */
+ public String getPropertyName() {
+ return propertyName;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/ConfigIniUtility.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/ConfigIniUtility.java
index b822336328..44d33484c9 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/ConfigIniUtility.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/ConfigIniUtility.java
@@ -1,248 +1,248 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.InputStreamReader;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-
-/**
- * Utility to extract config.ini entries of the formats
- * <p>
- * <li>classOrInterfaceName#propertyName=value</li>
- * <li>classOrInterfaceName/filter#propertyName=value</li>
- * <p>
- * Example entries
- * <li>com.myapp.MyService#realm=MyRealm</li>
- * <li>realm=MyRealm2</li>
- * <li>com.myapp.MyService#realm=${realm}</li>
- * <li>com.myapp.MyService/process#realm=ExecRealm</li>
- * <li>com.myapp.MyService/query#realm=QueryRealm</li>
- * <p>
- * Supports for config.ini files in an external area
- *
- * <pre>
- * <code>
- * external.configuration.area=[url | file | ${variable}]
- * external.configuration.area.0=[url | file | ${variable}]
- * external.configuration.area.1=[url | file | ${variable}]
- * external.configuration.area.2=[url | file | ${variable}]
- * ...
- * </code>
- * </pre>
- *
- * where ${variable} is a system property or an environment variable containing an url or a file path to the FOLDER
- * containing the config.ini
- */
-public final class ConfigIniUtility {
- private static final Pattern CONFIG_LINE_PATTERN = Pattern.compile("([^#/]+)(/[^#]+)?\\#([^=]+)=(.*)");
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(ConfigIniUtility.class);
- private static ConfigIniProperty[] configProperties;
-
- private ConfigIniUtility() {
- }
-
- static {
- ArrayList<ConfigIniProperty> parsingList = new ArrayList<ConfigIniProperty>();
- ArrayList<String> externalConfigPaths = new ArrayList<String>();
- parseLocalConfigIniFile(parsingList, externalConfigPaths);
- parseExternalConfigIniFiles(parsingList, externalConfigPaths);
- configProperties = parsingList.toArray(new ConfigIniProperty[parsingList.size()]);
- if (LOG.isInfoEnabled()) {
- LOG.info("Config Bean Properties");
- for (ConfigIniProperty p : configProperties) {
- LOG.info(" " + p.getBeanName() + "#" + p.getPropertyName() + (p.getFilter() != null ? "/" + p.getFilter() : "") + "=" + p.getValue());
- }
- }
- }
-
- public static Map<String, String> getProperties(Class beanType) {
- return getProperties(beanType, null);
- }
-
- public static Map<String, String> getProperties(Class beanType, String filter) {
- Map<String, String> props = new HashMap<String, String>();
- for (ConfigIniProperty p : configProperties) {
- if (matchesBeanClass(p, beanType, filter)) {
- String v = p.getValue();
- if (v != null && v.length() == 0) {
- v = null;
- }
- props.put(p.getPropertyName(), v);
- }
- }
- if (LOG.isInfoEnabled()) {
- LOG.info("Properties for " + beanType.getName());
- for (Map.Entry<String, String> e : props.entrySet()) {
- LOG.info(" " + e.getKey() + "=" + e.getValue());
- }
- }
- return props;
- }
-
- private static void parseLocalConfigIniFile(List<ConfigIniProperty> parsingList, List<String> externalConfigPaths) {
- String file = "config.ini";
- BufferedReader in = null;
- try {
- URL url = null;
- if (Platform.inDevelopmentMode()) {
- url = new URL(Platform.getConfigurationLocation().getURL(), file);
- }
- else {
- URL installLocationUrl = Platform.getInstallLocation().getURL();
- url = new URL(installLocationUrl, "configuration/" + file);
- }
- in = new BufferedReader(new InputStreamReader(url.openStream(), "UTF-8"));
- String line;
- while ((line = in.readLine()) != null) {
- ConfigIniProperty p = parseConfigIniLine(line);
- if (p != null) {
- parsingList.add(p);
- }
- if (line.matches("external.configuration.area(\\.[0-9]+)?=.*")) {
- externalConfigPaths.add(line.split("=", 2)[1]);
- }
- if (line.matches("osgi.sharedConfiguration.area=.*")) {
- externalConfigPaths.add(line.split("=", 2)[1]);
- }
- }
- }
- catch (Throwable t) {
- if (in != null) {
- LOG.error("parsing " + file, t);
- }
- }
- finally {
- if (in != null) {
- try {
- in.close();
- }
- catch (Throwable fatal) {
- }
- }
- }
- }
-
- private static void parseExternalConfigIniFiles(List<ConfigIniProperty> parsingList, List<String> externalConfigPaths) {
- for (String path : externalConfigPaths) {
- BufferedReader in = null;
- String resolvedPath = null;
- try {
- URL url = null;
- resolvedPath = path.replaceAll("\\\\(.)", "$1");
- if (resolvedPath.matches("\\$\\{.*\\}.*")) {
- String tail = resolvedPath.replaceAll("\\$\\{.*\\}", "");
- String variable = resolvedPath.replaceAll(tail, "");
- variable = variable.substring(2, variable.length() - 1);
- resolvedPath = System.getProperty(variable, null);
- if (resolvedPath == null) {
- resolvedPath = System.getenv(variable);
- }
- resolvedPath += tail;
- }
- if (resolvedPath == null) {
- continue;
- }
- resolvedPath = resolvedPath.replace("@user.home", System.getProperty("user.home"));
- resolvedPath = resolvedPath.replace("@user.dir", System.getProperty("user.dir"));
- File f1 = new File(resolvedPath);
- if (f1.exists()) {
- if (f1.isFile()) {
- url = f1.toURI().toURL();
- }
- else {
- url = new File(resolvedPath, "config.ini").toURI().toURL();
- }
- }
- else {
- if (resolvedPath.toLowerCase().endsWith(".ini") || resolvedPath.toLowerCase().endsWith(".properties")) {
- url = new URL(resolvedPath);
- }
- else {
- url = new URL(new URL(resolvedPath), "config.ini");
- }
- }
- in = new BufferedReader(new InputStreamReader(url.openStream(), "UTF-8"));
- String line;
- while ((line = in.readLine()) != null) {
- ConfigIniProperty p = parseConfigIniLine(line);
- if (p != null) {
- parsingList.add(p);
- }
- }
- }
- catch (Throwable t) {
- if (in != null) {
- LOG.error("parsing external file " + path + " (" + resolvedPath + ")", t);
- }
- }
- finally {
- if (in != null) {
- try {
- in.close();
- }
- catch (Throwable fatal) {
- }
- }
- }
- }
- }
-
- private static ConfigIniProperty parseConfigIniLine(String configLine) {
- if (configLine != null) {
- configLine = configLine.replaceAll("\\\\(.)", "$1");
- Matcher m = CONFIG_LINE_PATTERN.matcher(configLine);
- if (m.matches()) {
- String filter = m.group(2);
- if (filter != null && filter.startsWith("/")) {
- // ok
- }
- else {
- filter = null;
- }
- ConfigIniProperty p = new ConfigIniProperty(m.group(1), filter, m.group(3), BundleContextUtility.resolve(m.group(4)));
- return p;
- }
- }
- return null;
- }
-
- /**
- * returns true if this property bean type is equal or a supertype of the
- * parameter type
- */
- @SuppressWarnings("unchecked")
- private static boolean matchesBeanClass(ConfigIniProperty p, Class parameterType, String filter) {
- try {
- Class myType = Class.forName(p.getBeanName(), false, parameterType.getClassLoader());
- if (myType.isAssignableFrom(parameterType)) {
- if (filter == null || p.getFilter() == null || filter.equals(p.getFilter())) {
- return true;
- }
- }
- }
- catch (Throwable t) {
- }
- return false;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+
+/**
+ * Utility to extract config.ini entries of the formats
+ * <p>
+ * <li>classOrInterfaceName#propertyName=value</li>
+ * <li>classOrInterfaceName/filter#propertyName=value</li>
+ * <p>
+ * Example entries
+ * <li>com.myapp.MyService#realm=MyRealm</li>
+ * <li>realm=MyRealm2</li>
+ * <li>com.myapp.MyService#realm=${realm}</li>
+ * <li>com.myapp.MyService/process#realm=ExecRealm</li>
+ * <li>com.myapp.MyService/query#realm=QueryRealm</li>
+ * <p>
+ * Supports for config.ini files in an external area
+ *
+ * <pre>
+ * <code>
+ * external.configuration.area=[url | file | ${variable}]
+ * external.configuration.area.0=[url | file | ${variable}]
+ * external.configuration.area.1=[url | file | ${variable}]
+ * external.configuration.area.2=[url | file | ${variable}]
+ * ...
+ * </code>
+ * </pre>
+ *
+ * where ${variable} is a system property or an environment variable containing an url or a file path to the FOLDER
+ * containing the config.ini
+ */
+public final class ConfigIniUtility {
+ private static final Pattern CONFIG_LINE_PATTERN = Pattern.compile("([^#/]+)(/[^#]+)?\\#([^=]+)=(.*)");
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(ConfigIniUtility.class);
+ private static ConfigIniProperty[] configProperties;
+
+ private ConfigIniUtility() {
+ }
+
+ static {
+ ArrayList<ConfigIniProperty> parsingList = new ArrayList<ConfigIniProperty>();
+ ArrayList<String> externalConfigPaths = new ArrayList<String>();
+ parseLocalConfigIniFile(parsingList, externalConfigPaths);
+ parseExternalConfigIniFiles(parsingList, externalConfigPaths);
+ configProperties = parsingList.toArray(new ConfigIniProperty[parsingList.size()]);
+ if (LOG.isInfoEnabled()) {
+ LOG.info("Config Bean Properties");
+ for (ConfigIniProperty p : configProperties) {
+ LOG.info(" " + p.getBeanName() + "#" + p.getPropertyName() + (p.getFilter() != null ? "/" + p.getFilter() : "") + "=" + p.getValue());
+ }
+ }
+ }
+
+ public static Map<String, String> getProperties(Class beanType) {
+ return getProperties(beanType, null);
+ }
+
+ public static Map<String, String> getProperties(Class beanType, String filter) {
+ Map<String, String> props = new HashMap<String, String>();
+ for (ConfigIniProperty p : configProperties) {
+ if (matchesBeanClass(p, beanType, filter)) {
+ String v = p.getValue();
+ if (v != null && v.length() == 0) {
+ v = null;
+ }
+ props.put(p.getPropertyName(), v);
+ }
+ }
+ if (LOG.isInfoEnabled()) {
+ LOG.info("Properties for " + beanType.getName());
+ for (Map.Entry<String, String> e : props.entrySet()) {
+ LOG.info(" " + e.getKey() + "=" + e.getValue());
+ }
+ }
+ return props;
+ }
+
+ private static void parseLocalConfigIniFile(List<ConfigIniProperty> parsingList, List<String> externalConfigPaths) {
+ String file = "config.ini";
+ BufferedReader in = null;
+ try {
+ URL url = null;
+ if (Platform.inDevelopmentMode()) {
+ url = new URL(Platform.getConfigurationLocation().getURL(), file);
+ }
+ else {
+ URL installLocationUrl = Platform.getInstallLocation().getURL();
+ url = new URL(installLocationUrl, "configuration/" + file);
+ }
+ in = new BufferedReader(new InputStreamReader(url.openStream(), "UTF-8"));
+ String line;
+ while ((line = in.readLine()) != null) {
+ ConfigIniProperty p = parseConfigIniLine(line);
+ if (p != null) {
+ parsingList.add(p);
+ }
+ if (line.matches("external.configuration.area(\\.[0-9]+)?=.*")) {
+ externalConfigPaths.add(line.split("=", 2)[1]);
+ }
+ if (line.matches("osgi.sharedConfiguration.area=.*")) {
+ externalConfigPaths.add(line.split("=", 2)[1]);
+ }
+ }
+ }
+ catch (Throwable t) {
+ if (in != null) {
+ LOG.error("parsing " + file, t);
+ }
+ }
+ finally {
+ if (in != null) {
+ try {
+ in.close();
+ }
+ catch (Throwable fatal) {
+ }
+ }
+ }
+ }
+
+ private static void parseExternalConfigIniFiles(List<ConfigIniProperty> parsingList, List<String> externalConfigPaths) {
+ for (String path : externalConfigPaths) {
+ BufferedReader in = null;
+ String resolvedPath = null;
+ try {
+ URL url = null;
+ resolvedPath = path.replaceAll("\\\\(.)", "$1");
+ if (resolvedPath.matches("\\$\\{.*\\}.*")) {
+ String tail = resolvedPath.replaceAll("\\$\\{.*\\}", "");
+ String variable = resolvedPath.replaceAll(tail, "");
+ variable = variable.substring(2, variable.length() - 1);
+ resolvedPath = System.getProperty(variable, null);
+ if (resolvedPath == null) {
+ resolvedPath = System.getenv(variable);
+ }
+ resolvedPath += tail;
+ }
+ if (resolvedPath == null) {
+ continue;
+ }
+ resolvedPath = resolvedPath.replace("@user.home", System.getProperty("user.home"));
+ resolvedPath = resolvedPath.replace("@user.dir", System.getProperty("user.dir"));
+ File f1 = new File(resolvedPath);
+ if (f1.exists()) {
+ if (f1.isFile()) {
+ url = f1.toURI().toURL();
+ }
+ else {
+ url = new File(resolvedPath, "config.ini").toURI().toURL();
+ }
+ }
+ else {
+ if (resolvedPath.toLowerCase().endsWith(".ini") || resolvedPath.toLowerCase().endsWith(".properties")) {
+ url = new URL(resolvedPath);
+ }
+ else {
+ url = new URL(new URL(resolvedPath), "config.ini");
+ }
+ }
+ in = new BufferedReader(new InputStreamReader(url.openStream(), "UTF-8"));
+ String line;
+ while ((line = in.readLine()) != null) {
+ ConfigIniProperty p = parseConfigIniLine(line);
+ if (p != null) {
+ parsingList.add(p);
+ }
+ }
+ }
+ catch (Throwable t) {
+ if (in != null) {
+ LOG.error("parsing external file " + path + " (" + resolvedPath + ")", t);
+ }
+ }
+ finally {
+ if (in != null) {
+ try {
+ in.close();
+ }
+ catch (Throwable fatal) {
+ }
+ }
+ }
+ }
+ }
+
+ private static ConfigIniProperty parseConfigIniLine(String configLine) {
+ if (configLine != null) {
+ configLine = configLine.replaceAll("\\\\(.)", "$1");
+ Matcher m = CONFIG_LINE_PATTERN.matcher(configLine);
+ if (m.matches()) {
+ String filter = m.group(2);
+ if (filter != null && filter.startsWith("/")) {
+ // ok
+ }
+ else {
+ filter = null;
+ }
+ ConfigIniProperty p = new ConfigIniProperty(m.group(1), filter, m.group(3), BundleContextUtility.resolve(m.group(4)));
+ return p;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * returns true if this property bean type is equal or a supertype of the
+ * parameter type
+ */
+ @SuppressWarnings("unchecked")
+ private static boolean matchesBeanClass(ConfigIniProperty p, Class parameterType, String filter) {
+ try {
+ Class myType = Class.forName(p.getBeanName(), false, parameterType.getClassLoader());
+ if (myType.isAssignableFrom(parameterType)) {
+ if (filter == null || p.getFilter() == null || filter.equals(p.getFilter())) {
+ return true;
+ }
+ }
+ }
+ catch (Throwable t) {
+ }
+ return false;
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/ConfigurationUtility.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/ConfigurationUtility.java
index b544f501d7..ac34c39224 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/ConfigurationUtility.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/ConfigurationUtility.java
@@ -1,264 +1,264 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.TreeMap;
-
-import org.eclipse.scout.commons.annotations.IOrdered;
-import org.eclipse.scout.commons.annotations.InjectFieldTo;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-
-/**
- * Configuration-related utilities.
- */
-public final class ConfigurationUtility {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(ConfigurationUtility.class);
-
- private ConfigurationUtility() {
- }
-
- /**
- * Filters the given class array and sorts the remaining elements according to
- * their {@link Order} annotation.
- * <p>
- * By default, the method throws an {@link IllegalArgumentException} if one of the remaining classes is not annotated
- * by {@link Order}. The behavior can be switched off by setting the system property
- * <code>bsi.debug.innerclass.order</code> to an arbitrary value.
- *
- * @param classes
- * @param filter
- * @return
- * @throws IllegalArgumentException
- */
- @SuppressWarnings("unchecked")
- public static <T> Class<T>[] sortFilteredClassesByOrderAnnotation(Class[] classes, Class<T> filter) {
- TreeMap<CompositeObject, Class> orderedClassesMap = new TreeMap<CompositeObject, Class>();
- for (int i = 0; i < classes.length; i++) {
- if (filter.isAssignableFrom(classes[i])) {
- if (classes[i].isAnnotationPresent(Order.class)) {
- Order order = (Order) classes[i].getAnnotation(Order.class);
- orderedClassesMap.put(new CompositeObject(order.value(), i), classes[i]);
- }
- else {
- LOG.error("missing @Order annotation: " + classes[i].getName());
- orderedClassesMap.put(new CompositeObject(Double.MAX_VALUE, i), classes[i]);
- }
- }
- }
- return orderedClassesMap.values().toArray(new Class[orderedClassesMap.size()]);
- }
-
- /**
- * @deprecated use {@link #sortByOrder(Collection)} instead.
- */
- @Deprecated
- public static <T> Collection<T> sortByOrderAnnotation(Collection<T> list) {
- return sortByOrder(list);
- }
-
- /**
- * Sorts the elements according to their order:
- * <ol>
- * <li>If an {@link Order} annotation is available, its {@link Order#value()} is used</li>
- * <li>If the object implements {@link IOrdered}, {@link IOrdered#getOrder()} is used.</li>
- * <li>Finally, the index in the original collection is used</li>
- * </ol>
- *
- * @since 3.8.1
- */
- public static <T> Collection<T> sortByOrder(Collection<T> list) {
- if (list == null) {
- return null;
- }
- TreeMap<CompositeObject, T> sortMap = new TreeMap<CompositeObject, T>();
- int index = 0;
- for (T element : list) {
- Class<?> c = element.getClass();
- double order;
- if (c.isAnnotationPresent(Order.class)) {
- order = c.getAnnotation(Order.class).value();
- }
- else if (element instanceof IOrdered) {
- order = ((IOrdered) element).getOrder();
- }
- else {
- order = (double) index;
- }
- sortMap.put(new CompositeObject(order, index), element);
- index++;
- }
- return sortMap.values();
- }
-
- /**
- * Filters the given class array and returns the first occurrence of an
- * instantiable class of filter
- *
- * @param classes
- * @param filter
- * @return first occurrence of filter, might be annotated with {@link InjectFieldTo}
- */
- @SuppressWarnings("unchecked")
- public static <T> Class<T> filterClass(Class[] classes, Class<T> filter) {
- for (Class c : classes) {
- if (filter.isAssignableFrom(c) && !Modifier.isAbstract(c.getModifiers())) {
- return c;
- }
- }
- return null;
- }
-
- /**
- * same as {@link #filterClass(Class[], Class)} but ignoring classes with {@link InjectFieldTo} annotation
- *
- * @since 3.8.1
- */
- @SuppressWarnings("unchecked")
- public static <T> Class<T> filterClassIgnoringInjectFieldAnnotation(Class[] classes, Class<T> filter) {
- for (Class c : classes) {
- if (filter.isAssignableFrom(c) && !Modifier.isAbstract(c.getModifiers())) {
- if (!c.isAnnotationPresent(InjectFieldTo.class)) {
- return c;
- }
- }
- }
- return null;
- }
-
- /**
- * Filters the given class array and returns all occurrences of instantiable
- * classes of filter
- *
- * @param classes
- * @param filter
- * @return all occurrences of filter
- * @since 3.8.1
- */
- @SuppressWarnings("unchecked")
- public static <T> Class<T>[] filterClasses(Class[] classes, Class<T> filter) {
- ArrayList<Class<T>> list = new ArrayList<Class<T>>();
- for (Class c : classes) {
- if (filter.isAssignableFrom(c) && !Modifier.isAbstract(c.getModifiers())) {
- list.add(c);
- }
- }
- return list.toArray(new Class[0]);
- }
-
- /**
- * same as {@link #filterClasses(Class[], Class)} but ignoring classes with {@link InjectFieldTo} annotation
- *
- * @since 3.8.1
- */
- @SuppressWarnings("unchecked")
- public static <T> Class<T>[] filterClassesIgnoringInjectFieldAnnotation(Class[] classes, Class<T> filter) {
- ArrayList<Class<T>> list = new ArrayList<Class<T>>();
- for (Class c : classes) {
- if (filter.isAssignableFrom(c) && !Modifier.isAbstract(c.getModifiers())) {
- if (!c.isAnnotationPresent(InjectFieldTo.class)) {
- list.add(c);
- }
- }
- }
- return list.toArray(new Class[0]);
- }
-
- /**
- * same as {@link #filterClasses(Class[], Class)} but only accepting classes with {@link InjectFieldTo} annotation
- *
- * @since 3.8.1
- */
- @SuppressWarnings("unchecked")
- public static <T> Class<T>[] filterClassesWithInjectFieldAnnotation(Class[] classes, Class<T> filter) {
- ArrayList<Class<T>> list = new ArrayList<Class<T>>();
- for (Class c : classes) {
- if (filter.isAssignableFrom(c) && !Modifier.isAbstract(c.getModifiers())) {
- if (c.isAnnotationPresent(InjectFieldTo.class)) {
- list.add(c);
- }
- }
- }
- return list.toArray(new Class[0]);
- }
-
- /**
- * get all declared classes (inner types) of the specified class and all its
- * super classes
- */
- public static Class[] getDeclaredPublicClasses(Class c) {
- return c.getClasses();
- }
-
- public static <T> T newInnerInstance(Object instance, Class<T> innerClass) throws Exception {
- if (innerClass.getDeclaringClass() != null && (innerClass.getModifiers() & Modifier.STATIC) == 0) {
- Constructor<T> c = innerClass.getDeclaredConstructor(new Class[]{innerClass.getDeclaringClass()});
- return c.newInstance(new Object[]{instance});
- }
- else {
- return innerClass.newInstance();
- }
- }
-
- /**
- * @return true if the declared method is overwritten in implementationType
- */
- public static boolean isMethodOverwrite(Class<?> declaringType, String methodName, Class[] parameterTypes, Class<?> implementationType) {
- try {
- Method declaredMethod;
- try {
- declaredMethod = declaringType.getDeclaredMethod(methodName, parameterTypes);
- }
- catch (NoSuchMethodException e) {
- LOG.error("cannot find declared method " + declaringType.getName() + "." + methodName, e);
- return false;
- }
- Class<?> c = implementationType;
- while (c != null && c != declaringType) {
- try {
- //check if method is avaliable
- c.getDeclaredMethod(declaredMethod.getName(), declaredMethod.getParameterTypes());
- return true;
- }
- catch (NoSuchMethodException e) {
- //nop
- }
- //up
- c = c.getSuperclass();
- }
- }
- catch (Throwable t) {
- LOG.error("declaringType=" + declaringType + ", methodName=" + methodName + ", parameterTypes=" + parameterTypes + ", implementationType=" + implementationType, t);
- }
- return false;
- }
-
- /**
- * @return Returns the given objects enclosing container type, i.e the first class on the enclosing classes path that
- * is abstract or the outermost enclosing class. The latter is the primary type.
- */
- public static Class<?> getEnclosingContainerType(Object o) {
- if (o == null) {
- return null;
- }
- Class<?> c = o.getClass();
- while (!Modifier.isAbstract(c.getModifiers()) && c.getEnclosingClass() != null) {
- c = c.getEnclosingClass();
- }
- return c;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.TreeMap;
+
+import org.eclipse.scout.commons.annotations.IOrdered;
+import org.eclipse.scout.commons.annotations.InjectFieldTo;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+
+/**
+ * Configuration-related utilities.
+ */
+public final class ConfigurationUtility {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(ConfigurationUtility.class);
+
+ private ConfigurationUtility() {
+ }
+
+ /**
+ * Filters the given class array and sorts the remaining elements according to
+ * their {@link Order} annotation.
+ * <p>
+ * By default, the method throws an {@link IllegalArgumentException} if one of the remaining classes is not annotated
+ * by {@link Order}. The behavior can be switched off by setting the system property
+ * <code>bsi.debug.innerclass.order</code> to an arbitrary value.
+ *
+ * @param classes
+ * @param filter
+ * @return
+ * @throws IllegalArgumentException
+ */
+ @SuppressWarnings("unchecked")
+ public static <T> Class<T>[] sortFilteredClassesByOrderAnnotation(Class[] classes, Class<T> filter) {
+ TreeMap<CompositeObject, Class> orderedClassesMap = new TreeMap<CompositeObject, Class>();
+ for (int i = 0; i < classes.length; i++) {
+ if (filter.isAssignableFrom(classes[i])) {
+ if (classes[i].isAnnotationPresent(Order.class)) {
+ Order order = (Order) classes[i].getAnnotation(Order.class);
+ orderedClassesMap.put(new CompositeObject(order.value(), i), classes[i]);
+ }
+ else {
+ LOG.error("missing @Order annotation: " + classes[i].getName());
+ orderedClassesMap.put(new CompositeObject(Double.MAX_VALUE, i), classes[i]);
+ }
+ }
+ }
+ return orderedClassesMap.values().toArray(new Class[orderedClassesMap.size()]);
+ }
+
+ /**
+ * @deprecated use {@link #sortByOrder(Collection)} instead.
+ */
+ @Deprecated
+ public static <T> Collection<T> sortByOrderAnnotation(Collection<T> list) {
+ return sortByOrder(list);
+ }
+
+ /**
+ * Sorts the elements according to their order:
+ * <ol>
+ * <li>If an {@link Order} annotation is available, its {@link Order#value()} is used</li>
+ * <li>If the object implements {@link IOrdered}, {@link IOrdered#getOrder()} is used.</li>
+ * <li>Finally, the index in the original collection is used</li>
+ * </ol>
+ *
+ * @since 3.8.1
+ */
+ public static <T> Collection<T> sortByOrder(Collection<T> list) {
+ if (list == null) {
+ return null;
+ }
+ TreeMap<CompositeObject, T> sortMap = new TreeMap<CompositeObject, T>();
+ int index = 0;
+ for (T element : list) {
+ Class<?> c = element.getClass();
+ double order;
+ if (c.isAnnotationPresent(Order.class)) {
+ order = c.getAnnotation(Order.class).value();
+ }
+ else if (element instanceof IOrdered) {
+ order = ((IOrdered) element).getOrder();
+ }
+ else {
+ order = (double) index;
+ }
+ sortMap.put(new CompositeObject(order, index), element);
+ index++;
+ }
+ return sortMap.values();
+ }
+
+ /**
+ * Filters the given class array and returns the first occurrence of an
+ * instantiable class of filter
+ *
+ * @param classes
+ * @param filter
+ * @return first occurrence of filter, might be annotated with {@link InjectFieldTo}
+ */
+ @SuppressWarnings("unchecked")
+ public static <T> Class<T> filterClass(Class[] classes, Class<T> filter) {
+ for (Class c : classes) {
+ if (filter.isAssignableFrom(c) && !Modifier.isAbstract(c.getModifiers())) {
+ return c;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * same as {@link #filterClass(Class[], Class)} but ignoring classes with {@link InjectFieldTo} annotation
+ *
+ * @since 3.8.1
+ */
+ @SuppressWarnings("unchecked")
+ public static <T> Class<T> filterClassIgnoringInjectFieldAnnotation(Class[] classes, Class<T> filter) {
+ for (Class c : classes) {
+ if (filter.isAssignableFrom(c) && !Modifier.isAbstract(c.getModifiers())) {
+ if (!c.isAnnotationPresent(InjectFieldTo.class)) {
+ return c;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Filters the given class array and returns all occurrences of instantiable
+ * classes of filter
+ *
+ * @param classes
+ * @param filter
+ * @return all occurrences of filter
+ * @since 3.8.1
+ */
+ @SuppressWarnings("unchecked")
+ public static <T> Class<T>[] filterClasses(Class[] classes, Class<T> filter) {
+ ArrayList<Class<T>> list = new ArrayList<Class<T>>();
+ for (Class c : classes) {
+ if (filter.isAssignableFrom(c) && !Modifier.isAbstract(c.getModifiers())) {
+ list.add(c);
+ }
+ }
+ return list.toArray(new Class[0]);
+ }
+
+ /**
+ * same as {@link #filterClasses(Class[], Class)} but ignoring classes with {@link InjectFieldTo} annotation
+ *
+ * @since 3.8.1
+ */
+ @SuppressWarnings("unchecked")
+ public static <T> Class<T>[] filterClassesIgnoringInjectFieldAnnotation(Class[] classes, Class<T> filter) {
+ ArrayList<Class<T>> list = new ArrayList<Class<T>>();
+ for (Class c : classes) {
+ if (filter.isAssignableFrom(c) && !Modifier.isAbstract(c.getModifiers())) {
+ if (!c.isAnnotationPresent(InjectFieldTo.class)) {
+ list.add(c);
+ }
+ }
+ }
+ return list.toArray(new Class[0]);
+ }
+
+ /**
+ * same as {@link #filterClasses(Class[], Class)} but only accepting classes with {@link InjectFieldTo} annotation
+ *
+ * @since 3.8.1
+ */
+ @SuppressWarnings("unchecked")
+ public static <T> Class<T>[] filterClassesWithInjectFieldAnnotation(Class[] classes, Class<T> filter) {
+ ArrayList<Class<T>> list = new ArrayList<Class<T>>();
+ for (Class c : classes) {
+ if (filter.isAssignableFrom(c) && !Modifier.isAbstract(c.getModifiers())) {
+ if (c.isAnnotationPresent(InjectFieldTo.class)) {
+ list.add(c);
+ }
+ }
+ }
+ return list.toArray(new Class[0]);
+ }
+
+ /**
+ * get all declared classes (inner types) of the specified class and all its
+ * super classes
+ */
+ public static Class[] getDeclaredPublicClasses(Class c) {
+ return c.getClasses();
+ }
+
+ public static <T> T newInnerInstance(Object instance, Class<T> innerClass) throws Exception {
+ if (innerClass.getDeclaringClass() != null && (innerClass.getModifiers() & Modifier.STATIC) == 0) {
+ Constructor<T> c = innerClass.getDeclaredConstructor(new Class[]{innerClass.getDeclaringClass()});
+ return c.newInstance(new Object[]{instance});
+ }
+ else {
+ return innerClass.newInstance();
+ }
+ }
+
+ /**
+ * @return true if the declared method is overwritten in implementationType
+ */
+ public static boolean isMethodOverwrite(Class<?> declaringType, String methodName, Class[] parameterTypes, Class<?> implementationType) {
+ try {
+ Method declaredMethod;
+ try {
+ declaredMethod = declaringType.getDeclaredMethod(methodName, parameterTypes);
+ }
+ catch (NoSuchMethodException e) {
+ LOG.error("cannot find declared method " + declaringType.getName() + "." + methodName, e);
+ return false;
+ }
+ Class<?> c = implementationType;
+ while (c != null && c != declaringType) {
+ try {
+ //check if method is avaliable
+ c.getDeclaredMethod(declaredMethod.getName(), declaredMethod.getParameterTypes());
+ return true;
+ }
+ catch (NoSuchMethodException e) {
+ //nop
+ }
+ //up
+ c = c.getSuperclass();
+ }
+ }
+ catch (Throwable t) {
+ LOG.error("declaringType=" + declaringType + ", methodName=" + methodName + ", parameterTypes=" + parameterTypes + ", implementationType=" + implementationType, t);
+ }
+ return false;
+ }
+
+ /**
+ * @return Returns the given objects enclosing container type, i.e the first class on the enclosing classes path that
+ * is abstract or the outermost enclosing class. The latter is the primary type.
+ */
+ public static Class<?> getEnclosingContainerType(Object o) {
+ if (o == null) {
+ return null;
+ }
+ Class<?> c = o.getClass();
+ while (!Modifier.isAbstract(c.getModifiers()) && c.getEnclosingClass() != null) {
+ c = c.getEnclosingClass();
+ }
+ return c;
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/DateUtility.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/DateUtility.java
index 1364767f85..4d2ead8d9f 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/DateUtility.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/DateUtility.java
@@ -1,537 +1,537 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import java.text.DateFormat;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.Locale;
-
-public final class DateUtility {
-
- private DateUtility() {
- }
-
- public static final long DAY_MILLIS = 24L * 3600L * 1000L;
-
- /**
- * format date with {@value DateFormat#DEFAULT} pattern
- */
- public static String formatDate(Date d) {
- if (d == null) {
- return "";
- }
- Locale loc = LocaleThreadLocal.get();
- return DateFormat.getDateInstance(DateFormat.DEFAULT, loc).format(d);
- }
-
- /**
- * format time with {@value DateFormat#SHORT} pattern
- */
- public static String formatTime(Date d) {
- if (d == null) {
- return "";
- }
- Locale loc = LocaleThreadLocal.get();
- return DateFormat.getTimeInstance(DateFormat.SHORT, loc).format(d);
- }
-
- /**
- * format time with {@value DateFormat#SHORT}, {@value DateFormat#SHORT} patterns
- */
- public static String formatDateTime(Date d) {
- if (d == null) {
- return "";
- }
- Locale loc = LocaleThreadLocal.get();
- return DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, loc).format(d);
- }
-
- /**
- * format date with specific pattern as defined in {@link java.text.SimpleDateFormat}
- */
- public static String format(Date d, String pattern) {
- if (d == null || !StringUtility.hasText(pattern)) {
- return "";
- }
- Locale loc = LocaleThreadLocal.get();
- return new SimpleDateFormat(pattern, loc).format(d);
- }
-
- public static Date parse(String s, String pattern) {
- if (s == null) {
- return null;
- }
- try {
- Locale loc = LocaleThreadLocal.get();
- return new SimpleDateFormat(pattern, loc).parse(s);
- }
- catch (ParseException e) {
- throw new IllegalArgumentException("parse(\"" + s + "\",\"" + pattern + "\") failed", e);
- }
- }
-
- public static Date addHours(Date d, int hours) {
- if (d == null) {
- return null;
- }
- Calendar cal = Calendar.getInstance();
- cal.setTime(d);
- cal.add(Calendar.HOUR_OF_DAY, hours);
- return cal.getTime();
- }
-
- /**
- * add count days days is truncated to second and can be negative
- */
- public static Date addDays(Date d, double count) {
- if (d == null) {
- return null;
- }
- int sec = (int) (count * 3600 * 24);
- int sign = 1;
- if (sec < 0) {
- sec = -sec;
- sign = -1;
- }
- Calendar cal = Calendar.getInstance();
- cal.setTime(d);
- cal.add(Calendar.DATE, sign * (sec / 3600 / 24));
- cal.add(Calendar.HOUR_OF_DAY, sign * ((sec / 3600) % 24));
- cal.add(Calendar.MINUTE, sign * ((sec / 60) % 60));
- cal.add(Calendar.SECOND, sign * (sec % 60));
- return cal.getTime();
- }
-
- public static Date addMonths(Date d, int count) {
- if (d == null) {
- return null;
- }
- Calendar cal = Calendar.getInstance();
- cal.setTime(d);
- cal.add(Calendar.MONTH, count);
- return cal.getTime();
- }
-
- public static Date addYears(Date d, int count) {
- if (d == null) {
- return null;
- }
- Calendar cal = Calendar.getInstance();
- cal.setTime(d);
- cal.add(Calendar.YEAR, count);
- return cal.getTime();
- }
-
- /**
- * determines the day of the week
- *
- * @param d
- * @return int with the the day of the week (sunday=1)
- */
- public static int getWeekday(Date d) {
- if (d == null) {
- return -1;
- }
- Calendar cal = Calendar.getInstance();
- cal.setTime(d);
- int w = cal.get(Calendar.DAY_OF_WEEK);
- return w;
- }
-
- /**
- * truncate the date to a day with time 00:00:00.000
- */
- public static Date truncDate(Date d) {
- if (d == null) {
- return null;
- }
- Calendar c = Calendar.getInstance();
- c.setTime(d);
- truncCalendar(c);
- return new Date(c.getTime().getTime());
- }
-
- public static Date truncDateToMinute(Date d) {
- if (d == null) {
- return null;
- }
- Calendar c = Calendar.getInstance();
- c.setTime(d);
- c.set(Calendar.SECOND, 0);
- c.set(Calendar.MILLISECOND, 0);
- return new Date(c.getTime().getTime());
- }
-
- public static Date truncDateToSecond(Date d) {
- if (d == null) {
- return null;
- }
- Calendar c = Calendar.getInstance();
- c.setTime(d);
- c.set(Calendar.MILLISECOND, 0);
- return new Date(c.getTime().getTime());
- }
-
- /**
- * truncate the date to month
- */
- public static Date truncDateToWeek(Date d) {
- if (d == null) {
- return null;
- }
- Calendar c = Calendar.getInstance();
- c.setTime(d);
- truncCalendarToWeek(c, -1);
- return new Date(c.getTime().getTime());
- }
-
- /**
- * truncate the date to month
- */
- public static Date truncDateToMonth(Date d) {
- if (d == null) {
- return null;
- }
- Calendar c = Calendar.getInstance();
- c.setTime(d);
- truncCalendarToMonth(c);
- return new Date(c.getTime().getTime());
- }
-
- /**
- * truncate the date to year
- */
- public static Date truncDateToYear(Date d) {
- if (d == null) {
- return null;
- }
- Calendar c = Calendar.getInstance();
- c.setTime(d);
- truncCalendarToYear(c);
- return new Date(c.getTime().getTime());
- }
-
- /**
- * truncate the calendar to a day with time 00:00:00.000
- */
- public static void truncCalendar(Calendar c) {
- c.set(Calendar.HOUR_OF_DAY, 0);
- c.set(Calendar.MINUTE, 0);
- c.set(Calendar.SECOND, 0);
- c.set(Calendar.MILLISECOND, 0);
- }
-
- /**
- * truncate the calendar to week
- *
- * @param adjustIncrement
- * +1 or -1
- */
- public static void truncCalendarToWeek(Calendar c, int adjustIncrement) {
- if (adjustIncrement < -1) {
- adjustIncrement = -1;
- }
- if (adjustIncrement > 1) {
- adjustIncrement = 1;
- }
- if (adjustIncrement == 0) {
- adjustIncrement = -1;
- }
- c.set(Calendar.HOUR_OF_DAY, 0);
- c.set(Calendar.MINUTE, 0);
- c.set(Calendar.SECOND, 0);
- c.set(Calendar.MILLISECOND, 0);
- int firstDayOfWeek = Calendar.getInstance().getFirstDayOfWeek();
- while (c.get(Calendar.DAY_OF_WEEK) != firstDayOfWeek) {
- c.add(Calendar.DATE, adjustIncrement);
- }
- }
-
- /**
- * truncate the calendar to month
- */
- public static void truncCalendarToMonth(Calendar c) {
- c.set(Calendar.DATE, 1);
- c.set(Calendar.HOUR_OF_DAY, 0);
- c.set(Calendar.MINUTE, 0);
- c.set(Calendar.SECOND, 0);
- c.set(Calendar.MILLISECOND, 0);
- }
-
- /**
- * truncate the calendar to year
- */
- public static void truncCalendarToYear(Calendar c) {
- c.set(Calendar.MONTH, Calendar.JANUARY);
- c.set(Calendar.DATE, 1);
- c.set(Calendar.HOUR_OF_DAY, 0);
- c.set(Calendar.MINUTE, 0);
- c.set(Calendar.SECOND, 0);
- c.set(Calendar.MILLISECOND, 0);
- }
-
- /**
- * @return true if d is in the range [minDate,maxDate]
- */
- public static boolean isInRange(Date minDate, Date d, Date maxDate) {
- if (d == null || minDate == null || maxDate == null) {
- return false;
- }
- return minDate.compareTo(d) <= 0 && d.compareTo(maxDate) <= 0;
- }
-
- /**
- * @return true if the ranges intersect minDate and maxDate must not be null
- * fromDate or toDate may be null
- */
- public static boolean intersects(Date fromDate, Date toDate, Date minDate, Date maxDate) {
- if (minDate == null || maxDate == null) {
- return false;
- }
- if (fromDate == null && toDate == null) {
- return false;
- }
- if (fromDate == null) {
- return toDate.compareTo(minDate) >= 0;
- }
- else if (toDate == null) {
- return fromDate.compareTo(maxDate) <= 0;
- }
- else {
- return fromDate.compareTo(maxDate) <= 0 && toDate.compareTo(minDate) >= 0;
- }
- }
-
- /**
- * only compares the date, so doesn't care about time
- *
- * @return true if d is in the date range [minDate,maxDate]
- */
- public static boolean isInDateRange(Date minDate, Date d, Date maxDate) {
- return isInRange(truncDate(minDate), truncDate(d), truncDate(maxDate));
- }
-
- public static Date nextDay(Date d) {
- if (d == null) {
- return null;
- }
- Calendar c = Calendar.getInstance();
- c.setTime(d);
- c.add(Calendar.DATE, 1);
- Date dNew = new Date(c.getTime().getTime());
- return dNew;
- }
-
- public static Date max(Date... a) {
- Date max = null;
- for (Date d : a) {
- if (d != null) {
- if (max == null) {
- max = d;
- }
- else if (d.compareTo(max) > 0) {
- max = d;
- }
- }
- }
- return max;
- }
-
- public static Date min(Date... a) {
- Date min = null;
- for (Date d : a) {
- if (d != null) {
- if (min == null) {
- min = d;
- }
- else if (d.compareTo(min) < 0) {
- min = d;
- }
- }
- }
- return min;
- }
-
- public static boolean equals(Date a, Date b) {
- return a == b || (a != null && b != null && a.compareTo(b) == 0);
- }
-
- public static boolean isSameDay(Date a, Date b) {
- a = truncDate(a);
- b = truncDate(b);
- return equals(a, b);
- }
-
- public static boolean isSameMonth(Date d1, Date d2) {
- Calendar c = Calendar.getInstance();
- c.setTime(d1);
- int m1 = c.get(Calendar.MONTH);
- c.setTime(d2);
- int m2 = c.get(Calendar.MONTH);
- return (m1 == m2);
- }
-
- public static boolean isWeekend(Date d) {
- Calendar c = Calendar.getInstance();
- c.setTime(d);
- int dayOfWeek = c.get(Calendar.DAY_OF_WEEK);
- return dayOfWeek == Calendar.SATURDAY || dayOfWeek == Calendar.SUNDAY;
- }
-
- /**
- * Correctly calculate covered days of a day range. 13.3.2008 00:00 -
- * 14.3.2008 00:00 only covers 1 day (13.3.) 13.3.2008 12:00 - 14.3.2008 12:00
- * covers 2 days (13.3., 14.3.)
- *
- * @return array of days that with time set to 00:00:00.000
- */
- public static Date[] getCoveredDays(Date from, Date to) {
- if (from == null) {
- from = to;
- }
- if (to == null) {
- to = from;
- }
- if (from.compareTo(to) > 0) {
- to = from;
- }
- //
- if (from.compareTo(to) == 0) {
- return new Date[]{truncDate(from)};
- }
- else {
- Calendar a = Calendar.getInstance();
- a.setTime(from);
- truncCalendar(a);
- Calendar b = Calendar.getInstance();
- b.setTime(to);
- b.add(Calendar.MILLISECOND, -1);
- truncCalendar(b);
- long dayCount = ((b.getTimeInMillis() + DAY_MILLIS / 2 - a.getTimeInMillis()) / DAY_MILLIS) + 1;
- Date[] array = new Date[(int) dayCount];
- for (int i = 0; i < array.length; i++) {
- array[i] = a.getTime();
- a.add(Calendar.DATE, 1);
- }
- return array;
- }
- }
-
- public static <T> T nvl(T value, T valueWhenNull) {
- if (value != null) {
- return value;
- }
- else {
- return valueWhenNull;
- }
- }
-
- public static Date convertCalendar(Calendar c) {
- if (c == null) {
- return null;
- }
- return new Date(c.getTimeInMillis());
- }
-
- public static Calendar convertDate(Date d) {
- if (d == null) {
- return null;
- }
- Calendar c = Calendar.getInstance();
- c.setTime(d);
- return c;
- }
-
- /**
- * convert a (possible) subclass of {@link Date} to {@link Date}
- */
- public static Date toUtilDate(Date d) {
- if (d != null && d.getClass() != Date.class) {
- d = new Date(d.getTime());
- }
- return d;
- }
-
- /**
- * combine a date (yy/mm/dd) and a time (hh:mm:ss) into a combined timestamp-date containing both date and time.
- */
- public static Date createDateTime(Date date, Date time) {
- Calendar cal1 = Calendar.getInstance();
- cal1.setTime(date);
- Calendar cal2 = Calendar.getInstance();
- cal2.setTime(time);
- cal1.set(Calendar.HOUR_OF_DAY, cal2.get(Calendar.HOUR_OF_DAY));
- cal1.set(Calendar.MINUTE, cal2.get(Calendar.MINUTE));
- cal1.set(Calendar.SECOND, cal2.get(Calendar.SECOND));
- cal1.set(Calendar.MILLISECOND, cal2.get(Calendar.MILLISECOND));
- return cal1.getTime();
- }
-
- /**
- * @param d
- * a value in [0..1[ representing a day
- * @return the time value as date in the range from 00:00 - 23:59:59
- * @see #convertDateToDoubleTime(Date) inverse function
- */
- public static Date convertDoubleTimeToDate(Number d) {
- if (d == null) {
- return null;
- }
- int m;
- if (d.doubleValue() < 0) {
- m = (int) (((long) (d.doubleValue() * DAY_MILLIS - 0.5)) % DAY_MILLIS);
- }
- else {
- m = (int) (((long) (d.doubleValue() * DAY_MILLIS + 0.5)) % DAY_MILLIS);
- }
-
- Calendar c = Calendar.getInstance();
- c.clear();
- c.set(Calendar.MILLISECOND, m % 1000);
- m = m / 1000;
- c.set(Calendar.SECOND, m % 60);
- m = m / 60;
- c.set(Calendar.MINUTE, m % 60);
- m = m / 60;
- c.set(Calendar.HOUR_OF_DAY, m % 24);
- if (m < 0) {
- c.add(Calendar.DAY_OF_MONTH, 1);
- }
- return c.getTime();
- }
-
- /**
- * @param time
- * a time (hh:mm:ss) in the interval 00:00:00 - 23:59:59
- * @return the time value as a double in the range from [0..1[
- * @see #convertDoubleTimeToDate(Number) inverse function
- */
- public static Double convertDateToDoubleTime(Date time) {
- if (time == null) {
- return null;
- }
- Calendar c = Calendar.getInstance();
- c.setTime(time);
- double t = ((c.get(Calendar.HOUR_OF_DAY) * 60 + c.get(Calendar.MINUTE)) * 60 + c.get(Calendar.SECOND)) * 1000 + c.get(Calendar.MILLISECOND);
- Double d = new Double(t / DAY_MILLIS);
- // range check;
- if (d.doubleValue() < 0) {
- d = new Double(0);
- }
- if (d.doubleValue() > 1) {
- d = new Double(1);
- }
- return d;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.Locale;
+
+public final class DateUtility {
+
+ private DateUtility() {
+ }
+
+ public static final long DAY_MILLIS = 24L * 3600L * 1000L;
+
+ /**
+ * format date with {@value DateFormat#DEFAULT} pattern
+ */
+ public static String formatDate(Date d) {
+ if (d == null) {
+ return "";
+ }
+ Locale loc = LocaleThreadLocal.get();
+ return DateFormat.getDateInstance(DateFormat.DEFAULT, loc).format(d);
+ }
+
+ /**
+ * format time with {@value DateFormat#SHORT} pattern
+ */
+ public static String formatTime(Date d) {
+ if (d == null) {
+ return "";
+ }
+ Locale loc = LocaleThreadLocal.get();
+ return DateFormat.getTimeInstance(DateFormat.SHORT, loc).format(d);
+ }
+
+ /**
+ * format time with {@value DateFormat#SHORT}, {@value DateFormat#SHORT} patterns
+ */
+ public static String formatDateTime(Date d) {
+ if (d == null) {
+ return "";
+ }
+ Locale loc = LocaleThreadLocal.get();
+ return DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, loc).format(d);
+ }
+
+ /**
+ * format date with specific pattern as defined in {@link java.text.SimpleDateFormat}
+ */
+ public static String format(Date d, String pattern) {
+ if (d == null || !StringUtility.hasText(pattern)) {
+ return "";
+ }
+ Locale loc = LocaleThreadLocal.get();
+ return new SimpleDateFormat(pattern, loc).format(d);
+ }
+
+ public static Date parse(String s, String pattern) {
+ if (s == null) {
+ return null;
+ }
+ try {
+ Locale loc = LocaleThreadLocal.get();
+ return new SimpleDateFormat(pattern, loc).parse(s);
+ }
+ catch (ParseException e) {
+ throw new IllegalArgumentException("parse(\"" + s + "\",\"" + pattern + "\") failed", e);
+ }
+ }
+
+ public static Date addHours(Date d, int hours) {
+ if (d == null) {
+ return null;
+ }
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(d);
+ cal.add(Calendar.HOUR_OF_DAY, hours);
+ return cal.getTime();
+ }
+
+ /**
+ * add count days days is truncated to second and can be negative
+ */
+ public static Date addDays(Date d, double count) {
+ if (d == null) {
+ return null;
+ }
+ int sec = (int) (count * 3600 * 24);
+ int sign = 1;
+ if (sec < 0) {
+ sec = -sec;
+ sign = -1;
+ }
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(d);
+ cal.add(Calendar.DATE, sign * (sec / 3600 / 24));
+ cal.add(Calendar.HOUR_OF_DAY, sign * ((sec / 3600) % 24));
+ cal.add(Calendar.MINUTE, sign * ((sec / 60) % 60));
+ cal.add(Calendar.SECOND, sign * (sec % 60));
+ return cal.getTime();
+ }
+
+ public static Date addMonths(Date d, int count) {
+ if (d == null) {
+ return null;
+ }
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(d);
+ cal.add(Calendar.MONTH, count);
+ return cal.getTime();
+ }
+
+ public static Date addYears(Date d, int count) {
+ if (d == null) {
+ return null;
+ }
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(d);
+ cal.add(Calendar.YEAR, count);
+ return cal.getTime();
+ }
+
+ /**
+ * determines the day of the week
+ *
+ * @param d
+ * @return int with the the day of the week (sunday=1)
+ */
+ public static int getWeekday(Date d) {
+ if (d == null) {
+ return -1;
+ }
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(d);
+ int w = cal.get(Calendar.DAY_OF_WEEK);
+ return w;
+ }
+
+ /**
+ * truncate the date to a day with time 00:00:00.000
+ */
+ public static Date truncDate(Date d) {
+ if (d == null) {
+ return null;
+ }
+ Calendar c = Calendar.getInstance();
+ c.setTime(d);
+ truncCalendar(c);
+ return new Date(c.getTime().getTime());
+ }
+
+ public static Date truncDateToMinute(Date d) {
+ if (d == null) {
+ return null;
+ }
+ Calendar c = Calendar.getInstance();
+ c.setTime(d);
+ c.set(Calendar.SECOND, 0);
+ c.set(Calendar.MILLISECOND, 0);
+ return new Date(c.getTime().getTime());
+ }
+
+ public static Date truncDateToSecond(Date d) {
+ if (d == null) {
+ return null;
+ }
+ Calendar c = Calendar.getInstance();
+ c.setTime(d);
+ c.set(Calendar.MILLISECOND, 0);
+ return new Date(c.getTime().getTime());
+ }
+
+ /**
+ * truncate the date to month
+ */
+ public static Date truncDateToWeek(Date d) {
+ if (d == null) {
+ return null;
+ }
+ Calendar c = Calendar.getInstance();
+ c.setTime(d);
+ truncCalendarToWeek(c, -1);
+ return new Date(c.getTime().getTime());
+ }
+
+ /**
+ * truncate the date to month
+ */
+ public static Date truncDateToMonth(Date d) {
+ if (d == null) {
+ return null;
+ }
+ Calendar c = Calendar.getInstance();
+ c.setTime(d);
+ truncCalendarToMonth(c);
+ return new Date(c.getTime().getTime());
+ }
+
+ /**
+ * truncate the date to year
+ */
+ public static Date truncDateToYear(Date d) {
+ if (d == null) {
+ return null;
+ }
+ Calendar c = Calendar.getInstance();
+ c.setTime(d);
+ truncCalendarToYear(c);
+ return new Date(c.getTime().getTime());
+ }
+
+ /**
+ * truncate the calendar to a day with time 00:00:00.000
+ */
+ public static void truncCalendar(Calendar c) {
+ c.set(Calendar.HOUR_OF_DAY, 0);
+ c.set(Calendar.MINUTE, 0);
+ c.set(Calendar.SECOND, 0);
+ c.set(Calendar.MILLISECOND, 0);
+ }
+
+ /**
+ * truncate the calendar to week
+ *
+ * @param adjustIncrement
+ * +1 or -1
+ */
+ public static void truncCalendarToWeek(Calendar c, int adjustIncrement) {
+ if (adjustIncrement < -1) {
+ adjustIncrement = -1;
+ }
+ if (adjustIncrement > 1) {
+ adjustIncrement = 1;
+ }
+ if (adjustIncrement == 0) {
+ adjustIncrement = -1;
+ }
+ c.set(Calendar.HOUR_OF_DAY, 0);
+ c.set(Calendar.MINUTE, 0);
+ c.set(Calendar.SECOND, 0);
+ c.set(Calendar.MILLISECOND, 0);
+ int firstDayOfWeek = Calendar.getInstance().getFirstDayOfWeek();
+ while (c.get(Calendar.DAY_OF_WEEK) != firstDayOfWeek) {
+ c.add(Calendar.DATE, adjustIncrement);
+ }
+ }
+
+ /**
+ * truncate the calendar to month
+ */
+ public static void truncCalendarToMonth(Calendar c) {
+ c.set(Calendar.DATE, 1);
+ c.set(Calendar.HOUR_OF_DAY, 0);
+ c.set(Calendar.MINUTE, 0);
+ c.set(Calendar.SECOND, 0);
+ c.set(Calendar.MILLISECOND, 0);
+ }
+
+ /**
+ * truncate the calendar to year
+ */
+ public static void truncCalendarToYear(Calendar c) {
+ c.set(Calendar.MONTH, Calendar.JANUARY);
+ c.set(Calendar.DATE, 1);
+ c.set(Calendar.HOUR_OF_DAY, 0);
+ c.set(Calendar.MINUTE, 0);
+ c.set(Calendar.SECOND, 0);
+ c.set(Calendar.MILLISECOND, 0);
+ }
+
+ /**
+ * @return true if d is in the range [minDate,maxDate]
+ */
+ public static boolean isInRange(Date minDate, Date d, Date maxDate) {
+ if (d == null || minDate == null || maxDate == null) {
+ return false;
+ }
+ return minDate.compareTo(d) <= 0 && d.compareTo(maxDate) <= 0;
+ }
+
+ /**
+ * @return true if the ranges intersect minDate and maxDate must not be null
+ * fromDate or toDate may be null
+ */
+ public static boolean intersects(Date fromDate, Date toDate, Date minDate, Date maxDate) {
+ if (minDate == null || maxDate == null) {
+ return false;
+ }
+ if (fromDate == null && toDate == null) {
+ return false;
+ }
+ if (fromDate == null) {
+ return toDate.compareTo(minDate) >= 0;
+ }
+ else if (toDate == null) {
+ return fromDate.compareTo(maxDate) <= 0;
+ }
+ else {
+ return fromDate.compareTo(maxDate) <= 0 && toDate.compareTo(minDate) >= 0;
+ }
+ }
+
+ /**
+ * only compares the date, so doesn't care about time
+ *
+ * @return true if d is in the date range [minDate,maxDate]
+ */
+ public static boolean isInDateRange(Date minDate, Date d, Date maxDate) {
+ return isInRange(truncDate(minDate), truncDate(d), truncDate(maxDate));
+ }
+
+ public static Date nextDay(Date d) {
+ if (d == null) {
+ return null;
+ }
+ Calendar c = Calendar.getInstance();
+ c.setTime(d);
+ c.add(Calendar.DATE, 1);
+ Date dNew = new Date(c.getTime().getTime());
+ return dNew;
+ }
+
+ public static Date max(Date... a) {
+ Date max = null;
+ for (Date d : a) {
+ if (d != null) {
+ if (max == null) {
+ max = d;
+ }
+ else if (d.compareTo(max) > 0) {
+ max = d;
+ }
+ }
+ }
+ return max;
+ }
+
+ public static Date min(Date... a) {
+ Date min = null;
+ for (Date d : a) {
+ if (d != null) {
+ if (min == null) {
+ min = d;
+ }
+ else if (d.compareTo(min) < 0) {
+ min = d;
+ }
+ }
+ }
+ return min;
+ }
+
+ public static boolean equals(Date a, Date b) {
+ return a == b || (a != null && b != null && a.compareTo(b) == 0);
+ }
+
+ public static boolean isSameDay(Date a, Date b) {
+ a = truncDate(a);
+ b = truncDate(b);
+ return equals(a, b);
+ }
+
+ public static boolean isSameMonth(Date d1, Date d2) {
+ Calendar c = Calendar.getInstance();
+ c.setTime(d1);
+ int m1 = c.get(Calendar.MONTH);
+ c.setTime(d2);
+ int m2 = c.get(Calendar.MONTH);
+ return (m1 == m2);
+ }
+
+ public static boolean isWeekend(Date d) {
+ Calendar c = Calendar.getInstance();
+ c.setTime(d);
+ int dayOfWeek = c.get(Calendar.DAY_OF_WEEK);
+ return dayOfWeek == Calendar.SATURDAY || dayOfWeek == Calendar.SUNDAY;
+ }
+
+ /**
+ * Correctly calculate covered days of a day range. 13.3.2008 00:00 -
+ * 14.3.2008 00:00 only covers 1 day (13.3.) 13.3.2008 12:00 - 14.3.2008 12:00
+ * covers 2 days (13.3., 14.3.)
+ *
+ * @return array of days that with time set to 00:00:00.000
+ */
+ public static Date[] getCoveredDays(Date from, Date to) {
+ if (from == null) {
+ from = to;
+ }
+ if (to == null) {
+ to = from;
+ }
+ if (from.compareTo(to) > 0) {
+ to = from;
+ }
+ //
+ if (from.compareTo(to) == 0) {
+ return new Date[]{truncDate(from)};
+ }
+ else {
+ Calendar a = Calendar.getInstance();
+ a.setTime(from);
+ truncCalendar(a);
+ Calendar b = Calendar.getInstance();
+ b.setTime(to);
+ b.add(Calendar.MILLISECOND, -1);
+ truncCalendar(b);
+ long dayCount = ((b.getTimeInMillis() + DAY_MILLIS / 2 - a.getTimeInMillis()) / DAY_MILLIS) + 1;
+ Date[] array = new Date[(int) dayCount];
+ for (int i = 0; i < array.length; i++) {
+ array[i] = a.getTime();
+ a.add(Calendar.DATE, 1);
+ }
+ return array;
+ }
+ }
+
+ public static <T> T nvl(T value, T valueWhenNull) {
+ if (value != null) {
+ return value;
+ }
+ else {
+ return valueWhenNull;
+ }
+ }
+
+ public static Date convertCalendar(Calendar c) {
+ if (c == null) {
+ return null;
+ }
+ return new Date(c.getTimeInMillis());
+ }
+
+ public static Calendar convertDate(Date d) {
+ if (d == null) {
+ return null;
+ }
+ Calendar c = Calendar.getInstance();
+ c.setTime(d);
+ return c;
+ }
+
+ /**
+ * convert a (possible) subclass of {@link Date} to {@link Date}
+ */
+ public static Date toUtilDate(Date d) {
+ if (d != null && d.getClass() != Date.class) {
+ d = new Date(d.getTime());
+ }
+ return d;
+ }
+
+ /**
+ * combine a date (yy/mm/dd) and a time (hh:mm:ss) into a combined timestamp-date containing both date and time.
+ */
+ public static Date createDateTime(Date date, Date time) {
+ Calendar cal1 = Calendar.getInstance();
+ cal1.setTime(date);
+ Calendar cal2 = Calendar.getInstance();
+ cal2.setTime(time);
+ cal1.set(Calendar.HOUR_OF_DAY, cal2.get(Calendar.HOUR_OF_DAY));
+ cal1.set(Calendar.MINUTE, cal2.get(Calendar.MINUTE));
+ cal1.set(Calendar.SECOND, cal2.get(Calendar.SECOND));
+ cal1.set(Calendar.MILLISECOND, cal2.get(Calendar.MILLISECOND));
+ return cal1.getTime();
+ }
+
+ /**
+ * @param d
+ * a value in [0..1[ representing a day
+ * @return the time value as date in the range from 00:00 - 23:59:59
+ * @see #convertDateToDoubleTime(Date) inverse function
+ */
+ public static Date convertDoubleTimeToDate(Number d) {
+ if (d == null) {
+ return null;
+ }
+ int m;
+ if (d.doubleValue() < 0) {
+ m = (int) (((long) (d.doubleValue() * DAY_MILLIS - 0.5)) % DAY_MILLIS);
+ }
+ else {
+ m = (int) (((long) (d.doubleValue() * DAY_MILLIS + 0.5)) % DAY_MILLIS);
+ }
+
+ Calendar c = Calendar.getInstance();
+ c.clear();
+ c.set(Calendar.MILLISECOND, m % 1000);
+ m = m / 1000;
+ c.set(Calendar.SECOND, m % 60);
+ m = m / 60;
+ c.set(Calendar.MINUTE, m % 60);
+ m = m / 60;
+ c.set(Calendar.HOUR_OF_DAY, m % 24);
+ if (m < 0) {
+ c.add(Calendar.DAY_OF_MONTH, 1);
+ }
+ return c.getTime();
+ }
+
+ /**
+ * @param time
+ * a time (hh:mm:ss) in the interval 00:00:00 - 23:59:59
+ * @return the time value as a double in the range from [0..1[
+ * @see #convertDoubleTimeToDate(Number) inverse function
+ */
+ public static Double convertDateToDoubleTime(Date time) {
+ if (time == null) {
+ return null;
+ }
+ Calendar c = Calendar.getInstance();
+ c.setTime(time);
+ double t = ((c.get(Calendar.HOUR_OF_DAY) * 60 + c.get(Calendar.MINUTE)) * 60 + c.get(Calendar.SECOND)) * 1000 + c.get(Calendar.MILLISECOND);
+ Double d = new Double(t / DAY_MILLIS);
+ // range check;
+ if (d.doubleValue() < 0) {
+ d = new Double(0);
+ }
+ if (d.doubleValue() > 1) {
+ d = new Double(1);
+ }
+ return d;
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/EncryptionUtility.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/EncryptionUtility.java
index cf8960309f..d6251959e3 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/EncryptionUtility.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/EncryptionUtility.java
@@ -1,105 +1,105 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import java.util.Random;
-
-import org.eclipse.scout.commons.internal.tripledes.TripleDES;
-
-public final class EncryptionUtility {
- public static final byte[] DEFAULT_KEY = Base64Utility.decode("GQgTSBkIE0gZCBNIGQgTSBkIE0gZCBNI");// 24
-
- // bytes
-
- private EncryptionUtility() {
- }
-
- /**
- * @param data
- * in base 64 format
- * @param tripleDesKey
- * 24 bytes triple-des key, the default {@link #DEFAULT_KEY} may also
- * be used decrypt data using the triple-des key
- */
- public static byte[] decryptBase64(String data, byte[] tripleDesKey) {
- if (data == null) {
- return null;
- }
- if (data.length() >= 9 && data.charAt(8) == '#') {
- data = data.substring(9);
- }
- return decrypt(Base64Utility.decode(data), tripleDesKey);
- }
-
- /**
- * @param data
- * @param tripleDesKey
- * 24 bytes triple-des key, the default {@link #DEFAULT_KEY} may also
- * be used decrypt data using the triple-des key
- */
- public static byte[] decrypt(byte[] data, byte[] tripleDesKey) {
- if (data == null) {
- return null;
- }
- TripleDES t = null;
- try {
- t = new TripleDES(tripleDesKey);
- return t.decrypt(data, true);
- }
- finally {
- if (t != null) {
- t.destroy();
- }
- }
- }
-
- /**
- * @param data
- * @param tripleDesKey
- * 24 bytes triple-des key, the default {@link #DEFAULT_KEY} may also
- * be used
- * @return encrypted data using the triple-des key
- */
- public static byte[] encrypt(byte[] data, byte[] tripleDesKey) {
- if (data == null) {
- return null;
- }
- TripleDES t = null;
- try {
- t = new TripleDES(tripleDesKey);
- return t.encrypt(data);
- }
- finally {
- if (t != null) {
- t.destroy();
- }
- }
- }
-
- /**
- * @return data signed using MD5 algorithm
- */
- public static byte[] signMD5(byte[] data) throws NoSuchAlgorithmException {
- return MessageDigest.getInstance("MD5").digest(data);
- }
-
- /**
- * @return a new random 24 byte triple des key
- */
- public static byte[] createTripleDesKey() {
- Random r = new Random();
- byte[] key = new byte[24];
- r.nextBytes(key);
- return key;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.Random;
+
+import org.eclipse.scout.commons.internal.tripledes.TripleDES;
+
+public final class EncryptionUtility {
+ public static final byte[] DEFAULT_KEY = Base64Utility.decode("GQgTSBkIE0gZCBNIGQgTSBkIE0gZCBNI");// 24
+
+ // bytes
+
+ private EncryptionUtility() {
+ }
+
+ /**
+ * @param data
+ * in base 64 format
+ * @param tripleDesKey
+ * 24 bytes triple-des key, the default {@link #DEFAULT_KEY} may also
+ * be used decrypt data using the triple-des key
+ */
+ public static byte[] decryptBase64(String data, byte[] tripleDesKey) {
+ if (data == null) {
+ return null;
+ }
+ if (data.length() >= 9 && data.charAt(8) == '#') {
+ data = data.substring(9);
+ }
+ return decrypt(Base64Utility.decode(data), tripleDesKey);
+ }
+
+ /**
+ * @param data
+ * @param tripleDesKey
+ * 24 bytes triple-des key, the default {@link #DEFAULT_KEY} may also
+ * be used decrypt data using the triple-des key
+ */
+ public static byte[] decrypt(byte[] data, byte[] tripleDesKey) {
+ if (data == null) {
+ return null;
+ }
+ TripleDES t = null;
+ try {
+ t = new TripleDES(tripleDesKey);
+ return t.decrypt(data, true);
+ }
+ finally {
+ if (t != null) {
+ t.destroy();
+ }
+ }
+ }
+
+ /**
+ * @param data
+ * @param tripleDesKey
+ * 24 bytes triple-des key, the default {@link #DEFAULT_KEY} may also
+ * be used
+ * @return encrypted data using the triple-des key
+ */
+ public static byte[] encrypt(byte[] data, byte[] tripleDesKey) {
+ if (data == null) {
+ return null;
+ }
+ TripleDES t = null;
+ try {
+ t = new TripleDES(tripleDesKey);
+ return t.encrypt(data);
+ }
+ finally {
+ if (t != null) {
+ t.destroy();
+ }
+ }
+ }
+
+ /**
+ * @return data signed using MD5 algorithm
+ */
+ public static byte[] signMD5(byte[] data) throws NoSuchAlgorithmException {
+ return MessageDigest.getInstance("MD5").digest(data);
+ }
+
+ /**
+ * @return a new random 24 byte triple des key
+ */
+ public static byte[] createTripleDesKey() {
+ Random r = new Random();
+ byte[] key = new byte[24];
+ r.nextBytes(key);
+ return key;
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/EventListenerList.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/EventListenerList.java
index e40dbec1e8..6fc7ff603f 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/EventListenerList.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/EventListenerList.java
@@ -1,253 +1,253 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import java.lang.ref.WeakReference;
-import java.lang.reflect.Array;
-import java.util.EventListener;
-
-import org.eclipse.scout.commons.eventlistprofiler.EventListenerProfiler;
-import org.eclipse.scout.commons.eventlistprofiler.IEventListenerSnapshot;
-import org.eclipse.scout.commons.eventlistprofiler.IEventListenerSource;
-
-/**
- * Thread safe Listener list supports @see WeakEventListener
- */
-public class EventListenerList implements IEventListenerSource {
- private static final Object[] NULL_ARRAY = new Object[0];
- private Object listenerListLock = new Object();
- private transient Object[] listenerList = NULL_ARRAY;
-
- public EventListenerList() {
- if (EventListenerProfiler.getInstance().isEnabled()) {
- EventListenerProfiler.getInstance().registerSourceAsWeakReference(this);
- }
- }
-
- @Override
- public void dumpListenerList(IEventListenerSnapshot snapshot) {
- synchronized (listenerListLock) {
- for (int i = listenerList.length - 2; i >= 0; i -= 2) {
- Class c = (Class) listenerList[i];
- Object o = listenerList[i + 1];
- if (o instanceof WeakReference) {
- snapshot.add(c, null, ((WeakReference) o).get());
- }
- else {
- snapshot.add(c, null, o);
- }
- }
- }
- }
-
- /**
- * @returns the listener in reverse order in which they were added
- */
- @SuppressWarnings("unchecked")
- public <T extends EventListener> T[] getListeners(Class<T> t) {
- synchronized (listenerListLock) {
- maintainListNoLocking();
- Object[] lList = listenerList;
- int n = getListenerCountNoLock(t);
- T[] result = (T[]) Array.newInstance(t, n);
- int j = 0;
- int nullCount = 0;
- for (int i = lList.length - 2; i >= 0; i -= 2) {
- if (lList[i] == t) {
- Object ref = lList[i + 1];
- if (ref instanceof WeakReference) {
- result[j] = (T) ((WeakReference) ref).get();
- if (result[j] == null) {
- nullCount++;
- }
- j++;
- }
- else {
- result[j++] = (T) ref;
- }
- }
- }
- if (nullCount > 0) {
- EventListener[] tmp = new EventListener[result.length - nullCount];
- j = 0;
- for (int i = 0; i < result.length; i++) {
- if (result[i] != null) {
- tmp[j++] = result[i];
- }
- }
- result = (T[]) tmp;
- }
- return result;
- }
- }
-
- public <T extends EventListener> int getListenerCount(Class<T> t) {
- synchronized (listenerListLock) {
- return getListenerCountNoLock(t);
- }
- }
-
- @SuppressWarnings("unchecked")
- private <T extends EventListener> int getListenerCountNoLock(Class<T> t) {
- int count = 0;
- Object[] lList = listenerList;
- for (int i = 0; i < lList.length; i += 2) {
- if (t == (Class<T>) lList[i]) {
- count++;
- }
- }
- return count;
- }
-
- /**
- * Add the listener at the top (front) of the listener list (so it is called as LAST listener).
- */
- public <T extends EventListener> void insertAtFront(Class<T> t, T listener) {
- if (listener == null) {
- return;
- }
- Object ref;
- if (listener instanceof WeakEventListener) {
- ref = new WeakReference<EventListener>(listener);
- }
- else {
- ref = listener;
- }
- synchronized (listenerListLock) {
- if (listenerList == NULL_ARRAY) {
- listenerList = new Object[]{t, ref};
- }
- else {
- int n = listenerList.length + 2;
- int k = 0;
- Object[] tmp = new Object[n];
- if (k < n - 2) {
- System.arraycopy(listenerList, k, tmp, k + 2, n - 2 - k);
- }
- tmp[k] = t;
- tmp[k + 1] = ref;
- listenerList = tmp;
- }
- maintainListNoLocking();
- }
- }
-
- /**
- * The last listener added is the first to be called
- */
- public <T extends EventListener> void add(Class<T> t, T listener) {
- if (listener == null) {
- return;
- }
- Object ref;
- if (listener instanceof WeakEventListener) {
- ref = new WeakReference<EventListener>(listener);
- }
- else {
- ref = listener;
- }
- synchronized (listenerListLock) {
- if (listenerList == NULL_ARRAY) {
- listenerList = new Object[]{t, ref};
- }
- else {
- int i = listenerList.length;
- Object[] tmp = new Object[i + 2];
- System.arraycopy(listenerList, 0, tmp, 0, i);
- tmp[i] = t;
- tmp[i + 1] = ref;
- listenerList = tmp;
- }
- maintainListNoLocking();
- }
- }
-
- public <T extends EventListener> void remove(Class<T> t, T listener) {
- if (listener == null) {
- return;
- }
- synchronized (listenerListLock) {
- int index = -1;
- for (int i = listenerList.length - 2; i >= 0; i -= 2) {
- if (listenerList[i] == t) {
- if (listenerList[i + 1] instanceof WeakReference) {
- if (((WeakReference) listenerList[i + 1]).get() == listener) {
- index = i;
- break;
- }
- }
- else {
- if (listenerList[i + 1] == listener) {
- index = i;
- break;
- }
- }
- }
- }
- if (index != -1) {
- Object[] tmp = new Object[listenerList.length - 2];
- System.arraycopy(listenerList, 0, tmp, 0, index);
- if (index < tmp.length) {
- System.arraycopy(listenerList, index + 2, tmp, index,
- tmp.length - index);
- }
- listenerList = (tmp.length == 0) ? NULL_ARRAY : tmp;
- }
- maintainListNoLocking();
- }
- }
-
- private void maintainListNoLocking() {
- int j = 0;
- int nullCount = 0;
- for (int i = listenerList.length - 2; i >= 0; i -= 2) {
- Object ref = listenerList[i + 1];
- if (ref instanceof WeakReference) {
- if (((WeakReference) ref).get() == null) {
- listenerList[i + 1] = null;
- nullCount++;
- }
- }
- else {
- if (ref == null) {
- listenerList[i + 1] = null;
- nullCount++;
- }
- }
- }
- if (nullCount > 0) {
- Object[] tmp = new Object[listenerList.length - nullCount * 2];
- j = 0;
- for (int i = 0; i < listenerList.length; i = i + 2) {
- if (listenerList[i + 1] != null) {
- tmp[j] = listenerList[i];
- tmp[j + 1] = listenerList[i + 1];
- j = j + 2;
- }
- }
- listenerList = tmp;
- }
- }
-
- @Override
- public String toString() {
- synchronized (listenerListLock) {
- Object[] lList = listenerList;
- String s = "EventListenerList: ";
- s += lList.length / 2 + " listeners: ";
- for (int i = 0; i <= lList.length - 2; i += 2) {
- s += " type " + ((Class) lList[i]).getName();
- s += " listener " + lList[i + 1];
- }
- return s;
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import java.lang.ref.WeakReference;
+import java.lang.reflect.Array;
+import java.util.EventListener;
+
+import org.eclipse.scout.commons.eventlistprofiler.EventListenerProfiler;
+import org.eclipse.scout.commons.eventlistprofiler.IEventListenerSnapshot;
+import org.eclipse.scout.commons.eventlistprofiler.IEventListenerSource;
+
+/**
+ * Thread safe Listener list supports @see WeakEventListener
+ */
+public class EventListenerList implements IEventListenerSource {
+ private static final Object[] NULL_ARRAY = new Object[0];
+ private Object listenerListLock = new Object();
+ private transient Object[] listenerList = NULL_ARRAY;
+
+ public EventListenerList() {
+ if (EventListenerProfiler.getInstance().isEnabled()) {
+ EventListenerProfiler.getInstance().registerSourceAsWeakReference(this);
+ }
+ }
+
+ @Override
+ public void dumpListenerList(IEventListenerSnapshot snapshot) {
+ synchronized (listenerListLock) {
+ for (int i = listenerList.length - 2; i >= 0; i -= 2) {
+ Class c = (Class) listenerList[i];
+ Object o = listenerList[i + 1];
+ if (o instanceof WeakReference) {
+ snapshot.add(c, null, ((WeakReference) o).get());
+ }
+ else {
+ snapshot.add(c, null, o);
+ }
+ }
+ }
+ }
+
+ /**
+ * @returns the listener in reverse order in which they were added
+ */
+ @SuppressWarnings("unchecked")
+ public <T extends EventListener> T[] getListeners(Class<T> t) {
+ synchronized (listenerListLock) {
+ maintainListNoLocking();
+ Object[] lList = listenerList;
+ int n = getListenerCountNoLock(t);
+ T[] result = (T[]) Array.newInstance(t, n);
+ int j = 0;
+ int nullCount = 0;
+ for (int i = lList.length - 2; i >= 0; i -= 2) {
+ if (lList[i] == t) {
+ Object ref = lList[i + 1];
+ if (ref instanceof WeakReference) {
+ result[j] = (T) ((WeakReference) ref).get();
+ if (result[j] == null) {
+ nullCount++;
+ }
+ j++;
+ }
+ else {
+ result[j++] = (T) ref;
+ }
+ }
+ }
+ if (nullCount > 0) {
+ EventListener[] tmp = new EventListener[result.length - nullCount];
+ j = 0;
+ for (int i = 0; i < result.length; i++) {
+ if (result[i] != null) {
+ tmp[j++] = result[i];
+ }
+ }
+ result = (T[]) tmp;
+ }
+ return result;
+ }
+ }
+
+ public <T extends EventListener> int getListenerCount(Class<T> t) {
+ synchronized (listenerListLock) {
+ return getListenerCountNoLock(t);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private <T extends EventListener> int getListenerCountNoLock(Class<T> t) {
+ int count = 0;
+ Object[] lList = listenerList;
+ for (int i = 0; i < lList.length; i += 2) {
+ if (t == (Class<T>) lList[i]) {
+ count++;
+ }
+ }
+ return count;
+ }
+
+ /**
+ * Add the listener at the top (front) of the listener list (so it is called as LAST listener).
+ */
+ public <T extends EventListener> void insertAtFront(Class<T> t, T listener) {
+ if (listener == null) {
+ return;
+ }
+ Object ref;
+ if (listener instanceof WeakEventListener) {
+ ref = new WeakReference<EventListener>(listener);
+ }
+ else {
+ ref = listener;
+ }
+ synchronized (listenerListLock) {
+ if (listenerList == NULL_ARRAY) {
+ listenerList = new Object[]{t, ref};
+ }
+ else {
+ int n = listenerList.length + 2;
+ int k = 0;
+ Object[] tmp = new Object[n];
+ if (k < n - 2) {
+ System.arraycopy(listenerList, k, tmp, k + 2, n - 2 - k);
+ }
+ tmp[k] = t;
+ tmp[k + 1] = ref;
+ listenerList = tmp;
+ }
+ maintainListNoLocking();
+ }
+ }
+
+ /**
+ * The last listener added is the first to be called
+ */
+ public <T extends EventListener> void add(Class<T> t, T listener) {
+ if (listener == null) {
+ return;
+ }
+ Object ref;
+ if (listener instanceof WeakEventListener) {
+ ref = new WeakReference<EventListener>(listener);
+ }
+ else {
+ ref = listener;
+ }
+ synchronized (listenerListLock) {
+ if (listenerList == NULL_ARRAY) {
+ listenerList = new Object[]{t, ref};
+ }
+ else {
+ int i = listenerList.length;
+ Object[] tmp = new Object[i + 2];
+ System.arraycopy(listenerList, 0, tmp, 0, i);
+ tmp[i] = t;
+ tmp[i + 1] = ref;
+ listenerList = tmp;
+ }
+ maintainListNoLocking();
+ }
+ }
+
+ public <T extends EventListener> void remove(Class<T> t, T listener) {
+ if (listener == null) {
+ return;
+ }
+ synchronized (listenerListLock) {
+ int index = -1;
+ for (int i = listenerList.length - 2; i >= 0; i -= 2) {
+ if (listenerList[i] == t) {
+ if (listenerList[i + 1] instanceof WeakReference) {
+ if (((WeakReference) listenerList[i + 1]).get() == listener) {
+ index = i;
+ break;
+ }
+ }
+ else {
+ if (listenerList[i + 1] == listener) {
+ index = i;
+ break;
+ }
+ }
+ }
+ }
+ if (index != -1) {
+ Object[] tmp = new Object[listenerList.length - 2];
+ System.arraycopy(listenerList, 0, tmp, 0, index);
+ if (index < tmp.length) {
+ System.arraycopy(listenerList, index + 2, tmp, index,
+ tmp.length - index);
+ }
+ listenerList = (tmp.length == 0) ? NULL_ARRAY : tmp;
+ }
+ maintainListNoLocking();
+ }
+ }
+
+ private void maintainListNoLocking() {
+ int j = 0;
+ int nullCount = 0;
+ for (int i = listenerList.length - 2; i >= 0; i -= 2) {
+ Object ref = listenerList[i + 1];
+ if (ref instanceof WeakReference) {
+ if (((WeakReference) ref).get() == null) {
+ listenerList[i + 1] = null;
+ nullCount++;
+ }
+ }
+ else {
+ if (ref == null) {
+ listenerList[i + 1] = null;
+ nullCount++;
+ }
+ }
+ }
+ if (nullCount > 0) {
+ Object[] tmp = new Object[listenerList.length - nullCount * 2];
+ j = 0;
+ for (int i = 0; i < listenerList.length; i = i + 2) {
+ if (listenerList[i + 1] != null) {
+ tmp[j] = listenerList[i];
+ tmp[j + 1] = listenerList[i + 1];
+ j = j + 2;
+ }
+ }
+ listenerList = tmp;
+ }
+ }
+
+ @Override
+ public String toString() {
+ synchronized (listenerListLock) {
+ Object[] lList = listenerList;
+ String s = "EventListenerList: ";
+ s += lList.length / 2 + " listeners: ";
+ for (int i = 0; i <= lList.length - 2; i += 2) {
+ s += " type " + ((Class) lList[i]).getName();
+ s += " listener " + lList[i + 1];
+ }
+ return s;
+ }
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/FileUtility.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/FileUtility.java
index f8f8af2e6a..95cbe27f50 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/FileUtility.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/FileUtility.java
@@ -1,525 +1,525 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.nio.channels.FileChannel;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.List;
-import java.util.jar.JarEntry;
-import java.util.jar.JarFile;
-import java.util.jar.JarOutputStream;
-import java.util.zip.ZipEntry;
-
-/**
- * Utility class for managing directories and files
- *
- * @author BSI AG
- * @since 1.0
- */
-public final class FileUtility {
-
- private FileUtility() {
- }
-
- static {
- setupExtendedMimeMappings();
- }
-
- /**
- * Static extension to mimetype mapper
- */
- private static HashMap<String, String> EXT_TO_MIME_TYPE_MAP;
-
- /**
- * Static extension to mimetype mapper
- */
- private static void setupExtendedMimeMappings() {
- EXT_TO_MIME_TYPE_MAP = new HashMap<String, String>();
- EXT_TO_MIME_TYPE_MAP.put("ai", "application/postscript");
- EXT_TO_MIME_TYPE_MAP.put("aif", "audio/x-aiff");
- EXT_TO_MIME_TYPE_MAP.put("aifc", "audio/x-aiff");
- EXT_TO_MIME_TYPE_MAP.put("aiff", "audio/x-aiff");
- EXT_TO_MIME_TYPE_MAP.put("asc", "text/plain");
- EXT_TO_MIME_TYPE_MAP.put("au", "audio/basic");
- EXT_TO_MIME_TYPE_MAP.put("avi", "video/x-msvideo");
- EXT_TO_MIME_TYPE_MAP.put("bcpio", "application/x-bcpio");
- EXT_TO_MIME_TYPE_MAP.put("bin", "application/octet-stream");
- EXT_TO_MIME_TYPE_MAP.put("c", "text/plain");
- EXT_TO_MIME_TYPE_MAP.put("cc", "text/plain");
- EXT_TO_MIME_TYPE_MAP.put("ccad", "application/clariscad");
- EXT_TO_MIME_TYPE_MAP.put("cdf", "application/x-netcdf");
- EXT_TO_MIME_TYPE_MAP.put("class", "application/octet-stream");
- EXT_TO_MIME_TYPE_MAP.put("cpio", "application/x-cpio");
- EXT_TO_MIME_TYPE_MAP.put("cpt", "application/mac-compactpro");
- EXT_TO_MIME_TYPE_MAP.put("csh", "application/x-csh");
- EXT_TO_MIME_TYPE_MAP.put("css", "text/css");
- EXT_TO_MIME_TYPE_MAP.put("dcr", "application/x-director");
- EXT_TO_MIME_TYPE_MAP.put("dir", "application/x-director");
- EXT_TO_MIME_TYPE_MAP.put("dms", "application/octet-stream");
- EXT_TO_MIME_TYPE_MAP.put("doc", "application/msword");
- EXT_TO_MIME_TYPE_MAP.put("drw", "application/drafting");
- EXT_TO_MIME_TYPE_MAP.put("dvi", "application/x-dvi");
- EXT_TO_MIME_TYPE_MAP.put("dwg", "application/acad");
- EXT_TO_MIME_TYPE_MAP.put("dxf", "application/dxf");
- EXT_TO_MIME_TYPE_MAP.put("dxr", "application/x-director");
- EXT_TO_MIME_TYPE_MAP.put("eps", "application/postscript");
- EXT_TO_MIME_TYPE_MAP.put("etx", "text/x-setext");
- EXT_TO_MIME_TYPE_MAP.put("exe", "application/octet-stream");
- EXT_TO_MIME_TYPE_MAP.put("ez", "application/andrew-inset");
- EXT_TO_MIME_TYPE_MAP.put("f", "text/plain");
- EXT_TO_MIME_TYPE_MAP.put("f90", "text/plain");
- EXT_TO_MIME_TYPE_MAP.put("fli", "video/x-fli");
- EXT_TO_MIME_TYPE_MAP.put("gif", "image/gif");
- EXT_TO_MIME_TYPE_MAP.put("gtar", "application/x-gtar");
- EXT_TO_MIME_TYPE_MAP.put("gz", "application/x-gzip");
- EXT_TO_MIME_TYPE_MAP.put("h", "text/plain");
- EXT_TO_MIME_TYPE_MAP.put("hdf", "application/x-hdf");
- EXT_TO_MIME_TYPE_MAP.put("hh", "text/plain");
- EXT_TO_MIME_TYPE_MAP.put("hqx", "application/mac-binhex40");
- EXT_TO_MIME_TYPE_MAP.put("htm", "text/html");
- EXT_TO_MIME_TYPE_MAP.put("html", "text/html");
- EXT_TO_MIME_TYPE_MAP.put("ice", "x-conference/x-cooltalk");
- EXT_TO_MIME_TYPE_MAP.put("ief", "image/ief");
- EXT_TO_MIME_TYPE_MAP.put("iges", "model/iges");
- EXT_TO_MIME_TYPE_MAP.put("igs", "model/iges");
- EXT_TO_MIME_TYPE_MAP.put("ips", "application/x-ipscript");
- EXT_TO_MIME_TYPE_MAP.put("ipx", "application/x-ipix");
- EXT_TO_MIME_TYPE_MAP.put("jpe", "image/jpeg");
- EXT_TO_MIME_TYPE_MAP.put("jpeg", "image/jpeg");
- EXT_TO_MIME_TYPE_MAP.put("jpg", "image/jpeg");
- EXT_TO_MIME_TYPE_MAP.put("js", "application/x-javascript");
- EXT_TO_MIME_TYPE_MAP.put("kar", "audio/midi");
- EXT_TO_MIME_TYPE_MAP.put("latex", "application/x-latex");
- EXT_TO_MIME_TYPE_MAP.put("lha", "application/octet-stream");
- EXT_TO_MIME_TYPE_MAP.put("lsp", "application/x-lisp");
- EXT_TO_MIME_TYPE_MAP.put("lzh", "application/octet-stream");
- EXT_TO_MIME_TYPE_MAP.put("m", "text/plain");
- EXT_TO_MIME_TYPE_MAP.put("man", "application/x-troff-man");
- EXT_TO_MIME_TYPE_MAP.put("me", "application/x-troff-me");
- EXT_TO_MIME_TYPE_MAP.put("mesh", "model/mesh");
- EXT_TO_MIME_TYPE_MAP.put("mid", "audio/midi");
- EXT_TO_MIME_TYPE_MAP.put("midi", "audio/midi");
- EXT_TO_MIME_TYPE_MAP.put("mif", "application/vnd.mif");
- EXT_TO_MIME_TYPE_MAP.put("mime", "www/mime");
- EXT_TO_MIME_TYPE_MAP.put("mov", "video/quicktime");
- EXT_TO_MIME_TYPE_MAP.put("movie", "video/x-sgi-movie");
- EXT_TO_MIME_TYPE_MAP.put("mp2", "audio/mpeg");
- EXT_TO_MIME_TYPE_MAP.put("mp3", "audio/mpeg");
- EXT_TO_MIME_TYPE_MAP.put("mpe", "video/mpeg");
- EXT_TO_MIME_TYPE_MAP.put("mpeg", "video/mpeg");
- EXT_TO_MIME_TYPE_MAP.put("mpg", "video/mpeg");
- EXT_TO_MIME_TYPE_MAP.put("mpga", "audio/mpeg");
- EXT_TO_MIME_TYPE_MAP.put("ms", "application/x-troff-ms");
- EXT_TO_MIME_TYPE_MAP.put("msh", "model/mesh");
- EXT_TO_MIME_TYPE_MAP.put("nc", "application/x-netcdf");
- EXT_TO_MIME_TYPE_MAP.put("oda", "application/oda");
- EXT_TO_MIME_TYPE_MAP.put("pbm", "image/x-portable-bitmap");
- EXT_TO_MIME_TYPE_MAP.put("pdb", "chemical/x-pdb");
- EXT_TO_MIME_TYPE_MAP.put("pdf", "application/pdf");
- EXT_TO_MIME_TYPE_MAP.put("pgm", "image/x-portable-graymap");
- EXT_TO_MIME_TYPE_MAP.put("pgn", "application/x-chess-pgn");
- EXT_TO_MIME_TYPE_MAP.put("png", "image/png");
- EXT_TO_MIME_TYPE_MAP.put("pnm", "image/x-portable-anymap");
- EXT_TO_MIME_TYPE_MAP.put("pot", "application/mspowerpoint");
- EXT_TO_MIME_TYPE_MAP.put("ppm", "image/x-portable-pixmap");
- EXT_TO_MIME_TYPE_MAP.put("pps", "application/mspowerpoint");
- EXT_TO_MIME_TYPE_MAP.put("ppt", "application/mspowerpoint");
- EXT_TO_MIME_TYPE_MAP.put("ppz", "application/mspowerpoint");
- EXT_TO_MIME_TYPE_MAP.put("pre", "application/x-freelance");
- EXT_TO_MIME_TYPE_MAP.put("prt", "application/pro_eng");
- EXT_TO_MIME_TYPE_MAP.put("ps", "application/postscript");
- EXT_TO_MIME_TYPE_MAP.put("qt", "video/quicktime");
- EXT_TO_MIME_TYPE_MAP.put("ra", "audio/x-realaudio");
- EXT_TO_MIME_TYPE_MAP.put("ram", "audio/x-pn-realaudio");
- EXT_TO_MIME_TYPE_MAP.put("ras", "image/cmu-raster");
- EXT_TO_MIME_TYPE_MAP.put("rgb", "image/x-rgb");
- EXT_TO_MIME_TYPE_MAP.put("rm", "audio/x-pn-realaudio");
- EXT_TO_MIME_TYPE_MAP.put("roff", "application/x-troff");
- EXT_TO_MIME_TYPE_MAP.put("rpm", "audio/x-pn-realaudio-plugin");
- EXT_TO_MIME_TYPE_MAP.put("rtf", "text/rtf");
- EXT_TO_MIME_TYPE_MAP.put("rtx", "text/richtext");
- EXT_TO_MIME_TYPE_MAP.put("scm", "application/x-lotusscreencam");
- EXT_TO_MIME_TYPE_MAP.put("set", "application/set");
- EXT_TO_MIME_TYPE_MAP.put("sgm", "text/sgml");
- EXT_TO_MIME_TYPE_MAP.put("sgml", "text/sgml");
- EXT_TO_MIME_TYPE_MAP.put("sh", "application/x-sh");
- EXT_TO_MIME_TYPE_MAP.put("shar", "application/x-shar");
- EXT_TO_MIME_TYPE_MAP.put("silo", "model/mesh");
- EXT_TO_MIME_TYPE_MAP.put("sit", "application/x-stuffit");
- EXT_TO_MIME_TYPE_MAP.put("skd", "application/x-koan");
- EXT_TO_MIME_TYPE_MAP.put("skm", "application/x-koan");
- EXT_TO_MIME_TYPE_MAP.put("skp", "application/x-koan");
- EXT_TO_MIME_TYPE_MAP.put("skt", "application/x-koan");
- EXT_TO_MIME_TYPE_MAP.put("smi", "application/smil");
- EXT_TO_MIME_TYPE_MAP.put("smil", "application/smil");
- EXT_TO_MIME_TYPE_MAP.put("snd", "audio/basic");
- EXT_TO_MIME_TYPE_MAP.put("sol", "application/solids");
- EXT_TO_MIME_TYPE_MAP.put("spl", "application/x-futuresplash");
- EXT_TO_MIME_TYPE_MAP.put("src", "application/x-wais-source");
- EXT_TO_MIME_TYPE_MAP.put("step", "application/STEP");
- EXT_TO_MIME_TYPE_MAP.put("stl", "application/SLA");
- EXT_TO_MIME_TYPE_MAP.put("stp", "application/STEP");
- EXT_TO_MIME_TYPE_MAP.put("sv4cpio", "application/x-sv4cpio");
- EXT_TO_MIME_TYPE_MAP.put("sv4crc", "application/x-sv4crc");
- EXT_TO_MIME_TYPE_MAP.put("swf", "application/x-shockwave-flash");
- EXT_TO_MIME_TYPE_MAP.put("t", "application/x-troff");
- EXT_TO_MIME_TYPE_MAP.put("tar", "application/x-tar");
- EXT_TO_MIME_TYPE_MAP.put("tcl", "application/x-tcl");
- EXT_TO_MIME_TYPE_MAP.put("tex", "application/x-tex");
- EXT_TO_MIME_TYPE_MAP.put("texi", "application/x-texinfo");
- EXT_TO_MIME_TYPE_MAP.put("texinfo", "application/x-texinfo");
- EXT_TO_MIME_TYPE_MAP.put("tif", "image/tiff");
- EXT_TO_MIME_TYPE_MAP.put("tiff", "image/tiff");
- EXT_TO_MIME_TYPE_MAP.put("tr", "application/x-troff");
- EXT_TO_MIME_TYPE_MAP.put("tsi", "audio/TSP-audio");
- EXT_TO_MIME_TYPE_MAP.put("tsp", "application/dsptype");
- EXT_TO_MIME_TYPE_MAP.put("tsv", "text/tab-separated-values");
- EXT_TO_MIME_TYPE_MAP.put("txt", "text/plain");
- EXT_TO_MIME_TYPE_MAP.put("unv", "application/i-deas");
- EXT_TO_MIME_TYPE_MAP.put("ustar", "application/x-ustar");
- EXT_TO_MIME_TYPE_MAP.put("vcd", "application/x-cdlink");
- EXT_TO_MIME_TYPE_MAP.put("vda", "application/vda");
- EXT_TO_MIME_TYPE_MAP.put("viv", "video/vnd.vivo");
- EXT_TO_MIME_TYPE_MAP.put("vivo", "video/vnd.vivo");
- EXT_TO_MIME_TYPE_MAP.put("vrml", "model/vrml");
- EXT_TO_MIME_TYPE_MAP.put("wav", "audio/x-wav");
- EXT_TO_MIME_TYPE_MAP.put("wrl", "model/vrml");
- EXT_TO_MIME_TYPE_MAP.put("xbm", "image/x-xbitmap");
- EXT_TO_MIME_TYPE_MAP.put("xlc", "application/vnd.ms-excel");
- EXT_TO_MIME_TYPE_MAP.put("xll", "application/vnd.ms-excel");
- EXT_TO_MIME_TYPE_MAP.put("xlm", "application/vnd.ms-excel");
- EXT_TO_MIME_TYPE_MAP.put("xls", "application/vnd.ms-excel");
- EXT_TO_MIME_TYPE_MAP.put("xlw", "application/vnd.ms-excel");
- EXT_TO_MIME_TYPE_MAP.put("xml", "text/xml");
- EXT_TO_MIME_TYPE_MAP.put("xpm", "image/x-xpixmap");
- EXT_TO_MIME_TYPE_MAP.put("xwd", "image/x-xwindowdump");
- EXT_TO_MIME_TYPE_MAP.put("xyz", "chemical/x-pdb");
- EXT_TO_MIME_TYPE_MAP.put("zip", "application/zip");
- EXT_TO_MIME_TYPE_MAP.put("msg", "application/vnd.ms-outlook");
- EXT_TO_MIME_TYPE_MAP.put("eml", "message/rfc822");
- EXT_TO_MIME_TYPE_MAP.put("ini", "text/plain");
- }
-
- public static void extractArchive(File archiveFile, File destinationDir) throws IOException {
- destinationDir.mkdirs();
- destinationDir.setLastModified(archiveFile.lastModified());
- String localFile = destinationDir.getName();
- JarFile jar = new JarFile(archiveFile);
- try {
- Enumeration<JarEntry> entries = jar.entries();
- while (entries.hasMoreElements()) {
- JarEntry file = entries.nextElement();
- String name = file.getName();
- if (name.startsWith(localFile)) {
- name = name.substring(localFile.length());
- }
- while (name.startsWith("/") || name.startsWith("\\")) {
- name = name.substring(1);
- }
- File f = new File(destinationDir, name);
- if (file.isDirectory()) { // if its a directory, create it
- f.mkdirs();
- if (file.getTime() >= 0) {
- f.setLastModified(file.getTime());
- }
- continue;
- }
- else {
- f.getParentFile().mkdirs();
- InputStream is = null;
- FileOutputStream fos = null;
- try {
- is = jar.getInputStream(file);
- fos = new FileOutputStream(f);
- // Copy the bits from instream to outstream
- byte[] buf = new byte[102400];
- int len;
- while ((len = is.read(buf)) > 0) {
- fos.write(buf, 0, len);
- }
- }
- finally {
- if (fos != null) {
- fos.close();
- }
- if (is != null) {
- is.close();
- }
- }
- if (file.getTime() >= 0) {
- f.setLastModified(file.getTime());
- }
- }
- }
- }
- finally {
- if (jar != null) {
- try {
- jar.close();
- }
- catch (Throwable t) {
- }
- }
- }
- }
-
- /**
- * Copies one file to another. source must exist and be readable cannot copy a
- * directory to a file will not copy if timestamps and filesize match, will
- * overwrite otherwise
- *
- * @param source
- * the source file
- * @param dest
- * the destination file
- * @throws IOException
- * if an error occurs during the copy operation
- */
- public static void copyFile(File source, File dest) throws IOException {
- if (!source.exists()) {
- throw new FileNotFoundException(source.getAbsolutePath());
- }
- if (!source.canRead()) {
- throw new IOException("cannot read " + source);
- }
-
- if (dest.exists() && !dest.canWrite()) {
- throw new IOException("cannot write " + dest);
- }
-
- if (source.isDirectory()) {
- // source can not be a directory
- throw new IOException("source is a directory: " + source);
- }
-
- // source is a file
- if (dest.isDirectory()) {
- String sourceFileName = source.getName();
- copyFile(source, new File(dest, sourceFileName));
- }
- // both source and dest are files
- boolean needCopy = true;
- if (dest.exists()) {
- needCopy = (dest.length() != source.length()) || (dest.lastModified() != source.lastModified());
- }
- if (needCopy) {
- // Copies the file
- FileChannel input = null;
- FileChannel output = null;
- try {
- // magic number for Windows, 64Mb - 32Kb
- //
- int mbCount = 64;
- boolean done = false;
- // java.io.IOException: Insufficient system resources exist to complete
- // the requested service
- while (!done) {
- input = new FileInputStream(source).getChannel();
- if (!dest.exists()) {
- dest.getParentFile().mkdirs();
- }
- output = new FileOutputStream(dest).getChannel();
-
- try {
- int maxCount = (mbCount * 1024 * 1024) - (32 * 1024);
- long size = input.size();
- long position = 0;
- while (position < size) {
- position +=
- input.transferTo(position, maxCount, output);
- }
- done = true;
- }
- catch (IOException ioXcp) {
- // getLog().warn(ioXcp);
- if (ioXcp.getMessage().contains("Insufficient system resources exist to complete the requested service")) {
- mbCount--;
- // getLog().debug( "Dropped resource count down to ["+mbCount+"]"
- // );
- if (mbCount == 0) {
- done = true;
- }
- if (input != null) {
- input.close();
- }
- if (output != null) {
- output.close();
- }
- }
- else {
- throw ioXcp;
- }
- }
- }
- }
- finally {
- if (input != null) {
- input.close();
- }
- if (output != null) {
- output.close();
- }
- }
-
- if (dest.exists() && source.exists()) {
- dest.setLastModified(source.lastModified());
- }
- }
- }
-
- public static byte[] readFile(File source) throws IOException {
- if (!source.exists()) {
- throw new FileNotFoundException(source.getAbsolutePath());
- }
- if (!source.canRead()) {
- throw new IOException("cannot read " + source);
- }
- if (source.isDirectory()) {
- // source can not be a directory
- throw new IOException("source is a directory: " + source);
- }
- FileInputStream input = null;
- try {
- input = new FileInputStream(source);
- byte[] data = new byte[(int) source.length()];
- int n = 0;
- while (n < data.length) {
- n += input.read(data, n, data.length - n);
- }
- return data;
- }
- finally {
- if (input != null) {
- try {
- input.close();
- }
- catch (Throwable e) {
- }
- }
- }
- }
-
- public static void copyTree(File sourceLocation, File targetLocation) throws IOException {
- if (sourceLocation.isDirectory()) {
- if (!targetLocation.exists()) {
- targetLocation.mkdirs();
- targetLocation.setLastModified(sourceLocation.lastModified());
- }
-
- String[] children = sourceLocation.list();
- for (int i = 0; i < children.length; i++) {
- copyTree(new File(sourceLocation, children[i]), new File(
- targetLocation, children[i]));
- }
- }
- else {
- copyFile(sourceLocation, targetLocation);
- }
- }
-
- public static List<File> listTree(File f, boolean includeFiles, boolean includeFolders) throws IOException {
- ArrayList<File> list = new ArrayList<File>();
- listTreeRec(f, list, includeFiles, includeFolders);
- return list;
- }
-
- private static void listTreeRec(File f, List<File> list, boolean includeFiles, boolean includeFolders) throws IOException {
- if (f.isDirectory()) {
- if (includeFolders) {
- list.add(f);
- }
- String[] children = f.list();
- for (int i = 0; i < children.length; i++) {
- listTreeRec(new File(f, children[i]), list, includeFiles, includeFolders);
- }
- }
- else {
- if (includeFiles) {
- list.add(f);
- }
- }
- }
-
- public static void compressArchive(File srcDir, File archiveFile) throws IOException {
- JarOutputStream zOut = null;
- try {
- archiveFile.delete();
- zOut = new JarOutputStream(new FileOutputStream(archiveFile));
- addFolderToJar(srcDir, srcDir, zOut);
- }
- finally {
- if (zOut != null) {
- try {
- zOut.close();
- }
- catch (Throwable t) {
- }
- }
- }
- }
-
- private static void addFolderToJar(File baseDir, File srcdir, JarOutputStream zOut) throws IOException {
- if ((!srcdir.exists()) || (!srcdir.isDirectory())) {
- throw new IOException("source directory " + srcdir + " does not exist or is not a folder");
- }
- for (File f : srcdir.listFiles()) {
- if (f.exists() && (!f.isHidden())) {
- if (f.isDirectory()) {
- addFolderToJar(baseDir, f, zOut);
- }
- else {
- addFileToJar(baseDir, f, zOut);
- }
- }
- }
- }
-
- private static void addFileToJar(File baseDir, File src, JarOutputStream zOut) throws IOException {
- String name = src.getAbsolutePath();
- String prefix = baseDir.getAbsolutePath();
- if (prefix.endsWith("/") || prefix.endsWith("\\")) {
- prefix = prefix.substring(0, prefix.length() - 1);
- }
- name = name.substring(prefix.length() + 1);
- name = name.replace('\\', '/');
- byte[] data = readFile(src);
- addFileToJar(name, data, zOut);
- }
-
- private static void addFileToJar(String name, byte[] data, JarOutputStream zOut) throws IOException {
- zOut.putNextEntry(new ZipEntry(name));
- zOut.write(data);
- zOut.closeEntry();
- }
-
- /**
- * @return the mime type for the specified extension
- */
- public static String getContentTypeForExtension(String ext) {
- if (ext == null) {
- return null;
- }
- if (ext.startsWith(".")) {
- ext = ext.substring(1);
- }
- ext = ext.toLowerCase();
- return EXT_TO_MIME_TYPE_MAP.get(ext);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.channels.FileChannel;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.List;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+import java.util.jar.JarOutputStream;
+import java.util.zip.ZipEntry;
+
+/**
+ * Utility class for managing directories and files
+ *
+ * @author BSI AG
+ * @since 1.0
+ */
+public final class FileUtility {
+
+ private FileUtility() {
+ }
+
+ static {
+ setupExtendedMimeMappings();
+ }
+
+ /**
+ * Static extension to mimetype mapper
+ */
+ private static HashMap<String, String> EXT_TO_MIME_TYPE_MAP;
+
+ /**
+ * Static extension to mimetype mapper
+ */
+ private static void setupExtendedMimeMappings() {
+ EXT_TO_MIME_TYPE_MAP = new HashMap<String, String>();
+ EXT_TO_MIME_TYPE_MAP.put("ai", "application/postscript");
+ EXT_TO_MIME_TYPE_MAP.put("aif", "audio/x-aiff");
+ EXT_TO_MIME_TYPE_MAP.put("aifc", "audio/x-aiff");
+ EXT_TO_MIME_TYPE_MAP.put("aiff", "audio/x-aiff");
+ EXT_TO_MIME_TYPE_MAP.put("asc", "text/plain");
+ EXT_TO_MIME_TYPE_MAP.put("au", "audio/basic");
+ EXT_TO_MIME_TYPE_MAP.put("avi", "video/x-msvideo");
+ EXT_TO_MIME_TYPE_MAP.put("bcpio", "application/x-bcpio");
+ EXT_TO_MIME_TYPE_MAP.put("bin", "application/octet-stream");
+ EXT_TO_MIME_TYPE_MAP.put("c", "text/plain");
+ EXT_TO_MIME_TYPE_MAP.put("cc", "text/plain");
+ EXT_TO_MIME_TYPE_MAP.put("ccad", "application/clariscad");
+ EXT_TO_MIME_TYPE_MAP.put("cdf", "application/x-netcdf");
+ EXT_TO_MIME_TYPE_MAP.put("class", "application/octet-stream");
+ EXT_TO_MIME_TYPE_MAP.put("cpio", "application/x-cpio");
+ EXT_TO_MIME_TYPE_MAP.put("cpt", "application/mac-compactpro");
+ EXT_TO_MIME_TYPE_MAP.put("csh", "application/x-csh");
+ EXT_TO_MIME_TYPE_MAP.put("css", "text/css");
+ EXT_TO_MIME_TYPE_MAP.put("dcr", "application/x-director");
+ EXT_TO_MIME_TYPE_MAP.put("dir", "application/x-director");
+ EXT_TO_MIME_TYPE_MAP.put("dms", "application/octet-stream");
+ EXT_TO_MIME_TYPE_MAP.put("doc", "application/msword");
+ EXT_TO_MIME_TYPE_MAP.put("drw", "application/drafting");
+ EXT_TO_MIME_TYPE_MAP.put("dvi", "application/x-dvi");
+ EXT_TO_MIME_TYPE_MAP.put("dwg", "application/acad");
+ EXT_TO_MIME_TYPE_MAP.put("dxf", "application/dxf");
+ EXT_TO_MIME_TYPE_MAP.put("dxr", "application/x-director");
+ EXT_TO_MIME_TYPE_MAP.put("eps", "application/postscript");
+ EXT_TO_MIME_TYPE_MAP.put("etx", "text/x-setext");
+ EXT_TO_MIME_TYPE_MAP.put("exe", "application/octet-stream");
+ EXT_TO_MIME_TYPE_MAP.put("ez", "application/andrew-inset");
+ EXT_TO_MIME_TYPE_MAP.put("f", "text/plain");
+ EXT_TO_MIME_TYPE_MAP.put("f90", "text/plain");
+ EXT_TO_MIME_TYPE_MAP.put("fli", "video/x-fli");
+ EXT_TO_MIME_TYPE_MAP.put("gif", "image/gif");
+ EXT_TO_MIME_TYPE_MAP.put("gtar", "application/x-gtar");
+ EXT_TO_MIME_TYPE_MAP.put("gz", "application/x-gzip");
+ EXT_TO_MIME_TYPE_MAP.put("h", "text/plain");
+ EXT_TO_MIME_TYPE_MAP.put("hdf", "application/x-hdf");
+ EXT_TO_MIME_TYPE_MAP.put("hh", "text/plain");
+ EXT_TO_MIME_TYPE_MAP.put("hqx", "application/mac-binhex40");
+ EXT_TO_MIME_TYPE_MAP.put("htm", "text/html");
+ EXT_TO_MIME_TYPE_MAP.put("html", "text/html");
+ EXT_TO_MIME_TYPE_MAP.put("ice", "x-conference/x-cooltalk");
+ EXT_TO_MIME_TYPE_MAP.put("ief", "image/ief");
+ EXT_TO_MIME_TYPE_MAP.put("iges", "model/iges");
+ EXT_TO_MIME_TYPE_MAP.put("igs", "model/iges");
+ EXT_TO_MIME_TYPE_MAP.put("ips", "application/x-ipscript");
+ EXT_TO_MIME_TYPE_MAP.put("ipx", "application/x-ipix");
+ EXT_TO_MIME_TYPE_MAP.put("jpe", "image/jpeg");
+ EXT_TO_MIME_TYPE_MAP.put("jpeg", "image/jpeg");
+ EXT_TO_MIME_TYPE_MAP.put("jpg", "image/jpeg");
+ EXT_TO_MIME_TYPE_MAP.put("js", "application/x-javascript");
+ EXT_TO_MIME_TYPE_MAP.put("kar", "audio/midi");
+ EXT_TO_MIME_TYPE_MAP.put("latex", "application/x-latex");
+ EXT_TO_MIME_TYPE_MAP.put("lha", "application/octet-stream");
+ EXT_TO_MIME_TYPE_MAP.put("lsp", "application/x-lisp");
+ EXT_TO_MIME_TYPE_MAP.put("lzh", "application/octet-stream");
+ EXT_TO_MIME_TYPE_MAP.put("m", "text/plain");
+ EXT_TO_MIME_TYPE_MAP.put("man", "application/x-troff-man");
+ EXT_TO_MIME_TYPE_MAP.put("me", "application/x-troff-me");
+ EXT_TO_MIME_TYPE_MAP.put("mesh", "model/mesh");
+ EXT_TO_MIME_TYPE_MAP.put("mid", "audio/midi");
+ EXT_TO_MIME_TYPE_MAP.put("midi", "audio/midi");
+ EXT_TO_MIME_TYPE_MAP.put("mif", "application/vnd.mif");
+ EXT_TO_MIME_TYPE_MAP.put("mime", "www/mime");
+ EXT_TO_MIME_TYPE_MAP.put("mov", "video/quicktime");
+ EXT_TO_MIME_TYPE_MAP.put("movie", "video/x-sgi-movie");
+ EXT_TO_MIME_TYPE_MAP.put("mp2", "audio/mpeg");
+ EXT_TO_MIME_TYPE_MAP.put("mp3", "audio/mpeg");
+ EXT_TO_MIME_TYPE_MAP.put("mpe", "video/mpeg");
+ EXT_TO_MIME_TYPE_MAP.put("mpeg", "video/mpeg");
+ EXT_TO_MIME_TYPE_MAP.put("mpg", "video/mpeg");
+ EXT_TO_MIME_TYPE_MAP.put("mpga", "audio/mpeg");
+ EXT_TO_MIME_TYPE_MAP.put("ms", "application/x-troff-ms");
+ EXT_TO_MIME_TYPE_MAP.put("msh", "model/mesh");
+ EXT_TO_MIME_TYPE_MAP.put("nc", "application/x-netcdf");
+ EXT_TO_MIME_TYPE_MAP.put("oda", "application/oda");
+ EXT_TO_MIME_TYPE_MAP.put("pbm", "image/x-portable-bitmap");
+ EXT_TO_MIME_TYPE_MAP.put("pdb", "chemical/x-pdb");
+ EXT_TO_MIME_TYPE_MAP.put("pdf", "application/pdf");
+ EXT_TO_MIME_TYPE_MAP.put("pgm", "image/x-portable-graymap");
+ EXT_TO_MIME_TYPE_MAP.put("pgn", "application/x-chess-pgn");
+ EXT_TO_MIME_TYPE_MAP.put("png", "image/png");
+ EXT_TO_MIME_TYPE_MAP.put("pnm", "image/x-portable-anymap");
+ EXT_TO_MIME_TYPE_MAP.put("pot", "application/mspowerpoint");
+ EXT_TO_MIME_TYPE_MAP.put("ppm", "image/x-portable-pixmap");
+ EXT_TO_MIME_TYPE_MAP.put("pps", "application/mspowerpoint");
+ EXT_TO_MIME_TYPE_MAP.put("ppt", "application/mspowerpoint");
+ EXT_TO_MIME_TYPE_MAP.put("ppz", "application/mspowerpoint");
+ EXT_TO_MIME_TYPE_MAP.put("pre", "application/x-freelance");
+ EXT_TO_MIME_TYPE_MAP.put("prt", "application/pro_eng");
+ EXT_TO_MIME_TYPE_MAP.put("ps", "application/postscript");
+ EXT_TO_MIME_TYPE_MAP.put("qt", "video/quicktime");
+ EXT_TO_MIME_TYPE_MAP.put("ra", "audio/x-realaudio");
+ EXT_TO_MIME_TYPE_MAP.put("ram", "audio/x-pn-realaudio");
+ EXT_TO_MIME_TYPE_MAP.put("ras", "image/cmu-raster");
+ EXT_TO_MIME_TYPE_MAP.put("rgb", "image/x-rgb");
+ EXT_TO_MIME_TYPE_MAP.put("rm", "audio/x-pn-realaudio");
+ EXT_TO_MIME_TYPE_MAP.put("roff", "application/x-troff");
+ EXT_TO_MIME_TYPE_MAP.put("rpm", "audio/x-pn-realaudio-plugin");
+ EXT_TO_MIME_TYPE_MAP.put("rtf", "text/rtf");
+ EXT_TO_MIME_TYPE_MAP.put("rtx", "text/richtext");
+ EXT_TO_MIME_TYPE_MAP.put("scm", "application/x-lotusscreencam");
+ EXT_TO_MIME_TYPE_MAP.put("set", "application/set");
+ EXT_TO_MIME_TYPE_MAP.put("sgm", "text/sgml");
+ EXT_TO_MIME_TYPE_MAP.put("sgml", "text/sgml");
+ EXT_TO_MIME_TYPE_MAP.put("sh", "application/x-sh");
+ EXT_TO_MIME_TYPE_MAP.put("shar", "application/x-shar");
+ EXT_TO_MIME_TYPE_MAP.put("silo", "model/mesh");
+ EXT_TO_MIME_TYPE_MAP.put("sit", "application/x-stuffit");
+ EXT_TO_MIME_TYPE_MAP.put("skd", "application/x-koan");
+ EXT_TO_MIME_TYPE_MAP.put("skm", "application/x-koan");
+ EXT_TO_MIME_TYPE_MAP.put("skp", "application/x-koan");
+ EXT_TO_MIME_TYPE_MAP.put("skt", "application/x-koan");
+ EXT_TO_MIME_TYPE_MAP.put("smi", "application/smil");
+ EXT_TO_MIME_TYPE_MAP.put("smil", "application/smil");
+ EXT_TO_MIME_TYPE_MAP.put("snd", "audio/basic");
+ EXT_TO_MIME_TYPE_MAP.put("sol", "application/solids");
+ EXT_TO_MIME_TYPE_MAP.put("spl", "application/x-futuresplash");
+ EXT_TO_MIME_TYPE_MAP.put("src", "application/x-wais-source");
+ EXT_TO_MIME_TYPE_MAP.put("step", "application/STEP");
+ EXT_TO_MIME_TYPE_MAP.put("stl", "application/SLA");
+ EXT_TO_MIME_TYPE_MAP.put("stp", "application/STEP");
+ EXT_TO_MIME_TYPE_MAP.put("sv4cpio", "application/x-sv4cpio");
+ EXT_TO_MIME_TYPE_MAP.put("sv4crc", "application/x-sv4crc");
+ EXT_TO_MIME_TYPE_MAP.put("swf", "application/x-shockwave-flash");
+ EXT_TO_MIME_TYPE_MAP.put("t", "application/x-troff");
+ EXT_TO_MIME_TYPE_MAP.put("tar", "application/x-tar");
+ EXT_TO_MIME_TYPE_MAP.put("tcl", "application/x-tcl");
+ EXT_TO_MIME_TYPE_MAP.put("tex", "application/x-tex");
+ EXT_TO_MIME_TYPE_MAP.put("texi", "application/x-texinfo");
+ EXT_TO_MIME_TYPE_MAP.put("texinfo", "application/x-texinfo");
+ EXT_TO_MIME_TYPE_MAP.put("tif", "image/tiff");
+ EXT_TO_MIME_TYPE_MAP.put("tiff", "image/tiff");
+ EXT_TO_MIME_TYPE_MAP.put("tr", "application/x-troff");
+ EXT_TO_MIME_TYPE_MAP.put("tsi", "audio/TSP-audio");
+ EXT_TO_MIME_TYPE_MAP.put("tsp", "application/dsptype");
+ EXT_TO_MIME_TYPE_MAP.put("tsv", "text/tab-separated-values");
+ EXT_TO_MIME_TYPE_MAP.put("txt", "text/plain");
+ EXT_TO_MIME_TYPE_MAP.put("unv", "application/i-deas");
+ EXT_TO_MIME_TYPE_MAP.put("ustar", "application/x-ustar");
+ EXT_TO_MIME_TYPE_MAP.put("vcd", "application/x-cdlink");
+ EXT_TO_MIME_TYPE_MAP.put("vda", "application/vda");
+ EXT_TO_MIME_TYPE_MAP.put("viv", "video/vnd.vivo");
+ EXT_TO_MIME_TYPE_MAP.put("vivo", "video/vnd.vivo");
+ EXT_TO_MIME_TYPE_MAP.put("vrml", "model/vrml");
+ EXT_TO_MIME_TYPE_MAP.put("wav", "audio/x-wav");
+ EXT_TO_MIME_TYPE_MAP.put("wrl", "model/vrml");
+ EXT_TO_MIME_TYPE_MAP.put("xbm", "image/x-xbitmap");
+ EXT_TO_MIME_TYPE_MAP.put("xlc", "application/vnd.ms-excel");
+ EXT_TO_MIME_TYPE_MAP.put("xll", "application/vnd.ms-excel");
+ EXT_TO_MIME_TYPE_MAP.put("xlm", "application/vnd.ms-excel");
+ EXT_TO_MIME_TYPE_MAP.put("xls", "application/vnd.ms-excel");
+ EXT_TO_MIME_TYPE_MAP.put("xlw", "application/vnd.ms-excel");
+ EXT_TO_MIME_TYPE_MAP.put("xml", "text/xml");
+ EXT_TO_MIME_TYPE_MAP.put("xpm", "image/x-xpixmap");
+ EXT_TO_MIME_TYPE_MAP.put("xwd", "image/x-xwindowdump");
+ EXT_TO_MIME_TYPE_MAP.put("xyz", "chemical/x-pdb");
+ EXT_TO_MIME_TYPE_MAP.put("zip", "application/zip");
+ EXT_TO_MIME_TYPE_MAP.put("msg", "application/vnd.ms-outlook");
+ EXT_TO_MIME_TYPE_MAP.put("eml", "message/rfc822");
+ EXT_TO_MIME_TYPE_MAP.put("ini", "text/plain");
+ }
+
+ public static void extractArchive(File archiveFile, File destinationDir) throws IOException {
+ destinationDir.mkdirs();
+ destinationDir.setLastModified(archiveFile.lastModified());
+ String localFile = destinationDir.getName();
+ JarFile jar = new JarFile(archiveFile);
+ try {
+ Enumeration<JarEntry> entries = jar.entries();
+ while (entries.hasMoreElements()) {
+ JarEntry file = entries.nextElement();
+ String name = file.getName();
+ if (name.startsWith(localFile)) {
+ name = name.substring(localFile.length());
+ }
+ while (name.startsWith("/") || name.startsWith("\\")) {
+ name = name.substring(1);
+ }
+ File f = new File(destinationDir, name);
+ if (file.isDirectory()) { // if its a directory, create it
+ f.mkdirs();
+ if (file.getTime() >= 0) {
+ f.setLastModified(file.getTime());
+ }
+ continue;
+ }
+ else {
+ f.getParentFile().mkdirs();
+ InputStream is = null;
+ FileOutputStream fos = null;
+ try {
+ is = jar.getInputStream(file);
+ fos = new FileOutputStream(f);
+ // Copy the bits from instream to outstream
+ byte[] buf = new byte[102400];
+ int len;
+ while ((len = is.read(buf)) > 0) {
+ fos.write(buf, 0, len);
+ }
+ }
+ finally {
+ if (fos != null) {
+ fos.close();
+ }
+ if (is != null) {
+ is.close();
+ }
+ }
+ if (file.getTime() >= 0) {
+ f.setLastModified(file.getTime());
+ }
+ }
+ }
+ }
+ finally {
+ if (jar != null) {
+ try {
+ jar.close();
+ }
+ catch (Throwable t) {
+ }
+ }
+ }
+ }
+
+ /**
+ * Copies one file to another. source must exist and be readable cannot copy a
+ * directory to a file will not copy if timestamps and filesize match, will
+ * overwrite otherwise
+ *
+ * @param source
+ * the source file
+ * @param dest
+ * the destination file
+ * @throws IOException
+ * if an error occurs during the copy operation
+ */
+ public static void copyFile(File source, File dest) throws IOException {
+ if (!source.exists()) {
+ throw new FileNotFoundException(source.getAbsolutePath());
+ }
+ if (!source.canRead()) {
+ throw new IOException("cannot read " + source);
+ }
+
+ if (dest.exists() && !dest.canWrite()) {
+ throw new IOException("cannot write " + dest);
+ }
+
+ if (source.isDirectory()) {
+ // source can not be a directory
+ throw new IOException("source is a directory: " + source);
+ }
+
+ // source is a file
+ if (dest.isDirectory()) {
+ String sourceFileName = source.getName();
+ copyFile(source, new File(dest, sourceFileName));
+ }
+ // both source and dest are files
+ boolean needCopy = true;
+ if (dest.exists()) {
+ needCopy = (dest.length() != source.length()) || (dest.lastModified() != source.lastModified());
+ }
+ if (needCopy) {
+ // Copies the file
+ FileChannel input = null;
+ FileChannel output = null;
+ try {
+ // magic number for Windows, 64Mb - 32Kb
+ //
+ int mbCount = 64;
+ boolean done = false;
+ // java.io.IOException: Insufficient system resources exist to complete
+ // the requested service
+ while (!done) {
+ input = new FileInputStream(source).getChannel();
+ if (!dest.exists()) {
+ dest.getParentFile().mkdirs();
+ }
+ output = new FileOutputStream(dest).getChannel();
+
+ try {
+ int maxCount = (mbCount * 1024 * 1024) - (32 * 1024);
+ long size = input.size();
+ long position = 0;
+ while (position < size) {
+ position +=
+ input.transferTo(position, maxCount, output);
+ }
+ done = true;
+ }
+ catch (IOException ioXcp) {
+ // getLog().warn(ioXcp);
+ if (ioXcp.getMessage().contains("Insufficient system resources exist to complete the requested service")) {
+ mbCount--;
+ // getLog().debug( "Dropped resource count down to ["+mbCount+"]"
+ // );
+ if (mbCount == 0) {
+ done = true;
+ }
+ if (input != null) {
+ input.close();
+ }
+ if (output != null) {
+ output.close();
+ }
+ }
+ else {
+ throw ioXcp;
+ }
+ }
+ }
+ }
+ finally {
+ if (input != null) {
+ input.close();
+ }
+ if (output != null) {
+ output.close();
+ }
+ }
+
+ if (dest.exists() && source.exists()) {
+ dest.setLastModified(source.lastModified());
+ }
+ }
+ }
+
+ public static byte[] readFile(File source) throws IOException {
+ if (!source.exists()) {
+ throw new FileNotFoundException(source.getAbsolutePath());
+ }
+ if (!source.canRead()) {
+ throw new IOException("cannot read " + source);
+ }
+ if (source.isDirectory()) {
+ // source can not be a directory
+ throw new IOException("source is a directory: " + source);
+ }
+ FileInputStream input = null;
+ try {
+ input = new FileInputStream(source);
+ byte[] data = new byte[(int) source.length()];
+ int n = 0;
+ while (n < data.length) {
+ n += input.read(data, n, data.length - n);
+ }
+ return data;
+ }
+ finally {
+ if (input != null) {
+ try {
+ input.close();
+ }
+ catch (Throwable e) {
+ }
+ }
+ }
+ }
+
+ public static void copyTree(File sourceLocation, File targetLocation) throws IOException {
+ if (sourceLocation.isDirectory()) {
+ if (!targetLocation.exists()) {
+ targetLocation.mkdirs();
+ targetLocation.setLastModified(sourceLocation.lastModified());
+ }
+
+ String[] children = sourceLocation.list();
+ for (int i = 0; i < children.length; i++) {
+ copyTree(new File(sourceLocation, children[i]), new File(
+ targetLocation, children[i]));
+ }
+ }
+ else {
+ copyFile(sourceLocation, targetLocation);
+ }
+ }
+
+ public static List<File> listTree(File f, boolean includeFiles, boolean includeFolders) throws IOException {
+ ArrayList<File> list = new ArrayList<File>();
+ listTreeRec(f, list, includeFiles, includeFolders);
+ return list;
+ }
+
+ private static void listTreeRec(File f, List<File> list, boolean includeFiles, boolean includeFolders) throws IOException {
+ if (f.isDirectory()) {
+ if (includeFolders) {
+ list.add(f);
+ }
+ String[] children = f.list();
+ for (int i = 0; i < children.length; i++) {
+ listTreeRec(new File(f, children[i]), list, includeFiles, includeFolders);
+ }
+ }
+ else {
+ if (includeFiles) {
+ list.add(f);
+ }
+ }
+ }
+
+ public static void compressArchive(File srcDir, File archiveFile) throws IOException {
+ JarOutputStream zOut = null;
+ try {
+ archiveFile.delete();
+ zOut = new JarOutputStream(new FileOutputStream(archiveFile));
+ addFolderToJar(srcDir, srcDir, zOut);
+ }
+ finally {
+ if (zOut != null) {
+ try {
+ zOut.close();
+ }
+ catch (Throwable t) {
+ }
+ }
+ }
+ }
+
+ private static void addFolderToJar(File baseDir, File srcdir, JarOutputStream zOut) throws IOException {
+ if ((!srcdir.exists()) || (!srcdir.isDirectory())) {
+ throw new IOException("source directory " + srcdir + " does not exist or is not a folder");
+ }
+ for (File f : srcdir.listFiles()) {
+ if (f.exists() && (!f.isHidden())) {
+ if (f.isDirectory()) {
+ addFolderToJar(baseDir, f, zOut);
+ }
+ else {
+ addFileToJar(baseDir, f, zOut);
+ }
+ }
+ }
+ }
+
+ private static void addFileToJar(File baseDir, File src, JarOutputStream zOut) throws IOException {
+ String name = src.getAbsolutePath();
+ String prefix = baseDir.getAbsolutePath();
+ if (prefix.endsWith("/") || prefix.endsWith("\\")) {
+ prefix = prefix.substring(0, prefix.length() - 1);
+ }
+ name = name.substring(prefix.length() + 1);
+ name = name.replace('\\', '/');
+ byte[] data = readFile(src);
+ addFileToJar(name, data, zOut);
+ }
+
+ private static void addFileToJar(String name, byte[] data, JarOutputStream zOut) throws IOException {
+ zOut.putNextEntry(new ZipEntry(name));
+ zOut.write(data);
+ zOut.closeEntry();
+ }
+
+ /**
+ * @return the mime type for the specified extension
+ */
+ public static String getContentTypeForExtension(String ext) {
+ if (ext == null) {
+ return null;
+ }
+ if (ext.startsWith(".")) {
+ ext = ext.substring(1);
+ }
+ ext = ext.toLowerCase();
+ return EXT_TO_MIME_TYPE_MAP.get(ext);
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/FormattingUtility.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/FormattingUtility.java
index 06ee181a6f..544e1f21cf 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/FormattingUtility.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/FormattingUtility.java
@@ -1,87 +1,87 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import java.math.BigDecimal;
-import java.text.DateFormat;
-import java.text.DecimalFormat;
-import java.text.NumberFormat;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.Locale;
-
-public final class FormattingUtility {
- private FormattingUtility() {
- }
-
- public static String fixedRecord(String s, int length) {
- StringBuffer b = new StringBuffer(s != null ? s : "");
- while (b.length() < length) {
- b.append(" ");
- }
- return b.toString();
- }
-
- /**
- * Formats the given object respecting the current thread's {@link LocaleThreadLocal} and converts it to a String.
- * Supported types are:
- * <ul>
- * <li>{@link String}</li>
- * <li>{@link java.util.Date} with empty time part is formatted using {@link java.text.DateFormat#MEDIUM}
- * <li>{@link java.util.Date} with non-empty time part is formatted {@link java.text.DateFormat#SHORT} for date and
- * time part, respectively</li>
- * <li>{@link Float}, {@link Double} and {@link BigDecimal} are formatted using {@link java.text.NumberFormat} with
- * exactly 2 fraction digits</li>
- * <li>{@link Number} is formatted using {@link java.text.NumberFormat}</li>
- * <li>{@link Boolean} is formatted as "X" for <code>true</code>, "" for <code>false</code></li>
- * </ul>
- *
- * @param o
- * object to format
- * @return Returns formatted string representation, never <code>null</code>.
- */
- public static String formatObject(Object o) {
- Locale loc = LocaleThreadLocal.get();
- String ret = null;
- if (o instanceof String) {
- ret = (String) o;
- }
- else if (o instanceof Date) {
- ret = DateFormat.getDateInstance(DateFormat.MEDIUM, loc).format(o);
-
- // get time hours, minutes, seconds
- Calendar cal = Calendar.getInstance();
- cal.setTime((Date) o);
- int hour = cal.get(Calendar.HOUR);
- int minute = cal.get(Calendar.MINUTE);
- int second = cal.get(Calendar.SECOND);
- // if time different to 00:00:00
- // format with time
- if (hour != 0 || minute != 0 || second != 0) {
- ret = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, loc).format(o);
- }
- }
- else if (o instanceof Float || o instanceof Double || o instanceof BigDecimal) {
- NumberFormat f = DecimalFormat.getInstance(loc);
- f.setMinimumFractionDigits(2);
- f.setMaximumFractionDigits(2);
- ret = f.format(o);
- }
- else if (o instanceof Number) {
- ret = NumberFormat.getNumberInstance(loc).format(o);
- }
- else if (o instanceof Boolean) {
- ret = ((Boolean) o).booleanValue() == true ? "X" : "";
- }
-
- return ret == null ? "" : ret;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import java.math.BigDecimal;
+import java.text.DateFormat;
+import java.text.DecimalFormat;
+import java.text.NumberFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.Locale;
+
+public final class FormattingUtility {
+ private FormattingUtility() {
+ }
+
+ public static String fixedRecord(String s, int length) {
+ StringBuffer b = new StringBuffer(s != null ? s : "");
+ while (b.length() < length) {
+ b.append(" ");
+ }
+ return b.toString();
+ }
+
+ /**
+ * Formats the given object respecting the current thread's {@link LocaleThreadLocal} and converts it to a String.
+ * Supported types are:
+ * <ul>
+ * <li>{@link String}</li>
+ * <li>{@link java.util.Date} with empty time part is formatted using {@link java.text.DateFormat#MEDIUM}
+ * <li>{@link java.util.Date} with non-empty time part is formatted {@link java.text.DateFormat#SHORT} for date and
+ * time part, respectively</li>
+ * <li>{@link Float}, {@link Double} and {@link BigDecimal} are formatted using {@link java.text.NumberFormat} with
+ * exactly 2 fraction digits</li>
+ * <li>{@link Number} is formatted using {@link java.text.NumberFormat}</li>
+ * <li>{@link Boolean} is formatted as "X" for <code>true</code>, "" for <code>false</code></li>
+ * </ul>
+ *
+ * @param o
+ * object to format
+ * @return Returns formatted string representation, never <code>null</code>.
+ */
+ public static String formatObject(Object o) {
+ Locale loc = LocaleThreadLocal.get();
+ String ret = null;
+ if (o instanceof String) {
+ ret = (String) o;
+ }
+ else if (o instanceof Date) {
+ ret = DateFormat.getDateInstance(DateFormat.MEDIUM, loc).format(o);
+
+ // get time hours, minutes, seconds
+ Calendar cal = Calendar.getInstance();
+ cal.setTime((Date) o);
+ int hour = cal.get(Calendar.HOUR);
+ int minute = cal.get(Calendar.MINUTE);
+ int second = cal.get(Calendar.SECOND);
+ // if time different to 00:00:00
+ // format with time
+ if (hour != 0 || minute != 0 || second != 0) {
+ ret = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, loc).format(o);
+ }
+ }
+ else if (o instanceof Float || o instanceof Double || o instanceof BigDecimal) {
+ NumberFormat f = DecimalFormat.getInstance(loc);
+ f.setMinimumFractionDigits(2);
+ f.setMaximumFractionDigits(2);
+ ret = f.format(o);
+ }
+ else if (o instanceof Number) {
+ ret = NumberFormat.getNumberInstance(loc).format(o);
+ }
+ else if (o instanceof Boolean) {
+ ret = ((Boolean) o).booleanValue() == true ? "X" : "";
+ }
+
+ return ret == null ? "" : ret;
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/HTMLUtility.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/HTMLUtility.java
index 6a0c403279..b70e552776 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/HTMLUtility.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/HTMLUtility.java
@@ -1,941 +1,941 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import javax.swing.text.AbstractDocument;
-import javax.swing.text.AttributeSet;
-import javax.swing.text.BadLocationException;
-import javax.swing.text.Element;
-import javax.swing.text.MutableAttributeSet;
-import javax.swing.text.Style;
-import javax.swing.text.html.CSS;
-import javax.swing.text.html.HTML;
-import javax.swing.text.html.HTMLDocument;
-import javax.swing.text.html.HTMLEditorKit;
-import javax.swing.text.html.StyleSheet;
-import javax.swing.text.html.parser.DocumentParser;
-import javax.swing.text.html.parser.ParserDelegator;
-
-import org.eclipse.scout.commons.holders.IntegerHolder;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-
-/**
- * Utility to manipulate HTML documents regardless of ui (swt / swing). This
- * class is used from swt as well as in swing code
- */
-public final class HTMLUtility {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(HTMLUtility.class);
-
- private static HashMap<String, CSS.Attribute> cssMap;
-
- private HTMLUtility() {
- }
-
- static {
- CSSPatch.apply();
- cssMap = new HashMap<String, CSS.Attribute>();
- cssMap.put(CSS.Attribute.COLOR.toString(), CSS.Attribute.COLOR);
- cssMap.put(CSS.Attribute.BACKGROUND_COLOR.toString(), CSS.Attribute.BACKGROUND_COLOR);
- cssMap.put(CSS.Attribute.BORDER_COLOR.toString(), CSS.Attribute.BORDER_COLOR);
- cssMap.put(CSS.Attribute.FONT_SIZE.toString(), CSS.Attribute.FONT_SIZE);
- cssMap.put(CSS.Attribute.BACKGROUND_IMAGE.toString(), CSS.Attribute.BACKGROUND_IMAGE);
- cssMap.put(CSS.Attribute.LIST_STYLE_IMAGE.toString(), CSS.Attribute.LIST_STYLE_IMAGE);
- }
-
- /**
- * <p>
- * Creates a {@link HTMLDocument} from the given HTML text.
- * </p>
- * <p>
- * Please note, that all &lt;meta&gt; elements are removed. This is because setting a charset would cause an exception
- * as {@link DocumentParser} does not allow to specify the charset in HTML text. Due to failsafe, all other
- * &lt;meta&gt; tags are removed as well as just informative anyway.
- * </p>
- *
- * @param htmlText
- * @return
- */
- public static HTMLDocument toHtmlDocument(String htmlText) {
- if (StringUtility.isNullOrEmpty(htmlText)) {
- return null;
- }
- HTMLEditorKit kit = new HTMLEditorKit();
- // remove meta tags (see JavaDoc of @{link HTMLDocument#parseDocument(String)} for more information)
- Pattern[] metaPatterns = new Pattern[]{
- Pattern.compile("<meta\\s+[^>]*>"),
- Pattern.compile("<Meta\\s+[^>]*>"),
- Pattern.compile("<META\\s+[^>]*>"),
- Pattern.compile("</\\s*meta\\s*>"),
- Pattern.compile("</\\s*Meta\\s*>"),
- Pattern.compile("</\\s*META\\s*>"),
- };
- for (Pattern p : metaPatterns) {
- htmlText = p.matcher(htmlText).replaceAll("");
- }
-
- // Remove quotes in style attribute which are not closed.
- htmlText = HTMLUtility.removeUnclosedStyleQuotes(htmlText, true);
- htmlText = HTMLUtility.removeUnclosedStyleQuotes(htmlText, false);
-
- // fix incorrect single tag endings ( <br/ > <br /> )
- htmlText = htmlText.replaceAll("/\\s+>", "/>");
- htmlText = htmlText.replaceAll("([^\\s])\\s+/>", "$1/>");
- // before jre 1.6 eliminate single tags and </br> tags
- if (System.getProperty("java.version", "1.5").substring(0, 3).compareTo("1.6") < 0) {
- htmlText = htmlText.replaceAll("/>", ">");
- htmlText = htmlText.replaceAll("</\\s*br\\s*>", "");
- }
- StyleSheet styleSheet = new StyleSheet();
- MutableHTMLDocument doc = new MutableHTMLDocument(styleSheet);
- try {
- doc.setParser(new ParserDelegator());
- doc.setTokenThreshold(100);
- doc.remove(0, doc.getLength());
- kit.read(new StringReader(htmlText), doc, 0);
- }
- catch (Exception e) {
- LOG.warn(null, e);
- return null;
- }
- return doc;
- }
-
- public static String toHtmlText(HTMLDocument doc) {
- String htmlText = "";
- if (doc == null) {
- return htmlText;
- }
-
- try {
- HTMLEditorKit kit = new HTMLEditorKit();
- StringWriter buf = new StringWriter();
- kit.write(buf, doc, 0, doc.getLength());
- htmlText = buf.toString();
- }
- catch (Throwable t) {
- LOG.error("failed to extract HTML text from HTML document", t);
- }
- return htmlText;
- }
-
- /**
- * <p>
- * Applies some intelligence to the HTML document to ensure a valid HTML document.
- * </p>
- *
- * @param rawHtml
- * the raw HTML document
- * @param ensureContentType
- * to add missing meta directive &lt;meta http-equiv="content-type" content="text/html;charset=UTF-8"/>
- * @param cleanupCss
- * to cleanup CSS as HTML has some trouble with some style constructs.<br/>
- * <small>For more information, please refer to {@link HTMLUtility#cleanupCss(HTMLDocument, DefaultFont)}
- * </small>
- * @param defaultFont
- * to ensure default font set
- * @return the formatted HTML document
- */
- public static String cleanupHtml(String rawHtml, boolean ensureContentType, boolean cleanupCss, DefaultFont defaultFont) {
- rawHtml = StringUtility.nvl(rawHtml, "");
-
- try {
- // 1a) ensure <HTML> tag
- Matcher matcherHtmlTag = createMatcherForTag(rawHtml, "html", false);
- if (!matcherHtmlTag.find()) {
- // no <html> tag found. Insert <html> tag just before first tag
- Matcher matcherFirstTag = Pattern.compile("<\\s*?[^!/][^>]*?>", Pattern.CASE_INSENSITIVE).matcher(rawHtml);
- if (matcherFirstTag.find()) {
- rawHtml = rawHtml.substring(0, matcherFirstTag.start()) + "<html>" + rawHtml.substring(matcherFirstTag.start(), rawHtml.length());
- }
- else {
- // no tag found at all. Insert just after DOCTYPE declarations
- Matcher matcherComment = Pattern.compile("<\\![^>]+?>", Pattern.CASE_INSENSITIVE).matcher(rawHtml);
- int index = 0;
- while (matcherComment.find()) {
- index = matcherComment.end();
- }
- rawHtml = rawHtml.substring(0, index) + "<html>" + rawHtml.substring(index);
- }
- }
-
- // 1b) ensure </HTML> tag
- Matcher matcherHtmlEndTag = createMatcherForTag(rawHtml, "html", true);
- if (!matcherHtmlEndTag.find()) {
- rawHtml = rawHtml += "</html>";
- }
-
- // 2a) ensure <HEAD> tag
- Matcher matcherHeadTag = createMatcherForTag(rawHtml, "head", false);
- if (!matcherHeadTag.find()) {
- // no <head> tag found. Insert just after <html> tag
- matcherHtmlTag = createMatcherForTag(rawHtml, "html", false);
- matcherHtmlTag.find();
- rawHtml = rawHtml.substring(0, matcherHtmlTag.end()) + "<head>" + rawHtml.substring(matcherHtmlTag.end(), rawHtml.length());
- }
-
- // 2b) ensure </HEAD> tag
- Matcher matcherHeadEndTag = createMatcherForTag(rawHtml, "head", true);
- if (!matcherHeadEndTag.find()) {
- // no </head> tag found. Insert just after <head> tag
- matcherHeadTag = createMatcherForTag(rawHtml, "head", false);
- matcherHeadTag.find();
- rawHtml = rawHtml.substring(0, matcherHeadTag.end()) + "</head>" + rawHtml.substring(matcherHeadTag.end(), rawHtml.length());
- }
-
- // 3) in case of no default font specified in HTML, add default style. This is to adapt the application L&F.
- if (!cleanupCss && defaultFont != null) {
- rawHtml = ensureDefaultFont(rawHtml, defaultFont);
- }
- // 4a) ensure <BODY> tag
- Matcher matcherBodyTag = createMatcherForTag(rawHtml, "body", false);
- if (!matcherBodyTag.find()) {
- // no <body> tag found. Insert just after </head> tag
- matcherHeadEndTag = createMatcherForTag(rawHtml, "head", true);
- matcherHeadEndTag.find();
- rawHtml = rawHtml.substring(0, matcherHeadEndTag.end()) + "<body>" + rawHtml.substring(matcherHeadEndTag.end(), rawHtml.length());
- }
-
- // 4b) ensure </BODY> tag
- Matcher matcherBodyEndTag = createMatcherForTag(rawHtml, "body", true);
- if (!matcherBodyEndTag.find()) {
- // no </body> tag found. Insert just before </html> tag
- matcherHtmlEndTag = createMatcherForTag(rawHtml, "html", true);
- matcherHtmlEndTag.find();
- rawHtml = rawHtml.substring(0, matcherHtmlEndTag.start()) + "</body>" + rawHtml.substring(matcherHtmlEndTag.start(), rawHtml.length());
- }
-
- // 5) Eliminate vertical scrollbar
- rawHtml = eliminateVerticalScrollbar(rawHtml);
-
- // 6) cleanup CSS of document
- if (cleanupCss) {
- HTMLDocument htmlDoc = HTMLUtility.toHtmlDocument(rawHtml);
- if (htmlDoc != null) {
- htmlDoc = HTMLUtility.cleanupCss(htmlDoc, defaultFont);
- rawHtml = HTMLUtility.toHtmlText(htmlDoc);
- }
- }
-
- // 7) ensure <META> element with content-type and charset (This must be done after 6) as <META> tags are removed in cleanup)
- if (ensureContentType) {
- rawHtml = HTMLUtility.addHtmlMetaElement("content-type", "text/html;charset=UTF-8", rawHtml);
- }
- }
- catch (Throwable t) {
- // failsafe
- LOG.warn("failed to cleanup HTML document", t);
- }
-
- return rawHtml;
- }
-
- /**
- * HTML has several troubles with some CSS and tag style concepts.
- *
- * @param htmlDoc
- * @param defaultFont
- * @return
- */
- public static HTMLDocument cleanupCss(HTMLDocument htmlDoc, DefaultFont defaultFont) {
- if (htmlDoc == null) {
- return htmlDoc;
- }
- MutableHTMLDocument doc = (MutableHTMLDocument) htmlDoc;
- StyleSheet styleSheet = doc.getStyleSheet();
- Style style;
- // p style
- style = styleSheet.getStyle("p");
- if (style == null) {
- style = styleSheet.addStyle("p", null);
- styleSheet.addCSSAttribute(style, CSS.Attribute.MARGIN_LEFT, "0");
- styleSheet.addCSSAttribute(style, CSS.Attribute.MARGIN_RIGHT, "0");
- styleSheet.addCSSAttribute(style, CSS.Attribute.MARGIN_TOP, "4");
- styleSheet.addCSSAttribute(style, CSS.Attribute.MARGIN_BOTTOM, "4");
- styleSheet.addCSSAttribute(style, CSS.Attribute.PADDING_LEFT, "0");
- styleSheet.addCSSAttribute(style, CSS.Attribute.PADDING_RIGHT, "0");
- styleSheet.addCSSAttribute(style, CSS.Attribute.PADDING_TOP, "0");
- styleSheet.addCSSAttribute(style, CSS.Attribute.PADDING_BOTTOM, "0");
- }
- // a style
- style = styleSheet.getStyle("a");
- if (style == null) {
- style = styleSheet.addStyle("a", null);
- }
- if (style.getAttribute(CSS.Attribute.COLOR) == null) {
- styleSheet.addCSSAttribute(style, CSS.Attribute.COLOR, "#3366cc");
- }
- if (style.getAttribute(CSS.Attribute.TEXT_DECORATION) == null) {
- styleSheet.addCSSAttribute(style, CSS.Attribute.TEXT_DECORATION, "underline");
- }
- // body style
- style = styleSheet.getStyle("body");
- if (style == null) {
- style = styleSheet.addStyle("body", null);
- }
- if (style.getAttribute(CSS.Attribute.MARGIN_TOP) == null) {
- styleSheet.addCSSAttribute(style, CSS.Attribute.MARGIN_TOP, "0");
- }
- if (style.getAttribute(CSS.Attribute.MARGIN_LEFT) == null) {
- styleSheet.addCSSAttribute(style, CSS.Attribute.MARGIN_LEFT, "0");
- }
- if (style.getAttribute(CSS.Attribute.MARGIN_BOTTOM) == null) {
- styleSheet.addCSSAttribute(style, CSS.Attribute.MARGIN_BOTTOM, "0");
- }
- if (style.getAttribute(CSS.Attribute.MARGIN_RIGHT) == null) {
- styleSheet.addCSSAttribute(style, CSS.Attribute.MARGIN_RIGHT, "0");
- }
-
- // default fonts
- if (defaultFont != null) {
- setDefaultFont(styleSheet, "body", defaultFont);
- setDefaultFont(styleSheet, "p", defaultFont);
- setDefaultFont(styleSheet, "span", defaultFont);
- setDefaultFont(styleSheet, "th", defaultFont);
- setDefaultFont(styleSheet, "td", defaultFont);
- }
-
- // correct font and color units
- Pattern fontSizeWithUnitPat = Pattern.compile("([0-9]+)([^0-9]+)");
- Pattern colorThreeDigitPat = Pattern.compile("#(.)(.)(.)");
- for (Enumeration<?> en = styleSheet.getStyleNames(); en.hasMoreElements();) {
- String nm = (String) en.nextElement();
- style = styleSheet.getStyle(nm);
- for (Enumeration<?> en2 = style.getAttributeNames(); en2.hasMoreElements();) {
- Object attKey = en2.nextElement();
- CSS.Attribute cssAtt = cssMap.get("" + attKey);
- String value = "" + style.getAttribute(attKey);
- if (cssAtt != null) {
- if (cssAtt == CSS.Attribute.FONT_SIZE) {
- Matcher m = fontSizeWithUnitPat.matcher(value);
- if (m.matches()) {
- value = m.group(1);
- styleSheet.addCSSAttribute(style, cssAtt, value);
- }
- }
- else if (cssAtt == CSS.Attribute.COLOR || cssAtt == CSS.Attribute.BACKGROUND_COLOR || cssAtt == CSS.Attribute.BORDER_COLOR) {
- Matcher m = colorThreeDigitPat.matcher(value);
- if (m.matches()) {
- value = "#" + m.group(1) + m.group(1) + m.group(2) + m.group(2) + m.group(3) + m.group(3);
- styleSheet.addCSSAttribute(style, cssAtt, value);
- }
- }
- }
- }
- }
- // clean font tags if any styles are present
- doc.writeLockEx();
- visitDocument(doc, new IDocumentVisitor() {
- @Override
- public void visitElement(Element elem) {
- // nop
- }
-
- @Override
- public void visitAttribute(Element elem, AttributeSet atts, Object nm, Object value) {
- if (nm == HTML.Attribute.FACE || nm == HTML.Attribute.SIZE || nm == CSS.Attribute.FONT_FAMILY || nm == CSS.Attribute.FONT_SIZE) {
- if (atts instanceof MutableAttributeSet) {
- ((MutableAttributeSet) atts).removeAttribute(nm);
- }
- }
- }
- });
- doc.writeUnlockEx();
- return htmlDoc;
- }
-
- /**
- * Mail HTML may contain cid:xxxx URLs for local contents. This method
- * replaces such local cid URLs by real file URLs (normally a temporary
- * folder)
- */
- public static HTMLDocument replaceContendIDs(HTMLDocument htmlDoc, final Map<String, URL> cidToUrlMapping) {
- if (htmlDoc == null) {
- return htmlDoc;
- }
- MutableHTMLDocument doc = (MutableHTMLDocument) htmlDoc;
- StyleSheet styleSheet = doc.getStyleSheet();
- final IntegerHolder changeCount = new IntegerHolder(0);
- // visit all css attributes for occurrences of "cid:" URLs
- Pattern cidPattern = Pattern.compile(".*url\\s*\\(\\s*cid:(.*)\\s*\\).*");
- for (Enumeration<?> en = styleSheet.getStyleNames(); en.hasMoreElements();) {
- String nm = (String) en.nextElement();
- Style style = styleSheet.getStyle(nm);
- for (Enumeration<?> en2 = style.getAttributeNames(); en2.hasMoreElements();) {
- Object attKey = en2.nextElement();
- CSS.Attribute cssAtt = cssMap.get("" + attKey);
- String value = "" + style.getAttribute(attKey);
- if (cssAtt != null && (!value.equals("null")) && value.length() > 0) {
- Matcher m = cidPattern.matcher(value);
- if (m.matches()) {
- String cid = m.group(1);
- URL url = cidToUrlMapping.get(cid);
- if (url != null) {
- styleSheet.addCSSAttribute(style, cssAtt, "url(" + url.toExternalForm() + ")");
- changeCount.setValue(changeCount.getValue() + 1);
- }
- }
- }
- }
- }
- // visit all img tags for occurrences of "cid:" URLs
- doc.writeLockEx();
- visitDocument(doc, new IDocumentVisitor() {
- @Override
- public void visitElement(Element elem) {
- }
-
- @Override
- public void visitAttribute(Element elem, AttributeSet atts, Object nm, Object value) {
- if (nm == HTML.Attribute.SRC || nm == HTML.Attribute.HREF) {
- String src = "" + value;
- if (src.startsWith("cid:")) {
- String cid = src.substring(4);
- URL url = cidToUrlMapping.get(cid);
- if (url != null) {
- if (atts instanceof MutableAttributeSet) {
- ((MutableAttributeSet) atts).addAttribute(nm, url.toExternalForm());
- changeCount.setValue(changeCount.getValue() + 1);
- }
- }
- }
- }
- }
- });
- doc.writeUnlockEx();
- return htmlDoc;
- }
-
- public static HTMLDocument copyReferencedFilesToCache(HTMLDocument htmlDoc, final File cacheDir) {
- if (htmlDoc == null) {
- return htmlDoc;
- }
- MutableHTMLDocument doc = (MutableHTMLDocument) htmlDoc;
- // StyleSheet styleSheet=doc.getStyleSheet();
- final IntegerHolder changeCount = new IntegerHolder(0);
- // visit all img tags for occurrences of "cid:" URLs
- doc.writeLockEx();
- visitDocument(doc, new IDocumentVisitor() {
- @Override
- public void visitElement(Element elem) {
- }
-
- @Override
- public void visitAttribute(Element elem, AttributeSet atts, Object nm, Object value) {
- if (nm == HTML.Attribute.SRC || nm == HTML.Attribute.HREF) {
- String src = "" + value;
- URL url;
- try {
- url = new URL(src);
- File f = new File(url.getFile());
- if (f.exists() && !f.getParentFile().getAbsolutePath().equalsIgnoreCase(cacheDir.getAbsolutePath())) {
- // this file is not yet in cache and needs to be copied to cache
- File cacheFile = new File(cacheDir, f.getName());
- if (cacheFile.exists() && cacheFile.length() != f.length()) {
- IOUtility.writeContent(new FileOutputStream(cacheFile), IOUtility.getContent(new FileInputStream(f)));
- }
- // change attribute value
- if (atts instanceof MutableAttributeSet) {
- ((MutableAttributeSet) atts).addAttribute(nm, f.getName());
- changeCount.setValue(changeCount.getValue() + 1);
- }
- }
- }
- catch (MalformedURLException e) {
- }
- catch (Exception e) {
- LOG.warn(null, e);
- }
- }
- }
- });
- doc.writeUnlockEx();
- return htmlDoc;
- }
-
- public static String getPlainText(HTMLDocument htmlDoc) {
- if (htmlDoc == null) {
- return "";
- }
- try {
- return htmlDoc.getText(0, htmlDoc.getLength());
- }
- catch (BadLocationException e) {
- return "";
- }
- }
-
- /**
- * @return simple and quick conversion of html text to plain text without parsing and building of a html model
- * <p>
- * Rule based conversion:
- *
- * <pre>
- * <xmp>
- * <br>|<br/>
- * |
- *
- * </p>
- * |
- * <p/>
- * |</tr>|</table> create newlines </xmp></pre>
- */
- public static String getPlainText(String s) {
- s = StringUtility.getTag(s, "body");
- if (s == null || s.length() == 0) {
- return s;
- }
- //newlines
- s = s.replaceAll("\n", " ");
- s = s.replaceAll("<br>|<br/>|</p>|<p/>|</tr>|</table>", "\n");
- //remove tags
- s = Pattern.compile("<[^>]+>", Pattern.DOTALL).matcher(s).replaceAll(" ");
- //remove multiple spaces
- s = s.replaceAll("[ ]+", " ");
- //remove spaces at the beginning and end of each line
- s = s.replaceAll("[ ]+\n", "\n");
- s = s.replaceAll("\n[ ]+", "\n");
- s = StringUtility.htmlDecode(s);
- s = s.trim();
- return s;
- }
-
- /**
- * @return encoded text, ready to be included in a html text
- * <xmp>replaces &, ", ', <, > and all whitespace</xmp>
- */
- public static String encodeText(String s) {
- return StringUtility.htmlEncode(s, true);
- }
-
- /**
- * @return decoded text, ready to be printed as text
- * <xmp>replaces &, ", ', <, > and all whitespace</xmp>
- */
- public static String decodeText(String s) {
- return StringUtility.htmlDecode(s);
- }
-
- private static void visitDocument(HTMLDocument doc, IDocumentVisitor v) {
- visitElementRec(doc.getDefaultRootElement(), v);
- }
-
- private static void visitElementRec(Element elem, IDocumentVisitor v) {
- v.visitElement(elem);
- visitAttributeRec(elem, elem.getAttributes(), v);
- if (elem instanceof AbstractDocument.AbstractElement) {
- for (Enumeration en = ((AbstractDocument.AbstractElement) elem).children(); en != null && en.hasMoreElements();) {
- visitElementRec((Element) en.nextElement(), v);
- }
- }
- }
-
- private static void visitAttributeRec(Element elem, AttributeSet atts, IDocumentVisitor v) {
- for (Enumeration<?> en = atts.getAttributeNames(); en.hasMoreElements();) {
- Object nm = en.nextElement();
- Object value = atts.getAttribute(nm);
- if (value instanceof AttributeSet) {
- visitAttributeRec(elem, (AttributeSet) value, v);
- }
- else {
- v.visitAttribute(elem, atts, nm, value);
- }
- }
- }
-
- private static void setDefaultFont(StyleSheet styleSheet, String styleName, DefaultFont defaultFont) {
- if (defaultFont == null) {
- return;
- }
-
- Style style = styleSheet.getStyle(styleName);
- if (style == null) {
- style = styleSheet.addStyle(styleName, null);
- }
- String family = defaultFont.getFamiliesConcatenated();
- if (style.getAttribute(CSS.Attribute.FONT_FAMILY) == null && family != null) {
- styleSheet.addCSSAttribute(style, CSS.Attribute.FONT_FAMILY, family);
- }
- if (style.getAttribute(CSS.Attribute.FONT_SIZE) == null && defaultFont.getSize() > 0 && defaultFont.getSizeUnit() != null) {
- styleSheet.addCSSAttribute(style, CSS.Attribute.FONT_SIZE, defaultFont.getSize() + defaultFont.getSizeUnit());
- }
- }
-
- /**
- * <p>
- * To add a meta element into the &lt;head&gt;&lt;/head&gt; section.
- * </p>
- * <p>
- * Precondition: &lt;head&gt; section must be contained in the given HTML text
- * </p>
- *
- * @param httpEquiv
- * the content type
- * @param content
- * the content
- * @param rawHtml
- * @return
- */
- private static String addHtmlMetaElement(String httpEquiv, String content, String rawHtml) {
- if (StringUtility.isNullOrEmpty(rawHtml)) {
- return rawHtml;
- }
-
- String metaTagContentType = "<meta http-equiv=\"" + httpEquiv + "\" content=\"" + content + "\"/>";
- rawHtml = Pattern.compile("(<meta\\s*http-equiv=\"" + httpEquiv + "\"\\s*content=\"[^\"]+\"\\s*/>)", Pattern.CASE_INSENSITIVE).matcher(rawHtml).replaceFirst(metaTagContentType);
- // check <meta> tag to contain Content-Type
- if (StringUtility.find(rawHtml, metaTagContentType) == -1) {
- // no <meta> tag containing Content-Type found. Insert just after <head> tag
- Matcher matcherHeadTag = createMatcherForTag(rawHtml, "head", false);
- if (matcherHeadTag.find()) {
- rawHtml = rawHtml.substring(0, matcherHeadTag.end()) + metaTagContentType + rawHtml.substring(matcherHeadTag.end(), rawHtml.length());
- }
- }
- return rawHtml;
- }
-
- /**
- * <p>
- * Removes quotes in style attribute which are not closed.
- * </p>
- * <p>
- * This is important as document cannot be loaded by @{DocumentParser} otherwise.
- * </p>
- *
- * @param rawHtml
- * @param singleStyleQuote
- * the quote character for the style attribte
- * @return
- */
- private static String removeUnclosedStyleQuotes(String rawHtml, boolean singleStyleQuote) {
- char styleQuoteChar;
- char innerQuoteChar;
- if (singleStyleQuote) {
- styleQuoteChar = '\'';
- innerQuoteChar = '"';
- }
- else {
- styleQuoteChar = '"';
- innerQuoteChar = '\'';
- }
-
- String regex = "(<[^>]+?style[\\s]*=[\\s]*" + styleQuoteChar + ")([^" + styleQuoteChar + ">]*?" + innerQuoteChar + "[^" + styleQuoteChar + ">]*?)(" + styleQuoteChar + "[^>]*?>)";
- Pattern pattern = Pattern.compile(regex, Pattern.CASE_INSENSITIVE | Pattern.DOTALL);
- Matcher matcher = pattern.matcher(rawHtml);
- while (matcher.find()) {
- String preStyleContent = matcher.group(1);
- String styleContent = matcher.group(2);
- String postStyleContent = matcher.group(3);
-
- int numOfTokens = ("prefix" + styleContent + "suffix").split(innerQuoteChar + "").length; // add some text before and after style content to ensure proper splitting
-
- // check that inner quote characters are closed meaning that an inner quote is closed by a subsequent inner quote and so on. Otherwise, HTML document cannot be loaded.
- // Inner quotes are not closed properly, if there is an even number of tokens, e.g. <p style='font-family:Cou'rier'>text</p> has 2 tokens.
- if (numOfTokens % 2 == 0) {
- // inner quotes not closed properly. Remove all inner quotes.
- styleContent = styleContent.replaceAll(String.valueOf(innerQuoteChar), "");
- rawHtml = matcher.replaceAll(preStyleContent + styleContent + postStyleContent);
- }
- }
- return rawHtml;
- }
-
- /**
- * Create a {@link Matcher} for the given tag. Please note that the tag is not considered to be an empty tag, e.g.
- * <code>&lt;br/&gt;</code>
- *
- * @param rawHtml
- * @param tag
- * the tag the matcher should be created for
- * @param endTag
- * to indicate whether to match the start or end tag
- * @return
- */
- private static Matcher createMatcherForTag(String rawHtml, String tag, boolean endTag) {
- String regex = "<\\s*" + (endTag ? "\\/" : "") + "\\s*" + tag + ".*?>";
- return Pattern.compile(regex, Pattern.CASE_INSENSITIVE | Pattern.DOTALL).matcher(rawHtml);
- }
-
- /**
- * Eliminates the vertical scrollbar by setting overflow:auto in body style attribute.
- *
- * @param rawHtml
- * @return
- */
- private static String eliminateVerticalScrollbar(String rawHtml) {
- try {
- // find body tag
- Matcher matcherBodyTag = createMatcherForTag(rawHtml, "body", false);
- if (!matcherBodyTag.find()) {
- return rawHtml;
- }
- String contentBodyTag = matcherBodyTag.group();
-
- // find style attribute
- Pattern pattern = Pattern.compile("style[\\s]*=[\\s]*([\"'])", Pattern.CASE_INSENSITIVE | Pattern.DOTALL);
- Matcher matcherStyleTag = pattern.matcher(contentBodyTag);
- if (matcherStyleTag.find()) {
- // style attribute available
- String styleQuoteChar = matcherStyleTag.group(1);
-
- // extract style attribute content
- pattern = Pattern.compile("(.+?style[\\s]*=[\\s]*" + styleQuoteChar + ")([^" + styleQuoteChar + ">]*?)(" + styleQuoteChar + ".*)", Pattern.CASE_INSENSITIVE | Pattern.DOTALL);
- matcherStyleTag = pattern.matcher(contentBodyTag);
- matcherStyleTag.find();
- String preStyleContent = matcherStyleTag.group(1);
- String styleContent = matcherStyleTag.group(2);
- String postStyleContent = matcherStyleTag.group(3);
- // ensure overflow:auto in style attribute
- if (!styleContent.toLowerCase().contains("overflow")) {
- if (styleContent.trim().length() > 0 && !styleContent.endsWith(";")) {
- styleContent += ";";
- }
- styleContent += "overflow:auto;";
- rawHtml = matcherBodyTag.replaceFirst(preStyleContent + styleContent + postStyleContent);
- }
- }
- else {
- // no style attribute available
- int endBracket = contentBodyTag.lastIndexOf(">");
- contentBodyTag = contentBodyTag.substring(0, endBracket) + " style=\"overflow:auto;\">";
- rawHtml = matcherBodyTag.replaceAll(contentBodyTag);
- }
- }
- catch (Throwable e) {
- LOG.warn("failed to eliminate vertical scrollbar", e);
- }
-
- return rawHtml;
- }
-
- /**
- * To ensure default font settings set in CSS body style
- *
- * @param rawHtml
- * @param defaultFont
- * @return
- */
- private static String ensureDefaultFont(String rawHtml, DefaultFont defaultFont) {
- if (defaultFont == null || rawHtml == null) {
- return rawHtml;
- }
-
- // ensure style tag to be present. Create empty style definition if not existing.
- Matcher matcherStyleTag = createMatcherForTag(rawHtml, "style", false);
- if (matcherStyleTag.find()) {
- // style tag found: ensure style-type 'text/css'
- String styleTag = matcherStyleTag.group();
- if (!StringUtility.contains(styleTag, "type\\s*=\\s*['\"]text/css['\"]")) {
- rawHtml = matcherStyleTag.replaceFirst("<style type=\"text/css\">");
- }
- }
- else {
- // insert <style> tag just after <head> tag
- Matcher matcherHeadTag = createMatcherForTag(rawHtml, "head", false);
- matcherHeadTag.find();
- rawHtml = rawHtml.substring(0, matcherHeadTag.end()) + "<style type=\"text/css\"></style>" + rawHtml.substring(matcherHeadTag.end());
- }
-
- // extract content of <style> tag
- matcherStyleTag = createMatcherForTag(rawHtml, "style", false);
- matcherStyleTag.find();
- Matcher matcherStyleEndTag = createMatcherForTag(rawHtml, "style", true);
- if (!matcherStyleEndTag.find()) {
- LOG.warn("No closing </style> tag found");
- return rawHtml;
- }
-
- String[] tags = new String[]{"body", "table", "tr", "th", "td", "span", "p"};
- for (String tag : tags) {
- rawHtml = ensureDefaultFontForHtmlTag(rawHtml, defaultFont, tag);
- }
- return rawHtml;
- }
-
- private static String ensureDefaultFontForHtmlTag(String rawHtml, DefaultFont defaultFont, String htmlTag) {
- if (StringUtility.isNullOrEmpty(rawHtml) || StringUtility.isNullOrEmpty(htmlTag) || defaultFont == null) {
- return rawHtml;
- }
-
- Matcher matcherStyleTag = createMatcherForTag(rawHtml, "style", false);
- if (!matcherStyleTag.find()) {
- return rawHtml;
- }
- Matcher matcherStyleEndTag = createMatcherForTag(rawHtml, "style", true);
- if (!matcherStyleEndTag.find()) {
- return rawHtml;
- }
-
- String styleContent = rawHtml.substring(matcherStyleTag.end(), matcherStyleEndTag.start());
-
- // ensure style to be present for the given HTML tag. Create empty style if not existing.
- Pattern patternTagStyle = Pattern.compile("(.*?" + htmlTag + "[^\\{]*?\\s*\\{)\\s*([^\\}]*?)\\s*(\\}.*)", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL);
- Matcher matcherTagStyle = patternTagStyle.matcher(styleContent);
- if (!matcherTagStyle.find()) {
- styleContent = StringUtility.join("", styleContent, htmlTag + "{}");
- }
- // extract style for the given HTML tag
- matcherTagStyle = patternTagStyle.matcher(styleContent);
- matcherTagStyle.find();
- String preTagStyleContent = matcherTagStyle.group(1);
- String tagStyleContent = StringUtility.trim(StringUtility.nvl(matcherTagStyle.group(2), ""));
- String postTagStyleContent = matcherTagStyle.group(3);
-
- // check if combined font formatting is configured. If so, do not change style definition to not loose custom style definition.
- if (tagStyleContent.contains("font:")) {
- return rawHtml;
- }
-
- // assemble font formatting
- String fontFamily = defaultFont.getFamiliesConcatenated();
- // font-family
- if (fontFamily != null && !StringUtility.contains(tagStyleContent, "font-family")) {
- if (StringUtility.hasText(tagStyleContent) && !tagStyleContent.endsWith(";")) {
- tagStyleContent += ";";
- }
- tagStyleContent += "font-family:" + defaultFont.getFamiliesConcatenated() + ";";
- }
- // font-size
- int fontSize = defaultFont.getSize();
- if (fontSize > 0 && !StringUtility.contains(tagStyleContent, "font-size")) {
- if (StringUtility.hasText(tagStyleContent) && !tagStyleContent.endsWith(";")) {
- tagStyleContent += ";";
- }
- tagStyleContent += "font-size:" + StringUtility.join("", String.valueOf(defaultFont.getSize()), defaultFont.getSizeUnit()) + ";";
- }
- // foreground color
- if (!StringUtility.contains(tagStyleContent, "[\\s;]color:")) {
- if (StringUtility.hasText(tagStyleContent) && !tagStyleContent.endsWith(";")) {
- tagStyleContent += ";";
- }
- String fgHex = Integer.toHexString(defaultFont.getForegroundColor());
- tagStyleContent += "color:#" + StringUtility.lpad(fgHex, "0", 6) + ";";
- }
- styleContent = (preTagStyleContent + tagStyleContent + postTagStyleContent);
-
- // replace style definition
- matcherStyleTag = createMatcherForTag(rawHtml, "style", false);
- matcherStyleTag.find();
- matcherStyleEndTag = createMatcherForTag(rawHtml, "style", true);
- matcherStyleEndTag.find();
- return rawHtml.substring(0, matcherStyleTag.end()) + styleContent + rawHtml.substring(matcherStyleEndTag.start());
- }
-
- private static class MutableHTMLDocument extends HTMLDocument {
- private static final long serialVersionUID = 1L;
-
- public MutableHTMLDocument() {
- super();
- }
-
- public MutableHTMLDocument(StyleSheet styles) {
- super(styles);
- }
-
- public MutableHTMLDocument(Content c, StyleSheet styles) {
- super(c, styles);
- }
-
- public void writeLockEx() {
- writeLock();
- }
-
- public void writeUnlockEx() {
- writeUnlock();
- }
- }
-
- private static interface IDocumentVisitor {
- void visitElement(Element elem);
-
- void visitAttribute(Element elem, AttributeSet atts, Object nm, Object value);
- }
-
- public static class DefaultFont {
- private String[] m_families;
- private int m_size;
- private String m_sizeUnit;
- private int m_foregroundColor;
-
- public DefaultFont() {
- m_families = new String[]{"sans-serif"};
- m_size = 12;
- m_sizeUnit = "pt";
- m_foregroundColor = 0x000000;
- }
-
- public String[] getFamilies() {
- if (m_families == null) {
- return new String[0];
- }
- return m_families;
- }
-
- public void setFamilies(String[] families) {
- m_families = families;
- }
-
- /**
- * @return the concatenated font families
- */
- public String getFamiliesConcatenated() {
- String familyString = null;
- for (String familiy : getFamilies()) {
- if (!StringUtility.hasText(familiy)) {
- continue;
- }
- // in case of whitespace characters, quote font-family
- if (familiy.matches(".*\\s.*")) {
- familiy = "'" + familiy + "'";
- }
- familyString = StringUtility.join(",", familyString, familiy);
- }
- return familyString;
- }
-
- public int getSize() {
- return m_size;
- }
-
- public void setSize(int size) {
- m_size = size;
- }
-
- public String getSizeUnit() {
- return m_sizeUnit;
- }
-
- public void setSizeUnit(String sizeUnit) {
- m_sizeUnit = sizeUnit;
- }
-
- public int getForegroundColor() {
- return m_foregroundColor;
- }
-
- public void setForegroundColor(int foregroundColor) {
- m_foregroundColor = foregroundColor;
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.swing.text.AbstractDocument;
+import javax.swing.text.AttributeSet;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.Element;
+import javax.swing.text.MutableAttributeSet;
+import javax.swing.text.Style;
+import javax.swing.text.html.CSS;
+import javax.swing.text.html.HTML;
+import javax.swing.text.html.HTMLDocument;
+import javax.swing.text.html.HTMLEditorKit;
+import javax.swing.text.html.StyleSheet;
+import javax.swing.text.html.parser.DocumentParser;
+import javax.swing.text.html.parser.ParserDelegator;
+
+import org.eclipse.scout.commons.holders.IntegerHolder;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+
+/**
+ * Utility to manipulate HTML documents regardless of ui (swt / swing). This
+ * class is used from swt as well as in swing code
+ */
+public final class HTMLUtility {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(HTMLUtility.class);
+
+ private static HashMap<String, CSS.Attribute> cssMap;
+
+ private HTMLUtility() {
+ }
+
+ static {
+ CSSPatch.apply();
+ cssMap = new HashMap<String, CSS.Attribute>();
+ cssMap.put(CSS.Attribute.COLOR.toString(), CSS.Attribute.COLOR);
+ cssMap.put(CSS.Attribute.BACKGROUND_COLOR.toString(), CSS.Attribute.BACKGROUND_COLOR);
+ cssMap.put(CSS.Attribute.BORDER_COLOR.toString(), CSS.Attribute.BORDER_COLOR);
+ cssMap.put(CSS.Attribute.FONT_SIZE.toString(), CSS.Attribute.FONT_SIZE);
+ cssMap.put(CSS.Attribute.BACKGROUND_IMAGE.toString(), CSS.Attribute.BACKGROUND_IMAGE);
+ cssMap.put(CSS.Attribute.LIST_STYLE_IMAGE.toString(), CSS.Attribute.LIST_STYLE_IMAGE);
+ }
+
+ /**
+ * <p>
+ * Creates a {@link HTMLDocument} from the given HTML text.
+ * </p>
+ * <p>
+ * Please note, that all &lt;meta&gt; elements are removed. This is because setting a charset would cause an exception
+ * as {@link DocumentParser} does not allow to specify the charset in HTML text. Due to failsafe, all other
+ * &lt;meta&gt; tags are removed as well as just informative anyway.
+ * </p>
+ *
+ * @param htmlText
+ * @return
+ */
+ public static HTMLDocument toHtmlDocument(String htmlText) {
+ if (StringUtility.isNullOrEmpty(htmlText)) {
+ return null;
+ }
+ HTMLEditorKit kit = new HTMLEditorKit();
+ // remove meta tags (see JavaDoc of @{link HTMLDocument#parseDocument(String)} for more information)
+ Pattern[] metaPatterns = new Pattern[]{
+ Pattern.compile("<meta\\s+[^>]*>"),
+ Pattern.compile("<Meta\\s+[^>]*>"),
+ Pattern.compile("<META\\s+[^>]*>"),
+ Pattern.compile("</\\s*meta\\s*>"),
+ Pattern.compile("</\\s*Meta\\s*>"),
+ Pattern.compile("</\\s*META\\s*>"),
+ };
+ for (Pattern p : metaPatterns) {
+ htmlText = p.matcher(htmlText).replaceAll("");
+ }
+
+ // Remove quotes in style attribute which are not closed.
+ htmlText = HTMLUtility.removeUnclosedStyleQuotes(htmlText, true);
+ htmlText = HTMLUtility.removeUnclosedStyleQuotes(htmlText, false);
+
+ // fix incorrect single tag endings ( <br/ > <br /> )
+ htmlText = htmlText.replaceAll("/\\s+>", "/>");
+ htmlText = htmlText.replaceAll("([^\\s])\\s+/>", "$1/>");
+ // before jre 1.6 eliminate single tags and </br> tags
+ if (System.getProperty("java.version", "1.5").substring(0, 3).compareTo("1.6") < 0) {
+ htmlText = htmlText.replaceAll("/>", ">");
+ htmlText = htmlText.replaceAll("</\\s*br\\s*>", "");
+ }
+ StyleSheet styleSheet = new StyleSheet();
+ MutableHTMLDocument doc = new MutableHTMLDocument(styleSheet);
+ try {
+ doc.setParser(new ParserDelegator());
+ doc.setTokenThreshold(100);
+ doc.remove(0, doc.getLength());
+ kit.read(new StringReader(htmlText), doc, 0);
+ }
+ catch (Exception e) {
+ LOG.warn(null, e);
+ return null;
+ }
+ return doc;
+ }
+
+ public static String toHtmlText(HTMLDocument doc) {
+ String htmlText = "";
+ if (doc == null) {
+ return htmlText;
+ }
+
+ try {
+ HTMLEditorKit kit = new HTMLEditorKit();
+ StringWriter buf = new StringWriter();
+ kit.write(buf, doc, 0, doc.getLength());
+ htmlText = buf.toString();
+ }
+ catch (Throwable t) {
+ LOG.error("failed to extract HTML text from HTML document", t);
+ }
+ return htmlText;
+ }
+
+ /**
+ * <p>
+ * Applies some intelligence to the HTML document to ensure a valid HTML document.
+ * </p>
+ *
+ * @param rawHtml
+ * the raw HTML document
+ * @param ensureContentType
+ * to add missing meta directive &lt;meta http-equiv="content-type" content="text/html;charset=UTF-8"/>
+ * @param cleanupCss
+ * to cleanup CSS as HTML has some trouble with some style constructs.<br/>
+ * <small>For more information, please refer to {@link HTMLUtility#cleanupCss(HTMLDocument, DefaultFont)}
+ * </small>
+ * @param defaultFont
+ * to ensure default font set
+ * @return the formatted HTML document
+ */
+ public static String cleanupHtml(String rawHtml, boolean ensureContentType, boolean cleanupCss, DefaultFont defaultFont) {
+ rawHtml = StringUtility.nvl(rawHtml, "");
+
+ try {
+ // 1a) ensure <HTML> tag
+ Matcher matcherHtmlTag = createMatcherForTag(rawHtml, "html", false);
+ if (!matcherHtmlTag.find()) {
+ // no <html> tag found. Insert <html> tag just before first tag
+ Matcher matcherFirstTag = Pattern.compile("<\\s*?[^!/][^>]*?>", Pattern.CASE_INSENSITIVE).matcher(rawHtml);
+ if (matcherFirstTag.find()) {
+ rawHtml = rawHtml.substring(0, matcherFirstTag.start()) + "<html>" + rawHtml.substring(matcherFirstTag.start(), rawHtml.length());
+ }
+ else {
+ // no tag found at all. Insert just after DOCTYPE declarations
+ Matcher matcherComment = Pattern.compile("<\\![^>]+?>", Pattern.CASE_INSENSITIVE).matcher(rawHtml);
+ int index = 0;
+ while (matcherComment.find()) {
+ index = matcherComment.end();
+ }
+ rawHtml = rawHtml.substring(0, index) + "<html>" + rawHtml.substring(index);
+ }
+ }
+
+ // 1b) ensure </HTML> tag
+ Matcher matcherHtmlEndTag = createMatcherForTag(rawHtml, "html", true);
+ if (!matcherHtmlEndTag.find()) {
+ rawHtml = rawHtml += "</html>";
+ }
+
+ // 2a) ensure <HEAD> tag
+ Matcher matcherHeadTag = createMatcherForTag(rawHtml, "head", false);
+ if (!matcherHeadTag.find()) {
+ // no <head> tag found. Insert just after <html> tag
+ matcherHtmlTag = createMatcherForTag(rawHtml, "html", false);
+ matcherHtmlTag.find();
+ rawHtml = rawHtml.substring(0, matcherHtmlTag.end()) + "<head>" + rawHtml.substring(matcherHtmlTag.end(), rawHtml.length());
+ }
+
+ // 2b) ensure </HEAD> tag
+ Matcher matcherHeadEndTag = createMatcherForTag(rawHtml, "head", true);
+ if (!matcherHeadEndTag.find()) {
+ // no </head> tag found. Insert just after <head> tag
+ matcherHeadTag = createMatcherForTag(rawHtml, "head", false);
+ matcherHeadTag.find();
+ rawHtml = rawHtml.substring(0, matcherHeadTag.end()) + "</head>" + rawHtml.substring(matcherHeadTag.end(), rawHtml.length());
+ }
+
+ // 3) in case of no default font specified in HTML, add default style. This is to adapt the application L&F.
+ if (!cleanupCss && defaultFont != null) {
+ rawHtml = ensureDefaultFont(rawHtml, defaultFont);
+ }
+ // 4a) ensure <BODY> tag
+ Matcher matcherBodyTag = createMatcherForTag(rawHtml, "body", false);
+ if (!matcherBodyTag.find()) {
+ // no <body> tag found. Insert just after </head> tag
+ matcherHeadEndTag = createMatcherForTag(rawHtml, "head", true);
+ matcherHeadEndTag.find();
+ rawHtml = rawHtml.substring(0, matcherHeadEndTag.end()) + "<body>" + rawHtml.substring(matcherHeadEndTag.end(), rawHtml.length());
+ }
+
+ // 4b) ensure </BODY> tag
+ Matcher matcherBodyEndTag = createMatcherForTag(rawHtml, "body", true);
+ if (!matcherBodyEndTag.find()) {
+ // no </body> tag found. Insert just before </html> tag
+ matcherHtmlEndTag = createMatcherForTag(rawHtml, "html", true);
+ matcherHtmlEndTag.find();
+ rawHtml = rawHtml.substring(0, matcherHtmlEndTag.start()) + "</body>" + rawHtml.substring(matcherHtmlEndTag.start(), rawHtml.length());
+ }
+
+ // 5) Eliminate vertical scrollbar
+ rawHtml = eliminateVerticalScrollbar(rawHtml);
+
+ // 6) cleanup CSS of document
+ if (cleanupCss) {
+ HTMLDocument htmlDoc = HTMLUtility.toHtmlDocument(rawHtml);
+ if (htmlDoc != null) {
+ htmlDoc = HTMLUtility.cleanupCss(htmlDoc, defaultFont);
+ rawHtml = HTMLUtility.toHtmlText(htmlDoc);
+ }
+ }
+
+ // 7) ensure <META> element with content-type and charset (This must be done after 6) as <META> tags are removed in cleanup)
+ if (ensureContentType) {
+ rawHtml = HTMLUtility.addHtmlMetaElement("content-type", "text/html;charset=UTF-8", rawHtml);
+ }
+ }
+ catch (Throwable t) {
+ // failsafe
+ LOG.warn("failed to cleanup HTML document", t);
+ }
+
+ return rawHtml;
+ }
+
+ /**
+ * HTML has several troubles with some CSS and tag style concepts.
+ *
+ * @param htmlDoc
+ * @param defaultFont
+ * @return
+ */
+ public static HTMLDocument cleanupCss(HTMLDocument htmlDoc, DefaultFont defaultFont) {
+ if (htmlDoc == null) {
+ return htmlDoc;
+ }
+ MutableHTMLDocument doc = (MutableHTMLDocument) htmlDoc;
+ StyleSheet styleSheet = doc.getStyleSheet();
+ Style style;
+ // p style
+ style = styleSheet.getStyle("p");
+ if (style == null) {
+ style = styleSheet.addStyle("p", null);
+ styleSheet.addCSSAttribute(style, CSS.Attribute.MARGIN_LEFT, "0");
+ styleSheet.addCSSAttribute(style, CSS.Attribute.MARGIN_RIGHT, "0");
+ styleSheet.addCSSAttribute(style, CSS.Attribute.MARGIN_TOP, "4");
+ styleSheet.addCSSAttribute(style, CSS.Attribute.MARGIN_BOTTOM, "4");
+ styleSheet.addCSSAttribute(style, CSS.Attribute.PADDING_LEFT, "0");
+ styleSheet.addCSSAttribute(style, CSS.Attribute.PADDING_RIGHT, "0");
+ styleSheet.addCSSAttribute(style, CSS.Attribute.PADDING_TOP, "0");
+ styleSheet.addCSSAttribute(style, CSS.Attribute.PADDING_BOTTOM, "0");
+ }
+ // a style
+ style = styleSheet.getStyle("a");
+ if (style == null) {
+ style = styleSheet.addStyle("a", null);
+ }
+ if (style.getAttribute(CSS.Attribute.COLOR) == null) {
+ styleSheet.addCSSAttribute(style, CSS.Attribute.COLOR, "#3366cc");
+ }
+ if (style.getAttribute(CSS.Attribute.TEXT_DECORATION) == null) {
+ styleSheet.addCSSAttribute(style, CSS.Attribute.TEXT_DECORATION, "underline");
+ }
+ // body style
+ style = styleSheet.getStyle("body");
+ if (style == null) {
+ style = styleSheet.addStyle("body", null);
+ }
+ if (style.getAttribute(CSS.Attribute.MARGIN_TOP) == null) {
+ styleSheet.addCSSAttribute(style, CSS.Attribute.MARGIN_TOP, "0");
+ }
+ if (style.getAttribute(CSS.Attribute.MARGIN_LEFT) == null) {
+ styleSheet.addCSSAttribute(style, CSS.Attribute.MARGIN_LEFT, "0");
+ }
+ if (style.getAttribute(CSS.Attribute.MARGIN_BOTTOM) == null) {
+ styleSheet.addCSSAttribute(style, CSS.Attribute.MARGIN_BOTTOM, "0");
+ }
+ if (style.getAttribute(CSS.Attribute.MARGIN_RIGHT) == null) {
+ styleSheet.addCSSAttribute(style, CSS.Attribute.MARGIN_RIGHT, "0");
+ }
+
+ // default fonts
+ if (defaultFont != null) {
+ setDefaultFont(styleSheet, "body", defaultFont);
+ setDefaultFont(styleSheet, "p", defaultFont);
+ setDefaultFont(styleSheet, "span", defaultFont);
+ setDefaultFont(styleSheet, "th", defaultFont);
+ setDefaultFont(styleSheet, "td", defaultFont);
+ }
+
+ // correct font and color units
+ Pattern fontSizeWithUnitPat = Pattern.compile("([0-9]+)([^0-9]+)");
+ Pattern colorThreeDigitPat = Pattern.compile("#(.)(.)(.)");
+ for (Enumeration<?> en = styleSheet.getStyleNames(); en.hasMoreElements();) {
+ String nm = (String) en.nextElement();
+ style = styleSheet.getStyle(nm);
+ for (Enumeration<?> en2 = style.getAttributeNames(); en2.hasMoreElements();) {
+ Object attKey = en2.nextElement();
+ CSS.Attribute cssAtt = cssMap.get("" + attKey);
+ String value = "" + style.getAttribute(attKey);
+ if (cssAtt != null) {
+ if (cssAtt == CSS.Attribute.FONT_SIZE) {
+ Matcher m = fontSizeWithUnitPat.matcher(value);
+ if (m.matches()) {
+ value = m.group(1);
+ styleSheet.addCSSAttribute(style, cssAtt, value);
+ }
+ }
+ else if (cssAtt == CSS.Attribute.COLOR || cssAtt == CSS.Attribute.BACKGROUND_COLOR || cssAtt == CSS.Attribute.BORDER_COLOR) {
+ Matcher m = colorThreeDigitPat.matcher(value);
+ if (m.matches()) {
+ value = "#" + m.group(1) + m.group(1) + m.group(2) + m.group(2) + m.group(3) + m.group(3);
+ styleSheet.addCSSAttribute(style, cssAtt, value);
+ }
+ }
+ }
+ }
+ }
+ // clean font tags if any styles are present
+ doc.writeLockEx();
+ visitDocument(doc, new IDocumentVisitor() {
+ @Override
+ public void visitElement(Element elem) {
+ // nop
+ }
+
+ @Override
+ public void visitAttribute(Element elem, AttributeSet atts, Object nm, Object value) {
+ if (nm == HTML.Attribute.FACE || nm == HTML.Attribute.SIZE || nm == CSS.Attribute.FONT_FAMILY || nm == CSS.Attribute.FONT_SIZE) {
+ if (atts instanceof MutableAttributeSet) {
+ ((MutableAttributeSet) atts).removeAttribute(nm);
+ }
+ }
+ }
+ });
+ doc.writeUnlockEx();
+ return htmlDoc;
+ }
+
+ /**
+ * Mail HTML may contain cid:xxxx URLs for local contents. This method
+ * replaces such local cid URLs by real file URLs (normally a temporary
+ * folder)
+ */
+ public static HTMLDocument replaceContendIDs(HTMLDocument htmlDoc, final Map<String, URL> cidToUrlMapping) {
+ if (htmlDoc == null) {
+ return htmlDoc;
+ }
+ MutableHTMLDocument doc = (MutableHTMLDocument) htmlDoc;
+ StyleSheet styleSheet = doc.getStyleSheet();
+ final IntegerHolder changeCount = new IntegerHolder(0);
+ // visit all css attributes for occurrences of "cid:" URLs
+ Pattern cidPattern = Pattern.compile(".*url\\s*\\(\\s*cid:(.*)\\s*\\).*");
+ for (Enumeration<?> en = styleSheet.getStyleNames(); en.hasMoreElements();) {
+ String nm = (String) en.nextElement();
+ Style style = styleSheet.getStyle(nm);
+ for (Enumeration<?> en2 = style.getAttributeNames(); en2.hasMoreElements();) {
+ Object attKey = en2.nextElement();
+ CSS.Attribute cssAtt = cssMap.get("" + attKey);
+ String value = "" + style.getAttribute(attKey);
+ if (cssAtt != null && (!value.equals("null")) && value.length() > 0) {
+ Matcher m = cidPattern.matcher(value);
+ if (m.matches()) {
+ String cid = m.group(1);
+ URL url = cidToUrlMapping.get(cid);
+ if (url != null) {
+ styleSheet.addCSSAttribute(style, cssAtt, "url(" + url.toExternalForm() + ")");
+ changeCount.setValue(changeCount.getValue() + 1);
+ }
+ }
+ }
+ }
+ }
+ // visit all img tags for occurrences of "cid:" URLs
+ doc.writeLockEx();
+ visitDocument(doc, new IDocumentVisitor() {
+ @Override
+ public void visitElement(Element elem) {
+ }
+
+ @Override
+ public void visitAttribute(Element elem, AttributeSet atts, Object nm, Object value) {
+ if (nm == HTML.Attribute.SRC || nm == HTML.Attribute.HREF) {
+ String src = "" + value;
+ if (src.startsWith("cid:")) {
+ String cid = src.substring(4);
+ URL url = cidToUrlMapping.get(cid);
+ if (url != null) {
+ if (atts instanceof MutableAttributeSet) {
+ ((MutableAttributeSet) atts).addAttribute(nm, url.toExternalForm());
+ changeCount.setValue(changeCount.getValue() + 1);
+ }
+ }
+ }
+ }
+ }
+ });
+ doc.writeUnlockEx();
+ return htmlDoc;
+ }
+
+ public static HTMLDocument copyReferencedFilesToCache(HTMLDocument htmlDoc, final File cacheDir) {
+ if (htmlDoc == null) {
+ return htmlDoc;
+ }
+ MutableHTMLDocument doc = (MutableHTMLDocument) htmlDoc;
+ // StyleSheet styleSheet=doc.getStyleSheet();
+ final IntegerHolder changeCount = new IntegerHolder(0);
+ // visit all img tags for occurrences of "cid:" URLs
+ doc.writeLockEx();
+ visitDocument(doc, new IDocumentVisitor() {
+ @Override
+ public void visitElement(Element elem) {
+ }
+
+ @Override
+ public void visitAttribute(Element elem, AttributeSet atts, Object nm, Object value) {
+ if (nm == HTML.Attribute.SRC || nm == HTML.Attribute.HREF) {
+ String src = "" + value;
+ URL url;
+ try {
+ url = new URL(src);
+ File f = new File(url.getFile());
+ if (f.exists() && !f.getParentFile().getAbsolutePath().equalsIgnoreCase(cacheDir.getAbsolutePath())) {
+ // this file is not yet in cache and needs to be copied to cache
+ File cacheFile = new File(cacheDir, f.getName());
+ if (cacheFile.exists() && cacheFile.length() != f.length()) {
+ IOUtility.writeContent(new FileOutputStream(cacheFile), IOUtility.getContent(new FileInputStream(f)));
+ }
+ // change attribute value
+ if (atts instanceof MutableAttributeSet) {
+ ((MutableAttributeSet) atts).addAttribute(nm, f.getName());
+ changeCount.setValue(changeCount.getValue() + 1);
+ }
+ }
+ }
+ catch (MalformedURLException e) {
+ }
+ catch (Exception e) {
+ LOG.warn(null, e);
+ }
+ }
+ }
+ });
+ doc.writeUnlockEx();
+ return htmlDoc;
+ }
+
+ public static String getPlainText(HTMLDocument htmlDoc) {
+ if (htmlDoc == null) {
+ return "";
+ }
+ try {
+ return htmlDoc.getText(0, htmlDoc.getLength());
+ }
+ catch (BadLocationException e) {
+ return "";
+ }
+ }
+
+ /**
+ * @return simple and quick conversion of html text to plain text without parsing and building of a html model
+ * <p>
+ * Rule based conversion:
+ *
+ * <pre>
+ * <xmp>
+ * <br>|<br/>
+ * |
+ *
+ * </p>
+ * |
+ * <p/>
+ * |</tr>|</table> create newlines </xmp></pre>
+ */
+ public static String getPlainText(String s) {
+ s = StringUtility.getTag(s, "body");
+ if (s == null || s.length() == 0) {
+ return s;
+ }
+ //newlines
+ s = s.replaceAll("\n", " ");
+ s = s.replaceAll("<br>|<br/>|</p>|<p/>|</tr>|</table>", "\n");
+ //remove tags
+ s = Pattern.compile("<[^>]+>", Pattern.DOTALL).matcher(s).replaceAll(" ");
+ //remove multiple spaces
+ s = s.replaceAll("[ ]+", " ");
+ //remove spaces at the beginning and end of each line
+ s = s.replaceAll("[ ]+\n", "\n");
+ s = s.replaceAll("\n[ ]+", "\n");
+ s = StringUtility.htmlDecode(s);
+ s = s.trim();
+ return s;
+ }
+
+ /**
+ * @return encoded text, ready to be included in a html text
+ * <xmp>replaces &, ", ', <, > and all whitespace</xmp>
+ */
+ public static String encodeText(String s) {
+ return StringUtility.htmlEncode(s, true);
+ }
+
+ /**
+ * @return decoded text, ready to be printed as text
+ * <xmp>replaces &, ", ', <, > and all whitespace</xmp>
+ */
+ public static String decodeText(String s) {
+ return StringUtility.htmlDecode(s);
+ }
+
+ private static void visitDocument(HTMLDocument doc, IDocumentVisitor v) {
+ visitElementRec(doc.getDefaultRootElement(), v);
+ }
+
+ private static void visitElementRec(Element elem, IDocumentVisitor v) {
+ v.visitElement(elem);
+ visitAttributeRec(elem, elem.getAttributes(), v);
+ if (elem instanceof AbstractDocument.AbstractElement) {
+ for (Enumeration en = ((AbstractDocument.AbstractElement) elem).children(); en != null && en.hasMoreElements();) {
+ visitElementRec((Element) en.nextElement(), v);
+ }
+ }
+ }
+
+ private static void visitAttributeRec(Element elem, AttributeSet atts, IDocumentVisitor v) {
+ for (Enumeration<?> en = atts.getAttributeNames(); en.hasMoreElements();) {
+ Object nm = en.nextElement();
+ Object value = atts.getAttribute(nm);
+ if (value instanceof AttributeSet) {
+ visitAttributeRec(elem, (AttributeSet) value, v);
+ }
+ else {
+ v.visitAttribute(elem, atts, nm, value);
+ }
+ }
+ }
+
+ private static void setDefaultFont(StyleSheet styleSheet, String styleName, DefaultFont defaultFont) {
+ if (defaultFont == null) {
+ return;
+ }
+
+ Style style = styleSheet.getStyle(styleName);
+ if (style == null) {
+ style = styleSheet.addStyle(styleName, null);
+ }
+ String family = defaultFont.getFamiliesConcatenated();
+ if (style.getAttribute(CSS.Attribute.FONT_FAMILY) == null && family != null) {
+ styleSheet.addCSSAttribute(style, CSS.Attribute.FONT_FAMILY, family);
+ }
+ if (style.getAttribute(CSS.Attribute.FONT_SIZE) == null && defaultFont.getSize() > 0 && defaultFont.getSizeUnit() != null) {
+ styleSheet.addCSSAttribute(style, CSS.Attribute.FONT_SIZE, defaultFont.getSize() + defaultFont.getSizeUnit());
+ }
+ }
+
+ /**
+ * <p>
+ * To add a meta element into the &lt;head&gt;&lt;/head&gt; section.
+ * </p>
+ * <p>
+ * Precondition: &lt;head&gt; section must be contained in the given HTML text
+ * </p>
+ *
+ * @param httpEquiv
+ * the content type
+ * @param content
+ * the content
+ * @param rawHtml
+ * @return
+ */
+ private static String addHtmlMetaElement(String httpEquiv, String content, String rawHtml) {
+ if (StringUtility.isNullOrEmpty(rawHtml)) {
+ return rawHtml;
+ }
+
+ String metaTagContentType = "<meta http-equiv=\"" + httpEquiv + "\" content=\"" + content + "\"/>";
+ rawHtml = Pattern.compile("(<meta\\s*http-equiv=\"" + httpEquiv + "\"\\s*content=\"[^\"]+\"\\s*/>)", Pattern.CASE_INSENSITIVE).matcher(rawHtml).replaceFirst(metaTagContentType);
+ // check <meta> tag to contain Content-Type
+ if (StringUtility.find(rawHtml, metaTagContentType) == -1) {
+ // no <meta> tag containing Content-Type found. Insert just after <head> tag
+ Matcher matcherHeadTag = createMatcherForTag(rawHtml, "head", false);
+ if (matcherHeadTag.find()) {
+ rawHtml = rawHtml.substring(0, matcherHeadTag.end()) + metaTagContentType + rawHtml.substring(matcherHeadTag.end(), rawHtml.length());
+ }
+ }
+ return rawHtml;
+ }
+
+ /**
+ * <p>
+ * Removes quotes in style attribute which are not closed.
+ * </p>
+ * <p>
+ * This is important as document cannot be loaded by @{DocumentParser} otherwise.
+ * </p>
+ *
+ * @param rawHtml
+ * @param singleStyleQuote
+ * the quote character for the style attribte
+ * @return
+ */
+ private static String removeUnclosedStyleQuotes(String rawHtml, boolean singleStyleQuote) {
+ char styleQuoteChar;
+ char innerQuoteChar;
+ if (singleStyleQuote) {
+ styleQuoteChar = '\'';
+ innerQuoteChar = '"';
+ }
+ else {
+ styleQuoteChar = '"';
+ innerQuoteChar = '\'';
+ }
+
+ String regex = "(<[^>]+?style[\\s]*=[\\s]*" + styleQuoteChar + ")([^" + styleQuoteChar + ">]*?" + innerQuoteChar + "[^" + styleQuoteChar + ">]*?)(" + styleQuoteChar + "[^>]*?>)";
+ Pattern pattern = Pattern.compile(regex, Pattern.CASE_INSENSITIVE | Pattern.DOTALL);
+ Matcher matcher = pattern.matcher(rawHtml);
+ while (matcher.find()) {
+ String preStyleContent = matcher.group(1);
+ String styleContent = matcher.group(2);
+ String postStyleContent = matcher.group(3);
+
+ int numOfTokens = ("prefix" + styleContent + "suffix").split(innerQuoteChar + "").length; // add some text before and after style content to ensure proper splitting
+
+ // check that inner quote characters are closed meaning that an inner quote is closed by a subsequent inner quote and so on. Otherwise, HTML document cannot be loaded.
+ // Inner quotes are not closed properly, if there is an even number of tokens, e.g. <p style='font-family:Cou'rier'>text</p> has 2 tokens.
+ if (numOfTokens % 2 == 0) {
+ // inner quotes not closed properly. Remove all inner quotes.
+ styleContent = styleContent.replaceAll(String.valueOf(innerQuoteChar), "");
+ rawHtml = matcher.replaceAll(preStyleContent + styleContent + postStyleContent);
+ }
+ }
+ return rawHtml;
+ }
+
+ /**
+ * Create a {@link Matcher} for the given tag. Please note that the tag is not considered to be an empty tag, e.g.
+ * <code>&lt;br/&gt;</code>
+ *
+ * @param rawHtml
+ * @param tag
+ * the tag the matcher should be created for
+ * @param endTag
+ * to indicate whether to match the start or end tag
+ * @return
+ */
+ private static Matcher createMatcherForTag(String rawHtml, String tag, boolean endTag) {
+ String regex = "<\\s*" + (endTag ? "\\/" : "") + "\\s*" + tag + ".*?>";
+ return Pattern.compile(regex, Pattern.CASE_INSENSITIVE | Pattern.DOTALL).matcher(rawHtml);
+ }
+
+ /**
+ * Eliminates the vertical scrollbar by setting overflow:auto in body style attribute.
+ *
+ * @param rawHtml
+ * @return
+ */
+ private static String eliminateVerticalScrollbar(String rawHtml) {
+ try {
+ // find body tag
+ Matcher matcherBodyTag = createMatcherForTag(rawHtml, "body", false);
+ if (!matcherBodyTag.find()) {
+ return rawHtml;
+ }
+ String contentBodyTag = matcherBodyTag.group();
+
+ // find style attribute
+ Pattern pattern = Pattern.compile("style[\\s]*=[\\s]*([\"'])", Pattern.CASE_INSENSITIVE | Pattern.DOTALL);
+ Matcher matcherStyleTag = pattern.matcher(contentBodyTag);
+ if (matcherStyleTag.find()) {
+ // style attribute available
+ String styleQuoteChar = matcherStyleTag.group(1);
+
+ // extract style attribute content
+ pattern = Pattern.compile("(.+?style[\\s]*=[\\s]*" + styleQuoteChar + ")([^" + styleQuoteChar + ">]*?)(" + styleQuoteChar + ".*)", Pattern.CASE_INSENSITIVE | Pattern.DOTALL);
+ matcherStyleTag = pattern.matcher(contentBodyTag);
+ matcherStyleTag.find();
+ String preStyleContent = matcherStyleTag.group(1);
+ String styleContent = matcherStyleTag.group(2);
+ String postStyleContent = matcherStyleTag.group(3);
+ // ensure overflow:auto in style attribute
+ if (!styleContent.toLowerCase().contains("overflow")) {
+ if (styleContent.trim().length() > 0 && !styleContent.endsWith(";")) {
+ styleContent += ";";
+ }
+ styleContent += "overflow:auto;";
+ rawHtml = matcherBodyTag.replaceFirst(preStyleContent + styleContent + postStyleContent);
+ }
+ }
+ else {
+ // no style attribute available
+ int endBracket = contentBodyTag.lastIndexOf(">");
+ contentBodyTag = contentBodyTag.substring(0, endBracket) + " style=\"overflow:auto;\">";
+ rawHtml = matcherBodyTag.replaceAll(contentBodyTag);
+ }
+ }
+ catch (Throwable e) {
+ LOG.warn("failed to eliminate vertical scrollbar", e);
+ }
+
+ return rawHtml;
+ }
+
+ /**
+ * To ensure default font settings set in CSS body style
+ *
+ * @param rawHtml
+ * @param defaultFont
+ * @return
+ */
+ private static String ensureDefaultFont(String rawHtml, DefaultFont defaultFont) {
+ if (defaultFont == null || rawHtml == null) {
+ return rawHtml;
+ }
+
+ // ensure style tag to be present. Create empty style definition if not existing.
+ Matcher matcherStyleTag = createMatcherForTag(rawHtml, "style", false);
+ if (matcherStyleTag.find()) {
+ // style tag found: ensure style-type 'text/css'
+ String styleTag = matcherStyleTag.group();
+ if (!StringUtility.contains(styleTag, "type\\s*=\\s*['\"]text/css['\"]")) {
+ rawHtml = matcherStyleTag.replaceFirst("<style type=\"text/css\">");
+ }
+ }
+ else {
+ // insert <style> tag just after <head> tag
+ Matcher matcherHeadTag = createMatcherForTag(rawHtml, "head", false);
+ matcherHeadTag.find();
+ rawHtml = rawHtml.substring(0, matcherHeadTag.end()) + "<style type=\"text/css\"></style>" + rawHtml.substring(matcherHeadTag.end());
+ }
+
+ // extract content of <style> tag
+ matcherStyleTag = createMatcherForTag(rawHtml, "style", false);
+ matcherStyleTag.find();
+ Matcher matcherStyleEndTag = createMatcherForTag(rawHtml, "style", true);
+ if (!matcherStyleEndTag.find()) {
+ LOG.warn("No closing </style> tag found");
+ return rawHtml;
+ }
+
+ String[] tags = new String[]{"body", "table", "tr", "th", "td", "span", "p"};
+ for (String tag : tags) {
+ rawHtml = ensureDefaultFontForHtmlTag(rawHtml, defaultFont, tag);
+ }
+ return rawHtml;
+ }
+
+ private static String ensureDefaultFontForHtmlTag(String rawHtml, DefaultFont defaultFont, String htmlTag) {
+ if (StringUtility.isNullOrEmpty(rawHtml) || StringUtility.isNullOrEmpty(htmlTag) || defaultFont == null) {
+ return rawHtml;
+ }
+
+ Matcher matcherStyleTag = createMatcherForTag(rawHtml, "style", false);
+ if (!matcherStyleTag.find()) {
+ return rawHtml;
+ }
+ Matcher matcherStyleEndTag = createMatcherForTag(rawHtml, "style", true);
+ if (!matcherStyleEndTag.find()) {
+ return rawHtml;
+ }
+
+ String styleContent = rawHtml.substring(matcherStyleTag.end(), matcherStyleEndTag.start());
+
+ // ensure style to be present for the given HTML tag. Create empty style if not existing.
+ Pattern patternTagStyle = Pattern.compile("(.*?" + htmlTag + "[^\\{]*?\\s*\\{)\\s*([^\\}]*?)\\s*(\\}.*)", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL);
+ Matcher matcherTagStyle = patternTagStyle.matcher(styleContent);
+ if (!matcherTagStyle.find()) {
+ styleContent = StringUtility.join("", styleContent, htmlTag + "{}");
+ }
+ // extract style for the given HTML tag
+ matcherTagStyle = patternTagStyle.matcher(styleContent);
+ matcherTagStyle.find();
+ String preTagStyleContent = matcherTagStyle.group(1);
+ String tagStyleContent = StringUtility.trim(StringUtility.nvl(matcherTagStyle.group(2), ""));
+ String postTagStyleContent = matcherTagStyle.group(3);
+
+ // check if combined font formatting is configured. If so, do not change style definition to not loose custom style definition.
+ if (tagStyleContent.contains("font:")) {
+ return rawHtml;
+ }
+
+ // assemble font formatting
+ String fontFamily = defaultFont.getFamiliesConcatenated();
+ // font-family
+ if (fontFamily != null && !StringUtility.contains(tagStyleContent, "font-family")) {
+ if (StringUtility.hasText(tagStyleContent) && !tagStyleContent.endsWith(";")) {
+ tagStyleContent += ";";
+ }
+ tagStyleContent += "font-family:" + defaultFont.getFamiliesConcatenated() + ";";
+ }
+ // font-size
+ int fontSize = defaultFont.getSize();
+ if (fontSize > 0 && !StringUtility.contains(tagStyleContent, "font-size")) {
+ if (StringUtility.hasText(tagStyleContent) && !tagStyleContent.endsWith(";")) {
+ tagStyleContent += ";";
+ }
+ tagStyleContent += "font-size:" + StringUtility.join("", String.valueOf(defaultFont.getSize()), defaultFont.getSizeUnit()) + ";";
+ }
+ // foreground color
+ if (!StringUtility.contains(tagStyleContent, "[\\s;]color:")) {
+ if (StringUtility.hasText(tagStyleContent) && !tagStyleContent.endsWith(";")) {
+ tagStyleContent += ";";
+ }
+ String fgHex = Integer.toHexString(defaultFont.getForegroundColor());
+ tagStyleContent += "color:#" + StringUtility.lpad(fgHex, "0", 6) + ";";
+ }
+ styleContent = (preTagStyleContent + tagStyleContent + postTagStyleContent);
+
+ // replace style definition
+ matcherStyleTag = createMatcherForTag(rawHtml, "style", false);
+ matcherStyleTag.find();
+ matcherStyleEndTag = createMatcherForTag(rawHtml, "style", true);
+ matcherStyleEndTag.find();
+ return rawHtml.substring(0, matcherStyleTag.end()) + styleContent + rawHtml.substring(matcherStyleEndTag.start());
+ }
+
+ private static class MutableHTMLDocument extends HTMLDocument {
+ private static final long serialVersionUID = 1L;
+
+ public MutableHTMLDocument() {
+ super();
+ }
+
+ public MutableHTMLDocument(StyleSheet styles) {
+ super(styles);
+ }
+
+ public MutableHTMLDocument(Content c, StyleSheet styles) {
+ super(c, styles);
+ }
+
+ public void writeLockEx() {
+ writeLock();
+ }
+
+ public void writeUnlockEx() {
+ writeUnlock();
+ }
+ }
+
+ private static interface IDocumentVisitor {
+ void visitElement(Element elem);
+
+ void visitAttribute(Element elem, AttributeSet atts, Object nm, Object value);
+ }
+
+ public static class DefaultFont {
+ private String[] m_families;
+ private int m_size;
+ private String m_sizeUnit;
+ private int m_foregroundColor;
+
+ public DefaultFont() {
+ m_families = new String[]{"sans-serif"};
+ m_size = 12;
+ m_sizeUnit = "pt";
+ m_foregroundColor = 0x000000;
+ }
+
+ public String[] getFamilies() {
+ if (m_families == null) {
+ return new String[0];
+ }
+ return m_families;
+ }
+
+ public void setFamilies(String[] families) {
+ m_families = families;
+ }
+
+ /**
+ * @return the concatenated font families
+ */
+ public String getFamiliesConcatenated() {
+ String familyString = null;
+ for (String familiy : getFamilies()) {
+ if (!StringUtility.hasText(familiy)) {
+ continue;
+ }
+ // in case of whitespace characters, quote font-family
+ if (familiy.matches(".*\\s.*")) {
+ familiy = "'" + familiy + "'";
+ }
+ familyString = StringUtility.join(",", familyString, familiy);
+ }
+ return familyString;
+ }
+
+ public int getSize() {
+ return m_size;
+ }
+
+ public void setSize(int size) {
+ m_size = size;
+ }
+
+ public String getSizeUnit() {
+ return m_sizeUnit;
+ }
+
+ public void setSizeUnit(String sizeUnit) {
+ m_sizeUnit = sizeUnit;
+ }
+
+ public int getForegroundColor() {
+ return m_foregroundColor;
+ }
+
+ public void setForegroundColor(int foregroundColor) {
+ m_foregroundColor = foregroundColor;
+ }
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/IOUtility.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/IOUtility.java
index 92b54da216..ea64e60dc3 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/IOUtility.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/IOUtility.java
@@ -1,542 +1,542 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.BufferedReader;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileFilter;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.Reader;
-import java.io.StringWriter;
-import java.io.UnsupportedEncodingException;
-import java.io.Writer;
-import java.net.URL;
-import java.net.URLDecoder;
-import java.net.URLEncoder;
-import java.util.ArrayList;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-
-public final class IOUtility {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(IOUtility.class);
-
- private IOUtility() {
- }
-
- /**
- * retrieve content as raw bytes
- */
- public static byte[] getContent(InputStream stream) throws ProcessingException {
- return getContent(stream, true);
- }
-
- public static byte[] getContent(InputStream stream, boolean autoClose) throws ProcessingException {
- BufferedInputStream in = null;
- try {
- in = new BufferedInputStream(stream);
- ByteArrayOutputStream buffer = new ByteArrayOutputStream();
- byte[] b = new byte[10240];
- int len;
- while ((len = in.read(b)) > 0) {
- buffer.write(b, 0, len);
- }
- buffer.close();
- byte[] data = buffer.toByteArray();
- return data;
- }
- catch (IOException e) {
- throw new ProcessingException("input: " + stream, e);
- }
- finally {
- try {
- if (autoClose) {
- if (in != null) {
- in.close();
- }
- }
- }
- catch (IOException e) {
- throw new ProcessingException("input: " + stream, e);
- }
- }
- }
-
- public static byte[] getContent(String filename) throws ProcessingException {
- try {
- return getContent(new FileInputStream(toFile(filename)), true);
- }
- catch (FileNotFoundException e) {
- throw new ProcessingException("filename: " + filename, e);
- }
- }
-
- /**
- * write content as raw bytes
- */
- public static void writeContent(OutputStream stream, byte[] data) throws ProcessingException {
- writeContent(stream, data, true);
- }
-
- public static void writeContent(OutputStream stream, byte[] data, boolean autoClose) throws ProcessingException {
- BufferedOutputStream out = null;
- try {
- out = new BufferedOutputStream(stream);
- out.write(data);
- }
- catch (IOException e) {
- throw new ProcessingException("output: " + stream, e);
- }
- finally {
- try {
- if (autoClose) {
- if (out != null) {
- out.close();
- }
- }
- }
- catch (IOException e) {
- throw new ProcessingException("output: " + stream, e);
- }
- }
- }
-
- public static void writeContent(String filename, Object o) throws ProcessingException {
- File f = toFile(filename);
- try {
- if (o instanceof byte[]) {
- writeContent(new FileOutputStream(f), (byte[]) o);
- }
- else if (o instanceof char[]) {
- writeContent(new FileWriter(f), new String((char[]) o));
- }
- else if (o != null) {
- writeContent(new FileWriter(f), o.toString());
- }
- }
- catch (FileNotFoundException n) {
- throw new ProcessingException("filename: " + filename, n);
- }
- catch (IOException e) {
- throw new ProcessingException("filename: " + filename, e);
- }
- }
-
- public static void writeContent(Writer stream, String text) throws ProcessingException {
- writeContent(stream, text, true);
- }
-
- public static void writeContent(Writer stream, String text, boolean autoClose) throws ProcessingException {
- try {
- stream.write(text);
- }
- catch (IOException e) {
- throw new ProcessingException("output: " + stream, e);
- }
- finally {
- try {
- if (autoClose) {
- if (stream != null) {
- stream.close();
- }
- }
- }
- catch (IOException e) {
- throw new ProcessingException("output: " + stream, e);
- }
-
- }
- }
-
- /**
- * retrieve content as string (correct charcter conversion)
- */
- public static String getContent(Reader stream) throws ProcessingException {
- return getContent(stream, true);
- }
-
- public static String getContent(Reader stream, boolean autoClose) throws ProcessingException {
- BufferedReader in = null;
- try {
- in = new BufferedReader(stream);
- StringWriter buffer = new StringWriter();
- char[] b = new char[10240];
- int len;
- while ((len = in.read(b)) > 0) {
- buffer.write(b, 0, len);
- }
- buffer.close();
- return buffer.toString();
- }
- catch (IOException e) {
- throw new ProcessingException("input: " + stream, e);
- }
-
- finally {
- try {
- if (autoClose) {
- if (in != null) {
- in.close();
- }
- }
- }
- catch (IOException e) {
- throw new ProcessingException("input: " + stream, e);
- }
- }
- }
-
- /**
- * Directory browsing including subtree
- */
- public static File[] listFilesInSubtree(File dir, FileFilter filter) {
- ArrayList<File> list = new ArrayList<File>();
- listFilesRec(dir, filter, list);
- return list.toArray(new File[list.size()]);
- }
-
- private static void listFilesRec(File dir, FileFilter filter, ArrayList<File> intoList) {
- if (dir != null && dir.exists() && dir.isDirectory()) {
- File[] a = dir.listFiles(filter);
- for (int i = 0; a != null && i < a.length; i++) {
- if (a[i].isDirectory()) {
- listFilesRec(a[i], filter, intoList);
- }
- else {
- intoList.add(a[i]);
- }
- }
- }
- }
-
- /**
- * creates a temporary directory with a random name and the given suffix
- */
- public static File createTempDirectory(String dirSuffix) throws ProcessingException {
- try {
- if (dirSuffix != null) {
- dirSuffix = dirSuffix.replaceAll("[:*?\\\"<>|]*", "");
- }
- File tmp = File.createTempFile("dir", dirSuffix);
- tmp.delete();
- tmp.mkdirs();
- tmp.deleteOnExit();
- return tmp;
- }
- catch (IOException e) {
- throw new ProcessingException("dir: " + dirSuffix, e);
- }
- }
-
- public static File createTempFile(String fileName, byte[] content) throws ProcessingException {
- try {
- if (fileName != null) {
- fileName = fileName.replaceAll("[\\\\/:*?\\\"<>|]*", "");
- }
- if (fileName == null || fileName.length() == 0) {
- fileName = getTempFileName("tmp");
- }
- File f = File.createTempFile("tmp", ".tmp");
- File f2 = new File(f.getParentFile(), new File(fileName).getName());
- if (f2.exists() && !f2.delete()) {
- throw new IOException("File " + f2 + " exists and cannot be deleted");
- }
- boolean ok = f.renameTo(f2);
- if (!ok) {
- throw new IOException("failed renaming " + f + " to " + f2);
- }
- f2.deleteOnExit();
- if (content != null) {
- writeContent(new FileOutputStream(f2), content);
- }
- else {
- f2.createNewFile();
- }
- return f2;
- }
- catch (IOException e) {
- throw new ProcessingException("filename: " + fileName, e);
- }
- }
-
- public static File createTempFile(String prefix, String suffix, byte[] content) throws ProcessingException {
- File f = null;
- try {
- f = File.createTempFile(prefix, suffix);
- f.deleteOnExit();
- if (content != null) {
- writeContent(new FileOutputStream(f), content);
- }
- return f;
- }
- catch (IOException e) {
- throw new ProcessingException("filename: " + f, e);
- }
- }
-
- public static boolean deleteDirectory(File dir) {
- if (dir != null && dir.exists()) {
- File[] a = dir.listFiles();
- for (int i = 0; a != null && i < a.length; i++) {
- if (a[i].isDirectory()) {
- deleteDirectory(a[i]);
- }
- else {
- a[i].delete();
- }
- }
- return dir.delete();
- }
- return true;
- }
-
- public static boolean deleteDirectory(String dir) {
- File f = toFile(dir);
- if (f.exists()) {
- return deleteDirectory(f);
- }
- else {
- return false;
- }
- }
-
- public static boolean createDirectory(String dir) {
- if (dir != null) {
- dir = dir.replaceAll("[*?\\\"<>|]*", "");
- File f = toFile(dir);
- return f.mkdirs();
- }
- return false;
- }
-
- public static boolean deleteFile(String filePath) {
- if (filePath != null) {
- File f = toFile(filePath);
- if (f.exists()) {
- return f.delete();
- }
- }
- return false;
- }
-
- public static String exec(String cmd, String[] envp, File dir) throws ProcessingException {
- StringWriter sw = new StringWriter();
- try {
- Process p = Runtime.getRuntime().exec(cmd, envp, dir);
- new StreamDumper(p.getInputStream(), sw).start();
- new StreamDumper(p.getErrorStream(), sw).start();
- int code = -1;
- try {
- code = p.waitFor();
- }
- catch (InterruptedException e) {
- }
- if (code != 0) {
- throw new IOException("returncode is " + code);
- }
- return sw.toString();
- }
- catch (IOException e) {
- throw new ProcessingException("cmd: " + cmd, e);
- }
- }
-
- /**
- * file handling
- */
- public static long getFileSize(String filepath) {
- if (filepath == null) {
- return 0;
- }
- else {
- File f = toFile(filepath);
- return getFileSize(f);
- }
- }
-
- public static long getFileSize(File filepath) {
- if (filepath == null) {
- return 0;
- }
- else {
- if (filepath.exists()) {
- return filepath.length();
- }
- else {
- return 0;
- }
- }
- }
-
- public static long getFileLastModified(String filepath) {
- if (filepath == null) {
- return 0;
- }
- else {
- File f = toFile(filepath);
- if (f.exists()) {
- return f.lastModified();
- }
- else {
- return 0;
- }
- }
- }
-
- /**
- * @return the name of the file only
- */
- public static String getFileName(String filepath) {
- if (filepath == null) {
- return null;
- }
- File f = toFile(filepath);
- return f.getName();
- }
-
- /**
- * @return a valid File representing s with support for both / and \ as path
- * separators.
- */
- public static File toFile(String s) {
- if (s == null) {
- return null;
- }
- else {
- return new File(s.replace('\\', File.separatorChar).replace('/', File.separatorChar));
- }
- }
-
- /**
- * @return the extension of the file
- */
- public static String getFileExtension(String filename) {
- if (filename == null) {
- return null;
- }
- int i = filename.lastIndexOf(".");
- if (i < 0) {
- return null;
- }
- else {
- return filename.substring(i + 1);
- }
- }
-
- /**
- * @return the path of the file without its name
- */
- public static String getFilePath(String filepath) {
- if (filepath == null) {
- return null;
- }
- File f = toFile(filepath);
- return f.getParent();
- }
-
- public static boolean fileExists(String s) {
- if (s != null) {
- File f = toFile(s);
- return f.exists();
- }
- else {
- return false;
- }
- }
-
- public static String getTempFileName(String fileExtension) throws ProcessingException {
- try {
- File f = File.createTempFile("tmp", fileExtension);
- f.delete();
- return f.getAbsolutePath();
- }
- catch (IOException e) {
- throw new ProcessingException("extension: " + fileExtension, e);
- }
- }
-
- public static String urlEncode(String o) throws ProcessingException {
- String s;
- if (o == null) {
- s = "";
- }
- else {
- s = o.toString().trim();
- }
- if (s.length() == 0) {
- s = " ";
- }
- try {
- s = URLEncoder.encode(s, "UTF-8");// Build 158 needed an encoding
- s = StringUtility.replace(s, "+", "%20");
- }
- catch (UnsupportedEncodingException e) {
- }
- return s;
- }
-
- public static String urlDecode(String o) throws ProcessingException {
- String s;
- if (o == null) {
- s = "";
- }
- else {
- s = o.toString().trim();
- }
- try {
- s = URLDecoder.decode(s, "UTF-8");// Build 158 needed an encoding
- }
- catch (UnsupportedEncodingException e) {
- }
- return s;
- }
-
- /**
- * The text passed to this method is tried to wellform as an URL. If the text
- * can not be transformed into an URL the method returns null.
- *
- * @param urlText
- */
- public static URL urlTextToUrl(String urlText) {
- String text = urlText;
- URL url = null;
- if (text != null && text.length() > 0) {
- try {
- url = new URL(text);
- }
- catch (Exception e) {
- if (text.contains("@")) {
- text = "mailto:" + text;
- }
- else {
- text = "http://" + text;
- }
- try {
- url = new URL(text);
- }
- catch (Exception e1) {
- LOG.debug("Could not create url from : " + text + ":" + e1);
- }
- }
- }
- return url;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.BufferedReader;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.io.StringWriter;
+import java.io.UnsupportedEncodingException;
+import java.io.Writer;
+import java.net.URL;
+import java.net.URLDecoder;
+import java.net.URLEncoder;
+import java.util.ArrayList;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+
+public final class IOUtility {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(IOUtility.class);
+
+ private IOUtility() {
+ }
+
+ /**
+ * retrieve content as raw bytes
+ */
+ public static byte[] getContent(InputStream stream) throws ProcessingException {
+ return getContent(stream, true);
+ }
+
+ public static byte[] getContent(InputStream stream, boolean autoClose) throws ProcessingException {
+ BufferedInputStream in = null;
+ try {
+ in = new BufferedInputStream(stream);
+ ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+ byte[] b = new byte[10240];
+ int len;
+ while ((len = in.read(b)) > 0) {
+ buffer.write(b, 0, len);
+ }
+ buffer.close();
+ byte[] data = buffer.toByteArray();
+ return data;
+ }
+ catch (IOException e) {
+ throw new ProcessingException("input: " + stream, e);
+ }
+ finally {
+ try {
+ if (autoClose) {
+ if (in != null) {
+ in.close();
+ }
+ }
+ }
+ catch (IOException e) {
+ throw new ProcessingException("input: " + stream, e);
+ }
+ }
+ }
+
+ public static byte[] getContent(String filename) throws ProcessingException {
+ try {
+ return getContent(new FileInputStream(toFile(filename)), true);
+ }
+ catch (FileNotFoundException e) {
+ throw new ProcessingException("filename: " + filename, e);
+ }
+ }
+
+ /**
+ * write content as raw bytes
+ */
+ public static void writeContent(OutputStream stream, byte[] data) throws ProcessingException {
+ writeContent(stream, data, true);
+ }
+
+ public static void writeContent(OutputStream stream, byte[] data, boolean autoClose) throws ProcessingException {
+ BufferedOutputStream out = null;
+ try {
+ out = new BufferedOutputStream(stream);
+ out.write(data);
+ }
+ catch (IOException e) {
+ throw new ProcessingException("output: " + stream, e);
+ }
+ finally {
+ try {
+ if (autoClose) {
+ if (out != null) {
+ out.close();
+ }
+ }
+ }
+ catch (IOException e) {
+ throw new ProcessingException("output: " + stream, e);
+ }
+ }
+ }
+
+ public static void writeContent(String filename, Object o) throws ProcessingException {
+ File f = toFile(filename);
+ try {
+ if (o instanceof byte[]) {
+ writeContent(new FileOutputStream(f), (byte[]) o);
+ }
+ else if (o instanceof char[]) {
+ writeContent(new FileWriter(f), new String((char[]) o));
+ }
+ else if (o != null) {
+ writeContent(new FileWriter(f), o.toString());
+ }
+ }
+ catch (FileNotFoundException n) {
+ throw new ProcessingException("filename: " + filename, n);
+ }
+ catch (IOException e) {
+ throw new ProcessingException("filename: " + filename, e);
+ }
+ }
+
+ public static void writeContent(Writer stream, String text) throws ProcessingException {
+ writeContent(stream, text, true);
+ }
+
+ public static void writeContent(Writer stream, String text, boolean autoClose) throws ProcessingException {
+ try {
+ stream.write(text);
+ }
+ catch (IOException e) {
+ throw new ProcessingException("output: " + stream, e);
+ }
+ finally {
+ try {
+ if (autoClose) {
+ if (stream != null) {
+ stream.close();
+ }
+ }
+ }
+ catch (IOException e) {
+ throw new ProcessingException("output: " + stream, e);
+ }
+
+ }
+ }
+
+ /**
+ * retrieve content as string (correct charcter conversion)
+ */
+ public static String getContent(Reader stream) throws ProcessingException {
+ return getContent(stream, true);
+ }
+
+ public static String getContent(Reader stream, boolean autoClose) throws ProcessingException {
+ BufferedReader in = null;
+ try {
+ in = new BufferedReader(stream);
+ StringWriter buffer = new StringWriter();
+ char[] b = new char[10240];
+ int len;
+ while ((len = in.read(b)) > 0) {
+ buffer.write(b, 0, len);
+ }
+ buffer.close();
+ return buffer.toString();
+ }
+ catch (IOException e) {
+ throw new ProcessingException("input: " + stream, e);
+ }
+
+ finally {
+ try {
+ if (autoClose) {
+ if (in != null) {
+ in.close();
+ }
+ }
+ }
+ catch (IOException e) {
+ throw new ProcessingException("input: " + stream, e);
+ }
+ }
+ }
+
+ /**
+ * Directory browsing including subtree
+ */
+ public static File[] listFilesInSubtree(File dir, FileFilter filter) {
+ ArrayList<File> list = new ArrayList<File>();
+ listFilesRec(dir, filter, list);
+ return list.toArray(new File[list.size()]);
+ }
+
+ private static void listFilesRec(File dir, FileFilter filter, ArrayList<File> intoList) {
+ if (dir != null && dir.exists() && dir.isDirectory()) {
+ File[] a = dir.listFiles(filter);
+ for (int i = 0; a != null && i < a.length; i++) {
+ if (a[i].isDirectory()) {
+ listFilesRec(a[i], filter, intoList);
+ }
+ else {
+ intoList.add(a[i]);
+ }
+ }
+ }
+ }
+
+ /**
+ * creates a temporary directory with a random name and the given suffix
+ */
+ public static File createTempDirectory(String dirSuffix) throws ProcessingException {
+ try {
+ if (dirSuffix != null) {
+ dirSuffix = dirSuffix.replaceAll("[:*?\\\"<>|]*", "");
+ }
+ File tmp = File.createTempFile("dir", dirSuffix);
+ tmp.delete();
+ tmp.mkdirs();
+ tmp.deleteOnExit();
+ return tmp;
+ }
+ catch (IOException e) {
+ throw new ProcessingException("dir: " + dirSuffix, e);
+ }
+ }
+
+ public static File createTempFile(String fileName, byte[] content) throws ProcessingException {
+ try {
+ if (fileName != null) {
+ fileName = fileName.replaceAll("[\\\\/:*?\\\"<>|]*", "");
+ }
+ if (fileName == null || fileName.length() == 0) {
+ fileName = getTempFileName("tmp");
+ }
+ File f = File.createTempFile("tmp", ".tmp");
+ File f2 = new File(f.getParentFile(), new File(fileName).getName());
+ if (f2.exists() && !f2.delete()) {
+ throw new IOException("File " + f2 + " exists and cannot be deleted");
+ }
+ boolean ok = f.renameTo(f2);
+ if (!ok) {
+ throw new IOException("failed renaming " + f + " to " + f2);
+ }
+ f2.deleteOnExit();
+ if (content != null) {
+ writeContent(new FileOutputStream(f2), content);
+ }
+ else {
+ f2.createNewFile();
+ }
+ return f2;
+ }
+ catch (IOException e) {
+ throw new ProcessingException("filename: " + fileName, e);
+ }
+ }
+
+ public static File createTempFile(String prefix, String suffix, byte[] content) throws ProcessingException {
+ File f = null;
+ try {
+ f = File.createTempFile(prefix, suffix);
+ f.deleteOnExit();
+ if (content != null) {
+ writeContent(new FileOutputStream(f), content);
+ }
+ return f;
+ }
+ catch (IOException e) {
+ throw new ProcessingException("filename: " + f, e);
+ }
+ }
+
+ public static boolean deleteDirectory(File dir) {
+ if (dir != null && dir.exists()) {
+ File[] a = dir.listFiles();
+ for (int i = 0; a != null && i < a.length; i++) {
+ if (a[i].isDirectory()) {
+ deleteDirectory(a[i]);
+ }
+ else {
+ a[i].delete();
+ }
+ }
+ return dir.delete();
+ }
+ return true;
+ }
+
+ public static boolean deleteDirectory(String dir) {
+ File f = toFile(dir);
+ if (f.exists()) {
+ return deleteDirectory(f);
+ }
+ else {
+ return false;
+ }
+ }
+
+ public static boolean createDirectory(String dir) {
+ if (dir != null) {
+ dir = dir.replaceAll("[*?\\\"<>|]*", "");
+ File f = toFile(dir);
+ return f.mkdirs();
+ }
+ return false;
+ }
+
+ public static boolean deleteFile(String filePath) {
+ if (filePath != null) {
+ File f = toFile(filePath);
+ if (f.exists()) {
+ return f.delete();
+ }
+ }
+ return false;
+ }
+
+ public static String exec(String cmd, String[] envp, File dir) throws ProcessingException {
+ StringWriter sw = new StringWriter();
+ try {
+ Process p = Runtime.getRuntime().exec(cmd, envp, dir);
+ new StreamDumper(p.getInputStream(), sw).start();
+ new StreamDumper(p.getErrorStream(), sw).start();
+ int code = -1;
+ try {
+ code = p.waitFor();
+ }
+ catch (InterruptedException e) {
+ }
+ if (code != 0) {
+ throw new IOException("returncode is " + code);
+ }
+ return sw.toString();
+ }
+ catch (IOException e) {
+ throw new ProcessingException("cmd: " + cmd, e);
+ }
+ }
+
+ /**
+ * file handling
+ */
+ public static long getFileSize(String filepath) {
+ if (filepath == null) {
+ return 0;
+ }
+ else {
+ File f = toFile(filepath);
+ return getFileSize(f);
+ }
+ }
+
+ public static long getFileSize(File filepath) {
+ if (filepath == null) {
+ return 0;
+ }
+ else {
+ if (filepath.exists()) {
+ return filepath.length();
+ }
+ else {
+ return 0;
+ }
+ }
+ }
+
+ public static long getFileLastModified(String filepath) {
+ if (filepath == null) {
+ return 0;
+ }
+ else {
+ File f = toFile(filepath);
+ if (f.exists()) {
+ return f.lastModified();
+ }
+ else {
+ return 0;
+ }
+ }
+ }
+
+ /**
+ * @return the name of the file only
+ */
+ public static String getFileName(String filepath) {
+ if (filepath == null) {
+ return null;
+ }
+ File f = toFile(filepath);
+ return f.getName();
+ }
+
+ /**
+ * @return a valid File representing s with support for both / and \ as path
+ * separators.
+ */
+ public static File toFile(String s) {
+ if (s == null) {
+ return null;
+ }
+ else {
+ return new File(s.replace('\\', File.separatorChar).replace('/', File.separatorChar));
+ }
+ }
+
+ /**
+ * @return the extension of the file
+ */
+ public static String getFileExtension(String filename) {
+ if (filename == null) {
+ return null;
+ }
+ int i = filename.lastIndexOf(".");
+ if (i < 0) {
+ return null;
+ }
+ else {
+ return filename.substring(i + 1);
+ }
+ }
+
+ /**
+ * @return the path of the file without its name
+ */
+ public static String getFilePath(String filepath) {
+ if (filepath == null) {
+ return null;
+ }
+ File f = toFile(filepath);
+ return f.getParent();
+ }
+
+ public static boolean fileExists(String s) {
+ if (s != null) {
+ File f = toFile(s);
+ return f.exists();
+ }
+ else {
+ return false;
+ }
+ }
+
+ public static String getTempFileName(String fileExtension) throws ProcessingException {
+ try {
+ File f = File.createTempFile("tmp", fileExtension);
+ f.delete();
+ return f.getAbsolutePath();
+ }
+ catch (IOException e) {
+ throw new ProcessingException("extension: " + fileExtension, e);
+ }
+ }
+
+ public static String urlEncode(String o) throws ProcessingException {
+ String s;
+ if (o == null) {
+ s = "";
+ }
+ else {
+ s = o.toString().trim();
+ }
+ if (s.length() == 0) {
+ s = " ";
+ }
+ try {
+ s = URLEncoder.encode(s, "UTF-8");// Build 158 needed an encoding
+ s = StringUtility.replace(s, "+", "%20");
+ }
+ catch (UnsupportedEncodingException e) {
+ }
+ return s;
+ }
+
+ public static String urlDecode(String o) throws ProcessingException {
+ String s;
+ if (o == null) {
+ s = "";
+ }
+ else {
+ s = o.toString().trim();
+ }
+ try {
+ s = URLDecoder.decode(s, "UTF-8");// Build 158 needed an encoding
+ }
+ catch (UnsupportedEncodingException e) {
+ }
+ return s;
+ }
+
+ /**
+ * The text passed to this method is tried to wellform as an URL. If the text
+ * can not be transformed into an URL the method returns null.
+ *
+ * @param urlText
+ */
+ public static URL urlTextToUrl(String urlText) {
+ String text = urlText;
+ URL url = null;
+ if (text != null && text.length() > 0) {
+ try {
+ url = new URL(text);
+ }
+ catch (Exception e) {
+ if (text.contains("@")) {
+ text = "mailto:" + text;
+ }
+ else {
+ text = "http://" + text;
+ }
+ try {
+ url = new URL(text);
+ }
+ catch (Exception e1) {
+ LOG.debug("Could not create url from : " + text + ":" + e1);
+ }
+ }
+ }
+ return url;
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/LRUCache.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/LRUCache.java
index f999d07b61..e599bb7c30 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/LRUCache.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/LRUCache.java
@@ -1,315 +1,315 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Comparator;
-import java.util.EventListener;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-
-/**
- * Default implementation of a last recently used cache mechanism using a HashMap. This implementation is thread-safe.
- * {@link #setTargetSize(int)} is the number of items remaining in the cache, superfluous items are discarded and
- * notified by the DisposeListener
- */
-public class LRUCache<K, V> {
- private long m_nextSecondarySeq = 1;
- private int m_targetSize = 1000;
- private int m_overflowSize;
- private long m_timeout = -1;
- private HashMap<K, CacheEntry> m_accessMap;
- private final Object m_accessMapLock = new Object();
- private final EventListenerList m_listenerList = new EventListenerList();
-
- public LRUCache(int targetSize, long timeout) {
- m_accessMap = new HashMap<K, CacheEntry>();
- setTargetSize(targetSize);
- setTimeout(timeout);
- }
-
- public V get(K key) {
- boolean fire = false;
- V fireValue = null;
- V returnValue = null;
- synchronized (m_accessMapLock) {
- CacheEntry ce = m_accessMap.get(key);
- if (ce != null) {
- if (ce.isTimeout()) {
- m_accessMap.remove(key);
- fire = true;
- fireValue = ce.getValue();
- ce = null;
- }
- }
- if (ce != null) {
- ce.touch();
- returnValue = ce.getValue();
- }
- else {
- returnValue = null;
- }
- }
- if (fire) {
- fireValueDisposed(key, fireValue);
- }
- return returnValue;
- }
-
- public void put(K key, V value) {
- if (m_targetSize <= 0) {
- return;
- }
- boolean fire = false;
- V fireValue = null;
- //
- synchronized (m_accessMapLock) {
- validateCacheSizeNoLock();
- CacheEntry ce = m_accessMap.get(key);
- if (ce != null) {
- V oldValue = ce.getValue();
- ce.updateValue(value);
- if (oldValue != value) {
- fire = true;
- fireValue = oldValue;
- }
- }
- else {
- ce = new CacheEntry(key, value);
- m_accessMap.put(key, ce);
- }
- }
- if (fire) {
- fireValueDisposed(key, fireValue);
- }
- }
-
- public void remove(K key) {
- if (m_targetSize <= 0) {
- return;
- }
- boolean fire = false;
- V fireValue = null;
- //
- synchronized (m_accessMapLock) {
- CacheEntry ce = m_accessMap.remove(key);
- if (ce != null) {
- fire = true;
- fireValue = ce.getValue();
- }
- }
- if (fire) {
- fireValueDisposed(key, fireValue);
- }
- }
-
- public void clear() {
- Map<K, CacheEntry> oldMap;
- synchronized (m_accessMapLock) {
- oldMap = m_accessMap;
- m_accessMap = new HashMap<K, CacheEntry>();
- }
- for (CacheEntry ce : oldMap.values()) {
- fireValueDisposed(ce.getKey(), ce.getValue());
- }
- }
-
- public void setTimeout(long timeout) {
- m_timeout = timeout;
- }
-
- public long getTimeout() {
- return m_timeout;
- }
-
- public void setTargetSize(int size) {
- m_targetSize = size;
- m_overflowSize = m_targetSize * 3 / 2;
- }
-
- public int getTargetSize() {
- return m_targetSize;
- }
-
- public Map<K, V> entries() {
- return getCacheContent();
- }
-
- public Map<K, V> getCacheContent() {
- synchronized (m_accessMapLock) {
- HashMap<K, V> map = new HashMap<K, V>();
- for (CacheEntry ce : m_accessMap.values()) {
- if (!ce.isTimeout()) {
- map.put(ce.getKey(), ce.getValue());
- }
- }
- return map;
- }
- }
-
- public Set<K> keySet() {
- synchronized (m_accessMapLock) {
- HashSet<K> set = new HashSet<K>(m_accessMap.size());
- for (CacheEntry ce : m_accessMap.values()) {
- if (!ce.isTimeout()) {
- set.add(ce.getKey());
- }
- }
- return set;
- }
- }
-
- public boolean containsKey(K key) {
- synchronized (m_accessMapLock) {
- return m_accessMap.containsKey(key);
- }
- }
-
- public Collection<V> values() {
- synchronized (m_accessMapLock) {
- ArrayList<V> list = new ArrayList<V>(m_accessMap.size());
- for (CacheEntry ce : m_accessMap.values()) {
- if (!ce.isTimeout()) {
- list.add(ce.getValue());
- }
- }
- return list;
- }
- }
-
- public boolean containsValue(V value) {
- synchronized (m_accessMapLock) {
- for (CacheEntry ce : m_accessMap.values()) {
- if (ce.getValue() == null && value == null) {
- return true;
- }
- else if (ce.getValue() != null && ce.getValue().equals(value)) {
- return true;
- }
- }
- return false;
- }
- }
-
- private void validateCacheSizeNoLock() {
- if (m_accessMap.size() >= m_overflowSize) {
- TreeSet<CacheEntry> sortSet = new TreeSet<CacheEntry>(new CacheEntryTimestampComparator());
- for (CacheEntry ce : m_accessMap.values()) {
- sortSet.add(ce);
- }
- // rebuild access map with a maximum of targetSize elements
- m_accessMap.clear();
- int count = 0;
- for (CacheEntry ce : sortSet) {
- if (count > m_targetSize || ce.isTimeout()) {
- fireValueDisposed(ce.getKey(), ce.getValue());
- }
- else {
- m_accessMap.put(ce.getKey(), ce);
- count++;
- }
- }
- }
- }
-
- /**
- * Cache Entry Value Object
- */
- private class CacheEntry {
- private final K m_key;
- private V m_value;
- private long m_timestamp;
- private Long m_secondarySeq;
-
- public CacheEntry(K key, V value) {
- m_key = key;
- m_value = value;
- touch();
- }
-
- public K getKey() {
- return m_key;
- }
-
- public V getValue() {
- return m_value;
- }
-
- public long getTimestamp() {
- return m_timestamp;
- }
-
- public boolean isTimeout() {
- return m_timeout > 0 && m_timestamp + m_timeout < System.currentTimeMillis();
- }
-
- public void updateValue(V newValue) {
- m_value = newValue;
- touch();
- }
-
- public void touch() {
- m_timestamp = System.currentTimeMillis();
- }
-
- @Override
- public String toString() {
- return "LRU[" + m_key + "," + m_value + "]";
- }
- }// end class
-
- private class CacheEntryTimestampComparator implements Comparator<CacheEntry> {
-
- @Override
- public int compare(CacheEntry ca, CacheEntry cb) {
- if (ca.m_timestamp < cb.m_timestamp) {
- return +1;
- }
- if (ca.m_timestamp > cb.m_timestamp) {
- return -1;
- }
- // equal timestamps
- if (ca.m_secondarySeq == null) {
- ca.m_secondarySeq = (m_nextSecondarySeq++);
- }
- if (cb.m_secondarySeq == null) {
- cb.m_secondarySeq = (m_nextSecondarySeq++);
- }
- return ca.m_secondarySeq.compareTo(cb.m_secondarySeq);
- }
- }// end class
-
- /**
- * Dispose observer
- */
- public interface DisposeListener extends EventListener {
- void valueDisposed(Object key, Object value);
- }
-
- public void addDisposeListener(DisposeListener listener) {
- m_listenerList.add(DisposeListener.class, listener);
- }
-
- public void removeDisposeListener(DisposeListener listener) {
- m_listenerList.remove(DisposeListener.class, listener);
- }
-
- private void fireValueDisposed(Object key, Object value) {
- EventListener[] a = m_listenerList.getListeners(DisposeListener.class);
- for (int i = 0; i < a.length; i++) {
- ((DisposeListener) a[i]).valueDisposed(key, value);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Comparator;
+import java.util.EventListener;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+
+/**
+ * Default implementation of a last recently used cache mechanism using a HashMap. This implementation is thread-safe.
+ * {@link #setTargetSize(int)} is the number of items remaining in the cache, superfluous items are discarded and
+ * notified by the DisposeListener
+ */
+public class LRUCache<K, V> {
+ private long m_nextSecondarySeq = 1;
+ private int m_targetSize = 1000;
+ private int m_overflowSize;
+ private long m_timeout = -1;
+ private HashMap<K, CacheEntry> m_accessMap;
+ private final Object m_accessMapLock = new Object();
+ private final EventListenerList m_listenerList = new EventListenerList();
+
+ public LRUCache(int targetSize, long timeout) {
+ m_accessMap = new HashMap<K, CacheEntry>();
+ setTargetSize(targetSize);
+ setTimeout(timeout);
+ }
+
+ public V get(K key) {
+ boolean fire = false;
+ V fireValue = null;
+ V returnValue = null;
+ synchronized (m_accessMapLock) {
+ CacheEntry ce = m_accessMap.get(key);
+ if (ce != null) {
+ if (ce.isTimeout()) {
+ m_accessMap.remove(key);
+ fire = true;
+ fireValue = ce.getValue();
+ ce = null;
+ }
+ }
+ if (ce != null) {
+ ce.touch();
+ returnValue = ce.getValue();
+ }
+ else {
+ returnValue = null;
+ }
+ }
+ if (fire) {
+ fireValueDisposed(key, fireValue);
+ }
+ return returnValue;
+ }
+
+ public void put(K key, V value) {
+ if (m_targetSize <= 0) {
+ return;
+ }
+ boolean fire = false;
+ V fireValue = null;
+ //
+ synchronized (m_accessMapLock) {
+ validateCacheSizeNoLock();
+ CacheEntry ce = m_accessMap.get(key);
+ if (ce != null) {
+ V oldValue = ce.getValue();
+ ce.updateValue(value);
+ if (oldValue != value) {
+ fire = true;
+ fireValue = oldValue;
+ }
+ }
+ else {
+ ce = new CacheEntry(key, value);
+ m_accessMap.put(key, ce);
+ }
+ }
+ if (fire) {
+ fireValueDisposed(key, fireValue);
+ }
+ }
+
+ public void remove(K key) {
+ if (m_targetSize <= 0) {
+ return;
+ }
+ boolean fire = false;
+ V fireValue = null;
+ //
+ synchronized (m_accessMapLock) {
+ CacheEntry ce = m_accessMap.remove(key);
+ if (ce != null) {
+ fire = true;
+ fireValue = ce.getValue();
+ }
+ }
+ if (fire) {
+ fireValueDisposed(key, fireValue);
+ }
+ }
+
+ public void clear() {
+ Map<K, CacheEntry> oldMap;
+ synchronized (m_accessMapLock) {
+ oldMap = m_accessMap;
+ m_accessMap = new HashMap<K, CacheEntry>();
+ }
+ for (CacheEntry ce : oldMap.values()) {
+ fireValueDisposed(ce.getKey(), ce.getValue());
+ }
+ }
+
+ public void setTimeout(long timeout) {
+ m_timeout = timeout;
+ }
+
+ public long getTimeout() {
+ return m_timeout;
+ }
+
+ public void setTargetSize(int size) {
+ m_targetSize = size;
+ m_overflowSize = m_targetSize * 3 / 2;
+ }
+
+ public int getTargetSize() {
+ return m_targetSize;
+ }
+
+ public Map<K, V> entries() {
+ return getCacheContent();
+ }
+
+ public Map<K, V> getCacheContent() {
+ synchronized (m_accessMapLock) {
+ HashMap<K, V> map = new HashMap<K, V>();
+ for (CacheEntry ce : m_accessMap.values()) {
+ if (!ce.isTimeout()) {
+ map.put(ce.getKey(), ce.getValue());
+ }
+ }
+ return map;
+ }
+ }
+
+ public Set<K> keySet() {
+ synchronized (m_accessMapLock) {
+ HashSet<K> set = new HashSet<K>(m_accessMap.size());
+ for (CacheEntry ce : m_accessMap.values()) {
+ if (!ce.isTimeout()) {
+ set.add(ce.getKey());
+ }
+ }
+ return set;
+ }
+ }
+
+ public boolean containsKey(K key) {
+ synchronized (m_accessMapLock) {
+ return m_accessMap.containsKey(key);
+ }
+ }
+
+ public Collection<V> values() {
+ synchronized (m_accessMapLock) {
+ ArrayList<V> list = new ArrayList<V>(m_accessMap.size());
+ for (CacheEntry ce : m_accessMap.values()) {
+ if (!ce.isTimeout()) {
+ list.add(ce.getValue());
+ }
+ }
+ return list;
+ }
+ }
+
+ public boolean containsValue(V value) {
+ synchronized (m_accessMapLock) {
+ for (CacheEntry ce : m_accessMap.values()) {
+ if (ce.getValue() == null && value == null) {
+ return true;
+ }
+ else if (ce.getValue() != null && ce.getValue().equals(value)) {
+ return true;
+ }
+ }
+ return false;
+ }
+ }
+
+ private void validateCacheSizeNoLock() {
+ if (m_accessMap.size() >= m_overflowSize) {
+ TreeSet<CacheEntry> sortSet = new TreeSet<CacheEntry>(new CacheEntryTimestampComparator());
+ for (CacheEntry ce : m_accessMap.values()) {
+ sortSet.add(ce);
+ }
+ // rebuild access map with a maximum of targetSize elements
+ m_accessMap.clear();
+ int count = 0;
+ for (CacheEntry ce : sortSet) {
+ if (count > m_targetSize || ce.isTimeout()) {
+ fireValueDisposed(ce.getKey(), ce.getValue());
+ }
+ else {
+ m_accessMap.put(ce.getKey(), ce);
+ count++;
+ }
+ }
+ }
+ }
+
+ /**
+ * Cache Entry Value Object
+ */
+ private class CacheEntry {
+ private final K m_key;
+ private V m_value;
+ private long m_timestamp;
+ private Long m_secondarySeq;
+
+ public CacheEntry(K key, V value) {
+ m_key = key;
+ m_value = value;
+ touch();
+ }
+
+ public K getKey() {
+ return m_key;
+ }
+
+ public V getValue() {
+ return m_value;
+ }
+
+ public long getTimestamp() {
+ return m_timestamp;
+ }
+
+ public boolean isTimeout() {
+ return m_timeout > 0 && m_timestamp + m_timeout < System.currentTimeMillis();
+ }
+
+ public void updateValue(V newValue) {
+ m_value = newValue;
+ touch();
+ }
+
+ public void touch() {
+ m_timestamp = System.currentTimeMillis();
+ }
+
+ @Override
+ public String toString() {
+ return "LRU[" + m_key + "," + m_value + "]";
+ }
+ }// end class
+
+ private class CacheEntryTimestampComparator implements Comparator<CacheEntry> {
+
+ @Override
+ public int compare(CacheEntry ca, CacheEntry cb) {
+ if (ca.m_timestamp < cb.m_timestamp) {
+ return +1;
+ }
+ if (ca.m_timestamp > cb.m_timestamp) {
+ return -1;
+ }
+ // equal timestamps
+ if (ca.m_secondarySeq == null) {
+ ca.m_secondarySeq = (m_nextSecondarySeq++);
+ }
+ if (cb.m_secondarySeq == null) {
+ cb.m_secondarySeq = (m_nextSecondarySeq++);
+ }
+ return ca.m_secondarySeq.compareTo(cb.m_secondarySeq);
+ }
+ }// end class
+
+ /**
+ * Dispose observer
+ */
+ public interface DisposeListener extends EventListener {
+ void valueDisposed(Object key, Object value);
+ }
+
+ public void addDisposeListener(DisposeListener listener) {
+ m_listenerList.add(DisposeListener.class, listener);
+ }
+
+ public void removeDisposeListener(DisposeListener listener) {
+ m_listenerList.remove(DisposeListener.class, listener);
+ }
+
+ private void fireValueDisposed(Object key, Object value) {
+ EventListener[] a = m_listenerList.getListeners(DisposeListener.class);
+ for (int i = 0; i < a.length; i++) {
+ ((DisposeListener) a[i]).valueDisposed(key, value);
+ }
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/ListUtility.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/ListUtility.java
index a599e3ba31..886a8e2ee0 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/ListUtility.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/ListUtility.java
@@ -1,245 +1,245 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import java.lang.reflect.Array;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-
-public final class ListUtility {
-
- private ListUtility() {
- }
-
- public static List<Object> toList(Object... array) {
- ArrayList<Object> list = new ArrayList<Object>();
- if (array != null) {
- for (Object o : array) {
- list.add(o);
- }
- }
- return list;
- }
-
- public static Object[] toArray(Object... array) {
- return array;
- }
-
- @SuppressWarnings("unchecked")
- public static <T> T[] copyArray(T[] a) {
- T[] copy = (T[]) Array.newInstance(a.getClass().getComponentType(), a.length);
- System.arraycopy(a, 0, copy, 0, a.length);
- return copy;
- }
-
- /**
- * @return true if list contains any (at least 1) of the values
- */
- public static <T> boolean containsAny(Collection<T> list, Collection<T> values) {
- if (list != null) {
- for (T o : values) {
- if (list.contains(o)) {
- return true;
- }
- }
- }
- return false;
- }
-
- /**
- * @return true if list contains any (at least 1) of the values
- */
- public static <T> boolean containsAny(Collection<T> list, T... values) {
- if (list != null) {
- for (T o : values) {
- if (list.contains(o)) {
- return true;
- }
- }
- }
- return false;
- }
-
- public static <T> String format(Collection<T> list, String delimiter) {
- if (list == null) {
- return "";
- }
- StringBuffer buf = new StringBuffer();
- int index = 0;
- for (T o : list) {
- if (index > 0) {
- buf.append(delimiter);
- }
- buf.append("" + o);
- index++;
- }
- return buf.toString();
- }
-
- public static String format(Collection<?> list) {
- return format(list, false);
- }
-
- public static <T> String format(Collection<T> c, boolean quoteStrings) {
- StringBuffer buf = new StringBuffer();
- if (c != null) {
- int index = 0;
- for (T o : c) {
- if (index > 0) {
- buf.append(", ");
- }
- String s;
- if (o instanceof Number) {
- s = o.toString();
- }
- else {
- if (quoteStrings) {
- s = "'" + ("" + o).replaceAll(",", "%2C") + "'";
- }
- else {
- s = "" + o;
- }
- }
- buf.append(s);
- index++;
- }
- }
- return buf.toString();
- }
-
- public static List<Object> parse(String text) {
- List<Object> list = null;
- if (text != null && text.trim().length() > 0) {
- String[] a = text.split(",");
- for (String s : a) {
- Object o;
- // remove escaped ','
- s = s.replaceAll("%2C", ",");
- if (s.equalsIgnoreCase("null")) {
- o = null;
- }
- else if (s.length() >= 2 && s.startsWith("'") && s.endsWith("'")) {
- o = s.substring(1, s.length() - 2);
- }
- else if (s.length() >= 2 && s.startsWith("\"") && s.endsWith("\"")) {
- o = s.substring(1, s.length() - 2);
- }
- else if (s.indexOf(".") >= 0) {
- // try to make double
- try {
- o = new Double(Double.parseDouble(s));
- }
- catch (Exception e) {
- /* nop */
- o = s;
- }
- }
- else {
- // try to make long
- try {
- o = new Long(Long.parseLong(s));
- }
- catch (Exception e) {
- /* nop */
- o = s;
- }
- }
- list = CollectionUtility.appendList(list, o);
- }
- }
- return CollectionUtility.copyList(list);
- }
-
- /**
- * combine all lists into one list containing all elements the order of the
- * items is preserved
- */
- public static <T> List<T> combine(Collection<T>... collections) {
- List<T> list = null;
- if (collections != null && collections.length > 0) {
- for (Collection<T> c : collections) {
- for (T t : c) {
- list = CollectionUtility.appendList(list, t);
- }
- }
- }
- return CollectionUtility.copyList(list);
- }
-
- /**
- * @return true if the collection contains at least two equal values
- */
- public static <T> boolean isAmbiguous(Collection<T> c) {
- return !isDistinct(c);
- }
-
- /**
- * @return true if all values in the collection are distinct
- */
- public static <T> boolean isDistinct(Collection<T> c) {
- HashSet<T> set = new HashSet<T>(c);
- return (set.size() == c.size());
- }
-
- /**
- * returns the (single) number, if all values are the same in the array,
- * otherwise null
- */
- public static <T> T getUnique(T... n) {
- if (n == null || n.length == 0) {
- return null;
- }
- T retVal = null;
- for (int i = 0; i < n.length; i++) {
- if (n[i] != null) {
- if (retVal == null) {
- retVal = n[i];
- }
- else {
- if (!retVal.equals(n[i])) {
- return null;
- }
- }
- }
- }
- return retVal;
- }
-
- /**
- * @return the length of an array using {@link Array#getLength(Object)}.
- * <p>
- * Accepts arrays, {@link Collection}s, {@link Map}s, null
- * <p>
- * if the array has multiple dimensions, returns the first dimension
- * <p>
- * if the array is null, returns -1
- * <p>
- * @throws {@link IllegalArgumentException} if the argument is neither an array nor null
- */
- public static int length(Object array) {
- if (array == null) {
- return -1;
- }
- if (array.getClass().isArray()) {
- return Array.getLength(array);
- }
- if (array instanceof Collection<?>) {
- return ((Collection<?>) array).size();
- }
- if (array instanceof Map<?, ?>) {
- return ((Map<?, ?>) array).size();
- }
- throw new IllegalArgumentException("expected one of: null, array, collection, map");
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+
+public final class ListUtility {
+
+ private ListUtility() {
+ }
+
+ public static List<Object> toList(Object... array) {
+ ArrayList<Object> list = new ArrayList<Object>();
+ if (array != null) {
+ for (Object o : array) {
+ list.add(o);
+ }
+ }
+ return list;
+ }
+
+ public static Object[] toArray(Object... array) {
+ return array;
+ }
+
+ @SuppressWarnings("unchecked")
+ public static <T> T[] copyArray(T[] a) {
+ T[] copy = (T[]) Array.newInstance(a.getClass().getComponentType(), a.length);
+ System.arraycopy(a, 0, copy, 0, a.length);
+ return copy;
+ }
+
+ /**
+ * @return true if list contains any (at least 1) of the values
+ */
+ public static <T> boolean containsAny(Collection<T> list, Collection<T> values) {
+ if (list != null) {
+ for (T o : values) {
+ if (list.contains(o)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @return true if list contains any (at least 1) of the values
+ */
+ public static <T> boolean containsAny(Collection<T> list, T... values) {
+ if (list != null) {
+ for (T o : values) {
+ if (list.contains(o)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ public static <T> String format(Collection<T> list, String delimiter) {
+ if (list == null) {
+ return "";
+ }
+ StringBuffer buf = new StringBuffer();
+ int index = 0;
+ for (T o : list) {
+ if (index > 0) {
+ buf.append(delimiter);
+ }
+ buf.append("" + o);
+ index++;
+ }
+ return buf.toString();
+ }
+
+ public static String format(Collection<?> list) {
+ return format(list, false);
+ }
+
+ public static <T> String format(Collection<T> c, boolean quoteStrings) {
+ StringBuffer buf = new StringBuffer();
+ if (c != null) {
+ int index = 0;
+ for (T o : c) {
+ if (index > 0) {
+ buf.append(", ");
+ }
+ String s;
+ if (o instanceof Number) {
+ s = o.toString();
+ }
+ else {
+ if (quoteStrings) {
+ s = "'" + ("" + o).replaceAll(",", "%2C") + "'";
+ }
+ else {
+ s = "" + o;
+ }
+ }
+ buf.append(s);
+ index++;
+ }
+ }
+ return buf.toString();
+ }
+
+ public static List<Object> parse(String text) {
+ List<Object> list = null;
+ if (text != null && text.trim().length() > 0) {
+ String[] a = text.split(",");
+ for (String s : a) {
+ Object o;
+ // remove escaped ','
+ s = s.replaceAll("%2C", ",");
+ if (s.equalsIgnoreCase("null")) {
+ o = null;
+ }
+ else if (s.length() >= 2 && s.startsWith("'") && s.endsWith("'")) {
+ o = s.substring(1, s.length() - 2);
+ }
+ else if (s.length() >= 2 && s.startsWith("\"") && s.endsWith("\"")) {
+ o = s.substring(1, s.length() - 2);
+ }
+ else if (s.indexOf(".") >= 0) {
+ // try to make double
+ try {
+ o = new Double(Double.parseDouble(s));
+ }
+ catch (Exception e) {
+ /* nop */
+ o = s;
+ }
+ }
+ else {
+ // try to make long
+ try {
+ o = new Long(Long.parseLong(s));
+ }
+ catch (Exception e) {
+ /* nop */
+ o = s;
+ }
+ }
+ list = CollectionUtility.appendList(list, o);
+ }
+ }
+ return CollectionUtility.copyList(list);
+ }
+
+ /**
+ * combine all lists into one list containing all elements the order of the
+ * items is preserved
+ */
+ public static <T> List<T> combine(Collection<T>... collections) {
+ List<T> list = null;
+ if (collections != null && collections.length > 0) {
+ for (Collection<T> c : collections) {
+ for (T t : c) {
+ list = CollectionUtility.appendList(list, t);
+ }
+ }
+ }
+ return CollectionUtility.copyList(list);
+ }
+
+ /**
+ * @return true if the collection contains at least two equal values
+ */
+ public static <T> boolean isAmbiguous(Collection<T> c) {
+ return !isDistinct(c);
+ }
+
+ /**
+ * @return true if all values in the collection are distinct
+ */
+ public static <T> boolean isDistinct(Collection<T> c) {
+ HashSet<T> set = new HashSet<T>(c);
+ return (set.size() == c.size());
+ }
+
+ /**
+ * returns the (single) number, if all values are the same in the array,
+ * otherwise null
+ */
+ public static <T> T getUnique(T... n) {
+ if (n == null || n.length == 0) {
+ return null;
+ }
+ T retVal = null;
+ for (int i = 0; i < n.length; i++) {
+ if (n[i] != null) {
+ if (retVal == null) {
+ retVal = n[i];
+ }
+ else {
+ if (!retVal.equals(n[i])) {
+ return null;
+ }
+ }
+ }
+ }
+ return retVal;
+ }
+
+ /**
+ * @return the length of an array using {@link Array#getLength(Object)}.
+ * <p>
+ * Accepts arrays, {@link Collection}s, {@link Map}s, null
+ * <p>
+ * if the array has multiple dimensions, returns the first dimension
+ * <p>
+ * if the array is null, returns -1
+ * <p>
+ * @throws {@link IllegalArgumentException} if the argument is neither an array nor null
+ */
+ public static int length(Object array) {
+ if (array == null) {
+ return -1;
+ }
+ if (array.getClass().isArray()) {
+ return Array.getLength(array);
+ }
+ if (array instanceof Collection<?>) {
+ return ((Collection<?>) array).size();
+ }
+ if (array instanceof Map<?, ?>) {
+ return ((Map<?, ?>) array).size();
+ }
+ throw new IllegalArgumentException("expected one of: null, array, collection, map");
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/LocaleThreadLocal.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/LocaleThreadLocal.java
index d8a70bf15e..313c15efe1 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/LocaleThreadLocal.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/LocaleThreadLocal.java
@@ -1,37 +1,37 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import java.util.Locale;
-
-/**
- * This class represents the nls locale for the current thread and
- * Locale.getLocale() by default.
- */
-public final class LocaleThreadLocal {
- private static ThreadLocal<Locale> localeThreadLocal = new ThreadLocal<Locale>();
-
- private LocaleThreadLocal() {
- }
-
- public static Locale get() {
- Locale l = localeThreadLocal.get();
- if (l == null) {
- l = Locale.getDefault();
- }
- return l;
- }
-
- public static void set(Locale l) {
- localeThreadLocal.set(l);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import java.util.Locale;
+
+/**
+ * This class represents the nls locale for the current thread and
+ * Locale.getLocale() by default.
+ */
+public final class LocaleThreadLocal {
+ private static ThreadLocal<Locale> localeThreadLocal = new ThreadLocal<Locale>();
+
+ private LocaleThreadLocal() {
+ }
+
+ public static Locale get() {
+ Locale l = localeThreadLocal.get();
+ if (l == null) {
+ l = Locale.getDefault();
+ }
+ return l;
+ }
+
+ public static void set(Locale l) {
+ localeThreadLocal.set(l);
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/LocaleUtility.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/LocaleUtility.java
index 8b12b046af..0cb567b49c 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/LocaleUtility.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/LocaleUtility.java
@@ -1,36 +1,36 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import java.util.Locale;
-
-public final class LocaleUtility {
- private LocaleUtility() {
- }
-
- /**
- * @return the parsed locale such as created by {@link Locale#toString()}
- */
- public static Locale parse(String s) {
- if (s == null || s.length() == 0) {
- return null;
- }
- int a = s.indexOf('_');
- int b = (a >= 0 && a + 1 < s.length() ? s.indexOf('_', a + 1) : -1);
- if (a >= 0 && b >= 0) {
- return new Locale(s.substring(0, a), s.substring(a + 1, b), s.substring(b + 1));
- }
- if (a >= 0) {
- return new Locale(s.substring(0, a), s.substring(a + 1));
- }
- return new Locale(s);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import java.util.Locale;
+
+public final class LocaleUtility {
+ private LocaleUtility() {
+ }
+
+ /**
+ * @return the parsed locale such as created by {@link Locale#toString()}
+ */
+ public static Locale parse(String s) {
+ if (s == null || s.length() == 0) {
+ return null;
+ }
+ int a = s.indexOf('_');
+ int b = (a >= 0 && a + 1 < s.length() ? s.indexOf('_', a + 1) : -1);
+ if (a >= 0 && b >= 0) {
+ return new Locale(s.substring(0, a), s.substring(a + 1, b), s.substring(b + 1));
+ }
+ if (a >= 0) {
+ return new Locale(s.substring(0, a), s.substring(a + 1));
+ }
+ return new Locale(s);
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/MailUtility.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/MailUtility.java
index 65f865d653..00a75bb417 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/MailUtility.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/MailUtility.java
@@ -1,791 +1,791 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.Reader;
-import java.io.UnsupportedEncodingException;
-import java.lang.reflect.Array;
-import java.lang.reflect.Field;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import javax.activation.CommandMap;
-import javax.activation.DataHandler;
-import javax.activation.DataSource;
-import javax.activation.FileDataSource;
-import javax.activation.MailcapCommandMap;
-import javax.activation.MimetypesFileTypeMap;
-import javax.mail.BodyPart;
-import javax.mail.Message;
-import javax.mail.MessagingException;
-import javax.mail.Multipart;
-import javax.mail.Part;
-import javax.mail.internet.AddressException;
-import javax.mail.internet.InternetAddress;
-import javax.mail.internet.MimeBodyPart;
-import javax.mail.internet.MimeMessage;
-import javax.mail.internet.MimeMultipart;
-import javax.mail.internet.MimePart;
-import javax.mail.util.ByteArrayDataSource;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-
-public final class MailUtility {
-
- public static final IScoutLogger LOG = ScoutLogManager.getLogger(MailUtility.class);
-
- private static final String CONTENT_TYPE_ID = "Content-Type";
- public static final String CONTENT_TYPE_TEXT_HTML = "text/html; charset=\"UTF-8\"";
- public static final String CONTENT_TYPE_TEXT_PLAIN = "text/plain; charset=\"UTF-8\"";
- public static final String CONTENT_TYPE_MESSAGE_RFC822 = "message/rfc822";
- public static final String CONTENT_TYPE_MULTIPART = "alternative";
-
- private static MailUtility instance = new MailUtility();
-
- private MailUtility() {
- }
-
- /**
- * Container for the mail body in plain text and html.
- * For the correct html representation it contains also a list of files referenced in the html.
- */
- public class MailMessage {
-
- private String m_plainText;
- private String m_htmlText;
- private List<File> m_htmlAttachmentList;
-
- public MailMessage(String plainText, String htmlText, List<File> htmlAttachmentList) {
- m_plainText = plainText;
- m_htmlText = htmlText;
- m_htmlAttachmentList = htmlAttachmentList;
- }
-
- public String getPlainText() {
- return m_plainText;
- }
-
- public String getHtmlText() {
- return m_htmlText;
- }
-
- public List<File> getHtmlAttachmentList() {
- return m_htmlAttachmentList;
- }
- }
-
- public static Part[] getBodyParts(Part message) throws ProcessingException {
- return instance.getBodyPartsImpl(message);
- }
-
- private Part[] getBodyPartsImpl(Part message) throws ProcessingException {
- List<Part> bodyCollector = new ArrayList<Part>();
- List<Part> attachementCollector = new ArrayList<Part>();
- collectMailPartsReqImpl(message, bodyCollector, attachementCollector);
- return bodyCollector.toArray(new Part[bodyCollector.size()]);
- }
-
- public static Part[] getAttachmentParts(Part message) throws ProcessingException {
- return instance.getAttachmentPartsImpl(message);
- }
-
- private Part[] getAttachmentPartsImpl(Part message) throws ProcessingException {
- List<Part> bodyCollector = new ArrayList<Part>();
- List<Part> attachementCollector = new ArrayList<Part>();
- collectMailPartsReqImpl(message, bodyCollector, attachementCollector);
- return attachementCollector.toArray(new Part[attachementCollector.size()]);
- }
-
- public static void collectMailParts(Part message, List<Part> bodyCollector, List<Part> attachementCollector) throws ProcessingException {
- instance.collectMailPartsReqImpl(message, bodyCollector, attachementCollector);
- }
-
- private void collectMailPartsReqImpl(Part part, List<Part> bodyCollector, List<Part> attachementCollector) throws ProcessingException {
- if (part == null) {
- return;
- }
- try {
- String disp = part.getDisposition();
- if (disp != null && disp.equalsIgnoreCase(Part.ATTACHMENT)) {
- attachementCollector.add(part);
- }
- else if (part.getContent() instanceof Multipart) {
- Multipart multiPart = (Multipart) part.getContent();
- for (int i = 0; i < multiPart.getCount(); i++) {
- collectMailPartsReqImpl(multiPart.getBodyPart(i), bodyCollector, attachementCollector);
- }
- }
- else {
- if (part.isMimeType(CONTENT_TYPE_TEXT_PLAIN)) {
- bodyCollector.add(part);
- }
- else if (part.isMimeType(CONTENT_TYPE_TEXT_HTML)) {
- bodyCollector.add(part);
- }
- else if (part.isMimeType(CONTENT_TYPE_MESSAGE_RFC822) && part.getContent() instanceof MimeMessage) {
- // its a MIME message in rfc822 format as attachment therefore we have to set the filename for the attachment correctly.
- MimeMessage msg = (MimeMessage) part.getContent();
- String filteredSubjectText = StringUtility.filterText(msg.getSubject(), "a-zA-Z0-9_-", "");
- String fileName = (StringUtility.hasText(filteredSubjectText) ? filteredSubjectText : "originalMessage") + ".eml";
- RFCWrapperPart wrapperPart = new RFCWrapperPart(part, fileName);
- attachementCollector.add(wrapperPart);
- }
- }
- }
- catch (ProcessingException e) {
- throw e;
- }
- catch (Throwable t) {
- throw new ProcessingException("Unexpected: ", t);
- }
- }
-
- /**
- * @param part
- * @return the plainText part encoded with the encoding given in the MIME header or UTF-8 encoded or null if the
- * plainText Part is not given
- * @throws ProcessingException
- */
- public static String getPlainText(Part part) throws ProcessingException {
- return instance.getPlainTextImpl(part);
- }
-
- private String getPlainTextImpl(Part part) throws ProcessingException {
- String text = null;
- try {
- Part[] bodyParts = getBodyPartsImpl(part);
- Part plainTextPart = getPlainTextPart(bodyParts);
-
- if (plainTextPart instanceof MimePart) {
- MimePart mimePart = (MimePart) plainTextPart;
- byte[] content = IOUtility.getContent(mimePart.getInputStream());
- if (content != null) {
- try {
- text = new String(content, getCharacterEncodingOfMimePart(mimePart));
- }
- catch (UnsupportedEncodingException e) {
- text = new String(content);
- }
-
- }
- }
- }
- catch (ProcessingException e) {
- throw e;
- }
- catch (Throwable t) {
- throw new ProcessingException("Unexpected: ", t);
- }
- return text;
- }
-
- public static Part getHtmlPart(Part[] bodyParts) throws ProcessingException {
- for (Part p : bodyParts) {
- try {
- if (p != null && p.isMimeType(CONTENT_TYPE_TEXT_HTML)) {
- return p;
- }
- }
- catch (Throwable t) {
- throw new ProcessingException("Unexpected: ", t);
- }
- }
- return null;
- }
-
- public static Part getPlainTextPart(Part[] bodyParts) throws ProcessingException {
- for (Part p : bodyParts) {
- try {
- if (p != null && p.isMimeType(CONTENT_TYPE_TEXT_PLAIN)) {
- return p;
- }
- }
- catch (Throwable t) {
- throw new ProcessingException("Unexpected: ", t);
- }
- }
- return null;
- }
-
- public static DataSource createDataSource(File file) throws ProcessingException {
- try {
- int indexDot = file.getName().lastIndexOf(".");
- if (indexDot > 0) {
- String fileName = file.getName();
- String ext = fileName.substring(indexDot + 1);
- return instance.createDataSourceImpl(new FileInputStream(file), fileName, ext);
- }
- else {
- return null;
- }
- }
- catch (Throwable t) {
- throw new ProcessingException("Unexpected: ", t);
- }
- }
-
- public static DataSource createDataSource(InputStream inStream, String fileName, String fileExtension) throws ProcessingException {
- return instance.createDataSourceImpl(inStream, fileName, fileExtension);
- }
-
- /**
- * @param inStream
- * @param fileName
- * e.g. "file.txt"
- * @param fileExtension
- * e.g. "txt", "jpg"
- * @return
- * @throws ProcessingException
- */
- private DataSource createDataSourceImpl(InputStream inStream, String fileName, String fileExtension) throws ProcessingException {
- try {
- ByteArrayDataSource item = new ByteArrayDataSource(inStream, getContentTypeForExtension(fileExtension));
- item.setName(fileName);
- return item;
- }
- catch (Throwable t) {
- throw new ProcessingException("Unexpected: ", t);
- }
- }
-
- public static MailMessage extractMailMessageFromWordArchive(File archiveFile) {
- return instance.extractMailMessageFromWordArchiveInternal(archiveFile);
- }
-
- private MailMessage extractMailMessageFromWordArchiveInternal(File archiveFile) {
- MailMessage mailMessage = null;
- File tempDir = extractWordArchive(archiveFile);
- String simpleName = extractSimpleNameFromWordArchive(archiveFile);
- String messagePlainText = extractPlainTextFromWordArchiveInternal(tempDir, simpleName);
- String messageHtml = extractHtmlFromWordArchiveInternal(tempDir, simpleName);
- // replace directory entry
- // replace all paths to the 'files directory' with the root directory
- File attachmentFolder = null;
- if (tempDir.isDirectory()) {
- for (File file : tempDir.listFiles()) {
- if (file.isDirectory() && file.getName().startsWith(simpleName)) {
- attachmentFolder = file;
- break;
- }
- }
- }
- String folderName = null;
- if (attachmentFolder != null) {
- folderName = attachmentFolder.getName();
- }
- messageHtml = messageHtml.replaceAll(folderName + "/", "");
- messageHtml = removeWordTags(messageHtml);
- // now loop through the directory and search all the files needed for a correct representation of the html mail
- List<File> attachmentList = new ArrayList<File>();
- if (attachmentFolder != null) {
- for (File attFile : attachmentFolder.listFiles()) {
- // exclude Microsoft Word specific directory file. This is only used to edit HTML in Word.
- if (!attFile.isDirectory() && !isWordSpecificFile(attFile.getName())) {
- attachmentList.add(attFile);
- }
- }
- }
- mailMessage = new MailMessage(messagePlainText, messageHtml, attachmentList);
- return mailMessage;
- }
-
- private String extractHtmlFromWordArchiveInternal(File dir, String simpleName) {
- String txt = null;
- try {
- txt = extractTextFromWordArchiveInternal(dir, simpleName, "html");
- }
- catch (Exception e) {
- LOG.error("Error occured while trying to extract plain text file", e);
- }
- return txt;
- }
-
- private String extractSimpleNameFromWordArchive(File archiveFile) {
- String simpleName = archiveFile.getName();
- if (archiveFile.getName().lastIndexOf('.') != -1) {
- simpleName = archiveFile.getName().substring(0, archiveFile.getName().lastIndexOf('.'));
- }
- return simpleName;
- }
-
- private File extractWordArchive(File archiveFile) {
- File tempDir = null;
- try {
- tempDir = IOUtility.createTempDirectory("");
- FileUtility.extractArchive(archiveFile, tempDir);
- }
- catch (Exception e) {
- LOG.error("Error occured while trying to extract word archive", e);
- }
- return tempDir;
- }
-
- public static String extractPlainTextFromWordArchive(File archiveFile) {
- return instance.extractPlainTextFromWordArchiveInternal(archiveFile);
- }
-
- private String extractPlainTextFromWordArchiveInternal(File archiveFile) {
- File tempDir = extractWordArchive(archiveFile);
- String simpleName = extractSimpleNameFromWordArchive(archiveFile);
- return extractPlainTextFromWordArchiveInternal(tempDir, simpleName);
- }
-
- private String extractPlainTextFromWordArchiveInternal(File dir, String simpleName) {
- String plainText = null;
- try {
- plainText = extractTextFromWordArchiveInternal(dir, simpleName, "txt");
- }
- catch (Exception e) {
- LOG.error("Error occured while trying to extract plain text file", e);
- }
- return plainText;
- }
-
- private String extractTextFromWordArchiveInternal(File dir, String simpleName, String fileType) throws ProcessingException, IOException {
- String txt = null;
- File plainTextFile = new File(dir, simpleName + "." + fileType);
- if (plainTextFile.exists() && plainTextFile.canRead()) {
- Reader reader = new FileReader(plainTextFile);
- txt = IOUtility.getContent(reader);
- reader.close();
- }
- return txt;
- }
-
- /**
- * Create {@link MimeMessage} from plain text fields.
- *
- * @rn aho, 19.01.2009
- */
- public static MimeMessage createMimeMessage(String[] toRecipients, String sender, String subject, String bodyTextPlain, DataSource[] attachements) throws ProcessingException {
- return instance.createMimeMessageInternal(toRecipients, null, null, sender, subject, bodyTextPlain, attachements);
- }
-
- /**
- * Create {@link MimeMessage} from plain text fields.
- *
- * @rn aho, 19.01.2009
- */
- public static MimeMessage createMimeMessage(String[] toRecipients, String[] ccRecipients, String[] bccRecipients, String sender, String subject, String bodyTextPlain, DataSource[] attachements) throws ProcessingException {
- return instance.createMimeMessageInternal(toRecipients, ccRecipients, bccRecipients, sender, subject, bodyTextPlain, attachements);
- }
-
- private MimeMessage createMimeMessageInternal(String[] toRecipients, String[] ccRecipients, String[] bccRecipients, String sender, String subject, String bodyTextPlain, DataSource[] attachements) throws ProcessingException {
- try {
- MimeMessage msg = MailUtility.createMimeMessage(bodyTextPlain, null, attachements);
- if (sender != null) {
- InternetAddress addrSender = new InternetAddress(sender);
- msg.setFrom(addrSender);
- msg.setSender(addrSender);
- }
- msg.setSentDate(new java.util.Date());
- //
- msg.setSubject(subject, "UTF-8");
- //
- msg.setRecipients(Message.RecipientType.TO, parseAddresses(toRecipients));
- msg.setRecipients(Message.RecipientType.CC, parseAddresses(ccRecipients));
- msg.setRecipients(Message.RecipientType.BCC, parseAddresses(bccRecipients));
- return msg;
- }
- catch (ProcessingException pe) {
- throw pe;
- }
- catch (Exception e) {
- throw new ProcessingException("Failed to create MimeMessage.", e);
- }
- }
-
- public static MimeMessage createMimeMessage(String messagePlain, String messageHtml, DataSource[] attachements) throws ProcessingException {
- return instance.createMimeMessageInternal(messagePlain, messageHtml, attachements);
- }
-
- public static MimeMessage createMimeMessageFromWordArchiveDirectory(File archiveDir, String simpleName, File[] attachments, boolean markAsUnsent) throws ProcessingException {
- return instance.createMimeMessageFromWordArchiveInternal(archiveDir, simpleName, attachments, markAsUnsent);
- }
-
- public static MimeMessage createMimeMessageFromWordArchive(File archiveFile, File[] attachments) throws ProcessingException {
- return createMimeMessageFromWordArchive(archiveFile, attachments, false);
- }
-
- public static MimeMessage createMimeMessageFromWordArchive(File archiveFile, File[] attachments, boolean markAsUnsent) throws ProcessingException {
- try {
- File tempDir = IOUtility.createTempDirectory("");
- FileUtility.extractArchive(archiveFile, tempDir);
-
- String simpleName = archiveFile.getName();
- if (archiveFile.getName().lastIndexOf('.') != -1) {
- simpleName = archiveFile.getName().substring(0, archiveFile.getName().lastIndexOf('.'));
- }
- return instance.createMimeMessageFromWordArchiveInternal(tempDir, simpleName, attachments, markAsUnsent);
- }
- catch (ProcessingException pe) {
- throw pe;
- }
- catch (IOException e) {
- throw new ProcessingException("Error occured while accessing files", e);
- }
- }
-
- private MimeMessage createMimeMessageFromWordArchiveInternal(File archiveDir, String simpleName, File[] attachments, boolean markAsUnsent) throws ProcessingException {
- try {
- File plainTextFile = new File(archiveDir, simpleName + ".txt");
- String plainTextMessage = null;
- boolean hasPlainText = false;
- if (plainTextFile.exists()) {
- Reader reader = new FileReader(plainTextFile);
- plainTextMessage = IOUtility.getContent(reader);
- reader.close();
- hasPlainText = StringUtility.hasText(plainTextMessage);
- }
-
- String folderName = null;
- List<DataSource> htmlDataSourceList = new ArrayList<DataSource>();
- for (File filesFolder : archiveDir.listFiles()) {
- // in this archive file, exactly one directory should exist
- // word names this directory differently depending on the language
- if (filesFolder.isDirectory() && filesFolder.getName().startsWith(simpleName)) {
- // we accept the first directory that meets the constraint above
- // add all auxiliary files as attachment
- folderName = filesFolder.getName();
- for (File file : filesFolder.listFiles()) {
- // exclude Microsoft Word specific directory file. This is only used to edit HTML in Word.
- String filename = file.getName();
- if (!isWordSpecificFile(filename)) {
- FileDataSource fds = new FileDataSource(file);
- htmlDataSourceList.add(fds);
- }
- }
- break;
- }
- }
-
- File htmlFile = new File(archiveDir, simpleName + ".html");
- String htmlMessage = null;
- boolean hasHtml = false;
- if (htmlFile.exists()) {
- Reader reader = new FileReader(htmlFile);
- htmlMessage = IOUtility.getContent(reader);
- reader.close();
- // replace directory entry
- // replace all paths to the 'files directory' with the root directory
- htmlMessage = htmlMessage.replaceAll("\"" + folderName + "/", "\"cid:");
-
- htmlMessage = removeWordTags(htmlMessage);
- // remove any VML elements
- htmlMessage = htmlMessage.replaceAll("<!--\\[if gte vml 1(.*\\r?\\n)*?.*?endif\\]-->", "");
- // remove any VML elements part2
- htmlMessage = Pattern.compile("<!\\[if !vml\\]>(.*?)<!\\[endif\\]>", Pattern.DOTALL).matcher(htmlMessage).replaceAll("$1");
- // remove not referenced attachments
- for (Iterator<DataSource> it = htmlDataSourceList.iterator(); it.hasNext();) {
- DataSource ds = it.next();
- if (!htmlMessage.contains("cid:" + ds.getName())) {
- it.remove();
- }
- }
- hasHtml = StringUtility.hasText(htmlMessage);
- }
-
- if (!hasPlainText && !hasHtml) {
- throw new ProcessingException("message has no body");
- }
-
- MimeMessage mimeMessage = new CharsetSafeMimeMessage();
- MimePart bodyPart = null;
- if (attachments != null && attachments.length > 0) {
- MimeMultipart multiPart = new MimeMultipart(); //mixed
- mimeMessage.setContent(multiPart);
- //add a holder for the body text
- MimeBodyPart multiPartBody = new MimeBodyPart();
- multiPart.addBodyPart(multiPartBody);
- bodyPart = multiPartBody;
- //add the attachments
- for (File attachment : attachments) {
- MimeBodyPart part = new MimeBodyPart();
- FileDataSource fds = new FileDataSource(attachment);
- DataHandler handler = new DataHandler(fds);
- part.setDataHandler(handler);
- part.setFileName(attachment.getName());
- multiPart.addBodyPart(part);
- }
- }
- else {
- //no attachments -> no need for multipart/mixed element
- bodyPart = mimeMessage;
- }
-
- if (hasPlainText && hasHtml) {
- MimeMultipart alternativePart = new MimeMultipart("alternative");
- bodyPart.setContent(alternativePart);
- MimeBodyPart plainBodyPart = new MimeBodyPart();
- alternativePart.addBodyPart(plainBodyPart);
- writePlainBody(plainBodyPart, plainTextMessage);
- MimeBodyPart htmlBodyPart = new MimeBodyPart();
- alternativePart.addBodyPart(htmlBodyPart);
- writeHtmlBody(htmlBodyPart, htmlMessage, htmlDataSourceList);
- }
- else if (hasPlainText) { //plain text only
- writePlainBody(bodyPart, plainTextMessage);
- }
- else { //html only
- writeHtmlBody(bodyPart, htmlMessage, htmlDataSourceList);
- }
-
- if (markAsUnsent) {
- mimeMessage.setHeader("X-Unsent", "1"); // only supported in Outlook 2010
- }
- return mimeMessage;
- }
- catch (IOException e) {
- throw new ProcessingException("Error occured while accessing files", e);
- }
- catch (MessagingException e) {
- throw new ProcessingException("Error occured while creating MIME-message", e);
- }
- }
-
- private String removeWordTags(String htmlMessage) {
- // remove special/unused files
- htmlMessage = htmlMessage.replaceAll("<link rel=File-List href=\"cid:filelist.xml\">", "");
- htmlMessage = htmlMessage.replaceAll("<link rel=colorSchemeMapping href=\"cid:colorschememapping.xml\">", "");
- htmlMessage = htmlMessage.replaceAll("<link rel=themeData href=\"cid:themedata.thmx\">", "");
- htmlMessage = htmlMessage.replaceAll("<link rel=Edit-Time-Data href=\"cid:editdata.mso\">", "");
-
- // remove Microsoft Word tags
- htmlMessage = htmlMessage.replaceAll("<!--\\[if gte mso(.*\\r?\\n)*?.*?endif\\]-->", "");
-
- return htmlMessage;
- }
-
- /**
- * Checks if file is a Microsoft Word specific directory file. They are only used to edit HTML in Word.
- */
- private boolean isWordSpecificFile(String filename) {
- return filename.equalsIgnoreCase("filelist.xml") ||
- filename.equalsIgnoreCase("colorschememapping.xml") ||
- filename.equalsIgnoreCase("themedata.thmx") ||
- filename.equalsIgnoreCase("header.html") ||
- filename.equalsIgnoreCase("editdata.mso") ||
- filename.matches("item\\d{4}\\.xml") ||
- filename.matches("props\\d{4}\\.xml");
- }
-
- private static void writeHtmlBody(MimePart htmlBodyPart, String htmlMessage, List<DataSource> htmlDataSourceList) throws MessagingException {
- Multipart multiPartHtml = new MimeMultipart("related");
- htmlBodyPart.setContent(multiPartHtml);
- MimeBodyPart part = new MimeBodyPart();
- part.setContent(htmlMessage, CONTENT_TYPE_TEXT_HTML);
- part.setHeader(CONTENT_TYPE_ID, CONTENT_TYPE_TEXT_HTML);
- part.setHeader("Content-Transfer-Encoding", "quoted-printable");
- multiPartHtml.addBodyPart(part);
- for (DataSource source : htmlDataSourceList) {
- part = new MimeBodyPart();
- DataHandler handler = new DataHandler(source);
- part.setDataHandler(handler);
- part.setFileName(source.getName());
- part.addHeader("Content-ID", "<" + source.getName() + ">");
- multiPartHtml.addBodyPart(part);
- }
- }
-
- private static void writePlainBody(MimePart plainBodyPart, String plainTextMessage) throws MessagingException {
- plainBodyPart.setText(plainTextMessage, "UTF-8");
- plainBodyPart.setHeader(CONTENT_TYPE_ID, CONTENT_TYPE_TEXT_PLAIN);
- plainBodyPart.setHeader("Content-Transfer-Encoding", "quoted-printable");
- }
-
- private MimeMessage createMimeMessageInternal(String bodyTextPlain, String bodyTextHtml, DataSource[] attachements) throws ProcessingException {
- try {
- CharsetSafeMimeMessage m = new CharsetSafeMimeMessage();
- MimeMultipart multiPart = new MimeMultipart();
- BodyPart bodyPart = createBodyPart(bodyTextPlain, bodyTextHtml);
- if (bodyPart == null) {
- return null;
- }
- multiPart.addBodyPart(bodyPart);
- // attachements
- if (attachements != null) {
- for (DataSource source : attachements) {
- MimeBodyPart part = new MimeBodyPart();
- DataHandler handler = new DataHandler(source);
- part.setDataHandler(handler);
- part.setFileName(source.getName());
- multiPart.addBodyPart(part);
- }
- }
- m.setContent(multiPart);
- return m;
- }
- catch (Throwable t) {
- throw new ProcessingException("Failed to create MimeMessage.", t);
- }
- }
-
- private BodyPart createBodyPart(String bodyTextPlain, String bodyTextHtml) throws MessagingException {
- if (!StringUtility.isNullOrEmpty(bodyTextPlain) && !StringUtility.isNullOrEmpty(bodyTextHtml)) {
- // multipart
- MimeBodyPart plainPart = new MimeBodyPart();
- plainPart.setText(bodyTextPlain, "UTF-8");
- plainPart.addHeader(CONTENT_TYPE_ID, CONTENT_TYPE_TEXT_PLAIN);
- MimeBodyPart htmlPart = new MimeBodyPart();
- htmlPart.setText(bodyTextHtml, "UTF-8");
- htmlPart.addHeader(CONTENT_TYPE_ID, CONTENT_TYPE_TEXT_HTML);
-
- Multipart multiPart = new MimeMultipart("alternative");
- multiPart.addBodyPart(plainPart);
- multiPart.addBodyPart(htmlPart);
- MimeBodyPart multiBodyPart = new MimeBodyPart();
- multiBodyPart.setContent(multiPart);
- return multiBodyPart;
- }
- else if (!StringUtility.isNullOrEmpty(bodyTextPlain)) {
- MimeBodyPart part = new MimeBodyPart();
- part.setText(bodyTextPlain, "UTF-8");
- part.addHeader(CONTENT_TYPE_ID, CONTENT_TYPE_TEXT_PLAIN);
- return part;
- }
- else if (!StringUtility.isNullOrEmpty(bodyTextHtml)) {
- MimeBodyPart part = new MimeBodyPart();
- part.setText(bodyTextHtml, "UTF-8");
- part.addHeader(CONTENT_TYPE_ID, CONTENT_TYPE_TEXT_HTML);
- return part;
- }
- return null;
- }
-
- public static MimeMessage createMessageFromBytes(byte[] bytes) throws ProcessingException {
- return instance.createMessageFromBytesImpl(bytes);
- }
-
- private MimeMessage createMessageFromBytesImpl(byte[] bytes) throws ProcessingException {
- try {
- ByteArrayInputStream st = new ByteArrayInputStream(bytes);
- return new MimeMessage(null, st);
- }
- catch (Throwable t) {
- throw new ProcessingException("Unexpected: ", t);
- }
- }
-
- /**
- * @since 2.7
- */
- public static String getContentTypeForExtension(String ext) {
- if (ext == null) {
- return null;
- }
- if (ext.startsWith(".")) {
- ext = ext.substring(1);
- }
- ext = ext.toLowerCase();
- String type = FileUtility.getContentTypeForExtension(ext);
- if (type == null) {
- type = MimetypesFileTypeMap.getDefaultFileTypeMap().getContentType("tmp." + ext);
- }
- return type;
- }
-
- /**
- * Careful: this method returns null when the list of addresses is empty! This is a (stupid) default by
- * javax.mime.Message
- */
- private InternetAddress[] parseAddresses(String[] addresses) throws AddressException {
- if (addresses == null) {
- return null;
- }
- ArrayList<InternetAddress> addrList = new ArrayList<InternetAddress>();
- for (int i = 0; i < Array.getLength(addresses); i++) {
- addrList.add(new InternetAddress(addresses[i]));
- }
- if (addrList.size() == 0) {
- return null;
- }
- else {
- return addrList.toArray(new InternetAddress[addrList.size()]);
- }
- }
-
- private String getCharacterEncodingOfMimePart(MimePart part) throws MessagingException {
- Pattern pattern = Pattern.compile("charset=\".*\"", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE);
- Matcher matcher = pattern.matcher(part.getContentType());
- String characterEncoding = "UTF-8"; // default, a good guess in Europe
- if (matcher.find()) {
- if (matcher.group(0).split("\"").length >= 2) {
- characterEncoding = matcher.group(0).split("\"")[1];
- }
- }
- else {
- if (part.getContentType().contains("charset=")) {
- if (part.getContentType().split("charset=").length == 2) {
- characterEncoding = part.getContentType().split("charset=")[1];
- }
- }
- }
- return characterEncoding;
- }
-
- static {
- fixMailcapCommandMap();
- }
-
- /**
- * jax-ws in jre 1.6.0 and priopr to 1.2.7 breaks support for "Umlaute" ä, ö, ü due to a bug in
- * StringDataContentHandler.writeTo
- * <p>
- * This patch uses reflection to eliminate this buggy mapping from the command map and adds the default text_plain
- * mapping (if available, e.g. sun jre)
- */
- @SuppressWarnings("unchecked")
- private static void fixMailcapCommandMap() {
- try {
- //set the com.sun.mail.handlers.text_plain to level 0 (programmatic) to prevent others from overriding in level 0
- Class textPlainClass;
- try {
- textPlainClass = Class.forName("com.sun.mail.handlers.text_plain");
- }
- catch (Throwable t) {
- //class not found, cancel
- return;
- }
- CommandMap cmap = MailcapCommandMap.getDefaultCommandMap();
- if (!(cmap instanceof MailcapCommandMap)) {
- return;
- }
- ((MailcapCommandMap) cmap).addMailcap("text/plain;;x-java-content-handler=" + textPlainClass.getName());
- //use reflection to clear out all other mappings of text/plain in level 0
- Field f = MailcapCommandMap.class.getDeclaredField("DB");
- f.setAccessible(true);
- Object[] dbArray = (Object[]) f.get(cmap);
- f = Class.forName("com.sun.activation.registries.MailcapFile").getDeclaredField("type_hash");
- f.setAccessible(true);
- Map<Object, Object> db0 = (Map<Object, Object>) f.get(dbArray[0]);
- Map<Object, Object> typeMap = (Map<Object, Object>) db0.get("text/plain");
- List<String> handlerList = (List<String>) typeMap.get("content-handler");
- //put text_plain in front
- handlerList.remove("com.sun.mail.handlers.text_plain");
- handlerList.add(0, "com.sun.mail.handlers.text_plain");
- }
- catch (Throwable t) {
- ScoutLogManager.getLogger(MailUtility.class).warn("Failed fixing MailcapComandMap string handling: " + t);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+import java.io.UnsupportedEncodingException;
+import java.lang.reflect.Array;
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.activation.CommandMap;
+import javax.activation.DataHandler;
+import javax.activation.DataSource;
+import javax.activation.FileDataSource;
+import javax.activation.MailcapCommandMap;
+import javax.activation.MimetypesFileTypeMap;
+import javax.mail.BodyPart;
+import javax.mail.Message;
+import javax.mail.MessagingException;
+import javax.mail.Multipart;
+import javax.mail.Part;
+import javax.mail.internet.AddressException;
+import javax.mail.internet.InternetAddress;
+import javax.mail.internet.MimeBodyPart;
+import javax.mail.internet.MimeMessage;
+import javax.mail.internet.MimeMultipart;
+import javax.mail.internet.MimePart;
+import javax.mail.util.ByteArrayDataSource;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+
+public final class MailUtility {
+
+ public static final IScoutLogger LOG = ScoutLogManager.getLogger(MailUtility.class);
+
+ private static final String CONTENT_TYPE_ID = "Content-Type";
+ public static final String CONTENT_TYPE_TEXT_HTML = "text/html; charset=\"UTF-8\"";
+ public static final String CONTENT_TYPE_TEXT_PLAIN = "text/plain; charset=\"UTF-8\"";
+ public static final String CONTENT_TYPE_MESSAGE_RFC822 = "message/rfc822";
+ public static final String CONTENT_TYPE_MULTIPART = "alternative";
+
+ private static MailUtility instance = new MailUtility();
+
+ private MailUtility() {
+ }
+
+ /**
+ * Container for the mail body in plain text and html.
+ * For the correct html representation it contains also a list of files referenced in the html.
+ */
+ public class MailMessage {
+
+ private String m_plainText;
+ private String m_htmlText;
+ private List<File> m_htmlAttachmentList;
+
+ public MailMessage(String plainText, String htmlText, List<File> htmlAttachmentList) {
+ m_plainText = plainText;
+ m_htmlText = htmlText;
+ m_htmlAttachmentList = htmlAttachmentList;
+ }
+
+ public String getPlainText() {
+ return m_plainText;
+ }
+
+ public String getHtmlText() {
+ return m_htmlText;
+ }
+
+ public List<File> getHtmlAttachmentList() {
+ return m_htmlAttachmentList;
+ }
+ }
+
+ public static Part[] getBodyParts(Part message) throws ProcessingException {
+ return instance.getBodyPartsImpl(message);
+ }
+
+ private Part[] getBodyPartsImpl(Part message) throws ProcessingException {
+ List<Part> bodyCollector = new ArrayList<Part>();
+ List<Part> attachementCollector = new ArrayList<Part>();
+ collectMailPartsReqImpl(message, bodyCollector, attachementCollector);
+ return bodyCollector.toArray(new Part[bodyCollector.size()]);
+ }
+
+ public static Part[] getAttachmentParts(Part message) throws ProcessingException {
+ return instance.getAttachmentPartsImpl(message);
+ }
+
+ private Part[] getAttachmentPartsImpl(Part message) throws ProcessingException {
+ List<Part> bodyCollector = new ArrayList<Part>();
+ List<Part> attachementCollector = new ArrayList<Part>();
+ collectMailPartsReqImpl(message, bodyCollector, attachementCollector);
+ return attachementCollector.toArray(new Part[attachementCollector.size()]);
+ }
+
+ public static void collectMailParts(Part message, List<Part> bodyCollector, List<Part> attachementCollector) throws ProcessingException {
+ instance.collectMailPartsReqImpl(message, bodyCollector, attachementCollector);
+ }
+
+ private void collectMailPartsReqImpl(Part part, List<Part> bodyCollector, List<Part> attachementCollector) throws ProcessingException {
+ if (part == null) {
+ return;
+ }
+ try {
+ String disp = part.getDisposition();
+ if (disp != null && disp.equalsIgnoreCase(Part.ATTACHMENT)) {
+ attachementCollector.add(part);
+ }
+ else if (part.getContent() instanceof Multipart) {
+ Multipart multiPart = (Multipart) part.getContent();
+ for (int i = 0; i < multiPart.getCount(); i++) {
+ collectMailPartsReqImpl(multiPart.getBodyPart(i), bodyCollector, attachementCollector);
+ }
+ }
+ else {
+ if (part.isMimeType(CONTENT_TYPE_TEXT_PLAIN)) {
+ bodyCollector.add(part);
+ }
+ else if (part.isMimeType(CONTENT_TYPE_TEXT_HTML)) {
+ bodyCollector.add(part);
+ }
+ else if (part.isMimeType(CONTENT_TYPE_MESSAGE_RFC822) && part.getContent() instanceof MimeMessage) {
+ // its a MIME message in rfc822 format as attachment therefore we have to set the filename for the attachment correctly.
+ MimeMessage msg = (MimeMessage) part.getContent();
+ String filteredSubjectText = StringUtility.filterText(msg.getSubject(), "a-zA-Z0-9_-", "");
+ String fileName = (StringUtility.hasText(filteredSubjectText) ? filteredSubjectText : "originalMessage") + ".eml";
+ RFCWrapperPart wrapperPart = new RFCWrapperPart(part, fileName);
+ attachementCollector.add(wrapperPart);
+ }
+ }
+ }
+ catch (ProcessingException e) {
+ throw e;
+ }
+ catch (Throwable t) {
+ throw new ProcessingException("Unexpected: ", t);
+ }
+ }
+
+ /**
+ * @param part
+ * @return the plainText part encoded with the encoding given in the MIME header or UTF-8 encoded or null if the
+ * plainText Part is not given
+ * @throws ProcessingException
+ */
+ public static String getPlainText(Part part) throws ProcessingException {
+ return instance.getPlainTextImpl(part);
+ }
+
+ private String getPlainTextImpl(Part part) throws ProcessingException {
+ String text = null;
+ try {
+ Part[] bodyParts = getBodyPartsImpl(part);
+ Part plainTextPart = getPlainTextPart(bodyParts);
+
+ if (plainTextPart instanceof MimePart) {
+ MimePart mimePart = (MimePart) plainTextPart;
+ byte[] content = IOUtility.getContent(mimePart.getInputStream());
+ if (content != null) {
+ try {
+ text = new String(content, getCharacterEncodingOfMimePart(mimePart));
+ }
+ catch (UnsupportedEncodingException e) {
+ text = new String(content);
+ }
+
+ }
+ }
+ }
+ catch (ProcessingException e) {
+ throw e;
+ }
+ catch (Throwable t) {
+ throw new ProcessingException("Unexpected: ", t);
+ }
+ return text;
+ }
+
+ public static Part getHtmlPart(Part[] bodyParts) throws ProcessingException {
+ for (Part p : bodyParts) {
+ try {
+ if (p != null && p.isMimeType(CONTENT_TYPE_TEXT_HTML)) {
+ return p;
+ }
+ }
+ catch (Throwable t) {
+ throw new ProcessingException("Unexpected: ", t);
+ }
+ }
+ return null;
+ }
+
+ public static Part getPlainTextPart(Part[] bodyParts) throws ProcessingException {
+ for (Part p : bodyParts) {
+ try {
+ if (p != null && p.isMimeType(CONTENT_TYPE_TEXT_PLAIN)) {
+ return p;
+ }
+ }
+ catch (Throwable t) {
+ throw new ProcessingException("Unexpected: ", t);
+ }
+ }
+ return null;
+ }
+
+ public static DataSource createDataSource(File file) throws ProcessingException {
+ try {
+ int indexDot = file.getName().lastIndexOf(".");
+ if (indexDot > 0) {
+ String fileName = file.getName();
+ String ext = fileName.substring(indexDot + 1);
+ return instance.createDataSourceImpl(new FileInputStream(file), fileName, ext);
+ }
+ else {
+ return null;
+ }
+ }
+ catch (Throwable t) {
+ throw new ProcessingException("Unexpected: ", t);
+ }
+ }
+
+ public static DataSource createDataSource(InputStream inStream, String fileName, String fileExtension) throws ProcessingException {
+ return instance.createDataSourceImpl(inStream, fileName, fileExtension);
+ }
+
+ /**
+ * @param inStream
+ * @param fileName
+ * e.g. "file.txt"
+ * @param fileExtension
+ * e.g. "txt", "jpg"
+ * @return
+ * @throws ProcessingException
+ */
+ private DataSource createDataSourceImpl(InputStream inStream, String fileName, String fileExtension) throws ProcessingException {
+ try {
+ ByteArrayDataSource item = new ByteArrayDataSource(inStream, getContentTypeForExtension(fileExtension));
+ item.setName(fileName);
+ return item;
+ }
+ catch (Throwable t) {
+ throw new ProcessingException("Unexpected: ", t);
+ }
+ }
+
+ public static MailMessage extractMailMessageFromWordArchive(File archiveFile) {
+ return instance.extractMailMessageFromWordArchiveInternal(archiveFile);
+ }
+
+ private MailMessage extractMailMessageFromWordArchiveInternal(File archiveFile) {
+ MailMessage mailMessage = null;
+ File tempDir = extractWordArchive(archiveFile);
+ String simpleName = extractSimpleNameFromWordArchive(archiveFile);
+ String messagePlainText = extractPlainTextFromWordArchiveInternal(tempDir, simpleName);
+ String messageHtml = extractHtmlFromWordArchiveInternal(tempDir, simpleName);
+ // replace directory entry
+ // replace all paths to the 'files directory' with the root directory
+ File attachmentFolder = null;
+ if (tempDir.isDirectory()) {
+ for (File file : tempDir.listFiles()) {
+ if (file.isDirectory() && file.getName().startsWith(simpleName)) {
+ attachmentFolder = file;
+ break;
+ }
+ }
+ }
+ String folderName = null;
+ if (attachmentFolder != null) {
+ folderName = attachmentFolder.getName();
+ }
+ messageHtml = messageHtml.replaceAll(folderName + "/", "");
+ messageHtml = removeWordTags(messageHtml);
+ // now loop through the directory and search all the files needed for a correct representation of the html mail
+ List<File> attachmentList = new ArrayList<File>();
+ if (attachmentFolder != null) {
+ for (File attFile : attachmentFolder.listFiles()) {
+ // exclude Microsoft Word specific directory file. This is only used to edit HTML in Word.
+ if (!attFile.isDirectory() && !isWordSpecificFile(attFile.getName())) {
+ attachmentList.add(attFile);
+ }
+ }
+ }
+ mailMessage = new MailMessage(messagePlainText, messageHtml, attachmentList);
+ return mailMessage;
+ }
+
+ private String extractHtmlFromWordArchiveInternal(File dir, String simpleName) {
+ String txt = null;
+ try {
+ txt = extractTextFromWordArchiveInternal(dir, simpleName, "html");
+ }
+ catch (Exception e) {
+ LOG.error("Error occured while trying to extract plain text file", e);
+ }
+ return txt;
+ }
+
+ private String extractSimpleNameFromWordArchive(File archiveFile) {
+ String simpleName = archiveFile.getName();
+ if (archiveFile.getName().lastIndexOf('.') != -1) {
+ simpleName = archiveFile.getName().substring(0, archiveFile.getName().lastIndexOf('.'));
+ }
+ return simpleName;
+ }
+
+ private File extractWordArchive(File archiveFile) {
+ File tempDir = null;
+ try {
+ tempDir = IOUtility.createTempDirectory("");
+ FileUtility.extractArchive(archiveFile, tempDir);
+ }
+ catch (Exception e) {
+ LOG.error("Error occured while trying to extract word archive", e);
+ }
+ return tempDir;
+ }
+
+ public static String extractPlainTextFromWordArchive(File archiveFile) {
+ return instance.extractPlainTextFromWordArchiveInternal(archiveFile);
+ }
+
+ private String extractPlainTextFromWordArchiveInternal(File archiveFile) {
+ File tempDir = extractWordArchive(archiveFile);
+ String simpleName = extractSimpleNameFromWordArchive(archiveFile);
+ return extractPlainTextFromWordArchiveInternal(tempDir, simpleName);
+ }
+
+ private String extractPlainTextFromWordArchiveInternal(File dir, String simpleName) {
+ String plainText = null;
+ try {
+ plainText = extractTextFromWordArchiveInternal(dir, simpleName, "txt");
+ }
+ catch (Exception e) {
+ LOG.error("Error occured while trying to extract plain text file", e);
+ }
+ return plainText;
+ }
+
+ private String extractTextFromWordArchiveInternal(File dir, String simpleName, String fileType) throws ProcessingException, IOException {
+ String txt = null;
+ File plainTextFile = new File(dir, simpleName + "." + fileType);
+ if (plainTextFile.exists() && plainTextFile.canRead()) {
+ Reader reader = new FileReader(plainTextFile);
+ txt = IOUtility.getContent(reader);
+ reader.close();
+ }
+ return txt;
+ }
+
+ /**
+ * Create {@link MimeMessage} from plain text fields.
+ *
+ * @rn aho, 19.01.2009
+ */
+ public static MimeMessage createMimeMessage(String[] toRecipients, String sender, String subject, String bodyTextPlain, DataSource[] attachements) throws ProcessingException {
+ return instance.createMimeMessageInternal(toRecipients, null, null, sender, subject, bodyTextPlain, attachements);
+ }
+
+ /**
+ * Create {@link MimeMessage} from plain text fields.
+ *
+ * @rn aho, 19.01.2009
+ */
+ public static MimeMessage createMimeMessage(String[] toRecipients, String[] ccRecipients, String[] bccRecipients, String sender, String subject, String bodyTextPlain, DataSource[] attachements) throws ProcessingException {
+ return instance.createMimeMessageInternal(toRecipients, ccRecipients, bccRecipients, sender, subject, bodyTextPlain, attachements);
+ }
+
+ private MimeMessage createMimeMessageInternal(String[] toRecipients, String[] ccRecipients, String[] bccRecipients, String sender, String subject, String bodyTextPlain, DataSource[] attachements) throws ProcessingException {
+ try {
+ MimeMessage msg = MailUtility.createMimeMessage(bodyTextPlain, null, attachements);
+ if (sender != null) {
+ InternetAddress addrSender = new InternetAddress(sender);
+ msg.setFrom(addrSender);
+ msg.setSender(addrSender);
+ }
+ msg.setSentDate(new java.util.Date());
+ //
+ msg.setSubject(subject, "UTF-8");
+ //
+ msg.setRecipients(Message.RecipientType.TO, parseAddresses(toRecipients));
+ msg.setRecipients(Message.RecipientType.CC, parseAddresses(ccRecipients));
+ msg.setRecipients(Message.RecipientType.BCC, parseAddresses(bccRecipients));
+ return msg;
+ }
+ catch (ProcessingException pe) {
+ throw pe;
+ }
+ catch (Exception e) {
+ throw new ProcessingException("Failed to create MimeMessage.", e);
+ }
+ }
+
+ public static MimeMessage createMimeMessage(String messagePlain, String messageHtml, DataSource[] attachements) throws ProcessingException {
+ return instance.createMimeMessageInternal(messagePlain, messageHtml, attachements);
+ }
+
+ public static MimeMessage createMimeMessageFromWordArchiveDirectory(File archiveDir, String simpleName, File[] attachments, boolean markAsUnsent) throws ProcessingException {
+ return instance.createMimeMessageFromWordArchiveInternal(archiveDir, simpleName, attachments, markAsUnsent);
+ }
+
+ public static MimeMessage createMimeMessageFromWordArchive(File archiveFile, File[] attachments) throws ProcessingException {
+ return createMimeMessageFromWordArchive(archiveFile, attachments, false);
+ }
+
+ public static MimeMessage createMimeMessageFromWordArchive(File archiveFile, File[] attachments, boolean markAsUnsent) throws ProcessingException {
+ try {
+ File tempDir = IOUtility.createTempDirectory("");
+ FileUtility.extractArchive(archiveFile, tempDir);
+
+ String simpleName = archiveFile.getName();
+ if (archiveFile.getName().lastIndexOf('.') != -1) {
+ simpleName = archiveFile.getName().substring(0, archiveFile.getName().lastIndexOf('.'));
+ }
+ return instance.createMimeMessageFromWordArchiveInternal(tempDir, simpleName, attachments, markAsUnsent);
+ }
+ catch (ProcessingException pe) {
+ throw pe;
+ }
+ catch (IOException e) {
+ throw new ProcessingException("Error occured while accessing files", e);
+ }
+ }
+
+ private MimeMessage createMimeMessageFromWordArchiveInternal(File archiveDir, String simpleName, File[] attachments, boolean markAsUnsent) throws ProcessingException {
+ try {
+ File plainTextFile = new File(archiveDir, simpleName + ".txt");
+ String plainTextMessage = null;
+ boolean hasPlainText = false;
+ if (plainTextFile.exists()) {
+ Reader reader = new FileReader(plainTextFile);
+ plainTextMessage = IOUtility.getContent(reader);
+ reader.close();
+ hasPlainText = StringUtility.hasText(plainTextMessage);
+ }
+
+ String folderName = null;
+ List<DataSource> htmlDataSourceList = new ArrayList<DataSource>();
+ for (File filesFolder : archiveDir.listFiles()) {
+ // in this archive file, exactly one directory should exist
+ // word names this directory differently depending on the language
+ if (filesFolder.isDirectory() && filesFolder.getName().startsWith(simpleName)) {
+ // we accept the first directory that meets the constraint above
+ // add all auxiliary files as attachment
+ folderName = filesFolder.getName();
+ for (File file : filesFolder.listFiles()) {
+ // exclude Microsoft Word specific directory file. This is only used to edit HTML in Word.
+ String filename = file.getName();
+ if (!isWordSpecificFile(filename)) {
+ FileDataSource fds = new FileDataSource(file);
+ htmlDataSourceList.add(fds);
+ }
+ }
+ break;
+ }
+ }
+
+ File htmlFile = new File(archiveDir, simpleName + ".html");
+ String htmlMessage = null;
+ boolean hasHtml = false;
+ if (htmlFile.exists()) {
+ Reader reader = new FileReader(htmlFile);
+ htmlMessage = IOUtility.getContent(reader);
+ reader.close();
+ // replace directory entry
+ // replace all paths to the 'files directory' with the root directory
+ htmlMessage = htmlMessage.replaceAll("\"" + folderName + "/", "\"cid:");
+
+ htmlMessage = removeWordTags(htmlMessage);
+ // remove any VML elements
+ htmlMessage = htmlMessage.replaceAll("<!--\\[if gte vml 1(.*\\r?\\n)*?.*?endif\\]-->", "");
+ // remove any VML elements part2
+ htmlMessage = Pattern.compile("<!\\[if !vml\\]>(.*?)<!\\[endif\\]>", Pattern.DOTALL).matcher(htmlMessage).replaceAll("$1");
+ // remove not referenced attachments
+ for (Iterator<DataSource> it = htmlDataSourceList.iterator(); it.hasNext();) {
+ DataSource ds = it.next();
+ if (!htmlMessage.contains("cid:" + ds.getName())) {
+ it.remove();
+ }
+ }
+ hasHtml = StringUtility.hasText(htmlMessage);
+ }
+
+ if (!hasPlainText && !hasHtml) {
+ throw new ProcessingException("message has no body");
+ }
+
+ MimeMessage mimeMessage = new CharsetSafeMimeMessage();
+ MimePart bodyPart = null;
+ if (attachments != null && attachments.length > 0) {
+ MimeMultipart multiPart = new MimeMultipart(); //mixed
+ mimeMessage.setContent(multiPart);
+ //add a holder for the body text
+ MimeBodyPart multiPartBody = new MimeBodyPart();
+ multiPart.addBodyPart(multiPartBody);
+ bodyPart = multiPartBody;
+ //add the attachments
+ for (File attachment : attachments) {
+ MimeBodyPart part = new MimeBodyPart();
+ FileDataSource fds = new FileDataSource(attachment);
+ DataHandler handler = new DataHandler(fds);
+ part.setDataHandler(handler);
+ part.setFileName(attachment.getName());
+ multiPart.addBodyPart(part);
+ }
+ }
+ else {
+ //no attachments -> no need for multipart/mixed element
+ bodyPart = mimeMessage;
+ }
+
+ if (hasPlainText && hasHtml) {
+ MimeMultipart alternativePart = new MimeMultipart("alternative");
+ bodyPart.setContent(alternativePart);
+ MimeBodyPart plainBodyPart = new MimeBodyPart();
+ alternativePart.addBodyPart(plainBodyPart);
+ writePlainBody(plainBodyPart, plainTextMessage);
+ MimeBodyPart htmlBodyPart = new MimeBodyPart();
+ alternativePart.addBodyPart(htmlBodyPart);
+ writeHtmlBody(htmlBodyPart, htmlMessage, htmlDataSourceList);
+ }
+ else if (hasPlainText) { //plain text only
+ writePlainBody(bodyPart, plainTextMessage);
+ }
+ else { //html only
+ writeHtmlBody(bodyPart, htmlMessage, htmlDataSourceList);
+ }
+
+ if (markAsUnsent) {
+ mimeMessage.setHeader("X-Unsent", "1"); // only supported in Outlook 2010
+ }
+ return mimeMessage;
+ }
+ catch (IOException e) {
+ throw new ProcessingException("Error occured while accessing files", e);
+ }
+ catch (MessagingException e) {
+ throw new ProcessingException("Error occured while creating MIME-message", e);
+ }
+ }
+
+ private String removeWordTags(String htmlMessage) {
+ // remove special/unused files
+ htmlMessage = htmlMessage.replaceAll("<link rel=File-List href=\"cid:filelist.xml\">", "");
+ htmlMessage = htmlMessage.replaceAll("<link rel=colorSchemeMapping href=\"cid:colorschememapping.xml\">", "");
+ htmlMessage = htmlMessage.replaceAll("<link rel=themeData href=\"cid:themedata.thmx\">", "");
+ htmlMessage = htmlMessage.replaceAll("<link rel=Edit-Time-Data href=\"cid:editdata.mso\">", "");
+
+ // remove Microsoft Word tags
+ htmlMessage = htmlMessage.replaceAll("<!--\\[if gte mso(.*\\r?\\n)*?.*?endif\\]-->", "");
+
+ return htmlMessage;
+ }
+
+ /**
+ * Checks if file is a Microsoft Word specific directory file. They are only used to edit HTML in Word.
+ */
+ private boolean isWordSpecificFile(String filename) {
+ return filename.equalsIgnoreCase("filelist.xml") ||
+ filename.equalsIgnoreCase("colorschememapping.xml") ||
+ filename.equalsIgnoreCase("themedata.thmx") ||
+ filename.equalsIgnoreCase("header.html") ||
+ filename.equalsIgnoreCase("editdata.mso") ||
+ filename.matches("item\\d{4}\\.xml") ||
+ filename.matches("props\\d{4}\\.xml");
+ }
+
+ private static void writeHtmlBody(MimePart htmlBodyPart, String htmlMessage, List<DataSource> htmlDataSourceList) throws MessagingException {
+ Multipart multiPartHtml = new MimeMultipart("related");
+ htmlBodyPart.setContent(multiPartHtml);
+ MimeBodyPart part = new MimeBodyPart();
+ part.setContent(htmlMessage, CONTENT_TYPE_TEXT_HTML);
+ part.setHeader(CONTENT_TYPE_ID, CONTENT_TYPE_TEXT_HTML);
+ part.setHeader("Content-Transfer-Encoding", "quoted-printable");
+ multiPartHtml.addBodyPart(part);
+ for (DataSource source : htmlDataSourceList) {
+ part = new MimeBodyPart();
+ DataHandler handler = new DataHandler(source);
+ part.setDataHandler(handler);
+ part.setFileName(source.getName());
+ part.addHeader("Content-ID", "<" + source.getName() + ">");
+ multiPartHtml.addBodyPart(part);
+ }
+ }
+
+ private static void writePlainBody(MimePart plainBodyPart, String plainTextMessage) throws MessagingException {
+ plainBodyPart.setText(plainTextMessage, "UTF-8");
+ plainBodyPart.setHeader(CONTENT_TYPE_ID, CONTENT_TYPE_TEXT_PLAIN);
+ plainBodyPart.setHeader("Content-Transfer-Encoding", "quoted-printable");
+ }
+
+ private MimeMessage createMimeMessageInternal(String bodyTextPlain, String bodyTextHtml, DataSource[] attachements) throws ProcessingException {
+ try {
+ CharsetSafeMimeMessage m = new CharsetSafeMimeMessage();
+ MimeMultipart multiPart = new MimeMultipart();
+ BodyPart bodyPart = createBodyPart(bodyTextPlain, bodyTextHtml);
+ if (bodyPart == null) {
+ return null;
+ }
+ multiPart.addBodyPart(bodyPart);
+ // attachements
+ if (attachements != null) {
+ for (DataSource source : attachements) {
+ MimeBodyPart part = new MimeBodyPart();
+ DataHandler handler = new DataHandler(source);
+ part.setDataHandler(handler);
+ part.setFileName(source.getName());
+ multiPart.addBodyPart(part);
+ }
+ }
+ m.setContent(multiPart);
+ return m;
+ }
+ catch (Throwable t) {
+ throw new ProcessingException("Failed to create MimeMessage.", t);
+ }
+ }
+
+ private BodyPart createBodyPart(String bodyTextPlain, String bodyTextHtml) throws MessagingException {
+ if (!StringUtility.isNullOrEmpty(bodyTextPlain) && !StringUtility.isNullOrEmpty(bodyTextHtml)) {
+ // multipart
+ MimeBodyPart plainPart = new MimeBodyPart();
+ plainPart.setText(bodyTextPlain, "UTF-8");
+ plainPart.addHeader(CONTENT_TYPE_ID, CONTENT_TYPE_TEXT_PLAIN);
+ MimeBodyPart htmlPart = new MimeBodyPart();
+ htmlPart.setText(bodyTextHtml, "UTF-8");
+ htmlPart.addHeader(CONTENT_TYPE_ID, CONTENT_TYPE_TEXT_HTML);
+
+ Multipart multiPart = new MimeMultipart("alternative");
+ multiPart.addBodyPart(plainPart);
+ multiPart.addBodyPart(htmlPart);
+ MimeBodyPart multiBodyPart = new MimeBodyPart();
+ multiBodyPart.setContent(multiPart);
+ return multiBodyPart;
+ }
+ else if (!StringUtility.isNullOrEmpty(bodyTextPlain)) {
+ MimeBodyPart part = new MimeBodyPart();
+ part.setText(bodyTextPlain, "UTF-8");
+ part.addHeader(CONTENT_TYPE_ID, CONTENT_TYPE_TEXT_PLAIN);
+ return part;
+ }
+ else if (!StringUtility.isNullOrEmpty(bodyTextHtml)) {
+ MimeBodyPart part = new MimeBodyPart();
+ part.setText(bodyTextHtml, "UTF-8");
+ part.addHeader(CONTENT_TYPE_ID, CONTENT_TYPE_TEXT_HTML);
+ return part;
+ }
+ return null;
+ }
+
+ public static MimeMessage createMessageFromBytes(byte[] bytes) throws ProcessingException {
+ return instance.createMessageFromBytesImpl(bytes);
+ }
+
+ private MimeMessage createMessageFromBytesImpl(byte[] bytes) throws ProcessingException {
+ try {
+ ByteArrayInputStream st = new ByteArrayInputStream(bytes);
+ return new MimeMessage(null, st);
+ }
+ catch (Throwable t) {
+ throw new ProcessingException("Unexpected: ", t);
+ }
+ }
+
+ /**
+ * @since 2.7
+ */
+ public static String getContentTypeForExtension(String ext) {
+ if (ext == null) {
+ return null;
+ }
+ if (ext.startsWith(".")) {
+ ext = ext.substring(1);
+ }
+ ext = ext.toLowerCase();
+ String type = FileUtility.getContentTypeForExtension(ext);
+ if (type == null) {
+ type = MimetypesFileTypeMap.getDefaultFileTypeMap().getContentType("tmp." + ext);
+ }
+ return type;
+ }
+
+ /**
+ * Careful: this method returns null when the list of addresses is empty! This is a (stupid) default by
+ * javax.mime.Message
+ */
+ private InternetAddress[] parseAddresses(String[] addresses) throws AddressException {
+ if (addresses == null) {
+ return null;
+ }
+ ArrayList<InternetAddress> addrList = new ArrayList<InternetAddress>();
+ for (int i = 0; i < Array.getLength(addresses); i++) {
+ addrList.add(new InternetAddress(addresses[i]));
+ }
+ if (addrList.size() == 0) {
+ return null;
+ }
+ else {
+ return addrList.toArray(new InternetAddress[addrList.size()]);
+ }
+ }
+
+ private String getCharacterEncodingOfMimePart(MimePart part) throws MessagingException {
+ Pattern pattern = Pattern.compile("charset=\".*\"", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE);
+ Matcher matcher = pattern.matcher(part.getContentType());
+ String characterEncoding = "UTF-8"; // default, a good guess in Europe
+ if (matcher.find()) {
+ if (matcher.group(0).split("\"").length >= 2) {
+ characterEncoding = matcher.group(0).split("\"")[1];
+ }
+ }
+ else {
+ if (part.getContentType().contains("charset=")) {
+ if (part.getContentType().split("charset=").length == 2) {
+ characterEncoding = part.getContentType().split("charset=")[1];
+ }
+ }
+ }
+ return characterEncoding;
+ }
+
+ static {
+ fixMailcapCommandMap();
+ }
+
+ /**
+ * jax-ws in jre 1.6.0 and priopr to 1.2.7 breaks support for "Umlaute" ä, ö, ü due to a bug in
+ * StringDataContentHandler.writeTo
+ * <p>
+ * This patch uses reflection to eliminate this buggy mapping from the command map and adds the default text_plain
+ * mapping (if available, e.g. sun jre)
+ */
+ @SuppressWarnings("unchecked")
+ private static void fixMailcapCommandMap() {
+ try {
+ //set the com.sun.mail.handlers.text_plain to level 0 (programmatic) to prevent others from overriding in level 0
+ Class textPlainClass;
+ try {
+ textPlainClass = Class.forName("com.sun.mail.handlers.text_plain");
+ }
+ catch (Throwable t) {
+ //class not found, cancel
+ return;
+ }
+ CommandMap cmap = MailcapCommandMap.getDefaultCommandMap();
+ if (!(cmap instanceof MailcapCommandMap)) {
+ return;
+ }
+ ((MailcapCommandMap) cmap).addMailcap("text/plain;;x-java-content-handler=" + textPlainClass.getName());
+ //use reflection to clear out all other mappings of text/plain in level 0
+ Field f = MailcapCommandMap.class.getDeclaredField("DB");
+ f.setAccessible(true);
+ Object[] dbArray = (Object[]) f.get(cmap);
+ f = Class.forName("com.sun.activation.registries.MailcapFile").getDeclaredField("type_hash");
+ f.setAccessible(true);
+ Map<Object, Object> db0 = (Map<Object, Object>) f.get(dbArray[0]);
+ Map<Object, Object> typeMap = (Map<Object, Object>) db0.get("text/plain");
+ List<String> handlerList = (List<String>) typeMap.get("content-handler");
+ //put text_plain in front
+ handlerList.remove("com.sun.mail.handlers.text_plain");
+ handlerList.add(0, "com.sun.mail.handlers.text_plain");
+ }
+ catch (Throwable t) {
+ ScoutLogManager.getLogger(MailUtility.class).warn("Failed fixing MailcapComandMap string handling: " + t);
+ }
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/MatrixUtility.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/MatrixUtility.java
index 08ef03ffff..73a393ae13 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/MatrixUtility.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/MatrixUtility.java
@@ -1,290 +1,290 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import java.lang.reflect.Array;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Locale;
-
-import org.eclipse.scout.commons.nls.NlsUtility;
-
-public final class MatrixUtility {
-
- private MatrixUtility() {
- }
-
- /**
- * If data is a single value: returns a matrix with 1 row and 2 columns
- * [0..n/2][0..1] and the value is at [0][0] If data is an array: transforms a
- * list with n values into a matrix with n/2 rows and 2 columns [0..n/2][0..1]
- * always 2 values are used to create one matrix row If data is a matrix:
- * transforms a matrix with n values into a matrix with n/2 rows and 2 columns
- * [0..n/2][0..1] always 2 values are used to create one matrix traversal is
- * row-wise
- */
- public static Object[][] toTupels(Object data) {
- if (data == null) {
- return new Object[0][0];
- }
- if (data.getClass().isArray()) {
- if (data.getClass().getComponentType().isArray()) {
- // matrix
- if (Array.getLength(data) == 0) {
- return new Object[0][0];
- }
- int rows = Array.getLength(data);
- int cols = Array.getLength(Array.get(data, 0));
- int count = rows * cols;
- Object[][] matrix = new Object[count / 2][2];
- for (int i = 0; i < matrix.length; i++) {
- int r = (i * 2) / cols;
- int c = (i * 2) % cols;
- matrix[i][0] = Array.get(Array.get(data, r), c);
- r = (i * 2 + 1) / cols;
- c = (i * 2 + 1) % cols;
- matrix[i][1] = Array.get(Array.get(data, r), c);
- }
- return matrix;
- }
- else {
- // array
- if (Array.getLength(data) == 0) {
- return new Object[0][0];
- }
- int n = Array.getLength(data);
- Object[][] matrix = new Object[n / 2][2];
- for (int i = 0; i < matrix.length; i++) {
- matrix[i][0] = Array.get(data, i * 2);
- matrix[i][1] = Array.get(data, i * 2 + 1);
- }
- return matrix;
- }
- }
- else {
- // single value
- Object[][] matrix = new Object[1][2];
- matrix[0][1] = data;
- return matrix;
- }
- }
-
- /**
- * union all lists into a matrix every list is interpreted as a matrix row
- */
- public static Object[][] union(Collection<Object>... collections) {
- int rowCount = 0;
- int colCount = 0;
- for (Collection<Object> list : collections) {
- rowCount++;
- if (list != null) {
- colCount = Math.max(colCount, list.size());
- }
- }
- Object[][] matrix = new Object[rowCount][colCount];
- int r = 0;
- for (Collection<Object> list : collections) {
- if (list != null) {
- Object[] a = list.toArray();
- for (int c = 0; c < colCount && c < a.length; c++) {
- matrix[r][c] = a[c];
- }
- }
- r++;
- }
- return matrix;
- }
-
- /**
- * union all matrixes into a single matrix where the number of rows is the sum
- * of rows of all matrixes every list is interpreted as a matrix row in sql:
- * UNION ALL
- */
- public static Object[][] union(Object... matrixes) {
- int rowCount = 0;
- int colCount = 0;
- for (Object m : matrixes) {
- if (m != null) {
- int r = Array.getLength(m);
- rowCount += r;
- if (r > 0) {
- int c = Array.getLength(Array.get(m, 0));
- colCount = Math.max(colCount, c);
- }
- }
- }
- Object[][] matrix = new Object[rowCount][colCount];
- int r = 0;
- for (Object m : matrixes) {
- if (m != null) {
- int mRows = Array.getLength(m);
- if (mRows > 0) {
- for (int i = 0; i < mRows; i++) {
- Object rowArray = Array.get(m, i);
- int mCols = Array.getLength(rowArray);
- for (int c = 0; c < colCount && c < mCols; c++) {
- matrix[r][c] = Array.get(rowArray, c);
- }
- r++;
- }
- }
- }
- }
- return matrix;
- }
-
- public static Object[][] toMatrix(Object... values) {
- if (values == null) {
- return new Object[0][0];
- }
- Object[][] matrix = new Object[1][values.length];
- matrix[0] = values;
- return matrix;
- }
-
- public static Object[][] toMatrix(Object[]... rows) {
- if (rows == null) {
- return new Object[0][0];
- }
- Object[][][] matrices = new Object[rows.length][1][];
- for (int i = 0; i < rows.length; i++) {
- matrices[i][0] = rows[i];
- }
- return union((Object[]) matrices);
- }
-
- public static Object[][] toMatrix(Collection<Object>... rows) {
- return union(rows);
- }
-
- public static String toRange(int row, int col) {
- return CellRange.toRangeString(row, col);
- }
-
- public static String toRange(int row1, int col1, int row2, int col2) {
- return CellRange.toRangeString(row1, col1, row2, col2);
- }
-
- public static int rowCount(String range) {
- return new CellRange(range).getRowCount();
- }
-
- public static int columnCount(String range) {
- return new CellRange(range).getColumnCount();
- }
-
- public static int firstRow(String range) {
- return new CellRange(range).getFirstRow();
- }
-
- public static int lastRow(String range) {
- return new CellRange(range).getLastRow();
- }
-
- public static int firstColumn(String range) {
- return new CellRange(range).getFirstColumn();
- }
-
- public static int lastColumn(String range) {
- return new CellRange(range).getLastColumn();
- }
-
- @SuppressWarnings("unchecked")
- public static <T> T getColumn(Object matrix, int columnIndex, Class<T> arrayType) {
- int rowCount = Array.getLength(matrix);
- int colCount = 0;
- if (rowCount > 0) {
- colCount = Array.getLength(Array.get(matrix, 0));
- }
- T column = (T) Array.newInstance(arrayType.getComponentType(), rowCount);
- if (rowCount > 0 && colCount > columnIndex) {
- for (int r = 0; r < rowCount; r++) {
- Array.set(column, r, TypeCastUtility.castValue(Array.get(Array.get(matrix, r), columnIndex), arrayType.getComponentType()));
- }
- }
- return column;
- }
-
- /**
- * Convenience function to sort data for later call to {@link #createCodeRowArray(Object[][])} The sort indices are
- * 0-based.
- * <p>
- * <b>It is recommended to use {@link #sort(Locale, Object[][], int...)} with the specific {@link Locale}</b>
- */
- public static void sort(Object[][] data, int... sortColumns) {
- sort(NlsUtility.getDefaultLocale(), data, sortColumns);
- }
-
- /**
- * Convenience function to sort data for later call to {@link #createCodeRowArray(Object[][])} The sort indices are
- * 0-based.
- */
- public static void sort(Locale locale, Object[][] data, int... sortColumns) {
- if (data != null && data.length >= 2 && sortColumns != null && sortColumns.length > 0) {
- Arrays.sort(data, new ArrayComparator(locale, sortColumns));
- }
- }
-
- public static Object getColumn(Object matrix, int columnIndex) {
- int rowCount = Array.getLength(matrix);
- int colCount = 0;
- if (rowCount > 0) {
- colCount = Array.getLength(Array.get(matrix, 0));
- }
- Object column = Array.newInstance(matrix.getClass().getComponentType().getComponentType(), rowCount);
- if (rowCount > 0 && colCount > columnIndex) {
- for (int r = 0; r < rowCount; r++) {
- Array.set(column, r, Array.get(Array.get(matrix, r), columnIndex));
- }
- }
- return column;
- }
-
- @SuppressWarnings("unchecked")
- public static <T> T[] getColumn(T[][] matrix, int columnIndex) {
- int rowCount = Array.getLength(matrix);
- int colCount = 0;
- if (rowCount > 0) {
- colCount = Array.getLength(Array.get(matrix, 0));
- }
- T[] column = (T[]) Array.newInstance(matrix.getClass().getComponentType().getComponentType(), rowCount);
- if (rowCount > 0 && colCount > columnIndex) {
- for (int r = 0; r < rowCount; r++) {
- column[r] = (T) Array.get(Array.get(matrix, r), columnIndex);
- }
- }
- return column;
- }
-
- /**
- * lookup a row by its key (keyIndex=0) and return the value at valueIndex in
- * the same row
- */
- public static Object lookup(Object matrix, Object lookupKey, int valueIndex) {
- int keyIndex = 0;
- int rowCount = Array.getLength(matrix);
- int colCount = 0;
- if (rowCount > 0) {
- colCount = Array.getLength(Array.get(matrix, 0));
- }
- if (rowCount > 0 && colCount > valueIndex && colCount > keyIndex) {
- for (int r = 0; r < rowCount; r++) {
- Object row = Array.get(matrix, r);
- Object key = Array.get(row, keyIndex);
- if (key == lookupKey || (key != null && key.equals(lookupKey))) {
- return Array.get(row, valueIndex);
- }
- }
- }
- return null;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import java.lang.reflect.Array;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Locale;
+
+import org.eclipse.scout.commons.nls.NlsUtility;
+
+public final class MatrixUtility {
+
+ private MatrixUtility() {
+ }
+
+ /**
+ * If data is a single value: returns a matrix with 1 row and 2 columns
+ * [0..n/2][0..1] and the value is at [0][0] If data is an array: transforms a
+ * list with n values into a matrix with n/2 rows and 2 columns [0..n/2][0..1]
+ * always 2 values are used to create one matrix row If data is a matrix:
+ * transforms a matrix with n values into a matrix with n/2 rows and 2 columns
+ * [0..n/2][0..1] always 2 values are used to create one matrix traversal is
+ * row-wise
+ */
+ public static Object[][] toTupels(Object data) {
+ if (data == null) {
+ return new Object[0][0];
+ }
+ if (data.getClass().isArray()) {
+ if (data.getClass().getComponentType().isArray()) {
+ // matrix
+ if (Array.getLength(data) == 0) {
+ return new Object[0][0];
+ }
+ int rows = Array.getLength(data);
+ int cols = Array.getLength(Array.get(data, 0));
+ int count = rows * cols;
+ Object[][] matrix = new Object[count / 2][2];
+ for (int i = 0; i < matrix.length; i++) {
+ int r = (i * 2) / cols;
+ int c = (i * 2) % cols;
+ matrix[i][0] = Array.get(Array.get(data, r), c);
+ r = (i * 2 + 1) / cols;
+ c = (i * 2 + 1) % cols;
+ matrix[i][1] = Array.get(Array.get(data, r), c);
+ }
+ return matrix;
+ }
+ else {
+ // array
+ if (Array.getLength(data) == 0) {
+ return new Object[0][0];
+ }
+ int n = Array.getLength(data);
+ Object[][] matrix = new Object[n / 2][2];
+ for (int i = 0; i < matrix.length; i++) {
+ matrix[i][0] = Array.get(data, i * 2);
+ matrix[i][1] = Array.get(data, i * 2 + 1);
+ }
+ return matrix;
+ }
+ }
+ else {
+ // single value
+ Object[][] matrix = new Object[1][2];
+ matrix[0][1] = data;
+ return matrix;
+ }
+ }
+
+ /**
+ * union all lists into a matrix every list is interpreted as a matrix row
+ */
+ public static Object[][] union(Collection<Object>... collections) {
+ int rowCount = 0;
+ int colCount = 0;
+ for (Collection<Object> list : collections) {
+ rowCount++;
+ if (list != null) {
+ colCount = Math.max(colCount, list.size());
+ }
+ }
+ Object[][] matrix = new Object[rowCount][colCount];
+ int r = 0;
+ for (Collection<Object> list : collections) {
+ if (list != null) {
+ Object[] a = list.toArray();
+ for (int c = 0; c < colCount && c < a.length; c++) {
+ matrix[r][c] = a[c];
+ }
+ }
+ r++;
+ }
+ return matrix;
+ }
+
+ /**
+ * union all matrixes into a single matrix where the number of rows is the sum
+ * of rows of all matrixes every list is interpreted as a matrix row in sql:
+ * UNION ALL
+ */
+ public static Object[][] union(Object... matrixes) {
+ int rowCount = 0;
+ int colCount = 0;
+ for (Object m : matrixes) {
+ if (m != null) {
+ int r = Array.getLength(m);
+ rowCount += r;
+ if (r > 0) {
+ int c = Array.getLength(Array.get(m, 0));
+ colCount = Math.max(colCount, c);
+ }
+ }
+ }
+ Object[][] matrix = new Object[rowCount][colCount];
+ int r = 0;
+ for (Object m : matrixes) {
+ if (m != null) {
+ int mRows = Array.getLength(m);
+ if (mRows > 0) {
+ for (int i = 0; i < mRows; i++) {
+ Object rowArray = Array.get(m, i);
+ int mCols = Array.getLength(rowArray);
+ for (int c = 0; c < colCount && c < mCols; c++) {
+ matrix[r][c] = Array.get(rowArray, c);
+ }
+ r++;
+ }
+ }
+ }
+ }
+ return matrix;
+ }
+
+ public static Object[][] toMatrix(Object... values) {
+ if (values == null) {
+ return new Object[0][0];
+ }
+ Object[][] matrix = new Object[1][values.length];
+ matrix[0] = values;
+ return matrix;
+ }
+
+ public static Object[][] toMatrix(Object[]... rows) {
+ if (rows == null) {
+ return new Object[0][0];
+ }
+ Object[][][] matrices = new Object[rows.length][1][];
+ for (int i = 0; i < rows.length; i++) {
+ matrices[i][0] = rows[i];
+ }
+ return union((Object[]) matrices);
+ }
+
+ public static Object[][] toMatrix(Collection<Object>... rows) {
+ return union(rows);
+ }
+
+ public static String toRange(int row, int col) {
+ return CellRange.toRangeString(row, col);
+ }
+
+ public static String toRange(int row1, int col1, int row2, int col2) {
+ return CellRange.toRangeString(row1, col1, row2, col2);
+ }
+
+ public static int rowCount(String range) {
+ return new CellRange(range).getRowCount();
+ }
+
+ public static int columnCount(String range) {
+ return new CellRange(range).getColumnCount();
+ }
+
+ public static int firstRow(String range) {
+ return new CellRange(range).getFirstRow();
+ }
+
+ public static int lastRow(String range) {
+ return new CellRange(range).getLastRow();
+ }
+
+ public static int firstColumn(String range) {
+ return new CellRange(range).getFirstColumn();
+ }
+
+ public static int lastColumn(String range) {
+ return new CellRange(range).getLastColumn();
+ }
+
+ @SuppressWarnings("unchecked")
+ public static <T> T getColumn(Object matrix, int columnIndex, Class<T> arrayType) {
+ int rowCount = Array.getLength(matrix);
+ int colCount = 0;
+ if (rowCount > 0) {
+ colCount = Array.getLength(Array.get(matrix, 0));
+ }
+ T column = (T) Array.newInstance(arrayType.getComponentType(), rowCount);
+ if (rowCount > 0 && colCount > columnIndex) {
+ for (int r = 0; r < rowCount; r++) {
+ Array.set(column, r, TypeCastUtility.castValue(Array.get(Array.get(matrix, r), columnIndex), arrayType.getComponentType()));
+ }
+ }
+ return column;
+ }
+
+ /**
+ * Convenience function to sort data for later call to {@link #createCodeRowArray(Object[][])} The sort indices are
+ * 0-based.
+ * <p>
+ * <b>It is recommended to use {@link #sort(Locale, Object[][], int...)} with the specific {@link Locale}</b>
+ */
+ public static void sort(Object[][] data, int... sortColumns) {
+ sort(NlsUtility.getDefaultLocale(), data, sortColumns);
+ }
+
+ /**
+ * Convenience function to sort data for later call to {@link #createCodeRowArray(Object[][])} The sort indices are
+ * 0-based.
+ */
+ public static void sort(Locale locale, Object[][] data, int... sortColumns) {
+ if (data != null && data.length >= 2 && sortColumns != null && sortColumns.length > 0) {
+ Arrays.sort(data, new ArrayComparator(locale, sortColumns));
+ }
+ }
+
+ public static Object getColumn(Object matrix, int columnIndex) {
+ int rowCount = Array.getLength(matrix);
+ int colCount = 0;
+ if (rowCount > 0) {
+ colCount = Array.getLength(Array.get(matrix, 0));
+ }
+ Object column = Array.newInstance(matrix.getClass().getComponentType().getComponentType(), rowCount);
+ if (rowCount > 0 && colCount > columnIndex) {
+ for (int r = 0; r < rowCount; r++) {
+ Array.set(column, r, Array.get(Array.get(matrix, r), columnIndex));
+ }
+ }
+ return column;
+ }
+
+ @SuppressWarnings("unchecked")
+ public static <T> T[] getColumn(T[][] matrix, int columnIndex) {
+ int rowCount = Array.getLength(matrix);
+ int colCount = 0;
+ if (rowCount > 0) {
+ colCount = Array.getLength(Array.get(matrix, 0));
+ }
+ T[] column = (T[]) Array.newInstance(matrix.getClass().getComponentType().getComponentType(), rowCount);
+ if (rowCount > 0 && colCount > columnIndex) {
+ for (int r = 0; r < rowCount; r++) {
+ column[r] = (T) Array.get(Array.get(matrix, r), columnIndex);
+ }
+ }
+ return column;
+ }
+
+ /**
+ * lookup a row by its key (keyIndex=0) and return the value at valueIndex in
+ * the same row
+ */
+ public static Object lookup(Object matrix, Object lookupKey, int valueIndex) {
+ int keyIndex = 0;
+ int rowCount = Array.getLength(matrix);
+ int colCount = 0;
+ if (rowCount > 0) {
+ colCount = Array.getLength(Array.get(matrix, 0));
+ }
+ if (rowCount > 0 && colCount > valueIndex && colCount > keyIndex) {
+ for (int r = 0; r < rowCount; r++) {
+ Object row = Array.get(matrix, r);
+ Object key = Array.get(row, keyIndex);
+ if (key == lookupKey || (key != null && key.equals(lookupKey))) {
+ return Array.get(row, valueIndex);
+ }
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/NumberUtility.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/NumberUtility.java
index 50fd70913a..e847222b72 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/NumberUtility.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/NumberUtility.java
@@ -1,325 +1,325 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.text.NumberFormat;
-import java.util.Arrays;
-import java.util.Locale;
-import java.util.Random;
-
-public final class NumberUtility {
- private static final Random RANDOMIZER = new Random();
-
- private NumberUtility() {
- }
-
- public static Double toDouble(Number n) {
- if (n == null) {
- return null;
- }
- if (n instanceof Float) {
- // rounding error workaround
- return new Double(n.toString());
- }
- else {
- return new Double(n.doubleValue());
- }
- }
-
- public static Integer toInteger(Number n) {
- if (n == null) {
- return null;
- }
- return n.intValue();
- }
-
- public static Long toLong(Number n) {
- if (n == null) {
- return null;
- }
- return n.longValue();
- }
-
- public static BigDecimal toBigDecimal(Double d) {
- if (d == null) {
- return null;
- }
- return BigDecimal.valueOf(d);
- }
-
- public static BigInteger toBigInteger(Long l) {
- if (l == null) {
- return null;
- }
- return BigInteger.valueOf(l);
- }
-
- public static double avg(double... a) {
- if (a == null) {
- return 0;
- }
- long count = a.length;
- double sum = sum(a);
- if (count > 0) {
- return sum / count;
- }
- else {
- return 0;
- }
- }
-
- public static double median(double... a) {
- if (a == null) {
- return 0;
- }
- int count = a.length;
- double[] b = new double[a.length];
- System.arraycopy(a, 0, b, 0, count);
- Arrays.sort(b);
- if (count > 0) {
- return b[count / 2];
- }
- else {
- return 0;
- }
- }
-
- public static boolean hasBit(int value, int index) {
- return getBit(value, index);
- }
-
- public static boolean getBit(int value, int index) {
- return (value & (1 << index)) != 0;
- }
-
- public static double sum(double... a) {
- if (a == null) {
- return 0;
- }
- if (a.length == 0) {
- return 0;
- }
- double sum = 0;
- for (double d : a) {
- sum += d;
- }
- return sum;
- }
-
- public static long sum(long... a) {
- if (a == null) {
- return 0;
- }
- if (a.length == 0) {
- return 0;
- }
- long sum = 0;
- for (long d : a) {
- sum += d;
- }
- return sum;
- }
-
- public static double min(double... a) {
- if (a == null) {
- return 0;
- }
- if (a.length == 0) {
- return 0;
- }
- double min = Double.MAX_VALUE;
- for (double d : a) {
- min = Math.min(min, d);
- }
- return min;
- }
-
- public static double max(double... a) {
- if (a == null) {
- return 0;
- }
- if (a.length == 0) {
- return 0;
- }
- double max = Double.MIN_VALUE;
- for (double d : a) {
- max = Math.max(max, d);
- }
- return max;
- }
-
- public static long randomLong() {
- return RANDOMIZER.nextLong();
- }
-
- public static long randomInt() {
- return RANDOMIZER.nextInt();
- }
-
- public static long randomInt(int size) {
- return RANDOMIZER.nextInt(size);
- }
-
- public static double randomDouble() {
- return RANDOMIZER.nextDouble();
- }
-
- /**
- * rounding with big decimal precision
- */
- public static Number roundBigDecimal(Number value, double precision) {
- if (value != null) {
- BigDecimal val = value instanceof BigDecimal ? (BigDecimal) value : new BigDecimal(value.toString());
- BigDecimal prec = BigDecimal.valueOf(precision);
- return val.divide(prec, BigDecimal.ROUND_HALF_EVEN).setScale(0, BigDecimal.ROUND_HALF_EVEN).multiply(prec);
- }
- return null;
- }
-
- /**
- * rounding with decimal precision
- */
- public static double round(double value, double precision) {
- return Math.round(value / precision) * precision;
- }
-
- public static int setBit(int value, int index) {
- return value | (1 << index);
- }
-
- public static int clearBit(int value, int index) {
- return value & (value ^ (1 << index));
- }
-
- public static Number sign(Number n) {
- if (n == null) {
- return new Integer(0);
- }
- double d = n.doubleValue();
- if (d < 0) {
- return new Integer(-1);
- }
- if (d > 0) {
- return new Integer(+1);
- }
- return new Integer(0);
- }
-
- public static int parseInt(String s) {
- if (s == null) {
- return 0;
- }
- return TypeCastUtility.castValue(s, Integer.class);
- }
-
- public static long parseLong(String s) {
- if (s == null) {
- return 0;
- }
- return TypeCastUtility.castValue(s, Long.class);
- }
-
- public static double parseDouble(String s) {
- if (s == null) {
- return 0;
- }
- return TypeCastUtility.castValue(s, Double.class);
- }
-
- public static String format(Number n) {
- if (n == null) {
- return "";
- }
- Locale loc = LocaleThreadLocal.get();
- return NumberFormat.getInstance(loc).format(n);
- }
-
- public static <T> T nvl(T value, T valueWhenNull) {
- if (value != null) {
- return value;
- }
- else {
- return valueWhenNull;
- }
- }
-
- public static int nvl(Integer value, Number valueWhenNull) {
- if (value != null) {
- return value;
- }
- else {
- return valueWhenNull.intValue();
- }
- }
-
- public static long nvl(Long value, Number valueWhenNull) {
- if (value != null) {
- return value;
- }
- else {
- return valueWhenNull.longValue();
- }
- }
-
- /**
- * trunc a floating number to integer without rounding it
- */
- public static double trunc(Number n) {
- if (n == null) {
- return 0;
- }
- return Math.floor(n.doubleValue());
- }
-
- public static int longToInt(Long l) {
- if (l != null) {
- if (new Long(Integer.MAX_VALUE).compareTo(l) == -1) {
- return Integer.MAX_VALUE;
- }
- else if (new Long(Integer.MIN_VALUE).compareTo(l) == 1) {
- return Integer.MIN_VALUE;
- }
- return l.intValue();
- }
- return 0;
- }
-
- public static BigDecimal getBigDecimalValue(Object o) {
- if (o != null && o.toString().length() > 0) {
- return new BigDecimal(o.toString());
- }
- else {
- return null;
- }
- }
-
- /**
- * Divides two double values, NPE save.
- *
- * @param numerator
- * @param denominator
- * @return null if the numerator is null or the denominator is null or 0.0.
- * Else it returns the devision result.
- */
- public static Double divide(Double numerator, Double denominator) {
- if (numerator == null || denominator == null || denominator.equals(0.0)) {
- return null;
- }
- else if (numerator.equals(0.0)) {
- return 0d;
- }
- else {
- return numerator / denominator;
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.text.NumberFormat;
+import java.util.Arrays;
+import java.util.Locale;
+import java.util.Random;
+
+public final class NumberUtility {
+ private static final Random RANDOMIZER = new Random();
+
+ private NumberUtility() {
+ }
+
+ public static Double toDouble(Number n) {
+ if (n == null) {
+ return null;
+ }
+ if (n instanceof Float) {
+ // rounding error workaround
+ return new Double(n.toString());
+ }
+ else {
+ return new Double(n.doubleValue());
+ }
+ }
+
+ public static Integer toInteger(Number n) {
+ if (n == null) {
+ return null;
+ }
+ return n.intValue();
+ }
+
+ public static Long toLong(Number n) {
+ if (n == null) {
+ return null;
+ }
+ return n.longValue();
+ }
+
+ public static BigDecimal toBigDecimal(Double d) {
+ if (d == null) {
+ return null;
+ }
+ return BigDecimal.valueOf(d);
+ }
+
+ public static BigInteger toBigInteger(Long l) {
+ if (l == null) {
+ return null;
+ }
+ return BigInteger.valueOf(l);
+ }
+
+ public static double avg(double... a) {
+ if (a == null) {
+ return 0;
+ }
+ long count = a.length;
+ double sum = sum(a);
+ if (count > 0) {
+ return sum / count;
+ }
+ else {
+ return 0;
+ }
+ }
+
+ public static double median(double... a) {
+ if (a == null) {
+ return 0;
+ }
+ int count = a.length;
+ double[] b = new double[a.length];
+ System.arraycopy(a, 0, b, 0, count);
+ Arrays.sort(b);
+ if (count > 0) {
+ return b[count / 2];
+ }
+ else {
+ return 0;
+ }
+ }
+
+ public static boolean hasBit(int value, int index) {
+ return getBit(value, index);
+ }
+
+ public static boolean getBit(int value, int index) {
+ return (value & (1 << index)) != 0;
+ }
+
+ public static double sum(double... a) {
+ if (a == null) {
+ return 0;
+ }
+ if (a.length == 0) {
+ return 0;
+ }
+ double sum = 0;
+ for (double d : a) {
+ sum += d;
+ }
+ return sum;
+ }
+
+ public static long sum(long... a) {
+ if (a == null) {
+ return 0;
+ }
+ if (a.length == 0) {
+ return 0;
+ }
+ long sum = 0;
+ for (long d : a) {
+ sum += d;
+ }
+ return sum;
+ }
+
+ public static double min(double... a) {
+ if (a == null) {
+ return 0;
+ }
+ if (a.length == 0) {
+ return 0;
+ }
+ double min = Double.MAX_VALUE;
+ for (double d : a) {
+ min = Math.min(min, d);
+ }
+ return min;
+ }
+
+ public static double max(double... a) {
+ if (a == null) {
+ return 0;
+ }
+ if (a.length == 0) {
+ return 0;
+ }
+ double max = Double.MIN_VALUE;
+ for (double d : a) {
+ max = Math.max(max, d);
+ }
+ return max;
+ }
+
+ public static long randomLong() {
+ return RANDOMIZER.nextLong();
+ }
+
+ public static long randomInt() {
+ return RANDOMIZER.nextInt();
+ }
+
+ public static long randomInt(int size) {
+ return RANDOMIZER.nextInt(size);
+ }
+
+ public static double randomDouble() {
+ return RANDOMIZER.nextDouble();
+ }
+
+ /**
+ * rounding with big decimal precision
+ */
+ public static Number roundBigDecimal(Number value, double precision) {
+ if (value != null) {
+ BigDecimal val = value instanceof BigDecimal ? (BigDecimal) value : new BigDecimal(value.toString());
+ BigDecimal prec = BigDecimal.valueOf(precision);
+ return val.divide(prec, BigDecimal.ROUND_HALF_EVEN).setScale(0, BigDecimal.ROUND_HALF_EVEN).multiply(prec);
+ }
+ return null;
+ }
+
+ /**
+ * rounding with decimal precision
+ */
+ public static double round(double value, double precision) {
+ return Math.round(value / precision) * precision;
+ }
+
+ public static int setBit(int value, int index) {
+ return value | (1 << index);
+ }
+
+ public static int clearBit(int value, int index) {
+ return value & (value ^ (1 << index));
+ }
+
+ public static Number sign(Number n) {
+ if (n == null) {
+ return new Integer(0);
+ }
+ double d = n.doubleValue();
+ if (d < 0) {
+ return new Integer(-1);
+ }
+ if (d > 0) {
+ return new Integer(+1);
+ }
+ return new Integer(0);
+ }
+
+ public static int parseInt(String s) {
+ if (s == null) {
+ return 0;
+ }
+ return TypeCastUtility.castValue(s, Integer.class);
+ }
+
+ public static long parseLong(String s) {
+ if (s == null) {
+ return 0;
+ }
+ return TypeCastUtility.castValue(s, Long.class);
+ }
+
+ public static double parseDouble(String s) {
+ if (s == null) {
+ return 0;
+ }
+ return TypeCastUtility.castValue(s, Double.class);
+ }
+
+ public static String format(Number n) {
+ if (n == null) {
+ return "";
+ }
+ Locale loc = LocaleThreadLocal.get();
+ return NumberFormat.getInstance(loc).format(n);
+ }
+
+ public static <T> T nvl(T value, T valueWhenNull) {
+ if (value != null) {
+ return value;
+ }
+ else {
+ return valueWhenNull;
+ }
+ }
+
+ public static int nvl(Integer value, Number valueWhenNull) {
+ if (value != null) {
+ return value;
+ }
+ else {
+ return valueWhenNull.intValue();
+ }
+ }
+
+ public static long nvl(Long value, Number valueWhenNull) {
+ if (value != null) {
+ return value;
+ }
+ else {
+ return valueWhenNull.longValue();
+ }
+ }
+
+ /**
+ * trunc a floating number to integer without rounding it
+ */
+ public static double trunc(Number n) {
+ if (n == null) {
+ return 0;
+ }
+ return Math.floor(n.doubleValue());
+ }
+
+ public static int longToInt(Long l) {
+ if (l != null) {
+ if (new Long(Integer.MAX_VALUE).compareTo(l) == -1) {
+ return Integer.MAX_VALUE;
+ }
+ else if (new Long(Integer.MIN_VALUE).compareTo(l) == 1) {
+ return Integer.MIN_VALUE;
+ }
+ return l.intValue();
+ }
+ return 0;
+ }
+
+ public static BigDecimal getBigDecimalValue(Object o) {
+ if (o != null && o.toString().length() > 0) {
+ return new BigDecimal(o.toString());
+ }
+ else {
+ return null;
+ }
+ }
+
+ /**
+ * Divides two double values, NPE save.
+ *
+ * @param numerator
+ * @param denominator
+ * @return null if the numerator is null or the denominator is null or 0.0.
+ * Else it returns the devision result.
+ */
+ public static Double divide(Double numerator, Double denominator) {
+ if (numerator == null || denominator == null || denominator.equals(0.0)) {
+ return null;
+ }
+ else if (numerator.equals(0.0)) {
+ return 0d;
+ }
+ else {
+ return numerator / denominator;
+ }
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/OptimisticLock.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/OptimisticLock.java
index 0aa1c2b409..03900afad4 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/OptimisticLock.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/OptimisticLock.java
@@ -1,57 +1,57 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-
-/**
- * Optimistic locking with one accepted writer in critical section usage for
- * writers with access check is as follows: try{ if(lock.acquire()){ ... } }
- * finally{ lock.release(); } usage for writers with no access check is as
- * follows: try{ lock.acquire() ... } finally{ lock.release(); } usage for
- * tester is as follows: if(lock.isAcquired()){ ... } or if(lock.isReleased()){
- * ... }
- */
-public class OptimisticLock {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(OptimisticLock.class);
- private int m_lockCount = 0;
-
- /**
- * @return true if lock was acquired as first monitor
- */
- public synchronized boolean acquire() {
- m_lockCount++;
- if (m_lockCount == 1) {
- // this is the first
- return true;
- }
- else {
- if (m_lockCount > 10) {
- LOG.warn("potential programming problem; lock was 10 times acquired and not released", new Exception("origin"));
- }
- return false;
- }
- }
-
- public void release() {
- m_lockCount--;
- }
-
- public boolean isAcquired() {
- return m_lockCount > 0;
- }
-
- public boolean isReleased() {
- return m_lockCount <= 0;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+
+/**
+ * Optimistic locking with one accepted writer in critical section usage for
+ * writers with access check is as follows: try{ if(lock.acquire()){ ... } }
+ * finally{ lock.release(); } usage for writers with no access check is as
+ * follows: try{ lock.acquire() ... } finally{ lock.release(); } usage for
+ * tester is as follows: if(lock.isAcquired()){ ... } or if(lock.isReleased()){
+ * ... }
+ */
+public class OptimisticLock {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(OptimisticLock.class);
+ private int m_lockCount = 0;
+
+ /**
+ * @return true if lock was acquired as first monitor
+ */
+ public synchronized boolean acquire() {
+ m_lockCount++;
+ if (m_lockCount == 1) {
+ // this is the first
+ return true;
+ }
+ else {
+ if (m_lockCount > 10) {
+ LOG.warn("potential programming problem; lock was 10 times acquired and not released", new Exception("origin"));
+ }
+ return false;
+ }
+ }
+
+ public void release() {
+ m_lockCount--;
+ }
+
+ public boolean isAcquired() {
+ return m_lockCount > 0;
+ }
+
+ public boolean isReleased() {
+ return m_lockCount <= 0;
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/PublicKeyUtility.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/PublicKeyUtility.java
index 91ac1289b6..b499801eee 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/PublicKeyUtility.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/PublicKeyUtility.java
@@ -1,126 +1,126 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import java.security.InvalidKeyException;
-import java.security.KeyFactory;
-import java.security.KeyPair;
-import java.security.KeyPairGenerator;
-import java.security.NoSuchAlgorithmException;
-import java.security.PrivateKey;
-import java.security.PublicKey;
-import java.security.Signature;
-import java.security.SignatureException;
-import java.security.spec.InvalidKeySpecException;
-import java.security.spec.PKCS8EncodedKeySpec;
-import java.security.spec.X509EncodedKeySpec;
-
-public final class PublicKeyUtility {
-
- private PublicKeyUtility() {
- }
-
- /**
- * @param keyAlgorithm
- * default is "DSA"
- * @param bitSize
- * default is -1 to create a key pair for asymmmetric encryption.
- * @return two Strings, the public key (index 0) and the private key (index 1)
- * @throws NoSuchAlgorithmException
- */
- public static byte[][]/* public key/private key */createKeyPair(String keyAlgorithm, int bitSize) throws NoSuchAlgorithmException {
- if (keyAlgorithm == null) {
- keyAlgorithm = "DSA";
- }
- KeyPairGenerator instance = KeyPairGenerator.getInstance(keyAlgorithm);
- if (bitSize > 0) {
- instance.initialize(bitSize);
- }
- KeyPair pair = instance.generateKeyPair();
- PrivateKey privKey = pair.getPrivate();
- PublicKey pubKey = pair.getPublic();
- byte[][] a = new byte[2][];
- a[0] = pubKey.getEncoded();
- a[1] = privKey.getEncoded();
- return a;
- }
-
- /**
- * @param keyAlgorithm
- * default is DSA
- * @param signAlgorithm
- * default is SHA1withDSA
- * @return data signed with the private key
- * @throws NoSuchAlgorithmException
- * @throws InvalidKeySpecException
- * @throws InvalidKeyException
- * @throws SignatureException
- */
- public static byte[]/* Signature */sign(byte[] data, byte[] privateKey, String keyAlgorithm, String signAlgorithm) throws NoSuchAlgorithmException, InvalidKeySpecException, InvalidKeyException, SignatureException {
- if (keyAlgorithm == null) {
- keyAlgorithm = "DSA";
- }
- if (signAlgorithm == null) {
- signAlgorithm = "SHA1withDSA";
- }
-
- PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(privateKey);
- KeyFactory keyFactory = KeyFactory.getInstance(keyAlgorithm);
- PrivateKey privKey = keyFactory.generatePrivate(keySpec);
-
- Signature sign = Signature.getInstance(signAlgorithm);
- sign.initSign(privKey);
- sign.update(data);
-
- byte[] signatureData = sign.sign();
- return signatureData;
- }
-
- /**
- * @param data
- * to check on
- * @param publicKey
- * to check with
- * @param signatureData
- * signature to check against
- * @param keyAlgorithm
- * default is DSA
- * @param signAlgorithm
- * default is SHA1withDSA
- * @return true if the verification of the signature on data with the public
- * key succeeds.
- * @throws NoSuchAlgorithmException
- * @throws InvalidKeyException
- * @throws SignatureException
- * @throws InvalidKeySpecException
- */
- public static boolean verify(byte[] data, byte[] publicKey, byte[] signatureData, String keyAlgorithm, String signAlgorithm) throws NoSuchAlgorithmException, InvalidKeyException, SignatureException, InvalidKeySpecException {
- if (keyAlgorithm == null) {
- keyAlgorithm = "DSA";
- }
- if (signAlgorithm == null) {
- signAlgorithm = "SHA1withDSA";
- }
- if (data == null || signatureData == null) {
- return false;
- }
-
- X509EncodedKeySpec keySpec = new X509EncodedKeySpec(publicKey);
- KeyFactory keyFactory = KeyFactory.getInstance(keyAlgorithm);
- PublicKey pubKey = keyFactory.generatePublic(keySpec);
-
- Signature sign = Signature.getInstance(signAlgorithm);
- sign.initVerify(pubKey);
- sign.update(data);
- boolean ok = sign.verify(signatureData);
- return ok;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import java.security.InvalidKeyException;
+import java.security.KeyFactory;
+import java.security.KeyPair;
+import java.security.KeyPairGenerator;
+import java.security.NoSuchAlgorithmException;
+import java.security.PrivateKey;
+import java.security.PublicKey;
+import java.security.Signature;
+import java.security.SignatureException;
+import java.security.spec.InvalidKeySpecException;
+import java.security.spec.PKCS8EncodedKeySpec;
+import java.security.spec.X509EncodedKeySpec;
+
+public final class PublicKeyUtility {
+
+ private PublicKeyUtility() {
+ }
+
+ /**
+ * @param keyAlgorithm
+ * default is "DSA"
+ * @param bitSize
+ * default is -1 to create a key pair for asymmmetric encryption.
+ * @return two Strings, the public key (index 0) and the private key (index 1)
+ * @throws NoSuchAlgorithmException
+ */
+ public static byte[][]/* public key/private key */createKeyPair(String keyAlgorithm, int bitSize) throws NoSuchAlgorithmException {
+ if (keyAlgorithm == null) {
+ keyAlgorithm = "DSA";
+ }
+ KeyPairGenerator instance = KeyPairGenerator.getInstance(keyAlgorithm);
+ if (bitSize > 0) {
+ instance.initialize(bitSize);
+ }
+ KeyPair pair = instance.generateKeyPair();
+ PrivateKey privKey = pair.getPrivate();
+ PublicKey pubKey = pair.getPublic();
+ byte[][] a = new byte[2][];
+ a[0] = pubKey.getEncoded();
+ a[1] = privKey.getEncoded();
+ return a;
+ }
+
+ /**
+ * @param keyAlgorithm
+ * default is DSA
+ * @param signAlgorithm
+ * default is SHA1withDSA
+ * @return data signed with the private key
+ * @throws NoSuchAlgorithmException
+ * @throws InvalidKeySpecException
+ * @throws InvalidKeyException
+ * @throws SignatureException
+ */
+ public static byte[]/* Signature */sign(byte[] data, byte[] privateKey, String keyAlgorithm, String signAlgorithm) throws NoSuchAlgorithmException, InvalidKeySpecException, InvalidKeyException, SignatureException {
+ if (keyAlgorithm == null) {
+ keyAlgorithm = "DSA";
+ }
+ if (signAlgorithm == null) {
+ signAlgorithm = "SHA1withDSA";
+ }
+
+ PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(privateKey);
+ KeyFactory keyFactory = KeyFactory.getInstance(keyAlgorithm);
+ PrivateKey privKey = keyFactory.generatePrivate(keySpec);
+
+ Signature sign = Signature.getInstance(signAlgorithm);
+ sign.initSign(privKey);
+ sign.update(data);
+
+ byte[] signatureData = sign.sign();
+ return signatureData;
+ }
+
+ /**
+ * @param data
+ * to check on
+ * @param publicKey
+ * to check with
+ * @param signatureData
+ * signature to check against
+ * @param keyAlgorithm
+ * default is DSA
+ * @param signAlgorithm
+ * default is SHA1withDSA
+ * @return true if the verification of the signature on data with the public
+ * key succeeds.
+ * @throws NoSuchAlgorithmException
+ * @throws InvalidKeyException
+ * @throws SignatureException
+ * @throws InvalidKeySpecException
+ */
+ public static boolean verify(byte[] data, byte[] publicKey, byte[] signatureData, String keyAlgorithm, String signAlgorithm) throws NoSuchAlgorithmException, InvalidKeyException, SignatureException, InvalidKeySpecException {
+ if (keyAlgorithm == null) {
+ keyAlgorithm = "DSA";
+ }
+ if (signAlgorithm == null) {
+ signAlgorithm = "SHA1withDSA";
+ }
+ if (data == null || signatureData == null) {
+ return false;
+ }
+
+ X509EncodedKeySpec keySpec = new X509EncodedKeySpec(publicKey);
+ KeyFactory keyFactory = KeyFactory.getInstance(keyAlgorithm);
+ PublicKey pubKey = keyFactory.generatePublic(keySpec);
+
+ Signature sign = Signature.getInstance(signAlgorithm);
+ sign.initVerify(pubKey);
+ sign.update(data);
+ boolean ok = sign.verify(signatureData);
+ return ok;
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/RFCWrapperPart.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/RFCWrapperPart.java
index 62b98b0bd5..2ff6a8066b 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/RFCWrapperPart.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/RFCWrapperPart.java
@@ -1,162 +1,162 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.Enumeration;
-
-import javax.activation.DataHandler;
-import javax.mail.MessagingException;
-import javax.mail.Multipart;
-import javax.mail.Part;
-
-public class RFCWrapperPart implements Part {
- private final Part m_rfcPart;
- private final String m_fileName;
-
- public RFCWrapperPart(Part part, String fileName) {
- super();
- if (part != null && fileName != null && StringUtility.hasText(fileName)) {
- m_rfcPart = part;
- m_fileName = fileName;
- }
- else {
- throw new NullPointerException("RFC-Part and fileName should not be null or empty.");
- }
- }
-
- @Override
- public String getFileName() throws MessagingException {
- return m_fileName;
- }
-
- @Override
- public void addHeader(String header_name, String header_value) throws MessagingException {
- m_rfcPart.addHeader(header_name, header_value);
- }
-
- @Override
- public Enumeration getAllHeaders() throws MessagingException {
- return m_rfcPart.getAllHeaders();
- }
-
- @Override
- public Object getContent() throws IOException, MessagingException {
- return m_rfcPart.getContent();
- }
-
- @Override
- public String getContentType() throws MessagingException {
- return m_rfcPart.getContentType();
- }
-
- @Override
- public DataHandler getDataHandler() throws MessagingException {
- return m_rfcPart.getDataHandler();
- }
-
- @Override
- public String getDescription() throws MessagingException {
- return m_rfcPart.getDescription();
- }
-
- @Override
- public String getDisposition() throws MessagingException {
- return m_rfcPart.getDisposition();
- }
-
- @Override
- public String[] getHeader(String header_name) throws MessagingException {
- return m_rfcPart.getHeader(header_name);
- }
-
- @Override
- public InputStream getInputStream() throws IOException, MessagingException {
- return m_rfcPart.getInputStream();
- }
-
- @Override
- public int getLineCount() throws MessagingException {
- return m_rfcPart.getLineCount();
- }
-
- @Override
- public Enumeration getMatchingHeaders(String[] header_names) throws MessagingException {
- return m_rfcPart.getMatchingHeaders(header_names);
- }
-
- @Override
- public Enumeration getNonMatchingHeaders(String[] header_names) throws MessagingException {
- return m_rfcPart.getNonMatchingHeaders(header_names);
- }
-
- @Override
- public int getSize() throws MessagingException {
- return m_rfcPart.getSize();
- }
-
- @Override
- public boolean isMimeType(String mimeType) throws MessagingException {
- return m_rfcPart.isMimeType(mimeType);
- }
-
- @Override
- public void removeHeader(String header_name) throws MessagingException {
- m_rfcPart.removeHeader(header_name);
- }
-
- @Override
- public void setContent(Multipart mp) throws MessagingException {
- m_rfcPart.setContent(mp);
- }
-
- @Override
- public void setContent(Object obj, String type) throws MessagingException {
- m_rfcPart.setContent(obj, type);
- }
-
- @Override
- public void setDataHandler(DataHandler dh) throws MessagingException {
- m_rfcPart.setDataHandler(dh);
- }
-
- @Override
- public void setDescription(String description) throws MessagingException {
- m_rfcPart.setDescription(description);
- }
-
- @Override
- public void setDisposition(String disposition) throws MessagingException {
- m_rfcPart.setDisposition(disposition);
- }
-
- @Override
- public void setFileName(String filename) throws MessagingException {
- m_rfcPart.setFileName(filename);
- }
-
- @Override
- public void setHeader(String header_name, String header_value) throws MessagingException {
- m_rfcPart.setHeader(header_name, header_value);
- }
-
- @Override
- public void setText(String text) throws MessagingException {
- m_rfcPart.setText(text);
- }
-
- @Override
- public void writeTo(OutputStream os) throws IOException, MessagingException {
- m_rfcPart.writeTo(os);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.Enumeration;
+
+import javax.activation.DataHandler;
+import javax.mail.MessagingException;
+import javax.mail.Multipart;
+import javax.mail.Part;
+
+public class RFCWrapperPart implements Part {
+ private final Part m_rfcPart;
+ private final String m_fileName;
+
+ public RFCWrapperPart(Part part, String fileName) {
+ super();
+ if (part != null && fileName != null && StringUtility.hasText(fileName)) {
+ m_rfcPart = part;
+ m_fileName = fileName;
+ }
+ else {
+ throw new NullPointerException("RFC-Part and fileName should not be null or empty.");
+ }
+ }
+
+ @Override
+ public String getFileName() throws MessagingException {
+ return m_fileName;
+ }
+
+ @Override
+ public void addHeader(String header_name, String header_value) throws MessagingException {
+ m_rfcPart.addHeader(header_name, header_value);
+ }
+
+ @Override
+ public Enumeration getAllHeaders() throws MessagingException {
+ return m_rfcPart.getAllHeaders();
+ }
+
+ @Override
+ public Object getContent() throws IOException, MessagingException {
+ return m_rfcPart.getContent();
+ }
+
+ @Override
+ public String getContentType() throws MessagingException {
+ return m_rfcPart.getContentType();
+ }
+
+ @Override
+ public DataHandler getDataHandler() throws MessagingException {
+ return m_rfcPart.getDataHandler();
+ }
+
+ @Override
+ public String getDescription() throws MessagingException {
+ return m_rfcPart.getDescription();
+ }
+
+ @Override
+ public String getDisposition() throws MessagingException {
+ return m_rfcPart.getDisposition();
+ }
+
+ @Override
+ public String[] getHeader(String header_name) throws MessagingException {
+ return m_rfcPart.getHeader(header_name);
+ }
+
+ @Override
+ public InputStream getInputStream() throws IOException, MessagingException {
+ return m_rfcPart.getInputStream();
+ }
+
+ @Override
+ public int getLineCount() throws MessagingException {
+ return m_rfcPart.getLineCount();
+ }
+
+ @Override
+ public Enumeration getMatchingHeaders(String[] header_names) throws MessagingException {
+ return m_rfcPart.getMatchingHeaders(header_names);
+ }
+
+ @Override
+ public Enumeration getNonMatchingHeaders(String[] header_names) throws MessagingException {
+ return m_rfcPart.getNonMatchingHeaders(header_names);
+ }
+
+ @Override
+ public int getSize() throws MessagingException {
+ return m_rfcPart.getSize();
+ }
+
+ @Override
+ public boolean isMimeType(String mimeType) throws MessagingException {
+ return m_rfcPart.isMimeType(mimeType);
+ }
+
+ @Override
+ public void removeHeader(String header_name) throws MessagingException {
+ m_rfcPart.removeHeader(header_name);
+ }
+
+ @Override
+ public void setContent(Multipart mp) throws MessagingException {
+ m_rfcPart.setContent(mp);
+ }
+
+ @Override
+ public void setContent(Object obj, String type) throws MessagingException {
+ m_rfcPart.setContent(obj, type);
+ }
+
+ @Override
+ public void setDataHandler(DataHandler dh) throws MessagingException {
+ m_rfcPart.setDataHandler(dh);
+ }
+
+ @Override
+ public void setDescription(String description) throws MessagingException {
+ m_rfcPart.setDescription(description);
+ }
+
+ @Override
+ public void setDisposition(String disposition) throws MessagingException {
+ m_rfcPart.setDisposition(disposition);
+ }
+
+ @Override
+ public void setFileName(String filename) throws MessagingException {
+ m_rfcPart.setFileName(filename);
+ }
+
+ @Override
+ public void setHeader(String header_name, String header_value) throws MessagingException {
+ m_rfcPart.setHeader(header_name, header_value);
+ }
+
+ @Override
+ public void setText(String text) throws MessagingException {
+ m_rfcPart.setText(text);
+ }
+
+ @Override
+ public void writeTo(OutputStream os) throws IOException, MessagingException {
+ m_rfcPart.writeTo(os);
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/ReflectionUtility.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/ReflectionUtility.java
index 80ab7bfcc2..3862fa4594 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/ReflectionUtility.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/ReflectionUtility.java
@@ -1,41 +1,41 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-
-/**
- * Reflection Utility to change final modifiers on fields
- */
-public class ReflectionUtility {
-
- private ReflectionUtility() {
- }
-
- public static void removeFinalFlagOnField(Field f) throws Exception {
- Field reflectedModifier = Field.class.getDeclaredField("modifiers");
- reflectedModifier.setAccessible(true);
- int modifiers = (Integer) reflectedModifier.get(f);
- modifiers = modifiers & ~Modifier.FINAL;
- reflectedModifier.set(f, modifiers);
- reflectedModifier.setAccessible(false);
- }
-
- public static void setFinalFlagOnField(Field f) throws Exception {
- Field reflectedModifier = Field.class.getDeclaredField("modifiers");
- reflectedModifier.setAccessible(true);
- int modifiers = (Integer) reflectedModifier.get(f);
- modifiers = modifiers | Modifier.FINAL;
- reflectedModifier.set(f, modifiers);
- reflectedModifier.setAccessible(false);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+
+/**
+ * Reflection Utility to change final modifiers on fields
+ */
+public class ReflectionUtility {
+
+ private ReflectionUtility() {
+ }
+
+ public static void removeFinalFlagOnField(Field f) throws Exception {
+ Field reflectedModifier = Field.class.getDeclaredField("modifiers");
+ reflectedModifier.setAccessible(true);
+ int modifiers = (Integer) reflectedModifier.get(f);
+ modifiers = modifiers & ~Modifier.FINAL;
+ reflectedModifier.set(f, modifiers);
+ reflectedModifier.setAccessible(false);
+ }
+
+ public static void setFinalFlagOnField(Field f) throws Exception {
+ Field reflectedModifier = Field.class.getDeclaredField("modifiers");
+ reflectedModifier.setAccessible(true);
+ int modifiers = (Integer) reflectedModifier.get(f);
+ modifiers = modifiers | Modifier.FINAL;
+ reflectedModifier.set(f, modifiers);
+ reflectedModifier.setAccessible(false);
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/RunnableWithData.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/RunnableWithData.java
index 9b2a574360..02b591552b 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/RunnableWithData.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/RunnableWithData.java
@@ -1,80 +1,80 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import java.util.HashMap;
-
-public class RunnableWithData implements Runnable {
- private Exception m_constructorStackTrace;
- /*
- * cached from m_constructorStackTrace
- */
- private Exception m_originatingStackTrace;
- private HashMap<String, Object> m_dataMap = new HashMap<String, Object>();
-
- public RunnableWithData() {
- m_constructorStackTrace = new Exception();
- }
-
- @Override
- public void run() {
- }
-
- /**
- * Logging
- */
- public Exception getOriginatingStackTrace() {
- if (m_originatingStackTrace == null) {
- StackTraceElement[] trace = m_constructorStackTrace.getStackTrace();
- int traceIndex = 0;
- // find constructor
- while (traceIndex + 1 < trace.length && !getClass().getName().equals(trace[traceIndex].getClassName())) {
- traceIndex++;
- }
- // find origin
- while (traceIndex + 1 < trace.length && getClass().getName().equals(trace[traceIndex].getClassName())) {
- traceIndex++;
- }
- StackTraceElement[] trace2 = new StackTraceElement[trace.length - traceIndex];
- System.arraycopy(trace, traceIndex, trace2, 0, trace2.length);
- m_originatingStackTrace = new Exception();
- m_originatingStackTrace.setStackTrace(trace2);
- }
- return m_originatingStackTrace;
- }
-
- @Override
- public String toString() {
- StringBuffer buf = new StringBuffer(getClass().getSimpleName() + "[");
- StackTraceElement[] a = getOriginatingStackTrace().getStackTrace();
- if (a.length > 0) {
- buf.append(a[0]);
- }
- buf.append("]");
- return buf.toString();
- }
-
- public void setData(String key, Object data) {
- if (m_dataMap == null) {
- m_dataMap = new HashMap<String, Object>();
- }
- m_dataMap.put(key, data);
- }
-
- public Object getData(String key) {
- if (m_dataMap != null) {
- return m_dataMap.get(key);
- }
- else {
- return null;
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import java.util.HashMap;
+
+public class RunnableWithData implements Runnable {
+ private Exception m_constructorStackTrace;
+ /*
+ * cached from m_constructorStackTrace
+ */
+ private Exception m_originatingStackTrace;
+ private HashMap<String, Object> m_dataMap = new HashMap<String, Object>();
+
+ public RunnableWithData() {
+ m_constructorStackTrace = new Exception();
+ }
+
+ @Override
+ public void run() {
+ }
+
+ /**
+ * Logging
+ */
+ public Exception getOriginatingStackTrace() {
+ if (m_originatingStackTrace == null) {
+ StackTraceElement[] trace = m_constructorStackTrace.getStackTrace();
+ int traceIndex = 0;
+ // find constructor
+ while (traceIndex + 1 < trace.length && !getClass().getName().equals(trace[traceIndex].getClassName())) {
+ traceIndex++;
+ }
+ // find origin
+ while (traceIndex + 1 < trace.length && getClass().getName().equals(trace[traceIndex].getClassName())) {
+ traceIndex++;
+ }
+ StackTraceElement[] trace2 = new StackTraceElement[trace.length - traceIndex];
+ System.arraycopy(trace, traceIndex, trace2, 0, trace2.length);
+ m_originatingStackTrace = new Exception();
+ m_originatingStackTrace.setStackTrace(trace2);
+ }
+ return m_originatingStackTrace;
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer buf = new StringBuffer(getClass().getSimpleName() + "[");
+ StackTraceElement[] a = getOriginatingStackTrace().getStackTrace();
+ if (a.length > 0) {
+ buf.append(a[0]);
+ }
+ buf.append("]");
+ return buf.toString();
+ }
+
+ public void setData(String key, Object data) {
+ if (m_dataMap == null) {
+ m_dataMap = new HashMap<String, Object>();
+ }
+ m_dataMap.put(key, data);
+ }
+
+ public Object getData(String key) {
+ if (m_dataMap != null) {
+ return m_dataMap.get(key);
+ }
+ else {
+ return null;
+ }
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/RunnableWithException.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/RunnableWithException.java
index 97c2c9bfb9..6797d5c2da 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/RunnableWithException.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/RunnableWithException.java
@@ -1,15 +1,15 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-public interface RunnableWithException<T> {
- T run() throws Throwable;
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+public interface RunnableWithException<T> {
+ T run() throws Throwable;
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/SecurePreferencesUtility.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/SecurePreferencesUtility.java
index 0a7c16ffe3..a3c809ecb3 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/SecurePreferencesUtility.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/SecurePreferencesUtility.java
@@ -1,68 +1,68 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import java.io.IOException;
-
-import org.eclipse.equinox.security.storage.ISecurePreferences;
-import org.eclipse.equinox.security.storage.SecurePreferencesFactory;
-import org.eclipse.equinox.security.storage.StorageException;
-
-public final class SecurePreferencesUtility {
-
- private SecurePreferencesUtility() {
- }
-
- /**
- * @param path
- * normally of the form host/path, see {@link ISecurePreferences#node(String)} Store the data in the
- * {@link ISecurePreferences} store
- */
- public static void storeCredentials(String path, String username, String password) throws StorageException, IOException {
- ISecurePreferences securePreferences = SecurePreferencesFactory.getDefault();
- ISecurePreferences node = securePreferences.node(path);
- node.put("username", username, false);
- node.put("password", password, true);
- securePreferences.flush();
- }
-
- /**
- * @param path
- * normally of the form host/path, see {@link ISecurePreferences#node(String)}
- * @return String[2]{username,password} if it exists and null otherwise
- * @throws StorageException
- * Load the data from the {@link ISecurePreferences} store
- */
- public static String[] loadCredentials(String path) throws StorageException {
- ISecurePreferences securePreferences = SecurePreferencesFactory.getDefault();
- ISecurePreferences node = securePreferences.node(path);
- String username = node.get("username", null);
- String password = node.get("password", null);
- if (username != null && password != null) {
- return new String[]{username, password};
- }
- else {
- return null;
- }
- }
-
- /**
- * @param path
- * normally of the form host/path, see {@link ISecurePreferences#node(String)} Clear the data in the
- * {@link ISecurePreferences} store
- */
- public static void removeCredentials(String path) throws IOException {
- ISecurePreferences securePreferences = SecurePreferencesFactory.getDefault();
- ISecurePreferences node = securePreferences.node(path);
- node.removeNode();
- securePreferences.flush();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import java.io.IOException;
+
+import org.eclipse.equinox.security.storage.ISecurePreferences;
+import org.eclipse.equinox.security.storage.SecurePreferencesFactory;
+import org.eclipse.equinox.security.storage.StorageException;
+
+public final class SecurePreferencesUtility {
+
+ private SecurePreferencesUtility() {
+ }
+
+ /**
+ * @param path
+ * normally of the form host/path, see {@link ISecurePreferences#node(String)} Store the data in the
+ * {@link ISecurePreferences} store
+ */
+ public static void storeCredentials(String path, String username, String password) throws StorageException, IOException {
+ ISecurePreferences securePreferences = SecurePreferencesFactory.getDefault();
+ ISecurePreferences node = securePreferences.node(path);
+ node.put("username", username, false);
+ node.put("password", password, true);
+ securePreferences.flush();
+ }
+
+ /**
+ * @param path
+ * normally of the form host/path, see {@link ISecurePreferences#node(String)}
+ * @return String[2]{username,password} if it exists and null otherwise
+ * @throws StorageException
+ * Load the data from the {@link ISecurePreferences} store
+ */
+ public static String[] loadCredentials(String path) throws StorageException {
+ ISecurePreferences securePreferences = SecurePreferencesFactory.getDefault();
+ ISecurePreferences node = securePreferences.node(path);
+ String username = node.get("username", null);
+ String password = node.get("password", null);
+ if (username != null && password != null) {
+ return new String[]{username, password};
+ }
+ else {
+ return null;
+ }
+ }
+
+ /**
+ * @param path
+ * normally of the form host/path, see {@link ISecurePreferences#node(String)} Clear the data in the
+ * {@link ISecurePreferences} store
+ */
+ public static void removeCredentials(String path) throws IOException {
+ ISecurePreferences securePreferences = SecurePreferencesFactory.getDefault();
+ ISecurePreferences node = securePreferences.node(path);
+ node.removeNode();
+ securePreferences.flush();
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/SoapHandlingUtility.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/SoapHandlingUtility.java
index 3119007a58..07f9398f3f 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/SoapHandlingUtility.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/SoapHandlingUtility.java
@@ -1,122 +1,122 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import javax.xml.XMLConstants;
-import javax.xml.namespace.QName;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-import javax.xml.soap.SOAPConstants;
-import javax.xml.validation.SchemaFactory;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-
-/**
- * Convenience functions for soap message parsing and WSSE WS-Security
- */
-public final class SoapHandlingUtility {
- private SoapHandlingUtility() {
- }
-
- public static final String XMLNS_SOAPENV = SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE;
- public static final String XMLNS_WSSE = "http://schemas.xmlsoap.org/ws/2002/04/secext";
- public static final QName SOAPENV_ENVELOPE_ELEMENT = new QName(XMLNS_SOAPENV, "Envelope");
- public static final QName SOAPENV_HEADER_ELEMENT = new QName(XMLNS_SOAPENV, "Header");
- public static final QName WSSE_SECURITY_ELEMENT = new QName(XMLNS_WSSE, "Security");
- public static final QName WSSE_USERNAME_TOKEN_ELEMENT = new QName(XMLNS_WSSE, "UsernameToken");
- public static final QName WSSE_USERNAME_ELEMENT = new QName(XMLNS_WSSE, "Username");
- public static final QName WSSE_PASSWORD_ELEMENT = new QName(XMLNS_WSSE, "Password");
-
- public static final String WSSE_PASSWORD_TYPE_ATTRIBUTE = "Type";
-
- public static final String DEFAULT_WSSE_USERNAME_TOKEN = "" +
- "<wsse:Security soapenv:mustUnderstand=\"1\">" +
- " <wsse:UsernameToken>" +
- " <wsse:Username>${username}</wsse:Username>" +
- " <wsse:Password Type=\"http://scout.eclipse.org/security#Base64\">${password}</wsse:Password>" +
- " </wsse:UsernameToken>" +
- "</wsse:Security>";
-
- /**
- * Create a WS-Security username token containing username and password
- * <p>
- */
- public static String createWsSecurityUserNameToken(String username, byte[] password) {
- if (username == null) {
- username = "";
- }
- username = username.replaceAll("[<>\"]", " ");
- if (password == null) {
- password = new byte[0];
- }
- return DEFAULT_WSSE_USERNAME_TOKEN.replace("${username}", username).replace("${password}", Base64Utility.encode(password));
- }
-
- public static SAXParser createSaxParser(SAXParserFactory factory) throws ProcessingException {
- try {
- return factory.newSAXParser();
- }
- catch (Exception e) {
- throw new ProcessingException("building sax parser", e);
- }
- }
-
- public static SAXParserFactory createSaxParserFactory() throws ProcessingException {
- try {
- // Obtain an instance of a SchemaFactory for W3C Schemas
- SchemaFactory schemaFact = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
-
- // Obtain a new instance of a SAXParserFactory.
- SAXParserFactory factory = SAXParserFactory.newInstance();
-
- // Specifies that the parser produced by this code will provide
- // support for XML namespaces.
- factory.setNamespaceAware(true);
-
- // disables the XInclude feature
- factory.setXIncludeAware(false);
-
- // sets the schema validator
- factory.setSchema(schemaFact.newSchema());
-
- // Specifies that the parser produced by this code will validate
- // documents as they are parsed.
- factory.setValidating(false);
-
- //disable xml injection
- try {
- factory.setFeature("http://xml.org/sax/features/external-general-entities", false);
- }
- catch (Throwable t) {
- //nop
- }
- try {
- factory.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
- }
- catch (Throwable t) {
- //nop
- }
- try {
- factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
- }
- catch (Throwable t) {
- //nop
- }
- factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
-
- return factory;
- }
- catch (Exception e) {
- throw new ProcessingException("building sax parser", e);
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import javax.xml.XMLConstants;
+import javax.xml.namespace.QName;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.soap.SOAPConstants;
+import javax.xml.validation.SchemaFactory;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+
+/**
+ * Convenience functions for soap message parsing and WSSE WS-Security
+ */
+public final class SoapHandlingUtility {
+ private SoapHandlingUtility() {
+ }
+
+ public static final String XMLNS_SOAPENV = SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE;
+ public static final String XMLNS_WSSE = "http://schemas.xmlsoap.org/ws/2002/04/secext";
+ public static final QName SOAPENV_ENVELOPE_ELEMENT = new QName(XMLNS_SOAPENV, "Envelope");
+ public static final QName SOAPENV_HEADER_ELEMENT = new QName(XMLNS_SOAPENV, "Header");
+ public static final QName WSSE_SECURITY_ELEMENT = new QName(XMLNS_WSSE, "Security");
+ public static final QName WSSE_USERNAME_TOKEN_ELEMENT = new QName(XMLNS_WSSE, "UsernameToken");
+ public static final QName WSSE_USERNAME_ELEMENT = new QName(XMLNS_WSSE, "Username");
+ public static final QName WSSE_PASSWORD_ELEMENT = new QName(XMLNS_WSSE, "Password");
+
+ public static final String WSSE_PASSWORD_TYPE_ATTRIBUTE = "Type";
+
+ public static final String DEFAULT_WSSE_USERNAME_TOKEN = "" +
+ "<wsse:Security soapenv:mustUnderstand=\"1\">" +
+ " <wsse:UsernameToken>" +
+ " <wsse:Username>${username}</wsse:Username>" +
+ " <wsse:Password Type=\"http://scout.eclipse.org/security#Base64\">${password}</wsse:Password>" +
+ " </wsse:UsernameToken>" +
+ "</wsse:Security>";
+
+ /**
+ * Create a WS-Security username token containing username and password
+ * <p>
+ */
+ public static String createWsSecurityUserNameToken(String username, byte[] password) {
+ if (username == null) {
+ username = "";
+ }
+ username = username.replaceAll("[<>\"]", " ");
+ if (password == null) {
+ password = new byte[0];
+ }
+ return DEFAULT_WSSE_USERNAME_TOKEN.replace("${username}", username).replace("${password}", Base64Utility.encode(password));
+ }
+
+ public static SAXParser createSaxParser(SAXParserFactory factory) throws ProcessingException {
+ try {
+ return factory.newSAXParser();
+ }
+ catch (Exception e) {
+ throw new ProcessingException("building sax parser", e);
+ }
+ }
+
+ public static SAXParserFactory createSaxParserFactory() throws ProcessingException {
+ try {
+ // Obtain an instance of a SchemaFactory for W3C Schemas
+ SchemaFactory schemaFact = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+
+ // Obtain a new instance of a SAXParserFactory.
+ SAXParserFactory factory = SAXParserFactory.newInstance();
+
+ // Specifies that the parser produced by this code will provide
+ // support for XML namespaces.
+ factory.setNamespaceAware(true);
+
+ // disables the XInclude feature
+ factory.setXIncludeAware(false);
+
+ // sets the schema validator
+ factory.setSchema(schemaFact.newSchema());
+
+ // Specifies that the parser produced by this code will validate
+ // documents as they are parsed.
+ factory.setValidating(false);
+
+ //disable xml injection
+ try {
+ factory.setFeature("http://xml.org/sax/features/external-general-entities", false);
+ }
+ catch (Throwable t) {
+ //nop
+ }
+ try {
+ factory.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
+ }
+ catch (Throwable t) {
+ //nop
+ }
+ try {
+ factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
+ }
+ catch (Throwable t) {
+ //nop
+ }
+ factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+
+ return factory;
+ }
+ catch (Exception e) {
+ throw new ProcessingException("building sax parser", e);
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/StoppableThread.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/StoppableThread.java
index 5b8cd3cb70..aefa8742c8 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/StoppableThread.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/StoppableThread.java
@@ -1,56 +1,56 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-public class StoppableThread extends Thread {
- private boolean m_stopSignal;
-
- public StoppableThread() {
- super("StoppableThread");
- }
-
- public StoppableThread(String name) {
- super(name);
- }
-
- public StoppableThread(Runnable r) {
- super(r, "StoppableThread");
- }
-
- public StoppableThread(Runnable r, String s) {
- super(r, s);
- }
-
- public StoppableThread(ThreadGroup g, Runnable r, String s) {
- super(g, r, s);
- }
-
- @Override
- public void start() {
- m_stopSignal = false;
- super.start();
- }
-
- public void setStopSignal() {
- m_stopSignal = true;// cannot be set back agoin once it is set
- interrupt();
- }
-
- public void checkStopSignal() throws InterruptedException {
- if (m_stopSignal) {
- throw new InterruptedException("WorkerThread received stop signal");
- }
- }
-
- public boolean isStopSignal() {
- return m_stopSignal;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+public class StoppableThread extends Thread {
+ private boolean m_stopSignal;
+
+ public StoppableThread() {
+ super("StoppableThread");
+ }
+
+ public StoppableThread(String name) {
+ super(name);
+ }
+
+ public StoppableThread(Runnable r) {
+ super(r, "StoppableThread");
+ }
+
+ public StoppableThread(Runnable r, String s) {
+ super(r, s);
+ }
+
+ public StoppableThread(ThreadGroup g, Runnable r, String s) {
+ super(g, r, s);
+ }
+
+ @Override
+ public void start() {
+ m_stopSignal = false;
+ super.start();
+ }
+
+ public void setStopSignal() {
+ m_stopSignal = true;// cannot be set back agoin once it is set
+ interrupt();
+ }
+
+ public void checkStopSignal() throws InterruptedException {
+ if (m_stopSignal) {
+ throw new InterruptedException("WorkerThread received stop signal");
+ }
+ }
+
+ public boolean isStopSignal() {
+ return m_stopSignal;
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/StreamDumper.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/StreamDumper.java
index 5f3269d53b..1430813b35 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/StreamDumper.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/StreamDumper.java
@@ -1,44 +1,44 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import java.io.BufferedReader;
-import java.io.EOFException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-
-public class StreamDumper extends Thread {
- private BufferedReader m_in;
- private StringWriter m_sw;
-
- public StreamDumper(InputStream in, StringWriter sw) {
- setName("StreamDumper");
- m_sw = sw;
- m_in = new BufferedReader(new InputStreamReader(in));
- }
-
- @Override
- public void run() {
- String line;
- try {
- while ((line = m_in.readLine()) != null) {
- m_sw.write(line + "\n");
- }
- }
- catch (EOFException e) {
- }
- catch (Exception e) {
- e.printStackTrace(new PrintWriter(m_sw, true));
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import java.io.BufferedReader;
+import java.io.EOFException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+public class StreamDumper extends Thread {
+ private BufferedReader m_in;
+ private StringWriter m_sw;
+
+ public StreamDumper(InputStream in, StringWriter sw) {
+ setName("StreamDumper");
+ m_sw = sw;
+ m_in = new BufferedReader(new InputStreamReader(in));
+ }
+
+ @Override
+ public void run() {
+ String line;
+ try {
+ while ((line = m_in.readLine()) != null) {
+ m_sw.write(line + "\n");
+ }
+ }
+ catch (EOFException e) {
+ }
+ catch (Exception e) {
+ e.printStackTrace(new PrintWriter(m_sw, true));
+ }
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/StringUtility.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/StringUtility.java
index 117df7a218..0af930b7c4 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/StringUtility.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/StringUtility.java
@@ -1,1585 +1,1585 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.text.Collator;
-import java.util.Collection;
-import java.util.Locale;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import java.util.regex.PatternSyntaxException;
-import java.util.zip.Deflater;
-import java.util.zip.DeflaterOutputStream;
-import java.util.zip.Inflater;
-import java.util.zip.InflaterInputStream;
-
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.commons.nls.NlsUtility;
-
-public final class StringUtility {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(StringUtility.class);
- public static final Pattern PATTERN_TRIM_NEWLINES = Pattern.compile("^[\r\n]*(.*?)[\r\n]*$", Pattern.DOTALL);
-
- public static interface ITagProcessor {
- String/* tagReplacement */processTag(String tagName, String tagContent);
- }
-
- private StringUtility() {
- }
-
- public static boolean isNullOrEmpty(String s) {
- return s == null || s.length() == 0;
- }
-
- public static boolean hasText(String s) {
- return s != null && !"".equals(s.trim());
- }
-
- /**
- * Wildcard Pattern may contain only: wildcards: *,%,?,_ characters:<br>
- * A-Z,a-z,0-9 % and * are replaced by .* ? and _ are replaced by . all
- * invalid characters are also replaced by .
- */
- public static String toRegExPattern(String wildcardPattern) {
- if (wildcardPattern == null) {
- wildcardPattern = "";
- }
- StringBuffer buf = new StringBuffer();
- char[] ch = wildcardPattern.toCharArray();
- for (int i = 0; i < ch.length; i++) {
- switch (ch[i]) {
- case ' ': {
- buf.append(ch[i]);
- break;
- }
- case '*':
- case '%': {
- buf.append(".*");
- break;
- }
- case '_':
- case '?': {
- buf.append(".");
- break;
- }
- case '$':
- case '@': {
- buf.append(".");
- break;
- }
- case '<':
- case '>':
- case '=': {
- buf.append(ch[i]);
- break;
- }
- case '.': {
- buf.append("\\.");
- break;
- }
- default: {
- if (ch[i] >= 32 && (Character.isJavaIdentifierStart(ch[i]) || Character.isJavaIdentifierPart(ch[i]))) {
- buf.append(ch[i]);
- }
- else {
- buf.append('.');
- }
- }
- }
- }
- if (buf.length() > 0) {
- try {
- return Pattern.compile(buf.toString()).pattern();
- }
- catch (PatternSyntaxException ex) {
- return "INVALID_PATTERN";
- }
- }
- else {
- return ".*";
- }
- }
-
- /**
- * @param humanReadableFilterText
- * is not a regex and may contain *,%,? as wildcards for searching
- * @param patternFlags
- * see {@link Pattern}
- * @return a {@link Pattern} based on the input pattern. If the input pattern contains no '*' an '*' is automatically
- * appended. If the input pattern is null or empty then '*' is used instead
- * @since 3.8
- */
- public static Pattern toRegEx(String humanReadableFilterText, int patternFlags) {
- if (humanReadableFilterText == null) {
- humanReadableFilterText = "";
- }
- if (humanReadableFilterText.indexOf('*') < 0) {
- humanReadableFilterText += "*";
- }
- return Pattern.compile(StringUtility.toRegExPattern(humanReadableFilterText), patternFlags);
- }
-
- /**
- * Tokenize a String s by given character c. Take care about empty String
- * between two separating chars. {@link java.util.StringTokenizer} does not
- * care about empty string between separating chars.
- *
- * @param s
- * String to tokenize.
- * @param c
- * Separating character.
- * @return given String s tokenized by c.
- */
- public static String[] tokenize(String s, char c) {
- if (s == null) {
- return new String[0];
- }
- char[] cA = s.toCharArray();
- int count = 0;
- for (int i = 0; i < cA.length; i++) {
- if (cA[i] == c) {
- count++;
- }
- }
- String[] returnValue = new String[count + 1];
- int nextCindex = s.indexOf(c);
- /*
- * LOOP INV: nextCindex points to next index of c in s AND s is String to be
- * tokenized AND returnValue contains already tokenized Strings
- */
- count = 0;
- while (nextCindex >= 0) {
- returnValue[count++] = s.substring(0, nextCindex);
- s = s.substring(nextCindex + 1);
- nextCindex = s.indexOf(c);
- }
- returnValue[count++] = s;
- return returnValue;
- }
-
- public static boolean parseBoolean(String s, boolean defaultValue) {
- if (s == null || s.length() == 0) {
- return defaultValue;
- }
- s = s.toLowerCase().trim();
- if (defaultValue) {
- return !("0,false,no".indexOf(s) >= 0);
- }
- else {
- return "1,true,yes".indexOf(s) >= 0;
- }
- }
-
- public static boolean parseBoolean(String s) {
- return parseBoolean(s, false);
- }
-
- /**
- * @return the number of lines in the string s empty and null strings have 0
- * lines
- * @since Build 153
- */
- public static int getLineCount(String s) {
- if (s == null || s.length() == 0) {
- return 0;
- }
- int r = 1;
- int pos = 0;
- while ((pos = s.indexOf('\n', pos)) >= 0) {
- r++;
- // next
- pos++;
- }
- return r;
- }
-
- /**
- * @return the lines in the string s empty and null strings have 0 lines
- * @since Build 153
- */
- public static String[] getLines(String s) {
- int count = getLineCount(s);
- String[] lines = new String[count];
- if (count == 0) {
- return lines;
- }
- int index = 0;
- int begin = 0;
- int pos = 0;
- while ((pos = s.indexOf('\n', pos)) >= 0) {
- String unit = s.substring(begin, pos);
- int ulen = unit.length();
- if (ulen > 0 && unit.charAt(0) == '\r') {
- unit = unit.substring(1);
- }
- ulen = unit.length();
- if (ulen > 0 && unit.charAt(ulen - 1) == '\r') {
- unit = unit.substring(0, ulen - 1);
- }
- ulen = unit.length();
- lines[index] = unit;
- // next
- pos++;
- index++;
- begin = pos;
- }
- lines[index] = s.substring(begin);
- return lines;
- }
-
- /**
- * encode a string by escaping " -> "" and ' -> ''
- */
- public static String stringEsc(String s) {
- if (s == null) {
- return null;
- }
- s = s.replaceAll("[\"]", "\"\"");
- s = s.replaceAll("[']", "''");
- return s;
- }
-
- /**
- * decode a string by unescaping "" -> " and '' -> '
- */
- public static String stringUnesc(String s) {
- s = s.replaceAll("[\"][\"]", "\"");
- s = s.replaceAll("['][']", "'");
- return s;
- }
-
- public static String removeMnemonic(String text) {
- if (text == null) {
- return null;
- }
- Matcher m = MNEMONIC_PATTERN.matcher(text);
- return m.replaceAll("$1");
- }
-
- /**
- * Returns a new string resulting from replacing all new line characters ("\n", "\r\n", "\n\r" or "\r") with a single
- * blank (" ").
- * <p>
- * Examples:
- *
- * <pre>
- * "a\r\nb" -> "a b"
- * "a\nb" -> "a b"
- * </pre>
- *
- * </p>
- *
- * @param text
- * the {@link String} thats new line characters should be removed
- * @return a string derived from this string by replacing every occurrence of new line character with a
- * blank.
- */
- public static String removeNewLines(String text) {
- return replaceNewLines(text, " ");
- }
-
- /**
- * Returns a new string resulting from replacing all new line characters ("\n", "\r\n", "\n\r" or "\r") with the given
- * replacement string.
- *
- * @param text
- * the {@link String} thats new line characters should be removed
- * @param replacement
- * the {@link String} to be used as replacement for the new line characters
- * @return a string derived from this string by replacing every occurrence of new line character with the replacement
- * string.
- */
- public static String replaceNewLines(String text, String replacement) {
- if (isNullOrEmpty(text)) {
- return text;
- }
- String s = text.replaceAll("\r\n|\n\r", replacement);
- s = s.replace("\n", replacement).replace("\r", replacement);
- return s;
- }
-
- /**
- * @return a single tag <foo/>
- */
- private static TagBounds getSingleTag(String text, String tagName, int pos) {
- if (text == null) {
- return TAG_BOUNDS_NOT_FOUND;
- }
- Pattern pat = Pattern.compile("<" + tagName + "(\\s[^<>]*)?/>", Pattern.DOTALL);
- Matcher m = pat.matcher(text);
- if (m.find(pos)) {
- return new TagBounds(m.start(), m.end());
- }
- return TAG_BOUNDS_NOT_FOUND;
- }
-
- /**
- * @return a start tag (ignores single tags) <foo> (not <foo/>)
- */
- private static TagBounds getStartTag(String text, String tagName, int pos) {
- if (text == null) {
- return TAG_BOUNDS_NOT_FOUND;
- }
- Pattern pat = Pattern.compile("<" + tagName + "(\\s[^<>]*[^/])?>", Pattern.DOTALL);
- Matcher m = pat.matcher(text);
- if (m.find(pos)) {
- return new TagBounds(m.start(), m.end());
- }
- return TAG_BOUNDS_NOT_FOUND;
- }
-
- /**
- * @return an end tag </foo>
- */
- private static TagBounds getEndTag(String text, String tagName, int pos) {
- if (text == null) {
- return TAG_BOUNDS_NOT_FOUND;
- }
- Pattern pat = Pattern.compile("</" + tagName + ">");
- Matcher m = pat.matcher(text);
- if (m.find(pos)) {
- return new TagBounds(m.start(), m.end());
- }
- return TAG_BOUNDS_NOT_FOUND;
- }
-
- /**
- * @return the contents between a start and a end tag, resp "" when there is a single tag
- */
- public static String getTag(String text, String tagName) {
- if (text == null) {
- return null;
- }
- TagBounds a;
- TagBounds b;
- if ((a = getStartTag(text, tagName, 0)).begin >= 0 && (b = getEndTag(text, tagName, a.end)).begin >= 0) {
- return text.substring(a.end, b.begin).trim();
- }
- if ((a = getSingleTag(text, tagName, 0)).begin >= 0) {
- return "";
- }
- return null;
- }
-
- public static String replaceTags(String text, String tagName, final String replacement) {
- return replaceTags(text, tagName, new ITagProcessor() {
- @Override
- public String processTag(String name, String tagContent) {
- return replacement;
- }
- });
- }
-
- /**
- * tag processor returns the replacement for every tag
- * <p>
- * the tag content is either "" for single tags or the tag content else
- * <p>
- * be careful to not replace the tag again with the tag, this will result in an endless loop
- */
- public static String replaceTags(String text, String tagName, ITagProcessor processor) {
- if (text == null) {
- return null;
- }
- TagBounds a;
- TagBounds b;
- while ((a = getSingleTag(text, tagName, 0)).begin >= 0) {
- String tagContent = "";
- String replacement = processor.processTag(tagName, tagContent);
- text = text.substring(0, a.begin) + replacement + text.substring(a.end);
- }
- while ((a = getStartTag(text, tagName, 0)).begin >= 0 && (b = getEndTag(text, tagName, a.end)).begin >= 0) {
- String tagContent = text.substring(a.end, b.begin);
- String replacement = processor.processTag(tagName, tagContent);
- text = text.substring(0, a.begin) + replacement + text.substring(b.end);
- }
- return text;
- }
-
- public static String removeTag(String text, String tagName) {
- if (text == null) {
- return null;
- }
- TagBounds a;
- TagBounds b;
- while ((a = getSingleTag(text, tagName, 0)).begin >= 0) {
- text = text.substring(0, a.begin) + text.substring(a.end);
- }
- while ((a = getStartTag(text, tagName, 0)).begin >= 0 && (b = getEndTag(text, tagName, a.end)).begin >= 0) {
- text = text.substring(0, a.begin) + text.substring(b.end);
- }
- return text;
- }
-
- public static String removeTags(String text, String[] tagNames) {
- if (text == null) {
- return null;
- }
- for (int i = 0; i < tagNames.length; i++) {
- text = removeTag(text, tagNames[i]);
- }
- return text;
- }
-
- public static String removeTags(String text) {
- if (text == null) {
- return null;
- }
- text = Pattern.compile("<[^>]+>", Pattern.DOTALL).matcher(text).replaceAll("");
- return text;
- }
-
- public static String removeTagBounds(String text, String tagName) {
- if (text == null) {
- return null;
- }
- TagBounds a;
- TagBounds b;
- while ((a = getSingleTag(text, tagName, 0)).begin >= 0) {
- text = text.substring(0, a.begin) + text.substring(a.end);
- }
- while ((a = getStartTag(text, tagName, 0)).begin >= 0 && (b = getEndTag(text, tagName, a.end)).begin >= 0) {
- text = text.substring(0, a.begin) + text.substring(a.end, b.begin) + text.substring(b.end);
- }
- return text;
- }
-
- public static String replaceTagBounds(String text, String tagName, String start, String end) {
- if (text == null) {
- return null;
- }
- TagBounds a;
- int b;
- int startPos = 0;
- while (startPos < text.length() && (a = getStartTag(text, tagName, startPos)).begin >= 0 && (b = text.indexOf("</" + tagName + ">", a.end)) > 0) {
- text =
- text.substring(0, a.begin) +
- start +
- text.substring(a.end, b) +
- end +
- text.substring(b + tagName.length() + 3);
- //next
- startPos = a.begin + start.length();
- }
- return text;
- }
-
- public static final Pattern MNEMONIC_PATTERN = Pattern.compile("\\&([-?_.,a-zA-Z0-9])", Pattern.DOTALL);
-
- public static char getMnemonic(String text) {
- if (text == null) {
- return 0x0;
- }
- Matcher m = MNEMONIC_PATTERN.matcher(text);
- if (m.find()) {
- return m.group(1).charAt(0);
- }
- return 0x0;
- }
-
- public static String wrapText(String s, int lineSize) {
- if (s == null) {
- return null;
- }
- StringBuffer buf = new StringBuffer();
- if (s != null) {
- char[] ch = s.toCharArray();
- int col = 0;
- for (int i = 0; i < ch.length; i++) {
- if (ch[i] == '\n' || ch[i] == '\r') {
- col = 0;
- buf.append(ch[i]);
- }
- else {
- col++;
- if (col > lineSize) {
- buf.append('\n');
- col = 1;
- }
- buf.append(ch[i]);
- }
- }
- }
- return buf.toString();
- }
-
- public static String wrapWord(String s, int lineSize) {
- if (s == null) {
- return null;
- }
- StringBuffer buf = new StringBuffer();
- for (String line : s.split("[\\n\\r]")) {
- if (buf.length() > 0) {
- buf.append("\n");
- }
- StringBuffer wrappedLine = new StringBuffer();
- for (String word : line.split("[ \\t]")) {
- if (wrappedLine.length() > 0 && wrappedLine.length() + 1 + word.length() > lineSize) {
- buf.append(wrappedLine.toString());
- buf.append("\n");
- wrappedLine.setLength(0);
- }
- if (wrappedLine.length() > 0) {
- wrappedLine.append(" ");
- }
- wrappedLine.append(word);
- }
- if (wrappedLine.length() > 0) {
- buf.append(wrapText(wrappedLine.toString(), lineSize));
- }
- }
- return buf.toString().trim();
- }
-
- public static String unwrapText(String s) {
- if (s == null || s.length() == 0) {
- return null;
- }
- s = s.replace('\n', ' ').replace('\r', ' ').replace('\t', ' ');
- s = s.replaceAll("[ ]+", " ");
- return s.trim();
- }
-
- public static boolean isQuotedText(String s) {
- if (s == null || s.length() == 0) {
- return false;
- }
- if (s.charAt(0) == '\'' && s.charAt(s.length() - 1) == '\'') {
- return true;
- }
- else if (s.charAt(0) == '"' && s.charAt(s.length() - 1) == '"') {
- return true;
- }
- return false;
- }
-
- public static String unquoteText(String s) {
- if (s == null || s.length() == 0) {
- return null;
- }
- if (s.charAt(0) == '\'' && s.charAt(s.length() - 1) == '\'') {
- s = s.substring(1, s.length() - 1);
- }
- else if (s.charAt(0) == '"' && s.charAt(s.length() - 1) == '"') {
- s = s.substring(1, s.length() - 1);
- }
- return s;
- }
-
- public static String valueOf(Object o) {
- if (o == null) {
- return "";
- }
- if (o instanceof byte[]) {
- return new String((byte[]) o);
- }
- if (o instanceof char[]) {
- return new String((char[]) o);
- }
- return o.toString();
- }
-
- public static String className(Object o) {
- if (o == null) {
- return "";
- }
- String s = o.getClass().getName();
- int i = s.lastIndexOf('.');
- if (i >= 0) {
- return s.substring(i + 1);
- }
- else {
- return s;
- }
- }
-
- /*
- * Converts unicodes to encoded &#92;uxxxx and writes out any of the
- * characters in specialSaveChars with a preceding slash
- */
- private static final String CONVERT_UTF_ASCII_HEX_CHARS = "0123456789abcdef";
-
- public static String convertUTFAscii(String s, boolean escapeControlChars) {
- if (s == null || s.length() == 0) {
- return s;
- }
- int len = s.length();
- StringBuffer buf = new StringBuffer(len * 2);
- for (int i = 0; i < len; i++) {
- char ch = s.charAt(i);
- switch (ch) {
- case '\\':
- buf.append("\\\\");
- break;
- case '\t':
- if (escapeControlChars) {
- buf.append("\\t");
- }
- else {
- buf.append(ch);
- }
- break;
- case '\n':
- if (escapeControlChars) {
- buf.append("\\n");
- }
- else {
- buf.append(ch);
- }
- break;
- case '\r':
- if (escapeControlChars) {
- buf.append("\\r");
- }
- else {
- buf.append(ch);
- }
- break;
- case '\f':
- if (escapeControlChars) {
- buf.append("\\f");
- }
- else {
- buf.append(ch);
- }
- break;
- default:
- if ((ch < 0x0020) || (ch > 0x007e)) {
- buf.append('\\');
- buf.append('u');
- buf.append(CONVERT_UTF_ASCII_HEX_CHARS.charAt((ch >> 12) & 0xF));
- buf.append(CONVERT_UTF_ASCII_HEX_CHARS.charAt((ch >> 8) & 0xF));
- buf.append(CONVERT_UTF_ASCII_HEX_CHARS.charAt((ch >> 4) & 0xF));
- buf.append(CONVERT_UTF_ASCII_HEX_CHARS.charAt(ch & 0xF));
- }
- else {
- buf.append(ch);
- }
- }// end switch
- }// end for
- return buf.toString();
- }
-
- /*
- * Converts encoded &#92;uxxxx to unicode chars and changes special saved
- * chars to their original forms
- */
- public static String convertAsciiUTF(String s) {
- if (s == null || s.length() == 0) {
- return s;
- }
- char ch;
- int len = s.length();
- StringBuffer buf = new StringBuffer(len);
-
- for (int k = 0; k < len;) {
- ch = s.charAt(k++);
- if (ch == '\\') {
- ch = s.charAt(k++);
- if (ch == 'u') {
- // Read the xxxx
- int value = Integer.parseInt(s.substring(k, k + 4), 16);
- k = k + 4;
- buf.append((char) value);
- }// end if u
- else {
- switch (ch) {
- case '\\':
- buf.append('\\');
- break;
- case 't':
- buf.append('\t');
- break;
- case 'r':
- buf.append('\r');
- break;
- case 'n':
- buf.append('\n');
- break;
- case 'f':
- buf.append('\f');
- break;
- default:
- buf.append(ch);
- }
- }// end else
- }// end if escape
- else {
- buf.append(ch);
- }// end if else
- }// end for k
- return buf.toString();
- }
-
- public static String emptyIfNull(Object o) {
- return o == null ? "" : o.toString();
- }
-
- public static String chr(int code) {
- return "" + ((char) Math.min(Math.max(code, 0), 255));
- }
-
- public static int asc(String s) {
- if (s == null || s.length() == 0) {
- return 0;
- }
- else {
- return s.charAt(0);
- }
- }
-
- public static byte[] hexToBytes(String s) {
- if (s == null) {
- return new byte[0];
- }
- int slen = s.length();
- byte[] a = new byte[slen / 2];
- for (int i = 0; i < slen; i = i + 2) {
- a[i / 2] = (byte) Integer.parseInt(s.substring(i, i + 2), 16);
- }
- return a;
- }
-
- public static String bytesToHex(byte[] a) {
- if (a == null || a.length == 0) {
- return null;
- }
- StringBuffer buf = new StringBuffer(a.length * 2);
- int hi, lo;
- for (int i = 0; i < a.length; i++) {
- lo = (a[i]) & 0xff;
- hi = (lo >> 4);
- lo = lo & 0x0f;
- buf.append(Integer.toHexString(hi));
- buf.append(Integer.toHexString(lo));
- }
- return buf.toString();
- }
-
- /**
- * remove all \n, \r, \t and make all multiple spaces single space
- */
- public static String cleanup(String s) {
- return unwrapText(s);
- }
-
- /**
- * decision function: return DECODE(value,test1,result1,test2,result2,....,defaultResult)
- * <p>
- * decode('B','A',1,'B',2,'C',3,-1) --> 'B'
- */
- public static Object decode(Object... a) {
- Object ref = a[0];
- for (int i = 1, n = a.length; i < n; i = i + 2) {
- if (i + 1 < n) {// test-value and result-value
- Object test = a[i];
- if (ref == test || (ref != null && ref.equals(test))) {
- return a[i + 1];
- }
- }
- else {// default result value
- return a[i];
- }
- }
- return null;
- }
-
- /**
- * @return encoded text, ready to be included in a html text
- * <xmp>replaces &, ", ', <, > and all whitespace</xmp>
- */
- public static String htmlEncode(String s) {
- return htmlEncode(s, false);
- }
-
- public static String htmlEncode(String s, boolean replaceSpace) {
- if (s == null) {
- return s;
- }
- if (s.length() == 0) {
- return s;
- }
- s = s.replace("&", "&amp;");
- s = s.replace("\"", "&quot;");
- s = s.replace("'", "&#39;");
- s = s.replace("<", "&lt;");
- s = s.replace(">", "&gt;");
- s = s.replace("\n\r", "<br/>");
- s = s.replace("\n", "<br/>");
-
- // temporarily replace tabs with specific tab-identifier to not be replaced by subsequent whitespace pattern
- String tabIdentifier = "#TAB#";
- s = s.replace("\t", tabIdentifier);
-
- if (replaceSpace) {
- s = s.replaceAll("\\s", "&nbsp;");
- }
- s = s.replace(tabIdentifier, "<span style=\"white-space:pre\">&#9;</span>");
- return s;
- }
-
- /**
- * @return decoded text, ready to be printed as text
- * <xmp>replaces &, ", ', <, > and all whitespace</xmp>
- */
- public static String htmlDecode(String s) {
- if (s == null || s.length() == 0) {
- return s;
- }
-
- s = s.replace("&nbsp;", " ");
- s = s.replace("&quot;", "\"");
- s = s.replace("&apos;", "'");
- s = s.replace("&#39;", "'");
- s = s.replace("&lt;", "<");
- s = s.replace("&gt;", ">");
- s = s.replace("&amp;", "&");
-
- // whitespace patterns
- String zeroOrMoreWhitespaces = "\\s*?";
- String oneOrMoreWhitespaces = "\\s+?";
-
- // replace <br/> by \n
- s = s.replaceAll("<" + zeroOrMoreWhitespaces + "br" + zeroOrMoreWhitespaces + "/" + zeroOrMoreWhitespaces + ">", "\n");
- // replace HTML-tabs by \t
- s = s.replaceAll("<" + zeroOrMoreWhitespaces + "span" + oneOrMoreWhitespaces + "style" + zeroOrMoreWhitespaces + "=" + zeroOrMoreWhitespaces + "\"white-space:pre\"" + zeroOrMoreWhitespaces + ">&#9;<" + zeroOrMoreWhitespaces + "/" + zeroOrMoreWhitespaces + "span" + zeroOrMoreWhitespaces + ">", "\t");
-
- return s;
- }
-
- public static boolean equalsIgnoreCase(String a, String b) {
- if (a == null) {
- a = "";
- }
- if (b == null) {
- b = "";
- }
- return a.equalsIgnoreCase(b);
- }
-
- public static boolean notEequalsIgnoreCase(String a, String b) {
- if (a == null) {
- a = "";
- }
- if (b == null) {
- b = "";
- }
- return !a.equalsIgnoreCase(b);
- }
-
- public static final Pattern NEWLINE_PATTERN = Pattern.compile("[\\n\\r]+");
-
- public static boolean equalsIgnoreNewLines(String a, String b) {
- if (a == b) {
- return true;
- }
- if (a == null) {
- return false;
- }
- if (b == null) {
- return false;
- }
- return NEWLINE_PATTERN.matcher(a).replaceAll(" ").equals(NEWLINE_PATTERN.matcher(b).replaceAll(" "));
- }
-
- /**
- * converts all non-allowed characters in the text to the text contained in
- * replacementText
- * <p>
- * <b>Example</b>: <code>filterText("test-text/info.12345","a-zA-Z0-2","_")</code> yields "test_text_info12___" <br>
- * since JRE 1.5 same as: <code>"test-text/info.12345".replaceAll("[^a-zA-Z0-2]","_")</code>
- */
- public static String filterText(String text, String allowedCharacters, String replacementText) {
- if (text == null || allowedCharacters == null) {
- return text;
- }
- if (replacementText == null) {
- replacementText = "";
- }
- return text.replaceAll("[^" + allowedCharacters + "]", replacementText);
- }
-
- public static int find(String s, String what) {
- return find(s, what, 0);
- }
-
- public static int find(String s, String what, int start) {
- if (s == null || start >= s.length()) {
- return -1;
- }
- return s.indexOf(what, start);
- }
-
- /**
- * Format phone numbers (to international phone number format - eg +41 41 882
- * 32 21)
- *
- * @since
- * @param phoneNumber
- * Unformatted/Formatted phone number with optional country code.
- * Brackets for area code and special characters (like -) for local
- * number is supported.
- * @param formattingPattern
- * Defines the format of the phone number (eg. ## ### ## ## for 41
- * 841 44 44). The formattingPattern must not include the country
- * code.
- * @param countryCode
- * Country code (+41, 0041, 41)
- * @return If the phone number does not match the formatting pattern the
- * original phone number will be returned. Otherwise the formatted
- * phone number will be returned.
- */
- public static String formatPhone(String phoneNumber, String formattingPattern, String countryCode) {
- if (phoneNumber == null) {
- return null;
- }
- if (formattingPattern == null) {
- return phoneNumber;
- }
- if (countryCode == null) {
- return phoneNumber;
- }
-
- // declare local variables
- int numberPattern = "#".charAt(0);
- String formattedPhoneNumber = "";
- String normalizedNumber;
- boolean patternIsMatching = false;
- boolean hasCountryCode = false;
-
- // calc. pattern lenght without spaces, etc.
- int patternLengh = formattingPattern.replaceAll("[^#]", "").length();
-
- /* normalize phone number */
- normalizedNumber = phoneNumber.replaceAll("[^(0-9|\\+)]|(\\(|\\))", "");
-
- // check for country code
- hasCountryCode = normalizedNumber.matches("(^(0{2})[0-9]*)|(^\\+{1}[0-9]*)");
-
- /* normalize country code (no spaces; no leading +/00 */
- countryCode = countryCode.replaceAll("[^0-9]", "");
- countryCode = countryCode.replaceAll("^(0{0,2})", "");
-
- // phone number has country code
- if (hasCountryCode) {
- // remove country code
- normalizedNumber = normalizedNumber.replaceAll("^(0{0,2})", "");
- normalizedNumber = normalizedNumber.replaceAll("^(\\+)", "");
- normalizedNumber = normalizedNumber.replaceAll("^" + countryCode, "");
- }
-
- // add leading zeros of the area code. is required for a propper matching
- // with the pattern
- if (patternLengh == normalizedNumber.length() + 1 && !normalizedNumber.startsWith("0")) {
- normalizedNumber = "0" + normalizedNumber;
- patternIsMatching = true;
-
- // normalized phone number is matching pattern
- }
- else if (patternLengh == normalizedNumber.length()) {
- patternIsMatching = true;
- }
-
- // format the normalized phone number
- if (patternIsMatching) {
- int count = 0;
- for (int i = 0; i < formattingPattern.length(); i++) {
- if (formattingPattern.charAt(i) == numberPattern) {
- if (count < normalizedNumber.length()) {
- formattedPhoneNumber += normalizedNumber.charAt(count);
- count++;
- }
- }
- else {
- formattedPhoneNumber += formattingPattern.charAt(i);
- }
- }
-
- // remove zeros of the area code
- formattedPhoneNumber = formattedPhoneNumber.replaceAll("^[0]+", "");
- // add country code
- formattedPhoneNumber = "+" + countryCode + " " + formattedPhoneNumber;
-
- }
- else {
- // do nothing
- formattedPhoneNumber = phoneNumber;
- }
-
- return formattedPhoneNumber;
- }
-
- public static int length(String s) {
- if (s == null) {
- return 0;
- }
- else {
- return s.length();
- }
- }
-
- public static String lowercase(String s) {
- if (s == null) {
- return null;
- }
- else {
- return s.toLowerCase();
- }
- }
-
- public static String uppercase(String s) {
- if (s == null) {
- return null;
- }
- else {
- return s.toUpperCase();
- }
- }
-
- public static String[] split(String s, String regex) {
- if (s == null || s.length() == 0) {
- return new String[0];
- }
- return s.split(regex);
- }
-
- public static String substring(String s, int start) {
- if (s == null || start >= s.length()) {
- return "";
- }
- return s.substring(start);
- }
-
- public static String substring(String s, int start, int len) {
- if (s == null || start >= s.length()) {
- return "";
- }
- len = Math.min(s.length() - start, len);
- return s.substring(start, start + len);
- }
-
- public static String trim(String s) {
- if (s == null) {
- return null;
- }
- return s.trim();
- }
-
- /**
- * Returns a copy of the {@link String} with leading and trailing newlines omitted.
- *
- * @param s
- * @return
- */
- public static String trimNewLines(String s) {
- if (s == null) {
- return null;
- }
- Matcher matcher = PATTERN_TRIM_NEWLINES.matcher(s);
- if (matcher.find()) {
- s = matcher.group(1);
- }
- return s;
- }
-
- public static String lpad(String s, String fill, int len) {
- if (s == null || fill == null || s.length() >= len || fill.length() == 0) {
- return s;
- }
- StringBuffer buf = new StringBuffer(s);
- while (buf.length() < len) {
- buf.insert(0, fill);
- }
- return buf.substring(buf.length() - len, buf.length());
- }
-
- public static String rpad(String s, String fill, int len) {
- if (s == null || fill == null || s.length() >= len || fill.length() == 0) {
- return s;
- }
- StringBuffer buf = new StringBuffer(s);
- while (buf.length() < len) {
- buf.append(fill);
- }
- return buf.substring(0, len);
- }
-
- public static String ltrim(String s, Character c) {
- if (s == null) {
- return null;
- }
- if (c == null) {
- return s;
- }
- int len = s.length();
- int st = 0;
- char[] val = s.toCharArray();
- while ((st < len) && (val[st] == c)) {
- st++;
- }
- return ((st > 0) || (len < s.length())) ? s.substring(st, len) : s;
- }
-
- public static String rtrim(String s, Character c) {
- if (s == null) {
- return null;
- }
- if (c == null) {
- return s;
- }
- int len = s.length();
- int st = 0;
- char[] val = s.toCharArray();
- while ((st < len) && (val[len - 1] == c)) {
- len--;
- }
- return ((st > 0) || (len < s.length())) ? s.substring(st, len) : s;
- }
-
- public static String nvl(Object value, String valueWhenNull) {
- if (value != null) {
- return value.toString();
- }
- else {
- return valueWhenNull;
- }
- }
-
- /**
- * replace plain text without using regex
- */
- public static String replace(String s, String sOld, String sNew) {
- sNew = (sNew == null ? "" : sNew);
- if (s == null || sOld == null) {
- return s;
- }
- return s.replace(sOld, sNew);
- }
-
- /**
- * replace plain text without using regex, ignoring case
- */
- public static String replaceNoCase(String s, String sOld, String sNew) {
- if (s == null || sOld == null || sNew == null) {
- return s;
- }
- StringBuffer buf = new StringBuffer();
- int oldLen = sOld.length();
- int pos = 0;
- sOld = sOld.toLowerCase();
- String sLower = s.toLowerCase();
- int i = sLower.indexOf(sOld);
- while (i >= 0) {
- buf.append(s.substring(pos, i));
- buf.append(sNew);
- pos = i + oldLen;
- i = sLower.indexOf(sOld, pos);
- }
- buf.append(s.substring(pos));
- return buf.toString();
- }
-
- private static class TagBounds {
- final int begin;
- final int end;
-
- public TagBounds(int begin, int end) {
- this.begin = begin;
- this.end = end;
- }
-
- @Override
- public boolean equals(Object o) {
- if (o instanceof TagBounds) {
- return ((TagBounds) o).begin == begin && ((TagBounds) o).end == end;
- }
- return false;
- }
-
- @Override
- public int hashCode() {
- return begin ^ end;
- }
- }
-
- private static final TagBounds TAG_BOUNDS_NOT_FOUND = new TagBounds(-1, -1);
-
- public static String unescapeWhitespace(String s) {
- if (s == null) {
- return null;
- }
- s = s.replaceAll("\\\\n", "\n");
- s = s.replaceAll("\\\\t", "\t");
- s = s.replaceAll("\\\\r", "\r");
- s = s.replaceAll("\\\\b", "\b");
- s = s.replaceAll("\\\\f", "\f");
- return s;
- }
-
- public static String escapeWhitespace(String s) {
- if (s == null) {
- return null;
- }
- s = s.replaceAll("\n", "\\\\n");
- s = s.replaceAll("\t", "\\\\t");
- s = s.replaceAll("\r", "\\\\r");
- s = s.replaceAll("\b", "\\\\b");
- s = s.replaceAll("\f", "\\\\f");
- return s;
- }
-
- /**
- * Concatenates the raw input of {@link Object}s separated by <code>delimiter</code>. On
- * each object {@link Object#toString()} is invoked.<br />
- * <code>null</code> values or those {@link Object#toString()} is empty are neglected.
- *
- * @param delimiter
- * @param values
- * @return never <code>null</code>, empty String in case no elements are appended
- * @since 3.8.1
- */
- public static String join(String delimiter, Object... parts) {
- if (parts == null || parts.length == 0) {
- return "";
- }
- boolean added = false;
- StringBuilder builder = new StringBuilder();
- for (Object o : parts) {
- if (o == null) {
- continue;
- }
- String s = o.toString();
- if (!isNullOrEmpty(s)) {
- if (added && delimiter != null) {
- builder.append(delimiter);
- }
- builder.append(s);
- added = true;
- }
- }
- return builder.toString();
- }
-
- /**
- * @see #join(String, Object...)
- */
- public static String join(String delimiter, Long[] parts) {
- return join(delimiter, (Object[]) parts);
- }
-
- /**
- * @see #join(String, Object...)
- * @since 3.8.1
- */
- public static String join(String delimiter, String[] parts) {
- return join(delimiter, (Object[]) parts);
- }
-
- /**
- * Boxes the string with the given prefix and suffix. The result is the empty
- * string, if the string to box has no text. <code>null</code> or empty
- * prefixes and suffixes are neglected.
- * <p>
- * <b>Example</b>: <code>box("(", "foo", ")");</code> returns <code>"(foo)"</code>.
- *
- * @param prefix
- * @param s
- * the string to box.
- * @param suffix
- * @return Returns the boxed value.
- */
- public static String box(String prefix, String s, String suffix) {
- StringBuilder builder = new StringBuilder();
- if (hasText(s)) {
- if (!isNullOrEmpty(prefix)) {
- builder.append(prefix);
- }
- builder.append(s);
- if (!isNullOrEmpty(suffix)) {
- builder.append(suffix);
- }
- }
- return builder.toString();
- }
-
- /**
- * removes all suffixes from the string, starting with the last one. Ignores case!
- * <p>
- * <b>Example</b>: <br>
- * <code>removeSuffixes("CompanyFormData","Form","Data")</code> will result in "Company"<br>
- * but <code>removeSuffixes("CompanyFormData","Data","Form")</code> will result in "CompanyForm"
- */
- public static String removeSuffixes(String s, String... suffixes) {
- for (int i = suffixes.length - 1; i >= 0; i--) {
- if (suffixes[i] != null) {
- if (s.toLowerCase().endsWith(suffixes[i].toLowerCase())) {
- s = s.substring(0, s.length() - suffixes[i].length());
- }
- }
- }
- return s;
- }
-
- public static byte[] compress(String s) {
- ByteArrayOutputStream buffer = new ByteArrayOutputStream();
- Deflater deflater = new Deflater(Deflater.BEST_COMPRESSION);
- DeflaterOutputStream deflaterOutputStream = new DeflaterOutputStream(buffer, deflater); // schreibt
- // die
- // komprimierten
- // Daten
- // in
- // den
- // Stream
- // buffer
- StringReader in = null;
- try {
- in = new StringReader(s);
-
- char[] c = new char[102400];
- int len;
- while ((len = in.read(c)) > 0) {
- String str = new String(c, 0, len);
- byte[] b = str.getBytes("UTF-8");
- deflaterOutputStream.write(b, 0, b.length);
- }
- }
- catch (IOException e) {
- LOG.warn(null, e);
- }
- finally {
- try {
- deflaterOutputStream.flush();
- }
- catch (IOException e) {
- }
- try {
- buffer.flush();
- }
- catch (IOException e) {
- }
- deflater.finish();
- try {
- deflaterOutputStream.finish();
- }
- catch (IOException e) {
- }
- deflater.end();
- try {
- deflaterOutputStream.close();
- }
- catch (IOException e) {
- }
- try {
- buffer.close();
- }
- catch (IOException e) {
- }
- if (in != null) {
- in.close();
- }
- }
-
- return buffer.toByteArray();
- }
-
- public static String decompress(byte[] compressed) {
- ByteArrayInputStream in = new ByteArrayInputStream(compressed);
- Inflater inflater = new Inflater();
- InflaterInputStream inflaterInputStream = new InflaterInputStream(in, inflater);
- StringWriter out = new StringWriter();
- try {
- InputStreamReader reader = new InputStreamReader(inflaterInputStream, "UTF-8");
- char[] b = new char[102400];
- int len;
- while ((len = reader.read(b)) > 0) {
- String str = new String(b, 0, len);
- out.write(str, 0, str.length());
- }
- }
- catch (IOException e) {
- LOG.warn(null, e);
- }
- finally {
- try {
- inflaterInputStream.close();
- }
- catch (IOException e) {
- }
- inflater.end();
- out.flush();
- try {
- in.close();
- }
- catch (IOException e) {
- }
- try {
- out.close();
- }
- catch (IOException e) {
- }
- }
-
- return out.toString();
- }
-
- /**
- * removes all prefixes from the string, starting with the first one. Ignores case!
- * <p>
- * <b>Example</b>: <br>
- * <code>removePrefixes("CompanyFormData","Company","Form")</code> will result in "Data"<br>
- * but <code>removePrefixes("CompanyFormData","Form","Company")</code> will result in "FormData"
- */
- public static String removePrefixes(String s, String... prefixes) {
- for (int i = 0; i < prefixes.length; i++) {
- if (prefixes[i] != null) {
- if (s.toLowerCase().startsWith(prefixes[i].toLowerCase())) {
- s = s.substring(prefixes[i].length());
- }
- }
- }
- return s;
- }
-
- /**
- * The String s0 will only be added, if it is not empty. String s1, s3, ...
- * are treated as delimeters and are only inserted, if the corresponding
- * String s2, s4, ... is not empty. <br>
- * If there is an even number of Strings, the
- * last one will only be appended, if the concatenated String so far is not <code>null</code>
- *
- * @param s
- * list of strings to append, s0 will be appended first, s1 only if
- * s2 is not empty, dito for s3 and s4 ..
- */
- public static String concatenateTokens(String... s) {
- String retVal = "";
- if (s != null && s.length > 0) {
- StringBuffer b = new StringBuffer();
- String suffix = s[0];
- if (suffix != null && suffix.trim().length() > 0) {
- b.append(suffix.trim());
- }
- for (int i = 1, l = s.length - 1; i < l; i = i + 2) {
- String del = s[i];
- suffix = s[i + 1];
- if (suffix != null && suffix.trim().length() > 0) {
- if (b.length() > 0) {
- b.append(del);
- }
- b.append(suffix.trim());
- }
- }
- retVal = b.toString().trim();
- if ((s.length % 2) == 0 && retVal.length() > 0) {
- retVal = retVal + s[s.length - 1];
- }
- }
- return retVal;
- }
-
- /**
- * Delegate to {@link ListUtility.parse(String text)}
- */
- public static Collection<Object> stringToCollection(String text) {
- return ListUtility.parse(text);
- }
-
- /**
- * Delegate to {@link ListUtility.format(Collection c)}
- */
- public static String collectionToString(Collection<Object> c) {
- return collectionToString(c, false);
- }
-
- /**
- * Delegate to {@link ListUtility.format(Collection c, boolean quoteStrings)}
- */
- public static String collectionToString(Collection<Object> c, boolean quoteStrings) {
- return ListUtility.format(c, quoteStrings);
- }
-
- /**
- * compare two strings using a locale-dependent {@link Collator}
- */
- public static int compareIgnoreCase(String a, String b) {
- return compareIgnoreCase(NlsUtility.getDefaultLocale(), a, b);
- }
-
- /**
- * compare two strings using a locale-dependent {@link Collator}
- */
- public static int compareIgnoreCase(Locale locale, String a, String b) {
- if (a != null && a.length() == 0) {
- a = null;
- }
- if (b != null && b.length() == 0) {
- b = null;
- }
- //
- if (a == b) {
- return 0;
- }
- if (a == null) {
- return -1;
- }
- if (b == null) {
- return 1;
- }
- Collator collator = Collator.getInstance(locale);
- collator.setStrength(Collator.SECONDARY);
- return collator.compare(a, b);
- }
-
- public static boolean STRING_INTERN_ENABLED = true;
-
- /**
- * Delegate for {@link String#intern()}.
- */
- public static String intern(String s) {
- if (STRING_INTERN_ENABLED) {
- return s != null ? s.intern() : null;
- }
- return s;
- }
-
- /**
- * <p>
- * Attempts to match the entire region against the regex.
- * </p>
- * <p>
- * <small>Thereby, the pattern works case-insensitive and in dot-all mode. See {@link Pattern for more information}
- * </small>
- * </p>
- *
- * @param s
- * @param regex
- * @return
- */
- public static boolean contains(String s, String regex) {
- if (s == null || regex == null) {
- return false;
- }
- try {
- Pattern pattern = Pattern.compile(".*" + regex + ".*", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL);
- return pattern.matcher(s).matches();
- }
- catch (Throwable t) {
- return false;
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.text.Collator;
+import java.util.Collection;
+import java.util.Locale;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.regex.PatternSyntaxException;
+import java.util.zip.Deflater;
+import java.util.zip.DeflaterOutputStream;
+import java.util.zip.Inflater;
+import java.util.zip.InflaterInputStream;
+
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.commons.nls.NlsUtility;
+
+public final class StringUtility {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(StringUtility.class);
+ public static final Pattern PATTERN_TRIM_NEWLINES = Pattern.compile("^[\r\n]*(.*?)[\r\n]*$", Pattern.DOTALL);
+
+ public static interface ITagProcessor {
+ String/* tagReplacement */processTag(String tagName, String tagContent);
+ }
+
+ private StringUtility() {
+ }
+
+ public static boolean isNullOrEmpty(String s) {
+ return s == null || s.length() == 0;
+ }
+
+ public static boolean hasText(String s) {
+ return s != null && !"".equals(s.trim());
+ }
+
+ /**
+ * Wildcard Pattern may contain only: wildcards: *,%,?,_ characters:<br>
+ * A-Z,a-z,0-9 % and * are replaced by .* ? and _ are replaced by . all
+ * invalid characters are also replaced by .
+ */
+ public static String toRegExPattern(String wildcardPattern) {
+ if (wildcardPattern == null) {
+ wildcardPattern = "";
+ }
+ StringBuffer buf = new StringBuffer();
+ char[] ch = wildcardPattern.toCharArray();
+ for (int i = 0; i < ch.length; i++) {
+ switch (ch[i]) {
+ case ' ': {
+ buf.append(ch[i]);
+ break;
+ }
+ case '*':
+ case '%': {
+ buf.append(".*");
+ break;
+ }
+ case '_':
+ case '?': {
+ buf.append(".");
+ break;
+ }
+ case '$':
+ case '@': {
+ buf.append(".");
+ break;
+ }
+ case '<':
+ case '>':
+ case '=': {
+ buf.append(ch[i]);
+ break;
+ }
+ case '.': {
+ buf.append("\\.");
+ break;
+ }
+ default: {
+ if (ch[i] >= 32 && (Character.isJavaIdentifierStart(ch[i]) || Character.isJavaIdentifierPart(ch[i]))) {
+ buf.append(ch[i]);
+ }
+ else {
+ buf.append('.');
+ }
+ }
+ }
+ }
+ if (buf.length() > 0) {
+ try {
+ return Pattern.compile(buf.toString()).pattern();
+ }
+ catch (PatternSyntaxException ex) {
+ return "INVALID_PATTERN";
+ }
+ }
+ else {
+ return ".*";
+ }
+ }
+
+ /**
+ * @param humanReadableFilterText
+ * is not a regex and may contain *,%,? as wildcards for searching
+ * @param patternFlags
+ * see {@link Pattern}
+ * @return a {@link Pattern} based on the input pattern. If the input pattern contains no '*' an '*' is automatically
+ * appended. If the input pattern is null or empty then '*' is used instead
+ * @since 3.8
+ */
+ public static Pattern toRegEx(String humanReadableFilterText, int patternFlags) {
+ if (humanReadableFilterText == null) {
+ humanReadableFilterText = "";
+ }
+ if (humanReadableFilterText.indexOf('*') < 0) {
+ humanReadableFilterText += "*";
+ }
+ return Pattern.compile(StringUtility.toRegExPattern(humanReadableFilterText), patternFlags);
+ }
+
+ /**
+ * Tokenize a String s by given character c. Take care about empty String
+ * between two separating chars. {@link java.util.StringTokenizer} does not
+ * care about empty string between separating chars.
+ *
+ * @param s
+ * String to tokenize.
+ * @param c
+ * Separating character.
+ * @return given String s tokenized by c.
+ */
+ public static String[] tokenize(String s, char c) {
+ if (s == null) {
+ return new String[0];
+ }
+ char[] cA = s.toCharArray();
+ int count = 0;
+ for (int i = 0; i < cA.length; i++) {
+ if (cA[i] == c) {
+ count++;
+ }
+ }
+ String[] returnValue = new String[count + 1];
+ int nextCindex = s.indexOf(c);
+ /*
+ * LOOP INV: nextCindex points to next index of c in s AND s is String to be
+ * tokenized AND returnValue contains already tokenized Strings
+ */
+ count = 0;
+ while (nextCindex >= 0) {
+ returnValue[count++] = s.substring(0, nextCindex);
+ s = s.substring(nextCindex + 1);
+ nextCindex = s.indexOf(c);
+ }
+ returnValue[count++] = s;
+ return returnValue;
+ }
+
+ public static boolean parseBoolean(String s, boolean defaultValue) {
+ if (s == null || s.length() == 0) {
+ return defaultValue;
+ }
+ s = s.toLowerCase().trim();
+ if (defaultValue) {
+ return !("0,false,no".indexOf(s) >= 0);
+ }
+ else {
+ return "1,true,yes".indexOf(s) >= 0;
+ }
+ }
+
+ public static boolean parseBoolean(String s) {
+ return parseBoolean(s, false);
+ }
+
+ /**
+ * @return the number of lines in the string s empty and null strings have 0
+ * lines
+ * @since Build 153
+ */
+ public static int getLineCount(String s) {
+ if (s == null || s.length() == 0) {
+ return 0;
+ }
+ int r = 1;
+ int pos = 0;
+ while ((pos = s.indexOf('\n', pos)) >= 0) {
+ r++;
+ // next
+ pos++;
+ }
+ return r;
+ }
+
+ /**
+ * @return the lines in the string s empty and null strings have 0 lines
+ * @since Build 153
+ */
+ public static String[] getLines(String s) {
+ int count = getLineCount(s);
+ String[] lines = new String[count];
+ if (count == 0) {
+ return lines;
+ }
+ int index = 0;
+ int begin = 0;
+ int pos = 0;
+ while ((pos = s.indexOf('\n', pos)) >= 0) {
+ String unit = s.substring(begin, pos);
+ int ulen = unit.length();
+ if (ulen > 0 && unit.charAt(0) == '\r') {
+ unit = unit.substring(1);
+ }
+ ulen = unit.length();
+ if (ulen > 0 && unit.charAt(ulen - 1) == '\r') {
+ unit = unit.substring(0, ulen - 1);
+ }
+ ulen = unit.length();
+ lines[index] = unit;
+ // next
+ pos++;
+ index++;
+ begin = pos;
+ }
+ lines[index] = s.substring(begin);
+ return lines;
+ }
+
+ /**
+ * encode a string by escaping " -> "" and ' -> ''
+ */
+ public static String stringEsc(String s) {
+ if (s == null) {
+ return null;
+ }
+ s = s.replaceAll("[\"]", "\"\"");
+ s = s.replaceAll("[']", "''");
+ return s;
+ }
+
+ /**
+ * decode a string by unescaping "" -> " and '' -> '
+ */
+ public static String stringUnesc(String s) {
+ s = s.replaceAll("[\"][\"]", "\"");
+ s = s.replaceAll("['][']", "'");
+ return s;
+ }
+
+ public static String removeMnemonic(String text) {
+ if (text == null) {
+ return null;
+ }
+ Matcher m = MNEMONIC_PATTERN.matcher(text);
+ return m.replaceAll("$1");
+ }
+
+ /**
+ * Returns a new string resulting from replacing all new line characters ("\n", "\r\n", "\n\r" or "\r") with a single
+ * blank (" ").
+ * <p>
+ * Examples:
+ *
+ * <pre>
+ * "a\r\nb" -> "a b"
+ * "a\nb" -> "a b"
+ * </pre>
+ *
+ * </p>
+ *
+ * @param text
+ * the {@link String} thats new line characters should be removed
+ * @return a string derived from this string by replacing every occurrence of new line character with a
+ * blank.
+ */
+ public static String removeNewLines(String text) {
+ return replaceNewLines(text, " ");
+ }
+
+ /**
+ * Returns a new string resulting from replacing all new line characters ("\n", "\r\n", "\n\r" or "\r") with the given
+ * replacement string.
+ *
+ * @param text
+ * the {@link String} thats new line characters should be removed
+ * @param replacement
+ * the {@link String} to be used as replacement for the new line characters
+ * @return a string derived from this string by replacing every occurrence of new line character with the replacement
+ * string.
+ */
+ public static String replaceNewLines(String text, String replacement) {
+ if (isNullOrEmpty(text)) {
+ return text;
+ }
+ String s = text.replaceAll("\r\n|\n\r", replacement);
+ s = s.replace("\n", replacement).replace("\r", replacement);
+ return s;
+ }
+
+ /**
+ * @return a single tag <foo/>
+ */
+ private static TagBounds getSingleTag(String text, String tagName, int pos) {
+ if (text == null) {
+ return TAG_BOUNDS_NOT_FOUND;
+ }
+ Pattern pat = Pattern.compile("<" + tagName + "(\\s[^<>]*)?/>", Pattern.DOTALL);
+ Matcher m = pat.matcher(text);
+ if (m.find(pos)) {
+ return new TagBounds(m.start(), m.end());
+ }
+ return TAG_BOUNDS_NOT_FOUND;
+ }
+
+ /**
+ * @return a start tag (ignores single tags) <foo> (not <foo/>)
+ */
+ private static TagBounds getStartTag(String text, String tagName, int pos) {
+ if (text == null) {
+ return TAG_BOUNDS_NOT_FOUND;
+ }
+ Pattern pat = Pattern.compile("<" + tagName + "(\\s[^<>]*[^/])?>", Pattern.DOTALL);
+ Matcher m = pat.matcher(text);
+ if (m.find(pos)) {
+ return new TagBounds(m.start(), m.end());
+ }
+ return TAG_BOUNDS_NOT_FOUND;
+ }
+
+ /**
+ * @return an end tag </foo>
+ */
+ private static TagBounds getEndTag(String text, String tagName, int pos) {
+ if (text == null) {
+ return TAG_BOUNDS_NOT_FOUND;
+ }
+ Pattern pat = Pattern.compile("</" + tagName + ">");
+ Matcher m = pat.matcher(text);
+ if (m.find(pos)) {
+ return new TagBounds(m.start(), m.end());
+ }
+ return TAG_BOUNDS_NOT_FOUND;
+ }
+
+ /**
+ * @return the contents between a start and a end tag, resp "" when there is a single tag
+ */
+ public static String getTag(String text, String tagName) {
+ if (text == null) {
+ return null;
+ }
+ TagBounds a;
+ TagBounds b;
+ if ((a = getStartTag(text, tagName, 0)).begin >= 0 && (b = getEndTag(text, tagName, a.end)).begin >= 0) {
+ return text.substring(a.end, b.begin).trim();
+ }
+ if ((a = getSingleTag(text, tagName, 0)).begin >= 0) {
+ return "";
+ }
+ return null;
+ }
+
+ public static String replaceTags(String text, String tagName, final String replacement) {
+ return replaceTags(text, tagName, new ITagProcessor() {
+ @Override
+ public String processTag(String name, String tagContent) {
+ return replacement;
+ }
+ });
+ }
+
+ /**
+ * tag processor returns the replacement for every tag
+ * <p>
+ * the tag content is either "" for single tags or the tag content else
+ * <p>
+ * be careful to not replace the tag again with the tag, this will result in an endless loop
+ */
+ public static String replaceTags(String text, String tagName, ITagProcessor processor) {
+ if (text == null) {
+ return null;
+ }
+ TagBounds a;
+ TagBounds b;
+ while ((a = getSingleTag(text, tagName, 0)).begin >= 0) {
+ String tagContent = "";
+ String replacement = processor.processTag(tagName, tagContent);
+ text = text.substring(0, a.begin) + replacement + text.substring(a.end);
+ }
+ while ((a = getStartTag(text, tagName, 0)).begin >= 0 && (b = getEndTag(text, tagName, a.end)).begin >= 0) {
+ String tagContent = text.substring(a.end, b.begin);
+ String replacement = processor.processTag(tagName, tagContent);
+ text = text.substring(0, a.begin) + replacement + text.substring(b.end);
+ }
+ return text;
+ }
+
+ public static String removeTag(String text, String tagName) {
+ if (text == null) {
+ return null;
+ }
+ TagBounds a;
+ TagBounds b;
+ while ((a = getSingleTag(text, tagName, 0)).begin >= 0) {
+ text = text.substring(0, a.begin) + text.substring(a.end);
+ }
+ while ((a = getStartTag(text, tagName, 0)).begin >= 0 && (b = getEndTag(text, tagName, a.end)).begin >= 0) {
+ text = text.substring(0, a.begin) + text.substring(b.end);
+ }
+ return text;
+ }
+
+ public static String removeTags(String text, String[] tagNames) {
+ if (text == null) {
+ return null;
+ }
+ for (int i = 0; i < tagNames.length; i++) {
+ text = removeTag(text, tagNames[i]);
+ }
+ return text;
+ }
+
+ public static String removeTags(String text) {
+ if (text == null) {
+ return null;
+ }
+ text = Pattern.compile("<[^>]+>", Pattern.DOTALL).matcher(text).replaceAll("");
+ return text;
+ }
+
+ public static String removeTagBounds(String text, String tagName) {
+ if (text == null) {
+ return null;
+ }
+ TagBounds a;
+ TagBounds b;
+ while ((a = getSingleTag(text, tagName, 0)).begin >= 0) {
+ text = text.substring(0, a.begin) + text.substring(a.end);
+ }
+ while ((a = getStartTag(text, tagName, 0)).begin >= 0 && (b = getEndTag(text, tagName, a.end)).begin >= 0) {
+ text = text.substring(0, a.begin) + text.substring(a.end, b.begin) + text.substring(b.end);
+ }
+ return text;
+ }
+
+ public static String replaceTagBounds(String text, String tagName, String start, String end) {
+ if (text == null) {
+ return null;
+ }
+ TagBounds a;
+ int b;
+ int startPos = 0;
+ while (startPos < text.length() && (a = getStartTag(text, tagName, startPos)).begin >= 0 && (b = text.indexOf("</" + tagName + ">", a.end)) > 0) {
+ text =
+ text.substring(0, a.begin) +
+ start +
+ text.substring(a.end, b) +
+ end +
+ text.substring(b + tagName.length() + 3);
+ //next
+ startPos = a.begin + start.length();
+ }
+ return text;
+ }
+
+ public static final Pattern MNEMONIC_PATTERN = Pattern.compile("\\&([-?_.,a-zA-Z0-9])", Pattern.DOTALL);
+
+ public static char getMnemonic(String text) {
+ if (text == null) {
+ return 0x0;
+ }
+ Matcher m = MNEMONIC_PATTERN.matcher(text);
+ if (m.find()) {
+ return m.group(1).charAt(0);
+ }
+ return 0x0;
+ }
+
+ public static String wrapText(String s, int lineSize) {
+ if (s == null) {
+ return null;
+ }
+ StringBuffer buf = new StringBuffer();
+ if (s != null) {
+ char[] ch = s.toCharArray();
+ int col = 0;
+ for (int i = 0; i < ch.length; i++) {
+ if (ch[i] == '\n' || ch[i] == '\r') {
+ col = 0;
+ buf.append(ch[i]);
+ }
+ else {
+ col++;
+ if (col > lineSize) {
+ buf.append('\n');
+ col = 1;
+ }
+ buf.append(ch[i]);
+ }
+ }
+ }
+ return buf.toString();
+ }
+
+ public static String wrapWord(String s, int lineSize) {
+ if (s == null) {
+ return null;
+ }
+ StringBuffer buf = new StringBuffer();
+ for (String line : s.split("[\\n\\r]")) {
+ if (buf.length() > 0) {
+ buf.append("\n");
+ }
+ StringBuffer wrappedLine = new StringBuffer();
+ for (String word : line.split("[ \\t]")) {
+ if (wrappedLine.length() > 0 && wrappedLine.length() + 1 + word.length() > lineSize) {
+ buf.append(wrappedLine.toString());
+ buf.append("\n");
+ wrappedLine.setLength(0);
+ }
+ if (wrappedLine.length() > 0) {
+ wrappedLine.append(" ");
+ }
+ wrappedLine.append(word);
+ }
+ if (wrappedLine.length() > 0) {
+ buf.append(wrapText(wrappedLine.toString(), lineSize));
+ }
+ }
+ return buf.toString().trim();
+ }
+
+ public static String unwrapText(String s) {
+ if (s == null || s.length() == 0) {
+ return null;
+ }
+ s = s.replace('\n', ' ').replace('\r', ' ').replace('\t', ' ');
+ s = s.replaceAll("[ ]+", " ");
+ return s.trim();
+ }
+
+ public static boolean isQuotedText(String s) {
+ if (s == null || s.length() == 0) {
+ return false;
+ }
+ if (s.charAt(0) == '\'' && s.charAt(s.length() - 1) == '\'') {
+ return true;
+ }
+ else if (s.charAt(0) == '"' && s.charAt(s.length() - 1) == '"') {
+ return true;
+ }
+ return false;
+ }
+
+ public static String unquoteText(String s) {
+ if (s == null || s.length() == 0) {
+ return null;
+ }
+ if (s.charAt(0) == '\'' && s.charAt(s.length() - 1) == '\'') {
+ s = s.substring(1, s.length() - 1);
+ }
+ else if (s.charAt(0) == '"' && s.charAt(s.length() - 1) == '"') {
+ s = s.substring(1, s.length() - 1);
+ }
+ return s;
+ }
+
+ public static String valueOf(Object o) {
+ if (o == null) {
+ return "";
+ }
+ if (o instanceof byte[]) {
+ return new String((byte[]) o);
+ }
+ if (o instanceof char[]) {
+ return new String((char[]) o);
+ }
+ return o.toString();
+ }
+
+ public static String className(Object o) {
+ if (o == null) {
+ return "";
+ }
+ String s = o.getClass().getName();
+ int i = s.lastIndexOf('.');
+ if (i >= 0) {
+ return s.substring(i + 1);
+ }
+ else {
+ return s;
+ }
+ }
+
+ /*
+ * Converts unicodes to encoded &#92;uxxxx and writes out any of the
+ * characters in specialSaveChars with a preceding slash
+ */
+ private static final String CONVERT_UTF_ASCII_HEX_CHARS = "0123456789abcdef";
+
+ public static String convertUTFAscii(String s, boolean escapeControlChars) {
+ if (s == null || s.length() == 0) {
+ return s;
+ }
+ int len = s.length();
+ StringBuffer buf = new StringBuffer(len * 2);
+ for (int i = 0; i < len; i++) {
+ char ch = s.charAt(i);
+ switch (ch) {
+ case '\\':
+ buf.append("\\\\");
+ break;
+ case '\t':
+ if (escapeControlChars) {
+ buf.append("\\t");
+ }
+ else {
+ buf.append(ch);
+ }
+ break;
+ case '\n':
+ if (escapeControlChars) {
+ buf.append("\\n");
+ }
+ else {
+ buf.append(ch);
+ }
+ break;
+ case '\r':
+ if (escapeControlChars) {
+ buf.append("\\r");
+ }
+ else {
+ buf.append(ch);
+ }
+ break;
+ case '\f':
+ if (escapeControlChars) {
+ buf.append("\\f");
+ }
+ else {
+ buf.append(ch);
+ }
+ break;
+ default:
+ if ((ch < 0x0020) || (ch > 0x007e)) {
+ buf.append('\\');
+ buf.append('u');
+ buf.append(CONVERT_UTF_ASCII_HEX_CHARS.charAt((ch >> 12) & 0xF));
+ buf.append(CONVERT_UTF_ASCII_HEX_CHARS.charAt((ch >> 8) & 0xF));
+ buf.append(CONVERT_UTF_ASCII_HEX_CHARS.charAt((ch >> 4) & 0xF));
+ buf.append(CONVERT_UTF_ASCII_HEX_CHARS.charAt(ch & 0xF));
+ }
+ else {
+ buf.append(ch);
+ }
+ }// end switch
+ }// end for
+ return buf.toString();
+ }
+
+ /*
+ * Converts encoded &#92;uxxxx to unicode chars and changes special saved
+ * chars to their original forms
+ */
+ public static String convertAsciiUTF(String s) {
+ if (s == null || s.length() == 0) {
+ return s;
+ }
+ char ch;
+ int len = s.length();
+ StringBuffer buf = new StringBuffer(len);
+
+ for (int k = 0; k < len;) {
+ ch = s.charAt(k++);
+ if (ch == '\\') {
+ ch = s.charAt(k++);
+ if (ch == 'u') {
+ // Read the xxxx
+ int value = Integer.parseInt(s.substring(k, k + 4), 16);
+ k = k + 4;
+ buf.append((char) value);
+ }// end if u
+ else {
+ switch (ch) {
+ case '\\':
+ buf.append('\\');
+ break;
+ case 't':
+ buf.append('\t');
+ break;
+ case 'r':
+ buf.append('\r');
+ break;
+ case 'n':
+ buf.append('\n');
+ break;
+ case 'f':
+ buf.append('\f');
+ break;
+ default:
+ buf.append(ch);
+ }
+ }// end else
+ }// end if escape
+ else {
+ buf.append(ch);
+ }// end if else
+ }// end for k
+ return buf.toString();
+ }
+
+ public static String emptyIfNull(Object o) {
+ return o == null ? "" : o.toString();
+ }
+
+ public static String chr(int code) {
+ return "" + ((char) Math.min(Math.max(code, 0), 255));
+ }
+
+ public static int asc(String s) {
+ if (s == null || s.length() == 0) {
+ return 0;
+ }
+ else {
+ return s.charAt(0);
+ }
+ }
+
+ public static byte[] hexToBytes(String s) {
+ if (s == null) {
+ return new byte[0];
+ }
+ int slen = s.length();
+ byte[] a = new byte[slen / 2];
+ for (int i = 0; i < slen; i = i + 2) {
+ a[i / 2] = (byte) Integer.parseInt(s.substring(i, i + 2), 16);
+ }
+ return a;
+ }
+
+ public static String bytesToHex(byte[] a) {
+ if (a == null || a.length == 0) {
+ return null;
+ }
+ StringBuffer buf = new StringBuffer(a.length * 2);
+ int hi, lo;
+ for (int i = 0; i < a.length; i++) {
+ lo = (a[i]) & 0xff;
+ hi = (lo >> 4);
+ lo = lo & 0x0f;
+ buf.append(Integer.toHexString(hi));
+ buf.append(Integer.toHexString(lo));
+ }
+ return buf.toString();
+ }
+
+ /**
+ * remove all \n, \r, \t and make all multiple spaces single space
+ */
+ public static String cleanup(String s) {
+ return unwrapText(s);
+ }
+
+ /**
+ * decision function: return DECODE(value,test1,result1,test2,result2,....,defaultResult)
+ * <p>
+ * decode('B','A',1,'B',2,'C',3,-1) --> 'B'
+ */
+ public static Object decode(Object... a) {
+ Object ref = a[0];
+ for (int i = 1, n = a.length; i < n; i = i + 2) {
+ if (i + 1 < n) {// test-value and result-value
+ Object test = a[i];
+ if (ref == test || (ref != null && ref.equals(test))) {
+ return a[i + 1];
+ }
+ }
+ else {// default result value
+ return a[i];
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @return encoded text, ready to be included in a html text
+ * <xmp>replaces &, ", ', <, > and all whitespace</xmp>
+ */
+ public static String htmlEncode(String s) {
+ return htmlEncode(s, false);
+ }
+
+ public static String htmlEncode(String s, boolean replaceSpace) {
+ if (s == null) {
+ return s;
+ }
+ if (s.length() == 0) {
+ return s;
+ }
+ s = s.replace("&", "&amp;");
+ s = s.replace("\"", "&quot;");
+ s = s.replace("'", "&#39;");
+ s = s.replace("<", "&lt;");
+ s = s.replace(">", "&gt;");
+ s = s.replace("\n\r", "<br/>");
+ s = s.replace("\n", "<br/>");
+
+ // temporarily replace tabs with specific tab-identifier to not be replaced by subsequent whitespace pattern
+ String tabIdentifier = "#TAB#";
+ s = s.replace("\t", tabIdentifier);
+
+ if (replaceSpace) {
+ s = s.replaceAll("\\s", "&nbsp;");
+ }
+ s = s.replace(tabIdentifier, "<span style=\"white-space:pre\">&#9;</span>");
+ return s;
+ }
+
+ /**
+ * @return decoded text, ready to be printed as text
+ * <xmp>replaces &, ", ', <, > and all whitespace</xmp>
+ */
+ public static String htmlDecode(String s) {
+ if (s == null || s.length() == 0) {
+ return s;
+ }
+
+ s = s.replace("&nbsp;", " ");
+ s = s.replace("&quot;", "\"");
+ s = s.replace("&apos;", "'");
+ s = s.replace("&#39;", "'");
+ s = s.replace("&lt;", "<");
+ s = s.replace("&gt;", ">");
+ s = s.replace("&amp;", "&");
+
+ // whitespace patterns
+ String zeroOrMoreWhitespaces = "\\s*?";
+ String oneOrMoreWhitespaces = "\\s+?";
+
+ // replace <br/> by \n
+ s = s.replaceAll("<" + zeroOrMoreWhitespaces + "br" + zeroOrMoreWhitespaces + "/" + zeroOrMoreWhitespaces + ">", "\n");
+ // replace HTML-tabs by \t
+ s = s.replaceAll("<" + zeroOrMoreWhitespaces + "span" + oneOrMoreWhitespaces + "style" + zeroOrMoreWhitespaces + "=" + zeroOrMoreWhitespaces + "\"white-space:pre\"" + zeroOrMoreWhitespaces + ">&#9;<" + zeroOrMoreWhitespaces + "/" + zeroOrMoreWhitespaces + "span" + zeroOrMoreWhitespaces + ">", "\t");
+
+ return s;
+ }
+
+ public static boolean equalsIgnoreCase(String a, String b) {
+ if (a == null) {
+ a = "";
+ }
+ if (b == null) {
+ b = "";
+ }
+ return a.equalsIgnoreCase(b);
+ }
+
+ public static boolean notEequalsIgnoreCase(String a, String b) {
+ if (a == null) {
+ a = "";
+ }
+ if (b == null) {
+ b = "";
+ }
+ return !a.equalsIgnoreCase(b);
+ }
+
+ public static final Pattern NEWLINE_PATTERN = Pattern.compile("[\\n\\r]+");
+
+ public static boolean equalsIgnoreNewLines(String a, String b) {
+ if (a == b) {
+ return true;
+ }
+ if (a == null) {
+ return false;
+ }
+ if (b == null) {
+ return false;
+ }
+ return NEWLINE_PATTERN.matcher(a).replaceAll(" ").equals(NEWLINE_PATTERN.matcher(b).replaceAll(" "));
+ }
+
+ /**
+ * converts all non-allowed characters in the text to the text contained in
+ * replacementText
+ * <p>
+ * <b>Example</b>: <code>filterText("test-text/info.12345","a-zA-Z0-2","_")</code> yields "test_text_info12___" <br>
+ * since JRE 1.5 same as: <code>"test-text/info.12345".replaceAll("[^a-zA-Z0-2]","_")</code>
+ */
+ public static String filterText(String text, String allowedCharacters, String replacementText) {
+ if (text == null || allowedCharacters == null) {
+ return text;
+ }
+ if (replacementText == null) {
+ replacementText = "";
+ }
+ return text.replaceAll("[^" + allowedCharacters + "]", replacementText);
+ }
+
+ public static int find(String s, String what) {
+ return find(s, what, 0);
+ }
+
+ public static int find(String s, String what, int start) {
+ if (s == null || start >= s.length()) {
+ return -1;
+ }
+ return s.indexOf(what, start);
+ }
+
+ /**
+ * Format phone numbers (to international phone number format - eg +41 41 882
+ * 32 21)
+ *
+ * @since
+ * @param phoneNumber
+ * Unformatted/Formatted phone number with optional country code.
+ * Brackets for area code and special characters (like -) for local
+ * number is supported.
+ * @param formattingPattern
+ * Defines the format of the phone number (eg. ## ### ## ## for 41
+ * 841 44 44). The formattingPattern must not include the country
+ * code.
+ * @param countryCode
+ * Country code (+41, 0041, 41)
+ * @return If the phone number does not match the formatting pattern the
+ * original phone number will be returned. Otherwise the formatted
+ * phone number will be returned.
+ */
+ public static String formatPhone(String phoneNumber, String formattingPattern, String countryCode) {
+ if (phoneNumber == null) {
+ return null;
+ }
+ if (formattingPattern == null) {
+ return phoneNumber;
+ }
+ if (countryCode == null) {
+ return phoneNumber;
+ }
+
+ // declare local variables
+ int numberPattern = "#".charAt(0);
+ String formattedPhoneNumber = "";
+ String normalizedNumber;
+ boolean patternIsMatching = false;
+ boolean hasCountryCode = false;
+
+ // calc. pattern lenght without spaces, etc.
+ int patternLengh = formattingPattern.replaceAll("[^#]", "").length();
+
+ /* normalize phone number */
+ normalizedNumber = phoneNumber.replaceAll("[^(0-9|\\+)]|(\\(|\\))", "");
+
+ // check for country code
+ hasCountryCode = normalizedNumber.matches("(^(0{2})[0-9]*)|(^\\+{1}[0-9]*)");
+
+ /* normalize country code (no spaces; no leading +/00 */
+ countryCode = countryCode.replaceAll("[^0-9]", "");
+ countryCode = countryCode.replaceAll("^(0{0,2})", "");
+
+ // phone number has country code
+ if (hasCountryCode) {
+ // remove country code
+ normalizedNumber = normalizedNumber.replaceAll("^(0{0,2})", "");
+ normalizedNumber = normalizedNumber.replaceAll("^(\\+)", "");
+ normalizedNumber = normalizedNumber.replaceAll("^" + countryCode, "");
+ }
+
+ // add leading zeros of the area code. is required for a propper matching
+ // with the pattern
+ if (patternLengh == normalizedNumber.length() + 1 && !normalizedNumber.startsWith("0")) {
+ normalizedNumber = "0" + normalizedNumber;
+ patternIsMatching = true;
+
+ // normalized phone number is matching pattern
+ }
+ else if (patternLengh == normalizedNumber.length()) {
+ patternIsMatching = true;
+ }
+
+ // format the normalized phone number
+ if (patternIsMatching) {
+ int count = 0;
+ for (int i = 0; i < formattingPattern.length(); i++) {
+ if (formattingPattern.charAt(i) == numberPattern) {
+ if (count < normalizedNumber.length()) {
+ formattedPhoneNumber += normalizedNumber.charAt(count);
+ count++;
+ }
+ }
+ else {
+ formattedPhoneNumber += formattingPattern.charAt(i);
+ }
+ }
+
+ // remove zeros of the area code
+ formattedPhoneNumber = formattedPhoneNumber.replaceAll("^[0]+", "");
+ // add country code
+ formattedPhoneNumber = "+" + countryCode + " " + formattedPhoneNumber;
+
+ }
+ else {
+ // do nothing
+ formattedPhoneNumber = phoneNumber;
+ }
+
+ return formattedPhoneNumber;
+ }
+
+ public static int length(String s) {
+ if (s == null) {
+ return 0;
+ }
+ else {
+ return s.length();
+ }
+ }
+
+ public static String lowercase(String s) {
+ if (s == null) {
+ return null;
+ }
+ else {
+ return s.toLowerCase();
+ }
+ }
+
+ public static String uppercase(String s) {
+ if (s == null) {
+ return null;
+ }
+ else {
+ return s.toUpperCase();
+ }
+ }
+
+ public static String[] split(String s, String regex) {
+ if (s == null || s.length() == 0) {
+ return new String[0];
+ }
+ return s.split(regex);
+ }
+
+ public static String substring(String s, int start) {
+ if (s == null || start >= s.length()) {
+ return "";
+ }
+ return s.substring(start);
+ }
+
+ public static String substring(String s, int start, int len) {
+ if (s == null || start >= s.length()) {
+ return "";
+ }
+ len = Math.min(s.length() - start, len);
+ return s.substring(start, start + len);
+ }
+
+ public static String trim(String s) {
+ if (s == null) {
+ return null;
+ }
+ return s.trim();
+ }
+
+ /**
+ * Returns a copy of the {@link String} with leading and trailing newlines omitted.
+ *
+ * @param s
+ * @return
+ */
+ public static String trimNewLines(String s) {
+ if (s == null) {
+ return null;
+ }
+ Matcher matcher = PATTERN_TRIM_NEWLINES.matcher(s);
+ if (matcher.find()) {
+ s = matcher.group(1);
+ }
+ return s;
+ }
+
+ public static String lpad(String s, String fill, int len) {
+ if (s == null || fill == null || s.length() >= len || fill.length() == 0) {
+ return s;
+ }
+ StringBuffer buf = new StringBuffer(s);
+ while (buf.length() < len) {
+ buf.insert(0, fill);
+ }
+ return buf.substring(buf.length() - len, buf.length());
+ }
+
+ public static String rpad(String s, String fill, int len) {
+ if (s == null || fill == null || s.length() >= len || fill.length() == 0) {
+ return s;
+ }
+ StringBuffer buf = new StringBuffer(s);
+ while (buf.length() < len) {
+ buf.append(fill);
+ }
+ return buf.substring(0, len);
+ }
+
+ public static String ltrim(String s, Character c) {
+ if (s == null) {
+ return null;
+ }
+ if (c == null) {
+ return s;
+ }
+ int len = s.length();
+ int st = 0;
+ char[] val = s.toCharArray();
+ while ((st < len) && (val[st] == c)) {
+ st++;
+ }
+ return ((st > 0) || (len < s.length())) ? s.substring(st, len) : s;
+ }
+
+ public static String rtrim(String s, Character c) {
+ if (s == null) {
+ return null;
+ }
+ if (c == null) {
+ return s;
+ }
+ int len = s.length();
+ int st = 0;
+ char[] val = s.toCharArray();
+ while ((st < len) && (val[len - 1] == c)) {
+ len--;
+ }
+ return ((st > 0) || (len < s.length())) ? s.substring(st, len) : s;
+ }
+
+ public static String nvl(Object value, String valueWhenNull) {
+ if (value != null) {
+ return value.toString();
+ }
+ else {
+ return valueWhenNull;
+ }
+ }
+
+ /**
+ * replace plain text without using regex
+ */
+ public static String replace(String s, String sOld, String sNew) {
+ sNew = (sNew == null ? "" : sNew);
+ if (s == null || sOld == null) {
+ return s;
+ }
+ return s.replace(sOld, sNew);
+ }
+
+ /**
+ * replace plain text without using regex, ignoring case
+ */
+ public static String replaceNoCase(String s, String sOld, String sNew) {
+ if (s == null || sOld == null || sNew == null) {
+ return s;
+ }
+ StringBuffer buf = new StringBuffer();
+ int oldLen = sOld.length();
+ int pos = 0;
+ sOld = sOld.toLowerCase();
+ String sLower = s.toLowerCase();
+ int i = sLower.indexOf(sOld);
+ while (i >= 0) {
+ buf.append(s.substring(pos, i));
+ buf.append(sNew);
+ pos = i + oldLen;
+ i = sLower.indexOf(sOld, pos);
+ }
+ buf.append(s.substring(pos));
+ return buf.toString();
+ }
+
+ private static class TagBounds {
+ final int begin;
+ final int end;
+
+ public TagBounds(int begin, int end) {
+ this.begin = begin;
+ this.end = end;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o instanceof TagBounds) {
+ return ((TagBounds) o).begin == begin && ((TagBounds) o).end == end;
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return begin ^ end;
+ }
+ }
+
+ private static final TagBounds TAG_BOUNDS_NOT_FOUND = new TagBounds(-1, -1);
+
+ public static String unescapeWhitespace(String s) {
+ if (s == null) {
+ return null;
+ }
+ s = s.replaceAll("\\\\n", "\n");
+ s = s.replaceAll("\\\\t", "\t");
+ s = s.replaceAll("\\\\r", "\r");
+ s = s.replaceAll("\\\\b", "\b");
+ s = s.replaceAll("\\\\f", "\f");
+ return s;
+ }
+
+ public static String escapeWhitespace(String s) {
+ if (s == null) {
+ return null;
+ }
+ s = s.replaceAll("\n", "\\\\n");
+ s = s.replaceAll("\t", "\\\\t");
+ s = s.replaceAll("\r", "\\\\r");
+ s = s.replaceAll("\b", "\\\\b");
+ s = s.replaceAll("\f", "\\\\f");
+ return s;
+ }
+
+ /**
+ * Concatenates the raw input of {@link Object}s separated by <code>delimiter</code>. On
+ * each object {@link Object#toString()} is invoked.<br />
+ * <code>null</code> values or those {@link Object#toString()} is empty are neglected.
+ *
+ * @param delimiter
+ * @param values
+ * @return never <code>null</code>, empty String in case no elements are appended
+ * @since 3.8.1
+ */
+ public static String join(String delimiter, Object... parts) {
+ if (parts == null || parts.length == 0) {
+ return "";
+ }
+ boolean added = false;
+ StringBuilder builder = new StringBuilder();
+ for (Object o : parts) {
+ if (o == null) {
+ continue;
+ }
+ String s = o.toString();
+ if (!isNullOrEmpty(s)) {
+ if (added && delimiter != null) {
+ builder.append(delimiter);
+ }
+ builder.append(s);
+ added = true;
+ }
+ }
+ return builder.toString();
+ }
+
+ /**
+ * @see #join(String, Object...)
+ */
+ public static String join(String delimiter, Long[] parts) {
+ return join(delimiter, (Object[]) parts);
+ }
+
+ /**
+ * @see #join(String, Object...)
+ * @since 3.8.1
+ */
+ public static String join(String delimiter, String[] parts) {
+ return join(delimiter, (Object[]) parts);
+ }
+
+ /**
+ * Boxes the string with the given prefix and suffix. The result is the empty
+ * string, if the string to box has no text. <code>null</code> or empty
+ * prefixes and suffixes are neglected.
+ * <p>
+ * <b>Example</b>: <code>box("(", "foo", ")");</code> returns <code>"(foo)"</code>.
+ *
+ * @param prefix
+ * @param s
+ * the string to box.
+ * @param suffix
+ * @return Returns the boxed value.
+ */
+ public static String box(String prefix, String s, String suffix) {
+ StringBuilder builder = new StringBuilder();
+ if (hasText(s)) {
+ if (!isNullOrEmpty(prefix)) {
+ builder.append(prefix);
+ }
+ builder.append(s);
+ if (!isNullOrEmpty(suffix)) {
+ builder.append(suffix);
+ }
+ }
+ return builder.toString();
+ }
+
+ /**
+ * removes all suffixes from the string, starting with the last one. Ignores case!
+ * <p>
+ * <b>Example</b>: <br>
+ * <code>removeSuffixes("CompanyFormData","Form","Data")</code> will result in "Company"<br>
+ * but <code>removeSuffixes("CompanyFormData","Data","Form")</code> will result in "CompanyForm"
+ */
+ public static String removeSuffixes(String s, String... suffixes) {
+ for (int i = suffixes.length - 1; i >= 0; i--) {
+ if (suffixes[i] != null) {
+ if (s.toLowerCase().endsWith(suffixes[i].toLowerCase())) {
+ s = s.substring(0, s.length() - suffixes[i].length());
+ }
+ }
+ }
+ return s;
+ }
+
+ public static byte[] compress(String s) {
+ ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+ Deflater deflater = new Deflater(Deflater.BEST_COMPRESSION);
+ DeflaterOutputStream deflaterOutputStream = new DeflaterOutputStream(buffer, deflater); // schreibt
+ // die
+ // komprimierten
+ // Daten
+ // in
+ // den
+ // Stream
+ // buffer
+ StringReader in = null;
+ try {
+ in = new StringReader(s);
+
+ char[] c = new char[102400];
+ int len;
+ while ((len = in.read(c)) > 0) {
+ String str = new String(c, 0, len);
+ byte[] b = str.getBytes("UTF-8");
+ deflaterOutputStream.write(b, 0, b.length);
+ }
+ }
+ catch (IOException e) {
+ LOG.warn(null, e);
+ }
+ finally {
+ try {
+ deflaterOutputStream.flush();
+ }
+ catch (IOException e) {
+ }
+ try {
+ buffer.flush();
+ }
+ catch (IOException e) {
+ }
+ deflater.finish();
+ try {
+ deflaterOutputStream.finish();
+ }
+ catch (IOException e) {
+ }
+ deflater.end();
+ try {
+ deflaterOutputStream.close();
+ }
+ catch (IOException e) {
+ }
+ try {
+ buffer.close();
+ }
+ catch (IOException e) {
+ }
+ if (in != null) {
+ in.close();
+ }
+ }
+
+ return buffer.toByteArray();
+ }
+
+ public static String decompress(byte[] compressed) {
+ ByteArrayInputStream in = new ByteArrayInputStream(compressed);
+ Inflater inflater = new Inflater();
+ InflaterInputStream inflaterInputStream = new InflaterInputStream(in, inflater);
+ StringWriter out = new StringWriter();
+ try {
+ InputStreamReader reader = new InputStreamReader(inflaterInputStream, "UTF-8");
+ char[] b = new char[102400];
+ int len;
+ while ((len = reader.read(b)) > 0) {
+ String str = new String(b, 0, len);
+ out.write(str, 0, str.length());
+ }
+ }
+ catch (IOException e) {
+ LOG.warn(null, e);
+ }
+ finally {
+ try {
+ inflaterInputStream.close();
+ }
+ catch (IOException e) {
+ }
+ inflater.end();
+ out.flush();
+ try {
+ in.close();
+ }
+ catch (IOException e) {
+ }
+ try {
+ out.close();
+ }
+ catch (IOException e) {
+ }
+ }
+
+ return out.toString();
+ }
+
+ /**
+ * removes all prefixes from the string, starting with the first one. Ignores case!
+ * <p>
+ * <b>Example</b>: <br>
+ * <code>removePrefixes("CompanyFormData","Company","Form")</code> will result in "Data"<br>
+ * but <code>removePrefixes("CompanyFormData","Form","Company")</code> will result in "FormData"
+ */
+ public static String removePrefixes(String s, String... prefixes) {
+ for (int i = 0; i < prefixes.length; i++) {
+ if (prefixes[i] != null) {
+ if (s.toLowerCase().startsWith(prefixes[i].toLowerCase())) {
+ s = s.substring(prefixes[i].length());
+ }
+ }
+ }
+ return s;
+ }
+
+ /**
+ * The String s0 will only be added, if it is not empty. String s1, s3, ...
+ * are treated as delimeters and are only inserted, if the corresponding
+ * String s2, s4, ... is not empty. <br>
+ * If there is an even number of Strings, the
+ * last one will only be appended, if the concatenated String so far is not <code>null</code>
+ *
+ * @param s
+ * list of strings to append, s0 will be appended first, s1 only if
+ * s2 is not empty, dito for s3 and s4 ..
+ */
+ public static String concatenateTokens(String... s) {
+ String retVal = "";
+ if (s != null && s.length > 0) {
+ StringBuffer b = new StringBuffer();
+ String suffix = s[0];
+ if (suffix != null && suffix.trim().length() > 0) {
+ b.append(suffix.trim());
+ }
+ for (int i = 1, l = s.length - 1; i < l; i = i + 2) {
+ String del = s[i];
+ suffix = s[i + 1];
+ if (suffix != null && suffix.trim().length() > 0) {
+ if (b.length() > 0) {
+ b.append(del);
+ }
+ b.append(suffix.trim());
+ }
+ }
+ retVal = b.toString().trim();
+ if ((s.length % 2) == 0 && retVal.length() > 0) {
+ retVal = retVal + s[s.length - 1];
+ }
+ }
+ return retVal;
+ }
+
+ /**
+ * Delegate to {@link ListUtility.parse(String text)}
+ */
+ public static Collection<Object> stringToCollection(String text) {
+ return ListUtility.parse(text);
+ }
+
+ /**
+ * Delegate to {@link ListUtility.format(Collection c)}
+ */
+ public static String collectionToString(Collection<Object> c) {
+ return collectionToString(c, false);
+ }
+
+ /**
+ * Delegate to {@link ListUtility.format(Collection c, boolean quoteStrings)}
+ */
+ public static String collectionToString(Collection<Object> c, boolean quoteStrings) {
+ return ListUtility.format(c, quoteStrings);
+ }
+
+ /**
+ * compare two strings using a locale-dependent {@link Collator}
+ */
+ public static int compareIgnoreCase(String a, String b) {
+ return compareIgnoreCase(NlsUtility.getDefaultLocale(), a, b);
+ }
+
+ /**
+ * compare two strings using a locale-dependent {@link Collator}
+ */
+ public static int compareIgnoreCase(Locale locale, String a, String b) {
+ if (a != null && a.length() == 0) {
+ a = null;
+ }
+ if (b != null && b.length() == 0) {
+ b = null;
+ }
+ //
+ if (a == b) {
+ return 0;
+ }
+ if (a == null) {
+ return -1;
+ }
+ if (b == null) {
+ return 1;
+ }
+ Collator collator = Collator.getInstance(locale);
+ collator.setStrength(Collator.SECONDARY);
+ return collator.compare(a, b);
+ }
+
+ public static boolean STRING_INTERN_ENABLED = true;
+
+ /**
+ * Delegate for {@link String#intern()}.
+ */
+ public static String intern(String s) {
+ if (STRING_INTERN_ENABLED) {
+ return s != null ? s.intern() : null;
+ }
+ return s;
+ }
+
+ /**
+ * <p>
+ * Attempts to match the entire region against the regex.
+ * </p>
+ * <p>
+ * <small>Thereby, the pattern works case-insensitive and in dot-all mode. See {@link Pattern for more information}
+ * </small>
+ * </p>
+ *
+ * @param s
+ * @param regex
+ * @return
+ */
+ public static boolean contains(String s, String regex) {
+ if (s == null || regex == null) {
+ return false;
+ }
+ try {
+ Pattern pattern = Pattern.compile(".*" + regex + ".*", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL);
+ return pattern.matcher(s).matches();
+ }
+ catch (Throwable t) {
+ return false;
+ }
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/TTLCache.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/TTLCache.java
index 36bfd2622f..335d0a5769 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/TTLCache.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/TTLCache.java
@@ -1,197 +1,197 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-
-/**
- * Default implementation of a time to live cache mechanism using a HashMap. This implementation is thread-safe.
- * <p>
- * {@link #setTTL(long)} is the duration the items remain in the cache, after that time entries are discarded.
- */
-public class TTLCache<K, V> {
- private Map<K, CacheEntryTTL> m_itemMap;
- private long m_ttl;
- private final Object m_itemMapLock = new Object();
-
- public TTLCache() {
- this(60000);// 60 sec. default
- }
-
- public TTLCache(long timeToLive) {
- m_ttl = timeToLive;
- m_itemMap = new HashMap<K, CacheEntryTTL>();
- }
-
- public void clear() {
- synchronized (m_itemMapLock) {
- m_itemMap.clear();
- }
- }
-
- public void setTTL(long millis) {
- m_ttl = millis;
- }
-
- public long getTTL() {
- return m_ttl;
- }
-
- public void put(K key, V value) {
- if (m_ttl > 0) {
- synchronized (m_itemMapLock) {
- m_itemMap.put(key, new CacheEntryTTL(value));
- }
- }
- }
-
- public void remove(K key) {
- synchronized (m_itemMapLock) {
- m_itemMap.remove(key);
- }
- }
-
- public V get(K key) {
- CacheEntryTTL ce = getEntry(key);
- if (ce != null) {
- return ce.getValue();
- }
- else {
- return null;
- }
- }
-
- public Set<K> keySet() {
- HashSet<K> list = new HashSet<K>();
- synchronized (m_itemMapLock) {
- for (Iterator<K> it = m_itemMap.keySet().iterator(); it.hasNext();) {
- K key = it.next();
- if (!isCacheTimeoutReached(m_itemMap.get(key))) {
- list.add(key);
- }
- else {
- it.remove();
- }
- }
- }
- return list;
- }
-
- public int size() {
- synchronized (m_itemMapLock) {
- return m_itemMap.size();
- }
- }
-
- public Collection<V> values() {
- ArrayList<V> list = new ArrayList<V>();
- synchronized (m_itemMapLock) {
- for (Iterator<CacheEntryTTL> it = m_itemMap.values().iterator(); it.hasNext();) {
- CacheEntryTTL cacheEntry = it.next();
- if (!isCacheTimeoutReached(cacheEntry)) {
- list.add(cacheEntry.getValue());
- }
- else {
- it.remove();
- }
- }
- }
- return list;
- }
-
- public Map<K, V> getEntries() {
- Map<K, V> map = new HashMap<K, V>();
- synchronized (m_itemMapLock) {
- for (Iterator<Entry<K, CacheEntryTTL>> it = m_itemMap.entrySet().iterator(); it.hasNext();) {
- Entry<K, CacheEntryTTL> e = it.next();
- if (!isCacheTimeoutReached(e.getValue())) {
- map.put(e.getKey(), e.getValue().getValue());
- }
- else {
- it.remove();
- }
- }
- }
- return map;
- }
-
- public boolean containsKey(K key) {
- if (m_ttl > 0) {
- CacheEntryTTL ce = getEntry(key);
- if (ce != null) {
- return true;
- }
- }
- return false;
- }
-
- public boolean contains(K key, V value) {
- if (m_ttl > 0) {
- CacheEntryTTL ce = getEntry(key);
- if (ce != null) {
- V ceVal = ce.getValue();
- if (ceVal == value || (ceVal != null && ceVal.equals(value))) {
- // ok
- return true;
- }
- }
- }
- return false;
- }
-
- private CacheEntryTTL getEntry(K key) {
- if (m_ttl > 0) {
- CacheEntryTTL ce;
- synchronized (m_itemMapLock) {
- ce = m_itemMap.get(key);
- if (ce != null) {
- if (!isCacheTimeoutReached(ce)) {
- return ce;
- }
- else {
- // timeout
- m_itemMap.remove(key);
- }
- }
- }
- }
- return null;
- }
-
- private boolean isCacheTimeoutReached(CacheEntryTTL value) {
- return value.getTimestamp() + m_ttl <= System.currentTimeMillis();
- }
-
- private class CacheEntryTTL {
- private long m_time = System.currentTimeMillis();
- private V m_value;
-
- public CacheEntryTTL(V value) {
- m_value = value;
- }
-
- public long getTimestamp() {
- return m_time;
- }
-
- public V getValue() {
- return m_value;
- }
- }// end class
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+/**
+ * Default implementation of a time to live cache mechanism using a HashMap. This implementation is thread-safe.
+ * <p>
+ * {@link #setTTL(long)} is the duration the items remain in the cache, after that time entries are discarded.
+ */
+public class TTLCache<K, V> {
+ private Map<K, CacheEntryTTL> m_itemMap;
+ private long m_ttl;
+ private final Object m_itemMapLock = new Object();
+
+ public TTLCache() {
+ this(60000);// 60 sec. default
+ }
+
+ public TTLCache(long timeToLive) {
+ m_ttl = timeToLive;
+ m_itemMap = new HashMap<K, CacheEntryTTL>();
+ }
+
+ public void clear() {
+ synchronized (m_itemMapLock) {
+ m_itemMap.clear();
+ }
+ }
+
+ public void setTTL(long millis) {
+ m_ttl = millis;
+ }
+
+ public long getTTL() {
+ return m_ttl;
+ }
+
+ public void put(K key, V value) {
+ if (m_ttl > 0) {
+ synchronized (m_itemMapLock) {
+ m_itemMap.put(key, new CacheEntryTTL(value));
+ }
+ }
+ }
+
+ public void remove(K key) {
+ synchronized (m_itemMapLock) {
+ m_itemMap.remove(key);
+ }
+ }
+
+ public V get(K key) {
+ CacheEntryTTL ce = getEntry(key);
+ if (ce != null) {
+ return ce.getValue();
+ }
+ else {
+ return null;
+ }
+ }
+
+ public Set<K> keySet() {
+ HashSet<K> list = new HashSet<K>();
+ synchronized (m_itemMapLock) {
+ for (Iterator<K> it = m_itemMap.keySet().iterator(); it.hasNext();) {
+ K key = it.next();
+ if (!isCacheTimeoutReached(m_itemMap.get(key))) {
+ list.add(key);
+ }
+ else {
+ it.remove();
+ }
+ }
+ }
+ return list;
+ }
+
+ public int size() {
+ synchronized (m_itemMapLock) {
+ return m_itemMap.size();
+ }
+ }
+
+ public Collection<V> values() {
+ ArrayList<V> list = new ArrayList<V>();
+ synchronized (m_itemMapLock) {
+ for (Iterator<CacheEntryTTL> it = m_itemMap.values().iterator(); it.hasNext();) {
+ CacheEntryTTL cacheEntry = it.next();
+ if (!isCacheTimeoutReached(cacheEntry)) {
+ list.add(cacheEntry.getValue());
+ }
+ else {
+ it.remove();
+ }
+ }
+ }
+ return list;
+ }
+
+ public Map<K, V> getEntries() {
+ Map<K, V> map = new HashMap<K, V>();
+ synchronized (m_itemMapLock) {
+ for (Iterator<Entry<K, CacheEntryTTL>> it = m_itemMap.entrySet().iterator(); it.hasNext();) {
+ Entry<K, CacheEntryTTL> e = it.next();
+ if (!isCacheTimeoutReached(e.getValue())) {
+ map.put(e.getKey(), e.getValue().getValue());
+ }
+ else {
+ it.remove();
+ }
+ }
+ }
+ return map;
+ }
+
+ public boolean containsKey(K key) {
+ if (m_ttl > 0) {
+ CacheEntryTTL ce = getEntry(key);
+ if (ce != null) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public boolean contains(K key, V value) {
+ if (m_ttl > 0) {
+ CacheEntryTTL ce = getEntry(key);
+ if (ce != null) {
+ V ceVal = ce.getValue();
+ if (ceVal == value || (ceVal != null && ceVal.equals(value))) {
+ // ok
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ private CacheEntryTTL getEntry(K key) {
+ if (m_ttl > 0) {
+ CacheEntryTTL ce;
+ synchronized (m_itemMapLock) {
+ ce = m_itemMap.get(key);
+ if (ce != null) {
+ if (!isCacheTimeoutReached(ce)) {
+ return ce;
+ }
+ else {
+ // timeout
+ m_itemMap.remove(key);
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ private boolean isCacheTimeoutReached(CacheEntryTTL value) {
+ return value.getTimestamp() + m_ttl <= System.currentTimeMillis();
+ }
+
+ private class CacheEntryTTL {
+ private long m_time = System.currentTimeMillis();
+ private V m_value;
+
+ public CacheEntryTTL(V value) {
+ m_value = value;
+ }
+
+ public long getTimestamp() {
+ return m_time;
+ }
+
+ public V getValue() {
+ return m_value;
+ }
+ }// end class
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/TriState.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/TriState.java
index fa9f1e3ec0..776558d862 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/TriState.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/TriState.java
@@ -1,157 +1,157 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-/**
- * A TriState is a Boolean value with three states: {@value TriState#TRUE}, {@value TriState#FALSE} and
- * {@value TriState#UNDEFINED} The value is
- * internally represented as {@value Boolean#TRUE}, {@value Boolean#FALSE} and
- * null
- */
-public final class TriState implements java.io.Serializable, Comparable<TriState> {
- /**
- * The <code>Boolean</code> object corresponding to the value <code>true</code>.
- */
- public static final TriState TRUE = new TriState(Boolean.TRUE);
-
- /**
- * The <code>Boolean</code> object corresponding to the value <code>false</code>.
- */
- public static final TriState FALSE = new TriState(Boolean.FALSE);
-
- /**
- * The <code>Boolean</code> object corresponding to the value <code>null</code>.
- */
- public static final TriState UNDEFINED = new TriState(null);
-
- private final Boolean value;
-
- private static final long serialVersionUID = 1L;
-
- /**
- * Boolean: true -> true false -> false null -> null Number: 1 -> true 0 ->
- * false null -> null other-> null String: "true" -> true "false" -> false "1"
- * -> true "0" -> false null -> null other -> null
- */
- public static TriState parseTriState(Object value) {
- if (value == null) {
- return UNDEFINED;
- }
- else if (value instanceof Boolean) {
- if ((Boolean) value) {
- return TRUE;
- }
- else {
- return FALSE;
- }
- }
- else if (value instanceof Number) {
- int i = ((Number) value).intValue();
- switch (i) {
- case 0: {
- return FALSE;
- }
- case 1: {
- return TRUE;
- }
- default: {
- return UNDEFINED;
- }
- }
- }
- else if (value instanceof String) {
- if (value.equals("true")) {
- return TRUE;
- }
- else if (value.equals("false")) {
- return FALSE;
- }
- else if (value.equals("0")) {
- return FALSE;
- }
- else if (value.equals("1")) {
- return TRUE;
- }
- else {
- return UNDEFINED;
- }
- }
- else {
- throw new IllegalArgumentException("value of unknown type " + value + " [" + value.getClass() + "]");
- }
- }
-
- /**
- * see {@link #parseTriState(Object)}
- */
- private TriState(Boolean value) {
- this.value = value;
- }
-
- /**
- * @return true, false or null
- */
- public Boolean getBooleanValue() {
- return value;
- }
-
- /**
- * @return 1, 0 or null
- */
- public Integer getIntegerValue() {
- return (value != null ? (value ? 1 : 0) : null);
- }
-
- public boolean isUndefined() {
- return value == null;
- }
-
- @Override
- public String toString() {
- if (value != null) {
- return value ? "true" : "false";
- }
- else {
- return null;
- }
- }
-
- @Override
- public int hashCode() {
- if (value != null) {
- return value ? 1 : 0;
- }
- else {
- return 2;
- }
- }
-
- @Override
- public boolean equals(Object obj) {
- if (value == obj) {
- return true;
- }
- else if (obj instanceof TriState) {
- TriState t = (TriState) obj;
- int a = (value != null ? (value ? 1 : 0) : 2);
- int b = (t.value != null ? (t.value ? 1 : 0) : 2);
- return a == b;
- }
- return false;
- }
-
- @Override
- public int compareTo(TriState t) {
- Integer a = (value != null ? (value ? 1 : 0) : 2);
- Integer b = (t.value != null ? (t.value ? 1 : 0) : 2);
- return a.compareTo(b);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+/**
+ * A TriState is a Boolean value with three states: {@value TriState#TRUE}, {@value TriState#FALSE} and
+ * {@value TriState#UNDEFINED} The value is
+ * internally represented as {@value Boolean#TRUE}, {@value Boolean#FALSE} and
+ * null
+ */
+public final class TriState implements java.io.Serializable, Comparable<TriState> {
+ /**
+ * The <code>Boolean</code> object corresponding to the value <code>true</code>.
+ */
+ public static final TriState TRUE = new TriState(Boolean.TRUE);
+
+ /**
+ * The <code>Boolean</code> object corresponding to the value <code>false</code>.
+ */
+ public static final TriState FALSE = new TriState(Boolean.FALSE);
+
+ /**
+ * The <code>Boolean</code> object corresponding to the value <code>null</code>.
+ */
+ public static final TriState UNDEFINED = new TriState(null);
+
+ private final Boolean value;
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Boolean: true -> true false -> false null -> null Number: 1 -> true 0 ->
+ * false null -> null other-> null String: "true" -> true "false" -> false "1"
+ * -> true "0" -> false null -> null other -> null
+ */
+ public static TriState parseTriState(Object value) {
+ if (value == null) {
+ return UNDEFINED;
+ }
+ else if (value instanceof Boolean) {
+ if ((Boolean) value) {
+ return TRUE;
+ }
+ else {
+ return FALSE;
+ }
+ }
+ else if (value instanceof Number) {
+ int i = ((Number) value).intValue();
+ switch (i) {
+ case 0: {
+ return FALSE;
+ }
+ case 1: {
+ return TRUE;
+ }
+ default: {
+ return UNDEFINED;
+ }
+ }
+ }
+ else if (value instanceof String) {
+ if (value.equals("true")) {
+ return TRUE;
+ }
+ else if (value.equals("false")) {
+ return FALSE;
+ }
+ else if (value.equals("0")) {
+ return FALSE;
+ }
+ else if (value.equals("1")) {
+ return TRUE;
+ }
+ else {
+ return UNDEFINED;
+ }
+ }
+ else {
+ throw new IllegalArgumentException("value of unknown type " + value + " [" + value.getClass() + "]");
+ }
+ }
+
+ /**
+ * see {@link #parseTriState(Object)}
+ */
+ private TriState(Boolean value) {
+ this.value = value;
+ }
+
+ /**
+ * @return true, false or null
+ */
+ public Boolean getBooleanValue() {
+ return value;
+ }
+
+ /**
+ * @return 1, 0 or null
+ */
+ public Integer getIntegerValue() {
+ return (value != null ? (value ? 1 : 0) : null);
+ }
+
+ public boolean isUndefined() {
+ return value == null;
+ }
+
+ @Override
+ public String toString() {
+ if (value != null) {
+ return value ? "true" : "false";
+ }
+ else {
+ return null;
+ }
+ }
+
+ @Override
+ public int hashCode() {
+ if (value != null) {
+ return value ? 1 : 0;
+ }
+ else {
+ return 2;
+ }
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (value == obj) {
+ return true;
+ }
+ else if (obj instanceof TriState) {
+ TriState t = (TriState) obj;
+ int a = (value != null ? (value ? 1 : 0) : 2);
+ int b = (t.value != null ? (t.value ? 1 : 0) : 2);
+ return a == b;
+ }
+ return false;
+ }
+
+ @Override
+ public int compareTo(TriState t) {
+ Integer a = (value != null ? (value ? 1 : 0) : 2);
+ Integer b = (t.value != null ? (t.value ? 1 : 0) : 2);
+ return a.compareTo(b);
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/TuningUtility.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/TuningUtility.java
index 429a312530..0368c1dff7 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/TuningUtility.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/TuningUtility.java
@@ -1,253 +1,253 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import java.util.Map;
-import java.util.Stack;
-import java.util.TreeMap;
-import java.util.TreeSet;
-
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-
-/**
- * <p>
- * Class to help getting timing information without the need of adding attaching a profiler.
- * </p>
- * <h2>Example 1</h2>
- *
- * <pre>
- * TuningUtility.start();
- * // my code
- * // more of my code
- * TuningUtility.stop(&quot;myCode&quot;);
- * </pre>
- *
- * results in the output
- *
- * <pre>
- * #TuningUtility myCode took 30ms
- * </pre>
- *
- * <h2>Example 2</h2>
- *
- * <pre>
- * for (int i = 0; i &lt; 100; i++) {
- * TuningUtility.start();
- * // my repeated code A
- * TuningUtility.stop(&quot;repeatCodeA&quot;, false, true);
- * TuningUtility.start();
- * // my repeated code B
- * TuningUtility.stop(&quot;repeatCodeB&quot;, false, true);
- * }
- * TuningUtility.finishAll();
- * </pre>
- *
- * results in the output
- *
- * <pre>
- * #TUNING: repeatCodeA[100] sum=1449.755488 min=1.941867ms avg=14.497554ms median=14.665551ms max=30.327598ms [without 1 smallest and 1 largest: sum=1417.486023 min=1.943543ms avg=14.613257ms median=14.665551ms max=30.265579ms]
- * #TUNING: repeatCodeB[100] sum=6893.764704 min=4.891404ms avg=68.937647ms median=68.354218ms max=143.545897ms [without 1 smallest and 1 largest: sum=6745.327403 min=7.807417ms avg=69.539457ms median=68.354218ms max=142.573987ms]
- * </pre>
- */
-public final class TuningUtility {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(TuningUtility.class);
-
- private TuningUtility() {
- }
-
- // current timer
- private static Stack<Long> timerStack;
- // analysis
- private static Object analysisMapLock;
- private static TreeMap<String, TreeSet<CompositeObject>> analysisMap;
-
- static {
- timerStack = new Stack<Long>();
- // analysis
- analysisMapLock = new Object();
- analysisMap = new TreeMap<String, TreeSet<CompositeObject>>();
- }
-
- /**
- * Starts a timer by pushing the current time onto a stack.
- */
- public static void startTimer() {
- timerStack.push(System.nanoTime());
- }
-
- /**
- * <p>
- * Stops a timer and prints the result.
- * </p>
- * <p>
- * If no timer was started the output is suppressed.
- * </p>
- *
- * @param name
- * of the timer, used in the output
- * @return time spent in nanoseconds, -1 if no timer was started
- */
- public static long stopTimer(String name) {
- return stopTimer(name, true, false);
- }
-
- /**
- * Stops a timer
- *
- * @param name
- * of the timer, used to store the result for multiple measurements and for output
- * @param print
- * <code>true</code> prints as output how much time was spent since the start, the output is also suppressed
- * if there is not timer to stop
- * @param addToBatch
- * <code>true</code> the measurement is stored internally
- * @return time spent in nanoseconds, -1 if no timer was started
- */
- public static long stopTimer(String name, boolean print, boolean addToBatch) {
- long dtNanos;
- if (!timerStack.isEmpty()) {
- dtNanos = System.nanoTime() - timerStack.pop();
- }
- else {
- dtNanos = -1;
- }
- if (print && dtNanos != -1) {
- printSingle(name, dtNanos);
- }
- if (addToBatch) {
- synchronized (analysisMapLock) {
- TreeSet<CompositeObject> set = analysisMap.get(name);
- if (set == null) {
- set = new TreeSet<CompositeObject>();
- analysisMap.put(name, set);
- }
- set.add(new CompositeObject(dtNanos, set.size()));
- }
- }
- return dtNanos;
- }
-
- /**
- * print out a list of all timers that were stored (added to a batch)
- *
- * @param clearTimers
- * <code>true</code> if any timers have not been stopped yet, they will be removed
- * first. A warning message is still printed.<code>false</code> only a note will be printed, but unfinished
- * timers will not be stopped
- */
- public static void finishAll(boolean clearTimers) {
- if (!timerStack.isEmpty()) {
- System.out.println("#TUNING: there are " + timerStack.size() + " non-finished timers (start/stop mismatch)");
- }
- while (clearTimers && !timerStack.isEmpty()) {
- timerStack.pop();
- }
- synchronized (analysisMapLock) {
- for (Map.Entry<String, TreeSet<CompositeObject>> e : analysisMap.entrySet()) {
- String name = e.getKey();
- TreeSet<CompositeObject> set = e.getValue();
- long[] seriesSorted = new long[set.size()];
- int index = 0;
- for (CompositeObject o : set) {
- seriesSorted[index] = (Long) o.getComponent(0);
- index++;
- }
- printMulti(name, seriesSorted);
- }
- analysisMap.clear();
- }
- }
-
- /**
- * print out a list of all timers that were stored (added to a batch)
- */
- public static void finishAll() {
- finishAll(false);
- }
-
- private static String formatTime(long dtNanos) {
- String x = "" + dtNanos;
- while (x.length() < 7) {
- x = "0" + x;
- }
- return x.substring(0, x.length() - 6) + "." + x.substring(x.length() - 6);
- }
-
- private static void printSingle(String label, long dtNanos) {
- int level = timerStack.size();
- StringBuilder b = new StringBuilder();
- b.append("#TUNING: ");
- for (int i = 0; i < level; i++) {
- b.append(" ");
- }
- b.append(label);
- b.append(" took ");
- b.append(formatTime(dtNanos));
- b.append("ms");
- System.out.println(b);
- }
-
- private static void printMulti(String name, long[] seriesSorted) {
- StringBuilder b = new StringBuilder();
- b.append("#TUNING: ");
- b.append(name);
- b.append("[" + seriesSorted.length + "]");
- if (seriesSorted.length > 0) {
- double sum = 0;
- for (long n : seriesSorted) {
- sum += n;
- }
- b.append(" sum=" + formatTime((long) sum));
- long avg = (long) (sum / seriesSorted.length);
- b.append("ms");
- b.append(" min=");
- b.append(formatTime(seriesSorted[0]));
- b.append("ms");
- b.append(" avg=");
- b.append(formatTime(avg));
- b.append("ms");
- b.append(" median=");
- b.append(formatTime(seriesSorted[seriesSorted.length / 2]));
- b.append("ms");
- b.append(" max=");
- b.append(formatTime(seriesSorted[seriesSorted.length - 1]));
- b.append("ms");
- // remove smallest and largest 1%
- int start = Math.max(1, seriesSorted.length / 100);
- int end = Math.min(seriesSorted.length - 2, seriesSorted.length - 1 - seriesSorted.length / 100);
- if (start < end) {
- b.append(" [without " + start + " smallest and " + (seriesSorted.length - 1 - end) + " largest: ");
- sum = 0;
- for (int i = start; i <= end; i++) {
- sum += seriesSorted[i];
- }
- b.append(" sum=" + formatTime((long) sum));
- avg = (long) (sum / (end - start));
- b.append(" min=");
- b.append(formatTime(seriesSorted[start]));
- b.append("ms");
- b.append(" avg=");
- b.append(formatTime(avg));
- b.append("ms");
- b.append(" median=");
- b.append(formatTime(seriesSorted[seriesSorted.length / 2]));
- b.append("ms");
- b.append(" max=");
- b.append(formatTime(seriesSorted[end]));
- b.append("ms");
- b.append("]");
- }
- }
- System.out.println(b);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import java.util.Map;
+import java.util.Stack;
+import java.util.TreeMap;
+import java.util.TreeSet;
+
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+
+/**
+ * <p>
+ * Class to help getting timing information without the need of adding attaching a profiler.
+ * </p>
+ * <h2>Example 1</h2>
+ *
+ * <pre>
+ * TuningUtility.start();
+ * // my code
+ * // more of my code
+ * TuningUtility.stop(&quot;myCode&quot;);
+ * </pre>
+ *
+ * results in the output
+ *
+ * <pre>
+ * #TuningUtility myCode took 30ms
+ * </pre>
+ *
+ * <h2>Example 2</h2>
+ *
+ * <pre>
+ * for (int i = 0; i &lt; 100; i++) {
+ * TuningUtility.start();
+ * // my repeated code A
+ * TuningUtility.stop(&quot;repeatCodeA&quot;, false, true);
+ * TuningUtility.start();
+ * // my repeated code B
+ * TuningUtility.stop(&quot;repeatCodeB&quot;, false, true);
+ * }
+ * TuningUtility.finishAll();
+ * </pre>
+ *
+ * results in the output
+ *
+ * <pre>
+ * #TUNING: repeatCodeA[100] sum=1449.755488 min=1.941867ms avg=14.497554ms median=14.665551ms max=30.327598ms [without 1 smallest and 1 largest: sum=1417.486023 min=1.943543ms avg=14.613257ms median=14.665551ms max=30.265579ms]
+ * #TUNING: repeatCodeB[100] sum=6893.764704 min=4.891404ms avg=68.937647ms median=68.354218ms max=143.545897ms [without 1 smallest and 1 largest: sum=6745.327403 min=7.807417ms avg=69.539457ms median=68.354218ms max=142.573987ms]
+ * </pre>
+ */
+public final class TuningUtility {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(TuningUtility.class);
+
+ private TuningUtility() {
+ }
+
+ // current timer
+ private static Stack<Long> timerStack;
+ // analysis
+ private static Object analysisMapLock;
+ private static TreeMap<String, TreeSet<CompositeObject>> analysisMap;
+
+ static {
+ timerStack = new Stack<Long>();
+ // analysis
+ analysisMapLock = new Object();
+ analysisMap = new TreeMap<String, TreeSet<CompositeObject>>();
+ }
+
+ /**
+ * Starts a timer by pushing the current time onto a stack.
+ */
+ public static void startTimer() {
+ timerStack.push(System.nanoTime());
+ }
+
+ /**
+ * <p>
+ * Stops a timer and prints the result.
+ * </p>
+ * <p>
+ * If no timer was started the output is suppressed.
+ * </p>
+ *
+ * @param name
+ * of the timer, used in the output
+ * @return time spent in nanoseconds, -1 if no timer was started
+ */
+ public static long stopTimer(String name) {
+ return stopTimer(name, true, false);
+ }
+
+ /**
+ * Stops a timer
+ *
+ * @param name
+ * of the timer, used to store the result for multiple measurements and for output
+ * @param print
+ * <code>true</code> prints as output how much time was spent since the start, the output is also suppressed
+ * if there is not timer to stop
+ * @param addToBatch
+ * <code>true</code> the measurement is stored internally
+ * @return time spent in nanoseconds, -1 if no timer was started
+ */
+ public static long stopTimer(String name, boolean print, boolean addToBatch) {
+ long dtNanos;
+ if (!timerStack.isEmpty()) {
+ dtNanos = System.nanoTime() - timerStack.pop();
+ }
+ else {
+ dtNanos = -1;
+ }
+ if (print && dtNanos != -1) {
+ printSingle(name, dtNanos);
+ }
+ if (addToBatch) {
+ synchronized (analysisMapLock) {
+ TreeSet<CompositeObject> set = analysisMap.get(name);
+ if (set == null) {
+ set = new TreeSet<CompositeObject>();
+ analysisMap.put(name, set);
+ }
+ set.add(new CompositeObject(dtNanos, set.size()));
+ }
+ }
+ return dtNanos;
+ }
+
+ /**
+ * print out a list of all timers that were stored (added to a batch)
+ *
+ * @param clearTimers
+ * <code>true</code> if any timers have not been stopped yet, they will be removed
+ * first. A warning message is still printed.<code>false</code> only a note will be printed, but unfinished
+ * timers will not be stopped
+ */
+ public static void finishAll(boolean clearTimers) {
+ if (!timerStack.isEmpty()) {
+ System.out.println("#TUNING: there are " + timerStack.size() + " non-finished timers (start/stop mismatch)");
+ }
+ while (clearTimers && !timerStack.isEmpty()) {
+ timerStack.pop();
+ }
+ synchronized (analysisMapLock) {
+ for (Map.Entry<String, TreeSet<CompositeObject>> e : analysisMap.entrySet()) {
+ String name = e.getKey();
+ TreeSet<CompositeObject> set = e.getValue();
+ long[] seriesSorted = new long[set.size()];
+ int index = 0;
+ for (CompositeObject o : set) {
+ seriesSorted[index] = (Long) o.getComponent(0);
+ index++;
+ }
+ printMulti(name, seriesSorted);
+ }
+ analysisMap.clear();
+ }
+ }
+
+ /**
+ * print out a list of all timers that were stored (added to a batch)
+ */
+ public static void finishAll() {
+ finishAll(false);
+ }
+
+ private static String formatTime(long dtNanos) {
+ String x = "" + dtNanos;
+ while (x.length() < 7) {
+ x = "0" + x;
+ }
+ return x.substring(0, x.length() - 6) + "." + x.substring(x.length() - 6);
+ }
+
+ private static void printSingle(String label, long dtNanos) {
+ int level = timerStack.size();
+ StringBuilder b = new StringBuilder();
+ b.append("#TUNING: ");
+ for (int i = 0; i < level; i++) {
+ b.append(" ");
+ }
+ b.append(label);
+ b.append(" took ");
+ b.append(formatTime(dtNanos));
+ b.append("ms");
+ System.out.println(b);
+ }
+
+ private static void printMulti(String name, long[] seriesSorted) {
+ StringBuilder b = new StringBuilder();
+ b.append("#TUNING: ");
+ b.append(name);
+ b.append("[" + seriesSorted.length + "]");
+ if (seriesSorted.length > 0) {
+ double sum = 0;
+ for (long n : seriesSorted) {
+ sum += n;
+ }
+ b.append(" sum=" + formatTime((long) sum));
+ long avg = (long) (sum / seriesSorted.length);
+ b.append("ms");
+ b.append(" min=");
+ b.append(formatTime(seriesSorted[0]));
+ b.append("ms");
+ b.append(" avg=");
+ b.append(formatTime(avg));
+ b.append("ms");
+ b.append(" median=");
+ b.append(formatTime(seriesSorted[seriesSorted.length / 2]));
+ b.append("ms");
+ b.append(" max=");
+ b.append(formatTime(seriesSorted[seriesSorted.length - 1]));
+ b.append("ms");
+ // remove smallest and largest 1%
+ int start = Math.max(1, seriesSorted.length / 100);
+ int end = Math.min(seriesSorted.length - 2, seriesSorted.length - 1 - seriesSorted.length / 100);
+ if (start < end) {
+ b.append(" [without " + start + " smallest and " + (seriesSorted.length - 1 - end) + " largest: ");
+ sum = 0;
+ for (int i = start; i <= end; i++) {
+ sum += seriesSorted[i];
+ }
+ b.append(" sum=" + formatTime((long) sum));
+ avg = (long) (sum / (end - start));
+ b.append(" min=");
+ b.append(formatTime(seriesSorted[start]));
+ b.append("ms");
+ b.append(" avg=");
+ b.append(formatTime(avg));
+ b.append("ms");
+ b.append(" median=");
+ b.append(formatTime(seriesSorted[seriesSorted.length / 2]));
+ b.append("ms");
+ b.append(" max=");
+ b.append(formatTime(seriesSorted[end]));
+ b.append("ms");
+ b.append("]");
+ }
+ }
+ System.out.println(b);
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/TypeCastUtility.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/TypeCastUtility.java
index addda2908d..36ddccfcb1 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/TypeCastUtility.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/TypeCastUtility.java
@@ -1,2038 +1,2038 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import java.lang.reflect.Array;
-import java.lang.reflect.GenericArrayType;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.lang.reflect.TypeVariable;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.sql.Time;
-import java.sql.Timestamp;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Collection;
-import java.util.Date;
-import java.util.GregorianCalendar;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-
-public final class TypeCastUtility {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(TypeCastUtility.class);
-
- // singleton
- private static TypeCastUtility instance = new TypeCastUtility();
-
- private static final int CHARACTER = 1;
- private static final int BYTE = 2;
- private static final int BOOLEAN = 3;
- private static final int SHORT = 4;
- private static final int INTEGER = 5;
- private static final int LONG = 6;
- private static final int FLOAT = 7;
- private static final int DOUBLE = 8;
- private static final int STRING = 9;
- private static final int OBJECT = 10;
- private static final int BIGINTEGER = 11;
- private static final int BIGDECIMAL = 12;
- private static final int DATE = 13;
- private static final int CALENDAR = 14;
- private static final int SQLDATE = 15;
- private static final int SQLTIME = 16;
- private static final int SQLTIMESTAMP = 17;
- private static final int TRISTATE = 18;
- private static final int UTCDATE = 19;
- private static final int VOID = 9999;
-
- @SuppressWarnings("unchecked")
- public static <T> T castValue(Object o, Class<T> castType) {
- return (T) instance.castValueImpl(o, castType);
- }
-
- // instance
- /**
- * fast access to debug flag
- */
- private boolean m_debugEnabled;
- private final HashMap<Class, Class> m_wrapperTypeMap = new HashMap<Class, Class>();
- private final HashMap<Class, Integer> m_typeMap = new HashMap<Class, Integer>();
- private final HashMap<Class, Integer> m_primitiveTypeMap = new HashMap<Class, Integer>();
- private final HashMap<GPCKey, Class<?>> m_genericsParameterClassCache = new HashMap<GPCKey, Class<?>>();
-
- private TypeCastUtility() {
- m_wrapperTypeMap.put(char.class, Character.class);
- m_wrapperTypeMap.put(byte.class, Byte.class);
- m_wrapperTypeMap.put(boolean.class, Boolean.class);
- m_wrapperTypeMap.put(short.class, Short.class);
- m_wrapperTypeMap.put(int.class, Integer.class);
- m_wrapperTypeMap.put(long.class, Long.class);
- m_wrapperTypeMap.put(float.class, Float.class);
- m_wrapperTypeMap.put(double.class, Double.class);
- m_wrapperTypeMap.put(void.class, Void.class);
- //
- m_typeMap.put(Character.class, new Integer(CHARACTER));
- m_typeMap.put(Byte.class, new Integer(BYTE));
- m_typeMap.put(Boolean.class, new Integer(BOOLEAN));
- m_typeMap.put(TriState.class, new Integer(TRISTATE));
- m_typeMap.put(Short.class, new Integer(SHORT));
- m_typeMap.put(Integer.class, new Integer(INTEGER));
- m_typeMap.put(Long.class, new Integer(LONG));
- m_typeMap.put(Float.class, new Integer(FLOAT));
- m_typeMap.put(Double.class, new Integer(DOUBLE));
- m_typeMap.put(String.class, new Integer(STRING));
- m_typeMap.put(Object.class, new Integer(OBJECT));
- m_typeMap.put(BigInteger.class, new Integer(BIGINTEGER));
- m_typeMap.put(BigDecimal.class, new Integer(BIGDECIMAL));
- m_typeMap.put(UTCDate.class, new Integer(UTCDATE));
- m_typeMap.put(Date.class, new Integer(DATE));
- m_typeMap.put(Calendar.class, new Integer(CALENDAR));
- m_typeMap.put(GregorianCalendar.class, new Integer(CALENDAR));
- m_typeMap.put(java.sql.Date.class, new Integer(SQLDATE));
- m_typeMap.put(Time.class, new Integer(SQLTIME));
- m_typeMap.put(Timestamp.class, new Integer(SQLTIMESTAMP));
- m_typeMap.put(Void.class, new Integer(VOID));
- //
- m_primitiveTypeMap.put(boolean.class, new Integer(BOOLEAN));
- m_primitiveTypeMap.put(byte.class, new Integer(BYTE));
- m_primitiveTypeMap.put(char.class, new Integer(CHARACTER));
- m_primitiveTypeMap.put(short.class, new Integer(SHORT));
- m_primitiveTypeMap.put(int.class, new Integer(INTEGER));
- m_primitiveTypeMap.put(long.class, new Integer(LONG));
- m_primitiveTypeMap.put(float.class, new Integer(FLOAT));
- m_primitiveTypeMap.put(double.class, new Integer(DOUBLE));
- }
-
- @SuppressWarnings("unchecked")
- private Object castValueImpl(Object o, Class castType) {
- Class toType = castType;
- // null check
- if (o == null) {
- // primitive null-representation
- if (toType.isPrimitive()) {
- return getPrimitiveNull(toType);
- }
- return null;
- }
- // get non-primitive type
- if (toType.isPrimitive()) {
- toType = getWrappedType(toType);
- }
- // direct check
- if (toType.isInstance(o)) {
- return o;
- }
-
- // need conversion
- Class fromType = o.getClass();
- // array check
- if (toType.isArray()) {
- return castArrayValueImpl(o, fromType, toType);
- }
- else {
- return castBasicValueImpl(o, fromType, toType);
- }
- }
-
- /**
- * type to typeId
- */
- private int getTypeId(Class type) {
- Integer id = m_typeMap.get(type);
- if (id == null) {
- return 0;
- }
- else {
- return id.intValue();
- }
- }
-
- /**
- * type to typeId
- */
- private int getPrimitiveTypeId(Class type) {
- Integer id = m_primitiveTypeMap.get(type);
- if (id == null) {
- return 0;
- }
- else {
- return id.intValue();
- }
- }
-
- /**
- * wrapper type for primitive types
- */
- private Class getWrappedType(Class primitiveType) {
- Class wrappedType = m_wrapperTypeMap.get(primitiveType);
- return wrappedType;
- }
-
- /**
- * Null representation of a primitive type (0,false)
- */
- @SuppressWarnings("unchecked")
- private <T> T getPrimitiveNull(Class<T> primitiveType) {
- int fromId = getPrimitiveTypeId(primitiveType);
- if (fromId == 0) {
- throw new IllegalArgumentException(primitiveType + " no primitive type");
- }
- switch (fromId) {
- case BOOLEAN: {
- return (T) new Boolean(false);
- }
- case BYTE: {
- return (T) Byte.valueOf((byte) 0);
- }
- case CHARACTER: {
- return (T) new Character('\u0000');
- }
- case SHORT: {
- return (T) new Short((short) 0);
- }
- case INTEGER: {
- return (T) new Integer(0);
- }
- case LONG: {
- return (T) new Long(0L);
- }
- case FLOAT: {
- return (T) new Float(0.0f);
- }
- case DOUBLE: {
- return (T) new Double(0.0);
- }
- default: {
- throw new IllegalArgumentException(primitiveType + " no primitive type");
- }
- }
- }
-
- /**
- * exception builder
- */
- private IllegalArgumentException createException(Object o, Class fromType, Class toType, int code, String msg) {
- return new IllegalArgumentException(
- "converting " +
- VerboseUtility.dumpObject(o) +
- " from " +
- VerboseUtility.dumpType(fromType) +
- " to " +
- VerboseUtility.dumpType(toType) +
- " failed with code " +
- code +
- " (" + msg + ")");
- }
-
- private Object castArrayValueImpl(Object o, Class fromType, Class toType) {
- if (!fromType.isArray()) {
- // integrate collections framework. collections can be transformed to
- // arrays
- if (o instanceof Collection) {
- o = ((Collection) o).toArray();
- fromType = o.getClass();
- }
- else if (o instanceof Map) {
- o = ((Map) o).values().toArray();
- fromType = o.getClass();
- }
- else {
- throw createException(o, fromType, toType, 1, "object is not an array");
- }
- }
- Class toCompType = toType.getComponentType();
- // calculate dimension
- int dim = 0;
- Class t = toType;
- while (t.isArray()) {
- // next
- dim++;
- t = t.getComponentType();
- }
- // create array dims
- int[] dims = new int[dim];
- dim = 0;
- Object od = o;
- t = toType;
- while (t.isArray()) {
- dims[dim] = Array.getLength(od);
- t = t.getComponentType();
- if (dims[dim] == 0) {
- break;// if array length is 0 break up
- }
- // next
- od = Array.get(od, 0);
- dim++;
- }
- // create array
- Object newArray = Array.newInstance(t, dims);
- for (int i = 0, ni = dims[0]; i < ni; i++) {
- Object castedElement = castValueImpl(Array.get(o, i), toCompType);
- Array.set(newArray, i, castedElement);
- }
- return newArray;
- }
-
- private Object castBasicValueImpl(Object o, Class fromType, Class toType) {
- // null check
- if (o == null) {
- return null;
- }
- // from type in map
- int fromId = getTypeId(fromType);
- if (fromId == 0) {
- throw createException(o, fromType, toType, 2, "no from-mapping");
- }
- // to type in map
- int toId = getTypeId(toType);
- if (toId == 0) {
- throw createException(o, fromType, toType, 3, "no to-mapping");
- }
- switch (fromId) {
- case CHARACTER: {
- switch (toId) {
- case CHARACTER: {
- return o;
- }
- case BYTE: {
- return new Byte(txCharToByte(((Character) o).charValue()));
- }
- case BOOLEAN: {
- return new Boolean(txCharToBoolean(((Character) o).charValue()));
- }
- case TRISTATE: {
- return txCharToTriState(((Character) o).charValue());
- }
- case SHORT: {
- return new Short(txCharToShort(((Character) o).charValue()));
- }
- case INTEGER: {
- return new Integer(txCharToInt(((Character) o).charValue()));
- }
- case LONG: {
- return new Long(txCharToLong(((Character) o).charValue()));
- }
- case FLOAT: {
- return new Float(txCharToFloat(((Character) o).charValue()));
- }
- case DOUBLE: {
- return new Double(txCharToDouble(((Character) o).charValue()));
- }
- case STRING: {
- return txCharToString(((Character) o).charValue());
- }
- case OBJECT: {
- return o;
- }
- case BIGINTEGER: {
- return txCharToBigInteger(((Character) o).charValue());
- }
- case BIGDECIMAL: {
- return txCharToBigDecimal(((Character) o).charValue());
- }
- }
- break;
- }
- case BYTE: {
- switch (toId) {
- case CHARACTER: {
- return new Character(txByteToChar(((Byte) o).byteValue()));
- }
- case BYTE: {
- return o;
- }
- case BOOLEAN: {
- return new Boolean(txByteToBoolean(((Byte) o).byteValue()));
- }
- case TRISTATE: {
- return txByteToTriState(((Byte) o).byteValue());
- }
- case SHORT: {
- return new Short(txByteToShort(((Byte) o).byteValue()));
- }
- case INTEGER: {
- return new Integer(txByteToInt(((Byte) o).byteValue()));
- }
- case LONG: {
- return new Long(txByteToLong(((Byte) o).byteValue()));
- }
- case FLOAT: {
- return new Float(txByteToFloat(((Byte) o).byteValue()));
- }
- case DOUBLE: {
- return new Double(txByteToDouble(((Byte) o).byteValue()));
- }
- case STRING: {
- return txByteToString(((Byte) o).byteValue());
- }
- case OBJECT: {
- return o;
- }
- case BIGINTEGER: {
- return txByteToBigInteger(((Byte) o).byteValue());
- }
- case BIGDECIMAL: {
- return txByteToBigDecimal(((Byte) o).byteValue());
- }
- }
- break;
- }
- case BOOLEAN: {
- switch (toId) {
- case CHARACTER: {
- return new Character(txBooleanToChar(((Boolean) o).booleanValue()));
- }
- case BYTE: {
- return new Byte(txBooleanToByte(((Boolean) o).booleanValue()));
- }
- case BOOLEAN: {
- return o;
- }
- case TRISTATE: {
- return txBooleanToTriState(((Boolean) o).booleanValue());
- }
- case SHORT: {
- return new Short(txBooleanToShort(((Boolean) o).booleanValue()));
- }
- case INTEGER: {
- return new Integer(txBooleanToInt(((Boolean) o).booleanValue()));
- }
- case LONG: {
- return new Long(txBooleanToLong(((Boolean) o).booleanValue()));
- }
- case FLOAT: {
- return new Float(txBooleanToFloat(((Boolean) o).booleanValue()));
- }
- case DOUBLE: {
- return new Double(txBooleanToDouble(((Boolean) o).booleanValue()));
- }
- case STRING: {
- return txBooleanToString(((Boolean) o).booleanValue());
- }
- case OBJECT: {
- return o;
- }
- case BIGINTEGER: {
- return txBooleanToBigInteger(((Boolean) o).booleanValue());
- }
- case BIGDECIMAL: {
- return txBooleanToBigDecimal(((Boolean) o).booleanValue());
- }
- }
- break;
- }
- case TRISTATE: {
- switch (toId) {
- case CHARACTER: {
- return new Character(txTriStateToChar((TriState) o));
- }
- case BYTE: {
- return new Byte(txTriStateToByte((TriState) o));
- }
- case BOOLEAN: {
- return txTriStateToBoolean((TriState) o);
- }
- case TRISTATE: {
- return o;
- }
- case SHORT: {
- return new Short(txTriStateToShort((TriState) o));
- }
- case INTEGER: {
- return new Integer(txTriStateToInt((TriState) o));
- }
- case LONG: {
- return new Long(txTriStateToLong((TriState) o));
- }
- case FLOAT: {
- return new Float(txTriStateToFloat((TriState) o));
- }
- case DOUBLE: {
- return new Double(txTriStateToDouble((TriState) o));
- }
- case STRING: {
- return txTriStateToString((TriState) o);
- }
- case OBJECT: {
- return o;
- }
- case BIGINTEGER: {
- return txTriStateToBigInteger((TriState) o);
- }
- case BIGDECIMAL: {
- return txTriStateToBigDecimal((TriState) o);
- }
- }
- break;
- }
- case SHORT: {
- switch (toId) {
- case CHARACTER: {
- return new Character(txShortToChar(((Short) o).shortValue()));
- }
- case BYTE: {
- return new Byte(txShortToByte(((Short) o).shortValue()));
- }
- case BOOLEAN: {
- return new Boolean(txShortToBoolean(((Short) o).shortValue()));
- }
- case TRISTATE: {
- return txShortToTriState(((Short) o).shortValue());
- }
- case SHORT: {
- return o;
- }
- case INTEGER: {
- return new Integer(txShortToInt(((Short) o).shortValue()));
- }
- case LONG: {
- return new Long(txShortToLong(((Short) o).shortValue()));
- }
- case FLOAT: {
- return new Float(txShortToFloat(((Short) o).shortValue()));
- }
- case DOUBLE: {
- return new Double(txShortToDouble(((Short) o).shortValue()));
- }
- case STRING: {
- return txShortToString(((Short) o).shortValue());
- }
- case OBJECT: {
- return o;
- }
- case BIGINTEGER: {
- return txShortToBigInteger(((Short) o).shortValue());
- }
- case BIGDECIMAL: {
- return txShortToBigDecimal(((Short) o).shortValue());
- }
- }
- break;
- }
- case INTEGER: {
- switch (toId) {
- case CHARACTER: {
- return new Character(txIntToChar(((Integer) o).intValue()));
- }
- case BYTE: {
- return new Byte(txIntToByte(((Integer) o).intValue()));
- }
- case BOOLEAN: {
- return new Boolean(txIntToBoolean(((Integer) o).intValue()));
- }
- case TRISTATE: {
- return txIntToTriState(((Integer) o).intValue());
- }
- case SHORT: {
- return new Short(txIntToShort(((Integer) o).intValue()));
- }
- case INTEGER: {
- return o;
- }
- case LONG: {
- return new Long(txIntToLong(((Integer) o).intValue()));
- }
- case FLOAT: {
- return new Float(txIntToFloat(((Integer) o).intValue()));
- }
- case DOUBLE: {
- return new Double(txIntToDouble(((Integer) o).intValue()));
- }
- case STRING: {
- return txIntToString(((Integer) o).intValue());
- }
- case OBJECT: {
- return o;
- }
- case BIGINTEGER: {
- return txIntToBigInteger(((Integer) o).intValue());
- }
- case BIGDECIMAL: {
- return txIntToBigDecimal(((Integer) o).intValue());
- }
- }
- break;
- }
- case LONG: {
- switch (toId) {
- case CHARACTER: {
- return new Character(txLongToChar(((Long) o).longValue()));
- }
- case BYTE: {
- return new Byte(txLongToByte(((Long) o).longValue()));
- }
- case BOOLEAN: {
- return new Boolean(txLongToBoolean(((Long) o).longValue()));
- }
- case TRISTATE: {
- return txLongToTriState(((Long) o).longValue());
- }
- case SHORT: {
- return new Short(txLongToShort(((Long) o).longValue()));
- }
- case INTEGER: {
- return new Integer(txLongToInt(((Long) o).longValue()));
- }
- case LONG: {
- return o;
- }
- case FLOAT: {
- return new Float(txLongToFloat(((Long) o).longValue()));
- }
- case DOUBLE: {
- return new Double(txLongToDouble(((Long) o).longValue()));
- }
- case STRING: {
- return txLongToString(((Long) o).longValue());
- }
- case OBJECT: {
- return o;
- }
- case BIGINTEGER: {
- return txLongToBigInteger(((Long) o).longValue());
- }
- case BIGDECIMAL: {
- return txLongToBigDecimal(((Long) o).longValue());
- }
- }
- break;
- }
- case FLOAT: {
- switch (toId) {
- case CHARACTER: {
- return new Character(txFloatToChar(((Float) o).floatValue()));
- }
- case BYTE: {
- return new Byte(txFloatToByte(((Float) o).floatValue()));
- }
- case BOOLEAN: {
- return new Boolean(txFloatToBoolean(((Float) o).floatValue()));
- }
- case TRISTATE: {
- return txFloatToTriState(((Float) o).floatValue());
- }
- case SHORT: {
- return new Short(txFloatToShort(((Float) o).floatValue()));
- }
- case INTEGER: {
- return new Integer(txFloatToInt(((Float) o).floatValue()));
- }
- case LONG: {
- return new Long(txFloatToLong(((Float) o).floatValue()));
- }
- case FLOAT: {
- return o;
- }
- case DOUBLE: {
- return new Double(txFloatToDouble(((Float) o).floatValue()));
- }
- case STRING: {
- return txFloatToString(((Float) o).floatValue());
- }
- case OBJECT: {
- return o;
- }
- case BIGINTEGER: {
- return txFloatToBigInteger(((Float) o).floatValue());
- }
- case BIGDECIMAL: {
- return txFloatToBigDecimal(((Float) o).floatValue());
- }
- }
- break;
- }
- case DOUBLE: {
- switch (toId) {
- case CHARACTER: {
- return new Character(txDoubleToChar(((Double) o).doubleValue()));
- }
- case BYTE: {
- return new Byte(txDoubleToByte(((Double) o).doubleValue()));
- }
- case BOOLEAN: {
- return new Boolean(txDoubleToBoolean(((Double) o).doubleValue()));
- }
- case TRISTATE: {
- return txDoubleToTriState(((Double) o).doubleValue());
- }
- case SHORT: {
- return new Short(txDoubleToShort(((Double) o).doubleValue()));
- }
- case INTEGER: {
- return new Integer(txDoubleToInt(((Double) o).doubleValue()));
- }
- case LONG: {
- return new Long(txDoubleToLong(((Double) o).doubleValue()));
- }
- case FLOAT: {
- return new Float(txDoubleToFloat(((Double) o).doubleValue()));
- }
- case DOUBLE: {
- return o;
- }
- case STRING: {
- return txDoubleToString(((Double) o).doubleValue());
- }
- case OBJECT: {
- return o;
- }
- case BIGINTEGER: {
- return txDoubleToBigInteger(((Double) o).doubleValue());
- }
- case BIGDECIMAL: {
- return txDoubleToBigDecimal(((Double) o).doubleValue());
- }
- }
- break;
- }
- case STRING: {
- if (((String) o).length() == 0) {
- return null;// special handling for empty
- }
- // strings
- switch (toId) {
- case CHARACTER: {
- return new Character(txStringToChar((String) o));
- }
- case BYTE: {
- return new Byte(txStringToByte((String) o));
- }
- case BOOLEAN: {
- return new Boolean(txStringToBoolean((String) o));
- }
- case TRISTATE: {
- return txStringToTriState((String) o);
- }
- case SHORT: {
- return new Short(txStringToShort((String) o));
- }
- case INTEGER: {
- return new Integer(txStringToInt((String) o));
- }
- case LONG: {
- return new Long(txStringToLong((String) o));
- }
- case FLOAT: {
- return new Float(txStringToFloat((String) o));
- }
- case DOUBLE: {
- return new Double(txStringToDouble((String) o));
- }
- case STRING: {
- return o;
- }
- case OBJECT: {
- return o;
- }
- case DATE: {
- return txStringToDate((String) o);
- }
- case UTCDATE: {
- return txStringToUTCDate((String) o);
- }
- case CALENDAR: {
- return txStringToCalendar((String) o);
- }
- case SQLDATE: {
- return txStringToSqlDate((String) o);
- }
- case SQLTIME: {
- return txStringToSqlTime((String) o);
- }
- case SQLTIMESTAMP: {
- return txStringToSqlTimestamp((String) o);
- }
- case BIGINTEGER: {
- return txStringToBigInteger((String) o);
- }
- case BIGDECIMAL: {
- return txStringToBigDecimal((String) o);
- }
- }
- break;
- }
- case OBJECT: {
- switch (toId) {
- case STRING: {
- return txObjectToString(o);
- }
- case OBJECT: {
- return o;
- }
- }
- break;
- }
- case BIGINTEGER: {
- switch (toId) {
- case CHARACTER: {
- return new Character(txBigIntegerToChar((BigInteger) o));
- }
- case BYTE: {
- return new Byte(txBigIntegerToByte((BigInteger) o));
- }
- case BOOLEAN: {
- return new Boolean(txBigIntegerToBoolean((BigInteger) o));
- }
- case TRISTATE: {
- return txBigIntegerToTriState((BigInteger) o);
- }
- case SHORT: {
- return new Short(txBigIntegerToShort((BigInteger) o));
- }
- case INTEGER: {
- return new Integer(txBigIntegerToInt((BigInteger) o));
- }
- case LONG: {
- return new Long(txBigIntegerToLong((BigInteger) o));
- }
- case FLOAT: {
- return new Float(txBigIntegerToFloat((BigInteger) o));
- }
- case DOUBLE: {
- return new Double(txBigIntegerToDouble((BigInteger) o));
- }
- case STRING: {
- return txBigIntegerToString((BigInteger) o);
- }
- case OBJECT: {
- return o;
- }
- case BIGINTEGER: {
- return o;
- }
- case BIGDECIMAL: {
- return txBigIntegerToBigDecimal((BigInteger) o);
- }
- }
- break;
- }
- case BIGDECIMAL: {
- switch (toId) {
- case CHARACTER: {
- return new Character(txBigDecimalToChar((BigDecimal) o));
- }
- case BYTE: {
- return new Byte(txBigDecimalToByte((BigDecimal) o));
- }
- case BOOLEAN: {
- return new Boolean(txBigDecimalToBoolean((BigDecimal) o));
- }
- case TRISTATE: {
- return txBigDecimalToTriState((BigDecimal) o);
- }
- case SHORT: {
- return new Short(txBigDecimalToShort((BigDecimal) o));
- }
- case INTEGER: {
- return new Integer(txBigDecimalToInt((BigDecimal) o));
- }
- case LONG: {
- return new Long(txBigDecimalToLong((BigDecimal) o));
- }
- case FLOAT: {
- return new Float(txBigDecimalToFloat((BigDecimal) o));
- }
- case DOUBLE: {
- return new Double(txBigDecimalToDouble((BigDecimal) o));
- }
- case STRING: {
- return txBigDecimalToString((BigDecimal) o);
- }
- case OBJECT: {
- return o;
- }
- case BIGDECIMAL: {
- return o;
- }
- case BIGINTEGER: {
- return txBigDecimalToBigInteger((BigDecimal) o);
- }
- }
- break;
- }
- case DATE: {
- switch (toId) {
- case DATE: {
- return o;
- }
- case UTCDATE: {
- return txDateToUTCDate((Date) o);
- }
- case CALENDAR: {
- return txDateToCalendar((Date) o);
- }
- case SQLDATE: {
- return txDateToSqlDate((Date) o);
- }
- case SQLTIME: {
- return txDateToSqlTime((Date) o);
- }
- case SQLTIMESTAMP: {
- return txDateToSqlTimestamp((Date) o);
- }
- case STRING: {
- return txDateToString((Date) o);
- }
- case OBJECT: {
- return o;
- }
- }
- break;
- }
- case UTCDATE: {
- switch (toId) {
- case UTCDATE: {
- return o;
- }
- case DATE: {
- return txUTCDateToDate((UTCDate) o);
- }
- case CALENDAR: {
- return txUTCDateToCalendar((UTCDate) o);
- }
- case SQLDATE: {
- return txUTCDateToSqlDate((UTCDate) o);
- }
- case SQLTIME: {
- return txUTCDateToSqlTime((UTCDate) o);
- }
- case SQLTIMESTAMP: {
- return txUTCDateToSqlTimestamp((UTCDate) o);
- }
- case STRING: {
- return txUTCDateToString((UTCDate) o);
- }
- case OBJECT: {
- return o;
- }
- }
- break;
- }
- case CALENDAR: {
- switch (toId) {
- case DATE: {
- return txCalendarToDate((Calendar) o);
- }
- case UTCDATE: {
- return txCalendarToUTCDate((Calendar) o);
- }
- case CALENDAR: {
- return o;
- }
- case SQLDATE: {
- return txCalendarToSqlDate((Calendar) o);
- }
- case SQLTIME: {
- return txCalendarToSqlTime((Calendar) o);
- }
- case SQLTIMESTAMP: {
- return txCalendarToSqlTimestamp((Calendar) o);
- }
- case STRING: {
- return txCalendarToString((Calendar) o);
- }
- case OBJECT: {
- return o;
- }
- }
- break;
- }
- case SQLDATE: {
- switch (toId) {
- case DATE: {
- return o;
- }
- case UTCDATE: {
- return txSqlDateToUTCDate((java.sql.Date) o);
- }
- case CALENDAR: {
- return txSqlDateToCalendar((java.sql.Date) o);
- }
- case SQLDATE: {
- return o;
- }
- case SQLTIME: {
- return txSqlDateToSqlTime((java.sql.Date) o);
- }
- case SQLTIMESTAMP: {
- return txSqlDateToSqlTimestamp((java.sql.Date) o);
- }
- case STRING: {
- return txSqlDateToString((java.sql.Date) o);
- }
- case OBJECT: {
- return o;
- }
- }
- break;
- }
- case SQLTIME: {
- switch (toId) {
- case DATE: {
- return o;
- }
- case UTCDATE: {
- return txSqlTimeToUTCDate((java.sql.Time) o);
- }
- case CALENDAR: {
- return txSqlTimeToCalendar((java.sql.Time) o);
- }
- case SQLDATE: {
- return txSqlTimeToSqlDate((java.sql.Time) o);
- }
- case SQLTIME: {
- return o;
- }
- case SQLTIMESTAMP: {
- return txSqlTimeToSqlTimestamp((java.sql.Time) o);
- }
- case STRING: {
- return txSqlTimeToString((java.sql.Time) o);
- }
- case OBJECT: {
- return o;
- }
- }
- break;
- }
- case SQLTIMESTAMP: {
- switch (toId) {
- case DATE: {
- return o;
- }
- case UTCDATE: {
- return txSqlTimestampToUTCDate((java.sql.Timestamp) o);
- }
- case CALENDAR: {
- return txSqlTimestampToCalendar((java.sql.Timestamp) o);
- }
- case SQLDATE: {
- return txSqlTimestampToSqlDate((java.sql.Timestamp) o);
- }
- case SQLTIME: {
- return txSqlTimestampToSqlTime((java.sql.Timestamp) o);
- }
- case SQLTIMESTAMP: {
- return o;
- }
- case STRING: {
- return txSqlTimestampToString((java.sql.Timestamp) o);
- }
- case OBJECT: {
- return o;
- }
- }
- break;
- }
- }
- throw createException(o, fromType, toType, 4, "not implementated");
- }
-
- /**
- * Base Transformations
- */
-
- private byte txBooleanToByte(boolean o) {
- return (byte) (o ? 1 : 0);
- }
-
- private char txBooleanToChar(boolean o) {
- return (o ? 'X' : ' ');
- }
-
- private double txBooleanToDouble(boolean o) {
- return (o ? 1 : 0);
- }
-
- private float txBooleanToFloat(boolean o) {
- return (o ? 1 : 0);
- }
-
- private int txBooleanToInt(boolean o) {
- return (o ? 1 : 0);
- }
-
- private long txBooleanToLong(boolean o) {
- return (o ? 1 : 0);
- }
-
- private short txBooleanToShort(boolean o) {
- return (short) (o ? 1 : 0);
- }
-
- private String txBooleanToString(boolean o) {
- return String.valueOf(o);
- }
-
- private boolean txByteToBoolean(byte o) {
- return (o == 1);
- }
-
- private char txByteToChar(byte o) {
- return (char) (o);
- }
-
- private double txByteToDouble(byte o) {
- return (o);
- }
-
- private float txByteToFloat(byte o) {
- return (o);
- }
-
- private int txByteToInt(byte o) {
- return (o);
- }
-
- private long txByteToLong(byte o) {
- return (o);
- }
-
- private short txByteToShort(byte o) {
- return (o);
- }
-
- private String txByteToString(byte o) {
- return String.valueOf((char) o);
- }
-
- private boolean txCharToBoolean(char o) {
- return (o == 'X' || o == 'x' || o == '1');
- }
-
- private byte txCharToByte(char o) {
- return (byte) (o);
- }
-
- private double txCharToDouble(char o) {
- return Double.parseDouble(String.valueOf(o));
- }
-
- private float txCharToFloat(char o) {
- return Float.parseFloat(String.valueOf(o));
- }
-
- private int txCharToInt(char o) {
- return Integer.parseInt(String.valueOf(o));
- }
-
- private long txCharToLong(char o) {
- return Long.parseLong(String.valueOf(o));
- }
-
- private short txCharToShort(char o) {
- return Short.parseShort(String.valueOf(o));
- }
-
- private String txCharToString(char o) {
- return String.valueOf(o);
- }
-
- private boolean txDoubleToBoolean(double o) {
- return (o == 1.0);
- }
-
- private byte txDoubleToByte(double o) {
- return (byte) (o);
- }
-
- private char txDoubleToChar(double o) {
- return (char) (o);
- }
-
- private float txDoubleToFloat(double o) {
- return Float.parseFloat(String.valueOf(o));
- }
-
- private int txDoubleToInt(double o) {
- return (int) (o);
- }
-
- private long txDoubleToLong(double o) {
- return (long) (o);
- }
-
- private short txDoubleToShort(double o) {
- return (short) (o);
- }
-
- private String txDoubleToString(double o) {
- return String.valueOf(o);
- }
-
- private boolean txFloatToBoolean(float o) {
- return (o == 1f);
- }
-
- private byte txFloatToByte(float o) {
- return (byte) (o);
- }
-
- private char txFloatToChar(float o) {
- return (char) (o);
- }
-
- private double txFloatToDouble(float o) {
- return Double.parseDouble(String.valueOf(o));
- }
-
- private int txFloatToInt(float o) {
- return (int) (o);
- }
-
- private long txFloatToLong(float o) {
- return (long) (o);
- }
-
- private short txFloatToShort(float o) {
- return (short) (o);
- }
-
- private String txFloatToString(float o) {
- return String.valueOf(o);
- }
-
- private boolean txIntToBoolean(int o) {
- return (o == 1);
- }
-
- private byte txIntToByte(int o) {
- return (byte) (o);
- }
-
- private char txIntToChar(int o) {
- return (char) (o);
- }
-
- private double txIntToDouble(int o) {
- return (o);
- }
-
- private float txIntToFloat(int o) {
- return (o);
- }
-
- private long txIntToLong(int o) {
- return (o);
- }
-
- private short txIntToShort(int o) {
- return (short) (o);
- }
-
- private String txIntToString(int o) {
- return String.valueOf(o);
- }
-
- private boolean txLongToBoolean(long o) {
- return (o == 1L);
- }
-
- private byte txLongToByte(long o) {
- return (byte) (o);
- }
-
- private char txLongToChar(long o) {
- return (char) (o);
- }
-
- private double txLongToDouble(long o) {
- return (o);
- }
-
- private float txLongToFloat(long o) {
- return (o);
- }
-
- private int txLongToInt(long o) {
- return (int) (o);
- }
-
- private short txLongToShort(long o) {
- return (short) (o);
- }
-
- private String txLongToString(long o) {
- return String.valueOf(o);
- }
-
- private String txObjectToString(Object o) {
- return o.toString();
- }
-
- private boolean txShortToBoolean(short o) {
- return (o == 1);
- }
-
- private byte txShortToByte(short o) {
- return (byte) (o);
- }
-
- private char txShortToChar(short o) {
- return (char) (o);
- }
-
- private double txShortToDouble(short o) {
- return (o);
- }
-
- private float txShortToFloat(short o) {
- return (o);
- }
-
- private int txShortToInt(short o) {
- return (o);
- }
-
- private long txShortToLong(short o) {
- return (o);
- }
-
- private String txShortToString(short o) {
- return String.valueOf(o);
- }
-
- private boolean txStringToBoolean(String o) {
- o = o.toLowerCase();
- if (o.equals("true")) {
- return true;
- }
- if (o.equals("1")) {
- return true;
- }
- if (o.equals("yes")) {
- return true;
- }
- if (o.equals("x")) {
- return true;
- }
- if (o.equals("on")) {
- return true;
- }
- return false;
- }
-
- private byte txStringToByte(String o) {
- try {
- return Byte.parseByte(o);
- }
- catch (NumberFormatException nfe1) {
- return (byte) Float.parseFloat(o);
- }
- }
-
- private char txStringToChar(String o) {
- return o.charAt(0);
- }
-
- private double txStringToDouble(String o) {
- return Double.parseDouble(o);
- }
-
- private float txStringToFloat(String o) {
- return Float.parseFloat(o);
- }
-
- private int txStringToInt(String o) {
- try {
- return Integer.parseInt(o);
- }
- catch (NumberFormatException nfe1) {
- return (int) Float.parseFloat(o);
- }
- }
-
- private long txStringToLong(String o) {
- try {
- return Long.parseLong(o);
- }
- catch (NumberFormatException nfe1) {
- return (long) Double.parseDouble(o);
- }
- }
-
- private short txStringToShort(String o) {
- try {
- return Short.parseShort(o);
- }
- catch (NumberFormatException nfe1) {
- return (short) Float.parseFloat(o);
- }
- }
-
- // Phase 2
-
- private BigDecimal txBigIntegerToBigDecimal(BigInteger o) {
- return new BigDecimal(o);
- }
-
- private boolean txBigIntegerToBoolean(BigInteger o) {
- return o.equals(BigInteger.ONE);
- }
-
- private byte txBigIntegerToByte(BigInteger o) {
- return o.byteValue();
- }
-
- private char txBigIntegerToChar(BigInteger o) {
- return (char) o.intValue();
- }
-
- private double txBigIntegerToDouble(BigInteger o) {
- return o.doubleValue();
- }
-
- private float txBigIntegerToFloat(BigInteger o) {
- return o.floatValue();
- }
-
- private int txBigIntegerToInt(BigInteger o) {
- return o.intValue();
- }
-
- private long txBigIntegerToLong(BigInteger o) {
- return o.longValue();
- }
-
- private short txBigIntegerToShort(BigInteger o) {
- return o.shortValue();
- }
-
- private String txBigIntegerToString(BigInteger o) {
- return o.toString();
- }
-
- private BigInteger txBigDecimalToBigInteger(BigDecimal o) {
- return o.toBigInteger();
- }
-
- private boolean txBigDecimalToBoolean(BigDecimal o) {
- return o.equals(new BigDecimal(BigInteger.ONE));
- }
-
- private byte txBigDecimalToByte(BigDecimal o) {
- return o.byteValue();
- }
-
- private char txBigDecimalToChar(BigDecimal o) {
- return (char) o.intValue();
- }
-
- private double txBigDecimalToDouble(BigDecimal o) {
- return o.doubleValue();
- }
-
- private float txBigDecimalToFloat(BigDecimal o) {
- return o.floatValue();
- }
-
- private int txBigDecimalToInt(BigDecimal o) {
- return o.intValue();
- }
-
- private long txBigDecimalToLong(BigDecimal o) {
- return o.longValue();
- }
-
- private short txBigDecimalToShort(BigDecimal o) {
- return o.shortValue();
- }
-
- private String txBigDecimalToString(BigDecimal o) {
- return o.toString();
- }
-
- private BigDecimal txBooleanToBigDecimal(boolean o) {
- return new BigDecimal((o ? BigInteger.ONE : BigInteger.ZERO));
- }
-
- private BigInteger txBooleanToBigInteger(boolean o) {
- return (o ? BigInteger.ONE : BigInteger.ZERO);
- }
-
- private BigDecimal txByteToBigDecimal(byte o) {
- return BigDecimal.valueOf(o);
- }
-
- private BigInteger txByteToBigInteger(byte o) {
- return BigInteger.valueOf(o);
- }
-
- private Date txCalendarToDate(Calendar o) {
- return o.getTime();
- }
-
- private UTCDate txCalendarToUTCDate(Calendar o) {
- return new UTCDate(o.getTime().getTime());
- }
-
- private java.sql.Date txCalendarToSqlDate(Calendar o) {
- return new java.sql.Date(o.getTimeInMillis());
- }
-
- private java.sql.Time txCalendarToSqlTime(Calendar o) {
- return new java.sql.Time(o.getTimeInMillis());
- }
-
- private java.sql.Timestamp txCalendarToSqlTimestamp(Calendar o) {
- return new Timestamp(o.getTimeInMillis());
- }
-
- private String txCalendarToString(Calendar o) {
- return new SimpleDateFormat("dd.MM.yyyy'T'HH:mm:ss.sss'Z'").format(o.getTime());
- }
-
- private BigDecimal txCharToBigDecimal(char o) {
- return BigDecimal.valueOf(o);
- }
-
- private BigInteger txCharToBigInteger(char o) {
- return BigInteger.valueOf(o);
- }
-
- private Calendar txDateToCalendar(Date o) {
- GregorianCalendar cal = new GregorianCalendar();
- cal.setTime(o);
- return cal;
- }
-
- private UTCDate txDateToUTCDate(Date o) {
- return new UTCDate(o.getTime());
- }
-
- private java.sql.Date txDateToSqlDate(Date o) {
- return new java.sql.Date(o.getTime());
- }
-
- private java.sql.Time txDateToSqlTime(Date o) {
- return new java.sql.Time(o.getTime());
- }
-
- private java.sql.Timestamp txDateToSqlTimestamp(Date o) {
- return new Timestamp(o.getTime());
- }
-
- private String txDateToString(Date o) {
- return new SimpleDateFormat("dd.MM.yyyy'T'HH:mm:ss.sss'Z'").format(o);
- }
-
- private Date txUTCDateToDate(UTCDate o) {
- return o;
- }
-
- private Calendar txUTCDateToCalendar(UTCDate o) {
- GregorianCalendar cal = new GregorianCalendar();
- cal.setTime(o);
- return cal;
- }
-
- private java.sql.Date txUTCDateToSqlDate(UTCDate o) {
- return new java.sql.Date(o.getTime());
- }
-
- private java.sql.Time txUTCDateToSqlTime(UTCDate o) {
- return new java.sql.Time(o.getTime());
- }
-
- private java.sql.Timestamp txUTCDateToSqlTimestamp(UTCDate o) {
- return new java.sql.Timestamp(o.getTime());
- }
-
- private String txUTCDateToString(UTCDate o) {
- return new SimpleDateFormat("dd.MM.yyyy'T'HH:mm:ss.sss'Z'").format(o);
- }
-
- private BigDecimal txDoubleToBigDecimal(double o) {
- return new BigDecimal(Double.toString(o));
- }
-
- private BigInteger txDoubleToBigInteger(double o) {
- return BigInteger.valueOf((long) o);
- }
-
- private BigDecimal txFloatToBigDecimal(float o) {
- return new BigDecimal(String.valueOf(o));
- }
-
- private BigInteger txFloatToBigInteger(float o) {
- return BigInteger.valueOf((long) o);
- }
-
- private BigDecimal txIntToBigDecimal(int o) {
- return BigDecimal.valueOf(o);
- }
-
- private BigInteger txIntToBigInteger(int o) {
- return BigInteger.valueOf(o);
- }
-
- private BigDecimal txLongToBigDecimal(long o) {
- return BigDecimal.valueOf(o);
- }
-
- private BigInteger txLongToBigInteger(long o) {
- return BigInteger.valueOf(o);
- }
-
- private BigDecimal txShortToBigDecimal(short o) {
- return BigDecimal.valueOf(o);
- }
-
- private BigInteger txShortToBigInteger(short o) {
- return BigInteger.valueOf(o);
- }
-
- private Calendar txSqlDateToCalendar(java.sql.Date o) {
- GregorianCalendar cal = new GregorianCalendar();
- cal.setTime(o);
- return cal;
- }
-
- private java.sql.Time txSqlDateToSqlTime(java.sql.Date o) {
- return new Time(o.getTime());
- }
-
- private java.sql.Timestamp txSqlDateToSqlTimestamp(java.sql.Date o) {
- return new Timestamp(o.getTime());
- }
-
- private UTCDate txSqlDateToUTCDate(java.sql.Date o) {
- return new UTCDate(o.getTime());
- }
-
- private String txSqlDateToString(java.sql.Date o) {
- return new SimpleDateFormat("dd.MM.yyyy'T'HH:mm:ss.sss'Z'").format(o);
- }
-
- private Calendar txSqlTimestampToCalendar(java.sql.Timestamp o) {
- GregorianCalendar cal = new GregorianCalendar();
- cal.setTime(o);
- return cal;
- }
-
- private java.sql.Date txSqlTimestampToSqlDate(java.sql.Timestamp o) {
- return new java.sql.Date(o.getTime());
- }
-
- private java.sql.Time txSqlTimestampToSqlTime(java.sql.Timestamp o) {
- return new java.sql.Time(o.getTime());
- }
-
- private UTCDate txSqlTimestampToUTCDate(java.sql.Timestamp o) {
- return new UTCDate(o.getTime());
- }
-
- private String txSqlTimestampToString(java.sql.Timestamp o) {
- return new SimpleDateFormat("dd.MM.yyyy'T'HH:mm:ss.sss'Z'").format(o);
- }
-
- private Calendar txSqlTimeToCalendar(java.sql.Time o) {
- GregorianCalendar cal = new GregorianCalendar();
- cal.setTime(o);
- return cal;
- }
-
- private java.sql.Date txSqlTimeToSqlDate(java.sql.Time o) {
- return new java.sql.Date(o.getTime());
- }
-
- private java.sql.Timestamp txSqlTimeToSqlTimestamp(java.sql.Time o) {
- return new java.sql.Timestamp(o.getTime());
- }
-
- private UTCDate txSqlTimeToUTCDate(java.sql.Time o) {
- return new UTCDate(o.getTime());
- }
-
- private String txSqlTimeToString(java.sql.Time o) {
- return new SimpleDateFormat("dd.MM.yyyy'T'HH:mm:ss.sss'Z'").format(o);
- }
-
- private Date txStringToDate(String o) {
- try {
- return new SimpleDateFormat("dd.MM.yyyy'T'HH:mm:ss.sss'Z'").parse(o);
- }
- catch (ParseException pe) {
- throw createException(o, String.class, Date.class, 5, pe.getMessage());
- }
- }
-
- private UTCDate txStringToUTCDate(String o) {
- try {
- Date d = new SimpleDateFormat("dd.MM.yyyy'T'HH:mm:ss.sss'Z'").parse(o);
- return new UTCDate(d.getTime());
- }
- catch (ParseException pe) {
- throw createException(o, String.class, UTCDate.class, 5, pe.getMessage());
- }
- }
-
- private Calendar txStringToCalendar(String o) {
- try {
- Calendar cal = Calendar.getInstance();
- cal.setTime(new SimpleDateFormat("dd.MM.yyyy'T'HH:mm:ss.sss'Z'").parse(o));
- return cal;
- }
- catch (ParseException pe) {
- throw createException(o, String.class, Calendar.class, 6, pe.getMessage());
- }
- }
-
- private java.sql.Date txStringToSqlDate(String o) {
- try {
- return new java.sql.Date(new SimpleDateFormat("dd.MM.yyyy").parse(o).getTime());
- }
- catch (ParseException pe) {
- throw createException(o, String.class, java.sql.Date.class, 7, pe.getMessage());
- }
- }
-
- private java.sql.Time txStringToSqlTime(String o) {
- try {
- return new java.sql.Time(new SimpleDateFormat("HH:mm:ss.sss").parse(o).getTime());
- }
- catch (ParseException pe) {
- throw createException(o, String.class, java.sql.Time.class, 8, pe.getMessage());
- }
- }
-
- private java.sql.Timestamp txStringToSqlTimestamp(String o) {
- try {
- return new java.sql.Timestamp(new SimpleDateFormat("dd.MM.yyyy'T'HH:mm:ss.sss'Z'").parse(o).getTime());
- }
- catch (ParseException pe) {
- throw createException(o, String.class, java.sql.Timestamp.class, 8, pe.getMessage());
- }
- }
-
- private BigDecimal txStringToBigDecimal(String o) {
- return new BigDecimal(o);
- }
-
- private BigInteger txStringToBigInteger(String o) {
- return new BigDecimal(o).toBigInteger();
- }
-
- private byte txTriStateToByte(TriState o) {
- return o.isUndefined() ? -1 : o.getIntegerValue().byteValue();
- }
-
- private char txTriStateToChar(TriState o) {
- return o.isUndefined() ? '?' : o.getBooleanValue() ? 'X' : ' ';
- }
-
- private double txTriStateToDouble(TriState o) {
- return o.isUndefined() ? -1 : o.getIntegerValue().doubleValue();
- }
-
- private float txTriStateToFloat(TriState o) {
- return o.isUndefined() ? -1 : o.getIntegerValue().floatValue();
- }
-
- private int txTriStateToInt(TriState o) {
- return o.isUndefined() ? -1 : o.getIntegerValue().intValue();
- }
-
- private long txTriStateToLong(TriState o) {
- return o.isUndefined() ? -1 : o.getIntegerValue().longValue();
- }
-
- private short txTriStateToShort(TriState o) {
- return o.isUndefined() ? -1 : o.getIntegerValue().shortValue();
- }
-
- private String txTriStateToString(TriState o) {
- return o.toString();
- }
-
- private TriState txByteToTriState(byte o) {
- return TriState.parseTriState(o);
- }
-
- private TriState txCharToTriState(char o) {
- return TriState.parseTriState(o);
- }
-
- private TriState txDoubleToTriState(double o) {
- return TriState.parseTriState(o);
- }
-
- private TriState txFloatToTriState(float o) {
- return TriState.parseTriState(o);
- }
-
- private TriState txIntToTriState(int o) {
- return TriState.parseTriState(o);
- }
-
- private TriState txLongToTriState(long o) {
- return TriState.parseTriState(o);
- }
-
- private TriState txShortToTriState(short o) {
- return TriState.parseTriState(o);
- }
-
- private TriState txStringToTriState(String o) {
- return TriState.parseTriState(o);
- }
-
- private TriState txBigIntegerToTriState(BigInteger o) {
- return TriState.parseTriState(o);
- }
-
- private TriState txBigDecimalToTriState(BigDecimal o) {
- return TriState.parseTriState(o);
- }
-
- private BigDecimal txTriStateToBigDecimal(TriState o) {
- if (o.isUndefined()) {
- return null;
- }
- else if (o.getBooleanValue()) {
- return BigDecimal.ONE;
- }
- else {
- return BigDecimal.ZERO;
- }
- }
-
- private BigInteger txTriStateToBigInteger(TriState o) {
- if (o.isUndefined()) {
- return null;
- }
- else if (o.getBooleanValue()) {
- return BigInteger.ONE;
- }
- else {
- return BigInteger.ZERO;
- }
- }
-
- private TriState txBooleanToTriState(boolean o) {
- return TriState.parseTriState(o);
- }
-
- private boolean txTriStateToBoolean(TriState o) {
- return o.isUndefined() ? false : o.getBooleanValue().booleanValue();
- }
-
- private static class TypeDesc {
- int parameterizedTypeIndex;
- TypeVariable<?> typeVariable;
- Class resolvedClazz;
- int arrayDim;
- }
-
- /**
- * key for GenericsParameterClass with weak references so to allow for class unloading
- */
- private static class GPCKey {
- private final Class<?> m_queryClass;
- private final Class<?> m_genericsOwnerClass;
- private final int m_genericsParameterIndex;
-
- public GPCKey(Class queryClass, Class genericsOwnerClass, int genericsParameterIndex) {
- m_queryClass = queryClass;
- m_genericsOwnerClass = genericsOwnerClass;
- m_genericsParameterIndex = genericsParameterIndex;
- }
-
- @Override
- public int hashCode() {
- return (m_queryClass != null ? m_queryClass.hashCode() : 0) ^ (m_genericsOwnerClass != null ? m_genericsOwnerClass.hashCode() : 0) ^ m_genericsParameterIndex;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (!(obj instanceof GPCKey)) {
- return false;
- }
- GPCKey o = (GPCKey) obj;
- return (this.m_queryClass == o.m_queryClass) && (this.m_genericsOwnerClass == o.m_genericsOwnerClass) && (this.m_genericsParameterIndex == o.m_genericsParameterIndex);
- }
- }
-
- /**
- * {@link TypeCastUtility#getGenericsParameterClass(Class, Class, int)}
- */
- public static Class getGenericsParameterClass(Class queryClass, Class genericsOwnerClass) {
- return instance.getGenericsParameterClassImpl(queryClass, genericsOwnerClass, 0);
- }
-
- /**
- * @return the actual (declared) type of the generics parameter with index genericsParameterIndex on
- * genericsOwnerClass.
- * <p>
- * The generics parameter is defined on the genericsOwnerClass
- * <p>
- * The actual type must be declared on the queryClass
- * <p>
- * Example: queryType=LongArrayHolder, genericsOwnerClass=IHolder.class, genericsParameterIndex=0 since
- * IHolder has only one, returns Long[].class
- */
- public static Class getGenericsParameterClass(Class queryClass, Class genericsOwnerClass, int genericsParameterIndex) {
- return instance.getGenericsParameterClassImpl(queryClass, genericsOwnerClass, genericsParameterIndex);
- }
-
- private synchronized Class getGenericsParameterClassImpl(Class queryClass, Class genericsOwnerClass, int genericsParameterIndex) {
- GPCKey key = new GPCKey(queryClass, genericsOwnerClass, genericsParameterIndex);
- Class result = m_genericsParameterClassCache.get(key);
- if (result != null) {
- return result;
- }
- //
- m_debugEnabled = LOG.isDebugEnabled();
- if (m_debugEnabled) {
- LOG.debug("queryClass=" + queryClass + ", genericsOwnerClass=" + genericsOwnerClass + ", genericsParameterIndex=" + genericsParameterIndex);
- }
- TypeDesc desc = new TypeDesc();
- HashSet<Type> loopDetector = new HashSet<Type>();
- visitGenericsHierarchy(queryClass, genericsOwnerClass, genericsParameterIndex, desc, loopDetector);
- if (desc.resolvedClazz == null) {
- String s = (desc.typeVariable != null ? desc.typeVariable.getName() : "null");
- for (int i = 0; i < desc.arrayDim; i++) {
- s += "[]";
- }
- throw new IllegalArgumentException("cannot resolve " + s + " to a 'Class' type on " + queryClass);
- }
- if (desc.arrayDim > 0) {
- result = Array.newInstance(desc.resolvedClazz, new int[desc.arrayDim]).getClass();
- }
- else {
- result = desc.resolvedClazz;
- }
- m_genericsParameterClassCache.put(key, result);
- return result;
- }
-
- private boolean/* foundStopType */visitGenericsHierarchy(Type type, Class<?> stopType, int stopTypeGenericsParameterIndex, TypeDesc desc, HashSet<Type> loopDetector) {
- if (loopDetector.contains(type)) {
- return false;
- }
- if (type instanceof Class) {
- Class c = (Class) type;
- if (c == stopType) {
- //stop class, set generics index
- desc.parameterizedTypeIndex = stopTypeGenericsParameterIndex;
- if (m_debugEnabled) {
- LOG.debug("foundStopClass " + c + ", using generics index " + desc.parameterizedTypeIndex);
- }
- return true;
- }
- boolean foundStopClass = false;
- if (!foundStopClass) {
- if (!c.isInterface()) {
- Type a = c.getGenericSuperclass();
- if (a != null) {
- try {
- loopDetector.add(type);
- foundStopClass = visitGenericsHierarchy(a, stopType, stopTypeGenericsParameterIndex, desc, loopDetector);
- }
- finally {
- loopDetector.remove(type);
- }
- }
- }
- }
- if (!foundStopClass) {
- Type[] a = c.getGenericInterfaces();
- if (a.length > 0) {
- for (int i = 0; i < a.length && !foundStopClass; i++) {
- try {
- loopDetector.add(type);
- foundStopClass = visitGenericsHierarchy(a[i], stopType, stopTypeGenericsParameterIndex, desc, loopDetector);
- }
- finally {
- loopDetector.remove(type);
- }
- }
- }
- }
- if (foundStopClass) {
- if (m_debugEnabled) {
- LOG.debug("visit " + VerboseUtility.dumpGenerics(c));
- }
- if (desc.resolvedClazz == null) {
- //find the index of the typeParameter
- desc.parameterizedTypeIndex = 0;
- TypeVariable<?>[] vars = c.getTypeParameters();
- for (int i = 0; i < vars.length; i++) {
- if (vars[i] == desc.typeVariable) {
- if (m_debugEnabled) {
- LOG.debug(desc.typeVariable + " has index " + i);
- }
- desc.parameterizedTypeIndex = i;
- break;
- }
- }
- }
- return true;
- }
- return false;
- }
- //
- if (type instanceof ParameterizedType) {
- ParameterizedType pt = (ParameterizedType) type;
- Type rawType = pt.getRawType();
- try {
- loopDetector.add(pt);
- boolean b = visitGenericsHierarchy(rawType, stopType, stopTypeGenericsParameterIndex, desc, loopDetector);
- if (!b) {
- return false;
- }
- }
- finally {
- loopDetector.remove(pt);
- }
- //found path to stopClass
- if (m_debugEnabled) {
- LOG.debug("visit " + VerboseUtility.dumpGenerics(pt));
- }
- if (desc.resolvedClazz == null) {
- //find next type variable
- Type actualArg = pt.getActualTypeArguments()[desc.parameterizedTypeIndex];
- if (m_debugEnabled) {
- LOG.debug("index " + desc.parameterizedTypeIndex + " matches to " + actualArg);
- }
- while (actualArg instanceof GenericArrayType) {
- //it is something like <T[]>
- actualArg = ((GenericArrayType) actualArg).getGenericComponentType();
- desc.arrayDim++;
- }
- if (actualArg instanceof ParameterizedType) {
- //it is something like <Map<String,String>>
- actualArg = ((ParameterizedType) actualArg).getRawType();
- }
- if (actualArg instanceof Class) {
- desc.resolvedClazz = (Class) actualArg;
- }
- else if (actualArg instanceof TypeVariable) {
- desc.typeVariable = (TypeVariable) actualArg;
- }
- else {
- if (m_debugEnabled) {
- LOG.debug("failed with " + actualArg);
- }
- throw new IllegalArgumentException("expected ParameterizedType with actual argument of type Class or TypeVariable when encountered " + VerboseUtility.dumpGenerics(type));
- }
- }
- return true;
- }
- return false;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import java.lang.reflect.Array;
+import java.lang.reflect.GenericArrayType;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.lang.reflect.TypeVariable;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.sql.Time;
+import java.sql.Timestamp;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Collection;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+
+public final class TypeCastUtility {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(TypeCastUtility.class);
+
+ // singleton
+ private static TypeCastUtility instance = new TypeCastUtility();
+
+ private static final int CHARACTER = 1;
+ private static final int BYTE = 2;
+ private static final int BOOLEAN = 3;
+ private static final int SHORT = 4;
+ private static final int INTEGER = 5;
+ private static final int LONG = 6;
+ private static final int FLOAT = 7;
+ private static final int DOUBLE = 8;
+ private static final int STRING = 9;
+ private static final int OBJECT = 10;
+ private static final int BIGINTEGER = 11;
+ private static final int BIGDECIMAL = 12;
+ private static final int DATE = 13;
+ private static final int CALENDAR = 14;
+ private static final int SQLDATE = 15;
+ private static final int SQLTIME = 16;
+ private static final int SQLTIMESTAMP = 17;
+ private static final int TRISTATE = 18;
+ private static final int UTCDATE = 19;
+ private static final int VOID = 9999;
+
+ @SuppressWarnings("unchecked")
+ public static <T> T castValue(Object o, Class<T> castType) {
+ return (T) instance.castValueImpl(o, castType);
+ }
+
+ // instance
+ /**
+ * fast access to debug flag
+ */
+ private boolean m_debugEnabled;
+ private final HashMap<Class, Class> m_wrapperTypeMap = new HashMap<Class, Class>();
+ private final HashMap<Class, Integer> m_typeMap = new HashMap<Class, Integer>();
+ private final HashMap<Class, Integer> m_primitiveTypeMap = new HashMap<Class, Integer>();
+ private final HashMap<GPCKey, Class<?>> m_genericsParameterClassCache = new HashMap<GPCKey, Class<?>>();
+
+ private TypeCastUtility() {
+ m_wrapperTypeMap.put(char.class, Character.class);
+ m_wrapperTypeMap.put(byte.class, Byte.class);
+ m_wrapperTypeMap.put(boolean.class, Boolean.class);
+ m_wrapperTypeMap.put(short.class, Short.class);
+ m_wrapperTypeMap.put(int.class, Integer.class);
+ m_wrapperTypeMap.put(long.class, Long.class);
+ m_wrapperTypeMap.put(float.class, Float.class);
+ m_wrapperTypeMap.put(double.class, Double.class);
+ m_wrapperTypeMap.put(void.class, Void.class);
+ //
+ m_typeMap.put(Character.class, new Integer(CHARACTER));
+ m_typeMap.put(Byte.class, new Integer(BYTE));
+ m_typeMap.put(Boolean.class, new Integer(BOOLEAN));
+ m_typeMap.put(TriState.class, new Integer(TRISTATE));
+ m_typeMap.put(Short.class, new Integer(SHORT));
+ m_typeMap.put(Integer.class, new Integer(INTEGER));
+ m_typeMap.put(Long.class, new Integer(LONG));
+ m_typeMap.put(Float.class, new Integer(FLOAT));
+ m_typeMap.put(Double.class, new Integer(DOUBLE));
+ m_typeMap.put(String.class, new Integer(STRING));
+ m_typeMap.put(Object.class, new Integer(OBJECT));
+ m_typeMap.put(BigInteger.class, new Integer(BIGINTEGER));
+ m_typeMap.put(BigDecimal.class, new Integer(BIGDECIMAL));
+ m_typeMap.put(UTCDate.class, new Integer(UTCDATE));
+ m_typeMap.put(Date.class, new Integer(DATE));
+ m_typeMap.put(Calendar.class, new Integer(CALENDAR));
+ m_typeMap.put(GregorianCalendar.class, new Integer(CALENDAR));
+ m_typeMap.put(java.sql.Date.class, new Integer(SQLDATE));
+ m_typeMap.put(Time.class, new Integer(SQLTIME));
+ m_typeMap.put(Timestamp.class, new Integer(SQLTIMESTAMP));
+ m_typeMap.put(Void.class, new Integer(VOID));
+ //
+ m_primitiveTypeMap.put(boolean.class, new Integer(BOOLEAN));
+ m_primitiveTypeMap.put(byte.class, new Integer(BYTE));
+ m_primitiveTypeMap.put(char.class, new Integer(CHARACTER));
+ m_primitiveTypeMap.put(short.class, new Integer(SHORT));
+ m_primitiveTypeMap.put(int.class, new Integer(INTEGER));
+ m_primitiveTypeMap.put(long.class, new Integer(LONG));
+ m_primitiveTypeMap.put(float.class, new Integer(FLOAT));
+ m_primitiveTypeMap.put(double.class, new Integer(DOUBLE));
+ }
+
+ @SuppressWarnings("unchecked")
+ private Object castValueImpl(Object o, Class castType) {
+ Class toType = castType;
+ // null check
+ if (o == null) {
+ // primitive null-representation
+ if (toType.isPrimitive()) {
+ return getPrimitiveNull(toType);
+ }
+ return null;
+ }
+ // get non-primitive type
+ if (toType.isPrimitive()) {
+ toType = getWrappedType(toType);
+ }
+ // direct check
+ if (toType.isInstance(o)) {
+ return o;
+ }
+
+ // need conversion
+ Class fromType = o.getClass();
+ // array check
+ if (toType.isArray()) {
+ return castArrayValueImpl(o, fromType, toType);
+ }
+ else {
+ return castBasicValueImpl(o, fromType, toType);
+ }
+ }
+
+ /**
+ * type to typeId
+ */
+ private int getTypeId(Class type) {
+ Integer id = m_typeMap.get(type);
+ if (id == null) {
+ return 0;
+ }
+ else {
+ return id.intValue();
+ }
+ }
+
+ /**
+ * type to typeId
+ */
+ private int getPrimitiveTypeId(Class type) {
+ Integer id = m_primitiveTypeMap.get(type);
+ if (id == null) {
+ return 0;
+ }
+ else {
+ return id.intValue();
+ }
+ }
+
+ /**
+ * wrapper type for primitive types
+ */
+ private Class getWrappedType(Class primitiveType) {
+ Class wrappedType = m_wrapperTypeMap.get(primitiveType);
+ return wrappedType;
+ }
+
+ /**
+ * Null representation of a primitive type (0,false)
+ */
+ @SuppressWarnings("unchecked")
+ private <T> T getPrimitiveNull(Class<T> primitiveType) {
+ int fromId = getPrimitiveTypeId(primitiveType);
+ if (fromId == 0) {
+ throw new IllegalArgumentException(primitiveType + " no primitive type");
+ }
+ switch (fromId) {
+ case BOOLEAN: {
+ return (T) new Boolean(false);
+ }
+ case BYTE: {
+ return (T) Byte.valueOf((byte) 0);
+ }
+ case CHARACTER: {
+ return (T) new Character('\u0000');
+ }
+ case SHORT: {
+ return (T) new Short((short) 0);
+ }
+ case INTEGER: {
+ return (T) new Integer(0);
+ }
+ case LONG: {
+ return (T) new Long(0L);
+ }
+ case FLOAT: {
+ return (T) new Float(0.0f);
+ }
+ case DOUBLE: {
+ return (T) new Double(0.0);
+ }
+ default: {
+ throw new IllegalArgumentException(primitiveType + " no primitive type");
+ }
+ }
+ }
+
+ /**
+ * exception builder
+ */
+ private IllegalArgumentException createException(Object o, Class fromType, Class toType, int code, String msg) {
+ return new IllegalArgumentException(
+ "converting " +
+ VerboseUtility.dumpObject(o) +
+ " from " +
+ VerboseUtility.dumpType(fromType) +
+ " to " +
+ VerboseUtility.dumpType(toType) +
+ " failed with code " +
+ code +
+ " (" + msg + ")");
+ }
+
+ private Object castArrayValueImpl(Object o, Class fromType, Class toType) {
+ if (!fromType.isArray()) {
+ // integrate collections framework. collections can be transformed to
+ // arrays
+ if (o instanceof Collection) {
+ o = ((Collection) o).toArray();
+ fromType = o.getClass();
+ }
+ else if (o instanceof Map) {
+ o = ((Map) o).values().toArray();
+ fromType = o.getClass();
+ }
+ else {
+ throw createException(o, fromType, toType, 1, "object is not an array");
+ }
+ }
+ Class toCompType = toType.getComponentType();
+ // calculate dimension
+ int dim = 0;
+ Class t = toType;
+ while (t.isArray()) {
+ // next
+ dim++;
+ t = t.getComponentType();
+ }
+ // create array dims
+ int[] dims = new int[dim];
+ dim = 0;
+ Object od = o;
+ t = toType;
+ while (t.isArray()) {
+ dims[dim] = Array.getLength(od);
+ t = t.getComponentType();
+ if (dims[dim] == 0) {
+ break;// if array length is 0 break up
+ }
+ // next
+ od = Array.get(od, 0);
+ dim++;
+ }
+ // create array
+ Object newArray = Array.newInstance(t, dims);
+ for (int i = 0, ni = dims[0]; i < ni; i++) {
+ Object castedElement = castValueImpl(Array.get(o, i), toCompType);
+ Array.set(newArray, i, castedElement);
+ }
+ return newArray;
+ }
+
+ private Object castBasicValueImpl(Object o, Class fromType, Class toType) {
+ // null check
+ if (o == null) {
+ return null;
+ }
+ // from type in map
+ int fromId = getTypeId(fromType);
+ if (fromId == 0) {
+ throw createException(o, fromType, toType, 2, "no from-mapping");
+ }
+ // to type in map
+ int toId = getTypeId(toType);
+ if (toId == 0) {
+ throw createException(o, fromType, toType, 3, "no to-mapping");
+ }
+ switch (fromId) {
+ case CHARACTER: {
+ switch (toId) {
+ case CHARACTER: {
+ return o;
+ }
+ case BYTE: {
+ return new Byte(txCharToByte(((Character) o).charValue()));
+ }
+ case BOOLEAN: {
+ return new Boolean(txCharToBoolean(((Character) o).charValue()));
+ }
+ case TRISTATE: {
+ return txCharToTriState(((Character) o).charValue());
+ }
+ case SHORT: {
+ return new Short(txCharToShort(((Character) o).charValue()));
+ }
+ case INTEGER: {
+ return new Integer(txCharToInt(((Character) o).charValue()));
+ }
+ case LONG: {
+ return new Long(txCharToLong(((Character) o).charValue()));
+ }
+ case FLOAT: {
+ return new Float(txCharToFloat(((Character) o).charValue()));
+ }
+ case DOUBLE: {
+ return new Double(txCharToDouble(((Character) o).charValue()));
+ }
+ case STRING: {
+ return txCharToString(((Character) o).charValue());
+ }
+ case OBJECT: {
+ return o;
+ }
+ case BIGINTEGER: {
+ return txCharToBigInteger(((Character) o).charValue());
+ }
+ case BIGDECIMAL: {
+ return txCharToBigDecimal(((Character) o).charValue());
+ }
+ }
+ break;
+ }
+ case BYTE: {
+ switch (toId) {
+ case CHARACTER: {
+ return new Character(txByteToChar(((Byte) o).byteValue()));
+ }
+ case BYTE: {
+ return o;
+ }
+ case BOOLEAN: {
+ return new Boolean(txByteToBoolean(((Byte) o).byteValue()));
+ }
+ case TRISTATE: {
+ return txByteToTriState(((Byte) o).byteValue());
+ }
+ case SHORT: {
+ return new Short(txByteToShort(((Byte) o).byteValue()));
+ }
+ case INTEGER: {
+ return new Integer(txByteToInt(((Byte) o).byteValue()));
+ }
+ case LONG: {
+ return new Long(txByteToLong(((Byte) o).byteValue()));
+ }
+ case FLOAT: {
+ return new Float(txByteToFloat(((Byte) o).byteValue()));
+ }
+ case DOUBLE: {
+ return new Double(txByteToDouble(((Byte) o).byteValue()));
+ }
+ case STRING: {
+ return txByteToString(((Byte) o).byteValue());
+ }
+ case OBJECT: {
+ return o;
+ }
+ case BIGINTEGER: {
+ return txByteToBigInteger(((Byte) o).byteValue());
+ }
+ case BIGDECIMAL: {
+ return txByteToBigDecimal(((Byte) o).byteValue());
+ }
+ }
+ break;
+ }
+ case BOOLEAN: {
+ switch (toId) {
+ case CHARACTER: {
+ return new Character(txBooleanToChar(((Boolean) o).booleanValue()));
+ }
+ case BYTE: {
+ return new Byte(txBooleanToByte(((Boolean) o).booleanValue()));
+ }
+ case BOOLEAN: {
+ return o;
+ }
+ case TRISTATE: {
+ return txBooleanToTriState(((Boolean) o).booleanValue());
+ }
+ case SHORT: {
+ return new Short(txBooleanToShort(((Boolean) o).booleanValue()));
+ }
+ case INTEGER: {
+ return new Integer(txBooleanToInt(((Boolean) o).booleanValue()));
+ }
+ case LONG: {
+ return new Long(txBooleanToLong(((Boolean) o).booleanValue()));
+ }
+ case FLOAT: {
+ return new Float(txBooleanToFloat(((Boolean) o).booleanValue()));
+ }
+ case DOUBLE: {
+ return new Double(txBooleanToDouble(((Boolean) o).booleanValue()));
+ }
+ case STRING: {
+ return txBooleanToString(((Boolean) o).booleanValue());
+ }
+ case OBJECT: {
+ return o;
+ }
+ case BIGINTEGER: {
+ return txBooleanToBigInteger(((Boolean) o).booleanValue());
+ }
+ case BIGDECIMAL: {
+ return txBooleanToBigDecimal(((Boolean) o).booleanValue());
+ }
+ }
+ break;
+ }
+ case TRISTATE: {
+ switch (toId) {
+ case CHARACTER: {
+ return new Character(txTriStateToChar((TriState) o));
+ }
+ case BYTE: {
+ return new Byte(txTriStateToByte((TriState) o));
+ }
+ case BOOLEAN: {
+ return txTriStateToBoolean((TriState) o);
+ }
+ case TRISTATE: {
+ return o;
+ }
+ case SHORT: {
+ return new Short(txTriStateToShort((TriState) o));
+ }
+ case INTEGER: {
+ return new Integer(txTriStateToInt((TriState) o));
+ }
+ case LONG: {
+ return new Long(txTriStateToLong((TriState) o));
+ }
+ case FLOAT: {
+ return new Float(txTriStateToFloat((TriState) o));
+ }
+ case DOUBLE: {
+ return new Double(txTriStateToDouble((TriState) o));
+ }
+ case STRING: {
+ return txTriStateToString((TriState) o);
+ }
+ case OBJECT: {
+ return o;
+ }
+ case BIGINTEGER: {
+ return txTriStateToBigInteger((TriState) o);
+ }
+ case BIGDECIMAL: {
+ return txTriStateToBigDecimal((TriState) o);
+ }
+ }
+ break;
+ }
+ case SHORT: {
+ switch (toId) {
+ case CHARACTER: {
+ return new Character(txShortToChar(((Short) o).shortValue()));
+ }
+ case BYTE: {
+ return new Byte(txShortToByte(((Short) o).shortValue()));
+ }
+ case BOOLEAN: {
+ return new Boolean(txShortToBoolean(((Short) o).shortValue()));
+ }
+ case TRISTATE: {
+ return txShortToTriState(((Short) o).shortValue());
+ }
+ case SHORT: {
+ return o;
+ }
+ case INTEGER: {
+ return new Integer(txShortToInt(((Short) o).shortValue()));
+ }
+ case LONG: {
+ return new Long(txShortToLong(((Short) o).shortValue()));
+ }
+ case FLOAT: {
+ return new Float(txShortToFloat(((Short) o).shortValue()));
+ }
+ case DOUBLE: {
+ return new Double(txShortToDouble(((Short) o).shortValue()));
+ }
+ case STRING: {
+ return txShortToString(((Short) o).shortValue());
+ }
+ case OBJECT: {
+ return o;
+ }
+ case BIGINTEGER: {
+ return txShortToBigInteger(((Short) o).shortValue());
+ }
+ case BIGDECIMAL: {
+ return txShortToBigDecimal(((Short) o).shortValue());
+ }
+ }
+ break;
+ }
+ case INTEGER: {
+ switch (toId) {
+ case CHARACTER: {
+ return new Character(txIntToChar(((Integer) o).intValue()));
+ }
+ case BYTE: {
+ return new Byte(txIntToByte(((Integer) o).intValue()));
+ }
+ case BOOLEAN: {
+ return new Boolean(txIntToBoolean(((Integer) o).intValue()));
+ }
+ case TRISTATE: {
+ return txIntToTriState(((Integer) o).intValue());
+ }
+ case SHORT: {
+ return new Short(txIntToShort(((Integer) o).intValue()));
+ }
+ case INTEGER: {
+ return o;
+ }
+ case LONG: {
+ return new Long(txIntToLong(((Integer) o).intValue()));
+ }
+ case FLOAT: {
+ return new Float(txIntToFloat(((Integer) o).intValue()));
+ }
+ case DOUBLE: {
+ return new Double(txIntToDouble(((Integer) o).intValue()));
+ }
+ case STRING: {
+ return txIntToString(((Integer) o).intValue());
+ }
+ case OBJECT: {
+ return o;
+ }
+ case BIGINTEGER: {
+ return txIntToBigInteger(((Integer) o).intValue());
+ }
+ case BIGDECIMAL: {
+ return txIntToBigDecimal(((Integer) o).intValue());
+ }
+ }
+ break;
+ }
+ case LONG: {
+ switch (toId) {
+ case CHARACTER: {
+ return new Character(txLongToChar(((Long) o).longValue()));
+ }
+ case BYTE: {
+ return new Byte(txLongToByte(((Long) o).longValue()));
+ }
+ case BOOLEAN: {
+ return new Boolean(txLongToBoolean(((Long) o).longValue()));
+ }
+ case TRISTATE: {
+ return txLongToTriState(((Long) o).longValue());
+ }
+ case SHORT: {
+ return new Short(txLongToShort(((Long) o).longValue()));
+ }
+ case INTEGER: {
+ return new Integer(txLongToInt(((Long) o).longValue()));
+ }
+ case LONG: {
+ return o;
+ }
+ case FLOAT: {
+ return new Float(txLongToFloat(((Long) o).longValue()));
+ }
+ case DOUBLE: {
+ return new Double(txLongToDouble(((Long) o).longValue()));
+ }
+ case STRING: {
+ return txLongToString(((Long) o).longValue());
+ }
+ case OBJECT: {
+ return o;
+ }
+ case BIGINTEGER: {
+ return txLongToBigInteger(((Long) o).longValue());
+ }
+ case BIGDECIMAL: {
+ return txLongToBigDecimal(((Long) o).longValue());
+ }
+ }
+ break;
+ }
+ case FLOAT: {
+ switch (toId) {
+ case CHARACTER: {
+ return new Character(txFloatToChar(((Float) o).floatValue()));
+ }
+ case BYTE: {
+ return new Byte(txFloatToByte(((Float) o).floatValue()));
+ }
+ case BOOLEAN: {
+ return new Boolean(txFloatToBoolean(((Float) o).floatValue()));
+ }
+ case TRISTATE: {
+ return txFloatToTriState(((Float) o).floatValue());
+ }
+ case SHORT: {
+ return new Short(txFloatToShort(((Float) o).floatValue()));
+ }
+ case INTEGER: {
+ return new Integer(txFloatToInt(((Float) o).floatValue()));
+ }
+ case LONG: {
+ return new Long(txFloatToLong(((Float) o).floatValue()));
+ }
+ case FLOAT: {
+ return o;
+ }
+ case DOUBLE: {
+ return new Double(txFloatToDouble(((Float) o).floatValue()));
+ }
+ case STRING: {
+ return txFloatToString(((Float) o).floatValue());
+ }
+ case OBJECT: {
+ return o;
+ }
+ case BIGINTEGER: {
+ return txFloatToBigInteger(((Float) o).floatValue());
+ }
+ case BIGDECIMAL: {
+ return txFloatToBigDecimal(((Float) o).floatValue());
+ }
+ }
+ break;
+ }
+ case DOUBLE: {
+ switch (toId) {
+ case CHARACTER: {
+ return new Character(txDoubleToChar(((Double) o).doubleValue()));
+ }
+ case BYTE: {
+ return new Byte(txDoubleToByte(((Double) o).doubleValue()));
+ }
+ case BOOLEAN: {
+ return new Boolean(txDoubleToBoolean(((Double) o).doubleValue()));
+ }
+ case TRISTATE: {
+ return txDoubleToTriState(((Double) o).doubleValue());
+ }
+ case SHORT: {
+ return new Short(txDoubleToShort(((Double) o).doubleValue()));
+ }
+ case INTEGER: {
+ return new Integer(txDoubleToInt(((Double) o).doubleValue()));
+ }
+ case LONG: {
+ return new Long(txDoubleToLong(((Double) o).doubleValue()));
+ }
+ case FLOAT: {
+ return new Float(txDoubleToFloat(((Double) o).doubleValue()));
+ }
+ case DOUBLE: {
+ return o;
+ }
+ case STRING: {
+ return txDoubleToString(((Double) o).doubleValue());
+ }
+ case OBJECT: {
+ return o;
+ }
+ case BIGINTEGER: {
+ return txDoubleToBigInteger(((Double) o).doubleValue());
+ }
+ case BIGDECIMAL: {
+ return txDoubleToBigDecimal(((Double) o).doubleValue());
+ }
+ }
+ break;
+ }
+ case STRING: {
+ if (((String) o).length() == 0) {
+ return null;// special handling for empty
+ }
+ // strings
+ switch (toId) {
+ case CHARACTER: {
+ return new Character(txStringToChar((String) o));
+ }
+ case BYTE: {
+ return new Byte(txStringToByte((String) o));
+ }
+ case BOOLEAN: {
+ return new Boolean(txStringToBoolean((String) o));
+ }
+ case TRISTATE: {
+ return txStringToTriState((String) o);
+ }
+ case SHORT: {
+ return new Short(txStringToShort((String) o));
+ }
+ case INTEGER: {
+ return new Integer(txStringToInt((String) o));
+ }
+ case LONG: {
+ return new Long(txStringToLong((String) o));
+ }
+ case FLOAT: {
+ return new Float(txStringToFloat((String) o));
+ }
+ case DOUBLE: {
+ return new Double(txStringToDouble((String) o));
+ }
+ case STRING: {
+ return o;
+ }
+ case OBJECT: {
+ return o;
+ }
+ case DATE: {
+ return txStringToDate((String) o);
+ }
+ case UTCDATE: {
+ return txStringToUTCDate((String) o);
+ }
+ case CALENDAR: {
+ return txStringToCalendar((String) o);
+ }
+ case SQLDATE: {
+ return txStringToSqlDate((String) o);
+ }
+ case SQLTIME: {
+ return txStringToSqlTime((String) o);
+ }
+ case SQLTIMESTAMP: {
+ return txStringToSqlTimestamp((String) o);
+ }
+ case BIGINTEGER: {
+ return txStringToBigInteger((String) o);
+ }
+ case BIGDECIMAL: {
+ return txStringToBigDecimal((String) o);
+ }
+ }
+ break;
+ }
+ case OBJECT: {
+ switch (toId) {
+ case STRING: {
+ return txObjectToString(o);
+ }
+ case OBJECT: {
+ return o;
+ }
+ }
+ break;
+ }
+ case BIGINTEGER: {
+ switch (toId) {
+ case CHARACTER: {
+ return new Character(txBigIntegerToChar((BigInteger) o));
+ }
+ case BYTE: {
+ return new Byte(txBigIntegerToByte((BigInteger) o));
+ }
+ case BOOLEAN: {
+ return new Boolean(txBigIntegerToBoolean((BigInteger) o));
+ }
+ case TRISTATE: {
+ return txBigIntegerToTriState((BigInteger) o);
+ }
+ case SHORT: {
+ return new Short(txBigIntegerToShort((BigInteger) o));
+ }
+ case INTEGER: {
+ return new Integer(txBigIntegerToInt((BigInteger) o));
+ }
+ case LONG: {
+ return new Long(txBigIntegerToLong((BigInteger) o));
+ }
+ case FLOAT: {
+ return new Float(txBigIntegerToFloat((BigInteger) o));
+ }
+ case DOUBLE: {
+ return new Double(txBigIntegerToDouble((BigInteger) o));
+ }
+ case STRING: {
+ return txBigIntegerToString((BigInteger) o);
+ }
+ case OBJECT: {
+ return o;
+ }
+ case BIGINTEGER: {
+ return o;
+ }
+ case BIGDECIMAL: {
+ return txBigIntegerToBigDecimal((BigInteger) o);
+ }
+ }
+ break;
+ }
+ case BIGDECIMAL: {
+ switch (toId) {
+ case CHARACTER: {
+ return new Character(txBigDecimalToChar((BigDecimal) o));
+ }
+ case BYTE: {
+ return new Byte(txBigDecimalToByte((BigDecimal) o));
+ }
+ case BOOLEAN: {
+ return new Boolean(txBigDecimalToBoolean((BigDecimal) o));
+ }
+ case TRISTATE: {
+ return txBigDecimalToTriState((BigDecimal) o);
+ }
+ case SHORT: {
+ return new Short(txBigDecimalToShort((BigDecimal) o));
+ }
+ case INTEGER: {
+ return new Integer(txBigDecimalToInt((BigDecimal) o));
+ }
+ case LONG: {
+ return new Long(txBigDecimalToLong((BigDecimal) o));
+ }
+ case FLOAT: {
+ return new Float(txBigDecimalToFloat((BigDecimal) o));
+ }
+ case DOUBLE: {
+ return new Double(txBigDecimalToDouble((BigDecimal) o));
+ }
+ case STRING: {
+ return txBigDecimalToString((BigDecimal) o);
+ }
+ case OBJECT: {
+ return o;
+ }
+ case BIGDECIMAL: {
+ return o;
+ }
+ case BIGINTEGER: {
+ return txBigDecimalToBigInteger((BigDecimal) o);
+ }
+ }
+ break;
+ }
+ case DATE: {
+ switch (toId) {
+ case DATE: {
+ return o;
+ }
+ case UTCDATE: {
+ return txDateToUTCDate((Date) o);
+ }
+ case CALENDAR: {
+ return txDateToCalendar((Date) o);
+ }
+ case SQLDATE: {
+ return txDateToSqlDate((Date) o);
+ }
+ case SQLTIME: {
+ return txDateToSqlTime((Date) o);
+ }
+ case SQLTIMESTAMP: {
+ return txDateToSqlTimestamp((Date) o);
+ }
+ case STRING: {
+ return txDateToString((Date) o);
+ }
+ case OBJECT: {
+ return o;
+ }
+ }
+ break;
+ }
+ case UTCDATE: {
+ switch (toId) {
+ case UTCDATE: {
+ return o;
+ }
+ case DATE: {
+ return txUTCDateToDate((UTCDate) o);
+ }
+ case CALENDAR: {
+ return txUTCDateToCalendar((UTCDate) o);
+ }
+ case SQLDATE: {
+ return txUTCDateToSqlDate((UTCDate) o);
+ }
+ case SQLTIME: {
+ return txUTCDateToSqlTime((UTCDate) o);
+ }
+ case SQLTIMESTAMP: {
+ return txUTCDateToSqlTimestamp((UTCDate) o);
+ }
+ case STRING: {
+ return txUTCDateToString((UTCDate) o);
+ }
+ case OBJECT: {
+ return o;
+ }
+ }
+ break;
+ }
+ case CALENDAR: {
+ switch (toId) {
+ case DATE: {
+ return txCalendarToDate((Calendar) o);
+ }
+ case UTCDATE: {
+ return txCalendarToUTCDate((Calendar) o);
+ }
+ case CALENDAR: {
+ return o;
+ }
+ case SQLDATE: {
+ return txCalendarToSqlDate((Calendar) o);
+ }
+ case SQLTIME: {
+ return txCalendarToSqlTime((Calendar) o);
+ }
+ case SQLTIMESTAMP: {
+ return txCalendarToSqlTimestamp((Calendar) o);
+ }
+ case STRING: {
+ return txCalendarToString((Calendar) o);
+ }
+ case OBJECT: {
+ return o;
+ }
+ }
+ break;
+ }
+ case SQLDATE: {
+ switch (toId) {
+ case DATE: {
+ return o;
+ }
+ case UTCDATE: {
+ return txSqlDateToUTCDate((java.sql.Date) o);
+ }
+ case CALENDAR: {
+ return txSqlDateToCalendar((java.sql.Date) o);
+ }
+ case SQLDATE: {
+ return o;
+ }
+ case SQLTIME: {
+ return txSqlDateToSqlTime((java.sql.Date) o);
+ }
+ case SQLTIMESTAMP: {
+ return txSqlDateToSqlTimestamp((java.sql.Date) o);
+ }
+ case STRING: {
+ return txSqlDateToString((java.sql.Date) o);
+ }
+ case OBJECT: {
+ return o;
+ }
+ }
+ break;
+ }
+ case SQLTIME: {
+ switch (toId) {
+ case DATE: {
+ return o;
+ }
+ case UTCDATE: {
+ return txSqlTimeToUTCDate((java.sql.Time) o);
+ }
+ case CALENDAR: {
+ return txSqlTimeToCalendar((java.sql.Time) o);
+ }
+ case SQLDATE: {
+ return txSqlTimeToSqlDate((java.sql.Time) o);
+ }
+ case SQLTIME: {
+ return o;
+ }
+ case SQLTIMESTAMP: {
+ return txSqlTimeToSqlTimestamp((java.sql.Time) o);
+ }
+ case STRING: {
+ return txSqlTimeToString((java.sql.Time) o);
+ }
+ case OBJECT: {
+ return o;
+ }
+ }
+ break;
+ }
+ case SQLTIMESTAMP: {
+ switch (toId) {
+ case DATE: {
+ return o;
+ }
+ case UTCDATE: {
+ return txSqlTimestampToUTCDate((java.sql.Timestamp) o);
+ }
+ case CALENDAR: {
+ return txSqlTimestampToCalendar((java.sql.Timestamp) o);
+ }
+ case SQLDATE: {
+ return txSqlTimestampToSqlDate((java.sql.Timestamp) o);
+ }
+ case SQLTIME: {
+ return txSqlTimestampToSqlTime((java.sql.Timestamp) o);
+ }
+ case SQLTIMESTAMP: {
+ return o;
+ }
+ case STRING: {
+ return txSqlTimestampToString((java.sql.Timestamp) o);
+ }
+ case OBJECT: {
+ return o;
+ }
+ }
+ break;
+ }
+ }
+ throw createException(o, fromType, toType, 4, "not implementated");
+ }
+
+ /**
+ * Base Transformations
+ */
+
+ private byte txBooleanToByte(boolean o) {
+ return (byte) (o ? 1 : 0);
+ }
+
+ private char txBooleanToChar(boolean o) {
+ return (o ? 'X' : ' ');
+ }
+
+ private double txBooleanToDouble(boolean o) {
+ return (o ? 1 : 0);
+ }
+
+ private float txBooleanToFloat(boolean o) {
+ return (o ? 1 : 0);
+ }
+
+ private int txBooleanToInt(boolean o) {
+ return (o ? 1 : 0);
+ }
+
+ private long txBooleanToLong(boolean o) {
+ return (o ? 1 : 0);
+ }
+
+ private short txBooleanToShort(boolean o) {
+ return (short) (o ? 1 : 0);
+ }
+
+ private String txBooleanToString(boolean o) {
+ return String.valueOf(o);
+ }
+
+ private boolean txByteToBoolean(byte o) {
+ return (o == 1);
+ }
+
+ private char txByteToChar(byte o) {
+ return (char) (o);
+ }
+
+ private double txByteToDouble(byte o) {
+ return (o);
+ }
+
+ private float txByteToFloat(byte o) {
+ return (o);
+ }
+
+ private int txByteToInt(byte o) {
+ return (o);
+ }
+
+ private long txByteToLong(byte o) {
+ return (o);
+ }
+
+ private short txByteToShort(byte o) {
+ return (o);
+ }
+
+ private String txByteToString(byte o) {
+ return String.valueOf((char) o);
+ }
+
+ private boolean txCharToBoolean(char o) {
+ return (o == 'X' || o == 'x' || o == '1');
+ }
+
+ private byte txCharToByte(char o) {
+ return (byte) (o);
+ }
+
+ private double txCharToDouble(char o) {
+ return Double.parseDouble(String.valueOf(o));
+ }
+
+ private float txCharToFloat(char o) {
+ return Float.parseFloat(String.valueOf(o));
+ }
+
+ private int txCharToInt(char o) {
+ return Integer.parseInt(String.valueOf(o));
+ }
+
+ private long txCharToLong(char o) {
+ return Long.parseLong(String.valueOf(o));
+ }
+
+ private short txCharToShort(char o) {
+ return Short.parseShort(String.valueOf(o));
+ }
+
+ private String txCharToString(char o) {
+ return String.valueOf(o);
+ }
+
+ private boolean txDoubleToBoolean(double o) {
+ return (o == 1.0);
+ }
+
+ private byte txDoubleToByte(double o) {
+ return (byte) (o);
+ }
+
+ private char txDoubleToChar(double o) {
+ return (char) (o);
+ }
+
+ private float txDoubleToFloat(double o) {
+ return Float.parseFloat(String.valueOf(o));
+ }
+
+ private int txDoubleToInt(double o) {
+ return (int) (o);
+ }
+
+ private long txDoubleToLong(double o) {
+ return (long) (o);
+ }
+
+ private short txDoubleToShort(double o) {
+ return (short) (o);
+ }
+
+ private String txDoubleToString(double o) {
+ return String.valueOf(o);
+ }
+
+ private boolean txFloatToBoolean(float o) {
+ return (o == 1f);
+ }
+
+ private byte txFloatToByte(float o) {
+ return (byte) (o);
+ }
+
+ private char txFloatToChar(float o) {
+ return (char) (o);
+ }
+
+ private double txFloatToDouble(float o) {
+ return Double.parseDouble(String.valueOf(o));
+ }
+
+ private int txFloatToInt(float o) {
+ return (int) (o);
+ }
+
+ private long txFloatToLong(float o) {
+ return (long) (o);
+ }
+
+ private short txFloatToShort(float o) {
+ return (short) (o);
+ }
+
+ private String txFloatToString(float o) {
+ return String.valueOf(o);
+ }
+
+ private boolean txIntToBoolean(int o) {
+ return (o == 1);
+ }
+
+ private byte txIntToByte(int o) {
+ return (byte) (o);
+ }
+
+ private char txIntToChar(int o) {
+ return (char) (o);
+ }
+
+ private double txIntToDouble(int o) {
+ return (o);
+ }
+
+ private float txIntToFloat(int o) {
+ return (o);
+ }
+
+ private long txIntToLong(int o) {
+ return (o);
+ }
+
+ private short txIntToShort(int o) {
+ return (short) (o);
+ }
+
+ private String txIntToString(int o) {
+ return String.valueOf(o);
+ }
+
+ private boolean txLongToBoolean(long o) {
+ return (o == 1L);
+ }
+
+ private byte txLongToByte(long o) {
+ return (byte) (o);
+ }
+
+ private char txLongToChar(long o) {
+ return (char) (o);
+ }
+
+ private double txLongToDouble(long o) {
+ return (o);
+ }
+
+ private float txLongToFloat(long o) {
+ return (o);
+ }
+
+ private int txLongToInt(long o) {
+ return (int) (o);
+ }
+
+ private short txLongToShort(long o) {
+ return (short) (o);
+ }
+
+ private String txLongToString(long o) {
+ return String.valueOf(o);
+ }
+
+ private String txObjectToString(Object o) {
+ return o.toString();
+ }
+
+ private boolean txShortToBoolean(short o) {
+ return (o == 1);
+ }
+
+ private byte txShortToByte(short o) {
+ return (byte) (o);
+ }
+
+ private char txShortToChar(short o) {
+ return (char) (o);
+ }
+
+ private double txShortToDouble(short o) {
+ return (o);
+ }
+
+ private float txShortToFloat(short o) {
+ return (o);
+ }
+
+ private int txShortToInt(short o) {
+ return (o);
+ }
+
+ private long txShortToLong(short o) {
+ return (o);
+ }
+
+ private String txShortToString(short o) {
+ return String.valueOf(o);
+ }
+
+ private boolean txStringToBoolean(String o) {
+ o = o.toLowerCase();
+ if (o.equals("true")) {
+ return true;
+ }
+ if (o.equals("1")) {
+ return true;
+ }
+ if (o.equals("yes")) {
+ return true;
+ }
+ if (o.equals("x")) {
+ return true;
+ }
+ if (o.equals("on")) {
+ return true;
+ }
+ return false;
+ }
+
+ private byte txStringToByte(String o) {
+ try {
+ return Byte.parseByte(o);
+ }
+ catch (NumberFormatException nfe1) {
+ return (byte) Float.parseFloat(o);
+ }
+ }
+
+ private char txStringToChar(String o) {
+ return o.charAt(0);
+ }
+
+ private double txStringToDouble(String o) {
+ return Double.parseDouble(o);
+ }
+
+ private float txStringToFloat(String o) {
+ return Float.parseFloat(o);
+ }
+
+ private int txStringToInt(String o) {
+ try {
+ return Integer.parseInt(o);
+ }
+ catch (NumberFormatException nfe1) {
+ return (int) Float.parseFloat(o);
+ }
+ }
+
+ private long txStringToLong(String o) {
+ try {
+ return Long.parseLong(o);
+ }
+ catch (NumberFormatException nfe1) {
+ return (long) Double.parseDouble(o);
+ }
+ }
+
+ private short txStringToShort(String o) {
+ try {
+ return Short.parseShort(o);
+ }
+ catch (NumberFormatException nfe1) {
+ return (short) Float.parseFloat(o);
+ }
+ }
+
+ // Phase 2
+
+ private BigDecimal txBigIntegerToBigDecimal(BigInteger o) {
+ return new BigDecimal(o);
+ }
+
+ private boolean txBigIntegerToBoolean(BigInteger o) {
+ return o.equals(BigInteger.ONE);
+ }
+
+ private byte txBigIntegerToByte(BigInteger o) {
+ return o.byteValue();
+ }
+
+ private char txBigIntegerToChar(BigInteger o) {
+ return (char) o.intValue();
+ }
+
+ private double txBigIntegerToDouble(BigInteger o) {
+ return o.doubleValue();
+ }
+
+ private float txBigIntegerToFloat(BigInteger o) {
+ return o.floatValue();
+ }
+
+ private int txBigIntegerToInt(BigInteger o) {
+ return o.intValue();
+ }
+
+ private long txBigIntegerToLong(BigInteger o) {
+ return o.longValue();
+ }
+
+ private short txBigIntegerToShort(BigInteger o) {
+ return o.shortValue();
+ }
+
+ private String txBigIntegerToString(BigInteger o) {
+ return o.toString();
+ }
+
+ private BigInteger txBigDecimalToBigInteger(BigDecimal o) {
+ return o.toBigInteger();
+ }
+
+ private boolean txBigDecimalToBoolean(BigDecimal o) {
+ return o.equals(new BigDecimal(BigInteger.ONE));
+ }
+
+ private byte txBigDecimalToByte(BigDecimal o) {
+ return o.byteValue();
+ }
+
+ private char txBigDecimalToChar(BigDecimal o) {
+ return (char) o.intValue();
+ }
+
+ private double txBigDecimalToDouble(BigDecimal o) {
+ return o.doubleValue();
+ }
+
+ private float txBigDecimalToFloat(BigDecimal o) {
+ return o.floatValue();
+ }
+
+ private int txBigDecimalToInt(BigDecimal o) {
+ return o.intValue();
+ }
+
+ private long txBigDecimalToLong(BigDecimal o) {
+ return o.longValue();
+ }
+
+ private short txBigDecimalToShort(BigDecimal o) {
+ return o.shortValue();
+ }
+
+ private String txBigDecimalToString(BigDecimal o) {
+ return o.toString();
+ }
+
+ private BigDecimal txBooleanToBigDecimal(boolean o) {
+ return new BigDecimal((o ? BigInteger.ONE : BigInteger.ZERO));
+ }
+
+ private BigInteger txBooleanToBigInteger(boolean o) {
+ return (o ? BigInteger.ONE : BigInteger.ZERO);
+ }
+
+ private BigDecimal txByteToBigDecimal(byte o) {
+ return BigDecimal.valueOf(o);
+ }
+
+ private BigInteger txByteToBigInteger(byte o) {
+ return BigInteger.valueOf(o);
+ }
+
+ private Date txCalendarToDate(Calendar o) {
+ return o.getTime();
+ }
+
+ private UTCDate txCalendarToUTCDate(Calendar o) {
+ return new UTCDate(o.getTime().getTime());
+ }
+
+ private java.sql.Date txCalendarToSqlDate(Calendar o) {
+ return new java.sql.Date(o.getTimeInMillis());
+ }
+
+ private java.sql.Time txCalendarToSqlTime(Calendar o) {
+ return new java.sql.Time(o.getTimeInMillis());
+ }
+
+ private java.sql.Timestamp txCalendarToSqlTimestamp(Calendar o) {
+ return new Timestamp(o.getTimeInMillis());
+ }
+
+ private String txCalendarToString(Calendar o) {
+ return new SimpleDateFormat("dd.MM.yyyy'T'HH:mm:ss.sss'Z'").format(o.getTime());
+ }
+
+ private BigDecimal txCharToBigDecimal(char o) {
+ return BigDecimal.valueOf(o);
+ }
+
+ private BigInteger txCharToBigInteger(char o) {
+ return BigInteger.valueOf(o);
+ }
+
+ private Calendar txDateToCalendar(Date o) {
+ GregorianCalendar cal = new GregorianCalendar();
+ cal.setTime(o);
+ return cal;
+ }
+
+ private UTCDate txDateToUTCDate(Date o) {
+ return new UTCDate(o.getTime());
+ }
+
+ private java.sql.Date txDateToSqlDate(Date o) {
+ return new java.sql.Date(o.getTime());
+ }
+
+ private java.sql.Time txDateToSqlTime(Date o) {
+ return new java.sql.Time(o.getTime());
+ }
+
+ private java.sql.Timestamp txDateToSqlTimestamp(Date o) {
+ return new Timestamp(o.getTime());
+ }
+
+ private String txDateToString(Date o) {
+ return new SimpleDateFormat("dd.MM.yyyy'T'HH:mm:ss.sss'Z'").format(o);
+ }
+
+ private Date txUTCDateToDate(UTCDate o) {
+ return o;
+ }
+
+ private Calendar txUTCDateToCalendar(UTCDate o) {
+ GregorianCalendar cal = new GregorianCalendar();
+ cal.setTime(o);
+ return cal;
+ }
+
+ private java.sql.Date txUTCDateToSqlDate(UTCDate o) {
+ return new java.sql.Date(o.getTime());
+ }
+
+ private java.sql.Time txUTCDateToSqlTime(UTCDate o) {
+ return new java.sql.Time(o.getTime());
+ }
+
+ private java.sql.Timestamp txUTCDateToSqlTimestamp(UTCDate o) {
+ return new java.sql.Timestamp(o.getTime());
+ }
+
+ private String txUTCDateToString(UTCDate o) {
+ return new SimpleDateFormat("dd.MM.yyyy'T'HH:mm:ss.sss'Z'").format(o);
+ }
+
+ private BigDecimal txDoubleToBigDecimal(double o) {
+ return new BigDecimal(Double.toString(o));
+ }
+
+ private BigInteger txDoubleToBigInteger(double o) {
+ return BigInteger.valueOf((long) o);
+ }
+
+ private BigDecimal txFloatToBigDecimal(float o) {
+ return new BigDecimal(String.valueOf(o));
+ }
+
+ private BigInteger txFloatToBigInteger(float o) {
+ return BigInteger.valueOf((long) o);
+ }
+
+ private BigDecimal txIntToBigDecimal(int o) {
+ return BigDecimal.valueOf(o);
+ }
+
+ private BigInteger txIntToBigInteger(int o) {
+ return BigInteger.valueOf(o);
+ }
+
+ private BigDecimal txLongToBigDecimal(long o) {
+ return BigDecimal.valueOf(o);
+ }
+
+ private BigInteger txLongToBigInteger(long o) {
+ return BigInteger.valueOf(o);
+ }
+
+ private BigDecimal txShortToBigDecimal(short o) {
+ return BigDecimal.valueOf(o);
+ }
+
+ private BigInteger txShortToBigInteger(short o) {
+ return BigInteger.valueOf(o);
+ }
+
+ private Calendar txSqlDateToCalendar(java.sql.Date o) {
+ GregorianCalendar cal = new GregorianCalendar();
+ cal.setTime(o);
+ return cal;
+ }
+
+ private java.sql.Time txSqlDateToSqlTime(java.sql.Date o) {
+ return new Time(o.getTime());
+ }
+
+ private java.sql.Timestamp txSqlDateToSqlTimestamp(java.sql.Date o) {
+ return new Timestamp(o.getTime());
+ }
+
+ private UTCDate txSqlDateToUTCDate(java.sql.Date o) {
+ return new UTCDate(o.getTime());
+ }
+
+ private String txSqlDateToString(java.sql.Date o) {
+ return new SimpleDateFormat("dd.MM.yyyy'T'HH:mm:ss.sss'Z'").format(o);
+ }
+
+ private Calendar txSqlTimestampToCalendar(java.sql.Timestamp o) {
+ GregorianCalendar cal = new GregorianCalendar();
+ cal.setTime(o);
+ return cal;
+ }
+
+ private java.sql.Date txSqlTimestampToSqlDate(java.sql.Timestamp o) {
+ return new java.sql.Date(o.getTime());
+ }
+
+ private java.sql.Time txSqlTimestampToSqlTime(java.sql.Timestamp o) {
+ return new java.sql.Time(o.getTime());
+ }
+
+ private UTCDate txSqlTimestampToUTCDate(java.sql.Timestamp o) {
+ return new UTCDate(o.getTime());
+ }
+
+ private String txSqlTimestampToString(java.sql.Timestamp o) {
+ return new SimpleDateFormat("dd.MM.yyyy'T'HH:mm:ss.sss'Z'").format(o);
+ }
+
+ private Calendar txSqlTimeToCalendar(java.sql.Time o) {
+ GregorianCalendar cal = new GregorianCalendar();
+ cal.setTime(o);
+ return cal;
+ }
+
+ private java.sql.Date txSqlTimeToSqlDate(java.sql.Time o) {
+ return new java.sql.Date(o.getTime());
+ }
+
+ private java.sql.Timestamp txSqlTimeToSqlTimestamp(java.sql.Time o) {
+ return new java.sql.Timestamp(o.getTime());
+ }
+
+ private UTCDate txSqlTimeToUTCDate(java.sql.Time o) {
+ return new UTCDate(o.getTime());
+ }
+
+ private String txSqlTimeToString(java.sql.Time o) {
+ return new SimpleDateFormat("dd.MM.yyyy'T'HH:mm:ss.sss'Z'").format(o);
+ }
+
+ private Date txStringToDate(String o) {
+ try {
+ return new SimpleDateFormat("dd.MM.yyyy'T'HH:mm:ss.sss'Z'").parse(o);
+ }
+ catch (ParseException pe) {
+ throw createException(o, String.class, Date.class, 5, pe.getMessage());
+ }
+ }
+
+ private UTCDate txStringToUTCDate(String o) {
+ try {
+ Date d = new SimpleDateFormat("dd.MM.yyyy'T'HH:mm:ss.sss'Z'").parse(o);
+ return new UTCDate(d.getTime());
+ }
+ catch (ParseException pe) {
+ throw createException(o, String.class, UTCDate.class, 5, pe.getMessage());
+ }
+ }
+
+ private Calendar txStringToCalendar(String o) {
+ try {
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(new SimpleDateFormat("dd.MM.yyyy'T'HH:mm:ss.sss'Z'").parse(o));
+ return cal;
+ }
+ catch (ParseException pe) {
+ throw createException(o, String.class, Calendar.class, 6, pe.getMessage());
+ }
+ }
+
+ private java.sql.Date txStringToSqlDate(String o) {
+ try {
+ return new java.sql.Date(new SimpleDateFormat("dd.MM.yyyy").parse(o).getTime());
+ }
+ catch (ParseException pe) {
+ throw createException(o, String.class, java.sql.Date.class, 7, pe.getMessage());
+ }
+ }
+
+ private java.sql.Time txStringToSqlTime(String o) {
+ try {
+ return new java.sql.Time(new SimpleDateFormat("HH:mm:ss.sss").parse(o).getTime());
+ }
+ catch (ParseException pe) {
+ throw createException(o, String.class, java.sql.Time.class, 8, pe.getMessage());
+ }
+ }
+
+ private java.sql.Timestamp txStringToSqlTimestamp(String o) {
+ try {
+ return new java.sql.Timestamp(new SimpleDateFormat("dd.MM.yyyy'T'HH:mm:ss.sss'Z'").parse(o).getTime());
+ }
+ catch (ParseException pe) {
+ throw createException(o, String.class, java.sql.Timestamp.class, 8, pe.getMessage());
+ }
+ }
+
+ private BigDecimal txStringToBigDecimal(String o) {
+ return new BigDecimal(o);
+ }
+
+ private BigInteger txStringToBigInteger(String o) {
+ return new BigDecimal(o).toBigInteger();
+ }
+
+ private byte txTriStateToByte(TriState o) {
+ return o.isUndefined() ? -1 : o.getIntegerValue().byteValue();
+ }
+
+ private char txTriStateToChar(TriState o) {
+ return o.isUndefined() ? '?' : o.getBooleanValue() ? 'X' : ' ';
+ }
+
+ private double txTriStateToDouble(TriState o) {
+ return o.isUndefined() ? -1 : o.getIntegerValue().doubleValue();
+ }
+
+ private float txTriStateToFloat(TriState o) {
+ return o.isUndefined() ? -1 : o.getIntegerValue().floatValue();
+ }
+
+ private int txTriStateToInt(TriState o) {
+ return o.isUndefined() ? -1 : o.getIntegerValue().intValue();
+ }
+
+ private long txTriStateToLong(TriState o) {
+ return o.isUndefined() ? -1 : o.getIntegerValue().longValue();
+ }
+
+ private short txTriStateToShort(TriState o) {
+ return o.isUndefined() ? -1 : o.getIntegerValue().shortValue();
+ }
+
+ private String txTriStateToString(TriState o) {
+ return o.toString();
+ }
+
+ private TriState txByteToTriState(byte o) {
+ return TriState.parseTriState(o);
+ }
+
+ private TriState txCharToTriState(char o) {
+ return TriState.parseTriState(o);
+ }
+
+ private TriState txDoubleToTriState(double o) {
+ return TriState.parseTriState(o);
+ }
+
+ private TriState txFloatToTriState(float o) {
+ return TriState.parseTriState(o);
+ }
+
+ private TriState txIntToTriState(int o) {
+ return TriState.parseTriState(o);
+ }
+
+ private TriState txLongToTriState(long o) {
+ return TriState.parseTriState(o);
+ }
+
+ private TriState txShortToTriState(short o) {
+ return TriState.parseTriState(o);
+ }
+
+ private TriState txStringToTriState(String o) {
+ return TriState.parseTriState(o);
+ }
+
+ private TriState txBigIntegerToTriState(BigInteger o) {
+ return TriState.parseTriState(o);
+ }
+
+ private TriState txBigDecimalToTriState(BigDecimal o) {
+ return TriState.parseTriState(o);
+ }
+
+ private BigDecimal txTriStateToBigDecimal(TriState o) {
+ if (o.isUndefined()) {
+ return null;
+ }
+ else if (o.getBooleanValue()) {
+ return BigDecimal.ONE;
+ }
+ else {
+ return BigDecimal.ZERO;
+ }
+ }
+
+ private BigInteger txTriStateToBigInteger(TriState o) {
+ if (o.isUndefined()) {
+ return null;
+ }
+ else if (o.getBooleanValue()) {
+ return BigInteger.ONE;
+ }
+ else {
+ return BigInteger.ZERO;
+ }
+ }
+
+ private TriState txBooleanToTriState(boolean o) {
+ return TriState.parseTriState(o);
+ }
+
+ private boolean txTriStateToBoolean(TriState o) {
+ return o.isUndefined() ? false : o.getBooleanValue().booleanValue();
+ }
+
+ private static class TypeDesc {
+ int parameterizedTypeIndex;
+ TypeVariable<?> typeVariable;
+ Class resolvedClazz;
+ int arrayDim;
+ }
+
+ /**
+ * key for GenericsParameterClass with weak references so to allow for class unloading
+ */
+ private static class GPCKey {
+ private final Class<?> m_queryClass;
+ private final Class<?> m_genericsOwnerClass;
+ private final int m_genericsParameterIndex;
+
+ public GPCKey(Class queryClass, Class genericsOwnerClass, int genericsParameterIndex) {
+ m_queryClass = queryClass;
+ m_genericsOwnerClass = genericsOwnerClass;
+ m_genericsParameterIndex = genericsParameterIndex;
+ }
+
+ @Override
+ public int hashCode() {
+ return (m_queryClass != null ? m_queryClass.hashCode() : 0) ^ (m_genericsOwnerClass != null ? m_genericsOwnerClass.hashCode() : 0) ^ m_genericsParameterIndex;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (!(obj instanceof GPCKey)) {
+ return false;
+ }
+ GPCKey o = (GPCKey) obj;
+ return (this.m_queryClass == o.m_queryClass) && (this.m_genericsOwnerClass == o.m_genericsOwnerClass) && (this.m_genericsParameterIndex == o.m_genericsParameterIndex);
+ }
+ }
+
+ /**
+ * {@link TypeCastUtility#getGenericsParameterClass(Class, Class, int)}
+ */
+ public static Class getGenericsParameterClass(Class queryClass, Class genericsOwnerClass) {
+ return instance.getGenericsParameterClassImpl(queryClass, genericsOwnerClass, 0);
+ }
+
+ /**
+ * @return the actual (declared) type of the generics parameter with index genericsParameterIndex on
+ * genericsOwnerClass.
+ * <p>
+ * The generics parameter is defined on the genericsOwnerClass
+ * <p>
+ * The actual type must be declared on the queryClass
+ * <p>
+ * Example: queryType=LongArrayHolder, genericsOwnerClass=IHolder.class, genericsParameterIndex=0 since
+ * IHolder has only one, returns Long[].class
+ */
+ public static Class getGenericsParameterClass(Class queryClass, Class genericsOwnerClass, int genericsParameterIndex) {
+ return instance.getGenericsParameterClassImpl(queryClass, genericsOwnerClass, genericsParameterIndex);
+ }
+
+ private synchronized Class getGenericsParameterClassImpl(Class queryClass, Class genericsOwnerClass, int genericsParameterIndex) {
+ GPCKey key = new GPCKey(queryClass, genericsOwnerClass, genericsParameterIndex);
+ Class result = m_genericsParameterClassCache.get(key);
+ if (result != null) {
+ return result;
+ }
+ //
+ m_debugEnabled = LOG.isDebugEnabled();
+ if (m_debugEnabled) {
+ LOG.debug("queryClass=" + queryClass + ", genericsOwnerClass=" + genericsOwnerClass + ", genericsParameterIndex=" + genericsParameterIndex);
+ }
+ TypeDesc desc = new TypeDesc();
+ HashSet<Type> loopDetector = new HashSet<Type>();
+ visitGenericsHierarchy(queryClass, genericsOwnerClass, genericsParameterIndex, desc, loopDetector);
+ if (desc.resolvedClazz == null) {
+ String s = (desc.typeVariable != null ? desc.typeVariable.getName() : "null");
+ for (int i = 0; i < desc.arrayDim; i++) {
+ s += "[]";
+ }
+ throw new IllegalArgumentException("cannot resolve " + s + " to a 'Class' type on " + queryClass);
+ }
+ if (desc.arrayDim > 0) {
+ result = Array.newInstance(desc.resolvedClazz, new int[desc.arrayDim]).getClass();
+ }
+ else {
+ result = desc.resolvedClazz;
+ }
+ m_genericsParameterClassCache.put(key, result);
+ return result;
+ }
+
+ private boolean/* foundStopType */visitGenericsHierarchy(Type type, Class<?> stopType, int stopTypeGenericsParameterIndex, TypeDesc desc, HashSet<Type> loopDetector) {
+ if (loopDetector.contains(type)) {
+ return false;
+ }
+ if (type instanceof Class) {
+ Class c = (Class) type;
+ if (c == stopType) {
+ //stop class, set generics index
+ desc.parameterizedTypeIndex = stopTypeGenericsParameterIndex;
+ if (m_debugEnabled) {
+ LOG.debug("foundStopClass " + c + ", using generics index " + desc.parameterizedTypeIndex);
+ }
+ return true;
+ }
+ boolean foundStopClass = false;
+ if (!foundStopClass) {
+ if (!c.isInterface()) {
+ Type a = c.getGenericSuperclass();
+ if (a != null) {
+ try {
+ loopDetector.add(type);
+ foundStopClass = visitGenericsHierarchy(a, stopType, stopTypeGenericsParameterIndex, desc, loopDetector);
+ }
+ finally {
+ loopDetector.remove(type);
+ }
+ }
+ }
+ }
+ if (!foundStopClass) {
+ Type[] a = c.getGenericInterfaces();
+ if (a.length > 0) {
+ for (int i = 0; i < a.length && !foundStopClass; i++) {
+ try {
+ loopDetector.add(type);
+ foundStopClass = visitGenericsHierarchy(a[i], stopType, stopTypeGenericsParameterIndex, desc, loopDetector);
+ }
+ finally {
+ loopDetector.remove(type);
+ }
+ }
+ }
+ }
+ if (foundStopClass) {
+ if (m_debugEnabled) {
+ LOG.debug("visit " + VerboseUtility.dumpGenerics(c));
+ }
+ if (desc.resolvedClazz == null) {
+ //find the index of the typeParameter
+ desc.parameterizedTypeIndex = 0;
+ TypeVariable<?>[] vars = c.getTypeParameters();
+ for (int i = 0; i < vars.length; i++) {
+ if (vars[i] == desc.typeVariable) {
+ if (m_debugEnabled) {
+ LOG.debug(desc.typeVariable + " has index " + i);
+ }
+ desc.parameterizedTypeIndex = i;
+ break;
+ }
+ }
+ }
+ return true;
+ }
+ return false;
+ }
+ //
+ if (type instanceof ParameterizedType) {
+ ParameterizedType pt = (ParameterizedType) type;
+ Type rawType = pt.getRawType();
+ try {
+ loopDetector.add(pt);
+ boolean b = visitGenericsHierarchy(rawType, stopType, stopTypeGenericsParameterIndex, desc, loopDetector);
+ if (!b) {
+ return false;
+ }
+ }
+ finally {
+ loopDetector.remove(pt);
+ }
+ //found path to stopClass
+ if (m_debugEnabled) {
+ LOG.debug("visit " + VerboseUtility.dumpGenerics(pt));
+ }
+ if (desc.resolvedClazz == null) {
+ //find next type variable
+ Type actualArg = pt.getActualTypeArguments()[desc.parameterizedTypeIndex];
+ if (m_debugEnabled) {
+ LOG.debug("index " + desc.parameterizedTypeIndex + " matches to " + actualArg);
+ }
+ while (actualArg instanceof GenericArrayType) {
+ //it is something like <T[]>
+ actualArg = ((GenericArrayType) actualArg).getGenericComponentType();
+ desc.arrayDim++;
+ }
+ if (actualArg instanceof ParameterizedType) {
+ //it is something like <Map<String,String>>
+ actualArg = ((ParameterizedType) actualArg).getRawType();
+ }
+ if (actualArg instanceof Class) {
+ desc.resolvedClazz = (Class) actualArg;
+ }
+ else if (actualArg instanceof TypeVariable) {
+ desc.typeVariable = (TypeVariable) actualArg;
+ }
+ else {
+ if (m_debugEnabled) {
+ LOG.debug("failed with " + actualArg);
+ }
+ throw new IllegalArgumentException("expected ParameterizedType with actual argument of type Class or TypeVariable when encountered " + VerboseUtility.dumpGenerics(type));
+ }
+ }
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/UTCDate.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/UTCDate.java
index 195549334d..a5fb35743f 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/UTCDate.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/UTCDate.java
@@ -1,29 +1,29 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import java.util.Date;
-
-/**
- * UTC date marker subclass as an exception to StaticDate conversion in {@link ServiceTunnelInputStream} and
- * {@link ServiceTunnelOutputStream}.
- */
-public class UTCDate extends Date {
- private static final long serialVersionUID = 1L;
-
- public UTCDate() {
- super();
- }
-
- public UTCDate(long utcTime) {
- super(utcTime);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import java.util.Date;
+
+/**
+ * UTC date marker subclass as an exception to StaticDate conversion in {@link ServiceTunnelInputStream} and
+ * {@link ServiceTunnelOutputStream}.
+ */
+public class UTCDate extends Date {
+ private static final long serialVersionUID = 1L;
+
+ public UTCDate() {
+ super();
+ }
+
+ public UTCDate(long utcTime) {
+ super(utcTime);
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/UriBuilder.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/UriBuilder.java
index 142781cd45..85849f7adb 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/UriBuilder.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/UriBuilder.java
@@ -1,201 +1,201 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.net.URLEncoder;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-
-/**
- * Builder for {@link URI} and {@link URL} instances.
- *
- * @since 3.8.1
- */
-public class UriBuilder {
-
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(UriBuilder.class);
-
- private final Map<String, String> m_parameters = new HashMap<String, String>();
- private String m_scheme;
- private String m_host;
- private int m_port = -1;
- private String m_path;
- private String m_fragment;
-
- public UriBuilder() {
- }
-
- public UriBuilder(String uri) throws ProcessingException {
- this(uri, null);
- }
-
- public UriBuilder(String uri, String encoding) throws ProcessingException {
- this(UriUtility.toUri(uri), encoding);
- }
-
- public UriBuilder(URL url) throws ProcessingException {
- this(UriUtility.urlToUri(url), null);
- }
-
- public UriBuilder(URI uri) throws ProcessingException {
- this(uri, null);
- }
-
- public UriBuilder(URL url, String encoding) throws ProcessingException {
- this(UriUtility.urlToUri(url), encoding);
- }
-
- public UriBuilder(URI uri, String encoding) throws ProcessingException {
- if (uri == null) {
- return;
- }
- m_scheme = uri.getScheme();
- m_host = uri.getHost();
- m_port = uri.getPort();
- m_path = uri.getPath();
- m_fragment = uri.getFragment();
- Map<String, String> params = UriUtility.getQueryParameters(uri, encoding);
- m_parameters.putAll(params);
- }
-
- public UriBuilder scheme(String scheme) {
- m_scheme = scheme;
- return this;
- }
-
- public UriBuilder host(String host) {
- m_host = host;
- return this;
- }
-
- /**
- * Sets the remote host's port. Values lower than 1 are resetting a possibly set explicit port.
- *
- * @param port
- * @return
- */
- public UriBuilder port(int port) {
- if (port < 1) {
- m_port = -1;
- }
- else {
- m_port = port;
- }
- return this;
- }
-
- public UriBuilder path(String path) {
- m_path = path;
- return this;
- }
-
- public UriBuilder addPath(String path) {
- if (StringUtility.hasText(path)) {
- m_path = StringUtility.join("/", m_path, path);
- }
- return this;
- }
-
- public UriBuilder fragment(String fragment) {
- m_fragment = fragment;
- return this;
- }
-
- public UriBuilder parameter(String name, String value) {
- if (!StringUtility.hasText(name)) {
- return this;
- }
- if (value == null) {
- m_parameters.remove(name);
- }
- else {
- m_parameters.put(name, value);
- }
- return this;
- }
-
- public URL createURL() throws ProcessingException {
- return createURL(null);
- }
-
- public URI createURI() throws ProcessingException {
- return createURI(null);
- }
-
- public URL createURL(String encoding) throws ProcessingException {
- return UriUtility.uriToUrl(createURI(encoding));
- }
-
- public URI createURI(String encoding) throws ProcessingException {
- try {
- if (m_parameters == null || m_parameters.isEmpty()) {
- return new URI(m_scheme, null, m_host, m_port, m_path, null, m_fragment);
- }
- if (encoding == null) {
- encoding = UriUtility.ISO_8859_1;
- }
- StringBuilder query = new StringBuilder();
- for (Map.Entry<String, String> param : m_parameters.entrySet()) {
- if (!StringUtility.hasText(param.getKey())) {
- LOG.warn("ignoring parameter with empty key");
- continue;
- }
- if (query.length() > 0) {
- query.append("&");
- }
- try {
- query.append(URLEncoder.encode(param.getKey(), encoding));
- query.append("=");
- query.append(URLEncoder.encode(param.getValue(), encoding));
- }
- catch (UnsupportedEncodingException e) {
- throw new ProcessingException("Unsupported encoding '" + encoding + "'", e);
- }
- }
- return new URI(m_scheme, null, m_host, m_port, m_path, query.toString(), m_fragment);
- }
- catch (URISyntaxException e) {
- throw new ProcessingException("error creating URI", e);
- }
- }
-
- public String getScheme() {
- return m_scheme;
- }
-
- public String getHost() {
- return m_host;
- }
-
- public int getPort() {
- return m_port;
- }
-
- public String getPath() {
- return m_path;
- }
-
- public String getFragment() {
- return m_fragment;
- }
-
- public Map<String, String> getParameters() {
- return new HashMap<String, String>(m_parameters);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.net.URLEncoder;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+
+/**
+ * Builder for {@link URI} and {@link URL} instances.
+ *
+ * @since 3.8.1
+ */
+public class UriBuilder {
+
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(UriBuilder.class);
+
+ private final Map<String, String> m_parameters = new HashMap<String, String>();
+ private String m_scheme;
+ private String m_host;
+ private int m_port = -1;
+ private String m_path;
+ private String m_fragment;
+
+ public UriBuilder() {
+ }
+
+ public UriBuilder(String uri) throws ProcessingException {
+ this(uri, null);
+ }
+
+ public UriBuilder(String uri, String encoding) throws ProcessingException {
+ this(UriUtility.toUri(uri), encoding);
+ }
+
+ public UriBuilder(URL url) throws ProcessingException {
+ this(UriUtility.urlToUri(url), null);
+ }
+
+ public UriBuilder(URI uri) throws ProcessingException {
+ this(uri, null);
+ }
+
+ public UriBuilder(URL url, String encoding) throws ProcessingException {
+ this(UriUtility.urlToUri(url), encoding);
+ }
+
+ public UriBuilder(URI uri, String encoding) throws ProcessingException {
+ if (uri == null) {
+ return;
+ }
+ m_scheme = uri.getScheme();
+ m_host = uri.getHost();
+ m_port = uri.getPort();
+ m_path = uri.getPath();
+ m_fragment = uri.getFragment();
+ Map<String, String> params = UriUtility.getQueryParameters(uri, encoding);
+ m_parameters.putAll(params);
+ }
+
+ public UriBuilder scheme(String scheme) {
+ m_scheme = scheme;
+ return this;
+ }
+
+ public UriBuilder host(String host) {
+ m_host = host;
+ return this;
+ }
+
+ /**
+ * Sets the remote host's port. Values lower than 1 are resetting a possibly set explicit port.
+ *
+ * @param port
+ * @return
+ */
+ public UriBuilder port(int port) {
+ if (port < 1) {
+ m_port = -1;
+ }
+ else {
+ m_port = port;
+ }
+ return this;
+ }
+
+ public UriBuilder path(String path) {
+ m_path = path;
+ return this;
+ }
+
+ public UriBuilder addPath(String path) {
+ if (StringUtility.hasText(path)) {
+ m_path = StringUtility.join("/", m_path, path);
+ }
+ return this;
+ }
+
+ public UriBuilder fragment(String fragment) {
+ m_fragment = fragment;
+ return this;
+ }
+
+ public UriBuilder parameter(String name, String value) {
+ if (!StringUtility.hasText(name)) {
+ return this;
+ }
+ if (value == null) {
+ m_parameters.remove(name);
+ }
+ else {
+ m_parameters.put(name, value);
+ }
+ return this;
+ }
+
+ public URL createURL() throws ProcessingException {
+ return createURL(null);
+ }
+
+ public URI createURI() throws ProcessingException {
+ return createURI(null);
+ }
+
+ public URL createURL(String encoding) throws ProcessingException {
+ return UriUtility.uriToUrl(createURI(encoding));
+ }
+
+ public URI createURI(String encoding) throws ProcessingException {
+ try {
+ if (m_parameters == null || m_parameters.isEmpty()) {
+ return new URI(m_scheme, null, m_host, m_port, m_path, null, m_fragment);
+ }
+ if (encoding == null) {
+ encoding = UriUtility.ISO_8859_1;
+ }
+ StringBuilder query = new StringBuilder();
+ for (Map.Entry<String, String> param : m_parameters.entrySet()) {
+ if (!StringUtility.hasText(param.getKey())) {
+ LOG.warn("ignoring parameter with empty key");
+ continue;
+ }
+ if (query.length() > 0) {
+ query.append("&");
+ }
+ try {
+ query.append(URLEncoder.encode(param.getKey(), encoding));
+ query.append("=");
+ query.append(URLEncoder.encode(param.getValue(), encoding));
+ }
+ catch (UnsupportedEncodingException e) {
+ throw new ProcessingException("Unsupported encoding '" + encoding + "'", e);
+ }
+ }
+ return new URI(m_scheme, null, m_host, m_port, m_path, query.toString(), m_fragment);
+ }
+ catch (URISyntaxException e) {
+ throw new ProcessingException("error creating URI", e);
+ }
+ }
+
+ public String getScheme() {
+ return m_scheme;
+ }
+
+ public String getHost() {
+ return m_host;
+ }
+
+ public int getPort() {
+ return m_port;
+ }
+
+ public String getPath() {
+ return m_path;
+ }
+
+ public String getFragment() {
+ return m_fragment;
+ }
+
+ public Map<String, String> getParameters() {
+ return new HashMap<String, String>(m_parameters);
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/UriUtility.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/UriUtility.java
index 732a7fb5e1..5a3fddc38a 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/UriUtility.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/UriUtility.java
@@ -1,207 +1,207 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import java.io.UnsupportedEncodingException;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.net.URLDecoder;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-
-/**
- * Utility class for creating, parsing and converting {@link URI}s and {@link URL}s.
- *
- * @since 3.8.1
- */
-public final class UriUtility {
-
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(UriUtility.class);
- public static final String ISO_8859_1 = "ISO-8859-1";
-
- private UriUtility() {
- }
-
- /**
- * Parses the given URL's query string using encoding ISO-8859-1 and extracts the query parameter.
- *
- * @param uri
- * @return map with parsed query parameters. Never <code>null</code>.
- * @throws ProcessingException
- */
- public static Map<String, String> getQueryParameters(URL url) throws ProcessingException {
- return getQueryParameters(url, null);
- }
-
- /**
- * Parses the given URL's query string using the given encoding and extracts the query parameter.
- *
- * @param uri
- * @param encoding
- * encoding of the query parameter. If <code>null</code> ISO-8859-1 is used.
- * @return map with parsed query parameters. Never <code>null</code>.
- * @throws ProcessingException
- */
- public static Map<String, String> getQueryParameters(URL url, String encoding) throws ProcessingException {
- if (url == null) {
- return Collections.emptyMap();
- }
- return getQueryParameters(urlToUri(url), encoding);
- }
-
- /**
- * Parses the given URI's query string using encoding ISO-8859-1 and extracts the query parameter.
- *
- * @param uri
- * @return map with parsed query parameters. Never <code>null</code>.
- * @throws ProcessingException
- */
- public static Map<String, String> getQueryParameters(URI uri) throws ProcessingException {
- return getQueryParameters(uri, null);
- }
-
- /**
- * Parses the given URI's query string using the given encoding and extracts the query parameter.
- *
- * @param uri
- * @param encoding
- * encoding of the query parameter. If <code>null</code> ISO-8859-1 is used.
- * @return map with parsed query parameters. Never <code>null</code>.
- * @throws ProcessingException
- */
- public static Map<String, String> getQueryParameters(URI uri, String encoding) throws ProcessingException {
- if (uri == null || uri.getQuery() == null) {
- return Collections.emptyMap();
- }
- Map<String, String> result = new HashMap<String, String>();
- for (String param : uri.getQuery().split("&")) {
- String[] parts = StringUtility.split(param, "=");
- if (parts.length != 2) {
- throw new ProcessingException("invalid query parameter: '" + param + "'");
- }
- try {
- if (encoding == null) {
- encoding = ISO_8859_1;
- }
- String key = URLDecoder.decode(parts[0], encoding);
- String value = URLDecoder.decode(parts[1], encoding);
- String existingMapping = result.put(key, value);
- if (existingMapping != null) {
- LOG.warn("parameter key is used multiple times [key='" + key + "', oldValue='" + existingMapping + "', newValue='" + value + "'");
- }
- }
- catch (UnsupportedEncodingException e) {
- throw new ProcessingException("unsupported encoding '" + encoding + "'", e);
- }
- }
- return result;
- }
-
- /**
- * Splits the path of the given {@link URI} in its elements.
- *
- * @param uri
- * @return the path elements or an empty string array if the uri or its path is <code>null</code>.
- */
- public static String[] getPath(URI uri) {
- if (uri == null || uri.getPath() == null) {
- return new String[0];
- }
- String path = uri.getPath();
- if (path.startsWith("/")) {
- path = path.substring(1);
- }
- return StringUtility.split(path, "/");
- }
-
- /**
- * Converts the given URL into an URI.
- *
- * @param url
- * @return <code>null</code> if the given url is <code>null</code>.
- * @throws ProcessingException
- */
- public static URI urlToUri(URL url) throws ProcessingException {
- if (url == null) {
- return null;
- }
- try {
- return url.toURI();
- }
- catch (URISyntaxException e) {
- throw new ProcessingException("Exception while converting URL to URI", e);
- }
- }
-
- /**
- * Converts the given URI into an URL.
- *
- * @param uri
- * @return <code>null</code> if the given uri is <code>null</code>.
- * @throws ProcessingException
- */
- public static URL uriToUrl(URI uri) throws ProcessingException {
- if (uri == null) {
- return null;
- }
- try {
- return uri.toURL();
- }
- catch (MalformedURLException e) {
- throw new ProcessingException("Exception while converting URI to URL", e);
- }
- }
-
- /**
- * Parses the given string into an {@link URI}.
- *
- * @param uri
- * @return <code>null</code> if the given string is null or has no text or a parsed {@link URI} instance.
- * @throws ProcessingException
- */
- public static URI toUri(String uri) throws ProcessingException {
- if (!StringUtility.hasText(uri)) {
- return null;
- }
- try {
- return new URI(uri);
- }
- catch (URISyntaxException e) {
- throw new ProcessingException("Exception while parsing URI", e);
- }
- }
-
- /**
- * Parses the given string into an {@link URL}.
- *
- * @param url
- * @return <code>null</code> if the given string is null or has no text or a parsed {@link URL} instance.
- * @throws ProcessingException
- */
- public static URL toUrl(String url) throws ProcessingException {
- if (!StringUtility.hasText(url)) {
- return null;
- }
- try {
- return new URL(url);
- }
- catch (MalformedURLException e) {
- throw new ProcessingException("Exception while parsing URL", e);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import java.io.UnsupportedEncodingException;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.net.URLDecoder;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+
+/**
+ * Utility class for creating, parsing and converting {@link URI}s and {@link URL}s.
+ *
+ * @since 3.8.1
+ */
+public final class UriUtility {
+
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(UriUtility.class);
+ public static final String ISO_8859_1 = "ISO-8859-1";
+
+ private UriUtility() {
+ }
+
+ /**
+ * Parses the given URL's query string using encoding ISO-8859-1 and extracts the query parameter.
+ *
+ * @param uri
+ * @return map with parsed query parameters. Never <code>null</code>.
+ * @throws ProcessingException
+ */
+ public static Map<String, String> getQueryParameters(URL url) throws ProcessingException {
+ return getQueryParameters(url, null);
+ }
+
+ /**
+ * Parses the given URL's query string using the given encoding and extracts the query parameter.
+ *
+ * @param uri
+ * @param encoding
+ * encoding of the query parameter. If <code>null</code> ISO-8859-1 is used.
+ * @return map with parsed query parameters. Never <code>null</code>.
+ * @throws ProcessingException
+ */
+ public static Map<String, String> getQueryParameters(URL url, String encoding) throws ProcessingException {
+ if (url == null) {
+ return Collections.emptyMap();
+ }
+ return getQueryParameters(urlToUri(url), encoding);
+ }
+
+ /**
+ * Parses the given URI's query string using encoding ISO-8859-1 and extracts the query parameter.
+ *
+ * @param uri
+ * @return map with parsed query parameters. Never <code>null</code>.
+ * @throws ProcessingException
+ */
+ public static Map<String, String> getQueryParameters(URI uri) throws ProcessingException {
+ return getQueryParameters(uri, null);
+ }
+
+ /**
+ * Parses the given URI's query string using the given encoding and extracts the query parameter.
+ *
+ * @param uri
+ * @param encoding
+ * encoding of the query parameter. If <code>null</code> ISO-8859-1 is used.
+ * @return map with parsed query parameters. Never <code>null</code>.
+ * @throws ProcessingException
+ */
+ public static Map<String, String> getQueryParameters(URI uri, String encoding) throws ProcessingException {
+ if (uri == null || uri.getQuery() == null) {
+ return Collections.emptyMap();
+ }
+ Map<String, String> result = new HashMap<String, String>();
+ for (String param : uri.getQuery().split("&")) {
+ String[] parts = StringUtility.split(param, "=");
+ if (parts.length != 2) {
+ throw new ProcessingException("invalid query parameter: '" + param + "'");
+ }
+ try {
+ if (encoding == null) {
+ encoding = ISO_8859_1;
+ }
+ String key = URLDecoder.decode(parts[0], encoding);
+ String value = URLDecoder.decode(parts[1], encoding);
+ String existingMapping = result.put(key, value);
+ if (existingMapping != null) {
+ LOG.warn("parameter key is used multiple times [key='" + key + "', oldValue='" + existingMapping + "', newValue='" + value + "'");
+ }
+ }
+ catch (UnsupportedEncodingException e) {
+ throw new ProcessingException("unsupported encoding '" + encoding + "'", e);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Splits the path of the given {@link URI} in its elements.
+ *
+ * @param uri
+ * @return the path elements or an empty string array if the uri or its path is <code>null</code>.
+ */
+ public static String[] getPath(URI uri) {
+ if (uri == null || uri.getPath() == null) {
+ return new String[0];
+ }
+ String path = uri.getPath();
+ if (path.startsWith("/")) {
+ path = path.substring(1);
+ }
+ return StringUtility.split(path, "/");
+ }
+
+ /**
+ * Converts the given URL into an URI.
+ *
+ * @param url
+ * @return <code>null</code> if the given url is <code>null</code>.
+ * @throws ProcessingException
+ */
+ public static URI urlToUri(URL url) throws ProcessingException {
+ if (url == null) {
+ return null;
+ }
+ try {
+ return url.toURI();
+ }
+ catch (URISyntaxException e) {
+ throw new ProcessingException("Exception while converting URL to URI", e);
+ }
+ }
+
+ /**
+ * Converts the given URI into an URL.
+ *
+ * @param uri
+ * @return <code>null</code> if the given uri is <code>null</code>.
+ * @throws ProcessingException
+ */
+ public static URL uriToUrl(URI uri) throws ProcessingException {
+ if (uri == null) {
+ return null;
+ }
+ try {
+ return uri.toURL();
+ }
+ catch (MalformedURLException e) {
+ throw new ProcessingException("Exception while converting URI to URL", e);
+ }
+ }
+
+ /**
+ * Parses the given string into an {@link URI}.
+ *
+ * @param uri
+ * @return <code>null</code> if the given string is null or has no text or a parsed {@link URI} instance.
+ * @throws ProcessingException
+ */
+ public static URI toUri(String uri) throws ProcessingException {
+ if (!StringUtility.hasText(uri)) {
+ return null;
+ }
+ try {
+ return new URI(uri);
+ }
+ catch (URISyntaxException e) {
+ throw new ProcessingException("Exception while parsing URI", e);
+ }
+ }
+
+ /**
+ * Parses the given string into an {@link URL}.
+ *
+ * @param url
+ * @return <code>null</code> if the given string is null or has no text or a parsed {@link URL} instance.
+ * @throws ProcessingException
+ */
+ public static URL toUrl(String url) throws ProcessingException {
+ if (!StringUtility.hasText(url)) {
+ return null;
+ }
+ try {
+ return new URL(url);
+ }
+ catch (MalformedURLException e) {
+ throw new ProcessingException("Exception while parsing URL", e);
+ }
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/VerboseUtility.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/VerboseUtility.java
index 88527efe74..0fa69319fa 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/VerboseUtility.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/VerboseUtility.java
@@ -1,210 +1,210 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import java.lang.reflect.Array;
-import java.lang.reflect.GenericArrayType;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.lang.reflect.TypeVariable;
-import java.lang.reflect.WildcardType;
-import java.security.Principal;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import javax.security.auth.Subject;
-
-public final class VerboseUtility {
-
- private VerboseUtility() {
- }
-
- public static String dumpGenerics(Type... types) {
- HashMap<Type, String> longDesc = new HashMap<Type, String>();
- StringBuffer buf = new StringBuffer();
- buf.append(dumpGenericsRec(new HashMap<Type, String>(), longDesc, types));
- longDesc.remove(Object.class);
- if (longDesc.size() > 0) {
- buf.append(" WITH ");
- for (String s : longDesc.values()) {
- buf.append(" ");
- buf.append(s);
- }
- }
- return buf.toString();
- }
-
- private static String dumpGenericsRec(Map<Type, String> shortDecl, Map<Type, String> longDecl, Type... types) {
- if (types == null || types.length == 0) {
- return "";
- }
- if (types.length == 1) {
- return dumpGenericsImpl(shortDecl, longDecl, types[0]);
- }
- StringBuffer buf = new StringBuffer();
- buf.append("{");
- for (Type t : types) {
- if (buf.length() > 1) {
- buf.append(", ");
- }
- buf.append(dumpGenericsImpl(shortDecl, longDecl, t));
- }
- buf.append("}");
- return buf.toString();
- }
-
- private static String dumpGenericsImpl(Map<Type, String> shortDecl, Map<Type, String> longDecl, Type type) {
- String shortText = shortDecl.get(type);
- if (shortText != null) {
- return shortText;
- }
- //register short declaration first
- if (type == null) {
- shortText = "null";
- }
- else if (type instanceof Class) {
- Class<?> c = (Class<?>) type;
- shortText = "Class[" + c.getSimpleName() + "]";
- }
- else if (type instanceof GenericArrayType) {
- GenericArrayType g = (GenericArrayType) type;
- shortText = "GenericArrayType[" + dumpGenericsRec(shortDecl, longDecl, g.getGenericComponentType()) + "]";
- }
- else if (type instanceof ParameterizedType) {
- ParameterizedType p = (ParameterizedType) type;
- shortText = "ParameterizedType[" + dumpGenericsRec(shortDecl, longDecl, p.getActualTypeArguments()) + "]";
- }
- else if (type instanceof TypeVariable<?>) {
- TypeVariable v = (TypeVariable) type;
- shortText = "TypeVariable[" + v.getName() + "]";
- }
- else if (type instanceof WildcardType) {
- WildcardType w = (WildcardType) type;
- shortText = "WildcardType[" + dumpGenericsRec(shortDecl, longDecl, w.getLowerBounds()) + ", " + dumpGenericsRec(shortDecl, longDecl, w.getUpperBounds()) + "]";
- }
- else {
- shortText = "UNKNOWN[" + type.getClass().getSimpleName() + "]";
- }
- shortDecl.put(type, shortText);
- //add long declaration
- String longText = null;
- if (type == null) {
- //nop
- }
- else if (type instanceof Class) {
- Class<?> c = (Class<?>) type;
- longText = "Class[name=" + c.getName() + ", typeParameters=" + dumpGenericsRec(shortDecl, longDecl, c.getTypeParameters()) + "]";
- }
- else if (type instanceof GenericArrayType) {
- //nop
- }
- else if (type instanceof ParameterizedType) {
- //nop
- }
- else if (type instanceof TypeVariable<?>) {
- //nop
- }
- else if (type instanceof WildcardType) {
- WildcardType w = (WildcardType) type;
- longText = "WildcardType[lowerBounds=" + dumpGenericsRec(shortDecl, longDecl, w.getLowerBounds()) + ", upperBounds=" + dumpGenericsRec(shortDecl, longDecl, w.getUpperBounds()) + "]";
- }
- if (longText != null) {
- longDecl.put(type, longText);
- }
- return shortText;
- }
-
- public static String dumpType(Class cls) {
- if (cls == null) {
- return "null";
- }
- Class compClass = cls;
- String dim = "";
- while (compClass.isArray()) {
- dim = dim + "[]";
- compClass = compClass.getComponentType();
- }
- Package pkg = compClass.getPackage();
- String s = compClass.getName();
- if (pkg != null) {
- s = s.substring(pkg.getName().length() + 1);
- }
- return s + dim;
- }
-
- public static String dumpObject(Object o) {
- if (o == null) {
- return "null";
- }
- if (o.getClass().isArray()) {
- StringBuffer buf = new StringBuffer();
- buf.append("[");
- int n = Array.getLength(o);
- if (n > 100) {
- n = 100;
- }
- for (int i = 0; i < n; i++) {
- buf.append(dumpObject(Array.get(o, i)));
- if (i + 1 < n) {
- buf.append(",");
- }
- }
- if (Array.getLength(o) > n) {
- buf.append(",...");
- }
- buf.append("]");
- return buf.toString();
- }
- else if (o.getClass() == Byte.class) {
- Byte b = (Byte) o;
- String s = Integer.toHexString(b != null ? (b.intValue() & 0xff) : 0);
- if (s.length() < 2) {
- s = "0" + s;
- }
- return s;
- }
- else if (o instanceof Subject) {
- Subject s = (Subject) o;
- Set<Principal> set = s.getPrincipals();
- if (set.size() > 0) {
- return set.iterator().next().getName();
- }
- else {
- return s.toString();
- }
- }
- else {
- return "" + o;
- }
- }
-
- public static String dumpTypeAndObject(Object o) {
- if (o == null) {
- return "null";
- }
- return dumpType(o.getClass()) + ":" + dumpObject(o);
- }
-
- public static String dumpObjects(Object[] args) {
- if (args == null) {
- return "";
- }
- StringBuffer buf = new StringBuffer();
- for (int i = 0; i < args.length; i++) {
- buf.append(dumpObject(args[i]));
- if (i + 1 < args.length) {
- buf.append(", ");
- }
- }
- return buf.toString();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import java.lang.reflect.Array;
+import java.lang.reflect.GenericArrayType;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.lang.reflect.TypeVariable;
+import java.lang.reflect.WildcardType;
+import java.security.Principal;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import javax.security.auth.Subject;
+
+public final class VerboseUtility {
+
+ private VerboseUtility() {
+ }
+
+ public static String dumpGenerics(Type... types) {
+ HashMap<Type, String> longDesc = new HashMap<Type, String>();
+ StringBuffer buf = new StringBuffer();
+ buf.append(dumpGenericsRec(new HashMap<Type, String>(), longDesc, types));
+ longDesc.remove(Object.class);
+ if (longDesc.size() > 0) {
+ buf.append(" WITH ");
+ for (String s : longDesc.values()) {
+ buf.append(" ");
+ buf.append(s);
+ }
+ }
+ return buf.toString();
+ }
+
+ private static String dumpGenericsRec(Map<Type, String> shortDecl, Map<Type, String> longDecl, Type... types) {
+ if (types == null || types.length == 0) {
+ return "";
+ }
+ if (types.length == 1) {
+ return dumpGenericsImpl(shortDecl, longDecl, types[0]);
+ }
+ StringBuffer buf = new StringBuffer();
+ buf.append("{");
+ for (Type t : types) {
+ if (buf.length() > 1) {
+ buf.append(", ");
+ }
+ buf.append(dumpGenericsImpl(shortDecl, longDecl, t));
+ }
+ buf.append("}");
+ return buf.toString();
+ }
+
+ private static String dumpGenericsImpl(Map<Type, String> shortDecl, Map<Type, String> longDecl, Type type) {
+ String shortText = shortDecl.get(type);
+ if (shortText != null) {
+ return shortText;
+ }
+ //register short declaration first
+ if (type == null) {
+ shortText = "null";
+ }
+ else if (type instanceof Class) {
+ Class<?> c = (Class<?>) type;
+ shortText = "Class[" + c.getSimpleName() + "]";
+ }
+ else if (type instanceof GenericArrayType) {
+ GenericArrayType g = (GenericArrayType) type;
+ shortText = "GenericArrayType[" + dumpGenericsRec(shortDecl, longDecl, g.getGenericComponentType()) + "]";
+ }
+ else if (type instanceof ParameterizedType) {
+ ParameterizedType p = (ParameterizedType) type;
+ shortText = "ParameterizedType[" + dumpGenericsRec(shortDecl, longDecl, p.getActualTypeArguments()) + "]";
+ }
+ else if (type instanceof TypeVariable<?>) {
+ TypeVariable v = (TypeVariable) type;
+ shortText = "TypeVariable[" + v.getName() + "]";
+ }
+ else if (type instanceof WildcardType) {
+ WildcardType w = (WildcardType) type;
+ shortText = "WildcardType[" + dumpGenericsRec(shortDecl, longDecl, w.getLowerBounds()) + ", " + dumpGenericsRec(shortDecl, longDecl, w.getUpperBounds()) + "]";
+ }
+ else {
+ shortText = "UNKNOWN[" + type.getClass().getSimpleName() + "]";
+ }
+ shortDecl.put(type, shortText);
+ //add long declaration
+ String longText = null;
+ if (type == null) {
+ //nop
+ }
+ else if (type instanceof Class) {
+ Class<?> c = (Class<?>) type;
+ longText = "Class[name=" + c.getName() + ", typeParameters=" + dumpGenericsRec(shortDecl, longDecl, c.getTypeParameters()) + "]";
+ }
+ else if (type instanceof GenericArrayType) {
+ //nop
+ }
+ else if (type instanceof ParameterizedType) {
+ //nop
+ }
+ else if (type instanceof TypeVariable<?>) {
+ //nop
+ }
+ else if (type instanceof WildcardType) {
+ WildcardType w = (WildcardType) type;
+ longText = "WildcardType[lowerBounds=" + dumpGenericsRec(shortDecl, longDecl, w.getLowerBounds()) + ", upperBounds=" + dumpGenericsRec(shortDecl, longDecl, w.getUpperBounds()) + "]";
+ }
+ if (longText != null) {
+ longDecl.put(type, longText);
+ }
+ return shortText;
+ }
+
+ public static String dumpType(Class cls) {
+ if (cls == null) {
+ return "null";
+ }
+ Class compClass = cls;
+ String dim = "";
+ while (compClass.isArray()) {
+ dim = dim + "[]";
+ compClass = compClass.getComponentType();
+ }
+ Package pkg = compClass.getPackage();
+ String s = compClass.getName();
+ if (pkg != null) {
+ s = s.substring(pkg.getName().length() + 1);
+ }
+ return s + dim;
+ }
+
+ public static String dumpObject(Object o) {
+ if (o == null) {
+ return "null";
+ }
+ if (o.getClass().isArray()) {
+ StringBuffer buf = new StringBuffer();
+ buf.append("[");
+ int n = Array.getLength(o);
+ if (n > 100) {
+ n = 100;
+ }
+ for (int i = 0; i < n; i++) {
+ buf.append(dumpObject(Array.get(o, i)));
+ if (i + 1 < n) {
+ buf.append(",");
+ }
+ }
+ if (Array.getLength(o) > n) {
+ buf.append(",...");
+ }
+ buf.append("]");
+ return buf.toString();
+ }
+ else if (o.getClass() == Byte.class) {
+ Byte b = (Byte) o;
+ String s = Integer.toHexString(b != null ? (b.intValue() & 0xff) : 0);
+ if (s.length() < 2) {
+ s = "0" + s;
+ }
+ return s;
+ }
+ else if (o instanceof Subject) {
+ Subject s = (Subject) o;
+ Set<Principal> set = s.getPrincipals();
+ if (set.size() > 0) {
+ return set.iterator().next().getName();
+ }
+ else {
+ return s.toString();
+ }
+ }
+ else {
+ return "" + o;
+ }
+ }
+
+ public static String dumpTypeAndObject(Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return dumpType(o.getClass()) + ":" + dumpObject(o);
+ }
+
+ public static String dumpObjects(Object[] args) {
+ if (args == null) {
+ return "";
+ }
+ StringBuffer buf = new StringBuffer();
+ for (int i = 0; i < args.length; i++) {
+ buf.append(dumpObject(args[i]));
+ if (i + 1 < args.length) {
+ buf.append(", ");
+ }
+ }
+ return buf.toString();
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/WeakEventListener.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/WeakEventListener.java
index 9a53a0c1c9..050c3d3385 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/WeakEventListener.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/WeakEventListener.java
@@ -1,25 +1,25 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons;
-
-import java.util.EventListener;
-
-/**
- * marker interface for weak event listener WeakEventListener's are removed from
- * scout's models automatically when their reference (WeakReference) is null.
- * NOTE: weak listeners should be referenced by their host since the model will
- * not hold a valid reference to weak objects. best practise is to have a member
- * variable referencing every weak listener.
- */
-
-public interface WeakEventListener extends EventListener {
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons;
+
+import java.util.EventListener;
+
+/**
+ * marker interface for weak event listener WeakEventListener's are removed from
+ * scout's models automatically when their reference (WeakReference) is null.
+ * NOTE: weak listeners should be referenced by their host since the model will
+ * not hold a valid reference to weak objects. best practise is to have a member
+ * variable referencing every weak listener.
+ */
+
+public interface WeakEventListener extends EventListener {
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/ConfigOperation.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/ConfigOperation.java
index 15f44bdbf4..e4582aa388 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/ConfigOperation.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/ConfigOperation.java
@@ -1,25 +1,25 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Method is a callback or a method that can be overrided. By convention these
- * methods have a name prefix <i>exec</i>...
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.METHOD)
-public @interface ConfigOperation {
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Method is a callback or a method that can be overrided. By convention these
+ * methods have a name prefix <i>exec</i>...
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+public @interface ConfigOperation {
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/ConfigProperty.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/ConfigProperty.java
index 238bea1a2d..4d9a98589f 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/ConfigProperty.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/ConfigProperty.java
@@ -1,200 +1,200 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.METHOD)
-public @interface ConfigProperty {
- String value();
-
- /**
- * Boolean
- */
- String BOOLEAN = "BOOLEAN";
- /**
- * Double
- */
- String DOUBLE = "DOUBLE";
-
- /**
- * String
- */
- String DRAG_AND_DROP_TYPE = "DRAG_AND_DROP_TYPE";
- /**
- * Integer
- */
- String INTEGER = "INTEGER";
- /**
- * Long
- */
- String LONG = "LONG";
- /**
- * Plain-String
- */
- String STRING = "STRING";
- /**
- * e.g. arial,bold,11
- */
- String FONT = "FONT";
-
- String FORM_DATA = "FORM_DATA";
-
- String ABSTRACT_FORM_DATA = "ABSTRACT_FORM_DATA";
-
- /**
- * HEX COLOR e.g. FFFFFF
- */
- String COLOR = "COLOR";
- /**
- * Object
- */
- String OBJECT = "OBJECT";
- /**
- * int
- */
- String BUTTON_DISPLAY_STYLE = "BUTTON_DISPLAY_STYLE";
- /**
- * int
- */
- String BUTTON_SYSTEM_TYPE = "BUTTON_SYSTEM_TYPE";
- /**
- * Class&lt;? extends ICodeType&gt;
- */
- String CODE_TYPE = "CODE_TYPE";
- /**
- * int
- */
- String COMPOSER_ATTRIBUTE_TYPE = "COMPOSER_ATTRIBUTE_TYPE";
- /**
- * String[]
- */
- String FILE_EXTENSIONS = "FILE_EXTENSIONS";
- /**
- * int
- */
- String FORM_DISPLAY_HINT = "FORM_DISPLAY_HINT";
-
- /**
- * String
- */
- String FORM_VIEW_ID = "FORM_VIEW_ID";
-
- /**
- * int
- */
- String HORIZONTAL_ALIGNMENT = "HORIZONTAL_ALIGNMENT";
- /**
- * String
- */
- String ICON_ID = "ICON_ID";
- /**
- * Class&lt;? extends IKeyStroke&gt;
- */
- String KEY_STROKE = "KEY_STROKE";
- /**
- * Class&lt;? extends LookupCall&gt;
- */
- String LOOKUP_CALL = "LOOKUP_CALL";
- /**
- * Class&lt;? extends ILookupService&gt;
- */
- String LOOKUP_SERVICE = "LOOKUP_SERVICE";
- /**
- * Class&lt;? extends IValueField&gt;
- */
- String MASTER_FIELD = "MASTER_FIELD";
- /**
- * Class&lt;? extends IPage&gt;
- */
- String OUTLINE_ROOT_PAGE = "OUTLINE_ROOT_PAGE";
- /**
- * Class&lt;? extends IOutline&gt;
- */
- String OUTLINE = "OUTLINE";
- /**
- * Class&lt;? extends IOutline&gt;[]
- */
- String OUTLINES = "OUTLINES";
- /**
- * Class&lt;? extends IForm&gt;
- */
- String FORM = "FORM";
- /**
- * Class&lt;? extends ISearchForm&gt;
- */
- String SEARCH_FORM = "SEARCH_FORM";
- /**
- * Class&lt;? extends DynamicNls;
- */
- String NLS_PROVIDER = "NLS_PROVIDER";
- /**
- * Class&lt;? extends ISqlStyle&gt;
- */
- String SQL_STYLE = "SQL_STYLE";
- /**
- * Class&lt;? extends IColumn&gt;
- */
- String TABLE_COLUMN = "TABLE_COLUMN";
- /**
- * an String representing an SQL statement
- */
- String SQL = "SQL";
- /**
- * NLS translated String referencing normal text provider services.
- */
- String TEXT = "TEXT";
- /**
- * NLS translated Strings referencing text provider services flagged with
- * <code>IDocumentationTextProviderService</code>.
- */
- String DOC = "DOC";
- /**
- * int
- */
- String VERTICAL_ALIGNMENT = "VERTICAL_ALIGNMENT";
- /**
- * Fully qualified class name of a ISwingChartProvider class with bundle
- * symbolic name prefix<br>
- * Example: <code>com.bsiag.crm.ui.swing/com.bsiag.crm.ui.swing.chart.ForecastChart</code>
- */
- String CHART_QNAME = "CHART_QNAME";
- /**
- * {@link java.util.Calendar#MONDAY} ... {@link java.util.Calendar#SUNDAY}
- */
- String HOUR_OF_DAY = "HOUR_OF_DAY";
- /**
- * duration as type Long in minutes
- */
- String DURATION_MINUTES = "DURATION_MINUTES";
- /**
- * class of a local IMenu (used in table and tree)<br>
- * for example <code>NewCompanyMenu</code>
- */
- String MENU_CLASS = "MENU_CLASS";
- /**
- * Class&lt;?&gt; but must be a primitive wrapper type: String, Double, Float,
- * Long, Integer, Byte
- */
- String PRIMITIVE_TYPE = "PRIMITIVE_TYPE";
- /**
- * Position of the label of a form field.
- */
- String LABEL_POSITION = "LABEL_POSITION";
- /**
- * Horizontal alignment of the label of a form field.
- */
- String LABEL_HORIZONTAL_ALIGNMENT = "LABEL_HORIZONTAL_ALIGNMENT";
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+public @interface ConfigProperty {
+ String value();
+
+ /**
+ * Boolean
+ */
+ String BOOLEAN = "BOOLEAN";
+ /**
+ * Double
+ */
+ String DOUBLE = "DOUBLE";
+
+ /**
+ * String
+ */
+ String DRAG_AND_DROP_TYPE = "DRAG_AND_DROP_TYPE";
+ /**
+ * Integer
+ */
+ String INTEGER = "INTEGER";
+ /**
+ * Long
+ */
+ String LONG = "LONG";
+ /**
+ * Plain-String
+ */
+ String STRING = "STRING";
+ /**
+ * e.g. arial,bold,11
+ */
+ String FONT = "FONT";
+
+ String FORM_DATA = "FORM_DATA";
+
+ String ABSTRACT_FORM_DATA = "ABSTRACT_FORM_DATA";
+
+ /**
+ * HEX COLOR e.g. FFFFFF
+ */
+ String COLOR = "COLOR";
+ /**
+ * Object
+ */
+ String OBJECT = "OBJECT";
+ /**
+ * int
+ */
+ String BUTTON_DISPLAY_STYLE = "BUTTON_DISPLAY_STYLE";
+ /**
+ * int
+ */
+ String BUTTON_SYSTEM_TYPE = "BUTTON_SYSTEM_TYPE";
+ /**
+ * Class&lt;? extends ICodeType&gt;
+ */
+ String CODE_TYPE = "CODE_TYPE";
+ /**
+ * int
+ */
+ String COMPOSER_ATTRIBUTE_TYPE = "COMPOSER_ATTRIBUTE_TYPE";
+ /**
+ * String[]
+ */
+ String FILE_EXTENSIONS = "FILE_EXTENSIONS";
+ /**
+ * int
+ */
+ String FORM_DISPLAY_HINT = "FORM_DISPLAY_HINT";
+
+ /**
+ * String
+ */
+ String FORM_VIEW_ID = "FORM_VIEW_ID";
+
+ /**
+ * int
+ */
+ String HORIZONTAL_ALIGNMENT = "HORIZONTAL_ALIGNMENT";
+ /**
+ * String
+ */
+ String ICON_ID = "ICON_ID";
+ /**
+ * Class&lt;? extends IKeyStroke&gt;
+ */
+ String KEY_STROKE = "KEY_STROKE";
+ /**
+ * Class&lt;? extends LookupCall&gt;
+ */
+ String LOOKUP_CALL = "LOOKUP_CALL";
+ /**
+ * Class&lt;? extends ILookupService&gt;
+ */
+ String LOOKUP_SERVICE = "LOOKUP_SERVICE";
+ /**
+ * Class&lt;? extends IValueField&gt;
+ */
+ String MASTER_FIELD = "MASTER_FIELD";
+ /**
+ * Class&lt;? extends IPage&gt;
+ */
+ String OUTLINE_ROOT_PAGE = "OUTLINE_ROOT_PAGE";
+ /**
+ * Class&lt;? extends IOutline&gt;
+ */
+ String OUTLINE = "OUTLINE";
+ /**
+ * Class&lt;? extends IOutline&gt;[]
+ */
+ String OUTLINES = "OUTLINES";
+ /**
+ * Class&lt;? extends IForm&gt;
+ */
+ String FORM = "FORM";
+ /**
+ * Class&lt;? extends ISearchForm&gt;
+ */
+ String SEARCH_FORM = "SEARCH_FORM";
+ /**
+ * Class&lt;? extends DynamicNls;
+ */
+ String NLS_PROVIDER = "NLS_PROVIDER";
+ /**
+ * Class&lt;? extends ISqlStyle&gt;
+ */
+ String SQL_STYLE = "SQL_STYLE";
+ /**
+ * Class&lt;? extends IColumn&gt;
+ */
+ String TABLE_COLUMN = "TABLE_COLUMN";
+ /**
+ * an String representing an SQL statement
+ */
+ String SQL = "SQL";
+ /**
+ * NLS translated String referencing normal text provider services.
+ */
+ String TEXT = "TEXT";
+ /**
+ * NLS translated Strings referencing text provider services flagged with
+ * <code>IDocumentationTextProviderService</code>.
+ */
+ String DOC = "DOC";
+ /**
+ * int
+ */
+ String VERTICAL_ALIGNMENT = "VERTICAL_ALIGNMENT";
+ /**
+ * Fully qualified class name of a ISwingChartProvider class with bundle
+ * symbolic name prefix<br>
+ * Example: <code>com.bsiag.crm.ui.swing/com.bsiag.crm.ui.swing.chart.ForecastChart</code>
+ */
+ String CHART_QNAME = "CHART_QNAME";
+ /**
+ * {@link java.util.Calendar#MONDAY} ... {@link java.util.Calendar#SUNDAY}
+ */
+ String HOUR_OF_DAY = "HOUR_OF_DAY";
+ /**
+ * duration as type Long in minutes
+ */
+ String DURATION_MINUTES = "DURATION_MINUTES";
+ /**
+ * class of a local IMenu (used in table and tree)<br>
+ * for example <code>NewCompanyMenu</code>
+ */
+ String MENU_CLASS = "MENU_CLASS";
+ /**
+ * Class&lt;?&gt; but must be a primitive wrapper type: String, Double, Float,
+ * Long, Integer, Byte
+ */
+ String PRIMITIVE_TYPE = "PRIMITIVE_TYPE";
+ /**
+ * Position of the label of a form field.
+ */
+ String LABEL_POSITION = "LABEL_POSITION";
+ /**
+ * Horizontal alignment of the label of a form field.
+ */
+ String LABEL_HORIZONTAL_ALIGNMENT = "LABEL_HORIZONTAL_ALIGNMENT";
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/ConfigPropertyValue.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/ConfigPropertyValue.java
index 7dd2a7e3b3..55c87ceffc 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/ConfigPropertyValue.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/ConfigPropertyValue.java
@@ -1,22 +1,22 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.METHOD)
-public @interface ConfigPropertyValue {
- String value();
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+public @interface ConfigPropertyValue {
+ String value();
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/Doc.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/Doc.java
index ab3b8c21a1..b450a32c3d 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/Doc.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/Doc.java
@@ -1,12 +1,12 @@
-package org.eclipse.scout.commons.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-
-@Target(ElementType.TYPE)
-public @interface Doc {
- /**
- * @return The type's priority.
- */
- boolean ignore() default false;
-}
+package org.eclipse.scout.commons.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+
+@Target(ElementType.TYPE)
+public @interface Doc {
+ /**
+ * @return The type's priority.
+ */
+ boolean ignore() default false;
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/FormData.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/FormData.java
index 05d20859d5..c6782c9c62 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/FormData.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/FormData.java
@@ -1,146 +1,146 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Class annotation on a form or form field used in scout sdk as a marker to
- * manage the FormData.
- * <p>
- * The following properties are supported.
- * <table border="1">
- * <tr>
- * <th width="10%">Property</th>
- * <th width="10%">Property</th>
- * <th width="80%">Description</th>
- * </tr>
- * <tr>
- * <td rowspan="1" vAlign="top"><code>value</code></td>
- * <td>*.class</td>
- * <td>A form data class (e.g. <code>AbstractMyGroupboxData.class</code>).
- * <li>The form data class to generate for a <code>? extends AbstractForm</code> when {@link SdkCommand#CREATE}</li>
- * <li>The super class of the managed form data when {@link SdkCommand#USE}</li></td>
- * </tr>
- * <tr>
- * <td rowspan="4" vAlign="top"><code>sdkCommand</code></td>
- * <td> {@link SdkCommand#CREATE}</td>
- * <td>Scout SDK will create an manage the form data.</td>
- * </tr>
- * <tr>
- * <td> {@link SdkCommand#USE}</td>
- * <td>All subclasses will use the formdata (<code>value</code>) as a supertype of its formdata.</td>
- * </tr>
- * <tr>
- * <td> {@link SdkCommand#IGNORE}</td>
- * <td>The annotated class will be ignored in the formdata.</td>
- * </tr>
- * <tr>
- * <td> {@link SdkCommand#DEFAULT}</td>
- * <td>Not to use in the code.</td>
- * </tr>
- * <tr>
- * <td rowspan="4" vAlign="top"><code>defaultSubtypeSdkCommand</code></td>
- * <td> {@link DefaultSubtypeSdkCommand#CREATE}</td>
- * <td>All subtypes will be included in the formdata.</td>
- * </tr>
- * <tr>
- * <td> {@link DefaultSubtypeSdkCommand#IGNORE}</td>
- * <td>All subtypes will be ignored in the formdata.</td>
- * </tr>
- * <tr>
- * <td> {@link DefaultSubtypeSdkCommand#DEFAULT}</td>
- * <td>Not to use in the code.</td>
- * </tr>
- * </table>
- * <h3>Examples</h3>
- * <h4>Ignore on form fields</h4> <blockquote>
- *
- * <pre>
- * &#64FormData(sdkCommand=SdkCommand.IGNORE)
- * public class NameField extends AbstractStringField{...
- *</pre>
- *
- * </blockquote> The NameField will not be considered in the form data. The NameField is an inner type in a
- * form.</blockquote>
- * <h4>Ignore on abstract form fields</h4> <blockquote>
- *
- * <pre>
- * &#64FormData(defaultSubtypeSdkCommand=DefaultSubtypeSdkCommand.IGNORE)
- * public abstract class AbstractNameField extends AbstractStringField{...
- *</pre>
- *
- * </blockquote> Any subtype of AbstractFormField will be ignored in its form data. The AbstractNameField is a primary
- * type.
- * <h4>Template Groupbox</h4> <blockquote>
- *
- * <pre>
- * &#64FormData(value=AbstractTemplateGroupBoxData, defaultSubtypeSdkCommand=DefaultSubtypeSdkCommand.CREATE, sdkCommand=SdkCommand.CREATE)
- * public abstract class AbstractTemplateGroupBox extends AbstractGroupBox{...
- *</pre>
- *
- * </blockquote> The <code>DefaultSubtypeSdkCommand.CREATE</code> ensures the creation of a FormData class for every
- * subclass of this groupbox. The value <code>AbstractTemplateGroupBoxData</code> ensures every
- * <h3>Existing Annotations</h3>
- *
- * <pre>
- * &#64FormData(AbstractFormData.class)
- * public abstract class <b>AbstractForm</b> extends AbstractPropertyObserver implements IForm { ...
- * </pre>
- *
- * <pre>
- * &#64FormData(value = AbstractFormFieldData.class, sdkCommand = SdkCommand.USE)
- * public abstract class <b>AbstractFormField</b> extends AbstractPropertyObserver implements IFormField {...
- * </pre>
- *
- * <pre>
- * &#64FormData(value = AbstractValueFieldData.class, defaultSubtypeSdkCommand = DefaultSubtypeSdkCommand.CREATE, sdkCommand = SdkCommand.USE, genericOrdinal = 0)
- * public abstract class <b>AbstractValueField<T></b> extends AbstractFormField implements IValueField<T> { ...
- * </pre>
- *
- * <pre>
- * &#64FormData(value = AbstractComposerData.class, sdkCommand = SdkCommand.USE, defaultSubtypeSdkCommand = DefaultSubtypeSdkCommand.CREATE)
- * public abstract class <b>AbstractComposerField</b> extends AbstractFormField implements IComposerField { ...
- * </pre>
- *
- * <pre>
- * &#64FormData(value = AbstractUTCFieldData.class, sdkCommand = SdkCommand.USE)
- * public abstract class <b>AbstractUTCDateField</b> extends AbstractDateField implements IUTCDateField { ...
- * </pre>
- *
- * <pre>
- * &#64FormData(value = AbstractTableFieldData.class, sdkCommand = SdkCommand.USE, defaultSubtypeSdkCommand = DefaultSubtypeSdkCommand.CREATE)
- * public abstract class <b>AbstractTableField<T extends ITable></b> extends AbstractFormField implements ITableField<T> { ...
- * </pre>
- */
-@Retention(RetentionPolicy.CLASS)
-@Target({ElementType.METHOD, ElementType.TYPE})
-public @interface FormData {
-
- Class value() default Object.class;
-
- SdkCommand sdkCommand() default SdkCommand.DEFAULT;
-
- DefaultSubtypeSdkCommand defaultSubtypeSdkCommand() default DefaultSubtypeSdkCommand.DEFAULT;
-
- int genericOrdinal() default -1;
-
- public static enum SdkCommand {
- CREATE, USE, IGNORE, DEFAULT
- }
-
- public static enum DefaultSubtypeSdkCommand {
- CREATE, IGNORE, DEFAULT
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Class annotation on a form or form field used in scout sdk as a marker to
+ * manage the FormData.
+ * <p>
+ * The following properties are supported.
+ * <table border="1">
+ * <tr>
+ * <th width="10%">Property</th>
+ * <th width="10%">Property</th>
+ * <th width="80%">Description</th>
+ * </tr>
+ * <tr>
+ * <td rowspan="1" vAlign="top"><code>value</code></td>
+ * <td>*.class</td>
+ * <td>A form data class (e.g. <code>AbstractMyGroupboxData.class</code>).
+ * <li>The form data class to generate for a <code>? extends AbstractForm</code> when {@link SdkCommand#CREATE}</li>
+ * <li>The super class of the managed form data when {@link SdkCommand#USE}</li></td>
+ * </tr>
+ * <tr>
+ * <td rowspan="4" vAlign="top"><code>sdkCommand</code></td>
+ * <td> {@link SdkCommand#CREATE}</td>
+ * <td>Scout SDK will create an manage the form data.</td>
+ * </tr>
+ * <tr>
+ * <td> {@link SdkCommand#USE}</td>
+ * <td>All subclasses will use the formdata (<code>value</code>) as a supertype of its formdata.</td>
+ * </tr>
+ * <tr>
+ * <td> {@link SdkCommand#IGNORE}</td>
+ * <td>The annotated class will be ignored in the formdata.</td>
+ * </tr>
+ * <tr>
+ * <td> {@link SdkCommand#DEFAULT}</td>
+ * <td>Not to use in the code.</td>
+ * </tr>
+ * <tr>
+ * <td rowspan="4" vAlign="top"><code>defaultSubtypeSdkCommand</code></td>
+ * <td> {@link DefaultSubtypeSdkCommand#CREATE}</td>
+ * <td>All subtypes will be included in the formdata.</td>
+ * </tr>
+ * <tr>
+ * <td> {@link DefaultSubtypeSdkCommand#IGNORE}</td>
+ * <td>All subtypes will be ignored in the formdata.</td>
+ * </tr>
+ * <tr>
+ * <td> {@link DefaultSubtypeSdkCommand#DEFAULT}</td>
+ * <td>Not to use in the code.</td>
+ * </tr>
+ * </table>
+ * <h3>Examples</h3>
+ * <h4>Ignore on form fields</h4> <blockquote>
+ *
+ * <pre>
+ * &#64FormData(sdkCommand=SdkCommand.IGNORE)
+ * public class NameField extends AbstractStringField{...
+ *</pre>
+ *
+ * </blockquote> The NameField will not be considered in the form data. The NameField is an inner type in a
+ * form.</blockquote>
+ * <h4>Ignore on abstract form fields</h4> <blockquote>
+ *
+ * <pre>
+ * &#64FormData(defaultSubtypeSdkCommand=DefaultSubtypeSdkCommand.IGNORE)
+ * public abstract class AbstractNameField extends AbstractStringField{...
+ *</pre>
+ *
+ * </blockquote> Any subtype of AbstractFormField will be ignored in its form data. The AbstractNameField is a primary
+ * type.
+ * <h4>Template Groupbox</h4> <blockquote>
+ *
+ * <pre>
+ * &#64FormData(value=AbstractTemplateGroupBoxData, defaultSubtypeSdkCommand=DefaultSubtypeSdkCommand.CREATE, sdkCommand=SdkCommand.CREATE)
+ * public abstract class AbstractTemplateGroupBox extends AbstractGroupBox{...
+ *</pre>
+ *
+ * </blockquote> The <code>DefaultSubtypeSdkCommand.CREATE</code> ensures the creation of a FormData class for every
+ * subclass of this groupbox. The value <code>AbstractTemplateGroupBoxData</code> ensures every
+ * <h3>Existing Annotations</h3>
+ *
+ * <pre>
+ * &#64FormData(AbstractFormData.class)
+ * public abstract class <b>AbstractForm</b> extends AbstractPropertyObserver implements IForm { ...
+ * </pre>
+ *
+ * <pre>
+ * &#64FormData(value = AbstractFormFieldData.class, sdkCommand = SdkCommand.USE)
+ * public abstract class <b>AbstractFormField</b> extends AbstractPropertyObserver implements IFormField {...
+ * </pre>
+ *
+ * <pre>
+ * &#64FormData(value = AbstractValueFieldData.class, defaultSubtypeSdkCommand = DefaultSubtypeSdkCommand.CREATE, sdkCommand = SdkCommand.USE, genericOrdinal = 0)
+ * public abstract class <b>AbstractValueField<T></b> extends AbstractFormField implements IValueField<T> { ...
+ * </pre>
+ *
+ * <pre>
+ * &#64FormData(value = AbstractComposerData.class, sdkCommand = SdkCommand.USE, defaultSubtypeSdkCommand = DefaultSubtypeSdkCommand.CREATE)
+ * public abstract class <b>AbstractComposerField</b> extends AbstractFormField implements IComposerField { ...
+ * </pre>
+ *
+ * <pre>
+ * &#64FormData(value = AbstractUTCFieldData.class, sdkCommand = SdkCommand.USE)
+ * public abstract class <b>AbstractUTCDateField</b> extends AbstractDateField implements IUTCDateField { ...
+ * </pre>
+ *
+ * <pre>
+ * &#64FormData(value = AbstractTableFieldData.class, sdkCommand = SdkCommand.USE, defaultSubtypeSdkCommand = DefaultSubtypeSdkCommand.CREATE)
+ * public abstract class <b>AbstractTableField<T extends ITable></b> extends AbstractFormField implements ITableField<T> { ...
+ * </pre>
+ */
+@Retention(RetentionPolicy.CLASS)
+@Target({ElementType.METHOD, ElementType.TYPE})
+public @interface FormData {
+
+ Class value() default Object.class;
+
+ SdkCommand sdkCommand() default SdkCommand.DEFAULT;
+
+ DefaultSubtypeSdkCommand defaultSubtypeSdkCommand() default DefaultSubtypeSdkCommand.DEFAULT;
+
+ int genericOrdinal() default -1;
+
+ public static enum SdkCommand {
+ CREATE, USE, IGNORE, DEFAULT
+ }
+
+ public static enum DefaultSubtypeSdkCommand {
+ CREATE, IGNORE, DEFAULT
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/FormDataChecksum.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/FormDataChecksum.java
index 3c7189d1cb..e3c4297687 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/FormDataChecksum.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/FormDataChecksum.java
@@ -1,22 +1,22 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.annotations;
-
-import java.util.zip.Adler32;
-
-/**
- * The {@link Adler32} checksum of the resource the form data has been created for.
- * This annotation is used to determ a form data has to be created new or is still valid.
- */
-public @interface FormDataChecksum {
-
- long value() default 0l;
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.annotations;
+
+import java.util.zip.Adler32;
+
+/**
+ * The {@link Adler32} checksum of the resource the form data has been created for.
+ * This annotation is used to determ a form data has to be created new or is still valid.
+ */
+public @interface FormDataChecksum {
+
+ long value() default 0l;
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/IOrdered.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/IOrdered.java
index 9949697305..7be9eaa5db 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/IOrdered.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/IOrdered.java
@@ -1,28 +1,28 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.annotations;
-
-/**
- * Runtime equivalent of {@link Order} annotation. This interface allows defining an order on dynamically created
- * objects, so that they can be used along with statically ordered objects in ordered collections.
- * <p/>
- * <b>Note</b>: Note if both are available, an {@link Order} annotation and the order provided by the {@link IOrdered}
- * interface, the {@link Order} annotation is used.
- *
- * @since 3.8.1
- */
-public interface IOrdered {
-
- /**
- * @return Returns the object's order.
- */
- double getOrder();
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.annotations;
+
+/**
+ * Runtime equivalent of {@link Order} annotation. This interface allows defining an order on dynamically created
+ * objects, so that they can be used along with statically ordered objects in ordered collections.
+ * <p/>
+ * <b>Note</b>: Note if both are available, an {@link Order} annotation and the order provided by the {@link IOrdered}
+ * interface, the {@link Order} annotation is used.
+ *
+ * @since 3.8.1
+ */
+public interface IOrdered {
+
+ /**
+ * @return Returns the object's order.
+ */
+ double getOrder();
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/InjectFieldTo.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/InjectFieldTo.java
index 320baf6c1b..49c09da8f0 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/InjectFieldTo.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/InjectFieldTo.java
@@ -1,52 +1,52 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Annotation on a scout form field used to inject the field into another container.
- * <p>
- * The container may be another field inside the same form or a container in the super classes form fields.
- * <p>
- * The example adds a salary field to the existing BaseForm by injection in an extension form (simplified):
- *
- * <pre>
- * public class BaseForm {
- * &#064;Order(10)
- * public class MainBox extends AbstractGroupBox {
- * &#064;Order(10)
- * public class FirstGroupBox extends AbstractGroupBox {
- * &#064;Order(10)
- * public class NameField extends AbstractStringField {
- * }
- * }
- * }
- * }
- *
- * public class ExtendedForm extends BaseForm {
- * &#064;Order(20)
- * &#064;InjectFieldTo(BaseForm.MainBox.FirstGroupBox.class)
- * public class SalaryField extends AbstractDoubleField {
- * }
- * }
- * </pre>
- *
- * @since 3.9
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.TYPE)
-public @interface InjectFieldTo {
- Class value() default Object.class;
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation on a scout form field used to inject the field into another container.
+ * <p>
+ * The container may be another field inside the same form or a container in the super classes form fields.
+ * <p>
+ * The example adds a salary field to the existing BaseForm by injection in an extension form (simplified):
+ *
+ * <pre>
+ * public class BaseForm {
+ * &#064;Order(10)
+ * public class MainBox extends AbstractGroupBox {
+ * &#064;Order(10)
+ * public class FirstGroupBox extends AbstractGroupBox {
+ * &#064;Order(10)
+ * public class NameField extends AbstractStringField {
+ * }
+ * }
+ * }
+ * }
+ *
+ * public class ExtendedForm extends BaseForm {
+ * &#064;Order(20)
+ * &#064;InjectFieldTo(BaseForm.MainBox.FirstGroupBox.class)
+ * public class SalaryField extends AbstractDoubleField {
+ * }
+ * }
+ * </pre>
+ *
+ * @since 3.9
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+public @interface InjectFieldTo {
+ Class value() default Object.class;
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/Order.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/Order.java
index 3ef22027fd..d3c644b934 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/Order.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/Order.java
@@ -1,27 +1,27 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.annotations;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-/**
- * Assigns an absolute order to a type. To remove all Order-annotations theses
- * regular expressions can be used: search for: (@Order\()(\d+)(\.0f) replace
- * with: $1$2 search for: (@Order\()(\d+)(\.\d+)f replace with: $1$2$3
- */
-@Retention(RetentionPolicy.RUNTIME)
-public @interface Order {
- /**
- * @return The type's absolute order.
- */
- double value();
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.annotations;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * Assigns an absolute order to a type. To remove all Order-annotations theses
+ * regular expressions can be used: search for: (@Order\()(\d+)(\.0f) replace
+ * with: $1$2 search for: (@Order\()(\d+)(\.\d+)f replace with: $1$2$3
+ */
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Order {
+ /**
+ * @return The type's absolute order.
+ */
+ double value();
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/OrderComparator.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/OrderComparator.java
index 546eab619c..b570eaeb81 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/OrderComparator.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/OrderComparator.java
@@ -1,60 +1,60 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.annotations;
-
-import java.util.Comparator;
-
-/**
- * sort objects in ascending order (lowest value first)
- */
-public class OrderComparator implements Comparator<Object> {
-
- @Override
- public int compare(Object a, Object b) {
- if (a == b) {
- return 0;
- }
- if (a == null && b == null) {
- return 0;
- }
- if (a == null) {
- return -1;
- }
- if (b == null) {
- return 1;
- }
- double pa = getOrderOf(a);
- double pb = getOrderOf(b);
- if (pa > pb) {
- return -1;
- }
- if (pa < pb) {
- return 1;
- }
- return a.getClass().getCanonicalName().compareTo(b.getClass().getCanonicalName());
- }
-
- public static double getOrderOf(Object o) {
- if (o == null) {
- return 0;
- }
- double d = 0;
- Order order = o.getClass().getAnnotation(Order.class);
- if (order != null) {
- d = order.value();
- }
- else if (o instanceof IOrdered) {
- d = ((IOrdered) o).getOrder();
- }
- return d;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.annotations;
+
+import java.util.Comparator;
+
+/**
+ * sort objects in ascending order (lowest value first)
+ */
+public class OrderComparator implements Comparator<Object> {
+
+ @Override
+ public int compare(Object a, Object b) {
+ if (a == b) {
+ return 0;
+ }
+ if (a == null && b == null) {
+ return 0;
+ }
+ if (a == null) {
+ return -1;
+ }
+ if (b == null) {
+ return 1;
+ }
+ double pa = getOrderOf(a);
+ double pb = getOrderOf(b);
+ if (pa > pb) {
+ return -1;
+ }
+ if (pa < pb) {
+ return 1;
+ }
+ return a.getClass().getCanonicalName().compareTo(b.getClass().getCanonicalName());
+ }
+
+ public static double getOrderOf(Object o) {
+ if (o == null) {
+ return 0;
+ }
+ double d = 0;
+ Order order = o.getClass().getAnnotation(Order.class);
+ if (order != null) {
+ d = order.value();
+ }
+ else if (o instanceof IOrdered) {
+ d = ((IOrdered) o).getOrder();
+ }
+ return d;
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/Priority.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/Priority.java
index 1beb4d7862..9a4d4ae2bb 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/Priority.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/Priority.java
@@ -1,34 +1,34 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Defines a priority for a type (for example a service implementation) lowest
- * priority is negative infinity highest priority is positive infinity if a type
- * has no priority annotation, the priority value of 0 is assumed if multiple
- * types are considered, the type with the highest priority is chosen
- * recommended priority values are: -1: use only when no other candidate is
- * found 0: use as first choice (when no annotation is found, 0 is assumed) 1-9:
- * use preferrably 10-99: use explicitly
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.TYPE)
-public @interface Priority {
- /**
- * @return The type's priority.
- */
- float value();
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Defines a priority for a type (for example a service implementation) lowest
+ * priority is negative infinity highest priority is positive infinity if a type
+ * has no priority annotation, the priority value of 0 is assumed if multiple
+ * types are considered, the type with the highest priority is chosen
+ * recommended priority values are: -1: use only when no other candidate is
+ * found 0: use as first choice (when no annotation is found, 0 is assumed) 1-9:
+ * use preferrably 10-99: use explicitly
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+public @interface Priority {
+ /**
+ * @return The type's priority.
+ */
+ float value();
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/PriorityComparator.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/PriorityComparator.java
index c4b190c1d5..12846a3da3 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/PriorityComparator.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/PriorityComparator.java
@@ -1,64 +1,64 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.annotations;
-
-import java.lang.reflect.Proxy;
-import java.util.Comparator;
-
-/**
- * sort objects in descending priority (highest value first)
- */
-public class PriorityComparator implements Comparator<Object> {
-
- @Override
- public int compare(Object a, Object b) {
- if (a == b) {
- return 0;
- }
- if (a == null && b == null) {
- return 0;
- }
- if (a == null) {
- return -1;
- }
- if (b == null) {
- return 1;
- }
- float pa = getPriorityOf(a);
- float pb = getPriorityOf(b);
- if (pa > pb) {
- return -1;
- }
- if (pa < pb) {
- return 1;
- }
- return a.getClass().getCanonicalName().compareTo(b.getClass().getCanonicalName());
- }
-
- public static float getPriorityOf(Object o) {
- if (o == null) {
- return 0;
- }
- float f;
- Priority prio = o.getClass().getAnnotation(Priority.class);
- if (prio != null) {
- f = prio.value();
- }
- else if (Proxy.isProxyClass(o.getClass())) {
- f = -1;
- }
- else {
- f = 0;
- }
- return f;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.annotations;
+
+import java.lang.reflect.Proxy;
+import java.util.Comparator;
+
+/**
+ * sort objects in descending priority (highest value first)
+ */
+public class PriorityComparator implements Comparator<Object> {
+
+ @Override
+ public int compare(Object a, Object b) {
+ if (a == b) {
+ return 0;
+ }
+ if (a == null && b == null) {
+ return 0;
+ }
+ if (a == null) {
+ return -1;
+ }
+ if (b == null) {
+ return 1;
+ }
+ float pa = getPriorityOf(a);
+ float pb = getPriorityOf(b);
+ if (pa > pb) {
+ return -1;
+ }
+ if (pa < pb) {
+ return 1;
+ }
+ return a.getClass().getCanonicalName().compareTo(b.getClass().getCanonicalName());
+ }
+
+ public static float getPriorityOf(Object o) {
+ if (o == null) {
+ return 0;
+ }
+ float f;
+ Priority prio = o.getClass().getAnnotation(Priority.class);
+ if (prio != null) {
+ f = prio.value();
+ }
+ else if (Proxy.isProxyClass(o.getClass())) {
+ f = -1;
+ }
+ else {
+ f = 0;
+ }
+ return f;
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/SqlBindingIgnoreValidation.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/SqlBindingIgnoreValidation.java
index 9f3f095d4e..a7805821cb 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/SqlBindingIgnoreValidation.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/annotations/SqlBindingIgnoreValidation.java
@@ -1,32 +1,32 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.annotations;
-
-import static java.lang.annotation.ElementType.CONSTRUCTOR;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.LOCAL_VARIABLE;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.ElementType.TYPE;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- *
- */
-@Target({TYPE, FIELD, METHOD, PARAMETER, CONSTRUCTOR, LOCAL_VARIABLE})
-@Retention(RetentionPolicy.SOURCE)
-public @interface SqlBindingIgnoreValidation {
-
- String[] value() default "";
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.annotations;
+
+import static java.lang.annotation.ElementType.CONSTRUCTOR;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.LOCAL_VARIABLE;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ *
+ */
+@Target({TYPE, FIELD, METHOD, PARAMETER, CONSTRUCTOR, LOCAL_VARIABLE})
+@Retention(RetentionPolicy.SOURCE)
+public @interface SqlBindingIgnoreValidation {
+
+ String[] value() default "";
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/beans/AbstractPropertyObserver.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/beans/AbstractPropertyObserver.java
index 3ec08c694c..48305858d2 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/beans/AbstractPropertyObserver.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/beans/AbstractPropertyObserver.java
@@ -1,39 +1,39 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.beans;
-
-import java.beans.PropertyChangeListener;
-
-public abstract class AbstractPropertyObserver implements IPropertyObserver {
-
- protected final BasicPropertySupport propertySupport = new BasicPropertySupport(this);
-
- @Override
- public void addPropertyChangeListener(PropertyChangeListener listener) {
- propertySupport.addPropertyChangeListener(listener);
- }
-
- @Override
- public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
- propertySupport.addPropertyChangeListener(propertyName, listener);
- }
-
- @Override
- public void removePropertyChangeListener(PropertyChangeListener listener) {
- propertySupport.removePropertyChangeListener(listener);
- }
-
- @Override
- public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) {
- propertySupport.removePropertyChangeListener(propertyName, listener);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.beans;
+
+import java.beans.PropertyChangeListener;
+
+public abstract class AbstractPropertyObserver implements IPropertyObserver {
+
+ protected final BasicPropertySupport propertySupport = new BasicPropertySupport(this);
+
+ @Override
+ public void addPropertyChangeListener(PropertyChangeListener listener) {
+ propertySupport.addPropertyChangeListener(listener);
+ }
+
+ @Override
+ public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
+ propertySupport.addPropertyChangeListener(propertyName, listener);
+ }
+
+ @Override
+ public void removePropertyChangeListener(PropertyChangeListener listener) {
+ propertySupport.removePropertyChangeListener(listener);
+ }
+
+ @Override
+ public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) {
+ propertySupport.removePropertyChangeListener(propertyName, listener);
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/beans/BasicPropertySupport.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/beans/BasicPropertySupport.java
index 80b60b8b26..e6dc1eabb5 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/beans/BasicPropertySupport.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/beans/BasicPropertySupport.java
@@ -1,453 +1,453 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.beans;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.beans.PropertyChangeListenerProxy;
-import java.lang.ref.WeakReference;
-import java.util.ArrayList;
-import java.util.ConcurrentModificationException;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.Map;
-
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.commons.WeakEventListener;
-import org.eclipse.scout.commons.eventlistprofiler.EventListenerProfiler;
-import org.eclipse.scout.commons.eventlistprofiler.IEventListenerSnapshot;
-import org.eclipse.scout.commons.eventlistprofiler.IEventListenerSource;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-
-/**
- * Company: BSI AG
- * www.bsiag.com
- */
-
-public class BasicPropertySupport implements IEventListenerSource {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(BasicPropertySupport.class);
-
- public static final int DEFAULT_INT_VALUE = 0;
- public static final int DEFAULT_DOUBLE_VALUE = 0;
- public static final Integer DEFAULT_INT = new Integer(DEFAULT_INT_VALUE);
- public static final Double DEFAULT_DOUBLE = new Double(DEFAULT_DOUBLE_VALUE);
- public static final long DEFAULT_LONG_VALUE = DEFAULT_INT_VALUE;
- public static final Long DEFAULT_LONG = new Long(DEFAULT_LONG_VALUE);
- private static final Boolean DEFAULT_BOOL = new Boolean(false);
- private HashMap<String, Object> m_props = new HashMap<String, Object>();
- private Object m_source;
- // observer
- private Object m_listenerLock = new Object();
- private ArrayList<Object> m_listeners;
- private HashMap<String, ArrayList<Object>> m_childListeners;
- private int m_propertiesChanging;
- private ArrayList<PropertyChangeEvent> m_propertyEventBuffer;
-
- public BasicPropertySupport(Object sourceBean) {
- m_source = sourceBean;
- if (EventListenerProfiler.getInstance().isEnabled()) {
- EventListenerProfiler.getInstance().registerSourceAsWeakReference(this);
- }
- }
-
- @Override
- public void dumpListenerList(IEventListenerSnapshot snapshot) {
- synchronized (m_listenerLock) {
- if (m_listeners != null) {
- for (Object o : m_listeners) {
- if (o instanceof WeakReference) {
- snapshot.add(PropertyChangeListener.class, null, ((WeakReference) o).get());
- }
- else {
- snapshot.add(PropertyChangeListener.class, null, o);
- }
- }
- }
- if (m_childListeners != null) {
- for (Map.Entry<String, ArrayList<Object>> e : m_childListeners.entrySet()) {
- String context = e.getKey();
- for (Object o : e.getValue()) {
- if (o instanceof WeakReference) {
- snapshot.add(PropertyChangeListener.class, context, ((WeakReference) o).get());
- }
- else {
- snapshot.add(PropertyChangeListener.class, context, o);
- }
- }
- }
- }
- }
- }
-
- public boolean isPropertiesChanging() {
- return m_propertiesChanging > 0;
- }
-
- public void setPropertiesChanging(boolean b) {
- // use a stack counter because setTableChanging might be called in nested
- // loops
- if (b) {
- m_propertiesChanging++;
- }
- else {
- if (m_propertiesChanging > 0) {
- m_propertiesChanging--;
- if (m_propertiesChanging == 0) {
- processChangeBuffer();
- }
- }
- }
- }
-
- public void clearProperties() {
- m_props.clear();
- }
-
- public Map<String, Object> getPropertiesMap() {
- // loop and catch exception instead of using lock (better performance)
- for (int i = 0; i < 10; i++) {
- try {
- return new HashMap<String, Object>(m_props);
- }
- catch (ConcurrentModificationException cme) {
- if (LOG.isDebugEnabled()) {
- LOG.debug(null, cme);
- }
- }
- }
- return new HashMap<String, Object>(m_props);
- }
-
- public void putPropertiesMap(Map<String, Object> map) {
- m_props.putAll(map);
- }
-
- /**
- * DESIGN: should return false if the asked property is set to null - see
- * setProperty() as well. (tha, 16.2.6)
- */
- public boolean hasProperty(String name) {
- return m_props.containsKey(name);
- }
-
- public void setPropertyInt(String name, int i) {
- setProperty(name, new Integer(i), DEFAULT_INT);
- }
-
- public int getPropertyInt(String name) {
- Number n = (Number) getProperty(name);
- return n != null ? n.intValue() : 0;
- }
-
- public void setPropertyDouble(String name, double d) {
- setProperty(name, new Double(d), DEFAULT_DOUBLE);
- }
-
- public double getPropertyDouble(String name) {
- Number n = (Number) getProperty(name);
- return n != null ? n.doubleValue() : 0;
- }
-
- public void setPropertyLong(String name, long i) {
- setProperty(name, new Long(i), DEFAULT_LONG);
- }
-
- public long getPropertyLong(String name) {
- Number n = (Number) getProperty(name);
- return n != null ? n.longValue() : DEFAULT_LONG.longValue();
- }
-
- public boolean setPropertyBool(String name, boolean b) {
- return setProperty(name, new Boolean(b), DEFAULT_BOOL);
- }
-
- public boolean getPropertyBool(String name) {
- Boolean b = (Boolean) getProperty(name);
- return b != null ? b.booleanValue() : DEFAULT_BOOL.booleanValue();
- }
-
- public void setPropertyString(String name, String s) {
- setProperty(name, s);
- }
-
- public void setPropertyStringAlwaysFire(String name, String s) {
- setPropertyAlwaysFire(name, s);
- }
-
- public String getPropertyString(String name) {
- String s = (String) getProperty(name);
- return s;
- }
-
- public Object getProperty(String name) {
- return m_props.get(name);
- }
-
- public boolean setProperty(String name, Object newValue) {
- return setProperty(name, newValue, null);
- }
-
- public boolean/* changed */setPropertyNoFire(String name, Object newValue) {
- Object oldValue = m_props.get(name);
- m_props.put(name, newValue);
- if (CompareUtility.equals(oldValue, newValue)) {
- // no change
- return false;
- }
- else {
- return true;
- }
- }
-
- /**
- * DESIGN: should remove property if set to null - see hasProperty() as well
- * (tha, 16.2.6)
- */
- public boolean setProperty(String name, Object newValue, Object defaultOldValueWhenNull) {
- Object oldValue = m_props.get(name);
- if (oldValue == null) {
- oldValue = defaultOldValueWhenNull;
- }
- m_props.put(name, newValue);
- if (CompareUtility.equals(oldValue, newValue)) {
- // no change
- return false;
- }
- else {
- firePropertyChangeImpl(name, oldValue, newValue);
- return true;
- }
- }
-
- public void setPropertyAlwaysFire(String name, Object newValue) {
- Object oldValue = m_props.get(name);
- m_props.put(name, newValue);
- firePropertyChangeImpl(name, oldValue, newValue);
- }
-
- /**
- * Implementation
- */
-
- public void addPropertyChangeListener(PropertyChangeListener listener) {
- if (listener instanceof PropertyChangeListenerProxy) {
- PropertyChangeListenerProxy proxy = (PropertyChangeListenerProxy) listener;
- // Call two argument add method.
- addPropertyChangeListener(proxy.getPropertyName(), (PropertyChangeListener) proxy.getListener());
- }
- else {
- synchronized (m_listenerLock) {
- if (m_listeners == null) {
- m_listeners = new ArrayList<Object>();
- }
- if (listener instanceof WeakEventListener) {
- m_listeners.add(new WeakReference<PropertyChangeListener>(listener));
- }
- else {
- m_listeners.add(listener);
- }
- }
- }
- }
-
- public void removePropertyChangeListener(PropertyChangeListener listener) {
- if (listener instanceof PropertyChangeListenerProxy) {
- PropertyChangeListenerProxy proxy = (PropertyChangeListenerProxy) listener;
- // Call two argument remove method.
- removePropertyChangeListener(proxy.getPropertyName(), (PropertyChangeListener) proxy.getListener());
- }
- else {
- synchronized (m_listenerLock) {
- removeFromListNoLock(m_listeners, listener);
- if (m_childListeners != null) {
- for (ArrayList childList : m_childListeners.values()) {
- removeFromListNoLock(childList, listener);
- }
- }
- }
- }
- }
-
- public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
- synchronized (m_listenerLock) {
- if (m_childListeners == null) {
- m_childListeners = new HashMap<String, ArrayList<Object>>();
- }
- ArrayList<Object> children = m_childListeners.get(propertyName);
- if (children == null) {
- children = new ArrayList<Object>();
- m_childListeners.put(propertyName, children);
- }
- children.add(listener);
- }
- }
-
- public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) {
- synchronized (m_listenerLock) {
- if (m_childListeners != null) {
- ArrayList childList = m_childListeners.get(propertyName);
- if (childList != null) {
- removeFromListNoLock(childList, listener);
- }
- }
- }
- }
-
- private void removeFromListNoLock(ArrayList listeners, PropertyChangeListener listener) {
- if (listeners == null) {
- return;
- }
- if (listener instanceof WeakEventListener) {
- for (int i = 0, n = listeners.size(); i < n; i++) {
- Object o = listeners.get(i);
- if (o instanceof WeakReference) {
- if (((WeakReference) o).get() == listener) {
- listeners.remove(i);
- break;
- }
- }
- }
- }
- else {
- listeners.remove(listener);
- }
- if (listeners.size() == 0) {
- listeners.trimToSize();
- }
- }
-
- public void firePropertyChange(PropertyChangeEvent e) {
- firePropertyChangeImpl(e);
- }
-
- public void firePropertyChange(String propertyName, int oldValue, int newValue) {
- if (oldValue == newValue) {
- return;
- }
- firePropertyChangeImpl(propertyName, new Integer(oldValue), new Integer(newValue));
- }
-
- public void firePropertyChange(String propertyName, boolean oldValue, boolean newValue) {
- if (oldValue == newValue) {
- return;
- }
- firePropertyChangeImpl(propertyName, Boolean.valueOf(oldValue), Boolean.valueOf(newValue));
- }
-
- public void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
- if (CompareUtility.equals(oldValue, newValue)) {
- return;
- }
- firePropertyChangeImpl(propertyName, oldValue, newValue);
- }
-
- private void firePropertyChangeImpl(String propertyName, Object oldValue, Object newValue) {
- ArrayList l = m_listeners;
- HashMap m = m_childListeners;
- if ((l != null && l.size() > 0) || (m != null && m.size() > 0)) {
- PropertyChangeEvent e = new PropertyChangeEvent(m_source, propertyName, oldValue, newValue);
- firePropertyChangeImpl(e);
- }
- }
-
- private void firePropertyChangeImpl(PropertyChangeEvent e) {
- if (e == null) {
- return;
- }
- //
- if (isPropertiesChanging()) {
- // buffer the event for later batch firing
- synchronized (m_listenerLock) {
- if (m_propertyEventBuffer == null) {
- m_propertyEventBuffer = new ArrayList<PropertyChangeEvent>();
- }
- m_propertyEventBuffer.add(e);
- }
- }
- else {
- ArrayList<PropertyChangeListener> targets = new ArrayList<PropertyChangeListener>(4);
- synchronized (m_listenerLock) {
- if (m_listeners != null) {
- for (Object o : m_listeners) {
- if (o instanceof WeakReference) {
- o = ((WeakReference) o).get();
- }
- if (o != null) {
- targets.add((PropertyChangeListener) o);
- }
- }
- }
- String propertyName = e.getPropertyName();
- if (propertyName != null && m_childListeners != null) {
- ArrayList childListeners = m_childListeners.get(propertyName);
- if (childListeners != null) {
- for (Object o : childListeners) {
- if (o instanceof WeakReference) {
- o = ((WeakReference) o).get();
- }
- if (o != null) {
- targets.add((PropertyChangeListener) o);
- }
- }
- }
- }
- }// end synchronized
- if (targets.size() > 0) {
- for (PropertyChangeListener listener : targets) {
- listener.propertyChange(e);
- }
- }
- }
- }
-
- private void processChangeBuffer() {
- /*
- * fire events property changes are finished now fire all buffered events in
- * one batch
- */
- PropertyChangeEvent[] a = null;
- synchronized (m_listenerLock) {
- if (m_propertyEventBuffer != null) {
- a = m_propertyEventBuffer.toArray(new PropertyChangeEvent[m_propertyEventBuffer.size()]);
- }
- m_propertyEventBuffer = null;
- }
- if (a != null && a.length > 0) {
- // coalesce by names
- LinkedList<PropertyChangeEvent> coalesceList = new LinkedList<PropertyChangeEvent>();
- HashSet<String> names = new HashSet<String>();
- // reverse traversal
- for (int i = a.length - 1; i >= 0; i--) {
- if (!names.contains(a[i].getPropertyName())) {
- coalesceList.add(0, a[i]);
- names.add(a[i].getPropertyName());
- }
- }
- for (PropertyChangeEvent e : coalesceList) {
- firePropertyChangeImpl(e);
- }
- }
- }
-
- public boolean hasListeners(String propertyName) {
- synchronized (m_listenerLock) {
- ArrayList l0 = m_listeners;
- ArrayList l1 = null;
- if (propertyName != null) {
- l1 = m_childListeners.get(propertyName);
- }
- int count = (l0 != null ? l0.size() : 0) + (l1 != null ? l1.size() : 0);
- return count > 0;
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.beans;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeListenerProxy;
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+import java.util.ConcurrentModificationException;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.Map;
+
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.commons.WeakEventListener;
+import org.eclipse.scout.commons.eventlistprofiler.EventListenerProfiler;
+import org.eclipse.scout.commons.eventlistprofiler.IEventListenerSnapshot;
+import org.eclipse.scout.commons.eventlistprofiler.IEventListenerSource;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+
+/**
+ * Company: BSI AG
+ * www.bsiag.com
+ */
+
+public class BasicPropertySupport implements IEventListenerSource {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(BasicPropertySupport.class);
+
+ public static final int DEFAULT_INT_VALUE = 0;
+ public static final int DEFAULT_DOUBLE_VALUE = 0;
+ public static final Integer DEFAULT_INT = new Integer(DEFAULT_INT_VALUE);
+ public static final Double DEFAULT_DOUBLE = new Double(DEFAULT_DOUBLE_VALUE);
+ public static final long DEFAULT_LONG_VALUE = DEFAULT_INT_VALUE;
+ public static final Long DEFAULT_LONG = new Long(DEFAULT_LONG_VALUE);
+ private static final Boolean DEFAULT_BOOL = new Boolean(false);
+ private HashMap<String, Object> m_props = new HashMap<String, Object>();
+ private Object m_source;
+ // observer
+ private Object m_listenerLock = new Object();
+ private ArrayList<Object> m_listeners;
+ private HashMap<String, ArrayList<Object>> m_childListeners;
+ private int m_propertiesChanging;
+ private ArrayList<PropertyChangeEvent> m_propertyEventBuffer;
+
+ public BasicPropertySupport(Object sourceBean) {
+ m_source = sourceBean;
+ if (EventListenerProfiler.getInstance().isEnabled()) {
+ EventListenerProfiler.getInstance().registerSourceAsWeakReference(this);
+ }
+ }
+
+ @Override
+ public void dumpListenerList(IEventListenerSnapshot snapshot) {
+ synchronized (m_listenerLock) {
+ if (m_listeners != null) {
+ for (Object o : m_listeners) {
+ if (o instanceof WeakReference) {
+ snapshot.add(PropertyChangeListener.class, null, ((WeakReference) o).get());
+ }
+ else {
+ snapshot.add(PropertyChangeListener.class, null, o);
+ }
+ }
+ }
+ if (m_childListeners != null) {
+ for (Map.Entry<String, ArrayList<Object>> e : m_childListeners.entrySet()) {
+ String context = e.getKey();
+ for (Object o : e.getValue()) {
+ if (o instanceof WeakReference) {
+ snapshot.add(PropertyChangeListener.class, context, ((WeakReference) o).get());
+ }
+ else {
+ snapshot.add(PropertyChangeListener.class, context, o);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ public boolean isPropertiesChanging() {
+ return m_propertiesChanging > 0;
+ }
+
+ public void setPropertiesChanging(boolean b) {
+ // use a stack counter because setTableChanging might be called in nested
+ // loops
+ if (b) {
+ m_propertiesChanging++;
+ }
+ else {
+ if (m_propertiesChanging > 0) {
+ m_propertiesChanging--;
+ if (m_propertiesChanging == 0) {
+ processChangeBuffer();
+ }
+ }
+ }
+ }
+
+ public void clearProperties() {
+ m_props.clear();
+ }
+
+ public Map<String, Object> getPropertiesMap() {
+ // loop and catch exception instead of using lock (better performance)
+ for (int i = 0; i < 10; i++) {
+ try {
+ return new HashMap<String, Object>(m_props);
+ }
+ catch (ConcurrentModificationException cme) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug(null, cme);
+ }
+ }
+ }
+ return new HashMap<String, Object>(m_props);
+ }
+
+ public void putPropertiesMap(Map<String, Object> map) {
+ m_props.putAll(map);
+ }
+
+ /**
+ * DESIGN: should return false if the asked property is set to null - see
+ * setProperty() as well. (tha, 16.2.6)
+ */
+ public boolean hasProperty(String name) {
+ return m_props.containsKey(name);
+ }
+
+ public void setPropertyInt(String name, int i) {
+ setProperty(name, new Integer(i), DEFAULT_INT);
+ }
+
+ public int getPropertyInt(String name) {
+ Number n = (Number) getProperty(name);
+ return n != null ? n.intValue() : 0;
+ }
+
+ public void setPropertyDouble(String name, double d) {
+ setProperty(name, new Double(d), DEFAULT_DOUBLE);
+ }
+
+ public double getPropertyDouble(String name) {
+ Number n = (Number) getProperty(name);
+ return n != null ? n.doubleValue() : 0;
+ }
+
+ public void setPropertyLong(String name, long i) {
+ setProperty(name, new Long(i), DEFAULT_LONG);
+ }
+
+ public long getPropertyLong(String name) {
+ Number n = (Number) getProperty(name);
+ return n != null ? n.longValue() : DEFAULT_LONG.longValue();
+ }
+
+ public boolean setPropertyBool(String name, boolean b) {
+ return setProperty(name, new Boolean(b), DEFAULT_BOOL);
+ }
+
+ public boolean getPropertyBool(String name) {
+ Boolean b = (Boolean) getProperty(name);
+ return b != null ? b.booleanValue() : DEFAULT_BOOL.booleanValue();
+ }
+
+ public void setPropertyString(String name, String s) {
+ setProperty(name, s);
+ }
+
+ public void setPropertyStringAlwaysFire(String name, String s) {
+ setPropertyAlwaysFire(name, s);
+ }
+
+ public String getPropertyString(String name) {
+ String s = (String) getProperty(name);
+ return s;
+ }
+
+ public Object getProperty(String name) {
+ return m_props.get(name);
+ }
+
+ public boolean setProperty(String name, Object newValue) {
+ return setProperty(name, newValue, null);
+ }
+
+ public boolean/* changed */setPropertyNoFire(String name, Object newValue) {
+ Object oldValue = m_props.get(name);
+ m_props.put(name, newValue);
+ if (CompareUtility.equals(oldValue, newValue)) {
+ // no change
+ return false;
+ }
+ else {
+ return true;
+ }
+ }
+
+ /**
+ * DESIGN: should remove property if set to null - see hasProperty() as well
+ * (tha, 16.2.6)
+ */
+ public boolean setProperty(String name, Object newValue, Object defaultOldValueWhenNull) {
+ Object oldValue = m_props.get(name);
+ if (oldValue == null) {
+ oldValue = defaultOldValueWhenNull;
+ }
+ m_props.put(name, newValue);
+ if (CompareUtility.equals(oldValue, newValue)) {
+ // no change
+ return false;
+ }
+ else {
+ firePropertyChangeImpl(name, oldValue, newValue);
+ return true;
+ }
+ }
+
+ public void setPropertyAlwaysFire(String name, Object newValue) {
+ Object oldValue = m_props.get(name);
+ m_props.put(name, newValue);
+ firePropertyChangeImpl(name, oldValue, newValue);
+ }
+
+ /**
+ * Implementation
+ */
+
+ public void addPropertyChangeListener(PropertyChangeListener listener) {
+ if (listener instanceof PropertyChangeListenerProxy) {
+ PropertyChangeListenerProxy proxy = (PropertyChangeListenerProxy) listener;
+ // Call two argument add method.
+ addPropertyChangeListener(proxy.getPropertyName(), (PropertyChangeListener) proxy.getListener());
+ }
+ else {
+ synchronized (m_listenerLock) {
+ if (m_listeners == null) {
+ m_listeners = new ArrayList<Object>();
+ }
+ if (listener instanceof WeakEventListener) {
+ m_listeners.add(new WeakReference<PropertyChangeListener>(listener));
+ }
+ else {
+ m_listeners.add(listener);
+ }
+ }
+ }
+ }
+
+ public void removePropertyChangeListener(PropertyChangeListener listener) {
+ if (listener instanceof PropertyChangeListenerProxy) {
+ PropertyChangeListenerProxy proxy = (PropertyChangeListenerProxy) listener;
+ // Call two argument remove method.
+ removePropertyChangeListener(proxy.getPropertyName(), (PropertyChangeListener) proxy.getListener());
+ }
+ else {
+ synchronized (m_listenerLock) {
+ removeFromListNoLock(m_listeners, listener);
+ if (m_childListeners != null) {
+ for (ArrayList childList : m_childListeners.values()) {
+ removeFromListNoLock(childList, listener);
+ }
+ }
+ }
+ }
+ }
+
+ public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
+ synchronized (m_listenerLock) {
+ if (m_childListeners == null) {
+ m_childListeners = new HashMap<String, ArrayList<Object>>();
+ }
+ ArrayList<Object> children = m_childListeners.get(propertyName);
+ if (children == null) {
+ children = new ArrayList<Object>();
+ m_childListeners.put(propertyName, children);
+ }
+ children.add(listener);
+ }
+ }
+
+ public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) {
+ synchronized (m_listenerLock) {
+ if (m_childListeners != null) {
+ ArrayList childList = m_childListeners.get(propertyName);
+ if (childList != null) {
+ removeFromListNoLock(childList, listener);
+ }
+ }
+ }
+ }
+
+ private void removeFromListNoLock(ArrayList listeners, PropertyChangeListener listener) {
+ if (listeners == null) {
+ return;
+ }
+ if (listener instanceof WeakEventListener) {
+ for (int i = 0, n = listeners.size(); i < n; i++) {
+ Object o = listeners.get(i);
+ if (o instanceof WeakReference) {
+ if (((WeakReference) o).get() == listener) {
+ listeners.remove(i);
+ break;
+ }
+ }
+ }
+ }
+ else {
+ listeners.remove(listener);
+ }
+ if (listeners.size() == 0) {
+ listeners.trimToSize();
+ }
+ }
+
+ public void firePropertyChange(PropertyChangeEvent e) {
+ firePropertyChangeImpl(e);
+ }
+
+ public void firePropertyChange(String propertyName, int oldValue, int newValue) {
+ if (oldValue == newValue) {
+ return;
+ }
+ firePropertyChangeImpl(propertyName, new Integer(oldValue), new Integer(newValue));
+ }
+
+ public void firePropertyChange(String propertyName, boolean oldValue, boolean newValue) {
+ if (oldValue == newValue) {
+ return;
+ }
+ firePropertyChangeImpl(propertyName, Boolean.valueOf(oldValue), Boolean.valueOf(newValue));
+ }
+
+ public void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
+ if (CompareUtility.equals(oldValue, newValue)) {
+ return;
+ }
+ firePropertyChangeImpl(propertyName, oldValue, newValue);
+ }
+
+ private void firePropertyChangeImpl(String propertyName, Object oldValue, Object newValue) {
+ ArrayList l = m_listeners;
+ HashMap m = m_childListeners;
+ if ((l != null && l.size() > 0) || (m != null && m.size() > 0)) {
+ PropertyChangeEvent e = new PropertyChangeEvent(m_source, propertyName, oldValue, newValue);
+ firePropertyChangeImpl(e);
+ }
+ }
+
+ private void firePropertyChangeImpl(PropertyChangeEvent e) {
+ if (e == null) {
+ return;
+ }
+ //
+ if (isPropertiesChanging()) {
+ // buffer the event for later batch firing
+ synchronized (m_listenerLock) {
+ if (m_propertyEventBuffer == null) {
+ m_propertyEventBuffer = new ArrayList<PropertyChangeEvent>();
+ }
+ m_propertyEventBuffer.add(e);
+ }
+ }
+ else {
+ ArrayList<PropertyChangeListener> targets = new ArrayList<PropertyChangeListener>(4);
+ synchronized (m_listenerLock) {
+ if (m_listeners != null) {
+ for (Object o : m_listeners) {
+ if (o instanceof WeakReference) {
+ o = ((WeakReference) o).get();
+ }
+ if (o != null) {
+ targets.add((PropertyChangeListener) o);
+ }
+ }
+ }
+ String propertyName = e.getPropertyName();
+ if (propertyName != null && m_childListeners != null) {
+ ArrayList childListeners = m_childListeners.get(propertyName);
+ if (childListeners != null) {
+ for (Object o : childListeners) {
+ if (o instanceof WeakReference) {
+ o = ((WeakReference) o).get();
+ }
+ if (o != null) {
+ targets.add((PropertyChangeListener) o);
+ }
+ }
+ }
+ }
+ }// end synchronized
+ if (targets.size() > 0) {
+ for (PropertyChangeListener listener : targets) {
+ listener.propertyChange(e);
+ }
+ }
+ }
+ }
+
+ private void processChangeBuffer() {
+ /*
+ * fire events property changes are finished now fire all buffered events in
+ * one batch
+ */
+ PropertyChangeEvent[] a = null;
+ synchronized (m_listenerLock) {
+ if (m_propertyEventBuffer != null) {
+ a = m_propertyEventBuffer.toArray(new PropertyChangeEvent[m_propertyEventBuffer.size()]);
+ }
+ m_propertyEventBuffer = null;
+ }
+ if (a != null && a.length > 0) {
+ // coalesce by names
+ LinkedList<PropertyChangeEvent> coalesceList = new LinkedList<PropertyChangeEvent>();
+ HashSet<String> names = new HashSet<String>();
+ // reverse traversal
+ for (int i = a.length - 1; i >= 0; i--) {
+ if (!names.contains(a[i].getPropertyName())) {
+ coalesceList.add(0, a[i]);
+ names.add(a[i].getPropertyName());
+ }
+ }
+ for (PropertyChangeEvent e : coalesceList) {
+ firePropertyChangeImpl(e);
+ }
+ }
+ }
+
+ public boolean hasListeners(String propertyName) {
+ synchronized (m_listenerLock) {
+ ArrayList l0 = m_listeners;
+ ArrayList l1 = null;
+ if (propertyName != null) {
+ l1 = m_childListeners.get(propertyName);
+ }
+ int count = (l0 != null ? l0.size() : 0) + (l1 != null ? l1.size() : 0);
+ return count > 0;
+ }
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/beans/FastBeanInfo.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/beans/FastBeanInfo.java
index 139740c467..a3772f2025 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/beans/FastBeanInfo.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/beans/FastBeanInfo.java
@@ -1,66 +1,66 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.beans;
-
-import java.beans.BeanInfo;
-import java.util.Collections;
-import java.util.Map;
-
-/**
- * The java bean {@link BeanInfo} extracts all info from all beans.
- * Sometimes it is useful to have a hi-speed variant of bean info only providing and extracting bean name, type, getters
- * and setters
- * <p>
- * This lenient implementation creates SimplePropertyDescriptor objects that are also speed optimized.
- */
-public class FastBeanInfo {
- private final Class beanClass;
- private final Map<String/*propertyName*/, FastPropertyDescriptor> propertyMap;
- private final FastPropertyDescriptor[] propertyArray;
-
- public FastBeanInfo(Class<?> beanClass, Class<?> stopClass) {
- this.beanClass = beanClass;
- this.propertyMap = Collections.unmodifiableMap(FastBeanUtility.createPropertyDescriptorMap(beanClass, stopClass));
- this.propertyArray = propertyMap.values().toArray(new FastPropertyDescriptor[propertyMap.size()]);
- }
-
- public Class getBeanClass() {
- return beanClass;
- }
-
- public Map<String, FastPropertyDescriptor> getPropertyDescriptorMap() {
- return propertyMap;
- }
-
- /**
- * @return the property descriptor for that name
- * <p>
- * This method is lenient and checks for upper and lower case named properties. For example {@link
- * #getPropertyDescriptor("vATRate")} will also check for property "VATRate" and vis versa.
- */
- public FastPropertyDescriptor getPropertyDescriptor(String name) {
- FastPropertyDescriptor p = propertyMap.get(name);
- if (p == null && name.length() > 0) {
- //be lenient with uppercase/lowercase names
- if (Character.isUpperCase(name.charAt(0))) {
- p = propertyMap.get(Character.toLowerCase(name.charAt(0)) + name.substring(1));
- }
- else {
- p = propertyMap.get(Character.toUpperCase(name.charAt(0)) + name.substring(1));
- }
- }
- return p;
- }
-
- public FastPropertyDescriptor[] getPropertyDescriptors() {
- return propertyArray;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.beans;
+
+import java.beans.BeanInfo;
+import java.util.Collections;
+import java.util.Map;
+
+/**
+ * The java bean {@link BeanInfo} extracts all info from all beans.
+ * Sometimes it is useful to have a hi-speed variant of bean info only providing and extracting bean name, type, getters
+ * and setters
+ * <p>
+ * This lenient implementation creates SimplePropertyDescriptor objects that are also speed optimized.
+ */
+public class FastBeanInfo {
+ private final Class beanClass;
+ private final Map<String/*propertyName*/, FastPropertyDescriptor> propertyMap;
+ private final FastPropertyDescriptor[] propertyArray;
+
+ public FastBeanInfo(Class<?> beanClass, Class<?> stopClass) {
+ this.beanClass = beanClass;
+ this.propertyMap = Collections.unmodifiableMap(FastBeanUtility.createPropertyDescriptorMap(beanClass, stopClass));
+ this.propertyArray = propertyMap.values().toArray(new FastPropertyDescriptor[propertyMap.size()]);
+ }
+
+ public Class getBeanClass() {
+ return beanClass;
+ }
+
+ public Map<String, FastPropertyDescriptor> getPropertyDescriptorMap() {
+ return propertyMap;
+ }
+
+ /**
+ * @return the property descriptor for that name
+ * <p>
+ * This method is lenient and checks for upper and lower case named properties. For example {@link
+ * #getPropertyDescriptor("vATRate")} will also check for property "VATRate" and vis versa.
+ */
+ public FastPropertyDescriptor getPropertyDescriptor(String name) {
+ FastPropertyDescriptor p = propertyMap.get(name);
+ if (p == null && name.length() > 0) {
+ //be lenient with uppercase/lowercase names
+ if (Character.isUpperCase(name.charAt(0))) {
+ p = propertyMap.get(Character.toLowerCase(name.charAt(0)) + name.substring(1));
+ }
+ else {
+ p = propertyMap.get(Character.toUpperCase(name.charAt(0)) + name.substring(1));
+ }
+ }
+ return p;
+ }
+
+ public FastPropertyDescriptor[] getPropertyDescriptors() {
+ return propertyArray;
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/beans/FastBeanUtility.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/beans/FastBeanUtility.java
index ad099466bf..54c49b81d6 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/beans/FastBeanUtility.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/beans/FastBeanUtility.java
@@ -1,153 +1,153 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.beans;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * This utility class is only public for external junit testing reasons, do not use this API.
- */
-public final class FastBeanUtility {
-
- private FastBeanUtility() {
- }
-
- public static String capitalize(String s) {
- if (s == null || s.length() == 0) {
- return "";
- }
- return Character.toUpperCase(s.charAt(0)) + s.substring(1);
- }
-
- public static String decapitalize(String s) {
- if (s == null || s.length() == 0) {
- return "";
- }
- if (s.length() >= 2 && Character.isUpperCase(s.charAt(0)) && Character.isUpperCase(s.charAt(1))) {
- return s;
- }
- return Character.toLowerCase(s.charAt(0)) + s.substring(1);
- }
-
- public static boolean compareMethods(Method a, Method b) {
- if ((a == null) != (b == null)) {
- return false;
- }
-
- if (a != null && b != null) {
- if (!a.equals(b)) {
- return false;
- }
- }
- return true;
- }
-
- public static Class findPropertyType(Method readMethod, Method writeMethod) {
- if (readMethod != null) {
- return readMethod.getReturnType();
- }
- else if (writeMethod != null) {
- return writeMethod.getParameterTypes()[0];
- }
- else {
- return null;
- }
- }
-
- private static final Pattern BEAN_METHOD_PAT = Pattern.compile("(get|set|is)([A-Z].*)");
-
- /**
- * @return a map of property to its {@link InternalPropertyDescriptor}
- */
- public static Map<String/*propertyName*/, FastPropertyDescriptor> createPropertyDescriptorMap(Class<?> beanClazz, Class<?> stopClazz) {
- HashMap<String, FastPropertyDescriptor> map = new HashMap<String, FastPropertyDescriptor>();
- for (Class cl = beanClazz; cl != null && cl != stopClazz; cl = cl.getSuperclass()) {
- Method[] methods = getDeclaredPublicMethods(cl);
- contributePropertyDescriptors(beanClazz, cl, methods, map);
- }
- return map;
- }
-
- public static void contributePropertyDescriptors(Class<?> beanClazz, Class<?> aSuperClass, Method[] methods, Map<String/*propertyName*/, FastPropertyDescriptor> contributeMap) {
- if (methods == null || methods.length == 0) {
- return;
- }
- for (Method m : methods) {
- if (m != null) {
- Matcher matcher = BEAN_METHOD_PAT.matcher(m.getName());
- if (matcher.matches()) {
- String kind = matcher.group(1);
- String name = decapitalize(matcher.group(2));
- Class<?>[] paramTypes = m.getParameterTypes();
- if (paramTypes == null) {
- paramTypes = new Class<?>[0];
- }
- Class<?> retType = m.getReturnType();
- //
- if (kind.equals("get") && paramTypes.length == 0 && retType != null && retType != Void.TYPE) {
- FastPropertyDescriptor desc = contributeMap.get(name);
- if (desc == null) {
- desc = new FastPropertyDescriptor(beanClazz, name);
- contributeMap.put(name, desc);
- }
- desc.addReadMethod(m);
- }
- else if (kind.equals("is") && paramTypes.length == 0 && retType != null && retType == boolean.class) {
- FastPropertyDescriptor desc = contributeMap.get(name);
- if (desc == null) {
- desc = new FastPropertyDescriptor(beanClazz, name);
- contributeMap.put(name, desc);
- }
- desc.addReadMethod(m);
- }
- else if (kind.equals("set") && paramTypes.length == 1 && (retType == null || retType == Void.TYPE)) {
- FastPropertyDescriptor desc = contributeMap.get(name);
- if (desc == null) {
- desc = new FastPropertyDescriptor(beanClazz, name);
- contributeMap.put(name, desc);
- }
- desc.addWriteMethod(m);
- }
- }
- }
- }
- }
-
- public static Method[] getDeclaredPublicMethods(Class c) {
- Method[] result = null;
- final Class fc = c;
- result = AccessController.doPrivileged(new PrivilegedAction<Method[]>() {
- @Override
- public Method[] run() {
- return fc.getDeclaredMethods();
- }
- });
- //clear non-public methods
- if (result != null) {
- for (int i = 0; i < result.length; i++) {
- Method method = result[i];
- int mods = method.getModifiers();
- if (!Modifier.isPublic(mods)) {
- result[i] = null;
- }
- }
- }
- return result;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.beans;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * This utility class is only public for external junit testing reasons, do not use this API.
+ */
+public final class FastBeanUtility {
+
+ private FastBeanUtility() {
+ }
+
+ public static String capitalize(String s) {
+ if (s == null || s.length() == 0) {
+ return "";
+ }
+ return Character.toUpperCase(s.charAt(0)) + s.substring(1);
+ }
+
+ public static String decapitalize(String s) {
+ if (s == null || s.length() == 0) {
+ return "";
+ }
+ if (s.length() >= 2 && Character.isUpperCase(s.charAt(0)) && Character.isUpperCase(s.charAt(1))) {
+ return s;
+ }
+ return Character.toLowerCase(s.charAt(0)) + s.substring(1);
+ }
+
+ public static boolean compareMethods(Method a, Method b) {
+ if ((a == null) != (b == null)) {
+ return false;
+ }
+
+ if (a != null && b != null) {
+ if (!a.equals(b)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public static Class findPropertyType(Method readMethod, Method writeMethod) {
+ if (readMethod != null) {
+ return readMethod.getReturnType();
+ }
+ else if (writeMethod != null) {
+ return writeMethod.getParameterTypes()[0];
+ }
+ else {
+ return null;
+ }
+ }
+
+ private static final Pattern BEAN_METHOD_PAT = Pattern.compile("(get|set|is)([A-Z].*)");
+
+ /**
+ * @return a map of property to its {@link InternalPropertyDescriptor}
+ */
+ public static Map<String/*propertyName*/, FastPropertyDescriptor> createPropertyDescriptorMap(Class<?> beanClazz, Class<?> stopClazz) {
+ HashMap<String, FastPropertyDescriptor> map = new HashMap<String, FastPropertyDescriptor>();
+ for (Class cl = beanClazz; cl != null && cl != stopClazz; cl = cl.getSuperclass()) {
+ Method[] methods = getDeclaredPublicMethods(cl);
+ contributePropertyDescriptors(beanClazz, cl, methods, map);
+ }
+ return map;
+ }
+
+ public static void contributePropertyDescriptors(Class<?> beanClazz, Class<?> aSuperClass, Method[] methods, Map<String/*propertyName*/, FastPropertyDescriptor> contributeMap) {
+ if (methods == null || methods.length == 0) {
+ return;
+ }
+ for (Method m : methods) {
+ if (m != null) {
+ Matcher matcher = BEAN_METHOD_PAT.matcher(m.getName());
+ if (matcher.matches()) {
+ String kind = matcher.group(1);
+ String name = decapitalize(matcher.group(2));
+ Class<?>[] paramTypes = m.getParameterTypes();
+ if (paramTypes == null) {
+ paramTypes = new Class<?>[0];
+ }
+ Class<?> retType = m.getReturnType();
+ //
+ if (kind.equals("get") && paramTypes.length == 0 && retType != null && retType != Void.TYPE) {
+ FastPropertyDescriptor desc = contributeMap.get(name);
+ if (desc == null) {
+ desc = new FastPropertyDescriptor(beanClazz, name);
+ contributeMap.put(name, desc);
+ }
+ desc.addReadMethod(m);
+ }
+ else if (kind.equals("is") && paramTypes.length == 0 && retType != null && retType == boolean.class) {
+ FastPropertyDescriptor desc = contributeMap.get(name);
+ if (desc == null) {
+ desc = new FastPropertyDescriptor(beanClazz, name);
+ contributeMap.put(name, desc);
+ }
+ desc.addReadMethod(m);
+ }
+ else if (kind.equals("set") && paramTypes.length == 1 && (retType == null || retType == Void.TYPE)) {
+ FastPropertyDescriptor desc = contributeMap.get(name);
+ if (desc == null) {
+ desc = new FastPropertyDescriptor(beanClazz, name);
+ contributeMap.put(name, desc);
+ }
+ desc.addWriteMethod(m);
+ }
+ }
+ }
+ }
+ }
+
+ public static Method[] getDeclaredPublicMethods(Class c) {
+ Method[] result = null;
+ final Class fc = c;
+ result = AccessController.doPrivileged(new PrivilegedAction<Method[]>() {
+ @Override
+ public Method[] run() {
+ return fc.getDeclaredMethods();
+ }
+ });
+ //clear non-public methods
+ if (result != null) {
+ for (int i = 0; i < result.length; i++) {
+ Method method = result[i];
+ int mods = method.getModifiers();
+ if (!Modifier.isPublic(mods)) {
+ result[i] = null;
+ }
+ }
+ }
+ return result;
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/beans/FastPropertyDescriptor.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/beans/FastPropertyDescriptor.java
index e4107e072d..283b0428c7 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/beans/FastPropertyDescriptor.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/beans/FastPropertyDescriptor.java
@@ -1,146 +1,146 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.beans;
-
-import java.lang.reflect.Method;
-
-/**
- * The java bean FastPropertyDescriptor tries to find a read <b>and</b> write method of the
- * property, otherwise an exception is thrown.
- * <p>
- * This lenient implementation creates a FastPropertyDescriptor with an optional getter method and an optional setter
- * method so they exist.
- */
-public class FastPropertyDescriptor {
- private final Class<?> m_beanClass;
- private final String m_name;
- private Class<?> m_propertyType;
- private Method m_readMethod;
- private Method m_writeMethod;
-
- public FastPropertyDescriptor(Class<?> beanClazz, String name, Method readMethod, Method writeMethod) {
- m_beanClass = beanClazz;
- m_name = name;
- m_readMethod = readMethod;
- m_writeMethod = writeMethod;
- m_propertyType = FastBeanUtility.findPropertyType(readMethod, writeMethod);
- }
-
- FastPropertyDescriptor(Class<?> beanClazz, String name) {
- m_beanClass = beanClazz;
- m_name = name;
- }
-
- public Class getBeanClass() {
- return m_beanClass;
- }
-
- public String getName() {
- return m_name;
- }
-
- /**
- * Gets the Class object for the property.
- *
- * @return The Java type info for the property. Note that
- * the "Class" object may describe a built-in Java type such as "int".
- * The result may be "null" if this is an indexed property that
- * does not support non-indexed access.
- * <p>
- * This is the type that will be returned by the ReadMethod.
- */
- public Class<?> getPropertyType() {
- return m_propertyType;
- }
-
- /**
- * Gets the method that should be used to read the property value.
- *
- * @return The method that should be used to read the property value.
- * May return null if the property can't be read.
- */
- public Method getReadMethod() {
- return m_readMethod;
- }
-
- void addReadMethod(Method newMethod) {
- //is new method less specific than existing
- if (m_readMethod != null && m_propertyType != null && newMethod.getReturnType().isAssignableFrom(m_propertyType)) {
- return;
- }
- m_readMethod = newMethod;
- m_propertyType = m_readMethod.getReturnType();
- //check write method; read type wins
- if (m_writeMethod != null && !m_propertyType.isAssignableFrom(m_writeMethod.getParameterTypes()[0])) {
- m_writeMethod = null;
- }
- }
-
- /**
- * Gets the method that should be used to write the property value.
- *
- * @return The method that should be used to write the property value.
- * May return null if the property can't be written.
- */
- public Method getWriteMethod() {
- return m_writeMethod;
- }
-
- void addWriteMethod(Method newMethod) {
- //is new method less specific than existing
- if (m_writeMethod != null && newMethod.getParameterTypes()[0].isAssignableFrom(m_writeMethod.getParameterTypes()[0])) {
- return;
- }
- if (m_propertyType == null) {
- m_writeMethod = newMethod;
- m_propertyType = m_writeMethod.getParameterTypes()[0];
- }
- else if (m_propertyType.isAssignableFrom(newMethod.getParameterTypes()[0])) {
- m_writeMethod = newMethod;
- }
- }
-
- @Override
- public int hashCode() {
- int result = 0;
- result = result ^ getName().hashCode();
- result = result ^ ((getPropertyType() == null) ? 0 : getPropertyType().hashCode());
- result = result ^ ((getReadMethod() == null) ? 0 : getReadMethod().hashCode());
- result = result ^ ((getWriteMethod() == null) ? 0 : getWriteMethod().hashCode());
- return result;
- }
-
- /**
- * @return true if both <code>FastPropertyDescriptor</code>s have equal read method, write method and property type
- */
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj != null && obj instanceof FastPropertyDescriptor) {
- FastPropertyDescriptor other = (FastPropertyDescriptor) obj;
- Method otherReadMethod = other.getReadMethod();
- Method otherWriteMethod = other.getWriteMethod();
- if (!FastBeanUtility.compareMethods(getReadMethod(), otherReadMethod)) {
- return false;
- }
- if (!FastBeanUtility.compareMethods(getWriteMethod(), otherWriteMethod)) {
- return false;
- }
- if (getPropertyType() == other.getPropertyType()) {
- return true;
- }
- }
- return false;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.beans;
+
+import java.lang.reflect.Method;
+
+/**
+ * The java bean FastPropertyDescriptor tries to find a read <b>and</b> write method of the
+ * property, otherwise an exception is thrown.
+ * <p>
+ * This lenient implementation creates a FastPropertyDescriptor with an optional getter method and an optional setter
+ * method so they exist.
+ */
+public class FastPropertyDescriptor {
+ private final Class<?> m_beanClass;
+ private final String m_name;
+ private Class<?> m_propertyType;
+ private Method m_readMethod;
+ private Method m_writeMethod;
+
+ public FastPropertyDescriptor(Class<?> beanClazz, String name, Method readMethod, Method writeMethod) {
+ m_beanClass = beanClazz;
+ m_name = name;
+ m_readMethod = readMethod;
+ m_writeMethod = writeMethod;
+ m_propertyType = FastBeanUtility.findPropertyType(readMethod, writeMethod);
+ }
+
+ FastPropertyDescriptor(Class<?> beanClazz, String name) {
+ m_beanClass = beanClazz;
+ m_name = name;
+ }
+
+ public Class getBeanClass() {
+ return m_beanClass;
+ }
+
+ public String getName() {
+ return m_name;
+ }
+
+ /**
+ * Gets the Class object for the property.
+ *
+ * @return The Java type info for the property. Note that
+ * the "Class" object may describe a built-in Java type such as "int".
+ * The result may be "null" if this is an indexed property that
+ * does not support non-indexed access.
+ * <p>
+ * This is the type that will be returned by the ReadMethod.
+ */
+ public Class<?> getPropertyType() {
+ return m_propertyType;
+ }
+
+ /**
+ * Gets the method that should be used to read the property value.
+ *
+ * @return The method that should be used to read the property value.
+ * May return null if the property can't be read.
+ */
+ public Method getReadMethod() {
+ return m_readMethod;
+ }
+
+ void addReadMethod(Method newMethod) {
+ //is new method less specific than existing
+ if (m_readMethod != null && m_propertyType != null && newMethod.getReturnType().isAssignableFrom(m_propertyType)) {
+ return;
+ }
+ m_readMethod = newMethod;
+ m_propertyType = m_readMethod.getReturnType();
+ //check write method; read type wins
+ if (m_writeMethod != null && !m_propertyType.isAssignableFrom(m_writeMethod.getParameterTypes()[0])) {
+ m_writeMethod = null;
+ }
+ }
+
+ /**
+ * Gets the method that should be used to write the property value.
+ *
+ * @return The method that should be used to write the property value.
+ * May return null if the property can't be written.
+ */
+ public Method getWriteMethod() {
+ return m_writeMethod;
+ }
+
+ void addWriteMethod(Method newMethod) {
+ //is new method less specific than existing
+ if (m_writeMethod != null && newMethod.getParameterTypes()[0].isAssignableFrom(m_writeMethod.getParameterTypes()[0])) {
+ return;
+ }
+ if (m_propertyType == null) {
+ m_writeMethod = newMethod;
+ m_propertyType = m_writeMethod.getParameterTypes()[0];
+ }
+ else if (m_propertyType.isAssignableFrom(newMethod.getParameterTypes()[0])) {
+ m_writeMethod = newMethod;
+ }
+ }
+
+ @Override
+ public int hashCode() {
+ int result = 0;
+ result = result ^ getName().hashCode();
+ result = result ^ ((getPropertyType() == null) ? 0 : getPropertyType().hashCode());
+ result = result ^ ((getReadMethod() == null) ? 0 : getReadMethod().hashCode());
+ result = result ^ ((getWriteMethod() == null) ? 0 : getWriteMethod().hashCode());
+ return result;
+ }
+
+ /**
+ * @return true if both <code>FastPropertyDescriptor</code>s have equal read method, write method and property type
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj != null && obj instanceof FastPropertyDescriptor) {
+ FastPropertyDescriptor other = (FastPropertyDescriptor) obj;
+ Method otherReadMethod = other.getReadMethod();
+ Method otherWriteMethod = other.getWriteMethod();
+ if (!FastBeanUtility.compareMethods(getReadMethod(), otherReadMethod)) {
+ return false;
+ }
+ if (!FastBeanUtility.compareMethods(getWriteMethod(), otherWriteMethod)) {
+ return false;
+ }
+ if (getPropertyType() == other.getPropertyType()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/beans/IPropertyFilter.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/beans/IPropertyFilter.java
index 52dd0c3037..f605ff17c4 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/beans/IPropertyFilter.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/beans/IPropertyFilter.java
@@ -1,25 +1,25 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.beans;
-
-
-public interface IPropertyFilter {
-
- /**
- * If the given descriptor should be analyzed.
- *
- * @param descriptor
- * @return if accepts the given descriptor
- * @see AbstractForm.updateForm(...)
- */
- boolean accept(FastPropertyDescriptor descriptor);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.beans;
+
+
+public interface IPropertyFilter {
+
+ /**
+ * If the given descriptor should be analyzed.
+ *
+ * @param descriptor
+ * @return if accepts the given descriptor
+ * @see AbstractForm.updateForm(...)
+ */
+ boolean accept(FastPropertyDescriptor descriptor);
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/beans/IPropertyObserver.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/beans/IPropertyObserver.java
index 628aa2b3a7..95ba30d95e 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/beans/IPropertyObserver.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/beans/IPropertyObserver.java
@@ -1,24 +1,24 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.beans;
-
-import java.beans.PropertyChangeListener;
-
-public interface IPropertyObserver {
-
- void addPropertyChangeListener(PropertyChangeListener listener);
-
- void addPropertyChangeListener(String propertyName, PropertyChangeListener listener);
-
- void removePropertyChangeListener(PropertyChangeListener listener);
-
- void removePropertyChangeListener(String propertyName, PropertyChangeListener listener);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.beans;
+
+import java.beans.PropertyChangeListener;
+
+public interface IPropertyObserver {
+
+ void addPropertyChangeListener(PropertyChangeListener listener);
+
+ void addPropertyChangeListener(String propertyName, PropertyChangeListener listener);
+
+ void removePropertyChangeListener(PropertyChangeListener listener);
+
+ void removePropertyChangeListener(String propertyName, PropertyChangeListener listener);
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/csv/ArrayConsumer.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/csv/ArrayConsumer.java
index b1eb3b6308..cdfc5e487c 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/csv/ArrayConsumer.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/csv/ArrayConsumer.java
@@ -1,41 +1,41 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.csv;
-
-import java.lang.reflect.Array;
-import java.util.ArrayList;
-import java.util.List;
-
-public class ArrayConsumer implements IDataConsumer {
-
- private ArrayList<Object[]> m_rows;
-
- public ArrayConsumer() {
- m_rows = new ArrayList<Object[]>();
- }
-
- @Override
- public void processRow(int lineNr, List<Object> row) {
- m_rows.add(row.toArray());
- }
-
- public Object[][] getData() {
- int maxCol = 0;
- for (int i = 0; i < m_rows.size(); i++) {
- Object[] o = m_rows.get(i);
- if (Array.getLength(o) > maxCol) {
- maxCol = Array.getLength(o);
- }
- }
-
- return m_rows.toArray(new Object[m_rows.size()][maxCol]);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.csv;
+
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.List;
+
+public class ArrayConsumer implements IDataConsumer {
+
+ private ArrayList<Object[]> m_rows;
+
+ public ArrayConsumer() {
+ m_rows = new ArrayList<Object[]>();
+ }
+
+ @Override
+ public void processRow(int lineNr, List<Object> row) {
+ m_rows.add(row.toArray());
+ }
+
+ public Object[][] getData() {
+ int maxCol = 0;
+ for (int i = 0; i < m_rows.size(); i++) {
+ Object[] o = m_rows.get(i);
+ if (Array.getLength(o) > maxCol) {
+ maxCol = Array.getLength(o);
+ }
+ }
+
+ return m_rows.toArray(new Object[m_rows.size()][maxCol]);
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/csv/CsvHelper.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/csv/CsvHelper.java
index adf486554d..7183e2d926 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/csv/CsvHelper.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/csv/CsvHelper.java
@@ -1,583 +1,583 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.csv;
-
-/**
- * Title: BSI Scout V3
- */
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.io.Reader;
-import java.io.UnsupportedEncodingException;
-import java.io.Writer;
-import java.text.DateFormat;
-import java.text.DecimalFormat;
-import java.text.DecimalFormatSymbols;
-import java.text.Format;
-import java.text.NumberFormat;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Locale;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.nls.NlsUtility;
-
-public class CsvHelper {
- /**
- * a column named with "null" will be ignored, its data will not be imported
- */
- public static final String IGNORED_COLUMN_NAME = "null";
-
- private Locale m_locale;
- private char m_separatorChar;// ;
- private char m_textDelimiterChar;// "
- private String m_lineSeparator;// \n
- private int m_colCount;
- private ArrayList<String> m_colNames;
- private ArrayList<String> m_colTypes;
- private ArrayList<Format> m_colFormat;
- private boolean[] m_ignoredColumns;
-
- public CsvHelper() {
- this(null, ',', '"', "\n");
- }
-
- public CsvHelper(Locale locale, String separatorChar, String textDelimiterChar, String lineSeparator) {
- this(locale, (separatorChar != null && separatorChar.length() > 0 ? separatorChar.charAt(0) : 0x00), (textDelimiterChar != null && textDelimiterChar.length() > 0 ? textDelimiterChar.charAt(0) : 0x00), lineSeparator);
- }
-
- public CsvHelper(Locale locale, char separatorChar, char textDelimiterChar, String lineSeparator) {
- if (locale == null) {
- locale = NlsUtility.getDefaultLocale();
- }
- m_locale = locale;
- m_separatorChar = separatorChar != 0x00 ? separatorChar : ';';
- m_textDelimiterChar = textDelimiterChar != 0x00 ? textDelimiterChar : '"';
- m_lineSeparator = lineSeparator != null ? lineSeparator : "\n";
- m_colFormat = new ArrayList<Format>();
- }
-
- /**
- * @return column headers
- */
- public List<String> getColumnNames() {
- return Collections.unmodifiableList(m_colNames);
- }
-
- public void setColumnNames(List<String> list) {
- m_colNames = new ArrayList<String>(list);
- m_colCount = Math.max(m_colCount, m_colNames.size());
- m_ignoredColumns = new boolean[m_colNames.size()];
- for (int i = 0; i < m_colNames.size(); i++) {
- m_ignoredColumns[i] = IGNORED_COLUMN_NAME.equals(m_colNames.get(i));
- }
- }
-
- /**
- * @return column data types
- */
- public List<String> getColumnTypes() {
- return Collections.unmodifiableList(m_colTypes);
- }
-
- public void setColumnTypes(List<String> list) {
- m_colTypes = new ArrayList<String>(list.size());
- m_colFormat = new ArrayList<Format>(list.size());
- for (Iterator<String> it = list.iterator(); it.hasNext();) {
- String s = it.next();
- String sLow = (s != null ? s.toLowerCase() : null);
- Format f = null;
- if (s == null) {
- f = null;
- }
- else if (sLow.equals("string")) {
- f = null;
- }
- else if (sLow.startsWith("integer")) {
- if (s.length() >= 8) {// integer_<format>
- f = new DecimalFormat(s.substring(8), new DecimalFormatSymbols(m_locale));
- ((DecimalFormat) f).setParseIntegerOnly(true);
- }
- else {
- f = NumberFormat.getIntegerInstance(m_locale);
- }
- }
- else if (sLow.startsWith("float")) {
- if (s.length() >= 6) {// float_<format>
- f = new DecimalFormat(s.substring(6), new DecimalFormatSymbols(m_locale));
- }
- else {
- f = NumberFormat.getNumberInstance(m_locale);
- }
- }
- else if (sLow.startsWith("date")) {
- if (s.length() >= 5) {
- f = new SimpleDateFormat(s.substring(5), m_locale);
- }
- else {
- f = DateFormat.getDateInstance(DateFormat.SHORT, m_locale);
- }
- }
- else {
- s = "string";
- f = null;
- }
- m_colTypes.add(s);
- m_colFormat.add(f);
- }
- m_colCount = Math.max(m_colCount, m_colTypes.size());
- }
-
- public Object[][] importData(Reader reader, int headerRowCount, List<String> columnTypes, int rowCount) throws ProcessingException {
- try {
- if (columnTypes != null) {
- setColumnTypes(columnTypes);
- }
- ArrayConsumer cons = new ArrayConsumer();
- importData(cons, reader, false, false, headerRowCount, rowCount);
- Object[][] result = cons.getData();
- return result;
- }
- catch (Exception e) {
- throw new ProcessingException(e.getMessage(), e);
- }
- }
-
- public void importData(IDataConsumer dataConsumer, Reader reader, boolean readNameHeader, boolean readTypeHeader, int headerRowCount) throws ProcessingException {
- importData(dataConsumer, reader, readNameHeader, readTypeHeader, headerRowCount, -1);
- }
-
- public void importData(IDataConsumer dataConsumer, Reader reader, boolean readNameHeader, boolean readTypeHeader, int headerRowCount, int rowCount) throws ProcessingException {
- importData(dataConsumer, reader, readNameHeader, readTypeHeader, headerRowCount, rowCount, false);
- }
-
- /**
- * @param dataConsumer
- * @param reader
- * read data from
- * @param readNameHeader
- * stream contains a column header line
- * @param readTypeHeader
- * stream contains a column type line
- * @param headerRowCount
- * total number of header lines
- * @param rowCount
- * may be negative if unknown
- * @param allowVariableColumnCount
- * true if not all lines have the same number of columns
- * @throws ProcessingException
- */
- public void importData(IDataConsumer dataConsumer, Reader reader, boolean readNameHeader, boolean readTypeHeader, int headerRowCount, int rowCount, boolean allowVariableColumnCount) throws ProcessingException {
- String line = null;
- String cell = null;
- int colIndex = 0;
- int lineNr = -1;
- if (rowCount < 0) {
- rowCount = Integer.MAX_VALUE;
- }
- try {
- if (readNameHeader) {
- List<String> list = importRow(reader);
- if (list != null) {
- setColumnNames(list);
- }
- headerRowCount--;
- }
- if (readTypeHeader) {
- List<String> list = importRow(reader);
- if (list != null) {
- setColumnTypes(list);
- }
- headerRowCount--;
- }
- while (headerRowCount > 0) {
- importRow(reader);
- headerRowCount--;
- }
- // data
- ArrayList<String> cellList;
- lineNr = 1;
- while ((cellList = importRow(reader)) != null && lineNr <= rowCount) {
- // fill up with empty row if allowed
- while (allowVariableColumnCount && (cellList.size() < getColumnNames().size())) {
- cellList.add(cellList.size(), null);
- }
- // convert data types
- ArrayList<Object> objList = new ArrayList<Object>(cellList.size());
- for (colIndex = 0; colIndex < cellList.size(); colIndex++) {
- if (m_ignoredColumns == null || m_ignoredColumns.length == 0 || m_ignoredColumns.length < colIndex || m_ignoredColumns[colIndex] == false) {
- cell = cellList.get(colIndex);
- objList.add(importCell(cell, getColumnFormat(colIndex)));
- }
- }
- // add row to data
- dataConsumer.processRow(lineNr, objList);
- lineNr++;
- }
- }
- catch (Exception e) {
- throw new ProcessingException("line=" + line + " colIndex=" + colIndex + " cell=" + cell, e);
- }
- }
-
- public void exportData(Object[][] data, File f, String encoding, List<String> columnNames, boolean writeColumnNames, List<String> columnTypes, boolean writeColumnTypes) throws ProcessingException {
- try {
- if (encoding == null) {
- encoding = "UTF-8";
- }
- Writer writer = new OutputStreamWriter(new FileOutputStream(f), encoding);
- try {
- exportData(data, writer, columnNames, writeColumnNames, columnTypes, writeColumnTypes);
- }
- finally {
- try {
- writer.close();
- }
- catch (IOException e) {
- // nop
- }
- }
- }
- catch (UnsupportedEncodingException e) {
- throw new ProcessingException(f.getAbsolutePath(), e);
- }
- catch (FileNotFoundException e) {
- throw new ProcessingException(f.getAbsolutePath(), e);
- }
- }
-
- public void exportData(Object[][] data, Writer writer, List<String> columnNames, boolean writeColumnNames, List<String> columnTypes, boolean writeColumnTypes) throws ProcessingException {
- try {
- if (columnNames != null) {
- setColumnNames(columnNames);
- }
- if (columnTypes != null) {
- setColumnTypes(columnTypes);
- }
- exportHeaderRows(writer, writeColumnNames, writeColumnTypes);
- for (Object[] row : data) {
- exportDataRow(row, writer, false);
- }
- }
- finally {
- try {
- writer.close();
- }
- catch (Exception e) {
- }
- }
- }
-
- /**
- * @param writer
- * @param writeNames
- * write a line for the column names
- * @param writeTypes
- * write a line for the data types
- * @throws ProcessingException
- * Writes the header rows to the writer.
- */
- public void exportHeaderRows(Writer writer, boolean writeNames, boolean writeTypes) throws ProcessingException {
- String line = null;
- int colIndex = 0;
- Object val = null;
- String cell = null;
- try {
- if (writeNames) {
- line = exportRow(m_colNames);
- writer.write(line);
- writer.write(m_lineSeparator);
- }
- if (writeTypes) {
- line = exportRow(m_colTypes);
- writer.write(line);
- writer.write(m_lineSeparator);
- }
- }
- catch (IOException e) {
- throw new ProcessingException("line=" + line + " colIndex=" + colIndex + " value=" + val + " cell=" + cell);
- }
- }
-
- /**
- * @param writer
- * @throws ProcessingException
- * Writes data rows to the writer and does close it.
- */
- public void exportDataRow(Object[] row, Writer writer) throws ProcessingException {
- exportDataRow(row, writer, true);
- }
-
- /**
- * @param writer
- * @param closeWriter
- * true->will close the writer
- * @throws ProcessingException
- * Writes data rows to the writer.
- */
- public void exportDataRow(Object[] row, Writer writer, boolean closeWriter) throws ProcessingException {
- String line = null;
- Object val = null;
- String cell = null;
- try {
- ArrayList<String> rowStrings = new ArrayList<String>();
- rowStrings.clear();
- for (int i = 0; i < row.length; i++) {
- val = row[i];
- cell = exportCell(val, getColumnFormat(i));
- rowStrings.add(cell);
- }
- line = exportRow(rowStrings);
- writer.write(line);
- writer.write(m_lineSeparator);
- }
- catch (IOException e) {
- throw new ProcessingException("line=" + Arrays.asList(row));
- }
- finally {
- if (closeWriter) {
- try {
- writer.close();
- }
- catch (Exception e) {
- }
- }
- }
- }
-
- private Format getColumnFormat(int colIndex) {
- if (colIndex < m_colFormat.size()) {
- return m_colFormat.get(colIndex);
- }
- else {
- return null;
- }
- }
-
- private ArrayList<String> importRow(Reader reader) throws IOException {
- ArrayList<String> cellList = new ArrayList<String>(Math.max(m_colCount, 2));
- boolean inString = false;
- StringBuffer curBuf = new StringBuffer();
- String token;
- int ch = reader.read();
-
- while (ch == '\n' || ch == '\r') {
- ch = reader.read();
- }
- if (ch < 0) {
- return null;
- }
- while (true) {
- if (ch >= 0 && inString) {
- if (ch == m_textDelimiterChar) {
- inString = false;
- }
- else {
- // still in string
- }
- curBuf.append((char) ch);
- }
- else {// ch<0 or out of string or end of line
- if (ch == m_separatorChar || ch < 0 || ch == '\n' || ch == '\r') {
- // consume token
- token = curBuf.toString();
- curBuf.setLength(0);
- int tokenLen = token.length();
- if (tokenLen > 0) {
- // remove delimiters
- if (token.charAt(0) == m_textDelimiterChar && token.charAt(tokenLen - 1) == m_textDelimiterChar) {
- token = token.substring(1, tokenLen - 1);
- }
- if (token.length() == 0) {
- token = null;
- }
- }
- else {
- token = null;
- }
- // decode and add token
- token = decodeText(token);
- cellList.add(token);
- // check if end of current line
- if (ch < 0 || ch == '\n' || ch == '\r') {
- break;
- }
- }
- else if (ch == m_textDelimiterChar) {
- inString = true;
- curBuf.append((char) ch);
- }
- else {
- // normal character
- curBuf.append((char) ch);
- }
- }
- // next character
- ch = reader.read();
- }
- // end of file?
- if (cellList.size() == 0 && ch < 0) {
- cellList = null;
- }
- return cellList;
- }
-
- private String exportRow(Collection<String> strings) {
- StringBuffer buf = new StringBuffer();
- if (strings != null) {
- for (Iterator<String> it = strings.iterator(); it.hasNext();) {
- buf.append(encodeText(it.next()));
- if (it.hasNext()) {
- if (m_separatorChar != 0x00) {
- buf.append(m_separatorChar);
- }
- }
- }
- }
- return buf.toString();
- }
-
- private Object importCell(String text, Format f) throws ProcessingException {
- if (text != null && f != null) {
- try {
- text = text.trim();
- return f.parseObject(text);
- }
- catch (ParseException e) {
- throw new ProcessingException("text=" + text + " format=" + f);
- }
- }
- else {
- return text;
- }
- }
-
- private String exportCell(Object o, Format f) {
- if (f != null && o != null) {
- return f.format(o);
- }
- else if (o == null) {
- return "";
- }
- else {
- return o.toString();
- }
- }
-
- private String encodeText(String text) {
- if (m_textDelimiterChar != 0x00) {
- if (text != null) {
- text = stringReplace(text, "" + m_textDelimiterChar, "" + m_textDelimiterChar + m_textDelimiterChar);
- if (text.indexOf(m_separatorChar) >= 0 || text.indexOf(m_textDelimiterChar) >= 0) {
- text = m_textDelimiterChar + text + m_textDelimiterChar;
- }
- }
- }
- return text;
- }
-
- private String decodeText(String text) {
- if (text != null && text.length() > 0) {
- if (m_textDelimiterChar != 0x00) {
- if (text.charAt(0) == m_textDelimiterChar && text.charAt(text.length() - 1) == m_textDelimiterChar) {
- text = text.substring(1, text.length() - 1);
- }
- text = stringReplace(text, "" + m_textDelimiterChar + m_textDelimiterChar, "" + m_textDelimiterChar);
- }
- }
- return text;
- }
-
- private String stringReplace(String s, String sOld, String sNew) {
- sNew = (sNew == null ? "" : sNew);
- if (s == null || sOld == null) {
- return s;
- }
- StringBuffer buf = new StringBuffer();
- int oldLen = sOld.length();
- int pos = 0;
- int i = s.indexOf(sOld);
- while (i >= 0) {
- buf.append(s.substring(pos, i));
- buf.append(sNew);
- pos = i + oldLen;
- i = s.indexOf(sOld, pos);
- }
- buf.append(s.substring(pos));
- return buf.toString();
- }
-
- /**
- * @param file
- * @return the the first line of the file, expecting it to be the column names
- * @throws ProcessingException
- * Read only
- */
- public List<String> getColumnNames(File f) throws ProcessingException {
- Reader r = null;
- try {
- r = new FileReader(f);
- List<String> result = getCurrentRow(r);
- return result;
- }
- catch (IOException e) {
- throw new ProcessingException(e.getMessage(), e);
- }
- finally {
- if (r != null) {
- try {
- r.close();
- }
- catch (Throwable t) {
- }
- }
- }
- }
-
- /**
- * @param reader
- * @return the current row in the reader as cell tokens based on this helpers
- * context
- * @throws ProcessingException
- */
- public List<String> getCurrentRow(Reader reader) throws ProcessingException {
- BufferedReader bufferedReader = null;
- try {
- bufferedReader = new BufferedReader(reader);
- return importRow(bufferedReader);
- }
- catch (Exception e) {
- throw new ProcessingException("reading header row");
- }
- finally {
- if (bufferedReader != null) {
- try {
- bufferedReader.close();
- }
- catch (Exception e) {
- }
- }
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.csv;
+
+/**
+ * Title: BSI Scout V3
+ */
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.Reader;
+import java.io.UnsupportedEncodingException;
+import java.io.Writer;
+import java.text.DateFormat;
+import java.text.DecimalFormat;
+import java.text.DecimalFormatSymbols;
+import java.text.Format;
+import java.text.NumberFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.nls.NlsUtility;
+
+public class CsvHelper {
+ /**
+ * a column named with "null" will be ignored, its data will not be imported
+ */
+ public static final String IGNORED_COLUMN_NAME = "null";
+
+ private Locale m_locale;
+ private char m_separatorChar;// ;
+ private char m_textDelimiterChar;// "
+ private String m_lineSeparator;// \n
+ private int m_colCount;
+ private ArrayList<String> m_colNames;
+ private ArrayList<String> m_colTypes;
+ private ArrayList<Format> m_colFormat;
+ private boolean[] m_ignoredColumns;
+
+ public CsvHelper() {
+ this(null, ',', '"', "\n");
+ }
+
+ public CsvHelper(Locale locale, String separatorChar, String textDelimiterChar, String lineSeparator) {
+ this(locale, (separatorChar != null && separatorChar.length() > 0 ? separatorChar.charAt(0) : 0x00), (textDelimiterChar != null && textDelimiterChar.length() > 0 ? textDelimiterChar.charAt(0) : 0x00), lineSeparator);
+ }
+
+ public CsvHelper(Locale locale, char separatorChar, char textDelimiterChar, String lineSeparator) {
+ if (locale == null) {
+ locale = NlsUtility.getDefaultLocale();
+ }
+ m_locale = locale;
+ m_separatorChar = separatorChar != 0x00 ? separatorChar : ';';
+ m_textDelimiterChar = textDelimiterChar != 0x00 ? textDelimiterChar : '"';
+ m_lineSeparator = lineSeparator != null ? lineSeparator : "\n";
+ m_colFormat = new ArrayList<Format>();
+ }
+
+ /**
+ * @return column headers
+ */
+ public List<String> getColumnNames() {
+ return Collections.unmodifiableList(m_colNames);
+ }
+
+ public void setColumnNames(List<String> list) {
+ m_colNames = new ArrayList<String>(list);
+ m_colCount = Math.max(m_colCount, m_colNames.size());
+ m_ignoredColumns = new boolean[m_colNames.size()];
+ for (int i = 0; i < m_colNames.size(); i++) {
+ m_ignoredColumns[i] = IGNORED_COLUMN_NAME.equals(m_colNames.get(i));
+ }
+ }
+
+ /**
+ * @return column data types
+ */
+ public List<String> getColumnTypes() {
+ return Collections.unmodifiableList(m_colTypes);
+ }
+
+ public void setColumnTypes(List<String> list) {
+ m_colTypes = new ArrayList<String>(list.size());
+ m_colFormat = new ArrayList<Format>(list.size());
+ for (Iterator<String> it = list.iterator(); it.hasNext();) {
+ String s = it.next();
+ String sLow = (s != null ? s.toLowerCase() : null);
+ Format f = null;
+ if (s == null) {
+ f = null;
+ }
+ else if (sLow.equals("string")) {
+ f = null;
+ }
+ else if (sLow.startsWith("integer")) {
+ if (s.length() >= 8) {// integer_<format>
+ f = new DecimalFormat(s.substring(8), new DecimalFormatSymbols(m_locale));
+ ((DecimalFormat) f).setParseIntegerOnly(true);
+ }
+ else {
+ f = NumberFormat.getIntegerInstance(m_locale);
+ }
+ }
+ else if (sLow.startsWith("float")) {
+ if (s.length() >= 6) {// float_<format>
+ f = new DecimalFormat(s.substring(6), new DecimalFormatSymbols(m_locale));
+ }
+ else {
+ f = NumberFormat.getNumberInstance(m_locale);
+ }
+ }
+ else if (sLow.startsWith("date")) {
+ if (s.length() >= 5) {
+ f = new SimpleDateFormat(s.substring(5), m_locale);
+ }
+ else {
+ f = DateFormat.getDateInstance(DateFormat.SHORT, m_locale);
+ }
+ }
+ else {
+ s = "string";
+ f = null;
+ }
+ m_colTypes.add(s);
+ m_colFormat.add(f);
+ }
+ m_colCount = Math.max(m_colCount, m_colTypes.size());
+ }
+
+ public Object[][] importData(Reader reader, int headerRowCount, List<String> columnTypes, int rowCount) throws ProcessingException {
+ try {
+ if (columnTypes != null) {
+ setColumnTypes(columnTypes);
+ }
+ ArrayConsumer cons = new ArrayConsumer();
+ importData(cons, reader, false, false, headerRowCount, rowCount);
+ Object[][] result = cons.getData();
+ return result;
+ }
+ catch (Exception e) {
+ throw new ProcessingException(e.getMessage(), e);
+ }
+ }
+
+ public void importData(IDataConsumer dataConsumer, Reader reader, boolean readNameHeader, boolean readTypeHeader, int headerRowCount) throws ProcessingException {
+ importData(dataConsumer, reader, readNameHeader, readTypeHeader, headerRowCount, -1);
+ }
+
+ public void importData(IDataConsumer dataConsumer, Reader reader, boolean readNameHeader, boolean readTypeHeader, int headerRowCount, int rowCount) throws ProcessingException {
+ importData(dataConsumer, reader, readNameHeader, readTypeHeader, headerRowCount, rowCount, false);
+ }
+
+ /**
+ * @param dataConsumer
+ * @param reader
+ * read data from
+ * @param readNameHeader
+ * stream contains a column header line
+ * @param readTypeHeader
+ * stream contains a column type line
+ * @param headerRowCount
+ * total number of header lines
+ * @param rowCount
+ * may be negative if unknown
+ * @param allowVariableColumnCount
+ * true if not all lines have the same number of columns
+ * @throws ProcessingException
+ */
+ public void importData(IDataConsumer dataConsumer, Reader reader, boolean readNameHeader, boolean readTypeHeader, int headerRowCount, int rowCount, boolean allowVariableColumnCount) throws ProcessingException {
+ String line = null;
+ String cell = null;
+ int colIndex = 0;
+ int lineNr = -1;
+ if (rowCount < 0) {
+ rowCount = Integer.MAX_VALUE;
+ }
+ try {
+ if (readNameHeader) {
+ List<String> list = importRow(reader);
+ if (list != null) {
+ setColumnNames(list);
+ }
+ headerRowCount--;
+ }
+ if (readTypeHeader) {
+ List<String> list = importRow(reader);
+ if (list != null) {
+ setColumnTypes(list);
+ }
+ headerRowCount--;
+ }
+ while (headerRowCount > 0) {
+ importRow(reader);
+ headerRowCount--;
+ }
+ // data
+ ArrayList<String> cellList;
+ lineNr = 1;
+ while ((cellList = importRow(reader)) != null && lineNr <= rowCount) {
+ // fill up with empty row if allowed
+ while (allowVariableColumnCount && (cellList.size() < getColumnNames().size())) {
+ cellList.add(cellList.size(), null);
+ }
+ // convert data types
+ ArrayList<Object> objList = new ArrayList<Object>(cellList.size());
+ for (colIndex = 0; colIndex < cellList.size(); colIndex++) {
+ if (m_ignoredColumns == null || m_ignoredColumns.length == 0 || m_ignoredColumns.length < colIndex || m_ignoredColumns[colIndex] == false) {
+ cell = cellList.get(colIndex);
+ objList.add(importCell(cell, getColumnFormat(colIndex)));
+ }
+ }
+ // add row to data
+ dataConsumer.processRow(lineNr, objList);
+ lineNr++;
+ }
+ }
+ catch (Exception e) {
+ throw new ProcessingException("line=" + line + " colIndex=" + colIndex + " cell=" + cell, e);
+ }
+ }
+
+ public void exportData(Object[][] data, File f, String encoding, List<String> columnNames, boolean writeColumnNames, List<String> columnTypes, boolean writeColumnTypes) throws ProcessingException {
+ try {
+ if (encoding == null) {
+ encoding = "UTF-8";
+ }
+ Writer writer = new OutputStreamWriter(new FileOutputStream(f), encoding);
+ try {
+ exportData(data, writer, columnNames, writeColumnNames, columnTypes, writeColumnTypes);
+ }
+ finally {
+ try {
+ writer.close();
+ }
+ catch (IOException e) {
+ // nop
+ }
+ }
+ }
+ catch (UnsupportedEncodingException e) {
+ throw new ProcessingException(f.getAbsolutePath(), e);
+ }
+ catch (FileNotFoundException e) {
+ throw new ProcessingException(f.getAbsolutePath(), e);
+ }
+ }
+
+ public void exportData(Object[][] data, Writer writer, List<String> columnNames, boolean writeColumnNames, List<String> columnTypes, boolean writeColumnTypes) throws ProcessingException {
+ try {
+ if (columnNames != null) {
+ setColumnNames(columnNames);
+ }
+ if (columnTypes != null) {
+ setColumnTypes(columnTypes);
+ }
+ exportHeaderRows(writer, writeColumnNames, writeColumnTypes);
+ for (Object[] row : data) {
+ exportDataRow(row, writer, false);
+ }
+ }
+ finally {
+ try {
+ writer.close();
+ }
+ catch (Exception e) {
+ }
+ }
+ }
+
+ /**
+ * @param writer
+ * @param writeNames
+ * write a line for the column names
+ * @param writeTypes
+ * write a line for the data types
+ * @throws ProcessingException
+ * Writes the header rows to the writer.
+ */
+ public void exportHeaderRows(Writer writer, boolean writeNames, boolean writeTypes) throws ProcessingException {
+ String line = null;
+ int colIndex = 0;
+ Object val = null;
+ String cell = null;
+ try {
+ if (writeNames) {
+ line = exportRow(m_colNames);
+ writer.write(line);
+ writer.write(m_lineSeparator);
+ }
+ if (writeTypes) {
+ line = exportRow(m_colTypes);
+ writer.write(line);
+ writer.write(m_lineSeparator);
+ }
+ }
+ catch (IOException e) {
+ throw new ProcessingException("line=" + line + " colIndex=" + colIndex + " value=" + val + " cell=" + cell);
+ }
+ }
+
+ /**
+ * @param writer
+ * @throws ProcessingException
+ * Writes data rows to the writer and does close it.
+ */
+ public void exportDataRow(Object[] row, Writer writer) throws ProcessingException {
+ exportDataRow(row, writer, true);
+ }
+
+ /**
+ * @param writer
+ * @param closeWriter
+ * true->will close the writer
+ * @throws ProcessingException
+ * Writes data rows to the writer.
+ */
+ public void exportDataRow(Object[] row, Writer writer, boolean closeWriter) throws ProcessingException {
+ String line = null;
+ Object val = null;
+ String cell = null;
+ try {
+ ArrayList<String> rowStrings = new ArrayList<String>();
+ rowStrings.clear();
+ for (int i = 0; i < row.length; i++) {
+ val = row[i];
+ cell = exportCell(val, getColumnFormat(i));
+ rowStrings.add(cell);
+ }
+ line = exportRow(rowStrings);
+ writer.write(line);
+ writer.write(m_lineSeparator);
+ }
+ catch (IOException e) {
+ throw new ProcessingException("line=" + Arrays.asList(row));
+ }
+ finally {
+ if (closeWriter) {
+ try {
+ writer.close();
+ }
+ catch (Exception e) {
+ }
+ }
+ }
+ }
+
+ private Format getColumnFormat(int colIndex) {
+ if (colIndex < m_colFormat.size()) {
+ return m_colFormat.get(colIndex);
+ }
+ else {
+ return null;
+ }
+ }
+
+ private ArrayList<String> importRow(Reader reader) throws IOException {
+ ArrayList<String> cellList = new ArrayList<String>(Math.max(m_colCount, 2));
+ boolean inString = false;
+ StringBuffer curBuf = new StringBuffer();
+ String token;
+ int ch = reader.read();
+
+ while (ch == '\n' || ch == '\r') {
+ ch = reader.read();
+ }
+ if (ch < 0) {
+ return null;
+ }
+ while (true) {
+ if (ch >= 0 && inString) {
+ if (ch == m_textDelimiterChar) {
+ inString = false;
+ }
+ else {
+ // still in string
+ }
+ curBuf.append((char) ch);
+ }
+ else {// ch<0 or out of string or end of line
+ if (ch == m_separatorChar || ch < 0 || ch == '\n' || ch == '\r') {
+ // consume token
+ token = curBuf.toString();
+ curBuf.setLength(0);
+ int tokenLen = token.length();
+ if (tokenLen > 0) {
+ // remove delimiters
+ if (token.charAt(0) == m_textDelimiterChar && token.charAt(tokenLen - 1) == m_textDelimiterChar) {
+ token = token.substring(1, tokenLen - 1);
+ }
+ if (token.length() == 0) {
+ token = null;
+ }
+ }
+ else {
+ token = null;
+ }
+ // decode and add token
+ token = decodeText(token);
+ cellList.add(token);
+ // check if end of current line
+ if (ch < 0 || ch == '\n' || ch == '\r') {
+ break;
+ }
+ }
+ else if (ch == m_textDelimiterChar) {
+ inString = true;
+ curBuf.append((char) ch);
+ }
+ else {
+ // normal character
+ curBuf.append((char) ch);
+ }
+ }
+ // next character
+ ch = reader.read();
+ }
+ // end of file?
+ if (cellList.size() == 0 && ch < 0) {
+ cellList = null;
+ }
+ return cellList;
+ }
+
+ private String exportRow(Collection<String> strings) {
+ StringBuffer buf = new StringBuffer();
+ if (strings != null) {
+ for (Iterator<String> it = strings.iterator(); it.hasNext();) {
+ buf.append(encodeText(it.next()));
+ if (it.hasNext()) {
+ if (m_separatorChar != 0x00) {
+ buf.append(m_separatorChar);
+ }
+ }
+ }
+ }
+ return buf.toString();
+ }
+
+ private Object importCell(String text, Format f) throws ProcessingException {
+ if (text != null && f != null) {
+ try {
+ text = text.trim();
+ return f.parseObject(text);
+ }
+ catch (ParseException e) {
+ throw new ProcessingException("text=" + text + " format=" + f);
+ }
+ }
+ else {
+ return text;
+ }
+ }
+
+ private String exportCell(Object o, Format f) {
+ if (f != null && o != null) {
+ return f.format(o);
+ }
+ else if (o == null) {
+ return "";
+ }
+ else {
+ return o.toString();
+ }
+ }
+
+ private String encodeText(String text) {
+ if (m_textDelimiterChar != 0x00) {
+ if (text != null) {
+ text = stringReplace(text, "" + m_textDelimiterChar, "" + m_textDelimiterChar + m_textDelimiterChar);
+ if (text.indexOf(m_separatorChar) >= 0 || text.indexOf(m_textDelimiterChar) >= 0) {
+ text = m_textDelimiterChar + text + m_textDelimiterChar;
+ }
+ }
+ }
+ return text;
+ }
+
+ private String decodeText(String text) {
+ if (text != null && text.length() > 0) {
+ if (m_textDelimiterChar != 0x00) {
+ if (text.charAt(0) == m_textDelimiterChar && text.charAt(text.length() - 1) == m_textDelimiterChar) {
+ text = text.substring(1, text.length() - 1);
+ }
+ text = stringReplace(text, "" + m_textDelimiterChar + m_textDelimiterChar, "" + m_textDelimiterChar);
+ }
+ }
+ return text;
+ }
+
+ private String stringReplace(String s, String sOld, String sNew) {
+ sNew = (sNew == null ? "" : sNew);
+ if (s == null || sOld == null) {
+ return s;
+ }
+ StringBuffer buf = new StringBuffer();
+ int oldLen = sOld.length();
+ int pos = 0;
+ int i = s.indexOf(sOld);
+ while (i >= 0) {
+ buf.append(s.substring(pos, i));
+ buf.append(sNew);
+ pos = i + oldLen;
+ i = s.indexOf(sOld, pos);
+ }
+ buf.append(s.substring(pos));
+ return buf.toString();
+ }
+
+ /**
+ * @param file
+ * @return the the first line of the file, expecting it to be the column names
+ * @throws ProcessingException
+ * Read only
+ */
+ public List<String> getColumnNames(File f) throws ProcessingException {
+ Reader r = null;
+ try {
+ r = new FileReader(f);
+ List<String> result = getCurrentRow(r);
+ return result;
+ }
+ catch (IOException e) {
+ throw new ProcessingException(e.getMessage(), e);
+ }
+ finally {
+ if (r != null) {
+ try {
+ r.close();
+ }
+ catch (Throwable t) {
+ }
+ }
+ }
+ }
+
+ /**
+ * @param reader
+ * @return the current row in the reader as cell tokens based on this helpers
+ * context
+ * @throws ProcessingException
+ */
+ public List<String> getCurrentRow(Reader reader) throws ProcessingException {
+ BufferedReader bufferedReader = null;
+ try {
+ bufferedReader = new BufferedReader(reader);
+ return importRow(bufferedReader);
+ }
+ catch (Exception e) {
+ throw new ProcessingException("reading header row");
+ }
+ finally {
+ if (bufferedReader != null) {
+ try {
+ bufferedReader.close();
+ }
+ catch (Exception e) {
+ }
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/csv/IDataConsumer.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/csv/IDataConsumer.java
index 137f93d677..6854be929c 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/csv/IDataConsumer.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/csv/IDataConsumer.java
@@ -1,19 +1,19 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.csv;
-
-import java.util.List;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-
-public interface IDataConsumer {
- void processRow(int lineNr, List<Object> row) throws ProcessingException;
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.csv;
+
+import java.util.List;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+
+public interface IDataConsumer {
+ void processRow(int lineNr, List<Object> row) throws ProcessingException;
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/dnd/FileListTransferObject.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/dnd/FileListTransferObject.java
index 5fae4b5ef0..114071d636 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/dnd/FileListTransferObject.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/dnd/FileListTransferObject.java
@@ -1,73 +1,73 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.dnd;
-
-import java.io.File;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-
-/**
- * @since Build 202
- */
-
-public class FileListTransferObject extends TransferObject {
- private File[] m_files;
-
- public FileListTransferObject(File... files) {
- if (files == null) {
- m_files = new File[0];
- }
- else {
- m_files = files;
- }
- }
-
- public FileListTransferObject(Collection<File> files) {
- if (files == null) {
- m_files = new File[0];
- }
- else {
- m_files = files.toArray(new File[0]);
- }
- }
-
- @Override
- public boolean isFileList() {
- return true;
- }
-
- public File[] getFiles() {
- return m_files;
- }
-
- public List<File> getFileList() {
- return Arrays.asList(m_files);
- }
-
- public String[] getFilenames() {
- return getFilenameList();
- }
-
- public String[] getFilenameList() {
- String[] list = new String[m_files.length];
- for (int i = 0; i < m_files.length; i++) {
- list[i] = m_files[i].getAbsolutePath();
- }
- return list;
- }
-
- @Override
- public String toString() {
- return "FileListTransferObject[files=" + Arrays.toString(m_files) + "]";
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.dnd;
+
+import java.io.File;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * @since Build 202
+ */
+
+public class FileListTransferObject extends TransferObject {
+ private File[] m_files;
+
+ public FileListTransferObject(File... files) {
+ if (files == null) {
+ m_files = new File[0];
+ }
+ else {
+ m_files = files;
+ }
+ }
+
+ public FileListTransferObject(Collection<File> files) {
+ if (files == null) {
+ m_files = new File[0];
+ }
+ else {
+ m_files = files.toArray(new File[0]);
+ }
+ }
+
+ @Override
+ public boolean isFileList() {
+ return true;
+ }
+
+ public File[] getFiles() {
+ return m_files;
+ }
+
+ public List<File> getFileList() {
+ return Arrays.asList(m_files);
+ }
+
+ public String[] getFilenames() {
+ return getFilenameList();
+ }
+
+ public String[] getFilenameList() {
+ String[] list = new String[m_files.length];
+ for (int i = 0; i < m_files.length; i++) {
+ list[i] = m_files[i].getAbsolutePath();
+ }
+ return list;
+ }
+
+ @Override
+ public String toString() {
+ return "FileListTransferObject[files=" + Arrays.toString(m_files) + "]";
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/dnd/ImageTransferObject.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/dnd/ImageTransferObject.java
index 6f4312a960..52e0a09908 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/dnd/ImageTransferObject.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/dnd/ImageTransferObject.java
@@ -1,38 +1,38 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.dnd;
-
-/**
- * @since Build 202
- */
-
-public class ImageTransferObject extends TransferObject {
- private Object m_img;
-
- public ImageTransferObject(Object img) {
- m_img = img;
- }
-
- @Override
- public boolean isImage() {
- return true;
- }
-
- public Object getImage() {
- return m_img;
- }
-
- @Override
- public String toString() {
- return "ImageTransferObject[image=" + m_img + "]";
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.dnd;
+
+/**
+ * @since Build 202
+ */
+
+public class ImageTransferObject extends TransferObject {
+ private Object m_img;
+
+ public ImageTransferObject(Object img) {
+ m_img = img;
+ }
+
+ @Override
+ public boolean isImage() {
+ return true;
+ }
+
+ public Object getImage() {
+ return m_img;
+ }
+
+ @Override
+ public String toString() {
+ return "ImageTransferObject[image=" + m_img + "]";
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/dnd/JavaTransferObject.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/dnd/JavaTransferObject.java
index 922dd7e657..b4b0647362 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/dnd/JavaTransferObject.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/dnd/JavaTransferObject.java
@@ -1,37 +1,37 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.dnd;
-
-/**
- * @since Build 202
- */
-
-public class JavaTransferObject extends TransferObject {
- private Object m_localObject;
-
- public JavaTransferObject(Object bean) {
- m_localObject = bean;
- }
-
- @Override
- public boolean isLocalObject() {
- return true;
- }
-
- public Object getLocalObject() {
- return m_localObject;
- }
-
- @Override
- public String toString() {
- return "JavaTransferObject[localObject=" + m_localObject + "]";
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.dnd;
+
+/**
+ * @since Build 202
+ */
+
+public class JavaTransferObject extends TransferObject {
+ private Object m_localObject;
+
+ public JavaTransferObject(Object bean) {
+ m_localObject = bean;
+ }
+
+ @Override
+ public boolean isLocalObject() {
+ return true;
+ }
+
+ public Object getLocalObject() {
+ return m_localObject;
+ }
+
+ @Override
+ public String toString() {
+ return "JavaTransferObject[localObject=" + m_localObject + "]";
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/dnd/TextTransferObject.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/dnd/TextTransferObject.java
index 67388fdc0b..08f9569e6a 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/dnd/TextTransferObject.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/dnd/TextTransferObject.java
@@ -1,56 +1,56 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.dnd;
-
-/**
- * @since Build 202
- */
-
-public class TextTransferObject extends TransferObject {
- private String m_plainText;
- private String m_htmlText;
-
- public TextTransferObject(String plainText) {
- this(plainText, null);
- }
-
- public TextTransferObject(String plainText, String htmlText) {
- m_plainText = plainText;
- m_htmlText = htmlText;
- }
-
- @Override
- public boolean isText() {
- return true;
- }
-
- /**
- * @deprecated use {@link TextTransferObject#getPlainText()}. Will be removed in release 3.8.0
- * @return
- */
- @Deprecated
- public String getText() {
- return getPlainText();
- }
-
- public String getPlainText() {
- return m_plainText;
- }
-
- public String getHtmlText() {
- return m_htmlText;
- }
-
- @Override
- public String toString() {
- return "TextTransferObject[text=" + m_plainText + ";html=" + m_htmlText + "]";
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.dnd;
+
+/**
+ * @since Build 202
+ */
+
+public class TextTransferObject extends TransferObject {
+ private String m_plainText;
+ private String m_htmlText;
+
+ public TextTransferObject(String plainText) {
+ this(plainText, null);
+ }
+
+ public TextTransferObject(String plainText, String htmlText) {
+ m_plainText = plainText;
+ m_htmlText = htmlText;
+ }
+
+ @Override
+ public boolean isText() {
+ return true;
+ }
+
+ /**
+ * @deprecated use {@link TextTransferObject#getPlainText()}. Will be removed in release 3.8.0
+ * @return
+ */
+ @Deprecated
+ public String getText() {
+ return getPlainText();
+ }
+
+ public String getPlainText() {
+ return m_plainText;
+ }
+
+ public String getHtmlText() {
+ return m_htmlText;
+ }
+
+ @Override
+ public String toString() {
+ return "TextTransferObject[text=" + m_plainText + ";html=" + m_htmlText + "]";
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/dnd/TransferObject.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/dnd/TransferObject.java
index 120da66fb5..2aed1c9c3c 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/dnd/TransferObject.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/dnd/TransferObject.java
@@ -1,44 +1,44 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.dnd;
-
-/**
- * This is the super class of a transfer object model, normally this type is not used directly but any subtype of it.
- */
-public class TransferObject {
-
- private String m_mimeType;
-
- public String getMimeType() {
- return m_mimeType;
- }
-
- public void setMimeType(String mimeType) {
- m_mimeType = mimeType;
- }
-
- public boolean isText() {
- return false;
- }
-
- public boolean isFileList() {
- return false;
- }
-
- public boolean isImage() {
- return false;
- }
-
- public boolean isLocalObject() {
- return false;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.dnd;
+
+/**
+ * This is the super class of a transfer object model, normally this type is not used directly but any subtype of it.
+ */
+public class TransferObject {
+
+ private String m_mimeType;
+
+ public String getMimeType() {
+ return m_mimeType;
+ }
+
+ public void setMimeType(String mimeType) {
+ m_mimeType = mimeType;
+ }
+
+ public boolean isText() {
+ return false;
+ }
+
+ public boolean isFileList() {
+ return false;
+ }
+
+ public boolean isImage() {
+ return false;
+ }
+
+ public boolean isLocalObject() {
+ return false;
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/dnd/TransferObjectRequest.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/dnd/TransferObjectRequest.java
index 24e051d160..266d1744b7 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/dnd/TransferObjectRequest.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/dnd/TransferObjectRequest.java
@@ -1,34 +1,34 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.dnd;
-
-public class TransferObjectRequest {
-
- private final Class<? extends TransferObject> m_transferObjectType;
- private final String m_mimeType;
-
- public TransferObjectRequest(Class<? extends TransferObject> objectType) {
- this(objectType, null);
- }
-
- public TransferObjectRequest(Class<? extends TransferObject> objectType, String type) {
- m_transferObjectType = objectType;
- m_mimeType = type;
- }
-
- public Class<? extends TransferObject> getTransferObjectType() {
- return m_transferObjectType;
- }
-
- public String getMimeType() {
- return m_mimeType;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.dnd;
+
+public class TransferObjectRequest {
+
+ private final Class<? extends TransferObject> m_transferObjectType;
+ private final String m_mimeType;
+
+ public TransferObjectRequest(Class<? extends TransferObject> objectType) {
+ this(objectType, null);
+ }
+
+ public TransferObjectRequest(Class<? extends TransferObject> objectType, String type) {
+ m_transferObjectType = objectType;
+ m_mimeType = type;
+ }
+
+ public Class<? extends TransferObject> getTransferObjectType() {
+ return m_transferObjectType;
+ }
+
+ public String getMimeType() {
+ return m_mimeType;
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/eventlistprofiler/EventListenerProfiler.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/eventlistprofiler/EventListenerProfiler.java
index 862db77f12..ed14c9c6a1 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/eventlistprofiler/EventListenerProfiler.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/eventlistprofiler/EventListenerProfiler.java
@@ -1,116 +1,116 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.eventlistprofiler;
-
-import java.io.OutputStream;
-import java.io.PrintWriter;
-import java.lang.ref.WeakReference;
-import java.text.NumberFormat;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.scout.commons.LocaleThreadLocal;
-
-/**
- * This class is Thread safe
- */
-public final class EventListenerProfiler {
-
- private static EventListenerProfiler instance = new EventListenerProfiler();
-
- public static EventListenerProfiler getInstance() {
- return instance;
- }
-
- private boolean m_enabled = false;
- private Object m_sourcesLock = new Object();
- private List<WeakReference<IEventListenerSource>> m_sources = new ArrayList<WeakReference<IEventListenerSource>>();
-
- private EventListenerProfiler() {
- m_sourcesLock = new Object();
- m_sources = new ArrayList<WeakReference<IEventListenerSource>>();
- }
-
- public boolean isEnabled() {
- return m_enabled;
- }
-
- public void setEnabled(boolean enabled) {
- m_enabled = enabled;
- }
-
- /**
- * Add a weak reference to a source provider NOTE: the passed argument MUST be
- * referenced by the source type, otherwise it is garbage collected
- * immediately after adding
- */
- public void registerSourceAsWeakReference(IEventListenerSource source) {
- if (!m_enabled) {
- return;
- }
- synchronized (m_sourcesLock) {
- m_sources.add(new WeakReference<IEventListenerSource>(source));
- }
- }
-
- public void dump() {
- dump(System.out);
- }
-
- public void dump(OutputStream o) {
- /**
- * this call to gc is intended
- */
- System.gc();
- PrintWriter out = new PrintWriter(o, true);
- if (!m_enabled) {
- return;
- }
- try {
- EventListenerSnapshot snapshot = new EventListenerSnapshot();
- synchronized (m_sourcesLock) {
- manageNoLock();
- NumberFormat fmt = NumberFormat.getIntegerInstance(LocaleThreadLocal.get());
- out.println("Max memory: " + fmt.format(Runtime.getRuntime().maxMemory()));
- out.println("Total memory: " + fmt.format(Runtime.getRuntime().totalMemory()));
- out.println("Free memory: " + fmt.format(Runtime.getRuntime().freeMemory()));
- out.println("(Used memory):" + fmt.format(Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()));
- out.println();
- for (WeakReference<IEventListenerSource> ref : m_sources) {
- IEventListenerSource p = ref.get();
- if (p != null) {
- p.dumpListenerList(snapshot);
- }
- }
- }
- snapshot.dump(out);
- }
- catch (Throwable t) {
- t.printStackTrace();
- }
- finally {
- if (o != System.out) {
- out.close();
- }
- }
- }
-
- private void manageNoLock() {
- for (Iterator<WeakReference<IEventListenerSource>> it = m_sources.iterator(); it.hasNext();) {
- WeakReference<IEventListenerSource> ref = it.next();
- if (ref.get() == null) {
- it.remove();
- }
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.eventlistprofiler;
+
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.lang.ref.WeakReference;
+import java.text.NumberFormat;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.scout.commons.LocaleThreadLocal;
+
+/**
+ * This class is Thread safe
+ */
+public final class EventListenerProfiler {
+
+ private static EventListenerProfiler instance = new EventListenerProfiler();
+
+ public static EventListenerProfiler getInstance() {
+ return instance;
+ }
+
+ private boolean m_enabled = false;
+ private Object m_sourcesLock = new Object();
+ private List<WeakReference<IEventListenerSource>> m_sources = new ArrayList<WeakReference<IEventListenerSource>>();
+
+ private EventListenerProfiler() {
+ m_sourcesLock = new Object();
+ m_sources = new ArrayList<WeakReference<IEventListenerSource>>();
+ }
+
+ public boolean isEnabled() {
+ return m_enabled;
+ }
+
+ public void setEnabled(boolean enabled) {
+ m_enabled = enabled;
+ }
+
+ /**
+ * Add a weak reference to a source provider NOTE: the passed argument MUST be
+ * referenced by the source type, otherwise it is garbage collected
+ * immediately after adding
+ */
+ public void registerSourceAsWeakReference(IEventListenerSource source) {
+ if (!m_enabled) {
+ return;
+ }
+ synchronized (m_sourcesLock) {
+ m_sources.add(new WeakReference<IEventListenerSource>(source));
+ }
+ }
+
+ public void dump() {
+ dump(System.out);
+ }
+
+ public void dump(OutputStream o) {
+ /**
+ * this call to gc is intended
+ */
+ System.gc();
+ PrintWriter out = new PrintWriter(o, true);
+ if (!m_enabled) {
+ return;
+ }
+ try {
+ EventListenerSnapshot snapshot = new EventListenerSnapshot();
+ synchronized (m_sourcesLock) {
+ manageNoLock();
+ NumberFormat fmt = NumberFormat.getIntegerInstance(LocaleThreadLocal.get());
+ out.println("Max memory: " + fmt.format(Runtime.getRuntime().maxMemory()));
+ out.println("Total memory: " + fmt.format(Runtime.getRuntime().totalMemory()));
+ out.println("Free memory: " + fmt.format(Runtime.getRuntime().freeMemory()));
+ out.println("(Used memory):" + fmt.format(Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()));
+ out.println();
+ for (WeakReference<IEventListenerSource> ref : m_sources) {
+ IEventListenerSource p = ref.get();
+ if (p != null) {
+ p.dumpListenerList(snapshot);
+ }
+ }
+ }
+ snapshot.dump(out);
+ }
+ catch (Throwable t) {
+ t.printStackTrace();
+ }
+ finally {
+ if (o != System.out) {
+ out.close();
+ }
+ }
+ }
+
+ private void manageNoLock() {
+ for (Iterator<WeakReference<IEventListenerSource>> it = m_sources.iterator(); it.hasNext();) {
+ WeakReference<IEventListenerSource> ref = it.next();
+ if (ref.get() == null) {
+ it.remove();
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/eventlistprofiler/EventListenerSnapshot.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/eventlistprofiler/EventListenerSnapshot.java
index fd9f440b4d..03a63668c7 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/eventlistprofiler/EventListenerSnapshot.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/eventlistprofiler/EventListenerSnapshot.java
@@ -1,67 +1,67 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.eventlistprofiler;
-
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.TreeMap;
-
-public class EventListenerSnapshot implements IEventListenerSnapshot {
- private HashMap<String/* listenerType,context */, List<Object/* listeners */>> m_map;
-
- public EventListenerSnapshot() {
- m_map = new HashMap<String, List<Object>>();
- }
-
- @Override
- public void add(Class<?> listenerType, String context, Object listener) {
- if (listener == null) {
- return;
- }
- String key = listenerType.getName();
- if (context != null) {
- key += "#" + context;
- }
- List<Object> list = m_map.get(key);
- if (list == null) {
- list = new ArrayList<Object>();
- m_map.put(key, list);
- }
- list.add(listener);
- }
-
- public void dump(PrintWriter out) {
- out.println("DUMP AT " + new Date());
- for (Map.Entry<String, List<Object>> e : m_map.entrySet()) {
- String key = e.getKey();
- List<Object> list = e.getValue();
- out.println("TYPE " + key + " " + list.size());
- TreeMap<String, Integer> types = new TreeMap<String, Integer>();
- for (Object listener : list) {
- String c = listener.getClass().getName();
- Integer i = types.get(c);
- if (i == null) {
- i = 0;
- }
- types.put(c, i + 1);
- }
- for (Map.Entry<String, Integer> entry : types.entrySet()) {
- out.println(" " + entry.getKey() + ": " + entry.getValue());
- }
- }
- out.println();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.eventlistprofiler;
+
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+
+public class EventListenerSnapshot implements IEventListenerSnapshot {
+ private HashMap<String/* listenerType,context */, List<Object/* listeners */>> m_map;
+
+ public EventListenerSnapshot() {
+ m_map = new HashMap<String, List<Object>>();
+ }
+
+ @Override
+ public void add(Class<?> listenerType, String context, Object listener) {
+ if (listener == null) {
+ return;
+ }
+ String key = listenerType.getName();
+ if (context != null) {
+ key += "#" + context;
+ }
+ List<Object> list = m_map.get(key);
+ if (list == null) {
+ list = new ArrayList<Object>();
+ m_map.put(key, list);
+ }
+ list.add(listener);
+ }
+
+ public void dump(PrintWriter out) {
+ out.println("DUMP AT " + new Date());
+ for (Map.Entry<String, List<Object>> e : m_map.entrySet()) {
+ String key = e.getKey();
+ List<Object> list = e.getValue();
+ out.println("TYPE " + key + " " + list.size());
+ TreeMap<String, Integer> types = new TreeMap<String, Integer>();
+ for (Object listener : list) {
+ String c = listener.getClass().getName();
+ Integer i = types.get(c);
+ if (i == null) {
+ i = 0;
+ }
+ types.put(c, i + 1);
+ }
+ for (Map.Entry<String, Integer> entry : types.entrySet()) {
+ out.println(" " + entry.getKey() + ": " + entry.getValue());
+ }
+ }
+ out.println();
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/eventlistprofiler/IEventListenerSnapshot.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/eventlistprofiler/IEventListenerSnapshot.java
index 3c102380bc..d662163c5d 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/eventlistprofiler/IEventListenerSnapshot.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/eventlistprofiler/IEventListenerSnapshot.java
@@ -1,17 +1,17 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.eventlistprofiler;
-
-public interface IEventListenerSnapshot {
-
- void add(Class<?> listenerType, String context, Object listener);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.eventlistprofiler;
+
+public interface IEventListenerSnapshot {
+
+ void add(Class<?> listenerType, String context, Object listener);
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/eventlistprofiler/IEventListenerSource.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/eventlistprofiler/IEventListenerSource.java
index befbabc4a7..751df1b27f 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/eventlistprofiler/IEventListenerSource.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/eventlistprofiler/IEventListenerSource.java
@@ -1,17 +1,17 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.eventlistprofiler;
-
-public interface IEventListenerSource {
-
- void dumpListenerList(IEventListenerSnapshot snapshot);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.eventlistprofiler;
+
+public interface IEventListenerSource {
+
+ void dumpListenerList(IEventListenerSnapshot snapshot);
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/exception/IProcessingStatus.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/exception/IProcessingStatus.java
index d1d54c0718..d56866da0f 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/exception/IProcessingStatus.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/exception/IProcessingStatus.java
@@ -1,35 +1,35 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.exception;
-
-import org.eclipse.core.runtime.IStatus;
-
-public interface IProcessingStatus extends IStatus {
-
- int FATAL = 0x10;
-
- /**
- * alias for {@link #getException()}
- */
- Throwable getCause();
-
- String getTitle();
-
- /**
- * Returns a list of context informations that were collected while the
- * exception was travelling from its origin to the handler
- *
- * @return a list of localized contect messages
- */
- String[] getContextMessages();
-
- void addContextMessage(String message);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.exception;
+
+import org.eclipse.core.runtime.IStatus;
+
+public interface IProcessingStatus extends IStatus {
+
+ int FATAL = 0x10;
+
+ /**
+ * alias for {@link #getException()}
+ */
+ Throwable getCause();
+
+ String getTitle();
+
+ /**
+ * Returns a list of context informations that were collected while the
+ * exception was travelling from its origin to the handler
+ *
+ * @return a list of localized contect messages
+ */
+ String[] getContextMessages();
+
+ void addContextMessage(String message);
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/exception/PlaceholderException.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/exception/PlaceholderException.java
index ae3cea48ad..dfcd04daed 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/exception/PlaceholderException.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/exception/PlaceholderException.java
@@ -1,181 +1,181 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.exception;
-
-import java.lang.reflect.Constructor;
-import java.util.ArrayList;
-
-/**
- * This exception class is used as place holder for exceptions that are most
- * likely not known by external callers. The class carries the common exception
- * properties as well as the original exception's fully qualified class name.
- * The stack trace of this class looks exactly the same as the stack trace of
- * the replaced exception.
- */
-public class PlaceholderException extends Exception {
- private static final long serialVersionUID = 1L;
-
- private final String m_origThrowableClassName;
-
- public PlaceholderException(Throwable t, Throwable cause) {
- super(t.getMessage(), cause);
- setStackTrace(t.getStackTrace());
- m_origThrowableClassName = t.getClass().getName();
- }
-
- @Override
- public String toString() {
- String s = m_origThrowableClassName;
- String message = getLocalizedMessage();
- return (message != null) ? (s + ": " + message) : s;
- }
-
- public String getOrigThrowableClassName() {
- return m_origThrowableClassName;
- }
-
- /**
- * Transforms the given throwable and its recursively referenced throwables
- * into a new exception hierarchy. Exceptions that are most likely not known
- * by an external calling party are replaced by a {@link PlaceholderException} object:
- * <ul>
- * <li>{@link ProcessingException} are mapped to itself if possible, otherwise to a {@link ProcessingException}</li>
- * <li>Exceptions in package <code>java.*</code> are mapped to itself if possible, otherwise to a
- * {@link PlaceholderException}</li>
- * <li>All other exceptions are transformed to {@link PlaceholderException}</li>
- * </ul>
- *
- * @param t
- * @return
- */
- public static Throwable transformException(Throwable t) {
- // first, go to exception stack and reverse it
- ArrayList<Throwable> throwableStack = new ArrayList<Throwable>();
- while (t != null) {
- throwableStack.add(0, t);
- t = t.getCause();
- }
-
- // second, transform each exception so that they do not use probably
- // proprietary exception classes
- Throwable cause = null;
- for (Throwable throwable : throwableStack) {
- Throwable transformedThrowable = null;
-
- if (throwable instanceof ProcessingException) {
- ProcessingException pe = null;
- IProcessingStatus oldStatus = ((ProcessingException) throwable).getStatus();
- ProcessingStatus newStatus = (oldStatus instanceof ProcessingStatus ? (ProcessingStatus) oldStatus : new ProcessingStatus(oldStatus));
- newStatus.setException(cause);
- try {
- pe = (ProcessingException) transformWellKnownException(throwable, cause, newStatus);
- }
- catch (Throwable fatal) {
- // nop
- }
- if (pe == null) {
- pe = new ProcessingException();
- }
- pe.setStatus(newStatus);
- transformedThrowable = pe;
- }
- else if (throwable.getClass().getPackage() != null && throwable.getClass().getPackage().getName().startsWith("java.")) {
- transformedThrowable = transformWellKnownException(throwable, cause, null);
- }
-
- if (transformedThrowable == null) {
- transformedThrowable = new PlaceholderException(throwable, cause);
- }
-
- transformedThrowable.setStackTrace(throwable.getStackTrace());
- cause = transformedThrowable;
- }
- return cause;
- }
-
- /**
- * Creates a new instance of the given throwable using the given cause. The {@link IProcessingStatus} of the given
- * throwable is preserved if the given
- * throwable is a {@link ProcessingException}.
- *
- * @param throwable
- * @param cause
- * @param processingStatus
- * @return
- */
- private static Throwable transformWellKnownException(Throwable throwable, Throwable cause, IProcessingStatus processingStatus) {
- Class<? extends Throwable> clazz = throwable.getClass();
- Throwable transformedThrowable = null;
-
- if (throwable instanceof ProcessingException) {
- // 0. IProcessingStatus
- try {
- Constructor<? extends Throwable> ctor = clazz.getConstructor(IProcessingStatus.class);
- if (ctor != null) {
- transformedThrowable = ctor.newInstance(processingStatus);
- }
- }
- catch (Exception e) {
- // nop
- }
- }
-
- // 1. String, Throwable constructor
- if (transformedThrowable == null) {
- try {
- Constructor<? extends Throwable> ctor = clazz.getConstructor(String.class, Throwable.class);
- if (ctor != null) {
- transformedThrowable = ctor.newInstance(throwable.getMessage(), cause);
- }
- }
- catch (Exception e) {
- // nop
- }
- }
-
- // 2. String constructor
- if (transformedThrowable == null && cause == null) {
- try {
- Constructor<? extends Throwable> ctor = clazz.getConstructor(String.class);
- if (ctor != null) {
- transformedThrowable = ctor.newInstance(throwable.getMessage());
- }
- }
- catch (Exception e) {
- // nop
- }
- }
-
- // 3. Cause constructor
- if (transformedThrowable == null && throwable.getMessage() == null) {
- try {
- Constructor<? extends Throwable> ctor = clazz.getConstructor(Throwable.class);
- if (ctor != null) {
- transformedThrowable = ctor.newInstance(cause);
- }
- }
- catch (Exception e) {
- // nop
- }
- }
-
- // 4. default constructor
- if (transformedThrowable == null && cause == null) {
- try {
- transformedThrowable = clazz.newInstance();
- }
- catch (Exception e) {
- // nop
- }
- }
- return transformedThrowable;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.exception;
+
+import java.lang.reflect.Constructor;
+import java.util.ArrayList;
+
+/**
+ * This exception class is used as place holder for exceptions that are most
+ * likely not known by external callers. The class carries the common exception
+ * properties as well as the original exception's fully qualified class name.
+ * The stack trace of this class looks exactly the same as the stack trace of
+ * the replaced exception.
+ */
+public class PlaceholderException extends Exception {
+ private static final long serialVersionUID = 1L;
+
+ private final String m_origThrowableClassName;
+
+ public PlaceholderException(Throwable t, Throwable cause) {
+ super(t.getMessage(), cause);
+ setStackTrace(t.getStackTrace());
+ m_origThrowableClassName = t.getClass().getName();
+ }
+
+ @Override
+ public String toString() {
+ String s = m_origThrowableClassName;
+ String message = getLocalizedMessage();
+ return (message != null) ? (s + ": " + message) : s;
+ }
+
+ public String getOrigThrowableClassName() {
+ return m_origThrowableClassName;
+ }
+
+ /**
+ * Transforms the given throwable and its recursively referenced throwables
+ * into a new exception hierarchy. Exceptions that are most likely not known
+ * by an external calling party are replaced by a {@link PlaceholderException} object:
+ * <ul>
+ * <li>{@link ProcessingException} are mapped to itself if possible, otherwise to a {@link ProcessingException}</li>
+ * <li>Exceptions in package <code>java.*</code> are mapped to itself if possible, otherwise to a
+ * {@link PlaceholderException}</li>
+ * <li>All other exceptions are transformed to {@link PlaceholderException}</li>
+ * </ul>
+ *
+ * @param t
+ * @return
+ */
+ public static Throwable transformException(Throwable t) {
+ // first, go to exception stack and reverse it
+ ArrayList<Throwable> throwableStack = new ArrayList<Throwable>();
+ while (t != null) {
+ throwableStack.add(0, t);
+ t = t.getCause();
+ }
+
+ // second, transform each exception so that they do not use probably
+ // proprietary exception classes
+ Throwable cause = null;
+ for (Throwable throwable : throwableStack) {
+ Throwable transformedThrowable = null;
+
+ if (throwable instanceof ProcessingException) {
+ ProcessingException pe = null;
+ IProcessingStatus oldStatus = ((ProcessingException) throwable).getStatus();
+ ProcessingStatus newStatus = (oldStatus instanceof ProcessingStatus ? (ProcessingStatus) oldStatus : new ProcessingStatus(oldStatus));
+ newStatus.setException(cause);
+ try {
+ pe = (ProcessingException) transformWellKnownException(throwable, cause, newStatus);
+ }
+ catch (Throwable fatal) {
+ // nop
+ }
+ if (pe == null) {
+ pe = new ProcessingException();
+ }
+ pe.setStatus(newStatus);
+ transformedThrowable = pe;
+ }
+ else if (throwable.getClass().getPackage() != null && throwable.getClass().getPackage().getName().startsWith("java.")) {
+ transformedThrowable = transformWellKnownException(throwable, cause, null);
+ }
+
+ if (transformedThrowable == null) {
+ transformedThrowable = new PlaceholderException(throwable, cause);
+ }
+
+ transformedThrowable.setStackTrace(throwable.getStackTrace());
+ cause = transformedThrowable;
+ }
+ return cause;
+ }
+
+ /**
+ * Creates a new instance of the given throwable using the given cause. The {@link IProcessingStatus} of the given
+ * throwable is preserved if the given
+ * throwable is a {@link ProcessingException}.
+ *
+ * @param throwable
+ * @param cause
+ * @param processingStatus
+ * @return
+ */
+ private static Throwable transformWellKnownException(Throwable throwable, Throwable cause, IProcessingStatus processingStatus) {
+ Class<? extends Throwable> clazz = throwable.getClass();
+ Throwable transformedThrowable = null;
+
+ if (throwable instanceof ProcessingException) {
+ // 0. IProcessingStatus
+ try {
+ Constructor<? extends Throwable> ctor = clazz.getConstructor(IProcessingStatus.class);
+ if (ctor != null) {
+ transformedThrowable = ctor.newInstance(processingStatus);
+ }
+ }
+ catch (Exception e) {
+ // nop
+ }
+ }
+
+ // 1. String, Throwable constructor
+ if (transformedThrowable == null) {
+ try {
+ Constructor<? extends Throwable> ctor = clazz.getConstructor(String.class, Throwable.class);
+ if (ctor != null) {
+ transformedThrowable = ctor.newInstance(throwable.getMessage(), cause);
+ }
+ }
+ catch (Exception e) {
+ // nop
+ }
+ }
+
+ // 2. String constructor
+ if (transformedThrowable == null && cause == null) {
+ try {
+ Constructor<? extends Throwable> ctor = clazz.getConstructor(String.class);
+ if (ctor != null) {
+ transformedThrowable = ctor.newInstance(throwable.getMessage());
+ }
+ }
+ catch (Exception e) {
+ // nop
+ }
+ }
+
+ // 3. Cause constructor
+ if (transformedThrowable == null && throwable.getMessage() == null) {
+ try {
+ Constructor<? extends Throwable> ctor = clazz.getConstructor(Throwable.class);
+ if (ctor != null) {
+ transformedThrowable = ctor.newInstance(cause);
+ }
+ }
+ catch (Exception e) {
+ // nop
+ }
+ }
+
+ // 4. default constructor
+ if (transformedThrowable == null && cause == null) {
+ try {
+ transformedThrowable = clazz.newInstance();
+ }
+ catch (Exception e) {
+ // nop
+ }
+ }
+ return transformedThrowable;
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/exception/ProcessingException.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/exception/ProcessingException.java
index 121637821d..7e792054c1 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/exception/ProcessingException.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/exception/ProcessingException.java
@@ -1,118 +1,118 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.exception;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Arrays;
-
-import org.eclipse.core.runtime.IStatus;
-
-/**
- * This class is the core exception in scout do not change interface contract
- * since this class is serializable and used in different build versions This
- * class is a conceptual copy of {@link org.eclipse.core.runtime.Status} that
- * also can run in J2EE.
- */
-public class ProcessingException extends Exception implements Serializable {
- private static final long serialVersionUID = 1L;
-
- private IProcessingStatus m_status;
- private transient boolean m_consumed;
-
- /**
- * Empty constructor is used to support auto-webservice publishing with java
- * bean support
- */
- public ProcessingException() {
- super("undefined", null);
- }
-
- public ProcessingException(String message) {
- this(new ProcessingStatus(null, message, null, 0, IProcessingStatus.ERROR));
- }
-
- public ProcessingException(String message, Throwable cause) {
- this(new ProcessingStatus(null, message, cause, 0, IProcessingStatus.ERROR));
- }
-
- public ProcessingException(String message, Throwable cause, int errorCode) {
- this(new ProcessingStatus(null, message, cause, errorCode, IProcessingStatus.ERROR));
- }
-
- public ProcessingException(String message, Throwable cause, int errorCode, int severity) {
- this(new ProcessingStatus(null, message, cause, errorCode, severity));
- }
-
- public ProcessingException(String title, String message) {
- this(new ProcessingStatus(title, message, null, 0, IProcessingStatus.ERROR));
- }
-
- public ProcessingException(String title, String message, Throwable cause) {
- this(new ProcessingStatus(title, message, cause, 0, IProcessingStatus.ERROR));
- }
-
- public ProcessingException(String title, String message, Throwable cause, int errorCode) {
- this(new ProcessingStatus(title, message, cause, errorCode, IProcessingStatus.ERROR));
- }
-
- public ProcessingException(String title, String message, Throwable cause, int errorCode, int severity) {
- this(new ProcessingStatus(title, message, cause, errorCode, severity));
- }
-
- public ProcessingException(IStatus status) {
- super(status.getMessage(), status.getException());
- m_status = status instanceof ProcessingStatus ? (ProcessingStatus) status : new ProcessingStatus(status);
- }
-
- public IProcessingStatus getStatus() {
- return m_status;
- }
-
- public void setStatus(IProcessingStatus status) {
- m_status = status;
- }
-
- public void addContextMessage(String s) {
- m_status.addContextMessage(s);
- }
-
- public boolean isConsumed() {
- return m_consumed;
- }
-
- public void consume() {
- m_consumed = true;
- }
-
- public boolean isInterruption() {
- return m_status != null && (m_status.getCause() instanceof InterruptedException);
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName() + "[" + m_status.toString() + "]";
- }
-
- /**
- * @return the complete stacktrace of the Throwable and all its causes
- * (recursive)
- */
- public static StackTraceElement[] unionStackTrace(Throwable t) {
- ArrayList<StackTraceElement> list = new ArrayList<StackTraceElement>();
- while (t != null) {
- list.addAll(0, Arrays.asList(t.getStackTrace()));
- t = t.getCause();
- }
- return list.toArray(new StackTraceElement[list.size()]);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.exception;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Arrays;
+
+import org.eclipse.core.runtime.IStatus;
+
+/**
+ * This class is the core exception in scout do not change interface contract
+ * since this class is serializable and used in different build versions This
+ * class is a conceptual copy of {@link org.eclipse.core.runtime.Status} that
+ * also can run in J2EE.
+ */
+public class ProcessingException extends Exception implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private IProcessingStatus m_status;
+ private transient boolean m_consumed;
+
+ /**
+ * Empty constructor is used to support auto-webservice publishing with java
+ * bean support
+ */
+ public ProcessingException() {
+ super("undefined", null);
+ }
+
+ public ProcessingException(String message) {
+ this(new ProcessingStatus(null, message, null, 0, IProcessingStatus.ERROR));
+ }
+
+ public ProcessingException(String message, Throwable cause) {
+ this(new ProcessingStatus(null, message, cause, 0, IProcessingStatus.ERROR));
+ }
+
+ public ProcessingException(String message, Throwable cause, int errorCode) {
+ this(new ProcessingStatus(null, message, cause, errorCode, IProcessingStatus.ERROR));
+ }
+
+ public ProcessingException(String message, Throwable cause, int errorCode, int severity) {
+ this(new ProcessingStatus(null, message, cause, errorCode, severity));
+ }
+
+ public ProcessingException(String title, String message) {
+ this(new ProcessingStatus(title, message, null, 0, IProcessingStatus.ERROR));
+ }
+
+ public ProcessingException(String title, String message, Throwable cause) {
+ this(new ProcessingStatus(title, message, cause, 0, IProcessingStatus.ERROR));
+ }
+
+ public ProcessingException(String title, String message, Throwable cause, int errorCode) {
+ this(new ProcessingStatus(title, message, cause, errorCode, IProcessingStatus.ERROR));
+ }
+
+ public ProcessingException(String title, String message, Throwable cause, int errorCode, int severity) {
+ this(new ProcessingStatus(title, message, cause, errorCode, severity));
+ }
+
+ public ProcessingException(IStatus status) {
+ super(status.getMessage(), status.getException());
+ m_status = status instanceof ProcessingStatus ? (ProcessingStatus) status : new ProcessingStatus(status);
+ }
+
+ public IProcessingStatus getStatus() {
+ return m_status;
+ }
+
+ public void setStatus(IProcessingStatus status) {
+ m_status = status;
+ }
+
+ public void addContextMessage(String s) {
+ m_status.addContextMessage(s);
+ }
+
+ public boolean isConsumed() {
+ return m_consumed;
+ }
+
+ public void consume() {
+ m_consumed = true;
+ }
+
+ public boolean isInterruption() {
+ return m_status != null && (m_status.getCause() instanceof InterruptedException);
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + "[" + m_status.toString() + "]";
+ }
+
+ /**
+ * @return the complete stacktrace of the Throwable and all its causes
+ * (recursive)
+ */
+ public static StackTraceElement[] unionStackTrace(Throwable t) {
+ ArrayList<StackTraceElement> list = new ArrayList<StackTraceElement>();
+ while (t != null) {
+ list.addAll(0, Arrays.asList(t.getStackTrace()));
+ t = t.getCause();
+ }
+ return list.toArray(new StackTraceElement[list.size()]);
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/exception/ProcessingStatus.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/exception/ProcessingStatus.java
index bf4d292a52..0887ec3c37 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/exception/ProcessingStatus.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/exception/ProcessingStatus.java
@@ -1,335 +1,335 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.exception;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-
-import org.eclipse.core.runtime.IStatus;
-
-/**
- * A concrete status implementation, suitable either for instantiating or
- * subclassing.
- * <p>
- * This class can be used without OSGi running.
- * </p>
- */
-public class ProcessingStatus implements IProcessingStatus, Serializable {
- private static final long serialVersionUID = 1L;
-
- private int m_severity;
-
- /**
- * Custom status code.
- */
- private int m_code;
-
- private String m_plugin = "";
-
- /**
- * Title, localized to the current locale.
- */
- private String m_title;
-
- /**
- * Message, localized to the current locale.
- */
- private String m_message = "";
-
- private ArrayList<String> m_contextMessages;
-
- /**
- * Wrapped exception, or <code>null</code> if none.
- */
- private Throwable m_cause = null;
-
- /**
- * Creates a new status object. The created status has no children.
- *
- * @param message
- * a human-readable message, localized to the current locale, is
- * never null
- * @param severity
- * the severity; one of <code>FATAL</code>, <code>ERROR</code>, <code>INFO</code>, <code>WARNING</code>
- */
- public ProcessingStatus(String message, int severity) {
- setMessage(message);
- setSeverity(severity);
- }
-
- /**
- * Creates a new status object. The created status has no children.
- *
- * @param title
- * a human-readable title, localized to the current locale, can be
- * null
- * @param message
- * a human-readable message, localized to the current locale, is
- * never null
- * @param severity
- * the severity; one of <code>FATAL</code>, <code>ERROR</code>, <code>INFO</code>, <code>WARNING</code>
- */
- public ProcessingStatus(String title, String message, int severity) {
- setTitle(title);
- setMessage(message);
- setSeverity(severity);
- }
-
- /**
- * Creates a new status object. The created status has no children.
- *
- * @param message
- * a human-readable message, localized to the current locale, is
- * never null
- * @param cause
- * a low-level exception, or <code>null</code> if not applicable
- * @param code
- * the custom status code
- * @param severity
- * the severity; one of <code>FATAL</code>, <code>ERROR</code>, <code>INFO</code>, <code>WARNING</code>
- */
- public ProcessingStatus(String message, Throwable cause, int code, int severity) {
- setMessage(message);
- setException(cause);
- setCode(code);
- setSeverity(severity);
- }
-
- /**
- * Creates a new status object. The created status has no children.
- *
- * @param title
- * a human-readable title, localized to the current locale, can be
- * null
- * @param message
- * a human-readable message, localized to the current locale, is
- * never null
- * @param cause
- * a low-level exception, or <code>null</code> if not applicable
- * @param code
- * the custom status code
- * @param severity
- * the severity; one of <code>FATAL</code>, <code>ERROR</code>, <code>INFO</code>, <code>WARNING</code>
- */
- public ProcessingStatus(String title, String message, Throwable cause, int code, int severity) {
- setTitle(title);
- setMessage(message);
- setException(cause);
- setCode(code);
- setSeverity(severity);
- }
-
- public ProcessingStatus(IStatus s) {
- if (s != null) {
- setMessage(s.getMessage());
- setException(s.getException());
- setCode(s.getCode());
- setSeverity(s.getSeverity());
- if (s instanceof IProcessingStatus) {
- setTitle(((IProcessingStatus) s).getTitle());
- }
- }
- }
-
- @Override
- public IProcessingStatus[] getChildren() {
- return new IProcessingStatus[0];
- }
-
- @Override
- public boolean isMultiStatus() {
- return false;
- }
-
- @Override
- public int getCode() {
- return m_code;
- }
-
- @Override
- public Throwable getCause() {
- return m_cause;
- }
-
- @Override
- public Throwable getException() {
- return m_cause;
- }
-
- @Override
- public String getPlugin() {
- return m_plugin;
- }
-
- public void setPlugin(String plugin) {
- m_plugin = plugin;
- }
-
- @Override
- public String getMessage() {
- return m_message;
- }
-
- @Override
- public String getTitle() {
- return m_title;
- }
-
- @Override
- public int getSeverity() {
- return m_severity;
- }
-
- @Override
- public boolean isOK() {
- return m_severity == OK;
- }
-
- @Override
- public boolean matches(int severityMask) {
- return (getSeverity() & severityMask) != 0;
- }
-
- /**
- * Sets the status code.
- *
- * @param code
- * the custom status code
- */
- public void setCode(int code) {
- m_code = code;
- }
-
- /**
- * Sets the exception.
- *
- * @param exception
- * a low-level exception, or <code>null</code> if not applicable
- */
- public void setException(Throwable exception) {
- m_cause = exception;
- }
-
- /**
- * Sets the message.
- *
- * @param title
- * a human-readable message, localized to the current locale
- */
- public void setTitle(String title) {
- m_title = title;
- }
-
- /**
- * Sets the message.
- *
- * @param message
- * a human-readable message, localized to the current locale
- */
- public void setMessage(String message) {
- m_message = message;
- }
-
- @Override
- public void addContextMessage(String message) {
- if (message != null) {
- if (m_contextMessages == null) {
- m_contextMessages = new ArrayList<String>();
- }
- m_contextMessages.add(0, message);
- }
- }
-
- @Override
- public String[] getContextMessages() {
- return m_contextMessages != null ? m_contextMessages.toArray(new String[0]) : new String[0];
- }
-
- /**
- * Sets the severity.
- *
- * @param severity
- * the severity; one of <code>OK</code>, <code>ERROR</code>, <code>INFO</code>, <code>WARNING</code>, or
- * <code>CANCEL</code>
- */
- public void setSeverity(int severity) {
- switch (severity) {
- case INFO:
- case WARNING:
- case ERROR:
- case FATAL:
- case OK:
- case CANCEL: {
- break;
- }
- default: {
- throw new IllegalArgumentException("illegal severity: " + severity);
- }
- }
- m_severity = severity;
- }
-
- /**
- * Returns a string representation of the status, suitable for debugging
- * purposes only.
- */
- @Override
- public String toString() {
- StringBuffer buf = new StringBuffer();
- buf.append(getClass().getSimpleName() + "["); //$NON-NLS-1$
- switch (getSeverity()) {
- case INFO: {
- buf.append("INFO"); //$NON-NLS-1$
- break;
- }
- case WARNING: {
- buf.append("WARNING"); //$NON-NLS-1$
- break;
- }
- case ERROR: {
- buf.append("ERROR"); //$NON-NLS-1$
- break;
- }
- case FATAL: {
- buf.append("FATAL"); //$NON-NLS-1$
- break;
- }
- case OK: {
- buf.append("OK"); //$NON-NLS-1$
- break;
- }
- case CANCEL: {
- buf.append("CANCEL"); //$NON-NLS-1$
- break;
- }
- default: {
- buf.append("severity=" + getSeverity());
- }
- }
- buf.append(" code=" + m_code); //$NON-NLS-1$
- if (m_contextMessages != null) {
- for (String s : m_contextMessages) {
- buf.append(" ");
- buf.append(s);
- buf.append(" /");
- }
- }
- buf.append(" ");
- buf.append(m_message);
- if (m_cause != null) {
- buf.append(" ");
- buf.append(m_cause);
- }
- buf.append("]"); //$NON-NLS-1$
- return buf.toString();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.exception;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+
+import org.eclipse.core.runtime.IStatus;
+
+/**
+ * A concrete status implementation, suitable either for instantiating or
+ * subclassing.
+ * <p>
+ * This class can be used without OSGi running.
+ * </p>
+ */
+public class ProcessingStatus implements IProcessingStatus, Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private int m_severity;
+
+ /**
+ * Custom status code.
+ */
+ private int m_code;
+
+ private String m_plugin = "";
+
+ /**
+ * Title, localized to the current locale.
+ */
+ private String m_title;
+
+ /**
+ * Message, localized to the current locale.
+ */
+ private String m_message = "";
+
+ private ArrayList<String> m_contextMessages;
+
+ /**
+ * Wrapped exception, or <code>null</code> if none.
+ */
+ private Throwable m_cause = null;
+
+ /**
+ * Creates a new status object. The created status has no children.
+ *
+ * @param message
+ * a human-readable message, localized to the current locale, is
+ * never null
+ * @param severity
+ * the severity; one of <code>FATAL</code>, <code>ERROR</code>, <code>INFO</code>, <code>WARNING</code>
+ */
+ public ProcessingStatus(String message, int severity) {
+ setMessage(message);
+ setSeverity(severity);
+ }
+
+ /**
+ * Creates a new status object. The created status has no children.
+ *
+ * @param title
+ * a human-readable title, localized to the current locale, can be
+ * null
+ * @param message
+ * a human-readable message, localized to the current locale, is
+ * never null
+ * @param severity
+ * the severity; one of <code>FATAL</code>, <code>ERROR</code>, <code>INFO</code>, <code>WARNING</code>
+ */
+ public ProcessingStatus(String title, String message, int severity) {
+ setTitle(title);
+ setMessage(message);
+ setSeverity(severity);
+ }
+
+ /**
+ * Creates a new status object. The created status has no children.
+ *
+ * @param message
+ * a human-readable message, localized to the current locale, is
+ * never null
+ * @param cause
+ * a low-level exception, or <code>null</code> if not applicable
+ * @param code
+ * the custom status code
+ * @param severity
+ * the severity; one of <code>FATAL</code>, <code>ERROR</code>, <code>INFO</code>, <code>WARNING</code>
+ */
+ public ProcessingStatus(String message, Throwable cause, int code, int severity) {
+ setMessage(message);
+ setException(cause);
+ setCode(code);
+ setSeverity(severity);
+ }
+
+ /**
+ * Creates a new status object. The created status has no children.
+ *
+ * @param title
+ * a human-readable title, localized to the current locale, can be
+ * null
+ * @param message
+ * a human-readable message, localized to the current locale, is
+ * never null
+ * @param cause
+ * a low-level exception, or <code>null</code> if not applicable
+ * @param code
+ * the custom status code
+ * @param severity
+ * the severity; one of <code>FATAL</code>, <code>ERROR</code>, <code>INFO</code>, <code>WARNING</code>
+ */
+ public ProcessingStatus(String title, String message, Throwable cause, int code, int severity) {
+ setTitle(title);
+ setMessage(message);
+ setException(cause);
+ setCode(code);
+ setSeverity(severity);
+ }
+
+ public ProcessingStatus(IStatus s) {
+ if (s != null) {
+ setMessage(s.getMessage());
+ setException(s.getException());
+ setCode(s.getCode());
+ setSeverity(s.getSeverity());
+ if (s instanceof IProcessingStatus) {
+ setTitle(((IProcessingStatus) s).getTitle());
+ }
+ }
+ }
+
+ @Override
+ public IProcessingStatus[] getChildren() {
+ return new IProcessingStatus[0];
+ }
+
+ @Override
+ public boolean isMultiStatus() {
+ return false;
+ }
+
+ @Override
+ public int getCode() {
+ return m_code;
+ }
+
+ @Override
+ public Throwable getCause() {
+ return m_cause;
+ }
+
+ @Override
+ public Throwable getException() {
+ return m_cause;
+ }
+
+ @Override
+ public String getPlugin() {
+ return m_plugin;
+ }
+
+ public void setPlugin(String plugin) {
+ m_plugin = plugin;
+ }
+
+ @Override
+ public String getMessage() {
+ return m_message;
+ }
+
+ @Override
+ public String getTitle() {
+ return m_title;
+ }
+
+ @Override
+ public int getSeverity() {
+ return m_severity;
+ }
+
+ @Override
+ public boolean isOK() {
+ return m_severity == OK;
+ }
+
+ @Override
+ public boolean matches(int severityMask) {
+ return (getSeverity() & severityMask) != 0;
+ }
+
+ /**
+ * Sets the status code.
+ *
+ * @param code
+ * the custom status code
+ */
+ public void setCode(int code) {
+ m_code = code;
+ }
+
+ /**
+ * Sets the exception.
+ *
+ * @param exception
+ * a low-level exception, or <code>null</code> if not applicable
+ */
+ public void setException(Throwable exception) {
+ m_cause = exception;
+ }
+
+ /**
+ * Sets the message.
+ *
+ * @param title
+ * a human-readable message, localized to the current locale
+ */
+ public void setTitle(String title) {
+ m_title = title;
+ }
+
+ /**
+ * Sets the message.
+ *
+ * @param message
+ * a human-readable message, localized to the current locale
+ */
+ public void setMessage(String message) {
+ m_message = message;
+ }
+
+ @Override
+ public void addContextMessage(String message) {
+ if (message != null) {
+ if (m_contextMessages == null) {
+ m_contextMessages = new ArrayList<String>();
+ }
+ m_contextMessages.add(0, message);
+ }
+ }
+
+ @Override
+ public String[] getContextMessages() {
+ return m_contextMessages != null ? m_contextMessages.toArray(new String[0]) : new String[0];
+ }
+
+ /**
+ * Sets the severity.
+ *
+ * @param severity
+ * the severity; one of <code>OK</code>, <code>ERROR</code>, <code>INFO</code>, <code>WARNING</code>, or
+ * <code>CANCEL</code>
+ */
+ public void setSeverity(int severity) {
+ switch (severity) {
+ case INFO:
+ case WARNING:
+ case ERROR:
+ case FATAL:
+ case OK:
+ case CANCEL: {
+ break;
+ }
+ default: {
+ throw new IllegalArgumentException("illegal severity: " + severity);
+ }
+ }
+ m_severity = severity;
+ }
+
+ /**
+ * Returns a string representation of the status, suitable for debugging
+ * purposes only.
+ */
+ @Override
+ public String toString() {
+ StringBuffer buf = new StringBuffer();
+ buf.append(getClass().getSimpleName() + "["); //$NON-NLS-1$
+ switch (getSeverity()) {
+ case INFO: {
+ buf.append("INFO"); //$NON-NLS-1$
+ break;
+ }
+ case WARNING: {
+ buf.append("WARNING"); //$NON-NLS-1$
+ break;
+ }
+ case ERROR: {
+ buf.append("ERROR"); //$NON-NLS-1$
+ break;
+ }
+ case FATAL: {
+ buf.append("FATAL"); //$NON-NLS-1$
+ break;
+ }
+ case OK: {
+ buf.append("OK"); //$NON-NLS-1$
+ break;
+ }
+ case CANCEL: {
+ buf.append("CANCEL"); //$NON-NLS-1$
+ break;
+ }
+ default: {
+ buf.append("severity=" + getSeverity());
+ }
+ }
+ buf.append(" code=" + m_code); //$NON-NLS-1$
+ if (m_contextMessages != null) {
+ for (String s : m_contextMessages) {
+ buf.append(" ");
+ buf.append(s);
+ buf.append(" /");
+ }
+ }
+ buf.append(" ");
+ buf.append(m_message);
+ if (m_cause != null) {
+ buf.append(" ");
+ buf.append(m_cause);
+ }
+ buf.append("]"); //$NON-NLS-1$
+ return buf.toString();
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/exception/VetoException.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/exception/VetoException.java
index c761b89349..a379d8931f 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/exception/VetoException.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/exception/VetoException.java
@@ -1,75 +1,75 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.exception;
-
-import java.io.Serializable;
-
-/**
- * This class is a special subclass of {@link ProcessingException} to mark a
- * vetoed exception that is specialized from a general {@link ProcessingException} do not change interface contract
- * since this class
- * is serializable and used in different build versions
- */
-public class VetoException extends ProcessingException implements Serializable {
- private static final long serialVersionUID = 1L;
-
- /**
- * Empty constructor is used to support auto-webservice publishing with java
- * bean support
- */
- public VetoException() {
- super();
- }
-
- public VetoException(String message) {
- super(new ProcessingStatus(null, message, null, 0, IProcessingStatus.ERROR));
- }
-
- public VetoException(String message, Throwable cause) {
- super(new ProcessingStatus(null, message, cause, 0, IProcessingStatus.ERROR));
- }
-
- public VetoException(String message, Throwable cause, int errorCode) {
- super(new ProcessingStatus(null, message, cause, errorCode, IProcessingStatus.ERROR));
- }
-
- public VetoException(String message, int errorCode, int severity) {
- super(new ProcessingStatus(null, message, null, errorCode, severity));
- }
-
- public VetoException(String message, Throwable cause, int errorCode, int severity) {
- super(new ProcessingStatus(null, message, cause, errorCode, severity));
- }
-
- public VetoException(String title, String message) {
- super(new ProcessingStatus(title, message, null, 0, IProcessingStatus.ERROR));
- }
-
- public VetoException(String title, String message, Throwable cause) {
- super(new ProcessingStatus(title, message, cause, 0, IProcessingStatus.ERROR));
- }
-
- public VetoException(String title, String message, Throwable cause, int errorCode) {
- super(new ProcessingStatus(title, message, cause, errorCode, IProcessingStatus.ERROR));
- }
-
- public VetoException(String title, String message, int errorCode, int severity) {
- super(new ProcessingStatus(title, message, null, errorCode, severity));
- }
-
- public VetoException(String title, String message, Throwable cause, int errorCode, int severity) {
- super(new ProcessingStatus(title, message, cause, errorCode, severity));
- }
-
- public VetoException(IProcessingStatus status) {
- super(status);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.exception;
+
+import java.io.Serializable;
+
+/**
+ * This class is a special subclass of {@link ProcessingException} to mark a
+ * vetoed exception that is specialized from a general {@link ProcessingException} do not change interface contract
+ * since this class
+ * is serializable and used in different build versions
+ */
+public class VetoException extends ProcessingException implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Empty constructor is used to support auto-webservice publishing with java
+ * bean support
+ */
+ public VetoException() {
+ super();
+ }
+
+ public VetoException(String message) {
+ super(new ProcessingStatus(null, message, null, 0, IProcessingStatus.ERROR));
+ }
+
+ public VetoException(String message, Throwable cause) {
+ super(new ProcessingStatus(null, message, cause, 0, IProcessingStatus.ERROR));
+ }
+
+ public VetoException(String message, Throwable cause, int errorCode) {
+ super(new ProcessingStatus(null, message, cause, errorCode, IProcessingStatus.ERROR));
+ }
+
+ public VetoException(String message, int errorCode, int severity) {
+ super(new ProcessingStatus(null, message, null, errorCode, severity));
+ }
+
+ public VetoException(String message, Throwable cause, int errorCode, int severity) {
+ super(new ProcessingStatus(null, message, cause, errorCode, severity));
+ }
+
+ public VetoException(String title, String message) {
+ super(new ProcessingStatus(title, message, null, 0, IProcessingStatus.ERROR));
+ }
+
+ public VetoException(String title, String message, Throwable cause) {
+ super(new ProcessingStatus(title, message, cause, 0, IProcessingStatus.ERROR));
+ }
+
+ public VetoException(String title, String message, Throwable cause, int errorCode) {
+ super(new ProcessingStatus(title, message, cause, errorCode, IProcessingStatus.ERROR));
+ }
+
+ public VetoException(String title, String message, int errorCode, int severity) {
+ super(new ProcessingStatus(title, message, null, errorCode, severity));
+ }
+
+ public VetoException(String title, String message, Throwable cause, int errorCode, int severity) {
+ super(new ProcessingStatus(title, message, cause, errorCode, severity));
+ }
+
+ public VetoException(IProcessingStatus status) {
+ super(status);
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/BeanArrayHolder.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/BeanArrayHolder.java
index 5865500dfe..021e75ffd8 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/BeanArrayHolder.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/BeanArrayHolder.java
@@ -1,128 +1,128 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.holders;
-
-import java.io.Serializable;
-import java.lang.reflect.Array;
-import java.lang.reflect.UndeclaredThrowableException;
-import java.util.ArrayList;
-import java.util.EnumSet;
-import java.util.HashMap;
-
-/**
- * @param <T>
- * the type of beans stored in the holder
- * @since 3.0
- */
-public class BeanArrayHolder<T> implements IBeanArrayHolder<T>, Serializable {
- private static final long serialVersionUID = 1L;
- private ArrayList<T> m_list = new ArrayList<T>();
- private HashMap<T, State> m_stateList = new HashMap<T, State>();
- private Class<T> m_clazz;
-
- public BeanArrayHolder(Class<T> clazz) {
- m_clazz = clazz;
- }
-
- @Override
- public T addBean() {
- T ret = null;
- try {
- ret = m_clazz.newInstance();
- }
- catch (InstantiationException e) {
- throw new UndeclaredThrowableException(e, "BeanArrayHolder: cannot instantiate " + m_clazz.toString());
- }
- catch (IllegalAccessException e) {
- throw new UndeclaredThrowableException(e, "BeanArrayHolder: cannot instantiate " + m_clazz.toString());
- }
- m_list.add(ret);
- m_stateList.put(ret, IBeanArrayHolder.State.NON_CHANGED);
- return ret;
- }
-
- @Override
- public void ensureSize(int size) {
- while (m_list.size() < size) {
- addBean();
- }
- while (m_list.size() > size) {
- removeBean(m_list.size() - 1);
- }
- }
-
- public void removeBean(int index) {
- T ret = m_list.remove(index);
- m_stateList.remove(ret);
- }
-
- @Override
- public Class<T> getHolderType() {
- return m_clazz;
- }
-
- @Override
- public int getBeanCount(State... states) {
- if (states == null || states.length == 0) {
- return m_list.size();
- }
- EnumSet<State> state = EnumSet.noneOf(State.class);
- for (State s : states) {
- state.add(s);
- }
- if (state.isEmpty() || (state.contains(State.INSERTED) && state.contains(State.UPDATED)
- && state.contains(State.DELETED) && state.contains(State.NON_CHANGED))) {
- return m_list.size();
- }
- int ret = 0;
- for (T b : m_list) {
- if (state.contains(m_stateList.get(b))) {
- ret++;
- }
- }
- return ret;
- }
-
- @Override
- public T[] getBeans(State... states) {
- ArrayList<T> ret = new ArrayList<T>();
- EnumSet<State> state = EnumSet.noneOf(State.class);
- if (states != null) {
- for (State s : states) {
- state.add(s);
- }
- }
- if (state.isEmpty() || (state.contains(State.INSERTED) && state.contains(State.UPDATED)
- && state.contains(State.DELETED) && state.contains(State.NON_CHANGED))) {
- ret = m_list;
- }
- else {
- for (T b : m_list) {
- if (state.contains(m_stateList.get(b))) {
- ret.add(b);
- }
- }
- }
- @SuppressWarnings("unchecked")
- T[] result = ret.toArray((T[]) Array.newInstance(m_clazz, ret.size()));
- return result;
- }
-
- @Override
- public State getRowState(T bean) {
- return m_stateList.get(bean);
- }
-
- @Override
- public void setRowState(T bean, State state) {
- m_stateList.put(bean, state);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.holders;
+
+import java.io.Serializable;
+import java.lang.reflect.Array;
+import java.lang.reflect.UndeclaredThrowableException;
+import java.util.ArrayList;
+import java.util.EnumSet;
+import java.util.HashMap;
+
+/**
+ * @param <T>
+ * the type of beans stored in the holder
+ * @since 3.0
+ */
+public class BeanArrayHolder<T> implements IBeanArrayHolder<T>, Serializable {
+ private static final long serialVersionUID = 1L;
+ private ArrayList<T> m_list = new ArrayList<T>();
+ private HashMap<T, State> m_stateList = new HashMap<T, State>();
+ private Class<T> m_clazz;
+
+ public BeanArrayHolder(Class<T> clazz) {
+ m_clazz = clazz;
+ }
+
+ @Override
+ public T addBean() {
+ T ret = null;
+ try {
+ ret = m_clazz.newInstance();
+ }
+ catch (InstantiationException e) {
+ throw new UndeclaredThrowableException(e, "BeanArrayHolder: cannot instantiate " + m_clazz.toString());
+ }
+ catch (IllegalAccessException e) {
+ throw new UndeclaredThrowableException(e, "BeanArrayHolder: cannot instantiate " + m_clazz.toString());
+ }
+ m_list.add(ret);
+ m_stateList.put(ret, IBeanArrayHolder.State.NON_CHANGED);
+ return ret;
+ }
+
+ @Override
+ public void ensureSize(int size) {
+ while (m_list.size() < size) {
+ addBean();
+ }
+ while (m_list.size() > size) {
+ removeBean(m_list.size() - 1);
+ }
+ }
+
+ public void removeBean(int index) {
+ T ret = m_list.remove(index);
+ m_stateList.remove(ret);
+ }
+
+ @Override
+ public Class<T> getHolderType() {
+ return m_clazz;
+ }
+
+ @Override
+ public int getBeanCount(State... states) {
+ if (states == null || states.length == 0) {
+ return m_list.size();
+ }
+ EnumSet<State> state = EnumSet.noneOf(State.class);
+ for (State s : states) {
+ state.add(s);
+ }
+ if (state.isEmpty() || (state.contains(State.INSERTED) && state.contains(State.UPDATED)
+ && state.contains(State.DELETED) && state.contains(State.NON_CHANGED))) {
+ return m_list.size();
+ }
+ int ret = 0;
+ for (T b : m_list) {
+ if (state.contains(m_stateList.get(b))) {
+ ret++;
+ }
+ }
+ return ret;
+ }
+
+ @Override
+ public T[] getBeans(State... states) {
+ ArrayList<T> ret = new ArrayList<T>();
+ EnumSet<State> state = EnumSet.noneOf(State.class);
+ if (states != null) {
+ for (State s : states) {
+ state.add(s);
+ }
+ }
+ if (state.isEmpty() || (state.contains(State.INSERTED) && state.contains(State.UPDATED)
+ && state.contains(State.DELETED) && state.contains(State.NON_CHANGED))) {
+ ret = m_list;
+ }
+ else {
+ for (T b : m_list) {
+ if (state.contains(m_stateList.get(b))) {
+ ret.add(b);
+ }
+ }
+ }
+ @SuppressWarnings("unchecked")
+ T[] result = ret.toArray((T[]) Array.newInstance(m_clazz, ret.size()));
+ return result;
+ }
+
+ @Override
+ public State getRowState(T bean) {
+ return m_stateList.get(bean);
+ }
+
+ @Override
+ public void setRowState(T bean, State state) {
+ m_stateList.put(bean, state);
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/BeanArrayHolderFilter.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/BeanArrayHolderFilter.java
index 0b16786e40..92e69bde5f 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/BeanArrayHolderFilter.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/BeanArrayHolderFilter.java
@@ -1,37 +1,37 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.holders;
-
-import java.util.EnumSet;
-
-import org.eclipse.scout.commons.holders.IBeanArrayHolder.State;
-
-public class BeanArrayHolderFilter<T> {
- private IBeanArrayHolder<T> m_beanArray;
- private EnumSet<State> m_states = EnumSet.noneOf(State.class);
-
- public BeanArrayHolderFilter(IBeanArrayHolder<T> beanArray, State... states) {
- m_beanArray = beanArray;
- if (states != null) {
- for (State s : states) {
- m_states.add(s);
- }
- }
- }
-
- public IBeanArrayHolder<T> getBeanArrayHolder() {
- return m_beanArray;
- }
-
- public T[] getFilteredBeans() {
- return m_beanArray.getBeans((m_states.toArray(new State[0])));
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.holders;
+
+import java.util.EnumSet;
+
+import org.eclipse.scout.commons.holders.IBeanArrayHolder.State;
+
+public class BeanArrayHolderFilter<T> {
+ private IBeanArrayHolder<T> m_beanArray;
+ private EnumSet<State> m_states = EnumSet.noneOf(State.class);
+
+ public BeanArrayHolderFilter(IBeanArrayHolder<T> beanArray, State... states) {
+ m_beanArray = beanArray;
+ if (states != null) {
+ for (State s : states) {
+ m_states.add(s);
+ }
+ }
+ }
+
+ public IBeanArrayHolder<T> getBeanArrayHolder() {
+ return m_beanArray;
+ }
+
+ public T[] getFilteredBeans() {
+ return m_beanArray.getBeans((m_states.toArray(new State[0])));
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/BigDecimalArrayHolder.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/BigDecimalArrayHolder.java
index d6c3fc17c6..57ec30ec39 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/BigDecimalArrayHolder.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/BigDecimalArrayHolder.java
@@ -1,30 +1,30 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.holders;
-
-import java.math.BigDecimal;
-
-/**
- * @since 3.2
- */
-
-public class BigDecimalArrayHolder extends Holder<BigDecimal[]> {
- private static final long serialVersionUID = 1L;
-
- public BigDecimalArrayHolder() {
- super(BigDecimal[].class);
- }
-
- public BigDecimalArrayHolder(BigDecimal[] value) {
- super(BigDecimal[].class, value);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.holders;
+
+import java.math.BigDecimal;
+
+/**
+ * @since 3.2
+ */
+
+public class BigDecimalArrayHolder extends Holder<BigDecimal[]> {
+ private static final long serialVersionUID = 1L;
+
+ public BigDecimalArrayHolder() {
+ super(BigDecimal[].class);
+ }
+
+ public BigDecimalArrayHolder(BigDecimal[] value) {
+ super(BigDecimal[].class, value);
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/BigDecimalHolder.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/BigDecimalHolder.java
index e314474559..c02bdf80e8 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/BigDecimalHolder.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/BigDecimalHolder.java
@@ -1,30 +1,30 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.holders;
-
-import java.math.BigDecimal;
-
-/**
- * @since 3.0
- */
-
-public class BigDecimalHolder extends Holder<BigDecimal> {
- private static final long serialVersionUID = 1L;
-
- public BigDecimalHolder() {
- super(BigDecimal.class);
- }
-
- public BigDecimalHolder(BigDecimal value) {
- super(BigDecimal.class, value);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.holders;
+
+import java.math.BigDecimal;
+
+/**
+ * @since 3.0
+ */
+
+public class BigDecimalHolder extends Holder<BigDecimal> {
+ private static final long serialVersionUID = 1L;
+
+ public BigDecimalHolder() {
+ super(BigDecimal.class);
+ }
+
+ public BigDecimalHolder(BigDecimal value) {
+ super(BigDecimal.class, value);
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/BooleanArrayHolder.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/BooleanArrayHolder.java
index c38746a25a..35152d25b3 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/BooleanArrayHolder.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/BooleanArrayHolder.java
@@ -1,28 +1,28 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.holders;
-
-/**
- * @since 3.0
- */
-
-public class BooleanArrayHolder extends Holder<Boolean[]> {
- private static final long serialVersionUID = 1L;
-
- public BooleanArrayHolder() {
- super(Boolean[].class);
- }
-
- public BooleanArrayHolder(Boolean[] value) {
- super(Boolean[].class, value);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.holders;
+
+/**
+ * @since 3.0
+ */
+
+public class BooleanArrayHolder extends Holder<Boolean[]> {
+ private static final long serialVersionUID = 1L;
+
+ public BooleanArrayHolder() {
+ super(Boolean[].class);
+ }
+
+ public BooleanArrayHolder(Boolean[] value) {
+ super(Boolean[].class, value);
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/BooleanHolder.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/BooleanHolder.java
index 0ef818486e..546977b4ad 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/BooleanHolder.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/BooleanHolder.java
@@ -1,28 +1,28 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.holders;
-
-/**
- * @since 3.0
- */
-
-public class BooleanHolder extends Holder<Boolean> {
- private static final long serialVersionUID = 1L;
-
- public BooleanHolder() {
- super(Boolean.class);
- }
-
- public BooleanHolder(Boolean value) {
- super(Boolean.class, value);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.holders;
+
+/**
+ * @since 3.0
+ */
+
+public class BooleanHolder extends Holder<Boolean> {
+ private static final long serialVersionUID = 1L;
+
+ public BooleanHolder() {
+ super(Boolean.class);
+ }
+
+ public BooleanHolder(Boolean value) {
+ super(Boolean.class, value);
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/ByteArrayHolder.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/ByteArrayHolder.java
index 1d57d9bccf..389aea6521 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/ByteArrayHolder.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/ByteArrayHolder.java
@@ -1,28 +1,28 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.holders;
-
-/**
- * @since 3.0
- */
-
-public class ByteArrayHolder extends Holder<byte[]> {
- private static final long serialVersionUID = 1L;
-
- public ByteArrayHolder() {
- super(byte[].class);
- }
-
- public ByteArrayHolder(byte[] value) {
- super(byte[].class, value);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.holders;
+
+/**
+ * @since 3.0
+ */
+
+public class ByteArrayHolder extends Holder<byte[]> {
+ private static final long serialVersionUID = 1L;
+
+ public ByteArrayHolder() {
+ super(byte[].class);
+ }
+
+ public ByteArrayHolder(byte[] value) {
+ super(byte[].class, value);
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/DateArrayHolder.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/DateArrayHolder.java
index b6b6ace4bb..b59ae565d9 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/DateArrayHolder.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/DateArrayHolder.java
@@ -1,30 +1,30 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.holders;
-
-import java.util.Date;
-
-/**
- * @since 3.0
- */
-
-public class DateArrayHolder extends Holder<Date[]> {
- private static final long serialVersionUID = 1L;
-
- public DateArrayHolder() {
- super(Date[].class);
- }
-
- public DateArrayHolder(Date[] value) {
- super(Date[].class, value);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.holders;
+
+import java.util.Date;
+
+/**
+ * @since 3.0
+ */
+
+public class DateArrayHolder extends Holder<Date[]> {
+ private static final long serialVersionUID = 1L;
+
+ public DateArrayHolder() {
+ super(Date[].class);
+ }
+
+ public DateArrayHolder(Date[] value) {
+ super(Date[].class, value);
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/DateHolder.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/DateHolder.java
index c791e8ca40..dc3fc2a969 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/DateHolder.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/DateHolder.java
@@ -1,30 +1,30 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.holders;
-
-import java.util.Date;
-
-/**
- * @since 3.0
- */
-
-public class DateHolder extends Holder<Date> {
- private static final long serialVersionUID = 1L;
-
- public DateHolder() {
- super(Date.class);
- }
-
- public DateHolder(Date value) {
- super(Date.class, value);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.holders;
+
+import java.util.Date;
+
+/**
+ * @since 3.0
+ */
+
+public class DateHolder extends Holder<Date> {
+ private static final long serialVersionUID = 1L;
+
+ public DateHolder() {
+ super(Date.class);
+ }
+
+ public DateHolder(Date value) {
+ super(Date.class, value);
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/DoubleArrayHolder.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/DoubleArrayHolder.java
index d2044116af..e808714f15 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/DoubleArrayHolder.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/DoubleArrayHolder.java
@@ -1,28 +1,28 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.holders;
-
-/**
- * @since 3.0
- */
-
-public class DoubleArrayHolder extends Holder<Double[]> {
- private static final long serialVersionUID = 1L;
-
- public DoubleArrayHolder() {
- super(Double[].class);
- }
-
- public DoubleArrayHolder(Double[] value) {
- super(Double[].class, value);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.holders;
+
+/**
+ * @since 3.0
+ */
+
+public class DoubleArrayHolder extends Holder<Double[]> {
+ private static final long serialVersionUID = 1L;
+
+ public DoubleArrayHolder() {
+ super(Double[].class);
+ }
+
+ public DoubleArrayHolder(Double[] value) {
+ super(Double[].class, value);
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/DoubleHolder.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/DoubleHolder.java
index 8c3b0cb3e7..c3b0cffe7e 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/DoubleHolder.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/DoubleHolder.java
@@ -1,28 +1,28 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.holders;
-
-/**
- * @since 3.0
- */
-
-public class DoubleHolder extends Holder<Double> {
- private static final long serialVersionUID = 1L;
-
- public DoubleHolder() {
- super(Double.class);
- }
-
- public DoubleHolder(Double value) {
- super(Double.class, value);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.holders;
+
+/**
+ * @since 3.0
+ */
+
+public class DoubleHolder extends Holder<Double> {
+ private static final long serialVersionUID = 1L;
+
+ public DoubleHolder() {
+ super(Double.class);
+ }
+
+ public DoubleHolder(Double value) {
+ super(Double.class, value);
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/FloatArrayHolder.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/FloatArrayHolder.java
index ecb6dc9da8..1bd519e5a3 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/FloatArrayHolder.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/FloatArrayHolder.java
@@ -1,28 +1,28 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.holders;
-
-/**
- * @since 3.0
- */
-
-public class FloatArrayHolder extends Holder<Float[]> {
- private static final long serialVersionUID = 1L;
-
- public FloatArrayHolder() {
- super(Float[].class);
- }
-
- public FloatArrayHolder(Float[] value) {
- super(Float[].class, value);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.holders;
+
+/**
+ * @since 3.0
+ */
+
+public class FloatArrayHolder extends Holder<Float[]> {
+ private static final long serialVersionUID = 1L;
+
+ public FloatArrayHolder() {
+ super(Float[].class);
+ }
+
+ public FloatArrayHolder(Float[] value) {
+ super(Float[].class, value);
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/FloatHolder.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/FloatHolder.java
index cf01846707..e7789a052d 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/FloatHolder.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/FloatHolder.java
@@ -1,28 +1,28 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.holders;
-
-/**
- * @since 3.0
- */
-
-public class FloatHolder extends Holder<Float> {
- private static final long serialVersionUID = 1L;
-
- public FloatHolder() {
- super(Float.class);
- }
-
- public FloatHolder(Float value) {
- super(Float.class, value);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.holders;
+
+/**
+ * @since 3.0
+ */
+
+public class FloatHolder extends Holder<Float> {
+ private static final long serialVersionUID = 1L;
+
+ public FloatHolder() {
+ super(Float.class);
+ }
+
+ public FloatHolder(Float value) {
+ super(Float.class, value);
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/Holder.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/Holder.java
index 75de974011..8ab537419d 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/Holder.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/Holder.java
@@ -1,55 +1,55 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.holders;
-
-import java.io.Serializable;
-
-/**
- * @since 3.0
- */
-
-public class Holder<T> implements IHolder<T>, Serializable {
- private static final long serialVersionUID = 1L;
- private T m_value;
- private final Class<T> m_clazz;
-
- public Holder(Class<T> clazz) {
- m_clazz = clazz;
- }
-
- public Holder(Class<T> clazz, T o) {
- m_value = o;
- m_clazz = clazz;
- }
-
- @Override
- public T getValue() {
- return m_value;
- }
-
- @Override
- public void setValue(T o) {
- synchronized (this) {
- m_value = o;
- this.notifyAll();
- }
- }
-
- @Override
- public Class<T> getHolderType() {
- return m_clazz;
- }
-
- @Override
- public String toString() {
- return "Holder<" + m_clazz.getSimpleName() + ">(" + (m_value == null ? "" : m_value.toString()) + ")";
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.holders;
+
+import java.io.Serializable;
+
+/**
+ * @since 3.0
+ */
+
+public class Holder<T> implements IHolder<T>, Serializable {
+ private static final long serialVersionUID = 1L;
+ private T m_value;
+ private final Class<T> m_clazz;
+
+ public Holder(Class<T> clazz) {
+ m_clazz = clazz;
+ }
+
+ public Holder(Class<T> clazz, T o) {
+ m_value = o;
+ m_clazz = clazz;
+ }
+
+ @Override
+ public T getValue() {
+ return m_value;
+ }
+
+ @Override
+ public void setValue(T o) {
+ synchronized (this) {
+ m_value = o;
+ this.notifyAll();
+ }
+ }
+
+ @Override
+ public Class<T> getHolderType() {
+ return m_clazz;
+ }
+
+ @Override
+ public String toString() {
+ return "Holder<" + m_clazz.getSimpleName() + ">(" + (m_value == null ? "" : m_value.toString()) + ")";
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/HolderUtility.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/HolderUtility.java
index a9c235bf28..9439ed65fe 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/HolderUtility.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/HolderUtility.java
@@ -1,54 +1,54 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.holders;
-
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.commons.TypeCastUtility;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-
-/**
- * @since 3.0
- */
-
-public final class HolderUtility {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(HolderUtility.class);
-
- private HolderUtility() {
- }
-
- public static boolean containEqualValues(IHolder a, IHolder b) {
- Object va = a.getValue();
- Object vb = b.getValue();
- return CompareUtility.equals(va, vb);
- }
-
- public static <T> void setAndCastValue(IHolder<T> h, Object value) {
- if (h == null) {
- /* nop */
- }
- else {
- h.setValue(TypeCastUtility.castValue(value, h.getHolderType()));
- }
- }
-
- /**
- * when passing IHolder values to remote services it is necessary to create a
- * value copy of the holder for serialization
- */
- public static <T> IHolder<T> createSerializableHolder(IHolder<T> h) {
- if (h == null) {
- return null;
- }
- return new Holder<T>(h.getHolderType(), h.getValue());
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.holders;
+
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.commons.TypeCastUtility;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+
+/**
+ * @since 3.0
+ */
+
+public final class HolderUtility {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(HolderUtility.class);
+
+ private HolderUtility() {
+ }
+
+ public static boolean containEqualValues(IHolder a, IHolder b) {
+ Object va = a.getValue();
+ Object vb = b.getValue();
+ return CompareUtility.equals(va, vb);
+ }
+
+ public static <T> void setAndCastValue(IHolder<T> h, Object value) {
+ if (h == null) {
+ /* nop */
+ }
+ else {
+ h.setValue(TypeCastUtility.castValue(value, h.getHolderType()));
+ }
+ }
+
+ /**
+ * when passing IHolder values to remote services it is necessary to create a
+ * value copy of the holder for serialization
+ */
+ public static <T> IHolder<T> createSerializableHolder(IHolder<T> h) {
+ if (h == null) {
+ return null;
+ }
+ return new Holder<T>(h.getHolderType(), h.getValue());
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/IBeanArrayHolder.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/IBeanArrayHolder.java
index a081ad3486..8e16a76d62 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/IBeanArrayHolder.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/IBeanArrayHolder.java
@@ -1,96 +1,96 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.holders;
-
-/**
- * <p>
- * Holder class for beans.
- * </p>
- * <h3>Simple example</h3>
- * <p>
- * The <code>Order</code> class would contain at least the attributes <code>OrderNr</code>, <code>Reporting </code>and
- * <code>Year</code>.
- * </p>
- *
- * <pre>
- * BeanArrayHolder&lt;Order&gt; orders = new BeanArrayHolder&lt;Order&gt;(Order.class);
- * SQL.selectInto(
- * &quot;select ORDER_NR, &quot; +
- * &quot; REPORTING_UID, &quot; +
- * &quot; YEAR &quot; +
- * &quot; from order &quot; +
- * &quot; where 1=1 into :orderNr, :reporting, :year &quot;,
- * orders);
- * Order[] allOrders = orders.getBeans();
- * </pre>
- *
- * @since 3.0
- */
-
-public interface IBeanArrayHolder<T> {
- /**
- * States a bean in an {@link IBeanArrayHolder} can have.
- */
- public enum State {
- NON_CHANGED,
- INSERTED,
- UPDATED,
- DELETED
- }
-
- /**
- * Gets the the number of beans with a state that is contained in the passed states.
- * If no states are passed the number of all beans in the holder is returned.
- *
- * @param states
- * @return a value corresponding to the number of beans in this holder with a given state
- */
- int getBeanCount(State... states);
-
- /**
- * gets all beans with belonging to the set of supplied states
- *
- * @param states
- * that should be returned. If <code>null</code> or an empty
- * array is passed, then all beans regardless of state are returned.
- * @return an array of beans, does never return <code>null</code>
- */
- T[] getBeans(State... states);
-
- /**
- * Creates a new bean by calling <code>newInstance</code> on the class of beans. An constructor without parameters
- * must exist. The bean is added to this holder.
- *
- * @return the newly created bean.
- */
- T addBean();
-
- /**
- * Adjusts the size of the holder to the size given in the parameter. New beans are added or existing beans removed.
- *
- * @param size
- */
- void ensureSize(int size);
-
- void setRowState(T bean, State state);
-
- /**
- * @param bean
- * @return the state of the supplied bean in the holder
- */
- State getRowState(T bean);
-
- /**
- * @return the bean class contained in the holder
- */
- Class<T> getHolderType();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.holders;
+
+/**
+ * <p>
+ * Holder class for beans.
+ * </p>
+ * <h3>Simple example</h3>
+ * <p>
+ * The <code>Order</code> class would contain at least the attributes <code>OrderNr</code>, <code>Reporting </code>and
+ * <code>Year</code>.
+ * </p>
+ *
+ * <pre>
+ * BeanArrayHolder&lt;Order&gt; orders = new BeanArrayHolder&lt;Order&gt;(Order.class);
+ * SQL.selectInto(
+ * &quot;select ORDER_NR, &quot; +
+ * &quot; REPORTING_UID, &quot; +
+ * &quot; YEAR &quot; +
+ * &quot; from order &quot; +
+ * &quot; where 1=1 into :orderNr, :reporting, :year &quot;,
+ * orders);
+ * Order[] allOrders = orders.getBeans();
+ * </pre>
+ *
+ * @since 3.0
+ */
+
+public interface IBeanArrayHolder<T> {
+ /**
+ * States a bean in an {@link IBeanArrayHolder} can have.
+ */
+ public enum State {
+ NON_CHANGED,
+ INSERTED,
+ UPDATED,
+ DELETED
+ }
+
+ /**
+ * Gets the the number of beans with a state that is contained in the passed states.
+ * If no states are passed the number of all beans in the holder is returned.
+ *
+ * @param states
+ * @return a value corresponding to the number of beans in this holder with a given state
+ */
+ int getBeanCount(State... states);
+
+ /**
+ * gets all beans with belonging to the set of supplied states
+ *
+ * @param states
+ * that should be returned. If <code>null</code> or an empty
+ * array is passed, then all beans regardless of state are returned.
+ * @return an array of beans, does never return <code>null</code>
+ */
+ T[] getBeans(State... states);
+
+ /**
+ * Creates a new bean by calling <code>newInstance</code> on the class of beans. An constructor without parameters
+ * must exist. The bean is added to this holder.
+ *
+ * @return the newly created bean.
+ */
+ T addBean();
+
+ /**
+ * Adjusts the size of the holder to the size given in the parameter. New beans are added or existing beans removed.
+ *
+ * @param size
+ */
+ void ensureSize(int size);
+
+ void setRowState(T bean, State state);
+
+ /**
+ * @param bean
+ * @return the state of the supplied bean in the holder
+ */
+ State getRowState(T bean);
+
+ /**
+ * @return the bean class contained in the holder
+ */
+ Class<T> getHolderType();
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/IHolder.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/IHolder.java
index 8f50741447..0f77281271 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/IHolder.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/IHolder.java
@@ -1,25 +1,25 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.holders;
-
-/**
- * @since 3.0
- */
-
-public interface IHolder<T> {
-
- T getValue();
-
- void setValue(T o);
-
- Class<T> getHolderType();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.holders;
+
+/**
+ * @since 3.0
+ */
+
+public interface IHolder<T> {
+
+ T getValue();
+
+ void setValue(T o);
+
+ Class<T> getHolderType();
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/ITableHolder.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/ITableHolder.java
index e1fe7717f9..98292519e1 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/ITableHolder.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/ITableHolder.java
@@ -1,79 +1,79 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.holders;
-
-/**
- * @since 3.0
- */
-
-/**
- * Holder for table data value access of columns is done by Bean introspection
- * column methods must have a rowIndex argument, see example comment below
- */
-public interface ITableHolder {
- /**
- * same number as
- *
- * @see AbstractTableRowData
- */
- int STATUS_NON_CHANGED = 0;
- /**
- * same number as
- *
- * @see AbstractTableRowData
- */
- int STATUS_INSERTED = 1;
- /**
- * same number as
- *
- * @see AbstractTableRowData
- */
- int STATUS_UPDATED = 2;
- /**
- * same number as
- *
- * @see AbstractTableRowData
- */
- int STATUS_DELETED = 3;
-
- int/* newIndex */addRow();
-
- void ensureSize(int size);
-
- int getRowCount();
-
- int getColumnCount();
-
- int getRowState(int rowIndex);
-
- void setRowState(int rowIndex, int state);
-
- /**
- * The implementation will delegate this getter to one of the column getters
- */
- Object getValueAt(int row, int column);
-
- /**
- * The implementation will delegate this setter to one of the column setters
- *
- * @throws IllegalArgumentException
- */
- void setValueAt(int row, int column, Object value);
-
- /**
- * Sample of column property of type String
- */
- /*
- * String getCityColumn(int rowIndex){ ... } setCityColumn(int rowIndex,String
- * value){ ... }
- */
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.holders;
+
+/**
+ * @since 3.0
+ */
+
+/**
+ * Holder for table data value access of columns is done by Bean introspection
+ * column methods must have a rowIndex argument, see example comment below
+ */
+public interface ITableHolder {
+ /**
+ * same number as
+ *
+ * @see AbstractTableRowData
+ */
+ int STATUS_NON_CHANGED = 0;
+ /**
+ * same number as
+ *
+ * @see AbstractTableRowData
+ */
+ int STATUS_INSERTED = 1;
+ /**
+ * same number as
+ *
+ * @see AbstractTableRowData
+ */
+ int STATUS_UPDATED = 2;
+ /**
+ * same number as
+ *
+ * @see AbstractTableRowData
+ */
+ int STATUS_DELETED = 3;
+
+ int/* newIndex */addRow();
+
+ void ensureSize(int size);
+
+ int getRowCount();
+
+ int getColumnCount();
+
+ int getRowState(int rowIndex);
+
+ void setRowState(int rowIndex, int state);
+
+ /**
+ * The implementation will delegate this getter to one of the column getters
+ */
+ Object getValueAt(int row, int column);
+
+ /**
+ * The implementation will delegate this setter to one of the column setters
+ *
+ * @throws IllegalArgumentException
+ */
+ void setValueAt(int row, int column, Object value);
+
+ /**
+ * Sample of column property of type String
+ */
+ /*
+ * String getCityColumn(int rowIndex){ ... } setCityColumn(int rowIndex,String
+ * value){ ... }
+ */
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/IntegerArrayHolder.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/IntegerArrayHolder.java
index 190ff4d764..adf9dbadb6 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/IntegerArrayHolder.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/IntegerArrayHolder.java
@@ -1,28 +1,28 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.holders;
-
-/**
- * @since 3.0
- */
-
-public class IntegerArrayHolder extends Holder<Integer[]> {
- private static final long serialVersionUID = 1L;
-
- public IntegerArrayHolder() {
- super(Integer[].class);
- }
-
- public IntegerArrayHolder(Integer[] value) {
- super(Integer[].class, value);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.holders;
+
+/**
+ * @since 3.0
+ */
+
+public class IntegerArrayHolder extends Holder<Integer[]> {
+ private static final long serialVersionUID = 1L;
+
+ public IntegerArrayHolder() {
+ super(Integer[].class);
+ }
+
+ public IntegerArrayHolder(Integer[] value) {
+ super(Integer[].class, value);
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/IntegerHolder.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/IntegerHolder.java
index 4da5fce447..2737f1a28d 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/IntegerHolder.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/IntegerHolder.java
@@ -1,28 +1,28 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.holders;
-
-/**
- * @since 3.0
- */
-
-public class IntegerHolder extends Holder<Integer> {
- private static final long serialVersionUID = 1L;
-
- public IntegerHolder() {
- super(Integer.class);
- }
-
- public IntegerHolder(Integer value) {
- super(Integer.class, value);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.holders;
+
+/**
+ * @since 3.0
+ */
+
+public class IntegerHolder extends Holder<Integer> {
+ private static final long serialVersionUID = 1L;
+
+ public IntegerHolder() {
+ super(Integer.class);
+ }
+
+ public IntegerHolder(Integer value) {
+ super(Integer.class, value);
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/LongArrayHolder.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/LongArrayHolder.java
index 98e0d97d4b..9879b142c5 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/LongArrayHolder.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/LongArrayHolder.java
@@ -1,34 +1,34 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.holders;
-
-import org.eclipse.scout.commons.TypeCastUtility;
-
-/**
- * @since 3.0
- */
-
-public class LongArrayHolder extends Holder<Long[]> {
- private static final long serialVersionUID = 1L;
-
- public LongArrayHolder() {
- super(Long[].class);
- }
-
- public LongArrayHolder(Long[] value) {
- super(Long[].class, value);
- }
-
- public LongArrayHolder(Integer[] value) {
- super(Long[].class, (value != null ? TypeCastUtility.castValue(value, Long[].class) : null));
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.holders;
+
+import org.eclipse.scout.commons.TypeCastUtility;
+
+/**
+ * @since 3.0
+ */
+
+public class LongArrayHolder extends Holder<Long[]> {
+ private static final long serialVersionUID = 1L;
+
+ public LongArrayHolder() {
+ super(Long[].class);
+ }
+
+ public LongArrayHolder(Long[] value) {
+ super(Long[].class, value);
+ }
+
+ public LongArrayHolder(Integer[] value) {
+ super(Long[].class, (value != null ? TypeCastUtility.castValue(value, Long[].class) : null));
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/LongHolder.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/LongHolder.java
index 25b3c7d510..4278cf646c 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/LongHolder.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/LongHolder.java
@@ -1,32 +1,32 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.holders;
-
-/**
- * @since 3.0
- */
-
-public class LongHolder extends Holder<Long> {
- private static final long serialVersionUID = 1L;
-
- public LongHolder() {
- super(Long.class);
- }
-
- public LongHolder(Long value) {
- super(Long.class, value);
- }
-
- public LongHolder(Integer value) {
- super(Long.class, (value != null ? value.longValue() : null));
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.holders;
+
+/**
+ * @since 3.0
+ */
+
+public class LongHolder extends Holder<Long> {
+ private static final long serialVersionUID = 1L;
+
+ public LongHolder() {
+ super(Long.class);
+ }
+
+ public LongHolder(Long value) {
+ super(Long.class, value);
+ }
+
+ public LongHolder(Integer value) {
+ super(Long.class, (value != null ? value.longValue() : null));
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/NVPair.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/NVPair.java
index 4e75c265f5..7e0adf8552 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/NVPair.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/NVPair.java
@@ -1,52 +1,52 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.holders;
-
-import java.io.Serializable;
-
-/**
- * Name/Value pair used in sql bind base list for named binds
- */
-public class NVPair implements Serializable {
- private static final long serialVersionUID = 1L;
-
- private String m_name;
- private Object m_value;
- private Class m_nullType;
-
- public NVPair(String name, Object value) {
- m_name = name;
- m_value = value;
- }
-
- public NVPair(String name, Object value, Class nullType) {
- m_name = name;
- m_value = value;
- m_nullType = nullType;
- }
-
- public String getName() {
- return m_name;
- }
-
- public Object getValue() {
- return m_value;
- }
-
- public Class getNullType() {
- return m_nullType;
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName() + "[" + getName() + "=" + getValue() + "]";
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.holders;
+
+import java.io.Serializable;
+
+/**
+ * Name/Value pair used in sql bind base list for named binds
+ */
+public class NVPair implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private String m_name;
+ private Object m_value;
+ private Class m_nullType;
+
+ public NVPair(String name, Object value) {
+ m_name = name;
+ m_value = value;
+ }
+
+ public NVPair(String name, Object value, Class nullType) {
+ m_name = name;
+ m_value = value;
+ m_nullType = nullType;
+ }
+
+ public String getName() {
+ return m_name;
+ }
+
+ public Object getValue() {
+ return m_value;
+ }
+
+ public Class getNullType() {
+ return m_nullType;
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + "[" + getName() + "=" + getValue() + "]";
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/ObjectArrayHolder.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/ObjectArrayHolder.java
index 45f0315769..dc41c56b0a 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/ObjectArrayHolder.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/ObjectArrayHolder.java
@@ -1,28 +1,28 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.holders;
-
-/**
- * @since 3.0
- */
-
-public class ObjectArrayHolder extends Holder<Object[]> {
- private static final long serialVersionUID = 1L;
-
- public ObjectArrayHolder() {
- super(Object[].class);
- }
-
- public ObjectArrayHolder(Object[] value) {
- super(Object[].class, value);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.holders;
+
+/**
+ * @since 3.0
+ */
+
+public class ObjectArrayHolder extends Holder<Object[]> {
+ private static final long serialVersionUID = 1L;
+
+ public ObjectArrayHolder() {
+ super(Object[].class);
+ }
+
+ public ObjectArrayHolder(Object[] value) {
+ super(Object[].class, value);
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/ObjectHolder.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/ObjectHolder.java
index c23cf0ae7c..d29082818d 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/ObjectHolder.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/ObjectHolder.java
@@ -1,28 +1,28 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.holders;
-
-/**
- * @since 3.0
- */
-
-public class ObjectHolder extends Holder<Object> {
- private static final long serialVersionUID = 1L;
-
- public ObjectHolder() {
- super(Object.class);
- }
-
- public ObjectHolder(Object value) {
- super(Object.class, value);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.holders;
+
+/**
+ * @since 3.0
+ */
+
+public class ObjectHolder extends Holder<Object> {
+ private static final long serialVersionUID = 1L;
+
+ public ObjectHolder() {
+ super(Object.class);
+ }
+
+ public ObjectHolder(Object value) {
+ super(Object.class, value);
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/StringArrayHolder.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/StringArrayHolder.java
index 7a40671a7f..44a5495d63 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/StringArrayHolder.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/StringArrayHolder.java
@@ -1,28 +1,28 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.holders;
-
-/**
- * @since 3.0
- */
-
-public class StringArrayHolder extends Holder<String[]> {
- private static final long serialVersionUID = 1L;
-
- public StringArrayHolder() {
- super(String[].class);
- }
-
- public StringArrayHolder(String[] value) {
- super(String[].class, value);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.holders;
+
+/**
+ * @since 3.0
+ */
+
+public class StringArrayHolder extends Holder<String[]> {
+ private static final long serialVersionUID = 1L;
+
+ public StringArrayHolder() {
+ super(String[].class);
+ }
+
+ public StringArrayHolder(String[] value) {
+ super(String[].class, value);
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/StringHolder.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/StringHolder.java
index 5b16a5d353..6957e2380a 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/StringHolder.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/StringHolder.java
@@ -1,32 +1,32 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.holders;
-
-/**
- * @since 3.0
- */
-
-public class StringHolder extends Holder<String> {
- private static final long serialVersionUID = 1L;
-
- public StringHolder() {
- super(String.class);
- }
-
- public StringHolder(String value) {
- super(String.class, value);
- }
-
- @Override
- public String toString() {
- return getValue();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.holders;
+
+/**
+ * @since 3.0
+ */
+
+public class StringHolder extends Holder<String> {
+ private static final long serialVersionUID = 1L;
+
+ public StringHolder() {
+ super(String.class);
+ }
+
+ public StringHolder(String value) {
+ super(String.class, value);
+ }
+
+ @Override
+ public String toString() {
+ return getValue();
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/TableHolderFilter.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/TableHolderFilter.java
index 904df1357f..ba2b8b6360 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/TableHolderFilter.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/holders/TableHolderFilter.java
@@ -1,47 +1,47 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.holders;
-
-import java.util.HashSet;
-
-public class TableHolderFilter {
- private ITableHolder m_table;
- private HashSet<Integer> m_rowStates;
-
- public TableHolderFilter(ITableHolder table, int... rowStates) {
- m_table = table;
- m_rowStates = new HashSet<Integer>();
- if (rowStates != null) {
- for (int i : rowStates) {
- m_rowStates.add(i);
- }
- }
- }
-
- public ITableHolder getTableHolder() {
- return m_table;
- }
-
- public int[] getFilteredRows() {
- int[] a = new int[m_table.getRowCount()];
- int filterIndex = 0;
- for (int r = 0, nr = m_table.getRowCount(); r < nr; r++) {
- int state = m_table.getRowState(r);
- if (m_rowStates.contains(state)) {
- a[filterIndex] = r;
- filterIndex++;
- }
- }
- int[] b = new int[filterIndex];
- System.arraycopy(a, 0, b, 0, b.length);
- return b;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.holders;
+
+import java.util.HashSet;
+
+public class TableHolderFilter {
+ private ITableHolder m_table;
+ private HashSet<Integer> m_rowStates;
+
+ public TableHolderFilter(ITableHolder table, int... rowStates) {
+ m_table = table;
+ m_rowStates = new HashSet<Integer>();
+ if (rowStates != null) {
+ for (int i : rowStates) {
+ m_rowStates.add(i);
+ }
+ }
+ }
+
+ public ITableHolder getTableHolder() {
+ return m_table;
+ }
+
+ public int[] getFilteredRows() {
+ int[] a = new int[m_table.getRowCount()];
+ int filterIndex = 0;
+ for (int r = 0, nr = m_table.getRowCount(); r < nr; r++) {
+ int state = m_table.getRowState(r);
+ if (m_rowStates.contains(state)) {
+ a[filterIndex] = r;
+ filterIndex++;
+ }
+ }
+ int[] b = new int[filterIndex];
+ System.arraycopy(a, 0, b, 0, b.length);
+ return b;
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/html/tests/TestHTMLUtility.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/html/tests/TestHTMLUtility.java
index d4c0fd1a7b..c9c3a29098 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/html/tests/TestHTMLUtility.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/html/tests/TestHTMLUtility.java
@@ -1,39 +1,39 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.html.tests;
-
-import java.io.File;
-import java.io.FileReader;
-
-import javax.swing.text.html.HTMLDocument;
-
-import org.eclipse.scout.commons.CSSPatch;
-import org.eclipse.scout.commons.HTMLUtility;
-import org.eclipse.scout.commons.IOUtility;
-
-/**
- *
- */
-public class TestHTMLUtility {
- public static void main(String[] args) throws Exception {
- new TestHTMLUtility().run();
- }
-
- public void run() throws Exception {
- CSSPatch.apply();
- //
- String s1 = IOUtility.getContent(new FileReader(new File("D:/TEMP/original.html")));
- HTMLDocument doc = HTMLUtility.toHtmlDocument(s1);
- String s2 = HTMLUtility.toHtmlText(doc);
- System.out.println(s2);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.html.tests;
+
+import java.io.File;
+import java.io.FileReader;
+
+import javax.swing.text.html.HTMLDocument;
+
+import org.eclipse.scout.commons.CSSPatch;
+import org.eclipse.scout.commons.HTMLUtility;
+import org.eclipse.scout.commons.IOUtility;
+
+/**
+ *
+ */
+public class TestHTMLUtility {
+ public static void main(String[] args) throws Exception {
+ new TestHTMLUtility().run();
+ }
+
+ public void run() throws Exception {
+ CSSPatch.apply();
+ //
+ String s1 = IOUtility.getContent(new FileReader(new File("D:/TEMP/original.html")));
+ HTMLDocument doc = HTMLUtility.toHtmlDocument(s1);
+ String s2 = HTMLUtility.toHtmlText(doc);
+ System.out.println(s2);
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/internal/Activator.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/internal/Activator.java
index 596f9cc286..3384bf77b3 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/internal/Activator.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/internal/Activator.java
@@ -1,47 +1,47 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.internal;
-
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.scout.commons.CollationRulesPatch;
-import org.osgi.framework.BundleContext;
-
-public class Activator extends Plugin {
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.scout.commons";
- // The shared instance
- private static Activator m_plugin;
-
- public Activator() {
- }
-
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- m_plugin = this;
- CollationRulesPatch.patchDefaultCollationRules();
- }
-
- @Override
- public void stop(BundleContext context) throws Exception {
- m_plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return m_plugin;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.internal;
+
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.scout.commons.CollationRulesPatch;
+import org.osgi.framework.BundleContext;
+
+public class Activator extends Plugin {
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.scout.commons";
+ // The shared instance
+ private static Activator m_plugin;
+
+ public Activator() {
+ }
+
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ m_plugin = this;
+ CollationRulesPatch.patchDefaultCollationRules();
+ }
+
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ m_plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return m_plugin;
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/internal/test/TestPublicKeyUtility.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/internal/test/TestPublicKeyUtility.java
index d08741ff90..f8869951ba 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/internal/test/TestPublicKeyUtility.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/internal/test/TestPublicKeyUtility.java
@@ -1,34 +1,34 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.internal.test;
-
-import org.eclipse.scout.commons.Base64Utility;
-import org.eclipse.scout.commons.PublicKeyUtility;
-
-public final class TestPublicKeyUtility {
-
- private TestPublicKeyUtility() {
- }
-
- public static void main(String[] args) throws Exception {
- byte[][] tmp = PublicKeyUtility.createKeyPair(null, 1024);
- byte[] publicKey = tmp[0];
- byte[] privateKey = tmp[1];
- System.out.println("public key: " + Base64Utility.encode(publicKey));
- System.out.println("private key:" + Base64Utility.encode(privateKey));
- byte[] data = "Hello World".getBytes();
- //
- byte[] sig = PublicKeyUtility.sign(data, privateKey, null, null);
- System.out.println("signature: " + Base64Utility.encode(sig));
- boolean verify = PublicKeyUtility.verify(data, publicKey, sig, null, null);
- System.out.println("verify: " + verify);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.internal.test;
+
+import org.eclipse.scout.commons.Base64Utility;
+import org.eclipse.scout.commons.PublicKeyUtility;
+
+public final class TestPublicKeyUtility {
+
+ private TestPublicKeyUtility() {
+ }
+
+ public static void main(String[] args) throws Exception {
+ byte[][] tmp = PublicKeyUtility.createKeyPair(null, 1024);
+ byte[] publicKey = tmp[0];
+ byte[] privateKey = tmp[1];
+ System.out.println("public key: " + Base64Utility.encode(publicKey));
+ System.out.println("private key:" + Base64Utility.encode(privateKey));
+ byte[] data = "Hello World".getBytes();
+ //
+ byte[] sig = PublicKeyUtility.sign(data, privateKey, null, null);
+ System.out.println("signature: " + Base64Utility.encode(sig));
+ boolean verify = PublicKeyUtility.verify(data, publicKey, sig, null, null);
+ System.out.println("verify: " + verify);
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/internal/tripledes/TripleDES.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/internal/tripledes/TripleDES.java
index 47534eea9e..09ffc87991 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/internal/tripledes/TripleDES.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/internal/tripledes/TripleDES.java
@@ -1,274 +1,274 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.internal.tripledes;
-
-//3 x 64 =192 bit key DES
-public final class TripleDES {
- private DESKey k1;
- private DESKey k2;
- private DESKey k3;
-
- public TripleDES(byte[] key192Bit) {
- if (key192Bit.length == 0) {
- throw new ArrayIndexOutOfBoundsException("Creating a zero-length triple-DES key");
- }
- if (key192Bit.length < 24) {
- byte[] k = new byte[24];
- for (int i = 0; i < 24; i += key192Bit.length) {
- System.arraycopy(key192Bit, 0, k, i, Math.min(key192Bit.length, 24 - i));
- }
- key192Bit = k;
- }
- k1 = new DESKey(makeLong(key192Bit, 0, 8));
- k2 = new DESKey(makeLong(key192Bit, 8, 8));
- k3 = new DESKey(makeLong(key192Bit, 16, 8));
- }
-
- public byte[] encrypt(byte[] plain) {
- if (plain == null || plain.length == 0) {
- return new byte[0];
- }
- int len = plain.length;
- byte[] cipher = new byte[((len + plainBlockSize() - 1) / plainBlockSize()) * plainBlockSize()];
- for (int i = 0; i < cipher.length; i = i + plainBlockSize()) {
- if (i + plainBlockSize() <= plain.length) {
- encryptBlock(plain, i, cipher, i);
- }
- else {
- // temporary array
- byte[] tmp = new byte[plainBlockSize()];
- System.arraycopy(plain, i, tmp, 0, plain.length - i);
- encryptBlock(tmp, 0, cipher, i);
- }
- }
- return cipher;
- }
-
- public byte[] decrypt(byte[] cipher) {
- return decrypt(cipher, false);
- }
-
- public byte[] decrypt(byte[] cipher, boolean removeEndingZeros) {
- if (cipher == null || cipher.length == 0) {
- return new byte[0];
- }
- int len = cipher.length;
- if (len % plainBlockSize() != 0) {
- throw new IllegalArgumentException("cipher length must be multiple of " + plainBlockSize());
- }
- byte[] plain = new byte[len];
- for (int i = 0; i < cipher.length; i = i + plainBlockSize()) {
- decryptBlock(cipher, i, plain, i);
- }
- if (removeEndingZeros) {
- int reducedLen = len;
- while (reducedLen > 0 && plain[reducedLen - 1] == 0x00) {
- reducedLen--;
- }
- if (reducedLen < len) {
- byte[] newPlain = new byte[reducedLen];
- System.arraycopy(plain, 0, newPlain, 0, reducedLen);
- plain = newPlain;
- }
- }
- return plain;
- }
-
- public void destroy() {
- if (k1 != null) {
- k1.destroy();
- }
- k1 = null;
- if (k2 != null) {
- k2.destroy();
- }
- k2 = null;
- if (k3 != null) {
- k3.destroy();
- }
- k3 = null;
- }
-
- private int plainBlockSize() {
- return 8;
- }
-
- private byte[] getKey() {
- byte[] k = new byte[24];
- System.arraycopy(k1.getKey(), 0, k, 0, 8);
- System.arraycopy(k2.getKey(), 0, k, 8, 8);
- System.arraycopy(k3.getKey(), 0, k, 16, 8);
- return k;
- }
-
- private static long pickBits(long a, byte[] bits) {
- long r = 0;
- int l = bits.length;
- for (int b = 0; b < l; b++) {
- r = (r << 1) | ((a >>> (63 - bits[b])) & 1);
- }
- return r;
- }
-
- private void encryptBlock(byte[] source, int i, byte[] dest, int j) {
- long block = makeLong(source, i, 8);
- block = pickBits(block, DESKey.IP);
- block = k1.subCrypt(block);
- block = k2.subDecrypt(block);
- block = k3.subCrypt(block);
- block = pickBits(block, DESKey.FP);
- writeBytes(block, dest, j, 8);
- }
-
- private void decryptBlock(byte[] source, int i, byte[] dest, int j) {
- long block = makeLong(source, i, 8);
- block = pickBits(block, DESKey.IP);
- block = k3.subDecrypt(block);
- block = k2.subCrypt(block);
- block = k1.subDecrypt(block);
- block = pickBits(block, DESKey.FP);
- writeBytes(block, dest, j, 8);
- }
-
- private static void writeBytes(long a, byte[] dest, int i, int length) {
- for (int j = i + length - 1; j >= i; j--) {
- dest[j] = (byte) a;
- a = a >>> 8;
- }
- }
-
- private static long makeLong(byte[] buf, int i, int length) {
- long r = 0;
- length += i;
- for (int j = i; j < length; j++) {
- r = (r << 8) | (buf[j] & 0xffL);
- }
- return r;
- }
-
- /*
- * 64 bit key
- */
- private static class DESKey {
- private long key;
- private long[] subKeys;
-
- protected DESKey(byte[] key) {
- this.key = makeLong(key, 0, 8);
- buildSubKeys();
- }
-
- protected DESKey(long key) {
- this.key = key;
- buildSubKeys();
- }
-
- protected void destroy() {
- key = 0;
- if (subKeys != null && subKeys.length > 0) {
- for (int i = 0; i < subKeys.length; i++) {
- subKeys[i] = 0;
- }
- }
- subKeys = null;
- }
-
- protected byte[] getKey() {
- byte[] a = new byte[8];
- writeBytes(key, a, 0, 8);
- return a;
- }
-
- protected long subCrypt(long block) {
- int i = (int) (block >>> 32);
- int r = (int) block;
- for (int k = 0; k < 16; k++) {
- int t = i;
- i = r;
- r = t ^ f(r, subKeys[k]);
- }
- return ((long) r << 32) | (i & 0xffffffffL);
- }
-
- protected void encrypt(byte[] source, int i, byte[] dest, int j) {
- long block = makeLong(source, i, 8);
- block = pickBits(block, IP);
- block = subCrypt(block);
- block = pickBits(block, FP);
- writeBytes(block, dest, j, 8);
- }
-
- protected long subDecrypt(long block) {
- int i = (int) (block >>> 32);
- int r = (int) block;
- for (int k = 15; k >= 0; k--) {
- int t = i;
- i = r;
- r = t ^ f(r, subKeys[k]);
- }
- return ((long) r << 32) | (i & 0xffffffffL);
- }
-
- protected void decrypt(byte[] source, int i, byte[] dest, int j) {
- long block = makeLong(source, i, 8);
- block = pickBits(block, IP);
- block = subDecrypt(block);
- block = pickBits(block, FP);
- writeBytes(block, dest, j, 8);
- }
-
- private void buildSubKeys() {
- long k = pickBits(key, PC1);
- subKeys = new long[16];
- for (int i = 0; i < 16; i++) {
- if ((i == 0) || (i == 1) || (i == 8) || (i == 15)) {
- k = ((k << 1) & 0xffffffeffffffeL) | ((k >>> 27) & 0x00000010000001L);
- }
- else {
- k = ((k << 2) & 0xffffffcffffffcL) | ((k >>> 26) & 0x00000030000003L);
- }
- subKeys[i] = pickBits(k, PC2);
- }
- }
-
- /**
- * TRIPLE*DES MATRIX
- */
- private static final byte[] PC1 = {56, 48, 40, 32, 24, 16, 8, 0, 57, 49, 41, 33, 25, 17, 9, 1, 58, 50, 42, 34, 26, 18, 10, 2, 59, 51, 43, 35, 62, 54, 46, 38, 30, 22, 14, 6, 61, 53, 45, 37, 29, 21, 13, 5, 60, 52, 44, 36, 28, 20, 12, 4, 27, 19, 11, 3};
-
- private static final byte[] PC2 = {21, 24, 18, 31, 8, 12, 10, 35, 22, 13, 28, 17, 30, 26, 19, 11, 33, 15, 23, 14, 34, 27, 20, 9, 48, 59, 38, 44, 54, 62, 37, 47, 58, 52, 40, 55, 51, 56, 46, 63, 41, 60, 53, 49, 57, 43, 36, 39};
-
- private static final int[] S1 = {0x00808200, 0x00000000, 0x00008000, 0x00808202, 0x00808002, 0x00008202, 0x00000002, 0x00008000, 0x00000200, 0x00808200, 0x00808202, 0x00000200, 0x00800202, 0x00808002, 0x00800000, 0x00000002, 0x00000202, 0x00800200, 0x00800200, 0x00008200, 0x00008200, 0x00808000, 0x00808000, 0x00800202, 0x00008002, 0x00800002, 0x00800002, 0x00008002, 0x00000000, 0x00000202, 0x00008202, 0x00800000, 0x00008000, 0x00808202, 0x00000002, 0x00808000, 0x00808200, 0x00800000, 0x00800000, 0x00000200, 0x00808002, 0x00008000, 0x00008200, 0x00800002, 0x00000200, 0x00000002, 0x00800202, 0x00008202, 0x00808202, 0x00008002, 0x00808000, 0x00800202, 0x00800002, 0x00000202, 0x00008202, 0x00808200, 0x00000202, 0x00800200, 0x00800200, 0x00000000, 0x00008002, 0x00008200, 0x00000000, 0x00808002};
-
- private static final int[] S2 = {0x40084010, 0x40004000, 0x00004000, 0x00084010, 0x00080000, 0x00000010, 0x40080010, 0x40004010, 0x40000010, 0x40084010, 0x40084000, 0x40000000, 0x40004000, 0x00080000, 0x00000010, 0x40080010, 0x00084000, 0x00080010, 0x40004010, 0x00000000, 0x40000000, 0x00004000, 0x00084010, 0x40080000, 0x00080010, 0x40000010, 0x00000000, 0x00084000, 0x00004010, 0x40084000, 0x40080000, 0x00004010, 0x00000000, 0x00084010, 0x40080010, 0x00080000, 0x40004010, 0x40080000, 0x40084000, 0x00004000, 0x40080000, 0x40004000, 0x00000010, 0x40084010, 0x00084010, 0x00000010, 0x00004000, 0x40000000, 0x00004010, 0x40084000, 0x00080000, 0x40000010, 0x00080010, 0x40004010, 0x40000010, 0x00080010, 0x00084000, 0x00000000, 0x40004000, 0x00004010, 0x40000000, 0x40080010, 0x40084010, 0x00084000};
-
- private static final int[] S3 = {0x00000104, 0x04010100, 0x00000000, 0x04010004, 0x04000100, 0x00000000, 0x00010104, 0x04000100, 0x00010004, 0x04000004, 0x04000004, 0x00010000, 0x04010104, 0x00010004, 0x04010000, 0x00000104, 0x04000000, 0x00000004, 0x04010100, 0x00000100, 0x00010100, 0x04010000, 0x04010004, 0x00010104, 0x04000104, 0x00010100, 0x00010000, 0x04000104, 0x00000004, 0x04010104, 0x00000100, 0x04000000, 0x04010100, 0x04000000, 0x00010004, 0x00000104, 0x00010000, 0x04010100, 0x04000100, 0x00000000, 0x00000100, 0x00010004, 0x04010104, 0x04000100, 0x04000004, 0x00000100, 0x00000000, 0x04010004, 0x04000104, 0x00010000, 0x04000000, 0x04010104, 0x00000004, 0x00010104, 0x00010100, 0x04000004, 0x04010000, 0x04000104, 0x00000104, 0x04010000, 0x00010104, 0x00000004, 0x04010004, 0x00010100};
-
- private static final int[] S4 = {0x80401000, 0x80001040, 0x80001040, 0x00000040, 0x00401040, 0x80400040, 0x80400000, 0x80001000, 0x00000000, 0x00401000, 0x00401000, 0x80401040, 0x80000040, 0x00000000, 0x00400040, 0x80400000, 0x80000000, 0x00001000, 0x00400000, 0x80401000, 0x00000040, 0x00400000, 0x80001000, 0x00001040, 0x80400040, 0x80000000, 0x00001040, 0x00400040, 0x00001000, 0x00401040, 0x80401040, 0x80000040, 0x00400040, 0x80400000, 0x00401000, 0x80401040, 0x80000040, 0x00000000, 0x00000000, 0x00401000, 0x00001040, 0x00400040, 0x80400040, 0x80000000, 0x80401000, 0x80001040, 0x80001040, 0x00000040, 0x80401040, 0x80000040, 0x80000000, 0x00001000, 0x80400000, 0x80001000, 0x00401040, 0x80400040, 0x80001000, 0x00001040, 0x00400000, 0x80401000, 0x00000040, 0x00400000, 0x00001000, 0x00401040};
-
- private static final int[] S5 = {0x00000080, 0x01040080, 0x01040000, 0x21000080, 0x00040000, 0x00000080, 0x20000000, 0x01040000, 0x20040080, 0x00040000, 0x01000080, 0x20040080, 0x21000080, 0x21040000, 0x00040080, 0x20000000, 0x01000000, 0x20040000, 0x20040000, 0x00000000, 0x20000080, 0x21040080, 0x21040080, 0x01000080, 0x21040000, 0x20000080, 0x00000000, 0x21000000, 0x01040080, 0x01000000, 0x21000000, 0x00040080, 0x00040000, 0x21000080, 0x00000080, 0x01000000, 0x20000000, 0x01040000, 0x21000080, 0x20040080, 0x01000080, 0x20000000, 0x21040000, 0x01040080, 0x20040080, 0x00000080, 0x01000000, 0x21040000, 0x21040080, 0x00040080, 0x21000000, 0x21040080, 0x01040000, 0x00000000, 0x20040000, 0x21000000, 0x00040080, 0x01000080, 0x20000080, 0x00040000, 0x00000000, 0x20040000, 0x01040080, 0x20000080};
-
- private static final int[] S6 = {0x10000008, 0x10200000, 0x00002000, 0x10202008, 0x10200000, 0x00000008, 0x10202008, 0x00200000, 0x10002000, 0x00202008, 0x00200000, 0x10000008, 0x00200008, 0x10002000, 0x10000000, 0x00002008, 0x00000000, 0x00200008, 0x10002008, 0x00002000, 0x00202000, 0x10002008, 0x00000008, 0x10200008, 0x10200008, 0x00000000, 0x00202008, 0x10202000, 0x00002008, 0x00202000, 0x10202000, 0x10000000, 0x10002000, 0x00000008, 0x10200008, 0x00202000, 0x10202008, 0x00200000, 0x00002008, 0x10000008, 0x00200000, 0x10002000, 0x10000000, 0x00002008, 0x10000008, 0x10202008, 0x00202000, 0x10200000, 0x00202008, 0x10202000, 0x00000000, 0x10200008, 0x00000008, 0x00002000, 0x10200000, 0x00202008, 0x00002000, 0x00200008, 0x10002008, 0x00000000, 0x10202000, 0x10000000, 0x00200008, 0x10002008};
-
- private static final int[] S7 = {0x00100000, 0x02100001, 0x02000401, 0x00000000, 0x00000400, 0x02000401, 0x00100401, 0x02100400, 0x02100401, 0x00100000, 0x00000000, 0x02000001, 0x00000001, 0x02000000, 0x02100001, 0x00000401, 0x02000400, 0x00100401, 0x00100001, 0x02000400, 0x02000001, 0x02100000, 0x02100400, 0x00100001, 0x02100000, 0x00000400, 0x00000401, 0x02100401, 0x00100400, 0x00000001, 0x02000000, 0x00100400, 0x02000000, 0x00100400, 0x00100000, 0x02000401, 0x02000401, 0x02100001, 0x02100001, 0x00000001, 0x00100001, 0x02000000, 0x02000400, 0x00100000, 0x02100400, 0x00000401, 0x00100401, 0x02100400, 0x00000401, 0x02000001, 0x02100401, 0x02100000, 0x00100400, 0x00000000, 0x00000001, 0x02100401, 0x00000000, 0x00100401, 0x02100000, 0x00000400, 0x02000001, 0x02000400, 0x00000400, 0x00100001};
-
- private static final int[] S8 = {0x08000820, 0x00000800, 0x00020000, 0x08020820, 0x08000000, 0x08000820, 0x00000020, 0x08000000, 0x00020020, 0x08020000, 0x08020820, 0x00020800, 0x08020800, 0x00020820, 0x00000800, 0x00000020, 0x08020000, 0x08000020, 0x08000800, 0x00000820, 0x00020800, 0x00020020, 0x08020020, 0x08020800, 0x00000820, 0x00000000, 0x00000000, 0x08020020, 0x08000020, 0x08000800, 0x00020820, 0x00020000, 0x00020820, 0x00020000, 0x08020800, 0x00000800, 0x00000020, 0x08020020, 0x00000800, 0x00020820, 0x08000800, 0x00000020, 0x08000020, 0x08020000, 0x08020020, 0x08000000, 0x00020000, 0x08000820, 0x00000000, 0x08020820, 0x00020020, 0x08000020, 0x08020000, 0x08000800, 0x08000820, 0x00000000, 0x08020820, 0x00020800, 0x00020800, 0x00000820, 0x00000820, 0x00020020, 0x08000000, 0x08020800};
-
- protected static final byte[] IP = {57, 49, 41, 33, 25, 17, 9, 1, 59, 51, 43, 35, 27, 19, 11, 3, 61, 53, 45, 37, 29, 21, 13, 5, 63, 55, 47, 39, 31, 23, 15, 7, 56, 48, 40, 32, 24, 16, 8, 0, 58, 50, 42, 34, 26, 18, 10, 2, 60, 52, 44, 36, 28, 20, 12, 4, 62, 54, 46, 38, 30, 22, 14, 6,};
-
- protected static final byte[] FP = {39, 7, 47, 15, 55, 23, 63, 31, 38, 6, 46, 14, 54, 22, 62, 30, 37, 5, 45, 13, 53, 21, 61, 29, 36, 4, 44, 12, 52, 20, 60, 28, 35, 3, 43, 11, 51, 19, 59, 27, 34, 2, 42, 10, 50, 18, 58, 26, 33, 1, 41, 9, 49, 17, 57, 25, 32, 0, 40, 8, 48, 16, 56, 24};
-
- private static int f(int r, long k) {
- return S1[(int) ((((r << 5) & 0x20) | ((r >>> 27) & 0x1f)) ^ ((k >>> 42) & 0x3f))] | S2[(int) (((r >>> 23) & 0x3f) ^ ((k >>> 36) & 0x3f))] | S3[(int) (((r >>> 19) & 0x3f) ^ ((k >>> 30) & 0x3f))] | S4[(int) (((r >>> 15) & 0x3f) ^ ((k >>> 24) & 0x3f))] | S5[(int) (((r >>> 11) & 0x3f) ^ ((k >>> 18) & 0x3f))] | S6[(int) (((r >>> 7) & 0x3f) ^ ((k >>> 12) & 0x3f))] | S7[(int) (((r >>> 3) & 0x3f) ^ ((k >>> 6) & 0x3f))] | S8[(int) ((((r >>> 31) & 0x01) | ((r << 1) & 0x3e)) ^ (k & 0x3f))];
- }
-
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.internal.tripledes;
+
+//3 x 64 =192 bit key DES
+public final class TripleDES {
+ private DESKey k1;
+ private DESKey k2;
+ private DESKey k3;
+
+ public TripleDES(byte[] key192Bit) {
+ if (key192Bit.length == 0) {
+ throw new ArrayIndexOutOfBoundsException("Creating a zero-length triple-DES key");
+ }
+ if (key192Bit.length < 24) {
+ byte[] k = new byte[24];
+ for (int i = 0; i < 24; i += key192Bit.length) {
+ System.arraycopy(key192Bit, 0, k, i, Math.min(key192Bit.length, 24 - i));
+ }
+ key192Bit = k;
+ }
+ k1 = new DESKey(makeLong(key192Bit, 0, 8));
+ k2 = new DESKey(makeLong(key192Bit, 8, 8));
+ k3 = new DESKey(makeLong(key192Bit, 16, 8));
+ }
+
+ public byte[] encrypt(byte[] plain) {
+ if (plain == null || plain.length == 0) {
+ return new byte[0];
+ }
+ int len = plain.length;
+ byte[] cipher = new byte[((len + plainBlockSize() - 1) / plainBlockSize()) * plainBlockSize()];
+ for (int i = 0; i < cipher.length; i = i + plainBlockSize()) {
+ if (i + plainBlockSize() <= plain.length) {
+ encryptBlock(plain, i, cipher, i);
+ }
+ else {
+ // temporary array
+ byte[] tmp = new byte[plainBlockSize()];
+ System.arraycopy(plain, i, tmp, 0, plain.length - i);
+ encryptBlock(tmp, 0, cipher, i);
+ }
+ }
+ return cipher;
+ }
+
+ public byte[] decrypt(byte[] cipher) {
+ return decrypt(cipher, false);
+ }
+
+ public byte[] decrypt(byte[] cipher, boolean removeEndingZeros) {
+ if (cipher == null || cipher.length == 0) {
+ return new byte[0];
+ }
+ int len = cipher.length;
+ if (len % plainBlockSize() != 0) {
+ throw new IllegalArgumentException("cipher length must be multiple of " + plainBlockSize());
+ }
+ byte[] plain = new byte[len];
+ for (int i = 0; i < cipher.length; i = i + plainBlockSize()) {
+ decryptBlock(cipher, i, plain, i);
+ }
+ if (removeEndingZeros) {
+ int reducedLen = len;
+ while (reducedLen > 0 && plain[reducedLen - 1] == 0x00) {
+ reducedLen--;
+ }
+ if (reducedLen < len) {
+ byte[] newPlain = new byte[reducedLen];
+ System.arraycopy(plain, 0, newPlain, 0, reducedLen);
+ plain = newPlain;
+ }
+ }
+ return plain;
+ }
+
+ public void destroy() {
+ if (k1 != null) {
+ k1.destroy();
+ }
+ k1 = null;
+ if (k2 != null) {
+ k2.destroy();
+ }
+ k2 = null;
+ if (k3 != null) {
+ k3.destroy();
+ }
+ k3 = null;
+ }
+
+ private int plainBlockSize() {
+ return 8;
+ }
+
+ private byte[] getKey() {
+ byte[] k = new byte[24];
+ System.arraycopy(k1.getKey(), 0, k, 0, 8);
+ System.arraycopy(k2.getKey(), 0, k, 8, 8);
+ System.arraycopy(k3.getKey(), 0, k, 16, 8);
+ return k;
+ }
+
+ private static long pickBits(long a, byte[] bits) {
+ long r = 0;
+ int l = bits.length;
+ for (int b = 0; b < l; b++) {
+ r = (r << 1) | ((a >>> (63 - bits[b])) & 1);
+ }
+ return r;
+ }
+
+ private void encryptBlock(byte[] source, int i, byte[] dest, int j) {
+ long block = makeLong(source, i, 8);
+ block = pickBits(block, DESKey.IP);
+ block = k1.subCrypt(block);
+ block = k2.subDecrypt(block);
+ block = k3.subCrypt(block);
+ block = pickBits(block, DESKey.FP);
+ writeBytes(block, dest, j, 8);
+ }
+
+ private void decryptBlock(byte[] source, int i, byte[] dest, int j) {
+ long block = makeLong(source, i, 8);
+ block = pickBits(block, DESKey.IP);
+ block = k3.subDecrypt(block);
+ block = k2.subCrypt(block);
+ block = k1.subDecrypt(block);
+ block = pickBits(block, DESKey.FP);
+ writeBytes(block, dest, j, 8);
+ }
+
+ private static void writeBytes(long a, byte[] dest, int i, int length) {
+ for (int j = i + length - 1; j >= i; j--) {
+ dest[j] = (byte) a;
+ a = a >>> 8;
+ }
+ }
+
+ private static long makeLong(byte[] buf, int i, int length) {
+ long r = 0;
+ length += i;
+ for (int j = i; j < length; j++) {
+ r = (r << 8) | (buf[j] & 0xffL);
+ }
+ return r;
+ }
+
+ /*
+ * 64 bit key
+ */
+ private static class DESKey {
+ private long key;
+ private long[] subKeys;
+
+ protected DESKey(byte[] key) {
+ this.key = makeLong(key, 0, 8);
+ buildSubKeys();
+ }
+
+ protected DESKey(long key) {
+ this.key = key;
+ buildSubKeys();
+ }
+
+ protected void destroy() {
+ key = 0;
+ if (subKeys != null && subKeys.length > 0) {
+ for (int i = 0; i < subKeys.length; i++) {
+ subKeys[i] = 0;
+ }
+ }
+ subKeys = null;
+ }
+
+ protected byte[] getKey() {
+ byte[] a = new byte[8];
+ writeBytes(key, a, 0, 8);
+ return a;
+ }
+
+ protected long subCrypt(long block) {
+ int i = (int) (block >>> 32);
+ int r = (int) block;
+ for (int k = 0; k < 16; k++) {
+ int t = i;
+ i = r;
+ r = t ^ f(r, subKeys[k]);
+ }
+ return ((long) r << 32) | (i & 0xffffffffL);
+ }
+
+ protected void encrypt(byte[] source, int i, byte[] dest, int j) {
+ long block = makeLong(source, i, 8);
+ block = pickBits(block, IP);
+ block = subCrypt(block);
+ block = pickBits(block, FP);
+ writeBytes(block, dest, j, 8);
+ }
+
+ protected long subDecrypt(long block) {
+ int i = (int) (block >>> 32);
+ int r = (int) block;
+ for (int k = 15; k >= 0; k--) {
+ int t = i;
+ i = r;
+ r = t ^ f(r, subKeys[k]);
+ }
+ return ((long) r << 32) | (i & 0xffffffffL);
+ }
+
+ protected void decrypt(byte[] source, int i, byte[] dest, int j) {
+ long block = makeLong(source, i, 8);
+ block = pickBits(block, IP);
+ block = subDecrypt(block);
+ block = pickBits(block, FP);
+ writeBytes(block, dest, j, 8);
+ }
+
+ private void buildSubKeys() {
+ long k = pickBits(key, PC1);
+ subKeys = new long[16];
+ for (int i = 0; i < 16; i++) {
+ if ((i == 0) || (i == 1) || (i == 8) || (i == 15)) {
+ k = ((k << 1) & 0xffffffeffffffeL) | ((k >>> 27) & 0x00000010000001L);
+ }
+ else {
+ k = ((k << 2) & 0xffffffcffffffcL) | ((k >>> 26) & 0x00000030000003L);
+ }
+ subKeys[i] = pickBits(k, PC2);
+ }
+ }
+
+ /**
+ * TRIPLE*DES MATRIX
+ */
+ private static final byte[] PC1 = {56, 48, 40, 32, 24, 16, 8, 0, 57, 49, 41, 33, 25, 17, 9, 1, 58, 50, 42, 34, 26, 18, 10, 2, 59, 51, 43, 35, 62, 54, 46, 38, 30, 22, 14, 6, 61, 53, 45, 37, 29, 21, 13, 5, 60, 52, 44, 36, 28, 20, 12, 4, 27, 19, 11, 3};
+
+ private static final byte[] PC2 = {21, 24, 18, 31, 8, 12, 10, 35, 22, 13, 28, 17, 30, 26, 19, 11, 33, 15, 23, 14, 34, 27, 20, 9, 48, 59, 38, 44, 54, 62, 37, 47, 58, 52, 40, 55, 51, 56, 46, 63, 41, 60, 53, 49, 57, 43, 36, 39};
+
+ private static final int[] S1 = {0x00808200, 0x00000000, 0x00008000, 0x00808202, 0x00808002, 0x00008202, 0x00000002, 0x00008000, 0x00000200, 0x00808200, 0x00808202, 0x00000200, 0x00800202, 0x00808002, 0x00800000, 0x00000002, 0x00000202, 0x00800200, 0x00800200, 0x00008200, 0x00008200, 0x00808000, 0x00808000, 0x00800202, 0x00008002, 0x00800002, 0x00800002, 0x00008002, 0x00000000, 0x00000202, 0x00008202, 0x00800000, 0x00008000, 0x00808202, 0x00000002, 0x00808000, 0x00808200, 0x00800000, 0x00800000, 0x00000200, 0x00808002, 0x00008000, 0x00008200, 0x00800002, 0x00000200, 0x00000002, 0x00800202, 0x00008202, 0x00808202, 0x00008002, 0x00808000, 0x00800202, 0x00800002, 0x00000202, 0x00008202, 0x00808200, 0x00000202, 0x00800200, 0x00800200, 0x00000000, 0x00008002, 0x00008200, 0x00000000, 0x00808002};
+
+ private static final int[] S2 = {0x40084010, 0x40004000, 0x00004000, 0x00084010, 0x00080000, 0x00000010, 0x40080010, 0x40004010, 0x40000010, 0x40084010, 0x40084000, 0x40000000, 0x40004000, 0x00080000, 0x00000010, 0x40080010, 0x00084000, 0x00080010, 0x40004010, 0x00000000, 0x40000000, 0x00004000, 0x00084010, 0x40080000, 0x00080010, 0x40000010, 0x00000000, 0x00084000, 0x00004010, 0x40084000, 0x40080000, 0x00004010, 0x00000000, 0x00084010, 0x40080010, 0x00080000, 0x40004010, 0x40080000, 0x40084000, 0x00004000, 0x40080000, 0x40004000, 0x00000010, 0x40084010, 0x00084010, 0x00000010, 0x00004000, 0x40000000, 0x00004010, 0x40084000, 0x00080000, 0x40000010, 0x00080010, 0x40004010, 0x40000010, 0x00080010, 0x00084000, 0x00000000, 0x40004000, 0x00004010, 0x40000000, 0x40080010, 0x40084010, 0x00084000};
+
+ private static final int[] S3 = {0x00000104, 0x04010100, 0x00000000, 0x04010004, 0x04000100, 0x00000000, 0x00010104, 0x04000100, 0x00010004, 0x04000004, 0x04000004, 0x00010000, 0x04010104, 0x00010004, 0x04010000, 0x00000104, 0x04000000, 0x00000004, 0x04010100, 0x00000100, 0x00010100, 0x04010000, 0x04010004, 0x00010104, 0x04000104, 0x00010100, 0x00010000, 0x04000104, 0x00000004, 0x04010104, 0x00000100, 0x04000000, 0x04010100, 0x04000000, 0x00010004, 0x00000104, 0x00010000, 0x04010100, 0x04000100, 0x00000000, 0x00000100, 0x00010004, 0x04010104, 0x04000100, 0x04000004, 0x00000100, 0x00000000, 0x04010004, 0x04000104, 0x00010000, 0x04000000, 0x04010104, 0x00000004, 0x00010104, 0x00010100, 0x04000004, 0x04010000, 0x04000104, 0x00000104, 0x04010000, 0x00010104, 0x00000004, 0x04010004, 0x00010100};
+
+ private static final int[] S4 = {0x80401000, 0x80001040, 0x80001040, 0x00000040, 0x00401040, 0x80400040, 0x80400000, 0x80001000, 0x00000000, 0x00401000, 0x00401000, 0x80401040, 0x80000040, 0x00000000, 0x00400040, 0x80400000, 0x80000000, 0x00001000, 0x00400000, 0x80401000, 0x00000040, 0x00400000, 0x80001000, 0x00001040, 0x80400040, 0x80000000, 0x00001040, 0x00400040, 0x00001000, 0x00401040, 0x80401040, 0x80000040, 0x00400040, 0x80400000, 0x00401000, 0x80401040, 0x80000040, 0x00000000, 0x00000000, 0x00401000, 0x00001040, 0x00400040, 0x80400040, 0x80000000, 0x80401000, 0x80001040, 0x80001040, 0x00000040, 0x80401040, 0x80000040, 0x80000000, 0x00001000, 0x80400000, 0x80001000, 0x00401040, 0x80400040, 0x80001000, 0x00001040, 0x00400000, 0x80401000, 0x00000040, 0x00400000, 0x00001000, 0x00401040};
+
+ private static final int[] S5 = {0x00000080, 0x01040080, 0x01040000, 0x21000080, 0x00040000, 0x00000080, 0x20000000, 0x01040000, 0x20040080, 0x00040000, 0x01000080, 0x20040080, 0x21000080, 0x21040000, 0x00040080, 0x20000000, 0x01000000, 0x20040000, 0x20040000, 0x00000000, 0x20000080, 0x21040080, 0x21040080, 0x01000080, 0x21040000, 0x20000080, 0x00000000, 0x21000000, 0x01040080, 0x01000000, 0x21000000, 0x00040080, 0x00040000, 0x21000080, 0x00000080, 0x01000000, 0x20000000, 0x01040000, 0x21000080, 0x20040080, 0x01000080, 0x20000000, 0x21040000, 0x01040080, 0x20040080, 0x00000080, 0x01000000, 0x21040000, 0x21040080, 0x00040080, 0x21000000, 0x21040080, 0x01040000, 0x00000000, 0x20040000, 0x21000000, 0x00040080, 0x01000080, 0x20000080, 0x00040000, 0x00000000, 0x20040000, 0x01040080, 0x20000080};
+
+ private static final int[] S6 = {0x10000008, 0x10200000, 0x00002000, 0x10202008, 0x10200000, 0x00000008, 0x10202008, 0x00200000, 0x10002000, 0x00202008, 0x00200000, 0x10000008, 0x00200008, 0x10002000, 0x10000000, 0x00002008, 0x00000000, 0x00200008, 0x10002008, 0x00002000, 0x00202000, 0x10002008, 0x00000008, 0x10200008, 0x10200008, 0x00000000, 0x00202008, 0x10202000, 0x00002008, 0x00202000, 0x10202000, 0x10000000, 0x10002000, 0x00000008, 0x10200008, 0x00202000, 0x10202008, 0x00200000, 0x00002008, 0x10000008, 0x00200000, 0x10002000, 0x10000000, 0x00002008, 0x10000008, 0x10202008, 0x00202000, 0x10200000, 0x00202008, 0x10202000, 0x00000000, 0x10200008, 0x00000008, 0x00002000, 0x10200000, 0x00202008, 0x00002000, 0x00200008, 0x10002008, 0x00000000, 0x10202000, 0x10000000, 0x00200008, 0x10002008};
+
+ private static final int[] S7 = {0x00100000, 0x02100001, 0x02000401, 0x00000000, 0x00000400, 0x02000401, 0x00100401, 0x02100400, 0x02100401, 0x00100000, 0x00000000, 0x02000001, 0x00000001, 0x02000000, 0x02100001, 0x00000401, 0x02000400, 0x00100401, 0x00100001, 0x02000400, 0x02000001, 0x02100000, 0x02100400, 0x00100001, 0x02100000, 0x00000400, 0x00000401, 0x02100401, 0x00100400, 0x00000001, 0x02000000, 0x00100400, 0x02000000, 0x00100400, 0x00100000, 0x02000401, 0x02000401, 0x02100001, 0x02100001, 0x00000001, 0x00100001, 0x02000000, 0x02000400, 0x00100000, 0x02100400, 0x00000401, 0x00100401, 0x02100400, 0x00000401, 0x02000001, 0x02100401, 0x02100000, 0x00100400, 0x00000000, 0x00000001, 0x02100401, 0x00000000, 0x00100401, 0x02100000, 0x00000400, 0x02000001, 0x02000400, 0x00000400, 0x00100001};
+
+ private static final int[] S8 = {0x08000820, 0x00000800, 0x00020000, 0x08020820, 0x08000000, 0x08000820, 0x00000020, 0x08000000, 0x00020020, 0x08020000, 0x08020820, 0x00020800, 0x08020800, 0x00020820, 0x00000800, 0x00000020, 0x08020000, 0x08000020, 0x08000800, 0x00000820, 0x00020800, 0x00020020, 0x08020020, 0x08020800, 0x00000820, 0x00000000, 0x00000000, 0x08020020, 0x08000020, 0x08000800, 0x00020820, 0x00020000, 0x00020820, 0x00020000, 0x08020800, 0x00000800, 0x00000020, 0x08020020, 0x00000800, 0x00020820, 0x08000800, 0x00000020, 0x08000020, 0x08020000, 0x08020020, 0x08000000, 0x00020000, 0x08000820, 0x00000000, 0x08020820, 0x00020020, 0x08000020, 0x08020000, 0x08000800, 0x08000820, 0x00000000, 0x08020820, 0x00020800, 0x00020800, 0x00000820, 0x00000820, 0x00020020, 0x08000000, 0x08020800};
+
+ protected static final byte[] IP = {57, 49, 41, 33, 25, 17, 9, 1, 59, 51, 43, 35, 27, 19, 11, 3, 61, 53, 45, 37, 29, 21, 13, 5, 63, 55, 47, 39, 31, 23, 15, 7, 56, 48, 40, 32, 24, 16, 8, 0, 58, 50, 42, 34, 26, 18, 10, 2, 60, 52, 44, 36, 28, 20, 12, 4, 62, 54, 46, 38, 30, 22, 14, 6,};
+
+ protected static final byte[] FP = {39, 7, 47, 15, 55, 23, 63, 31, 38, 6, 46, 14, 54, 22, 62, 30, 37, 5, 45, 13, 53, 21, 61, 29, 36, 4, 44, 12, 52, 20, 60, 28, 35, 3, 43, 11, 51, 19, 59, 27, 34, 2, 42, 10, 50, 18, 58, 26, 33, 1, 41, 9, 49, 17, 57, 25, 32, 0, 40, 8, 48, 16, 56, 24};
+
+ private static int f(int r, long k) {
+ return S1[(int) ((((r << 5) & 0x20) | ((r >>> 27) & 0x1f)) ^ ((k >>> 42) & 0x3f))] | S2[(int) (((r >>> 23) & 0x3f) ^ ((k >>> 36) & 0x3f))] | S3[(int) (((r >>> 19) & 0x3f) ^ ((k >>> 30) & 0x3f))] | S4[(int) (((r >>> 15) & 0x3f) ^ ((k >>> 24) & 0x3f))] | S5[(int) (((r >>> 11) & 0x3f) ^ ((k >>> 18) & 0x3f))] | S6[(int) (((r >>> 7) & 0x3f) ^ ((k >>> 12) & 0x3f))] | S7[(int) (((r >>> 3) & 0x3f) ^ ((k >>> 6) & 0x3f))] | S8[(int) ((((r >>> 31) & 0x01) | ((r << 1) & 0x3e)) ^ (k & 0x3f))];
+ }
+
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/job/JobEx.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/job/JobEx.java
index b8a7191571..06c3e7b96c 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/job/JobEx.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/job/JobEx.java
@@ -1,163 +1,163 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.job;
-
-import java.lang.reflect.Method;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.jobs.IJobChangeEvent;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.core.runtime.jobs.JobChangeAdapter;
-import org.eclipse.scout.commons.exception.ProcessingException;
-
-/**
- * Extended job
- * <ul>
- * <li>access to canceled property</li>
- * <li>access to progress monitor</li>
- * <li>run convenience methods</li>
- * </ul>
- */
-public abstract class JobEx extends Job {
- private IStatus m_statusOfRunNow;
-
- public JobEx(String name) {
- super(name);
- }
-
- @Override
- public final boolean shouldRun() {
- m_statusOfRunNow = null;
- return super.shouldRun();
- }
-
- /**
- * Some times it is useful to run a job "manually", for example when the job
- * can be run immediately.
- */
- public IStatus runNow(IProgressMonitor monitor) {
- m_statusOfRunNow = null;
- m_statusOfRunNow = run(monitor);
- return m_statusOfRunNow;
- }
-
- /**
- * Convenience for evaluating the result and throwing an exception if the job
- * result contains an exception
- */
- public void throwOnError() throws ProcessingException {
- IStatus status = getResult();
- if (status == null) {
- status = m_statusOfRunNow;
- }
- if (status != null && status.getException() != null) {
- Throwable t = status.getException();
- if (t instanceof ProcessingException) {
- throw (ProcessingException) t;
- }
- else {
- throw new ProcessingException("Unexpected", t);
- }
- }
- }
-
- public IProgressMonitor getMonitor() {
- IProgressMonitor monitor = null;
- if (getState() == Job.RUNNING) {
- try {
- Method m = Job.class.getSuperclass().getDeclaredMethod("getProgressMonitor");
- m.setAccessible(true);
- Object result = m.invoke(this, new Object[0]);
- if (result instanceof IProgressMonitor) {
- monitor = (IProgressMonitor) result;
- }
- }
- catch (Throwable t) {
- // nop
- }
- }
- return monitor;
- }
-
- /**
- * @return {@link #isCanceled()} property iff the current job is of instance {@link ClientJob}
- */
- public static boolean isCurrentJobCanceled() {
- Job job = getJobManager().currentJob();
- if (job instanceof JobEx) {
- IProgressMonitor monitor = ((JobEx) job).getMonitor();
- if (monitor != null) {
- return monitor.isCanceled();
- }
- }
- return false;
- }
-
- /**
- * Similar to {@link #join()} but with the difference that it waits at most the specified time.
- * <p>
- * A value of &lt;= 0 is equivalent to calling {@link #join()}.
- *
- * @throws InterruptedException
- */
- public final void join(final long millis) throws InterruptedException {
- if (millis <= 0) {
- join();
- }
- else {
- int state = getState();
- if (state == Job.NONE) {
- return;
- }
- //it's an error for a job to join itself
- if (state == Job.RUNNING && getThread() == Thread.currentThread()) {
- throw new IllegalStateException("Job attempted to join itself");
- }
- final AtomicBoolean jobDoneLock = new AtomicBoolean();
- JobChangeAdapter listener = new JobChangeAdapter() {
- @Override
- public void done(IJobChangeEvent event) {
- synchronized (jobDoneLock) {
- jobDoneLock.set(true);
- jobDoneLock.notifyAll();
- }
- }
- };
- try {
- addJobChangeListener(listener);
- //
- if (getState() == Job.NONE) {
- return;
- }
- long endTime = System.currentTimeMillis() + millis;
- synchronized (jobDoneLock) {
- while (!jobDoneLock.get()) {
- long dt = endTime - System.currentTimeMillis();
- if (dt <= 0) {
- return;
- }
- try {
- jobDoneLock.wait(dt);
- }
- catch (InterruptedException e) {
- throw e;
- }
- }
- }
- }
- finally {
- removeJobChangeListener(listener);
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.job;
+
+import java.lang.reflect.Method;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.core.runtime.jobs.JobChangeAdapter;
+import org.eclipse.scout.commons.exception.ProcessingException;
+
+/**
+ * Extended job
+ * <ul>
+ * <li>access to canceled property</li>
+ * <li>access to progress monitor</li>
+ * <li>run convenience methods</li>
+ * </ul>
+ */
+public abstract class JobEx extends Job {
+ private IStatus m_statusOfRunNow;
+
+ public JobEx(String name) {
+ super(name);
+ }
+
+ @Override
+ public final boolean shouldRun() {
+ m_statusOfRunNow = null;
+ return super.shouldRun();
+ }
+
+ /**
+ * Some times it is useful to run a job "manually", for example when the job
+ * can be run immediately.
+ */
+ public IStatus runNow(IProgressMonitor monitor) {
+ m_statusOfRunNow = null;
+ m_statusOfRunNow = run(monitor);
+ return m_statusOfRunNow;
+ }
+
+ /**
+ * Convenience for evaluating the result and throwing an exception if the job
+ * result contains an exception
+ */
+ public void throwOnError() throws ProcessingException {
+ IStatus status = getResult();
+ if (status == null) {
+ status = m_statusOfRunNow;
+ }
+ if (status != null && status.getException() != null) {
+ Throwable t = status.getException();
+ if (t instanceof ProcessingException) {
+ throw (ProcessingException) t;
+ }
+ else {
+ throw new ProcessingException("Unexpected", t);
+ }
+ }
+ }
+
+ public IProgressMonitor getMonitor() {
+ IProgressMonitor monitor = null;
+ if (getState() == Job.RUNNING) {
+ try {
+ Method m = Job.class.getSuperclass().getDeclaredMethod("getProgressMonitor");
+ m.setAccessible(true);
+ Object result = m.invoke(this, new Object[0]);
+ if (result instanceof IProgressMonitor) {
+ monitor = (IProgressMonitor) result;
+ }
+ }
+ catch (Throwable t) {
+ // nop
+ }
+ }
+ return monitor;
+ }
+
+ /**
+ * @return {@link #isCanceled()} property iff the current job is of instance {@link ClientJob}
+ */
+ public static boolean isCurrentJobCanceled() {
+ Job job = getJobManager().currentJob();
+ if (job instanceof JobEx) {
+ IProgressMonitor monitor = ((JobEx) job).getMonitor();
+ if (monitor != null) {
+ return monitor.isCanceled();
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Similar to {@link #join()} but with the difference that it waits at most the specified time.
+ * <p>
+ * A value of &lt;= 0 is equivalent to calling {@link #join()}.
+ *
+ * @throws InterruptedException
+ */
+ public final void join(final long millis) throws InterruptedException {
+ if (millis <= 0) {
+ join();
+ }
+ else {
+ int state = getState();
+ if (state == Job.NONE) {
+ return;
+ }
+ //it's an error for a job to join itself
+ if (state == Job.RUNNING && getThread() == Thread.currentThread()) {
+ throw new IllegalStateException("Job attempted to join itself");
+ }
+ final AtomicBoolean jobDoneLock = new AtomicBoolean();
+ JobChangeAdapter listener = new JobChangeAdapter() {
+ @Override
+ public void done(IJobChangeEvent event) {
+ synchronized (jobDoneLock) {
+ jobDoneLock.set(true);
+ jobDoneLock.notifyAll();
+ }
+ }
+ };
+ try {
+ addJobChangeListener(listener);
+ //
+ if (getState() == Job.NONE) {
+ return;
+ }
+ long endTime = System.currentTimeMillis() + millis;
+ synchronized (jobDoneLock) {
+ while (!jobDoneLock.get()) {
+ long dt = endTime - System.currentTimeMillis();
+ if (dt <= 0) {
+ return;
+ }
+ try {
+ jobDoneLock.wait(dt);
+ }
+ catch (InterruptedException e) {
+ throw e;
+ }
+ }
+ }
+ }
+ finally {
+ removeJobChangeListener(listener);
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/EclipseLogUtility.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/EclipseLogUtility.java
index 1262a7968b..91338826c1 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/EclipseLogUtility.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/EclipseLogUtility.java
@@ -1,66 +1,66 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.logger;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-
-public class EclipseLogUtility {
-
- private EclipseLogUtility() {
- }
-
- /**
- * convert between Eclipse status {@link IStatus} and Scout level (int-based)
- */
- public static int eclipseToScoutLevel(int level) {
- switch (level) {
- case IStatus.ERROR:
- case IStatus.CANCEL:
- return IScoutLogger.LEVEL_ERROR;
- case IStatus.WARNING:
- return IScoutLogger.LEVEL_WARN;
- case IStatus.INFO:
- case IStatus.OK:
- return IScoutLogger.LEVEL_INFO;
- default:
- return IScoutLogger.LEVEL_INFO;
- }
- }
-
- /**
- * convert between Scout log {@link IScoutLogger} and Eclipse level
- */
- public static int scoutToEclipseLevel(int level) {
- switch (level) {
- case IScoutLogger.LEVEL_OFF: {
- return Status.ERROR;
- }
- case IScoutLogger.LEVEL_ERROR: {
- return Status.ERROR;
- }
- case IScoutLogger.LEVEL_WARN: {
- return Status.WARNING;
- }
- case IScoutLogger.LEVEL_INFO: {
- return Status.INFO;
- }
- case IScoutLogger.LEVEL_DEBUG: {
- return Status.INFO;
- }
- case IScoutLogger.LEVEL_TRACE: {
- return Status.INFO;
- }
- default:
- return Status.INFO;
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.logger;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+
+public class EclipseLogUtility {
+
+ private EclipseLogUtility() {
+ }
+
+ /**
+ * convert between Eclipse status {@link IStatus} and Scout level (int-based)
+ */
+ public static int eclipseToScoutLevel(int level) {
+ switch (level) {
+ case IStatus.ERROR:
+ case IStatus.CANCEL:
+ return IScoutLogger.LEVEL_ERROR;
+ case IStatus.WARNING:
+ return IScoutLogger.LEVEL_WARN;
+ case IStatus.INFO:
+ case IStatus.OK:
+ return IScoutLogger.LEVEL_INFO;
+ default:
+ return IScoutLogger.LEVEL_INFO;
+ }
+ }
+
+ /**
+ * convert between Scout log {@link IScoutLogger} and Eclipse level
+ */
+ public static int scoutToEclipseLevel(int level) {
+ switch (level) {
+ case IScoutLogger.LEVEL_OFF: {
+ return Status.ERROR;
+ }
+ case IScoutLogger.LEVEL_ERROR: {
+ return Status.ERROR;
+ }
+ case IScoutLogger.LEVEL_WARN: {
+ return Status.WARNING;
+ }
+ case IScoutLogger.LEVEL_INFO: {
+ return Status.INFO;
+ }
+ case IScoutLogger.LEVEL_DEBUG: {
+ return Status.INFO;
+ }
+ case IScoutLogger.LEVEL_TRACE: {
+ return Status.INFO;
+ }
+ default:
+ return Status.INFO;
+ }
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/IScoutLogManager.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/IScoutLogManager.java
index bd2897dcc3..e63d3a5b2b 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/IScoutLogManager.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/IScoutLogManager.java
@@ -1,82 +1,82 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.logger;
-
-import java.io.File;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-
-public interface IScoutLogManager {
-
- /**
- * To initialize the log manager
- */
- void initialize();
-
- /**
- * To get a new instance of the log wrapper
- *
- * @param name
- * @return
- */
- IScoutLogger getLogger(String name);
-
- /**
- * To get a new instance of the log wrapper
- *
- * @param clazz
- * @return
- */
- IScoutLogger getLogger(Class clazz);
-
- /**
- * To overwrite the level of all loggers with the given global level. If null is provided, no global log level is used
- * but the initial configuration instead.
- *
- * @param globalLogLevel
- * the global log level to set or null to read the initial log configuration
- * @throws UnsupportedOperationException
- * is thrown if the log implementation does not support global log level
- */
- void setGlobalLogLevel(Integer globalLogLevel) throws UnsupportedOperationException;
-
- /**
- * If a global log level is installed by {@link IScoutLogManager#setGlobalLogLevel(Integer)}, this global level is
- * returned.
- *
- * @return the global log level or null, if no global log level is set
- * @throws UnsupportedOperationException
- * is thrown if the log implementation does not support global log level
- */
- Integer getGlobalLogLevel() throws UnsupportedOperationException;
-
- /**
- * To start recording log messages. If a recording is already in progress by a previous call to this method, this
- * call has no effect.
- *
- * @return true if the recording is started or false, if the recording is already in progress.
- * @throws ProcessingException
- * is thrown if the recording could not be started
- * @throws UnsupportedOperationException
- * is thrown if the log implementation does not support recording of log messages
- */
- boolean startRecording() throws ProcessingException, UnsupportedOperationException;
-
- /**
- * To stop recording log messages. If no recording is in progress, this call has no effect and null is returned.
- *
- * @return the log file containing the recorded log messages or null, if no recording was in progress or an error
- * occured while retrieving the log entries.
- * @throws UnsupportedOperationException
- * is thrown if the log implementation does not support recording of log messages
- */
- File stopRecording() throws UnsupportedOperationException;
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.logger;
+
+import java.io.File;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+
+public interface IScoutLogManager {
+
+ /**
+ * To initialize the log manager
+ */
+ void initialize();
+
+ /**
+ * To get a new instance of the log wrapper
+ *
+ * @param name
+ * @return
+ */
+ IScoutLogger getLogger(String name);
+
+ /**
+ * To get a new instance of the log wrapper
+ *
+ * @param clazz
+ * @return
+ */
+ IScoutLogger getLogger(Class clazz);
+
+ /**
+ * To overwrite the level of all loggers with the given global level. If null is provided, no global log level is used
+ * but the initial configuration instead.
+ *
+ * @param globalLogLevel
+ * the global log level to set or null to read the initial log configuration
+ * @throws UnsupportedOperationException
+ * is thrown if the log implementation does not support global log level
+ */
+ void setGlobalLogLevel(Integer globalLogLevel) throws UnsupportedOperationException;
+
+ /**
+ * If a global log level is installed by {@link IScoutLogManager#setGlobalLogLevel(Integer)}, this global level is
+ * returned.
+ *
+ * @return the global log level or null, if no global log level is set
+ * @throws UnsupportedOperationException
+ * is thrown if the log implementation does not support global log level
+ */
+ Integer getGlobalLogLevel() throws UnsupportedOperationException;
+
+ /**
+ * To start recording log messages. If a recording is already in progress by a previous call to this method, this
+ * call has no effect.
+ *
+ * @return true if the recording is started or false, if the recording is already in progress.
+ * @throws ProcessingException
+ * is thrown if the recording could not be started
+ * @throws UnsupportedOperationException
+ * is thrown if the log implementation does not support recording of log messages
+ */
+ boolean startRecording() throws ProcessingException, UnsupportedOperationException;
+
+ /**
+ * To stop recording log messages. If no recording is in progress, this call has no effect and null is returned.
+ *
+ * @return the log file containing the recorded log messages or null, if no recording was in progress or an error
+ * occured while retrieving the log entries.
+ * @throws UnsupportedOperationException
+ * is thrown if the log implementation does not support recording of log messages
+ */
+ File stopRecording() throws UnsupportedOperationException;
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/IScoutLogger.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/IScoutLogger.java
index be558137b1..c2e55650a2 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/IScoutLogger.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/IScoutLogger.java
@@ -1,403 +1,403 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.logger;
-
-import java.util.logging.Logger;
-
-/**
- * This interface can be used via {@link ScoutLogManager#getLogger(Class)}.
- * <p>
- * ScoutLogManager creates a transparent wrapper of a java.util.logging.Logger or Eclipse Logger.
- * <p>
- * Therefore using this interface or {@link Logger#getLogger(String)} is the absolute same thing.
- * <p>
- */
-public interface IScoutLogger {
- int LEVEL_OFF = 0;
- int LEVEL_ERROR = 1;
- int LEVEL_WARN = 2;
- int LEVEL_INFO = 3;
- int LEVEL_DEBUG = 4;
- int LEVEL_TRACE = 5;
-
- boolean isLoggable(int logLevel);
-
- /**
- * @return the name of this <code>IScoutLogger</code> instance.
- */
- String getName();
-
- int getLevel();
-
- void setLevel(int level);
-
- /**
- * Is the logger instance enabled for the TRACE level?
- *
- * @return True if this Logger is enabled for the TRACE level,
- * false otherwise.
- * @since 1.4
- */
- boolean isTraceEnabled();
-
- /**
- * Log a message at the TRACE level.
- *
- * @param msg
- * the message string to be logged
- * @since 1.4
- */
- void trace(String msg);
-
- /**
- * Log a message at the TRACE level according to the specified format
- * and argument.
- * <p>
- * This form avoids superfluous object creation when the logger is disabled for the TRACE level.
- * </p>
- *
- * @param format
- * the format string
- * @param arg
- * the argument
- * @since 1.4
- */
- void trace(String format, Object arg);
-
- /**
- * Log a message at the TRACE level according to the specified format
- * and arguments.
- * <p>
- * This form avoids superfluous object creation when the logger is disabled for the TRACE level.
- * </p>
- *
- * @param format
- * the format string
- * @param arg1
- * the first argument
- * @param arg2
- * the second argument
- * @since 1.4
- */
- void trace(String format, Object arg1, Object arg2);
-
- /**
- * Log a message at the TRACE level according to the specified format
- * and arguments.
- * <p>
- * This form avoids superfluous object creation when the logger is disabled for the TRACE level.
- * </p>
- *
- * @param format
- * the format string
- * @param argArray
- * an array of arguments
- * @since 1.4
- */
- void trace(String format, Object[] argArray);
-
- /**
- * Log an exception (throwable) at the TRACE level with an
- * accompanying message.
- *
- * @param msg
- * the message accompanying the exception
- * @param t
- * the exception (throwable) to log
- * @since 1.4
- */
- void trace(String msg, Throwable t);
-
- /**
- * Is the logger instance enabled for the DEBUG level?
- *
- * @return True if this Logger is enabled for the DEBUG level,
- * false otherwise.
- */
- boolean isDebugEnabled();
-
- /**
- * Log a message at the DEBUG level.
- *
- * @param msg
- * the message string to be logged
- */
- void debug(String msg);
-
- /**
- * Log a message at the DEBUG level according to the specified format
- * and argument.
- * <p>
- * This form avoids superfluous object creation when the logger is disabled for the DEBUG level.
- * </p>
- *
- * @param format
- * the format string
- * @param arg
- * the argument
- */
- void debug(String format, Object arg);
-
- /**
- * Log a message at the DEBUG level according to the specified format
- * and arguments.
- * <p>
- * This form avoids superfluous object creation when the logger is disabled for the DEBUG level.
- * </p>
- *
- * @param format
- * the format string
- * @param arg1
- * the first argument
- * @param arg2
- * the second argument
- */
- void debug(String format, Object arg1, Object arg2);
-
- /**
- * Log a message at the DEBUG level according to the specified format
- * and arguments.
- * <p>
- * This form avoids superfluous object creation when the logger is disabled for the DEBUG level.
- * </p>
- *
- * @param format
- * the format string
- * @param argArray
- * an array of arguments
- */
- void debug(String format, Object[] argArray);
-
- /**
- * Log an exception (throwable) at the DEBUG level with an
- * accompanying message.
- *
- * @param msg
- * the message accompanying the exception
- * @param t
- * the exception (throwable) to log
- */
- void debug(String msg, Throwable t);
-
- /**
- * Is the logger instance enabled for the INFO level?
- *
- * @return True if this Logger is enabled for the INFO level,
- * false otherwise.
- */
- boolean isInfoEnabled();
-
- /**
- * Log a message at the INFO level.
- *
- * @param msg
- * the message string to be logged
- */
- void info(String msg);
-
- /**
- * Log a message at the INFO level according to the specified format
- * and argument.
- * <p>
- * This form avoids superfluous object creation when the logger is disabled for the INFO level.
- * </p>
- *
- * @param format
- * the format string
- * @param arg
- * the argument
- */
- void info(String format, Object arg);
-
- /**
- * Log a message at the INFO level according to the specified format
- * and arguments.
- * <p>
- * This form avoids superfluous object creation when the logger is disabled for the INFO level.
- * </p>
- *
- * @param format
- * the format string
- * @param arg1
- * the first argument
- * @param arg2
- * the second argument
- */
- void info(String format, Object arg1, Object arg2);
-
- /**
- * Log a message at the INFO level according to the specified format
- * and arguments.
- * <p>
- * This form avoids superfluous object creation when the logger is disabled for the INFO level.
- * </p>
- *
- * @param format
- * the format string
- * @param argArray
- * an array of arguments
- */
- void info(String format, Object[] argArray);
-
- /**
- * Log an exception (throwable) at the INFO level with an
- * accompanying message.
- *
- * @param msg
- * the message accompanying the exception
- * @param t
- * the exception (throwable) to log
- */
- void info(String msg, Throwable t);
-
- /**
- * Is the logger instance enabled for the WARN level?
- *
- * @return True if this Logger is enabled for the WARN level,
- * false otherwise.
- */
- boolean isWarnEnabled();
-
- /**
- * Log a message at the WARN level.
- *
- * @param msg
- * the message string to be logged
- */
- void warn(String msg);
-
- /**
- * Log a message at the WARN level according to the specified format
- * and argument.
- * <p>
- * This form avoids superfluous object creation when the logger is disabled for the WARN level.
- * </p>
- *
- * @param format
- * the format string
- * @param arg
- * the argument
- */
- void warn(String format, Object arg);
-
- /**
- * Log a message at the WARN level according to the specified format
- * and arguments.
- * <p>
- * This form avoids superfluous object creation when the logger is disabled for the WARN level.
- * </p>
- *
- * @param format
- * the format string
- * @param argArray
- * an array of arguments
- */
- void warn(String format, Object[] argArray);
-
- /**
- * Log a message at the WARN level according to the specified format
- * and arguments.
- * <p>
- * This form avoids superfluous object creation when the logger is disabled for the WARN level.
- * </p>
- *
- * @param format
- * the format string
- * @param arg1
- * the first argument
- * @param arg2
- * the second argument
- */
- void warn(String format, Object arg1, Object arg2);
-
- /**
- * Log an exception (throwable) at the WARN level with an
- * accompanying message.
- *
- * @param msg
- * the message accompanying the exception
- * @param t
- * the exception (throwable) to log
- */
- void warn(String msg, Throwable t);
-
- /**
- * Is the logger instance enabled for the ERROR level?
- *
- * @return True if this Logger is enabled for the ERROR level,
- * false otherwise.
- */
- boolean isErrorEnabled();
-
- /**
- * Log a message at the ERROR level.
- *
- * @param msg
- * the message string to be logged
- */
- void error(String msg);
-
- /**
- * Log a message at the ERROR level according to the specified format
- * and argument.
- * <p>
- * This form avoids superfluous object creation when the logger is disabled for the ERROR level.
- * </p>
- *
- * @param format
- * the format string
- * @param arg
- * the argument
- */
- void error(String format, Object arg);
-
- /**
- * Log a message at the ERROR level according to the specified format
- * and arguments.
- * <p>
- * This form avoids superfluous object creation when the logger is disabled for the ERROR level.
- * </p>
- *
- * @param format
- * the format string
- * @param arg1
- * the first argument
- * @param arg2
- * the second argument
- */
- void error(String format, Object arg1, Object arg2);
-
- /**
- * Log a message at the ERROR level according to the specified format
- * and arguments.
- * <p>
- * This form avoids superfluous object creation when the logger is disabled for the ERROR level.
- * </p>
- *
- * @param format
- * the format string
- * @param argArray
- * an array of arguments
- */
- void error(String format, Object[] argArray);
-
- /**
- * Log an exception (throwable) at the ERROR level with an
- * accompanying message.
- *
- * @param msg
- * the message accompanying the exception
- * @param t
- * the exception (throwable) to log
- */
- void error(String msg, Throwable t);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.logger;
+
+import java.util.logging.Logger;
+
+/**
+ * This interface can be used via {@link ScoutLogManager#getLogger(Class)}.
+ * <p>
+ * ScoutLogManager creates a transparent wrapper of a java.util.logging.Logger or Eclipse Logger.
+ * <p>
+ * Therefore using this interface or {@link Logger#getLogger(String)} is the absolute same thing.
+ * <p>
+ */
+public interface IScoutLogger {
+ int LEVEL_OFF = 0;
+ int LEVEL_ERROR = 1;
+ int LEVEL_WARN = 2;
+ int LEVEL_INFO = 3;
+ int LEVEL_DEBUG = 4;
+ int LEVEL_TRACE = 5;
+
+ boolean isLoggable(int logLevel);
+
+ /**
+ * @return the name of this <code>IScoutLogger</code> instance.
+ */
+ String getName();
+
+ int getLevel();
+
+ void setLevel(int level);
+
+ /**
+ * Is the logger instance enabled for the TRACE level?
+ *
+ * @return True if this Logger is enabled for the TRACE level,
+ * false otherwise.
+ * @since 1.4
+ */
+ boolean isTraceEnabled();
+
+ /**
+ * Log a message at the TRACE level.
+ *
+ * @param msg
+ * the message string to be logged
+ * @since 1.4
+ */
+ void trace(String msg);
+
+ /**
+ * Log a message at the TRACE level according to the specified format
+ * and argument.
+ * <p>
+ * This form avoids superfluous object creation when the logger is disabled for the TRACE level.
+ * </p>
+ *
+ * @param format
+ * the format string
+ * @param arg
+ * the argument
+ * @since 1.4
+ */
+ void trace(String format, Object arg);
+
+ /**
+ * Log a message at the TRACE level according to the specified format
+ * and arguments.
+ * <p>
+ * This form avoids superfluous object creation when the logger is disabled for the TRACE level.
+ * </p>
+ *
+ * @param format
+ * the format string
+ * @param arg1
+ * the first argument
+ * @param arg2
+ * the second argument
+ * @since 1.4
+ */
+ void trace(String format, Object arg1, Object arg2);
+
+ /**
+ * Log a message at the TRACE level according to the specified format
+ * and arguments.
+ * <p>
+ * This form avoids superfluous object creation when the logger is disabled for the TRACE level.
+ * </p>
+ *
+ * @param format
+ * the format string
+ * @param argArray
+ * an array of arguments
+ * @since 1.4
+ */
+ void trace(String format, Object[] argArray);
+
+ /**
+ * Log an exception (throwable) at the TRACE level with an
+ * accompanying message.
+ *
+ * @param msg
+ * the message accompanying the exception
+ * @param t
+ * the exception (throwable) to log
+ * @since 1.4
+ */
+ void trace(String msg, Throwable t);
+
+ /**
+ * Is the logger instance enabled for the DEBUG level?
+ *
+ * @return True if this Logger is enabled for the DEBUG level,
+ * false otherwise.
+ */
+ boolean isDebugEnabled();
+
+ /**
+ * Log a message at the DEBUG level.
+ *
+ * @param msg
+ * the message string to be logged
+ */
+ void debug(String msg);
+
+ /**
+ * Log a message at the DEBUG level according to the specified format
+ * and argument.
+ * <p>
+ * This form avoids superfluous object creation when the logger is disabled for the DEBUG level.
+ * </p>
+ *
+ * @param format
+ * the format string
+ * @param arg
+ * the argument
+ */
+ void debug(String format, Object arg);
+
+ /**
+ * Log a message at the DEBUG level according to the specified format
+ * and arguments.
+ * <p>
+ * This form avoids superfluous object creation when the logger is disabled for the DEBUG level.
+ * </p>
+ *
+ * @param format
+ * the format string
+ * @param arg1
+ * the first argument
+ * @param arg2
+ * the second argument
+ */
+ void debug(String format, Object arg1, Object arg2);
+
+ /**
+ * Log a message at the DEBUG level according to the specified format
+ * and arguments.
+ * <p>
+ * This form avoids superfluous object creation when the logger is disabled for the DEBUG level.
+ * </p>
+ *
+ * @param format
+ * the format string
+ * @param argArray
+ * an array of arguments
+ */
+ void debug(String format, Object[] argArray);
+
+ /**
+ * Log an exception (throwable) at the DEBUG level with an
+ * accompanying message.
+ *
+ * @param msg
+ * the message accompanying the exception
+ * @param t
+ * the exception (throwable) to log
+ */
+ void debug(String msg, Throwable t);
+
+ /**
+ * Is the logger instance enabled for the INFO level?
+ *
+ * @return True if this Logger is enabled for the INFO level,
+ * false otherwise.
+ */
+ boolean isInfoEnabled();
+
+ /**
+ * Log a message at the INFO level.
+ *
+ * @param msg
+ * the message string to be logged
+ */
+ void info(String msg);
+
+ /**
+ * Log a message at the INFO level according to the specified format
+ * and argument.
+ * <p>
+ * This form avoids superfluous object creation when the logger is disabled for the INFO level.
+ * </p>
+ *
+ * @param format
+ * the format string
+ * @param arg
+ * the argument
+ */
+ void info(String format, Object arg);
+
+ /**
+ * Log a message at the INFO level according to the specified format
+ * and arguments.
+ * <p>
+ * This form avoids superfluous object creation when the logger is disabled for the INFO level.
+ * </p>
+ *
+ * @param format
+ * the format string
+ * @param arg1
+ * the first argument
+ * @param arg2
+ * the second argument
+ */
+ void info(String format, Object arg1, Object arg2);
+
+ /**
+ * Log a message at the INFO level according to the specified format
+ * and arguments.
+ * <p>
+ * This form avoids superfluous object creation when the logger is disabled for the INFO level.
+ * </p>
+ *
+ * @param format
+ * the format string
+ * @param argArray
+ * an array of arguments
+ */
+ void info(String format, Object[] argArray);
+
+ /**
+ * Log an exception (throwable) at the INFO level with an
+ * accompanying message.
+ *
+ * @param msg
+ * the message accompanying the exception
+ * @param t
+ * the exception (throwable) to log
+ */
+ void info(String msg, Throwable t);
+
+ /**
+ * Is the logger instance enabled for the WARN level?
+ *
+ * @return True if this Logger is enabled for the WARN level,
+ * false otherwise.
+ */
+ boolean isWarnEnabled();
+
+ /**
+ * Log a message at the WARN level.
+ *
+ * @param msg
+ * the message string to be logged
+ */
+ void warn(String msg);
+
+ /**
+ * Log a message at the WARN level according to the specified format
+ * and argument.
+ * <p>
+ * This form avoids superfluous object creation when the logger is disabled for the WARN level.
+ * </p>
+ *
+ * @param format
+ * the format string
+ * @param arg
+ * the argument
+ */
+ void warn(String format, Object arg);
+
+ /**
+ * Log a message at the WARN level according to the specified format
+ * and arguments.
+ * <p>
+ * This form avoids superfluous object creation when the logger is disabled for the WARN level.
+ * </p>
+ *
+ * @param format
+ * the format string
+ * @param argArray
+ * an array of arguments
+ */
+ void warn(String format, Object[] argArray);
+
+ /**
+ * Log a message at the WARN level according to the specified format
+ * and arguments.
+ * <p>
+ * This form avoids superfluous object creation when the logger is disabled for the WARN level.
+ * </p>
+ *
+ * @param format
+ * the format string
+ * @param arg1
+ * the first argument
+ * @param arg2
+ * the second argument
+ */
+ void warn(String format, Object arg1, Object arg2);
+
+ /**
+ * Log an exception (throwable) at the WARN level with an
+ * accompanying message.
+ *
+ * @param msg
+ * the message accompanying the exception
+ * @param t
+ * the exception (throwable) to log
+ */
+ void warn(String msg, Throwable t);
+
+ /**
+ * Is the logger instance enabled for the ERROR level?
+ *
+ * @return True if this Logger is enabled for the ERROR level,
+ * false otherwise.
+ */
+ boolean isErrorEnabled();
+
+ /**
+ * Log a message at the ERROR level.
+ *
+ * @param msg
+ * the message string to be logged
+ */
+ void error(String msg);
+
+ /**
+ * Log a message at the ERROR level according to the specified format
+ * and argument.
+ * <p>
+ * This form avoids superfluous object creation when the logger is disabled for the ERROR level.
+ * </p>
+ *
+ * @param format
+ * the format string
+ * @param arg
+ * the argument
+ */
+ void error(String format, Object arg);
+
+ /**
+ * Log a message at the ERROR level according to the specified format
+ * and arguments.
+ * <p>
+ * This form avoids superfluous object creation when the logger is disabled for the ERROR level.
+ * </p>
+ *
+ * @param format
+ * the format string
+ * @param arg1
+ * the first argument
+ * @param arg2
+ * the second argument
+ */
+ void error(String format, Object arg1, Object arg2);
+
+ /**
+ * Log a message at the ERROR level according to the specified format
+ * and arguments.
+ * <p>
+ * This form avoids superfluous object creation when the logger is disabled for the ERROR level.
+ * </p>
+ *
+ * @param format
+ * the format string
+ * @param argArray
+ * an array of arguments
+ */
+ void error(String format, Object[] argArray);
+
+ /**
+ * Log an exception (throwable) at the ERROR level with an
+ * accompanying message.
+ *
+ * @param msg
+ * the message accompanying the exception
+ * @param t
+ * the exception (throwable) to log
+ */
+ void error(String msg, Throwable t);
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/JavaLogUtility.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/JavaLogUtility.java
index 6973883493..3f0634ffb5 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/JavaLogUtility.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/JavaLogUtility.java
@@ -1,141 +1,141 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.logger;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.logging.Level;
-import java.util.logging.LogRecord;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-public final class JavaLogUtility {
- private static final Pattern VARIABLE_PATTERN = Pattern.compile("\\{([0-9]*)\\}", Pattern.DOTALL);
-
- private JavaLogUtility() {
- }
-
- private static final HashMap<Level, Integer> levelMap;
-
- static {
- levelMap = new HashMap<Level, Integer>();
- levelMap.put(Level.OFF, IScoutLogger.LEVEL_OFF);
- levelMap.put(Level.SEVERE, IScoutLogger.LEVEL_ERROR);
- levelMap.put(Level.WARNING, IScoutLogger.LEVEL_WARN);
- levelMap.put(Level.INFO, IScoutLogger.LEVEL_INFO);
- levelMap.put(Level.CONFIG, IScoutLogger.LEVEL_INFO);
- levelMap.put(Level.FINE, IScoutLogger.LEVEL_DEBUG);
- levelMap.put(Level.FINER, IScoutLogger.LEVEL_DEBUG);
- levelMap.put(Level.FINEST, IScoutLogger.LEVEL_TRACE);
- levelMap.put(Level.ALL, IScoutLogger.LEVEL_TRACE);
- }
-
- /**
- * convert between java log {@link Level} (object-based) and scout level (int-based)
- */
- public static int javaToScoutLevel(Level level) {
- Integer l = levelMap.get(level);
- if (l == null) {
- l = IScoutLogger.LEVEL_WARN;
- }
- return l;
- }
-
- /**
- * convert between java log {@link Level} (object-based) and scout level (int-based)
- */
- public static Level scoutToJavaLevel(int level) {
- switch (level) {
- case IScoutLogger.LEVEL_OFF:
- return Level.OFF;
- case IScoutLogger.LEVEL_ERROR:
- return Level.SEVERE;
- case IScoutLogger.LEVEL_WARN:
- return Level.WARNING;
- case IScoutLogger.LEVEL_INFO:
- return Level.INFO;
- case IScoutLogger.LEVEL_DEBUG:
- return Level.FINE;
- case IScoutLogger.LEVEL_TRACE:
- return Level.FINEST;
- default:
- return Level.WARNING;
- }
- }
-
- public static LogRecord buildLogRecord(Class wrapperClass, Level level, String format, Object[] args) {
- //replace args
- String msg;
- if (format != null && args != null && args.length > 0) {
- Matcher m = VARIABLE_PATTERN.matcher(format);
- StringBuilder buf = new StringBuilder();
- int endPos = 0;
- int index = 0;
- while (m.find() && index < args.length) {
- buf.append(format.substring(endPos, m.start()));
- buf.append(args[index]);
- endPos = m.end();
- index++;
- }
- if (endPos < format.length()) {
- buf.append(format.substring(endPos));
- }
- msg = buf.toString();
- }
- else {
- msg = format;
- }
- //
- LogRecord record = new LogRecord(level, msg);
- //
- //class, method, line
- StackTraceElement e = getCallerLine(wrapperClass);
- if (e != null) {
- //class.method: org.eclipse.foo.bar.MyClass.myMethod(MyClass.java:123)
- record.setSourceClassName(e.getClassName() + "." + e.getMethodName() + "(" + e.getFileName() + ":" + e.getLineNumber() + ")");
- record.setSourceMethodName(null);
- }
- return record;
- }
-
- private static StackTraceElement getCallerLine(Class wrapperClass) {
- try {
- StackTraceElement[] trace = new Exception().getStackTrace();
- int traceIndex = 0;
- HashSet<String> ignoredPackagePrefixes = new HashSet<String>();
- ignoredPackagePrefixes.add(IScoutLogger.class.getPackage().getName());
- if (wrapperClass != null) {
- ignoredPackagePrefixes.add(wrapperClass.getPackage().getName());
- }
- while (traceIndex < trace.length) {
- boolean found = true;
- for (String prefix : ignoredPackagePrefixes) {
- if (trace[traceIndex].getClassName().startsWith(prefix)) {
- found = false;
- break;
- }
- }
- if (found) {
- break;
- }
- traceIndex++;
- }
- if (traceIndex >= trace.length) {
- traceIndex = trace.length - 1;
- }
- return trace[traceIndex];
- }
- catch (Throwable t) {
- return null;
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.logger;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.logging.Level;
+import java.util.logging.LogRecord;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public final class JavaLogUtility {
+ private static final Pattern VARIABLE_PATTERN = Pattern.compile("\\{([0-9]*)\\}", Pattern.DOTALL);
+
+ private JavaLogUtility() {
+ }
+
+ private static final HashMap<Level, Integer> levelMap;
+
+ static {
+ levelMap = new HashMap<Level, Integer>();
+ levelMap.put(Level.OFF, IScoutLogger.LEVEL_OFF);
+ levelMap.put(Level.SEVERE, IScoutLogger.LEVEL_ERROR);
+ levelMap.put(Level.WARNING, IScoutLogger.LEVEL_WARN);
+ levelMap.put(Level.INFO, IScoutLogger.LEVEL_INFO);
+ levelMap.put(Level.CONFIG, IScoutLogger.LEVEL_INFO);
+ levelMap.put(Level.FINE, IScoutLogger.LEVEL_DEBUG);
+ levelMap.put(Level.FINER, IScoutLogger.LEVEL_DEBUG);
+ levelMap.put(Level.FINEST, IScoutLogger.LEVEL_TRACE);
+ levelMap.put(Level.ALL, IScoutLogger.LEVEL_TRACE);
+ }
+
+ /**
+ * convert between java log {@link Level} (object-based) and scout level (int-based)
+ */
+ public static int javaToScoutLevel(Level level) {
+ Integer l = levelMap.get(level);
+ if (l == null) {
+ l = IScoutLogger.LEVEL_WARN;
+ }
+ return l;
+ }
+
+ /**
+ * convert between java log {@link Level} (object-based) and scout level (int-based)
+ */
+ public static Level scoutToJavaLevel(int level) {
+ switch (level) {
+ case IScoutLogger.LEVEL_OFF:
+ return Level.OFF;
+ case IScoutLogger.LEVEL_ERROR:
+ return Level.SEVERE;
+ case IScoutLogger.LEVEL_WARN:
+ return Level.WARNING;
+ case IScoutLogger.LEVEL_INFO:
+ return Level.INFO;
+ case IScoutLogger.LEVEL_DEBUG:
+ return Level.FINE;
+ case IScoutLogger.LEVEL_TRACE:
+ return Level.FINEST;
+ default:
+ return Level.WARNING;
+ }
+ }
+
+ public static LogRecord buildLogRecord(Class wrapperClass, Level level, String format, Object[] args) {
+ //replace args
+ String msg;
+ if (format != null && args != null && args.length > 0) {
+ Matcher m = VARIABLE_PATTERN.matcher(format);
+ StringBuilder buf = new StringBuilder();
+ int endPos = 0;
+ int index = 0;
+ while (m.find() && index < args.length) {
+ buf.append(format.substring(endPos, m.start()));
+ buf.append(args[index]);
+ endPos = m.end();
+ index++;
+ }
+ if (endPos < format.length()) {
+ buf.append(format.substring(endPos));
+ }
+ msg = buf.toString();
+ }
+ else {
+ msg = format;
+ }
+ //
+ LogRecord record = new LogRecord(level, msg);
+ //
+ //class, method, line
+ StackTraceElement e = getCallerLine(wrapperClass);
+ if (e != null) {
+ //class.method: org.eclipse.foo.bar.MyClass.myMethod(MyClass.java:123)
+ record.setSourceClassName(e.getClassName() + "." + e.getMethodName() + "(" + e.getFileName() + ":" + e.getLineNumber() + ")");
+ record.setSourceMethodName(null);
+ }
+ return record;
+ }
+
+ private static StackTraceElement getCallerLine(Class wrapperClass) {
+ try {
+ StackTraceElement[] trace = new Exception().getStackTrace();
+ int traceIndex = 0;
+ HashSet<String> ignoredPackagePrefixes = new HashSet<String>();
+ ignoredPackagePrefixes.add(IScoutLogger.class.getPackage().getName());
+ if (wrapperClass != null) {
+ ignoredPackagePrefixes.add(wrapperClass.getPackage().getName());
+ }
+ while (traceIndex < trace.length) {
+ boolean found = true;
+ for (String prefix : ignoredPackagePrefixes) {
+ if (trace[traceIndex].getClassName().startsWith(prefix)) {
+ found = false;
+ break;
+ }
+ }
+ if (found) {
+ break;
+ }
+ traceIndex++;
+ }
+ if (traceIndex >= trace.length) {
+ traceIndex = trace.length - 1;
+ }
+ return trace[traceIndex];
+ }
+ catch (Throwable t) {
+ return null;
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/ScoutLogManager.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/ScoutLogManager.java
index 61365aeedd..9367391f15 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/ScoutLogManager.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/ScoutLogManager.java
@@ -1,208 +1,208 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.logger;
-
-import java.io.File;
-import java.util.logging.Logger;
-
-import org.eclipse.core.runtime.ILog;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.internal.Activator;
-import org.eclipse.scout.commons.logger.internal.eclipse.EclipseScoutLogManager;
-import org.eclipse.scout.commons.logger.internal.java.JavaScoutLogManager;
-
-/**
- * The default factory to create {@link IScoutLogger} objects.
- * <p>
- * This factory creates transparent wrappers of JUL logger {@link Logger} and Eclipse logger {@link ILog}, see
- * {@link IScoutLogger} for more details.</br> Set the system (or config.ini) property
- * <code>org.eclipse.scout.log</code> to define a logging strategy. Valid values are:
- * <table border="1">
- * <tr>
- * <td><strong>System (or config.ini) property</strong></td>
- * <td><strong>Strategy</strong></td>
- * <td><strong>Description</strong></td>
- * </tr>
- * <tr>
- * <td>java</td>
- * <td>JUL (Java Util Logger)</td>
- * <td>All log events are passed to the java.util.log logger. This is the default strategy used.</td>
- * </tr>
- * <tr>
- * <td>eclipse</td>
- * <td>Eclipse Logger</td>
- * <td>All log events are passed to the Eclipse logger<br/>
- * The system (or config.ini) property <code>org.eclipse.scout.log.level</code> is only valid for eclipse log and
- * defines which log level is passed to Eclipse.<br>
- * The default is WARNING, since lower levels may produce substantial amount of log when using default eclipse log
- * settings. Valid values are ERROR, WARNING, INFO, DEBUG</td>
- * </tr>
- * <tr>
- * <td><i>EMPTY</td>
- * <td>Custom logger</i></td>
- * <td>By not setting the strategy property, the system looks for a class named
- * <code>org.eclipse.scout.commons.logger.CustomLogManager</code> within its classpath. If found, this class is
- * instantiated and used as logging strategy.</b>Typically, this is done by creating a fragment with this Plug-In
- * configured as host Plug-In. In addition, the fragment must contain the class
- * <code>org.eclipse.scout.commons.logger.CustomLogManager</code> (instance of {@link IScoutLogManager}) to be
- * considered as logging strategy.</td>
- * </tr>
- * </table>
- * <p>
- * It is possible to set a global log level to affect all loggers. Also, log messages can be recorded into a separate
- * file.
- * </p>
- * <p>
- * Example settings in config.ini for eclipse log:
- * </p>
- * <p>
- *
- * <pre>
- * eclipse.consoleLog=true
- * org.eclipse.scout.log=eclipse
- * org.eclipse.scout.log.level=WARNING
- * </pre>
- *
- * </p>
- * <p>
- * Example settings in config.ini for java log:
- *
- * <pre>
- * eclipse.consoleLog=false
- * org.eclipse.scout.log=java
- * </pre>
- *
- * </p>
- */
-public final class ScoutLogManager {
-
- public static final IScoutLogManager instance;
-
- static {
- instance = createScoutLogManager();
- instance.initialize();
- }
-
- private ScoutLogManager() {
- }
-
- private static IScoutLogManager createScoutLogManager() {
- String strategy = getProperty("org.eclipse.scout.log");
- if (strategy != null) {
- if ("eclipse".equalsIgnoreCase(strategy)) {
- return new EclipseScoutLogManager();
- }
- else if ("java".equalsIgnoreCase(strategy)) {
- // default behavior is to use Java log strategy
- return new JavaScoutLogManager();
- }
- }
-
- // no logging strategy set. Try to find class 'org.eclipse.scout.commons.logger.CustomLogManager' for custom logging
- if (Activator.getDefault() != null) {
- try {
- Class clazz = Activator.getDefault().getBundle().loadClass("org.eclipse.scout.commons.logger.CustomLogManager");
- if (clazz != null && IScoutLogManager.class.isAssignableFrom(clazz)) {
- return (IScoutLogManager) clazz.newInstance();
- }
- }
- catch (ClassNotFoundException e) {
- // nop (custom logger is not installed)
- }
- catch (Exception e) {
- // error cannot be logged by log manager as not installed yet
- e.printStackTrace();
- }
- }
-
- return new JavaScoutLogManager();
- }
-
- public static String getProperty(String property) {
- if (Activator.getDefault() != null) {
- return Activator.getDefault().getBundle().getBundleContext().getProperty(property);
- }
- else {
- }
- return System.getProperty(property, null);
- }
-
- /**
- * To overwrite the level of all loggers with the given global level. If null is provided, no global log level is used
- * but the initial configuration instead.
- *
- * @param globalLogLevel
- * the global log level to set or null to read the initial log configuration
- * @throws UnsupportedOperationException
- * is thrown if the log implementation does not support global log level
- */
- public static void setGlobalLogLevel(Integer level) throws UnsupportedOperationException {
- instance.setGlobalLogLevel(level);
- }
-
- /**
- * If a global log level is installed by {@link ScoutLogManager#setGlobalLogLevel(Integer)}, this global level is
- * returned.
- *
- * @return the global log level or null, if no global log level is set
- * @throws UnsupportedOperationException
- * is thrown if the log implementation does not support global log level
- */
- public static Integer getGlobalLogLevel() throws UnsupportedOperationException {
- return instance.getGlobalLogLevel();
- }
-
- /**
- * To start recording log messages. If a recording is already in progress by a previous call to this method, this
- * call has no effect.
- *
- * @return true if the recording is started or false, if the recording is already in progress.
- * @throws ProcessingException
- * is thrown if the recording could not be started
- * @throws UnsupportedOperationException
- * is thrown if the log implementation does not support recording of log messages
- */
- public static boolean startRecording() throws ProcessingException, UnsupportedOperationException {
- return instance.startRecording();
- }
-
- /**
- * To stop recording log messages. If no recording is in progress, this call has no effect and null is returned.
- *
- * @return the log file containing the recorded log messages or null, if no recording was in progress or an error
- * occured while retrieving the log entries.
- * @throws UnsupportedOperationException
- * is thrown if the log implementation does not support recording of log messages
- */
- public static File stopRecording() throws UnsupportedOperationException {
- return instance.stopRecording();
- }
-
- /**
- * To get a new instance of the log wrapper
- *
- * @param clazz
- * @return
- */
- public static IScoutLogger getLogger(Class clazz) {
- return instance.getLogger(clazz);
- }
-
- /**
- * To get a new instance of the log wrapper
- *
- * @param name
- * @return
- */
- public static IScoutLogger getLogger(String name) {
- return instance.getLogger(name);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.logger;
+
+import java.io.File;
+import java.util.logging.Logger;
+
+import org.eclipse.core.runtime.ILog;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.internal.Activator;
+import org.eclipse.scout.commons.logger.internal.eclipse.EclipseScoutLogManager;
+import org.eclipse.scout.commons.logger.internal.java.JavaScoutLogManager;
+
+/**
+ * The default factory to create {@link IScoutLogger} objects.
+ * <p>
+ * This factory creates transparent wrappers of JUL logger {@link Logger} and Eclipse logger {@link ILog}, see
+ * {@link IScoutLogger} for more details.</br> Set the system (or config.ini) property
+ * <code>org.eclipse.scout.log</code> to define a logging strategy. Valid values are:
+ * <table border="1">
+ * <tr>
+ * <td><strong>System (or config.ini) property</strong></td>
+ * <td><strong>Strategy</strong></td>
+ * <td><strong>Description</strong></td>
+ * </tr>
+ * <tr>
+ * <td>java</td>
+ * <td>JUL (Java Util Logger)</td>
+ * <td>All log events are passed to the java.util.log logger. This is the default strategy used.</td>
+ * </tr>
+ * <tr>
+ * <td>eclipse</td>
+ * <td>Eclipse Logger</td>
+ * <td>All log events are passed to the Eclipse logger<br/>
+ * The system (or config.ini) property <code>org.eclipse.scout.log.level</code> is only valid for eclipse log and
+ * defines which log level is passed to Eclipse.<br>
+ * The default is WARNING, since lower levels may produce substantial amount of log when using default eclipse log
+ * settings. Valid values are ERROR, WARNING, INFO, DEBUG</td>
+ * </tr>
+ * <tr>
+ * <td><i>EMPTY</td>
+ * <td>Custom logger</i></td>
+ * <td>By not setting the strategy property, the system looks for a class named
+ * <code>org.eclipse.scout.commons.logger.CustomLogManager</code> within its classpath. If found, this class is
+ * instantiated and used as logging strategy.</b>Typically, this is done by creating a fragment with this Plug-In
+ * configured as host Plug-In. In addition, the fragment must contain the class
+ * <code>org.eclipse.scout.commons.logger.CustomLogManager</code> (instance of {@link IScoutLogManager}) to be
+ * considered as logging strategy.</td>
+ * </tr>
+ * </table>
+ * <p>
+ * It is possible to set a global log level to affect all loggers. Also, log messages can be recorded into a separate
+ * file.
+ * </p>
+ * <p>
+ * Example settings in config.ini for eclipse log:
+ * </p>
+ * <p>
+ *
+ * <pre>
+ * eclipse.consoleLog=true
+ * org.eclipse.scout.log=eclipse
+ * org.eclipse.scout.log.level=WARNING
+ * </pre>
+ *
+ * </p>
+ * <p>
+ * Example settings in config.ini for java log:
+ *
+ * <pre>
+ * eclipse.consoleLog=false
+ * org.eclipse.scout.log=java
+ * </pre>
+ *
+ * </p>
+ */
+public final class ScoutLogManager {
+
+ public static final IScoutLogManager instance;
+
+ static {
+ instance = createScoutLogManager();
+ instance.initialize();
+ }
+
+ private ScoutLogManager() {
+ }
+
+ private static IScoutLogManager createScoutLogManager() {
+ String strategy = getProperty("org.eclipse.scout.log");
+ if (strategy != null) {
+ if ("eclipse".equalsIgnoreCase(strategy)) {
+ return new EclipseScoutLogManager();
+ }
+ else if ("java".equalsIgnoreCase(strategy)) {
+ // default behavior is to use Java log strategy
+ return new JavaScoutLogManager();
+ }
+ }
+
+ // no logging strategy set. Try to find class 'org.eclipse.scout.commons.logger.CustomLogManager' for custom logging
+ if (Activator.getDefault() != null) {
+ try {
+ Class clazz = Activator.getDefault().getBundle().loadClass("org.eclipse.scout.commons.logger.CustomLogManager");
+ if (clazz != null && IScoutLogManager.class.isAssignableFrom(clazz)) {
+ return (IScoutLogManager) clazz.newInstance();
+ }
+ }
+ catch (ClassNotFoundException e) {
+ // nop (custom logger is not installed)
+ }
+ catch (Exception e) {
+ // error cannot be logged by log manager as not installed yet
+ e.printStackTrace();
+ }
+ }
+
+ return new JavaScoutLogManager();
+ }
+
+ public static String getProperty(String property) {
+ if (Activator.getDefault() != null) {
+ return Activator.getDefault().getBundle().getBundleContext().getProperty(property);
+ }
+ else {
+ }
+ return System.getProperty(property, null);
+ }
+
+ /**
+ * To overwrite the level of all loggers with the given global level. If null is provided, no global log level is used
+ * but the initial configuration instead.
+ *
+ * @param globalLogLevel
+ * the global log level to set or null to read the initial log configuration
+ * @throws UnsupportedOperationException
+ * is thrown if the log implementation does not support global log level
+ */
+ public static void setGlobalLogLevel(Integer level) throws UnsupportedOperationException {
+ instance.setGlobalLogLevel(level);
+ }
+
+ /**
+ * If a global log level is installed by {@link ScoutLogManager#setGlobalLogLevel(Integer)}, this global level is
+ * returned.
+ *
+ * @return the global log level or null, if no global log level is set
+ * @throws UnsupportedOperationException
+ * is thrown if the log implementation does not support global log level
+ */
+ public static Integer getGlobalLogLevel() throws UnsupportedOperationException {
+ return instance.getGlobalLogLevel();
+ }
+
+ /**
+ * To start recording log messages. If a recording is already in progress by a previous call to this method, this
+ * call has no effect.
+ *
+ * @return true if the recording is started or false, if the recording is already in progress.
+ * @throws ProcessingException
+ * is thrown if the recording could not be started
+ * @throws UnsupportedOperationException
+ * is thrown if the log implementation does not support recording of log messages
+ */
+ public static boolean startRecording() throws ProcessingException, UnsupportedOperationException {
+ return instance.startRecording();
+ }
+
+ /**
+ * To stop recording log messages. If no recording is in progress, this call has no effect and null is returned.
+ *
+ * @return the log file containing the recorded log messages or null, if no recording was in progress or an error
+ * occured while retrieving the log entries.
+ * @throws UnsupportedOperationException
+ * is thrown if the log implementation does not support recording of log messages
+ */
+ public static File stopRecording() throws UnsupportedOperationException {
+ return instance.stopRecording();
+ }
+
+ /**
+ * To get a new instance of the log wrapper
+ *
+ * @param clazz
+ * @return
+ */
+ public static IScoutLogger getLogger(Class clazz) {
+ return instance.getLogger(clazz);
+ }
+
+ /**
+ * To get a new instance of the log wrapper
+ *
+ * @param name
+ * @return
+ */
+ public static IScoutLogger getLogger(String name) {
+ return instance.getLogger(name);
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/analysis/AbstractLogFilter.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/analysis/AbstractLogFilter.java
index 3ec576bc3a..8fe39006e3 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/analysis/AbstractLogFilter.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/analysis/AbstractLogFilter.java
@@ -1,204 +1,204 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.logger.analysis;
-
-import java.text.SimpleDateFormat;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * Example of simple log record [FATAL] 2008-02-01 08:21:06.934 TP-Processor23
- * org.eclipse.scout.rt.server.servlet.HttpProxyHandlerServlet.service(
- * HttpProxyHandlerServlet.java:102) Example of eclipse log record !ENTRY
- * org.eclipse
- * .scout.rt.shared.services.common.exceptionhandler.LogExceptionHandlerService
- * .handleException(LogExceptionHandlerService.java:33) 4 0 2008-09-23
- * 08:11:43.776 !MESSAGE ProcessingStatus[ERROR code=0
- * Client=BSIAG\Administrator@127.0.0.1/127.0.0.1 / Identity=BSIAG\Administrator
- * / cannot find a userNr for 'administrator' java.lang.SecurityException:
- * access denied] !STACK 0 and !SESSION 2008-09-30 12:20:35.435
- * ----------------------------------------------- ...
- */
-public abstract class AbstractLogFilter implements ILogFilter {
- private static final Pattern SIMPLE_LOG_PARSE_PATTERN = Pattern.compile("^\\[([^]]+)\\]\\s+(....-..-.....:..:..\\....)\\s+([^\\s]+)\\s+([^\\s]+)\\s+(.*)$");
- private static final Pattern ECLIPSE_LOG_PARSE_PATTERN1 = Pattern.compile("^\\!ENTRY\\s+([^\\s]+)\\s+([^\\s]+)\\s+([^\\s]+)\\s+(....-..-.....:..:..\\....)$");
- private static final Pattern ECLIPSE_LOG_PARSE_PATTERN2 = Pattern.compile("^\\!SESSION\\s+(....-..-.....:..:..\\....).*$");
- private static final SimpleDateFormat ECLIPSE_LOG_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
- private static final SimpleDateFormat SIMPLE_LOG_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
-
- private final String m_formatPattern;
- private final SimpleDateFormat m_dateFormat;
-
- public AbstractLogFilter() {
- this("[{1}] {2} {3} {4} {5}", "yyyy-MM-dd HH:mm:ss.SSS");
- }
-
- /**
- * @param parsePattern
- * defines the first log line of a log entry and consists of some
- * groups
- * @param formatPattern
- * defines a pattern with the variables {1},{2},{3},{4},{5} that
- * represent (severity) (date) (thread) (source) (message)
- */
- public AbstractLogFilter(String formatPattern, String dateFormat) {
- m_formatPattern = formatPattern;
- m_dateFormat = new SimpleDateFormat(dateFormat);
- }
-
- @Override
- public boolean isIgnoredLine(String line) {
- if (line.startsWith("PasswordSecurityFilter::")) {
- return true;
- }
- return false;
- }
-
- @Override
- public boolean isLogEntryStartLine(String line) {
- if (SIMPLE_LOG_PARSE_PATTERN.matcher(line).matches()) {
- return true;
- }
- if (ECLIPSE_LOG_PARSE_PATTERN1.matcher(line).matches()) {
- return true;
- }
- if (ECLIPSE_LOG_PARSE_PATTERN2.matcher(line).matches()) {
- return true;
- }
- return false;
- }
-
- @SuppressWarnings("null")
- @Override
- public LogEntry parse(List<String> entry) throws Exception {
- LogEntry e = null;
- // try simple log
- if (e == null) {
- Matcher m = SIMPLE_LOG_PARSE_PATTERN.matcher(entry.get(0));
- if (m.matches()) {
- e = new LogEntry();
- e.severity = m.group(1);
- e.date = SIMPLE_LOG_DATE_FORMAT.parse(m.group(2));
- e.thread = m.group(3);
- e.source = m.group(4);
- e.message = m.group(5);
- if (entry.size() > 1) {
- StringBuffer b = new StringBuffer();
- for (int i = 1; i < entry.size(); i++) {
- if (b.length() > 0) {
- b.append("\n");
- }
- b.append(entry.get(i));
- }
- e.attachment = b.toString();
- }
- else {
- e.attachment = "";
- }
- }
- }
- // try eclipse log
- if (e == null) {
- Matcher m = ECLIPSE_LOG_PARSE_PATTERN1.matcher(entry.get(0));
- if (m.matches()) {
- e = new LogEntry();
- e.severity = "LOG";
- e.thread = "";
- e.source = m.group(1);
- e.date = ECLIPSE_LOG_DATE_FORMAT.parse(m.group(4));
- e.message = "";
- StringBuffer attachmentBuf = new StringBuffer();
- for (String line : entry) {
- if (line.startsWith("!ENTRY")) {
- // ignore
- }
- else if (line.startsWith("!MESSAGE")) {
- if (e.message.length() == 0) {
- e.message = line.substring(9);
- }
- }
- else if (line.startsWith("!STACK")) {
- // ignore
- }
- else if (line.startsWith("!SESSION")) {
- // ignore
- }
- else {
- if (attachmentBuf.length() > 0) {
- attachmentBuf.append("\n");
- }
- attachmentBuf.append(line);
- }
- }
- e.attachment = attachmentBuf.toString().trim();
- }
- }
- if (e == null) {
- Matcher m = ECLIPSE_LOG_PARSE_PATTERN2.matcher(entry.get(0));
- if (m.matches()) {
- e = new LogEntry();
- e.severity = "LOG";
- e.thread = "";
- e.source = "";
- e.date = ECLIPSE_LOG_DATE_FORMAT.parse(m.group(1));
- e.message = "New Session";
- StringBuffer attachmentBuf = new StringBuffer();
- for (String line : entry) {
- if (attachmentBuf.length() > 0) {
- attachmentBuf.append("\n");
- }
- attachmentBuf.append(line);
- }
- e.attachment = attachmentBuf.toString().trim();
- }
- }
- /*
- * workaround for logger that doesn't handle logger stop class
- */
- if (e.source.indexOf("LogExceptionHandlerService.handleException") >= 0) {
- Matcher m = Pattern.compile("\\sat\\s([^\\s(:]+\\([^\\s:]+\\:[0-9]+\\))").matcher(e.attachment);
- if (m.find()) {
- e.source = m.group(1);
- }
- }
- return e;
- }
-
- @Override
- public LogEntry filter(LogEntry e) {
- return e;
- }
-
- @Override
- public String formatContext(LogEntry e) {
- return m_dateFormat.format(e.date) + " " + e.thread + " " + e.message;
- }
-
- @Override
- public String format(LogEntry e) {
- StringBuffer b = new StringBuffer();
- String line = m_formatPattern;
- line = line.replace("{1}", e.severity);
- line = line.replace("{2}", m_dateFormat.format(e.date));
- line = line.replace("{3}", e.thread);
- line = line.replace("{4}", e.source);
- line = line.replace("{5}", e.message);
- b.append(line);
- b.append("\n");
- if (e.attachment.length() > 0) {
- b.append(e.attachment);
- b.append("\n");
- }
- return b.toString();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.logger.analysis;
+
+import java.text.SimpleDateFormat;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Example of simple log record [FATAL] 2008-02-01 08:21:06.934 TP-Processor23
+ * org.eclipse.scout.rt.server.servlet.HttpProxyHandlerServlet.service(
+ * HttpProxyHandlerServlet.java:102) Example of eclipse log record !ENTRY
+ * org.eclipse
+ * .scout.rt.shared.services.common.exceptionhandler.LogExceptionHandlerService
+ * .handleException(LogExceptionHandlerService.java:33) 4 0 2008-09-23
+ * 08:11:43.776 !MESSAGE ProcessingStatus[ERROR code=0
+ * Client=BSIAG\Administrator@127.0.0.1/127.0.0.1 / Identity=BSIAG\Administrator
+ * / cannot find a userNr for 'administrator' java.lang.SecurityException:
+ * access denied] !STACK 0 and !SESSION 2008-09-30 12:20:35.435
+ * ----------------------------------------------- ...
+ */
+public abstract class AbstractLogFilter implements ILogFilter {
+ private static final Pattern SIMPLE_LOG_PARSE_PATTERN = Pattern.compile("^\\[([^]]+)\\]\\s+(....-..-.....:..:..\\....)\\s+([^\\s]+)\\s+([^\\s]+)\\s+(.*)$");
+ private static final Pattern ECLIPSE_LOG_PARSE_PATTERN1 = Pattern.compile("^\\!ENTRY\\s+([^\\s]+)\\s+([^\\s]+)\\s+([^\\s]+)\\s+(....-..-.....:..:..\\....)$");
+ private static final Pattern ECLIPSE_LOG_PARSE_PATTERN2 = Pattern.compile("^\\!SESSION\\s+(....-..-.....:..:..\\....).*$");
+ private static final SimpleDateFormat ECLIPSE_LOG_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
+ private static final SimpleDateFormat SIMPLE_LOG_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
+
+ private final String m_formatPattern;
+ private final SimpleDateFormat m_dateFormat;
+
+ public AbstractLogFilter() {
+ this("[{1}] {2} {3} {4} {5}", "yyyy-MM-dd HH:mm:ss.SSS");
+ }
+
+ /**
+ * @param parsePattern
+ * defines the first log line of a log entry and consists of some
+ * groups
+ * @param formatPattern
+ * defines a pattern with the variables {1},{2},{3},{4},{5} that
+ * represent (severity) (date) (thread) (source) (message)
+ */
+ public AbstractLogFilter(String formatPattern, String dateFormat) {
+ m_formatPattern = formatPattern;
+ m_dateFormat = new SimpleDateFormat(dateFormat);
+ }
+
+ @Override
+ public boolean isIgnoredLine(String line) {
+ if (line.startsWith("PasswordSecurityFilter::")) {
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public boolean isLogEntryStartLine(String line) {
+ if (SIMPLE_LOG_PARSE_PATTERN.matcher(line).matches()) {
+ return true;
+ }
+ if (ECLIPSE_LOG_PARSE_PATTERN1.matcher(line).matches()) {
+ return true;
+ }
+ if (ECLIPSE_LOG_PARSE_PATTERN2.matcher(line).matches()) {
+ return true;
+ }
+ return false;
+ }
+
+ @SuppressWarnings("null")
+ @Override
+ public LogEntry parse(List<String> entry) throws Exception {
+ LogEntry e = null;
+ // try simple log
+ if (e == null) {
+ Matcher m = SIMPLE_LOG_PARSE_PATTERN.matcher(entry.get(0));
+ if (m.matches()) {
+ e = new LogEntry();
+ e.severity = m.group(1);
+ e.date = SIMPLE_LOG_DATE_FORMAT.parse(m.group(2));
+ e.thread = m.group(3);
+ e.source = m.group(4);
+ e.message = m.group(5);
+ if (entry.size() > 1) {
+ StringBuffer b = new StringBuffer();
+ for (int i = 1; i < entry.size(); i++) {
+ if (b.length() > 0) {
+ b.append("\n");
+ }
+ b.append(entry.get(i));
+ }
+ e.attachment = b.toString();
+ }
+ else {
+ e.attachment = "";
+ }
+ }
+ }
+ // try eclipse log
+ if (e == null) {
+ Matcher m = ECLIPSE_LOG_PARSE_PATTERN1.matcher(entry.get(0));
+ if (m.matches()) {
+ e = new LogEntry();
+ e.severity = "LOG";
+ e.thread = "";
+ e.source = m.group(1);
+ e.date = ECLIPSE_LOG_DATE_FORMAT.parse(m.group(4));
+ e.message = "";
+ StringBuffer attachmentBuf = new StringBuffer();
+ for (String line : entry) {
+ if (line.startsWith("!ENTRY")) {
+ // ignore
+ }
+ else if (line.startsWith("!MESSAGE")) {
+ if (e.message.length() == 0) {
+ e.message = line.substring(9);
+ }
+ }
+ else if (line.startsWith("!STACK")) {
+ // ignore
+ }
+ else if (line.startsWith("!SESSION")) {
+ // ignore
+ }
+ else {
+ if (attachmentBuf.length() > 0) {
+ attachmentBuf.append("\n");
+ }
+ attachmentBuf.append(line);
+ }
+ }
+ e.attachment = attachmentBuf.toString().trim();
+ }
+ }
+ if (e == null) {
+ Matcher m = ECLIPSE_LOG_PARSE_PATTERN2.matcher(entry.get(0));
+ if (m.matches()) {
+ e = new LogEntry();
+ e.severity = "LOG";
+ e.thread = "";
+ e.source = "";
+ e.date = ECLIPSE_LOG_DATE_FORMAT.parse(m.group(1));
+ e.message = "New Session";
+ StringBuffer attachmentBuf = new StringBuffer();
+ for (String line : entry) {
+ if (attachmentBuf.length() > 0) {
+ attachmentBuf.append("\n");
+ }
+ attachmentBuf.append(line);
+ }
+ e.attachment = attachmentBuf.toString().trim();
+ }
+ }
+ /*
+ * workaround for logger that doesn't handle logger stop class
+ */
+ if (e.source.indexOf("LogExceptionHandlerService.handleException") >= 0) {
+ Matcher m = Pattern.compile("\\sat\\s([^\\s(:]+\\([^\\s:]+\\:[0-9]+\\))").matcher(e.attachment);
+ if (m.find()) {
+ e.source = m.group(1);
+ }
+ }
+ return e;
+ }
+
+ @Override
+ public LogEntry filter(LogEntry e) {
+ return e;
+ }
+
+ @Override
+ public String formatContext(LogEntry e) {
+ return m_dateFormat.format(e.date) + " " + e.thread + " " + e.message;
+ }
+
+ @Override
+ public String format(LogEntry e) {
+ StringBuffer b = new StringBuffer();
+ String line = m_formatPattern;
+ line = line.replace("{1}", e.severity);
+ line = line.replace("{2}", m_dateFormat.format(e.date));
+ line = line.replace("{3}", e.thread);
+ line = line.replace("{4}", e.source);
+ line = line.replace("{5}", e.message);
+ b.append(line);
+ b.append("\n");
+ if (e.attachment.length() > 0) {
+ b.append(e.attachment);
+ b.append("\n");
+ }
+ return b.toString();
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/analysis/ILogFilter.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/analysis/ILogFilter.java
index b34e662862..74788ff6f2 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/analysis/ILogFilter.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/analysis/ILogFilter.java
@@ -1,35 +1,35 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.logger.analysis;
-
-import java.util.List;
-
-public interface ILogFilter {
-
- boolean isIgnoredLine(String line);
-
- boolean isLogEntryStartLine(String line);
-
- LogEntry parse(List<String> entry) throws Exception;
-
- LogEntry filter(LogEntry entry) throws Exception;
-
- /**
- * format context only (date, thread, message)
- */
- String formatContext(LogEntry e);
-
- /**
- * format complete entry
- */
- String format(LogEntry e);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.logger.analysis;
+
+import java.util.List;
+
+public interface ILogFilter {
+
+ boolean isIgnoredLine(String line);
+
+ boolean isLogEntryStartLine(String line);
+
+ LogEntry parse(List<String> entry) throws Exception;
+
+ LogEntry filter(LogEntry entry) throws Exception;
+
+ /**
+ * format context only (date, thread, message)
+ */
+ String formatContext(LogEntry e);
+
+ /**
+ * format complete entry
+ */
+ String format(LogEntry e);
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/analysis/LogAnalyzer.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/analysis/LogAnalyzer.java
index 087109a76c..55fdcad3b4 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/analysis/LogAnalyzer.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/analysis/LogAnalyzer.java
@@ -1,152 +1,152 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.logger.analysis;
-
-import java.awt.Toolkit;
-import java.awt.datatransfer.DataFlavor;
-import java.awt.datatransfer.StringSelection;
-import java.awt.datatransfer.Transferable;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.Reader;
-import java.io.StringWriter;
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.TreeMap;
-
-import org.eclipse.scout.commons.CompositeObject;
-
-/**
- * Analyze a log file with records of the following format LOG_MESSAGE_LINE
- * optional STACK TRACE and info
- */
-public class LogAnalyzer {
- private int m_totalCount;
- private int m_filterCount;
- private ArrayList<LogCategory> m_categories;
-
- public LogAnalyzer() {
- }
-
- public void start(File in, File out, ILogFilter filter) throws Exception {
- File tmp = new File(out.getAbsolutePath() + ".tmp");
- tmp.deleteOnExit();
- start(new FileReader(in), new FileWriter(tmp), filter);
- if (out.exists() && !out.delete()) {
- throw new IOException("Cannot delete old version of " + out);
- }
- tmp.renameTo(out);
- }
-
- public void start(ILogFilter filter) throws Exception {
- Transferable t = Toolkit.getDefaultToolkit().getSystemClipboard().getContents(null);
- DataFlavor f = DataFlavor.getTextPlainUnicodeFlavor();
- if (!t.isDataFlavorSupported(f)) {
- throw new IOException("Expected COPY/PASTE text");
- }
- StringWriter out = new StringWriter();
- start(f.getReaderForText(t), out, filter);
- Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(out.getBuffer().toString()), null);
- System.out.println("PASTED text to clipboard");
- }
-
- public void start(Reader in, Writer out, ILogFilter filter) throws Exception {
- analyze(in, out, filter);
- }
-
- private void analyze(Reader in, Writer out, ILogFilter filter) throws Exception {
- m_totalCount = 0;
- m_filterCount = 0;
- m_categories = new ArrayList<LogCategory>();
- BufferedReader r = new BufferedReader(in);
- try {
- String line;
- ArrayList<String> buf = null;
- while ((line = r.readLine()) != null) {
- if (filter.isIgnoredLine(line)) {
- System.out.println("ignoring line: " + line);
- }
- else {
- if (filter.isLogEntryStartLine(line)) {
- analyzeBuffer(buf, out, filter);
- buf = new ArrayList<String>();
- }
- if (buf != null) {
- buf.add(line);
- }
- }
- }
- analyzeBuffer(buf, out, filter);
- // write output
- TreeMap<CompositeObject, LogCategory> sortMap = new TreeMap<CompositeObject, LogCategory>();
- int index = 0;
- for (LogCategory c : m_categories) {
- sortMap.put(new CompositeObject(-c.getEntryCount(), index), c);
- index++;
- }
- for (LogCategory c : sortMap.values()) {
- out.write(c.format(filter));
- out.write("\n");
- }
- System.out.println("TOTAL " + m_totalCount + " entries\nACCEPTED " + m_filterCount + " in " + m_categories.size() + " CATEGORIES");
- }
- finally {
- try {
- r.close();
- }
- catch (Throwable t) {
- }
- try {
- out.close();
- }
- catch (Throwable t) {
- }
- }
- }
-
- private void analyzeBuffer(List<String> buf, Writer out, ILogFilter filter) throws Exception {
- if (buf != null && buf.size() > 0) {
- m_totalCount++;
- LogEntry e = filter.parse(buf);
- e = filter.filter(e);
- if (e != null) {
- m_filterCount++;
- LogCategory c = null;
- for (LogCategory cat : m_categories) {
- if (cat.isCategoryFor(e)) {
- c = cat;
- break;
- }
- }
- if (c == null) {
- // not categorized
- c = new LogCategory(e);
- m_categories.add(c);
- }
- c.add(e);
- }
- }
- }
-
- public static void main(String[] args) throws Exception {
- ILogFilter filter = new AbstractLogFilter() {
- @Override
- public LogEntry filter(LogEntry e) {
- return e;
- }
- };
- new LogAnalyzer().start(filter);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.logger.analysis;
+
+import java.awt.Toolkit;
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.StringSelection;
+import java.awt.datatransfer.Transferable;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.Reader;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.TreeMap;
+
+import org.eclipse.scout.commons.CompositeObject;
+
+/**
+ * Analyze a log file with records of the following format LOG_MESSAGE_LINE
+ * optional STACK TRACE and info
+ */
+public class LogAnalyzer {
+ private int m_totalCount;
+ private int m_filterCount;
+ private ArrayList<LogCategory> m_categories;
+
+ public LogAnalyzer() {
+ }
+
+ public void start(File in, File out, ILogFilter filter) throws Exception {
+ File tmp = new File(out.getAbsolutePath() + ".tmp");
+ tmp.deleteOnExit();
+ start(new FileReader(in), new FileWriter(tmp), filter);
+ if (out.exists() && !out.delete()) {
+ throw new IOException("Cannot delete old version of " + out);
+ }
+ tmp.renameTo(out);
+ }
+
+ public void start(ILogFilter filter) throws Exception {
+ Transferable t = Toolkit.getDefaultToolkit().getSystemClipboard().getContents(null);
+ DataFlavor f = DataFlavor.getTextPlainUnicodeFlavor();
+ if (!t.isDataFlavorSupported(f)) {
+ throw new IOException("Expected COPY/PASTE text");
+ }
+ StringWriter out = new StringWriter();
+ start(f.getReaderForText(t), out, filter);
+ Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(out.getBuffer().toString()), null);
+ System.out.println("PASTED text to clipboard");
+ }
+
+ public void start(Reader in, Writer out, ILogFilter filter) throws Exception {
+ analyze(in, out, filter);
+ }
+
+ private void analyze(Reader in, Writer out, ILogFilter filter) throws Exception {
+ m_totalCount = 0;
+ m_filterCount = 0;
+ m_categories = new ArrayList<LogCategory>();
+ BufferedReader r = new BufferedReader(in);
+ try {
+ String line;
+ ArrayList<String> buf = null;
+ while ((line = r.readLine()) != null) {
+ if (filter.isIgnoredLine(line)) {
+ System.out.println("ignoring line: " + line);
+ }
+ else {
+ if (filter.isLogEntryStartLine(line)) {
+ analyzeBuffer(buf, out, filter);
+ buf = new ArrayList<String>();
+ }
+ if (buf != null) {
+ buf.add(line);
+ }
+ }
+ }
+ analyzeBuffer(buf, out, filter);
+ // write output
+ TreeMap<CompositeObject, LogCategory> sortMap = new TreeMap<CompositeObject, LogCategory>();
+ int index = 0;
+ for (LogCategory c : m_categories) {
+ sortMap.put(new CompositeObject(-c.getEntryCount(), index), c);
+ index++;
+ }
+ for (LogCategory c : sortMap.values()) {
+ out.write(c.format(filter));
+ out.write("\n");
+ }
+ System.out.println("TOTAL " + m_totalCount + " entries\nACCEPTED " + m_filterCount + " in " + m_categories.size() + " CATEGORIES");
+ }
+ finally {
+ try {
+ r.close();
+ }
+ catch (Throwable t) {
+ }
+ try {
+ out.close();
+ }
+ catch (Throwable t) {
+ }
+ }
+ }
+
+ private void analyzeBuffer(List<String> buf, Writer out, ILogFilter filter) throws Exception {
+ if (buf != null && buf.size() > 0) {
+ m_totalCount++;
+ LogEntry e = filter.parse(buf);
+ e = filter.filter(e);
+ if (e != null) {
+ m_filterCount++;
+ LogCategory c = null;
+ for (LogCategory cat : m_categories) {
+ if (cat.isCategoryFor(e)) {
+ c = cat;
+ break;
+ }
+ }
+ if (c == null) {
+ // not categorized
+ c = new LogCategory(e);
+ m_categories.add(c);
+ }
+ c.add(e);
+ }
+ }
+ }
+
+ public static void main(String[] args) throws Exception {
+ ILogFilter filter = new AbstractLogFilter() {
+ @Override
+ public LogEntry filter(LogEntry e) {
+ return e;
+ }
+ };
+ new LogAnalyzer().start(filter);
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/analysis/LogCategory.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/analysis/LogCategory.java
index 46447f7145..260fd09f40 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/analysis/LogCategory.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/analysis/LogCategory.java
@@ -1,109 +1,109 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.logger.analysis;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-public class LogCategory {
- private static Pattern causePattern = Pattern.compile(".*(Caused by: .*)");
-
- private String severity;
- private String source;
- private String attachmentSignature;
- private ArrayList<LogEntry> m_entries;
-
- public LogCategory(LogEntry template) {
- m_entries = new ArrayList<LogEntry>();
- severity = template.severity;
- source = template.source;
- attachmentSignature = createAttachmentSignature(template.attachment);
- }
-
- public int getEntryCount() {
- return m_entries.size();
- }
-
- // parse all "Caused by: javax.servlet.ServletException: abc def"
- private String createAttachmentSignature(String s) {
- if (s == null) {
- return "- none -";
- }
- s = s.trim();
- if (s.length() == 0) {
- return "- none -";
- }
- //
- StringBuffer buf = new StringBuffer();
- for (String line : s.split("\n")) {
- Matcher m = causePattern.matcher(line);
- if (m.matches()) {
- if (buf.length() > 0) {
- buf.append("\n");
- }
- buf.append(m.group(1));
- }
- }
- return buf.toString();
- }
-
- public boolean isCategoryFor(LogEntry e) {
- if (severity.equals(e.severity) && source.equals(e.source) && attachmentSignature.equals(createAttachmentSignature(e.attachment))) {
- return true;
- }
- else {
- return false;
- }
- }
-
- public void add(LogEntry e) {
- m_entries.add(e);
- }
-
- public String format(ILogFilter filter) {
- StringBuffer b = new StringBuffer();
- HashSet<String> attachmentSet = new HashSet<String>();
- for (LogEntry e : m_entries) {
- if (e.attachment.length() > 0) {
- attachmentSet.add(e.attachment);
- }
- }
- // source
- b.append("[");
- b.append(severity);
- b.append("] ");
- b.append(source);
- b.append("\n");
- b.append(m_entries.size() + " occurrences");
- if (attachmentSet.size() >= 2) {
- b.append(" with " + attachmentSet.size() + " different attachments");
- }
- b.append("\n");
- b.append("*** Signature ***\n");
- b.append(attachmentSignature);
- b.append("\n");
- // occurrences
- b.append("*** Headers ***\n");
- for (LogEntry e : m_entries) {
- b.append(filter.formatContext(e));
- b.append("\n");
- }
- // attachment
- b.append("*** Details ***\n");
- for (String s : attachmentSet) {
- b.append(s);
- b.append("\n");
- }
- return b.toString();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.logger.analysis;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class LogCategory {
+ private static Pattern causePattern = Pattern.compile(".*(Caused by: .*)");
+
+ private String severity;
+ private String source;
+ private String attachmentSignature;
+ private ArrayList<LogEntry> m_entries;
+
+ public LogCategory(LogEntry template) {
+ m_entries = new ArrayList<LogEntry>();
+ severity = template.severity;
+ source = template.source;
+ attachmentSignature = createAttachmentSignature(template.attachment);
+ }
+
+ public int getEntryCount() {
+ return m_entries.size();
+ }
+
+ // parse all "Caused by: javax.servlet.ServletException: abc def"
+ private String createAttachmentSignature(String s) {
+ if (s == null) {
+ return "- none -";
+ }
+ s = s.trim();
+ if (s.length() == 0) {
+ return "- none -";
+ }
+ //
+ StringBuffer buf = new StringBuffer();
+ for (String line : s.split("\n")) {
+ Matcher m = causePattern.matcher(line);
+ if (m.matches()) {
+ if (buf.length() > 0) {
+ buf.append("\n");
+ }
+ buf.append(m.group(1));
+ }
+ }
+ return buf.toString();
+ }
+
+ public boolean isCategoryFor(LogEntry e) {
+ if (severity.equals(e.severity) && source.equals(e.source) && attachmentSignature.equals(createAttachmentSignature(e.attachment))) {
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+
+ public void add(LogEntry e) {
+ m_entries.add(e);
+ }
+
+ public String format(ILogFilter filter) {
+ StringBuffer b = new StringBuffer();
+ HashSet<String> attachmentSet = new HashSet<String>();
+ for (LogEntry e : m_entries) {
+ if (e.attachment.length() > 0) {
+ attachmentSet.add(e.attachment);
+ }
+ }
+ // source
+ b.append("[");
+ b.append(severity);
+ b.append("] ");
+ b.append(source);
+ b.append("\n");
+ b.append(m_entries.size() + " occurrences");
+ if (attachmentSet.size() >= 2) {
+ b.append(" with " + attachmentSet.size() + " different attachments");
+ }
+ b.append("\n");
+ b.append("*** Signature ***\n");
+ b.append(attachmentSignature);
+ b.append("\n");
+ // occurrences
+ b.append("*** Headers ***\n");
+ for (LogEntry e : m_entries) {
+ b.append(filter.formatContext(e));
+ b.append("\n");
+ }
+ // attachment
+ b.append("*** Details ***\n");
+ for (String s : attachmentSet) {
+ b.append(s);
+ b.append("\n");
+ }
+ return b.toString();
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/analysis/LogEntry.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/analysis/LogEntry.java
index fc69798d0b..7c96c5248c 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/analysis/LogEntry.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/analysis/LogEntry.java
@@ -1,22 +1,22 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.logger.analysis;
-
-import java.util.Date;
-
-public class LogEntry {
- String severity;
- Date date;
- String thread;
- String source;
- String message;
- String attachment;
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.logger.analysis;
+
+import java.util.Date;
+
+public class LogEntry {
+ String severity;
+ Date date;
+ String thread;
+ String source;
+ String message;
+ String attachment;
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/internal/AbstractScoutLogger.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/internal/AbstractScoutLogger.java
index f7c8aba5e3..2b8f356263 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/internal/AbstractScoutLogger.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/internal/AbstractScoutLogger.java
@@ -1,223 +1,223 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.logger.internal;
-
-import java.util.HashSet;
-import java.util.logging.LogRecord;
-
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.JavaLogUtility;
-
-public abstract class AbstractScoutLogger implements IScoutLogger {
-
- public AbstractScoutLogger() {
- }
-
- protected void log(int level, String format, Object[] args, Throwable t) {
- if (!isLoggable(level)) {
- return;
- }
- LogRecord record = JavaLogUtility.buildLogRecord(AbstractScoutLogger.class, JavaLogUtility.scoutToJavaLevel(level), format, args);
- record.setLoggerName(getName());
- record.setThrown(t);
- logImpl(record);
- }
-
- protected abstract void logImpl(LogRecord record);
-
- protected StackTraceElement getCallerLine(Class wrapperClass) {
- try {
- StackTraceElement[] trace = new Exception().getStackTrace();
- int traceIndex = 0;
- HashSet<String> ignoredPackagePrefixes = new HashSet<String>();
- ignoredPackagePrefixes.add(IScoutLogger.class.getPackage().getName());
- if (wrapperClass != null) {
- ignoredPackagePrefixes.add(wrapperClass.getPackage().getName());
- }
- while (traceIndex < trace.length) {
- boolean found = true;
- for (String prefix : ignoredPackagePrefixes) {
- if (trace[traceIndex].getClassName().startsWith(prefix)) {
- found = false;
- break;
- }
- }
- if (found) {
- break;
- }
- traceIndex++;
- }
- if (traceIndex >= trace.length) {
- traceIndex = trace.length - 1;
- }
- return trace[traceIndex];
- }
- catch (Throwable t) {
- return null;
- }
- }
-
- @Override
- public void debug(String msg) {
- log(LEVEL_DEBUG, msg, null, null);
- }
-
- @Override
- public void debug(String format, Object arg) {
- log(LEVEL_DEBUG, format, new Object[]{arg}, null);
- }
-
- @Override
- public void debug(String format, Object arg1, Object arg2) {
- log(LEVEL_DEBUG, format, new Object[]{arg1, arg2}, null);
- }
-
- @Override
- public void debug(String format, Object[] argArray) {
- log(LEVEL_DEBUG, format, argArray, null);
- }
-
- @Override
- public void debug(String msg, Throwable t) {
- log(LEVEL_DEBUG, msg, null, t);
- }
-
- @Override
- public void error(String msg) {
- log(LEVEL_ERROR, msg, null, null);
- }
-
- @Override
- public void error(String format, Object arg) {
- log(LEVEL_ERROR, format, new Object[]{arg}, null);
- }
-
- @Override
- public void error(String format, Object arg1, Object arg2) {
- log(LEVEL_ERROR, format, new Object[]{arg1, arg2}, null);
- }
-
- @Override
- public void error(String format, Object[] argArray) {
- log(LEVEL_ERROR, format, argArray, null);
- }
-
- @Override
- public void error(String msg, Throwable t) {
- log(LEVEL_ERROR, msg, null, t);
- }
-
- @Override
- public void info(String msg) {
- log(LEVEL_INFO, msg, null, null);
- }
-
- @Override
- public void info(String format, Object arg) {
- log(LEVEL_INFO, format, new Object[]{arg}, null);
- }
-
- @Override
- public void info(String format, Object arg1, Object arg2) {
- log(LEVEL_INFO, format, new Object[]{arg1, arg2}, null);
- }
-
- @Override
- public void info(String format, Object[] argArray) {
- log(LEVEL_INFO, format, argArray, null);
- }
-
- @Override
- public void info(String msg, Throwable t) {
- log(LEVEL_INFO, msg, null, t);
- }
-
- @Override
- public void trace(String msg) {
- log(LEVEL_TRACE, msg, null, null);
- }
-
- @Override
- public void trace(String format, Object arg) {
- log(LEVEL_TRACE, format, new Object[]{arg}, null);
- }
-
- @Override
- public void trace(String format, Object arg1, Object arg2) {
- log(LEVEL_TRACE, format, new Object[]{arg1, arg2}, null);
- }
-
- @Override
- public void trace(String format, Object[] argArray) {
- log(LEVEL_TRACE, format, argArray, null);
- }
-
- @Override
- public void trace(String msg, Throwable t) {
- log(LEVEL_TRACE, msg, null, t);
- }
-
- @Override
- public void warn(String msg) {
- log(LEVEL_WARN, msg, null, null);
- }
-
- @Override
- public void warn(String format, Object arg) {
- log(LEVEL_WARN, format, new Object[]{arg}, null);
- }
-
- @Override
- public void warn(String format, Object[] argArray) {
- log(LEVEL_WARN, format, argArray, null);
- }
-
- @Override
- public void warn(String format, Object arg1, Object arg2) {
- log(LEVEL_WARN, format, new Object[]{arg1, arg2}, null);
- }
-
- @Override
- public void warn(String msg, Throwable t) {
- log(LEVEL_WARN, msg, null, t);
- }
-
- @Override
- public boolean isTraceEnabled() {
- return isLoggable(LEVEL_TRACE);
- }
-
- @Override
- public boolean isDebugEnabled() {
- return isLoggable(LEVEL_DEBUG);
- }
-
- @Override
- public boolean isInfoEnabled() {
- return isLoggable(LEVEL_INFO);
- }
-
- @Override
- public boolean isWarnEnabled() {
- return isLoggable(LEVEL_WARN);
- }
-
- @Override
- public boolean isErrorEnabled() {
- return isLoggable(LEVEL_ERROR);
- }
-
- @Override
- public boolean isLoggable(int level) {
- return getLevel() >= level;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.logger.internal;
+
+import java.util.HashSet;
+import java.util.logging.LogRecord;
+
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.JavaLogUtility;
+
+public abstract class AbstractScoutLogger implements IScoutLogger {
+
+ public AbstractScoutLogger() {
+ }
+
+ protected void log(int level, String format, Object[] args, Throwable t) {
+ if (!isLoggable(level)) {
+ return;
+ }
+ LogRecord record = JavaLogUtility.buildLogRecord(AbstractScoutLogger.class, JavaLogUtility.scoutToJavaLevel(level), format, args);
+ record.setLoggerName(getName());
+ record.setThrown(t);
+ logImpl(record);
+ }
+
+ protected abstract void logImpl(LogRecord record);
+
+ protected StackTraceElement getCallerLine(Class wrapperClass) {
+ try {
+ StackTraceElement[] trace = new Exception().getStackTrace();
+ int traceIndex = 0;
+ HashSet<String> ignoredPackagePrefixes = new HashSet<String>();
+ ignoredPackagePrefixes.add(IScoutLogger.class.getPackage().getName());
+ if (wrapperClass != null) {
+ ignoredPackagePrefixes.add(wrapperClass.getPackage().getName());
+ }
+ while (traceIndex < trace.length) {
+ boolean found = true;
+ for (String prefix : ignoredPackagePrefixes) {
+ if (trace[traceIndex].getClassName().startsWith(prefix)) {
+ found = false;
+ break;
+ }
+ }
+ if (found) {
+ break;
+ }
+ traceIndex++;
+ }
+ if (traceIndex >= trace.length) {
+ traceIndex = trace.length - 1;
+ }
+ return trace[traceIndex];
+ }
+ catch (Throwable t) {
+ return null;
+ }
+ }
+
+ @Override
+ public void debug(String msg) {
+ log(LEVEL_DEBUG, msg, null, null);
+ }
+
+ @Override
+ public void debug(String format, Object arg) {
+ log(LEVEL_DEBUG, format, new Object[]{arg}, null);
+ }
+
+ @Override
+ public void debug(String format, Object arg1, Object arg2) {
+ log(LEVEL_DEBUG, format, new Object[]{arg1, arg2}, null);
+ }
+
+ @Override
+ public void debug(String format, Object[] argArray) {
+ log(LEVEL_DEBUG, format, argArray, null);
+ }
+
+ @Override
+ public void debug(String msg, Throwable t) {
+ log(LEVEL_DEBUG, msg, null, t);
+ }
+
+ @Override
+ public void error(String msg) {
+ log(LEVEL_ERROR, msg, null, null);
+ }
+
+ @Override
+ public void error(String format, Object arg) {
+ log(LEVEL_ERROR, format, new Object[]{arg}, null);
+ }
+
+ @Override
+ public void error(String format, Object arg1, Object arg2) {
+ log(LEVEL_ERROR, format, new Object[]{arg1, arg2}, null);
+ }
+
+ @Override
+ public void error(String format, Object[] argArray) {
+ log(LEVEL_ERROR, format, argArray, null);
+ }
+
+ @Override
+ public void error(String msg, Throwable t) {
+ log(LEVEL_ERROR, msg, null, t);
+ }
+
+ @Override
+ public void info(String msg) {
+ log(LEVEL_INFO, msg, null, null);
+ }
+
+ @Override
+ public void info(String format, Object arg) {
+ log(LEVEL_INFO, format, new Object[]{arg}, null);
+ }
+
+ @Override
+ public void info(String format, Object arg1, Object arg2) {
+ log(LEVEL_INFO, format, new Object[]{arg1, arg2}, null);
+ }
+
+ @Override
+ public void info(String format, Object[] argArray) {
+ log(LEVEL_INFO, format, argArray, null);
+ }
+
+ @Override
+ public void info(String msg, Throwable t) {
+ log(LEVEL_INFO, msg, null, t);
+ }
+
+ @Override
+ public void trace(String msg) {
+ log(LEVEL_TRACE, msg, null, null);
+ }
+
+ @Override
+ public void trace(String format, Object arg) {
+ log(LEVEL_TRACE, format, new Object[]{arg}, null);
+ }
+
+ @Override
+ public void trace(String format, Object arg1, Object arg2) {
+ log(LEVEL_TRACE, format, new Object[]{arg1, arg2}, null);
+ }
+
+ @Override
+ public void trace(String format, Object[] argArray) {
+ log(LEVEL_TRACE, format, argArray, null);
+ }
+
+ @Override
+ public void trace(String msg, Throwable t) {
+ log(LEVEL_TRACE, msg, null, t);
+ }
+
+ @Override
+ public void warn(String msg) {
+ log(LEVEL_WARN, msg, null, null);
+ }
+
+ @Override
+ public void warn(String format, Object arg) {
+ log(LEVEL_WARN, format, new Object[]{arg}, null);
+ }
+
+ @Override
+ public void warn(String format, Object[] argArray) {
+ log(LEVEL_WARN, format, argArray, null);
+ }
+
+ @Override
+ public void warn(String format, Object arg1, Object arg2) {
+ log(LEVEL_WARN, format, new Object[]{arg1, arg2}, null);
+ }
+
+ @Override
+ public void warn(String msg, Throwable t) {
+ log(LEVEL_WARN, msg, null, t);
+ }
+
+ @Override
+ public boolean isTraceEnabled() {
+ return isLoggable(LEVEL_TRACE);
+ }
+
+ @Override
+ public boolean isDebugEnabled() {
+ return isLoggable(LEVEL_DEBUG);
+ }
+
+ @Override
+ public boolean isInfoEnabled() {
+ return isLoggable(LEVEL_INFO);
+ }
+
+ @Override
+ public boolean isWarnEnabled() {
+ return isLoggable(LEVEL_WARN);
+ }
+
+ @Override
+ public boolean isErrorEnabled() {
+ return isLoggable(LEVEL_ERROR);
+ }
+
+ @Override
+ public boolean isLoggable(int level) {
+ return getLevel() >= level;
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/internal/eclipse/EclipseLogWrapper.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/internal/eclipse/EclipseLogWrapper.java
index 86728eed01..3b179a7251 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/internal/eclipse/EclipseLogWrapper.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/internal/eclipse/EclipseLogWrapper.java
@@ -1,107 +1,107 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.logger.internal.eclipse;
-
-import java.util.logging.LogRecord;
-
-import org.eclipse.core.runtime.ILog;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.scout.commons.internal.Activator;
-import org.eclipse.scout.commons.logger.EclipseLogUtility;
-import org.eclipse.scout.commons.logger.JavaLogUtility;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.commons.logger.internal.AbstractScoutLogger;
-import org.osgi.framework.Bundle;
-
-/**
- * This implementation is a wrapper for {@link ILog}
- */
-public class EclipseLogWrapper extends AbstractScoutLogger {
-
- private String m_name;
- private int m_level;
-
- public EclipseLogWrapper(String name, int level) {
- m_name = name;
- m_level = level;
- }
-
- @Override
- public String getName() {
- return m_name;
- }
-
- @Override
- public int getLevel() {
- Integer globalLogLevel = ScoutLogManager.getGlobalLogLevel();
- if (globalLogLevel != null) {
- return globalLogLevel;
- }
- return m_level;
- }
-
- @Override
- public void setLevel(int level) {
- m_level = level;
- }
-
- @Override
- protected void logImpl(LogRecord record) {
- String path = stripOffLastSegment(record.getLoggerName());
- Bundle bundle = null;
- while (path != null) {
- bundle = Platform.getBundle(path);
- if (bundle != null) {
- break;
- }
- path = stripOffLastSegment(path);
- }
- if (bundle == null) {
- bundle = Activator.getDefault().getBundle();
- }
- //
- StringBuffer buf = new StringBuffer();
- if (record.getSourceClassName() != null) {
- buf.append(record.getSourceClassName());
- if (record.getSourceMethodName() != null) {
- buf.append(".");
- buf.append(record.getSourceMethodName());
- }
- }
- else {
- buf.append(record.getLoggerName());
- }
- if (bundle != null) {
- int scoutLevel = JavaLogUtility.javaToScoutLevel(record.getLevel());
- int severity = EclipseLogUtility.scoutToEclipseLevel(scoutLevel);
- Status status = new Status(severity, bundle.getSymbolicName(), 0, buf.toString() + " " + record.getMessage(), record.getThrown());
- Platform.getLog(bundle).log(status);
- }
- else {
- System.err.println("Failed logging entry " + record.getLoggerName() + " " + buf.toString() + " " + record.getMessage());
- }
- }
-
- public String stripOffLastSegment(String s) {
- if (s == null) {
- return null;
- }
- int i = s.lastIndexOf('.');
- if (i >= 0) {
- s = s.substring(0, i).trim();
- return s.length() > 0 ? s : null;
- }
- else {
- return null;
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.logger.internal.eclipse;
+
+import java.util.logging.LogRecord;
+
+import org.eclipse.core.runtime.ILog;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.scout.commons.internal.Activator;
+import org.eclipse.scout.commons.logger.EclipseLogUtility;
+import org.eclipse.scout.commons.logger.JavaLogUtility;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.commons.logger.internal.AbstractScoutLogger;
+import org.osgi.framework.Bundle;
+
+/**
+ * This implementation is a wrapper for {@link ILog}
+ */
+public class EclipseLogWrapper extends AbstractScoutLogger {
+
+ private String m_name;
+ private int m_level;
+
+ public EclipseLogWrapper(String name, int level) {
+ m_name = name;
+ m_level = level;
+ }
+
+ @Override
+ public String getName() {
+ return m_name;
+ }
+
+ @Override
+ public int getLevel() {
+ Integer globalLogLevel = ScoutLogManager.getGlobalLogLevel();
+ if (globalLogLevel != null) {
+ return globalLogLevel;
+ }
+ return m_level;
+ }
+
+ @Override
+ public void setLevel(int level) {
+ m_level = level;
+ }
+
+ @Override
+ protected void logImpl(LogRecord record) {
+ String path = stripOffLastSegment(record.getLoggerName());
+ Bundle bundle = null;
+ while (path != null) {
+ bundle = Platform.getBundle(path);
+ if (bundle != null) {
+ break;
+ }
+ path = stripOffLastSegment(path);
+ }
+ if (bundle == null) {
+ bundle = Activator.getDefault().getBundle();
+ }
+ //
+ StringBuffer buf = new StringBuffer();
+ if (record.getSourceClassName() != null) {
+ buf.append(record.getSourceClassName());
+ if (record.getSourceMethodName() != null) {
+ buf.append(".");
+ buf.append(record.getSourceMethodName());
+ }
+ }
+ else {
+ buf.append(record.getLoggerName());
+ }
+ if (bundle != null) {
+ int scoutLevel = JavaLogUtility.javaToScoutLevel(record.getLevel());
+ int severity = EclipseLogUtility.scoutToEclipseLevel(scoutLevel);
+ Status status = new Status(severity, bundle.getSymbolicName(), 0, buf.toString() + " " + record.getMessage(), record.getThrown());
+ Platform.getLog(bundle).log(status);
+ }
+ else {
+ System.err.println("Failed logging entry " + record.getLoggerName() + " " + buf.toString() + " " + record.getMessage());
+ }
+ }
+
+ public String stripOffLastSegment(String s) {
+ if (s == null) {
+ return null;
+ }
+ int i = s.lastIndexOf('.');
+ if (i >= 0) {
+ s = s.substring(0, i).trim();
+ return s.length() > 0 ? s : null;
+ }
+ else {
+ return null;
+ }
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/internal/eclipse/EclipseScoutLogManager.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/internal/eclipse/EclipseScoutLogManager.java
index b2a38047d9..f3fee6b3b7 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/internal/eclipse/EclipseScoutLogManager.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/internal/eclipse/EclipseScoutLogManager.java
@@ -1,204 +1,204 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.logger.internal.eclipse;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.logging.Level;
-
-import org.eclipse.core.runtime.ILogListener;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.scout.commons.IOUtility;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.internal.Activator;
-import org.eclipse.scout.commons.logger.EclipseLogUtility;
-import org.eclipse.scout.commons.logger.IScoutLogManager;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.JavaLogUtility;
-import org.eclipse.scout.commons.logger.internal.java.JavaScoutLogManager;
-
-/**
- * The default Scout log manager when using Eclipse logging.
- * <p>
- * When being initialized, the manager installs a listener to the {@link Platform} in order to also delegate Eclipse log
- * event to JUL.
- * </p>
- * <p>
- * If a global log level is set, it is simply hold by this log manager. It is business of the @{link
- * {@link EclipseLogWrapper}'s to take into account this level when handling log events.
- * </p>
- * <p>
- * Recording of log messages is implemented the way of installing a {@link ILogListener} to the {@link Platform} in
- * order to intercept log message events. In turn, the log messages are written into a temporary file that is returned
- * when recording is stopped.
- * </p>
- */
-public class EclipseScoutLogManager implements IScoutLogManager {
-
- private Integer m_globalLogLevel;
- private P_LogListener m_logListener;
- private Object m_recordingLock;
-
- public EclipseScoutLogManager() {
- m_recordingLock = new Object();
- }
-
- @Override
- public void initialize() {
- }
-
- @Override
- public void setGlobalLogLevel(Integer globalLogLevel) {
- m_globalLogLevel = globalLogLevel;
- }
-
- @Override
- public Integer getGlobalLogLevel() {
- return m_globalLogLevel;
- }
-
- @Override
- public IScoutLogger getLogger(String name) {
- return new EclipseLogWrapper(name, getSystemLogLevel());
- }
-
- @Override
- public IScoutLogger getLogger(Class clazz) {
- return getLogger(clazz.getName());
- }
-
- @Override
- public boolean startRecording() throws ProcessingException {
- synchronized (m_recordingLock) {
- if (m_logListener == null) {
- m_logListener = new P_LogListener();
- Platform.addLogListener(m_logListener);
- return true;
- }
- }
- return false;
- }
-
- @Override
- public File stopRecording() {
- synchronized (m_recordingLock) {
- if (m_logListener == null) {
- return null;
- }
- Platform.removeLogListener(m_logListener);
- File logFile = m_logListener.getLogFile();
- m_logListener = null;
- return logFile;
- }
- }
-
- private int getSystemLogLevel() {
- String levelText = StringUtility.uppercase(Activator.getDefault().getBundle().getBundleContext().getProperty("org.eclipse.scout.log.level"));
- if (!StringUtility.hasText(levelText)) {
- levelText = "WARNING";
- }
-
- if ("ERROR".equals(levelText)) {
- return IScoutLogger.LEVEL_ERROR;
- }
- else if ("WARNING".equals(levelText)) {
- return IScoutLogger.LEVEL_WARN;
- }
- else if ("INFO".equals(levelText)) {
- return IScoutLogger.LEVEL_INFO;
- }
- else if ("DEBUG".equals(levelText)) {
- return IScoutLogger.LEVEL_DEBUG;
- }
- else {
- return IScoutLogger.LEVEL_WARN;
- }
- }
-
- private final class P_LogListener implements ILogListener {
-
- private File m_logFile;
- private BufferedWriter m_logWriter;
-
- public P_LogListener() throws ProcessingException {
- try {
- m_logFile = IOUtility.createTempFile("log.log", null);
- m_logWriter = new BufferedWriter(new FileWriter(m_logFile));
- }
- catch (Exception e) {
- throw new ProcessingException("could not install log listener", e);
- }
- }
-
- @Override
- public void logging(IStatus status, String plugin) {
- int severity = EclipseLogUtility.eclipseToScoutLevel(status.getSeverity());
- Level level = JavaLogUtility.scoutToJavaLevel(severity);
-
- String logLevel = "[" + level.getName() + "] ";
- String logPlugin;
- if (StringUtility.hasText(status.getPlugin())) {
- logPlugin = "plug-In=" + status.getPlugin();
- }
- else {
- logPlugin = "plug-In=" + plugin;
- }
- String logCode = null;
- if (status.getCode() != 0) {
- logCode = "code=" + status.getCode();
- }
-
- String log = StringUtility.join(" ", logLevel, getFormattedDate(), logPlugin, logCode, status.getMessage(), getStackTrace(status.getException()));
- try {
- m_logWriter.write(log);
- m_logWriter.newLine();
- }
- catch (IOException e) {
- System.err.println("Failed recording logging entry");
- }
- }
-
- public File getLogFile() {
- try {
- m_logWriter.flush();
- m_logWriter.close();
- return m_logFile;
- }
- catch (IOException e) {
- getLogger(JavaScoutLogManager.class).error("could not get log file", e);
- }
- return null;
- }
-
- private String getFormattedDate() {
- Calendar calendar = Calendar.getInstance();
- calendar.setTimeInMillis(System.currentTimeMillis());
- return new SimpleDateFormat("yyyy.MM.dd-HH:mm:ss").format(calendar.getTime());
- }
-
- private String getStackTrace(Throwable t) {
- if (t == null) {
- return null;
- }
- StringWriter writer = new StringWriter();
- t.printStackTrace(new PrintWriter(writer));
- return writer.toString();
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.logger.internal.eclipse;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.logging.Level;
+
+import org.eclipse.core.runtime.ILogListener;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.scout.commons.IOUtility;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.internal.Activator;
+import org.eclipse.scout.commons.logger.EclipseLogUtility;
+import org.eclipse.scout.commons.logger.IScoutLogManager;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.JavaLogUtility;
+import org.eclipse.scout.commons.logger.internal.java.JavaScoutLogManager;
+
+/**
+ * The default Scout log manager when using Eclipse logging.
+ * <p>
+ * When being initialized, the manager installs a listener to the {@link Platform} in order to also delegate Eclipse log
+ * event to JUL.
+ * </p>
+ * <p>
+ * If a global log level is set, it is simply hold by this log manager. It is business of the @{link
+ * {@link EclipseLogWrapper}'s to take into account this level when handling log events.
+ * </p>
+ * <p>
+ * Recording of log messages is implemented the way of installing a {@link ILogListener} to the {@link Platform} in
+ * order to intercept log message events. In turn, the log messages are written into a temporary file that is returned
+ * when recording is stopped.
+ * </p>
+ */
+public class EclipseScoutLogManager implements IScoutLogManager {
+
+ private Integer m_globalLogLevel;
+ private P_LogListener m_logListener;
+ private Object m_recordingLock;
+
+ public EclipseScoutLogManager() {
+ m_recordingLock = new Object();
+ }
+
+ @Override
+ public void initialize() {
+ }
+
+ @Override
+ public void setGlobalLogLevel(Integer globalLogLevel) {
+ m_globalLogLevel = globalLogLevel;
+ }
+
+ @Override
+ public Integer getGlobalLogLevel() {
+ return m_globalLogLevel;
+ }
+
+ @Override
+ public IScoutLogger getLogger(String name) {
+ return new EclipseLogWrapper(name, getSystemLogLevel());
+ }
+
+ @Override
+ public IScoutLogger getLogger(Class clazz) {
+ return getLogger(clazz.getName());
+ }
+
+ @Override
+ public boolean startRecording() throws ProcessingException {
+ synchronized (m_recordingLock) {
+ if (m_logListener == null) {
+ m_logListener = new P_LogListener();
+ Platform.addLogListener(m_logListener);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public File stopRecording() {
+ synchronized (m_recordingLock) {
+ if (m_logListener == null) {
+ return null;
+ }
+ Platform.removeLogListener(m_logListener);
+ File logFile = m_logListener.getLogFile();
+ m_logListener = null;
+ return logFile;
+ }
+ }
+
+ private int getSystemLogLevel() {
+ String levelText = StringUtility.uppercase(Activator.getDefault().getBundle().getBundleContext().getProperty("org.eclipse.scout.log.level"));
+ if (!StringUtility.hasText(levelText)) {
+ levelText = "WARNING";
+ }
+
+ if ("ERROR".equals(levelText)) {
+ return IScoutLogger.LEVEL_ERROR;
+ }
+ else if ("WARNING".equals(levelText)) {
+ return IScoutLogger.LEVEL_WARN;
+ }
+ else if ("INFO".equals(levelText)) {
+ return IScoutLogger.LEVEL_INFO;
+ }
+ else if ("DEBUG".equals(levelText)) {
+ return IScoutLogger.LEVEL_DEBUG;
+ }
+ else {
+ return IScoutLogger.LEVEL_WARN;
+ }
+ }
+
+ private final class P_LogListener implements ILogListener {
+
+ private File m_logFile;
+ private BufferedWriter m_logWriter;
+
+ public P_LogListener() throws ProcessingException {
+ try {
+ m_logFile = IOUtility.createTempFile("log.log", null);
+ m_logWriter = new BufferedWriter(new FileWriter(m_logFile));
+ }
+ catch (Exception e) {
+ throw new ProcessingException("could not install log listener", e);
+ }
+ }
+
+ @Override
+ public void logging(IStatus status, String plugin) {
+ int severity = EclipseLogUtility.eclipseToScoutLevel(status.getSeverity());
+ Level level = JavaLogUtility.scoutToJavaLevel(severity);
+
+ String logLevel = "[" + level.getName() + "] ";
+ String logPlugin;
+ if (StringUtility.hasText(status.getPlugin())) {
+ logPlugin = "plug-In=" + status.getPlugin();
+ }
+ else {
+ logPlugin = "plug-In=" + plugin;
+ }
+ String logCode = null;
+ if (status.getCode() != 0) {
+ logCode = "code=" + status.getCode();
+ }
+
+ String log = StringUtility.join(" ", logLevel, getFormattedDate(), logPlugin, logCode, status.getMessage(), getStackTrace(status.getException()));
+ try {
+ m_logWriter.write(log);
+ m_logWriter.newLine();
+ }
+ catch (IOException e) {
+ System.err.println("Failed recording logging entry");
+ }
+ }
+
+ public File getLogFile() {
+ try {
+ m_logWriter.flush();
+ m_logWriter.close();
+ return m_logFile;
+ }
+ catch (IOException e) {
+ getLogger(JavaScoutLogManager.class).error("could not get log file", e);
+ }
+ return null;
+ }
+
+ private String getFormattedDate() {
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTimeInMillis(System.currentTimeMillis());
+ return new SimpleDateFormat("yyyy.MM.dd-HH:mm:ss").format(calendar.getTime());
+ }
+
+ private String getStackTrace(Throwable t) {
+ if (t == null) {
+ return null;
+ }
+ StringWriter writer = new StringWriter();
+ t.printStackTrace(new PrintWriter(writer));
+ return writer.toString();
+ }
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/internal/java/JavaLogFormatter.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/internal/java/JavaLogFormatter.java
index 2c0ede37b0..4c96a738ce 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/internal/java/JavaLogFormatter.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/internal/java/JavaLogFormatter.java
@@ -1,73 +1,73 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.logger.internal.java;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.logging.Formatter;
-import java.util.logging.LogRecord;
-
-public class JavaLogFormatter extends Formatter {
- private final static SimpleDateFormat TIMESTAMP_FORMAT = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss.SSS");
-
- private Date m_tmpDate = new Date();
-
- /**
- * Format the given LogRecord.
- *
- * @param record
- * the log record to be formatted.
- * @return a formatted log record
- */
- @Override
- public synchronized String format(LogRecord record) {
- StringBuffer buf = new StringBuffer();
- //single instance of date to save memory
- m_tmpDate.setTime(record.getMillis());
- buf.append(TIMESTAMP_FORMAT.format(m_tmpDate));
- buf.append(" ");
- String levelText = record.getLevel().getName();
- if (levelText.equals("SEVERE")) {
- levelText = "ERROR";
- }
- buf.append(levelText);
- buf.append(" ");
- if (record.getSourceClassName() != null) {
- buf.append(record.getSourceClassName());
- if (record.getSourceMethodName() != null) {
- buf.append(".");
- buf.append(record.getSourceMethodName());
- }
- }
- else {
- buf.append(record.getLoggerName());
- }
- buf.append(" ");
- buf.append(formatMessage(record));
- if (record.getThrown() != null) {
- buf.append("\n");
- try {
- StringWriter sw = new StringWriter();
- PrintWriter p = new PrintWriter(sw);
- record.getThrown().printStackTrace(p);
- p.close();
- buf.append(sw.toString());
- }
- catch (Exception e) {
- //nop
- }
- }
- buf.append("\n");
- return buf.toString();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.logger.internal.java;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.logging.Formatter;
+import java.util.logging.LogRecord;
+
+public class JavaLogFormatter extends Formatter {
+ private final static SimpleDateFormat TIMESTAMP_FORMAT = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss.SSS");
+
+ private Date m_tmpDate = new Date();
+
+ /**
+ * Format the given LogRecord.
+ *
+ * @param record
+ * the log record to be formatted.
+ * @return a formatted log record
+ */
+ @Override
+ public synchronized String format(LogRecord record) {
+ StringBuffer buf = new StringBuffer();
+ //single instance of date to save memory
+ m_tmpDate.setTime(record.getMillis());
+ buf.append(TIMESTAMP_FORMAT.format(m_tmpDate));
+ buf.append(" ");
+ String levelText = record.getLevel().getName();
+ if (levelText.equals("SEVERE")) {
+ levelText = "ERROR";
+ }
+ buf.append(levelText);
+ buf.append(" ");
+ if (record.getSourceClassName() != null) {
+ buf.append(record.getSourceClassName());
+ if (record.getSourceMethodName() != null) {
+ buf.append(".");
+ buf.append(record.getSourceMethodName());
+ }
+ }
+ else {
+ buf.append(record.getLoggerName());
+ }
+ buf.append(" ");
+ buf.append(formatMessage(record));
+ if (record.getThrown() != null) {
+ buf.append("\n");
+ try {
+ StringWriter sw = new StringWriter();
+ PrintWriter p = new PrintWriter(sw);
+ record.getThrown().printStackTrace(p);
+ p.close();
+ buf.append(sw.toString());
+ }
+ catch (Exception e) {
+ //nop
+ }
+ }
+ buf.append("\n");
+ return buf.toString();
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/internal/java/JavaLogWrapper.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/internal/java/JavaLogWrapper.java
index d9ebf44554..2a373a1069 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/internal/java/JavaLogWrapper.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/internal/java/JavaLogWrapper.java
@@ -1,59 +1,59 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.logger.internal.java;
-
-import java.util.logging.LogRecord;
-import java.util.logging.Logger;
-
-import org.eclipse.scout.commons.logger.JavaLogUtility;
-import org.eclipse.scout.commons.logger.internal.AbstractScoutLogger;
-
-/**
- * This implementation is a wrapper for {@link Logger}
- */
-public class JavaLogWrapper extends AbstractScoutLogger {
-
- private Logger m_logger;
-
- public JavaLogWrapper(String name) {
- m_logger = Logger.getLogger(name);
- }
-
- @Override
- public String getName() {
- return m_logger.getName();
- }
-
- @Override
- public int getLevel() {
- Logger loggerWithLevel = m_logger;
- while (loggerWithLevel.getLevel() == null && loggerWithLevel.getParent() != null) {
- loggerWithLevel = loggerWithLevel.getParent();
- }
- return JavaLogUtility.javaToScoutLevel(loggerWithLevel.getLevel());
- }
-
- @Override
- public void setLevel(int level) {
- m_logger.setLevel(JavaLogUtility.scoutToJavaLevel(level));
- }
-
- @Override
- protected void logImpl(LogRecord record) {
- m_logger.log(record);
- }
-
- @Override
- public boolean isLoggable(int logLevel) {
- return m_logger.isLoggable(JavaLogUtility.scoutToJavaLevel(logLevel));
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.logger.internal.java;
+
+import java.util.logging.LogRecord;
+import java.util.logging.Logger;
+
+import org.eclipse.scout.commons.logger.JavaLogUtility;
+import org.eclipse.scout.commons.logger.internal.AbstractScoutLogger;
+
+/**
+ * This implementation is a wrapper for {@link Logger}
+ */
+public class JavaLogWrapper extends AbstractScoutLogger {
+
+ private Logger m_logger;
+
+ public JavaLogWrapper(String name) {
+ m_logger = Logger.getLogger(name);
+ }
+
+ @Override
+ public String getName() {
+ return m_logger.getName();
+ }
+
+ @Override
+ public int getLevel() {
+ Logger loggerWithLevel = m_logger;
+ while (loggerWithLevel.getLevel() == null && loggerWithLevel.getParent() != null) {
+ loggerWithLevel = loggerWithLevel.getParent();
+ }
+ return JavaLogUtility.javaToScoutLevel(loggerWithLevel.getLevel());
+ }
+
+ @Override
+ public void setLevel(int level) {
+ m_logger.setLevel(JavaLogUtility.scoutToJavaLevel(level));
+ }
+
+ @Override
+ protected void logImpl(LogRecord record) {
+ m_logger.log(record);
+ }
+
+ @Override
+ public boolean isLoggable(int logLevel) {
+ return m_logger.isLoggable(JavaLogUtility.scoutToJavaLevel(logLevel));
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/internal/java/JavaScoutLogManager.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/internal/java/JavaScoutLogManager.java
index ead831af1f..f6c76fd174 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/internal/java/JavaScoutLogManager.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/internal/java/JavaScoutLogManager.java
@@ -1,224 +1,224 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.logger.internal.java;
-
-import java.io.File;
-import java.util.Enumeration;
-import java.util.logging.Handler;
-import java.util.logging.Level;
-import java.util.logging.LogManager;
-import java.util.logging.LogRecord;
-import java.util.logging.Logger;
-import java.util.logging.SimpleFormatter;
-
-import org.eclipse.core.runtime.ILogListener;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.scout.commons.IOUtility;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.EclipseLogUtility;
-import org.eclipse.scout.commons.logger.IScoutLogManager;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.JavaLogUtility;
-
-/**
- * The default Scout log manager when using java.util.logging (JUL).
- * <p>
- * When being initialized, the manager installs a listener to the {@link Platform} in order to also delegate Eclipse log
- * event to JUL.
- * </p>
- * <p>
- * A global log level is set by setting the levels of all child loggers to null to inherit the configuration of the root
- * logger. In turn, the level of the root logger is set to the global log level. Furthermore, the level of all attached
- * log handlers is set to the given global log level.
- * </p>
- * <p>
- * Recording of log messages is implemented the way of installing a log handler to JUL. Thereby, all log messages are
- * written into a temporary ZIP file that is returned when recording is stopped.
- * </p>
- */
-public class JavaScoutLogManager implements IScoutLogManager {
-
- private Object m_recordingLock;
- private LogRecorderHandler m_logRecorderHandler;
- private ILogListener m_eclipseLogListener;
- private boolean m_globalLogLevelSet;
-
- public JavaScoutLogManager() {
- m_recordingLock = new Object();
- m_eclipseLogListener = new P_EclipseToJavaDelegateListener();
- }
-
- /**
- * Redirect eclipse log to java log
- * <p>
- * Make two enhancements
- * <ol>
- * <li>set default log level for root to WARNING if there is no custom config. INFO is insane as a default-default</li>
- * <li>install "better" simple log formatter when SimpleFormatter is used</li>
- * </ol>
- */
- @Override
- public void initialize() {
- if (Platform.isRunning()) {
- Platform.addLogListener(m_eclipseLogListener);
- }
-
- Logger root = Logger.getLogger("");
- if (root.getLevel() == Level.INFO) {
- if (System.getProperty("java.util.logging.config.class") == null && System.getProperty("java.util.logging.config.file") == null) {
- root.setLevel(Level.WARNING);
- }
- }
-
- for (Handler h : root.getHandlers()) {
- if (h.getFormatter() instanceof SimpleFormatter) {
- h.setFormatter(new JavaLogFormatter());
- }
- }
- }
-
- @Override
- public IScoutLogger getLogger(String name) {
- return new JavaLogWrapper(name);
- }
-
- @Override
- public IScoutLogger getLogger(Class clazz) {
- return getLogger(clazz.getName());
- }
-
- @Override
- public void setGlobalLogLevel(Integer globalLogLevel) {
- if (globalLogLevel == null) {
- // reset logger configuration
- m_globalLogLevelSet = false;
- try {
- LogManager.getLogManager().getLogger("").setLevel(null);
- LogManager.getLogManager().readConfiguration();
- }
- catch (Exception e) {
- getLogger(JavaScoutLogManager.class).error("could not restore logging configuration", e);
- }
- }
- else {
- //set global log level to all loggers and handlers
- m_globalLogLevelSet = true;
-
- Level javaLogLevel = JavaLogUtility.scoutToJavaLevel(globalLogLevel);
-
- // first, reset the level of loggers as only level of root logger is set afterwards
- Enumeration<String> loggerNames = LogManager.getLogManager().getLoggerNames();
- while (loggerNames.hasMoreElements()) {
- Logger logger = LogManager.getLogManager().getLogger(loggerNames.nextElement());
- if (logger == null) {
- continue; // failsafe in case a logger has been removed in the meantime
- }
- if (logger.getLevel() != null && logger.getLevel() != javaLogLevel) {
- logger.setLevel(null);
- }
-
- // update level of attached handlers to the given level
- for (Handler handler : logger.getHandlers()) {
- handler.setLevel(javaLogLevel);
- }
- }
-
- // instruct root logger to log all messages of the given level
- LogManager.getLogManager().getLogger("").setLevel(javaLogLevel);
- }
- }
-
- @Override
- public Integer getGlobalLogLevel() {
- if (m_globalLogLevelSet) {
- Level level = LogManager.getLogManager().getLogger("").getLevel();
- return JavaLogUtility.javaToScoutLevel(level);
- }
- return null;
- }
-
- @Override
- public boolean startRecording() throws ProcessingException {
- synchronized (m_recordingLock) {
- if (m_logRecorderHandler == null) {
- m_logRecorderHandler = createLogRecordingHandler();
-
- Logger root = Logger.getLogger("");
- root.addHandler(m_logRecorderHandler);
- return true;
- }
- return false;
- }
- }
-
- @Override
- public File stopRecording() {
- synchronized (m_recordingLock) {
- if (m_logRecorderHandler == null) {
- return null;
- }
- File logFile = m_logRecorderHandler.getLogFile();
- m_logRecorderHandler = null;
-
- // remove installed handler
- Logger root = Logger.getLogger("");
- root.removeHandler(m_logRecorderHandler);
-
- return logFile;
- }
- }
-
- /**
- * To create a handler to record the log messages
- *
- * @return
- * @throws ProcessingException
- */
- protected LogRecorderHandler createLogRecordingHandler() throws ProcessingException {
- try {
- File tempLogDir = IOUtility.createTempDirectory("log");
- LogRecorderHandler handler = new LogRecorderHandler(tempLogDir.getAbsolutePath(), 1024 * 1024, 1024, false);
- handler.setLevel(Level.FINEST);
- handler.setFormatter(new JavaLogFormatter());
- handler.setEncoding("UTF-8");
- return handler;
- }
- catch (Exception e) {
- throw new ProcessingException("could not create handler to record log messages", e);
- }
- }
-
- /**
- * To listen for Eclipse log events and send them to JUL
- */
- private final class P_EclipseToJavaDelegateListener implements ILogListener {
-
- @Override
- public void logging(IStatus status, String plugin) {
- int scoutLogLevel = EclipseLogUtility.eclipseToScoutLevel(status.getSeverity());
- Level javaLogLevel = JavaLogUtility.scoutToJavaLevel(scoutLogLevel);
-
- String codeText = status.getCode() != 0 ? "[code " + status.getCode() + "] " : "";
- LogRecord record = new LogRecord(javaLogLevel, codeText + status.getMessage());
- record.setLoggerName(plugin);
- if (status.getPlugin() != null && status.getPlugin().length() > 0) {
- record.setSourceClassName(status.getPlugin());
- }
- else {
- record.setSourceClassName(plugin);
- }
- record.setSourceMethodName(null);
- record.setThrown(status.getException());
- Logger.getLogger(record.getLoggerName()).log(record);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.logger.internal.java;
+
+import java.io.File;
+import java.util.Enumeration;
+import java.util.logging.Handler;
+import java.util.logging.Level;
+import java.util.logging.LogManager;
+import java.util.logging.LogRecord;
+import java.util.logging.Logger;
+import java.util.logging.SimpleFormatter;
+
+import org.eclipse.core.runtime.ILogListener;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.scout.commons.IOUtility;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.EclipseLogUtility;
+import org.eclipse.scout.commons.logger.IScoutLogManager;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.JavaLogUtility;
+
+/**
+ * The default Scout log manager when using java.util.logging (JUL).
+ * <p>
+ * When being initialized, the manager installs a listener to the {@link Platform} in order to also delegate Eclipse log
+ * event to JUL.
+ * </p>
+ * <p>
+ * A global log level is set by setting the levels of all child loggers to null to inherit the configuration of the root
+ * logger. In turn, the level of the root logger is set to the global log level. Furthermore, the level of all attached
+ * log handlers is set to the given global log level.
+ * </p>
+ * <p>
+ * Recording of log messages is implemented the way of installing a log handler to JUL. Thereby, all log messages are
+ * written into a temporary ZIP file that is returned when recording is stopped.
+ * </p>
+ */
+public class JavaScoutLogManager implements IScoutLogManager {
+
+ private Object m_recordingLock;
+ private LogRecorderHandler m_logRecorderHandler;
+ private ILogListener m_eclipseLogListener;
+ private boolean m_globalLogLevelSet;
+
+ public JavaScoutLogManager() {
+ m_recordingLock = new Object();
+ m_eclipseLogListener = new P_EclipseToJavaDelegateListener();
+ }
+
+ /**
+ * Redirect eclipse log to java log
+ * <p>
+ * Make two enhancements
+ * <ol>
+ * <li>set default log level for root to WARNING if there is no custom config. INFO is insane as a default-default</li>
+ * <li>install "better" simple log formatter when SimpleFormatter is used</li>
+ * </ol>
+ */
+ @Override
+ public void initialize() {
+ if (Platform.isRunning()) {
+ Platform.addLogListener(m_eclipseLogListener);
+ }
+
+ Logger root = Logger.getLogger("");
+ if (root.getLevel() == Level.INFO) {
+ if (System.getProperty("java.util.logging.config.class") == null && System.getProperty("java.util.logging.config.file") == null) {
+ root.setLevel(Level.WARNING);
+ }
+ }
+
+ for (Handler h : root.getHandlers()) {
+ if (h.getFormatter() instanceof SimpleFormatter) {
+ h.setFormatter(new JavaLogFormatter());
+ }
+ }
+ }
+
+ @Override
+ public IScoutLogger getLogger(String name) {
+ return new JavaLogWrapper(name);
+ }
+
+ @Override
+ public IScoutLogger getLogger(Class clazz) {
+ return getLogger(clazz.getName());
+ }
+
+ @Override
+ public void setGlobalLogLevel(Integer globalLogLevel) {
+ if (globalLogLevel == null) {
+ // reset logger configuration
+ m_globalLogLevelSet = false;
+ try {
+ LogManager.getLogManager().getLogger("").setLevel(null);
+ LogManager.getLogManager().readConfiguration();
+ }
+ catch (Exception e) {
+ getLogger(JavaScoutLogManager.class).error("could not restore logging configuration", e);
+ }
+ }
+ else {
+ //set global log level to all loggers and handlers
+ m_globalLogLevelSet = true;
+
+ Level javaLogLevel = JavaLogUtility.scoutToJavaLevel(globalLogLevel);
+
+ // first, reset the level of loggers as only level of root logger is set afterwards
+ Enumeration<String> loggerNames = LogManager.getLogManager().getLoggerNames();
+ while (loggerNames.hasMoreElements()) {
+ Logger logger = LogManager.getLogManager().getLogger(loggerNames.nextElement());
+ if (logger == null) {
+ continue; // failsafe in case a logger has been removed in the meantime
+ }
+ if (logger.getLevel() != null && logger.getLevel() != javaLogLevel) {
+ logger.setLevel(null);
+ }
+
+ // update level of attached handlers to the given level
+ for (Handler handler : logger.getHandlers()) {
+ handler.setLevel(javaLogLevel);
+ }
+ }
+
+ // instruct root logger to log all messages of the given level
+ LogManager.getLogManager().getLogger("").setLevel(javaLogLevel);
+ }
+ }
+
+ @Override
+ public Integer getGlobalLogLevel() {
+ if (m_globalLogLevelSet) {
+ Level level = LogManager.getLogManager().getLogger("").getLevel();
+ return JavaLogUtility.javaToScoutLevel(level);
+ }
+ return null;
+ }
+
+ @Override
+ public boolean startRecording() throws ProcessingException {
+ synchronized (m_recordingLock) {
+ if (m_logRecorderHandler == null) {
+ m_logRecorderHandler = createLogRecordingHandler();
+
+ Logger root = Logger.getLogger("");
+ root.addHandler(m_logRecorderHandler);
+ return true;
+ }
+ return false;
+ }
+ }
+
+ @Override
+ public File stopRecording() {
+ synchronized (m_recordingLock) {
+ if (m_logRecorderHandler == null) {
+ return null;
+ }
+ File logFile = m_logRecorderHandler.getLogFile();
+ m_logRecorderHandler = null;
+
+ // remove installed handler
+ Logger root = Logger.getLogger("");
+ root.removeHandler(m_logRecorderHandler);
+
+ return logFile;
+ }
+ }
+
+ /**
+ * To create a handler to record the log messages
+ *
+ * @return
+ * @throws ProcessingException
+ */
+ protected LogRecorderHandler createLogRecordingHandler() throws ProcessingException {
+ try {
+ File tempLogDir = IOUtility.createTempDirectory("log");
+ LogRecorderHandler handler = new LogRecorderHandler(tempLogDir.getAbsolutePath(), 1024 * 1024, 1024, false);
+ handler.setLevel(Level.FINEST);
+ handler.setFormatter(new JavaLogFormatter());
+ handler.setEncoding("UTF-8");
+ return handler;
+ }
+ catch (Exception e) {
+ throw new ProcessingException("could not create handler to record log messages", e);
+ }
+ }
+
+ /**
+ * To listen for Eclipse log events and send them to JUL
+ */
+ private final class P_EclipseToJavaDelegateListener implements ILogListener {
+
+ @Override
+ public void logging(IStatus status, String plugin) {
+ int scoutLogLevel = EclipseLogUtility.eclipseToScoutLevel(status.getSeverity());
+ Level javaLogLevel = JavaLogUtility.scoutToJavaLevel(scoutLogLevel);
+
+ String codeText = status.getCode() != 0 ? "[code " + status.getCode() + "] " : "";
+ LogRecord record = new LogRecord(javaLogLevel, codeText + status.getMessage());
+ record.setLoggerName(plugin);
+ if (status.getPlugin() != null && status.getPlugin().length() > 0) {
+ record.setSourceClassName(status.getPlugin());
+ }
+ else {
+ record.setSourceClassName(plugin);
+ }
+ record.setSourceMethodName(null);
+ record.setThrown(status.getException());
+ Logger.getLogger(record.getLoggerName()).log(record);
+ }
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/internal/java/LogRecorderHandler.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/internal/java/LogRecorderHandler.java
index b320a6fad1..5ee15538ba 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/internal/java/LogRecorderHandler.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/logger/internal/java/LogRecorderHandler.java
@@ -1,48 +1,48 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.logger.internal.java;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.logging.FileHandler;
-
-import org.eclipse.scout.commons.FileUtility;
-import org.eclipse.scout.commons.IOUtility;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-
-public class LogRecorderHandler extends FileHandler {
-
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(LogRecorderHandler.class);
-
- private String m_logDirectory;
-
- public LogRecorderHandler(String logDirectory, int limit, int count, boolean append) throws SecurityException, IOException {
- super(logDirectory + "/log_%u%g.log", limit, count, append);
- m_logDirectory = logDirectory;
- }
-
- public File getLogFile() {
- try {
- File zipFile = IOUtility.createTempFile("logging.zip", null);
- FileUtility.compressArchive(IOUtility.toFile(m_logDirectory), zipFile);
- return zipFile;
- }
- catch (Exception e) {
- LOG.error("could not pack log files into ZIP archive", e);
- }
- return null;
- }
-
- public String getLogDirectory() {
- return m_logDirectory;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.logger.internal.java;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.logging.FileHandler;
+
+import org.eclipse.scout.commons.FileUtility;
+import org.eclipse.scout.commons.IOUtility;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+
+public class LogRecorderHandler extends FileHandler {
+
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(LogRecorderHandler.class);
+
+ private String m_logDirectory;
+
+ public LogRecorderHandler(String logDirectory, int limit, int count, boolean append) throws SecurityException, IOException {
+ super(logDirectory + "/log_%u%g.log", limit, count, append);
+ m_logDirectory = logDirectory;
+ }
+
+ public File getLogFile() {
+ try {
+ File zipFile = IOUtility.createTempFile("logging.zip", null);
+ FileUtility.compressArchive(IOUtility.toFile(m_logDirectory), zipFile);
+ return zipFile;
+ }
+ catch (Exception e) {
+ LOG.error("could not pack log files into ZIP archive", e);
+ }
+ return null;
+ }
+
+ public String getLogDirectory() {
+ return m_logDirectory;
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/nls/DynamicNls.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/nls/DynamicNls.java
index 7dd93c61e7..e5ad191b7c 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/nls/DynamicNls.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/nls/DynamicNls.java
@@ -1,131 +1,131 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.nls;
-
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-/**
- * Warning: Avoid osgi imports in this class, so it can be used in J2EE
- */
-public class DynamicNls {
-
- private ArrayList<NlsResourceBundleCache> m_resourceBundles;
-
- public DynamicNls() {
- m_resourceBundles = new ArrayList<NlsResourceBundleCache>();
- }
-
- public void registerResourceBundle(String resourceBundleName, Class<?> wrapperClass) {
- m_resourceBundles.add(0, new NlsResourceBundleCache(resourceBundleName, wrapperClass));
- //NlsUtility.dynamicBindFields(wrapperClass);
- }
-
- /**
- * @param key
- * nls text key
- * @param messageArguments
- * the translation of the text might contain variables
- * {0},{1},{2},... Examples: getText("MissingFile1"); with
- * translation: MissingFile1=Das File konnte nicht gefunden werden
- * getText("MissingFile2",fileName); with translation:
- * MissingFile2=Das File {0} konnte nicht gefunden werden.
- * getText("MissingFile3",fileName,dir); with translation:
- * MissingFile3=Das File {0} im Ordner {1} konnte nicht gefunden
- * werden
- */
- public final String getText(String key, String... messageArguments) {
- return getText(null, key, messageArguments);
- }
-
- /**
- * @param locale
- * the locale of the text
- * @param key
- * nls text key
- * @param messageArguments
- * the translation of the text might contain variables
- * {0},{1},{2},... Examples: getText("MissingFile1"); with
- * translation: MissingFile1=Das File konnte nicht gefunden werden
- * getText("MissingFile2",fileName); with translation:
- * MissingFile2=Das File {0} konnte nicht gefunden werden.
- * getText("MissingFile3",fileName,dir); with translation:
- * MissingFile3=Das File {0} im Ordner {1} konnte nicht gefunden
- * werden
- */
- public final String getText(Locale locale, String key, String... messageArguments) {
- if (key == null) {
- return null;
- }
-
- String text = getTextInternal(locale, key);
- return NlsUtility.bindText(text, messageArguments);
- }
-
- private String getTextInternal(Locale locale, String key) {
- if (locale == null) {
- locale = getDefaultLocale();
- }
- for (NlsResourceBundleCache c : m_resourceBundles) {
- try {
- ResourceBundle resourceBundle = c.getResourceBundle(locale);
- if (resourceBundle != null) {
- return resourceBundle.getString(key);
- }
- }
- catch (MissingResourceException e) {
- //nop
- }
- }
- return null;
- }
-
- /**
- * get all key/texts defined or redefined by the wrapper class for that locale
- */
- public Map<String, String> getTextMap(Locale locale) {
- HashMap<String, String> map = new HashMap<String, String>();
- if (locale == null) {
- locale = getDefaultLocale();
- }
- for (NlsResourceBundleCache c : m_resourceBundles) {
- try {
- ResourceBundle r = c.getResourceBundle(locale);
- if (r == null) {
- continue;
- }
- for (Enumeration<String> en = r.getKeys(); en.hasMoreElements();) {
- String key = en.nextElement();
- String text = r.getString(key);
- if (!map.containsKey(key)) {
- map.put(key, text);
- }
- }
- }
- catch (MissingResourceException e) {
- //nop
- }
- }
- return map;
- }
-
- /**
- * Override this method to change default locale behaviour
- */
- protected Locale getDefaultLocale() {
- return NlsUtility.getDefaultLocale();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.nls;
+
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * Warning: Avoid osgi imports in this class, so it can be used in J2EE
+ */
+public class DynamicNls {
+
+ private ArrayList<NlsResourceBundleCache> m_resourceBundles;
+
+ public DynamicNls() {
+ m_resourceBundles = new ArrayList<NlsResourceBundleCache>();
+ }
+
+ public void registerResourceBundle(String resourceBundleName, Class<?> wrapperClass) {
+ m_resourceBundles.add(0, new NlsResourceBundleCache(resourceBundleName, wrapperClass));
+ //NlsUtility.dynamicBindFields(wrapperClass);
+ }
+
+ /**
+ * @param key
+ * nls text key
+ * @param messageArguments
+ * the translation of the text might contain variables
+ * {0},{1},{2},... Examples: getText("MissingFile1"); with
+ * translation: MissingFile1=Das File konnte nicht gefunden werden
+ * getText("MissingFile2",fileName); with translation:
+ * MissingFile2=Das File {0} konnte nicht gefunden werden.
+ * getText("MissingFile3",fileName,dir); with translation:
+ * MissingFile3=Das File {0} im Ordner {1} konnte nicht gefunden
+ * werden
+ */
+ public final String getText(String key, String... messageArguments) {
+ return getText(null, key, messageArguments);
+ }
+
+ /**
+ * @param locale
+ * the locale of the text
+ * @param key
+ * nls text key
+ * @param messageArguments
+ * the translation of the text might contain variables
+ * {0},{1},{2},... Examples: getText("MissingFile1"); with
+ * translation: MissingFile1=Das File konnte nicht gefunden werden
+ * getText("MissingFile2",fileName); with translation:
+ * MissingFile2=Das File {0} konnte nicht gefunden werden.
+ * getText("MissingFile3",fileName,dir); with translation:
+ * MissingFile3=Das File {0} im Ordner {1} konnte nicht gefunden
+ * werden
+ */
+ public final String getText(Locale locale, String key, String... messageArguments) {
+ if (key == null) {
+ return null;
+ }
+
+ String text = getTextInternal(locale, key);
+ return NlsUtility.bindText(text, messageArguments);
+ }
+
+ private String getTextInternal(Locale locale, String key) {
+ if (locale == null) {
+ locale = getDefaultLocale();
+ }
+ for (NlsResourceBundleCache c : m_resourceBundles) {
+ try {
+ ResourceBundle resourceBundle = c.getResourceBundle(locale);
+ if (resourceBundle != null) {
+ return resourceBundle.getString(key);
+ }
+ }
+ catch (MissingResourceException e) {
+ //nop
+ }
+ }
+ return null;
+ }
+
+ /**
+ * get all key/texts defined or redefined by the wrapper class for that locale
+ */
+ public Map<String, String> getTextMap(Locale locale) {
+ HashMap<String, String> map = new HashMap<String, String>();
+ if (locale == null) {
+ locale = getDefaultLocale();
+ }
+ for (NlsResourceBundleCache c : m_resourceBundles) {
+ try {
+ ResourceBundle r = c.getResourceBundle(locale);
+ if (r == null) {
+ continue;
+ }
+ for (Enumeration<String> en = r.getKeys(); en.hasMoreElements();) {
+ String key = en.nextElement();
+ String text = r.getString(key);
+ if (!map.containsKey(key)) {
+ map.put(key, text);
+ }
+ }
+ }
+ catch (MissingResourceException e) {
+ //nop
+ }
+ }
+ return map;
+ }
+
+ /**
+ * Override this method to change default locale behaviour
+ */
+ protected Locale getDefaultLocale() {
+ return NlsUtility.getDefaultLocale();
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/nls/NlsLocale.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/nls/NlsLocale.java
index 64b0ea44ff..1dd07d4bf7 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/nls/NlsLocale.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/nls/NlsLocale.java
@@ -1,94 +1,94 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.nls;
-
-import java.text.spi.DateFormatProvider;
-import java.text.spi.NumberFormatProvider;
-import java.util.Locale;
-
-import org.eclipse.scout.commons.LocaleThreadLocal;
-
-/**
- * @deprecated Will be removed in release 3.9.0 and is to be replaced by {@link Locale} or {@link LocaleThreadLocal}.
- * On client side, it is typically replaced by {@link Locale#getDefault()} or
- * {@link Locale#setDefault(Locale)}, on server side by {@link LocaleThreadLocal#get()} or
- * {@link LocaleThreadLocal#set(Locale)}, respectively. This is because on server side, the default
- * {@link Locale} must be bound to the current thread.
- * <p>
- * To support a custom locale (e.g. en_CH), do the following:
- * <ol>
- * <li>Create a plain Java project</li>
- * <li>Create two classes that inherit from {@link DateFormatProvider} and {@link NumberFormatProvider} and
- * implement the method stubs specific to your locale</li>
- * <li>Create the folder META-INF/services with two files java.text.spi.DateFormatProvider and
- * java.text.spi.NumberFormatProvider</li>
- * <li>In those files, simply put the the fully qualified name to your date/number providers</li>
- * <li>Export project as JAR file and put it into \lib\ext of your JRE</li>
- * </ol>
- * </p>
- */
-@Deprecated
-public final class NlsLocale {
-
- public Locale getLocale() {
- return NlsUtility.getDefaultLocale();
- }
-
- @Override
- public int hashCode() {
- return getLocale().hashCode();
- }
-
- @Override
- public boolean equals(Object o) {
- return (o instanceof NlsLocale && ((NlsLocale) o).getLocale().equals(this.getLocale()));
- }
-
- @Override
- public String toString() {
- return getLocale().toString();
- }
-
- /**
- * @return
- * @deprecated Will be removed in release 3.9.0, use {@link Locale#getDefault()} or {@link LocaleThreadLocal#get()}
- * instead.<br/>
- * Please note that {@link Locale#getDefault()} returns the locale for this instance of the Java Virtual
- * Machine.
- * Typically, this is only meaningful on client side. On server side, use {@link LocaleThreadLocal#get()}
- * instead.
- */
- @Deprecated
- public static NlsLocale getDefault() {
- return new NlsLocale();
- }
-
- /**
- * @param l
- * @deprecated Will be removed in release 3.9.0, use {@link Locale#setDefault(Locale)} instead.<br/>
- * Please note that this changes the default locale for this instance of the Java Virtual Machine.
- * Typically, this is only meaningful on client side. On server side, use
- * {@link LocaleThreadLocal#set(Locale)} instead.
- */
- @Deprecated
- public static void setDefault(NlsLocale l) {
- Locale.setDefault(l.getLocale());
- }
-
- /**
- * @param l
- * @deprecated Will be removed in release 3.9.0, use {@link LocaleThreadLocal#set(Locale)} instead.<br/>
- */
- @Deprecated
- public static void setThreadDefault(NlsLocale l) {
- LocaleThreadLocal.set(l.getLocale());
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.nls;
+
+import java.text.spi.DateFormatProvider;
+import java.text.spi.NumberFormatProvider;
+import java.util.Locale;
+
+import org.eclipse.scout.commons.LocaleThreadLocal;
+
+/**
+ * @deprecated Will be removed in release 3.9.0 and is to be replaced by {@link Locale} or {@link LocaleThreadLocal}.
+ * On client side, it is typically replaced by {@link Locale#getDefault()} or
+ * {@link Locale#setDefault(Locale)}, on server side by {@link LocaleThreadLocal#get()} or
+ * {@link LocaleThreadLocal#set(Locale)}, respectively. This is because on server side, the default
+ * {@link Locale} must be bound to the current thread.
+ * <p>
+ * To support a custom locale (e.g. en_CH), do the following:
+ * <ol>
+ * <li>Create a plain Java project</li>
+ * <li>Create two classes that inherit from {@link DateFormatProvider} and {@link NumberFormatProvider} and
+ * implement the method stubs specific to your locale</li>
+ * <li>Create the folder META-INF/services with two files java.text.spi.DateFormatProvider and
+ * java.text.spi.NumberFormatProvider</li>
+ * <li>In those files, simply put the the fully qualified name to your date/number providers</li>
+ * <li>Export project as JAR file and put it into \lib\ext of your JRE</li>
+ * </ol>
+ * </p>
+ */
+@Deprecated
+public final class NlsLocale {
+
+ public Locale getLocale() {
+ return NlsUtility.getDefaultLocale();
+ }
+
+ @Override
+ public int hashCode() {
+ return getLocale().hashCode();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return (o instanceof NlsLocale && ((NlsLocale) o).getLocale().equals(this.getLocale()));
+ }
+
+ @Override
+ public String toString() {
+ return getLocale().toString();
+ }
+
+ /**
+ * @return
+ * @deprecated Will be removed in release 3.9.0, use {@link Locale#getDefault()} or {@link LocaleThreadLocal#get()}
+ * instead.<br/>
+ * Please note that {@link Locale#getDefault()} returns the locale for this instance of the Java Virtual
+ * Machine.
+ * Typically, this is only meaningful on client side. On server side, use {@link LocaleThreadLocal#get()}
+ * instead.
+ */
+ @Deprecated
+ public static NlsLocale getDefault() {
+ return new NlsLocale();
+ }
+
+ /**
+ * @param l
+ * @deprecated Will be removed in release 3.9.0, use {@link Locale#setDefault(Locale)} instead.<br/>
+ * Please note that this changes the default locale for this instance of the Java Virtual Machine.
+ * Typically, this is only meaningful on client side. On server side, use
+ * {@link LocaleThreadLocal#set(Locale)} instead.
+ */
+ @Deprecated
+ public static void setDefault(NlsLocale l) {
+ Locale.setDefault(l.getLocale());
+ }
+
+ /**
+ * @param l
+ * @deprecated Will be removed in release 3.9.0, use {@link LocaleThreadLocal#set(Locale)} instead.<br/>
+ */
+ @Deprecated
+ public static void setThreadDefault(NlsLocale l) {
+ LocaleThreadLocal.set(l.getLocale());
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/nls/NlsResourceBundle.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/nls/NlsResourceBundle.java
index 472b78b27b..8bf8604d12 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/nls/NlsResourceBundle.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/nls/NlsResourceBundle.java
@@ -1,159 +1,159 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.nls;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Locale;
-import java.util.PropertyResourceBundle;
-import java.util.ResourceBundle;
-
-import org.eclipse.scout.commons.internal.Activator;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-
-/**
- * <h4>NlsResourceBundle</h4> Other than {@link ResourceBundle} this bundle
- * loads bundles by their intuitiv names. Example: There are bundles
- * Texts.properties (default english), Texts_de.properties and
- * Texts_fr.properties {@link ResourceBundle#getBundle("Texts",de_CH)} will
- * yield Texts_de.properties! This cache will yield Texts.properties (which
- * basically is the correct solution)
- *
- * @author imo
- */
-public final class NlsResourceBundle extends PropertyResourceBundle {
-
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(NlsResourceBundle.class);
-
- public NlsResourceBundle(InputStream stream) throws IOException {
- super(stream);
- }
-
- public static NlsResourceBundle getBundle(String baseName, Locale locale, ClassLoader cl) {
- return getBundle(baseName, locale, cl, (Class) null);
- }
-
- public static NlsResourceBundle getBundle(String baseName, Locale locale, ClassLoader cl, Class wrapperClass) {
- String ls = locale.toString();
- ArrayList<String> suffixes = new ArrayList<String>();
- suffixes.add("_" + ls);
- int i = ls.lastIndexOf('_');
- while (i >= 0) {
- ls = ls.substring(0, i);
- suffixes.add("_" + ls);
- // next
- i = ls.lastIndexOf('_');
- }
- suffixes.add("");
- //
- NlsResourceBundle root = null;
- NlsResourceBundle child = null;
- for (String suffix : suffixes) {
- String fileName = baseName.replace('.', '/') + suffix + ".properties";
- URL res = cl.getResource(fileName);
- if (res == null) {
- // Resource not found by class loader. Perhaps this instance is used outside a running
- // Equinox instance (e.g. from an ordinary JUnit test started from the Eclipse IDE).
- // Try to load the resource bundle from the expanded development workspace project structure.
- res = getResourceFromDevelopmentWorkspaceProject(wrapperClass, fileName);
- }
- if (res != null) {
- InputStream in = null;
- try {
- in = res.openStream();
- NlsResourceBundle parent = new NlsResourceBundle(in);
- if (root == null) {
- root = parent;
- }
- if (child != null) {
- child.setParent(parent);
- }
- child = parent;
- }
- catch (IOException e) {
- LOG.warn(null, e);
- }
- finally {
- if (in != null) {
- try {
- in.close();
- }
- catch (Throwable t) {
- }
- }
- }
- }
- }
- return root;
- }
-
- /**
- * Resolves the requested file in the given class's project location if the current java process is not running in an
- * eclipse instance (e.g. if an ordinary JUnit test is executed). The requested file is expected to be located
- * directly in the project folder and the compiled classes are expected to be located in a sub-folder in the project
- * directory as well.
- * <p/>
- * <h3>Example</h3> The following project structure is expected for
- * <code>getResourceFromDevelopmentWorkspaceProject(org.eclipse.foo.Texts.class, "resources/texts/Texts.properties");</code>
- *
- * <pre>
- * o project folder
- * |
- * +---o bin
- * | |
- * | +---o org.eclipse.foo.Texts.class
- * | +---o &lt;other compiled java classes&gt;
- * |
- * +---o resources
- * |
- * +---o texts
- * |
- * +---o Texts.properties
- * +---o Texts_de.properties
- * +---o Texts_en.properties
- * </pre>
- *
- * @param clazz
- * arbitrary class for determining the requested resource's project location on disk.
- * @param fileName
- * file name of the requested resource relative to the wrapper class's project folder.
- * @return Returns <code>null</code> if invoked within a running eclipse environment or if the requested resource can
- * not be found. Otherwise a file URL is returned.
- */
- private static URL getResourceFromDevelopmentWorkspaceProject(Class clazz, String fileName) {
- if (Activator.getDefault() != null) {
- // eclipse is running
- return null;
- }
- URL res = null;
- try {
- URL location = clazz.getProtectionDomain().getCodeSource().getLocation();
- if ("file".equals(location.getProtocol())) {
- File projectLocation = new File(location.toURI());
- if (projectLocation.exists() && projectLocation.isDirectory()) {
- File f = new File(projectLocation, fileName);
- if (f.exists() && f.isFile()) {
- res = f.toURI().toURL();
- }
- }
- }
- }
- catch (Exception e) {
- LOG.debug("Error while resolving resource bundle in development mode outside a running eclipse", e);
- }
- return res;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.nls;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Locale;
+import java.util.PropertyResourceBundle;
+import java.util.ResourceBundle;
+
+import org.eclipse.scout.commons.internal.Activator;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+
+/**
+ * <h4>NlsResourceBundle</h4> Other than {@link ResourceBundle} this bundle
+ * loads bundles by their intuitiv names. Example: There are bundles
+ * Texts.properties (default english), Texts_de.properties and
+ * Texts_fr.properties {@link ResourceBundle#getBundle("Texts",de_CH)} will
+ * yield Texts_de.properties! This cache will yield Texts.properties (which
+ * basically is the correct solution)
+ *
+ * @author imo
+ */
+public final class NlsResourceBundle extends PropertyResourceBundle {
+
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(NlsResourceBundle.class);
+
+ public NlsResourceBundle(InputStream stream) throws IOException {
+ super(stream);
+ }
+
+ public static NlsResourceBundle getBundle(String baseName, Locale locale, ClassLoader cl) {
+ return getBundle(baseName, locale, cl, (Class) null);
+ }
+
+ public static NlsResourceBundle getBundle(String baseName, Locale locale, ClassLoader cl, Class wrapperClass) {
+ String ls = locale.toString();
+ ArrayList<String> suffixes = new ArrayList<String>();
+ suffixes.add("_" + ls);
+ int i = ls.lastIndexOf('_');
+ while (i >= 0) {
+ ls = ls.substring(0, i);
+ suffixes.add("_" + ls);
+ // next
+ i = ls.lastIndexOf('_');
+ }
+ suffixes.add("");
+ //
+ NlsResourceBundle root = null;
+ NlsResourceBundle child = null;
+ for (String suffix : suffixes) {
+ String fileName = baseName.replace('.', '/') + suffix + ".properties";
+ URL res = cl.getResource(fileName);
+ if (res == null) {
+ // Resource not found by class loader. Perhaps this instance is used outside a running
+ // Equinox instance (e.g. from an ordinary JUnit test started from the Eclipse IDE).
+ // Try to load the resource bundle from the expanded development workspace project structure.
+ res = getResourceFromDevelopmentWorkspaceProject(wrapperClass, fileName);
+ }
+ if (res != null) {
+ InputStream in = null;
+ try {
+ in = res.openStream();
+ NlsResourceBundle parent = new NlsResourceBundle(in);
+ if (root == null) {
+ root = parent;
+ }
+ if (child != null) {
+ child.setParent(parent);
+ }
+ child = parent;
+ }
+ catch (IOException e) {
+ LOG.warn(null, e);
+ }
+ finally {
+ if (in != null) {
+ try {
+ in.close();
+ }
+ catch (Throwable t) {
+ }
+ }
+ }
+ }
+ }
+ return root;
+ }
+
+ /**
+ * Resolves the requested file in the given class's project location if the current java process is not running in an
+ * eclipse instance (e.g. if an ordinary JUnit test is executed). The requested file is expected to be located
+ * directly in the project folder and the compiled classes are expected to be located in a sub-folder in the project
+ * directory as well.
+ * <p/>
+ * <h3>Example</h3> The following project structure is expected for
+ * <code>getResourceFromDevelopmentWorkspaceProject(org.eclipse.foo.Texts.class, "resources/texts/Texts.properties");</code>
+ *
+ * <pre>
+ * o project folder
+ * |
+ * +---o bin
+ * | |
+ * | +---o org.eclipse.foo.Texts.class
+ * | +---o &lt;other compiled java classes&gt;
+ * |
+ * +---o resources
+ * |
+ * +---o texts
+ * |
+ * +---o Texts.properties
+ * +---o Texts_de.properties
+ * +---o Texts_en.properties
+ * </pre>
+ *
+ * @param clazz
+ * arbitrary class for determining the requested resource's project location on disk.
+ * @param fileName
+ * file name of the requested resource relative to the wrapper class's project folder.
+ * @return Returns <code>null</code> if invoked within a running eclipse environment or if the requested resource can
+ * not be found. Otherwise a file URL is returned.
+ */
+ private static URL getResourceFromDevelopmentWorkspaceProject(Class clazz, String fileName) {
+ if (Activator.getDefault() != null) {
+ // eclipse is running
+ return null;
+ }
+ URL res = null;
+ try {
+ URL location = clazz.getProtectionDomain().getCodeSource().getLocation();
+ if ("file".equals(location.getProtocol())) {
+ File projectLocation = new File(location.toURI());
+ if (projectLocation.exists() && projectLocation.isDirectory()) {
+ File f = new File(projectLocation, fileName);
+ if (f.exists() && f.isFile()) {
+ res = f.toURI().toURL();
+ }
+ }
+ }
+ }
+ catch (Exception e) {
+ LOG.debug("Error while resolving resource bundle in development mode outside a running eclipse", e);
+ }
+ return res;
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/nls/NlsResourceBundleCache.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/nls/NlsResourceBundleCache.java
index 7c0f3a5cae..0b442332f9 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/nls/NlsResourceBundleCache.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/nls/NlsResourceBundleCache.java
@@ -1,56 +1,56 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.nls;
-
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.ResourceBundle;
-
-/**
- * <h4>ResourceBundleCache</h4> Is used to cache resource bundle instances per {@link java.util.Locale}
- *
- * @author imo
- */
-public class NlsResourceBundleCache {
- private String m_resourceBundleName;
- private Class m_wrapperClass;
- private HashMap<Locale, ResourceBundle> m_resourceBundles;
- private Object m_resourceBundlesLock;
-
- public NlsResourceBundleCache(String resourceBundleName, Class wrapperClass) {
- m_resourceBundleName = resourceBundleName;
- m_wrapperClass = wrapperClass;
- m_resourceBundlesLock = new Object();
- m_resourceBundles = new HashMap<Locale, ResourceBundle>();
- }
-
- public ResourceBundle getResourceBundle(Locale locale) {
- if (locale == null) {
- throw new IllegalArgumentException("locale must not be null");
- }
- synchronized (m_resourceBundlesLock) {
- // double check with lock
- ResourceBundle r = m_resourceBundles.get(locale);
- if (r == null) {
- r = NlsResourceBundle.getBundle(m_resourceBundleName, locale, m_wrapperClass.getClassLoader(), m_wrapperClass);
- if (r != null) {
- m_resourceBundles.put(locale, r);
- }
- }
- return r;
- }
- }
-
- public Class getWrapperClass() {
- return m_wrapperClass;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.nls;
+
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+/**
+ * <h4>ResourceBundleCache</h4> Is used to cache resource bundle instances per {@link java.util.Locale}
+ *
+ * @author imo
+ */
+public class NlsResourceBundleCache {
+ private String m_resourceBundleName;
+ private Class m_wrapperClass;
+ private HashMap<Locale, ResourceBundle> m_resourceBundles;
+ private Object m_resourceBundlesLock;
+
+ public NlsResourceBundleCache(String resourceBundleName, Class wrapperClass) {
+ m_resourceBundleName = resourceBundleName;
+ m_wrapperClass = wrapperClass;
+ m_resourceBundlesLock = new Object();
+ m_resourceBundles = new HashMap<Locale, ResourceBundle>();
+ }
+
+ public ResourceBundle getResourceBundle(Locale locale) {
+ if (locale == null) {
+ throw new IllegalArgumentException("locale must not be null");
+ }
+ synchronized (m_resourceBundlesLock) {
+ // double check with lock
+ ResourceBundle r = m_resourceBundles.get(locale);
+ if (r == null) {
+ r = NlsResourceBundle.getBundle(m_resourceBundleName, locale, m_wrapperClass.getClassLoader(), m_wrapperClass);
+ if (r != null) {
+ m_resourceBundles.put(locale, r);
+ }
+ }
+ return r;
+ }
+ }
+
+ public Class getWrapperClass() {
+ return m_wrapperClass;
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/nls/NlsUtility.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/nls/NlsUtility.java
index 53e17bba12..7dc1032967 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/nls/NlsUtility.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/nls/NlsUtility.java
@@ -1,173 +1,173 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.nls;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.Locale;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.scout.commons.LocaleThreadLocal;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-
-/**
- * Warning: Avoid osgi imports in this class, so it can be used in J2EE
- */
-public final class NlsUtility {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(NlsUtility.class);
-
- private NlsUtility() {
- }
-
- private static final int MOD_EXPECTED = Modifier.PUBLIC | Modifier.STATIC;
-
- private static final int MOD_MASK = MOD_EXPECTED | Modifier.FINAL;
-
- public static void dynamicBindFields(Class<?> clazz) {
- final Field[] fieldArray = clazz.getDeclaredFields();
-
- boolean isAccessible = (clazz.getModifiers() & Modifier.PUBLIC) != 0;
-
- // build a map of field names to Field objects
- // final int len = fieldArray.length;
-
- for (Field field : fieldArray) {
- // can only set value of public static non-final fields
- if ((field.getModifiers() & MOD_MASK) != MOD_EXPECTED) {
- continue;
- }
- try {
- // Check to see if we are allowed to modify the field. If we
- // aren't (for instance
- // if the class is not public) then change the accessible
- // attribute of the field
- // before trying to set the value.
- if (!isAccessible) {
- makeAccessible(field);
- }
- // Set the value into the field. We should never get an
- // exception here because
- // we know we have a public static non-final field. If we do get
- // an exception, silently
- // log it and continue. This means that the field will (most
- // likely) be un-initialized and
- // will fail later in the code and if so then we will see both
- // the NPE and this error.
- field.set(null, field.getName());
- }
- catch (Exception e) {
- LOG.warn(null, e);
- }
- }
- }
-
- /*
- * Change the accessibility of the specified field so we can set its value to
- * be the appropriate message string.
- */
- static void makeAccessible(final Field field) {
- if (System.getSecurityManager() == null) {
- field.setAccessible(true);
- }
- else {
- AccessController.doPrivileged(new PrivilegedAction<Object>() {
- @Override
- public Object run() {
- field.setAccessible(true);
- return null;
- }
- });
- }
- }
-
- private static Pattern messageArgumentPattern = Pattern.compile("\\{([0-9]+)\\}");
-
- /**
- * @param key
- * nls text key
- * @param messageArguments
- * the translation of the text might contain variables
- * {0},{1},{2},... Examples: getText("MissingFile1"); with
- * translation: MissingFile1=Das File konnte nicht gefunden werden
- * getText("MissingFile2",fileName); with translation:
- * MissingFile2=Das File {0} konnte nicht gefunden werden.
- * getText("MissingFile3",fileName,dir); with translation:
- * MissingFile3=Das File {0} im Ordner {1} konnte nicht gefunden
- * werden
- */
- public static String bindText(String text, String... messageArguments) {
- if (text != null) {
- // check potential for message arguments
- if (messageArguments != null && messageArguments.length > 0) {
- Matcher m = messageArgumentPattern.matcher(text);
- StringBuilder b = new StringBuilder();
- int start = 0;
- while (m.find(start)) {
- b.append(text.substring(start, m.start()));
- int index = Integer.parseInt(m.group(1));
- if (messageArguments != null && index < messageArguments.length) {
- if (messageArguments[index] != null) {
- b.append(messageArguments[index]);
- }
- }
- else {
- b.append("{" + index + "}");
- }
- // next
- start = m.end();
- }
- b.append(text.substring(start));
- return b.toString();
- }
- else {
- return text;
- }
- }
- return text;
- }
-
- public static Locale parseLocale(String pattern) {
- if (pattern == null) {
- return LocaleThreadLocal.get();
- }
- String[] a = pattern.split("_");
- switch (a.length) {
- case 1:
- return new Locale(a[0]);
- case 2:
- return new Locale(a[0], a[1]);
- case 3:
- return new Locale(a[0], a[1], a[2]);
- default:
- return LocaleThreadLocal.get();
- }
- }
-
- /**
- * Only use this {@link Locale} resolver if the calling code is executed in both, server- and client side.
- * On client side, use {@link Locale#getDefault()} whereas on server side use {@link LocaleThreadLocal#get()}.
- *
- * @return the locale hold by the current thread in {@link LocaleThreadLocal} or if not set by the instance of the
- * Java Virtual Machine.
- */
- public static Locale getDefaultLocale() {
- Locale locale = LocaleThreadLocal.get();
- if (locale == null) {
- locale = Locale.getDefault();
- }
- return locale;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.nls;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.Locale;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.scout.commons.LocaleThreadLocal;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+
+/**
+ * Warning: Avoid osgi imports in this class, so it can be used in J2EE
+ */
+public final class NlsUtility {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(NlsUtility.class);
+
+ private NlsUtility() {
+ }
+
+ private static final int MOD_EXPECTED = Modifier.PUBLIC | Modifier.STATIC;
+
+ private static final int MOD_MASK = MOD_EXPECTED | Modifier.FINAL;
+
+ public static void dynamicBindFields(Class<?> clazz) {
+ final Field[] fieldArray = clazz.getDeclaredFields();
+
+ boolean isAccessible = (clazz.getModifiers() & Modifier.PUBLIC) != 0;
+
+ // build a map of field names to Field objects
+ // final int len = fieldArray.length;
+
+ for (Field field : fieldArray) {
+ // can only set value of public static non-final fields
+ if ((field.getModifiers() & MOD_MASK) != MOD_EXPECTED) {
+ continue;
+ }
+ try {
+ // Check to see if we are allowed to modify the field. If we
+ // aren't (for instance
+ // if the class is not public) then change the accessible
+ // attribute of the field
+ // before trying to set the value.
+ if (!isAccessible) {
+ makeAccessible(field);
+ }
+ // Set the value into the field. We should never get an
+ // exception here because
+ // we know we have a public static non-final field. If we do get
+ // an exception, silently
+ // log it and continue. This means that the field will (most
+ // likely) be un-initialized and
+ // will fail later in the code and if so then we will see both
+ // the NPE and this error.
+ field.set(null, field.getName());
+ }
+ catch (Exception e) {
+ LOG.warn(null, e);
+ }
+ }
+ }
+
+ /*
+ * Change the accessibility of the specified field so we can set its value to
+ * be the appropriate message string.
+ */
+ static void makeAccessible(final Field field) {
+ if (System.getSecurityManager() == null) {
+ field.setAccessible(true);
+ }
+ else {
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ @Override
+ public Object run() {
+ field.setAccessible(true);
+ return null;
+ }
+ });
+ }
+ }
+
+ private static Pattern messageArgumentPattern = Pattern.compile("\\{([0-9]+)\\}");
+
+ /**
+ * @param key
+ * nls text key
+ * @param messageArguments
+ * the translation of the text might contain variables
+ * {0},{1},{2},... Examples: getText("MissingFile1"); with
+ * translation: MissingFile1=Das File konnte nicht gefunden werden
+ * getText("MissingFile2",fileName); with translation:
+ * MissingFile2=Das File {0} konnte nicht gefunden werden.
+ * getText("MissingFile3",fileName,dir); with translation:
+ * MissingFile3=Das File {0} im Ordner {1} konnte nicht gefunden
+ * werden
+ */
+ public static String bindText(String text, String... messageArguments) {
+ if (text != null) {
+ // check potential for message arguments
+ if (messageArguments != null && messageArguments.length > 0) {
+ Matcher m = messageArgumentPattern.matcher(text);
+ StringBuilder b = new StringBuilder();
+ int start = 0;
+ while (m.find(start)) {
+ b.append(text.substring(start, m.start()));
+ int index = Integer.parseInt(m.group(1));
+ if (messageArguments != null && index < messageArguments.length) {
+ if (messageArguments[index] != null) {
+ b.append(messageArguments[index]);
+ }
+ }
+ else {
+ b.append("{" + index + "}");
+ }
+ // next
+ start = m.end();
+ }
+ b.append(text.substring(start));
+ return b.toString();
+ }
+ else {
+ return text;
+ }
+ }
+ return text;
+ }
+
+ public static Locale parseLocale(String pattern) {
+ if (pattern == null) {
+ return LocaleThreadLocal.get();
+ }
+ String[] a = pattern.split("_");
+ switch (a.length) {
+ case 1:
+ return new Locale(a[0]);
+ case 2:
+ return new Locale(a[0], a[1]);
+ case 3:
+ return new Locale(a[0], a[1], a[2]);
+ default:
+ return LocaleThreadLocal.get();
+ }
+ }
+
+ /**
+ * Only use this {@link Locale} resolver if the calling code is executed in both, server- and client side.
+ * On client side, use {@link Locale#getDefault()} whereas on server side use {@link LocaleThreadLocal#get()}.
+ *
+ * @return the locale hold by the current thread in {@link LocaleThreadLocal} or if not set by the instance of the
+ * Java Virtual Machine.
+ */
+ public static Locale getDefaultLocale() {
+ Locale locale = LocaleThreadLocal.get();
+ if (locale == null) {
+ locale = Locale.getDefault();
+ }
+ return locale;
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/osgi/BundleClassDescriptor.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/osgi/BundleClassDescriptor.java
index dae8a49886..c06b4d6b97 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/osgi/BundleClassDescriptor.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/osgi/BundleClassDescriptor.java
@@ -1,92 +1,92 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.osgi;
-
-import java.io.Serializable;
-
-/**
- * Convenience holder with a bundle symbolic name and a classname.
- */
-public class BundleClassDescriptor implements Serializable {
- private static final long serialVersionUID = 1L;
-
- private String m_bundleSymbolicName;
- private String m_className;
-
- public BundleClassDescriptor(String bundleSymbolicName, String className) {
- if (bundleSymbolicName == null) {
- throw new IllegalArgumentException("bundleSymbolicName must not be null");
- }
- if (className == null) {
- throw new IllegalArgumentException("className must not be null");
- }
- m_bundleSymbolicName = bundleSymbolicName;
- m_className = className;
- }
-
- /**
- * @return the bundleSymbolicName
- */
- public String getBundleSymbolicName() {
- return m_bundleSymbolicName;
- }
-
- /**
- * @return the className
- */
- public String getClassName() {
- return m_className;
- }
-
- /**
- * @return the class simple name
- */
- public String getSimpleClassName() {
- int i = m_className.lastIndexOf('.');
- if (i >= 0) {
- return m_className.substring(i + 1);
- }
- else {
- return m_className;
- }
- }
-
- /*
- * (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- return m_bundleSymbolicName.hashCode() ^ m_className.hashCode();
- }
-
- /*
- * (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof BundleClassDescriptor) {
- BundleClassDescriptor o = (BundleClassDescriptor) obj;
- return o.m_bundleSymbolicName.equals(this.m_bundleSymbolicName) && o.m_className.equals(this.m_className);
- }
- return false;
- }
-
- /*
- * (non-Javadoc)
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return getClass().getSimpleName() + "[" + m_className + "@" + m_bundleSymbolicName + "]";
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.osgi;
+
+import java.io.Serializable;
+
+/**
+ * Convenience holder with a bundle symbolic name and a classname.
+ */
+public class BundleClassDescriptor implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private String m_bundleSymbolicName;
+ private String m_className;
+
+ public BundleClassDescriptor(String bundleSymbolicName, String className) {
+ if (bundleSymbolicName == null) {
+ throw new IllegalArgumentException("bundleSymbolicName must not be null");
+ }
+ if (className == null) {
+ throw new IllegalArgumentException("className must not be null");
+ }
+ m_bundleSymbolicName = bundleSymbolicName;
+ m_className = className;
+ }
+
+ /**
+ * @return the bundleSymbolicName
+ */
+ public String getBundleSymbolicName() {
+ return m_bundleSymbolicName;
+ }
+
+ /**
+ * @return the className
+ */
+ public String getClassName() {
+ return m_className;
+ }
+
+ /**
+ * @return the class simple name
+ */
+ public String getSimpleClassName() {
+ int i = m_className.lastIndexOf('.');
+ if (i >= 0) {
+ return m_className.substring(i + 1);
+ }
+ else {
+ return m_className;
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ return m_bundleSymbolicName.hashCode() ^ m_className.hashCode();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof BundleClassDescriptor) {
+ BundleClassDescriptor o = (BundleClassDescriptor) obj;
+ return o.m_bundleSymbolicName.equals(this.m_bundleSymbolicName) && o.m_className.equals(this.m_className);
+ }
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + "[" + m_className + "@" + m_bundleSymbolicName + "]";
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/osgi/BundleInspector.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/osgi/BundleInspector.java
index b8c0e1ee2c..676c57cd3a 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/osgi/BundleInspector.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/osgi/BundleInspector.java
@@ -1,335 +1,335 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.osgi;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.osgi.util.ManifestElement;
-import org.eclipse.scout.commons.internal.Activator;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleException;
-import org.osgi.framework.Constants;
-
-public final class BundleInspector {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(BundleInspector.class);
-
- private BundleInspector() {
- }
-
- /**
- * @return the breath-first traversed list of all bundles that are reachable starting with the rootBundle
- */
- public static Bundle[] getBundleDependencyTree(Bundle rootBundle) {
- ArrayList<Bundle> list = new ArrayList<Bundle>();
- ArrayList<Bundle> parents = new ArrayList<Bundle>();
- if (rootBundle != null) {
- list.add(rootBundle);
- parents.add(rootBundle);
- }
- // breath first tree traversal
- while (parents.size() > 0) {
- ArrayList<Bundle> nextParents = new ArrayList<Bundle>();
- for (Bundle bundle : parents) {
- try {
- ManifestElement[] bundleNames;
- bundleNames = ManifestElement.parseHeader(Constants.REQUIRE_BUNDLE, (String) bundle.getHeaders().get(Constants.REQUIRE_BUNDLE));
- if (bundleNames != null) {
- for (int i = 0; i < bundleNames.length; i++) {
- Bundle child = Platform.getBundle(bundleNames[i].getValue());
- if (child != null && !list.contains(child)) {
- list.add(child);
- nextParents.add(child);
- }
- }
- }
- }
- catch (BundleException e) {
- LOG.warn(null, e);
- }
- }
- parents = nextParents;
- }
- return list.toArray(new Bundle[0]);
- }
-
- /**
- * Transforms the dependency tree of all installed bundles into a list using the following algorithm:
- * <ul>
- * <li>Compute all leaf bundles and sort them according to the given prefix list.</li>
- * <li>For each leaf bundle, compute the bundle dependency tree, flatten and merge it with the resulting ordered
- * dependency list.</li>
- * </ul>
- * A leaf bundle's dependency list is merged into the resulting ordered list by iterating through the leaf bundle's
- * dependency list. As soon as a common bundle is found in both lists, the already iterated sub list of the leaf
- * bundle's dependency list is added in front of the common bundle in the resulting bundle list. This procedure is
- * repeated until the end of the leaf bundle's dependency list is reached. The potentially available tail list is
- * added to the end of the resulting ordered list.
- * <p>
- * <b>Example</b>
- *
- * <pre>
- * a.bundle1
- * |
- * |
- * |
- * a.bundle2
- * |
- * /--------------------+--------------------\
- * | | | |
- * a.bundle4 a.bundle3 b.bundle1 c.bundle1
- * | |
- * b.bundle2 c.bundle2
- * </pre>
- *
- * The invocation <code>getOrderedBundleList("c", "b")</code> returns one of the following two resulting lists:
- * <table>
- * <tr>
- * <th>Solution 1</th>
- * <th>Solution 2</th>
- * </tr>
- * <tr>
- * <td>c.bundle2</td>
- * <td>c.bundle2</td>
- * </tr>
- * <tr>
- * <td>c.bundle1</td>
- * <td>c.bundle1</td>
- * </tr>
- * <tr>
- * <td>b.bundle2</td>
- * <td>b.bundle2</td>
- * </tr>
- * <tr>
- * <td>b.bundle1</td>
- * <td>b.bundle1</td>
- * </tr>
- * <tr>
- * <td>a.bundle3</td>
- * <td>a.bundle4</td>
- * </tr>
- * <tr>
- * <td>a.bundle4</td>
- * <td>a.bundle3</td>
- * </tr>
- * <tr>
- * <td>a.bundle2</td>
- * <td>a.bundle2</td>
- * </tr>
- * <tr>
- * <td>a.bundle1</td>
- * <td>a.bundle1</td>
- * </tr>
- * </table>
- *
- * @param prefixList
- * list of bundle name prefixes that are used for ordering the bundles in the resulting list.
- * @return list of all bundles, ordered according to the dependency tree and the list of prefixes; all remaining are
- * added at the end.
- */
- public static Bundle[] getOrderedBundleList(final String... prefixList) {
- Bundle[] allBundles;
- if (Activator.getDefault() != null) {
- allBundles = Activator.getDefault().getBundle().getBundleContext().getBundles();
- }
- else {
- allBundles = new Bundle[0];
- }
- if (allBundles == null || allBundles.length == 0) {
- return new Bundle[0];
- }
-
- Set<Bundle> leafBundles = new HashSet<Bundle>();
- Map<String, Bundle> allBundleMap = new HashMap<String, Bundle>();
- Map<Bundle, List<Bundle>> bundleDependencies = new HashMap<Bundle, List<Bundle>>();
- for (Bundle bundle : allBundles) {
- allBundleMap.put(bundle.getSymbolicName(), bundle);
- leafBundles.add(bundle);
- }
-
- // compute leaf bundles and bundle dependencies
- for (Bundle bundle : allBundles) {
- try {
- List<Bundle> bundleDependencyList = new ArrayList<Bundle>();
- bundleDependencies.put(bundle, bundleDependencyList);
- ManifestElement[] bundleNames = ManifestElement.parseHeader(Constants.REQUIRE_BUNDLE, (String) bundle.getHeaders().get(Constants.REQUIRE_BUNDLE));
- if (bundleNames != null) {
- for (ManifestElement bundleName : bundleNames) {
- Bundle dependingBundle = allBundleMap.get(bundleName.getValue());
- leafBundles.remove(dependingBundle);
- if (dependingBundle != null) {
- bundleDependencyList.add(dependingBundle);
- }
- }
- }
- }
- catch (BundleException e) {
- LOG.warn(null, e);
- }
- }
-
- // sort leaf bundles according to the given prefix list
- List<Bundle> leafBundleList = new ArrayList<Bundle>(leafBundles);
- if (prefixList != null && prefixList.length > 0) {
- Comparator<Bundle> bundleComparator = new P_BundleNamePrefixComparator(prefixList);
- Collections.sort(leafBundleList, bundleComparator);
- }
-
- // build resulting ordered bundle list
- ArrayList<Bundle> orderedBundles = new ArrayList<Bundle>();
- for (Bundle leafBundle : leafBundleList) {
- ArrayList<Bundle> currentLeafBundleList = new ArrayList<Bundle>();
- ArrayList<Bundle> parents = new ArrayList<Bundle>();
- currentLeafBundleList.add(leafBundle);
- parents.add(leafBundle);
- // breath first tree traversal
- while (parents.size() > 0) {
- ArrayList<Bundle> nextParents = new ArrayList<Bundle>();
- for (Bundle bundle : parents) {
- for (Bundle bundleDep : bundleDependencies.get(bundle)) {
- if (!currentLeafBundleList.contains(bundleDep)) {
- currentLeafBundleList.add(bundleDep);
- if (!orderedBundles.contains(bundleDep)) {
- // Element is already in resulting ordered bundle list hence its dependencies are contained as well.
- // The element is still required in the currentLeafBundleList in order to find the point of
- // insertion in the resulting ordered bundle list.
- nextParents.add(bundleDep);
- }
- }
- }
- }
- parents = nextParents;
- }
-
- // merge current ordered leaf bundle list with resulting ordered bundle list
- if (orderedBundles.isEmpty()) {
- orderedBundles.addAll(currentLeafBundleList);
- }
- else {
- int curStart = 0;
- int curEnd = 0;
- for (Bundle bundle : currentLeafBundleList) {
- if (orderedBundles.contains(bundle)) {
- if (curStart != curEnd) {
- int insertIndex = orderedBundles.indexOf(bundle);
- orderedBundles.addAll(insertIndex, currentLeafBundleList.subList(curStart, curEnd));
- }
- curEnd++;
- curStart = curEnd;
- }
- else {
- curEnd++;
- }
- }
- if (curStart != curEnd) {
- orderedBundles.addAll(currentLeafBundleList.subList(curStart, curEnd));
- }
- }
- }
-
- return orderedBundles.toArray(new Bundle[orderedBundles.size()]);
- }
-
- /**
- * Resolves the given bundle's host or returns itself, if it is not a fragment bundle.
- *
- * @param bundle
- * <code>null</code> or an arbitrary bundle.
- * @return Returns <code>null</code> if the given bundle is <code>null</code>, the given bundle itself if its not a
- * fragment or the fragment's host bundle. If the resolution of a bundle throws an exception <code>null</code>
- * is returned as well.
- */
- public static Bundle getHostBundle(Bundle bundle) {
- if (bundle == null) {
- return null;
- }
- if (!Platform.isFragment(bundle)) {
- return bundle;
- }
- try {
- ManifestElement[] hostBundles = ManifestElement.parseHeader(Constants.FRAGMENT_HOST, (String) bundle.getHeaders().get(Constants.FRAGMENT_HOST));
- String hostBundleName = hostBundles[0].getValue();
- return Platform.getBundle(hostBundleName);
- }
- catch (Exception e) {
- LOG.warn("Could not resolve host of fragment bundle [" + bundle.getBundleId() + "]", e);
- }
- return null;
- }
-
- private static final class P_BundleNamePrefixComparator implements Comparator<Bundle> {
- private final String[] prefixList;
-
- private P_BundleNamePrefixComparator(String... prefixList) {
- if (prefixList == null) {
- throw new IllegalArgumentException("prefixList must not be null.");
- }
- this.prefixList = prefixList;
- }
-
- @Override
- public int compare(Bundle b1, Bundle b2) {
- int b1SortIndex = getBundleSortIndex(b1);
- int b2SortIndex = getBundleSortIndex(b2);
- if (b1SortIndex == b2SortIndex) {
- return 0;
- }
- else if (b1SortIndex < b2SortIndex) {
- return -1;
- }
- else {
- return 1;
- }
- }
-
- private int getBundleSortIndex(Bundle bundle) {
- for (int i = 0; i < prefixList.length; i++) {
- String symbolicName = bundle.getSymbolicName();
- if (symbolicName.startsWith(prefixList[i])) {
- return i;
- }
- }
- return Integer.MAX_VALUE;
- }
- }
-
- public abstract static class BundleComparator implements Comparator<Bundle> {
-
- public BundleComparator() {
- }
-
- @Override
- public int compare(Bundle b1, Bundle b2) {
- int b1SortIndex = getBundleSortIndex(b1, b1.getSymbolicName());
- int b2SortIndex = getBundleSortIndex(b2, b2.getSymbolicName());
- if (b1SortIndex == b2SortIndex) {
- return 0;
- }
- else if (b1SortIndex < b2SortIndex) {
- return -1;
- }
- else {
- return 1;
- }
- }
-
- protected abstract int getBundleSortIndex(Bundle bundle, String symbolicName);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.osgi;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.osgi.util.ManifestElement;
+import org.eclipse.scout.commons.internal.Activator;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.Constants;
+
+public final class BundleInspector {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(BundleInspector.class);
+
+ private BundleInspector() {
+ }
+
+ /**
+ * @return the breath-first traversed list of all bundles that are reachable starting with the rootBundle
+ */
+ public static Bundle[] getBundleDependencyTree(Bundle rootBundle) {
+ ArrayList<Bundle> list = new ArrayList<Bundle>();
+ ArrayList<Bundle> parents = new ArrayList<Bundle>();
+ if (rootBundle != null) {
+ list.add(rootBundle);
+ parents.add(rootBundle);
+ }
+ // breath first tree traversal
+ while (parents.size() > 0) {
+ ArrayList<Bundle> nextParents = new ArrayList<Bundle>();
+ for (Bundle bundle : parents) {
+ try {
+ ManifestElement[] bundleNames;
+ bundleNames = ManifestElement.parseHeader(Constants.REQUIRE_BUNDLE, (String) bundle.getHeaders().get(Constants.REQUIRE_BUNDLE));
+ if (bundleNames != null) {
+ for (int i = 0; i < bundleNames.length; i++) {
+ Bundle child = Platform.getBundle(bundleNames[i].getValue());
+ if (child != null && !list.contains(child)) {
+ list.add(child);
+ nextParents.add(child);
+ }
+ }
+ }
+ }
+ catch (BundleException e) {
+ LOG.warn(null, e);
+ }
+ }
+ parents = nextParents;
+ }
+ return list.toArray(new Bundle[0]);
+ }
+
+ /**
+ * Transforms the dependency tree of all installed bundles into a list using the following algorithm:
+ * <ul>
+ * <li>Compute all leaf bundles and sort them according to the given prefix list.</li>
+ * <li>For each leaf bundle, compute the bundle dependency tree, flatten and merge it with the resulting ordered
+ * dependency list.</li>
+ * </ul>
+ * A leaf bundle's dependency list is merged into the resulting ordered list by iterating through the leaf bundle's
+ * dependency list. As soon as a common bundle is found in both lists, the already iterated sub list of the leaf
+ * bundle's dependency list is added in front of the common bundle in the resulting bundle list. This procedure is
+ * repeated until the end of the leaf bundle's dependency list is reached. The potentially available tail list is
+ * added to the end of the resulting ordered list.
+ * <p>
+ * <b>Example</b>
+ *
+ * <pre>
+ * a.bundle1
+ * |
+ * |
+ * |
+ * a.bundle2
+ * |
+ * /--------------------+--------------------\
+ * | | | |
+ * a.bundle4 a.bundle3 b.bundle1 c.bundle1
+ * | |
+ * b.bundle2 c.bundle2
+ * </pre>
+ *
+ * The invocation <code>getOrderedBundleList("c", "b")</code> returns one of the following two resulting lists:
+ * <table>
+ * <tr>
+ * <th>Solution 1</th>
+ * <th>Solution 2</th>
+ * </tr>
+ * <tr>
+ * <td>c.bundle2</td>
+ * <td>c.bundle2</td>
+ * </tr>
+ * <tr>
+ * <td>c.bundle1</td>
+ * <td>c.bundle1</td>
+ * </tr>
+ * <tr>
+ * <td>b.bundle2</td>
+ * <td>b.bundle2</td>
+ * </tr>
+ * <tr>
+ * <td>b.bundle1</td>
+ * <td>b.bundle1</td>
+ * </tr>
+ * <tr>
+ * <td>a.bundle3</td>
+ * <td>a.bundle4</td>
+ * </tr>
+ * <tr>
+ * <td>a.bundle4</td>
+ * <td>a.bundle3</td>
+ * </tr>
+ * <tr>
+ * <td>a.bundle2</td>
+ * <td>a.bundle2</td>
+ * </tr>
+ * <tr>
+ * <td>a.bundle1</td>
+ * <td>a.bundle1</td>
+ * </tr>
+ * </table>
+ *
+ * @param prefixList
+ * list of bundle name prefixes that are used for ordering the bundles in the resulting list.
+ * @return list of all bundles, ordered according to the dependency tree and the list of prefixes; all remaining are
+ * added at the end.
+ */
+ public static Bundle[] getOrderedBundleList(final String... prefixList) {
+ Bundle[] allBundles;
+ if (Activator.getDefault() != null) {
+ allBundles = Activator.getDefault().getBundle().getBundleContext().getBundles();
+ }
+ else {
+ allBundles = new Bundle[0];
+ }
+ if (allBundles == null || allBundles.length == 0) {
+ return new Bundle[0];
+ }
+
+ Set<Bundle> leafBundles = new HashSet<Bundle>();
+ Map<String, Bundle> allBundleMap = new HashMap<String, Bundle>();
+ Map<Bundle, List<Bundle>> bundleDependencies = new HashMap<Bundle, List<Bundle>>();
+ for (Bundle bundle : allBundles) {
+ allBundleMap.put(bundle.getSymbolicName(), bundle);
+ leafBundles.add(bundle);
+ }
+
+ // compute leaf bundles and bundle dependencies
+ for (Bundle bundle : allBundles) {
+ try {
+ List<Bundle> bundleDependencyList = new ArrayList<Bundle>();
+ bundleDependencies.put(bundle, bundleDependencyList);
+ ManifestElement[] bundleNames = ManifestElement.parseHeader(Constants.REQUIRE_BUNDLE, (String) bundle.getHeaders().get(Constants.REQUIRE_BUNDLE));
+ if (bundleNames != null) {
+ for (ManifestElement bundleName : bundleNames) {
+ Bundle dependingBundle = allBundleMap.get(bundleName.getValue());
+ leafBundles.remove(dependingBundle);
+ if (dependingBundle != null) {
+ bundleDependencyList.add(dependingBundle);
+ }
+ }
+ }
+ }
+ catch (BundleException e) {
+ LOG.warn(null, e);
+ }
+ }
+
+ // sort leaf bundles according to the given prefix list
+ List<Bundle> leafBundleList = new ArrayList<Bundle>(leafBundles);
+ if (prefixList != null && prefixList.length > 0) {
+ Comparator<Bundle> bundleComparator = new P_BundleNamePrefixComparator(prefixList);
+ Collections.sort(leafBundleList, bundleComparator);
+ }
+
+ // build resulting ordered bundle list
+ ArrayList<Bundle> orderedBundles = new ArrayList<Bundle>();
+ for (Bundle leafBundle : leafBundleList) {
+ ArrayList<Bundle> currentLeafBundleList = new ArrayList<Bundle>();
+ ArrayList<Bundle> parents = new ArrayList<Bundle>();
+ currentLeafBundleList.add(leafBundle);
+ parents.add(leafBundle);
+ // breath first tree traversal
+ while (parents.size() > 0) {
+ ArrayList<Bundle> nextParents = new ArrayList<Bundle>();
+ for (Bundle bundle : parents) {
+ for (Bundle bundleDep : bundleDependencies.get(bundle)) {
+ if (!currentLeafBundleList.contains(bundleDep)) {
+ currentLeafBundleList.add(bundleDep);
+ if (!orderedBundles.contains(bundleDep)) {
+ // Element is already in resulting ordered bundle list hence its dependencies are contained as well.
+ // The element is still required in the currentLeafBundleList in order to find the point of
+ // insertion in the resulting ordered bundle list.
+ nextParents.add(bundleDep);
+ }
+ }
+ }
+ }
+ parents = nextParents;
+ }
+
+ // merge current ordered leaf bundle list with resulting ordered bundle list
+ if (orderedBundles.isEmpty()) {
+ orderedBundles.addAll(currentLeafBundleList);
+ }
+ else {
+ int curStart = 0;
+ int curEnd = 0;
+ for (Bundle bundle : currentLeafBundleList) {
+ if (orderedBundles.contains(bundle)) {
+ if (curStart != curEnd) {
+ int insertIndex = orderedBundles.indexOf(bundle);
+ orderedBundles.addAll(insertIndex, currentLeafBundleList.subList(curStart, curEnd));
+ }
+ curEnd++;
+ curStart = curEnd;
+ }
+ else {
+ curEnd++;
+ }
+ }
+ if (curStart != curEnd) {
+ orderedBundles.addAll(currentLeafBundleList.subList(curStart, curEnd));
+ }
+ }
+ }
+
+ return orderedBundles.toArray(new Bundle[orderedBundles.size()]);
+ }
+
+ /**
+ * Resolves the given bundle's host or returns itself, if it is not a fragment bundle.
+ *
+ * @param bundle
+ * <code>null</code> or an arbitrary bundle.
+ * @return Returns <code>null</code> if the given bundle is <code>null</code>, the given bundle itself if its not a
+ * fragment or the fragment's host bundle. If the resolution of a bundle throws an exception <code>null</code>
+ * is returned as well.
+ */
+ public static Bundle getHostBundle(Bundle bundle) {
+ if (bundle == null) {
+ return null;
+ }
+ if (!Platform.isFragment(bundle)) {
+ return bundle;
+ }
+ try {
+ ManifestElement[] hostBundles = ManifestElement.parseHeader(Constants.FRAGMENT_HOST, (String) bundle.getHeaders().get(Constants.FRAGMENT_HOST));
+ String hostBundleName = hostBundles[0].getValue();
+ return Platform.getBundle(hostBundleName);
+ }
+ catch (Exception e) {
+ LOG.warn("Could not resolve host of fragment bundle [" + bundle.getBundleId() + "]", e);
+ }
+ return null;
+ }
+
+ private static final class P_BundleNamePrefixComparator implements Comparator<Bundle> {
+ private final String[] prefixList;
+
+ private P_BundleNamePrefixComparator(String... prefixList) {
+ if (prefixList == null) {
+ throw new IllegalArgumentException("prefixList must not be null.");
+ }
+ this.prefixList = prefixList;
+ }
+
+ @Override
+ public int compare(Bundle b1, Bundle b2) {
+ int b1SortIndex = getBundleSortIndex(b1);
+ int b2SortIndex = getBundleSortIndex(b2);
+ if (b1SortIndex == b2SortIndex) {
+ return 0;
+ }
+ else if (b1SortIndex < b2SortIndex) {
+ return -1;
+ }
+ else {
+ return 1;
+ }
+ }
+
+ private int getBundleSortIndex(Bundle bundle) {
+ for (int i = 0; i < prefixList.length; i++) {
+ String symbolicName = bundle.getSymbolicName();
+ if (symbolicName.startsWith(prefixList[i])) {
+ return i;
+ }
+ }
+ return Integer.MAX_VALUE;
+ }
+ }
+
+ public abstract static class BundleComparator implements Comparator<Bundle> {
+
+ public BundleComparator() {
+ }
+
+ @Override
+ public int compare(Bundle b1, Bundle b2) {
+ int b1SortIndex = getBundleSortIndex(b1, b1.getSymbolicName());
+ int b2SortIndex = getBundleSortIndex(b2, b2.getSymbolicName());
+ if (b1SortIndex == b2SortIndex) {
+ return 0;
+ }
+ else if (b1SortIndex < b2SortIndex) {
+ return -1;
+ }
+ else {
+ return 1;
+ }
+ }
+
+ protected abstract int getBundleSortIndex(Bundle bundle, String symbolicName);
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/osgi/BundleObjectInputStream.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/osgi/BundleObjectInputStream.java
index 6d6fc8ff02..9f461758e2 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/osgi/BundleObjectInputStream.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/osgi/BundleObjectInputStream.java
@@ -1,153 +1,153 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.osgi;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectStreamClass;
-import java.lang.reflect.Array;
-import java.util.HashMap;
-
-import org.eclipse.scout.commons.internal.Activator;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.osgi.framework.Bundle;
-
-/**
- * Serialization specialization to be used in osgi environments with bundle class loading instead of flat class loading<br>
- * <p>
- * see also {@link BundleObjectOutputStream}
- */
-public class BundleObjectInputStream extends ObjectInputStream {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(BundleObjectInputStream.class);
-
- /** table mapping primitive type names to corresponding class objects */
- private static final HashMap<String, Class> PRIMITIVE_TYPES;
- static {
- PRIMITIVE_TYPES = new HashMap<String, Class>(8, 1f);
- PRIMITIVE_TYPES.put("boolean", boolean.class);
- PRIMITIVE_TYPES.put("byte", byte.class);
- PRIMITIVE_TYPES.put("char", char.class);
- PRIMITIVE_TYPES.put("short", short.class);
- PRIMITIVE_TYPES.put("int", int.class);
- PRIMITIVE_TYPES.put("long", long.class);
- PRIMITIVE_TYPES.put("float", float.class);
- PRIMITIVE_TYPES.put("double", double.class);
- PRIMITIVE_TYPES.put("void", void.class);
- //
- PRIMITIVE_TYPES.put("Z", boolean.class);
- PRIMITIVE_TYPES.put("B", byte.class);
- PRIMITIVE_TYPES.put("C", char.class);
- PRIMITIVE_TYPES.put("S", short.class);
- PRIMITIVE_TYPES.put("I", int.class);
- PRIMITIVE_TYPES.put("J", long.class);
- PRIMITIVE_TYPES.put("F", float.class);
- PRIMITIVE_TYPES.put("D", double.class);
- PRIMITIVE_TYPES.put("V", void.class);
- }
-
- private Bundle[] m_bundleList;
-
- public BundleObjectInputStream(InputStream in, Bundle[] bundleList) throws IOException {
- super(in);
- m_bundleList = bundleList;
- enableResolveObject(true);
- }
-
- /**
- * explicitly made public to allow object replacers to load classes via the input stream
- */
- @Override
- public Class<?> resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException {
- return defaultResolveClass(desc.getName());
- }
-
- private Class<?> defaultResolveClass(String className) throws ClassNotFoundException, IOException {
- Class c = PRIMITIVE_TYPES.get(className);
- if (c != null) {
- return c;
- }
- try {
- int arrayDim = 0;
- while (className.startsWith("[")) {
- className = className.substring(1);
- arrayDim++;
- }
- if (className.matches("L.*;")) {
- className = className.substring(1, className.length() - 1);
- }
- if (arrayDim > 0) {
- c = defaultResolveClass(className);
- int[] dimensions = new int[arrayDim];
- c = Array.newInstance(c, dimensions).getClass();
- }
- else {
- //1. try activated bundles
- for (Bundle b : m_bundleList) {
- if (b.getState() == Bundle.ACTIVE) {
- try {
- c = b.loadClass(className);
- break;
- }
- catch (ClassNotFoundException e) {
- // nop
- }
- }
- }
- if (c != null) {
- return c;
- }
- //2. try resolved bundles which prefix the class
- for (Bundle b : m_bundleList) {
- if (b.getState() == Bundle.RESOLVED && className.startsWith(b.getSymbolicName())) {
- try {
- c = b.loadClass(className);
- break;
- }
- catch (ClassNotFoundException e) {
- // nop
- }
- }
- }
- if (c != null) {
- return c;
- }
- //3. try all bundles
- for (Bundle b : m_bundleList) {
- try {
- c = b.loadClass(className);
- break;
- }
- catch (ClassNotFoundException e) {
- // nop
- }
- }
- if (c != null) {
- return c;
- }
- //
- if (Activator.getDefault() == null) {
- //outside osgi
- c = Class.forName(className);
- return c;
- }
- throw new ClassNotFoundException(className);
- }
- return c;
- }
- catch (ClassNotFoundException e) {
- LOG.error("reading serialized object from http proxy tunnel: " + e.getMessage(), e);
- throw e;
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.osgi;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectStreamClass;
+import java.lang.reflect.Array;
+import java.util.HashMap;
+
+import org.eclipse.scout.commons.internal.Activator;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.osgi.framework.Bundle;
+
+/**
+ * Serialization specialization to be used in osgi environments with bundle class loading instead of flat class loading<br>
+ * <p>
+ * see also {@link BundleObjectOutputStream}
+ */
+public class BundleObjectInputStream extends ObjectInputStream {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(BundleObjectInputStream.class);
+
+ /** table mapping primitive type names to corresponding class objects */
+ private static final HashMap<String, Class> PRIMITIVE_TYPES;
+ static {
+ PRIMITIVE_TYPES = new HashMap<String, Class>(8, 1f);
+ PRIMITIVE_TYPES.put("boolean", boolean.class);
+ PRIMITIVE_TYPES.put("byte", byte.class);
+ PRIMITIVE_TYPES.put("char", char.class);
+ PRIMITIVE_TYPES.put("short", short.class);
+ PRIMITIVE_TYPES.put("int", int.class);
+ PRIMITIVE_TYPES.put("long", long.class);
+ PRIMITIVE_TYPES.put("float", float.class);
+ PRIMITIVE_TYPES.put("double", double.class);
+ PRIMITIVE_TYPES.put("void", void.class);
+ //
+ PRIMITIVE_TYPES.put("Z", boolean.class);
+ PRIMITIVE_TYPES.put("B", byte.class);
+ PRIMITIVE_TYPES.put("C", char.class);
+ PRIMITIVE_TYPES.put("S", short.class);
+ PRIMITIVE_TYPES.put("I", int.class);
+ PRIMITIVE_TYPES.put("J", long.class);
+ PRIMITIVE_TYPES.put("F", float.class);
+ PRIMITIVE_TYPES.put("D", double.class);
+ PRIMITIVE_TYPES.put("V", void.class);
+ }
+
+ private Bundle[] m_bundleList;
+
+ public BundleObjectInputStream(InputStream in, Bundle[] bundleList) throws IOException {
+ super(in);
+ m_bundleList = bundleList;
+ enableResolveObject(true);
+ }
+
+ /**
+ * explicitly made public to allow object replacers to load classes via the input stream
+ */
+ @Override
+ public Class<?> resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException {
+ return defaultResolveClass(desc.getName());
+ }
+
+ private Class<?> defaultResolveClass(String className) throws ClassNotFoundException, IOException {
+ Class c = PRIMITIVE_TYPES.get(className);
+ if (c != null) {
+ return c;
+ }
+ try {
+ int arrayDim = 0;
+ while (className.startsWith("[")) {
+ className = className.substring(1);
+ arrayDim++;
+ }
+ if (className.matches("L.*;")) {
+ className = className.substring(1, className.length() - 1);
+ }
+ if (arrayDim > 0) {
+ c = defaultResolveClass(className);
+ int[] dimensions = new int[arrayDim];
+ c = Array.newInstance(c, dimensions).getClass();
+ }
+ else {
+ //1. try activated bundles
+ for (Bundle b : m_bundleList) {
+ if (b.getState() == Bundle.ACTIVE) {
+ try {
+ c = b.loadClass(className);
+ break;
+ }
+ catch (ClassNotFoundException e) {
+ // nop
+ }
+ }
+ }
+ if (c != null) {
+ return c;
+ }
+ //2. try resolved bundles which prefix the class
+ for (Bundle b : m_bundleList) {
+ if (b.getState() == Bundle.RESOLVED && className.startsWith(b.getSymbolicName())) {
+ try {
+ c = b.loadClass(className);
+ break;
+ }
+ catch (ClassNotFoundException e) {
+ // nop
+ }
+ }
+ }
+ if (c != null) {
+ return c;
+ }
+ //3. try all bundles
+ for (Bundle b : m_bundleList) {
+ try {
+ c = b.loadClass(className);
+ break;
+ }
+ catch (ClassNotFoundException e) {
+ // nop
+ }
+ }
+ if (c != null) {
+ return c;
+ }
+ //
+ if (Activator.getDefault() == null) {
+ //outside osgi
+ c = Class.forName(className);
+ return c;
+ }
+ throw new ClassNotFoundException(className);
+ }
+ return c;
+ }
+ catch (ClassNotFoundException e) {
+ LOG.error("reading serialized object from http proxy tunnel: " + e.getMessage(), e);
+ throw e;
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/osgi/BundleObjectOutputStream.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/osgi/BundleObjectOutputStream.java
index e7e8532912..daf44add9b 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/osgi/BundleObjectOutputStream.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/osgi/BundleObjectOutputStream.java
@@ -1,29 +1,29 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.osgi;
-
-import java.io.IOException;
-import java.io.ObjectOutputStream;
-import java.io.OutputStream;
-
-/**
- * Serialization specialization to be used in osgi environments with bundle class loading instead of flat class loading<br>
- * <p>
- * see also {@link BundleObjectInputStream}
- */
-public class BundleObjectOutputStream extends ObjectOutputStream {
-
- public BundleObjectOutputStream(OutputStream out) throws IOException {
- super(out);
- enableReplaceObject(true);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.osgi;
+
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+import java.io.OutputStream;
+
+/**
+ * Serialization specialization to be used in osgi environments with bundle class loading instead of flat class loading<br>
+ * <p>
+ * see also {@link BundleObjectInputStream}
+ */
+public class BundleObjectOutputStream extends ObjectOutputStream {
+
+ public BundleObjectOutputStream(OutputStream out) throws IOException {
+ super(out);
+ enableReplaceObject(true);
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/osgi/ContextFinderBasedObjectInputStream.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/osgi/ContextFinderBasedObjectInputStream.java
index ff30d5fbf9..8939ad328a 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/osgi/ContextFinderBasedObjectInputStream.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/osgi/ContextFinderBasedObjectInputStream.java
@@ -1,104 +1,104 @@
-package org.eclipse.scout.commons.osgi;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectStreamClass;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
-/**
- * Resolve an object using first the context class loader (ContextFinder) and then a custom resolver.
- * <p>
- * The ContextFinder has the "flaw" that it uses the caller class loader(s) but it accepts the first class loader of
- * type BundleClassLoader. Since this guess is correct in some / many cases it is wrong for other cases when a
- * specialized bundle uses code from a common bundle and the common bundle loads classes using the ContextFinder. Then
- * the other BundleClassLoader should be considered as well.
- */
-public class ContextFinderBasedObjectInputStream extends ObjectInputStream {
- private static final class ClassContextAccessor extends SecurityManager {
- @Override
- public Class[] getClassContext() {
- return super.getClassContext();
- }
- }
-
- private static ClassContextAccessor ccAccessor;
-
- static {
- AccessController.doPrivileged(new PrivilegedAction<Object>() {
- @Override
- public Object run() {
- ccAccessor = new ClassContextAccessor();
- return null;
- }
- });
- }
-
- private ClassLoader m_primaryClassLoader;
-
- public ContextFinderBasedObjectInputStream(InputStream in) throws IOException {
- this(in, null);
- }
-
- public ContextFinderBasedObjectInputStream(InputStream in, ClassLoader primaryClassLoader) throws IOException {
- super(in);
- m_primaryClassLoader = primaryClassLoader;
- enableResolveObject(true);
- }
-
- @Override
- protected Class<?> resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException {
- try {
- //pass 1
- return defaultResolveClass(desc.getName());
- }
- catch (ClassNotFoundException e) {
- //pass 2
- return pass2ResolveClass(desc.getName());
- }
- }
-
- private Class<?> defaultResolveClass(String className) throws ClassNotFoundException, IOException {
- return Class.forName(className);
- }
-
- private Class<?> pass2ResolveClass(String className) throws ClassNotFoundException, IOException {
- if (m_primaryClassLoader != null) {
- try {
- return Class.forName(className, false, m_primaryClassLoader);
- }
- catch (Throwable t) {
- //nop
- }
- }
- //
- Class[] cc = ccAccessor.getClassContext();
- ClassLoader contextLoader = Thread.currentThread().getContextClassLoader();
- ClassLoader lastLoader = null;
- for (int i = 1; i < cc.length; i++) {
- ClassLoader cl = cc[i].getClassLoader();
- if (cl == null) {
- continue;
- }
- if (cl == m_primaryClassLoader) {
- continue;
- }
- if (cl == contextLoader) {
- continue;
- }
- if (cl == lastLoader) {
- continue;
- }
- lastLoader = cl;
- try {
- return Class.forName(className, false, cl);
- }
- catch (Throwable t) {
- //nop
- }
- }
- throw new ClassNotFoundException(className);
- }
-
-}
+package org.eclipse.scout.commons.osgi;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectStreamClass;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+/**
+ * Resolve an object using first the context class loader (ContextFinder) and then a custom resolver.
+ * <p>
+ * The ContextFinder has the "flaw" that it uses the caller class loader(s) but it accepts the first class loader of
+ * type BundleClassLoader. Since this guess is correct in some / many cases it is wrong for other cases when a
+ * specialized bundle uses code from a common bundle and the common bundle loads classes using the ContextFinder. Then
+ * the other BundleClassLoader should be considered as well.
+ */
+public class ContextFinderBasedObjectInputStream extends ObjectInputStream {
+ private static final class ClassContextAccessor extends SecurityManager {
+ @Override
+ public Class[] getClassContext() {
+ return super.getClassContext();
+ }
+ }
+
+ private static ClassContextAccessor ccAccessor;
+
+ static {
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ @Override
+ public Object run() {
+ ccAccessor = new ClassContextAccessor();
+ return null;
+ }
+ });
+ }
+
+ private ClassLoader m_primaryClassLoader;
+
+ public ContextFinderBasedObjectInputStream(InputStream in) throws IOException {
+ this(in, null);
+ }
+
+ public ContextFinderBasedObjectInputStream(InputStream in, ClassLoader primaryClassLoader) throws IOException {
+ super(in);
+ m_primaryClassLoader = primaryClassLoader;
+ enableResolveObject(true);
+ }
+
+ @Override
+ protected Class<?> resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException {
+ try {
+ //pass 1
+ return defaultResolveClass(desc.getName());
+ }
+ catch (ClassNotFoundException e) {
+ //pass 2
+ return pass2ResolveClass(desc.getName());
+ }
+ }
+
+ private Class<?> defaultResolveClass(String className) throws ClassNotFoundException, IOException {
+ return Class.forName(className);
+ }
+
+ private Class<?> pass2ResolveClass(String className) throws ClassNotFoundException, IOException {
+ if (m_primaryClassLoader != null) {
+ try {
+ return Class.forName(className, false, m_primaryClassLoader);
+ }
+ catch (Throwable t) {
+ //nop
+ }
+ }
+ //
+ Class[] cc = ccAccessor.getClassContext();
+ ClassLoader contextLoader = Thread.currentThread().getContextClassLoader();
+ ClassLoader lastLoader = null;
+ for (int i = 1; i < cc.length; i++) {
+ ClassLoader cl = cc[i].getClassLoader();
+ if (cl == null) {
+ continue;
+ }
+ if (cl == m_primaryClassLoader) {
+ continue;
+ }
+ if (cl == contextLoader) {
+ continue;
+ }
+ if (cl == lastLoader) {
+ continue;
+ }
+ lastLoader = cl;
+ try {
+ return Class.forName(className, false, cl);
+ }
+ catch (Throwable t) {
+ //nop
+ }
+ }
+ throw new ClassNotFoundException(className);
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/BindModel.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/BindModel.java
index 6efb36e02e..2e5f2cfb75 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/BindModel.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/BindModel.java
@@ -1,68 +1,68 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.parsers;
-
-import java.util.ArrayList;
-
-import org.eclipse.scout.commons.parsers.token.FunctionInputToken;
-import org.eclipse.scout.commons.parsers.token.IToken;
-import org.eclipse.scout.commons.parsers.token.ValueInputToken;
-import org.eclipse.scout.commons.parsers.token.ValueOutputToken;
-
-public class BindModel {
- private IToken[] m_allTokens;
- private IToken[] m_ioTokens;
-
- public BindModel(IToken[] tokens) {
- m_allTokens = tokens;
- ArrayList<IToken> ioList = new ArrayList<IToken>();
- for (int i = 0; i < tokens.length; i++) {
- if (tokens[i] instanceof ValueInputToken) {
- ioList.add(tokens[i]);
- }
- else if (tokens[i] instanceof FunctionInputToken) {
- ioList.add(tokens[i]);
- }
- else if (tokens[i] instanceof ValueOutputToken) {
- ioList.add(tokens[i]);
- }
- }
- m_ioTokens = ioList.toArray(new IToken[ioList.size()]);
- }
-
- public IToken[] getAllTokens() {
- return m_allTokens;
- }
-
- public IToken[] getIOTokens() {
- return m_ioTokens;
- }
-
- public String getFilteredStatement() {
- StringBuffer b = new StringBuffer();
- for (int i = 0; i < m_allTokens.length; i++) {
- if (m_allTokens[i] instanceof ValueInputToken) {
- ValueInputToken valueInputToken = (ValueInputToken) m_allTokens[i];
- if (valueInputToken.getParsedAttribute() != null) {
- b.append(valueInputToken.getParsedAttribute());
- b.append(" ");
- }
- if (valueInputToken.getParsedOp() != null) {
- b.append(valueInputToken.getParsedOp());
- b.append(" ");
- }
- }
- b.append(m_allTokens[i].getReplaceToken());
- }
- return b.toString();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.parsers;
+
+import java.util.ArrayList;
+
+import org.eclipse.scout.commons.parsers.token.FunctionInputToken;
+import org.eclipse.scout.commons.parsers.token.IToken;
+import org.eclipse.scout.commons.parsers.token.ValueInputToken;
+import org.eclipse.scout.commons.parsers.token.ValueOutputToken;
+
+public class BindModel {
+ private IToken[] m_allTokens;
+ private IToken[] m_ioTokens;
+
+ public BindModel(IToken[] tokens) {
+ m_allTokens = tokens;
+ ArrayList<IToken> ioList = new ArrayList<IToken>();
+ for (int i = 0; i < tokens.length; i++) {
+ if (tokens[i] instanceof ValueInputToken) {
+ ioList.add(tokens[i]);
+ }
+ else if (tokens[i] instanceof FunctionInputToken) {
+ ioList.add(tokens[i]);
+ }
+ else if (tokens[i] instanceof ValueOutputToken) {
+ ioList.add(tokens[i]);
+ }
+ }
+ m_ioTokens = ioList.toArray(new IToken[ioList.size()]);
+ }
+
+ public IToken[] getAllTokens() {
+ return m_allTokens;
+ }
+
+ public IToken[] getIOTokens() {
+ return m_ioTokens;
+ }
+
+ public String getFilteredStatement() {
+ StringBuffer b = new StringBuffer();
+ for (int i = 0; i < m_allTokens.length; i++) {
+ if (m_allTokens[i] instanceof ValueInputToken) {
+ ValueInputToken valueInputToken = (ValueInputToken) m_allTokens[i];
+ if (valueInputToken.getParsedAttribute() != null) {
+ b.append(valueInputToken.getParsedAttribute());
+ b.append(" ");
+ }
+ if (valueInputToken.getParsedOp() != null) {
+ b.append(valueInputToken.getParsedOp());
+ b.append(" ");
+ }
+ }
+ b.append(m_allTokens[i].getReplaceToken());
+ }
+ return b.toString();
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/BindParser.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/BindParser.java
index a1154a7e90..cfabf07b7f 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/BindParser.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/BindParser.java
@@ -1,594 +1,594 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.parsers;
-
-import java.text.ParsePosition;
-import java.util.ArrayList;
-
-import org.eclipse.scout.commons.internal.Activator;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.commons.parsers.token.DatabaseSpecificToken;
-import org.eclipse.scout.commons.parsers.token.FunctionInputToken;
-import org.eclipse.scout.commons.parsers.token.IToken;
-import org.eclipse.scout.commons.parsers.token.TextToken;
-import org.eclipse.scout.commons.parsers.token.ValueInputToken;
-import org.eclipse.scout.commons.parsers.token.ValueOutputToken;
-
-/**
- * Parser for bind variables in arbitrary sql staments
- * The bind is (possibly) parsed together with its left operator (for better =ANY vs. IN handlings)
- * <p>
- * Bind Possibilities are
- * <ul>
- * <li>:abc</li>
- * <li>:[OUT]abc</li>
- * <li>#abc#</li>
- * <li>#[OUT]abc#</li>
- * </ul>
- * <p>
- * Syntax (EBNF):
- * <pre>
- * statement = S? token-list .
- * token-list = token (S? token)* .
- * token = text | extended-bind | char .
- * extended-bind = (attribute S?)? (op S?)? bind .
- * attribute = name . //but not op
- * op = '=' | '<>' | '!=' | '<=' | '>=' | '<' | '>' | 'IN' | 'NOT' S 'IN' .
- * bind = escaped-value-bind | plain-sql-bind | jdbc-bind .
- * escaped-value-bind='#' name '#' .
- * jdbc-bind = ':' name .
- * function-bind = ( '::' | '##' ) name S? '(' S? function-arg-list? S? ')' .
- * function-arg-list= function-arg (S? ',' S? function-arg)* .
- * function-arg = text | name | number.
- * database-specific-token = '$$' name .
- * name = name-char+ .
- * number = name-char+ .
- * text = `'` text-char* `'` .
- * name-char = [a-zA-Z0-9_.{}[]] .
- * number-char = [0-9] .
- * text-char = [^'] | `''` .
- * char = [.] .
- * S = ([ \n\t\r])+ .
- * </pre>
- * <p>
- * The legacy functionality supporting &...& binds - which can lead to sql injection if not carefully used - will be eliminated in future releases.
- * To avoid unexpected usages, a warning is thrown on every usage. Using the server-side config.ini property <b>org.eclipse.scout.commons.sqlplainbind=true|false</b>
- * true means activating the legacy functionality (which will be removed in future releases) and false throws an exception when using &...& binds.
- */
-public class BindParser {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(BindParser.class);
-
- private static final String PLAIN_SQL_BIND_PROPERTY_NAME = "org.eclipse.scout.commons.sqlplainbind";
- private static final Boolean PLAIN_SQL_BIND_ENABLED;
-
- private static final String S_MAP;
- private static final String NAME_MAP;
- static {
- S_MAP = " \n\t\r";
- NAME_MAP = "_.0123456789{}[]ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
- String s = Activator.getDefault() != null ? Activator.getDefault().getBundle().getBundleContext().getProperty(PLAIN_SQL_BIND_PROPERTY_NAME) : System.getProperty(PLAIN_SQL_BIND_PROPERTY_NAME);
- if ("true".equalsIgnoreCase(s)) {
- PLAIN_SQL_BIND_ENABLED = Boolean.TRUE;
- }
- else if ("false".equalsIgnoreCase(s)) {
- PLAIN_SQL_BIND_ENABLED = Boolean.FALSE;
- }
- else {
- PLAIN_SQL_BIND_ENABLED = null;
- }
- }
-
- private String m_str;
- private ParsePosition m_pos;
- //
- private ArrayList<IToken> m_tokenList = new ArrayList<IToken>();
- private int m_lastTokenEndIndex;
-
- public BindParser(String sqlStatement) {
- m_str = sqlStatement.trim();
- }
-
- public BindModel parse() {
- m_pos = new ParsePosition(0);
- parseStatement();
- addTextTokenUntil(m_str.length());
- if (m_pos.getIndex() < m_str.length()) {
- LOG.warn("statement not fully parsed (index " + m_pos.getIndex() + "): " + m_str);
- }
- return new BindModel(m_tokenList.toArray(new IToken[m_tokenList.size()]));
- }
-
- private boolean parseStatement() {
- if (LOG.isTraceEnabled()) {
- trace("parseStatement");
- }
- int index = m_pos.getIndex();
- parseWhitespace(0);
- if (parseTokenList()) {
- return true;
- }
- else {
- m_pos.setIndex(index);
- return false;
- }
- }
-
- private boolean parseTokenList() {
- if (LOG.isTraceEnabled()) {
- trace("parseTokenList");
- }
- int index = m_pos.getIndex();
- if (parseToken()) {
- index = m_pos.getIndex();
- parseWhitespace(0);
- while (parseToken()) {
- index = m_pos.getIndex();
- parseWhitespace(0);
- }
- m_pos.setIndex(index);
- return true;
- }
- else {
- m_pos.setIndex(index);
- return false;
- }
- }
-
- private ArrayList<String> parseFunctionArgList() {
- if (LOG.isTraceEnabled()) {
- trace("parseFunctionArgList");
- }
- int index = m_pos.getIndex();
- ArrayList<String> textList = new ArrayList<String>();
- String text;
- if ((text = parseFunctionArg()) != null) {
- textList.add(text);
- index = m_pos.getIndex();
- parseWhitespace(0);
- while (matches(",") && parseWhitespace(0) && (text = parseFunctionArg()) != null) {
- textList.add(text);
- index = m_pos.getIndex();
- parseWhitespace(0);
- }
- m_pos.setIndex(index);
- return textList;
- }
- else {
- m_pos.setIndex(index);
- return textList;
- }
- }
-
- private boolean parseToken() {
- if (LOG.isTraceEnabled()) {
- trace("parseToken");
- }
- if (parseText() != null ||
- parseExtendedBind() != null ||
- parseChar()) {
- return true;
- }
- else {
- return false;
- }
- }
-
- private String parseText() {
- if (LOG.isTraceEnabled()) {
- trace("parseText");
- }
- int index = m_pos.getIndex();
- if (matches("'")) {
- while (parseTextChar()) {
- }
- if (!matches("'")) {
- LOG.warn("expected ' at position " + m_pos.getIndex() + " of " + m_str);
- }
- String text = m_str.substring(index + 1, m_pos.getIndex()).replaceAll("''", "'");
- return text;
- }
- m_pos.setIndex(index);
- return null;
- }
-
- private String parseFunctionArg() {
- if (LOG.isTraceEnabled()) {
- trace("parseFunctionArg");
- }
- int index = m_pos.getIndex();
- String arg;
- if ((arg = parseText()) != null || (arg = parseName()) != null || (arg = parseNumber()) != null) {
- return arg;
- }
- m_pos.setIndex(index);
- return null;
- }
-
- private IToken parseExtendedBind() {
- if (LOG.isTraceEnabled()) {
- trace("parseExtendedBind");
- }
- int index = m_pos.getIndex();
- String attribute = null;
- String op = null;
- IToken token = null;
- if ((attribute = parseAttribute()) != null && parseWhitespace(0) && (op = parseOp()) != null && parseWhitespace(0)) {
- }
- else {
- m_pos.setIndex(index);
- attribute = null;
- op = null;
- if ((op = parseOp()) != null && parseWhitespace(0)) {
- }
- else {
- m_pos.setIndex(index);
- }
- }
- int indexAfterOp = m_pos.getIndex();
- if ((token = parseBind()) != null) {
- if (token instanceof ValueInputToken) {
- addTextTokenUntil(index);
- ((ValueInputToken) token).setParsedAttribute(attribute);
- ((ValueInputToken) token).setParsedOp(op);
- }
- else {
- addTextTokenUntil(indexAfterOp);
- }
- addToken(token, m_pos.getIndex());
- return token;
- }
- else {
- m_pos.setIndex(index);
- return null;
- }
- }
-
- private String parseAttribute() {
- if (LOG.isTraceEnabled()) {
- trace("parseAttribute");
- }
- int index = m_pos.getIndex();
- if (parseOp() == null) {
- return parseName();
- }
- else {
- m_pos.setIndex(index);
- return null;
- }
- }
-
- private String parseOp() {
- if (LOG.isTraceEnabled()) {
- trace("parseOp");
- }
- int index = m_pos.getIndex();
- if (matches("=")) {
- return "=";
- }
- m_pos.setIndex(index);
- if (matches("<>")) {
- return "<>";
- }
- m_pos.setIndex(index);
- if (matches("!=")) {
- return "!=";
- }
- m_pos.setIndex(index);
- if (matches("<=")) {
- return "<=";
- }
- m_pos.setIndex(index);
- if (matches(">=")) {
- return ">=";
- }
- m_pos.setIndex(index);
- if (matches("<")) {
- return "<";
- }
- m_pos.setIndex(index);
- if (matches(">")) {
- return ">";
- }
- m_pos.setIndex(index);
- if (matches("IN") && !peekNameChar()) {
- return "IN";
- }
- m_pos.setIndex(index);
- if (matches("NOT") && parseWhitespace(1) && matches("IN") && !peekNameChar()) {
- return "NOT IN";
- }
- m_pos.setIndex(index);
- if (matches("LIKE") && !peekNameChar()) {
- return "LIKE";
- }
- m_pos.setIndex(index);
- if (matches("NOT") && parseWhitespace(1) && matches("LIKE") && !peekNameChar()) {
- return "NOT LIKE";
- }
- m_pos.setIndex(index);
- return null;
- }
-
- private IToken parseBind() {
- if (LOG.isTraceEnabled()) {
- trace("parseBind");
- }
- IToken token = null;
- int index = m_pos.getIndex();
- if ((token = parsePlainValueBind()) != null ||
- (token = parsePlainSqlBind()) != null ||
- (token = parseFunctionBind()) != null ||
- (token = parseDatabaseSpecificToken()) != null ||
- (token = parseStdBind()) != null) {
- return token;
- }
- else {
- m_pos.setIndex(index);
- return null;
- }
- }
-
- private IToken parsePlainValueBind() {
- if (LOG.isTraceEnabled()) {
- trace("parsePlainValueBind");
- }
- int index = m_pos.getIndex();
- String name;
- if (matches("#") && (name = parseName()) != null && matches("#")) {
- if (name.startsWith("[OUT]")) {
- return new ValueOutputToken(m_str.substring(index, m_pos.getIndex()), name.substring(5), false);
- }
- else {
- return new ValueInputToken(m_str.substring(index, m_pos.getIndex()), name, true, false);
- }
- }
- m_pos.setIndex(index);
- return null;
- }
-
- /**
- * @deprecated will be completely eliminated, potential sql injections
- */
- @Deprecated
- private IToken parsePlainSqlBind() {
- if (LOG.isTraceEnabled()) {
- trace("parsePlainSqlBind");
- }
- int index = m_pos.getIndex();
- String name;
- if (matches("&") && (name = parseName()) != null && matches("&")) {
- if (PLAIN_SQL_BIND_ENABLED == null) {
- LOG.warn("using plain sql bind can cause sql injections: &" + name + "&. Set property " + PLAIN_SQL_BIND_PROPERTY_NAME + "=true when legacy logic is necessarily being used");
- }
- else if (PLAIN_SQL_BIND_ENABLED == Boolean.FALSE) {
- String msg = "using plain sql bind: &" + name + "&. Property " + PLAIN_SQL_BIND_PROPERTY_NAME + " is set to false which causes this error";
- LOG.error(msg);
- throw new IllegalArgumentException(msg);
- }
- //
- if (name.startsWith("[OUT]")) {
- return new ValueOutputToken(m_str.substring(index, m_pos.getIndex()), name.substring(5), false);
- }
- else {
- return new ValueInputToken(m_str.substring(index, m_pos.getIndex()), name, false, true);
- }
- }
- m_pos.setIndex(index);
- return null;
- }
-
- private IToken parseFunctionBind() {
- if (LOG.isTraceEnabled()) {
- trace("parseFunctionBind");
- }
- int index = m_pos.getIndex();
- if (matches("::") || matches("##")) {
- boolean plainValue = m_str.substring(index, index + 2).equals("##");
- String name;
- ArrayList<String> args;
- if ((name = parseName()) != null && parseWhitespace(0) && matches("(") && parseWhitespace(0) && (args = parseFunctionArgList()).size() > 0 && parseWhitespace(0) && matches(")")) {
- return new FunctionInputToken(m_str.substring(index, m_pos.getIndex()), name, args.toArray(new String[0]), plainValue, false);
- }
- }
- m_pos.setIndex(index);
- return null;
- }
-
- private IToken parseDatabaseSpecificToken() {
- if (LOG.isTraceEnabled()) {
- trace("parseDatabaseSpecificToken");
- }
- int index = m_pos.getIndex();
- String name;
- if (matches("$$") && (name = parseName()) != null) {
- return new DatabaseSpecificToken(m_str.substring(index, m_pos.getIndex()), name);
- }
- m_pos.setIndex(index);
- return null;
- }
-
- private IToken parseStdBind() {
- if (LOG.isTraceEnabled()) {
- trace("parseStdBind");
- }
- int index = m_pos.getIndex();
- String name;
- if (matches(":") && (name = parseName()) != null) {
- if (name.startsWith("[OUT]")) {
- return new ValueOutputToken(m_str.substring(index, m_pos.getIndex()), name.substring(5), false);
- }
- else {
- return new ValueInputToken(m_str.substring(index, m_pos.getIndex()), name, false, false);
- }
- }
- m_pos.setIndex(index);
- return null;
- }
-
- private String parseName() {
- if (LOG.isTraceEnabled()) {
- trace("parseName");
- }
- int index = m_pos.getIndex();
- while (parseNameChar()) {
- }
- if (m_pos.getIndex() > index) {
- return m_str.substring(index, m_pos.getIndex());
- }
- else {
- m_pos.setIndex(index);
- return null;
- }
- }
-
- private String parseNumber() {
- if (LOG.isTraceEnabled()) {
- trace("parseNumber");
- }
- int index = m_pos.getIndex();
- while (parseNumberChar()) {
- }
- if (m_pos.getIndex() > index) {
- return m_str.substring(index, m_pos.getIndex());
- }
- else {
- m_pos.setIndex(index);
- return null;
- }
- }
-
- private boolean parseChar() {
- if (LOG.isTraceEnabled()) {
- trace("parseChar");
- }
- int index = m_pos.getIndex();
- if (index < m_str.length()) {
- m_pos.setIndex(index + 1);
- return true;
- }
- return false;
- }
-
- private boolean matches(String m) {
- int index = m_pos.getIndex();
- int len = m.length();
- if (index + len <= m_str.length() && m.equalsIgnoreCase(m_str.substring(index, index + len))) {
- m_pos.setIndex(index + len);
- return true;
- }
- else {
- return false;
- }
- }
-
- private boolean parseTextChar() {
- if (LOG.isTraceEnabled()) {
- trace("parseTextChar");
- }
- int index = m_pos.getIndex();
- int len = m_str.length();
- if (index < len && m_str.charAt(index) != '\'') {
- m_pos.setIndex(index + 1);
- return true;
- }
- else if (index + 1 < len && m_str.charAt(index + 1) == '\'') {
- m_pos.setIndex(index + 2);
- return true;
- }
- else {
- return false;
- }
- }
-
- private boolean parseNumberChar() {
- if (LOG.isTraceEnabled()) {
- trace("parseNumberChar");
- }
- int index = m_pos.getIndex();
- int len = m_str.length();
- if (index < len && Character.isDigit(m_str.charAt(index))) {
- m_pos.setIndex(index + 1);
- return true;
- }
- else {
- return false;
- }
- }
-
- private boolean parseNameChar() {
- if (LOG.isTraceEnabled()) {
- trace("parseNameChar");
- }
- int index = m_pos.getIndex();
- int len = m_str.length();
- if (index < len && NAME_MAP.indexOf(m_str.charAt(index)) >= 0) {
- m_pos.setIndex(index + 1);
- return true;
- }
- else {
- return false;
- }
- }
-
- /**
- * @return true if the next char is a name char, without changing the parse position
- */
- private boolean peekNameChar() {
- if (LOG.isTraceEnabled()) {
- trace("parseNameChar");
- }
- int index = m_pos.getIndex();
- int len = m_str.length();
- if (index < len && NAME_MAP.indexOf(m_str.charAt(index)) >= 0) {
- return true;
- }
- else {
- return false;
- }
- }
-
- private boolean parseWhitespace(int nunRequired) {
- int index = m_pos.getIndex();
- int len = m_str.length();
- int i = index;
- while (i < len && S_MAP.indexOf(m_str.charAt(i)) >= 0) {
- i++;
- }
- if (i - index >= nunRequired) {
- m_pos.setIndex(i);
- return true;
- }
- else {
- return false;
- }
- }
-
- private void trace(String s) {
- int len = m_str.length();
- int i0 = Math.min(m_pos.getIndex(), len - 1);
- int i1 = Math.min(i0 + 32, len);
- LOG.trace("# " + s + " at:" + m_str.substring(i0, i1));
- }
-
- private void addTextTokenUntil(int endIndex) {
- if (endIndex > m_lastTokenEndIndex) {
- m_tokenList.add(new TextToken(m_str.substring(m_lastTokenEndIndex, endIndex)));
- }
- m_lastTokenEndIndex = endIndex;
- }
-
- private void addToken(IToken t, int endIndex) {
- m_tokenList.add(t);
- m_lastTokenEndIndex = endIndex;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.parsers;
+
+import java.text.ParsePosition;
+import java.util.ArrayList;
+
+import org.eclipse.scout.commons.internal.Activator;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.commons.parsers.token.DatabaseSpecificToken;
+import org.eclipse.scout.commons.parsers.token.FunctionInputToken;
+import org.eclipse.scout.commons.parsers.token.IToken;
+import org.eclipse.scout.commons.parsers.token.TextToken;
+import org.eclipse.scout.commons.parsers.token.ValueInputToken;
+import org.eclipse.scout.commons.parsers.token.ValueOutputToken;
+
+/**
+ * Parser for bind variables in arbitrary sql staments
+ * The bind is (possibly) parsed together with its left operator (for better =ANY vs. IN handlings)
+ * <p>
+ * Bind Possibilities are
+ * <ul>
+ * <li>:abc</li>
+ * <li>:[OUT]abc</li>
+ * <li>#abc#</li>
+ * <li>#[OUT]abc#</li>
+ * </ul>
+ * <p>
+ * Syntax (EBNF):
+ * <pre>
+ * statement = S? token-list .
+ * token-list = token (S? token)* .
+ * token = text | extended-bind | char .
+ * extended-bind = (attribute S?)? (op S?)? bind .
+ * attribute = name . //but not op
+ * op = '=' | '<>' | '!=' | '<=' | '>=' | '<' | '>' | 'IN' | 'NOT' S 'IN' .
+ * bind = escaped-value-bind | plain-sql-bind | jdbc-bind .
+ * escaped-value-bind='#' name '#' .
+ * jdbc-bind = ':' name .
+ * function-bind = ( '::' | '##' ) name S? '(' S? function-arg-list? S? ')' .
+ * function-arg-list= function-arg (S? ',' S? function-arg)* .
+ * function-arg = text | name | number.
+ * database-specific-token = '$$' name .
+ * name = name-char+ .
+ * number = name-char+ .
+ * text = `'` text-char* `'` .
+ * name-char = [a-zA-Z0-9_.{}[]] .
+ * number-char = [0-9] .
+ * text-char = [^'] | `''` .
+ * char = [.] .
+ * S = ([ \n\t\r])+ .
+ * </pre>
+ * <p>
+ * The legacy functionality supporting &...& binds - which can lead to sql injection if not carefully used - will be eliminated in future releases.
+ * To avoid unexpected usages, a warning is thrown on every usage. Using the server-side config.ini property <b>org.eclipse.scout.commons.sqlplainbind=true|false</b>
+ * true means activating the legacy functionality (which will be removed in future releases) and false throws an exception when using &...& binds.
+ */
+public class BindParser {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(BindParser.class);
+
+ private static final String PLAIN_SQL_BIND_PROPERTY_NAME = "org.eclipse.scout.commons.sqlplainbind";
+ private static final Boolean PLAIN_SQL_BIND_ENABLED;
+
+ private static final String S_MAP;
+ private static final String NAME_MAP;
+ static {
+ S_MAP = " \n\t\r";
+ NAME_MAP = "_.0123456789{}[]ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
+ String s = Activator.getDefault() != null ? Activator.getDefault().getBundle().getBundleContext().getProperty(PLAIN_SQL_BIND_PROPERTY_NAME) : System.getProperty(PLAIN_SQL_BIND_PROPERTY_NAME);
+ if ("true".equalsIgnoreCase(s)) {
+ PLAIN_SQL_BIND_ENABLED = Boolean.TRUE;
+ }
+ else if ("false".equalsIgnoreCase(s)) {
+ PLAIN_SQL_BIND_ENABLED = Boolean.FALSE;
+ }
+ else {
+ PLAIN_SQL_BIND_ENABLED = null;
+ }
+ }
+
+ private String m_str;
+ private ParsePosition m_pos;
+ //
+ private ArrayList<IToken> m_tokenList = new ArrayList<IToken>();
+ private int m_lastTokenEndIndex;
+
+ public BindParser(String sqlStatement) {
+ m_str = sqlStatement.trim();
+ }
+
+ public BindModel parse() {
+ m_pos = new ParsePosition(0);
+ parseStatement();
+ addTextTokenUntil(m_str.length());
+ if (m_pos.getIndex() < m_str.length()) {
+ LOG.warn("statement not fully parsed (index " + m_pos.getIndex() + "): " + m_str);
+ }
+ return new BindModel(m_tokenList.toArray(new IToken[m_tokenList.size()]));
+ }
+
+ private boolean parseStatement() {
+ if (LOG.isTraceEnabled()) {
+ trace("parseStatement");
+ }
+ int index = m_pos.getIndex();
+ parseWhitespace(0);
+ if (parseTokenList()) {
+ return true;
+ }
+ else {
+ m_pos.setIndex(index);
+ return false;
+ }
+ }
+
+ private boolean parseTokenList() {
+ if (LOG.isTraceEnabled()) {
+ trace("parseTokenList");
+ }
+ int index = m_pos.getIndex();
+ if (parseToken()) {
+ index = m_pos.getIndex();
+ parseWhitespace(0);
+ while (parseToken()) {
+ index = m_pos.getIndex();
+ parseWhitespace(0);
+ }
+ m_pos.setIndex(index);
+ return true;
+ }
+ else {
+ m_pos.setIndex(index);
+ return false;
+ }
+ }
+
+ private ArrayList<String> parseFunctionArgList() {
+ if (LOG.isTraceEnabled()) {
+ trace("parseFunctionArgList");
+ }
+ int index = m_pos.getIndex();
+ ArrayList<String> textList = new ArrayList<String>();
+ String text;
+ if ((text = parseFunctionArg()) != null) {
+ textList.add(text);
+ index = m_pos.getIndex();
+ parseWhitespace(0);
+ while (matches(",") && parseWhitespace(0) && (text = parseFunctionArg()) != null) {
+ textList.add(text);
+ index = m_pos.getIndex();
+ parseWhitespace(0);
+ }
+ m_pos.setIndex(index);
+ return textList;
+ }
+ else {
+ m_pos.setIndex(index);
+ return textList;
+ }
+ }
+
+ private boolean parseToken() {
+ if (LOG.isTraceEnabled()) {
+ trace("parseToken");
+ }
+ if (parseText() != null ||
+ parseExtendedBind() != null ||
+ parseChar()) {
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+
+ private String parseText() {
+ if (LOG.isTraceEnabled()) {
+ trace("parseText");
+ }
+ int index = m_pos.getIndex();
+ if (matches("'")) {
+ while (parseTextChar()) {
+ }
+ if (!matches("'")) {
+ LOG.warn("expected ' at position " + m_pos.getIndex() + " of " + m_str);
+ }
+ String text = m_str.substring(index + 1, m_pos.getIndex()).replaceAll("''", "'");
+ return text;
+ }
+ m_pos.setIndex(index);
+ return null;
+ }
+
+ private String parseFunctionArg() {
+ if (LOG.isTraceEnabled()) {
+ trace("parseFunctionArg");
+ }
+ int index = m_pos.getIndex();
+ String arg;
+ if ((arg = parseText()) != null || (arg = parseName()) != null || (arg = parseNumber()) != null) {
+ return arg;
+ }
+ m_pos.setIndex(index);
+ return null;
+ }
+
+ private IToken parseExtendedBind() {
+ if (LOG.isTraceEnabled()) {
+ trace("parseExtendedBind");
+ }
+ int index = m_pos.getIndex();
+ String attribute = null;
+ String op = null;
+ IToken token = null;
+ if ((attribute = parseAttribute()) != null && parseWhitespace(0) && (op = parseOp()) != null && parseWhitespace(0)) {
+ }
+ else {
+ m_pos.setIndex(index);
+ attribute = null;
+ op = null;
+ if ((op = parseOp()) != null && parseWhitespace(0)) {
+ }
+ else {
+ m_pos.setIndex(index);
+ }
+ }
+ int indexAfterOp = m_pos.getIndex();
+ if ((token = parseBind()) != null) {
+ if (token instanceof ValueInputToken) {
+ addTextTokenUntil(index);
+ ((ValueInputToken) token).setParsedAttribute(attribute);
+ ((ValueInputToken) token).setParsedOp(op);
+ }
+ else {
+ addTextTokenUntil(indexAfterOp);
+ }
+ addToken(token, m_pos.getIndex());
+ return token;
+ }
+ else {
+ m_pos.setIndex(index);
+ return null;
+ }
+ }
+
+ private String parseAttribute() {
+ if (LOG.isTraceEnabled()) {
+ trace("parseAttribute");
+ }
+ int index = m_pos.getIndex();
+ if (parseOp() == null) {
+ return parseName();
+ }
+ else {
+ m_pos.setIndex(index);
+ return null;
+ }
+ }
+
+ private String parseOp() {
+ if (LOG.isTraceEnabled()) {
+ trace("parseOp");
+ }
+ int index = m_pos.getIndex();
+ if (matches("=")) {
+ return "=";
+ }
+ m_pos.setIndex(index);
+ if (matches("<>")) {
+ return "<>";
+ }
+ m_pos.setIndex(index);
+ if (matches("!=")) {
+ return "!=";
+ }
+ m_pos.setIndex(index);
+ if (matches("<=")) {
+ return "<=";
+ }
+ m_pos.setIndex(index);
+ if (matches(">=")) {
+ return ">=";
+ }
+ m_pos.setIndex(index);
+ if (matches("<")) {
+ return "<";
+ }
+ m_pos.setIndex(index);
+ if (matches(">")) {
+ return ">";
+ }
+ m_pos.setIndex(index);
+ if (matches("IN") && !peekNameChar()) {
+ return "IN";
+ }
+ m_pos.setIndex(index);
+ if (matches("NOT") && parseWhitespace(1) && matches("IN") && !peekNameChar()) {
+ return "NOT IN";
+ }
+ m_pos.setIndex(index);
+ if (matches("LIKE") && !peekNameChar()) {
+ return "LIKE";
+ }
+ m_pos.setIndex(index);
+ if (matches("NOT") && parseWhitespace(1) && matches("LIKE") && !peekNameChar()) {
+ return "NOT LIKE";
+ }
+ m_pos.setIndex(index);
+ return null;
+ }
+
+ private IToken parseBind() {
+ if (LOG.isTraceEnabled()) {
+ trace("parseBind");
+ }
+ IToken token = null;
+ int index = m_pos.getIndex();
+ if ((token = parsePlainValueBind()) != null ||
+ (token = parsePlainSqlBind()) != null ||
+ (token = parseFunctionBind()) != null ||
+ (token = parseDatabaseSpecificToken()) != null ||
+ (token = parseStdBind()) != null) {
+ return token;
+ }
+ else {
+ m_pos.setIndex(index);
+ return null;
+ }
+ }
+
+ private IToken parsePlainValueBind() {
+ if (LOG.isTraceEnabled()) {
+ trace("parsePlainValueBind");
+ }
+ int index = m_pos.getIndex();
+ String name;
+ if (matches("#") && (name = parseName()) != null && matches("#")) {
+ if (name.startsWith("[OUT]")) {
+ return new ValueOutputToken(m_str.substring(index, m_pos.getIndex()), name.substring(5), false);
+ }
+ else {
+ return new ValueInputToken(m_str.substring(index, m_pos.getIndex()), name, true, false);
+ }
+ }
+ m_pos.setIndex(index);
+ return null;
+ }
+
+ /**
+ * @deprecated will be completely eliminated, potential sql injections
+ */
+ @Deprecated
+ private IToken parsePlainSqlBind() {
+ if (LOG.isTraceEnabled()) {
+ trace("parsePlainSqlBind");
+ }
+ int index = m_pos.getIndex();
+ String name;
+ if (matches("&") && (name = parseName()) != null && matches("&")) {
+ if (PLAIN_SQL_BIND_ENABLED == null) {
+ LOG.warn("using plain sql bind can cause sql injections: &" + name + "&. Set property " + PLAIN_SQL_BIND_PROPERTY_NAME + "=true when legacy logic is necessarily being used");
+ }
+ else if (PLAIN_SQL_BIND_ENABLED == Boolean.FALSE) {
+ String msg = "using plain sql bind: &" + name + "&. Property " + PLAIN_SQL_BIND_PROPERTY_NAME + " is set to false which causes this error";
+ LOG.error(msg);
+ throw new IllegalArgumentException(msg);
+ }
+ //
+ if (name.startsWith("[OUT]")) {
+ return new ValueOutputToken(m_str.substring(index, m_pos.getIndex()), name.substring(5), false);
+ }
+ else {
+ return new ValueInputToken(m_str.substring(index, m_pos.getIndex()), name, false, true);
+ }
+ }
+ m_pos.setIndex(index);
+ return null;
+ }
+
+ private IToken parseFunctionBind() {
+ if (LOG.isTraceEnabled()) {
+ trace("parseFunctionBind");
+ }
+ int index = m_pos.getIndex();
+ if (matches("::") || matches("##")) {
+ boolean plainValue = m_str.substring(index, index + 2).equals("##");
+ String name;
+ ArrayList<String> args;
+ if ((name = parseName()) != null && parseWhitespace(0) && matches("(") && parseWhitespace(0) && (args = parseFunctionArgList()).size() > 0 && parseWhitespace(0) && matches(")")) {
+ return new FunctionInputToken(m_str.substring(index, m_pos.getIndex()), name, args.toArray(new String[0]), plainValue, false);
+ }
+ }
+ m_pos.setIndex(index);
+ return null;
+ }
+
+ private IToken parseDatabaseSpecificToken() {
+ if (LOG.isTraceEnabled()) {
+ trace("parseDatabaseSpecificToken");
+ }
+ int index = m_pos.getIndex();
+ String name;
+ if (matches("$$") && (name = parseName()) != null) {
+ return new DatabaseSpecificToken(m_str.substring(index, m_pos.getIndex()), name);
+ }
+ m_pos.setIndex(index);
+ return null;
+ }
+
+ private IToken parseStdBind() {
+ if (LOG.isTraceEnabled()) {
+ trace("parseStdBind");
+ }
+ int index = m_pos.getIndex();
+ String name;
+ if (matches(":") && (name = parseName()) != null) {
+ if (name.startsWith("[OUT]")) {
+ return new ValueOutputToken(m_str.substring(index, m_pos.getIndex()), name.substring(5), false);
+ }
+ else {
+ return new ValueInputToken(m_str.substring(index, m_pos.getIndex()), name, false, false);
+ }
+ }
+ m_pos.setIndex(index);
+ return null;
+ }
+
+ private String parseName() {
+ if (LOG.isTraceEnabled()) {
+ trace("parseName");
+ }
+ int index = m_pos.getIndex();
+ while (parseNameChar()) {
+ }
+ if (m_pos.getIndex() > index) {
+ return m_str.substring(index, m_pos.getIndex());
+ }
+ else {
+ m_pos.setIndex(index);
+ return null;
+ }
+ }
+
+ private String parseNumber() {
+ if (LOG.isTraceEnabled()) {
+ trace("parseNumber");
+ }
+ int index = m_pos.getIndex();
+ while (parseNumberChar()) {
+ }
+ if (m_pos.getIndex() > index) {
+ return m_str.substring(index, m_pos.getIndex());
+ }
+ else {
+ m_pos.setIndex(index);
+ return null;
+ }
+ }
+
+ private boolean parseChar() {
+ if (LOG.isTraceEnabled()) {
+ trace("parseChar");
+ }
+ int index = m_pos.getIndex();
+ if (index < m_str.length()) {
+ m_pos.setIndex(index + 1);
+ return true;
+ }
+ return false;
+ }
+
+ private boolean matches(String m) {
+ int index = m_pos.getIndex();
+ int len = m.length();
+ if (index + len <= m_str.length() && m.equalsIgnoreCase(m_str.substring(index, index + len))) {
+ m_pos.setIndex(index + len);
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+
+ private boolean parseTextChar() {
+ if (LOG.isTraceEnabled()) {
+ trace("parseTextChar");
+ }
+ int index = m_pos.getIndex();
+ int len = m_str.length();
+ if (index < len && m_str.charAt(index) != '\'') {
+ m_pos.setIndex(index + 1);
+ return true;
+ }
+ else if (index + 1 < len && m_str.charAt(index + 1) == '\'') {
+ m_pos.setIndex(index + 2);
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+
+ private boolean parseNumberChar() {
+ if (LOG.isTraceEnabled()) {
+ trace("parseNumberChar");
+ }
+ int index = m_pos.getIndex();
+ int len = m_str.length();
+ if (index < len && Character.isDigit(m_str.charAt(index))) {
+ m_pos.setIndex(index + 1);
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+
+ private boolean parseNameChar() {
+ if (LOG.isTraceEnabled()) {
+ trace("parseNameChar");
+ }
+ int index = m_pos.getIndex();
+ int len = m_str.length();
+ if (index < len && NAME_MAP.indexOf(m_str.charAt(index)) >= 0) {
+ m_pos.setIndex(index + 1);
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+
+ /**
+ * @return true if the next char is a name char, without changing the parse position
+ */
+ private boolean peekNameChar() {
+ if (LOG.isTraceEnabled()) {
+ trace("parseNameChar");
+ }
+ int index = m_pos.getIndex();
+ int len = m_str.length();
+ if (index < len && NAME_MAP.indexOf(m_str.charAt(index)) >= 0) {
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+
+ private boolean parseWhitespace(int nunRequired) {
+ int index = m_pos.getIndex();
+ int len = m_str.length();
+ int i = index;
+ while (i < len && S_MAP.indexOf(m_str.charAt(i)) >= 0) {
+ i++;
+ }
+ if (i - index >= nunRequired) {
+ m_pos.setIndex(i);
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+
+ private void trace(String s) {
+ int len = m_str.length();
+ int i0 = Math.min(m_pos.getIndex(), len - 1);
+ int i1 = Math.min(i0 + 32, len);
+ LOG.trace("# " + s + " at:" + m_str.substring(i0, i1));
+ }
+
+ private void addTextTokenUntil(int endIndex) {
+ if (endIndex > m_lastTokenEndIndex) {
+ m_tokenList.add(new TextToken(m_str.substring(m_lastTokenEndIndex, endIndex)));
+ }
+ m_lastTokenEndIndex = endIndex;
+ }
+
+ private void addToken(IToken t, int endIndex) {
+ m_tokenList.add(t);
+ m_lastTokenEndIndex = endIndex;
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/IntoModel.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/IntoModel.java
index 0bce489906..3c6e17c1d6 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/IntoModel.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/IntoModel.java
@@ -1,31 +1,31 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.parsers;
-
-import org.eclipse.scout.commons.parsers.token.ValueOutputToken;
-
-public class IntoModel {
- String m_filteredStatement;
- private ValueOutputToken[] m_intoTokens;
-
- public IntoModel(String filteredStatement, ValueOutputToken[] intoTokens) {
- m_filteredStatement = filteredStatement;
- m_intoTokens = intoTokens;
- }
-
- public ValueOutputToken[] getOutputTokens() {
- return m_intoTokens;
- }
-
- public String getFilteredStatement() {
- return m_filteredStatement;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.parsers;
+
+import org.eclipse.scout.commons.parsers.token.ValueOutputToken;
+
+public class IntoModel {
+ String m_filteredStatement;
+ private ValueOutputToken[] m_intoTokens;
+
+ public IntoModel(String filteredStatement, ValueOutputToken[] intoTokens) {
+ m_filteredStatement = filteredStatement;
+ m_intoTokens = intoTokens;
+ }
+
+ public ValueOutputToken[] getOutputTokens() {
+ return m_intoTokens;
+ }
+
+ public String getFilteredStatement() {
+ return m_filteredStatement;
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/IntoParser.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/IntoParser.java
index 135a15ee65..fcc536af39 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/IntoParser.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/IntoParser.java
@@ -1,341 +1,341 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.parsers;
-
-import java.text.ParsePosition;
-import java.util.ArrayList;
-
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.commons.parsers.token.ValueOutputToken;
-
-/**
- * Parser for into variables in arbitrary sql text Syntax (EBNF):
- *
- * <pre>
- * statement = S? * token-list .
- * token-list = token (S? token)* .
- * token = text | into | char .
- * text = `'` text-char* `'` .
- * text-char = [^'] | `''` .
- * into = 'into' S bind-list .
- * bind-list = bind (S? ',' S? bind)* .
- * bind = hash-bind | plain-bind | std-bind .
- * hash-bind = `#` name `#` .
- * plain-bind = `&` name `&` .
- * std-bind = `:` name .
- * name = name-char+ .
- * name-char = [a-zA-Z0-9_.{}] .
- * char = . .
- * S = ([ \n\t\r])+ .
- * </pre>
- */
-public class IntoParser {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(IntoParser.class);
-
- private static final String S_MAP;
- private static final String NAME_MAP;
- static {
- S_MAP = " \n\t\r";
- NAME_MAP = "_.0123456789{}ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
- }
-
- private String m_str;
- private ParsePosition m_pos;
- //
- private ArrayList<ValueOutputToken> m_intoList = new ArrayList<ValueOutputToken>();
- private StringBuffer m_filteredText = new StringBuffer();
- private int m_lastTextIndex;
-
- public IntoParser(String sqlStatement) {
- m_str = sqlStatement.trim();
- }
-
- public IntoModel parse() {
- m_pos = new ParsePosition(0);
- parseStatement();
- addTextUntil(m_str.length());
- if (m_pos.getIndex() < m_str.length()) {
- LOG.warn("statement not fully parsed (index " + m_pos.getIndex() + "): " + m_str);
- }
- return new IntoModel(m_filteredText.toString(), m_intoList.toArray(new ValueOutputToken[0]));
- }
-
- private boolean parseStatement() {
- if (LOG.isTraceEnabled()) {
- trace("parseStatement");
- }
- int index = m_pos.getIndex();
- parseWhitespace(0);
- if (parseTokenList()) {
- return true;
- }
- else {
- m_pos.setIndex(index);
- return false;
- }
- }
-
- private boolean parseTokenList() {
- if (LOG.isTraceEnabled()) {
- trace("parseTokenList");
- }
- int index = m_pos.getIndex();
- if (parseToken()) {
- index = m_pos.getIndex();
- parseWhitespace(0);
- while (parseToken()) {
- index = m_pos.getIndex();
- parseWhitespace(0);
- }
- m_pos.setIndex(index);
- return true;
- }
- else {
- m_pos.setIndex(index);
- return false;
- }
- }
-
- private boolean parseToken() {
- if (LOG.isTraceEnabled()) {
- trace("parseToken");
- }
- if (parseText() ||
- parseInto() ||
- parseChar()) {
- return true;
- }
- else {
- return false;
- }
- }
-
- private boolean parseText() {
- if (LOG.isTraceEnabled()) {
- trace("parseText");
- }
- int index = m_pos.getIndex();
- if (matches("'")) {
- while (parseTextChar()) {
- }
- if (!matches("'")) {
- LOG.warn("expected ' at position " + m_pos.getIndex() + " of " + m_str);
- }
- return true;
- }
- m_pos.setIndex(index);
- return false;
- }
-
- private boolean parseInto() {
- if (LOG.isTraceEnabled()) {
- trace("parseInto");
- }
- int index = m_pos.getIndex();
- if (matches("into") && parseWhitespace(1) && parseBindList()) {
- addTextUntil(index);
- ignoreTextUntil(m_pos.getIndex());
- return true;
- }
- else {
- m_pos.setIndex(index);
- return false;
- }
- }
-
- private boolean parseBindList() {
- if (LOG.isTraceEnabled()) {
- trace("parseBindList");
- }
- int index = m_pos.getIndex();
- if (parseBind()) {
- index = m_pos.getIndex();
- while (parseWhitespace(0) && matches(",") && parseWhitespace(0) && parseBind()) {
- index = m_pos.getIndex();
- }
- m_pos.setIndex(index);
- return true;
- }
- else {
- m_pos.setIndex(index);
- return false;
- }
- }
-
- private boolean parseBind() {
- if (LOG.isTraceEnabled()) {
- trace("parseBind");
- }
- int index = m_pos.getIndex();
- if (parseHashBind() ||
- parsePlainBind() ||
- parseStdBind()) {
- return true;
- }
- else {
- m_pos.setIndex(index);
- return false;
- }
- }
-
- private boolean parseHashBind() {
- if (LOG.isTraceEnabled()) {
- trace("parseHashBind");
- }
- int index = m_pos.getIndex();
- if (matches("#") && parseName() && matches("#")) {
- addIntoToken(new ValueOutputToken(m_str.substring(index, m_pos.getIndex()), m_str.substring(index + 1, m_pos.getIndex() - 1), true));
- return true;
- }
- m_pos.setIndex(index);
- return false;
- }
-
- private boolean parsePlainBind() {
- if (LOG.isTraceEnabled()) {
- trace("parsePlainBind");
- }
- int index = m_pos.getIndex();
- if (matches("&") && parseName() && matches("&")) {
- addIntoToken(new ValueOutputToken(m_str.substring(index, m_pos.getIndex()), m_str.substring(index + 1, m_pos.getIndex() - 1), true));
- return true;
- }
- m_pos.setIndex(index);
- return false;
- }
-
- private boolean parseStdBind() {
- if (LOG.isTraceEnabled()) {
- trace("parseStdBind");
- }
- int index = m_pos.getIndex();
- if (matches(":") && parseName()) {
- addIntoToken(new ValueOutputToken(m_str.substring(index, m_pos.getIndex()), m_str.substring(index + 1, m_pos.getIndex()), true));
- return true;
- }
- m_pos.setIndex(index);
- return false;
- }
-
- private boolean parseName() {
- if (LOG.isTraceEnabled()) {
- trace("parseName");
- }
- int index = m_pos.getIndex();
- while (parseNameChar()) {
- }
- if (m_pos.getIndex() > index) {
- return true;
- }
- else {
- m_pos.setIndex(index);
- return false;
- }
- }
-
- private boolean parseChar() {
- if (LOG.isTraceEnabled()) {
- trace("parseChar");
- }
- int index = m_pos.getIndex();
- if (index < m_str.length()) {
- m_pos.setIndex(index + 1);
- return true;
- }
- return false;
- }
-
- private boolean matches(String m) {
- int index = m_pos.getIndex();
- int len = m.length();
- if (index + len <= m_str.length() && m.equalsIgnoreCase(m_str.substring(index, index + len))) {
- m_pos.setIndex(index + len);
- return true;
- }
- else {
- return false;
- }
- }
-
- private boolean parseTextChar() {
- if (LOG.isTraceEnabled()) {
- trace("parseTextChar");
- }
- int index = m_pos.getIndex();
- int len = m_str.length();
- if (index < len && m_str.charAt(index) != '\'') {
- m_pos.setIndex(index + 1);
- return true;
- }
- else if (index + 1 < len && m_str.charAt(index + 1) == '\'') {
- m_pos.setIndex(index + 2);
- return true;
- }
- else {
- return false;
- }
- }
-
- private boolean parseNameChar() {
- if (LOG.isTraceEnabled()) {
- trace("parseNameChar");
- }
- int index = m_pos.getIndex();
- int len = m_str.length();
- if (index < len && NAME_MAP.indexOf(m_str.charAt(index)) >= 0) {
- m_pos.setIndex(index + 1);
- return true;
- }
- else {
- return false;
- }
- }
-
- private boolean parseWhitespace(int nunRequired) {
- int index = m_pos.getIndex();
- int len = m_str.length();
- int i = index;
- while (i < len && S_MAP.indexOf(m_str.charAt(i)) >= 0) {
- i++;
- }
- if (i - index >= nunRequired) {
- m_pos.setIndex(i);
- return true;
- }
- else {
- return false;
- }
- }
-
- private void trace(String s) {
- int len = m_str.length();
- int i0 = Math.min(m_pos.getIndex(), len - 1);
- int i1 = Math.min(i0 + 32, len);
- LOG.trace("# " + s + " at:" + m_str.substring(i0, i1));
- }
-
- private void addTextUntil(int endIndex) {
- if (endIndex > m_lastTextIndex) {
- m_filteredText.append(m_str.substring(m_lastTextIndex, endIndex));
- }
- m_lastTextIndex = endIndex;
- }
-
- private void ignoreTextUntil(int endIndex) {
- m_lastTextIndex = endIndex;
- }
-
- private void addIntoToken(ValueOutputToken t) {
- m_intoList.add(t);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.parsers;
+
+import java.text.ParsePosition;
+import java.util.ArrayList;
+
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.commons.parsers.token.ValueOutputToken;
+
+/**
+ * Parser for into variables in arbitrary sql text Syntax (EBNF):
+ *
+ * <pre>
+ * statement = S? * token-list .
+ * token-list = token (S? token)* .
+ * token = text | into | char .
+ * text = `'` text-char* `'` .
+ * text-char = [^'] | `''` .
+ * into = 'into' S bind-list .
+ * bind-list = bind (S? ',' S? bind)* .
+ * bind = hash-bind | plain-bind | std-bind .
+ * hash-bind = `#` name `#` .
+ * plain-bind = `&` name `&` .
+ * std-bind = `:` name .
+ * name = name-char+ .
+ * name-char = [a-zA-Z0-9_.{}] .
+ * char = . .
+ * S = ([ \n\t\r])+ .
+ * </pre>
+ */
+public class IntoParser {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(IntoParser.class);
+
+ private static final String S_MAP;
+ private static final String NAME_MAP;
+ static {
+ S_MAP = " \n\t\r";
+ NAME_MAP = "_.0123456789{}ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
+ }
+
+ private String m_str;
+ private ParsePosition m_pos;
+ //
+ private ArrayList<ValueOutputToken> m_intoList = new ArrayList<ValueOutputToken>();
+ private StringBuffer m_filteredText = new StringBuffer();
+ private int m_lastTextIndex;
+
+ public IntoParser(String sqlStatement) {
+ m_str = sqlStatement.trim();
+ }
+
+ public IntoModel parse() {
+ m_pos = new ParsePosition(0);
+ parseStatement();
+ addTextUntil(m_str.length());
+ if (m_pos.getIndex() < m_str.length()) {
+ LOG.warn("statement not fully parsed (index " + m_pos.getIndex() + "): " + m_str);
+ }
+ return new IntoModel(m_filteredText.toString(), m_intoList.toArray(new ValueOutputToken[0]));
+ }
+
+ private boolean parseStatement() {
+ if (LOG.isTraceEnabled()) {
+ trace("parseStatement");
+ }
+ int index = m_pos.getIndex();
+ parseWhitespace(0);
+ if (parseTokenList()) {
+ return true;
+ }
+ else {
+ m_pos.setIndex(index);
+ return false;
+ }
+ }
+
+ private boolean parseTokenList() {
+ if (LOG.isTraceEnabled()) {
+ trace("parseTokenList");
+ }
+ int index = m_pos.getIndex();
+ if (parseToken()) {
+ index = m_pos.getIndex();
+ parseWhitespace(0);
+ while (parseToken()) {
+ index = m_pos.getIndex();
+ parseWhitespace(0);
+ }
+ m_pos.setIndex(index);
+ return true;
+ }
+ else {
+ m_pos.setIndex(index);
+ return false;
+ }
+ }
+
+ private boolean parseToken() {
+ if (LOG.isTraceEnabled()) {
+ trace("parseToken");
+ }
+ if (parseText() ||
+ parseInto() ||
+ parseChar()) {
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+
+ private boolean parseText() {
+ if (LOG.isTraceEnabled()) {
+ trace("parseText");
+ }
+ int index = m_pos.getIndex();
+ if (matches("'")) {
+ while (parseTextChar()) {
+ }
+ if (!matches("'")) {
+ LOG.warn("expected ' at position " + m_pos.getIndex() + " of " + m_str);
+ }
+ return true;
+ }
+ m_pos.setIndex(index);
+ return false;
+ }
+
+ private boolean parseInto() {
+ if (LOG.isTraceEnabled()) {
+ trace("parseInto");
+ }
+ int index = m_pos.getIndex();
+ if (matches("into") && parseWhitespace(1) && parseBindList()) {
+ addTextUntil(index);
+ ignoreTextUntil(m_pos.getIndex());
+ return true;
+ }
+ else {
+ m_pos.setIndex(index);
+ return false;
+ }
+ }
+
+ private boolean parseBindList() {
+ if (LOG.isTraceEnabled()) {
+ trace("parseBindList");
+ }
+ int index = m_pos.getIndex();
+ if (parseBind()) {
+ index = m_pos.getIndex();
+ while (parseWhitespace(0) && matches(",") && parseWhitespace(0) && parseBind()) {
+ index = m_pos.getIndex();
+ }
+ m_pos.setIndex(index);
+ return true;
+ }
+ else {
+ m_pos.setIndex(index);
+ return false;
+ }
+ }
+
+ private boolean parseBind() {
+ if (LOG.isTraceEnabled()) {
+ trace("parseBind");
+ }
+ int index = m_pos.getIndex();
+ if (parseHashBind() ||
+ parsePlainBind() ||
+ parseStdBind()) {
+ return true;
+ }
+ else {
+ m_pos.setIndex(index);
+ return false;
+ }
+ }
+
+ private boolean parseHashBind() {
+ if (LOG.isTraceEnabled()) {
+ trace("parseHashBind");
+ }
+ int index = m_pos.getIndex();
+ if (matches("#") && parseName() && matches("#")) {
+ addIntoToken(new ValueOutputToken(m_str.substring(index, m_pos.getIndex()), m_str.substring(index + 1, m_pos.getIndex() - 1), true));
+ return true;
+ }
+ m_pos.setIndex(index);
+ return false;
+ }
+
+ private boolean parsePlainBind() {
+ if (LOG.isTraceEnabled()) {
+ trace("parsePlainBind");
+ }
+ int index = m_pos.getIndex();
+ if (matches("&") && parseName() && matches("&")) {
+ addIntoToken(new ValueOutputToken(m_str.substring(index, m_pos.getIndex()), m_str.substring(index + 1, m_pos.getIndex() - 1), true));
+ return true;
+ }
+ m_pos.setIndex(index);
+ return false;
+ }
+
+ private boolean parseStdBind() {
+ if (LOG.isTraceEnabled()) {
+ trace("parseStdBind");
+ }
+ int index = m_pos.getIndex();
+ if (matches(":") && parseName()) {
+ addIntoToken(new ValueOutputToken(m_str.substring(index, m_pos.getIndex()), m_str.substring(index + 1, m_pos.getIndex()), true));
+ return true;
+ }
+ m_pos.setIndex(index);
+ return false;
+ }
+
+ private boolean parseName() {
+ if (LOG.isTraceEnabled()) {
+ trace("parseName");
+ }
+ int index = m_pos.getIndex();
+ while (parseNameChar()) {
+ }
+ if (m_pos.getIndex() > index) {
+ return true;
+ }
+ else {
+ m_pos.setIndex(index);
+ return false;
+ }
+ }
+
+ private boolean parseChar() {
+ if (LOG.isTraceEnabled()) {
+ trace("parseChar");
+ }
+ int index = m_pos.getIndex();
+ if (index < m_str.length()) {
+ m_pos.setIndex(index + 1);
+ return true;
+ }
+ return false;
+ }
+
+ private boolean matches(String m) {
+ int index = m_pos.getIndex();
+ int len = m.length();
+ if (index + len <= m_str.length() && m.equalsIgnoreCase(m_str.substring(index, index + len))) {
+ m_pos.setIndex(index + len);
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+
+ private boolean parseTextChar() {
+ if (LOG.isTraceEnabled()) {
+ trace("parseTextChar");
+ }
+ int index = m_pos.getIndex();
+ int len = m_str.length();
+ if (index < len && m_str.charAt(index) != '\'') {
+ m_pos.setIndex(index + 1);
+ return true;
+ }
+ else if (index + 1 < len && m_str.charAt(index + 1) == '\'') {
+ m_pos.setIndex(index + 2);
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+
+ private boolean parseNameChar() {
+ if (LOG.isTraceEnabled()) {
+ trace("parseNameChar");
+ }
+ int index = m_pos.getIndex();
+ int len = m_str.length();
+ if (index < len && NAME_MAP.indexOf(m_str.charAt(index)) >= 0) {
+ m_pos.setIndex(index + 1);
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+
+ private boolean parseWhitespace(int nunRequired) {
+ int index = m_pos.getIndex();
+ int len = m_str.length();
+ int i = index;
+ while (i < len && S_MAP.indexOf(m_str.charAt(i)) >= 0) {
+ i++;
+ }
+ if (i - index >= nunRequired) {
+ m_pos.setIndex(i);
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+
+ private void trace(String s) {
+ int len = m_str.length();
+ int i0 = Math.min(m_pos.getIndex(), len - 1);
+ int i1 = Math.min(i0 + 32, len);
+ LOG.trace("# " + s + " at:" + m_str.substring(i0, i1));
+ }
+
+ private void addTextUntil(int endIndex) {
+ if (endIndex > m_lastTextIndex) {
+ m_filteredText.append(m_str.substring(m_lastTextIndex, endIndex));
+ }
+ m_lastTextIndex = endIndex;
+ }
+
+ private void ignoreTextUntil(int endIndex) {
+ m_lastTextIndex = endIndex;
+ }
+
+ private void addIntoToken(ValueOutputToken t) {
+ m_intoList.add(t);
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/sql/SqlFormatter.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/sql/SqlFormatter.java
index 2a26c3e62f..293293f048 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/sql/SqlFormatter.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/sql/SqlFormatter.java
@@ -1,411 +1,411 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.parsers.sql;
-
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.commons.parsers.sql.SqlParserToken.AndExpr;
-import org.eclipse.scout.commons.parsers.sql.SqlParserToken.AndOp;
-import org.eclipse.scout.commons.parsers.sql.SqlParserToken.Atom;
-import org.eclipse.scout.commons.parsers.sql.SqlParserToken.BracketExpr;
-import org.eclipse.scout.commons.parsers.sql.SqlParserToken.CloseBracketToken;
-import org.eclipse.scout.commons.parsers.sql.SqlParserToken.Comment;
-import org.eclipse.scout.commons.parsers.sql.SqlParserToken.FunExpr;
-import org.eclipse.scout.commons.parsers.sql.SqlParserToken.IToken;
-import org.eclipse.scout.commons.parsers.sql.SqlParserToken.ListExpr;
-import org.eclipse.scout.commons.parsers.sql.SqlParserToken.ListSeparator;
-import org.eclipse.scout.commons.parsers.sql.SqlParserToken.MathExpr;
-import org.eclipse.scout.commons.parsers.sql.SqlParserToken.MathOp;
-import org.eclipse.scout.commons.parsers.sql.SqlParserToken.MinusExpr;
-import org.eclipse.scout.commons.parsers.sql.SqlParserToken.Name;
-import org.eclipse.scout.commons.parsers.sql.SqlParserToken.OpenBracketToken;
-import org.eclipse.scout.commons.parsers.sql.SqlParserToken.OrExpr;
-import org.eclipse.scout.commons.parsers.sql.SqlParserToken.OrOp;
-import org.eclipse.scout.commons.parsers.sql.SqlParserToken.Part;
-import org.eclipse.scout.commons.parsers.sql.SqlParserToken.PartToken;
-import org.eclipse.scout.commons.parsers.sql.SqlParserToken.SingleStatement;
-import org.eclipse.scout.commons.parsers.sql.SqlParserToken.Statement;
-import org.eclipse.scout.commons.parsers.sql.SqlParserToken.UnaryPrefix;
-import org.eclipse.scout.commons.parsers.sql.SqlParserToken.UnaryPrefixExpr;
-import org.eclipse.scout.commons.parsers.sql.SqlParserToken.UnionToken;
-import org.eclipse.scout.commons.parsers.sql.SqlParserToken.Unparsed;
-
-/**
- * see {@link SqlParser}
- *
- * <pre>
- * <code>
- * Statement = SingleStatement (UnionToken SingleStatement)* (Unparsed)?
- * SingleStatement = Part+
- * Part = PartToken ListExpr
- * ListExpr = OrExpr (ListSeparator OrExpr)*
- * OrExpr = AndExpr (BinaryOp['OR'] AndExpr)*
- * AndExpr = MathExpr (BinaryOp['AND'] MathExpr)*
- * MathExpr = _simpleExpr (BinaryOp _simpleExpr)*
- * _simpleExpr = UnaryPrefixExpr | MinusExpr | Atom
- * UnaryPrefixExpr = UnaryPrefix Atom
- * MinusExpr = BinaryOp['-'] Atom
- * Atom= (BracketExpr | Statement | OrExpr | FunExpr | Name | Text | BinaryOp['*']) (OuterJoinToken)? (Name["AS"])? (Name[alias])?
- * BracketExpr = OpenBracketToken (Statement | ListExpr) CloseBracketToken
- * FunExpr = Name BracketExpr
- * </code>
- * </pre>
- */
-public class SqlFormatter {
- private static IScoutLogger logger = ScoutLogManager.getLogger(SqlFormatter.class);
-
- private static class FormatContext {
- private int m_tabSize;
- private int m_indent;
- private int m_linePos;
- private StringBuilder m_buf;
-
- public FormatContext(int tabSize) {
- m_tabSize = tabSize;
- m_buf = new StringBuilder();
- }
-
- public void in() {
- m_indent += m_tabSize;
- if (m_linePos >= m_indent) {
- print(" ");
- }
- }
-
- public void out() {
- m_indent -= m_tabSize;
- if (m_linePos > m_indent) {
- println();
- }
- }
-
- public void println() {
- print("\n");
- }
-
- public void println(String s) {
- print(s);
- print("\n");
- }
-
- public void print(String s) {
- for (char ch : s.toCharArray()) {
- if (ch == '\n') {
- m_buf.append('\n');
- m_linePos = 0;
- }
- else {
- //check indentation
- while (m_linePos < m_indent) {
- m_buf.append(' ');
- m_linePos++;
- }
- m_buf.append(ch);
- m_linePos++;
- }
- }
- }
-
- public String getBuffer() {
- return m_buf.toString();
- }
- }
-
- public SqlFormatter() {
- }
-
- public static String wellform(String s) {
- return new SqlFormatter().wellform(s, 10);
- }
-
- public String wellform(String s, int tabSize) {
- Statement stm = new SqlParser().parse(s);
- FormatContext ctx = new FormatContext(tabSize);
- formatStatement(stm, ctx);
- return ctx.getBuffer().trim();
- }
-
- private void formatStatement(Statement stm, FormatContext ctx) {
- if (stm != null) {
- for (IToken t : stm.getChildren()) {
- if (t instanceof Statement) {
- formatStatement((Statement) t, ctx);
- }
- else if (t instanceof SingleStatement) {
- formatSingleStatement((SingleStatement) t, ctx);
- }
- else if (t instanceof BracketExpr) {
- formatBracketExpr((BracketExpr) t, ctx);
- }
- else if (t instanceof UnionToken) {
- formatDefault(t, ctx);
- ctx.println();
- }
- else if (t instanceof Unparsed) {
- ctx.println("*** UNPARSED ***");
- formatDefault(t, ctx);
- ctx.println();
- }
- else {
- formatDefault(t, ctx);
- }
- }
- }
- }
-
- private void formatSingleStatement(SingleStatement stm, FormatContext ctx) {
- for (IToken t : stm.getChildren()) {
- if (t instanceof Part) {
- formatPart((Part) t, ctx);
- }
- else {
- formatDefault(t, ctx);
- }
- }
- }
-
- private void formatPart(Part stm, FormatContext ctx) {
- boolean hasList = false;
- for (IToken t : stm.getChildren()) {
- if (t instanceof PartToken) {
- formatDefault(t, ctx);
- }
- else if (t instanceof Part) {
- ctx.in();
- formatPart((Part) t, ctx);
- ctx.out();
- }
- else if (t instanceof ListExpr) {
- hasList = true;
- ctx.in();
- formatListExpr((ListExpr) t, true, ctx);
- ctx.out();
- }
- else {
- formatDefault(t, ctx);
- }
- }
- if (!hasList) {
- ctx.in();
- ctx.print(" ");
- ctx.out();
- }
- }
-
- private void formatListExpr(ListExpr stm, boolean multiline, FormatContext ctx) {
- for (IToken t : stm.getChildren()) {
- if (t instanceof OrExpr) {
- formatOrExpr((OrExpr) t, ctx);
- }
- else if (t instanceof ListSeparator) {
- formatDefault(t, ctx);
- if (multiline) {
- ctx.println();
- }
- else {
- ctx.print(" ");
- }
- }
- else {
- formatDefault(t, ctx);
- }
- }
- }
-
- private void formatOrExpr(OrExpr stm, FormatContext ctx) {
- for (IToken t : stm.getChildren()) {
- if (t instanceof AndExpr) {
- formatAndExpr((AndExpr) t, ctx);
- }
- else if (t instanceof OrOp) {
- ctx.println();
- formatDefault(t, ctx);
- ctx.println();
- }
- else {
- formatDefault(t, ctx);
- }
- }
- }
-
- private void formatAndExpr(AndExpr stm, FormatContext ctx) {
- for (IToken t : stm.getChildren()) {
- if (t instanceof MathExpr) {
- formatMathExpr((MathExpr) t, ctx);
- }
- else if (t instanceof AndOp) {
- ctx.println();
- formatDefault(t, ctx);
- ctx.print(" ");
- }
- else {
- formatDefault(t, ctx);
- }
- }
- }
-
- private void formatMathExpr(MathExpr stm, FormatContext ctx) {
- for (IToken t : stm.getChildren()) {
- if (!(t instanceof MathOp)) {
- formatSimpleExpr(t, ctx);
- }
- else if (t instanceof MathOp) {
- ctx.print(" ");
- formatDefault(t, ctx);
- ctx.print(" ");
- }
- else {
- formatDefault(t, ctx);
- }
- }
- }
-
- private void formatSimpleExpr(IToken stm, FormatContext ctx) {
- IToken t = stm;
- if (t instanceof UnaryPrefixExpr) {
- formatUnaryPrefixExpr((UnaryPrefixExpr) t, ctx);
- }
- else if (t instanceof MinusExpr) {
- formatMinusExpr((MinusExpr) t, ctx);
- }
- else if (t instanceof Atom) {
- formatAtom((Atom) t, ctx);
- }
- else {
- formatDefault(t, ctx);
- }
- }
-
- private void formatUnaryPrefixExpr(UnaryPrefixExpr stm, FormatContext ctx) {
- for (IToken t : stm.getChildren()) {
- if (t instanceof UnaryPrefix) {
- formatDefault(t, ctx);
- ctx.print(" ");
- }
- else if (t instanceof Atom) {
- formatAtom((Atom) t, ctx);
- }
- else {
- formatDefault(t, ctx);
- }
- }
- }
-
- private void formatMinusExpr(MinusExpr stm, FormatContext ctx) {
- for (IToken t : stm.getChildren()) {
- if (t instanceof MathOp) {
- formatDefault(t, ctx);
- }
- else if (t instanceof Atom) {
- formatAtom((Atom) t, ctx);
- }
- else {
- formatDefault(t, ctx);
- }
- }
- }
-
- private void formatAtom(Atom stm, FormatContext ctx) {
- int index = 0;
- for (IToken t : stm.getChildren()) {
- if (t instanceof BracketExpr) {
- formatBracketExpr((BracketExpr) t, ctx);
- }
- else if (t instanceof Statement) {
- formatStatement((Statement) t, ctx);
- }
- else if (t instanceof Part) {
- formatPart((Part) t, ctx);
- }
- else if (t instanceof OrExpr) {
- formatOrExpr((OrExpr) t, ctx);
- }
- else if (t instanceof FunExpr) {
- formatFunExpr((FunExpr) t, ctx);
- }
- else if (t instanceof Name) {
- if (index > 0) {
- ctx.print(" ");
- }
- formatDefault(t, ctx);
- }
- else {
- formatDefault(t, ctx);
- }
- index++;
- }
- }
-
- private void formatBracketExpr(BracketExpr stm, FormatContext ctx) {
- boolean multiline = isMultiline(stm);
- for (IToken t : stm.getChildren()) {
- if (t instanceof OpenBracketToken) {
- formatDefault(t, ctx);
- if (multiline) {
- ctx.println();
- ctx.in();
- }
- }
- else if (t instanceof CloseBracketToken) {
- if (multiline) {
- ctx.out();
- }
- formatDefault(t, ctx);
- }
- else if (t instanceof Statement) {
- formatStatement((Statement) t, ctx);
- }
- else if (t instanceof SingleStatement) {
- formatSingleStatement((SingleStatement) t, ctx);
- }
- else if (t instanceof ListExpr) {
- formatListExpr((ListExpr) t, multiline, ctx);
- }
- else {
- formatDefault(t, ctx);
- }
- }
- }
-
- private void formatFunExpr(FunExpr stm, FormatContext ctx) {
- for (IToken t : stm.getChildren()) {
- if (t instanceof Name) {
- formatDefault(t, ctx);
- }
- else if (t instanceof BracketExpr) {
- formatBracketExpr((BracketExpr) t, ctx);
- }
- else {
- formatDefault(t, ctx);
- }
- }
- }
-
- private void formatDefault(IToken t, FormatContext ctx) {
- for (Comment c : t.getComments()) {
- ctx.print(c.toString());
- }
- ctx.print(t.toString());
- }
-
- private boolean isMultiline(IToken stm) {
- if (stm instanceof Statement) {
- return true;
- }
- for (IToken t : stm.getChildren()) {
- if (isMultiline(t)) {
- return true;
- }
- }
- return false;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.parsers.sql;
+
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.commons.parsers.sql.SqlParserToken.AndExpr;
+import org.eclipse.scout.commons.parsers.sql.SqlParserToken.AndOp;
+import org.eclipse.scout.commons.parsers.sql.SqlParserToken.Atom;
+import org.eclipse.scout.commons.parsers.sql.SqlParserToken.BracketExpr;
+import org.eclipse.scout.commons.parsers.sql.SqlParserToken.CloseBracketToken;
+import org.eclipse.scout.commons.parsers.sql.SqlParserToken.Comment;
+import org.eclipse.scout.commons.parsers.sql.SqlParserToken.FunExpr;
+import org.eclipse.scout.commons.parsers.sql.SqlParserToken.IToken;
+import org.eclipse.scout.commons.parsers.sql.SqlParserToken.ListExpr;
+import org.eclipse.scout.commons.parsers.sql.SqlParserToken.ListSeparator;
+import org.eclipse.scout.commons.parsers.sql.SqlParserToken.MathExpr;
+import org.eclipse.scout.commons.parsers.sql.SqlParserToken.MathOp;
+import org.eclipse.scout.commons.parsers.sql.SqlParserToken.MinusExpr;
+import org.eclipse.scout.commons.parsers.sql.SqlParserToken.Name;
+import org.eclipse.scout.commons.parsers.sql.SqlParserToken.OpenBracketToken;
+import org.eclipse.scout.commons.parsers.sql.SqlParserToken.OrExpr;
+import org.eclipse.scout.commons.parsers.sql.SqlParserToken.OrOp;
+import org.eclipse.scout.commons.parsers.sql.SqlParserToken.Part;
+import org.eclipse.scout.commons.parsers.sql.SqlParserToken.PartToken;
+import org.eclipse.scout.commons.parsers.sql.SqlParserToken.SingleStatement;
+import org.eclipse.scout.commons.parsers.sql.SqlParserToken.Statement;
+import org.eclipse.scout.commons.parsers.sql.SqlParserToken.UnaryPrefix;
+import org.eclipse.scout.commons.parsers.sql.SqlParserToken.UnaryPrefixExpr;
+import org.eclipse.scout.commons.parsers.sql.SqlParserToken.UnionToken;
+import org.eclipse.scout.commons.parsers.sql.SqlParserToken.Unparsed;
+
+/**
+ * see {@link SqlParser}
+ *
+ * <pre>
+ * <code>
+ * Statement = SingleStatement (UnionToken SingleStatement)* (Unparsed)?
+ * SingleStatement = Part+
+ * Part = PartToken ListExpr
+ * ListExpr = OrExpr (ListSeparator OrExpr)*
+ * OrExpr = AndExpr (BinaryOp['OR'] AndExpr)*
+ * AndExpr = MathExpr (BinaryOp['AND'] MathExpr)*
+ * MathExpr = _simpleExpr (BinaryOp _simpleExpr)*
+ * _simpleExpr = UnaryPrefixExpr | MinusExpr | Atom
+ * UnaryPrefixExpr = UnaryPrefix Atom
+ * MinusExpr = BinaryOp['-'] Atom
+ * Atom= (BracketExpr | Statement | OrExpr | FunExpr | Name | Text | BinaryOp['*']) (OuterJoinToken)? (Name["AS"])? (Name[alias])?
+ * BracketExpr = OpenBracketToken (Statement | ListExpr) CloseBracketToken
+ * FunExpr = Name BracketExpr
+ * </code>
+ * </pre>
+ */
+public class SqlFormatter {
+ private static IScoutLogger logger = ScoutLogManager.getLogger(SqlFormatter.class);
+
+ private static class FormatContext {
+ private int m_tabSize;
+ private int m_indent;
+ private int m_linePos;
+ private StringBuilder m_buf;
+
+ public FormatContext(int tabSize) {
+ m_tabSize = tabSize;
+ m_buf = new StringBuilder();
+ }
+
+ public void in() {
+ m_indent += m_tabSize;
+ if (m_linePos >= m_indent) {
+ print(" ");
+ }
+ }
+
+ public void out() {
+ m_indent -= m_tabSize;
+ if (m_linePos > m_indent) {
+ println();
+ }
+ }
+
+ public void println() {
+ print("\n");
+ }
+
+ public void println(String s) {
+ print(s);
+ print("\n");
+ }
+
+ public void print(String s) {
+ for (char ch : s.toCharArray()) {
+ if (ch == '\n') {
+ m_buf.append('\n');
+ m_linePos = 0;
+ }
+ else {
+ //check indentation
+ while (m_linePos < m_indent) {
+ m_buf.append(' ');
+ m_linePos++;
+ }
+ m_buf.append(ch);
+ m_linePos++;
+ }
+ }
+ }
+
+ public String getBuffer() {
+ return m_buf.toString();
+ }
+ }
+
+ public SqlFormatter() {
+ }
+
+ public static String wellform(String s) {
+ return new SqlFormatter().wellform(s, 10);
+ }
+
+ public String wellform(String s, int tabSize) {
+ Statement stm = new SqlParser().parse(s);
+ FormatContext ctx = new FormatContext(tabSize);
+ formatStatement(stm, ctx);
+ return ctx.getBuffer().trim();
+ }
+
+ private void formatStatement(Statement stm, FormatContext ctx) {
+ if (stm != null) {
+ for (IToken t : stm.getChildren()) {
+ if (t instanceof Statement) {
+ formatStatement((Statement) t, ctx);
+ }
+ else if (t instanceof SingleStatement) {
+ formatSingleStatement((SingleStatement) t, ctx);
+ }
+ else if (t instanceof BracketExpr) {
+ formatBracketExpr((BracketExpr) t, ctx);
+ }
+ else if (t instanceof UnionToken) {
+ formatDefault(t, ctx);
+ ctx.println();
+ }
+ else if (t instanceof Unparsed) {
+ ctx.println("*** UNPARSED ***");
+ formatDefault(t, ctx);
+ ctx.println();
+ }
+ else {
+ formatDefault(t, ctx);
+ }
+ }
+ }
+ }
+
+ private void formatSingleStatement(SingleStatement stm, FormatContext ctx) {
+ for (IToken t : stm.getChildren()) {
+ if (t instanceof Part) {
+ formatPart((Part) t, ctx);
+ }
+ else {
+ formatDefault(t, ctx);
+ }
+ }
+ }
+
+ private void formatPart(Part stm, FormatContext ctx) {
+ boolean hasList = false;
+ for (IToken t : stm.getChildren()) {
+ if (t instanceof PartToken) {
+ formatDefault(t, ctx);
+ }
+ else if (t instanceof Part) {
+ ctx.in();
+ formatPart((Part) t, ctx);
+ ctx.out();
+ }
+ else if (t instanceof ListExpr) {
+ hasList = true;
+ ctx.in();
+ formatListExpr((ListExpr) t, true, ctx);
+ ctx.out();
+ }
+ else {
+ formatDefault(t, ctx);
+ }
+ }
+ if (!hasList) {
+ ctx.in();
+ ctx.print(" ");
+ ctx.out();
+ }
+ }
+
+ private void formatListExpr(ListExpr stm, boolean multiline, FormatContext ctx) {
+ for (IToken t : stm.getChildren()) {
+ if (t instanceof OrExpr) {
+ formatOrExpr((OrExpr) t, ctx);
+ }
+ else if (t instanceof ListSeparator) {
+ formatDefault(t, ctx);
+ if (multiline) {
+ ctx.println();
+ }
+ else {
+ ctx.print(" ");
+ }
+ }
+ else {
+ formatDefault(t, ctx);
+ }
+ }
+ }
+
+ private void formatOrExpr(OrExpr stm, FormatContext ctx) {
+ for (IToken t : stm.getChildren()) {
+ if (t instanceof AndExpr) {
+ formatAndExpr((AndExpr) t, ctx);
+ }
+ else if (t instanceof OrOp) {
+ ctx.println();
+ formatDefault(t, ctx);
+ ctx.println();
+ }
+ else {
+ formatDefault(t, ctx);
+ }
+ }
+ }
+
+ private void formatAndExpr(AndExpr stm, FormatContext ctx) {
+ for (IToken t : stm.getChildren()) {
+ if (t instanceof MathExpr) {
+ formatMathExpr((MathExpr) t, ctx);
+ }
+ else if (t instanceof AndOp) {
+ ctx.println();
+ formatDefault(t, ctx);
+ ctx.print(" ");
+ }
+ else {
+ formatDefault(t, ctx);
+ }
+ }
+ }
+
+ private void formatMathExpr(MathExpr stm, FormatContext ctx) {
+ for (IToken t : stm.getChildren()) {
+ if (!(t instanceof MathOp)) {
+ formatSimpleExpr(t, ctx);
+ }
+ else if (t instanceof MathOp) {
+ ctx.print(" ");
+ formatDefault(t, ctx);
+ ctx.print(" ");
+ }
+ else {
+ formatDefault(t, ctx);
+ }
+ }
+ }
+
+ private void formatSimpleExpr(IToken stm, FormatContext ctx) {
+ IToken t = stm;
+ if (t instanceof UnaryPrefixExpr) {
+ formatUnaryPrefixExpr((UnaryPrefixExpr) t, ctx);
+ }
+ else if (t instanceof MinusExpr) {
+ formatMinusExpr((MinusExpr) t, ctx);
+ }
+ else if (t instanceof Atom) {
+ formatAtom((Atom) t, ctx);
+ }
+ else {
+ formatDefault(t, ctx);
+ }
+ }
+
+ private void formatUnaryPrefixExpr(UnaryPrefixExpr stm, FormatContext ctx) {
+ for (IToken t : stm.getChildren()) {
+ if (t instanceof UnaryPrefix) {
+ formatDefault(t, ctx);
+ ctx.print(" ");
+ }
+ else if (t instanceof Atom) {
+ formatAtom((Atom) t, ctx);
+ }
+ else {
+ formatDefault(t, ctx);
+ }
+ }
+ }
+
+ private void formatMinusExpr(MinusExpr stm, FormatContext ctx) {
+ for (IToken t : stm.getChildren()) {
+ if (t instanceof MathOp) {
+ formatDefault(t, ctx);
+ }
+ else if (t instanceof Atom) {
+ formatAtom((Atom) t, ctx);
+ }
+ else {
+ formatDefault(t, ctx);
+ }
+ }
+ }
+
+ private void formatAtom(Atom stm, FormatContext ctx) {
+ int index = 0;
+ for (IToken t : stm.getChildren()) {
+ if (t instanceof BracketExpr) {
+ formatBracketExpr((BracketExpr) t, ctx);
+ }
+ else if (t instanceof Statement) {
+ formatStatement((Statement) t, ctx);
+ }
+ else if (t instanceof Part) {
+ formatPart((Part) t, ctx);
+ }
+ else if (t instanceof OrExpr) {
+ formatOrExpr((OrExpr) t, ctx);
+ }
+ else if (t instanceof FunExpr) {
+ formatFunExpr((FunExpr) t, ctx);
+ }
+ else if (t instanceof Name) {
+ if (index > 0) {
+ ctx.print(" ");
+ }
+ formatDefault(t, ctx);
+ }
+ else {
+ formatDefault(t, ctx);
+ }
+ index++;
+ }
+ }
+
+ private void formatBracketExpr(BracketExpr stm, FormatContext ctx) {
+ boolean multiline = isMultiline(stm);
+ for (IToken t : stm.getChildren()) {
+ if (t instanceof OpenBracketToken) {
+ formatDefault(t, ctx);
+ if (multiline) {
+ ctx.println();
+ ctx.in();
+ }
+ }
+ else if (t instanceof CloseBracketToken) {
+ if (multiline) {
+ ctx.out();
+ }
+ formatDefault(t, ctx);
+ }
+ else if (t instanceof Statement) {
+ formatStatement((Statement) t, ctx);
+ }
+ else if (t instanceof SingleStatement) {
+ formatSingleStatement((SingleStatement) t, ctx);
+ }
+ else if (t instanceof ListExpr) {
+ formatListExpr((ListExpr) t, multiline, ctx);
+ }
+ else {
+ formatDefault(t, ctx);
+ }
+ }
+ }
+
+ private void formatFunExpr(FunExpr stm, FormatContext ctx) {
+ for (IToken t : stm.getChildren()) {
+ if (t instanceof Name) {
+ formatDefault(t, ctx);
+ }
+ else if (t instanceof BracketExpr) {
+ formatBracketExpr((BracketExpr) t, ctx);
+ }
+ else {
+ formatDefault(t, ctx);
+ }
+ }
+ }
+
+ private void formatDefault(IToken t, FormatContext ctx) {
+ for (Comment c : t.getComments()) {
+ ctx.print(c.toString());
+ }
+ ctx.print(t.toString());
+ }
+
+ private boolean isMultiline(IToken stm) {
+ if (stm instanceof Statement) {
+ return true;
+ }
+ for (IToken t : stm.getChildren()) {
+ if (isMultiline(t)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/sql/SqlParser.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/sql/SqlParser.java
index 756a0d6458..6445732118 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/sql/SqlParser.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/sql/SqlParser.java
@@ -1,878 +1,878 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.parsers.sql;
-
-import java.text.ParseException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.commons.parsers.BindModel;
-import org.eclipse.scout.commons.parsers.BindParser;
-import org.eclipse.scout.commons.parsers.sql.SqlParserToken.AndExpr;
-import org.eclipse.scout.commons.parsers.sql.SqlParserToken.AndOp;
-import org.eclipse.scout.commons.parsers.sql.SqlParserToken.Atom;
-import org.eclipse.scout.commons.parsers.sql.SqlParserToken.BracketExpr;
-import org.eclipse.scout.commons.parsers.sql.SqlParserToken.CloseBracketToken;
-import org.eclipse.scout.commons.parsers.sql.SqlParserToken.Comment;
-import org.eclipse.scout.commons.parsers.sql.SqlParserToken.FunExpr;
-import org.eclipse.scout.commons.parsers.sql.SqlParserToken.IToken;
-import org.eclipse.scout.commons.parsers.sql.SqlParserToken.ListExpr;
-import org.eclipse.scout.commons.parsers.sql.SqlParserToken.ListSeparator;
-import org.eclipse.scout.commons.parsers.sql.SqlParserToken.MathExpr;
-import org.eclipse.scout.commons.parsers.sql.SqlParserToken.MathOp;
-import org.eclipse.scout.commons.parsers.sql.SqlParserToken.MinusExpr;
-import org.eclipse.scout.commons.parsers.sql.SqlParserToken.Name;
-import org.eclipse.scout.commons.parsers.sql.SqlParserToken.OpenBracketToken;
-import org.eclipse.scout.commons.parsers.sql.SqlParserToken.OrExpr;
-import org.eclipse.scout.commons.parsers.sql.SqlParserToken.OrOp;
-import org.eclipse.scout.commons.parsers.sql.SqlParserToken.OuterJoinToken;
-import org.eclipse.scout.commons.parsers.sql.SqlParserToken.Part;
-import org.eclipse.scout.commons.parsers.sql.SqlParserToken.PartToken;
-import org.eclipse.scout.commons.parsers.sql.SqlParserToken.Raw;
-import org.eclipse.scout.commons.parsers.sql.SqlParserToken.SingleStatement;
-import org.eclipse.scout.commons.parsers.sql.SqlParserToken.Statement;
-import org.eclipse.scout.commons.parsers.sql.SqlParserToken.Text;
-import org.eclipse.scout.commons.parsers.sql.SqlParserToken.UnaryPrefix;
-import org.eclipse.scout.commons.parsers.sql.SqlParserToken.UnaryPrefixExpr;
-import org.eclipse.scout.commons.parsers.sql.SqlParserToken.UnionToken;
-import org.eclipse.scout.commons.parsers.sql.SqlParserToken.Unparsed;
-import org.eclipse.scout.commons.parsers.token.TextToken;
-
-/**
- * Parser for sql SELECT statements
- * Syntax (EBNF):
- *
- * <pre>
- * <code>
- * Statement = SingleStatement (UnionToken SingleStatement)* (Unparsed)?
- * SingleStatement = Part+ {with first part being a statement root part such as SELECT, INSERT, WITH, ...}
- * Part = PartToken ListExpr
- * ListExpr = OrExpr (ListSeparator OrExpr)*
- * OrExpr = AndExpr (OrOp AndExpr)*
- * AndExpr = MathExpr (AndOp MathExpr)*
- * MathExpr = _simpleExpr (MathOp _simpleExpr)*
- * _simpleExpr = UnaryPrefixExpr | MinusExpr | Atom
- * UnaryPrefixExpr = UnaryPrefix Atom
- * MinusExpr = BinaryOp['-'] Atom
- * Atom= (BracketExpr | Statement | OrExpr | FunExpr | Name | Text | BinaryOp['*']) (OuterJoinToken)? (Name[alias])?
- * BracketExpr = OpenBracketToken (Statement | ListExpr) CloseBracketToken
- * FunExpr = Name BracketExpr
- * Bind = ':' any until whitespace | '#' any '#' | '&' any '&'
- * Name = nameChar+
- * nameChar = {a-zA-Z0-9_$.@:?}
- * </code>
- * </pre>
- */
-public class SqlParser {
- private static IScoutLogger logger = ScoutLogManager.getLogger(SqlParser.class);
-
- private static final String nameChars = "a-zA-Z0-9_$.@:?";
- private static final Pattern COMMENT_PAT = Pattern.compile("(\\{[^\\}]*\\})");
- private static final Pattern APOS_PAT = Pattern.compile("('[^']*')");
- private static final Pattern QUOT_PAT = Pattern.compile("(\"[^\"]*\")");
- //make all uppercase and single space (order of tokens matters!)
- private static final Pattern UNION_PAT = Pattern.compile("[^" + nameChars + "](UNION ALL|INTERSECT|MINUS|UNION)[^" + nameChars + "]");
- private static final Pattern PART_PAT = Pattern.compile("[^" + nameChars + "](WITH|AS|SELECT|FROM|LEFT JOIN|OUTER JOIN|INNER JOIN|JOIN|ON|WHERE|GROUP BY|HAVING|ORDER BY|INSERT INTO|INSERT|INTO|CONNECT BY( NOCYCLE)?|START WITH|UPDATE|DELETE FROM|DELETE|SET|VALUES|CASE|ELSE|END|THEN|WHEN)[^" + nameChars + "]");
- private static final Pattern OUTER_JOIN_PAT = Pattern.compile("(\\(\\+\\))");
- private static final Pattern OR_OP_PAT = Pattern.compile("[^" + nameChars + "](OR)[^" + nameChars + "]");
- private static final Pattern AND_OP_PAT = Pattern.compile("[^" + nameChars + "](AND)[^" + nameChars + "]");
- private static final Pattern MATH_OP_PAT1 = Pattern.compile("[^" + nameChars + "](NOT IN|IN|IS NOT|IS|NOT BETWEEN|BETWEEN|NOT LIKE|LIKE)[^" + nameChars + "]");
- private static final Pattern MATH_OP_PAT2 = Pattern.compile("(=|<>|!=|<=|>=|<|>|\\%|\\^|\\+|\\-|\\*|/|\\|\\||\\&\\&)");
- private static final Pattern UNARY_PREFIX_PAT = Pattern.compile("[^" + nameChars + "](NOT|DISTINCT|NEW)[^" + nameChars + "]");
- //eliminate all remaining spaces
- private static final Pattern NAME_PAT = Pattern.compile("([" + nameChars + "]+)");
- private static final Pattern OPEN_BRACKET_PAT = Pattern.compile("([(])");
- private static final Pattern CLOSE_BRACKET_PAT = Pattern.compile("([)])");
- private static final Pattern LIST_SEPARATOR_PAT = Pattern.compile("([,])");
-
- /**
- * avoid dead-lock
- */
- private static class ParseContext {
- private HashSet<ParseStep> m_steps;
- private HashMap<String, String> m_bindMap;
-
- public ParseContext() {
- m_steps = new HashSet<ParseStep>();
- m_bindMap = new HashMap<String, String>();
- }
-
- public Map<String/*code*/, String/*name*/> getBinds() {
- return m_bindMap;
- }
-
- /**
- * @return true if the operation can be performed and the context was added, returns false when the operation is a
- * loop and the context was NOT added
- */
- public ParseStep checkAndAdd(String method, List<IToken> list) {
- ParseStep step = new ParseStep(method, list.size() > 0 ? list.get(0) : null);
- if (m_steps.contains(step)) {
- return null;
- }
- m_steps.add(step);
- return step;
- }
-
- public void remove(ParseStep step) {
- m_steps.remove(step);
- }
- }
-
- private static class ParseStep {
- private final String m_method;
- private final IToken m_token;
-
- public ParseStep(String method, IToken token) {
- m_method = method;
- m_token = token;
- }
-
- @Override
- public int hashCode() {
- return m_method.hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (!(obj instanceof ParseStep)) {
- return false;
- }
- ParseStep o = (ParseStep) obj;
- return this.m_method.equals(o.m_method) && this.m_token == o.m_token;
- }
-
- @Override
- public String toString() {
- return m_method + ": " + m_token;
- }
- }
-
- public SqlParser() {
- }
-
- public Statement parse(String s) {
- ParseContext ctx = new ParseContext();
- List<IToken> list = tokenize(s, ctx);
- Statement stm = parseStatement(list, ctx);
- //sometimes sql is wrapped into brackets
- if (stm == null) {
- ctx = new ParseContext();
- list = tokenize(s, ctx);
- BracketExpr be = parseBracketExpr(list, ctx);
- if (be != null) {
- for (IToken t : be.getChildren()) {
- if (t instanceof Statement) {
- stm = (Statement) t;
- break;
- }
- }
- }
- }
- if (list.size() > 0) {
- Unparsed up = new Unparsed();
- up.setText(flatten(list));
- if (stm == null) {
- stm = new Statement();
- }
- stm.addChild(up);
- }
- return stm;
- }
-
- private Statement parseStatement(List<IToken> list, ParseContext ctx) {
- //SingleStatement (UnionToken SingleStatement)*
- ParseStep lock = ctx.checkAndAdd("Statement", list);
- if (lock == null) {
- return null;
- }
- try {
- IToken ss = parseSingleStatement(list, ctx);
- if (ss == null) {
- return null;
- }
- Statement s = new Statement();
- s.addChild(ss);
- UnionToken u;
- IToken nexts = null;
- while ((u = removeToken(list, UnionToken.class)) != null && (nexts = parseSingleStatement(list, ctx)) != null) {
- s.addChild(u);
- s.addChild(nexts);
- }
- //restore incomplete
- if (u != null && nexts == null) {
- list.add(0, u);
- }
- return s;
- }
- finally {
- ctx.remove(lock);
- }
- }
-
- /**
- * return {@link SingleStatement} or {@link BracketExpr}
- */
- private IToken parseSingleStatement(List<IToken> list, ParseContext ctx) {
- ParseStep lock = ctx.checkAndAdd("SingleStatement", list);
- if (lock == null) {
- return null;
- }
- try {
- //brackets
- ArrayList<IToken> backup = new ArrayList<IToken>(list);
- BracketExpr be = parseBracketExpr(list, ctx);
- if (be != null) {
- BracketExpr tmp = be;
- while (tmp != null) {
- IToken ch = tmp.getChildren().get(1);//open, token, close
- if (ch instanceof BracketExpr) {
- tmp = (BracketExpr) ch;
- }
- else if (ch instanceof Statement) {
- return be;
- }
- else if (ch instanceof SingleStatement) {
- return be;
- }
- else {
- tmp = null;
- }
- }
- //restore
- list.clear();
- list.addAll(backup);
- return null;
- }
- //
- //Part+
- Part p;
- SingleStatement ss = new SingleStatement();
- if ((p = parsePart(list, ctx, true)) != null) {
- //ok
- ss.addChild(p);
- }
- else {
- return null;
- }
- while ((p = parsePart(list, ctx, false)) != null) {
- ss.addChild(p);
- }
- if (ss.getChildren().size() == 0) {
- return null;
- }
- return ss;
- }
- finally {
- ctx.remove(lock);
- }
- }
-
- private Part parsePart(List<IToken> list, ParseContext ctx, boolean rootPart) {
- //PartToken ListExpr
- ParseStep lock = ctx.checkAndAdd("Part", list);
- if (lock == null) {
- return null;
- }
- try {
- PartToken pt;
- ListExpr le;
- if ((pt = removeToken(list, PartToken.class)) != null && (!rootPart || isRootPartToken(pt))) {
- //ok
- le = parseListExpr(list, ctx);
- }
- else {
- //restore incomplete
- if (pt != null) {
- list.add(0, pt);
- }
- return null;
- }
- Part p = new Part();
- p.addChild(pt);
- if (le != null) {
- p.addChild(le);
- }
- return p;
- }
- finally {
- ctx.remove(lock);
- }
- }
-
- private boolean isRootPartToken(PartToken pt) {
- String s = pt.getText();
- if (s.equals("SELECT")) {
- return true;
- }
- if (s.equals("INSERT INTO")) {
- return true;
- }
- if (s.equals("INSERT")) {
- return true;
- }
- if (s.equals("UPDATE")) {
- return true;
- }
- if (s.equals("DELETE FROM")) {
- return true;
- }
- if (s.equals("DELETE")) {
- return true;
- }
- if (s.equals("CASE")) {
- return true;
- }
- if (s.equals("WITH")) {
- return true;
- }
- return false;
- }
-
- private ListExpr parseListExpr(List<IToken> list, ParseContext ctx) {
- //OrExpr (ListSeparator OrExpr)*
- ParseStep lock = ctx.checkAndAdd("ListExpr", list);
- if (lock == null) {
- return null;
- }
- try {
- OrExpr oe = parseOrExpr(list, ctx);
- if (oe == null) {
- return null;
- }
- ListExpr le = new ListExpr();
- le.addChild(oe);
- ListSeparator ls = null;
- while ((ls = removeToken(list, ListSeparator.class)) != null && (oe = parseOrExpr(list, ctx)) != null) {
- le.addChild(ls);
- le.addChild(oe);
- }
- //restore incomplete
- if (ls != null && oe == null) {
- list.add(0, ls);
- }
- return le;
- }
- finally {
- ctx.remove(lock);
- }
- }
-
- private OrExpr parseOrExpr(List<IToken> list, ParseContext ctx) {
- //AndExpr (BinaryOp['OR'] AndExpr)*
- ParseStep lock = ctx.checkAndAdd("OrExpr", list);
- if (lock == null) {
- return null;
- }
- try {
- AndExpr ae = parseAndExpr(list, ctx);
- if (ae == null) {
- return null;
- }
- OrExpr oe = new OrExpr();
- oe.addChild(ae);
- OrOp oo;
- while ((oo = removeToken(list, OrOp.class)) != null && (ae = parseAndExpr(list, ctx)) != null) {
- oe.addChild(oo);
- oe.addChild(ae);
- }
- //remaining?
- if (oo != null) {
- oo.addComment(new Comment("/*syntax warning*/"));
- oe.addChild(oo);
- }
- return oe;
- }
- finally {
- ctx.remove(lock);
- }
- }
-
- private AndExpr parseAndExpr(List<IToken> list, ParseContext ctx) {
- //MathExpr (BinaryOp['AND'] MathExpr)*
- ParseStep lock = ctx.checkAndAdd("AndExpr", list);
- if (lock == null) {
- return null;
- }
- try {
- IToken me = parseMathExpr(list, ctx);
- if (me == null) {
- return null;
- }
- AndExpr ae = new AndExpr();
- ae.addChild(me);
- AndOp ao;
- while ((ao = removeToken(list, AndOp.class)) != null && (me = parseMathExpr(list, ctx)) != null) {
- ae.addChild(ao);
- ae.addChild(me);
- }
- //remaining?
- if (ao != null) {
- ao.addComment(new Comment("/*syntax warning*/"));
- ae.addChild(ao);
- }
- return ae;
- }
- finally {
- ctx.remove(lock);
- }
- }
-
- private MathExpr parseMathExpr(List<IToken> list, ParseContext ctx) {
- //_simpleExpr (BinaryOp _simpleExpr)*
- ParseStep lock = ctx.checkAndAdd("MathExpr", list);
- if (lock == null) {
- return null;
- }
- try {
- IToken se = parseSimpleExpr(list, ctx);
- if (se == null) {
- return null;
- }
- MathExpr me = new MathExpr();
- me.addChild(se);
- MathOp mo;
- while ((mo = removeToken(list, MathOp.class)) != null && (se = parseSimpleExpr(list, ctx)) != null) {
- me.addChild(mo);
- me.addChild(se);
- }
- //restore incomplete
- if (mo != null && se == null) {
- list.add(0, mo);
- }
- return me;
- }
- finally {
- ctx.remove(lock);
- }
- }
-
- private IToken parseSimpleExpr(List<IToken> list, ParseContext ctx) {
- //UnaryPrefixExpr | MinusExpr | Atom
- ParseStep lock = ctx.checkAndAdd("SimpleExpr", list);
- if (lock == null) {
- return null;
- }
- try {
- IToken t;
- if ((t = parseUnaryPrefixExpr(list, ctx)) != null) {
- return t;
- }
- if ((t = parseMinusExpr(list, ctx)) != null) {
- return t;
- }
- if ((t = parseAtom(list, ctx)) != null) {
- return t;
- }
- return null;
- }
- finally {
- ctx.remove(lock);
- }
- }
-
- private UnaryPrefixExpr parseUnaryPrefixExpr(List<IToken> list, ParseContext ctx) {
- //UnaryPrefix Atom
- ParseStep lock = ctx.checkAndAdd("UnaryPrefixExpr", list);
- if (lock == null) {
- return null;
- }
- try {
- UnaryPrefix up = null;
- IToken a = null;
- if ((up = removeToken(list, UnaryPrefix.class)) != null && (a = parseAtom(list, ctx)) != null) {
- //ok
- }
- else {
- //restore incomplete
- if (up != null && a == null) {
- list.add(0, up);
- }
- return null;
- }
- UnaryPrefixExpr e = new UnaryPrefixExpr();
- e.addChild(up);
- e.addChild(a);
- return e;
- }
- finally {
- ctx.remove(lock);
- }
- }
-
- private MinusExpr parseMinusExpr(List<IToken> list, ParseContext ctx) {
- //BinaryOp['-'] Atom
- ParseStep lock = ctx.checkAndAdd("MinusExpr", list);
- if (lock == null) {
- return null;
- }
- try {
- MathOp mo = null;
- IToken a = null;
- if ((mo = removeToken(list, MathOp.class, "-")) != null && (a = parseAtom(list, ctx)) != null) {
- //ok
- }
- else {
- //restore incomplete
- if (mo != null && a == null) {
- list.add(0, mo);
- }
- return null;
- }
- MinusExpr e = new MinusExpr();
- e.addChild(mo);
- e.addChild(a);
- return e;
- }
- finally {
- ctx.remove(lock);
- }
- }
-
- private FunExpr parseFunExpr(List<IToken> list, ParseContext ctx) {
- //Name BracketExpr
- ParseStep lock = ctx.checkAndAdd("FunExpr", list);
- if (lock == null) {
- return null;
- }
- try {
- Name nm = null;
- BracketExpr be = null;
- if ((nm = removeToken(list, Name.class)) != null && (be = parseBracketExpr(list, ctx)) != null) {
- //ok
- }
- else {
- //restore incomplete
- if (nm != null && be == null) {
- list.add(0, nm);
- }
- return null;
- }
- FunExpr e = new FunExpr();
- e.addChild(nm);
- e.addChild(be);
- return e;
- }
- finally {
- ctx.remove(lock);
- }
- }
-
- private BracketExpr parseBracketExpr(List<IToken> list, ParseContext ctx) {
- //BracketExpr = OpenBracketToken (Statement | ListExpr) CloseBracketToken
- ParseStep lock = ctx.checkAndAdd("BracketExpr", list);
- if (lock == null) {
- return null;
- }
- try {
- IToken open = null;
- IToken t = null;
- IToken close = null;
- ArrayList<IToken> backup = new ArrayList<IToken>(list);
- if ((open = removeToken(list, OpenBracketToken.class)) != null && ((t = parseStatement(list, ctx)) != null || (t = parseListExpr(list, ctx)) != null || t == null) && (close = removeToken(list, CloseBracketToken.class)) != null) {
- //ok
- }
- else {
- //restore incomplete
- list.clear();
- list.addAll(backup);
- return null;
- }
- BracketExpr e = new BracketExpr();
- e.addChild(open);
- if (t != null) {
- e.addChild(t);
- }
- e.addChild(close);
- return e;
- }
- finally {
- ctx.remove(lock);
- }
- }
-
- private Atom parseAtom(List<IToken> list, ParseContext ctx) {
- //(BracketExpr Outer | Statement | OrExpr | FunExpr | Name | Text | BinaryOp['*']) (OuterJoinToken)? (Name["AS"])? (Name[alias])?
- ParseStep lock = ctx.checkAndAdd("Atom", list);
- if (lock == null) {
- return null;
- }
- try {
- IToken t = null;
- if ((t = parseBracketExpr(list, ctx)) != null) {
- //ok
- }
- else if ((t = parseStatement(list, ctx)) != null) {
- //ok
- }
- else if ((t = parseOrExpr(list, ctx)) != null) {
- //ok
- }
- else if ((t = parseFunExpr(list, ctx)) != null) {
- //ok
- }
- else if ((t = removeToken(list, Name.class)) != null) {
- //ok
- }
- else if ((t = removeToken(list, Text.class)) != null) {
- //ok
- }
- else if ((t = removeToken(list, MathOp.class, "*")) != null) {
- //ok
- }
- else {
- return null;
- }
- //found a match
- Atom a = new Atom();
- a.addChild(t);
- if ((t = removeToken(list, OuterJoinToken.class)) != null) {
- a.addChild(t);
- }
- if ((t = removeToken(list, Name.class)) != null) {
- a.addChild(t);
- }
- return a;
- }
- finally {
- ctx.remove(lock);
- }
- }
-
- @SuppressWarnings("unchecked")
- private <T extends IToken> T removeToken(List<IToken> list, Class<T> tokenType) {
- if (0 < list.size() && tokenType.isAssignableFrom(list.get(0).getClass())) {
- return (T) list.remove(0);
- }
- return null;
- }
-
- @SuppressWarnings("unchecked")
- private <T extends IToken> T removeToken(List<IToken> list, Class<T> tokenType, String text) {
- if (0 < list.size() && tokenType.isAssignableFrom(list.get(0).getClass()) && text.equals(list.get(0).getText())) {
- return (T) list.remove(0);
- }
- return null;
- }
-
- /**
- * Tokenize a string into Whitespace (containing Comment and HintComment), Text and Token items.
- * There are no Raw objects left.
- *
- * @throws ParseException
- */
- private List<IToken> tokenize(String s, ParseContext ctx) {
- s = encodeBinds(s, ctx);
- s = s.replaceAll("[\\n\\r]+", " ");
- List<IToken> list = new ArrayList<IToken>();
- list.add(new Raw(s));
- //
- list = tokenizeRaw(list, COMMENT_PAT, Comment.class, true);
- list = tokenizeRaw(list, APOS_PAT, Text.class, true);
- list = tokenizeRaw(list, APOS_PAT, Text.class, false);
- list = tokenizeRaw(list, QUOT_PAT, Name.class, true);
- list = tokenizeRaw(list, QUOT_PAT, Name.class, false);
- //replace all remaining whitespace by a single space and convert to upper case
- for (IToken item : list) {
- if (item instanceof Raw) {
- String text = item.getText();
- text = text.replaceAll("[\\s]+", " ");
- text = text.toUpperCase();
- item.setText(text);
- }
- }
- list = tokenizeRaw(list, UNION_PAT, UnionToken.class, false);
- list = tokenizeRaw(list, PART_PAT, PartToken.class, false);
- list = tokenizeRaw(list, OUTER_JOIN_PAT, OuterJoinToken.class, false);
- list = tokenizeRaw(list, OR_OP_PAT, OrOp.class, false);
- list = tokenizeRaw(list, AND_OP_PAT, AndOp.class, false);
- list = tokenizeRaw(list, MATH_OP_PAT1, MathOp.class, false);
- list = tokenizeRaw(list, MATH_OP_PAT2, MathOp.class, false);
- list = tokenizeRaw(list, UNARY_PREFIX_PAT, UnaryPrefix.class, false);
- list = tokenizeRaw(list, NAME_PAT, Name.class, false);
- list = tokenizeRaw(list, OPEN_BRACKET_PAT, OpenBracketToken.class, false);
- list = tokenizeRaw(list, CLOSE_BRACKET_PAT, CloseBracketToken.class, false);
- list = tokenizeRaw(list, LIST_SEPARATOR_PAT, ListSeparator.class, false);
- //eliminate all empty Raw
- for (Iterator<IToken> it = list.iterator(); it.hasNext();) {
- IToken item = it.next();
- if (item instanceof Raw) {
- if (item.getText().trim().length() == 0) {
- it.remove();
- }
- }
- }
- //check the rest, no more Raw, convert to comment with warning
- for (int i = 0; i < list.size(); i++) {
- IToken tok = list.get(i);
- if (tok instanceof Raw) {
- list.remove(i);
- Comment c = new Comment();
- c.setText("/*XXX unexpected token: " + tok.getText() + "*/");
- list.add(i, c);
- }
- }
- //associate comments with the successor token
- for (int i = 0; i < list.size(); i++) {
- if (list.get(i) instanceof Comment) {
- //find successor
- IToken succ = null;
- for (int k = i + 1; k < list.size(); k++) {
- if (!(list.get(k) instanceof Comment)) {
- succ = list.get(k);
- break;
- }
- }
- if (succ == null) {
- for (int k = 0; k < list.size(); k++) {
- if (!(list.get(k) instanceof Comment)) {
- succ = list.get(k);
- break;
- }
- }
- }
- if (succ != null) {
- succ.addComment((Comment) list.get(i));
- }
- }
- }
- for (Iterator<IToken> it = list.iterator(); it.hasNext();) {
- IToken item = it.next();
- if (item instanceof Comment) {
- it.remove();
- }
- }
- decodeBinds(list, ctx);
- return list;
- }
-
- private List<IToken> tokenizeRaw(List<IToken> list, Pattern p, Class<? extends IToken> tokenType, boolean transcodeDelimiters) {
- ArrayList<IToken> newList = new ArrayList<IToken>(list.size());
- for (IToken item : list) {
- if (item instanceof Raw) {
- String s = ((Raw) item).getText();
- if (transcodeDelimiters) {
- s = encodeDelimiters(s);
- }
- //extend s to start and end with an empty text (simpler regex can be used then)
- s = " " + s + " ";
- Matcher m = p.matcher(s);
- int lastEnd = 0;
- while (lastEnd < s.length() && m.find(lastEnd)) {
- String r = s.substring(lastEnd, m.start(1));
- if (transcodeDelimiters) {
- r = decodeDelimiters(r);
- }
- newList.add(new Raw(r.trim()));
- //
- r = m.group(1);
- if (transcodeDelimiters) {
- r = decodeDelimiters(r);
- }
- IToken t;
- try {
- t = tokenType.newInstance();
- }
- catch (Exception e) {
- throw new RuntimeException(e);
- }
- t.setText(r);
- newList.add(t);
- //
- lastEnd = m.end(1);
- }
- //remaining part
- if (lastEnd < s.length()) {
- String r = s.substring(lastEnd);
- if (transcodeDelimiters) {
- r = decodeDelimiters(r);
- }
- newList.add(new Raw(r.trim()));
- }
- }
- else {
- newList.add(item);
- }
- }
- return newList;
- }
-
- private String encodeBinds(String s, ParseContext ctx) {
- BindModel m = new BindParser(s).parse();
- for (org.eclipse.scout.commons.parsers.token.IToken bindToken : m.getAllTokens()) {
- if (bindToken instanceof TextToken) {
- continue;
- }
- String code = "___BIND" + ctx.getBinds().size();
- String name = bindToken.getParsedToken();
- bindToken.setReplaceToken(code);
- ctx.getBinds().put(code, name);
- }
- return m.getFilteredStatement();
- }
-
- private void decodeBinds(List<IToken> list, ParseContext ctx) {
- for (IToken t : list) {
- if (t instanceof Name) {
- String s = ctx.getBinds().get(t.getText());
- if (s != null) {
- t.setText(s);
- }
- }
- }
- }
-
- /**
- * @return text containing only the white space delimters and ' " { }
- */
- private String encodeDelimiters(String s) {
- //backup chars and escapes
- s = s.replace("$", "$0");
- s = s.replace("{", "$1");
- s = s.replace("}", "$2");
- s = s.replace("''", "$3");
- s = s.replace("\"\"", "$4");
- //define single-char delimiters for comments
- s = s.replace("/*", "{");
- s = s.replace("*/", "}");
- return s;
- }
-
- private String decodeDelimiters(String s) {
- s = s.replace("}", "*/");
- s = s.replace("{", "/*");
- s = s.replace("$4", "\"\"");
- s = s.replace("$3", "''");
- s = s.replace("$2", "}");
- s = s.replace("$1", "{");
- s = s.replace("$0", "$");
- return s;
- }
-
- private String flatten(List<IToken> list) {
- StringBuffer buf = new StringBuffer();
- for (IToken item : list) {
- if (buf.length() > 0) {
- buf.append(" ");
- }
- buf.append(item);
- }
- return buf.toString();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.parsers.sql;
+
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.commons.parsers.BindModel;
+import org.eclipse.scout.commons.parsers.BindParser;
+import org.eclipse.scout.commons.parsers.sql.SqlParserToken.AndExpr;
+import org.eclipse.scout.commons.parsers.sql.SqlParserToken.AndOp;
+import org.eclipse.scout.commons.parsers.sql.SqlParserToken.Atom;
+import org.eclipse.scout.commons.parsers.sql.SqlParserToken.BracketExpr;
+import org.eclipse.scout.commons.parsers.sql.SqlParserToken.CloseBracketToken;
+import org.eclipse.scout.commons.parsers.sql.SqlParserToken.Comment;
+import org.eclipse.scout.commons.parsers.sql.SqlParserToken.FunExpr;
+import org.eclipse.scout.commons.parsers.sql.SqlParserToken.IToken;
+import org.eclipse.scout.commons.parsers.sql.SqlParserToken.ListExpr;
+import org.eclipse.scout.commons.parsers.sql.SqlParserToken.ListSeparator;
+import org.eclipse.scout.commons.parsers.sql.SqlParserToken.MathExpr;
+import org.eclipse.scout.commons.parsers.sql.SqlParserToken.MathOp;
+import org.eclipse.scout.commons.parsers.sql.SqlParserToken.MinusExpr;
+import org.eclipse.scout.commons.parsers.sql.SqlParserToken.Name;
+import org.eclipse.scout.commons.parsers.sql.SqlParserToken.OpenBracketToken;
+import org.eclipse.scout.commons.parsers.sql.SqlParserToken.OrExpr;
+import org.eclipse.scout.commons.parsers.sql.SqlParserToken.OrOp;
+import org.eclipse.scout.commons.parsers.sql.SqlParserToken.OuterJoinToken;
+import org.eclipse.scout.commons.parsers.sql.SqlParserToken.Part;
+import org.eclipse.scout.commons.parsers.sql.SqlParserToken.PartToken;
+import org.eclipse.scout.commons.parsers.sql.SqlParserToken.Raw;
+import org.eclipse.scout.commons.parsers.sql.SqlParserToken.SingleStatement;
+import org.eclipse.scout.commons.parsers.sql.SqlParserToken.Statement;
+import org.eclipse.scout.commons.parsers.sql.SqlParserToken.Text;
+import org.eclipse.scout.commons.parsers.sql.SqlParserToken.UnaryPrefix;
+import org.eclipse.scout.commons.parsers.sql.SqlParserToken.UnaryPrefixExpr;
+import org.eclipse.scout.commons.parsers.sql.SqlParserToken.UnionToken;
+import org.eclipse.scout.commons.parsers.sql.SqlParserToken.Unparsed;
+import org.eclipse.scout.commons.parsers.token.TextToken;
+
+/**
+ * Parser for sql SELECT statements
+ * Syntax (EBNF):
+ *
+ * <pre>
+ * <code>
+ * Statement = SingleStatement (UnionToken SingleStatement)* (Unparsed)?
+ * SingleStatement = Part+ {with first part being a statement root part such as SELECT, INSERT, WITH, ...}
+ * Part = PartToken ListExpr
+ * ListExpr = OrExpr (ListSeparator OrExpr)*
+ * OrExpr = AndExpr (OrOp AndExpr)*
+ * AndExpr = MathExpr (AndOp MathExpr)*
+ * MathExpr = _simpleExpr (MathOp _simpleExpr)*
+ * _simpleExpr = UnaryPrefixExpr | MinusExpr | Atom
+ * UnaryPrefixExpr = UnaryPrefix Atom
+ * MinusExpr = BinaryOp['-'] Atom
+ * Atom= (BracketExpr | Statement | OrExpr | FunExpr | Name | Text | BinaryOp['*']) (OuterJoinToken)? (Name[alias])?
+ * BracketExpr = OpenBracketToken (Statement | ListExpr) CloseBracketToken
+ * FunExpr = Name BracketExpr
+ * Bind = ':' any until whitespace | '#' any '#' | '&' any '&'
+ * Name = nameChar+
+ * nameChar = {a-zA-Z0-9_$.@:?}
+ * </code>
+ * </pre>
+ */
+public class SqlParser {
+ private static IScoutLogger logger = ScoutLogManager.getLogger(SqlParser.class);
+
+ private static final String nameChars = "a-zA-Z0-9_$.@:?";
+ private static final Pattern COMMENT_PAT = Pattern.compile("(\\{[^\\}]*\\})");
+ private static final Pattern APOS_PAT = Pattern.compile("('[^']*')");
+ private static final Pattern QUOT_PAT = Pattern.compile("(\"[^\"]*\")");
+ //make all uppercase and single space (order of tokens matters!)
+ private static final Pattern UNION_PAT = Pattern.compile("[^" + nameChars + "](UNION ALL|INTERSECT|MINUS|UNION)[^" + nameChars + "]");
+ private static final Pattern PART_PAT = Pattern.compile("[^" + nameChars + "](WITH|AS|SELECT|FROM|LEFT JOIN|OUTER JOIN|INNER JOIN|JOIN|ON|WHERE|GROUP BY|HAVING|ORDER BY|INSERT INTO|INSERT|INTO|CONNECT BY( NOCYCLE)?|START WITH|UPDATE|DELETE FROM|DELETE|SET|VALUES|CASE|ELSE|END|THEN|WHEN)[^" + nameChars + "]");
+ private static final Pattern OUTER_JOIN_PAT = Pattern.compile("(\\(\\+\\))");
+ private static final Pattern OR_OP_PAT = Pattern.compile("[^" + nameChars + "](OR)[^" + nameChars + "]");
+ private static final Pattern AND_OP_PAT = Pattern.compile("[^" + nameChars + "](AND)[^" + nameChars + "]");
+ private static final Pattern MATH_OP_PAT1 = Pattern.compile("[^" + nameChars + "](NOT IN|IN|IS NOT|IS|NOT BETWEEN|BETWEEN|NOT LIKE|LIKE)[^" + nameChars + "]");
+ private static final Pattern MATH_OP_PAT2 = Pattern.compile("(=|<>|!=|<=|>=|<|>|\\%|\\^|\\+|\\-|\\*|/|\\|\\||\\&\\&)");
+ private static final Pattern UNARY_PREFIX_PAT = Pattern.compile("[^" + nameChars + "](NOT|DISTINCT|NEW)[^" + nameChars + "]");
+ //eliminate all remaining spaces
+ private static final Pattern NAME_PAT = Pattern.compile("([" + nameChars + "]+)");
+ private static final Pattern OPEN_BRACKET_PAT = Pattern.compile("([(])");
+ private static final Pattern CLOSE_BRACKET_PAT = Pattern.compile("([)])");
+ private static final Pattern LIST_SEPARATOR_PAT = Pattern.compile("([,])");
+
+ /**
+ * avoid dead-lock
+ */
+ private static class ParseContext {
+ private HashSet<ParseStep> m_steps;
+ private HashMap<String, String> m_bindMap;
+
+ public ParseContext() {
+ m_steps = new HashSet<ParseStep>();
+ m_bindMap = new HashMap<String, String>();
+ }
+
+ public Map<String/*code*/, String/*name*/> getBinds() {
+ return m_bindMap;
+ }
+
+ /**
+ * @return true if the operation can be performed and the context was added, returns false when the operation is a
+ * loop and the context was NOT added
+ */
+ public ParseStep checkAndAdd(String method, List<IToken> list) {
+ ParseStep step = new ParseStep(method, list.size() > 0 ? list.get(0) : null);
+ if (m_steps.contains(step)) {
+ return null;
+ }
+ m_steps.add(step);
+ return step;
+ }
+
+ public void remove(ParseStep step) {
+ m_steps.remove(step);
+ }
+ }
+
+ private static class ParseStep {
+ private final String m_method;
+ private final IToken m_token;
+
+ public ParseStep(String method, IToken token) {
+ m_method = method;
+ m_token = token;
+ }
+
+ @Override
+ public int hashCode() {
+ return m_method.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (!(obj instanceof ParseStep)) {
+ return false;
+ }
+ ParseStep o = (ParseStep) obj;
+ return this.m_method.equals(o.m_method) && this.m_token == o.m_token;
+ }
+
+ @Override
+ public String toString() {
+ return m_method + ": " + m_token;
+ }
+ }
+
+ public SqlParser() {
+ }
+
+ public Statement parse(String s) {
+ ParseContext ctx = new ParseContext();
+ List<IToken> list = tokenize(s, ctx);
+ Statement stm = parseStatement(list, ctx);
+ //sometimes sql is wrapped into brackets
+ if (stm == null) {
+ ctx = new ParseContext();
+ list = tokenize(s, ctx);
+ BracketExpr be = parseBracketExpr(list, ctx);
+ if (be != null) {
+ for (IToken t : be.getChildren()) {
+ if (t instanceof Statement) {
+ stm = (Statement) t;
+ break;
+ }
+ }
+ }
+ }
+ if (list.size() > 0) {
+ Unparsed up = new Unparsed();
+ up.setText(flatten(list));
+ if (stm == null) {
+ stm = new Statement();
+ }
+ stm.addChild(up);
+ }
+ return stm;
+ }
+
+ private Statement parseStatement(List<IToken> list, ParseContext ctx) {
+ //SingleStatement (UnionToken SingleStatement)*
+ ParseStep lock = ctx.checkAndAdd("Statement", list);
+ if (lock == null) {
+ return null;
+ }
+ try {
+ IToken ss = parseSingleStatement(list, ctx);
+ if (ss == null) {
+ return null;
+ }
+ Statement s = new Statement();
+ s.addChild(ss);
+ UnionToken u;
+ IToken nexts = null;
+ while ((u = removeToken(list, UnionToken.class)) != null && (nexts = parseSingleStatement(list, ctx)) != null) {
+ s.addChild(u);
+ s.addChild(nexts);
+ }
+ //restore incomplete
+ if (u != null && nexts == null) {
+ list.add(0, u);
+ }
+ return s;
+ }
+ finally {
+ ctx.remove(lock);
+ }
+ }
+
+ /**
+ * return {@link SingleStatement} or {@link BracketExpr}
+ */
+ private IToken parseSingleStatement(List<IToken> list, ParseContext ctx) {
+ ParseStep lock = ctx.checkAndAdd("SingleStatement", list);
+ if (lock == null) {
+ return null;
+ }
+ try {
+ //brackets
+ ArrayList<IToken> backup = new ArrayList<IToken>(list);
+ BracketExpr be = parseBracketExpr(list, ctx);
+ if (be != null) {
+ BracketExpr tmp = be;
+ while (tmp != null) {
+ IToken ch = tmp.getChildren().get(1);//open, token, close
+ if (ch instanceof BracketExpr) {
+ tmp = (BracketExpr) ch;
+ }
+ else if (ch instanceof Statement) {
+ return be;
+ }
+ else if (ch instanceof SingleStatement) {
+ return be;
+ }
+ else {
+ tmp = null;
+ }
+ }
+ //restore
+ list.clear();
+ list.addAll(backup);
+ return null;
+ }
+ //
+ //Part+
+ Part p;
+ SingleStatement ss = new SingleStatement();
+ if ((p = parsePart(list, ctx, true)) != null) {
+ //ok
+ ss.addChild(p);
+ }
+ else {
+ return null;
+ }
+ while ((p = parsePart(list, ctx, false)) != null) {
+ ss.addChild(p);
+ }
+ if (ss.getChildren().size() == 0) {
+ return null;
+ }
+ return ss;
+ }
+ finally {
+ ctx.remove(lock);
+ }
+ }
+
+ private Part parsePart(List<IToken> list, ParseContext ctx, boolean rootPart) {
+ //PartToken ListExpr
+ ParseStep lock = ctx.checkAndAdd("Part", list);
+ if (lock == null) {
+ return null;
+ }
+ try {
+ PartToken pt;
+ ListExpr le;
+ if ((pt = removeToken(list, PartToken.class)) != null && (!rootPart || isRootPartToken(pt))) {
+ //ok
+ le = parseListExpr(list, ctx);
+ }
+ else {
+ //restore incomplete
+ if (pt != null) {
+ list.add(0, pt);
+ }
+ return null;
+ }
+ Part p = new Part();
+ p.addChild(pt);
+ if (le != null) {
+ p.addChild(le);
+ }
+ return p;
+ }
+ finally {
+ ctx.remove(lock);
+ }
+ }
+
+ private boolean isRootPartToken(PartToken pt) {
+ String s = pt.getText();
+ if (s.equals("SELECT")) {
+ return true;
+ }
+ if (s.equals("INSERT INTO")) {
+ return true;
+ }
+ if (s.equals("INSERT")) {
+ return true;
+ }
+ if (s.equals("UPDATE")) {
+ return true;
+ }
+ if (s.equals("DELETE FROM")) {
+ return true;
+ }
+ if (s.equals("DELETE")) {
+ return true;
+ }
+ if (s.equals("CASE")) {
+ return true;
+ }
+ if (s.equals("WITH")) {
+ return true;
+ }
+ return false;
+ }
+
+ private ListExpr parseListExpr(List<IToken> list, ParseContext ctx) {
+ //OrExpr (ListSeparator OrExpr)*
+ ParseStep lock = ctx.checkAndAdd("ListExpr", list);
+ if (lock == null) {
+ return null;
+ }
+ try {
+ OrExpr oe = parseOrExpr(list, ctx);
+ if (oe == null) {
+ return null;
+ }
+ ListExpr le = new ListExpr();
+ le.addChild(oe);
+ ListSeparator ls = null;
+ while ((ls = removeToken(list, ListSeparator.class)) != null && (oe = parseOrExpr(list, ctx)) != null) {
+ le.addChild(ls);
+ le.addChild(oe);
+ }
+ //restore incomplete
+ if (ls != null && oe == null) {
+ list.add(0, ls);
+ }
+ return le;
+ }
+ finally {
+ ctx.remove(lock);
+ }
+ }
+
+ private OrExpr parseOrExpr(List<IToken> list, ParseContext ctx) {
+ //AndExpr (BinaryOp['OR'] AndExpr)*
+ ParseStep lock = ctx.checkAndAdd("OrExpr", list);
+ if (lock == null) {
+ return null;
+ }
+ try {
+ AndExpr ae = parseAndExpr(list, ctx);
+ if (ae == null) {
+ return null;
+ }
+ OrExpr oe = new OrExpr();
+ oe.addChild(ae);
+ OrOp oo;
+ while ((oo = removeToken(list, OrOp.class)) != null && (ae = parseAndExpr(list, ctx)) != null) {
+ oe.addChild(oo);
+ oe.addChild(ae);
+ }
+ //remaining?
+ if (oo != null) {
+ oo.addComment(new Comment("/*syntax warning*/"));
+ oe.addChild(oo);
+ }
+ return oe;
+ }
+ finally {
+ ctx.remove(lock);
+ }
+ }
+
+ private AndExpr parseAndExpr(List<IToken> list, ParseContext ctx) {
+ //MathExpr (BinaryOp['AND'] MathExpr)*
+ ParseStep lock = ctx.checkAndAdd("AndExpr", list);
+ if (lock == null) {
+ return null;
+ }
+ try {
+ IToken me = parseMathExpr(list, ctx);
+ if (me == null) {
+ return null;
+ }
+ AndExpr ae = new AndExpr();
+ ae.addChild(me);
+ AndOp ao;
+ while ((ao = removeToken(list, AndOp.class)) != null && (me = parseMathExpr(list, ctx)) != null) {
+ ae.addChild(ao);
+ ae.addChild(me);
+ }
+ //remaining?
+ if (ao != null) {
+ ao.addComment(new Comment("/*syntax warning*/"));
+ ae.addChild(ao);
+ }
+ return ae;
+ }
+ finally {
+ ctx.remove(lock);
+ }
+ }
+
+ private MathExpr parseMathExpr(List<IToken> list, ParseContext ctx) {
+ //_simpleExpr (BinaryOp _simpleExpr)*
+ ParseStep lock = ctx.checkAndAdd("MathExpr", list);
+ if (lock == null) {
+ return null;
+ }
+ try {
+ IToken se = parseSimpleExpr(list, ctx);
+ if (se == null) {
+ return null;
+ }
+ MathExpr me = new MathExpr();
+ me.addChild(se);
+ MathOp mo;
+ while ((mo = removeToken(list, MathOp.class)) != null && (se = parseSimpleExpr(list, ctx)) != null) {
+ me.addChild(mo);
+ me.addChild(se);
+ }
+ //restore incomplete
+ if (mo != null && se == null) {
+ list.add(0, mo);
+ }
+ return me;
+ }
+ finally {
+ ctx.remove(lock);
+ }
+ }
+
+ private IToken parseSimpleExpr(List<IToken> list, ParseContext ctx) {
+ //UnaryPrefixExpr | MinusExpr | Atom
+ ParseStep lock = ctx.checkAndAdd("SimpleExpr", list);
+ if (lock == null) {
+ return null;
+ }
+ try {
+ IToken t;
+ if ((t = parseUnaryPrefixExpr(list, ctx)) != null) {
+ return t;
+ }
+ if ((t = parseMinusExpr(list, ctx)) != null) {
+ return t;
+ }
+ if ((t = parseAtom(list, ctx)) != null) {
+ return t;
+ }
+ return null;
+ }
+ finally {
+ ctx.remove(lock);
+ }
+ }
+
+ private UnaryPrefixExpr parseUnaryPrefixExpr(List<IToken> list, ParseContext ctx) {
+ //UnaryPrefix Atom
+ ParseStep lock = ctx.checkAndAdd("UnaryPrefixExpr", list);
+ if (lock == null) {
+ return null;
+ }
+ try {
+ UnaryPrefix up = null;
+ IToken a = null;
+ if ((up = removeToken(list, UnaryPrefix.class)) != null && (a = parseAtom(list, ctx)) != null) {
+ //ok
+ }
+ else {
+ //restore incomplete
+ if (up != null && a == null) {
+ list.add(0, up);
+ }
+ return null;
+ }
+ UnaryPrefixExpr e = new UnaryPrefixExpr();
+ e.addChild(up);
+ e.addChild(a);
+ return e;
+ }
+ finally {
+ ctx.remove(lock);
+ }
+ }
+
+ private MinusExpr parseMinusExpr(List<IToken> list, ParseContext ctx) {
+ //BinaryOp['-'] Atom
+ ParseStep lock = ctx.checkAndAdd("MinusExpr", list);
+ if (lock == null) {
+ return null;
+ }
+ try {
+ MathOp mo = null;
+ IToken a = null;
+ if ((mo = removeToken(list, MathOp.class, "-")) != null && (a = parseAtom(list, ctx)) != null) {
+ //ok
+ }
+ else {
+ //restore incomplete
+ if (mo != null && a == null) {
+ list.add(0, mo);
+ }
+ return null;
+ }
+ MinusExpr e = new MinusExpr();
+ e.addChild(mo);
+ e.addChild(a);
+ return e;
+ }
+ finally {
+ ctx.remove(lock);
+ }
+ }
+
+ private FunExpr parseFunExpr(List<IToken> list, ParseContext ctx) {
+ //Name BracketExpr
+ ParseStep lock = ctx.checkAndAdd("FunExpr", list);
+ if (lock == null) {
+ return null;
+ }
+ try {
+ Name nm = null;
+ BracketExpr be = null;
+ if ((nm = removeToken(list, Name.class)) != null && (be = parseBracketExpr(list, ctx)) != null) {
+ //ok
+ }
+ else {
+ //restore incomplete
+ if (nm != null && be == null) {
+ list.add(0, nm);
+ }
+ return null;
+ }
+ FunExpr e = new FunExpr();
+ e.addChild(nm);
+ e.addChild(be);
+ return e;
+ }
+ finally {
+ ctx.remove(lock);
+ }
+ }
+
+ private BracketExpr parseBracketExpr(List<IToken> list, ParseContext ctx) {
+ //BracketExpr = OpenBracketToken (Statement | ListExpr) CloseBracketToken
+ ParseStep lock = ctx.checkAndAdd("BracketExpr", list);
+ if (lock == null) {
+ return null;
+ }
+ try {
+ IToken open = null;
+ IToken t = null;
+ IToken close = null;
+ ArrayList<IToken> backup = new ArrayList<IToken>(list);
+ if ((open = removeToken(list, OpenBracketToken.class)) != null && ((t = parseStatement(list, ctx)) != null || (t = parseListExpr(list, ctx)) != null || t == null) && (close = removeToken(list, CloseBracketToken.class)) != null) {
+ //ok
+ }
+ else {
+ //restore incomplete
+ list.clear();
+ list.addAll(backup);
+ return null;
+ }
+ BracketExpr e = new BracketExpr();
+ e.addChild(open);
+ if (t != null) {
+ e.addChild(t);
+ }
+ e.addChild(close);
+ return e;
+ }
+ finally {
+ ctx.remove(lock);
+ }
+ }
+
+ private Atom parseAtom(List<IToken> list, ParseContext ctx) {
+ //(BracketExpr Outer | Statement | OrExpr | FunExpr | Name | Text | BinaryOp['*']) (OuterJoinToken)? (Name["AS"])? (Name[alias])?
+ ParseStep lock = ctx.checkAndAdd("Atom", list);
+ if (lock == null) {
+ return null;
+ }
+ try {
+ IToken t = null;
+ if ((t = parseBracketExpr(list, ctx)) != null) {
+ //ok
+ }
+ else if ((t = parseStatement(list, ctx)) != null) {
+ //ok
+ }
+ else if ((t = parseOrExpr(list, ctx)) != null) {
+ //ok
+ }
+ else if ((t = parseFunExpr(list, ctx)) != null) {
+ //ok
+ }
+ else if ((t = removeToken(list, Name.class)) != null) {
+ //ok
+ }
+ else if ((t = removeToken(list, Text.class)) != null) {
+ //ok
+ }
+ else if ((t = removeToken(list, MathOp.class, "*")) != null) {
+ //ok
+ }
+ else {
+ return null;
+ }
+ //found a match
+ Atom a = new Atom();
+ a.addChild(t);
+ if ((t = removeToken(list, OuterJoinToken.class)) != null) {
+ a.addChild(t);
+ }
+ if ((t = removeToken(list, Name.class)) != null) {
+ a.addChild(t);
+ }
+ return a;
+ }
+ finally {
+ ctx.remove(lock);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private <T extends IToken> T removeToken(List<IToken> list, Class<T> tokenType) {
+ if (0 < list.size() && tokenType.isAssignableFrom(list.get(0).getClass())) {
+ return (T) list.remove(0);
+ }
+ return null;
+ }
+
+ @SuppressWarnings("unchecked")
+ private <T extends IToken> T removeToken(List<IToken> list, Class<T> tokenType, String text) {
+ if (0 < list.size() && tokenType.isAssignableFrom(list.get(0).getClass()) && text.equals(list.get(0).getText())) {
+ return (T) list.remove(0);
+ }
+ return null;
+ }
+
+ /**
+ * Tokenize a string into Whitespace (containing Comment and HintComment), Text and Token items.
+ * There are no Raw objects left.
+ *
+ * @throws ParseException
+ */
+ private List<IToken> tokenize(String s, ParseContext ctx) {
+ s = encodeBinds(s, ctx);
+ s = s.replaceAll("[\\n\\r]+", " ");
+ List<IToken> list = new ArrayList<IToken>();
+ list.add(new Raw(s));
+ //
+ list = tokenizeRaw(list, COMMENT_PAT, Comment.class, true);
+ list = tokenizeRaw(list, APOS_PAT, Text.class, true);
+ list = tokenizeRaw(list, APOS_PAT, Text.class, false);
+ list = tokenizeRaw(list, QUOT_PAT, Name.class, true);
+ list = tokenizeRaw(list, QUOT_PAT, Name.class, false);
+ //replace all remaining whitespace by a single space and convert to upper case
+ for (IToken item : list) {
+ if (item instanceof Raw) {
+ String text = item.getText();
+ text = text.replaceAll("[\\s]+", " ");
+ text = text.toUpperCase();
+ item.setText(text);
+ }
+ }
+ list = tokenizeRaw(list, UNION_PAT, UnionToken.class, false);
+ list = tokenizeRaw(list, PART_PAT, PartToken.class, false);
+ list = tokenizeRaw(list, OUTER_JOIN_PAT, OuterJoinToken.class, false);
+ list = tokenizeRaw(list, OR_OP_PAT, OrOp.class, false);
+ list = tokenizeRaw(list, AND_OP_PAT, AndOp.class, false);
+ list = tokenizeRaw(list, MATH_OP_PAT1, MathOp.class, false);
+ list = tokenizeRaw(list, MATH_OP_PAT2, MathOp.class, false);
+ list = tokenizeRaw(list, UNARY_PREFIX_PAT, UnaryPrefix.class, false);
+ list = tokenizeRaw(list, NAME_PAT, Name.class, false);
+ list = tokenizeRaw(list, OPEN_BRACKET_PAT, OpenBracketToken.class, false);
+ list = tokenizeRaw(list, CLOSE_BRACKET_PAT, CloseBracketToken.class, false);
+ list = tokenizeRaw(list, LIST_SEPARATOR_PAT, ListSeparator.class, false);
+ //eliminate all empty Raw
+ for (Iterator<IToken> it = list.iterator(); it.hasNext();) {
+ IToken item = it.next();
+ if (item instanceof Raw) {
+ if (item.getText().trim().length() == 0) {
+ it.remove();
+ }
+ }
+ }
+ //check the rest, no more Raw, convert to comment with warning
+ for (int i = 0; i < list.size(); i++) {
+ IToken tok = list.get(i);
+ if (tok instanceof Raw) {
+ list.remove(i);
+ Comment c = new Comment();
+ c.setText("/*XXX unexpected token: " + tok.getText() + "*/");
+ list.add(i, c);
+ }
+ }
+ //associate comments with the successor token
+ for (int i = 0; i < list.size(); i++) {
+ if (list.get(i) instanceof Comment) {
+ //find successor
+ IToken succ = null;
+ for (int k = i + 1; k < list.size(); k++) {
+ if (!(list.get(k) instanceof Comment)) {
+ succ = list.get(k);
+ break;
+ }
+ }
+ if (succ == null) {
+ for (int k = 0; k < list.size(); k++) {
+ if (!(list.get(k) instanceof Comment)) {
+ succ = list.get(k);
+ break;
+ }
+ }
+ }
+ if (succ != null) {
+ succ.addComment((Comment) list.get(i));
+ }
+ }
+ }
+ for (Iterator<IToken> it = list.iterator(); it.hasNext();) {
+ IToken item = it.next();
+ if (item instanceof Comment) {
+ it.remove();
+ }
+ }
+ decodeBinds(list, ctx);
+ return list;
+ }
+
+ private List<IToken> tokenizeRaw(List<IToken> list, Pattern p, Class<? extends IToken> tokenType, boolean transcodeDelimiters) {
+ ArrayList<IToken> newList = new ArrayList<IToken>(list.size());
+ for (IToken item : list) {
+ if (item instanceof Raw) {
+ String s = ((Raw) item).getText();
+ if (transcodeDelimiters) {
+ s = encodeDelimiters(s);
+ }
+ //extend s to start and end with an empty text (simpler regex can be used then)
+ s = " " + s + " ";
+ Matcher m = p.matcher(s);
+ int lastEnd = 0;
+ while (lastEnd < s.length() && m.find(lastEnd)) {
+ String r = s.substring(lastEnd, m.start(1));
+ if (transcodeDelimiters) {
+ r = decodeDelimiters(r);
+ }
+ newList.add(new Raw(r.trim()));
+ //
+ r = m.group(1);
+ if (transcodeDelimiters) {
+ r = decodeDelimiters(r);
+ }
+ IToken t;
+ try {
+ t = tokenType.newInstance();
+ }
+ catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ t.setText(r);
+ newList.add(t);
+ //
+ lastEnd = m.end(1);
+ }
+ //remaining part
+ if (lastEnd < s.length()) {
+ String r = s.substring(lastEnd);
+ if (transcodeDelimiters) {
+ r = decodeDelimiters(r);
+ }
+ newList.add(new Raw(r.trim()));
+ }
+ }
+ else {
+ newList.add(item);
+ }
+ }
+ return newList;
+ }
+
+ private String encodeBinds(String s, ParseContext ctx) {
+ BindModel m = new BindParser(s).parse();
+ for (org.eclipse.scout.commons.parsers.token.IToken bindToken : m.getAllTokens()) {
+ if (bindToken instanceof TextToken) {
+ continue;
+ }
+ String code = "___BIND" + ctx.getBinds().size();
+ String name = bindToken.getParsedToken();
+ bindToken.setReplaceToken(code);
+ ctx.getBinds().put(code, name);
+ }
+ return m.getFilteredStatement();
+ }
+
+ private void decodeBinds(List<IToken> list, ParseContext ctx) {
+ for (IToken t : list) {
+ if (t instanceof Name) {
+ String s = ctx.getBinds().get(t.getText());
+ if (s != null) {
+ t.setText(s);
+ }
+ }
+ }
+ }
+
+ /**
+ * @return text containing only the white space delimters and ' " { }
+ */
+ private String encodeDelimiters(String s) {
+ //backup chars and escapes
+ s = s.replace("$", "$0");
+ s = s.replace("{", "$1");
+ s = s.replace("}", "$2");
+ s = s.replace("''", "$3");
+ s = s.replace("\"\"", "$4");
+ //define single-char delimiters for comments
+ s = s.replace("/*", "{");
+ s = s.replace("*/", "}");
+ return s;
+ }
+
+ private String decodeDelimiters(String s) {
+ s = s.replace("}", "*/");
+ s = s.replace("{", "/*");
+ s = s.replace("$4", "\"\"");
+ s = s.replace("$3", "''");
+ s = s.replace("$2", "}");
+ s = s.replace("$1", "{");
+ s = s.replace("$0", "$");
+ return s;
+ }
+
+ private String flatten(List<IToken> list) {
+ StringBuffer buf = new StringBuffer();
+ for (IToken item : list) {
+ if (buf.length() > 0) {
+ buf.append(" ");
+ }
+ buf.append(item);
+ }
+ return buf.toString();
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/sql/SqlParserToken.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/sql/SqlParserToken.java
index 130c6d1f5a..5753ddca43 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/sql/SqlParserToken.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/sql/SqlParserToken.java
@@ -1,219 +1,219 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.parsers.sql;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-
-final class SqlParserToken {
- private static IScoutLogger logger = ScoutLogManager.getLogger(SqlParserToken.class);
-
- public static interface IToken {
- String getText();
-
- void setText(String text);
-
- void addChild(IToken child);
-
- void addChildren(List<IToken> children);
-
- List<IToken> getChildren();
-
- void addComment(Comment c);
-
- List<Comment> getComments();
- }
-
- public static abstract class AbstractToken implements IToken {
- private String m_text;
- private List<IToken> m_children;
- private List<Comment> m_comments;
-
- public AbstractToken() {
- }
-
- @Override
- public String getText() {
- return m_text;
- }
-
- @Override
- public void setText(String text) {
- m_text = text;
- }
-
- @Override
- public void addChild(IToken child) {
- if (m_children == null) {
- m_children = new ArrayList<IToken>();
- }
- m_children.add(child);
- }
-
- @Override
- public void addChildren(List<IToken> children) {
- if (m_children == null) {
- m_children = new ArrayList<IToken>();
- }
- m_children.addAll(children);
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public List<IToken> getChildren() {
- return m_children != null ? m_children : Collections.EMPTY_LIST;
- }
-
- @Override
- public void addComment(Comment c) {
- if (m_comments == null) {
- m_comments = new ArrayList<Comment>();
- }
- m_comments.add(c);
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public List<Comment> getComments() {
- return m_comments != null ? m_comments : Collections.EMPTY_LIST;
- }
-
- @Override
- public String toString() {
- StringBuffer buf = new StringBuffer();
- if (getText() != null) {
- buf.append(getText());
- }
- for (IToken t : getChildren()) {
- if (buf.length() > 0) {
- buf.append(" ");
- }
- buf.append(t.toString());
- }
- return buf.toString();
- }
- }
-
- public static class Raw extends AbstractToken {
- public Raw(String text) {
- setText(text);
- }
- }
-
- public static class Comment extends AbstractToken {
- public Comment() {
- }
-
- public Comment(String text) {
- setText(text);
- }
- }
-
- public static class Text extends AbstractToken {
- }
-
- public static class Name extends AbstractToken {
- }
-
- public static class UnionToken extends AbstractToken {
- }
-
- public static class PartToken extends AbstractToken {
- }
-
- public static class UnaryPrefix extends AbstractToken {
- }
-
- public static class OuterJoinToken extends AbstractToken {
- }
-
- public static class OrOp extends AbstractToken {
- }
-
- public static class AndOp extends AbstractToken {
- }
-
- public static class MathOp extends AbstractToken {
- }
-
- public static class OpenBracketToken extends AbstractToken {
- private int m_level;
-
- public int getLevel() {
- return m_level;
- }
-
- public void setLevel(int level) {
- m_level = level;
- }
- }
-
- public static class CloseBracketToken extends AbstractToken {
- private int m_level;
-
- public int getLevel() {
- return m_level;
- }
-
- public void setLevel(int level) {
- m_level = level;
- }
- }
-
- public static class ListSeparator extends AbstractToken {
- }
-
- public static class Statement extends AbstractToken {
- }
-
- public static class SingleStatement extends AbstractToken {
- }
-
- public static class Part extends AbstractToken {
- }
-
- public static class ListExpr extends AbstractToken {
- }
-
- public static class OrExpr extends AbstractToken {
- }
-
- public static class AndExpr extends AbstractToken {
- }
-
- public static class UnaryPrefixExpr extends AbstractToken {
- }
-
- public static class MinusExpr extends AbstractToken {
- }
-
- public static class MathExpr extends AbstractToken {
- }
-
- public static class FunExpr extends AbstractToken {
- }
-
- public static class BracketExpr extends AbstractToken {
- }
-
- public static class Atom extends AbstractToken {
- }
-
- public static class Unparsed extends AbstractToken {
- }
-
- public SqlParserToken() {
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.parsers.sql;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+
+final class SqlParserToken {
+ private static IScoutLogger logger = ScoutLogManager.getLogger(SqlParserToken.class);
+
+ public static interface IToken {
+ String getText();
+
+ void setText(String text);
+
+ void addChild(IToken child);
+
+ void addChildren(List<IToken> children);
+
+ List<IToken> getChildren();
+
+ void addComment(Comment c);
+
+ List<Comment> getComments();
+ }
+
+ public static abstract class AbstractToken implements IToken {
+ private String m_text;
+ private List<IToken> m_children;
+ private List<Comment> m_comments;
+
+ public AbstractToken() {
+ }
+
+ @Override
+ public String getText() {
+ return m_text;
+ }
+
+ @Override
+ public void setText(String text) {
+ m_text = text;
+ }
+
+ @Override
+ public void addChild(IToken child) {
+ if (m_children == null) {
+ m_children = new ArrayList<IToken>();
+ }
+ m_children.add(child);
+ }
+
+ @Override
+ public void addChildren(List<IToken> children) {
+ if (m_children == null) {
+ m_children = new ArrayList<IToken>();
+ }
+ m_children.addAll(children);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public List<IToken> getChildren() {
+ return m_children != null ? m_children : Collections.EMPTY_LIST;
+ }
+
+ @Override
+ public void addComment(Comment c) {
+ if (m_comments == null) {
+ m_comments = new ArrayList<Comment>();
+ }
+ m_comments.add(c);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public List<Comment> getComments() {
+ return m_comments != null ? m_comments : Collections.EMPTY_LIST;
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer buf = new StringBuffer();
+ if (getText() != null) {
+ buf.append(getText());
+ }
+ for (IToken t : getChildren()) {
+ if (buf.length() > 0) {
+ buf.append(" ");
+ }
+ buf.append(t.toString());
+ }
+ return buf.toString();
+ }
+ }
+
+ public static class Raw extends AbstractToken {
+ public Raw(String text) {
+ setText(text);
+ }
+ }
+
+ public static class Comment extends AbstractToken {
+ public Comment() {
+ }
+
+ public Comment(String text) {
+ setText(text);
+ }
+ }
+
+ public static class Text extends AbstractToken {
+ }
+
+ public static class Name extends AbstractToken {
+ }
+
+ public static class UnionToken extends AbstractToken {
+ }
+
+ public static class PartToken extends AbstractToken {
+ }
+
+ public static class UnaryPrefix extends AbstractToken {
+ }
+
+ public static class OuterJoinToken extends AbstractToken {
+ }
+
+ public static class OrOp extends AbstractToken {
+ }
+
+ public static class AndOp extends AbstractToken {
+ }
+
+ public static class MathOp extends AbstractToken {
+ }
+
+ public static class OpenBracketToken extends AbstractToken {
+ private int m_level;
+
+ public int getLevel() {
+ return m_level;
+ }
+
+ public void setLevel(int level) {
+ m_level = level;
+ }
+ }
+
+ public static class CloseBracketToken extends AbstractToken {
+ private int m_level;
+
+ public int getLevel() {
+ return m_level;
+ }
+
+ public void setLevel(int level) {
+ m_level = level;
+ }
+ }
+
+ public static class ListSeparator extends AbstractToken {
+ }
+
+ public static class Statement extends AbstractToken {
+ }
+
+ public static class SingleStatement extends AbstractToken {
+ }
+
+ public static class Part extends AbstractToken {
+ }
+
+ public static class ListExpr extends AbstractToken {
+ }
+
+ public static class OrExpr extends AbstractToken {
+ }
+
+ public static class AndExpr extends AbstractToken {
+ }
+
+ public static class UnaryPrefixExpr extends AbstractToken {
+ }
+
+ public static class MinusExpr extends AbstractToken {
+ }
+
+ public static class MathExpr extends AbstractToken {
+ }
+
+ public static class FunExpr extends AbstractToken {
+ }
+
+ public static class BracketExpr extends AbstractToken {
+ }
+
+ public static class Atom extends AbstractToken {
+ }
+
+ public static class Unparsed extends AbstractToken {
+ }
+
+ public SqlParserToken() {
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/token/DatabaseSpecificToken.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/token/DatabaseSpecificToken.java
index 2c9f455479..191f4a0ab0 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/token/DatabaseSpecificToken.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/token/DatabaseSpecificToken.java
@@ -1,59 +1,59 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.parsers.token;
-
-public class DatabaseSpecificToken implements IToken {
- // sql text
- private String m_parsedToken;
- private String m_replaceToken;
- // bind info
- private String m_name;
-
- public DatabaseSpecificToken(String parsedToken, String name) {
- m_parsedToken = parsedToken;
- m_name = name;
- }
-
- @Override
- public boolean isInput() {
- return false;
- }
-
- @Override
- public boolean isOutput() {
- return false;
- }
-
- @Override
- public String getParsedToken() {
- return m_parsedToken;
- }
-
- @Override
- public String getReplaceToken() {
- if (m_replaceToken != null) {
- return m_replaceToken;
- }
- else {
- return m_parsedToken;
- }
- }
-
- @Override
- public void setReplaceToken(String s) {
- m_replaceToken = s;
- }
-
- public String getName() {
- return m_name;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.parsers.token;
+
+public class DatabaseSpecificToken implements IToken {
+ // sql text
+ private String m_parsedToken;
+ private String m_replaceToken;
+ // bind info
+ private String m_name;
+
+ public DatabaseSpecificToken(String parsedToken, String name) {
+ m_parsedToken = parsedToken;
+ m_name = name;
+ }
+
+ @Override
+ public boolean isInput() {
+ return false;
+ }
+
+ @Override
+ public boolean isOutput() {
+ return false;
+ }
+
+ @Override
+ public String getParsedToken() {
+ return m_parsedToken;
+ }
+
+ @Override
+ public String getReplaceToken() {
+ if (m_replaceToken != null) {
+ return m_replaceToken;
+ }
+ else {
+ return m_parsedToken;
+ }
+ }
+
+ @Override
+ public void setReplaceToken(String s) {
+ m_replaceToken = s;
+ }
+
+ public String getName() {
+ return m_name;
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/token/FunctionInputToken.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/token/FunctionInputToken.java
index 937504f6ac..12a7cfcbf7 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/token/FunctionInputToken.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/token/FunctionInputToken.java
@@ -1,96 +1,96 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.parsers.token;
-
-/**
- * Prepared statement input bind can be a batch bind can be a plain bind
- */
-public class FunctionInputToken implements IToken {
- // sql text
- private String m_parsedToken;
- private String m_replaceToken;
- private boolean m_plainValue;
- private boolean m_plainSql;
- private boolean m_plainToken;
- // bind info
- private String m_name;
- private String[] m_args;
-
- public FunctionInputToken(String parsedToken, String name, String[] args, boolean plainValue, boolean plainSql) {
- m_parsedToken = parsedToken;
- m_name = name;
- m_args = args;
- m_plainValue = plainValue;
- m_plainSql = plainSql;
- }
-
- @Override
- public boolean isInput() {
- return true;
- }
-
- @Override
- public boolean isOutput() {
- return false;
- }
-
- @Override
- public String getParsedToken() {
- return m_parsedToken;
- }
-
- @Override
- public String getReplaceToken() {
- if (m_replaceToken != null) {
- return m_replaceToken;
- }
- else {
- return m_parsedToken;
- }
- }
-
- @Override
- public void setReplaceToken(String s) {
- m_replaceToken = s;
- }
-
- public String getName() {
- return m_name;
- }
-
- public String[] getArgs() {
- return m_args;
- }
-
- public boolean isPlainValue() {
- return m_plainValue;
- }
-
- public void setPlainValue(boolean b) {
- m_plainValue = b;
- }
-
- public boolean isPlainToken() {
- return m_plainToken;
- }
-
- public void setPlainToken(boolean b) {
- m_plainToken = b;
- }
-
- public boolean isPlainSql() {
- return m_plainSql;
- }
-
- public void setPlainSql(boolean b) {
- m_plainSql = b;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.parsers.token;
+
+/**
+ * Prepared statement input bind can be a batch bind can be a plain bind
+ */
+public class FunctionInputToken implements IToken {
+ // sql text
+ private String m_parsedToken;
+ private String m_replaceToken;
+ private boolean m_plainValue;
+ private boolean m_plainSql;
+ private boolean m_plainToken;
+ // bind info
+ private String m_name;
+ private String[] m_args;
+
+ public FunctionInputToken(String parsedToken, String name, String[] args, boolean plainValue, boolean plainSql) {
+ m_parsedToken = parsedToken;
+ m_name = name;
+ m_args = args;
+ m_plainValue = plainValue;
+ m_plainSql = plainSql;
+ }
+
+ @Override
+ public boolean isInput() {
+ return true;
+ }
+
+ @Override
+ public boolean isOutput() {
+ return false;
+ }
+
+ @Override
+ public String getParsedToken() {
+ return m_parsedToken;
+ }
+
+ @Override
+ public String getReplaceToken() {
+ if (m_replaceToken != null) {
+ return m_replaceToken;
+ }
+ else {
+ return m_parsedToken;
+ }
+ }
+
+ @Override
+ public void setReplaceToken(String s) {
+ m_replaceToken = s;
+ }
+
+ public String getName() {
+ return m_name;
+ }
+
+ public String[] getArgs() {
+ return m_args;
+ }
+
+ public boolean isPlainValue() {
+ return m_plainValue;
+ }
+
+ public void setPlainValue(boolean b) {
+ m_plainValue = b;
+ }
+
+ public boolean isPlainToken() {
+ return m_plainToken;
+ }
+
+ public void setPlainToken(boolean b) {
+ m_plainToken = b;
+ }
+
+ public boolean isPlainSql() {
+ return m_plainSql;
+ }
+
+ public void setPlainSql(boolean b) {
+ m_plainSql = b;
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/token/IToken.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/token/IToken.java
index 572fbe295e..eef9f873fa 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/token/IToken.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/token/IToken.java
@@ -1,24 +1,24 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.parsers.token;
-
-public interface IToken {
-
- String getParsedToken();
-
- String getReplaceToken();
-
- void setReplaceToken(String s);
-
- boolean isInput();
-
- boolean isOutput();
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.parsers.token;
+
+public interface IToken {
+
+ String getParsedToken();
+
+ String getReplaceToken();
+
+ void setReplaceToken(String s);
+
+ boolean isInput();
+
+ boolean isOutput();
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/token/TextToken.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/token/TextToken.java
index ec7df92507..ee903c5688 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/token/TextToken.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/token/TextToken.java
@@ -1,49 +1,49 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.parsers.token;
-
-public class TextToken implements IToken {
- private String m_parsedToken;
-
- public TextToken(String parsedToken) {
- m_parsedToken = parsedToken;
- }
-
- @Override
- public boolean isInput() {
- return false;
- }
-
- @Override
- public boolean isOutput() {
- return false;
- }
-
- @Override
- public String getParsedToken() {
- return m_parsedToken;
- }
-
- @Override
- public String getReplaceToken() {
- return m_parsedToken;
- }
-
- @Override
- public void setReplaceToken(String s) {
- throw new IllegalArgumentException("Cannot replace content of a TextToken");
- }
-
- @Override
- public String toString() {
- return "TextToken[" + m_parsedToken + "]";
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.parsers.token;
+
+public class TextToken implements IToken {
+ private String m_parsedToken;
+
+ public TextToken(String parsedToken) {
+ m_parsedToken = parsedToken;
+ }
+
+ @Override
+ public boolean isInput() {
+ return false;
+ }
+
+ @Override
+ public boolean isOutput() {
+ return false;
+ }
+
+ @Override
+ public String getParsedToken() {
+ return m_parsedToken;
+ }
+
+ @Override
+ public String getReplaceToken() {
+ return m_parsedToken;
+ }
+
+ @Override
+ public void setReplaceToken(String s) {
+ throw new IllegalArgumentException("Cannot replace content of a TextToken");
+ }
+
+ @Override
+ public String toString() {
+ return "TextToken[" + m_parsedToken + "]";
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/token/ValueInputToken.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/token/ValueInputToken.java
index 1413b3a19d..a3d9c20348 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/token/ValueInputToken.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/token/ValueInputToken.java
@@ -1,160 +1,160 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.parsers.token;
-
-/**
- * Prepared statement input bind can be a batch bind can be a plain bind
- */
-public class ValueInputToken implements IToken {
- /**
- * sql text
- */
- private String m_parsedToken;
- /**
- * optional: the op left to the token
- */
- private String m_parsedOp;
- /**
- * optional: the attribute left to the op
- */
- private String m_parsedAttribute;
- private String m_replaceToken;
- // bind info
- private String m_name;
- private boolean m_plainValue;
- private boolean m_plainSql;
- private boolean m_batch;
-
- public ValueInputToken(String parsedToken, String name, boolean plainValue, boolean plainSql) {
- m_parsedToken = parsedToken;
- m_name = name;
- m_plainValue = plainValue;
- m_plainSql = plainSql;
- if (name.startsWith("{") && name.endsWith("}")) {
- m_name = m_name.substring(1, m_name.length() - 1);
- m_batch = true;
- }
- }
-
- @Override
- public boolean isInput() {
- return true;
- }
-
- @Override
- public boolean isOutput() {
- return false;
- }
-
- @Override
- public String getParsedToken() {
- return m_parsedToken;
- }
-
- @Override
- public String getReplaceToken() {
- if (m_replaceToken != null) {
- return m_replaceToken;
- }
- else {
- return m_parsedToken;
- }
- }
-
- @Override
- public void setReplaceToken(String s) {
- m_replaceToken = s;
- }
-
- public String getParsedOp() {
- return m_parsedOp;
- }
-
- public void setParsedOp(String s) {
- m_parsedOp = s;
- }
-
- public String getParsedAttribute() {
- return m_parsedAttribute;
- }
-
- public void setParsedAttribute(String s) {
- m_parsedAttribute = s;
- }
-
- public String getName() {
- return m_name;
- }
-
- public boolean isPlainValue() {
- return m_plainValue;
- }
-
- public void setPlainValue(boolean b) {
- m_plainValue = b;
- }
-
- public boolean isPlainSql() {
- return m_plainSql;
- }
-
- public void setPlainSql(boolean b) {
- m_plainSql = b;
- }
-
- public boolean isBatch() {
- return m_batch;
- }
-
- public void setBatch(boolean b) {
- m_batch = b;
- }
-
- @Override
- public String toString() {
- StringBuffer b = new StringBuffer();
- b.append(getClass().getSimpleName() + "[");
- b.append("parsed '");
- if (getParsedAttribute() != null) {
- b.append(getParsedAttribute());
- b.append(" ");
- }
- if (getParsedOp() != null) {
- b.append(getParsedOp());
- b.append(" ");
- }
- b.append(getParsedToken());
- b.append("'");
- b.append(", replaced '");
- if (getParsedAttribute() != null) {
- b.append(getParsedAttribute());
- b.append(" ");
- }
- if (getParsedOp() != null) {
- b.append(getParsedOp());
- b.append(" ");
- }
- b.append(getReplaceToken());
- b.append("'");
- if (isBatch()) {
- b.append(" batch");
- }
- if (isPlainSql()) {
- b.append(" plainSql");
- }
- if (isPlainValue()) {
- b.append(" plainValue");
- }
- b.append("]");
- return b.toString();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.parsers.token;
+
+/**
+ * Prepared statement input bind can be a batch bind can be a plain bind
+ */
+public class ValueInputToken implements IToken {
+ /**
+ * sql text
+ */
+ private String m_parsedToken;
+ /**
+ * optional: the op left to the token
+ */
+ private String m_parsedOp;
+ /**
+ * optional: the attribute left to the op
+ */
+ private String m_parsedAttribute;
+ private String m_replaceToken;
+ // bind info
+ private String m_name;
+ private boolean m_plainValue;
+ private boolean m_plainSql;
+ private boolean m_batch;
+
+ public ValueInputToken(String parsedToken, String name, boolean plainValue, boolean plainSql) {
+ m_parsedToken = parsedToken;
+ m_name = name;
+ m_plainValue = plainValue;
+ m_plainSql = plainSql;
+ if (name.startsWith("{") && name.endsWith("}")) {
+ m_name = m_name.substring(1, m_name.length() - 1);
+ m_batch = true;
+ }
+ }
+
+ @Override
+ public boolean isInput() {
+ return true;
+ }
+
+ @Override
+ public boolean isOutput() {
+ return false;
+ }
+
+ @Override
+ public String getParsedToken() {
+ return m_parsedToken;
+ }
+
+ @Override
+ public String getReplaceToken() {
+ if (m_replaceToken != null) {
+ return m_replaceToken;
+ }
+ else {
+ return m_parsedToken;
+ }
+ }
+
+ @Override
+ public void setReplaceToken(String s) {
+ m_replaceToken = s;
+ }
+
+ public String getParsedOp() {
+ return m_parsedOp;
+ }
+
+ public void setParsedOp(String s) {
+ m_parsedOp = s;
+ }
+
+ public String getParsedAttribute() {
+ return m_parsedAttribute;
+ }
+
+ public void setParsedAttribute(String s) {
+ m_parsedAttribute = s;
+ }
+
+ public String getName() {
+ return m_name;
+ }
+
+ public boolean isPlainValue() {
+ return m_plainValue;
+ }
+
+ public void setPlainValue(boolean b) {
+ m_plainValue = b;
+ }
+
+ public boolean isPlainSql() {
+ return m_plainSql;
+ }
+
+ public void setPlainSql(boolean b) {
+ m_plainSql = b;
+ }
+
+ public boolean isBatch() {
+ return m_batch;
+ }
+
+ public void setBatch(boolean b) {
+ m_batch = b;
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer b = new StringBuffer();
+ b.append(getClass().getSimpleName() + "[");
+ b.append("parsed '");
+ if (getParsedAttribute() != null) {
+ b.append(getParsedAttribute());
+ b.append(" ");
+ }
+ if (getParsedOp() != null) {
+ b.append(getParsedOp());
+ b.append(" ");
+ }
+ b.append(getParsedToken());
+ b.append("'");
+ b.append(", replaced '");
+ if (getParsedAttribute() != null) {
+ b.append(getParsedAttribute());
+ b.append(" ");
+ }
+ if (getParsedOp() != null) {
+ b.append(getParsedOp());
+ b.append(" ");
+ }
+ b.append(getReplaceToken());
+ b.append("'");
+ if (isBatch()) {
+ b.append(" batch");
+ }
+ if (isPlainSql()) {
+ b.append(" plainSql");
+ }
+ if (isPlainValue()) {
+ b.append(" plainValue");
+ }
+ b.append("]");
+ return b.toString();
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/token/ValueOutputToken.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/token/ValueOutputToken.java
index f11c3100b8..986ef5be6a 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/token/ValueOutputToken.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/parsers/token/ValueOutputToken.java
@@ -1,101 +1,101 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.parsers.token;
-
-/**
- * Select into result can be a batch
- */
-public class ValueOutputToken implements IToken {
- private String m_parsedToken;
- private String m_replaceToken;
- private String m_name;
- private boolean m_batch;
- private boolean m_selectInto;
-
- public ValueOutputToken(String parsedToken, String name, boolean selectInto) {
- m_parsedToken = parsedToken;
- m_name = name;
- m_selectInto = selectInto;
- if (name.startsWith("{") && name.endsWith("}")) {
- m_name = m_name.substring(1, m_name.length() - 1);
- m_batch = true;
- }
- }
-
- @Override
- public boolean isInput() {
- return false;
- }
-
- @Override
- public boolean isOutput() {
- return true;
- }
-
- @Override
- public String getParsedToken() {
- return m_parsedToken;
- }
-
- @Override
- public String getReplaceToken() {
- if (m_replaceToken != null) {
- return m_replaceToken;
- }
- else {
- return m_parsedToken;
- }
- }
-
- @Override
- public void setReplaceToken(String s) {
- m_replaceToken = s;
- }
-
- public String getName() {
- return m_name;
- }
-
- public boolean isSelectInto() {
- return m_selectInto;
- }
-
- public boolean isBatch() {
- return m_batch;
- }
-
- public void setBatch(boolean b) {
- m_batch = b;
- }
-
- @Override
- public String toString() {
- StringBuffer b = new StringBuffer();
- b.append(getClass().getSimpleName() + "[");
- b.append(m_name);
- b.append(" ");
- b.append("parsed '");
- b.append(getParsedToken());
- b.append("'");
- b.append(", replaced '");
- b.append(getReplaceToken());
- b.append("'");
- if (isBatch()) {
- b.append(" batch");
- }
- if (isSelectInto()) {
- b.append(" into");
- }
- b.append("]");
- return b.toString();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.parsers.token;
+
+/**
+ * Select into result can be a batch
+ */
+public class ValueOutputToken implements IToken {
+ private String m_parsedToken;
+ private String m_replaceToken;
+ private String m_name;
+ private boolean m_batch;
+ private boolean m_selectInto;
+
+ public ValueOutputToken(String parsedToken, String name, boolean selectInto) {
+ m_parsedToken = parsedToken;
+ m_name = name;
+ m_selectInto = selectInto;
+ if (name.startsWith("{") && name.endsWith("}")) {
+ m_name = m_name.substring(1, m_name.length() - 1);
+ m_batch = true;
+ }
+ }
+
+ @Override
+ public boolean isInput() {
+ return false;
+ }
+
+ @Override
+ public boolean isOutput() {
+ return true;
+ }
+
+ @Override
+ public String getParsedToken() {
+ return m_parsedToken;
+ }
+
+ @Override
+ public String getReplaceToken() {
+ if (m_replaceToken != null) {
+ return m_replaceToken;
+ }
+ else {
+ return m_parsedToken;
+ }
+ }
+
+ @Override
+ public void setReplaceToken(String s) {
+ m_replaceToken = s;
+ }
+
+ public String getName() {
+ return m_name;
+ }
+
+ public boolean isSelectInto() {
+ return m_selectInto;
+ }
+
+ public boolean isBatch() {
+ return m_batch;
+ }
+
+ public void setBatch(boolean b) {
+ m_batch = b;
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer b = new StringBuffer();
+ b.append(getClass().getSimpleName() + "[");
+ b.append(m_name);
+ b.append(" ");
+ b.append("parsed '");
+ b.append(getParsedToken());
+ b.append("'");
+ b.append(", replaced '");
+ b.append(getReplaceToken());
+ b.append("'");
+ if (isBatch()) {
+ b.append(" batch");
+ }
+ if (isSelectInto()) {
+ b.append(" into");
+ }
+ b.append("]");
+ return b.toString();
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/prefs/AbstractPreferences.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/prefs/AbstractPreferences.java
index b2c3363ada..7520adb054 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/prefs/AbstractPreferences.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/prefs/AbstractPreferences.java
@@ -1,276 +1,276 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.prefs;
-
-import org.eclipse.scout.commons.Base64Utility;
-import org.osgi.service.prefs.BackingStoreException;
-import org.osgi.service.prefs.Preferences;
-
-/**
- * Basic empty implementation of {@link Preferences}
- */
-public abstract class AbstractPreferences implements Preferences {
-
- private final String m_name;
-
- public AbstractPreferences(String name) {
- m_name = name;
- }
-
- protected abstract void putImpl(String key, String value);
-
- protected abstract String getImpl(String key);
-
- protected abstract void removeImpl(String key);
-
- protected abstract void clearImpl();
-
- @Override
- public String name() {
- return m_name;
- }
-
- @Override
- public String[] childrenNames() throws BackingStoreException {
- return new String[0];
- }
-
- @Override
- public Preferences parent() {
- return null;
- }
-
- @Override
- public Preferences node(String pathName) {
- return null;
- }
-
- @Override
- public boolean nodeExists(String pathName) throws BackingStoreException {
- return false;
- }
-
- @Override
- public void removeNode() throws BackingStoreException {
- }
-
- @Override
- public String absolutePath() {
- return "/" + name();
- }
-
- @Override
- public void flush() throws BackingStoreException {
- }
-
- @Override
- public void sync() throws BackingStoreException {
- }
-
- @Override
- public void clear() throws BackingStoreException {
- clearImpl();
- }
-
- @Override
- public void remove(String key) {
- removeImpl(key);
- }
-
- /*
- * @see org.osgi.service.prefs.Preferences#put(java.lang.String, java.lang.String)
- */
- @Override
- public void put(String key, String newValue) {
- internalPut(key, newValue);
- }
-
- private static final String TRUE = "true";
- private static final String FALSE = "false";
-
- /*
- * @see org.osgi.service.prefs.Preferences#putBoolean(java.lang.String, boolean)
- */
- @Override
- public void putBoolean(String key, boolean value) {
- String newValue = value ? TRUE : FALSE;
- internalPut(key, newValue);
- }
-
- /*
- * @see org.osgi.service.prefs.Preferences#putByteArray(java.lang.String, byte[])
- */
- @Override
- public void putByteArray(String key, byte[] value) {
- String newValue = new String(Base64Utility.encode(value));
- internalPut(key, newValue);
- }
-
- /*
- * @see org.osgi.service.prefs.Preferences#putDouble(java.lang.String, double)
- */
- @Override
- public void putDouble(String key, double value) {
- String newValue = Double.toString(value);
- internalPut(key, newValue);
- }
-
- /*
- * @see org.osgi.service.prefs.Preferences#putFloat(java.lang.String, float)
- */
- @Override
- public void putFloat(String key, float value) {
- String newValue = Float.toString(value);
- internalPut(key, newValue);
- }
-
- /*
- * @see org.osgi.service.prefs.Preferences#putInt(java.lang.String, int)
- */
- @Override
- public void putInt(String key, int value) {
- String newValue = Integer.toString(value);
- internalPut(key, newValue);
- }
-
- /*
- * @see org.osgi.service.prefs.Preferences#putLong(java.lang.String, long)
- */
- @Override
- public void putLong(String key, long value) {
- String newValue = Long.toString(value);
- internalPut(key, newValue);
- }
-
- /*
- * @see org.osgi.service.prefs.Preferences#get(java.lang.String, java.lang.String)
- */
- @Override
- public String get(String key, String def) {
- String value = internalGet(key);
- return value != null ? value : def;
- }
-
- /*
- * @see org.osgi.service.prefs.Preferences#getBoolean(java.lang.String, boolean)
- */
- @Override
- public boolean getBoolean(String key, boolean def) {
- String value = internalGet(key);
- return value != null ? TRUE.equalsIgnoreCase(value) : def;
- }
-
- /*
- * @see org.osgi.service.prefs.Preferences#getByteArray(java.lang.String, byte[])
- *
- */
- @Override
- public byte[] getByteArray(String key, byte[] def) {
- String value = internalGet(key);
- return value != null ? Base64Utility.decode(value) : def;
- }
-
- /*
- * @see org.osgi.service.prefs.Preferences#getDouble(java.lang.String, double)
- */
- @Override
- public double getDouble(String key, double def) {
- String value = internalGet(key);
- if (value != null) {
- try {
- return Double.parseDouble(value);
- }
- catch (NumberFormatException e) {
- //nop
- }
- }
- return def;
- }
-
- /*
- * @see org.osgi.service.prefs.Preferences#getFloat(java.lang.String, float)
- */
- @Override
- public float getFloat(String key, float def) {
- String value = internalGet(key);
- if (value != null) {
- try {
- return Float.parseFloat(value);
- }
- catch (NumberFormatException e) {
- // nop
- }
- }
- return def;
- }
-
- /*
- * @see org.osgi.service.prefs.Preferences#getInt(java.lang.String, int)
- */
- @Override
- public int getInt(String key, int def) {
- String value = internalGet(key);
- if (value != null) {
- try {
- return Integer.parseInt(value);
- }
- catch (NumberFormatException e) {
- //nop
- }
- }
- return def;
- }
-
- /*
- * @see org.osgi.service.prefs.Preferences#getLong(java.lang.String, long)
- */
- @Override
- public long getLong(String key, long def) {
- String value = internalGet(key);
- if (value != null) {
- try {
- return Long.parseLong(value);
- }
- catch (NumberFormatException e) {
- //nop
- }
- }
- return def;
- }
-
- /**
- * @return old value
- */
- protected String internalPut(String key, String newValue) {
- if (key == null) {
- throw new NullPointerException();
- }
- String oldValue = getImpl(key);
- if (newValue == oldValue || (newValue != null && newValue.equals(oldValue))) {
- //not changed
- }
- else {
- putImpl(key, newValue);
- }
- return oldValue;
- }
-
- /**
- * @return the value for the key or null when the key does not exist
- */
- protected String internalGet(String key) {
- if (key == null) {
- throw new NullPointerException();
- }
- return getImpl(key);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.prefs;
+
+import org.eclipse.scout.commons.Base64Utility;
+import org.osgi.service.prefs.BackingStoreException;
+import org.osgi.service.prefs.Preferences;
+
+/**
+ * Basic empty implementation of {@link Preferences}
+ */
+public abstract class AbstractPreferences implements Preferences {
+
+ private final String m_name;
+
+ public AbstractPreferences(String name) {
+ m_name = name;
+ }
+
+ protected abstract void putImpl(String key, String value);
+
+ protected abstract String getImpl(String key);
+
+ protected abstract void removeImpl(String key);
+
+ protected abstract void clearImpl();
+
+ @Override
+ public String name() {
+ return m_name;
+ }
+
+ @Override
+ public String[] childrenNames() throws BackingStoreException {
+ return new String[0];
+ }
+
+ @Override
+ public Preferences parent() {
+ return null;
+ }
+
+ @Override
+ public Preferences node(String pathName) {
+ return null;
+ }
+
+ @Override
+ public boolean nodeExists(String pathName) throws BackingStoreException {
+ return false;
+ }
+
+ @Override
+ public void removeNode() throws BackingStoreException {
+ }
+
+ @Override
+ public String absolutePath() {
+ return "/" + name();
+ }
+
+ @Override
+ public void flush() throws BackingStoreException {
+ }
+
+ @Override
+ public void sync() throws BackingStoreException {
+ }
+
+ @Override
+ public void clear() throws BackingStoreException {
+ clearImpl();
+ }
+
+ @Override
+ public void remove(String key) {
+ removeImpl(key);
+ }
+
+ /*
+ * @see org.osgi.service.prefs.Preferences#put(java.lang.String, java.lang.String)
+ */
+ @Override
+ public void put(String key, String newValue) {
+ internalPut(key, newValue);
+ }
+
+ private static final String TRUE = "true";
+ private static final String FALSE = "false";
+
+ /*
+ * @see org.osgi.service.prefs.Preferences#putBoolean(java.lang.String, boolean)
+ */
+ @Override
+ public void putBoolean(String key, boolean value) {
+ String newValue = value ? TRUE : FALSE;
+ internalPut(key, newValue);
+ }
+
+ /*
+ * @see org.osgi.service.prefs.Preferences#putByteArray(java.lang.String, byte[])
+ */
+ @Override
+ public void putByteArray(String key, byte[] value) {
+ String newValue = new String(Base64Utility.encode(value));
+ internalPut(key, newValue);
+ }
+
+ /*
+ * @see org.osgi.service.prefs.Preferences#putDouble(java.lang.String, double)
+ */
+ @Override
+ public void putDouble(String key, double value) {
+ String newValue = Double.toString(value);
+ internalPut(key, newValue);
+ }
+
+ /*
+ * @see org.osgi.service.prefs.Preferences#putFloat(java.lang.String, float)
+ */
+ @Override
+ public void putFloat(String key, float value) {
+ String newValue = Float.toString(value);
+ internalPut(key, newValue);
+ }
+
+ /*
+ * @see org.osgi.service.prefs.Preferences#putInt(java.lang.String, int)
+ */
+ @Override
+ public void putInt(String key, int value) {
+ String newValue = Integer.toString(value);
+ internalPut(key, newValue);
+ }
+
+ /*
+ * @see org.osgi.service.prefs.Preferences#putLong(java.lang.String, long)
+ */
+ @Override
+ public void putLong(String key, long value) {
+ String newValue = Long.toString(value);
+ internalPut(key, newValue);
+ }
+
+ /*
+ * @see org.osgi.service.prefs.Preferences#get(java.lang.String, java.lang.String)
+ */
+ @Override
+ public String get(String key, String def) {
+ String value = internalGet(key);
+ return value != null ? value : def;
+ }
+
+ /*
+ * @see org.osgi.service.prefs.Preferences#getBoolean(java.lang.String, boolean)
+ */
+ @Override
+ public boolean getBoolean(String key, boolean def) {
+ String value = internalGet(key);
+ return value != null ? TRUE.equalsIgnoreCase(value) : def;
+ }
+
+ /*
+ * @see org.osgi.service.prefs.Preferences#getByteArray(java.lang.String, byte[])
+ *
+ */
+ @Override
+ public byte[] getByteArray(String key, byte[] def) {
+ String value = internalGet(key);
+ return value != null ? Base64Utility.decode(value) : def;
+ }
+
+ /*
+ * @see org.osgi.service.prefs.Preferences#getDouble(java.lang.String, double)
+ */
+ @Override
+ public double getDouble(String key, double def) {
+ String value = internalGet(key);
+ if (value != null) {
+ try {
+ return Double.parseDouble(value);
+ }
+ catch (NumberFormatException e) {
+ //nop
+ }
+ }
+ return def;
+ }
+
+ /*
+ * @see org.osgi.service.prefs.Preferences#getFloat(java.lang.String, float)
+ */
+ @Override
+ public float getFloat(String key, float def) {
+ String value = internalGet(key);
+ if (value != null) {
+ try {
+ return Float.parseFloat(value);
+ }
+ catch (NumberFormatException e) {
+ // nop
+ }
+ }
+ return def;
+ }
+
+ /*
+ * @see org.osgi.service.prefs.Preferences#getInt(java.lang.String, int)
+ */
+ @Override
+ public int getInt(String key, int def) {
+ String value = internalGet(key);
+ if (value != null) {
+ try {
+ return Integer.parseInt(value);
+ }
+ catch (NumberFormatException e) {
+ //nop
+ }
+ }
+ return def;
+ }
+
+ /*
+ * @see org.osgi.service.prefs.Preferences#getLong(java.lang.String, long)
+ */
+ @Override
+ public long getLong(String key, long def) {
+ String value = internalGet(key);
+ if (value != null) {
+ try {
+ return Long.parseLong(value);
+ }
+ catch (NumberFormatException e) {
+ //nop
+ }
+ }
+ return def;
+ }
+
+ /**
+ * @return old value
+ */
+ protected String internalPut(String key, String newValue) {
+ if (key == null) {
+ throw new NullPointerException();
+ }
+ String oldValue = getImpl(key);
+ if (newValue == oldValue || (newValue != null && newValue.equals(oldValue))) {
+ //not changed
+ }
+ else {
+ putImpl(key, newValue);
+ }
+ return oldValue;
+ }
+
+ /**
+ * @return the value for the key or null when the key does not exist
+ */
+ protected String internalGet(String key) {
+ if (key == null) {
+ throw new NullPointerException();
+ }
+ return getImpl(key);
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/prefs/UserPreferences.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/prefs/UserPreferences.java
index 29499b9de1..2bb0760c77 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/prefs/UserPreferences.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/prefs/UserPreferences.java
@@ -1,88 +1,88 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.prefs;
-
-import org.eclipse.core.internal.preferences.EclipsePreferences;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.preferences.IEclipsePreferences;
-import org.eclipse.core.runtime.preferences.InstanceScope;
-import org.osgi.service.prefs.BackingStoreException;
-
-/**
- * @since 3.4
- */
-@SuppressWarnings("restriction")
-public class UserPreferences extends EclipsePreferences {
- // cached values
- private IPath location;
-
- /**
- * Default constructor. Should only be called by #createExecutableExtension.
- */
- public UserPreferences(String qualifier) {
- super(null, qualifier);
- }
-
- @Override
- protected IPath getLocation() {
- if (location == null) {
- location = computeLocation(new Path(Platform.getUserLocation().getURL().getFile()), name());
- }
- return location;
- }
-
- public void create() {
- try {
- setLoading(true);
- loadLegacy();
- load();
- loaded();
- flush();
- }
- catch (BackingStoreException e) {
- e.printStackTrace();
- }
- finally {
- setLoading(false);
- }
- }
-
- @Override
- protected void loaded() {
- // ONLY in case the property set is empty load fom legacy instance scope
- if (keys().length == 0) {
- try {
- IEclipsePreferences oldPrefs = new InstanceScope().getNode(name());
- for (String key : oldPrefs.keys()) {
- String value = oldPrefs.get(key, null);
- if (value != null) {
- this.internalPut(key, value);
- }
- }
- }
- catch (BackingStoreException e) {
- e.printStackTrace();
- }
- }
- }
-
- @Override
- protected IEclipsePreferences getLoadLevel() {
- return this;
- }
-
- @Override
- protected EclipsePreferences internalCreate(EclipsePreferences nodeParent, String nodeName, Object context) {
- throw new UnsupportedOperationException();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.prefs;
+
+import org.eclipse.core.internal.preferences.EclipsePreferences;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.osgi.service.prefs.BackingStoreException;
+
+/**
+ * @since 3.4
+ */
+@SuppressWarnings("restriction")
+public class UserPreferences extends EclipsePreferences {
+ // cached values
+ private IPath location;
+
+ /**
+ * Default constructor. Should only be called by #createExecutableExtension.
+ */
+ public UserPreferences(String qualifier) {
+ super(null, qualifier);
+ }
+
+ @Override
+ protected IPath getLocation() {
+ if (location == null) {
+ location = computeLocation(new Path(Platform.getUserLocation().getURL().getFile()), name());
+ }
+ return location;
+ }
+
+ public void create() {
+ try {
+ setLoading(true);
+ loadLegacy();
+ load();
+ loaded();
+ flush();
+ }
+ catch (BackingStoreException e) {
+ e.printStackTrace();
+ }
+ finally {
+ setLoading(false);
+ }
+ }
+
+ @Override
+ protected void loaded() {
+ // ONLY in case the property set is empty load fom legacy instance scope
+ if (keys().length == 0) {
+ try {
+ IEclipsePreferences oldPrefs = new InstanceScope().getNode(name());
+ for (String key : oldPrefs.keys()) {
+ String value = oldPrefs.get(key, null);
+ if (value != null) {
+ this.internalPut(key, value);
+ }
+ }
+ }
+ catch (BackingStoreException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ @Override
+ protected IEclipsePreferences getLoadLevel() {
+ return this;
+ }
+
+ @Override
+ protected EclipsePreferences internalCreate(EclipsePreferences nodeParent, String nodeName, Object context) {
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/prefs/UserScope.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/prefs/UserScope.java
index fede34a5d8..09f270ba77 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/prefs/UserScope.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/prefs/UserScope.java
@@ -1,80 +1,80 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.prefs;
-
-import java.util.HashMap;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.preferences.IEclipsePreferences;
-
-/**
- * Object representing the user scope in the Eclipse preferences, located under
- * the user area.
- * <p>
- * This is useful when multiple users are working on the same eclipse instance under same os user account.
- * <p>
- *
- * @since 3.4
- * @noextend This class is not intended to be subclassed by clients.
- */
-public final class UserScope {
- public static final String SCOPE = "user"; //$NON-NLS-1$
- private static HashMap<String, UserPreferences> prefsMap;
- private static Object prefsMapLock;
-
- static {
- prefsMapLock = new Object();
- prefsMap = new HashMap<String, UserPreferences>();
- }
-
- /**
- * Create and return a new instance scope instance.
- */
- public UserScope() {
- }
-
- /*
- * @see org.eclipse.core.runtime.preferences.IScopeContext#getLocation()
- */
- public IPath getLocation() {
- // Return null. The user location usually corresponds to the state
- // location of the bundle and we don't know what bundle we are dealing with.
- return new Path(Platform.getUserLocation().getURL().getFile());
- }
-
- /*
- * @see org.eclipse.core.runtime.preferences.IScopeContext#getName()
- */
- public String getName() {
- return SCOPE;
- }
-
- /*
- * (non-Javadoc)
- * @see
- * org.eclipse.core.runtime.preferences.IScopeContext#getNode(java.lang.String
- * )
- */
- public IEclipsePreferences getNode(String qualifier) {
- synchronized (prefsMapLock) {
- UserPreferences prefs = prefsMap.get(qualifier);
- if (prefs == null) {
- prefs = new UserPreferences(qualifier);
- prefs.create();
- //
- prefsMap.put(qualifier, prefs);
- }
- return prefs;
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.prefs;
+
+import java.util.HashMap;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+
+/**
+ * Object representing the user scope in the Eclipse preferences, located under
+ * the user area.
+ * <p>
+ * This is useful when multiple users are working on the same eclipse instance under same os user account.
+ * <p>
+ *
+ * @since 3.4
+ * @noextend This class is not intended to be subclassed by clients.
+ */
+public final class UserScope {
+ public static final String SCOPE = "user"; //$NON-NLS-1$
+ private static HashMap<String, UserPreferences> prefsMap;
+ private static Object prefsMapLock;
+
+ static {
+ prefsMapLock = new Object();
+ prefsMap = new HashMap<String, UserPreferences>();
+ }
+
+ /**
+ * Create and return a new instance scope instance.
+ */
+ public UserScope() {
+ }
+
+ /*
+ * @see org.eclipse.core.runtime.preferences.IScopeContext#getLocation()
+ */
+ public IPath getLocation() {
+ // Return null. The user location usually corresponds to the state
+ // location of the bundle and we don't know what bundle we are dealing with.
+ return new Path(Platform.getUserLocation().getURL().getFile());
+ }
+
+ /*
+ * @see org.eclipse.core.runtime.preferences.IScopeContext#getName()
+ */
+ public String getName() {
+ return SCOPE;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
+ * org.eclipse.core.runtime.preferences.IScopeContext#getNode(java.lang.String
+ * )
+ */
+ public IEclipsePreferences getNode(String qualifier) {
+ synchronized (prefsMapLock) {
+ UserPreferences prefs = prefsMap.get(qualifier);
+ if (prefs == null) {
+ prefs = new UserPreferences(qualifier);
+ prefs.create();
+ //
+ prefsMap.put(qualifier, prefs);
+ }
+ return prefs;
+ }
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/runtime/BundleBrowser.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/runtime/BundleBrowser.java
index 60d096e0bd..14f78ecc25 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/runtime/BundleBrowser.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/runtime/BundleBrowser.java
@@ -1,169 +1,169 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.runtime;
-
-import java.net.URL;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.osgi.framework.Bundle;
-
-/**
- * Browses classes in a bundle.
- * <p>
- * This browser checks for classes in the following order:
- * <ol>
- * <li>/bin/ (workspace bundles)</li>
- * <li>/classes/ (workspace bundles)</li>
- * <li>/target/classes/ (maven workspace bundles)</li>
- * <li>/ (zipped bundles)</li>
- * </ol>
- */
-public class BundleBrowser {
- public static final IScoutLogger LOG = ScoutLogManager.getLogger(BundleBrowser.class);
-
- private final Bundle m_bundle;
- private final String m_packagePath;
- //context as members (performance)
- private HashSet<String> m_set;
- private String m_prefix;
- private int m_prefixLen;
- /**
- * fix: when running in dev mode, all classes are spidered twice, but even worse
- * if the prefix is /bin/ then the enum returns paths such as bin/... without the leading /
- * The double-check verifies this fact.
- */
- private boolean m_doubleCheckPrefix;
- boolean m_includeInnerTypes;
- boolean m_includeSubtree;
-
- public BundleBrowser(String symbolicName, String packageName) {
- m_bundle = Platform.getBundle(symbolicName);
- String s = packageName;
- if (s != null) {
- s = s.replace('.', '/');
- }
- m_packagePath = s;
- }
-
- /**
- * @return all found classes in side the bundle
- * If the bundle is a binary bundle, simply visits all its classes, otherwise visits the /bin, the /classes or
- * the /target/classes folder
- */
- public String[] getClasses(boolean includeInnerTypes, boolean includeSubtree) {
- m_includeInnerTypes = includeInnerTypes;
- m_includeSubtree = includeSubtree;
- m_set = new HashSet<String>();
- if (m_bundle != null && m_packagePath != null) {
- String path = removeLeadingSlash(m_packagePath);
- m_prefix = "/bin/";
- m_doubleCheckPrefix = true;
- Enumeration<String> en = getResourcesEnumeration(m_bundle, m_prefix + path);
- if (en == null) {
- m_prefix = "/classes/";
- en = getResourcesEnumeration(m_bundle, m_prefix + path);
- }
- if (en == null) {
- m_prefix = "/target/classes/";
- en = getResourcesEnumeration(m_bundle, m_prefix + path);
- }
- if (en == null) {
- m_prefix = "/";
- en = getResourcesEnumeration(m_bundle, m_prefix + path);
- }
- m_prefixLen = m_prefix.length();
- visit(en);
- }
- return m_set.toArray(new String[m_set.size()]);
- }
-
- private String removeLeadingSlash(String path) {
- if (path.startsWith("/")) {
- return path.substring(1);
- }
- return path;
- }
-
- /**
- * To recursively get all resources placed at the given location. Thereby, attaching fragments are also looked for
- * resources.
- *
- * @param bundle
- * @param path
- * @return
- */
- private Enumeration<String> getResourcesEnumeration(Bundle bundle, String path) {
- Set<String> resources = new HashSet<String>();
-
- Enumeration entries = bundle.findEntries(path, "*", true);
- if (entries == null || !entries.hasMoreElements()) {
- return null;
- }
-
- while (entries.hasMoreElements()) {
- URL url = (URL) entries.nextElement();
- resources.add(url.getPath());
- }
-
- return Collections.enumeration(resources);
- }
-
- private Enumeration convertToStringPaths(Enumeration entries) {
- Set<String> paths = new HashSet<String>();
-
- if (entries != null) {
- while (entries.hasMoreElements()) {
- URL url = (URL) entries.nextElement();
- paths.add(url.getPath());
- }
- }
-
- return Collections.enumeration(paths);
- }
-
- private void visit(Enumeration<String> en) {
- if (en != null) {
- while (en.hasMoreElements()) {
- String path = en.nextElement();
- if (path.endsWith(".class")) {
- String className;
- if (m_doubleCheckPrefix) {
- if (path.startsWith(m_prefix)) {
- className = path.substring(m_prefixLen, path.length() - 6);
- }
- else {
- className = path.substring(m_prefixLen - 1, path.length() - 6);
- }
- }
- else {
- className = path.substring(m_prefixLen, path.length() - 6);
- }
- if (path.indexOf("$") < 0 || m_includeInnerTypes) {
- className = className.replaceAll("[/]", ".");
- m_set.add(className);
- }
- }
- else if (path.endsWith("/")) {
- if (m_includeSubtree) {
- visit(m_bundle.getEntryPaths(path));
- }
- }
- }
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.runtime;
+
+import java.net.URL;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.osgi.framework.Bundle;
+
+/**
+ * Browses classes in a bundle.
+ * <p>
+ * This browser checks for classes in the following order:
+ * <ol>
+ * <li>/bin/ (workspace bundles)</li>
+ * <li>/classes/ (workspace bundles)</li>
+ * <li>/target/classes/ (maven workspace bundles)</li>
+ * <li>/ (zipped bundles)</li>
+ * </ol>
+ */
+public class BundleBrowser {
+ public static final IScoutLogger LOG = ScoutLogManager.getLogger(BundleBrowser.class);
+
+ private final Bundle m_bundle;
+ private final String m_packagePath;
+ //context as members (performance)
+ private HashSet<String> m_set;
+ private String m_prefix;
+ private int m_prefixLen;
+ /**
+ * fix: when running in dev mode, all classes are spidered twice, but even worse
+ * if the prefix is /bin/ then the enum returns paths such as bin/... without the leading /
+ * The double-check verifies this fact.
+ */
+ private boolean m_doubleCheckPrefix;
+ boolean m_includeInnerTypes;
+ boolean m_includeSubtree;
+
+ public BundleBrowser(String symbolicName, String packageName) {
+ m_bundle = Platform.getBundle(symbolicName);
+ String s = packageName;
+ if (s != null) {
+ s = s.replace('.', '/');
+ }
+ m_packagePath = s;
+ }
+
+ /**
+ * @return all found classes in side the bundle
+ * If the bundle is a binary bundle, simply visits all its classes, otherwise visits the /bin, the /classes or
+ * the /target/classes folder
+ */
+ public String[] getClasses(boolean includeInnerTypes, boolean includeSubtree) {
+ m_includeInnerTypes = includeInnerTypes;
+ m_includeSubtree = includeSubtree;
+ m_set = new HashSet<String>();
+ if (m_bundle != null && m_packagePath != null) {
+ String path = removeLeadingSlash(m_packagePath);
+ m_prefix = "/bin/";
+ m_doubleCheckPrefix = true;
+ Enumeration<String> en = getResourcesEnumeration(m_bundle, m_prefix + path);
+ if (en == null) {
+ m_prefix = "/classes/";
+ en = getResourcesEnumeration(m_bundle, m_prefix + path);
+ }
+ if (en == null) {
+ m_prefix = "/target/classes/";
+ en = getResourcesEnumeration(m_bundle, m_prefix + path);
+ }
+ if (en == null) {
+ m_prefix = "/";
+ en = getResourcesEnumeration(m_bundle, m_prefix + path);
+ }
+ m_prefixLen = m_prefix.length();
+ visit(en);
+ }
+ return m_set.toArray(new String[m_set.size()]);
+ }
+
+ private String removeLeadingSlash(String path) {
+ if (path.startsWith("/")) {
+ return path.substring(1);
+ }
+ return path;
+ }
+
+ /**
+ * To recursively get all resources placed at the given location. Thereby, attaching fragments are also looked for
+ * resources.
+ *
+ * @param bundle
+ * @param path
+ * @return
+ */
+ private Enumeration<String> getResourcesEnumeration(Bundle bundle, String path) {
+ Set<String> resources = new HashSet<String>();
+
+ Enumeration entries = bundle.findEntries(path, "*", true);
+ if (entries == null || !entries.hasMoreElements()) {
+ return null;
+ }
+
+ while (entries.hasMoreElements()) {
+ URL url = (URL) entries.nextElement();
+ resources.add(url.getPath());
+ }
+
+ return Collections.enumeration(resources);
+ }
+
+ private Enumeration convertToStringPaths(Enumeration entries) {
+ Set<String> paths = new HashSet<String>();
+
+ if (entries != null) {
+ while (entries.hasMoreElements()) {
+ URL url = (URL) entries.nextElement();
+ paths.add(url.getPath());
+ }
+ }
+
+ return Collections.enumeration(paths);
+ }
+
+ private void visit(Enumeration<String> en) {
+ if (en != null) {
+ while (en.hasMoreElements()) {
+ String path = en.nextElement();
+ if (path.endsWith(".class")) {
+ String className;
+ if (m_doubleCheckPrefix) {
+ if (path.startsWith(m_prefix)) {
+ className = path.substring(m_prefixLen, path.length() - 6);
+ }
+ else {
+ className = path.substring(m_prefixLen - 1, path.length() - 6);
+ }
+ }
+ else {
+ className = path.substring(m_prefixLen, path.length() - 6);
+ }
+ if (path.indexOf("$") < 0 || m_includeInnerTypes) {
+ className = className.replaceAll("[/]", ".");
+ m_set.add(className);
+ }
+ }
+ else if (path.endsWith("/")) {
+ if (m_includeSubtree) {
+ visit(m_bundle.getEntryPaths(path));
+ }
+ }
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/runtime/ClasspathBrowser.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/runtime/ClasspathBrowser.java
index 1629aea760..9204a6678d 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/runtime/ClasspathBrowser.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/runtime/ClasspathBrowser.java
@@ -1,313 +1,313 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.runtime;
-
-import java.io.File;
-import java.lang.reflect.Method;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.Set;
-import java.util.TreeSet;
-import java.util.jar.JarEntry;
-import java.util.jar.JarFile;
-
-/**
- * Browser known classes on the class path Note: this visitor only detects
- * classes on the "visitable" classpath. This is mainly the area of
- * URLClassLoaders and jar/zip-based archives
- */
-public class ClasspathBrowser {
- private static final boolean DEBUG_PATH = false;
- private static final boolean DEBUG_ENTRY = false;
-
- private ArrayList<String> m_classpathsList = new ArrayList<String>();
- //
- private Set<String> m_classes = new TreeSet<String>();
- private Set<String> m_resources = new TreeSet<String>();
-
- public ClasspathBrowser() {
- }
-
- public void addDefaultClasspaths() {
- addClasspath(System.getProperty("sun.boot.class.path"));
- addClasspath(System.getProperty("java.class.path"));
- }
-
- public void addClasspath(String cp) {
- m_classpathsList.add(cp);
- }
-
- public void addClasspathsByClassLoader(Class startClass) {
- ClassLoader cl = startClass.getClassLoader();
- while (cl != null) {
- if (cl instanceof URLClassLoader) {
- URL[] a = ((URLClassLoader) cl).getURLs();
- if (a != null) {
- for (URL url : a) {
- m_classpathsList.add(url.getFile());
- }
- }
- }
- else {
- /*
- * IBM's WebSphere uses a com.ibm.ws.classloader.CompoundClassLoader
- * that has a getPaths() method.
- */
- try {
- Method m = cl.getClass().getMethod("getPaths");
- String[] b = (String[]) m.invoke(cl);
- if (b != null) {
- for (String path : b) {
- m_classpathsList.add(path);
- }
- }
- }
- catch (Exception e) {
- if (DEBUG_PATH) {
- log(e.getMessage());
- }
- }
- }
- // next
- cl = cl.getParent();
- }
- }
-
- public void visit() throws Exception {
- m_classes.clear();
- m_resources.clear();
- for (String s : m_classpathsList) {
- visitClasspaths(s);
- }
- }
-
- public String[] getClasses() {
- return m_classes.toArray(new String[0]);
- }
-
- public String[] getResources() {
- return m_resources.toArray(new String[0]);
- }
-
- private void visitClasspaths(String classpaths) throws Exception {
- if (DEBUG_PATH) {
- log("visit classpaths " + classpaths);
- }
- String[] a = classpaths.split(File.pathSeparator);
- for (String cp : a) {
- visitClasspath(cp);
- }
- }
-
- private void visitClasspath(String classpath) throws Exception {
- if (DEBUG_PATH) {
- log(" visit classpath " + classpath);
- }
- File f = new File(classpath.trim());
- if (f.isDirectory()) {
- String dirName = f.getCanonicalPath();
- int dirNameLen = dirName.length();
- if (dirName.endsWith("/") || dirName.endsWith("\\")) {
- // ok
- }
- else {
- dirNameLen++;
- }
- visitDirectory(dirNameLen, f);
- }
- else if (f.exists()) {
- visitJar(f);
- }
- else {
- if (DEBUG_PATH) {
- log(" " + classpath + " does not exist");
- }
- }
- }
-
- private void visitJar(File f) throws Exception {
- JarFile jarFile = new JarFile(f);
- if (DEBUG_PATH) {
- log(" visit jar " + f + " with " + jarFile.size() + " elements");
- }
- for (Enumeration en = jarFile.entries(); en.hasMoreElements();) {
- JarEntry entry = (JarEntry) en.nextElement();
- if (entry.isDirectory()) {
- // nop
- }
- else {
- String entryName = entry.getName();
- visitEntry(entryName);
- }
- }
- }
-
- private void visitDirectory(int namePrefixLen, File dir) throws Exception {
- File[] files = dir.listFiles();
- if (files != null) {
- int n = files.length;
- if (DEBUG_PATH) {
- log(" visit dir " + dir + " with " + n + " elements");
- }
- for (int i = 0; i < n; i++) {
- if (files[i].isDirectory()) {
- visitDirectory(namePrefixLen, files[i]);
- }
- else {
- String fileName = files[i].getCanonicalPath();
- String entryName = fileName.substring(namePrefixLen);
- visitEntry(entryName);
- }
- }
- }
- }
-
- private void visitEntry(String entryName) throws Exception {
- if (entryName.endsWith(".class")) {
- // class
- String className = entryName.substring(0, entryName.length() - 6);
- className = className.replaceAll("[/\\\\]", ".");
- if (acceptClass(className)) {
- // add
- if (DEBUG_ENTRY) {
- log(" C " + className + " +");
- }
- m_classes.add(className);
- }
- else {
- if (DEBUG_ENTRY) {
- log(" C " + className + " -");
- }
- }
- }
- else {
- // resource
- String resName = entryName;
- String resPath = "";
- resName = resName.replace('\\', '/');
- int i = resName.lastIndexOf('/');
- if (i >= 0) {
- resPath = resName.substring(0, i + 1);
- resName = resName.substring(i + 1);
- }
- if (!resPath.startsWith("/")) {
- resPath = "/" + resPath;
- }
- if (acceptResoure(resPath, resName)) {
- // add
- if (DEBUG_ENTRY) {
- log(" R " + resPath + resName + " +");
- }
- m_resources.add(resPath + resName);
- }
- else {
- if (DEBUG_ENTRY) {
- log(" R " + resPath + resName + " -");
- }
- }
- }
- }
-
- protected boolean acceptClass(String className) {
- if (className.indexOf("$") >= 0) {
- return false;
- }
- if (className.startsWith("java.")) {
- return false;
- }
- if (className.startsWith("javax.")) {
- return false;
- }
- if (className.startsWith("com.sun.")) {
- return false;
- }
- if (className.startsWith("sun.")) {
- return false;
- }
- if (className.startsWith("sunw.")) {
- return false;
- }
- if (className.startsWith("org.")) {
- return false;
- }
- if (className.startsWith("oracle.")) {
- return false;
- }
- if (className.startsWith("com.thoughtworks.")) {
- return false;
- }
- if (className.startsWith("com.ibm.")) {
- return false;
- }
- if (className.startsWith("com.tivoli.")) {
- return false;
- }
- if (className.startsWith("net.sf.retrotranslator.")) {
- return false;
- }
- if (className.startsWith("WEB-INF.classes.")) {
- return false;
- }
- return true;
- }
-
- /**
- * @param path
- * only forwardslashes and a forward slash at the end (
- * /META-INF/services/ )
- * @param name
- * name without path info ( config.xml )
- */
-
- protected boolean acceptResoure(String path, String name) {
- if (path.startsWith("/java/")) {
- return false;
- }
- if (path.startsWith("/sun/")) {
- return false;
- }
- if (path.startsWith("/com/sun/")) {
- return false;
- }
- if (path.startsWith("/javax/")) {
- return false;
- }
- if (path.startsWith("/java/")) {
- return false;
- }
- if (path.startsWith("/org/")) {
- return false;
- }
- if (path.startsWith("/oracle/")) {
- return false;
- }
- if (path.startsWith("/com/ibm/")) {
- return false;
- }
- if (path.startsWith("/com/tivoli/")) {
- return false;
- }
- if (path.startsWith("/net/sf/retrotranslator/")) {
- return false;
- }
- if (path.startsWith("/WEB-INF/classes/")) {
- return false;
- }
- return true;
- }
-
- private void log(String s) {
- System.out.println(s);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.runtime;
+
+import java.io.File;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+
+/**
+ * Browser known classes on the class path Note: this visitor only detects
+ * classes on the "visitable" classpath. This is mainly the area of
+ * URLClassLoaders and jar/zip-based archives
+ */
+public class ClasspathBrowser {
+ private static final boolean DEBUG_PATH = false;
+ private static final boolean DEBUG_ENTRY = false;
+
+ private ArrayList<String> m_classpathsList = new ArrayList<String>();
+ //
+ private Set<String> m_classes = new TreeSet<String>();
+ private Set<String> m_resources = new TreeSet<String>();
+
+ public ClasspathBrowser() {
+ }
+
+ public void addDefaultClasspaths() {
+ addClasspath(System.getProperty("sun.boot.class.path"));
+ addClasspath(System.getProperty("java.class.path"));
+ }
+
+ public void addClasspath(String cp) {
+ m_classpathsList.add(cp);
+ }
+
+ public void addClasspathsByClassLoader(Class startClass) {
+ ClassLoader cl = startClass.getClassLoader();
+ while (cl != null) {
+ if (cl instanceof URLClassLoader) {
+ URL[] a = ((URLClassLoader) cl).getURLs();
+ if (a != null) {
+ for (URL url : a) {
+ m_classpathsList.add(url.getFile());
+ }
+ }
+ }
+ else {
+ /*
+ * IBM's WebSphere uses a com.ibm.ws.classloader.CompoundClassLoader
+ * that has a getPaths() method.
+ */
+ try {
+ Method m = cl.getClass().getMethod("getPaths");
+ String[] b = (String[]) m.invoke(cl);
+ if (b != null) {
+ for (String path : b) {
+ m_classpathsList.add(path);
+ }
+ }
+ }
+ catch (Exception e) {
+ if (DEBUG_PATH) {
+ log(e.getMessage());
+ }
+ }
+ }
+ // next
+ cl = cl.getParent();
+ }
+ }
+
+ public void visit() throws Exception {
+ m_classes.clear();
+ m_resources.clear();
+ for (String s : m_classpathsList) {
+ visitClasspaths(s);
+ }
+ }
+
+ public String[] getClasses() {
+ return m_classes.toArray(new String[0]);
+ }
+
+ public String[] getResources() {
+ return m_resources.toArray(new String[0]);
+ }
+
+ private void visitClasspaths(String classpaths) throws Exception {
+ if (DEBUG_PATH) {
+ log("visit classpaths " + classpaths);
+ }
+ String[] a = classpaths.split(File.pathSeparator);
+ for (String cp : a) {
+ visitClasspath(cp);
+ }
+ }
+
+ private void visitClasspath(String classpath) throws Exception {
+ if (DEBUG_PATH) {
+ log(" visit classpath " + classpath);
+ }
+ File f = new File(classpath.trim());
+ if (f.isDirectory()) {
+ String dirName = f.getCanonicalPath();
+ int dirNameLen = dirName.length();
+ if (dirName.endsWith("/") || dirName.endsWith("\\")) {
+ // ok
+ }
+ else {
+ dirNameLen++;
+ }
+ visitDirectory(dirNameLen, f);
+ }
+ else if (f.exists()) {
+ visitJar(f);
+ }
+ else {
+ if (DEBUG_PATH) {
+ log(" " + classpath + " does not exist");
+ }
+ }
+ }
+
+ private void visitJar(File f) throws Exception {
+ JarFile jarFile = new JarFile(f);
+ if (DEBUG_PATH) {
+ log(" visit jar " + f + " with " + jarFile.size() + " elements");
+ }
+ for (Enumeration en = jarFile.entries(); en.hasMoreElements();) {
+ JarEntry entry = (JarEntry) en.nextElement();
+ if (entry.isDirectory()) {
+ // nop
+ }
+ else {
+ String entryName = entry.getName();
+ visitEntry(entryName);
+ }
+ }
+ }
+
+ private void visitDirectory(int namePrefixLen, File dir) throws Exception {
+ File[] files = dir.listFiles();
+ if (files != null) {
+ int n = files.length;
+ if (DEBUG_PATH) {
+ log(" visit dir " + dir + " with " + n + " elements");
+ }
+ for (int i = 0; i < n; i++) {
+ if (files[i].isDirectory()) {
+ visitDirectory(namePrefixLen, files[i]);
+ }
+ else {
+ String fileName = files[i].getCanonicalPath();
+ String entryName = fileName.substring(namePrefixLen);
+ visitEntry(entryName);
+ }
+ }
+ }
+ }
+
+ private void visitEntry(String entryName) throws Exception {
+ if (entryName.endsWith(".class")) {
+ // class
+ String className = entryName.substring(0, entryName.length() - 6);
+ className = className.replaceAll("[/\\\\]", ".");
+ if (acceptClass(className)) {
+ // add
+ if (DEBUG_ENTRY) {
+ log(" C " + className + " +");
+ }
+ m_classes.add(className);
+ }
+ else {
+ if (DEBUG_ENTRY) {
+ log(" C " + className + " -");
+ }
+ }
+ }
+ else {
+ // resource
+ String resName = entryName;
+ String resPath = "";
+ resName = resName.replace('\\', '/');
+ int i = resName.lastIndexOf('/');
+ if (i >= 0) {
+ resPath = resName.substring(0, i + 1);
+ resName = resName.substring(i + 1);
+ }
+ if (!resPath.startsWith("/")) {
+ resPath = "/" + resPath;
+ }
+ if (acceptResoure(resPath, resName)) {
+ // add
+ if (DEBUG_ENTRY) {
+ log(" R " + resPath + resName + " +");
+ }
+ m_resources.add(resPath + resName);
+ }
+ else {
+ if (DEBUG_ENTRY) {
+ log(" R " + resPath + resName + " -");
+ }
+ }
+ }
+ }
+
+ protected boolean acceptClass(String className) {
+ if (className.indexOf("$") >= 0) {
+ return false;
+ }
+ if (className.startsWith("java.")) {
+ return false;
+ }
+ if (className.startsWith("javax.")) {
+ return false;
+ }
+ if (className.startsWith("com.sun.")) {
+ return false;
+ }
+ if (className.startsWith("sun.")) {
+ return false;
+ }
+ if (className.startsWith("sunw.")) {
+ return false;
+ }
+ if (className.startsWith("org.")) {
+ return false;
+ }
+ if (className.startsWith("oracle.")) {
+ return false;
+ }
+ if (className.startsWith("com.thoughtworks.")) {
+ return false;
+ }
+ if (className.startsWith("com.ibm.")) {
+ return false;
+ }
+ if (className.startsWith("com.tivoli.")) {
+ return false;
+ }
+ if (className.startsWith("net.sf.retrotranslator.")) {
+ return false;
+ }
+ if (className.startsWith("WEB-INF.classes.")) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * @param path
+ * only forwardslashes and a forward slash at the end (
+ * /META-INF/services/ )
+ * @param name
+ * name without path info ( config.xml )
+ */
+
+ protected boolean acceptResoure(String path, String name) {
+ if (path.startsWith("/java/")) {
+ return false;
+ }
+ if (path.startsWith("/sun/")) {
+ return false;
+ }
+ if (path.startsWith("/com/sun/")) {
+ return false;
+ }
+ if (path.startsWith("/javax/")) {
+ return false;
+ }
+ if (path.startsWith("/java/")) {
+ return false;
+ }
+ if (path.startsWith("/org/")) {
+ return false;
+ }
+ if (path.startsWith("/oracle/")) {
+ return false;
+ }
+ if (path.startsWith("/com/ibm/")) {
+ return false;
+ }
+ if (path.startsWith("/com/tivoli/")) {
+ return false;
+ }
+ if (path.startsWith("/net/sf/retrotranslator/")) {
+ return false;
+ }
+ if (path.startsWith("/WEB-INF/classes/")) {
+ return false;
+ }
+ return true;
+ }
+
+ private void log(String s) {
+ System.out.println(s);
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/runtime/ExtensionPointTracker.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/runtime/ExtensionPointTracker.java
index 6dfad963df..ecc6f2e9c7 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/runtime/ExtensionPointTracker.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/runtime/ExtensionPointTracker.java
@@ -1,183 +1,183 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.runtime;
-
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionDelta;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.IRegistryChangeEvent;
-import org.eclipse.core.runtime.IRegistryChangeListener;
-import org.eclipse.core.runtime.InvalidRegistryObjectException;
-
-/**
- * Common extension point tracker that delegates added and removed extension events to a {@link Listener}.
- */
-public class ExtensionPointTracker {
- public interface Listener {
- /**
- * This method is synchronized and therefore thread safe
- */
- void added(IExtension extension);
-
- /**
- * This method is synchronized and therefore thread safe
- */
- void removed(IExtension extension);
- }
-
- private static final Listener NULL_LISTENER = new Listener() {
- @Override
- public void added(IExtension extension) {
- }
-
- @Override
- public void removed(IExtension extension) {
- }
- };
-
- private final IExtensionRegistry m_registry;
- private final String m_extensionPointId;
- private final String m_namespace;
- private final String m_simpleName;
- private final Set<IExtension> m_extensionCache = new HashSet<IExtension>();
- private final Listener m_listener;
- private final RegistryChangeListener m_registryChangeListener = new RegistryChangeListener();
- private final Object m_trackerLock = new Object();
- private boolean m_open = false;
-
- public ExtensionPointTracker(IExtensionRegistry registry, String extensionPointId, Listener listener) {
- m_registry = registry;
- m_extensionPointId = extensionPointId;
- m_listener = (listener != null) ? listener : NULL_LISTENER;
- if (extensionPointId == null || -1 == extensionPointId.indexOf('.')) {
- throw new IllegalArgumentException("Unexpected Extension Point Identifier: " + extensionPointId); //$NON-NLS-1$
- }
- int lastDotIndex = extensionPointId.lastIndexOf('.');
- m_namespace = extensionPointId.substring(0, lastDotIndex);
- m_simpleName = extensionPointId.substring(lastDotIndex + 1);
- }
-
- public final Object getTrackerLock() {
- return m_trackerLock;
- }
-
- public boolean isOpen() {
- return m_open;
- }
-
- /**
- * Opens and starts this extension point tracker. Only the first invocation and every invocation after a
- * {@link #close()} registers this tracker.
- *
- * @return Returns <code>true</code> if the tracker has been started during the current method invocation.
- */
- public boolean open() {
- // unsafe check (performance)
- if (m_open) {
- return false;
- }
- synchronized (m_trackerLock) {
- // safe check
- if (m_open) {
- return false;
- }
- IExtension[] extensions = null;
- m_registry.addRegistryChangeListener(m_registryChangeListener, m_namespace);
- try {
- IExtensionPoint point = m_registry.getExtensionPoint(m_extensionPointId);
- if (point != null) {
- extensions = point.getExtensions();
- m_extensionCache.addAll(Arrays.asList(extensions));
- }
- }
- catch (InvalidRegistryObjectException e) {
- m_registry.removeRegistryChangeListener(m_registryChangeListener);
- throw e;
- }
- if (extensions != null) {
- for (int i = 0; i < extensions.length; ++i) {
- m_listener.added(extensions[i]);
- }
- }
- m_open = true;
- }
- return true;
- }
-
- public void close() {
- Set<IExtension> extensions = null;
- synchronized (m_trackerLock) {
- if (!m_open) {
- return;
- }
- m_open = false;
- m_registry.removeRegistryChangeListener(m_registryChangeListener);
- extensions = new HashSet<IExtension>(m_extensionCache);
- m_extensionCache.clear();
- for (IExtension x : extensions) {
- m_listener.removed(x);
- }
- }
- }
-
- private boolean removeExtensionNoLocking(IExtension extension) {
- if (!m_open) {
- return false;
- }
- return m_extensionCache.remove(extension);
- }
-
- private boolean addExtensionNoLocking(IExtension extension) {
- if (!m_open) {
- return false;
- }
- return m_extensionCache.add(extension);
- }
-
- public IExtension[] getExtensions() {
- synchronized (m_trackerLock) {
- return m_extensionCache.toArray(new IExtension[m_extensionCache.size()]);
- }
- }
-
- class RegistryChangeListener implements IRegistryChangeListener {
- @Override
- public void registryChanged(IRegistryChangeEvent event) {
- IExtensionDelta[] deltas = event.getExtensionDeltas(m_namespace, m_simpleName);
- for (int i = 0; i < deltas.length; ++i) {
- IExtensionDelta delta = deltas[i];
- IExtension extension = delta.getExtension();
- switch (delta.getKind()) {
- case IExtensionDelta.ADDED:
- synchronized (m_trackerLock) {
- if (addExtensionNoLocking(extension)) {
- m_listener.added(extension);
- }
- }
- break;
- case IExtensionDelta.REMOVED:
- synchronized (m_trackerLock) {
- if (removeExtensionNoLocking(extension)) {
- m_listener.removed(extension);
- }
- }
- default:
- break;
- }
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.runtime;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionDelta;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.IRegistryChangeEvent;
+import org.eclipse.core.runtime.IRegistryChangeListener;
+import org.eclipse.core.runtime.InvalidRegistryObjectException;
+
+/**
+ * Common extension point tracker that delegates added and removed extension events to a {@link Listener}.
+ */
+public class ExtensionPointTracker {
+ public interface Listener {
+ /**
+ * This method is synchronized and therefore thread safe
+ */
+ void added(IExtension extension);
+
+ /**
+ * This method is synchronized and therefore thread safe
+ */
+ void removed(IExtension extension);
+ }
+
+ private static final Listener NULL_LISTENER = new Listener() {
+ @Override
+ public void added(IExtension extension) {
+ }
+
+ @Override
+ public void removed(IExtension extension) {
+ }
+ };
+
+ private final IExtensionRegistry m_registry;
+ private final String m_extensionPointId;
+ private final String m_namespace;
+ private final String m_simpleName;
+ private final Set<IExtension> m_extensionCache = new HashSet<IExtension>();
+ private final Listener m_listener;
+ private final RegistryChangeListener m_registryChangeListener = new RegistryChangeListener();
+ private final Object m_trackerLock = new Object();
+ private boolean m_open = false;
+
+ public ExtensionPointTracker(IExtensionRegistry registry, String extensionPointId, Listener listener) {
+ m_registry = registry;
+ m_extensionPointId = extensionPointId;
+ m_listener = (listener != null) ? listener : NULL_LISTENER;
+ if (extensionPointId == null || -1 == extensionPointId.indexOf('.')) {
+ throw new IllegalArgumentException("Unexpected Extension Point Identifier: " + extensionPointId); //$NON-NLS-1$
+ }
+ int lastDotIndex = extensionPointId.lastIndexOf('.');
+ m_namespace = extensionPointId.substring(0, lastDotIndex);
+ m_simpleName = extensionPointId.substring(lastDotIndex + 1);
+ }
+
+ public final Object getTrackerLock() {
+ return m_trackerLock;
+ }
+
+ public boolean isOpen() {
+ return m_open;
+ }
+
+ /**
+ * Opens and starts this extension point tracker. Only the first invocation and every invocation after a
+ * {@link #close()} registers this tracker.
+ *
+ * @return Returns <code>true</code> if the tracker has been started during the current method invocation.
+ */
+ public boolean open() {
+ // unsafe check (performance)
+ if (m_open) {
+ return false;
+ }
+ synchronized (m_trackerLock) {
+ // safe check
+ if (m_open) {
+ return false;
+ }
+ IExtension[] extensions = null;
+ m_registry.addRegistryChangeListener(m_registryChangeListener, m_namespace);
+ try {
+ IExtensionPoint point = m_registry.getExtensionPoint(m_extensionPointId);
+ if (point != null) {
+ extensions = point.getExtensions();
+ m_extensionCache.addAll(Arrays.asList(extensions));
+ }
+ }
+ catch (InvalidRegistryObjectException e) {
+ m_registry.removeRegistryChangeListener(m_registryChangeListener);
+ throw e;
+ }
+ if (extensions != null) {
+ for (int i = 0; i < extensions.length; ++i) {
+ m_listener.added(extensions[i]);
+ }
+ }
+ m_open = true;
+ }
+ return true;
+ }
+
+ public void close() {
+ Set<IExtension> extensions = null;
+ synchronized (m_trackerLock) {
+ if (!m_open) {
+ return;
+ }
+ m_open = false;
+ m_registry.removeRegistryChangeListener(m_registryChangeListener);
+ extensions = new HashSet<IExtension>(m_extensionCache);
+ m_extensionCache.clear();
+ for (IExtension x : extensions) {
+ m_listener.removed(x);
+ }
+ }
+ }
+
+ private boolean removeExtensionNoLocking(IExtension extension) {
+ if (!m_open) {
+ return false;
+ }
+ return m_extensionCache.remove(extension);
+ }
+
+ private boolean addExtensionNoLocking(IExtension extension) {
+ if (!m_open) {
+ return false;
+ }
+ return m_extensionCache.add(extension);
+ }
+
+ public IExtension[] getExtensions() {
+ synchronized (m_trackerLock) {
+ return m_extensionCache.toArray(new IExtension[m_extensionCache.size()]);
+ }
+ }
+
+ class RegistryChangeListener implements IRegistryChangeListener {
+ @Override
+ public void registryChanged(IRegistryChangeEvent event) {
+ IExtensionDelta[] deltas = event.getExtensionDeltas(m_namespace, m_simpleName);
+ for (int i = 0; i < deltas.length; ++i) {
+ IExtensionDelta delta = deltas[i];
+ IExtension extension = delta.getExtension();
+ switch (delta.getKind()) {
+ case IExtensionDelta.ADDED:
+ synchronized (m_trackerLock) {
+ if (addExtensionNoLocking(extension)) {
+ m_listener.added(extension);
+ }
+ }
+ break;
+ case IExtensionDelta.REMOVED:
+ synchronized (m_trackerLock) {
+ if (removeExtensionNoLocking(extension)) {
+ m_listener.removed(extension);
+ }
+ }
+ default:
+ break;
+ }
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/runtime/internal/TestClasspathBrowser.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/runtime/internal/TestClasspathBrowser.java
index 8dc0d61d1b..5d4c8aad0b 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/runtime/internal/TestClasspathBrowser.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/runtime/internal/TestClasspathBrowser.java
@@ -1,51 +1,51 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.runtime.internal;
-
-import java.lang.reflect.Modifier;
-
-import org.eclipse.scout.commons.runtime.ClasspathBrowser;
-
-public final class TestClasspathBrowser {
-
- private TestClasspathBrowser() {
- }
-
- public static void main(String[] args) throws Exception {
- ClasspathBrowser b = new ClasspathBrowser();
- b.addDefaultClasspaths();
- b.addClasspathsByClassLoader(TestClasspathBrowser.class);
- b.visit();
- //
- /*
- * System.out.println("# Classes"); for(String s: b.getClasses()){
- * System.out.println(s); } // System.out.println("# Resources"); for(String
- * s: b.getResources()){ System.out.println(s); }
- */
- // filter
- System.out.println("# Service Implementations");
- for (String className : b.getClasses()) {
- try {
- Class c = Class.forName(className, true, TestClasspathBrowser.class.getClassLoader());
- if (!c.isInterface()) {
- int flags = c.getModifiers();
- if (Modifier.isPublic(flags) && (!Modifier.isAbstract(flags)) && (!c.getSimpleName().startsWith("Abstract"))) {
- System.out.println(c);
- }
- }
- }
- catch (Throwable t) {
- System.out.println("Failed :" + className + ": " + t);
- }
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.runtime.internal;
+
+import java.lang.reflect.Modifier;
+
+import org.eclipse.scout.commons.runtime.ClasspathBrowser;
+
+public final class TestClasspathBrowser {
+
+ private TestClasspathBrowser() {
+ }
+
+ public static void main(String[] args) throws Exception {
+ ClasspathBrowser b = new ClasspathBrowser();
+ b.addDefaultClasspaths();
+ b.addClasspathsByClassLoader(TestClasspathBrowser.class);
+ b.visit();
+ //
+ /*
+ * System.out.println("# Classes"); for(String s: b.getClasses()){
+ * System.out.println(s); } // System.out.println("# Resources"); for(String
+ * s: b.getResources()){ System.out.println(s); }
+ */
+ // filter
+ System.out.println("# Service Implementations");
+ for (String className : b.getClasses()) {
+ try {
+ Class c = Class.forName(className, true, TestClasspathBrowser.class.getClassLoader());
+ if (!c.isInterface()) {
+ int flags = c.getModifiers();
+ if (Modifier.isPublic(flags) && (!Modifier.isAbstract(flags)) && (!c.getSimpleName().startsWith("Abstract"))) {
+ System.out.println(c);
+ }
+ }
+ }
+ catch (Throwable t) {
+ System.out.println("Failed :" + className + ": " + t);
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/security/SimplePrincipal.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/security/SimplePrincipal.java
index 730b33a27d..5409c01d39 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/security/SimplePrincipal.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/security/SimplePrincipal.java
@@ -1,57 +1,57 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.security;
-
-import java.io.Serializable;
-import java.security.Principal;
-
-public class SimplePrincipal implements Principal, Serializable {
- private static final long serialVersionUID = 1L;
-
- private String m_name;
-
- public SimplePrincipal(String name) {
- if (name == null) {
- throw new IllegalArgumentException("name must not be null");
- }
- m_name = name;
- }
-
- @Override
- public String getName() {
- return m_name;
- }
-
- @Override
- public int hashCode() {
- return getName().hashCode();
- }
-
- @Override
- public boolean equals(Object other) {
- if (other == this) {
- return true;
- }
- if (!(other instanceof SimplePrincipal)) {
- return false;
- }
- else {
- String myFullName = getName();
- String otherFullName = ((SimplePrincipal) other).getName();
- return myFullName.equals(otherFullName);
- }
- }
-
- @Override
- public String toString() {
- return getName();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.security;
+
+import java.io.Serializable;
+import java.security.Principal;
+
+public class SimplePrincipal implements Principal, Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private String m_name;
+
+ public SimplePrincipal(String name) {
+ if (name == null) {
+ throw new IllegalArgumentException("name must not be null");
+ }
+ m_name = name;
+ }
+
+ @Override
+ public String getName() {
+ return m_name;
+ }
+
+ @Override
+ public int hashCode() {
+ return getName().hashCode();
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == this) {
+ return true;
+ }
+ if (!(other instanceof SimplePrincipal)) {
+ return false;
+ }
+ else {
+ String myFullName = getName();
+ String otherFullName = ((SimplePrincipal) other).getName();
+ return myFullName.equals(otherFullName);
+ }
+ }
+
+ @Override
+ public String toString() {
+ return getName();
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/xmlparser/ScoutXmlDocument.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/xmlparser/ScoutXmlDocument.java
index 6eaec145a9..34ff6b101f 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/xmlparser/ScoutXmlDocument.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/xmlparser/ScoutXmlDocument.java
@@ -1,2911 +1,2911 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.xmlparser;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.Serializable;
-import java.io.StringWriter;
-import java.io.Writer;
-import java.net.URL;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Date;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.regex.Pattern;
-
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.xml.sax.Attributes;
-
-/**
- * Title : Scout XML Document
- *
- * @version 2.0
- */
-public class ScoutXmlDocument implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(ScoutXmlDocument.class);
-
- private static final boolean DEFAULT_ACCEPT_REGEX_QUERIES = false;
- private static final boolean DEFAULT_IGNORE_INDENT_WHITESPACE = false;
- private static final boolean DEFAULT_IGNORE_QUERY_CASE = false;
- private static final String DEFAULT_INDENT = " ";
- private static final boolean DEFAULT_PRETTY_PRINT = true;
- private static final boolean DEFAULT_STRICTLY_CHECKING = true;
- private static final String DEFAULT_XML_ENCODING = "UTF-8"; // "ISO-8859-1"
- private static final String DEFAULT_XML_VERSION = "1.0";
- private static final int INITIAL_ATTRIBUTE_LIST_SIZE = 5;
- private static final int INITIAL_CONTENT_LIST_SIZE = 10;
- private static final int INITIAL_NAMESPACE_MAP_SIZE = 5;
-
- private final static Pattern[] COMPILED_REGEX_PATTERNS = new Pattern[]{
- Pattern.compile("(\\*)|(\\{\\*\\}\\*)|(\\*:\\*)"),
- Pattern.compile("(\\{\\*\\}.*)|(\\*:.*)"),
- Pattern.compile("\\{.*\\}\\*"),
- Pattern.compile(".*:\\*"),
- Pattern.compile("\\{.*\\}.*")};
-
- public static final Hashtable<String, String> XML_ENTITIES;
-
- static {
- XML_ENTITIES = new Hashtable<String, String>();
-
- XML_ENTITIES.put("&", "&amp;");
- XML_ENTITIES.put("\"", "&quot;");
- XML_ENTITIES.put("'", "&apos;");
- XML_ENTITIES.put("<", "&lt;");
- XML_ENTITIES.put(">", "&gt;");
- }
-
- private final P_Registry m_nameRegistry;
- private final P_Registry m_textRegistry;
- private final P_Registry m_attvRegistry;
-
- private boolean m_acceptRegExQueries;
- private boolean m_ignoreQueryCase;
- private boolean m_ignoreIndentWhitespace;
- private String m_indent;
- private String m_externalDtdPublicId;
- private String m_externalDtdLocation;
- private boolean m_prettyPrint;
- private ScoutXmlElement m_root;
- private boolean m_strictlyChecking;
- private String m_xmlEncoding;
- private String m_xmlVersion;
-
- /**
- * @since 1.0
- */
- public ScoutXmlDocument() {
- m_nameRegistry = new P_Registry();
- m_textRegistry = new P_Registry();
- m_attvRegistry = new P_Registry();
-
- this.setAcceptRegExQueries(DEFAULT_ACCEPT_REGEX_QUERIES);
- this.setIgnoreIndentWhitespace(DEFAULT_IGNORE_INDENT_WHITESPACE);
- this.setIgnoreQueryCase(DEFAULT_IGNORE_QUERY_CASE);
- this.setIndent(DEFAULT_INDENT);
- this.setPrettyPrint(DEFAULT_PRETTY_PRINT);
- this.setStrictlyChecking(DEFAULT_STRICTLY_CHECKING);
- this.setXmlEncoding(DEFAULT_XML_ENCODING);
- this.setXmlVersion(DEFAULT_XML_VERSION);
-
- this.setExternalDTD(null, null);
- }
-
- /**
- * @since 1.0
- */
- public ScoutXmlDocument(File file) {
- this();
-
- try {
- new ScoutXmlParser(this).parse(file);
- }
- catch (Exception exception) {
- LOG.error("Could not parse the given file.", exception);
- }
- }
-
- /**
- * @since 1.0
- */
- public ScoutXmlDocument(InputStream stream) {
- this();
-
- try {
- new ScoutXmlParser(this).parse(stream);
- }
- catch (Exception exception) {
- LOG.error("Could not parse the given stream.", exception);
- }
- }
-
- /**
- * @since 1.0
- */
- public ScoutXmlDocument(InputStream stream, String systemID) {
- this();
-
- try {
- new ScoutXmlParser(this).parse(stream, systemID);
- }
- catch (Exception exception) {
- LOG.error("Could not parse the given stream.", exception);
- }
- }
-
- /**
- * @since 1.0
- */
- public ScoutXmlDocument(ScoutXmlElement root) {
- this();
- this.setRoot(root);
- }
-
- /**
- * @since 1.0
- */
- public ScoutXmlDocument(String source) {
- this();
-
- try {
- new ScoutXmlParser(this).parse(source);
- }
- catch (Exception exception) {
- LOG.error("Could not parse the given source.", exception);
- }
- }
-
- /**
- * @since 1.0
- */
- public ScoutXmlDocument(String source, String systemID) {
- this();
-
- try {
- new ScoutXmlParser(this).parse(source, systemID);
- }
- catch (Exception exception) {
- LOG.error("Could not parse the given file.", exception);
- }
- }
-
- /**
- * @since 1.0
- */
- public ScoutXmlDocument(URL url) {
- this();
-
- try {
- new ScoutXmlParser(this).parse(url);
- }
- catch (Exception exception) {
- LOG.error("Could not parse the given file.", exception);
- }
- }
-
- /**
- * Returns true if and only if the String representations of the two
- * ScoutXmlDocument instances are equal. Indents and new-line characters are
- * ignored.
- *
- * @since 1.3
- */
- public boolean equalsSemantically(Object object) {
- if (object == null) {
- return false;
- }
- try {
- boolean oldSetting = this.isPrettyPrint();
- this.setPrettyPrint(false);
- String string = this.getRoot().toString();
- this.setPrettyPrint(oldSetting);
- if (object instanceof ScoutXmlDocument) {
- oldSetting = ((ScoutXmlDocument) object).isPrettyPrint();
- ((ScoutXmlDocument) object).setPrettyPrint(false);
- boolean result = string.equals(((ScoutXmlDocument) object).getRoot().toString());
- ((ScoutXmlDocument) object).setPrettyPrint(oldSetting);
-
- return result;
- }
- else if (object instanceof String) {
- return string.equals(object);
- }
- else {
- return false;
- }
- }
- catch (Exception exception) {
- return false;
- }
- }
-
- /**
- * @since 1.1
- */
- public ScoutXmlElement getChild(String name) {
- String n = null;
-
- if (name.startsWith(n = this.getRoot().getNameExpanded())) {
- if (name.equals(n)) {
- return this.getRoot();
- }
- else {
- return this.getRoot().getChild(name.replaceFirst(n, ""));
- }
- }
- else if (name.startsWith(n = this.getRoot().getNamePrefixed())) {
- if (name.equals(n)) {
- return this.getRoot();
- }
- else {
- return this.getRoot().getChild(name.replaceFirst(n, ""));
- }
- }
- else {
- return null;
- }
- }
-
- /**
- * @since 1.0
- */
- public String getExternalDtdLocation() {
- return m_externalDtdLocation;
- }
-
- /**
- * @since 1.0
- */
- public String getExternalDtdPublicId() {
- return m_externalDtdLocation;
- }
-
- /**
- * @since 1.0
- */
- public String getIndent() {
- return m_indent;
- }
-
- /**
- * @since 1.0
- */
- public ScoutXmlElement getRoot() {
- return m_root;
- }
-
- /**
- * @since 1.0
- */
- public String getXmlEncoding() {
- return m_xmlEncoding;
- }
-
- /**
- * @since 1.0
- */
- public String getXmlVersion() {
- return m_xmlVersion;
- }
-
- /**
- * @since 1.0
- */
- public boolean hasExternalDTD() {
- return (m_externalDtdLocation != null);
- }
-
- /**
- * @since 1.0
- */
- public boolean hasRoot() {
- return (m_root != null);
- }
-
- /**
- * @since 1.0
- */
- public boolean isAcceptRegExQueries() {
- return m_acceptRegExQueries;
- }
-
- /**
- * @since 1.0
- */
- public boolean isEmpty() {
- return ((m_root == null) && (m_externalDtdLocation == null) && (m_externalDtdPublicId == null));
- }
-
- /**
- * @since 1.0
- */
- public boolean isIgnoreIndentWhitespace() {
- return m_ignoreIndentWhitespace;
- }
-
- /**
- * @since 1.0
- */
- public boolean isIgnoreQueryCase() {
- return m_ignoreQueryCase;
- }
-
- /**
- * @since 1.0
- */
- public boolean isPrettyPrint() {
- return m_prettyPrint;
- }
-
- /**
- * @since 1.0
- */
- public boolean isStrictlyChecking() {
- return m_strictlyChecking;
- }
-
- /**
- * @since 1.0
- */
- public void setAcceptRegExQueries(boolean acceptRegEx) {
- m_acceptRegExQueries = acceptRegEx;
- }
-
- /**
- * @since 1.0
- */
- public void setExternalDTD(String publicID, String dtdLocation) {
- m_externalDtdPublicId = publicID;
- m_externalDtdLocation = dtdLocation;
- }
-
- /**
- * @since 1.0
- */
- public void setIgnoreIndentWhitespace(boolean indentWhitespace) {
- m_ignoreIndentWhitespace = indentWhitespace;
- }
-
- /**
- * @since 1.0
- */
- public void setIgnoreQueryCase(boolean ignoreCase) {
- m_ignoreQueryCase = ignoreCase;
- }
-
- /**
- * @since 1.0
- */
- public void setIndent(String indent) {
- m_indent = indent;
- }
-
- /**
- * @since 1.0
- */
- public void setPrettyPrint(boolean prettyPrint) {
- m_prettyPrint = prettyPrint;
-
- if (prettyPrint) {
- this.setIndent(DEFAULT_INDENT);
- }
- else {
- this.setIndent("");
- }
- }
-
- /**
- * @since 1.0
- */
- public void setRoot(ScoutXmlElement root) {
- if (root.getDocument().equals(ScoutXmlDocument.this)) {
- m_root = root;
- }
- else {
- m_root = null;
-
- try {
- new ScoutXmlParser(this).parse(root.toString());
- }
- catch (Exception exception) {
- // Must not happpen
- }
- }
- }
-
- /**
- * @since 1.0
- */
- public ScoutXmlElement setRoot(String name) {
- return (m_root = new ScoutXmlElement(name));
- }
-
- /**
- * @since 1.0
- */
- public void setStrictlyChecking(boolean strictlyChecking) {
- m_strictlyChecking = strictlyChecking;
- }
-
- /**
- * @since 1.0
- */
- public void setXmlEncoding(String encoding) {
- m_xmlEncoding = encoding;
- }
-
- /**
- * @since 1.0
- */
- public void setXmlVersion(String xmlVersion) {
- m_xmlVersion = xmlVersion;
- }
-
- /**
- * Converts the XML datastructure into an ArrayList[] Works of course only
- * with specific XML documents, for example one which was created with new
- * ScoutXmlDocument(arrayList).
- *
- * @since 1.2
- */
- @SuppressWarnings("unchecked")
- public ArrayList[] toData() {
- ArrayList[] data = null;
- ScoutXmlElement rowElement = null;
- ScoutXmlElement colElement = null;
-
- try {
- int noRows = this.getChild("ArrayList").countChildren();
- data = new ArrayList[noRows];
-
- for (int rowNr = 0; rowNr < noRows; rowNr++) {
- rowElement = this.getChild("ArrayList").getChild(rowNr);
- data[rowNr] = new ArrayList(rowElement.countChildren());
-
- for (int colNr = 0; colNr < rowElement.countChildren(); colNr++) {
- colElement = this.getChild("ArrayList").getChild(rowNr).getChild(colNr);
- data[rowNr].add(Class.forName(colElement.getAttribute("type")).getConstructor(new Class[]{String.class}).newInstance(new Object[]{colElement.getText()}));
- }
- }
- }
- catch (Exception exception) {
- LOG.error("Could not create ArrayList[].", exception);
- }
-
- return data;
- }
-
- /**
- * @since 1.0
- */
- @Override
- public String toString() {
- try {
- StringWriter writer = new StringWriter();
- this.write(writer);
- writer.close();
-
- return writer.toString();
- }
- catch (Exception exception) {
- return null;
- }
- }
-
- /**
- * @since 1.0
- */
- public File write(File file) throws IOException {
- this.write(new FileOutputStream(file));
- return file;
- }
-
- /**
- * @since 1.0
- */
- public void write(OutputStream stream) throws IOException {
- this.write(new BufferedWriter(new OutputStreamWriter(stream, m_xmlEncoding)));
- }
-
- /**
- * @since 1.0
- */
- private void write(Writer writer) throws IOException {
- BufferedWriter bufferedWriter = null;
-
- if (writer instanceof BufferedWriter) {
- bufferedWriter = (BufferedWriter) writer;
- }
- else {
- bufferedWriter = new BufferedWriter(writer);
- }
-
- bufferedWriter.write("<?xml version=\"" + m_xmlVersion + "\" encoding=\"" + m_xmlEncoding + "\"?>");
-
- if (ScoutXmlDocument.this.isPrettyPrint()) {
- bufferedWriter.newLine();
- }
-
- if (m_root != null) {
- if (m_externalDtdLocation != null) {
- bufferedWriter.write("<!DOCTYPE");
- bufferedWriter.write(' ');
- bufferedWriter.write(m_root.getNamePrefixed());
- bufferedWriter.write(' ');
-
- if (m_externalDtdPublicId == null) {
- bufferedWriter.write("SYSTEM \"" + m_externalDtdLocation);
- }
- else {
- bufferedWriter.write("PUBLIC \"" + m_externalDtdPublicId + "\" \"" + m_externalDtdLocation);
- }
- bufferedWriter.write("\">");
-
- if (ScoutXmlDocument.this.isPrettyPrint()) {
- bufferedWriter.newLine();
- }
- }
-
- m_root.write(bufferedWriter);
- }
-
- bufferedWriter.flush();
- }
-
- private abstract class P_AbstractNode implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- protected int m_nameID; // The name ID of this node. Is resolved in the
-
- // enclosing document.
-
- /**
- * Returns this node's QName.
- *
- * @return This node's QName.
- * @since 1.0
- */
- public abstract ScoutXmlQName getName();
-
- /**
- * Returns this node's QName in the expanded form. If the namespace doesn't
- * exist only the localName is returned.
- *
- * @return This node's QName in the expanded form. For example
- * "{http://namespace}localName".
- * @since 1.0
- */
- public String getNameExpanded() {
- return this.getName().getExpandedForm();
- }
-
- /**
- * Returns this node's QName in the prefixed form. If the prefix doesn't
- * exist only the localName is returned.
- *
- * @return This node's QName in the prefixed form. For example
- * "ns0:localName".
- * @since 1.0
- */
- public String getNamePrefixed() {
- return m_nameRegistry.getValueAsString(m_nameID);
- }
-
- /**
- * @since 1.0
- */
- public abstract String getNamespace(String prefix);
-
- /**
- * Sets this node's name. Accepted forms are 'localname',
- * '{namespace}localname' and 'prefix:localname'. In the case of a prefixed
- * name, the corresponding namespace is only checked if the document is set
- * to strictly checking.
- *
- * @since 1.0
- */
- public void setName(String name) {
- if (ScoutXmlDocument.this.isStrictlyChecking()) {
- if (ScoutXmlQName.isPrefixed(name)) {
- if (getNamespace(ScoutXmlQName.extractPrefix(name)) == null) {
- throw new ScoutXmlException("Unbound prefix: " + ScoutXmlQName.extractPrefix(name));
- }
- }
- }
-
- m_nameID = m_nameRegistry.getID(name, true);
- }
-
- /**
- * @since 1.0
- */
- public abstract void write(Writer writer) throws IOException;
- }
-
- private class P_NodeCounter extends P_AbstractNodeVisitor<Integer> implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- private int m_counter = 0;
-
- public P_NodeCounter(String name) {
- super(name);
- }
-
- @Override
- public Integer getResult() {
- return m_counter;
- }
-
- @Override
- public boolean isNotDoneYet() {
- return true;
- }
-
- @Override
- protected void nameMatched(P_AbstractNode element) {
- m_counter++;
- }
- }
-
- private class P_NodeExistenceChecker extends P_AbstractNodeVisitor<Boolean> implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- private boolean m_nodeFound = false;
-
- public P_NodeExistenceChecker(String name) {
- super(name);
- }
-
- @Override
- public Boolean getResult() {
- return m_nodeFound;
- }
-
- @Override
- public boolean isNotDoneYet() {
- return !m_nodeFound;
- }
-
- @Override
- protected void nameMatched(P_AbstractNode node) {
- m_nodeFound = true;
- }
- }
-
- private class P_NodeSelectorMulti<T extends P_AbstractNode> extends P_AbstractNodeVisitor<List<T>> implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- private final List<T> m_selectedNodes = new ArrayList<T>();
- private String[] m_requiredAttributeNames = null;
- private String[] m_requiredAttributeValues = null;
-
- public P_NodeSelectorMulti(String name) {
- super(name);
- }
-
- public P_NodeSelectorMulti(String name, String[] requiredAttributeNames, String[] requiredAttributeValues) {
- super(name);
-
- m_requiredAttributeNames = requiredAttributeNames;
- m_requiredAttributeValues = requiredAttributeValues;
- }
-
- @Override
- public List<T> getResult() {
- return m_selectedNodes;
- }
-
- @Override
- public boolean isNotDoneYet() {
- return true;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- protected void nameMatched(P_AbstractNode node) {
- if (m_requiredAttributeNames != null) {
- for (int i = 0; i < m_requiredAttributeNames.length; i++) {
- try {
- if (!((ScoutXmlElement) node).hasAttribute(m_requiredAttributeNames[i], m_requiredAttributeValues[i])) {
- return;
- }
- }
- catch (NullPointerException exception) {
- return;
- }
- }
- }
-
- m_selectedNodes.add((T) node);
- }
- }
-
- private class P_NodeSelectorSingle extends P_AbstractNodeVisitor<P_AbstractNode> implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- private P_AbstractNode m_selectedNode = null;
- private String[] m_requiredAttributeNames = null;
- private String[] m_requiredAttributeValues = null;
-
- public P_NodeSelectorSingle(String name) {
- super(name);
- }
-
- public P_NodeSelectorSingle(String name, String[] requiredAttributeNames, String[] requiredAttributeValues) {
- super(name);
-
- m_requiredAttributeNames = requiredAttributeNames;
- m_requiredAttributeValues = requiredAttributeValues;
- }
-
- @Override
- public P_AbstractNode getResult() {
- return m_selectedNode;
- }
-
- @Override
- public boolean isNotDoneYet() {
- return (m_selectedNode == null);
- }
-
- @Override
- protected void nameMatched(P_AbstractNode node) {
- if (m_requiredAttributeNames != null) {
- for (int i = 0; i < m_requiredAttributeNames.length; i++) {
- try {
- if (!((ScoutXmlElement) node).hasAttribute(m_requiredAttributeNames[i], m_requiredAttributeValues[i])) {
- return;
- }
- }
- catch (NullPointerException exception) {
- return;
- }
- }
- }
-
- m_selectedNode = node;
- }
- }
-
- private abstract class P_AbstractNodeVisitor<T> implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- private int m_mode = 0;
- private String m_stringToCompare;
-
- protected P_AbstractNodeVisitor(String name) {
- if (COMPILED_REGEX_PATTERNS[0].matcher(name).matches()) // * || {*}* || *:*
- {
- m_mode = 0;
- m_stringToCompare = null;
- }
- else if (COMPILED_REGEX_PATTERNS[1].matcher(name).matches()) // {*}localpart *:localpart
- {
- m_mode = 1;
- m_stringToCompare = ScoutXmlQName.extractLocalName(name);
- }
- else if (COMPILED_REGEX_PATTERNS[2].matcher(name).matches()) // {namespace}*
- {
- m_mode = 2;
- m_stringToCompare = ScoutXmlQName.extractNamespace(name);
- }
- else if (COMPILED_REGEX_PATTERNS[3].matcher(name).matches()) // prefix:*
- {
- m_mode = 3;
- m_stringToCompare = ScoutXmlQName.extractPrefix(name);
- }
- else if (COMPILED_REGEX_PATTERNS[4].matcher(name).matches()) // {namespace}localpart || {}localpart
- {
- m_mode = 4;
- m_stringToCompare = name.replaceAll("\\{\\}", "");
- }
- else // prefix:localpart || localpart
- {
- m_mode = 5;
- m_stringToCompare = name;
- }
- }
-
- protected void visit(P_AbstractNode node) {
- String string = "";
-
- switch (m_mode) {
- case 0:
- nameMatched(node);
- return;
- case 1:
- string = node.getName().getLocalName();
- break;
- case 2:
- string = node.getName().getNamespace();
- break;
- case 3:
- string = node.getName().getPrefix();
- break;
- case 4:
- string = node.getNameExpanded();
- break;
- case 5:
- string = node.getNamePrefixed();
- break;
- }
-
- if (ScoutXmlDocument.this.isAcceptRegExQueries()) {
- String stringToCompare;
-
- string = string.replace('{', ' ').replace('}', ' ');
- stringToCompare = m_stringToCompare.replace('{', ' ').replace('}', ' ');
-
- if (m_ignoreQueryCase) {
- string = string.toUpperCase();
- stringToCompare = stringToCompare.toUpperCase();
- }
-
- if (string.matches(stringToCompare)) {
- nameMatched(node);
- }
- }
- else {
- if (m_ignoreQueryCase && string.equalsIgnoreCase(m_stringToCompare)) {
- nameMatched(node);
- }
- else if (string.equals(m_stringToCompare)) {
- nameMatched(node);
- }
- }
- }
-
- protected abstract void nameMatched(P_AbstractNode element);
-
- protected abstract boolean isNotDoneYet();
-
- protected abstract T getResult();
- }
-
- private class P_Registry implements Serializable {
-
- private static final long serialVersionUID = 1L;
- private static final int INITIAL_SIZE = 50;
-
- private final List<Object> m_values; // Maps IDs to values
- private final Map<Object, Integer> m_valuesReverse; // Maps values to IDs
-
- /**
- * @since 1.0
- */
- public P_Registry() {
- m_values = new ArrayList<Object>(INITIAL_SIZE);
- m_valuesReverse = new Hashtable<Object, Integer>(INITIAL_SIZE);
- }
-
- /**
- * @since 1.0
- */
- public int getID(Object value, boolean addValueIfNotExists) {
- if (value != null) {
- if (m_valuesReverse.containsKey(value)) {
- return (m_valuesReverse.get(value)).intValue();
- }
- else if (addValueIfNotExists) {
- m_values.add(value);
- m_valuesReverse.put(value, new Integer(m_values.size() - 1));
-
- return (m_values.size() - 1);
- }
- }
-
- return -1;
- }
-
- /**
- * @since 1.0
- */
- public Object getValue(int valueID) {
- return m_values.get(valueID);
- }
-
- /**
- * @since 1.0
- */
- public Object getValue(Integer valueID) {
- return this.getValue(valueID.intValue());
- }
-
- /**
- * @since 1.0
- */
- public String getValueAsString(int valueID) {
- return (String) this.getValue(valueID);
- }
-
- /**
- * @since 1.0
- */
- public String getValueAsString(Integer valueID) {
- return (String) this.getValue(valueID);
- }
- }
-
- public class ScoutXmlElement extends P_AbstractNode implements Serializable {
-
- private static final long serialVersionUID = 1L;
- private List<P_Attribute> m_attributes; // This element's attributes
- private Object m_content; // This element's content (text, a child, a list of children or a mixed list)
- private Map<String, String> m_namespaces; // This element's namespace declarations
- private ScoutXmlElement m_parent; // This element's predecessor
-
- /**
- * @since 1.0
- */
- protected ScoutXmlElement() {
- m_attributes = null;
- m_content = null;
- m_namespaces = null;
- m_parent = null;
- }
-
- /**
- * @since 1.0
- */
- protected ScoutXmlElement(String name) {
- this();
- super.setName(name);
- }
-
- /**
- * @since 1.0
- */
- public ScoutXmlElement addChild() {
- ScoutXmlElement child = new ScoutXmlElement();
-
- child.setParent(this);
- this.addChild(child);
-
- return child;
- }
-
- /**
- * @since 1.0
- */
- public ScoutXmlElement addChild(String name) {
- ScoutXmlElement child = this.addChild();
-
- child.setName(name);
-
- return child;
- }
-
- /**
- * @since 1.0
- */
- public ScoutXmlElement addChild(ScoutXmlDocument document) {
- return this.addChild(document, -1);
- }
-
- /**
- * @since 1.0
- */
- public ScoutXmlElement addChild(ScoutXmlDocument document, int position) {
- return this.addChild(document.getRoot(), position);
- }
-
- /**
- * @since 1.0
- */
- public ScoutXmlElement addChild(ScoutXmlElement child) {
- return this.addChild(child, -1);
- }
-
- /**
- * @since 1.0
- */
- @SuppressWarnings("unchecked")
- public ScoutXmlElement addChild(ScoutXmlElement child, int position) {
- if (child.getDocument().equals(ScoutXmlDocument.this)) {
- if (child != null) {
- child.setParent(this);
-
- if (m_content == null) {
- m_content = child;
- }
- else if (m_content instanceof List) {
- if (position == -1) {
- ((List) m_content).add(child);
- }
- else {
- ((List) m_content).add(position, child);
- }
- }
- else {
- List newContent = new ArrayList(INITIAL_CONTENT_LIST_SIZE);
- newContent.add(m_content);
- newContent.add(child);
- m_content = newContent;
- }
- }
- }
- else {
- try {
- new ScoutXmlParser(ScoutXmlDocument.this, ScoutXmlElement.this).parse(child.toString());
- }
- catch (Exception e) {
- // Must not happpen
- }
- }
-
- return child;
- }
-
- /**
- * @since 1.0
- */
- public void addChildren(List<ScoutXmlElement> children) {
- for (ScoutXmlElement xmlElement : children) {
- this.addChild(xmlElement);
- }
- }
-
- /**
- * @since 1.0
- */
- public void addContent(Object content) {
- if (content instanceof ScoutXmlElement) {
- this.addChild((ScoutXmlElement) content);
- }
- else {
- this.addText(content.toString());
- }
- }
-
- /**
- * @since 1.0
- */
- @SuppressWarnings("unchecked")
- public void addText(String text) {
- if ((text != null) && (!text.equals(""))) {
- Integer textID = new Integer(m_textRegistry.getID(text, true));
-
- if (m_content == null) {
- m_content = textID;
- }
- else if (m_content instanceof List) {
- ((List) m_content).add(textID);
- }
- else {
- List newContent = new ArrayList(INITIAL_ATTRIBUTE_LIST_SIZE);
- newContent.add(m_content);
- newContent.add(textID);
- m_content = newContent;
- }
- }
- }
-
- /**
- * Returns this element's number of attributes.
- *
- * @since 1.0
- */
- public int countAttributes() {
- if (m_attributes != null) {
- return m_attributes.size();
- }
- else {
- return 0;
- }
- }
-
- /**
- * Returns this element's number of attributes with the given name.
- *
- * @since 1.0
- */
- public int countAttributes(String name) {
- return this.visitAttributes(new P_NodeCounter(name));
- }
-
- /**
- * Returns this element's number of child elements.
- *
- * @since 1.0
- */
- public int countChildren() {
- if (m_content instanceof List) {
- Iterator iterator = ((List) m_content).iterator();
- int noChildren = 0;
-
- while (iterator.hasNext()) {
- if (iterator.next() instanceof ScoutXmlElement) {
- noChildren++;
- }
- }
-
- return noChildren;
- }
- else if (m_content instanceof ScoutXmlElement) {
- return 1;
- }
- else {
- return 0;
- }
- }
-
- /**
- * Returns this element's number of child elements with the given name.
- *
- * @since 1.0
- */
- public int countChildren(String name) {
- return this.visitChildren(new P_NodeCounter(name));
- }
-
- /**
- * Returns this element's number of descendant elements.
- *
- * @since 1.0
- */
- public int countDescendants() {
- return this.countDescendants("*");
- }
-
- /**
- * Returns this element's number of descendant elements with the given name.
- *
- * @since 1.0
- */
- public int countDescendants(String name) {
- return (this.visitDescendants(new P_NodeCounter(name))).intValue();
- }
-
- /**
- * Returns this element's number of sibling elements.
- *
- * @since 1.1
- */
- public int countSiblings() {
- return this.countSiblings("*");
- }
-
- /**
- * Returns this element's number of sibling elements with the given name.
- *
- * @since 1.1
- */
- public int countSiblings(String name) {
- if (this.hasParent()) {
- return this.getParent().visitChildren(new P_NodeCounter(name)) - 1;
- }
- else {
- return 0;
- }
- }
-
- /**
- * Returns the number of namespaces which are declared on this element.
- *
- * @since 1.0
- */
- public int countNamespaces() {
- if (this.hasNamespace()) {
- return m_namespaces.size();
- }
- else {
- return 0;
- }
- }
-
- /**
- * Retrieves an attribute value by name.
- *
- * @param name
- * The name of the attribute to retrieve.
- * @return The attribute's value.
- * @throws ScoutXmlException
- * If the attribute does not exist or if its value is invalid.
- * @since 1.0
- */
- public String getAttribute(String name) {
- try {
- return this.getAttributeNode(name).getValueAsString();
- }
- catch (NullPointerException exception) {
- throw new ScoutXmlException("Attribute '" + name + "' does not exist for '" + this.getPath() + "'");
- }
- }
-
- /**
- * Retrieves an attribute value by name.
- *
- * @param name
- * The name of the attribute to retrieve.
- * @param defaultValue
- * The default value for this attribute.
- * @return The attribute's value or the default value if the attribute does
- * not exist.
- * @since 1.0
- */
- public String getAttribute(String name, String defaultValue) {
- try {
- return this.getAttributeNode(name).getValueAsString();
- }
- catch (Exception exception) {
- return defaultValue;
- }
- }
-
- /**
- * Retrieves an attribute value by name.
- *
- * @param name
- * The name of the attribute to retrieve.
- * @return The attribute's value.
- * @throws ScoutXmlException
- * If the attribute does not exist or if its value is invalid.
- * @since 1.0
- */
- public boolean getAttributeAsBoolean(String name) {
- try {
- return this.getAttributeNode(name).getValueAsBoolean();
- }
- catch (NullPointerException exception) {
- throw new ScoutXmlException("Attribute '" + name + "' does not exist for '" + this.getPath() + "'");
- }
- }
-
- /**
- * Retrieves an attribute value by name.
- *
- * @param name
- * The name of the attribute to retrieve.
- * @param defaultValue
- * The default value for this attribute.
- * @return The attribute's value or the default value if the attribute does
- * not exist.
- * @since 1.0
- */
- public boolean getAttributeAsBoolean(String name, boolean defaultValue) {
- try {
- return this.getAttributeNode(name).getValueAsBoolean();
- }
- catch (Exception exception) {
- return defaultValue;
- }
- }
-
- /**
- * Retrieves an attribute value by name.
- *
- * @param name
- * The name of the attribute to retrieve.
- * @param format
- * The format pattern for this date.
- * @return The attribute's value.
- * @throws ScoutXmlException
- * If the attribute does not exist or if its value is invalid.
- * @since 1.1
- */
- public Date getAttributeAsDate(String name, String format) {
- try {
- return this.getAttributeNode(name).getValueAsDate(format);
- }
- catch (NullPointerException exception) {
- throw new ScoutXmlException("Attribute '" + name + "' does not exist for '" + this.getPath() + "'");
- }
- }
-
- /**
- * Retrieves an attribute value by name.
- *
- * @param name
- * The name of the attribute to retrieve.
- * @param format
- * The format pattern for this date.
- * @param defaultValue
- * The default value for this attribute.
- * @return The attribute's value or the default value if the attribute does
- * not exist.
- * @since 1.1
- */
- public Date getAttributeAsDate(String name, String format, Date defaultValue) {
- try {
- return this.getAttributeNode(name).getValueAsDate(format);
- }
- catch (Exception exception) {
- return defaultValue;
- }
- }
-
- /**
- * Retrieves an attribute value by name.
- *
- * @param name
- * The name of the attribute to retrieve.
- * @return The attribute's value.
- * @throws ScoutXmlException
- * If the attribute does not exist or if its value is invalid.
- * @since 1.0
- */
- public double getAttributeAsDouble(String name) {
- try {
- return this.getAttributeNode(name).getValueAsDouble();
- }
- catch (NullPointerException exception) {
- throw new ScoutXmlException("Attribute '" + name + "' does not exist for '" + this.getPath() + "'");
- }
- }
-
- /**
- * Retrieves an attribute value by name.
- *
- * @param name
- * The name of the attribute to retrieve.
- * @param defaultValue
- * The default value for this attribute.
- * @return The attribute's value or the default value if the attribute does
- * not exist.
- * @since 1.0
- */
- public double getAttributeAsDouble(String name, double defaultValue) {
- try {
- return this.getAttributeNode(name).getValueAsDouble();
- }
- catch (Exception exception) {
- return defaultValue;
- }
- }
-
- /**
- * Retrieves an attribute value by name.
- *
- * @param name
- * The name of the attribute to retrieve.
- * @return The attribute's value.
- * @throws ScoutXmlException
- * If the attribute does not exist or if its value is invalid.
- * @since 1.0
- */
- public int getAttributeAsInt(String name) {
- try {
- return this.getAttributeNode(name).getValueAsInt();
- }
- catch (NullPointerException exception) {
- throw new ScoutXmlException("Attribute '" + name + "' does not exist for '" + this.getPath() + "'");
- }
- }
-
- /**
- * Retrieves an attribute value by name.
- *
- * @param name
- * The name of the attribute to retrieve.
- * @param defaultValue
- * The default value for this attribute.
- * @return The attribute's value or the default value if the attribute does
- * not exist.
- * @since 1.0
- */
- public int getAttributeAsInt(String name, int defaultValue) {
- try {
- return this.getAttributeNode(name).getValueAsInt();
- }
- catch (Exception exception) {
- return defaultValue;
- }
- }
-
- /**
- * Retrieves an attribute value by name.
- *
- * @param name
- * The name of the attribute to retrieve.
- * @return The attribute's value.
- * @throws ScoutXmlException
- * If the attribute does not exist or if its value is invalid.
- * @since 1.0
- */
- public long getAttributeAsLong(String name) {
- try {
- return this.getAttributeNode(name).getValueAsLong();
- }
- catch (NullPointerException exception) {
- throw new ScoutXmlException("Attribute '" + name + "' does not exist for '" + this.getPath() + "'");
- }
- }
-
- /**
- * Retrieves an attribute value by name.
- *
- * @param name
- * The name of the attribute to retrieve.
- * @param defaultValue
- * The default value for this attribute.
- * @return The attribute's value as a string or the default value if the
- * attribute does not exist.
- * @since 1.0
- */
- public long getAttributeAsLong(String name, long defaultValue) {
- try {
- return this.getAttributeNode(name).getValueAsLong();
- }
- catch (Exception exception) {
- return defaultValue;
- }
- }
-
- /**
- * Retrieves an attribute value by name.
- *
- * @param name
- * The name of the attribute to retrieve.
- * @return The attribute's value.
- * @throws ScoutXmlException
- * If the attribute does not exist or if its value is invalid.
- * @since 1.0
- */
- public short getAttributeAsShort(String name) {
- return this.getAttributeNode(name).getValueAsShort();
- }
-
- /**
- * Retrieves an attribute value by name.
- *
- * @param name
- * The name of the attribute to retrieve.
- * @param defaultValue
- * The default value for this attribute.
- * @return The attribute's value or the default value if the attribute does
- * not exist.
- * @since 1.0
- */
- public short getAttributeAsShort(String name, short defaultValue) {
- try {
- return this.getAttributeNode(name).getValueAsShort();
- }
- catch (Exception exception) {
- return defaultValue;
- }
- }
-
- /**
- * Retrieves an attribute node by name.
- *
- * @param name
- * The name of the attribute to retrieve.
- * @return The attribute node or null if it does not exist.
- * @since 1.0
- */
- private P_Attribute getAttributeNode(String name) {
- return (P_Attribute) this.visitAttributes(new P_NodeSelectorSingle(name));
- }
-
- /**
- * @since 1.0
- */
- private Collection<P_Attribute> getAttributeNodes(String name) {
- return visitAttributes(new P_NodeSelectorMulti<P_Attribute>(name));
- }
-
- /**
- * @since 1.0
- */
- public int getIndex() {
- if (this.hasParent()) {
- return this.getParent().getChildren().indexOf(this);
- }
- else {
- return 0;
- }
- }
-
- /**
- * @since 1.0
- */
- @Override
- public String getNamespace(String prefix) {
- if (prefix != null) {
- if (this.hasNamespace(prefix)) {
- return m_namespaces.get(prefix);
- }
- else if (this.hasParent()) {
- return this.getParent().getNamespace(prefix);
- }
- else {
- return null;
- }
- }
- else {
- return null;
- }
- }
-
- /**
- * @since 1.0
- */
- public Map<String, String> getNamespaces() {
- return m_namespaces;
- }
-
- /**
- * @since 1.0
- */
- public ScoutXmlElement getChild(int index) {
- try {
- if ((index == 0) && (m_content instanceof ScoutXmlElement)) {
- return (ScoutXmlElement) m_content;
- }
- else {
- return this.getChildren().get(index);
- }
- }
- catch (Exception exception) {
- throw new ScoutXmlException("Child with index " + index + " does not exist for '" + this.getPath() + "'");
- }
- }
-
- /**
- * @since 1.0
- */
- public ScoutXmlElement getChild(String name) {
- return (ScoutXmlElement) this.visitChildren(new P_NodeSelectorSingle(name));
- }
-
- /**
- * @since 1.0
- */
- public ScoutXmlElement getChild(String name, String requiredAttributeName, String requiredAttributeValue) {
- return this.getChild(name, new String[]{requiredAttributeName}, new String[]{requiredAttributeValue});
- }
-
- /**
- * @since 1.0
- */
- public ScoutXmlElement getChild(String name, String[] requiredAttributeNames, String[] requiredAttributeValues) {
- return (ScoutXmlElement) this.visitChildren(new P_NodeSelectorSingle(name, requiredAttributeNames, requiredAttributeValues));
- }
-
- /**
- * Returns this element's children. If there are no children, an empty list
- * is returned.
- *
- * @since 1.0
- */
- @SuppressWarnings("unchecked")
- public List<ScoutXmlElement> getChildren() {
- ArrayList<ScoutXmlElement> children = new ArrayList<ScoutXmlElement>();
-
- if (m_content instanceof List) {
- if (this.hasText()) {
- for (int i = 0; i < ((List) m_content).size(); i++) {
- Object o = ((List) m_content).get(i);
-
- if (o instanceof ScoutXmlElement) {
- children.add((ScoutXmlElement) o);
- }
- }
- }
- else {
- return (List<ScoutXmlElement>) m_content;
- }
- }
- else if (m_content instanceof ScoutXmlElement) {
- children.add((ScoutXmlElement) m_content);
- }
-
- return children;
- }
-
- /**
- * @since 1.0
- */
- public List<ScoutXmlElement> getChildren(String name) {
- return visitChildren(new P_NodeSelectorMulti<ScoutXmlElement>(name));
- }
-
- /**
- * @since 1.0
- */
- public ScoutXmlElement getDescendant(String name) {
- return (ScoutXmlElement) this.visitDescendants(new P_NodeSelectorSingle(name));
- }
-
- /**
- * @since 1.0
- */
- public List<ScoutXmlElement> getDescendants(String name) {
- return visitDescendants(new P_NodeSelectorMulti<ScoutXmlElement>(name));
- }
-
- /**
- * @since 1.0
- */
- public ScoutXmlDocument getDocument() {
- return ScoutXmlDocument.this;
- }
-
- /**
- * @since 1.0
- */
- public boolean hasAttribute(String name) {
- try {
- return (this.visitAttributes(new P_NodeExistenceChecker(name))).booleanValue();
- }
- catch (Exception exception) {
- return false;
- }
- }
-
- /**
- * @since 1.0
- */
- public boolean hasAttribute(String name, String value) {
- return (this.hasAttribute(name) && this.getAttribute(name).equals(value));
- }
-
- /**
- * @since 1.0
- */
- public boolean hasAttributeExact(String name) {
- if (this.hasAttributes()) {
- Iterator<P_Attribute> iterator = m_attributes.iterator();
-
- for (int i = 0; iterator.hasNext(); i++) {
- if (iterator.next().getNamePrefixed().equals(name)) {
- return true;
- }
- }
- }
-
- return false;
- }
-
- /**
- * @since 1.0
- */
- public boolean hasAttributes() {
- return (m_attributes != null && !m_attributes.isEmpty());
- }
-
- /**
- * @since 1.0
- */
- public boolean hasChild(String name) {
- return this.visitChildren(new P_NodeExistenceChecker(name));
- }
-
- /**
- * @since 1.0
- */
- public boolean hasChildren() {
- if (m_content instanceof ScoutXmlElement) {
- return true;
- }
- else if (m_content instanceof List) {
- Iterator iterator = ((List) m_content).iterator();
-
- while (iterator.hasNext()) {
- if (iterator.next() instanceof ScoutXmlElement) {
- return true;
- }
- }
- }
-
- return false;
- }
-
- /**
- * @since 1.0
- */
- public boolean hasContent() {
- return (m_content != null);
- }
-
- /**
- * @since 1.0
- */
- public boolean hasNamespace() {
- if (m_namespaces != null) {
- return (!m_namespaces.isEmpty());
- }
- else {
- return false;
- }
- }
-
- /**
- * @since 1.0
- */
- public boolean hasNamespace(String prefix) {
- if (this.hasNamespace() && (prefix != null)) {
- return m_namespaces.containsKey(prefix);
- }
- else {
- return false;
- }
- }
-
- /**
- * @since 1.0
- */
- public boolean hasParent() {
- return (this.getParent() != null);
- }
-
- /**
- * @since 1.0
- */
- public boolean hasName() {
- return (m_nameID != -1);
- }
-
- /**
- * @since 1.0
- */
- public boolean hasText() {
- if (m_content instanceof Integer) {
- return true;
- }
- else if (m_content instanceof String) {
- return (!((String) m_content).equals(""));
- }
- else if (m_content instanceof List) {
- Iterator iterator = ((List) m_content).iterator();
-
- while (iterator.hasNext()) {
- Object contentPart = iterator.next();
- if (contentPart instanceof String || contentPart instanceof Integer) {
- return true;
- }
- }
- }
-
- return false;
- }
-
- /**
- * @since 1.0
- */
- public boolean isRoot() {
- return (!this.hasParent());
- }
-
- /**
- * Optimizes the memory consumption of this element's data structures
- * Intended to be called by an instance of ScoutXmlParser.
- *
- * @since 1.0
- */
- protected void optimize() {
-
- // 1. Optimize content data structure
-
- if (m_content instanceof List) {
- if (((List) m_content).size() == 0) {
- m_content = null;
- }
- else {
- ((ArrayList) m_content).trimToSize();
- }
- }
-
- // 2. Optimize attribute data structure
-
- if (m_attributes != null) {
- if (m_attributes.isEmpty()) {
- m_attributes = null;
- }
- else {
- ((ArrayList) m_attributes).trimToSize();
- }
- }
-
- // 3. Optimize namespace data structure
-
- if (m_namespaces != null) {
- if (m_namespaces.isEmpty()) {
- m_namespaces = null;
- }
- }
- }
-
- /**
- * Retrieves this element's text. If the element contains mixed content the
- * different text parts are concatenated. If the element contains no text
- * the empty string is returned.
- *
- * @return This element's text.
- * @since 1.0
- */
- public String getText() {
- return getText("");
- }
-
- /**
- * Retrieves this element's text. If the element contains mixed content the
- * different text parts are concatenated. If the element contains no text
- * the given defaultValue is returned.
- *
- * @param defaultValue
- * The default value.
- * @return This element's text.
- * @since 1.4
- */
- public String getText(String defaultValue) {
- String text = null;
-
- if (m_content instanceof Integer) {
- text = m_textRegistry.getValueAsString((Integer) m_content);
- }
- else if (m_content instanceof String) {
- text = (String) m_content;
- }
- else if (m_content instanceof List) {
- StringBuffer stringBuffer = new StringBuffer();
-
- for (int i = 0; i < ((List) m_content).size(); i++) {
- Object contentPart = ((List) m_content).get(i);
-
- if (contentPart instanceof String) {
- stringBuffer.append((String) contentPart);
- }
- else if (contentPart instanceof Integer) {
- stringBuffer.append(m_textRegistry.getValueAsString((Integer) contentPart));
- }
- }
-
- text = stringBuffer.toString();
- }
-
- if (text != null) {
- if (ScoutXmlDocument.this.isIgnoreIndentWhitespace()) {
- return text.replaceAll("\n *", "\n").replaceAll("\n\t*", "\n");
- }
- else {
- return text;
- }
- }
- else {
- return defaultValue;
- }
- }
-
- /**
- * Retrieves this element's text.
- *
- * @return The element's text.
- * @throws ScoutXmlException
- * If the value is invalid.
- * @since 1.0
- */
- public boolean getTextAsBoolean() {
- try {
- return Boolean.valueOf(this.getText()).booleanValue();
- }
- catch (Exception exception) {
- throw new ScoutXmlException("The text '" + this.getText() + "' is not a valid 'boolean' value (" + ScoutXmlElement.this.getPath() + ")");
- }
- }
-
- /**
- * Retrieves this element's text.
- *
- * @param defaultValue
- * The default value.
- * @return The element's text or the default value if the text value is
- * invalid.
- * @since 1.0
- */
- public boolean getTextAsBoolean(boolean defaultValue) {
- try {
- return Boolean.valueOf(this.getText()).booleanValue();
- }
- catch (Exception exception) {
- return defaultValue;
- }
- }
-
- /**
- * Retrieves this element's text.
- *
- * @format The date's format pattern.
- * @return The element's text.
- * @throws ScoutXmlException
- * If the value is invalid.
- * @since 1.0
- */
- public Date getTextAsDate(String format) {
- try {
- return new SimpleDateFormat(format).parse(this.getText());
- }
- catch (Exception exception) {
- throw new ScoutXmlException("The text '" + this.getText() + "' is not a valid 'Date' value (" + ScoutXmlElement.this.getPath() + ")");
- }
- }
-
- /**
- * Retrieves this element's text.
- *
- * @format The date's format pattern.
- * @param defaultValue
- * The default value.
- * @return The element's text or the default value if the text value is
- * invalid.
- * @since 1.0
- */
- public Date getTextAsDate(String format, Date defaultValue) {
- try {
- return new SimpleDateFormat(format).parse(this.getText());
- }
- catch (Exception exception) {
- return defaultValue;
- }
- }
-
- /**
- * Retrieves this element's text.
- *
- * @return The element's text.
- * @throws ScoutXmlException
- * If the value is invalid.
- * @since 1.0
- */
- public double getTextAsDouble() {
- try {
- return Double.valueOf(this.getText()).doubleValue();
- }
- catch (Exception exception) {
- throw new ScoutXmlException("The text '" + this.getText() + "' is not a valid 'double' value (" + ScoutXmlElement.this.getPath() + ")");
- }
- }
-
- /**
- * Retrieves this element's text.
- *
- * @param defaultValue
- * The default value.
- * @return The element's text or the default value if the text value is
- * invalid.
- * @since 1.0
- */
- public double getTextAsDouble(double defaultValue) {
- try {
- return Double.valueOf(this.getText()).doubleValue();
- }
- catch (Exception exception) {
- return defaultValue;
- }
- }
-
- /**
- * Retrieves this element's text.
- *
- * @return The element's text.
- * @throws ScoutXmlException
- * If the value is invalid.
- * @since 1.0
- */
- public int getTextAsInt() {
- try {
- return Integer.valueOf(this.getText()).intValue();
- }
- catch (Exception exception) {
- throw new ScoutXmlException("The text '" + this.getText() + "' is not a valid 'int' value (" + ScoutXmlElement.this.getPath() + ")");
- }
- }
-
- /**
- * Retrieves this element's text.
- *
- * @param defaultValue
- * The default value.
- * @return The element's text or the default value if the text value is
- * invalid.
- * @since 1.0
- */
- public int getTextAsInt(int defaultValue) {
- try {
- return Integer.valueOf(this.getText()).intValue();
- }
- catch (Exception exception) {
- return defaultValue;
- }
- }
-
- /**
- * Retrieves this element's text.
- *
- * @return The element's text.
- * @throws ScoutXmlException
- * If the value is invalid.
- * @since 1.0
- */
- public long getTextAsLong() {
- try {
- return Long.valueOf(this.getText()).longValue();
- }
- catch (Exception exception) {
- throw new ScoutXmlException("The text '" + this.getText() + "' is not a valid 'long' value (" + ScoutXmlElement.this.getPath() + ")");
- }
- }
-
- /**
- * Retrieves this element's text.
- *
- * @param defaultValue
- * The default value.
- * @return The element's text or the default value if the text value is
- * invalid.
- * @since 1.0
- */
- public long getTextAsLong(long defaultValue) {
- try {
- return Long.valueOf(this.getText()).longValue();
- }
- catch (Exception exception) {
- return defaultValue;
- }
- }
-
- /**
- * Retrieves this element's text.
- *
- * @return The element's text.
- * @throws ScoutXmlException
- * If the value is invalid.
- * @since 1.0
- */
- public short getTextAsShort() {
- try {
- return Short.valueOf(this.getText()).shortValue();
- }
- catch (Exception exception) {
- throw new ScoutXmlException("The text '" + this.getText() + "' is not a valid 'short' value (" + ScoutXmlElement.this.getPath() + ")");
- }
- }
-
- /**
- * Retrieves this element's text.
- *
- * @param defaultValue
- * The default value.
- * @return The element's text or the default value if the text value is
- * invalid.
- * @since 1.0
- */
- public short getTextAsShort(short defaultValue) {
- try {
- return Short.valueOf(this.getText()).shortValue();
- }
- catch (Exception exception) {
- return defaultValue;
- }
- }
-
- public String getLocalName() {
- String name = m_nameRegistry.getValueAsString(m_nameID);
- String localName = ScoutXmlQName.extractLocalName(name);
- return localName;
- }
-
- public String getNamePrefix() {
- String name = m_nameRegistry.getValueAsString(m_nameID);
- String prefix = ScoutXmlQName.extractPrefix(name);
- return prefix;
- }
-
- public String getNameNamespace() {
- String name = m_nameRegistry.getValueAsString(m_nameID);
- String prefix = ScoutXmlQName.extractPrefix(name);
- return getNamespace(prefix);
- }
-
- /**
- * @since 1.0
- */
- @Override
- public ScoutXmlQName getName() {
- String name = m_nameRegistry.getValueAsString(m_nameID);
- String prefix = ScoutXmlQName.extractPrefix(name);
- String localName = ScoutXmlQName.extractLocalName(name);
- return new ScoutXmlQName(this.getNamespace(prefix), prefix, localName);
- }
-
- /**
- * @since 1.0
- */
- public ScoutXmlElement getParent() {
- return m_parent;
- }
-
- /**
- * @since 1.1
- */
- public String getPath() {
- StringBuffer buffer = new StringBuffer();
- ScoutXmlElement element = this;
-
- while (element.hasParent()) {
- if (element.countSiblings(element.getNameExpanded()) > 0) {
- buffer.insert(0, ']');
- buffer.insert(0, element.getIndex());
- buffer.insert(0, '[');
- }
-
- buffer.insert(0, element.getNameExpanded());
- buffer.insert(0, '/');
-
- element = element.getParent();
- }
-
- buffer.insert(0, element.getNameExpanded());
-
- return buffer.toString();
- }
-
- /**
- * @since 1.0
- */
- public ScoutXmlElement getRoot() {
- if (this.hasParent()) {
- return this.getParent().getRoot();
- }
- else {
- return this;
- }
- }
-
- /**
- * Removes this element's attribute which matches the given name. Nothing is
- * done if the attribute can't be found.
- *
- * @since 1.0
- */
- public void removeAttribute(String name) {
- try {
- m_attributes.remove(this.getAttributeNode(name));
- }
- catch (Exception exception) {
- // Do nothing...
- }
- }
-
- /**
- * Removes all of this element's attributes.
- *
- * @since 1.0
- */
- public void removeAttributes() {
- m_attributes = null;
- }
-
- /**
- * Removes all of this element's attributes which match the given name.
- * Nothing is done if no matching attribute can be found.
- *
- * @since 1.0
- */
- public void removeAttributes(String name) {
- try {
- m_attributes.removeAll(this.getAttributeNodes(name));
- }
- catch (Exception exception) {
- // Do nothing...
- }
- }
-
- /**
- * Removes the the child with the given index. Nothing is done if the child
- * can't be found.
- *
- * @since 1.0
- */
- public void removeChild(int index) {
- try {
- this.removeChild(this.getChild(index));
- }
- catch (Exception exception) {
- // Do nothing...
- }
- }
-
- /**
- * Removes the given child from this element. Nothing is done if the child
- * element doesn't belong to this element.
- *
- * @param child
- * The element to be removed.
- * @since 1.0
- */
- public void removeChild(ScoutXmlElement child) {
- try {
- if (m_content.equals(child)) {
- m_content = null;
- }
- else {
- ((List) m_content).remove(child);
- }
- }
- catch (Exception exception) {
- // Do nothing...
- }
- }
-
- /**
- * Removes the given child from this element. Nothing is done if the child
- * element can't be found.
- *
- * @param child
- * The element to be removed.
- * @since 1.0
- */
- public void removeChild(String name) {
- try {
- this.removeChild(this.getChild(name));
- }
- catch (Exception exception) {
- // Do nothing...
- }
- }
-
- /**
- * Removes all children of this element.
- *
- * @since 1.0
- */
- public void removeChildren() {
- m_content = null;
- }
-
- /**
- * Removes the given children.
- *
- * @param children
- * @since 1.0
- */
- @SuppressWarnings("unchecked")
- public void removeChildren(Collection<ScoutXmlElement> children) {
- try {
- ((List<P_AbstractNode>) m_content).removeAll(children);
- }
- catch (Exception exception) {
- // Do nothing...
- }
- }
-
- /**
- * Removes all children which match the given name.
- *
- * @param name
- * @since 1.0
- */
- public void removeChildren(String name) {
- try {
- removeChildren(this.getChildren(name));
- }
- catch (Exception exception) {
- // Do nothing...
- }
- }
-
- /**
- * Removes all content of this element. This includes text and children.
- *
- * @since 1.0
- */
- public void removeContent() {
- m_content = null;
- }
-
- /**
- * @since 1.0
- */
- public void removeNamespace(String prefix) {
- if (this.hasNamespace(prefix)) {
- m_namespaces.remove(prefix);
- }
- else {
- LOG.warn("Namespace with prefix '" + prefix + "' not removed, it doesn't exist for element '" + this.getNamePrefixed() + "'.");
- }
- }
-
- /**
- * @since 1.0
- */
- public void removeNamespaces() {
- m_namespaces = null;
- }
-
- /**
- * Removes this element's text.
- *
- * @since 1.0
- */
- public void removeText() {
- if (m_content instanceof Integer) {
- m_content = null;
- }
- else if (m_content instanceof String) {
- m_content = null;
- }
- else if (m_content instanceof List) {
- for (int i = 0; i < ((List) m_content).size(); i++) {
- Object contentPart = ((List) m_content).get(i);
-
- if (contentPart instanceof String) {
- ((List) m_content).remove(contentPart);
- }
- else if (contentPart instanceof Integer) {
- ((List) m_content).remove(contentPart);
- }
- }
- }
- }
-
- /**
- * Adds a new attribute or modifies an existing one.
- *
- * @param name
- * The name of the attribute to create or modify.
- * @param value
- * The value to be set.
- * @since 1.0
- */
- public void setAttribute(String name, boolean value) {
- this.setAttribute(name, String.valueOf(value));
- }
-
- /**
- * Adds a new attribute or modifies an existing one.
- *
- * @param name
- * The name of the attribute to create or modify.
- * @param value
- * The value to be set.
- * @since 1.1
- */
- public void setAttribute(String name, Date value, String dateFormat) {
- this.setAttribute(name, new SimpleDateFormat(dateFormat).format(value));
- }
-
- /**
- * Adds a new attribute or modifies an existing one.
- *
- * @param name
- * The name of the attribute to create or modify.
- * @param value
- * The value to be set.
- * @since 1.0
- */
- public void setAttribute(String name, double value) {
- this.setAttribute(name, String.valueOf(value));
- }
-
- /**
- * Adds a new attribute or modifies an existing one.
- *
- * @param name
- * The name of the attribute to create or modify.
- * @param value
- * The value to be set.
- * @since 1.0
- */
- public void setAttribute(String name, int value) {
- this.setAttribute(name, String.valueOf(value));
- }
-
- /**
- * Adds a new attribute or modifies an existing one.
- *
- * @param name
- * The name of the attribute to create or modify.
- * @param value
- * The value to be set.
- * @since 1.0
- */
- public void setAttribute(String name, long value) {
- this.setAttribute(name, String.valueOf(value));
- }
-
- /**
- * Adds a new attribute or modifies an existing one.
- *
- * @param name
- * The name of the attribute to create or modify.
- * @param value
- * The value to be set.
- * @since 1.0
- */
- public void setAttribute(String name, short value) {
- this.setAttribute(name, String.valueOf(value));
- }
-
- /**
- * Adds a new attribute or modifies an existing one.
- *
- * @param name
- * The name of the attribute to create or modify.
- * @param value
- * The value to be set.
- * @since 1.0
- */
- public void setAttribute(String name, String value) {
- if (value != null) {
- if (m_attributes == null) {
- m_attributes = new ArrayList<P_Attribute>(INITIAL_ATTRIBUTE_LIST_SIZE);
- }
-
- P_Attribute newAttribute = new P_Attribute(name, value);
-
- if (ScoutXmlDocument.this.isStrictlyChecking() && this.hasAttribute(newAttribute.getNameExpanded())) {
- this.getAttributeNode(newAttribute.getNameExpanded()).setValue(value);
- }
-
- m_attributes.add(newAttribute);
- }
- }
-
- /**
- * @param attributes
- * @since 1.0
- */
- protected void setAttributes(Attributes attributes) {
- if (attributes.getLength() > 0) {
- if (m_attributes == null) {
- m_attributes = new ArrayList<P_Attribute>(attributes.getLength());
- }
-
- for (int i = 0; i < attributes.getLength(); i++) {
- if ((attributes.getValue(i) != null) && (!attributes.getValue(i).equals(""))) {
- m_attributes.add(new P_Attribute(attributes.getQName(i), attributes.getValue(i)));
- }
- }
- }
- }
-
- /**
- * @since 1.0
- */
- public void setNamespace(String prefix, String namespaceURI) {
- if (m_namespaces == null) {
- m_namespaces = new Hashtable<String, String>(INITIAL_NAMESPACE_MAP_SIZE);
- }
-
- m_namespaces.put((prefix != null ? prefix : ""), namespaceURI);
- }
-
- /**
- * @since 1.0
- */
- protected void setNamespaces(Map<String, String> namespaces) {
- if (m_namespaces == null) {
- m_namespaces = new Hashtable<String, String>(namespaces.size());
- }
-
- m_namespaces.putAll(namespaces);
- }
-
- /**
- * @since 1.0
- */
- public void setParent(ScoutXmlElement parent) {
- m_parent = parent;
- }
-
- /**
- * @since 1.0
- */
- public String export() {
- try {
- StringWriter stringWriter = new StringWriter();
- this.write(stringWriter);
- return stringWriter.toString();
- }
- catch (IOException exception) {
- return null;
- }
- }
-
- /**
- * @since 1.0
- */
- @Override
- public String toString() {
- return export();
- }
-
- /**
- * @since 1.0
- */
- protected <T> T visitAttributes(P_AbstractNodeVisitor<T> visitor) {
- if (this.hasAttributes()) {
- Iterator<P_Attribute> iterator = m_attributes.iterator();
-
- while (iterator.hasNext() && visitor.isNotDoneYet()) {
- visitor.visit(iterator.next());
- }
-
- return visitor.getResult();
- }
- else {
- return null;
- }
- }
-
- /**
- * @since 1.0
- */
- protected <T> T visitChildren(P_AbstractNodeVisitor<T> visitor) {
- Iterator<ScoutXmlElement> iterator = this.getChildren().iterator();
-
- while (iterator.hasNext() && visitor.isNotDoneYet()) {
- visitor.visit(iterator.next());
- }
-
- return visitor.getResult();
- }
-
- /**
- * @since 1.0
- */
- protected <T> T visitDescendants(P_AbstractNodeVisitor<T> visitor) {
- Iterator<ScoutXmlElement> iterator = this.getChildren().iterator();
- ScoutXmlElement child = null;
-
- while (iterator.hasNext() && visitor.isNotDoneYet()) {
- child = iterator.next();
-
- visitor.visit(child);
- child.visitDescendants(visitor);
- }
-
- return visitor.getResult();
- }
-
- /**
- * @since 1.0
- */
- @Override
- public void write(Writer writer) throws IOException {
- BufferedWriter bufferedWriter = null;
-
- if (writer instanceof BufferedWriter) {
- bufferedWriter = (BufferedWriter) writer;
- }
- else {
- bufferedWriter = new BufferedWriter(writer);
- }
-
- this.write(bufferedWriter, "");
- bufferedWriter.flush();
- }
-
- /**
- * @since 1.0
- */
- private void write(BufferedWriter bufferedWriter, String currentIndent) throws IOException {
- if (this.hasName()) {
- bufferedWriter.write(currentIndent);
- bufferedWriter.write('<');
- bufferedWriter.write(this.getNamePrefixed());
-
- if (this.hasAttributes()) {
- Iterator<P_Attribute> iterator = m_attributes.iterator();
-
- while (iterator.hasNext()) {
- bufferedWriter.write(' ');
- iterator.next().write(bufferedWriter);
- }
- }
-
- if (this.hasNamespace()) {
- Iterator<String> iterator = m_namespaces.keySet().iterator();
- String prefix = null;
-
- while (iterator.hasNext()) {
- prefix = iterator.next();
-
- bufferedWriter.write(" xmlns");
- if (!prefix.equals("")) {
- bufferedWriter.write(':');
- bufferedWriter.write(prefix);
- }
- bufferedWriter.write('=');
- bufferedWriter.write('"');
- this.writeEncoded(bufferedWriter, this.getNamespace(prefix));
- bufferedWriter.write('"');
- }
- }
-
- if (this.hasContent()) {
- bufferedWriter.write('>');
-
- if (m_content instanceof List) {
- if (ScoutXmlDocument.this.isPrettyPrint()) {
- bufferedWriter.newLine();
- }
-
- for (int i = 0; i < ((List) m_content).size(); i++) {
- Object o = ((List) m_content).get(i);
-
- if (o instanceof ScoutXmlElement) {
- ((ScoutXmlElement) o).write(bufferedWriter, currentIndent + ScoutXmlDocument.this.getIndent());
- }
- else if (o instanceof Integer) {
- bufferedWriter.write(currentIndent + ScoutXmlDocument.this.getIndent());
- this.writeEncoded(bufferedWriter, m_textRegistry.getValueAsString(((Integer) o).intValue()));
-
- if (ScoutXmlDocument.this.isPrettyPrint()) {
- bufferedWriter.newLine();
- }
- }
- }
-
- bufferedWriter.write(currentIndent);
- }
- else if (m_content instanceof ScoutXmlElement) {
- if (ScoutXmlDocument.this.isPrettyPrint()) {
- bufferedWriter.newLine();
- }
-
- ((ScoutXmlElement) m_content).write(bufferedWriter, currentIndent + ScoutXmlDocument.this.getIndent());
- bufferedWriter.write(currentIndent);
- }
- else if (m_content instanceof Integer) {
- this.writeEncoded(bufferedWriter, m_textRegistry.getValueAsString((Integer) m_content));
- }
-
- bufferedWriter.write('<');
- bufferedWriter.write('/');
- bufferedWriter.write(this.getNamePrefixed());
- bufferedWriter.write('>');
- }
- else {
- bufferedWriter.write('/');
- bufferedWriter.write('>');
- }
-
- if (ScoutXmlDocument.this.isPrettyPrint()) {
- bufferedWriter.newLine();
- }
- }
- else {
- throw new ScoutXmlException("Can't write this element because it has no name.");
- }
- }
-
- /**
- * @since 1.0
- */
- protected void writeEncoded(BufferedWriter bufferedWriter, String string) throws IOException {
- if (string != null) {
- for (int i = 0; i < string.length(); i++) {
- String ch = "" + string.charAt(i);
- String escaped = ScoutXmlDocument.XML_ENTITIES.get(ch);
- if (escaped != null) {
- bufferedWriter.write(escaped);
- }
- else {
- bufferedWriter.write(ch);
- }
- }
- }
- }
-
- private class P_Attribute extends P_AbstractNode implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- private int m_valueID;
-
- /**
- * @since 1.0
- */
- public P_Attribute(String name, String value) {
- super.setName(name);
- this.setValue(value);
- }
-
- /**
- * @since 1.0
- */
- @Override
- public boolean equals(Object object) {
- if (object == null) {
- return false;
- }
- try {
- P_Attribute attribute = (P_Attribute) object;
- return this.getName().equals(attribute.getName()) && this.getValueAsString().equals(attribute.getValueAsString());
- }
- catch (Exception exception) {
- return false;
- }
- }
-
- @Override
- public int hashCode() {
- return this.getName().hashCode() ^ this.getValueAsString().hashCode();
- }
-
- /**
- * @since 1.0
- */
- public ScoutXmlDocument getDocument() {
- return ScoutXmlDocument.this;
- }
-
- /**
- * @since 1.0
- */
- @Override
- public ScoutXmlQName getName() {
- String name = m_nameRegistry.getValueAsString(m_nameID);
-
- String prefix = ScoutXmlQName.extractPrefix(name);
- String localName = ScoutXmlQName.extractLocalName(name);
-
- return new ScoutXmlQName(this.getNamespace(prefix), prefix, localName);
- }
-
- /**
- * @since 1.0
- */
- @Override
- public String getNamespace(String prefix) {
- return ScoutXmlElement.this.getNamespace(prefix);
- }
-
- /**
- * @since 1.0
- */
- public Object getValue() {
- return m_nameRegistry.getValue(m_valueID);
- }
-
- /**
- * @since 1.0
- */
- public boolean getValueAsBoolean() {
- return Boolean.valueOf(this.getValueAsString()).booleanValue();
- }
-
- /**
- * @since 1.0
- */
- public Date getValueAsDate(String format) {
- try {
- return new SimpleDateFormat(format).parse(this.getValueAsString());
- }
- catch (Exception exception) {
- throw new ScoutXmlException("Attribute value '" + this.getValueAsString() + "' is not a valid 'Date' value (" + ScoutXmlElement.this.getPath() + "/@" + this.getNameExpanded() + ")");
- }
- }
-
- /**
- * @since 1.0
- */
- public double getValueAsDouble() {
- try {
- return Double.valueOf(this.getValueAsString()).doubleValue();
- }
- catch (NumberFormatException exception) {
- throw new ScoutXmlException("Attribute value '" + this.getValueAsString() + "' is not a valid 'double' value (" + ScoutXmlElement.this.getPath() + "/@" + this.getNameExpanded() + ")");
- }
- }
-
- /**
- * @since 1.0
- */
- public int getValueAsInt() {
- try {
- return Integer.valueOf(this.getValueAsString()).intValue();
- }
- catch (NumberFormatException exception) {
- throw new ScoutXmlException("Attribute value '" + this.getValueAsString() + "' is not a valid 'int' value (" + ScoutXmlElement.this.getPath() + "/@" + this.getNameExpanded() + ")");
- }
- }
-
- /**
- * @since 1.0
- */
- public long getValueAsLong() {
- try {
- return Long.valueOf(this.getValueAsString()).longValue();
- }
- catch (NumberFormatException exception) {
- throw new ScoutXmlException("Attribute value '" + this.getValueAsString() + "' is not a valid 'long' value (" + ScoutXmlElement.this.getPath() + "/@" + this.getNameExpanded() + ")");
- }
- }
-
- /**
- * @since 1.0
- */
- public short getValueAsShort() {
- try {
- return Short.valueOf(this.getValueAsString()).shortValue();
- }
- catch (NumberFormatException exception) {
- throw new ScoutXmlException("Attribute value '" + this.getValueAsString() + "' is not a valid 'short' value (" + ScoutXmlElement.this.getPath() + "/@" + this.getNameExpanded() + ")");
- }
- }
-
- /**
- * @since 1.0
- */
- public String getValueAsString() {
- return m_attvRegistry.getValueAsString(m_valueID);
- }
-
- /**
- * @since 1.0
- */
- public void setValue(String value) {
- m_valueID = m_attvRegistry.getID(value, true);
- }
-
- /**
- * @since 1.0
- */
- @Override
- public String toString() {
- try {
- StringWriter stringWriter = new StringWriter();
- this.write(stringWriter);
- return stringWriter.toString();
- }
- catch (IOException exception) {
- return null;
- }
- }
-
- /**
- * @since 1.0
- */
- @Override
- public void write(Writer writer) throws IOException {
- BufferedWriter bufferedWriter = null;
-
- if (writer instanceof BufferedWriter) {
- bufferedWriter = (BufferedWriter) writer;
- }
- else {
- bufferedWriter = new BufferedWriter(writer);
- }
-
- bufferedWriter.write(m_nameRegistry.getValueAsString(m_nameID));
- bufferedWriter.write('=');
- bufferedWriter.write('"');
- ScoutXmlElement.this.writeEncoded(bufferedWriter, this.getValueAsString());
- bufferedWriter.write('"');
-
- bufferedWriter.flush();
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.xmlparser;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Serializable;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.net.URL;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Pattern;
+
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.xml.sax.Attributes;
+
+/**
+ * Title : Scout XML Document
+ *
+ * @version 2.0
+ */
+public class ScoutXmlDocument implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(ScoutXmlDocument.class);
+
+ private static final boolean DEFAULT_ACCEPT_REGEX_QUERIES = false;
+ private static final boolean DEFAULT_IGNORE_INDENT_WHITESPACE = false;
+ private static final boolean DEFAULT_IGNORE_QUERY_CASE = false;
+ private static final String DEFAULT_INDENT = " ";
+ private static final boolean DEFAULT_PRETTY_PRINT = true;
+ private static final boolean DEFAULT_STRICTLY_CHECKING = true;
+ private static final String DEFAULT_XML_ENCODING = "UTF-8"; // "ISO-8859-1"
+ private static final String DEFAULT_XML_VERSION = "1.0";
+ private static final int INITIAL_ATTRIBUTE_LIST_SIZE = 5;
+ private static final int INITIAL_CONTENT_LIST_SIZE = 10;
+ private static final int INITIAL_NAMESPACE_MAP_SIZE = 5;
+
+ private final static Pattern[] COMPILED_REGEX_PATTERNS = new Pattern[]{
+ Pattern.compile("(\\*)|(\\{\\*\\}\\*)|(\\*:\\*)"),
+ Pattern.compile("(\\{\\*\\}.*)|(\\*:.*)"),
+ Pattern.compile("\\{.*\\}\\*"),
+ Pattern.compile(".*:\\*"),
+ Pattern.compile("\\{.*\\}.*")};
+
+ public static final Hashtable<String, String> XML_ENTITIES;
+
+ static {
+ XML_ENTITIES = new Hashtable<String, String>();
+
+ XML_ENTITIES.put("&", "&amp;");
+ XML_ENTITIES.put("\"", "&quot;");
+ XML_ENTITIES.put("'", "&apos;");
+ XML_ENTITIES.put("<", "&lt;");
+ XML_ENTITIES.put(">", "&gt;");
+ }
+
+ private final P_Registry m_nameRegistry;
+ private final P_Registry m_textRegistry;
+ private final P_Registry m_attvRegistry;
+
+ private boolean m_acceptRegExQueries;
+ private boolean m_ignoreQueryCase;
+ private boolean m_ignoreIndentWhitespace;
+ private String m_indent;
+ private String m_externalDtdPublicId;
+ private String m_externalDtdLocation;
+ private boolean m_prettyPrint;
+ private ScoutXmlElement m_root;
+ private boolean m_strictlyChecking;
+ private String m_xmlEncoding;
+ private String m_xmlVersion;
+
+ /**
+ * @since 1.0
+ */
+ public ScoutXmlDocument() {
+ m_nameRegistry = new P_Registry();
+ m_textRegistry = new P_Registry();
+ m_attvRegistry = new P_Registry();
+
+ this.setAcceptRegExQueries(DEFAULT_ACCEPT_REGEX_QUERIES);
+ this.setIgnoreIndentWhitespace(DEFAULT_IGNORE_INDENT_WHITESPACE);
+ this.setIgnoreQueryCase(DEFAULT_IGNORE_QUERY_CASE);
+ this.setIndent(DEFAULT_INDENT);
+ this.setPrettyPrint(DEFAULT_PRETTY_PRINT);
+ this.setStrictlyChecking(DEFAULT_STRICTLY_CHECKING);
+ this.setXmlEncoding(DEFAULT_XML_ENCODING);
+ this.setXmlVersion(DEFAULT_XML_VERSION);
+
+ this.setExternalDTD(null, null);
+ }
+
+ /**
+ * @since 1.0
+ */
+ public ScoutXmlDocument(File file) {
+ this();
+
+ try {
+ new ScoutXmlParser(this).parse(file);
+ }
+ catch (Exception exception) {
+ LOG.error("Could not parse the given file.", exception);
+ }
+ }
+
+ /**
+ * @since 1.0
+ */
+ public ScoutXmlDocument(InputStream stream) {
+ this();
+
+ try {
+ new ScoutXmlParser(this).parse(stream);
+ }
+ catch (Exception exception) {
+ LOG.error("Could not parse the given stream.", exception);
+ }
+ }
+
+ /**
+ * @since 1.0
+ */
+ public ScoutXmlDocument(InputStream stream, String systemID) {
+ this();
+
+ try {
+ new ScoutXmlParser(this).parse(stream, systemID);
+ }
+ catch (Exception exception) {
+ LOG.error("Could not parse the given stream.", exception);
+ }
+ }
+
+ /**
+ * @since 1.0
+ */
+ public ScoutXmlDocument(ScoutXmlElement root) {
+ this();
+ this.setRoot(root);
+ }
+
+ /**
+ * @since 1.0
+ */
+ public ScoutXmlDocument(String source) {
+ this();
+
+ try {
+ new ScoutXmlParser(this).parse(source);
+ }
+ catch (Exception exception) {
+ LOG.error("Could not parse the given source.", exception);
+ }
+ }
+
+ /**
+ * @since 1.0
+ */
+ public ScoutXmlDocument(String source, String systemID) {
+ this();
+
+ try {
+ new ScoutXmlParser(this).parse(source, systemID);
+ }
+ catch (Exception exception) {
+ LOG.error("Could not parse the given file.", exception);
+ }
+ }
+
+ /**
+ * @since 1.0
+ */
+ public ScoutXmlDocument(URL url) {
+ this();
+
+ try {
+ new ScoutXmlParser(this).parse(url);
+ }
+ catch (Exception exception) {
+ LOG.error("Could not parse the given file.", exception);
+ }
+ }
+
+ /**
+ * Returns true if and only if the String representations of the two
+ * ScoutXmlDocument instances are equal. Indents and new-line characters are
+ * ignored.
+ *
+ * @since 1.3
+ */
+ public boolean equalsSemantically(Object object) {
+ if (object == null) {
+ return false;
+ }
+ try {
+ boolean oldSetting = this.isPrettyPrint();
+ this.setPrettyPrint(false);
+ String string = this.getRoot().toString();
+ this.setPrettyPrint(oldSetting);
+ if (object instanceof ScoutXmlDocument) {
+ oldSetting = ((ScoutXmlDocument) object).isPrettyPrint();
+ ((ScoutXmlDocument) object).setPrettyPrint(false);
+ boolean result = string.equals(((ScoutXmlDocument) object).getRoot().toString());
+ ((ScoutXmlDocument) object).setPrettyPrint(oldSetting);
+
+ return result;
+ }
+ else if (object instanceof String) {
+ return string.equals(object);
+ }
+ else {
+ return false;
+ }
+ }
+ catch (Exception exception) {
+ return false;
+ }
+ }
+
+ /**
+ * @since 1.1
+ */
+ public ScoutXmlElement getChild(String name) {
+ String n = null;
+
+ if (name.startsWith(n = this.getRoot().getNameExpanded())) {
+ if (name.equals(n)) {
+ return this.getRoot();
+ }
+ else {
+ return this.getRoot().getChild(name.replaceFirst(n, ""));
+ }
+ }
+ else if (name.startsWith(n = this.getRoot().getNamePrefixed())) {
+ if (name.equals(n)) {
+ return this.getRoot();
+ }
+ else {
+ return this.getRoot().getChild(name.replaceFirst(n, ""));
+ }
+ }
+ else {
+ return null;
+ }
+ }
+
+ /**
+ * @since 1.0
+ */
+ public String getExternalDtdLocation() {
+ return m_externalDtdLocation;
+ }
+
+ /**
+ * @since 1.0
+ */
+ public String getExternalDtdPublicId() {
+ return m_externalDtdLocation;
+ }
+
+ /**
+ * @since 1.0
+ */
+ public String getIndent() {
+ return m_indent;
+ }
+
+ /**
+ * @since 1.0
+ */
+ public ScoutXmlElement getRoot() {
+ return m_root;
+ }
+
+ /**
+ * @since 1.0
+ */
+ public String getXmlEncoding() {
+ return m_xmlEncoding;
+ }
+
+ /**
+ * @since 1.0
+ */
+ public String getXmlVersion() {
+ return m_xmlVersion;
+ }
+
+ /**
+ * @since 1.0
+ */
+ public boolean hasExternalDTD() {
+ return (m_externalDtdLocation != null);
+ }
+
+ /**
+ * @since 1.0
+ */
+ public boolean hasRoot() {
+ return (m_root != null);
+ }
+
+ /**
+ * @since 1.0
+ */
+ public boolean isAcceptRegExQueries() {
+ return m_acceptRegExQueries;
+ }
+
+ /**
+ * @since 1.0
+ */
+ public boolean isEmpty() {
+ return ((m_root == null) && (m_externalDtdLocation == null) && (m_externalDtdPublicId == null));
+ }
+
+ /**
+ * @since 1.0
+ */
+ public boolean isIgnoreIndentWhitespace() {
+ return m_ignoreIndentWhitespace;
+ }
+
+ /**
+ * @since 1.0
+ */
+ public boolean isIgnoreQueryCase() {
+ return m_ignoreQueryCase;
+ }
+
+ /**
+ * @since 1.0
+ */
+ public boolean isPrettyPrint() {
+ return m_prettyPrint;
+ }
+
+ /**
+ * @since 1.0
+ */
+ public boolean isStrictlyChecking() {
+ return m_strictlyChecking;
+ }
+
+ /**
+ * @since 1.0
+ */
+ public void setAcceptRegExQueries(boolean acceptRegEx) {
+ m_acceptRegExQueries = acceptRegEx;
+ }
+
+ /**
+ * @since 1.0
+ */
+ public void setExternalDTD(String publicID, String dtdLocation) {
+ m_externalDtdPublicId = publicID;
+ m_externalDtdLocation = dtdLocation;
+ }
+
+ /**
+ * @since 1.0
+ */
+ public void setIgnoreIndentWhitespace(boolean indentWhitespace) {
+ m_ignoreIndentWhitespace = indentWhitespace;
+ }
+
+ /**
+ * @since 1.0
+ */
+ public void setIgnoreQueryCase(boolean ignoreCase) {
+ m_ignoreQueryCase = ignoreCase;
+ }
+
+ /**
+ * @since 1.0
+ */
+ public void setIndent(String indent) {
+ m_indent = indent;
+ }
+
+ /**
+ * @since 1.0
+ */
+ public void setPrettyPrint(boolean prettyPrint) {
+ m_prettyPrint = prettyPrint;
+
+ if (prettyPrint) {
+ this.setIndent(DEFAULT_INDENT);
+ }
+ else {
+ this.setIndent("");
+ }
+ }
+
+ /**
+ * @since 1.0
+ */
+ public void setRoot(ScoutXmlElement root) {
+ if (root.getDocument().equals(ScoutXmlDocument.this)) {
+ m_root = root;
+ }
+ else {
+ m_root = null;
+
+ try {
+ new ScoutXmlParser(this).parse(root.toString());
+ }
+ catch (Exception exception) {
+ // Must not happpen
+ }
+ }
+ }
+
+ /**
+ * @since 1.0
+ */
+ public ScoutXmlElement setRoot(String name) {
+ return (m_root = new ScoutXmlElement(name));
+ }
+
+ /**
+ * @since 1.0
+ */
+ public void setStrictlyChecking(boolean strictlyChecking) {
+ m_strictlyChecking = strictlyChecking;
+ }
+
+ /**
+ * @since 1.0
+ */
+ public void setXmlEncoding(String encoding) {
+ m_xmlEncoding = encoding;
+ }
+
+ /**
+ * @since 1.0
+ */
+ public void setXmlVersion(String xmlVersion) {
+ m_xmlVersion = xmlVersion;
+ }
+
+ /**
+ * Converts the XML datastructure into an ArrayList[] Works of course only
+ * with specific XML documents, for example one which was created with new
+ * ScoutXmlDocument(arrayList).
+ *
+ * @since 1.2
+ */
+ @SuppressWarnings("unchecked")
+ public ArrayList[] toData() {
+ ArrayList[] data = null;
+ ScoutXmlElement rowElement = null;
+ ScoutXmlElement colElement = null;
+
+ try {
+ int noRows = this.getChild("ArrayList").countChildren();
+ data = new ArrayList[noRows];
+
+ for (int rowNr = 0; rowNr < noRows; rowNr++) {
+ rowElement = this.getChild("ArrayList").getChild(rowNr);
+ data[rowNr] = new ArrayList(rowElement.countChildren());
+
+ for (int colNr = 0; colNr < rowElement.countChildren(); colNr++) {
+ colElement = this.getChild("ArrayList").getChild(rowNr).getChild(colNr);
+ data[rowNr].add(Class.forName(colElement.getAttribute("type")).getConstructor(new Class[]{String.class}).newInstance(new Object[]{colElement.getText()}));
+ }
+ }
+ }
+ catch (Exception exception) {
+ LOG.error("Could not create ArrayList[].", exception);
+ }
+
+ return data;
+ }
+
+ /**
+ * @since 1.0
+ */
+ @Override
+ public String toString() {
+ try {
+ StringWriter writer = new StringWriter();
+ this.write(writer);
+ writer.close();
+
+ return writer.toString();
+ }
+ catch (Exception exception) {
+ return null;
+ }
+ }
+
+ /**
+ * @since 1.0
+ */
+ public File write(File file) throws IOException {
+ this.write(new FileOutputStream(file));
+ return file;
+ }
+
+ /**
+ * @since 1.0
+ */
+ public void write(OutputStream stream) throws IOException {
+ this.write(new BufferedWriter(new OutputStreamWriter(stream, m_xmlEncoding)));
+ }
+
+ /**
+ * @since 1.0
+ */
+ private void write(Writer writer) throws IOException {
+ BufferedWriter bufferedWriter = null;
+
+ if (writer instanceof BufferedWriter) {
+ bufferedWriter = (BufferedWriter) writer;
+ }
+ else {
+ bufferedWriter = new BufferedWriter(writer);
+ }
+
+ bufferedWriter.write("<?xml version=\"" + m_xmlVersion + "\" encoding=\"" + m_xmlEncoding + "\"?>");
+
+ if (ScoutXmlDocument.this.isPrettyPrint()) {
+ bufferedWriter.newLine();
+ }
+
+ if (m_root != null) {
+ if (m_externalDtdLocation != null) {
+ bufferedWriter.write("<!DOCTYPE");
+ bufferedWriter.write(' ');
+ bufferedWriter.write(m_root.getNamePrefixed());
+ bufferedWriter.write(' ');
+
+ if (m_externalDtdPublicId == null) {
+ bufferedWriter.write("SYSTEM \"" + m_externalDtdLocation);
+ }
+ else {
+ bufferedWriter.write("PUBLIC \"" + m_externalDtdPublicId + "\" \"" + m_externalDtdLocation);
+ }
+ bufferedWriter.write("\">");
+
+ if (ScoutXmlDocument.this.isPrettyPrint()) {
+ bufferedWriter.newLine();
+ }
+ }
+
+ m_root.write(bufferedWriter);
+ }
+
+ bufferedWriter.flush();
+ }
+
+ private abstract class P_AbstractNode implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ protected int m_nameID; // The name ID of this node. Is resolved in the
+
+ // enclosing document.
+
+ /**
+ * Returns this node's QName.
+ *
+ * @return This node's QName.
+ * @since 1.0
+ */
+ public abstract ScoutXmlQName getName();
+
+ /**
+ * Returns this node's QName in the expanded form. If the namespace doesn't
+ * exist only the localName is returned.
+ *
+ * @return This node's QName in the expanded form. For example
+ * "{http://namespace}localName".
+ * @since 1.0
+ */
+ public String getNameExpanded() {
+ return this.getName().getExpandedForm();
+ }
+
+ /**
+ * Returns this node's QName in the prefixed form. If the prefix doesn't
+ * exist only the localName is returned.
+ *
+ * @return This node's QName in the prefixed form. For example
+ * "ns0:localName".
+ * @since 1.0
+ */
+ public String getNamePrefixed() {
+ return m_nameRegistry.getValueAsString(m_nameID);
+ }
+
+ /**
+ * @since 1.0
+ */
+ public abstract String getNamespace(String prefix);
+
+ /**
+ * Sets this node's name. Accepted forms are 'localname',
+ * '{namespace}localname' and 'prefix:localname'. In the case of a prefixed
+ * name, the corresponding namespace is only checked if the document is set
+ * to strictly checking.
+ *
+ * @since 1.0
+ */
+ public void setName(String name) {
+ if (ScoutXmlDocument.this.isStrictlyChecking()) {
+ if (ScoutXmlQName.isPrefixed(name)) {
+ if (getNamespace(ScoutXmlQName.extractPrefix(name)) == null) {
+ throw new ScoutXmlException("Unbound prefix: " + ScoutXmlQName.extractPrefix(name));
+ }
+ }
+ }
+
+ m_nameID = m_nameRegistry.getID(name, true);
+ }
+
+ /**
+ * @since 1.0
+ */
+ public abstract void write(Writer writer) throws IOException;
+ }
+
+ private class P_NodeCounter extends P_AbstractNodeVisitor<Integer> implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private int m_counter = 0;
+
+ public P_NodeCounter(String name) {
+ super(name);
+ }
+
+ @Override
+ public Integer getResult() {
+ return m_counter;
+ }
+
+ @Override
+ public boolean isNotDoneYet() {
+ return true;
+ }
+
+ @Override
+ protected void nameMatched(P_AbstractNode element) {
+ m_counter++;
+ }
+ }
+
+ private class P_NodeExistenceChecker extends P_AbstractNodeVisitor<Boolean> implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private boolean m_nodeFound = false;
+
+ public P_NodeExistenceChecker(String name) {
+ super(name);
+ }
+
+ @Override
+ public Boolean getResult() {
+ return m_nodeFound;
+ }
+
+ @Override
+ public boolean isNotDoneYet() {
+ return !m_nodeFound;
+ }
+
+ @Override
+ protected void nameMatched(P_AbstractNode node) {
+ m_nodeFound = true;
+ }
+ }
+
+ private class P_NodeSelectorMulti<T extends P_AbstractNode> extends P_AbstractNodeVisitor<List<T>> implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private final List<T> m_selectedNodes = new ArrayList<T>();
+ private String[] m_requiredAttributeNames = null;
+ private String[] m_requiredAttributeValues = null;
+
+ public P_NodeSelectorMulti(String name) {
+ super(name);
+ }
+
+ public P_NodeSelectorMulti(String name, String[] requiredAttributeNames, String[] requiredAttributeValues) {
+ super(name);
+
+ m_requiredAttributeNames = requiredAttributeNames;
+ m_requiredAttributeValues = requiredAttributeValues;
+ }
+
+ @Override
+ public List<T> getResult() {
+ return m_selectedNodes;
+ }
+
+ @Override
+ public boolean isNotDoneYet() {
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ protected void nameMatched(P_AbstractNode node) {
+ if (m_requiredAttributeNames != null) {
+ for (int i = 0; i < m_requiredAttributeNames.length; i++) {
+ try {
+ if (!((ScoutXmlElement) node).hasAttribute(m_requiredAttributeNames[i], m_requiredAttributeValues[i])) {
+ return;
+ }
+ }
+ catch (NullPointerException exception) {
+ return;
+ }
+ }
+ }
+
+ m_selectedNodes.add((T) node);
+ }
+ }
+
+ private class P_NodeSelectorSingle extends P_AbstractNodeVisitor<P_AbstractNode> implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private P_AbstractNode m_selectedNode = null;
+ private String[] m_requiredAttributeNames = null;
+ private String[] m_requiredAttributeValues = null;
+
+ public P_NodeSelectorSingle(String name) {
+ super(name);
+ }
+
+ public P_NodeSelectorSingle(String name, String[] requiredAttributeNames, String[] requiredAttributeValues) {
+ super(name);
+
+ m_requiredAttributeNames = requiredAttributeNames;
+ m_requiredAttributeValues = requiredAttributeValues;
+ }
+
+ @Override
+ public P_AbstractNode getResult() {
+ return m_selectedNode;
+ }
+
+ @Override
+ public boolean isNotDoneYet() {
+ return (m_selectedNode == null);
+ }
+
+ @Override
+ protected void nameMatched(P_AbstractNode node) {
+ if (m_requiredAttributeNames != null) {
+ for (int i = 0; i < m_requiredAttributeNames.length; i++) {
+ try {
+ if (!((ScoutXmlElement) node).hasAttribute(m_requiredAttributeNames[i], m_requiredAttributeValues[i])) {
+ return;
+ }
+ }
+ catch (NullPointerException exception) {
+ return;
+ }
+ }
+ }
+
+ m_selectedNode = node;
+ }
+ }
+
+ private abstract class P_AbstractNodeVisitor<T> implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private int m_mode = 0;
+ private String m_stringToCompare;
+
+ protected P_AbstractNodeVisitor(String name) {
+ if (COMPILED_REGEX_PATTERNS[0].matcher(name).matches()) // * || {*}* || *:*
+ {
+ m_mode = 0;
+ m_stringToCompare = null;
+ }
+ else if (COMPILED_REGEX_PATTERNS[1].matcher(name).matches()) // {*}localpart *:localpart
+ {
+ m_mode = 1;
+ m_stringToCompare = ScoutXmlQName.extractLocalName(name);
+ }
+ else if (COMPILED_REGEX_PATTERNS[2].matcher(name).matches()) // {namespace}*
+ {
+ m_mode = 2;
+ m_stringToCompare = ScoutXmlQName.extractNamespace(name);
+ }
+ else if (COMPILED_REGEX_PATTERNS[3].matcher(name).matches()) // prefix:*
+ {
+ m_mode = 3;
+ m_stringToCompare = ScoutXmlQName.extractPrefix(name);
+ }
+ else if (COMPILED_REGEX_PATTERNS[4].matcher(name).matches()) // {namespace}localpart || {}localpart
+ {
+ m_mode = 4;
+ m_stringToCompare = name.replaceAll("\\{\\}", "");
+ }
+ else // prefix:localpart || localpart
+ {
+ m_mode = 5;
+ m_stringToCompare = name;
+ }
+ }
+
+ protected void visit(P_AbstractNode node) {
+ String string = "";
+
+ switch (m_mode) {
+ case 0:
+ nameMatched(node);
+ return;
+ case 1:
+ string = node.getName().getLocalName();
+ break;
+ case 2:
+ string = node.getName().getNamespace();
+ break;
+ case 3:
+ string = node.getName().getPrefix();
+ break;
+ case 4:
+ string = node.getNameExpanded();
+ break;
+ case 5:
+ string = node.getNamePrefixed();
+ break;
+ }
+
+ if (ScoutXmlDocument.this.isAcceptRegExQueries()) {
+ String stringToCompare;
+
+ string = string.replace('{', ' ').replace('}', ' ');
+ stringToCompare = m_stringToCompare.replace('{', ' ').replace('}', ' ');
+
+ if (m_ignoreQueryCase) {
+ string = string.toUpperCase();
+ stringToCompare = stringToCompare.toUpperCase();
+ }
+
+ if (string.matches(stringToCompare)) {
+ nameMatched(node);
+ }
+ }
+ else {
+ if (m_ignoreQueryCase && string.equalsIgnoreCase(m_stringToCompare)) {
+ nameMatched(node);
+ }
+ else if (string.equals(m_stringToCompare)) {
+ nameMatched(node);
+ }
+ }
+ }
+
+ protected abstract void nameMatched(P_AbstractNode element);
+
+ protected abstract boolean isNotDoneYet();
+
+ protected abstract T getResult();
+ }
+
+ private class P_Registry implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+ private static final int INITIAL_SIZE = 50;
+
+ private final List<Object> m_values; // Maps IDs to values
+ private final Map<Object, Integer> m_valuesReverse; // Maps values to IDs
+
+ /**
+ * @since 1.0
+ */
+ public P_Registry() {
+ m_values = new ArrayList<Object>(INITIAL_SIZE);
+ m_valuesReverse = new Hashtable<Object, Integer>(INITIAL_SIZE);
+ }
+
+ /**
+ * @since 1.0
+ */
+ public int getID(Object value, boolean addValueIfNotExists) {
+ if (value != null) {
+ if (m_valuesReverse.containsKey(value)) {
+ return (m_valuesReverse.get(value)).intValue();
+ }
+ else if (addValueIfNotExists) {
+ m_values.add(value);
+ m_valuesReverse.put(value, new Integer(m_values.size() - 1));
+
+ return (m_values.size() - 1);
+ }
+ }
+
+ return -1;
+ }
+
+ /**
+ * @since 1.0
+ */
+ public Object getValue(int valueID) {
+ return m_values.get(valueID);
+ }
+
+ /**
+ * @since 1.0
+ */
+ public Object getValue(Integer valueID) {
+ return this.getValue(valueID.intValue());
+ }
+
+ /**
+ * @since 1.0
+ */
+ public String getValueAsString(int valueID) {
+ return (String) this.getValue(valueID);
+ }
+
+ /**
+ * @since 1.0
+ */
+ public String getValueAsString(Integer valueID) {
+ return (String) this.getValue(valueID);
+ }
+ }
+
+ public class ScoutXmlElement extends P_AbstractNode implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+ private List<P_Attribute> m_attributes; // This element's attributes
+ private Object m_content; // This element's content (text, a child, a list of children or a mixed list)
+ private Map<String, String> m_namespaces; // This element's namespace declarations
+ private ScoutXmlElement m_parent; // This element's predecessor
+
+ /**
+ * @since 1.0
+ */
+ protected ScoutXmlElement() {
+ m_attributes = null;
+ m_content = null;
+ m_namespaces = null;
+ m_parent = null;
+ }
+
+ /**
+ * @since 1.0
+ */
+ protected ScoutXmlElement(String name) {
+ this();
+ super.setName(name);
+ }
+
+ /**
+ * @since 1.0
+ */
+ public ScoutXmlElement addChild() {
+ ScoutXmlElement child = new ScoutXmlElement();
+
+ child.setParent(this);
+ this.addChild(child);
+
+ return child;
+ }
+
+ /**
+ * @since 1.0
+ */
+ public ScoutXmlElement addChild(String name) {
+ ScoutXmlElement child = this.addChild();
+
+ child.setName(name);
+
+ return child;
+ }
+
+ /**
+ * @since 1.0
+ */
+ public ScoutXmlElement addChild(ScoutXmlDocument document) {
+ return this.addChild(document, -1);
+ }
+
+ /**
+ * @since 1.0
+ */
+ public ScoutXmlElement addChild(ScoutXmlDocument document, int position) {
+ return this.addChild(document.getRoot(), position);
+ }
+
+ /**
+ * @since 1.0
+ */
+ public ScoutXmlElement addChild(ScoutXmlElement child) {
+ return this.addChild(child, -1);
+ }
+
+ /**
+ * @since 1.0
+ */
+ @SuppressWarnings("unchecked")
+ public ScoutXmlElement addChild(ScoutXmlElement child, int position) {
+ if (child.getDocument().equals(ScoutXmlDocument.this)) {
+ if (child != null) {
+ child.setParent(this);
+
+ if (m_content == null) {
+ m_content = child;
+ }
+ else if (m_content instanceof List) {
+ if (position == -1) {
+ ((List) m_content).add(child);
+ }
+ else {
+ ((List) m_content).add(position, child);
+ }
+ }
+ else {
+ List newContent = new ArrayList(INITIAL_CONTENT_LIST_SIZE);
+ newContent.add(m_content);
+ newContent.add(child);
+ m_content = newContent;
+ }
+ }
+ }
+ else {
+ try {
+ new ScoutXmlParser(ScoutXmlDocument.this, ScoutXmlElement.this).parse(child.toString());
+ }
+ catch (Exception e) {
+ // Must not happpen
+ }
+ }
+
+ return child;
+ }
+
+ /**
+ * @since 1.0
+ */
+ public void addChildren(List<ScoutXmlElement> children) {
+ for (ScoutXmlElement xmlElement : children) {
+ this.addChild(xmlElement);
+ }
+ }
+
+ /**
+ * @since 1.0
+ */
+ public void addContent(Object content) {
+ if (content instanceof ScoutXmlElement) {
+ this.addChild((ScoutXmlElement) content);
+ }
+ else {
+ this.addText(content.toString());
+ }
+ }
+
+ /**
+ * @since 1.0
+ */
+ @SuppressWarnings("unchecked")
+ public void addText(String text) {
+ if ((text != null) && (!text.equals(""))) {
+ Integer textID = new Integer(m_textRegistry.getID(text, true));
+
+ if (m_content == null) {
+ m_content = textID;
+ }
+ else if (m_content instanceof List) {
+ ((List) m_content).add(textID);
+ }
+ else {
+ List newContent = new ArrayList(INITIAL_ATTRIBUTE_LIST_SIZE);
+ newContent.add(m_content);
+ newContent.add(textID);
+ m_content = newContent;
+ }
+ }
+ }
+
+ /**
+ * Returns this element's number of attributes.
+ *
+ * @since 1.0
+ */
+ public int countAttributes() {
+ if (m_attributes != null) {
+ return m_attributes.size();
+ }
+ else {
+ return 0;
+ }
+ }
+
+ /**
+ * Returns this element's number of attributes with the given name.
+ *
+ * @since 1.0
+ */
+ public int countAttributes(String name) {
+ return this.visitAttributes(new P_NodeCounter(name));
+ }
+
+ /**
+ * Returns this element's number of child elements.
+ *
+ * @since 1.0
+ */
+ public int countChildren() {
+ if (m_content instanceof List) {
+ Iterator iterator = ((List) m_content).iterator();
+ int noChildren = 0;
+
+ while (iterator.hasNext()) {
+ if (iterator.next() instanceof ScoutXmlElement) {
+ noChildren++;
+ }
+ }
+
+ return noChildren;
+ }
+ else if (m_content instanceof ScoutXmlElement) {
+ return 1;
+ }
+ else {
+ return 0;
+ }
+ }
+
+ /**
+ * Returns this element's number of child elements with the given name.
+ *
+ * @since 1.0
+ */
+ public int countChildren(String name) {
+ return this.visitChildren(new P_NodeCounter(name));
+ }
+
+ /**
+ * Returns this element's number of descendant elements.
+ *
+ * @since 1.0
+ */
+ public int countDescendants() {
+ return this.countDescendants("*");
+ }
+
+ /**
+ * Returns this element's number of descendant elements with the given name.
+ *
+ * @since 1.0
+ */
+ public int countDescendants(String name) {
+ return (this.visitDescendants(new P_NodeCounter(name))).intValue();
+ }
+
+ /**
+ * Returns this element's number of sibling elements.
+ *
+ * @since 1.1
+ */
+ public int countSiblings() {
+ return this.countSiblings("*");
+ }
+
+ /**
+ * Returns this element's number of sibling elements with the given name.
+ *
+ * @since 1.1
+ */
+ public int countSiblings(String name) {
+ if (this.hasParent()) {
+ return this.getParent().visitChildren(new P_NodeCounter(name)) - 1;
+ }
+ else {
+ return 0;
+ }
+ }
+
+ /**
+ * Returns the number of namespaces which are declared on this element.
+ *
+ * @since 1.0
+ */
+ public int countNamespaces() {
+ if (this.hasNamespace()) {
+ return m_namespaces.size();
+ }
+ else {
+ return 0;
+ }
+ }
+
+ /**
+ * Retrieves an attribute value by name.
+ *
+ * @param name
+ * The name of the attribute to retrieve.
+ * @return The attribute's value.
+ * @throws ScoutXmlException
+ * If the attribute does not exist or if its value is invalid.
+ * @since 1.0
+ */
+ public String getAttribute(String name) {
+ try {
+ return this.getAttributeNode(name).getValueAsString();
+ }
+ catch (NullPointerException exception) {
+ throw new ScoutXmlException("Attribute '" + name + "' does not exist for '" + this.getPath() + "'");
+ }
+ }
+
+ /**
+ * Retrieves an attribute value by name.
+ *
+ * @param name
+ * The name of the attribute to retrieve.
+ * @param defaultValue
+ * The default value for this attribute.
+ * @return The attribute's value or the default value if the attribute does
+ * not exist.
+ * @since 1.0
+ */
+ public String getAttribute(String name, String defaultValue) {
+ try {
+ return this.getAttributeNode(name).getValueAsString();
+ }
+ catch (Exception exception) {
+ return defaultValue;
+ }
+ }
+
+ /**
+ * Retrieves an attribute value by name.
+ *
+ * @param name
+ * The name of the attribute to retrieve.
+ * @return The attribute's value.
+ * @throws ScoutXmlException
+ * If the attribute does not exist or if its value is invalid.
+ * @since 1.0
+ */
+ public boolean getAttributeAsBoolean(String name) {
+ try {
+ return this.getAttributeNode(name).getValueAsBoolean();
+ }
+ catch (NullPointerException exception) {
+ throw new ScoutXmlException("Attribute '" + name + "' does not exist for '" + this.getPath() + "'");
+ }
+ }
+
+ /**
+ * Retrieves an attribute value by name.
+ *
+ * @param name
+ * The name of the attribute to retrieve.
+ * @param defaultValue
+ * The default value for this attribute.
+ * @return The attribute's value or the default value if the attribute does
+ * not exist.
+ * @since 1.0
+ */
+ public boolean getAttributeAsBoolean(String name, boolean defaultValue) {
+ try {
+ return this.getAttributeNode(name).getValueAsBoolean();
+ }
+ catch (Exception exception) {
+ return defaultValue;
+ }
+ }
+
+ /**
+ * Retrieves an attribute value by name.
+ *
+ * @param name
+ * The name of the attribute to retrieve.
+ * @param format
+ * The format pattern for this date.
+ * @return The attribute's value.
+ * @throws ScoutXmlException
+ * If the attribute does not exist or if its value is invalid.
+ * @since 1.1
+ */
+ public Date getAttributeAsDate(String name, String format) {
+ try {
+ return this.getAttributeNode(name).getValueAsDate(format);
+ }
+ catch (NullPointerException exception) {
+ throw new ScoutXmlException("Attribute '" + name + "' does not exist for '" + this.getPath() + "'");
+ }
+ }
+
+ /**
+ * Retrieves an attribute value by name.
+ *
+ * @param name
+ * The name of the attribute to retrieve.
+ * @param format
+ * The format pattern for this date.
+ * @param defaultValue
+ * The default value for this attribute.
+ * @return The attribute's value or the default value if the attribute does
+ * not exist.
+ * @since 1.1
+ */
+ public Date getAttributeAsDate(String name, String format, Date defaultValue) {
+ try {
+ return this.getAttributeNode(name).getValueAsDate(format);
+ }
+ catch (Exception exception) {
+ return defaultValue;
+ }
+ }
+
+ /**
+ * Retrieves an attribute value by name.
+ *
+ * @param name
+ * The name of the attribute to retrieve.
+ * @return The attribute's value.
+ * @throws ScoutXmlException
+ * If the attribute does not exist or if its value is invalid.
+ * @since 1.0
+ */
+ public double getAttributeAsDouble(String name) {
+ try {
+ return this.getAttributeNode(name).getValueAsDouble();
+ }
+ catch (NullPointerException exception) {
+ throw new ScoutXmlException("Attribute '" + name + "' does not exist for '" + this.getPath() + "'");
+ }
+ }
+
+ /**
+ * Retrieves an attribute value by name.
+ *
+ * @param name
+ * The name of the attribute to retrieve.
+ * @param defaultValue
+ * The default value for this attribute.
+ * @return The attribute's value or the default value if the attribute does
+ * not exist.
+ * @since 1.0
+ */
+ public double getAttributeAsDouble(String name, double defaultValue) {
+ try {
+ return this.getAttributeNode(name).getValueAsDouble();
+ }
+ catch (Exception exception) {
+ return defaultValue;
+ }
+ }
+
+ /**
+ * Retrieves an attribute value by name.
+ *
+ * @param name
+ * The name of the attribute to retrieve.
+ * @return The attribute's value.
+ * @throws ScoutXmlException
+ * If the attribute does not exist or if its value is invalid.
+ * @since 1.0
+ */
+ public int getAttributeAsInt(String name) {
+ try {
+ return this.getAttributeNode(name).getValueAsInt();
+ }
+ catch (NullPointerException exception) {
+ throw new ScoutXmlException("Attribute '" + name + "' does not exist for '" + this.getPath() + "'");
+ }
+ }
+
+ /**
+ * Retrieves an attribute value by name.
+ *
+ * @param name
+ * The name of the attribute to retrieve.
+ * @param defaultValue
+ * The default value for this attribute.
+ * @return The attribute's value or the default value if the attribute does
+ * not exist.
+ * @since 1.0
+ */
+ public int getAttributeAsInt(String name, int defaultValue) {
+ try {
+ return this.getAttributeNode(name).getValueAsInt();
+ }
+ catch (Exception exception) {
+ return defaultValue;
+ }
+ }
+
+ /**
+ * Retrieves an attribute value by name.
+ *
+ * @param name
+ * The name of the attribute to retrieve.
+ * @return The attribute's value.
+ * @throws ScoutXmlException
+ * If the attribute does not exist or if its value is invalid.
+ * @since 1.0
+ */
+ public long getAttributeAsLong(String name) {
+ try {
+ return this.getAttributeNode(name).getValueAsLong();
+ }
+ catch (NullPointerException exception) {
+ throw new ScoutXmlException("Attribute '" + name + "' does not exist for '" + this.getPath() + "'");
+ }
+ }
+
+ /**
+ * Retrieves an attribute value by name.
+ *
+ * @param name
+ * The name of the attribute to retrieve.
+ * @param defaultValue
+ * The default value for this attribute.
+ * @return The attribute's value as a string or the default value if the
+ * attribute does not exist.
+ * @since 1.0
+ */
+ public long getAttributeAsLong(String name, long defaultValue) {
+ try {
+ return this.getAttributeNode(name).getValueAsLong();
+ }
+ catch (Exception exception) {
+ return defaultValue;
+ }
+ }
+
+ /**
+ * Retrieves an attribute value by name.
+ *
+ * @param name
+ * The name of the attribute to retrieve.
+ * @return The attribute's value.
+ * @throws ScoutXmlException
+ * If the attribute does not exist or if its value is invalid.
+ * @since 1.0
+ */
+ public short getAttributeAsShort(String name) {
+ return this.getAttributeNode(name).getValueAsShort();
+ }
+
+ /**
+ * Retrieves an attribute value by name.
+ *
+ * @param name
+ * The name of the attribute to retrieve.
+ * @param defaultValue
+ * The default value for this attribute.
+ * @return The attribute's value or the default value if the attribute does
+ * not exist.
+ * @since 1.0
+ */
+ public short getAttributeAsShort(String name, short defaultValue) {
+ try {
+ return this.getAttributeNode(name).getValueAsShort();
+ }
+ catch (Exception exception) {
+ return defaultValue;
+ }
+ }
+
+ /**
+ * Retrieves an attribute node by name.
+ *
+ * @param name
+ * The name of the attribute to retrieve.
+ * @return The attribute node or null if it does not exist.
+ * @since 1.0
+ */
+ private P_Attribute getAttributeNode(String name) {
+ return (P_Attribute) this.visitAttributes(new P_NodeSelectorSingle(name));
+ }
+
+ /**
+ * @since 1.0
+ */
+ private Collection<P_Attribute> getAttributeNodes(String name) {
+ return visitAttributes(new P_NodeSelectorMulti<P_Attribute>(name));
+ }
+
+ /**
+ * @since 1.0
+ */
+ public int getIndex() {
+ if (this.hasParent()) {
+ return this.getParent().getChildren().indexOf(this);
+ }
+ else {
+ return 0;
+ }
+ }
+
+ /**
+ * @since 1.0
+ */
+ @Override
+ public String getNamespace(String prefix) {
+ if (prefix != null) {
+ if (this.hasNamespace(prefix)) {
+ return m_namespaces.get(prefix);
+ }
+ else if (this.hasParent()) {
+ return this.getParent().getNamespace(prefix);
+ }
+ else {
+ return null;
+ }
+ }
+ else {
+ return null;
+ }
+ }
+
+ /**
+ * @since 1.0
+ */
+ public Map<String, String> getNamespaces() {
+ return m_namespaces;
+ }
+
+ /**
+ * @since 1.0
+ */
+ public ScoutXmlElement getChild(int index) {
+ try {
+ if ((index == 0) && (m_content instanceof ScoutXmlElement)) {
+ return (ScoutXmlElement) m_content;
+ }
+ else {
+ return this.getChildren().get(index);
+ }
+ }
+ catch (Exception exception) {
+ throw new ScoutXmlException("Child with index " + index + " does not exist for '" + this.getPath() + "'");
+ }
+ }
+
+ /**
+ * @since 1.0
+ */
+ public ScoutXmlElement getChild(String name) {
+ return (ScoutXmlElement) this.visitChildren(new P_NodeSelectorSingle(name));
+ }
+
+ /**
+ * @since 1.0
+ */
+ public ScoutXmlElement getChild(String name, String requiredAttributeName, String requiredAttributeValue) {
+ return this.getChild(name, new String[]{requiredAttributeName}, new String[]{requiredAttributeValue});
+ }
+
+ /**
+ * @since 1.0
+ */
+ public ScoutXmlElement getChild(String name, String[] requiredAttributeNames, String[] requiredAttributeValues) {
+ return (ScoutXmlElement) this.visitChildren(new P_NodeSelectorSingle(name, requiredAttributeNames, requiredAttributeValues));
+ }
+
+ /**
+ * Returns this element's children. If there are no children, an empty list
+ * is returned.
+ *
+ * @since 1.0
+ */
+ @SuppressWarnings("unchecked")
+ public List<ScoutXmlElement> getChildren() {
+ ArrayList<ScoutXmlElement> children = new ArrayList<ScoutXmlElement>();
+
+ if (m_content instanceof List) {
+ if (this.hasText()) {
+ for (int i = 0; i < ((List) m_content).size(); i++) {
+ Object o = ((List) m_content).get(i);
+
+ if (o instanceof ScoutXmlElement) {
+ children.add((ScoutXmlElement) o);
+ }
+ }
+ }
+ else {
+ return (List<ScoutXmlElement>) m_content;
+ }
+ }
+ else if (m_content instanceof ScoutXmlElement) {
+ children.add((ScoutXmlElement) m_content);
+ }
+
+ return children;
+ }
+
+ /**
+ * @since 1.0
+ */
+ public List<ScoutXmlElement> getChildren(String name) {
+ return visitChildren(new P_NodeSelectorMulti<ScoutXmlElement>(name));
+ }
+
+ /**
+ * @since 1.0
+ */
+ public ScoutXmlElement getDescendant(String name) {
+ return (ScoutXmlElement) this.visitDescendants(new P_NodeSelectorSingle(name));
+ }
+
+ /**
+ * @since 1.0
+ */
+ public List<ScoutXmlElement> getDescendants(String name) {
+ return visitDescendants(new P_NodeSelectorMulti<ScoutXmlElement>(name));
+ }
+
+ /**
+ * @since 1.0
+ */
+ public ScoutXmlDocument getDocument() {
+ return ScoutXmlDocument.this;
+ }
+
+ /**
+ * @since 1.0
+ */
+ public boolean hasAttribute(String name) {
+ try {
+ return (this.visitAttributes(new P_NodeExistenceChecker(name))).booleanValue();
+ }
+ catch (Exception exception) {
+ return false;
+ }
+ }
+
+ /**
+ * @since 1.0
+ */
+ public boolean hasAttribute(String name, String value) {
+ return (this.hasAttribute(name) && this.getAttribute(name).equals(value));
+ }
+
+ /**
+ * @since 1.0
+ */
+ public boolean hasAttributeExact(String name) {
+ if (this.hasAttributes()) {
+ Iterator<P_Attribute> iterator = m_attributes.iterator();
+
+ for (int i = 0; iterator.hasNext(); i++) {
+ if (iterator.next().getNamePrefixed().equals(name)) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * @since 1.0
+ */
+ public boolean hasAttributes() {
+ return (m_attributes != null && !m_attributes.isEmpty());
+ }
+
+ /**
+ * @since 1.0
+ */
+ public boolean hasChild(String name) {
+ return this.visitChildren(new P_NodeExistenceChecker(name));
+ }
+
+ /**
+ * @since 1.0
+ */
+ public boolean hasChildren() {
+ if (m_content instanceof ScoutXmlElement) {
+ return true;
+ }
+ else if (m_content instanceof List) {
+ Iterator iterator = ((List) m_content).iterator();
+
+ while (iterator.hasNext()) {
+ if (iterator.next() instanceof ScoutXmlElement) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * @since 1.0
+ */
+ public boolean hasContent() {
+ return (m_content != null);
+ }
+
+ /**
+ * @since 1.0
+ */
+ public boolean hasNamespace() {
+ if (m_namespaces != null) {
+ return (!m_namespaces.isEmpty());
+ }
+ else {
+ return false;
+ }
+ }
+
+ /**
+ * @since 1.0
+ */
+ public boolean hasNamespace(String prefix) {
+ if (this.hasNamespace() && (prefix != null)) {
+ return m_namespaces.containsKey(prefix);
+ }
+ else {
+ return false;
+ }
+ }
+
+ /**
+ * @since 1.0
+ */
+ public boolean hasParent() {
+ return (this.getParent() != null);
+ }
+
+ /**
+ * @since 1.0
+ */
+ public boolean hasName() {
+ return (m_nameID != -1);
+ }
+
+ /**
+ * @since 1.0
+ */
+ public boolean hasText() {
+ if (m_content instanceof Integer) {
+ return true;
+ }
+ else if (m_content instanceof String) {
+ return (!((String) m_content).equals(""));
+ }
+ else if (m_content instanceof List) {
+ Iterator iterator = ((List) m_content).iterator();
+
+ while (iterator.hasNext()) {
+ Object contentPart = iterator.next();
+ if (contentPart instanceof String || contentPart instanceof Integer) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * @since 1.0
+ */
+ public boolean isRoot() {
+ return (!this.hasParent());
+ }
+
+ /**
+ * Optimizes the memory consumption of this element's data structures
+ * Intended to be called by an instance of ScoutXmlParser.
+ *
+ * @since 1.0
+ */
+ protected void optimize() {
+
+ // 1. Optimize content data structure
+
+ if (m_content instanceof List) {
+ if (((List) m_content).size() == 0) {
+ m_content = null;
+ }
+ else {
+ ((ArrayList) m_content).trimToSize();
+ }
+ }
+
+ // 2. Optimize attribute data structure
+
+ if (m_attributes != null) {
+ if (m_attributes.isEmpty()) {
+ m_attributes = null;
+ }
+ else {
+ ((ArrayList) m_attributes).trimToSize();
+ }
+ }
+
+ // 3. Optimize namespace data structure
+
+ if (m_namespaces != null) {
+ if (m_namespaces.isEmpty()) {
+ m_namespaces = null;
+ }
+ }
+ }
+
+ /**
+ * Retrieves this element's text. If the element contains mixed content the
+ * different text parts are concatenated. If the element contains no text
+ * the empty string is returned.
+ *
+ * @return This element's text.
+ * @since 1.0
+ */
+ public String getText() {
+ return getText("");
+ }
+
+ /**
+ * Retrieves this element's text. If the element contains mixed content the
+ * different text parts are concatenated. If the element contains no text
+ * the given defaultValue is returned.
+ *
+ * @param defaultValue
+ * The default value.
+ * @return This element's text.
+ * @since 1.4
+ */
+ public String getText(String defaultValue) {
+ String text = null;
+
+ if (m_content instanceof Integer) {
+ text = m_textRegistry.getValueAsString((Integer) m_content);
+ }
+ else if (m_content instanceof String) {
+ text = (String) m_content;
+ }
+ else if (m_content instanceof List) {
+ StringBuffer stringBuffer = new StringBuffer();
+
+ for (int i = 0; i < ((List) m_content).size(); i++) {
+ Object contentPart = ((List) m_content).get(i);
+
+ if (contentPart instanceof String) {
+ stringBuffer.append((String) contentPart);
+ }
+ else if (contentPart instanceof Integer) {
+ stringBuffer.append(m_textRegistry.getValueAsString((Integer) contentPart));
+ }
+ }
+
+ text = stringBuffer.toString();
+ }
+
+ if (text != null) {
+ if (ScoutXmlDocument.this.isIgnoreIndentWhitespace()) {
+ return text.replaceAll("\n *", "\n").replaceAll("\n\t*", "\n");
+ }
+ else {
+ return text;
+ }
+ }
+ else {
+ return defaultValue;
+ }
+ }
+
+ /**
+ * Retrieves this element's text.
+ *
+ * @return The element's text.
+ * @throws ScoutXmlException
+ * If the value is invalid.
+ * @since 1.0
+ */
+ public boolean getTextAsBoolean() {
+ try {
+ return Boolean.valueOf(this.getText()).booleanValue();
+ }
+ catch (Exception exception) {
+ throw new ScoutXmlException("The text '" + this.getText() + "' is not a valid 'boolean' value (" + ScoutXmlElement.this.getPath() + ")");
+ }
+ }
+
+ /**
+ * Retrieves this element's text.
+ *
+ * @param defaultValue
+ * The default value.
+ * @return The element's text or the default value if the text value is
+ * invalid.
+ * @since 1.0
+ */
+ public boolean getTextAsBoolean(boolean defaultValue) {
+ try {
+ return Boolean.valueOf(this.getText()).booleanValue();
+ }
+ catch (Exception exception) {
+ return defaultValue;
+ }
+ }
+
+ /**
+ * Retrieves this element's text.
+ *
+ * @format The date's format pattern.
+ * @return The element's text.
+ * @throws ScoutXmlException
+ * If the value is invalid.
+ * @since 1.0
+ */
+ public Date getTextAsDate(String format) {
+ try {
+ return new SimpleDateFormat(format).parse(this.getText());
+ }
+ catch (Exception exception) {
+ throw new ScoutXmlException("The text '" + this.getText() + "' is not a valid 'Date' value (" + ScoutXmlElement.this.getPath() + ")");
+ }
+ }
+
+ /**
+ * Retrieves this element's text.
+ *
+ * @format The date's format pattern.
+ * @param defaultValue
+ * The default value.
+ * @return The element's text or the default value if the text value is
+ * invalid.
+ * @since 1.0
+ */
+ public Date getTextAsDate(String format, Date defaultValue) {
+ try {
+ return new SimpleDateFormat(format).parse(this.getText());
+ }
+ catch (Exception exception) {
+ return defaultValue;
+ }
+ }
+
+ /**
+ * Retrieves this element's text.
+ *
+ * @return The element's text.
+ * @throws ScoutXmlException
+ * If the value is invalid.
+ * @since 1.0
+ */
+ public double getTextAsDouble() {
+ try {
+ return Double.valueOf(this.getText()).doubleValue();
+ }
+ catch (Exception exception) {
+ throw new ScoutXmlException("The text '" + this.getText() + "' is not a valid 'double' value (" + ScoutXmlElement.this.getPath() + ")");
+ }
+ }
+
+ /**
+ * Retrieves this element's text.
+ *
+ * @param defaultValue
+ * The default value.
+ * @return The element's text or the default value if the text value is
+ * invalid.
+ * @since 1.0
+ */
+ public double getTextAsDouble(double defaultValue) {
+ try {
+ return Double.valueOf(this.getText()).doubleValue();
+ }
+ catch (Exception exception) {
+ return defaultValue;
+ }
+ }
+
+ /**
+ * Retrieves this element's text.
+ *
+ * @return The element's text.
+ * @throws ScoutXmlException
+ * If the value is invalid.
+ * @since 1.0
+ */
+ public int getTextAsInt() {
+ try {
+ return Integer.valueOf(this.getText()).intValue();
+ }
+ catch (Exception exception) {
+ throw new ScoutXmlException("The text '" + this.getText() + "' is not a valid 'int' value (" + ScoutXmlElement.this.getPath() + ")");
+ }
+ }
+
+ /**
+ * Retrieves this element's text.
+ *
+ * @param defaultValue
+ * The default value.
+ * @return The element's text or the default value if the text value is
+ * invalid.
+ * @since 1.0
+ */
+ public int getTextAsInt(int defaultValue) {
+ try {
+ return Integer.valueOf(this.getText()).intValue();
+ }
+ catch (Exception exception) {
+ return defaultValue;
+ }
+ }
+
+ /**
+ * Retrieves this element's text.
+ *
+ * @return The element's text.
+ * @throws ScoutXmlException
+ * If the value is invalid.
+ * @since 1.0
+ */
+ public long getTextAsLong() {
+ try {
+ return Long.valueOf(this.getText()).longValue();
+ }
+ catch (Exception exception) {
+ throw new ScoutXmlException("The text '" + this.getText() + "' is not a valid 'long' value (" + ScoutXmlElement.this.getPath() + ")");
+ }
+ }
+
+ /**
+ * Retrieves this element's text.
+ *
+ * @param defaultValue
+ * The default value.
+ * @return The element's text or the default value if the text value is
+ * invalid.
+ * @since 1.0
+ */
+ public long getTextAsLong(long defaultValue) {
+ try {
+ return Long.valueOf(this.getText()).longValue();
+ }
+ catch (Exception exception) {
+ return defaultValue;
+ }
+ }
+
+ /**
+ * Retrieves this element's text.
+ *
+ * @return The element's text.
+ * @throws ScoutXmlException
+ * If the value is invalid.
+ * @since 1.0
+ */
+ public short getTextAsShort() {
+ try {
+ return Short.valueOf(this.getText()).shortValue();
+ }
+ catch (Exception exception) {
+ throw new ScoutXmlException("The text '" + this.getText() + "' is not a valid 'short' value (" + ScoutXmlElement.this.getPath() + ")");
+ }
+ }
+
+ /**
+ * Retrieves this element's text.
+ *
+ * @param defaultValue
+ * The default value.
+ * @return The element's text or the default value if the text value is
+ * invalid.
+ * @since 1.0
+ */
+ public short getTextAsShort(short defaultValue) {
+ try {
+ return Short.valueOf(this.getText()).shortValue();
+ }
+ catch (Exception exception) {
+ return defaultValue;
+ }
+ }
+
+ public String getLocalName() {
+ String name = m_nameRegistry.getValueAsString(m_nameID);
+ String localName = ScoutXmlQName.extractLocalName(name);
+ return localName;
+ }
+
+ public String getNamePrefix() {
+ String name = m_nameRegistry.getValueAsString(m_nameID);
+ String prefix = ScoutXmlQName.extractPrefix(name);
+ return prefix;
+ }
+
+ public String getNameNamespace() {
+ String name = m_nameRegistry.getValueAsString(m_nameID);
+ String prefix = ScoutXmlQName.extractPrefix(name);
+ return getNamespace(prefix);
+ }
+
+ /**
+ * @since 1.0
+ */
+ @Override
+ public ScoutXmlQName getName() {
+ String name = m_nameRegistry.getValueAsString(m_nameID);
+ String prefix = ScoutXmlQName.extractPrefix(name);
+ String localName = ScoutXmlQName.extractLocalName(name);
+ return new ScoutXmlQName(this.getNamespace(prefix), prefix, localName);
+ }
+
+ /**
+ * @since 1.0
+ */
+ public ScoutXmlElement getParent() {
+ return m_parent;
+ }
+
+ /**
+ * @since 1.1
+ */
+ public String getPath() {
+ StringBuffer buffer = new StringBuffer();
+ ScoutXmlElement element = this;
+
+ while (element.hasParent()) {
+ if (element.countSiblings(element.getNameExpanded()) > 0) {
+ buffer.insert(0, ']');
+ buffer.insert(0, element.getIndex());
+ buffer.insert(0, '[');
+ }
+
+ buffer.insert(0, element.getNameExpanded());
+ buffer.insert(0, '/');
+
+ element = element.getParent();
+ }
+
+ buffer.insert(0, element.getNameExpanded());
+
+ return buffer.toString();
+ }
+
+ /**
+ * @since 1.0
+ */
+ public ScoutXmlElement getRoot() {
+ if (this.hasParent()) {
+ return this.getParent().getRoot();
+ }
+ else {
+ return this;
+ }
+ }
+
+ /**
+ * Removes this element's attribute which matches the given name. Nothing is
+ * done if the attribute can't be found.
+ *
+ * @since 1.0
+ */
+ public void removeAttribute(String name) {
+ try {
+ m_attributes.remove(this.getAttributeNode(name));
+ }
+ catch (Exception exception) {
+ // Do nothing...
+ }
+ }
+
+ /**
+ * Removes all of this element's attributes.
+ *
+ * @since 1.0
+ */
+ public void removeAttributes() {
+ m_attributes = null;
+ }
+
+ /**
+ * Removes all of this element's attributes which match the given name.
+ * Nothing is done if no matching attribute can be found.
+ *
+ * @since 1.0
+ */
+ public void removeAttributes(String name) {
+ try {
+ m_attributes.removeAll(this.getAttributeNodes(name));
+ }
+ catch (Exception exception) {
+ // Do nothing...
+ }
+ }
+
+ /**
+ * Removes the the child with the given index. Nothing is done if the child
+ * can't be found.
+ *
+ * @since 1.0
+ */
+ public void removeChild(int index) {
+ try {
+ this.removeChild(this.getChild(index));
+ }
+ catch (Exception exception) {
+ // Do nothing...
+ }
+ }
+
+ /**
+ * Removes the given child from this element. Nothing is done if the child
+ * element doesn't belong to this element.
+ *
+ * @param child
+ * The element to be removed.
+ * @since 1.0
+ */
+ public void removeChild(ScoutXmlElement child) {
+ try {
+ if (m_content.equals(child)) {
+ m_content = null;
+ }
+ else {
+ ((List) m_content).remove(child);
+ }
+ }
+ catch (Exception exception) {
+ // Do nothing...
+ }
+ }
+
+ /**
+ * Removes the given child from this element. Nothing is done if the child
+ * element can't be found.
+ *
+ * @param child
+ * The element to be removed.
+ * @since 1.0
+ */
+ public void removeChild(String name) {
+ try {
+ this.removeChild(this.getChild(name));
+ }
+ catch (Exception exception) {
+ // Do nothing...
+ }
+ }
+
+ /**
+ * Removes all children of this element.
+ *
+ * @since 1.0
+ */
+ public void removeChildren() {
+ m_content = null;
+ }
+
+ /**
+ * Removes the given children.
+ *
+ * @param children
+ * @since 1.0
+ */
+ @SuppressWarnings("unchecked")
+ public void removeChildren(Collection<ScoutXmlElement> children) {
+ try {
+ ((List<P_AbstractNode>) m_content).removeAll(children);
+ }
+ catch (Exception exception) {
+ // Do nothing...
+ }
+ }
+
+ /**
+ * Removes all children which match the given name.
+ *
+ * @param name
+ * @since 1.0
+ */
+ public void removeChildren(String name) {
+ try {
+ removeChildren(this.getChildren(name));
+ }
+ catch (Exception exception) {
+ // Do nothing...
+ }
+ }
+
+ /**
+ * Removes all content of this element. This includes text and children.
+ *
+ * @since 1.0
+ */
+ public void removeContent() {
+ m_content = null;
+ }
+
+ /**
+ * @since 1.0
+ */
+ public void removeNamespace(String prefix) {
+ if (this.hasNamespace(prefix)) {
+ m_namespaces.remove(prefix);
+ }
+ else {
+ LOG.warn("Namespace with prefix '" + prefix + "' not removed, it doesn't exist for element '" + this.getNamePrefixed() + "'.");
+ }
+ }
+
+ /**
+ * @since 1.0
+ */
+ public void removeNamespaces() {
+ m_namespaces = null;
+ }
+
+ /**
+ * Removes this element's text.
+ *
+ * @since 1.0
+ */
+ public void removeText() {
+ if (m_content instanceof Integer) {
+ m_content = null;
+ }
+ else if (m_content instanceof String) {
+ m_content = null;
+ }
+ else if (m_content instanceof List) {
+ for (int i = 0; i < ((List) m_content).size(); i++) {
+ Object contentPart = ((List) m_content).get(i);
+
+ if (contentPart instanceof String) {
+ ((List) m_content).remove(contentPart);
+ }
+ else if (contentPart instanceof Integer) {
+ ((List) m_content).remove(contentPart);
+ }
+ }
+ }
+ }
+
+ /**
+ * Adds a new attribute or modifies an existing one.
+ *
+ * @param name
+ * The name of the attribute to create or modify.
+ * @param value
+ * The value to be set.
+ * @since 1.0
+ */
+ public void setAttribute(String name, boolean value) {
+ this.setAttribute(name, String.valueOf(value));
+ }
+
+ /**
+ * Adds a new attribute or modifies an existing one.
+ *
+ * @param name
+ * The name of the attribute to create or modify.
+ * @param value
+ * The value to be set.
+ * @since 1.1
+ */
+ public void setAttribute(String name, Date value, String dateFormat) {
+ this.setAttribute(name, new SimpleDateFormat(dateFormat).format(value));
+ }
+
+ /**
+ * Adds a new attribute or modifies an existing one.
+ *
+ * @param name
+ * The name of the attribute to create or modify.
+ * @param value
+ * The value to be set.
+ * @since 1.0
+ */
+ public void setAttribute(String name, double value) {
+ this.setAttribute(name, String.valueOf(value));
+ }
+
+ /**
+ * Adds a new attribute or modifies an existing one.
+ *
+ * @param name
+ * The name of the attribute to create or modify.
+ * @param value
+ * The value to be set.
+ * @since 1.0
+ */
+ public void setAttribute(String name, int value) {
+ this.setAttribute(name, String.valueOf(value));
+ }
+
+ /**
+ * Adds a new attribute or modifies an existing one.
+ *
+ * @param name
+ * The name of the attribute to create or modify.
+ * @param value
+ * The value to be set.
+ * @since 1.0
+ */
+ public void setAttribute(String name, long value) {
+ this.setAttribute(name, String.valueOf(value));
+ }
+
+ /**
+ * Adds a new attribute or modifies an existing one.
+ *
+ * @param name
+ * The name of the attribute to create or modify.
+ * @param value
+ * The value to be set.
+ * @since 1.0
+ */
+ public void setAttribute(String name, short value) {
+ this.setAttribute(name, String.valueOf(value));
+ }
+
+ /**
+ * Adds a new attribute or modifies an existing one.
+ *
+ * @param name
+ * The name of the attribute to create or modify.
+ * @param value
+ * The value to be set.
+ * @since 1.0
+ */
+ public void setAttribute(String name, String value) {
+ if (value != null) {
+ if (m_attributes == null) {
+ m_attributes = new ArrayList<P_Attribute>(INITIAL_ATTRIBUTE_LIST_SIZE);
+ }
+
+ P_Attribute newAttribute = new P_Attribute(name, value);
+
+ if (ScoutXmlDocument.this.isStrictlyChecking() && this.hasAttribute(newAttribute.getNameExpanded())) {
+ this.getAttributeNode(newAttribute.getNameExpanded()).setValue(value);
+ }
+
+ m_attributes.add(newAttribute);
+ }
+ }
+
+ /**
+ * @param attributes
+ * @since 1.0
+ */
+ protected void setAttributes(Attributes attributes) {
+ if (attributes.getLength() > 0) {
+ if (m_attributes == null) {
+ m_attributes = new ArrayList<P_Attribute>(attributes.getLength());
+ }
+
+ for (int i = 0; i < attributes.getLength(); i++) {
+ if ((attributes.getValue(i) != null) && (!attributes.getValue(i).equals(""))) {
+ m_attributes.add(new P_Attribute(attributes.getQName(i), attributes.getValue(i)));
+ }
+ }
+ }
+ }
+
+ /**
+ * @since 1.0
+ */
+ public void setNamespace(String prefix, String namespaceURI) {
+ if (m_namespaces == null) {
+ m_namespaces = new Hashtable<String, String>(INITIAL_NAMESPACE_MAP_SIZE);
+ }
+
+ m_namespaces.put((prefix != null ? prefix : ""), namespaceURI);
+ }
+
+ /**
+ * @since 1.0
+ */
+ protected void setNamespaces(Map<String, String> namespaces) {
+ if (m_namespaces == null) {
+ m_namespaces = new Hashtable<String, String>(namespaces.size());
+ }
+
+ m_namespaces.putAll(namespaces);
+ }
+
+ /**
+ * @since 1.0
+ */
+ public void setParent(ScoutXmlElement parent) {
+ m_parent = parent;
+ }
+
+ /**
+ * @since 1.0
+ */
+ public String export() {
+ try {
+ StringWriter stringWriter = new StringWriter();
+ this.write(stringWriter);
+ return stringWriter.toString();
+ }
+ catch (IOException exception) {
+ return null;
+ }
+ }
+
+ /**
+ * @since 1.0
+ */
+ @Override
+ public String toString() {
+ return export();
+ }
+
+ /**
+ * @since 1.0
+ */
+ protected <T> T visitAttributes(P_AbstractNodeVisitor<T> visitor) {
+ if (this.hasAttributes()) {
+ Iterator<P_Attribute> iterator = m_attributes.iterator();
+
+ while (iterator.hasNext() && visitor.isNotDoneYet()) {
+ visitor.visit(iterator.next());
+ }
+
+ return visitor.getResult();
+ }
+ else {
+ return null;
+ }
+ }
+
+ /**
+ * @since 1.0
+ */
+ protected <T> T visitChildren(P_AbstractNodeVisitor<T> visitor) {
+ Iterator<ScoutXmlElement> iterator = this.getChildren().iterator();
+
+ while (iterator.hasNext() && visitor.isNotDoneYet()) {
+ visitor.visit(iterator.next());
+ }
+
+ return visitor.getResult();
+ }
+
+ /**
+ * @since 1.0
+ */
+ protected <T> T visitDescendants(P_AbstractNodeVisitor<T> visitor) {
+ Iterator<ScoutXmlElement> iterator = this.getChildren().iterator();
+ ScoutXmlElement child = null;
+
+ while (iterator.hasNext() && visitor.isNotDoneYet()) {
+ child = iterator.next();
+
+ visitor.visit(child);
+ child.visitDescendants(visitor);
+ }
+
+ return visitor.getResult();
+ }
+
+ /**
+ * @since 1.0
+ */
+ @Override
+ public void write(Writer writer) throws IOException {
+ BufferedWriter bufferedWriter = null;
+
+ if (writer instanceof BufferedWriter) {
+ bufferedWriter = (BufferedWriter) writer;
+ }
+ else {
+ bufferedWriter = new BufferedWriter(writer);
+ }
+
+ this.write(bufferedWriter, "");
+ bufferedWriter.flush();
+ }
+
+ /**
+ * @since 1.0
+ */
+ private void write(BufferedWriter bufferedWriter, String currentIndent) throws IOException {
+ if (this.hasName()) {
+ bufferedWriter.write(currentIndent);
+ bufferedWriter.write('<');
+ bufferedWriter.write(this.getNamePrefixed());
+
+ if (this.hasAttributes()) {
+ Iterator<P_Attribute> iterator = m_attributes.iterator();
+
+ while (iterator.hasNext()) {
+ bufferedWriter.write(' ');
+ iterator.next().write(bufferedWriter);
+ }
+ }
+
+ if (this.hasNamespace()) {
+ Iterator<String> iterator = m_namespaces.keySet().iterator();
+ String prefix = null;
+
+ while (iterator.hasNext()) {
+ prefix = iterator.next();
+
+ bufferedWriter.write(" xmlns");
+ if (!prefix.equals("")) {
+ bufferedWriter.write(':');
+ bufferedWriter.write(prefix);
+ }
+ bufferedWriter.write('=');
+ bufferedWriter.write('"');
+ this.writeEncoded(bufferedWriter, this.getNamespace(prefix));
+ bufferedWriter.write('"');
+ }
+ }
+
+ if (this.hasContent()) {
+ bufferedWriter.write('>');
+
+ if (m_content instanceof List) {
+ if (ScoutXmlDocument.this.isPrettyPrint()) {
+ bufferedWriter.newLine();
+ }
+
+ for (int i = 0; i < ((List) m_content).size(); i++) {
+ Object o = ((List) m_content).get(i);
+
+ if (o instanceof ScoutXmlElement) {
+ ((ScoutXmlElement) o).write(bufferedWriter, currentIndent + ScoutXmlDocument.this.getIndent());
+ }
+ else if (o instanceof Integer) {
+ bufferedWriter.write(currentIndent + ScoutXmlDocument.this.getIndent());
+ this.writeEncoded(bufferedWriter, m_textRegistry.getValueAsString(((Integer) o).intValue()));
+
+ if (ScoutXmlDocument.this.isPrettyPrint()) {
+ bufferedWriter.newLine();
+ }
+ }
+ }
+
+ bufferedWriter.write(currentIndent);
+ }
+ else if (m_content instanceof ScoutXmlElement) {
+ if (ScoutXmlDocument.this.isPrettyPrint()) {
+ bufferedWriter.newLine();
+ }
+
+ ((ScoutXmlElement) m_content).write(bufferedWriter, currentIndent + ScoutXmlDocument.this.getIndent());
+ bufferedWriter.write(currentIndent);
+ }
+ else if (m_content instanceof Integer) {
+ this.writeEncoded(bufferedWriter, m_textRegistry.getValueAsString((Integer) m_content));
+ }
+
+ bufferedWriter.write('<');
+ bufferedWriter.write('/');
+ bufferedWriter.write(this.getNamePrefixed());
+ bufferedWriter.write('>');
+ }
+ else {
+ bufferedWriter.write('/');
+ bufferedWriter.write('>');
+ }
+
+ if (ScoutXmlDocument.this.isPrettyPrint()) {
+ bufferedWriter.newLine();
+ }
+ }
+ else {
+ throw new ScoutXmlException("Can't write this element because it has no name.");
+ }
+ }
+
+ /**
+ * @since 1.0
+ */
+ protected void writeEncoded(BufferedWriter bufferedWriter, String string) throws IOException {
+ if (string != null) {
+ for (int i = 0; i < string.length(); i++) {
+ String ch = "" + string.charAt(i);
+ String escaped = ScoutXmlDocument.XML_ENTITIES.get(ch);
+ if (escaped != null) {
+ bufferedWriter.write(escaped);
+ }
+ else {
+ bufferedWriter.write(ch);
+ }
+ }
+ }
+ }
+
+ private class P_Attribute extends P_AbstractNode implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private int m_valueID;
+
+ /**
+ * @since 1.0
+ */
+ public P_Attribute(String name, String value) {
+ super.setName(name);
+ this.setValue(value);
+ }
+
+ /**
+ * @since 1.0
+ */
+ @Override
+ public boolean equals(Object object) {
+ if (object == null) {
+ return false;
+ }
+ try {
+ P_Attribute attribute = (P_Attribute) object;
+ return this.getName().equals(attribute.getName()) && this.getValueAsString().equals(attribute.getValueAsString());
+ }
+ catch (Exception exception) {
+ return false;
+ }
+ }
+
+ @Override
+ public int hashCode() {
+ return this.getName().hashCode() ^ this.getValueAsString().hashCode();
+ }
+
+ /**
+ * @since 1.0
+ */
+ public ScoutXmlDocument getDocument() {
+ return ScoutXmlDocument.this;
+ }
+
+ /**
+ * @since 1.0
+ */
+ @Override
+ public ScoutXmlQName getName() {
+ String name = m_nameRegistry.getValueAsString(m_nameID);
+
+ String prefix = ScoutXmlQName.extractPrefix(name);
+ String localName = ScoutXmlQName.extractLocalName(name);
+
+ return new ScoutXmlQName(this.getNamespace(prefix), prefix, localName);
+ }
+
+ /**
+ * @since 1.0
+ */
+ @Override
+ public String getNamespace(String prefix) {
+ return ScoutXmlElement.this.getNamespace(prefix);
+ }
+
+ /**
+ * @since 1.0
+ */
+ public Object getValue() {
+ return m_nameRegistry.getValue(m_valueID);
+ }
+
+ /**
+ * @since 1.0
+ */
+ public boolean getValueAsBoolean() {
+ return Boolean.valueOf(this.getValueAsString()).booleanValue();
+ }
+
+ /**
+ * @since 1.0
+ */
+ public Date getValueAsDate(String format) {
+ try {
+ return new SimpleDateFormat(format).parse(this.getValueAsString());
+ }
+ catch (Exception exception) {
+ throw new ScoutXmlException("Attribute value '" + this.getValueAsString() + "' is not a valid 'Date' value (" + ScoutXmlElement.this.getPath() + "/@" + this.getNameExpanded() + ")");
+ }
+ }
+
+ /**
+ * @since 1.0
+ */
+ public double getValueAsDouble() {
+ try {
+ return Double.valueOf(this.getValueAsString()).doubleValue();
+ }
+ catch (NumberFormatException exception) {
+ throw new ScoutXmlException("Attribute value '" + this.getValueAsString() + "' is not a valid 'double' value (" + ScoutXmlElement.this.getPath() + "/@" + this.getNameExpanded() + ")");
+ }
+ }
+
+ /**
+ * @since 1.0
+ */
+ public int getValueAsInt() {
+ try {
+ return Integer.valueOf(this.getValueAsString()).intValue();
+ }
+ catch (NumberFormatException exception) {
+ throw new ScoutXmlException("Attribute value '" + this.getValueAsString() + "' is not a valid 'int' value (" + ScoutXmlElement.this.getPath() + "/@" + this.getNameExpanded() + ")");
+ }
+ }
+
+ /**
+ * @since 1.0
+ */
+ public long getValueAsLong() {
+ try {
+ return Long.valueOf(this.getValueAsString()).longValue();
+ }
+ catch (NumberFormatException exception) {
+ throw new ScoutXmlException("Attribute value '" + this.getValueAsString() + "' is not a valid 'long' value (" + ScoutXmlElement.this.getPath() + "/@" + this.getNameExpanded() + ")");
+ }
+ }
+
+ /**
+ * @since 1.0
+ */
+ public short getValueAsShort() {
+ try {
+ return Short.valueOf(this.getValueAsString()).shortValue();
+ }
+ catch (NumberFormatException exception) {
+ throw new ScoutXmlException("Attribute value '" + this.getValueAsString() + "' is not a valid 'short' value (" + ScoutXmlElement.this.getPath() + "/@" + this.getNameExpanded() + ")");
+ }
+ }
+
+ /**
+ * @since 1.0
+ */
+ public String getValueAsString() {
+ return m_attvRegistry.getValueAsString(m_valueID);
+ }
+
+ /**
+ * @since 1.0
+ */
+ public void setValue(String value) {
+ m_valueID = m_attvRegistry.getID(value, true);
+ }
+
+ /**
+ * @since 1.0
+ */
+ @Override
+ public String toString() {
+ try {
+ StringWriter stringWriter = new StringWriter();
+ this.write(stringWriter);
+ return stringWriter.toString();
+ }
+ catch (IOException exception) {
+ return null;
+ }
+ }
+
+ /**
+ * @since 1.0
+ */
+ @Override
+ public void write(Writer writer) throws IOException {
+ BufferedWriter bufferedWriter = null;
+
+ if (writer instanceof BufferedWriter) {
+ bufferedWriter = (BufferedWriter) writer;
+ }
+ else {
+ bufferedWriter = new BufferedWriter(writer);
+ }
+
+ bufferedWriter.write(m_nameRegistry.getValueAsString(m_nameID));
+ bufferedWriter.write('=');
+ bufferedWriter.write('"');
+ ScoutXmlElement.this.writeEncoded(bufferedWriter, this.getValueAsString());
+ bufferedWriter.write('"');
+
+ bufferedWriter.flush();
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/xmlparser/ScoutXmlException.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/xmlparser/ScoutXmlException.java
index 0964cadec9..09f401d4b3 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/xmlparser/ScoutXmlException.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/xmlparser/ScoutXmlException.java
@@ -1,33 +1,33 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.xmlparser;
-
-/**
- * Title : Scout XML Exception Description: Copyright : Copyright (c) 2006 BSI
- * AG, ETH Zürich, Stefan Vogt Company : BSI AG www.bsiag.com
- *
- * @version 1.0
- */
-public class ScoutXmlException extends RuntimeException {
- private static final long serialVersionUID = 1L;
-
- public ScoutXmlException() {
- super();
- }
-
- public ScoutXmlException(String message) {
- super(message);
- }
-
- public ScoutXmlException(String message, Throwable cause) {
- super(message, cause);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.xmlparser;
+
+/**
+ * Title : Scout XML Exception Description: Copyright : Copyright (c) 2006 BSI
+ * AG, ETH Zürich, Stefan Vogt Company : BSI AG www.bsiag.com
+ *
+ * @version 1.0
+ */
+public class ScoutXmlException extends RuntimeException {
+ private static final long serialVersionUID = 1L;
+
+ public ScoutXmlException() {
+ super();
+ }
+
+ public ScoutXmlException(String message) {
+ super(message);
+ }
+
+ public ScoutXmlException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/xmlparser/ScoutXmlParser.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/xmlparser/ScoutXmlParser.java
index 4e0a95e9eb..6ac87cb794 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/xmlparser/ScoutXmlParser.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/xmlparser/ScoutXmlParser.java
@@ -1,585 +1,585 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.xmlparser;
-
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.Hashtable;
-import java.util.Map;
-
-import javax.naming.ConfigurationException;
-
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
-import org.xml.sax.Attributes;
-import org.xml.sax.InputSource;
-import org.xml.sax.Locator;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXNotRecognizedException;
-import org.xml.sax.SAXNotSupportedException;
-import org.xml.sax.SAXParseException;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLReaderFactory;
-
-/**
- * Title : Scout XML Parser Description: Copyright : Copyright (c) 2006 BSI AG,
- * ETH Zürich, Stefan Vogt Company : BSI AG www.bsiag.com
- *
- * @version 1.0
- */
-public class ScoutXmlParser {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(ScoutXmlParser.class);
- private static boolean warnedDefaultParserNotFound;
-
- private static final boolean DEFAULT_IGNORE_EXTERNAL_ENTITIES = false;
- private static final boolean DEFAULT_IGNORE_SAX_ERRORS = false;
- private static final boolean DEFAULT_IGNORE_SAX_WARNINGS = true;
- private static final String DEFAULT_ENTITY_EXPANSION_LIMIT = "1000000000";
-
- private boolean m_ignoreExternalEntities;
- private boolean m_ignoreSaxErrors;
- private boolean m_ignoreSaxWarnings;
- private int m_numberOfIgnoredErrors;
- private int m_numberOfIgnoredWarnings;
- private ScoutXmlDocument m_xmlDocument;
- private ScoutXmlElement m_initialElement;
- private XMLReader m_xmlReader;
-
- /**
- * @since 1.0
- */
- public ScoutXmlParser() {
- this(new ScoutXmlDocument());
- }
-
- /**
- * @since 1.0
- */
- public ScoutXmlParser(boolean ignoreExternalEntities) {
- this();
- this.setIgnoreExternalEntities(ignoreExternalEntities);
- }
-
- /**
- * @since 1.0
- */
- public ScoutXmlParser(ScoutXmlDocument document) {
- this(document, null);
- }
-
- /**
- * @since 1.0
- */
- protected ScoutXmlParser(ScoutXmlDocument document, ScoutXmlElement root) {
- m_initialElement = root;
- m_xmlDocument = document;
-
- this.setIgnoreExternalEntities(DEFAULT_IGNORE_EXTERNAL_ENTITIES);
- this.setIgnoreSaxErrors(DEFAULT_IGNORE_SAX_ERRORS);
- this.setIgnoreSaxWarnings(DEFAULT_IGNORE_SAX_WARNINGS);
-
- try {
- m_xmlReader = new org.apache.xerces.parsers.SAXParser();
- }
- catch (Throwable t) {
- try {
- m_xmlReader = XMLReaderFactory.createXMLReader();
- }
- catch (SAXException e) {
- throw new UnsupportedOperationException("Cannot find an xml parser. Check dependency to org.apache.xerces");
- }
- if (!warnedDefaultParserNotFound) {
- warnedDefaultParserNotFound = true;
- if (LOG.isInfoEnabled()) {
- LOG.info("Missing dependency to org.apache.xerces. Using alternative " + m_xmlReader.getClass().getName());
- }
- }
- }
-
- m_xmlReader.setContentHandler(new P_SaxContentHandler());
- m_xmlReader.setErrorHandler(new P_SaxErrorHandler());
- m_xmlReader.setEntityResolver(new P_SaxEntityResolver());
-
- try {
- m_xmlReader.setProperty("http://xml.org/sax/properties/lexical-handler", new P_SaxLexicalHandler());
- m_xmlReader.setProperty("http://xml.org/sax/properties/declaration-handler", new P_SaxDeclarationHandler());
-
- m_xmlReader.setFeature("http://xml.org/sax/features/external-general-entities", true);
- m_xmlReader.setFeature("http://xml.org/sax/features/external-parameter-entities", true);
- }
- catch (SAXNotRecognizedException e) {
- // Do nothing
- }
- catch (SAXNotSupportedException e) {
- // Do nothing
- }
- }
-
- /**
- * Returns whether this parser is ignoring external entities. This is
- * especially useful if you want to ignore an external DTD which is currently
- * unavailable. But keep in mind that if you ignore the DTD it is possible
- * that some texts differ because entities declared in the DTD can't be
- * resolved.
- *
- * @since 1.0
- */
- public boolean isIgnoreExternalEntities() {
- return m_ignoreExternalEntities;
- }
-
- /**
- * Returns whether this parser is ignoring recoverable SAX errors.
- *
- * @since 1.0
- */
- public boolean isIgnoreSaxErrors() {
- return m_ignoreSaxErrors;
- }
-
- /**
- * Returns whether this parser is ignoring SAX warnings.
- *
- * @since 1.0
- */
- public boolean isIgnoreSaxWarnings() {
- return m_ignoreSaxWarnings;
- }
-
- /**
- * Returns whether this parser is validating.
- *
- * @since 1.0
- */
- public boolean isValidating() {
- try {
- return m_xmlReader.getFeature("http://xml.org/sax/features/validation");
- }
- catch (SAXNotRecognizedException exception) {
- return false;
- }
- catch (SAXNotSupportedException exception) {
- return false;
- }
- }
-
- /**
- * @param file
- * @return
- * @throws FileNotFoundException
- * @throws IOException
- * @throws SAXException
- * @since 1.0
- */
- public ScoutXmlDocument parse(File file) throws IOException, SAXException {
- return this.parse(new FileInputStream(file), file.getAbsolutePath());
- }
-
- /**
- * Parses the given stream and returns the resulting XML document.
- *
- * @param stream
- * The stream to be parsed.
- * @return ScoutXmlDocument
- * @throws IOException
- * @throws SAXException
- * @since 1.0
- */
- public ScoutXmlDocument parse(InputStream stream) throws IOException, SAXException {
- return this.parse(stream, null);
- }
-
- /**
- * Parses the given stream and returns the resulting XML document.
- *
- * @param stream
- * The stream to be parsed.
- * @param systemId
- * The system identifier for this source.
- * @return ScoutXmlDocument
- * @throws IOException
- * @throws SAXException
- * @since 1.0
- */
- public ScoutXmlDocument parse(InputStream stream, String systemId) throws IOException, SAXException {
- InputSource inputSource = new InputSource(stream);
-
- if (systemId != null) {
- inputSource.setSystemId(new File(systemId).toURI().toString());
- }
-
- m_xmlReader.parse(inputSource);
-
- return m_xmlDocument;
- }
-
- /**
- * Parses the given source and returns the resulting XML document.
- *
- * @param source
- * The source can be a file's name, an URI or the XML document
- * itself. Examples for a valid source are: &quot;C:\\test.xml&quot;,
- * &quot;http://www.bsiag.com/test.xml&quot; or
- * &quot;&lt;test&gt;Hello&lt;/test&gt;&quot;
- * @return ScoutXmlDocument
- * @throws IOException
- * @throws SAXException
- * @since 1.0
- */
- public ScoutXmlDocument parse(String source) throws IOException, SAXException {
- return this.parse(source, null);
- }
-
- /**
- * Parses the given source and returns the resulting XML document.
- *
- * @param source
- * The source can be a file's name, an URI or the XML document
- * itself. Examples for a valid source are: &quot;C:\\test.xml&quot;,
- * &quot;http://www.bsiag.com/test.xml&quot; or
- * &quot;&lt;test&gt;Hello&lt;/test&gt;&quot;
- * @param systemId
- * The system identifier for this source. Only used if the source is
- * XML code.
- * @return ScoutXmlDocument
- * @throws IOException
- * @throws SAXException
- * @since 1.0
- */
- public ScoutXmlDocument parse(String source, String systemId) throws IOException, SAXException {
- if (source.equals("")) {
- return m_xmlDocument;
- }
- else {
- try {
- if (new File(source).exists()) {
- source = new File(source).toURI().toString();
- }
- else {
- new URI(source);
- }
-
- m_xmlReader.parse(source);
- }
- catch (URISyntaxException exception) {
- if (source.trim().startsWith("<")) {
- this.parse(new ByteArrayInputStream(source.getBytes()), systemId);
- }
- else {
- throw new ScoutXmlException("Unknown source. If it is a file path the file doesn't exist.");
- }
- }
- }
-
- return m_xmlDocument;
- }
-
- /**
- * @since 1.0
- */
- public ScoutXmlDocument parse(URL url) throws IOException, SAXException {
- return this.parse(url.toExternalForm());
- }
-
- /**
- * Sets whether to ignore all external entities This is especially useful if
- * you want to ignore an external DTD which is currently unavailable. But keep
- * in mind that if you ignore the DTD it is possible that some text values
- * differ because entities declared in the DTD can't be resolved or that the
- *
- * @param ignoreExternalEntities
- * If true all external entities are ignored.
- * @since 1.0
- */
- public void setIgnoreExternalEntities(boolean ignoreExternalEntities) {
- m_ignoreExternalEntities = ignoreExternalEntities;
- }
-
- /**
- * Sets whether to ignore recoverable SAX parser errors.
- *
- * @param ignoreSaxErrors
- * If true all recoverable parser errors are ignored, otherwise an
- * exception is thrown.
- * @since 1.0
- */
- public void setIgnoreSaxErrors(boolean ignoreSaxErrors) {
- m_ignoreSaxErrors = ignoreSaxErrors;
- }
-
- /**
- * Sets whether to ignore SAX parser warnings.
- *
- * @param ignoreParserErrors
- * If true all parser warnings are ignored, otherwise the warning is
- * written to the log.
- * @since 1.0
- */
- public void setIgnoreSaxWarnings(boolean ignoreSaxWarnings) {
- m_ignoreSaxWarnings = ignoreSaxWarnings;
- }
-
- /**
- * Sets whether to validate the document which is to be parsed.
- *
- * @param validating
- * If true the document is validated, otherwise not.
- * @throws ConfigurationException
- * Is thrown if the underlying SAX parser doesn't support
- * validation.
- * @since 1.0
- */
- public void setValidating(boolean validating) {
- try {
- m_xmlReader.setFeature("http://xml.org/sax/features/validation", validating);
- }
- catch (Exception exception) {
- if (validating) {
- throw new ScoutXmlException("The currently instantiated SAX parser doesn't allow to turn validation on.", exception);
- }
- }
- }
-
- public void setXmlEncoding(String encoding) {
- m_xmlDocument.setXmlEncoding(encoding);
- }
-
- private class P_SaxContentHandler implements org.xml.sax.ContentHandler {
- private ScoutXmlElement m_ancestor;
- private ScoutXmlElement m_current;
- private Map<String, String> m_namespaceBuffer;
- private StringBuffer m_textBuffer;
-
- @Override
- public void startDocument() throws SAXException {
- m_ancestor = m_initialElement != null ? m_initialElement.getParent() : null;
- m_current = m_initialElement;
- m_namespaceBuffer = new Hashtable<String, String>();
- m_textBuffer = new StringBuffer();
-
- m_numberOfIgnoredErrors = 0;
- m_numberOfIgnoredWarnings = 0;
-
- m_xmlDocument.setStrictlyChecking(false);
- }
-
- @Override
- public void startPrefixMapping(String prefix, String namespaceURI) throws SAXException {
- m_namespaceBuffer.put(prefix, namespaceURI);
- }
-
- @Override
- public void startElement(String namespaceURI, String localName, String qnamePrefixed, Attributes attributes) throws SAXException {
- String text = m_textBuffer.toString().trim(); // Other wise problems with
- // mixed content
- if (text.length() > 0) {
- m_current.addText(text);
- }
- if (m_textBuffer.length() > 0) {
- m_textBuffer = new StringBuffer();
- }
-
- m_ancestor = m_current;
- m_current = m_xmlDocument.new ScoutXmlElement();
-
- m_current.setName(qnamePrefixed.equals("") ? localName : qnamePrefixed);
-
- if (m_xmlDocument.hasRoot()) {
- m_ancestor.addChild(m_current);
- }
- else {
- m_xmlDocument.setRoot(m_current);
- }
-
- if (m_namespaceBuffer.size() > 0) {
- m_current.setNamespaces(m_namespaceBuffer);
- m_namespaceBuffer = new Hashtable<String, String>();
- }
-
- if (attributes.getLength() > 0) {
- m_current.setAttributes(attributes);
- }
- }
-
- @Override
- public void characters(char[] characters, int start, int length) throws SAXException {
- if (length > 0) {
- m_textBuffer.append(characters, start, length);
- }
- }
-
- @Override
- public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException {
- // Ignored
- }
-
- @Override
- public void endElement(String uri, String localName, String qName) throws SAXException {
- String text = m_textBuffer.toString().trim();
- if (text.length() > 0) {
- m_current.addText(text);
- }
- if (m_textBuffer.length() > 0) {
- m_textBuffer = new StringBuffer();
- }
-
- m_current.optimize();
-
- if (!m_current.isRoot()) {
- m_current = m_ancestor;
- m_ancestor = m_ancestor.getParent();
- }
- }
-
- @Override
- public void endPrefixMapping(String prefix) throws SAXException {
- // Ignored
- }
-
- @Override
- public void endDocument() throws SAXException {
- m_ancestor = null;
- m_current = null;
- m_namespaceBuffer = null;
- m_textBuffer = null;
-
- if (m_numberOfIgnoredErrors > 0) {
- LOG.warn(m_numberOfIgnoredErrors + " recoverable error(s) were ignored.");
- }
-
- if (m_numberOfIgnoredWarnings > 0) {
- LOG.warn(m_numberOfIgnoredWarnings + " warnings(s) were ignored.");
- }
- }
-
- @Override
- public void processingInstruction(String target, String data) throws SAXException {
- // Ignored
- }
-
- @Override
- public void setDocumentLocator(Locator locator) {
- // Ignored
- }
-
- @Override
- public void skippedEntity(String name) throws SAXException {
- // Ignored
- }
- }
-
- private class P_SaxDeclarationHandler implements org.xml.sax.ext.DeclHandler {
-
- @Override
- public void attributeDecl(String eName, String aName, String type, String valueDefault, String value) throws SAXException {
- // Ignored
- }
-
- @Override
- public void elementDecl(String name, String model) throws SAXException {
- // Ignored
- }
-
- @Override
- public void externalEntityDecl(String name, String publicId, String systemId) throws SAXException {
- // Ignored
- }
-
- @Override
- public void internalEntityDecl(String name, String value) throws SAXException {
- // Ignored
- }
- }
-
- private class P_SaxEntityResolver implements org.xml.sax.EntityResolver {
- @Override
- public InputSource resolveEntity(String publicId, String systemId) throws SAXException {
- if (ScoutXmlParser.this.isIgnoreExternalEntities()) {
- return new InputSource(new ByteArrayInputStream(new String("<?xml version=\"1.0\" encoding=\"UTF-8\"?>").getBytes()));
- }
- else {
- return null;
- }
- }
- }
-
- private class P_SaxErrorHandler implements org.xml.sax.ErrorHandler {
- @Override
- public void fatalError(SAXParseException exception) throws SAXException {
- throw exception;
- }
-
- @Override
- public void error(SAXParseException exception) throws SAXException {
- if (ScoutXmlParser.this.isIgnoreSaxErrors()) {
- m_numberOfIgnoredErrors++;
- }
- else {
- throw exception;
- }
- }
-
- @Override
- public void warning(SAXParseException exception) throws SAXException {
- if (ScoutXmlParser.this.isIgnoreSaxWarnings()) {
- m_numberOfIgnoredWarnings++;
- }
- else {
- LOG.warn(exception.getMessage());
- }
- }
- }
-
- private class P_SaxLexicalHandler implements org.xml.sax.ext.LexicalHandler {
- @Override
- public void comment(char[] ch, int start, int length) throws SAXException {
- // Ignored
- }
-
- @Override
- public void startCDATA() throws SAXException {
- // Ignored
- }
-
- @Override
- public void endCDATA() throws SAXException {
- // Ignored
- }
-
- @Override
- public void startDTD(String name, String publicId, String systemId) throws SAXException {
- m_xmlDocument.setExternalDTD(publicId, systemId);
- }
-
- @Override
- public void endDTD() throws SAXException {
- // Ignored
- }
-
- @Override
- public void startEntity(String name) throws SAXException {
- // Ignored
- }
-
- @Override
- public void endEntity(String name) throws SAXException {
- // Ignored
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.xmlparser;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.Hashtable;
+import java.util.Map;
+
+import javax.naming.ConfigurationException;
+
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
+import org.xml.sax.Attributes;
+import org.xml.sax.InputSource;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXNotSupportedException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.XMLReaderFactory;
+
+/**
+ * Title : Scout XML Parser Description: Copyright : Copyright (c) 2006 BSI AG,
+ * ETH Zürich, Stefan Vogt Company : BSI AG www.bsiag.com
+ *
+ * @version 1.0
+ */
+public class ScoutXmlParser {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(ScoutXmlParser.class);
+ private static boolean warnedDefaultParserNotFound;
+
+ private static final boolean DEFAULT_IGNORE_EXTERNAL_ENTITIES = false;
+ private static final boolean DEFAULT_IGNORE_SAX_ERRORS = false;
+ private static final boolean DEFAULT_IGNORE_SAX_WARNINGS = true;
+ private static final String DEFAULT_ENTITY_EXPANSION_LIMIT = "1000000000";
+
+ private boolean m_ignoreExternalEntities;
+ private boolean m_ignoreSaxErrors;
+ private boolean m_ignoreSaxWarnings;
+ private int m_numberOfIgnoredErrors;
+ private int m_numberOfIgnoredWarnings;
+ private ScoutXmlDocument m_xmlDocument;
+ private ScoutXmlElement m_initialElement;
+ private XMLReader m_xmlReader;
+
+ /**
+ * @since 1.0
+ */
+ public ScoutXmlParser() {
+ this(new ScoutXmlDocument());
+ }
+
+ /**
+ * @since 1.0
+ */
+ public ScoutXmlParser(boolean ignoreExternalEntities) {
+ this();
+ this.setIgnoreExternalEntities(ignoreExternalEntities);
+ }
+
+ /**
+ * @since 1.0
+ */
+ public ScoutXmlParser(ScoutXmlDocument document) {
+ this(document, null);
+ }
+
+ /**
+ * @since 1.0
+ */
+ protected ScoutXmlParser(ScoutXmlDocument document, ScoutXmlElement root) {
+ m_initialElement = root;
+ m_xmlDocument = document;
+
+ this.setIgnoreExternalEntities(DEFAULT_IGNORE_EXTERNAL_ENTITIES);
+ this.setIgnoreSaxErrors(DEFAULT_IGNORE_SAX_ERRORS);
+ this.setIgnoreSaxWarnings(DEFAULT_IGNORE_SAX_WARNINGS);
+
+ try {
+ m_xmlReader = new org.apache.xerces.parsers.SAXParser();
+ }
+ catch (Throwable t) {
+ try {
+ m_xmlReader = XMLReaderFactory.createXMLReader();
+ }
+ catch (SAXException e) {
+ throw new UnsupportedOperationException("Cannot find an xml parser. Check dependency to org.apache.xerces");
+ }
+ if (!warnedDefaultParserNotFound) {
+ warnedDefaultParserNotFound = true;
+ if (LOG.isInfoEnabled()) {
+ LOG.info("Missing dependency to org.apache.xerces. Using alternative " + m_xmlReader.getClass().getName());
+ }
+ }
+ }
+
+ m_xmlReader.setContentHandler(new P_SaxContentHandler());
+ m_xmlReader.setErrorHandler(new P_SaxErrorHandler());
+ m_xmlReader.setEntityResolver(new P_SaxEntityResolver());
+
+ try {
+ m_xmlReader.setProperty("http://xml.org/sax/properties/lexical-handler", new P_SaxLexicalHandler());
+ m_xmlReader.setProperty("http://xml.org/sax/properties/declaration-handler", new P_SaxDeclarationHandler());
+
+ m_xmlReader.setFeature("http://xml.org/sax/features/external-general-entities", true);
+ m_xmlReader.setFeature("http://xml.org/sax/features/external-parameter-entities", true);
+ }
+ catch (SAXNotRecognizedException e) {
+ // Do nothing
+ }
+ catch (SAXNotSupportedException e) {
+ // Do nothing
+ }
+ }
+
+ /**
+ * Returns whether this parser is ignoring external entities. This is
+ * especially useful if you want to ignore an external DTD which is currently
+ * unavailable. But keep in mind that if you ignore the DTD it is possible
+ * that some texts differ because entities declared in the DTD can't be
+ * resolved.
+ *
+ * @since 1.0
+ */
+ public boolean isIgnoreExternalEntities() {
+ return m_ignoreExternalEntities;
+ }
+
+ /**
+ * Returns whether this parser is ignoring recoverable SAX errors.
+ *
+ * @since 1.0
+ */
+ public boolean isIgnoreSaxErrors() {
+ return m_ignoreSaxErrors;
+ }
+
+ /**
+ * Returns whether this parser is ignoring SAX warnings.
+ *
+ * @since 1.0
+ */
+ public boolean isIgnoreSaxWarnings() {
+ return m_ignoreSaxWarnings;
+ }
+
+ /**
+ * Returns whether this parser is validating.
+ *
+ * @since 1.0
+ */
+ public boolean isValidating() {
+ try {
+ return m_xmlReader.getFeature("http://xml.org/sax/features/validation");
+ }
+ catch (SAXNotRecognizedException exception) {
+ return false;
+ }
+ catch (SAXNotSupportedException exception) {
+ return false;
+ }
+ }
+
+ /**
+ * @param file
+ * @return
+ * @throws FileNotFoundException
+ * @throws IOException
+ * @throws SAXException
+ * @since 1.0
+ */
+ public ScoutXmlDocument parse(File file) throws IOException, SAXException {
+ return this.parse(new FileInputStream(file), file.getAbsolutePath());
+ }
+
+ /**
+ * Parses the given stream and returns the resulting XML document.
+ *
+ * @param stream
+ * The stream to be parsed.
+ * @return ScoutXmlDocument
+ * @throws IOException
+ * @throws SAXException
+ * @since 1.0
+ */
+ public ScoutXmlDocument parse(InputStream stream) throws IOException, SAXException {
+ return this.parse(stream, null);
+ }
+
+ /**
+ * Parses the given stream and returns the resulting XML document.
+ *
+ * @param stream
+ * The stream to be parsed.
+ * @param systemId
+ * The system identifier for this source.
+ * @return ScoutXmlDocument
+ * @throws IOException
+ * @throws SAXException
+ * @since 1.0
+ */
+ public ScoutXmlDocument parse(InputStream stream, String systemId) throws IOException, SAXException {
+ InputSource inputSource = new InputSource(stream);
+
+ if (systemId != null) {
+ inputSource.setSystemId(new File(systemId).toURI().toString());
+ }
+
+ m_xmlReader.parse(inputSource);
+
+ return m_xmlDocument;
+ }
+
+ /**
+ * Parses the given source and returns the resulting XML document.
+ *
+ * @param source
+ * The source can be a file's name, an URI or the XML document
+ * itself. Examples for a valid source are: &quot;C:\\test.xml&quot;,
+ * &quot;http://www.bsiag.com/test.xml&quot; or
+ * &quot;&lt;test&gt;Hello&lt;/test&gt;&quot;
+ * @return ScoutXmlDocument
+ * @throws IOException
+ * @throws SAXException
+ * @since 1.0
+ */
+ public ScoutXmlDocument parse(String source) throws IOException, SAXException {
+ return this.parse(source, null);
+ }
+
+ /**
+ * Parses the given source and returns the resulting XML document.
+ *
+ * @param source
+ * The source can be a file's name, an URI or the XML document
+ * itself. Examples for a valid source are: &quot;C:\\test.xml&quot;,
+ * &quot;http://www.bsiag.com/test.xml&quot; or
+ * &quot;&lt;test&gt;Hello&lt;/test&gt;&quot;
+ * @param systemId
+ * The system identifier for this source. Only used if the source is
+ * XML code.
+ * @return ScoutXmlDocument
+ * @throws IOException
+ * @throws SAXException
+ * @since 1.0
+ */
+ public ScoutXmlDocument parse(String source, String systemId) throws IOException, SAXException {
+ if (source.equals("")) {
+ return m_xmlDocument;
+ }
+ else {
+ try {
+ if (new File(source).exists()) {
+ source = new File(source).toURI().toString();
+ }
+ else {
+ new URI(source);
+ }
+
+ m_xmlReader.parse(source);
+ }
+ catch (URISyntaxException exception) {
+ if (source.trim().startsWith("<")) {
+ this.parse(new ByteArrayInputStream(source.getBytes()), systemId);
+ }
+ else {
+ throw new ScoutXmlException("Unknown source. If it is a file path the file doesn't exist.");
+ }
+ }
+ }
+
+ return m_xmlDocument;
+ }
+
+ /**
+ * @since 1.0
+ */
+ public ScoutXmlDocument parse(URL url) throws IOException, SAXException {
+ return this.parse(url.toExternalForm());
+ }
+
+ /**
+ * Sets whether to ignore all external entities This is especially useful if
+ * you want to ignore an external DTD which is currently unavailable. But keep
+ * in mind that if you ignore the DTD it is possible that some text values
+ * differ because entities declared in the DTD can't be resolved or that the
+ *
+ * @param ignoreExternalEntities
+ * If true all external entities are ignored.
+ * @since 1.0
+ */
+ public void setIgnoreExternalEntities(boolean ignoreExternalEntities) {
+ m_ignoreExternalEntities = ignoreExternalEntities;
+ }
+
+ /**
+ * Sets whether to ignore recoverable SAX parser errors.
+ *
+ * @param ignoreSaxErrors
+ * If true all recoverable parser errors are ignored, otherwise an
+ * exception is thrown.
+ * @since 1.0
+ */
+ public void setIgnoreSaxErrors(boolean ignoreSaxErrors) {
+ m_ignoreSaxErrors = ignoreSaxErrors;
+ }
+
+ /**
+ * Sets whether to ignore SAX parser warnings.
+ *
+ * @param ignoreParserErrors
+ * If true all parser warnings are ignored, otherwise the warning is
+ * written to the log.
+ * @since 1.0
+ */
+ public void setIgnoreSaxWarnings(boolean ignoreSaxWarnings) {
+ m_ignoreSaxWarnings = ignoreSaxWarnings;
+ }
+
+ /**
+ * Sets whether to validate the document which is to be parsed.
+ *
+ * @param validating
+ * If true the document is validated, otherwise not.
+ * @throws ConfigurationException
+ * Is thrown if the underlying SAX parser doesn't support
+ * validation.
+ * @since 1.0
+ */
+ public void setValidating(boolean validating) {
+ try {
+ m_xmlReader.setFeature("http://xml.org/sax/features/validation", validating);
+ }
+ catch (Exception exception) {
+ if (validating) {
+ throw new ScoutXmlException("The currently instantiated SAX parser doesn't allow to turn validation on.", exception);
+ }
+ }
+ }
+
+ public void setXmlEncoding(String encoding) {
+ m_xmlDocument.setXmlEncoding(encoding);
+ }
+
+ private class P_SaxContentHandler implements org.xml.sax.ContentHandler {
+ private ScoutXmlElement m_ancestor;
+ private ScoutXmlElement m_current;
+ private Map<String, String> m_namespaceBuffer;
+ private StringBuffer m_textBuffer;
+
+ @Override
+ public void startDocument() throws SAXException {
+ m_ancestor = m_initialElement != null ? m_initialElement.getParent() : null;
+ m_current = m_initialElement;
+ m_namespaceBuffer = new Hashtable<String, String>();
+ m_textBuffer = new StringBuffer();
+
+ m_numberOfIgnoredErrors = 0;
+ m_numberOfIgnoredWarnings = 0;
+
+ m_xmlDocument.setStrictlyChecking(false);
+ }
+
+ @Override
+ public void startPrefixMapping(String prefix, String namespaceURI) throws SAXException {
+ m_namespaceBuffer.put(prefix, namespaceURI);
+ }
+
+ @Override
+ public void startElement(String namespaceURI, String localName, String qnamePrefixed, Attributes attributes) throws SAXException {
+ String text = m_textBuffer.toString().trim(); // Other wise problems with
+ // mixed content
+ if (text.length() > 0) {
+ m_current.addText(text);
+ }
+ if (m_textBuffer.length() > 0) {
+ m_textBuffer = new StringBuffer();
+ }
+
+ m_ancestor = m_current;
+ m_current = m_xmlDocument.new ScoutXmlElement();
+
+ m_current.setName(qnamePrefixed.equals("") ? localName : qnamePrefixed);
+
+ if (m_xmlDocument.hasRoot()) {
+ m_ancestor.addChild(m_current);
+ }
+ else {
+ m_xmlDocument.setRoot(m_current);
+ }
+
+ if (m_namespaceBuffer.size() > 0) {
+ m_current.setNamespaces(m_namespaceBuffer);
+ m_namespaceBuffer = new Hashtable<String, String>();
+ }
+
+ if (attributes.getLength() > 0) {
+ m_current.setAttributes(attributes);
+ }
+ }
+
+ @Override
+ public void characters(char[] characters, int start, int length) throws SAXException {
+ if (length > 0) {
+ m_textBuffer.append(characters, start, length);
+ }
+ }
+
+ @Override
+ public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException {
+ // Ignored
+ }
+
+ @Override
+ public void endElement(String uri, String localName, String qName) throws SAXException {
+ String text = m_textBuffer.toString().trim();
+ if (text.length() > 0) {
+ m_current.addText(text);
+ }
+ if (m_textBuffer.length() > 0) {
+ m_textBuffer = new StringBuffer();
+ }
+
+ m_current.optimize();
+
+ if (!m_current.isRoot()) {
+ m_current = m_ancestor;
+ m_ancestor = m_ancestor.getParent();
+ }
+ }
+
+ @Override
+ public void endPrefixMapping(String prefix) throws SAXException {
+ // Ignored
+ }
+
+ @Override
+ public void endDocument() throws SAXException {
+ m_ancestor = null;
+ m_current = null;
+ m_namespaceBuffer = null;
+ m_textBuffer = null;
+
+ if (m_numberOfIgnoredErrors > 0) {
+ LOG.warn(m_numberOfIgnoredErrors + " recoverable error(s) were ignored.");
+ }
+
+ if (m_numberOfIgnoredWarnings > 0) {
+ LOG.warn(m_numberOfIgnoredWarnings + " warnings(s) were ignored.");
+ }
+ }
+
+ @Override
+ public void processingInstruction(String target, String data) throws SAXException {
+ // Ignored
+ }
+
+ @Override
+ public void setDocumentLocator(Locator locator) {
+ // Ignored
+ }
+
+ @Override
+ public void skippedEntity(String name) throws SAXException {
+ // Ignored
+ }
+ }
+
+ private class P_SaxDeclarationHandler implements org.xml.sax.ext.DeclHandler {
+
+ @Override
+ public void attributeDecl(String eName, String aName, String type, String valueDefault, String value) throws SAXException {
+ // Ignored
+ }
+
+ @Override
+ public void elementDecl(String name, String model) throws SAXException {
+ // Ignored
+ }
+
+ @Override
+ public void externalEntityDecl(String name, String publicId, String systemId) throws SAXException {
+ // Ignored
+ }
+
+ @Override
+ public void internalEntityDecl(String name, String value) throws SAXException {
+ // Ignored
+ }
+ }
+
+ private class P_SaxEntityResolver implements org.xml.sax.EntityResolver {
+ @Override
+ public InputSource resolveEntity(String publicId, String systemId) throws SAXException {
+ if (ScoutXmlParser.this.isIgnoreExternalEntities()) {
+ return new InputSource(new ByteArrayInputStream(new String("<?xml version=\"1.0\" encoding=\"UTF-8\"?>").getBytes()));
+ }
+ else {
+ return null;
+ }
+ }
+ }
+
+ private class P_SaxErrorHandler implements org.xml.sax.ErrorHandler {
+ @Override
+ public void fatalError(SAXParseException exception) throws SAXException {
+ throw exception;
+ }
+
+ @Override
+ public void error(SAXParseException exception) throws SAXException {
+ if (ScoutXmlParser.this.isIgnoreSaxErrors()) {
+ m_numberOfIgnoredErrors++;
+ }
+ else {
+ throw exception;
+ }
+ }
+
+ @Override
+ public void warning(SAXParseException exception) throws SAXException {
+ if (ScoutXmlParser.this.isIgnoreSaxWarnings()) {
+ m_numberOfIgnoredWarnings++;
+ }
+ else {
+ LOG.warn(exception.getMessage());
+ }
+ }
+ }
+
+ private class P_SaxLexicalHandler implements org.xml.sax.ext.LexicalHandler {
+ @Override
+ public void comment(char[] ch, int start, int length) throws SAXException {
+ // Ignored
+ }
+
+ @Override
+ public void startCDATA() throws SAXException {
+ // Ignored
+ }
+
+ @Override
+ public void endCDATA() throws SAXException {
+ // Ignored
+ }
+
+ @Override
+ public void startDTD(String name, String publicId, String systemId) throws SAXException {
+ m_xmlDocument.setExternalDTD(publicId, systemId);
+ }
+
+ @Override
+ public void endDTD() throws SAXException {
+ // Ignored
+ }
+
+ @Override
+ public void startEntity(String name) throws SAXException {
+ // Ignored
+ }
+
+ @Override
+ public void endEntity(String name) throws SAXException {
+ // Ignored
+ }
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/xmlparser/ScoutXmlQName.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/xmlparser/ScoutXmlQName.java
index 259568cbd0..1ac826ec50 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/xmlparser/ScoutXmlQName.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/xmlparser/ScoutXmlQName.java
@@ -1,225 +1,225 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.xmlparser;
-
-/**
- * Title : Scout XML QName Description: QName (qualified name) support for
- * ScoutXml elements and attributes Copyright : Copyright (c) 2006 BSI AG, ETH
- * Zürich, Stefan Vogt Company : BSI AG www.bsiag.com
- *
- * @version 1.0
- */
-public class ScoutXmlQName implements Comparable {
- private String m_namespaceURI;
- private String m_localName;
- private String m_prefix;
-
- /**
- * @since 1.0
- */
- protected ScoutXmlQName(String localPart) {
- this(null, null, localPart);
- }
-
- /**
- * @since 1.0
- */
- protected ScoutXmlQName(String namespace, String localPart) {
- this(namespace, null, localPart);
- }
-
- /**
- * @since 1.0
- */
- protected ScoutXmlQName(String namespace, String prefix, String localPart) {
- m_namespaceURI = namespace;
- m_prefix = prefix;
- m_localName = localPart;
- }
-
- /**
- * @since 1.0
- */
- protected static String extractNamespace(String nameExpanded) {
- if (isExpanded(nameExpanded)) {
- return nameExpanded.replaceAll("\\{", "").replaceAll("}.*", "");
- }
- else {
- return "";
- }
- }
-
- /**
- * @since 1.0
- */
- protected static String extractPrefix(String namePrefixed) {
- if (isPrefixed(namePrefixed)) {
- return namePrefixed.replaceAll(":.*", "");
- }
- else {
- return "";
- }
- }
-
- /**
- * @since 1.0
- */
- protected static String extractLocalName(String name) {
- if (isPrefixed(name)) {
- return name.replaceAll(".*:", "");
- }
- else if (isExpanded(name)) {
- return name.replaceAll("\\{.*\\}", "");
- }
- else {
- return name;
- }
- }
-
- /**
- * @since 1.0
- */
- protected static boolean isExpanded(String name) {
- return name.matches("\\{.*\\}.*");
- }
-
- /**
- * @since 1.0
- */
- protected static boolean isPrefixed(String name) {
- return name.matches(".*:.*");
- }
-
- /**
- * @since 1.0
- */
- public static ScoutXmlQName valueOf(String name) {
- if ((name != null) && (!name.equals(""))) {
- if (isPrefixed(name)) {
- return new ScoutXmlQName(null, extractPrefix(name), extractLocalName(name));
- }
- else if (isExpanded(name)) {
- return new ScoutXmlQName(extractNamespace(name), null, extractLocalName(name));
-
- }
- else {
- return new ScoutXmlQName(null, null, name);
- }
- }
- else {
- return null;
- }
- }
-
- /**
- * @since 1.0
- */
- @Override
- public int compareTo(Object object) {
- if (object != null) {
- return this.toString().compareTo(object.toString());
- }
- else {
- return 0;
- }
- }
-
- /**
- * @since 1.0
- */
- public int compareToIgnoreCase(Object object) {
- if (object != null) {
- return this.toString().compareToIgnoreCase(object.toString());
- }
- else {
- return 0;
- }
- }
-
- /**
- * @since 1.0
- */
- @Override
- public boolean equals(Object object) {
- return ((object != null) && (object instanceof ScoutXmlQName) && (((ScoutXmlQName) object).toString().equals(this.toString())));
- }
-
- @Override
- public int hashCode() {
- return this.toString().hashCode();
- }
-
- /**
- * @since 1.0
- */
- public boolean equalsIgnoreCase(Object object) {
- return ((object != null) && (object instanceof ScoutXmlQName) && (((ScoutXmlQName) object).toString().equalsIgnoreCase(this.toString())));
- }
-
- /**
- * @since 1.0
- */
- public String getPrefix() {
- return m_prefix;
- }
-
- /**
- * @since 1.0
- */
- public String getNamespace() {
- return m_namespaceURI;
- }
-
- /**
- * @since 1.0
- */
- public boolean hasNamespace() {
- return (m_namespaceURI != null) && (!m_namespaceURI.equals(""));
- }
-
- /**
- * @since 1.0
- */
- public boolean hasPrefix() {
- return (m_prefix != null) && (!m_prefix.equals(""));
- }
-
- /**
- * @since 1.0
- */
- public String getExpandedForm() {
- return ((this.hasNamespace() ? "{" + this.getNamespace() + "}" : "") + this.getLocalName());
- }
-
- /**
- * @since 1.0
- */
- public String getPrefixedForm() {
- return ((this.hasPrefix() ? this.getPrefix() + ":" : "") + this.getLocalName());
- }
-
- /**
- * @since 1.0
- */
- public String getLocalName() {
- return m_localName;
- }
-
- /**
- * Returns the expanded form, e.g. {namespace}localpart, of this QName.
- *
- * @since 1.0
- */
- @Override
- public String toString() {
- return this.getExpandedForm();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.xmlparser;
+
+/**
+ * Title : Scout XML QName Description: QName (qualified name) support for
+ * ScoutXml elements and attributes Copyright : Copyright (c) 2006 BSI AG, ETH
+ * Zürich, Stefan Vogt Company : BSI AG www.bsiag.com
+ *
+ * @version 1.0
+ */
+public class ScoutXmlQName implements Comparable {
+ private String m_namespaceURI;
+ private String m_localName;
+ private String m_prefix;
+
+ /**
+ * @since 1.0
+ */
+ protected ScoutXmlQName(String localPart) {
+ this(null, null, localPart);
+ }
+
+ /**
+ * @since 1.0
+ */
+ protected ScoutXmlQName(String namespace, String localPart) {
+ this(namespace, null, localPart);
+ }
+
+ /**
+ * @since 1.0
+ */
+ protected ScoutXmlQName(String namespace, String prefix, String localPart) {
+ m_namespaceURI = namespace;
+ m_prefix = prefix;
+ m_localName = localPart;
+ }
+
+ /**
+ * @since 1.0
+ */
+ protected static String extractNamespace(String nameExpanded) {
+ if (isExpanded(nameExpanded)) {
+ return nameExpanded.replaceAll("\\{", "").replaceAll("}.*", "");
+ }
+ else {
+ return "";
+ }
+ }
+
+ /**
+ * @since 1.0
+ */
+ protected static String extractPrefix(String namePrefixed) {
+ if (isPrefixed(namePrefixed)) {
+ return namePrefixed.replaceAll(":.*", "");
+ }
+ else {
+ return "";
+ }
+ }
+
+ /**
+ * @since 1.0
+ */
+ protected static String extractLocalName(String name) {
+ if (isPrefixed(name)) {
+ return name.replaceAll(".*:", "");
+ }
+ else if (isExpanded(name)) {
+ return name.replaceAll("\\{.*\\}", "");
+ }
+ else {
+ return name;
+ }
+ }
+
+ /**
+ * @since 1.0
+ */
+ protected static boolean isExpanded(String name) {
+ return name.matches("\\{.*\\}.*");
+ }
+
+ /**
+ * @since 1.0
+ */
+ protected static boolean isPrefixed(String name) {
+ return name.matches(".*:.*");
+ }
+
+ /**
+ * @since 1.0
+ */
+ public static ScoutXmlQName valueOf(String name) {
+ if ((name != null) && (!name.equals(""))) {
+ if (isPrefixed(name)) {
+ return new ScoutXmlQName(null, extractPrefix(name), extractLocalName(name));
+ }
+ else if (isExpanded(name)) {
+ return new ScoutXmlQName(extractNamespace(name), null, extractLocalName(name));
+
+ }
+ else {
+ return new ScoutXmlQName(null, null, name);
+ }
+ }
+ else {
+ return null;
+ }
+ }
+
+ /**
+ * @since 1.0
+ */
+ @Override
+ public int compareTo(Object object) {
+ if (object != null) {
+ return this.toString().compareTo(object.toString());
+ }
+ else {
+ return 0;
+ }
+ }
+
+ /**
+ * @since 1.0
+ */
+ public int compareToIgnoreCase(Object object) {
+ if (object != null) {
+ return this.toString().compareToIgnoreCase(object.toString());
+ }
+ else {
+ return 0;
+ }
+ }
+
+ /**
+ * @since 1.0
+ */
+ @Override
+ public boolean equals(Object object) {
+ return ((object != null) && (object instanceof ScoutXmlQName) && (((ScoutXmlQName) object).toString().equals(this.toString())));
+ }
+
+ @Override
+ public int hashCode() {
+ return this.toString().hashCode();
+ }
+
+ /**
+ * @since 1.0
+ */
+ public boolean equalsIgnoreCase(Object object) {
+ return ((object != null) && (object instanceof ScoutXmlQName) && (((ScoutXmlQName) object).toString().equalsIgnoreCase(this.toString())));
+ }
+
+ /**
+ * @since 1.0
+ */
+ public String getPrefix() {
+ return m_prefix;
+ }
+
+ /**
+ * @since 1.0
+ */
+ public String getNamespace() {
+ return m_namespaceURI;
+ }
+
+ /**
+ * @since 1.0
+ */
+ public boolean hasNamespace() {
+ return (m_namespaceURI != null) && (!m_namespaceURI.equals(""));
+ }
+
+ /**
+ * @since 1.0
+ */
+ public boolean hasPrefix() {
+ return (m_prefix != null) && (!m_prefix.equals(""));
+ }
+
+ /**
+ * @since 1.0
+ */
+ public String getExpandedForm() {
+ return ((this.hasNamespace() ? "{" + this.getNamespace() + "}" : "") + this.getLocalName());
+ }
+
+ /**
+ * @since 1.0
+ */
+ public String getPrefixedForm() {
+ return ((this.hasPrefix() ? this.getPrefix() + ":" : "") + this.getLocalName());
+ }
+
+ /**
+ * @since 1.0
+ */
+ public String getLocalName() {
+ return m_localName;
+ }
+
+ /**
+ * Returns the expanded form, e.g. {namespace}localpart, of this QName.
+ *
+ * @since 1.0
+ */
+ @Override
+ public String toString() {
+ return this.getExpandedForm();
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/xmlparser/SimpleXmlElement.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/xmlparser/SimpleXmlElement.java
index 529d07240f..fcb03f6c1f 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/xmlparser/SimpleXmlElement.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/xmlparser/SimpleXmlElement.java
@@ -1,1281 +1,1281 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.xmlparser;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.CharArrayReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.ObjectOutputStream;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.Reader;
-import java.io.StringReader;
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.TreeMap;
-
-import org.eclipse.scout.commons.Base64Utility;
-import org.eclipse.scout.commons.osgi.ContextFinderBasedObjectInputStream;
-
-/**
- * Simple xml parser/writer. Very efficient and performant when handling xml
- * content without care of namespaces.
- */
-public class SimpleXmlElement {
- private static final HashMap<String, String> ENTITIES;
- private static final HashMap<String, String> INVERSE_ENTITIES;
-
- private TreeMap<String, String> m_attributeMap;
- private ArrayList<String> m_attributeNames;
- private SimpleXmlElement m_parent;
- private ArrayList<SimpleXmlElement> m_children;
- private String m_name;
- private String m_contents;
- private int m_lineNr;
- private char m_charReadTooMuch;
- private Reader m_reader;
- private int m_parserLineNr;
- // flags
- private boolean m_ignoreCase;
- private boolean m_ignoreWhitespace;
-
- public SimpleXmlElement() {
- this((String) null);
- }
-
- public SimpleXmlElement(String name) {
- this(name, false, false);
- }
-
- public SimpleXmlElement(String name, boolean ignoreWhiteSpace, boolean ignoreCase) {
- m_name = name;
- m_ignoreCase = ignoreCase;
- m_ignoreWhitespace = ignoreWhiteSpace;
- m_contents = "";
- m_attributeMap = new TreeMap<String, String>();
- m_attributeNames = new ArrayList<String>();
- m_children = new ArrayList<SimpleXmlElement>();
- m_lineNr = 0;
- }
-
- public SimpleXmlElement(SimpleXmlElement x) {
- m_name = x.m_name;
- m_ignoreCase = x.m_ignoreCase;
- m_ignoreWhitespace = x.m_ignoreWhitespace;
- m_contents = x.m_contents;
- m_attributeMap = new TreeMap<String, String>(x.m_attributeMap);
- m_attributeNames = new ArrayList<String>(x.m_attributeNames);
- m_children = new ArrayList<SimpleXmlElement>();
- m_lineNr = 0;
- }
-
- public void setIgnoreWhitespace(boolean b) {
- m_ignoreWhitespace = b;
- }
-
- public boolean isIgnoreWhitespace() {
- return m_ignoreWhitespace;
- }
-
- public void setIgnoreCase(boolean b) {
- m_ignoreCase = b;
- }
-
- public boolean isIgnoreCase() {
- return m_ignoreCase;
- }
-
- public void addChild(SimpleXmlElement child) {
- if (child.m_parent != null) {
- child.m_parent.removeChild(child);
- }
- m_children.add(child);
- child.m_parent = this;
- }
-
- public void addChild(SimpleXmlElement child, int pos) {
- m_children.add(pos, child);
- child.m_parent = this;
- }
-
- public void replaceChild(SimpleXmlElement oldChild, SimpleXmlElement newChild) {
- if (newChild == null) {
- throw new IllegalArgumentException("newChild must not be null");
- }
- int index = m_children.indexOf(oldChild);
- if (index < 0) {
- throw new IllegalArgumentException("oldChild " + oldChild + " does not exist");
- }
- m_children.set(index, newChild);
- newChild.m_parent = this;
- oldChild.m_parent = null;
- }
-
- public void setAttribute(String name, Object value) {
- if (m_ignoreCase) {
- name = name.toUpperCase();
- }
- setAttributeInternal(name, value != null ? value.toString() : null);
- }
-
- public void setIntAttribute(String name, int value) {
- if (m_ignoreCase) {
- name = name.toUpperCase();
- }
- setAttributeInternal(name, Integer.toString(value));
- }
-
- public void setDoubleAttribute(String name, double value) {
- if (m_ignoreCase) {
- name = name.toUpperCase();
- }
- setAttributeInternal(name, Double.toString(value));
- }
-
- public int countChildren() {
- return m_children.size();
- }
-
- public void clearAttributes() {
- m_attributeMap.clear();
- m_attributeNames.clear();
- }
-
- public void moveTo(int newIndex) {
- if (m_parent != null) {
- ArrayList<SimpleXmlElement> a = m_parent.m_children;
- int i = a.indexOf(this);
- if (i >= 0 && i != newIndex) {
- newIndex = Math.min(Math.max(0, newIndex), a.size() - 1);
- a.remove(i);
- a.add(newIndex, this);
- }
- }
- }
-
- public int getIndex() {
- if (m_parent != null) {
- ArrayList<SimpleXmlElement> a = m_parent.m_children;
- return a.indexOf(this);
- }
- return -1;
- }
-
- public ArrayList<String> getChildNames() {
- ArrayList<String> a = new ArrayList<String>();
- for (SimpleXmlElement e : getChildren()) {
- a.add(e.getName());
- }
- return a;
- }
-
- public ArrayList<SimpleXmlElement> getChildren() {
- return new ArrayList<SimpleXmlElement>(m_children);
- }
-
- public ArrayList<SimpleXmlElement> getChildren(String childrenName) {
- ArrayList<SimpleXmlElement> a = new ArrayList<SimpleXmlElement>();
- for (SimpleXmlElement c : m_children) {
- if (c.getName().equalsIgnoreCase(childrenName)) {
- a.add(c);
- }
- }
- return a;
- }
-
- /**
- * Returns an ArrayList with all children whose name matches the given regular
- * expression.
- */
- public ArrayList<SimpleXmlElement> getChildrenRegEx(String childNameAsRegEx) {
- ArrayList<SimpleXmlElement> selectedChildren = new ArrayList<SimpleXmlElement>();
- for (SimpleXmlElement child : m_children) {
- if (child.getName().matches(childNameAsRegEx)) {
- selectedChildren.add(child);
- }
- }
- return selectedChildren;
- }
-
- public SimpleXmlElement getChild(String name) {
- for (SimpleXmlElement c : m_children) {
- if (c.getName().equalsIgnoreCase(name)) {
- return c;
- }
- }
- return null;
- }
-
- /**
- * Returns the first child that matches the given regular expression or null
- * if there's no match.
- */
- public SimpleXmlElement getChildRegEx(String childNameAsRegEx) {
- Iterator<SimpleXmlElement> iterator = m_children.iterator();
-
- while (iterator.hasNext()) {
- SimpleXmlElement child = iterator.next();
-
- if (child.getName().matches(childNameAsRegEx)) {
- return child;
- }
- }
-
- return null;
- }
-
- public String getContent() {
- return m_contents;
- }
-
- public int getLineNr() {
- return m_lineNr;
- }
-
- public Object getAttribute(String name) {
- return this.getAttribute(name, null);
- }
-
- public boolean hasAttribute(String name) {
- if (m_ignoreCase) {
- name = name.toUpperCase();
- }
- return m_attributeMap.containsKey(name);
- }
-
- public Map<String, String> getAttributes() {
- return new HashMap<String, String>(m_attributeMap);
- }
-
- /**
- * Returns the first attribute that matches the given regular expression or
- * null if there's no match.
- */
- public Object getAttributeRegEx(String attributeNameAsRegEx) {
- Iterator<String> iterator = m_attributeMap.keySet().iterator();
-
- while (iterator.hasNext()) {
- String attributeName = iterator.next();
-
- if (attributeName.matches(attributeNameAsRegEx)) {
- return this.getAttribute(attributeName);
- }
- }
-
- return null;
- }
-
- public Object getAttribute(String name, Object defaultValue) {
- if (m_ignoreCase) {
- name = name.toUpperCase();
- }
- Object value = getAttributeInternal(name);
- if (value == null || ("" + value).length() == 0) {
- value = defaultValue;
- }
- return value;
- }
-
- public Object getAttribute(String name, HashMap<Object, Object> valueSet, String defaultKey, boolean allowLiterals) {
- if (m_ignoreCase) {
- name = name.toUpperCase();
- }
- Object key = getAttributeInternal(name);
- Object result;
- if (key == null) {
- key = defaultKey;
- }
- result = valueSet.get(key);
- if (result == null) {
- if (allowLiterals) {
- result = key;
- }
- else {
- throw this.invalidValue(name, (String) key);
- }
- }
- return result;
- }
-
- public String getStringAttribute(String name) {
- return this.getStringAttribute(name, null);
- }
-
- public String getStringAttribute(String name, String defaultValue) {
- return (String) this.getAttribute(name, defaultValue);
- }
-
- public String getStringAttribute(String name, HashMap<Object, Object> valueSet, String defaultKey, boolean allowLiterals) {
- return (String) this.getAttribute(name, valueSet, defaultKey, allowLiterals);
- }
-
- public int getIntAttribute(String name) {
- return this.getIntAttribute(name, 0);
- }
-
- public int getIntAttribute(String name, int defaultValue) {
- if (m_ignoreCase) {
- name = name.toUpperCase();
- }
- String value = getAttributeInternal(name);
- if (value == null) {
- return defaultValue;
- }
- else {
- try {
- return Integer.parseInt(value);
- }
- catch (NumberFormatException e) {
- throw this.invalidValue(name, value);
- }
- }
- }
-
- public Long getLongAttribute(String name) {
- String value = getAttributeInternal(name);
- if (value == null) {
- return null;
- }
- else {
- return new Long(Long.parseLong(value));
- }
- }
-
- public Object getObjectAttribute(String name, Object defaultValue) throws IOException, ClassNotFoundException {
- return getObjectAttribute(name, defaultValue, null);
- }
-
- /**
- * @return a serialized object attribute from base64 serialized data using {@link ContextFinderBasedObjectInputStream}
- * that tries
- * to find the class using default osgi class loading and in a
- * second stage using the caller classes class loaders.
- */
- public Object getObjectAttribute(String name, Object defaultValue, ClassLoader primaryLoader) throws IOException, ClassNotFoundException {
- String base64 = getStringAttribute(name, "");
- if (base64.length() <= 0) {
- return defaultValue;
- }
- byte[] raw = Base64Utility.decode(base64);
- ContextFinderBasedObjectInputStream oi = new ContextFinderBasedObjectInputStream(new ByteArrayInputStream(raw), primaryLoader);
- Object o = oi.readObject();
- if (o == null) {
- o = defaultValue;
- }
- oi.close();
- return o;
- }
-
- /**
- * write a serialized object attribute
- */
- public void setObjectAttribute(String name, Object o) throws IOException {
- ByteArrayOutputStream bout = new ByteArrayOutputStream();
- ObjectOutputStream out = new ObjectOutputStream(bout);
- out.writeObject(o);
- out.close();
- String base64 = Base64Utility.encode(bout.toByteArray()).trim();
- this.setAttribute(name, base64);
- }
-
- public int getIntAttribute(String name, HashMap<Object, Integer> valueSet, String defaultKey, boolean allowLiteralNumbers) {
- if (m_ignoreCase) {
- name = name.toUpperCase();
- }
- Object key = getAttributeInternal(name);
- Integer result;
- if (key == null) {
- key = defaultKey;
- }
- try {
- result = valueSet.get(key);
- }
- catch (ClassCastException e) {
- throw this.invalidValueSet(name);
- }
- if (result == null) {
- if (!allowLiteralNumbers) {
- throw this.invalidValue(name, (String) key);
- }
- try {
- result = Integer.valueOf((String) key);
- }
- catch (NumberFormatException e) {
- throw this.invalidValue(name, (String) key);
- }
- }
- return result.intValue();
- }
-
- public double getDoubleAttribute(String name) {
- return this.getDoubleAttribute(name, 0.0);
- }
-
- public double getDoubleAttribute(String name, double defaultValue) {
- if (m_ignoreCase) {
- name = name.toUpperCase();
- }
- String value = getAttributeInternal(name);
- if (value == null) {
- return defaultValue;
- }
- else {
- try {
- return Double.valueOf(value).doubleValue();
- }
- catch (NumberFormatException e) {
- throw this.invalidValue(name, value);
- }
- }
- }
-
- public double getDoubleAttribute(String name, Map<Object, Double> valueSet, String defaultKey, boolean allowLiteralNumbers) {
- if (m_ignoreCase) {
- name = name.toUpperCase();
- }
- Object key = getAttributeInternal(name);
- Double result;
- if (key == null) {
- key = defaultKey;
- }
- try {
- result = valueSet.get(key);
- }
- catch (ClassCastException e) {
- throw this.invalidValueSet(name);
- }
- if (result == null) {
- if (!allowLiteralNumbers) {
- throw this.invalidValue(name, (String) key);
- }
- try {
- result = Double.valueOf((String) key);
- }
- catch (NumberFormatException e) {
- throw this.invalidValue(name, (String) key);
- }
- }
- return result.doubleValue();
- }
-
- public boolean getBooleanAttribute(String name, String trueValue, String falseValue, boolean defaultValue) {
- if (m_ignoreCase) {
- name = name.toUpperCase();
- }
- Object value = getAttributeInternal(name);
- if (value == null) {
- return defaultValue;
- }
- else if (value.equals(trueValue)) {
- return true;
- }
- else if (value.equals(falseValue)) {
- return false;
- }
- else {
- throw this.invalidValue(name, (String) value);
- }
- }
-
- public String getName() {
- return m_name;
- }
-
- public String getTagName() {
- return this.getName();
- }
-
- public void parseStream(InputStream in) throws IOException {
- parseStream(in, 1);
- }
-
- public void parseStream(InputStream input, int startingLineNr) throws IOException {
- parseStream(input, startingLineNr, true);
- }
-
- public void parseStream(InputStream input, int startingLineNr, boolean autoClose) throws IOException {
- // check input encoding if present
- removeChildren();
- BufferedInputStream bin;
- if (input instanceof BufferedInputStream) {
- bin = (BufferedInputStream) input;
- }
- else {
- bin = new BufferedInputStream(input);
- }
- bin.mark(1024);
- BufferedReader encodedReader = null;
- int ch = bin.read();
- while (ch >= 0 && (ch == '\n' || ch == '\t' || ch == ' ' || ch == '\r')) {
- ch = bin.read();
- }
- if (ch == '<') {
- ch = bin.read();
- if (ch == '?') {
- StringBuffer buf = new StringBuffer("<?");
- ch = bin.read();
- while (ch >= 0 && ch != '?') {
- buf.append((char) ch);
- ch = bin.read();
- }
- if (ch == '?') {
- buf.append((char) ch);
- }
- ch = bin.read();
- if (ch == '>') {
- buf.append((char) ch);
- }
- String xmlLine = buf.toString();
- int k = xmlLine.indexOf("encoding");
- if (k >= 0) {
- k = xmlLine.indexOf('=', k);
- if (k >= 0) {
- k = xmlLine.indexOf('"', k);
- if (k >= 0) {
- int m = xmlLine.indexOf('"', k + 1);
- if (m >= 0) {
- String encoding = xmlLine.substring(k + 1, m);
- // replace input reader
- bin.reset();
- encodedReader = new BufferedReader(new InputStreamReader(bin, encoding));
- }
- }
- }
- }
- }
- }
- // do not close bin
- if (encodedReader == null) {
- bin.reset();
- encodedReader = new BufferedReader(new InputStreamReader(bin));
- }
- try {
- parseImpl(encodedReader, 1);
- }
- finally {
- if (autoClose) {
- encodedReader.close();
- }
- }
- }
-
- protected void parseImpl(Reader r, int startingLineNr) throws IOException {
- m_name = null;
- m_contents = "";
- m_attributeMap = new TreeMap<String, String>();
- m_attributeNames = new ArrayList<String>();
- m_children = new ArrayList<SimpleXmlElement>();
- m_charReadTooMuch = '\0';
- m_reader = r;
- m_parserLineNr = startingLineNr;
-
- for (;;) {
- char ch = this.scanWhitespace();
-
- if (ch != '<') {
- throw this.expectedInput("<");
- }
-
- ch = this.readChar();
-
- if ((ch == '!') || (ch == '?')) {
- this.skipSpecialTag(0);
- }
- else {
- this.unreadChar(ch);
- this.scanElement(this);
- return;
- }
- }
- }
-
- public void parseReader(Reader r) throws IOException {
- parseImpl(r, 1);
- }
-
- public void parseString(String string) {
- try {
- this.parseImpl(new StringReader(string), 1);
- }
- catch (IOException e) {
- /* nop */
- }
- }
-
- public void parseString(String string, int offset) {
- this.parseString(string.substring(offset));
- }
-
- public void parseString(String string, int offset, int end) {
- this.parseString(string.substring(offset, end));
- }
-
- public void parseString(String string, int offset, int end, int startingLineNr) {
- string = string.substring(offset, end);
- try {
- this.parseImpl(new StringReader(string), startingLineNr);
- }
- catch (IOException e) {
- // Java exception handling suxx
- }
- }
-
- public void parseCharArray(char[] input, int offset, int end) {
- this.parseCharArray(input, offset, end, 1);
- }
-
- public void parseCharArray(char[] input, int offset, int end, int startingLineNr) {
- try {
- Reader reader = new CharArrayReader(input, offset, end);
- parseImpl(reader, startingLineNr);
- }
- catch (IOException e) {
- // This exception will never happen.
- }
- }
-
- public SimpleXmlElement getParent() {
- return m_parent;
- }
-
- public boolean isAncestorOf(SimpleXmlElement child) {
- SimpleXmlElement e = child;
- while (e != null) {
- if (e == this) {
- return true;
- }
- e = e.getParent();
- }
- return false;
- }
-
- public SimpleXmlElement getRoot() {
- if (m_parent == null) {
- return this;
- }
- else {
- return m_parent.getRoot();
- }
- }
-
- public void removeChild(SimpleXmlElement child) {
- m_children.remove(child);
- child.m_parent = null;
- }
-
- public void removeChildren() {
- m_children.clear();
- }
-
- public void removeChildren(String tagName) {
- for (Iterator<SimpleXmlElement> it = m_children.iterator(); it.hasNext();) {
- SimpleXmlElement e = it.next();
- if (e.getName().equalsIgnoreCase(tagName)) {
- it.remove();
- }
- }
- }
-
- public void removeAttribute(String name) {
- if (m_ignoreCase) {
- name = name.toUpperCase();
- }
- removeAttributeInternal(name);
- }
-
- protected SimpleXmlElement createAnotherElement() {
- return new SimpleXmlElement(null, m_ignoreWhitespace, m_ignoreCase);
- }
-
- public void setContent(String content) {
- m_contents = content;
- }
-
- public void setTagName(String name) {
- this.setName(name);
- }
-
- public void setName(String name) {
- m_name = name;
- }
-
- // important: make toString different if tags different
- @Override
- public String toString() {
- StringBuffer buf = new StringBuffer();
- buf.append("<");
- buf.append(getName());
- for (String key : m_attributeNames) {
- String val = "" + getAttributeInternal(key);
- buf.append(" ");
- buf.append(key + "=\"" + val + "\"");
- }
- buf.append("]");
- return buf.toString();
- }
-
- public void writeDocument(Writer w, String dtdName, String encoding) throws IOException {
- writeDocumentImpl(w, dtdName, encoding);
- }
-
- public void writeDocument(OutputStream out, String dtdName, String encoding) throws IOException {
- if (encoding != null) {
- writeDocumentImpl(new BufferedWriter(new OutputStreamWriter(out, encoding)), dtdName, encoding);
- }
- else {
- writeDocumentImpl(new BufferedWriter(new OutputStreamWriter(out)), dtdName, encoding);
- }
- }
-
- protected void writeDocumentImpl(Writer w, String dtdName, String encoding) throws IOException {
- try {
- if (encoding != null) {
- w.write("<?xml version=\"1.0\" encoding=\"" + encoding + "\"?>\n");
- }
- else {
- w.write("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n");
- }
- if (dtdName != null) {
- w.write("<!DOCTYPE app SYSTEM \"" + dtdName + "\">\n");
- }
- write(w, "");
- }
- finally {
- w.close();
- }
- }
-
- protected void write(Writer writer, String prefix) throws IOException {
- if (m_name == null) {
- this.writeEncoded(writer, m_contents);
- return;
- }
- writer.write(prefix + '<');
- writer.write(m_name);
- if (!m_attributeMap.isEmpty()) {
- for (String key : m_attributeNames) {
- String value = getAttributeInternal(key);
- if (value != null) {
- writer.write(' ');
- writer.write(key);
- writer.write('=');
- writer.write('"');
- this.writeEncoded(writer, value);
- writer.write('"');
- }
- }
- }
- if (!m_children.isEmpty()) {
- writer.write('>');
- writer.write("\n");
- Iterator<?> en = this.getChildren().iterator();
- while (en.hasNext()) {
- SimpleXmlElement child = (SimpleXmlElement) en.next();
- child.write(writer, prefix + " ");
- }
- writer.write(prefix + '<');
- writer.write('/');
- writer.write(m_name);
- writer.write('>');
- writer.write("\n");
- }
- else if ((m_contents != null) && (m_contents.length() > 0)) {
- writer.write('>');
- this.writeEncoded(writer, m_contents);
- writer.write('<');
- writer.write('/');
- writer.write(m_name);
- writer.write('>');
- writer.write("\n");
- }
- else {// this.children.isEmpty()
- writer.write('/');
- writer.write('>');
- writer.write("\n");
- }
- }
-
- protected void writeEncoded(Writer writer, String str) throws IOException {
- if (str == null) {
- return;
- }
- for (int i = 0; i < str.length(); i += 1) {
- String ch = "" + str.charAt(i);
- String escaped = INVERSE_ENTITIES.get(ch);
- if (escaped != null) {
- writer.write(escaped);
- }
- else {
- writer.write(ch);
- }
- }
- }
-
- protected void scanIdentifier(StringBuffer result) throws IOException {
- for (;;) {
- char ch = this.readChar();
- if (((ch < 'A') || (ch > 'Z')) && ((ch < 'a') || (ch > 'z')) && ((ch < '0') || (ch > '9')) && (ch != '_') && (ch != '.') && (ch != ':') && (ch != '-') && (ch <= '\u007E')) {
- this.unreadChar(ch);
- return;
- }
- result.append(ch);
- }
- }
-
- protected char scanWhitespace() throws IOException {
- for (;;) {
- char ch = this.readChar();
- switch (ch) {
- case ' ':
- case '\t':
- case '\n':
- case '\r':
- break;
- default:
- return ch;
- }
- }
- }
-
- protected char scanWhitespace(StringBuffer result) throws IOException {
- for (;;) {
- char ch = this.readChar();
- switch (ch) {
- case ' ':
- case '\t':
- case '\n':
- result.append(ch);
- case '\r':
- break;
- default:
- return ch;
- }
- }
- }
-
- protected void scanString(StringBuffer string) throws IOException {
- char delimiter = this.readChar();
- if ((delimiter != '\'') && (delimiter != '"')) {
- throw this.expectedInput("' or \"");
- }
- for (;;) {
- char ch = this.readChar();
- if (ch == delimiter) {
- return;
- }
- else if (ch == '&') {
- this.resolveEntity(string);
- }
- else {
- string.append(ch);
- }
- }
- }
-
- protected void scanPCData(StringBuffer data) throws IOException {
- for (;;) {
- char ch = this.readChar();
- if (ch == '<') {
- ch = this.readChar();
- if (ch == '!') {
- this.checkCDATA(data);
- }
- else {
- this.unreadChar(ch);
- return;
- }
- }
- else if (ch == '&') {
- this.resolveEntity(data);
- }
- else {
- data.append(ch);
- }
- }
- }
-
- protected boolean checkCDATA(StringBuffer buf) throws IOException {
- char ch = this.readChar();
- if (ch != '[') {
- this.unreadChar(ch);
- this.skipSpecialTag(0);
- return false;
- }
- else if (!this.checkLiteral("CDATA[")) {
- this.skipSpecialTag(1);
- // one [ has already been read
- return false;
- }
- else {
- int delimiterCharsSkipped = 0;
- while (delimiterCharsSkipped < 3) {
- ch = this.readChar();
- switch (ch) {
- case ']':
- if (delimiterCharsSkipped < 2) {
- delimiterCharsSkipped += 1;
- }
- else {// 2,3,...
- // delimiterCharsSkipped=delimiterCharsSkipped+1-1 add current [
- // and remove first [
- buf.append(']');// add first [ to buffer
- }
- break;
- case '>':
- if (delimiterCharsSkipped < 2) {
- for (int i = 0; i < delimiterCharsSkipped; i++) {
- buf.append(']');
- }
- delimiterCharsSkipped = 0;
- buf.append('>');
- }
- else {
- delimiterCharsSkipped = 3;
- }
- break;
- default:
- for (int i = 0; i < delimiterCharsSkipped; i += 1) {
- buf.append(']');
- }
- buf.append(ch);
- delimiterCharsSkipped = 0;
- }
- }
- return true;
- }
- }
-
- protected void skipComment() throws IOException {
- int dashesToRead = 2;
- while (dashesToRead > 0) {
- char ch = this.readChar();
- if (ch == '-') {
- dashesToRead -= 1;
- }
- else {
- dashesToRead = 2;
- }
- }
- if (this.readChar() != '>') {
- throw this.expectedInput(">");
- }
- }
-
- protected void skipSpecialTag(int bracketLevel) throws IOException {
- int tagLevel = 1;
- // <
- char stringDelimiter = '\0';
- if (bracketLevel == 0) {
- char ch = this.readChar();
- if (ch == '[') {
- bracketLevel += 1;
- }
- else if (ch == '-') {
- ch = this.readChar();
- if (ch == '[') {
- bracketLevel += 1;
- }
- else if (ch == ']') {
- bracketLevel -= 1;
- }
- else if (ch == '-') {
- this.skipComment();
- return;
- }
- }
- }
- while (tagLevel > 0) {
- char ch = this.readChar();
- if (stringDelimiter == '\0') {
- if ((ch == '"') || (ch == '\'')) {
- stringDelimiter = ch;
- }
- else if (bracketLevel <= 0) {
- if (ch == '<') {
- tagLevel += 1;
- }
- else if (ch == '>') {
- tagLevel -= 1;
- }
- }
- if (ch == '[') {
- bracketLevel += 1;
- }
- else if (ch == ']') {
- bracketLevel -= 1;
- }
- }
- else {
- if (ch == stringDelimiter) {
- stringDelimiter = '\0';
- }
- }
- }
- }
-
- protected boolean checkLiteral(String literal) throws IOException {
- int length = literal.length();
- for (int i = 0; i < length; i += 1) {
- if (this.readChar() != literal.charAt(i)) {
- return false;
- }
- }
- return true;
- }
-
- protected char readChar() throws IOException {
- if (m_charReadTooMuch != '\0') {
- char ch = m_charReadTooMuch;
- m_charReadTooMuch = '\0';
- return ch;
- }
- else {
- int i = m_reader.read();
- if (i < 0) {
- throw this.unexpectedEndOfData();
- }
- else if (i == 10) {
- m_parserLineNr += 1;
- return '\n';
- }
- else {
- return (char) i;
- }
- }
- }
-
- protected void scanElement(SimpleXmlElement elt) throws IOException {
- StringBuffer buf = new StringBuffer();
- this.scanIdentifier(buf);
- String eltName = buf.toString();
- elt.setName(eltName);
- char ch = this.scanWhitespace();
- while ((ch != '>') && (ch != '/')) {
- buf.setLength(0);
- this.unreadChar(ch);
- this.scanIdentifier(buf);
- String key = buf.toString();
- ch = this.scanWhitespace();
- if (ch != '=') {
- throw this.expectedInput("=");
- }
- this.unreadChar(this.scanWhitespace());
- buf.setLength(0);
- this.scanString(buf);
- elt.setAttribute(key, buf);
- ch = this.scanWhitespace();
- }
- if (ch == '/') {
- ch = this.readChar();
- if (ch != '>') {
- throw this.expectedInput(">");
- }
- return;
- }
- buf.setLength(0);
- ch = this.scanWhitespace(buf);
- if (ch != '<') {
- this.unreadChar(ch);
- this.scanPCData(buf);
- }
- else {
- for (;;) {
- ch = this.readChar();
- if (ch == '!') {
- if (this.checkCDATA(buf)) {
- this.scanPCData(buf);
- break;
- }
- else {
- ch = this.scanWhitespace(buf);
- if (ch != '<') {
- this.unreadChar(ch);
- this.scanPCData(buf);
- break;
- }
- }
- }
- else {
- if ((ch != '/') || m_ignoreWhitespace) {
- buf.setLength(0);
- }
- if (ch == '/') {
- this.unreadChar(ch);
- }
- break;
- }
- }
- }
- if (buf.length() == 0) {
- while (ch != '/') {
- if (ch == '!') {
- ch = this.readChar();
- if (ch != '-') {
- throw this.expectedInput("Comment or Element");
- }
- ch = this.readChar();
- if (ch != '-') {
- throw this.expectedInput("Comment or Element");
- }
- this.skipComment();
- }
- else {
- this.unreadChar(ch);
- SimpleXmlElement child = this.createAnotherElement();
- this.scanElement(child);
- elt.addChild(child);
- }
- ch = this.scanWhitespace();
- if (ch != '<') {
- throw this.expectedInput("<");
- }
- ch = this.readChar();
- }
- this.unreadChar(ch);
- }
- else {
- if (m_ignoreWhitespace) {
- elt.setContent(buf.toString().trim());
- }
- else {
- elt.setContent(buf.toString());
- }
- }
- ch = this.readChar();
- if (ch != '/') {
- throw this.expectedInput("/");
- }
- this.unreadChar(this.scanWhitespace());
- if (!this.checkLiteral(eltName)) {
- throw this.expectedInput(eltName);
- }
- if (this.scanWhitespace() != '>') {
- throw this.expectedInput(">");
- }
- }
-
- protected void resolveEntity(StringBuffer buf) throws IOException {
- char ch = '\0';
- StringBuffer keyBuf = new StringBuffer();
- for (;;) {
- ch = this.readChar();
- if (ch == ';') {
- break;
- }
- keyBuf.append(ch);
- }
- String key = keyBuf.toString();
- if (key.charAt(0) == '#') {
- try {
- if (key.charAt(1) == 'x') {
- ch = (char) Integer.parseInt(key.substring(2), 16);
- }
- else {
- ch = (char) Integer.parseInt(key.substring(1), 10);
- }
- }
- catch (NumberFormatException e) {
- throw this.unknownEntity(key);
- }
- buf.append(ch);
- }
- else {
- String value = ENTITIES.get(key);
- if (value == null) {
- System.out.println(getClass().getSimpleName() + ": unknownEntity " + key);
- value = "?";
- }
- buf.append(value);
- }
- }
-
- protected void unreadChar(char ch) {
- m_charReadTooMuch = ch;
- }
-
- protected IllegalArgumentException invalidValueSet(String name) {
- String msg = "Invalid value set (entity name = \"" + name + "\")";
- return new IllegalArgumentException(this.getName() + ": " + msg);
- }
-
- protected IllegalArgumentException invalidValue(String name, String value) {
- String msg = "Attribute \"" + name + "\" does not contain a valid " + "value (\"" + value + "\")";
- return new IllegalArgumentException(this.getName() + ": " + msg);
- }
-
- protected IOException unexpectedEndOfData() {
- String msg = "Unexpected end of data reached";
- return new IOException(this.getName() + ": " + msg);
- }
-
- protected IOException syntaxError(String context) {
- String msg = "Syntax error while parsing " + context;
- return new IOException(this.getName() + ": " + msg);
- }
-
- protected IOException expectedInput(String charSet) {
- String msg = "Expected: " + charSet;
- return new IOException(this.getName() + ": " + msg);
- }
-
- protected IOException unknownEntity(String name) {
- String msg = "Unknown or invalid entity: &" + name + ";";
- return new IOException(this.getName() + ": " + msg);
- }
-
- private void setAttributeInternal(String name, String val) {
- if (!m_attributeNames.contains(name)) {
- m_attributeNames.add(name);
- }
- m_attributeMap.put(name, val);
- }
-
- private String getAttributeInternal(String name) {
- return m_attributeMap.get(name);
- }
-
- private void removeAttributeInternal(String name) {
- m_attributeNames.remove(name);
- m_attributeMap.remove(name);
- }
-
- static {
- ENTITIES = new HashMap<String, String>();
- ENTITIES.put("amp", "&");
- ENTITIES.put("quot", "\"");
- ENTITIES.put("apos", "'");
- ENTITIES.put("lt", "<");
- ENTITIES.put("gt", ">");
- ENTITIES.put("auml", "ä");
- ENTITIES.put("ouml", "ö");
- ENTITIES.put("uuml", "ü");
- ENTITIES.put("Auml", "Ä");
- ENTITIES.put("Ouml", "Ö");
- ENTITIES.put("Uuml", "Ü");
- // reverse entities are used for exporting xml
- // normally ä,ö,ü are NOT excaped since encoding formats like ISO.. are used
- INVERSE_ENTITIES = new HashMap<String, String>();
- INVERSE_ENTITIES.put("&", "&amp;");
- INVERSE_ENTITIES.put("\"", "&quot;");
- INVERSE_ENTITIES.put("'", "&apos;");
- INVERSE_ENTITIES.put("<", "&lt;");
- INVERSE_ENTITIES.put(">", "&gt;");
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.xmlparser;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.CharArrayReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.ObjectOutputStream;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Reader;
+import java.io.StringReader;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.eclipse.scout.commons.Base64Utility;
+import org.eclipse.scout.commons.osgi.ContextFinderBasedObjectInputStream;
+
+/**
+ * Simple xml parser/writer. Very efficient and performant when handling xml
+ * content without care of namespaces.
+ */
+public class SimpleXmlElement {
+ private static final HashMap<String, String> ENTITIES;
+ private static final HashMap<String, String> INVERSE_ENTITIES;
+
+ private TreeMap<String, String> m_attributeMap;
+ private ArrayList<String> m_attributeNames;
+ private SimpleXmlElement m_parent;
+ private ArrayList<SimpleXmlElement> m_children;
+ private String m_name;
+ private String m_contents;
+ private int m_lineNr;
+ private char m_charReadTooMuch;
+ private Reader m_reader;
+ private int m_parserLineNr;
+ // flags
+ private boolean m_ignoreCase;
+ private boolean m_ignoreWhitespace;
+
+ public SimpleXmlElement() {
+ this((String) null);
+ }
+
+ public SimpleXmlElement(String name) {
+ this(name, false, false);
+ }
+
+ public SimpleXmlElement(String name, boolean ignoreWhiteSpace, boolean ignoreCase) {
+ m_name = name;
+ m_ignoreCase = ignoreCase;
+ m_ignoreWhitespace = ignoreWhiteSpace;
+ m_contents = "";
+ m_attributeMap = new TreeMap<String, String>();
+ m_attributeNames = new ArrayList<String>();
+ m_children = new ArrayList<SimpleXmlElement>();
+ m_lineNr = 0;
+ }
+
+ public SimpleXmlElement(SimpleXmlElement x) {
+ m_name = x.m_name;
+ m_ignoreCase = x.m_ignoreCase;
+ m_ignoreWhitespace = x.m_ignoreWhitespace;
+ m_contents = x.m_contents;
+ m_attributeMap = new TreeMap<String, String>(x.m_attributeMap);
+ m_attributeNames = new ArrayList<String>(x.m_attributeNames);
+ m_children = new ArrayList<SimpleXmlElement>();
+ m_lineNr = 0;
+ }
+
+ public void setIgnoreWhitespace(boolean b) {
+ m_ignoreWhitespace = b;
+ }
+
+ public boolean isIgnoreWhitespace() {
+ return m_ignoreWhitespace;
+ }
+
+ public void setIgnoreCase(boolean b) {
+ m_ignoreCase = b;
+ }
+
+ public boolean isIgnoreCase() {
+ return m_ignoreCase;
+ }
+
+ public void addChild(SimpleXmlElement child) {
+ if (child.m_parent != null) {
+ child.m_parent.removeChild(child);
+ }
+ m_children.add(child);
+ child.m_parent = this;
+ }
+
+ public void addChild(SimpleXmlElement child, int pos) {
+ m_children.add(pos, child);
+ child.m_parent = this;
+ }
+
+ public void replaceChild(SimpleXmlElement oldChild, SimpleXmlElement newChild) {
+ if (newChild == null) {
+ throw new IllegalArgumentException("newChild must not be null");
+ }
+ int index = m_children.indexOf(oldChild);
+ if (index < 0) {
+ throw new IllegalArgumentException("oldChild " + oldChild + " does not exist");
+ }
+ m_children.set(index, newChild);
+ newChild.m_parent = this;
+ oldChild.m_parent = null;
+ }
+
+ public void setAttribute(String name, Object value) {
+ if (m_ignoreCase) {
+ name = name.toUpperCase();
+ }
+ setAttributeInternal(name, value != null ? value.toString() : null);
+ }
+
+ public void setIntAttribute(String name, int value) {
+ if (m_ignoreCase) {
+ name = name.toUpperCase();
+ }
+ setAttributeInternal(name, Integer.toString(value));
+ }
+
+ public void setDoubleAttribute(String name, double value) {
+ if (m_ignoreCase) {
+ name = name.toUpperCase();
+ }
+ setAttributeInternal(name, Double.toString(value));
+ }
+
+ public int countChildren() {
+ return m_children.size();
+ }
+
+ public void clearAttributes() {
+ m_attributeMap.clear();
+ m_attributeNames.clear();
+ }
+
+ public void moveTo(int newIndex) {
+ if (m_parent != null) {
+ ArrayList<SimpleXmlElement> a = m_parent.m_children;
+ int i = a.indexOf(this);
+ if (i >= 0 && i != newIndex) {
+ newIndex = Math.min(Math.max(0, newIndex), a.size() - 1);
+ a.remove(i);
+ a.add(newIndex, this);
+ }
+ }
+ }
+
+ public int getIndex() {
+ if (m_parent != null) {
+ ArrayList<SimpleXmlElement> a = m_parent.m_children;
+ return a.indexOf(this);
+ }
+ return -1;
+ }
+
+ public ArrayList<String> getChildNames() {
+ ArrayList<String> a = new ArrayList<String>();
+ for (SimpleXmlElement e : getChildren()) {
+ a.add(e.getName());
+ }
+ return a;
+ }
+
+ public ArrayList<SimpleXmlElement> getChildren() {
+ return new ArrayList<SimpleXmlElement>(m_children);
+ }
+
+ public ArrayList<SimpleXmlElement> getChildren(String childrenName) {
+ ArrayList<SimpleXmlElement> a = new ArrayList<SimpleXmlElement>();
+ for (SimpleXmlElement c : m_children) {
+ if (c.getName().equalsIgnoreCase(childrenName)) {
+ a.add(c);
+ }
+ }
+ return a;
+ }
+
+ /**
+ * Returns an ArrayList with all children whose name matches the given regular
+ * expression.
+ */
+ public ArrayList<SimpleXmlElement> getChildrenRegEx(String childNameAsRegEx) {
+ ArrayList<SimpleXmlElement> selectedChildren = new ArrayList<SimpleXmlElement>();
+ for (SimpleXmlElement child : m_children) {
+ if (child.getName().matches(childNameAsRegEx)) {
+ selectedChildren.add(child);
+ }
+ }
+ return selectedChildren;
+ }
+
+ public SimpleXmlElement getChild(String name) {
+ for (SimpleXmlElement c : m_children) {
+ if (c.getName().equalsIgnoreCase(name)) {
+ return c;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the first child that matches the given regular expression or null
+ * if there's no match.
+ */
+ public SimpleXmlElement getChildRegEx(String childNameAsRegEx) {
+ Iterator<SimpleXmlElement> iterator = m_children.iterator();
+
+ while (iterator.hasNext()) {
+ SimpleXmlElement child = iterator.next();
+
+ if (child.getName().matches(childNameAsRegEx)) {
+ return child;
+ }
+ }
+
+ return null;
+ }
+
+ public String getContent() {
+ return m_contents;
+ }
+
+ public int getLineNr() {
+ return m_lineNr;
+ }
+
+ public Object getAttribute(String name) {
+ return this.getAttribute(name, null);
+ }
+
+ public boolean hasAttribute(String name) {
+ if (m_ignoreCase) {
+ name = name.toUpperCase();
+ }
+ return m_attributeMap.containsKey(name);
+ }
+
+ public Map<String, String> getAttributes() {
+ return new HashMap<String, String>(m_attributeMap);
+ }
+
+ /**
+ * Returns the first attribute that matches the given regular expression or
+ * null if there's no match.
+ */
+ public Object getAttributeRegEx(String attributeNameAsRegEx) {
+ Iterator<String> iterator = m_attributeMap.keySet().iterator();
+
+ while (iterator.hasNext()) {
+ String attributeName = iterator.next();
+
+ if (attributeName.matches(attributeNameAsRegEx)) {
+ return this.getAttribute(attributeName);
+ }
+ }
+
+ return null;
+ }
+
+ public Object getAttribute(String name, Object defaultValue) {
+ if (m_ignoreCase) {
+ name = name.toUpperCase();
+ }
+ Object value = getAttributeInternal(name);
+ if (value == null || ("" + value).length() == 0) {
+ value = defaultValue;
+ }
+ return value;
+ }
+
+ public Object getAttribute(String name, HashMap<Object, Object> valueSet, String defaultKey, boolean allowLiterals) {
+ if (m_ignoreCase) {
+ name = name.toUpperCase();
+ }
+ Object key = getAttributeInternal(name);
+ Object result;
+ if (key == null) {
+ key = defaultKey;
+ }
+ result = valueSet.get(key);
+ if (result == null) {
+ if (allowLiterals) {
+ result = key;
+ }
+ else {
+ throw this.invalidValue(name, (String) key);
+ }
+ }
+ return result;
+ }
+
+ public String getStringAttribute(String name) {
+ return this.getStringAttribute(name, null);
+ }
+
+ public String getStringAttribute(String name, String defaultValue) {
+ return (String) this.getAttribute(name, defaultValue);
+ }
+
+ public String getStringAttribute(String name, HashMap<Object, Object> valueSet, String defaultKey, boolean allowLiterals) {
+ return (String) this.getAttribute(name, valueSet, defaultKey, allowLiterals);
+ }
+
+ public int getIntAttribute(String name) {
+ return this.getIntAttribute(name, 0);
+ }
+
+ public int getIntAttribute(String name, int defaultValue) {
+ if (m_ignoreCase) {
+ name = name.toUpperCase();
+ }
+ String value = getAttributeInternal(name);
+ if (value == null) {
+ return defaultValue;
+ }
+ else {
+ try {
+ return Integer.parseInt(value);
+ }
+ catch (NumberFormatException e) {
+ throw this.invalidValue(name, value);
+ }
+ }
+ }
+
+ public Long getLongAttribute(String name) {
+ String value = getAttributeInternal(name);
+ if (value == null) {
+ return null;
+ }
+ else {
+ return new Long(Long.parseLong(value));
+ }
+ }
+
+ public Object getObjectAttribute(String name, Object defaultValue) throws IOException, ClassNotFoundException {
+ return getObjectAttribute(name, defaultValue, null);
+ }
+
+ /**
+ * @return a serialized object attribute from base64 serialized data using {@link ContextFinderBasedObjectInputStream}
+ * that tries
+ * to find the class using default osgi class loading and in a
+ * second stage using the caller classes class loaders.
+ */
+ public Object getObjectAttribute(String name, Object defaultValue, ClassLoader primaryLoader) throws IOException, ClassNotFoundException {
+ String base64 = getStringAttribute(name, "");
+ if (base64.length() <= 0) {
+ return defaultValue;
+ }
+ byte[] raw = Base64Utility.decode(base64);
+ ContextFinderBasedObjectInputStream oi = new ContextFinderBasedObjectInputStream(new ByteArrayInputStream(raw), primaryLoader);
+ Object o = oi.readObject();
+ if (o == null) {
+ o = defaultValue;
+ }
+ oi.close();
+ return o;
+ }
+
+ /**
+ * write a serialized object attribute
+ */
+ public void setObjectAttribute(String name, Object o) throws IOException {
+ ByteArrayOutputStream bout = new ByteArrayOutputStream();
+ ObjectOutputStream out = new ObjectOutputStream(bout);
+ out.writeObject(o);
+ out.close();
+ String base64 = Base64Utility.encode(bout.toByteArray()).trim();
+ this.setAttribute(name, base64);
+ }
+
+ public int getIntAttribute(String name, HashMap<Object, Integer> valueSet, String defaultKey, boolean allowLiteralNumbers) {
+ if (m_ignoreCase) {
+ name = name.toUpperCase();
+ }
+ Object key = getAttributeInternal(name);
+ Integer result;
+ if (key == null) {
+ key = defaultKey;
+ }
+ try {
+ result = valueSet.get(key);
+ }
+ catch (ClassCastException e) {
+ throw this.invalidValueSet(name);
+ }
+ if (result == null) {
+ if (!allowLiteralNumbers) {
+ throw this.invalidValue(name, (String) key);
+ }
+ try {
+ result = Integer.valueOf((String) key);
+ }
+ catch (NumberFormatException e) {
+ throw this.invalidValue(name, (String) key);
+ }
+ }
+ return result.intValue();
+ }
+
+ public double getDoubleAttribute(String name) {
+ return this.getDoubleAttribute(name, 0.0);
+ }
+
+ public double getDoubleAttribute(String name, double defaultValue) {
+ if (m_ignoreCase) {
+ name = name.toUpperCase();
+ }
+ String value = getAttributeInternal(name);
+ if (value == null) {
+ return defaultValue;
+ }
+ else {
+ try {
+ return Double.valueOf(value).doubleValue();
+ }
+ catch (NumberFormatException e) {
+ throw this.invalidValue(name, value);
+ }
+ }
+ }
+
+ public double getDoubleAttribute(String name, Map<Object, Double> valueSet, String defaultKey, boolean allowLiteralNumbers) {
+ if (m_ignoreCase) {
+ name = name.toUpperCase();
+ }
+ Object key = getAttributeInternal(name);
+ Double result;
+ if (key == null) {
+ key = defaultKey;
+ }
+ try {
+ result = valueSet.get(key);
+ }
+ catch (ClassCastException e) {
+ throw this.invalidValueSet(name);
+ }
+ if (result == null) {
+ if (!allowLiteralNumbers) {
+ throw this.invalidValue(name, (String) key);
+ }
+ try {
+ result = Double.valueOf((String) key);
+ }
+ catch (NumberFormatException e) {
+ throw this.invalidValue(name, (String) key);
+ }
+ }
+ return result.doubleValue();
+ }
+
+ public boolean getBooleanAttribute(String name, String trueValue, String falseValue, boolean defaultValue) {
+ if (m_ignoreCase) {
+ name = name.toUpperCase();
+ }
+ Object value = getAttributeInternal(name);
+ if (value == null) {
+ return defaultValue;
+ }
+ else if (value.equals(trueValue)) {
+ return true;
+ }
+ else if (value.equals(falseValue)) {
+ return false;
+ }
+ else {
+ throw this.invalidValue(name, (String) value);
+ }
+ }
+
+ public String getName() {
+ return m_name;
+ }
+
+ public String getTagName() {
+ return this.getName();
+ }
+
+ public void parseStream(InputStream in) throws IOException {
+ parseStream(in, 1);
+ }
+
+ public void parseStream(InputStream input, int startingLineNr) throws IOException {
+ parseStream(input, startingLineNr, true);
+ }
+
+ public void parseStream(InputStream input, int startingLineNr, boolean autoClose) throws IOException {
+ // check input encoding if present
+ removeChildren();
+ BufferedInputStream bin;
+ if (input instanceof BufferedInputStream) {
+ bin = (BufferedInputStream) input;
+ }
+ else {
+ bin = new BufferedInputStream(input);
+ }
+ bin.mark(1024);
+ BufferedReader encodedReader = null;
+ int ch = bin.read();
+ while (ch >= 0 && (ch == '\n' || ch == '\t' || ch == ' ' || ch == '\r')) {
+ ch = bin.read();
+ }
+ if (ch == '<') {
+ ch = bin.read();
+ if (ch == '?') {
+ StringBuffer buf = new StringBuffer("<?");
+ ch = bin.read();
+ while (ch >= 0 && ch != '?') {
+ buf.append((char) ch);
+ ch = bin.read();
+ }
+ if (ch == '?') {
+ buf.append((char) ch);
+ }
+ ch = bin.read();
+ if (ch == '>') {
+ buf.append((char) ch);
+ }
+ String xmlLine = buf.toString();
+ int k = xmlLine.indexOf("encoding");
+ if (k >= 0) {
+ k = xmlLine.indexOf('=', k);
+ if (k >= 0) {
+ k = xmlLine.indexOf('"', k);
+ if (k >= 0) {
+ int m = xmlLine.indexOf('"', k + 1);
+ if (m >= 0) {
+ String encoding = xmlLine.substring(k + 1, m);
+ // replace input reader
+ bin.reset();
+ encodedReader = new BufferedReader(new InputStreamReader(bin, encoding));
+ }
+ }
+ }
+ }
+ }
+ }
+ // do not close bin
+ if (encodedReader == null) {
+ bin.reset();
+ encodedReader = new BufferedReader(new InputStreamReader(bin));
+ }
+ try {
+ parseImpl(encodedReader, 1);
+ }
+ finally {
+ if (autoClose) {
+ encodedReader.close();
+ }
+ }
+ }
+
+ protected void parseImpl(Reader r, int startingLineNr) throws IOException {
+ m_name = null;
+ m_contents = "";
+ m_attributeMap = new TreeMap<String, String>();
+ m_attributeNames = new ArrayList<String>();
+ m_children = new ArrayList<SimpleXmlElement>();
+ m_charReadTooMuch = '\0';
+ m_reader = r;
+ m_parserLineNr = startingLineNr;
+
+ for (;;) {
+ char ch = this.scanWhitespace();
+
+ if (ch != '<') {
+ throw this.expectedInput("<");
+ }
+
+ ch = this.readChar();
+
+ if ((ch == '!') || (ch == '?')) {
+ this.skipSpecialTag(0);
+ }
+ else {
+ this.unreadChar(ch);
+ this.scanElement(this);
+ return;
+ }
+ }
+ }
+
+ public void parseReader(Reader r) throws IOException {
+ parseImpl(r, 1);
+ }
+
+ public void parseString(String string) {
+ try {
+ this.parseImpl(new StringReader(string), 1);
+ }
+ catch (IOException e) {
+ /* nop */
+ }
+ }
+
+ public void parseString(String string, int offset) {
+ this.parseString(string.substring(offset));
+ }
+
+ public void parseString(String string, int offset, int end) {
+ this.parseString(string.substring(offset, end));
+ }
+
+ public void parseString(String string, int offset, int end, int startingLineNr) {
+ string = string.substring(offset, end);
+ try {
+ this.parseImpl(new StringReader(string), startingLineNr);
+ }
+ catch (IOException e) {
+ // Java exception handling suxx
+ }
+ }
+
+ public void parseCharArray(char[] input, int offset, int end) {
+ this.parseCharArray(input, offset, end, 1);
+ }
+
+ public void parseCharArray(char[] input, int offset, int end, int startingLineNr) {
+ try {
+ Reader reader = new CharArrayReader(input, offset, end);
+ parseImpl(reader, startingLineNr);
+ }
+ catch (IOException e) {
+ // This exception will never happen.
+ }
+ }
+
+ public SimpleXmlElement getParent() {
+ return m_parent;
+ }
+
+ public boolean isAncestorOf(SimpleXmlElement child) {
+ SimpleXmlElement e = child;
+ while (e != null) {
+ if (e == this) {
+ return true;
+ }
+ e = e.getParent();
+ }
+ return false;
+ }
+
+ public SimpleXmlElement getRoot() {
+ if (m_parent == null) {
+ return this;
+ }
+ else {
+ return m_parent.getRoot();
+ }
+ }
+
+ public void removeChild(SimpleXmlElement child) {
+ m_children.remove(child);
+ child.m_parent = null;
+ }
+
+ public void removeChildren() {
+ m_children.clear();
+ }
+
+ public void removeChildren(String tagName) {
+ for (Iterator<SimpleXmlElement> it = m_children.iterator(); it.hasNext();) {
+ SimpleXmlElement e = it.next();
+ if (e.getName().equalsIgnoreCase(tagName)) {
+ it.remove();
+ }
+ }
+ }
+
+ public void removeAttribute(String name) {
+ if (m_ignoreCase) {
+ name = name.toUpperCase();
+ }
+ removeAttributeInternal(name);
+ }
+
+ protected SimpleXmlElement createAnotherElement() {
+ return new SimpleXmlElement(null, m_ignoreWhitespace, m_ignoreCase);
+ }
+
+ public void setContent(String content) {
+ m_contents = content;
+ }
+
+ public void setTagName(String name) {
+ this.setName(name);
+ }
+
+ public void setName(String name) {
+ m_name = name;
+ }
+
+ // important: make toString different if tags different
+ @Override
+ public String toString() {
+ StringBuffer buf = new StringBuffer();
+ buf.append("<");
+ buf.append(getName());
+ for (String key : m_attributeNames) {
+ String val = "" + getAttributeInternal(key);
+ buf.append(" ");
+ buf.append(key + "=\"" + val + "\"");
+ }
+ buf.append("]");
+ return buf.toString();
+ }
+
+ public void writeDocument(Writer w, String dtdName, String encoding) throws IOException {
+ writeDocumentImpl(w, dtdName, encoding);
+ }
+
+ public void writeDocument(OutputStream out, String dtdName, String encoding) throws IOException {
+ if (encoding != null) {
+ writeDocumentImpl(new BufferedWriter(new OutputStreamWriter(out, encoding)), dtdName, encoding);
+ }
+ else {
+ writeDocumentImpl(new BufferedWriter(new OutputStreamWriter(out)), dtdName, encoding);
+ }
+ }
+
+ protected void writeDocumentImpl(Writer w, String dtdName, String encoding) throws IOException {
+ try {
+ if (encoding != null) {
+ w.write("<?xml version=\"1.0\" encoding=\"" + encoding + "\"?>\n");
+ }
+ else {
+ w.write("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n");
+ }
+ if (dtdName != null) {
+ w.write("<!DOCTYPE app SYSTEM \"" + dtdName + "\">\n");
+ }
+ write(w, "");
+ }
+ finally {
+ w.close();
+ }
+ }
+
+ protected void write(Writer writer, String prefix) throws IOException {
+ if (m_name == null) {
+ this.writeEncoded(writer, m_contents);
+ return;
+ }
+ writer.write(prefix + '<');
+ writer.write(m_name);
+ if (!m_attributeMap.isEmpty()) {
+ for (String key : m_attributeNames) {
+ String value = getAttributeInternal(key);
+ if (value != null) {
+ writer.write(' ');
+ writer.write(key);
+ writer.write('=');
+ writer.write('"');
+ this.writeEncoded(writer, value);
+ writer.write('"');
+ }
+ }
+ }
+ if (!m_children.isEmpty()) {
+ writer.write('>');
+ writer.write("\n");
+ Iterator<?> en = this.getChildren().iterator();
+ while (en.hasNext()) {
+ SimpleXmlElement child = (SimpleXmlElement) en.next();
+ child.write(writer, prefix + " ");
+ }
+ writer.write(prefix + '<');
+ writer.write('/');
+ writer.write(m_name);
+ writer.write('>');
+ writer.write("\n");
+ }
+ else if ((m_contents != null) && (m_contents.length() > 0)) {
+ writer.write('>');
+ this.writeEncoded(writer, m_contents);
+ writer.write('<');
+ writer.write('/');
+ writer.write(m_name);
+ writer.write('>');
+ writer.write("\n");
+ }
+ else {// this.children.isEmpty()
+ writer.write('/');
+ writer.write('>');
+ writer.write("\n");
+ }
+ }
+
+ protected void writeEncoded(Writer writer, String str) throws IOException {
+ if (str == null) {
+ return;
+ }
+ for (int i = 0; i < str.length(); i += 1) {
+ String ch = "" + str.charAt(i);
+ String escaped = INVERSE_ENTITIES.get(ch);
+ if (escaped != null) {
+ writer.write(escaped);
+ }
+ else {
+ writer.write(ch);
+ }
+ }
+ }
+
+ protected void scanIdentifier(StringBuffer result) throws IOException {
+ for (;;) {
+ char ch = this.readChar();
+ if (((ch < 'A') || (ch > 'Z')) && ((ch < 'a') || (ch > 'z')) && ((ch < '0') || (ch > '9')) && (ch != '_') && (ch != '.') && (ch != ':') && (ch != '-') && (ch <= '\u007E')) {
+ this.unreadChar(ch);
+ return;
+ }
+ result.append(ch);
+ }
+ }
+
+ protected char scanWhitespace() throws IOException {
+ for (;;) {
+ char ch = this.readChar();
+ switch (ch) {
+ case ' ':
+ case '\t':
+ case '\n':
+ case '\r':
+ break;
+ default:
+ return ch;
+ }
+ }
+ }
+
+ protected char scanWhitespace(StringBuffer result) throws IOException {
+ for (;;) {
+ char ch = this.readChar();
+ switch (ch) {
+ case ' ':
+ case '\t':
+ case '\n':
+ result.append(ch);
+ case '\r':
+ break;
+ default:
+ return ch;
+ }
+ }
+ }
+
+ protected void scanString(StringBuffer string) throws IOException {
+ char delimiter = this.readChar();
+ if ((delimiter != '\'') && (delimiter != '"')) {
+ throw this.expectedInput("' or \"");
+ }
+ for (;;) {
+ char ch = this.readChar();
+ if (ch == delimiter) {
+ return;
+ }
+ else if (ch == '&') {
+ this.resolveEntity(string);
+ }
+ else {
+ string.append(ch);
+ }
+ }
+ }
+
+ protected void scanPCData(StringBuffer data) throws IOException {
+ for (;;) {
+ char ch = this.readChar();
+ if (ch == '<') {
+ ch = this.readChar();
+ if (ch == '!') {
+ this.checkCDATA(data);
+ }
+ else {
+ this.unreadChar(ch);
+ return;
+ }
+ }
+ else if (ch == '&') {
+ this.resolveEntity(data);
+ }
+ else {
+ data.append(ch);
+ }
+ }
+ }
+
+ protected boolean checkCDATA(StringBuffer buf) throws IOException {
+ char ch = this.readChar();
+ if (ch != '[') {
+ this.unreadChar(ch);
+ this.skipSpecialTag(0);
+ return false;
+ }
+ else if (!this.checkLiteral("CDATA[")) {
+ this.skipSpecialTag(1);
+ // one [ has already been read
+ return false;
+ }
+ else {
+ int delimiterCharsSkipped = 0;
+ while (delimiterCharsSkipped < 3) {
+ ch = this.readChar();
+ switch (ch) {
+ case ']':
+ if (delimiterCharsSkipped < 2) {
+ delimiterCharsSkipped += 1;
+ }
+ else {// 2,3,...
+ // delimiterCharsSkipped=delimiterCharsSkipped+1-1 add current [
+ // and remove first [
+ buf.append(']');// add first [ to buffer
+ }
+ break;
+ case '>':
+ if (delimiterCharsSkipped < 2) {
+ for (int i = 0; i < delimiterCharsSkipped; i++) {
+ buf.append(']');
+ }
+ delimiterCharsSkipped = 0;
+ buf.append('>');
+ }
+ else {
+ delimiterCharsSkipped = 3;
+ }
+ break;
+ default:
+ for (int i = 0; i < delimiterCharsSkipped; i += 1) {
+ buf.append(']');
+ }
+ buf.append(ch);
+ delimiterCharsSkipped = 0;
+ }
+ }
+ return true;
+ }
+ }
+
+ protected void skipComment() throws IOException {
+ int dashesToRead = 2;
+ while (dashesToRead > 0) {
+ char ch = this.readChar();
+ if (ch == '-') {
+ dashesToRead -= 1;
+ }
+ else {
+ dashesToRead = 2;
+ }
+ }
+ if (this.readChar() != '>') {
+ throw this.expectedInput(">");
+ }
+ }
+
+ protected void skipSpecialTag(int bracketLevel) throws IOException {
+ int tagLevel = 1;
+ // <
+ char stringDelimiter = '\0';
+ if (bracketLevel == 0) {
+ char ch = this.readChar();
+ if (ch == '[') {
+ bracketLevel += 1;
+ }
+ else if (ch == '-') {
+ ch = this.readChar();
+ if (ch == '[') {
+ bracketLevel += 1;
+ }
+ else if (ch == ']') {
+ bracketLevel -= 1;
+ }
+ else if (ch == '-') {
+ this.skipComment();
+ return;
+ }
+ }
+ }
+ while (tagLevel > 0) {
+ char ch = this.readChar();
+ if (stringDelimiter == '\0') {
+ if ((ch == '"') || (ch == '\'')) {
+ stringDelimiter = ch;
+ }
+ else if (bracketLevel <= 0) {
+ if (ch == '<') {
+ tagLevel += 1;
+ }
+ else if (ch == '>') {
+ tagLevel -= 1;
+ }
+ }
+ if (ch == '[') {
+ bracketLevel += 1;
+ }
+ else if (ch == ']') {
+ bracketLevel -= 1;
+ }
+ }
+ else {
+ if (ch == stringDelimiter) {
+ stringDelimiter = '\0';
+ }
+ }
+ }
+ }
+
+ protected boolean checkLiteral(String literal) throws IOException {
+ int length = literal.length();
+ for (int i = 0; i < length; i += 1) {
+ if (this.readChar() != literal.charAt(i)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ protected char readChar() throws IOException {
+ if (m_charReadTooMuch != '\0') {
+ char ch = m_charReadTooMuch;
+ m_charReadTooMuch = '\0';
+ return ch;
+ }
+ else {
+ int i = m_reader.read();
+ if (i < 0) {
+ throw this.unexpectedEndOfData();
+ }
+ else if (i == 10) {
+ m_parserLineNr += 1;
+ return '\n';
+ }
+ else {
+ return (char) i;
+ }
+ }
+ }
+
+ protected void scanElement(SimpleXmlElement elt) throws IOException {
+ StringBuffer buf = new StringBuffer();
+ this.scanIdentifier(buf);
+ String eltName = buf.toString();
+ elt.setName(eltName);
+ char ch = this.scanWhitespace();
+ while ((ch != '>') && (ch != '/')) {
+ buf.setLength(0);
+ this.unreadChar(ch);
+ this.scanIdentifier(buf);
+ String key = buf.toString();
+ ch = this.scanWhitespace();
+ if (ch != '=') {
+ throw this.expectedInput("=");
+ }
+ this.unreadChar(this.scanWhitespace());
+ buf.setLength(0);
+ this.scanString(buf);
+ elt.setAttribute(key, buf);
+ ch = this.scanWhitespace();
+ }
+ if (ch == '/') {
+ ch = this.readChar();
+ if (ch != '>') {
+ throw this.expectedInput(">");
+ }
+ return;
+ }
+ buf.setLength(0);
+ ch = this.scanWhitespace(buf);
+ if (ch != '<') {
+ this.unreadChar(ch);
+ this.scanPCData(buf);
+ }
+ else {
+ for (;;) {
+ ch = this.readChar();
+ if (ch == '!') {
+ if (this.checkCDATA(buf)) {
+ this.scanPCData(buf);
+ break;
+ }
+ else {
+ ch = this.scanWhitespace(buf);
+ if (ch != '<') {
+ this.unreadChar(ch);
+ this.scanPCData(buf);
+ break;
+ }
+ }
+ }
+ else {
+ if ((ch != '/') || m_ignoreWhitespace) {
+ buf.setLength(0);
+ }
+ if (ch == '/') {
+ this.unreadChar(ch);
+ }
+ break;
+ }
+ }
+ }
+ if (buf.length() == 0) {
+ while (ch != '/') {
+ if (ch == '!') {
+ ch = this.readChar();
+ if (ch != '-') {
+ throw this.expectedInput("Comment or Element");
+ }
+ ch = this.readChar();
+ if (ch != '-') {
+ throw this.expectedInput("Comment or Element");
+ }
+ this.skipComment();
+ }
+ else {
+ this.unreadChar(ch);
+ SimpleXmlElement child = this.createAnotherElement();
+ this.scanElement(child);
+ elt.addChild(child);
+ }
+ ch = this.scanWhitespace();
+ if (ch != '<') {
+ throw this.expectedInput("<");
+ }
+ ch = this.readChar();
+ }
+ this.unreadChar(ch);
+ }
+ else {
+ if (m_ignoreWhitespace) {
+ elt.setContent(buf.toString().trim());
+ }
+ else {
+ elt.setContent(buf.toString());
+ }
+ }
+ ch = this.readChar();
+ if (ch != '/') {
+ throw this.expectedInput("/");
+ }
+ this.unreadChar(this.scanWhitespace());
+ if (!this.checkLiteral(eltName)) {
+ throw this.expectedInput(eltName);
+ }
+ if (this.scanWhitespace() != '>') {
+ throw this.expectedInput(">");
+ }
+ }
+
+ protected void resolveEntity(StringBuffer buf) throws IOException {
+ char ch = '\0';
+ StringBuffer keyBuf = new StringBuffer();
+ for (;;) {
+ ch = this.readChar();
+ if (ch == ';') {
+ break;
+ }
+ keyBuf.append(ch);
+ }
+ String key = keyBuf.toString();
+ if (key.charAt(0) == '#') {
+ try {
+ if (key.charAt(1) == 'x') {
+ ch = (char) Integer.parseInt(key.substring(2), 16);
+ }
+ else {
+ ch = (char) Integer.parseInt(key.substring(1), 10);
+ }
+ }
+ catch (NumberFormatException e) {
+ throw this.unknownEntity(key);
+ }
+ buf.append(ch);
+ }
+ else {
+ String value = ENTITIES.get(key);
+ if (value == null) {
+ System.out.println(getClass().getSimpleName() + ": unknownEntity " + key);
+ value = "?";
+ }
+ buf.append(value);
+ }
+ }
+
+ protected void unreadChar(char ch) {
+ m_charReadTooMuch = ch;
+ }
+
+ protected IllegalArgumentException invalidValueSet(String name) {
+ String msg = "Invalid value set (entity name = \"" + name + "\")";
+ return new IllegalArgumentException(this.getName() + ": " + msg);
+ }
+
+ protected IllegalArgumentException invalidValue(String name, String value) {
+ String msg = "Attribute \"" + name + "\" does not contain a valid " + "value (\"" + value + "\")";
+ return new IllegalArgumentException(this.getName() + ": " + msg);
+ }
+
+ protected IOException unexpectedEndOfData() {
+ String msg = "Unexpected end of data reached";
+ return new IOException(this.getName() + ": " + msg);
+ }
+
+ protected IOException syntaxError(String context) {
+ String msg = "Syntax error while parsing " + context;
+ return new IOException(this.getName() + ": " + msg);
+ }
+
+ protected IOException expectedInput(String charSet) {
+ String msg = "Expected: " + charSet;
+ return new IOException(this.getName() + ": " + msg);
+ }
+
+ protected IOException unknownEntity(String name) {
+ String msg = "Unknown or invalid entity: &" + name + ";";
+ return new IOException(this.getName() + ": " + msg);
+ }
+
+ private void setAttributeInternal(String name, String val) {
+ if (!m_attributeNames.contains(name)) {
+ m_attributeNames.add(name);
+ }
+ m_attributeMap.put(name, val);
+ }
+
+ private String getAttributeInternal(String name) {
+ return m_attributeMap.get(name);
+ }
+
+ private void removeAttributeInternal(String name) {
+ m_attributeNames.remove(name);
+ m_attributeMap.remove(name);
+ }
+
+ static {
+ ENTITIES = new HashMap<String, String>();
+ ENTITIES.put("amp", "&");
+ ENTITIES.put("quot", "\"");
+ ENTITIES.put("apos", "'");
+ ENTITIES.put("lt", "<");
+ ENTITIES.put("gt", ">");
+ ENTITIES.put("auml", "ä");
+ ENTITIES.put("ouml", "ö");
+ ENTITIES.put("uuml", "ü");
+ ENTITIES.put("Auml", "Ä");
+ ENTITIES.put("Ouml", "Ö");
+ ENTITIES.put("Uuml", "Ü");
+ // reverse entities are used for exporting xml
+ // normally ä,ö,ü are NOT excaped since encoding formats like ISO.. are used
+ INVERSE_ENTITIES = new HashMap<String, String>();
+ INVERSE_ENTITIES.put("&", "&amp;");
+ INVERSE_ENTITIES.put("\"", "&quot;");
+ INVERSE_ENTITIES.put("'", "&apos;");
+ INVERSE_ENTITIES.put("<", "&lt;");
+ INVERSE_ENTITIES.put(">", "&gt;");
+ }
+}
diff --git a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/xmlparser/internal/TestScoutXml.java b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/xmlparser/internal/TestScoutXml.java
index 2f64d71f25..9abfb33f3e 100644
--- a/org.eclipse.scout.commons/src/org/eclipse/scout/commons/xmlparser/internal/TestScoutXml.java
+++ b/org.eclipse.scout.commons/src/org/eclipse/scout/commons/xmlparser/internal/TestScoutXml.java
@@ -1,160 +1,160 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.commons.xmlparser.internal;
-
-import java.io.File;
-import java.io.FileInputStream;
-
-import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument;
-import org.eclipse.scout.commons.xmlparser.ScoutXmlParser;
-
-public final class TestScoutXml {
- private ScoutXmlDocument testDocument1;
- private ScoutXmlDocument testDocument2;
-
- private TestScoutXml() {
- testDocument1 = new ScoutXmlDocument(
- "<library>" +
- " <name>Book Library</name>" +
- " <books>" +
- " <book>" +
- " <title>XML in a Nutshell</title>" +
- " <year>2004</year>" +
- " <author>" +
- " <forename>Elliotte Rusty, W.Scott Means</forename>" +
- " <lastname>Harold</lastname>" +
- " </author>" +
- " <author>" +
- " <forename>W.Scott</forename>" +
- " <lastname>Means</lastname>" +
- " </author>" +
- " <publisher>O'Reilly</publisher>" +
- " </book>" +
- " </books>" +
- "</library>"
- );
- testDocument2 = new ScoutXmlDocument(
- "<root a1='text' a2='7' a3='7.1' a4='true' a5='2006.01.13' a6=''/>"
- );
- }
-
- public void testErrorHandling() {
- // System.out.println("\n--- Test error handling --------------------------------------------------------------------\n");
-
- try {
- testDocument2.getRoot().getAttribute("a0");
- }
- catch (Exception exception) {
- System.out.println("Error handling test: " + exception);
- }
-
- try {
- testDocument2.getRoot().getAttributeAsInt("a0");
- }
- catch (Exception exception) {
- System.out.println("Error handling test: " + exception);
- }
-
- try {
- testDocument2.getRoot().getAttributeAsInt("a1");
- }
- catch (Exception exception) {
- System.out.println("Error handling test: " + exception);
- }
- }
-
- private void testFileParsingWriting(String readDirectory, String writeDirectory) throws Exception {
- File[] files = new File(readDirectory).listFiles();
-
- for (int i = 0; (i < files.length); i++) {
- ScoutXmlParser parser = new ScoutXmlParser();
- parser.setValidating(false);
- parser.setIgnoreSaxErrors(false);
- parser.setIgnoreExternalEntities(true);
- ScoutXmlDocument document = null;
-
- if (files[i].getName().endsWith("dtd")) {
- continue;
- }
- if (readDirectory != null) {
- System.out.println();
- System.out.println("- Reading '" + files[i].getName() + "'...");
-
- document = parser.parse(new FileInputStream(files[i]), readDirectory);
- // document = parser.parse(files[i].getAbsolutePath());
- // System.out.println(" " + (document.getRoot().countDescendants() +
- // 1) + " element(s) read in " + (System.currentTimeMillis() -
- // timeR)/1000 + " second(s).");
- }
-
- if (writeDirectory != null && document != null) {
- System.out.println();
- long timeW = System.currentTimeMillis();
- System.out.println("- Writing '" + files[i].getName() + "'...");
- document.write(new File(writeDirectory + "\\" + files[i].getName()));
- System.out.println(" Done in " + (System.currentTimeMillis() - timeW) / 1000 + " second(s).");
- }
-
- // System.out.println();
- // System.out.println(document.toPrettyString());
- // System.out.println();
- }
- }
-
- public void testMixedContent() {
- // System.out.println("\n--- Test mixed content ---------------------------------------------------------------------\n");
-
- String test = "<a>t1<b>t21<c>t4</c>t22</b>t3</a>";
-
- ScoutXmlDocument document = new ScoutXmlDocument(test);
- document.setPrettyPrint(false);
-
- System.out.println("Mixed content test successful:\t" + document.equalsSemantically(test));
- }
-
- private void testModifying() {
- // System.out.println("\n--- Test document modifying ----------------------------------------------------------------\n");
-
- new ScoutXmlDocument("<data><table/></data>").getChild("data").addChild("row").addText("2006.10");
-
- ScoutXmlDocument doc1 = new ScoutXmlDocument("<A>x</A>");
- ScoutXmlDocument doc2 = new ScoutXmlDocument("<B>y</B>");
- doc1.getRoot().addChild(doc2.getRoot());
- doc1.getRoot().addText("z");
- doc1.getRoot().addChild("C1");
- doc1.getRoot().addChild("C2");
- doc1.getRoot().removeChild("C1");
-
- System.out.println("Document modifying successful:\t" + doc1.equalsSemantically("<A>x<B>y</B>z<C2/></A>"));
- }
-
- private void testVarious() {
- // System.out.println("\n--- Test Various ---------------------------------------------------------------------------\n");
-
- new ScoutXmlDocument().toString();
- new ScoutXmlDocument("").toString();
-
- System.out.println("Various testing successful:\t" + new ScoutXmlDocument("<x/>").equalsSemantically("<x/>"));
- }
-
- public static void main(String[] args) throws Exception {
- TestScoutXml xmlTest = new TestScoutXml();
-
- xmlTest.testMixedContent();
- xmlTest.testModifying();
- xmlTest.testVarious();
-
- // xmlTest.testErrorHandling();
-
- // xmlTest.testFileParsingWriting("C:\\Development\\Projects\\ScoutXml\\Test\\Originals",
- // "C:\\Development\\Projects\\ScoutXml\\Test\\Written by ScoutXml");
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.commons.xmlparser.internal;
+
+import java.io.File;
+import java.io.FileInputStream;
+
+import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument;
+import org.eclipse.scout.commons.xmlparser.ScoutXmlParser;
+
+public final class TestScoutXml {
+ private ScoutXmlDocument testDocument1;
+ private ScoutXmlDocument testDocument2;
+
+ private TestScoutXml() {
+ testDocument1 = new ScoutXmlDocument(
+ "<library>" +
+ " <name>Book Library</name>" +
+ " <books>" +
+ " <book>" +
+ " <title>XML in a Nutshell</title>" +
+ " <year>2004</year>" +
+ " <author>" +
+ " <forename>Elliotte Rusty, W.Scott Means</forename>" +
+ " <lastname>Harold</lastname>" +
+ " </author>" +
+ " <author>" +
+ " <forename>W.Scott</forename>" +
+ " <lastname>Means</lastname>" +
+ " </author>" +
+ " <publisher>O'Reilly</publisher>" +
+ " </book>" +
+ " </books>" +
+ "</library>"
+ );
+ testDocument2 = new ScoutXmlDocument(
+ "<root a1='text' a2='7' a3='7.1' a4='true' a5='2006.01.13' a6=''/>"
+ );
+ }
+
+ public void testErrorHandling() {
+ // System.out.println("\n--- Test error handling --------------------------------------------------------------------\n");
+
+ try {
+ testDocument2.getRoot().getAttribute("a0");
+ }
+ catch (Exception exception) {
+ System.out.println("Error handling test: " + exception);
+ }
+
+ try {
+ testDocument2.getRoot().getAttributeAsInt("a0");
+ }
+ catch (Exception exception) {
+ System.out.println("Error handling test: " + exception);
+ }
+
+ try {
+ testDocument2.getRoot().getAttributeAsInt("a1");
+ }
+ catch (Exception exception) {
+ System.out.println("Error handling test: " + exception);
+ }
+ }
+
+ private void testFileParsingWriting(String readDirectory, String writeDirectory) throws Exception {
+ File[] files = new File(readDirectory).listFiles();
+
+ for (int i = 0; (i < files.length); i++) {
+ ScoutXmlParser parser = new ScoutXmlParser();
+ parser.setValidating(false);
+ parser.setIgnoreSaxErrors(false);
+ parser.setIgnoreExternalEntities(true);
+ ScoutXmlDocument document = null;
+
+ if (files[i].getName().endsWith("dtd")) {
+ continue;
+ }
+ if (readDirectory != null) {
+ System.out.println();
+ System.out.println("- Reading '" + files[i].getName() + "'...");
+
+ document = parser.parse(new FileInputStream(files[i]), readDirectory);
+ // document = parser.parse(files[i].getAbsolutePath());
+ // System.out.println(" " + (document.getRoot().countDescendants() +
+ // 1) + " element(s) read in " + (System.currentTimeMillis() -
+ // timeR)/1000 + " second(s).");
+ }
+
+ if (writeDirectory != null && document != null) {
+ System.out.println();
+ long timeW = System.currentTimeMillis();
+ System.out.println("- Writing '" + files[i].getName() + "'...");
+ document.write(new File(writeDirectory + "\\" + files[i].getName()));
+ System.out.println(" Done in " + (System.currentTimeMillis() - timeW) / 1000 + " second(s).");
+ }
+
+ // System.out.println();
+ // System.out.println(document.toPrettyString());
+ // System.out.println();
+ }
+ }
+
+ public void testMixedContent() {
+ // System.out.println("\n--- Test mixed content ---------------------------------------------------------------------\n");
+
+ String test = "<a>t1<b>t21<c>t4</c>t22</b>t3</a>";
+
+ ScoutXmlDocument document = new ScoutXmlDocument(test);
+ document.setPrettyPrint(false);
+
+ System.out.println("Mixed content test successful:\t" + document.equalsSemantically(test));
+ }
+
+ private void testModifying() {
+ // System.out.println("\n--- Test document modifying ----------------------------------------------------------------\n");
+
+ new ScoutXmlDocument("<data><table/></data>").getChild("data").addChild("row").addText("2006.10");
+
+ ScoutXmlDocument doc1 = new ScoutXmlDocument("<A>x</A>");
+ ScoutXmlDocument doc2 = new ScoutXmlDocument("<B>y</B>");
+ doc1.getRoot().addChild(doc2.getRoot());
+ doc1.getRoot().addText("z");
+ doc1.getRoot().addChild("C1");
+ doc1.getRoot().addChild("C2");
+ doc1.getRoot().removeChild("C1");
+
+ System.out.println("Document modifying successful:\t" + doc1.equalsSemantically("<A>x<B>y</B>z<C2/></A>"));
+ }
+
+ private void testVarious() {
+ // System.out.println("\n--- Test Various ---------------------------------------------------------------------------\n");
+
+ new ScoutXmlDocument().toString();
+ new ScoutXmlDocument("").toString();
+
+ System.out.println("Various testing successful:\t" + new ScoutXmlDocument("<x/>").equalsSemantically("<x/>"));
+ }
+
+ public static void main(String[] args) throws Exception {
+ TestScoutXml xmlTest = new TestScoutXml();
+
+ xmlTest.testMixedContent();
+ xmlTest.testModifying();
+ xmlTest.testVarious();
+
+ // xmlTest.testErrorHandling();
+
+ // xmlTest.testFileParsingWriting("C:\\Development\\Projects\\ScoutXml\\Test\\Originals",
+ // "C:\\Development\\Projects\\ScoutXml\\Test\\Written by ScoutXml");
+ }
+}
diff --git a/org.eclipse.scout.http.servletfilter/.settings/org.eclipse.pde.core.prefs b/org.eclipse.scout.http.servletfilter/.settings/org.eclipse.pde.core.prefs
index baef13dd8c..a3a50fc8da 100644
--- a/org.eclipse.scout.http.servletfilter/.settings/org.eclipse.pde.core.prefs
+++ b/org.eclipse.scout.http.servletfilter/.settings/org.eclipse.pde.core.prefs
@@ -1,3 +1,3 @@
-#Mon Jul 11 16:16:00 CEST 2011
-eclipse.preferences.version=1
-pluginProject.extensions=true
+#Mon Jul 11 16:16:00 CEST 2011
+eclipse.preferences.version=1
+pluginProject.extensions=true
diff --git a/org.eclipse.scout.http.servletfilter/ReleseNotes.txt b/org.eclipse.scout.http.servletfilter/ReleseNotes.txt
index 86fe5c2f3c..23af242bfc 100644
--- a/org.eclipse.scout.http.servletfilter/ReleseNotes.txt
+++ b/org.eclipse.scout.http.servletfilter/ReleseNotes.txt
@@ -1,18 +1,18 @@
-18.10.2011 aho
-bugzilla ticket: 361256
-To make reuse of the ServletFilters in RAP projects. The following classes
-should be moved to the 'org.eclipse.scout.http.servletfilter' bundle:
-- org.eclipse.scout.rt.server.servlet.filter.AbstractChainableSecurityFilter
-- org.eclipse.scout.rt.server.servlet.filter.AnonymousSecurityFilter
-- org.eclipse.scout.rt.server.servlet.filter.BasicSecurityFilter
-- org.eclipse.scout.rt.server.servlet.filter.DataSourceSecurityFilter
-- org.eclipse.scout.rt.server.servlet.filter.LDAPSecurityFilter
-- org.eclipse.scout.rt.server.servlet.filter.TomcatSecurityFilter
-
-All servlet filters in the 'org.eclipse.scout.rt.server' bundle were kept as @deprecated subclasses of the moved ones.
-
-Furthermore the
-'org.eclipse.scout.rt.shared.services.common.security.SimplePrincipal' should
-be moved to the 'org.eclipse.scout.commons' bundle.
-
+18.10.2011 aho
+bugzilla ticket: 361256
+To make reuse of the ServletFilters in RAP projects. The following classes
+should be moved to the 'org.eclipse.scout.http.servletfilter' bundle:
+- org.eclipse.scout.rt.server.servlet.filter.AbstractChainableSecurityFilter
+- org.eclipse.scout.rt.server.servlet.filter.AnonymousSecurityFilter
+- org.eclipse.scout.rt.server.servlet.filter.BasicSecurityFilter
+- org.eclipse.scout.rt.server.servlet.filter.DataSourceSecurityFilter
+- org.eclipse.scout.rt.server.servlet.filter.LDAPSecurityFilter
+- org.eclipse.scout.rt.server.servlet.filter.TomcatSecurityFilter
+
+All servlet filters in the 'org.eclipse.scout.rt.server' bundle were kept as @deprecated subclasses of the moved ones.
+
+Furthermore the
+'org.eclipse.scout.rt.shared.services.common.security.SimplePrincipal' should
+be moved to the 'org.eclipse.scout.commons' bundle.
+
Migration: change all 'org.eclipse.scout.rt.shared.services.common.security.SimplePrincipal' imports to 'org.eclipse.scout.commons.security.SimplePrincipal'. \ No newline at end of file
diff --git a/org.eclipse.scout.http.servletfilter/plugin.xml b/org.eclipse.scout.http.servletfilter/plugin.xml
index 26e2469799..0708396550 100644
--- a/org.eclipse.scout.http.servletfilter/plugin.xml
+++ b/org.eclipse.scout.http.servletfilter/plugin.xml
@@ -1,6 +1,6 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.2"?>
-<plugin>
- <extension-point id="filters" name="filters" schema="schema/filters.exsd"/>
-
-</plugin>
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension-point id="filters" name="filters" schema="schema/filters.exsd"/>
+
+</plugin>
diff --git a/org.eclipse.scout.http.servletfilter/schema/filters.exsd b/org.eclipse.scout.http.servletfilter/schema/filters.exsd
index c79a074341..52a73a2cdf 100644
--- a/org.eclipse.scout.http.servletfilter/schema/filters.exsd
+++ b/org.eclipse.scout.http.servletfilter/schema/filters.exsd
@@ -1,159 +1,159 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.scout.http.servletfilter" xmlns="http://www.w3.org/2001/XMLSchema">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.scout.http.servletfilter" id="filters" name="filters"/>
- </appInfo>
- <documentation>
- [Enter description of this extension point.]
- </documentation>
- </annotation>
-
- <element name="extension">
- <annotation>
- <appInfo>
- <meta.element />
- </appInfo>
- </annotation>
- <complexType>
- <choice minOccurs="0" maxOccurs="unbounded">
- <element ref="filter"/>
- </choice>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- <appInfo>
- <meta.attribute translatable="true"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="filter">
- <annotation>
- <appInfo>
- <meta.element labelAttribute="aliases"/>
- </appInfo>
- </annotation>
- <complexType>
- <choice minOccurs="0" maxOccurs="unbounded">
- <element ref="init-param"/>
- </choice>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- <appInfo>
- <meta.attribute kind="java" basedOn=":javax.servlet.Filter"/>
- </appInfo>
- </annotation>
- </attribute>
- <attribute name="aliases" type="string" use="required">
- <annotation>
- <documentation>
- Comma space or semicolon separated list of aliases this filter is applied to.
-Example: /services /files /download
- </documentation>
- </annotation>
- </attribute>
- <attribute name="ranking" type="string">
- <annotation>
- <documentation>
- By default, filters are run in the order they are defined in the extension.
-However, if different plugins define filters for the same servlet, it can be useful to define the run order
-of the filters. This attribute is assumed to be a double value.
-Default value is 0
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="init-param">
- <annotation>
- <documentation>
- Init-param names may be defined / overridden using config.ini
-
-Example:
-name=&quot;myapp.username&quot; value=&quot;tbd&quot;
-
-and the config.ini defines
-
-myapp.username=scott
- </documentation>
- </annotation>
- <complexType>
- <attribute name="name" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="value" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
- [Enter the first release in which this extension point appears.]
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- [Enter extension point usage example here.]
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiinfo"/>
- </appInfo>
- <documentation>
- [Enter API information here.]
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
- [Enter information about supplied implementation of this extension point.]
- </documentation>
- </annotation>
-
-
-</schema>
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.scout.http.servletfilter" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.scout.http.servletfilter" id="filters" name="filters"/>
+ </appInfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element ref="filter"/>
+ </choice>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="filter">
+ <annotation>
+ <appInfo>
+ <meta.element labelAttribute="aliases"/>
+ </appInfo>
+ </annotation>
+ <complexType>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element ref="init-param"/>
+ </choice>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn=":javax.servlet.Filter"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="aliases" type="string" use="required">
+ <annotation>
+ <documentation>
+ Comma space or semicolon separated list of aliases this filter is applied to.
+Example: /services /files /download
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="ranking" type="string">
+ <annotation>
+ <documentation>
+ By default, filters are run in the order they are defined in the extension.
+However, if different plugins define filters for the same servlet, it can be useful to define the run order
+of the filters. This attribute is assumed to be a double value.
+Default value is 0
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="init-param">
+ <annotation>
+ <documentation>
+ Init-param names may be defined / overridden using config.ini
+
+Example:
+name=&quot;myapp.username&quot; value=&quot;tbd&quot;
+
+and the config.ini defines
+
+myapp.username=scott
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="name" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="value" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiinfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/FilterConfigInjection.java b/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/FilterConfigInjection.java
index b3f41b8bcc..a89a63387e 100644
--- a/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/FilterConfigInjection.java
+++ b/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/FilterConfigInjection.java
@@ -1,186 +1,186 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.http.servletfilter;
-
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.TreeSet;
-import java.util.Vector;
-
-import javax.servlet.Filter;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletRequest;
-import javax.servlet.http.HttpServletRequest;
-
-import org.eclipse.scout.commons.BundleContextUtility;
-import org.eclipse.scout.commons.ConfigIniUtility;
-
-/**
- * Wrapper to support filtering and replacing of init parameters using {@link ConfigIniUtility#getProperties(Class)}.
- * use inside {@link Filter#init(FilterConfig)}
- * <p>
- * This wrapper supports using config.ini property injection as in {@link BundleContextUtility#resolve(String)} and
- * {@link ConfigIniUtility#getProperties(Class)} to be used as filter init parameters.
- * <p>
- * This supports for using config.ini entries in the format filterClass#initPropertyName/filterAlias=value where value
- * can contain ${name} variables.
- * <p>
- * The special property "active" can be used to activate or deactivate the filter.
- * <p>
- * Examples of config.ini properties: org.myproject.filters.SecurityFilter#active=true <i>activates all filter of that
- * type (including subtypes) on al aliases</i> org.myproject.filters.SecurityFilter#active/shopping=true <i>activates
- * all filter of that type (including subtypes) on the alias /shopping</i>
- * org.myproject.filters.SecurityFilter#realm=acm.org <i>sets the init parameter "realm" to the value "acm.org" on all
- * filters of that type (including subtypes) on all aliases</i>
- * org.myproject.filters.SecurityFilter#realm/shopping=acm.org <i>sets the init parameter "realm" to the value "acm.org"
- * on all filters of that type (including subtypes) on the alias /shopping</i>
- * <p>
- * Example code
- * <p>
- * <code>
- * public class MyFilter implements Filter{
- * private FilterConfigInjection m_injection;
- *
- * public void init(FilterConfig config0) throws ServletException {
- * m_injection=new FilterConfigInjection(config0,getClass());
- * }
- *
- * public void destroy() {
- * m_injection=null;
- * }
- *
- * public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
- * //get injection config for this filter with this filter mapping
- * FilterConfigInjection.FilterConfig config=m_injection.getConfig(req);
- * if(!config.isActive(req)){
- * chain.doFilter(req,res);
- * return;
- * }
- * ...
- * }
- * }
- * </code>
- */
-public class FilterConfigInjection {
- private final javax.servlet.FilterConfig m_config;
- private final Class<? extends Filter> m_filterType;
- private final Object m_configCacheLock;
- private final Map<String, Map<String, String>> m_configCache;
-
- public FilterConfigInjection(javax.servlet.FilterConfig config, Class<? extends Filter> filterType) {
- m_config = config;
- m_filterType = filterType;
- m_configCacheLock = new Object();
- m_configCache = new HashMap<String, Map<String, String>>();
- }
-
- public FilterConfig getConfig(ServletRequest req) {
- if (req instanceof HttpServletRequest) {
- return getConfig(((HttpServletRequest) req).getServletPath());
- }
- else {
- return getConfig((String) null);
- }
- }
-
- /**
- * same as {@link #getConfig(null)}
- */
- public FilterConfig getAnyConfig() {
- return getConfig((String) null);
- }
-
- /**
- * @param path
- * starting with / or a subpath or null for wildcard
- */
- public FilterConfig getConfig(String path) {
- if (path != null && path.startsWith("/")) {
- return new FilterConfig(getCachedPropertyMap(path));
- }
- else {
- return new FilterConfig(getCachedPropertyMap(null));
- }
- }
-
- private Map<String, String> getCachedPropertyMap(String path) {
- if (path == null) {
- path = "";
- }
- Map<String, String> map;
- synchronized (m_configCacheLock) {
- map = m_configCache.get(path);
- if (map == null) {
- if (path.length() == 0) {
- map = ConfigIniUtility.getProperties(m_filterType);
- }
- else {
- map = ConfigIniUtility.getProperties(m_filterType, path);
- }
- if (map == null) {
- map = new HashMap<String, String>();
- }
- m_configCache.put(path, map);
- }
- }
- return map;
- }
-
- public class FilterConfig implements javax.servlet.FilterConfig {
- private final Map<String, String> m_injectedMap;
-
- public FilterConfig(Map<String, String> injectedMap) {
- m_injectedMap = injectedMap;
- }
-
- /**
- * Convenience for parameter "active"
- *
- * @return true if there is no init parameter "active" or the init parameter
- * "active" has the value "true"
- */
- public boolean isActive() {
- String activeText = getInitParameter("active");
- return activeText == null || activeText.equals("true");
- }
-
- @Override
- public String getFilterName() {
- return m_config.getFilterName();
- }
-
- @Override
- public ServletContext getServletContext() {
- return m_config.getServletContext();
- }
-
- @Override
- public String getInitParameter(String name) {
- if (m_injectedMap.containsKey(name)) {
- return m_injectedMap.get(name);
- }
- else {
- String s = m_config.getInitParameter(name);
- return BundleContextUtility.resolve(s);
- }
- }
-
- @Override
- public Enumeration getInitParameterNames() {
- TreeSet<String> names = new TreeSet<String>(m_injectedMap.keySet());
- for (Enumeration en = m_config.getInitParameterNames(); en.hasMoreElements();) {
- names.add((String) en.nextElement());
- }
- return new Vector<String>(names).elements();
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.http.servletfilter;
+
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.TreeSet;
+import java.util.Vector;
+
+import javax.servlet.Filter;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletRequest;
+import javax.servlet.http.HttpServletRequest;
+
+import org.eclipse.scout.commons.BundleContextUtility;
+import org.eclipse.scout.commons.ConfigIniUtility;
+
+/**
+ * Wrapper to support filtering and replacing of init parameters using {@link ConfigIniUtility#getProperties(Class)}.
+ * use inside {@link Filter#init(FilterConfig)}
+ * <p>
+ * This wrapper supports using config.ini property injection as in {@link BundleContextUtility#resolve(String)} and
+ * {@link ConfigIniUtility#getProperties(Class)} to be used as filter init parameters.
+ * <p>
+ * This supports for using config.ini entries in the format filterClass#initPropertyName/filterAlias=value where value
+ * can contain ${name} variables.
+ * <p>
+ * The special property "active" can be used to activate or deactivate the filter.
+ * <p>
+ * Examples of config.ini properties: org.myproject.filters.SecurityFilter#active=true <i>activates all filter of that
+ * type (including subtypes) on al aliases</i> org.myproject.filters.SecurityFilter#active/shopping=true <i>activates
+ * all filter of that type (including subtypes) on the alias /shopping</i>
+ * org.myproject.filters.SecurityFilter#realm=acm.org <i>sets the init parameter "realm" to the value "acm.org" on all
+ * filters of that type (including subtypes) on all aliases</i>
+ * org.myproject.filters.SecurityFilter#realm/shopping=acm.org <i>sets the init parameter "realm" to the value "acm.org"
+ * on all filters of that type (including subtypes) on the alias /shopping</i>
+ * <p>
+ * Example code
+ * <p>
+ * <code>
+ * public class MyFilter implements Filter{
+ * private FilterConfigInjection m_injection;
+ *
+ * public void init(FilterConfig config0) throws ServletException {
+ * m_injection=new FilterConfigInjection(config0,getClass());
+ * }
+ *
+ * public void destroy() {
+ * m_injection=null;
+ * }
+ *
+ * public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
+ * //get injection config for this filter with this filter mapping
+ * FilterConfigInjection.FilterConfig config=m_injection.getConfig(req);
+ * if(!config.isActive(req)){
+ * chain.doFilter(req,res);
+ * return;
+ * }
+ * ...
+ * }
+ * }
+ * </code>
+ */
+public class FilterConfigInjection {
+ private final javax.servlet.FilterConfig m_config;
+ private final Class<? extends Filter> m_filterType;
+ private final Object m_configCacheLock;
+ private final Map<String, Map<String, String>> m_configCache;
+
+ public FilterConfigInjection(javax.servlet.FilterConfig config, Class<? extends Filter> filterType) {
+ m_config = config;
+ m_filterType = filterType;
+ m_configCacheLock = new Object();
+ m_configCache = new HashMap<String, Map<String, String>>();
+ }
+
+ public FilterConfig getConfig(ServletRequest req) {
+ if (req instanceof HttpServletRequest) {
+ return getConfig(((HttpServletRequest) req).getServletPath());
+ }
+ else {
+ return getConfig((String) null);
+ }
+ }
+
+ /**
+ * same as {@link #getConfig(null)}
+ */
+ public FilterConfig getAnyConfig() {
+ return getConfig((String) null);
+ }
+
+ /**
+ * @param path
+ * starting with / or a subpath or null for wildcard
+ */
+ public FilterConfig getConfig(String path) {
+ if (path != null && path.startsWith("/")) {
+ return new FilterConfig(getCachedPropertyMap(path));
+ }
+ else {
+ return new FilterConfig(getCachedPropertyMap(null));
+ }
+ }
+
+ private Map<String, String> getCachedPropertyMap(String path) {
+ if (path == null) {
+ path = "";
+ }
+ Map<String, String> map;
+ synchronized (m_configCacheLock) {
+ map = m_configCache.get(path);
+ if (map == null) {
+ if (path.length() == 0) {
+ map = ConfigIniUtility.getProperties(m_filterType);
+ }
+ else {
+ map = ConfigIniUtility.getProperties(m_filterType, path);
+ }
+ if (map == null) {
+ map = new HashMap<String, String>();
+ }
+ m_configCache.put(path, map);
+ }
+ }
+ return map;
+ }
+
+ public class FilterConfig implements javax.servlet.FilterConfig {
+ private final Map<String, String> m_injectedMap;
+
+ public FilterConfig(Map<String, String> injectedMap) {
+ m_injectedMap = injectedMap;
+ }
+
+ /**
+ * Convenience for parameter "active"
+ *
+ * @return true if there is no init parameter "active" or the init parameter
+ * "active" has the value "true"
+ */
+ public boolean isActive() {
+ String activeText = getInitParameter("active");
+ return activeText == null || activeText.equals("true");
+ }
+
+ @Override
+ public String getFilterName() {
+ return m_config.getFilterName();
+ }
+
+ @Override
+ public ServletContext getServletContext() {
+ return m_config.getServletContext();
+ }
+
+ @Override
+ public String getInitParameter(String name) {
+ if (m_injectedMap.containsKey(name)) {
+ return m_injectedMap.get(name);
+ }
+ else {
+ String s = m_config.getInitParameter(name);
+ return BundleContextUtility.resolve(s);
+ }
+ }
+
+ @Override
+ public Enumeration getInitParameterNames() {
+ TreeSet<String> names = new TreeSet<String>(m_injectedMap.keySet());
+ for (Enumeration en = m_config.getInitParameterNames(); en.hasMoreElements();) {
+ names.add((String) en.nextElement());
+ }
+ return new Vector<String>(names).elements();
+ }
+ }
+}
diff --git a/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/HttpServletEx.java b/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/HttpServletEx.java
index 7b564bfdcf..28b327812e 100644
--- a/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/HttpServletEx.java
+++ b/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/HttpServletEx.java
@@ -1,48 +1,48 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.http.servletfilter;
-
-import java.io.IOException;
-
-import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServlet;
-
-/**
- * In order to have servlet filters inside equinox use this baseclass instead of {@link HttpServlet}.<br>
- * See extension point org.eclipse.scout.http.servletfilter.filters in plugin
- * org.eclipse.scout.http.servletfilter<br>
- * For debugging use system property javax.servlet.filter.debug=true<br>
- * <p>
- * This is a temporary solution until bug <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=128068"
- * >https://bugs.eclipse.org/bugs/show_bug.cgi?id=128068</a> is closed.
- */
-public class HttpServletEx extends HttpServlet {
- private static final long serialVersionUID = 1L;
-
- @Override
- public final void service(ServletRequest req, ServletResponse res) throws ServletException, IOException {
- new ServletFilterDelegate().delegateServiceMethod(req, res, new ServletFilterDelegate.IServiceCallback() {
- @Override
- public void service(ServletRequest reqInner, ServletResponse resInner) throws ServletException, IOException {
- HttpServletEx.super.service(reqInner, resInner);
- }
-
- @Override
- public ServletContext getServletContext() {
- return HttpServletEx.this.getServletContext();
- }
- });
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.http.servletfilter;
+
+import java.io.IOException;
+
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServlet;
+
+/**
+ * In order to have servlet filters inside equinox use this baseclass instead of {@link HttpServlet}.<br>
+ * See extension point org.eclipse.scout.http.servletfilter.filters in plugin
+ * org.eclipse.scout.http.servletfilter<br>
+ * For debugging use system property javax.servlet.filter.debug=true<br>
+ * <p>
+ * This is a temporary solution until bug <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=128068"
+ * >https://bugs.eclipse.org/bugs/show_bug.cgi?id=128068</a> is closed.
+ */
+public class HttpServletEx extends HttpServlet {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public final void service(ServletRequest req, ServletResponse res) throws ServletException, IOException {
+ new ServletFilterDelegate().delegateServiceMethod(req, res, new ServletFilterDelegate.IServiceCallback() {
+ @Override
+ public void service(ServletRequest reqInner, ServletResponse resInner) throws ServletException, IOException {
+ HttpServletEx.super.service(reqInner, resInner);
+ }
+
+ @Override
+ public ServletContext getServletContext() {
+ return HttpServletEx.this.getServletContext();
+ }
+ });
+ }
+
+}
diff --git a/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/ServletFilterDelegate.java b/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/ServletFilterDelegate.java
index 0a368cb715..6eb94b4224 100644
--- a/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/ServletFilterDelegate.java
+++ b/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/ServletFilterDelegate.java
@@ -1,59 +1,59 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.http.servletfilter;
-
-import java.io.IOException;
-import java.util.ArrayList;
-
-import javax.servlet.Filter;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-
-import org.eclipse.scout.http.servletfilter.internal.FilterChainImpl;
-import org.eclipse.scout.http.servletfilter.internal.FilterConfigImpl;
-import org.eclipse.scout.http.servletfilter.internal.ServletFilterExtensionPoint;
-
-public final class ServletFilterDelegate {
-
- public static interface IServiceCallback {
- void service(ServletRequest req, ServletResponse res) throws ServletException, IOException;
-
- ServletContext getServletContext();
- }
-
- public ServletFilterDelegate() {
- }
-
- public void delegateServiceMethod(ServletRequest req, ServletResponse res, IServiceCallback callback) throws ServletException, IOException {
- String servletPath = ((HttpServletRequest) req).getServletPath();
- if (servletPath == null) {
- servletPath = "/";
- }
- else if (!servletPath.startsWith("/")) {
- servletPath = "/" + servletPath;
- }
- ArrayList<Filter> filterList = new ArrayList<Filter>();
- //
- ServletContext servletContext = callback.getServletContext();
- for (FilterConfigImpl ref : ServletFilterExtensionPoint.getExtensions()) {
- if (ref.isFiltering(servletPath)) {
- Filter f = ref.getFilter(servletContext);
- if (f != null) {
- filterList.add(f);
- }
- }
- }
- new FilterChainImpl(filterList, callback).doFilter(req, res);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.http.servletfilter;
+
+import java.io.IOException;
+import java.util.ArrayList;
+
+import javax.servlet.Filter;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+
+import org.eclipse.scout.http.servletfilter.internal.FilterChainImpl;
+import org.eclipse.scout.http.servletfilter.internal.FilterConfigImpl;
+import org.eclipse.scout.http.servletfilter.internal.ServletFilterExtensionPoint;
+
+public final class ServletFilterDelegate {
+
+ public static interface IServiceCallback {
+ void service(ServletRequest req, ServletResponse res) throws ServletException, IOException;
+
+ ServletContext getServletContext();
+ }
+
+ public ServletFilterDelegate() {
+ }
+
+ public void delegateServiceMethod(ServletRequest req, ServletResponse res, IServiceCallback callback) throws ServletException, IOException {
+ String servletPath = ((HttpServletRequest) req).getServletPath();
+ if (servletPath == null) {
+ servletPath = "/";
+ }
+ else if (!servletPath.startsWith("/")) {
+ servletPath = "/" + servletPath;
+ }
+ ArrayList<Filter> filterList = new ArrayList<Filter>();
+ //
+ ServletContext servletContext = callback.getServletContext();
+ for (FilterConfigImpl ref : ServletFilterExtensionPoint.getExtensions()) {
+ if (ref.isFiltering(servletPath)) {
+ Filter f = ref.getFilter(servletContext);
+ if (f != null) {
+ filterList.add(f);
+ }
+ }
+ }
+ new FilterChainImpl(filterList, callback).doFilter(req, res);
+ }
+}
diff --git a/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/helper/DevelopmentAuthFilter.java b/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/helper/DevelopmentAuthFilter.java
index 26664f87c2..5ffab09443 100644
--- a/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/helper/DevelopmentAuthFilter.java
+++ b/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/helper/DevelopmentAuthFilter.java
@@ -1,123 +1,123 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.http.servletfilter.helper;
-
-import java.io.IOException;
-import java.security.AccessController;
-import java.security.Principal;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-
-import javax.security.auth.Subject;
-import javax.servlet.Filter;
-import javax.servlet.FilterChain;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.commons.security.SimplePrincipal;
-import org.eclipse.scout.http.servletfilter.FilterConfigInjection;
-import org.eclipse.scout.http.servletfilter.security.SecureHttpServletRequestWrapper;
-
-/**
- * Convenience authentication filter for development mode.
- * <p>
- * This filter is registered in the scout server plugin.xml as /process by default with order 1'000'010 and has the
- * active flag set to true
- */
-public class DevelopmentAuthFilter implements Filter {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(DevelopmentAuthFilter.class);
-
- private FilterConfigInjection m_injection;
- private boolean m_showWarning = true;
-
- @Override
- public void init(FilterConfig config0) throws ServletException {
- m_injection = new FilterConfigInjection(config0, getClass());
- }
-
- @Override
- public void destroy() {
- m_injection = null;
- }
-
- @Override
- public void doFilter(ServletRequest in, ServletResponse out, final FilterChain chain) throws IOException, ServletException {
- if (isSubjectSet() || !Platform.inDevelopmentMode()) {
- chain.doFilter(in, out);
- return;
- }
- FilterConfigInjection.FilterConfig config = m_injection.getConfig(in);
- if (!config.isActive()) {
- chain.doFilter(in, out);
- return;
- }
- Subject subject = createDevelopmentSubject(m_showWarning);
- m_showWarning = false;
- if (subject == null) {
- chain.doFilter(in, out);
- return;
- }
- continueChainWithPrincipal(subject, (HttpServletRequest) in, (HttpServletResponse) out, chain);
- }
-
- private boolean isSubjectSet() {
- Subject subject = Subject.getSubject(AccessController.getContext());
- if (subject == null) {
- return false;
- }
- return true;
- }
-
- protected Subject createDevelopmentSubject(boolean showWarning) {
- if (showWarning) {
- LOG.warn("+++Development security: Create Subject based on System.getProperty('user.name')");
- }
- Subject subject = new Subject();
- subject.getPrincipals().add(new SimplePrincipal(System.getProperty("user.name")));
- return subject;
- }
-
- private void continueChainWithPrincipal(Subject subject, final HttpServletRequest req, final HttpServletResponse res, final FilterChain chain) throws IOException, ServletException {
- try {
- Subject.doAs(
- subject,
- new PrivilegedExceptionAction<Object>() {
- @Override
- public Object run() throws Exception {
- Principal principal = Subject.getSubject(AccessController.getContext()).getPrincipals().iterator().next();
- HttpServletRequest secureReq = new SecureHttpServletRequestWrapper(req, principal);
- chain.doFilter(secureReq, res);
- return null;
- }
- }
- );
- }
- catch (PrivilegedActionException e) {
- Throwable t = e.getCause();
- if (t instanceof IOException) {
- throw (IOException) t;
- }
- else if (t instanceof ServletException) {
- throw (ServletException) t;
- }
- else {
- throw new ServletException(t);
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.http.servletfilter.helper;
+
+import java.io.IOException;
+import java.security.AccessController;
+import java.security.Principal;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+
+import javax.security.auth.Subject;
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.commons.security.SimplePrincipal;
+import org.eclipse.scout.http.servletfilter.FilterConfigInjection;
+import org.eclipse.scout.http.servletfilter.security.SecureHttpServletRequestWrapper;
+
+/**
+ * Convenience authentication filter for development mode.
+ * <p>
+ * This filter is registered in the scout server plugin.xml as /process by default with order 1'000'010 and has the
+ * active flag set to true
+ */
+public class DevelopmentAuthFilter implements Filter {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(DevelopmentAuthFilter.class);
+
+ private FilterConfigInjection m_injection;
+ private boolean m_showWarning = true;
+
+ @Override
+ public void init(FilterConfig config0) throws ServletException {
+ m_injection = new FilterConfigInjection(config0, getClass());
+ }
+
+ @Override
+ public void destroy() {
+ m_injection = null;
+ }
+
+ @Override
+ public void doFilter(ServletRequest in, ServletResponse out, final FilterChain chain) throws IOException, ServletException {
+ if (isSubjectSet() || !Platform.inDevelopmentMode()) {
+ chain.doFilter(in, out);
+ return;
+ }
+ FilterConfigInjection.FilterConfig config = m_injection.getConfig(in);
+ if (!config.isActive()) {
+ chain.doFilter(in, out);
+ return;
+ }
+ Subject subject = createDevelopmentSubject(m_showWarning);
+ m_showWarning = false;
+ if (subject == null) {
+ chain.doFilter(in, out);
+ return;
+ }
+ continueChainWithPrincipal(subject, (HttpServletRequest) in, (HttpServletResponse) out, chain);
+ }
+
+ private boolean isSubjectSet() {
+ Subject subject = Subject.getSubject(AccessController.getContext());
+ if (subject == null) {
+ return false;
+ }
+ return true;
+ }
+
+ protected Subject createDevelopmentSubject(boolean showWarning) {
+ if (showWarning) {
+ LOG.warn("+++Development security: Create Subject based on System.getProperty('user.name')");
+ }
+ Subject subject = new Subject();
+ subject.getPrincipals().add(new SimplePrincipal(System.getProperty("user.name")));
+ return subject;
+ }
+
+ private void continueChainWithPrincipal(Subject subject, final HttpServletRequest req, final HttpServletResponse res, final FilterChain chain) throws IOException, ServletException {
+ try {
+ Subject.doAs(
+ subject,
+ new PrivilegedExceptionAction<Object>() {
+ @Override
+ public Object run() throws Exception {
+ Principal principal = Subject.getSubject(AccessController.getContext()).getPrincipals().iterator().next();
+ HttpServletRequest secureReq = new SecureHttpServletRequestWrapper(req, principal);
+ chain.doFilter(secureReq, res);
+ return null;
+ }
+ }
+ );
+ }
+ catch (PrivilegedActionException e) {
+ Throwable t = e.getCause();
+ if (t instanceof IOException) {
+ throw (IOException) t;
+ }
+ else if (t instanceof ServletException) {
+ throw (ServletException) t;
+ }
+ else {
+ throw new ServletException(t);
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/helper/HttpAuthJaasFilter.java b/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/helper/HttpAuthJaasFilter.java
index b2cc964d28..ed787fe761 100644
--- a/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/helper/HttpAuthJaasFilter.java
+++ b/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/helper/HttpAuthJaasFilter.java
@@ -1,146 +1,146 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.http.servletfilter.helper;
-
-import java.io.IOException;
-import java.security.AccessController;
-import java.security.Principal;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-
-import javax.security.auth.Subject;
-import javax.servlet.Filter;
-import javax.servlet.FilterChain;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.security.SimplePrincipal;
-import org.eclipse.scout.http.servletfilter.FilterConfigInjection;
-import org.eclipse.scout.http.servletfilter.security.SecureHttpServletRequestWrapper;
-
-/**
- * Transformation filter used to create a subject based on {@link HttpServletRequest#getRemoteUser()} or
- * {@link HttpServletRequest#getUserPrincipal()}
- * <p>
- * If there is already a subject set as {@link Subject#getSubject(java.security.AccessControlContext)} then the filter
- * is transparent.
- * <p>
- * Normally this filters the alias /process
- * <p>
- * This filter is registered in the scout server plugin.xml as /process by default with order 1'000'000 and has the
- * active flag set to true
- */
-public class HttpAuthJaasFilter implements Filter {
- private FilterConfigInjection m_injection;
-
- @Override
- public void init(FilterConfig config0) throws ServletException {
- m_injection = new FilterConfigInjection(config0, getClass());
- }
-
- @Override
- public void destroy() {
- m_injection = null;
- }
-
- @Override
- public void doFilter(ServletRequest in, ServletResponse out, final FilterChain chain) throws IOException, ServletException {
- if (isSubjectSet()) {
- chain.doFilter(in, out);
- return;
- }
- FilterConfigInjection.FilterConfig config = m_injection.getConfig(in);
- if (!config.isActive()) {
- chain.doFilter(in, out);
- return;
- }
-
- HttpServletRequest req = (HttpServletRequest) in;
- HttpServletResponse res = (HttpServletResponse) out;
-
- // check if subject that has one principal at minimum is available
- // create subject if necessary
- Subject subject = Subject.getSubject(AccessController.getContext());
- if (subject == null || subject.isReadOnly()) {
- subject = new Subject();
- }
-
- // create principal if necessary
- Principal principal = req.getUserPrincipal();
- if (principal != null && !StringUtility.hasText(principal.getName())) {
- principal = null;
- String name = req.getRemoteUser();
- if (StringUtility.hasText(name)) {
- principal = new SimplePrincipal(name);
- }
- }
- if (principal == null) {
- // no principal provided, abort chain
- res.sendError(HttpServletResponse.SC_FORBIDDEN);
- return;
- }
-
- subject.getPrincipals().add(principal);
- subject.setReadOnly();
-
- continueChainWithPrincipal(subject, req, res, chain);
- }
-
- private boolean isSubjectSet() {
- Subject subject = Subject.getSubject(AccessController.getContext());
- if (subject == null) {
- return false;
- }
- if (subject.getPrincipals().size() == 0) {
- return false;
- }
- String name = subject.getPrincipals().iterator().next().getName();
- if (name == null || name.trim().length() == 0) {
- return false;
- }
- return true;
- }
-
- private void continueChainWithPrincipal(Subject subject, final HttpServletRequest req, final HttpServletResponse res, final FilterChain chain) throws IOException, ServletException {
- try {
- Subject.doAs(
- subject,
- new PrivilegedExceptionAction<Object>() {
- @Override
- public Object run() throws Exception {
- Principal principal = Subject.getSubject(AccessController.getContext()).getPrincipals().iterator().next();
- HttpServletRequest secureReq = new SecureHttpServletRequestWrapper(req, principal);
- chain.doFilter(secureReq, res);
- return null;
- }
- }
- );
- }
- catch (PrivilegedActionException e) {
- Throwable t = e.getCause();
- if (t instanceof IOException) {
- throw (IOException) t;
- }
- else if (t instanceof ServletException) {
- throw (ServletException) t;
- }
- else {
- throw new ServletException(t);
- }
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.http.servletfilter.helper;
+
+import java.io.IOException;
+import java.security.AccessController;
+import java.security.Principal;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+
+import javax.security.auth.Subject;
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.security.SimplePrincipal;
+import org.eclipse.scout.http.servletfilter.FilterConfigInjection;
+import org.eclipse.scout.http.servletfilter.security.SecureHttpServletRequestWrapper;
+
+/**
+ * Transformation filter used to create a subject based on {@link HttpServletRequest#getRemoteUser()} or
+ * {@link HttpServletRequest#getUserPrincipal()}
+ * <p>
+ * If there is already a subject set as {@link Subject#getSubject(java.security.AccessControlContext)} then the filter
+ * is transparent.
+ * <p>
+ * Normally this filters the alias /process
+ * <p>
+ * This filter is registered in the scout server plugin.xml as /process by default with order 1'000'000 and has the
+ * active flag set to true
+ */
+public class HttpAuthJaasFilter implements Filter {
+ private FilterConfigInjection m_injection;
+
+ @Override
+ public void init(FilterConfig config0) throws ServletException {
+ m_injection = new FilterConfigInjection(config0, getClass());
+ }
+
+ @Override
+ public void destroy() {
+ m_injection = null;
+ }
+
+ @Override
+ public void doFilter(ServletRequest in, ServletResponse out, final FilterChain chain) throws IOException, ServletException {
+ if (isSubjectSet()) {
+ chain.doFilter(in, out);
+ return;
+ }
+ FilterConfigInjection.FilterConfig config = m_injection.getConfig(in);
+ if (!config.isActive()) {
+ chain.doFilter(in, out);
+ return;
+ }
+
+ HttpServletRequest req = (HttpServletRequest) in;
+ HttpServletResponse res = (HttpServletResponse) out;
+
+ // check if subject that has one principal at minimum is available
+ // create subject if necessary
+ Subject subject = Subject.getSubject(AccessController.getContext());
+ if (subject == null || subject.isReadOnly()) {
+ subject = new Subject();
+ }
+
+ // create principal if necessary
+ Principal principal = req.getUserPrincipal();
+ if (principal != null && !StringUtility.hasText(principal.getName())) {
+ principal = null;
+ String name = req.getRemoteUser();
+ if (StringUtility.hasText(name)) {
+ principal = new SimplePrincipal(name);
+ }
+ }
+ if (principal == null) {
+ // no principal provided, abort chain
+ res.sendError(HttpServletResponse.SC_FORBIDDEN);
+ return;
+ }
+
+ subject.getPrincipals().add(principal);
+ subject.setReadOnly();
+
+ continueChainWithPrincipal(subject, req, res, chain);
+ }
+
+ private boolean isSubjectSet() {
+ Subject subject = Subject.getSubject(AccessController.getContext());
+ if (subject == null) {
+ return false;
+ }
+ if (subject.getPrincipals().size() == 0) {
+ return false;
+ }
+ String name = subject.getPrincipals().iterator().next().getName();
+ if (name == null || name.trim().length() == 0) {
+ return false;
+ }
+ return true;
+ }
+
+ private void continueChainWithPrincipal(Subject subject, final HttpServletRequest req, final HttpServletResponse res, final FilterChain chain) throws IOException, ServletException {
+ try {
+ Subject.doAs(
+ subject,
+ new PrivilegedExceptionAction<Object>() {
+ @Override
+ public Object run() throws Exception {
+ Principal principal = Subject.getSubject(AccessController.getContext()).getPrincipals().iterator().next();
+ HttpServletRequest secureReq = new SecureHttpServletRequestWrapper(req, principal);
+ chain.doFilter(secureReq, res);
+ return null;
+ }
+ }
+ );
+ }
+ catch (PrivilegedActionException e) {
+ Throwable t = e.getCause();
+ if (t instanceof IOException) {
+ throw (IOException) t;
+ }
+ else if (t instanceof ServletException) {
+ throw (ServletException) t;
+ }
+ else {
+ throw new ServletException(t);
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/internal/Activator.java b/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/internal/Activator.java
index 2de14db157..62dc7eb427 100644
--- a/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/internal/Activator.java
+++ b/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/internal/Activator.java
@@ -1,65 +1,65 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.http.servletfilter.internal;
-
-import org.eclipse.core.runtime.Plugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends Plugin {
- public static boolean DEBUG;
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.scout.http.servletfilter";
-
- // The shared instance
- private static Activator plugin;
-
- /**
- * The constructor
- */
- public Activator() {
- }
-
- /*
- * (non-Javadoc)
- * @see
- * org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
- */
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- DEBUG = "true".equals(context.getProperty("javax.servlet.filter.debug"));
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.http.servletfilter.internal;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends Plugin {
+ public static boolean DEBUG;
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.scout.http.servletfilter";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
+ * org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ DEBUG = "true".equals(context.getProperty("javax.servlet.filter.debug"));
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/internal/FilterChainImpl.java b/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/internal/FilterChainImpl.java
index 0f1bded206..3141f045f2 100644
--- a/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/internal/FilterChainImpl.java
+++ b/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/internal/FilterChainImpl.java
@@ -1,48 +1,48 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.http.servletfilter.internal;
-
-import java.io.IOException;
-import java.util.List;
-
-import javax.servlet.Filter;
-import javax.servlet.FilterChain;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-
-import org.eclipse.core.runtime.Status;
-import org.eclipse.scout.http.servletfilter.ServletFilterDelegate;
-
-public class FilterChainImpl implements FilterChain {
- private List<Filter> m_filters;
- private ServletFilterDelegate.IServiceCallback m_callback;
-
- public FilterChainImpl(List<Filter> filters, ServletFilterDelegate.IServiceCallback callback) {
- m_filters = filters;
- m_callback = callback;
- }
-
- @Override
- public void doFilter(ServletRequest req, ServletResponse res) throws IOException, ServletException {
- if (m_filters.size() > 0) {
- Filter nextFilter = m_filters.remove(0);
- if (Activator.DEBUG) {
- Activator.getDefault().getLog().log(new Status(Status.INFO, Activator.PLUGIN_ID, "ServletFilterChain: doFilter " + nextFilter.getClass().getSimpleName()));
- }
- nextFilter.doFilter(req, res, this);
- }
- else {
- m_callback.service(req, res);
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.http.servletfilter.internal;
+
+import java.io.IOException;
+import java.util.List;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+
+import org.eclipse.core.runtime.Status;
+import org.eclipse.scout.http.servletfilter.ServletFilterDelegate;
+
+public class FilterChainImpl implements FilterChain {
+ private List<Filter> m_filters;
+ private ServletFilterDelegate.IServiceCallback m_callback;
+
+ public FilterChainImpl(List<Filter> filters, ServletFilterDelegate.IServiceCallback callback) {
+ m_filters = filters;
+ m_callback = callback;
+ }
+
+ @Override
+ public void doFilter(ServletRequest req, ServletResponse res) throws IOException, ServletException {
+ if (m_filters.size() > 0) {
+ Filter nextFilter = m_filters.remove(0);
+ if (Activator.DEBUG) {
+ Activator.getDefault().getLog().log(new Status(Status.INFO, Activator.PLUGIN_ID, "ServletFilterChain: doFilter " + nextFilter.getClass().getSimpleName()));
+ }
+ nextFilter.doFilter(req, res, this);
+ }
+ else {
+ m_callback.service(req, res);
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/internal/FilterConfigImpl.java b/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/internal/FilterConfigImpl.java
index 48ad179bba..4bc9e2850b 100644
--- a/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/internal/FilterConfigImpl.java
+++ b/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/internal/FilterConfigImpl.java
@@ -1,142 +1,142 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.http.servletfilter.internal;
-
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Vector;
-
-import javax.servlet.Filter;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.Status;
-import org.osgi.framework.Bundle;
-
-public class FilterConfigImpl implements FilterConfig {
- private ServletContext m_servletContext;
- private final IConfigurationElement m_serviceElement;
- private final Bundle m_definingBundle;
- private final HashMap<String, String> m_initParams;
- private final String m_alias;
- // cache
- private Filter m_filter;
- private boolean m_destroyed;
- private final String m_equalityCode;
-
- public FilterConfigImpl(String alias, IConfigurationElement serviceElement, Bundle definingBundle) {
- m_alias = alias;
- m_serviceElement = serviceElement;
- m_definingBundle = definingBundle;
- String className = serviceElement.getAttribute("class");
- //
- m_initParams = new HashMap<String, String>();
- for (IConfigurationElement initParam : serviceElement.getChildren("init-param")) {
- String name = initParam.getAttribute("name");
- String value = initParam.getAttribute("value");
- m_initParams.put(name, value);
- }
- //
- m_equalityCode = m_definingBundle.getSymbolicName() + "/" + className + alias;
- }
-
- public boolean isFiltering(String servletPath) {
- if (servletPath != null) {
- if (servletPath.startsWith(m_alias)) {
- return true;
- }
- }
- return false;
- }
-
- public Filter getFilter(ServletContext servletContext) throws ServletException {
- if (m_filter == null && (!m_destroyed)) {
- try {
- m_servletContext = servletContext;
- m_filter = (Filter) m_serviceElement.createExecutableExtension("class");
- if (Activator.DEBUG) {
- Activator.getDefault().getLog().log(new Status(Status.INFO, Activator.PLUGIN_ID, "ServletFilterConfig: init " + m_filter.getClass().getSimpleName()));
- }
- m_filter.init(this);
- }
- catch (Throwable t) {
- String className = m_serviceElement.getAttribute("class");
- throw new ServletException("init " + className, t);
- }
- }
- return m_filter;
- }
-
- public void destroy() {
- if (m_filter != null) {
- try {
- if (Activator.DEBUG) {
- Activator.getDefault().getLog().log(new Status(Status.INFO, Activator.PLUGIN_ID, "ServletFilterConfig: destroy " + m_filter.getClass().getSimpleName()));
- }
- m_filter.destroy();
- }
- catch (Throwable t) {
- String className = m_serviceElement.getAttribute("class");
- Activator.getDefault().getLog().log(new Status(Status.ERROR, Activator.PLUGIN_ID, "destroy " + className, t));
- }
- finally {
- m_filter = null;
- m_destroyed = true;
- }
- }
- }
-
- public Bundle getDefiningBundle() {
- return m_definingBundle;
- }
-
- @Override
- public int hashCode() {
- return m_equalityCode.hashCode();
- }
-
- @Override
- public boolean equals(Object o) {
- if (o == null) {
- return false;
- }
- return this.m_equalityCode.equals(((FilterConfigImpl) o).m_equalityCode);
- }
-
- @Override
- public String getFilterName() {
- String className = m_serviceElement.getAttribute("class");
- return className;
- }
-
- @Override
- public String getInitParameter(String name) {
- return m_initParams.get(name);
- }
-
- @Override
- public Enumeration getInitParameterNames() {
- return new Vector<String>(m_initParams.keySet()).elements();
- }
-
- @Override
- public ServletContext getServletContext() {
- return m_servletContext;
- }
-
- @Override
- public String toString() {
- return getFilterName() + "[" + m_alias + "]";
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.http.servletfilter.internal;
+
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Vector;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.Status;
+import org.osgi.framework.Bundle;
+
+public class FilterConfigImpl implements FilterConfig {
+ private ServletContext m_servletContext;
+ private final IConfigurationElement m_serviceElement;
+ private final Bundle m_definingBundle;
+ private final HashMap<String, String> m_initParams;
+ private final String m_alias;
+ // cache
+ private Filter m_filter;
+ private boolean m_destroyed;
+ private final String m_equalityCode;
+
+ public FilterConfigImpl(String alias, IConfigurationElement serviceElement, Bundle definingBundle) {
+ m_alias = alias;
+ m_serviceElement = serviceElement;
+ m_definingBundle = definingBundle;
+ String className = serviceElement.getAttribute("class");
+ //
+ m_initParams = new HashMap<String, String>();
+ for (IConfigurationElement initParam : serviceElement.getChildren("init-param")) {
+ String name = initParam.getAttribute("name");
+ String value = initParam.getAttribute("value");
+ m_initParams.put(name, value);
+ }
+ //
+ m_equalityCode = m_definingBundle.getSymbolicName() + "/" + className + alias;
+ }
+
+ public boolean isFiltering(String servletPath) {
+ if (servletPath != null) {
+ if (servletPath.startsWith(m_alias)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public Filter getFilter(ServletContext servletContext) throws ServletException {
+ if (m_filter == null && (!m_destroyed)) {
+ try {
+ m_servletContext = servletContext;
+ m_filter = (Filter) m_serviceElement.createExecutableExtension("class");
+ if (Activator.DEBUG) {
+ Activator.getDefault().getLog().log(new Status(Status.INFO, Activator.PLUGIN_ID, "ServletFilterConfig: init " + m_filter.getClass().getSimpleName()));
+ }
+ m_filter.init(this);
+ }
+ catch (Throwable t) {
+ String className = m_serviceElement.getAttribute("class");
+ throw new ServletException("init " + className, t);
+ }
+ }
+ return m_filter;
+ }
+
+ public void destroy() {
+ if (m_filter != null) {
+ try {
+ if (Activator.DEBUG) {
+ Activator.getDefault().getLog().log(new Status(Status.INFO, Activator.PLUGIN_ID, "ServletFilterConfig: destroy " + m_filter.getClass().getSimpleName()));
+ }
+ m_filter.destroy();
+ }
+ catch (Throwable t) {
+ String className = m_serviceElement.getAttribute("class");
+ Activator.getDefault().getLog().log(new Status(Status.ERROR, Activator.PLUGIN_ID, "destroy " + className, t));
+ }
+ finally {
+ m_filter = null;
+ m_destroyed = true;
+ }
+ }
+ }
+
+ public Bundle getDefiningBundle() {
+ return m_definingBundle;
+ }
+
+ @Override
+ public int hashCode() {
+ return m_equalityCode.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o == null) {
+ return false;
+ }
+ return this.m_equalityCode.equals(((FilterConfigImpl) o).m_equalityCode);
+ }
+
+ @Override
+ public String getFilterName() {
+ String className = m_serviceElement.getAttribute("class");
+ return className;
+ }
+
+ @Override
+ public String getInitParameter(String name) {
+ return m_initParams.get(name);
+ }
+
+ @Override
+ public Enumeration getInitParameterNames() {
+ return new Vector<String>(m_initParams.keySet()).elements();
+ }
+
+ @Override
+ public ServletContext getServletContext() {
+ return m_servletContext;
+ }
+
+ @Override
+ public String toString() {
+ return getFilterName() + "[" + m_alias + "]";
+ }
+
+}
diff --git a/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/internal/ServletFilterExtensionPoint.java b/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/internal/ServletFilterExtensionPoint.java
index 55067f3891..ef40d19633 100644
--- a/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/internal/ServletFilterExtensionPoint.java
+++ b/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/internal/ServletFilterExtensionPoint.java
@@ -1,105 +1,105 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.http.servletfilter.internal;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.TreeMap;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.IRegistryEventListener;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.osgi.framework.Bundle;
-
-public final class ServletFilterExtensionPoint {
- private static Object filtersLock = new Object();
- private static List<FilterConfigImpl> filters;
-
- private ServletFilterExtensionPoint() {
- }
-
- public static List<FilterConfigImpl> getExtensions() {
- if (filters == null) {
- synchronized (filtersLock) {
- TreeMap<Double, FilterConfigImpl> tempMap = new TreeMap<Double, FilterConfigImpl>();
- IExtensionRegistry reg = Platform.getExtensionRegistry();
- // add change listener
- reg.addListener(new IRegistryEventListener() {
- @Override
- public void added(IExtension[] extensions) {
- notifyExtensionPointChanged();
- }
-
- @Override
- public void removed(IExtension[] extensions) {
- notifyExtensionPointChanged();
- }
-
- @Override
- public void added(IExtensionPoint[] extensionPoints) {
- notifyExtensionPointChanged();
- }
-
- @Override
- public void removed(IExtensionPoint[] extensionPoints) {
- notifyExtensionPointChanged();
- }
- }, Activator.PLUGIN_ID + ".filters");
- IExtensionPoint xp = reg.getExtensionPoint(Activator.PLUGIN_ID, "filters");
- IExtension[] extensions = xp.getExtensions();
- double index = 0;
- for (IExtension extension : extensions) {
- Bundle contributorBundle = Platform.getBundle(extension.getContributor().getName());
- IConfigurationElement[] serviceElements = extension.getConfigurationElements();
- for (IConfigurationElement serviceElement : serviceElements) {
- String className = serviceElement.getAttribute("class");
- String runOrderText = serviceElement.getAttribute("ranking");
- try {
- double runOrder = 0.0;
- if (runOrderText != null && runOrderText.length() > 0) {
- runOrder = Double.parseDouble(runOrderText);
- }
- for (String alias : serviceElement.getAttribute("aliases").split("[ ,;]")) {
- alias = alias.trim();
- if (alias.length() > 0) {
- FilterConfigImpl ref = new FilterConfigImpl(alias, serviceElement, contributorBundle);
- tempMap.put(runOrder + index * (1e-6), ref);
- index++;
- }
- }
- }
- catch (Throwable t) {
- Activator.getDefault().getLog().log(new Status(Status.ERROR, Activator.PLUGIN_ID, "create filter: " + className, t));
- }
- }
- }
- filters = new ArrayList<FilterConfigImpl>(tempMap.values());
- }
- }
- return filters;
- }
-
- private static void notifyExtensionPointChanged() {
- synchronized (filtersLock) {
- if (filters != null) {
- for (FilterConfigImpl ref : filters) {
- ref.destroy();
- }
- }
- filters = null;
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.http.servletfilter.internal;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.TreeMap;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.IRegistryEventListener;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.osgi.framework.Bundle;
+
+public final class ServletFilterExtensionPoint {
+ private static Object filtersLock = new Object();
+ private static List<FilterConfigImpl> filters;
+
+ private ServletFilterExtensionPoint() {
+ }
+
+ public static List<FilterConfigImpl> getExtensions() {
+ if (filters == null) {
+ synchronized (filtersLock) {
+ TreeMap<Double, FilterConfigImpl> tempMap = new TreeMap<Double, FilterConfigImpl>();
+ IExtensionRegistry reg = Platform.getExtensionRegistry();
+ // add change listener
+ reg.addListener(new IRegistryEventListener() {
+ @Override
+ public void added(IExtension[] extensions) {
+ notifyExtensionPointChanged();
+ }
+
+ @Override
+ public void removed(IExtension[] extensions) {
+ notifyExtensionPointChanged();
+ }
+
+ @Override
+ public void added(IExtensionPoint[] extensionPoints) {
+ notifyExtensionPointChanged();
+ }
+
+ @Override
+ public void removed(IExtensionPoint[] extensionPoints) {
+ notifyExtensionPointChanged();
+ }
+ }, Activator.PLUGIN_ID + ".filters");
+ IExtensionPoint xp = reg.getExtensionPoint(Activator.PLUGIN_ID, "filters");
+ IExtension[] extensions = xp.getExtensions();
+ double index = 0;
+ for (IExtension extension : extensions) {
+ Bundle contributorBundle = Platform.getBundle(extension.getContributor().getName());
+ IConfigurationElement[] serviceElements = extension.getConfigurationElements();
+ for (IConfigurationElement serviceElement : serviceElements) {
+ String className = serviceElement.getAttribute("class");
+ String runOrderText = serviceElement.getAttribute("ranking");
+ try {
+ double runOrder = 0.0;
+ if (runOrderText != null && runOrderText.length() > 0) {
+ runOrder = Double.parseDouble(runOrderText);
+ }
+ for (String alias : serviceElement.getAttribute("aliases").split("[ ,;]")) {
+ alias = alias.trim();
+ if (alias.length() > 0) {
+ FilterConfigImpl ref = new FilterConfigImpl(alias, serviceElement, contributorBundle);
+ tempMap.put(runOrder + index * (1e-6), ref);
+ index++;
+ }
+ }
+ }
+ catch (Throwable t) {
+ Activator.getDefault().getLog().log(new Status(Status.ERROR, Activator.PLUGIN_ID, "create filter: " + className, t));
+ }
+ }
+ }
+ filters = new ArrayList<FilterConfigImpl>(tempMap.values());
+ }
+ }
+ return filters;
+ }
+
+ private static void notifyExtensionPointChanged() {
+ synchronized (filtersLock) {
+ if (filters != null) {
+ for (FilterConfigImpl ref : filters) {
+ ref.destroy();
+ }
+ }
+ filters = null;
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/security/AbstractChainableSecurityFilter.java b/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/security/AbstractChainableSecurityFilter.java
index 4308c0a8f6..10d4f227eb 100644
--- a/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/security/AbstractChainableSecurityFilter.java
+++ b/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/security/AbstractChainableSecurityFilter.java
@@ -1,231 +1,231 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.http.servletfilter.security;
-
-import java.io.IOException;
-import java.security.AccessController;
-import java.security.Principal;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-
-import javax.security.auth.Subject;
-import javax.servlet.Filter;
-import javax.servlet.FilterChain;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.commons.security.SimplePrincipal;
-import org.eclipse.scout.http.servletfilter.FilterConfigInjection;
-
-/**
- * <h4>AbstractChainableSecurityFilter</h4> The following properties can be set
- * in the <code>config.ini</code> file:
- * <ul>
- * <li><code>&lt;fully qualified name of class&gt;#active=true/false</code></li>
- * <li><code>&lt;fully qualified name of class&gt;#realm=abcde</code> <b>required</b></li>
- * <li><code>&lt;fully qualified name of class&gt;#failover=true/false</code> <b>default false</b></li>
- * </ul>
- * <p>
- * <h5>NOTE</h5> All security filters inheriting from {@link AbstractChainableSecurityFilter} are chainable. What means
- * can be used together with other Filters. The <code>runOrder</code> flag of the extension point defines the run order
- * of chainable security filters. To make this filter chainable set the flag failover to true. <b>Ensure to set the
- * failover flag on the last security filter to false!</b>
- * <p>
- * Make sure to dectivate session persistence. In tomcat: in server.xml inside <Context> tag add
- *
- * <pre>
- * &lt;Manager className="org.apache.catalina.session.StandardManager" pathname=""&gt; &lt;/Manager&gt;
- * </pre>
- *
- * @since 1.0.3 06.02.2009
- */
-public abstract class AbstractChainableSecurityFilter implements Filter {
- private static IScoutLogger LOG = ScoutLogManager.getLogger(AbstractChainableSecurityFilter.class);
- public static final String PROP_SUBJECT = Subject.class.getName();
-
- public static final int STATUS_CONTINUE_CHAIN = 1;
- public static final int STATUS_BREAK_CHAIN = 2;
- public static final int STATUS_CONTINUE_WITH_PRINCIPAL = 3;
-
- private boolean m_failover;
- private String m_realm;
- private FilterConfigInjection m_injection;
-
- public AbstractChainableSecurityFilter() {
- }
-
- /**
- * identifier for this filter.
- *
- * @rn aho, 4.6.09
- */
- protected String getFilterId() {
- return this.getClass().getSimpleName();
- }
-
- @Override
- public void init(FilterConfig config0) throws ServletException {
- m_injection = new FilterConfigInjection(config0, getClass());
- FilterConfigInjection.FilterConfig config = m_injection.getAnyConfig();
- String failoverString = config.getInitParameter("failover");
- m_failover = Boolean.parseBoolean(failoverString);
- String realmParam = config.getInitParameter("realm");
- if (realmParam == null) {
- realmParam = "Default";
- }
- m_realm = realmParam;
- }
-
- @Override
- public void destroy() {
- m_injection = null;
- }
-
- @Override
- public final void doFilter(ServletRequest in, ServletResponse out, final FilterChain chain) throws IOException, ServletException {
- //ticket 94794
- FilterConfigInjection.FilterConfig config = m_injection.getConfig(in);
- if (!config.isActive()) {
- chain.doFilter(in, out);
- return;
- }
- //
- final HttpServletRequest req = (HttpServletRequest) in;
- final HttpServletResponse res = (HttpServletResponse) out;
- //touch the session so it is effectively used
- req.getSession();
- // check subject on session
- Subject subject = null;
- synchronized (req.getSession()) {
- subject = findSubjectOnSession(req, res);
- }
- if (subject == null || subject.getPrincipals().size() == 0) {
- //try negotiate
- PrincipalHolder pHolder = new PrincipalHolder();
- switch (negotiate(req, res, pHolder)) {
- case STATUS_CONTINUE_CHAIN:
- if (m_failover) {
- chain.doFilter(req, res);
- return;
- }
- else {
- res.sendError(HttpServletResponse.SC_UNAUTHORIZED);
- return;
- }
- case STATUS_BREAK_CHAIN:
- return;
- case STATUS_CONTINUE_WITH_PRINCIPAL:
- if (subject == null || subject.isReadOnly()) {
- subject = new Subject();
- }
- subject.getPrincipals().add(pHolder.getPrincipal());
- subject.setReadOnly();
- synchronized (req.getSession()) {
- req.getSession().setAttribute(PROP_SUBJECT, subject);
- }
- break;
- }
- }
- //run in subject
- if (Subject.getSubject(AccessController.getContext()) != null) {
- doFilterInternal(req, res, chain);
- }
- else {
- try {
- Subject.doAs(subject, new PrivilegedExceptionAction<Object>() {
- @Override
- public Object run() throws Exception {
- HttpServletRequest secureReq = req;
- if (!(secureReq instanceof SecureHttpServletRequestWrapper)) {
- Principal principal = Subject.getSubject(AccessController.getContext()).getPrincipals().iterator().next();
- secureReq = new SecureHttpServletRequestWrapper(req, principal);
- }
- doFilterInternal(secureReq, res, chain);
- return null;
- }
- });
- }
- catch (PrivilegedActionException e) {
- Throwable t = e.getCause();
- if (t instanceof IOException) {
- throw (IOException) t;
- }
- else if (t instanceof ServletException) {
- throw (ServletException) t;
- }
- else {
- throw new ServletException(t);
- }
- }
- }
- }
-
- private Subject findSubjectOnSession(HttpServletRequest req, HttpServletResponse resp) {
- Object o = null;
- Subject subject = null;
- o = req.getSession().getAttribute(PROP_SUBJECT);
-
- if (o instanceof Subject) {
- subject = (Subject) o;
- }
- //check if we are already authenticated
- if (subject == null) {
- subject = Subject.getSubject(AccessController.getContext());
- }
-
- // Subject subject=Subject.getSubject(AccessController.getContext());
- if (subject == null) {
- Principal principal = req.getUserPrincipal();
- if (principal == null || principal.getName() == null || principal.getName().trim().length() == 0) {
- principal = null;
- String name = req.getRemoteUser();
- if (name != null && name.trim().length() > 0) {
- principal = new SimplePrincipal(name);
- }
- }
- if (principal != null) {
- subject = new Subject();
- subject.getPrincipals().add(principal);
- subject.setReadOnly();
- req.getSession().setAttribute(PROP_SUBJECT, subject);
- }
- }
- return subject;
- }
-
- /**
- * set the 'WWW-Authenticate' value on the response to enforce the client to provide login data.
- *
- * @param req
- * @param resp
- * @return
- */
- protected abstract int negotiate(HttpServletRequest req, HttpServletResponse resp, PrincipalHolder holder) throws IOException, ServletException;
-
- private void doFilterInternal(HttpServletRequest req, HttpServletResponse res, FilterChain chain) throws IOException, ServletException {
- chain.doFilter(req, res);
- }
-
- public String getRealm() {
- return m_realm;
- }
-
- public boolean isFailover() {
- return m_failover;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.http.servletfilter.security;
+
+import java.io.IOException;
+import java.security.AccessController;
+import java.security.Principal;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+
+import javax.security.auth.Subject;
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.commons.security.SimplePrincipal;
+import org.eclipse.scout.http.servletfilter.FilterConfigInjection;
+
+/**
+ * <h4>AbstractChainableSecurityFilter</h4> The following properties can be set
+ * in the <code>config.ini</code> file:
+ * <ul>
+ * <li><code>&lt;fully qualified name of class&gt;#active=true/false</code></li>
+ * <li><code>&lt;fully qualified name of class&gt;#realm=abcde</code> <b>required</b></li>
+ * <li><code>&lt;fully qualified name of class&gt;#failover=true/false</code> <b>default false</b></li>
+ * </ul>
+ * <p>
+ * <h5>NOTE</h5> All security filters inheriting from {@link AbstractChainableSecurityFilter} are chainable. What means
+ * can be used together with other Filters. The <code>runOrder</code> flag of the extension point defines the run order
+ * of chainable security filters. To make this filter chainable set the flag failover to true. <b>Ensure to set the
+ * failover flag on the last security filter to false!</b>
+ * <p>
+ * Make sure to dectivate session persistence. In tomcat: in server.xml inside <Context> tag add
+ *
+ * <pre>
+ * &lt;Manager className="org.apache.catalina.session.StandardManager" pathname=""&gt; &lt;/Manager&gt;
+ * </pre>
+ *
+ * @since 1.0.3 06.02.2009
+ */
+public abstract class AbstractChainableSecurityFilter implements Filter {
+ private static IScoutLogger LOG = ScoutLogManager.getLogger(AbstractChainableSecurityFilter.class);
+ public static final String PROP_SUBJECT = Subject.class.getName();
+
+ public static final int STATUS_CONTINUE_CHAIN = 1;
+ public static final int STATUS_BREAK_CHAIN = 2;
+ public static final int STATUS_CONTINUE_WITH_PRINCIPAL = 3;
+
+ private boolean m_failover;
+ private String m_realm;
+ private FilterConfigInjection m_injection;
+
+ public AbstractChainableSecurityFilter() {
+ }
+
+ /**
+ * identifier for this filter.
+ *
+ * @rn aho, 4.6.09
+ */
+ protected String getFilterId() {
+ return this.getClass().getSimpleName();
+ }
+
+ @Override
+ public void init(FilterConfig config0) throws ServletException {
+ m_injection = new FilterConfigInjection(config0, getClass());
+ FilterConfigInjection.FilterConfig config = m_injection.getAnyConfig();
+ String failoverString = config.getInitParameter("failover");
+ m_failover = Boolean.parseBoolean(failoverString);
+ String realmParam = config.getInitParameter("realm");
+ if (realmParam == null) {
+ realmParam = "Default";
+ }
+ m_realm = realmParam;
+ }
+
+ @Override
+ public void destroy() {
+ m_injection = null;
+ }
+
+ @Override
+ public final void doFilter(ServletRequest in, ServletResponse out, final FilterChain chain) throws IOException, ServletException {
+ //ticket 94794
+ FilterConfigInjection.FilterConfig config = m_injection.getConfig(in);
+ if (!config.isActive()) {
+ chain.doFilter(in, out);
+ return;
+ }
+ //
+ final HttpServletRequest req = (HttpServletRequest) in;
+ final HttpServletResponse res = (HttpServletResponse) out;
+ //touch the session so it is effectively used
+ req.getSession();
+ // check subject on session
+ Subject subject = null;
+ synchronized (req.getSession()) {
+ subject = findSubjectOnSession(req, res);
+ }
+ if (subject == null || subject.getPrincipals().size() == 0) {
+ //try negotiate
+ PrincipalHolder pHolder = new PrincipalHolder();
+ switch (negotiate(req, res, pHolder)) {
+ case STATUS_CONTINUE_CHAIN:
+ if (m_failover) {
+ chain.doFilter(req, res);
+ return;
+ }
+ else {
+ res.sendError(HttpServletResponse.SC_UNAUTHORIZED);
+ return;
+ }
+ case STATUS_BREAK_CHAIN:
+ return;
+ case STATUS_CONTINUE_WITH_PRINCIPAL:
+ if (subject == null || subject.isReadOnly()) {
+ subject = new Subject();
+ }
+ subject.getPrincipals().add(pHolder.getPrincipal());
+ subject.setReadOnly();
+ synchronized (req.getSession()) {
+ req.getSession().setAttribute(PROP_SUBJECT, subject);
+ }
+ break;
+ }
+ }
+ //run in subject
+ if (Subject.getSubject(AccessController.getContext()) != null) {
+ doFilterInternal(req, res, chain);
+ }
+ else {
+ try {
+ Subject.doAs(subject, new PrivilegedExceptionAction<Object>() {
+ @Override
+ public Object run() throws Exception {
+ HttpServletRequest secureReq = req;
+ if (!(secureReq instanceof SecureHttpServletRequestWrapper)) {
+ Principal principal = Subject.getSubject(AccessController.getContext()).getPrincipals().iterator().next();
+ secureReq = new SecureHttpServletRequestWrapper(req, principal);
+ }
+ doFilterInternal(secureReq, res, chain);
+ return null;
+ }
+ });
+ }
+ catch (PrivilegedActionException e) {
+ Throwable t = e.getCause();
+ if (t instanceof IOException) {
+ throw (IOException) t;
+ }
+ else if (t instanceof ServletException) {
+ throw (ServletException) t;
+ }
+ else {
+ throw new ServletException(t);
+ }
+ }
+ }
+ }
+
+ private Subject findSubjectOnSession(HttpServletRequest req, HttpServletResponse resp) {
+ Object o = null;
+ Subject subject = null;
+ o = req.getSession().getAttribute(PROP_SUBJECT);
+
+ if (o instanceof Subject) {
+ subject = (Subject) o;
+ }
+ //check if we are already authenticated
+ if (subject == null) {
+ subject = Subject.getSubject(AccessController.getContext());
+ }
+
+ // Subject subject=Subject.getSubject(AccessController.getContext());
+ if (subject == null) {
+ Principal principal = req.getUserPrincipal();
+ if (principal == null || principal.getName() == null || principal.getName().trim().length() == 0) {
+ principal = null;
+ String name = req.getRemoteUser();
+ if (name != null && name.trim().length() > 0) {
+ principal = new SimplePrincipal(name);
+ }
+ }
+ if (principal != null) {
+ subject = new Subject();
+ subject.getPrincipals().add(principal);
+ subject.setReadOnly();
+ req.getSession().setAttribute(PROP_SUBJECT, subject);
+ }
+ }
+ return subject;
+ }
+
+ /**
+ * set the 'WWW-Authenticate' value on the response to enforce the client to provide login data.
+ *
+ * @param req
+ * @param resp
+ * @return
+ */
+ protected abstract int negotiate(HttpServletRequest req, HttpServletResponse resp, PrincipalHolder holder) throws IOException, ServletException;
+
+ private void doFilterInternal(HttpServletRequest req, HttpServletResponse res, FilterChain chain) throws IOException, ServletException {
+ chain.doFilter(req, res);
+ }
+
+ public String getRealm() {
+ return m_realm;
+ }
+
+ public boolean isFailover() {
+ return m_failover;
+ }
+
+}
diff --git a/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/security/AnonymousSecurityFilter.java b/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/security/AnonymousSecurityFilter.java
index b1c5206fe9..67228630b6 100644
--- a/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/security/AnonymousSecurityFilter.java
+++ b/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/security/AnonymousSecurityFilter.java
@@ -1,33 +1,33 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.http.servletfilter.security;
-
-import java.io.IOException;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.eclipse.scout.commons.security.SimplePrincipal;
-
-/**
- * a security filter allowing anonymous access to the application.
- */
-public class AnonymousSecurityFilter extends AbstractChainableSecurityFilter {
- public static final String ANONYMOUS_USER_NAME = "anonymous";
-
- @Override
- protected int negotiate(HttpServletRequest req, HttpServletResponse resp, PrincipalHolder holder) throws IOException, ServletException {
- holder.setPrincipal(new SimplePrincipal(ANONYMOUS_USER_NAME));
- return STATUS_CONTINUE_WITH_PRINCIPAL;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.http.servletfilter.security;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.eclipse.scout.commons.security.SimplePrincipal;
+
+/**
+ * a security filter allowing anonymous access to the application.
+ */
+public class AnonymousSecurityFilter extends AbstractChainableSecurityFilter {
+ public static final String ANONYMOUS_USER_NAME = "anonymous";
+
+ @Override
+ protected int negotiate(HttpServletRequest req, HttpServletResponse resp, PrincipalHolder holder) throws IOException, ServletException {
+ holder.setPrincipal(new SimplePrincipal(ANONYMOUS_USER_NAME));
+ return STATUS_CONTINUE_WITH_PRINCIPAL;
+ }
+
+}
diff --git a/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/security/BasicSecurityFilter.java b/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/security/BasicSecurityFilter.java
index 1c44b1186f..19454fe221 100644
--- a/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/security/BasicSecurityFilter.java
+++ b/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/security/BasicSecurityFilter.java
@@ -1,108 +1,108 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.http.servletfilter.security;
-
-import java.io.IOException;
-import java.util.HashMap;
-
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.eclipse.scout.commons.Base64Utility;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.commons.security.SimplePrincipal;
-import org.eclipse.scout.http.servletfilter.FilterConfigInjection;
-
-/**
- * <h4>BasicSecurityFilter</h4> A simple security filter using username,password
- * tuples either set in the extension point or in the config ini.
- * <ul>
- * <li><code>&lt;fully qualified name of class&gt;#active=true/false</code> <b>might be set in the extension point</b></li>
- * <li><code>&lt;fully qualified name of class&gt;#realm=abcde</code> <b>required</b></li>
- * <li><code>&lt;fully qualified name of class&gt;#failover=true/false</code> <b>default false</b></li>
- * <li>
- * <code>&lt;fully qualified name of class&gt;#users=username1\=password1,username2\=password2</code>
- * <b>required</b></li>
- * </ul>
- * <p>
- *
- * @since 1.0.3 06.02.2009
- */
-public class BasicSecurityFilter extends AbstractChainableSecurityFilter {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(BasicSecurityFilter.class);
- public static final String PROP_BASIC_ATTEMPT = "BasicSecurityFilter.basicAttempt";
-
- private HashMap<String, String> m_userDatabase;
-
- @Override
- public void init(FilterConfig config0) throws ServletException {
- super.init(config0);
- FilterConfigInjection.FilterConfig config = new FilterConfigInjection(config0, getClass()).getAnyConfig();
- String usersParam = config.getInitParameter("users");
- if (usersParam == null) {
- throw new ServletException("missing init-param with name 'users'");
- }
- m_userDatabase = new HashMap<String, String>();
- for (String pair : usersParam.split(",")) {
- String[] a = pair.trim().split("=", 2);
- m_userDatabase.put(a[0].toLowerCase(), a[1]);
- }
- }
-
- @Override
- public void destroy() {
- m_userDatabase.clear();
- }
-
- @Override
- protected int negotiate(HttpServletRequest req, HttpServletResponse resp, PrincipalHolder holder) throws IOException, ServletException {
- String h = req.getHeader("Authorization");
- if (h != null && h.matches("Basic .*")) {
- String[] a = new String(Base64Utility.decode(h.substring(6)), "ISO-8859-1").split(":", 2);
- String user = a[0].toLowerCase();
- String pass = a[1];
- if (user != null && pass != null) {
- if (pass.equals(m_userDatabase.get(user))) {// check can also be based on
- // filter init params
- // success
- holder.setPrincipal(new SimplePrincipal(user));
- return STATUS_CONTINUE_WITH_PRINCIPAL;
- }
- }
- }
- int attempts = getBasicAttempt(req);
- if (attempts > 2) {
- return STATUS_CONTINUE_CHAIN;
- }
- else {
- setBasicAttept(req, attempts + 1);
- resp.setHeader("WWW-Authenticate", "Basic realm=\"" + getRealm() + "\"");
- return STATUS_CONTINUE_CHAIN;
- }
- }
-
- private int getBasicAttempt(HttpServletRequest req) {
- int basicAtttempt = 0;
- Object attribute = req.getSession().getAttribute(PROP_BASIC_ATTEMPT);
- if (attribute instanceof Integer) {
- basicAtttempt = ((Integer) attribute).intValue();
- }
- return basicAtttempt;
- }
-
- private void setBasicAttept(HttpServletRequest req, int attempts) {
- req.getSession().setAttribute(PROP_BASIC_ATTEMPT, attempts);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.http.servletfilter.security;
+
+import java.io.IOException;
+import java.util.HashMap;
+
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.eclipse.scout.commons.Base64Utility;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.commons.security.SimplePrincipal;
+import org.eclipse.scout.http.servletfilter.FilterConfigInjection;
+
+/**
+ * <h4>BasicSecurityFilter</h4> A simple security filter using username,password
+ * tuples either set in the extension point or in the config ini.
+ * <ul>
+ * <li><code>&lt;fully qualified name of class&gt;#active=true/false</code> <b>might be set in the extension point</b></li>
+ * <li><code>&lt;fully qualified name of class&gt;#realm=abcde</code> <b>required</b></li>
+ * <li><code>&lt;fully qualified name of class&gt;#failover=true/false</code> <b>default false</b></li>
+ * <li>
+ * <code>&lt;fully qualified name of class&gt;#users=username1\=password1,username2\=password2</code>
+ * <b>required</b></li>
+ * </ul>
+ * <p>
+ *
+ * @since 1.0.3 06.02.2009
+ */
+public class BasicSecurityFilter extends AbstractChainableSecurityFilter {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(BasicSecurityFilter.class);
+ public static final String PROP_BASIC_ATTEMPT = "BasicSecurityFilter.basicAttempt";
+
+ private HashMap<String, String> m_userDatabase;
+
+ @Override
+ public void init(FilterConfig config0) throws ServletException {
+ super.init(config0);
+ FilterConfigInjection.FilterConfig config = new FilterConfigInjection(config0, getClass()).getAnyConfig();
+ String usersParam = config.getInitParameter("users");
+ if (usersParam == null) {
+ throw new ServletException("missing init-param with name 'users'");
+ }
+ m_userDatabase = new HashMap<String, String>();
+ for (String pair : usersParam.split(",")) {
+ String[] a = pair.trim().split("=", 2);
+ m_userDatabase.put(a[0].toLowerCase(), a[1]);
+ }
+ }
+
+ @Override
+ public void destroy() {
+ m_userDatabase.clear();
+ }
+
+ @Override
+ protected int negotiate(HttpServletRequest req, HttpServletResponse resp, PrincipalHolder holder) throws IOException, ServletException {
+ String h = req.getHeader("Authorization");
+ if (h != null && h.matches("Basic .*")) {
+ String[] a = new String(Base64Utility.decode(h.substring(6)), "ISO-8859-1").split(":", 2);
+ String user = a[0].toLowerCase();
+ String pass = a[1];
+ if (user != null && pass != null) {
+ if (pass.equals(m_userDatabase.get(user))) {// check can also be based on
+ // filter init params
+ // success
+ holder.setPrincipal(new SimplePrincipal(user));
+ return STATUS_CONTINUE_WITH_PRINCIPAL;
+ }
+ }
+ }
+ int attempts = getBasicAttempt(req);
+ if (attempts > 2) {
+ return STATUS_CONTINUE_CHAIN;
+ }
+ else {
+ setBasicAttept(req, attempts + 1);
+ resp.setHeader("WWW-Authenticate", "Basic realm=\"" + getRealm() + "\"");
+ return STATUS_CONTINUE_CHAIN;
+ }
+ }
+
+ private int getBasicAttempt(HttpServletRequest req) {
+ int basicAtttempt = 0;
+ Object attribute = req.getSession().getAttribute(PROP_BASIC_ATTEMPT);
+ if (attribute instanceof Integer) {
+ basicAtttempt = ((Integer) attribute).intValue();
+ }
+ return basicAtttempt;
+ }
+
+ private void setBasicAttept(HttpServletRequest req, int attempts) {
+ req.getSession().setAttribute(PROP_BASIC_ATTEMPT, attempts);
+ }
+
+}
diff --git a/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/security/DataSourceSecurityFilter.java b/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/security/DataSourceSecurityFilter.java
index a9ee219cc1..33e4b7a4e8 100644
--- a/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/security/DataSourceSecurityFilter.java
+++ b/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/security/DataSourceSecurityFilter.java
@@ -1,271 +1,271 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.http.servletfilter.security;
-
-import java.io.IOException;
-import java.security.NoSuchAlgorithmException;
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.Hashtable;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.sql.DataSource;
-
-import org.eclipse.scout.commons.Base64Utility;
-import org.eclipse.scout.commons.EncryptionUtility;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.commons.security.SimplePrincipal;
-import org.eclipse.scout.http.servletfilter.FilterConfigInjection;
-
-/**
- * <h4>DataSourceSecurityFilter</h4> The following properties can be set in the <code>config.ini</code> file:
- * <ul>
- * <li><code>&lt;fully qualified name of class&gt;#active=true/false</code> <b>might be set in the extension point</b></li>
- * <li><code>&lt;fully qualified name of class&gt;#realm=abcde</code> <b>required</b></li>
- * <li><code>&lt;fully qualified name of class&gt;#failover=true/false</code> <b>default false</b></li>
- * <li>
- * <code>&lt;fully qualified name of class&gt;#jdbcDriverName=[e.g. oracle.jdbc.OracleDriver]</code> <b>required for
- * JDBC</b></li>
- * <li>
- * <code>&lt;fully qualified name of class&gt;#jdbcMappingName=[e.g. jdbc:oracle:thin:@dbUrl:1521:DBNAME]</code>
- * <b>required for JDBC</b></li>
- * <li><code>&lt;fully qualified name of class&gt;#jdbcUsername=USER</code> <b>required for JDBC, optional JNDI</b></li>
- * <li><code>&lt;fully qualified name of class&gt;#jdbcPassword=PASS</code> <b>required for JDBC, optional JNDI</b></li>
- * <li><code>&lt;fully qualified name of class&gt;#selectUserPass=<br>
- * [e.g. SELECT LOWER(USERNAME) FROM ORS_WEB_USER WHERE ACCOUNT_LOCKED=0 AND NVL(EVT_ACCOUNT_EXPIRY,SYSDATE)>=SYSDATE AND LOWER(USERNAME)=? AND PASSWORD=?]</code>
- * <b>required</b></li>
- * <li>
- * <code>&lt;fully qualified name of class&gt;#useJndiConnection=false</code> <b>default false</b></li>
- * <li>
- * <code>&lt;fully qualified name of class&gt;#jndiName=[e.g. jdbc/jndiDbname]</code> <b>required for JNDI</b></li>
- * <li>
- * <code>&lt;fully qualified name of class&gt;#jndiInitialContextFactory=</code></li>
- * <li><code>&lt;fully qualified name of class&gt;#jndiProviderUrl=</code></li>
- * <li><code>&lt;fully qualified name of class&gt;#jndiUrlPkgPrefixes=</code></li>
- * </ul>
- * <p>
- * , Michael Rudolf
- *
- * @since 1.0.3 06.02.2009
- */
-public class DataSourceSecurityFilter extends AbstractChainableSecurityFilter {
-
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(DataSourceSecurityFilter.class);
- public static final String PROP_BASIC_ATTEMPT = "DataSourceSecurityFilter.basicAttempt";
-
- // init params
- private String m_jdbcUserName;
- private String m_jdbcPassword;
-
- private String m_jdbcDriverName;
- private String m_jdbcMappingName;
- private String m_selectStatement;
-
- private boolean m_useJndiConnection;
- private String m_jndiName;
- private String m_jndiInitialContextFactory;
- private String m_jndiProviderUrl;
- private String m_jndiUrlPkgPrefixes;
-
- @Override
- public void init(FilterConfig config0) throws ServletException {
- super.init(config0);
- FilterConfigInjection.FilterConfig config = new FilterConfigInjection(config0, getClass()).getAnyConfig();
-
- String useJndiConnectionString = config.getInitParameter("useJndiConnection");
- m_useJndiConnection = Boolean.parseBoolean(useJndiConnectionString);
-
- m_jdbcDriverName = getInitParam(config, "jdbcDriverName", !m_useJndiConnection);
- m_jdbcMappingName = getInitParam(config, "jdbcMappingName", !m_useJndiConnection);
- m_jdbcUserName = getInitParam(config, "jdbcUsername", false);
- m_jdbcPassword = getInitParam(config, "jdbcPassword", false);
- m_selectStatement = getInitParam(config, "selectUserPass", !m_useJndiConnection);
- m_jndiName = getInitParam(config, "jndiName", m_useJndiConnection);
- m_jndiInitialContextFactory = config.getInitParameter("jndiInitialContextFactory");
- m_jndiProviderUrl = config.getInitParameter("jndiProviderUrl");
- m_jndiUrlPkgPrefixes = config.getInitParameter("jndiUrlPkgPrefixes");
- }
-
- private String getInitParam(FilterConfig filterConfig, String paramName, boolean requierd) throws ServletException {
- String paramValue = filterConfig.getInitParameter(paramName);
- if (requierd && paramValue == null) {
- throw new ServletException("Missing init-param with name '" + paramName + "'.");
- }
- return paramValue;
- }
-
- @Override
- protected int negotiate(HttpServletRequest req, HttpServletResponse resp, PrincipalHolder holder) throws IOException, ServletException {
- String h = req.getHeader("Authorization");
- if (h != null && h.matches("Basic .*")) {
- String[] a = new String(Base64Utility.decode(h.substring(6)), "ISO-8859-1").split(":", 2);
- String user = a[0].toLowerCase();
- String pass = a[1];
- if (user != null && pass != null) {
- String passEncrypted = encryptPass(pass);
- if (isValidUser(user, passEncrypted)) {
- holder.setPrincipal(new SimplePrincipal(user));
- return STATUS_CONTINUE_WITH_PRINCIPAL;
- }
- }
- }
- int attempts = getBasicAttempt(req);
- if (attempts > 2) {
- return STATUS_CONTINUE_CHAIN;
- }
- else {
- setBasicAttept(req, attempts + 1);
- resp.setHeader("WWW-Authenticate", "Basic realm=\"" + getRealm() + "\"");
- return STATUS_CONTINUE_CHAIN;
- }
- }
-
- private int getBasicAttempt(HttpServletRequest req) {
- int basicAtttempt = 0;
- Object attribute = req.getSession().getAttribute(PROP_BASIC_ATTEMPT);
- if (attribute instanceof Integer) {
- basicAtttempt = ((Integer) attribute).intValue();
- }
- return basicAtttempt;
- }
-
- private void setBasicAttept(HttpServletRequest req, int attempts) {
- req.getSession().setAttribute(PROP_BASIC_ATTEMPT, attempts);
- }
-
- protected boolean isValidUser(String username, String password) throws ServletException {
- Connection databaseConnection = null;
- try {
-
- if (m_useJndiConnection) {
- databaseConnection = createJndiConnection();
- }
- else {
- databaseConnection = createJdbcDirectConnection();
- }
- return isValidUser(username, password, databaseConnection);
-
- }
- catch (Exception e) {
- LOG.error("Cannot SELECT user/pass.", e);
- throw new ServletException(e.getMessage(), e);
- }
- finally {
- try {
- if (databaseConnection != null) {
- databaseConnection.close();
- databaseConnection = null;
- }
- }
- catch (SQLException e) {
- LOG.warn("Exception in close connection!", e);
- }
- }
- }
-
- protected boolean isValidUser(String username, String password, Connection connection) throws SQLException {
- PreparedStatement stmt = null;
- try {
- stmt = connection.prepareStatement(m_selectStatement);
- stmt.setString(1, username);
- stmt.setString(2, password);
- stmt.execute();
- ResultSet resultSet = stmt.getResultSet();
- return (resultSet.next() && resultSet.getString(1).equals(username));
- }
- finally {
- try {
- if (stmt != null) {
- stmt.close();
- stmt = null;
- }
- }
- catch (SQLException e) {
- LOG.warn("Exception in close stmt!", e);
- }
- }
- }
-
- protected String encryptPass(String pass) throws ServletException {
- String passEncrypted = null;
- if (pass != null) {
- try {
- passEncrypted = Base64Utility.encode(EncryptionUtility.signMD5(pass.getBytes()));
- }
- catch (NoSuchAlgorithmException e) {
- LOG.error("couldn't create the password", e);
- throw new ServletException("couldn't create the password", e);
- }
- }
- return passEncrypted;
- }
-
- protected Connection createJdbcDirectConnection() throws ClassNotFoundException, SQLException {
- Class.forName(m_jdbcDriverName);
- return DriverManager.getConnection(m_jdbcMappingName, m_jdbcUserName, m_jdbcPassword);
- }
-
- protected Connection createJndiConnection() throws NamingException, SQLException {
- InitialContext initialContext = null;
-
- String jndiName = m_jndiName;
- String jndiInitialContextFactory = m_jndiInitialContextFactory;
- String jndiProviderUrl = m_jndiProviderUrl;
- String jndiUrlPkgPrefixes = m_jndiUrlPkgPrefixes;
- if (LOG.isInfoEnabled()) {
- LOG.info("Opening rmi connection to: " + jndiName + "," + m_jdbcUserName);
- }
- if (LOG.isInfoEnabled()) {
- LOG.info(" using initial context factory: " + jndiInitialContextFactory);
- }
- if (LOG.isInfoEnabled()) {
- LOG.info(" using provider url: " + jndiProviderUrl);
- }
- Hashtable<String, String> ht = new Hashtable<String, String>();
- if (jndiInitialContextFactory != null) {
- ht.put(Context.INITIAL_CONTEXT_FACTORY, jndiInitialContextFactory);
- }
- if (jndiProviderUrl != null) {
- ht.put(Context.PROVIDER_URL, jndiProviderUrl);
- }
- if (jndiUrlPkgPrefixes != null) {
- ht.put(Context.URL_PKG_PREFIXES, jndiUrlPkgPrefixes);
- }
- DataSource dataSource = null;
- if (ht.size() > 0) {
- initialContext = new InitialContext(ht);
- }
- else {
- initialContext = new InitialContext();
- }
- dataSource = (DataSource) initialContext.lookup(jndiName);
- // Grab a connection
- Connection conn;
- if (m_jdbcUserName != null && m_jdbcPassword != null) {
- conn = dataSource.getConnection(m_jdbcUserName, m_jdbcPassword);
- }
- else {
- conn = dataSource.getConnection();
- }
- conn.setAutoCommit(false);
- return conn;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.http.servletfilter.security;
+
+import java.io.IOException;
+import java.security.NoSuchAlgorithmException;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.Hashtable;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.sql.DataSource;
+
+import org.eclipse.scout.commons.Base64Utility;
+import org.eclipse.scout.commons.EncryptionUtility;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.commons.security.SimplePrincipal;
+import org.eclipse.scout.http.servletfilter.FilterConfigInjection;
+
+/**
+ * <h4>DataSourceSecurityFilter</h4> The following properties can be set in the <code>config.ini</code> file:
+ * <ul>
+ * <li><code>&lt;fully qualified name of class&gt;#active=true/false</code> <b>might be set in the extension point</b></li>
+ * <li><code>&lt;fully qualified name of class&gt;#realm=abcde</code> <b>required</b></li>
+ * <li><code>&lt;fully qualified name of class&gt;#failover=true/false</code> <b>default false</b></li>
+ * <li>
+ * <code>&lt;fully qualified name of class&gt;#jdbcDriverName=[e.g. oracle.jdbc.OracleDriver]</code> <b>required for
+ * JDBC</b></li>
+ * <li>
+ * <code>&lt;fully qualified name of class&gt;#jdbcMappingName=[e.g. jdbc:oracle:thin:@dbUrl:1521:DBNAME]</code>
+ * <b>required for JDBC</b></li>
+ * <li><code>&lt;fully qualified name of class&gt;#jdbcUsername=USER</code> <b>required for JDBC, optional JNDI</b></li>
+ * <li><code>&lt;fully qualified name of class&gt;#jdbcPassword=PASS</code> <b>required for JDBC, optional JNDI</b></li>
+ * <li><code>&lt;fully qualified name of class&gt;#selectUserPass=<br>
+ * [e.g. SELECT LOWER(USERNAME) FROM ORS_WEB_USER WHERE ACCOUNT_LOCKED=0 AND NVL(EVT_ACCOUNT_EXPIRY,SYSDATE)>=SYSDATE AND LOWER(USERNAME)=? AND PASSWORD=?]</code>
+ * <b>required</b></li>
+ * <li>
+ * <code>&lt;fully qualified name of class&gt;#useJndiConnection=false</code> <b>default false</b></li>
+ * <li>
+ * <code>&lt;fully qualified name of class&gt;#jndiName=[e.g. jdbc/jndiDbname]</code> <b>required for JNDI</b></li>
+ * <li>
+ * <code>&lt;fully qualified name of class&gt;#jndiInitialContextFactory=</code></li>
+ * <li><code>&lt;fully qualified name of class&gt;#jndiProviderUrl=</code></li>
+ * <li><code>&lt;fully qualified name of class&gt;#jndiUrlPkgPrefixes=</code></li>
+ * </ul>
+ * <p>
+ * , Michael Rudolf
+ *
+ * @since 1.0.3 06.02.2009
+ */
+public class DataSourceSecurityFilter extends AbstractChainableSecurityFilter {
+
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(DataSourceSecurityFilter.class);
+ public static final String PROP_BASIC_ATTEMPT = "DataSourceSecurityFilter.basicAttempt";
+
+ // init params
+ private String m_jdbcUserName;
+ private String m_jdbcPassword;
+
+ private String m_jdbcDriverName;
+ private String m_jdbcMappingName;
+ private String m_selectStatement;
+
+ private boolean m_useJndiConnection;
+ private String m_jndiName;
+ private String m_jndiInitialContextFactory;
+ private String m_jndiProviderUrl;
+ private String m_jndiUrlPkgPrefixes;
+
+ @Override
+ public void init(FilterConfig config0) throws ServletException {
+ super.init(config0);
+ FilterConfigInjection.FilterConfig config = new FilterConfigInjection(config0, getClass()).getAnyConfig();
+
+ String useJndiConnectionString = config.getInitParameter("useJndiConnection");
+ m_useJndiConnection = Boolean.parseBoolean(useJndiConnectionString);
+
+ m_jdbcDriverName = getInitParam(config, "jdbcDriverName", !m_useJndiConnection);
+ m_jdbcMappingName = getInitParam(config, "jdbcMappingName", !m_useJndiConnection);
+ m_jdbcUserName = getInitParam(config, "jdbcUsername", false);
+ m_jdbcPassword = getInitParam(config, "jdbcPassword", false);
+ m_selectStatement = getInitParam(config, "selectUserPass", !m_useJndiConnection);
+ m_jndiName = getInitParam(config, "jndiName", m_useJndiConnection);
+ m_jndiInitialContextFactory = config.getInitParameter("jndiInitialContextFactory");
+ m_jndiProviderUrl = config.getInitParameter("jndiProviderUrl");
+ m_jndiUrlPkgPrefixes = config.getInitParameter("jndiUrlPkgPrefixes");
+ }
+
+ private String getInitParam(FilterConfig filterConfig, String paramName, boolean requierd) throws ServletException {
+ String paramValue = filterConfig.getInitParameter(paramName);
+ if (requierd && paramValue == null) {
+ throw new ServletException("Missing init-param with name '" + paramName + "'.");
+ }
+ return paramValue;
+ }
+
+ @Override
+ protected int negotiate(HttpServletRequest req, HttpServletResponse resp, PrincipalHolder holder) throws IOException, ServletException {
+ String h = req.getHeader("Authorization");
+ if (h != null && h.matches("Basic .*")) {
+ String[] a = new String(Base64Utility.decode(h.substring(6)), "ISO-8859-1").split(":", 2);
+ String user = a[0].toLowerCase();
+ String pass = a[1];
+ if (user != null && pass != null) {
+ String passEncrypted = encryptPass(pass);
+ if (isValidUser(user, passEncrypted)) {
+ holder.setPrincipal(new SimplePrincipal(user));
+ return STATUS_CONTINUE_WITH_PRINCIPAL;
+ }
+ }
+ }
+ int attempts = getBasicAttempt(req);
+ if (attempts > 2) {
+ return STATUS_CONTINUE_CHAIN;
+ }
+ else {
+ setBasicAttept(req, attempts + 1);
+ resp.setHeader("WWW-Authenticate", "Basic realm=\"" + getRealm() + "\"");
+ return STATUS_CONTINUE_CHAIN;
+ }
+ }
+
+ private int getBasicAttempt(HttpServletRequest req) {
+ int basicAtttempt = 0;
+ Object attribute = req.getSession().getAttribute(PROP_BASIC_ATTEMPT);
+ if (attribute instanceof Integer) {
+ basicAtttempt = ((Integer) attribute).intValue();
+ }
+ return basicAtttempt;
+ }
+
+ private void setBasicAttept(HttpServletRequest req, int attempts) {
+ req.getSession().setAttribute(PROP_BASIC_ATTEMPT, attempts);
+ }
+
+ protected boolean isValidUser(String username, String password) throws ServletException {
+ Connection databaseConnection = null;
+ try {
+
+ if (m_useJndiConnection) {
+ databaseConnection = createJndiConnection();
+ }
+ else {
+ databaseConnection = createJdbcDirectConnection();
+ }
+ return isValidUser(username, password, databaseConnection);
+
+ }
+ catch (Exception e) {
+ LOG.error("Cannot SELECT user/pass.", e);
+ throw new ServletException(e.getMessage(), e);
+ }
+ finally {
+ try {
+ if (databaseConnection != null) {
+ databaseConnection.close();
+ databaseConnection = null;
+ }
+ }
+ catch (SQLException e) {
+ LOG.warn("Exception in close connection!", e);
+ }
+ }
+ }
+
+ protected boolean isValidUser(String username, String password, Connection connection) throws SQLException {
+ PreparedStatement stmt = null;
+ try {
+ stmt = connection.prepareStatement(m_selectStatement);
+ stmt.setString(1, username);
+ stmt.setString(2, password);
+ stmt.execute();
+ ResultSet resultSet = stmt.getResultSet();
+ return (resultSet.next() && resultSet.getString(1).equals(username));
+ }
+ finally {
+ try {
+ if (stmt != null) {
+ stmt.close();
+ stmt = null;
+ }
+ }
+ catch (SQLException e) {
+ LOG.warn("Exception in close stmt!", e);
+ }
+ }
+ }
+
+ protected String encryptPass(String pass) throws ServletException {
+ String passEncrypted = null;
+ if (pass != null) {
+ try {
+ passEncrypted = Base64Utility.encode(EncryptionUtility.signMD5(pass.getBytes()));
+ }
+ catch (NoSuchAlgorithmException e) {
+ LOG.error("couldn't create the password", e);
+ throw new ServletException("couldn't create the password", e);
+ }
+ }
+ return passEncrypted;
+ }
+
+ protected Connection createJdbcDirectConnection() throws ClassNotFoundException, SQLException {
+ Class.forName(m_jdbcDriverName);
+ return DriverManager.getConnection(m_jdbcMappingName, m_jdbcUserName, m_jdbcPassword);
+ }
+
+ protected Connection createJndiConnection() throws NamingException, SQLException {
+ InitialContext initialContext = null;
+
+ String jndiName = m_jndiName;
+ String jndiInitialContextFactory = m_jndiInitialContextFactory;
+ String jndiProviderUrl = m_jndiProviderUrl;
+ String jndiUrlPkgPrefixes = m_jndiUrlPkgPrefixes;
+ if (LOG.isInfoEnabled()) {
+ LOG.info("Opening rmi connection to: " + jndiName + "," + m_jdbcUserName);
+ }
+ if (LOG.isInfoEnabled()) {
+ LOG.info(" using initial context factory: " + jndiInitialContextFactory);
+ }
+ if (LOG.isInfoEnabled()) {
+ LOG.info(" using provider url: " + jndiProviderUrl);
+ }
+ Hashtable<String, String> ht = new Hashtable<String, String>();
+ if (jndiInitialContextFactory != null) {
+ ht.put(Context.INITIAL_CONTEXT_FACTORY, jndiInitialContextFactory);
+ }
+ if (jndiProviderUrl != null) {
+ ht.put(Context.PROVIDER_URL, jndiProviderUrl);
+ }
+ if (jndiUrlPkgPrefixes != null) {
+ ht.put(Context.URL_PKG_PREFIXES, jndiUrlPkgPrefixes);
+ }
+ DataSource dataSource = null;
+ if (ht.size() > 0) {
+ initialContext = new InitialContext(ht);
+ }
+ else {
+ initialContext = new InitialContext();
+ }
+ dataSource = (DataSource) initialContext.lookup(jndiName);
+ // Grab a connection
+ Connection conn;
+ if (m_jdbcUserName != null && m_jdbcPassword != null) {
+ conn = dataSource.getConnection(m_jdbcUserName, m_jdbcPassword);
+ }
+ else {
+ conn = dataSource.getConnection();
+ }
+ conn.setAutoCommit(false);
+ return conn;
+ }
+}
diff --git a/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/security/LDAPSecurityFilter.java b/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/security/LDAPSecurityFilter.java
index 1dfd9357dd..a69eefdf85 100644
--- a/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/security/LDAPSecurityFilter.java
+++ b/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/security/LDAPSecurityFilter.java
@@ -1,237 +1,237 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.http.servletfilter.security;
-
-import java.io.IOException;
-import java.util.Enumeration;
-import java.util.Hashtable;
-
-import javax.naming.Context;
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.DirContext;
-import javax.naming.directory.InitialDirContext;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.eclipse.scout.commons.Base64Utility;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.http.servletfilter.FilterConfigInjection;
-import org.eclipse.scout.commons.security.SimplePrincipal;
-
-/**
- * <h4>LDAPSecurityFilter</h4> The following properties can be set in the <code>config.ini</code> file:
- * <ul>
- * <li><code>&lt;fully qualified name of class&gt;#active=true/false</code> <b>might be set in the extension point</b></li>
- * <li><code>&lt;fully qualified name of class&gt;#realm=abcde</code> <b>required</b></li>
- * <li><code>&lt;fully qualified name of class&gt;#failover=true/false</code> <b>default false</b></li>
- * <li>
- * <code>&lt;fully qualified name of class&gt;#ldapServer=[e.g. ldap://100.100.29.4]</code> <b>required</b></li>
- * <li>
- * <code>&lt;fully qualified name of class&gt;#ldapBaseDN=[e.g. o=bsiag]</code> <b>required</b></li>
- * <li>
- * <code>&lt;fully qualified name of class&gt;#lDAPgroupDN=[e.g. ou=bsi_baden,ou=bsi_bern]</code> <b>required</b></li>
- * <li>
- * <code>&lt;fully qualified name of class&gt;#lDAPgroupAttributeId=[e.g. cn]</code> <b>required</b></li>
- * </ul>
- * <p>
- *
- * @since 1.0.0 02.07.2008
- */
-public class LDAPSecurityFilter extends AbstractChainableSecurityFilter {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(LDAPSecurityFilter.class);
- public static final String PROP_BASIC_ATTEMPT = "LDAPSecurityFilter.basicAttempt";
-
- private String m_serverUrl;
- private String m_baseDn;
- private String m_groupDn;
- private String m_groupAttr;
-
- public LDAPSecurityFilter() {
- }
-
- @Override
- public void init(FilterConfig config0) throws ServletException {
- super.init(config0);
- FilterConfigInjection.FilterConfig config = new FilterConfigInjection(config0, getClass()).getAnyConfig();
- m_serverUrl = getParam(config, "ldapServer", false);
- m_baseDn = getParam(config, "ldapBaseDN", true);
- m_groupDn = getParam(config, "lDAPgroupDN", true);
- m_groupAttr = getParam(config, "lDAPgroupAttributeId", true);
- }
-
- protected String getParam(FilterConfig filterConfig, String paramName, boolean nullAllowed) throws ServletException {
- String paramValue = filterConfig.getInitParameter(paramName);
- boolean exists = false;
- if (paramValue == null && nullAllowed) { // check if parameter exists
- Enumeration initParameterNames = filterConfig.getInitParameterNames();
- while (initParameterNames.hasMoreElements() && exists == false) {
- String object = (String) initParameterNames.nextElement();
- exists = object.equals(paramName);
- }
- }
- if (paramValue == null && !exists) {
- throw new ServletException("Missing init-param with name '" + paramName + "'.");
- }
- return paramValue;
- }
-
- @Override
- protected int negotiate(HttpServletRequest req, HttpServletResponse resp, PrincipalHolder holder) throws IOException, ServletException {
- String h = req.getHeader("Authorization");
- if (h != null && h.matches("Basic .*")) {
- String[] a = new String(Base64Utility.decode(h.substring(6)), "ISO-8859-1").split(":", 2);
- String user = a[0].toLowerCase();
- String pass = a[1];
- if (user != null && pass != null) {
- if (ldapLogin(m_serverUrl, m_baseDn, m_groupDn, m_groupAttr, user, pass, false/*
- * show
- * exceptions
- */)) {
- // success
- holder.setPrincipal(new SimplePrincipal(user));
- return STATUS_CONTINUE_WITH_PRINCIPAL;
- }
- }
- }
- int attempts = getBasicAttempt(req);
- if (attempts > 2) {
- return STATUS_CONTINUE_CHAIN;
- }
- else {
- setBasicAttept(req, attempts + 1);
- resp.setHeader("WWW-Authenticate", "Basic realm=\"" + getRealm() + "\"");
- return STATUS_CONTINUE_CHAIN;
- }
- }
-
- private int getBasicAttempt(HttpServletRequest req) {
- int basicAtttempt = 0;
- Object attribute = req.getSession().getAttribute(PROP_BASIC_ATTEMPT);
- if (attribute instanceof Integer) {
- basicAtttempt = ((Integer) attribute).intValue();
- }
- return basicAtttempt;
- }
-
- private void setBasicAttept(HttpServletRequest req, int attempts) {
- req.getSession().setAttribute(PROP_BASIC_ATTEMPT, attempts);
- }
-
- /**
- * @param username
- * e.g. KippingSte
- * @param server
- * e.g. ldap://172.20.1.21
- * @param baseDN
- * e.g. o=hermes
- * @param groupDN
- * e.g. cn=AGENTS,ou=ks,ou=lm,ou=hlg,ou=zentrale <br>
- * The user DN is defined within this group
- * @param attributeId
- * e.g. equivalentToMe <br>
- * Name of the user DN attribute
- * @return something like
- * "cn=KippingSte,ou=KS,ou=LM,ou=HLG,ou=ZENTRALE,o=HERMES"
- * @throws ServletException
- */
- @SuppressWarnings("unchecked")
- protected String getUserDN(String username, String server, String baseDN, String groupDN, String attributeId) throws ServletException {
-
- String userDN = "";
- Hashtable env = new Hashtable();
- env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
- env.put(Context.PROVIDER_URL, server + "/" + baseDN);
- env.put(Context.SECURITY_PRINCIPAL, "" + "=" + "" + "," + "" + "," + baseDN);
- env.put(Context.SECURITY_CREDENTIALS, "");
- env.put(Context.LANGUAGE, "de");
-
- try {
- DirContext ldap = new InitialDirContext(env);
- Attributes attrs = ldap.getAttributes(groupDN, new String[]{attributeId});
- NamingEnumeration<? extends Attribute> equivalentToMe = attrs.getAll();
-
- Attribute attr = null;
- NamingEnumeration<?> allValues = null;
- String dn = null;
- String un = "";
- String[] parts;
- while (equivalentToMe.hasMore()) {
- attr = equivalentToMe.next();
-
- allValues = attr.getAll();
-
- while (allValues.hasMore()) {
- // dn is something like
- // "cn=KippingSte,ou=KS,ou=LM,ou=HLG,ou=ZENTRALE,o=HERMES"
- dn = (String) allValues.next();
- // extract userName (e.g. "BulinskyMir")
- if (dn.length() > 4) {
- un = dn.substring(3);
- parts = un.split(",");
- if (parts.length > 1) {
- un = parts[0].toLowerCase();
- if (username.equals(un)) {
- userDN = dn;
- break;
- }
- }
- }
- }
- }
-
- }
- catch (NamingException ne) {
- LOG.error("Exception in getting user DN from LDAP: " + ne);
- throw new SecurityException(ne.getMessage(), ne);
- }
- return userDN;
- }
-
- @SuppressWarnings("unchecked")
- private boolean ldapLogin(
- String server,
- String baseDN,
- String groupDN,
- String groupAttr,
- String username,
- String password,
- boolean showexceptions) throws ServletException {
-
- String userDN = getUserDN(username, server, baseDN, groupDN, groupAttr);
- if (userDN.equals("")) {
- return false;
- }
- Hashtable env = new Hashtable();
- env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
- env.put(Context.PROVIDER_URL, server + "/" + baseDN);
- env.put(Context.SECURITY_PRINCIPAL, userDN);
- env.put(Context.SECURITY_CREDENTIALS, password);
- env.put(Context.LANGUAGE, "de");
-
- try {
- new InitialDirContext(env);
- return true;
- }
- catch (NamingException ne) {
- if (showexceptions) {
- ne.printStackTrace();
- }
- return false;
- }
-
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.http.servletfilter.security;
+
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.Hashtable;
+
+import javax.naming.Context;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.DirContext;
+import javax.naming.directory.InitialDirContext;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.eclipse.scout.commons.Base64Utility;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.http.servletfilter.FilterConfigInjection;
+import org.eclipse.scout.commons.security.SimplePrincipal;
+
+/**
+ * <h4>LDAPSecurityFilter</h4> The following properties can be set in the <code>config.ini</code> file:
+ * <ul>
+ * <li><code>&lt;fully qualified name of class&gt;#active=true/false</code> <b>might be set in the extension point</b></li>
+ * <li><code>&lt;fully qualified name of class&gt;#realm=abcde</code> <b>required</b></li>
+ * <li><code>&lt;fully qualified name of class&gt;#failover=true/false</code> <b>default false</b></li>
+ * <li>
+ * <code>&lt;fully qualified name of class&gt;#ldapServer=[e.g. ldap://100.100.29.4]</code> <b>required</b></li>
+ * <li>
+ * <code>&lt;fully qualified name of class&gt;#ldapBaseDN=[e.g. o=bsiag]</code> <b>required</b></li>
+ * <li>
+ * <code>&lt;fully qualified name of class&gt;#lDAPgroupDN=[e.g. ou=bsi_baden,ou=bsi_bern]</code> <b>required</b></li>
+ * <li>
+ * <code>&lt;fully qualified name of class&gt;#lDAPgroupAttributeId=[e.g. cn]</code> <b>required</b></li>
+ * </ul>
+ * <p>
+ *
+ * @since 1.0.0 02.07.2008
+ */
+public class LDAPSecurityFilter extends AbstractChainableSecurityFilter {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(LDAPSecurityFilter.class);
+ public static final String PROP_BASIC_ATTEMPT = "LDAPSecurityFilter.basicAttempt";
+
+ private String m_serverUrl;
+ private String m_baseDn;
+ private String m_groupDn;
+ private String m_groupAttr;
+
+ public LDAPSecurityFilter() {
+ }
+
+ @Override
+ public void init(FilterConfig config0) throws ServletException {
+ super.init(config0);
+ FilterConfigInjection.FilterConfig config = new FilterConfigInjection(config0, getClass()).getAnyConfig();
+ m_serverUrl = getParam(config, "ldapServer", false);
+ m_baseDn = getParam(config, "ldapBaseDN", true);
+ m_groupDn = getParam(config, "lDAPgroupDN", true);
+ m_groupAttr = getParam(config, "lDAPgroupAttributeId", true);
+ }
+
+ protected String getParam(FilterConfig filterConfig, String paramName, boolean nullAllowed) throws ServletException {
+ String paramValue = filterConfig.getInitParameter(paramName);
+ boolean exists = false;
+ if (paramValue == null && nullAllowed) { // check if parameter exists
+ Enumeration initParameterNames = filterConfig.getInitParameterNames();
+ while (initParameterNames.hasMoreElements() && exists == false) {
+ String object = (String) initParameterNames.nextElement();
+ exists = object.equals(paramName);
+ }
+ }
+ if (paramValue == null && !exists) {
+ throw new ServletException("Missing init-param with name '" + paramName + "'.");
+ }
+ return paramValue;
+ }
+
+ @Override
+ protected int negotiate(HttpServletRequest req, HttpServletResponse resp, PrincipalHolder holder) throws IOException, ServletException {
+ String h = req.getHeader("Authorization");
+ if (h != null && h.matches("Basic .*")) {
+ String[] a = new String(Base64Utility.decode(h.substring(6)), "ISO-8859-1").split(":", 2);
+ String user = a[0].toLowerCase();
+ String pass = a[1];
+ if (user != null && pass != null) {
+ if (ldapLogin(m_serverUrl, m_baseDn, m_groupDn, m_groupAttr, user, pass, false/*
+ * show
+ * exceptions
+ */)) {
+ // success
+ holder.setPrincipal(new SimplePrincipal(user));
+ return STATUS_CONTINUE_WITH_PRINCIPAL;
+ }
+ }
+ }
+ int attempts = getBasicAttempt(req);
+ if (attempts > 2) {
+ return STATUS_CONTINUE_CHAIN;
+ }
+ else {
+ setBasicAttept(req, attempts + 1);
+ resp.setHeader("WWW-Authenticate", "Basic realm=\"" + getRealm() + "\"");
+ return STATUS_CONTINUE_CHAIN;
+ }
+ }
+
+ private int getBasicAttempt(HttpServletRequest req) {
+ int basicAtttempt = 0;
+ Object attribute = req.getSession().getAttribute(PROP_BASIC_ATTEMPT);
+ if (attribute instanceof Integer) {
+ basicAtttempt = ((Integer) attribute).intValue();
+ }
+ return basicAtttempt;
+ }
+
+ private void setBasicAttept(HttpServletRequest req, int attempts) {
+ req.getSession().setAttribute(PROP_BASIC_ATTEMPT, attempts);
+ }
+
+ /**
+ * @param username
+ * e.g. KippingSte
+ * @param server
+ * e.g. ldap://172.20.1.21
+ * @param baseDN
+ * e.g. o=hermes
+ * @param groupDN
+ * e.g. cn=AGENTS,ou=ks,ou=lm,ou=hlg,ou=zentrale <br>
+ * The user DN is defined within this group
+ * @param attributeId
+ * e.g. equivalentToMe <br>
+ * Name of the user DN attribute
+ * @return something like
+ * "cn=KippingSte,ou=KS,ou=LM,ou=HLG,ou=ZENTRALE,o=HERMES"
+ * @throws ServletException
+ */
+ @SuppressWarnings("unchecked")
+ protected String getUserDN(String username, String server, String baseDN, String groupDN, String attributeId) throws ServletException {
+
+ String userDN = "";
+ Hashtable env = new Hashtable();
+ env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
+ env.put(Context.PROVIDER_URL, server + "/" + baseDN);
+ env.put(Context.SECURITY_PRINCIPAL, "" + "=" + "" + "," + "" + "," + baseDN);
+ env.put(Context.SECURITY_CREDENTIALS, "");
+ env.put(Context.LANGUAGE, "de");
+
+ try {
+ DirContext ldap = new InitialDirContext(env);
+ Attributes attrs = ldap.getAttributes(groupDN, new String[]{attributeId});
+ NamingEnumeration<? extends Attribute> equivalentToMe = attrs.getAll();
+
+ Attribute attr = null;
+ NamingEnumeration<?> allValues = null;
+ String dn = null;
+ String un = "";
+ String[] parts;
+ while (equivalentToMe.hasMore()) {
+ attr = equivalentToMe.next();
+
+ allValues = attr.getAll();
+
+ while (allValues.hasMore()) {
+ // dn is something like
+ // "cn=KippingSte,ou=KS,ou=LM,ou=HLG,ou=ZENTRALE,o=HERMES"
+ dn = (String) allValues.next();
+ // extract userName (e.g. "BulinskyMir")
+ if (dn.length() > 4) {
+ un = dn.substring(3);
+ parts = un.split(",");
+ if (parts.length > 1) {
+ un = parts[0].toLowerCase();
+ if (username.equals(un)) {
+ userDN = dn;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ }
+ catch (NamingException ne) {
+ LOG.error("Exception in getting user DN from LDAP: " + ne);
+ throw new SecurityException(ne.getMessage(), ne);
+ }
+ return userDN;
+ }
+
+ @SuppressWarnings("unchecked")
+ private boolean ldapLogin(
+ String server,
+ String baseDN,
+ String groupDN,
+ String groupAttr,
+ String username,
+ String password,
+ boolean showexceptions) throws ServletException {
+
+ String userDN = getUserDN(username, server, baseDN, groupDN, groupAttr);
+ if (userDN.equals("")) {
+ return false;
+ }
+ Hashtable env = new Hashtable();
+ env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
+ env.put(Context.PROVIDER_URL, server + "/" + baseDN);
+ env.put(Context.SECURITY_PRINCIPAL, userDN);
+ env.put(Context.SECURITY_CREDENTIALS, password);
+ env.put(Context.LANGUAGE, "de");
+
+ try {
+ new InitialDirContext(env);
+ return true;
+ }
+ catch (NamingException ne) {
+ if (showexceptions) {
+ ne.printStackTrace();
+ }
+ return false;
+ }
+
+ }
+}
diff --git a/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/security/PrincipalHolder.java b/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/security/PrincipalHolder.java
index c304ca7a11..7855670c74 100644
--- a/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/security/PrincipalHolder.java
+++ b/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/security/PrincipalHolder.java
@@ -1,31 +1,31 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.http.servletfilter.security;
-
-import java.security.Principal;
-
-import org.eclipse.scout.commons.holders.Holder;
-
-public class PrincipalHolder extends Holder<Principal> {
- private static final long serialVersionUID = 1L;
-
- public PrincipalHolder() {
- super(Principal.class);
- }
-
- public void setPrincipal(Principal principal) {
- setValue(principal);
- }
-
- public Principal getPrincipal() {
- return getValue();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.http.servletfilter.security;
+
+import java.security.Principal;
+
+import org.eclipse.scout.commons.holders.Holder;
+
+public class PrincipalHolder extends Holder<Principal> {
+ private static final long serialVersionUID = 1L;
+
+ public PrincipalHolder() {
+ super(Principal.class);
+ }
+
+ public void setPrincipal(Principal principal) {
+ setValue(principal);
+ }
+
+ public Principal getPrincipal() {
+ return getValue();
+ }
+}
diff --git a/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/security/SecureHttpServletRequestWrapper.java b/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/security/SecureHttpServletRequestWrapper.java
index 0a1e109d9c..84962e41b7 100644
--- a/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/security/SecureHttpServletRequestWrapper.java
+++ b/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/security/SecureHttpServletRequestWrapper.java
@@ -1,60 +1,60 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.http.servletfilter.security;
-
-import java.security.Principal;
-import java.util.Arrays;
-import java.util.List;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletRequestWrapper;
-
-public class SecureHttpServletRequestWrapper extends HttpServletRequestWrapper {
-
- private static List<String> AUTH_TYPES = Arrays.asList(new String[]{"BASIC_AUTH", "FORM_AUTH", "CLIENT_CERT_AUTH", "DIGEST_AUTH", "NTLM"});
-
- private final Principal m_principal;
- private final String m_authType;
-
- public SecureHttpServletRequestWrapper(HttpServletRequest req, Principal principal) {
- this(req, principal, null);
- }
-
- public SecureHttpServletRequestWrapper(HttpServletRequest req, Principal principal, String authType) {
- super(req);
- m_principal = principal;
- if (authType != null && !AUTH_TYPES.contains(authType)) {
- authType = null;
- }
- if (authType == null) {
- authType = req.getAuthType();
- }
- if (authType == null) {
- authType = AUTH_TYPES.get(0);
- }
- m_authType = authType;
- }
-
- @Override
- public String getRemoteUser() {
- return m_principal.getName();
- }
-
- @Override
- public Principal getUserPrincipal() {
- return m_principal;
- }
-
- @Override
- public String getAuthType() {
- return m_authType;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.http.servletfilter.security;
+
+import java.security.Principal;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletRequestWrapper;
+
+public class SecureHttpServletRequestWrapper extends HttpServletRequestWrapper {
+
+ private static List<String> AUTH_TYPES = Arrays.asList(new String[]{"BASIC_AUTH", "FORM_AUTH", "CLIENT_CERT_AUTH", "DIGEST_AUTH", "NTLM"});
+
+ private final Principal m_principal;
+ private final String m_authType;
+
+ public SecureHttpServletRequestWrapper(HttpServletRequest req, Principal principal) {
+ this(req, principal, null);
+ }
+
+ public SecureHttpServletRequestWrapper(HttpServletRequest req, Principal principal, String authType) {
+ super(req);
+ m_principal = principal;
+ if (authType != null && !AUTH_TYPES.contains(authType)) {
+ authType = null;
+ }
+ if (authType == null) {
+ authType = req.getAuthType();
+ }
+ if (authType == null) {
+ authType = AUTH_TYPES.get(0);
+ }
+ m_authType = authType;
+ }
+
+ @Override
+ public String getRemoteUser() {
+ return m_principal.getName();
+ }
+
+ @Override
+ public Principal getUserPrincipal() {
+ return m_principal;
+ }
+
+ @Override
+ public String getAuthType() {
+ return m_authType;
+ }
+}
diff --git a/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/security/TomcatSecurityFilter.java b/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/security/TomcatSecurityFilter.java
index 8dc3b9601f..22217ce846 100644
--- a/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/security/TomcatSecurityFilter.java
+++ b/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/security/TomcatSecurityFilter.java
@@ -1,140 +1,140 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.http.servletfilter.security;
-
-import java.io.IOException;
-import java.security.AccessController;
-import java.security.Principal;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-
-import javax.security.auth.Subject;
-import javax.servlet.Filter;
-import javax.servlet.FilterChain;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.http.servletfilter.FilterConfigInjection;
-import org.eclipse.scout.commons.security.SimplePrincipal;
-
-/**
- * In Tomcat, the Subject is lost after authentication and is not passed to the servlet.
- * Only the remoteUser and the userPrincipal are available.<br>
- * This servlet-filter ensures that each request is executed in a secure context.
- * This filter doesn't authenticate the caller, this is the responsibility of Tomcat/Container<br>
- * <br>
- * For Tomcat 6, following steps are required to achieve sso with Windows AD:<br>
- * <li>copy spnego.jar to tomcat\lib</li> <br>
- * <li>copy krb5.conf and login.conf to tomcat-home</li><br>
- * <li>adjust paramters in login.conf</li><br>
- * <li>adjust paramters in conf\web.xml</li><br>
- */
-public class TomcatSecurityFilter implements Filter {
- private FilterConfigInjection m_injection;
-
- @Override
- public void init(FilterConfig config0) throws ServletException {
- m_injection = new FilterConfigInjection(config0, getClass());
- }
-
- @Override
- public void destroy() {
- m_injection = null;
- }
-
- @Override
- public void doFilter(ServletRequest in, ServletResponse out, final FilterChain chain) throws IOException, ServletException {
- FilterConfigInjection.FilterConfig config = m_injection.getConfig(in);
- if (!config.isActive()) {
- chain.doFilter(in, out);
- return;
- }
-
- HttpServletRequest req = (HttpServletRequest) in;
- HttpServletResponse res = (HttpServletResponse) out;
-
- // touch the session so it is effectively used
- req.getSession();
-
- // check if subject that has one principal at minimum is available
- Subject subject = Subject.getSubject(AccessController.getContext());
- if (subject != null && subject.getPrincipals().size() > 0) {
- doFilterInternal(req, res, chain);
- }
- else {
- // create subject if necessary
- if (subject == null || subject.isReadOnly()) {
- subject = new Subject();
- }
-
- // create principal if necessary
- Principal principal = req.getUserPrincipal();
- if (principal == null || !StringUtility.hasText(principal.getName())) {
- principal = null;
- String name = req.getRemoteUser();
- if (StringUtility.hasText(name)) {
- principal = new SimplePrincipal(name);
- }
- }
- if (principal == null) {
- // no principal provided, abort chain
- res.sendError(HttpServletResponse.SC_UNAUTHORIZED);
- return;
- }
-
- subject.getPrincipals().add(principal);
- subject.setReadOnly();
-
- continueChainWithPrincipal(subject, req, res, chain);
- }
- }
-
- private void continueChainWithPrincipal(Subject subject, final HttpServletRequest req, final HttpServletResponse res, final FilterChain chain) throws IOException, ServletException {
- try {
- Subject.doAs(
- subject,
- new PrivilegedExceptionAction<Object>() {
- @Override
- public Object run() throws Exception {
- HttpServletRequest secureReq = req;
- if (!(secureReq instanceof SecureHttpServletRequestWrapper)) {
- Principal principal = Subject.getSubject(AccessController.getContext()).getPrincipals().iterator().next();
- secureReq = new SecureHttpServletRequestWrapper(req, principal);
- }
- doFilterInternal(secureReq, res, chain);
- return null;
- }
- }
- );
- }
- catch (PrivilegedActionException e) {
- Throwable t = e.getCause();
- if (t instanceof IOException) {
- throw (IOException) t;
- }
- else if (t instanceof ServletException) {
- throw (ServletException) t;
- }
- else {
- throw new ServletException(t);
- }
- }
- }
-
- private void doFilterInternal(HttpServletRequest req, HttpServletResponse res, FilterChain chain) throws IOException, ServletException {
- chain.doFilter(req, res);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.http.servletfilter.security;
+
+import java.io.IOException;
+import java.security.AccessController;
+import java.security.Principal;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+
+import javax.security.auth.Subject;
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.http.servletfilter.FilterConfigInjection;
+import org.eclipse.scout.commons.security.SimplePrincipal;
+
+/**
+ * In Tomcat, the Subject is lost after authentication and is not passed to the servlet.
+ * Only the remoteUser and the userPrincipal are available.<br>
+ * This servlet-filter ensures that each request is executed in a secure context.
+ * This filter doesn't authenticate the caller, this is the responsibility of Tomcat/Container<br>
+ * <br>
+ * For Tomcat 6, following steps are required to achieve sso with Windows AD:<br>
+ * <li>copy spnego.jar to tomcat\lib</li> <br>
+ * <li>copy krb5.conf and login.conf to tomcat-home</li><br>
+ * <li>adjust paramters in login.conf</li><br>
+ * <li>adjust paramters in conf\web.xml</li><br>
+ */
+public class TomcatSecurityFilter implements Filter {
+ private FilterConfigInjection m_injection;
+
+ @Override
+ public void init(FilterConfig config0) throws ServletException {
+ m_injection = new FilterConfigInjection(config0, getClass());
+ }
+
+ @Override
+ public void destroy() {
+ m_injection = null;
+ }
+
+ @Override
+ public void doFilter(ServletRequest in, ServletResponse out, final FilterChain chain) throws IOException, ServletException {
+ FilterConfigInjection.FilterConfig config = m_injection.getConfig(in);
+ if (!config.isActive()) {
+ chain.doFilter(in, out);
+ return;
+ }
+
+ HttpServletRequest req = (HttpServletRequest) in;
+ HttpServletResponse res = (HttpServletResponse) out;
+
+ // touch the session so it is effectively used
+ req.getSession();
+
+ // check if subject that has one principal at minimum is available
+ Subject subject = Subject.getSubject(AccessController.getContext());
+ if (subject != null && subject.getPrincipals().size() > 0) {
+ doFilterInternal(req, res, chain);
+ }
+ else {
+ // create subject if necessary
+ if (subject == null || subject.isReadOnly()) {
+ subject = new Subject();
+ }
+
+ // create principal if necessary
+ Principal principal = req.getUserPrincipal();
+ if (principal == null || !StringUtility.hasText(principal.getName())) {
+ principal = null;
+ String name = req.getRemoteUser();
+ if (StringUtility.hasText(name)) {
+ principal = new SimplePrincipal(name);
+ }
+ }
+ if (principal == null) {
+ // no principal provided, abort chain
+ res.sendError(HttpServletResponse.SC_UNAUTHORIZED);
+ return;
+ }
+
+ subject.getPrincipals().add(principal);
+ subject.setReadOnly();
+
+ continueChainWithPrincipal(subject, req, res, chain);
+ }
+ }
+
+ private void continueChainWithPrincipal(Subject subject, final HttpServletRequest req, final HttpServletResponse res, final FilterChain chain) throws IOException, ServletException {
+ try {
+ Subject.doAs(
+ subject,
+ new PrivilegedExceptionAction<Object>() {
+ @Override
+ public Object run() throws Exception {
+ HttpServletRequest secureReq = req;
+ if (!(secureReq instanceof SecureHttpServletRequestWrapper)) {
+ Principal principal = Subject.getSubject(AccessController.getContext()).getPrincipals().iterator().next();
+ secureReq = new SecureHttpServletRequestWrapper(req, principal);
+ }
+ doFilterInternal(secureReq, res, chain);
+ return null;
+ }
+ }
+ );
+ }
+ catch (PrivilegedActionException e) {
+ Throwable t = e.getCause();
+ if (t instanceof IOException) {
+ throw (IOException) t;
+ }
+ else if (t instanceof ServletException) {
+ throw (ServletException) t;
+ }
+ else {
+ throw new ServletException(t);
+ }
+ }
+ }
+
+ private void doFilterInternal(HttpServletRequest req, HttpServletResponse res, FilterChain chain) throws IOException, ServletException {
+ chain.doFilter(req, res);
+ }
+}
diff --git a/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/security/WrappedServletResponse.java b/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/security/WrappedServletResponse.java
index 58d4ab83ad..a03d540118 100644
--- a/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/security/WrappedServletResponse.java
+++ b/org.eclipse.scout.http.servletfilter/src/org/eclipse/scout/http/servletfilter/security/WrappedServletResponse.java
@@ -1,105 +1,105 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.http.servletfilter.security;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpServletResponseWrapper;
-
-public class WrappedServletResponse extends HttpServletResponseWrapper {
- private static final int TYPE_ADD = 1;
- private static final int TYPE_SET = 2;
- private List<P_HeaderAttribute> m_headerAttributes;
-
- public WrappedServletResponse(HttpServletResponse response) {
- super(response);
- m_headerAttributes = new ArrayList<P_HeaderAttribute>();
- }
-
- @Override
- public void setHeader(String name, String value) {
- m_headerAttributes.add(new P_HeaderAttribute(name, value, TYPE_SET));
- }
-
- @Override
- public void addHeader(String name, String value) {
- m_headerAttributes.add(new P_HeaderAttribute(name, value, TYPE_ADD));
- }
-
- public String getHeaderValue(String name) {
- for (P_HeaderAttribute att : m_headerAttributes) {
- if (att.getName().equals(name)) {
- return att.getValue();
- }
- }
- return null;
- }
-
- public void clearHeader() {
- m_headerAttributes.clear();
- }
-
- @Override
- public void flushBuffer() throws IOException {
-
- }
-
- @Override
- public void setStatus(int sc) {
- }
-
- @Override
- public HttpServletResponse getResponse() {
- return (HttpServletResponse) super.getResponse();
- }
-
- public void applyHeader() {
- for (P_HeaderAttribute att : m_headerAttributes) {
- switch (att.getType()) {
- case TYPE_ADD:
- getResponse().addHeader(att.getName(), att.getValue());
- break;
- case TYPE_SET:
- getResponse().setHeader(att.getName(), att.getValue());
- break;
- }
- }
- }
-
- private class P_HeaderAttribute {
- private final String m_name;
- private final String m_value;
- private final int m_type;
-
- public P_HeaderAttribute(String name, String value, int type) {
- m_name = name;
- m_value = value;
- m_type = type;
- }
-
- public String getName() {
- return m_name;
- }
-
- public String getValue() {
- return m_value;
- }
-
- public int getType() {
- return m_type;
- }
-
- } // end class P_HeaderAttribute
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.http.servletfilter.security;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpServletResponseWrapper;
+
+public class WrappedServletResponse extends HttpServletResponseWrapper {
+ private static final int TYPE_ADD = 1;
+ private static final int TYPE_SET = 2;
+ private List<P_HeaderAttribute> m_headerAttributes;
+
+ public WrappedServletResponse(HttpServletResponse response) {
+ super(response);
+ m_headerAttributes = new ArrayList<P_HeaderAttribute>();
+ }
+
+ @Override
+ public void setHeader(String name, String value) {
+ m_headerAttributes.add(new P_HeaderAttribute(name, value, TYPE_SET));
+ }
+
+ @Override
+ public void addHeader(String name, String value) {
+ m_headerAttributes.add(new P_HeaderAttribute(name, value, TYPE_ADD));
+ }
+
+ public String getHeaderValue(String name) {
+ for (P_HeaderAttribute att : m_headerAttributes) {
+ if (att.getName().equals(name)) {
+ return att.getValue();
+ }
+ }
+ return null;
+ }
+
+ public void clearHeader() {
+ m_headerAttributes.clear();
+ }
+
+ @Override
+ public void flushBuffer() throws IOException {
+
+ }
+
+ @Override
+ public void setStatus(int sc) {
+ }
+
+ @Override
+ public HttpServletResponse getResponse() {
+ return (HttpServletResponse) super.getResponse();
+ }
+
+ public void applyHeader() {
+ for (P_HeaderAttribute att : m_headerAttributes) {
+ switch (att.getType()) {
+ case TYPE_ADD:
+ getResponse().addHeader(att.getName(), att.getValue());
+ break;
+ case TYPE_SET:
+ getResponse().setHeader(att.getName(), att.getValue());
+ break;
+ }
+ }
+ }
+
+ private class P_HeaderAttribute {
+ private final String m_name;
+ private final String m_value;
+ private final int m_type;
+
+ public P_HeaderAttribute(String name, String value, int type) {
+ m_name = name;
+ m_value = value;
+ m_type = type;
+ }
+
+ public String getName() {
+ return m_name;
+ }
+
+ public String getValue() {
+ return m_value;
+ }
+
+ public int getType() {
+ return m_type;
+ }
+
+ } // end class P_HeaderAttribute
+
+}
diff --git a/org.eclipse.scout.jaxws216/.settings/org.eclipse.pde.core.prefs b/org.eclipse.scout.jaxws216/.settings/org.eclipse.pde.core.prefs
index 2cd73caed8..ae233b04e2 100644
--- a/org.eclipse.scout.jaxws216/.settings/org.eclipse.pde.core.prefs
+++ b/org.eclipse.scout.jaxws216/.settings/org.eclipse.pde.core.prefs
@@ -1,3 +1,3 @@
-#Wed Sep 12 16:50:29 CEST 2007
-eclipse.preferences.version=1
-pluginProject.extensions=true
+#Wed Sep 12 16:50:29 CEST 2007
+eclipse.preferences.version=1
+pluginProject.extensions=true
diff --git a/org.eclipse.scout.jaxws216/README.txt b/org.eclipse.scout.jaxws216/README.txt
index b858afcc51..40e613c50e 100644
--- a/org.eclipse.scout.jaxws216/README.txt
+++ b/org.eclipse.scout.jaxws216/README.txt
@@ -1,23 +1,23 @@
-How to make the Plug-In to compile
-==================================
-The JRE jar-file 'tools.jar' is used by 'org.eclipse.scout.jaxws.tool.JaxWsStubGenerator' to build webservice stubs.
-As this jar is not part of the JRE system libraries, you manually have to add it.
-
-1. Open Eclipse Preferences
-2. Open 'Java | Installed JREs'
-3. Edit default JRE
-4. Add 'External JAR' as system library
-5. Choose the tools.jar which typically is located at %JAVA_HOME%/lib/tools.jar
-
-Please note: At SDK runtime, the JAR is located as follows:
-1. If 'tools.jar' is part of the workspace classpath, this one is used
-2. It is tried to locate the JAR by using the %JAVA_HOME% path variable
-
-How webservice providers are discovered
-=======================================
-Providers are to be registered in sun-jaxws.xml of their respective Plug-Ins and must be located at WEB-INI/sun-jaxws.xml.
-At runtime, all bundles (Plug-Ins, fragments) installed in the OSGi environment are scanned for such a descriptor file and their webservices published.
-The endpoints are published at the address that is composed of the JaxWsServlet-alias and the respective URL-pattern in sun-jaxws.xml.
-To see all published endpoints, please enter the JaxWsServlet-alias into the browsser's address bar.
-To customize this summary page, create a HTML template named 'jaxws-services.html' and put it into your server project (e.g. /resources/html/jaxws-services.html).
-To use your template over the default one, configure the init-paramters 'bundle-name' and 'bundle-path' on the JaxWsServlet-registration to point to your resources.
+How to make the Plug-In to compile
+==================================
+The JRE jar-file 'tools.jar' is used by 'org.eclipse.scout.jaxws.tool.JaxWsStubGenerator' to build webservice stubs.
+As this jar is not part of the JRE system libraries, you manually have to add it.
+
+1. Open Eclipse Preferences
+2. Open 'Java | Installed JREs'
+3. Edit default JRE
+4. Add 'External JAR' as system library
+5. Choose the tools.jar which typically is located at %JAVA_HOME%/lib/tools.jar
+
+Please note: At SDK runtime, the JAR is located as follows:
+1. If 'tools.jar' is part of the workspace classpath, this one is used
+2. It is tried to locate the JAR by using the %JAVA_HOME% path variable
+
+How webservice providers are discovered
+=======================================
+Providers are to be registered in sun-jaxws.xml of their respective Plug-Ins and must be located at WEB-INI/sun-jaxws.xml.
+At runtime, all bundles (Plug-Ins, fragments) installed in the OSGi environment are scanned for such a descriptor file and their webservices published.
+The endpoints are published at the address that is composed of the JaxWsServlet-alias and the respective URL-pattern in sun-jaxws.xml.
+To see all published endpoints, please enter the JaxWsServlet-alias into the browsser's address bar.
+To customize this summary page, create a HTML template named 'jaxws-services.html' and put it into your server project (e.g. /resources/html/jaxws-services.html).
+To use your template over the default one, configure the init-paramters 'bundle-name' and 'bundle-path' on the JaxWsServlet-registration to point to your resources.
diff --git a/org.eclipse.scout.jaxws216/Release Notes.txt b/org.eclipse.scout.jaxws216/Release Notes.txt
index 4a79c988ee..4887046ee5 100644
--- a/org.eclipse.scout.jaxws216/Release Notes.txt
+++ b/org.eclipse.scout.jaxws216/Release Notes.txt
@@ -1,223 +1,223 @@
-17.05.2011 dwi
-Problem:
-Change of API due to ease of simplicity
-Solution:
-
-Change:
- - Rename of AbstractWebServiceProxyService to AbstractWebServiceClient
-Migration:
- - Change super type of your webservice consumers and rename the concrete implementation accordingly, e.g. TestWebServiceProxyService to TestWebServiceClient
- - Update fully qualified names of webservice consumers in config.ini (properties for URL, username and password)
-
-Change:
- - Rename of ScoutWebServiceProxy annotation to ScoutWebServiceClient
-Migration:
- - Change code to use renamed annotation
-
---
-Change:
- - Removal of factories ICredentialValidationFactory and IAuthenticationFactory
-Migration:
- - Remove concrete consumer factory implementations from project and instrument WebServiceClient (former WebServiceProxyService) in ScoutWebServiceClient annotation (former ScoutWebServiceProxy) to directly use the respective strategy.
- Mostly, a strategy was implemented as inner class within the factory. Extract that code to a separate compilation unit.
- - Remove concrete provider factory implementations from project and instrument WebService in ScoutWebService annotation to directly use the respective strategy.
- Mostly, a strategy was implemented as inner class within the factory. Extract that code to a separate compilation unit.
-
---
-Change:
- - due to previous change, properties in annotation ScoutWebService / ScoutWebServiceClient changed
-Migration:
- - use authenticationHandler instead of authenticationFactory
- - use credentialValidationStrategy instead of credentialValidationFactory
-
---
-Change:
- - Rename of method [protected List<Handler<? extends MessageContext>> getConfiguredHandlers()] in AbstractWebServiceClient (former AbstractWebServiceProxyService).
- Furthermore, handler support is limited to only SOAPHandler's.
-Migration:
- - Use [protected void execInstallHandlers(List<SOAPHandler<SOAPMessageContext>> handlers)] instead and register handlers in given live list
-
---
-Change:
- - Rename of method [protected void execPrepareSecurityHandler(IAuthenticationHandler securityHandler) throws ProcessingException] in AbstractWebServiceClient (former AbstractWebServiceProxyService).
-Migration:
- - Use [protected boolean execPrepareAuthenticationHandler(IAuthenticationHandler authenticationHandler) throws ProcessingException] instead
-
---
-Change:
- - Modification to authentication process to support in front authentication, e.g. in an application server.
- * The request can be authenticated in two ways:
- * 1. By the application server itself or a previous filter.
- * In such situation, we are already running in a respective doAs call which implies that the subject obtained
- * is not null and contains one principal at minimum.
- * 2. By a subsequent {@link IAuthenticationHandler} handler.
- * This is if the subject is null or there is no principal associated yet.
- * If the current subject is null or readonly, a new one is created.
-Migration:
- - None
-
---
-Change:
- - Changed data adapters to typed adapters which inherit from javax.xml.bind.annotation.adapters.XmlAdapter.
- This has the advantage, that conversion methods must not be specified in binding.xml anymore and that no anonymous adapter classes are generated at stub generation.
- When not working with custom packages but rather with the recommended JAX-WS package algorithm, those adapters where mutually overwritten by other stub implementations.
-Migration:
- - Change registration in binding.xml files:
- <jaxws:bindings version="2.0" node="wsdl:definitions/wsdl:types/xsd:schema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:jaxws="http://java.sun.com/xml/ns/jaxws">
- <jaxb:globalBindings>
- <xjc:javaType name="java.util.Date" xmlType="xsd:date" adapter="org.eclipse.scout.jaxws.adapters.DateAdapterISO8601UTC"/>
- <xjc:javaType name="java.util.Date" xmlType="xsd:time" adapter="org.eclipse.scout.jaxws.adapters.DateAdapterISO8601UTC"/>
- <xjc:javaType name="java.util.Date" xmlType="xsd:dateTime" adapter="org.eclipse.scout.jaxws.adapters.DateAdapterISO8601UTC"/>
- </jaxb:globalBindings>
- </jaxws:bindings>
-
---
-Added:
- - JAX-WS support in Scout SDK
- After doing the previous migration steps, your webservices should be recognized by Scout SDK.
- - remove of old files
- - remove com.bsiag.crm.ws.gen.jar in WEB-INF/build
- - remove build ant tasks in WEB-INF/build
- - repair tasks
- Still, there will be some problems in regard of building webservice stubs. Please use the proposed repair tasks to solve the problems.
- - build-jaxws.xml
- After Scout SDK created a build-jaxws.xml entry for each webservice, you manually have to configure the source folder. This is the folder generated code is placed in when generating the stub.
- > In order to this, just add the property 'source="src-ws"' to the respective build-jaxws.entry.
- > For webservice consumers, register WSDL file in Scout property view of your webservice. This is in section 'Webservice properties | WSDL file'.
- - build directives
- If you used build directives to build your webservice stubs, move them into the build-jaxws.xml file.
- A typical configuration would be:
-
- <property name="b" value="WEB-INF/build/XXX-bindings.xml"/>
- <property name="verbose"/>
- <property name="target" value="2.0"/>
- <property name="Xdebug"/>
- <property name="Xnocompile"/>
-
-27.06.2011 dwi
-Problem:
-If getter methods for username / password are overwritten, their values are not considered
-Solution:
-- removed domain property as not used yet
-- changed access of username / password property in AbstractWebServiceClient: use getter methods instead of accessing the members directly
-
-26.08.2011 dwi
-Problem:
-- AbstractWebServiceClient#getConfiguredHandlers(List<SOAPHandler<SOAPMessageContext>>) is not used (dead code)
-- LogHandler should be parameterizable to log directly to console and not only to logger (for rapid development)
-Solution:
-- removed AbstractWebServiceClient#getConfiguredHandlers(List<SOAPHandler<SOAPMessageContext>>)
-- added constructor to log handler with sysout as argument
-Migration:
-If AbstractWebServiceClient#getConfiguredHandlers(List<SOAPHandler<SOAPMessageContext>> handlers) is overwritten,
-move handler instantiation to AbstractWebServiceClient#execInstallHandlers(List<SOAPHandler<SOAPMessageContext>>)
-as this had no effect (dead code).
-
-22.10.2011 dwi
-BSI Ticket: 107'106
-Problem:
-It should be possible to set a maximal timeout for a webservice consumer to wait for a response
-Solution:
-- added getConfiguredRequestTimeout(): maximal time to wait for response data to be ready to be read
-- added getConfiguredConnectTimeout(): maximal time to wait for a connection to be established
-Migration:
-None
-
-07.11.2011 dwi
-BSI Ticket: 107'602
-Problem:
-DateAdapterISO8601UTC does not support all valid date-time combinations.
-Also, the xsd:dateTime definition does not fully rely on ISO-8601 standard because lack of timezone information.
-It should be possible to not only work with UTC time.
-Solution:
-- Changed adapter to fully support xsd:date transformation
-- Renamed DateAdapterISO8601UTC to UtcDateAdapter: all transformations are in respect to the UTC time.
- > Use this adapter if all dates are uniformly to be transformed into UTC time (Zulu-time).
-- Renamed DateAdapter to DefaultTimezoneDateAdapter: all transformations are in respect to the default timezone on server
- > Use this adapter if you expect to work with dates local to the default timezone.
-- Added CalendarAdapter: transformation into calendar object without loosing local time information.
- > Use this adapter if you expect to work with dates from various timezones without
- > loosing the local time. If the UTC (Zulu-time) is sufficient, use {@link UtcDateAdapter} instead.
-Migration:
-- If using the adapter 'DateAdapterISO8601UTC' for xsd:date<>java.util.Date transformation, do the following:
- 1) Go to the binding files of webservice providers and consumers
- 2) Change DateAdapterISO8601UTC to UtcDateAdapter or if applicable, use another one
- 3) Change DateAdapter to DefaultTimezoneDateAdapter or if applicable, use another one
- 4) Rebuild affected webservice stubs
-
-06.01.2012 dwi
-Bugzilla: 367994
-Problem:
-a) The WSDL file of webservice providers whose WSDL file is located in a sub-folder of '/WEB-INF/wsdl' is dynamically generated at JAX-WS bootstrap instead of the existing WSDL file to be published.
-b) Webservice consumer specific WSDL files might interfere with provider specific WSDL files, e.g. if defining same services or ports. In consequence, all webservice providers of that plugin are not published.
-c) redundant WSDL file in webservice stub JAR-file.
-Solution:
-a) changed JAX-WS resource loading to also look in subfolders for existing resources
-b) WS provider specific WSDL files should be located in the folder '/WEB-INF/wsdl/provider' whereas consumer specific WSDL files in '/WEB-INF/wsdl/consumer'. In turn, JAX-WS is instrumented to ignore all the files in the (sub-)folder '/WEB-INF/wsdl/consumer' when publishing the endpoints.
-c) WSDL file is not put into the JAR archive anymore when building the webservice stub.
-Migration:
-- Use Scout SDK (repair actions) to move WSDL files of webservice providers into folder '/WEB-INF/wsdl/provider' and of webservice consumer into folder '/WEB-INF/wsdl/consumers'
-- Rebuild webservice stubs (should automatically be done if using repair action)
-
-20.01.2012 dwi
-Bugzilla: 369242
-Problem: Basic authentication of webservice providers does not work on tomcat. That is because tomcat converts all the HTTP header names to lower case. According to RFC 2616, this conversion is eligible as header names are case-insensitive. On Jetty, basic authentication mechanism works fine as header-names are untouched. Because Scout JAX-WS RT handles header-names in a case-sensitive way the authentication fails.
-Solution: Fixed 'BasicAuthenticationHandler' to treat header names case-insensitive.
-Migration: None
-
-06.01.2012 dwi
-Bugzilla: 367994
-Problem:
-a) The WSDL file of webservice providers whose WSDL file is located in a sub-folder of '/WEB-INF/wsdl' is dynamically generated at JAX-WS bootstrap instead of the existing WSDL file to be published.
-b) Webservice consumer specific WSDL files might interfere with provider specific WSDL files, e.g. if defining same services or ports. In consequence, all webservice providers of that plugin are not published.
-c) redundant WSDL file in webservice stub JAR-file.
-Solution:
-a) changed JAX-WS resource loading to also look in subfolders for existing resources
-b) WS provider specific WSDL files should be located in the folder '/WEB-INF/wsdl/provider' whereas consumer specific WSDL files in '/WEB-INF/wsdl/consumer'. In turn, JAX-WS is instrumented to ignore all the files in the (sub-)folder '/WEB-INF/wsdl/consumer' when publishing the endpoints.
-c) WSDL file is not put into the JAR archive anymore when building the webservice stub.
-Migration:
-- Use Scout SDK (repair actions) to move WSDL files of webservice providers into folder '/WEB-INF/wsdl/provider' and of webservice consumer into folder '/WEB-INF/wsdl/consumers'
-- Rebuild webservice stubs (should automatically be done if using repair action)
-
-24.02.2012 dwi
-Bugzilla: 372476
-Problem: If throwing an exception (SOAP fault or not) in webservice processing, the transaction is not rollbacked.
-Furthermore, SOAP faults should be logged with a severity of INFO instead of ERROR whereas unexpected errors with a severity of WARN.
-Solution:
-- Rollback of transaction (always in case of an error)
-- SOAP faults are logged with a severity of INFO
-- Runtime exceptions are logged with a severity of WARN with the note to handle such faults by respective SOAP faults. Also, the causing exception is not propagated back to the webservice client.
-Migration: None
-
-17.03.2012 dwi
-Bugzilla: 374580
-Problem:
-The webservice endpoints installed should be accessible within Scout application to access their properties.
-Solution:
-- Moved JAX-WS bootstrapping from servlet initialization into service initialization of IJaxWsEndpointService. This service provides access to the installed JAX-WS endpoints.
-- Moved JAX-WS status page from EndpointServlet to IJaxWsEndpointService.
-Migration:
-If you are providing a custom status page for your webservice endpoints, you configured the init-parameters 'bundle-name' and 'bundle-path' in the JAX-WS servlet. Remove those two parameters and set the following properties in config.ini file accordingly:
-org.eclipse.scout.jaxws.resource.bundle-name=<resource-bundle>
-org.eclipse.scout.jaxws.resource.bundle-path=<resource-path within resource-bundle>
-
-20.03.2012 dwi
-Bugzilla: 374837
-Problem:
-WebServiceContext cannot be injected into port type with @Resource annotation.
-That would be necessary to access message context and security information
-relative to a request being served.
-Solution:
-Fixed instance resolver to respect JAX-WS resource injection.
-Migration:
-None
-
-26.04.2012 mvi
-Bugzilla: 377831
-Problem:
-JaxWsStubGenerator crashes when creating providers or consumers under Java 7
-Solution:
-Bridge implemented that can handle both implementation versions.
-Furthermore logging has been improved to get more detailed messages.
-Migration:
+17.05.2011 dwi
+Problem:
+Change of API due to ease of simplicity
+Solution:
+
+Change:
+ - Rename of AbstractWebServiceProxyService to AbstractWebServiceClient
+Migration:
+ - Change super type of your webservice consumers and rename the concrete implementation accordingly, e.g. TestWebServiceProxyService to TestWebServiceClient
+ - Update fully qualified names of webservice consumers in config.ini (properties for URL, username and password)
+
+Change:
+ - Rename of ScoutWebServiceProxy annotation to ScoutWebServiceClient
+Migration:
+ - Change code to use renamed annotation
+
+--
+Change:
+ - Removal of factories ICredentialValidationFactory and IAuthenticationFactory
+Migration:
+ - Remove concrete consumer factory implementations from project and instrument WebServiceClient (former WebServiceProxyService) in ScoutWebServiceClient annotation (former ScoutWebServiceProxy) to directly use the respective strategy.
+ Mostly, a strategy was implemented as inner class within the factory. Extract that code to a separate compilation unit.
+ - Remove concrete provider factory implementations from project and instrument WebService in ScoutWebService annotation to directly use the respective strategy.
+ Mostly, a strategy was implemented as inner class within the factory. Extract that code to a separate compilation unit.
+
+--
+Change:
+ - due to previous change, properties in annotation ScoutWebService / ScoutWebServiceClient changed
+Migration:
+ - use authenticationHandler instead of authenticationFactory
+ - use credentialValidationStrategy instead of credentialValidationFactory
+
+--
+Change:
+ - Rename of method [protected List<Handler<? extends MessageContext>> getConfiguredHandlers()] in AbstractWebServiceClient (former AbstractWebServiceProxyService).
+ Furthermore, handler support is limited to only SOAPHandler's.
+Migration:
+ - Use [protected void execInstallHandlers(List<SOAPHandler<SOAPMessageContext>> handlers)] instead and register handlers in given live list
+
+--
+Change:
+ - Rename of method [protected void execPrepareSecurityHandler(IAuthenticationHandler securityHandler) throws ProcessingException] in AbstractWebServiceClient (former AbstractWebServiceProxyService).
+Migration:
+ - Use [protected boolean execPrepareAuthenticationHandler(IAuthenticationHandler authenticationHandler) throws ProcessingException] instead
+
+--
+Change:
+ - Modification to authentication process to support in front authentication, e.g. in an application server.
+ * The request can be authenticated in two ways:
+ * 1. By the application server itself or a previous filter.
+ * In such situation, we are already running in a respective doAs call which implies that the subject obtained
+ * is not null and contains one principal at minimum.
+ * 2. By a subsequent {@link IAuthenticationHandler} handler.
+ * This is if the subject is null or there is no principal associated yet.
+ * If the current subject is null or readonly, a new one is created.
+Migration:
+ - None
+
+--
+Change:
+ - Changed data adapters to typed adapters which inherit from javax.xml.bind.annotation.adapters.XmlAdapter.
+ This has the advantage, that conversion methods must not be specified in binding.xml anymore and that no anonymous adapter classes are generated at stub generation.
+ When not working with custom packages but rather with the recommended JAX-WS package algorithm, those adapters where mutually overwritten by other stub implementations.
+Migration:
+ - Change registration in binding.xml files:
+ <jaxws:bindings version="2.0" node="wsdl:definitions/wsdl:types/xsd:schema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:jaxws="http://java.sun.com/xml/ns/jaxws">
+ <jaxb:globalBindings>
+ <xjc:javaType name="java.util.Date" xmlType="xsd:date" adapter="org.eclipse.scout.jaxws.adapters.DateAdapterISO8601UTC"/>
+ <xjc:javaType name="java.util.Date" xmlType="xsd:time" adapter="org.eclipse.scout.jaxws.adapters.DateAdapterISO8601UTC"/>
+ <xjc:javaType name="java.util.Date" xmlType="xsd:dateTime" adapter="org.eclipse.scout.jaxws.adapters.DateAdapterISO8601UTC"/>
+ </jaxb:globalBindings>
+ </jaxws:bindings>
+
+--
+Added:
+ - JAX-WS support in Scout SDK
+ After doing the previous migration steps, your webservices should be recognized by Scout SDK.
+ - remove of old files
+ - remove com.bsiag.crm.ws.gen.jar in WEB-INF/build
+ - remove build ant tasks in WEB-INF/build
+ - repair tasks
+ Still, there will be some problems in regard of building webservice stubs. Please use the proposed repair tasks to solve the problems.
+ - build-jaxws.xml
+ After Scout SDK created a build-jaxws.xml entry for each webservice, you manually have to configure the source folder. This is the folder generated code is placed in when generating the stub.
+ > In order to this, just add the property 'source="src-ws"' to the respective build-jaxws.entry.
+ > For webservice consumers, register WSDL file in Scout property view of your webservice. This is in section 'Webservice properties | WSDL file'.
+ - build directives
+ If you used build directives to build your webservice stubs, move them into the build-jaxws.xml file.
+ A typical configuration would be:
+
+ <property name="b" value="WEB-INF/build/XXX-bindings.xml"/>
+ <property name="verbose"/>
+ <property name="target" value="2.0"/>
+ <property name="Xdebug"/>
+ <property name="Xnocompile"/>
+
+27.06.2011 dwi
+Problem:
+If getter methods for username / password are overwritten, their values are not considered
+Solution:
+- removed domain property as not used yet
+- changed access of username / password property in AbstractWebServiceClient: use getter methods instead of accessing the members directly
+
+26.08.2011 dwi
+Problem:
+- AbstractWebServiceClient#getConfiguredHandlers(List<SOAPHandler<SOAPMessageContext>>) is not used (dead code)
+- LogHandler should be parameterizable to log directly to console and not only to logger (for rapid development)
+Solution:
+- removed AbstractWebServiceClient#getConfiguredHandlers(List<SOAPHandler<SOAPMessageContext>>)
+- added constructor to log handler with sysout as argument
+Migration:
+If AbstractWebServiceClient#getConfiguredHandlers(List<SOAPHandler<SOAPMessageContext>> handlers) is overwritten,
+move handler instantiation to AbstractWebServiceClient#execInstallHandlers(List<SOAPHandler<SOAPMessageContext>>)
+as this had no effect (dead code).
+
+22.10.2011 dwi
+BSI Ticket: 107'106
+Problem:
+It should be possible to set a maximal timeout for a webservice consumer to wait for a response
+Solution:
+- added getConfiguredRequestTimeout(): maximal time to wait for response data to be ready to be read
+- added getConfiguredConnectTimeout(): maximal time to wait for a connection to be established
+Migration:
+None
+
+07.11.2011 dwi
+BSI Ticket: 107'602
+Problem:
+DateAdapterISO8601UTC does not support all valid date-time combinations.
+Also, the xsd:dateTime definition does not fully rely on ISO-8601 standard because lack of timezone information.
+It should be possible to not only work with UTC time.
+Solution:
+- Changed adapter to fully support xsd:date transformation
+- Renamed DateAdapterISO8601UTC to UtcDateAdapter: all transformations are in respect to the UTC time.
+ > Use this adapter if all dates are uniformly to be transformed into UTC time (Zulu-time).
+- Renamed DateAdapter to DefaultTimezoneDateAdapter: all transformations are in respect to the default timezone on server
+ > Use this adapter if you expect to work with dates local to the default timezone.
+- Added CalendarAdapter: transformation into calendar object without loosing local time information.
+ > Use this adapter if you expect to work with dates from various timezones without
+ > loosing the local time. If the UTC (Zulu-time) is sufficient, use {@link UtcDateAdapter} instead.
+Migration:
+- If using the adapter 'DateAdapterISO8601UTC' for xsd:date<>java.util.Date transformation, do the following:
+ 1) Go to the binding files of webservice providers and consumers
+ 2) Change DateAdapterISO8601UTC to UtcDateAdapter or if applicable, use another one
+ 3) Change DateAdapter to DefaultTimezoneDateAdapter or if applicable, use another one
+ 4) Rebuild affected webservice stubs
+
+06.01.2012 dwi
+Bugzilla: 367994
+Problem:
+a) The WSDL file of webservice providers whose WSDL file is located in a sub-folder of '/WEB-INF/wsdl' is dynamically generated at JAX-WS bootstrap instead of the existing WSDL file to be published.
+b) Webservice consumer specific WSDL files might interfere with provider specific WSDL files, e.g. if defining same services or ports. In consequence, all webservice providers of that plugin are not published.
+c) redundant WSDL file in webservice stub JAR-file.
+Solution:
+a) changed JAX-WS resource loading to also look in subfolders for existing resources
+b) WS provider specific WSDL files should be located in the folder '/WEB-INF/wsdl/provider' whereas consumer specific WSDL files in '/WEB-INF/wsdl/consumer'. In turn, JAX-WS is instrumented to ignore all the files in the (sub-)folder '/WEB-INF/wsdl/consumer' when publishing the endpoints.
+c) WSDL file is not put into the JAR archive anymore when building the webservice stub.
+Migration:
+- Use Scout SDK (repair actions) to move WSDL files of webservice providers into folder '/WEB-INF/wsdl/provider' and of webservice consumer into folder '/WEB-INF/wsdl/consumers'
+- Rebuild webservice stubs (should automatically be done if using repair action)
+
+20.01.2012 dwi
+Bugzilla: 369242
+Problem: Basic authentication of webservice providers does not work on tomcat. That is because tomcat converts all the HTTP header names to lower case. According to RFC 2616, this conversion is eligible as header names are case-insensitive. On Jetty, basic authentication mechanism works fine as header-names are untouched. Because Scout JAX-WS RT handles header-names in a case-sensitive way the authentication fails.
+Solution: Fixed 'BasicAuthenticationHandler' to treat header names case-insensitive.
+Migration: None
+
+06.01.2012 dwi
+Bugzilla: 367994
+Problem:
+a) The WSDL file of webservice providers whose WSDL file is located in a sub-folder of '/WEB-INF/wsdl' is dynamically generated at JAX-WS bootstrap instead of the existing WSDL file to be published.
+b) Webservice consumer specific WSDL files might interfere with provider specific WSDL files, e.g. if defining same services or ports. In consequence, all webservice providers of that plugin are not published.
+c) redundant WSDL file in webservice stub JAR-file.
+Solution:
+a) changed JAX-WS resource loading to also look in subfolders for existing resources
+b) WS provider specific WSDL files should be located in the folder '/WEB-INF/wsdl/provider' whereas consumer specific WSDL files in '/WEB-INF/wsdl/consumer'. In turn, JAX-WS is instrumented to ignore all the files in the (sub-)folder '/WEB-INF/wsdl/consumer' when publishing the endpoints.
+c) WSDL file is not put into the JAR archive anymore when building the webservice stub.
+Migration:
+- Use Scout SDK (repair actions) to move WSDL files of webservice providers into folder '/WEB-INF/wsdl/provider' and of webservice consumer into folder '/WEB-INF/wsdl/consumers'
+- Rebuild webservice stubs (should automatically be done if using repair action)
+
+24.02.2012 dwi
+Bugzilla: 372476
+Problem: If throwing an exception (SOAP fault or not) in webservice processing, the transaction is not rollbacked.
+Furthermore, SOAP faults should be logged with a severity of INFO instead of ERROR whereas unexpected errors with a severity of WARN.
+Solution:
+- Rollback of transaction (always in case of an error)
+- SOAP faults are logged with a severity of INFO
+- Runtime exceptions are logged with a severity of WARN with the note to handle such faults by respective SOAP faults. Also, the causing exception is not propagated back to the webservice client.
+Migration: None
+
+17.03.2012 dwi
+Bugzilla: 374580
+Problem:
+The webservice endpoints installed should be accessible within Scout application to access their properties.
+Solution:
+- Moved JAX-WS bootstrapping from servlet initialization into service initialization of IJaxWsEndpointService. This service provides access to the installed JAX-WS endpoints.
+- Moved JAX-WS status page from EndpointServlet to IJaxWsEndpointService.
+Migration:
+If you are providing a custom status page for your webservice endpoints, you configured the init-parameters 'bundle-name' and 'bundle-path' in the JAX-WS servlet. Remove those two parameters and set the following properties in config.ini file accordingly:
+org.eclipse.scout.jaxws.resource.bundle-name=<resource-bundle>
+org.eclipse.scout.jaxws.resource.bundle-path=<resource-path within resource-bundle>
+
+20.03.2012 dwi
+Bugzilla: 374837
+Problem:
+WebServiceContext cannot be injected into port type with @Resource annotation.
+That would be necessary to access message context and security information
+relative to a request being served.
+Solution:
+Fixed instance resolver to respect JAX-WS resource injection.
+Migration:
+None
+
+26.04.2012 mvi
+Bugzilla: 377831
+Problem:
+JaxWsStubGenerator crashes when creating providers or consumers under Java 7
+Solution:
+Bridge implemented that can handle both implementation versions.
+Furthermore logging has been improved to get more detailed messages.
+Migration:
None \ No newline at end of file
diff --git a/org.eclipse.scout.jaxws216/plugin.xml b/org.eclipse.scout.jaxws216/plugin.xml
index 510827a640..8baea8a853 100644
--- a/org.eclipse.scout.jaxws216/plugin.xml
+++ b/org.eclipse.scout.jaxws216/plugin.xml
@@ -1,17 +1,17 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<plugin>
- <extension point="org.eclipse.scout.service.services">
- <service class="org.eclipse.scout.jaxws.security.GlobalTrustManagerService" createImmediately="false" />
- <service class="org.eclipse.scout.jaxws.internal.JaxWsEndpointService" createImmediately="true" ranking="-1" />
- </extension>
- <extension
- point="org.eclipse.core.runtime.adapters">
- <factory
- adaptableType="com.sun.xml.internal.ws.transport.http.ResourceLoader"
- class="org.eclipse.scout.jaxws.internal.adapter.ResourceLoaderAdapterFactory">
- <adapter
- type="com.sun.xml.internal.ws.api.ResourceLoader">
- </adapter>
- </factory>
- </extension>
-</plugin>
+<?xml version="1.0" encoding="UTF-8"?>
+<plugin>
+ <extension point="org.eclipse.scout.service.services">
+ <service class="org.eclipse.scout.jaxws.security.GlobalTrustManagerService" createImmediately="false" />
+ <service class="org.eclipse.scout.jaxws.internal.JaxWsEndpointService" createImmediately="true" ranking="-1" />
+ </extension>
+ <extension
+ point="org.eclipse.core.runtime.adapters">
+ <factory
+ adaptableType="com.sun.xml.internal.ws.transport.http.ResourceLoader"
+ class="org.eclipse.scout.jaxws.internal.adapter.ResourceLoaderAdapterFactory">
+ <adapter
+ type="com.sun.xml.internal.ws.api.ResourceLoader">
+ </adapter>
+ </factory>
+ </extension>
+</plugin>
diff --git a/org.eclipse.scout.jaxws216/resources/html/jaxws-services.html b/org.eclipse.scout.jaxws216/resources/html/jaxws-services.html
index 6e59e1c65f..e2a8f59322 100644
--- a/org.eclipse.scout.jaxws216/resources/html/jaxws-services.html
+++ b/org.eclipse.scout.jaxws216/resources/html/jaxws-services.html
@@ -1,141 +1,141 @@
-<html>
-<head>
-<title>Webservices</title>
-<style type="text/css">
-<!--
-* {
- margin: 0;
- padding: 0;
-}
-
-html {
- height: 100%;
- overflow: inherit;
-}
-
-body {
- height: 100%;
- width: 100%;
- background-color: #FFFFFF;
- font-family: Helvetica, sans-serif;
- text-align: center;
- /* in IE, 'margin: 0 auto;' on page style does not work */
-}
-
-#page {
- min-width: 1000px;
- width: 60%;
- background-color: #FFFFFF;
- padding: 0px;
- margin: 0 auto;
-}
-
-#header {
- margin-top: 15px;
- margin-bottom: 10px;
- text-align: center;
-}
-
-a:link {
- color: #0082A1;
- text-decoration: none
-}
-
-a:visited {
- color: #0082A1;
- text-decoration: none
-}
-
-a:active {
- color: #0082A1;
- text-decoration: none
-}
-
-a:hover {
- color: #FE9915;
- text-decoration: underline
-}
-
-#jaxws-services {
- margin-top: 10px;
- margin-bottom: 20px;
- margin-left: 10px;
- margin-right: 10px;
-}
-
-.service_box {
- width: 100%;
- margin-top: 20px;
- margin-bottom: 20px;
- padding: 0px;
- border-style: solid;
- border-width: 1px;
- border-color: #2B82A0;
- border-spacing: 0px;
-}
-
-.service_name {
- background-color: #2B82A0;
- color: #FFFFFF;
- text-align: left;
- font-weight: bold;
- font-size: 14px;
- padding-left: 10px;
- padding-right: 5px;
- padding-top: 2px;
- padding-bottom: 2px;
- margin: 0px;
-}
-
-.content_box {
- border-width: 0px;
- border-style: none;
- margin-top: 10px;
- margin-bottom: 10px;
- font-size: 12px;
- padding: 0px;
-}
-
-.left_content_box {
- width: 60%;
- padding: 0px;
- padding-left: 10px;
- padding-right: 10px;
- vertical-align: top;
-}
-
-.right_content_box {
- width: 40%;
- padding: 0px;
- padding-left: 10px;
- padding-right: 10px;
- vertical-align: top;
- padding-right: 10px;
-}
-
-.label {
- font-weight: normal;
- width: 95px;
- vertical-align: top;
-}
-
-.content {
- vertical-align: top;
-}
-
-#logo {
- border: 0px;
- border-style: none;
-}
--->
-</style>
-</head>
-<body>
- <div id="page">
- <div id="header">
- <img id="logo" src="jaxws-services.png" />
- </div>
- <div id="jaxws-services">#jaxws-services#</div>
- </div>
-</body>
+<html>
+<head>
+<title>Webservices</title>
+<style type="text/css">
+<!--
+* {
+ margin: 0;
+ padding: 0;
+}
+
+html {
+ height: 100%;
+ overflow: inherit;
+}
+
+body {
+ height: 100%;
+ width: 100%;
+ background-color: #FFFFFF;
+ font-family: Helvetica, sans-serif;
+ text-align: center;
+ /* in IE, 'margin: 0 auto;' on page style does not work */
+}
+
+#page {
+ min-width: 1000px;
+ width: 60%;
+ background-color: #FFFFFF;
+ padding: 0px;
+ margin: 0 auto;
+}
+
+#header {
+ margin-top: 15px;
+ margin-bottom: 10px;
+ text-align: center;
+}
+
+a:link {
+ color: #0082A1;
+ text-decoration: none
+}
+
+a:visited {
+ color: #0082A1;
+ text-decoration: none
+}
+
+a:active {
+ color: #0082A1;
+ text-decoration: none
+}
+
+a:hover {
+ color: #FE9915;
+ text-decoration: underline
+}
+
+#jaxws-services {
+ margin-top: 10px;
+ margin-bottom: 20px;
+ margin-left: 10px;
+ margin-right: 10px;
+}
+
+.service_box {
+ width: 100%;
+ margin-top: 20px;
+ margin-bottom: 20px;
+ padding: 0px;
+ border-style: solid;
+ border-width: 1px;
+ border-color: #2B82A0;
+ border-spacing: 0px;
+}
+
+.service_name {
+ background-color: #2B82A0;
+ color: #FFFFFF;
+ text-align: left;
+ font-weight: bold;
+ font-size: 14px;
+ padding-left: 10px;
+ padding-right: 5px;
+ padding-top: 2px;
+ padding-bottom: 2px;
+ margin: 0px;
+}
+
+.content_box {
+ border-width: 0px;
+ border-style: none;
+ margin-top: 10px;
+ margin-bottom: 10px;
+ font-size: 12px;
+ padding: 0px;
+}
+
+.left_content_box {
+ width: 60%;
+ padding: 0px;
+ padding-left: 10px;
+ padding-right: 10px;
+ vertical-align: top;
+}
+
+.right_content_box {
+ width: 40%;
+ padding: 0px;
+ padding-left: 10px;
+ padding-right: 10px;
+ vertical-align: top;
+ padding-right: 10px;
+}
+
+.label {
+ font-weight: normal;
+ width: 95px;
+ vertical-align: top;
+}
+
+.content {
+ vertical-align: top;
+}
+
+#logo {
+ border: 0px;
+ border-style: none;
+}
+-->
+</style>
+</head>
+<body>
+ <div id="page">
+ <div id="header">
+ <img id="logo" src="jaxws-services.png" />
+ </div>
+ <div id="jaxws-services">#jaxws-services#</div>
+ </div>
+</body>
</html> \ No newline at end of file
diff --git a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/Activator.java b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/Activator.java
index beac3b6956..ea64fd56e1 100644
--- a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/Activator.java
+++ b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/Activator.java
@@ -1,55 +1,55 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.jaxws;
-
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.scout.commons.TypeCastUtility;
-import org.osgi.framework.BundleContext;
-
-import com.sun.xml.internal.ws.fault.SOAPFaultBuilder;
-
-public class Activator extends Plugin {
-
- public static final String PROP_STACKTRACE = "org.eclipse.scout.jaxws.stacktrace";
- public static final String PROP_DEFAULT_PRINCIPAL = "org.eclipse.scout.jaxws.txhandler.sessionfactory.principal";
- public static final String PROP_PUBLISH_STATUS_PAGE = "org.eclipse.scout.jaxws.publish_status_page";
- public static final String PROP_RESOURCE_BUNDLE = "org.eclipse.scout.jaxws.resource.bundle-name";
- public static final String PROP_RESOURCE_PATH = "org.eclipse.scout.jaxws.resource.bundle-path";
-
- public static final String PLUGIN_ID = "org.eclipse.scout.jaxws";
- private static Activator m_plugin;
-
- public Activator() {
- }
-
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- m_plugin = this;
-
- // apply properties
- BundleContext bundleContext = getBundle().getBundleContext();
- boolean stacktraceEnabled = TypeCastUtility.castValue(bundleContext.getProperty(PROP_STACKTRACE), boolean.class);
- if (!stacktraceEnabled) {
- System.setProperty(SOAPFaultBuilder.class.getName() + ".disableCaptureStackTrace", "false");
- }
- }
-
- @Override
- public void stop(BundleContext context) throws Exception {
- m_plugin = null;
- super.stop(context);
- }
-
- public static Activator getDefault() {
- return m_plugin;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.jaxws;
+
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.scout.commons.TypeCastUtility;
+import org.osgi.framework.BundleContext;
+
+import com.sun.xml.internal.ws.fault.SOAPFaultBuilder;
+
+public class Activator extends Plugin {
+
+ public static final String PROP_STACKTRACE = "org.eclipse.scout.jaxws.stacktrace";
+ public static final String PROP_DEFAULT_PRINCIPAL = "org.eclipse.scout.jaxws.txhandler.sessionfactory.principal";
+ public static final String PROP_PUBLISH_STATUS_PAGE = "org.eclipse.scout.jaxws.publish_status_page";
+ public static final String PROP_RESOURCE_BUNDLE = "org.eclipse.scout.jaxws.resource.bundle-name";
+ public static final String PROP_RESOURCE_PATH = "org.eclipse.scout.jaxws.resource.bundle-path";
+
+ public static final String PLUGIN_ID = "org.eclipse.scout.jaxws";
+ private static Activator m_plugin;
+
+ public Activator() {
+ }
+
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ m_plugin = this;
+
+ // apply properties
+ BundleContext bundleContext = getBundle().getBundleContext();
+ boolean stacktraceEnabled = TypeCastUtility.castValue(bundleContext.getProperty(PROP_STACKTRACE), boolean.class);
+ if (!stacktraceEnabled) {
+ System.setProperty(SOAPFaultBuilder.class.getName() + ".disableCaptureStackTrace", "false");
+ }
+ }
+
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ m_plugin = null;
+ super.stop(context);
+ }
+
+ public static Activator getDefault() {
+ return m_plugin;
+ }
+}
diff --git a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/JaxWsServlet.java b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/JaxWsServlet.java
index 4efe0b30bb..42aefb6eee 100644
--- a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/JaxWsServlet.java
+++ b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/JaxWsServlet.java
@@ -1,92 +1,92 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.jaxws;
-
-import java.io.IOException;
-import java.security.AccessController;
-import java.security.Principal;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-
-import javax.security.auth.Subject;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-
-import org.eclipse.scout.http.servletfilter.ServletFilterDelegate;
-import org.eclipse.scout.jaxws.internal.servlet.EndpointServlet;
-import org.eclipse.scout.jaxws.security.provider.IAuthenticationHandler;
-
-/**
- * Runs the request in a Subject context.
- * Soap handlers may add {@link Principal}'s to {@link Subject#getSubject(java.security.AccessControlContext)}
- *
- * @see {@link Subject#doAs(Subject, java.security.PrivilegedAction)}.
- * @see {@link IAuthenticationHandler}.
- */
-public class JaxWsServlet extends EndpointServlet {
- private static final long serialVersionUID = 1L;
-
- @Override
- public final void service(ServletRequest req, ServletResponse res) throws ServletException, IOException {
- new ServletFilterDelegate().delegateServiceMethod(req, res, new ServletFilterDelegate.IServiceCallback() {
- @Override
- public void service(final ServletRequest reqInner, final ServletResponse resInner) throws ServletException, IOException {
- /*
- * The request can be authenticated in two ways:
- * 1. By the application server itself or a previous filter.
- * In such situation, we are already running in a respective doAs call which implies that the subject obtained
- * is not null and contains one principal at minimum.
- * 2. By a subsequent {@link IAuthenticationHandler} handler.
- * This is if the subject is null or there is no principal associated yet.
- * If the current subject is null or readonly, a new one is created.
- */
- Subject subject = Subject.getSubject(AccessController.getContext());
- if (subject == null || subject.getPrincipals().size() == 0) {
- // request is not authenticated yet
- if (subject == null || subject.isReadOnly()) {
- subject = new Subject(); // precondition that subject is set
- }
- try {
- Subject.doAs(subject, new PrivilegedExceptionAction<Object>() {
- @Override
- public Object run() throws Exception {
- JaxWsServlet.super.service(reqInner, resInner);
- return null;
- }
- });
- }
- catch (PrivilegedActionException e) {
- if (e.getCause() instanceof ServletException) {
- throw (ServletException) e.getCause();
- }
- else if (e.getCause() instanceof IOException) {
- throw (IOException) e.getCause();
- }
- else {
- throw new IOException("Wrapped", e);
- }
- }
- }
- else {
- // request is already authenticated
- JaxWsServlet.super.service(reqInner, resInner);
- }
- }
-
- @Override
- public ServletContext getServletContext() {
- return JaxWsServlet.this.getServletContext();
- }
- });
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.jaxws;
+
+import java.io.IOException;
+import java.security.AccessController;
+import java.security.Principal;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+
+import javax.security.auth.Subject;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+
+import org.eclipse.scout.http.servletfilter.ServletFilterDelegate;
+import org.eclipse.scout.jaxws.internal.servlet.EndpointServlet;
+import org.eclipse.scout.jaxws.security.provider.IAuthenticationHandler;
+
+/**
+ * Runs the request in a Subject context.
+ * Soap handlers may add {@link Principal}'s to {@link Subject#getSubject(java.security.AccessControlContext)}
+ *
+ * @see {@link Subject#doAs(Subject, java.security.PrivilegedAction)}.
+ * @see {@link IAuthenticationHandler}.
+ */
+public class JaxWsServlet extends EndpointServlet {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public final void service(ServletRequest req, ServletResponse res) throws ServletException, IOException {
+ new ServletFilterDelegate().delegateServiceMethod(req, res, new ServletFilterDelegate.IServiceCallback() {
+ @Override
+ public void service(final ServletRequest reqInner, final ServletResponse resInner) throws ServletException, IOException {
+ /*
+ * The request can be authenticated in two ways:
+ * 1. By the application server itself or a previous filter.
+ * In such situation, we are already running in a respective doAs call which implies that the subject obtained
+ * is not null and contains one principal at minimum.
+ * 2. By a subsequent {@link IAuthenticationHandler} handler.
+ * This is if the subject is null or there is no principal associated yet.
+ * If the current subject is null or readonly, a new one is created.
+ */
+ Subject subject = Subject.getSubject(AccessController.getContext());
+ if (subject == null || subject.getPrincipals().size() == 0) {
+ // request is not authenticated yet
+ if (subject == null || subject.isReadOnly()) {
+ subject = new Subject(); // precondition that subject is set
+ }
+ try {
+ Subject.doAs(subject, new PrivilegedExceptionAction<Object>() {
+ @Override
+ public Object run() throws Exception {
+ JaxWsServlet.super.service(reqInner, resInner);
+ return null;
+ }
+ });
+ }
+ catch (PrivilegedActionException e) {
+ if (e.getCause() instanceof ServletException) {
+ throw (ServletException) e.getCause();
+ }
+ else if (e.getCause() instanceof IOException) {
+ throw (IOException) e.getCause();
+ }
+ else {
+ throw new IOException("Wrapped", e);
+ }
+ }
+ }
+ else {
+ // request is already authenticated
+ JaxWsServlet.super.service(reqInner, resInner);
+ }
+ }
+
+ @Override
+ public ServletContext getServletContext() {
+ return JaxWsServlet.this.getServletContext();
+ }
+ });
+ }
+}
diff --git a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/adapters/CalendarAdapter.java b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/adapters/CalendarAdapter.java
index e1564cb4dd..efd56aa603 100644
--- a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/adapters/CalendarAdapter.java
+++ b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/adapters/CalendarAdapter.java
@@ -1,93 +1,93 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.jaxws.adapters;
-
-import java.util.Calendar;
-import java.util.GregorianCalendar;
-
-import javax.xml.bind.annotation.adapters.XmlAdapter;
-import javax.xml.datatype.DatatypeFactory;
-import javax.xml.datatype.XMLGregorianCalendar;
-
-import org.eclipse.scout.commons.StringUtility;
-
-/**
- * <p>
- * Adapter to convert a <code>xsd:dateTime</code> to a {@link Calendar} and vice versa. For both directions, the
- * timezone information is NOT lost. Use this adapter if you expect to work with dates from various timezones without
- * loosing the local time. If the UTC (Zulu-time) is sufficent, use {@link UtcDateAdapter} instead.
- * </p>
- * <p>
- * The {@link String} provided must correspond to the <code>xsd:dateTime</code> format defined on <a
- * href="http://www.w3.org/TR/xmlschema-2/#dateTime">http://www.w3.org/TR/xmlschema-2/#dateTime</a>. The format was
- * inspired by [ISO 8601] but with timezone information included, because in [ISO 8601], a time is only represented as
- * local time or in relation to UTC (Zulu time).
- * </p>
- * <p>
- * <h2>Definition of xsd:dateTime format</h2> <b> Format:
- * <code>'-'? yyyy '-' mm '-' dd 'T' hh ':' mm ':' ss ('.' s+)? (zzzzzz)?</code></b>
- * <ul>
- * <li>'-'? <em>yyyy</em> is a four-or-more digit optionally negative-signed numeral that represents the year; if more
- * than four digits, leading zeros are prohibited, and '0000' is prohibited; also note that a plus sign is <b>not</b>
- * permitted);</li>
- * <li>the remaining '-'s are separators between parts of the date portion;</li>
- * <li>the first <em>mm</em> is a two-digit numeral that represents the month;</li>
- * <li><em>dd</em> is a two-digit numeral that represents the day;</li>
- * <li>'T' is a separator indicating that time-of-day follows;</li>
- * <li><em>hh</em> is a two-digit numeral that represents the hour; '24' is permitted if the minutes and seconds
- * represented are zero, and the <code>dateTime</code> value so represented is the first instant of the following day
- * (the hour property of a <code>dateTime</code> object cannot have a value greater than 23);</li>
- * <li>':' is a separator between parts of the time-of-day portion;</li>
- * <li>the second <em>mm</em> is a two-digit numeral that represents the minute;</li>
- * <li><em>ss</em> is a two-integer-digit numeral that represents the whole seconds;</li>
- * <li>'.' <em>s+</em> (if present) represents the fractional seconds;</li>
- * <li><em>zzzzzz</em> (if present) represents the timezone.</li>
- * </ul>
- * </p>
- */
-public final class CalendarAdapter extends XmlAdapter<String, Calendar> {
-
- public CalendarAdapter() {
- }
-
- @Override
- public String marshal(Calendar calendar) throws Exception {
- if (calendar == null) {
- return null;
- }
-
- GregorianCalendar gregorianCalendar = toGregorianCalendar(calendar);
- DatatypeFactory factory = DatatypeFactory.newInstance();
- XMLGregorianCalendar xmlCalendar = factory.newXMLGregorianCalendar(gregorianCalendar);
- return xmlCalendar.toXMLFormat();
- }
-
- @Override
- public Calendar unmarshal(String rawValue) throws Exception {
- if (!StringUtility.hasText(rawValue)) {
- return null;
- }
-
- DatatypeFactory factory = DatatypeFactory.newInstance();
- XMLGregorianCalendar xmlCalendar = factory.newXMLGregorianCalendar(rawValue);
-
- return xmlCalendar.toGregorianCalendar();
- }
-
- private GregorianCalendar toGregorianCalendar(Calendar calendar) {
- if (calendar == null) {
- return null;
- }
- GregorianCalendar gCal = (GregorianCalendar) GregorianCalendar.getInstance(calendar.getTimeZone());
- gCal.setTimeInMillis(calendar.getTimeInMillis());
- return gCal;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.jaxws.adapters;
+
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+import javax.xml.datatype.DatatypeFactory;
+import javax.xml.datatype.XMLGregorianCalendar;
+
+import org.eclipse.scout.commons.StringUtility;
+
+/**
+ * <p>
+ * Adapter to convert a <code>xsd:dateTime</code> to a {@link Calendar} and vice versa. For both directions, the
+ * timezone information is NOT lost. Use this adapter if you expect to work with dates from various timezones without
+ * loosing the local time. If the UTC (Zulu-time) is sufficent, use {@link UtcDateAdapter} instead.
+ * </p>
+ * <p>
+ * The {@link String} provided must correspond to the <code>xsd:dateTime</code> format defined on <a
+ * href="http://www.w3.org/TR/xmlschema-2/#dateTime">http://www.w3.org/TR/xmlschema-2/#dateTime</a>. The format was
+ * inspired by [ISO 8601] but with timezone information included, because in [ISO 8601], a time is only represented as
+ * local time or in relation to UTC (Zulu time).
+ * </p>
+ * <p>
+ * <h2>Definition of xsd:dateTime format</h2> <b> Format:
+ * <code>'-'? yyyy '-' mm '-' dd 'T' hh ':' mm ':' ss ('.' s+)? (zzzzzz)?</code></b>
+ * <ul>
+ * <li>'-'? <em>yyyy</em> is a four-or-more digit optionally negative-signed numeral that represents the year; if more
+ * than four digits, leading zeros are prohibited, and '0000' is prohibited; also note that a plus sign is <b>not</b>
+ * permitted);</li>
+ * <li>the remaining '-'s are separators between parts of the date portion;</li>
+ * <li>the first <em>mm</em> is a two-digit numeral that represents the month;</li>
+ * <li><em>dd</em> is a two-digit numeral that represents the day;</li>
+ * <li>'T' is a separator indicating that time-of-day follows;</li>
+ * <li><em>hh</em> is a two-digit numeral that represents the hour; '24' is permitted if the minutes and seconds
+ * represented are zero, and the <code>dateTime</code> value so represented is the first instant of the following day
+ * (the hour property of a <code>dateTime</code> object cannot have a value greater than 23);</li>
+ * <li>':' is a separator between parts of the time-of-day portion;</li>
+ * <li>the second <em>mm</em> is a two-digit numeral that represents the minute;</li>
+ * <li><em>ss</em> is a two-integer-digit numeral that represents the whole seconds;</li>
+ * <li>'.' <em>s+</em> (if present) represents the fractional seconds;</li>
+ * <li><em>zzzzzz</em> (if present) represents the timezone.</li>
+ * </ul>
+ * </p>
+ */
+public final class CalendarAdapter extends XmlAdapter<String, Calendar> {
+
+ public CalendarAdapter() {
+ }
+
+ @Override
+ public String marshal(Calendar calendar) throws Exception {
+ if (calendar == null) {
+ return null;
+ }
+
+ GregorianCalendar gregorianCalendar = toGregorianCalendar(calendar);
+ DatatypeFactory factory = DatatypeFactory.newInstance();
+ XMLGregorianCalendar xmlCalendar = factory.newXMLGregorianCalendar(gregorianCalendar);
+ return xmlCalendar.toXMLFormat();
+ }
+
+ @Override
+ public Calendar unmarshal(String rawValue) throws Exception {
+ if (!StringUtility.hasText(rawValue)) {
+ return null;
+ }
+
+ DatatypeFactory factory = DatatypeFactory.newInstance();
+ XMLGregorianCalendar xmlCalendar = factory.newXMLGregorianCalendar(rawValue);
+
+ return xmlCalendar.toGregorianCalendar();
+ }
+
+ private GregorianCalendar toGregorianCalendar(Calendar calendar) {
+ if (calendar == null) {
+ return null;
+ }
+ GregorianCalendar gCal = (GregorianCalendar) GregorianCalendar.getInstance(calendar.getTimeZone());
+ gCal.setTimeInMillis(calendar.getTimeInMillis());
+ return gCal;
+ }
+}
diff --git a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/adapters/DefaultTimezoneDateAdapter.java b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/adapters/DefaultTimezoneDateAdapter.java
index 2704ccd072..bfeb67eb2b 100644
--- a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/adapters/DefaultTimezoneDateAdapter.java
+++ b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/adapters/DefaultTimezoneDateAdapter.java
@@ -1,99 +1,99 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.jaxws.adapters;
-
-import java.util.Calendar;
-import java.util.Date;
-import java.util.GregorianCalendar;
-import java.util.TimeZone;
-
-import javax.xml.bind.annotation.adapters.XmlAdapter;
-import javax.xml.datatype.DatatypeFactory;
-import javax.xml.datatype.XMLGregorianCalendar;
-
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-
-/**
- * <p>
- * Adapter to convert a <code>xsd:dateTime</code> to a {@link Date} and vice versa. For both directions, the
- * transformation is in respect to the default timezone accessible by {@link TimeZone#getDefault()}. If no timezone is
- * provided at all, the date is interpreted to be local to the default timezone.
- * </p>
- * <p>
- * The {@link String} provided must correspond to the <code>xsd:dateTime</code> format defined on <a
- * href="http://www.w3.org/TR/xmlschema-2/#dateTime">http://www.w3.org/TR/xmlschema-2/#dateTime</a>. The format was
- * inspired by [ISO 8601] but with timezone information included, because in [ISO 8601], a time is only represented as
- * local time or in relation to UTC (Zulu time).
- * </p>
- * <p>
- * <h2>Definition of xsd:dateTime format</h2> <b> Format:
- * <code>'-'? yyyy '-' mm '-' dd 'T' hh ':' mm ':' ss ('.' s+)? (zzzzzz)?</code></b>
- * <ul>
- * <li>'-'? <em>yyyy</em> is a four-or-more digit optionally negative-signed numeral that represents the year; if more
- * than four digits, leading zeros are prohibited, and '0000' is prohibited; also note that a plus sign is <b>not</b>
- * permitted);</li>
- * <li>the remaining '-'s are separators between parts of the date portion;</li>
- * <li>the first <em>mm</em> is a two-digit numeral that represents the month;</li>
- * <li><em>dd</em> is a two-digit numeral that represents the day;</li>
- * <li>'T' is a separator indicating that time-of-day follows;</li>
- * <li><em>hh</em> is a two-digit numeral that represents the hour; '24' is permitted if the minutes and seconds
- * represented are zero, and the <code>dateTime</code> value so represented is the first instant of the following day
- * (the hour property of a <code>dateTime</code> object cannot have a value greater than 23);</li>
- * <li>':' is a separator between parts of the time-of-day portion;</li>
- * <li>the second <em>mm</em> is a two-digit numeral that represents the minute;</li>
- * <li><em>ss</em> is a two-integer-digit numeral that represents the whole seconds;</li>
- * <li>'.' <em>s+</em> (if present) represents the fractional seconds;</li>
- * <li><em>zzzzzz</em> (if present) represents the timezone.</li>
- * </ul>
- * </p>
- */
-public class DefaultTimezoneDateAdapter extends XmlAdapter<String, Date> {
-
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(DefaultTimezoneDateAdapter.class);
-
- public DefaultTimezoneDateAdapter() {
- }
-
- @Override
- public String marshal(Date date) throws Exception {
- if (date == null) {
- return null;
- }
-
- long utcMillis = date.getTime();
- GregorianCalendar calendar = new GregorianCalendar(TimeZone.getDefault());
- calendar.setTimeInMillis(utcMillis);
-
- DatatypeFactory factory = DatatypeFactory.newInstance();
- XMLGregorianCalendar xmlCalendar = factory.newXMLGregorianCalendar(calendar);
- return xmlCalendar.toXMLFormat();
- }
-
- @Override
- public Date unmarshal(String rawValue) throws Exception {
- if (!StringUtility.hasText(rawValue)) {
- return null;
- }
-
- // local time of given timezone (or default timezone if not applicable)
- DatatypeFactory factory = DatatypeFactory.newInstance();
- XMLGregorianCalendar xmlCalendar = factory.newXMLGregorianCalendar(rawValue);
- GregorianCalendar calendar = xmlCalendar.toGregorianCalendar();
- long utcMillis = calendar.getTimeInMillis();
-
- // default time
- Calendar defaultTimezoneCalendar = Calendar.getInstance();
- defaultTimezoneCalendar.setTimeInMillis(utcMillis);
- return defaultTimezoneCalendar.getTime();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.jaxws.adapters;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.TimeZone;
+
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+import javax.xml.datatype.DatatypeFactory;
+import javax.xml.datatype.XMLGregorianCalendar;
+
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+
+/**
+ * <p>
+ * Adapter to convert a <code>xsd:dateTime</code> to a {@link Date} and vice versa. For both directions, the
+ * transformation is in respect to the default timezone accessible by {@link TimeZone#getDefault()}. If no timezone is
+ * provided at all, the date is interpreted to be local to the default timezone.
+ * </p>
+ * <p>
+ * The {@link String} provided must correspond to the <code>xsd:dateTime</code> format defined on <a
+ * href="http://www.w3.org/TR/xmlschema-2/#dateTime">http://www.w3.org/TR/xmlschema-2/#dateTime</a>. The format was
+ * inspired by [ISO 8601] but with timezone information included, because in [ISO 8601], a time is only represented as
+ * local time or in relation to UTC (Zulu time).
+ * </p>
+ * <p>
+ * <h2>Definition of xsd:dateTime format</h2> <b> Format:
+ * <code>'-'? yyyy '-' mm '-' dd 'T' hh ':' mm ':' ss ('.' s+)? (zzzzzz)?</code></b>
+ * <ul>
+ * <li>'-'? <em>yyyy</em> is a four-or-more digit optionally negative-signed numeral that represents the year; if more
+ * than four digits, leading zeros are prohibited, and '0000' is prohibited; also note that a plus sign is <b>not</b>
+ * permitted);</li>
+ * <li>the remaining '-'s are separators between parts of the date portion;</li>
+ * <li>the first <em>mm</em> is a two-digit numeral that represents the month;</li>
+ * <li><em>dd</em> is a two-digit numeral that represents the day;</li>
+ * <li>'T' is a separator indicating that time-of-day follows;</li>
+ * <li><em>hh</em> is a two-digit numeral that represents the hour; '24' is permitted if the minutes and seconds
+ * represented are zero, and the <code>dateTime</code> value so represented is the first instant of the following day
+ * (the hour property of a <code>dateTime</code> object cannot have a value greater than 23);</li>
+ * <li>':' is a separator between parts of the time-of-day portion;</li>
+ * <li>the second <em>mm</em> is a two-digit numeral that represents the minute;</li>
+ * <li><em>ss</em> is a two-integer-digit numeral that represents the whole seconds;</li>
+ * <li>'.' <em>s+</em> (if present) represents the fractional seconds;</li>
+ * <li><em>zzzzzz</em> (if present) represents the timezone.</li>
+ * </ul>
+ * </p>
+ */
+public class DefaultTimezoneDateAdapter extends XmlAdapter<String, Date> {
+
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(DefaultTimezoneDateAdapter.class);
+
+ public DefaultTimezoneDateAdapter() {
+ }
+
+ @Override
+ public String marshal(Date date) throws Exception {
+ if (date == null) {
+ return null;
+ }
+
+ long utcMillis = date.getTime();
+ GregorianCalendar calendar = new GregorianCalendar(TimeZone.getDefault());
+ calendar.setTimeInMillis(utcMillis);
+
+ DatatypeFactory factory = DatatypeFactory.newInstance();
+ XMLGregorianCalendar xmlCalendar = factory.newXMLGregorianCalendar(calendar);
+ return xmlCalendar.toXMLFormat();
+ }
+
+ @Override
+ public Date unmarshal(String rawValue) throws Exception {
+ if (!StringUtility.hasText(rawValue)) {
+ return null;
+ }
+
+ // local time of given timezone (or default timezone if not applicable)
+ DatatypeFactory factory = DatatypeFactory.newInstance();
+ XMLGregorianCalendar xmlCalendar = factory.newXMLGregorianCalendar(rawValue);
+ GregorianCalendar calendar = xmlCalendar.toGregorianCalendar();
+ long utcMillis = calendar.getTimeInMillis();
+
+ // default time
+ Calendar defaultTimezoneCalendar = Calendar.getInstance();
+ defaultTimezoneCalendar.setTimeInMillis(utcMillis);
+ return defaultTimezoneCalendar.getTime();
+ }
+}
diff --git a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/adapters/UtcDateAdapter.java b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/adapters/UtcDateAdapter.java
index cf4075fa9c..a1618ed191 100644
--- a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/adapters/UtcDateAdapter.java
+++ b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/adapters/UtcDateAdapter.java
@@ -1,137 +1,137 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.jaxws.adapters;
-
-import java.util.Calendar;
-import java.util.Date;
-import java.util.GregorianCalendar;
-import java.util.TimeZone;
-
-import javax.xml.bind.annotation.adapters.XmlAdapter;
-import javax.xml.datatype.DatatypeFactory;
-import javax.xml.datatype.XMLGregorianCalendar;
-
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-
-/**
- * <p>
- * The {@link String} provided must correspond to the <code>xsd:dateTime</code> format defined on <a
- * href="http://www.w3.org/TR/xmlschema-2/#dateTime">http://www.w3.org/TR/xmlschema-2/#dateTime</a>. The format was
- * inspired by [ISO 8601] but with timezone information included, because in [ISO 8601], a time is only represented as
- * local time or in relation to UTC (Zulu time).
- * </p>
- * <p>
- * <b> Please note, that if there is a timezone present, this adapter transforms the date into the UTC time. To get the
- * local time in that timezone, the timezone shift has to be added to the date. </b>
- * </p>
- * <p>
- * In the following, the rules of conversion to an UTC time are explained:
- * <ul>
- * <li>If there is a timezone included, the resulting {@link Date} would represent the UTC time, not the local time. To
- * get the local time in that timezone, the timezone shift has to be added to the UTC date. If you are expecting dates
- * from within different timezones, this adapter might not be suitable because the timeshift portion is lost which makes
- * it impossible to derive the local time.</li>
- * <li>If an UTC time is provided (dennoted by a 'Z', +00:00 or -00:00 as its timezone), the date is interpreted as UTC
- * time</li>
- * <li>If there no time zone provided at all, the date provided is interpreted to be a local date in respect to the
- * default timezone of this JVM. The resulting date would also be an UTC date.</li>
- * </ul>
- * </p>
- * <p>
- * In the following, please find some examples of the conversion from <code>xsd:date</code> to the UTC {@link Date}.
- * <table border="1">
- * <tr>
- * <th><code>xsd:date</code></th>
- * <th>UTC date</th>
- * <th>Description</th>
- * </tr>
- * <tr>
- * <td>2011-11-03T18:04:00-05:00</td>
- * <td>2011-11-03 23:04:00</td>
- * <td>The date provided represents a local time in the given timezone whereas the resulting date is an UTC date.</td>
- * </tr>
- * <tr>
- * <td>2011-11-03T18:04:00Z</td>
- * <td>2011-11-03 18:04:00</td>
- * <td>The date provided is already an UTC date and therefore is the same as the resulting UTC {@link Date}</td>
- * </tr>
- * <tr>
- * <td>2011-11-03T18:04:00</td>
- * <td>e.g. 2011-11-03 17:04:00, if timezone is <code>+01:00</code></td>
- * <td>The date provided has no timezone information included and therefore is interpreted to be a local date in respect
- * to the default timezone of this JVM. Depending on the default timezone, the resulting UTC date differs.</td>
- * </tr>
- * </table>
- * </p>
- * <p>
- * <h2>Definition of xsd:dateTime format</h2> <b> Format:
- * <code>'-'? yyyy '-' mm '-' dd 'T' hh ':' mm ':' ss ('.' s+)? (zzzzzz)?</code></b>
- * <ul>
- * <li>'-'? <em>yyyy</em> is a four-or-more digit optionally negative-signed numeral that represents the year; if more
- * than four digits, leading zeros are prohibited, and '0000' is prohibited; also note that a plus sign is <b>not</b>
- * permitted);</li>
- * <li>the remaining '-'s are separators between parts of the date portion;</li>
- * <li>the first <em>mm</em> is a two-digit numeral that represents the month;</li>
- * <li><em>dd</em> is a two-digit numeral that represents the day;</li>
- * <li>'T' is a separator indicating that time-of-day follows;</li>
- * <li><em>hh</em> is a two-digit numeral that represents the hour; '24' is permitted if the minutes and seconds
- * represented are zero, and the <code>dateTime</code> value so represented is the first instant of the following day
- * (the hour property of a <code>dateTime</code> object cannot have a value greater than 23);</li>
- * <li>':' is a separator between parts of the time-of-day portion;</li>
- * <li>the second <em>mm</em> is a two-digit numeral that represents the minute;</li>
- * <li><em>ss</em> is a two-integer-digit numeral that represents the whole seconds;</li>
- * <li>'.' <em>s+</em> (if present) represents the fractional seconds;</li>
- * <li><em>zzzzzz</em> (if present) represents the timezone.</li>
- * </ul>
- * </p>
- */
-public class UtcDateAdapter extends XmlAdapter<String, Date> {
-
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(UtcDateAdapter.class);
-
- public UtcDateAdapter() {
- }
-
- @Override
- public String marshal(Date date) throws Exception {
- if (date == null) {
- return null;
- }
-
- long utcMillis = date.getTime();
- GregorianCalendar calendar = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
- calendar.setTimeInMillis(utcMillis);
-
- DatatypeFactory factory = DatatypeFactory.newInstance();
- XMLGregorianCalendar xmlCalendar = factory.newXMLGregorianCalendar(calendar);
- return xmlCalendar.toXMLFormat();
- }
-
- @Override
- public Date unmarshal(String rawValue) throws Exception {
- if (!StringUtility.hasText(rawValue)) {
- return null;
- }
-
- // local time of given timezone (or default timezone if not applicable)
- DatatypeFactory factory = DatatypeFactory.newInstance();
- XMLGregorianCalendar xmlCalendar = factory.newXMLGregorianCalendar(rawValue);
- GregorianCalendar calendar = xmlCalendar.toGregorianCalendar();
- long utcMillis = calendar.getTimeInMillis();
-
- // UTC time
- Calendar utcCalendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
- utcCalendar.setTimeInMillis(utcMillis);
- return utcCalendar.getTime();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.jaxws.adapters;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.TimeZone;
+
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+import javax.xml.datatype.DatatypeFactory;
+import javax.xml.datatype.XMLGregorianCalendar;
+
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+
+/**
+ * <p>
+ * The {@link String} provided must correspond to the <code>xsd:dateTime</code> format defined on <a
+ * href="http://www.w3.org/TR/xmlschema-2/#dateTime">http://www.w3.org/TR/xmlschema-2/#dateTime</a>. The format was
+ * inspired by [ISO 8601] but with timezone information included, because in [ISO 8601], a time is only represented as
+ * local time or in relation to UTC (Zulu time).
+ * </p>
+ * <p>
+ * <b> Please note, that if there is a timezone present, this adapter transforms the date into the UTC time. To get the
+ * local time in that timezone, the timezone shift has to be added to the date. </b>
+ * </p>
+ * <p>
+ * In the following, the rules of conversion to an UTC time are explained:
+ * <ul>
+ * <li>If there is a timezone included, the resulting {@link Date} would represent the UTC time, not the local time. To
+ * get the local time in that timezone, the timezone shift has to be added to the UTC date. If you are expecting dates
+ * from within different timezones, this adapter might not be suitable because the timeshift portion is lost which makes
+ * it impossible to derive the local time.</li>
+ * <li>If an UTC time is provided (dennoted by a 'Z', +00:00 or -00:00 as its timezone), the date is interpreted as UTC
+ * time</li>
+ * <li>If there no time zone provided at all, the date provided is interpreted to be a local date in respect to the
+ * default timezone of this JVM. The resulting date would also be an UTC date.</li>
+ * </ul>
+ * </p>
+ * <p>
+ * In the following, please find some examples of the conversion from <code>xsd:date</code> to the UTC {@link Date}.
+ * <table border="1">
+ * <tr>
+ * <th><code>xsd:date</code></th>
+ * <th>UTC date</th>
+ * <th>Description</th>
+ * </tr>
+ * <tr>
+ * <td>2011-11-03T18:04:00-05:00</td>
+ * <td>2011-11-03 23:04:00</td>
+ * <td>The date provided represents a local time in the given timezone whereas the resulting date is an UTC date.</td>
+ * </tr>
+ * <tr>
+ * <td>2011-11-03T18:04:00Z</td>
+ * <td>2011-11-03 18:04:00</td>
+ * <td>The date provided is already an UTC date and therefore is the same as the resulting UTC {@link Date}</td>
+ * </tr>
+ * <tr>
+ * <td>2011-11-03T18:04:00</td>
+ * <td>e.g. 2011-11-03 17:04:00, if timezone is <code>+01:00</code></td>
+ * <td>The date provided has no timezone information included and therefore is interpreted to be a local date in respect
+ * to the default timezone of this JVM. Depending on the default timezone, the resulting UTC date differs.</td>
+ * </tr>
+ * </table>
+ * </p>
+ * <p>
+ * <h2>Definition of xsd:dateTime format</h2> <b> Format:
+ * <code>'-'? yyyy '-' mm '-' dd 'T' hh ':' mm ':' ss ('.' s+)? (zzzzzz)?</code></b>
+ * <ul>
+ * <li>'-'? <em>yyyy</em> is a four-or-more digit optionally negative-signed numeral that represents the year; if more
+ * than four digits, leading zeros are prohibited, and '0000' is prohibited; also note that a plus sign is <b>not</b>
+ * permitted);</li>
+ * <li>the remaining '-'s are separators between parts of the date portion;</li>
+ * <li>the first <em>mm</em> is a two-digit numeral that represents the month;</li>
+ * <li><em>dd</em> is a two-digit numeral that represents the day;</li>
+ * <li>'T' is a separator indicating that time-of-day follows;</li>
+ * <li><em>hh</em> is a two-digit numeral that represents the hour; '24' is permitted if the minutes and seconds
+ * represented are zero, and the <code>dateTime</code> value so represented is the first instant of the following day
+ * (the hour property of a <code>dateTime</code> object cannot have a value greater than 23);</li>
+ * <li>':' is a separator between parts of the time-of-day portion;</li>
+ * <li>the second <em>mm</em> is a two-digit numeral that represents the minute;</li>
+ * <li><em>ss</em> is a two-integer-digit numeral that represents the whole seconds;</li>
+ * <li>'.' <em>s+</em> (if present) represents the fractional seconds;</li>
+ * <li><em>zzzzzz</em> (if present) represents the timezone.</li>
+ * </ul>
+ * </p>
+ */
+public class UtcDateAdapter extends XmlAdapter<String, Date> {
+
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(UtcDateAdapter.class);
+
+ public UtcDateAdapter() {
+ }
+
+ @Override
+ public String marshal(Date date) throws Exception {
+ if (date == null) {
+ return null;
+ }
+
+ long utcMillis = date.getTime();
+ GregorianCalendar calendar = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
+ calendar.setTimeInMillis(utcMillis);
+
+ DatatypeFactory factory = DatatypeFactory.newInstance();
+ XMLGregorianCalendar xmlCalendar = factory.newXMLGregorianCalendar(calendar);
+ return xmlCalendar.toXMLFormat();
+ }
+
+ @Override
+ public Date unmarshal(String rawValue) throws Exception {
+ if (!StringUtility.hasText(rawValue)) {
+ return null;
+ }
+
+ // local time of given timezone (or default timezone if not applicable)
+ DatatypeFactory factory = DatatypeFactory.newInstance();
+ XMLGregorianCalendar xmlCalendar = factory.newXMLGregorianCalendar(rawValue);
+ GregorianCalendar calendar = xmlCalendar.toGregorianCalendar();
+ long utcMillis = calendar.getTimeInMillis();
+
+ // UTC time
+ Calendar utcCalendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
+ utcCalendar.setTimeInMillis(utcMillis);
+ return utcCalendar.getTime();
+ }
+}
diff --git a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/annotation/ScoutTransaction.java b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/annotation/ScoutTransaction.java
index 5085cfa897..60265aa6be 100644
--- a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/annotation/ScoutTransaction.java
+++ b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/annotation/ScoutTransaction.java
@@ -1,32 +1,32 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.jaxws.annotation;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import org.eclipse.scout.jaxws.session.DefaultServerSessionFactory;
-import org.eclipse.scout.jaxws.session.IServerSessionFactory;
-import org.eclipse.scout.rt.server.IServerSession;
-
-/**
- * <p>
- * Annotate handlers to run within a transactional context on behalf of a {@link IServerSession}.<br/>
- * By default, {@link DefaultServerSessionFactory} is used as session strategy.
- * </p>
- */
-@Target(ElementType.TYPE)
-@Retention(RetentionPolicy.RUNTIME)
-public @interface ScoutTransaction {
- Class<? extends IServerSessionFactory> sessionFactory() default DefaultServerSessionFactory.class;
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.jaxws.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.eclipse.scout.jaxws.session.DefaultServerSessionFactory;
+import org.eclipse.scout.jaxws.session.IServerSessionFactory;
+import org.eclipse.scout.rt.server.IServerSession;
+
+/**
+ * <p>
+ * Annotate handlers to run within a transactional context on behalf of a {@link IServerSession}.<br/>
+ * By default, {@link DefaultServerSessionFactory} is used as session strategy.
+ * </p>
+ */
+@Target(ElementType.TYPE)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface ScoutTransaction {
+ Class<? extends IServerSessionFactory> sessionFactory() default DefaultServerSessionFactory.class;
+}
diff --git a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/annotation/ScoutWebService.java b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/annotation/ScoutWebService.java
index 7404acda8e..f5fe26cfad 100644
--- a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/annotation/ScoutWebService.java
+++ b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/annotation/ScoutWebService.java
@@ -1,61 +1,61 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.jaxws.annotation;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import org.eclipse.scout.jaxws.internal.resolver.ScoutInstanceResolver;
-import org.eclipse.scout.jaxws.security.provider.BasicAuthenticationHandler;
-import org.eclipse.scout.jaxws.security.provider.ConfigIniCredentialValidationStrategy;
-import org.eclipse.scout.jaxws.security.provider.IAuthenticationHandler;
-import org.eclipse.scout.jaxws.security.provider.ICredentialValidationStrategy;
-import org.eclipse.scout.jaxws.session.DefaultServerSessionFactory;
-import org.eclipse.scout.jaxws.session.IServerSessionFactory;
-
-import com.sun.xml.internal.ws.api.server.InstanceResolverAnnotation;
-
-/**
- * <p>
- * Annotation to specify session, authentication and credential validation strategy.<br/>
- * By default, the following configuration is applied:
- * </p>
- * <table border="1">
- * <tr>
- * <td><b>property</b></td>
- * <td><b>default</b></td>
- * </tr>
- * <tr>
- * <td>sessionFactory</td>
- * <td>{@link DefaultServerSessionFactory}</td>
- * </tr>
- * <tr>
- * <td>authenticationHandler</td>
- * <td>{@link BasicAuthenticationHandler}</td>
- * </tr>
- * <tr>
- * <td>credentialValidationStrategy</td>
- * <td>{@link ConfigIniCredentialValidationStrategy}</td>
- * </tr>
- * </table>
- */
-@Target(ElementType.TYPE)
-@InstanceResolverAnnotation(ScoutInstanceResolver.class)
-@Retention(RetentionPolicy.RUNTIME)
-public @interface ScoutWebService {
- Class<? extends IServerSessionFactory> sessionFactory() default DefaultServerSessionFactory.class;
-
- Class<? extends IAuthenticationHandler> authenticationHandler() default BasicAuthenticationHandler.class;
-
- Class<? extends ICredentialValidationStrategy> credentialValidationStrategy() default ConfigIniCredentialValidationStrategy.class;
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.jaxws.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.eclipse.scout.jaxws.internal.resolver.ScoutInstanceResolver;
+import org.eclipse.scout.jaxws.security.provider.BasicAuthenticationHandler;
+import org.eclipse.scout.jaxws.security.provider.ConfigIniCredentialValidationStrategy;
+import org.eclipse.scout.jaxws.security.provider.IAuthenticationHandler;
+import org.eclipse.scout.jaxws.security.provider.ICredentialValidationStrategy;
+import org.eclipse.scout.jaxws.session.DefaultServerSessionFactory;
+import org.eclipse.scout.jaxws.session.IServerSessionFactory;
+
+import com.sun.xml.internal.ws.api.server.InstanceResolverAnnotation;
+
+/**
+ * <p>
+ * Annotation to specify session, authentication and credential validation strategy.<br/>
+ * By default, the following configuration is applied:
+ * </p>
+ * <table border="1">
+ * <tr>
+ * <td><b>property</b></td>
+ * <td><b>default</b></td>
+ * </tr>
+ * <tr>
+ * <td>sessionFactory</td>
+ * <td>{@link DefaultServerSessionFactory}</td>
+ * </tr>
+ * <tr>
+ * <td>authenticationHandler</td>
+ * <td>{@link BasicAuthenticationHandler}</td>
+ * </tr>
+ * <tr>
+ * <td>credentialValidationStrategy</td>
+ * <td>{@link ConfigIniCredentialValidationStrategy}</td>
+ * </tr>
+ * </table>
+ */
+@Target(ElementType.TYPE)
+@InstanceResolverAnnotation(ScoutInstanceResolver.class)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface ScoutWebService {
+ Class<? extends IServerSessionFactory> sessionFactory() default DefaultServerSessionFactory.class;
+
+ Class<? extends IAuthenticationHandler> authenticationHandler() default BasicAuthenticationHandler.class;
+
+ Class<? extends ICredentialValidationStrategy> credentialValidationStrategy() default ConfigIniCredentialValidationStrategy.class;
+}
diff --git a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/annotation/ScoutWebServiceClient.java b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/annotation/ScoutWebServiceClient.java
index be11405f0c..128ffbb4d5 100644
--- a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/annotation/ScoutWebServiceClient.java
+++ b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/annotation/ScoutWebServiceClient.java
@@ -1,29 +1,29 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.jaxws.annotation;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import org.eclipse.scout.jaxws.security.consumer.IAuthenticationHandler;
-
-/**
- * <p>
- * Annotation to specify authentication mechanism.<br/>
- * By default, no authentication handler is installed.
- */
-@Target(ElementType.TYPE)
-@Retention(RetentionPolicy.RUNTIME)
-public @interface ScoutWebServiceClient {
- Class<? extends IAuthenticationHandler> authenticationHandler() default IAuthenticationHandler.NONE.class;
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.jaxws.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.eclipse.scout.jaxws.security.consumer.IAuthenticationHandler;
+
+/**
+ * <p>
+ * Annotation to specify authentication mechanism.<br/>
+ * By default, no authentication handler is installed.
+ */
+@Target(ElementType.TYPE)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface ScoutWebServiceClient {
+ Class<? extends IAuthenticationHandler> authenticationHandler() default IAuthenticationHandler.NONE.class;
+}
diff --git a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/handler/LogHandler.java b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/handler/LogHandler.java
index 833993185e..0bdb2f851b 100644
--- a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/handler/LogHandler.java
+++ b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/handler/LogHandler.java
@@ -1,114 +1,114 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.jaxws.handler;
-
-import java.io.ByteArrayOutputStream;
-import java.util.Set;
-
-import javax.xml.namespace.QName;
-import javax.xml.ws.handler.MessageContext;
-import javax.xml.ws.handler.soap.SOAPHandler;
-import javax.xml.ws.handler.soap.SOAPMessageContext;
-
-import org.eclipse.scout.commons.TypeCastUtility;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-
-/**
- * Handler to log SOAP messages.
- */
-public class LogHandler implements SOAPHandler<SOAPMessageContext> {
-
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(LogHandler.class);
-
- private int m_logLevel;
-
- public LogHandler() {
- initConfig();
- }
-
- protected void initConfig() {
- setLogLevel(getConfiguredLogLevel());
- }
-
- @Override
- public final boolean handleMessage(SOAPMessageContext context) {
- handleLogMessageInternal(context);
- return true;
- }
-
- @Override
- public final boolean handleFault(SOAPMessageContext context) {
- handleLogMessageInternal(context);
- return true;
- }
-
- @Override
- public final Set<QName> getHeaders() {
- return null;
- }
-
- @Override
- public final void close(MessageContext messageContext) {
- }
-
- private void handleLogMessageInternal(SOAPMessageContext context) {
- try {
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- context.getMessage().writeTo(bos);
- bos.close();
- boolean outbound = TypeCastUtility.castValue(context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY), boolean.class);
- handleLogMessage(outbound ? DirectionType.Out : DirectionType.In, bos.toString("UTF-8"), context);
- }
- catch (Exception e) {
- LOG.error("Error occured while logging SOAP message.", e);
- }
- }
-
- protected void handleLogMessage(DirectionType directionType, String soapMessage, SOAPMessageContext context) {
- String logMessage = "WS SOAP [service=" + context.get(SOAPMessageContext.WSDL_SERVICE) + ", port=" + context.get(SOAPMessageContext.WSDL_PORT) + ", operation=" + context.get(SOAPMessageContext.WSDL_OPERATION) + ", direction=" + directionType + ", message=" + soapMessage + "]";
-
- switch (getLogLevel()) {
- case IScoutLogger.LEVEL_WARN:
- LOG.warn(logMessage);
- break;
- case IScoutLogger.LEVEL_DEBUG:
- LOG.debug(logMessage);
- break;
- case IScoutLogger.LEVEL_TRACE:
- LOG.trace(logMessage);
- break;
- default:
- LOG.info(logMessage);
- break;
- }
- }
-
- public int getLogLevel() {
- return m_logLevel;
- }
-
- public void setLogLevel(int logLevel) {
- m_logLevel = logLevel;
- }
-
- @Order(10.0)
- @ConfigProperty(ConfigProperty.INTEGER)
- protected int getConfiguredLogLevel() {
- return IScoutLogger.LEVEL_INFO;
- }
-
- public static enum DirectionType {
- In, Out;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.jaxws.handler;
+
+import java.io.ByteArrayOutputStream;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPHandler;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+import org.eclipse.scout.commons.TypeCastUtility;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+
+/**
+ * Handler to log SOAP messages.
+ */
+public class LogHandler implements SOAPHandler<SOAPMessageContext> {
+
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(LogHandler.class);
+
+ private int m_logLevel;
+
+ public LogHandler() {
+ initConfig();
+ }
+
+ protected void initConfig() {
+ setLogLevel(getConfiguredLogLevel());
+ }
+
+ @Override
+ public final boolean handleMessage(SOAPMessageContext context) {
+ handleLogMessageInternal(context);
+ return true;
+ }
+
+ @Override
+ public final boolean handleFault(SOAPMessageContext context) {
+ handleLogMessageInternal(context);
+ return true;
+ }
+
+ @Override
+ public final Set<QName> getHeaders() {
+ return null;
+ }
+
+ @Override
+ public final void close(MessageContext messageContext) {
+ }
+
+ private void handleLogMessageInternal(SOAPMessageContext context) {
+ try {
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ context.getMessage().writeTo(bos);
+ bos.close();
+ boolean outbound = TypeCastUtility.castValue(context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY), boolean.class);
+ handleLogMessage(outbound ? DirectionType.Out : DirectionType.In, bos.toString("UTF-8"), context);
+ }
+ catch (Exception e) {
+ LOG.error("Error occured while logging SOAP message.", e);
+ }
+ }
+
+ protected void handleLogMessage(DirectionType directionType, String soapMessage, SOAPMessageContext context) {
+ String logMessage = "WS SOAP [service=" + context.get(SOAPMessageContext.WSDL_SERVICE) + ", port=" + context.get(SOAPMessageContext.WSDL_PORT) + ", operation=" + context.get(SOAPMessageContext.WSDL_OPERATION) + ", direction=" + directionType + ", message=" + soapMessage + "]";
+
+ switch (getLogLevel()) {
+ case IScoutLogger.LEVEL_WARN:
+ LOG.warn(logMessage);
+ break;
+ case IScoutLogger.LEVEL_DEBUG:
+ LOG.debug(logMessage);
+ break;
+ case IScoutLogger.LEVEL_TRACE:
+ LOG.trace(logMessage);
+ break;
+ default:
+ LOG.info(logMessage);
+ break;
+ }
+ }
+
+ public int getLogLevel() {
+ return m_logLevel;
+ }
+
+ public void setLogLevel(int logLevel) {
+ m_logLevel = logLevel;
+ }
+
+ @Order(10.0)
+ @ConfigProperty(ConfigProperty.INTEGER)
+ protected int getConfiguredLogLevel() {
+ return IScoutLogger.LEVEL_INFO;
+ }
+
+ public static enum DirectionType {
+ In, Out;
+ }
+}
diff --git a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/handler/internal/IScoutTransactionHandlerWrapper.java b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/handler/internal/IScoutTransactionHandlerWrapper.java
index f25c7bcad7..0af29f8514 100644
--- a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/handler/internal/IScoutTransactionHandlerWrapper.java
+++ b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/handler/internal/IScoutTransactionHandlerWrapper.java
@@ -1,19 +1,19 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.jaxws.handler.internal;
-
-import javax.xml.ws.handler.Handler;
-import javax.xml.ws.handler.MessageContext;
-
-public interface IScoutTransactionHandlerWrapper<T extends MessageContext> {
-
- Handler<T> getHandler();
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.jaxws.handler.internal;
+
+import javax.xml.ws.handler.Handler;
+import javax.xml.ws.handler.MessageContext;
+
+public interface IScoutTransactionHandlerWrapper<T extends MessageContext> {
+
+ Handler<T> getHandler();
+}
diff --git a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/handler/internal/ScoutTransactionLogicalHandlerWrapper.java b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/handler/internal/ScoutTransactionLogicalHandlerWrapper.java
index 288501522f..6bc69c189c 100644
--- a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/handler/internal/ScoutTransactionLogicalHandlerWrapper.java
+++ b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/handler/internal/ScoutTransactionLogicalHandlerWrapper.java
@@ -1,77 +1,77 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.jaxws.handler.internal;
-
-import javax.xml.ws.handler.Handler;
-import javax.xml.ws.handler.LogicalHandler;
-import javax.xml.ws.handler.LogicalMessageContext;
-import javax.xml.ws.handler.MessageContext;
-
-import org.eclipse.scout.commons.RunnableWithException;
-import org.eclipse.scout.jaxws.annotation.ScoutTransaction;
-import org.eclipse.scout.jaxws.internal.ScoutTransactionDelegate;
-
-public class ScoutTransactionLogicalHandlerWrapper<T extends LogicalMessageContext> implements LogicalHandler<T>, IScoutTransactionHandlerWrapper<T> {
-
- protected final ScoutTransactionDelegate m_transactionDelegate;
- protected final LogicalHandler<T> m_logicalHandler;
-
- public ScoutTransactionLogicalHandlerWrapper(LogicalHandler<T> logicalHandler, ScoutTransaction scoutTransaction) {
- m_transactionDelegate = createTransactionDelegate(scoutTransaction);
- m_logicalHandler = logicalHandler;
- }
-
- @Override
- public boolean handleMessage(final T context) {
- RunnableWithException<Boolean> runnable = new RunnableWithException<Boolean>() {
-
- @Override
- public Boolean run() throws Throwable {
- return m_logicalHandler.handleMessage(context);
- }
- };
- return m_transactionDelegate.runInTransaction(runnable, context);
- }
-
- @Override
- public boolean handleFault(final T context) {
- RunnableWithException<Boolean> runnable = new RunnableWithException<Boolean>() {
-
- @Override
- public Boolean run() throws Throwable {
- return m_logicalHandler.handleFault(context);
- }
- };
- return m_transactionDelegate.runInTransaction(runnable, context);
- }
-
- @Override
- public void close(final MessageContext context) {
- RunnableWithException<Boolean> runnable = new RunnableWithException<Boolean>() {
-
- @Override
- public Boolean run() throws Throwable {
- m_logicalHandler.close(context);
- return null;
- }
- };
- m_transactionDelegate.runInTransaction(runnable, context);
- }
-
- protected ScoutTransactionDelegate createTransactionDelegate(ScoutTransaction scoutTransaction) {
- return new ScoutTransactionDelegate(scoutTransaction);
- }
-
- @Override
- public Handler<T> getHandler() {
- return null;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.jaxws.handler.internal;
+
+import javax.xml.ws.handler.Handler;
+import javax.xml.ws.handler.LogicalHandler;
+import javax.xml.ws.handler.LogicalMessageContext;
+import javax.xml.ws.handler.MessageContext;
+
+import org.eclipse.scout.commons.RunnableWithException;
+import org.eclipse.scout.jaxws.annotation.ScoutTransaction;
+import org.eclipse.scout.jaxws.internal.ScoutTransactionDelegate;
+
+public class ScoutTransactionLogicalHandlerWrapper<T extends LogicalMessageContext> implements LogicalHandler<T>, IScoutTransactionHandlerWrapper<T> {
+
+ protected final ScoutTransactionDelegate m_transactionDelegate;
+ protected final LogicalHandler<T> m_logicalHandler;
+
+ public ScoutTransactionLogicalHandlerWrapper(LogicalHandler<T> logicalHandler, ScoutTransaction scoutTransaction) {
+ m_transactionDelegate = createTransactionDelegate(scoutTransaction);
+ m_logicalHandler = logicalHandler;
+ }
+
+ @Override
+ public boolean handleMessage(final T context) {
+ RunnableWithException<Boolean> runnable = new RunnableWithException<Boolean>() {
+
+ @Override
+ public Boolean run() throws Throwable {
+ return m_logicalHandler.handleMessage(context);
+ }
+ };
+ return m_transactionDelegate.runInTransaction(runnable, context);
+ }
+
+ @Override
+ public boolean handleFault(final T context) {
+ RunnableWithException<Boolean> runnable = new RunnableWithException<Boolean>() {
+
+ @Override
+ public Boolean run() throws Throwable {
+ return m_logicalHandler.handleFault(context);
+ }
+ };
+ return m_transactionDelegate.runInTransaction(runnable, context);
+ }
+
+ @Override
+ public void close(final MessageContext context) {
+ RunnableWithException<Boolean> runnable = new RunnableWithException<Boolean>() {
+
+ @Override
+ public Boolean run() throws Throwable {
+ m_logicalHandler.close(context);
+ return null;
+ }
+ };
+ m_transactionDelegate.runInTransaction(runnable, context);
+ }
+
+ protected ScoutTransactionDelegate createTransactionDelegate(ScoutTransaction scoutTransaction) {
+ return new ScoutTransactionDelegate(scoutTransaction);
+ }
+
+ @Override
+ public Handler<T> getHandler() {
+ return null;
+ }
+}
diff --git a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/handler/internal/ScoutTransactionMessageHandlerWrapper.java b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/handler/internal/ScoutTransactionMessageHandlerWrapper.java
index ecad23d2fa..c0eadfdcde 100644
--- a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/handler/internal/ScoutTransactionMessageHandlerWrapper.java
+++ b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/handler/internal/ScoutTransactionMessageHandlerWrapper.java
@@ -1,86 +1,86 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.jaxws.handler.internal;
-
-import java.util.Set;
-
-import javax.xml.namespace.QName;
-import javax.xml.ws.handler.Handler;
-import javax.xml.ws.handler.MessageContext;
-
-import org.eclipse.scout.commons.RunnableWithException;
-import org.eclipse.scout.jaxws.annotation.ScoutTransaction;
-import org.eclipse.scout.jaxws.internal.ScoutTransactionDelegate;
-
-import com.sun.xml.internal.ws.api.handler.MessageHandler;
-import com.sun.xml.internal.ws.api.handler.MessageHandlerContext;
-
-public class ScoutTransactionMessageHandlerWrapper<T extends MessageHandlerContext> implements MessageHandler<T>, IScoutTransactionHandlerWrapper<T> {
-
- protected final ScoutTransactionDelegate m_transactionDelegate;
- protected final MessageHandler<T> m_messageHandler;
-
- public ScoutTransactionMessageHandlerWrapper(MessageHandler<T> messageHandler, ScoutTransaction scoutTransaction) {
- m_transactionDelegate = createTransactionDelegate(scoutTransaction);
- m_messageHandler = messageHandler;
- }
-
- @Override
- public boolean handleMessage(final T context) {
- RunnableWithException<Boolean> runnable = new RunnableWithException<Boolean>() {
-
- @Override
- public Boolean run() throws Throwable {
- return m_messageHandler.handleMessage(context);
- }
- };
- return m_transactionDelegate.runInTransaction(runnable, context);
- }
-
- @Override
- public boolean handleFault(final T context) {
- RunnableWithException<Boolean> runnable = new RunnableWithException<Boolean>() {
-
- @Override
- public Boolean run() throws Throwable {
- return m_messageHandler.handleFault(context);
- }
- };
- return m_transactionDelegate.runInTransaction(runnable, context);
- }
-
- @Override
- public void close(final MessageContext context) {
- RunnableWithException<Boolean> runnable = new RunnableWithException<Boolean>() {
-
- @Override
- public Boolean run() throws Throwable {
- m_messageHandler.close(context);
- return null;
- }
- };
- m_transactionDelegate.runInTransaction(runnable, context);
- }
-
- @Override
- public Set<QName> getHeaders() {
- return m_messageHandler.getHeaders();
- }
-
- protected ScoutTransactionDelegate createTransactionDelegate(ScoutTransaction scoutTransaction) {
- return new ScoutTransactionDelegate(scoutTransaction);
- }
-
- @Override
- public Handler<T> getHandler() {
- return m_messageHandler;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.jaxws.handler.internal;
+
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.handler.Handler;
+import javax.xml.ws.handler.MessageContext;
+
+import org.eclipse.scout.commons.RunnableWithException;
+import org.eclipse.scout.jaxws.annotation.ScoutTransaction;
+import org.eclipse.scout.jaxws.internal.ScoutTransactionDelegate;
+
+import com.sun.xml.internal.ws.api.handler.MessageHandler;
+import com.sun.xml.internal.ws.api.handler.MessageHandlerContext;
+
+public class ScoutTransactionMessageHandlerWrapper<T extends MessageHandlerContext> implements MessageHandler<T>, IScoutTransactionHandlerWrapper<T> {
+
+ protected final ScoutTransactionDelegate m_transactionDelegate;
+ protected final MessageHandler<T> m_messageHandler;
+
+ public ScoutTransactionMessageHandlerWrapper(MessageHandler<T> messageHandler, ScoutTransaction scoutTransaction) {
+ m_transactionDelegate = createTransactionDelegate(scoutTransaction);
+ m_messageHandler = messageHandler;
+ }
+
+ @Override
+ public boolean handleMessage(final T context) {
+ RunnableWithException<Boolean> runnable = new RunnableWithException<Boolean>() {
+
+ @Override
+ public Boolean run() throws Throwable {
+ return m_messageHandler.handleMessage(context);
+ }
+ };
+ return m_transactionDelegate.runInTransaction(runnable, context);
+ }
+
+ @Override
+ public boolean handleFault(final T context) {
+ RunnableWithException<Boolean> runnable = new RunnableWithException<Boolean>() {
+
+ @Override
+ public Boolean run() throws Throwable {
+ return m_messageHandler.handleFault(context);
+ }
+ };
+ return m_transactionDelegate.runInTransaction(runnable, context);
+ }
+
+ @Override
+ public void close(final MessageContext context) {
+ RunnableWithException<Boolean> runnable = new RunnableWithException<Boolean>() {
+
+ @Override
+ public Boolean run() throws Throwable {
+ m_messageHandler.close(context);
+ return null;
+ }
+ };
+ m_transactionDelegate.runInTransaction(runnable, context);
+ }
+
+ @Override
+ public Set<QName> getHeaders() {
+ return m_messageHandler.getHeaders();
+ }
+
+ protected ScoutTransactionDelegate createTransactionDelegate(ScoutTransaction scoutTransaction) {
+ return new ScoutTransactionDelegate(scoutTransaction);
+ }
+
+ @Override
+ public Handler<T> getHandler() {
+ return m_messageHandler;
+ }
+}
diff --git a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/handler/internal/ScoutTransactionSOAPHandlerWrapper.java b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/handler/internal/ScoutTransactionSOAPHandlerWrapper.java
index 6c0a8112ce..23f5503387 100644
--- a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/handler/internal/ScoutTransactionSOAPHandlerWrapper.java
+++ b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/handler/internal/ScoutTransactionSOAPHandlerWrapper.java
@@ -1,85 +1,85 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.jaxws.handler.internal;
-
-import java.util.Set;
-
-import javax.xml.namespace.QName;
-import javax.xml.ws.handler.Handler;
-import javax.xml.ws.handler.MessageContext;
-import javax.xml.ws.handler.soap.SOAPHandler;
-import javax.xml.ws.handler.soap.SOAPMessageContext;
-
-import org.eclipse.scout.commons.RunnableWithException;
-import org.eclipse.scout.jaxws.annotation.ScoutTransaction;
-import org.eclipse.scout.jaxws.internal.ScoutTransactionDelegate;
-
-public class ScoutTransactionSOAPHandlerWrapper<T extends SOAPMessageContext> implements SOAPHandler<T>, IScoutTransactionHandlerWrapper<T> {
-
- protected final ScoutTransactionDelegate m_transactionDelegate;
- protected final SOAPHandler<T> m_soapHandler;
-
- public ScoutTransactionSOAPHandlerWrapper(SOAPHandler<T> soapHandler, ScoutTransaction scoutTransaction) {
- m_transactionDelegate = createTransactionDelegate(scoutTransaction);
- m_soapHandler = soapHandler;
- }
-
- @Override
- public boolean handleMessage(final T context) {
- RunnableWithException<Boolean> runnable = new RunnableWithException<Boolean>() {
-
- @Override
- public Boolean run() throws Throwable {
- return m_soapHandler.handleMessage(context);
- }
- };
- return m_transactionDelegate.runInTransaction(runnable, context);
- }
-
- @Override
- public boolean handleFault(final T context) {
- RunnableWithException<Boolean> runnable = new RunnableWithException<Boolean>() {
-
- @Override
- public Boolean run() throws Throwable {
- return m_soapHandler.handleFault(context);
- }
- };
- return m_transactionDelegate.runInTransaction(runnable, context);
- }
-
- @Override
- public void close(final MessageContext context) {
- RunnableWithException<Boolean> runnable = new RunnableWithException<Boolean>() {
-
- @Override
- public Boolean run() throws Throwable {
- m_soapHandler.close(context);
- return null;
- }
- };
- m_transactionDelegate.runInTransaction(runnable, context);
- }
-
- @Override
- public Set<QName> getHeaders() {
- return m_soapHandler.getHeaders();
- }
-
- protected ScoutTransactionDelegate createTransactionDelegate(ScoutTransaction scoutTransaction) {
- return new ScoutTransactionDelegate(scoutTransaction);
- }
-
- @Override
- public Handler<T> getHandler() {
- return m_soapHandler;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.jaxws.handler.internal;
+
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.handler.Handler;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPHandler;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+import org.eclipse.scout.commons.RunnableWithException;
+import org.eclipse.scout.jaxws.annotation.ScoutTransaction;
+import org.eclipse.scout.jaxws.internal.ScoutTransactionDelegate;
+
+public class ScoutTransactionSOAPHandlerWrapper<T extends SOAPMessageContext> implements SOAPHandler<T>, IScoutTransactionHandlerWrapper<T> {
+
+ protected final ScoutTransactionDelegate m_transactionDelegate;
+ protected final SOAPHandler<T> m_soapHandler;
+
+ public ScoutTransactionSOAPHandlerWrapper(SOAPHandler<T> soapHandler, ScoutTransaction scoutTransaction) {
+ m_transactionDelegate = createTransactionDelegate(scoutTransaction);
+ m_soapHandler = soapHandler;
+ }
+
+ @Override
+ public boolean handleMessage(final T context) {
+ RunnableWithException<Boolean> runnable = new RunnableWithException<Boolean>() {
+
+ @Override
+ public Boolean run() throws Throwable {
+ return m_soapHandler.handleMessage(context);
+ }
+ };
+ return m_transactionDelegate.runInTransaction(runnable, context);
+ }
+
+ @Override
+ public boolean handleFault(final T context) {
+ RunnableWithException<Boolean> runnable = new RunnableWithException<Boolean>() {
+
+ @Override
+ public Boolean run() throws Throwable {
+ return m_soapHandler.handleFault(context);
+ }
+ };
+ return m_transactionDelegate.runInTransaction(runnable, context);
+ }
+
+ @Override
+ public void close(final MessageContext context) {
+ RunnableWithException<Boolean> runnable = new RunnableWithException<Boolean>() {
+
+ @Override
+ public Boolean run() throws Throwable {
+ m_soapHandler.close(context);
+ return null;
+ }
+ };
+ m_transactionDelegate.runInTransaction(runnable, context);
+ }
+
+ @Override
+ public Set<QName> getHeaders() {
+ return m_soapHandler.getHeaders();
+ }
+
+ protected ScoutTransactionDelegate createTransactionDelegate(ScoutTransaction scoutTransaction) {
+ return new ScoutTransactionDelegate(scoutTransaction);
+ }
+
+ @Override
+ public Handler<T> getHandler() {
+ return m_soapHandler;
+ }
+}
diff --git a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/ContextHelper.java b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/ContextHelper.java
index 5b09cedff0..6db11f39f7 100644
--- a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/ContextHelper.java
+++ b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/ContextHelper.java
@@ -1,106 +1,106 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.jaxws.internal;
-
-import javax.xml.ws.handler.MessageContext;
-import javax.xml.ws.handler.MessageContext.Scope;
-
-import org.eclipse.scout.jaxws.session.IServerSessionFactory;
-import org.eclipse.scout.rt.server.IServerSession;
-
-/**
- * Helper to maintain the session on the calling context
- */
-public final class ContextHelper {
- public static final String PROP_SESSION_CONTEXT = "org.eclipse.scout.jaxws.internal.session";
- public static final String PROP_SESSION_FACTORY_PORT_TYPE = "org.eclipse.scout.jaxws.internal.session.factory.porttype";
-
- private ContextHelper() {
- }
-
- /**
- * Returns the session stored on the calling context
- *
- * @param context
- * @return the cached session or null if not applicable
- */
- public static IServerSession getContextSession(MessageContext context) {
- Object object = context.get(PROP_SESSION_CONTEXT);
- if (object instanceof SessionContextBean) {
- return ((SessionContextBean) object).getSession();
- }
- return null;
- }
-
- /**
- * Returns the session factory class which was used to create the cached session.
- *
- * @param context
- * @return the session factory or null if the session is not cached on the calling context yet
- */
- public static Class<? extends IServerSessionFactory> getContextSessionFactoryClass(MessageContext context) {
- Object object = context.get(PROP_SESSION_CONTEXT);
- if (object instanceof SessionContextBean) {
- return ((SessionContextBean) object).getFactoryClass();
- }
- return null;
- }
-
- /**
- * Returns the session factory configured on the port type
- *
- * @param context
- * @return the session factory on the port type or null if not applicable
- */
- public static IServerSessionFactory getPortTypeSessionFactory(MessageContext context) {
- Object object = context.get(PROP_SESSION_FACTORY_PORT_TYPE);
- if (object instanceof IServerSessionFactory) {
- return (IServerSessionFactory) object;
- }
- return null;
- }
-
- /**
- * To set the session and its factory class on the calling context
- *
- * @param context
- * @param factory
- * the factory the given session was created by
- * @param session
- * the created session
- */
- public static void setContextSession(MessageContext context, IServerSessionFactory factory, IServerSession session) {
- if (factory == null || session == null) {
- context.remove(PROP_SESSION_CONTEXT);
- }
- else {
- context.put(PROP_SESSION_CONTEXT, new SessionContextBean(factory.getClass(), session));
- context.setScope(PROP_SESSION_CONTEXT, Scope.APPLICATION); // APPLICATION-SCOPE to be accessible in @{link ScoutInstanceResolver}
- }
- }
-
- /**
- * To set the session factory configured on the port type for the calling context
- *
- * @param context
- * @param factory
- * the factory configured on port type
- */
- public static void setPortTypeSessionFactory(MessageContext context, IServerSessionFactory factory) {
- if (factory == null) {
- context.remove(PROP_SESSION_FACTORY_PORT_TYPE);
- }
- else {
- context.put(PROP_SESSION_FACTORY_PORT_TYPE, factory);
- context.setScope(PROP_SESSION_FACTORY_PORT_TYPE, Scope.HANDLER); // HANDLER-SCOPE as only accessible by handlers
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.jaxws.internal;
+
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.MessageContext.Scope;
+
+import org.eclipse.scout.jaxws.session.IServerSessionFactory;
+import org.eclipse.scout.rt.server.IServerSession;
+
+/**
+ * Helper to maintain the session on the calling context
+ */
+public final class ContextHelper {
+ public static final String PROP_SESSION_CONTEXT = "org.eclipse.scout.jaxws.internal.session";
+ public static final String PROP_SESSION_FACTORY_PORT_TYPE = "org.eclipse.scout.jaxws.internal.session.factory.porttype";
+
+ private ContextHelper() {
+ }
+
+ /**
+ * Returns the session stored on the calling context
+ *
+ * @param context
+ * @return the cached session or null if not applicable
+ */
+ public static IServerSession getContextSession(MessageContext context) {
+ Object object = context.get(PROP_SESSION_CONTEXT);
+ if (object instanceof SessionContextBean) {
+ return ((SessionContextBean) object).getSession();
+ }
+ return null;
+ }
+
+ /**
+ * Returns the session factory class which was used to create the cached session.
+ *
+ * @param context
+ * @return the session factory or null if the session is not cached on the calling context yet
+ */
+ public static Class<? extends IServerSessionFactory> getContextSessionFactoryClass(MessageContext context) {
+ Object object = context.get(PROP_SESSION_CONTEXT);
+ if (object instanceof SessionContextBean) {
+ return ((SessionContextBean) object).getFactoryClass();
+ }
+ return null;
+ }
+
+ /**
+ * Returns the session factory configured on the port type
+ *
+ * @param context
+ * @return the session factory on the port type or null if not applicable
+ */
+ public static IServerSessionFactory getPortTypeSessionFactory(MessageContext context) {
+ Object object = context.get(PROP_SESSION_FACTORY_PORT_TYPE);
+ if (object instanceof IServerSessionFactory) {
+ return (IServerSessionFactory) object;
+ }
+ return null;
+ }
+
+ /**
+ * To set the session and its factory class on the calling context
+ *
+ * @param context
+ * @param factory
+ * the factory the given session was created by
+ * @param session
+ * the created session
+ */
+ public static void setContextSession(MessageContext context, IServerSessionFactory factory, IServerSession session) {
+ if (factory == null || session == null) {
+ context.remove(PROP_SESSION_CONTEXT);
+ }
+ else {
+ context.put(PROP_SESSION_CONTEXT, new SessionContextBean(factory.getClass(), session));
+ context.setScope(PROP_SESSION_CONTEXT, Scope.APPLICATION); // APPLICATION-SCOPE to be accessible in @{link ScoutInstanceResolver}
+ }
+ }
+
+ /**
+ * To set the session factory configured on the port type for the calling context
+ *
+ * @param context
+ * @param factory
+ * the factory configured on port type
+ */
+ public static void setPortTypeSessionFactory(MessageContext context, IServerSessionFactory factory) {
+ if (factory == null) {
+ context.remove(PROP_SESSION_FACTORY_PORT_TYPE);
+ }
+ else {
+ context.put(PROP_SESSION_FACTORY_PORT_TYPE, factory);
+ context.setScope(PROP_SESSION_FACTORY_PORT_TYPE, Scope.HANDLER); // HANDLER-SCOPE as only accessible by handlers
+ }
+ }
+}
diff --git a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/JaxWsEndpointService.java b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/JaxWsEndpointService.java
index 4e1e00bf10..7acd24989b 100644
--- a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/JaxWsEndpointService.java
+++ b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/JaxWsEndpointService.java
@@ -1,288 +1,288 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.jaxws.internal;
-
-import java.io.InputStreamReader;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.xml.ws.handler.Handler;
-
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.commons.FileUtility;
-import org.eclipse.scout.commons.IOUtility;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.jaxws.Activator;
-import org.eclipse.scout.jaxws.handler.internal.IScoutTransactionHandlerWrapper;
-import org.eclipse.scout.jaxws.internal.resources.BundleProxyClassLoader;
-import org.eclipse.scout.jaxws.internal.resources.BundleProxyResourceLoader;
-import org.eclipse.scout.jaxws.internal.resources.SunJaxWsXml;
-import org.eclipse.scout.jaxws.internal.resources.SunJaxWsXmlFinder;
-import org.eclipse.scout.jaxws.internal.servlet.JaxWsHelper;
-import org.eclipse.scout.jaxws.internal.servlet.ServletAdapter;
-import org.eclipse.scout.jaxws.internal.servlet.ServletAdapterFactory;
-import org.eclipse.scout.jaxws.internal.servlet.ServletContainer;
-import org.eclipse.scout.jaxws.security.provider.IAuthenticationHandler;
-import org.eclipse.scout.jaxws.service.IJaxWsEndpointService;
-import org.eclipse.scout.service.AbstractService;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.ServiceRegistration;
-
-import com.sun.xml.internal.ws.api.server.Container;
-import com.sun.xml.internal.ws.resources.WsservletMessages;
-import com.sun.xml.internal.ws.transport.http.DeploymentDescriptorParser;
-import com.sun.xml.internal.ws.transport.http.DeploymentDescriptorParser.AdapterFactory;
-import com.sun.xml.internal.ws.transport.http.ResourceLoader;
-
-public class JaxWsEndpointService extends AbstractService implements IJaxWsEndpointService {
-
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(JaxWsEndpointService.class);
-
- public static final String HTML_STATUS_PAGE_TEMPLATE = "jaxws-services.html";
- public static final String HTML_STATUS_PAGE_ENDPOINT_PLACEHOLDER = "#jaxws-services#";
-
- private ServletAdapter[] m_servletAdapters;
- private String m_propResourceBundle;
- private String m_propResourcePath;
-
- @Override
- public final void initializeService(final ServiceRegistration registration) {
- m_servletAdapters = createEndpointAdapters();
- initResourceBundle();
- }
-
- @Override
- public ServletAdapter[] getServletAdapters() {
- return m_servletAdapters;
- }
-
- @Override
- public ServletAdapter getServletAdapter(final String alias) {
- if (alias == null) {
- return null;
- }
- for (ServletAdapter adapter : m_servletAdapters) {
- if (alias.equals(adapter.getAlias())) {
- return adapter;
- }
- }
- return null;
- }
-
- @Override
- public String getAuthenticationMethod(final ServletAdapter adapter) {
- List<Handler> handlers = adapter.getEndpoint().getBinding().getHandlerChain();
- for (Handler handler : handlers) {
- if (handler instanceof IScoutTransactionHandlerWrapper) {
- handler = ((IScoutTransactionHandlerWrapper) handler).getHandler();
- }
- if (handler instanceof IAuthenticationHandler) {
- return ((IAuthenticationHandler) handler).getName();
- }
- }
- return "None";
- }
-
- @Override
- public final void onGetRequest(final HttpServletRequest request, final HttpServletResponse response, final ServletAdapter[] servletAdapters) throws Exception {
- String pathInfo = request.getPathInfo();
- if (!StringUtility.hasText(pathInfo)) {
- // ensure proper resource loading if trailing slash is missing
- response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
- response.setHeader("Location", new Path(JaxWsHelper.getBaseAddress(request, false)).append(request.getRequestURI()).addTrailingSeparator().toString());
- return;
- }
-
- if (pathInfo == null || pathInfo.endsWith("/") || pathInfo.equals("")) {
- pathInfo = "/" + HTML_STATUS_PAGE_TEMPLATE; // status page
- }
-
- byte[] content = new byte[0];
- if (new Path(pathInfo).lastSegment().equals(HTML_STATUS_PAGE_TEMPLATE)) {
- // status page
- String html = createHtmlStatusPage(request.getContextPath(), servletAdapters);
- if (html != null) {
- content = html.getBytes("UTF-8");
- }
- }
- else {
- // other resource (e.g. image file)
- URL url = resolveResourceURL(pathInfo);
- if (url != null) {
- content = IOUtility.getContent(url.openStream(), true);
- }
- else {
- response.sendError(HttpServletResponse.SC_NOT_FOUND);
- return;
- }
- }
-
- response.getOutputStream().write(content);
- response.setStatus(HttpServletResponse.SC_OK);
- response.setContentLength(content.length);
-
- String contentType = FileUtility.getContentTypeForExtension(new Path(pathInfo).getFileExtension());
- if (contentType == null) {
- contentType = "application/unknown";
- }
- response.setContentType(contentType);
- }
-
- protected String createHtmlStatusPage(final String contextPath, final ServletAdapter[] servletAdapters) throws Exception {
- URL url = resolveResourceURL(HTML_STATUS_PAGE_TEMPLATE);
- if (url == null) {
- return null;
- }
-
- // substitute HTML with table of webservices
- String html = IOUtility.getContent(new InputStreamReader(url.openStream()), true);
- if (!html.contains(HTML_STATUS_PAGE_ENDPOINT_PLACEHOLDER)) {
- return html;
- }
-
- List<ServletAdapter> adaptersOrdered = new ArrayList<ServletAdapter>(Arrays.asList(servletAdapters));
- Collections.sort(adaptersOrdered, new Comparator<ServletAdapter>() {
-
- @Override
- public int compare(ServletAdapter adapter1, ServletAdapter adapter2) {
- return CompareUtility.compareTo(adapter1.getAlias(), adapter2.getAlias());
- }
- });
-
- StringBuilder builder = new StringBuilder();
- for (ServletAdapter adapter : adaptersOrdered) {
- String endpointAddress = adapter.getAddress(contextPath).toString();
-
- builder.append("<table class=\"service_box\" cellpadding=\"0\" cellspacing=\"0\">");
-
- builder.append("<tr><td colspan=\"2\" class=\"service_name\">" + StringUtility.nvl(adapter.getAlias(), "?") + "</td></tr>");
- builder.append("<tr><td class=\"left_content_box\">");
-
- builder.append("<table class=\"content_box\" cellpadding=\"0\" cellspacing=\"0\">");
- builder.append("<tr><td class=\"label\">Service Name:</td><td class=\"content\">" + adapter.getEndpoint().getServiceName() + "</td></tr>");
- builder.append("<tr><td class=\"label\">Port Name:</td><td class=\"content\">" + adapter.getEndpoint().getPortName() + "</td></tr>");
- builder.append("<tr><td class=\"label\">Authentication:</td><td class=\"content\">" + getAuthenticationMethod(adapter) + "</td></tr>");
- builder.append("</table>");
-
- builder.append("</td><td class=\"right_content_box\">");
-
- builder.append("<table class=\"content_box\" cellpadding=\"0\" cellspacing=\"0\">");
- builder.append("<tr><td class=\"label\">Address:</td><td class=\"content\">" + endpointAddress + "</td></tr>");
- builder.append("<tr><td class=\"label\">WSDL:</td><td class=\"content\"><a href=\"" + endpointAddress + "?wsdl\">" + endpointAddress + "?wsdl</a></td></tr>");
- builder.append("</table>");
-
- builder.append("</td></tr>");
- builder.append("</table>");
- }
- return html.replaceFirst(HTML_STATUS_PAGE_ENDPOINT_PLACEHOLDER, builder.toString());
- }
-
- @Override
- public void disposeServices() {
- for (ServletAdapter servletAdapter : m_servletAdapters) {
- try {
- servletAdapter.getEndpoint().dispose();
- }
- catch (Throwable t) {
- LOG.error("failed to dispose webservice endpoint", t);
- }
- }
- }
-
- protected ServletAdapter[] createEndpointAdapters() {
- final List<ServletAdapter> servletAdapters = new ArrayList<ServletAdapter>();
- for (SunJaxWsXml cfg : new SunJaxWsXmlFinder().findAll()) {
- try {
- final URL sunJaxWsXml = cfg.getResource();
- final ClassLoader classLoader = new BundleProxyClassLoader(cfg.getBundle());
- final ClassLoader oldContextCL = Thread.currentThread().getContextClassLoader();
- try {
- Thread.currentThread().setContextClassLoader(classLoader);
-
- final ResourceLoader resourceLoader = new BundleProxyResourceLoader(cfg.getBundle());
- final Container container = createContainer(resourceLoader);
- final AdapterFactory adapterFactory = createServletAdapterFactory();
- final DeploymentDescriptorParser<ServletAdapter> parser = createDeploymentDescriptorParser(classLoader, resourceLoader, container, adapterFactory);
- final List<ServletAdapter> adaptersInBundle = parser.parse(sunJaxWsXml.toExternalForm(), sunJaxWsXml.openStream());
- if (adaptersInBundle != null) {
- servletAdapters.addAll(adaptersInBundle);
- }
- }
- finally {
- Thread.currentThread().setContextClassLoader(oldContextCL);
- }
- }
- catch (Exception e) {
- LOG.error(WsservletMessages.LISTENER_PARSING_FAILED(e) + " for bundle '" + cfg.getBundle().getSymbolicName() + "'", e);
- }
- }
- return servletAdapters.toArray(new ServletAdapter[servletAdapters.size()]);
- }
-
- @SuppressWarnings("unchecked")
- protected DeploymentDescriptorParser<ServletAdapter> createDeploymentDescriptorParser(final ClassLoader classLoader, final ResourceLoader resourceLoader, final Container container, final AdapterFactory adapterFactory) throws MalformedURLException {
- return new DeploymentDescriptorParser(classLoader, resourceLoader, container, adapterFactory);
- }
-
- protected Container createContainer(final ResourceLoader resourceLoader) {
- return new ServletContainer((com.sun.xml.internal.ws.api.ResourceLoader) Platform.getAdapterManager().getAdapter(resourceLoader, com.sun.xml.internal.ws.api.ResourceLoader.class));
- }
-
- protected AdapterFactory<ServletAdapter> createServletAdapterFactory() {
- return new ServletAdapterFactory();
- }
-
- protected URL resolveResourceURL(String pathInfo) {
- if (m_propResourceBundle == null || m_propResourcePath == null) {
- return resolveDefaultResourceURL(pathInfo);
- }
- Bundle resourceBundle = Platform.getBundle(m_propResourceBundle);
- if (resourceBundle == null) {
- LOG.warn("The resource bundle configured in config-ini could not be found [property='" + Activator.PROP_RESOURCE_BUNDLE + "']");
- return resolveDefaultResourceURL(pathInfo);
- }
- URL url = resourceBundle.getResource(new Path(m_propResourcePath).append(pathInfo).toPortableString());
- if (url == null) {
- // fallback
- return resolveDefaultResourceURL(pathInfo);
- }
- return url;
- }
-
- private void initResourceBundle() {
- // resource bundle
- m_propResourceBundle = Activator.getDefault().getBundle().getBundleContext().getProperty(Activator.PROP_RESOURCE_BUNDLE);
- if (!StringUtility.hasText(m_propResourceBundle)) {
- m_propResourceBundle = null;
- }
-
- // resource path
- m_propResourcePath = Activator.getDefault().getBundle().getBundleContext().getProperty(Activator.PROP_RESOURCE_PATH);
- if (!StringUtility.hasText(m_propResourcePath)) {
- m_propResourcePath = null;
- }
- }
-
- private URL resolveDefaultResourceURL(String pathInfo) {
- return Activator.getDefault().getBundle().getResource(new Path("/resources/html/").append(pathInfo).toPortableString());
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.jaxws.internal;
+
+import java.io.InputStreamReader;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.ws.handler.Handler;
+
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.commons.FileUtility;
+import org.eclipse.scout.commons.IOUtility;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.jaxws.Activator;
+import org.eclipse.scout.jaxws.handler.internal.IScoutTransactionHandlerWrapper;
+import org.eclipse.scout.jaxws.internal.resources.BundleProxyClassLoader;
+import org.eclipse.scout.jaxws.internal.resources.BundleProxyResourceLoader;
+import org.eclipse.scout.jaxws.internal.resources.SunJaxWsXml;
+import org.eclipse.scout.jaxws.internal.resources.SunJaxWsXmlFinder;
+import org.eclipse.scout.jaxws.internal.servlet.JaxWsHelper;
+import org.eclipse.scout.jaxws.internal.servlet.ServletAdapter;
+import org.eclipse.scout.jaxws.internal.servlet.ServletAdapterFactory;
+import org.eclipse.scout.jaxws.internal.servlet.ServletContainer;
+import org.eclipse.scout.jaxws.security.provider.IAuthenticationHandler;
+import org.eclipse.scout.jaxws.service.IJaxWsEndpointService;
+import org.eclipse.scout.service.AbstractService;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.ServiceRegistration;
+
+import com.sun.xml.internal.ws.api.server.Container;
+import com.sun.xml.internal.ws.resources.WsservletMessages;
+import com.sun.xml.internal.ws.transport.http.DeploymentDescriptorParser;
+import com.sun.xml.internal.ws.transport.http.DeploymentDescriptorParser.AdapterFactory;
+import com.sun.xml.internal.ws.transport.http.ResourceLoader;
+
+public class JaxWsEndpointService extends AbstractService implements IJaxWsEndpointService {
+
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(JaxWsEndpointService.class);
+
+ public static final String HTML_STATUS_PAGE_TEMPLATE = "jaxws-services.html";
+ public static final String HTML_STATUS_PAGE_ENDPOINT_PLACEHOLDER = "#jaxws-services#";
+
+ private ServletAdapter[] m_servletAdapters;
+ private String m_propResourceBundle;
+ private String m_propResourcePath;
+
+ @Override
+ public final void initializeService(final ServiceRegistration registration) {
+ m_servletAdapters = createEndpointAdapters();
+ initResourceBundle();
+ }
+
+ @Override
+ public ServletAdapter[] getServletAdapters() {
+ return m_servletAdapters;
+ }
+
+ @Override
+ public ServletAdapter getServletAdapter(final String alias) {
+ if (alias == null) {
+ return null;
+ }
+ for (ServletAdapter adapter : m_servletAdapters) {
+ if (alias.equals(adapter.getAlias())) {
+ return adapter;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public String getAuthenticationMethod(final ServletAdapter adapter) {
+ List<Handler> handlers = adapter.getEndpoint().getBinding().getHandlerChain();
+ for (Handler handler : handlers) {
+ if (handler instanceof IScoutTransactionHandlerWrapper) {
+ handler = ((IScoutTransactionHandlerWrapper) handler).getHandler();
+ }
+ if (handler instanceof IAuthenticationHandler) {
+ return ((IAuthenticationHandler) handler).getName();
+ }
+ }
+ return "None";
+ }
+
+ @Override
+ public final void onGetRequest(final HttpServletRequest request, final HttpServletResponse response, final ServletAdapter[] servletAdapters) throws Exception {
+ String pathInfo = request.getPathInfo();
+ if (!StringUtility.hasText(pathInfo)) {
+ // ensure proper resource loading if trailing slash is missing
+ response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
+ response.setHeader("Location", new Path(JaxWsHelper.getBaseAddress(request, false)).append(request.getRequestURI()).addTrailingSeparator().toString());
+ return;
+ }
+
+ if (pathInfo == null || pathInfo.endsWith("/") || pathInfo.equals("")) {
+ pathInfo = "/" + HTML_STATUS_PAGE_TEMPLATE; // status page
+ }
+
+ byte[] content = new byte[0];
+ if (new Path(pathInfo).lastSegment().equals(HTML_STATUS_PAGE_TEMPLATE)) {
+ // status page
+ String html = createHtmlStatusPage(request.getContextPath(), servletAdapters);
+ if (html != null) {
+ content = html.getBytes("UTF-8");
+ }
+ }
+ else {
+ // other resource (e.g. image file)
+ URL url = resolveResourceURL(pathInfo);
+ if (url != null) {
+ content = IOUtility.getContent(url.openStream(), true);
+ }
+ else {
+ response.sendError(HttpServletResponse.SC_NOT_FOUND);
+ return;
+ }
+ }
+
+ response.getOutputStream().write(content);
+ response.setStatus(HttpServletResponse.SC_OK);
+ response.setContentLength(content.length);
+
+ String contentType = FileUtility.getContentTypeForExtension(new Path(pathInfo).getFileExtension());
+ if (contentType == null) {
+ contentType = "application/unknown";
+ }
+ response.setContentType(contentType);
+ }
+
+ protected String createHtmlStatusPage(final String contextPath, final ServletAdapter[] servletAdapters) throws Exception {
+ URL url = resolveResourceURL(HTML_STATUS_PAGE_TEMPLATE);
+ if (url == null) {
+ return null;
+ }
+
+ // substitute HTML with table of webservices
+ String html = IOUtility.getContent(new InputStreamReader(url.openStream()), true);
+ if (!html.contains(HTML_STATUS_PAGE_ENDPOINT_PLACEHOLDER)) {
+ return html;
+ }
+
+ List<ServletAdapter> adaptersOrdered = new ArrayList<ServletAdapter>(Arrays.asList(servletAdapters));
+ Collections.sort(adaptersOrdered, new Comparator<ServletAdapter>() {
+
+ @Override
+ public int compare(ServletAdapter adapter1, ServletAdapter adapter2) {
+ return CompareUtility.compareTo(adapter1.getAlias(), adapter2.getAlias());
+ }
+ });
+
+ StringBuilder builder = new StringBuilder();
+ for (ServletAdapter adapter : adaptersOrdered) {
+ String endpointAddress = adapter.getAddress(contextPath).toString();
+
+ builder.append("<table class=\"service_box\" cellpadding=\"0\" cellspacing=\"0\">");
+
+ builder.append("<tr><td colspan=\"2\" class=\"service_name\">" + StringUtility.nvl(adapter.getAlias(), "?") + "</td></tr>");
+ builder.append("<tr><td class=\"left_content_box\">");
+
+ builder.append("<table class=\"content_box\" cellpadding=\"0\" cellspacing=\"0\">");
+ builder.append("<tr><td class=\"label\">Service Name:</td><td class=\"content\">" + adapter.getEndpoint().getServiceName() + "</td></tr>");
+ builder.append("<tr><td class=\"label\">Port Name:</td><td class=\"content\">" + adapter.getEndpoint().getPortName() + "</td></tr>");
+ builder.append("<tr><td class=\"label\">Authentication:</td><td class=\"content\">" + getAuthenticationMethod(adapter) + "</td></tr>");
+ builder.append("</table>");
+
+ builder.append("</td><td class=\"right_content_box\">");
+
+ builder.append("<table class=\"content_box\" cellpadding=\"0\" cellspacing=\"0\">");
+ builder.append("<tr><td class=\"label\">Address:</td><td class=\"content\">" + endpointAddress + "</td></tr>");
+ builder.append("<tr><td class=\"label\">WSDL:</td><td class=\"content\"><a href=\"" + endpointAddress + "?wsdl\">" + endpointAddress + "?wsdl</a></td></tr>");
+ builder.append("</table>");
+
+ builder.append("</td></tr>");
+ builder.append("</table>");
+ }
+ return html.replaceFirst(HTML_STATUS_PAGE_ENDPOINT_PLACEHOLDER, builder.toString());
+ }
+
+ @Override
+ public void disposeServices() {
+ for (ServletAdapter servletAdapter : m_servletAdapters) {
+ try {
+ servletAdapter.getEndpoint().dispose();
+ }
+ catch (Throwable t) {
+ LOG.error("failed to dispose webservice endpoint", t);
+ }
+ }
+ }
+
+ protected ServletAdapter[] createEndpointAdapters() {
+ final List<ServletAdapter> servletAdapters = new ArrayList<ServletAdapter>();
+ for (SunJaxWsXml cfg : new SunJaxWsXmlFinder().findAll()) {
+ try {
+ final URL sunJaxWsXml = cfg.getResource();
+ final ClassLoader classLoader = new BundleProxyClassLoader(cfg.getBundle());
+ final ClassLoader oldContextCL = Thread.currentThread().getContextClassLoader();
+ try {
+ Thread.currentThread().setContextClassLoader(classLoader);
+
+ final ResourceLoader resourceLoader = new BundleProxyResourceLoader(cfg.getBundle());
+ final Container container = createContainer(resourceLoader);
+ final AdapterFactory adapterFactory = createServletAdapterFactory();
+ final DeploymentDescriptorParser<ServletAdapter> parser = createDeploymentDescriptorParser(classLoader, resourceLoader, container, adapterFactory);
+ final List<ServletAdapter> adaptersInBundle = parser.parse(sunJaxWsXml.toExternalForm(), sunJaxWsXml.openStream());
+ if (adaptersInBundle != null) {
+ servletAdapters.addAll(adaptersInBundle);
+ }
+ }
+ finally {
+ Thread.currentThread().setContextClassLoader(oldContextCL);
+ }
+ }
+ catch (Exception e) {
+ LOG.error(WsservletMessages.LISTENER_PARSING_FAILED(e) + " for bundle '" + cfg.getBundle().getSymbolicName() + "'", e);
+ }
+ }
+ return servletAdapters.toArray(new ServletAdapter[servletAdapters.size()]);
+ }
+
+ @SuppressWarnings("unchecked")
+ protected DeploymentDescriptorParser<ServletAdapter> createDeploymentDescriptorParser(final ClassLoader classLoader, final ResourceLoader resourceLoader, final Container container, final AdapterFactory adapterFactory) throws MalformedURLException {
+ return new DeploymentDescriptorParser(classLoader, resourceLoader, container, adapterFactory);
+ }
+
+ protected Container createContainer(final ResourceLoader resourceLoader) {
+ return new ServletContainer((com.sun.xml.internal.ws.api.ResourceLoader) Platform.getAdapterManager().getAdapter(resourceLoader, com.sun.xml.internal.ws.api.ResourceLoader.class));
+ }
+
+ protected AdapterFactory<ServletAdapter> createServletAdapterFactory() {
+ return new ServletAdapterFactory();
+ }
+
+ protected URL resolveResourceURL(String pathInfo) {
+ if (m_propResourceBundle == null || m_propResourcePath == null) {
+ return resolveDefaultResourceURL(pathInfo);
+ }
+ Bundle resourceBundle = Platform.getBundle(m_propResourceBundle);
+ if (resourceBundle == null) {
+ LOG.warn("The resource bundle configured in config-ini could not be found [property='" + Activator.PROP_RESOURCE_BUNDLE + "']");
+ return resolveDefaultResourceURL(pathInfo);
+ }
+ URL url = resourceBundle.getResource(new Path(m_propResourcePath).append(pathInfo).toPortableString());
+ if (url == null) {
+ // fallback
+ return resolveDefaultResourceURL(pathInfo);
+ }
+ return url;
+ }
+
+ private void initResourceBundle() {
+ // resource bundle
+ m_propResourceBundle = Activator.getDefault().getBundle().getBundleContext().getProperty(Activator.PROP_RESOURCE_BUNDLE);
+ if (!StringUtility.hasText(m_propResourceBundle)) {
+ m_propResourceBundle = null;
+ }
+
+ // resource path
+ m_propResourcePath = Activator.getDefault().getBundle().getBundleContext().getProperty(Activator.PROP_RESOURCE_PATH);
+ if (!StringUtility.hasText(m_propResourcePath)) {
+ m_propResourcePath = null;
+ }
+ }
+
+ private URL resolveDefaultResourceURL(String pathInfo) {
+ return Activator.getDefault().getBundle().getResource(new Path("/resources/html/").append(pathInfo).toPortableString());
+ }
+}
diff --git a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/ScoutTransactionDelegate.java b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/ScoutTransactionDelegate.java
index c2e1a62241..efb69f7d3c 100644
--- a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/ScoutTransactionDelegate.java
+++ b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/ScoutTransactionDelegate.java
@@ -1,111 +1,111 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.jaxws.internal;
-
-import java.security.AccessController;
-
-import javax.security.auth.Subject;
-import javax.xml.ws.WebServiceException;
-import javax.xml.ws.handler.MessageContext;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.scout.commons.RunnableWithException;
-import org.eclipse.scout.commons.holders.Holder;
-import org.eclipse.scout.commons.holders.IHolder;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.jaxws.annotation.ScoutTransaction;
-import org.eclipse.scout.jaxws.session.IServerSessionFactory;
-import org.eclipse.scout.rt.server.IServerSession;
-import org.eclipse.scout.rt.server.ServerJob;
-
-public class ScoutTransactionDelegate {
-
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(ScoutTransactionDelegate.class);
-
- private ScoutTransaction m_scoutTransaction;
-
- public ScoutTransactionDelegate(ScoutTransaction scoutTransaction) {
- m_scoutTransaction = scoutTransaction;
- }
-
- public <T> T runInTransaction(final RunnableWithException<T> runnable, MessageContext context) {
- IServerSession serverSession = ContextHelper.getContextSession(context);
- if (serverSession == null) {
- try {
- IServerSessionFactory factory = m_scoutTransaction.sessionFactory().newInstance();
- serverSession = SessionHelper.createNewServerSession(factory);
- ContextHelper.setContextSession(context, factory, serverSession);
- }
- catch (Exception e) {
- LOG.error("Failed to create server session for transactional handler", e);
- }
- }
- if (serverSession == null) {
- LOG.error("No server session applicable. Handler is not run in transactional scope.");
- return doRun(runnable);
- }
-
- // run in transaction in ServerJob (transaction wrapper)
- final P_Holder<T> resultHolder = new P_Holder<T>();
- final IHolder<RuntimeException> errorHolder = new Holder<RuntimeException>(RuntimeException.class);
-
- Subject subject = Subject.getSubject(AccessController.getContext());
- ServerJob serverJob = new ServerJob("Transactional handler", serverSession, subject) {
-
- @Override
- protected IStatus runTransaction(IProgressMonitor monitor) throws Exception {
- try {
- T result = ScoutTransactionDelegate.this.doRun(runnable);
- resultHolder.setValue(result);
- }
- catch (RuntimeException e) {
- errorHolder.setValue(e);
- }
- return Status.OK_STATUS;
- }
- };
- serverJob.setSystem(true);
- serverJob.runNow(new NullProgressMonitor());
-
- if (errorHolder.getValue() != null) {
- throw errorHolder.getValue();
- }
- return resultHolder.getValue();
- }
-
- protected <T> T doRun(RunnableWithException<T> runnable) {
- try {
- return runnable.run();
- }
- catch (RuntimeException e) {
- throw e;
- }
- catch (Throwable e) {
- throw new WebServiceException(e);
- }
- }
-
- private static class P_Holder<T> {
- private T m_value;
-
- public T getValue() {
- return m_value;
- }
-
- public void setValue(T value) {
- m_value = value;
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.jaxws.internal;
+
+import java.security.AccessController;
+
+import javax.security.auth.Subject;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.handler.MessageContext;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.scout.commons.RunnableWithException;
+import org.eclipse.scout.commons.holders.Holder;
+import org.eclipse.scout.commons.holders.IHolder;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.jaxws.annotation.ScoutTransaction;
+import org.eclipse.scout.jaxws.session.IServerSessionFactory;
+import org.eclipse.scout.rt.server.IServerSession;
+import org.eclipse.scout.rt.server.ServerJob;
+
+public class ScoutTransactionDelegate {
+
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(ScoutTransactionDelegate.class);
+
+ private ScoutTransaction m_scoutTransaction;
+
+ public ScoutTransactionDelegate(ScoutTransaction scoutTransaction) {
+ m_scoutTransaction = scoutTransaction;
+ }
+
+ public <T> T runInTransaction(final RunnableWithException<T> runnable, MessageContext context) {
+ IServerSession serverSession = ContextHelper.getContextSession(context);
+ if (serverSession == null) {
+ try {
+ IServerSessionFactory factory = m_scoutTransaction.sessionFactory().newInstance();
+ serverSession = SessionHelper.createNewServerSession(factory);
+ ContextHelper.setContextSession(context, factory, serverSession);
+ }
+ catch (Exception e) {
+ LOG.error("Failed to create server session for transactional handler", e);
+ }
+ }
+ if (serverSession == null) {
+ LOG.error("No server session applicable. Handler is not run in transactional scope.");
+ return doRun(runnable);
+ }
+
+ // run in transaction in ServerJob (transaction wrapper)
+ final P_Holder<T> resultHolder = new P_Holder<T>();
+ final IHolder<RuntimeException> errorHolder = new Holder<RuntimeException>(RuntimeException.class);
+
+ Subject subject = Subject.getSubject(AccessController.getContext());
+ ServerJob serverJob = new ServerJob("Transactional handler", serverSession, subject) {
+
+ @Override
+ protected IStatus runTransaction(IProgressMonitor monitor) throws Exception {
+ try {
+ T result = ScoutTransactionDelegate.this.doRun(runnable);
+ resultHolder.setValue(result);
+ }
+ catch (RuntimeException e) {
+ errorHolder.setValue(e);
+ }
+ return Status.OK_STATUS;
+ }
+ };
+ serverJob.setSystem(true);
+ serverJob.runNow(new NullProgressMonitor());
+
+ if (errorHolder.getValue() != null) {
+ throw errorHolder.getValue();
+ }
+ return resultHolder.getValue();
+ }
+
+ protected <T> T doRun(RunnableWithException<T> runnable) {
+ try {
+ return runnable.run();
+ }
+ catch (RuntimeException e) {
+ throw e;
+ }
+ catch (Throwable e) {
+ throw new WebServiceException(e);
+ }
+ }
+
+ private static class P_Holder<T> {
+ private T m_value;
+
+ public T getValue() {
+ return m_value;
+ }
+
+ public void setValue(T value) {
+ m_value = value;
+ }
+ }
+}
diff --git a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/SessionContextBean.java b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/SessionContextBean.java
index 67e653cb70..bd665e669e 100644
--- a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/SessionContextBean.java
+++ b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/SessionContextBean.java
@@ -1,40 +1,40 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.jaxws.internal;
-
-import org.eclipse.scout.jaxws.session.IServerSessionFactory;
-import org.eclipse.scout.rt.server.IServerSession;
-
-public class SessionContextBean {
- private Class<? extends IServerSessionFactory> m_factoryClass;
- private IServerSession m_session;
-
- public SessionContextBean(Class<? extends IServerSessionFactory> factoryClass, IServerSession session) {
- m_factoryClass = factoryClass;
- m_session = session;
- }
-
- public Class<? extends IServerSessionFactory> getFactoryClass() {
- return m_factoryClass;
- }
-
- public void setFactoryClass(Class<? extends IServerSessionFactory> factoryClass) {
- m_factoryClass = factoryClass;
- }
-
- public IServerSession getSession() {
- return m_session;
- }
-
- public void setSession(IServerSession session) {
- m_session = session;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.jaxws.internal;
+
+import org.eclipse.scout.jaxws.session.IServerSessionFactory;
+import org.eclipse.scout.rt.server.IServerSession;
+
+public class SessionContextBean {
+ private Class<? extends IServerSessionFactory> m_factoryClass;
+ private IServerSession m_session;
+
+ public SessionContextBean(Class<? extends IServerSessionFactory> factoryClass, IServerSession session) {
+ m_factoryClass = factoryClass;
+ m_session = session;
+ }
+
+ public Class<? extends IServerSessionFactory> getFactoryClass() {
+ return m_factoryClass;
+ }
+
+ public void setFactoryClass(Class<? extends IServerSessionFactory> factoryClass) {
+ m_factoryClass = factoryClass;
+ }
+
+ public IServerSession getSession() {
+ return m_session;
+ }
+
+ public void setSession(IServerSession session) {
+ m_session = session;
+ }
+}
diff --git a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/SessionHelper.java b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/SessionHelper.java
index 44e3a8c1d4..3ef48f0ed7 100644
--- a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/SessionHelper.java
+++ b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/SessionHelper.java
@@ -1,87 +1,87 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.jaxws.internal;
-
-import java.security.AccessController;
-import java.security.PrivilegedExceptionAction;
-
-import javax.security.auth.Subject;
-
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.commons.security.SimplePrincipal;
-import org.eclipse.scout.jaxws.Activator;
-import org.eclipse.scout.jaxws.session.IServerSessionFactory;
-import org.eclipse.scout.rt.server.IServerSession;
-
-/**
- * Helper to create a session
- */
-public final class SessionHelper {
-
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(SessionHelper.class);
-
- private SessionHelper() {
- }
-
- /**
- * To create a new session
- *
- * @param factory
- * the factory to be used to create the session
- * @return
- */
- public static IServerSession createNewServerSession(final IServerSessionFactory factory) {
- if (factory == null) {
- return null;
- }
-
- Subject subject = null;
- try {
- subject = Subject.getSubject(AccessController.getContext());
- }
- catch (Exception e) {
- LOG.error("Failed to get subject of calling access context", e);
- }
- // As long as the request is not authenticated the subject is null or empty. If using container authentication, the subject is always available.
- if (subject == null || subject.getPrincipals().size() == 0) {
- // create subject with anonymous principal
- String principalName = Activator.getDefault().getBundle().getBundleContext().getProperty(Activator.PROP_DEFAULT_PRINCIPAL);
- if (!StringUtility.hasText(principalName)) {
- LOG.warn("No subject found in calling AccessContext. That is why the principal 'anonymous' is registered with the subject. This subject is used to create sessions for transactional handlers as long as the request is not authenticated. The default principal can be changed by configuring the prinicipal in '" + Activator.PROP_DEFAULT_PRINCIPAL + "' in config.ini.");
- principalName = "anonymous";
- }
- subject = new Subject();
- subject.getPrincipals().add(new SimplePrincipal(principalName));
- subject.setReadOnly();
- }
-
- // create the new session on behalf of the subject
- IServerSession serverSession = null;
- try {
- serverSession = Subject.doAs(subject, new PrivilegedExceptionAction<IServerSession>() {
- @Override
- public IServerSession run() throws Exception {
- return factory.create();
- }
- });
- }
- catch (Exception e) {
- LOG.error("Failed to create server session.", e);
- return null;
- }
- if (serverSession == null) {
- LOG.error("Session created by factory '" + factory.getClass().getName() + "' must not be null.");
- }
- return serverSession;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.jaxws.internal;
+
+import java.security.AccessController;
+import java.security.PrivilegedExceptionAction;
+
+import javax.security.auth.Subject;
+
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.commons.security.SimplePrincipal;
+import org.eclipse.scout.jaxws.Activator;
+import org.eclipse.scout.jaxws.session.IServerSessionFactory;
+import org.eclipse.scout.rt.server.IServerSession;
+
+/**
+ * Helper to create a session
+ */
+public final class SessionHelper {
+
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(SessionHelper.class);
+
+ private SessionHelper() {
+ }
+
+ /**
+ * To create a new session
+ *
+ * @param factory
+ * the factory to be used to create the session
+ * @return
+ */
+ public static IServerSession createNewServerSession(final IServerSessionFactory factory) {
+ if (factory == null) {
+ return null;
+ }
+
+ Subject subject = null;
+ try {
+ subject = Subject.getSubject(AccessController.getContext());
+ }
+ catch (Exception e) {
+ LOG.error("Failed to get subject of calling access context", e);
+ }
+ // As long as the request is not authenticated the subject is null or empty. If using container authentication, the subject is always available.
+ if (subject == null || subject.getPrincipals().size() == 0) {
+ // create subject with anonymous principal
+ String principalName = Activator.getDefault().getBundle().getBundleContext().getProperty(Activator.PROP_DEFAULT_PRINCIPAL);
+ if (!StringUtility.hasText(principalName)) {
+ LOG.warn("No subject found in calling AccessContext. That is why the principal 'anonymous' is registered with the subject. This subject is used to create sessions for transactional handlers as long as the request is not authenticated. The default principal can be changed by configuring the prinicipal in '" + Activator.PROP_DEFAULT_PRINCIPAL + "' in config.ini.");
+ principalName = "anonymous";
+ }
+ subject = new Subject();
+ subject.getPrincipals().add(new SimplePrincipal(principalName));
+ subject.setReadOnly();
+ }
+
+ // create the new session on behalf of the subject
+ IServerSession serverSession = null;
+ try {
+ serverSession = Subject.doAs(subject, new PrivilegedExceptionAction<IServerSession>() {
+ @Override
+ public IServerSession run() throws Exception {
+ return factory.create();
+ }
+ });
+ }
+ catch (Exception e) {
+ LOG.error("Failed to create server session.", e);
+ return null;
+ }
+ if (serverSession == null) {
+ LOG.error("Session created by factory '" + factory.getClass().getName() + "' must not be null.");
+ }
+ return serverSession;
+ }
+}
diff --git a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/adapter/ResourceLoaderAdapterFactory.java b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/adapter/ResourceLoaderAdapterFactory.java
index ff2874fdf9..89d42f191f 100644
--- a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/adapter/ResourceLoaderAdapterFactory.java
+++ b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/adapter/ResourceLoaderAdapterFactory.java
@@ -1,35 +1,35 @@
-package org.eclipse.scout.jaxws.internal.adapter;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-
-import com.sun.xml.internal.ws.transport.http.ResourceLoader;
-
-/**
- * Adapter Factory to adapt a {@link ResourceLoader} into a {@link com.sun.xml.internal.ws.api.ResourceLoader} object.
- */
-public class ResourceLoaderAdapterFactory implements IAdapterFactory {
-
- @Override
- public Object getAdapter(Object adaptableObject, Class adapterType) {
- final ResourceLoader resourceLoader = (ResourceLoader) adaptableObject;
-
- if (com.sun.xml.internal.ws.api.ResourceLoader.class.equals(adapterType)) {
- return new com.sun.xml.internal.ws.api.ResourceLoader() {
-
- @Override
- public URL getResource(String resource) throws MalformedURLException {
- return resourceLoader.getResource("/WEB-INF/" + resource);
- }
- };
- }
- return null;
- }
-
- @Override
- public Class<?>[] getAdapterList() {
- return new Class<?>[]{com.sun.xml.internal.ws.api.ResourceLoader.class};
- }
-}
+package org.eclipse.scout.jaxws.internal.adapter;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+
+import com.sun.xml.internal.ws.transport.http.ResourceLoader;
+
+/**
+ * Adapter Factory to adapt a {@link ResourceLoader} into a {@link com.sun.xml.internal.ws.api.ResourceLoader} object.
+ */
+public class ResourceLoaderAdapterFactory implements IAdapterFactory {
+
+ @Override
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ final ResourceLoader resourceLoader = (ResourceLoader) adaptableObject;
+
+ if (com.sun.xml.internal.ws.api.ResourceLoader.class.equals(adapterType)) {
+ return new com.sun.xml.internal.ws.api.ResourceLoader() {
+
+ @Override
+ public URL getResource(String resource) throws MalformedURLException {
+ return resourceLoader.getResource("/WEB-INF/" + resource);
+ }
+ };
+ }
+ return null;
+ }
+
+ @Override
+ public Class<?>[] getAdapterList() {
+ return new Class<?>[]{com.sun.xml.internal.ws.api.ResourceLoader.class};
+ }
+}
diff --git a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/resolver/ScoutInstanceResolver.java b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/resolver/ScoutInstanceResolver.java
index fd92b038e3..eadac35929 100644
--- a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/resolver/ScoutInstanceResolver.java
+++ b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/resolver/ScoutInstanceResolver.java
@@ -1,206 +1,206 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.jaxws.internal.resolver;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.security.AccessController;
-
-import javax.security.auth.Subject;
-import javax.xml.ws.WebServiceException;
-import javax.xml.ws.handler.MessageContext;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.commons.holders.Holder;
-import org.eclipse.scout.commons.holders.ObjectHolder;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.jaxws.annotation.ScoutWebService;
-import org.eclipse.scout.jaxws.internal.ContextHelper;
-import org.eclipse.scout.jaxws.internal.SessionHelper;
-import org.eclipse.scout.jaxws.session.IServerSessionFactory;
-import org.eclipse.scout.rt.server.IServerSession;
-import org.eclipse.scout.rt.server.ServerJob;
-import org.eclipse.scout.rt.server.ThreadContext;
-
-import com.sun.xml.internal.ws.api.message.Packet;
-import com.sun.xml.internal.ws.api.server.Invoker;
-import com.sun.xml.internal.ws.api.server.WSEndpoint;
-import com.sun.xml.internal.ws.api.server.WSWebServiceContext;
-import com.sun.xml.internal.ws.server.AbstractMultiInstanceResolver;
-
-/**
- * This resolver intercepts webservice requests prior to being propagated to the port type in order to
- * bind the call to a {@link IServerSession} context.
- */
-public class ScoutInstanceResolver<T> extends AbstractMultiInstanceResolver<T> {
-
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(ScoutInstanceResolver.class);
-
- private IServerSessionFactory m_sessionFactory;
-
- public ScoutInstanceResolver(Class<T> portTypeClass) {
- super(portTypeClass);
- if (portTypeClass == null) {
- throw new WebServiceException("No port type class configured in sun-jaxws.xml");
- }
- }
-
- @Override
- public void start(WSWebServiceContext context, WSEndpoint endpoint) {
- m_sessionFactory = createSessionFactory(clazz);
- super.start(context, endpoint);
- }
-
- @Override
- public T resolve(Packet packet) {
- return super.create(); // creates a new port type instance, injects the @{WebServiceContext} and invokes the method annotated with @{link PostConstruct}
- }
-
- protected IServerSessionFactory createSessionFactory(Class<?> portTypeClass) {
- ScoutWebService annotation = portTypeClass.getAnnotation(ScoutWebService.class);
- if (annotation == null) {
- return null;
- }
- try {
- return annotation.sessionFactory().newInstance();
- }
- catch (Exception e) {
- LOG.error("Error occured while creating session factory.", e);
- }
- return null;
- }
-
- protected IServerSession getSession(MessageContext context) {
- if (m_sessionFactory == null) {
- return null;
- }
- // Prefer cached session over creating a new one.
- // However, the session is only considered if created by the same type of factory.
- // This is to ensure a proper session context which is what the user is expecting.
- IServerSession contextSession = ContextHelper.getContextSession(context);
- Class<? extends IServerSessionFactory> contextSessionFactory = ContextHelper.getContextSessionFactoryClass(context);
- if (contextSession == null || !CompareUtility.equals(m_sessionFactory.getClass(), contextSessionFactory)) {
- // create a new session
- return SessionHelper.createNewServerSession(m_sessionFactory);
- }
- // cached session
- return contextSession;
- }
-
- @Override
- public Invoker createInvoker() {
- return new P_Invoker();
- }
-
- protected class P_Invoker extends Invoker {
-
- protected WSWebServiceContext m_context;
-
- @Override
- public void start(final WSWebServiceContext context, final WSEndpoint endpoint) {
- m_context = context;
- ScoutInstanceResolver.this.start(context, endpoint);
- }
-
- @Override
- public void dispose() {
- m_context = null;
- ScoutInstanceResolver.this.dispose();
- }
-
- @Override
- public Object invoke(final Packet packet, final Method method, final Object... aobj) throws InvocationTargetException, IllegalAccessException {
- final T portType = ScoutInstanceResolver.this.resolve(packet);
- if (portType == null) {
- throw new WebServiceException("No port type found");
- }
-
- Subject subject = null;
- try {
- subject = Subject.getSubject(AccessController.getContext());
- }
- catch (Exception e) {
- LOG.error("Failed to get subject of calling access context", e);
- }
- if (subject == null) {
- throw new WebServiceException("Webservice request was NOT dispatched due to security reasons: request must run on behalf of a subject context.");
- }
- IServerSession session = getSession(m_context.getMessageContext());
- if (session == null) {
- LOG.warn("Webservice request is not run in a session context as no server session is configured.");
- return method.invoke(portType, aobj);
- }
-
- try {
- final ObjectHolder resultHolder = new ObjectHolder();
- final Holder<InvocationTargetException> invocationTargetExceptionHolder = new Holder<InvocationTargetException>(InvocationTargetException.class);
- final Holder<IllegalAccessException> illegalAccessExceptionHolder = new Holder<IllegalAccessException>(IllegalAccessException.class);
- final Holder<RuntimeException> runtimeExceptionHolder = new Holder<RuntimeException>(RuntimeException.class);
- // run server job
- ServerJob serverJob = new ServerJob("Tx", session, subject) {
-
- @Override
- protected IStatus runTransaction(IProgressMonitor monitor) throws Exception {
- try {
- resultHolder.setValue(method.invoke(portType, aobj));
- }
- catch (InvocationTargetException e) {
- Throwable cause = e.getCause();
- ThreadContext.getTransaction().addFailure(cause); // rollback transaction
-
- if (cause instanceof RuntimeException) {
- LOG.warn("Webservice processing exception occured. Please handle faults by respective checked SOAP faults.", cause);
- invocationTargetExceptionHolder.setValue(new InvocationTargetException(new WebServiceException("Internal Server Error")));
- }
- else {
- // business exception (SOAP faults are checked exceptions)
- LOG.info("Webservice processing exception occured.", cause);
- invocationTargetExceptionHolder.setValue(e);
- }
- }
- catch (IllegalAccessException e) {
- ThreadContext.getTransaction().addFailure(e); // rollback transaction
- LOG.error("Illegal access exception occured while dispatching webservice request. This might be caused because of Java security settings.", e);
- illegalAccessExceptionHolder.setValue(e);
- }
- catch (RuntimeException e) {
- ThreadContext.getTransaction().addFailure(e); // rollback transaction
- LOG.error("Unexpected error occured while dispatching webservice request.", e);
- runtimeExceptionHolder.setValue(e);
- }
-
- return Status.OK_STATUS;
- }
- };
- serverJob.setSystem(true);
- serverJob.runNow(new NullProgressMonitor());
- if (invocationTargetExceptionHolder.getValue() != null) {
- throw invocationTargetExceptionHolder.getValue();
- }
- if (illegalAccessExceptionHolder.getValue() != null) {
- throw illegalAccessExceptionHolder.getValue();
- }
- if (runtimeExceptionHolder.getValue() != null) {
- throw runtimeExceptionHolder.getValue();
- }
- return resultHolder.getValue();
- }
- finally {
- postInvoke(packet, portType);
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.jaxws.internal.resolver;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.security.AccessController;
+
+import javax.security.auth.Subject;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.handler.MessageContext;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.commons.holders.Holder;
+import org.eclipse.scout.commons.holders.ObjectHolder;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.jaxws.annotation.ScoutWebService;
+import org.eclipse.scout.jaxws.internal.ContextHelper;
+import org.eclipse.scout.jaxws.internal.SessionHelper;
+import org.eclipse.scout.jaxws.session.IServerSessionFactory;
+import org.eclipse.scout.rt.server.IServerSession;
+import org.eclipse.scout.rt.server.ServerJob;
+import org.eclipse.scout.rt.server.ThreadContext;
+
+import com.sun.xml.internal.ws.api.message.Packet;
+import com.sun.xml.internal.ws.api.server.Invoker;
+import com.sun.xml.internal.ws.api.server.WSEndpoint;
+import com.sun.xml.internal.ws.api.server.WSWebServiceContext;
+import com.sun.xml.internal.ws.server.AbstractMultiInstanceResolver;
+
+/**
+ * This resolver intercepts webservice requests prior to being propagated to the port type in order to
+ * bind the call to a {@link IServerSession} context.
+ */
+public class ScoutInstanceResolver<T> extends AbstractMultiInstanceResolver<T> {
+
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(ScoutInstanceResolver.class);
+
+ private IServerSessionFactory m_sessionFactory;
+
+ public ScoutInstanceResolver(Class<T> portTypeClass) {
+ super(portTypeClass);
+ if (portTypeClass == null) {
+ throw new WebServiceException("No port type class configured in sun-jaxws.xml");
+ }
+ }
+
+ @Override
+ public void start(WSWebServiceContext context, WSEndpoint endpoint) {
+ m_sessionFactory = createSessionFactory(clazz);
+ super.start(context, endpoint);
+ }
+
+ @Override
+ public T resolve(Packet packet) {
+ return super.create(); // creates a new port type instance, injects the @{WebServiceContext} and invokes the method annotated with @{link PostConstruct}
+ }
+
+ protected IServerSessionFactory createSessionFactory(Class<?> portTypeClass) {
+ ScoutWebService annotation = portTypeClass.getAnnotation(ScoutWebService.class);
+ if (annotation == null) {
+ return null;
+ }
+ try {
+ return annotation.sessionFactory().newInstance();
+ }
+ catch (Exception e) {
+ LOG.error("Error occured while creating session factory.", e);
+ }
+ return null;
+ }
+
+ protected IServerSession getSession(MessageContext context) {
+ if (m_sessionFactory == null) {
+ return null;
+ }
+ // Prefer cached session over creating a new one.
+ // However, the session is only considered if created by the same type of factory.
+ // This is to ensure a proper session context which is what the user is expecting.
+ IServerSession contextSession = ContextHelper.getContextSession(context);
+ Class<? extends IServerSessionFactory> contextSessionFactory = ContextHelper.getContextSessionFactoryClass(context);
+ if (contextSession == null || !CompareUtility.equals(m_sessionFactory.getClass(), contextSessionFactory)) {
+ // create a new session
+ return SessionHelper.createNewServerSession(m_sessionFactory);
+ }
+ // cached session
+ return contextSession;
+ }
+
+ @Override
+ public Invoker createInvoker() {
+ return new P_Invoker();
+ }
+
+ protected class P_Invoker extends Invoker {
+
+ protected WSWebServiceContext m_context;
+
+ @Override
+ public void start(final WSWebServiceContext context, final WSEndpoint endpoint) {
+ m_context = context;
+ ScoutInstanceResolver.this.start(context, endpoint);
+ }
+
+ @Override
+ public void dispose() {
+ m_context = null;
+ ScoutInstanceResolver.this.dispose();
+ }
+
+ @Override
+ public Object invoke(final Packet packet, final Method method, final Object... aobj) throws InvocationTargetException, IllegalAccessException {
+ final T portType = ScoutInstanceResolver.this.resolve(packet);
+ if (portType == null) {
+ throw new WebServiceException("No port type found");
+ }
+
+ Subject subject = null;
+ try {
+ subject = Subject.getSubject(AccessController.getContext());
+ }
+ catch (Exception e) {
+ LOG.error("Failed to get subject of calling access context", e);
+ }
+ if (subject == null) {
+ throw new WebServiceException("Webservice request was NOT dispatched due to security reasons: request must run on behalf of a subject context.");
+ }
+ IServerSession session = getSession(m_context.getMessageContext());
+ if (session == null) {
+ LOG.warn("Webservice request is not run in a session context as no server session is configured.");
+ return method.invoke(portType, aobj);
+ }
+
+ try {
+ final ObjectHolder resultHolder = new ObjectHolder();
+ final Holder<InvocationTargetException> invocationTargetExceptionHolder = new Holder<InvocationTargetException>(InvocationTargetException.class);
+ final Holder<IllegalAccessException> illegalAccessExceptionHolder = new Holder<IllegalAccessException>(IllegalAccessException.class);
+ final Holder<RuntimeException> runtimeExceptionHolder = new Holder<RuntimeException>(RuntimeException.class);
+ // run server job
+ ServerJob serverJob = new ServerJob("Tx", session, subject) {
+
+ @Override
+ protected IStatus runTransaction(IProgressMonitor monitor) throws Exception {
+ try {
+ resultHolder.setValue(method.invoke(portType, aobj));
+ }
+ catch (InvocationTargetException e) {
+ Throwable cause = e.getCause();
+ ThreadContext.getTransaction().addFailure(cause); // rollback transaction
+
+ if (cause instanceof RuntimeException) {
+ LOG.warn("Webservice processing exception occured. Please handle faults by respective checked SOAP faults.", cause);
+ invocationTargetExceptionHolder.setValue(new InvocationTargetException(new WebServiceException("Internal Server Error")));
+ }
+ else {
+ // business exception (SOAP faults are checked exceptions)
+ LOG.info("Webservice processing exception occured.", cause);
+ invocationTargetExceptionHolder.setValue(e);
+ }
+ }
+ catch (IllegalAccessException e) {
+ ThreadContext.getTransaction().addFailure(e); // rollback transaction
+ LOG.error("Illegal access exception occured while dispatching webservice request. This might be caused because of Java security settings.", e);
+ illegalAccessExceptionHolder.setValue(e);
+ }
+ catch (RuntimeException e) {
+ ThreadContext.getTransaction().addFailure(e); // rollback transaction
+ LOG.error("Unexpected error occured while dispatching webservice request.", e);
+ runtimeExceptionHolder.setValue(e);
+ }
+
+ return Status.OK_STATUS;
+ }
+ };
+ serverJob.setSystem(true);
+ serverJob.runNow(new NullProgressMonitor());
+ if (invocationTargetExceptionHolder.getValue() != null) {
+ throw invocationTargetExceptionHolder.getValue();
+ }
+ if (illegalAccessExceptionHolder.getValue() != null) {
+ throw illegalAccessExceptionHolder.getValue();
+ }
+ if (runtimeExceptionHolder.getValue() != null) {
+ throw runtimeExceptionHolder.getValue();
+ }
+ return resultHolder.getValue();
+ }
+ finally {
+ postInvoke(packet, portType);
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/resources/AbstractResolver.java b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/resources/AbstractResolver.java
index 7f53126074..65257ad930 100644
--- a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/resources/AbstractResolver.java
+++ b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/resources/AbstractResolver.java
@@ -1,63 +1,63 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.jaxws.internal.resources;
-
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.osgi.framework.Bundle;
-
-abstract class AbstractResolver<T> {
-
- private static final Logger LOG = Logger.getLogger("com.sun.xml.ws.server.http");
-
- private Bundle[] m_bundles;
-
- public AbstractResolver(Bundle... bundles) {
- m_bundles = bundles;
- }
-
- public void setBundles(Bundle[] bundles) {
- m_bundles = bundles;
- }
-
- public T resolve() {
- for (Bundle bundle : m_bundles) {
- // bundle must be in state RESOLVED at minimum
- if (bundle.getState() < Bundle.RESOLVED) {
- LOG.log(Level.SEVERE, "JAXWS resources could not be loaded as bundle '" + bundle.getSymbolicName() + "' is not in state RESOLVED.");
- continue;
- }
-
- try {
- return resolve(bundle);
- }
- catch (ResourceNotFoundException e) {
- //nop
- }
- }
- return resolveEmpty();
- }
-
- public abstract T resolve(Bundle bundle) throws ResourceNotFoundException;
-
- public T resolveEmpty() {
- return null;
- }
-
- /**
- * Exception to indicate that no resource is found.
- */
- static class ResourceNotFoundException extends Exception {
-
- private static final long serialVersionUID = 1L;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.jaxws.internal.resources;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.osgi.framework.Bundle;
+
+abstract class AbstractResolver<T> {
+
+ private static final Logger LOG = Logger.getLogger("com.sun.xml.ws.server.http");
+
+ private Bundle[] m_bundles;
+
+ public AbstractResolver(Bundle... bundles) {
+ m_bundles = bundles;
+ }
+
+ public void setBundles(Bundle[] bundles) {
+ m_bundles = bundles;
+ }
+
+ public T resolve() {
+ for (Bundle bundle : m_bundles) {
+ // bundle must be in state RESOLVED at minimum
+ if (bundle.getState() < Bundle.RESOLVED) {
+ LOG.log(Level.SEVERE, "JAXWS resources could not be loaded as bundle '" + bundle.getSymbolicName() + "' is not in state RESOLVED.");
+ continue;
+ }
+
+ try {
+ return resolve(bundle);
+ }
+ catch (ResourceNotFoundException e) {
+ //nop
+ }
+ }
+ return resolveEmpty();
+ }
+
+ public abstract T resolve(Bundle bundle) throws ResourceNotFoundException;
+
+ public T resolveEmpty() {
+ return null;
+ }
+
+ /**
+ * Exception to indicate that no resource is found.
+ */
+ static class ResourceNotFoundException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+ }
+}
diff --git a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/resources/BundleProxyClassLoader.java b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/resources/BundleProxyClassLoader.java
index a2d53a5b95..1624cbd879 100644
--- a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/resources/BundleProxyClassLoader.java
+++ b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/resources/BundleProxyClassLoader.java
@@ -1,205 +1,205 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.jaxws.internal.resources;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.logging.Logger;
-
-import org.eclipse.scout.jaxws.Activator;
-import org.osgi.framework.Bundle;
-
-public class BundleProxyClassLoader extends ClassLoader {
-
- private static final Logger LOG = Logger.getLogger("com.sun.xml.ws.server.http");
-
- private Bundle m_bundle;
-
- public BundleProxyClassLoader(Bundle bundle) {
- m_bundle = bundle;
- }
-
- @Override
- protected Class<?> findClass(String name) throws ClassNotFoundException {
- return new P_FindClassResolver(name, Activator.getDefault().getBundle(), m_bundle).resolve();
- }
-
- @Override
- protected URL findResource(String name) {
- return new P_FindResourceResolver(name, Activator.getDefault().getBundle(), m_bundle).resolve();
- }
-
- @Override
- protected Enumeration<URL> findResources(String name) throws IOException {
- return new P_FindResourcesResolver(name, Activator.getDefault().getBundle(), m_bundle).resolve();
- }
-
- @Override
- public Enumeration<URL> getResources(String name) throws IOException {
- return new P_GetResourcesResolver(name, Activator.getDefault().getBundle(), m_bundle).resolve();
- }
-
- @Override
- public URL getResource(String name) {
- return new P_GetResourceResolver(name, Activator.getDefault().getBundle(), m_bundle).resolve();
- }
-
- @Override
- public InputStream getResourceAsStream(String name) {
- return new P_GetResourceAsStream(name, Activator.getDefault().getBundle(), m_bundle).resolve();
- }
-
- private class P_FindClassResolver extends AbstractResolver<Class<?>> {
-
- private String m_name;
-
- public P_FindClassResolver(String name, Bundle... bundles) {
- super(bundles);
- m_name = name;
- }
-
- @Override
- public Class<?> resolve(Bundle bundle) throws ResourceNotFoundException {
- try {
- return bundle.loadClass(m_name);
- }
- catch (Exception e) {
- throw new ResourceNotFoundException();
- }
- }
- }
-
- private class P_FindResourceResolver extends AbstractResolver<URL> {
-
- private String m_name;
-
- public P_FindResourceResolver(String name, Bundle... bundles) {
- super(bundles);
- m_name = name;
- }
-
- @Override
- public URL resolve(Bundle bundle) throws ResourceNotFoundException {
- URL url = bundle.getResource(m_name);
- if (url != null) {
- return url;
- }
- throw new ResourceNotFoundException();
- }
- }
-
- private class P_GetResourceResolver extends AbstractResolver<URL> {
-
- private String m_name;
-
- public P_GetResourceResolver(String name, Bundle... bundles) {
- super(bundles);
- m_name = name;
- }
-
- @Override
- public URL resolve(Bundle bundle) throws ResourceNotFoundException {
- URL url = bundle.getResource(m_name);
- if (url != null) {
- return url;
- }
- throw new ResourceNotFoundException();
- }
- }
-
- private class P_GetResourcesResolver extends AbstractResolver<Enumeration<URL>> {
-
- private String m_name;
-
- public P_GetResourcesResolver(String name, Bundle... bundles) {
- super(bundles);
- m_name = name;
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public Enumeration<URL> resolve(Bundle bundle) throws ResourceNotFoundException {
- try {
- Enumeration<URL> urls = bundle.getResources(m_name);
- if (urls != null && urls.hasMoreElements()) {
- return urls;
- }
- }
- catch (IOException e) {
- }
-
- throw new ResourceNotFoundException();
- }
-
- @Override
- public Enumeration<URL> resolveEmpty() {
- return Collections.enumeration(new ArrayList<URL>(0));
- }
- }
-
- private class P_FindResourcesResolver extends AbstractResolver<Enumeration<URL>> {
-
- private String m_name;
-
- public P_FindResourcesResolver(String name, Bundle... bundles) {
- super(bundles);
- m_name = name;
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public Enumeration<URL> resolve(Bundle bundle) throws ResourceNotFoundException {
- try {
- Enumeration<URL> urls = bundle.getResources(m_name);
- if (urls != null && urls.hasMoreElements()) {
- return urls;
- }
- }
- catch (Exception e) {
- }
-
- throw new ResourceNotFoundException();
- }
-
- @Override
- public Enumeration<URL> resolveEmpty() {
- return Collections.enumeration(new ArrayList<URL>(0));
- }
- }
-
- private class P_GetResourceAsStream extends AbstractResolver<InputStream> {
-
- private String m_name;
-
- public P_GetResourceAsStream(String name, Bundle... bundles) {
- super(bundles);
- m_name = name;
- }
-
- @Override
- public InputStream resolve(Bundle bundle) throws ResourceNotFoundException {
- URL url = bundle.getResource(m_name);
- if (url != null) {
- try {
- return url.openStream();
- }
- catch (Exception e) {
- // nop
- }
- }
- throw new ResourceNotFoundException();
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.jaxws.internal.resources;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.logging.Logger;
+
+import org.eclipse.scout.jaxws.Activator;
+import org.osgi.framework.Bundle;
+
+public class BundleProxyClassLoader extends ClassLoader {
+
+ private static final Logger LOG = Logger.getLogger("com.sun.xml.ws.server.http");
+
+ private Bundle m_bundle;
+
+ public BundleProxyClassLoader(Bundle bundle) {
+ m_bundle = bundle;
+ }
+
+ @Override
+ protected Class<?> findClass(String name) throws ClassNotFoundException {
+ return new P_FindClassResolver(name, Activator.getDefault().getBundle(), m_bundle).resolve();
+ }
+
+ @Override
+ protected URL findResource(String name) {
+ return new P_FindResourceResolver(name, Activator.getDefault().getBundle(), m_bundle).resolve();
+ }
+
+ @Override
+ protected Enumeration<URL> findResources(String name) throws IOException {
+ return new P_FindResourcesResolver(name, Activator.getDefault().getBundle(), m_bundle).resolve();
+ }
+
+ @Override
+ public Enumeration<URL> getResources(String name) throws IOException {
+ return new P_GetResourcesResolver(name, Activator.getDefault().getBundle(), m_bundle).resolve();
+ }
+
+ @Override
+ public URL getResource(String name) {
+ return new P_GetResourceResolver(name, Activator.getDefault().getBundle(), m_bundle).resolve();
+ }
+
+ @Override
+ public InputStream getResourceAsStream(String name) {
+ return new P_GetResourceAsStream(name, Activator.getDefault().getBundle(), m_bundle).resolve();
+ }
+
+ private class P_FindClassResolver extends AbstractResolver<Class<?>> {
+
+ private String m_name;
+
+ public P_FindClassResolver(String name, Bundle... bundles) {
+ super(bundles);
+ m_name = name;
+ }
+
+ @Override
+ public Class<?> resolve(Bundle bundle) throws ResourceNotFoundException {
+ try {
+ return bundle.loadClass(m_name);
+ }
+ catch (Exception e) {
+ throw new ResourceNotFoundException();
+ }
+ }
+ }
+
+ private class P_FindResourceResolver extends AbstractResolver<URL> {
+
+ private String m_name;
+
+ public P_FindResourceResolver(String name, Bundle... bundles) {
+ super(bundles);
+ m_name = name;
+ }
+
+ @Override
+ public URL resolve(Bundle bundle) throws ResourceNotFoundException {
+ URL url = bundle.getResource(m_name);
+ if (url != null) {
+ return url;
+ }
+ throw new ResourceNotFoundException();
+ }
+ }
+
+ private class P_GetResourceResolver extends AbstractResolver<URL> {
+
+ private String m_name;
+
+ public P_GetResourceResolver(String name, Bundle... bundles) {
+ super(bundles);
+ m_name = name;
+ }
+
+ @Override
+ public URL resolve(Bundle bundle) throws ResourceNotFoundException {
+ URL url = bundle.getResource(m_name);
+ if (url != null) {
+ return url;
+ }
+ throw new ResourceNotFoundException();
+ }
+ }
+
+ private class P_GetResourcesResolver extends AbstractResolver<Enumeration<URL>> {
+
+ private String m_name;
+
+ public P_GetResourcesResolver(String name, Bundle... bundles) {
+ super(bundles);
+ m_name = name;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Enumeration<URL> resolve(Bundle bundle) throws ResourceNotFoundException {
+ try {
+ Enumeration<URL> urls = bundle.getResources(m_name);
+ if (urls != null && urls.hasMoreElements()) {
+ return urls;
+ }
+ }
+ catch (IOException e) {
+ }
+
+ throw new ResourceNotFoundException();
+ }
+
+ @Override
+ public Enumeration<URL> resolveEmpty() {
+ return Collections.enumeration(new ArrayList<URL>(0));
+ }
+ }
+
+ private class P_FindResourcesResolver extends AbstractResolver<Enumeration<URL>> {
+
+ private String m_name;
+
+ public P_FindResourcesResolver(String name, Bundle... bundles) {
+ super(bundles);
+ m_name = name;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Enumeration<URL> resolve(Bundle bundle) throws ResourceNotFoundException {
+ try {
+ Enumeration<URL> urls = bundle.getResources(m_name);
+ if (urls != null && urls.hasMoreElements()) {
+ return urls;
+ }
+ }
+ catch (Exception e) {
+ }
+
+ throw new ResourceNotFoundException();
+ }
+
+ @Override
+ public Enumeration<URL> resolveEmpty() {
+ return Collections.enumeration(new ArrayList<URL>(0));
+ }
+ }
+
+ private class P_GetResourceAsStream extends AbstractResolver<InputStream> {
+
+ private String m_name;
+
+ public P_GetResourceAsStream(String name, Bundle... bundles) {
+ super(bundles);
+ m_name = name;
+ }
+
+ @Override
+ public InputStream resolve(Bundle bundle) throws ResourceNotFoundException {
+ URL url = bundle.getResource(m_name);
+ if (url != null) {
+ try {
+ return url.openStream();
+ }
+ catch (Exception e) {
+ // nop
+ }
+ }
+ throw new ResourceNotFoundException();
+ }
+ }
+}
diff --git a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/resources/BundleProxyResourceLoader.java b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/resources/BundleProxyResourceLoader.java
index 2caad099e4..21accbfc95 100644
--- a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/resources/BundleProxyResourceLoader.java
+++ b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/resources/BundleProxyResourceLoader.java
@@ -1,138 +1,138 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.jaxws.internal.resources;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.logging.Logger;
-
-import org.eclipse.scout.commons.xmlparser.ScoutXmlParser;
-import org.eclipse.scout.jaxws.Activator;
-import org.osgi.framework.Bundle;
-
-import com.sun.xml.internal.ws.transport.http.ResourceLoader;
-
-public class BundleProxyResourceLoader implements ResourceLoader {
-
- private static final Logger LOG = Logger.getLogger("com.sun.xml.ws.server.http");
-
- private Bundle m_bundle;
-
- public BundleProxyResourceLoader(Bundle bundle) {
- m_bundle = bundle;
- }
-
- @Override
- public URL getCatalogFile() throws MalformedURLException {
- return getResource("/WEB-INF/jax-ws-catalog.xml");
- }
-
- @Override
- public URL getResource(String path) throws MalformedURLException {
- return new P_GetResourceResolver(path, Activator.getDefault().getBundle(), m_bundle).resolve();
- }
-
- @Override
- public Set<String> getResourcePaths(String path) {
- return new P_GetResourcePathsResolver(path, Activator.getDefault().getBundle(), m_bundle).resolve();
- }
-
- private class P_GetResourcePathsResolver extends AbstractResolver<Set<String>> {
-
- private String m_path;
-
- public P_GetResourcePathsResolver(String path, Bundle... bundles) {
- super(bundles);
- m_path = path;
- }
-
- @Override
- public Set<String> resolve(Bundle bundle) throws ResourceNotFoundException {
- Set<String> paths = new HashSet<String>();
-
- // Collect resources of bundle and its attached fragments
- Enumeration entries = m_bundle.findEntries(m_path, "*", false);
- if (entries == null || !entries.hasMoreElements()) {
- throw new ResourceNotFoundException();
- }
-
- while (entries.hasMoreElements()) {
- URL url = (URL) entries.nextElement();
- if (url == null) {
- continue;
- }
- // Skip hidden files like /WEB-INF/wsdl/.svn/
- if (url.getPath().matches("^.+/\\..+/$")) {
- continue;
- }
- // Skip files in webservice consumer folder as they might interfere with webservice provider files.
- // E.g. if having a consumer WSDL file whose service or port is the very same as from a provider to be published. See @{link EndpointFactory#findPrimary(List)}.
- if (url.getPath().endsWith("/consumer/")) {
- continue;
- }
-
- if (url.getPath().endsWith("/")) { // to support sub-folders. In turn, JAX-WS recursively browses those folders in @{link DeploymentDescriptorParser#collectDocs(String)} by calling this resolver anew.
- paths.add(url.getPath());
- }
- else if (isValidXml(url)) {
- paths.add(url.getPath());
- }
- else {
- LOG.info("Resource '" + url.getPath() + "' skipped for webservice resource as file is corrupt or does not contain valid XML. [bundle=" + m_bundle.getSymbolicName() + "]");
- }
- }
- if (paths.size() > 0) {
- return paths;
- }
- throw new ResourceNotFoundException();
- }
-
- @Override
- public Set<String> resolveEmpty() {
- return new HashSet<String>();
- }
-
- private boolean isValidXml(URL url) {
- try {
- // skip files which are not valid XML as JAX-WS fails to start properly otherwise.
- ScoutXmlParser parser = new ScoutXmlParser();
- parser.parse(url);
- return true;
- }
- catch (Exception e) {
- return false;
- }
- }
- }
-
- private class P_GetResourceResolver extends AbstractResolver<URL> {
-
- private String m_path;
-
- public P_GetResourceResolver(String path, Bundle... bundles) {
- super(bundles);
- m_path = path;
- }
-
- @Override
- public URL resolve(Bundle bundle) throws ResourceNotFoundException {
- // do not use {@link Bundle#bundle.getEntry(String)} as the m_bundle's classloader must be used in order to work for fragments.
- URL url = bundle.getResource(m_path);
- if (url != null) {
- return url;
- }
- throw new ResourceNotFoundException();
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.jaxws.internal.resources;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.logging.Logger;
+
+import org.eclipse.scout.commons.xmlparser.ScoutXmlParser;
+import org.eclipse.scout.jaxws.Activator;
+import org.osgi.framework.Bundle;
+
+import com.sun.xml.internal.ws.transport.http.ResourceLoader;
+
+public class BundleProxyResourceLoader implements ResourceLoader {
+
+ private static final Logger LOG = Logger.getLogger("com.sun.xml.ws.server.http");
+
+ private Bundle m_bundle;
+
+ public BundleProxyResourceLoader(Bundle bundle) {
+ m_bundle = bundle;
+ }
+
+ @Override
+ public URL getCatalogFile() throws MalformedURLException {
+ return getResource("/WEB-INF/jax-ws-catalog.xml");
+ }
+
+ @Override
+ public URL getResource(String path) throws MalformedURLException {
+ return new P_GetResourceResolver(path, Activator.getDefault().getBundle(), m_bundle).resolve();
+ }
+
+ @Override
+ public Set<String> getResourcePaths(String path) {
+ return new P_GetResourcePathsResolver(path, Activator.getDefault().getBundle(), m_bundle).resolve();
+ }
+
+ private class P_GetResourcePathsResolver extends AbstractResolver<Set<String>> {
+
+ private String m_path;
+
+ public P_GetResourcePathsResolver(String path, Bundle... bundles) {
+ super(bundles);
+ m_path = path;
+ }
+
+ @Override
+ public Set<String> resolve(Bundle bundle) throws ResourceNotFoundException {
+ Set<String> paths = new HashSet<String>();
+
+ // Collect resources of bundle and its attached fragments
+ Enumeration entries = m_bundle.findEntries(m_path, "*", false);
+ if (entries == null || !entries.hasMoreElements()) {
+ throw new ResourceNotFoundException();
+ }
+
+ while (entries.hasMoreElements()) {
+ URL url = (URL) entries.nextElement();
+ if (url == null) {
+ continue;
+ }
+ // Skip hidden files like /WEB-INF/wsdl/.svn/
+ if (url.getPath().matches("^.+/\\..+/$")) {
+ continue;
+ }
+ // Skip files in webservice consumer folder as they might interfere with webservice provider files.
+ // E.g. if having a consumer WSDL file whose service or port is the very same as from a provider to be published. See @{link EndpointFactory#findPrimary(List)}.
+ if (url.getPath().endsWith("/consumer/")) {
+ continue;
+ }
+
+ if (url.getPath().endsWith("/")) { // to support sub-folders. In turn, JAX-WS recursively browses those folders in @{link DeploymentDescriptorParser#collectDocs(String)} by calling this resolver anew.
+ paths.add(url.getPath());
+ }
+ else if (isValidXml(url)) {
+ paths.add(url.getPath());
+ }
+ else {
+ LOG.info("Resource '" + url.getPath() + "' skipped for webservice resource as file is corrupt or does not contain valid XML. [bundle=" + m_bundle.getSymbolicName() + "]");
+ }
+ }
+ if (paths.size() > 0) {
+ return paths;
+ }
+ throw new ResourceNotFoundException();
+ }
+
+ @Override
+ public Set<String> resolveEmpty() {
+ return new HashSet<String>();
+ }
+
+ private boolean isValidXml(URL url) {
+ try {
+ // skip files which are not valid XML as JAX-WS fails to start properly otherwise.
+ ScoutXmlParser parser = new ScoutXmlParser();
+ parser.parse(url);
+ return true;
+ }
+ catch (Exception e) {
+ return false;
+ }
+ }
+ }
+
+ private class P_GetResourceResolver extends AbstractResolver<URL> {
+
+ private String m_path;
+
+ public P_GetResourceResolver(String path, Bundle... bundles) {
+ super(bundles);
+ m_path = path;
+ }
+
+ @Override
+ public URL resolve(Bundle bundle) throws ResourceNotFoundException {
+ // do not use {@link Bundle#bundle.getEntry(String)} as the m_bundle's classloader must be used in order to work for fragments.
+ URL url = bundle.getResource(m_path);
+ if (url != null) {
+ return url;
+ }
+ throw new ResourceNotFoundException();
+ }
+ }
+}
diff --git a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/resources/SunJaxWsXml.java b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/resources/SunJaxWsXml.java
index a05d4d99d4..e66528b5cf 100644
--- a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/resources/SunJaxWsXml.java
+++ b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/resources/SunJaxWsXml.java
@@ -1,33 +1,33 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.jaxws.internal.resources;
-
-import java.net.URL;
-
-import org.osgi.framework.Bundle;
-
-public class SunJaxWsXml {
- private final Bundle m_bundle;
- private final URL m_resource;
-
- public SunJaxWsXml(Bundle bundle, URL resource) {
- m_bundle = bundle;
- m_resource = resource;
- }
-
- public Bundle getBundle() {
- return m_bundle;
- }
-
- public URL getResource() {
- return m_resource;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.jaxws.internal.resources;
+
+import java.net.URL;
+
+import org.osgi.framework.Bundle;
+
+public class SunJaxWsXml {
+ private final Bundle m_bundle;
+ private final URL m_resource;
+
+ public SunJaxWsXml(Bundle bundle, URL resource) {
+ m_bundle = bundle;
+ m_resource = resource;
+ }
+
+ public Bundle getBundle() {
+ return m_bundle;
+ }
+
+ public URL getResource() {
+ return m_resource;
+ }
+}
diff --git a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/resources/SunJaxWsXmlFinder.java b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/resources/SunJaxWsXmlFinder.java
index f4bf775400..9742983a3d 100644
--- a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/resources/SunJaxWsXmlFinder.java
+++ b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/resources/SunJaxWsXmlFinder.java
@@ -1,59 +1,59 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.jaxws.internal.resources;
-
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.List;
-
-import org.eclipse.osgi.framework.internal.core.BundleFragment;
-import org.eclipse.scout.jaxws.Activator;
-import org.osgi.framework.Bundle;
-
-/**
- * Finds sun-jaxws.xml
- */
-@SuppressWarnings("restriction")
-public class SunJaxWsXmlFinder {
-
- /**
- * Searches all WEB-INF folders for sun-jaxws.xml
- */
- public List<SunJaxWsXml> findAll() {
- ArrayList<SunJaxWsXml> list = new ArrayList<SunJaxWsXml>();
- for (Bundle bundle : Activator.getDefault().getBundle().getBundleContext().getBundles()) {
- // exclude fragments as their content is searched by their host bundles.
- // Furthermore, fragments do not have a classloader and therefore cannot load classes.
- if (!(bundle instanceof BundleFragment)) {
- list.addAll(getConfigurations(bundle, "/WEB-INF"));
- }
- }
-
- return list;
- }
-
- private List<SunJaxWsXml> getConfigurations(Bundle bundle, String path) {
- List<SunJaxWsXml> configurations = new ArrayList<SunJaxWsXml>();
-
- // do not use {@link Bundle#bundle.getEntryPaths(String)} as the bundle's classloader must be used in order to work for fragments.
- Enumeration entries = bundle.findEntries(path, "sun-jaxws.xml", false);
- if (entries != null && entries.hasMoreElements()) {
- while (entries.hasMoreElements()) {
- URL url = (URL) entries.nextElement();
- if (url != null) {
- configurations.add(new SunJaxWsXml(bundle, url));
- }
- }
- }
- return configurations;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.jaxws.internal.resources;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+
+import org.eclipse.osgi.framework.internal.core.BundleFragment;
+import org.eclipse.scout.jaxws.Activator;
+import org.osgi.framework.Bundle;
+
+/**
+ * Finds sun-jaxws.xml
+ */
+@SuppressWarnings("restriction")
+public class SunJaxWsXmlFinder {
+
+ /**
+ * Searches all WEB-INF folders for sun-jaxws.xml
+ */
+ public List<SunJaxWsXml> findAll() {
+ ArrayList<SunJaxWsXml> list = new ArrayList<SunJaxWsXml>();
+ for (Bundle bundle : Activator.getDefault().getBundle().getBundleContext().getBundles()) {
+ // exclude fragments as their content is searched by their host bundles.
+ // Furthermore, fragments do not have a classloader and therefore cannot load classes.
+ if (!(bundle instanceof BundleFragment)) {
+ list.addAll(getConfigurations(bundle, "/WEB-INF"));
+ }
+ }
+
+ return list;
+ }
+
+ private List<SunJaxWsXml> getConfigurations(Bundle bundle, String path) {
+ List<SunJaxWsXml> configurations = new ArrayList<SunJaxWsXml>();
+
+ // do not use {@link Bundle#bundle.getEntryPaths(String)} as the bundle's classloader must be used in order to work for fragments.
+ Enumeration entries = bundle.findEntries(path, "sun-jaxws.xml", false);
+ if (entries != null && entries.hasMoreElements()) {
+ while (entries.hasMoreElements()) {
+ URL url = (URL) entries.nextElement();
+ if (url != null) {
+ configurations.add(new SunJaxWsXml(bundle, url));
+ }
+ }
+ }
+ return configurations;
+ }
+}
diff --git a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/servlet/EndpointServlet.java b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/servlet/EndpointServlet.java
index e342e017c1..cfdf905272 100644
--- a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/servlet/EndpointServlet.java
+++ b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/servlet/EndpointServlet.java
@@ -1,150 +1,150 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.jaxws.internal.servlet;
-
-import java.io.IOException;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.regex.Pattern;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.xml.ws.Binding;
-import javax.xml.ws.http.HTTPBinding;
-
-import org.eclipse.scout.commons.BooleanUtility;
-import org.eclipse.scout.commons.TypeCastUtility;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.jaxws.Activator;
-import org.eclipse.scout.jaxws.service.IJaxWsEndpointService;
-import org.eclipse.scout.service.SERVICES;
-
-import com.sun.xml.internal.ws.transport.http.HttpAdapter;
-
-public abstract class EndpointServlet extends HttpServlet {
-
- private static final long serialVersionUID = 1L;
-
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(EndpointServlet.class);
-
- private final Map<String, ServletAdapter> m_urlAdapterMap = new HashMap<String, ServletAdapter>();
- private boolean m_publishStatusPage;
-
- @Override
- public void init() throws ServletException {
- super.init();
- installServletAdapters();
- publishStatusPage();
- }
-
- @Override
- protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
- handleRequest(request, response);
- }
-
- @Override
- protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
- handleRequest(request, response);
- }
-
- @Override
- protected void doDelete(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
- handleRequest(request, response, HTTPBinding.class);
- }
-
- @Override
- protected void doPut(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
- handleRequest(request, response, HTTPBinding.class);
- }
-
- protected void handleRequest(HttpServletRequest request, HttpServletResponse response) {
- handleRequest(request, response, null);
- }
-
- protected void handleRequest(HttpServletRequest request, HttpServletResponse response, Class<? extends Binding> bindingTypeFilter) {
- try {
- ServletAdapter adapter = resolveServletAdapter(request);
- if (adapter == null) {
- // status page
- if (request.getMethod().equals("GET") && m_publishStatusPage) {
- IJaxWsEndpointService endpointService = SERVICES.getService(IJaxWsEndpointService.class);
- Collection<ServletAdapter> servletAdapters = m_urlAdapterMap.values();
- endpointService.onGetRequest(request, response, servletAdapters.toArray(new ServletAdapter[servletAdapters.size()]));
- return;
- }
- response.sendError(HttpServletResponse.SC_NOT_FOUND);
- return;
- }
-
- if (bindingTypeFilter != null) {
- Binding candidateBinding = adapter.getEndpoint().getBinding();
- if (!bindingTypeFilter.isAssignableFrom(candidateBinding.getClass())) {
- LOG.error("Illegal binding in webservice request. Must be of the type " + bindingTypeFilter.getName());
- response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, "Illegal binding in webservie request.");
- return;
- }
- }
- adapter.handle(getServletContext(), request, response);
- }
- catch (Exception e) {
- LOG.error("webservice request failed", e);
- try {
- response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
- }
- catch (IOException ioe) {
- response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
- }
- }
- }
-
- protected void installServletAdapters() {
- IJaxWsEndpointService endpointService = SERVICES.getService(IJaxWsEndpointService.class);
- for (ServletAdapter servletAdapter : endpointService.getServletAdapters()) {
- String urlPattern = servletAdapter.getValidPath();
- if (urlPattern.contains("*.")) {
- LOG.warn("Failed to install JAX-WS endpoint '" + servletAdapter.getAlias() + "' due to unsupported URL pattern");
- continue;
- }
-
- if (m_urlAdapterMap.containsKey(urlPattern)) {
- LOG.warn("Failed to install JAX-WS endpoint '" + servletAdapter.getAlias() + "' due to duplicate URL pattern '" + urlPattern + "'");
- continue;
- }
-
- m_urlAdapterMap.put(urlPattern, servletAdapter);
- LOG.info("Successfully installed JAX-WS endpoint '" + servletAdapter.getAlias() + "' on URL '" + urlPattern + "'");
- }
- }
-
- protected void publishStatusPage() {
- // do not use JAX-WS status page to display all endpoints together
- HttpAdapter.publishStatusPage = false;
- m_publishStatusPage = BooleanUtility.nvl(TypeCastUtility.castValue(Activator.getDefault().getBundle().getBundleContext().getProperty(Activator.PROP_PUBLISH_STATUS_PAGE), Boolean.class), true);
- }
-
- protected ServletAdapter resolveServletAdapter(HttpServletRequest request) {
- String requestPath = request.getRequestURI().substring(request.getContextPath().length());
- ServletAdapter adapter = m_urlAdapterMap.get(requestPath);
- if (adapter != null) {
- return adapter;
- }
- for (ServletAdapter candidate : m_urlAdapterMap.values()) {
- if (requestPath.matches("^" + Pattern.quote(candidate.getValidPath()) + "[\\/\\?]?.*$")) {
- return candidate;
- }
- }
- return null;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.jaxws.internal.servlet;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.regex.Pattern;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.ws.Binding;
+import javax.xml.ws.http.HTTPBinding;
+
+import org.eclipse.scout.commons.BooleanUtility;
+import org.eclipse.scout.commons.TypeCastUtility;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.jaxws.Activator;
+import org.eclipse.scout.jaxws.service.IJaxWsEndpointService;
+import org.eclipse.scout.service.SERVICES;
+
+import com.sun.xml.internal.ws.transport.http.HttpAdapter;
+
+public abstract class EndpointServlet extends HttpServlet {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(EndpointServlet.class);
+
+ private final Map<String, ServletAdapter> m_urlAdapterMap = new HashMap<String, ServletAdapter>();
+ private boolean m_publishStatusPage;
+
+ @Override
+ public void init() throws ServletException {
+ super.init();
+ installServletAdapters();
+ publishStatusPage();
+ }
+
+ @Override
+ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+ handleRequest(request, response);
+ }
+
+ @Override
+ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+ handleRequest(request, response);
+ }
+
+ @Override
+ protected void doDelete(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+ handleRequest(request, response, HTTPBinding.class);
+ }
+
+ @Override
+ protected void doPut(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+ handleRequest(request, response, HTTPBinding.class);
+ }
+
+ protected void handleRequest(HttpServletRequest request, HttpServletResponse response) {
+ handleRequest(request, response, null);
+ }
+
+ protected void handleRequest(HttpServletRequest request, HttpServletResponse response, Class<? extends Binding> bindingTypeFilter) {
+ try {
+ ServletAdapter adapter = resolveServletAdapter(request);
+ if (adapter == null) {
+ // status page
+ if (request.getMethod().equals("GET") && m_publishStatusPage) {
+ IJaxWsEndpointService endpointService = SERVICES.getService(IJaxWsEndpointService.class);
+ Collection<ServletAdapter> servletAdapters = m_urlAdapterMap.values();
+ endpointService.onGetRequest(request, response, servletAdapters.toArray(new ServletAdapter[servletAdapters.size()]));
+ return;
+ }
+ response.sendError(HttpServletResponse.SC_NOT_FOUND);
+ return;
+ }
+
+ if (bindingTypeFilter != null) {
+ Binding candidateBinding = adapter.getEndpoint().getBinding();
+ if (!bindingTypeFilter.isAssignableFrom(candidateBinding.getClass())) {
+ LOG.error("Illegal binding in webservice request. Must be of the type " + bindingTypeFilter.getName());
+ response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, "Illegal binding in webservie request.");
+ return;
+ }
+ }
+ adapter.handle(getServletContext(), request, response);
+ }
+ catch (Exception e) {
+ LOG.error("webservice request failed", e);
+ try {
+ response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ }
+ catch (IOException ioe) {
+ response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ }
+ }
+ }
+
+ protected void installServletAdapters() {
+ IJaxWsEndpointService endpointService = SERVICES.getService(IJaxWsEndpointService.class);
+ for (ServletAdapter servletAdapter : endpointService.getServletAdapters()) {
+ String urlPattern = servletAdapter.getValidPath();
+ if (urlPattern.contains("*.")) {
+ LOG.warn("Failed to install JAX-WS endpoint '" + servletAdapter.getAlias() + "' due to unsupported URL pattern");
+ continue;
+ }
+
+ if (m_urlAdapterMap.containsKey(urlPattern)) {
+ LOG.warn("Failed to install JAX-WS endpoint '" + servletAdapter.getAlias() + "' due to duplicate URL pattern '" + urlPattern + "'");
+ continue;
+ }
+
+ m_urlAdapterMap.put(urlPattern, servletAdapter);
+ LOG.info("Successfully installed JAX-WS endpoint '" + servletAdapter.getAlias() + "' on URL '" + urlPattern + "'");
+ }
+ }
+
+ protected void publishStatusPage() {
+ // do not use JAX-WS status page to display all endpoints together
+ HttpAdapter.publishStatusPage = false;
+ m_publishStatusPage = BooleanUtility.nvl(TypeCastUtility.castValue(Activator.getDefault().getBundle().getBundleContext().getProperty(Activator.PROP_PUBLISH_STATUS_PAGE), Boolean.class), true);
+ }
+
+ protected ServletAdapter resolveServletAdapter(HttpServletRequest request) {
+ String requestPath = request.getRequestURI().substring(request.getContextPath().length());
+ ServletAdapter adapter = m_urlAdapterMap.get(requestPath);
+ if (adapter != null) {
+ return adapter;
+ }
+ for (ServletAdapter candidate : m_urlAdapterMap.values()) {
+ if (requestPath.matches("^" + Pattern.quote(candidate.getValidPath()) + "[\\/\\?]?.*$")) {
+ return candidate;
+ }
+ }
+ return null;
+ }
+}
diff --git a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/servlet/JaxWsHelper.java b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/servlet/JaxWsHelper.java
index 7a8a23cb8f..125d08795f 100644
--- a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/servlet/JaxWsHelper.java
+++ b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/servlet/JaxWsHelper.java
@@ -1,62 +1,62 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.jaxws.internal.servlet;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import javax.servlet.http.HttpServletRequest;
-
-public final class JaxWsHelper {
-
- private JaxWsHelper() {
- }
-
- /**
- * To get the base address of the application
- *
- * @param request
- * @return
- */
- public static String getBaseAddress(HttpServletRequest request, boolean includeContextPath) {
- StringBuilder builder = new StringBuilder();
- builder.append(request.getScheme());
- builder.append("://");
- builder.append(request.getServerName());
- builder.append(':');
- builder.append(request.getServerPort());
- if (includeContextPath) {
- builder.append(request.getContextPath());
- }
- return builder.toString();
- }
-
- /**
- * Clones the given header map
- *
- * @param headers
- * @return
- */
- public static Map<String, List<String>> cloneHeaderMap(Map<String, List<String>> headers) {
- Map<String, List<String>> clone = new HashMap<String, List<String>>();
-
- for (Entry<String, List<String>> headerEntry : headers.entrySet()) {
- String name = headerEntry.getKey();
- List<String> values = headerEntry.getValue();
-
- clone.put(name, new ArrayList<String>(values));
- }
- return clone;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.jaxws.internal.servlet;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import javax.servlet.http.HttpServletRequest;
+
+public final class JaxWsHelper {
+
+ private JaxWsHelper() {
+ }
+
+ /**
+ * To get the base address of the application
+ *
+ * @param request
+ * @return
+ */
+ public static String getBaseAddress(HttpServletRequest request, boolean includeContextPath) {
+ StringBuilder builder = new StringBuilder();
+ builder.append(request.getScheme());
+ builder.append("://");
+ builder.append(request.getServerName());
+ builder.append(':');
+ builder.append(request.getServerPort());
+ if (includeContextPath) {
+ builder.append(request.getContextPath());
+ }
+ return builder.toString();
+ }
+
+ /**
+ * Clones the given header map
+ *
+ * @param headers
+ * @return
+ */
+ public static Map<String, List<String>> cloneHeaderMap(Map<String, List<String>> headers) {
+ Map<String, List<String>> clone = new HashMap<String, List<String>>();
+
+ for (Entry<String, List<String>> headerEntry : headers.entrySet()) {
+ String name = headerEntry.getKey();
+ List<String> values = headerEntry.getValue();
+
+ clone.put(name, new ArrayList<String>(values));
+ }
+ return clone;
+ }
+}
diff --git a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/servlet/ServletAdapter.java b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/servlet/ServletAdapter.java
index 970297da4d..8c7453f339 100644
--- a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/servlet/ServletAdapter.java
+++ b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/servlet/ServletAdapter.java
@@ -1,88 +1,88 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.jaxws.internal.servlet;
-
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.xml.ws.WebServiceException;
-
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-
-import com.sun.xml.internal.ws.api.server.BoundEndpoint;
-import com.sun.xml.internal.ws.api.server.Module;
-import com.sun.xml.internal.ws.api.server.WSEndpoint;
-import com.sun.xml.internal.ws.api.server.WebModule;
-import com.sun.xml.internal.ws.transport.http.HttpAdapter;
-import com.sun.xml.internal.ws.transport.http.HttpAdapterList;
-import com.sun.xml.internal.ws.transport.http.WSHTTPConnection;
-
-public class ServletAdapter extends HttpAdapter implements BoundEndpoint {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(ServletAdapter.class);
-
- private String m_alias;
-
- public ServletAdapter(WSEndpoint endpoint, String alias, String urlPattern, HttpAdapterList<? extends HttpAdapter> owner) {
- super(endpoint, owner, urlPattern);
- m_alias = alias;
-
- registerEndpoint();
- }
-
- public void handle(ServletContext context, HttpServletRequest request, HttpServletResponse response) throws IOException {
- WSHTTPConnection connection = new ServletConnection(this, context, request, response);
- super.handle(connection);
- }
-
- @Override
- public URI getAddress() {
- WebModule webModule = endpoint.getContainer().getSPI(WebModule.class);
- if (webModule == null) {
- throw new WebServiceException("Container " + endpoint.getContainer().getClass().getName() + " does not support " + WebModule.class.getName());
- }
- return getAddress(webModule.getContextPath());
- }
-
- @Override
- public URI getAddress(String baseAddress) {
- String uri = StringUtility.join("", baseAddress, getValidPath());
- try {
- return new URI(uri);
- }
- catch (URISyntaxException e) {
- throw new WebServiceException("Invalid URI '" + uri + "'", e);
- }
- }
-
- public String getAlias() {
- return m_alias;
- }
-
- @Override
- public String toString() {
- return StringUtility.join(" ", super.toString(), "[endpoint=" + getAlias() + "]");
- }
-
- private void registerEndpoint() {
- Module module = getEndpoint().getContainer().getSPI(Module.class);
- if (module == null) {
- LOG.warn("Container " + endpoint.getContainer().getClass().getName() + " does not support " + Module.class.getName());
- return;
- }
- module.getBoundEndpoints().add(this);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.jaxws.internal.servlet;
+
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.ws.WebServiceException;
+
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+
+import com.sun.xml.internal.ws.api.server.BoundEndpoint;
+import com.sun.xml.internal.ws.api.server.Module;
+import com.sun.xml.internal.ws.api.server.WSEndpoint;
+import com.sun.xml.internal.ws.api.server.WebModule;
+import com.sun.xml.internal.ws.transport.http.HttpAdapter;
+import com.sun.xml.internal.ws.transport.http.HttpAdapterList;
+import com.sun.xml.internal.ws.transport.http.WSHTTPConnection;
+
+public class ServletAdapter extends HttpAdapter implements BoundEndpoint {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(ServletAdapter.class);
+
+ private String m_alias;
+
+ public ServletAdapter(WSEndpoint endpoint, String alias, String urlPattern, HttpAdapterList<? extends HttpAdapter> owner) {
+ super(endpoint, owner, urlPattern);
+ m_alias = alias;
+
+ registerEndpoint();
+ }
+
+ public void handle(ServletContext context, HttpServletRequest request, HttpServletResponse response) throws IOException {
+ WSHTTPConnection connection = new ServletConnection(this, context, request, response);
+ super.handle(connection);
+ }
+
+ @Override
+ public URI getAddress() {
+ WebModule webModule = endpoint.getContainer().getSPI(WebModule.class);
+ if (webModule == null) {
+ throw new WebServiceException("Container " + endpoint.getContainer().getClass().getName() + " does not support " + WebModule.class.getName());
+ }
+ return getAddress(webModule.getContextPath());
+ }
+
+ @Override
+ public URI getAddress(String baseAddress) {
+ String uri = StringUtility.join("", baseAddress, getValidPath());
+ try {
+ return new URI(uri);
+ }
+ catch (URISyntaxException e) {
+ throw new WebServiceException("Invalid URI '" + uri + "'", e);
+ }
+ }
+
+ public String getAlias() {
+ return m_alias;
+ }
+
+ @Override
+ public String toString() {
+ return StringUtility.join(" ", super.toString(), "[endpoint=" + getAlias() + "]");
+ }
+
+ private void registerEndpoint() {
+ Module module = getEndpoint().getContainer().getSPI(Module.class);
+ if (module == null) {
+ LOG.warn("Container " + endpoint.getContainer().getClass().getName() + " does not support " + Module.class.getName());
+ return;
+ }
+ module.getBoundEndpoints().add(this);
+ }
+}
diff --git a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/servlet/ServletAdapterFactory.java b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/servlet/ServletAdapterFactory.java
index 4ff0e99590..cbcdf769e6 100644
--- a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/servlet/ServletAdapterFactory.java
+++ b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/servlet/ServletAdapterFactory.java
@@ -1,25 +1,25 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.jaxws.internal.servlet;
-
-import com.sun.xml.internal.ws.api.server.WSEndpoint;
-import com.sun.xml.internal.ws.transport.http.HttpAdapterList;
-
-public class ServletAdapterFactory extends HttpAdapterList<ServletAdapter> {
-
- /**
- * Factory to create {@link ServletAdapter}
- */
- @Override
- protected ServletAdapter createHttpAdapter(String name, String urlPattern, WSEndpoint<?> endpoint) {
- return new ServletAdapter(endpoint, name, urlPattern, this);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.jaxws.internal.servlet;
+
+import com.sun.xml.internal.ws.api.server.WSEndpoint;
+import com.sun.xml.internal.ws.transport.http.HttpAdapterList;
+
+public class ServletAdapterFactory extends HttpAdapterList<ServletAdapter> {
+
+ /**
+ * Factory to create {@link ServletAdapter}
+ */
+ @Override
+ protected ServletAdapter createHttpAdapter(String name, String urlPattern, WSEndpoint<?> endpoint) {
+ return new ServletAdapter(endpoint, name, urlPattern, this);
+ }
+}
diff --git a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/servlet/ServletConnection.java b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/servlet/ServletConnection.java
index ebe3a6ea82..d445295f10 100644
--- a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/servlet/ServletConnection.java
+++ b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/servlet/ServletConnection.java
@@ -1,211 +1,211 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.jaxws.internal.servlet;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.xml.ws.handler.MessageContext;
-
-import com.sun.xml.internal.ws.api.message.Packet;
-import com.sun.xml.internal.ws.api.server.WebServiceContextDelegate;
-import com.sun.xml.internal.ws.developer.JAXWSProperties;
-import com.sun.xml.internal.ws.transport.http.HttpAdapter;
-import com.sun.xml.internal.ws.transport.http.WSHTTPConnection;
-
-public class ServletConnection extends WSHTTPConnection {
-
- private static final PropertyMap PROP_MODEL;
-
- private final HttpServletRequest m_request;
- private final HttpServletResponse m_response;
- private final ServletContext m_context;
- private final WebServiceContextDelegate m_contextDelegate;
- private int m_status;
-
- private final Map<String, List<String>> m_responseHeaderMap;
-
- static {
- PROP_MODEL = parse(ServletConnection.class);
- }
-
- public ServletConnection(HttpAdapter adapter, ServletContext context, HttpServletRequest request, HttpServletResponse response) {
- m_context = context;
- m_request = request;
- m_response = response;
- m_contextDelegate = createContextDelegate(adapter, request);
- m_responseHeaderMap = new HashMap<String, List<String>>();
- }
-
- @Property(MessageContext.SERVLET_RESPONSE)
- public HttpServletResponse getResponse() {
- return m_response;
- }
-
- @Property(MessageContext.SERVLET_REQUEST)
- public HttpServletRequest getRequest() {
- return m_request;
- }
-
- @Property(JAXWSProperties.HTTP_REQUEST_URL)
- public String getRequestURL() {
- return m_request.getRequestURL().toString();
- }
-
- @Override
- public void setStatus(int status) {
- m_status = status;
- }
-
- @Override
- @Property(MessageContext.HTTP_RESPONSE_CODE)
- public int getStatus() {
- return m_status;
- }
-
- @Override
- public boolean isSecure() {
- return m_request.getScheme().equals("https");
- }
-
- @Override
- public InputStream getInput() throws IOException {
- return m_request.getInputStream();
- }
-
- @Override
- public String getProtocol() {
- return m_request.getProtocol();
- }
-
- @Override
- public OutputStream getOutput() throws IOException {
- m_response.setStatus(m_status);
- return m_response.getOutputStream();
- }
-
- @Override
- @Property(MessageContext.PATH_INFO)
- public String getPathInfo() {
- return m_request.getPathInfo();
- }
-
- @Override
- public String getBaseAddress() {
- return JaxWsHelper.getBaseAddress(m_request, true);
- }
-
- @Override
- @Property(MessageContext.QUERY_STRING)
- public String getQueryString() {
- return m_request.getQueryString();
- }
-
- @Override
- @Property(MessageContext.HTTP_REQUEST_METHOD)
- public String getRequestMethod() {
- return m_request.getMethod();
- }
-
- @Override
- public String getRequestHeader(String headerName) {
- return m_request.getHeader(headerName);
- }
-
- @Override
- @SuppressWarnings("deprecation")
- @Property({MessageContext.HTTP_REQUEST_HEADERS, Packet.INBOUND_TRANSPORT_HEADERS})
- public Map<String, List<String>> getRequestHeaders() {
- Map<String, List<String>> headerMap = new HashMap<String, List<String>>();
-
- Enumeration headerNames = m_request.getHeaderNames();
- while (headerNames.hasMoreElements()) {
- String name = (String) headerNames.nextElement();
- String value = m_request.getHeader(name);
-
- if (headerMap.get(name) == null) {
- headerMap.put(name, new ArrayList<String>());
- }
- headerMap.get(name).add(value);
- }
-
- return headerMap;
- }
-
- @Override
- public void setResponseHeaders(Map<String, List<String>> responseHeaders) {
- m_responseHeaderMap.clear();
- m_response.reset();
- m_response.setStatus(m_status);
-
- // update headers of @{link HttpServletResponse}
- if (responseHeaders == null || responseHeaders.size() == 0) {
- return;
- }
- for (Entry<String, List<String>> entry : responseHeaders.entrySet()) {
- String name = entry.getKey();
- List<String> values = entry.getValue();
-
- // According to JavaDoc, ignore 'Content-Type' and 'Content-Length'
- if (name.equalsIgnoreCase("Content-Type") || name.equalsIgnoreCase("Content-Length")) {
- continue;
- }
- for (String value : values) {
- m_response.addHeader(name, value);
- }
- }
- }
-
- @Override
- @Property({MessageContext.HTTP_RESPONSE_HEADERS, Packet.OUTBOUND_TRANSPORT_HEADERS})
- public Map<String, List<String>> getResponseHeaders() {
- return JaxWsHelper.cloneHeaderMap(m_responseHeaderMap); // clone according do JavaDoc
- }
-
- @Override
- public void setContentTypeResponseHeader(String value) {
- m_response.setContentType(value);
- }
-
- @Override
- public void setContentLengthResponseHeader(int value) {
- m_response.setContentLength(value);
- }
-
- @Property(MessageContext.SERVLET_CONTEXT)
- public ServletContext getContext() {
- return m_context;
- }
-
- @Override
- public WebServiceContextDelegate getWebServiceContextDelegate() {
- return m_contextDelegate;
- }
-
- @Override
- protected PropertyMap getPropertyMap() {
- return PROP_MODEL;
- }
-
- protected WebServiceContextDelegate createContextDelegate(HttpAdapter adapter, HttpServletRequest request) {
- return new ServletContextDelegate(adapter, request);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.jaxws.internal.servlet;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.ws.handler.MessageContext;
+
+import com.sun.xml.internal.ws.api.message.Packet;
+import com.sun.xml.internal.ws.api.server.WebServiceContextDelegate;
+import com.sun.xml.internal.ws.developer.JAXWSProperties;
+import com.sun.xml.internal.ws.transport.http.HttpAdapter;
+import com.sun.xml.internal.ws.transport.http.WSHTTPConnection;
+
+public class ServletConnection extends WSHTTPConnection {
+
+ private static final PropertyMap PROP_MODEL;
+
+ private final HttpServletRequest m_request;
+ private final HttpServletResponse m_response;
+ private final ServletContext m_context;
+ private final WebServiceContextDelegate m_contextDelegate;
+ private int m_status;
+
+ private final Map<String, List<String>> m_responseHeaderMap;
+
+ static {
+ PROP_MODEL = parse(ServletConnection.class);
+ }
+
+ public ServletConnection(HttpAdapter adapter, ServletContext context, HttpServletRequest request, HttpServletResponse response) {
+ m_context = context;
+ m_request = request;
+ m_response = response;
+ m_contextDelegate = createContextDelegate(adapter, request);
+ m_responseHeaderMap = new HashMap<String, List<String>>();
+ }
+
+ @Property(MessageContext.SERVLET_RESPONSE)
+ public HttpServletResponse getResponse() {
+ return m_response;
+ }
+
+ @Property(MessageContext.SERVLET_REQUEST)
+ public HttpServletRequest getRequest() {
+ return m_request;
+ }
+
+ @Property(JAXWSProperties.HTTP_REQUEST_URL)
+ public String getRequestURL() {
+ return m_request.getRequestURL().toString();
+ }
+
+ @Override
+ public void setStatus(int status) {
+ m_status = status;
+ }
+
+ @Override
+ @Property(MessageContext.HTTP_RESPONSE_CODE)
+ public int getStatus() {
+ return m_status;
+ }
+
+ @Override
+ public boolean isSecure() {
+ return m_request.getScheme().equals("https");
+ }
+
+ @Override
+ public InputStream getInput() throws IOException {
+ return m_request.getInputStream();
+ }
+
+ @Override
+ public String getProtocol() {
+ return m_request.getProtocol();
+ }
+
+ @Override
+ public OutputStream getOutput() throws IOException {
+ m_response.setStatus(m_status);
+ return m_response.getOutputStream();
+ }
+
+ @Override
+ @Property(MessageContext.PATH_INFO)
+ public String getPathInfo() {
+ return m_request.getPathInfo();
+ }
+
+ @Override
+ public String getBaseAddress() {
+ return JaxWsHelper.getBaseAddress(m_request, true);
+ }
+
+ @Override
+ @Property(MessageContext.QUERY_STRING)
+ public String getQueryString() {
+ return m_request.getQueryString();
+ }
+
+ @Override
+ @Property(MessageContext.HTTP_REQUEST_METHOD)
+ public String getRequestMethod() {
+ return m_request.getMethod();
+ }
+
+ @Override
+ public String getRequestHeader(String headerName) {
+ return m_request.getHeader(headerName);
+ }
+
+ @Override
+ @SuppressWarnings("deprecation")
+ @Property({MessageContext.HTTP_REQUEST_HEADERS, Packet.INBOUND_TRANSPORT_HEADERS})
+ public Map<String, List<String>> getRequestHeaders() {
+ Map<String, List<String>> headerMap = new HashMap<String, List<String>>();
+
+ Enumeration headerNames = m_request.getHeaderNames();
+ while (headerNames.hasMoreElements()) {
+ String name = (String) headerNames.nextElement();
+ String value = m_request.getHeader(name);
+
+ if (headerMap.get(name) == null) {
+ headerMap.put(name, new ArrayList<String>());
+ }
+ headerMap.get(name).add(value);
+ }
+
+ return headerMap;
+ }
+
+ @Override
+ public void setResponseHeaders(Map<String, List<String>> responseHeaders) {
+ m_responseHeaderMap.clear();
+ m_response.reset();
+ m_response.setStatus(m_status);
+
+ // update headers of @{link HttpServletResponse}
+ if (responseHeaders == null || responseHeaders.size() == 0) {
+ return;
+ }
+ for (Entry<String, List<String>> entry : responseHeaders.entrySet()) {
+ String name = entry.getKey();
+ List<String> values = entry.getValue();
+
+ // According to JavaDoc, ignore 'Content-Type' and 'Content-Length'
+ if (name.equalsIgnoreCase("Content-Type") || name.equalsIgnoreCase("Content-Length")) {
+ continue;
+ }
+ for (String value : values) {
+ m_response.addHeader(name, value);
+ }
+ }
+ }
+
+ @Override
+ @Property({MessageContext.HTTP_RESPONSE_HEADERS, Packet.OUTBOUND_TRANSPORT_HEADERS})
+ public Map<String, List<String>> getResponseHeaders() {
+ return JaxWsHelper.cloneHeaderMap(m_responseHeaderMap); // clone according do JavaDoc
+ }
+
+ @Override
+ public void setContentTypeResponseHeader(String value) {
+ m_response.setContentType(value);
+ }
+
+ @Override
+ public void setContentLengthResponseHeader(int value) {
+ m_response.setContentLength(value);
+ }
+
+ @Property(MessageContext.SERVLET_CONTEXT)
+ public ServletContext getContext() {
+ return m_context;
+ }
+
+ @Override
+ public WebServiceContextDelegate getWebServiceContextDelegate() {
+ return m_contextDelegate;
+ }
+
+ @Override
+ protected PropertyMap getPropertyMap() {
+ return PROP_MODEL;
+ }
+
+ protected WebServiceContextDelegate createContextDelegate(HttpAdapter adapter, HttpServletRequest request) {
+ return new ServletContextDelegate(adapter, request);
+ }
+}
diff --git a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/servlet/ServletContainer.java b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/servlet/ServletContainer.java
index 8243a93364..f7eebb137c 100644
--- a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/servlet/ServletContainer.java
+++ b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/servlet/ServletContainer.java
@@ -1,57 +1,57 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.jaxws.internal.servlet;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.ws.WebServiceException;
-
-import com.sun.xml.internal.ws.api.ResourceLoader;
-import com.sun.xml.internal.ws.api.server.BoundEndpoint;
-import com.sun.xml.internal.ws.api.server.Container;
-import com.sun.xml.internal.ws.api.server.WebModule;
-
-public class ServletContainer extends Container {
-
- private final WebModule m_module = new P_ServletModule();
- private final ResourceLoader m_resourceLoader;
-
- public ServletContainer(final ResourceLoader resourceLoader) {
- m_resourceLoader = resourceLoader;
- }
-
- @Override
- public <T> T getSPI(Class<T> spiType) {
- if (spiType.isAssignableFrom(m_module.getClass())) {
- return spiType.cast(m_module);
- }
- if (spiType == ResourceLoader.class) {
- return spiType.cast(m_resourceLoader);
- }
- return null;
- }
-
- private class P_ServletModule extends WebModule {
-
- private final List<BoundEndpoint> m_endpoints = new ArrayList<BoundEndpoint>();
-
- @Override
- public String getContextPath() {
- throw new WebServiceException("Container " + ServletContainer.class.getName() + " does not support getContextPath()");
- }
-
- @Override
- public List<BoundEndpoint> getBoundEndpoints() {
- return m_endpoints;
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.jaxws.internal.servlet;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.ws.WebServiceException;
+
+import com.sun.xml.internal.ws.api.ResourceLoader;
+import com.sun.xml.internal.ws.api.server.BoundEndpoint;
+import com.sun.xml.internal.ws.api.server.Container;
+import com.sun.xml.internal.ws.api.server.WebModule;
+
+public class ServletContainer extends Container {
+
+ private final WebModule m_module = new P_ServletModule();
+ private final ResourceLoader m_resourceLoader;
+
+ public ServletContainer(final ResourceLoader resourceLoader) {
+ m_resourceLoader = resourceLoader;
+ }
+
+ @Override
+ public <T> T getSPI(Class<T> spiType) {
+ if (spiType.isAssignableFrom(m_module.getClass())) {
+ return spiType.cast(m_module);
+ }
+ if (spiType == ResourceLoader.class) {
+ return spiType.cast(m_resourceLoader);
+ }
+ return null;
+ }
+
+ private class P_ServletModule extends WebModule {
+
+ private final List<BoundEndpoint> m_endpoints = new ArrayList<BoundEndpoint>();
+
+ @Override
+ public String getContextPath() {
+ throw new WebServiceException("Container " + ServletContainer.class.getName() + " does not support getContextPath()");
+ }
+
+ @Override
+ public List<BoundEndpoint> getBoundEndpoints() {
+ return m_endpoints;
+ }
+ }
+}
diff --git a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/servlet/ServletContextDelegate.java b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/servlet/ServletContextDelegate.java
index 20d2dcc930..1a668a0fad 100644
--- a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/servlet/ServletContextDelegate.java
+++ b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/servlet/ServletContextDelegate.java
@@ -1,68 +1,68 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.jaxws.internal.servlet;
-
-import java.security.Principal;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.xml.namespace.QName;
-import javax.xml.ws.WebServiceException;
-
-import org.eclipse.scout.commons.StringUtility;
-
-import com.sun.xml.internal.ws.api.message.Packet;
-import com.sun.xml.internal.ws.api.server.PortAddressResolver;
-import com.sun.xml.internal.ws.api.server.WSEndpoint;
-import com.sun.xml.internal.ws.api.server.WebServiceContextDelegate;
-import com.sun.xml.internal.ws.transport.http.HttpAdapter;
-
-public class ServletContextDelegate implements WebServiceContextDelegate {
-
- private HttpAdapter m_servletAdapter;
- private HttpServletRequest m_request;
-
- public ServletContextDelegate(HttpAdapter servletAdapter, HttpServletRequest request) {
- m_servletAdapter = servletAdapter;
- m_request = request;
- }
-
- @Override
- public Principal getUserPrincipal(Packet packet) {
- return m_request.getUserPrincipal();
- }
-
- @Override
- public boolean isUserInRole(Packet packet, String role) {
- return m_request.isUserInRole(role);
- }
-
- @Override
- public String getEPRAddress(Packet packet, WSEndpoint endpoint) {
- String baseAddress = JaxWsHelper.getBaseAddress(m_request, true);
- PortAddressResolver resolver = m_servletAdapter.owner.createPortAddressResolver(baseAddress);
- QName serviceQName = endpoint.getServiceName();
- QName portQName = endpoint.getPortName();
-
- String address = resolver.getAddressFor(serviceQName, portQName.getLocalPart());
- if (address == null) {
- throw new WebServiceException("Failed to find address for port '" + portQName + "'");
- }
- return address;
- }
-
- @Override
- public String getWSDLAddress(Packet packet, WSEndpoint endpoint) {
- if (m_servletAdapter.getEndpoint().getPort() != null) {
- return StringUtility.join("", getEPRAddress(packet, endpoint), "?wsdl");
- }
- return null;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.jaxws.internal.servlet;
+
+import java.security.Principal;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.xml.namespace.QName;
+import javax.xml.ws.WebServiceException;
+
+import org.eclipse.scout.commons.StringUtility;
+
+import com.sun.xml.internal.ws.api.message.Packet;
+import com.sun.xml.internal.ws.api.server.PortAddressResolver;
+import com.sun.xml.internal.ws.api.server.WSEndpoint;
+import com.sun.xml.internal.ws.api.server.WebServiceContextDelegate;
+import com.sun.xml.internal.ws.transport.http.HttpAdapter;
+
+public class ServletContextDelegate implements WebServiceContextDelegate {
+
+ private HttpAdapter m_servletAdapter;
+ private HttpServletRequest m_request;
+
+ public ServletContextDelegate(HttpAdapter servletAdapter, HttpServletRequest request) {
+ m_servletAdapter = servletAdapter;
+ m_request = request;
+ }
+
+ @Override
+ public Principal getUserPrincipal(Packet packet) {
+ return m_request.getUserPrincipal();
+ }
+
+ @Override
+ public boolean isUserInRole(Packet packet, String role) {
+ return m_request.isUserInRole(role);
+ }
+
+ @Override
+ public String getEPRAddress(Packet packet, WSEndpoint endpoint) {
+ String baseAddress = JaxWsHelper.getBaseAddress(m_request, true);
+ PortAddressResolver resolver = m_servletAdapter.owner.createPortAddressResolver(baseAddress);
+ QName serviceQName = endpoint.getServiceName();
+ QName portQName = endpoint.getPortName();
+
+ String address = resolver.getAddressFor(serviceQName, portQName.getLocalPart());
+ if (address == null) {
+ throw new WebServiceException("Failed to find address for port '" + portQName + "'");
+ }
+ return address;
+ }
+
+ @Override
+ public String getWSDLAddress(Packet packet, WSEndpoint endpoint) {
+ if (m_servletAdapter.getEndpoint().getPort() != null) {
+ return StringUtility.join("", getEPRAddress(packet, endpoint), "?wsdl");
+ }
+ return null;
+ }
+}
diff --git a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/tube/ScoutTubelineAssembler.java b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/tube/ScoutTubelineAssembler.java
index 0286db28a6..c2c03f31b5 100644
--- a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/tube/ScoutTubelineAssembler.java
+++ b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/tube/ScoutTubelineAssembler.java
@@ -1,264 +1,264 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.jaxws.internal.tube;
-
-import java.lang.annotation.Annotation;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-
-import javax.xml.namespace.QName;
-import javax.xml.ws.Binding;
-import javax.xml.ws.handler.Handler;
-import javax.xml.ws.handler.LogicalHandler;
-import javax.xml.ws.handler.LogicalMessageContext;
-import javax.xml.ws.handler.MessageContext;
-import javax.xml.ws.handler.soap.SOAPHandler;
-import javax.xml.ws.handler.soap.SOAPMessageContext;
-
-import org.eclipse.scout.commons.TypeCastUtility;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.jaxws.annotation.ScoutTransaction;
-import org.eclipse.scout.jaxws.annotation.ScoutWebService;
-import org.eclipse.scout.jaxws.handler.internal.ScoutTransactionLogicalHandlerWrapper;
-import org.eclipse.scout.jaxws.handler.internal.ScoutTransactionMessageHandlerWrapper;
-import org.eclipse.scout.jaxws.handler.internal.ScoutTransactionSOAPHandlerWrapper;
-import org.eclipse.scout.jaxws.internal.ContextHelper;
-import org.eclipse.scout.jaxws.security.provider.IAuthenticationHandler;
-import org.eclipse.scout.jaxws.security.provider.ICredentialValidationStrategy;
-import org.eclipse.scout.jaxws.session.IServerSessionFactory;
-
-import com.sun.xml.internal.ws.api.handler.MessageHandler;
-import com.sun.xml.internal.ws.api.handler.MessageHandlerContext;
-import com.sun.xml.internal.ws.api.pipe.ClientTubeAssemblerContext;
-import com.sun.xml.internal.ws.api.pipe.ServerTubeAssemblerContext;
-import com.sun.xml.internal.ws.api.pipe.Tube;
-import com.sun.xml.internal.ws.api.pipe.TubelineAssembler;
-
-/**
- * Tube line assembler which installs a security handler at runtime.
- */
-public class ScoutTubelineAssembler implements TubelineAssembler {
-
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(ScoutTubelineAssembler.class);
-
- @Override
- public Tube createClient(ClientTubeAssemblerContext context) {
- // wrap handlers with transactional context
- wrapScoutTransactionHandlers(context.getBinding());
-
- // assemble tubes
- Tube head = context.createTransportTube();
- head = context.createSecurityTube(head);
- head = context.createWsaTube(head);
- head = context.createClientMUTube(head);
- head = context.createValidationTube(head);
- return context.createHandlerTube(head);
- }
-
- @Override
- public Tube createServer(ServerTubeAssemblerContext context) {
- // Installs the authentication handler
- // This must precede wrapping handlers with a transactional context
- installServerAuthenticationHandler(context);
-
- // wrap handlers with transactional context
- wrapScoutTransactionHandlers(context.getEndpoint().getBinding());
-
- // assemble tubes
- Tube head = context.getTerminalTube();
- head = context.createValidationTube(head);
- head = context.createHandlerTube(head);
- head = context.createMonitoringTube(head);
- head = context.createServerMUTube(head);
- head = context.createWsaTube(head);
- head = context.createSecurityTube(head);
- return head;
- }
-
- private void wrapScoutTransactionHandlers(Binding binding) {
- List<Handler> handlerChain = new ArrayList<Handler>();
-
- for (Handler handler : binding.getHandlerChain()) {
- if (handler instanceof LogicalHandler ||
- handler instanceof SOAPHandler ||
- handler instanceof MessageHandler) {
-
- ScoutTransaction annotation = getAnnotation(handler.getClass(), ScoutTransaction.class);
- if (annotation != null) {
- handler = createScoutTransactionHandlerWrapper(handler, annotation);
- }
- }
- handlerChain.add(handler);
- }
- binding.setHandlerChain(handlerChain);
- }
-
- @SuppressWarnings("unchecked")
- private Handler createScoutTransactionHandlerWrapper(final Handler handler, final ScoutTransaction scoutTransaction) {
- if (scoutTransaction == null || handler == null) {
- return handler;
- }
-
- if (handler instanceof LogicalHandler) {
- return new ScoutTransactionLogicalHandlerWrapper<LogicalMessageContext>((LogicalHandler<LogicalMessageContext>) handler, scoutTransaction);
- }
- else if (handler instanceof SOAPHandler) {
- return new ScoutTransactionSOAPHandlerWrapper<SOAPMessageContext>((SOAPHandler) handler, scoutTransaction);
- }
- else if (handler instanceof MessageHandler) {
- return new ScoutTransactionMessageHandlerWrapper<MessageHandlerContext>((MessageHandler<MessageHandlerContext>) handler, scoutTransaction);
- }
- else {
- LOG.warn("Unsupported handler type '" + handler.getClass().getName() + "' for Scout transaction.");
- return handler;
- }
- }
-
- private void installServerAuthenticationHandler(ServerTubeAssemblerContext context) {
- List<Handler> handlerChain = new LinkedList<Handler>();
-
- // install existing handlers
- handlerChain.addAll(context.getEndpoint().getBinding().getHandlerChain());
-
- // install authentication handler
- IAuthenticationHandler authenticationHandler = createAuthenticationHandler(context);
- if (authenticationHandler != null) {
- handlerChain.add(authenticationHandler);
- }
-
- // install handler to put the session factory configured on the port type into the runnning context.
- // This handler must be installed prior to authentication handlers
- Class<?> portTypeClass = context.getEndpoint().getImplementationClass();
- try {
- if (portTypeClass != null) {
- ScoutWebService scoutWebService = portTypeClass.getAnnotation(ScoutWebService.class);
- if (scoutWebService != null) {
- handlerChain.add(new P_PortTypeSessionFactoryRegistrationHandler(scoutWebService));
- }
- }
- }
- catch (Exception e) {
- LOG.error("failed to install handler to register configured port type factory in running context", e);
- }
-
- // set handler chain
- context.getEndpoint().getBinding().setHandlerChain(handlerChain);
- }
-
- private IAuthenticationHandler createAuthenticationHandler(ServerTubeAssemblerContext context) {
- Class<?> wsImplClazz = context.getEndpoint().getImplementationClass();
- if (wsImplClazz == null) {
- return null;
- }
-
- ScoutWebService annotation = getAnnotation(wsImplClazz, ScoutWebService.class);
- if (annotation == null) {
- return null;
- }
-
- Class<? extends IAuthenticationHandler> authenticationHandlerClazz = annotation.authenticationHandler();
- if (authenticationHandlerClazz == null || authenticationHandlerClazz == IAuthenticationHandler.NONE.class) {
- return null;
- }
-
- IAuthenticationHandler authenticationHandler = null;
- try {
- authenticationHandler = authenticationHandlerClazz.newInstance();
- }
- catch (Throwable e) {
- LOG.error("Failed to create authentication handler '" + authenticationHandlerClazz.getName() + "'. No authentication is applied.", e);
- return null;
- }
-
- // inject credential validation strategy
- Class<? extends ICredentialValidationStrategy> strategyClazz = annotation.credentialValidationStrategy();
- if (strategyClazz == null) {
- return authenticationHandler;
- }
-
- ICredentialValidationStrategy strategy = null;
- try {
- strategy = strategyClazz.newInstance();
- }
- catch (Throwable e) {
- LOG.error("Failed to create credential validation strategy '" + strategyClazz.getName() + "' for authentication handler '" + authenticationHandler.getClass().getName() + "'.", e);
- return authenticationHandler;
- }
-
- // inject credential validation strategy
- try {
- authenticationHandler.injectCredentialValidationStrategy(strategy);
- }
- catch (Throwable e) {
- LOG.error("Failed to inject credential validation strategy to authentication handler '" + authenticationHandler.getClass().getName() + "'.", e);
- return authenticationHandler;
- }
-
- return authenticationHandler;
- }
-
- private <A extends Annotation> A getAnnotation(Class<?> type, Class<A> annotationClazz) {
- A annotation = type.getAnnotation(annotationClazz);
- if (annotation == null && type != Object.class) {
- return getAnnotation(type.getSuperclass(), annotationClazz);
- }
- return annotation;
- }
-
- /**
- * Handler used to store the session factory configured on the port type in the calling context.
- * This must be the first handler installed.
- */
- private class P_PortTypeSessionFactoryRegistrationHandler implements SOAPHandler<SOAPMessageContext> {
-
- private ScoutWebService m_scoutWebServiceAnnotation;
-
- private P_PortTypeSessionFactoryRegistrationHandler(ScoutWebService scoutWebServiceAnnotation) {
- m_scoutWebServiceAnnotation = scoutWebServiceAnnotation;
- }
-
- @Override
- public boolean handleMessage(SOAPMessageContext context) {
- boolean outbound = TypeCastUtility.castValue(context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY), boolean.class);
- if (outbound) {
- return true; // only inbound messages are of interest
- }
- try {
- // get session factory configured on port type
- IServerSessionFactory portTypeSessionFactory = m_scoutWebServiceAnnotation.sessionFactory().newInstance();
- // store session factory in running context
- ContextHelper.setPortTypeSessionFactory(context, portTypeSessionFactory);
- }
- catch (Exception e) {
- LOG.error("Failed to put port type session factory into the running context", e);
- }
- return true;
- }
-
- @Override
- public boolean handleFault(SOAPMessageContext context) {
- return true;
- }
-
- @Override
- public void close(MessageContext context) {
- }
-
- @Override
- public Set<QName> getHeaders() {
- return new HashSet<QName>();
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.jaxws.internal.tube;
+
+import java.lang.annotation.Annotation;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Binding;
+import javax.xml.ws.handler.Handler;
+import javax.xml.ws.handler.LogicalHandler;
+import javax.xml.ws.handler.LogicalMessageContext;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPHandler;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+import org.eclipse.scout.commons.TypeCastUtility;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.jaxws.annotation.ScoutTransaction;
+import org.eclipse.scout.jaxws.annotation.ScoutWebService;
+import org.eclipse.scout.jaxws.handler.internal.ScoutTransactionLogicalHandlerWrapper;
+import org.eclipse.scout.jaxws.handler.internal.ScoutTransactionMessageHandlerWrapper;
+import org.eclipse.scout.jaxws.handler.internal.ScoutTransactionSOAPHandlerWrapper;
+import org.eclipse.scout.jaxws.internal.ContextHelper;
+import org.eclipse.scout.jaxws.security.provider.IAuthenticationHandler;
+import org.eclipse.scout.jaxws.security.provider.ICredentialValidationStrategy;
+import org.eclipse.scout.jaxws.session.IServerSessionFactory;
+
+import com.sun.xml.internal.ws.api.handler.MessageHandler;
+import com.sun.xml.internal.ws.api.handler.MessageHandlerContext;
+import com.sun.xml.internal.ws.api.pipe.ClientTubeAssemblerContext;
+import com.sun.xml.internal.ws.api.pipe.ServerTubeAssemblerContext;
+import com.sun.xml.internal.ws.api.pipe.Tube;
+import com.sun.xml.internal.ws.api.pipe.TubelineAssembler;
+
+/**
+ * Tube line assembler which installs a security handler at runtime.
+ */
+public class ScoutTubelineAssembler implements TubelineAssembler {
+
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(ScoutTubelineAssembler.class);
+
+ @Override
+ public Tube createClient(ClientTubeAssemblerContext context) {
+ // wrap handlers with transactional context
+ wrapScoutTransactionHandlers(context.getBinding());
+
+ // assemble tubes
+ Tube head = context.createTransportTube();
+ head = context.createSecurityTube(head);
+ head = context.createWsaTube(head);
+ head = context.createClientMUTube(head);
+ head = context.createValidationTube(head);
+ return context.createHandlerTube(head);
+ }
+
+ @Override
+ public Tube createServer(ServerTubeAssemblerContext context) {
+ // Installs the authentication handler
+ // This must precede wrapping handlers with a transactional context
+ installServerAuthenticationHandler(context);
+
+ // wrap handlers with transactional context
+ wrapScoutTransactionHandlers(context.getEndpoint().getBinding());
+
+ // assemble tubes
+ Tube head = context.getTerminalTube();
+ head = context.createValidationTube(head);
+ head = context.createHandlerTube(head);
+ head = context.createMonitoringTube(head);
+ head = context.createServerMUTube(head);
+ head = context.createWsaTube(head);
+ head = context.createSecurityTube(head);
+ return head;
+ }
+
+ private void wrapScoutTransactionHandlers(Binding binding) {
+ List<Handler> handlerChain = new ArrayList<Handler>();
+
+ for (Handler handler : binding.getHandlerChain()) {
+ if (handler instanceof LogicalHandler ||
+ handler instanceof SOAPHandler ||
+ handler instanceof MessageHandler) {
+
+ ScoutTransaction annotation = getAnnotation(handler.getClass(), ScoutTransaction.class);
+ if (annotation != null) {
+ handler = createScoutTransactionHandlerWrapper(handler, annotation);
+ }
+ }
+ handlerChain.add(handler);
+ }
+ binding.setHandlerChain(handlerChain);
+ }
+
+ @SuppressWarnings("unchecked")
+ private Handler createScoutTransactionHandlerWrapper(final Handler handler, final ScoutTransaction scoutTransaction) {
+ if (scoutTransaction == null || handler == null) {
+ return handler;
+ }
+
+ if (handler instanceof LogicalHandler) {
+ return new ScoutTransactionLogicalHandlerWrapper<LogicalMessageContext>((LogicalHandler<LogicalMessageContext>) handler, scoutTransaction);
+ }
+ else if (handler instanceof SOAPHandler) {
+ return new ScoutTransactionSOAPHandlerWrapper<SOAPMessageContext>((SOAPHandler) handler, scoutTransaction);
+ }
+ else if (handler instanceof MessageHandler) {
+ return new ScoutTransactionMessageHandlerWrapper<MessageHandlerContext>((MessageHandler<MessageHandlerContext>) handler, scoutTransaction);
+ }
+ else {
+ LOG.warn("Unsupported handler type '" + handler.getClass().getName() + "' for Scout transaction.");
+ return handler;
+ }
+ }
+
+ private void installServerAuthenticationHandler(ServerTubeAssemblerContext context) {
+ List<Handler> handlerChain = new LinkedList<Handler>();
+
+ // install existing handlers
+ handlerChain.addAll(context.getEndpoint().getBinding().getHandlerChain());
+
+ // install authentication handler
+ IAuthenticationHandler authenticationHandler = createAuthenticationHandler(context);
+ if (authenticationHandler != null) {
+ handlerChain.add(authenticationHandler);
+ }
+
+ // install handler to put the session factory configured on the port type into the runnning context.
+ // This handler must be installed prior to authentication handlers
+ Class<?> portTypeClass = context.getEndpoint().getImplementationClass();
+ try {
+ if (portTypeClass != null) {
+ ScoutWebService scoutWebService = portTypeClass.getAnnotation(ScoutWebService.class);
+ if (scoutWebService != null) {
+ handlerChain.add(new P_PortTypeSessionFactoryRegistrationHandler(scoutWebService));
+ }
+ }
+ }
+ catch (Exception e) {
+ LOG.error("failed to install handler to register configured port type factory in running context", e);
+ }
+
+ // set handler chain
+ context.getEndpoint().getBinding().setHandlerChain(handlerChain);
+ }
+
+ private IAuthenticationHandler createAuthenticationHandler(ServerTubeAssemblerContext context) {
+ Class<?> wsImplClazz = context.getEndpoint().getImplementationClass();
+ if (wsImplClazz == null) {
+ return null;
+ }
+
+ ScoutWebService annotation = getAnnotation(wsImplClazz, ScoutWebService.class);
+ if (annotation == null) {
+ return null;
+ }
+
+ Class<? extends IAuthenticationHandler> authenticationHandlerClazz = annotation.authenticationHandler();
+ if (authenticationHandlerClazz == null || authenticationHandlerClazz == IAuthenticationHandler.NONE.class) {
+ return null;
+ }
+
+ IAuthenticationHandler authenticationHandler = null;
+ try {
+ authenticationHandler = authenticationHandlerClazz.newInstance();
+ }
+ catch (Throwable e) {
+ LOG.error("Failed to create authentication handler '" + authenticationHandlerClazz.getName() + "'. No authentication is applied.", e);
+ return null;
+ }
+
+ // inject credential validation strategy
+ Class<? extends ICredentialValidationStrategy> strategyClazz = annotation.credentialValidationStrategy();
+ if (strategyClazz == null) {
+ return authenticationHandler;
+ }
+
+ ICredentialValidationStrategy strategy = null;
+ try {
+ strategy = strategyClazz.newInstance();
+ }
+ catch (Throwable e) {
+ LOG.error("Failed to create credential validation strategy '" + strategyClazz.getName() + "' for authentication handler '" + authenticationHandler.getClass().getName() + "'.", e);
+ return authenticationHandler;
+ }
+
+ // inject credential validation strategy
+ try {
+ authenticationHandler.injectCredentialValidationStrategy(strategy);
+ }
+ catch (Throwable e) {
+ LOG.error("Failed to inject credential validation strategy to authentication handler '" + authenticationHandler.getClass().getName() + "'.", e);
+ return authenticationHandler;
+ }
+
+ return authenticationHandler;
+ }
+
+ private <A extends Annotation> A getAnnotation(Class<?> type, Class<A> annotationClazz) {
+ A annotation = type.getAnnotation(annotationClazz);
+ if (annotation == null && type != Object.class) {
+ return getAnnotation(type.getSuperclass(), annotationClazz);
+ }
+ return annotation;
+ }
+
+ /**
+ * Handler used to store the session factory configured on the port type in the calling context.
+ * This must be the first handler installed.
+ */
+ private class P_PortTypeSessionFactoryRegistrationHandler implements SOAPHandler<SOAPMessageContext> {
+
+ private ScoutWebService m_scoutWebServiceAnnotation;
+
+ private P_PortTypeSessionFactoryRegistrationHandler(ScoutWebService scoutWebServiceAnnotation) {
+ m_scoutWebServiceAnnotation = scoutWebServiceAnnotation;
+ }
+
+ @Override
+ public boolean handleMessage(SOAPMessageContext context) {
+ boolean outbound = TypeCastUtility.castValue(context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY), boolean.class);
+ if (outbound) {
+ return true; // only inbound messages are of interest
+ }
+ try {
+ // get session factory configured on port type
+ IServerSessionFactory portTypeSessionFactory = m_scoutWebServiceAnnotation.sessionFactory().newInstance();
+ // store session factory in running context
+ ContextHelper.setPortTypeSessionFactory(context, portTypeSessionFactory);
+ }
+ catch (Exception e) {
+ LOG.error("Failed to put port type session factory into the running context", e);
+ }
+ return true;
+ }
+
+ @Override
+ public boolean handleFault(SOAPMessageContext context) {
+ return true;
+ }
+
+ @Override
+ public void close(MessageContext context) {
+ }
+
+ @Override
+ public Set<QName> getHeaders() {
+ return new HashSet<QName>();
+ }
+ }
+}
diff --git a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/tube/ScoutTubelineAssemblerFactory.java b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/tube/ScoutTubelineAssemblerFactory.java
index d11ddd06de..86cc1bb8d5 100644
--- a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/tube/ScoutTubelineAssemblerFactory.java
+++ b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/internal/tube/ScoutTubelineAssemblerFactory.java
@@ -1,27 +1,27 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.jaxws.internal.tube;
-
-import com.sun.xml.internal.ws.api.BindingID;
-import com.sun.xml.internal.ws.api.pipe.TubelineAssembler;
-import com.sun.xml.internal.ws.api.pipe.TubelineAssemblerFactory;
-
-/**
- * Factory to provide a custom tubeline assembler. This factory is registered in file
- * META-INF/services/com.sun.xml.ws.api.pipe.TubelineAssemblerFactory.
- */
-public class ScoutTubelineAssemblerFactory extends TubelineAssemblerFactory {
-
- @Override
- public TubelineAssembler doCreate(BindingID bindingid) {
- return new ScoutTubelineAssembler();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.jaxws.internal.tube;
+
+import com.sun.xml.internal.ws.api.BindingID;
+import com.sun.xml.internal.ws.api.pipe.TubelineAssembler;
+import com.sun.xml.internal.ws.api.pipe.TubelineAssemblerFactory;
+
+/**
+ * Factory to provide a custom tubeline assembler. This factory is registered in file
+ * META-INF/services/com.sun.xml.ws.api.pipe.TubelineAssemblerFactory.
+ */
+public class ScoutTubelineAssemblerFactory extends TubelineAssemblerFactory {
+
+ @Override
+ public TubelineAssembler doCreate(BindingID bindingid) {
+ return new ScoutTubelineAssembler();
+ }
+}
diff --git a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/security/Authenticator.java b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/security/Authenticator.java
index 62fde3f35f..8b5265e7cf 100644
--- a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/security/Authenticator.java
+++ b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/security/Authenticator.java
@@ -1,88 +1,88 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.jaxws.security;
-
-import java.security.AccessController;
-
-import javax.security.auth.Subject;
-import javax.xml.ws.WebServiceException;
-
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.commons.security.SimplePrincipal;
-import org.eclipse.scout.jaxws.security.provider.ICredentialValidationStrategy;
-
-/**
- * Helper to authenticate a request.
- * <p>
- * A request is considered authenticated, if it run's in a subject context with one principal set at minimum.
- * </p>
- */
-public class Authenticator {
-
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(Authenticator.class);
-
- /**
- * Checks whether the call runs in a doAs Subject context with one principal set at minimum
- *
- * @return true if the calls runs in a doAs context with one principal set at minimum
- */
- public static boolean isSubjectAuthenticated() {
- Subject subject = Subject.getSubject(AccessController.getContext());
- return (subject != null && subject.getPrincipals().size() > 0);
- }
-
- /**
- * Authenticates a request with the given user's credential. If credentials are accepted by the given credential
- * validation strategy, a respective user principal is created and added to the subject. Finally, the subject is
- * marked readonly.
- *
- * @param strategy
- * credential validation strategy to validate a user's credential
- * @param username
- * the username to be validated
- * @param passwordPlainText
- * the password to be validated
- * @return true if authentication succeeds or false otherwise
- */
- public static boolean authenticateRequest(ICredentialValidationStrategy strategy, String username, String passwordPlainText) {
- Subject subject = Subject.getSubject(AccessController.getContext());
- if (subject == null) {
- throw new WebServiceException("Webservice request was blocked due to security reasons: request must run on behalf of a subject context.");
- }
-
- if (subject.getPrincipals().size() > 0) {
- return true; // request already authenticated
- }
- if (subject.isReadOnly()) {
- throw new WebServiceException("Unexpected. Authenticated principal cannot be added to subject as it is readonly.");
- }
- if (strategy == null) {
- LOG.warn("No credential validation strategy configured.");
- return false;
- }
- if (!StringUtility.hasText(username) || !StringUtility.hasText(passwordPlainText)) {
- return false;
- }
- try {
- if (strategy.isValidUser(username, passwordPlainText)) {
- subject.getPrincipals().add(new SimplePrincipal(username));
- subject.setReadOnly();
- return true;
- }
- }
- catch (Exception e) {
- LOG.error("user credential validation failed", e);
- }
- return false;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.jaxws.security;
+
+import java.security.AccessController;
+
+import javax.security.auth.Subject;
+import javax.xml.ws.WebServiceException;
+
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.commons.security.SimplePrincipal;
+import org.eclipse.scout.jaxws.security.provider.ICredentialValidationStrategy;
+
+/**
+ * Helper to authenticate a request.
+ * <p>
+ * A request is considered authenticated, if it run's in a subject context with one principal set at minimum.
+ * </p>
+ */
+public class Authenticator {
+
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(Authenticator.class);
+
+ /**
+ * Checks whether the call runs in a doAs Subject context with one principal set at minimum
+ *
+ * @return true if the calls runs in a doAs context with one principal set at minimum
+ */
+ public static boolean isSubjectAuthenticated() {
+ Subject subject = Subject.getSubject(AccessController.getContext());
+ return (subject != null && subject.getPrincipals().size() > 0);
+ }
+
+ /**
+ * Authenticates a request with the given user's credential. If credentials are accepted by the given credential
+ * validation strategy, a respective user principal is created and added to the subject. Finally, the subject is
+ * marked readonly.
+ *
+ * @param strategy
+ * credential validation strategy to validate a user's credential
+ * @param username
+ * the username to be validated
+ * @param passwordPlainText
+ * the password to be validated
+ * @return true if authentication succeeds or false otherwise
+ */
+ public static boolean authenticateRequest(ICredentialValidationStrategy strategy, String username, String passwordPlainText) {
+ Subject subject = Subject.getSubject(AccessController.getContext());
+ if (subject == null) {
+ throw new WebServiceException("Webservice request was blocked due to security reasons: request must run on behalf of a subject context.");
+ }
+
+ if (subject.getPrincipals().size() > 0) {
+ return true; // request already authenticated
+ }
+ if (subject.isReadOnly()) {
+ throw new WebServiceException("Unexpected. Authenticated principal cannot be added to subject as it is readonly.");
+ }
+ if (strategy == null) {
+ LOG.warn("No credential validation strategy configured.");
+ return false;
+ }
+ if (!StringUtility.hasText(username) || !StringUtility.hasText(passwordPlainText)) {
+ return false;
+ }
+ try {
+ if (strategy.isValidUser(username, passwordPlainText)) {
+ subject.getPrincipals().add(new SimplePrincipal(username));
+ subject.setReadOnly();
+ return true;
+ }
+ }
+ catch (Exception e) {
+ LOG.error("user credential validation failed", e);
+ }
+ return false;
+ }
+}
diff --git a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/security/GlobalTrustManagerService.java b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/security/GlobalTrustManagerService.java
index 69f780727b..72578718e9 100644
--- a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/security/GlobalTrustManagerService.java
+++ b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/security/GlobalTrustManagerService.java
@@ -1,255 +1,255 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.jaxws.security;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedWriter;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FilenameFilter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.StringWriter;
-import java.security.GeneralSecurityException;
-import java.security.KeyStore;
-import java.security.SecureRandom;
-import java.security.cert.CertificateException;
-import java.security.cert.CertificateFactory;
-import java.security.cert.X509Certificate;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.LinkedList;
-import java.util.List;
-
-import javax.net.ssl.HttpsURLConnection;
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.TrustManager;
-import javax.net.ssl.TrustManagerFactory;
-import javax.net.ssl.X509TrustManager;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.shared.services.common.file.IRemoteFileService;
-import org.eclipse.scout.rt.shared.services.common.file.RemoteFile;
-import org.eclipse.scout.service.AbstractService;
-import org.eclipse.scout.service.SERVICES;
-
-/**
- * Factory to create a global {@link TrustManager}. If a certificate is not trusted by the manager, the request is
- * delegates to other installed {@link TrustManager}'s, e.g. the JAVA default keystore cacerts.
- * Trusted certificates should be placed in <i>/externalfiles/certificates/</i>. Please consider that only *.DER
- * certificate files are considered.
- */
-public class GlobalTrustManagerService extends AbstractService {
-
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(GlobalTrustManagerService.class);
-
- private static final String PATH_CERTS = "/certificates";
-
- public void installGlobalTrustManager() throws ProcessingException {
- X509TrustManager globalTrustManager;
- try {
- globalTrustManager = createGlobalTrustManager();
-
- SSLContext sslContext = SSLContext.getInstance("SSL");
- sslContext.init(null, new TrustManager[]{globalTrustManager}, new SecureRandom());
- HttpsURLConnection.setDefaultSSLSocketFactory(sslContext.getSocketFactory());
- }
- catch (Exception e) {
- throw new ProcessingException("could not install global trust manager.", e);
- }
- }
-
- protected X509Certificate[] getTrustedCertificates() throws IOException, CertificateException {
- List<X509Certificate> trustedCerts = new LinkedList<X509Certificate>();
-
- FilenameFilter certFilter = new FilenameFilter() {
- @Override
- public boolean accept(File file, String name) {
- return (name.toLowerCase().endsWith(".der"));
- }
- };
-
- try {
- RemoteFile[] certRemoteFiles = SERVICES.getService(IRemoteFileService.class).getRemoteFiles(PATH_CERTS, certFilter, null);
- if (certRemoteFiles.length == 0) {
- LOG.warn("No certificates to trust in folder '" + PATH_CERTS + "' could be found.");
- }
-
- for (RemoteFile certRemoteFile : certRemoteFiles) {
- try {
- LOG.info("Trusted certificate '" + certRemoteFile.getName() + "' found.");
- ByteArrayOutputStream os = new ByteArrayOutputStream();
- certRemoteFile.writeData(os);
- X509Certificate cert = readX509Cert(new ByteArrayInputStream(os.toByteArray()));
- trustedCerts.add(cert);
- LOG.info("Trusted certificate '" + certRemoteFile.getName() + "' successfully installed.");
- }
- catch (Exception e) {
- LOG.info("Failed to install trusted certificate '" + certRemoteFile.getName() + "'.");
- }
- }
- }
- catch (ProcessingException e) {
- LOG.error("Could not access folder '" + PATH_CERTS + "' to import trusted certificates.", e);
- }
-
- return trustedCerts.toArray(new X509Certificate[trustedCerts.size()]);
- }
-
- protected X509TrustManager createGlobalTrustManager() throws Exception {
- X509Certificate[] trustedCerts = getTrustedCertificates();
-
- P_GlobalTrustManager globalTrustManager = new P_GlobalTrustManager(trustedCerts);
- return globalTrustManager;
- }
-
- private X509Certificate readX509Cert(InputStream inputStream) throws CertificateException, IOException {
- BufferedInputStream bis = new BufferedInputStream(inputStream);
- CertificateFactory certFactory = CertificateFactory.getInstance("X.509");
- X509Certificate cert = null;
- while (bis.available() > 0) {
- cert = (X509Certificate) certFactory.generateCertificate(bis);
- }
-
- try {
- bis.close();
- }
- catch (IOException e) {
- LOG.warn("could not close input stream for certificate");
- }
- return cert;
- }
-
- protected class P_GlobalTrustManager implements X509TrustManager {
-
- private TrustManager[] m_installedTrustManagers;
- private X509Certificate[] m_trustedCerts;
-
- public P_GlobalTrustManager(X509Certificate[] trustedCerts) throws Exception {
- if (trustedCerts != null) {
- m_trustedCerts = trustedCerts;
- }
- else {
- m_trustedCerts = new X509Certificate[0];
- }
-
- // Get default truststore. As no argument is provided for keystore, the precedence is as follows:
- // 1. evaluation of system property 'javax.net.ssl.trustStore' and check whether a truststore exists at the given location
- // 2. check, whether the following truststore exists: %JAVA_HOME%/lib/security/jssecacerts
- // 3. check, whether the following truststore exists: %JAVA_HOME%/lib/security/cacerts
- // 4. empty truststore with no certificates in it is used
- TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance("SunX509");
- trustManagerFactory.init((KeyStore) null);
- m_installedTrustManagers = trustManagerFactory.getTrustManagers();
-
- if (m_installedTrustManagers == null) {
- m_installedTrustManagers = new TrustManager[0];
- }
- }
-
- @Override
- public void checkClientTrusted(X509Certificate[] certs, String authType) throws CertificateException {
- // only ask default truststore (e.g. cacerts) for trusted certificates. Depending on the authType, different managers are possible.
- for (TrustManager installedTrustManager : m_installedTrustManagers) {
- if (installedTrustManager instanceof X509TrustManager) {
- try {
- ((X509TrustManager) installedTrustManager).checkClientTrusted(certs, authType);
- }
- catch (CertificateException e) {
- LOG.error("certificate not trusted.", e);
- throw e;
- }
- }
- }
- }
-
- @Override
- public void checkServerTrusted(X509Certificate[] certs, String authType) throws CertificateException {
- // check whether certificate is stored as trusted certificate in external files
-
- // iterates from most specific to root certificate
- for (X509Certificate candidateCert : certs) {
- if (candidateCert == null) {
- continue;
- }
-
- for (X509Certificate trustedCert : m_trustedCerts) {
- if (trustedCert == null) {
- continue;
- }
-
- try {
- // Verifies that this certificate was signed using the private key that corresponds to the specified public key.
- candidateCert.verify(trustedCert.getPublicKey());
- // check whether certificate is still valid (time)
- candidateCert.checkValidity();
- // certificate accepted
- return;
- }
- catch (GeneralSecurityException e) {
- // Security exception is thrown if a certificate is not valid.
- }
- }
- }
-
- // ask default truststore (e.g. cacerts) whether certificate is trusted. Depending on the authType, different managers are possible.
- for (TrustManager trustManager : m_installedTrustManagers) {
- if (trustManager instanceof X509TrustManager) {
- try {
- ((X509TrustManager) trustManager).checkServerTrusted(certs, authType);
- }
- catch (CertificateException e) {
- LOG.error("certificate not trusted.", e);
- throw e;
- }
- }
- }
- }
-
- @Override
- public X509Certificate[] getAcceptedIssuers() {
- List<X509Certificate> trustedCertsAll = new ArrayList<X509Certificate>();
- trustedCertsAll.addAll(Arrays.asList(m_trustedCerts));
-
- // ask default truststore (e.g. cacerts) for trusted certificates. Depending on the authType, different managers are possible.
- for (TrustManager trustManager : m_installedTrustManagers) {
- if (trustManager instanceof X509TrustManager) {
- X509Certificate[] certs = ((X509TrustManager) trustManager).getAcceptedIssuers();
- if (certs != null && certs.length > 0) {
- trustedCertsAll.addAll(Arrays.asList(certs));
- }
- }
- }
-
- return trustedCertsAll.toArray(new X509Certificate[trustedCertsAll.size()]);
- }
-
- private String printCertificates(X509Certificate[] certificates) {
- StringWriter stringWriter = new StringWriter();
- BufferedWriter writer = new BufferedWriter(stringWriter);
-
- for (X509Certificate certificate : certificates) {
- try {
- writer.write(certificate.toString());
- writer.newLine();
- }
- catch (IOException e) {
- LOG.warn("Error while printing certificates.", e);
- }
- }
-
- return stringWriter.getBuffer().toString();
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.jaxws.security;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedWriter;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringWriter;
+import java.security.GeneralSecurityException;
+import java.security.KeyStore;
+import java.security.SecureRandom;
+import java.security.cert.CertificateException;
+import java.security.cert.CertificateFactory;
+import java.security.cert.X509Certificate;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.TrustManagerFactory;
+import javax.net.ssl.X509TrustManager;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.shared.services.common.file.IRemoteFileService;
+import org.eclipse.scout.rt.shared.services.common.file.RemoteFile;
+import org.eclipse.scout.service.AbstractService;
+import org.eclipse.scout.service.SERVICES;
+
+/**
+ * Factory to create a global {@link TrustManager}. If a certificate is not trusted by the manager, the request is
+ * delegates to other installed {@link TrustManager}'s, e.g. the JAVA default keystore cacerts.
+ * Trusted certificates should be placed in <i>/externalfiles/certificates/</i>. Please consider that only *.DER
+ * certificate files are considered.
+ */
+public class GlobalTrustManagerService extends AbstractService {
+
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(GlobalTrustManagerService.class);
+
+ private static final String PATH_CERTS = "/certificates";
+
+ public void installGlobalTrustManager() throws ProcessingException {
+ X509TrustManager globalTrustManager;
+ try {
+ globalTrustManager = createGlobalTrustManager();
+
+ SSLContext sslContext = SSLContext.getInstance("SSL");
+ sslContext.init(null, new TrustManager[]{globalTrustManager}, new SecureRandom());
+ HttpsURLConnection.setDefaultSSLSocketFactory(sslContext.getSocketFactory());
+ }
+ catch (Exception e) {
+ throw new ProcessingException("could not install global trust manager.", e);
+ }
+ }
+
+ protected X509Certificate[] getTrustedCertificates() throws IOException, CertificateException {
+ List<X509Certificate> trustedCerts = new LinkedList<X509Certificate>();
+
+ FilenameFilter certFilter = new FilenameFilter() {
+ @Override
+ public boolean accept(File file, String name) {
+ return (name.toLowerCase().endsWith(".der"));
+ }
+ };
+
+ try {
+ RemoteFile[] certRemoteFiles = SERVICES.getService(IRemoteFileService.class).getRemoteFiles(PATH_CERTS, certFilter, null);
+ if (certRemoteFiles.length == 0) {
+ LOG.warn("No certificates to trust in folder '" + PATH_CERTS + "' could be found.");
+ }
+
+ for (RemoteFile certRemoteFile : certRemoteFiles) {
+ try {
+ LOG.info("Trusted certificate '" + certRemoteFile.getName() + "' found.");
+ ByteArrayOutputStream os = new ByteArrayOutputStream();
+ certRemoteFile.writeData(os);
+ X509Certificate cert = readX509Cert(new ByteArrayInputStream(os.toByteArray()));
+ trustedCerts.add(cert);
+ LOG.info("Trusted certificate '" + certRemoteFile.getName() + "' successfully installed.");
+ }
+ catch (Exception e) {
+ LOG.info("Failed to install trusted certificate '" + certRemoteFile.getName() + "'.");
+ }
+ }
+ }
+ catch (ProcessingException e) {
+ LOG.error("Could not access folder '" + PATH_CERTS + "' to import trusted certificates.", e);
+ }
+
+ return trustedCerts.toArray(new X509Certificate[trustedCerts.size()]);
+ }
+
+ protected X509TrustManager createGlobalTrustManager() throws Exception {
+ X509Certificate[] trustedCerts = getTrustedCertificates();
+
+ P_GlobalTrustManager globalTrustManager = new P_GlobalTrustManager(trustedCerts);
+ return globalTrustManager;
+ }
+
+ private X509Certificate readX509Cert(InputStream inputStream) throws CertificateException, IOException {
+ BufferedInputStream bis = new BufferedInputStream(inputStream);
+ CertificateFactory certFactory = CertificateFactory.getInstance("X.509");
+ X509Certificate cert = null;
+ while (bis.available() > 0) {
+ cert = (X509Certificate) certFactory.generateCertificate(bis);
+ }
+
+ try {
+ bis.close();
+ }
+ catch (IOException e) {
+ LOG.warn("could not close input stream for certificate");
+ }
+ return cert;
+ }
+
+ protected class P_GlobalTrustManager implements X509TrustManager {
+
+ private TrustManager[] m_installedTrustManagers;
+ private X509Certificate[] m_trustedCerts;
+
+ public P_GlobalTrustManager(X509Certificate[] trustedCerts) throws Exception {
+ if (trustedCerts != null) {
+ m_trustedCerts = trustedCerts;
+ }
+ else {
+ m_trustedCerts = new X509Certificate[0];
+ }
+
+ // Get default truststore. As no argument is provided for keystore, the precedence is as follows:
+ // 1. evaluation of system property 'javax.net.ssl.trustStore' and check whether a truststore exists at the given location
+ // 2. check, whether the following truststore exists: %JAVA_HOME%/lib/security/jssecacerts
+ // 3. check, whether the following truststore exists: %JAVA_HOME%/lib/security/cacerts
+ // 4. empty truststore with no certificates in it is used
+ TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance("SunX509");
+ trustManagerFactory.init((KeyStore) null);
+ m_installedTrustManagers = trustManagerFactory.getTrustManagers();
+
+ if (m_installedTrustManagers == null) {
+ m_installedTrustManagers = new TrustManager[0];
+ }
+ }
+
+ @Override
+ public void checkClientTrusted(X509Certificate[] certs, String authType) throws CertificateException {
+ // only ask default truststore (e.g. cacerts) for trusted certificates. Depending on the authType, different managers are possible.
+ for (TrustManager installedTrustManager : m_installedTrustManagers) {
+ if (installedTrustManager instanceof X509TrustManager) {
+ try {
+ ((X509TrustManager) installedTrustManager).checkClientTrusted(certs, authType);
+ }
+ catch (CertificateException e) {
+ LOG.error("certificate not trusted.", e);
+ throw e;
+ }
+ }
+ }
+ }
+
+ @Override
+ public void checkServerTrusted(X509Certificate[] certs, String authType) throws CertificateException {
+ // check whether certificate is stored as trusted certificate in external files
+
+ // iterates from most specific to root certificate
+ for (X509Certificate candidateCert : certs) {
+ if (candidateCert == null) {
+ continue;
+ }
+
+ for (X509Certificate trustedCert : m_trustedCerts) {
+ if (trustedCert == null) {
+ continue;
+ }
+
+ try {
+ // Verifies that this certificate was signed using the private key that corresponds to the specified public key.
+ candidateCert.verify(trustedCert.getPublicKey());
+ // check whether certificate is still valid (time)
+ candidateCert.checkValidity();
+ // certificate accepted
+ return;
+ }
+ catch (GeneralSecurityException e) {
+ // Security exception is thrown if a certificate is not valid.
+ }
+ }
+ }
+
+ // ask default truststore (e.g. cacerts) whether certificate is trusted. Depending on the authType, different managers are possible.
+ for (TrustManager trustManager : m_installedTrustManagers) {
+ if (trustManager instanceof X509TrustManager) {
+ try {
+ ((X509TrustManager) trustManager).checkServerTrusted(certs, authType);
+ }
+ catch (CertificateException e) {
+ LOG.error("certificate not trusted.", e);
+ throw e;
+ }
+ }
+ }
+ }
+
+ @Override
+ public X509Certificate[] getAcceptedIssuers() {
+ List<X509Certificate> trustedCertsAll = new ArrayList<X509Certificate>();
+ trustedCertsAll.addAll(Arrays.asList(m_trustedCerts));
+
+ // ask default truststore (e.g. cacerts) for trusted certificates. Depending on the authType, different managers are possible.
+ for (TrustManager trustManager : m_installedTrustManagers) {
+ if (trustManager instanceof X509TrustManager) {
+ X509Certificate[] certs = ((X509TrustManager) trustManager).getAcceptedIssuers();
+ if (certs != null && certs.length > 0) {
+ trustedCertsAll.addAll(Arrays.asList(certs));
+ }
+ }
+ }
+
+ return trustedCertsAll.toArray(new X509Certificate[trustedCertsAll.size()]);
+ }
+
+ private String printCertificates(X509Certificate[] certificates) {
+ StringWriter stringWriter = new StringWriter();
+ BufferedWriter writer = new BufferedWriter(stringWriter);
+
+ for (X509Certificate certificate : certificates) {
+ try {
+ writer.write(certificate.toString());
+ writer.newLine();
+ }
+ catch (IOException e) {
+ LOG.warn("Error while printing certificates.", e);
+ }
+ }
+
+ return stringWriter.getBuffer().toString();
+ }
+ }
+}
diff --git a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/security/consumer/BasicAuthenticationHandler.java b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/security/consumer/BasicAuthenticationHandler.java
index ff58850726..6635806580 100644
--- a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/security/consumer/BasicAuthenticationHandler.java
+++ b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/security/consumer/BasicAuthenticationHandler.java
@@ -1,123 +1,123 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.jaxws.security.consumer;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.xml.namespace.QName;
-import javax.xml.ws.WebServiceException;
-import javax.xml.ws.handler.MessageContext;
-import javax.xml.ws.handler.soap.SOAPMessageContext;
-
-import org.eclipse.scout.commons.Base64Utility;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.TypeCastUtility;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.jaxws.annotation.ScoutTransaction;
-import org.eclipse.scout.jaxws.service.AbstractWebServiceClient;
-
-/**
- * <p>
- * Handler to include user's credentials in webservice requests by using Basic Access Authentication. This requires
- * requests to provide a valid user name and password to access content. User's credentials are transported in HTTP
- * headers. Basic authentication also works across firewalls and proxy servers.
- * </p>
- * <p>
- * User's credentials are configured in config.ini by specifying the properties <code>#username</code> and
- * <code>#password</code> of the respective {@link AbstractWebServiceClient}.
- * </p>
- * <p>
- * However, the disadvantage of Basic authentication is that it transmits unencrypted base64-encoded passwords across
- * the network. Therefore, you only should use this authentication when you know that the connection between the client
- * and the server is secure. The connection should be established either over a dedicated line or by using Secure
- * Sockets Layer (SSL) encryption and Transport Layer Security (TLS).
- * </p>
- */
-@ScoutTransaction
-public class BasicAuthenticationHandler implements IAuthenticationHandler {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(BasicAuthenticationHandler.class);
-
- protected String m_username;
- protected String m_password;
-
- public BasicAuthenticationHandler() {
- }
-
- @Override
- public final boolean handleMessage(SOAPMessageContext context) {
- boolean outbound = TypeCastUtility.castValue(context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY), boolean.class);
- if (!outbound) {
- return true; // only outbound messages are of interest
- }
-
- if (m_username == null || m_password == null) {
- throw new WebServiceException("Invalid credentials configured.");
- }
-
- try {
- Map<String, List<String>> httpRequestHeaders = getHttpRequestHeaders(context);
- if (httpRequestHeaders == null) {
- httpRequestHeaders = new HashMap<String, List<String>>();
- }
- installAuthHeader(httpRequestHeaders);
- context.put(MessageContext.HTTP_REQUEST_HEADERS, httpRequestHeaders);
- return true;
- }
- catch (Exception e) {
- LOG.error("Failed to install Basic Authentication headers", e);
- return false;
- }
- }
-
- protected void installAuthHeader(Map<String, List<String>> httpRequestHeaders) throws Exception {
- String credentials = StringUtility.join(":", m_username, m_password);
- String credentialsEncoded = Base64Utility.encode(credentials.getBytes());
-
- List<String> basicAuthToken = new LinkedList<String>();
- basicAuthToken.add("Basic " + credentialsEncoded);
- httpRequestHeaders.put("Authorization", basicAuthToken);
- }
-
- @Override
- public Set<QName> getHeaders() {
- return new HashSet<QName>();
- }
-
- @Override
- public void close(MessageContext context) {
- }
-
- @Override
- public boolean handleFault(SOAPMessageContext context) {
- return false;
- }
-
- @SuppressWarnings("unchecked")
- private Map<String, List<String>> getHttpRequestHeaders(SOAPMessageContext context) {
- return (Map<String, List<String>>) context.get(MessageContext.HTTP_REQUEST_HEADERS);
- }
-
- @Override
- public void setPassword(String password) {
- m_password = password;
- }
-
- @Override
- public void setUsername(String username) {
- m_username = username;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.jaxws.security.consumer;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+import org.eclipse.scout.commons.Base64Utility;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.TypeCastUtility;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.jaxws.annotation.ScoutTransaction;
+import org.eclipse.scout.jaxws.service.AbstractWebServiceClient;
+
+/**
+ * <p>
+ * Handler to include user's credentials in webservice requests by using Basic Access Authentication. This requires
+ * requests to provide a valid user name and password to access content. User's credentials are transported in HTTP
+ * headers. Basic authentication also works across firewalls and proxy servers.
+ * </p>
+ * <p>
+ * User's credentials are configured in config.ini by specifying the properties <code>#username</code> and
+ * <code>#password</code> of the respective {@link AbstractWebServiceClient}.
+ * </p>
+ * <p>
+ * However, the disadvantage of Basic authentication is that it transmits unencrypted base64-encoded passwords across
+ * the network. Therefore, you only should use this authentication when you know that the connection between the client
+ * and the server is secure. The connection should be established either over a dedicated line or by using Secure
+ * Sockets Layer (SSL) encryption and Transport Layer Security (TLS).
+ * </p>
+ */
+@ScoutTransaction
+public class BasicAuthenticationHandler implements IAuthenticationHandler {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(BasicAuthenticationHandler.class);
+
+ protected String m_username;
+ protected String m_password;
+
+ public BasicAuthenticationHandler() {
+ }
+
+ @Override
+ public final boolean handleMessage(SOAPMessageContext context) {
+ boolean outbound = TypeCastUtility.castValue(context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY), boolean.class);
+ if (!outbound) {
+ return true; // only outbound messages are of interest
+ }
+
+ if (m_username == null || m_password == null) {
+ throw new WebServiceException("Invalid credentials configured.");
+ }
+
+ try {
+ Map<String, List<String>> httpRequestHeaders = getHttpRequestHeaders(context);
+ if (httpRequestHeaders == null) {
+ httpRequestHeaders = new HashMap<String, List<String>>();
+ }
+ installAuthHeader(httpRequestHeaders);
+ context.put(MessageContext.HTTP_REQUEST_HEADERS, httpRequestHeaders);
+ return true;
+ }
+ catch (Exception e) {
+ LOG.error("Failed to install Basic Authentication headers", e);
+ return false;
+ }
+ }
+
+ protected void installAuthHeader(Map<String, List<String>> httpRequestHeaders) throws Exception {
+ String credentials = StringUtility.join(":", m_username, m_password);
+ String credentialsEncoded = Base64Utility.encode(credentials.getBytes());
+
+ List<String> basicAuthToken = new LinkedList<String>();
+ basicAuthToken.add("Basic " + credentialsEncoded);
+ httpRequestHeaders.put("Authorization", basicAuthToken);
+ }
+
+ @Override
+ public Set<QName> getHeaders() {
+ return new HashSet<QName>();
+ }
+
+ @Override
+ public void close(MessageContext context) {
+ }
+
+ @Override
+ public boolean handleFault(SOAPMessageContext context) {
+ return false;
+ }
+
+ @SuppressWarnings("unchecked")
+ private Map<String, List<String>> getHttpRequestHeaders(SOAPMessageContext context) {
+ return (Map<String, List<String>>) context.get(MessageContext.HTTP_REQUEST_HEADERS);
+ }
+
+ @Override
+ public void setPassword(String password) {
+ m_password = password;
+ }
+
+ @Override
+ public void setUsername(String username) {
+ m_username = username;
+ }
+}
diff --git a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/security/consumer/IAuthenticationHandler.java b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/security/consumer/IAuthenticationHandler.java
index cad10db84f..b74ab97709 100644
--- a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/security/consumer/IAuthenticationHandler.java
+++ b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/security/consumer/IAuthenticationHandler.java
@@ -1,67 +1,67 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.jaxws.security.consumer;
-
-import java.util.Set;
-
-import javax.xml.namespace.QName;
-import javax.xml.ws.handler.MessageContext;
-import javax.xml.ws.handler.soap.SOAPHandler;
-import javax.xml.ws.handler.soap.SOAPMessageContext;
-
-import org.eclipse.scout.jaxws.annotation.ScoutWebServiceClient;
-
-/**
- * Handler that represents an authentication strategy to include user's credentials in a webservice request.
- */
-public interface IAuthenticationHandler extends SOAPHandler<SOAPMessageContext> {
-
- void setUsername(String username);
-
- void setPassword(String password);
-
- /**
- * Used in {@link ScoutWebServiceClient#authenticationHandler()} to
- * signal that authentication handler is not used.
- */
- static final class NONE implements IAuthenticationHandler {
-
- @Override
- public void setPassword(String password) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void setUsername(String username) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public Set<QName> getHeaders() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void close(MessageContext context) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public boolean handleFault(SOAPMessageContext context) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public boolean handleMessage(SOAPMessageContext context) {
- throw new UnsupportedOperationException();
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.jaxws.security.consumer;
+
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPHandler;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+import org.eclipse.scout.jaxws.annotation.ScoutWebServiceClient;
+
+/**
+ * Handler that represents an authentication strategy to include user's credentials in a webservice request.
+ */
+public interface IAuthenticationHandler extends SOAPHandler<SOAPMessageContext> {
+
+ void setUsername(String username);
+
+ void setPassword(String password);
+
+ /**
+ * Used in {@link ScoutWebServiceClient#authenticationHandler()} to
+ * signal that authentication handler is not used.
+ */
+ static final class NONE implements IAuthenticationHandler {
+
+ @Override
+ public void setPassword(String password) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void setUsername(String username) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Set<QName> getHeaders() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void close(MessageContext context) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public boolean handleFault(SOAPMessageContext context) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public boolean handleMessage(SOAPMessageContext context) {
+ throw new UnsupportedOperationException();
+ }
+ }
+}
diff --git a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/security/consumer/WsseUsernameTokenAuthenticationHandler.java b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/security/consumer/WsseUsernameTokenAuthenticationHandler.java
index c7d10b7b50..7da561fb5f 100644
--- a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/security/consumer/WsseUsernameTokenAuthenticationHandler.java
+++ b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/security/consumer/WsseUsernameTokenAuthenticationHandler.java
@@ -1,125 +1,125 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.jaxws.security.consumer;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.xml.namespace.QName;
-import javax.xml.soap.SOAPElement;
-import javax.xml.soap.SOAPEnvelope;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPHeader;
-import javax.xml.ws.WebServiceException;
-import javax.xml.ws.handler.MessageContext;
-import javax.xml.ws.handler.soap.SOAPMessageContext;
-
-import org.eclipse.scout.commons.TypeCastUtility;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.jaxws.annotation.ScoutTransaction;
-import org.eclipse.scout.jaxws.service.AbstractWebServiceClient;
-
-/**
- * <p>
- * Handler to include user's credentials in webservice requests by using Message Level WS-Security with UsernameToken
- * Authentication. This requires requests to provide a valid user name and password to access content. User's
- * credentials are included in SOAP message headers which also works across firewalls and proxy servers.
- * </p>
- * <p>
- * User's credentials are configured in config.ini by specifying the properties <code>#username</code> and
- * <code>#password</code> of the respective {@link AbstractWebServiceClient}.
- * </p>
- * <p>
- * However, the disadvantage of WSSE UsernameToken Authentication is that it transmits unencrypted passwords across the
- * network. Therefore, you only should use this authentication when you know that the connection between the client and
- * the server is secure. The connection should be established either over a dedicated line or by using Secure Sockets
- * Layer (SSL) encryption and Transport Layer Security (TLS).
- * </p>
- */
-@ScoutTransaction
-public class WsseUsernameTokenAuthenticationHandler implements IAuthenticationHandler {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(WsseUsernameTokenAuthenticationHandler.class);
-
- private static final String WSSE = "wsse";
- private static final String WS_SEC = "Security";
- private static final String USERNAME_TOKEN = "UsernameToken";
- private static final String USERNAME = "Username";
- private static final String PASSWORD = "Password";
- private static final String NAME_SPACE_URI = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd";
-
- protected String m_username;
- protected String m_password;
-
- public WsseUsernameTokenAuthenticationHandler() {
- }
-
- @Override
- public final boolean handleMessage(SOAPMessageContext context) {
- boolean outbound = TypeCastUtility.castValue(context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY), boolean.class);
- if (!outbound) {
- return true; // only outbound messages are of interest
- }
-
- if (m_username == null || m_password == null) {
- throw new WebServiceException("Invalid credentials configured.");
- }
-
- try {
- SOAPEnvelope envelope = context.getMessage().getSOAPPart().getEnvelope();
-
- SOAPHeader header = envelope.getHeader();
- if (header == null) {
- header = envelope.addHeader();
- }
- installAuthHeader(header);
- return true;
- }
- catch (SOAPException e) {
- LOG.error("Unable to add wss security token", e);
- return false;
- }
- }
-
- protected void installAuthHeader(SOAPHeader header) throws SOAPException {
- SOAPElement security = header.addChildElement(WS_SEC, WSSE, NAME_SPACE_URI);
- SOAPElement userToken = security.addChildElement(USERNAME_TOKEN, WSSE);
-
- userToken.addChildElement(USERNAME, WSSE).addTextNode(m_username);
- userToken.addChildElement(PASSWORD, WSSE).addTextNode(m_password);
- }
-
- @Override
- public Set<QName> getHeaders() {
- Set<QName> headers = new HashSet<QName>();
- headers.add(new QName(NAME_SPACE_URI, WS_SEC));
- return headers;
- }
-
- @Override
- public void close(MessageContext context) {
- }
-
- @Override
- public boolean handleFault(SOAPMessageContext context) {
- return false;
- }
-
- @Override
- public void setPassword(String password) {
- m_password = password;
- }
-
- @Override
- public void setUsername(String username) {
- m_username = username;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.jaxws.security.consumer;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPHeader;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+import org.eclipse.scout.commons.TypeCastUtility;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.jaxws.annotation.ScoutTransaction;
+import org.eclipse.scout.jaxws.service.AbstractWebServiceClient;
+
+/**
+ * <p>
+ * Handler to include user's credentials in webservice requests by using Message Level WS-Security with UsernameToken
+ * Authentication. This requires requests to provide a valid user name and password to access content. User's
+ * credentials are included in SOAP message headers which also works across firewalls and proxy servers.
+ * </p>
+ * <p>
+ * User's credentials are configured in config.ini by specifying the properties <code>#username</code> and
+ * <code>#password</code> of the respective {@link AbstractWebServiceClient}.
+ * </p>
+ * <p>
+ * However, the disadvantage of WSSE UsernameToken Authentication is that it transmits unencrypted passwords across the
+ * network. Therefore, you only should use this authentication when you know that the connection between the client and
+ * the server is secure. The connection should be established either over a dedicated line or by using Secure Sockets
+ * Layer (SSL) encryption and Transport Layer Security (TLS).
+ * </p>
+ */
+@ScoutTransaction
+public class WsseUsernameTokenAuthenticationHandler implements IAuthenticationHandler {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(WsseUsernameTokenAuthenticationHandler.class);
+
+ private static final String WSSE = "wsse";
+ private static final String WS_SEC = "Security";
+ private static final String USERNAME_TOKEN = "UsernameToken";
+ private static final String USERNAME = "Username";
+ private static final String PASSWORD = "Password";
+ private static final String NAME_SPACE_URI = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd";
+
+ protected String m_username;
+ protected String m_password;
+
+ public WsseUsernameTokenAuthenticationHandler() {
+ }
+
+ @Override
+ public final boolean handleMessage(SOAPMessageContext context) {
+ boolean outbound = TypeCastUtility.castValue(context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY), boolean.class);
+ if (!outbound) {
+ return true; // only outbound messages are of interest
+ }
+
+ if (m_username == null || m_password == null) {
+ throw new WebServiceException("Invalid credentials configured.");
+ }
+
+ try {
+ SOAPEnvelope envelope = context.getMessage().getSOAPPart().getEnvelope();
+
+ SOAPHeader header = envelope.getHeader();
+ if (header == null) {
+ header = envelope.addHeader();
+ }
+ installAuthHeader(header);
+ return true;
+ }
+ catch (SOAPException e) {
+ LOG.error("Unable to add wss security token", e);
+ return false;
+ }
+ }
+
+ protected void installAuthHeader(SOAPHeader header) throws SOAPException {
+ SOAPElement security = header.addChildElement(WS_SEC, WSSE, NAME_SPACE_URI);
+ SOAPElement userToken = security.addChildElement(USERNAME_TOKEN, WSSE);
+
+ userToken.addChildElement(USERNAME, WSSE).addTextNode(m_username);
+ userToken.addChildElement(PASSWORD, WSSE).addTextNode(m_password);
+ }
+
+ @Override
+ public Set<QName> getHeaders() {
+ Set<QName> headers = new HashSet<QName>();
+ headers.add(new QName(NAME_SPACE_URI, WS_SEC));
+ return headers;
+ }
+
+ @Override
+ public void close(MessageContext context) {
+ }
+
+ @Override
+ public boolean handleFault(SOAPMessageContext context) {
+ return false;
+ }
+
+ @Override
+ public void setPassword(String password) {
+ m_password = password;
+ }
+
+ @Override
+ public void setUsername(String username) {
+ m_username = username;
+ }
+}
diff --git a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/security/provider/BasicAuthenticationHandler.java b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/security/provider/BasicAuthenticationHandler.java
index ea337ef88a..46a05a3eec 100644
--- a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/security/provider/BasicAuthenticationHandler.java
+++ b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/security/provider/BasicAuthenticationHandler.java
@@ -1,205 +1,205 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.jaxws.security.provider;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.servlet.http.HttpServletResponse;
-import javax.xml.namespace.QName;
-import javax.xml.ws.WebServiceException;
-import javax.xml.ws.handler.MessageContext;
-import javax.xml.ws.handler.soap.SOAPMessageContext;
-
-import org.eclipse.scout.commons.Base64Utility;
-import org.eclipse.scout.commons.BooleanUtility;
-import org.eclipse.scout.commons.TypeCastUtility;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.jaxws.annotation.ScoutTransaction;
-import org.eclipse.scout.jaxws.internal.ContextHelper;
-import org.eclipse.scout.jaxws.internal.SessionHelper;
-import org.eclipse.scout.jaxws.security.Authenticator;
-import org.eclipse.scout.jaxws.session.IServerSessionFactory;
-import org.eclipse.scout.rt.server.IServerSession;
-import org.eclipse.scout.service.ServiceUtility;
-
-import com.sun.xml.internal.ws.client.BindingProviderProperties;
-
-/**
- * <p>
- * Handler to protect your webservice with Basic Access Authentication. This requires requests to provide a valid user
- * name and password to access content. User's credentials are transported in HTTP headers. Basic authentication also
- * works across firewalls and proxy servers.
- * </p>
- * <p>
- * However, the disadvantage of Basic authentication is that it transmits unencrypted base64-encoded passwords across
- * the network. Therefore, you only should use this authentication when you know that the connection between the client
- * and the server is secure. The connection should be established either over a dedicated line or by using Secure
- * Sockets Layer (SSL) encryption and Transport Layer Security (TLS).
- * </p>
- */
-@ScoutTransaction
-public class BasicAuthenticationHandler implements IAuthenticationHandler {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(BasicAuthenticationHandler.class);
-
- private ICredentialValidationStrategy m_credentialValidationStrategy;
-
- public BasicAuthenticationHandler() {
- ServiceUtility.injectConfigProperties(this);
- }
-
- @Override
- public final boolean handleMessage(SOAPMessageContext context) {
- boolean outbound = TypeCastUtility.castValue(context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY), boolean.class);
- if (outbound) {
- return true; // only inbound messages are of interest
- }
-
- if (Authenticator.isSubjectAuthenticated()) {
- return true;
- }
-
- String[] authorizationHeader = getAuthorizationHeader(context);
- if (authorizationHeader.length == 0) {
- // force consumer to include authentication information
- installAuthHeader(context);
- return breakHandlerChain(context);
- }
-
- for (String headerValue : authorizationHeader) {
- if (headerValue.startsWith("Basic ")) {
- try {
- if (authenticateRequest(headerValue)) {
- // create and cache a new server session on behalf of the authenticated user by using the session factory configured on the port type.
- // In turn, this session is used by subsequent handlers and the port type resolver.
- IServerSessionFactory portTypeSessionFactory = ContextHelper.getPortTypeSessionFactory(context);
- IServerSession serverSession = SessionHelper.createNewServerSession(portTypeSessionFactory);
- if (serverSession != null) {
- // cache session to be used by subsequent handlers and port type resolver
- ContextHelper.setContextSession(context, portTypeSessionFactory, serverSession);
- }
- return true;
- }
- return breakHandlerChain(context);
- }
- catch (Exception e) {
- return breakHandlerChainWithException(context, e);
- }
- }
- }
- return breakHandlerChain(context);
- }
-
- @Override
- public void injectCredentialValidationStrategy(ICredentialValidationStrategy strategy) {
- m_credentialValidationStrategy = strategy;
- }
-
- @Override
- public final Set<QName> getHeaders() {
- return new HashSet<QName>();
- }
-
- @Override
- public final void close(MessageContext context) {
- }
-
- @Override
- public final boolean handleFault(SOAPMessageContext context) {
- return false;
- }
-
- protected boolean authenticateRequest(String authHeader) throws Exception {
- String[] credentials = new String(Base64Utility.decode(authHeader.substring("Basic ".length())), "ISO-8859-1").split(":", 2);
- String username = credentials[0];
- String passwordPlainText = credentials[1];
-
- return Authenticator.authenticateRequest(m_credentialValidationStrategy, username, passwordPlainText);
- }
-
- protected void installAuthHeader(SOAPMessageContext context) {
- Map<String, List<String>> httpResponseHeaders = getHttpResponseHeaders(context);
- if (httpResponseHeaders == null) {
- httpResponseHeaders = new HashMap<String, List<String>>();
- }
-
- List<String> basicAuthToken = new LinkedList<String>();
- basicAuthToken.add("Basic realm=\"" + getRealm() + "\"");
- httpResponseHeaders.put("WWW-Authenticate", basicAuthToken);
-
- context.put(MessageContext.HTTP_RESPONSE_CODE, HttpServletResponse.SC_UNAUTHORIZED);
- context.put(MessageContext.HTTP_RESPONSE_HEADERS, httpResponseHeaders);
- }
-
- @SuppressWarnings("unchecked")
- protected Map<String, List<String>> getHttpRequestHeaders(SOAPMessageContext context) {
- return (Map<String, List<String>>) context.get(MessageContext.HTTP_REQUEST_HEADERS);
- }
-
- @SuppressWarnings("unchecked")
- protected Map<String, List<String>> getHttpResponseHeaders(SOAPMessageContext context) {
- return (Map<String, List<String>>) context.get(MessageContext.HTTP_RESPONSE_HEADERS);
- }
-
- protected boolean breakHandlerChain(SOAPMessageContext context) {
- context.put(MessageContext.HTTP_RESPONSE_CODE, HttpServletResponse.SC_UNAUTHORIZED);
-
- boolean oneway = BooleanUtility.nvl((Boolean) context.get(BindingProviderProperties.ONE_WAY_OPERATION), false);
- if (oneway) {
- // do not just return false as in one-way communication, the chain is continued regardless of the status.
- throw new WebServiceException("Unauthorized");
- }
- return false;
- }
-
- protected boolean breakHandlerChainWithException(SOAPMessageContext context, Exception exception) {
- context.put(MessageContext.HTTP_RESPONSE_CODE, HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
- LOG.error("Internal server error (Basic Access Authentication)", exception);
-
- if (exception instanceof WebServiceException) {
- throw (WebServiceException) exception;
- }
- throw new WebServiceException("Internal server error");
- }
-
- protected String getRealm() {
- return "Secure Area";
- }
-
- protected String[] getAuthorizationHeader(SOAPMessageContext context) {
- Map<String, List<String>> httpRequestHeaderMap = getHttpRequestHeaders(context);
- if (httpRequestHeaderMap == null || httpRequestHeaderMap.size() == 0) {
- return new String[0];
- }
-
- // According to RFC 2616 header names are case-insensitive
- for (String headerName : httpRequestHeaderMap.keySet()) {
- if ("authorization".equalsIgnoreCase(headerName)) {
- List<String> headerValues = httpRequestHeaderMap.get(headerName);
- if (headerValues != null) {
- return headerValues.toArray(new String[headerValues.size()]);
- }
- return new String[0];
- }
- }
- return new String[0];
- }
-
- @Override
- public String getName() {
- return "BASIC";
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.jaxws.security.provider;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.namespace.QName;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+import org.eclipse.scout.commons.Base64Utility;
+import org.eclipse.scout.commons.BooleanUtility;
+import org.eclipse.scout.commons.TypeCastUtility;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.jaxws.annotation.ScoutTransaction;
+import org.eclipse.scout.jaxws.internal.ContextHelper;
+import org.eclipse.scout.jaxws.internal.SessionHelper;
+import org.eclipse.scout.jaxws.security.Authenticator;
+import org.eclipse.scout.jaxws.session.IServerSessionFactory;
+import org.eclipse.scout.rt.server.IServerSession;
+import org.eclipse.scout.service.ServiceUtility;
+
+import com.sun.xml.internal.ws.client.BindingProviderProperties;
+
+/**
+ * <p>
+ * Handler to protect your webservice with Basic Access Authentication. This requires requests to provide a valid user
+ * name and password to access content. User's credentials are transported in HTTP headers. Basic authentication also
+ * works across firewalls and proxy servers.
+ * </p>
+ * <p>
+ * However, the disadvantage of Basic authentication is that it transmits unencrypted base64-encoded passwords across
+ * the network. Therefore, you only should use this authentication when you know that the connection between the client
+ * and the server is secure. The connection should be established either over a dedicated line or by using Secure
+ * Sockets Layer (SSL) encryption and Transport Layer Security (TLS).
+ * </p>
+ */
+@ScoutTransaction
+public class BasicAuthenticationHandler implements IAuthenticationHandler {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(BasicAuthenticationHandler.class);
+
+ private ICredentialValidationStrategy m_credentialValidationStrategy;
+
+ public BasicAuthenticationHandler() {
+ ServiceUtility.injectConfigProperties(this);
+ }
+
+ @Override
+ public final boolean handleMessage(SOAPMessageContext context) {
+ boolean outbound = TypeCastUtility.castValue(context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY), boolean.class);
+ if (outbound) {
+ return true; // only inbound messages are of interest
+ }
+
+ if (Authenticator.isSubjectAuthenticated()) {
+ return true;
+ }
+
+ String[] authorizationHeader = getAuthorizationHeader(context);
+ if (authorizationHeader.length == 0) {
+ // force consumer to include authentication information
+ installAuthHeader(context);
+ return breakHandlerChain(context);
+ }
+
+ for (String headerValue : authorizationHeader) {
+ if (headerValue.startsWith("Basic ")) {
+ try {
+ if (authenticateRequest(headerValue)) {
+ // create and cache a new server session on behalf of the authenticated user by using the session factory configured on the port type.
+ // In turn, this session is used by subsequent handlers and the port type resolver.
+ IServerSessionFactory portTypeSessionFactory = ContextHelper.getPortTypeSessionFactory(context);
+ IServerSession serverSession = SessionHelper.createNewServerSession(portTypeSessionFactory);
+ if (serverSession != null) {
+ // cache session to be used by subsequent handlers and port type resolver
+ ContextHelper.setContextSession(context, portTypeSessionFactory, serverSession);
+ }
+ return true;
+ }
+ return breakHandlerChain(context);
+ }
+ catch (Exception e) {
+ return breakHandlerChainWithException(context, e);
+ }
+ }
+ }
+ return breakHandlerChain(context);
+ }
+
+ @Override
+ public void injectCredentialValidationStrategy(ICredentialValidationStrategy strategy) {
+ m_credentialValidationStrategy = strategy;
+ }
+
+ @Override
+ public final Set<QName> getHeaders() {
+ return new HashSet<QName>();
+ }
+
+ @Override
+ public final void close(MessageContext context) {
+ }
+
+ @Override
+ public final boolean handleFault(SOAPMessageContext context) {
+ return false;
+ }
+
+ protected boolean authenticateRequest(String authHeader) throws Exception {
+ String[] credentials = new String(Base64Utility.decode(authHeader.substring("Basic ".length())), "ISO-8859-1").split(":", 2);
+ String username = credentials[0];
+ String passwordPlainText = credentials[1];
+
+ return Authenticator.authenticateRequest(m_credentialValidationStrategy, username, passwordPlainText);
+ }
+
+ protected void installAuthHeader(SOAPMessageContext context) {
+ Map<String, List<String>> httpResponseHeaders = getHttpResponseHeaders(context);
+ if (httpResponseHeaders == null) {
+ httpResponseHeaders = new HashMap<String, List<String>>();
+ }
+
+ List<String> basicAuthToken = new LinkedList<String>();
+ basicAuthToken.add("Basic realm=\"" + getRealm() + "\"");
+ httpResponseHeaders.put("WWW-Authenticate", basicAuthToken);
+
+ context.put(MessageContext.HTTP_RESPONSE_CODE, HttpServletResponse.SC_UNAUTHORIZED);
+ context.put(MessageContext.HTTP_RESPONSE_HEADERS, httpResponseHeaders);
+ }
+
+ @SuppressWarnings("unchecked")
+ protected Map<String, List<String>> getHttpRequestHeaders(SOAPMessageContext context) {
+ return (Map<String, List<String>>) context.get(MessageContext.HTTP_REQUEST_HEADERS);
+ }
+
+ @SuppressWarnings("unchecked")
+ protected Map<String, List<String>> getHttpResponseHeaders(SOAPMessageContext context) {
+ return (Map<String, List<String>>) context.get(MessageContext.HTTP_RESPONSE_HEADERS);
+ }
+
+ protected boolean breakHandlerChain(SOAPMessageContext context) {
+ context.put(MessageContext.HTTP_RESPONSE_CODE, HttpServletResponse.SC_UNAUTHORIZED);
+
+ boolean oneway = BooleanUtility.nvl((Boolean) context.get(BindingProviderProperties.ONE_WAY_OPERATION), false);
+ if (oneway) {
+ // do not just return false as in one-way communication, the chain is continued regardless of the status.
+ throw new WebServiceException("Unauthorized");
+ }
+ return false;
+ }
+
+ protected boolean breakHandlerChainWithException(SOAPMessageContext context, Exception exception) {
+ context.put(MessageContext.HTTP_RESPONSE_CODE, HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ LOG.error("Internal server error (Basic Access Authentication)", exception);
+
+ if (exception instanceof WebServiceException) {
+ throw (WebServiceException) exception;
+ }
+ throw new WebServiceException("Internal server error");
+ }
+
+ protected String getRealm() {
+ return "Secure Area";
+ }
+
+ protected String[] getAuthorizationHeader(SOAPMessageContext context) {
+ Map<String, List<String>> httpRequestHeaderMap = getHttpRequestHeaders(context);
+ if (httpRequestHeaderMap == null || httpRequestHeaderMap.size() == 0) {
+ return new String[0];
+ }
+
+ // According to RFC 2616 header names are case-insensitive
+ for (String headerName : httpRequestHeaderMap.keySet()) {
+ if ("authorization".equalsIgnoreCase(headerName)) {
+ List<String> headerValues = httpRequestHeaderMap.get(headerName);
+ if (headerValues != null) {
+ return headerValues.toArray(new String[headerValues.size()]);
+ }
+ return new String[0];
+ }
+ }
+ return new String[0];
+ }
+
+ @Override
+ public String getName() {
+ return "BASIC";
+ }
+}
diff --git a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/security/provider/ConfigIniCredentialValidationStrategy.java b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/security/provider/ConfigIniCredentialValidationStrategy.java
index 18adbd92f6..243130d1d6 100644
--- a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/security/provider/ConfigIniCredentialValidationStrategy.java
+++ b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/security/provider/ConfigIniCredentialValidationStrategy.java
@@ -1,99 +1,99 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.jaxws.security.provider;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.service.ServiceUtility;
-
-/**
- * <p>
- * Strategy to validate a user's credential against configured users in config.ini file.
- * </p>
- * <p>
- * Valid users are to be configured with the property
- * <code>org.eclipse.scout.jaxws.security.provider.ConfigIniCredentialValidationStrategy#credentials</code> in
- * config.ini.
- * </p>
- * <p>
- * Multiple credentials are separated by a semicolon, username and password by the equals sign.<br/>
- * e.g.
- * <code>org.eclipse.scout.jaxws.security.provider.ConfigIniCredentialValidationStrategy#credentials=sean\=XXXX;jack\=XXXX;kimberley\=XXXX</code>
- * </p>
- */
-public class ConfigIniCredentialValidationStrategy implements ICredentialValidationStrategy {
-
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(ConfigIniCredentialValidationStrategy.class);
-
- private String m_credentials;
- private Map<String, String> m_credentialsMap;
-
- public ConfigIniCredentialValidationStrategy() {
- m_credentialsMap = new HashMap<String, String>();
- ServiceUtility.injectConfigProperties(this);
- init();
- }
-
- @Override
- public boolean isValidUser(String username, String passwordPlainText) throws Exception {
- if (!StringUtility.hasText(username) || !StringUtility.hasText(passwordPlainText)) {
- return false;
- }
-
- if (m_credentialsMap.containsKey(username.toLowerCase())) {
- return CompareUtility.equals(m_credentialsMap.get(username.toLowerCase()), passwordPlainText);
- }
- return false;
- }
-
- protected void init() {
- if (!StringUtility.hasText(m_credentials) || m_credentials.split(";").length == 0) {
- LOG.info("No user's credentials configured. " + getExampleConfig());
- return;
- }
-
- String[] credentialList = m_credentials.split(";");
-
- for (String credentials : credentialList) {
- String[] userpass = credentials.split("=", 2);
- if (userpass.length == 2) {
- String username = userpass[0];
- if (!StringUtility.hasText(username)) {
- LOG.warn("Configured username must not be empty. " + getExampleConfig());
- continue;
- }
-
- String password = userpass[1];
- if (!StringUtility.hasText(password)) {
- LOG.warn("Configured password must not be empty. " + getExampleConfig());
- continue;
- }
- m_credentialsMap.put(username.toLowerCase(), password);
- }
- else {
- LOG.warn("username and password must be separated by the equals sign. " + getExampleConfig());
- }
- }
- }
-
- public void setCredentials(String credentials) {
- m_credentials = credentials;
- }
-
- private String getExampleConfig() {
- return "Please see the exmaple config: " + ConfigIniCredentialValidationStrategy.class.getName() + "#credentials=sean\\=XXXX;jack\\=XXXX;kimberley\\=XXXX";
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.jaxws.security.provider;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.service.ServiceUtility;
+
+/**
+ * <p>
+ * Strategy to validate a user's credential against configured users in config.ini file.
+ * </p>
+ * <p>
+ * Valid users are to be configured with the property
+ * <code>org.eclipse.scout.jaxws.security.provider.ConfigIniCredentialValidationStrategy#credentials</code> in
+ * config.ini.
+ * </p>
+ * <p>
+ * Multiple credentials are separated by a semicolon, username and password by the equals sign.<br/>
+ * e.g.
+ * <code>org.eclipse.scout.jaxws.security.provider.ConfigIniCredentialValidationStrategy#credentials=sean\=XXXX;jack\=XXXX;kimberley\=XXXX</code>
+ * </p>
+ */
+public class ConfigIniCredentialValidationStrategy implements ICredentialValidationStrategy {
+
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(ConfigIniCredentialValidationStrategy.class);
+
+ private String m_credentials;
+ private Map<String, String> m_credentialsMap;
+
+ public ConfigIniCredentialValidationStrategy() {
+ m_credentialsMap = new HashMap<String, String>();
+ ServiceUtility.injectConfigProperties(this);
+ init();
+ }
+
+ @Override
+ public boolean isValidUser(String username, String passwordPlainText) throws Exception {
+ if (!StringUtility.hasText(username) || !StringUtility.hasText(passwordPlainText)) {
+ return false;
+ }
+
+ if (m_credentialsMap.containsKey(username.toLowerCase())) {
+ return CompareUtility.equals(m_credentialsMap.get(username.toLowerCase()), passwordPlainText);
+ }
+ return false;
+ }
+
+ protected void init() {
+ if (!StringUtility.hasText(m_credentials) || m_credentials.split(";").length == 0) {
+ LOG.info("No user's credentials configured. " + getExampleConfig());
+ return;
+ }
+
+ String[] credentialList = m_credentials.split(";");
+
+ for (String credentials : credentialList) {
+ String[] userpass = credentials.split("=", 2);
+ if (userpass.length == 2) {
+ String username = userpass[0];
+ if (!StringUtility.hasText(username)) {
+ LOG.warn("Configured username must not be empty. " + getExampleConfig());
+ continue;
+ }
+
+ String password = userpass[1];
+ if (!StringUtility.hasText(password)) {
+ LOG.warn("Configured password must not be empty. " + getExampleConfig());
+ continue;
+ }
+ m_credentialsMap.put(username.toLowerCase(), password);
+ }
+ else {
+ LOG.warn("username and password must be separated by the equals sign. " + getExampleConfig());
+ }
+ }
+ }
+
+ public void setCredentials(String credentials) {
+ m_credentials = credentials;
+ }
+
+ private String getExampleConfig() {
+ return "Please see the exmaple config: " + ConfigIniCredentialValidationStrategy.class.getName() + "#credentials=sean\\=XXXX;jack\\=XXXX;kimberley\\=XXXX";
+ }
+}
diff --git a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/security/provider/IAuthenticationHandler.java b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/security/provider/IAuthenticationHandler.java
index b4115b5348..aa2ae7d4b1 100644
--- a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/security/provider/IAuthenticationHandler.java
+++ b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/security/provider/IAuthenticationHandler.java
@@ -1,78 +1,78 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.jaxws.security.provider;
-
-import java.util.Set;
-
-import javax.xml.namespace.QName;
-import javax.xml.ws.handler.MessageContext;
-import javax.xml.ws.handler.soap.SOAPHandler;
-import javax.xml.ws.handler.soap.SOAPMessageContext;
-
-import org.eclipse.scout.jaxws.annotation.ScoutWebService;
-
-/**
- * Handler that represents an authentication strategy to protect your webservice provider.
- */
-public interface IAuthenticationHandler extends SOAPHandler<SOAPMessageContext> {
-
- /**
- * To inject a {@link ICredentialValidationStrategy} to authenticate user's credentials included in the webservice
- * request.
- *
- * @param strategy
- * the strategy to be injected
- */
- void injectCredentialValidationStrategy(ICredentialValidationStrategy strategy);
-
- /**
- * @return
- * The name of this authentication method
- */
- String getName();
-
- /**
- * Used in {@link ScoutWebService#authenticationHandler()} to
- * signal that authentication handler is not used.
- */
- static final class NONE implements IAuthenticationHandler {
-
- @Override
- public void injectCredentialValidationStrategy(ICredentialValidationStrategy strategy) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public Set<QName> getHeaders() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void close(MessageContext context) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public boolean handleFault(SOAPMessageContext context) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public boolean handleMessage(SOAPMessageContext context) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public String getName() {
- return null;
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.jaxws.security.provider;
+
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPHandler;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+import org.eclipse.scout.jaxws.annotation.ScoutWebService;
+
+/**
+ * Handler that represents an authentication strategy to protect your webservice provider.
+ */
+public interface IAuthenticationHandler extends SOAPHandler<SOAPMessageContext> {
+
+ /**
+ * To inject a {@link ICredentialValidationStrategy} to authenticate user's credentials included in the webservice
+ * request.
+ *
+ * @param strategy
+ * the strategy to be injected
+ */
+ void injectCredentialValidationStrategy(ICredentialValidationStrategy strategy);
+
+ /**
+ * @return
+ * The name of this authentication method
+ */
+ String getName();
+
+ /**
+ * Used in {@link ScoutWebService#authenticationHandler()} to
+ * signal that authentication handler is not used.
+ */
+ static final class NONE implements IAuthenticationHandler {
+
+ @Override
+ public void injectCredentialValidationStrategy(ICredentialValidationStrategy strategy) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Set<QName> getHeaders() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void close(MessageContext context) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public boolean handleFault(SOAPMessageContext context) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public boolean handleMessage(SOAPMessageContext context) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public String getName() {
+ return null;
+ }
+ }
+}
diff --git a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/security/provider/ICredentialValidationStrategy.java b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/security/provider/ICredentialValidationStrategy.java
index 1ab92cd9cc..ff549014f5 100644
--- a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/security/provider/ICredentialValidationStrategy.java
+++ b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/security/provider/ICredentialValidationStrategy.java
@@ -1,30 +1,30 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.jaxws.security.provider;
-
-/**
- * Encapsulates logic to validate user's credentials against a strategy such as database, config.ini, LDAP or others.
- */
-public interface ICredentialValidationStrategy {
-
- /**
- * Validates user's credentials
- *
- * @param username
- * the username to be validated
- * @param passwordPlainText
- * the password to be validated
- * @return true if user's credentials are valid or false otherwise
- * @throws Exception
- * throw exception if user's credentials cannot be validated.
- */
- boolean isValidUser(String username, String passwordPlainText) throws Exception;
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.jaxws.security.provider;
+
+/**
+ * Encapsulates logic to validate user's credentials against a strategy such as database, config.ini, LDAP or others.
+ */
+public interface ICredentialValidationStrategy {
+
+ /**
+ * Validates user's credentials
+ *
+ * @param username
+ * the username to be validated
+ * @param passwordPlainText
+ * the password to be validated
+ * @return true if user's credentials are valid or false otherwise
+ * @throws Exception
+ * throw exception if user's credentials cannot be validated.
+ */
+ boolean isValidUser(String username, String passwordPlainText) throws Exception;
+}
diff --git a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/security/provider/WsseUsernameTokenAuthenticationHandler.java b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/security/provider/WsseUsernameTokenAuthenticationHandler.java
index 3d5c688885..489325da77 100644
--- a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/security/provider/WsseUsernameTokenAuthenticationHandler.java
+++ b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/security/provider/WsseUsernameTokenAuthenticationHandler.java
@@ -1,179 +1,179 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.jaxws.security.provider;
-
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import javax.servlet.http.HttpServletResponse;
-import javax.xml.namespace.QName;
-import javax.xml.soap.SOAPElement;
-import javax.xml.soap.SOAPHeader;
-import javax.xml.ws.WebServiceException;
-import javax.xml.ws.handler.MessageContext;
-import javax.xml.ws.handler.soap.SOAPMessageContext;
-
-import org.eclipse.scout.commons.BooleanUtility;
-import org.eclipse.scout.commons.TypeCastUtility;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.jaxws.annotation.ScoutTransaction;
-import org.eclipse.scout.jaxws.internal.ContextHelper;
-import org.eclipse.scout.jaxws.internal.SessionHelper;
-import org.eclipse.scout.jaxws.security.Authenticator;
-import org.eclipse.scout.jaxws.session.IServerSessionFactory;
-import org.eclipse.scout.rt.server.IServerSession;
-import org.eclipse.scout.service.ServiceUtility;
-
-import com.sun.xml.internal.ws.client.BindingProviderProperties;
-
-/**
- * <p>
- * Handler to protect your webservice with Message Level WS-Security with UsernameToken Authentication. This requires
- * requests to provide a valid user name and password to access content. User's credentials are included in SOAP message
- * headers.
- * </p>
- * <p>
- * However, the disadvantage of WSSE UsernameToken Authentication is that it transmits unencrypted passwords across the
- * network. Therefore, you only should use this authentication when you know that the connection between the client and
- * the server is secure. The connection should be established either over a dedicated line or by using Secure Sockets
- * Layer (SSL) encryption and Transport Layer Security (TLS).
- * </p>
- */
-@ScoutTransaction
-public class WsseUsernameTokenAuthenticationHandler implements IAuthenticationHandler {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(WsseUsernameTokenAuthenticationHandler.class);
-
- private static final String WSSE = "wsse";
- private static final String WS_SEC = "Security";
- private static final String USERNAME_TOKEN = "UsernameToken";
- private static final String USERNAME = "Username";
- private static final String PASSWORD = "Password";
- private static final String NAME_SPACE_URI = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd";
-
- private ICredentialValidationStrategy m_credentialValidationStrategy;
-
- public WsseUsernameTokenAuthenticationHandler() {
- ServiceUtility.injectConfigProperties(this);
- }
-
- @Override
- public final boolean handleMessage(SOAPMessageContext context) {
- boolean outbound = TypeCastUtility.castValue(context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY), boolean.class);
- if (outbound) {
- return true; // only inbound messages are of interest
- }
-
- if (Authenticator.isSubjectAuthenticated()) {
- return true;
- }
-
- try {
- SOAPHeader header = context.getMessage().getSOAPPart().getEnvelope().getHeader();
- if (header == null) {
- throw new WebServiceException("Authentication failed as no WSSE-Security header found.");
- }
- if (authenticateRequest(header)) {
- // create and cache a new server session on behalf of the authenticated user by using the session factory configured on the port type.
- // In turn, this session is used by subsequent handlers and the port type resolver.
- IServerSessionFactory portTypeSessionFactory = ContextHelper.getPortTypeSessionFactory(context);
- IServerSession serverSession = SessionHelper.createNewServerSession(portTypeSessionFactory);
- if (serverSession != null) {
- // cache session to be used by subsequent handlers and port type resolver
- ContextHelper.setContextSession(context, portTypeSessionFactory, serverSession);
- }
- return true;
- }
- return breakHandlerChain(context);
- }
- catch (Exception e) {
- return breakHandlerChainWithException(context, e);
- }
- }
-
- @Override
- public void injectCredentialValidationStrategy(ICredentialValidationStrategy strategy) {
- m_credentialValidationStrategy = strategy;
- }
-
- @Override
- public Set<QName> getHeaders() {
- Set<QName> headers = new HashSet<QName>();
- headers.add(new QName(NAME_SPACE_URI, WS_SEC));
- return headers;
- }
-
- @Override
- public void close(MessageContext context) {
- }
-
- @Override
- public boolean handleFault(SOAPMessageContext context) {
- return false;
- }
-
- protected boolean authenticateRequest(SOAPHeader header) throws Exception {
- Iterator iteratorSecurity = header.getChildElements(new QName(NAME_SPACE_URI, WS_SEC, WSSE));
- if (!iteratorSecurity.hasNext()) {
- throw new WebServiceException("Authentication failed as no WSSE-Security header found.");
- }
-
- while (iteratorSecurity.hasNext()) {
- SOAPElement security = (SOAPElement) iteratorSecurity.next();
- Iterator iteratorUserToken = security.getChildElements(new QName(NAME_SPACE_URI, USERNAME_TOKEN, WSSE));
- while (iteratorUserToken.hasNext()) {
- SOAPElement userTokenElement = (SOAPElement) iteratorUserToken.next();
-
- Iterator iteratorUsername = userTokenElement.getChildElements(new QName(NAME_SPACE_URI, USERNAME, WSSE));
- Iterator iteratorPassword = userTokenElement.getChildElements(new QName(NAME_SPACE_URI, PASSWORD, WSSE));
-
- if (iteratorUsername.hasNext() && iteratorPassword.hasNext()) {
- SOAPElement usernameElement = (SOAPElement) iteratorUsername.next();
- SOAPElement passwordElement = (SOAPElement) iteratorPassword.next();
-
- if (usernameElement != null && passwordElement != null) {
- String username = usernameElement.getValue();
- String passwordPlainText = passwordElement.getValue();
- return Authenticator.authenticateRequest(m_credentialValidationStrategy, username, passwordPlainText);
- }
- }
- }
- }
- return false;
- }
-
- protected boolean breakHandlerChain(SOAPMessageContext context) {
- context.put(MessageContext.HTTP_RESPONSE_CODE, HttpServletResponse.SC_UNAUTHORIZED);
-
- boolean oneway = BooleanUtility.nvl((Boolean) context.get(BindingProviderProperties.ONE_WAY_OPERATION), false);
- if (oneway) {
- // do not just return false as in one-way communication, the chain is continued regardless of the status.
- throw new WebServiceException("Unauthorized");
- }
- return false;
- }
-
- protected boolean breakHandlerChainWithException(SOAPMessageContext context, Exception exception) {
- context.put(MessageContext.HTTP_RESPONSE_CODE, HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
- LOG.error("Internal server error (Message Level WS-Security with UsernameToken authentication)", exception);
-
- if (exception instanceof WebServiceException) {
- throw (WebServiceException) exception;
- }
- throw new WebServiceException("Internal server error");
- }
-
- @Override
- public String getName() {
- return "WSSE Username Token";
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.jaxws.security.provider;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPHeader;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+import org.eclipse.scout.commons.BooleanUtility;
+import org.eclipse.scout.commons.TypeCastUtility;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.jaxws.annotation.ScoutTransaction;
+import org.eclipse.scout.jaxws.internal.ContextHelper;
+import org.eclipse.scout.jaxws.internal.SessionHelper;
+import org.eclipse.scout.jaxws.security.Authenticator;
+import org.eclipse.scout.jaxws.session.IServerSessionFactory;
+import org.eclipse.scout.rt.server.IServerSession;
+import org.eclipse.scout.service.ServiceUtility;
+
+import com.sun.xml.internal.ws.client.BindingProviderProperties;
+
+/**
+ * <p>
+ * Handler to protect your webservice with Message Level WS-Security with UsernameToken Authentication. This requires
+ * requests to provide a valid user name and password to access content. User's credentials are included in SOAP message
+ * headers.
+ * </p>
+ * <p>
+ * However, the disadvantage of WSSE UsernameToken Authentication is that it transmits unencrypted passwords across the
+ * network. Therefore, you only should use this authentication when you know that the connection between the client and
+ * the server is secure. The connection should be established either over a dedicated line or by using Secure Sockets
+ * Layer (SSL) encryption and Transport Layer Security (TLS).
+ * </p>
+ */
+@ScoutTransaction
+public class WsseUsernameTokenAuthenticationHandler implements IAuthenticationHandler {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(WsseUsernameTokenAuthenticationHandler.class);
+
+ private static final String WSSE = "wsse";
+ private static final String WS_SEC = "Security";
+ private static final String USERNAME_TOKEN = "UsernameToken";
+ private static final String USERNAME = "Username";
+ private static final String PASSWORD = "Password";
+ private static final String NAME_SPACE_URI = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd";
+
+ private ICredentialValidationStrategy m_credentialValidationStrategy;
+
+ public WsseUsernameTokenAuthenticationHandler() {
+ ServiceUtility.injectConfigProperties(this);
+ }
+
+ @Override
+ public final boolean handleMessage(SOAPMessageContext context) {
+ boolean outbound = TypeCastUtility.castValue(context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY), boolean.class);
+ if (outbound) {
+ return true; // only inbound messages are of interest
+ }
+
+ if (Authenticator.isSubjectAuthenticated()) {
+ return true;
+ }
+
+ try {
+ SOAPHeader header = context.getMessage().getSOAPPart().getEnvelope().getHeader();
+ if (header == null) {
+ throw new WebServiceException("Authentication failed as no WSSE-Security header found.");
+ }
+ if (authenticateRequest(header)) {
+ // create and cache a new server session on behalf of the authenticated user by using the session factory configured on the port type.
+ // In turn, this session is used by subsequent handlers and the port type resolver.
+ IServerSessionFactory portTypeSessionFactory = ContextHelper.getPortTypeSessionFactory(context);
+ IServerSession serverSession = SessionHelper.createNewServerSession(portTypeSessionFactory);
+ if (serverSession != null) {
+ // cache session to be used by subsequent handlers and port type resolver
+ ContextHelper.setContextSession(context, portTypeSessionFactory, serverSession);
+ }
+ return true;
+ }
+ return breakHandlerChain(context);
+ }
+ catch (Exception e) {
+ return breakHandlerChainWithException(context, e);
+ }
+ }
+
+ @Override
+ public void injectCredentialValidationStrategy(ICredentialValidationStrategy strategy) {
+ m_credentialValidationStrategy = strategy;
+ }
+
+ @Override
+ public Set<QName> getHeaders() {
+ Set<QName> headers = new HashSet<QName>();
+ headers.add(new QName(NAME_SPACE_URI, WS_SEC));
+ return headers;
+ }
+
+ @Override
+ public void close(MessageContext context) {
+ }
+
+ @Override
+ public boolean handleFault(SOAPMessageContext context) {
+ return false;
+ }
+
+ protected boolean authenticateRequest(SOAPHeader header) throws Exception {
+ Iterator iteratorSecurity = header.getChildElements(new QName(NAME_SPACE_URI, WS_SEC, WSSE));
+ if (!iteratorSecurity.hasNext()) {
+ throw new WebServiceException("Authentication failed as no WSSE-Security header found.");
+ }
+
+ while (iteratorSecurity.hasNext()) {
+ SOAPElement security = (SOAPElement) iteratorSecurity.next();
+ Iterator iteratorUserToken = security.getChildElements(new QName(NAME_SPACE_URI, USERNAME_TOKEN, WSSE));
+ while (iteratorUserToken.hasNext()) {
+ SOAPElement userTokenElement = (SOAPElement) iteratorUserToken.next();
+
+ Iterator iteratorUsername = userTokenElement.getChildElements(new QName(NAME_SPACE_URI, USERNAME, WSSE));
+ Iterator iteratorPassword = userTokenElement.getChildElements(new QName(NAME_SPACE_URI, PASSWORD, WSSE));
+
+ if (iteratorUsername.hasNext() && iteratorPassword.hasNext()) {
+ SOAPElement usernameElement = (SOAPElement) iteratorUsername.next();
+ SOAPElement passwordElement = (SOAPElement) iteratorPassword.next();
+
+ if (usernameElement != null && passwordElement != null) {
+ String username = usernameElement.getValue();
+ String passwordPlainText = passwordElement.getValue();
+ return Authenticator.authenticateRequest(m_credentialValidationStrategy, username, passwordPlainText);
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ protected boolean breakHandlerChain(SOAPMessageContext context) {
+ context.put(MessageContext.HTTP_RESPONSE_CODE, HttpServletResponse.SC_UNAUTHORIZED);
+
+ boolean oneway = BooleanUtility.nvl((Boolean) context.get(BindingProviderProperties.ONE_WAY_OPERATION), false);
+ if (oneway) {
+ // do not just return false as in one-way communication, the chain is continued regardless of the status.
+ throw new WebServiceException("Unauthorized");
+ }
+ return false;
+ }
+
+ protected boolean breakHandlerChainWithException(SOAPMessageContext context, Exception exception) {
+ context.put(MessageContext.HTTP_RESPONSE_CODE, HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ LOG.error("Internal server error (Message Level WS-Security with UsernameToken authentication)", exception);
+
+ if (exception instanceof WebServiceException) {
+ throw (WebServiceException) exception;
+ }
+ throw new WebServiceException("Internal server error");
+ }
+
+ @Override
+ public String getName() {
+ return "WSSE Username Token";
+ }
+}
diff --git a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/service/AbstractWebServiceClient.java b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/service/AbstractWebServiceClient.java
index 45f6aef7bf..e1e3114112 100644
--- a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/service/AbstractWebServiceClient.java
+++ b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/service/AbstractWebServiceClient.java
@@ -1,448 +1,448 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.jaxws.service;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.ParameterizedType;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-import javax.xml.ws.Service;
-import javax.xml.ws.WebServiceClient;
-import javax.xml.ws.WebServiceException;
-import javax.xml.ws.handler.Handler;
-import javax.xml.ws.handler.HandlerResolver;
-import javax.xml.ws.handler.PortInfo;
-import javax.xml.ws.handler.soap.SOAPHandler;
-import javax.xml.ws.handler.soap.SOAPMessageContext;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.scout.commons.NumberUtility;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.annotations.ConfigOperation;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.jaxws.annotation.ScoutWebServiceClient;
-import org.eclipse.scout.jaxws.security.consumer.IAuthenticationHandler;
-import org.eclipse.scout.service.AbstractService;
-import org.eclipse.scout.service.IService;
-import org.osgi.framework.ServiceRegistration;
-
-import com.sun.xml.internal.ws.client.BindingProviderProperties;
-
-/**
- * <p>
- * To proxy a webservice stub to an {@link IService}.
- * </p>
- * <ul>
- * <li>An authentication strategy can be specified by setting the annotation {@link ScoutWebServiceClient}<br/>
- * A user's credential can be configured in config.ini by setting the properties domain, username and password or
- * directly in respective <code>getConfigured</code> methods.</li>
- * <li>Custom handlers can be installed by overriding {@link AbstractWebServiceClient#execInstallHandlers(List)}.</li>
- * <li>The endpoint URL can be configured by specifying the property url in config.ini or directly in
- * {@link AbstractWebServiceClient#getConfiguredUrl()}. If it is about a dynamic URL, it also can be set at runtime when
- * obtaining the port type.</li>
- * </ul>
- *
- * @param <S>
- * The service to be proxied. The service is unique among all services defined within in the enclosing WSDL
- * document and groups a set of related ports together.
- * @param <P>
- * The port type to communicate with. The port type is unique among all port types defined within in the
- * enclosing WSDL document. A port type is a named set of abstract operations and the abstract messages
- * involved. The port type is unique among all port types defined within in the enclosing WSDL document.
- */
-@ScoutWebServiceClient
-public class AbstractWebServiceClient<S extends Service, P> extends AbstractService implements IWebServiceClient {
-
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractWebServiceClient.class);
-
- private WebServiceClient m_webServiceClientAnnotation;
- private String m_url;
- private URL m_wsdlLocation;
- private String m_targetNamespace;
- private String m_serviceName;
- private Integer m_requestTimeout;
- private Integer m_connectTimeout;
-
- private String m_username;
- private String m_password;
-
- private Class<? extends Service> m_serviceClazz;
- private Class<?> m_portTypeClazz;
-
- @SuppressWarnings("unchecked")
- @Override
- public void initializeService(ServiceRegistration registration) {
- m_serviceClazz = (Class<? extends Service>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0];
- m_portTypeClazz = (Class<?>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[1];
- m_webServiceClientAnnotation = m_serviceClazz.getAnnotation(WebServiceClient.class);
-
- if (m_webServiceClientAnnotation == null) {
- throw new WebServiceException("Missing required annotation '" + WebServiceClient.class.getName() + "' on webservice client '" + getClass().getName() + "'");
- }
-
- initConfig();
- super.initializeService(registration);
- }
-
- protected void initConfig() {
- setWsdlLocation(getConfiguredWsdlLocation());
- setUrl(getConfiguredUrl());
- setTargetNamespace(getConfiguredTargetNamespace());
- setServiceName(getConfiguredServiceName());
- setUsername(getConfiguredUsername());
- setPassword(getConfiguredPassword());
- setConnectTimeout(getConfiguredConnectTimeout());
- setRequestTimeout(getConfiguredRequestTimeout());
- }
-
- /**
- * To get the service stub specified by generic type parameter {@link S}.<br/>
- * Please be in mind, that the endpoint URL is set on port type level. Therefore, when working directly on the
- * service, you have to set the endpoint URL manually when calling the service. <br/>
- * By using {@link AbstractWebServiceClient#getPortType()}, the URL is set accordingly.
- *
- * @return
- */
- @SuppressWarnings("unchecked")
- public S getWebService() {
- if (getWsdlLocation() == null) {
- throw new WebServiceException("No location for WSDL configured on webservice proxy '" + getClass().getName() + "'.");
- }
-
- try {
- Constructor<? extends Service> constructor = m_serviceClazz.getConstructor(URL.class, QName.class);
- S service = (S) constructor.newInstance(getWsdlLocation(), new QName(getTargetNamespace(), getServiceName()));
-
- // install handlers
- service.setHandlerResolver(new HandlerResolver() {
-
- @Override
- public List<Handler> getHandlerChain(PortInfo portInfo) {
- ArrayList<Handler> list = new ArrayList<Handler>();
-
- // authentication handler
- IAuthenticationHandler authenticationHandler = createAuthenticationHandler();
- if (authenticationHandler != null) {
- try {
- (authenticationHandler).setUsername(getUsername());
- (authenticationHandler).setPassword(getPassword());
-
- if (execPrepareAuthenticationHandler(authenticationHandler)) {
- list.add(authenticationHandler);
- }
- }
- catch (ProcessingException e) {
- LOG.error("Authentication handler could not be installed.", e);
- }
- }
-
- List<SOAPHandler<SOAPMessageContext>> handlers = new LinkedList<SOAPHandler<SOAPMessageContext>>();
- execInstallHandlers(handlers);
- if (handlers.size() > 0) {
- list.addAll(handlers);
- }
-
- return list;
- }
- });
-
- return service;
- }
- catch (Exception e) {
- throw new WebServiceException("Webservice proxy '" + getClass().getName() + "' could not be created.", e);
- }
- }
-
- /**
- * To get the port type specified by generic type parameter {@link P}.
- *
- * @return
- */
- public P getPortType() {
- return getPortType(getUrl());
- }
-
- /**
- * To get the port type specified by generic type parameter {@link P}.
- *
- * @param url
- * {@link URL} to connect with endpoint. Do not use this method to distinguish between development and
- * production {@link URL}. Use property in config.ini instead.
- * @return
- */
- @SuppressWarnings("unchecked")
- public P getPortType(String url) {
- if (StringUtility.isNullOrEmpty(url)) {
- throw new WebServiceException("No endpoint URL configured for webservice client '" + getClass().getName() + "'.");
- }
-
- P portType = (P) getWebService().getPort(m_portTypeClazz);
-
- // set endpoint URL
- ((javax.xml.ws.BindingProvider) portType).getRequestContext().put(javax.xml.ws.BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url);
-
- // set request timeout
- if (NumberUtility.nvl(getRequestTimeout(), 0) > 0) {
- ((javax.xml.ws.BindingProvider) portType).getRequestContext().put(BindingProviderProperties.REQUEST_TIMEOUT, getRequestTimeout());
- }
-
- // set connect timeout
- if (NumberUtility.nvl(getConnectTimeout(), 0) > 0) {
- ((javax.xml.ws.BindingProvider) portType).getRequestContext().put(BindingProviderProperties.CONNECT_TIMEOUT, getConnectTimeout());
- }
-
- return portType;
- }
-
- /**
- * To be overwritten if WSDL file is located somewhere else than specified in {@link WebServiceClient#wsdlLocation()}.
- * This location can be specified when generating the stub with the option -wsdllocation.
- *
- * @return URL to WSDL file
- */
- @ConfigProperty(ConfigProperty.OBJECT)
- @Order(20)
- protected URL getConfiguredWsdlLocation() {
- String wsdlLocation = m_webServiceClientAnnotation.wsdlLocation();
- if (StringUtility.isNullOrEmpty(wsdlLocation)) {
- throw new WebServiceException("No WSDL file location configured on webservice proxy '" + getClass().getName() + "'");
- }
- IPath path = new Path("").addTrailingSeparator().append(new Path(wsdlLocation)); // ensure root relative path
- URL urlWsdlLocation = getClass().getResource(path.toPortableString());
- if (urlWsdlLocation == null) {
- throw new WebServiceException("Could not find WSDL file '" + StringUtility.nvl(wsdlLocation, "?") + "' of webservice client '" + getClass().getName() + "'");
- }
- return urlWsdlLocation;
- }
-
- /**
- * To configure a static endpoint URL
- *
- * @return
- */
- @ConfigProperty(ConfigProperty.STRING)
- @Order(30)
- protected String getConfiguredUrl() {
- return null;
- }
-
- /**
- * To be overwritten if service name to be called is different from {@link WebServiceClient#name()} in {@link Service}
- *
- * @return unqualified service name to be called.
- */
- @Order(40)
- protected String getConfiguredServiceName() {
- return m_webServiceClientAnnotation.name();
- }
-
- /**
- * To be overwritten if targetNamespace of service to be called is different from
- * {@link WebServiceClient#targetNamespace()} in {@link Service}
- *
- * @return
- */
- @Order(50)
- protected String getConfiguredTargetNamespace() {
- return m_webServiceClientAnnotation.targetNamespace();
- }
-
- /**
- * To configure a static user's credential
- *
- * @return
- */
- @ConfigProperty(ConfigProperty.STRING)
- @Order(60)
- protected String getConfiguredUsername() {
- return null;
- }
-
- /**
- * To configure a static user's credential
- *
- * @return
- */
- @ConfigProperty(ConfigProperty.STRING)
- @Order(70)
- protected String getConfiguredPassword() {
- return null;
- }
-
- /**
- * To configure the maximum timeout in milliseconds to wait for the connection to be established.
- *
- * @See {@link HttpURLConnection#setConnectTimeout(int)}
- * @return the maximal timeout to wait for the connection to be established.
- */
- @ConfigProperty(ConfigProperty.INTEGER)
- @Order(80)
- protected Integer getConfiguredConnectTimeout() {
- return null;
- }
-
- /**
- * To configure the maximum timeout in milliseconds to wait for response data to be ready to be read.
- *
- * @See {@link HttpURLConnection#setReadTimeout(int)}
- * @return the maximal timeout to wait for response data to be ready to be read.
- */
- @ConfigProperty(ConfigProperty.INTEGER)
- @Order(90)
- protected Integer getConfiguredRequestTimeout() {
- return null;
- }
-
- /**
- * Is called before the authentication handler is installed.
- *
- * @param authenticationHandler
- * the authentication handler
- * @return true to install the authentication handler or false to not install it
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(10)
- protected boolean execPrepareAuthenticationHandler(IAuthenticationHandler authenticationHandler) throws ProcessingException {
- return true;
- }
-
- /**
- * Add custom handlers to the handler chain
- *
- * @param handlers
- * handlers to be installed
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(20)
- protected void execInstallHandlers(List<SOAPHandler<SOAPMessageContext>> handlers) {
- }
-
- private IAuthenticationHandler createAuthenticationHandler() {
- ScoutWebServiceClient annotation = null;
- Class<?> declaringClass = getClass();
- while (annotation == null && declaringClass != null && declaringClass != Object.class) {
- annotation = declaringClass.getAnnotation(ScoutWebServiceClient.class);
- declaringClass = declaringClass.getSuperclass();
- }
-
- if (annotation == null) {
- return null;
- }
-
- Class<? extends IAuthenticationHandler> authenticationHandlerClazz = annotation.authenticationHandler();
- if (authenticationHandlerClazz == null || authenticationHandlerClazz == IAuthenticationHandler.NONE.class) {
- return null;
- }
-
- IAuthenticationHandler authenticationHandler = null;
- try {
- authenticationHandler = authenticationHandlerClazz.newInstance();
- }
- catch (Exception e) {
- LOG.error("Failed to instantiate authentication handler '" + authenticationHandlerClazz.getName() + "'.", e);
- return null;
- }
-
- return authenticationHandler;
- }
-
- @Override
- public String getPassword() {
- return m_password;
- }
-
- @Override
- public String getServiceName() {
- return m_serviceName;
- }
-
- @Override
- public String getTargetNamespace() {
- return m_targetNamespace;
- }
-
- @Override
- public String getUsername() {
- return m_username;
- }
-
- @Override
- public URL getWsdlLocation() {
- return m_wsdlLocation;
- }
-
- @Override
- public void setPassword(String password) {
- m_password = password;
- }
-
- @Override
- public void setServiceName(String serviceName) {
- m_serviceName = serviceName;
- }
-
- @Override
- public void setTargetNamespace(String targetNamespace) {
- m_targetNamespace = targetNamespace;
- }
-
- @Override
- public void setUsername(String username) {
- m_username = username;
- }
-
- @Override
- public Integer getRequestTimeout() {
- return m_requestTimeout;
- }
-
- @Override
- public void setRequestTimeout(Integer requestTimeout) {
- m_requestTimeout = requestTimeout;
- }
-
- @Override
- public Integer getConnectTimeout() {
- return m_connectTimeout;
- }
-
- @Override
- public void setConnectTimeout(Integer connectTimeout) {
- m_connectTimeout = connectTimeout;
- }
-
- @Override
- public void setWsdlLocation(URL wsdlLocation) {
- m_wsdlLocation = wsdlLocation;
- }
-
- @Override
- public String getUrl() {
- return m_url;
- }
-
- @Override
- public void setUrl(String url) {
- m_url = url;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.jaxws.service;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.ParameterizedType;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebServiceClient;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.handler.Handler;
+import javax.xml.ws.handler.HandlerResolver;
+import javax.xml.ws.handler.PortInfo;
+import javax.xml.ws.handler.soap.SOAPHandler;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.scout.commons.NumberUtility;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.annotations.ConfigOperation;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.jaxws.annotation.ScoutWebServiceClient;
+import org.eclipse.scout.jaxws.security.consumer.IAuthenticationHandler;
+import org.eclipse.scout.service.AbstractService;
+import org.eclipse.scout.service.IService;
+import org.osgi.framework.ServiceRegistration;
+
+import com.sun.xml.internal.ws.client.BindingProviderProperties;
+
+/**
+ * <p>
+ * To proxy a webservice stub to an {@link IService}.
+ * </p>
+ * <ul>
+ * <li>An authentication strategy can be specified by setting the annotation {@link ScoutWebServiceClient}<br/>
+ * A user's credential can be configured in config.ini by setting the properties domain, username and password or
+ * directly in respective <code>getConfigured</code> methods.</li>
+ * <li>Custom handlers can be installed by overriding {@link AbstractWebServiceClient#execInstallHandlers(List)}.</li>
+ * <li>The endpoint URL can be configured by specifying the property url in config.ini or directly in
+ * {@link AbstractWebServiceClient#getConfiguredUrl()}. If it is about a dynamic URL, it also can be set at runtime when
+ * obtaining the port type.</li>
+ * </ul>
+ *
+ * @param <S>
+ * The service to be proxied. The service is unique among all services defined within in the enclosing WSDL
+ * document and groups a set of related ports together.
+ * @param <P>
+ * The port type to communicate with. The port type is unique among all port types defined within in the
+ * enclosing WSDL document. A port type is a named set of abstract operations and the abstract messages
+ * involved. The port type is unique among all port types defined within in the enclosing WSDL document.
+ */
+@ScoutWebServiceClient
+public class AbstractWebServiceClient<S extends Service, P> extends AbstractService implements IWebServiceClient {
+
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractWebServiceClient.class);
+
+ private WebServiceClient m_webServiceClientAnnotation;
+ private String m_url;
+ private URL m_wsdlLocation;
+ private String m_targetNamespace;
+ private String m_serviceName;
+ private Integer m_requestTimeout;
+ private Integer m_connectTimeout;
+
+ private String m_username;
+ private String m_password;
+
+ private Class<? extends Service> m_serviceClazz;
+ private Class<?> m_portTypeClazz;
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public void initializeService(ServiceRegistration registration) {
+ m_serviceClazz = (Class<? extends Service>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0];
+ m_portTypeClazz = (Class<?>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[1];
+ m_webServiceClientAnnotation = m_serviceClazz.getAnnotation(WebServiceClient.class);
+
+ if (m_webServiceClientAnnotation == null) {
+ throw new WebServiceException("Missing required annotation '" + WebServiceClient.class.getName() + "' on webservice client '" + getClass().getName() + "'");
+ }
+
+ initConfig();
+ super.initializeService(registration);
+ }
+
+ protected void initConfig() {
+ setWsdlLocation(getConfiguredWsdlLocation());
+ setUrl(getConfiguredUrl());
+ setTargetNamespace(getConfiguredTargetNamespace());
+ setServiceName(getConfiguredServiceName());
+ setUsername(getConfiguredUsername());
+ setPassword(getConfiguredPassword());
+ setConnectTimeout(getConfiguredConnectTimeout());
+ setRequestTimeout(getConfiguredRequestTimeout());
+ }
+
+ /**
+ * To get the service stub specified by generic type parameter {@link S}.<br/>
+ * Please be in mind, that the endpoint URL is set on port type level. Therefore, when working directly on the
+ * service, you have to set the endpoint URL manually when calling the service. <br/>
+ * By using {@link AbstractWebServiceClient#getPortType()}, the URL is set accordingly.
+ *
+ * @return
+ */
+ @SuppressWarnings("unchecked")
+ public S getWebService() {
+ if (getWsdlLocation() == null) {
+ throw new WebServiceException("No location for WSDL configured on webservice proxy '" + getClass().getName() + "'.");
+ }
+
+ try {
+ Constructor<? extends Service> constructor = m_serviceClazz.getConstructor(URL.class, QName.class);
+ S service = (S) constructor.newInstance(getWsdlLocation(), new QName(getTargetNamespace(), getServiceName()));
+
+ // install handlers
+ service.setHandlerResolver(new HandlerResolver() {
+
+ @Override
+ public List<Handler> getHandlerChain(PortInfo portInfo) {
+ ArrayList<Handler> list = new ArrayList<Handler>();
+
+ // authentication handler
+ IAuthenticationHandler authenticationHandler = createAuthenticationHandler();
+ if (authenticationHandler != null) {
+ try {
+ (authenticationHandler).setUsername(getUsername());
+ (authenticationHandler).setPassword(getPassword());
+
+ if (execPrepareAuthenticationHandler(authenticationHandler)) {
+ list.add(authenticationHandler);
+ }
+ }
+ catch (ProcessingException e) {
+ LOG.error("Authentication handler could not be installed.", e);
+ }
+ }
+
+ List<SOAPHandler<SOAPMessageContext>> handlers = new LinkedList<SOAPHandler<SOAPMessageContext>>();
+ execInstallHandlers(handlers);
+ if (handlers.size() > 0) {
+ list.addAll(handlers);
+ }
+
+ return list;
+ }
+ });
+
+ return service;
+ }
+ catch (Exception e) {
+ throw new WebServiceException("Webservice proxy '" + getClass().getName() + "' could not be created.", e);
+ }
+ }
+
+ /**
+ * To get the port type specified by generic type parameter {@link P}.
+ *
+ * @return
+ */
+ public P getPortType() {
+ return getPortType(getUrl());
+ }
+
+ /**
+ * To get the port type specified by generic type parameter {@link P}.
+ *
+ * @param url
+ * {@link URL} to connect with endpoint. Do not use this method to distinguish between development and
+ * production {@link URL}. Use property in config.ini instead.
+ * @return
+ */
+ @SuppressWarnings("unchecked")
+ public P getPortType(String url) {
+ if (StringUtility.isNullOrEmpty(url)) {
+ throw new WebServiceException("No endpoint URL configured for webservice client '" + getClass().getName() + "'.");
+ }
+
+ P portType = (P) getWebService().getPort(m_portTypeClazz);
+
+ // set endpoint URL
+ ((javax.xml.ws.BindingProvider) portType).getRequestContext().put(javax.xml.ws.BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url);
+
+ // set request timeout
+ if (NumberUtility.nvl(getRequestTimeout(), 0) > 0) {
+ ((javax.xml.ws.BindingProvider) portType).getRequestContext().put(BindingProviderProperties.REQUEST_TIMEOUT, getRequestTimeout());
+ }
+
+ // set connect timeout
+ if (NumberUtility.nvl(getConnectTimeout(), 0) > 0) {
+ ((javax.xml.ws.BindingProvider) portType).getRequestContext().put(BindingProviderProperties.CONNECT_TIMEOUT, getConnectTimeout());
+ }
+
+ return portType;
+ }
+
+ /**
+ * To be overwritten if WSDL file is located somewhere else than specified in {@link WebServiceClient#wsdlLocation()}.
+ * This location can be specified when generating the stub with the option -wsdllocation.
+ *
+ * @return URL to WSDL file
+ */
+ @ConfigProperty(ConfigProperty.OBJECT)
+ @Order(20)
+ protected URL getConfiguredWsdlLocation() {
+ String wsdlLocation = m_webServiceClientAnnotation.wsdlLocation();
+ if (StringUtility.isNullOrEmpty(wsdlLocation)) {
+ throw new WebServiceException("No WSDL file location configured on webservice proxy '" + getClass().getName() + "'");
+ }
+ IPath path = new Path("").addTrailingSeparator().append(new Path(wsdlLocation)); // ensure root relative path
+ URL urlWsdlLocation = getClass().getResource(path.toPortableString());
+ if (urlWsdlLocation == null) {
+ throw new WebServiceException("Could not find WSDL file '" + StringUtility.nvl(wsdlLocation, "?") + "' of webservice client '" + getClass().getName() + "'");
+ }
+ return urlWsdlLocation;
+ }
+
+ /**
+ * To configure a static endpoint URL
+ *
+ * @return
+ */
+ @ConfigProperty(ConfigProperty.STRING)
+ @Order(30)
+ protected String getConfiguredUrl() {
+ return null;
+ }
+
+ /**
+ * To be overwritten if service name to be called is different from {@link WebServiceClient#name()} in {@link Service}
+ *
+ * @return unqualified service name to be called.
+ */
+ @Order(40)
+ protected String getConfiguredServiceName() {
+ return m_webServiceClientAnnotation.name();
+ }
+
+ /**
+ * To be overwritten if targetNamespace of service to be called is different from
+ * {@link WebServiceClient#targetNamespace()} in {@link Service}
+ *
+ * @return
+ */
+ @Order(50)
+ protected String getConfiguredTargetNamespace() {
+ return m_webServiceClientAnnotation.targetNamespace();
+ }
+
+ /**
+ * To configure a static user's credential
+ *
+ * @return
+ */
+ @ConfigProperty(ConfigProperty.STRING)
+ @Order(60)
+ protected String getConfiguredUsername() {
+ return null;
+ }
+
+ /**
+ * To configure a static user's credential
+ *
+ * @return
+ */
+ @ConfigProperty(ConfigProperty.STRING)
+ @Order(70)
+ protected String getConfiguredPassword() {
+ return null;
+ }
+
+ /**
+ * To configure the maximum timeout in milliseconds to wait for the connection to be established.
+ *
+ * @See {@link HttpURLConnection#setConnectTimeout(int)}
+ * @return the maximal timeout to wait for the connection to be established.
+ */
+ @ConfigProperty(ConfigProperty.INTEGER)
+ @Order(80)
+ protected Integer getConfiguredConnectTimeout() {
+ return null;
+ }
+
+ /**
+ * To configure the maximum timeout in milliseconds to wait for response data to be ready to be read.
+ *
+ * @See {@link HttpURLConnection#setReadTimeout(int)}
+ * @return the maximal timeout to wait for response data to be ready to be read.
+ */
+ @ConfigProperty(ConfigProperty.INTEGER)
+ @Order(90)
+ protected Integer getConfiguredRequestTimeout() {
+ return null;
+ }
+
+ /**
+ * Is called before the authentication handler is installed.
+ *
+ * @param authenticationHandler
+ * the authentication handler
+ * @return true to install the authentication handler or false to not install it
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(10)
+ protected boolean execPrepareAuthenticationHandler(IAuthenticationHandler authenticationHandler) throws ProcessingException {
+ return true;
+ }
+
+ /**
+ * Add custom handlers to the handler chain
+ *
+ * @param handlers
+ * handlers to be installed
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(20)
+ protected void execInstallHandlers(List<SOAPHandler<SOAPMessageContext>> handlers) {
+ }
+
+ private IAuthenticationHandler createAuthenticationHandler() {
+ ScoutWebServiceClient annotation = null;
+ Class<?> declaringClass = getClass();
+ while (annotation == null && declaringClass != null && declaringClass != Object.class) {
+ annotation = declaringClass.getAnnotation(ScoutWebServiceClient.class);
+ declaringClass = declaringClass.getSuperclass();
+ }
+
+ if (annotation == null) {
+ return null;
+ }
+
+ Class<? extends IAuthenticationHandler> authenticationHandlerClazz = annotation.authenticationHandler();
+ if (authenticationHandlerClazz == null || authenticationHandlerClazz == IAuthenticationHandler.NONE.class) {
+ return null;
+ }
+
+ IAuthenticationHandler authenticationHandler = null;
+ try {
+ authenticationHandler = authenticationHandlerClazz.newInstance();
+ }
+ catch (Exception e) {
+ LOG.error("Failed to instantiate authentication handler '" + authenticationHandlerClazz.getName() + "'.", e);
+ return null;
+ }
+
+ return authenticationHandler;
+ }
+
+ @Override
+ public String getPassword() {
+ return m_password;
+ }
+
+ @Override
+ public String getServiceName() {
+ return m_serviceName;
+ }
+
+ @Override
+ public String getTargetNamespace() {
+ return m_targetNamespace;
+ }
+
+ @Override
+ public String getUsername() {
+ return m_username;
+ }
+
+ @Override
+ public URL getWsdlLocation() {
+ return m_wsdlLocation;
+ }
+
+ @Override
+ public void setPassword(String password) {
+ m_password = password;
+ }
+
+ @Override
+ public void setServiceName(String serviceName) {
+ m_serviceName = serviceName;
+ }
+
+ @Override
+ public void setTargetNamespace(String targetNamespace) {
+ m_targetNamespace = targetNamespace;
+ }
+
+ @Override
+ public void setUsername(String username) {
+ m_username = username;
+ }
+
+ @Override
+ public Integer getRequestTimeout() {
+ return m_requestTimeout;
+ }
+
+ @Override
+ public void setRequestTimeout(Integer requestTimeout) {
+ m_requestTimeout = requestTimeout;
+ }
+
+ @Override
+ public Integer getConnectTimeout() {
+ return m_connectTimeout;
+ }
+
+ @Override
+ public void setConnectTimeout(Integer connectTimeout) {
+ m_connectTimeout = connectTimeout;
+ }
+
+ @Override
+ public void setWsdlLocation(URL wsdlLocation) {
+ m_wsdlLocation = wsdlLocation;
+ }
+
+ @Override
+ public String getUrl() {
+ return m_url;
+ }
+
+ @Override
+ public void setUrl(String url) {
+ m_url = url;
+ }
+}
diff --git a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/service/IJaxWsEndpointService.java b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/service/IJaxWsEndpointService.java
index 6fde2fcbf6..e85a4027c7 100644
--- a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/service/IJaxWsEndpointService.java
+++ b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/service/IJaxWsEndpointService.java
@@ -1,61 +1,61 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.jaxws.service;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.eclipse.scout.jaxws.internal.servlet.ServletAdapter;
-import org.eclipse.scout.service.IService;
-
-/**
- * Service to access installed JAX-WS endpoints and intercept HTTP-GET request that are not target to a JAX-WS endpoint.
- */
-public interface IJaxWsEndpointService extends IService {
-
- /**
- * To get a specific JAX-WS endpoint
- *
- * @param alias
- * the alias of the JAX-WS endpoint to be looked for
- * @return the {@link ServletAdapter} or null if no JAX-WS endpoint exists for the given alias
- */
- ServletAdapter getServletAdapter(String alias);
-
- /**
- * To get all installed JAX-WS endpoints
- *
- * @return all installed JAX-WS endpoints
- */
- ServletAdapter[] getServletAdapters();
-
- /**
- * To get the authentication method of a given {@link ServletAdapter}
- *
- * @param adapter
- * {@link ServletAdapter}
- * @return the authentication method or "None" if not applicable
- */
- String getAuthenticationMethod(ServletAdapter adapter);
-
- /**
- * To intercept a HTTP-GET request that is not target to a JAX-WS endpoint.
- *
- * @param request
- * {@link HttpServletRequest}
- * @param response
- * {@link HttpServletResponse}
- * @param servletAdapters
- * the JAX-WS endpoints installed
- * @throws Exception
- */
- void onGetRequest(HttpServletRequest request, HttpServletResponse response, ServletAdapter[] servletAdapters) throws Exception;
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.jaxws.service;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.eclipse.scout.jaxws.internal.servlet.ServletAdapter;
+import org.eclipse.scout.service.IService;
+
+/**
+ * Service to access installed JAX-WS endpoints and intercept HTTP-GET request that are not target to a JAX-WS endpoint.
+ */
+public interface IJaxWsEndpointService extends IService {
+
+ /**
+ * To get a specific JAX-WS endpoint
+ *
+ * @param alias
+ * the alias of the JAX-WS endpoint to be looked for
+ * @return the {@link ServletAdapter} or null if no JAX-WS endpoint exists for the given alias
+ */
+ ServletAdapter getServletAdapter(String alias);
+
+ /**
+ * To get all installed JAX-WS endpoints
+ *
+ * @return all installed JAX-WS endpoints
+ */
+ ServletAdapter[] getServletAdapters();
+
+ /**
+ * To get the authentication method of a given {@link ServletAdapter}
+ *
+ * @param adapter
+ * {@link ServletAdapter}
+ * @return the authentication method or "None" if not applicable
+ */
+ String getAuthenticationMethod(ServletAdapter adapter);
+
+ /**
+ * To intercept a HTTP-GET request that is not target to a JAX-WS endpoint.
+ *
+ * @param request
+ * {@link HttpServletRequest}
+ * @param response
+ * {@link HttpServletResponse}
+ * @param servletAdapters
+ * the JAX-WS endpoints installed
+ * @throws Exception
+ */
+ void onGetRequest(HttpServletRequest request, HttpServletResponse response, ServletAdapter[] servletAdapters) throws Exception;
+}
diff --git a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/service/IWebServiceClient.java b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/service/IWebServiceClient.java
index 67be69dc21..698e92df00 100644
--- a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/service/IWebServiceClient.java
+++ b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/service/IWebServiceClient.java
@@ -1,50 +1,50 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.jaxws.service;
-
-import java.net.URL;
-
-import org.eclipse.scout.service.IService;
-
-public interface IWebServiceClient extends IService {
-
- public String getUsername();
-
- public void setUsername(String username);
-
- public String getPassword();
-
- public void setPassword(String password);
-
- public URL getWsdlLocation();
-
- public void setWsdlLocation(URL wsdlLocation);
-
- public String getTargetNamespace();
-
- public void setTargetNamespace(String targetNamespace);
-
- public String getServiceName();
-
- public void setServiceName(String serviceName);
-
- public String getUrl();
-
- public void setUrl(String url);
-
- public Integer getRequestTimeout();
-
- public void setRequestTimeout(Integer requestTimeout);
-
- public Integer getConnectTimeout();
-
- public void setConnectTimeout(Integer connectTimeout);
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.jaxws.service;
+
+import java.net.URL;
+
+import org.eclipse.scout.service.IService;
+
+public interface IWebServiceClient extends IService {
+
+ public String getUsername();
+
+ public void setUsername(String username);
+
+ public String getPassword();
+
+ public void setPassword(String password);
+
+ public URL getWsdlLocation();
+
+ public void setWsdlLocation(URL wsdlLocation);
+
+ public String getTargetNamespace();
+
+ public void setTargetNamespace(String targetNamespace);
+
+ public String getServiceName();
+
+ public void setServiceName(String serviceName);
+
+ public String getUrl();
+
+ public void setUrl(String url);
+
+ public Integer getRequestTimeout();
+
+ public void setRequestTimeout(Integer requestTimeout);
+
+ public Integer getConnectTimeout();
+
+ public void setConnectTimeout(Integer connectTimeout);
+}
diff --git a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/session/DefaultServerSessionFactory.java b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/session/DefaultServerSessionFactory.java
index 154ff6d3d6..7ba18e648a 100644
--- a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/session/DefaultServerSessionFactory.java
+++ b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/session/DefaultServerSessionFactory.java
@@ -1,102 +1,102 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.jaxws.session;
-
-import java.security.AccessController;
-
-import javax.security.auth.Subject;
-import javax.xml.ws.WebServiceException;
-
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.server.IServerSession;
-import org.eclipse.scout.rt.server.ServiceTunnelServlet;
-import org.eclipse.scout.rt.server.services.common.session.IServerSessionRegistryService;
-import org.eclipse.scout.service.SERVICES;
-
-/**
- * <p>
- * Factory that creates a new {@link IServerSession} for each web service request.
- * </p>
- * <p>
- * The {@link IServerSession} is tried to be found based on several approaches:
- * <ol>
- * <li>based on config.ini parameters
- * <code>org.eclipse.scout.jaxws.session.DefaultServerSessionFactory#qnSession</code> and
- * <code>org.eclipse.scout.jaxws.session.DefaultServerSessionFactory#snBundle</code></li>
- * <li>based on default-naming-convention in bundle of servlet contributor for {@link ServiceTunnelServlet}</li>
- * </ol>
- * </p>
- * <p>
- * <b>Configuration in config.ini for creation of DefaultServerSession</b>
- * </p>
- * <table border="1">
- * <tr>
- * <td width="250px"><b>Property</b></td>
- * <td><b>Mandatory</b></td>
- * <td><b>Description</b></td>
- * </tr>
- * </tr>
- * <tr>
- * <td>org.eclipse.scout.jaxws.session.DefaultServerSessionFactory#qnSession</td>
- * <td>yes</td>
- * <td>Fully qualified name of session class</td>
- * </tr>
- * <tr>
- * <td>org.eclipse.scout.jaxws.session.DefaultServerSessionFactory#snBundle</td>
- * <td>no</td>
- * <td>Symbolic name of bundle whose classloader is to be used to load the session class. If not specified, the bundle
- * to load the session is assumed to be the qualifier of the session's qualified name.</td>
- * </tr>
- * </table>
- */
-public class DefaultServerSessionFactory implements IServerSessionFactory {
-
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(DefaultServerSessionFactory.class);
-
- /**
- * Symbolic name of the bundle that holds the {@link IServerSession}
- */
- public static final String PROP_SN_BUNDLE = DefaultServerSessionFactory.class.getName() + "#snBundle";
- /**
- * Fully qualified name of {@link IServerSession}
- */
- public static final String PROP_QN_SESSION = DefaultServerSessionFactory.class.getName() + "#qnSession";
-
- @Override
- public IServerSession create() {
- Class<? extends IServerSession> sessionClazz = ServerSessionClassFinder.find();
- if (sessionClazz == null) {
- throw new WebServiceException("Server session class could not be found.'");
- }
-
- Subject subject = null;
- try {
- subject = Subject.getSubject(AccessController.getContext());
- }
- catch (Exception e) {
- LOG.error("Failed to get subject of calling acess context", e);
- }
- if (subject == null) {
- throw new WebServiceException("Unexpected: missing subject in current access context.");
- }
-
- try {
- return SERVICES.getService(IServerSessionRegistryService.class).newServerSession(sessionClazz, subject);
- }
- catch (Throwable e) {
- if (e.getCause() instanceof SecurityException) {
- throw new WebServiceException("Session could not be created. Access denied.", e);
- }
- throw new WebServiceException("Session could not be created.", e);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.jaxws.session;
+
+import java.security.AccessController;
+
+import javax.security.auth.Subject;
+import javax.xml.ws.WebServiceException;
+
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.server.IServerSession;
+import org.eclipse.scout.rt.server.ServiceTunnelServlet;
+import org.eclipse.scout.rt.server.services.common.session.IServerSessionRegistryService;
+import org.eclipse.scout.service.SERVICES;
+
+/**
+ * <p>
+ * Factory that creates a new {@link IServerSession} for each web service request.
+ * </p>
+ * <p>
+ * The {@link IServerSession} is tried to be found based on several approaches:
+ * <ol>
+ * <li>based on config.ini parameters
+ * <code>org.eclipse.scout.jaxws.session.DefaultServerSessionFactory#qnSession</code> and
+ * <code>org.eclipse.scout.jaxws.session.DefaultServerSessionFactory#snBundle</code></li>
+ * <li>based on default-naming-convention in bundle of servlet contributor for {@link ServiceTunnelServlet}</li>
+ * </ol>
+ * </p>
+ * <p>
+ * <b>Configuration in config.ini for creation of DefaultServerSession</b>
+ * </p>
+ * <table border="1">
+ * <tr>
+ * <td width="250px"><b>Property</b></td>
+ * <td><b>Mandatory</b></td>
+ * <td><b>Description</b></td>
+ * </tr>
+ * </tr>
+ * <tr>
+ * <td>org.eclipse.scout.jaxws.session.DefaultServerSessionFactory#qnSession</td>
+ * <td>yes</td>
+ * <td>Fully qualified name of session class</td>
+ * </tr>
+ * <tr>
+ * <td>org.eclipse.scout.jaxws.session.DefaultServerSessionFactory#snBundle</td>
+ * <td>no</td>
+ * <td>Symbolic name of bundle whose classloader is to be used to load the session class. If not specified, the bundle
+ * to load the session is assumed to be the qualifier of the session's qualified name.</td>
+ * </tr>
+ * </table>
+ */
+public class DefaultServerSessionFactory implements IServerSessionFactory {
+
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(DefaultServerSessionFactory.class);
+
+ /**
+ * Symbolic name of the bundle that holds the {@link IServerSession}
+ */
+ public static final String PROP_SN_BUNDLE = DefaultServerSessionFactory.class.getName() + "#snBundle";
+ /**
+ * Fully qualified name of {@link IServerSession}
+ */
+ public static final String PROP_QN_SESSION = DefaultServerSessionFactory.class.getName() + "#qnSession";
+
+ @Override
+ public IServerSession create() {
+ Class<? extends IServerSession> sessionClazz = ServerSessionClassFinder.find();
+ if (sessionClazz == null) {
+ throw new WebServiceException("Server session class could not be found.'");
+ }
+
+ Subject subject = null;
+ try {
+ subject = Subject.getSubject(AccessController.getContext());
+ }
+ catch (Exception e) {
+ LOG.error("Failed to get subject of calling acess context", e);
+ }
+ if (subject == null) {
+ throw new WebServiceException("Unexpected: missing subject in current access context.");
+ }
+
+ try {
+ return SERVICES.getService(IServerSessionRegistryService.class).newServerSession(sessionClazz, subject);
+ }
+ catch (Throwable e) {
+ if (e.getCause() instanceof SecurityException) {
+ throw new WebServiceException("Session could not be created. Access denied.", e);
+ }
+ throw new WebServiceException("Session could not be created.", e);
+ }
+ }
+}
diff --git a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/session/IServerSessionFactory.java b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/session/IServerSessionFactory.java
index 8ed9a77ca0..2a02290ea8 100644
--- a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/session/IServerSessionFactory.java
+++ b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/session/IServerSessionFactory.java
@@ -1,25 +1,25 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.jaxws.session;
-
-import org.eclipse.scout.rt.server.IServerSession;
-import org.eclipse.scout.rt.server.ServerJob;
-
-/**
- * Factory to create a {@link IServerSession} creation strategy.
- */
-public interface IServerSessionFactory {
-
- /**
- * @return the server session or null to not run in a {@link ServerJob}
- */
- public IServerSession create();
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.jaxws.session;
+
+import org.eclipse.scout.rt.server.IServerSession;
+import org.eclipse.scout.rt.server.ServerJob;
+
+/**
+ * Factory to create a {@link IServerSession} creation strategy.
+ */
+public interface IServerSessionFactory {
+
+ /**
+ * @return the server session or null to not run in a {@link ServerJob}
+ */
+ public IServerSession create();
+}
diff --git a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/session/ServerSessionClassFinder.java b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/session/ServerSessionClassFinder.java
index 12b9e24a97..e48ffc7f33 100644
--- a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/session/ServerSessionClassFinder.java
+++ b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/session/ServerSessionClassFinder.java
@@ -1,164 +1,164 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.jaxws.session;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.jaxws.Activator;
-import org.eclipse.scout.rt.server.IServerSession;
-import org.eclipse.scout.rt.server.ServiceTunnelServlet;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-
-public class ServerSessionClassFinder {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(ServerSessionClassFinder.class);
-
- /**
- * Tries to find the server session class based on several approaches:
- * <ol>
- * <li>based on config.ini parameters {@link PROP_QN_SESSION} and {@link PROP_SN_BUNDLE}</li>
- * <li>based on default-naming-convention in bundle of servlet contributor for {@link ServiceTunnelServlet}</li>
- * </ol>
- *
- * @return the found server session class or null if not found
- */
- public static Class<? extends IServerSession> find() {
- // try to resolve session based on JAX-WS specific properties in config.ini
- Class<? extends IServerSession> serverSessionClass = resolveJaxWsServerSession();
- if (serverSessionClass != null) {
- return serverSessionClass;
- }
-
- // try by-convention-approach
- Bundle bundle = findServletContributorBundle();
- if (bundle == null) {
- LOG.error("Failed to find server session class. Specify the property '" + DefaultServerSessionFactory.PROP_QN_SESSION + "' in config.ini accordingly.");
- return null;
- }
-
- String fqn = bundle.getSymbolicName() + ".ServerSession";
- serverSessionClass = loadServerSessionSafe(bundle, fqn);
- if (serverSessionClass == null) {
- LOG.error("Failed to load server session class '" + fqn + "' from bundle '" + bundle.getSymbolicName() + "'. Specify the property '" + DefaultServerSessionFactory.PROP_QN_SESSION + "' in config.ini accordingly.");
- return null;
- }
- return serverSessionClass;
- }
-
- private static Bundle findServletContributorBundle() {
- try {
- BundleContext context = Activator.getDefault().getBundle().getBundleContext();
- ServiceReference ref = context.getServiceReference(IExtensionRegistry.class.getName());
- if (ref == null) {
- return null;
- }
- IExtensionRegistry reg = (IExtensionRegistry) context.getService(ref);
- if (reg == null) {
- return null;
- }
- IExtensionPoint xpServlet = reg.getExtensionPoint("org.eclipse.equinox.http.registry.servlets");
- if (xpServlet == null) {
- return null;
- }
- Set<Bundle> serviceTunnelContributorBundles = new HashSet<Bundle>();
- for (IExtension xServlet : xpServlet.getExtensions()) {
- for (IConfigurationElement cServlet : xServlet.getConfigurationElements()) {
- if (cServlet.getName().equals("servlet")) {
- String servletFqn = cServlet.getAttribute("class");
- Bundle bundle = Platform.getBundle(cServlet.getContributor().getName());
- try {
- Class servletClass = bundle.loadClass(servletFqn);
- if (ServiceTunnelServlet.class.isAssignableFrom(servletClass)) {
- serviceTunnelContributorBundles.add(bundle);
- }
- }
- catch (ClassNotFoundException e) {
- // nop
- }
- }
- }
- }
-
- int count = serviceTunnelContributorBundles.size();
- if (count == 1) {
- return serviceTunnelContributorBundles.iterator().next();
- }
- else if (count == 0) {
- LOG.warn("No contribution bundle found for servlet '" + ServiceTunnelServlet.class.getSimpleName() + "'");
- }
- else {
- LOG.warn("Multiple contribution bundles found for servlet '" + ServiceTunnelServlet.class.getSimpleName() + "'.");
- }
- }
- catch (Throwable e) {
- LOG.error("failed to find servlet contributor", e);
- }
- return null;
- }
-
- private static Class<? extends IServerSession> resolveJaxWsServerSession() {
- String qnSession = Activator.getDefault().getBundle().getBundleContext().getProperty(DefaultServerSessionFactory.PROP_QN_SESSION);
- String snBundle = Activator.getDefault().getBundle().getBundleContext().getProperty(DefaultServerSessionFactory.PROP_SN_BUNDLE);
-
- if (!StringUtility.hasText(qnSession)) {
- return null;
- }
-
- if (!StringUtility.hasText(snBundle) && qnSession.split("\\.").length == 0) {
- LOG.error("Session class '" + qnSession + "' configured in config.ini '" + DefaultServerSessionFactory.PROP_QN_SESSION + "' must be fully qualified if not used in conjunction with belonging bundle '" + snBundle + "'.");
- return null;
- }
-
- Bundle bundle;
- if (StringUtility.hasText(snBundle)) {
- bundle = Platform.getBundle(snBundle);
- if (bundle == null) {
- LOG.error("Bundle with the symbolic name '" + snBundle + "' configured in config.ini '" + DefaultServerSessionFactory.PROP_SN_BUNDLE + "' could not be resolved. Please ensure to have typed the symbolic name correctly and that the bundle is resolved without errors.");
- return null;
- }
- }
- else {
- String symbolicName = qnSession.substring(0, qnSession.lastIndexOf('.'));
- bundle = Platform.getBundle(symbolicName);
- if (bundle == null) {
- LOG.error("Bundle with the symbolic name '" + symbolicName + "' configured in config.ini could not be found. The attempt to derive the symbolic name from within the configured session '" + DefaultServerSessionFactory.PROP_QN_SESSION + "' failed. If the package name of the session does not correspond to the symbolic name of the bundle, please specify '" + DefaultServerSessionFactory.PROP_SN_BUNDLE + "' accordingly.");
- return null;
- }
- }
-
- return loadServerSessionSafe(bundle, qnSession);
- }
-
- @SuppressWarnings("unchecked")
- private static Class<? extends IServerSession> loadServerSessionSafe(Bundle bundle, String serverSessionFqn) {
- try {
- Class clazz = bundle.loadClass(serverSessionFqn);
- if (IServerSession.class.isAssignableFrom(clazz)) {
- return clazz;
- }
- LOG.error("Server session class '" + serverSessionFqn + "' could not be loaded as not of the type '" + IServerSession.class.getName() + "'");
- }
- catch (ClassNotFoundException e) {
- LOG.error("Server session class '" + serverSessionFqn + "' could not be found");
- }
- return null;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.jaxws.session;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.jaxws.Activator;
+import org.eclipse.scout.rt.server.IServerSession;
+import org.eclipse.scout.rt.server.ServiceTunnelServlet;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+
+public class ServerSessionClassFinder {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(ServerSessionClassFinder.class);
+
+ /**
+ * Tries to find the server session class based on several approaches:
+ * <ol>
+ * <li>based on config.ini parameters {@link PROP_QN_SESSION} and {@link PROP_SN_BUNDLE}</li>
+ * <li>based on default-naming-convention in bundle of servlet contributor for {@link ServiceTunnelServlet}</li>
+ * </ol>
+ *
+ * @return the found server session class or null if not found
+ */
+ public static Class<? extends IServerSession> find() {
+ // try to resolve session based on JAX-WS specific properties in config.ini
+ Class<? extends IServerSession> serverSessionClass = resolveJaxWsServerSession();
+ if (serverSessionClass != null) {
+ return serverSessionClass;
+ }
+
+ // try by-convention-approach
+ Bundle bundle = findServletContributorBundle();
+ if (bundle == null) {
+ LOG.error("Failed to find server session class. Specify the property '" + DefaultServerSessionFactory.PROP_QN_SESSION + "' in config.ini accordingly.");
+ return null;
+ }
+
+ String fqn = bundle.getSymbolicName() + ".ServerSession";
+ serverSessionClass = loadServerSessionSafe(bundle, fqn);
+ if (serverSessionClass == null) {
+ LOG.error("Failed to load server session class '" + fqn + "' from bundle '" + bundle.getSymbolicName() + "'. Specify the property '" + DefaultServerSessionFactory.PROP_QN_SESSION + "' in config.ini accordingly.");
+ return null;
+ }
+ return serverSessionClass;
+ }
+
+ private static Bundle findServletContributorBundle() {
+ try {
+ BundleContext context = Activator.getDefault().getBundle().getBundleContext();
+ ServiceReference ref = context.getServiceReference(IExtensionRegistry.class.getName());
+ if (ref == null) {
+ return null;
+ }
+ IExtensionRegistry reg = (IExtensionRegistry) context.getService(ref);
+ if (reg == null) {
+ return null;
+ }
+ IExtensionPoint xpServlet = reg.getExtensionPoint("org.eclipse.equinox.http.registry.servlets");
+ if (xpServlet == null) {
+ return null;
+ }
+ Set<Bundle> serviceTunnelContributorBundles = new HashSet<Bundle>();
+ for (IExtension xServlet : xpServlet.getExtensions()) {
+ for (IConfigurationElement cServlet : xServlet.getConfigurationElements()) {
+ if (cServlet.getName().equals("servlet")) {
+ String servletFqn = cServlet.getAttribute("class");
+ Bundle bundle = Platform.getBundle(cServlet.getContributor().getName());
+ try {
+ Class servletClass = bundle.loadClass(servletFqn);
+ if (ServiceTunnelServlet.class.isAssignableFrom(servletClass)) {
+ serviceTunnelContributorBundles.add(bundle);
+ }
+ }
+ catch (ClassNotFoundException e) {
+ // nop
+ }
+ }
+ }
+ }
+
+ int count = serviceTunnelContributorBundles.size();
+ if (count == 1) {
+ return serviceTunnelContributorBundles.iterator().next();
+ }
+ else if (count == 0) {
+ LOG.warn("No contribution bundle found for servlet '" + ServiceTunnelServlet.class.getSimpleName() + "'");
+ }
+ else {
+ LOG.warn("Multiple contribution bundles found for servlet '" + ServiceTunnelServlet.class.getSimpleName() + "'.");
+ }
+ }
+ catch (Throwable e) {
+ LOG.error("failed to find servlet contributor", e);
+ }
+ return null;
+ }
+
+ private static Class<? extends IServerSession> resolveJaxWsServerSession() {
+ String qnSession = Activator.getDefault().getBundle().getBundleContext().getProperty(DefaultServerSessionFactory.PROP_QN_SESSION);
+ String snBundle = Activator.getDefault().getBundle().getBundleContext().getProperty(DefaultServerSessionFactory.PROP_SN_BUNDLE);
+
+ if (!StringUtility.hasText(qnSession)) {
+ return null;
+ }
+
+ if (!StringUtility.hasText(snBundle) && qnSession.split("\\.").length == 0) {
+ LOG.error("Session class '" + qnSession + "' configured in config.ini '" + DefaultServerSessionFactory.PROP_QN_SESSION + "' must be fully qualified if not used in conjunction with belonging bundle '" + snBundle + "'.");
+ return null;
+ }
+
+ Bundle bundle;
+ if (StringUtility.hasText(snBundle)) {
+ bundle = Platform.getBundle(snBundle);
+ if (bundle == null) {
+ LOG.error("Bundle with the symbolic name '" + snBundle + "' configured in config.ini '" + DefaultServerSessionFactory.PROP_SN_BUNDLE + "' could not be resolved. Please ensure to have typed the symbolic name correctly and that the bundle is resolved without errors.");
+ return null;
+ }
+ }
+ else {
+ String symbolicName = qnSession.substring(0, qnSession.lastIndexOf('.'));
+ bundle = Platform.getBundle(symbolicName);
+ if (bundle == null) {
+ LOG.error("Bundle with the symbolic name '" + symbolicName + "' configured in config.ini could not be found. The attempt to derive the symbolic name from within the configured session '" + DefaultServerSessionFactory.PROP_QN_SESSION + "' failed. If the package name of the session does not correspond to the symbolic name of the bundle, please specify '" + DefaultServerSessionFactory.PROP_SN_BUNDLE + "' accordingly.");
+ return null;
+ }
+ }
+
+ return loadServerSessionSafe(bundle, qnSession);
+ }
+
+ @SuppressWarnings("unchecked")
+ private static Class<? extends IServerSession> loadServerSessionSafe(Bundle bundle, String serverSessionFqn) {
+ try {
+ Class clazz = bundle.loadClass(serverSessionFqn);
+ if (IServerSession.class.isAssignableFrom(clazz)) {
+ return clazz;
+ }
+ LOG.error("Server session class '" + serverSessionFqn + "' could not be loaded as not of the type '" + IServerSession.class.getName() + "'");
+ }
+ catch (ClassNotFoundException e) {
+ LOG.error("Server session class '" + serverSessionFqn + "' could not be found");
+ }
+ return null;
+ }
+}
diff --git a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/tool/JaxWsStubGenerator.java b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/tool/JaxWsStubGenerator.java
index a50e3318a7..c99140e0ae 100644
--- a/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/tool/JaxWsStubGenerator.java
+++ b/org.eclipse.scout.jaxws216/src/org/eclipse/scout/jaxws/tool/JaxWsStubGenerator.java
@@ -1,522 +1,522 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.jaxws.tool;
-
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.FilenameFilter;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.io.UnsupportedEncodingException;
-import java.lang.reflect.Constructor;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import javax.tools.JavaCompiler;
-import javax.tools.ToolProvider;
-
-import org.eclipse.core.runtime.Path;
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.commons.FileUtility;
-import org.eclipse.scout.commons.IOUtility;
-import org.eclipse.scout.commons.StringUtility;
-import org.xml.sax.SAXParseException;
-
-import com.sun.tools.internal.ws.processor.model.Model;
-import com.sun.tools.internal.ws.processor.model.Port;
-import com.sun.tools.internal.ws.processor.model.Service;
-import com.sun.tools.internal.ws.processor.modeler.wsdl.WSDLModeler;
-import com.sun.tools.internal.ws.wscompile.AbortException;
-import com.sun.tools.internal.ws.wscompile.ErrorReceiver;
-import com.sun.tools.internal.ws.wscompile.WsimportOptions;
-import com.sun.tools.internal.ws.wscompile.WsimportTool;
-import com.sun.tools.internal.ws.wsdl.parser.MetadataFinder;
-import com.sun.tools.internal.ws.wsdl.parser.WSDLInternalizationLogic;
-
-/**
- * <p>
- * This class is a wrapper for {@link WsimportTool} to generate a JAX-WS stub.
- * </p>
- * <p>
- * In order to make this class work, the JAR 'tools.jar' must be added to the classpath.
- * </p>
- * <b>Usage:</b><br/>
- * Provide '<cod>help</code>' as first argument to see detailed usage information.
- * <table>
- * <tr>
- * <td valign="top">arg[0]</td>
- * <td>Output directory where to place generated files. This might be a project relative or an absolute path. If it is a
- * file of the type jar, the generated files are put into that archive.<br/>
- * <i>E.g. ws-stub/xy.jar</i></td>
- * </tr>
- * <tr>
- * <td valign="top">arg[1]</td>
- * <td>WSDL file location (project relative)<br/>
- * <i>E.g. WEB-INF/wsdl/xy.wsdl</i></td>
- * </tr>
- * <tr>
- * <td valign="top">arg[2]</td>
- * <td>1 to applies patches, 0 to not apply patches</td>
- * </tr>
- * <tr>
- * <td valign="top">arg[3..x]</td>
- * <td>further options<br/>
- * This can be key-value pairs in the form of <code>KEY=VALUE</code> or simple directives</td>
- * </tr>
- * </table>
- * In order to run the program, follow the subsequent instructions within your Eclipse IDE:
- * <ol>
- * <li>Open this class (CTRL-T > JaxWsStubGenerator)</li>
- * <li>Right-click on the class, choose 'Run As | Run Configurations...' to open the run-configuration</li>
- * <li>In the tab 'Main', choose your Project</li>
- * <li>In the tab 'Arguments', enter the stub generation options. For instance, that could be as follow:</br>
- * <ul>
- * <li>ws-stub/xy.jar (output directory or output JAR-file)</li>
- * <li>WEB-INF/wsdl/xy.wsdl (project relative path to your WSDL file)</li>
- * <li>1</li>
- * <li>verbose</li>
- * <li>Xdebug</li>
- * <li>target=2.0</li>
- * <li>keep</li>
- * </ul>
- * </li>
- * <li>In the tab 'Classpath', add a 'User Entry' and choose 'Add external JARS's...'. Then select the tools.jar from
- * within your Java SDK installation in its lib folder.</li>
- * <li>Then you are done and can run the program</li>
- * <li>Please note, that you manually have to refresh the output Eclipse folders</li>
- * </ol>
- */
-public class JaxWsStubGenerator {
-
- private static final int ARG_OUT_DIR = 0;
- private static final int ARG_WSDL_FILE = 1;
- private static final int ARG_APPLY_PATCH = 2;
-
- private static final String FILE_PATH_SEPARATOR = System.getProperty("file.separator");
- private static final String LINE_SEPARATOR = System.getProperty("line.separator");
-
- public static void main(String[] args) throws Exception {
- if ((args.length > 0 && CompareUtility.equals(args[0], "help")) || args.length < 3) {
- logInfo("Usage:");
- logInfo("arg[" + ARG_OUT_DIR + "] output directory where to place generated files. This might be a project relative or an absolute path. If it is a file of the type jar, the generated files are put into that archive.");
- logInfo("arg[" + ARG_WSDL_FILE + "] project relative path to WSDL");
- logInfo("arg[" + ARG_APPLY_PATCH + "] apply patches to stub source");
- logInfo("arg[..] other options");
- logInfo("[options supported in build file]");
-
- // print help of WsImportTool
- ByteArrayOutputStream os = new ByteArrayOutputStream();
- new WsimportTool(os).run(new String[]{"-help"});
- logInfo(os);
- return;
- }
-
- String wsdlLocation = args[ARG_WSDL_FILE];
- if (wsdlLocation.startsWith(FILE_PATH_SEPARATOR)) {
- wsdlLocation = wsdlLocation.substring(1);
- }
-
- String outDir = null;
- String jarFileName = null;
-
- // prepare output directory
- Path outPath = new Path(args[ARG_OUT_DIR]);
- File tempOutDir = null;
- String suffix = outPath.getFileExtension();
- if (suffix != null && suffix.equalsIgnoreCase("jar")) {
- jarFileName = outPath.lastSegment();
- outDir = outPath.removeLastSegments(1).toPortableString();
- }
- else {
- outDir = outPath.toPortableString();
- }
- new File(outDir).mkdirs();
-
- // instrument with output directory
- List<String> properties = new LinkedList<String>();
-
- // instrument with WSDL file
- properties.add("-wsdllocation");
- properties.add(wsdlLocation);
-
- // instrument with other options
- boolean noCompile = false;
-
- for (int i = 3; i < args.length; i++) {
- String directive = args[i];
- if (directive == null || directive.trim().length() == 0) {
- continue;
- }
- String[] property = directive.split("=", 2);
-
- // omit output directories as set by args[0]
- String key = property[0].trim();
- if (key.equals("s") ||
- key.equals("d")) {
- continue;
- }
-
- // check for compilation
- if (key.equals("Xnocompile")) {
- noCompile = true;
- }
-
- String param = "-" + key;
- if (property.length == 2 && property[1].trim().length() > 0) {
- String value = property[1].trim();
- properties.add(param);
- properties.add(value);
- logInfo("JAX-WS option: " + StringUtility.join(" ", param, value));
- }
- else {
- properties.add(param);
- logInfo("JAX-WS directive: " + param);
- }
- }
-
- boolean createJarFile = (jarFileName != null);
-
- // instrument with output directory
- if (createJarFile) {
- tempOutDir = IOUtility.createTempDirectory(null);
- properties.add("-d");
- properties.add(tempOutDir.getAbsolutePath());
- }
- else {
- properties.add("-d");
- properties.add(outDir);
- }
-
- // instrument to not compile the source files as source code fixes have to be applied first
- properties.add("-Xnocompile");
-
- // instrument with WSDL location to be referenced in stub code
- properties.add(wsdlLocation);
-
- // generate stub
- String[] propertyArray = properties.toArray(new String[properties.size()]);
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- boolean status = new WsimportTool(bos).run(propertyArray);
- if (status) {
- // success
- File stubOutDir;
- if (createJarFile) {
- stubOutDir = tempOutDir;
- }
- else {
- stubOutDir = new File(outDir);
- }
-
- // check that stub files were generated
- if (stubOutDir == null || stubOutDir.list() == null || stubOutDir.list().length == 0) {
- logError("No JAX-WS stub files generated");
- throw new Exception("No JAX-WS stub files generated.");
- }
-
- // fix resource loading
- if (Integer.valueOf(args[ARG_APPLY_PATCH]) > 0) {
- patchSourceCodeWsdlResources(stubOutDir);
- }
-
- // compile java files
- if (!noCompile) {
- compile(stubOutDir);
- }
-
- // create JAR-archive
- if (createJarFile) {
- createJarArchive(stubOutDir, outDir, jarFileName);
- }
-
- logInfo("JAX-WS stub generation completed. For debugging purpose, please see the following debug output.");
- logInfo(bos);
- printModelInformation(propertyArray);
- }
- else {
- logInfo("JAX-WS stub generation failed.");
- logError(bos);
- throw new Exception("JAX-WS stub generation failed."); // do not remove as Scout SDK expects an exit status different to 0 in case of a failure.
- }
- }
-
- private static void patchSourceCodeWsdlResources(File folder) {
- Pattern pattern = Pattern.compile("\\.class\\.getResource\\(\\s*\"\\.\"\\s*\\)");
- File[] javaFiles = getAllJavaFiles(folder);
- for (File javaFile : javaFiles) {
- try {
- String content = IOUtility.getContent(new FileReader(javaFile), true);
- Matcher matcher = pattern.matcher(content);
- if (matcher.find()) {
- content = matcher.replaceAll(".class.getResource(\"/\")");
- IOUtility.writeContent(new FileWriter(javaFile), content);
- logInfo("Code fix (WSDL resource finding) applied to " + javaFile.getName());
- }
- }
- catch (Throwable t) {
- logError("Failed to apply code fix (WSDL resource finding) in '" + javaFile.getName() + "'", t);
- }
- }
- }
-
- private static void createJarArchive(File tempOutDir, String outDirPath, String jarFileName) {
- if (jarFileName == null) {
- return;
- }
-
- try {
- // create archive from created files
- if (!outDirPath.endsWith(FILE_PATH_SEPARATOR)) {
- outDirPath = outDirPath + FILE_PATH_SEPARATOR;
- }
- File jarFile = IOUtility.toFile(outDirPath + jarFileName);
- if (jarFile.exists()) {
- jarFile.delete();
- }
- jarFile.createNewFile();
-
- File metaInfFolder = new File(tempOutDir, "META-INF");
- metaInfFolder.mkdir();
-
- File manifestFile = new File(metaInfFolder, "MANIFEST.MF");
- manifestFile.createNewFile();
- FileWriter fileWriter = new FileWriter(manifestFile);
- fileWriter.write("Manifest-Version: 1.0");
- fileWriter.flush();
- fileWriter.close();
-
- FileUtility.compressArchive(tempOutDir, jarFile);
-
- logInfo("Stub JAR-file '" + jarFileName + "' created");
- }
- catch (Throwable t) {
- logError("Failed to create stub JAR-file '" + jarFileName + "'", t);
- }
- }
-
- private static void compile(File folder) {
- try {
- File[] javaFiles = getAllJavaFiles(folder);
-
- // create dictionary containing all classes to be compiled
- File classesDictionary = IOUtility.createTempFile("classes", null, null);
- FileWriter fileWriter = new FileWriter(classesDictionary);
- for (int i = 0; i < javaFiles.length; i++) {
- if (i > 0) {
- fileWriter.write(LINE_SEPARATOR);
- }
- fileWriter.write(javaFiles[i].getAbsolutePath());
- }
- fileWriter.flush();
- fileWriter.close();
-
- // create dictionary containing options for compiling process
- File optionsDictionary = IOUtility.createTempFile("options", null, null);
- fileWriter = new FileWriter(optionsDictionary);
- fileWriter.flush();
- fileWriter.close();
-
- // start compilation
- JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
- int status = compiler.run(System.in, System.out, System.err, "@" + optionsDictionary.getAbsolutePath(), "@" + classesDictionary.getAbsolutePath());
- if (status == 0) {
- logInfo("All the " + javaFiles.length + " stub files compiled");
- }
- else {
- logError("Failed to compile JAX-WS stub files");
- }
- }
- catch (Throwable t) {
- logError("Failed to compile JAX-WS stub files", t);
- }
- }
-
- private static File[] getAllJavaFiles(File folder) {
- List<File> files = new ArrayList<File>();
-
- if (!folder.isDirectory()) {
- return new File[0];
- }
-
- File[] ff = folder.listFiles(new FilenameFilter() {
-
- @Override
- public boolean accept(File dir, String name) {
- // filter for directories and java files
- return new File(dir, name).isDirectory() || name.endsWith(".java");
- }
- });
-
- for (File f : ff) {
- if (f.isDirectory()) {
- files.addAll(Arrays.asList(getAllJavaFiles(f)));
- }
- else {
- files.add(f);
- }
- }
- return files.toArray(new File[files.size()]);
- }
-
- /**
- * Print information about WSDL
- *
- * @param properties
- * @param logger
- */
- private static void printModelInformation(String[] properties) {
- try {
- WsimportOptions options = new WsimportOptions();
- options.parseArguments(properties);
-
- ErrorReceiver receiver = new ErrorReceiver() {
- @Override
- public void warning(SAXParseException saxparseexception) throws AbortException {
- logInfo(saxparseexception.toString());
- }
-
- @Override
- public void info(SAXParseException saxparseexception) {
- logInfo(saxparseexception.toString());
- }
-
- @Override
- public void fatalError(SAXParseException saxparseexception) throws AbortException {
- logError(saxparseexception.toString());
- }
-
- @Override
- public void error(SAXParseException saxparseexception) throws AbortException {
- logError(saxparseexception.toString());
- }
-
- @Override
- public void debug(SAXParseException saxparseexception) {
- }
- };
-
- MetadataFinder forest = new MetadataFinder(new WSDLInternalizationLogic(), options, receiver);
- WSDLModeler wsdlModeler = createWsdlModeler(options, receiver, forest);
- if (wsdlModeler == null) {
- logInfo("WSDLModeler could not be created to display service properties");
- return;
- }
- Model wsdlModel = wsdlModeler.buildModel();
-
- if (wsdlModel == null) {
- logInfo("WSDL model could not be parsed to display service properties");
- return;
- }
-
- if (wsdlModel.getName() != null) {
- logInfo("wsdl model name=" + wsdlModel.getName().getLocalPart());
- }
- logInfo("targetNamespace=" + wsdlModel.getTargetNamespaceURI());
-
- List<Service> services = wsdlModel.getServices();
- for (Service service : services) {
- logInfo("service=" + service.getName());
-
- List<Port> ports = service.getPorts();
- for (Port port : ports) {
- logInfo(" port=" + port.getName());
- }
- }
- }
- catch (Throwable e) {
- logError("WSDL model could not be parsed to display service properties: " + e.getMessage());
- }
- }
-
- private static WSDLModeler createWsdlModeler(WsimportOptions options, ErrorReceiver receiver, MetadataFinder forest) {
- for (Constructor c : WSDLModeler.class.getConstructors()) {
- try {
- Class<?>[] paramTypes = c.getParameterTypes();
- if (paramTypes.length == 2 &&
- paramTypes[0].isAssignableFrom(WsimportOptions.class) &&
- paramTypes[1].isAssignableFrom(ErrorReceiver.class)) {
- // <= JRE6
- return (WSDLModeler) c.newInstance(options, receiver);
- }
- else if (paramTypes.length == 3 &&
- paramTypes[0].isAssignableFrom(WsimportOptions.class) &&
- paramTypes[1].isAssignableFrom(ErrorReceiver.class) &&
- paramTypes[2].isAssignableFrom(MetadataFinder.class)) {
- // >= JRE7
- return (WSDLModeler) c.newInstance(options, receiver, forest);
- }
- }
- catch (Exception e) {
- logError("Error creating WSDLModeler: " + e.getMessage());
- }
- }
- return null;
- }
-
- private static void logInfo(String message) {
- System.out.println("[INFO] " + message);
- }
-
- private static void logInfo(ByteArrayOutputStream os) {
- System.out.println("[INFO] " + convertToString(os));
- }
-
- private static void logError(String message) {
- System.err.println("[ERROR] " + message);
- }
-
- private static void logError(ByteArrayOutputStream os) {
- System.err.println("[ERROR] " + convertToString(os));
- }
-
- private static void logError(String message, Throwable t) {
- if (message != null) {
- System.err.println("[ERROR] " + getStacktrace(t));
- }
- else {
- System.err.println("[ERROR] " + message + LINE_SEPARATOR + getStacktrace(t));
- }
- }
-
- private static String convertToString(ByteArrayOutputStream os) {
- try {
- return os.toString("UTF-8");
- }
- catch (UnsupportedEncodingException e) {
- return "Could not access log message due to unsupported encoding.";
- }
- }
-
- private static String getStacktrace(Throwable t) {
- if (t == null) {
- return null;
- }
- StringWriter writer = new StringWriter();
- t.printStackTrace(new PrintWriter(writer));
- return writer.toString();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.jaxws.tool;
+
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.FilenameFilter;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.io.UnsupportedEncodingException;
+import java.lang.reflect.Constructor;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.tools.JavaCompiler;
+import javax.tools.ToolProvider;
+
+import org.eclipse.core.runtime.Path;
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.commons.FileUtility;
+import org.eclipse.scout.commons.IOUtility;
+import org.eclipse.scout.commons.StringUtility;
+import org.xml.sax.SAXParseException;
+
+import com.sun.tools.internal.ws.processor.model.Model;
+import com.sun.tools.internal.ws.processor.model.Port;
+import com.sun.tools.internal.ws.processor.model.Service;
+import com.sun.tools.internal.ws.processor.modeler.wsdl.WSDLModeler;
+import com.sun.tools.internal.ws.wscompile.AbortException;
+import com.sun.tools.internal.ws.wscompile.ErrorReceiver;
+import com.sun.tools.internal.ws.wscompile.WsimportOptions;
+import com.sun.tools.internal.ws.wscompile.WsimportTool;
+import com.sun.tools.internal.ws.wsdl.parser.MetadataFinder;
+import com.sun.tools.internal.ws.wsdl.parser.WSDLInternalizationLogic;
+
+/**
+ * <p>
+ * This class is a wrapper for {@link WsimportTool} to generate a JAX-WS stub.
+ * </p>
+ * <p>
+ * In order to make this class work, the JAR 'tools.jar' must be added to the classpath.
+ * </p>
+ * <b>Usage:</b><br/>
+ * Provide '<cod>help</code>' as first argument to see detailed usage information.
+ * <table>
+ * <tr>
+ * <td valign="top">arg[0]</td>
+ * <td>Output directory where to place generated files. This might be a project relative or an absolute path. If it is a
+ * file of the type jar, the generated files are put into that archive.<br/>
+ * <i>E.g. ws-stub/xy.jar</i></td>
+ * </tr>
+ * <tr>
+ * <td valign="top">arg[1]</td>
+ * <td>WSDL file location (project relative)<br/>
+ * <i>E.g. WEB-INF/wsdl/xy.wsdl</i></td>
+ * </tr>
+ * <tr>
+ * <td valign="top">arg[2]</td>
+ * <td>1 to applies patches, 0 to not apply patches</td>
+ * </tr>
+ * <tr>
+ * <td valign="top">arg[3..x]</td>
+ * <td>further options<br/>
+ * This can be key-value pairs in the form of <code>KEY=VALUE</code> or simple directives</td>
+ * </tr>
+ * </table>
+ * In order to run the program, follow the subsequent instructions within your Eclipse IDE:
+ * <ol>
+ * <li>Open this class (CTRL-T > JaxWsStubGenerator)</li>
+ * <li>Right-click on the class, choose 'Run As | Run Configurations...' to open the run-configuration</li>
+ * <li>In the tab 'Main', choose your Project</li>
+ * <li>In the tab 'Arguments', enter the stub generation options. For instance, that could be as follow:</br>
+ * <ul>
+ * <li>ws-stub/xy.jar (output directory or output JAR-file)</li>
+ * <li>WEB-INF/wsdl/xy.wsdl (project relative path to your WSDL file)</li>
+ * <li>1</li>
+ * <li>verbose</li>
+ * <li>Xdebug</li>
+ * <li>target=2.0</li>
+ * <li>keep</li>
+ * </ul>
+ * </li>
+ * <li>In the tab 'Classpath', add a 'User Entry' and choose 'Add external JARS's...'. Then select the tools.jar from
+ * within your Java SDK installation in its lib folder.</li>
+ * <li>Then you are done and can run the program</li>
+ * <li>Please note, that you manually have to refresh the output Eclipse folders</li>
+ * </ol>
+ */
+public class JaxWsStubGenerator {
+
+ private static final int ARG_OUT_DIR = 0;
+ private static final int ARG_WSDL_FILE = 1;
+ private static final int ARG_APPLY_PATCH = 2;
+
+ private static final String FILE_PATH_SEPARATOR = System.getProperty("file.separator");
+ private static final String LINE_SEPARATOR = System.getProperty("line.separator");
+
+ public static void main(String[] args) throws Exception {
+ if ((args.length > 0 && CompareUtility.equals(args[0], "help")) || args.length < 3) {
+ logInfo("Usage:");
+ logInfo("arg[" + ARG_OUT_DIR + "] output directory where to place generated files. This might be a project relative or an absolute path. If it is a file of the type jar, the generated files are put into that archive.");
+ logInfo("arg[" + ARG_WSDL_FILE + "] project relative path to WSDL");
+ logInfo("arg[" + ARG_APPLY_PATCH + "] apply patches to stub source");
+ logInfo("arg[..] other options");
+ logInfo("[options supported in build file]");
+
+ // print help of WsImportTool
+ ByteArrayOutputStream os = new ByteArrayOutputStream();
+ new WsimportTool(os).run(new String[]{"-help"});
+ logInfo(os);
+ return;
+ }
+
+ String wsdlLocation = args[ARG_WSDL_FILE];
+ if (wsdlLocation.startsWith(FILE_PATH_SEPARATOR)) {
+ wsdlLocation = wsdlLocation.substring(1);
+ }
+
+ String outDir = null;
+ String jarFileName = null;
+
+ // prepare output directory
+ Path outPath = new Path(args[ARG_OUT_DIR]);
+ File tempOutDir = null;
+ String suffix = outPath.getFileExtension();
+ if (suffix != null && suffix.equalsIgnoreCase("jar")) {
+ jarFileName = outPath.lastSegment();
+ outDir = outPath.removeLastSegments(1).toPortableString();
+ }
+ else {
+ outDir = outPath.toPortableString();
+ }
+ new File(outDir).mkdirs();
+
+ // instrument with output directory
+ List<String> properties = new LinkedList<String>();
+
+ // instrument with WSDL file
+ properties.add("-wsdllocation");
+ properties.add(wsdlLocation);
+
+ // instrument with other options
+ boolean noCompile = false;
+
+ for (int i = 3; i < args.length; i++) {
+ String directive = args[i];
+ if (directive == null || directive.trim().length() == 0) {
+ continue;
+ }
+ String[] property = directive.split("=", 2);
+
+ // omit output directories as set by args[0]
+ String key = property[0].trim();
+ if (key.equals("s") ||
+ key.equals("d")) {
+ continue;
+ }
+
+ // check for compilation
+ if (key.equals("Xnocompile")) {
+ noCompile = true;
+ }
+
+ String param = "-" + key;
+ if (property.length == 2 && property[1].trim().length() > 0) {
+ String value = property[1].trim();
+ properties.add(param);
+ properties.add(value);
+ logInfo("JAX-WS option: " + StringUtility.join(" ", param, value));
+ }
+ else {
+ properties.add(param);
+ logInfo("JAX-WS directive: " + param);
+ }
+ }
+
+ boolean createJarFile = (jarFileName != null);
+
+ // instrument with output directory
+ if (createJarFile) {
+ tempOutDir = IOUtility.createTempDirectory(null);
+ properties.add("-d");
+ properties.add(tempOutDir.getAbsolutePath());
+ }
+ else {
+ properties.add("-d");
+ properties.add(outDir);
+ }
+
+ // instrument to not compile the source files as source code fixes have to be applied first
+ properties.add("-Xnocompile");
+
+ // instrument with WSDL location to be referenced in stub code
+ properties.add(wsdlLocation);
+
+ // generate stub
+ String[] propertyArray = properties.toArray(new String[properties.size()]);
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ boolean status = new WsimportTool(bos).run(propertyArray);
+ if (status) {
+ // success
+ File stubOutDir;
+ if (createJarFile) {
+ stubOutDir = tempOutDir;
+ }
+ else {
+ stubOutDir = new File(outDir);
+ }
+
+ // check that stub files were generated
+ if (stubOutDir == null || stubOutDir.list() == null || stubOutDir.list().length == 0) {
+ logError("No JAX-WS stub files generated");
+ throw new Exception("No JAX-WS stub files generated.");
+ }
+
+ // fix resource loading
+ if (Integer.valueOf(args[ARG_APPLY_PATCH]) > 0) {
+ patchSourceCodeWsdlResources(stubOutDir);
+ }
+
+ // compile java files
+ if (!noCompile) {
+ compile(stubOutDir);
+ }
+
+ // create JAR-archive
+ if (createJarFile) {
+ createJarArchive(stubOutDir, outDir, jarFileName);
+ }
+
+ logInfo("JAX-WS stub generation completed. For debugging purpose, please see the following debug output.");
+ logInfo(bos);
+ printModelInformation(propertyArray);
+ }
+ else {
+ logInfo("JAX-WS stub generation failed.");
+ logError(bos);
+ throw new Exception("JAX-WS stub generation failed."); // do not remove as Scout SDK expects an exit status different to 0 in case of a failure.
+ }
+ }
+
+ private static void patchSourceCodeWsdlResources(File folder) {
+ Pattern pattern = Pattern.compile("\\.class\\.getResource\\(\\s*\"\\.\"\\s*\\)");
+ File[] javaFiles = getAllJavaFiles(folder);
+ for (File javaFile : javaFiles) {
+ try {
+ String content = IOUtility.getContent(new FileReader(javaFile), true);
+ Matcher matcher = pattern.matcher(content);
+ if (matcher.find()) {
+ content = matcher.replaceAll(".class.getResource(\"/\")");
+ IOUtility.writeContent(new FileWriter(javaFile), content);
+ logInfo("Code fix (WSDL resource finding) applied to " + javaFile.getName());
+ }
+ }
+ catch (Throwable t) {
+ logError("Failed to apply code fix (WSDL resource finding) in '" + javaFile.getName() + "'", t);
+ }
+ }
+ }
+
+ private static void createJarArchive(File tempOutDir, String outDirPath, String jarFileName) {
+ if (jarFileName == null) {
+ return;
+ }
+
+ try {
+ // create archive from created files
+ if (!outDirPath.endsWith(FILE_PATH_SEPARATOR)) {
+ outDirPath = outDirPath + FILE_PATH_SEPARATOR;
+ }
+ File jarFile = IOUtility.toFile(outDirPath + jarFileName);
+ if (jarFile.exists()) {
+ jarFile.delete();
+ }
+ jarFile.createNewFile();
+
+ File metaInfFolder = new File(tempOutDir, "META-INF");
+ metaInfFolder.mkdir();
+
+ File manifestFile = new File(metaInfFolder, "MANIFEST.MF");
+ manifestFile.createNewFile();
+ FileWriter fileWriter = new FileWriter(manifestFile);
+ fileWriter.write("Manifest-Version: 1.0");
+ fileWriter.flush();
+ fileWriter.close();
+
+ FileUtility.compressArchive(tempOutDir, jarFile);
+
+ logInfo("Stub JAR-file '" + jarFileName + "' created");
+ }
+ catch (Throwable t) {
+ logError("Failed to create stub JAR-file '" + jarFileName + "'", t);
+ }
+ }
+
+ private static void compile(File folder) {
+ try {
+ File[] javaFiles = getAllJavaFiles(folder);
+
+ // create dictionary containing all classes to be compiled
+ File classesDictionary = IOUtility.createTempFile("classes", null, null);
+ FileWriter fileWriter = new FileWriter(classesDictionary);
+ for (int i = 0; i < javaFiles.length; i++) {
+ if (i > 0) {
+ fileWriter.write(LINE_SEPARATOR);
+ }
+ fileWriter.write(javaFiles[i].getAbsolutePath());
+ }
+ fileWriter.flush();
+ fileWriter.close();
+
+ // create dictionary containing options for compiling process
+ File optionsDictionary = IOUtility.createTempFile("options", null, null);
+ fileWriter = new FileWriter(optionsDictionary);
+ fileWriter.flush();
+ fileWriter.close();
+
+ // start compilation
+ JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
+ int status = compiler.run(System.in, System.out, System.err, "@" + optionsDictionary.getAbsolutePath(), "@" + classesDictionary.getAbsolutePath());
+ if (status == 0) {
+ logInfo("All the " + javaFiles.length + " stub files compiled");
+ }
+ else {
+ logError("Failed to compile JAX-WS stub files");
+ }
+ }
+ catch (Throwable t) {
+ logError("Failed to compile JAX-WS stub files", t);
+ }
+ }
+
+ private static File[] getAllJavaFiles(File folder) {
+ List<File> files = new ArrayList<File>();
+
+ if (!folder.isDirectory()) {
+ return new File[0];
+ }
+
+ File[] ff = folder.listFiles(new FilenameFilter() {
+
+ @Override
+ public boolean accept(File dir, String name) {
+ // filter for directories and java files
+ return new File(dir, name).isDirectory() || name.endsWith(".java");
+ }
+ });
+
+ for (File f : ff) {
+ if (f.isDirectory()) {
+ files.addAll(Arrays.asList(getAllJavaFiles(f)));
+ }
+ else {
+ files.add(f);
+ }
+ }
+ return files.toArray(new File[files.size()]);
+ }
+
+ /**
+ * Print information about WSDL
+ *
+ * @param properties
+ * @param logger
+ */
+ private static void printModelInformation(String[] properties) {
+ try {
+ WsimportOptions options = new WsimportOptions();
+ options.parseArguments(properties);
+
+ ErrorReceiver receiver = new ErrorReceiver() {
+ @Override
+ public void warning(SAXParseException saxparseexception) throws AbortException {
+ logInfo(saxparseexception.toString());
+ }
+
+ @Override
+ public void info(SAXParseException saxparseexception) {
+ logInfo(saxparseexception.toString());
+ }
+
+ @Override
+ public void fatalError(SAXParseException saxparseexception) throws AbortException {
+ logError(saxparseexception.toString());
+ }
+
+ @Override
+ public void error(SAXParseException saxparseexception) throws AbortException {
+ logError(saxparseexception.toString());
+ }
+
+ @Override
+ public void debug(SAXParseException saxparseexception) {
+ }
+ };
+
+ MetadataFinder forest = new MetadataFinder(new WSDLInternalizationLogic(), options, receiver);
+ WSDLModeler wsdlModeler = createWsdlModeler(options, receiver, forest);
+ if (wsdlModeler == null) {
+ logInfo("WSDLModeler could not be created to display service properties");
+ return;
+ }
+ Model wsdlModel = wsdlModeler.buildModel();
+
+ if (wsdlModel == null) {
+ logInfo("WSDL model could not be parsed to display service properties");
+ return;
+ }
+
+ if (wsdlModel.getName() != null) {
+ logInfo("wsdl model name=" + wsdlModel.getName().getLocalPart());
+ }
+ logInfo("targetNamespace=" + wsdlModel.getTargetNamespaceURI());
+
+ List<Service> services = wsdlModel.getServices();
+ for (Service service : services) {
+ logInfo("service=" + service.getName());
+
+ List<Port> ports = service.getPorts();
+ for (Port port : ports) {
+ logInfo(" port=" + port.getName());
+ }
+ }
+ }
+ catch (Throwable e) {
+ logError("WSDL model could not be parsed to display service properties: " + e.getMessage());
+ }
+ }
+
+ private static WSDLModeler createWsdlModeler(WsimportOptions options, ErrorReceiver receiver, MetadataFinder forest) {
+ for (Constructor c : WSDLModeler.class.getConstructors()) {
+ try {
+ Class<?>[] paramTypes = c.getParameterTypes();
+ if (paramTypes.length == 2 &&
+ paramTypes[0].isAssignableFrom(WsimportOptions.class) &&
+ paramTypes[1].isAssignableFrom(ErrorReceiver.class)) {
+ // <= JRE6
+ return (WSDLModeler) c.newInstance(options, receiver);
+ }
+ else if (paramTypes.length == 3 &&
+ paramTypes[0].isAssignableFrom(WsimportOptions.class) &&
+ paramTypes[1].isAssignableFrom(ErrorReceiver.class) &&
+ paramTypes[2].isAssignableFrom(MetadataFinder.class)) {
+ // >= JRE7
+ return (WSDLModeler) c.newInstance(options, receiver, forest);
+ }
+ }
+ catch (Exception e) {
+ logError("Error creating WSDLModeler: " + e.getMessage());
+ }
+ }
+ return null;
+ }
+
+ private static void logInfo(String message) {
+ System.out.println("[INFO] " + message);
+ }
+
+ private static void logInfo(ByteArrayOutputStream os) {
+ System.out.println("[INFO] " + convertToString(os));
+ }
+
+ private static void logError(String message) {
+ System.err.println("[ERROR] " + message);
+ }
+
+ private static void logError(ByteArrayOutputStream os) {
+ System.err.println("[ERROR] " + convertToString(os));
+ }
+
+ private static void logError(String message, Throwable t) {
+ if (message != null) {
+ System.err.println("[ERROR] " + getStacktrace(t));
+ }
+ else {
+ System.err.println("[ERROR] " + message + LINE_SEPARATOR + getStacktrace(t));
+ }
+ }
+
+ private static String convertToString(ByteArrayOutputStream os) {
+ try {
+ return os.toString("UTF-8");
+ }
+ catch (UnsupportedEncodingException e) {
+ return "Could not access log message due to unsupported encoding.";
+ }
+ }
+
+ private static String getStacktrace(Throwable t) {
+ if (t == null) {
+ return null;
+ }
+ StringWriter writer = new StringWriter();
+ t.printStackTrace(new PrintWriter(writer));
+ return writer.toString();
+ }
+}
diff --git a/org.eclipse.scout.net/.settings/org.eclipse.pde.core.prefs b/org.eclipse.scout.net/.settings/org.eclipse.pde.core.prefs
index baef13dd8c..a3a50fc8da 100644
--- a/org.eclipse.scout.net/.settings/org.eclipse.pde.core.prefs
+++ b/org.eclipse.scout.net/.settings/org.eclipse.pde.core.prefs
@@ -1,3 +1,3 @@
-#Mon Jul 11 16:16:00 CEST 2011
-eclipse.preferences.version=1
-pluginProject.extensions=true
+#Mon Jul 11 16:16:00 CEST 2011
+eclipse.preferences.version=1
+pluginProject.extensions=true
diff --git a/org.eclipse.scout.net/plugin.xml b/org.eclipse.scout.net/plugin.xml
index cf698d27bf..5394707949 100644
--- a/org.eclipse.scout.net/plugin.xml
+++ b/org.eclipse.scout.net/plugin.xml
@@ -1,17 +1,17 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<plugin>
-
- <extension id="app" point="org.eclipse.core.runtime.applications">
- <application>
- <run class="org.eclipse.scout.net.tests.TestApplication"/>
- </application>
- </extension>
-
- <extension id="product" point="org.eclipse.core.runtime.products">
- <product application="org.eclipse.scout.net.app" name="net bug product">
- <property name="appName" value="net bug product"/>
- </product>
- </extension>
-
-</plugin>
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+
+ <extension id="app" point="org.eclipse.core.runtime.applications">
+ <application>
+ <run class="org.eclipse.scout.net.tests.TestApplication"/>
+ </application>
+ </extension>
+
+ <extension id="product" point="org.eclipse.core.runtime.products">
+ <product application="org.eclipse.scout.net.app" name="net bug product">
+ <property name="appName" value="net bug product"/>
+ </product>
+ </extension>
+
+</plugin>
diff --git a/org.eclipse.scout.net/src/org/eclipse/scout/net/EclipseAuthenticator.java b/org.eclipse.scout.net/src/org/eclipse/scout/net/EclipseAuthenticator.java
index e2aa4db91f..8992476e56 100644
--- a/org.eclipse.scout.net/src/org/eclipse/scout/net/EclipseAuthenticator.java
+++ b/org.eclipse.scout.net/src/org/eclipse/scout/net/EclipseAuthenticator.java
@@ -1,33 +1,33 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.net;
-
-import java.net.PasswordAuthentication;
-
-import org.eclipse.scout.net.internal.InternalEclipseAuthenticator;
-
-/**
- * java.net Authenticator supporting runtime add/remove of local authenticators.
- * When no local authenticator is available the
- * org.eclipse.core.net.authenticator extension is used as default.
- *
- * @deprecated this class is only used until
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=299756 and
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=257443 are solved.
- */
-@Deprecated
-public final class EclipseAuthenticator extends InternalEclipseAuthenticator {
-
- @Override
- protected PasswordAuthentication getPasswordAuthentication() {
- return super.getPasswordAuthentication();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.net;
+
+import java.net.PasswordAuthentication;
+
+import org.eclipse.scout.net.internal.InternalEclipseAuthenticator;
+
+/**
+ * java.net Authenticator supporting runtime add/remove of local authenticators.
+ * When no local authenticator is available the
+ * org.eclipse.core.net.authenticator extension is used as default.
+ *
+ * @deprecated this class is only used until
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=299756 and
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=257443 are solved.
+ */
+@Deprecated
+public final class EclipseAuthenticator extends InternalEclipseAuthenticator {
+
+ @Override
+ protected PasswordAuthentication getPasswordAuthentication() {
+ return super.getPasswordAuthentication();
+ }
+}
diff --git a/org.eclipse.scout.net/src/org/eclipse/scout/net/EclipseProxySelector.java b/org.eclipse.scout.net/src/org/eclipse/scout/net/EclipseProxySelector.java
index 5127d26215..d4abecf2ff 100644
--- a/org.eclipse.scout.net/src/org/eclipse/scout/net/EclipseProxySelector.java
+++ b/org.eclipse.scout.net/src/org/eclipse/scout/net/EclipseProxySelector.java
@@ -1,190 +1,190 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.net;
-
-import java.io.IOException;
-import java.lang.reflect.Method;
-import java.net.InetSocketAddress;
-import java.net.Proxy;
-import java.net.ProxySelector;
-import java.net.SocketAddress;
-import java.net.URI;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import org.eclipse.core.net.proxy.IProxyData;
-import org.eclipse.core.net.proxy.IProxyService;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.scout.net.internal.TTLCache;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.Version;
-
-/**
- * Implementation of a java.net {@link ProxySelector}. To activate this
- * selector, call {@link ProxySelector#setDefault(ProxySelector)}. This will
- * enable the full capability of the eclipse proxy selector to the java.net
- * world. To make a connection, just create an {@link URL} and call {@link URL#openConnection()}. The
- * {@link ProxySelector} will take care of all
- * proxy related issues automatically.
- * <p>
- * This class also solves re-entrancy issues when using PAC scripts and self-references.
- * <p>
- * The config.ini property "org.eclipse.scout.net.cache" can be used to set the cache TTL in millis, default is 300'000
- * millis (5 minutes). Values &lt;=0 deactivate caching.
- *
- * @deprecated this class is only used until
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=299756 and
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=257443 are solved.
- */
-@Deprecated
-public final class EclipseProxySelector extends ProxySelector {
-
- private AtomicBoolean m_initialized;
- private AtomicBoolean m_initializeInProgress;
-
- private boolean m_cacheEnabled;
- private Object m_cacheLock;
- private TTLCache<URI, List<Proxy>> m_cache;
-
- public EclipseProxySelector() {
- m_initialized = new AtomicBoolean();
- m_initializeInProgress = new AtomicBoolean();
- m_cacheEnabled = true;
- m_cacheLock = new Object();
- m_cache = new TTLCache<URI, List<Proxy>>(300000L);
- try {
- String ttlText = NetActivator.getDefault().getBundle().getBundleContext().getProperty(NetActivator.PLUGIN_ID + ".cache");
- if (ttlText != null) {
- long ttl = Long.parseLong(ttlText);
- if (ttl > 0) {
- m_cache.setTTL(ttl);
- }
- else {
- m_cacheEnabled = false;
- }
- }
- }
- catch (Throwable t) {
- //nop
- }
- }
-
- @Override
- public List<Proxy> select(URI uri) {
- List<Proxy> list;
- //check cache
- if (m_cacheEnabled) {
- synchronized (m_cacheLock) {
- list = m_cache.get(uri);
- if (list != null) {
- return list;
- }
- }
- }
- list = new ArrayList<Proxy>();
- IProxyData[] datas = reentrantSelectImpl(uri);
- if (datas != null) {
- for (IProxyData data : datas) {
- Proxy.Type javaNetType = null;
- if (data.getType().equals(IProxyData.SOCKS_PROXY_TYPE)) {
- javaNetType = Proxy.Type.SOCKS;
- }
- else if (data.getType().equals(IProxyData.HTTP_PROXY_TYPE)) {
- javaNetType = Proxy.Type.HTTP;
- }
- else if (data.getType().equals(IProxyData.HTTPS_PROXY_TYPE)) {
- javaNetType = Proxy.Type.HTTP;
- }
- if (javaNetType != null) {
- Proxy javaNetProxy = new Proxy(javaNetType, InetSocketAddress.createUnresolved(data.getHost(), data.getPort()));
- list.add(javaNetProxy);
- }
- }
- }
- if (list.size() == 0) {
- list.add(Proxy.NO_PROXY);
- }
- //update cache
- list = Collections.unmodifiableList(list);
- if (m_cacheEnabled) {
- synchronized (m_cacheLock) {
- m_cache.put(uri, list);
- }
- }
- return list;
- }
-
- @Override
- public void connectFailed(URI uri, SocketAddress sa, IOException ioe) {
- NetActivator.getDefault().getLog().log(new Status(Status.WARNING, NetActivator.PLUGIN_ID, "Failed connecting to proxy server " + sa, ioe));
- }
-
- /**
- * fix for reentrancy
- */
- private IProxyData[] reentrantSelectImpl(URI uri) {
- synchronized (m_initialized) {
- if (!m_initialized.get()) {
- if (!m_initializeInProgress.get()) {
- try {
- m_initializeInProgress.set(true);
- return safeSelectImpl(uri);
- }
- finally {
- m_initialized.set(true);
- m_initializeInProgress.set(false);
- }
- }
- }
- }
- if (m_initialized.get()) {
- return safeSelectImpl(uri);
- }
- else {
- //pending init, must allow for direct connection
- return new IProxyData[0];
- }
- }
-
- private IProxyData[] safeSelectImpl(URI uri) {
- BundleContext context = NetActivator.getDefault().getBundle().getBundleContext();
- ServiceReference ref = context.getServiceReference(IProxyService.class.getName());
- if (ref != null) {
- try {
- IProxyService service = (IProxyService) context.getService(ref);
-
- //Necessary for backward compatibility to Eclipse 3.4 needed for Lotus Notes 8.5.2
- Version frameworkVersion = new Version(NetActivator.getDefault().getBundle().getBundleContext().getProperty("osgi.framework.version"));
- if (frameworkVersion.getMajor() == 3
- && frameworkVersion.getMinor() <= 4) {
- return new IProxyData[0];
- }
- else {
- try {
- Method method = IProxyService.class.getMethod("select", URI.class);
- return (IProxyData[]) method.invoke(service, uri);
- }
- catch (Exception e) {
- NetActivator.getDefault().getLog().log(new Status(Status.WARNING, NetActivator.PLUGIN_ID, "could not access method 'select' on 'IProxyService'.", e));
- }
- }
- }
- finally {
- context.ungetService(ref);
- }
- }
- return new IProxyData[0];
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.net;
+
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.net.InetSocketAddress;
+import java.net.Proxy;
+import java.net.ProxySelector;
+import java.net.SocketAddress;
+import java.net.URI;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.eclipse.core.net.proxy.IProxyData;
+import org.eclipse.core.net.proxy.IProxyService;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.scout.net.internal.TTLCache;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.Version;
+
+/**
+ * Implementation of a java.net {@link ProxySelector}. To activate this
+ * selector, call {@link ProxySelector#setDefault(ProxySelector)}. This will
+ * enable the full capability of the eclipse proxy selector to the java.net
+ * world. To make a connection, just create an {@link URL} and call {@link URL#openConnection()}. The
+ * {@link ProxySelector} will take care of all
+ * proxy related issues automatically.
+ * <p>
+ * This class also solves re-entrancy issues when using PAC scripts and self-references.
+ * <p>
+ * The config.ini property "org.eclipse.scout.net.cache" can be used to set the cache TTL in millis, default is 300'000
+ * millis (5 minutes). Values &lt;=0 deactivate caching.
+ *
+ * @deprecated this class is only used until
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=299756 and
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=257443 are solved.
+ */
+@Deprecated
+public final class EclipseProxySelector extends ProxySelector {
+
+ private AtomicBoolean m_initialized;
+ private AtomicBoolean m_initializeInProgress;
+
+ private boolean m_cacheEnabled;
+ private Object m_cacheLock;
+ private TTLCache<URI, List<Proxy>> m_cache;
+
+ public EclipseProxySelector() {
+ m_initialized = new AtomicBoolean();
+ m_initializeInProgress = new AtomicBoolean();
+ m_cacheEnabled = true;
+ m_cacheLock = new Object();
+ m_cache = new TTLCache<URI, List<Proxy>>(300000L);
+ try {
+ String ttlText = NetActivator.getDefault().getBundle().getBundleContext().getProperty(NetActivator.PLUGIN_ID + ".cache");
+ if (ttlText != null) {
+ long ttl = Long.parseLong(ttlText);
+ if (ttl > 0) {
+ m_cache.setTTL(ttl);
+ }
+ else {
+ m_cacheEnabled = false;
+ }
+ }
+ }
+ catch (Throwable t) {
+ //nop
+ }
+ }
+
+ @Override
+ public List<Proxy> select(URI uri) {
+ List<Proxy> list;
+ //check cache
+ if (m_cacheEnabled) {
+ synchronized (m_cacheLock) {
+ list = m_cache.get(uri);
+ if (list != null) {
+ return list;
+ }
+ }
+ }
+ list = new ArrayList<Proxy>();
+ IProxyData[] datas = reentrantSelectImpl(uri);
+ if (datas != null) {
+ for (IProxyData data : datas) {
+ Proxy.Type javaNetType = null;
+ if (data.getType().equals(IProxyData.SOCKS_PROXY_TYPE)) {
+ javaNetType = Proxy.Type.SOCKS;
+ }
+ else if (data.getType().equals(IProxyData.HTTP_PROXY_TYPE)) {
+ javaNetType = Proxy.Type.HTTP;
+ }
+ else if (data.getType().equals(IProxyData.HTTPS_PROXY_TYPE)) {
+ javaNetType = Proxy.Type.HTTP;
+ }
+ if (javaNetType != null) {
+ Proxy javaNetProxy = new Proxy(javaNetType, InetSocketAddress.createUnresolved(data.getHost(), data.getPort()));
+ list.add(javaNetProxy);
+ }
+ }
+ }
+ if (list.size() == 0) {
+ list.add(Proxy.NO_PROXY);
+ }
+ //update cache
+ list = Collections.unmodifiableList(list);
+ if (m_cacheEnabled) {
+ synchronized (m_cacheLock) {
+ m_cache.put(uri, list);
+ }
+ }
+ return list;
+ }
+
+ @Override
+ public void connectFailed(URI uri, SocketAddress sa, IOException ioe) {
+ NetActivator.getDefault().getLog().log(new Status(Status.WARNING, NetActivator.PLUGIN_ID, "Failed connecting to proxy server " + sa, ioe));
+ }
+
+ /**
+ * fix for reentrancy
+ */
+ private IProxyData[] reentrantSelectImpl(URI uri) {
+ synchronized (m_initialized) {
+ if (!m_initialized.get()) {
+ if (!m_initializeInProgress.get()) {
+ try {
+ m_initializeInProgress.set(true);
+ return safeSelectImpl(uri);
+ }
+ finally {
+ m_initialized.set(true);
+ m_initializeInProgress.set(false);
+ }
+ }
+ }
+ }
+ if (m_initialized.get()) {
+ return safeSelectImpl(uri);
+ }
+ else {
+ //pending init, must allow for direct connection
+ return new IProxyData[0];
+ }
+ }
+
+ private IProxyData[] safeSelectImpl(URI uri) {
+ BundleContext context = NetActivator.getDefault().getBundle().getBundleContext();
+ ServiceReference ref = context.getServiceReference(IProxyService.class.getName());
+ if (ref != null) {
+ try {
+ IProxyService service = (IProxyService) context.getService(ref);
+
+ //Necessary for backward compatibility to Eclipse 3.4 needed for Lotus Notes 8.5.2
+ Version frameworkVersion = new Version(NetActivator.getDefault().getBundle().getBundleContext().getProperty("osgi.framework.version"));
+ if (frameworkVersion.getMajor() == 3
+ && frameworkVersion.getMinor() <= 4) {
+ return new IProxyData[0];
+ }
+ else {
+ try {
+ Method method = IProxyService.class.getMethod("select", URI.class);
+ return (IProxyData[]) method.invoke(service, uri);
+ }
+ catch (Exception e) {
+ NetActivator.getDefault().getLog().log(new Status(Status.WARNING, NetActivator.PLUGIN_ID, "could not access method 'select' on 'IProxyService'.", e));
+ }
+ }
+ }
+ finally {
+ context.ungetService(ref);
+ }
+ }
+ return new IProxyData[0];
+ }
+}
diff --git a/org.eclipse.scout.net/src/org/eclipse/scout/net/NetActivator.java b/org.eclipse.scout.net/src/org/eclipse/scout/net/NetActivator.java
index 7e5326e3ee..ca4c9c61e5 100644
--- a/org.eclipse.scout.net/src/org/eclipse/scout/net/NetActivator.java
+++ b/org.eclipse.scout.net/src/org/eclipse/scout/net/NetActivator.java
@@ -1,106 +1,106 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.net;
-
-import java.net.Authenticator;
-import java.net.CookieHandler;
-import java.net.CookieManager;
-import java.net.CookiePolicy;
-import java.net.ProxySelector;
-
-import org.eclipse.core.runtime.Plugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * Extension to the org.eclipse.core.net to support JAAS based net
- * authentications using a {@link NetPrincipal}.
- * <p>
- * Calling {@link #install()} resp. activating this bundle will install
- * <li>pre eclipse 3.6 auto proxy handling using {@link EclipseProxySelector} into java.net.ProxySelector</li>
- * <li>an {@link EclipseAuthenticator} wrapper into java.net.Authenticator that will delegate to the
- * org.eclipse.core.net.authenticator extension (if not null) else to the osgi service of type java.net.Authenticator</li>
- * <li>installs the default java 1.6 {@link CookieManager} if there is no {@link CookieHandler} installed yet</li>
- * <p>
- * Note: this class is only used until https://bugs.eclipse.org/bugs/show_bug.cgi?id=299756 and
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=257443 are solved.
- * <p>
- * Use init property (config.ini, system properties, etc.) with name java.net.authenticate.cache.enabled=true|false to
- * allow/disallow caching of passwords. This property may/should be queried by {@link Authenticator} ui implementations
- * to decide whether to show/not show a checkbox or something simliar to save the passwords.
- * <p/>
- * Use org.eclipse.scout.net.proxy.autodetect=false to disable proxy detection
- */
-public final class NetActivator extends Plugin {
- public static final String PLUGIN_ID = "org.eclipse.scout.net";
- public static boolean DEBUG;
- public static boolean PROXY_AUTODETECTION;
-
- private static NetActivator plugin;
-
- public static NetActivator getDefault() {
- return plugin;
- }
-
- /**
- * alias for {@link #getDefault()}, simply instantiates the plugin Installs {@link EclipseAuthenticator} inside
- * {@link Authenticator} and {@link EclipseProxySelector} inside {@link ProxySelector}
- */
- public static void install() {
- getDefault();
- }
-
- private CookieHandler m_oldCookieHandler;
- private CookieHandler m_newCookieHandler;
- private ProxySelector m_oldProxySelector;
- private ProxySelector m_newProxySelector;
-
- public NetActivator() {
- }
-
- @SuppressWarnings("deprecation")
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- String debugText = context.getProperty(PLUGIN_ID + ".debug");
- DEBUG = (debugText != null && debugText.equalsIgnoreCase("true"));
-
- String proxyDetectionText = context.getProperty(PLUGIN_ID + ".proxy.autodetect");
- PROXY_AUTODETECTION = (proxyDetectionText == null || proxyDetectionText.equalsIgnoreCase("true"));
-
- // setup java.net
- m_oldProxySelector = ProxySelector.getDefault();
- m_oldCookieHandler = CookieHandler.getDefault();
- if (PROXY_AUTODETECTION) {
- ProxySelector.setDefault(m_newProxySelector = new EclipseProxySelector());
- }
- CookieManager.setDefault(m_newCookieHandler = new CookieManager(null, CookiePolicy.ACCEPT_ALL));
- Authenticator.setDefault(new EclipseAuthenticator());
- }
-
- @Override
- public void stop(BundleContext context) throws Exception {
- super.stop(context);
- Authenticator.setDefault(null);
- if (ProxySelector.getDefault() == m_newProxySelector) {
- ProxySelector.setDefault(m_oldProxySelector);
- }
- if (CookieHandler.getDefault() == m_newCookieHandler) {
- CookieHandler.setDefault(m_oldCookieHandler);
- }
- m_oldProxySelector = null;
- m_newProxySelector = null;
- m_oldCookieHandler = null;
- m_newCookieHandler = null;
- plugin = null;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.net;
+
+import java.net.Authenticator;
+import java.net.CookieHandler;
+import java.net.CookieManager;
+import java.net.CookiePolicy;
+import java.net.ProxySelector;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * Extension to the org.eclipse.core.net to support JAAS based net
+ * authentications using a {@link NetPrincipal}.
+ * <p>
+ * Calling {@link #install()} resp. activating this bundle will install
+ * <li>pre eclipse 3.6 auto proxy handling using {@link EclipseProxySelector} into java.net.ProxySelector</li>
+ * <li>an {@link EclipseAuthenticator} wrapper into java.net.Authenticator that will delegate to the
+ * org.eclipse.core.net.authenticator extension (if not null) else to the osgi service of type java.net.Authenticator</li>
+ * <li>installs the default java 1.6 {@link CookieManager} if there is no {@link CookieHandler} installed yet</li>
+ * <p>
+ * Note: this class is only used until https://bugs.eclipse.org/bugs/show_bug.cgi?id=299756 and
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=257443 are solved.
+ * <p>
+ * Use init property (config.ini, system properties, etc.) with name java.net.authenticate.cache.enabled=true|false to
+ * allow/disallow caching of passwords. This property may/should be queried by {@link Authenticator} ui implementations
+ * to decide whether to show/not show a checkbox or something simliar to save the passwords.
+ * <p/>
+ * Use org.eclipse.scout.net.proxy.autodetect=false to disable proxy detection
+ */
+public final class NetActivator extends Plugin {
+ public static final String PLUGIN_ID = "org.eclipse.scout.net";
+ public static boolean DEBUG;
+ public static boolean PROXY_AUTODETECTION;
+
+ private static NetActivator plugin;
+
+ public static NetActivator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * alias for {@link #getDefault()}, simply instantiates the plugin Installs {@link EclipseAuthenticator} inside
+ * {@link Authenticator} and {@link EclipseProxySelector} inside {@link ProxySelector}
+ */
+ public static void install() {
+ getDefault();
+ }
+
+ private CookieHandler m_oldCookieHandler;
+ private CookieHandler m_newCookieHandler;
+ private ProxySelector m_oldProxySelector;
+ private ProxySelector m_newProxySelector;
+
+ public NetActivator() {
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ String debugText = context.getProperty(PLUGIN_ID + ".debug");
+ DEBUG = (debugText != null && debugText.equalsIgnoreCase("true"));
+
+ String proxyDetectionText = context.getProperty(PLUGIN_ID + ".proxy.autodetect");
+ PROXY_AUTODETECTION = (proxyDetectionText == null || proxyDetectionText.equalsIgnoreCase("true"));
+
+ // setup java.net
+ m_oldProxySelector = ProxySelector.getDefault();
+ m_oldCookieHandler = CookieHandler.getDefault();
+ if (PROXY_AUTODETECTION) {
+ ProxySelector.setDefault(m_newProxySelector = new EclipseProxySelector());
+ }
+ CookieManager.setDefault(m_newCookieHandler = new CookieManager(null, CookiePolicy.ACCEPT_ALL));
+ Authenticator.setDefault(new EclipseAuthenticator());
+ }
+
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ super.stop(context);
+ Authenticator.setDefault(null);
+ if (ProxySelector.getDefault() == m_newProxySelector) {
+ ProxySelector.setDefault(m_oldProxySelector);
+ }
+ if (CookieHandler.getDefault() == m_newCookieHandler) {
+ CookieHandler.setDefault(m_oldCookieHandler);
+ }
+ m_oldProxySelector = null;
+ m_newProxySelector = null;
+ m_oldCookieHandler = null;
+ m_newCookieHandler = null;
+ plugin = null;
+ }
+
+}
diff --git a/org.eclipse.scout.net/src/org/eclipse/scout/net/internal/EclipseAuthenticatorLocator.java b/org.eclipse.scout.net/src/org/eclipse/scout/net/internal/EclipseAuthenticatorLocator.java
index 73fa75c5bf..2f823fd646 100644
--- a/org.eclipse.scout.net/src/org/eclipse/scout/net/internal/EclipseAuthenticatorLocator.java
+++ b/org.eclipse.scout.net/src/org/eclipse/scout/net/internal/EclipseAuthenticatorLocator.java
@@ -1,50 +1,50 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.net.internal;
-
-import java.net.Authenticator;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.scout.net.NetActivator;
-
-/**
- * locate authenticator at extension point "org.eclipse.core.net.authenticator"
- */
-public class EclipseAuthenticatorLocator {
-
- public Authenticator locate() {
- IExtensionRegistry xreg = Platform.getExtensionRegistry();
- if (xreg != null) {
- IExtensionPoint xp = xreg.getExtensionPoint("org.eclipse.core.net", "authenticator");
- IExtension[] extensions = xp.getExtensions();
- for (IExtension extension : extensions) {
- for (IConfigurationElement authenticatorElement : extension.getConfigurationElements()) {
- try {
- if (authenticatorElement.getName().equals("authenticator")) {
- return (Authenticator) authenticatorElement.createExecutableExtension("class");
- }
- }
- catch (CoreException e) {
- NetActivator.getDefault().getLog().log(new Status(Status.ERROR, NetActivator.PLUGIN_ID, "authenticator: " + authenticatorElement.getAttribute("class"), e));
- }
- }
- }
- }
- return null;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.net.internal;
+
+import java.net.Authenticator;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.scout.net.NetActivator;
+
+/**
+ * locate authenticator at extension point "org.eclipse.core.net.authenticator"
+ */
+public class EclipseAuthenticatorLocator {
+
+ public Authenticator locate() {
+ IExtensionRegistry xreg = Platform.getExtensionRegistry();
+ if (xreg != null) {
+ IExtensionPoint xp = xreg.getExtensionPoint("org.eclipse.core.net", "authenticator");
+ IExtension[] extensions = xp.getExtensions();
+ for (IExtension extension : extensions) {
+ for (IConfigurationElement authenticatorElement : extension.getConfigurationElements()) {
+ try {
+ if (authenticatorElement.getName().equals("authenticator")) {
+ return (Authenticator) authenticatorElement.createExecutableExtension("class");
+ }
+ }
+ catch (CoreException e) {
+ NetActivator.getDefault().getLog().log(new Status(Status.ERROR, NetActivator.PLUGIN_ID, "authenticator: " + authenticatorElement.getAttribute("class"), e));
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/org.eclipse.scout.net/src/org/eclipse/scout/net/internal/InternalEclipseAuthenticator.java b/org.eclipse.scout.net/src/org/eclipse/scout/net/internal/InternalEclipseAuthenticator.java
index 56dfe8e68e..0750bf4478 100644
--- a/org.eclipse.scout.net/src/org/eclipse/scout/net/internal/InternalEclipseAuthenticator.java
+++ b/org.eclipse.scout.net/src/org/eclipse/scout/net/internal/InternalEclipseAuthenticator.java
@@ -1,86 +1,86 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.net.internal;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.net.Authenticator;
-import java.net.PasswordAuthentication;
-
-import org.eclipse.core.runtime.Status;
-import org.eclipse.scout.net.NetActivator;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-
-public class InternalEclipseAuthenticator extends Authenticator {
-
- public InternalEclipseAuthenticator() {
- }
-
- @Override
- protected PasswordAuthentication getPasswordAuthentication() {
- PasswordAuthentication result = null;
- Authenticator auth = new EclipseAuthenticatorLocator().locate();
- if (auth == null) {
- // use osgi service
- BundleContext context = NetActivator.getDefault().getBundle().getBundleContext();
- ServiceReference ref = context.getServiceReference(Authenticator.class.getName());
- if (ref != null) {
- auth = (Authenticator) context.getService(ref);
- context.ungetService(ref);
- }
- }
- if (auth != null) {
- try {
- result = reflectPasswordAuthentication(auth);
- }
- catch (Throwable ex) {
- NetActivator.getDefault().getLog().log(new Status(Status.ERROR, NetActivator.PLUGIN_ID, getRequestingURL() + " " + getRequestorType(), ex));
- throw new SecurityException(ex);
- }
- }
- if (result != null) {
- if (NetActivator.DEBUG) {
- NetActivator.getDefault().getLog().log(new Status(Status.INFO, NetActivator.PLUGIN_ID, "net.auth SUCCESS " + getRequestingURL() + " " + getRequestorType() + " " + result.getUserName()));
- }
- return result;
- }
- else {
- if (NetActivator.DEBUG) {
- NetActivator.getDefault().getLog().log(new Status(Status.INFO, NetActivator.PLUGIN_ID, "net.auth NONE " + getRequestingURL() + " " + getRequestorType()));
- }
- return null;
- }
- }
-
- private PasswordAuthentication reflectPasswordAuthentication(Authenticator delegate) throws Throwable {
- reflectCopyField(this, delegate, "requestingHost");
- reflectCopyField(this, delegate, "requestingSite");
- reflectCopyField(this, delegate, "requestingPort");
- reflectCopyField(this, delegate, "requestingProtocol");
- reflectCopyField(this, delegate, "requestingPrompt");
- reflectCopyField(this, delegate, "requestingScheme");
- reflectCopyField(this, delegate, "requestingURL");
- reflectCopyField(this, delegate, "requestingAuthType");
- //
- Method m = delegate.getClass().getDeclaredMethod("getPasswordAuthentication");
- m.setAccessible(true);
- return (PasswordAuthentication) m.invoke(delegate);
- }
-
- private void reflectCopyField(Authenticator from, Authenticator to, String fieldName) throws Throwable {
- Field f = Authenticator.class.getDeclaredField(fieldName);
- f.setAccessible(true);
- Object value = f.get(from);
- f.set(to, value);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.net.internal;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.net.Authenticator;
+import java.net.PasswordAuthentication;
+
+import org.eclipse.core.runtime.Status;
+import org.eclipse.scout.net.NetActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+
+public class InternalEclipseAuthenticator extends Authenticator {
+
+ public InternalEclipseAuthenticator() {
+ }
+
+ @Override
+ protected PasswordAuthentication getPasswordAuthentication() {
+ PasswordAuthentication result = null;
+ Authenticator auth = new EclipseAuthenticatorLocator().locate();
+ if (auth == null) {
+ // use osgi service
+ BundleContext context = NetActivator.getDefault().getBundle().getBundleContext();
+ ServiceReference ref = context.getServiceReference(Authenticator.class.getName());
+ if (ref != null) {
+ auth = (Authenticator) context.getService(ref);
+ context.ungetService(ref);
+ }
+ }
+ if (auth != null) {
+ try {
+ result = reflectPasswordAuthentication(auth);
+ }
+ catch (Throwable ex) {
+ NetActivator.getDefault().getLog().log(new Status(Status.ERROR, NetActivator.PLUGIN_ID, getRequestingURL() + " " + getRequestorType(), ex));
+ throw new SecurityException(ex);
+ }
+ }
+ if (result != null) {
+ if (NetActivator.DEBUG) {
+ NetActivator.getDefault().getLog().log(new Status(Status.INFO, NetActivator.PLUGIN_ID, "net.auth SUCCESS " + getRequestingURL() + " " + getRequestorType() + " " + result.getUserName()));
+ }
+ return result;
+ }
+ else {
+ if (NetActivator.DEBUG) {
+ NetActivator.getDefault().getLog().log(new Status(Status.INFO, NetActivator.PLUGIN_ID, "net.auth NONE " + getRequestingURL() + " " + getRequestorType()));
+ }
+ return null;
+ }
+ }
+
+ private PasswordAuthentication reflectPasswordAuthentication(Authenticator delegate) throws Throwable {
+ reflectCopyField(this, delegate, "requestingHost");
+ reflectCopyField(this, delegate, "requestingSite");
+ reflectCopyField(this, delegate, "requestingPort");
+ reflectCopyField(this, delegate, "requestingProtocol");
+ reflectCopyField(this, delegate, "requestingPrompt");
+ reflectCopyField(this, delegate, "requestingScheme");
+ reflectCopyField(this, delegate, "requestingURL");
+ reflectCopyField(this, delegate, "requestingAuthType");
+ //
+ Method m = delegate.getClass().getDeclaredMethod("getPasswordAuthentication");
+ m.setAccessible(true);
+ return (PasswordAuthentication) m.invoke(delegate);
+ }
+
+ private void reflectCopyField(Authenticator from, Authenticator to, String fieldName) throws Throwable {
+ Field f = Authenticator.class.getDeclaredField(fieldName);
+ f.setAccessible(true);
+ Object value = f.get(from);
+ f.set(to, value);
+ }
+
+}
diff --git a/org.eclipse.scout.net/src/org/eclipse/scout/net/internal/TTLCache.java b/org.eclipse.scout.net/src/org/eclipse/scout/net/internal/TTLCache.java
index b43cb02caa..09f354fa85 100644
--- a/org.eclipse.scout.net/src/org/eclipse/scout/net/internal/TTLCache.java
+++ b/org.eclipse.scout.net/src/org/eclipse/scout/net/internal/TTLCache.java
@@ -1,192 +1,192 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.net.internal;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import java.util.Map.Entry;
-
-public class TTLCache<K, V> {
- private Map<K, CacheEntryTTL> m_itemMap;
- private long m_ttl;
- private final Object m_itemMapLock = new Object();
-
- public TTLCache() {
- this(60000);// 60 sec. default
- }
-
- public TTLCache(long timeToLive) {
- m_ttl = timeToLive;
- m_itemMap = new HashMap<K, CacheEntryTTL>();
- }
-
- public void clear() {
- synchronized (m_itemMapLock) {
- m_itemMap.clear();
- }
- }
-
- public void setTTL(long millis) {
- m_ttl = millis;
- }
-
- public long getTTL() {
- return m_ttl;
- }
-
- public void put(K key, V value) {
- if (m_ttl > 0) {
- synchronized (m_itemMapLock) {
- m_itemMap.put(key, new CacheEntryTTL(value));
- }
- }
- }
-
- public void remove(K key) {
- synchronized (m_itemMapLock) {
- m_itemMap.remove(key);
- }
- }
-
- public V get(K key) {
- CacheEntryTTL ce = getEntry(key);
- if (ce != null) {
- return ce.getValue();
- }
- else {
- return null;
- }
- }
-
- public Set<K> keySet() {
- HashSet<K> list = new HashSet<K>();
- synchronized (m_itemMapLock) {
- for (Iterator<K> it = m_itemMap.keySet().iterator(); it.hasNext();) {
- K key = it.next();
- if (!isCacheTimeoutReached(m_itemMap.get(key))) {
- list.add(key);
- }
- else {
- it.remove();
- }
- }
- }
- return list;
- }
-
- public int size() {
- synchronized (m_itemMapLock) {
- return m_itemMap.size();
- }
- }
-
- public Collection<V> values() {
- ArrayList<V> list = new ArrayList<V>();
- synchronized (m_itemMapLock) {
- for (Iterator<CacheEntryTTL> it = m_itemMap.values().iterator(); it.hasNext();) {
- CacheEntryTTL cacheEntry = it.next();
- if (!isCacheTimeoutReached(cacheEntry)) {
- list.add(cacheEntry.getValue());
- }
- else {
- it.remove();
- }
- }
- }
- return list;
- }
-
- public Map<K, V> getEntries() {
- Map<K, V> map = new HashMap<K, V>();
- synchronized (m_itemMapLock) {
- for (Iterator<Entry<K, CacheEntryTTL>> it = m_itemMap.entrySet().iterator(); it.hasNext();) {
- Entry<K, CacheEntryTTL> e = it.next();
- if (!isCacheTimeoutReached(e.getValue())) {
- map.put(e.getKey(), e.getValue().getValue());
- }
- else {
- it.remove();
- }
- }
- }
- return map;
- }
-
- public boolean containsKey(K key) {
- if (m_ttl > 0) {
- CacheEntryTTL ce = getEntry(key);
- if (ce != null) {
- return true;
- }
- }
- return false;
- }
-
- public boolean contains(K key, V value) {
- if (m_ttl > 0) {
- CacheEntryTTL ce = getEntry(key);
- if (ce != null) {
- V ceVal = ce.getValue();
- if (ceVal == value || (ceVal != null && ceVal.equals(value))) {
- // ok
- return true;
- }
- }
- }
- return false;
- }
-
- private CacheEntryTTL getEntry(K key) {
- if (m_ttl > 0) {
- CacheEntryTTL ce;
- synchronized (m_itemMapLock) {
- ce = m_itemMap.get(key);
- if (ce != null) {
- if (!isCacheTimeoutReached(ce)) {
- return ce;
- }
- else {
- // timeout
- m_itemMap.remove(key);
- }
- }
- }
- }
- return null;
- }
-
- private boolean isCacheTimeoutReached(CacheEntryTTL value) {
- return value.getTimestamp() + m_ttl <= System.currentTimeMillis();
- }
-
- private class CacheEntryTTL {
- private long m_time = System.currentTimeMillis();
- private V m_value;
-
- public CacheEntryTTL(V value) {
- m_value = value;
- }
-
- public long getTimestamp() {
- return m_time;
- }
-
- public V getValue() {
- return m_value;
- }
- }// end class
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.net.internal;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.Map.Entry;
+
+public class TTLCache<K, V> {
+ private Map<K, CacheEntryTTL> m_itemMap;
+ private long m_ttl;
+ private final Object m_itemMapLock = new Object();
+
+ public TTLCache() {
+ this(60000);// 60 sec. default
+ }
+
+ public TTLCache(long timeToLive) {
+ m_ttl = timeToLive;
+ m_itemMap = new HashMap<K, CacheEntryTTL>();
+ }
+
+ public void clear() {
+ synchronized (m_itemMapLock) {
+ m_itemMap.clear();
+ }
+ }
+
+ public void setTTL(long millis) {
+ m_ttl = millis;
+ }
+
+ public long getTTL() {
+ return m_ttl;
+ }
+
+ public void put(K key, V value) {
+ if (m_ttl > 0) {
+ synchronized (m_itemMapLock) {
+ m_itemMap.put(key, new CacheEntryTTL(value));
+ }
+ }
+ }
+
+ public void remove(K key) {
+ synchronized (m_itemMapLock) {
+ m_itemMap.remove(key);
+ }
+ }
+
+ public V get(K key) {
+ CacheEntryTTL ce = getEntry(key);
+ if (ce != null) {
+ return ce.getValue();
+ }
+ else {
+ return null;
+ }
+ }
+
+ public Set<K> keySet() {
+ HashSet<K> list = new HashSet<K>();
+ synchronized (m_itemMapLock) {
+ for (Iterator<K> it = m_itemMap.keySet().iterator(); it.hasNext();) {
+ K key = it.next();
+ if (!isCacheTimeoutReached(m_itemMap.get(key))) {
+ list.add(key);
+ }
+ else {
+ it.remove();
+ }
+ }
+ }
+ return list;
+ }
+
+ public int size() {
+ synchronized (m_itemMapLock) {
+ return m_itemMap.size();
+ }
+ }
+
+ public Collection<V> values() {
+ ArrayList<V> list = new ArrayList<V>();
+ synchronized (m_itemMapLock) {
+ for (Iterator<CacheEntryTTL> it = m_itemMap.values().iterator(); it.hasNext();) {
+ CacheEntryTTL cacheEntry = it.next();
+ if (!isCacheTimeoutReached(cacheEntry)) {
+ list.add(cacheEntry.getValue());
+ }
+ else {
+ it.remove();
+ }
+ }
+ }
+ return list;
+ }
+
+ public Map<K, V> getEntries() {
+ Map<K, V> map = new HashMap<K, V>();
+ synchronized (m_itemMapLock) {
+ for (Iterator<Entry<K, CacheEntryTTL>> it = m_itemMap.entrySet().iterator(); it.hasNext();) {
+ Entry<K, CacheEntryTTL> e = it.next();
+ if (!isCacheTimeoutReached(e.getValue())) {
+ map.put(e.getKey(), e.getValue().getValue());
+ }
+ else {
+ it.remove();
+ }
+ }
+ }
+ return map;
+ }
+
+ public boolean containsKey(K key) {
+ if (m_ttl > 0) {
+ CacheEntryTTL ce = getEntry(key);
+ if (ce != null) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public boolean contains(K key, V value) {
+ if (m_ttl > 0) {
+ CacheEntryTTL ce = getEntry(key);
+ if (ce != null) {
+ V ceVal = ce.getValue();
+ if (ceVal == value || (ceVal != null && ceVal.equals(value))) {
+ // ok
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ private CacheEntryTTL getEntry(K key) {
+ if (m_ttl > 0) {
+ CacheEntryTTL ce;
+ synchronized (m_itemMapLock) {
+ ce = m_itemMap.get(key);
+ if (ce != null) {
+ if (!isCacheTimeoutReached(ce)) {
+ return ce;
+ }
+ else {
+ // timeout
+ m_itemMap.remove(key);
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ private boolean isCacheTimeoutReached(CacheEntryTTL value) {
+ return value.getTimestamp() + m_ttl <= System.currentTimeMillis();
+ }
+
+ private class CacheEntryTTL {
+ private long m_time = System.currentTimeMillis();
+ private V m_value;
+
+ public CacheEntryTTL(V value) {
+ m_value = value;
+ }
+
+ public long getTimestamp() {
+ return m_time;
+ }
+
+ public V getValue() {
+ return m_value;
+ }
+ }// end class
+
+}
diff --git a/org.eclipse.scout.net/src/org/eclipse/scout/net/tests/TestApplication.java b/org.eclipse.scout.net/src/org/eclipse/scout/net/tests/TestApplication.java
index 716efc17d5..687e62bf2b 100644
--- a/org.eclipse.scout.net/src/org/eclipse/scout/net/tests/TestApplication.java
+++ b/org.eclipse.scout.net/src/org/eclipse/scout/net/tests/TestApplication.java
@@ -1,41 +1,41 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.net.tests;
-
-import java.net.URL;
-
-import org.eclipse.equinox.app.IApplication;
-import org.eclipse.equinox.app.IApplicationContext;
-import org.eclipse.scout.net.NetActivator;
-
-public class TestApplication implements IApplication {
-
- @Override
- public Object start(IApplicationContext context) throws Exception {
- System.out.println("Hello RCP World!");
-
- NetActivator.install();
-
- URL url = new URL("http://www.google.ch");
- for (int i = 0; i < 10; i++) {
- long t = System.nanoTime();
- url.openConnection().getInputStream();
- long dt = System.nanoTime() - t;
- System.out.println("Accessing " + url + " took " + (dt / 1000000L) + " ms");
- }
-
- return EXIT_OK;
- }
-
- @Override
- public void stop() {
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.net.tests;
+
+import java.net.URL;
+
+import org.eclipse.equinox.app.IApplication;
+import org.eclipse.equinox.app.IApplicationContext;
+import org.eclipse.scout.net.NetActivator;
+
+public class TestApplication implements IApplication {
+
+ @Override
+ public Object start(IApplicationContext context) throws Exception {
+ System.out.println("Hello RCP World!");
+
+ NetActivator.install();
+
+ URL url = new URL("http://www.google.ch");
+ for (int i = 0; i < 10; i++) {
+ long t = System.nanoTime();
+ url.openConnection().getInputStream();
+ long dt = System.nanoTime() - t;
+ System.out.println("Accessing " + url + " took " + (dt / 1000000L) + " ms");
+ }
+
+ return EXIT_OK;
+ }
+
+ @Override
+ public void stop() {
+ }
+}
diff --git a/org.eclipse.scout.net/src/org/eclipse/scout/net/tests/tests.product b/org.eclipse.scout.net/src/org/eclipse/scout/net/tests/tests.product
index 40a09b7612..0a87be396b 100644
--- a/org.eclipse.scout.net/src/org/eclipse/scout/net/tests/tests.product
+++ b/org.eclipse.scout.net/src/org/eclipse/scout/net/tests/tests.product
@@ -1,42 +1,42 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?pde version="3.5"?>
-
-<product name="net bug product" id="org.eclipse.scout.net.product" application="org.eclipse.scout.net.app" useFeatures="false" includeLaunchers="true">
-
- <configIni use="default">
- </configIni>
-
- <launcherArgs>
- <programArgs>-console -consoleLog</programArgs>
- <vmArgsMac>-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts</vmArgsMac>
- </launcherArgs>
-
- <windowImages/>
-
- <launcher>
- <solaris/>
- <win useIco="false">
- <bmp/>
- </win>
- </launcher>
-
- <vm>
- </vm>
-
- <plugins>
- <plugin id="org.eclipse.core.contenttype"/>
- <plugin id="org.eclipse.core.jobs"/>
- <plugin id="org.eclipse.core.net"/>
- <plugin id="org.eclipse.core.runtime"/>
- <plugin id="org.eclipse.core.runtime.compatibility.registry" fragment="true"/>
- <plugin id="org.eclipse.equinox.app"/>
- <plugin id="org.eclipse.equinox.common"/>
- <plugin id="org.eclipse.equinox.preferences"/>
- <plugin id="org.eclipse.equinox.registry"/>
- <plugin id="org.eclipse.equinox.security"/>
- <plugin id="org.eclipse.osgi"/>
- <plugin id="org.eclipse.scout.net"/>
- </plugins>
-
-
-</product>
+<?xml version="1.0" encoding="UTF-8"?>
+<?pde version="3.5"?>
+
+<product name="net bug product" id="org.eclipse.scout.net.product" application="org.eclipse.scout.net.app" useFeatures="false" includeLaunchers="true">
+
+ <configIni use="default">
+ </configIni>
+
+ <launcherArgs>
+ <programArgs>-console -consoleLog</programArgs>
+ <vmArgsMac>-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts</vmArgsMac>
+ </launcherArgs>
+
+ <windowImages/>
+
+ <launcher>
+ <solaris/>
+ <win useIco="false">
+ <bmp/>
+ </win>
+ </launcher>
+
+ <vm>
+ </vm>
+
+ <plugins>
+ <plugin id="org.eclipse.core.contenttype"/>
+ <plugin id="org.eclipse.core.jobs"/>
+ <plugin id="org.eclipse.core.net"/>
+ <plugin id="org.eclipse.core.runtime"/>
+ <plugin id="org.eclipse.core.runtime.compatibility.registry" fragment="true"/>
+ <plugin id="org.eclipse.equinox.app"/>
+ <plugin id="org.eclipse.equinox.common"/>
+ <plugin id="org.eclipse.equinox.preferences"/>
+ <plugin id="org.eclipse.equinox.registry"/>
+ <plugin id="org.eclipse.equinox.security"/>
+ <plugin id="org.eclipse.osgi"/>
+ <plugin id="org.eclipse.scout.net"/>
+ </plugins>
+
+
+</product>
diff --git a/org.eclipse.scout.rt.client.mobile/.settings/org.eclipse.pde.core.prefs b/org.eclipse.scout.rt.client.mobile/.settings/org.eclipse.pde.core.prefs
index baef13dd8c..a3a50fc8da 100644
--- a/org.eclipse.scout.rt.client.mobile/.settings/org.eclipse.pde.core.prefs
+++ b/org.eclipse.scout.rt.client.mobile/.settings/org.eclipse.pde.core.prefs
@@ -1,3 +1,3 @@
-#Mon Jul 11 16:16:00 CEST 2011
-eclipse.preferences.version=1
-pluginProject.extensions=true
+#Mon Jul 11 16:16:00 CEST 2011
+eclipse.preferences.version=1
+pluginProject.extensions=true
diff --git a/org.eclipse.scout.rt.client.mobile/plugin.xml b/org.eclipse.scout.rt.client.mobile/plugin.xml
index e2e81e0c63..67b7f9b4e3 100644
--- a/org.eclipse.scout.rt.client.mobile/plugin.xml
+++ b/org.eclipse.scout.rt.client.mobile/plugin.xml
@@ -1,26 +1,26 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<plugin>
- <extension
- point="org.eclipse.scout.service.services">
- <service
- class="org.eclipse.scout.rt.client.mobile.services.text.TextProviderService"
- createImmediately="false"
- factory="org.eclipse.scout.rt.client.mobile.services.MobileClientServiceFactory"
- ranking="-25">
- </service>
- <service
- class="org.eclipse.scout.rt.client.mobile.navigation.BreadCrumbsNavigationService"
- createImmediately="false"
- factory="org.eclipse.scout.rt.client.mobile.services.MobileClientServiceFactory"
- ranking="-1000">
- </service>
- <service
- class="org.eclipse.scout.rt.client.mobile.transformation.DeviceTransformationService"
- createImmediately="false"
- factory="org.eclipse.scout.rt.client.mobile.services.MobileClientServiceFactory"
- ranking="-1000">
- </service>
- </extension>
-
-</plugin>
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.scout.service.services">
+ <service
+ class="org.eclipse.scout.rt.client.mobile.services.text.TextProviderService"
+ createImmediately="false"
+ factory="org.eclipse.scout.rt.client.mobile.services.MobileClientServiceFactory"
+ ranking="-25">
+ </service>
+ <service
+ class="org.eclipse.scout.rt.client.mobile.navigation.BreadCrumbsNavigationService"
+ createImmediately="false"
+ factory="org.eclipse.scout.rt.client.mobile.services.MobileClientServiceFactory"
+ ranking="-1000">
+ </service>
+ <service
+ class="org.eclipse.scout.rt.client.mobile.transformation.DeviceTransformationService"
+ createImmediately="false"
+ factory="org.eclipse.scout.rt.client.mobile.services.MobileClientServiceFactory"
+ ranking="-1000">
+ </service>
+ </extension>
+
+</plugin>
diff --git a/org.eclipse.scout.rt.client.mobile/resources/html/MobileTableCellContent.html b/org.eclipse.scout.rt.client.mobile/resources/html/MobileTableCellContent.html
index 39b166a93b..e17e5196cd 100644
--- a/org.eclipse.scout.rt.client.mobile/resources/html/MobileTableCellContent.html
+++ b/org.eclipse.scout.rt.client.mobile/resources/html/MobileTableCellContent.html
@@ -1,16 +1,16 @@
-<html>
-<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0" style="table-layout:fixed;border-collapse: collapse;">
- <colgroup>
- <col width="#ICON_COL_WIDTH#/">
- <col />
- <col width="#DRILL_DOWN_COL_WIDTH#/"/>
- </colgroup>
- <tbody>
- <tr style="border-bottom:1px solid #e1efec">
- <td align="center">#ICON#</td>
- <td style="text-overflow:ellipsis;overflow:hidden;white-space:nowrap;">#CONTENT#</td>
- <td>#DRILL_DOWN#</td>
- </tr>
- </tbody>
-</table>
+<html>
+<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0" style="table-layout:fixed;border-collapse: collapse;">
+ <colgroup>
+ <col width="#ICON_COL_WIDTH#/">
+ <col />
+ <col width="#DRILL_DOWN_COL_WIDTH#/"/>
+ </colgroup>
+ <tbody>
+ <tr style="border-bottom:1px solid #e1efec">
+ <td align="center">#ICON#</td>
+ <td style="text-overflow:ellipsis;overflow:hidden;white-space:nowrap;">#CONTENT#</td>
+ <td>#DRILL_DOWN#</td>
+ </tr>
+ </tbody>
+</table>
</html> \ No newline at end of file
diff --git a/org.eclipse.scout.rt.client.mobile/resources/html/MobileTableDrillDown.html b/org.eclipse.scout.rt.client.mobile/resources/html/MobileTableDrillDown.html
index 844c61046b..8fcc6b49ae 100644
--- a/org.eclipse.scout.rt.client.mobile/resources/html/MobileTableDrillDown.html
+++ b/org.eclipse.scout.rt.client.mobile/resources/html/MobileTableDrillDown.html
@@ -1,8 +1,8 @@
-<span
- style="
- display:block;
- background-image:url('cid:mobile_drill_down');
- background-repeat:no-repeat;
- background-position:center;
- width:100%;height:50px;">
-</span>
+<span
+ style="
+ display:block;
+ background-image:url('cid:mobile_drill_down');
+ background-repeat:no-repeat;
+ background-position:center;
+ width:100%;height:50px;">
+</span>
diff --git a/org.eclipse.scout.rt.client.mobile/resources/html/MobileTableDrillDownButton.html b/org.eclipse.scout.rt.client.mobile/resources/html/MobileTableDrillDownButton.html
index 126d1bee31..3951e1b279 100644
--- a/org.eclipse.scout.rt.client.mobile/resources/html/MobileTableDrillDownButton.html
+++ b/org.eclipse.scout.rt.client.mobile/resources/html/MobileTableDrillDownButton.html
@@ -1,12 +1,12 @@
-<span
- class="link"
- href="http://local/scout?action=drill_down"
- style="
- display:block;
- background-image:url('cid:mobile_drill_down_button');
- background-repeat:no-repeat;
- background-position:center;
- width:100%;height:50px;
- cursor:pointer"
- onclick="currentElement=event.target || event.srcElement;currentElement.style.backgroundImage='url(cid:mobile_drill_down_button_pressed)';return false;">
-</span>
+<span
+ class="link"
+ href="http://local/scout?action=drill_down"
+ style="
+ display:block;
+ background-image:url('cid:mobile_drill_down_button');
+ background-repeat:no-repeat;
+ background-position:center;
+ width:100%;height:50px;
+ cursor:pointer"
+ onclick="currentElement=event.target || event.srcElement;currentElement.style.backgroundImage='url(cid:mobile_drill_down_button_pressed)';return false;">
+</span>
diff --git a/org.eclipse.scout.rt.client.mobile/resources/texts/Texts.properties b/org.eclipse.scout.rt.client.mobile/resources/texts/Texts.properties
index 91184cd179..d9d5204306 100644
--- a/org.eclipse.scout.rt.client.mobile/resources/texts/Texts.properties
+++ b/org.eclipse.scout.rt.client.mobile/resources/texts/Texts.properties
@@ -1,11 +1,11 @@
-FormToolsButtonTooltip=Show form actions
-MobileBusyBlockingAbort=Abort
-MobileBusyBlockingMessage=Processing request...
-MobileOutlineChooserTitle=Outlines
-MobilePlaceholderTableTitle=Details
-MobileSmartFormTitle=Choose {0}
-MobileSmartFormTitleDefault=Choose object
-MobileTableDefaultHeader=Objects
-OkButton=Done
-OkButtonTooltip=Save and close
-TooManyRows=Search limitation required.
+FormToolsButtonTooltip=Show form actions
+MobileBusyBlockingAbort=Abort
+MobileBusyBlockingMessage=Processing request...
+MobileOutlineChooserTitle=Outlines
+MobilePlaceholderTableTitle=Details
+MobileSmartFormTitle=Choose {0}
+MobileSmartFormTitleDefault=Choose object
+MobileTableDefaultHeader=Objects
+OkButton=Done
+OkButtonTooltip=Save and close
+TooManyRows=Search limitation required.
diff --git a/org.eclipse.scout.rt.client.mobile/resources/texts/Texts_de.properties b/org.eclipse.scout.rt.client.mobile/resources/texts/Texts_de.properties
index 077a4a3c73..6e9fae11b4 100644
--- a/org.eclipse.scout.rt.client.mobile/resources/texts/Texts_de.properties
+++ b/org.eclipse.scout.rt.client.mobile/resources/texts/Texts_de.properties
@@ -1,11 +1,11 @@
-FormToolsButtonTooltip=Formular-Aktionen anzeigen
-MobileBusyBlockingAbort=Abbrechen
-MobileBusyBlockingMessage=Verarbeitung l\u00E4uft...
-MobileOutlineChooserTitle=Sichten
-MobilePlaceholderTableTitle=Details
-MobileSmartFormTitle={0} w\u00E4hlen
-MobileSmartFormTitleDefault=Objekt w\u00E4hlen
-MobileTableDefaultHeader=Objekte
-OkButton=Fertig
-OkButtonTooltip=Speichern und schliessen
-TooManyRows=Einschr\u00E4nkung der Suche erforderlich.
+FormToolsButtonTooltip=Formular-Aktionen anzeigen
+MobileBusyBlockingAbort=Abbrechen
+MobileBusyBlockingMessage=Verarbeitung l\u00E4uft...
+MobileOutlineChooserTitle=Sichten
+MobilePlaceholderTableTitle=Details
+MobileSmartFormTitle={0} w\u00E4hlen
+MobileSmartFormTitleDefault=Objekt w\u00E4hlen
+MobileTableDefaultHeader=Objekte
+OkButton=Fertig
+OkButtonTooltip=Speichern und schliessen
+TooManyRows=Einschr\u00E4nkung der Suche erforderlich.
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/Activator.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/Activator.java
index f78692a26a..f027b206f9 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/Activator.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/Activator.java
@@ -1,61 +1,61 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile;
-
-import org.eclipse.core.runtime.Plugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends Plugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.scout.rt.client.mobile";
-
- // The shared instance
- private static Activator plugin;
-
- /**
- * The constructor
- */
- public Activator() {
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.scout.rt.client.mobile";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/Icons.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/Icons.java
index 2ba2f7a7de..1d5d15b684 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/Icons.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/Icons.java
@@ -1,32 +1,32 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile;
-
-import org.eclipse.scout.rt.shared.AbstractIcons;
-
-/**
- * @since 3.9.0
- */
-public class Icons extends AbstractIcons {
-
- private static final long serialVersionUID = 1L;
-
- public static final String BackAction = "mobile_back_action";
- public static final String CheckboxYes = "checkbox_yes";
- public static final String CheckboxNo = "checkbox_no";
- public static final String DrillDown = "mobile_drill_down";
- public static final String DrillDownButton = "mobile_drill_down_button";
- public static final String FormToolsAction = "mobile_tools_menu";
- public static final String HomeAction = "mobile_home_action";
- public static final String MoreActionsUp = "mobile_more_actions_up";
- public static final String MoreActionsDown = "mobile_more_actions_down";
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile;
+
+import org.eclipse.scout.rt.shared.AbstractIcons;
+
+/**
+ * @since 3.9.0
+ */
+public class Icons extends AbstractIcons {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String BackAction = "mobile_back_action";
+ public static final String CheckboxYes = "checkbox_yes";
+ public static final String CheckboxNo = "checkbox_no";
+ public static final String DrillDown = "mobile_drill_down";
+ public static final String DrillDownButton = "mobile_drill_down_button";
+ public static final String FormToolsAction = "mobile_tools_menu";
+ public static final String HomeAction = "mobile_home_action";
+ public static final String MoreActionsUp = "mobile_more_actions_up";
+ public static final String MoreActionsDown = "mobile_more_actions_down";
+
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/navigation/AbstractMobileBackAction.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/navigation/AbstractMobileBackAction.java
index 6fa6897c5e..7a512f1ed1 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/navigation/AbstractMobileBackAction.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/navigation/AbstractMobileBackAction.java
@@ -1,43 +1,43 @@
-package org.eclipse.scout.rt.client.mobile.navigation;
-
-import org.eclipse.scout.commons.WeakEventListener;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.mobile.Icons;
-import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
-import org.eclipse.scout.service.SERVICES;
-
-public class AbstractMobileBackAction extends AbstractMenu {
- private P_BreadCrumbsListener m_breadCrumbsListener;
-
- @Override
- protected String getConfiguredText() {
- return "";
- }
-
- @Override
- protected void execInitAction() throws ProcessingException {
- if (m_breadCrumbsListener == null) {
- m_breadCrumbsListener = new P_BreadCrumbsListener();
- SERVICES.getService(IBreadCrumbsNavigationService.class).getBreadCrumbsNavigation().addBreadCrumbsListener(m_breadCrumbsListener);
- }
- }
-
- @Override
- protected String getConfiguredIconId() {
- return Icons.BackAction;
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- SERVICES.getService(IBreadCrumbsNavigationService.class).getBreadCrumbsNavigation().stepBack();
- }
-
- private class P_BreadCrumbsListener implements BreadCrumbsListener, WeakEventListener {
-
- @Override
- public void breadCrumbsChanged(BreadCrumbsEvent e) {
- setVisible(e.getBreadCrumbsNavigation().isSteppingBackPossible());
- }
-
- }
-}
+package org.eclipse.scout.rt.client.mobile.navigation;
+
+import org.eclipse.scout.commons.WeakEventListener;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.mobile.Icons;
+import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
+import org.eclipse.scout.service.SERVICES;
+
+public class AbstractMobileBackAction extends AbstractMenu {
+ private P_BreadCrumbsListener m_breadCrumbsListener;
+
+ @Override
+ protected String getConfiguredText() {
+ return "";
+ }
+
+ @Override
+ protected void execInitAction() throws ProcessingException {
+ if (m_breadCrumbsListener == null) {
+ m_breadCrumbsListener = new P_BreadCrumbsListener();
+ SERVICES.getService(IBreadCrumbsNavigationService.class).getBreadCrumbsNavigation().addBreadCrumbsListener(m_breadCrumbsListener);
+ }
+ }
+
+ @Override
+ protected String getConfiguredIconId() {
+ return Icons.BackAction;
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ SERVICES.getService(IBreadCrumbsNavigationService.class).getBreadCrumbsNavigation().stepBack();
+ }
+
+ private class P_BreadCrumbsListener implements BreadCrumbsListener, WeakEventListener {
+
+ @Override
+ public void breadCrumbsChanged(BreadCrumbsEvent e) {
+ setVisible(e.getBreadCrumbsNavigation().isSteppingBackPossible());
+ }
+
+ }
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/navigation/AbstractMobileHomeAction.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/navigation/AbstractMobileHomeAction.java
index c7aac3e66d..253eba73ea 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/navigation/AbstractMobileHomeAction.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/navigation/AbstractMobileHomeAction.java
@@ -1,50 +1,50 @@
-package org.eclipse.scout.rt.client.mobile.navigation;
-
-import org.eclipse.scout.commons.WeakEventListener;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.mobile.Icons;
-import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
-import org.eclipse.scout.service.SERVICES;
-
-@Order(20)
-public class AbstractMobileHomeAction extends AbstractMenu {
- private P_BreadCrumbsListener m_breadCrumbsListener;
-
- @Override
- protected String getConfiguredText() {
- return "";
- }
-
- @Override
- protected boolean getConfiguredVisible() {
- return false;
- }
-
- @Override
- protected String getConfiguredIconId() {
- return Icons.HomeAction;
- }
-
- @Override
- protected void execInitAction() throws ProcessingException {
- if (m_breadCrumbsListener == null) {
- m_breadCrumbsListener = new P_BreadCrumbsListener();
- SERVICES.getService(IBreadCrumbsNavigationService.class).getBreadCrumbsNavigation().addBreadCrumbsListener(m_breadCrumbsListener);
- }
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- SERVICES.getService(IBreadCrumbsNavigationService.class).getBreadCrumbsNavigation().goHome();
- }
-
- private class P_BreadCrumbsListener implements BreadCrumbsListener, WeakEventListener {
-
- @Override
- public void breadCrumbsChanged(BreadCrumbsEvent e) {
- setVisible(e.getBreadCrumbsNavigation().isGoingHomePossible());
- }
-
- }
-}
+package org.eclipse.scout.rt.client.mobile.navigation;
+
+import org.eclipse.scout.commons.WeakEventListener;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.mobile.Icons;
+import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
+import org.eclipse.scout.service.SERVICES;
+
+@Order(20)
+public class AbstractMobileHomeAction extends AbstractMenu {
+ private P_BreadCrumbsListener m_breadCrumbsListener;
+
+ @Override
+ protected String getConfiguredText() {
+ return "";
+ }
+
+ @Override
+ protected boolean getConfiguredVisible() {
+ return false;
+ }
+
+ @Override
+ protected String getConfiguredIconId() {
+ return Icons.HomeAction;
+ }
+
+ @Override
+ protected void execInitAction() throws ProcessingException {
+ if (m_breadCrumbsListener == null) {
+ m_breadCrumbsListener = new P_BreadCrumbsListener();
+ SERVICES.getService(IBreadCrumbsNavigationService.class).getBreadCrumbsNavigation().addBreadCrumbsListener(m_breadCrumbsListener);
+ }
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ SERVICES.getService(IBreadCrumbsNavigationService.class).getBreadCrumbsNavigation().goHome();
+ }
+
+ private class P_BreadCrumbsListener implements BreadCrumbsListener, WeakEventListener {
+
+ @Override
+ public void breadCrumbsChanged(BreadCrumbsEvent e) {
+ setVisible(e.getBreadCrumbsNavigation().isGoingHomePossible());
+ }
+
+ }
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/navigation/BreadCrumb.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/navigation/BreadCrumb.java
index d30dee2460..c355a4011d 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/navigation/BreadCrumb.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/navigation/BreadCrumb.java
@@ -1,94 +1,94 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.navigation;
-
-import java.util.List;
-
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ClientJob;
-import org.eclipse.scout.rt.client.mobile.ui.desktop.MobileDesktopUtility;
-import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-
-/**
- * @since 3.9.0
- */
-public class BreadCrumb implements IBreadCrumb {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(BreadCrumb.class);
-
- private IForm m_form;
- private IBreadCrumbsNavigation m_breadCrumbsNavigation;
-
- public BreadCrumb(IBreadCrumbsNavigation breadCrumbsNavigation, IForm form) {
- m_breadCrumbsNavigation = breadCrumbsNavigation;
- m_form = form;
- }
-
- @Override
- public void activate() throws ProcessingException {
- autoCloseNavigationForms();
-
- //Add form to desktop if it is open but has been removed
- if (getForm() != null) {
- IDesktop desktop = ClientJob.getCurrentSession().getDesktop();
- if (getForm().isFormOpen() && !desktop.isShowing(getForm())) {
- if (MobileDesktopUtility.isToolForm(getForm())) {
- MobileDesktopUtility.openToolForm(getForm());
- }
- else {
- MobileDesktopUtility.addFormToDesktop(getForm());
- }
- }
- }
- }
-
- private void autoCloseNavigationForms() throws ProcessingException {
- IDesktop desktop = ClientJob.getCurrentSession().getDesktop();
-
- List<IForm> currentNavigationForms = getBreadCrumbsNavigation().getCurrentNavigationForms();
- for (IForm form : currentNavigationForms) {
- //Never close the active outline table form
- if (form == desktop.getOutlineTableForm()) {
- continue;
- }
- if (form != getForm() && !getBreadCrumbsNavigation().containsFormInHistory(form)) {
- MobileDesktopUtility.closeForm(form);
- }
- }
- }
-
- public IBreadCrumbsNavigation getBreadCrumbsNavigation() {
- return m_breadCrumbsNavigation;
- }
-
- @Override
- public IForm getForm() {
- return m_form;
- }
-
- @Override
- public String toString() {
- String formName = getForm().getTitle();
- if (StringUtility.isNullOrEmpty(formName)) {
- formName = getForm().toString();
- }
- return "Form: " + formName;
- }
-
- @Override
- public boolean belongsTo(IForm form) {
- return getForm() == form;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.navigation;
+
+import java.util.List;
+
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ClientJob;
+import org.eclipse.scout.rt.client.mobile.ui.desktop.MobileDesktopUtility;
+import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+
+/**
+ * @since 3.9.0
+ */
+public class BreadCrumb implements IBreadCrumb {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(BreadCrumb.class);
+
+ private IForm m_form;
+ private IBreadCrumbsNavigation m_breadCrumbsNavigation;
+
+ public BreadCrumb(IBreadCrumbsNavigation breadCrumbsNavigation, IForm form) {
+ m_breadCrumbsNavigation = breadCrumbsNavigation;
+ m_form = form;
+ }
+
+ @Override
+ public void activate() throws ProcessingException {
+ autoCloseNavigationForms();
+
+ //Add form to desktop if it is open but has been removed
+ if (getForm() != null) {
+ IDesktop desktop = ClientJob.getCurrentSession().getDesktop();
+ if (getForm().isFormOpen() && !desktop.isShowing(getForm())) {
+ if (MobileDesktopUtility.isToolForm(getForm())) {
+ MobileDesktopUtility.openToolForm(getForm());
+ }
+ else {
+ MobileDesktopUtility.addFormToDesktop(getForm());
+ }
+ }
+ }
+ }
+
+ private void autoCloseNavigationForms() throws ProcessingException {
+ IDesktop desktop = ClientJob.getCurrentSession().getDesktop();
+
+ List<IForm> currentNavigationForms = getBreadCrumbsNavigation().getCurrentNavigationForms();
+ for (IForm form : currentNavigationForms) {
+ //Never close the active outline table form
+ if (form == desktop.getOutlineTableForm()) {
+ continue;
+ }
+ if (form != getForm() && !getBreadCrumbsNavigation().containsFormInHistory(form)) {
+ MobileDesktopUtility.closeForm(form);
+ }
+ }
+ }
+
+ public IBreadCrumbsNavigation getBreadCrumbsNavigation() {
+ return m_breadCrumbsNavigation;
+ }
+
+ @Override
+ public IForm getForm() {
+ return m_form;
+ }
+
+ @Override
+ public String toString() {
+ String formName = getForm().getTitle();
+ if (StringUtility.isNullOrEmpty(formName)) {
+ formName = getForm().toString();
+ }
+ return "Form: " + formName;
+ }
+
+ @Override
+ public boolean belongsTo(IForm form) {
+ return getForm() == form;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/navigation/BreadCrumbsEvent.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/navigation/BreadCrumbsEvent.java
index ee00eeb11c..2ab406ab02 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/navigation/BreadCrumbsEvent.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/navigation/BreadCrumbsEvent.java
@@ -1,34 +1,34 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.navigation;
-
-import java.util.EventObject;
-
-/**
- * @since 3.9.0
- */
-public class BreadCrumbsEvent extends EventObject {
- private static final long serialVersionUID = 1L;
-
- private final int m_type;
- public static final int TYPE_CHANGED = 10;
-
- public BreadCrumbsEvent(IBreadCrumbsNavigation source, int type) {
- super(source);
-
- m_type = type;
- }
-
- public IBreadCrumbsNavigation getBreadCrumbsNavigation() {
- return (IBreadCrumbsNavigation) getSource();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.navigation;
+
+import java.util.EventObject;
+
+/**
+ * @since 3.9.0
+ */
+public class BreadCrumbsEvent extends EventObject {
+ private static final long serialVersionUID = 1L;
+
+ private final int m_type;
+ public static final int TYPE_CHANGED = 10;
+
+ public BreadCrumbsEvent(IBreadCrumbsNavigation source, int type) {
+ super(source);
+
+ m_type = type;
+ }
+
+ public IBreadCrumbsNavigation getBreadCrumbsNavigation() {
+ return (IBreadCrumbsNavigation) getSource();
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/navigation/BreadCrumbsListener.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/navigation/BreadCrumbsListener.java
index 5aaaa16b99..e740c1a91c 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/navigation/BreadCrumbsListener.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/navigation/BreadCrumbsListener.java
@@ -1,20 +1,20 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.navigation;
-
-import java.util.EventListener;
-
-/**
- * @since 3.9.0
- */
-public interface BreadCrumbsListener extends EventListener {
- void breadCrumbsChanged(BreadCrumbsEvent e);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.navigation;
+
+import java.util.EventListener;
+
+/**
+ * @since 3.9.0
+ */
+public interface BreadCrumbsListener extends EventListener {
+ void breadCrumbsChanged(BreadCrumbsEvent e);
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/navigation/BreadCrumbsNavigation.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/navigation/BreadCrumbsNavigation.java
index 77a039d204..94a3e54d2b 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/navigation/BreadCrumbsNavigation.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/navigation/BreadCrumbsNavigation.java
@@ -1,392 +1,392 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.navigation;
-
-import java.util.EventListener;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Stack;
-
-import org.eclipse.scout.commons.EventListenerList;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.mobile.ui.desktop.MobileDesktopUtility;
-import org.eclipse.scout.rt.client.mobile.ui.form.outline.IOutlineChooserForm;
-import org.eclipse.scout.rt.client.ui.desktop.DesktopEvent;
-import org.eclipse.scout.rt.client.ui.desktop.DesktopListener;
-import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
-import org.eclipse.scout.rt.client.ui.form.FormEvent;
-import org.eclipse.scout.rt.client.ui.form.FormListener;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-
-/**
- * @since 3.9.0
- */
-public class BreadCrumbsNavigation implements IBreadCrumbsNavigation {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(BreadCrumbsNavigation.class);
-
- private final EventListenerList m_listenerList;
- private Stack<IBreadCrumb> m_breadCrumbs;
- private P_DesktopListener m_desktopListener;
- private List<String> m_navigationFormsDisplayViewIds;
- private P_FormListener m_formListener;
- private IBreadCrumb m_currentBreadCrumb;
- private IDesktop m_desktop;
-
- public BreadCrumbsNavigation() {
- this(null);
- }
-
- public BreadCrumbsNavigation(IDesktop desktop) {
- if (desktop == null) {
- desktop = ClientSyncJob.getCurrentSession().getDesktop();
- }
- m_desktop = desktop;
- if (m_desktop == null) {
- throw new IllegalArgumentException("No desktop found. Cannot create bread crumbs navigation.");
- }
-
- m_breadCrumbs = new Stack<IBreadCrumb>();
- m_listenerList = new EventListenerList();
- m_desktopListener = new P_DesktopListener();
- desktop.addDesktopListener(m_desktopListener);
- }
-
- @Override
- public Stack<IBreadCrumb> getBreadCrumbs() {
- return m_breadCrumbs;
- }
-
- @Override
- public void trackDisplayViewId(String displayViewId) {
- if (m_navigationFormsDisplayViewIds == null) {
- m_navigationFormsDisplayViewIds = new LinkedList<String>();
- }
-
- if (!m_navigationFormsDisplayViewIds.contains(displayViewId)) {
- m_navigationFormsDisplayViewIds.add(displayViewId);
- }
- }
-
- @Override
- public void stepBack() throws ProcessingException {
- IDesktop desktop = ClientSyncJob.getCurrentSession().getDesktop();
- if (desktop == null) {
- return;
- }
-
- Stack<IBreadCrumb> breadCrumbs = getBreadCrumbs();
- if (breadCrumbs.size() == 0) {
- LOG.debug("Stepping back not possible because no bread crumbs found.");
- return;
- }
-
- m_currentBreadCrumb = breadCrumbs.pop();
- m_currentBreadCrumb.activate();
-
- LOG.debug("Stepped back to: " + m_currentBreadCrumb);
- LOG.debug("Current bread crumbs way: " + toString());
-
- fireBreadCrumbsChanged();
- }
-
- @Override
- public boolean isSteppingBackPossible() {
- return getBreadCrumbs().size() > 0;
- }
-
- @Override
- public boolean isGoingHomePossible() {
- return isSteppingBackPossible();
- }
-
- @Override
- public void goHome() throws ProcessingException {
- if (getBreadCrumbs().size() == 0) {
- return;
- }
-
- activate(getBreadCrumbs().get(0));
- }
-
- public void activate(IBreadCrumb breadCrumb) throws ProcessingException {
- if (!getBreadCrumbs().contains(breadCrumb)) {
- return;
- }
-
- do {
- m_currentBreadCrumb = getBreadCrumbs().pop();
- }
- while (m_currentBreadCrumb != breadCrumb);
-
- m_currentBreadCrumb.activate();
- LOG.debug("Activated bread crumb: " + m_currentBreadCrumb);
- LOG.debug("Current bread crumbs way: " + toString());
-
- fireBreadCrumbsChanged();
- }
-
- @Override
- public List<IForm> getCurrentNavigationForms() {
- List<IForm> navigationForms = new LinkedList<IForm>();
-
- IForm[] dialogStack = getDesktop().getDialogStack();
- for (IForm form : dialogStack) {
- navigationForms.add(form);
- }
-
- IForm[] viewStack = getDesktop().getViewStack();
- for (IForm form : viewStack) {
- if (m_navigationFormsDisplayViewIds != null && m_navigationFormsDisplayViewIds.contains(form.getDisplayViewId())) {
- navigationForms.add(form);
- }
- }
-
- return navigationForms;
- }
-
- @Override
- public boolean containsFormInHistory(IForm form) {
- if (form == null) {
- return false;
- }
-
- for (IBreadCrumb breadCrumb : getBreadCrumbs()) {
- if (form == breadCrumb.getForm()) {
- return true;
- }
- }
-
- return false;
- }
-
- @Override
- public IForm getCurrentNavigationForm() {
- if (m_currentBreadCrumb != null) {
- return m_currentBreadCrumb.getForm();
- }
-
- return null;
- }
-
- @Override
- public IDesktop getDesktop() {
- return m_desktop;
- }
-
- private void destroy() {
- if (m_desktopListener != null) {
- getDesktop().removeDesktopListener(m_desktopListener);
- m_desktopListener = null;
- }
-
- getBreadCrumbs().clear();
- }
-
- private void removeExistingBreadCrumb(IForm form) {
- if (m_currentBreadCrumb == null) {
- return;
- }
-
- if (m_currentBreadCrumb.belongsTo(form)) {
- LOG.debug("Removing existing bread crumb: " + m_currentBreadCrumb);
-
- if (getBreadCrumbs().size() > 0) {
- m_currentBreadCrumb = getBreadCrumbs().pop();
- }
- else {
- m_currentBreadCrumb = null;
- }
-
- LOG.debug("Current bread crumbs way: " + toString());
- fireBreadCrumbsChanged();
- }
- else {
- IBreadCrumb[] breadCrumbs = getBreadCrumbs().toArray(new IBreadCrumb[getBreadCrumbs().size()]);
- int pos = 0;
- for (IBreadCrumb breadCrumb : breadCrumbs) {
- if (breadCrumb.belongsTo(form)) {
- LOG.debug("Removing existing bread crumb: " + breadCrumb);
-
- getBreadCrumbs().remove(breadCrumb);
- mergeDuplicates(pos);
-
- LOG.debug("Current bread crumbs way: " + toString());
- fireBreadCrumbsChanged();
- return;
- }
- pos++;
- }
- }
- }
-
- /**
- * Makes sure that the bread crumbs at position pos and pos -1 are not the same.
- * <p>
- * Such successive duplicate bread crumbs make no sense because pressing back on such a duplicate would just open the
- * same form again.
- */
- private void mergeDuplicates(int pos) {
- if (pos <= 0 || pos >= getBreadCrumbs().size()) {
- return;
- }
-
- IBreadCrumb predecessor = getBreadCrumbs().get(pos - 1);
- IBreadCrumb successor = getBreadCrumbs().get(pos);
- if (predecessor.getForm() == successor.getForm()) {
- getBreadCrumbs().remove(successor);
- LOG.debug("Removing duplicate bread crumb: " + successor);
- }
- }
-
- private void addNewBreadCrumb(IForm form) {
- if (m_currentBreadCrumb != null) {
- //Ignore attempts to insert the same bread crumb again
- if (m_currentBreadCrumb.belongsTo(form)) {
- return;
- }
-
- getBreadCrumbs().add(m_currentBreadCrumb);
- LOG.debug("Added new bread crumb: " + m_currentBreadCrumb);
- }
-
- if (form instanceof IOutlineChooserForm) {
- m_currentBreadCrumb = new OutlineChooserBreadCrumb(this, form);
- }
- else {
- m_currentBreadCrumb = new BreadCrumb(this, form);
- }
- LOG.debug("Current bread crumbs way: " + toString());
- fireBreadCrumbsChanged();
- }
-
- @Override
- public void addBreadCrumbsListener(BreadCrumbsListener listener) {
- m_listenerList.add(BreadCrumbsListener.class, listener);
- }
-
- @Override
- public void removeBreadCrumbsListener(BreadCrumbsListener listener) {
- m_listenerList.remove(BreadCrumbsListener.class, listener);
- }
-
- private void fireBreadCrumbsChanged() {
- BreadCrumbsEvent e = new BreadCrumbsEvent(this, BreadCrumbsEvent.TYPE_CHANGED);
- fireBreadCrumbsEvent(e);
- }
-
- private void fireBreadCrumbsEvent(BreadCrumbsEvent e) {
- EventListener[] a = m_listenerList.getListeners(BreadCrumbsListener.class);
- if (a != null) {
- for (int i = 0; i < a.length; i++) {
- ((BreadCrumbsListener) a[i]).breadCrumbsChanged(e);
- }
- }
- }
-
- @Override
- public String toString() {
- String breadCrumbsWay = "";
- for (IBreadCrumb breadCrumb : getBreadCrumbs()) {
- breadCrumbsWay += "[" + breadCrumb + "] > ";
- }
- if (m_currentBreadCrumb != null) {
- breadCrumbsWay += "[" + m_currentBreadCrumb + "]";
- }
- else {
- breadCrumbsWay = "empty bread crumbs navigation";
- }
-
- return breadCrumbsWay;
- }
-
- private class P_DesktopListener implements DesktopListener {
-
- @Override
- public void desktopChanged(DesktopEvent e) {
-
- switch (e.getType()) {
- case DesktopEvent.TYPE_FORM_ADDED: {
- handleFormAdded(e);
- break;
- }
- case DesktopEvent.TYPE_FORM_REMOVED: {
- handleFormRemoved(e);
- break;
- }
- case DesktopEvent.TYPE_DESKTOP_CLOSED: {
- destroy();
- break;
- }
- default:
- break;
- }
- }
-
- private void handleFormAdded(DesktopEvent e) {
- IForm form = e.getForm();
- if (IForm.DISPLAY_HINT_VIEW == form.getDisplayHint() && m_navigationFormsDisplayViewIds != null && !m_navigationFormsDisplayViewIds.contains(form.getDisplayViewId())) {
- return;
- }
-
- if (m_currentBreadCrumb == null) {
- addNewBreadCrumb(form);
- }
- else if (m_currentBreadCrumb.getForm() != form) {
- addNewBreadCrumb(form);
- }
-
- attachFormListener(form);
- }
-
- private void handleFormRemoved(DesktopEvent e) {
- if (getBreadCrumbs().size() == 0) {
- return;
- }
-
- IForm form = e.getForm();
- if (MobileDesktopUtility.isToolForm(form)) {
- // Stepping back must never open a tool form -> Remove from bread crumbs
- removeExistingBreadCrumb(form);
- }
- }
-
- private void attachFormListener(IForm form) {
- if (m_formListener == null) {
- m_formListener = new P_FormListener();
- }
- form.removeFormListener(m_formListener);
- form.addFormListener(m_formListener);
- }
-
- }
-
- /**
- * Makes sure closed forms get removed from the bread crumbs.
- */
- private class P_FormListener implements FormListener {
-
- @Override
- public void formChanged(FormEvent e) throws ProcessingException {
- if (FormEvent.TYPE_CLOSED == e.getType()) {
- IForm form = e.getForm();
- removeExistingBreadCrumb(form);
- detachFormListener(form);
- }
- }
-
- private void detachFormListener(IForm form) {
- form.removeFormListener(this);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.navigation;
+
+import java.util.EventListener;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Stack;
+
+import org.eclipse.scout.commons.EventListenerList;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.mobile.ui.desktop.MobileDesktopUtility;
+import org.eclipse.scout.rt.client.mobile.ui.form.outline.IOutlineChooserForm;
+import org.eclipse.scout.rt.client.ui.desktop.DesktopEvent;
+import org.eclipse.scout.rt.client.ui.desktop.DesktopListener;
+import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
+import org.eclipse.scout.rt.client.ui.form.FormEvent;
+import org.eclipse.scout.rt.client.ui.form.FormListener;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+
+/**
+ * @since 3.9.0
+ */
+public class BreadCrumbsNavigation implements IBreadCrumbsNavigation {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(BreadCrumbsNavigation.class);
+
+ private final EventListenerList m_listenerList;
+ private Stack<IBreadCrumb> m_breadCrumbs;
+ private P_DesktopListener m_desktopListener;
+ private List<String> m_navigationFormsDisplayViewIds;
+ private P_FormListener m_formListener;
+ private IBreadCrumb m_currentBreadCrumb;
+ private IDesktop m_desktop;
+
+ public BreadCrumbsNavigation() {
+ this(null);
+ }
+
+ public BreadCrumbsNavigation(IDesktop desktop) {
+ if (desktop == null) {
+ desktop = ClientSyncJob.getCurrentSession().getDesktop();
+ }
+ m_desktop = desktop;
+ if (m_desktop == null) {
+ throw new IllegalArgumentException("No desktop found. Cannot create bread crumbs navigation.");
+ }
+
+ m_breadCrumbs = new Stack<IBreadCrumb>();
+ m_listenerList = new EventListenerList();
+ m_desktopListener = new P_DesktopListener();
+ desktop.addDesktopListener(m_desktopListener);
+ }
+
+ @Override
+ public Stack<IBreadCrumb> getBreadCrumbs() {
+ return m_breadCrumbs;
+ }
+
+ @Override
+ public void trackDisplayViewId(String displayViewId) {
+ if (m_navigationFormsDisplayViewIds == null) {
+ m_navigationFormsDisplayViewIds = new LinkedList<String>();
+ }
+
+ if (!m_navigationFormsDisplayViewIds.contains(displayViewId)) {
+ m_navigationFormsDisplayViewIds.add(displayViewId);
+ }
+ }
+
+ @Override
+ public void stepBack() throws ProcessingException {
+ IDesktop desktop = ClientSyncJob.getCurrentSession().getDesktop();
+ if (desktop == null) {
+ return;
+ }
+
+ Stack<IBreadCrumb> breadCrumbs = getBreadCrumbs();
+ if (breadCrumbs.size() == 0) {
+ LOG.debug("Stepping back not possible because no bread crumbs found.");
+ return;
+ }
+
+ m_currentBreadCrumb = breadCrumbs.pop();
+ m_currentBreadCrumb.activate();
+
+ LOG.debug("Stepped back to: " + m_currentBreadCrumb);
+ LOG.debug("Current bread crumbs way: " + toString());
+
+ fireBreadCrumbsChanged();
+ }
+
+ @Override
+ public boolean isSteppingBackPossible() {
+ return getBreadCrumbs().size() > 0;
+ }
+
+ @Override
+ public boolean isGoingHomePossible() {
+ return isSteppingBackPossible();
+ }
+
+ @Override
+ public void goHome() throws ProcessingException {
+ if (getBreadCrumbs().size() == 0) {
+ return;
+ }
+
+ activate(getBreadCrumbs().get(0));
+ }
+
+ public void activate(IBreadCrumb breadCrumb) throws ProcessingException {
+ if (!getBreadCrumbs().contains(breadCrumb)) {
+ return;
+ }
+
+ do {
+ m_currentBreadCrumb = getBreadCrumbs().pop();
+ }
+ while (m_currentBreadCrumb != breadCrumb);
+
+ m_currentBreadCrumb.activate();
+ LOG.debug("Activated bread crumb: " + m_currentBreadCrumb);
+ LOG.debug("Current bread crumbs way: " + toString());
+
+ fireBreadCrumbsChanged();
+ }
+
+ @Override
+ public List<IForm> getCurrentNavigationForms() {
+ List<IForm> navigationForms = new LinkedList<IForm>();
+
+ IForm[] dialogStack = getDesktop().getDialogStack();
+ for (IForm form : dialogStack) {
+ navigationForms.add(form);
+ }
+
+ IForm[] viewStack = getDesktop().getViewStack();
+ for (IForm form : viewStack) {
+ if (m_navigationFormsDisplayViewIds != null && m_navigationFormsDisplayViewIds.contains(form.getDisplayViewId())) {
+ navigationForms.add(form);
+ }
+ }
+
+ return navigationForms;
+ }
+
+ @Override
+ public boolean containsFormInHistory(IForm form) {
+ if (form == null) {
+ return false;
+ }
+
+ for (IBreadCrumb breadCrumb : getBreadCrumbs()) {
+ if (form == breadCrumb.getForm()) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ @Override
+ public IForm getCurrentNavigationForm() {
+ if (m_currentBreadCrumb != null) {
+ return m_currentBreadCrumb.getForm();
+ }
+
+ return null;
+ }
+
+ @Override
+ public IDesktop getDesktop() {
+ return m_desktop;
+ }
+
+ private void destroy() {
+ if (m_desktopListener != null) {
+ getDesktop().removeDesktopListener(m_desktopListener);
+ m_desktopListener = null;
+ }
+
+ getBreadCrumbs().clear();
+ }
+
+ private void removeExistingBreadCrumb(IForm form) {
+ if (m_currentBreadCrumb == null) {
+ return;
+ }
+
+ if (m_currentBreadCrumb.belongsTo(form)) {
+ LOG.debug("Removing existing bread crumb: " + m_currentBreadCrumb);
+
+ if (getBreadCrumbs().size() > 0) {
+ m_currentBreadCrumb = getBreadCrumbs().pop();
+ }
+ else {
+ m_currentBreadCrumb = null;
+ }
+
+ LOG.debug("Current bread crumbs way: " + toString());
+ fireBreadCrumbsChanged();
+ }
+ else {
+ IBreadCrumb[] breadCrumbs = getBreadCrumbs().toArray(new IBreadCrumb[getBreadCrumbs().size()]);
+ int pos = 0;
+ for (IBreadCrumb breadCrumb : breadCrumbs) {
+ if (breadCrumb.belongsTo(form)) {
+ LOG.debug("Removing existing bread crumb: " + breadCrumb);
+
+ getBreadCrumbs().remove(breadCrumb);
+ mergeDuplicates(pos);
+
+ LOG.debug("Current bread crumbs way: " + toString());
+ fireBreadCrumbsChanged();
+ return;
+ }
+ pos++;
+ }
+ }
+ }
+
+ /**
+ * Makes sure that the bread crumbs at position pos and pos -1 are not the same.
+ * <p>
+ * Such successive duplicate bread crumbs make no sense because pressing back on such a duplicate would just open the
+ * same form again.
+ */
+ private void mergeDuplicates(int pos) {
+ if (pos <= 0 || pos >= getBreadCrumbs().size()) {
+ return;
+ }
+
+ IBreadCrumb predecessor = getBreadCrumbs().get(pos - 1);
+ IBreadCrumb successor = getBreadCrumbs().get(pos);
+ if (predecessor.getForm() == successor.getForm()) {
+ getBreadCrumbs().remove(successor);
+ LOG.debug("Removing duplicate bread crumb: " + successor);
+ }
+ }
+
+ private void addNewBreadCrumb(IForm form) {
+ if (m_currentBreadCrumb != null) {
+ //Ignore attempts to insert the same bread crumb again
+ if (m_currentBreadCrumb.belongsTo(form)) {
+ return;
+ }
+
+ getBreadCrumbs().add(m_currentBreadCrumb);
+ LOG.debug("Added new bread crumb: " + m_currentBreadCrumb);
+ }
+
+ if (form instanceof IOutlineChooserForm) {
+ m_currentBreadCrumb = new OutlineChooserBreadCrumb(this, form);
+ }
+ else {
+ m_currentBreadCrumb = new BreadCrumb(this, form);
+ }
+ LOG.debug("Current bread crumbs way: " + toString());
+ fireBreadCrumbsChanged();
+ }
+
+ @Override
+ public void addBreadCrumbsListener(BreadCrumbsListener listener) {
+ m_listenerList.add(BreadCrumbsListener.class, listener);
+ }
+
+ @Override
+ public void removeBreadCrumbsListener(BreadCrumbsListener listener) {
+ m_listenerList.remove(BreadCrumbsListener.class, listener);
+ }
+
+ private void fireBreadCrumbsChanged() {
+ BreadCrumbsEvent e = new BreadCrumbsEvent(this, BreadCrumbsEvent.TYPE_CHANGED);
+ fireBreadCrumbsEvent(e);
+ }
+
+ private void fireBreadCrumbsEvent(BreadCrumbsEvent e) {
+ EventListener[] a = m_listenerList.getListeners(BreadCrumbsListener.class);
+ if (a != null) {
+ for (int i = 0; i < a.length; i++) {
+ ((BreadCrumbsListener) a[i]).breadCrumbsChanged(e);
+ }
+ }
+ }
+
+ @Override
+ public String toString() {
+ String breadCrumbsWay = "";
+ for (IBreadCrumb breadCrumb : getBreadCrumbs()) {
+ breadCrumbsWay += "[" + breadCrumb + "] > ";
+ }
+ if (m_currentBreadCrumb != null) {
+ breadCrumbsWay += "[" + m_currentBreadCrumb + "]";
+ }
+ else {
+ breadCrumbsWay = "empty bread crumbs navigation";
+ }
+
+ return breadCrumbsWay;
+ }
+
+ private class P_DesktopListener implements DesktopListener {
+
+ @Override
+ public void desktopChanged(DesktopEvent e) {
+
+ switch (e.getType()) {
+ case DesktopEvent.TYPE_FORM_ADDED: {
+ handleFormAdded(e);
+ break;
+ }
+ case DesktopEvent.TYPE_FORM_REMOVED: {
+ handleFormRemoved(e);
+ break;
+ }
+ case DesktopEvent.TYPE_DESKTOP_CLOSED: {
+ destroy();
+ break;
+ }
+ default:
+ break;
+ }
+ }
+
+ private void handleFormAdded(DesktopEvent e) {
+ IForm form = e.getForm();
+ if (IForm.DISPLAY_HINT_VIEW == form.getDisplayHint() && m_navigationFormsDisplayViewIds != null && !m_navigationFormsDisplayViewIds.contains(form.getDisplayViewId())) {
+ return;
+ }
+
+ if (m_currentBreadCrumb == null) {
+ addNewBreadCrumb(form);
+ }
+ else if (m_currentBreadCrumb.getForm() != form) {
+ addNewBreadCrumb(form);
+ }
+
+ attachFormListener(form);
+ }
+
+ private void handleFormRemoved(DesktopEvent e) {
+ if (getBreadCrumbs().size() == 0) {
+ return;
+ }
+
+ IForm form = e.getForm();
+ if (MobileDesktopUtility.isToolForm(form)) {
+ // Stepping back must never open a tool form -> Remove from bread crumbs
+ removeExistingBreadCrumb(form);
+ }
+ }
+
+ private void attachFormListener(IForm form) {
+ if (m_formListener == null) {
+ m_formListener = new P_FormListener();
+ }
+ form.removeFormListener(m_formListener);
+ form.addFormListener(m_formListener);
+ }
+
+ }
+
+ /**
+ * Makes sure closed forms get removed from the bread crumbs.
+ */
+ private class P_FormListener implements FormListener {
+
+ @Override
+ public void formChanged(FormEvent e) throws ProcessingException {
+ if (FormEvent.TYPE_CLOSED == e.getType()) {
+ IForm form = e.getForm();
+ removeExistingBreadCrumb(form);
+ detachFormListener(form);
+ }
+ }
+
+ private void detachFormListener(IForm form) {
+ form.removeFormListener(this);
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/navigation/BreadCrumbsNavigationService.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/navigation/BreadCrumbsNavigationService.java
index 789dcf7ec2..20b8296ca4 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/navigation/BreadCrumbsNavigationService.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/navigation/BreadCrumbsNavigationService.java
@@ -1,49 +1,49 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.navigation;
-
-import org.eclipse.scout.rt.client.ClientJob;
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
-import org.eclipse.scout.service.AbstractService;
-
-/**
- * @since 3.9.0
- */
-public class BreadCrumbsNavigationService extends AbstractService implements IBreadCrumbsNavigationService {
- private String SESSION_DATA_KEY = "BreadCrumbsNavigationData";
-
- protected IBreadCrumbsNavigation createBreadCrumbsNavigation() {
- return new BreadCrumbsNavigation();
- }
-
- protected IBreadCrumbsNavigation createBreadCrumbsNavigation(IDesktop desktop) {
- return new BreadCrumbsNavigation(desktop);
- }
-
- @Override
- public IBreadCrumbsNavigation getBreadCrumbsNavigation(IDesktop desktop) {
- IClientSession session = ClientJob.getCurrentSession();
- IBreadCrumbsNavigation data = (IBreadCrumbsNavigation) session.getData(SESSION_DATA_KEY);
-
- if (data == null) {
- data = createBreadCrumbsNavigation(desktop);
- session.setData(SESSION_DATA_KEY, data);
- }
- return data;
- }
-
- @Override
- public IBreadCrumbsNavigation getBreadCrumbsNavigation() {
- return getBreadCrumbsNavigation(null);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.navigation;
+
+import org.eclipse.scout.rt.client.ClientJob;
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
+import org.eclipse.scout.service.AbstractService;
+
+/**
+ * @since 3.9.0
+ */
+public class BreadCrumbsNavigationService extends AbstractService implements IBreadCrumbsNavigationService {
+ private String SESSION_DATA_KEY = "BreadCrumbsNavigationData";
+
+ protected IBreadCrumbsNavigation createBreadCrumbsNavigation() {
+ return new BreadCrumbsNavigation();
+ }
+
+ protected IBreadCrumbsNavigation createBreadCrumbsNavigation(IDesktop desktop) {
+ return new BreadCrumbsNavigation(desktop);
+ }
+
+ @Override
+ public IBreadCrumbsNavigation getBreadCrumbsNavigation(IDesktop desktop) {
+ IClientSession session = ClientJob.getCurrentSession();
+ IBreadCrumbsNavigation data = (IBreadCrumbsNavigation) session.getData(SESSION_DATA_KEY);
+
+ if (data == null) {
+ data = createBreadCrumbsNavigation(desktop);
+ session.setData(SESSION_DATA_KEY, data);
+ }
+ return data;
+ }
+
+ @Override
+ public IBreadCrumbsNavigation getBreadCrumbsNavigation() {
+ return getBreadCrumbsNavigation(null);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/navigation/IBreadCrumb.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/navigation/IBreadCrumb.java
index c984c9104e..c26ccd307d 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/navigation/IBreadCrumb.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/navigation/IBreadCrumb.java
@@ -1,26 +1,26 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.navigation;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-
-/**
- * @since 3.9.0
- */
-public interface IBreadCrumb {
-
- void activate() throws ProcessingException;
-
- IForm getForm();
-
- boolean belongsTo(IForm form);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.navigation;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+
+/**
+ * @since 3.9.0
+ */
+public interface IBreadCrumb {
+
+ void activate() throws ProcessingException;
+
+ IForm getForm();
+
+ boolean belongsTo(IForm form);
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/navigation/IBreadCrumbsNavigation.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/navigation/IBreadCrumbsNavigation.java
index 5d630661ab..4f2171fb0f 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/navigation/IBreadCrumbsNavigation.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/navigation/IBreadCrumbsNavigation.java
@@ -1,47 +1,47 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.navigation;
-
-import java.util.List;
-import java.util.Stack;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-
-/**
- * @since 3.9.0
- */
-public interface IBreadCrumbsNavigation {
- void goHome() throws ProcessingException;
-
- void stepBack() throws ProcessingException;
-
- boolean isSteppingBackPossible();
-
- boolean isGoingHomePossible();
-
- IForm getCurrentNavigationForm();
-
- List<IForm> getCurrentNavigationForms();
-
- Stack<IBreadCrumb> getBreadCrumbs();
-
- boolean containsFormInHistory(IForm form);
-
- void addBreadCrumbsListener(BreadCrumbsListener listener);
-
- void removeBreadCrumbsListener(BreadCrumbsListener listener);
-
- void trackDisplayViewId(String displayViewId);
-
- IDesktop getDesktop();
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.navigation;
+
+import java.util.List;
+import java.util.Stack;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+
+/**
+ * @since 3.9.0
+ */
+public interface IBreadCrumbsNavigation {
+ void goHome() throws ProcessingException;
+
+ void stepBack() throws ProcessingException;
+
+ boolean isSteppingBackPossible();
+
+ boolean isGoingHomePossible();
+
+ IForm getCurrentNavigationForm();
+
+ List<IForm> getCurrentNavigationForms();
+
+ Stack<IBreadCrumb> getBreadCrumbs();
+
+ boolean containsFormInHistory(IForm form);
+
+ void addBreadCrumbsListener(BreadCrumbsListener listener);
+
+ void removeBreadCrumbsListener(BreadCrumbsListener listener);
+
+ void trackDisplayViewId(String displayViewId);
+
+ IDesktop getDesktop();
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/navigation/IBreadCrumbsNavigationService.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/navigation/IBreadCrumbsNavigationService.java
index 6d41efc161..d2bebfdf39 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/navigation/IBreadCrumbsNavigationService.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/navigation/IBreadCrumbsNavigationService.java
@@ -1,25 +1,25 @@
-package org.eclipse.scout.rt.client.mobile.navigation;
-
-import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
-import org.eclipse.scout.service.IService2;
-
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-
-/**
- * @since 3.9.0
- */
-public interface IBreadCrumbsNavigationService extends IService2 {
-
- IBreadCrumbsNavigation getBreadCrumbsNavigation(IDesktop desktop);
-
- IBreadCrumbsNavigation getBreadCrumbsNavigation();
-}
+package org.eclipse.scout.rt.client.mobile.navigation;
+
+import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
+import org.eclipse.scout.service.IService2;
+
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+
+/**
+ * @since 3.9.0
+ */
+public interface IBreadCrumbsNavigationService extends IService2 {
+
+ IBreadCrumbsNavigation getBreadCrumbsNavigation(IDesktop desktop);
+
+ IBreadCrumbsNavigation getBreadCrumbsNavigation();
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/navigation/OutlineChooserBreadCrumb.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/navigation/OutlineChooserBreadCrumb.java
index dd3e701489..d370e99599 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/navigation/OutlineChooserBreadCrumb.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/navigation/OutlineChooserBreadCrumb.java
@@ -1,40 +1,40 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.navigation;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-
-/**
- * @since 3.9.0
- */
-public class OutlineChooserBreadCrumb extends BreadCrumb {
-
- public OutlineChooserBreadCrumb(IBreadCrumbsNavigation breadCrumbsNavigation, IForm form) {
- super(breadCrumbsNavigation, form);
- }
-
- @Override
- public void activate() throws ProcessingException {
- super.activate();
-
- //Clear any outline selection to make sure drill down works as expected again and again
- IDesktop desktop = ClientSyncJob.getCurrentSession().getDesktop();
- for (IOutline outline : desktop.getAvailableOutlines()) {
- outline.selectNode(null);
- }
- desktop.setOutline((IOutline) null);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.navigation;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+
+/**
+ * @since 3.9.0
+ */
+public class OutlineChooserBreadCrumb extends BreadCrumb {
+
+ public OutlineChooserBreadCrumb(IBreadCrumbsNavigation breadCrumbsNavigation, IForm form) {
+ super(breadCrumbsNavigation, form);
+ }
+
+ @Override
+ public void activate() throws ProcessingException {
+ super.activate();
+
+ //Clear any outline selection to make sure drill down works as expected again and again
+ IDesktop desktop = ClientSyncJob.getCurrentSession().getDesktop();
+ for (IOutline outline : desktop.getAvailableOutlines()) {
+ outline.selectNode(null);
+ }
+ desktop.setOutline((IOutline) null);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/services/MobileClientServiceFactory.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/services/MobileClientServiceFactory.java
index f32be100e9..7128b1c5c6 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/services/MobileClientServiceFactory.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/services/MobileClientServiceFactory.java
@@ -1,43 +1,43 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.services;
-
-import org.eclipse.scout.rt.client.ClientJob;
-import org.eclipse.scout.rt.client.services.ClientServiceFactory;
-import org.eclipse.scout.rt.shared.ui.IUiDeviceType;
-import org.eclipse.scout.rt.shared.ui.UiDeviceType;
-import org.eclipse.scout.rt.shared.ui.UserAgent;
-import org.eclipse.scout.service.ServiceUtility;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.ServiceRegistration;
-
-/**
- * Accepts the service only if the current device is a mobile or tablet.
- *
- * @since 3.9.0
- * @see {@link UserAgent}
- */
-public class MobileClientServiceFactory extends ClientServiceFactory {
-
- public MobileClientServiceFactory(Class<?> serviceClass) {
- super(serviceClass);
- }
-
- @Override
- public Object getService(Bundle bundle, ServiceRegistration registration) {
- IUiDeviceType uiDeviceType = ClientJob.getCurrentSession().getUserAgent().getUiDeviceType();
- if (!UiDeviceType.MOBILE.equals(uiDeviceType) && !UiDeviceType.TABLET.equals(uiDeviceType)) {
- return ServiceUtility.NULL_SERVICE;
- }
-
- return super.getService(bundle, registration);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.services;
+
+import org.eclipse.scout.rt.client.ClientJob;
+import org.eclipse.scout.rt.client.services.ClientServiceFactory;
+import org.eclipse.scout.rt.shared.ui.IUiDeviceType;
+import org.eclipse.scout.rt.shared.ui.UiDeviceType;
+import org.eclipse.scout.rt.shared.ui.UserAgent;
+import org.eclipse.scout.service.ServiceUtility;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.ServiceRegistration;
+
+/**
+ * Accepts the service only if the current device is a mobile or tablet.
+ *
+ * @since 3.9.0
+ * @see {@link UserAgent}
+ */
+public class MobileClientServiceFactory extends ClientServiceFactory {
+
+ public MobileClientServiceFactory(Class<?> serviceClass) {
+ super(serviceClass);
+ }
+
+ @Override
+ public Object getService(Bundle bundle, ServiceRegistration registration) {
+ IUiDeviceType uiDeviceType = ClientJob.getCurrentSession().getUserAgent().getUiDeviceType();
+ if (!UiDeviceType.MOBILE.equals(uiDeviceType) && !UiDeviceType.TABLET.equals(uiDeviceType)) {
+ return ServiceUtility.NULL_SERVICE;
+ }
+
+ return super.getService(bundle, registration);
+ }
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/transformation/DeviceTransformationService.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/transformation/DeviceTransformationService.java
index 2fa36321f3..5d80503aa1 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/transformation/DeviceTransformationService.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/transformation/DeviceTransformationService.java
@@ -1,52 +1,52 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.transformation;
-
-import org.eclipse.scout.rt.client.ClientJob;
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
-import org.eclipse.scout.rt.shared.ui.UserAgentUtility;
-import org.eclipse.scout.service.AbstractService;
-
-/**
- * @since 3.9.0
- */
-public class DeviceTransformationService extends AbstractService implements IDeviceTransformationService {
-
- private String SESSION_DATA_KEY = "DeviceTransformationServiceData";
-
- protected IDeviceTransformer createDeviceTransformer(IDesktop desktop) {
- if (UserAgentUtility.isTabletDevice()) {
- return new TabletDeviceTransformer(desktop);
- }
- else {
- return new MobileDeviceTransformer(desktop);
- }
- }
-
- @Override
- public IDeviceTransformer getDeviceTransformer() {
- return getDeviceTransformer(null);
- }
-
- @Override
- public IDeviceTransformer getDeviceTransformer(IDesktop desktop) {
- IClientSession session = ClientJob.getCurrentSession();
- IDeviceTransformer data = (IDeviceTransformer) session.getData(SESSION_DATA_KEY);
-
- if (data == null) {
- data = createDeviceTransformer(desktop);
- session.setData(SESSION_DATA_KEY, data);
- }
- return data;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.transformation;
+
+import org.eclipse.scout.rt.client.ClientJob;
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
+import org.eclipse.scout.rt.shared.ui.UserAgentUtility;
+import org.eclipse.scout.service.AbstractService;
+
+/**
+ * @since 3.9.0
+ */
+public class DeviceTransformationService extends AbstractService implements IDeviceTransformationService {
+
+ private String SESSION_DATA_KEY = "DeviceTransformationServiceData";
+
+ protected IDeviceTransformer createDeviceTransformer(IDesktop desktop) {
+ if (UserAgentUtility.isTabletDevice()) {
+ return new TabletDeviceTransformer(desktop);
+ }
+ else {
+ return new MobileDeviceTransformer(desktop);
+ }
+ }
+
+ @Override
+ public IDeviceTransformer getDeviceTransformer() {
+ return getDeviceTransformer(null);
+ }
+
+ @Override
+ public IDeviceTransformer getDeviceTransformer(IDesktop desktop) {
+ IClientSession session = ClientJob.getCurrentSession();
+ IDeviceTransformer data = (IDeviceTransformer) session.getData(SESSION_DATA_KEY);
+
+ if (data == null) {
+ data = createDeviceTransformer(desktop);
+ session.setData(SESSION_DATA_KEY, data);
+ }
+ return data;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/transformation/IDeviceTransformationService.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/transformation/IDeviceTransformationService.java
index 76edbfc800..dc0ec85eb4 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/transformation/IDeviceTransformationService.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/transformation/IDeviceTransformationService.java
@@ -1,23 +1,23 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.transformation;
-
-import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
-import org.eclipse.scout.service.IService2;
-
-/**
- * @since 3.9.0
- */
-public interface IDeviceTransformationService extends IService2 {
- IDeviceTransformer getDeviceTransformer();
-
- IDeviceTransformer getDeviceTransformer(IDesktop desktop);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.transformation;
+
+import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
+import org.eclipse.scout.service.IService2;
+
+/**
+ * @since 3.9.0
+ */
+public interface IDeviceTransformationService extends IService2 {
+ IDeviceTransformer getDeviceTransformer();
+
+ IDeviceTransformer getDeviceTransformer(IDesktop desktop);
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/transformation/IDeviceTransformer.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/transformation/IDeviceTransformer.java
index 4bb577958c..c1d8d56b0d 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/transformation/IDeviceTransformer.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/transformation/IDeviceTransformer.java
@@ -1,52 +1,52 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.transformation;
-
-import java.util.Collection;
-import java.util.List;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.action.IAction;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.client.ui.form.fields.tabbox.ITabBox;
-
-/**
- * @since 3.9.0
- */
-public interface IDeviceTransformer {
- void adaptDesktopActions(Collection<IAction> actions);
-
- void tablePageLoaded(IPageWithTable<?> tablePage) throws ProcessingException;
-
- void transformForm(IForm form) throws ProcessingException;
-
- void transformOutline(IOutline outline) throws ProcessingException;
-
- void transformPageDetailTable(ITable table) throws ProcessingException;
-
- boolean acceptForm(IForm form);
-
- void adaptFormHeaderLeftActions(IForm form, List<IMenu> menuList);
-
- void adaptFormHeaderRightActions(IForm form, List<IMenu> menuList);
-
- boolean acceptMobileTabBoxTransformation(ITabBox tabBox);
-
- /**
- * @return a list of accepted view ids (IForm#VIEW_ID_* or null to accept all.
- * @see {@link IForm}
- */
- List<String> getAcceptedViewIds();
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.transformation;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.action.IAction;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.client.ui.form.fields.tabbox.ITabBox;
+
+/**
+ * @since 3.9.0
+ */
+public interface IDeviceTransformer {
+ void adaptDesktopActions(Collection<IAction> actions);
+
+ void tablePageLoaded(IPageWithTable<?> tablePage) throws ProcessingException;
+
+ void transformForm(IForm form) throws ProcessingException;
+
+ void transformOutline(IOutline outline) throws ProcessingException;
+
+ void transformPageDetailTable(ITable table) throws ProcessingException;
+
+ boolean acceptForm(IForm form);
+
+ void adaptFormHeaderLeftActions(IForm form, List<IMenu> menuList);
+
+ void adaptFormHeaderRightActions(IForm form, List<IMenu> menuList);
+
+ boolean acceptMobileTabBoxTransformation(ITabBox tabBox);
+
+ /**
+ * @return a list of accepted view ids (IForm#VIEW_ID_* or null to accept all.
+ * @see {@link IForm}
+ */
+ List<String> getAcceptedViewIds();
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/transformation/MobileDeviceTransformer.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/transformation/MobileDeviceTransformer.java
index 5011462862..f07afaf562 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/transformation/MobileDeviceTransformer.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/transformation/MobileDeviceTransformer.java
@@ -1,410 +1,410 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.transformation;
-
-import java.lang.ref.WeakReference;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.WeakHashMap;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.mobile.navigation.AbstractMobileBackAction;
-import org.eclipse.scout.rt.client.mobile.navigation.IBreadCrumbsNavigationService;
-import org.eclipse.scout.rt.client.mobile.ui.action.ButtonWrappingAction;
-import org.eclipse.scout.rt.client.mobile.ui.desktop.MobileDesktopUtility;
-import org.eclipse.scout.rt.client.mobile.ui.form.fields.button.IMobileButton;
-import org.eclipse.scout.rt.client.mobile.ui.form.outline.PageFormManager;
-import org.eclipse.scout.rt.client.ui.action.IAction;
-import org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.action.view.IViewButton;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithNodes;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
-import org.eclipse.scout.rt.client.ui.form.FormUtility;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.client.ui.form.IFormFieldVisitor;
-import org.eclipse.scout.rt.client.ui.form.fields.GridData;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.booleanfield.IBooleanField;
-import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox;
-import org.eclipse.scout.rt.client.ui.form.fields.placeholder.IPlaceholderField;
-import org.eclipse.scout.rt.client.ui.form.fields.sequencebox.ISequenceBox;
-import org.eclipse.scout.rt.client.ui.form.fields.smartfield.ISmartField;
-import org.eclipse.scout.rt.client.ui.form.fields.tabbox.ITabBox;
-import org.eclipse.scout.service.SERVICES;
-
-/**
- * @since 3.9.0
- */
-public class MobileDeviceTransformer implements IDeviceTransformer {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(MobileDeviceTransformer.class);
-
- private final Map<IForm, WeakReference<IForm>> m_modifiedForms = new WeakHashMap<IForm, WeakReference<IForm>>();
- private IDesktop m_desktop;
- private PageFormManager m_pageFormManager;
- private ToolFormHandler m_toolFormHandler;
- private boolean m_gridDataDirty;
-
- public MobileDeviceTransformer(IDesktop desktop) {
- if (desktop == null) {
- desktop = ClientSyncJob.getCurrentSession().getDesktop();
- }
- m_desktop = desktop;
- if (m_desktop == null) {
- throw new IllegalArgumentException("No desktop found. Cannot create device transformer.");
- }
-
- m_pageFormManager = createPageFormManager(desktop);
- m_toolFormHandler = createToolFormHandler(desktop);
-
- SERVICES.getService(IBreadCrumbsNavigationService.class).getBreadCrumbsNavigation(desktop).trackDisplayViewId(IForm.VIEW_ID_CENTER);
- }
-
- public MobileDeviceTransformer() {
- this(null);
- }
-
- protected PageFormManager createPageFormManager(IDesktop desktop) {
- PageFormManager manager = new PageFormManager(desktop, IForm.VIEW_ID_CENTER);
- manager.setTableStatusVisible(!shouldPageTableStatusBeHidden());
-
- return manager;
- }
-
- protected ToolFormHandler createToolFormHandler(IDesktop desktop) {
- return new ToolFormHandler(getDesktop());
- }
-
- @Override
- public List<String> getAcceptedViewIds() {
- List<String> viewIds = new LinkedList<String>();
- viewIds.add(IForm.VIEW_ID_CENTER);
-
- return viewIds;
- }
-
- @Override
- public void tablePageLoaded(IPageWithTable<?> tablePage) throws ProcessingException {
- if (m_toolFormHandler != null) {
- m_toolFormHandler.tablePageLoaded(tablePage);
- }
- }
-
- /**
- * Remove outline buttons, keystrokes and menus
- */
- @Override
- public void adaptDesktopActions(Collection<IAction> actions) {
- for (Iterator<IAction> iterator = actions.iterator(); iterator.hasNext();) {
- IAction action = iterator.next();
- if (action instanceof IViewButton || action instanceof IKeyStroke || action instanceof IMenu) {
- iterator.remove();
- }
- }
- }
-
- @Override
- public void transformForm(IForm form) throws ProcessingException {
- m_gridDataDirty = false;
-
- if (shouldCancelConfirmationBeDisabled()) {
- form.setAskIfNeedSave(false);
- }
-
- if (form.getDisplayHint() == IForm.DISPLAY_HINT_VIEW) {
- transformView(form);
- }
- transformFormFields(form);
-
- if (isGridDataDirty()) {
- FormUtility.rebuildFieldGrid(form, true);
- m_gridDataDirty = false;
- }
- }
-
- protected void transformView(IForm form) {
- form.setDisplayViewId(IForm.VIEW_ID_CENTER);
- }
-
- @Override
- public void transformOutline(IOutline outline) {
- if (outline == null || outline.getRootNode() == null) {
- return;
- }
-
- //Necessary to enable drilldown from top of the outline
- outline.setRootNodeVisible(true);
- }
-
- @Override
- public void transformPageDetailTable(ITable table) {
- if (table == null) {
- //Do not allow closing the outline table because it breaks the navigation
- makeSurePageDetailTableIsVisible();
- }
- }
-
- @Override
- public boolean acceptForm(IForm form) {
- return m_pageFormManager.acceptForm(form);
- }
-
- private void makeSurePageDetailTableIsVisible() {
- final IOutline outline = getDesktop().getOutline();
- if (outline == null) {
- return;
- }
-
- final IPage activePage = outline.getActivePage();
- if (activePage == null || activePage.isTableVisible() || isPageDetailTableAllowedToBeClosed(activePage)) {
- return;
- }
- activePage.setTableVisible(true);
-
- if (activePage instanceof IPageWithNodes) {
- outline.setDetailTable(((IPageWithNodes) activePage).getInternalTable());
- }
- else if (activePage instanceof IPageWithTable<?>) {
- outline.setDetailTable(((IPageWithTable) activePage).getTable());
- }
- }
-
- protected boolean isPageDetailTableAllowedToBeClosed(IPage activePage) {
- return activePage.isLeaf();
- }
-
- protected void transformFormFields(IForm form) throws ProcessingException {
- WeakReference<IForm> formRef = m_modifiedForms.get(form);
- if (formRef != null) {
- return;
- }
-
- form.visitFields(new IFormFieldVisitor() {
- @Override
- public boolean visitField(IFormField field, int level, int fieldIndex) {
- transformFormField(field);
-
- return true;
- }
- });
-
- transformMainBox(form.getRootGroupBox());
-
- //mark form as modified
- m_modifiedForms.put(form, new WeakReference<IForm>(form));
- }
-
- protected void transformFormField(IFormField field) {
- if (shouldLabelBeMovedToTop()) {
- moveLabelToTop(field);
- }
-
- if (shouldFieldBeMadeScalable()) {
- makeFieldScalable(field);
- }
-
- if (field instanceof IGroupBox) {
- transformGroupBox((IGroupBox) field);
- }
- else if (field instanceof ISmartField) {
- transformSmartField((ISmartField) field);
- }
- else if (field instanceof IPlaceholderField) {
- transformPlaceholderField((IPlaceholderField) field);
- }
-
- }
-
- /**
- * Makes sure weightX is set to 1 which makes the field scalable.
- * <p>
- * Reason:<br>
- * The width of the field should be adjusted according to the display width, otherwise it may be too big to be
- * displayed. <br>
- * Additionally, since we use a one column layout, setting weightX to 0 might destroy the layout because it affects
- * all the fields in the groupBox.
- */
- protected void makeFieldScalable(IFormField field) {
- //Since a sequencebox contains several fields it's very risky to modify the gridData because it could make the fields too big or too small.
- if (field.getParentField() instanceof ISequenceBox) {
- return;
- }
-
- //Make sure weightX is set to 1 so the field grows and shrinks and does not break the 1 column layout
- GridData gridDataHints = field.getGridDataHints();
- if (gridDataHints.weightX == 0) {
- gridDataHints.weightX = 1;
- field.setGridDataHints(gridDataHints);
-
- markGridDataDirty();
- }
- }
-
- protected void moveLabelToTop(IFormField field) {
- if (IFormField.LABEL_POSITION_ON_FIELD == field.getLabelPosition()) {
- return;
- }
-
- //Do not modify the labels inside a sequencebox
- if (field.getParentField() instanceof ISequenceBox) {
- return;
- }
-
- field.setLabelPosition(IFormField.LABEL_POSITION_TOP);
-
- // The actual label of the boolean field is on the right side and position=top has no effect.
- // Removing the label actually removes the place on the left side so that it gets aligned to the other fields.
- if (field instanceof IBooleanField) {
- field.setLabelVisible(false);
- }
- }
-
- protected void transformMainBox(IGroupBox groupBox) throws ProcessingException {
- if (!groupBox.isScrollable()) {
- groupBox.setScrollable(true);
-
- //GridDataHints have been modified by setScrollable. Update the actual gridData with those hints.
- markGridDataDirty();
- }
- }
-
- protected void transformGroupBox(IGroupBox groupBox) {
- groupBox.setGridColumnCountHint(1);
- }
-
- protected void transformSmartField(ISmartField<?> field) {
- if (field.getBrowseMaxRowCount() > getSmartFieldBrowseMaxRowCount()) {
- field.setBrowseMaxRowCount(getSmartFieldBrowseMaxRowCount());
- }
- }
-
- /**
- * Makes placeholder fields invisible since they just waste space on 1 column layouts
- */
- protected void transformPlaceholderField(IPlaceholderField field) {
- field.setVisible(false);
- }
-
- /**
- * Used to keep the row count small which speeds up the list.
- */
- protected int getSmartFieldBrowseMaxRowCount() {
- return 20;
- }
-
- protected IDesktop getDesktop() {
- return m_desktop;
- }
-
- @Override
- public boolean acceptMobileTabBoxTransformation(ITabBox tabBox) {
- IGroupBox mainBox = tabBox.getForm().getRootGroupBox();
- if (tabBox.getParentField() == mainBox) {
- return !(mainBox.getControlFields()[0] == tabBox);
- }
-
- return false;
- }
-
- /**
- * Adds a close button to the tool form.
- * <p>
- * Adds a back button if there is no other button on the left side which is able to close the form.
- */
- @Override
- public void adaptFormHeaderLeftActions(IForm form, List<IMenu> menuList) {
- if (MobileDesktopUtility.isToolForm(form) && !containsCloseAction(menuList)) {
- menuList.add(new ToolFormCloseAction(form));
- }
-
- if (autoAddBackActionToFormHeader() && !containsCloseAction(menuList)) {
- menuList.add(new P_BackAction());
- }
- }
-
- @Override
- public void adaptFormHeaderRightActions(IForm form, List<IMenu> menuList) {
- }
-
- protected boolean containsCloseAction(List<IMenu> menuList) {
- if (menuList == null) {
- return false;
- }
-
- for (IMenu action : menuList) {
- if (action instanceof ToolFormCloseAction) {
- return true;
- }
- else if (action instanceof ButtonWrappingAction) {
- IButton wrappedButton = ((ButtonWrappingAction) action).getWrappedButton();
- switch (wrappedButton.getSystemType()) {
- case IButton.SYSTEM_TYPE_CANCEL:
- case IButton.SYSTEM_TYPE_CLOSE:
- case IButton.SYSTEM_TYPE_OK:
- case IMobileButton.SYSTEM_TYPE_BACK:
- if (wrappedButton.isVisible() && wrappedButton.isEnabled()) {
- return true;
- }
- }
- }
- }
-
- return false;
- }
-
- protected boolean autoAddBackActionToFormHeader() {
- return true;
- }
-
- protected boolean shouldPageDetailFormBeEmbedded() {
- return true;
- }
-
- protected boolean shouldPageTableStatusBeHidden() {
- return false;
- }
-
- protected boolean shouldLabelBeMovedToTop() {
- return true;
- }
-
- protected boolean shouldFieldBeMadeScalable() {
- return true;
- }
-
- protected boolean shouldCancelConfirmationBeDisabled() {
- return true;
- }
-
- protected boolean isGridDataDirty() {
- return m_gridDataDirty;
- }
-
- protected void markGridDataDirty() {
- m_gridDataDirty = true;
- }
-
- private class P_BackAction extends AbstractMobileBackAction {
-
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.transformation;
+
+import java.lang.ref.WeakReference;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.WeakHashMap;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.mobile.navigation.AbstractMobileBackAction;
+import org.eclipse.scout.rt.client.mobile.navigation.IBreadCrumbsNavigationService;
+import org.eclipse.scout.rt.client.mobile.ui.action.ButtonWrappingAction;
+import org.eclipse.scout.rt.client.mobile.ui.desktop.MobileDesktopUtility;
+import org.eclipse.scout.rt.client.mobile.ui.form.fields.button.IMobileButton;
+import org.eclipse.scout.rt.client.mobile.ui.form.outline.PageFormManager;
+import org.eclipse.scout.rt.client.ui.action.IAction;
+import org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.action.view.IViewButton;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithNodes;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
+import org.eclipse.scout.rt.client.ui.form.FormUtility;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.client.ui.form.IFormFieldVisitor;
+import org.eclipse.scout.rt.client.ui.form.fields.GridData;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.booleanfield.IBooleanField;
+import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox;
+import org.eclipse.scout.rt.client.ui.form.fields.placeholder.IPlaceholderField;
+import org.eclipse.scout.rt.client.ui.form.fields.sequencebox.ISequenceBox;
+import org.eclipse.scout.rt.client.ui.form.fields.smartfield.ISmartField;
+import org.eclipse.scout.rt.client.ui.form.fields.tabbox.ITabBox;
+import org.eclipse.scout.service.SERVICES;
+
+/**
+ * @since 3.9.0
+ */
+public class MobileDeviceTransformer implements IDeviceTransformer {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(MobileDeviceTransformer.class);
+
+ private final Map<IForm, WeakReference<IForm>> m_modifiedForms = new WeakHashMap<IForm, WeakReference<IForm>>();
+ private IDesktop m_desktop;
+ private PageFormManager m_pageFormManager;
+ private ToolFormHandler m_toolFormHandler;
+ private boolean m_gridDataDirty;
+
+ public MobileDeviceTransformer(IDesktop desktop) {
+ if (desktop == null) {
+ desktop = ClientSyncJob.getCurrentSession().getDesktop();
+ }
+ m_desktop = desktop;
+ if (m_desktop == null) {
+ throw new IllegalArgumentException("No desktop found. Cannot create device transformer.");
+ }
+
+ m_pageFormManager = createPageFormManager(desktop);
+ m_toolFormHandler = createToolFormHandler(desktop);
+
+ SERVICES.getService(IBreadCrumbsNavigationService.class).getBreadCrumbsNavigation(desktop).trackDisplayViewId(IForm.VIEW_ID_CENTER);
+ }
+
+ public MobileDeviceTransformer() {
+ this(null);
+ }
+
+ protected PageFormManager createPageFormManager(IDesktop desktop) {
+ PageFormManager manager = new PageFormManager(desktop, IForm.VIEW_ID_CENTER);
+ manager.setTableStatusVisible(!shouldPageTableStatusBeHidden());
+
+ return manager;
+ }
+
+ protected ToolFormHandler createToolFormHandler(IDesktop desktop) {
+ return new ToolFormHandler(getDesktop());
+ }
+
+ @Override
+ public List<String> getAcceptedViewIds() {
+ List<String> viewIds = new LinkedList<String>();
+ viewIds.add(IForm.VIEW_ID_CENTER);
+
+ return viewIds;
+ }
+
+ @Override
+ public void tablePageLoaded(IPageWithTable<?> tablePage) throws ProcessingException {
+ if (m_toolFormHandler != null) {
+ m_toolFormHandler.tablePageLoaded(tablePage);
+ }
+ }
+
+ /**
+ * Remove outline buttons, keystrokes and menus
+ */
+ @Override
+ public void adaptDesktopActions(Collection<IAction> actions) {
+ for (Iterator<IAction> iterator = actions.iterator(); iterator.hasNext();) {
+ IAction action = iterator.next();
+ if (action instanceof IViewButton || action instanceof IKeyStroke || action instanceof IMenu) {
+ iterator.remove();
+ }
+ }
+ }
+
+ @Override
+ public void transformForm(IForm form) throws ProcessingException {
+ m_gridDataDirty = false;
+
+ if (shouldCancelConfirmationBeDisabled()) {
+ form.setAskIfNeedSave(false);
+ }
+
+ if (form.getDisplayHint() == IForm.DISPLAY_HINT_VIEW) {
+ transformView(form);
+ }
+ transformFormFields(form);
+
+ if (isGridDataDirty()) {
+ FormUtility.rebuildFieldGrid(form, true);
+ m_gridDataDirty = false;
+ }
+ }
+
+ protected void transformView(IForm form) {
+ form.setDisplayViewId(IForm.VIEW_ID_CENTER);
+ }
+
+ @Override
+ public void transformOutline(IOutline outline) {
+ if (outline == null || outline.getRootNode() == null) {
+ return;
+ }
+
+ //Necessary to enable drilldown from top of the outline
+ outline.setRootNodeVisible(true);
+ }
+
+ @Override
+ public void transformPageDetailTable(ITable table) {
+ if (table == null) {
+ //Do not allow closing the outline table because it breaks the navigation
+ makeSurePageDetailTableIsVisible();
+ }
+ }
+
+ @Override
+ public boolean acceptForm(IForm form) {
+ return m_pageFormManager.acceptForm(form);
+ }
+
+ private void makeSurePageDetailTableIsVisible() {
+ final IOutline outline = getDesktop().getOutline();
+ if (outline == null) {
+ return;
+ }
+
+ final IPage activePage = outline.getActivePage();
+ if (activePage == null || activePage.isTableVisible() || isPageDetailTableAllowedToBeClosed(activePage)) {
+ return;
+ }
+ activePage.setTableVisible(true);
+
+ if (activePage instanceof IPageWithNodes) {
+ outline.setDetailTable(((IPageWithNodes) activePage).getInternalTable());
+ }
+ else if (activePage instanceof IPageWithTable<?>) {
+ outline.setDetailTable(((IPageWithTable) activePage).getTable());
+ }
+ }
+
+ protected boolean isPageDetailTableAllowedToBeClosed(IPage activePage) {
+ return activePage.isLeaf();
+ }
+
+ protected void transformFormFields(IForm form) throws ProcessingException {
+ WeakReference<IForm> formRef = m_modifiedForms.get(form);
+ if (formRef != null) {
+ return;
+ }
+
+ form.visitFields(new IFormFieldVisitor() {
+ @Override
+ public boolean visitField(IFormField field, int level, int fieldIndex) {
+ transformFormField(field);
+
+ return true;
+ }
+ });
+
+ transformMainBox(form.getRootGroupBox());
+
+ //mark form as modified
+ m_modifiedForms.put(form, new WeakReference<IForm>(form));
+ }
+
+ protected void transformFormField(IFormField field) {
+ if (shouldLabelBeMovedToTop()) {
+ moveLabelToTop(field);
+ }
+
+ if (shouldFieldBeMadeScalable()) {
+ makeFieldScalable(field);
+ }
+
+ if (field instanceof IGroupBox) {
+ transformGroupBox((IGroupBox) field);
+ }
+ else if (field instanceof ISmartField) {
+ transformSmartField((ISmartField) field);
+ }
+ else if (field instanceof IPlaceholderField) {
+ transformPlaceholderField((IPlaceholderField) field);
+ }
+
+ }
+
+ /**
+ * Makes sure weightX is set to 1 which makes the field scalable.
+ * <p>
+ * Reason:<br>
+ * The width of the field should be adjusted according to the display width, otherwise it may be too big to be
+ * displayed. <br>
+ * Additionally, since we use a one column layout, setting weightX to 0 might destroy the layout because it affects
+ * all the fields in the groupBox.
+ */
+ protected void makeFieldScalable(IFormField field) {
+ //Since a sequencebox contains several fields it's very risky to modify the gridData because it could make the fields too big or too small.
+ if (field.getParentField() instanceof ISequenceBox) {
+ return;
+ }
+
+ //Make sure weightX is set to 1 so the field grows and shrinks and does not break the 1 column layout
+ GridData gridDataHints = field.getGridDataHints();
+ if (gridDataHints.weightX == 0) {
+ gridDataHints.weightX = 1;
+ field.setGridDataHints(gridDataHints);
+
+ markGridDataDirty();
+ }
+ }
+
+ protected void moveLabelToTop(IFormField field) {
+ if (IFormField.LABEL_POSITION_ON_FIELD == field.getLabelPosition()) {
+ return;
+ }
+
+ //Do not modify the labels inside a sequencebox
+ if (field.getParentField() instanceof ISequenceBox) {
+ return;
+ }
+
+ field.setLabelPosition(IFormField.LABEL_POSITION_TOP);
+
+ // The actual label of the boolean field is on the right side and position=top has no effect.
+ // Removing the label actually removes the place on the left side so that it gets aligned to the other fields.
+ if (field instanceof IBooleanField) {
+ field.setLabelVisible(false);
+ }
+ }
+
+ protected void transformMainBox(IGroupBox groupBox) throws ProcessingException {
+ if (!groupBox.isScrollable()) {
+ groupBox.setScrollable(true);
+
+ //GridDataHints have been modified by setScrollable. Update the actual gridData with those hints.
+ markGridDataDirty();
+ }
+ }
+
+ protected void transformGroupBox(IGroupBox groupBox) {
+ groupBox.setGridColumnCountHint(1);
+ }
+
+ protected void transformSmartField(ISmartField<?> field) {
+ if (field.getBrowseMaxRowCount() > getSmartFieldBrowseMaxRowCount()) {
+ field.setBrowseMaxRowCount(getSmartFieldBrowseMaxRowCount());
+ }
+ }
+
+ /**
+ * Makes placeholder fields invisible since they just waste space on 1 column layouts
+ */
+ protected void transformPlaceholderField(IPlaceholderField field) {
+ field.setVisible(false);
+ }
+
+ /**
+ * Used to keep the row count small which speeds up the list.
+ */
+ protected int getSmartFieldBrowseMaxRowCount() {
+ return 20;
+ }
+
+ protected IDesktop getDesktop() {
+ return m_desktop;
+ }
+
+ @Override
+ public boolean acceptMobileTabBoxTransformation(ITabBox tabBox) {
+ IGroupBox mainBox = tabBox.getForm().getRootGroupBox();
+ if (tabBox.getParentField() == mainBox) {
+ return !(mainBox.getControlFields()[0] == tabBox);
+ }
+
+ return false;
+ }
+
+ /**
+ * Adds a close button to the tool form.
+ * <p>
+ * Adds a back button if there is no other button on the left side which is able to close the form.
+ */
+ @Override
+ public void adaptFormHeaderLeftActions(IForm form, List<IMenu> menuList) {
+ if (MobileDesktopUtility.isToolForm(form) && !containsCloseAction(menuList)) {
+ menuList.add(new ToolFormCloseAction(form));
+ }
+
+ if (autoAddBackActionToFormHeader() && !containsCloseAction(menuList)) {
+ menuList.add(new P_BackAction());
+ }
+ }
+
+ @Override
+ public void adaptFormHeaderRightActions(IForm form, List<IMenu> menuList) {
+ }
+
+ protected boolean containsCloseAction(List<IMenu> menuList) {
+ if (menuList == null) {
+ return false;
+ }
+
+ for (IMenu action : menuList) {
+ if (action instanceof ToolFormCloseAction) {
+ return true;
+ }
+ else if (action instanceof ButtonWrappingAction) {
+ IButton wrappedButton = ((ButtonWrappingAction) action).getWrappedButton();
+ switch (wrappedButton.getSystemType()) {
+ case IButton.SYSTEM_TYPE_CANCEL:
+ case IButton.SYSTEM_TYPE_CLOSE:
+ case IButton.SYSTEM_TYPE_OK:
+ case IMobileButton.SYSTEM_TYPE_BACK:
+ if (wrappedButton.isVisible() && wrappedButton.isEnabled()) {
+ return true;
+ }
+ }
+ }
+ }
+
+ return false;
+ }
+
+ protected boolean autoAddBackActionToFormHeader() {
+ return true;
+ }
+
+ protected boolean shouldPageDetailFormBeEmbedded() {
+ return true;
+ }
+
+ protected boolean shouldPageTableStatusBeHidden() {
+ return false;
+ }
+
+ protected boolean shouldLabelBeMovedToTop() {
+ return true;
+ }
+
+ protected boolean shouldFieldBeMadeScalable() {
+ return true;
+ }
+
+ protected boolean shouldCancelConfirmationBeDisabled() {
+ return true;
+ }
+
+ protected boolean isGridDataDirty() {
+ return m_gridDataDirty;
+ }
+
+ protected void markGridDataDirty() {
+ m_gridDataDirty = true;
+ }
+
+ private class P_BackAction extends AbstractMobileBackAction {
+
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/transformation/TabletDeviceTransformer.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/transformation/TabletDeviceTransformer.java
index b778c4eecf..93bf97c5df 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/transformation/TabletDeviceTransformer.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/transformation/TabletDeviceTransformer.java
@@ -1,110 +1,110 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.transformation;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.mobile.ui.basic.table.form.TableRowForm;
-import org.eclipse.scout.rt.client.mobile.ui.desktop.MobileDesktopUtility;
-import org.eclipse.scout.rt.client.mobile.ui.desktop.MultiPageChangeStrategy;
-import org.eclipse.scout.rt.client.mobile.ui.form.fields.tabbox.TabForm;
-import org.eclipse.scout.rt.client.mobile.ui.form.outline.IOutlineChooserForm;
-import org.eclipse.scout.rt.client.mobile.ui.form.outline.IPageForm;
-import org.eclipse.scout.rt.client.mobile.ui.form.outline.PageFormManager;
-import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
-import org.eclipse.scout.rt.client.ui.desktop.outline.IPageChangeStrategy;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-
-/**
- * @since 3.9.0
- */
-public class TabletDeviceTransformer extends MobileDeviceTransformer {
- private static int EAST_FORM_WIDTH = 700;
-
- public TabletDeviceTransformer() {
- this(null);
- }
-
- public TabletDeviceTransformer(IDesktop desktop) {
- super(desktop);
- }
-
- @Override
- protected PageFormManager createPageFormManager(IDesktop desktop) {
- PageFormManager manager = new PageFormManager(desktop, IForm.VIEW_ID_CENTER, IForm.VIEW_ID_E);
- manager.setTableStatusVisible(!shouldPageTableStatusBeHidden());
-
- initMultiPageChangeStrategy(manager);
-
- return manager;
- }
-
- /**
- * On tablet devices there are at maximum two view stacks, on mobile only one. So it is not necessary to create the
- * other ones which saves unnecessary composites and therefore loading time.
- */
- @Override
- public List<String> getAcceptedViewIds() {
- List<String> viewIds = new LinkedList<String>();
- viewIds.add(IForm.VIEW_ID_CENTER);
- viewIds.add(IForm.VIEW_ID_E);
-
- return viewIds;
- }
-
- private void initMultiPageChangeStrategy(PageFormManager pageFormManager) {
- IPageChangeStrategy strategy = new MultiPageChangeStrategy(pageFormManager);
- for (IOutline outline : getDesktop().getAvailableOutlines()) {
- outline.setPageChangeStrategy(strategy);
- }
- }
-
- @Override
- public void transformForm(IForm form) throws ProcessingException {
- super.transformForm(form);
-
- if (execCloseToolFormsOnFormOpen(form)) {
- MobileDesktopUtility.closeAllToolForms();
- }
- }
-
- @Override
- protected void transformView(IForm form) {
- if (!(form instanceof IPageForm || form instanceof IOutlineChooserForm)) {
- form.setDisplayViewId(IForm.VIEW_ID_E);
- }
- if (IForm.VIEW_ID_E.equals(form.getDisplayViewId())) {
- MobileDesktopUtility.setFormWidthHint(form, EAST_FORM_WIDTH);
- }
- }
-
- protected boolean execCloseToolFormsOnFormOpen(IForm form) {
- return !(form instanceof TableRowForm) && !(form instanceof TabForm);
- }
-
- @Override
- protected boolean shouldPageDetailFormBeEmbedded() {
- return false;
- }
-
- @Override
- protected boolean autoAddBackActionToFormHeader() {
- return false;
- }
-
- @Override
- protected boolean shouldLabelBeMovedToTop() {
- return false;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.transformation;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.mobile.ui.basic.table.form.TableRowForm;
+import org.eclipse.scout.rt.client.mobile.ui.desktop.MobileDesktopUtility;
+import org.eclipse.scout.rt.client.mobile.ui.desktop.MultiPageChangeStrategy;
+import org.eclipse.scout.rt.client.mobile.ui.form.fields.tabbox.TabForm;
+import org.eclipse.scout.rt.client.mobile.ui.form.outline.IOutlineChooserForm;
+import org.eclipse.scout.rt.client.mobile.ui.form.outline.IPageForm;
+import org.eclipse.scout.rt.client.mobile.ui.form.outline.PageFormManager;
+import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
+import org.eclipse.scout.rt.client.ui.desktop.outline.IPageChangeStrategy;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+
+/**
+ * @since 3.9.0
+ */
+public class TabletDeviceTransformer extends MobileDeviceTransformer {
+ private static int EAST_FORM_WIDTH = 700;
+
+ public TabletDeviceTransformer() {
+ this(null);
+ }
+
+ public TabletDeviceTransformer(IDesktop desktop) {
+ super(desktop);
+ }
+
+ @Override
+ protected PageFormManager createPageFormManager(IDesktop desktop) {
+ PageFormManager manager = new PageFormManager(desktop, IForm.VIEW_ID_CENTER, IForm.VIEW_ID_E);
+ manager.setTableStatusVisible(!shouldPageTableStatusBeHidden());
+
+ initMultiPageChangeStrategy(manager);
+
+ return manager;
+ }
+
+ /**
+ * On tablet devices there are at maximum two view stacks, on mobile only one. So it is not necessary to create the
+ * other ones which saves unnecessary composites and therefore loading time.
+ */
+ @Override
+ public List<String> getAcceptedViewIds() {
+ List<String> viewIds = new LinkedList<String>();
+ viewIds.add(IForm.VIEW_ID_CENTER);
+ viewIds.add(IForm.VIEW_ID_E);
+
+ return viewIds;
+ }
+
+ private void initMultiPageChangeStrategy(PageFormManager pageFormManager) {
+ IPageChangeStrategy strategy = new MultiPageChangeStrategy(pageFormManager);
+ for (IOutline outline : getDesktop().getAvailableOutlines()) {
+ outline.setPageChangeStrategy(strategy);
+ }
+ }
+
+ @Override
+ public void transformForm(IForm form) throws ProcessingException {
+ super.transformForm(form);
+
+ if (execCloseToolFormsOnFormOpen(form)) {
+ MobileDesktopUtility.closeAllToolForms();
+ }
+ }
+
+ @Override
+ protected void transformView(IForm form) {
+ if (!(form instanceof IPageForm || form instanceof IOutlineChooserForm)) {
+ form.setDisplayViewId(IForm.VIEW_ID_E);
+ }
+ if (IForm.VIEW_ID_E.equals(form.getDisplayViewId())) {
+ MobileDesktopUtility.setFormWidthHint(form, EAST_FORM_WIDTH);
+ }
+ }
+
+ protected boolean execCloseToolFormsOnFormOpen(IForm form) {
+ return !(form instanceof TableRowForm) && !(form instanceof TabForm);
+ }
+
+ @Override
+ protected boolean shouldPageDetailFormBeEmbedded() {
+ return false;
+ }
+
+ @Override
+ protected boolean autoAddBackActionToFormHeader() {
+ return false;
+ }
+
+ @Override
+ protected boolean shouldLabelBeMovedToTop() {
+ return false;
+ }
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/transformation/ToolFormCloseAction.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/transformation/ToolFormCloseAction.java
index fc742852da..048f166135 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/transformation/ToolFormCloseAction.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/transformation/ToolFormCloseAction.java
@@ -1,25 +1,25 @@
-package org.eclipse.scout.rt.client.mobile.transformation;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.mobile.ui.desktop.MobileDesktopUtility;
-import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.shared.TEXTS;
-
-public class ToolFormCloseAction extends AbstractMenu {
- private IForm m_form;
-
- public ToolFormCloseAction(IForm form) {
- m_form = form;
- }
-
- @Override
- protected String getConfiguredText() {
- return TEXTS.get("CloseButton");
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- MobileDesktopUtility.closeToolForm(m_form);
- }
-}
+package org.eclipse.scout.rt.client.mobile.transformation;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.mobile.ui.desktop.MobileDesktopUtility;
+import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.shared.TEXTS;
+
+public class ToolFormCloseAction extends AbstractMenu {
+ private IForm m_form;
+
+ public ToolFormCloseAction(IForm form) {
+ m_form = form;
+ }
+
+ @Override
+ protected String getConfiguredText() {
+ return TEXTS.get("CloseButton");
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ MobileDesktopUtility.closeToolForm(m_form);
+ }
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/transformation/ToolFormHandler.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/transformation/ToolFormHandler.java
index fb24d6f28b..a126189ab7 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/transformation/ToolFormHandler.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/transformation/ToolFormHandler.java
@@ -1,136 +1,136 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.transformation;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.mobile.ui.basic.table.form.TableRowForm;
-import org.eclipse.scout.rt.client.mobile.ui.desktop.MobileDesktopUtility;
-import org.eclipse.scout.rt.client.mobile.ui.form.fields.tabbox.TabForm;
-import org.eclipse.scout.rt.client.ui.basic.tree.TreeAdapter;
-import org.eclipse.scout.rt.client.ui.basic.tree.TreeEvent;
-import org.eclipse.scout.rt.client.ui.desktop.DesktopEvent;
-import org.eclipse.scout.rt.client.ui.desktop.DesktopListener;
-import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-
-/**
- * @since 3.9.0
- */
-public class ToolFormHandler {
- private P_DesktopListener m_desktopListener;
- private P_OutlineListener m_outlineListener;
- private IOutline m_activeOutline;
- private IDesktop m_desktop;
-
- public ToolFormHandler(IDesktop desktop) {
- m_desktop = desktop;
- m_desktopListener = new P_DesktopListener();
- m_desktop.addDesktopListener(m_desktopListener);
- }
-
- private void destroy() {
- if (m_desktopListener != null) {
- getDesktop().removeDesktopListener(m_desktopListener);
- m_desktopListener = null;
- }
- }
-
- public IDesktop getDesktop() {
- return m_desktop;
- }
-
- protected boolean execCloseToolFormsOnFormOpen(IForm form) {
- if (IForm.DISPLAY_HINT_VIEW == form.getDisplayHint() && !MobileDesktopUtility.isToolForm(form)) {
- return !(form instanceof TableRowForm) && !(form instanceof TabForm);
- }
-
- return false;
- }
-
- /**
- * This is a delegate and needs to be explicitly called.<br>
- * It's purpose is to close tool forms after a search or after a bookmark activation.
- */
- public void tablePageLoaded(IPageWithTable<?> tablePage) throws ProcessingException {
- MobileDesktopUtility.closeAllToolForms();
- }
-
- private class P_DesktopListener implements DesktopListener {
-
- @Override
- public void desktopChanged(DesktopEvent e) {
-
- switch (e.getType()) {
- case DesktopEvent.TYPE_FORM_ADDED: {
- handleFormAdded(e);
- break;
- }
- case DesktopEvent.TYPE_DESKTOP_CLOSED: {
- destroy();
- break;
- }
- case DesktopEvent.TYPE_OUTLINE_CHANGED: {
- handleOutlineChanged(e);
- }
- default:
- break;
- }
- }
-
- private void handleOutlineChanged(DesktopEvent e) {
- IOutline outline = e.getOutline();
-
- if (m_activeOutline != null) {
- m_activeOutline.removeTreeListener(m_outlineListener);
- }
-
- if (outline != null) {
- if (m_outlineListener == null) {
- m_outlineListener = new P_OutlineListener();
- }
-
- outline.addTreeListener(m_outlineListener);
- }
-
- m_activeOutline = outline;
- }
-
- private void handleFormAdded(DesktopEvent e) {
- IForm form = e.getForm();
- if (execCloseToolFormsOnFormOpen(form)) {
- //Close tool form if another view is opened
- MobileDesktopUtility.closeAllToolForms();
- }
-
- }
-
- }
-
- private class P_OutlineListener extends TreeAdapter {
-
- @Override
- public void treeChanged(TreeEvent e) {
- switch (e.getType()) {
- case TreeEvent.TYPE_NODES_SELECTED: {
- handleNodesSelected(e);
- break;
- }
- }
- }
-
- private void handleNodesSelected(TreeEvent event) {
- MobileDesktopUtility.closeAllToolForms();
- }
-
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.transformation;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.mobile.ui.basic.table.form.TableRowForm;
+import org.eclipse.scout.rt.client.mobile.ui.desktop.MobileDesktopUtility;
+import org.eclipse.scout.rt.client.mobile.ui.form.fields.tabbox.TabForm;
+import org.eclipse.scout.rt.client.ui.basic.tree.TreeAdapter;
+import org.eclipse.scout.rt.client.ui.basic.tree.TreeEvent;
+import org.eclipse.scout.rt.client.ui.desktop.DesktopEvent;
+import org.eclipse.scout.rt.client.ui.desktop.DesktopListener;
+import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+
+/**
+ * @since 3.9.0
+ */
+public class ToolFormHandler {
+ private P_DesktopListener m_desktopListener;
+ private P_OutlineListener m_outlineListener;
+ private IOutline m_activeOutline;
+ private IDesktop m_desktop;
+
+ public ToolFormHandler(IDesktop desktop) {
+ m_desktop = desktop;
+ m_desktopListener = new P_DesktopListener();
+ m_desktop.addDesktopListener(m_desktopListener);
+ }
+
+ private void destroy() {
+ if (m_desktopListener != null) {
+ getDesktop().removeDesktopListener(m_desktopListener);
+ m_desktopListener = null;
+ }
+ }
+
+ public IDesktop getDesktop() {
+ return m_desktop;
+ }
+
+ protected boolean execCloseToolFormsOnFormOpen(IForm form) {
+ if (IForm.DISPLAY_HINT_VIEW == form.getDisplayHint() && !MobileDesktopUtility.isToolForm(form)) {
+ return !(form instanceof TableRowForm) && !(form instanceof TabForm);
+ }
+
+ return false;
+ }
+
+ /**
+ * This is a delegate and needs to be explicitly called.<br>
+ * It's purpose is to close tool forms after a search or after a bookmark activation.
+ */
+ public void tablePageLoaded(IPageWithTable<?> tablePage) throws ProcessingException {
+ MobileDesktopUtility.closeAllToolForms();
+ }
+
+ private class P_DesktopListener implements DesktopListener {
+
+ @Override
+ public void desktopChanged(DesktopEvent e) {
+
+ switch (e.getType()) {
+ case DesktopEvent.TYPE_FORM_ADDED: {
+ handleFormAdded(e);
+ break;
+ }
+ case DesktopEvent.TYPE_DESKTOP_CLOSED: {
+ destroy();
+ break;
+ }
+ case DesktopEvent.TYPE_OUTLINE_CHANGED: {
+ handleOutlineChanged(e);
+ }
+ default:
+ break;
+ }
+ }
+
+ private void handleOutlineChanged(DesktopEvent e) {
+ IOutline outline = e.getOutline();
+
+ if (m_activeOutline != null) {
+ m_activeOutline.removeTreeListener(m_outlineListener);
+ }
+
+ if (outline != null) {
+ if (m_outlineListener == null) {
+ m_outlineListener = new P_OutlineListener();
+ }
+
+ outline.addTreeListener(m_outlineListener);
+ }
+
+ m_activeOutline = outline;
+ }
+
+ private void handleFormAdded(DesktopEvent e) {
+ IForm form = e.getForm();
+ if (execCloseToolFormsOnFormOpen(form)) {
+ //Close tool form if another view is opened
+ MobileDesktopUtility.closeAllToolForms();
+ }
+
+ }
+
+ }
+
+ private class P_OutlineListener extends TreeAdapter {
+
+ @Override
+ public void treeChanged(TreeEvent e) {
+ switch (e.getType()) {
+ case TreeEvent.TYPE_NODES_SELECTED: {
+ handleNodesSelected(e);
+ break;
+ }
+ }
+ }
+
+ private void handleNodesSelected(TreeEvent event) {
+ MobileDesktopUtility.closeAllToolForms();
+ }
+
+ }
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/action/ActionButtonBarUtility.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/action/ActionButtonBarUtility.java
index 2d7d9b69d6..96e7375159 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/action/ActionButtonBarUtility.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/action/ActionButtonBarUtility.java
@@ -1,88 +1,88 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.action;
-
-import java.util.Arrays;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.scout.rt.client.mobile.ui.form.IMobileAction;
-import org.eclipse.scout.rt.client.mobile.ui.form.outline.AutoLeafPageWithNodes;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
-
-/**
- * @since 3.9.0
- */
-public class ActionButtonBarUtility {
-
- public static List<IMobileAction> convertButtonsToActions(IButton[] buttons) {
- List<IMobileAction> menuList = new LinkedList<IMobileAction>();
- for (IButton button : buttons) {
- IMobileAction action = convertButtonToAction(button);
- if (action != null) {
- menuList.add(action);
- }
- }
-
- return menuList;
- }
-
- public static IMobileAction convertButtonToAction(IButton button) {
- if (button == null) {
- return null;
- }
-
- return new ButtonWrappingAction(button);
- }
-
- /**
- * If there are empty space menus distribute the row menus so that the menus alternate and the most important are on
- * top, starting with a empty space menu
- */
- public static void distributeRowActions(List<IMenu> menuList, IMenu[] emptySpaceMenus, List<IMenu> rowMenuList) {
- if (emptySpaceMenus == null) {
- return;
- }
-
- for (IMenu emptySpaceMenu : emptySpaceMenus) {
- if (rowMenuList.size() == 0) {
- break;
- }
-
- int index = menuList.indexOf(emptySpaceMenu) + 1;
- IMenu rowMenu = rowMenuList.get(0);
- menuList.add(index, rowMenu);
- rowMenuList.remove(rowMenu);
- }
- }
-
- /**
- * Fetches the actions of the given page (tree node and table row menus).
- */
- public static List<IMenu> fetchPageActions(IPage page) {
- List<IMenu> pageActions = new LinkedList<IMenu>();
- if (page.getTree() != null) {
- //Fetch the menus of the given page (getUIFacade().fireNodePopupFromUI() is not possible since the selected node may not the same as the given page)
- pageActions.addAll(Arrays.asList(page.getTree().fetchMenusForNodesInternal(new ITreeNode[]{page})));
- if (page instanceof AutoLeafPageWithNodes) {
- //AutoLeafPage has no parent so the table row actions are not fetched by the regular way (see AbstractOutline#P_OutlineListener).
- //Instead we directly fetch the table row actions
- pageActions.addAll(Arrays.asList(((AutoLeafPageWithNodes) page).getTableRow().getTable().getUIFacade().fireRowPopupFromUI()));
- }
- }
-
- return pageActions;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.action;
+
+import java.util.Arrays;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.scout.rt.client.mobile.ui.form.IMobileAction;
+import org.eclipse.scout.rt.client.mobile.ui.form.outline.AutoLeafPageWithNodes;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
+
+/**
+ * @since 3.9.0
+ */
+public class ActionButtonBarUtility {
+
+ public static List<IMobileAction> convertButtonsToActions(IButton[] buttons) {
+ List<IMobileAction> menuList = new LinkedList<IMobileAction>();
+ for (IButton button : buttons) {
+ IMobileAction action = convertButtonToAction(button);
+ if (action != null) {
+ menuList.add(action);
+ }
+ }
+
+ return menuList;
+ }
+
+ public static IMobileAction convertButtonToAction(IButton button) {
+ if (button == null) {
+ return null;
+ }
+
+ return new ButtonWrappingAction(button);
+ }
+
+ /**
+ * If there are empty space menus distribute the row menus so that the menus alternate and the most important are on
+ * top, starting with a empty space menu
+ */
+ public static void distributeRowActions(List<IMenu> menuList, IMenu[] emptySpaceMenus, List<IMenu> rowMenuList) {
+ if (emptySpaceMenus == null) {
+ return;
+ }
+
+ for (IMenu emptySpaceMenu : emptySpaceMenus) {
+ if (rowMenuList.size() == 0) {
+ break;
+ }
+
+ int index = menuList.indexOf(emptySpaceMenu) + 1;
+ IMenu rowMenu = rowMenuList.get(0);
+ menuList.add(index, rowMenu);
+ rowMenuList.remove(rowMenu);
+ }
+ }
+
+ /**
+ * Fetches the actions of the given page (tree node and table row menus).
+ */
+ public static List<IMenu> fetchPageActions(IPage page) {
+ List<IMenu> pageActions = new LinkedList<IMenu>();
+ if (page.getTree() != null) {
+ //Fetch the menus of the given page (getUIFacade().fireNodePopupFromUI() is not possible since the selected node may not the same as the given page)
+ pageActions.addAll(Arrays.asList(page.getTree().fetchMenusForNodesInternal(new ITreeNode[]{page})));
+ if (page instanceof AutoLeafPageWithNodes) {
+ //AutoLeafPage has no parent so the table row actions are not fetched by the regular way (see AbstractOutline#P_OutlineListener).
+ //Instead we directly fetch the table row actions
+ pageActions.addAll(Arrays.asList(((AutoLeafPageWithNodes) page).getTableRow().getTable().getUIFacade().fireRowPopupFromUI()));
+ }
+ }
+
+ return pageActions;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/action/ActionToButtonPropertyDelegator.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/action/ActionToButtonPropertyDelegator.java
index b2524a2e98..e26a4876bd 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/action/ActionToButtonPropertyDelegator.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/action/ActionToButtonPropertyDelegator.java
@@ -1,65 +1,65 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.action;
-
-import org.eclipse.scout.rt.client.mobile.ui.form.fields.PropertyDelegator;
-import org.eclipse.scout.rt.client.ui.action.IAction;
-import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
-
-public class ActionToButtonPropertyDelegator extends PropertyDelegator<IAction, IButton> {
-
- public ActionToButtonPropertyDelegator(IAction sender, IButton receiver) {
- super(sender, receiver);
- }
-
- @Override
- public void init() {
- super.init();
-
- getReceiver().setVisible(getSender().isVisible());
- if (!getSender().isVisible()) {
- getReceiver().setVisibleGranted(getSender().isVisibleGranted());
- }
- getReceiver().setEnabled(getSender().isEnabled());
- if (!getSender().isEnabled()) {
- getReceiver().setEnabledGranted(getSender().isEnabledGranted());
- }
- getReceiver().setIconId(getSender().getIconId());
- getReceiver().setLabel(getSender().getText());
- getReceiver().setTooltipText(getSender().getTooltipText());
- if (getSender().isToggleAction()) {
- getReceiver().setDisplayStyleInternal(IButton.DISPLAY_STYLE_TOGGLE);
- }
- getReceiver().setSelected(getSender().isSelected());
- }
-
- private void handleButtonPropertyChange(String name, Object newValue) {
- if (name.equals(IAction.PROP_ENABLED)) {
- getReceiver().setEnabled(((Boolean) newValue).booleanValue());
- }
- else if (name.equals(IAction.PROP_TEXT)) {
- getReceiver().setLabel((String) newValue);
- }
- else if (name.equals(IAction.PROP_TOOLTIP_TEXT)) {
- getReceiver().setTooltipText((String) newValue);
- }
- else if (name.equals(IAction.PROP_VISIBLE)) {
- getReceiver().setVisible(((Boolean) newValue).booleanValue());
- }
- else if (name.equals(IAction.PROP_ICON_ID)) {
- getReceiver().setIconId((String) newValue);
- }
- else if (name.equals(IAction.PROP_SELECTED)) {
- getReceiver().setSelected(((Boolean) newValue).booleanValue());
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.action;
+
+import org.eclipse.scout.rt.client.mobile.ui.form.fields.PropertyDelegator;
+import org.eclipse.scout.rt.client.ui.action.IAction;
+import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
+
+public class ActionToButtonPropertyDelegator extends PropertyDelegator<IAction, IButton> {
+
+ public ActionToButtonPropertyDelegator(IAction sender, IButton receiver) {
+ super(sender, receiver);
+ }
+
+ @Override
+ public void init() {
+ super.init();
+
+ getReceiver().setVisible(getSender().isVisible());
+ if (!getSender().isVisible()) {
+ getReceiver().setVisibleGranted(getSender().isVisibleGranted());
+ }
+ getReceiver().setEnabled(getSender().isEnabled());
+ if (!getSender().isEnabled()) {
+ getReceiver().setEnabledGranted(getSender().isEnabledGranted());
+ }
+ getReceiver().setIconId(getSender().getIconId());
+ getReceiver().setLabel(getSender().getText());
+ getReceiver().setTooltipText(getSender().getTooltipText());
+ if (getSender().isToggleAction()) {
+ getReceiver().setDisplayStyleInternal(IButton.DISPLAY_STYLE_TOGGLE);
+ }
+ getReceiver().setSelected(getSender().isSelected());
+ }
+
+ private void handleButtonPropertyChange(String name, Object newValue) {
+ if (name.equals(IAction.PROP_ENABLED)) {
+ getReceiver().setEnabled(((Boolean) newValue).booleanValue());
+ }
+ else if (name.equals(IAction.PROP_TEXT)) {
+ getReceiver().setLabel((String) newValue);
+ }
+ else if (name.equals(IAction.PROP_TOOLTIP_TEXT)) {
+ getReceiver().setTooltipText((String) newValue);
+ }
+ else if (name.equals(IAction.PROP_VISIBLE)) {
+ getReceiver().setVisible(((Boolean) newValue).booleanValue());
+ }
+ else if (name.equals(IAction.PROP_ICON_ID)) {
+ getReceiver().setIconId((String) newValue);
+ }
+ else if (name.equals(IAction.PROP_SELECTED)) {
+ getReceiver().setSelected(((Boolean) newValue).booleanValue());
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/action/ButtonToActionPropertyDelegator.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/action/ButtonToActionPropertyDelegator.java
index d8bb25e255..5ba94f4f96 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/action/ButtonToActionPropertyDelegator.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/action/ButtonToActionPropertyDelegator.java
@@ -1,66 +1,66 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.action;
-
-import org.eclipse.scout.rt.client.mobile.ui.form.fields.PropertyDelegator;
-import org.eclipse.scout.rt.client.ui.action.IAction;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
-
-public class ButtonToActionPropertyDelegator extends PropertyDelegator<IButton, IAction> {
-
- public ButtonToActionPropertyDelegator(IButton sender, IAction receiver) {
- super(sender, receiver);
- }
-
- @Override
- public void init() {
- super.init();
-
- getReceiver().setVisible(getSender().isVisible());
- if (!getSender().isVisible()) {
- //Since AbstractFormField#calculateVisibleInternal may ignore this property only set it if it hasn't been ignored (to not override those rules)
- getReceiver().setVisibleGranted(getSender().isVisibleGranted());
- }
- getReceiver().setEnabled(getSender().isEnabled());
- if (!getSender().isEnabled()) {
- //Since AbstractFormField#calculateEnabled may ignore this property only set it if it hasn't been ignored (to not override those rules)
- getReceiver().setEnabledGranted(getSender().isEnabledGranted());
- }
- getReceiver().setIconId(getSender().getIconId());
- getReceiver().setText(getSender().getLabel());
- getReceiver().setTooltipText(getSender().getTooltipText());
- getReceiver().setToggleAction(getSender().getDisplayStyle() == IButton.DISPLAY_STYLE_TOGGLE);
- getReceiver().setSelected(getSender().isSelected());
- }
-
- private void handleButtonPropertyChange(String name, Object newValue) {
- if (name.equals(IFormField.PROP_ENABLED)) {
- getReceiver().setEnabled(((Boolean) newValue).booleanValue());
- }
- else if (name.equals(IFormField.PROP_LABEL)) {
- getReceiver().setText((String) newValue);
- }
- else if (name.equals(IFormField.PROP_TOOLTIP_TEXT)) {
- getReceiver().setTooltipText((String) newValue);
- }
- else if (name.equals(IFormField.PROP_VISIBLE)) {
- getReceiver().setVisible(((Boolean) newValue).booleanValue());
- }
- else if (name.equals(IButton.PROP_ICON_ID)) {
- getReceiver().setIconId((String) newValue);
- }
- else if (name.equals(IButton.PROP_SELECTED)) {
- getReceiver().setSelected(((Boolean) newValue).booleanValue());
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.action;
+
+import org.eclipse.scout.rt.client.mobile.ui.form.fields.PropertyDelegator;
+import org.eclipse.scout.rt.client.ui.action.IAction;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
+
+public class ButtonToActionPropertyDelegator extends PropertyDelegator<IButton, IAction> {
+
+ public ButtonToActionPropertyDelegator(IButton sender, IAction receiver) {
+ super(sender, receiver);
+ }
+
+ @Override
+ public void init() {
+ super.init();
+
+ getReceiver().setVisible(getSender().isVisible());
+ if (!getSender().isVisible()) {
+ //Since AbstractFormField#calculateVisibleInternal may ignore this property only set it if it hasn't been ignored (to not override those rules)
+ getReceiver().setVisibleGranted(getSender().isVisibleGranted());
+ }
+ getReceiver().setEnabled(getSender().isEnabled());
+ if (!getSender().isEnabled()) {
+ //Since AbstractFormField#calculateEnabled may ignore this property only set it if it hasn't been ignored (to not override those rules)
+ getReceiver().setEnabledGranted(getSender().isEnabledGranted());
+ }
+ getReceiver().setIconId(getSender().getIconId());
+ getReceiver().setText(getSender().getLabel());
+ getReceiver().setTooltipText(getSender().getTooltipText());
+ getReceiver().setToggleAction(getSender().getDisplayStyle() == IButton.DISPLAY_STYLE_TOGGLE);
+ getReceiver().setSelected(getSender().isSelected());
+ }
+
+ private void handleButtonPropertyChange(String name, Object newValue) {
+ if (name.equals(IFormField.PROP_ENABLED)) {
+ getReceiver().setEnabled(((Boolean) newValue).booleanValue());
+ }
+ else if (name.equals(IFormField.PROP_LABEL)) {
+ getReceiver().setText((String) newValue);
+ }
+ else if (name.equals(IFormField.PROP_TOOLTIP_TEXT)) {
+ getReceiver().setTooltipText((String) newValue);
+ }
+ else if (name.equals(IFormField.PROP_VISIBLE)) {
+ getReceiver().setVisible(((Boolean) newValue).booleanValue());
+ }
+ else if (name.equals(IButton.PROP_ICON_ID)) {
+ getReceiver().setIconId((String) newValue);
+ }
+ else if (name.equals(IButton.PROP_SELECTED)) {
+ getReceiver().setSelected(((Boolean) newValue).booleanValue());
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/action/ButtonWrappingAction.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/action/ButtonWrappingAction.java
index 2bc90e747b..b1be8493ca 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/action/ButtonWrappingAction.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/action/ButtonWrappingAction.java
@@ -1,49 +1,49 @@
-package org.eclipse.scout.rt.client.mobile.ui.action;
-
-import java.beans.PropertyChangeEvent;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.mobile.ui.form.AbstractMobileAction;
-import org.eclipse.scout.rt.client.ui.action.tree.IActionNode;
-import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
-
-/**
- * A {@link IActionNode} which wraps a {@link IButton}. <br/>
- * {@link PropertyChangeEvent}s fired by the button are delegated
- * to the action
- *
- * @since 3.9.0
- */
-public class ButtonWrappingAction extends AbstractMobileAction {
- private ButtonToActionPropertyDelegator m_propertyDelegator;
-
- public ButtonWrappingAction(IButton wrappedButton) {
- super(false);
-
- m_propertyDelegator = new ButtonToActionPropertyDelegator(wrappedButton, this);
-
- callInitializer();
- }
-
- @Override
- protected void initConfig() {
- super.initConfig();
-
- m_propertyDelegator.init();
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- getWrappedButton().doClick();
- }
-
- @Override
- protected void execToggleAction(boolean selected) throws ProcessingException {
- getWrappedButton().setSelected(selected);
- }
-
- public IButton getWrappedButton() {
- return m_propertyDelegator.getSender();
- }
-
-}
+package org.eclipse.scout.rt.client.mobile.ui.action;
+
+import java.beans.PropertyChangeEvent;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.mobile.ui.form.AbstractMobileAction;
+import org.eclipse.scout.rt.client.ui.action.tree.IActionNode;
+import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
+
+/**
+ * A {@link IActionNode} which wraps a {@link IButton}. <br/>
+ * {@link PropertyChangeEvent}s fired by the button are delegated
+ * to the action
+ *
+ * @since 3.9.0
+ */
+public class ButtonWrappingAction extends AbstractMobileAction {
+ private ButtonToActionPropertyDelegator m_propertyDelegator;
+
+ public ButtonWrappingAction(IButton wrappedButton) {
+ super(false);
+
+ m_propertyDelegator = new ButtonToActionPropertyDelegator(wrappedButton, this);
+
+ callInitializer();
+ }
+
+ @Override
+ protected void initConfig() {
+ super.initConfig();
+
+ m_propertyDelegator.init();
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ getWrappedButton().doClick();
+ }
+
+ @Override
+ protected void execToggleAction(boolean selected) throws ProcessingException {
+ getWrappedButton().setSelected(selected);
+ }
+
+ public IButton getWrappedButton() {
+ return m_propertyDelegator.getSender();
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/AbstractMobileTable.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/AbstractMobileTable.java
index f069176555..c6e7e75953 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/AbstractMobileTable.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/AbstractMobileTable.java
@@ -1,147 +1,147 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.basic.table;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ClientJob;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.mobile.ui.basic.table.columns.IRowSummaryColumn;
-import org.eclipse.scout.rt.client.mobile.ui.basic.table.form.TableRowForm;
-import org.eclipse.scout.rt.client.ui.basic.table.AbstractTable;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-
-/**
- * @since 3.9.0
- */
-public abstract class AbstractMobileTable extends AbstractTable implements IMobileTable {
- private DrillDownStyleMap m_drillDownStyleMap;
- private int m_tableRowFormDisplayHint;
- private String m_tableRowFormDisplayViewId;
-
- public AbstractMobileTable() {
- this(true);
- }
-
- public AbstractMobileTable(boolean callInitializer) {
- super(callInitializer);
- }
-
- @Override
- protected void initConfig() {
- super.initConfig();
-
- m_drillDownStyleMap = new DrillDownStyleMap();
- setAutoCreateTableRowForm(execIsAutoCreateTableRowForm());
- setDefaultDrillDownStyle(execComputeDrillDownStyle());
- }
-
- @Override
- public boolean isAutoCreateTableRowForm() {
- return propertySupport.getPropertyBool(PROP_AUTO_CREATE_TABLE_ROW_FORM);
- }
-
- @Override
- public void setAutoCreateTableRowForm(boolean autoCreateTableRowForm) {
- propertySupport.setPropertyBool(PROP_AUTO_CREATE_TABLE_ROW_FORM, autoCreateTableRowForm);
- }
-
- @Override
- public String getDefaultDrillDownStyle() {
- return propertySupport.getPropertyString(PROP_DEFAULT_DRILL_DOWN_STYLE);
- }
-
- @Override
- public void setDefaultDrillDownStyle(String defaultDrillDownStyle) {
- propertySupport.setPropertyString(PROP_DEFAULT_DRILL_DOWN_STYLE, defaultDrillDownStyle);
- }
-
- public void putDrillDownStyle(ITableRow row, String drillDownStyle) {
- m_drillDownStyleMap.put(row, drillDownStyle);
- }
-
- public String getDrillDownStyle(ITableRow row) {
- return m_drillDownStyleMap.get(row);
- }
-
- public int getTableRowFormDisplayHint() {
- return m_tableRowFormDisplayHint;
- }
-
- public void setTableRowFormDisplayHint(int tableRowFormDisplayHint) {
- m_tableRowFormDisplayHint = tableRowFormDisplayHint;
- }
-
- public String getTableRowFormDisplayViewId() {
- return m_tableRowFormDisplayViewId;
- }
-
- public void setTableRowFormDisplayViewId(String tableRowFormDisplayViewId) {
- m_tableRowFormDisplayViewId = tableRowFormDisplayViewId;
- }
-
- @Override
- public void setDrillDownStyleMap(DrillDownStyleMap drillDownStyleMap) {
- m_drillDownStyleMap = drillDownStyleMap;
- if (m_drillDownStyleMap == null) {
- m_drillDownStyleMap = new DrillDownStyleMap();
- }
- }
-
- @Override
- public DrillDownStyleMap getDrillDownStyleMap() {
- return m_drillDownStyleMap;
- }
-
- protected boolean execIsAutoCreateTableRowForm() {
- if (isCheckable()) {
- return false;
- }
-
- return true;
- }
-
- protected String execComputeDrillDownStyle() {
- if (isCheckable()) {
- return IRowSummaryColumn.DRILL_DOWN_STYLE_NONE;
- }
-
- return IRowSummaryColumn.DRILL_DOWN_STYLE_ICON;
- }
-
- protected void startTableRowForm(ITableRow row) throws ProcessingException {
- TableRowForm form = new TableRowForm(row);
- form.setDisplayHint(getTableRowFormDisplayHint());
- form.setDisplayViewId(getTableRowFormDisplayViewId());
- form.setModal(IForm.DISPLAY_HINT_DIALOG == form.getDisplayHint());
- form.start();
- if (IRowSummaryColumn.DRILL_DOWN_STYLE_ICON.equals(getDrillDownStyle(row))) {
- form.addFormListener(new ClearTableSelectionFormCloseListener(this));
- }
- }
-
- protected void clearSelectionDelayed() {
- ClientSyncJob job = new ClientSyncJob("Clearing selection", ClientJob.getCurrentSession()) {
-
- @Override
- protected void runVoid(IProgressMonitor monitor) throws Throwable {
- clearSelection();
- }
-
- };
- job.schedule();
- }
-
- protected void clearSelection() {
- selectRow(null);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.basic.table;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ClientJob;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.mobile.ui.basic.table.columns.IRowSummaryColumn;
+import org.eclipse.scout.rt.client.mobile.ui.basic.table.form.TableRowForm;
+import org.eclipse.scout.rt.client.ui.basic.table.AbstractTable;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+
+/**
+ * @since 3.9.0
+ */
+public abstract class AbstractMobileTable extends AbstractTable implements IMobileTable {
+ private DrillDownStyleMap m_drillDownStyleMap;
+ private int m_tableRowFormDisplayHint;
+ private String m_tableRowFormDisplayViewId;
+
+ public AbstractMobileTable() {
+ this(true);
+ }
+
+ public AbstractMobileTable(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ @Override
+ protected void initConfig() {
+ super.initConfig();
+
+ m_drillDownStyleMap = new DrillDownStyleMap();
+ setAutoCreateTableRowForm(execIsAutoCreateTableRowForm());
+ setDefaultDrillDownStyle(execComputeDrillDownStyle());
+ }
+
+ @Override
+ public boolean isAutoCreateTableRowForm() {
+ return propertySupport.getPropertyBool(PROP_AUTO_CREATE_TABLE_ROW_FORM);
+ }
+
+ @Override
+ public void setAutoCreateTableRowForm(boolean autoCreateTableRowForm) {
+ propertySupport.setPropertyBool(PROP_AUTO_CREATE_TABLE_ROW_FORM, autoCreateTableRowForm);
+ }
+
+ @Override
+ public String getDefaultDrillDownStyle() {
+ return propertySupport.getPropertyString(PROP_DEFAULT_DRILL_DOWN_STYLE);
+ }
+
+ @Override
+ public void setDefaultDrillDownStyle(String defaultDrillDownStyle) {
+ propertySupport.setPropertyString(PROP_DEFAULT_DRILL_DOWN_STYLE, defaultDrillDownStyle);
+ }
+
+ public void putDrillDownStyle(ITableRow row, String drillDownStyle) {
+ m_drillDownStyleMap.put(row, drillDownStyle);
+ }
+
+ public String getDrillDownStyle(ITableRow row) {
+ return m_drillDownStyleMap.get(row);
+ }
+
+ public int getTableRowFormDisplayHint() {
+ return m_tableRowFormDisplayHint;
+ }
+
+ public void setTableRowFormDisplayHint(int tableRowFormDisplayHint) {
+ m_tableRowFormDisplayHint = tableRowFormDisplayHint;
+ }
+
+ public String getTableRowFormDisplayViewId() {
+ return m_tableRowFormDisplayViewId;
+ }
+
+ public void setTableRowFormDisplayViewId(String tableRowFormDisplayViewId) {
+ m_tableRowFormDisplayViewId = tableRowFormDisplayViewId;
+ }
+
+ @Override
+ public void setDrillDownStyleMap(DrillDownStyleMap drillDownStyleMap) {
+ m_drillDownStyleMap = drillDownStyleMap;
+ if (m_drillDownStyleMap == null) {
+ m_drillDownStyleMap = new DrillDownStyleMap();
+ }
+ }
+
+ @Override
+ public DrillDownStyleMap getDrillDownStyleMap() {
+ return m_drillDownStyleMap;
+ }
+
+ protected boolean execIsAutoCreateTableRowForm() {
+ if (isCheckable()) {
+ return false;
+ }
+
+ return true;
+ }
+
+ protected String execComputeDrillDownStyle() {
+ if (isCheckable()) {
+ return IRowSummaryColumn.DRILL_DOWN_STYLE_NONE;
+ }
+
+ return IRowSummaryColumn.DRILL_DOWN_STYLE_ICON;
+ }
+
+ protected void startTableRowForm(ITableRow row) throws ProcessingException {
+ TableRowForm form = new TableRowForm(row);
+ form.setDisplayHint(getTableRowFormDisplayHint());
+ form.setDisplayViewId(getTableRowFormDisplayViewId());
+ form.setModal(IForm.DISPLAY_HINT_DIALOG == form.getDisplayHint());
+ form.start();
+ if (IRowSummaryColumn.DRILL_DOWN_STYLE_ICON.equals(getDrillDownStyle(row))) {
+ form.addFormListener(new ClearTableSelectionFormCloseListener(this));
+ }
+ }
+
+ protected void clearSelectionDelayed() {
+ ClientSyncJob job = new ClientSyncJob("Clearing selection", ClientJob.getCurrentSession()) {
+
+ @Override
+ protected void runVoid(IProgressMonitor monitor) throws Throwable {
+ clearSelection();
+ }
+
+ };
+ job.schedule();
+ }
+
+ protected void clearSelection() {
+ selectRow(null);
+ }
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/ClearTableSelectionFormCloseListener.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/ClearTableSelectionFormCloseListener.java
index 80f07bc5b2..57c09deea0 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/ClearTableSelectionFormCloseListener.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/ClearTableSelectionFormCloseListener.java
@@ -1,43 +1,43 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.basic.table;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.form.FormEvent;
-import org.eclipse.scout.rt.client.ui.form.FormListener;
-
-/**
- * @since 3.9.0
- */
-public class ClearTableSelectionFormCloseListener implements FormListener {
- private ITable m_table;
-
- public ClearTableSelectionFormCloseListener(ITable table) {
- m_table = table;
- }
-
- @Override
- public void formChanged(FormEvent e) throws ProcessingException {
- if (FormEvent.TYPE_CLOSED == e.getType()) {
- handleFormClosed();
- }
- }
-
- protected void handleFormClosed() {
- clearSelection();
- }
-
- protected void clearSelection() {
- m_table.selectRow(null);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.basic.table;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.form.FormEvent;
+import org.eclipse.scout.rt.client.ui.form.FormListener;
+
+/**
+ * @since 3.9.0
+ */
+public class ClearTableSelectionFormCloseListener implements FormListener {
+ private ITable m_table;
+
+ public ClearTableSelectionFormCloseListener(ITable table) {
+ m_table = table;
+ }
+
+ @Override
+ public void formChanged(FormEvent e) throws ProcessingException {
+ if (FormEvent.TYPE_CLOSED == e.getType()) {
+ handleFormClosed();
+ }
+ }
+
+ protected void handleFormClosed() {
+ clearSelection();
+ }
+
+ protected void clearSelection() {
+ m_table.selectRow(null);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/DrillDownStyleMap.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/DrillDownStyleMap.java
index 441a78e499..ce75a2456d 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/DrillDownStyleMap.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/DrillDownStyleMap.java
@@ -1,33 +1,33 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.basic.table;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-
-public class DrillDownStyleMap {
- private Map<ITableRow, String> m_drillDownStyleMap;
-
- public DrillDownStyleMap() {
- m_drillDownStyleMap = new HashMap<ITableRow, String>();
- }
-
- public void put(ITableRow tableRow, String drillDownStyle) {
- m_drillDownStyleMap.put(tableRow, drillDownStyle);
- }
-
- public String get(ITableRow tableRow) {
- return m_drillDownStyleMap.get(tableRow);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.basic.table;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+
+public class DrillDownStyleMap {
+ private Map<ITableRow, String> m_drillDownStyleMap;
+
+ public DrillDownStyleMap() {
+ m_drillDownStyleMap = new HashMap<ITableRow, String>();
+ }
+
+ public void put(ITableRow tableRow, String drillDownStyle) {
+ m_drillDownStyleMap.put(tableRow, drillDownStyle);
+ }
+
+ public String get(ITableRow tableRow) {
+ return m_drillDownStyleMap.get(tableRow);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/IMobileTable.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/IMobileTable.java
index 91507dd4f9..8d0129aa9b 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/IMobileTable.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/IMobileTable.java
@@ -1,40 +1,40 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.basic.table;
-
-import org.eclipse.scout.rt.client.mobile.ui.basic.table.columns.IRowSummaryColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-
-/**
- * @since 3.9.0
- */
-public interface IMobileTable extends ITable {
-
- String PROP_DRILL_DOWN_STYLE_MAP = "drillDownStyleMap";
- String PROP_AUTO_CREATE_TABLE_ROW_FORM = "autoCreateTableRowForm";
- String PROP_DEFAULT_DRILL_DOWN_STYLE = IRowSummaryColumn.PROP_DEFAULT_DRILL_DOWN_STYLE;
-
- String DRILL_DOWN_STYLE_NONE = IRowSummaryColumn.DRILL_DOWN_STYLE_NONE;
- String DRILL_DOWN_STYLE_ICON = IRowSummaryColumn.DRILL_DOWN_STYLE_ICON;
- String DRILL_DOWN_STYLE_BUTTON = IRowSummaryColumn.DRILL_DOWN_STYLE_BUTTON;
-
- String getDefaultDrillDownStyle();
-
- void setDefaultDrillDownStyle(String defaultDrillDownStyle);
-
- DrillDownStyleMap getDrillDownStyleMap();
-
- void setDrillDownStyleMap(DrillDownStyleMap drillDownStyleMap);
-
- boolean isAutoCreateTableRowForm();
-
- void setAutoCreateTableRowForm(boolean autoCreateRowForm);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.basic.table;
+
+import org.eclipse.scout.rt.client.mobile.ui.basic.table.columns.IRowSummaryColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+
+/**
+ * @since 3.9.0
+ */
+public interface IMobileTable extends ITable {
+
+ String PROP_DRILL_DOWN_STYLE_MAP = "drillDownStyleMap";
+ String PROP_AUTO_CREATE_TABLE_ROW_FORM = "autoCreateTableRowForm";
+ String PROP_DEFAULT_DRILL_DOWN_STYLE = IRowSummaryColumn.PROP_DEFAULT_DRILL_DOWN_STYLE;
+
+ String DRILL_DOWN_STYLE_NONE = IRowSummaryColumn.DRILL_DOWN_STYLE_NONE;
+ String DRILL_DOWN_STYLE_ICON = IRowSummaryColumn.DRILL_DOWN_STYLE_ICON;
+ String DRILL_DOWN_STYLE_BUTTON = IRowSummaryColumn.DRILL_DOWN_STYLE_BUTTON;
+
+ String getDefaultDrillDownStyle();
+
+ void setDefaultDrillDownStyle(String defaultDrillDownStyle);
+
+ DrillDownStyleMap getDrillDownStyleMap();
+
+ void setDrillDownStyleMap(DrillDownStyleMap drillDownStyleMap);
+
+ boolean isAutoCreateTableRowForm();
+
+ void setAutoCreateTableRowForm(boolean autoCreateRowForm);
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/MobileTable.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/MobileTable.java
index 991a867b56..3fb38cdc8b 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/MobileTable.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/MobileTable.java
@@ -1,486 +1,486 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.basic.table;
-
-import java.net.URL;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.scout.commons.ConfigurationUtility;
-import org.eclipse.scout.commons.OptimisticLock;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.dnd.TransferObject;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.mobile.ui.basic.table.columns.AbstractRowSummaryColumn;
-import org.eclipse.scout.rt.client.mobile.ui.basic.table.columns.IRowSummaryColumn;
-import org.eclipse.scout.rt.client.mobile.ui.form.fields.PropertyBucket;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.basic.table.AbstractTable;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableUIFacade;
-import org.eclipse.scout.rt.client.ui.basic.table.TableAdapter;
-import org.eclipse.scout.rt.client.ui.basic.table.TableEvent;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
-import org.eclipse.scout.service.SERVICES;
-
-/**
- * A table optimized for mobile devices which wraps another table.
- * <p>
- * It consists of a content column which displays the relevant information of the original table.
- *
- * @since 3.9.0
- */
-public class MobileTable extends AbstractMobileTable implements IMobileTable {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(MobileTable.class);
- private static final int ROW_HEIGHT = 18;
- private int m_maxCellDetailColumns;
- private OptimisticLock m_selectionLock;
-
- private MobileTablePropertyDelegator m_propertyDelegator;
-
- private P_TableEventListener m_tableListener;
-
- public MobileTable(ITable originalTable) {
- super(false);
- Set<String> filter = new HashSet<String>();
- filter.add(ITable.PROP_AUTO_RESIZE_COLUMNS);
- filter.add(ITable.PROP_ROW_HEIGHT_HINT);
- filter.add(ITable.PROP_DEFAULT_ICON);
- filter.add(ITable.PROP_HEADER_VISIBLE);
- m_propertyDelegator = new MobileTablePropertyDelegator(originalTable, this, filter);
- callInitializer();
-
- try {
- m_selectionLock = new OptimisticLock();
- m_tableListener = new P_TableEventListener();
-
- m_tableListener.initalizeWith(originalTable);
- getOriginalTable().addTableListener(m_tableListener);
- }
- catch (ProcessingException e) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- }
-
- @Override
- protected void initConfig() {
- super.initConfig();
-
- m_propertyDelegator.init();
- setAutoDiscardOnDelete(false);
- setAutoResizeColumns(true);
- setDefaultIconId(null);
- setHeaderVisible(false);
-
- m_maxCellDetailColumns = 2;
- if (getOriginalTable().getRowHeightHint() == -1) {
- //+1 stands for the cell header row
- setRowHeightHint((m_maxCellDetailColumns + 1) * ROW_HEIGHT);
- }
-
- getContentColumn().setDefaultDrillDownStyle(getDefaultDrillDownStyle());
- setDrillDownStyleMap(getDrillDownStyleMap(getOriginalTable()));
- }
-
- @Override
- protected boolean execIsAutoCreateTableRowForm() {
- Boolean autoCreateRowForm = isAutoCreateRowForm(getOriginalTable());
- if (autoCreateRowForm != null) {
- return autoCreateRowForm;
- }
-
- if (getOriginalTable().isCheckable()) {
- return false;
- }
-
- return true;
- }
-
- @Override
- protected String execComputeDrillDownStyle() {
- String defaultDrillDownStyle = getDefaultDrillDownStyle(getOriginalTable());
- if (defaultDrillDownStyle != null) {
- return defaultDrillDownStyle;
- }
-
- if (getOriginalTable().isCheckable()) {
- return IRowSummaryColumn.DRILL_DOWN_STYLE_NONE;
- }
-
- //Check if the original table already has a selection or click behavior implemented. If yes, use the drill down button style to not break the original selection or click behavior.
- if (!(getOriginalTable() instanceof IMobileTable)) {
- if (ConfigurationUtility.isMethodOverwrite(AbstractTable.class, "execRowsSelected", new Class[]{ITableRow[].class}, getOriginalTable().getClass()) ||
- ConfigurationUtility.isMethodOverwrite(AbstractTable.class, "execRowClick", new Class[]{ITableRow.class}, getOriginalTable().getClass())) {
- return IRowSummaryColumn.DRILL_DOWN_STYLE_BUTTON;
- }
- }
-
- return IRowSummaryColumn.DRILL_DOWN_STYLE_ICON;
- }
-
- public void dispose() {
- if (m_tableListener == null) {
- return;
- }
-
- getOriginalTable().removeTableListener(m_tableListener);
- m_tableListener = null;
- }
-
- public ITable getOriginalTable() {
- return m_propertyDelegator.getSender();
- }
-
- @Override
- public String getDrillDownStyle(ITableRow tableRow) {
- String drillDownStyle = super.getDrillDownStyle(tableRow);
- if (drillDownStyle == null) {
- drillDownStyle = getContentColumn().getDefaultDrillDownStyle();
- }
-
- return drillDownStyle;
- }
-
- @Override
- protected void execRowsSelected(ITableRow[] rows) throws ProcessingException {
- try {
- if (!m_selectionLock.acquire()) {
- //Prevent loop which could happen because delegation of selection is done from this to original table and vice versa
- return;
- }
-
- //Delegate to original table
- getOriginalTable().getUIFacade().setSelectedRowsFromUI(getRowMapColumn().getValues(rows));
-
- ITableRow originalRow = null;
- if (rows != null && rows.length > 0) {
- originalRow = getRowMapColumn().getValue(rows[0]);
- }
- if (originalRow != null) {
- // TODO CGU: Attention: Drill Down style may not be accurate at this time.
- // This may happen if the events are executed as batch and another listener sets the style on a rows inserted event (see PageForm)
- if (isAutoCreateTableRowForm() && IRowSummaryColumn.DRILL_DOWN_STYLE_ICON.equals(getDrillDownStyle(originalRow))) {
- startTableRowForm(originalRow);
- }
- }
- }
- finally {
- m_selectionLock.release();
- }
- }
-
- @Override
- protected void execRowClick(ITableRow row) throws ProcessingException {
- //Delegate to original table
- ITableRow originalRow = getRowMapColumn().getValue(row);
- getOriginalTable().getUIFacade().fireRowClickFromUI(originalRow);
- }
-
- @Override
- protected void execHyperlinkAction(URL url, String path, boolean local) throws ProcessingException {
- //Delegate to original table
- ITableRow originalRow = getRowMapColumn().getValue(getSelectedRow());
- getOriginalTable().getUIFacade().fireHyperlinkActionFromUI(originalRow, null, url);
-
- if (AbstractRowSummaryColumn.isDrillDownButtonUrl(url, path, local)) {
- execDrillDownButtonAction();
- }
- }
-
- protected void execDrillDownButtonAction() throws ProcessingException {
- if (isAutoCreateTableRowForm()) {
- ITableRow originalRow = null;
- ITableRow selectedRow = getSelectedRow();
- if (selectedRow != null) {
- originalRow = getRowMapColumn().getValue(selectedRow);
- }
- startTableRowForm(originalRow);
- }
- }
-
- public ContentColumn getContentColumn() {
- return getColumnSet().getColumnByClass(ContentColumn.class);
- }
-
- public RowMapColumn getRowMapColumn() {
- return getColumnSet().getColumnByClass(RowMapColumn.class);
- }
-
- @Order(10.0)
- public class RowMapColumn extends AbstractColumn<ITableRow> {
-
- @Override
- protected boolean getConfiguredDisplayable() {
- return false;
- }
-
- }
-
- @Order(20.0)
- public class ContentColumn extends AbstractRowSummaryColumn {
-
- }
-
- @Override
- protected ITableUIFacade createUIFacade() {
- return new P_MobileTableUIFacade();
- }
-
- private void reset() {
- discardAllRows();
- }
-
- private void handleWrappedTableRowsDeleted(ITableRow[] rows) {
- try {
- setTableChanging(true);
- for (ITableRow deletedRow : rows) {
- ITableRow mobileTableRow = getRowMapColumn().findRow(deletedRow);
- discardRow(mobileTableRow);
- }
- }
- finally {
- setTableChanging(false);
- }
- }
-
- private void handleWrappedTableRowsSelected(ITableRow[] rows) {
- try {
- setTableChanging(true);
- ITableRow[] mappedRows = getRowMapColumn().findRows(rows);
- selectRows(mappedRows);
- }
- finally {
- setTableChanging(false);
- }
- }
-
- private void handleWrappedTableRowsInserted(ITableRow[] rows) {
- if (!getContentColumn().isInitialized()) {
- getContentColumn().initializeDecorationConfiguration(getOriginalTable(), m_maxCellDetailColumns);
- }
-
- try {
- setTableChanging(true);
- for (ITableRow insertedRow : rows) {
- try {
- ITableRow row = addRowByArray(new Object[]{insertedRow, "", ""});
- getContentColumn().updateValue(row, insertedRow, getDrillDownStyleMap());
- }
- catch (ProcessingException exception) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(exception);
- }
- }
- }
- finally {
- setTableChanging(false);
- }
- }
-
- private void handleWrappedTableRowOrderChanged(ITableRow[] rows) {
- ITableRow[] sortedMobileRows = getRowMapColumn().findRows(rows);
- sort(sortedMobileRows);
- }
-
- private void handleWrappedTableRowsUpdated(ITableRow[] originalRows) {
- if (getOriginalTable() == null || getOriginalTable().getRowCount() == 0) {
- return;
- }
-
- try {
- setTableChanging(true);
- try {
- for (ITableRow originalRow : originalRows) {
- ITableRow row = getRowMapColumn().findRow(originalRow);
- if (row != null) {
- getContentColumn().updateValue(row, originalRow, getDrillDownStyleMap());
- if (isCheckable()) {
- checkRow(row, originalRow.isChecked());
- }
- }
-
- }
-
- }
- catch (ProcessingException exception) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(exception);
- }
- }
- finally {
- setTableChanging(false);
- }
- }
-
- private void selectRows() {
- if (getOriginalTable().getSelectedRowCount() == 0) {
- return;
- }
-
- selectRows(getRowMapColumn().findRows(getOriginalTable().getSelectedRows()));
- }
-
- private void checkRows() throws ProcessingException {
- if (!isCheckable() || getOriginalTable().getCheckedRows().length == 0) {
- return;
- }
-
- checkRows(getRowMapColumn().findRows(getOriginalTable().getCheckedRows()), true);
- }
-
- private class P_TableEventListener extends TableAdapter {
-
- protected void initalizeWith(ITable originalTable) throws ProcessingException {
- reset();
-
- if (originalTable.getRows().length > 0) {
- //'fire' a rows inserted event with all rows
- tableChanged(new TableEvent(originalTable, TableEvent.TYPE_ROWS_INSERTED, originalTable.getRows()));
- }
-
- selectRows();
- checkRows();
- }
-
- @Override
- public void tableChanged(TableEvent e) {
- switch (e.getType()) {
- case TableEvent.TYPE_ROWS_SELECTED: {
- handleWrappedTableRowsSelected(e.getRows());
- break;
- }
- case TableEvent.TYPE_ALL_ROWS_DELETED: {
- reset();
- break;
- }
- case TableEvent.TYPE_ROWS_DELETED: {
- handleWrappedTableRowsDeleted(e.getRows());
- break;
- }
- case TableEvent.TYPE_ROWS_INSERTED: {
- handleWrappedTableRowsInserted(e.getRows());
- break;
- }
- case TableEvent.TYPE_ROWS_UPDATED: {
- handleWrappedTableRowsUpdated(e.getRows());
- break;
- }
- case TableEvent.TYPE_ROW_ORDER_CHANGED: {
- handleWrappedTableRowOrderChanged(e.getRows());
- break;
- }
- }
- }
-
- }
-
- public static void setAutoCreateRowForm(ITable table, Boolean autoCreateRowForm) {
- PropertyBucket.getInstance().setPropertyBoolean(table, IMobileTable.PROP_AUTO_CREATE_TABLE_ROW_FORM, autoCreateRowForm);
- }
-
- public static Boolean isAutoCreateRowForm(ITable table) {
- return PropertyBucket.getInstance().getPropertyBoolean(table, IMobileTable.PROP_AUTO_CREATE_TABLE_ROW_FORM);
- }
-
- public static void setDrillDownStyleMap(ITable table, DrillDownStyleMap drillDownStyles) {
- PropertyBucket.getInstance().setProperty(table, IMobileTable.PROP_DRILL_DOWN_STYLE_MAP, drillDownStyles);
- }
-
- public static DrillDownStyleMap getDrillDownStyleMap(ITable table) {
- return PropertyBucket.getInstance().getProperty(table, IMobileTable.PROP_DRILL_DOWN_STYLE_MAP);
- }
-
- public static void setDefaultDrillDownStyle(ITable table, String defaultDrillDownStyle) {
- PropertyBucket.getInstance().setProperty(table, IMobileTable.PROP_DEFAULT_DRILL_DOWN_STYLE, defaultDrillDownStyle);
- }
-
- public static String getDefaultDrillDownStyle(ITable table) {
- return PropertyBucket.getInstance().getProperty(table, IMobileTable.PROP_DEFAULT_DRILL_DOWN_STYLE);
- }
-
- /**
- * Used to directly dispatch ui events to the original table or to completely deny certain events
- */
- protected class P_MobileTableUIFacade extends P_TableUIFacade {
-
- //------------- pass events only to original table -------------
- @Override
- public IMenu[] fireRowPopupFromUI() {
- return getOriginalTable().getUIFacade().fireRowPopupFromUI();
- }
-
- @Override
- public IMenu[] fireEmptySpacePopupFromUI() {
- return getOriginalTable().getUIFacade().fireEmptySpacePopupFromUI();
- }
-
- @Override
- public IMenu[] fireHeaderPopupFromUI() {
- return getOriginalTable().getUIFacade().fireHeaderPopupFromUI();
- }
-
- @Override
- public TransferObject fireRowsDragRequestFromUI() {
- return getOriginalTable().getUIFacade().fireRowsDragRequestFromUI();
- }
-
- @Override
- public void fireRowDropActionFromUI(ITableRow row, TransferObject dropData) {
- getOriginalTable().getUIFacade().fireRowDropActionFromUI(getRowMapColumn().getValue(row), dropData);
- }
-
- @Override
- public boolean fireKeyTypedFromUI(String keyStrokeText, char keyChar) {
- return getOriginalTable().getUIFacade().fireKeyTypedFromUI(keyStrokeText, keyChar);
- }
-
- //------------- do not process events --------------------------
- @Override
- public void fireRowActionFromUI(ITableRow row) {
- //nop; not allowed
- }
-
- @Override
- public void fireColumnMovedFromUI(IColumn<?> c, int toViewIndex) {
- //nop; not allowed
- }
-
- @Override
- public void fireVisibleColumnsChangedFromUI(IColumn<?>[] visibleColumns) {
- //nop; not allowed
- }
-
- @Override
- public void setColumnWidthFromUI(IColumn<?> c, int newWidth) {
- //nop; not allowed
- }
-
- @Override
- public IFormField prepareCellEditFromUI(ITableRow row, IColumn<?> col) {
- //nop; not allowed
- return null;
- }
-
- @Override
- public void completeCellEditFromUI() {
- //nop; not allowed
- }
-
- @Override
- public void cancelCellEditFromUI() {
- //nop; not allowed
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.basic.table;
+
+import java.net.URL;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.scout.commons.ConfigurationUtility;
+import org.eclipse.scout.commons.OptimisticLock;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.dnd.TransferObject;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.mobile.ui.basic.table.columns.AbstractRowSummaryColumn;
+import org.eclipse.scout.rt.client.mobile.ui.basic.table.columns.IRowSummaryColumn;
+import org.eclipse.scout.rt.client.mobile.ui.form.fields.PropertyBucket;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.basic.table.AbstractTable;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableUIFacade;
+import org.eclipse.scout.rt.client.ui.basic.table.TableAdapter;
+import org.eclipse.scout.rt.client.ui.basic.table.TableEvent;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
+import org.eclipse.scout.service.SERVICES;
+
+/**
+ * A table optimized for mobile devices which wraps another table.
+ * <p>
+ * It consists of a content column which displays the relevant information of the original table.
+ *
+ * @since 3.9.0
+ */
+public class MobileTable extends AbstractMobileTable implements IMobileTable {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(MobileTable.class);
+ private static final int ROW_HEIGHT = 18;
+ private int m_maxCellDetailColumns;
+ private OptimisticLock m_selectionLock;
+
+ private MobileTablePropertyDelegator m_propertyDelegator;
+
+ private P_TableEventListener m_tableListener;
+
+ public MobileTable(ITable originalTable) {
+ super(false);
+ Set<String> filter = new HashSet<String>();
+ filter.add(ITable.PROP_AUTO_RESIZE_COLUMNS);
+ filter.add(ITable.PROP_ROW_HEIGHT_HINT);
+ filter.add(ITable.PROP_DEFAULT_ICON);
+ filter.add(ITable.PROP_HEADER_VISIBLE);
+ m_propertyDelegator = new MobileTablePropertyDelegator(originalTable, this, filter);
+ callInitializer();
+
+ try {
+ m_selectionLock = new OptimisticLock();
+ m_tableListener = new P_TableEventListener();
+
+ m_tableListener.initalizeWith(originalTable);
+ getOriginalTable().addTableListener(m_tableListener);
+ }
+ catch (ProcessingException e) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ }
+
+ @Override
+ protected void initConfig() {
+ super.initConfig();
+
+ m_propertyDelegator.init();
+ setAutoDiscardOnDelete(false);
+ setAutoResizeColumns(true);
+ setDefaultIconId(null);
+ setHeaderVisible(false);
+
+ m_maxCellDetailColumns = 2;
+ if (getOriginalTable().getRowHeightHint() == -1) {
+ //+1 stands for the cell header row
+ setRowHeightHint((m_maxCellDetailColumns + 1) * ROW_HEIGHT);
+ }
+
+ getContentColumn().setDefaultDrillDownStyle(getDefaultDrillDownStyle());
+ setDrillDownStyleMap(getDrillDownStyleMap(getOriginalTable()));
+ }
+
+ @Override
+ protected boolean execIsAutoCreateTableRowForm() {
+ Boolean autoCreateRowForm = isAutoCreateRowForm(getOriginalTable());
+ if (autoCreateRowForm != null) {
+ return autoCreateRowForm;
+ }
+
+ if (getOriginalTable().isCheckable()) {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ protected String execComputeDrillDownStyle() {
+ String defaultDrillDownStyle = getDefaultDrillDownStyle(getOriginalTable());
+ if (defaultDrillDownStyle != null) {
+ return defaultDrillDownStyle;
+ }
+
+ if (getOriginalTable().isCheckable()) {
+ return IRowSummaryColumn.DRILL_DOWN_STYLE_NONE;
+ }
+
+ //Check if the original table already has a selection or click behavior implemented. If yes, use the drill down button style to not break the original selection or click behavior.
+ if (!(getOriginalTable() instanceof IMobileTable)) {
+ if (ConfigurationUtility.isMethodOverwrite(AbstractTable.class, "execRowsSelected", new Class[]{ITableRow[].class}, getOriginalTable().getClass()) ||
+ ConfigurationUtility.isMethodOverwrite(AbstractTable.class, "execRowClick", new Class[]{ITableRow.class}, getOriginalTable().getClass())) {
+ return IRowSummaryColumn.DRILL_DOWN_STYLE_BUTTON;
+ }
+ }
+
+ return IRowSummaryColumn.DRILL_DOWN_STYLE_ICON;
+ }
+
+ public void dispose() {
+ if (m_tableListener == null) {
+ return;
+ }
+
+ getOriginalTable().removeTableListener(m_tableListener);
+ m_tableListener = null;
+ }
+
+ public ITable getOriginalTable() {
+ return m_propertyDelegator.getSender();
+ }
+
+ @Override
+ public String getDrillDownStyle(ITableRow tableRow) {
+ String drillDownStyle = super.getDrillDownStyle(tableRow);
+ if (drillDownStyle == null) {
+ drillDownStyle = getContentColumn().getDefaultDrillDownStyle();
+ }
+
+ return drillDownStyle;
+ }
+
+ @Override
+ protected void execRowsSelected(ITableRow[] rows) throws ProcessingException {
+ try {
+ if (!m_selectionLock.acquire()) {
+ //Prevent loop which could happen because delegation of selection is done from this to original table and vice versa
+ return;
+ }
+
+ //Delegate to original table
+ getOriginalTable().getUIFacade().setSelectedRowsFromUI(getRowMapColumn().getValues(rows));
+
+ ITableRow originalRow = null;
+ if (rows != null && rows.length > 0) {
+ originalRow = getRowMapColumn().getValue(rows[0]);
+ }
+ if (originalRow != null) {
+ // TODO CGU: Attention: Drill Down style may not be accurate at this time.
+ // This may happen if the events are executed as batch and another listener sets the style on a rows inserted event (see PageForm)
+ if (isAutoCreateTableRowForm() && IRowSummaryColumn.DRILL_DOWN_STYLE_ICON.equals(getDrillDownStyle(originalRow))) {
+ startTableRowForm(originalRow);
+ }
+ }
+ }
+ finally {
+ m_selectionLock.release();
+ }
+ }
+
+ @Override
+ protected void execRowClick(ITableRow row) throws ProcessingException {
+ //Delegate to original table
+ ITableRow originalRow = getRowMapColumn().getValue(row);
+ getOriginalTable().getUIFacade().fireRowClickFromUI(originalRow);
+ }
+
+ @Override
+ protected void execHyperlinkAction(URL url, String path, boolean local) throws ProcessingException {
+ //Delegate to original table
+ ITableRow originalRow = getRowMapColumn().getValue(getSelectedRow());
+ getOriginalTable().getUIFacade().fireHyperlinkActionFromUI(originalRow, null, url);
+
+ if (AbstractRowSummaryColumn.isDrillDownButtonUrl(url, path, local)) {
+ execDrillDownButtonAction();
+ }
+ }
+
+ protected void execDrillDownButtonAction() throws ProcessingException {
+ if (isAutoCreateTableRowForm()) {
+ ITableRow originalRow = null;
+ ITableRow selectedRow = getSelectedRow();
+ if (selectedRow != null) {
+ originalRow = getRowMapColumn().getValue(selectedRow);
+ }
+ startTableRowForm(originalRow);
+ }
+ }
+
+ public ContentColumn getContentColumn() {
+ return getColumnSet().getColumnByClass(ContentColumn.class);
+ }
+
+ public RowMapColumn getRowMapColumn() {
+ return getColumnSet().getColumnByClass(RowMapColumn.class);
+ }
+
+ @Order(10.0)
+ public class RowMapColumn extends AbstractColumn<ITableRow> {
+
+ @Override
+ protected boolean getConfiguredDisplayable() {
+ return false;
+ }
+
+ }
+
+ @Order(20.0)
+ public class ContentColumn extends AbstractRowSummaryColumn {
+
+ }
+
+ @Override
+ protected ITableUIFacade createUIFacade() {
+ return new P_MobileTableUIFacade();
+ }
+
+ private void reset() {
+ discardAllRows();
+ }
+
+ private void handleWrappedTableRowsDeleted(ITableRow[] rows) {
+ try {
+ setTableChanging(true);
+ for (ITableRow deletedRow : rows) {
+ ITableRow mobileTableRow = getRowMapColumn().findRow(deletedRow);
+ discardRow(mobileTableRow);
+ }
+ }
+ finally {
+ setTableChanging(false);
+ }
+ }
+
+ private void handleWrappedTableRowsSelected(ITableRow[] rows) {
+ try {
+ setTableChanging(true);
+ ITableRow[] mappedRows = getRowMapColumn().findRows(rows);
+ selectRows(mappedRows);
+ }
+ finally {
+ setTableChanging(false);
+ }
+ }
+
+ private void handleWrappedTableRowsInserted(ITableRow[] rows) {
+ if (!getContentColumn().isInitialized()) {
+ getContentColumn().initializeDecorationConfiguration(getOriginalTable(), m_maxCellDetailColumns);
+ }
+
+ try {
+ setTableChanging(true);
+ for (ITableRow insertedRow : rows) {
+ try {
+ ITableRow row = addRowByArray(new Object[]{insertedRow, "", ""});
+ getContentColumn().updateValue(row, insertedRow, getDrillDownStyleMap());
+ }
+ catch (ProcessingException exception) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(exception);
+ }
+ }
+ }
+ finally {
+ setTableChanging(false);
+ }
+ }
+
+ private void handleWrappedTableRowOrderChanged(ITableRow[] rows) {
+ ITableRow[] sortedMobileRows = getRowMapColumn().findRows(rows);
+ sort(sortedMobileRows);
+ }
+
+ private void handleWrappedTableRowsUpdated(ITableRow[] originalRows) {
+ if (getOriginalTable() == null || getOriginalTable().getRowCount() == 0) {
+ return;
+ }
+
+ try {
+ setTableChanging(true);
+ try {
+ for (ITableRow originalRow : originalRows) {
+ ITableRow row = getRowMapColumn().findRow(originalRow);
+ if (row != null) {
+ getContentColumn().updateValue(row, originalRow, getDrillDownStyleMap());
+ if (isCheckable()) {
+ checkRow(row, originalRow.isChecked());
+ }
+ }
+
+ }
+
+ }
+ catch (ProcessingException exception) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(exception);
+ }
+ }
+ finally {
+ setTableChanging(false);
+ }
+ }
+
+ private void selectRows() {
+ if (getOriginalTable().getSelectedRowCount() == 0) {
+ return;
+ }
+
+ selectRows(getRowMapColumn().findRows(getOriginalTable().getSelectedRows()));
+ }
+
+ private void checkRows() throws ProcessingException {
+ if (!isCheckable() || getOriginalTable().getCheckedRows().length == 0) {
+ return;
+ }
+
+ checkRows(getRowMapColumn().findRows(getOriginalTable().getCheckedRows()), true);
+ }
+
+ private class P_TableEventListener extends TableAdapter {
+
+ protected void initalizeWith(ITable originalTable) throws ProcessingException {
+ reset();
+
+ if (originalTable.getRows().length > 0) {
+ //'fire' a rows inserted event with all rows
+ tableChanged(new TableEvent(originalTable, TableEvent.TYPE_ROWS_INSERTED, originalTable.getRows()));
+ }
+
+ selectRows();
+ checkRows();
+ }
+
+ @Override
+ public void tableChanged(TableEvent e) {
+ switch (e.getType()) {
+ case TableEvent.TYPE_ROWS_SELECTED: {
+ handleWrappedTableRowsSelected(e.getRows());
+ break;
+ }
+ case TableEvent.TYPE_ALL_ROWS_DELETED: {
+ reset();
+ break;
+ }
+ case TableEvent.TYPE_ROWS_DELETED: {
+ handleWrappedTableRowsDeleted(e.getRows());
+ break;
+ }
+ case TableEvent.TYPE_ROWS_INSERTED: {
+ handleWrappedTableRowsInserted(e.getRows());
+ break;
+ }
+ case TableEvent.TYPE_ROWS_UPDATED: {
+ handleWrappedTableRowsUpdated(e.getRows());
+ break;
+ }
+ case TableEvent.TYPE_ROW_ORDER_CHANGED: {
+ handleWrappedTableRowOrderChanged(e.getRows());
+ break;
+ }
+ }
+ }
+
+ }
+
+ public static void setAutoCreateRowForm(ITable table, Boolean autoCreateRowForm) {
+ PropertyBucket.getInstance().setPropertyBoolean(table, IMobileTable.PROP_AUTO_CREATE_TABLE_ROW_FORM, autoCreateRowForm);
+ }
+
+ public static Boolean isAutoCreateRowForm(ITable table) {
+ return PropertyBucket.getInstance().getPropertyBoolean(table, IMobileTable.PROP_AUTO_CREATE_TABLE_ROW_FORM);
+ }
+
+ public static void setDrillDownStyleMap(ITable table, DrillDownStyleMap drillDownStyles) {
+ PropertyBucket.getInstance().setProperty(table, IMobileTable.PROP_DRILL_DOWN_STYLE_MAP, drillDownStyles);
+ }
+
+ public static DrillDownStyleMap getDrillDownStyleMap(ITable table) {
+ return PropertyBucket.getInstance().getProperty(table, IMobileTable.PROP_DRILL_DOWN_STYLE_MAP);
+ }
+
+ public static void setDefaultDrillDownStyle(ITable table, String defaultDrillDownStyle) {
+ PropertyBucket.getInstance().setProperty(table, IMobileTable.PROP_DEFAULT_DRILL_DOWN_STYLE, defaultDrillDownStyle);
+ }
+
+ public static String getDefaultDrillDownStyle(ITable table) {
+ return PropertyBucket.getInstance().getProperty(table, IMobileTable.PROP_DEFAULT_DRILL_DOWN_STYLE);
+ }
+
+ /**
+ * Used to directly dispatch ui events to the original table or to completely deny certain events
+ */
+ protected class P_MobileTableUIFacade extends P_TableUIFacade {
+
+ //------------- pass events only to original table -------------
+ @Override
+ public IMenu[] fireRowPopupFromUI() {
+ return getOriginalTable().getUIFacade().fireRowPopupFromUI();
+ }
+
+ @Override
+ public IMenu[] fireEmptySpacePopupFromUI() {
+ return getOriginalTable().getUIFacade().fireEmptySpacePopupFromUI();
+ }
+
+ @Override
+ public IMenu[] fireHeaderPopupFromUI() {
+ return getOriginalTable().getUIFacade().fireHeaderPopupFromUI();
+ }
+
+ @Override
+ public TransferObject fireRowsDragRequestFromUI() {
+ return getOriginalTable().getUIFacade().fireRowsDragRequestFromUI();
+ }
+
+ @Override
+ public void fireRowDropActionFromUI(ITableRow row, TransferObject dropData) {
+ getOriginalTable().getUIFacade().fireRowDropActionFromUI(getRowMapColumn().getValue(row), dropData);
+ }
+
+ @Override
+ public boolean fireKeyTypedFromUI(String keyStrokeText, char keyChar) {
+ return getOriginalTable().getUIFacade().fireKeyTypedFromUI(keyStrokeText, keyChar);
+ }
+
+ //------------- do not process events --------------------------
+ @Override
+ public void fireRowActionFromUI(ITableRow row) {
+ //nop; not allowed
+ }
+
+ @Override
+ public void fireColumnMovedFromUI(IColumn<?> c, int toViewIndex) {
+ //nop; not allowed
+ }
+
+ @Override
+ public void fireVisibleColumnsChangedFromUI(IColumn<?>[] visibleColumns) {
+ //nop; not allowed
+ }
+
+ @Override
+ public void setColumnWidthFromUI(IColumn<?> c, int newWidth) {
+ //nop; not allowed
+ }
+
+ @Override
+ public IFormField prepareCellEditFromUI(ITableRow row, IColumn<?> col) {
+ //nop; not allowed
+ return null;
+ }
+
+ @Override
+ public void completeCellEditFromUI() {
+ //nop; not allowed
+ }
+
+ @Override
+ public void cancelCellEditFromUI() {
+ //nop; not allowed
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/MobileTablePropertyDelegator.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/MobileTablePropertyDelegator.java
index e798279f7c..1afdceb3d1 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/MobileTablePropertyDelegator.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/MobileTablePropertyDelegator.java
@@ -1,59 +1,59 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.basic.table;
-
-import java.util.Set;
-
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-
-/**
- * Delegates the table properties and also the additional properties of the {@link IMobileTable}.
- * <p>
- * The sender does not necessarily need to be of type {@link IMobileTable}, if the properties are set, they will be
- * delegated.
- *
- * @since 3.9.0
- */
-public class MobileTablePropertyDelegator extends TablePropertyDelegator<ITable, IMobileTable> {
-
- public MobileTablePropertyDelegator(ITable sender, IMobileTable receiver) {
- super(sender, receiver);
- }
-
- public MobileTablePropertyDelegator(ITable sender, IMobileTable receiver, Set<String> filteredPropertyNames) {
- super(sender, receiver, filteredPropertyNames);
- }
-
- @Override
- public void init() {
- super.init();
-
- if (getSender().hasProperty(IMobileTable.PROP_AUTO_CREATE_TABLE_ROW_FORM)) {
- getReceiver().setAutoCreateTableRowForm((Boolean) getSender().getProperty(IMobileTable.PROP_AUTO_CREATE_TABLE_ROW_FORM));
- }
- if (getSender().hasProperty(IMobileTable.PROP_DRILL_DOWN_STYLE_MAP)) {
- getReceiver().setDrillDownStyleMap((DrillDownStyleMap) getSender().getProperty(IMobileTable.PROP_DRILL_DOWN_STYLE_MAP));
- }
- }
-
- @Override
- protected void handlePropertyChange(String name, Object newValue) {
- super.handlePropertyChange(name, newValue);
-
- if (name.equals(IMobileTable.PROP_AUTO_CREATE_TABLE_ROW_FORM)) {
- getReceiver().setAutoCreateTableRowForm((Boolean) newValue);
- }
- else if (name.equals(IMobileTable.PROP_DRILL_DOWN_STYLE_MAP)) {
- getReceiver().setDrillDownStyleMap((DrillDownStyleMap) newValue);
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.basic.table;
+
+import java.util.Set;
+
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+
+/**
+ * Delegates the table properties and also the additional properties of the {@link IMobileTable}.
+ * <p>
+ * The sender does not necessarily need to be of type {@link IMobileTable}, if the properties are set, they will be
+ * delegated.
+ *
+ * @since 3.9.0
+ */
+public class MobileTablePropertyDelegator extends TablePropertyDelegator<ITable, IMobileTable> {
+
+ public MobileTablePropertyDelegator(ITable sender, IMobileTable receiver) {
+ super(sender, receiver);
+ }
+
+ public MobileTablePropertyDelegator(ITable sender, IMobileTable receiver, Set<String> filteredPropertyNames) {
+ super(sender, receiver, filteredPropertyNames);
+ }
+
+ @Override
+ public void init() {
+ super.init();
+
+ if (getSender().hasProperty(IMobileTable.PROP_AUTO_CREATE_TABLE_ROW_FORM)) {
+ getReceiver().setAutoCreateTableRowForm((Boolean) getSender().getProperty(IMobileTable.PROP_AUTO_CREATE_TABLE_ROW_FORM));
+ }
+ if (getSender().hasProperty(IMobileTable.PROP_DRILL_DOWN_STYLE_MAP)) {
+ getReceiver().setDrillDownStyleMap((DrillDownStyleMap) getSender().getProperty(IMobileTable.PROP_DRILL_DOWN_STYLE_MAP));
+ }
+ }
+
+ @Override
+ protected void handlePropertyChange(String name, Object newValue) {
+ super.handlePropertyChange(name, newValue);
+
+ if (name.equals(IMobileTable.PROP_AUTO_CREATE_TABLE_ROW_FORM)) {
+ getReceiver().setAutoCreateTableRowForm((Boolean) newValue);
+ }
+ else if (name.equals(IMobileTable.PROP_DRILL_DOWN_STYLE_MAP)) {
+ getReceiver().setDrillDownStyleMap((DrillDownStyleMap) newValue);
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/TablePropertyDelegator.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/TablePropertyDelegator.java
index 21a6b745ff..174a24092b 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/TablePropertyDelegator.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/TablePropertyDelegator.java
@@ -1,86 +1,86 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.basic.table;
-
-import java.util.Set;
-
-import org.eclipse.scout.rt.client.mobile.ui.form.fields.PropertyDelegator;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-
-public class TablePropertyDelegator<SENDER extends ITable, RECEIVER extends ITable> extends PropertyDelegator<SENDER, RECEIVER> {
-
- public TablePropertyDelegator(SENDER sender, RECEIVER receiver) {
- super(sender, receiver);
- }
-
- public TablePropertyDelegator(SENDER sender, RECEIVER receiver, Set<String> filteredPropertyNames) {
- super(sender, receiver, filteredPropertyNames);
- }
-
- @Override
- public void init() {
- super.init();
-
- getReceiver().setAutoDiscardOnDelete(getSender().isAutoDiscardOnDelete());
- getReceiver().setAutoResizeColumns(getSender().isAutoResizeColumns());
- getReceiver().setCheckable(getSender().isCheckable());
- getReceiver().setDefaultIconId(getSender().getDefaultIconId());
- getReceiver().setEnabled(getSender().isEnabled());
- getReceiver().setHeaderVisible(getSender().isHeaderVisible());
- getReceiver().setInitialMultilineText(getSender().isInitialMultilineText());
- getReceiver().setKeyboardNavigation(getSender().hasKeyboardNavigation());
- getReceiver().setMultiCheck(getSender().isMultiCheck());
- getReceiver().setMultilineText(getSender().isMultilineText());
- getReceiver().setMultiSelect(getSender().isMultiSelect());
- getReceiver().setRowHeightHint(getSender().getRowHeightHint());
- getReceiver().setScrollToSelection(getSender().isScrollToSelection());
- getReceiver().setSortEnabled(getSender().isSortEnabled());
- }
-
- @Override
- protected void handlePropertyChange(String name, Object newValue) {
- super.handlePropertyChange(name, newValue);
-
- if (name.equals(ITable.PROP_AUTO_RESIZE_COLUMNS)) {
- getReceiver().setAutoResizeColumns(getSender().isAutoResizeColumns());
- }
- else if (name.equals(ITable.PROP_CHECKABLE)) {
- getReceiver().setCheckable(getSender().isCheckable());
- }
- else if (name.equals(ITable.PROP_DEFAULT_ICON)) {
- getReceiver().setDefaultIconId(getSender().getDefaultIconId());
- }
- else if (name.equals(ITable.PROP_ENABLED)) {
- getReceiver().setEnabled(getSender().isEnabled());
- }
- else if (name.equals(ITable.PROP_HEADER_VISIBLE)) {
- getReceiver().setHeaderVisible(getSender().isHeaderVisible());
- }
- else if (name.equals(ITable.PROP_KEYBOARD_NAVIGATION)) {
- getReceiver().setKeyboardNavigation(getSender().hasKeyboardNavigation());
- }
- else if (name.equals(ITable.PROP_MULTI_CHECK)) {
- getReceiver().setMultiCheck(getSender().isMultiCheck());
- }
- else if (name.equals(ITable.PROP_MULTILINE_TEXT)) {
- getReceiver().setMultilineText(getSender().isMultilineText());
- }
- else if (name.equals(ITable.PROP_MULTI_SELECT)) {
- getReceiver().setMultiSelect(getSender().isMultiSelect());
- }
- else if (name.equals(ITable.PROP_ROW_HEIGHT_HINT)) {
- getReceiver().setRowHeightHint(getSender().getRowHeightHint());
- }
- else if (name.equals(ITable.PROP_SCROLL_TO_SELECTION)) {
- getReceiver().setScrollToSelection(getSender().isScrollToSelection());
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.basic.table;
+
+import java.util.Set;
+
+import org.eclipse.scout.rt.client.mobile.ui.form.fields.PropertyDelegator;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+
+public class TablePropertyDelegator<SENDER extends ITable, RECEIVER extends ITable> extends PropertyDelegator<SENDER, RECEIVER> {
+
+ public TablePropertyDelegator(SENDER sender, RECEIVER receiver) {
+ super(sender, receiver);
+ }
+
+ public TablePropertyDelegator(SENDER sender, RECEIVER receiver, Set<String> filteredPropertyNames) {
+ super(sender, receiver, filteredPropertyNames);
+ }
+
+ @Override
+ public void init() {
+ super.init();
+
+ getReceiver().setAutoDiscardOnDelete(getSender().isAutoDiscardOnDelete());
+ getReceiver().setAutoResizeColumns(getSender().isAutoResizeColumns());
+ getReceiver().setCheckable(getSender().isCheckable());
+ getReceiver().setDefaultIconId(getSender().getDefaultIconId());
+ getReceiver().setEnabled(getSender().isEnabled());
+ getReceiver().setHeaderVisible(getSender().isHeaderVisible());
+ getReceiver().setInitialMultilineText(getSender().isInitialMultilineText());
+ getReceiver().setKeyboardNavigation(getSender().hasKeyboardNavigation());
+ getReceiver().setMultiCheck(getSender().isMultiCheck());
+ getReceiver().setMultilineText(getSender().isMultilineText());
+ getReceiver().setMultiSelect(getSender().isMultiSelect());
+ getReceiver().setRowHeightHint(getSender().getRowHeightHint());
+ getReceiver().setScrollToSelection(getSender().isScrollToSelection());
+ getReceiver().setSortEnabled(getSender().isSortEnabled());
+ }
+
+ @Override
+ protected void handlePropertyChange(String name, Object newValue) {
+ super.handlePropertyChange(name, newValue);
+
+ if (name.equals(ITable.PROP_AUTO_RESIZE_COLUMNS)) {
+ getReceiver().setAutoResizeColumns(getSender().isAutoResizeColumns());
+ }
+ else if (name.equals(ITable.PROP_CHECKABLE)) {
+ getReceiver().setCheckable(getSender().isCheckable());
+ }
+ else if (name.equals(ITable.PROP_DEFAULT_ICON)) {
+ getReceiver().setDefaultIconId(getSender().getDefaultIconId());
+ }
+ else if (name.equals(ITable.PROP_ENABLED)) {
+ getReceiver().setEnabled(getSender().isEnabled());
+ }
+ else if (name.equals(ITable.PROP_HEADER_VISIBLE)) {
+ getReceiver().setHeaderVisible(getSender().isHeaderVisible());
+ }
+ else if (name.equals(ITable.PROP_KEYBOARD_NAVIGATION)) {
+ getReceiver().setKeyboardNavigation(getSender().hasKeyboardNavigation());
+ }
+ else if (name.equals(ITable.PROP_MULTI_CHECK)) {
+ getReceiver().setMultiCheck(getSender().isMultiCheck());
+ }
+ else if (name.equals(ITable.PROP_MULTILINE_TEXT)) {
+ getReceiver().setMultilineText(getSender().isMultilineText());
+ }
+ else if (name.equals(ITable.PROP_MULTI_SELECT)) {
+ getReceiver().setMultiSelect(getSender().isMultiSelect());
+ }
+ else if (name.equals(ITable.PROP_ROW_HEIGHT_HINT)) {
+ getReceiver().setRowHeightHint(getSender().getRowHeightHint());
+ }
+ else if (name.equals(ITable.PROP_SCROLL_TO_SELECTION)) {
+ getReceiver().setScrollToSelection(getSender().isScrollToSelection());
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/columns/AbstractRowSummaryColumn.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/columns/AbstractRowSummaryColumn.java
index 92495e21b9..b697728e3c 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/columns/AbstractRowSummaryColumn.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/columns/AbstractRowSummaryColumn.java
@@ -1,487 +1,487 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.basic.table.columns;
-
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.scout.commons.HTMLUtility;
-import org.eclipse.scout.commons.IOUtility;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.mobile.Activator;
-import org.eclipse.scout.rt.client.mobile.Icons;
-import org.eclipse.scout.rt.client.mobile.ui.basic.table.DrillDownStyleMap;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractStringColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.ISmartColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IStringColumn;
-import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
-import org.eclipse.scout.service.SERVICES;
-
-/**
- * @since 3.9.0
- */
-public class AbstractRowSummaryColumn extends AbstractStringColumn implements IRowSummaryColumn {
- private boolean m_initialized;
-
- private IColumn m_cellHeaderColumn;
- private List<IColumn> m_cellDetailColumns;
- private String m_htmlCellTemplate;
- private String m_htmlDrillDown;
- private String m_htmlDrillDownButton;
-
- public AbstractRowSummaryColumn() {
- try {
- m_htmlCellTemplate = initHtmlCellTemplate();
- m_htmlDrillDown = initHtmlDrillDown();
- m_htmlDrillDownButton = initHtmlDrillDownButton();
- }
- catch (ProcessingException e) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- }
-
- @Override
- protected void initConfig() {
- super.initConfig();
-
- setDefaultDrillDownStyle(getConfiguredDefaultDrillDownStyle());
- }
-
- protected String initHtmlCellTemplate() throws ProcessingException {
- try {
- return new String(IOUtility.getContent(Activator.getDefault().getBundle().getResource("resources/html/MobileTableCellContent.html").openStream()), "iso-8859-1");
- }
- catch (Throwable t) {
- throw new ProcessingException("Exception while loading html cell template for mobile table", t);
- }
- }
-
- protected String initHtmlDrillDown() throws ProcessingException {
- try {
- return new String(IOUtility.getContent(Activator.getDefault().getBundle().getResource("resources/html/MobileTableDrillDown.html").openStream()), "iso-8859-1");
- }
- catch (Throwable t) {
- throw new ProcessingException("Exception while loading html cell template for mobile table", t);
- }
- }
-
- protected String initHtmlDrillDownButton() throws ProcessingException {
- try {
- return new String(IOUtility.getContent(Activator.getDefault().getBundle().getResource("resources/html/MobileTableDrillDownButton.html").openStream()), "iso-8859-1");
- }
- catch (Throwable t) {
- throw new ProcessingException("Exception while loading html cell template for mobile table", t);
- }
- }
-
- @Override
- public String getDefaultDrillDownStyle() {
- return propertySupport.getPropertyString(PROP_DEFAULT_DRILL_DOWN_STYLE);
- }
-
- @Override
- public void setDefaultDrillDownStyle(String drillDownStyle) {
- propertySupport.setPropertyString(PROP_DEFAULT_DRILL_DOWN_STYLE, drillDownStyle);
- }
-
- public String getConfiguredDefaultDrillDownStyle() {
- return null;
- }
-
- public boolean isInitialized() {
- return m_initialized;
- }
-
- public static boolean isDrillDownButtonUrl(URL url, String path, boolean local) {
- if (!local) {
- return false;
- }
-
- String query = url.getQuery();
- if (query == null) {
- return false;
- }
-
- for (String s : query.split("[\\?\\&]")) {
- Matcher m = Pattern.compile("action=drill_down").matcher(s);
- if (m.matches()) {
- return true;
- }
- }
- return false;
- }
-
- public void updateValue(ITableRow row, ITableRow modelRow, DrillDownStyleMap drillDownStyle) throws ProcessingException {
- setValue(row, computeContentColumnValue(modelRow, drillDownStyle));
- }
-
- public void updateValue(ITableRow row, ITableRow modelRow) throws ProcessingException {
- updateValue(row, modelRow, null);
- }
-
- /**
- * Analyzes the content of the table to find optimal columns for the displayed texts.
- */
- public void initializeDecorationConfiguration(ITable table, int maxCellDetailColumns) {
- m_cellHeaderColumn = null;
- m_cellDetailColumns = new ArrayList<IColumn>(maxCellDetailColumns);
-
- for (IColumn<?> column : table.getColumnSet().getVisibleColumns()) {
- if (m_cellDetailColumns.size() >= maxCellDetailColumns) {
- break;
- }
-
- if (m_cellHeaderColumn == null && useColumnForCellHeader(table, column)) {
- m_cellHeaderColumn = column;
- }
- else if (useColumnForCellDetail(table, column)) {
- m_cellDetailColumns.add(column);
- }
-
- }
-
- m_initialized = true;
- }
-
- private boolean useColumnForCellHeader(ITable table, IColumn<?> column) {
- //Only use the given column if there are no summary columns defined
- if (table.getColumnSet().getSummaryColumns().length == 0) {
- return true;
- }
-
- return false;
- }
-
- private boolean useColumnForCellDetail(ITable table, IColumn<?> column) {
- boolean columnEmpty = true;
- int maxRowsToConsider = 10;
-
- for (int row = 0; row < Math.min(maxRowsToConsider, table.getRowCount()); row++) {
- ITableRow tableRow = table.getRow(row);
- final String columnDisplayText = column.getDisplayText(tableRow);
- if (StringUtility.hasText(columnDisplayText)) {
- columnEmpty = false;
-
- String cellHeaderText = getCellHeaderText(tableRow);
- if (cellHeaderText != null && cellHeaderText.contains(columnDisplayText)) {
- return false;
- }
-
- }
-
- }
-
- if (columnEmpty) {
- return false;
- }
-
- return true;
- }
-
- private String getCellHeaderText(ITableRow row) {
- if (m_cellHeaderColumn != null) {
- return m_cellHeaderColumn.getDisplayText(row);
- }
- else {
- return row.getTable().getSummaryCell(row).getText();
- }
- }
-
- private static final Pattern bodyPartPattern = Pattern.compile("(.*<body[^>]*>)(.*)(</body>.*)", Pattern.CASE_INSENSITIVE | Pattern.DOTALL);
- private static final Pattern htmlPartPattern = Pattern.compile("(.*<html[^>]*>)(.*)(</html>.*)", Pattern.CASE_INSENSITIVE | Pattern.DOTALL);
-
- /**
- * Wraps the existing html with a div having a border on the bottom to visually separate the rows. This would actually
- * be the job of the GUI, but it seems not to be possible with the list widget of rap.
- */
- private String addGridLine(String existingHtml) {
- String borderDivStart = "<div style=\"position: absolute; width: 100%; height: 100%; border-bottom:1px solid #e1efec\">";
- String borderDivEnd = "</div>";
- String prePart = "";
- String mainPart = "";
- String postPart = "";
-
- Matcher m = bodyPartPattern.matcher(existingHtml);
- boolean found = m.find();
- if (!found) {
- m = htmlPartPattern.matcher(existingHtml);
- found = m.find();
- }
- if (found) {
- prePart = m.group(1);
- mainPart = m.group(2);
- postPart = m.group(3);
- }
- else {
- mainPart = existingHtml;
- }
-
- return prePart + borderDivStart + mainPart + borderDivEnd + postPart;
- }
-
- protected String adaptExistingHtmlInCellHeader(String cellHeaderHtml) {
- cellHeaderHtml = addGridLine(cellHeaderHtml);
-
- return cellHeaderHtml;
- }
-
- /**
- * @return true if the text starts with {@code <html>}, false if not. The check is case insensitive.
- */
- private boolean containsHtml(String text) {
- if (text == null || text.length() < 6) {
- return false;
- }
- if (text.charAt(0) == '<' && text.charAt(5) == '>') {
- String tag = text.substring(1, 5);
- return tag.equalsIgnoreCase("html");
- }
-
- return false;
- }
-
- private String computeContentColumnValue(ITableRow row, DrillDownStyleMap drillDownStyles) throws ProcessingException {
- if (row == null) {
- return null;
- }
-
- String cellHeaderText = getCellHeaderText(row);
- if (cellHeaderText == null) {
- cellHeaderText = "";
- }
- //Don't generate cell content if the only column contains html.
- //It is assumed that such a column is already optimized for mobile devices.
- if (m_cellDetailColumns.size() == 0 && containsHtml(cellHeaderText)) {
- cellHeaderText = adaptExistingHtmlInCellHeader(cellHeaderText);
-
- //Make sure drill down style is set to none
- if (drillDownStyles != null) {
- drillDownStyles.put(row, IRowSummaryColumn.DRILL_DOWN_STYLE_NONE);
- }
- return cellHeaderText;
- }
-
- String content = "";
- boolean cellHasHeader = false;
- if (StringUtility.hasText(cellHeaderText)) {
- content = createCellHeader(cellHeaderText);
- content += "<br/>";
- cellHasHeader = true;
- }
-
- content += createCellDetail(row, cellHasHeader);
-
- String drillDownStyle = null;
- if (drillDownStyles != null) {
- drillDownStyle = drillDownStyles.get(row);
- }
- String icon = createCellIcon(row);
- String output = m_htmlCellTemplate.replace("#ICON#", icon);
- output = output.replace("#ICON_COL_WIDTH#", createCellIconColWidth(row, icon));
- output = output.replace("#CONTENT#", content);
- output = output.replace("#DRILL_DOWN#", createCellDrillDown(row, drillDownStyle));
- output = output.replace("#DRILL_DOWN_COL_WIDTH#", createCellDrillDownColWidth(row, drillDownStyle));
-
- return output;
- }
-
- private String createCellIcon(ITableRow row) {
- if (row == null) {
- return "";
- }
-
- String iconId = null;
- if (row.getTable().isCheckable()) {
- if (row.isChecked()) {
- iconId = Icons.CheckboxYes;
- }
- else {
- iconId = Icons.CheckboxNo;
- }
- }
- else {
- iconId = row.getIconId();
- if (iconId == null) {
- iconId = row.getCell(0).getIconId();
- }
- }
-
- if (iconId == null) {
- return "";
- }
- else {
- return "<img width=\"16\" height=\"16\" src=\"cid:" + iconId + "\"/>";
- }
- }
-
- private String createCellIconColWidth(ITableRow row, String icon) {
- if (StringUtility.hasText(icon)) {
- return "32";
- }
- else {
- //If there is no icon set a small width as left padding for the text.
- return "6";
- }
- }
-
- private String createCellDrillDown(ITableRow row, String drillDownStyle) {
- if (drillDownStyle == null) {
- drillDownStyle = getDefaultDrillDownStyle();
- }
-
- if (DRILL_DOWN_STYLE_ICON.equals(drillDownStyle)) {
- return m_htmlDrillDown;
- }
- else if (DRILL_DOWN_STYLE_BUTTON.equals(drillDownStyle)) {
- return m_htmlDrillDownButton;
- }
- else {
- return "";
- }
- }
-
- private String createCellDrillDownColWidth(ITableRow row, String drillDownStyle) {
- if (drillDownStyle == null) {
- drillDownStyle = getDefaultDrillDownStyle();
- }
-
- if (DRILL_DOWN_STYLE_ICON.equals(drillDownStyle)) {
- return "32";
- }
- else if (DRILL_DOWN_STYLE_BUTTON.equals(drillDownStyle)) {
- return "60";
- }
- else {
- return "0";
- }
- }
-
- private String createCellHeader(String cellHeaderText) {
- String content = "";
-
- content = cleanupText(cellHeaderText);
- content = "<b>" + content + "</b>";
-
- return content;
- }
-
- private String createCellDetail(ITableRow row, boolean cellHasHeader) {
- if (row == null) {
- return "";
- }
-
- String content = "";
- int col = 0;
- for (IColumn column : m_cellDetailColumns) {
- String displayText = extractCellDisplayText(column, row);
-
- if (StringUtility.hasText(displayText)) {
- if (isHeaderDescriptionNeeded(row, column)) {
- content += extractColumnHeader(column);
- content += ": ";
- }
- content += displayText;
- }
-
- if (col < m_cellDetailColumns.size() - 1) {
- content += "<br/>";
- }
-
- col++;
- }
-
- if (cellHasHeader) {
- //Make the font a little smaller if there is a cell header
- content = "<span style=\"font-size:12px\">" + content + "</span>";
- }
-
- return content;
- }
-
- private String cleanupText(String text) {
- if (text == null) {
- return null;
- }
-
- //Remove html tags
- if (text.contains("<html>")) {
- String textWithoutHtml = HTMLUtility.getPlainText(text);
- if (textWithoutHtml != null) {
- text = textWithoutHtml;
- }
- }
- text = StringUtility.removeNewLines(text);
- text = StringUtility.trim(text);
- text = replaceSpaces(text);
-
- return text;
- }
-
- /**
- * Replace spaces with non breaking spaces.
- * Can't use &nbsp; because of https://bugs.eclipse.org/bugs/show_bug.cgi?id=379088
- */
- private String replaceSpaces(String text) {
- return text.replaceAll("\\s", "&#160;");
- }
-
- private String extractCellDisplayText(IColumn column, ITableRow row) {
- String displayText = column.getDisplayText(row);
-
- displayText = cleanupText(displayText);
-
- return displayText;
- }
-
- private String extractColumnHeader(IColumn column) {
- String header = column.getHeaderCell().getText();
-
- header = cleanupText(header);
-
- return header;
- }
-
- /**
- * Columns with a reasonable text don't need the header description.
- */
- private boolean isHeaderDescriptionNeeded(ITableRow row, IColumn column) {
- if (column instanceof ISmartColumn<?>) {
- return column.getValue(row) instanceof Boolean;
- }
-
- if (column instanceof IStringColumn) {
- return isNumber(((IStringColumn) column).getValue(row));
- }
-
- return true;
- }
-
- private boolean isNumber(String value) {
- if (value == null) {
- return false;
- }
-
- try {
- Double.parseDouble(value);
- }
- catch (NumberFormatException e) {
- return false;
- }
- return true;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.basic.table.columns;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.scout.commons.HTMLUtility;
+import org.eclipse.scout.commons.IOUtility;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.mobile.Activator;
+import org.eclipse.scout.rt.client.mobile.Icons;
+import org.eclipse.scout.rt.client.mobile.ui.basic.table.DrillDownStyleMap;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractStringColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.ISmartColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IStringColumn;
+import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
+import org.eclipse.scout.service.SERVICES;
+
+/**
+ * @since 3.9.0
+ */
+public class AbstractRowSummaryColumn extends AbstractStringColumn implements IRowSummaryColumn {
+ private boolean m_initialized;
+
+ private IColumn m_cellHeaderColumn;
+ private List<IColumn> m_cellDetailColumns;
+ private String m_htmlCellTemplate;
+ private String m_htmlDrillDown;
+ private String m_htmlDrillDownButton;
+
+ public AbstractRowSummaryColumn() {
+ try {
+ m_htmlCellTemplate = initHtmlCellTemplate();
+ m_htmlDrillDown = initHtmlDrillDown();
+ m_htmlDrillDownButton = initHtmlDrillDownButton();
+ }
+ catch (ProcessingException e) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ }
+
+ @Override
+ protected void initConfig() {
+ super.initConfig();
+
+ setDefaultDrillDownStyle(getConfiguredDefaultDrillDownStyle());
+ }
+
+ protected String initHtmlCellTemplate() throws ProcessingException {
+ try {
+ return new String(IOUtility.getContent(Activator.getDefault().getBundle().getResource("resources/html/MobileTableCellContent.html").openStream()), "iso-8859-1");
+ }
+ catch (Throwable t) {
+ throw new ProcessingException("Exception while loading html cell template for mobile table", t);
+ }
+ }
+
+ protected String initHtmlDrillDown() throws ProcessingException {
+ try {
+ return new String(IOUtility.getContent(Activator.getDefault().getBundle().getResource("resources/html/MobileTableDrillDown.html").openStream()), "iso-8859-1");
+ }
+ catch (Throwable t) {
+ throw new ProcessingException("Exception while loading html cell template for mobile table", t);
+ }
+ }
+
+ protected String initHtmlDrillDownButton() throws ProcessingException {
+ try {
+ return new String(IOUtility.getContent(Activator.getDefault().getBundle().getResource("resources/html/MobileTableDrillDownButton.html").openStream()), "iso-8859-1");
+ }
+ catch (Throwable t) {
+ throw new ProcessingException("Exception while loading html cell template for mobile table", t);
+ }
+ }
+
+ @Override
+ public String getDefaultDrillDownStyle() {
+ return propertySupport.getPropertyString(PROP_DEFAULT_DRILL_DOWN_STYLE);
+ }
+
+ @Override
+ public void setDefaultDrillDownStyle(String drillDownStyle) {
+ propertySupport.setPropertyString(PROP_DEFAULT_DRILL_DOWN_STYLE, drillDownStyle);
+ }
+
+ public String getConfiguredDefaultDrillDownStyle() {
+ return null;
+ }
+
+ public boolean isInitialized() {
+ return m_initialized;
+ }
+
+ public static boolean isDrillDownButtonUrl(URL url, String path, boolean local) {
+ if (!local) {
+ return false;
+ }
+
+ String query = url.getQuery();
+ if (query == null) {
+ return false;
+ }
+
+ for (String s : query.split("[\\?\\&]")) {
+ Matcher m = Pattern.compile("action=drill_down").matcher(s);
+ if (m.matches()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public void updateValue(ITableRow row, ITableRow modelRow, DrillDownStyleMap drillDownStyle) throws ProcessingException {
+ setValue(row, computeContentColumnValue(modelRow, drillDownStyle));
+ }
+
+ public void updateValue(ITableRow row, ITableRow modelRow) throws ProcessingException {
+ updateValue(row, modelRow, null);
+ }
+
+ /**
+ * Analyzes the content of the table to find optimal columns for the displayed texts.
+ */
+ public void initializeDecorationConfiguration(ITable table, int maxCellDetailColumns) {
+ m_cellHeaderColumn = null;
+ m_cellDetailColumns = new ArrayList<IColumn>(maxCellDetailColumns);
+
+ for (IColumn<?> column : table.getColumnSet().getVisibleColumns()) {
+ if (m_cellDetailColumns.size() >= maxCellDetailColumns) {
+ break;
+ }
+
+ if (m_cellHeaderColumn == null && useColumnForCellHeader(table, column)) {
+ m_cellHeaderColumn = column;
+ }
+ else if (useColumnForCellDetail(table, column)) {
+ m_cellDetailColumns.add(column);
+ }
+
+ }
+
+ m_initialized = true;
+ }
+
+ private boolean useColumnForCellHeader(ITable table, IColumn<?> column) {
+ //Only use the given column if there are no summary columns defined
+ if (table.getColumnSet().getSummaryColumns().length == 0) {
+ return true;
+ }
+
+ return false;
+ }
+
+ private boolean useColumnForCellDetail(ITable table, IColumn<?> column) {
+ boolean columnEmpty = true;
+ int maxRowsToConsider = 10;
+
+ for (int row = 0; row < Math.min(maxRowsToConsider, table.getRowCount()); row++) {
+ ITableRow tableRow = table.getRow(row);
+ final String columnDisplayText = column.getDisplayText(tableRow);
+ if (StringUtility.hasText(columnDisplayText)) {
+ columnEmpty = false;
+
+ String cellHeaderText = getCellHeaderText(tableRow);
+ if (cellHeaderText != null && cellHeaderText.contains(columnDisplayText)) {
+ return false;
+ }
+
+ }
+
+ }
+
+ if (columnEmpty) {
+ return false;
+ }
+
+ return true;
+ }
+
+ private String getCellHeaderText(ITableRow row) {
+ if (m_cellHeaderColumn != null) {
+ return m_cellHeaderColumn.getDisplayText(row);
+ }
+ else {
+ return row.getTable().getSummaryCell(row).getText();
+ }
+ }
+
+ private static final Pattern bodyPartPattern = Pattern.compile("(.*<body[^>]*>)(.*)(</body>.*)", Pattern.CASE_INSENSITIVE | Pattern.DOTALL);
+ private static final Pattern htmlPartPattern = Pattern.compile("(.*<html[^>]*>)(.*)(</html>.*)", Pattern.CASE_INSENSITIVE | Pattern.DOTALL);
+
+ /**
+ * Wraps the existing html with a div having a border on the bottom to visually separate the rows. This would actually
+ * be the job of the GUI, but it seems not to be possible with the list widget of rap.
+ */
+ private String addGridLine(String existingHtml) {
+ String borderDivStart = "<div style=\"position: absolute; width: 100%; height: 100%; border-bottom:1px solid #e1efec\">";
+ String borderDivEnd = "</div>";
+ String prePart = "";
+ String mainPart = "";
+ String postPart = "";
+
+ Matcher m = bodyPartPattern.matcher(existingHtml);
+ boolean found = m.find();
+ if (!found) {
+ m = htmlPartPattern.matcher(existingHtml);
+ found = m.find();
+ }
+ if (found) {
+ prePart = m.group(1);
+ mainPart = m.group(2);
+ postPart = m.group(3);
+ }
+ else {
+ mainPart = existingHtml;
+ }
+
+ return prePart + borderDivStart + mainPart + borderDivEnd + postPart;
+ }
+
+ protected String adaptExistingHtmlInCellHeader(String cellHeaderHtml) {
+ cellHeaderHtml = addGridLine(cellHeaderHtml);
+
+ return cellHeaderHtml;
+ }
+
+ /**
+ * @return true if the text starts with {@code <html>}, false if not. The check is case insensitive.
+ */
+ private boolean containsHtml(String text) {
+ if (text == null || text.length() < 6) {
+ return false;
+ }
+ if (text.charAt(0) == '<' && text.charAt(5) == '>') {
+ String tag = text.substring(1, 5);
+ return tag.equalsIgnoreCase("html");
+ }
+
+ return false;
+ }
+
+ private String computeContentColumnValue(ITableRow row, DrillDownStyleMap drillDownStyles) throws ProcessingException {
+ if (row == null) {
+ return null;
+ }
+
+ String cellHeaderText = getCellHeaderText(row);
+ if (cellHeaderText == null) {
+ cellHeaderText = "";
+ }
+ //Don't generate cell content if the only column contains html.
+ //It is assumed that such a column is already optimized for mobile devices.
+ if (m_cellDetailColumns.size() == 0 && containsHtml(cellHeaderText)) {
+ cellHeaderText = adaptExistingHtmlInCellHeader(cellHeaderText);
+
+ //Make sure drill down style is set to none
+ if (drillDownStyles != null) {
+ drillDownStyles.put(row, IRowSummaryColumn.DRILL_DOWN_STYLE_NONE);
+ }
+ return cellHeaderText;
+ }
+
+ String content = "";
+ boolean cellHasHeader = false;
+ if (StringUtility.hasText(cellHeaderText)) {
+ content = createCellHeader(cellHeaderText);
+ content += "<br/>";
+ cellHasHeader = true;
+ }
+
+ content += createCellDetail(row, cellHasHeader);
+
+ String drillDownStyle = null;
+ if (drillDownStyles != null) {
+ drillDownStyle = drillDownStyles.get(row);
+ }
+ String icon = createCellIcon(row);
+ String output = m_htmlCellTemplate.replace("#ICON#", icon);
+ output = output.replace("#ICON_COL_WIDTH#", createCellIconColWidth(row, icon));
+ output = output.replace("#CONTENT#", content);
+ output = output.replace("#DRILL_DOWN#", createCellDrillDown(row, drillDownStyle));
+ output = output.replace("#DRILL_DOWN_COL_WIDTH#", createCellDrillDownColWidth(row, drillDownStyle));
+
+ return output;
+ }
+
+ private String createCellIcon(ITableRow row) {
+ if (row == null) {
+ return "";
+ }
+
+ String iconId = null;
+ if (row.getTable().isCheckable()) {
+ if (row.isChecked()) {
+ iconId = Icons.CheckboxYes;
+ }
+ else {
+ iconId = Icons.CheckboxNo;
+ }
+ }
+ else {
+ iconId = row.getIconId();
+ if (iconId == null) {
+ iconId = row.getCell(0).getIconId();
+ }
+ }
+
+ if (iconId == null) {
+ return "";
+ }
+ else {
+ return "<img width=\"16\" height=\"16\" src=\"cid:" + iconId + "\"/>";
+ }
+ }
+
+ private String createCellIconColWidth(ITableRow row, String icon) {
+ if (StringUtility.hasText(icon)) {
+ return "32";
+ }
+ else {
+ //If there is no icon set a small width as left padding for the text.
+ return "6";
+ }
+ }
+
+ private String createCellDrillDown(ITableRow row, String drillDownStyle) {
+ if (drillDownStyle == null) {
+ drillDownStyle = getDefaultDrillDownStyle();
+ }
+
+ if (DRILL_DOWN_STYLE_ICON.equals(drillDownStyle)) {
+ return m_htmlDrillDown;
+ }
+ else if (DRILL_DOWN_STYLE_BUTTON.equals(drillDownStyle)) {
+ return m_htmlDrillDownButton;
+ }
+ else {
+ return "";
+ }
+ }
+
+ private String createCellDrillDownColWidth(ITableRow row, String drillDownStyle) {
+ if (drillDownStyle == null) {
+ drillDownStyle = getDefaultDrillDownStyle();
+ }
+
+ if (DRILL_DOWN_STYLE_ICON.equals(drillDownStyle)) {
+ return "32";
+ }
+ else if (DRILL_DOWN_STYLE_BUTTON.equals(drillDownStyle)) {
+ return "60";
+ }
+ else {
+ return "0";
+ }
+ }
+
+ private String createCellHeader(String cellHeaderText) {
+ String content = "";
+
+ content = cleanupText(cellHeaderText);
+ content = "<b>" + content + "</b>";
+
+ return content;
+ }
+
+ private String createCellDetail(ITableRow row, boolean cellHasHeader) {
+ if (row == null) {
+ return "";
+ }
+
+ String content = "";
+ int col = 0;
+ for (IColumn column : m_cellDetailColumns) {
+ String displayText = extractCellDisplayText(column, row);
+
+ if (StringUtility.hasText(displayText)) {
+ if (isHeaderDescriptionNeeded(row, column)) {
+ content += extractColumnHeader(column);
+ content += ": ";
+ }
+ content += displayText;
+ }
+
+ if (col < m_cellDetailColumns.size() - 1) {
+ content += "<br/>";
+ }
+
+ col++;
+ }
+
+ if (cellHasHeader) {
+ //Make the font a little smaller if there is a cell header
+ content = "<span style=\"font-size:12px\">" + content + "</span>";
+ }
+
+ return content;
+ }
+
+ private String cleanupText(String text) {
+ if (text == null) {
+ return null;
+ }
+
+ //Remove html tags
+ if (text.contains("<html>")) {
+ String textWithoutHtml = HTMLUtility.getPlainText(text);
+ if (textWithoutHtml != null) {
+ text = textWithoutHtml;
+ }
+ }
+ text = StringUtility.removeNewLines(text);
+ text = StringUtility.trim(text);
+ text = replaceSpaces(text);
+
+ return text;
+ }
+
+ /**
+ * Replace spaces with non breaking spaces.
+ * Can't use &nbsp; because of https://bugs.eclipse.org/bugs/show_bug.cgi?id=379088
+ */
+ private String replaceSpaces(String text) {
+ return text.replaceAll("\\s", "&#160;");
+ }
+
+ private String extractCellDisplayText(IColumn column, ITableRow row) {
+ String displayText = column.getDisplayText(row);
+
+ displayText = cleanupText(displayText);
+
+ return displayText;
+ }
+
+ private String extractColumnHeader(IColumn column) {
+ String header = column.getHeaderCell().getText();
+
+ header = cleanupText(header);
+
+ return header;
+ }
+
+ /**
+ * Columns with a reasonable text don't need the header description.
+ */
+ private boolean isHeaderDescriptionNeeded(ITableRow row, IColumn column) {
+ if (column instanceof ISmartColumn<?>) {
+ return column.getValue(row) instanceof Boolean;
+ }
+
+ if (column instanceof IStringColumn) {
+ return isNumber(((IStringColumn) column).getValue(row));
+ }
+
+ return true;
+ }
+
+ private boolean isNumber(String value) {
+ if (value == null) {
+ return false;
+ }
+
+ try {
+ Double.parseDouble(value);
+ }
+ catch (NumberFormatException e) {
+ return false;
+ }
+ return true;
+ }
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/columns/IRowSummaryColumn.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/columns/IRowSummaryColumn.java
index 74d59a3bac..2f1048669b 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/columns/IRowSummaryColumn.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/columns/IRowSummaryColumn.java
@@ -1,30 +1,30 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.basic.table.columns;
-
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-
-/**
- * @since 3..9.0
- */
-public interface IRowSummaryColumn extends IColumn<String> {
-
- String PROP_DEFAULT_DRILL_DOWN_STYLE = "defaultDrillDownStyle";
-
- String DRILL_DOWN_STYLE_NONE = "none";
- String DRILL_DOWN_STYLE_ICON = "icon";
- String DRILL_DOWN_STYLE_BUTTON = "button";
-
- String getDefaultDrillDownStyle();
-
- void setDefaultDrillDownStyle(String drillDownStyle);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.basic.table.columns;
+
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+
+/**
+ * @since 3..9.0
+ */
+public interface IRowSummaryColumn extends IColumn<String> {
+
+ String PROP_DEFAULT_DRILL_DOWN_STYLE = "defaultDrillDownStyle";
+
+ String DRILL_DOWN_STYLE_NONE = "none";
+ String DRILL_DOWN_STYLE_ICON = "icon";
+ String DRILL_DOWN_STYLE_BUTTON = "button";
+
+ String getDefaultDrillDownStyle();
+
+ void setDefaultDrillDownStyle(String drillDownStyle);
+
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/TableRowForm.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/TableRowForm.java
index 1c00ab986a..0c831b3bda 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/TableRowForm.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/TableRowForm.java
@@ -1,219 +1,219 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.basic.table.form;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.mobile.ui.basic.table.form.fields.ColumnFieldBuilder;
-import org.eclipse.scout.rt.client.mobile.ui.form.AbstractMobileForm;
-import org.eclipse.scout.rt.client.mobile.ui.form.IActionFetcher;
-import org.eclipse.scout.rt.client.mobile.ui.form.fields.button.AbstractBackButton;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.client.ui.basic.table.TableAdapter;
-import org.eclipse.scout.rt.client.ui.basic.table.TableEvent;
-import org.eclipse.scout.rt.client.ui.basic.table.TableRowMapper;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-import org.eclipse.scout.rt.client.ui.form.AbstractFormHandler;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
-import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
-import org.eclipse.scout.service.SERVICES;
-
-/**
- * Form which displays a {@link ITableRow} as fields. Only the fields belonging to editable columns are enabled.
- *
- * @since 3.9.0
- */
-public class TableRowForm extends AbstractMobileForm {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(TableRowForm.class);
-
- private ITable m_table;
- private ITableRow m_row;
- private ColumnFieldBuilder m_autoTableBuilder;
- private Map<IColumn, IFormField> m_autoGeneratedFields;
- private P_TableListener m_tableListener;
- private TableRowMapper m_rowMapper;
-
- public TableRowForm(ITableRow row) throws ProcessingException {
- super(false);
- m_row = row;
- m_table = row.getTable();
- m_autoTableBuilder = createAutoTableBuilder();
- m_autoGeneratedFields = m_autoTableBuilder.build(getTable().getColumns(), row);
- callInitializer();
-
- m_tableListener = new P_TableListener();
- getTable().addTableListener(m_tableListener);
- }
-
- @Override
- protected void execDisposeForm() throws ProcessingException {
- getTable().removeTableListener(m_tableListener);
- }
-
- protected ColumnFieldBuilder createAutoTableBuilder() {
- return new ColumnFieldBuilder();
- }
-
- public ITable getTable() {
- return m_table;
- }
-
- public ITableRow getRow() {
- return m_row;
- }
-
- @Override
- protected int getConfiguredDisplayHint() {
- return DISPLAY_HINT_VIEW;
- }
-
- @Override
- protected String getConfiguredDisplayViewId() {
- return VIEW_ID_PAGE_DETAIL;
- }
-
- @Override
- protected IActionFetcher createHeaderActionFetcher() {
- return new TableRowFormHeaderActionFetcher(this, getTable());
- }
-
- @Order(10.0f)
- public class MainBox extends AbstractGroupBox {
-
- @Order(10.0f)
- public class GroupBox extends AbstractGroupBox {
-
- @Override
- protected void injectFieldsInternal(List<IFormField> fieldList) {
- for (IColumn column : getTable().getColumns()) {
- IFormField field = m_autoGeneratedFields.get(column);
- if (field != null) {
- fieldList.add(field);
- }
- }
-
- super.injectFieldsInternal(fieldList);
- }
-
- }
-
- @Order(5)
- public class BackButton extends AbstractBackButton {
-
- }
-
- }
-
- public void start() throws ProcessingException {
- startInternal(new FormHandler());
- }
-
- @Order(10.0f)
- public class FormHandler extends AbstractFormHandler {
-
- @SuppressWarnings("unchecked")
- @Override
- protected void execLoad() throws ProcessingException {
- m_rowMapper = new TableRowMapper(getRow());
- for (IColumn column : m_autoGeneratedFields.keySet()) {
- IFormField field = m_autoGeneratedFields.get(column);
- if (field instanceof IValueField) {
- IValueField<?> valueField = (IValueField<?>) field;
- m_rowMapper.addMapping(column, valueField);
- valueField.addPropertyChangeListener(new P_ValueFieldListener(column));
- }
- }
- m_rowMapper.exportRowData();
- }
-
- }
-
- private void handleRowDeleted() {
- try {
- doClose();
- }
- catch (ProcessingException e) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- }
-
- private void handleRowUpdated() {
- m_rowMapper.exportRowData();
- }
-
- /**
- * Listener to inform the column about the completion of an edit.
- */
- private class P_ValueFieldListener implements PropertyChangeListener {
- private IColumn<?> m_column;
-
- public P_ValueFieldListener(IColumn<?> column) {
- m_column = column;
- }
-
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- try {
- if (!m_column.isEditable()) {
- return;
- }
-
- IValueField<?> field = (IValueField) evt.getSource();
- if (IValueField.PROP_VALUE.equals(evt.getPropertyName())) {
- m_column.completeEdit(getRow(), field);
- }
- }
- catch (ProcessingException e) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- }
-
- }
-
- private class P_TableListener extends TableAdapter {
-
- @Override
- public void tableChanged(TableEvent e) {
- ITableRow[] rows = e.getRows();
- if (rows == null) {
- return;
- }
-
- for (ITableRow row : rows) {
- if (!getRow().equals(row)) {
- continue;
- }
-
- switch (e.getType()) {
- case TableEvent.TYPE_ALL_ROWS_DELETED:
- case TableEvent.TYPE_ROWS_DELETED:
- handleRowDeleted();
- break;
- case TableEvent.TYPE_ROWS_UPDATED:
- handleRowUpdated();
- break;
- }
- }
- }
-
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.basic.table.form;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.mobile.ui.basic.table.form.fields.ColumnFieldBuilder;
+import org.eclipse.scout.rt.client.mobile.ui.form.AbstractMobileForm;
+import org.eclipse.scout.rt.client.mobile.ui.form.IActionFetcher;
+import org.eclipse.scout.rt.client.mobile.ui.form.fields.button.AbstractBackButton;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.client.ui.basic.table.TableAdapter;
+import org.eclipse.scout.rt.client.ui.basic.table.TableEvent;
+import org.eclipse.scout.rt.client.ui.basic.table.TableRowMapper;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+import org.eclipse.scout.rt.client.ui.form.AbstractFormHandler;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
+import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
+import org.eclipse.scout.service.SERVICES;
+
+/**
+ * Form which displays a {@link ITableRow} as fields. Only the fields belonging to editable columns are enabled.
+ *
+ * @since 3.9.0
+ */
+public class TableRowForm extends AbstractMobileForm {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(TableRowForm.class);
+
+ private ITable m_table;
+ private ITableRow m_row;
+ private ColumnFieldBuilder m_autoTableBuilder;
+ private Map<IColumn, IFormField> m_autoGeneratedFields;
+ private P_TableListener m_tableListener;
+ private TableRowMapper m_rowMapper;
+
+ public TableRowForm(ITableRow row) throws ProcessingException {
+ super(false);
+ m_row = row;
+ m_table = row.getTable();
+ m_autoTableBuilder = createAutoTableBuilder();
+ m_autoGeneratedFields = m_autoTableBuilder.build(getTable().getColumns(), row);
+ callInitializer();
+
+ m_tableListener = new P_TableListener();
+ getTable().addTableListener(m_tableListener);
+ }
+
+ @Override
+ protected void execDisposeForm() throws ProcessingException {
+ getTable().removeTableListener(m_tableListener);
+ }
+
+ protected ColumnFieldBuilder createAutoTableBuilder() {
+ return new ColumnFieldBuilder();
+ }
+
+ public ITable getTable() {
+ return m_table;
+ }
+
+ public ITableRow getRow() {
+ return m_row;
+ }
+
+ @Override
+ protected int getConfiguredDisplayHint() {
+ return DISPLAY_HINT_VIEW;
+ }
+
+ @Override
+ protected String getConfiguredDisplayViewId() {
+ return VIEW_ID_PAGE_DETAIL;
+ }
+
+ @Override
+ protected IActionFetcher createHeaderActionFetcher() {
+ return new TableRowFormHeaderActionFetcher(this, getTable());
+ }
+
+ @Order(10.0f)
+ public class MainBox extends AbstractGroupBox {
+
+ @Order(10.0f)
+ public class GroupBox extends AbstractGroupBox {
+
+ @Override
+ protected void injectFieldsInternal(List<IFormField> fieldList) {
+ for (IColumn column : getTable().getColumns()) {
+ IFormField field = m_autoGeneratedFields.get(column);
+ if (field != null) {
+ fieldList.add(field);
+ }
+ }
+
+ super.injectFieldsInternal(fieldList);
+ }
+
+ }
+
+ @Order(5)
+ public class BackButton extends AbstractBackButton {
+
+ }
+
+ }
+
+ public void start() throws ProcessingException {
+ startInternal(new FormHandler());
+ }
+
+ @Order(10.0f)
+ public class FormHandler extends AbstractFormHandler {
+
+ @SuppressWarnings("unchecked")
+ @Override
+ protected void execLoad() throws ProcessingException {
+ m_rowMapper = new TableRowMapper(getRow());
+ for (IColumn column : m_autoGeneratedFields.keySet()) {
+ IFormField field = m_autoGeneratedFields.get(column);
+ if (field instanceof IValueField) {
+ IValueField<?> valueField = (IValueField<?>) field;
+ m_rowMapper.addMapping(column, valueField);
+ valueField.addPropertyChangeListener(new P_ValueFieldListener(column));
+ }
+ }
+ m_rowMapper.exportRowData();
+ }
+
+ }
+
+ private void handleRowDeleted() {
+ try {
+ doClose();
+ }
+ catch (ProcessingException e) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ }
+
+ private void handleRowUpdated() {
+ m_rowMapper.exportRowData();
+ }
+
+ /**
+ * Listener to inform the column about the completion of an edit.
+ */
+ private class P_ValueFieldListener implements PropertyChangeListener {
+ private IColumn<?> m_column;
+
+ public P_ValueFieldListener(IColumn<?> column) {
+ m_column = column;
+ }
+
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ try {
+ if (!m_column.isEditable()) {
+ return;
+ }
+
+ IValueField<?> field = (IValueField) evt.getSource();
+ if (IValueField.PROP_VALUE.equals(evt.getPropertyName())) {
+ m_column.completeEdit(getRow(), field);
+ }
+ }
+ catch (ProcessingException e) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ }
+
+ }
+
+ private class P_TableListener extends TableAdapter {
+
+ @Override
+ public void tableChanged(TableEvent e) {
+ ITableRow[] rows = e.getRows();
+ if (rows == null) {
+ return;
+ }
+
+ for (ITableRow row : rows) {
+ if (!getRow().equals(row)) {
+ continue;
+ }
+
+ switch (e.getType()) {
+ case TableEvent.TYPE_ALL_ROWS_DELETED:
+ case TableEvent.TYPE_ROWS_DELETED:
+ handleRowDeleted();
+ break;
+ case TableEvent.TYPE_ROWS_UPDATED:
+ handleRowUpdated();
+ break;
+ }
+ }
+ }
+
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/TableRowFormHeaderActionFetcher.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/TableRowFormHeaderActionFetcher.java
index 15fa9dbe1e..05d8ac7af1 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/TableRowFormHeaderActionFetcher.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/TableRowFormHeaderActionFetcher.java
@@ -1,53 +1,53 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.basic.table.form;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.scout.rt.client.mobile.ui.form.AbstractMobileAction;
-import org.eclipse.scout.rt.client.mobile.ui.form.FormHeaderActionFetcher;
-import org.eclipse.scout.rt.client.mobile.ui.form.IMobileAction;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-
-/**
- * Additionally fetches the actions of the table row and places them on the right side.
- */
-public class TableRowFormHeaderActionFetcher extends FormHeaderActionFetcher {
-
- private ITable m_table;
-
- public TableRowFormHeaderActionFetcher(IForm form, ITable table) {
- super(form);
-
- m_table = table;
- }
-
- public ITable getTable() {
- return m_table;
- }
-
- @Override
- public List<IMenu> fetch() {
- List<IMenu> headerActions = super.fetch();
-
- IMenu[] tableRowActions = getTable().getUIFacade().fireRowPopupFromUI();
- for (IMenu action : tableRowActions) {
- AbstractMobileAction.setHorizontalAlignment(action, IMobileAction.HORIZONTAL_ALIGNMENT_RIGHT);
- }
- headerActions.addAll(0, Arrays.asList(tableRowActions));
-
- return headerActions;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.basic.table.form;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.scout.rt.client.mobile.ui.form.AbstractMobileAction;
+import org.eclipse.scout.rt.client.mobile.ui.form.FormHeaderActionFetcher;
+import org.eclipse.scout.rt.client.mobile.ui.form.IMobileAction;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+
+/**
+ * Additionally fetches the actions of the table row and places them on the right side.
+ */
+public class TableRowFormHeaderActionFetcher extends FormHeaderActionFetcher {
+
+ private ITable m_table;
+
+ public TableRowFormHeaderActionFetcher(IForm form, ITable table) {
+ super(form);
+
+ m_table = table;
+ }
+
+ public ITable getTable() {
+ return m_table;
+ }
+
+ @Override
+ public List<IMenu> fetch() {
+ List<IMenu> headerActions = super.fetch();
+
+ IMenu[] tableRowActions = getTable().getUIFacade().fireRowPopupFromUI();
+ for (IMenu action : tableRowActions) {
+ AbstractMobileAction.setHorizontalAlignment(action, IMobileAction.HORIZONTAL_ALIGNMENT_RIGHT);
+ }
+ headerActions.addAll(0, Arrays.asList(tableRowActions));
+
+ return headerActions;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/BigDecimalColumnField.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/BigDecimalColumnField.java
index 2b4b51e61f..f0c1c7edb8 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/BigDecimalColumnField.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/BigDecimalColumnField.java
@@ -1,39 +1,39 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.basic.table.form.fields;
-
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IBigDecimalColumn;
-import org.eclipse.scout.rt.client.ui.form.fields.bigdecimalfield.AbstractBigDecimalField;
-
-/**
- * @since 3.9.0
- */
-public class BigDecimalColumnField extends AbstractBigDecimalField implements IColumnWrapper<IBigDecimalColumn> {
- private BigDecimalColumnFieldPropertyDelegator m_propertyDelegator;
-
- public BigDecimalColumnField(IBigDecimalColumn column) {
- super(false);
- m_propertyDelegator = new BigDecimalColumnFieldPropertyDelegator(column, this);
- callInitializer();
- }
-
- @Override
- protected void initConfig() {
- super.initConfig();
-
- m_propertyDelegator.init();
- }
-
- @Override
- public IBigDecimalColumn getWrappedObject() {
- return m_propertyDelegator.getSender();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.basic.table.form.fields;
+
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IBigDecimalColumn;
+import org.eclipse.scout.rt.client.ui.form.fields.bigdecimalfield.AbstractBigDecimalField;
+
+/**
+ * @since 3.9.0
+ */
+public class BigDecimalColumnField extends AbstractBigDecimalField implements IColumnWrapper<IBigDecimalColumn> {
+ private BigDecimalColumnFieldPropertyDelegator m_propertyDelegator;
+
+ public BigDecimalColumnField(IBigDecimalColumn column) {
+ super(false);
+ m_propertyDelegator = new BigDecimalColumnFieldPropertyDelegator(column, this);
+ callInitializer();
+ }
+
+ @Override
+ protected void initConfig() {
+ super.initConfig();
+
+ m_propertyDelegator.init();
+ }
+
+ @Override
+ public IBigDecimalColumn getWrappedObject() {
+ return m_propertyDelegator.getSender();
+ }
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/BigDecimalColumnFieldPropertyDelegator.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/BigDecimalColumnFieldPropertyDelegator.java
index 55080863f2..2d597e6904 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/BigDecimalColumnFieldPropertyDelegator.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/BigDecimalColumnFieldPropertyDelegator.java
@@ -1,37 +1,37 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.basic.table.form.fields;
-
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IBigDecimalColumn;
-import org.eclipse.scout.rt.client.ui.form.fields.bigdecimalfield.IBigDecimalField;
-
-/**
- * @since 3.9.0
- */
-public class BigDecimalColumnFieldPropertyDelegator extends ColumnFieldPropertyDelegator<IBigDecimalColumn, IBigDecimalField> {
-
- public BigDecimalColumnFieldPropertyDelegator(IBigDecimalColumn sender, IBigDecimalField receiver) {
- super(sender, receiver);
- }
-
- @Override
- public void init() {
- super.init();
-
- getReceiver().setFormat(getSender().getFormat());
- getReceiver().setMinFractionDigits(getSender().getMinFractionDigits());
- getReceiver().setMaxFractionDigits(getSender().getMaxFractionDigits());
- getReceiver().setGroupingUsed(getSender().isGroupingUsed());
- getReceiver().setPercent(getSender().isPercent());
- getReceiver().setMultiplier(getSender().getMultiplier());
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.basic.table.form.fields;
+
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IBigDecimalColumn;
+import org.eclipse.scout.rt.client.ui.form.fields.bigdecimalfield.IBigDecimalField;
+
+/**
+ * @since 3.9.0
+ */
+public class BigDecimalColumnFieldPropertyDelegator extends ColumnFieldPropertyDelegator<IBigDecimalColumn, IBigDecimalField> {
+
+ public BigDecimalColumnFieldPropertyDelegator(IBigDecimalColumn sender, IBigDecimalField receiver) {
+ super(sender, receiver);
+ }
+
+ @Override
+ public void init() {
+ super.init();
+
+ getReceiver().setFormat(getSender().getFormat());
+ getReceiver().setMinFractionDigits(getSender().getMinFractionDigits());
+ getReceiver().setMaxFractionDigits(getSender().getMaxFractionDigits());
+ getReceiver().setGroupingUsed(getSender().isGroupingUsed());
+ getReceiver().setPercent(getSender().isPercent());
+ getReceiver().setMultiplier(getSender().getMultiplier());
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/BooleanColumnField.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/BooleanColumnField.java
index efcfda6a62..fa484b8acb 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/BooleanColumnField.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/BooleanColumnField.java
@@ -1,40 +1,40 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.basic.table.form.fields;
-
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IBooleanColumn;
-import org.eclipse.scout.rt.client.ui.form.fields.booleanfield.AbstractBooleanField;
-import org.eclipse.scout.rt.client.ui.form.fields.booleanfield.IBooleanField;
-
-/**
- * @since 3.9.0
- */
-public class BooleanColumnField extends AbstractBooleanField implements IColumnWrapper<IBooleanColumn> {
- private ColumnFieldPropertyDelegator<IBooleanColumn, IBooleanField> m_propertyDelegator;
-
- public BooleanColumnField(IBooleanColumn column) {
- super(false);
- m_propertyDelegator = new ColumnFieldPropertyDelegator<IBooleanColumn, IBooleanField>(column, this);
- callInitializer();
- }
-
- @Override
- protected void initConfig() {
- super.initConfig();
-
- m_propertyDelegator.init();
- }
-
- @Override
- public IBooleanColumn getWrappedObject() {
- return m_propertyDelegator.getSender();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.basic.table.form.fields;
+
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IBooleanColumn;
+import org.eclipse.scout.rt.client.ui.form.fields.booleanfield.AbstractBooleanField;
+import org.eclipse.scout.rt.client.ui.form.fields.booleanfield.IBooleanField;
+
+/**
+ * @since 3.9.0
+ */
+public class BooleanColumnField extends AbstractBooleanField implements IColumnWrapper<IBooleanColumn> {
+ private ColumnFieldPropertyDelegator<IBooleanColumn, IBooleanField> m_propertyDelegator;
+
+ public BooleanColumnField(IBooleanColumn column) {
+ super(false);
+ m_propertyDelegator = new ColumnFieldPropertyDelegator<IBooleanColumn, IBooleanField>(column, this);
+ callInitializer();
+ }
+
+ @Override
+ protected void initConfig() {
+ super.initConfig();
+
+ m_propertyDelegator.init();
+ }
+
+ @Override
+ public IBooleanColumn getWrappedObject() {
+ return m_propertyDelegator.getSender();
+ }
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/ColumnFieldBuilder.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/ColumnFieldBuilder.java
index f191edbaa4..9cf6959be7 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/ColumnFieldBuilder.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/ColumnFieldBuilder.java
@@ -1,105 +1,105 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.basic.table.form.fields;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IBigDecimalColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IBooleanColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IDateColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IDoubleColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IIntegerColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.ILongColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.ISmartColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IStringColumn;
-import org.eclipse.scout.rt.client.ui.form.fields.GridData;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-
-/**
- * @since 3.9.0
- */
-public class ColumnFieldBuilder {
-
- public Map<IColumn, IFormField> build(IColumn<?>[] columns, ITableRow row) throws ProcessingException {
- Map<IColumn, IFormField> fields = new HashMap<IColumn, IFormField>();
- if (columns == null) {
- return fields;
- }
-
- for (IColumn column : columns) {
- IFormField field = createValueField(column, row);
- if (field != null) {
- fields.put(column, field);
- }
- }
-
- return fields;
- }
-
- @SuppressWarnings("unchecked")
- protected IFormField createValueField(IColumn<?> column, ITableRow row) throws ProcessingException {
- if (column.isEditable()) {
- IFormField field = createEditableField(column, row);
- if (field != null) {
- //Only
- return field;
- }
- }
-
- if (column instanceof IStringColumn) {
- return new StringColumnField((IStringColumn) column);
- }
- if (column instanceof ISmartColumn) {
- return new SmartColumnField((ISmartColumn<?>) column);
- }
- if (column instanceof IDoubleColumn) {
- return new DoubleColumnField((IDoubleColumn) column);
- }
- if (column instanceof IDateColumn) {
- return new DateColumnField((IDateColumn) column);
- }
- if (column instanceof IBooleanColumn) {
- return new BooleanColumnField((IBooleanColumn) column);
- }
- if (column instanceof ILongColumn) {
- return new LongColumnField((ILongColumn) column);
- }
- if (column instanceof IIntegerColumn) {
- return new IntegerColumnField((IIntegerColumn) column);
- }
- if (column instanceof IBigDecimalColumn) {
- return new BigDecimalColumnField((IBigDecimalColumn) column);
- }
-
- return null;
- }
-
- protected IFormField createEditableField(IColumn<?> column, ITableRow row) throws ProcessingException {
- IFormField field = column.prepareEdit(row);
- if (field != null) {
- //Revert changes which are done in AbstractColumn#prepareEdit
- field.setLabelVisible(true);
- GridData gd = field.getGridDataHints();
- gd.weightY = 0;
- field.setGridDataHints(gd);
-
- //Set missing properties
- field.setLabel(column.getHeaderCell().getText());
- field.setTooltipText(column.getHeaderCell().getTooltipText());
- }
-
- return field;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.basic.table.form.fields;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IBigDecimalColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IBooleanColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IDateColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IDoubleColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IIntegerColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.ILongColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.ISmartColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IStringColumn;
+import org.eclipse.scout.rt.client.ui.form.fields.GridData;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+
+/**
+ * @since 3.9.0
+ */
+public class ColumnFieldBuilder {
+
+ public Map<IColumn, IFormField> build(IColumn<?>[] columns, ITableRow row) throws ProcessingException {
+ Map<IColumn, IFormField> fields = new HashMap<IColumn, IFormField>();
+ if (columns == null) {
+ return fields;
+ }
+
+ for (IColumn column : columns) {
+ IFormField field = createValueField(column, row);
+ if (field != null) {
+ fields.put(column, field);
+ }
+ }
+
+ return fields;
+ }
+
+ @SuppressWarnings("unchecked")
+ protected IFormField createValueField(IColumn<?> column, ITableRow row) throws ProcessingException {
+ if (column.isEditable()) {
+ IFormField field = createEditableField(column, row);
+ if (field != null) {
+ //Only
+ return field;
+ }
+ }
+
+ if (column instanceof IStringColumn) {
+ return new StringColumnField((IStringColumn) column);
+ }
+ if (column instanceof ISmartColumn) {
+ return new SmartColumnField((ISmartColumn<?>) column);
+ }
+ if (column instanceof IDoubleColumn) {
+ return new DoubleColumnField((IDoubleColumn) column);
+ }
+ if (column instanceof IDateColumn) {
+ return new DateColumnField((IDateColumn) column);
+ }
+ if (column instanceof IBooleanColumn) {
+ return new BooleanColumnField((IBooleanColumn) column);
+ }
+ if (column instanceof ILongColumn) {
+ return new LongColumnField((ILongColumn) column);
+ }
+ if (column instanceof IIntegerColumn) {
+ return new IntegerColumnField((IIntegerColumn) column);
+ }
+ if (column instanceof IBigDecimalColumn) {
+ return new BigDecimalColumnField((IBigDecimalColumn) column);
+ }
+
+ return null;
+ }
+
+ protected IFormField createEditableField(IColumn<?> column, ITableRow row) throws ProcessingException {
+ IFormField field = column.prepareEdit(row);
+ if (field != null) {
+ //Revert changes which are done in AbstractColumn#prepareEdit
+ field.setLabelVisible(true);
+ GridData gd = field.getGridDataHints();
+ gd.weightY = 0;
+ field.setGridDataHints(gd);
+
+ //Set missing properties
+ field.setLabel(column.getHeaderCell().getText());
+ field.setTooltipText(column.getHeaderCell().getTooltipText());
+ }
+
+ return field;
+ }
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/ColumnFieldPropertyDelegator.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/ColumnFieldPropertyDelegator.java
index 41ef87f543..9aad5dc7f0 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/ColumnFieldPropertyDelegator.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/ColumnFieldPropertyDelegator.java
@@ -1,47 +1,47 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.basic.table.form.fields;
-
-import org.eclipse.scout.rt.client.mobile.ui.form.fields.PropertyDelegator;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-
-/**
- * @since 3.9.0
- */
-public class ColumnFieldPropertyDelegator<SENDER extends IColumn, RECEIVER extends IFormField> extends PropertyDelegator<SENDER, RECEIVER> {
-
- public ColumnFieldPropertyDelegator(SENDER sender, RECEIVER receiver) {
- super(sender, receiver);
- }
-
- @Override
- public void init() {
- getReceiver().setVisible(getSender().isVisible());
- if (!getSender().isVisible()) {
- getReceiver().setVisibleGranted(getSender().isVisibleGranted());
- }
- getReceiver().setLabel(getSender().getHeaderCell().getText());
- getReceiver().setTooltipText(getSender().getHeaderCell().getTooltipText());
- getReceiver().setEnabled(false);
- }
-
- @Override
- protected void handlePropertyChange(String name, Object newValue) {
- if (name.equals(IColumn.PROP_VISIBLE)) {
- getReceiver().setVisible(((Boolean) newValue).booleanValue());
- }
- if (name.equals(IColumn.PROP_EDITABLE)) {
- getReceiver().setEnabled(((Boolean) newValue).booleanValue());
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.basic.table.form.fields;
+
+import org.eclipse.scout.rt.client.mobile.ui.form.fields.PropertyDelegator;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+
+/**
+ * @since 3.9.0
+ */
+public class ColumnFieldPropertyDelegator<SENDER extends IColumn, RECEIVER extends IFormField> extends PropertyDelegator<SENDER, RECEIVER> {
+
+ public ColumnFieldPropertyDelegator(SENDER sender, RECEIVER receiver) {
+ super(sender, receiver);
+ }
+
+ @Override
+ public void init() {
+ getReceiver().setVisible(getSender().isVisible());
+ if (!getSender().isVisible()) {
+ getReceiver().setVisibleGranted(getSender().isVisibleGranted());
+ }
+ getReceiver().setLabel(getSender().getHeaderCell().getText());
+ getReceiver().setTooltipText(getSender().getHeaderCell().getTooltipText());
+ getReceiver().setEnabled(false);
+ }
+
+ @Override
+ protected void handlePropertyChange(String name, Object newValue) {
+ if (name.equals(IColumn.PROP_VISIBLE)) {
+ getReceiver().setVisible(((Boolean) newValue).booleanValue());
+ }
+ if (name.equals(IColumn.PROP_EDITABLE)) {
+ getReceiver().setEnabled(((Boolean) newValue).booleanValue());
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/DateColumnField.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/DateColumnField.java
index 00ad44012b..e11b16f60c 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/DateColumnField.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/DateColumnField.java
@@ -1,39 +1,39 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.basic.table.form.fields;
-
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IDateColumn;
-import org.eclipse.scout.rt.client.ui.form.fields.datefield.AbstractDateField;
-
-/**
- * @since 3.9.0
- */
-public class DateColumnField extends AbstractDateField implements IColumnWrapper<IDateColumn> {
- private DateColumnFieldPropertyDelegator m_propertyDelegator;
-
- public DateColumnField(IDateColumn column) {
- super(false);
- m_propertyDelegator = new DateColumnFieldPropertyDelegator(column, this);
- callInitializer();
- }
-
- @Override
- protected void initConfig() {
- super.initConfig();
-
- m_propertyDelegator.init();
- }
-
- @Override
- public IDateColumn getWrappedObject() {
- return m_propertyDelegator.getSender();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.basic.table.form.fields;
+
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IDateColumn;
+import org.eclipse.scout.rt.client.ui.form.fields.datefield.AbstractDateField;
+
+/**
+ * @since 3.9.0
+ */
+public class DateColumnField extends AbstractDateField implements IColumnWrapper<IDateColumn> {
+ private DateColumnFieldPropertyDelegator m_propertyDelegator;
+
+ public DateColumnField(IDateColumn column) {
+ super(false);
+ m_propertyDelegator = new DateColumnFieldPropertyDelegator(column, this);
+ callInitializer();
+ }
+
+ @Override
+ protected void initConfig() {
+ super.initConfig();
+
+ m_propertyDelegator.init();
+ }
+
+ @Override
+ public IDateColumn getWrappedObject() {
+ return m_propertyDelegator.getSender();
+ }
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/DateColumnFieldPropertyDelegator.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/DateColumnFieldPropertyDelegator.java
index 1afca7e08b..87fc5cddcc 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/DateColumnFieldPropertyDelegator.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/DateColumnFieldPropertyDelegator.java
@@ -1,34 +1,34 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.basic.table.form.fields;
-
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IDateColumn;
-import org.eclipse.scout.rt.client.ui.form.fields.datefield.IDateField;
-
-/**
- * @since 3.9.0
- */
-public class DateColumnFieldPropertyDelegator extends ColumnFieldPropertyDelegator<IDateColumn, IDateField> {
-
- public DateColumnFieldPropertyDelegator(IDateColumn sender, IDateField receiver) {
- super(sender, receiver);
- }
-
- @Override
- public void init() {
- super.init();
-
- getReceiver().setFormat(getSender().getFormat());
- getReceiver().setHasDate(getSender().isHasDate());
- getReceiver().setHasTime(getSender().isHasTime());
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.basic.table.form.fields;
+
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IDateColumn;
+import org.eclipse.scout.rt.client.ui.form.fields.datefield.IDateField;
+
+/**
+ * @since 3.9.0
+ */
+public class DateColumnFieldPropertyDelegator extends ColumnFieldPropertyDelegator<IDateColumn, IDateField> {
+
+ public DateColumnFieldPropertyDelegator(IDateColumn sender, IDateField receiver) {
+ super(sender, receiver);
+ }
+
+ @Override
+ public void init() {
+ super.init();
+
+ getReceiver().setFormat(getSender().getFormat());
+ getReceiver().setHasDate(getSender().isHasDate());
+ getReceiver().setHasTime(getSender().isHasTime());
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/DoubleColumnField.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/DoubleColumnField.java
index a7165df82a..d545b9c520 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/DoubleColumnField.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/DoubleColumnField.java
@@ -1,39 +1,39 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.basic.table.form.fields;
-
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IDoubleColumn;
-import org.eclipse.scout.rt.client.ui.form.fields.doublefield.AbstractDoubleField;
-
-/**
- * @since 3.9.0
- */
-public class DoubleColumnField extends AbstractDoubleField implements IColumnWrapper<IDoubleColumn> {
- private DoubleColumnFieldPropertyDelegator m_propertyDelegator;
-
- public DoubleColumnField(IDoubleColumn column) {
- super(false);
- m_propertyDelegator = new DoubleColumnFieldPropertyDelegator(column, this);
- callInitializer();
- }
-
- @Override
- protected void initConfig() {
- super.initConfig();
-
- m_propertyDelegator.init();
- }
-
- @Override
- public IDoubleColumn getWrappedObject() {
- return m_propertyDelegator.getSender();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.basic.table.form.fields;
+
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IDoubleColumn;
+import org.eclipse.scout.rt.client.ui.form.fields.doublefield.AbstractDoubleField;
+
+/**
+ * @since 3.9.0
+ */
+public class DoubleColumnField extends AbstractDoubleField implements IColumnWrapper<IDoubleColumn> {
+ private DoubleColumnFieldPropertyDelegator m_propertyDelegator;
+
+ public DoubleColumnField(IDoubleColumn column) {
+ super(false);
+ m_propertyDelegator = new DoubleColumnFieldPropertyDelegator(column, this);
+ callInitializer();
+ }
+
+ @Override
+ protected void initConfig() {
+ super.initConfig();
+
+ m_propertyDelegator.init();
+ }
+
+ @Override
+ public IDoubleColumn getWrappedObject() {
+ return m_propertyDelegator.getSender();
+ }
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/DoubleColumnFieldPropertyDelegator.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/DoubleColumnFieldPropertyDelegator.java
index ac2bb66e7b..1719987939 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/DoubleColumnFieldPropertyDelegator.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/DoubleColumnFieldPropertyDelegator.java
@@ -1,37 +1,37 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.basic.table.form.fields;
-
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IDoubleColumn;
-import org.eclipse.scout.rt.client.ui.form.fields.doublefield.IDoubleField;
-
-/**
- * @since 3.9.0
- */
-public class DoubleColumnFieldPropertyDelegator extends ColumnFieldPropertyDelegator<IDoubleColumn, IDoubleField> {
-
- public DoubleColumnFieldPropertyDelegator(IDoubleColumn sender, IDoubleField receiver) {
- super(sender, receiver);
- }
-
- @Override
- public void init() {
- super.init();
-
- getReceiver().setFormat(getSender().getFormat());
- getReceiver().setMinFractionDigits(getSender().getMinFractionDigits());
- getReceiver().setMaxFractionDigits(getSender().getMaxFractionDigits());
- getReceiver().setGroupingUsed(getSender().isGroupingUsed());
- getReceiver().setPercent(getSender().isPercent());
- getReceiver().setMultiplier(getSender().getMultiplier());
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.basic.table.form.fields;
+
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IDoubleColumn;
+import org.eclipse.scout.rt.client.ui.form.fields.doublefield.IDoubleField;
+
+/**
+ * @since 3.9.0
+ */
+public class DoubleColumnFieldPropertyDelegator extends ColumnFieldPropertyDelegator<IDoubleColumn, IDoubleField> {
+
+ public DoubleColumnFieldPropertyDelegator(IDoubleColumn sender, IDoubleField receiver) {
+ super(sender, receiver);
+ }
+
+ @Override
+ public void init() {
+ super.init();
+
+ getReceiver().setFormat(getSender().getFormat());
+ getReceiver().setMinFractionDigits(getSender().getMinFractionDigits());
+ getReceiver().setMaxFractionDigits(getSender().getMaxFractionDigits());
+ getReceiver().setGroupingUsed(getSender().isGroupingUsed());
+ getReceiver().setPercent(getSender().isPercent());
+ getReceiver().setMultiplier(getSender().getMultiplier());
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/IColumnWrapper.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/IColumnWrapper.java
index 334a63658c..6f019bff80 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/IColumnWrapper.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/IColumnWrapper.java
@@ -1,20 +1,20 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.basic.table.form.fields;
-
-import org.eclipse.scout.rt.client.mobile.ui.form.fields.IWrapper;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-
-/**
- * @since 3.9.0
- */
-public interface IColumnWrapper<WRAPPABLE extends IColumn> extends IWrapper<WRAPPABLE> {
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.basic.table.form.fields;
+
+import org.eclipse.scout.rt.client.mobile.ui.form.fields.IWrapper;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+
+/**
+ * @since 3.9.0
+ */
+public interface IColumnWrapper<WRAPPABLE extends IColumn> extends IWrapper<WRAPPABLE> {
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/IntegerColumnField.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/IntegerColumnField.java
index 96248989c9..d3252abefb 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/IntegerColumnField.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/IntegerColumnField.java
@@ -1,39 +1,39 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.basic.table.form.fields;
-
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IIntegerColumn;
-import org.eclipse.scout.rt.client.ui.form.fields.integerfield.AbstractIntegerField;
-
-/**
- * @since 3.9.0
- */
-public class IntegerColumnField extends AbstractIntegerField implements IColumnWrapper<IIntegerColumn> {
- private IntegerColumnFieldPropertyDelegator m_propertyDelegator;
-
- public IntegerColumnField(IIntegerColumn column) {
- super(false);
- m_propertyDelegator = new IntegerColumnFieldPropertyDelegator(column, this);
- callInitializer();
- }
-
- @Override
- protected void initConfig() {
- super.initConfig();
-
- m_propertyDelegator.init();
- }
-
- @Override
- public IIntegerColumn getWrappedObject() {
- return m_propertyDelegator.getSender();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.basic.table.form.fields;
+
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IIntegerColumn;
+import org.eclipse.scout.rt.client.ui.form.fields.integerfield.AbstractIntegerField;
+
+/**
+ * @since 3.9.0
+ */
+public class IntegerColumnField extends AbstractIntegerField implements IColumnWrapper<IIntegerColumn> {
+ private IntegerColumnFieldPropertyDelegator m_propertyDelegator;
+
+ public IntegerColumnField(IIntegerColumn column) {
+ super(false);
+ m_propertyDelegator = new IntegerColumnFieldPropertyDelegator(column, this);
+ callInitializer();
+ }
+
+ @Override
+ protected void initConfig() {
+ super.initConfig();
+
+ m_propertyDelegator.init();
+ }
+
+ @Override
+ public IIntegerColumn getWrappedObject() {
+ return m_propertyDelegator.getSender();
+ }
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/IntegerColumnFieldPropertyDelegator.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/IntegerColumnFieldPropertyDelegator.java
index 484785ff0f..05491958c8 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/IntegerColumnFieldPropertyDelegator.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/IntegerColumnFieldPropertyDelegator.java
@@ -1,33 +1,33 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.basic.table.form.fields;
-
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IIntegerColumn;
-import org.eclipse.scout.rt.client.ui.form.fields.integerfield.IIntegerField;
-
-/**
- * @since 3.9.0
- */
-public class IntegerColumnFieldPropertyDelegator extends ColumnFieldPropertyDelegator<IIntegerColumn, IIntegerField> {
-
- public IntegerColumnFieldPropertyDelegator(IIntegerColumn sender, IIntegerField receiver) {
- super(sender, receiver);
- }
-
- @Override
- public void init() {
- super.init();
-
- getReceiver().setFormat(getSender().getFormat());
- getReceiver().setGroupingUsed(getSender().isGroupingUsed());
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.basic.table.form.fields;
+
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IIntegerColumn;
+import org.eclipse.scout.rt.client.ui.form.fields.integerfield.IIntegerField;
+
+/**
+ * @since 3.9.0
+ */
+public class IntegerColumnFieldPropertyDelegator extends ColumnFieldPropertyDelegator<IIntegerColumn, IIntegerField> {
+
+ public IntegerColumnFieldPropertyDelegator(IIntegerColumn sender, IIntegerField receiver) {
+ super(sender, receiver);
+ }
+
+ @Override
+ public void init() {
+ super.init();
+
+ getReceiver().setFormat(getSender().getFormat());
+ getReceiver().setGroupingUsed(getSender().isGroupingUsed());
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/LongColumnField.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/LongColumnField.java
index 43524038b6..70b94019af 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/LongColumnField.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/LongColumnField.java
@@ -1,39 +1,39 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.basic.table.form.fields;
-
-import org.eclipse.scout.rt.client.ui.basic.table.columns.ILongColumn;
-import org.eclipse.scout.rt.client.ui.form.fields.longfield.AbstractLongField;
-
-/**
- * @since 3.9.0
- */
-public class LongColumnField extends AbstractLongField implements IColumnWrapper<ILongColumn> {
- private LongColumnFieldPropertyDelegator m_propertyDelegator;
-
- public LongColumnField(ILongColumn column) {
- super(false);
- m_propertyDelegator = new LongColumnFieldPropertyDelegator(column, this);
- callInitializer();
- }
-
- @Override
- protected void initConfig() {
- super.initConfig();
-
- m_propertyDelegator.init();
- }
-
- @Override
- public ILongColumn getWrappedObject() {
- return m_propertyDelegator.getSender();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.basic.table.form.fields;
+
+import org.eclipse.scout.rt.client.ui.basic.table.columns.ILongColumn;
+import org.eclipse.scout.rt.client.ui.form.fields.longfield.AbstractLongField;
+
+/**
+ * @since 3.9.0
+ */
+public class LongColumnField extends AbstractLongField implements IColumnWrapper<ILongColumn> {
+ private LongColumnFieldPropertyDelegator m_propertyDelegator;
+
+ public LongColumnField(ILongColumn column) {
+ super(false);
+ m_propertyDelegator = new LongColumnFieldPropertyDelegator(column, this);
+ callInitializer();
+ }
+
+ @Override
+ protected void initConfig() {
+ super.initConfig();
+
+ m_propertyDelegator.init();
+ }
+
+ @Override
+ public ILongColumn getWrappedObject() {
+ return m_propertyDelegator.getSender();
+ }
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/LongColumnFieldPropertyDelegator.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/LongColumnFieldPropertyDelegator.java
index f8157780af..9882b78f1c 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/LongColumnFieldPropertyDelegator.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/LongColumnFieldPropertyDelegator.java
@@ -1,33 +1,33 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.basic.table.form.fields;
-
-import org.eclipse.scout.rt.client.ui.basic.table.columns.ILongColumn;
-import org.eclipse.scout.rt.client.ui.form.fields.longfield.ILongField;
-
-/**
- * @since 3.9.0
- */
-public class LongColumnFieldPropertyDelegator extends ColumnFieldPropertyDelegator<ILongColumn, ILongField> {
-
- public LongColumnFieldPropertyDelegator(ILongColumn sender, ILongField receiver) {
- super(sender, receiver);
- }
-
- @Override
- public void init() {
- super.init();
-
- getReceiver().setFormat(getSender().getFormat());
- getReceiver().setGroupingUsed(getSender().isGroupingUsed());
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.basic.table.form.fields;
+
+import org.eclipse.scout.rt.client.ui.basic.table.columns.ILongColumn;
+import org.eclipse.scout.rt.client.ui.form.fields.longfield.ILongField;
+
+/**
+ * @since 3.9.0
+ */
+public class LongColumnFieldPropertyDelegator extends ColumnFieldPropertyDelegator<ILongColumn, ILongField> {
+
+ public LongColumnFieldPropertyDelegator(ILongColumn sender, ILongField receiver) {
+ super(sender, receiver);
+ }
+
+ @Override
+ public void init() {
+ super.init();
+
+ getReceiver().setFormat(getSender().getFormat());
+ getReceiver().setGroupingUsed(getSender().isGroupingUsed());
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/SmartColumnField.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/SmartColumnField.java
index 79348f22fe..a60ef04ea5 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/SmartColumnField.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/SmartColumnField.java
@@ -1,44 +1,44 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.basic.table.form.fields;
-
-import org.eclipse.scout.rt.client.ui.basic.table.columns.ISmartColumn;
-import org.eclipse.scout.rt.client.ui.form.fields.smartfield.AbstractSmartField;
-
-/**
- * @since 3.9.0
- */
-public class SmartColumnField<T> extends AbstractSmartField<T> implements IColumnWrapper<ISmartColumn<T>> {
- private SmartColumnFieldPropertyDelegator<T> m_propertyDelegator;
-
- public SmartColumnField(ISmartColumn<T> column) {
- super(false);
- m_propertyDelegator = new SmartColumnFieldPropertyDelegator<T>(column, this);
- callInitializer();
- }
-
- @Override
- protected void initConfig() {
- super.initConfig();
-
- m_propertyDelegator.init();
- }
-
- @Override
- public ISmartColumn<T> getWrappedObject() {
- return m_propertyDelegator.getSender();
- }
-
- @Override
- public Class<T> getHolderType() {
- return getWrappedObject().getDataType();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.basic.table.form.fields;
+
+import org.eclipse.scout.rt.client.ui.basic.table.columns.ISmartColumn;
+import org.eclipse.scout.rt.client.ui.form.fields.smartfield.AbstractSmartField;
+
+/**
+ * @since 3.9.0
+ */
+public class SmartColumnField<T> extends AbstractSmartField<T> implements IColumnWrapper<ISmartColumn<T>> {
+ private SmartColumnFieldPropertyDelegator<T> m_propertyDelegator;
+
+ public SmartColumnField(ISmartColumn<T> column) {
+ super(false);
+ m_propertyDelegator = new SmartColumnFieldPropertyDelegator<T>(column, this);
+ callInitializer();
+ }
+
+ @Override
+ protected void initConfig() {
+ super.initConfig();
+
+ m_propertyDelegator.init();
+ }
+
+ @Override
+ public ISmartColumn<T> getWrappedObject() {
+ return m_propertyDelegator.getSender();
+ }
+
+ @Override
+ public Class<T> getHolderType() {
+ return getWrappedObject().getDataType();
+ }
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/SmartColumnFieldPropertyDelegator.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/SmartColumnFieldPropertyDelegator.java
index fe3103b998..108e98a7d5 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/SmartColumnFieldPropertyDelegator.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/SmartColumnFieldPropertyDelegator.java
@@ -1,33 +1,33 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.basic.table.form.fields;
-
-import org.eclipse.scout.rt.client.ui.basic.table.columns.ISmartColumn;
-import org.eclipse.scout.rt.client.ui.form.fields.smartfield.ISmartField;
-
-/**
- * @since 3.9.0
- */
-public class SmartColumnFieldPropertyDelegator<T> extends ColumnFieldPropertyDelegator<ISmartColumn<T>, ISmartField<T>> {
-
- public SmartColumnFieldPropertyDelegator(ISmartColumn<T> sender, ISmartField<T> receiver) {
- super(sender, receiver);
- }
-
- @Override
- public void init() {
- super.init();
-
- getReceiver().setCodeTypeClass(getSender().getCodeTypeClass());
- getReceiver().setLookupCall(getSender().getLookupCall());
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.basic.table.form.fields;
+
+import org.eclipse.scout.rt.client.ui.basic.table.columns.ISmartColumn;
+import org.eclipse.scout.rt.client.ui.form.fields.smartfield.ISmartField;
+
+/**
+ * @since 3.9.0
+ */
+public class SmartColumnFieldPropertyDelegator<T> extends ColumnFieldPropertyDelegator<ISmartColumn<T>, ISmartField<T>> {
+
+ public SmartColumnFieldPropertyDelegator(ISmartColumn<T> sender, ISmartField<T> receiver) {
+ super(sender, receiver);
+ }
+
+ @Override
+ public void init() {
+ super.init();
+
+ getReceiver().setCodeTypeClass(getSender().getCodeTypeClass());
+ getReceiver().setLookupCall(getSender().getLookupCall());
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/StringColumnField.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/StringColumnField.java
index d69a41a43d..da75eddb9b 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/StringColumnField.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/StringColumnField.java
@@ -1,50 +1,50 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.basic.table.form.fields;
-
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IStringColumn;
-import org.eclipse.scout.rt.client.ui.form.fields.stringfield.AbstractStringField;
-
-/**
- * @since 3.9.0
- */
-public class StringColumnField extends AbstractStringField implements IColumnWrapper<IStringColumn> {
- private StringColumnFieldPropertyDelegator m_propertyDelegator;
-
- public StringColumnField(IStringColumn column) {
- super(false);
- m_propertyDelegator = new StringColumnFieldPropertyDelegator(column, this);
- callInitializer();
- }
-
- @Override
- protected void initConfig() {
- super.initConfig();
-
- m_propertyDelegator.init();
- }
-
- @Override
- public IStringColumn getWrappedObject() {
- return m_propertyDelegator.getSender();
- }
-
- @Override
- protected int getConfiguredGridH() {
- //If text wrap is set to true the field typically contains a lot of information.
- //Therefore make it bigger so the user can read it.
- if (getWrappedObject().isTextWrap()) {
- return 2;
- }
-
- return super.getConfiguredGridH();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.basic.table.form.fields;
+
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IStringColumn;
+import org.eclipse.scout.rt.client.ui.form.fields.stringfield.AbstractStringField;
+
+/**
+ * @since 3.9.0
+ */
+public class StringColumnField extends AbstractStringField implements IColumnWrapper<IStringColumn> {
+ private StringColumnFieldPropertyDelegator m_propertyDelegator;
+
+ public StringColumnField(IStringColumn column) {
+ super(false);
+ m_propertyDelegator = new StringColumnFieldPropertyDelegator(column, this);
+ callInitializer();
+ }
+
+ @Override
+ protected void initConfig() {
+ super.initConfig();
+
+ m_propertyDelegator.init();
+ }
+
+ @Override
+ public IStringColumn getWrappedObject() {
+ return m_propertyDelegator.getSender();
+ }
+
+ @Override
+ protected int getConfiguredGridH() {
+ //If text wrap is set to true the field typically contains a lot of information.
+ //Therefore make it bigger so the user can read it.
+ if (getWrappedObject().isTextWrap()) {
+ return 2;
+ }
+
+ return super.getConfiguredGridH();
+ }
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/StringColumnFieldPropertyDelegator.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/StringColumnFieldPropertyDelegator.java
index 5f9e557b03..90218357d0 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/StringColumnFieldPropertyDelegator.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/basic/table/form/fields/StringColumnFieldPropertyDelegator.java
@@ -1,38 +1,38 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.basic.table.form.fields;
-
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IStringColumn;
-import org.eclipse.scout.rt.client.ui.form.fields.stringfield.IStringField;
-
-/**
- * @since 3.9.0
- */
-public class StringColumnFieldPropertyDelegator extends ColumnFieldPropertyDelegator<IStringColumn, IStringField> {
-
- public StringColumnFieldPropertyDelegator(IStringColumn sender, IStringField receiver) {
- super(sender, receiver);
- }
-
- @Override
- public void init() {
- super.init();
-
- getReceiver().setInputMasked(getSender().isInputMasked());
- getReceiver().setFormat(getSender().getDisplayFormat());
- getReceiver().setWrapText(getSender().isTextWrap());
- if (getSender().isTextWrap()) {
- //Text wrap typically only works if multiline is enabled
- getReceiver().setMultilineText(true);
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.basic.table.form.fields;
+
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IStringColumn;
+import org.eclipse.scout.rt.client.ui.form.fields.stringfield.IStringField;
+
+/**
+ * @since 3.9.0
+ */
+public class StringColumnFieldPropertyDelegator extends ColumnFieldPropertyDelegator<IStringColumn, IStringField> {
+
+ public StringColumnFieldPropertyDelegator(IStringColumn sender, IStringField receiver) {
+ super(sender, receiver);
+ }
+
+ @Override
+ public void init() {
+ super.init();
+
+ getReceiver().setInputMasked(getSender().isInputMasked());
+ getReceiver().setFormat(getSender().getDisplayFormat());
+ getReceiver().setWrapText(getSender().isTextWrap());
+ if (getSender().isTextWrap()) {
+ //Text wrap typically only works if multiline is enabled
+ getReceiver().setMultilineText(true);
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/desktop/ActiveOutlineObserver.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/desktop/ActiveOutlineObserver.java
index 91b8c893dd..68fe9bbeef 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/desktop/ActiveOutlineObserver.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/desktop/ActiveOutlineObserver.java
@@ -1,207 +1,207 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.desktop;
-
-import java.beans.PropertyChangeListener;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.ui.basic.tree.TreeListener;
-import org.eclipse.scout.rt.client.ui.desktop.DesktopEvent;
-import org.eclipse.scout.rt.client.ui.desktop.DesktopListener;
-import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
-
-/**
- * @since 3.9.0
- */
-public class ActiveOutlineObserver {
- private IOutline m_activeOutline;
- private IDesktop m_desktop;
- private P_DesktopListener m_desktopListener;
- private Set<TreeListener> m_outlineTreeListeners;
- private Set<TreeListener> m_outlineUITreeListeners;
- private Set<PropertyChangeListener> m_outlinePropertyChangeListeners;
-
- public ActiveOutlineObserver() {
- this(null);
- }
-
- public ActiveOutlineObserver(IDesktop desktop) {
- if (desktop == null) {
- desktop = ClientSyncJob.getCurrentSession().getDesktop();
- }
- m_desktop = desktop;
- if (m_desktop == null) {
- throw new IllegalArgumentException("No desktop found. Cannot create ActiveOutlineObserver.");
- }
-
- m_activeOutline = desktop.getOutline();
- m_outlineTreeListeners = new HashSet<TreeListener>();
- m_outlineUITreeListeners = new HashSet<TreeListener>();
- m_outlinePropertyChangeListeners = new HashSet<PropertyChangeListener>();
- m_desktopListener = new P_DesktopListener();
- desktop.addDesktopListener(m_desktopListener);
- }
-
- public IDesktop getDesktop() {
- return m_desktop;
- }
-
- public IOutline getActiveOutline() {
- return m_activeOutline;
- }
-
- private void destroy() {
- if (m_desktopListener != null) {
- getDesktop().removeDesktopListener(m_desktopListener);
- m_desktopListener = null;
- }
-
- removeAllListeners(m_activeOutline);
- m_outlineTreeListeners.clear();
- m_outlineUITreeListeners.clear();
- m_outlinePropertyChangeListeners.clear();
- }
-
- public void addOutlineTreeListener(TreeListener treeListener) {
- if (treeListener == null) {
- return;
- }
-
- if (m_activeOutline != null) {
- m_activeOutline.addTreeListener(treeListener);
- }
- m_outlineTreeListeners.add(treeListener);
- }
-
- public void addOutlineUITreeListener(TreeListener treeListener) {
- if (treeListener == null) {
- return;
- }
-
- if (m_activeOutline != null) {
- m_activeOutline.addTreeListener(treeListener);
- }
- m_outlineUITreeListeners.add(treeListener);
- }
-
- public void addOutlinePropertyChangeListener(PropertyChangeListener propertyChangeListener) {
- if (propertyChangeListener == null) {
- return;
- }
-
- if (m_activeOutline != null) {
- m_activeOutline.addPropertyChangeListener(propertyChangeListener);
- }
- m_outlinePropertyChangeListeners.add(propertyChangeListener);
- }
-
- public void removeOutlineTreeListener(TreeListener treeListener) {
- if (treeListener == null) {
- return;
- }
-
- if (m_activeOutline != null) {
- m_activeOutline.removeTreeListener(treeListener);
- }
- m_outlineTreeListeners.remove(treeListener);
- }
-
- public void removeOutlineUITreeListener(TreeListener treeListener) {
- if (treeListener == null) {
- return;
- }
-
- if (m_activeOutline != null) {
- m_activeOutline.removeTreeListener(treeListener);
- }
- m_outlineUITreeListeners.remove(treeListener);
- }
-
- public void removeOutlinePropertyChangeListener(PropertyChangeListener propertyChangeListener) {
- if (propertyChangeListener == null) {
- return;
- }
-
- if (m_activeOutline != null) {
- m_activeOutline.removePropertyChangeListener(propertyChangeListener);
- }
- m_outlinePropertyChangeListeners.remove(propertyChangeListener);
- }
-
- private void removeAllListeners(IOutline outline) {
- if (outline == null) {
- return;
- }
-
- for (TreeListener treeListener : m_outlineTreeListeners) {
- outline.removeTreeListener(treeListener);
- }
- for (TreeListener treeListener : m_outlineUITreeListeners) {
- outline.removeTreeListener(treeListener);
- }
- for (PropertyChangeListener propertyChangeListener : m_outlinePropertyChangeListeners) {
- outline.removePropertyChangeListener(propertyChangeListener);
- }
- }
-
- private void addAllListeners(IOutline outline) {
- if (outline == null) {
- return;
- }
-
- for (TreeListener treeListener : m_outlineTreeListeners) {
- outline.addTreeListener(treeListener);
- }
- for (TreeListener treeListener : m_outlineUITreeListeners) {
- outline.addUITreeListener(treeListener);
- }
- for (PropertyChangeListener propertyChangeListener : m_outlinePropertyChangeListeners) {
- outline.addPropertyChangeListener(propertyChangeListener);
- }
- }
-
- private class P_DesktopListener implements DesktopListener {
-
- @Override
- public void desktopChanged(DesktopEvent e) {
-
- switch (e.getType()) {
- case DesktopEvent.TYPE_DESKTOP_CLOSED: {
- destroy();
- break;
- }
- case DesktopEvent.TYPE_OUTLINE_CHANGED: {
- handleOutlineChanged(e);
- break;
- }
- default:
- break;
- }
- }
-
- private void handleOutlineChanged(DesktopEvent e) {
- IOutline outline = e.getOutline();
-
- if (m_activeOutline != null) {
- removeAllListeners(m_activeOutline);
- }
-
- if (outline != null) {
- addAllListeners(outline);
- }
-
- m_activeOutline = outline;
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.desktop;
+
+import java.beans.PropertyChangeListener;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.ui.basic.tree.TreeListener;
+import org.eclipse.scout.rt.client.ui.desktop.DesktopEvent;
+import org.eclipse.scout.rt.client.ui.desktop.DesktopListener;
+import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
+
+/**
+ * @since 3.9.0
+ */
+public class ActiveOutlineObserver {
+ private IOutline m_activeOutline;
+ private IDesktop m_desktop;
+ private P_DesktopListener m_desktopListener;
+ private Set<TreeListener> m_outlineTreeListeners;
+ private Set<TreeListener> m_outlineUITreeListeners;
+ private Set<PropertyChangeListener> m_outlinePropertyChangeListeners;
+
+ public ActiveOutlineObserver() {
+ this(null);
+ }
+
+ public ActiveOutlineObserver(IDesktop desktop) {
+ if (desktop == null) {
+ desktop = ClientSyncJob.getCurrentSession().getDesktop();
+ }
+ m_desktop = desktop;
+ if (m_desktop == null) {
+ throw new IllegalArgumentException("No desktop found. Cannot create ActiveOutlineObserver.");
+ }
+
+ m_activeOutline = desktop.getOutline();
+ m_outlineTreeListeners = new HashSet<TreeListener>();
+ m_outlineUITreeListeners = new HashSet<TreeListener>();
+ m_outlinePropertyChangeListeners = new HashSet<PropertyChangeListener>();
+ m_desktopListener = new P_DesktopListener();
+ desktop.addDesktopListener(m_desktopListener);
+ }
+
+ public IDesktop getDesktop() {
+ return m_desktop;
+ }
+
+ public IOutline getActiveOutline() {
+ return m_activeOutline;
+ }
+
+ private void destroy() {
+ if (m_desktopListener != null) {
+ getDesktop().removeDesktopListener(m_desktopListener);
+ m_desktopListener = null;
+ }
+
+ removeAllListeners(m_activeOutline);
+ m_outlineTreeListeners.clear();
+ m_outlineUITreeListeners.clear();
+ m_outlinePropertyChangeListeners.clear();
+ }
+
+ public void addOutlineTreeListener(TreeListener treeListener) {
+ if (treeListener == null) {
+ return;
+ }
+
+ if (m_activeOutline != null) {
+ m_activeOutline.addTreeListener(treeListener);
+ }
+ m_outlineTreeListeners.add(treeListener);
+ }
+
+ public void addOutlineUITreeListener(TreeListener treeListener) {
+ if (treeListener == null) {
+ return;
+ }
+
+ if (m_activeOutline != null) {
+ m_activeOutline.addTreeListener(treeListener);
+ }
+ m_outlineUITreeListeners.add(treeListener);
+ }
+
+ public void addOutlinePropertyChangeListener(PropertyChangeListener propertyChangeListener) {
+ if (propertyChangeListener == null) {
+ return;
+ }
+
+ if (m_activeOutline != null) {
+ m_activeOutline.addPropertyChangeListener(propertyChangeListener);
+ }
+ m_outlinePropertyChangeListeners.add(propertyChangeListener);
+ }
+
+ public void removeOutlineTreeListener(TreeListener treeListener) {
+ if (treeListener == null) {
+ return;
+ }
+
+ if (m_activeOutline != null) {
+ m_activeOutline.removeTreeListener(treeListener);
+ }
+ m_outlineTreeListeners.remove(treeListener);
+ }
+
+ public void removeOutlineUITreeListener(TreeListener treeListener) {
+ if (treeListener == null) {
+ return;
+ }
+
+ if (m_activeOutline != null) {
+ m_activeOutline.removeTreeListener(treeListener);
+ }
+ m_outlineUITreeListeners.remove(treeListener);
+ }
+
+ public void removeOutlinePropertyChangeListener(PropertyChangeListener propertyChangeListener) {
+ if (propertyChangeListener == null) {
+ return;
+ }
+
+ if (m_activeOutline != null) {
+ m_activeOutline.removePropertyChangeListener(propertyChangeListener);
+ }
+ m_outlinePropertyChangeListeners.remove(propertyChangeListener);
+ }
+
+ private void removeAllListeners(IOutline outline) {
+ if (outline == null) {
+ return;
+ }
+
+ for (TreeListener treeListener : m_outlineTreeListeners) {
+ outline.removeTreeListener(treeListener);
+ }
+ for (TreeListener treeListener : m_outlineUITreeListeners) {
+ outline.removeTreeListener(treeListener);
+ }
+ for (PropertyChangeListener propertyChangeListener : m_outlinePropertyChangeListeners) {
+ outline.removePropertyChangeListener(propertyChangeListener);
+ }
+ }
+
+ private void addAllListeners(IOutline outline) {
+ if (outline == null) {
+ return;
+ }
+
+ for (TreeListener treeListener : m_outlineTreeListeners) {
+ outline.addTreeListener(treeListener);
+ }
+ for (TreeListener treeListener : m_outlineUITreeListeners) {
+ outline.addUITreeListener(treeListener);
+ }
+ for (PropertyChangeListener propertyChangeListener : m_outlinePropertyChangeListeners) {
+ outline.addPropertyChangeListener(propertyChangeListener);
+ }
+ }
+
+ private class P_DesktopListener implements DesktopListener {
+
+ @Override
+ public void desktopChanged(DesktopEvent e) {
+
+ switch (e.getType()) {
+ case DesktopEvent.TYPE_DESKTOP_CLOSED: {
+ destroy();
+ break;
+ }
+ case DesktopEvent.TYPE_OUTLINE_CHANGED: {
+ handleOutlineChanged(e);
+ break;
+ }
+ default:
+ break;
+ }
+ }
+
+ private void handleOutlineChanged(DesktopEvent e) {
+ IOutline outline = e.getOutline();
+
+ if (m_activeOutline != null) {
+ removeAllListeners(m_activeOutline);
+ }
+
+ if (outline != null) {
+ addAllListeners(outline);
+ }
+
+ m_activeOutline = outline;
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/desktop/DeviceTransformationDesktopExtension.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/desktop/DeviceTransformationDesktopExtension.java
index 986d9c169f..5e1200edbc 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/desktop/DeviceTransformationDesktopExtension.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/desktop/DeviceTransformationDesktopExtension.java
@@ -1,191 +1,191 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.desktop;
-
-import java.util.Collection;
-
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.holders.IHolder;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ClientJob;
-import org.eclipse.scout.rt.client.mobile.navigation.AbstractMobileBackAction;
-import org.eclipse.scout.rt.client.mobile.navigation.AbstractMobileHomeAction;
-import org.eclipse.scout.rt.client.mobile.transformation.IDeviceTransformationService;
-import org.eclipse.scout.rt.client.mobile.transformation.IDeviceTransformer;
-import org.eclipse.scout.rt.client.ui.action.IAction;
-import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.desktop.AbstractDesktopExtension;
-import org.eclipse.scout.rt.client.ui.desktop.ContributionCommand;
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.shared.TEXTS;
-import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
-import org.eclipse.scout.rt.shared.ui.UserAgentUtility;
-import org.eclipse.scout.service.SERVICES;
-
-public class DeviceTransformationDesktopExtension extends AbstractDesktopExtension {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(DeviceTransformationDesktopExtension.class);
-
- private boolean m_active;
- private IDeviceTransformer m_deviceTransformer;
-
- public DeviceTransformationDesktopExtension() {
- setActive(UserAgentUtility.isTouchDevice());
- }
-
- public boolean isActive() {
- return m_active;
- }
-
- public void setActive(boolean active) {
- m_active = active;
- }
-
- public IDeviceTransformer getDeviceTransformer() {
- if (m_deviceTransformer == null) {
- m_deviceTransformer = SERVICES.getService(IDeviceTransformationService.class).getDeviceTransformer(getCoreDesktop());
- }
-
- return m_deviceTransformer;
- }
-
- @Override
- protected ContributionCommand execInit() throws ProcessingException {
- if (!isActive()) {
- return super.execInit();
- }
-
- //Create transformer
- getDeviceTransformer();
-
- return ContributionCommand.Continue;
- }
-
- @Override
- public void contributeActions(Collection<IAction> actions) {
- if (!isActive()) {
- return;
- }
-
- getDeviceTransformer().adaptDesktopActions(actions);
-
- super.contributeActions(actions);
- }
-
- @Override
- protected ContributionCommand execOutlineChanged(IOutline oldOutline, IOutline newOutline) throws ProcessingException {
- if (!isActive()) {
- return super.execOutlineChanged(oldOutline, newOutline);
- }
-
- getDeviceTransformer().transformOutline(newOutline);
-
- return ContributionCommand.Continue;
- }
-
- @Override
- protected ContributionCommand execPageDetailTableChanged(ITable oldTable, ITable newTable) throws ProcessingException {
- if (!isActive()) {
- return super.execPageDetailTableChanged(oldTable, newTable);
- }
-
- getDeviceTransformer().transformPageDetailTable(newTable);
-
- return ContributionCommand.Continue;
- }
-
- @Override
- protected ContributionCommand execCustomFormModification(IHolder<IForm> formHolder) {
- if (!isActive()) {
- return super.execCustomFormModification(formHolder);
- }
-
- IForm form = formHolder.getValue();
- if (form == null) {
- return ContributionCommand.Stop;
- }
-
- try {
- getDeviceTransformer().transformForm(form);
- }
- catch (ProcessingException e) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
-
- //FIXME CGU separate into acceptTransformation and acceptAdditionToDesktop
- if (!getDeviceTransformer().acceptForm(form)) {
- formHolder.setValue(null);
- return ContributionCommand.Stop;
- }
-
- return ContributionCommand.Continue;
- }
-
- @Override
- protected ContributionCommand execTablePageLoaded(IPageWithTable<?> tablePage) throws ProcessingException {
- if (!isActive()) {
- return super.execTablePageLoaded(tablePage);
- }
-
- getDeviceTransformer().tablePageLoaded(tablePage);
-
- return ContributionCommand.Continue;
- }
-
- @Order(10)
- public class BackAction extends AbstractMobileBackAction {
-
- @Override
- protected boolean getConfiguredVisible() {
- return false;
- }
-
- }
-
- @Order(20)
- public class HomeAction extends AbstractMobileHomeAction {
-
- @Override
- protected boolean getConfiguredVisible() {
- return false;
- }
-
- }
-
- @Order(30.0)
- public class LogoutMenu extends AbstractMenu {
-
- @Override
- protected boolean getConfiguredSingleSelectionAction() {
- return true;
- }
-
- @Override
- protected String getConfiguredText() {
- return TEXTS.get("Logoff");
- }
-
- @Override
- protected boolean getConfiguredVisible() {
- return false;
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- ClientJob.getCurrentSession().stopSession();
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.desktop;
+
+import java.util.Collection;
+
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.holders.IHolder;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ClientJob;
+import org.eclipse.scout.rt.client.mobile.navigation.AbstractMobileBackAction;
+import org.eclipse.scout.rt.client.mobile.navigation.AbstractMobileHomeAction;
+import org.eclipse.scout.rt.client.mobile.transformation.IDeviceTransformationService;
+import org.eclipse.scout.rt.client.mobile.transformation.IDeviceTransformer;
+import org.eclipse.scout.rt.client.ui.action.IAction;
+import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.desktop.AbstractDesktopExtension;
+import org.eclipse.scout.rt.client.ui.desktop.ContributionCommand;
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.shared.TEXTS;
+import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
+import org.eclipse.scout.rt.shared.ui.UserAgentUtility;
+import org.eclipse.scout.service.SERVICES;
+
+public class DeviceTransformationDesktopExtension extends AbstractDesktopExtension {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(DeviceTransformationDesktopExtension.class);
+
+ private boolean m_active;
+ private IDeviceTransformer m_deviceTransformer;
+
+ public DeviceTransformationDesktopExtension() {
+ setActive(UserAgentUtility.isTouchDevice());
+ }
+
+ public boolean isActive() {
+ return m_active;
+ }
+
+ public void setActive(boolean active) {
+ m_active = active;
+ }
+
+ public IDeviceTransformer getDeviceTransformer() {
+ if (m_deviceTransformer == null) {
+ m_deviceTransformer = SERVICES.getService(IDeviceTransformationService.class).getDeviceTransformer(getCoreDesktop());
+ }
+
+ return m_deviceTransformer;
+ }
+
+ @Override
+ protected ContributionCommand execInit() throws ProcessingException {
+ if (!isActive()) {
+ return super.execInit();
+ }
+
+ //Create transformer
+ getDeviceTransformer();
+
+ return ContributionCommand.Continue;
+ }
+
+ @Override
+ public void contributeActions(Collection<IAction> actions) {
+ if (!isActive()) {
+ return;
+ }
+
+ getDeviceTransformer().adaptDesktopActions(actions);
+
+ super.contributeActions(actions);
+ }
+
+ @Override
+ protected ContributionCommand execOutlineChanged(IOutline oldOutline, IOutline newOutline) throws ProcessingException {
+ if (!isActive()) {
+ return super.execOutlineChanged(oldOutline, newOutline);
+ }
+
+ getDeviceTransformer().transformOutline(newOutline);
+
+ return ContributionCommand.Continue;
+ }
+
+ @Override
+ protected ContributionCommand execPageDetailTableChanged(ITable oldTable, ITable newTable) throws ProcessingException {
+ if (!isActive()) {
+ return super.execPageDetailTableChanged(oldTable, newTable);
+ }
+
+ getDeviceTransformer().transformPageDetailTable(newTable);
+
+ return ContributionCommand.Continue;
+ }
+
+ @Override
+ protected ContributionCommand execCustomFormModification(IHolder<IForm> formHolder) {
+ if (!isActive()) {
+ return super.execCustomFormModification(formHolder);
+ }
+
+ IForm form = formHolder.getValue();
+ if (form == null) {
+ return ContributionCommand.Stop;
+ }
+
+ try {
+ getDeviceTransformer().transformForm(form);
+ }
+ catch (ProcessingException e) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+
+ //FIXME CGU separate into acceptTransformation and acceptAdditionToDesktop
+ if (!getDeviceTransformer().acceptForm(form)) {
+ formHolder.setValue(null);
+ return ContributionCommand.Stop;
+ }
+
+ return ContributionCommand.Continue;
+ }
+
+ @Override
+ protected ContributionCommand execTablePageLoaded(IPageWithTable<?> tablePage) throws ProcessingException {
+ if (!isActive()) {
+ return super.execTablePageLoaded(tablePage);
+ }
+
+ getDeviceTransformer().tablePageLoaded(tablePage);
+
+ return ContributionCommand.Continue;
+ }
+
+ @Order(10)
+ public class BackAction extends AbstractMobileBackAction {
+
+ @Override
+ protected boolean getConfiguredVisible() {
+ return false;
+ }
+
+ }
+
+ @Order(20)
+ public class HomeAction extends AbstractMobileHomeAction {
+
+ @Override
+ protected boolean getConfiguredVisible() {
+ return false;
+ }
+
+ }
+
+ @Order(30.0)
+ public class LogoutMenu extends AbstractMenu {
+
+ @Override
+ protected boolean getConfiguredSingleSelectionAction() {
+ return true;
+ }
+
+ @Override
+ protected String getConfiguredText() {
+ return TEXTS.get("Logoff");
+ }
+
+ @Override
+ protected boolean getConfiguredVisible() {
+ return false;
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ ClientJob.getCurrentSession().stopSession();
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/desktop/MobileDesktopUtility.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/desktop/MobileDesktopUtility.java
index 13c832770e..8a98d32cb4 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/desktop/MobileDesktopUtility.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/desktop/MobileDesktopUtility.java
@@ -1,225 +1,225 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.desktop;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ClientJob;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.ui.action.tool.IToolButton;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
-import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
-import org.eclipse.scout.rt.client.ui.desktop.outline.AbstractFormToolButton;
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutlineTableForm;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithNodes;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.client.ui.form.fields.GridData;
-
-/**
- * @since 3.9.0
- */
-public class MobileDesktopUtility {
-
- public static void activateOutline(IOutline outline) {
- IDesktop desktop = ClientJob.getCurrentSession().getDesktop();
- desktop.setOutlineTableFormVisible(true);
-
- if (desktop.getOutline() != outline) {
- desktop.setOutline(outline);
- }
-
- if (!outline.isRootNodeVisible()) {
- throw new IllegalStateException("Root node must be visible for this drill down approach.");
- }
-
- if (outline.getSelectedNode() == null) {
- outline.selectNode(outline.getRootPage());
- }
- }
-
- public static boolean isToolForm(IForm form) {
- if (getToolButtonFor(form) != null) {
- return true;
- }
-
- return false;
- }
-
- public static IToolButton getToolButtonFor(IForm form) {
- for (IToolButton toolButton : getDesktop().getToolButtons()) {
- if (toolButton instanceof AbstractFormToolButton) {
- IForm toolForm = ((AbstractFormToolButton) toolButton).getForm();
- if (form == toolForm) {
- return toolButton;
- }
- }
- }
-
- return null;
- }
-
- public static void openToolForm(IForm form) {
- IToolButton toolButton = getToolButtonFor(form);
- if (toolButton != null) {
- toolButton.setSelected(true);
- }
- //Double check to make sure it really will be added
- if (!getDesktop().isShowing(form)) {
- getDesktop().addForm(form);
- }
- }
-
- public static void closeToolForm(IForm form) {
- IToolButton toolButton = getToolButtonFor(form);
- if (toolButton != null) {
- toolButton.setSelected(false);
- }
- //Double check to make sure it really will be removed
- if (getDesktop().isShowing(form)) {
- getDesktop().removeForm(form);
- }
- }
-
- public static void closeAllToolForms() {
- for (IToolButton toolButton : getDesktop().getToolButtons()) {
- if (toolButton.isVisible()) {
- toolButton.setSelected(false);
- }
- }
- }
-
- public static void closeOpenForms() throws ProcessingException {
- final IForm[] viewStack = getDesktop().getViewStack();
- for (IForm form : viewStack) {
- closeForm(form);
- }
- }
-
- public static void closeForm(IForm form) throws ProcessingException {
- if (form == null) {
- return;
- }
-
- if (MobileDesktopUtility.isToolForm(form)) {
- MobileDesktopUtility.closeToolForm(form);
- }
- else if (form.isAutoAddRemoveOnDesktop()) {
- form.doClose();
- }
- else {
- removeFormFromDesktop(form);
- }
- }
-
- public static void removeFormFromDesktop(IForm form) {
- if (form instanceof IOutlineTableForm) {
- getDesktop().setOutlineTableFormVisible(false);
- }
- else {
- getDesktop().removeForm(form);
- }
- }
-
- public static void removeFormsFromDesktop(Class<? extends IForm> formClass, String displayViewId, IForm excludedForm) {
- if (displayViewId == null) {
- return;
- }
-
- IForm[] viewStack = getDesktop().getViewStack();
- for (IForm form : viewStack) {
- if (form != excludedForm && formClass.isInstance(form) && displayViewId.equals(form.getDisplayViewId())) {
- getDesktop().removeForm(form);
- }
- }
- }
-
- public static void addFormToDesktop(IForm form) {
- if (form instanceof IOutlineTableForm) {
- //Make sure the outline table form is linked with the desktop
- getDesktop().setOutlineTableForm((IOutlineTableForm) form);
-
- getDesktop().setOutlineTableFormVisible(true);
- }
- else if (isToolForm(form)) {
- openToolForm(form);
- }
- else {
- getDesktop().addForm(form);
- }
- }
-
- private static IDesktop getDesktop() {
- return ClientSyncJob.getCurrentSession().getDesktop();
- }
-
- public static boolean isAnyViewVisible(String displayViewId) {
- if (displayViewId == null) {
- return false;
- }
-
- IForm[] viewStack = getDesktop().getViewStack();
- for (IForm form : viewStack) {
- if (displayViewId.equals(form.getDisplayViewId())) {
- return true;
- }
- }
-
- return false;
- }
-
- public static void setFormWidthHint(IForm form, int widthHint) {
- GridData gridDataHints = form.getRootGroupBox().getGridDataHints();
- gridDataHints.widthInPixel = widthHint;
- form.getRootGroupBox().setGridDataHints(gridDataHints);
- }
-
- public static ITable getPageTable(IPage page) {
- if (page instanceof IPageWithTable) {
- IPageWithTable tablePage = (IPageWithTable) page;
- return tablePage.getTable();
- }
- else if (page instanceof IPageWithNodes) {
- IPageWithNodes nodePage = (IPageWithNodes) page;
- return nodePage.getInternalTable();
- }
-
- return null;
- }
-
- public static IPage getPageFor(IPage parentPage, ITableRow tableRow) {
- ITreeNode node = null;
- if (parentPage instanceof IPageWithNodes) {
- node = ((IPageWithNodes) parentPage).getTreeNodeFor(tableRow);
- }
- else if (parentPage instanceof IPageWithTable<?>) {
- node = ((IPageWithTable<?>) parentPage).getTreeNodeFor(tableRow);
- }
-
- return (IPage) node;
- }
-
- public static ITableRow getTableRowFor(IPage parentPage, IPage page) {
- ITableRow row = null;
- if (parentPage instanceof IPageWithNodes) {
- row = ((IPageWithNodes) parentPage).getTableRowFor(page);
- }
- else if (parentPage instanceof IPageWithTable<?>) {
- row = ((IPageWithTable) parentPage).getTableRowFor(page);
- }
-
- return row;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.desktop;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ClientJob;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.ui.action.tool.IToolButton;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
+import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
+import org.eclipse.scout.rt.client.ui.desktop.outline.AbstractFormToolButton;
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutlineTableForm;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithNodes;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.client.ui.form.fields.GridData;
+
+/**
+ * @since 3.9.0
+ */
+public class MobileDesktopUtility {
+
+ public static void activateOutline(IOutline outline) {
+ IDesktop desktop = ClientJob.getCurrentSession().getDesktop();
+ desktop.setOutlineTableFormVisible(true);
+
+ if (desktop.getOutline() != outline) {
+ desktop.setOutline(outline);
+ }
+
+ if (!outline.isRootNodeVisible()) {
+ throw new IllegalStateException("Root node must be visible for this drill down approach.");
+ }
+
+ if (outline.getSelectedNode() == null) {
+ outline.selectNode(outline.getRootPage());
+ }
+ }
+
+ public static boolean isToolForm(IForm form) {
+ if (getToolButtonFor(form) != null) {
+ return true;
+ }
+
+ return false;
+ }
+
+ public static IToolButton getToolButtonFor(IForm form) {
+ for (IToolButton toolButton : getDesktop().getToolButtons()) {
+ if (toolButton instanceof AbstractFormToolButton) {
+ IForm toolForm = ((AbstractFormToolButton) toolButton).getForm();
+ if (form == toolForm) {
+ return toolButton;
+ }
+ }
+ }
+
+ return null;
+ }
+
+ public static void openToolForm(IForm form) {
+ IToolButton toolButton = getToolButtonFor(form);
+ if (toolButton != null) {
+ toolButton.setSelected(true);
+ }
+ //Double check to make sure it really will be added
+ if (!getDesktop().isShowing(form)) {
+ getDesktop().addForm(form);
+ }
+ }
+
+ public static void closeToolForm(IForm form) {
+ IToolButton toolButton = getToolButtonFor(form);
+ if (toolButton != null) {
+ toolButton.setSelected(false);
+ }
+ //Double check to make sure it really will be removed
+ if (getDesktop().isShowing(form)) {
+ getDesktop().removeForm(form);
+ }
+ }
+
+ public static void closeAllToolForms() {
+ for (IToolButton toolButton : getDesktop().getToolButtons()) {
+ if (toolButton.isVisible()) {
+ toolButton.setSelected(false);
+ }
+ }
+ }
+
+ public static void closeOpenForms() throws ProcessingException {
+ final IForm[] viewStack = getDesktop().getViewStack();
+ for (IForm form : viewStack) {
+ closeForm(form);
+ }
+ }
+
+ public static void closeForm(IForm form) throws ProcessingException {
+ if (form == null) {
+ return;
+ }
+
+ if (MobileDesktopUtility.isToolForm(form)) {
+ MobileDesktopUtility.closeToolForm(form);
+ }
+ else if (form.isAutoAddRemoveOnDesktop()) {
+ form.doClose();
+ }
+ else {
+ removeFormFromDesktop(form);
+ }
+ }
+
+ public static void removeFormFromDesktop(IForm form) {
+ if (form instanceof IOutlineTableForm) {
+ getDesktop().setOutlineTableFormVisible(false);
+ }
+ else {
+ getDesktop().removeForm(form);
+ }
+ }
+
+ public static void removeFormsFromDesktop(Class<? extends IForm> formClass, String displayViewId, IForm excludedForm) {
+ if (displayViewId == null) {
+ return;
+ }
+
+ IForm[] viewStack = getDesktop().getViewStack();
+ for (IForm form : viewStack) {
+ if (form != excludedForm && formClass.isInstance(form) && displayViewId.equals(form.getDisplayViewId())) {
+ getDesktop().removeForm(form);
+ }
+ }
+ }
+
+ public static void addFormToDesktop(IForm form) {
+ if (form instanceof IOutlineTableForm) {
+ //Make sure the outline table form is linked with the desktop
+ getDesktop().setOutlineTableForm((IOutlineTableForm) form);
+
+ getDesktop().setOutlineTableFormVisible(true);
+ }
+ else if (isToolForm(form)) {
+ openToolForm(form);
+ }
+ else {
+ getDesktop().addForm(form);
+ }
+ }
+
+ private static IDesktop getDesktop() {
+ return ClientSyncJob.getCurrentSession().getDesktop();
+ }
+
+ public static boolean isAnyViewVisible(String displayViewId) {
+ if (displayViewId == null) {
+ return false;
+ }
+
+ IForm[] viewStack = getDesktop().getViewStack();
+ for (IForm form : viewStack) {
+ if (displayViewId.equals(form.getDisplayViewId())) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public static void setFormWidthHint(IForm form, int widthHint) {
+ GridData gridDataHints = form.getRootGroupBox().getGridDataHints();
+ gridDataHints.widthInPixel = widthHint;
+ form.getRootGroupBox().setGridDataHints(gridDataHints);
+ }
+
+ public static ITable getPageTable(IPage page) {
+ if (page instanceof IPageWithTable) {
+ IPageWithTable tablePage = (IPageWithTable) page;
+ return tablePage.getTable();
+ }
+ else if (page instanceof IPageWithNodes) {
+ IPageWithNodes nodePage = (IPageWithNodes) page;
+ return nodePage.getInternalTable();
+ }
+
+ return null;
+ }
+
+ public static IPage getPageFor(IPage parentPage, ITableRow tableRow) {
+ ITreeNode node = null;
+ if (parentPage instanceof IPageWithNodes) {
+ node = ((IPageWithNodes) parentPage).getTreeNodeFor(tableRow);
+ }
+ else if (parentPage instanceof IPageWithTable<?>) {
+ node = ((IPageWithTable<?>) parentPage).getTreeNodeFor(tableRow);
+ }
+
+ return (IPage) node;
+ }
+
+ public static ITableRow getTableRowFor(IPage parentPage, IPage page) {
+ ITableRow row = null;
+ if (parentPage instanceof IPageWithNodes) {
+ row = ((IPageWithNodes) parentPage).getTableRowFor(page);
+ }
+ else if (parentPage instanceof IPageWithTable<?>) {
+ row = ((IPageWithTable) parentPage).getTableRowFor(page);
+ }
+
+ return row;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/desktop/MultiPageChangeStrategy.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/desktop/MultiPageChangeStrategy.java
index 0e5f1527bd..75cadabfe0 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/desktop/MultiPageChangeStrategy.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/desktop/MultiPageChangeStrategy.java
@@ -1,124 +1,124 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.desktop;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.mobile.ui.form.outline.PageFormManager;
-import org.eclipse.scout.rt.client.ui.desktop.outline.DefaultPageChangeStrategy;
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
-import org.eclipse.scout.rt.client.ui.desktop.outline.IPageChangeStrategy;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
-import org.eclipse.scout.service.SERVICES;
-
-/**
- * @since 3.9.0
- */
-public class MultiPageChangeStrategy implements IPageChangeStrategy {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(MultiPageChangeStrategy.class);
-
- private IOutline m_outline;
- private IPage m_mainPage;
- private IPage m_subPage;
- private PageFormManager m_pageFormManager;
- private DefaultPageChangeStrategy m_defaultPageChangeStrategy;
-
- public MultiPageChangeStrategy(PageFormManager pageFormManager) {
- m_defaultPageChangeStrategy = new DefaultPageChangeStrategy();
- m_pageFormManager = pageFormManager;
- }
-
- @Override
- public void pageChanged(IOutline outline, IPage deselectedPage, IPage selectedPage) {
- if (outline == null) {
- return;
- }
-
- if (outline != m_outline) {
- m_mainPage = null;
- m_subPage = null;
- m_outline = outline;
- }
-
- if (selectedPage == null) {
- activateMainPage(deselectedPage, selectedPage);
- }
- else {
- String pageFormSlot = m_pageFormManager.computePageFormSlot(selectedPage);
- if (m_pageFormManager.getLeftPageSlotViewId().equals(pageFormSlot)) {
- activateMainPage(deselectedPage, selectedPage);
- }
- else {
- activateMainPage(deselectedPage, selectedPage.getParentPage());
- activateSubPage(selectedPage);
- }
- }
- }
-
- private void activateMainPage(IPage deselectedPage, IPage selectedPage) {
- if (m_mainPage == selectedPage) {
- return;
- }
- deactivateSubPage();
-
- m_defaultPageChangeStrategy.pageChanged(m_outline, deselectedPage, selectedPage);
- m_mainPage = selectedPage;
-
- LOG.debug("Main page activated: " + selectedPage);
- }
-
- private void activateSubPage(IPage selectedPage) {
- if (m_subPage == selectedPage) {
- return;
- }
- deactivateSubPage();
-
- m_subPage = selectedPage;
- if (m_subPage != null) {
- m_subPage.pageActivatedNotify();
-
- try {
- m_subPage.ensureChildrenLoaded();
- }
- catch (ProcessingException e1) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(e1);
- }
-
- LOG.debug("Sub page activated: " + selectedPage);
- }
- }
-
- private void deactivateSubPage() {
- if (m_subPage == null) {
- return;
- }
-
- m_subPage.pageDeactivatedNotify();
- m_subPage = null;
- }
-
- private boolean isChildOfMainPage(IPage selectedPage) {
- if (selectedPage == null || m_mainPage == null || m_mainPage.getChildNodeCount() == 0) {
- return false;
- }
-
- for (IPage childPage : m_mainPage.getChildPages()) {
- if (selectedPage.equals(childPage)) {
- return true;
- }
- }
-
- return false;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.desktop;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.mobile.ui.form.outline.PageFormManager;
+import org.eclipse.scout.rt.client.ui.desktop.outline.DefaultPageChangeStrategy;
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
+import org.eclipse.scout.rt.client.ui.desktop.outline.IPageChangeStrategy;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
+import org.eclipse.scout.service.SERVICES;
+
+/**
+ * @since 3.9.0
+ */
+public class MultiPageChangeStrategy implements IPageChangeStrategy {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(MultiPageChangeStrategy.class);
+
+ private IOutline m_outline;
+ private IPage m_mainPage;
+ private IPage m_subPage;
+ private PageFormManager m_pageFormManager;
+ private DefaultPageChangeStrategy m_defaultPageChangeStrategy;
+
+ public MultiPageChangeStrategy(PageFormManager pageFormManager) {
+ m_defaultPageChangeStrategy = new DefaultPageChangeStrategy();
+ m_pageFormManager = pageFormManager;
+ }
+
+ @Override
+ public void pageChanged(IOutline outline, IPage deselectedPage, IPage selectedPage) {
+ if (outline == null) {
+ return;
+ }
+
+ if (outline != m_outline) {
+ m_mainPage = null;
+ m_subPage = null;
+ m_outline = outline;
+ }
+
+ if (selectedPage == null) {
+ activateMainPage(deselectedPage, selectedPage);
+ }
+ else {
+ String pageFormSlot = m_pageFormManager.computePageFormSlot(selectedPage);
+ if (m_pageFormManager.getLeftPageSlotViewId().equals(pageFormSlot)) {
+ activateMainPage(deselectedPage, selectedPage);
+ }
+ else {
+ activateMainPage(deselectedPage, selectedPage.getParentPage());
+ activateSubPage(selectedPage);
+ }
+ }
+ }
+
+ private void activateMainPage(IPage deselectedPage, IPage selectedPage) {
+ if (m_mainPage == selectedPage) {
+ return;
+ }
+ deactivateSubPage();
+
+ m_defaultPageChangeStrategy.pageChanged(m_outline, deselectedPage, selectedPage);
+ m_mainPage = selectedPage;
+
+ LOG.debug("Main page activated: " + selectedPage);
+ }
+
+ private void activateSubPage(IPage selectedPage) {
+ if (m_subPage == selectedPage) {
+ return;
+ }
+ deactivateSubPage();
+
+ m_subPage = selectedPage;
+ if (m_subPage != null) {
+ m_subPage.pageActivatedNotify();
+
+ try {
+ m_subPage.ensureChildrenLoaded();
+ }
+ catch (ProcessingException e1) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e1);
+ }
+
+ LOG.debug("Sub page activated: " + selectedPage);
+ }
+ }
+
+ private void deactivateSubPage() {
+ if (m_subPage == null) {
+ return;
+ }
+
+ m_subPage.pageDeactivatedNotify();
+ m_subPage = null;
+ }
+
+ private boolean isChildOfMainPage(IPage selectedPage) {
+ if (selectedPage == null || m_mainPage == null || m_mainPage.getChildNodeCount() == 0) {
+ return false;
+ }
+
+ for (IPage childPage : m_mainPage.getChildPages()) {
+ if (selectedPage.equals(childPage)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/AbstractFormActionFetcher.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/AbstractFormActionFetcher.java
index f3855d0490..520c5c1420 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/AbstractFormActionFetcher.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/AbstractFormActionFetcher.java
@@ -1,43 +1,43 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.form;
-
-import java.util.List;
-
-import org.eclipse.scout.rt.client.mobile.ui.action.ActionButtonBarUtility;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
-
-public abstract class AbstractFormActionFetcher implements IActionFetcher {
- private IForm m_form;
-
- public AbstractFormActionFetcher(IForm form) {
- m_form = form;
- }
-
- public IForm getForm() {
- return m_form;
- }
-
- @Override
- public abstract List<IMenu> fetch();
-
- protected List<IMobileAction> convertCustomProcessButtons() {
- IButton[] customProcessButtons = getForm().getRootGroupBox().getCustomProcessButtons();
- if (customProcessButtons == null || customProcessButtons.length == 0) {
- return null;
- }
-
- return ActionButtonBarUtility.convertButtonsToActions(getForm().getRootGroupBox().getCustomProcessButtons());
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.form;
+
+import java.util.List;
+
+import org.eclipse.scout.rt.client.mobile.ui.action.ActionButtonBarUtility;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
+
+public abstract class AbstractFormActionFetcher implements IActionFetcher {
+ private IForm m_form;
+
+ public AbstractFormActionFetcher(IForm form) {
+ m_form = form;
+ }
+
+ public IForm getForm() {
+ return m_form;
+ }
+
+ @Override
+ public abstract List<IMenu> fetch();
+
+ protected List<IMobileAction> convertCustomProcessButtons() {
+ IButton[] customProcessButtons = getForm().getRootGroupBox().getCustomProcessButtons();
+ if (customProcessButtons == null || customProcessButtons.length == 0) {
+ return null;
+ }
+
+ return ActionButtonBarUtility.convertButtonsToActions(getForm().getRootGroupBox().getCustomProcessButtons());
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/AbstractMobileAction.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/AbstractMobileAction.java
index 7303c0ff2c..c3e5c0de77 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/AbstractMobileAction.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/AbstractMobileAction.java
@@ -1,58 +1,58 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.form;
-
-import org.eclipse.scout.rt.client.ui.action.IAction;
-import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
-
-/**
- * @since 3.9.0
- */
-public class AbstractMobileAction extends AbstractMenu implements IMobileAction {
-
- public AbstractMobileAction() {
- super();
- }
-
- public AbstractMobileAction(boolean callInitializer) {
- super(callInitializer);
- }
-
- @Override
- protected void initConfig() {
- super.initConfig();
-
- setHorizontalAlignment(getConfiguredHorizontalAlignment());
- }
-
- @Override
- public int getHorizontalAlignment() {
- return getHorizontalAlignment(this);
- }
-
- @Override
- public void setHorizontalAlignment(int alignment) {
- setHorizontalAlignment(this, alignment);
- }
-
- public static Integer getHorizontalAlignment(IAction action) {
- return (Integer) action.getProperty(PROP_HORIZONTAL_ALIGNMENT);
- }
-
- public static void setHorizontalAlignment(IAction action, Integer alignment) {
- action.setProperty(PROP_HORIZONTAL_ALIGNMENT, alignment);
- }
-
- protected int getConfiguredHorizontalAlignment() {
- return 1;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.form;
+
+import org.eclipse.scout.rt.client.ui.action.IAction;
+import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
+
+/**
+ * @since 3.9.0
+ */
+public class AbstractMobileAction extends AbstractMenu implements IMobileAction {
+
+ public AbstractMobileAction() {
+ super();
+ }
+
+ public AbstractMobileAction(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ @Override
+ protected void initConfig() {
+ super.initConfig();
+
+ setHorizontalAlignment(getConfiguredHorizontalAlignment());
+ }
+
+ @Override
+ public int getHorizontalAlignment() {
+ return getHorizontalAlignment(this);
+ }
+
+ @Override
+ public void setHorizontalAlignment(int alignment) {
+ setHorizontalAlignment(this, alignment);
+ }
+
+ public static Integer getHorizontalAlignment(IAction action) {
+ return (Integer) action.getProperty(PROP_HORIZONTAL_ALIGNMENT);
+ }
+
+ public static void setHorizontalAlignment(IAction action, Integer alignment) {
+ action.setProperty(PROP_HORIZONTAL_ALIGNMENT, alignment);
+ }
+
+ protected int getConfiguredHorizontalAlignment() {
+ return 1;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/AbstractMobileForm.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/AbstractMobileForm.java
index 9cb60cb67a..3fba9aa090 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/AbstractMobileForm.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/AbstractMobileForm.java
@@ -1,97 +1,97 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.form;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.form.AbstractForm;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-
-/**
- * @since 3.9.0
- */
-public abstract class AbstractMobileForm extends AbstractForm implements IMobileForm {
-
- public AbstractMobileForm() throws ProcessingException {
- this(true);
- }
-
- public AbstractMobileForm(boolean callInitializer) throws ProcessingException {
- super(callInitializer);
- }
-
- @Override
- protected void initConfig() throws ProcessingException {
- super.initConfig();
-
- setFooterVisible(getConfiguredFooterVisible());
- setHeaderActionFetcher(createHeaderActionFetcher());
- setFooterActionFetcher(createFooterActionFetcher());
- }
-
- protected boolean getConfiguredFooterVisible() {
- return false;
- }
-
- @Override
- public boolean isFooterVisible() {
- return propertySupport.getPropertyBool(PROP_FOOTER_VISIBLE);
- }
-
- @Override
- public void setFooterVisible(boolean visible) {
- propertySupport.setPropertyBool(PROP_FOOTER_VISIBLE, visible);
- }
-
- protected IActionFetcher createHeaderActionFetcher() {
- return new FormHeaderActionFetcher(this);
- }
-
- protected IActionFetcher createFooterActionFetcher() {
- return new FormFooterActionFetcher(this);
- }
-
- public static IActionFetcher getHeaderActionFetcher(IForm form) {
- return (IActionFetcher) form.getProperty(IMobileForm.PROP_HEADER_ACTION_FETCHER);
- }
-
- public static void setHeaderActionFetcher(IForm form, IActionFetcher headerActionFetcher) {
- form.setProperty(IMobileForm.PROP_HEADER_ACTION_FETCHER, headerActionFetcher);
- }
-
- @Override
- public IActionFetcher getHeaderActionFetcher() {
- return getHeaderActionFetcher(this);
- }
-
- @Override
- public void setHeaderActionFetcher(IActionFetcher headerActionFetcher) {
- setHeaderActionFetcher(this, headerActionFetcher);
- }
-
- @Override
- public IActionFetcher getFooterActionFetcher() {
- return getFooterActionFetcher(this);
- }
-
- @Override
- public void setFooterActionFetcher(IActionFetcher footerActionFetcher) {
- setFooterActionFetcher(this, footerActionFetcher);
- }
-
- public static IActionFetcher getFooterActionFetcher(IForm form) {
- return (IActionFetcher) form.getProperty(IMobileForm.PROP_FOOTER_ACTION_FETCHER);
- }
-
- public static void setFooterActionFetcher(IForm form, IActionFetcher footerActionFetcher) {
- form.setProperty(IMobileForm.PROP_FOOTER_ACTION_FETCHER, footerActionFetcher);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.form;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.form.AbstractForm;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+
+/**
+ * @since 3.9.0
+ */
+public abstract class AbstractMobileForm extends AbstractForm implements IMobileForm {
+
+ public AbstractMobileForm() throws ProcessingException {
+ this(true);
+ }
+
+ public AbstractMobileForm(boolean callInitializer) throws ProcessingException {
+ super(callInitializer);
+ }
+
+ @Override
+ protected void initConfig() throws ProcessingException {
+ super.initConfig();
+
+ setFooterVisible(getConfiguredFooterVisible());
+ setHeaderActionFetcher(createHeaderActionFetcher());
+ setFooterActionFetcher(createFooterActionFetcher());
+ }
+
+ protected boolean getConfiguredFooterVisible() {
+ return false;
+ }
+
+ @Override
+ public boolean isFooterVisible() {
+ return propertySupport.getPropertyBool(PROP_FOOTER_VISIBLE);
+ }
+
+ @Override
+ public void setFooterVisible(boolean visible) {
+ propertySupport.setPropertyBool(PROP_FOOTER_VISIBLE, visible);
+ }
+
+ protected IActionFetcher createHeaderActionFetcher() {
+ return new FormHeaderActionFetcher(this);
+ }
+
+ protected IActionFetcher createFooterActionFetcher() {
+ return new FormFooterActionFetcher(this);
+ }
+
+ public static IActionFetcher getHeaderActionFetcher(IForm form) {
+ return (IActionFetcher) form.getProperty(IMobileForm.PROP_HEADER_ACTION_FETCHER);
+ }
+
+ public static void setHeaderActionFetcher(IForm form, IActionFetcher headerActionFetcher) {
+ form.setProperty(IMobileForm.PROP_HEADER_ACTION_FETCHER, headerActionFetcher);
+ }
+
+ @Override
+ public IActionFetcher getHeaderActionFetcher() {
+ return getHeaderActionFetcher(this);
+ }
+
+ @Override
+ public void setHeaderActionFetcher(IActionFetcher headerActionFetcher) {
+ setHeaderActionFetcher(this, headerActionFetcher);
+ }
+
+ @Override
+ public IActionFetcher getFooterActionFetcher() {
+ return getFooterActionFetcher(this);
+ }
+
+ @Override
+ public void setFooterActionFetcher(IActionFetcher footerActionFetcher) {
+ setFooterActionFetcher(this, footerActionFetcher);
+ }
+
+ public static IActionFetcher getFooterActionFetcher(IForm form) {
+ return (IActionFetcher) form.getProperty(IMobileForm.PROP_FOOTER_ACTION_FETCHER);
+ }
+
+ public static void setFooterActionFetcher(IForm form, IActionFetcher footerActionFetcher) {
+ form.setProperty(IMobileForm.PROP_FOOTER_ACTION_FETCHER, footerActionFetcher);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/FormFooterActionFetcher.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/FormFooterActionFetcher.java
index e566d6d083..2847ddd471 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/FormFooterActionFetcher.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/FormFooterActionFetcher.java
@@ -1,49 +1,49 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.form;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-
-/**
- * Converts the custom process buttons of the main box to actions.
- * <p>
- * The custom process buttons will be placed on the left side.
- */
-public class FormFooterActionFetcher extends AbstractFormActionFetcher {
-
- public FormFooterActionFetcher(IForm form) {
- super(form);
- }
-
- @Override
- public List<IMenu> fetch() {
- List<IMenu> formActions = new LinkedList<IMenu>();
- if (getForm().getRootGroupBox().getCustomProcessButtonCount() > 0) {
- List<IMobileAction> leftActions = createLeftFooterActions();
- if (leftActions != null) {
- for (IMobileAction action : leftActions) {
- action.setHorizontalAlignment(IMobileAction.HORIZONTAL_ALIGNMENT_LEFT);
- }
- formActions.addAll(leftActions);
- }
- }
- return formActions;
- }
-
- protected List<IMobileAction> createLeftFooterActions() {
- return convertCustomProcessButtons();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.form;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+
+/**
+ * Converts the custom process buttons of the main box to actions.
+ * <p>
+ * The custom process buttons will be placed on the left side.
+ */
+public class FormFooterActionFetcher extends AbstractFormActionFetcher {
+
+ public FormFooterActionFetcher(IForm form) {
+ super(form);
+ }
+
+ @Override
+ public List<IMenu> fetch() {
+ List<IMenu> formActions = new LinkedList<IMenu>();
+ if (getForm().getRootGroupBox().getCustomProcessButtonCount() > 0) {
+ List<IMobileAction> leftActions = createLeftFooterActions();
+ if (leftActions != null) {
+ for (IMobileAction action : leftActions) {
+ action.setHorizontalAlignment(IMobileAction.HORIZONTAL_ALIGNMENT_LEFT);
+ }
+ formActions.addAll(leftActions);
+ }
+ }
+ return formActions;
+ }
+
+ protected List<IMobileAction> createLeftFooterActions() {
+ return convertCustomProcessButtons();
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/FormHeaderActionFetcher.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/FormHeaderActionFetcher.java
index efab0d0b41..745708d8cd 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/FormHeaderActionFetcher.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/FormHeaderActionFetcher.java
@@ -1,146 +1,146 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.form;
-
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-import java.util.TreeSet;
-
-import org.eclipse.scout.rt.client.mobile.ui.action.ActionButtonBarUtility;
-import org.eclipse.scout.rt.client.mobile.ui.form.fields.button.IMobileButton;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
-
-/**
- * Converts the system and custom process buttons of the main box to actions.
- * <p>
- * The custom process buttons will be placed on the right side, the placement of the system process buttons depend on
- * the system type (see {@link #getRelevantSystemTypesForLeftHeader()} and
- * {@link #getRelevantSystemTypesForRightHeader()})
- */
-public class FormHeaderActionFetcher extends AbstractFormActionFetcher {
-
- public FormHeaderActionFetcher(IForm form) {
- super(form);
- }
-
- @Override
- public List<IMenu> fetch() {
- List<IMenu> formActions = new LinkedList<IMenu>();
-
- if (getForm().getRootGroupBox().getSystemProcessButtonCount() > 0) {
- List<IMobileAction> leftActions = createLeftActions();
- if (leftActions != null) {
- for (IMobileAction action : leftActions) {
- action.setHorizontalAlignment(IMobileAction.HORIZONTAL_ALIGNMENT_LEFT);
- }
- formActions.addAll(leftActions);
- }
- }
- if (getForm().getRootGroupBox().getSystemProcessButtonCount() > 0 || getForm().getRootGroupBox().getCustomProcessButtonCount() > 0) {
- List<IMobileAction> rightActions = createRightActions();
- if (rightActions != null) {
- for (IMobileAction action : rightActions) {
- action.setHorizontalAlignment(IMobileAction.HORIZONTAL_ALIGNMENT_RIGHT);
- }
- }
- formActions.addAll(rightActions);
- }
-
- return formActions;
- }
-
- /**
- * If there are multiple buttons with a matching system types the order given in the list is used to sort the buttons.
- */
- protected List<IMobileAction> convertSystemProcessButtons(final List<Integer> relevantSystemTypes) {
- if (relevantSystemTypes == null || relevantSystemTypes.size() == 0) {
- return null;
- }
-
- IButton[] systemProcessButtons = getForm().getRootGroupBox().getSystemProcessButtons();
- if (systemProcessButtons == null || systemProcessButtons.length == 0) {
- return null;
- }
-
- Comparator<IButton> comparator = new Comparator<IButton>() {
- @Override
- public int compare(IButton button1, IButton button2) {
- int index1 = relevantSystemTypes.indexOf(button1.getSystemType());
- int index2 = relevantSystemTypes.indexOf(button2.getSystemType());
- if (index1 >= index2) {
- return 1;
- }
- else {
- return -1;
- }
- }
- };
-
- Set<IButton> sortedButtons = new TreeSet<IButton>(comparator);
- sortedButtons.addAll(Arrays.asList(systemProcessButtons));
- List<IMobileAction> actions = new LinkedList<IMobileAction>();
- for (IButton button : sortedButtons) {
- if (relevantSystemTypes.contains(button.getSystemType())) {
- actions.add(ActionButtonBarUtility.convertButtonToAction(button));
- }
- }
-
- return actions;
- }
-
- protected List<IMobileAction> createLeftActions() {
- return convertSystemProcessButtons(getRelevantSystemTypesForLeftSide());
- }
-
- protected List<IMobileAction> createRightActions() {
- List<IMobileAction> actions = new LinkedList<IMobileAction>();
-
- List<IMobileAction> systemActions = convertSystemProcessButtons(getRelevantSystemTypesForRightSide());
- if (systemActions != null) {
- actions.addAll(systemActions);
- }
-
- List<IMobileAction> customActions = convertCustomProcessButtons();
- if (customActions != null) {
- actions.addAll(customActions);
- }
-
- return actions;
- }
-
- protected List<Integer> getRelevantSystemTypesForLeftSide() {
- List<Integer> systemTypesToConsider = new LinkedList<Integer>();
- systemTypesToConsider.add(IButton.SYSTEM_TYPE_CANCEL);
- systemTypesToConsider.add(IButton.SYSTEM_TYPE_CLOSE);
- systemTypesToConsider.add(IMobileButton.SYSTEM_TYPE_BACK);
- return systemTypesToConsider;
- }
-
- /**
- * Returns the system types which are relevant for the right button bar. The order of the list is taken into account
- * too.
- */
- protected List<Integer> getRelevantSystemTypesForRightSide() {
- List<Integer> systemTypesToConsider = new LinkedList<Integer>();
- systemTypesToConsider.add(IButton.SYSTEM_TYPE_OK);
- systemTypesToConsider.add(IButton.SYSTEM_TYPE_SAVE);
- systemTypesToConsider.add(IButton.SYSTEM_TYPE_SAVE_WITHOUT_MARKER_CHANGE);
- systemTypesToConsider.add(IButton.SYSTEM_TYPE_RESET);
-
- return systemTypesToConsider;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.form;
+
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.eclipse.scout.rt.client.mobile.ui.action.ActionButtonBarUtility;
+import org.eclipse.scout.rt.client.mobile.ui.form.fields.button.IMobileButton;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
+
+/**
+ * Converts the system and custom process buttons of the main box to actions.
+ * <p>
+ * The custom process buttons will be placed on the right side, the placement of the system process buttons depend on
+ * the system type (see {@link #getRelevantSystemTypesForLeftHeader()} and
+ * {@link #getRelevantSystemTypesForRightHeader()})
+ */
+public class FormHeaderActionFetcher extends AbstractFormActionFetcher {
+
+ public FormHeaderActionFetcher(IForm form) {
+ super(form);
+ }
+
+ @Override
+ public List<IMenu> fetch() {
+ List<IMenu> formActions = new LinkedList<IMenu>();
+
+ if (getForm().getRootGroupBox().getSystemProcessButtonCount() > 0) {
+ List<IMobileAction> leftActions = createLeftActions();
+ if (leftActions != null) {
+ for (IMobileAction action : leftActions) {
+ action.setHorizontalAlignment(IMobileAction.HORIZONTAL_ALIGNMENT_LEFT);
+ }
+ formActions.addAll(leftActions);
+ }
+ }
+ if (getForm().getRootGroupBox().getSystemProcessButtonCount() > 0 || getForm().getRootGroupBox().getCustomProcessButtonCount() > 0) {
+ List<IMobileAction> rightActions = createRightActions();
+ if (rightActions != null) {
+ for (IMobileAction action : rightActions) {
+ action.setHorizontalAlignment(IMobileAction.HORIZONTAL_ALIGNMENT_RIGHT);
+ }
+ }
+ formActions.addAll(rightActions);
+ }
+
+ return formActions;
+ }
+
+ /**
+ * If there are multiple buttons with a matching system types the order given in the list is used to sort the buttons.
+ */
+ protected List<IMobileAction> convertSystemProcessButtons(final List<Integer> relevantSystemTypes) {
+ if (relevantSystemTypes == null || relevantSystemTypes.size() == 0) {
+ return null;
+ }
+
+ IButton[] systemProcessButtons = getForm().getRootGroupBox().getSystemProcessButtons();
+ if (systemProcessButtons == null || systemProcessButtons.length == 0) {
+ return null;
+ }
+
+ Comparator<IButton> comparator = new Comparator<IButton>() {
+ @Override
+ public int compare(IButton button1, IButton button2) {
+ int index1 = relevantSystemTypes.indexOf(button1.getSystemType());
+ int index2 = relevantSystemTypes.indexOf(button2.getSystemType());
+ if (index1 >= index2) {
+ return 1;
+ }
+ else {
+ return -1;
+ }
+ }
+ };
+
+ Set<IButton> sortedButtons = new TreeSet<IButton>(comparator);
+ sortedButtons.addAll(Arrays.asList(systemProcessButtons));
+ List<IMobileAction> actions = new LinkedList<IMobileAction>();
+ for (IButton button : sortedButtons) {
+ if (relevantSystemTypes.contains(button.getSystemType())) {
+ actions.add(ActionButtonBarUtility.convertButtonToAction(button));
+ }
+ }
+
+ return actions;
+ }
+
+ protected List<IMobileAction> createLeftActions() {
+ return convertSystemProcessButtons(getRelevantSystemTypesForLeftSide());
+ }
+
+ protected List<IMobileAction> createRightActions() {
+ List<IMobileAction> actions = new LinkedList<IMobileAction>();
+
+ List<IMobileAction> systemActions = convertSystemProcessButtons(getRelevantSystemTypesForRightSide());
+ if (systemActions != null) {
+ actions.addAll(systemActions);
+ }
+
+ List<IMobileAction> customActions = convertCustomProcessButtons();
+ if (customActions != null) {
+ actions.addAll(customActions);
+ }
+
+ return actions;
+ }
+
+ protected List<Integer> getRelevantSystemTypesForLeftSide() {
+ List<Integer> systemTypesToConsider = new LinkedList<Integer>();
+ systemTypesToConsider.add(IButton.SYSTEM_TYPE_CANCEL);
+ systemTypesToConsider.add(IButton.SYSTEM_TYPE_CLOSE);
+ systemTypesToConsider.add(IMobileButton.SYSTEM_TYPE_BACK);
+ return systemTypesToConsider;
+ }
+
+ /**
+ * Returns the system types which are relevant for the right button bar. The order of the list is taken into account
+ * too.
+ */
+ protected List<Integer> getRelevantSystemTypesForRightSide() {
+ List<Integer> systemTypesToConsider = new LinkedList<Integer>();
+ systemTypesToConsider.add(IButton.SYSTEM_TYPE_OK);
+ systemTypesToConsider.add(IButton.SYSTEM_TYPE_SAVE);
+ systemTypesToConsider.add(IButton.SYSTEM_TYPE_SAVE_WITHOUT_MARKER_CHANGE);
+ systemTypesToConsider.add(IButton.SYSTEM_TYPE_RESET);
+
+ return systemTypesToConsider;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/IActionFetcher.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/IActionFetcher.java
index e44a52b70f..380499e09b 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/IActionFetcher.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/IActionFetcher.java
@@ -1,22 +1,22 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.form;
-
-import java.util.List;
-
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-
-/**
- * @since 3.9.0
- */
-public interface IActionFetcher {
- List<IMenu> fetch();
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.form;
+
+import java.util.List;
+
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+
+/**
+ * @since 3.9.0
+ */
+public interface IActionFetcher {
+ List<IMenu> fetch();
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/IMobileAction.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/IMobileAction.java
index 7289a52af7..74fc526943 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/IMobileAction.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/IMobileAction.java
@@ -1,32 +1,32 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.form;
-
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-
-/**
- * @since 3.9.0
- */
-public interface IMobileAction extends IMenu {
-
- String PROP_HORIZONTAL_ALIGNMENT = "horizontalAlignment";
-
- int HORIZONTAL_ALIGNMENT_LEFT = -1;
- int HORIZONTAL_ALIGNMENT_RIGHT = 1;
-
- int getHorizontalAlignment();
-
- /**
- * @param alignment
- * negative for left and positive for right alignment
- */
- void setHorizontalAlignment(int alignment);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.form;
+
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+
+/**
+ * @since 3.9.0
+ */
+public interface IMobileAction extends IMenu {
+
+ String PROP_HORIZONTAL_ALIGNMENT = "horizontalAlignment";
+
+ int HORIZONTAL_ALIGNMENT_LEFT = -1;
+ int HORIZONTAL_ALIGNMENT_RIGHT = 1;
+
+ int getHorizontalAlignment();
+
+ /**
+ * @param alignment
+ * negative for left and positive for right alignment
+ */
+ void setHorizontalAlignment(int alignment);
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/IMobileForm.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/IMobileForm.java
index bbbad6c4b8..d2e3fede83 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/IMobileForm.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/IMobileForm.java
@@ -1,34 +1,34 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.form;
-
-import org.eclipse.scout.rt.client.ui.form.IForm;
-
-/**
- * @since 3.9.0
- */
-public interface IMobileForm extends IForm {
- String PROP_FOOTER_VISIBLE = "footerVisible";
- String PROP_HEADER_ACTION_FETCHER = "headerActionFetcher";
- String PROP_FOOTER_ACTION_FETCHER = "footerActionFetcher";
-
- boolean isFooterVisible();
-
- void setFooterVisible(boolean visible);
-
- IActionFetcher getHeaderActionFetcher();
-
- void setHeaderActionFetcher(IActionFetcher headerActionFetcher);
-
- IActionFetcher getFooterActionFetcher();
-
- void setFooterActionFetcher(IActionFetcher footerActionFetcher);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.form;
+
+import org.eclipse.scout.rt.client.ui.form.IForm;
+
+/**
+ * @since 3.9.0
+ */
+public interface IMobileForm extends IForm {
+ String PROP_FOOTER_VISIBLE = "footerVisible";
+ String PROP_HEADER_ACTION_FETCHER = "headerActionFetcher";
+ String PROP_FOOTER_ACTION_FETCHER = "footerActionFetcher";
+
+ boolean isFooterVisible();
+
+ void setFooterVisible(boolean visible);
+
+ IActionFetcher getHeaderActionFetcher();
+
+ void setHeaderActionFetcher(IActionFetcher headerActionFetcher);
+
+ IActionFetcher getFooterActionFetcher();
+
+ void setFooterActionFetcher(IActionFetcher footerActionFetcher);
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/FormFieldPropertyDelegator.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/FormFieldPropertyDelegator.java
index bd1bd749a2..95d7b7a73a 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/FormFieldPropertyDelegator.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/FormFieldPropertyDelegator.java
@@ -1,53 +1,53 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.form.fields;
-
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-
-public class FormFieldPropertyDelegator<SENDER extends IFormField, RECEIVER extends IFormField> extends PropertyDelegator<SENDER, RECEIVER> {
-
- public FormFieldPropertyDelegator(SENDER sendingField, RECEIVER receivingField) {
- super(sendingField, receivingField);
- }
-
- @Override
- public void init() {
- getReceiver().setVisible(getSender().isVisible());
- if (!getSender().isVisible()) {
- //Since AbstractFormField#calculateVisibleInternal may ignore this property only set it if it hasn't been ignored (to not override those rules)
- getReceiver().setVisibleGranted(getSender().isVisibleGranted());
- }
- getReceiver().setEnabled(getSender().isEnabled());
- if (!getSender().isEnabled()) {
- //Since AbstractFormField#calculateEnabled may ignore this property only set it if it hasn't been ignored (to not override those rules)
- getReceiver().setEnabledGranted(getSender().isEnabledGranted());
- }
- getReceiver().setLabel(getSender().getLabel());
- getReceiver().setTooltipText(getSender().getTooltipText());
- }
-
- @Override
- protected void handlePropertyChange(String name, Object newValue) {
- if (name.equals(IFormField.PROP_VISIBLE)) {
- getReceiver().setVisible(((Boolean) newValue).booleanValue());
- }
- else if (name.equals(IFormField.PROP_ENABLED)) {
- getReceiver().setEnabled(((Boolean) newValue).booleanValue());
- }
- else if (name.equals(IFormField.PROP_LABEL)) {
- getReceiver().setLabel(((String) newValue));
- }
- else if (name.equals(IFormField.PROP_TOOLTIP_TEXT)) {
- getReceiver().setTooltipText((String) newValue);
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.form.fields;
+
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+
+public class FormFieldPropertyDelegator<SENDER extends IFormField, RECEIVER extends IFormField> extends PropertyDelegator<SENDER, RECEIVER> {
+
+ public FormFieldPropertyDelegator(SENDER sendingField, RECEIVER receivingField) {
+ super(sendingField, receivingField);
+ }
+
+ @Override
+ public void init() {
+ getReceiver().setVisible(getSender().isVisible());
+ if (!getSender().isVisible()) {
+ //Since AbstractFormField#calculateVisibleInternal may ignore this property only set it if it hasn't been ignored (to not override those rules)
+ getReceiver().setVisibleGranted(getSender().isVisibleGranted());
+ }
+ getReceiver().setEnabled(getSender().isEnabled());
+ if (!getSender().isEnabled()) {
+ //Since AbstractFormField#calculateEnabled may ignore this property only set it if it hasn't been ignored (to not override those rules)
+ getReceiver().setEnabledGranted(getSender().isEnabledGranted());
+ }
+ getReceiver().setLabel(getSender().getLabel());
+ getReceiver().setTooltipText(getSender().getTooltipText());
+ }
+
+ @Override
+ protected void handlePropertyChange(String name, Object newValue) {
+ if (name.equals(IFormField.PROP_VISIBLE)) {
+ getReceiver().setVisible(((Boolean) newValue).booleanValue());
+ }
+ else if (name.equals(IFormField.PROP_ENABLED)) {
+ getReceiver().setEnabled(((Boolean) newValue).booleanValue());
+ }
+ else if (name.equals(IFormField.PROP_LABEL)) {
+ getReceiver().setLabel(((String) newValue));
+ }
+ else if (name.equals(IFormField.PROP_TOOLTIP_TEXT)) {
+ getReceiver().setTooltipText((String) newValue);
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/IWrapper.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/IWrapper.java
index 6a6f3b6710..aced24067b 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/IWrapper.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/IWrapper.java
@@ -1,20 +1,20 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.form.fields;
-
-import org.eclipse.scout.commons.beans.IPropertyObserver;
-
-/**
- * @since 3.9.0
- */
-public interface IWrapper<WRAPPABLE extends IPropertyObserver> {
- WRAPPABLE getWrappedObject();
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.form.fields;
+
+import org.eclipse.scout.commons.beans.IPropertyObserver;
+
+/**
+ * @since 3.9.0
+ */
+public interface IWrapper<WRAPPABLE extends IPropertyObserver> {
+ WRAPPABLE getWrappedObject();
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/PropertyBucket.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/PropertyBucket.java
index 439629d7ad..58575b3e64 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/PropertyBucket.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/PropertyBucket.java
@@ -1,93 +1,93 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.form.fields;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.IClientSession;
-
-/**
- * @since 3.9.0
- */
-public class PropertyBucket {
- private static final String SESSION_DATA_KEY = "PropertyBucketSessionData";
-
- /**
- * Properties are stored per class to make it more robust against wrong implementations of equals and hashcode.
- */
- private Map<Class, PropertyMap> m_propertiesForClass;
-
- public PropertyBucket() {
- m_propertiesForClass = new HashMap<Class, PropertyMap>();
- }
-
- public static PropertyBucket getInstance(IClientSession clientSession) {
- Object data = clientSession.getData(SESSION_DATA_KEY);
-
- PropertyBucket propertyStore = null;
- if (data instanceof PropertyBucket) {
- propertyStore = (PropertyBucket) data;
- }
-
- if (propertyStore == null) {
- propertyStore = new PropertyBucket();
- clientSession.setData(SESSION_DATA_KEY, propertyStore);
- }
-
- return propertyStore;
- }
-
- public static PropertyBucket getInstance() {
- return getInstance(ClientSyncJob.getCurrentSession());
- }
-
- private PropertyMap getOrCreatePropertyMap(Object bean) {
- PropertyMap propertyMap = m_propertiesForClass.get(bean.getClass());
- if (propertyMap == null) {
- propertyMap = new PropertyMap();
- m_propertiesForClass.put(bean.getClass(), propertyMap);
- }
-
- return propertyMap;
- }
-
- public void setPropertyBoolean(Object bean, String name, Boolean value) {
- PropertyMap propertyMap = getOrCreatePropertyMap(bean);
- propertyMap.setPropertyBoolean(bean, name, value);
- }
-
- public Boolean getPropertyBoolean(Object bean, String name) {
- PropertyMap propertyMap = getOrCreatePropertyMap(bean);
- return propertyMap.getPropertyBoolean(bean, name);
- }
-
- public void setPropertyString(Object bean, String name, String value) {
- PropertyMap propertyMap = getOrCreatePropertyMap(bean);
- propertyMap.setPropertyString(bean, name, value);
- }
-
- public String getPropertyString(Object bean, String name) {
- PropertyMap propertyMap = getOrCreatePropertyMap(bean);
- return propertyMap.getPropertyString(bean, name);
- }
-
- public <T extends Object> void setProperty(Object bean, String name, T value) {
- PropertyMap propertyMap = getOrCreatePropertyMap(bean);
- propertyMap.setProperty(bean, name, value);
- }
-
- public <T extends Object> T getProperty(Object bean, String name) {
- PropertyMap propertyMap = getOrCreatePropertyMap(bean);
- return propertyMap.getProperty(bean, name);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.form.fields;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.IClientSession;
+
+/**
+ * @since 3.9.0
+ */
+public class PropertyBucket {
+ private static final String SESSION_DATA_KEY = "PropertyBucketSessionData";
+
+ /**
+ * Properties are stored per class to make it more robust against wrong implementations of equals and hashcode.
+ */
+ private Map<Class, PropertyMap> m_propertiesForClass;
+
+ public PropertyBucket() {
+ m_propertiesForClass = new HashMap<Class, PropertyMap>();
+ }
+
+ public static PropertyBucket getInstance(IClientSession clientSession) {
+ Object data = clientSession.getData(SESSION_DATA_KEY);
+
+ PropertyBucket propertyStore = null;
+ if (data instanceof PropertyBucket) {
+ propertyStore = (PropertyBucket) data;
+ }
+
+ if (propertyStore == null) {
+ propertyStore = new PropertyBucket();
+ clientSession.setData(SESSION_DATA_KEY, propertyStore);
+ }
+
+ return propertyStore;
+ }
+
+ public static PropertyBucket getInstance() {
+ return getInstance(ClientSyncJob.getCurrentSession());
+ }
+
+ private PropertyMap getOrCreatePropertyMap(Object bean) {
+ PropertyMap propertyMap = m_propertiesForClass.get(bean.getClass());
+ if (propertyMap == null) {
+ propertyMap = new PropertyMap();
+ m_propertiesForClass.put(bean.getClass(), propertyMap);
+ }
+
+ return propertyMap;
+ }
+
+ public void setPropertyBoolean(Object bean, String name, Boolean value) {
+ PropertyMap propertyMap = getOrCreatePropertyMap(bean);
+ propertyMap.setPropertyBoolean(bean, name, value);
+ }
+
+ public Boolean getPropertyBoolean(Object bean, String name) {
+ PropertyMap propertyMap = getOrCreatePropertyMap(bean);
+ return propertyMap.getPropertyBoolean(bean, name);
+ }
+
+ public void setPropertyString(Object bean, String name, String value) {
+ PropertyMap propertyMap = getOrCreatePropertyMap(bean);
+ propertyMap.setPropertyString(bean, name, value);
+ }
+
+ public String getPropertyString(Object bean, String name) {
+ PropertyMap propertyMap = getOrCreatePropertyMap(bean);
+ return propertyMap.getPropertyString(bean, name);
+ }
+
+ public <T extends Object> void setProperty(Object bean, String name, T value) {
+ PropertyMap propertyMap = getOrCreatePropertyMap(bean);
+ propertyMap.setProperty(bean, name, value);
+ }
+
+ public <T extends Object> T getProperty(Object bean, String name) {
+ PropertyMap propertyMap = getOrCreatePropertyMap(bean);
+ return propertyMap.getProperty(bean, name);
+ }
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/PropertyDelegator.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/PropertyDelegator.java
index eb02849f95..ec145d4d20 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/PropertyDelegator.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/PropertyDelegator.java
@@ -1,70 +1,70 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.form.fields;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.scout.commons.beans.IPropertyObserver;
-
-public class PropertyDelegator<SENDER extends IPropertyObserver, RECEIVER extends IPropertyObserver> {
- private P_PropertyChangeListener m_propertyChangeListener;
- private Set<String> m_filter;
- private SENDER m_sender;
- private RECEIVER m_receiver;
-
- public PropertyDelegator(SENDER sender, RECEIVER receiver) {
- this(sender, receiver, null);
- }
-
- public PropertyDelegator(SENDER sender, RECEIVER receiver, Set<String> filteredPropertyNames) {
- m_sender = sender;
- m_receiver = receiver;
-
- m_filter = filteredPropertyNames;
- if (m_filter == null) {
- m_filter = new HashSet<String>();
- }
- m_propertyChangeListener = new P_PropertyChangeListener();
- m_sender.addPropertyChangeListener(m_propertyChangeListener);
- }
-
- public SENDER getSender() {
- return m_sender;
- }
-
- public RECEIVER getReceiver() {
- return m_receiver;
- }
-
- /**
- * Fills the properties of the receiver with the values of the sender. Typically used at the initialization of objects
- * e.g. at initConfig() of a form field.
- */
- public void init() {
- }
-
- protected void handlePropertyChange(String name, Object newValue) {
- }
-
- private class P_PropertyChangeListener implements PropertyChangeListener {
-
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- if (!m_filter.contains(evt.getPropertyName())) {
- handlePropertyChange(evt.getPropertyName(), evt.getNewValue());
- }
- }
-
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.form.fields;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.scout.commons.beans.IPropertyObserver;
+
+public class PropertyDelegator<SENDER extends IPropertyObserver, RECEIVER extends IPropertyObserver> {
+ private P_PropertyChangeListener m_propertyChangeListener;
+ private Set<String> m_filter;
+ private SENDER m_sender;
+ private RECEIVER m_receiver;
+
+ public PropertyDelegator(SENDER sender, RECEIVER receiver) {
+ this(sender, receiver, null);
+ }
+
+ public PropertyDelegator(SENDER sender, RECEIVER receiver, Set<String> filteredPropertyNames) {
+ m_sender = sender;
+ m_receiver = receiver;
+
+ m_filter = filteredPropertyNames;
+ if (m_filter == null) {
+ m_filter = new HashSet<String>();
+ }
+ m_propertyChangeListener = new P_PropertyChangeListener();
+ m_sender.addPropertyChangeListener(m_propertyChangeListener);
+ }
+
+ public SENDER getSender() {
+ return m_sender;
+ }
+
+ public RECEIVER getReceiver() {
+ return m_receiver;
+ }
+
+ /**
+ * Fills the properties of the receiver with the values of the sender. Typically used at the initialization of objects
+ * e.g. at initConfig() of a form field.
+ */
+ public void init() {
+ }
+
+ protected void handlePropertyChange(String name, Object newValue) {
+ }
+
+ private class P_PropertyChangeListener implements PropertyChangeListener {
+
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (!m_filter.contains(evt.getPropertyName())) {
+ handlePropertyChange(evt.getPropertyName(), evt.getNewValue());
+ }
+ }
+
+ }
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/PropertyMap.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/PropertyMap.java
index 3b7e62bb27..1db0d9d98d 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/PropertyMap.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/PropertyMap.java
@@ -1,98 +1,98 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.form.fields;
-
-import java.util.Map;
-import java.util.WeakHashMap;
-
-import org.eclipse.scout.commons.beans.BasicPropertySupport;
-
-/**
- * @since 3.9.0
- */
-public class PropertyMap {
- private Map<Object, BasicPropertySupport> m_instanceProperties;
-
- public PropertyMap() {
- m_instanceProperties = new WeakHashMap<Object, BasicPropertySupport>();
- }
-
- public void setPropertyBoolean(Object bean, String name, Boolean value) {
- BasicPropertySupport basicPropertySupport = m_instanceProperties.get(bean);
- if (basicPropertySupport == null) {
- basicPropertySupport = new BasicPropertySupport(bean);
- m_instanceProperties.put(bean, basicPropertySupport);
- }
-
- basicPropertySupport.setProperty(name, value);
- }
-
- public Boolean getPropertyBoolean(Object bean, String name) {
- BasicPropertySupport basicPropertySupport = m_instanceProperties.get(bean);
- if (basicPropertySupport == null) {
- return null;
- }
-
- //TODO CGU: better with hasProperty? But then removing a property must be possible which is not currently
- Object prop = basicPropertySupport.getProperty(name);
- if (prop instanceof Boolean) {
- return (Boolean) prop;
- }
-
- return null;
- }
-
- public void setPropertyString(Object bean, String name, String value) {
- BasicPropertySupport basicPropertySupport = m_instanceProperties.get(bean);
- if (basicPropertySupport == null) {
- basicPropertySupport = new BasicPropertySupport(bean);
- m_instanceProperties.put(bean, basicPropertySupport);
- }
-
- basicPropertySupport.setProperty(name, value);
- }
-
- public String getPropertyString(Object bean, String name) {
- BasicPropertySupport basicPropertySupport = m_instanceProperties.get(bean);
- if (basicPropertySupport == null) {
- return null;
- }
-
- //TODO CGU: better with hasProperty? But then removing a property must be possible which is not currently
- Object prop = basicPropertySupport.getProperty(name);
- if (prop instanceof String) {
- return (String) prop;
- }
-
- return null;
- }
-
- public <T extends Object> void setProperty(Object bean, String name, T value) {
- BasicPropertySupport basicPropertySupport = m_instanceProperties.get(bean);
- if (basicPropertySupport == null) {
- basicPropertySupport = new BasicPropertySupport(bean);
- m_instanceProperties.put(bean, basicPropertySupport);
- }
-
- basicPropertySupport.setProperty(name, value);
- }
-
- @SuppressWarnings("unchecked")
- public <T extends Object> T getProperty(Object bean, String name) {
- BasicPropertySupport basicPropertySupport = m_instanceProperties.get(bean);
- if (basicPropertySupport == null) {
- return null;
- }
-
- return (T) basicPropertySupport.getProperty(name);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.form.fields;
+
+import java.util.Map;
+import java.util.WeakHashMap;
+
+import org.eclipse.scout.commons.beans.BasicPropertySupport;
+
+/**
+ * @since 3.9.0
+ */
+public class PropertyMap {
+ private Map<Object, BasicPropertySupport> m_instanceProperties;
+
+ public PropertyMap() {
+ m_instanceProperties = new WeakHashMap<Object, BasicPropertySupport>();
+ }
+
+ public void setPropertyBoolean(Object bean, String name, Boolean value) {
+ BasicPropertySupport basicPropertySupport = m_instanceProperties.get(bean);
+ if (basicPropertySupport == null) {
+ basicPropertySupport = new BasicPropertySupport(bean);
+ m_instanceProperties.put(bean, basicPropertySupport);
+ }
+
+ basicPropertySupport.setProperty(name, value);
+ }
+
+ public Boolean getPropertyBoolean(Object bean, String name) {
+ BasicPropertySupport basicPropertySupport = m_instanceProperties.get(bean);
+ if (basicPropertySupport == null) {
+ return null;
+ }
+
+ //TODO CGU: better with hasProperty? But then removing a property must be possible which is not currently
+ Object prop = basicPropertySupport.getProperty(name);
+ if (prop instanceof Boolean) {
+ return (Boolean) prop;
+ }
+
+ return null;
+ }
+
+ public void setPropertyString(Object bean, String name, String value) {
+ BasicPropertySupport basicPropertySupport = m_instanceProperties.get(bean);
+ if (basicPropertySupport == null) {
+ basicPropertySupport = new BasicPropertySupport(bean);
+ m_instanceProperties.put(bean, basicPropertySupport);
+ }
+
+ basicPropertySupport.setProperty(name, value);
+ }
+
+ public String getPropertyString(Object bean, String name) {
+ BasicPropertySupport basicPropertySupport = m_instanceProperties.get(bean);
+ if (basicPropertySupport == null) {
+ return null;
+ }
+
+ //TODO CGU: better with hasProperty? But then removing a property must be possible which is not currently
+ Object prop = basicPropertySupport.getProperty(name);
+ if (prop instanceof String) {
+ return (String) prop;
+ }
+
+ return null;
+ }
+
+ public <T extends Object> void setProperty(Object bean, String name, T value) {
+ BasicPropertySupport basicPropertySupport = m_instanceProperties.get(bean);
+ if (basicPropertySupport == null) {
+ basicPropertySupport = new BasicPropertySupport(bean);
+ m_instanceProperties.put(bean, basicPropertySupport);
+ }
+
+ basicPropertySupport.setProperty(name, value);
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T extends Object> T getProperty(Object bean, String name) {
+ BasicPropertySupport basicPropertySupport = m_instanceProperties.get(bean);
+ if (basicPropertySupport == null) {
+ return null;
+ }
+
+ return (T) basicPropertySupport.getProperty(name);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/button/AbstractBackButton.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/button/AbstractBackButton.java
index fcafeb482f..d7d93dfd8a 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/button/AbstractBackButton.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/button/AbstractBackButton.java
@@ -1,47 +1,47 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.form.fields.button;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.mobile.Icons;
-import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractButton;
-
-/**
- * @since 3.9.0
- */
-public class AbstractBackButton extends AbstractButton implements IMobileButton {
-
- @Override
- protected String getConfiguredLabel() {
- return null;
- }
-
- @Override
- protected String getConfiguredIconId() {
- return Icons.BackAction;
- }
-
- @Override
- protected String getConfiguredTooltipText() {
- return null;
- }
-
- @Override
- protected int getConfiguredSystemType() {
- return SYSTEM_TYPE_BACK;
- }
-
- @Override
- protected void execClickAction() throws ProcessingException {
- getForm().doOk();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.form.fields.button;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.mobile.Icons;
+import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractButton;
+
+/**
+ * @since 3.9.0
+ */
+public class AbstractBackButton extends AbstractButton implements IMobileButton {
+
+ @Override
+ protected String getConfiguredLabel() {
+ return null;
+ }
+
+ @Override
+ protected String getConfiguredIconId() {
+ return Icons.BackAction;
+ }
+
+ @Override
+ protected String getConfiguredTooltipText() {
+ return null;
+ }
+
+ @Override
+ protected int getConfiguredSystemType() {
+ return SYSTEM_TYPE_BACK;
+ }
+
+ @Override
+ protected void execClickAction() throws ProcessingException {
+ getForm().doOk();
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/button/IMobileButton.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/button/IMobileButton.java
index 698132e3e7..d9d1ae0591 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/button/IMobileButton.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/button/IMobileButton.java
@@ -1,17 +1,17 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.form.fields.button;
-
-import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
-
-public interface IMobileButton extends IButton {
- int SYSTEM_TYPE_BACK = 100;
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.form.fields.button;
+
+import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
+
+public interface IMobileButton extends IButton {
+ int SYSTEM_TYPE_BACK = 100;
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/groupbox/GroupBoxPropertyDelegator.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/groupbox/GroupBoxPropertyDelegator.java
index 03410f2642..c69946e08f 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/groupbox/GroupBoxPropertyDelegator.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/groupbox/GroupBoxPropertyDelegator.java
@@ -1,57 +1,57 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.form.fields.groupbox;
-
-import org.eclipse.scout.rt.client.mobile.ui.form.fields.FormFieldPropertyDelegator;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox;
-
-public class GroupBoxPropertyDelegator extends FormFieldPropertyDelegator<IGroupBox, IGroupBox> {
-
- public GroupBoxPropertyDelegator(IGroupBox sendingField, IGroupBox receivingField) {
- super(sendingField, receivingField);
- }
-
- @Override
- public void init() {
- super.init();
-
- getReceiver().setBorderVisible(getSender().isBorderVisible());
- getReceiver().setBorderDecoration(getSender().getBorderDecoration());
- getReceiver().setExpanded(getSender().isExpanded());
- getReceiver().setBackgroundImageName(getSender().getBackgroundImageName());
- getReceiver().setBackgroundImageHorizontalAlignment(getSender().getBackgroundImageHorizontalAlignment());
- getReceiver().setBackgroundImageVerticalAlignment(getSender().getBackgroundImageVerticalAlignment());
- }
-
- @Override
- protected void handlePropertyChange(String name, Object newValue) {
- super.handlePropertyChange(name, newValue);
-
- if (name.equals(IGroupBox.PROP_BORDER_VISIBLE)) {
- getReceiver().setBorderVisible(((Boolean) newValue).booleanValue());
- }
- else if (name.equals(IGroupBox.PROP_BORDER_DECORATION)) {
- getReceiver().setBorderDecoration(((String) newValue));
- }
- else if (name.equals(IGroupBox.PROP_EXPANDED)) {
- getReceiver().setExpanded(((Boolean) newValue).booleanValue());
- }
- else if (name.equals(IGroupBox.PROP_BACKGROUND_IMAGE_NAME)) {
- getReceiver().setBackgroundImageName((String) newValue);
- }
- else if (name.equals(IGroupBox.PROP_BACKGROUND_IMAGE_HORIZONTAL_ALIGNMENT)) {
- getReceiver().setBackgroundImageHorizontalAlignment((Integer) newValue);
- }
- else if (name.equals(IGroupBox.PROP_BACKGROUND_IMAGE_VERTICAL_ALIGNMENT)) {
- getReceiver().setBackgroundImageVerticalAlignment((Integer) newValue);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.form.fields.groupbox;
+
+import org.eclipse.scout.rt.client.mobile.ui.form.fields.FormFieldPropertyDelegator;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox;
+
+public class GroupBoxPropertyDelegator extends FormFieldPropertyDelegator<IGroupBox, IGroupBox> {
+
+ public GroupBoxPropertyDelegator(IGroupBox sendingField, IGroupBox receivingField) {
+ super(sendingField, receivingField);
+ }
+
+ @Override
+ public void init() {
+ super.init();
+
+ getReceiver().setBorderVisible(getSender().isBorderVisible());
+ getReceiver().setBorderDecoration(getSender().getBorderDecoration());
+ getReceiver().setExpanded(getSender().isExpanded());
+ getReceiver().setBackgroundImageName(getSender().getBackgroundImageName());
+ getReceiver().setBackgroundImageHorizontalAlignment(getSender().getBackgroundImageHorizontalAlignment());
+ getReceiver().setBackgroundImageVerticalAlignment(getSender().getBackgroundImageVerticalAlignment());
+ }
+
+ @Override
+ protected void handlePropertyChange(String name, Object newValue) {
+ super.handlePropertyChange(name, newValue);
+
+ if (name.equals(IGroupBox.PROP_BORDER_VISIBLE)) {
+ getReceiver().setBorderVisible(((Boolean) newValue).booleanValue());
+ }
+ else if (name.equals(IGroupBox.PROP_BORDER_DECORATION)) {
+ getReceiver().setBorderDecoration(((String) newValue));
+ }
+ else if (name.equals(IGroupBox.PROP_EXPANDED)) {
+ getReceiver().setExpanded(((Boolean) newValue).booleanValue());
+ }
+ else if (name.equals(IGroupBox.PROP_BACKGROUND_IMAGE_NAME)) {
+ getReceiver().setBackgroundImageName((String) newValue);
+ }
+ else if (name.equals(IGroupBox.PROP_BACKGROUND_IMAGE_HORIZONTAL_ALIGNMENT)) {
+ getReceiver().setBackgroundImageHorizontalAlignment((Integer) newValue);
+ }
+ else if (name.equals(IGroupBox.PROP_BACKGROUND_IMAGE_VERTICAL_ALIGNMENT)) {
+ getReceiver().setBackgroundImageVerticalAlignment((Integer) newValue);
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/smartfield/CustomTextLookupRow.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/smartfield/CustomTextLookupRow.java
index f9d997d3fd..0c413dcb08 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/smartfield/CustomTextLookupRow.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/smartfield/CustomTextLookupRow.java
@@ -1,23 +1,23 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.form.fields.smartfield;
-
-import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
-
-public class CustomTextLookupRow extends LookupRow {
-
- private static final long serialVersionUID = 1L;
-
- public CustomTextLookupRow(String text) {
- super(null, text);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.form.fields.smartfield;
+
+import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
+
+public class CustomTextLookupRow extends LookupRow {
+
+ private static final long serialVersionUID = 1L;
+
+ public CustomTextLookupRow(String text) {
+ super(null, text);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/smartfield/MobileSmartFieldProposalFormProvider.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/smartfield/MobileSmartFieldProposalFormProvider.java
index ad83f8b107..3029596039 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/smartfield/MobileSmartFieldProposalFormProvider.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/smartfield/MobileSmartFieldProposalFormProvider.java
@@ -1,37 +1,37 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.form.fields.smartfield;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.form.fields.smartfield.ISmartField;
-import org.eclipse.scout.rt.client.ui.form.fields.smartfield.ISmartFieldProposalForm;
-import org.eclipse.scout.rt.client.ui.form.fields.smartfield.ISmartFieldProposalFormProvider;
-
-/**
- * @since 3.9.0
- */
-public class MobileSmartFieldProposalFormProvider implements ISmartFieldProposalFormProvider {
-
- @Override
- public ISmartFieldProposalForm createProposalForm(ISmartField smartField) throws ProcessingException {
- ISmartFieldProposalForm form;
- if (smartField.isBrowseHierarchy()) {
- form = new MobileSmartTreeForm(smartField);
- }
- else {
- form = new MobileSmartTableForm(smartField);
- }
- form.setAutoAddRemoveOnDesktop(true);
-
- return form;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.form.fields.smartfield;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.form.fields.smartfield.ISmartField;
+import org.eclipse.scout.rt.client.ui.form.fields.smartfield.ISmartFieldProposalForm;
+import org.eclipse.scout.rt.client.ui.form.fields.smartfield.ISmartFieldProposalFormProvider;
+
+/**
+ * @since 3.9.0
+ */
+public class MobileSmartFieldProposalFormProvider implements ISmartFieldProposalFormProvider {
+
+ @Override
+ public ISmartFieldProposalForm createProposalForm(ISmartField smartField) throws ProcessingException {
+ ISmartFieldProposalForm form;
+ if (smartField.isBrowseHierarchy()) {
+ form = new MobileSmartTreeForm(smartField);
+ }
+ else {
+ form = new MobileSmartTableForm(smartField);
+ }
+ form.setAutoAddRemoveOnDesktop(true);
+
+ return form;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/smartfield/MobileSmartTableForm.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/smartfield/MobileSmartTableForm.java
index edd570b21f..dedbf33cde 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/smartfield/MobileSmartTableForm.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/smartfield/MobileSmartTableForm.java
@@ -1,265 +1,265 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.form.fields.smartfield;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.mobile.ui.form.fields.button.AbstractBackButton;
-import org.eclipse.scout.rt.client.mobile.ui.form.fields.smartfield.MobileSmartTableForm.MainBox.GroupBox.FilterField;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.client.ui.basic.table.TableAdapter;
-import org.eclipse.scout.rt.client.ui.basic.table.TableEvent;
-import org.eclipse.scout.rt.client.ui.form.FormEvent;
-import org.eclipse.scout.rt.client.ui.form.FormListener;
-import org.eclipse.scout.rt.client.ui.form.fields.GridData;
-import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
-import org.eclipse.scout.rt.client.ui.form.fields.smartfield.ISmartField;
-import org.eclipse.scout.rt.client.ui.form.fields.smartfield.SmartTableForm;
-import org.eclipse.scout.rt.client.ui.form.fields.stringfield.AbstractStringField;
-import org.eclipse.scout.rt.shared.TEXTS;
-import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
-import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
-import org.eclipse.scout.service.SERVICES;
-
-/**
- * @since 3.9.0
- */
-public class MobileSmartTableForm extends SmartTableForm {
- private P_SmartFieldListener m_smartFieldListener;
- private boolean m_acceptingProposal;
-
- public MobileSmartTableForm(ISmartField<?> smartField) throws ProcessingException {
- super(smartField);
- }
-
- @Override
- protected void initConfig() throws ProcessingException {
- super.initConfig();
-
- String title = getSmartField().getLabel();
- if (StringUtility.hasText(title)) {
- title = TEXTS.get("MobileSmartFormTitle", title);
- }
- else {
- title = TEXTS.get("MobileSmartFormTitleDefault");
- }
- setTitle(title);
- getResultTableField().getTable().setCheckable(true);
- getResultTableField().getTable().addTableListener(new P_TableListener());
-
- GridData tableFieldGridDataHints = getResultTableField().getGridDataHints();
- tableFieldGridDataHints.useUiHeight = false;
- tableFieldGridDataHints.useUiWidth = false;
- tableFieldGridDataHints.h = 2;
- tableFieldGridDataHints.fillVertical = true;
- getResultTableField().setGridDataHints(tableFieldGridDataHints);
-
- addFormListener(new P_FormListener());
- if (m_smartFieldListener == null) {
- m_smartFieldListener = new P_SmartFieldListener();
- getSmartField().addPropertyChangeListener(m_smartFieldListener);
- }
- }
-
- @Override
- protected void execDisposeForm() throws ProcessingException {
- super.execDisposeForm();
-
- if (m_smartFieldListener != null) {
- getSmartField().removePropertyChangeListener(m_smartFieldListener);
- m_smartFieldListener = null;
- }
- }
-
- @Override
- protected int getConfiguredDisplayHint() {
- return DISPLAY_HINT_DIALOG;
- }
-
- @Override
- protected boolean getConfiguredModal() {
- return true;
- }
-
- @Override
- protected boolean getConfiguredAskIfNeedSave() {
- return true;
- }
-
- @Override
- protected void injectResultTableMenus(List<IMenu> menuList) {
- super.injectResultTableMenus(menuList);
-
- List<IMenu> smartFieldMenus = Arrays.asList(getSmartField().getMenus());
- menuList.addAll(smartFieldMenus);
- }
-
- @Override
- protected void execResultTableRowClicked(ITableRow row) throws ProcessingException {
- // nop. Clicking a row must NOT close the form.
- }
-
- private void acceptProposal() throws ProcessingException {
- m_acceptingProposal = true;
- try {
- LookupRow lookupRow = getAcceptedProposal();
- if (lookupRow != null) {
- getSmartField().acceptProposal(lookupRow);
- }
- }
- finally {
- m_acceptingProposal = false;
- }
- }
-
- @Override
- public LookupRow getAcceptedProposal() throws ProcessingException {
- LookupRow row = getSelectedLookupRow();
- if (row != null && row.isEnabled()) {
- return row;
- }
- else if (getSmartField().isAllowCustomText()) {
- return new CustomTextLookupRow(getFilterField().getValue());
- }
- else {
- // With the mobile smartfield deleting a value is only possible by not selecting any value.
- // The deletion of the value is achieved by returning an empty lookup row.
- return ISmartField.EMPTY_LOOKUP_ROW;
- }
- }
-
- public FilterField getFilterField() {
- return getFieldByClass(FilterField.class);
- }
-
- public class MainBox extends SmartTableForm.MainBox {
-
- @Override
- protected int getConfiguredHeightInPixel() {
- return 400;
- }
-
- @Order(1)
- public class GroupBox extends AbstractGroupBox {
-
- @Override
- protected boolean getConfiguredBorderVisible() {
- return true;
- }
-
- @Order(1)
- public class FilterField extends AbstractStringField {
-
- @Override
- protected boolean getConfiguredLabelVisible() {
- return false;
- }
-
- @Override
- protected boolean getConfiguredValidateOnAnyKey() {
- return true;
- }
-
- @Override
- protected void execChangedValue() throws ProcessingException {
- setSearchText(getValue());
- update(false, false);
- }
-
- }
- }
-
- @Order(99)
- public class BackButton extends AbstractBackButton {
-
- }
-
- }
-
- private void handleTableRowsUpdated(ITableRow[] rows) {
- if (rows != null && rows.length > 0) {
- try {
- //Accept proposal if a row gets checked. This makes sure the smartfield menus work.
- acceptProposal();
- }
- catch (ProcessingException e) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- }
- }
-
- private class P_TableListener extends TableAdapter {
-
- @Override
- public void tableChanged(TableEvent e) {
- switch (e.getType()) {
- case TableEvent.TYPE_ROWS_UPDATED: {
- handleTableRowsUpdated(e.getRows());
- break;
- }
- }
- }
-
- }
-
- /**
- * Updates the {@link FilterField} with the display text of the smartfield if the value gets changed externally (e.g.
- * by a smartfield menu action).
- */
- private class P_SmartFieldListener implements PropertyChangeListener {
-
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- if (ISmartField.PROP_VALUE.equals(evt.getPropertyName())) {
- if (!m_acceptingProposal) {
- getFilterField().setValue(getSmartField().getDisplayText());
- }
- }
- }
-
- }
-
- private class P_FormListener implements FormListener {
-
- @Override
- public void formChanged(FormEvent e) throws ProcessingException {
- switch (e.getType()) {
- case FormEvent.TYPE_CLOSED: {
- if (e.getForm() != MobileSmartTableForm.this) {
- return;
- }
-
- removeFormListener(this);
- if (getCloseSystemType() == IButton.SYSTEM_TYPE_OK) {
- LookupRow row = getAcceptedProposal();
- if (row instanceof CustomTextLookupRow) {
- // Setting the value is done by AbstractSmartField.P_ProposalFormListener
- // Unfortunately, if the value is not valid, the display text is not updated as well.
- // That's why it is set here
- getSmartField().setDisplayText(row.getText());
- }
- }
- break;
- }
- }
- }
-
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.form.fields.smartfield;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.mobile.ui.form.fields.button.AbstractBackButton;
+import org.eclipse.scout.rt.client.mobile.ui.form.fields.smartfield.MobileSmartTableForm.MainBox.GroupBox.FilterField;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.client.ui.basic.table.TableAdapter;
+import org.eclipse.scout.rt.client.ui.basic.table.TableEvent;
+import org.eclipse.scout.rt.client.ui.form.FormEvent;
+import org.eclipse.scout.rt.client.ui.form.FormListener;
+import org.eclipse.scout.rt.client.ui.form.fields.GridData;
+import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
+import org.eclipse.scout.rt.client.ui.form.fields.smartfield.ISmartField;
+import org.eclipse.scout.rt.client.ui.form.fields.smartfield.SmartTableForm;
+import org.eclipse.scout.rt.client.ui.form.fields.stringfield.AbstractStringField;
+import org.eclipse.scout.rt.shared.TEXTS;
+import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
+import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
+import org.eclipse.scout.service.SERVICES;
+
+/**
+ * @since 3.9.0
+ */
+public class MobileSmartTableForm extends SmartTableForm {
+ private P_SmartFieldListener m_smartFieldListener;
+ private boolean m_acceptingProposal;
+
+ public MobileSmartTableForm(ISmartField<?> smartField) throws ProcessingException {
+ super(smartField);
+ }
+
+ @Override
+ protected void initConfig() throws ProcessingException {
+ super.initConfig();
+
+ String title = getSmartField().getLabel();
+ if (StringUtility.hasText(title)) {
+ title = TEXTS.get("MobileSmartFormTitle", title);
+ }
+ else {
+ title = TEXTS.get("MobileSmartFormTitleDefault");
+ }
+ setTitle(title);
+ getResultTableField().getTable().setCheckable(true);
+ getResultTableField().getTable().addTableListener(new P_TableListener());
+
+ GridData tableFieldGridDataHints = getResultTableField().getGridDataHints();
+ tableFieldGridDataHints.useUiHeight = false;
+ tableFieldGridDataHints.useUiWidth = false;
+ tableFieldGridDataHints.h = 2;
+ tableFieldGridDataHints.fillVertical = true;
+ getResultTableField().setGridDataHints(tableFieldGridDataHints);
+
+ addFormListener(new P_FormListener());
+ if (m_smartFieldListener == null) {
+ m_smartFieldListener = new P_SmartFieldListener();
+ getSmartField().addPropertyChangeListener(m_smartFieldListener);
+ }
+ }
+
+ @Override
+ protected void execDisposeForm() throws ProcessingException {
+ super.execDisposeForm();
+
+ if (m_smartFieldListener != null) {
+ getSmartField().removePropertyChangeListener(m_smartFieldListener);
+ m_smartFieldListener = null;
+ }
+ }
+
+ @Override
+ protected int getConfiguredDisplayHint() {
+ return DISPLAY_HINT_DIALOG;
+ }
+
+ @Override
+ protected boolean getConfiguredModal() {
+ return true;
+ }
+
+ @Override
+ protected boolean getConfiguredAskIfNeedSave() {
+ return true;
+ }
+
+ @Override
+ protected void injectResultTableMenus(List<IMenu> menuList) {
+ super.injectResultTableMenus(menuList);
+
+ List<IMenu> smartFieldMenus = Arrays.asList(getSmartField().getMenus());
+ menuList.addAll(smartFieldMenus);
+ }
+
+ @Override
+ protected void execResultTableRowClicked(ITableRow row) throws ProcessingException {
+ // nop. Clicking a row must NOT close the form.
+ }
+
+ private void acceptProposal() throws ProcessingException {
+ m_acceptingProposal = true;
+ try {
+ LookupRow lookupRow = getAcceptedProposal();
+ if (lookupRow != null) {
+ getSmartField().acceptProposal(lookupRow);
+ }
+ }
+ finally {
+ m_acceptingProposal = false;
+ }
+ }
+
+ @Override
+ public LookupRow getAcceptedProposal() throws ProcessingException {
+ LookupRow row = getSelectedLookupRow();
+ if (row != null && row.isEnabled()) {
+ return row;
+ }
+ else if (getSmartField().isAllowCustomText()) {
+ return new CustomTextLookupRow(getFilterField().getValue());
+ }
+ else {
+ // With the mobile smartfield deleting a value is only possible by not selecting any value.
+ // The deletion of the value is achieved by returning an empty lookup row.
+ return ISmartField.EMPTY_LOOKUP_ROW;
+ }
+ }
+
+ public FilterField getFilterField() {
+ return getFieldByClass(FilterField.class);
+ }
+
+ public class MainBox extends SmartTableForm.MainBox {
+
+ @Override
+ protected int getConfiguredHeightInPixel() {
+ return 400;
+ }
+
+ @Order(1)
+ public class GroupBox extends AbstractGroupBox {
+
+ @Override
+ protected boolean getConfiguredBorderVisible() {
+ return true;
+ }
+
+ @Order(1)
+ public class FilterField extends AbstractStringField {
+
+ @Override
+ protected boolean getConfiguredLabelVisible() {
+ return false;
+ }
+
+ @Override
+ protected boolean getConfiguredValidateOnAnyKey() {
+ return true;
+ }
+
+ @Override
+ protected void execChangedValue() throws ProcessingException {
+ setSearchText(getValue());
+ update(false, false);
+ }
+
+ }
+ }
+
+ @Order(99)
+ public class BackButton extends AbstractBackButton {
+
+ }
+
+ }
+
+ private void handleTableRowsUpdated(ITableRow[] rows) {
+ if (rows != null && rows.length > 0) {
+ try {
+ //Accept proposal if a row gets checked. This makes sure the smartfield menus work.
+ acceptProposal();
+ }
+ catch (ProcessingException e) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ }
+ }
+
+ private class P_TableListener extends TableAdapter {
+
+ @Override
+ public void tableChanged(TableEvent e) {
+ switch (e.getType()) {
+ case TableEvent.TYPE_ROWS_UPDATED: {
+ handleTableRowsUpdated(e.getRows());
+ break;
+ }
+ }
+ }
+
+ }
+
+ /**
+ * Updates the {@link FilterField} with the display text of the smartfield if the value gets changed externally (e.g.
+ * by a smartfield menu action).
+ */
+ private class P_SmartFieldListener implements PropertyChangeListener {
+
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (ISmartField.PROP_VALUE.equals(evt.getPropertyName())) {
+ if (!m_acceptingProposal) {
+ getFilterField().setValue(getSmartField().getDisplayText());
+ }
+ }
+ }
+
+ }
+
+ private class P_FormListener implements FormListener {
+
+ @Override
+ public void formChanged(FormEvent e) throws ProcessingException {
+ switch (e.getType()) {
+ case FormEvent.TYPE_CLOSED: {
+ if (e.getForm() != MobileSmartTableForm.this) {
+ return;
+ }
+
+ removeFormListener(this);
+ if (getCloseSystemType() == IButton.SYSTEM_TYPE_OK) {
+ LookupRow row = getAcceptedProposal();
+ if (row instanceof CustomTextLookupRow) {
+ // Setting the value is done by AbstractSmartField.P_ProposalFormListener
+ // Unfortunately, if the value is not valid, the display text is not updated as well.
+ // That's why it is set here
+ getSmartField().setDisplayText(row.getText());
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/smartfield/MobileSmartTreeForm.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/smartfield/MobileSmartTreeForm.java
index d7d8aec4dd..25f84277a0 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/smartfield/MobileSmartTreeForm.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/smartfield/MobileSmartTreeForm.java
@@ -1,261 +1,261 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.form.fields.smartfield;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.mobile.ui.form.fields.button.AbstractBackButton;
-import org.eclipse.scout.rt.client.mobile.ui.form.fields.smartfield.MobileSmartTreeForm.MainBox.GroupBox.FilterField;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
-import org.eclipse.scout.rt.client.ui.basic.tree.TreeAdapter;
-import org.eclipse.scout.rt.client.ui.basic.tree.TreeEvent;
-import org.eclipse.scout.rt.client.ui.form.FormEvent;
-import org.eclipse.scout.rt.client.ui.form.FormListener;
-import org.eclipse.scout.rt.client.ui.form.fields.GridData;
-import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
-import org.eclipse.scout.rt.client.ui.form.fields.smartfield.ISmartField;
-import org.eclipse.scout.rt.client.ui.form.fields.smartfield.SmartTreeForm;
-import org.eclipse.scout.rt.client.ui.form.fields.stringfield.AbstractStringField;
-import org.eclipse.scout.rt.shared.TEXTS;
-import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
-import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
-import org.eclipse.scout.service.SERVICES;
-
-/**
- * @since 3.9.0
- */
-public class MobileSmartTreeForm extends SmartTreeForm {
- private P_SmartFieldListener m_smartFieldListener;
- private boolean m_acceptingProposal;
-
- public MobileSmartTreeForm(ISmartField<?> smartField) throws ProcessingException {
- super(smartField);
- }
-
- @Override
- protected void initConfig() throws ProcessingException {
- super.initConfig();
-
- String title = getSmartField().getLabel();
- if (StringUtility.hasText(title)) {
- title = TEXTS.get("MobileSmartFormTitle", title);
- }
- else {
- title = TEXTS.get("MobileSmartFormTitleDefault");
- }
- setTitle(title);
- getResultTreeField().getTree().setCheckable(true);
- getResultTreeField().getTree().addTreeListener(new P_TreeListener());
-
- GridData treeFieldGridDataHints = getResultTreeField().getGridDataHints();
- treeFieldGridDataHints.useUiHeight = false;
- treeFieldGridDataHints.useUiWidth = false;
- treeFieldGridDataHints.h = 2;
- treeFieldGridDataHints.fillVertical = true;
- getResultTreeField().setGridDataHints(treeFieldGridDataHints);
-
- addFormListener(new P_FormListener());
- if (m_smartFieldListener == null) {
- m_smartFieldListener = new P_SmartFieldListener();
- getSmartField().addPropertyChangeListener(m_smartFieldListener);
- }
- }
-
- @Override
- protected void execDisposeForm() throws ProcessingException {
- super.execDisposeForm();
-
- if (m_smartFieldListener != null) {
- getSmartField().removePropertyChangeListener(m_smartFieldListener);
- m_smartFieldListener = null;
- }
- }
-
- @Override
- protected int getConfiguredDisplayHint() {
- return DISPLAY_HINT_DIALOG;
- }
-
- @Override
- protected boolean getConfiguredModal() {
- return true;
- }
-
- @Override
- protected boolean getConfiguredAskIfNeedSave() {
- return true;
- }
-
- @Override
- protected void injectResultTreeMenus(List<IMenu> menuList) {
- super.injectResultTreeMenus(menuList);
-
- List<IMenu> smartFieldMenus = Arrays.asList(getSmartField().getMenus());
- menuList.addAll(smartFieldMenus);
- }
-
- @Override
- protected void execResultTreeNodeClick(ITreeNode node) throws ProcessingException {
- // nop. Clicking a node must NOT close the form.
- }
-
- private void acceptProposal() throws ProcessingException {
- m_acceptingProposal = true;
- try {
- LookupRow lookupRow = getAcceptedProposal();
- if (lookupRow != null) {
- getSmartField().acceptProposal(lookupRow);
- }
- }
- finally {
- m_acceptingProposal = false;
- }
- }
-
- @Override
- public LookupRow getAcceptedProposal() throws ProcessingException {
- LookupRow row = getSelectedLookupRow();
- if (row != null && row.isEnabled()) {
- return row;
- }
- else if (getSmartField().isAllowCustomText()) {
- return new CustomTextLookupRow(getFilterField().getValue());
- }
- else {
- // With the mobile smartfield deleting a value is only possible by not selecting any value.
- // The deletion of the value is achieved by returning an empty lookup row.
- return ISmartField.EMPTY_LOOKUP_ROW;
- }
- }
-
- public FilterField getFilterField() {
- return getFieldByClass(FilterField.class);
- }
-
- public class MainBox extends SmartTreeForm.MainBox {
-
- @Override
- protected int getConfiguredHeightInPixel() {
- return 400;
- }
-
- @Order(1)
- public class GroupBox extends AbstractGroupBox {
-
- @Override
- protected boolean getConfiguredBorderVisible() {
- return true;
- }
-
- @Order(1)
- public class FilterField extends AbstractStringField {
-
- @Override
- protected boolean getConfiguredLabelVisible() {
- return false;
- }
-
- @Override
- protected boolean getConfiguredValidateOnAnyKey() {
- return true;
- }
-
- @Override
- protected void execChangedValue() throws ProcessingException {
- setSearchText(getValue());
- update(false, false);
- }
-
- }
- }
-
- @Order(99)
- public class BackButton extends AbstractBackButton {
-
- }
- }
-
- private void handleTreeNodesUpdated(ITreeNode[] nodes) {
- if (nodes != null && nodes.length > 0) {
- try {
- //Accept proposal if a node gets checked. This makes sure the smartfield menus work.
- acceptProposal();
- }
- catch (ProcessingException e) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- }
- }
-
- private class P_TreeListener extends TreeAdapter {
-
- @Override
- public void treeChanged(TreeEvent e) {
- switch (e.getType()) {
- case TreeEvent.TYPE_NODES_UPDATED: {
- handleTreeNodesUpdated(e.getNodes());
- break;
- }
- }
- }
- }
-
- /**
- * Updates the {@link FilterField} with the display text of the smartfield if the value gets changed externally (e.g.
- * by a smartfield menu action).
- */
- private class P_SmartFieldListener implements PropertyChangeListener {
-
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- if (ISmartField.PROP_VALUE.equals(evt.getPropertyName())) {
- if (!m_acceptingProposal) {
- getFilterField().setValue(getSmartField().getDisplayText());
- }
- }
- }
-
- }
-
- private class P_FormListener implements FormListener {
- @Override
- public void formChanged(FormEvent e) throws ProcessingException {
- switch (e.getType()) {
- case FormEvent.TYPE_CLOSED: {
- if (e.getForm() != MobileSmartTreeForm.this) {
- return;
- }
-
- removeFormListener(this);
- if (getCloseSystemType() == IButton.SYSTEM_TYPE_OK) {
- LookupRow row = getAcceptedProposal();
- if (row instanceof CustomTextLookupRow) {
- // Setting the value is done by AbstractSmartField.P_ProposalFormListener
- // Unfortunately, if the value is not valid, the display text is not updated as well.
- // That's why it is set here
- getSmartField().setDisplayText(row.getText());
- }
- }
- break;
- }
- }
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.form.fields.smartfield;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.mobile.ui.form.fields.button.AbstractBackButton;
+import org.eclipse.scout.rt.client.mobile.ui.form.fields.smartfield.MobileSmartTreeForm.MainBox.GroupBox.FilterField;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
+import org.eclipse.scout.rt.client.ui.basic.tree.TreeAdapter;
+import org.eclipse.scout.rt.client.ui.basic.tree.TreeEvent;
+import org.eclipse.scout.rt.client.ui.form.FormEvent;
+import org.eclipse.scout.rt.client.ui.form.FormListener;
+import org.eclipse.scout.rt.client.ui.form.fields.GridData;
+import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
+import org.eclipse.scout.rt.client.ui.form.fields.smartfield.ISmartField;
+import org.eclipse.scout.rt.client.ui.form.fields.smartfield.SmartTreeForm;
+import org.eclipse.scout.rt.client.ui.form.fields.stringfield.AbstractStringField;
+import org.eclipse.scout.rt.shared.TEXTS;
+import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
+import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
+import org.eclipse.scout.service.SERVICES;
+
+/**
+ * @since 3.9.0
+ */
+public class MobileSmartTreeForm extends SmartTreeForm {
+ private P_SmartFieldListener m_smartFieldListener;
+ private boolean m_acceptingProposal;
+
+ public MobileSmartTreeForm(ISmartField<?> smartField) throws ProcessingException {
+ super(smartField);
+ }
+
+ @Override
+ protected void initConfig() throws ProcessingException {
+ super.initConfig();
+
+ String title = getSmartField().getLabel();
+ if (StringUtility.hasText(title)) {
+ title = TEXTS.get("MobileSmartFormTitle", title);
+ }
+ else {
+ title = TEXTS.get("MobileSmartFormTitleDefault");
+ }
+ setTitle(title);
+ getResultTreeField().getTree().setCheckable(true);
+ getResultTreeField().getTree().addTreeListener(new P_TreeListener());
+
+ GridData treeFieldGridDataHints = getResultTreeField().getGridDataHints();
+ treeFieldGridDataHints.useUiHeight = false;
+ treeFieldGridDataHints.useUiWidth = false;
+ treeFieldGridDataHints.h = 2;
+ treeFieldGridDataHints.fillVertical = true;
+ getResultTreeField().setGridDataHints(treeFieldGridDataHints);
+
+ addFormListener(new P_FormListener());
+ if (m_smartFieldListener == null) {
+ m_smartFieldListener = new P_SmartFieldListener();
+ getSmartField().addPropertyChangeListener(m_smartFieldListener);
+ }
+ }
+
+ @Override
+ protected void execDisposeForm() throws ProcessingException {
+ super.execDisposeForm();
+
+ if (m_smartFieldListener != null) {
+ getSmartField().removePropertyChangeListener(m_smartFieldListener);
+ m_smartFieldListener = null;
+ }
+ }
+
+ @Override
+ protected int getConfiguredDisplayHint() {
+ return DISPLAY_HINT_DIALOG;
+ }
+
+ @Override
+ protected boolean getConfiguredModal() {
+ return true;
+ }
+
+ @Override
+ protected boolean getConfiguredAskIfNeedSave() {
+ return true;
+ }
+
+ @Override
+ protected void injectResultTreeMenus(List<IMenu> menuList) {
+ super.injectResultTreeMenus(menuList);
+
+ List<IMenu> smartFieldMenus = Arrays.asList(getSmartField().getMenus());
+ menuList.addAll(smartFieldMenus);
+ }
+
+ @Override
+ protected void execResultTreeNodeClick(ITreeNode node) throws ProcessingException {
+ // nop. Clicking a node must NOT close the form.
+ }
+
+ private void acceptProposal() throws ProcessingException {
+ m_acceptingProposal = true;
+ try {
+ LookupRow lookupRow = getAcceptedProposal();
+ if (lookupRow != null) {
+ getSmartField().acceptProposal(lookupRow);
+ }
+ }
+ finally {
+ m_acceptingProposal = false;
+ }
+ }
+
+ @Override
+ public LookupRow getAcceptedProposal() throws ProcessingException {
+ LookupRow row = getSelectedLookupRow();
+ if (row != null && row.isEnabled()) {
+ return row;
+ }
+ else if (getSmartField().isAllowCustomText()) {
+ return new CustomTextLookupRow(getFilterField().getValue());
+ }
+ else {
+ // With the mobile smartfield deleting a value is only possible by not selecting any value.
+ // The deletion of the value is achieved by returning an empty lookup row.
+ return ISmartField.EMPTY_LOOKUP_ROW;
+ }
+ }
+
+ public FilterField getFilterField() {
+ return getFieldByClass(FilterField.class);
+ }
+
+ public class MainBox extends SmartTreeForm.MainBox {
+
+ @Override
+ protected int getConfiguredHeightInPixel() {
+ return 400;
+ }
+
+ @Order(1)
+ public class GroupBox extends AbstractGroupBox {
+
+ @Override
+ protected boolean getConfiguredBorderVisible() {
+ return true;
+ }
+
+ @Order(1)
+ public class FilterField extends AbstractStringField {
+
+ @Override
+ protected boolean getConfiguredLabelVisible() {
+ return false;
+ }
+
+ @Override
+ protected boolean getConfiguredValidateOnAnyKey() {
+ return true;
+ }
+
+ @Override
+ protected void execChangedValue() throws ProcessingException {
+ setSearchText(getValue());
+ update(false, false);
+ }
+
+ }
+ }
+
+ @Order(99)
+ public class BackButton extends AbstractBackButton {
+
+ }
+ }
+
+ private void handleTreeNodesUpdated(ITreeNode[] nodes) {
+ if (nodes != null && nodes.length > 0) {
+ try {
+ //Accept proposal if a node gets checked. This makes sure the smartfield menus work.
+ acceptProposal();
+ }
+ catch (ProcessingException e) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ }
+ }
+
+ private class P_TreeListener extends TreeAdapter {
+
+ @Override
+ public void treeChanged(TreeEvent e) {
+ switch (e.getType()) {
+ case TreeEvent.TYPE_NODES_UPDATED: {
+ handleTreeNodesUpdated(e.getNodes());
+ break;
+ }
+ }
+ }
+ }
+
+ /**
+ * Updates the {@link FilterField} with the display text of the smartfield if the value gets changed externally (e.g.
+ * by a smartfield menu action).
+ */
+ private class P_SmartFieldListener implements PropertyChangeListener {
+
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (ISmartField.PROP_VALUE.equals(evt.getPropertyName())) {
+ if (!m_acceptingProposal) {
+ getFilterField().setValue(getSmartField().getDisplayText());
+ }
+ }
+ }
+
+ }
+
+ private class P_FormListener implements FormListener {
+ @Override
+ public void formChanged(FormEvent e) throws ProcessingException {
+ switch (e.getType()) {
+ case FormEvent.TYPE_CLOSED: {
+ if (e.getForm() != MobileSmartTreeForm.this) {
+ return;
+ }
+
+ removeFormListener(this);
+ if (getCloseSystemType() == IButton.SYSTEM_TYPE_OK) {
+ LookupRow row = getAcceptedProposal();
+ if (row instanceof CustomTextLookupRow) {
+ // Setting the value is done by AbstractSmartField.P_ProposalFormListener
+ // Unfortunately, if the value is not valid, the display text is not updated as well.
+ // That's why it is set here
+ getSmartField().setDisplayText(row.getText());
+ }
+ }
+ break;
+ }
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/tabbox/TabBoxGroupBox.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/tabbox/TabBoxGroupBox.java
index d08ca5f373..f51f5a4f6e 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/tabbox/TabBoxGroupBox.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/tabbox/TabBoxGroupBox.java
@@ -1,66 +1,66 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.form.fields.tabbox;
-
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.mobile.ui.form.fields.FormFieldPropertyDelegator;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox;
-import org.eclipse.scout.rt.client.ui.form.fields.tabbox.ITabBox;
-
-/**
- * Group box which represents a {@link ITabBox} and contains a {@link TabBoxTableField} to represent the tab items.
- *
- * @since 3.9.0
- */
-public class TabBoxGroupBox extends AbstractGroupBox {
- private FormFieldPropertyDelegator<ITabBox, IGroupBox> m_propertyDelegator;
-
- public TabBoxGroupBox(ITabBox tabBox) {
- super(false);
- m_propertyDelegator = new FormFieldPropertyDelegator<ITabBox, IGroupBox>(tabBox, this);
- callInitializer();
- setFormInternal(tabBox.getForm());
- rebuildFieldGrid();
- }
-
- @Override
- protected void initConfig() {
- super.initConfig();
-
- m_propertyDelegator.init();
- }
-
- @Override
- protected void execInitField() throws ProcessingException {
- getTableField().initField();
- }
-
- public ITabBox getTabBox() {
- return m_propertyDelegator.getSender();
- }
-
- public TableField getTableField() {
- return getFieldByClass(TableField.class);
- }
-
- @Order(10)
- public class TableField extends TabBoxTableField {
-
- @Override
- public ITabBox getConfiguredTabBox() {
- return TabBoxGroupBox.this.getTabBox();
- }
-
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.form.fields.tabbox;
+
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.mobile.ui.form.fields.FormFieldPropertyDelegator;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox;
+import org.eclipse.scout.rt.client.ui.form.fields.tabbox.ITabBox;
+
+/**
+ * Group box which represents a {@link ITabBox} and contains a {@link TabBoxTableField} to represent the tab items.
+ *
+ * @since 3.9.0
+ */
+public class TabBoxGroupBox extends AbstractGroupBox {
+ private FormFieldPropertyDelegator<ITabBox, IGroupBox> m_propertyDelegator;
+
+ public TabBoxGroupBox(ITabBox tabBox) {
+ super(false);
+ m_propertyDelegator = new FormFieldPropertyDelegator<ITabBox, IGroupBox>(tabBox, this);
+ callInitializer();
+ setFormInternal(tabBox.getForm());
+ rebuildFieldGrid();
+ }
+
+ @Override
+ protected void initConfig() {
+ super.initConfig();
+
+ m_propertyDelegator.init();
+ }
+
+ @Override
+ protected void execInitField() throws ProcessingException {
+ getTableField().initField();
+ }
+
+ public ITabBox getTabBox() {
+ return m_propertyDelegator.getSender();
+ }
+
+ public TableField getTableField() {
+ return getFieldByClass(TableField.class);
+ }
+
+ @Order(10)
+ public class TableField extends TabBoxTableField {
+
+ @Override
+ public ITabBox getConfiguredTabBox() {
+ return TabBoxGroupBox.this.getTabBox();
+ }
+
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/tabbox/TabBoxTableField.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/tabbox/TabBoxTableField.java
index 671afa7977..a836180bed 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/tabbox/TabBoxTableField.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/tabbox/TabBoxTableField.java
@@ -1,169 +1,169 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.form.fields.tabbox;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.mobile.ui.basic.table.AbstractMobileTable;
-import org.eclipse.scout.rt.client.mobile.ui.basic.table.ClearTableSelectionFormCloseListener;
-import org.eclipse.scout.rt.client.mobile.ui.form.fields.tabbox.TabBoxTableField.Table;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractStringColumn;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox;
-import org.eclipse.scout.rt.client.ui.form.fields.tabbox.ITabBox;
-import org.eclipse.scout.rt.client.ui.form.fields.tablefield.AbstractTableField;
-import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
-import org.eclipse.scout.service.SERVICES;
-
-/**
- * @since 3.9.0
- */
-public class TabBoxTableField extends AbstractTableField<Table> {
- private ITabBox m_tabBox;
-
- public ITabBox getTabBox() {
- return m_tabBox;
- }
-
- @Override
- protected void initConfig() {
- super.initConfig();
-
- m_tabBox = getConfiguredTabBox();
- }
-
- public ITabBox getConfiguredTabBox() {
- return null;
- }
-
- @Override
- protected void execInitField() throws ProcessingException {
- if (m_tabBox == null) {
- return;
- }
-
- for (IGroupBox groupBox : m_tabBox.getGroupBoxes()) {
- groupBox.addPropertyChangeListener(new P_TabPropertyChangeListener());
- }
-
- rebuildTableRows();
- }
-
- public void rebuildTableRows() throws ProcessingException {
- if (m_tabBox == null) {
- return;
- }
-
- getTable().discardAllRows();
-
- for (IGroupBox groupBox : m_tabBox.getGroupBoxes()) {
- if (groupBox.isVisible()) {
- getTable().addRowByArray(new Object[]{groupBox, groupBox.getLabel()});
- }
- }
-
- getParentGroupBox().rebuildFieldGrid();
- }
-
- @Override
- protected boolean getConfiguredLabelVisible() {
- return false;
- }
-
- @Override
- protected boolean getConfiguredGridUseUiHeight() {
- return true;
- }
-
- @Order(10.0f)
- public class Table extends AbstractMobileTable {
-
- @Override
- protected void execRowsSelected(ITableRow[] rows) throws ProcessingException {
- if (getSelectedRow() == null) {
- return;
- }
-
- IGroupBox tab = getTabColumn().getValue(getSelectedRow());
- TabForm form = new TabForm(tab);
- form.setDisplayHint(getForm().getDisplayHint());
- form.setDisplayViewId(getForm().getDisplayViewId());
- form.setModal(IForm.DISPLAY_HINT_DIALOG == form.getDisplayHint());
- form.start();
- form.addFormListener(new ClearTableSelectionFormCloseListener(this));
- }
-
- @Override
- protected boolean execIsAutoCreateTableRowForm() {
- return false;
- }
-
- @Override
- protected boolean getConfiguredSortEnabled() {
- return false;
- }
-
- @Override
- protected boolean getConfiguredAutoResizeColumns() {
- return true;
- }
-
- @Override
- protected boolean getConfiguredMultiSelect() {
- return false;
- }
-
- public TabColumn getTabColumn() {
- return getColumnSet().getColumnByClass(TabColumn.class);
- }
-
- public LabelColumn getLabelColumn() {
- return getColumnSet().getColumnByClass(LabelColumn.class);
- }
-
- @Order(1)
- public class TabColumn extends AbstractColumn<IGroupBox> {
-
- @Override
- protected boolean getConfiguredDisplayable() {
- return false;
- }
-
- }
-
- @Order(2)
- public class LabelColumn extends AbstractStringColumn {
-
- }
- }
-
- private class P_TabPropertyChangeListener implements PropertyChangeListener {
-
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- try {
- if (IGroupBox.PROP_VISIBLE.equals(evt.getPropertyName())) {
- rebuildTableRows();
- }
- }
- catch (ProcessingException e) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
-
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.form.fields.tabbox;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.mobile.ui.basic.table.AbstractMobileTable;
+import org.eclipse.scout.rt.client.mobile.ui.basic.table.ClearTableSelectionFormCloseListener;
+import org.eclipse.scout.rt.client.mobile.ui.form.fields.tabbox.TabBoxTableField.Table;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractStringColumn;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox;
+import org.eclipse.scout.rt.client.ui.form.fields.tabbox.ITabBox;
+import org.eclipse.scout.rt.client.ui.form.fields.tablefield.AbstractTableField;
+import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
+import org.eclipse.scout.service.SERVICES;
+
+/**
+ * @since 3.9.0
+ */
+public class TabBoxTableField extends AbstractTableField<Table> {
+ private ITabBox m_tabBox;
+
+ public ITabBox getTabBox() {
+ return m_tabBox;
+ }
+
+ @Override
+ protected void initConfig() {
+ super.initConfig();
+
+ m_tabBox = getConfiguredTabBox();
+ }
+
+ public ITabBox getConfiguredTabBox() {
+ return null;
+ }
+
+ @Override
+ protected void execInitField() throws ProcessingException {
+ if (m_tabBox == null) {
+ return;
+ }
+
+ for (IGroupBox groupBox : m_tabBox.getGroupBoxes()) {
+ groupBox.addPropertyChangeListener(new P_TabPropertyChangeListener());
+ }
+
+ rebuildTableRows();
+ }
+
+ public void rebuildTableRows() throws ProcessingException {
+ if (m_tabBox == null) {
+ return;
+ }
+
+ getTable().discardAllRows();
+
+ for (IGroupBox groupBox : m_tabBox.getGroupBoxes()) {
+ if (groupBox.isVisible()) {
+ getTable().addRowByArray(new Object[]{groupBox, groupBox.getLabel()});
+ }
+ }
+
+ getParentGroupBox().rebuildFieldGrid();
+ }
+
+ @Override
+ protected boolean getConfiguredLabelVisible() {
+ return false;
+ }
+
+ @Override
+ protected boolean getConfiguredGridUseUiHeight() {
+ return true;
+ }
+
+ @Order(10.0f)
+ public class Table extends AbstractMobileTable {
+
+ @Override
+ protected void execRowsSelected(ITableRow[] rows) throws ProcessingException {
+ if (getSelectedRow() == null) {
+ return;
+ }
+
+ IGroupBox tab = getTabColumn().getValue(getSelectedRow());
+ TabForm form = new TabForm(tab);
+ form.setDisplayHint(getForm().getDisplayHint());
+ form.setDisplayViewId(getForm().getDisplayViewId());
+ form.setModal(IForm.DISPLAY_HINT_DIALOG == form.getDisplayHint());
+ form.start();
+ form.addFormListener(new ClearTableSelectionFormCloseListener(this));
+ }
+
+ @Override
+ protected boolean execIsAutoCreateTableRowForm() {
+ return false;
+ }
+
+ @Override
+ protected boolean getConfiguredSortEnabled() {
+ return false;
+ }
+
+ @Override
+ protected boolean getConfiguredAutoResizeColumns() {
+ return true;
+ }
+
+ @Override
+ protected boolean getConfiguredMultiSelect() {
+ return false;
+ }
+
+ public TabColumn getTabColumn() {
+ return getColumnSet().getColumnByClass(TabColumn.class);
+ }
+
+ public LabelColumn getLabelColumn() {
+ return getColumnSet().getColumnByClass(LabelColumn.class);
+ }
+
+ @Order(1)
+ public class TabColumn extends AbstractColumn<IGroupBox> {
+
+ @Override
+ protected boolean getConfiguredDisplayable() {
+ return false;
+ }
+
+ }
+
+ @Order(2)
+ public class LabelColumn extends AbstractStringColumn {
+
+ }
+ }
+
+ private class P_TabPropertyChangeListener implements PropertyChangeListener {
+
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ try {
+ if (IGroupBox.PROP_VISIBLE.equals(evt.getPropertyName())) {
+ rebuildTableRows();
+ }
+ }
+ catch (ProcessingException e) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/tabbox/TabForm.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/tabbox/TabForm.java
index dfa8bf6fb1..5fe109eea3 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/tabbox/TabForm.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/tabbox/TabForm.java
@@ -1,82 +1,82 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.form.fields.tabbox;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.mobile.Icons;
-import org.eclipse.scout.rt.client.mobile.ui.form.fields.groupbox.GroupBoxPropertyDelegator;
-import org.eclipse.scout.rt.client.ui.form.AbstractForm;
-import org.eclipse.scout.rt.client.ui.form.AbstractFormHandler;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractCloseButton;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox;
-
-public class TabForm extends AbstractForm {
- private IGroupBox m_tabGroupBox;
-
- public TabForm(IGroupBox tabGroupBox) throws ProcessingException {
- super(false);
- m_tabGroupBox = tabGroupBox;
- callInitializer();
- }
-
- @Order(10)
- public class Mainbox extends AbstractGroupBox {
-
- @Override
- protected void initConfig() {
- super.initConfig();
-
- new GroupBoxPropertyDelegator(m_tabGroupBox, this).init();
- }
-
- @Override
- protected void injectFieldsInternal(List<IFormField> fieldList) {
- super.injectFieldsInternal(fieldList);
-
- fieldList.addAll(Arrays.asList(m_tabGroupBox.getFields()));
- }
-
- @Order(10)
- public class CloseButton extends AbstractCloseButton {
- @Override
- protected String getConfiguredLabel() {
- return null;
- }
-
- @Override
- protected String getConfiguredIconId() {
- return Icons.BackAction;
- }
- }
-
- }
-
- public void start() throws ProcessingException {
- startInternal(new FormHandler());
- }
-
- @Order(20.0f)
- public class FormHandler extends AbstractFormHandler {
-
- @Override
- protected void execLoad() throws ProcessingException {
- setTitle(m_tabGroupBox.getLabel());
- m_tabGroupBox.setBorderDecoration(IGroupBox.BORDER_DECORATION_EMPTY);
- }
-
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.form.fields.tabbox;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.mobile.Icons;
+import org.eclipse.scout.rt.client.mobile.ui.form.fields.groupbox.GroupBoxPropertyDelegator;
+import org.eclipse.scout.rt.client.ui.form.AbstractForm;
+import org.eclipse.scout.rt.client.ui.form.AbstractFormHandler;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractCloseButton;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox;
+
+public class TabForm extends AbstractForm {
+ private IGroupBox m_tabGroupBox;
+
+ public TabForm(IGroupBox tabGroupBox) throws ProcessingException {
+ super(false);
+ m_tabGroupBox = tabGroupBox;
+ callInitializer();
+ }
+
+ @Order(10)
+ public class Mainbox extends AbstractGroupBox {
+
+ @Override
+ protected void initConfig() {
+ super.initConfig();
+
+ new GroupBoxPropertyDelegator(m_tabGroupBox, this).init();
+ }
+
+ @Override
+ protected void injectFieldsInternal(List<IFormField> fieldList) {
+ super.injectFieldsInternal(fieldList);
+
+ fieldList.addAll(Arrays.asList(m_tabGroupBox.getFields()));
+ }
+
+ @Order(10)
+ public class CloseButton extends AbstractCloseButton {
+ @Override
+ protected String getConfiguredLabel() {
+ return null;
+ }
+
+ @Override
+ protected String getConfiguredIconId() {
+ return Icons.BackAction;
+ }
+ }
+
+ }
+
+ public void start() throws ProcessingException {
+ startInternal(new FormHandler());
+ }
+
+ @Order(20.0f)
+ public class FormHandler extends AbstractFormHandler {
+
+ @Override
+ protected void execLoad() throws ProcessingException {
+ setTitle(m_tabGroupBox.getLabel());
+ m_tabGroupBox.setBorderDecoration(IGroupBox.BORDER_DECORATION_EMPTY);
+ }
+
+ }
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/table/AbstractMobileTableField.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/table/AbstractMobileTableField.java
index 7ba74e8583..6455c07e23 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/table/AbstractMobileTableField.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/table/AbstractMobileTableField.java
@@ -1,42 +1,42 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.form.fields.table;
-
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.form.fields.tablefield.AbstractTableField;
-
-/**
- * @since 3.9.0
- */
-public abstract class AbstractMobileTableField<T extends ITable> extends AbstractTableField<T> implements IMobileTableField<T> {
-
- @Override
- protected void initConfig() {
- super.initConfig();
-
- setActionBarVisible(getConfiguredActionBarVisible());
- }
-
- protected boolean getConfiguredActionBarVisible() {
- return true;
- }
-
- @Override
- public boolean isActionBarVisible() {
- return propertySupport.getPropertyBool(PROP_ACTION_BAR_VISIBLE);
- }
-
- @Override
- public void setActionBarVisible(boolean visible) {
- propertySupport.setPropertyBool(PROP_ACTION_BAR_VISIBLE, visible);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.form.fields.table;
+
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.form.fields.tablefield.AbstractTableField;
+
+/**
+ * @since 3.9.0
+ */
+public abstract class AbstractMobileTableField<T extends ITable> extends AbstractTableField<T> implements IMobileTableField<T> {
+
+ @Override
+ protected void initConfig() {
+ super.initConfig();
+
+ setActionBarVisible(getConfiguredActionBarVisible());
+ }
+
+ protected boolean getConfiguredActionBarVisible() {
+ return true;
+ }
+
+ @Override
+ public boolean isActionBarVisible() {
+ return propertySupport.getPropertyBool(PROP_ACTION_BAR_VISIBLE);
+ }
+
+ @Override
+ public void setActionBarVisible(boolean visible) {
+ propertySupport.setPropertyBool(PROP_ACTION_BAR_VISIBLE, visible);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/table/IMobileTableField.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/table/IMobileTableField.java
index 784a736f15..0f666371f6 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/table/IMobileTableField.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/fields/table/IMobileTableField.java
@@ -1,25 +1,25 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.form.fields.table;
-
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.form.fields.tablefield.ITableField;
-
-/**
- * @since 3.9.0
- */
-public interface IMobileTableField<T extends ITable> extends ITableField<T> {
- String PROP_ACTION_BAR_VISIBLE = "actionBarVisible";
-
- boolean isActionBarVisible();
-
- void setActionBarVisible(boolean visible);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.form.fields.table;
+
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.form.fields.tablefield.ITableField;
+
+/**
+ * @since 3.9.0
+ */
+public interface IMobileTableField<T extends ITable> extends ITableField<T> {
+ String PROP_ACTION_BAR_VISIBLE = "actionBarVisible";
+
+ boolean isActionBarVisible();
+
+ void setActionBarVisible(boolean visible);
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/AutoLeafPageWithNodes.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/AutoLeafPageWithNodes.java
index 8c5154f50b..67c5912156 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/AutoLeafPageWithNodes.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/AutoLeafPageWithNodes.java
@@ -1,90 +1,90 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.form.outline;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.mobile.ui.basic.table.form.TableRowForm;
-import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.AbstractPageWithNodes;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-
-public class AutoLeafPageWithNodes extends AbstractPageWithNodes {
- private ITableRow m_tableRow;
- private IPage m_actualParentPage;
-
- public AutoLeafPageWithNodes(ITableRow row, IPage parentPage) {
- if (row == null) {
- throw new IllegalArgumentException("Row must not be null");
- }
-
- m_tableRow = row;
- m_actualParentPage = parentPage;
- }
-
- public ITableRow getTableRow() {
- return m_tableRow;
- }
-
- public IPage getActualParentPage() {
- return m_actualParentPage;
- }
-
- @Override
- protected void execInitPage() throws ProcessingException {
- Cell cell = getCellForUpdate();
- if (cell.getText() == null) {
- cell.setText(findAppropriateTitle());
- }
- if (cell.getIconId() == null) {
- cell.setIconId(m_tableRow.getIconId());
- }
- }
-
- private String findAppropriateTitle() {
- for (IColumn column : m_tableRow.getTable().getColumns()) {
- if (column.isVisible()) {
- return m_tableRow.getTable().getCell(m_tableRow, column).getText();
- }
- }
-
- return null;
- }
-
- @Override
- protected boolean getConfiguredTableVisible() {
- return false;
- }
-
- @Override
- protected boolean getConfiguredLeaf() {
- return true;
- }
-
- @Override
- protected void execPageActivated() throws ProcessingException {
- if (getDetailForm() == null) {
- TableRowForm form = new TableRowForm(m_tableRow);
- setDetailForm(form);
- form.start();
- }
- }
-
- @Override
- protected void execDisposePage() throws ProcessingException {
- super.execDisposePage();
- if (getDetailForm() != null) {
- getDetailForm().doClose();
- setDetailForm(null);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.form.outline;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.mobile.ui.basic.table.form.TableRowForm;
+import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.AbstractPageWithNodes;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+
+public class AutoLeafPageWithNodes extends AbstractPageWithNodes {
+ private ITableRow m_tableRow;
+ private IPage m_actualParentPage;
+
+ public AutoLeafPageWithNodes(ITableRow row, IPage parentPage) {
+ if (row == null) {
+ throw new IllegalArgumentException("Row must not be null");
+ }
+
+ m_tableRow = row;
+ m_actualParentPage = parentPage;
+ }
+
+ public ITableRow getTableRow() {
+ return m_tableRow;
+ }
+
+ public IPage getActualParentPage() {
+ return m_actualParentPage;
+ }
+
+ @Override
+ protected void execInitPage() throws ProcessingException {
+ Cell cell = getCellForUpdate();
+ if (cell.getText() == null) {
+ cell.setText(findAppropriateTitle());
+ }
+ if (cell.getIconId() == null) {
+ cell.setIconId(m_tableRow.getIconId());
+ }
+ }
+
+ private String findAppropriateTitle() {
+ for (IColumn column : m_tableRow.getTable().getColumns()) {
+ if (column.isVisible()) {
+ return m_tableRow.getTable().getCell(m_tableRow, column).getText();
+ }
+ }
+
+ return null;
+ }
+
+ @Override
+ protected boolean getConfiguredTableVisible() {
+ return false;
+ }
+
+ @Override
+ protected boolean getConfiguredLeaf() {
+ return true;
+ }
+
+ @Override
+ protected void execPageActivated() throws ProcessingException {
+ if (getDetailForm() == null) {
+ TableRowForm form = new TableRowForm(m_tableRow);
+ setDetailForm(form);
+ form.start();
+ }
+ }
+
+ @Override
+ protected void execDisposePage() throws ProcessingException {
+ super.execDisposePage();
+ if (getDetailForm() != null) {
+ getDetailForm().doClose();
+ setDetailForm(null);
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/AutoOutline.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/AutoOutline.java
index d21c21c4c2..a028c901e8 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/AutoOutline.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/AutoOutline.java
@@ -1,38 +1,38 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.form.outline;
-
-import java.util.Collection;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.desktop.outline.AbstractOutline;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-
-public class AutoOutline extends AbstractOutline {
- private IPage m_page;
-
- public AutoOutline(IPage page) {
- super(false);
- m_page = page;
- callInitializer();
- }
-
- @Override
- protected boolean getConfiguredRootNodeVisible() {
- return false;
- }
-
- @Override
- protected void execCreateChildPages(Collection<IPage> pageList) throws ProcessingException {
- pageList.add(m_page);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.form.outline;
+
+import java.util.Collection;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.desktop.outline.AbstractOutline;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+
+public class AutoOutline extends AbstractOutline {
+ private IPage m_page;
+
+ public AutoOutline(IPage page) {
+ super(false);
+ m_page = page;
+ callInitializer();
+ }
+
+ @Override
+ protected boolean getConfiguredRootNodeVisible() {
+ return false;
+ }
+
+ @Override
+ protected void execCreateChildPages(Collection<IPage> pageList) throws ProcessingException {
+ pageList.add(m_page);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/DefaultOutlineChooserForm.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/DefaultOutlineChooserForm.java
index af6909cbcb..394b6d1dfe 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/DefaultOutlineChooserForm.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/DefaultOutlineChooserForm.java
@@ -1,186 +1,186 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.form.outline;
-
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.mobile.ui.basic.table.AbstractMobileTable;
-import org.eclipse.scout.rt.client.mobile.ui.desktop.MobileDesktopUtility;
-import org.eclipse.scout.rt.client.mobile.ui.form.outline.DefaultOutlineChooserForm.MainBox.OutlinesTableField;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractStringColumn;
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
-import org.eclipse.scout.rt.client.ui.form.AbstractForm;
-import org.eclipse.scout.rt.client.ui.form.AbstractFormHandler;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
-import org.eclipse.scout.rt.client.ui.form.fields.tablefield.AbstractTableField;
-import org.eclipse.scout.rt.shared.AbstractIcons;
-import org.eclipse.scout.rt.shared.TEXTS;
-
-public class DefaultOutlineChooserForm extends AbstractForm implements IOutlineChooserForm {
-
- public DefaultOutlineChooserForm() throws ProcessingException {
- super();
- }
-
- @Override
- protected boolean getConfiguredAskIfNeedSave() {
- return false;
- }
-
- @Override
- protected int getConfiguredDisplayHint() {
- return DISPLAY_HINT_VIEW;
- }
-
- @Override
- protected String getConfiguredDisplayViewId() {
- return VIEW_ID_CENTER;
- }
-
- @Override
- protected String getConfiguredTitle() {
- return TEXTS.get("MobileOutlineChooserTitle");
- }
-
- public void startView() throws ProcessingException {
- startInternal(new ViewHandler());
- }
-
- public MainBox getMainBox() {
- return (MainBox) getRootGroupBox();
- }
-
- public OutlinesTableField getOutlinesTableField() {
- return getFieldByClass(OutlinesTableField.class);
- }
-
- @Order(10.0)
- public class MainBox extends AbstractGroupBox {
-
- @Override
- protected boolean getConfiguredBorderVisible() {
- return false;
- }
-
- @Order(10.0)
- public class OutlinesTableField extends AbstractTableField<OutlinesTableField.Table> {
-
- @Override
- protected boolean getConfiguredLabelVisible() {
- return false;
- }
-
- @Override
- protected int getConfiguredGridH() {
- return 2;
- }
-
- @Order(10.0)
- public class Table extends AbstractMobileTable {
-
- @Override
- protected boolean execIsAutoCreateTableRowForm() {
- return false;
- }
-
- @Override
- protected boolean getConfiguredAutoDiscardOnDelete() {
- return true;
- }
-
- @Override
- protected String getConfiguredDefaultIconId() {
- return AbstractIcons.TreeNode;
- }
-
- @Override
- protected boolean getConfiguredAutoResizeColumns() {
- return true;
- }
-
- @Override
- protected boolean getConfiguredSortEnabled() {
- return false;
- }
-
- public LabelColumn getLableColumn() {
- return getColumnSet().getColumnByClass(LabelColumn.class);
- }
-
- public OutlineColumn getOutlineColumn() {
- return getColumnSet().getColumnByClass(OutlineColumn.class);
- }
-
- @Override
- protected void execDecorateRow(ITableRow row) throws ProcessingException {
- final String outlineIcon = getOutlineColumn().getValue(row).getIconId();
- if (outlineIcon != null) {
- row.setIconId(outlineIcon);
- }
- }
-
- @Order(10.0)
- public class OutlineColumn extends AbstractColumn<IOutline> {
-
- @Override
- protected boolean getConfiguredDisplayable() {
- return false;
- }
- }
-
- @Order(20.0)
- public class LabelColumn extends AbstractStringColumn {
-
- }
-
- @Override
- protected void execRowsSelected(ITableRow[] rows) throws ProcessingException {
- if (rows == null || rows.length == 0) {
- return;
- }
-
- IOutline outline = getOutlineColumn().getValue(rows[0]);
-
- MobileDesktopUtility.activateOutline(outline);
- getDesktop().removeForm(DefaultOutlineChooserForm.this);
-
- clearSelectionDelayed();
- }
- }
- }
- }
-
- @Order(10.0)
- public class ViewHandler extends AbstractFormHandler {
-
- @Override
- protected void execLoad() throws ProcessingException {
- final OutlinesTableField.Table table = getOutlinesTableField().getTable();
-
- IOutline[] outlines = getDesktop().getAvailableOutlines();
- for (IOutline outline : outlines) {
- if (outline.isVisible() && outline.getRootNode() != null) {
- ITableRow row = table.createRow(new Object[]{outline, outline.getTitle()});
- row.setEnabled(outline.isEnabled());
- table.addRow(row);
- }
- }
- }
-
- @Override
- protected void execFinally() throws ProcessingException {
- final OutlinesTableField.Table table = getOutlinesTableField().getTable();
- table.discardAllRows();
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.form.outline;
+
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.mobile.ui.basic.table.AbstractMobileTable;
+import org.eclipse.scout.rt.client.mobile.ui.desktop.MobileDesktopUtility;
+import org.eclipse.scout.rt.client.mobile.ui.form.outline.DefaultOutlineChooserForm.MainBox.OutlinesTableField;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractStringColumn;
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
+import org.eclipse.scout.rt.client.ui.form.AbstractForm;
+import org.eclipse.scout.rt.client.ui.form.AbstractFormHandler;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
+import org.eclipse.scout.rt.client.ui.form.fields.tablefield.AbstractTableField;
+import org.eclipse.scout.rt.shared.AbstractIcons;
+import org.eclipse.scout.rt.shared.TEXTS;
+
+public class DefaultOutlineChooserForm extends AbstractForm implements IOutlineChooserForm {
+
+ public DefaultOutlineChooserForm() throws ProcessingException {
+ super();
+ }
+
+ @Override
+ protected boolean getConfiguredAskIfNeedSave() {
+ return false;
+ }
+
+ @Override
+ protected int getConfiguredDisplayHint() {
+ return DISPLAY_HINT_VIEW;
+ }
+
+ @Override
+ protected String getConfiguredDisplayViewId() {
+ return VIEW_ID_CENTER;
+ }
+
+ @Override
+ protected String getConfiguredTitle() {
+ return TEXTS.get("MobileOutlineChooserTitle");
+ }
+
+ public void startView() throws ProcessingException {
+ startInternal(new ViewHandler());
+ }
+
+ public MainBox getMainBox() {
+ return (MainBox) getRootGroupBox();
+ }
+
+ public OutlinesTableField getOutlinesTableField() {
+ return getFieldByClass(OutlinesTableField.class);
+ }
+
+ @Order(10.0)
+ public class MainBox extends AbstractGroupBox {
+
+ @Override
+ protected boolean getConfiguredBorderVisible() {
+ return false;
+ }
+
+ @Order(10.0)
+ public class OutlinesTableField extends AbstractTableField<OutlinesTableField.Table> {
+
+ @Override
+ protected boolean getConfiguredLabelVisible() {
+ return false;
+ }
+
+ @Override
+ protected int getConfiguredGridH() {
+ return 2;
+ }
+
+ @Order(10.0)
+ public class Table extends AbstractMobileTable {
+
+ @Override
+ protected boolean execIsAutoCreateTableRowForm() {
+ return false;
+ }
+
+ @Override
+ protected boolean getConfiguredAutoDiscardOnDelete() {
+ return true;
+ }
+
+ @Override
+ protected String getConfiguredDefaultIconId() {
+ return AbstractIcons.TreeNode;
+ }
+
+ @Override
+ protected boolean getConfiguredAutoResizeColumns() {
+ return true;
+ }
+
+ @Override
+ protected boolean getConfiguredSortEnabled() {
+ return false;
+ }
+
+ public LabelColumn getLableColumn() {
+ return getColumnSet().getColumnByClass(LabelColumn.class);
+ }
+
+ public OutlineColumn getOutlineColumn() {
+ return getColumnSet().getColumnByClass(OutlineColumn.class);
+ }
+
+ @Override
+ protected void execDecorateRow(ITableRow row) throws ProcessingException {
+ final String outlineIcon = getOutlineColumn().getValue(row).getIconId();
+ if (outlineIcon != null) {
+ row.setIconId(outlineIcon);
+ }
+ }
+
+ @Order(10.0)
+ public class OutlineColumn extends AbstractColumn<IOutline> {
+
+ @Override
+ protected boolean getConfiguredDisplayable() {
+ return false;
+ }
+ }
+
+ @Order(20.0)
+ public class LabelColumn extends AbstractStringColumn {
+
+ }
+
+ @Override
+ protected void execRowsSelected(ITableRow[] rows) throws ProcessingException {
+ if (rows == null || rows.length == 0) {
+ return;
+ }
+
+ IOutline outline = getOutlineColumn().getValue(rows[0]);
+
+ MobileDesktopUtility.activateOutline(outline);
+ getDesktop().removeForm(DefaultOutlineChooserForm.this);
+
+ clearSelectionDelayed();
+ }
+ }
+ }
+ }
+
+ @Order(10.0)
+ public class ViewHandler extends AbstractFormHandler {
+
+ @Override
+ protected void execLoad() throws ProcessingException {
+ final OutlinesTableField.Table table = getOutlinesTableField().getTable();
+
+ IOutline[] outlines = getDesktop().getAvailableOutlines();
+ for (IOutline outline : outlines) {
+ if (outline.isVisible() && outline.getRootNode() != null) {
+ ITableRow row = table.createRow(new Object[]{outline, outline.getTitle()});
+ row.setEnabled(outline.isEnabled());
+ table.addRow(row);
+ }
+ }
+ }
+
+ @Override
+ protected void execFinally() throws ProcessingException {
+ final OutlinesTableField.Table table = getOutlinesTableField().getTable();
+ table.discardAllRows();
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/IMainPageForm.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/IMainPageForm.java
index 9db75a2dc6..a0d931258f 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/IMainPageForm.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/IMainPageForm.java
@@ -1,15 +1,15 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.form.outline;
-
-public interface IMainPageForm extends IPageForm {
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.form.outline;
+
+public interface IMainPageForm extends IPageForm {
+
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/IMobileOutlineTableForm.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/IMobileOutlineTableForm.java
index 6d0e902923..17518ae4b5 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/IMobileOutlineTableForm.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/IMobileOutlineTableForm.java
@@ -1,20 +1,20 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.form.outline;
-
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutlineTableForm;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-
-public interface IMobileOutlineTableForm extends IOutlineTableForm {
- void setCurrentForm(IForm form);
-
- IForm getCurrentForm();
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.form.outline;
+
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutlineTableForm;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+
+public interface IMobileOutlineTableForm extends IOutlineTableForm {
+ void setCurrentForm(IForm form);
+
+ IForm getCurrentForm();
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/IOutlineChooserForm.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/IOutlineChooserForm.java
index 89667c7f02..b4b30d11a2 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/IOutlineChooserForm.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/IOutlineChooserForm.java
@@ -1,20 +1,20 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.form.outline;
-
-import org.eclipse.scout.rt.client.ui.form.IForm;
-
-/**
- * @since 3.9.0
- */
-public interface IOutlineChooserForm extends IForm {
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.form.outline;
+
+import org.eclipse.scout.rt.client.ui.form.IForm;
+
+/**
+ * @since 3.9.0
+ */
+public interface IOutlineChooserForm extends IForm {
+
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/IPageForm.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/IPageForm.java
index 3fe4c8fcd7..c5aa1a2b64 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/IPageForm.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/IPageForm.java
@@ -1,26 +1,26 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.form.outline;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-
-public interface IPageForm extends IForm {
-
- IPage getPage();
-
- PageFormConfig getPageFormConfig();
-
- void start() throws ProcessingException;
-
- void pageSelectedNotify() throws ProcessingException;
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.form.outline;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+
+public interface IPageForm extends IForm {
+
+ IPage getPage();
+
+ PageFormConfig getPageFormConfig();
+
+ void start() throws ProcessingException;
+
+ void pageSelectedNotify() throws ProcessingException;
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/MainPageForm.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/MainPageForm.java
index a71987d3fe..4abd53ce2c 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/MainPageForm.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/MainPageForm.java
@@ -1,34 +1,34 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.form.outline;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-
-public class MainPageForm extends PageForm implements IMainPageForm {
-
- public MainPageForm(IPage page, PageFormManager manager, PageFormConfig config) throws ProcessingException {
- super(page, manager, config);
- }
-
- @Override
- protected void initConfig() throws ProcessingException {
- super.initConfig();
-
- getPageTableField().setActionBarVisible(false);
- }
-
- @Override
- protected boolean getConfiguredFooterVisible() {
- return true;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.form.outline;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+
+public class MainPageForm extends PageForm implements IMainPageForm {
+
+ public MainPageForm(IPage page, PageFormManager manager, PageFormConfig config) throws ProcessingException {
+ super(page, manager, config);
+ }
+
+ @Override
+ protected void initConfig() throws ProcessingException {
+ super.initConfig();
+
+ getPageTableField().setActionBarVisible(false);
+ }
+
+ @Override
+ protected boolean getConfiguredFooterVisible() {
+ return true;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/PageForm.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/PageForm.java
index f9a2ac56cb..a2b370ecd4 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/PageForm.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/PageForm.java
@@ -1,742 +1,742 @@
-package org.eclipse.scout.rt.client.mobile.ui.form.outline;
-
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.scout.commons.NumberUtility;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.IProcessingStatus;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.exception.ProcessingStatus;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.mobile.ui.basic.table.DrillDownStyleMap;
-import org.eclipse.scout.rt.client.mobile.ui.basic.table.MobileTable;
-import org.eclipse.scout.rt.client.mobile.ui.basic.table.columns.IRowSummaryColumn;
-import org.eclipse.scout.rt.client.mobile.ui.basic.table.form.TableRowForm;
-import org.eclipse.scout.rt.client.mobile.ui.desktop.MobileDesktopUtility;
-import org.eclipse.scout.rt.client.mobile.ui.form.AbstractMobileForm;
-import org.eclipse.scout.rt.client.mobile.ui.form.IActionFetcher;
-import org.eclipse.scout.rt.client.mobile.ui.form.fields.table.AbstractMobileTableField;
-import org.eclipse.scout.rt.client.mobile.ui.form.outline.PageForm.MainBox.PageDetailFormField;
-import org.eclipse.scout.rt.client.mobile.ui.form.outline.PageForm.MainBox.PageTableGroupBox;
-import org.eclipse.scout.rt.client.mobile.ui.form.outline.PageForm.MainBox.PageTableGroupBox.PageTableField;
-import org.eclipse.scout.rt.client.ui.basic.table.AbstractTable;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.client.ui.basic.table.TableAdapter;
-import org.eclipse.scout.rt.client.ui.basic.table.TableEvent;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractStringColumn;
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
-import org.eclipse.scout.rt.client.ui.form.AbstractFormHandler;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.client.ui.form.fields.GridData;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
-import org.eclipse.scout.rt.client.ui.form.fields.wrappedform.AbstractWrappedFormField;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.TEXTS;
-import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
-import org.eclipse.scout.service.SERVICES;
-
-public class PageForm extends AbstractMobileForm implements IPageForm {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(PageForm.class);
- private List<IButton> m_mainboxButtons;
- private IPage m_page;
- private P_PageTableListener m_pageTableListener;
- private P_PageTableSelectionListener m_pageTableSelectionListener;
- private PageFormConfig m_pageFormConfig;
- private PageFormManager m_pageFormManager;
- private Map<ITableRow, AutoLeafPageWithNodes> m_autoLeafPageMap;
- private boolean m_rowSelectionRequired;
-
- public PageForm(IPage page, PageFormManager manager, PageFormConfig pageFormConfig) throws ProcessingException {
- super(false);
- m_pageFormManager = manager;
- m_pageFormConfig = pageFormConfig;
- if (m_pageFormConfig == null) {
- m_pageFormConfig = new PageFormConfig();
- }
- m_autoLeafPageMap = new HashMap<ITableRow, AutoLeafPageWithNodes>();
-
- //Init (order is important)
- setPageInternal(page);
- initMainButtons();
- callInitializer();
- initFields();
- }
-
- @Override
- public PageFormConfig getPageFormConfig() {
- return m_pageFormConfig;
- }
-
- @Override
- protected boolean getConfiguredAskIfNeedSave() {
- return false;
- }
-
- @Override
- protected int getConfiguredDisplayHint() {
- return DISPLAY_HINT_VIEW;
- }
-
- @Override
- protected String getConfiguredDisplayViewId() {
- return VIEW_ID_CENTER;
- }
-
- public PageTableField getPageTableField() {
- return getFieldByClass(PageTableField.class);
- }
-
- public PageDetailFormField getPageDetailFormField() {
- return getFieldByClass(PageDetailFormField.class);
- }
-
- public PageTableGroupBox getPageTableGroupBox() {
- return getFieldByClass(PageTableGroupBox.class);
- }
-
- @Override
- public final IPage getPage() {
- return m_page;
- }
-
- private void setPageInternal(IPage page) throws ProcessingException {
- m_page = page;
- m_page = (IPage) m_page.getTree().resolveVirtualNode(m_page);
-
- if (m_pageFormConfig.isDetailFormVisible() && m_page.getDetailForm() == null) {
- TableRowForm autoDetailForm = createAutoDetailForm();
- if (autoDetailForm != null) {
- m_page.setDetailForm(autoDetailForm);
- autoDetailForm.start();
- }
- }
-
- setTitle(page.getCellForUpdate().getText());
- }
-
- /**
- * If there is a detail form the table field is visible depending on its content. If there is no detail form the table
- * field always is visible.
- */
- protected void updateTableFieldVisibility() throws ProcessingException {
- ITable table = getPageTableField().getTable();
- boolean hasDetailForm = getPageDetailFormField().getInnerForm() != null;
-
- if (hasDetailForm) {
- boolean hasTableRows = table != null && table.getRowCount() > 0;
- getPageTableField().setVisible(hasTableRows);
- }
- }
-
- /**
- * Creates a {@link TableRowForm} out of the selected table row if the parent page is a {@link IPageWithTable}.
- */
- private TableRowForm createAutoDetailForm() throws ProcessingException {
- ITable table = null;
- IPage parentPage = m_page.getParentPage();
- if (parentPage instanceof IPageWithTable) {
- table = ((IPageWithTable) parentPage).getTable();
- }
- if (table != null) {
- if (table.getSelectedRow() == null) {
- //If the parent page has not been selected before there is no row selected -> select it to create the tableRowForm
- ITableRow row = MobileDesktopUtility.getTableRowFor(m_page.getParentPage(), m_page);
- if (row != null) {
- row.getTable().selectRow(row);
- }
- }
- if (table.getSelectedRow() != null) {
- return new TableRowForm(table.getSelectedRow());
- }
-
- }
-
- return null;
- }
-
- @Override
- protected IActionFetcher createHeaderActionFetcher() {
- return new PageFormHeaderActionFetcher(this);
- }
-
- @Override
- protected IActionFetcher createFooterActionFetcher() {
- return new PageFormFooterActionFetcher(this);
- }
-
- private void initMainButtons() throws ProcessingException {
- List<IButton> buttonList = new LinkedList<IButton>();
-
- //Add buttons of the detail form to the main box
- if (m_page.getDetailForm() != null) {
- IButton[] detailFormCustomButtons = m_page.getDetailForm().getRootGroupBox().getCustomProcessButtons();
- buttonList.addAll(Arrays.asList(detailFormCustomButtons));
- }
-
- m_mainboxButtons = buttonList;
- }
-
- private void initFields() throws ProcessingException {
- if (m_pageFormConfig.isDetailFormVisible()) {
- getPageDetailFormField().setInnerForm(m_page.getDetailForm());
- }
-
- //Don't display detail form field if there is no detail form -> saves space
- getPageDetailFormField().setVisible(getPageDetailFormField().getInnerForm() != null);
-
- ITable pageTable = MobileDesktopUtility.getPageTable(m_page);
-
- //Make sure the preview form does only contain folder pages.
- if (!m_pageFormConfig.isTablePageAllowed() && m_page instanceof IPageWithTable) {
- pageTable = new PlaceholderTable(m_page);
- pageTable.initTable();
- pageTable.addRowByArray(new Object[]{TEXTS.get("MobilePlaceholderTableTitle")});
- pageTable.setDefaultIconId(m_page.getCell().getIconId());
- }
-
- MobileTable.setAutoCreateRowForm(pageTable, false);
- getPageTableField().setTable(pageTable, true);
- addTableListener();
-
- updateTableFieldVisibility();
-
- //If there is no table make sure the table group box is invisible and the detail form grows and takes all the space.
- if (!getPageTableField().isVisible()) {
- getPageTableGroupBox().setVisible(false);
-
- GridData gridData = getPageDetailFormField().getGridDataHints();
- gridData.weightY = 1;
- getPageDetailFormField().setGridDataHints(gridData);
- getRootGroupBox().rebuildFieldGrid();
- }
-
- if (getPageTableGroupBox().isVisible()) {
- //If there is a table but no detail form, don't display a border -> make the table as big as the form.
- //If there is a table and a detail form, display a border to make it look better.
- getPageTableGroupBox().setBorderVisible(getPageDetailFormField().getInnerForm() != null);
- }
- getPageTableField().setTableStatusVisible(m_pageFormConfig.isTableStatusVisible());
- }
-
- @Override
- protected void execDisposeForm() throws ProcessingException {
- removeTableListener();
- for (AutoLeafPageWithNodes autoLeafPage : m_autoLeafPageMap.values()) {
- disposeAutoLeafPage(autoLeafPage);
- }
-
- if (m_page != null && m_page.getDetailForm() != null) {
- m_page.getDetailForm().doClose();
- m_page.setDetailForm(null);
- }
- }
-
- private void updateDrillDownStyle() {
- ITable table = getPageTableField().getTable();
- if (table != null) {
- setTableRowDrillDownStyle(table, table.getRows());
- }
- }
-
- private void setTableRowDrillDownStyle(ITable table, ITableRow[] rows) {
- if (rows == null) {
- return;
- }
-
- DrillDownStyleMap drillDownMap = MobileTable.getDrillDownStyleMap(table);
- if (drillDownMap == null) {
- drillDownMap = new DrillDownStyleMap();
- MobileTable.setDrillDownStyleMap(table, drillDownMap);
- }
-
- for (ITableRow row : rows) {
- if (!isDrillDownRow(row)) {
- drillDownMap.put(row, IRowSummaryColumn.DRILL_DOWN_STYLE_NONE);
- }
- else {
- drillDownMap.put(row, IRowSummaryColumn.DRILL_DOWN_STYLE_ICON);
- }
- }
-
- }
-
- private boolean isDrillDownRow(ITableRow tableRow) {
- if (!m_pageFormConfig.isKeepSelection()) {
- return true;
- }
-
- return PageFormManager.isDrillDownPage(MobileDesktopUtility.getPageFor(getPage(), tableRow));
- }
-
- public void formAddedNotify() throws ProcessingException {
- LOG.debug(this + " added");
-
- //Clear selection if form gets visible again. It must not happen earlier, since the actions typically depend on the selected row.
- clearTableSelectionIfNecessary();
-
- //Make sure the rows display the correct drill down style
- updateDrillDownStyle();
-
- if (!m_page.isSelectedNode()) {
- selectChildPageTableRowIfNecessary();
-
- //Make sure the page which belongs to the form is active when the form is shown
- m_page.getOutline().getUIFacade().setNodeSelectedAndExpandedFromUI(m_page);
- }
-
- addTableSelectionListener();
- processSelectedTableRow();
- }
-
- @Override
- public void pageSelectedNotify() throws ProcessingException {
- if (m_rowSelectionRequired) {
- selectPageTableRowIfNecessary(getPageTableField().getTable());
- m_rowSelectionRequired = false;
- }
- }
-
- private void clearTableSelectionIfNecessary() {
- if (getPageTableField().getTable() == null) {
- return;
- }
-
- ITableRow selectedRow = getPageTableField().getTable().getSelectedRow();
- if (selectedRow != null && isDrillDownRow(selectedRow)) {
- LOG.debug("Clearing row for table " + getPageTableField().getTable());
-
- getPageTableField().getTable().selectRow(null);
- }
- }
-
- public void formRemovedNotify() throws ProcessingException {
- removeTableSelectionListener();
- }
-
- private void addTableListener() {
- if (m_pageTableListener != null) {
- return;
- }
- m_pageTableListener = new P_PageTableListener();
-
- ITable table = getPageTableField().getTable();
- if (table != null) {
- table.addTableListener(m_pageTableListener);
- }
- }
-
- private void removeTableListener() {
- if (m_pageTableListener == null) {
- return;
- }
- ITable table = getPageTableField().getTable();
- if (table != null) {
- table.removeTableListener(m_pageTableListener);
- }
- m_pageTableListener = null;
- }
-
- private void addTableSelectionListener() {
- if (m_pageTableSelectionListener != null) {
- return;
- }
- m_pageTableSelectionListener = new P_PageTableSelectionListener();
-
- ITable table = getPageTableField().getTable();
- if (table != null) {
- table.addTableListener(m_pageTableSelectionListener);
- }
- }
-
- private void removeTableSelectionListener() {
- if (m_pageTableSelectionListener == null) {
- return;
- }
- ITable table = getPageTableField().getTable();
- if (table != null) {
- table.removeTableListener(m_pageTableSelectionListener);
- }
- m_pageTableSelectionListener = null;
- }
-
- private void processSelectedTableRow() throws ProcessingException {
- if (!m_pageFormConfig.isKeepSelection()) {
- return;
- }
-
- ITable pageTable = MobileDesktopUtility.getPageTable(getPage());
- if (pageTable == null) {
- return;
- }
-
- ITableRow selectedRow = pageTable.getSelectedRow();
- if (!PageFormManager.isDrillDownPage(MobileDesktopUtility.getPageFor(getPage(), selectedRow))) {
- if (selectedRow != null) {
- handleTableRowSelected(pageTable, selectedRow);
- }
- else {
- selectPageTableRowIfNecessary(pageTable);
- }
- }
- }
-
- @Order(10.0f)
- public class MainBox extends AbstractGroupBox {
-
- @Override
- protected boolean getConfiguredBorderVisible() {
- return false;
- }
-
- @Override
- protected int getConfiguredGridColumnCount() {
- return 1;
- }
-
- @Override
- protected void injectFieldsInternal(List<IFormField> fieldList) {
- if (m_mainboxButtons != null) {
- fieldList.addAll(m_mainboxButtons);
- }
-
- super.injectFieldsInternal(fieldList);
- }
-
- @Order(5.0f)
- public class PageDetailFormField extends AbstractWrappedFormField<IForm> {
-
- @Override
- protected int getConfiguredGridW() {
- return 2;
- }
-
- @Override
- protected int getConfiguredGridH() {
- return 2;
- }
-
- @Override
- protected double getConfiguredGridWeightY() {
- return 0;
- }
-
- }
-
- @Order(10.0f)
- public class PageTableGroupBox extends AbstractGroupBox {
-
- @Order(10.0f)
- public class PageTableField extends AbstractMobileTableField<ITable> {
-
- @Override
- protected boolean getConfiguredLabelVisible() {
- return false;
- }
-
- @Override
- protected boolean getConfiguredTableStatusVisible() {
- return false;
- }
-
- @Override
- protected boolean getConfiguredGridUseUiHeight() {
- //If there is a detail form make the table as height as necessary to avoid a second scrollbar.
- //If there is no detail form make the table itself scrollable.
- return m_pageFormConfig.isDetailFormVisible() && m_page.getDetailForm() != null;
- }
-
- @Override
- protected void execUpdateTableStatus() {
- execUpdatePageTableStatus();
- }
-
- @Override
- public String createDefaultTableStatus() {
- return createDefaultPageTableStatus(getTable());
- }
- }
-
- }
- }
-
- protected void execUpdatePageTableStatus() {
- if (!m_pageFormConfig.isTableStatusVisible()) {
- return;
- }
- if (getPage() instanceof IPageWithTable<?>) {
- //popuplate status
- IPageWithTable<?> tablePage = (IPageWithTable<?>) getPage();
- IProcessingStatus populateStatus = tablePage.getPagePopulateStatus();
- getPageTableField().setTablePopulateStatus(populateStatus);
- //selection status
- if (tablePage.isSearchActive() && tablePage.getSearchFilter() != null && (!tablePage.getSearchFilter().isCompleted()) && tablePage.isSearchRequired()) {
- getPageTableField().setTableSelectionStatus(null);
- }
- else if (populateStatus != null && populateStatus.getSeverity() == IProcessingStatus.WARNING) {
- getPageTableField().setTableSelectionStatus(null);
- }
- else {
- getPageTableField().setTableSelectionStatus(new ProcessingStatus(getPageTableField().createDefaultTableStatus(), IProcessingStatus.INFO));
- }
- }
- else {
- getPageTableField().setTablePopulateStatus(null);
- getPageTableField().setTableSelectionStatus(null);
- }
- }
-
- protected String createDefaultPageTableStatus(ITable table) {
- StringBuilder statusText = new StringBuilder();
- if (table != null) {
- int nTotal = table.getFilteredRowCount();
- if (nTotal == 1) {
- statusText.append(ScoutTexts.get("OneRow"));
- }
- else {
- statusText.append(ScoutTexts.get("XRows", NumberUtility.format(nTotal)));
- }
- }
- if (statusText.length() == 0) {
- return null;
- }
- return statusText.toString();
- }
-
- @Override
- public Object computeExclusiveKey() throws ProcessingException {
- return m_page;
- }
-
- @Override
- public void start() throws ProcessingException {
- startInternalExclusive(new FormHandler());
- }
-
- @Order(10.0f)
- public class FormHandler extends AbstractFormHandler {
-
- @Override
- protected boolean getConfiguredOpenExclusive() {
- return true;
- }
-
- }
-
- private void handleTableRowSelected(ITable table, ITableRow tableRow) throws ProcessingException {
- LOG.debug("Table row selected: " + tableRow);
-
- // If children are not loaded rowPage cannot be estimated.
- //This is the case when the rows get replaced which restores the selection before the children are loaded (e.g. executed by a search).
- if (!m_page.isLeaf() && !m_page.isChildrenLoaded()) {
- if (tableRow == null) {
- //Postpone the row selection since it cannot be done if the row page cannot be estimated
- m_rowSelectionRequired = true;
- }
- return;
- }
-
- if (tableRow == null) {
- //Make sure there always is a selected row. if NodePageSwitch is enabled the same page and therefore the same table is on different pageForms
- selectPageTableRowIfNecessary(table);
- return;
- }
-
- IPage rowPage = null;
- if (table instanceof PlaceholderTable) {
- rowPage = ((PlaceholderTable) table).getActualPage();
- }
- else if (m_autoLeafPageMap.containsKey(tableRow)) {
- rowPage = m_autoLeafPageMap.get(tableRow);
- }
- else {
- rowPage = MobileDesktopUtility.getPageFor(m_page, tableRow);
- }
- if (rowPage == null) {
- //Create auto leaf page including an outline and activate it.
- //Adding to a "real" outline is not possible because the page to row maps in AbstractPageWithTable resp. AbstractPageWithNodes can only be modified by the page itself.
- AutoLeafPageWithNodes autoPage = new AutoLeafPageWithNodes(tableRow, m_page);
- AutoOutline autoOutline = new AutoOutline(autoPage);
- autoOutline.selectNode(autoPage);
- m_autoLeafPageMap.put(tableRow, autoPage);
-
- rowPage = autoPage;
- }
-
- m_pageFormManager.pageSelectedNotify(this, rowPage);
- }
-
- private void handleTableRowsDeleted(ITable table, ITableRow[] tableRows) throws ProcessingException {
- if (tableRows == null) {
- return;
- }
-
- for (ITableRow tableRow : tableRows) {
- AutoLeafPageWithNodes autoPage = m_autoLeafPageMap.remove(tableRow);
- if (autoPage != null) {
- disposeAutoLeafPage(autoPage);
-
- m_pageFormManager.pageRemovedNotify(this, autoPage);
- }
- }
- }
-
- private void disposeAutoLeafPage(AutoLeafPageWithNodes page) {
- if (page == null || page.getOutline() == null) {
- return;
- }
-
- IOutline outline = page.getOutline();
- outline.removeAllChildNodes(outline.getRootNode());
- outline.disposeTree();
- }
-
- private void handleTableRowsInserted(ITable table, ITableRow[] tableRows) throws ProcessingException {
- setTableRowDrillDownStyle(table, tableRows);
- }
-
- protected void selectPageTableRowIfNecessary(final ITable pageDetailTable) throws ProcessingException {
- if (!m_pageFormConfig.isKeepSelection() || pageDetailTable == null || pageDetailTable.getRowCount() == 0) {
- return;
- }
-
- IPage pageToSelect = MobileDesktopUtility.getPageFor(m_page, pageDetailTable.getRow(0));
- if (pageDetailTable.getSelectedRow() == null) {
- if (!PageFormManager.isDrillDownPage(pageToSelect)) {
- pageDetailTable.selectFirstRow();
- }
- }
-
- }
-
- /**
- * If the currently selected page is a child page belonging to this form, make sure the table reflects that -> select
- * the child page in the table
- */
- private void selectChildPageTableRowIfNecessary() {
- if (!m_pageFormConfig.isKeepSelection()) {
- return;
- }
-
- IPage selectedPage = (IPage) m_page.getOutline().getSelectedNode();
- if (selectedPage != null && selectedPage.getParentPage() == m_page) {
- ITableRow row = MobileDesktopUtility.getTableRowFor(m_page, selectedPage);
- if (row != null && !isDrillDownRow(row)) {
- row.getTable().selectRow(row);
- }
- }
- }
-
- private class PlaceholderTable extends AbstractTable {
- private IPage m_actualPage;
-
- public PlaceholderTable(IPage page) {
- m_actualPage = page;
- }
-
- public IPage getActualPage() {
- return m_actualPage;
- }
-
- @Override
- protected boolean getConfiguredSortEnabled() {
- return false;
- }
-
- @Override
- protected boolean getConfiguredAutoResizeColumns() {
- return true;
- }
-
- @Override
- protected boolean getConfiguredMultiSelect() {
- return false;
- }
-
- public LabelColumn getLabelColumn() {
- return getColumnSet().getColumnByClass(LabelColumn.class);
- }
-
- @Order(1)
- public class LabelColumn extends AbstractStringColumn {
-
- @Override
- protected String getConfiguredHeaderText() {
- return ScoutTexts.get("Folders");
- }
-
- }
- }
-
- private class P_PageTableListener extends TableAdapter {
- @Override
- public void tableChanged(TableEvent event) {
- try {
- switch (event.getType()) {
- case TableEvent.TYPE_ALL_ROWS_DELETED:
- case TableEvent.TYPE_ROWS_DELETED: {
- handleTableRowDeleted(event);
- break;
- }
- case TableEvent.TYPE_ROWS_INSERTED:
- handleTableRowsInserted(event);
- }
- }
- catch (ProcessingException e) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- }
-
- private void handleTableRowDeleted(TableEvent event) throws ProcessingException {
- PageForm.this.handleTableRowsDeleted(event.getTable(), event.getRows());
- updateTableFieldVisibility();
- }
-
- private void handleTableRowsInserted(TableEvent event) throws ProcessingException {
- PageForm.this.handleTableRowsInserted(event.getTable(), event.getRows());
- updateTableFieldVisibility();
- }
-
- }
-
- private class P_PageTableSelectionListener extends TableAdapter {
- @Override
- public void tableChanged(TableEvent event) {
- try {
- switch (event.getType()) {
- case TableEvent.TYPE_ROWS_SELECTED: {
- handleTableRowSelected(event);
- break;
- }
- }
- }
- catch (ProcessingException e) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- }
-
- private void handleTableRowSelected(TableEvent event) throws ProcessingException {
- if (event.isConsumed()) {
- return;
- }
-
- ITableRow tableRow = event.getFirstRow();
- PageForm.this.handleTableRowSelected(event.getTable(), tableRow);
- }
-
- }
-
- @Override
- public String toString() {
- return super.toString() + " with page " + m_page;
- }
-}
+package org.eclipse.scout.rt.client.mobile.ui.form.outline;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.scout.commons.NumberUtility;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.IProcessingStatus;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.exception.ProcessingStatus;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.mobile.ui.basic.table.DrillDownStyleMap;
+import org.eclipse.scout.rt.client.mobile.ui.basic.table.MobileTable;
+import org.eclipse.scout.rt.client.mobile.ui.basic.table.columns.IRowSummaryColumn;
+import org.eclipse.scout.rt.client.mobile.ui.basic.table.form.TableRowForm;
+import org.eclipse.scout.rt.client.mobile.ui.desktop.MobileDesktopUtility;
+import org.eclipse.scout.rt.client.mobile.ui.form.AbstractMobileForm;
+import org.eclipse.scout.rt.client.mobile.ui.form.IActionFetcher;
+import org.eclipse.scout.rt.client.mobile.ui.form.fields.table.AbstractMobileTableField;
+import org.eclipse.scout.rt.client.mobile.ui.form.outline.PageForm.MainBox.PageDetailFormField;
+import org.eclipse.scout.rt.client.mobile.ui.form.outline.PageForm.MainBox.PageTableGroupBox;
+import org.eclipse.scout.rt.client.mobile.ui.form.outline.PageForm.MainBox.PageTableGroupBox.PageTableField;
+import org.eclipse.scout.rt.client.ui.basic.table.AbstractTable;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.client.ui.basic.table.TableAdapter;
+import org.eclipse.scout.rt.client.ui.basic.table.TableEvent;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractStringColumn;
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
+import org.eclipse.scout.rt.client.ui.form.AbstractFormHandler;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.client.ui.form.fields.GridData;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
+import org.eclipse.scout.rt.client.ui.form.fields.wrappedform.AbstractWrappedFormField;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.TEXTS;
+import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
+import org.eclipse.scout.service.SERVICES;
+
+public class PageForm extends AbstractMobileForm implements IPageForm {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(PageForm.class);
+ private List<IButton> m_mainboxButtons;
+ private IPage m_page;
+ private P_PageTableListener m_pageTableListener;
+ private P_PageTableSelectionListener m_pageTableSelectionListener;
+ private PageFormConfig m_pageFormConfig;
+ private PageFormManager m_pageFormManager;
+ private Map<ITableRow, AutoLeafPageWithNodes> m_autoLeafPageMap;
+ private boolean m_rowSelectionRequired;
+
+ public PageForm(IPage page, PageFormManager manager, PageFormConfig pageFormConfig) throws ProcessingException {
+ super(false);
+ m_pageFormManager = manager;
+ m_pageFormConfig = pageFormConfig;
+ if (m_pageFormConfig == null) {
+ m_pageFormConfig = new PageFormConfig();
+ }
+ m_autoLeafPageMap = new HashMap<ITableRow, AutoLeafPageWithNodes>();
+
+ //Init (order is important)
+ setPageInternal(page);
+ initMainButtons();
+ callInitializer();
+ initFields();
+ }
+
+ @Override
+ public PageFormConfig getPageFormConfig() {
+ return m_pageFormConfig;
+ }
+
+ @Override
+ protected boolean getConfiguredAskIfNeedSave() {
+ return false;
+ }
+
+ @Override
+ protected int getConfiguredDisplayHint() {
+ return DISPLAY_HINT_VIEW;
+ }
+
+ @Override
+ protected String getConfiguredDisplayViewId() {
+ return VIEW_ID_CENTER;
+ }
+
+ public PageTableField getPageTableField() {
+ return getFieldByClass(PageTableField.class);
+ }
+
+ public PageDetailFormField getPageDetailFormField() {
+ return getFieldByClass(PageDetailFormField.class);
+ }
+
+ public PageTableGroupBox getPageTableGroupBox() {
+ return getFieldByClass(PageTableGroupBox.class);
+ }
+
+ @Override
+ public final IPage getPage() {
+ return m_page;
+ }
+
+ private void setPageInternal(IPage page) throws ProcessingException {
+ m_page = page;
+ m_page = (IPage) m_page.getTree().resolveVirtualNode(m_page);
+
+ if (m_pageFormConfig.isDetailFormVisible() && m_page.getDetailForm() == null) {
+ TableRowForm autoDetailForm = createAutoDetailForm();
+ if (autoDetailForm != null) {
+ m_page.setDetailForm(autoDetailForm);
+ autoDetailForm.start();
+ }
+ }
+
+ setTitle(page.getCellForUpdate().getText());
+ }
+
+ /**
+ * If there is a detail form the table field is visible depending on its content. If there is no detail form the table
+ * field always is visible.
+ */
+ protected void updateTableFieldVisibility() throws ProcessingException {
+ ITable table = getPageTableField().getTable();
+ boolean hasDetailForm = getPageDetailFormField().getInnerForm() != null;
+
+ if (hasDetailForm) {
+ boolean hasTableRows = table != null && table.getRowCount() > 0;
+ getPageTableField().setVisible(hasTableRows);
+ }
+ }
+
+ /**
+ * Creates a {@link TableRowForm} out of the selected table row if the parent page is a {@link IPageWithTable}.
+ */
+ private TableRowForm createAutoDetailForm() throws ProcessingException {
+ ITable table = null;
+ IPage parentPage = m_page.getParentPage();
+ if (parentPage instanceof IPageWithTable) {
+ table = ((IPageWithTable) parentPage).getTable();
+ }
+ if (table != null) {
+ if (table.getSelectedRow() == null) {
+ //If the parent page has not been selected before there is no row selected -> select it to create the tableRowForm
+ ITableRow row = MobileDesktopUtility.getTableRowFor(m_page.getParentPage(), m_page);
+ if (row != null) {
+ row.getTable().selectRow(row);
+ }
+ }
+ if (table.getSelectedRow() != null) {
+ return new TableRowForm(table.getSelectedRow());
+ }
+
+ }
+
+ return null;
+ }
+
+ @Override
+ protected IActionFetcher createHeaderActionFetcher() {
+ return new PageFormHeaderActionFetcher(this);
+ }
+
+ @Override
+ protected IActionFetcher createFooterActionFetcher() {
+ return new PageFormFooterActionFetcher(this);
+ }
+
+ private void initMainButtons() throws ProcessingException {
+ List<IButton> buttonList = new LinkedList<IButton>();
+
+ //Add buttons of the detail form to the main box
+ if (m_page.getDetailForm() != null) {
+ IButton[] detailFormCustomButtons = m_page.getDetailForm().getRootGroupBox().getCustomProcessButtons();
+ buttonList.addAll(Arrays.asList(detailFormCustomButtons));
+ }
+
+ m_mainboxButtons = buttonList;
+ }
+
+ private void initFields() throws ProcessingException {
+ if (m_pageFormConfig.isDetailFormVisible()) {
+ getPageDetailFormField().setInnerForm(m_page.getDetailForm());
+ }
+
+ //Don't display detail form field if there is no detail form -> saves space
+ getPageDetailFormField().setVisible(getPageDetailFormField().getInnerForm() != null);
+
+ ITable pageTable = MobileDesktopUtility.getPageTable(m_page);
+
+ //Make sure the preview form does only contain folder pages.
+ if (!m_pageFormConfig.isTablePageAllowed() && m_page instanceof IPageWithTable) {
+ pageTable = new PlaceholderTable(m_page);
+ pageTable.initTable();
+ pageTable.addRowByArray(new Object[]{TEXTS.get("MobilePlaceholderTableTitle")});
+ pageTable.setDefaultIconId(m_page.getCell().getIconId());
+ }
+
+ MobileTable.setAutoCreateRowForm(pageTable, false);
+ getPageTableField().setTable(pageTable, true);
+ addTableListener();
+
+ updateTableFieldVisibility();
+
+ //If there is no table make sure the table group box is invisible and the detail form grows and takes all the space.
+ if (!getPageTableField().isVisible()) {
+ getPageTableGroupBox().setVisible(false);
+
+ GridData gridData = getPageDetailFormField().getGridDataHints();
+ gridData.weightY = 1;
+ getPageDetailFormField().setGridDataHints(gridData);
+ getRootGroupBox().rebuildFieldGrid();
+ }
+
+ if (getPageTableGroupBox().isVisible()) {
+ //If there is a table but no detail form, don't display a border -> make the table as big as the form.
+ //If there is a table and a detail form, display a border to make it look better.
+ getPageTableGroupBox().setBorderVisible(getPageDetailFormField().getInnerForm() != null);
+ }
+ getPageTableField().setTableStatusVisible(m_pageFormConfig.isTableStatusVisible());
+ }
+
+ @Override
+ protected void execDisposeForm() throws ProcessingException {
+ removeTableListener();
+ for (AutoLeafPageWithNodes autoLeafPage : m_autoLeafPageMap.values()) {
+ disposeAutoLeafPage(autoLeafPage);
+ }
+
+ if (m_page != null && m_page.getDetailForm() != null) {
+ m_page.getDetailForm().doClose();
+ m_page.setDetailForm(null);
+ }
+ }
+
+ private void updateDrillDownStyle() {
+ ITable table = getPageTableField().getTable();
+ if (table != null) {
+ setTableRowDrillDownStyle(table, table.getRows());
+ }
+ }
+
+ private void setTableRowDrillDownStyle(ITable table, ITableRow[] rows) {
+ if (rows == null) {
+ return;
+ }
+
+ DrillDownStyleMap drillDownMap = MobileTable.getDrillDownStyleMap(table);
+ if (drillDownMap == null) {
+ drillDownMap = new DrillDownStyleMap();
+ MobileTable.setDrillDownStyleMap(table, drillDownMap);
+ }
+
+ for (ITableRow row : rows) {
+ if (!isDrillDownRow(row)) {
+ drillDownMap.put(row, IRowSummaryColumn.DRILL_DOWN_STYLE_NONE);
+ }
+ else {
+ drillDownMap.put(row, IRowSummaryColumn.DRILL_DOWN_STYLE_ICON);
+ }
+ }
+
+ }
+
+ private boolean isDrillDownRow(ITableRow tableRow) {
+ if (!m_pageFormConfig.isKeepSelection()) {
+ return true;
+ }
+
+ return PageFormManager.isDrillDownPage(MobileDesktopUtility.getPageFor(getPage(), tableRow));
+ }
+
+ public void formAddedNotify() throws ProcessingException {
+ LOG.debug(this + " added");
+
+ //Clear selection if form gets visible again. It must not happen earlier, since the actions typically depend on the selected row.
+ clearTableSelectionIfNecessary();
+
+ //Make sure the rows display the correct drill down style
+ updateDrillDownStyle();
+
+ if (!m_page.isSelectedNode()) {
+ selectChildPageTableRowIfNecessary();
+
+ //Make sure the page which belongs to the form is active when the form is shown
+ m_page.getOutline().getUIFacade().setNodeSelectedAndExpandedFromUI(m_page);
+ }
+
+ addTableSelectionListener();
+ processSelectedTableRow();
+ }
+
+ @Override
+ public void pageSelectedNotify() throws ProcessingException {
+ if (m_rowSelectionRequired) {
+ selectPageTableRowIfNecessary(getPageTableField().getTable());
+ m_rowSelectionRequired = false;
+ }
+ }
+
+ private void clearTableSelectionIfNecessary() {
+ if (getPageTableField().getTable() == null) {
+ return;
+ }
+
+ ITableRow selectedRow = getPageTableField().getTable().getSelectedRow();
+ if (selectedRow != null && isDrillDownRow(selectedRow)) {
+ LOG.debug("Clearing row for table " + getPageTableField().getTable());
+
+ getPageTableField().getTable().selectRow(null);
+ }
+ }
+
+ public void formRemovedNotify() throws ProcessingException {
+ removeTableSelectionListener();
+ }
+
+ private void addTableListener() {
+ if (m_pageTableListener != null) {
+ return;
+ }
+ m_pageTableListener = new P_PageTableListener();
+
+ ITable table = getPageTableField().getTable();
+ if (table != null) {
+ table.addTableListener(m_pageTableListener);
+ }
+ }
+
+ private void removeTableListener() {
+ if (m_pageTableListener == null) {
+ return;
+ }
+ ITable table = getPageTableField().getTable();
+ if (table != null) {
+ table.removeTableListener(m_pageTableListener);
+ }
+ m_pageTableListener = null;
+ }
+
+ private void addTableSelectionListener() {
+ if (m_pageTableSelectionListener != null) {
+ return;
+ }
+ m_pageTableSelectionListener = new P_PageTableSelectionListener();
+
+ ITable table = getPageTableField().getTable();
+ if (table != null) {
+ table.addTableListener(m_pageTableSelectionListener);
+ }
+ }
+
+ private void removeTableSelectionListener() {
+ if (m_pageTableSelectionListener == null) {
+ return;
+ }
+ ITable table = getPageTableField().getTable();
+ if (table != null) {
+ table.removeTableListener(m_pageTableSelectionListener);
+ }
+ m_pageTableSelectionListener = null;
+ }
+
+ private void processSelectedTableRow() throws ProcessingException {
+ if (!m_pageFormConfig.isKeepSelection()) {
+ return;
+ }
+
+ ITable pageTable = MobileDesktopUtility.getPageTable(getPage());
+ if (pageTable == null) {
+ return;
+ }
+
+ ITableRow selectedRow = pageTable.getSelectedRow();
+ if (!PageFormManager.isDrillDownPage(MobileDesktopUtility.getPageFor(getPage(), selectedRow))) {
+ if (selectedRow != null) {
+ handleTableRowSelected(pageTable, selectedRow);
+ }
+ else {
+ selectPageTableRowIfNecessary(pageTable);
+ }
+ }
+ }
+
+ @Order(10.0f)
+ public class MainBox extends AbstractGroupBox {
+
+ @Override
+ protected boolean getConfiguredBorderVisible() {
+ return false;
+ }
+
+ @Override
+ protected int getConfiguredGridColumnCount() {
+ return 1;
+ }
+
+ @Override
+ protected void injectFieldsInternal(List<IFormField> fieldList) {
+ if (m_mainboxButtons != null) {
+ fieldList.addAll(m_mainboxButtons);
+ }
+
+ super.injectFieldsInternal(fieldList);
+ }
+
+ @Order(5.0f)
+ public class PageDetailFormField extends AbstractWrappedFormField<IForm> {
+
+ @Override
+ protected int getConfiguredGridW() {
+ return 2;
+ }
+
+ @Override
+ protected int getConfiguredGridH() {
+ return 2;
+ }
+
+ @Override
+ protected double getConfiguredGridWeightY() {
+ return 0;
+ }
+
+ }
+
+ @Order(10.0f)
+ public class PageTableGroupBox extends AbstractGroupBox {
+
+ @Order(10.0f)
+ public class PageTableField extends AbstractMobileTableField<ITable> {
+
+ @Override
+ protected boolean getConfiguredLabelVisible() {
+ return false;
+ }
+
+ @Override
+ protected boolean getConfiguredTableStatusVisible() {
+ return false;
+ }
+
+ @Override
+ protected boolean getConfiguredGridUseUiHeight() {
+ //If there is a detail form make the table as height as necessary to avoid a second scrollbar.
+ //If there is no detail form make the table itself scrollable.
+ return m_pageFormConfig.isDetailFormVisible() && m_page.getDetailForm() != null;
+ }
+
+ @Override
+ protected void execUpdateTableStatus() {
+ execUpdatePageTableStatus();
+ }
+
+ @Override
+ public String createDefaultTableStatus() {
+ return createDefaultPageTableStatus(getTable());
+ }
+ }
+
+ }
+ }
+
+ protected void execUpdatePageTableStatus() {
+ if (!m_pageFormConfig.isTableStatusVisible()) {
+ return;
+ }
+ if (getPage() instanceof IPageWithTable<?>) {
+ //popuplate status
+ IPageWithTable<?> tablePage = (IPageWithTable<?>) getPage();
+ IProcessingStatus populateStatus = tablePage.getPagePopulateStatus();
+ getPageTableField().setTablePopulateStatus(populateStatus);
+ //selection status
+ if (tablePage.isSearchActive() && tablePage.getSearchFilter() != null && (!tablePage.getSearchFilter().isCompleted()) && tablePage.isSearchRequired()) {
+ getPageTableField().setTableSelectionStatus(null);
+ }
+ else if (populateStatus != null && populateStatus.getSeverity() == IProcessingStatus.WARNING) {
+ getPageTableField().setTableSelectionStatus(null);
+ }
+ else {
+ getPageTableField().setTableSelectionStatus(new ProcessingStatus(getPageTableField().createDefaultTableStatus(), IProcessingStatus.INFO));
+ }
+ }
+ else {
+ getPageTableField().setTablePopulateStatus(null);
+ getPageTableField().setTableSelectionStatus(null);
+ }
+ }
+
+ protected String createDefaultPageTableStatus(ITable table) {
+ StringBuilder statusText = new StringBuilder();
+ if (table != null) {
+ int nTotal = table.getFilteredRowCount();
+ if (nTotal == 1) {
+ statusText.append(ScoutTexts.get("OneRow"));
+ }
+ else {
+ statusText.append(ScoutTexts.get("XRows", NumberUtility.format(nTotal)));
+ }
+ }
+ if (statusText.length() == 0) {
+ return null;
+ }
+ return statusText.toString();
+ }
+
+ @Override
+ public Object computeExclusiveKey() throws ProcessingException {
+ return m_page;
+ }
+
+ @Override
+ public void start() throws ProcessingException {
+ startInternalExclusive(new FormHandler());
+ }
+
+ @Order(10.0f)
+ public class FormHandler extends AbstractFormHandler {
+
+ @Override
+ protected boolean getConfiguredOpenExclusive() {
+ return true;
+ }
+
+ }
+
+ private void handleTableRowSelected(ITable table, ITableRow tableRow) throws ProcessingException {
+ LOG.debug("Table row selected: " + tableRow);
+
+ // If children are not loaded rowPage cannot be estimated.
+ //This is the case when the rows get replaced which restores the selection before the children are loaded (e.g. executed by a search).
+ if (!m_page.isLeaf() && !m_page.isChildrenLoaded()) {
+ if (tableRow == null) {
+ //Postpone the row selection since it cannot be done if the row page cannot be estimated
+ m_rowSelectionRequired = true;
+ }
+ return;
+ }
+
+ if (tableRow == null) {
+ //Make sure there always is a selected row. if NodePageSwitch is enabled the same page and therefore the same table is on different pageForms
+ selectPageTableRowIfNecessary(table);
+ return;
+ }
+
+ IPage rowPage = null;
+ if (table instanceof PlaceholderTable) {
+ rowPage = ((PlaceholderTable) table).getActualPage();
+ }
+ else if (m_autoLeafPageMap.containsKey(tableRow)) {
+ rowPage = m_autoLeafPageMap.get(tableRow);
+ }
+ else {
+ rowPage = MobileDesktopUtility.getPageFor(m_page, tableRow);
+ }
+ if (rowPage == null) {
+ //Create auto leaf page including an outline and activate it.
+ //Adding to a "real" outline is not possible because the page to row maps in AbstractPageWithTable resp. AbstractPageWithNodes can only be modified by the page itself.
+ AutoLeafPageWithNodes autoPage = new AutoLeafPageWithNodes(tableRow, m_page);
+ AutoOutline autoOutline = new AutoOutline(autoPage);
+ autoOutline.selectNode(autoPage);
+ m_autoLeafPageMap.put(tableRow, autoPage);
+
+ rowPage = autoPage;
+ }
+
+ m_pageFormManager.pageSelectedNotify(this, rowPage);
+ }
+
+ private void handleTableRowsDeleted(ITable table, ITableRow[] tableRows) throws ProcessingException {
+ if (tableRows == null) {
+ return;
+ }
+
+ for (ITableRow tableRow : tableRows) {
+ AutoLeafPageWithNodes autoPage = m_autoLeafPageMap.remove(tableRow);
+ if (autoPage != null) {
+ disposeAutoLeafPage(autoPage);
+
+ m_pageFormManager.pageRemovedNotify(this, autoPage);
+ }
+ }
+ }
+
+ private void disposeAutoLeafPage(AutoLeafPageWithNodes page) {
+ if (page == null || page.getOutline() == null) {
+ return;
+ }
+
+ IOutline outline = page.getOutline();
+ outline.removeAllChildNodes(outline.getRootNode());
+ outline.disposeTree();
+ }
+
+ private void handleTableRowsInserted(ITable table, ITableRow[] tableRows) throws ProcessingException {
+ setTableRowDrillDownStyle(table, tableRows);
+ }
+
+ protected void selectPageTableRowIfNecessary(final ITable pageDetailTable) throws ProcessingException {
+ if (!m_pageFormConfig.isKeepSelection() || pageDetailTable == null || pageDetailTable.getRowCount() == 0) {
+ return;
+ }
+
+ IPage pageToSelect = MobileDesktopUtility.getPageFor(m_page, pageDetailTable.getRow(0));
+ if (pageDetailTable.getSelectedRow() == null) {
+ if (!PageFormManager.isDrillDownPage(pageToSelect)) {
+ pageDetailTable.selectFirstRow();
+ }
+ }
+
+ }
+
+ /**
+ * If the currently selected page is a child page belonging to this form, make sure the table reflects that -> select
+ * the child page in the table
+ */
+ private void selectChildPageTableRowIfNecessary() {
+ if (!m_pageFormConfig.isKeepSelection()) {
+ return;
+ }
+
+ IPage selectedPage = (IPage) m_page.getOutline().getSelectedNode();
+ if (selectedPage != null && selectedPage.getParentPage() == m_page) {
+ ITableRow row = MobileDesktopUtility.getTableRowFor(m_page, selectedPage);
+ if (row != null && !isDrillDownRow(row)) {
+ row.getTable().selectRow(row);
+ }
+ }
+ }
+
+ private class PlaceholderTable extends AbstractTable {
+ private IPage m_actualPage;
+
+ public PlaceholderTable(IPage page) {
+ m_actualPage = page;
+ }
+
+ public IPage getActualPage() {
+ return m_actualPage;
+ }
+
+ @Override
+ protected boolean getConfiguredSortEnabled() {
+ return false;
+ }
+
+ @Override
+ protected boolean getConfiguredAutoResizeColumns() {
+ return true;
+ }
+
+ @Override
+ protected boolean getConfiguredMultiSelect() {
+ return false;
+ }
+
+ public LabelColumn getLabelColumn() {
+ return getColumnSet().getColumnByClass(LabelColumn.class);
+ }
+
+ @Order(1)
+ public class LabelColumn extends AbstractStringColumn {
+
+ @Override
+ protected String getConfiguredHeaderText() {
+ return ScoutTexts.get("Folders");
+ }
+
+ }
+ }
+
+ private class P_PageTableListener extends TableAdapter {
+ @Override
+ public void tableChanged(TableEvent event) {
+ try {
+ switch (event.getType()) {
+ case TableEvent.TYPE_ALL_ROWS_DELETED:
+ case TableEvent.TYPE_ROWS_DELETED: {
+ handleTableRowDeleted(event);
+ break;
+ }
+ case TableEvent.TYPE_ROWS_INSERTED:
+ handleTableRowsInserted(event);
+ }
+ }
+ catch (ProcessingException e) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ }
+
+ private void handleTableRowDeleted(TableEvent event) throws ProcessingException {
+ PageForm.this.handleTableRowsDeleted(event.getTable(), event.getRows());
+ updateTableFieldVisibility();
+ }
+
+ private void handleTableRowsInserted(TableEvent event) throws ProcessingException {
+ PageForm.this.handleTableRowsInserted(event.getTable(), event.getRows());
+ updateTableFieldVisibility();
+ }
+
+ }
+
+ private class P_PageTableSelectionListener extends TableAdapter {
+ @Override
+ public void tableChanged(TableEvent event) {
+ try {
+ switch (event.getType()) {
+ case TableEvent.TYPE_ROWS_SELECTED: {
+ handleTableRowSelected(event);
+ break;
+ }
+ }
+ }
+ catch (ProcessingException e) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ }
+
+ private void handleTableRowSelected(TableEvent event) throws ProcessingException {
+ if (event.isConsumed()) {
+ return;
+ }
+
+ ITableRow tableRow = event.getFirstRow();
+ PageForm.this.handleTableRowSelected(event.getTable(), tableRow);
+ }
+
+ }
+
+ @Override
+ public String toString() {
+ return super.toString() + " with page " + m_page;
+ }
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/PageFormConfig.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/PageFormConfig.java
index 1198102f74..7a5958bb87 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/PageFormConfig.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/PageFormConfig.java
@@ -1,50 +1,50 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.form.outline;
-
-public class PageFormConfig {
- private boolean m_tablePageAllowed;
- private boolean m_detailFormVisible;
- private boolean m_keepSelection;
- private boolean m_tableStatusVisible;
-
- public boolean isTablePageAllowed() {
- return m_tablePageAllowed;
- }
-
- public void setTablePageAllowed(boolean tablePagesAllowed) {
- m_tablePageAllowed = tablePagesAllowed;
- }
-
- public boolean isDetailFormVisible() {
- return m_detailFormVisible;
- }
-
- public void setDetailFormVisible(boolean detailFormVisible) {
- m_detailFormVisible = detailFormVisible;
- }
-
- public boolean isKeepSelection() {
- return m_keepSelection;
- }
-
- public void setKeepSelection(boolean keepSelection) {
- m_keepSelection = keepSelection;
- }
-
- public boolean isTableStatusVisible() {
- return m_tableStatusVisible;
- }
-
- public void setTableStatusVisible(boolean tableStatusVisible) {
- m_tableStatusVisible = tableStatusVisible;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.form.outline;
+
+public class PageFormConfig {
+ private boolean m_tablePageAllowed;
+ private boolean m_detailFormVisible;
+ private boolean m_keepSelection;
+ private boolean m_tableStatusVisible;
+
+ public boolean isTablePageAllowed() {
+ return m_tablePageAllowed;
+ }
+
+ public void setTablePageAllowed(boolean tablePagesAllowed) {
+ m_tablePageAllowed = tablePagesAllowed;
+ }
+
+ public boolean isDetailFormVisible() {
+ return m_detailFormVisible;
+ }
+
+ public void setDetailFormVisible(boolean detailFormVisible) {
+ m_detailFormVisible = detailFormVisible;
+ }
+
+ public boolean isKeepSelection() {
+ return m_keepSelection;
+ }
+
+ public void setKeepSelection(boolean keepSelection) {
+ m_keepSelection = keepSelection;
+ }
+
+ public boolean isTableStatusVisible() {
+ return m_tableStatusVisible;
+ }
+
+ public void setTableStatusVisible(boolean tableStatusVisible) {
+ m_tableStatusVisible = tableStatusVisible;
+ }
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/PageFormFooterActionFetcher.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/PageFormFooterActionFetcher.java
index a72d0f38d4..316e512cfc 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/PageFormFooterActionFetcher.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/PageFormFooterActionFetcher.java
@@ -1,50 +1,50 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.form.outline;
-
-import java.util.List;
-
-import org.eclipse.scout.rt.client.mobile.ui.action.ActionButtonBarUtility;
-import org.eclipse.scout.rt.client.mobile.ui.form.AbstractMobileAction;
-import org.eclipse.scout.rt.client.mobile.ui.form.FormFooterActionFetcher;
-import org.eclipse.scout.rt.client.mobile.ui.form.IMobileAction;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-
-/**
- * Additionally fetches the actions of the current page and places them on the left side.
- */
-public class PageFormFooterActionFetcher extends FormFooterActionFetcher {
-
- public PageFormFooterActionFetcher(PageForm form) {
- super(form);
- }
-
- @Override
- public PageForm getForm() {
- return (PageForm) super.getForm();
- }
-
- @Override
- public List<IMenu> fetch() {
- List<IMenu> footerActions = super.fetch();
- IPage page = getForm().getPage();
-
- List<IMenu> nodeActions = ActionButtonBarUtility.fetchPageActions(page);
- for (IMenu action : nodeActions) {
- AbstractMobileAction.setHorizontalAlignment(action, IMobileAction.HORIZONTAL_ALIGNMENT_LEFT);
- }
- footerActions.addAll(0, nodeActions);
-
- return footerActions;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.form.outline;
+
+import java.util.List;
+
+import org.eclipse.scout.rt.client.mobile.ui.action.ActionButtonBarUtility;
+import org.eclipse.scout.rt.client.mobile.ui.form.AbstractMobileAction;
+import org.eclipse.scout.rt.client.mobile.ui.form.FormFooterActionFetcher;
+import org.eclipse.scout.rt.client.mobile.ui.form.IMobileAction;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+
+/**
+ * Additionally fetches the actions of the current page and places them on the left side.
+ */
+public class PageFormFooterActionFetcher extends FormFooterActionFetcher {
+
+ public PageFormFooterActionFetcher(PageForm form) {
+ super(form);
+ }
+
+ @Override
+ public PageForm getForm() {
+ return (PageForm) super.getForm();
+ }
+
+ @Override
+ public List<IMenu> fetch() {
+ List<IMenu> footerActions = super.fetch();
+ IPage page = getForm().getPage();
+
+ List<IMenu> nodeActions = ActionButtonBarUtility.fetchPageActions(page);
+ for (IMenu action : nodeActions) {
+ AbstractMobileAction.setHorizontalAlignment(action, IMobileAction.HORIZONTAL_ALIGNMENT_LEFT);
+ }
+ footerActions.addAll(0, nodeActions);
+
+ return footerActions;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/PageFormHeaderActionFetcher.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/PageFormHeaderActionFetcher.java
index 4c43bd6396..b1c2709fc6 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/PageFormHeaderActionFetcher.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/PageFormHeaderActionFetcher.java
@@ -1,50 +1,50 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.form.outline;
-
-import java.util.List;
-
-import org.eclipse.scout.rt.client.mobile.ui.action.ActionButtonBarUtility;
-import org.eclipse.scout.rt.client.mobile.ui.form.AbstractMobileAction;
-import org.eclipse.scout.rt.client.mobile.ui.form.FormHeaderActionFetcher;
-import org.eclipse.scout.rt.client.mobile.ui.form.IMobileAction;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-
-/**
- * Additionally fetches the actions of the current page and places them on the right side.
- */
-public class PageFormHeaderActionFetcher extends FormHeaderActionFetcher {
-
- public PageFormHeaderActionFetcher(PageForm form) {
- super(form);
- }
-
- @Override
- public PageForm getForm() {
- return (PageForm) super.getForm();
- }
-
- @Override
- public List<IMenu> fetch() {
- List<IMenu> headerActions = super.fetch();
- IPage page = getForm().getPage();
-
- List<IMenu> nodeActions = ActionButtonBarUtility.fetchPageActions(page);
- for (IMenu action : nodeActions) {
- AbstractMobileAction.setHorizontalAlignment(action, IMobileAction.HORIZONTAL_ALIGNMENT_RIGHT);
- }
- headerActions.addAll(0, nodeActions);
-
- return headerActions;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.form.outline;
+
+import java.util.List;
+
+import org.eclipse.scout.rt.client.mobile.ui.action.ActionButtonBarUtility;
+import org.eclipse.scout.rt.client.mobile.ui.form.AbstractMobileAction;
+import org.eclipse.scout.rt.client.mobile.ui.form.FormHeaderActionFetcher;
+import org.eclipse.scout.rt.client.mobile.ui.form.IMobileAction;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+
+/**
+ * Additionally fetches the actions of the current page and places them on the right side.
+ */
+public class PageFormHeaderActionFetcher extends FormHeaderActionFetcher {
+
+ public PageFormHeaderActionFetcher(PageForm form) {
+ super(form);
+ }
+
+ @Override
+ public PageForm getForm() {
+ return (PageForm) super.getForm();
+ }
+
+ @Override
+ public List<IMenu> fetch() {
+ List<IMenu> headerActions = super.fetch();
+ IPage page = getForm().getPage();
+
+ List<IMenu> nodeActions = ActionButtonBarUtility.fetchPageActions(page);
+ for (IMenu action : nodeActions) {
+ AbstractMobileAction.setHorizontalAlignment(action, IMobileAction.HORIZONTAL_ALIGNMENT_RIGHT);
+ }
+ headerActions.addAll(0, nodeActions);
+
+ return headerActions;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/PageFormManager.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/PageFormManager.java
index ab4c22cc1d..1add945a0b 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/PageFormManager.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/PageFormManager.java
@@ -1,530 +1,530 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.form.outline;
-
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.mobile.ui.desktop.ActiveOutlineObserver;
-import org.eclipse.scout.rt.client.mobile.ui.desktop.MobileDesktopUtility;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
-import org.eclipse.scout.rt.client.ui.basic.tree.TreeAdapter;
-import org.eclipse.scout.rt.client.ui.basic.tree.TreeEvent;
-import org.eclipse.scout.rt.client.ui.desktop.DesktopEvent;
-import org.eclipse.scout.rt.client.ui.desktop.DesktopListener;
-import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutlineTableForm;
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutlineTreeForm;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithNodes;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
-import org.eclipse.scout.service.SERVICES;
-
-public class PageFormManager {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(PageFormManager.class);
-
- private PageFormMap m_pageFormMap;
- private ActiveOutlineObserver m_activeOutlineObserver;
- private P_OutlineTreeListener m_outlineTreeListener;
- private P_DesktopListener m_desktopListener;
- private Map<IPage, String> m_selectedPageSlotMap;
-
- private String m_leftPageSlotViewId;
- private String m_middlePageSlotViewId;
- private boolean m_tableStatusVisible;
- private IDesktop m_desktop;
-
- private List<IForm> m_blockedForms;
- private boolean m_pageSelectionRunning;
-
- public PageFormManager(String... pageSlotViewIds) {
- this(null, pageSlotViewIds);
- }
-
- public PageFormManager(IDesktop desktop, String... pageSlotViewIds) {
- if (desktop == null) {
- desktop = ClientSyncJob.getCurrentSession().getDesktop();
- }
- m_desktop = desktop;
- if (m_desktop == null) {
- throw new IllegalArgumentException("No desktop found. Cannot create OutlineFormsMediator.");
- }
-
- initPageSlots(pageSlotViewIds);
- m_pageFormMap = new PageFormMap();
- m_blockedForms = new LinkedList<IForm>();
- m_activeOutlineObserver = new ActiveOutlineObserver(desktop);
- m_selectedPageSlotMap = new HashMap<IPage, String>();
-
- //Since the page is activated by the outline and the outline itself also listens to tree selection events,
- //a UI listener is attached to make sure this listener is called at the end and therefore after the page has been activated properly.
- m_outlineTreeListener = new P_OutlineTreeListener();
- m_activeOutlineObserver.addOutlineUITreeListener(m_outlineTreeListener);
-
- m_desktopListener = new P_DesktopListener();
- desktop.addDesktopListener(m_desktopListener);
- }
-
- private void initPageSlots(String... pageSlotViewIds) {
- if (pageSlotViewIds == null || pageSlotViewIds.length == 0 || !StringUtility.hasText(pageSlotViewIds[0])) {
- throw new IllegalArgumentException("At least one pageSlotViewId needs to be specified.");
- }
-
- m_leftPageSlotViewId = pageSlotViewIds[0];
- if (pageSlotViewIds.length > 1) {
- m_middlePageSlotViewId = pageSlotViewIds[1];
- }
- }
-
- public void setTableStatusVisible(boolean tableStatusVisible) {
- m_tableStatusVisible = tableStatusVisible;
- }
-
- public boolean isTableStatusVisible() {
- return m_tableStatusVisible;
- }
-
- public String getLeftPageSlotViewId() {
- return m_leftPageSlotViewId;
- }
-
- public String getMiddlePageSlotViewId() {
- return m_middlePageSlotViewId;
- }
-
- public boolean hasOnlyOnePageSlot() {
- return m_middlePageSlotViewId == null;
- }
-
- public boolean isPageSelectionRunning() {
- return m_pageSelectionRunning;
- }
-
- protected void setPageSelectionRunning(boolean pageSelectionRunning) {
- m_pageSelectionRunning = pageSelectionRunning;
- }
-
- public static boolean isDrillDownPage(IPage page) {
- return page instanceof IPageWithTable && page.getParentNode() instanceof IPageWithNodes;
- }
-
- private void destroy() {
- if (m_desktopListener != null) {
- getDesktop().removeDesktopListener(m_desktopListener);
- m_desktopListener = null;
- }
-
- if (m_outlineTreeListener != null) {
- m_activeOutlineObserver.removeOutlineUITreeListener(m_outlineTreeListener);
- m_outlineTreeListener = null;
- }
-
- m_pageFormMap.clear();
- }
-
- private void hidePageForms() {
- IPageForm[] pageForms = getDesktop().findForms(IPageForm.class);
- if (pageForms == null) {
- return;
- }
-
- for (IPageForm pageForm : pageForms) {
- getDesktop().removeForm(pageForm);
- }
- }
-
- private void hidePage(IPage page) throws ProcessingException {
- if (page == null) {
- return;
- }
-
- LOG.debug("Hiding page: " + page);
- IPageForm pageForm = m_pageFormMap.get(page);
- if (pageForm != null) {
- getDesktop().removeForm(pageForm);
- }
- }
-
- private IPageForm showPage(IPage page) throws ProcessingException {
- IPageForm pageForm = getPageForm(page, true);
- if (pageForm != null) {
- return pageForm;
- }
- LOG.debug("Showing page: " + page);
-
- String displayViewId = getLeftPageSlotViewId();
-
- if (!hasOnlyOnePageSlot()) {
- displayViewId = computePageFormSlot(page);
- }
-
- return showPage(page, displayViewId);
- }
-
- public IPageForm getPageForm(IPage page, boolean onlyShowing) {
- return m_pageFormMap.get(page, onlyShowing);
- }
-
- public String computePageFormSlot(IPage page) {
- if (page == null) {
- return null;
- }
-
- if (page instanceof AutoLeafPageWithNodes) {
- return getMiddlePageSlotViewId();
- }
-
- if (page.getParentNode() == null) {
- return getLeftPageSlotViewId();
- }
-
- //PageWithTables should be displayed on the left side
- if (isDrillDownPage(page)) {
- return getLeftPageSlotViewId();
- }
-
- //Special case for nested PageWithTables:
- //The right side can only contain a pageWithTable if the left side also shows a pageWithTable.
- //In that case a selection of the "Details" table row of the right side selects the right pageWithTable again.
- //This pageWithTable should now be displayed on the left side that's why the leftPageSlotViewId is returned.
- String currentViewId = m_selectedPageSlotMap.get(page);
- if (getMiddlePageSlotViewId().equals(currentViewId) && page.getParentPage() instanceof IPageWithTable) {
- return getLeftPageSlotViewId();
- }
-
- return getMiddlePageSlotViewId();
- }
-
- private void showPageInLeftForm(IPage page) throws ProcessingException {
- showPage(page, getLeftPageSlotViewId());
- }
-
- private IPageForm showPage(IPage page, String viewId) throws ProcessingException {
- updateLeftPageIfNecessary(page, viewId);
-
- IPageForm pageForm = m_pageFormMap.get(viewId, page);
- if (pageForm == null) {
- if (getLeftPageSlotViewId().equals(viewId)) {
- pageForm = createMainPageForm(page);
- }
- else {
- pageForm = createPageForm(page);
- }
- pageForm.setAutoAddRemoveOnDesktop(false);
- pageForm.setDisplayViewId(viewId);
- pageForm.start();
-
- m_pageFormMap.put(pageForm);
- }
-
- if (!pageForm.isShowing()) {
- getDesktop().addForm(pageForm);
- }
-
- return pageForm;
- }
-
- /**
- * If a page gets shown on the right side it's necessary to make sure the left side displays the correct page, which
- * is the parent page.
- * <p>
- * Normally, on regular drill down, the left page gets shown first and afterwards the right one. In this situation
- * everything is fine and the method does nothing.<br>
- * The left page may be wrong if the right page gets shown first, which may happen in case of bookmark activation or a
- * node page switch. In such situations the left side needs to be updated with the correct page.
- * <p>
- * Node page switch: The node page on the right side moves to the left side when selecting a node page, happens on
- * nested PageWithNodes
- */
- private void updateLeftPageIfNecessary(IPage page, String viewId) throws ProcessingException {
- if (getMiddlePageSlotViewId() == null) {
- return;
- }
-
- if (getMiddlePageSlotViewId().equals(viewId) && page.getParentPage() != null && !(page instanceof AutoLeafPageWithNodes)) {
- IPageForm parentPageForm = m_pageFormMap.get(page.getParentPage(), true);
- if (parentPageForm == null || getMiddlePageSlotViewId().equals(parentPageForm.getDisplayViewId())) {
-
- //Make sure there is always the correct page on the left side which is the parent page
- showPage(page.getParentPage(), getLeftPageSlotViewId());
- }
- }
- }
-
- private IMainPageForm createMainPageForm(IPage page) throws ProcessingException {
- PageFormConfig config = new PageFormConfig();
- config.setTablePageAllowed(true);
- config.setTableStatusVisible(isTableStatusVisible());
- if (hasOnlyOnePageSlot()) {
- config.setDetailFormVisible(true);
- }
- else {
- config.setKeepSelection(true);
- }
-
- return new MainPageForm(page, this, config);
- }
-
- private IPageForm createPageForm(IPage page) throws ProcessingException {
- PageFormConfig config = new PageFormConfig();
- config.setDetailFormVisible(true);
-
- return new PageForm(page, this, config);
- }
-
- private IDesktop getDesktop() {
- return m_desktop;
- }
-
- public void pageSelectedNotify(PageForm pageForm, IPage selectedPage) throws ProcessingException {
- if (selectedPage == null) {
- return;
- }
-
- //A AutoLeafPage is not attached to a real outline. Since it already has been activated just show it.
- if (selectedPage instanceof AutoLeafPageWithNodes) {
- showPage(selectedPage);
- }
- else {
- if (selectedPage.isSelectedNode()) {
- //Trigger selection again to move it to the left side and to make sure it's treated like a main page (see MultiPageChangeStrategy)
- selectedPage.getOutline().selectNode(null);
- }
- m_selectedPageSlotMap.put(selectedPage, pageForm.getDisplayViewId());
- try {
- selectAndExpandPage(selectedPage);
- }
- finally {
- m_selectedPageSlotMap.remove(selectedPage);
- }
- }
- }
-
- /**
- * Mainly a copy from AbstractTree.getUIFacade.setNodeSelectedAndExpandedFromUI() without setTreeChanging(true/false)
- * and additional outline change.
- * TreeChanging must not be set otherwise collecting node menus does not work anymore.
- */
- private void selectAndExpandPage(IPage page) throws ProcessingException {
- try {
- setPageSelectionRunning(true);
-
- //Make sure outline is correctly set
- IOutline outline = page.getOutline();
- if (getDesktop().getOutline() != page.getOutline()) {
- getDesktop().setOutline(page.getOutline());
- }
-
- //Select node
- ITreeNode node = outline.resolveVirtualNode(page);
- if (node != null) {
- if (node.isChildrenDirty() || node.isChildrenVolatile()) {
- node.loadChildren();
- }
- outline.selectNode(node, false);
- outline.setNodeExpanded(node, true);
- if (!outline.isScrollToSelection()) {
- outline.scrollToSelection();
- }
- }
- }
- finally {
- setPageSelectionRunning(false);
- showBlockedForms();
- }
- }
-
- private void handleTreeNodeSelected(final ITreeNode deselctedNode, final ITreeNode selectedNode) throws ProcessingException {
- LOG.debug("Tree node selected: " + selectedNode);
- if (selectedNode == null) {
- hidePageForms();
- return;
- }
-
- IPageForm pageForm = showPage((IPage) selectedNode);
- pageForm.pageSelectedNotify();
- }
-
- private void handleTreeNodesDeleted(ITreeNode[] deletedNodes) throws ProcessingException {
- if (deletedNodes == null) {
- return;
- }
-
- for (ITreeNode node : deletedNodes) {
-
- //If a node gets deleted the child nodes typically get detached from the tree too, but no separate event will be fired.
- //So we need to make sure the pageForms of the child pages are properly removed as well.
- handleTreeNodesDeleted(node.getChildNodes());
-
- if (node instanceof IPage && node.getTree() == null) {
- IPage page = (IPage) node;
- handlePageRemoved(page);
- }
- }
- }
-
- public void pageRemovedNotify(PageForm pageForm, IPage page) throws ProcessingException {
- handlePageRemoved(page);
- }
-
- private void handlePageRemoved(IPage page) throws ProcessingException {
- if (page == null) {
- return;
- }
-
- try {
- IPageForm pageForm = m_pageFormMap.get(page);
- if (pageForm != null) {
- pageForm.doClose();
- hidePage(page);
- }
- }
- finally {
- m_pageFormMap.remove(page);
- }
-
- // Normally, when removing the selected page, the parent page gets selected and the corresponding page form shown.
- // In case of the AutoLeafPageWithNodes, the parent page already is selected, so no selection event will be fired. Therefore we need to show the page form manually.
- if (page instanceof AutoLeafPageWithNodes) {
- IPage parentPage = ((AutoLeafPageWithNodes) page).getActualParentPage();
- if (parentPage.isSelectedNode()) {
- showPage(parentPage);
- }
- }
- }
-
- public boolean acceptForm(IForm form) {
- //Outline forms are not used at all -> never show them.
- if (form instanceof IOutlineTreeForm || form instanceof IOutlineTableForm) {
- return false;
- }
-
- //Always block detail forms because they are displayed as inner forms on the page forms.
- if (form == getDesktop().getPageDetailForm()) {
- return false;
- }
-
- //If the page selection is running queue the opening of the form to make sure the page form is opened first.
- if (isPageSelectionRunning()) {
- if (!(form instanceof PageForm)) {
- if (!m_blockedForms.contains(form)) {
- m_blockedForms.add(form);
- }
- return false;
- }
- }
-
- return true;
- }
-
- private void showBlockedForms() {
- for (IForm form : m_blockedForms.toArray(new IForm[m_blockedForms.size()])) {
- m_blockedForms.remove(form);
- MobileDesktopUtility.addFormToDesktop(form);
- }
- }
-
- private void handlePageFormAdded(PageForm pageForm) throws ProcessingException {
- if (pageForm == null) {
- return;
- }
-
- String displayViewId = pageForm.getDisplayViewId();
- MobileDesktopUtility.removeFormsFromDesktop(IPageForm.class, displayViewId, pageForm);
- if (getLeftPageSlotViewId().equals(displayViewId)) {
- MobileDesktopUtility.removeFormsFromDesktop(IPageForm.class, getMiddlePageSlotViewId(), pageForm);
- }
- pageForm.formAddedNotify();
- }
-
- private void handlePageFormRemoved(PageForm pageForm) throws ProcessingException {
- if (pageForm == null) {
- return;
- }
-
- pageForm.formRemovedNotify();
- }
-
- private class P_OutlineTreeListener extends TreeAdapter {
-
- @Override
- public void treeChanged(TreeEvent event) {
- try {
- switch (event.getType()) {
- case TreeEvent.TYPE_NODES_SELECTED: {
- handleTreeNodeSelected(event.getDeselectedNode(), event.getNewSelectedNode());
- break;
- }
- case TreeEvent.TYPE_NODES_DELETED: {
- handleTreeNodesDeleted(event.getNodes());
- break;
- }
- }
- }
- catch (ProcessingException e) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- }
-
- }
-
- private class P_DesktopListener implements DesktopListener {
-
- @Override
- public void desktopChanged(DesktopEvent event) {
- try {
- switch (event.getType()) {
- case DesktopEvent.TYPE_FORM_ADDED: {
- handleFormAdded(event);
- break;
- }
- case DesktopEvent.TYPE_FORM_REMOVED: {
- handleFormRemoved(event);
- break;
- }
- case DesktopEvent.TYPE_DESKTOP_CLOSED: {
- destroy();
- break;
- }
- }
- }
- catch (ProcessingException e) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- }
-
- private void handleFormAdded(DesktopEvent event) throws ProcessingException {
- IForm form = event.getForm();
- if (form instanceof PageForm) {
- handlePageFormAdded((PageForm) form);
- }
- }
-
- private void handleFormRemoved(DesktopEvent event) throws ProcessingException {
- IForm form = event.getForm();
- if (form instanceof PageForm) {
- handlePageFormRemoved((PageForm) form);
- }
- }
-
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.form.outline;
+
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.mobile.ui.desktop.ActiveOutlineObserver;
+import org.eclipse.scout.rt.client.mobile.ui.desktop.MobileDesktopUtility;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
+import org.eclipse.scout.rt.client.ui.basic.tree.TreeAdapter;
+import org.eclipse.scout.rt.client.ui.basic.tree.TreeEvent;
+import org.eclipse.scout.rt.client.ui.desktop.DesktopEvent;
+import org.eclipse.scout.rt.client.ui.desktop.DesktopListener;
+import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutlineTableForm;
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutlineTreeForm;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithNodes;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
+import org.eclipse.scout.service.SERVICES;
+
+public class PageFormManager {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(PageFormManager.class);
+
+ private PageFormMap m_pageFormMap;
+ private ActiveOutlineObserver m_activeOutlineObserver;
+ private P_OutlineTreeListener m_outlineTreeListener;
+ private P_DesktopListener m_desktopListener;
+ private Map<IPage, String> m_selectedPageSlotMap;
+
+ private String m_leftPageSlotViewId;
+ private String m_middlePageSlotViewId;
+ private boolean m_tableStatusVisible;
+ private IDesktop m_desktop;
+
+ private List<IForm> m_blockedForms;
+ private boolean m_pageSelectionRunning;
+
+ public PageFormManager(String... pageSlotViewIds) {
+ this(null, pageSlotViewIds);
+ }
+
+ public PageFormManager(IDesktop desktop, String... pageSlotViewIds) {
+ if (desktop == null) {
+ desktop = ClientSyncJob.getCurrentSession().getDesktop();
+ }
+ m_desktop = desktop;
+ if (m_desktop == null) {
+ throw new IllegalArgumentException("No desktop found. Cannot create OutlineFormsMediator.");
+ }
+
+ initPageSlots(pageSlotViewIds);
+ m_pageFormMap = new PageFormMap();
+ m_blockedForms = new LinkedList<IForm>();
+ m_activeOutlineObserver = new ActiveOutlineObserver(desktop);
+ m_selectedPageSlotMap = new HashMap<IPage, String>();
+
+ //Since the page is activated by the outline and the outline itself also listens to tree selection events,
+ //a UI listener is attached to make sure this listener is called at the end and therefore after the page has been activated properly.
+ m_outlineTreeListener = new P_OutlineTreeListener();
+ m_activeOutlineObserver.addOutlineUITreeListener(m_outlineTreeListener);
+
+ m_desktopListener = new P_DesktopListener();
+ desktop.addDesktopListener(m_desktopListener);
+ }
+
+ private void initPageSlots(String... pageSlotViewIds) {
+ if (pageSlotViewIds == null || pageSlotViewIds.length == 0 || !StringUtility.hasText(pageSlotViewIds[0])) {
+ throw new IllegalArgumentException("At least one pageSlotViewId needs to be specified.");
+ }
+
+ m_leftPageSlotViewId = pageSlotViewIds[0];
+ if (pageSlotViewIds.length > 1) {
+ m_middlePageSlotViewId = pageSlotViewIds[1];
+ }
+ }
+
+ public void setTableStatusVisible(boolean tableStatusVisible) {
+ m_tableStatusVisible = tableStatusVisible;
+ }
+
+ public boolean isTableStatusVisible() {
+ return m_tableStatusVisible;
+ }
+
+ public String getLeftPageSlotViewId() {
+ return m_leftPageSlotViewId;
+ }
+
+ public String getMiddlePageSlotViewId() {
+ return m_middlePageSlotViewId;
+ }
+
+ public boolean hasOnlyOnePageSlot() {
+ return m_middlePageSlotViewId == null;
+ }
+
+ public boolean isPageSelectionRunning() {
+ return m_pageSelectionRunning;
+ }
+
+ protected void setPageSelectionRunning(boolean pageSelectionRunning) {
+ m_pageSelectionRunning = pageSelectionRunning;
+ }
+
+ public static boolean isDrillDownPage(IPage page) {
+ return page instanceof IPageWithTable && page.getParentNode() instanceof IPageWithNodes;
+ }
+
+ private void destroy() {
+ if (m_desktopListener != null) {
+ getDesktop().removeDesktopListener(m_desktopListener);
+ m_desktopListener = null;
+ }
+
+ if (m_outlineTreeListener != null) {
+ m_activeOutlineObserver.removeOutlineUITreeListener(m_outlineTreeListener);
+ m_outlineTreeListener = null;
+ }
+
+ m_pageFormMap.clear();
+ }
+
+ private void hidePageForms() {
+ IPageForm[] pageForms = getDesktop().findForms(IPageForm.class);
+ if (pageForms == null) {
+ return;
+ }
+
+ for (IPageForm pageForm : pageForms) {
+ getDesktop().removeForm(pageForm);
+ }
+ }
+
+ private void hidePage(IPage page) throws ProcessingException {
+ if (page == null) {
+ return;
+ }
+
+ LOG.debug("Hiding page: " + page);
+ IPageForm pageForm = m_pageFormMap.get(page);
+ if (pageForm != null) {
+ getDesktop().removeForm(pageForm);
+ }
+ }
+
+ private IPageForm showPage(IPage page) throws ProcessingException {
+ IPageForm pageForm = getPageForm(page, true);
+ if (pageForm != null) {
+ return pageForm;
+ }
+ LOG.debug("Showing page: " + page);
+
+ String displayViewId = getLeftPageSlotViewId();
+
+ if (!hasOnlyOnePageSlot()) {
+ displayViewId = computePageFormSlot(page);
+ }
+
+ return showPage(page, displayViewId);
+ }
+
+ public IPageForm getPageForm(IPage page, boolean onlyShowing) {
+ return m_pageFormMap.get(page, onlyShowing);
+ }
+
+ public String computePageFormSlot(IPage page) {
+ if (page == null) {
+ return null;
+ }
+
+ if (page instanceof AutoLeafPageWithNodes) {
+ return getMiddlePageSlotViewId();
+ }
+
+ if (page.getParentNode() == null) {
+ return getLeftPageSlotViewId();
+ }
+
+ //PageWithTables should be displayed on the left side
+ if (isDrillDownPage(page)) {
+ return getLeftPageSlotViewId();
+ }
+
+ //Special case for nested PageWithTables:
+ //The right side can only contain a pageWithTable if the left side also shows a pageWithTable.
+ //In that case a selection of the "Details" table row of the right side selects the right pageWithTable again.
+ //This pageWithTable should now be displayed on the left side that's why the leftPageSlotViewId is returned.
+ String currentViewId = m_selectedPageSlotMap.get(page);
+ if (getMiddlePageSlotViewId().equals(currentViewId) && page.getParentPage() instanceof IPageWithTable) {
+ return getLeftPageSlotViewId();
+ }
+
+ return getMiddlePageSlotViewId();
+ }
+
+ private void showPageInLeftForm(IPage page) throws ProcessingException {
+ showPage(page, getLeftPageSlotViewId());
+ }
+
+ private IPageForm showPage(IPage page, String viewId) throws ProcessingException {
+ updateLeftPageIfNecessary(page, viewId);
+
+ IPageForm pageForm = m_pageFormMap.get(viewId, page);
+ if (pageForm == null) {
+ if (getLeftPageSlotViewId().equals(viewId)) {
+ pageForm = createMainPageForm(page);
+ }
+ else {
+ pageForm = createPageForm(page);
+ }
+ pageForm.setAutoAddRemoveOnDesktop(false);
+ pageForm.setDisplayViewId(viewId);
+ pageForm.start();
+
+ m_pageFormMap.put(pageForm);
+ }
+
+ if (!pageForm.isShowing()) {
+ getDesktop().addForm(pageForm);
+ }
+
+ return pageForm;
+ }
+
+ /**
+ * If a page gets shown on the right side it's necessary to make sure the left side displays the correct page, which
+ * is the parent page.
+ * <p>
+ * Normally, on regular drill down, the left page gets shown first and afterwards the right one. In this situation
+ * everything is fine and the method does nothing.<br>
+ * The left page may be wrong if the right page gets shown first, which may happen in case of bookmark activation or a
+ * node page switch. In such situations the left side needs to be updated with the correct page.
+ * <p>
+ * Node page switch: The node page on the right side moves to the left side when selecting a node page, happens on
+ * nested PageWithNodes
+ */
+ private void updateLeftPageIfNecessary(IPage page, String viewId) throws ProcessingException {
+ if (getMiddlePageSlotViewId() == null) {
+ return;
+ }
+
+ if (getMiddlePageSlotViewId().equals(viewId) && page.getParentPage() != null && !(page instanceof AutoLeafPageWithNodes)) {
+ IPageForm parentPageForm = m_pageFormMap.get(page.getParentPage(), true);
+ if (parentPageForm == null || getMiddlePageSlotViewId().equals(parentPageForm.getDisplayViewId())) {
+
+ //Make sure there is always the correct page on the left side which is the parent page
+ showPage(page.getParentPage(), getLeftPageSlotViewId());
+ }
+ }
+ }
+
+ private IMainPageForm createMainPageForm(IPage page) throws ProcessingException {
+ PageFormConfig config = new PageFormConfig();
+ config.setTablePageAllowed(true);
+ config.setTableStatusVisible(isTableStatusVisible());
+ if (hasOnlyOnePageSlot()) {
+ config.setDetailFormVisible(true);
+ }
+ else {
+ config.setKeepSelection(true);
+ }
+
+ return new MainPageForm(page, this, config);
+ }
+
+ private IPageForm createPageForm(IPage page) throws ProcessingException {
+ PageFormConfig config = new PageFormConfig();
+ config.setDetailFormVisible(true);
+
+ return new PageForm(page, this, config);
+ }
+
+ private IDesktop getDesktop() {
+ return m_desktop;
+ }
+
+ public void pageSelectedNotify(PageForm pageForm, IPage selectedPage) throws ProcessingException {
+ if (selectedPage == null) {
+ return;
+ }
+
+ //A AutoLeafPage is not attached to a real outline. Since it already has been activated just show it.
+ if (selectedPage instanceof AutoLeafPageWithNodes) {
+ showPage(selectedPage);
+ }
+ else {
+ if (selectedPage.isSelectedNode()) {
+ //Trigger selection again to move it to the left side and to make sure it's treated like a main page (see MultiPageChangeStrategy)
+ selectedPage.getOutline().selectNode(null);
+ }
+ m_selectedPageSlotMap.put(selectedPage, pageForm.getDisplayViewId());
+ try {
+ selectAndExpandPage(selectedPage);
+ }
+ finally {
+ m_selectedPageSlotMap.remove(selectedPage);
+ }
+ }
+ }
+
+ /**
+ * Mainly a copy from AbstractTree.getUIFacade.setNodeSelectedAndExpandedFromUI() without setTreeChanging(true/false)
+ * and additional outline change.
+ * TreeChanging must not be set otherwise collecting node menus does not work anymore.
+ */
+ private void selectAndExpandPage(IPage page) throws ProcessingException {
+ try {
+ setPageSelectionRunning(true);
+
+ //Make sure outline is correctly set
+ IOutline outline = page.getOutline();
+ if (getDesktop().getOutline() != page.getOutline()) {
+ getDesktop().setOutline(page.getOutline());
+ }
+
+ //Select node
+ ITreeNode node = outline.resolveVirtualNode(page);
+ if (node != null) {
+ if (node.isChildrenDirty() || node.isChildrenVolatile()) {
+ node.loadChildren();
+ }
+ outline.selectNode(node, false);
+ outline.setNodeExpanded(node, true);
+ if (!outline.isScrollToSelection()) {
+ outline.scrollToSelection();
+ }
+ }
+ }
+ finally {
+ setPageSelectionRunning(false);
+ showBlockedForms();
+ }
+ }
+
+ private void handleTreeNodeSelected(final ITreeNode deselctedNode, final ITreeNode selectedNode) throws ProcessingException {
+ LOG.debug("Tree node selected: " + selectedNode);
+ if (selectedNode == null) {
+ hidePageForms();
+ return;
+ }
+
+ IPageForm pageForm = showPage((IPage) selectedNode);
+ pageForm.pageSelectedNotify();
+ }
+
+ private void handleTreeNodesDeleted(ITreeNode[] deletedNodes) throws ProcessingException {
+ if (deletedNodes == null) {
+ return;
+ }
+
+ for (ITreeNode node : deletedNodes) {
+
+ //If a node gets deleted the child nodes typically get detached from the tree too, but no separate event will be fired.
+ //So we need to make sure the pageForms of the child pages are properly removed as well.
+ handleTreeNodesDeleted(node.getChildNodes());
+
+ if (node instanceof IPage && node.getTree() == null) {
+ IPage page = (IPage) node;
+ handlePageRemoved(page);
+ }
+ }
+ }
+
+ public void pageRemovedNotify(PageForm pageForm, IPage page) throws ProcessingException {
+ handlePageRemoved(page);
+ }
+
+ private void handlePageRemoved(IPage page) throws ProcessingException {
+ if (page == null) {
+ return;
+ }
+
+ try {
+ IPageForm pageForm = m_pageFormMap.get(page);
+ if (pageForm != null) {
+ pageForm.doClose();
+ hidePage(page);
+ }
+ }
+ finally {
+ m_pageFormMap.remove(page);
+ }
+
+ // Normally, when removing the selected page, the parent page gets selected and the corresponding page form shown.
+ // In case of the AutoLeafPageWithNodes, the parent page already is selected, so no selection event will be fired. Therefore we need to show the page form manually.
+ if (page instanceof AutoLeafPageWithNodes) {
+ IPage parentPage = ((AutoLeafPageWithNodes) page).getActualParentPage();
+ if (parentPage.isSelectedNode()) {
+ showPage(parentPage);
+ }
+ }
+ }
+
+ public boolean acceptForm(IForm form) {
+ //Outline forms are not used at all -> never show them.
+ if (form instanceof IOutlineTreeForm || form instanceof IOutlineTableForm) {
+ return false;
+ }
+
+ //Always block detail forms because they are displayed as inner forms on the page forms.
+ if (form == getDesktop().getPageDetailForm()) {
+ return false;
+ }
+
+ //If the page selection is running queue the opening of the form to make sure the page form is opened first.
+ if (isPageSelectionRunning()) {
+ if (!(form instanceof PageForm)) {
+ if (!m_blockedForms.contains(form)) {
+ m_blockedForms.add(form);
+ }
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ private void showBlockedForms() {
+ for (IForm form : m_blockedForms.toArray(new IForm[m_blockedForms.size()])) {
+ m_blockedForms.remove(form);
+ MobileDesktopUtility.addFormToDesktop(form);
+ }
+ }
+
+ private void handlePageFormAdded(PageForm pageForm) throws ProcessingException {
+ if (pageForm == null) {
+ return;
+ }
+
+ String displayViewId = pageForm.getDisplayViewId();
+ MobileDesktopUtility.removeFormsFromDesktop(IPageForm.class, displayViewId, pageForm);
+ if (getLeftPageSlotViewId().equals(displayViewId)) {
+ MobileDesktopUtility.removeFormsFromDesktop(IPageForm.class, getMiddlePageSlotViewId(), pageForm);
+ }
+ pageForm.formAddedNotify();
+ }
+
+ private void handlePageFormRemoved(PageForm pageForm) throws ProcessingException {
+ if (pageForm == null) {
+ return;
+ }
+
+ pageForm.formRemovedNotify();
+ }
+
+ private class P_OutlineTreeListener extends TreeAdapter {
+
+ @Override
+ public void treeChanged(TreeEvent event) {
+ try {
+ switch (event.getType()) {
+ case TreeEvent.TYPE_NODES_SELECTED: {
+ handleTreeNodeSelected(event.getDeselectedNode(), event.getNewSelectedNode());
+ break;
+ }
+ case TreeEvent.TYPE_NODES_DELETED: {
+ handleTreeNodesDeleted(event.getNodes());
+ break;
+ }
+ }
+ }
+ catch (ProcessingException e) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ }
+
+ }
+
+ private class P_DesktopListener implements DesktopListener {
+
+ @Override
+ public void desktopChanged(DesktopEvent event) {
+ try {
+ switch (event.getType()) {
+ case DesktopEvent.TYPE_FORM_ADDED: {
+ handleFormAdded(event);
+ break;
+ }
+ case DesktopEvent.TYPE_FORM_REMOVED: {
+ handleFormRemoved(event);
+ break;
+ }
+ case DesktopEvent.TYPE_DESKTOP_CLOSED: {
+ destroy();
+ break;
+ }
+ }
+ }
+ catch (ProcessingException e) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ }
+
+ private void handleFormAdded(DesktopEvent event) throws ProcessingException {
+ IForm form = event.getForm();
+ if (form instanceof PageForm) {
+ handlePageFormAdded((PageForm) form);
+ }
+ }
+
+ private void handleFormRemoved(DesktopEvent event) throws ProcessingException {
+ IForm form = event.getForm();
+ if (form instanceof PageForm) {
+ handlePageFormRemoved((PageForm) form);
+ }
+ }
+
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/PageFormMap.java b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/PageFormMap.java
index aadf353de9..ba8926385a 100644
--- a/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/PageFormMap.java
+++ b/org.eclipse.scout.rt.client.mobile/src/org/eclipse/scout/rt/client/mobile/ui/form/outline/PageFormMap.java
@@ -1,104 +1,104 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.mobile.ui.form.outline;
-
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.scout.rt.client.ClientJob;
-import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-
-public class PageFormMap {
- private Map<String, List<IPageForm>> m_pageFormMaps;
-
- public PageFormMap() {
- m_pageFormMaps = new HashMap<String, List<IPageForm>>();
- }
-
- public IPageForm get(IPage page) {
- return get(page, false);
- }
-
- public IPageForm get(IPage page, boolean onlyVisible) {
- if (page == null) {
- return null;
- }
-
- for (List<IPageForm> pageFormList : m_pageFormMaps.values()) {
- if (pageFormList == null) {
- continue;
- }
-
- for (IPageForm pageForm : pageFormList) {
- if (page.equals(pageForm.getPage())) {
- IDesktop desktop = ClientJob.getCurrentSession().getDesktop();
- if (!onlyVisible || desktop.isShowing(pageForm)) {
- return pageForm;
- }
- }
- }
- }
-
- return null;
- }
-
- public IPageForm get(String displayViewId, IPage page) {
- if (displayViewId == null || page == null) {
- return null;
- }
-
- List<IPageForm> list = m_pageFormMaps.get(displayViewId);
- if (list == null) {
- return null;
- }
-
- for (IPageForm pageForm : list) {
- if (displayViewId.equals(pageForm.getDisplayViewId()) && page.equals(pageForm.getPage())) {
- return pageForm;
- }
- }
-
- return null;
- }
-
- public void put(IPageForm pageForm) {
- String displayViewId = pageForm.getDisplayViewId();
- List<IPageForm> list = m_pageFormMaps.get(displayViewId);
- if (list == null) {
- list = new LinkedList<IPageForm>();
- }
-
- list.add(pageForm);
- m_pageFormMaps.put(displayViewId, list);
- }
-
- public void remove(IPage page) {
- for (List<IPageForm> pageFormList : m_pageFormMaps.values()) {
- if (pageFormList == null) {
- continue;
- }
-
- for (IPageForm pageForm : new LinkedList<IPageForm>(pageFormList)) {
- if (page.equals(pageForm.getPage())) {
- pageFormList.remove(pageForm);
- }
- }
- }
- }
-
- public void clear() {
- m_pageFormMaps.clear();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.mobile.ui.form.outline;
+
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.scout.rt.client.ClientJob;
+import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+
+public class PageFormMap {
+ private Map<String, List<IPageForm>> m_pageFormMaps;
+
+ public PageFormMap() {
+ m_pageFormMaps = new HashMap<String, List<IPageForm>>();
+ }
+
+ public IPageForm get(IPage page) {
+ return get(page, false);
+ }
+
+ public IPageForm get(IPage page, boolean onlyVisible) {
+ if (page == null) {
+ return null;
+ }
+
+ for (List<IPageForm> pageFormList : m_pageFormMaps.values()) {
+ if (pageFormList == null) {
+ continue;
+ }
+
+ for (IPageForm pageForm : pageFormList) {
+ if (page.equals(pageForm.getPage())) {
+ IDesktop desktop = ClientJob.getCurrentSession().getDesktop();
+ if (!onlyVisible || desktop.isShowing(pageForm)) {
+ return pageForm;
+ }
+ }
+ }
+ }
+
+ return null;
+ }
+
+ public IPageForm get(String displayViewId, IPage page) {
+ if (displayViewId == null || page == null) {
+ return null;
+ }
+
+ List<IPageForm> list = m_pageFormMaps.get(displayViewId);
+ if (list == null) {
+ return null;
+ }
+
+ for (IPageForm pageForm : list) {
+ if (displayViewId.equals(pageForm.getDisplayViewId()) && page.equals(pageForm.getPage())) {
+ return pageForm;
+ }
+ }
+
+ return null;
+ }
+
+ public void put(IPageForm pageForm) {
+ String displayViewId = pageForm.getDisplayViewId();
+ List<IPageForm> list = m_pageFormMaps.get(displayViewId);
+ if (list == null) {
+ list = new LinkedList<IPageForm>();
+ }
+
+ list.add(pageForm);
+ m_pageFormMaps.put(displayViewId, list);
+ }
+
+ public void remove(IPage page) {
+ for (List<IPageForm> pageFormList : m_pageFormMaps.values()) {
+ if (pageFormList == null) {
+ continue;
+ }
+
+ for (IPageForm pageForm : new LinkedList<IPageForm>(pageFormList)) {
+ if (page.equals(pageForm.getPage())) {
+ pageFormList.remove(pageForm);
+ }
+ }
+ }
+ }
+
+ public void clear() {
+ m_pageFormMaps.clear();
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/.settings/org.eclipse.pde.core.prefs b/org.eclipse.scout.rt.client/.settings/org.eclipse.pde.core.prefs
index baef13dd8c..a3a50fc8da 100644
--- a/org.eclipse.scout.rt.client/.settings/org.eclipse.pde.core.prefs
+++ b/org.eclipse.scout.rt.client/.settings/org.eclipse.pde.core.prefs
@@ -1,3 +1,3 @@
-#Mon Jul 11 16:16:00 CEST 2011
-eclipse.preferences.version=1
-pluginProject.extensions=true
+#Mon Jul 11 16:16:00 CEST 2011
+eclipse.preferences.version=1
+pluginProject.extensions=true
diff --git a/org.eclipse.scout.rt.client/Release Notes.txt b/org.eclipse.scout.rt.client/Release Notes.txt
index 20b515d1d5..ae1bae55fd 100644
--- a/org.eclipse.scout.rt.client/Release Notes.txt
+++ b/org.eclipse.scout.rt.client/Release Notes.txt
@@ -1,857 +1,857 @@
-14.07.2010 imo
-Since model-based selection filtering leads to many defects and misunderstandings. See ticket 87693 and others (follow).
-removed ITable.acceptSelection and AbstractTable.execAcceptSelection
-removed ITree.acceptSelection and AbstractTree.execAcceptSelection
-removed AbstractListBox.execAcceptSelection
-removed AbstractTreeBox.execAcceptSelection
-old:
- @Override
- protected boolean execAcceptSelection(ITreeNode node, Long value, int level) {
- return level >= 2;
- }
-new:
- @Override
- protected void execFilterNewNode(ITreeNode newNode, int level) throws ProcessingException {
- newNode.setEnabled(level >= 2);
- }
-
-14.07.2010 imo
-Disabled rows on ITable and disabled nodes on ITree are (now) selectable, and support for context menus.
-
-14.07.2010 imo
-Changed model of listbox and treebox. The value (checked keys) is separated from the selection (table selection)
-The (existing) checkable property is used to distinguish between listboxes with checkboxes and listboxes that behave like tables.
-On checkable listboxes (normally multi-selection boxes) selecting a row is NOT the same as checking the rows checkbox.
-On non-checkable listboxes (normally single-selection boxes) selecting a row is the same as checking the corresponding key.
-renamed getConfiguredFilterSelectedRows to getConfiguredFilterCheckedRows
-added ITableRow.isChecked
-added ITableRow.setChecked
-added ITreeNode.isChecked
-added ITreeNode.setChecked
-renamed all IListBox.*Select* to IListBox.*Check*
-renamed all ITreeBox.*Select* to ITreeBox.*Check*
-Migration:
-Check all occurrences of ITable.setMultiSelect(true/false) and check if it is a listbox table.
-Most such cases are replaced by ITable.setMultiCheck(true/false), except those where the listbox was set to non-checkable
-either by getConfiguredCheckable(){return false;} or by getMyListBox().getTable().setCheckable(false);
-
-14.07.2010 imo
-Removed the ITable.getContextRow since this is now the same as getSelectedRow()
-Removed the ITree.getContextNode since this is now the same as getSelectedNode()
-
-14.07.2010 imo
-Removed AbstractAction/AbstractMenu.getConfiguredNonSelectionAction() since this is obsolete now that disabled rows can be selected.
-
-15.07.2010 imo
-Removed table context row and tree context node
-old:
- protected void execContextCellChanged(ITableRow row, IColumn col) throws ProcessingException {
- ...
- }
-new:
- protected void execRowClick(ITableRow row) throws ProcessingException {
- IColumn col=getContextColumn();
- ...
- }
-
-17.07.2010 imo
-Merged Rayo and Scout core widget copies of DateField, TimeField. Created new combined popup window with date/time and a new analog clock.
-
-20.07.2010 imo
-Refactoring IGroupbox.isBorderEnabled and BORDER_DECORATION_NONE
-Due to misleading naming and for better understanding
-Migration:
-RENAME AbstractGroupbox.getConfiguredBorderEnabled TO AbstractGroupbox.getConfiguredBorderVisible
-RENAME IGroupbox.isBorderEnabled TO IGroupbox.isBorderVisible
-RENAME IGroupbox.setBorderEnabled TO IGroupbox.setBorderVisible
-RENAME IGroupbox.BORDER_DECORATION_NONE TO IGroupbox.BORDER_DECORATION_EMPTY.
-
-20.07.2010 imo
-Merged concepts of cyclic locking on swingscout compositions using only a scout-update lock and a ignore-scout-event set throughout all implementations.
-Removed various separate optimistic locks.
-Migration: none necessary
-
-22.07.2010 imo
-NEW property "Tray visible" on IDesktop
-NEW broadcast event TYPE_TRAY_POPUP on DesktopEvent to collect menus for the tray
-NEW method IDesktopUiFacade.fireTrayPopupFromUI to get the tray menus
-NEW operation AbstractDesktop.execAddTrayMenus to contribute to the tray menu
-Migration: none necessary
-
-11.08.2010 imo
-Added cache to Introspector.getBeanInfo: 500ms down to 1 ms
-Saves 1 seconds on all forms when loading and storing
-Migration: none necessary
-
-19.08.2010 imo
-Tuned Introspector.getBeanInfo: 1ms down to 0.05 ms
-Saves 1-4 seconds on all forms when loading and storing
-Migration: none necessary
-
-20.08.2010 imo
-Moved org.eclipse.scout.rt.client.ui.form.fields.htmlfield.HTMLUtility to org.eclipse.scout.commons.HTMLUtility
-Migration: rename org.eclipse.scout.rt.client.ui.form.fields.htmlfield.HTMLUtility by org.eclipse.scout.commons.HTMLUtility
-
-20.08.2010 imo
-Ticket 92'775 revealed that WizardEvents for Suspend,Finish,Cancel are never fired and also not used, since they are subsumized under TYPE_CLOSED.
-However, in order to find out under which condition the wizard was closed, there is a new property IWizard.getCloseType that returns the CloseType enum.
-Migration: (rare) if really used, replace the WizardEvent types TYPE_CANCELLED, TYPE_SUSPENDED, TYPE_FINISHED by TYPE_CLOSED and use IWizard.getCloseType() for details.
-
-30.08.2010 imo
-Ticket 90'088
-Dropped AbstractTable.execSortDataSource(IColumn[] sortColumns)
-This operation is a legacy from scout 2 and is never and nowhere used.
-Migration: if however used, please report to tools@bsiag.com
-
-30.08.2010 abr
-Ticket 93'106: Fixed visibility of the IOutlineTableForm when it is initialized.
-Migration: none
-
-30.08.2010 imo
-Ticket 90'088
-Reset of table columns was re-modeled to be more finegrained.
-Merged AbstractTable.execResetColumnSortOrder with AbstractTable.execResetDisplayableColumns to
-AbstractTable.execResetColumns(boolean visibility, boolean order, boolean sorting, boolean widths)
-This operation is rarely used in custom code.
-Migration: When using these operations, rename it and check the boolean argument as to what aspect is resetting.
-
-30.08.2010 imo
-Ticket 90'088
-Additional table header menu for "Column Filter" similar to excel AutoFilter
-Migration: None
-
-07.09.2010 imo
-Added new IForm display hint: DISPLAY_HINT_POPUP
-
-13.09.2010 abr
-Ticket 91'279
-Added IColumn.isVisibleInternal() that is used to for storing a table column's UI preferences (uses visible only instead of visible && displayable && visibleGranted).
-Migration: None
-
-01.11.2010 pba
-Added opportunity for lazy initialization of search forms on table pages.
-Added org.eclipse.scout.rt.client.ui.desktop.outline.pages.AbstractPageWithTable.execInitSearchForm().
-Migration: optional MOVE all your search form related initialization code form the execInitPage() method to execInitSearchForm().
-
-20.12.2010 imo
-Consolidation of date/time fields. The existing ITimeField is based on Double and is replaced by a new AbstractTimeField based on Date and subclassing AbstractDateField.
-Migration: Usages of AbstractTimeField must be reviewed, form data fields must be changed from Double to Date.
-Legacy support: AbstractTimeColumn and AbstractTimeField have setTimeValue/getTimeValue of type Double, the column accepts/tolerates Double and Date as values.
-
-21.12.2010 imo
-Extracted DataModel with entities and attributes out of AbstractComposerField and moved to org.eclipse.scout.rt.shared.data.model
-Migration:
-rename IComposerOp -> IDataModelAttributeOp
-rename IComposerEntity -> IDataModelEntity
-rename IComposerAttribute -> IDataModelAttribute
-rename AbstractComposerEntity -> AbstractDataModelEntity
-rename AbstractAttributeEntity -> AbstractDataModelAttribute
-rename ComposerAttributeInjector -> DataModelAttributeInjector
-rename ComposerConstants -> DataModelConstants
-rename org.eclipse.scout.rt.client.ui.form.fields.composer.attribute.IDataModelAttributeOp -> org.eclipse.scout.rt.shared.data.model.IDataModelAttributeOp
-rename org.eclipse.scout.rt.client.ui.form.fields.composer.attribute.IDataModelEntity -> org.eclipse.scout.rt.shared.data.model.IDataModelEntity
-rename org.eclipse.scout.rt.client.ui.form.fields.composer.attribute.IDataModelAttribute -> org.eclipse.scout.rt.shared.data.model.IDataModelAttribute
-rename org.eclipse.scout.rt.client.ui.form.fields.composer.attribute.AbstractDataModelEntity -> org.eclipse.scout.rt.shared.data.model.AbstractDataModelEntity
-rename org.eclipse.scout.rt.client.ui.form.fields.composer.attribute.AbstractDataModelAttribute -> org.eclipse.scout.rt.shared.data.model.AbstractDataModelAttribute
-rename org.eclipse.scout.rt.client.ui.form.fields.composer.attribute.DataModelAttributeInjector -> org.eclipse.scout.rt.shared.data.model.DataModelAttributeInjector
-rename org.eclipse.scout.rt.shared.data.form.fields.composer.DataModelConstants -> org.eclipse.scout.rt.shared.data.model.DataModelConstants
-rename getComposerAttributes() -> getAttributes()
-rename getComposerEntities() -> getEntities()
-rename setComposerAttribute( -> setAttribute(
-Move the composer data model to the shared area:
-extract all entities/attributes from the composer to a new shared DataModel
-In the composer implement execCreateDataModel
-To convert between external entity and attribute ids use DataModelUtility.
-For example: IDataModelEntity e=DataModelUtility.externalIdToEntity(builder.getDataModel(), entityNodeData.getEntityExternalId(), null)
-Legacy:
-There is legacy support with deprecated AbstractComposerAttribute and AbstractComposerEntity. Also inner attributes and entities of a composer field are still valid
-and wrapped in a ComposerFieldDataModel.
-
-21.12.2010 imo
-renamed AbstractComposerAggregationField to AbstractDataModelAggregationField
-renamed AbstractComposerOperatorField to AbstractDataModelOperatorField
-
-27.12.2010 jgu
-Change in field validation: Error status is set to WARN instead of ERROR when an invalid date is entered via date picker.
-Affected Field Types: AbstractDateField, AbstractTimeField, AbstractDateTimeField
-
-Problem:
-Validation errors of text input in date fields lead to different results in the GUI than validation of date input (via date picker of keystrokes).
-Invalid date input is not displayed in the text field whereas invalid text input is. In both cases an error icon is shown to indicate that the entered value is not valid.
-In the case of date input, the date is not displayed in the text field, if it is invalid. When the field is re-validated and the previously entered value was valid, the field is valid again and the error disappears.
-A user might not notice that his input value was not accepted, when working fast.
-
-In both cases the model contains only valid values (as always) and an error status (IProcessingStatus.ERROR).
-
-Solution:
-If a date input is invalid, the error status is set to (IProcessingStatus.WARNING) to indicate that the selected value was not accepted, but there might still be a valid value in the text field.
-The warn status only disappears, if a new date or text is entered.
-
-This solution was chosen based on the following principles:
-- The model should only contain valid values (as before)
-- Text input should not be removed or changed when it is wrong (user experience).
-- Date input should not be displayed in the text field, if invalid, because it may not be possible to format it and the date input may depend on the value in the model (keystrokes).
-
-Migration: None
-
-24.01.2011 dwi
-By default, table cells that are disabled should not be editable.
-Migration: None
-
-27.01.2011 dwi
-Problem:
-In SwingScoutTable#prepareRenderer, evaluation of cell's editable state to draw respective marker icon caused loops and UI freeze.
-So far, the only way to determine cell's editable state was to call AbstractColumn#isCellEditable(ITableRow). This required synchronization with model thread which affected performance badly. Even worse, if model thread was busy, the enqueued request did not succeed at all (timeout).
-Solution:
-- Property added to hold result of AbstractColumn#isCellEditable(ITableRow) which can be evaluated in UI thread without need of model thread synchronization.
-- Population of property: Property is populated when AbstractColumn#decorateCellInternal is called.
-- Change of ICellSpecialization and implementing classes: added ICellSpecialization$isEditable(), added ICellSpecialization#setEditable(boolean)
-- Change of ICell and implementing classes: added ICell#isEditable()) -> default value is false
-- Change of Cell: added Cell#isEditable(), added Cell#setEditableInternal(boolean). Accessor setEditableInternal(boolean) is internal by intention as not intended for public use as various checks in AbstractColumn#execIsEditable are bypassed otherwise (JavaDoc added). E.g., do not use in execDecorateCell.
-- Change of SwingTableModel#isCellEditable() --> synchronization with model thread not neccessary anymore as property can be evaluated thread safe. (Java bean property)
-- Change of SwingScoutTable#prepareRenderer() --> synchronization with model thread for querying editable state not neccessary anymore as property can be evaluated thread safe. (Java bean property)
-Migration: None
-
-10.02.2011 sle
-In SWT Perspective-Handling was never really thought through and tested with more than one perspective and/or more than one scout-application running parallel. This was now done, implemented and tested with Kudi/Bap. (see Visio)
-In general can be said, that now no perspective has to be active/open to run a scout-application. When the Workbench is started the existing scout-application will be started and the model-desktop open. As soon as the perspective is active execGuiAttached will be called on the model-desktop. When the perspective is closed execGuiDettached is called. When a perspective is reset detached/attached is called.
-
-Change in Scout-Client:
-- Everywhere desktop.isGuiAvailable() was called now desktop.isOpened() is called. For Swing there is no change, the two states are changed at the same location.
-- AbstractDesktop.closeInternal goes through all open forms and calls removeForm
-- IDesktopUIFacade has now fireDesktopResetFromUI anymore. This method was used from AbstractSwtEnvironment
-- new Property on IForm: PROP_PERSPECTIVE_ID. This is used from SWT to ensure a form is opend in a chosen perspective. No use in Swing.
-
-Migration: Swing-Gui: none / SWT-Gui: if application uses more than one perspective, changes may be necessary. Please consult with me (s.leicht@bsiag.com / 947)
-
-10.02.2011 abr
-bsi ticket 98'890
-fixed model change counters running out of sync if unchecked exceptions are thrown.
-Migration: None
-
-16.02.2011 imo
-Splitted ITableField tableStatus into tablePopulateStatus and tableSelectionStatus
-
-01.03.2011 pba
-#94708 added new Event public static final int TYPE_TABLE_POPULATED = 820;
-to handle the case, when no rows are returned for the first select
-
-03.03.2011 pba
-bsi ticket #93948
-if the Fileservice has a rootpath set, take it and not the relative one, otherwise it is impossible to give a target path independent of the workbench
-
-04.03.2011 pba
-bsi ticket #99504
-Add menus in outline also for node-, not only table pages
-
-04.03.2011 pba
-bsi ticket #99533
-add a reasonable default implementation for getBookmarkIdentifier() in AbstractPage to avoid caching bugs
-
-10.03.2011 imo
-bsi ticket 96627
-do not activate disabled or invisible outlines when activating bookmark
-
-18.03.2011 imo
-Migration of legacy: moving remaining legacy logic from client to server
-Added TokenBasedSearchFilter, TokenBasedSearchFilterService to support token-based query building on logical level.
-Added LegacySearchFilterService to support global client side legacy handling of search behaviour.
-Migration: None ( legacy search can still be used)
-Continuous Migration:
-1) Create an annotation for already migrated search forms: MigratedSearchForm
-2) in every search form (or if using a custom base class) add:
- @Override
- protected void execResetSearchFilter(SearchFilter searchFilter) throws ProcessingException {
- if (getClass().isAnnotationPresent(MigratedSearchForm.class)) {
- // Migrated SearchForm
- setSearchFilter(new SearchFilter());
- }
- else {
- // Legacy SearchForm
- searchFilter = new LegacySearchFilter();
- setSearchFilter(searchFilter);
- }
- super.execResetSearchFilter(getSearchFilter());
- }
-
-
-15.04.2011 dwi
-[contributed by oca]
-Problem:
-Sometimes, not all calendar items supposed to be loaded into a calendar by an AbstractCalendarItemProvider (package org.eclipse.scout.rt.client.ui.basic.calendar.provider) are actually shown in the calendar due to race conditions.
-Analysis:
-During initialization of an AbstractCalendarItemProvider in its constructor, loadItemsAsyncInternal() is invoked twice:
-- once via initConfig() -> setRefreshIntervalMillis()
-- once via ensureItemsLoadedInternal()
-If the asynchronous loading of the first invocation of loadItemsAsyncInternal() has not completed while the second invocation is taking place, the first invocation is canceled. However, the first invocation will try to reschedule another job. This will cause the second invocation to be canceled as well. If no m_minDateLoaded, m_maxDateLoaded were set yet, no other jobs are scheduled and the current instance will never provide any calendar items again.
-Solution:
-Rescheduling (and cancelling a currently running job) should only happen, if a previous job actually succeeded in loading the calendar items.
-Migration: None
-
-06.05.2011 imo
-- added IClientSession.getWebSessionId for ajax like apps with gui-backend-to-server-backend communication using virtual sessionId
-- associate state of service with client session instance / client session type for:
-org.eclipse.scout.rt.client.services.common.bookmark.internal.BookmarkService (Done)
-org.eclipse.scout.rt.client.services.common.clientnotification.internal.ClientNotificationConsumerService (Done)
-org.eclipse.scout.rt.client.services.common.code.CodeServiceClientProxy (Done)
-org.eclipse.scout.rt.client.services.common.exceptionhandler.internal.InternalClientExceptionHandlerService (Done)
-org.eclipse.scout.rt.client.services.common.security.AccessControlServiceClientProxy (Done)
-org.eclipse.scout.rt.client.services.common.security.PermissionServiceClientProxy (Done)
-org.eclipse.scout.rt.client.services.common.session.internal.ClientSessionRegistryService (Done)
-- added IClientSession.getWebSessionId to support for multi-session web guis such as rap/rwt, wicket, ajax
-Migration: None
-Except: If your project runs as web app (rap/rwt) make sure to refactor state of stateful services to be associated with each individual client session.
-This is normally done as:
-class MyStatefulService{
- private static final String SESSION_DATA_KEY = "bookmarkServiceState";
-
- private ServiceState getServiceState() {
- IClientSession session = ClientJob.getCurrentSession();
- if (session == null) {
- LOG.warn("could not find a client session");
- return null;
- }
- ServiceState data = (ServiceState) session.getData(SESSION_DATA_KEY);
- if (data == null) {
- data = new ServiceState();
- session.setData(SESSION_DATA_KEY, data);
- }
- return data;
- }
-
- ...
-
- private static class ServiceState {
- //this was the global state of the service when run in a single-user osgi
- EventListenerList m_listenerList = new EventListenerList();
- BookmarkData m_model;
- }
-}
-
-08.05.2011 dwi
-bsi ticket #99504
-Problem:
-On the associated folder table of a AbstractPageWithNodes, there was no popup menu support.
-Solution:
-Added support to have the very same menus on the associated folder table as on the AbstractPageWithNodes itself.
-There was some change necessary on ITable and ITree to obtain the validated menus from within the model
-Methods added:
-- ITree#fetchMenusForNodesInternal (AbstractTree#fetchMenusForNodesInternal)
-- ITable#fetchMenusForRowsInternal (AbstractTable#fetchMenusForRowsInternal)
-Methods changed:
-- AbstractPageWithNodes$P_TableListener#tableChanged
-Migration: None
-
-06.05.2011 imo
-Bugzilla Ticket 331535
-
-Added possibility to override/complete texts and translations defined by the scout framework.
-To fully enable this feature, the following adaptations are necessary:
-
-0) Add the additional translations and text overrides to the project specific text resources:
-Adapt Texts_*.properties files in your scout project (com.example.myapp.shared/resources/texts) by adding
-the same keys as defined by the scout framework (org.eclipse.scout.rt.shared/resources/texts/ScoutTexts.properties)
-with your own translations.
-
-1) Override method getNlsTexts in ClientSession:
-
- @Override
- public DynamicNls getNlsTexts(){
- return Texts.getInstance();
- }
-
-2) Override method getNlsTexts in ServerSession:
-
- @Override
- public DynamicNls getNlsTexts(){
- return Texts.getInstance();
- }
-
-3) Only required for Swing client: override createSwingEnvironment() in class SwingApplication:
-- set the global text provider for Swing with SwingUtility.setNlsTexts
-- call execInitLocale() to initialize the NlsLocale as stored in the UserPreferences
-
- @Override
- protected ISwingEnvironment createSwingEnvironment(){
- execInitLocale();
- SwingUtility.setNlsTexts(Texts.getInstance());
- return new SwingEnvironment();
- }
-
-11.05.2011 sle
-bsi ticket #101160
-Added convenience methods to ITable as known from deprecated ICheckableTable. Also added know possibility to configure
-a invisible "checkbox-column" for data-transportation to server via formData.
-Methods added:
-ITable:
-- void checkRow(int rowIndex, boolean value) throws ProcessingException;
-- void checkRow(ITableRow row, boolean value) throws ProcessingException;
-- void checkRows(ITableRow[] rows, boolean value) throws ProcessingException;
-- void checkAllRows() throws ProcessingException;
-- void uncheckAllRows() throws ProcessingException;
-
-- void setCheckableColumn(IBooleanColumn checkboxColumn); (for internal use)
-- IBooleanColumn getCheckableColumn(); (for internal use)
-
-AbstractTable:
-- protected Class<? extends AbstractBooleanColumn> getConfiguredCheckableColumn();
-Migration: None
-
-17.05.2011 sle
-bsi ticket 102'010: ScoutInfoForm looks ugly (in SWT)
-Problem:
-a) ScoutInfoForm does not look nice in SWT
-b) ... does not have a Default-Logo
-c) ... has a quirky way of getting the logo.
-
-Solution:
-a) In Swing the GridData is different than for the other ui-layers.
-b) The Bundle org.eclipse.scout.rt.client has now a Default-Logo.
-c) The Logo is searched with th IconLocator.
-
-Migration:
-If ScoutInfoForm is overwritten to be able to get the correct logo this is not necessary anymore. Just the IIconProviderService
-has to be registered and an Icon with the name application_logo_large.png must be in a bundle.
-
-25.05.2011 dwi
-bsi ticket 102'437: support for adding child entities on entity nodes of extended search
-Problem:
-Child entities do not appear on popup menu when being on an entity node
-Solution:
-changed AbstractComposerField#execCreateAttributeNode
-changed AbtractComposerNode#attachAddEntityMenus
-changed constructor of AttributeNode
-changed constructor of EntityNode
-Migration:
-None
-
-30.05.2011 imo
-Added explicit instead of implicit session argument to IClientNotificationConsumerService observer, added possibility to add global observer.
-See javadoc for more details.
-Migration:
-Review deprecated usages of IClientNotificationConsumerService.addClientNotificationConsumerListener and IClientNotificationConsumerService.addClientNotificationConsumerListener.
-Default simply adds "ClientJob.getCurrentSession()" as first argument.
-
-30.05.2011 imo
-bsi ticket 100940
-A menu opened in empty space should not consider any selection on a row.
-Thus the menu should open anyway (not querying the selection status of any row).
-Migration:
-None
-
-06.06.211 sle
-bugzilla 348678
-bsi ticket 102'728
-Smartfield Warn-Text: When a Smartfield-Proposal opens with more than the aloud rows a Warning apears. This is to close to the left border and the color is not styleable.
-Solution: The SmartTableForm had a Label under the table. This label was removed and instead we use the existing TableStatus.
-Migration: None
-
-09.06.2011 imo
-bsi ticket 102823
-do not activate disabled tree nodes when setting new outline on desktop
-Migration: None
-
-28.06.2011 dwi
-bsi ticket #99'948 / #100'755
-Problem:
-If user cancels current running jobs, associated running SQL statements should also be killed.
-Solution:
-Added support to kill associated running JDBC statements if client job gets canceled.
-In StatementProcessor, statements to be executed are registered in RunningStatementStore on behalf of the current session.
-If a ClientJob gets canceled, a subsequent fire-and-forget cancel request is triggered to cancel registered statements.
-Resources changed:
-org.eclipse.scout.rt.client
-- InternalHttpServiceTunnel changed (cancel support for online servermode)
-- plugin.xml changed (registration of cancel processing service)
-com.bsiag.scout.shared
-- IServerProcessingCancelService added (service interface of cancel processing service)
-org.eclipse.scout.rt.server
-- ServerProcessingCancelService added (service implementation of cancel processing service)
-- RunningStatementStore added (store to hold currently running statements)
-- StatementProcessor changed to register / unregister currently running statements
-Migration: None
-
-01.07.2011 dwi
-bsi ticket: #103'490
-bugzilla ticket: 350661
-Problem:
-When setting a new nls local via ClientUIPreferences, the changed entry is not
-flushed to disk, i.e. causing the old entry to still exits. Other changes made,
-e.g. updateTableColumnOrder, are flushed immediately.
-Solution:
-Changed ClientUiPreferences#setNlsLocale(NlsLocale) to flush value to disk
-Migration: None
-
-11.07.2011 aho
-Ticket: 102'194 is about taking screen shots of forms. The problem is since the form is opened async the print event does not get to the form.
-Solution:
-Back event to notify the model once a screen shot is done. Furthermore a PrintApplicationAction is created to take screen shots of the whole application.
-Migration:
-none
-
-25.07.2011 dwi
-bugzilla 345184
-bsi ticket 102'074
-Problem:
-- When form tool button is selected, other tool buttons should only be deselected if of the type AbstractFormToolButton
-Migration: None
-
-09.08.2011 dwi
-bsi ticket #104'887
-Problem:
-When exporting table to CVS file format (AbstractTable#exportTableRowsAsCSV), columns of the type boolean are not considered.
-Solution:
-Added handling for values in boolean column. That is if no custom display text is set for such a cell, an 'X' is exported as value.
-Migration:
-None
-
-12.08.2011 dwi
-bsi ticket #100'300
-Problem:
-If having an editable column of the type boolean, values are rendered as checkboxes. When changing the value of that checkbox, the checkbox jumps from center position to the left edge. Furthermore, not the same checkbox widget is displayed as in non-edit mode.
-Solution:
-- Changed representation of checkbox to look the same in edit and non-edit mode.
-- Fixed layout problems when changing from non-edit to edit-mode (checkbox positioning)
-- Added VerticalAlignment on IBoolean column to align the checkbox in both directions, vertical and horizontal
-- Fixed problems in LogicalGridLayout manager to round resulting floating numbers (center position caluculations) the same way as Java layout managers do. Otherwise, the checkbox is positioned differently in between of the layout managers which causes the checkbox to jump around.
-- Fixed problems in inset calculation to look the same on the different L&F providers
-Migration:
-None
-
-22.08.2011 dwi
-BSI ticket #105'026, #104'976
-Problem:
-- Failed to display corrupt HTML pages (e.g. if missing closing quote in style definition)
-- In HTML editor, no cleanup (auto-correction) should be applied to the given HTML. That is because if the user did some modifications in the HTML source and reloads the HTML in the editor anew, unwanted auto-corrections would be applied.
-Solution:
-- Accomplish consistency concerning HTML styling (cleanup) in between of Swing and SWT in regard of ScoutHtmlField and ScoutHmtEditor.
- In more detail, this entails the following:
- - Before passing the HTML to the respective widget (ScoutHtmlEditor, ScoutHtmlField), Abstract[Swing|Swt]Environment#styleHtmlText() is called to cleanup the given HTML.
- - In case of HTML editor mode, no modifications are applied to the given HTML in both, Swing and SWT, respectively.
- - However, in non-editor mode, some intelligence is applied to the HTML to ensure proper display of the HTML document.
- - In Swing, cleanup of HTML structure and CSS definitions is done. That is crucial as Swing HTML viewer has some problems with some CSS constructs.
- - In SWT, OS default browser is used. That is why cleanup of CSS is not necessary as done by browser itself.
- But, because the HTML is provided as file to the browser, proper encoding and charset must be set.
-- Failsafe: if HTML text cannot be parsed for cleanup, the raw HTML text is used instead of an exception thrown.
-- Consolidation of HTML cleanup functionality in HTMLUtility for plain and simple use that is applicable for both, SWT and Swing, respectively. That is why various methods in HtmlUtility are removed.
-Plug-Ins affected:
-- org.eclipse.scout.commons (HTMLUtility
-- org.eclipse.scout.rt.client (AbstractHtmlField)
-- org.eclipse.scout.rt.ui.swing (AbstractSwingEnvironment, SwingScoutHtmlField, SwingScoutMailField)
-- org.eclipse.scout.rt.ui.swing.bsi.fragment (SwingScoutHtmlEditor)
-- org.eclipse.scout.rt.ui.swt (AbstractSwtEnvironment, SwtScoutHtmlField)
-- org.eclipse.scout.rt.ui.swt.bsi.fragment (SwtScoutHtmlEditor)
-Migration Swing / SWT:
-- In HTMLUtility, the following methods are removed.
- - HTMLUtility#parseDocument(String) to be replaced by HTMLUtility.toHtmlDocument(String)
- - HTMLUtility#formatDocument(String) to be replaced by HTMLUtility.toHtmlText(HTMLDocument)
- - HTMLUtility#cleanupDocument(HTMLDocument, String, int) to be replaced by HTMLUtility.cleanupHtml(String, boolean,boolean, DefaultFont)
- - HTMLUtility#wellformDocument(HTMLDocument, String, int) to be replaced by HTMLUtility.cleanupHtml(String, boolean,boolean, DefaultFont)
-Migration SWT:
-- In AbstractSwtEnvironment, the following methods are removed as not required anymore because logic is encapsulated in HTMLUtility.
- - AbstractSwtEnvironment#styleHtmlText(Control, String)
- - AbstractSwtEnvironment#createCSS(Control)
- - AbstractSwtEnvironment#createHtmlDocument(String, String)
-
-22.07.2011 dwi [contributed by Remo Arpagaus, BSI Business Systems Integration AG]
-bsi ticket #105’126
-Problem:
-When using ‘yyyy’ in the format of an AbstractDateField, there is no interpretation of the century. Entering 11 for the year results in 0011 CE instead of 2011 CE
-Resources changed: AbstractDateField
-Migration: None
-
-30.09.2011 abr [contributed by Adrian Moser, BSI Business Systems Integration AG]
-bugzilla ticket: 359418
-Bookmark Management Customization
-Changes/Fixes to Scout Bookmark Handling:
-- Scout implementation should be able to use a customized BookmarkForm
-- AbstractBookmarkTreeField: New/Edit Menu PrepareActions (Permissions) should be customizable
-- AbstractBookmarkTreeField : "New Folder" should not be possible on Bookmark Node
-- Text for Global/Private Bookmarks should be configurable
-Migration: None
-
-04.10.2011 dwi
-BSI ticket #106'222, #99'582, #105'229
-Bugzilla ticket #358064, #359811, #359812
-Problem:
-All the tickets mentioned belong to the editable cell topic:
-a) If properties like visiblity or editability are changed on IColumn, the accessiblity of editable cells within that column is not calculated anew.
- As consequence, the UI representation of such cells does not correspond to the values on the model.
-b) If a value of an editable boolean column is changed by inline editing, other values of that column are toggled/untoggled as well.
- Even though holding the correct value on model, their UI representation differs. For instance, if forcing the UI to refresh by resizing a column, the checked state in UI gets corrected.
-c) If toggling three times the very same cell of an editable boolean column, the value is not stored in the model anymore.
-d) If toggling a cell of an editable boolean column, it's value is immediately written back to the model which is good.
- This has the effect, that if there is an implict or explicit sort installed on that column, toggled rows are scampering.
- This is especially absurd, if the column is part of an implicit sort, meaning that no CTRL-key was held while determing
- the sort columns. Due to lack of the visual representation of such an implicit sort column, the user gets really confused
- as rows are reorganized for no reason. This problem is also applicable to other types of editable columns.
-e) If clicking on a cell of an editable boolean column, the cell transitions into modification state, meaning that the associated cell editor is activated.
- Even though the toggled value is already written back to model, the editor remains open which is confusing to the user.
- This should be changed to immediately close the cell editor if the value is toggled.
-f) If an editable colum is moved, the column is not editable anymore. Only if the column is moved back to its origin location, the column becomes editable anymore.
-g) If having a checkable table and a cell editor of an editable column does not fill the whole cell space,
- clicking on that empty space toggles the checked state of the row. This is confusing and moreover error-prone as not the row is intended to be checked/unchecked but rather the cell editor activated / toggled.
-h) If having a checkable table and moving an editable column to the very first position, a click on that column correctly activates the inline editor.
- Thus, the checked state of that row cannot be changed by clicking on the presented checkbox.
- This should be changed to not allow an editable column to be moved to the first position. Moreorver, the first column should also be freezed if the succeeding column is an editable one.
-Solution:
-a) Apply row decoration on property change
-b) This was because the active cell editor remained active after toggling the value.
- Fixed that a still active cell editor gets closed prior to update the model state.
-c) solved by e)
-d) Changed that if the value of a cell editor is written back to model, the sort (if applicable) is suspended.
- Thus, even though the column represents an implict or explicit sort column, its values are not sorted anymore which in turn is the expected behavior.
- In consequence, to get the column's values sorted again, the user has to sort the column anew.
-e) Instead of creating an ICheckBox as cell editor which stays active until the focus get lost, an empty cell editor (null) is created.
- As the toggled value is immediately written back to the model, this editor gets closed shortly after (see b).
-f) Fixed
-g) Mouseclicks that are targetted to cell editors are not interpereted as row-check nor row-uncheck clicks anymore.
-h) Fixed
-Plug-Ins changed:
-- org.eclipse.scout.rt.ui.swing, org.eclipse.scout.rt.client
-Migration:
-None
-
-04.10.2011 hmu
-Bugzilla ticket #359840
-Problem:
-SmartField doesn't handle isAllowCustomText properly when value changed in ui
-Plug-Ins changed:
-- org.eclipse.scout.rt.client
-Migration:
-None
-
-05.10.2011 abr [contributed by Adrian Moser, BSI Business Systems Integration AG]
-bugzilla ticket: 359418
-Bookmark Management Customization
-- Private Folder should be removed (not needed)
-- Support for additional logic when user opens bookmark: IOpenBookmarkCommand
-- AbstractBookmarkTreeField: Support for custom icons
-- BookmarkFolderForm: Grid width should be 1.
-- IBookmarkForm: JavaDoc shoud be added.
-- Bookmark: Support for new Bookmark (unread Bookmarks) should be added
-Migration: None
-
-13.10.2011 abr [contributed by Adrian Moser, BSI Business Systems Integration AG]
-bugzilla ticket: 359418
-Bookmark Management Customization
-Enhancements/fixes for the bookmark field (client-side only):
-- allow dragging and transfer of multiple nodes
-- Possibility to use a row-level PublishUserBookmarkPermission
-- Deletion of bookmark folders improved
-- some more JavaDoc added.
-Migration: None
-
-18.10.2011 abr [contributed by Adrian Moser, BSI Business Systems Integration AG]
-bugzilla ticket: 361233
-Allow implementations to handle AbstractBookmarkTreeField's DnD drop requests
-Added IBookmarkNode interface that allows the receiver to read bookmark data.
-Migration: None
-
-24.10.2011 mvi
-Bugzilla ticket 361816
-Replace current NLS support with Text Provider Services
-- added ITextProviderService, IDocumentationTextProviderService, AbstractDynamicNlsTextProviderService
-- Migrated existing text providers to scout text provider services
-- TEXTS class added for consistent translation retrieval
-- Splitted org.eclipse.scout.rt.shared texts into two plugins:
- - org.eclipse.scout.rt.shared contains text provider service with all texts that are used by the runtime
- - org.eclipse.scout.rt.shared.legacy.texts.fragment contains all texts that are no longer used by the runtime
-- getConfiguredDoc properties moved to different ConfigProperty type for Scout SDK (support for Docs Text Providers)
-Migration:
-- Add "org.eclipse.scout.rt.shared.legacy.texts.fragment" to all products.
-- For each existing NLS Class (directly or indirectly extending "org.eclipse.scout.rt.shared.ScoutTexts" or "org.eclipse.scout.commons.nls.DynamicNls"):
- - create a new "<YourSharedPlugin>.services.common.text.<Name>TextProviderService" extending "org.eclipse.scout.rt.shared.services.common.text.AbstractDynamicNlsTextProviderService" in the corresponding shared plugin.
-- For each created TextProvider Service:
- - Overwrite the method "getDynamicNlsBaseName" and return the same value as in the "RESOURCE_BUNDLE_NAME" constant (stored in the corresponding Texts class) as string literal.
- - Register the service in the corresponding plugin as scout service using the "org.eclipse.scout.service.DefaultServiceFactory", no session class and give a ranking > 0. E.g.: <service class="com.bsiag.crm.shared.core.services.common.text.CoreTextProviderService" factory="org.eclipse.scout.service.DefaultServiceFactory" ranking="100" />
-- Delete all Texts classes and replace all uses of the old Texts classes with the class "org.eclipse.scout.rt.shared.TEXTS".
-- Remove the "getNlsTexts" methods from the Session classes if existent (unless you use session-dependent translations).
-- Correct return type of "getConfiguredNlsProvider" of all SqlServices (if existent) to return the new type defined by AbstractSqlService and return "ScoutTexts.class" inside the method.
-- If somewhere the "SwingUtility.setNlsTexts" method or "SwtUtility.setNlsTextsOnDisplay" method is used, set it to "ScoutTexts.getInstance()".
-- Delete all .nls files (NLS Editor can now be accessed using the TextProviderService Node in the Scout Explorer of the Scout perspective).
- If you want to keep the .nls files (e.g. to support key shortcuts like ctrl+shift+r) do the following:
- - Open the .nls file in the text editor (right click -> open with).
- - Remove the following properties: "Nls-Type", "Nls-File-Prefix", "Nls-Translation-Folder".
- - Change the property "Nls-Class" to the fully qualified name of the Text Provider Service you would like to edit with this .nls file.
- - Save the changes and open the .nls file again in the Multilanguage Editor (right click -> open with).
-
-26.10.2011 dwi
-Bugzilla ticket 361795
-Problem:
-Decorating a Date or a Number has to use NlsLocale-Settings.
-Currently, Locale.getLocal() is used which may contradict with user-settings.
-Solution:
-In Java 6 it is possible to contribute custom Locales (e.g. en_CH) to the JRE. That is why Scout NlsLocale is not used anymore and therefore marked as deprecated.
-The user's locale is accessed as follows:
-- On client side, the user's locale is accessed by Locale.getDefault()
-- On server side the request's locale is accessed by LocaleThreadLocal.get() (convenience accessor: ServerSession.get().getLocale())
-Eventhough the class NlsLocale is marked as deprecated for legacy support, its constructor 'NlsLocale(Locale)' was removed because NlsLocale was changed to only act as delegate to the thread's locale (if applicable) or default locale otherwise.
-Please note: A locale consists of its language and country. The country is mainly responsible for format settings as for instance the grouping separator of numbers. A very few locales already exist in the JRE. But if you like to have the application in the English language with Switzerland as its region, you have to contribute your own locale-implementation 'en_CH'. Please see Migration section for detailed instructions to extend JRE with a custom locale.
-Plug-Ins changed:
-- org.eclipse.scout.commons
-- org.eclipse.scout.rt.client
-- org.eclipse.scout.rt.server
-- org.eclipse.scout.rt.shared
-- org.eclipse.scout.rt.ui.swing
-- org.eclipse.scout.rt.oraclelite10g.core
-- org.eclipse.scout.rt.xstream.shared
-Migration:
-- removed NlsLocale(Locale) (constructor): use Locale instead of NlsLocale
-- removed IServerSession#getNlsLocale(): use IServerSession#getLocale() instead (e.g. replace all ServerSession.get().getNlsLocale().getLocale() by ServerSession.get().getLocale())
-- In client Plug-Ins: replace NlsLocale.getDefault().getLocale() by Locale.getDefault()
-- In server Plug-Ins: replace NlsLocale.getThreadDefault().getLocale() by LocaleThreadLocal.get()
-- In shared Plug-Ins: replace NlsLocale.getDefault().getLocale() by NlsUtility.getDefaultLocale()
-Contribution of custom locales to the JRE:
-1. Create a plain Java project, e.g. x.y.localeprovider.en.ch
-2. Create two classes that inherit from {@link DateFormatProvider} and {@link NumberFormatProvider} and implement the method stubs specific to your locale
-3. Create the folder META-INF/services with two files java.text.spi.DateFormatProvider and java.text.spi.NumberFormatProvider
-4. In those files, simply put the the fully qualified name to your date/number provider
-5. Export project as JAR file and put it into \lib\ext of your JRE
-
-15.12.2011 cgu
-Bugzilla ticket 364556
-Problem:
-If a checkbox is defined in a sequence box, the label of the checkbox is shown as label of the sequence box although the checkbox itself already shows the label.
-Solution:
-Excluded BooleanFields from the computation of the compound label.
-Migration:
-- Since the checkbox is excluded the label of the next field is considered for the compound label.
- So if you use sequenceboxes which contain a checkbox and another field you may want to override execIsLabelSuffixCandidate and return false so that no label suffix is created and only the sequencebox label is shown.
-
-03.01.2012 dwi
-Bugzilla: 367507
-Problem:
-When having a single line textfield (getConfiguredMultilineText=false), leading and trailing newlines should not be replaced by spaces but omitted insted.
-Solution:
-Leading and trailing newlines are trimmed prior to replacing them by spaces.
-Plug-Ins changed:
-org.eclipse.scout.commons [StringUtility], org.eclipse.scout.rt.ui.swing [SwingScoutTextFieldComposite#P_SwingDocumentFilter], org.eclipse.scout.rt.client [SwingScoutTextFieldComposite]
-Migration: None
-
-12.01.2012 imo
-Bugzilla: 364574
-New busy handling facility
-The model detects busy in ClientSyncJob and provides the IBusyManagerService with IBusyHandler.
-See swing, swt, rwt scout implemenations for more details.
-
-19.01.2012 abr
-Bugzilla: 369115, Locale on client-side
-Locale must be available on the ClientSession and all client jobs have to use it (i.e. set LocaleThreadLocal before executing the job).
-Migration:
-- Possibly available ClientSession.getLocale and ClientSession.setLocale must either be removed or renamed.
-- Dynamically changing the locale must be propagated to the client session as well.
-- Accessing a client's locale should always done by invoking LocaleThreadLocal.get()
-- ClientJob.run (and therefore ClientSyncJob.run as well as ClientAsyncJob.run) should not be overridden anymore. The method will be marked final in a subsequent release.
- Use ClientJob.runStatus or ClientJob.runVoid instead.
-
-30.01.2012 abr
-Bugzilla 370118
-findCodeTypeById on CodeService and CodeServiceClientProxy works for cached code types only
-Solution:
-If findCodeTypeById returns null for a non-null key, populate cache and retry.
-Migration:
-None
-
-07.02.2011 abr
-Bugzilla 370821
-last activated forms on AbstractDesktop are not released
-The AbstractDesktop manages a list of open forms, ordered descending by their last activation. The elements
-of the list are never released and the form listener tracking activation changes is not used at all. Further,
-the last active form returned is not the last, but the first which weak reference is still valid.
-Migration: None
-
-07.02.2011 abr
-Bugzilla 370830
-closing the desktop should close all open forms as well
-When the desktop is closed, all open forms are just removed from the view and dialog stacks, respectively.
-The forms however are not closed. Hence any clean-up operations must be implemented as desktop listeners.
-This approach still breaks a form's life cycle.
-Migration: None
-
-14.02.2012 kle
-Bugzilla 352955
-Problem:
-When using modes IActivityMap.PLANNING_MODE_DAY or IActivityMap.PLANNING_MODE_WEEK
-the selected columns are not handled correctly due to the used values at the end
-boundaries of a MinorColumn object. During construction of a MinorColumn, 1ms is
-automatically subtracted from the end time.
-Solution:
-When fetching the column index for a given end time, it has to be checked if
-the given end time fits into the begin and end time interval of the column.
-Otherwise, the previous column has to be returned.
-Migration:
-None
-
-06.03.2012 abr
-Bugzilla: 373358
-composer field: select parent node when a node is deleted
-Problem:
-The selection in an org.eclipse.scout.rt.client.ui.form.fields.composer.AbstractComposerField gets lost if a node
-is removed using its corresponding delete menu. However, the previous node is selected when a node is deleted by
-the delete key stroke.
-Solution:
-Added the selection behavior to the nodes' delete menus and select previous parent node instead of previous node.
-Migration: none
-
-12.03.2012 ast, abr
-Bugzilla: 372381
-Setting up an initial order for IColumns
-Problem:
-Table columns are initially ordered in the GUI the same way as in the model, using the @Order annotation. It is not
-possible to set a different initial ordering for the GUI.
-Solution:
-Added new property viewOrder on IColumn and recompute view orders whenever the property changes for a column. As a
-side effect, view orders can be changed after the model has been initialized.
-Migration: none
-
-13.03.2012 abr
-Bugzilla: 374044
-Problem:
-Currently, table column filters are persisted in user scope preferences. Hence they are reapplied after application
-restarts. They are further applied to all table instances having the same client preference context.
-Solution:
-Table filter settings behave like search form states. i.e. they are remembered as long as a Scout application runs,
-but they do not endure application restarts. Reloading pages having search constraints or filters applied, must
-apply them again. Memory constraints may limit the size of stored search constraints and filter settings.
-Added filter settings cache on IMemoryPolicy.
-Migration: none
-
-26.03.2012 sme, abr
-Bugzilla: 375152
-Problem:
-When a user cancels the search in an outline, the search form keeps its state but the displayed rows belong to the last
-executed search.
-Solution:
-o If a user cancels the search, all rows in the table should be discarded and the user show be notified of the canceled
- search.
-o Additionally, any exception during loading the table data behaves the same: the table data is discarded and
- the table status is set appropriately.
-o If the severity of the table population status is IProcessingStatus.CANCEL, the table selection status is hidden and
- the population status is rendered like a warning (e.g. foreground color orange).
-Migration: none
-
-27.03.2012 bko,jgu
-Bugzilla: 367850
-Problem:
-XML I/O on IForm (IForm.storeXML and IForm.loadXML) does not work properly for
-IFormFields with a non-unique class name. F.e. if a SearchForm with two tabs
-which both contains a TextField with the same class name.
-Solution:
-o The IFromField provides a method getXMLFieldId() which will be used for XML I/O.
-This method will return the fields simple class name by default for fields with unique class names.
-For non-unique class names the simple class name of the parent field is added to the id, until it is unique.
-o Loading older XML files with ambiguous fields is still possible: Data is imported to the first field found (as before).
-Migration: none
-
-10.04.2012 jbr
-Bugzilla: 361985
-Bug following the discussion here:
-http://www.eclipse.org/forums/index.php/t/210744/
- • Naming consistency:
-clearDeletedRows() => discardAllDeletedRows()
- • Add the possibility to discard a specific deleted row
-discardDeleteRow(TableRow deletedRow)
-discardDeleteRows(TableRow deletedRow)
-discarding a DeletedRow by index (or array of indexes) makes no sense, because if the row is deleted, the row do not have an index anymore.
-Migration: ITable#clearDeletedRows() is deprecated, use ITable#discardAllDeletedRows() instead.
+14.07.2010 imo
+Since model-based selection filtering leads to many defects and misunderstandings. See ticket 87693 and others (follow).
+removed ITable.acceptSelection and AbstractTable.execAcceptSelection
+removed ITree.acceptSelection and AbstractTree.execAcceptSelection
+removed AbstractListBox.execAcceptSelection
+removed AbstractTreeBox.execAcceptSelection
+old:
+ @Override
+ protected boolean execAcceptSelection(ITreeNode node, Long value, int level) {
+ return level >= 2;
+ }
+new:
+ @Override
+ protected void execFilterNewNode(ITreeNode newNode, int level) throws ProcessingException {
+ newNode.setEnabled(level >= 2);
+ }
+
+14.07.2010 imo
+Disabled rows on ITable and disabled nodes on ITree are (now) selectable, and support for context menus.
+
+14.07.2010 imo
+Changed model of listbox and treebox. The value (checked keys) is separated from the selection (table selection)
+The (existing) checkable property is used to distinguish between listboxes with checkboxes and listboxes that behave like tables.
+On checkable listboxes (normally multi-selection boxes) selecting a row is NOT the same as checking the rows checkbox.
+On non-checkable listboxes (normally single-selection boxes) selecting a row is the same as checking the corresponding key.
+renamed getConfiguredFilterSelectedRows to getConfiguredFilterCheckedRows
+added ITableRow.isChecked
+added ITableRow.setChecked
+added ITreeNode.isChecked
+added ITreeNode.setChecked
+renamed all IListBox.*Select* to IListBox.*Check*
+renamed all ITreeBox.*Select* to ITreeBox.*Check*
+Migration:
+Check all occurrences of ITable.setMultiSelect(true/false) and check if it is a listbox table.
+Most such cases are replaced by ITable.setMultiCheck(true/false), except those where the listbox was set to non-checkable
+either by getConfiguredCheckable(){return false;} or by getMyListBox().getTable().setCheckable(false);
+
+14.07.2010 imo
+Removed the ITable.getContextRow since this is now the same as getSelectedRow()
+Removed the ITree.getContextNode since this is now the same as getSelectedNode()
+
+14.07.2010 imo
+Removed AbstractAction/AbstractMenu.getConfiguredNonSelectionAction() since this is obsolete now that disabled rows can be selected.
+
+15.07.2010 imo
+Removed table context row and tree context node
+old:
+ protected void execContextCellChanged(ITableRow row, IColumn col) throws ProcessingException {
+ ...
+ }
+new:
+ protected void execRowClick(ITableRow row) throws ProcessingException {
+ IColumn col=getContextColumn();
+ ...
+ }
+
+17.07.2010 imo
+Merged Rayo and Scout core widget copies of DateField, TimeField. Created new combined popup window with date/time and a new analog clock.
+
+20.07.2010 imo
+Refactoring IGroupbox.isBorderEnabled and BORDER_DECORATION_NONE
+Due to misleading naming and for better understanding
+Migration:
+RENAME AbstractGroupbox.getConfiguredBorderEnabled TO AbstractGroupbox.getConfiguredBorderVisible
+RENAME IGroupbox.isBorderEnabled TO IGroupbox.isBorderVisible
+RENAME IGroupbox.setBorderEnabled TO IGroupbox.setBorderVisible
+RENAME IGroupbox.BORDER_DECORATION_NONE TO IGroupbox.BORDER_DECORATION_EMPTY.
+
+20.07.2010 imo
+Merged concepts of cyclic locking on swingscout compositions using only a scout-update lock and a ignore-scout-event set throughout all implementations.
+Removed various separate optimistic locks.
+Migration: none necessary
+
+22.07.2010 imo
+NEW property "Tray visible" on IDesktop
+NEW broadcast event TYPE_TRAY_POPUP on DesktopEvent to collect menus for the tray
+NEW method IDesktopUiFacade.fireTrayPopupFromUI to get the tray menus
+NEW operation AbstractDesktop.execAddTrayMenus to contribute to the tray menu
+Migration: none necessary
+
+11.08.2010 imo
+Added cache to Introspector.getBeanInfo: 500ms down to 1 ms
+Saves 1 seconds on all forms when loading and storing
+Migration: none necessary
+
+19.08.2010 imo
+Tuned Introspector.getBeanInfo: 1ms down to 0.05 ms
+Saves 1-4 seconds on all forms when loading and storing
+Migration: none necessary
+
+20.08.2010 imo
+Moved org.eclipse.scout.rt.client.ui.form.fields.htmlfield.HTMLUtility to org.eclipse.scout.commons.HTMLUtility
+Migration: rename org.eclipse.scout.rt.client.ui.form.fields.htmlfield.HTMLUtility by org.eclipse.scout.commons.HTMLUtility
+
+20.08.2010 imo
+Ticket 92'775 revealed that WizardEvents for Suspend,Finish,Cancel are never fired and also not used, since they are subsumized under TYPE_CLOSED.
+However, in order to find out under which condition the wizard was closed, there is a new property IWizard.getCloseType that returns the CloseType enum.
+Migration: (rare) if really used, replace the WizardEvent types TYPE_CANCELLED, TYPE_SUSPENDED, TYPE_FINISHED by TYPE_CLOSED and use IWizard.getCloseType() for details.
+
+30.08.2010 imo
+Ticket 90'088
+Dropped AbstractTable.execSortDataSource(IColumn[] sortColumns)
+This operation is a legacy from scout 2 and is never and nowhere used.
+Migration: if however used, please report to tools@bsiag.com
+
+30.08.2010 abr
+Ticket 93'106: Fixed visibility of the IOutlineTableForm when it is initialized.
+Migration: none
+
+30.08.2010 imo
+Ticket 90'088
+Reset of table columns was re-modeled to be more finegrained.
+Merged AbstractTable.execResetColumnSortOrder with AbstractTable.execResetDisplayableColumns to
+AbstractTable.execResetColumns(boolean visibility, boolean order, boolean sorting, boolean widths)
+This operation is rarely used in custom code.
+Migration: When using these operations, rename it and check the boolean argument as to what aspect is resetting.
+
+30.08.2010 imo
+Ticket 90'088
+Additional table header menu for "Column Filter" similar to excel AutoFilter
+Migration: None
+
+07.09.2010 imo
+Added new IForm display hint: DISPLAY_HINT_POPUP
+
+13.09.2010 abr
+Ticket 91'279
+Added IColumn.isVisibleInternal() that is used to for storing a table column's UI preferences (uses visible only instead of visible && displayable && visibleGranted).
+Migration: None
+
+01.11.2010 pba
+Added opportunity for lazy initialization of search forms on table pages.
+Added org.eclipse.scout.rt.client.ui.desktop.outline.pages.AbstractPageWithTable.execInitSearchForm().
+Migration: optional MOVE all your search form related initialization code form the execInitPage() method to execInitSearchForm().
+
+20.12.2010 imo
+Consolidation of date/time fields. The existing ITimeField is based on Double and is replaced by a new AbstractTimeField based on Date and subclassing AbstractDateField.
+Migration: Usages of AbstractTimeField must be reviewed, form data fields must be changed from Double to Date.
+Legacy support: AbstractTimeColumn and AbstractTimeField have setTimeValue/getTimeValue of type Double, the column accepts/tolerates Double and Date as values.
+
+21.12.2010 imo
+Extracted DataModel with entities and attributes out of AbstractComposerField and moved to org.eclipse.scout.rt.shared.data.model
+Migration:
+rename IComposerOp -> IDataModelAttributeOp
+rename IComposerEntity -> IDataModelEntity
+rename IComposerAttribute -> IDataModelAttribute
+rename AbstractComposerEntity -> AbstractDataModelEntity
+rename AbstractAttributeEntity -> AbstractDataModelAttribute
+rename ComposerAttributeInjector -> DataModelAttributeInjector
+rename ComposerConstants -> DataModelConstants
+rename org.eclipse.scout.rt.client.ui.form.fields.composer.attribute.IDataModelAttributeOp -> org.eclipse.scout.rt.shared.data.model.IDataModelAttributeOp
+rename org.eclipse.scout.rt.client.ui.form.fields.composer.attribute.IDataModelEntity -> org.eclipse.scout.rt.shared.data.model.IDataModelEntity
+rename org.eclipse.scout.rt.client.ui.form.fields.composer.attribute.IDataModelAttribute -> org.eclipse.scout.rt.shared.data.model.IDataModelAttribute
+rename org.eclipse.scout.rt.client.ui.form.fields.composer.attribute.AbstractDataModelEntity -> org.eclipse.scout.rt.shared.data.model.AbstractDataModelEntity
+rename org.eclipse.scout.rt.client.ui.form.fields.composer.attribute.AbstractDataModelAttribute -> org.eclipse.scout.rt.shared.data.model.AbstractDataModelAttribute
+rename org.eclipse.scout.rt.client.ui.form.fields.composer.attribute.DataModelAttributeInjector -> org.eclipse.scout.rt.shared.data.model.DataModelAttributeInjector
+rename org.eclipse.scout.rt.shared.data.form.fields.composer.DataModelConstants -> org.eclipse.scout.rt.shared.data.model.DataModelConstants
+rename getComposerAttributes() -> getAttributes()
+rename getComposerEntities() -> getEntities()
+rename setComposerAttribute( -> setAttribute(
+Move the composer data model to the shared area:
+extract all entities/attributes from the composer to a new shared DataModel
+In the composer implement execCreateDataModel
+To convert between external entity and attribute ids use DataModelUtility.
+For example: IDataModelEntity e=DataModelUtility.externalIdToEntity(builder.getDataModel(), entityNodeData.getEntityExternalId(), null)
+Legacy:
+There is legacy support with deprecated AbstractComposerAttribute and AbstractComposerEntity. Also inner attributes and entities of a composer field are still valid
+and wrapped in a ComposerFieldDataModel.
+
+21.12.2010 imo
+renamed AbstractComposerAggregationField to AbstractDataModelAggregationField
+renamed AbstractComposerOperatorField to AbstractDataModelOperatorField
+
+27.12.2010 jgu
+Change in field validation: Error status is set to WARN instead of ERROR when an invalid date is entered via date picker.
+Affected Field Types: AbstractDateField, AbstractTimeField, AbstractDateTimeField
+
+Problem:
+Validation errors of text input in date fields lead to different results in the GUI than validation of date input (via date picker of keystrokes).
+Invalid date input is not displayed in the text field whereas invalid text input is. In both cases an error icon is shown to indicate that the entered value is not valid.
+In the case of date input, the date is not displayed in the text field, if it is invalid. When the field is re-validated and the previously entered value was valid, the field is valid again and the error disappears.
+A user might not notice that his input value was not accepted, when working fast.
+
+In both cases the model contains only valid values (as always) and an error status (IProcessingStatus.ERROR).
+
+Solution:
+If a date input is invalid, the error status is set to (IProcessingStatus.WARNING) to indicate that the selected value was not accepted, but there might still be a valid value in the text field.
+The warn status only disappears, if a new date or text is entered.
+
+This solution was chosen based on the following principles:
+- The model should only contain valid values (as before)
+- Text input should not be removed or changed when it is wrong (user experience).
+- Date input should not be displayed in the text field, if invalid, because it may not be possible to format it and the date input may depend on the value in the model (keystrokes).
+
+Migration: None
+
+24.01.2011 dwi
+By default, table cells that are disabled should not be editable.
+Migration: None
+
+27.01.2011 dwi
+Problem:
+In SwingScoutTable#prepareRenderer, evaluation of cell's editable state to draw respective marker icon caused loops and UI freeze.
+So far, the only way to determine cell's editable state was to call AbstractColumn#isCellEditable(ITableRow). This required synchronization with model thread which affected performance badly. Even worse, if model thread was busy, the enqueued request did not succeed at all (timeout).
+Solution:
+- Property added to hold result of AbstractColumn#isCellEditable(ITableRow) which can be evaluated in UI thread without need of model thread synchronization.
+- Population of property: Property is populated when AbstractColumn#decorateCellInternal is called.
+- Change of ICellSpecialization and implementing classes: added ICellSpecialization$isEditable(), added ICellSpecialization#setEditable(boolean)
+- Change of ICell and implementing classes: added ICell#isEditable()) -> default value is false
+- Change of Cell: added Cell#isEditable(), added Cell#setEditableInternal(boolean). Accessor setEditableInternal(boolean) is internal by intention as not intended for public use as various checks in AbstractColumn#execIsEditable are bypassed otherwise (JavaDoc added). E.g., do not use in execDecorateCell.
+- Change of SwingTableModel#isCellEditable() --> synchronization with model thread not neccessary anymore as property can be evaluated thread safe. (Java bean property)
+- Change of SwingScoutTable#prepareRenderer() --> synchronization with model thread for querying editable state not neccessary anymore as property can be evaluated thread safe. (Java bean property)
+Migration: None
+
+10.02.2011 sle
+In SWT Perspective-Handling was never really thought through and tested with more than one perspective and/or more than one scout-application running parallel. This was now done, implemented and tested with Kudi/Bap. (see Visio)
+In general can be said, that now no perspective has to be active/open to run a scout-application. When the Workbench is started the existing scout-application will be started and the model-desktop open. As soon as the perspective is active execGuiAttached will be called on the model-desktop. When the perspective is closed execGuiDettached is called. When a perspective is reset detached/attached is called.
+
+Change in Scout-Client:
+- Everywhere desktop.isGuiAvailable() was called now desktop.isOpened() is called. For Swing there is no change, the two states are changed at the same location.
+- AbstractDesktop.closeInternal goes through all open forms and calls removeForm
+- IDesktopUIFacade has now fireDesktopResetFromUI anymore. This method was used from AbstractSwtEnvironment
+- new Property on IForm: PROP_PERSPECTIVE_ID. This is used from SWT to ensure a form is opend in a chosen perspective. No use in Swing.
+
+Migration: Swing-Gui: none / SWT-Gui: if application uses more than one perspective, changes may be necessary. Please consult with me (s.leicht@bsiag.com / 947)
+
+10.02.2011 abr
+bsi ticket 98'890
+fixed model change counters running out of sync if unchecked exceptions are thrown.
+Migration: None
+
+16.02.2011 imo
+Splitted ITableField tableStatus into tablePopulateStatus and tableSelectionStatus
+
+01.03.2011 pba
+#94708 added new Event public static final int TYPE_TABLE_POPULATED = 820;
+to handle the case, when no rows are returned for the first select
+
+03.03.2011 pba
+bsi ticket #93948
+if the Fileservice has a rootpath set, take it and not the relative one, otherwise it is impossible to give a target path independent of the workbench
+
+04.03.2011 pba
+bsi ticket #99504
+Add menus in outline also for node-, not only table pages
+
+04.03.2011 pba
+bsi ticket #99533
+add a reasonable default implementation for getBookmarkIdentifier() in AbstractPage to avoid caching bugs
+
+10.03.2011 imo
+bsi ticket 96627
+do not activate disabled or invisible outlines when activating bookmark
+
+18.03.2011 imo
+Migration of legacy: moving remaining legacy logic from client to server
+Added TokenBasedSearchFilter, TokenBasedSearchFilterService to support token-based query building on logical level.
+Added LegacySearchFilterService to support global client side legacy handling of search behaviour.
+Migration: None ( legacy search can still be used)
+Continuous Migration:
+1) Create an annotation for already migrated search forms: MigratedSearchForm
+2) in every search form (or if using a custom base class) add:
+ @Override
+ protected void execResetSearchFilter(SearchFilter searchFilter) throws ProcessingException {
+ if (getClass().isAnnotationPresent(MigratedSearchForm.class)) {
+ // Migrated SearchForm
+ setSearchFilter(new SearchFilter());
+ }
+ else {
+ // Legacy SearchForm
+ searchFilter = new LegacySearchFilter();
+ setSearchFilter(searchFilter);
+ }
+ super.execResetSearchFilter(getSearchFilter());
+ }
+
+
+15.04.2011 dwi
+[contributed by oca]
+Problem:
+Sometimes, not all calendar items supposed to be loaded into a calendar by an AbstractCalendarItemProvider (package org.eclipse.scout.rt.client.ui.basic.calendar.provider) are actually shown in the calendar due to race conditions.
+Analysis:
+During initialization of an AbstractCalendarItemProvider in its constructor, loadItemsAsyncInternal() is invoked twice:
+- once via initConfig() -> setRefreshIntervalMillis()
+- once via ensureItemsLoadedInternal()
+If the asynchronous loading of the first invocation of loadItemsAsyncInternal() has not completed while the second invocation is taking place, the first invocation is canceled. However, the first invocation will try to reschedule another job. This will cause the second invocation to be canceled as well. If no m_minDateLoaded, m_maxDateLoaded were set yet, no other jobs are scheduled and the current instance will never provide any calendar items again.
+Solution:
+Rescheduling (and cancelling a currently running job) should only happen, if a previous job actually succeeded in loading the calendar items.
+Migration: None
+
+06.05.2011 imo
+- added IClientSession.getWebSessionId for ajax like apps with gui-backend-to-server-backend communication using virtual sessionId
+- associate state of service with client session instance / client session type for:
+org.eclipse.scout.rt.client.services.common.bookmark.internal.BookmarkService (Done)
+org.eclipse.scout.rt.client.services.common.clientnotification.internal.ClientNotificationConsumerService (Done)
+org.eclipse.scout.rt.client.services.common.code.CodeServiceClientProxy (Done)
+org.eclipse.scout.rt.client.services.common.exceptionhandler.internal.InternalClientExceptionHandlerService (Done)
+org.eclipse.scout.rt.client.services.common.security.AccessControlServiceClientProxy (Done)
+org.eclipse.scout.rt.client.services.common.security.PermissionServiceClientProxy (Done)
+org.eclipse.scout.rt.client.services.common.session.internal.ClientSessionRegistryService (Done)
+- added IClientSession.getWebSessionId to support for multi-session web guis such as rap/rwt, wicket, ajax
+Migration: None
+Except: If your project runs as web app (rap/rwt) make sure to refactor state of stateful services to be associated with each individual client session.
+This is normally done as:
+class MyStatefulService{
+ private static final String SESSION_DATA_KEY = "bookmarkServiceState";
+
+ private ServiceState getServiceState() {
+ IClientSession session = ClientJob.getCurrentSession();
+ if (session == null) {
+ LOG.warn("could not find a client session");
+ return null;
+ }
+ ServiceState data = (ServiceState) session.getData(SESSION_DATA_KEY);
+ if (data == null) {
+ data = new ServiceState();
+ session.setData(SESSION_DATA_KEY, data);
+ }
+ return data;
+ }
+
+ ...
+
+ private static class ServiceState {
+ //this was the global state of the service when run in a single-user osgi
+ EventListenerList m_listenerList = new EventListenerList();
+ BookmarkData m_model;
+ }
+}
+
+08.05.2011 dwi
+bsi ticket #99504
+Problem:
+On the associated folder table of a AbstractPageWithNodes, there was no popup menu support.
+Solution:
+Added support to have the very same menus on the associated folder table as on the AbstractPageWithNodes itself.
+There was some change necessary on ITable and ITree to obtain the validated menus from within the model
+Methods added:
+- ITree#fetchMenusForNodesInternal (AbstractTree#fetchMenusForNodesInternal)
+- ITable#fetchMenusForRowsInternal (AbstractTable#fetchMenusForRowsInternal)
+Methods changed:
+- AbstractPageWithNodes$P_TableListener#tableChanged
+Migration: None
+
+06.05.2011 imo
+Bugzilla Ticket 331535
+
+Added possibility to override/complete texts and translations defined by the scout framework.
+To fully enable this feature, the following adaptations are necessary:
+
+0) Add the additional translations and text overrides to the project specific text resources:
+Adapt Texts_*.properties files in your scout project (com.example.myapp.shared/resources/texts) by adding
+the same keys as defined by the scout framework (org.eclipse.scout.rt.shared/resources/texts/ScoutTexts.properties)
+with your own translations.
+
+1) Override method getNlsTexts in ClientSession:
+
+ @Override
+ public DynamicNls getNlsTexts(){
+ return Texts.getInstance();
+ }
+
+2) Override method getNlsTexts in ServerSession:
+
+ @Override
+ public DynamicNls getNlsTexts(){
+ return Texts.getInstance();
+ }
+
+3) Only required for Swing client: override createSwingEnvironment() in class SwingApplication:
+- set the global text provider for Swing with SwingUtility.setNlsTexts
+- call execInitLocale() to initialize the NlsLocale as stored in the UserPreferences
+
+ @Override
+ protected ISwingEnvironment createSwingEnvironment(){
+ execInitLocale();
+ SwingUtility.setNlsTexts(Texts.getInstance());
+ return new SwingEnvironment();
+ }
+
+11.05.2011 sle
+bsi ticket #101160
+Added convenience methods to ITable as known from deprecated ICheckableTable. Also added know possibility to configure
+a invisible "checkbox-column" for data-transportation to server via formData.
+Methods added:
+ITable:
+- void checkRow(int rowIndex, boolean value) throws ProcessingException;
+- void checkRow(ITableRow row, boolean value) throws ProcessingException;
+- void checkRows(ITableRow[] rows, boolean value) throws ProcessingException;
+- void checkAllRows() throws ProcessingException;
+- void uncheckAllRows() throws ProcessingException;
+
+- void setCheckableColumn(IBooleanColumn checkboxColumn); (for internal use)
+- IBooleanColumn getCheckableColumn(); (for internal use)
+
+AbstractTable:
+- protected Class<? extends AbstractBooleanColumn> getConfiguredCheckableColumn();
+Migration: None
+
+17.05.2011 sle
+bsi ticket 102'010: ScoutInfoForm looks ugly (in SWT)
+Problem:
+a) ScoutInfoForm does not look nice in SWT
+b) ... does not have a Default-Logo
+c) ... has a quirky way of getting the logo.
+
+Solution:
+a) In Swing the GridData is different than for the other ui-layers.
+b) The Bundle org.eclipse.scout.rt.client has now a Default-Logo.
+c) The Logo is searched with th IconLocator.
+
+Migration:
+If ScoutInfoForm is overwritten to be able to get the correct logo this is not necessary anymore. Just the IIconProviderService
+has to be registered and an Icon with the name application_logo_large.png must be in a bundle.
+
+25.05.2011 dwi
+bsi ticket 102'437: support for adding child entities on entity nodes of extended search
+Problem:
+Child entities do not appear on popup menu when being on an entity node
+Solution:
+changed AbstractComposerField#execCreateAttributeNode
+changed AbtractComposerNode#attachAddEntityMenus
+changed constructor of AttributeNode
+changed constructor of EntityNode
+Migration:
+None
+
+30.05.2011 imo
+Added explicit instead of implicit session argument to IClientNotificationConsumerService observer, added possibility to add global observer.
+See javadoc for more details.
+Migration:
+Review deprecated usages of IClientNotificationConsumerService.addClientNotificationConsumerListener and IClientNotificationConsumerService.addClientNotificationConsumerListener.
+Default simply adds "ClientJob.getCurrentSession()" as first argument.
+
+30.05.2011 imo
+bsi ticket 100940
+A menu opened in empty space should not consider any selection on a row.
+Thus the menu should open anyway (not querying the selection status of any row).
+Migration:
+None
+
+06.06.211 sle
+bugzilla 348678
+bsi ticket 102'728
+Smartfield Warn-Text: When a Smartfield-Proposal opens with more than the aloud rows a Warning apears. This is to close to the left border and the color is not styleable.
+Solution: The SmartTableForm had a Label under the table. This label was removed and instead we use the existing TableStatus.
+Migration: None
+
+09.06.2011 imo
+bsi ticket 102823
+do not activate disabled tree nodes when setting new outline on desktop
+Migration: None
+
+28.06.2011 dwi
+bsi ticket #99'948 / #100'755
+Problem:
+If user cancels current running jobs, associated running SQL statements should also be killed.
+Solution:
+Added support to kill associated running JDBC statements if client job gets canceled.
+In StatementProcessor, statements to be executed are registered in RunningStatementStore on behalf of the current session.
+If a ClientJob gets canceled, a subsequent fire-and-forget cancel request is triggered to cancel registered statements.
+Resources changed:
+org.eclipse.scout.rt.client
+- InternalHttpServiceTunnel changed (cancel support for online servermode)
+- plugin.xml changed (registration of cancel processing service)
+com.bsiag.scout.shared
+- IServerProcessingCancelService added (service interface of cancel processing service)
+org.eclipse.scout.rt.server
+- ServerProcessingCancelService added (service implementation of cancel processing service)
+- RunningStatementStore added (store to hold currently running statements)
+- StatementProcessor changed to register / unregister currently running statements
+Migration: None
+
+01.07.2011 dwi
+bsi ticket: #103'490
+bugzilla ticket: 350661
+Problem:
+When setting a new nls local via ClientUIPreferences, the changed entry is not
+flushed to disk, i.e. causing the old entry to still exits. Other changes made,
+e.g. updateTableColumnOrder, are flushed immediately.
+Solution:
+Changed ClientUiPreferences#setNlsLocale(NlsLocale) to flush value to disk
+Migration: None
+
+11.07.2011 aho
+Ticket: 102'194 is about taking screen shots of forms. The problem is since the form is opened async the print event does not get to the form.
+Solution:
+Back event to notify the model once a screen shot is done. Furthermore a PrintApplicationAction is created to take screen shots of the whole application.
+Migration:
+none
+
+25.07.2011 dwi
+bugzilla 345184
+bsi ticket 102'074
+Problem:
+- When form tool button is selected, other tool buttons should only be deselected if of the type AbstractFormToolButton
+Migration: None
+
+09.08.2011 dwi
+bsi ticket #104'887
+Problem:
+When exporting table to CVS file format (AbstractTable#exportTableRowsAsCSV), columns of the type boolean are not considered.
+Solution:
+Added handling for values in boolean column. That is if no custom display text is set for such a cell, an 'X' is exported as value.
+Migration:
+None
+
+12.08.2011 dwi
+bsi ticket #100'300
+Problem:
+If having an editable column of the type boolean, values are rendered as checkboxes. When changing the value of that checkbox, the checkbox jumps from center position to the left edge. Furthermore, not the same checkbox widget is displayed as in non-edit mode.
+Solution:
+- Changed representation of checkbox to look the same in edit and non-edit mode.
+- Fixed layout problems when changing from non-edit to edit-mode (checkbox positioning)
+- Added VerticalAlignment on IBoolean column to align the checkbox in both directions, vertical and horizontal
+- Fixed problems in LogicalGridLayout manager to round resulting floating numbers (center position caluculations) the same way as Java layout managers do. Otherwise, the checkbox is positioned differently in between of the layout managers which causes the checkbox to jump around.
+- Fixed problems in inset calculation to look the same on the different L&F providers
+Migration:
+None
+
+22.08.2011 dwi
+BSI ticket #105'026, #104'976
+Problem:
+- Failed to display corrupt HTML pages (e.g. if missing closing quote in style definition)
+- In HTML editor, no cleanup (auto-correction) should be applied to the given HTML. That is because if the user did some modifications in the HTML source and reloads the HTML in the editor anew, unwanted auto-corrections would be applied.
+Solution:
+- Accomplish consistency concerning HTML styling (cleanup) in between of Swing and SWT in regard of ScoutHtmlField and ScoutHmtEditor.
+ In more detail, this entails the following:
+ - Before passing the HTML to the respective widget (ScoutHtmlEditor, ScoutHtmlField), Abstract[Swing|Swt]Environment#styleHtmlText() is called to cleanup the given HTML.
+ - In case of HTML editor mode, no modifications are applied to the given HTML in both, Swing and SWT, respectively.
+ - However, in non-editor mode, some intelligence is applied to the HTML to ensure proper display of the HTML document.
+ - In Swing, cleanup of HTML structure and CSS definitions is done. That is crucial as Swing HTML viewer has some problems with some CSS constructs.
+ - In SWT, OS default browser is used. That is why cleanup of CSS is not necessary as done by browser itself.
+ But, because the HTML is provided as file to the browser, proper encoding and charset must be set.
+- Failsafe: if HTML text cannot be parsed for cleanup, the raw HTML text is used instead of an exception thrown.
+- Consolidation of HTML cleanup functionality in HTMLUtility for plain and simple use that is applicable for both, SWT and Swing, respectively. That is why various methods in HtmlUtility are removed.
+Plug-Ins affected:
+- org.eclipse.scout.commons (HTMLUtility
+- org.eclipse.scout.rt.client (AbstractHtmlField)
+- org.eclipse.scout.rt.ui.swing (AbstractSwingEnvironment, SwingScoutHtmlField, SwingScoutMailField)
+- org.eclipse.scout.rt.ui.swing.bsi.fragment (SwingScoutHtmlEditor)
+- org.eclipse.scout.rt.ui.swt (AbstractSwtEnvironment, SwtScoutHtmlField)
+- org.eclipse.scout.rt.ui.swt.bsi.fragment (SwtScoutHtmlEditor)
+Migration Swing / SWT:
+- In HTMLUtility, the following methods are removed.
+ - HTMLUtility#parseDocument(String) to be replaced by HTMLUtility.toHtmlDocument(String)
+ - HTMLUtility#formatDocument(String) to be replaced by HTMLUtility.toHtmlText(HTMLDocument)
+ - HTMLUtility#cleanupDocument(HTMLDocument, String, int) to be replaced by HTMLUtility.cleanupHtml(String, boolean,boolean, DefaultFont)
+ - HTMLUtility#wellformDocument(HTMLDocument, String, int) to be replaced by HTMLUtility.cleanupHtml(String, boolean,boolean, DefaultFont)
+Migration SWT:
+- In AbstractSwtEnvironment, the following methods are removed as not required anymore because logic is encapsulated in HTMLUtility.
+ - AbstractSwtEnvironment#styleHtmlText(Control, String)
+ - AbstractSwtEnvironment#createCSS(Control)
+ - AbstractSwtEnvironment#createHtmlDocument(String, String)
+
+22.07.2011 dwi [contributed by Remo Arpagaus, BSI Business Systems Integration AG]
+bsi ticket #105’126
+Problem:
+When using ‘yyyy’ in the format of an AbstractDateField, there is no interpretation of the century. Entering 11 for the year results in 0011 CE instead of 2011 CE
+Resources changed: AbstractDateField
+Migration: None
+
+30.09.2011 abr [contributed by Adrian Moser, BSI Business Systems Integration AG]
+bugzilla ticket: 359418
+Bookmark Management Customization
+Changes/Fixes to Scout Bookmark Handling:
+- Scout implementation should be able to use a customized BookmarkForm
+- AbstractBookmarkTreeField: New/Edit Menu PrepareActions (Permissions) should be customizable
+- AbstractBookmarkTreeField : "New Folder" should not be possible on Bookmark Node
+- Text for Global/Private Bookmarks should be configurable
+Migration: None
+
+04.10.2011 dwi
+BSI ticket #106'222, #99'582, #105'229
+Bugzilla ticket #358064, #359811, #359812
+Problem:
+All the tickets mentioned belong to the editable cell topic:
+a) If properties like visiblity or editability are changed on IColumn, the accessiblity of editable cells within that column is not calculated anew.
+ As consequence, the UI representation of such cells does not correspond to the values on the model.
+b) If a value of an editable boolean column is changed by inline editing, other values of that column are toggled/untoggled as well.
+ Even though holding the correct value on model, their UI representation differs. For instance, if forcing the UI to refresh by resizing a column, the checked state in UI gets corrected.
+c) If toggling three times the very same cell of an editable boolean column, the value is not stored in the model anymore.
+d) If toggling a cell of an editable boolean column, it's value is immediately written back to the model which is good.
+ This has the effect, that if there is an implict or explicit sort installed on that column, toggled rows are scampering.
+ This is especially absurd, if the column is part of an implicit sort, meaning that no CTRL-key was held while determing
+ the sort columns. Due to lack of the visual representation of such an implicit sort column, the user gets really confused
+ as rows are reorganized for no reason. This problem is also applicable to other types of editable columns.
+e) If clicking on a cell of an editable boolean column, the cell transitions into modification state, meaning that the associated cell editor is activated.
+ Even though the toggled value is already written back to model, the editor remains open which is confusing to the user.
+ This should be changed to immediately close the cell editor if the value is toggled.
+f) If an editable colum is moved, the column is not editable anymore. Only if the column is moved back to its origin location, the column becomes editable anymore.
+g) If having a checkable table and a cell editor of an editable column does not fill the whole cell space,
+ clicking on that empty space toggles the checked state of the row. This is confusing and moreover error-prone as not the row is intended to be checked/unchecked but rather the cell editor activated / toggled.
+h) If having a checkable table and moving an editable column to the very first position, a click on that column correctly activates the inline editor.
+ Thus, the checked state of that row cannot be changed by clicking on the presented checkbox.
+ This should be changed to not allow an editable column to be moved to the first position. Moreorver, the first column should also be freezed if the succeeding column is an editable one.
+Solution:
+a) Apply row decoration on property change
+b) This was because the active cell editor remained active after toggling the value.
+ Fixed that a still active cell editor gets closed prior to update the model state.
+c) solved by e)
+d) Changed that if the value of a cell editor is written back to model, the sort (if applicable) is suspended.
+ Thus, even though the column represents an implict or explicit sort column, its values are not sorted anymore which in turn is the expected behavior.
+ In consequence, to get the column's values sorted again, the user has to sort the column anew.
+e) Instead of creating an ICheckBox as cell editor which stays active until the focus get lost, an empty cell editor (null) is created.
+ As the toggled value is immediately written back to the model, this editor gets closed shortly after (see b).
+f) Fixed
+g) Mouseclicks that are targetted to cell editors are not interpereted as row-check nor row-uncheck clicks anymore.
+h) Fixed
+Plug-Ins changed:
+- org.eclipse.scout.rt.ui.swing, org.eclipse.scout.rt.client
+Migration:
+None
+
+04.10.2011 hmu
+Bugzilla ticket #359840
+Problem:
+SmartField doesn't handle isAllowCustomText properly when value changed in ui
+Plug-Ins changed:
+- org.eclipse.scout.rt.client
+Migration:
+None
+
+05.10.2011 abr [contributed by Adrian Moser, BSI Business Systems Integration AG]
+bugzilla ticket: 359418
+Bookmark Management Customization
+- Private Folder should be removed (not needed)
+- Support for additional logic when user opens bookmark: IOpenBookmarkCommand
+- AbstractBookmarkTreeField: Support for custom icons
+- BookmarkFolderForm: Grid width should be 1.
+- IBookmarkForm: JavaDoc shoud be added.
+- Bookmark: Support for new Bookmark (unread Bookmarks) should be added
+Migration: None
+
+13.10.2011 abr [contributed by Adrian Moser, BSI Business Systems Integration AG]
+bugzilla ticket: 359418
+Bookmark Management Customization
+Enhancements/fixes for the bookmark field (client-side only):
+- allow dragging and transfer of multiple nodes
+- Possibility to use a row-level PublishUserBookmarkPermission
+- Deletion of bookmark folders improved
+- some more JavaDoc added.
+Migration: None
+
+18.10.2011 abr [contributed by Adrian Moser, BSI Business Systems Integration AG]
+bugzilla ticket: 361233
+Allow implementations to handle AbstractBookmarkTreeField's DnD drop requests
+Added IBookmarkNode interface that allows the receiver to read bookmark data.
+Migration: None
+
+24.10.2011 mvi
+Bugzilla ticket 361816
+Replace current NLS support with Text Provider Services
+- added ITextProviderService, IDocumentationTextProviderService, AbstractDynamicNlsTextProviderService
+- Migrated existing text providers to scout text provider services
+- TEXTS class added for consistent translation retrieval
+- Splitted org.eclipse.scout.rt.shared texts into two plugins:
+ - org.eclipse.scout.rt.shared contains text provider service with all texts that are used by the runtime
+ - org.eclipse.scout.rt.shared.legacy.texts.fragment contains all texts that are no longer used by the runtime
+- getConfiguredDoc properties moved to different ConfigProperty type for Scout SDK (support for Docs Text Providers)
+Migration:
+- Add "org.eclipse.scout.rt.shared.legacy.texts.fragment" to all products.
+- For each existing NLS Class (directly or indirectly extending "org.eclipse.scout.rt.shared.ScoutTexts" or "org.eclipse.scout.commons.nls.DynamicNls"):
+ - create a new "<YourSharedPlugin>.services.common.text.<Name>TextProviderService" extending "org.eclipse.scout.rt.shared.services.common.text.AbstractDynamicNlsTextProviderService" in the corresponding shared plugin.
+- For each created TextProvider Service:
+ - Overwrite the method "getDynamicNlsBaseName" and return the same value as in the "RESOURCE_BUNDLE_NAME" constant (stored in the corresponding Texts class) as string literal.
+ - Register the service in the corresponding plugin as scout service using the "org.eclipse.scout.service.DefaultServiceFactory", no session class and give a ranking > 0. E.g.: <service class="com.bsiag.crm.shared.core.services.common.text.CoreTextProviderService" factory="org.eclipse.scout.service.DefaultServiceFactory" ranking="100" />
+- Delete all Texts classes and replace all uses of the old Texts classes with the class "org.eclipse.scout.rt.shared.TEXTS".
+- Remove the "getNlsTexts" methods from the Session classes if existent (unless you use session-dependent translations).
+- Correct return type of "getConfiguredNlsProvider" of all SqlServices (if existent) to return the new type defined by AbstractSqlService and return "ScoutTexts.class" inside the method.
+- If somewhere the "SwingUtility.setNlsTexts" method or "SwtUtility.setNlsTextsOnDisplay" method is used, set it to "ScoutTexts.getInstance()".
+- Delete all .nls files (NLS Editor can now be accessed using the TextProviderService Node in the Scout Explorer of the Scout perspective).
+ If you want to keep the .nls files (e.g. to support key shortcuts like ctrl+shift+r) do the following:
+ - Open the .nls file in the text editor (right click -> open with).
+ - Remove the following properties: "Nls-Type", "Nls-File-Prefix", "Nls-Translation-Folder".
+ - Change the property "Nls-Class" to the fully qualified name of the Text Provider Service you would like to edit with this .nls file.
+ - Save the changes and open the .nls file again in the Multilanguage Editor (right click -> open with).
+
+26.10.2011 dwi
+Bugzilla ticket 361795
+Problem:
+Decorating a Date or a Number has to use NlsLocale-Settings.
+Currently, Locale.getLocal() is used which may contradict with user-settings.
+Solution:
+In Java 6 it is possible to contribute custom Locales (e.g. en_CH) to the JRE. That is why Scout NlsLocale is not used anymore and therefore marked as deprecated.
+The user's locale is accessed as follows:
+- On client side, the user's locale is accessed by Locale.getDefault()
+- On server side the request's locale is accessed by LocaleThreadLocal.get() (convenience accessor: ServerSession.get().getLocale())
+Eventhough the class NlsLocale is marked as deprecated for legacy support, its constructor 'NlsLocale(Locale)' was removed because NlsLocale was changed to only act as delegate to the thread's locale (if applicable) or default locale otherwise.
+Please note: A locale consists of its language and country. The country is mainly responsible for format settings as for instance the grouping separator of numbers. A very few locales already exist in the JRE. But if you like to have the application in the English language with Switzerland as its region, you have to contribute your own locale-implementation 'en_CH'. Please see Migration section for detailed instructions to extend JRE with a custom locale.
+Plug-Ins changed:
+- org.eclipse.scout.commons
+- org.eclipse.scout.rt.client
+- org.eclipse.scout.rt.server
+- org.eclipse.scout.rt.shared
+- org.eclipse.scout.rt.ui.swing
+- org.eclipse.scout.rt.oraclelite10g.core
+- org.eclipse.scout.rt.xstream.shared
+Migration:
+- removed NlsLocale(Locale) (constructor): use Locale instead of NlsLocale
+- removed IServerSession#getNlsLocale(): use IServerSession#getLocale() instead (e.g. replace all ServerSession.get().getNlsLocale().getLocale() by ServerSession.get().getLocale())
+- In client Plug-Ins: replace NlsLocale.getDefault().getLocale() by Locale.getDefault()
+- In server Plug-Ins: replace NlsLocale.getThreadDefault().getLocale() by LocaleThreadLocal.get()
+- In shared Plug-Ins: replace NlsLocale.getDefault().getLocale() by NlsUtility.getDefaultLocale()
+Contribution of custom locales to the JRE:
+1. Create a plain Java project, e.g. x.y.localeprovider.en.ch
+2. Create two classes that inherit from {@link DateFormatProvider} and {@link NumberFormatProvider} and implement the method stubs specific to your locale
+3. Create the folder META-INF/services with two files java.text.spi.DateFormatProvider and java.text.spi.NumberFormatProvider
+4. In those files, simply put the the fully qualified name to your date/number provider
+5. Export project as JAR file and put it into \lib\ext of your JRE
+
+15.12.2011 cgu
+Bugzilla ticket 364556
+Problem:
+If a checkbox is defined in a sequence box, the label of the checkbox is shown as label of the sequence box although the checkbox itself already shows the label.
+Solution:
+Excluded BooleanFields from the computation of the compound label.
+Migration:
+- Since the checkbox is excluded the label of the next field is considered for the compound label.
+ So if you use sequenceboxes which contain a checkbox and another field you may want to override execIsLabelSuffixCandidate and return false so that no label suffix is created and only the sequencebox label is shown.
+
+03.01.2012 dwi
+Bugzilla: 367507
+Problem:
+When having a single line textfield (getConfiguredMultilineText=false), leading and trailing newlines should not be replaced by spaces but omitted insted.
+Solution:
+Leading and trailing newlines are trimmed prior to replacing them by spaces.
+Plug-Ins changed:
+org.eclipse.scout.commons [StringUtility], org.eclipse.scout.rt.ui.swing [SwingScoutTextFieldComposite#P_SwingDocumentFilter], org.eclipse.scout.rt.client [SwingScoutTextFieldComposite]
+Migration: None
+
+12.01.2012 imo
+Bugzilla: 364574
+New busy handling facility
+The model detects busy in ClientSyncJob and provides the IBusyManagerService with IBusyHandler.
+See swing, swt, rwt scout implemenations for more details.
+
+19.01.2012 abr
+Bugzilla: 369115, Locale on client-side
+Locale must be available on the ClientSession and all client jobs have to use it (i.e. set LocaleThreadLocal before executing the job).
+Migration:
+- Possibly available ClientSession.getLocale and ClientSession.setLocale must either be removed or renamed.
+- Dynamically changing the locale must be propagated to the client session as well.
+- Accessing a client's locale should always done by invoking LocaleThreadLocal.get()
+- ClientJob.run (and therefore ClientSyncJob.run as well as ClientAsyncJob.run) should not be overridden anymore. The method will be marked final in a subsequent release.
+ Use ClientJob.runStatus or ClientJob.runVoid instead.
+
+30.01.2012 abr
+Bugzilla 370118
+findCodeTypeById on CodeService and CodeServiceClientProxy works for cached code types only
+Solution:
+If findCodeTypeById returns null for a non-null key, populate cache and retry.
+Migration:
+None
+
+07.02.2011 abr
+Bugzilla 370821
+last activated forms on AbstractDesktop are not released
+The AbstractDesktop manages a list of open forms, ordered descending by their last activation. The elements
+of the list are never released and the form listener tracking activation changes is not used at all. Further,
+the last active form returned is not the last, but the first which weak reference is still valid.
+Migration: None
+
+07.02.2011 abr
+Bugzilla 370830
+closing the desktop should close all open forms as well
+When the desktop is closed, all open forms are just removed from the view and dialog stacks, respectively.
+The forms however are not closed. Hence any clean-up operations must be implemented as desktop listeners.
+This approach still breaks a form's life cycle.
+Migration: None
+
+14.02.2012 kle
+Bugzilla 352955
+Problem:
+When using modes IActivityMap.PLANNING_MODE_DAY or IActivityMap.PLANNING_MODE_WEEK
+the selected columns are not handled correctly due to the used values at the end
+boundaries of a MinorColumn object. During construction of a MinorColumn, 1ms is
+automatically subtracted from the end time.
+Solution:
+When fetching the column index for a given end time, it has to be checked if
+the given end time fits into the begin and end time interval of the column.
+Otherwise, the previous column has to be returned.
+Migration:
+None
+
+06.03.2012 abr
+Bugzilla: 373358
+composer field: select parent node when a node is deleted
+Problem:
+The selection in an org.eclipse.scout.rt.client.ui.form.fields.composer.AbstractComposerField gets lost if a node
+is removed using its corresponding delete menu. However, the previous node is selected when a node is deleted by
+the delete key stroke.
+Solution:
+Added the selection behavior to the nodes' delete menus and select previous parent node instead of previous node.
+Migration: none
+
+12.03.2012 ast, abr
+Bugzilla: 372381
+Setting up an initial order for IColumns
+Problem:
+Table columns are initially ordered in the GUI the same way as in the model, using the @Order annotation. It is not
+possible to set a different initial ordering for the GUI.
+Solution:
+Added new property viewOrder on IColumn and recompute view orders whenever the property changes for a column. As a
+side effect, view orders can be changed after the model has been initialized.
+Migration: none
+
+13.03.2012 abr
+Bugzilla: 374044
+Problem:
+Currently, table column filters are persisted in user scope preferences. Hence they are reapplied after application
+restarts. They are further applied to all table instances having the same client preference context.
+Solution:
+Table filter settings behave like search form states. i.e. they are remembered as long as a Scout application runs,
+but they do not endure application restarts. Reloading pages having search constraints or filters applied, must
+apply them again. Memory constraints may limit the size of stored search constraints and filter settings.
+Added filter settings cache on IMemoryPolicy.
+Migration: none
+
+26.03.2012 sme, abr
+Bugzilla: 375152
+Problem:
+When a user cancels the search in an outline, the search form keeps its state but the displayed rows belong to the last
+executed search.
+Solution:
+o If a user cancels the search, all rows in the table should be discarded and the user show be notified of the canceled
+ search.
+o Additionally, any exception during loading the table data behaves the same: the table data is discarded and
+ the table status is set appropriately.
+o If the severity of the table population status is IProcessingStatus.CANCEL, the table selection status is hidden and
+ the population status is rendered like a warning (e.g. foreground color orange).
+Migration: none
+
+27.03.2012 bko,jgu
+Bugzilla: 367850
+Problem:
+XML I/O on IForm (IForm.storeXML and IForm.loadXML) does not work properly for
+IFormFields with a non-unique class name. F.e. if a SearchForm with two tabs
+which both contains a TextField with the same class name.
+Solution:
+o The IFromField provides a method getXMLFieldId() which will be used for XML I/O.
+This method will return the fields simple class name by default for fields with unique class names.
+For non-unique class names the simple class name of the parent field is added to the id, until it is unique.
+o Loading older XML files with ambiguous fields is still possible: Data is imported to the first field found (as before).
+Migration: none
+
+10.04.2012 jbr
+Bugzilla: 361985
+Bug following the discussion here:
+http://www.eclipse.org/forums/index.php/t/210744/
+ • Naming consistency:
+clearDeletedRows() => discardAllDeletedRows()
+ • Add the possibility to discard a specific deleted row
+discardDeleteRow(TableRow deletedRow)
+discardDeleteRows(TableRow deletedRow)
+discarding a DeletedRow by index (or array of indexes) makes no sense, because if the row is deleted, the row do not have an index anymore.
+Migration: ITable#clearDeletedRows() is deprecated, use ITable#discardAllDeletedRows() instead.
diff --git a/org.eclipse.scout.rt.client/resources/html/defaultWizardStatus.html b/org.eclipse.scout.rt.client/resources/html/defaultWizardStatus.html
index 951ac55cad..5e3e87518a 100644
--- a/org.eclipse.scout.rt.client/resources/html/defaultWizardStatus.html
+++ b/org.eclipse.scout.rt.client/resources/html/defaultWizardStatus.html
@@ -1,79 +1,79 @@
-<html>
-<head>
- <style type="text/css">
- body, td {
- font-family:arial;
- font-size:12#FONT_SIZE_UNIT#;
- background-color:#EBF4F8;
- margin:0;
- }
- a {
- font-family:arial;
- font-size:12#FONT_SIZE_UNIT#;
- color: #67A8CE;
- margin:0;
- }
- td {
- vertical-align: top;
- }
- td.bullet {
- font-weight:bold;
- font-size:18#FONT_SIZE_UNIT#;
- text-align:center;
- color:#FFFFFF;
- }
- tr.selected td {
- font-family:arial;
- font-size:12#FONT_SIZE_UNIT#;
- background-color:#FFFFFF;
- margin:0;
- }
- tr.default td {
- font-family:arial;
- font-size:12#FONT_SIZE_UNIT#;
- background-color:#EBF4F8;
- margin:0;
- }
- tr.line td {
- background-color:#DFEEF5;
- }
- tr.spacerselected td {
- background-color:#FFFFFF;
- }
- tr.default td.bullet {
- background-image: url("wizard_bullet.png");
- background-repeat: no-repeat;
- padding-top: 2px;
- font-weight:bold;
- font-size:18#FONT_SIZE_UNIT#;
- text-align:center;
- color: #FFFFFF;
- }
- tr.selected td.bullet {
- background-image: url("wizard_bullet_selected.png");
- background-repeat: no-repeat;
- padding-top: 2px;
- font-weight:bold;
- font-size:18#FONT_SIZE_UNIT#;
- text-align:center;
- color: #FFFFFF;
- }
- tr.disabled td.bullet {
- background-image: url("wizard_bullet_disabled.png");
- background-repeat: no-repeat;
- padding-top: 2px;
- font-weight:bold;
- font-size:18#FONT_SIZE_UNIT#;
- text-align:center;
- color: #FFFFFF;
- }
- </style>
-</head>
-<body>
- #TOP#
- <table width="100%" border="0" cellspacing="0" cellpadding="0">
- #LIST#
- </table>
- #BOTTOM#
-</body>
+<html>
+<head>
+ <style type="text/css">
+ body, td {
+ font-family:arial;
+ font-size:12#FONT_SIZE_UNIT#;
+ background-color:#EBF4F8;
+ margin:0;
+ }
+ a {
+ font-family:arial;
+ font-size:12#FONT_SIZE_UNIT#;
+ color: #67A8CE;
+ margin:0;
+ }
+ td {
+ vertical-align: top;
+ }
+ td.bullet {
+ font-weight:bold;
+ font-size:18#FONT_SIZE_UNIT#;
+ text-align:center;
+ color:#FFFFFF;
+ }
+ tr.selected td {
+ font-family:arial;
+ font-size:12#FONT_SIZE_UNIT#;
+ background-color:#FFFFFF;
+ margin:0;
+ }
+ tr.default td {
+ font-family:arial;
+ font-size:12#FONT_SIZE_UNIT#;
+ background-color:#EBF4F8;
+ margin:0;
+ }
+ tr.line td {
+ background-color:#DFEEF5;
+ }
+ tr.spacerselected td {
+ background-color:#FFFFFF;
+ }
+ tr.default td.bullet {
+ background-image: url("wizard_bullet.png");
+ background-repeat: no-repeat;
+ padding-top: 2px;
+ font-weight:bold;
+ font-size:18#FONT_SIZE_UNIT#;
+ text-align:center;
+ color: #FFFFFF;
+ }
+ tr.selected td.bullet {
+ background-image: url("wizard_bullet_selected.png");
+ background-repeat: no-repeat;
+ padding-top: 2px;
+ font-weight:bold;
+ font-size:18#FONT_SIZE_UNIT#;
+ text-align:center;
+ color: #FFFFFF;
+ }
+ tr.disabled td.bullet {
+ background-image: url("wizard_bullet_disabled.png");
+ background-repeat: no-repeat;
+ padding-top: 2px;
+ font-weight:bold;
+ font-size:18#FONT_SIZE_UNIT#;
+ text-align:center;
+ color: #FFFFFF;
+ }
+ </style>
+</head>
+<body>
+ #TOP#
+ <table width="100%" border="0" cellspacing="0" cellpadding="0">
+ #LIST#
+ </table>
+ #BOTTOM#
+</body>
</html> \ No newline at end of file
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/AbstractClientSession.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/AbstractClientSession.java
index 861f18fe7b..9f7e2c2836 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/AbstractClientSession.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/AbstractClientSession.java
@@ -1,528 +1,528 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client;
-
-import java.beans.PropertyChangeListener;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Vector;
-
-import javax.security.auth.Subject;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.equinox.app.IApplication;
-import org.eclipse.scout.commons.EventListenerList;
-import org.eclipse.scout.commons.LocaleThreadLocal;
-import org.eclipse.scout.commons.TypeCastUtility;
-import org.eclipse.scout.commons.annotations.ConfigOperation;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.commons.security.SimplePrincipal;
-import org.eclipse.scout.rt.client.services.common.clientnotification.ClientNotificationConsumerEvent;
-import org.eclipse.scout.rt.client.services.common.clientnotification.IClientNotificationConsumerListener;
-import org.eclipse.scout.rt.client.services.common.clientnotification.IClientNotificationConsumerService;
-import org.eclipse.scout.rt.client.servicetunnel.IServiceTunnel;
-import org.eclipse.scout.rt.client.ui.DataChangeListener;
-import org.eclipse.scout.rt.client.ui.IIconLocator;
-import org.eclipse.scout.rt.client.ui.IconLocator;
-import org.eclipse.scout.rt.client.ui.desktop.DesktopListener;
-import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
-import org.eclipse.scout.rt.client.ui.desktop.internal.VirtualDesktop;
-import org.eclipse.scout.rt.shared.OfflineState;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.TextsThreadLocal;
-import org.eclipse.scout.rt.shared.services.common.context.SharedContextChangedNotification;
-import org.eclipse.scout.rt.shared.services.common.context.SharedVariableMap;
-import org.eclipse.scout.rt.shared.services.common.prefs.IUserPreferencesStorageService;
-import org.eclipse.scout.rt.shared.services.common.security.ILogoutService;
-import org.eclipse.scout.rt.shared.ui.UserAgent;
-import org.eclipse.scout.service.SERVICES;
-import org.osgi.framework.Bundle;
-import org.osgi.service.prefs.BackingStoreException;
-import org.osgi.service.prefs.Preferences;
-
-public abstract class AbstractClientSession implements IClientSession {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractClientSession.class);
-
- // context
- private Bundle m_bundle;
- // state
- private final Object m_stateLock;
- private boolean m_active;
- private Throwable m_loadError;
- private int m_exitCode = IApplication.EXIT_OK;
- // model
- private IDesktop m_desktop;
- private VirtualDesktop m_virtualDesktop;
- private IServiceTunnel m_serviceTunnel;
- private Subject m_offlineSubject;
- private Subject m_subject;
- private final SharedVariableMap m_sharedVariableMap;
- private boolean m_singleThreadSession;
- private String m_virtualSessionId;
- private IMemoryPolicy m_memoryPolicy;
- private IIconLocator m_iconLocator;
- private final HashMap<String, Object> m_clientSessionData;
- private ScoutTexts m_scoutTexts;
- private Locale m_locale;
- private UserAgent m_userAgent;
- private Vector<ILocaleListener> m_localeListener = new Vector<ILocaleListener>();
-
- public AbstractClientSession(boolean autoInitConfig) {
- m_clientSessionData = new HashMap<String, Object>();
- m_stateLock = new Object();
- m_sharedVariableMap = new SharedVariableMap();
- m_locale = LocaleThreadLocal.get();
- if (autoInitConfig) {
- initConfig();
- }
- }
-
- /**
- * @deprecated use {@link #getConfiguredSingleThreadSession()} instead
- */
- @Deprecated
- protected boolean getConfiguredWebSession() {
- return getConfiguredSingleThreadSession();
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(100)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredSingleThreadSession() {
- return false;
- }
-
- @Override
- public String getUserId() {
- return getSharedContextVariable("userId", String.class);
- }
-
- /**
- * <p>
- * Returns the {@link ScoutTexts} instance assigned to the type (class) of the current ClientSession.
- * </p>
- * <p>
- * Override this method to set the application specific texts implementation
- * </p>
- */
- @Override
- public ScoutTexts getTexts() {
- return m_scoutTexts;
- }
-
- @Override
- public final Locale getLocale() {
- return m_locale;
- }
-
- @Override
- public final void setLocale(Locale locale) {
- if (locale != null) {
- Locale oldLocale = m_locale;
- m_locale = locale;
- if (!locale.equals(oldLocale)) {
- notifyLocaleListeners(locale);
- }
- }
- }
-
- @Override
- public Subject getOfflineSubject() {
- return m_offlineSubject;
- }
-
- protected void setOfflineSubject(Subject offlineSubject) {
- m_offlineSubject = offlineSubject;
- }
-
- @Override
- public Bundle getBundle() {
- return m_bundle;
- }
-
- @Override
- public boolean isActive() {
- return m_active;
- }
-
- private void setActive(boolean b) {
- synchronized (m_stateLock) {
- m_active = b;
- m_stateLock.notifyAll();
- }
- }
-
- @Override
- public boolean isLoaded() {
- return m_active;
- }
-
- @Override
- public Map<String, Object> getSharedVariableMap() {
- return Collections.unmodifiableMap(m_sharedVariableMap);
- }
-
- /**
- * do not use this internal method directly
- */
- protected <T> T getSharedContextVariable(String name, Class<T> type) {
- Object o = m_sharedVariableMap.get(name);
- return TypeCastUtility.castValue(o, type);
- }
-
- @Override
- public final Throwable getLoadError() {
- return m_loadError;
- }
-
- @Override
- public final Object getStateLock() {
- return m_stateLock;
- }
-
- /*
- * Properties
- */
-
- protected void initConfig() {
- m_singleThreadSession = getConfiguredSingleThreadSession();
- m_virtualDesktop = new VirtualDesktop();
- setMemoryPolicy(new LargeMemoryPolicy());
- // add client notification listener
- IClientNotificationConsumerService clientNotificationConsumerService = SERVICES.getService(IClientNotificationConsumerService.class);
- if (clientNotificationConsumerService != null) {
- clientNotificationConsumerService.addClientNotificationConsumerListener(this, new IClientNotificationConsumerListener() {
- @Override
- public void handleEvent(final ClientNotificationConsumerEvent e, boolean sync) {
- if (e.getClientNotification().getClass() == SharedContextChangedNotification.class) {
- if (sync) {
- try {
- updateSharedVariableMap(((SharedContextChangedNotification) e.getClientNotification()).getSharedVariableMap());
- }
- catch (Throwable t) {
- LOG.error("update of shared contex", t);
- // nop
- }
- }
- else {
- new ClientSyncJob("Update shared context", ClientSyncJob.getCurrentSession()) {
- @Override
- protected void runVoid(IProgressMonitor monitor) throws Throwable {
- updateSharedVariableMap(((SharedContextChangedNotification) e.getClientNotification()).getSharedVariableMap());
- }
- }.schedule();
- }
- }
- }
- });
- }
- }
-
- private void updateSharedVariableMap(SharedVariableMap newMap) {
- m_sharedVariableMap.updateInternal(newMap);
- }
-
- @Override
- public final void startSession(Bundle bundle) {
- m_bundle = bundle;
- if (isActive()) {
- throw new IllegalStateException("session is active");
- }
- try {
- String policy = bundle.getBundleContext().getProperty("org.eclipse.scout.memory");
- if ("small".equals(policy)) {
- setMemoryPolicy(new SmallMemoryPolicy());
- }
- else if ("medium".equals(policy)) {
- setMemoryPolicy(new MediumMemoryPolicy());
- }
- m_iconLocator = createIconLocator();
- m_scoutTexts = new ScoutTexts();
- // explicitly set the just created instance to the ThreadLocal because it was not available yet, when the job was started.
- TextsThreadLocal.set(m_scoutTexts);
- execLoadSession();
- setActive(true);
- }
- catch (Throwable t) {
- m_loadError = t;
- LOG.error("load session", t);
- }
- }
-
- @ConfigOperation
- @Order(10)
- protected void execLoadSession() throws ProcessingException {
- }
-
- @ConfigOperation
- @Order(20)
- protected void execStoreSession() throws ProcessingException {
- }
-
- @Override
- public IDesktop getVirtualDesktop() {
- return m_desktop != null ? m_desktop : m_virtualDesktop;
- }
-
- @Override
- public IDesktop getDesktop() {
- return m_desktop;
- }
-
- @Override
- public void setDesktop(IDesktop a) throws ProcessingException {
- if (a == null) {
- throw new IllegalArgumentException("argument must not be null");
- }
- if (m_desktop != null) {
- throw new IllegalStateException("desktop is active");
- }
- m_desktop = a;
- if (m_desktop != null) {
- if (m_virtualDesktop != null) {
- for (DesktopListener listener : m_virtualDesktop.getDesktopListeners()) {
- m_desktop.addDesktopListener(listener);
- }
- for (Map.Entry<String, EventListenerList> e : m_virtualDesktop.getPropertyChangeListenerMap().entrySet()) {
- String propName = e.getKey();
- EventListenerList list = e.getValue();
- if (propName == null) {
- for (PropertyChangeListener listener : list.getListeners(PropertyChangeListener.class)) {
- m_desktop.addPropertyChangeListener(listener);
- }
- }
- else {
- for (PropertyChangeListener listener : list.getListeners(PropertyChangeListener.class)) {
- m_desktop.addPropertyChangeListener(propName, listener);
- }
- }
- }
- for (Map.Entry<Object, EventListenerList> e : m_virtualDesktop.getDataChangeListenerMap().entrySet()) {
- Object dataType = e.getKey();
- EventListenerList list = e.getValue();
- if (dataType == null) {
- for (DataChangeListener listener : list.getListeners(DataChangeListener.class)) {
- m_desktop.addDataChangeListener(listener);
- }
- }
- else {
- for (DataChangeListener listener : list.getListeners(DataChangeListener.class)) {
- m_desktop.addDataChangeListener(listener, dataType);
- }
- }
- }
- m_virtualDesktop = null;
- }
- m_desktop.initDesktop();
- }
- else {
- m_virtualDesktop = new VirtualDesktop();
- }
- }
-
- /**
- * Close the session
- */
- @Override
- public void stopSession() {
- stopSession(IApplication.EXIT_OK);
- }
-
- @Override
- public void stopSession(int exitCode) {
- m_exitCode = exitCode;
- try {
- execStoreSession();
- }
- catch (Throwable t) {
- LOG.error("store session", t);
- }
- if (m_desktop != null) {
- try {
- m_desktop.closeInternal();
- }
- catch (Throwable t) {
- LOG.error("close desktop", t);
- }
- m_desktop = null;
- }
- if (!m_localeListener.isEmpty()) {
- m_localeListener.clear();
- }
- try {
- if (getServiceTunnel() != null) {
- SERVICES.getService(ILogoutService.class).logout();
- }
- }
- catch (Throwable t) {
- LOG.info("logout on server", t);
- }
- m_clientSessionData.clear();
- setActive(false);
- if (LOG.isInfoEnabled()) {
- LOG.info("end session event loop");
- }
- }
-
- @Override
- public int getExitCode() {
- return m_exitCode;
- }
-
- @Override
- public IServiceTunnel getServiceTunnel() {
- return m_serviceTunnel;
- }
-
- protected void setServiceTunnel(IServiceTunnel tunnel) {
- m_serviceTunnel = tunnel;
- }
-
- @Override
- public IMemoryPolicy getMemoryPolicy() {
- return m_memoryPolicy;
- }
-
- @Override
- public void setMemoryPolicy(IMemoryPolicy p) {
- if (m_memoryPolicy != null) {
- m_memoryPolicy.removeNotify();
- }
- m_memoryPolicy = p;
- if (m_memoryPolicy != null) {
- m_memoryPolicy.addNotify();
- }
- }
-
- public void goOnline() throws ProcessingException {
- if (OfflineState.isOfflineDefault()) {
- OfflineState.setOfflineDefault(false);
- }
- }
-
- @Override
- public void goOffline() throws ProcessingException {
- Preferences pref = SERVICES.getService(IUserPreferencesStorageService.class).loadPreferences();
- if (getUserId() != null) {
- if (OfflineState.isOnlineDefault()) {
- try {
- pref.put("offline.user", getUserId());
- pref.flush();
- pref.sync();
- }
- catch (BackingStoreException e) {
- LOG.error("Could not write userId to preferences!");
- }
- }
- }
- // create new backend subject
- String offlineUser = pref.get("offline.user", "anonymous");
- m_offlineSubject = new Subject();
- m_offlineSubject.getPrincipals().add(new SimplePrincipal(offlineUser));
- OfflineState.setOfflineDefault(true);
- }
-
- @Override
- @SuppressWarnings("deprecation")
- public boolean isWebSession() {
- return isSingleThreadSession();
- }
-
- @Override
- public boolean isSingleThreadSession() {
- return m_singleThreadSession;
- }
-
- @Override
- public String getVirtualSessionId() {
- return m_virtualSessionId;
- }
-
- @Override
- public void setVirtualSessionId(String sessionId) {
- m_virtualSessionId = sessionId;
- }
-
- @Override
- public Subject getSubject() {
- return m_subject;
- }
-
- @Override
- public void setSubject(Subject subject) {
- m_subject = subject;
- }
-
- protected IIconLocator createIconLocator() {
- return new IconLocator(this);
- }
-
- @Override
- public IIconLocator getIconLocator() {
- return m_iconLocator;
- }
-
- @Override
- public void setData(String key, Object data) {
- if (data == null) {
- m_clientSessionData.remove(key);
- }
- else {
- m_clientSessionData.put(key, data);
- }
- }
-
- @Override
- public Object getData(String key) {
- return m_clientSessionData.get(key);
- }
-
- @Override
- public UserAgent getUserAgent() {
- if (m_userAgent == null) {
- LOG.warn("UserAgent has not been initialied correctly. Using default.");
- m_userAgent = UserAgent.createDefault();
- }
- return m_userAgent;
- }
-
- @Override
- public void setUserAgent(UserAgent userAgent) {
- m_userAgent = userAgent;
- }
-
- @Override
- public void addLocaleListener(ILocaleListener listener) {
- m_localeListener.add(listener);
- }
-
- @Override
- public void removeLocaleListener(ILocaleListener listener) {
- m_localeListener.remove(listener);
- }
-
- protected void notifyLocaleListeners(Locale locale) {
- LocaleChangeEvent event = new LocaleChangeEvent(this, locale);
- Iterator it = ((Vector) m_localeListener.clone()).iterator();
- while (it.hasNext()) {
- ILocaleListener listener = (ILocaleListener) it.next();
- listener.localeChanged(event);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client;
+
+import java.beans.PropertyChangeListener;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Vector;
+
+import javax.security.auth.Subject;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.equinox.app.IApplication;
+import org.eclipse.scout.commons.EventListenerList;
+import org.eclipse.scout.commons.LocaleThreadLocal;
+import org.eclipse.scout.commons.TypeCastUtility;
+import org.eclipse.scout.commons.annotations.ConfigOperation;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.commons.security.SimplePrincipal;
+import org.eclipse.scout.rt.client.services.common.clientnotification.ClientNotificationConsumerEvent;
+import org.eclipse.scout.rt.client.services.common.clientnotification.IClientNotificationConsumerListener;
+import org.eclipse.scout.rt.client.services.common.clientnotification.IClientNotificationConsumerService;
+import org.eclipse.scout.rt.client.servicetunnel.IServiceTunnel;
+import org.eclipse.scout.rt.client.ui.DataChangeListener;
+import org.eclipse.scout.rt.client.ui.IIconLocator;
+import org.eclipse.scout.rt.client.ui.IconLocator;
+import org.eclipse.scout.rt.client.ui.desktop.DesktopListener;
+import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
+import org.eclipse.scout.rt.client.ui.desktop.internal.VirtualDesktop;
+import org.eclipse.scout.rt.shared.OfflineState;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.TextsThreadLocal;
+import org.eclipse.scout.rt.shared.services.common.context.SharedContextChangedNotification;
+import org.eclipse.scout.rt.shared.services.common.context.SharedVariableMap;
+import org.eclipse.scout.rt.shared.services.common.prefs.IUserPreferencesStorageService;
+import org.eclipse.scout.rt.shared.services.common.security.ILogoutService;
+import org.eclipse.scout.rt.shared.ui.UserAgent;
+import org.eclipse.scout.service.SERVICES;
+import org.osgi.framework.Bundle;
+import org.osgi.service.prefs.BackingStoreException;
+import org.osgi.service.prefs.Preferences;
+
+public abstract class AbstractClientSession implements IClientSession {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractClientSession.class);
+
+ // context
+ private Bundle m_bundle;
+ // state
+ private final Object m_stateLock;
+ private boolean m_active;
+ private Throwable m_loadError;
+ private int m_exitCode = IApplication.EXIT_OK;
+ // model
+ private IDesktop m_desktop;
+ private VirtualDesktop m_virtualDesktop;
+ private IServiceTunnel m_serviceTunnel;
+ private Subject m_offlineSubject;
+ private Subject m_subject;
+ private final SharedVariableMap m_sharedVariableMap;
+ private boolean m_singleThreadSession;
+ private String m_virtualSessionId;
+ private IMemoryPolicy m_memoryPolicy;
+ private IIconLocator m_iconLocator;
+ private final HashMap<String, Object> m_clientSessionData;
+ private ScoutTexts m_scoutTexts;
+ private Locale m_locale;
+ private UserAgent m_userAgent;
+ private Vector<ILocaleListener> m_localeListener = new Vector<ILocaleListener>();
+
+ public AbstractClientSession(boolean autoInitConfig) {
+ m_clientSessionData = new HashMap<String, Object>();
+ m_stateLock = new Object();
+ m_sharedVariableMap = new SharedVariableMap();
+ m_locale = LocaleThreadLocal.get();
+ if (autoInitConfig) {
+ initConfig();
+ }
+ }
+
+ /**
+ * @deprecated use {@link #getConfiguredSingleThreadSession()} instead
+ */
+ @Deprecated
+ protected boolean getConfiguredWebSession() {
+ return getConfiguredSingleThreadSession();
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(100)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredSingleThreadSession() {
+ return false;
+ }
+
+ @Override
+ public String getUserId() {
+ return getSharedContextVariable("userId", String.class);
+ }
+
+ /**
+ * <p>
+ * Returns the {@link ScoutTexts} instance assigned to the type (class) of the current ClientSession.
+ * </p>
+ * <p>
+ * Override this method to set the application specific texts implementation
+ * </p>
+ */
+ @Override
+ public ScoutTexts getTexts() {
+ return m_scoutTexts;
+ }
+
+ @Override
+ public final Locale getLocale() {
+ return m_locale;
+ }
+
+ @Override
+ public final void setLocale(Locale locale) {
+ if (locale != null) {
+ Locale oldLocale = m_locale;
+ m_locale = locale;
+ if (!locale.equals(oldLocale)) {
+ notifyLocaleListeners(locale);
+ }
+ }
+ }
+
+ @Override
+ public Subject getOfflineSubject() {
+ return m_offlineSubject;
+ }
+
+ protected void setOfflineSubject(Subject offlineSubject) {
+ m_offlineSubject = offlineSubject;
+ }
+
+ @Override
+ public Bundle getBundle() {
+ return m_bundle;
+ }
+
+ @Override
+ public boolean isActive() {
+ return m_active;
+ }
+
+ private void setActive(boolean b) {
+ synchronized (m_stateLock) {
+ m_active = b;
+ m_stateLock.notifyAll();
+ }
+ }
+
+ @Override
+ public boolean isLoaded() {
+ return m_active;
+ }
+
+ @Override
+ public Map<String, Object> getSharedVariableMap() {
+ return Collections.unmodifiableMap(m_sharedVariableMap);
+ }
+
+ /**
+ * do not use this internal method directly
+ */
+ protected <T> T getSharedContextVariable(String name, Class<T> type) {
+ Object o = m_sharedVariableMap.get(name);
+ return TypeCastUtility.castValue(o, type);
+ }
+
+ @Override
+ public final Throwable getLoadError() {
+ return m_loadError;
+ }
+
+ @Override
+ public final Object getStateLock() {
+ return m_stateLock;
+ }
+
+ /*
+ * Properties
+ */
+
+ protected void initConfig() {
+ m_singleThreadSession = getConfiguredSingleThreadSession();
+ m_virtualDesktop = new VirtualDesktop();
+ setMemoryPolicy(new LargeMemoryPolicy());
+ // add client notification listener
+ IClientNotificationConsumerService clientNotificationConsumerService = SERVICES.getService(IClientNotificationConsumerService.class);
+ if (clientNotificationConsumerService != null) {
+ clientNotificationConsumerService.addClientNotificationConsumerListener(this, new IClientNotificationConsumerListener() {
+ @Override
+ public void handleEvent(final ClientNotificationConsumerEvent e, boolean sync) {
+ if (e.getClientNotification().getClass() == SharedContextChangedNotification.class) {
+ if (sync) {
+ try {
+ updateSharedVariableMap(((SharedContextChangedNotification) e.getClientNotification()).getSharedVariableMap());
+ }
+ catch (Throwable t) {
+ LOG.error("update of shared contex", t);
+ // nop
+ }
+ }
+ else {
+ new ClientSyncJob("Update shared context", ClientSyncJob.getCurrentSession()) {
+ @Override
+ protected void runVoid(IProgressMonitor monitor) throws Throwable {
+ updateSharedVariableMap(((SharedContextChangedNotification) e.getClientNotification()).getSharedVariableMap());
+ }
+ }.schedule();
+ }
+ }
+ }
+ });
+ }
+ }
+
+ private void updateSharedVariableMap(SharedVariableMap newMap) {
+ m_sharedVariableMap.updateInternal(newMap);
+ }
+
+ @Override
+ public final void startSession(Bundle bundle) {
+ m_bundle = bundle;
+ if (isActive()) {
+ throw new IllegalStateException("session is active");
+ }
+ try {
+ String policy = bundle.getBundleContext().getProperty("org.eclipse.scout.memory");
+ if ("small".equals(policy)) {
+ setMemoryPolicy(new SmallMemoryPolicy());
+ }
+ else if ("medium".equals(policy)) {
+ setMemoryPolicy(new MediumMemoryPolicy());
+ }
+ m_iconLocator = createIconLocator();
+ m_scoutTexts = new ScoutTexts();
+ // explicitly set the just created instance to the ThreadLocal because it was not available yet, when the job was started.
+ TextsThreadLocal.set(m_scoutTexts);
+ execLoadSession();
+ setActive(true);
+ }
+ catch (Throwable t) {
+ m_loadError = t;
+ LOG.error("load session", t);
+ }
+ }
+
+ @ConfigOperation
+ @Order(10)
+ protected void execLoadSession() throws ProcessingException {
+ }
+
+ @ConfigOperation
+ @Order(20)
+ protected void execStoreSession() throws ProcessingException {
+ }
+
+ @Override
+ public IDesktop getVirtualDesktop() {
+ return m_desktop != null ? m_desktop : m_virtualDesktop;
+ }
+
+ @Override
+ public IDesktop getDesktop() {
+ return m_desktop;
+ }
+
+ @Override
+ public void setDesktop(IDesktop a) throws ProcessingException {
+ if (a == null) {
+ throw new IllegalArgumentException("argument must not be null");
+ }
+ if (m_desktop != null) {
+ throw new IllegalStateException("desktop is active");
+ }
+ m_desktop = a;
+ if (m_desktop != null) {
+ if (m_virtualDesktop != null) {
+ for (DesktopListener listener : m_virtualDesktop.getDesktopListeners()) {
+ m_desktop.addDesktopListener(listener);
+ }
+ for (Map.Entry<String, EventListenerList> e : m_virtualDesktop.getPropertyChangeListenerMap().entrySet()) {
+ String propName = e.getKey();
+ EventListenerList list = e.getValue();
+ if (propName == null) {
+ for (PropertyChangeListener listener : list.getListeners(PropertyChangeListener.class)) {
+ m_desktop.addPropertyChangeListener(listener);
+ }
+ }
+ else {
+ for (PropertyChangeListener listener : list.getListeners(PropertyChangeListener.class)) {
+ m_desktop.addPropertyChangeListener(propName, listener);
+ }
+ }
+ }
+ for (Map.Entry<Object, EventListenerList> e : m_virtualDesktop.getDataChangeListenerMap().entrySet()) {
+ Object dataType = e.getKey();
+ EventListenerList list = e.getValue();
+ if (dataType == null) {
+ for (DataChangeListener listener : list.getListeners(DataChangeListener.class)) {
+ m_desktop.addDataChangeListener(listener);
+ }
+ }
+ else {
+ for (DataChangeListener listener : list.getListeners(DataChangeListener.class)) {
+ m_desktop.addDataChangeListener(listener, dataType);
+ }
+ }
+ }
+ m_virtualDesktop = null;
+ }
+ m_desktop.initDesktop();
+ }
+ else {
+ m_virtualDesktop = new VirtualDesktop();
+ }
+ }
+
+ /**
+ * Close the session
+ */
+ @Override
+ public void stopSession() {
+ stopSession(IApplication.EXIT_OK);
+ }
+
+ @Override
+ public void stopSession(int exitCode) {
+ m_exitCode = exitCode;
+ try {
+ execStoreSession();
+ }
+ catch (Throwable t) {
+ LOG.error("store session", t);
+ }
+ if (m_desktop != null) {
+ try {
+ m_desktop.closeInternal();
+ }
+ catch (Throwable t) {
+ LOG.error("close desktop", t);
+ }
+ m_desktop = null;
+ }
+ if (!m_localeListener.isEmpty()) {
+ m_localeListener.clear();
+ }
+ try {
+ if (getServiceTunnel() != null) {
+ SERVICES.getService(ILogoutService.class).logout();
+ }
+ }
+ catch (Throwable t) {
+ LOG.info("logout on server", t);
+ }
+ m_clientSessionData.clear();
+ setActive(false);
+ if (LOG.isInfoEnabled()) {
+ LOG.info("end session event loop");
+ }
+ }
+
+ @Override
+ public int getExitCode() {
+ return m_exitCode;
+ }
+
+ @Override
+ public IServiceTunnel getServiceTunnel() {
+ return m_serviceTunnel;
+ }
+
+ protected void setServiceTunnel(IServiceTunnel tunnel) {
+ m_serviceTunnel = tunnel;
+ }
+
+ @Override
+ public IMemoryPolicy getMemoryPolicy() {
+ return m_memoryPolicy;
+ }
+
+ @Override
+ public void setMemoryPolicy(IMemoryPolicy p) {
+ if (m_memoryPolicy != null) {
+ m_memoryPolicy.removeNotify();
+ }
+ m_memoryPolicy = p;
+ if (m_memoryPolicy != null) {
+ m_memoryPolicy.addNotify();
+ }
+ }
+
+ public void goOnline() throws ProcessingException {
+ if (OfflineState.isOfflineDefault()) {
+ OfflineState.setOfflineDefault(false);
+ }
+ }
+
+ @Override
+ public void goOffline() throws ProcessingException {
+ Preferences pref = SERVICES.getService(IUserPreferencesStorageService.class).loadPreferences();
+ if (getUserId() != null) {
+ if (OfflineState.isOnlineDefault()) {
+ try {
+ pref.put("offline.user", getUserId());
+ pref.flush();
+ pref.sync();
+ }
+ catch (BackingStoreException e) {
+ LOG.error("Could not write userId to preferences!");
+ }
+ }
+ }
+ // create new backend subject
+ String offlineUser = pref.get("offline.user", "anonymous");
+ m_offlineSubject = new Subject();
+ m_offlineSubject.getPrincipals().add(new SimplePrincipal(offlineUser));
+ OfflineState.setOfflineDefault(true);
+ }
+
+ @Override
+ @SuppressWarnings("deprecation")
+ public boolean isWebSession() {
+ return isSingleThreadSession();
+ }
+
+ @Override
+ public boolean isSingleThreadSession() {
+ return m_singleThreadSession;
+ }
+
+ @Override
+ public String getVirtualSessionId() {
+ return m_virtualSessionId;
+ }
+
+ @Override
+ public void setVirtualSessionId(String sessionId) {
+ m_virtualSessionId = sessionId;
+ }
+
+ @Override
+ public Subject getSubject() {
+ return m_subject;
+ }
+
+ @Override
+ public void setSubject(Subject subject) {
+ m_subject = subject;
+ }
+
+ protected IIconLocator createIconLocator() {
+ return new IconLocator(this);
+ }
+
+ @Override
+ public IIconLocator getIconLocator() {
+ return m_iconLocator;
+ }
+
+ @Override
+ public void setData(String key, Object data) {
+ if (data == null) {
+ m_clientSessionData.remove(key);
+ }
+ else {
+ m_clientSessionData.put(key, data);
+ }
+ }
+
+ @Override
+ public Object getData(String key) {
+ return m_clientSessionData.get(key);
+ }
+
+ @Override
+ public UserAgent getUserAgent() {
+ if (m_userAgent == null) {
+ LOG.warn("UserAgent has not been initialied correctly. Using default.");
+ m_userAgent = UserAgent.createDefault();
+ }
+ return m_userAgent;
+ }
+
+ @Override
+ public void setUserAgent(UserAgent userAgent) {
+ m_userAgent = userAgent;
+ }
+
+ @Override
+ public void addLocaleListener(ILocaleListener listener) {
+ m_localeListener.add(listener);
+ }
+
+ @Override
+ public void removeLocaleListener(ILocaleListener listener) {
+ m_localeListener.remove(listener);
+ }
+
+ protected void notifyLocaleListeners(Locale locale) {
+ LocaleChangeEvent event = new LocaleChangeEvent(this, locale);
+ Iterator it = ((Vector) m_localeListener.clone()).iterator();
+ while (it.hasNext()) {
+ ILocaleListener listener = (ILocaleListener) it.next();
+ listener.localeChanged(event);
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/AbstractMemoryPolicy.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/AbstractMemoryPolicy.java
index 2adbe740cc..3e1c180797 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/AbstractMemoryPolicy.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/AbstractMemoryPolicy.java
@@ -1,271 +1,271 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client;
-
-import java.util.Date;
-import java.util.WeakHashMap;
-import java.util.zip.CRC32;
-
-import org.eclipse.scout.commons.beans.FastBeanInfo;
-import org.eclipse.scout.commons.beans.FastPropertyDescriptor;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.basic.table.columnfilter.TableColumnFilterEvent;
-import org.eclipse.scout.rt.client.ui.basic.table.columnfilter.TableColumnFilterListener;
-import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
-import org.eclipse.scout.rt.client.ui.form.FormEvent;
-import org.eclipse.scout.rt.client.ui.form.FormListener;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.client.ui.form.fields.pagefield.AbstractPageField;
-import org.eclipse.scout.rt.shared.services.common.jdbc.SearchFilter;
-
-public class AbstractMemoryPolicy implements IMemoryPolicy {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractMemoryPolicy.class);
-
- public static class SearchFormState {
- final String formContentXml;
- final SearchFilter searchFilter;
-
- public SearchFormState(String xml, SearchFilter filter) {
- formContentXml = xml;
- searchFilter = filter;
- }
- }
-
- private boolean m_active;
- private final WeakHashMap<IForm, String> m_formToIdentifierMap;
- private final WeakHashMap<ITable, String> m_tableToIdentifierMap;
-
- private final FormListener m_formListener = new FormListener() {
- @Override
- public void formChanged(FormEvent e) throws ProcessingException {
- //auto-detach
- if (!m_active) {
- e.getForm().removeFormListener(m_formListener);
- return;
- }
- String id = m_formToIdentifierMap.get(e.getForm());
- if (id != null) {
- try {
- handlePageFormEvent(e, id);
- }
- catch (Throwable t) {
- LOG.warn("page form event " + e, t);
- }
- }
- }
- };
-
- private final TableColumnFilterListener m_tableColumnFilterListener = new TableColumnFilterListener() {
- @Override
- public void tableColumnFilterChanged(TableColumnFilterEvent e) throws ProcessingException {
- if (!m_active) {
- e.getColumnFilterManager().removeListener(m_tableColumnFilterListener);
- return;
- }
- String id = m_tableToIdentifierMap.get(e.getTable());
- if (id != null) {
- try {
- handleTableFilterEvent(e, id);
- }
- catch (Throwable t) {
- LOG.warn("table filter event " + e, t);
- }
- }
- }
- };
-
- public AbstractMemoryPolicy() {
- m_formToIdentifierMap = new WeakHashMap<IForm, String>();
- m_tableToIdentifierMap = new WeakHashMap<ITable, String>();
- }
-
- @Override
- public void addNotify() {
- m_active = true;
- }
-
- @Override
- public void removeNotify() {
- m_active = false;
- }
-
- /**
- * Attaches listener on page contents
- */
- @Override
- public void pageCreated(IPage p) throws ProcessingException {
- if (p.getOutline() instanceof AbstractPageField.SimpleOutline) {
- return;
- }
- if (p instanceof IPageWithTable) {
- IPageWithTable<? extends ITable> pt = (IPageWithTable<?>) p;
- ITable table = pt.getTable();
- if (table != null) {
- String pageTableIdentifier = registerPageTable(pt, table);
- if (pageTableIdentifier != null) {
- loadColumnFilterState(table, pageTableIdentifier);
- }
- }
- }
- }
-
- @Override
- public void pageSearchFormStarted(IPageWithTable<?> p) throws ProcessingException {
- if (p.getOutline() instanceof AbstractPageField.SimpleOutline) {
- return;
- }
- IForm f = p.getSearchFormInternal();
- if (f != null) {
- String pageFormIdentifier = registerPageForm(p, f);
- if (f.isFormOpen()) {
- loadSearchFormState(f, pageFormIdentifier);
- }
- }
- }
-
- /**
- * @return the identifier for the page form
- */
- protected String registerPageForm(IPage p, IForm f) {
- String id = createUniqueIdForPage(p, f);
- m_formToIdentifierMap.put(f, id);
- f.removeFormListener(m_formListener);
- f.addFormListener(m_formListener);
- return id;
- }
-
- /**
- * @return the identifier for the page table or <code>null</code> if the table does not have a column filter manager.
- */
- protected String registerPageTable(IPage p, ITable t) {
- if (t.getColumnFilterManager() == null) {
- return null;
- }
- String id = createUniqueIdForPage(p, t);
- m_tableToIdentifierMap.put(t, id);
- t.getColumnFilterManager().removeListener(m_tableColumnFilterListener);
- t.getColumnFilterManager().addListener(m_tableColumnFilterListener);
- return id;
- }
-
- protected String createUniqueIdForPage(IPage p, Object o) {
- if (p == null) {
- return null;
- }
- StringBuilder builder = new StringBuilder();
- createIdForPage(builder, p, o);
- IPage page = p.getParentPage();
- while (page != null) {
- createIdForPage(builder, page, null);
- page = page.getParentPage();
- }
- CRC32 crc = new CRC32();
- crc.update(builder.toString().getBytes());
- return "" + crc.getValue();
- }
-
- private void createIdForPage(StringBuilder b, IPage page, Object o) {
- b.append("/");
- b.append(page.getClass().getName());
- if (page.getUserPreferenceContext() != null) {
- b.append("/");
- b.append(page.getUserPreferenceContext());
- }
- if (o != null) {
- b.append("/");
- b.append(o.getClass().getName());
- }
- FastBeanInfo pi = new FastBeanInfo(page.getClass(), page.getClass().getSuperclass());
- for (FastPropertyDescriptor prop : pi.getPropertyDescriptors()) {
- if (prop.getReadMethod() != null &&
- (Date.class.isAssignableFrom(prop.getPropertyType()) ||
- Number.class.isAssignableFrom(prop.getPropertyType()) ||
- String.class.isAssignableFrom(prop.getPropertyType()) ||
- long.class.isAssignableFrom(prop.getPropertyType()))) {
- // only accept Numbers, Strings or Dates
- try {
- b.append("/");
- b.append(prop.getName());
- b.append("=");
- b.append(prop.getReadMethod().invoke(page, new Object[0]));
- }
- catch (Exception e) {
- e.printStackTrace();
- // nop - ignore this property
- }
- }
- }
- }
-
- protected void handlePageFormEvent(FormEvent e, String pageFormIdentifier) throws ProcessingException {
- switch (e.getType()) {
- case FormEvent.TYPE_LOAD_COMPLETE: {
- //store form state since it was probably reset
- storeSearchFormState(e.getForm(), pageFormIdentifier);
- break;
- }
- case FormEvent.TYPE_STORE_AFTER: {
- storeSearchFormState(e.getForm(), pageFormIdentifier);
- break;
- }
- }
- }
-
- protected void loadSearchFormState(IForm f, String pageFormIdentifier) throws ProcessingException {
- //nop
- }
-
- protected void storeSearchFormState(IForm f, String pageFormIdentifier) throws ProcessingException {
- //nop
- }
-
- protected void handleTableFilterEvent(TableColumnFilterEvent e, String id) throws ProcessingException {
- switch (e.getType()) {
- case TableColumnFilterEvent.TYPE_FILTER_ADDED:
- case TableColumnFilterEvent.TYPE_FILTER_CHANGED:
- case TableColumnFilterEvent.TYPE_FILTER_REMOVED:
- case TableColumnFilterEvent.TYPE_FILTERS_RESET:
- storeColumnFilterState(e.getTable(), id);
- break;
- }
-
- }
-
- protected void storeColumnFilterState(ITable t, String pageTableIdentifier) throws ProcessingException {
- // nop
- }
-
- protected void loadColumnFilterState(ITable t, String pageTableIdentifier) throws ProcessingException {
- // nop
- }
-
- @Override
- public void afterOutlineSelectionChanged(final IDesktop desktop) {
- }
-
- @Override
- public void beforeTablePageLoadData(IPageWithTable<?> page) {
- }
-
- @Override
- public void afterTablePageLoadData(IPageWithTable<?> page) {
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client;
+
+import java.util.Date;
+import java.util.WeakHashMap;
+import java.util.zip.CRC32;
+
+import org.eclipse.scout.commons.beans.FastBeanInfo;
+import org.eclipse.scout.commons.beans.FastPropertyDescriptor;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.basic.table.columnfilter.TableColumnFilterEvent;
+import org.eclipse.scout.rt.client.ui.basic.table.columnfilter.TableColumnFilterListener;
+import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
+import org.eclipse.scout.rt.client.ui.form.FormEvent;
+import org.eclipse.scout.rt.client.ui.form.FormListener;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.client.ui.form.fields.pagefield.AbstractPageField;
+import org.eclipse.scout.rt.shared.services.common.jdbc.SearchFilter;
+
+public class AbstractMemoryPolicy implements IMemoryPolicy {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractMemoryPolicy.class);
+
+ public static class SearchFormState {
+ final String formContentXml;
+ final SearchFilter searchFilter;
+
+ public SearchFormState(String xml, SearchFilter filter) {
+ formContentXml = xml;
+ searchFilter = filter;
+ }
+ }
+
+ private boolean m_active;
+ private final WeakHashMap<IForm, String> m_formToIdentifierMap;
+ private final WeakHashMap<ITable, String> m_tableToIdentifierMap;
+
+ private final FormListener m_formListener = new FormListener() {
+ @Override
+ public void formChanged(FormEvent e) throws ProcessingException {
+ //auto-detach
+ if (!m_active) {
+ e.getForm().removeFormListener(m_formListener);
+ return;
+ }
+ String id = m_formToIdentifierMap.get(e.getForm());
+ if (id != null) {
+ try {
+ handlePageFormEvent(e, id);
+ }
+ catch (Throwable t) {
+ LOG.warn("page form event " + e, t);
+ }
+ }
+ }
+ };
+
+ private final TableColumnFilterListener m_tableColumnFilterListener = new TableColumnFilterListener() {
+ @Override
+ public void tableColumnFilterChanged(TableColumnFilterEvent e) throws ProcessingException {
+ if (!m_active) {
+ e.getColumnFilterManager().removeListener(m_tableColumnFilterListener);
+ return;
+ }
+ String id = m_tableToIdentifierMap.get(e.getTable());
+ if (id != null) {
+ try {
+ handleTableFilterEvent(e, id);
+ }
+ catch (Throwable t) {
+ LOG.warn("table filter event " + e, t);
+ }
+ }
+ }
+ };
+
+ public AbstractMemoryPolicy() {
+ m_formToIdentifierMap = new WeakHashMap<IForm, String>();
+ m_tableToIdentifierMap = new WeakHashMap<ITable, String>();
+ }
+
+ @Override
+ public void addNotify() {
+ m_active = true;
+ }
+
+ @Override
+ public void removeNotify() {
+ m_active = false;
+ }
+
+ /**
+ * Attaches listener on page contents
+ */
+ @Override
+ public void pageCreated(IPage p) throws ProcessingException {
+ if (p.getOutline() instanceof AbstractPageField.SimpleOutline) {
+ return;
+ }
+ if (p instanceof IPageWithTable) {
+ IPageWithTable<? extends ITable> pt = (IPageWithTable<?>) p;
+ ITable table = pt.getTable();
+ if (table != null) {
+ String pageTableIdentifier = registerPageTable(pt, table);
+ if (pageTableIdentifier != null) {
+ loadColumnFilterState(table, pageTableIdentifier);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void pageSearchFormStarted(IPageWithTable<?> p) throws ProcessingException {
+ if (p.getOutline() instanceof AbstractPageField.SimpleOutline) {
+ return;
+ }
+ IForm f = p.getSearchFormInternal();
+ if (f != null) {
+ String pageFormIdentifier = registerPageForm(p, f);
+ if (f.isFormOpen()) {
+ loadSearchFormState(f, pageFormIdentifier);
+ }
+ }
+ }
+
+ /**
+ * @return the identifier for the page form
+ */
+ protected String registerPageForm(IPage p, IForm f) {
+ String id = createUniqueIdForPage(p, f);
+ m_formToIdentifierMap.put(f, id);
+ f.removeFormListener(m_formListener);
+ f.addFormListener(m_formListener);
+ return id;
+ }
+
+ /**
+ * @return the identifier for the page table or <code>null</code> if the table does not have a column filter manager.
+ */
+ protected String registerPageTable(IPage p, ITable t) {
+ if (t.getColumnFilterManager() == null) {
+ return null;
+ }
+ String id = createUniqueIdForPage(p, t);
+ m_tableToIdentifierMap.put(t, id);
+ t.getColumnFilterManager().removeListener(m_tableColumnFilterListener);
+ t.getColumnFilterManager().addListener(m_tableColumnFilterListener);
+ return id;
+ }
+
+ protected String createUniqueIdForPage(IPage p, Object o) {
+ if (p == null) {
+ return null;
+ }
+ StringBuilder builder = new StringBuilder();
+ createIdForPage(builder, p, o);
+ IPage page = p.getParentPage();
+ while (page != null) {
+ createIdForPage(builder, page, null);
+ page = page.getParentPage();
+ }
+ CRC32 crc = new CRC32();
+ crc.update(builder.toString().getBytes());
+ return "" + crc.getValue();
+ }
+
+ private void createIdForPage(StringBuilder b, IPage page, Object o) {
+ b.append("/");
+ b.append(page.getClass().getName());
+ if (page.getUserPreferenceContext() != null) {
+ b.append("/");
+ b.append(page.getUserPreferenceContext());
+ }
+ if (o != null) {
+ b.append("/");
+ b.append(o.getClass().getName());
+ }
+ FastBeanInfo pi = new FastBeanInfo(page.getClass(), page.getClass().getSuperclass());
+ for (FastPropertyDescriptor prop : pi.getPropertyDescriptors()) {
+ if (prop.getReadMethod() != null &&
+ (Date.class.isAssignableFrom(prop.getPropertyType()) ||
+ Number.class.isAssignableFrom(prop.getPropertyType()) ||
+ String.class.isAssignableFrom(prop.getPropertyType()) ||
+ long.class.isAssignableFrom(prop.getPropertyType()))) {
+ // only accept Numbers, Strings or Dates
+ try {
+ b.append("/");
+ b.append(prop.getName());
+ b.append("=");
+ b.append(prop.getReadMethod().invoke(page, new Object[0]));
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ // nop - ignore this property
+ }
+ }
+ }
+ }
+
+ protected void handlePageFormEvent(FormEvent e, String pageFormIdentifier) throws ProcessingException {
+ switch (e.getType()) {
+ case FormEvent.TYPE_LOAD_COMPLETE: {
+ //store form state since it was probably reset
+ storeSearchFormState(e.getForm(), pageFormIdentifier);
+ break;
+ }
+ case FormEvent.TYPE_STORE_AFTER: {
+ storeSearchFormState(e.getForm(), pageFormIdentifier);
+ break;
+ }
+ }
+ }
+
+ protected void loadSearchFormState(IForm f, String pageFormIdentifier) throws ProcessingException {
+ //nop
+ }
+
+ protected void storeSearchFormState(IForm f, String pageFormIdentifier) throws ProcessingException {
+ //nop
+ }
+
+ protected void handleTableFilterEvent(TableColumnFilterEvent e, String id) throws ProcessingException {
+ switch (e.getType()) {
+ case TableColumnFilterEvent.TYPE_FILTER_ADDED:
+ case TableColumnFilterEvent.TYPE_FILTER_CHANGED:
+ case TableColumnFilterEvent.TYPE_FILTER_REMOVED:
+ case TableColumnFilterEvent.TYPE_FILTERS_RESET:
+ storeColumnFilterState(e.getTable(), id);
+ break;
+ }
+
+ }
+
+ protected void storeColumnFilterState(ITable t, String pageTableIdentifier) throws ProcessingException {
+ // nop
+ }
+
+ protected void loadColumnFilterState(ITable t, String pageTableIdentifier) throws ProcessingException {
+ // nop
+ }
+
+ @Override
+ public void afterOutlineSelectionChanged(final IDesktop desktop) {
+ }
+
+ @Override
+ public void beforeTablePageLoadData(IPageWithTable<?> page) {
+ }
+
+ @Override
+ public void afterTablePageLoadData(IPageWithTable<?> page) {
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName();
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/Activator.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/Activator.java
index 9c889959ed..631c5211b2 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/Activator.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/Activator.java
@@ -1,44 +1,44 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client;
-
-import org.eclipse.core.runtime.Plugin;
-import org.osgi.framework.BundleContext;
-
-public class Activator extends Plugin {
- public static final String PLUGIN_ID = "org.eclipse.scout.rt.client";
- private static Activator plugin;
-
- public static Activator getDefault() {
- return plugin;
- }
-
- /*
- * (non-Javadoc)
- * @see
- * org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
- */
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+public class Activator extends Plugin {
+ public static final String PLUGIN_ID = "org.eclipse.scout.rt.client";
+ private static Activator plugin;
+
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
+ * org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/BlockingCondition.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/BlockingCondition.java
index 1243a891f1..d5ecfb9da3 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/BlockingCondition.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/BlockingCondition.java
@@ -1,87 +1,87 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client;
-
-import java.util.ArrayList;
-
-import org.eclipse.core.runtime.jobs.Job;
-
-/**
- * Use this object to put the current job into waiting mode until the blocking
- * condition falls. see {@link ClientSyncJob}
- */
-public class BlockingCondition {
- private boolean m_blocking = true;
- private ArrayList<ClientJob> m_blockingJobs;
-
- public BlockingCondition(boolean b) {
- m_blocking = b;
- m_blockingJobs = new ArrayList<ClientJob>();
- }
-
- public boolean isBlocking() {
- return m_blocking;
- }
-
- public void setBlocking(boolean b) {
- if (m_blocking != b) {
- if (b) {
- synchronized (this) {
- m_blocking = true;
- }
- }
- else {
- release();
- }
- }
- }
-
- public void waitFor() throws InterruptedException {
- ClientJob c = null;
- synchronized (this) {
- if (m_blocking) {
- Job j = ClientJob.getJobManager().currentJob();
- if (j instanceof ClientJob) {
- c = (ClientJob) j;
- m_blockingJobs.add(c);
- }
- else {
- while (m_blocking) {
- wait();
- }
- return;
- }
- }
- }
- // outside sync
- if (c != null) {
- c.waitFor();
- }
- }
-
- public void release() {
- synchronized (this) {
- if (m_blocking) {
- m_blocking = false;
- notifyAll();
- for (ClientJob c : m_blockingJobs) {
- try {
- c.releaseWaitFor();
- }
- catch (Throwable t) {
- t.printStackTrace();
- }
- }
- m_blockingJobs.clear();
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.runtime.jobs.Job;
+
+/**
+ * Use this object to put the current job into waiting mode until the blocking
+ * condition falls. see {@link ClientSyncJob}
+ */
+public class BlockingCondition {
+ private boolean m_blocking = true;
+ private ArrayList<ClientJob> m_blockingJobs;
+
+ public BlockingCondition(boolean b) {
+ m_blocking = b;
+ m_blockingJobs = new ArrayList<ClientJob>();
+ }
+
+ public boolean isBlocking() {
+ return m_blocking;
+ }
+
+ public void setBlocking(boolean b) {
+ if (m_blocking != b) {
+ if (b) {
+ synchronized (this) {
+ m_blocking = true;
+ }
+ }
+ else {
+ release();
+ }
+ }
+ }
+
+ public void waitFor() throws InterruptedException {
+ ClientJob c = null;
+ synchronized (this) {
+ if (m_blocking) {
+ Job j = ClientJob.getJobManager().currentJob();
+ if (j instanceof ClientJob) {
+ c = (ClientJob) j;
+ m_blockingJobs.add(c);
+ }
+ else {
+ while (m_blocking) {
+ wait();
+ }
+ return;
+ }
+ }
+ }
+ // outside sync
+ if (c != null) {
+ c.waitFor();
+ }
+ }
+
+ public void release() {
+ synchronized (this) {
+ if (m_blocking) {
+ m_blocking = false;
+ notifyAll();
+ for (ClientJob c : m_blockingJobs) {
+ try {
+ c.releaseWaitFor();
+ }
+ catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+ m_blockingJobs.clear();
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ClientAsyncJob.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ClientAsyncJob.java
index bd7b18b044..2857716566 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ClientAsyncJob.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ClientAsyncJob.java
@@ -1,53 +1,53 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client;
-
-/**
- * <p>
- * Convenience for a job operating on a {@link IClientSession} which is not synchronized and does not block other job
- * operating on the same session.
- * </p>
- * <p>
- * Normally this kind of job is used for read-only ui operations in the background, be careful when performing
- * concurrent and parallel processing on a session.
- * </p>
- * see {@link ClientJob}
- */
-public class ClientAsyncJob extends ClientJob {
-
- /**
- * see {@link ClientJob#ClientJob(String, IClientSession, boolean)}
- */
- public ClientAsyncJob(String name, IClientSession session) {
- this(name, session, true);
- }
-
- /**
- * see {@link ClientJob#ClientJob(String, IClientSession, boolean, boolean)}
- */
- public ClientAsyncJob(String name, IClientSession session, boolean system) {
- super(name, session, false, system);
- }
-
- /**
- * {@link ClientAsyncJob}s belong to the family of type {@link ClientJob}.class and {@link ClientAsyncJob}.class
- */
- @Override
- public boolean belongsTo(Object family) {
- if (super.belongsTo(family)) {
- return true;
- }
- if (family == ClientAsyncJob.class) {
- return true;
- }
- return false;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client;
+
+/**
+ * <p>
+ * Convenience for a job operating on a {@link IClientSession} which is not synchronized and does not block other job
+ * operating on the same session.
+ * </p>
+ * <p>
+ * Normally this kind of job is used for read-only ui operations in the background, be careful when performing
+ * concurrent and parallel processing on a session.
+ * </p>
+ * see {@link ClientJob}
+ */
+public class ClientAsyncJob extends ClientJob {
+
+ /**
+ * see {@link ClientJob#ClientJob(String, IClientSession, boolean)}
+ */
+ public ClientAsyncJob(String name, IClientSession session) {
+ this(name, session, true);
+ }
+
+ /**
+ * see {@link ClientJob#ClientJob(String, IClientSession, boolean, boolean)}
+ */
+ public ClientAsyncJob(String name, IClientSession session, boolean system) {
+ super(name, session, false, system);
+ }
+
+ /**
+ * {@link ClientAsyncJob}s belong to the family of type {@link ClientJob}.class and {@link ClientAsyncJob}.class
+ */
+ @Override
+ public boolean belongsTo(Object family) {
+ if (super.belongsTo(family)) {
+ return true;
+ }
+ if (family == ClientAsyncJob.class) {
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ClientJob.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ClientJob.java
index 7db72328c6..b3c1372fd6 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ClientJob.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ClientJob.java
@@ -1,342 +1,342 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client;
-
-import java.util.ArrayList;
-import java.util.Locale;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.IJobChangeEvent;
-import org.eclipse.core.runtime.jobs.IJobManager;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.scout.commons.EventListenerList;
-import org.eclipse.scout.commons.LocaleThreadLocal;
-import org.eclipse.scout.commons.job.JobEx;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.TextsThreadLocal;
-
-/**
- * Job operating on a {@link IClientSession} Job may be sync or async. Sync jobs
- * use the {@link ClientRule}, async don't. Be careful when using async jobs and
- * use it only read-only. When using a {@link BlockingCondition} to wait on, the
- * lock is released during the blocking wait and re-acquired after. see {@link ClientSyncJob} and {@link ClientAsyncJob}
- */
-public class ClientJob extends JobEx implements IClientSessionProvider {
- private final IClientSession m_session;
- private final EventListenerList m_listeners;
- private final Object m_waitForLock;
- private boolean m_waitFor;
-
- /**
- * @param name
- * job name
- * @param session
- * {@link IClientSession} in which the job is running
- * @param sync
- * if true then {@link IClientSession#getJobSyncLock()} is acquired
- * to run the job, if false the job runs without lock (careful,
- * read-only-mode recommended)
- */
- public ClientJob(String name, IClientSession session, boolean sync) {
- this(name, session, sync, true);
- }
-
- /**
- * @param name
- * job name
- * @param session
- * {@link IClientSession} in which the job is running
- * @param sync
- * if true then {@link IClientSession#getJobSyncLock()} is acquired
- * to run the job, if false the job runs without lock (careful,
- * read-only-mode recommended)
- * @param system
- * see {@link Job#setSystem(boolean)}
- */
- public ClientJob(String name, IClientSession session, boolean sync, boolean system) {
- super(name);
- if (session == null) {
- throw new IllegalArgumentException("session is null");
- }
- m_session = session;
- m_listeners = new EventListenerList();
- setUser(false);
- setSystem(system);
- m_waitForLock = new Object();
- if (sync) {
- setRule(new ClientRule(session));
- }
- }
-
- @Override
- public IClientSession getClientSession() {
- return m_session;
- }
-
- /**
- * {@link ClientJob}s belong to the family of type {@link ClientJob}.class
- */
- @Override
- public boolean belongsTo(Object family) {
- if (family == ClientJob.class) {
- return true;
- }
- return false;
- }
-
- /**
- * @return whether the job is running with the {@link ClientRule} and
- * therefore runs in sequence with other jobs on the same session
- */
- public final boolean isSync() {
- return getRule() instanceof ClientRule;
- }
-
- /**
- * Set whether the job is running with the {@link ClientRule} and therefore
- * runs in sequence with other jobs on the same session. This method can only
- * be called before the job is scheduled
- */
- public final void setSync(boolean sync) {
- if (sync != isSync()) {
- if (getState() != NONE) {
- throw new IllegalStateException("sync property cannot be changed once the job is scheduled");
- }
- //
- if (sync) {
- setRule(new ClientRule(m_session));
- }
- else {
- setRule(null);
- }
- }
- }
-
- public final boolean isWaitFor() {
- return m_waitFor;
- }
-
- @Override
- public boolean shouldSchedule() {
- if (getClientSession() != null && getClientSession().isSingleThreadSession()) {
- runNow(new NullProgressMonitor());
- return false;
- }
- else {
- return super.shouldSchedule();
- }
- }
-
- /**
- * {@inheritDoc}
- * <p/>
- * <h1><b>Warning:</b></h1> Do not override this method. It will be changed to final in a subsequent release. Override
- * {@link #runStatus(IProgressMonitor)} instead.
- */
- @Override
- protected final IStatus run(IProgressMonitor monitor) {
- return runTransactionWrapper(monitor);
- }
-
- private IStatus runTransactionWrapper(IProgressMonitor monitor) {
- Locale oldLocale = LocaleThreadLocal.get();
- ScoutTexts oldTexts = TextsThreadLocal.get();
- IClientSession oldSession = ClientSessionThreadLocal.get();
- try {
- ClientSessionThreadLocal.set(getClientSession());
- LocaleThreadLocal.set(m_session.getLocale());
- TextsThreadLocal.set(m_session.getTexts());
- //
- return runStatus(monitor);
- }
- finally {
- ClientSessionThreadLocal.set(oldSession);
- LocaleThreadLocal.set(oldLocale);
- TextsThreadLocal.set(oldTexts);
- }
- }
-
- /**
- * Executes this job. The session's locale is accessible through {@link LocaleThreadLocal}.
- *
- * @see #run(IProgressMonitor)
- */
- protected IStatus runStatus(IProgressMonitor monitor) {
- try {
- runVoid(monitor);
- return Status.OK_STATUS;
- }
- catch (Throwable t) {
- return new Status(Status.ERROR, "<none>", 0, t.getMessage(), t);
- }
- }
-
- /**
- * Convenience that throws exceptions instead of returning a status
- */
- protected void runVoid(IProgressMonitor monitor) throws Throwable {
- }
-
- /**
- * Waits for the condition and blocks the execution of the current job.
- * Notifies job listeners with {@link IJobChangeListenerEx#blockingConditionStart(IJobChangeEvent)} and
- * {@link IJobChangeListenerEx#blockingConditionEnd(IJobChangeEvent)} about
- * the blocking condition.
- */
- void waitFor() throws InterruptedException {
- final ClientRule rule = (getRule() instanceof ClientRule ? (ClientRule) getRule() : null);
- //
- fireBlockingConditionStart();
-
- //Waking up the waiting jobs and wait() must be synchronized to avoid race conditions
- //which could happen if a waiting job wants to release the lock
- synchronized (m_waitForLock) {
- if (rule != null) {
- rule.setEnabled(false);
- rescheduleWaitingSyncJobs();
- }
- m_waitFor = true;
-
- m_waitForLock.wait();
- }
- m_waitFor = false;
- fireBlockingConditionEnd();
- // continue work
- }
-
- void releaseWaitFor() throws InterruptedException {
- final ClientRule rule = (getRule() instanceof ClientRule ? (ClientRule) getRule() : null);
- if (rule != null) {
- ClientSyncJob proxyJob = new ClientSyncJob("release waitFor lock on \"" + this + "\"", m_session) {
- @Override
- protected void runVoid(IProgressMonitor arg0) throws Throwable {
- rule.setEnabled(true);
- rescheduleWaitingSyncJobs();
- synchronized (m_waitForLock) {
- m_waitForLock.notifyAll();
- }
- }
- };
- proxyJob.schedule();
- }
- }
-
- private void rescheduleWaitingSyncJobs() {
- ArrayList<Job> jobList = new ArrayList<Job>();
- for (Job j : Job.getJobManager().find(ClientJob.class)) {
- if (j instanceof ClientJob) {
- ClientJob c = (ClientJob) j;
- if (c.isSync() && !c.isWaitFor()) {
- if (c.getState() == Job.WAITING) {
- jobList.add(j);
- }
- }
- }
- }
- for (int i = jobList.size() - 1; i >= 0; i--) {
- Job j = jobList.get(i);
- if (!j.sleep()) {
- jobList.remove(i);
- }
- }
- for (Job j : jobList) {
- j.wakeUp();
- }
- }
-
- public final void addJobChangeListenerEx(IJobChangeListenerEx listener) {
- addJobChangeListener(listener);
- m_listeners.add(IJobChangeListenerEx.class, listener);
- }
-
- public final void removeJobChangeListenerEx(IJobChangeListenerEx listener) {
- removeJobChangeListener(listener);
- m_listeners.remove(IJobChangeListenerEx.class, listener);
- }
-
- private void fireBlockingConditionStart() {
- JobChangeEventEx e = new JobChangeEventEx(this);
- for (IJobChangeListenerEx listener : m_listeners.getListeners(IJobChangeListenerEx.class)) {
- try {
- listener.blockingConditionStart(e);
- }
- catch (Throwable t) {
- t.printStackTrace();
- }
- }
- }
-
- private void fireBlockingConditionEnd() {
- JobChangeEventEx e = new JobChangeEventEx(this);
- for (IJobChangeListenerEx listener : m_listeners.getListeners(IJobChangeListenerEx.class)) {
- try {
- listener.blockingConditionEnd(e);
- }
- catch (Throwable t) {
- t.printStackTrace();
- }
- }
- }
-
- private static class JobChangeEventEx implements IJobChangeEvent {
- Job job = null;
-
- public JobChangeEventEx(Job job) {
- this.job = job;
- }
-
- @Override
- public long getDelay() {
- return 0L;
- }
-
- @Override
- public Job getJob() {
- return job;
- }
-
- @Override
- public IStatus getResult() {
- return null;
- }
- }
-
- /**
- * @return true if {@link IJobManager#currentJob()} is a {@link ClientJob} and {@link ClientJob#isSync()} is true
- */
- public static final boolean isSyncClientJob() {
- Job j = Job.getJobManager().currentJob();
- return (j instanceof ClientJob) && ((ClientJob) j).isSync();
- }
-
- /**
- * @return {@link ClientSessionThreadLocal#get()}
- */
- public static final IClientSession getCurrentSession() {
- return getCurrentSession(IClientSession.class);
- }
-
- /**
- * @return {@link ClientSessionThreadLocal#get()} and check if it matches the required type
- */
- @SuppressWarnings("unchecked")
- public static final <T extends IClientSession> T getCurrentSession(Class<T> type) {
- IClientSession s = ClientSessionThreadLocal.get();
- if (s != null && type.isAssignableFrom(s.getClass())) {
- return (T) s;
- }
- return null;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client;
+
+import java.util.ArrayList;
+import java.util.Locale;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.core.runtime.jobs.IJobManager;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.scout.commons.EventListenerList;
+import org.eclipse.scout.commons.LocaleThreadLocal;
+import org.eclipse.scout.commons.job.JobEx;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.TextsThreadLocal;
+
+/**
+ * Job operating on a {@link IClientSession} Job may be sync or async. Sync jobs
+ * use the {@link ClientRule}, async don't. Be careful when using async jobs and
+ * use it only read-only. When using a {@link BlockingCondition} to wait on, the
+ * lock is released during the blocking wait and re-acquired after. see {@link ClientSyncJob} and {@link ClientAsyncJob}
+ */
+public class ClientJob extends JobEx implements IClientSessionProvider {
+ private final IClientSession m_session;
+ private final EventListenerList m_listeners;
+ private final Object m_waitForLock;
+ private boolean m_waitFor;
+
+ /**
+ * @param name
+ * job name
+ * @param session
+ * {@link IClientSession} in which the job is running
+ * @param sync
+ * if true then {@link IClientSession#getJobSyncLock()} is acquired
+ * to run the job, if false the job runs without lock (careful,
+ * read-only-mode recommended)
+ */
+ public ClientJob(String name, IClientSession session, boolean sync) {
+ this(name, session, sync, true);
+ }
+
+ /**
+ * @param name
+ * job name
+ * @param session
+ * {@link IClientSession} in which the job is running
+ * @param sync
+ * if true then {@link IClientSession#getJobSyncLock()} is acquired
+ * to run the job, if false the job runs without lock (careful,
+ * read-only-mode recommended)
+ * @param system
+ * see {@link Job#setSystem(boolean)}
+ */
+ public ClientJob(String name, IClientSession session, boolean sync, boolean system) {
+ super(name);
+ if (session == null) {
+ throw new IllegalArgumentException("session is null");
+ }
+ m_session = session;
+ m_listeners = new EventListenerList();
+ setUser(false);
+ setSystem(system);
+ m_waitForLock = new Object();
+ if (sync) {
+ setRule(new ClientRule(session));
+ }
+ }
+
+ @Override
+ public IClientSession getClientSession() {
+ return m_session;
+ }
+
+ /**
+ * {@link ClientJob}s belong to the family of type {@link ClientJob}.class
+ */
+ @Override
+ public boolean belongsTo(Object family) {
+ if (family == ClientJob.class) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @return whether the job is running with the {@link ClientRule} and
+ * therefore runs in sequence with other jobs on the same session
+ */
+ public final boolean isSync() {
+ return getRule() instanceof ClientRule;
+ }
+
+ /**
+ * Set whether the job is running with the {@link ClientRule} and therefore
+ * runs in sequence with other jobs on the same session. This method can only
+ * be called before the job is scheduled
+ */
+ public final void setSync(boolean sync) {
+ if (sync != isSync()) {
+ if (getState() != NONE) {
+ throw new IllegalStateException("sync property cannot be changed once the job is scheduled");
+ }
+ //
+ if (sync) {
+ setRule(new ClientRule(m_session));
+ }
+ else {
+ setRule(null);
+ }
+ }
+ }
+
+ public final boolean isWaitFor() {
+ return m_waitFor;
+ }
+
+ @Override
+ public boolean shouldSchedule() {
+ if (getClientSession() != null && getClientSession().isSingleThreadSession()) {
+ runNow(new NullProgressMonitor());
+ return false;
+ }
+ else {
+ return super.shouldSchedule();
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ * <p/>
+ * <h1><b>Warning:</b></h1> Do not override this method. It will be changed to final in a subsequent release. Override
+ * {@link #runStatus(IProgressMonitor)} instead.
+ */
+ @Override
+ protected final IStatus run(IProgressMonitor monitor) {
+ return runTransactionWrapper(monitor);
+ }
+
+ private IStatus runTransactionWrapper(IProgressMonitor monitor) {
+ Locale oldLocale = LocaleThreadLocal.get();
+ ScoutTexts oldTexts = TextsThreadLocal.get();
+ IClientSession oldSession = ClientSessionThreadLocal.get();
+ try {
+ ClientSessionThreadLocal.set(getClientSession());
+ LocaleThreadLocal.set(m_session.getLocale());
+ TextsThreadLocal.set(m_session.getTexts());
+ //
+ return runStatus(monitor);
+ }
+ finally {
+ ClientSessionThreadLocal.set(oldSession);
+ LocaleThreadLocal.set(oldLocale);
+ TextsThreadLocal.set(oldTexts);
+ }
+ }
+
+ /**
+ * Executes this job. The session's locale is accessible through {@link LocaleThreadLocal}.
+ *
+ * @see #run(IProgressMonitor)
+ */
+ protected IStatus runStatus(IProgressMonitor monitor) {
+ try {
+ runVoid(monitor);
+ return Status.OK_STATUS;
+ }
+ catch (Throwable t) {
+ return new Status(Status.ERROR, "<none>", 0, t.getMessage(), t);
+ }
+ }
+
+ /**
+ * Convenience that throws exceptions instead of returning a status
+ */
+ protected void runVoid(IProgressMonitor monitor) throws Throwable {
+ }
+
+ /**
+ * Waits for the condition and blocks the execution of the current job.
+ * Notifies job listeners with {@link IJobChangeListenerEx#blockingConditionStart(IJobChangeEvent)} and
+ * {@link IJobChangeListenerEx#blockingConditionEnd(IJobChangeEvent)} about
+ * the blocking condition.
+ */
+ void waitFor() throws InterruptedException {
+ final ClientRule rule = (getRule() instanceof ClientRule ? (ClientRule) getRule() : null);
+ //
+ fireBlockingConditionStart();
+
+ //Waking up the waiting jobs and wait() must be synchronized to avoid race conditions
+ //which could happen if a waiting job wants to release the lock
+ synchronized (m_waitForLock) {
+ if (rule != null) {
+ rule.setEnabled(false);
+ rescheduleWaitingSyncJobs();
+ }
+ m_waitFor = true;
+
+ m_waitForLock.wait();
+ }
+ m_waitFor = false;
+ fireBlockingConditionEnd();
+ // continue work
+ }
+
+ void releaseWaitFor() throws InterruptedException {
+ final ClientRule rule = (getRule() instanceof ClientRule ? (ClientRule) getRule() : null);
+ if (rule != null) {
+ ClientSyncJob proxyJob = new ClientSyncJob("release waitFor lock on \"" + this + "\"", m_session) {
+ @Override
+ protected void runVoid(IProgressMonitor arg0) throws Throwable {
+ rule.setEnabled(true);
+ rescheduleWaitingSyncJobs();
+ synchronized (m_waitForLock) {
+ m_waitForLock.notifyAll();
+ }
+ }
+ };
+ proxyJob.schedule();
+ }
+ }
+
+ private void rescheduleWaitingSyncJobs() {
+ ArrayList<Job> jobList = new ArrayList<Job>();
+ for (Job j : Job.getJobManager().find(ClientJob.class)) {
+ if (j instanceof ClientJob) {
+ ClientJob c = (ClientJob) j;
+ if (c.isSync() && !c.isWaitFor()) {
+ if (c.getState() == Job.WAITING) {
+ jobList.add(j);
+ }
+ }
+ }
+ }
+ for (int i = jobList.size() - 1; i >= 0; i--) {
+ Job j = jobList.get(i);
+ if (!j.sleep()) {
+ jobList.remove(i);
+ }
+ }
+ for (Job j : jobList) {
+ j.wakeUp();
+ }
+ }
+
+ public final void addJobChangeListenerEx(IJobChangeListenerEx listener) {
+ addJobChangeListener(listener);
+ m_listeners.add(IJobChangeListenerEx.class, listener);
+ }
+
+ public final void removeJobChangeListenerEx(IJobChangeListenerEx listener) {
+ removeJobChangeListener(listener);
+ m_listeners.remove(IJobChangeListenerEx.class, listener);
+ }
+
+ private void fireBlockingConditionStart() {
+ JobChangeEventEx e = new JobChangeEventEx(this);
+ for (IJobChangeListenerEx listener : m_listeners.getListeners(IJobChangeListenerEx.class)) {
+ try {
+ listener.blockingConditionStart(e);
+ }
+ catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+ }
+
+ private void fireBlockingConditionEnd() {
+ JobChangeEventEx e = new JobChangeEventEx(this);
+ for (IJobChangeListenerEx listener : m_listeners.getListeners(IJobChangeListenerEx.class)) {
+ try {
+ listener.blockingConditionEnd(e);
+ }
+ catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+ }
+
+ private static class JobChangeEventEx implements IJobChangeEvent {
+ Job job = null;
+
+ public JobChangeEventEx(Job job) {
+ this.job = job;
+ }
+
+ @Override
+ public long getDelay() {
+ return 0L;
+ }
+
+ @Override
+ public Job getJob() {
+ return job;
+ }
+
+ @Override
+ public IStatus getResult() {
+ return null;
+ }
+ }
+
+ /**
+ * @return true if {@link IJobManager#currentJob()} is a {@link ClientJob} and {@link ClientJob#isSync()} is true
+ */
+ public static final boolean isSyncClientJob() {
+ Job j = Job.getJobManager().currentJob();
+ return (j instanceof ClientJob) && ((ClientJob) j).isSync();
+ }
+
+ /**
+ * @return {@link ClientSessionThreadLocal#get()}
+ */
+ public static final IClientSession getCurrentSession() {
+ return getCurrentSession(IClientSession.class);
+ }
+
+ /**
+ * @return {@link ClientSessionThreadLocal#get()} and check if it matches the required type
+ */
+ @SuppressWarnings("unchecked")
+ public static final <T extends IClientSession> T getCurrentSession(Class<T> type) {
+ IClientSession s = ClientSessionThreadLocal.get();
+ if (s != null && type.isAssignableFrom(s.getClass())) {
+ return (T) s;
+ }
+ return null;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ClientRule.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ClientRule.java
index 12fec4cc37..1610aa1be9 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ClientRule.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ClientRule.java
@@ -1,72 +1,72 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client;
-
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.scout.commons.beans.AbstractPropertyObserver;
-
-public class ClientRule extends AbstractPropertyObserver implements ISchedulingRule {
- private final IClientSession m_session;
- private boolean m_enabled = true;
-
- public ClientRule(IClientSession session) {
- m_session = session;
- }
-
- public IClientSession getClientSession() {
- return m_session;
- }
-
- public void setEnabled(boolean enabled) {
- m_enabled = enabled;
- }
-
- public boolean isEnabled() {
- return m_enabled;
- }
-
- @Override
- public int hashCode() {
- return m_session.hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- return obj == this;
- }
-
- @Override
- public boolean contains(ISchedulingRule rule) {
- if (this == rule) {
- return true;
- }
- //
- if (this.isEnabled() && rule instanceof ClientRule) {
- return (this.getClientSession() == ((ClientRule) rule).getClientSession());
- }
- //
- return false;
- }
-
- @Override
- public boolean isConflicting(ISchedulingRule rule) {
- if (this == rule) {
- return true;
- }
- //
- if (this.isEnabled() && rule instanceof ClientRule) {
- return (this.getClientSession() == ((ClientRule) rule).getClientSession());
- }
- //
- return false;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client;
+
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
+import org.eclipse.scout.commons.beans.AbstractPropertyObserver;
+
+public class ClientRule extends AbstractPropertyObserver implements ISchedulingRule {
+ private final IClientSession m_session;
+ private boolean m_enabled = true;
+
+ public ClientRule(IClientSession session) {
+ m_session = session;
+ }
+
+ public IClientSession getClientSession() {
+ return m_session;
+ }
+
+ public void setEnabled(boolean enabled) {
+ m_enabled = enabled;
+ }
+
+ public boolean isEnabled() {
+ return m_enabled;
+ }
+
+ @Override
+ public int hashCode() {
+ return m_session.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ return obj == this;
+ }
+
+ @Override
+ public boolean contains(ISchedulingRule rule) {
+ if (this == rule) {
+ return true;
+ }
+ //
+ if (this.isEnabled() && rule instanceof ClientRule) {
+ return (this.getClientSession() == ((ClientRule) rule).getClientSession());
+ }
+ //
+ return false;
+ }
+
+ @Override
+ public boolean isConflicting(ISchedulingRule rule) {
+ if (this == rule) {
+ return true;
+ }
+ //
+ if (this.isEnabled() && rule instanceof ClientRule) {
+ return (this.getClientSession() == ((ClientRule) rule).getClientSession());
+ }
+ //
+ return false;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ClientSessionThreadLocal.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ClientSessionThreadLocal.java
index b3367f31ec..ac2bbb87f3 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ClientSessionThreadLocal.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ClientSessionThreadLocal.java
@@ -1,30 +1,30 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client;
-
-/**
- * This class represents the client session for the current thread.
- */
-public final class ClientSessionThreadLocal {
- private static final ThreadLocal<IClientSession> THREAD_LOCAL = new ThreadLocal<IClientSession>();
-
- private ClientSessionThreadLocal() {
- }
-
- public static IClientSession get() {
- return THREAD_LOCAL.get();
- }
-
- public static void set(IClientSession l) {
- THREAD_LOCAL.set(l);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client;
+
+/**
+ * This class represents the client session for the current thread.
+ */
+public final class ClientSessionThreadLocal {
+ private static final ThreadLocal<IClientSession> THREAD_LOCAL = new ThreadLocal<IClientSession>();
+
+ private ClientSessionThreadLocal() {
+ }
+
+ public static IClientSession get() {
+ return THREAD_LOCAL.get();
+ }
+
+ public static void set(IClientSession l) {
+ THREAD_LOCAL.set(l);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ClientSyncJob.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ClientSyncJob.java
index 3a2d883c35..5424dc4ddd 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ClientSyncJob.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ClientSyncJob.java
@@ -1,47 +1,47 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client;
-
-/**
- * Convenience for job operating on a {@link IClientSession} which blocks all
- * other ClientJobs operating on the same session. see {@link ClientJob}
- */
-public class ClientSyncJob extends ClientJob {
-
- /**
- * see {@link ClientJob#ClientJob(String, IClientSession, boolean)}
- */
- public ClientSyncJob(String name, IClientSession session) {
- this(name, session, true);
- }
-
- /**
- * see {@link ClientJob#ClientJob(String, IClientSession, boolean, boolean)}
- */
- public ClientSyncJob(String name, IClientSession session, boolean system) {
- super(name, session, true, system);
- }
-
- /**
- * {@link ClientSyncJob}s belong to the family of type {@link ClientJob}.class and {@link ClientSyncJob}.class
- */
- @Override
- public boolean belongsTo(Object family) {
- if (super.belongsTo(family)) {
- return true;
- }
- if (family == ClientSyncJob.class) {
- return true;
- }
- return false;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client;
+
+/**
+ * Convenience for job operating on a {@link IClientSession} which blocks all
+ * other ClientJobs operating on the same session. see {@link ClientJob}
+ */
+public class ClientSyncJob extends ClientJob {
+
+ /**
+ * see {@link ClientJob#ClientJob(String, IClientSession, boolean)}
+ */
+ public ClientSyncJob(String name, IClientSession session) {
+ this(name, session, true);
+ }
+
+ /**
+ * see {@link ClientJob#ClientJob(String, IClientSession, boolean, boolean)}
+ */
+ public ClientSyncJob(String name, IClientSession session, boolean system) {
+ super(name, session, true, system);
+ }
+
+ /**
+ * {@link ClientSyncJob}s belong to the family of type {@link ClientJob}.class and {@link ClientSyncJob}.class
+ */
+ @Override
+ public boolean belongsTo(Object family) {
+ if (super.belongsTo(family)) {
+ return true;
+ }
+ if (family == ClientSyncJob.class) {
+ return true;
+ }
+ return false;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ForceGCJob.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ForceGCJob.java
index ffd360bab0..f4b4bffaee 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ForceGCJob.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ForceGCJob.java
@@ -1,41 +1,41 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-
-/**
- *
- */
-public class ForceGCJob extends ClientAsyncJob {
- boolean m_cancel = false;
-
- public ForceGCJob() {
- super("Release memory", ClientAsyncJob.getCurrentSession());
- setPriority(DECORATE);
- }
-
- @Override
- protected void runVoid(IProgressMonitor monitor) throws Throwable {
- int counter = 0;
- Thread.sleep(10000);
- while (counter < 7 && !m_cancel && (Runtime.getRuntime().freeMemory() > 30000000 || counter < 2)) {
- System.gc();
- counter++;
- Thread.sleep(10000);
- }
- }
-
- @Override
- protected void canceling() {
- m_cancel = true;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+
+/**
+ *
+ */
+public class ForceGCJob extends ClientAsyncJob {
+ boolean m_cancel = false;
+
+ public ForceGCJob() {
+ super("Release memory", ClientAsyncJob.getCurrentSession());
+ setPriority(DECORATE);
+ }
+
+ @Override
+ protected void runVoid(IProgressMonitor monitor) throws Throwable {
+ int counter = 0;
+ Thread.sleep(10000);
+ while (counter < 7 && !m_cancel && (Runtime.getRuntime().freeMemory() > 30000000 || counter < 2)) {
+ System.gc();
+ counter++;
+ Thread.sleep(10000);
+ }
+ }
+
+ @Override
+ protected void canceling() {
+ m_cancel = true;
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/IClientSession.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/IClientSession.java
index b6407c4ceb..4cb6853f8f 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/IClientSession.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/IClientSession.java
@@ -1,147 +1,147 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client;
-
-import javax.security.auth.Subject;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.servicetunnel.IServiceTunnel;
-import org.eclipse.scout.rt.client.ui.IIconLocator;
-import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
-import org.eclipse.scout.rt.shared.ISession;
-import org.osgi.framework.Bundle;
-
-public interface IClientSession extends ISession {
-
- /**
- * Monitor can be used to wait for changes of the states 'active' and 'loaded'
- */
- Object getStateLock();
-
- /**
- * The session is running and was loaded
- */
- boolean isLoaded();
-
- Throwable getLoadError();
-
- /**
- * Start model thread with job queue<br>
- * The model thread will first load the session and then start the event loop
- * <p>
- * The session is active just after this method returns.
- */
- void startSession(Bundle bundle);
-
- /**
- * send a stop signal to the session event queue<br>
- * check {@link #isActive()} to wait until the queue has in fact closed
- */
- void stopSession();
-
- /**
- * @param exitCode
- * {@link org.eclipse.equinox.app.IApplication#EXIT_OK},
- * {@link org.eclipse.equinox.app.IApplication#EXIT_RELAUNCH},
- * {@link org.eclipse.equinox.app.IApplication#EXIT_RESTART}
- */
- void stopSession(int exitCode);
-
- int getExitCode();
-
- /**
- * @return a virtual desktop model assiciated with this client session
- * <p>
- * Before a desktop is set using {@link #setDesktop(IDesktop)} this is a virtual desktop ONLY used to early
- * register observers.<br>
- * Once a desktop has been set, this is the same as calling {@link #getDesktop()}
- */
- IDesktop getVirtualDesktop();
-
- /**
- * @return the desktop model assiciated with this client session
- * <p>
- * Desktop is available only after {@link #startSession(Bundle)} and
- * <code>AbstractClientSession.execLoadSession()</code>
- */
- IDesktop getDesktop();
-
- /**
- * set the desktop model assiciated with this client session
- */
- void setDesktop(IDesktop a) throws ProcessingException;
-
- IServiceTunnel getServiceTunnel();
-
- /**
- * see {@link IMemoryPolicy}
- */
- IMemoryPolicy getMemoryPolicy();
-
- /**
- * see {@link IMemoryPolicy}
- */
- void setMemoryPolicy(IMemoryPolicy p);
-
- /**
- * @return Subject used for offline operations
- */
- Subject getOfflineSubject();
-
- void goOffline() throws ProcessingException;
-
- /**
- * @deprecated, use {@link #isSingleThreadSession()} instead
- */
- @Deprecated
- boolean isWebSession();
-
- /**
- * If {@link IClientSession#getVirtualSessionId()} is not null then it is sent as part of the wsse security header to
- * the
- * server.
- * <p>
- * This is necessary since the web-gui-servlet is itself a single servlet that is calling the server-servlet /process
- * with a single cookie and therefore a single http session. When this session is set, the ServiceTunnelServlet
- * /process recognizes this and is not associating the scout server session with the HttpSession but with a custom
- * cache associated with this ajax (remote) session id.
- * <p>
- *
- * @return rap/rwt/ajax session id (this is a uuid) or null if app is not running as web app
- */
- String getVirtualSessionId();
-
- /**
- * see {@link #getVirtualSessionId()}
- */
- void setVirtualSessionId(String sessionId);
-
- /**
- * The {@link IServiceTunnel} used by {@link IClientSession#getServiceTunnel()} checks for the Subject
- * under which the session is running and creates a WSSE security element.
- * <p>
- * Consumers can query for the {@link Subject} of a {@link IClientSession}
- * <p>
- * Providers can set the {@link Subject} associated with a {@link IClientSession}
- */
- Subject getSubject();
-
- void setSubject(Subject subject);
-
- /**
- * @return
- */
- IIconLocator getIconLocator();
-
- void addLocaleListener(ILocaleListener listener);
-
- void removeLocaleListener(ILocaleListener listener);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client;
+
+import javax.security.auth.Subject;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.servicetunnel.IServiceTunnel;
+import org.eclipse.scout.rt.client.ui.IIconLocator;
+import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
+import org.eclipse.scout.rt.shared.ISession;
+import org.osgi.framework.Bundle;
+
+public interface IClientSession extends ISession {
+
+ /**
+ * Monitor can be used to wait for changes of the states 'active' and 'loaded'
+ */
+ Object getStateLock();
+
+ /**
+ * The session is running and was loaded
+ */
+ boolean isLoaded();
+
+ Throwable getLoadError();
+
+ /**
+ * Start model thread with job queue<br>
+ * The model thread will first load the session and then start the event loop
+ * <p>
+ * The session is active just after this method returns.
+ */
+ void startSession(Bundle bundle);
+
+ /**
+ * send a stop signal to the session event queue<br>
+ * check {@link #isActive()} to wait until the queue has in fact closed
+ */
+ void stopSession();
+
+ /**
+ * @param exitCode
+ * {@link org.eclipse.equinox.app.IApplication#EXIT_OK},
+ * {@link org.eclipse.equinox.app.IApplication#EXIT_RELAUNCH},
+ * {@link org.eclipse.equinox.app.IApplication#EXIT_RESTART}
+ */
+ void stopSession(int exitCode);
+
+ int getExitCode();
+
+ /**
+ * @return a virtual desktop model assiciated with this client session
+ * <p>
+ * Before a desktop is set using {@link #setDesktop(IDesktop)} this is a virtual desktop ONLY used to early
+ * register observers.<br>
+ * Once a desktop has been set, this is the same as calling {@link #getDesktop()}
+ */
+ IDesktop getVirtualDesktop();
+
+ /**
+ * @return the desktop model assiciated with this client session
+ * <p>
+ * Desktop is available only after {@link #startSession(Bundle)} and
+ * <code>AbstractClientSession.execLoadSession()</code>
+ */
+ IDesktop getDesktop();
+
+ /**
+ * set the desktop model assiciated with this client session
+ */
+ void setDesktop(IDesktop a) throws ProcessingException;
+
+ IServiceTunnel getServiceTunnel();
+
+ /**
+ * see {@link IMemoryPolicy}
+ */
+ IMemoryPolicy getMemoryPolicy();
+
+ /**
+ * see {@link IMemoryPolicy}
+ */
+ void setMemoryPolicy(IMemoryPolicy p);
+
+ /**
+ * @return Subject used for offline operations
+ */
+ Subject getOfflineSubject();
+
+ void goOffline() throws ProcessingException;
+
+ /**
+ * @deprecated, use {@link #isSingleThreadSession()} instead
+ */
+ @Deprecated
+ boolean isWebSession();
+
+ /**
+ * If {@link IClientSession#getVirtualSessionId()} is not null then it is sent as part of the wsse security header to
+ * the
+ * server.
+ * <p>
+ * This is necessary since the web-gui-servlet is itself a single servlet that is calling the server-servlet /process
+ * with a single cookie and therefore a single http session. When this session is set, the ServiceTunnelServlet
+ * /process recognizes this and is not associating the scout server session with the HttpSession but with a custom
+ * cache associated with this ajax (remote) session id.
+ * <p>
+ *
+ * @return rap/rwt/ajax session id (this is a uuid) or null if app is not running as web app
+ */
+ String getVirtualSessionId();
+
+ /**
+ * see {@link #getVirtualSessionId()}
+ */
+ void setVirtualSessionId(String sessionId);
+
+ /**
+ * The {@link IServiceTunnel} used by {@link IClientSession#getServiceTunnel()} checks for the Subject
+ * under which the session is running and creates a WSSE security element.
+ * <p>
+ * Consumers can query for the {@link Subject} of a {@link IClientSession}
+ * <p>
+ * Providers can set the {@link Subject} associated with a {@link IClientSession}
+ */
+ Subject getSubject();
+
+ void setSubject(Subject subject);
+
+ /**
+ * @return
+ */
+ IIconLocator getIconLocator();
+
+ void addLocaleListener(ILocaleListener listener);
+
+ void removeLocaleListener(ILocaleListener listener);
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/IClientSessionProvider.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/IClientSessionProvider.java
index e8cae017e2..7777de6ad7 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/IClientSessionProvider.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/IClientSessionProvider.java
@@ -1,17 +1,17 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client;
-
-public interface IClientSessionProvider {
-
- IClientSession getClientSession();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client;
+
+public interface IClientSessionProvider {
+
+ IClientSession getClientSession();
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/IJobChangeListenerEx.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/IJobChangeListenerEx.java
index e57f02e083..35c4201611 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/IJobChangeListenerEx.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/IJobChangeListenerEx.java
@@ -1,36 +1,36 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client;
-
-import java.util.EventListener;
-
-import org.eclipse.core.runtime.jobs.IJobChangeEvent;
-import org.eclipse.core.runtime.jobs.IJobChangeListener;
-
-public interface IJobChangeListenerEx extends IJobChangeListener, EventListener {
-
- /**
- * Notification that a job entered a blocking condition
- *
- * @param event
- * the event details
- */
- void blockingConditionStart(IJobChangeEvent event);
-
- /**
- * Notification that a job left a blocking condition
- *
- * @param event
- * the event details
- */
- void blockingConditionEnd(IJobChangeEvent event);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client;
+
+import java.util.EventListener;
+
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.core.runtime.jobs.IJobChangeListener;
+
+public interface IJobChangeListenerEx extends IJobChangeListener, EventListener {
+
+ /**
+ * Notification that a job entered a blocking condition
+ *
+ * @param event
+ * the event details
+ */
+ void blockingConditionStart(IJobChangeEvent event);
+
+ /**
+ * Notification that a job left a blocking condition
+ *
+ * @param event
+ * the event details
+ */
+ void blockingConditionEnd(IJobChangeEvent event);
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ILocaleListener.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ILocaleListener.java
index 0df752eed9..52e546feb8 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ILocaleListener.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ILocaleListener.java
@@ -1,20 +1,20 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client;
-
-/**
- * Listeners will be informed if the locale has changed.
- */
-public interface ILocaleListener {
-
- public void localeChanged(LocaleChangeEvent event);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client;
+
+/**
+ * Listeners will be informed if the locale has changed.
+ */
+public interface ILocaleListener {
+
+ public void localeChanged(LocaleChangeEvent event);
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/IMemoryPolicy.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/IMemoryPolicy.java
index 83ac4299dc..0044e26104 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/IMemoryPolicy.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/IMemoryPolicy.java
@@ -1,75 +1,75 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.ISearchForm;
-
-/**
- * Handling of various framework aspects regarding memory allocation, caching and lazy-ness
- * <p>
- * The use of which profile to be used in {@link IClientSession} can be set in the config.ini as
- * <code>org.eclipse.scout.memory=small | medium | large</code>
- * <ul>
- * <li>small: low profile hardware, citrix and alike, memory consumption below 256m, no caching where not explicitly
- * needed. {@link SmallMemoryPolicy}</li>
- * <li>medium: medium profile hardware, old PC's and alike, memory consumption in the area 256m-512m, but caching is ok
- * to gain speed. {@link MediumMemoryPolicy}</li>
- * <li>large: client pc's and customer workstations, memory consumption can be 512m or more, caching whenever needed for
- * optimal speed. {@link LargeMemoryPolicy}</li>
- * </ul>
- */
-public interface IMemoryPolicy {
-
- /**
- * After policy was set to a {@link IClientSession}.
- */
- void addNotify();
-
- /**
- * Before policy is removed from a {@link IClientSession} and replaced by another one.
- */
- void removeNotify();
-
- /**
- * This method is called just after a new page was created using {@link IPage#initPage()}.
- * <p>
- * Do not access the {@link IPageWithTable#getSearchFormInternal()} since it is lazy created.
- * <p>
- * For search form caching use {@link #pageSearchFormStarted(IPageWithTable)} instead.
- */
- void pageCreated(IPage page) throws ProcessingException;
-
- /**
- * This method is called just after a search form inside a page was started using {@link ISearchForm#startSearch()}
- */
- void pageSearchFormStarted(IPageWithTable<?> page) throws ProcessingException;
-
- /**
- * Whenever a new page is selected this methode is called to give the possibility to release unused pages.
- */
- void afterOutlineSelectionChanged(IDesktop desktop) throws ProcessingException;
-
- /**
- * Before data is fetched and loaded this methode is called to give the possibility to previously manipulate the
- * table.
- */
- void beforeTablePageLoadData(IPageWithTable<?> page) throws ProcessingException;
-
- /**
- * After data is fetched and loaded this methode is called to give the possibility to manipulate the table.
- */
- void afterTablePageLoadData(IPageWithTable<?> page) throws ProcessingException;
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.ISearchForm;
+
+/**
+ * Handling of various framework aspects regarding memory allocation, caching and lazy-ness
+ * <p>
+ * The use of which profile to be used in {@link IClientSession} can be set in the config.ini as
+ * <code>org.eclipse.scout.memory=small | medium | large</code>
+ * <ul>
+ * <li>small: low profile hardware, citrix and alike, memory consumption below 256m, no caching where not explicitly
+ * needed. {@link SmallMemoryPolicy}</li>
+ * <li>medium: medium profile hardware, old PC's and alike, memory consumption in the area 256m-512m, but caching is ok
+ * to gain speed. {@link MediumMemoryPolicy}</li>
+ * <li>large: client pc's and customer workstations, memory consumption can be 512m or more, caching whenever needed for
+ * optimal speed. {@link LargeMemoryPolicy}</li>
+ * </ul>
+ */
+public interface IMemoryPolicy {
+
+ /**
+ * After policy was set to a {@link IClientSession}.
+ */
+ void addNotify();
+
+ /**
+ * Before policy is removed from a {@link IClientSession} and replaced by another one.
+ */
+ void removeNotify();
+
+ /**
+ * This method is called just after a new page was created using {@link IPage#initPage()}.
+ * <p>
+ * Do not access the {@link IPageWithTable#getSearchFormInternal()} since it is lazy created.
+ * <p>
+ * For search form caching use {@link #pageSearchFormStarted(IPageWithTable)} instead.
+ */
+ void pageCreated(IPage page) throws ProcessingException;
+
+ /**
+ * This method is called just after a search form inside a page was started using {@link ISearchForm#startSearch()}
+ */
+ void pageSearchFormStarted(IPageWithTable<?> page) throws ProcessingException;
+
+ /**
+ * Whenever a new page is selected this methode is called to give the possibility to release unused pages.
+ */
+ void afterOutlineSelectionChanged(IDesktop desktop) throws ProcessingException;
+
+ /**
+ * Before data is fetched and loaded this methode is called to give the possibility to previously manipulate the
+ * table.
+ */
+ void beforeTablePageLoadData(IPageWithTable<?> page) throws ProcessingException;
+
+ /**
+ * After data is fetched and loaded this methode is called to give the possibility to manipulate the table.
+ */
+ void afterTablePageLoadData(IPageWithTable<?> page) throws ProcessingException;
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/JobChangeAdapterEx.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/JobChangeAdapterEx.java
index 509b81c28f..b6d6bdb72d 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/JobChangeAdapterEx.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/JobChangeAdapterEx.java
@@ -1,25 +1,25 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client;
-
-import org.eclipse.core.runtime.jobs.IJobChangeEvent;
-import org.eclipse.core.runtime.jobs.JobChangeAdapter;
-
-public class JobChangeAdapterEx extends JobChangeAdapter implements IJobChangeListenerEx {
-
- @Override
- public void blockingConditionEnd(IJobChangeEvent event) {
- }
-
- @Override
- public void blockingConditionStart(IJobChangeEvent event) {
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client;
+
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.core.runtime.jobs.JobChangeAdapter;
+
+public class JobChangeAdapterEx extends JobChangeAdapter implements IJobChangeListenerEx {
+
+ @Override
+ public void blockingConditionEnd(IJobChangeEvent event) {
+ }
+
+ @Override
+ public void blockingConditionStart(IJobChangeEvent event) {
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/LargeMemoryPolicy.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/LargeMemoryPolicy.java
index 8cb7863363..cbdf585747 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/LargeMemoryPolicy.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/LargeMemoryPolicy.java
@@ -1,133 +1,133 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.basic.table.columnfilter.ITableColumnFilter;
-import org.eclipse.scout.rt.client.ui.basic.table.columnfilter.ITableColumnFilterManager;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.shared.services.common.jdbc.SearchFilter;
-
-/**
- * No specific restrictions, cache all table page search form contents and all page table filter settings. Check memory
- * limits after page reload.
- */
-public class LargeMemoryPolicy extends AbstractMemoryPolicy {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(LargeMemoryPolicy.class);
-
- //cache all search form contents
- private final Map<String/*pageFormIdentifier*/, SearchFormState> m_searchFormCache;
- private final Map<String /*pageTableIdentifier*/, Map<String, byte[]>> m_tableColumnFilterManagerState;
-
- public LargeMemoryPolicy() {
- m_searchFormCache = new HashMap<String, SearchFormState>();
- m_tableColumnFilterManagerState = new HashMap<String, Map<String, byte[]>>();
- }
-
- @Override
- protected void loadSearchFormState(IForm f, String pageFormIdentifier) throws ProcessingException {
- //check if there is stored search form data
- SearchFormState state = m_searchFormCache.get(pageFormIdentifier);
- if (state != null) {
- if (state.formContentXml != null) {
- f.setXML(state.formContentXml);
- }
- if (state.searchFilter != null) {
- f.setSearchFilter(state.searchFilter);
- }
- }
- }
-
- @Override
- protected void storeSearchFormState(IForm f, String pageFormIdentifier) throws ProcessingException {
- //cache search form data
- if (f.isEmpty()) {
- m_searchFormCache.remove(pageFormIdentifier);
- }
- else {
- String xml = f.getXML("UTF-8");
- SearchFilter filter = f.getSearchFilter();
- m_searchFormCache.put(pageFormIdentifier, new SearchFormState(xml, filter));
- }
- }
-
- @Override
- protected void storeColumnFilterState(ITable t, String pageTableIdentifier) throws ProcessingException {
- ITableColumnFilterManager filterManager = t.getColumnFilterManager();
- if (filterManager == null || filterManager.getFilters() == null || filterManager.getFilters().isEmpty()) {
- m_tableColumnFilterManagerState.remove(pageTableIdentifier);
- return;
- }
- Map<String, byte[]> state = m_tableColumnFilterManagerState.get(pageTableIdentifier);
- if (state == null) {
- state = new HashMap<String, byte[]>();
- m_tableColumnFilterManagerState.put(pageTableIdentifier, state);
- }
- for (ITableColumnFilter<?> filter : filterManager.getFilters()) {
- IColumn<?> col = filter.getColumn();
- if (col.getColumnId() != null) {
- byte[] data = filterManager.getSerializedFilter(col);
- if (data == null || data.length == 0) {
- state.remove(col.getColumnId());
- }
- else {
- state.put(col.getColumnId(), data);
- }
- }
- }
- }
-
- @Override
- protected void loadColumnFilterState(ITable t, String pageTableIdentifier) throws ProcessingException {
- if (t == null || t.getColumnFilterManager() == null) {
- return;
- }
- Map<String, byte[]> state = m_tableColumnFilterManagerState.get(pageTableIdentifier);
- if (state != null) {
- for (Map.Entry<String, byte[]> entry : state.entrySet()) {
- IColumn col = t.getColumnSet().getColumnById(entry.getKey());
- if (col != null) {
- t.getColumnFilterManager().setSerializedFilter(entry.getValue(), col);
- }
- }
- }
- }
-
- @Override
- public void afterOutlineSelectionChanged(final IDesktop desktop) {
- long memTotal = Runtime.getRuntime().totalMemory();
- long memUsed = (memTotal - Runtime.getRuntime().freeMemory());
- long memMax = Runtime.getRuntime().maxMemory();
- if (memUsed > memMax * 80L / 100L) {
- new ClientSyncJob("Check memory", ClientSyncJob.getCurrentSession()) {
- @Override
- protected void runVoid(IProgressMonitor monitor) throws Throwable {
- desktop.releaseUnusedPages();
- System.gc();
- }
- }.schedule();
- }
- }
-
- @Override
- public String toString() {
- return "Large";
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.basic.table.columnfilter.ITableColumnFilter;
+import org.eclipse.scout.rt.client.ui.basic.table.columnfilter.ITableColumnFilterManager;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.shared.services.common.jdbc.SearchFilter;
+
+/**
+ * No specific restrictions, cache all table page search form contents and all page table filter settings. Check memory
+ * limits after page reload.
+ */
+public class LargeMemoryPolicy extends AbstractMemoryPolicy {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(LargeMemoryPolicy.class);
+
+ //cache all search form contents
+ private final Map<String/*pageFormIdentifier*/, SearchFormState> m_searchFormCache;
+ private final Map<String /*pageTableIdentifier*/, Map<String, byte[]>> m_tableColumnFilterManagerState;
+
+ public LargeMemoryPolicy() {
+ m_searchFormCache = new HashMap<String, SearchFormState>();
+ m_tableColumnFilterManagerState = new HashMap<String, Map<String, byte[]>>();
+ }
+
+ @Override
+ protected void loadSearchFormState(IForm f, String pageFormIdentifier) throws ProcessingException {
+ //check if there is stored search form data
+ SearchFormState state = m_searchFormCache.get(pageFormIdentifier);
+ if (state != null) {
+ if (state.formContentXml != null) {
+ f.setXML(state.formContentXml);
+ }
+ if (state.searchFilter != null) {
+ f.setSearchFilter(state.searchFilter);
+ }
+ }
+ }
+
+ @Override
+ protected void storeSearchFormState(IForm f, String pageFormIdentifier) throws ProcessingException {
+ //cache search form data
+ if (f.isEmpty()) {
+ m_searchFormCache.remove(pageFormIdentifier);
+ }
+ else {
+ String xml = f.getXML("UTF-8");
+ SearchFilter filter = f.getSearchFilter();
+ m_searchFormCache.put(pageFormIdentifier, new SearchFormState(xml, filter));
+ }
+ }
+
+ @Override
+ protected void storeColumnFilterState(ITable t, String pageTableIdentifier) throws ProcessingException {
+ ITableColumnFilterManager filterManager = t.getColumnFilterManager();
+ if (filterManager == null || filterManager.getFilters() == null || filterManager.getFilters().isEmpty()) {
+ m_tableColumnFilterManagerState.remove(pageTableIdentifier);
+ return;
+ }
+ Map<String, byte[]> state = m_tableColumnFilterManagerState.get(pageTableIdentifier);
+ if (state == null) {
+ state = new HashMap<String, byte[]>();
+ m_tableColumnFilterManagerState.put(pageTableIdentifier, state);
+ }
+ for (ITableColumnFilter<?> filter : filterManager.getFilters()) {
+ IColumn<?> col = filter.getColumn();
+ if (col.getColumnId() != null) {
+ byte[] data = filterManager.getSerializedFilter(col);
+ if (data == null || data.length == 0) {
+ state.remove(col.getColumnId());
+ }
+ else {
+ state.put(col.getColumnId(), data);
+ }
+ }
+ }
+ }
+
+ @Override
+ protected void loadColumnFilterState(ITable t, String pageTableIdentifier) throws ProcessingException {
+ if (t == null || t.getColumnFilterManager() == null) {
+ return;
+ }
+ Map<String, byte[]> state = m_tableColumnFilterManagerState.get(pageTableIdentifier);
+ if (state != null) {
+ for (Map.Entry<String, byte[]> entry : state.entrySet()) {
+ IColumn col = t.getColumnSet().getColumnById(entry.getKey());
+ if (col != null) {
+ t.getColumnFilterManager().setSerializedFilter(entry.getValue(), col);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void afterOutlineSelectionChanged(final IDesktop desktop) {
+ long memTotal = Runtime.getRuntime().totalMemory();
+ long memUsed = (memTotal - Runtime.getRuntime().freeMemory());
+ long memMax = Runtime.getRuntime().maxMemory();
+ if (memUsed > memMax * 80L / 100L) {
+ new ClientSyncJob("Check memory", ClientSyncJob.getCurrentSession()) {
+ @Override
+ protected void runVoid(IProgressMonitor monitor) throws Throwable {
+ desktop.releaseUnusedPages();
+ System.gc();
+ }
+ }.schedule();
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "Large";
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/LocaleChangeEvent.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/LocaleChangeEvent.java
index b2b7c95c63..bd4d50b0c9 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/LocaleChangeEvent.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/LocaleChangeEvent.java
@@ -1,36 +1,36 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client;
-
-import java.util.EventObject;
-import java.util.Locale;
-
-/**
- * This event is fired when the locale has changed.
- */
-public class LocaleChangeEvent extends EventObject {
- private static final long serialVersionUID = 1L;
-
- private Locale m_locale;
-
- public LocaleChangeEvent(Object source) {
- super(source);
- }
-
- public LocaleChangeEvent(Object source, Locale locale) {
- super(source);
- m_locale = locale;
- }
-
- public Locale getLocale() {
- return m_locale;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client;
+
+import java.util.EventObject;
+import java.util.Locale;
+
+/**
+ * This event is fired when the locale has changed.
+ */
+public class LocaleChangeEvent extends EventObject {
+ private static final long serialVersionUID = 1L;
+
+ private Locale m_locale;
+
+ public LocaleChangeEvent(Object source) {
+ super(source);
+ }
+
+ public LocaleChangeEvent(Object source, Locale locale) {
+ super(source);
+ m_locale = locale;
+ }
+
+ public Locale getLocale() {
+ return m_locale;
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/MediumMemoryPolicy.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/MediumMemoryPolicy.java
index 96f587fa8a..2a9cf3bb6c 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/MediumMemoryPolicy.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/MediumMemoryPolicy.java
@@ -1,200 +1,200 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.concurrent.atomic.AtomicLong;
-
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.scout.commons.LRUCache;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.basic.table.columnfilter.ITableColumnFilter;
-import org.eclipse.scout.rt.client.ui.basic.table.columnfilter.ITableColumnFilterManager;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeVisitor;
-import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.shared.services.common.jdbc.SearchFilter;
-
-/**
- * Cache only last 5 table page search form contents, last 5 table filter settings, releaseUnusedPages after every page
- * reload and force gc do free memory.
- */
-public class MediumMemoryPolicy extends AbstractMemoryPolicy {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(MediumMemoryPolicy.class);
-
- private boolean m_release = false;
- //cache last 5 search form contents and table filters
- private final LRUCache<String/*pageFormIdentifier*/, SearchFormState> m_searchFormCache;
- private final LRUCache<String /*pageTableIdentifier*/, Map<String, byte[]>> m_tableColumnFilterManagerState;
-
- public MediumMemoryPolicy() {
- m_searchFormCache = new LRUCache<String, SearchFormState>(5, 0L);
- m_tableColumnFilterManagerState = new LRUCache<String, Map<String, byte[]>>(5, 0L);
- }
-
- @Override
- protected void loadSearchFormState(IForm f, String pageFormIdentifier) throws ProcessingException {
- //check if there is stored search form data
- SearchFormState state = m_searchFormCache.get(pageFormIdentifier);
- if (state != null) {
- if (state.formContentXml != null) {
- f.setXML(state.formContentXml);
- }
- if (state.searchFilter != null) {
- f.setSearchFilter(state.searchFilter);
- }
- }
- }
-
- @Override
- protected void storeSearchFormState(IForm f, String pageFormIdentifier) throws ProcessingException {
- //cache search form data
- if (f.isEmpty()) {
- m_searchFormCache.remove(pageFormIdentifier);
- }
- else {
- String xml = f.getXML("UTF-8");
- SearchFilter filter = f.getSearchFilter();
- m_searchFormCache.put(pageFormIdentifier, new SearchFormState(xml, filter));
- }
- }
-
- @Override
- protected void storeColumnFilterState(ITable t, String pageTableIdentifier) throws ProcessingException {
- ITableColumnFilterManager filterManager = t.getColumnFilterManager();
- if (filterManager == null || filterManager.getFilters() == null || filterManager.getFilters().isEmpty()) {
- m_tableColumnFilterManagerState.remove(pageTableIdentifier);
- return;
- }
- Map<String, byte[]> state = m_tableColumnFilterManagerState.get(pageTableIdentifier);
- if (state == null) {
- state = new HashMap<String, byte[]>();
- m_tableColumnFilterManagerState.put(pageTableIdentifier, state);
- }
- for (ITableColumnFilter<?> filter : filterManager.getFilters()) {
- IColumn<?> col = filter.getColumn();
- if (col.getColumnId() != null) {
- byte[] data = filterManager.getSerializedFilter(col);
- if (data == null || data.length == 0) {
- state.remove(col.getColumnId());
- }
- else {
- state.put(col.getColumnId(), data);
- }
- }
- }
- }
-
- @Override
- protected void loadColumnFilterState(ITable t, String pageTableIdentifier) throws ProcessingException {
- if (t == null || t.getColumnFilterManager() == null) {
- return;
- }
- Map<String, byte[]> state = m_tableColumnFilterManagerState.get(pageTableIdentifier);
- if (state != null) {
- for (Map.Entry<String, byte[]> entry : state.entrySet()) {
- IColumn col = t.getColumnSet().getColumnById(entry.getKey());
- if (col != null) {
- t.getColumnFilterManager().setSerializedFilter(entry.getValue(), col);
- }
- }
- }
- }
-
- @Override
- public void afterOutlineSelectionChanged(final IDesktop desktop) {
- try {
- final AtomicLong nodeCount = new AtomicLong();
- if (desktop.getOutline() != null && desktop.getOutline().getSelectedNode() != null) {
- final HashSet<IPage> preservationSet = new HashSet<IPage>();
- IPage p = (IPage) desktop.getOutline().getSelectedNode();
- while (p != null) {
- // the tree in the selection is not the topic
- // of the analysis whether we should free up the memory
- // so we calculate only the other ones.
- preservationSet.add(p);
- p = p.getParentPage();
- }
- ITreeVisitor v = new ITreeVisitor() {
- @Override
- public boolean visit(ITreeNode node) {
- IPage page = (IPage) node;
- if (preservationSet.contains(page)) {
- // nop
- }
- else if (page.getParentPage() == null) {
- // nop, InvisibleRootPage
- }
- else if (page.isChildrenLoaded()) {
- nodeCount.getAndAdd(page.getChildNodeCount());
- }
- return true;
- }
- };
- for (IOutline outline : desktop.getAvailableOutlines()) {
- outline.visitNode(outline.getRootNode(), v);
- }
- }
- long memTotal = Runtime.getRuntime().totalMemory();
- long memUsed = (memTotal - Runtime.getRuntime().freeMemory());
- long memMax = Runtime.getRuntime().maxMemory();
- if (memUsed > memMax * 80L / 100L || nodeCount.get() > 10000) {
- m_release = true;
- }
- }
- catch (Exception e) {
- LOG.error(null, e);
- }
- }
-
- /**
- * when table contains 1000+ rows clear table before loading new data, thus disabling "replaceRow" mechanism
- */
- @Override
- public void beforeTablePageLoadData(IPageWithTable<?> page) {
- if (m_release) {
- //make sure inactive outlines have no selection that "keeps" the pages
- IDesktop desktop = ClientJob.getCurrentSession().getDesktop();
- for (IOutline o : desktop.getAvailableOutlines()) {
- if (o != desktop.getOutline()) {
- o.selectNode(null);
- }
- }
- ClientJob.getCurrentSession().getDesktop().releaseUnusedPages();
- System.gc();
- for (Job j : Job.getJobManager().find(ClientJob.class)) {
- if (j instanceof ForceGCJob) {
- j.cancel();
- }
- }
- new ForceGCJob().schedule();
- m_release = false;
- }
- if (page.getTable() != null && page.getTable().getRowCount() > 1000) {
- page.getTable().discardAllRows();
- }
- }
-
- @Override
- public String toString() {
- return "Medium";
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.scout.commons.LRUCache;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.basic.table.columnfilter.ITableColumnFilter;
+import org.eclipse.scout.rt.client.ui.basic.table.columnfilter.ITableColumnFilterManager;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeVisitor;
+import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.shared.services.common.jdbc.SearchFilter;
+
+/**
+ * Cache only last 5 table page search form contents, last 5 table filter settings, releaseUnusedPages after every page
+ * reload and force gc do free memory.
+ */
+public class MediumMemoryPolicy extends AbstractMemoryPolicy {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(MediumMemoryPolicy.class);
+
+ private boolean m_release = false;
+ //cache last 5 search form contents and table filters
+ private final LRUCache<String/*pageFormIdentifier*/, SearchFormState> m_searchFormCache;
+ private final LRUCache<String /*pageTableIdentifier*/, Map<String, byte[]>> m_tableColumnFilterManagerState;
+
+ public MediumMemoryPolicy() {
+ m_searchFormCache = new LRUCache<String, SearchFormState>(5, 0L);
+ m_tableColumnFilterManagerState = new LRUCache<String, Map<String, byte[]>>(5, 0L);
+ }
+
+ @Override
+ protected void loadSearchFormState(IForm f, String pageFormIdentifier) throws ProcessingException {
+ //check if there is stored search form data
+ SearchFormState state = m_searchFormCache.get(pageFormIdentifier);
+ if (state != null) {
+ if (state.formContentXml != null) {
+ f.setXML(state.formContentXml);
+ }
+ if (state.searchFilter != null) {
+ f.setSearchFilter(state.searchFilter);
+ }
+ }
+ }
+
+ @Override
+ protected void storeSearchFormState(IForm f, String pageFormIdentifier) throws ProcessingException {
+ //cache search form data
+ if (f.isEmpty()) {
+ m_searchFormCache.remove(pageFormIdentifier);
+ }
+ else {
+ String xml = f.getXML("UTF-8");
+ SearchFilter filter = f.getSearchFilter();
+ m_searchFormCache.put(pageFormIdentifier, new SearchFormState(xml, filter));
+ }
+ }
+
+ @Override
+ protected void storeColumnFilterState(ITable t, String pageTableIdentifier) throws ProcessingException {
+ ITableColumnFilterManager filterManager = t.getColumnFilterManager();
+ if (filterManager == null || filterManager.getFilters() == null || filterManager.getFilters().isEmpty()) {
+ m_tableColumnFilterManagerState.remove(pageTableIdentifier);
+ return;
+ }
+ Map<String, byte[]> state = m_tableColumnFilterManagerState.get(pageTableIdentifier);
+ if (state == null) {
+ state = new HashMap<String, byte[]>();
+ m_tableColumnFilterManagerState.put(pageTableIdentifier, state);
+ }
+ for (ITableColumnFilter<?> filter : filterManager.getFilters()) {
+ IColumn<?> col = filter.getColumn();
+ if (col.getColumnId() != null) {
+ byte[] data = filterManager.getSerializedFilter(col);
+ if (data == null || data.length == 0) {
+ state.remove(col.getColumnId());
+ }
+ else {
+ state.put(col.getColumnId(), data);
+ }
+ }
+ }
+ }
+
+ @Override
+ protected void loadColumnFilterState(ITable t, String pageTableIdentifier) throws ProcessingException {
+ if (t == null || t.getColumnFilterManager() == null) {
+ return;
+ }
+ Map<String, byte[]> state = m_tableColumnFilterManagerState.get(pageTableIdentifier);
+ if (state != null) {
+ for (Map.Entry<String, byte[]> entry : state.entrySet()) {
+ IColumn col = t.getColumnSet().getColumnById(entry.getKey());
+ if (col != null) {
+ t.getColumnFilterManager().setSerializedFilter(entry.getValue(), col);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void afterOutlineSelectionChanged(final IDesktop desktop) {
+ try {
+ final AtomicLong nodeCount = new AtomicLong();
+ if (desktop.getOutline() != null && desktop.getOutline().getSelectedNode() != null) {
+ final HashSet<IPage> preservationSet = new HashSet<IPage>();
+ IPage p = (IPage) desktop.getOutline().getSelectedNode();
+ while (p != null) {
+ // the tree in the selection is not the topic
+ // of the analysis whether we should free up the memory
+ // so we calculate only the other ones.
+ preservationSet.add(p);
+ p = p.getParentPage();
+ }
+ ITreeVisitor v = new ITreeVisitor() {
+ @Override
+ public boolean visit(ITreeNode node) {
+ IPage page = (IPage) node;
+ if (preservationSet.contains(page)) {
+ // nop
+ }
+ else if (page.getParentPage() == null) {
+ // nop, InvisibleRootPage
+ }
+ else if (page.isChildrenLoaded()) {
+ nodeCount.getAndAdd(page.getChildNodeCount());
+ }
+ return true;
+ }
+ };
+ for (IOutline outline : desktop.getAvailableOutlines()) {
+ outline.visitNode(outline.getRootNode(), v);
+ }
+ }
+ long memTotal = Runtime.getRuntime().totalMemory();
+ long memUsed = (memTotal - Runtime.getRuntime().freeMemory());
+ long memMax = Runtime.getRuntime().maxMemory();
+ if (memUsed > memMax * 80L / 100L || nodeCount.get() > 10000) {
+ m_release = true;
+ }
+ }
+ catch (Exception e) {
+ LOG.error(null, e);
+ }
+ }
+
+ /**
+ * when table contains 1000+ rows clear table before loading new data, thus disabling "replaceRow" mechanism
+ */
+ @Override
+ public void beforeTablePageLoadData(IPageWithTable<?> page) {
+ if (m_release) {
+ //make sure inactive outlines have no selection that "keeps" the pages
+ IDesktop desktop = ClientJob.getCurrentSession().getDesktop();
+ for (IOutline o : desktop.getAvailableOutlines()) {
+ if (o != desktop.getOutline()) {
+ o.selectNode(null);
+ }
+ }
+ ClientJob.getCurrentSession().getDesktop().releaseUnusedPages();
+ System.gc();
+ for (Job j : Job.getJobManager().find(ClientJob.class)) {
+ if (j instanceof ForceGCJob) {
+ j.cancel();
+ }
+ }
+ new ForceGCJob().schedule();
+ m_release = false;
+ }
+ if (page.getTable() != null && page.getTable().getRowCount() > 1000) {
+ page.getTable().discardAllRows();
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "Medium";
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/SmallMemoryPolicy.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/SmallMemoryPolicy.java
index 81d85983c2..31e0f514cf 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/SmallMemoryPolicy.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/SmallMemoryPolicy.java
@@ -1,65 +1,65 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client;
-
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
-
-/**
- * dont cache table page search form contents, releaseUnusedPages before every page reload and force gc to free
- * memory
- */
-public class SmallMemoryPolicy extends AbstractMemoryPolicy {
-
- /**
- * clear table before loading new data, thus disabling "replaceRow" mechanism but saving memory
- */
- @Override
- public void beforeTablePageLoadData(IPageWithTable<?> page) {
- //make sure inactive outlines have no selection that "keeps" the pages
- IDesktop desktop = ClientJob.getCurrentSession().getDesktop();
- for (IOutline o : desktop.getAvailableOutlines()) {
- if (o != desktop.getOutline()) {
- o.selectNode(null);
- }
- }
- ClientJob.getCurrentSession().getDesktop().releaseUnusedPages();
- System.gc();
- for (Job j : Job.getJobManager().find(ClientJob.class)) {
- if (j instanceof ForceGCJob) {
- j.cancel();
- }
- }
- new ForceGCJob().schedule();
- if (page.getTable() != null) {
- page.getTable().discardAllRows();
- }
- }
-
- @Override
- public void pageSearchFormStarted(IPageWithTable<?> p) throws ProcessingException {
- //nop
- }
-
- @Override
- public void pageCreated(IPage p) throws ProcessingException {
- //nop
- }
-
- @Override
- public String toString() {
- return "Small";
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client;
+
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
+
+/**
+ * dont cache table page search form contents, releaseUnusedPages before every page reload and force gc to free
+ * memory
+ */
+public class SmallMemoryPolicy extends AbstractMemoryPolicy {
+
+ /**
+ * clear table before loading new data, thus disabling "replaceRow" mechanism but saving memory
+ */
+ @Override
+ public void beforeTablePageLoadData(IPageWithTable<?> page) {
+ //make sure inactive outlines have no selection that "keeps" the pages
+ IDesktop desktop = ClientJob.getCurrentSession().getDesktop();
+ for (IOutline o : desktop.getAvailableOutlines()) {
+ if (o != desktop.getOutline()) {
+ o.selectNode(null);
+ }
+ }
+ ClientJob.getCurrentSession().getDesktop().releaseUnusedPages();
+ System.gc();
+ for (Job j : Job.getJobManager().find(ClientJob.class)) {
+ if (j instanceof ForceGCJob) {
+ j.cancel();
+ }
+ }
+ new ForceGCJob().schedule();
+ if (page.getTable() != null) {
+ page.getTable().discardAllRows();
+ }
+ }
+
+ @Override
+ public void pageSearchFormStarted(IPageWithTable<?> p) throws ProcessingException {
+ //nop
+ }
+
+ @Override
+ public void pageCreated(IPage p) throws ProcessingException {
+ //nop
+ }
+
+ @Override
+ public String toString() {
+ return "Small";
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/busy/AbstractBusyHandler.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/busy/AbstractBusyHandler.java
index a0f9226be2..d915a062c1 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/busy/AbstractBusyHandler.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/busy/AbstractBusyHandler.java
@@ -1,255 +1,255 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.busy;
-
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.QualifiedName;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ClientJob;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.client.ui.form.fields.smartfield.SmartTreeForm;
-
-/**
- * <p>
- * Shows blocking progress when {@link ClientSyncJob} or {@link ClientJob} with {@link ClientJob#isSync()} are doing a
- * long operation.
- * </p>
- * <p>
- * The decision whether or not the progress should be visible is made in the acceptor
- * {@link AbstractBusyHandler#acceptJob(Job)}
- * </p>
- * <p>
- * The strategy to display busy and blocking progress can be changed by overriding {@link #runBusy(Object)} and
- * {@link #runBusy(IRunnableWithProgress)}.
- * </p>
- * Implementations are ui specific an can be found in the swing, swt, rwt implementation sof scout.
- * <p>
- * This abstract implementation is Thread-safe.
- *
- * @author imo
- * @since 3.8
- */
-public abstract class AbstractBusyHandler implements IBusyHandler {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractBusyHandler.class);
- private static final QualifiedName TIMER_PROPERTY = new QualifiedName(AbstractBusyHandler.class.getName(), "timer");
- private static final QualifiedName BUSY_OPERATION_PROPERTY = new QualifiedName(AbstractBusyHandler.class.getName(), "busy");
-
- private final IClientSession m_session;
- private final Object m_stateLock = new Object();
- private final Set<Job> m_list = Collections.synchronizedSet(new HashSet<Job>());
- private long m_shortOperationMillis = 200L;
- private long m_longOperationMillis = 3000L;
- private boolean m_enabled = true;
-
- public AbstractBusyHandler(IClientSession session) {
- m_session = session;
- }
-
- @Override
- public boolean acceptJob(final Job job) {
- if (job == null) {
- return false;
- }
- if (job instanceof ClientJob && ((ClientJob) job).isSync()) {
- return true;
- }
- return false;
- }
-
- @Override
- public void onJobBegin(Job job) {
- addTimer(job);
- }
-
- @Override
- public void onJobEnd(Job job) {
- removeTimer(job);
- //avoid unnecessary locks
- if (isBusyOperationNoLock(job)) {
- removeBusyOperation(job);
- }
- }
-
- @Override
- public final Object getStateLock() {
- return m_stateLock;
- }
-
- @Override
- public void cancel() {
- synchronized (getStateLock()) {
- for (Job job : m_list) {
- try {
- job.cancel();
- }
- catch (Throwable t) {
- //nop
- }
- }
- }
- }
-
- /**
- * This method is called directly before calling {@link #runBusy()} and can be used to late-check if busy handling is
- * really necessary at that point in time.
- * <p>
- * The default checks if the job is in a smart tree operation and ignores busy, see
- * {@link SmartTreeForm#JOB_PROPERTY_LOAD_TREE}.
- */
- protected boolean shouldRunBusy(Job job) {
- Boolean b = (Boolean) job.getProperty(SmartTreeForm.JOB_PROPERTY_LOAD_TREE);
- if (b != null && b.booleanValue()) {
- return false;
- }
- return true;
- }
-
- /**
- * This method is called directly from the job listener after {@link #getShortOperationMillis()}.
- * <p>
- * You may call {@link #runDefaultBusy(Object, IProgressMonitor)} to use default handling.
- * <p>
- * {@link #getStateLock()} can be used synchronized to check {@link #isBusy()}
- * <p>
- * Be careful what to do, since this might be expensive. The default starts a {@link BusyJob} or a subclass of the
- * {@link BusyJob}
- */
- protected abstract void runBusy(Job job);
-
- /**
- * @retrun true if blocking is active
- */
- @Override
- public final boolean isBusy() {
- return m_list.size() > 0;
- }
-
- @Override
- public long getShortOperationMillis() {
- return m_shortOperationMillis;
- }
-
- public void setShortOperationMillis(long shortOperationMillis) {
- m_shortOperationMillis = shortOperationMillis;
- }
-
- @Override
- public long getLongOperationMillis() {
- return m_longOperationMillis;
- }
-
- public void setLongOperationMillis(long longOperationMillis) {
- m_longOperationMillis = longOperationMillis;
- }
-
- @Override
- public boolean isEnabled() {
- return m_enabled;
- }
-
- @Override
- public void setEnabled(boolean enabled) {
- m_enabled = enabled;
- }
-
- private void addTimer(Job job) {
- P_TimerJob t = new P_TimerJob(job);
- job.setProperty(TIMER_PROPERTY, t);
- t.schedule(getShortOperationMillis());
- }
-
- private void removeTimer(Job job) {
- P_TimerJob t = (P_TimerJob) job.getProperty(TIMER_PROPERTY);
- if (t != null) {
- t.cancel();
- job.setProperty(TIMER_PROPERTY, null);
- }
- }
-
- private P_TimerJob getTimer(Job job) {
- return (P_TimerJob) job.getProperty(TIMER_PROPERTY);
- }
-
- private void addBusyOperation(Job job) {
- int oldSize, newSize;
- synchronized (getStateLock()) {
- job.setProperty(BUSY_OPERATION_PROPERTY, "true");
- oldSize = m_list.size();
- m_list.add(job);
- newSize = m_list.size();
- getStateLock().notifyAll();
- }
- if (oldSize == 0 && newSize == 1) {
- runBusy(job);
- }
- }
-
- private void removeBusyOperation(Job job) {
- synchronized (getStateLock()) {
- job.setProperty(BUSY_OPERATION_PROPERTY, null);
- m_list.remove(job);
- getStateLock().notifyAll();
- }
- }
-
- private boolean isBusyOperationNoLock(Job job) {
- return "true".equals(job.getProperty(BUSY_OPERATION_PROPERTY));
- }
-
- private static boolean isJobActive(final Job job) {
- if (job.getState() != Job.RUNNING) {
- return false;
- }
- if (job instanceof ClientJob && ((ClientJob) job).isWaitFor()) {
- return false;
- }
- return true;
- }
-
- private class P_TimerJob extends Job {
- private final Job m_job;
-
- public P_TimerJob(Job job) {
- super("TimerJob");
- setSystem(true);
- m_job = job;
- }
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- if (P_TimerJob.this != getTimer(m_job)) {
- return Status.OK_STATUS;
- }
- removeTimer(m_job);
- if (isJobActive(m_job)) {
- if (!isEnabled() || !shouldRunBusy(m_job)) {
- return Status.OK_STATUS;
- }
- addBusyOperation(m_job);
- }
- //double check after queuing (avoid unnecessary locks)
- if (!isJobActive(m_job)) {
- removeBusyOperation(m_job);
- }
- return Status.OK_STATUS;
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.busy;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.QualifiedName;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ClientJob;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.client.ui.form.fields.smartfield.SmartTreeForm;
+
+/**
+ * <p>
+ * Shows blocking progress when {@link ClientSyncJob} or {@link ClientJob} with {@link ClientJob#isSync()} are doing a
+ * long operation.
+ * </p>
+ * <p>
+ * The decision whether or not the progress should be visible is made in the acceptor
+ * {@link AbstractBusyHandler#acceptJob(Job)}
+ * </p>
+ * <p>
+ * The strategy to display busy and blocking progress can be changed by overriding {@link #runBusy(Object)} and
+ * {@link #runBusy(IRunnableWithProgress)}.
+ * </p>
+ * Implementations are ui specific an can be found in the swing, swt, rwt implementation sof scout.
+ * <p>
+ * This abstract implementation is Thread-safe.
+ *
+ * @author imo
+ * @since 3.8
+ */
+public abstract class AbstractBusyHandler implements IBusyHandler {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractBusyHandler.class);
+ private static final QualifiedName TIMER_PROPERTY = new QualifiedName(AbstractBusyHandler.class.getName(), "timer");
+ private static final QualifiedName BUSY_OPERATION_PROPERTY = new QualifiedName(AbstractBusyHandler.class.getName(), "busy");
+
+ private final IClientSession m_session;
+ private final Object m_stateLock = new Object();
+ private final Set<Job> m_list = Collections.synchronizedSet(new HashSet<Job>());
+ private long m_shortOperationMillis = 200L;
+ private long m_longOperationMillis = 3000L;
+ private boolean m_enabled = true;
+
+ public AbstractBusyHandler(IClientSession session) {
+ m_session = session;
+ }
+
+ @Override
+ public boolean acceptJob(final Job job) {
+ if (job == null) {
+ return false;
+ }
+ if (job instanceof ClientJob && ((ClientJob) job).isSync()) {
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public void onJobBegin(Job job) {
+ addTimer(job);
+ }
+
+ @Override
+ public void onJobEnd(Job job) {
+ removeTimer(job);
+ //avoid unnecessary locks
+ if (isBusyOperationNoLock(job)) {
+ removeBusyOperation(job);
+ }
+ }
+
+ @Override
+ public final Object getStateLock() {
+ return m_stateLock;
+ }
+
+ @Override
+ public void cancel() {
+ synchronized (getStateLock()) {
+ for (Job job : m_list) {
+ try {
+ job.cancel();
+ }
+ catch (Throwable t) {
+ //nop
+ }
+ }
+ }
+ }
+
+ /**
+ * This method is called directly before calling {@link #runBusy()} and can be used to late-check if busy handling is
+ * really necessary at that point in time.
+ * <p>
+ * The default checks if the job is in a smart tree operation and ignores busy, see
+ * {@link SmartTreeForm#JOB_PROPERTY_LOAD_TREE}.
+ */
+ protected boolean shouldRunBusy(Job job) {
+ Boolean b = (Boolean) job.getProperty(SmartTreeForm.JOB_PROPERTY_LOAD_TREE);
+ if (b != null && b.booleanValue()) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * This method is called directly from the job listener after {@link #getShortOperationMillis()}.
+ * <p>
+ * You may call {@link #runDefaultBusy(Object, IProgressMonitor)} to use default handling.
+ * <p>
+ * {@link #getStateLock()} can be used synchronized to check {@link #isBusy()}
+ * <p>
+ * Be careful what to do, since this might be expensive. The default starts a {@link BusyJob} or a subclass of the
+ * {@link BusyJob}
+ */
+ protected abstract void runBusy(Job job);
+
+ /**
+ * @retrun true if blocking is active
+ */
+ @Override
+ public final boolean isBusy() {
+ return m_list.size() > 0;
+ }
+
+ @Override
+ public long getShortOperationMillis() {
+ return m_shortOperationMillis;
+ }
+
+ public void setShortOperationMillis(long shortOperationMillis) {
+ m_shortOperationMillis = shortOperationMillis;
+ }
+
+ @Override
+ public long getLongOperationMillis() {
+ return m_longOperationMillis;
+ }
+
+ public void setLongOperationMillis(long longOperationMillis) {
+ m_longOperationMillis = longOperationMillis;
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return m_enabled;
+ }
+
+ @Override
+ public void setEnabled(boolean enabled) {
+ m_enabled = enabled;
+ }
+
+ private void addTimer(Job job) {
+ P_TimerJob t = new P_TimerJob(job);
+ job.setProperty(TIMER_PROPERTY, t);
+ t.schedule(getShortOperationMillis());
+ }
+
+ private void removeTimer(Job job) {
+ P_TimerJob t = (P_TimerJob) job.getProperty(TIMER_PROPERTY);
+ if (t != null) {
+ t.cancel();
+ job.setProperty(TIMER_PROPERTY, null);
+ }
+ }
+
+ private P_TimerJob getTimer(Job job) {
+ return (P_TimerJob) job.getProperty(TIMER_PROPERTY);
+ }
+
+ private void addBusyOperation(Job job) {
+ int oldSize, newSize;
+ synchronized (getStateLock()) {
+ job.setProperty(BUSY_OPERATION_PROPERTY, "true");
+ oldSize = m_list.size();
+ m_list.add(job);
+ newSize = m_list.size();
+ getStateLock().notifyAll();
+ }
+ if (oldSize == 0 && newSize == 1) {
+ runBusy(job);
+ }
+ }
+
+ private void removeBusyOperation(Job job) {
+ synchronized (getStateLock()) {
+ job.setProperty(BUSY_OPERATION_PROPERTY, null);
+ m_list.remove(job);
+ getStateLock().notifyAll();
+ }
+ }
+
+ private boolean isBusyOperationNoLock(Job job) {
+ return "true".equals(job.getProperty(BUSY_OPERATION_PROPERTY));
+ }
+
+ private static boolean isJobActive(final Job job) {
+ if (job.getState() != Job.RUNNING) {
+ return false;
+ }
+ if (job instanceof ClientJob && ((ClientJob) job).isWaitFor()) {
+ return false;
+ }
+ return true;
+ }
+
+ private class P_TimerJob extends Job {
+ private final Job m_job;
+
+ public P_TimerJob(Job job) {
+ super("TimerJob");
+ setSystem(true);
+ m_job = job;
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ if (P_TimerJob.this != getTimer(m_job)) {
+ return Status.OK_STATUS;
+ }
+ removeTimer(m_job);
+ if (isJobActive(m_job)) {
+ if (!isEnabled() || !shouldRunBusy(m_job)) {
+ return Status.OK_STATUS;
+ }
+ addBusyOperation(m_job);
+ }
+ //double check after queuing (avoid unnecessary locks)
+ if (!isJobActive(m_job)) {
+ removeBusyOperation(m_job);
+ }
+ return Status.OK_STATUS;
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/busy/BusyJob.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/busy/BusyJob.java
index f2ae939731..e9975fd8d1 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/busy/BusyJob.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/busy/BusyJob.java
@@ -1,113 +1,113 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.busy;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-
-/**
- * This is the default busy job that runs the process of showing busy marker, blocking and canceling.
- * <p>
- * Subclass this job for custom handling.
- * <p>
- * The {@link #run(IProgressMonitor)} first calls {@link #runBusy(IProgressMonitor)} and then calls
- * {@link #runBlocking(IProgressMonitor)}
- *
- * @author imo
- * @since 3.8
- */
-public class BusyJob extends Job {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(BusyJob.class);
-
- private final IBusyHandler m_handler;
- private boolean m_cancelApplied;
-
- public BusyJob(String name, IBusyHandler handler) {
- super(name);
- m_handler = handler;
- }
-
- protected IBusyHandler getBusyHandler() {
- return m_handler;
- }
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- if (!getBusyHandler().isBusy() || !getBusyHandler().isEnabled()) {
- return Status.OK_STATUS;
- }
- runBusy(monitor);
- if (!getBusyHandler().isBusy() || !getBusyHandler().isEnabled()) {
- return Status.OK_STATUS;
- }
- runBlocking(monitor);
- return Status.OK_STATUS;
- }
-
- protected void runBusy(IProgressMonitor monitor) {
- IBusyHandler h = getBusyHandler();
- Object lock = h.getStateLock();
- long longOpTimestamp = System.currentTimeMillis() + h.getLongOperationMillis() - h.getShortOperationMillis();
- while (true) {
- synchronized (lock) {
- if (!h.isBusy()) {
- return;
- }
- if (!m_cancelApplied && monitor.isCanceled()) {
- m_cancelApplied = true;
- h.cancel();
- }
- if (System.currentTimeMillis() > longOpTimestamp) {
- return;
- }
- try {
- lock.wait(100);
- }
- catch (InterruptedException e) {
- return;
- }
- }
- }
- }
-
- protected void runBlocking(IProgressMonitor monitor) {
- IBusyHandler h = getBusyHandler();
- Object lock = h.getStateLock();
- try {
- monitor.beginTask(null, IProgressMonitor.UNKNOWN);
- while (true) {
- synchronized (lock) {
- if (!h.isBusy()) {
- return;
- }
- if (!m_cancelApplied && monitor.isCanceled()) {
- m_cancelApplied = true;
- h.cancel();
- }
- try {
- lock.wait(100);
- }
- catch (InterruptedException e) {
- return;
- }
- }
- }
- }
- finally {
- monitor.done();
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.busy;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+
+/**
+ * This is the default busy job that runs the process of showing busy marker, blocking and canceling.
+ * <p>
+ * Subclass this job for custom handling.
+ * <p>
+ * The {@link #run(IProgressMonitor)} first calls {@link #runBusy(IProgressMonitor)} and then calls
+ * {@link #runBlocking(IProgressMonitor)}
+ *
+ * @author imo
+ * @since 3.8
+ */
+public class BusyJob extends Job {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(BusyJob.class);
+
+ private final IBusyHandler m_handler;
+ private boolean m_cancelApplied;
+
+ public BusyJob(String name, IBusyHandler handler) {
+ super(name);
+ m_handler = handler;
+ }
+
+ protected IBusyHandler getBusyHandler() {
+ return m_handler;
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ if (!getBusyHandler().isBusy() || !getBusyHandler().isEnabled()) {
+ return Status.OK_STATUS;
+ }
+ runBusy(monitor);
+ if (!getBusyHandler().isBusy() || !getBusyHandler().isEnabled()) {
+ return Status.OK_STATUS;
+ }
+ runBlocking(monitor);
+ return Status.OK_STATUS;
+ }
+
+ protected void runBusy(IProgressMonitor monitor) {
+ IBusyHandler h = getBusyHandler();
+ Object lock = h.getStateLock();
+ long longOpTimestamp = System.currentTimeMillis() + h.getLongOperationMillis() - h.getShortOperationMillis();
+ while (true) {
+ synchronized (lock) {
+ if (!h.isBusy()) {
+ return;
+ }
+ if (!m_cancelApplied && monitor.isCanceled()) {
+ m_cancelApplied = true;
+ h.cancel();
+ }
+ if (System.currentTimeMillis() > longOpTimestamp) {
+ return;
+ }
+ try {
+ lock.wait(100);
+ }
+ catch (InterruptedException e) {
+ return;
+ }
+ }
+ }
+ }
+
+ protected void runBlocking(IProgressMonitor monitor) {
+ IBusyHandler h = getBusyHandler();
+ Object lock = h.getStateLock();
+ try {
+ monitor.beginTask(null, IProgressMonitor.UNKNOWN);
+ while (true) {
+ synchronized (lock) {
+ if (!h.isBusy()) {
+ return;
+ }
+ if (!m_cancelApplied && monitor.isCanceled()) {
+ m_cancelApplied = true;
+ h.cancel();
+ }
+ try {
+ lock.wait(100);
+ }
+ catch (InterruptedException e) {
+ return;
+ }
+ }
+ }
+ }
+ finally {
+ monitor.done();
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/busy/BusyManagerService.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/busy/BusyManagerService.java
index a98dcb93a2..390fa3500d 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/busy/BusyManagerService.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/busy/BusyManagerService.java
@@ -1,204 +1,204 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.busy;
-
-import org.eclipse.core.runtime.jobs.IJobChangeEvent;
-import org.eclipse.core.runtime.jobs.IJobChangeListener;
-import org.eclipse.core.runtime.jobs.IJobManager;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.core.runtime.jobs.JobChangeAdapter;
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ClientJob;
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.client.IClientSessionProvider;
-import org.eclipse.scout.rt.client.IJobChangeListenerEx;
-import org.eclipse.scout.rt.client.JobChangeAdapterEx;
-import org.eclipse.scout.service.AbstractService;
-import org.osgi.framework.ServiceRegistration;
-
-/**
- * The busy manager is the primary place to register/unregister {@link IBusyHandler} per {@link IClientSession}
- * <p>
- * This service is registered by default with priority -1000
- *
- * @author imo
- * @since 3.8
- */
-@Priority(-1000)
-public class BusyManagerService extends AbstractService implements IBusyManagerService {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(BusyManagerService.class);
- private static final String HANDLER_CLIENT_SESSION_KEY = IBusyHandler.class.getName();
-
- private final IJobChangeListener m_jobChangeListener;
- private final IJobChangeListenerEx m_jobChangeListenerEx;
- private JobManagerResumeThread m_jobManagerResumeThread;
-
- public BusyManagerService() {
- m_jobChangeListener = new P_JobChangeListener();
- m_jobChangeListenerEx = new P_JobChangeListenerEx();
- }
-
- @Override
- public void initializeService(ServiceRegistration registration) {
- super.initializeService(registration);
- Job.getJobManager().addJobChangeListener(m_jobChangeListener);
- //Bug in eclipse job manager: sometimes a delayed scheduled job is not run after the delay but remains sleeping forever.
- //To work around this issue, a call to IJobManager.resume() wakes up these jobs.
- m_jobManagerResumeThread = new JobManagerResumeThread();
- m_jobManagerResumeThread.start();
- }
-
- @Override
- public void disposeServices() {
- try {
- if (m_jobManagerResumeThread != null) {
- m_jobManagerResumeThread.cancel();
- }
- m_jobManagerResumeThread = null;
- Job.getJobManager().removeJobChangeListener(m_jobChangeListener);
- }
- finally {
- super.disposeServices();
- }
- }
-
- private IBusyHandler getHandlerInternal(Job job) {
- if (job instanceof IClientSessionProvider) {
- IClientSession session = ((IClientSessionProvider) job).getClientSession();
- return getHandler(session);
- }
- return null;
- }
-
- @Override
- public IBusyHandler getHandler(IClientSession session) {
- if (session != null) {
- return (IBusyHandler) session.getData(HANDLER_CLIENT_SESSION_KEY);
- }
- return null;
- }
-
- @Override
- public synchronized void register(IClientSession session, IBusyHandler handler) {
- if (session == null || handler == null) {
- return;
- }
- handler.setEnabled(true);
- session.setData(HANDLER_CLIENT_SESSION_KEY, handler);
- }
-
- @Override
- public synchronized void unregister(IClientSession session) {
- if (session == null) {
- return;
- }
- IBusyHandler handler = getHandler(session);
- if (handler != null) {
- handler.setEnabled(false);
- }
- session.setData(HANDLER_CLIENT_SESSION_KEY, null);
- }
-
- private class P_JobChangeListener extends JobChangeAdapter {
- @Override
- public void running(IJobChangeEvent event) {
- final Job job = event.getJob();
- IBusyHandler handler = getHandlerInternal(job);
- if (handler == null) {
- return;
- }
- if (!handler.acceptJob(job)) {
- return;
- }
- if (job instanceof ClientJob) {
- ((ClientJob) job).addJobChangeListenerEx(m_jobChangeListenerEx);
- }
- handler.onJobBegin(job);
- }
-
- @Override
- public void done(IJobChangeEvent event) {
- final Job job = event.getJob();
- IBusyHandler handler = getHandlerInternal(job);
- if (handler == null) {
- return;
- }
- if (!handler.acceptJob(job)) {
- return;
- }
- if (job instanceof ClientJob) {
- ((ClientJob) job).removeJobChangeListenerEx(m_jobChangeListenerEx);
- }
- handler.onJobEnd(job);
- }
- }
-
- private class P_JobChangeListenerEx extends JobChangeAdapterEx {
- @Override
- public void blockingConditionStart(IJobChangeEvent event) {
- final Job job = event.getJob();
- IBusyHandler handler = getHandlerInternal(job);
- if (handler == null) {
- return;
- }
- handler.onJobEnd(job);
- }
-
- @Override
- public void blockingConditionEnd(IJobChangeEvent event) {
- final Job job = event.getJob();
- IBusyHandler handler = getHandlerInternal(job);
- if (handler == null) {
- return;
- }
- handler.onJobBegin(job);
- }
- }
-
- private static class JobManagerResumeThread extends Thread {
-
- private boolean m_running = true;
-
- public JobManagerResumeThread() {
- super("JobManager-Resume");
- setDaemon(true);
- }
-
- public void cancel() {
- m_running = false;
- }
-
- @Override
- public void run() {
- while (true) {
- if (!m_running) {
- return;
- }
- try {
- Thread.sleep(2000);
- if (!m_running) {
- return;
- }
- IJobManager m = Job.getJobManager();
- if (m != null && !m.isSuspended()) {
- m.resume();
- }
- }
- catch (Throwable t) {
- //nop
- }
- }
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.busy;
+
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.core.runtime.jobs.IJobChangeListener;
+import org.eclipse.core.runtime.jobs.IJobManager;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.core.runtime.jobs.JobChangeAdapter;
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ClientJob;
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.client.IClientSessionProvider;
+import org.eclipse.scout.rt.client.IJobChangeListenerEx;
+import org.eclipse.scout.rt.client.JobChangeAdapterEx;
+import org.eclipse.scout.service.AbstractService;
+import org.osgi.framework.ServiceRegistration;
+
+/**
+ * The busy manager is the primary place to register/unregister {@link IBusyHandler} per {@link IClientSession}
+ * <p>
+ * This service is registered by default with priority -1000
+ *
+ * @author imo
+ * @since 3.8
+ */
+@Priority(-1000)
+public class BusyManagerService extends AbstractService implements IBusyManagerService {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(BusyManagerService.class);
+ private static final String HANDLER_CLIENT_SESSION_KEY = IBusyHandler.class.getName();
+
+ private final IJobChangeListener m_jobChangeListener;
+ private final IJobChangeListenerEx m_jobChangeListenerEx;
+ private JobManagerResumeThread m_jobManagerResumeThread;
+
+ public BusyManagerService() {
+ m_jobChangeListener = new P_JobChangeListener();
+ m_jobChangeListenerEx = new P_JobChangeListenerEx();
+ }
+
+ @Override
+ public void initializeService(ServiceRegistration registration) {
+ super.initializeService(registration);
+ Job.getJobManager().addJobChangeListener(m_jobChangeListener);
+ //Bug in eclipse job manager: sometimes a delayed scheduled job is not run after the delay but remains sleeping forever.
+ //To work around this issue, a call to IJobManager.resume() wakes up these jobs.
+ m_jobManagerResumeThread = new JobManagerResumeThread();
+ m_jobManagerResumeThread.start();
+ }
+
+ @Override
+ public void disposeServices() {
+ try {
+ if (m_jobManagerResumeThread != null) {
+ m_jobManagerResumeThread.cancel();
+ }
+ m_jobManagerResumeThread = null;
+ Job.getJobManager().removeJobChangeListener(m_jobChangeListener);
+ }
+ finally {
+ super.disposeServices();
+ }
+ }
+
+ private IBusyHandler getHandlerInternal(Job job) {
+ if (job instanceof IClientSessionProvider) {
+ IClientSession session = ((IClientSessionProvider) job).getClientSession();
+ return getHandler(session);
+ }
+ return null;
+ }
+
+ @Override
+ public IBusyHandler getHandler(IClientSession session) {
+ if (session != null) {
+ return (IBusyHandler) session.getData(HANDLER_CLIENT_SESSION_KEY);
+ }
+ return null;
+ }
+
+ @Override
+ public synchronized void register(IClientSession session, IBusyHandler handler) {
+ if (session == null || handler == null) {
+ return;
+ }
+ handler.setEnabled(true);
+ session.setData(HANDLER_CLIENT_SESSION_KEY, handler);
+ }
+
+ @Override
+ public synchronized void unregister(IClientSession session) {
+ if (session == null) {
+ return;
+ }
+ IBusyHandler handler = getHandler(session);
+ if (handler != null) {
+ handler.setEnabled(false);
+ }
+ session.setData(HANDLER_CLIENT_SESSION_KEY, null);
+ }
+
+ private class P_JobChangeListener extends JobChangeAdapter {
+ @Override
+ public void running(IJobChangeEvent event) {
+ final Job job = event.getJob();
+ IBusyHandler handler = getHandlerInternal(job);
+ if (handler == null) {
+ return;
+ }
+ if (!handler.acceptJob(job)) {
+ return;
+ }
+ if (job instanceof ClientJob) {
+ ((ClientJob) job).addJobChangeListenerEx(m_jobChangeListenerEx);
+ }
+ handler.onJobBegin(job);
+ }
+
+ @Override
+ public void done(IJobChangeEvent event) {
+ final Job job = event.getJob();
+ IBusyHandler handler = getHandlerInternal(job);
+ if (handler == null) {
+ return;
+ }
+ if (!handler.acceptJob(job)) {
+ return;
+ }
+ if (job instanceof ClientJob) {
+ ((ClientJob) job).removeJobChangeListenerEx(m_jobChangeListenerEx);
+ }
+ handler.onJobEnd(job);
+ }
+ }
+
+ private class P_JobChangeListenerEx extends JobChangeAdapterEx {
+ @Override
+ public void blockingConditionStart(IJobChangeEvent event) {
+ final Job job = event.getJob();
+ IBusyHandler handler = getHandlerInternal(job);
+ if (handler == null) {
+ return;
+ }
+ handler.onJobEnd(job);
+ }
+
+ @Override
+ public void blockingConditionEnd(IJobChangeEvent event) {
+ final Job job = event.getJob();
+ IBusyHandler handler = getHandlerInternal(job);
+ if (handler == null) {
+ return;
+ }
+ handler.onJobBegin(job);
+ }
+ }
+
+ private static class JobManagerResumeThread extends Thread {
+
+ private boolean m_running = true;
+
+ public JobManagerResumeThread() {
+ super("JobManager-Resume");
+ setDaemon(true);
+ }
+
+ public void cancel() {
+ m_running = false;
+ }
+
+ @Override
+ public void run() {
+ while (true) {
+ if (!m_running) {
+ return;
+ }
+ try {
+ Thread.sleep(2000);
+ if (!m_running) {
+ return;
+ }
+ IJobManager m = Job.getJobManager();
+ if (m != null && !m.isSuspended()) {
+ m.resume();
+ }
+ }
+ catch (Throwable t) {
+ //nop
+ }
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/busy/IBusyHandler.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/busy/IBusyHandler.java
index 02fb8a9d0a..03405a8b8c 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/busy/IBusyHandler.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/busy/IBusyHandler.java
@@ -1,57 +1,57 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.busy;
-
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.scout.rt.client.ClientJob;
-import org.eclipse.scout.rt.client.IClientSession;
-
-/**
- * Shows blocking progress on a long operation for a {@link IClientSession} {@link ClientJob} with respect to
- * {@link #acceptJob(Job)}s
- * <p>
- * The decision whether or not the progress should be visible is made in the acceptor
- * {@link IBusyHandler#acceptJob(Job)}
- *
- * @author imo
- * @since 3.8
- */
-public interface IBusyHandler {
-
- /**
- * Decides whether to block the ui based on that running job.
- */
- boolean acceptJob(final Job job);
-
- /**
- * callback when a job accepted by {@link #acceptJob(Job)} begun running
- */
- void onJobBegin(Job job);
-
- /**
- * callback when a job is done
- */
- void onJobEnd(Job job);
-
- boolean isBusy();
-
- Object getStateLock();
-
- void cancel();
-
- long getShortOperationMillis();
-
- long getLongOperationMillis();
-
- void setEnabled(boolean b);
-
- boolean isEnabled();
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.busy;
+
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.scout.rt.client.ClientJob;
+import org.eclipse.scout.rt.client.IClientSession;
+
+/**
+ * Shows blocking progress on a long operation for a {@link IClientSession} {@link ClientJob} with respect to
+ * {@link #acceptJob(Job)}s
+ * <p>
+ * The decision whether or not the progress should be visible is made in the acceptor
+ * {@link IBusyHandler#acceptJob(Job)}
+ *
+ * @author imo
+ * @since 3.8
+ */
+public interface IBusyHandler {
+
+ /**
+ * Decides whether to block the ui based on that running job.
+ */
+ boolean acceptJob(final Job job);
+
+ /**
+ * callback when a job accepted by {@link #acceptJob(Job)} begun running
+ */
+ void onJobBegin(Job job);
+
+ /**
+ * callback when a job is done
+ */
+ void onJobEnd(Job job);
+
+ boolean isBusy();
+
+ Object getStateLock();
+
+ void cancel();
+
+ long getShortOperationMillis();
+
+ long getLongOperationMillis();
+
+ void setEnabled(boolean b);
+
+ boolean isEnabled();
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/busy/IBusyManagerService.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/busy/IBusyManagerService.java
index 203fc90e1b..e287f09030 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/busy/IBusyManagerService.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/busy/IBusyManagerService.java
@@ -1,31 +1,31 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.busy;
-
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.service.IService2;
-
-/**
- * The busy manager service is global and is the primary place to register/unregister {@link IBusyHandler}s per
- * {@link IClientSession}
- *
- * @author imo
- * @since 3.8
- */
-public interface IBusyManagerService extends IService2 {
-
- void register(IClientSession session, IBusyHandler handler);
-
- void unregister(IClientSession session);
-
- IBusyHandler getHandler(IClientSession session);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.busy;
+
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.service.IService2;
+
+/**
+ * The busy manager service is global and is the primary place to register/unregister {@link IBusyHandler}s per
+ * {@link IClientSession}
+ *
+ * @author imo
+ * @since 3.8
+ */
+public interface IBusyManagerService extends IService2 {
+
+ void register(IClientSession session, IBusyHandler handler);
+
+ void unregister(IClientSession session);
+
+ IBusyHandler getHandler(IClientSession session);
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/internal/TestLock.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/internal/TestLock.java
index 5b7b5b578e..c9ce584c87 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/internal/TestLock.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/internal/TestLock.java
@@ -1,70 +1,70 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.internal;
-
-import java.util.concurrent.locks.ReentrantLock;
-
-public class TestLock {
-
- public static void main(String[] args) throws Exception {
- new TestLock().run();
- }
-
- private ReentrantLock m_lock = new ReentrantLock();
- private int expectedId;
-
- public void run() throws Exception {
- T[] a = new T[100];
- for (int n = 0; n < 10; n++) {
- System.out.println("Go " + n);
- for (int i = 0; i < a.length; i++) {
- a[i] = new T(i, "" + Math.random());
- }
- m_lock.lock();
- for (int i = 0; i < a.length; i++) {
- a[i].start();
- Thread.sleep(0, 1);
- }
- expectedId = 0;
- m_lock.unlock();
- for (int i = 0; i < a.length; i++) {
- a[i].join();
- }
- }
- }
-
- private class T extends Thread {
- private int m_id;
-
- public T(int id, String name) {
- super(name);
- m_id = id;
- }
-
- @Override
- public void run() {
- m_lock.lock();
- try {
- // System.out.println(m_id+" got lock, expected "+expectedId);
- if (m_id == expectedId) {
- expectedId++;
- }
- else {
- System.out.println("ERROR " + m_id + " expected " + expectedId);
- }
- }
- finally {
- m_lock.unlock();
- }
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.internal;
+
+import java.util.concurrent.locks.ReentrantLock;
+
+public class TestLock {
+
+ public static void main(String[] args) throws Exception {
+ new TestLock().run();
+ }
+
+ private ReentrantLock m_lock = new ReentrantLock();
+ private int expectedId;
+
+ public void run() throws Exception {
+ T[] a = new T[100];
+ for (int n = 0; n < 10; n++) {
+ System.out.println("Go " + n);
+ for (int i = 0; i < a.length; i++) {
+ a[i] = new T(i, "" + Math.random());
+ }
+ m_lock.lock();
+ for (int i = 0; i < a.length; i++) {
+ a[i].start();
+ Thread.sleep(0, 1);
+ }
+ expectedId = 0;
+ m_lock.unlock();
+ for (int i = 0; i < a.length; i++) {
+ a[i].join();
+ }
+ }
+ }
+
+ private class T extends Thread {
+ private int m_id;
+
+ public T(int id, String name) {
+ super(name);
+ m_id = id;
+ }
+
+ @Override
+ public void run() {
+ m_lock.lock();
+ try {
+ // System.out.println(m_id+" got lock, expected "+expectedId);
+ if (m_id == expectedId) {
+ expectedId++;
+ }
+ else {
+ System.out.println("ERROR " + m_id + " expected " + expectedId);
+ }
+ }
+ finally {
+ m_lock.unlock();
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/ClientProxyServiceFactory.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/ClientProxyServiceFactory.java
index 36e91dd60e..d0c3638892 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/ClientProxyServiceFactory.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/ClientProxyServiceFactory.java
@@ -1,162 +1,162 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ClientAsyncJob;
-import org.eclipse.scout.rt.client.ClientJob;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.client.IClientSessionProvider;
-import org.eclipse.scout.rt.client.servicetunnel.IServiceTunnel;
-import org.eclipse.scout.rt.client.servicetunnel.ServiceTunnelUtility;
-import org.eclipse.scout.rt.shared.TierState;
-import org.eclipse.scout.rt.shared.TierState.Tier;
-import org.eclipse.scout.service.CreateServiceImmediatelySchedulingRule;
-import org.eclipse.scout.service.IService;
-import org.eclipse.scout.service.IService2;
-import org.eclipse.scout.service.IServiceFactory;
-import org.eclipse.scout.service.ServiceConstants;
-import org.eclipse.scout.service.ServiceUtility;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.ServiceRegistration;
-
-/**
- * Service factory handling client proxy services based on a {@link IClientSession}. The service exists once per osgi
- * environment and is
- * cached persistent. The proxy is only available within a {@link Job} that
- * implements {@link IClientSessionProvider} with a compatible {@link IClientSession} type. see {@link ClientJob},
- * {@link ClientSyncJob}, {@link ClientAsyncJob} The proxy is tunneled through the {@link IServiceTunnel} provided on
- * the {@link IClientSession}.
- * <p>
- * The factory supports {@link ServiceConstants#SERVICE_SCOPE} and expects an {@link IClientSession} class
- * <p>
- * Visiblity: ClientJob.getCurrentSession()!=null && FE, see also {@link IService} for details
- * <p>
- * This proxy service factory can be used on an interface (default) where it creates an ad-hoc proxy on each operation
- * call, but it also can be used on an implementation, where it is similar to the {@link ClientServiceFactory} but
- * scopes as a proxy. This is useful when creating "pseudo" proxies as in AccessControlClientProxy etc.
- */
-public class ClientProxyServiceFactory implements IServiceFactory {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(ClientProxyServiceFactory.class);
-
- private Bundle m_bundle;
- private final Class<?> m_serviceClass;
- private String m_sessionType;
- private Class<? extends IClientSession> m_sessionClass;
- // lazy creation
- private Object m_serviceImpl;
- private final Object m_serviceLock = new Object();
-
- public ClientProxyServiceFactory(Class<?> serviceClass) {
- if (serviceClass == null) {
- throw new IllegalArgumentException("service type must not be null");
- }
- m_serviceClass = serviceClass;
- }
-
- @Override
- public void serviceRegistered(final ServiceRegistration registration) throws Throwable {
- if (!m_serviceClass.isInterface()) {
- Boolean createImmediately = (Boolean) registration.getReference().getProperty(ServiceConstants.SERVICE_CREATE_IMMEDIATELY);
- if (createImmediately != null && createImmediately) {
- Job job = new Job("create service " + m_serviceClass.getSimpleName()) {
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- updateClassCache(registration);
- updateInstanceCache(registration);
- return Status.OK_STATUS;
- }
- };
- job.setRule(new CreateServiceImmediatelySchedulingRule());
- job.schedule();
- }
- }
- }
-
- @Override
- public Object getService(Bundle bundle, ServiceRegistration registration) {
- updateClassCache(registration);
- IClientSession session = ClientJob.getCurrentSession(m_sessionClass);
- if (session != null) {
- if (TierState.get() == Tier.FrontEnd || TierState.get() == Tier.Undefined) {
- updateInstanceCache(registration);
- if (m_serviceClass.isInterface()) {
- Object service = ServiceTunnelUtility.createProxy(m_serviceClass, session.getServiceTunnel());
- return service;
- }
- else {
- return m_serviceImpl;
- }
- }
- }
- return ServiceUtility.NULL_SERVICE;
- }
-
- @Override
- public void ungetService(Bundle bundle, ServiceRegistration registration, Object service) {
- }
-
- @SuppressWarnings("unchecked")
- private void updateClassCache(ServiceRegistration registration) {
- synchronized (m_serviceLock) {
- if (m_bundle == null) {
- m_bundle = registration.getReference().getBundle();
- }
- if (m_sessionType == null) {
- m_sessionType = (String) registration.getReference().getProperty(ServiceConstants.SERVICE_SCOPE);
- }
- try {
- if (m_sessionClass == null) {
- if (m_sessionType == null) {
- m_sessionClass = IClientSession.class;
- }
- else {
- m_sessionClass = (Class<? extends IClientSession>) m_bundle.loadClass(m_sessionType);
- if (!IClientSession.class.isAssignableFrom(m_sessionClass)) {
- throw new IllegalArgumentException("session type must be a subtype of " + IClientSession.class + ": " + m_sessionType);
- }
- }
- }
- }
- catch (Throwable t) {
- LOG.error("Failed creating proxy class for " + m_serviceClass, t);
- }
- }
- }
-
- private void updateInstanceCache(ServiceRegistration registration) {
- synchronized (m_serviceLock) {
- if (m_serviceImpl == null) {
- try {
- if (!m_serviceClass.isInterface()) {
- m_serviceImpl = m_serviceClass.newInstance();
- if (m_serviceImpl instanceof IService2) {
- ((IService2) m_serviceImpl).initializeService(registration);
- }
- else if (m_serviceImpl instanceof IService) {
- ((IService) m_serviceImpl).initializeService();
- }
-
- }
- }
- catch (Throwable t) {
- LOG.error("Failed creating proxy instance for " + m_serviceClass, t);
- }
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ClientAsyncJob;
+import org.eclipse.scout.rt.client.ClientJob;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.client.IClientSessionProvider;
+import org.eclipse.scout.rt.client.servicetunnel.IServiceTunnel;
+import org.eclipse.scout.rt.client.servicetunnel.ServiceTunnelUtility;
+import org.eclipse.scout.rt.shared.TierState;
+import org.eclipse.scout.rt.shared.TierState.Tier;
+import org.eclipse.scout.service.CreateServiceImmediatelySchedulingRule;
+import org.eclipse.scout.service.IService;
+import org.eclipse.scout.service.IService2;
+import org.eclipse.scout.service.IServiceFactory;
+import org.eclipse.scout.service.ServiceConstants;
+import org.eclipse.scout.service.ServiceUtility;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.ServiceRegistration;
+
+/**
+ * Service factory handling client proxy services based on a {@link IClientSession}. The service exists once per osgi
+ * environment and is
+ * cached persistent. The proxy is only available within a {@link Job} that
+ * implements {@link IClientSessionProvider} with a compatible {@link IClientSession} type. see {@link ClientJob},
+ * {@link ClientSyncJob}, {@link ClientAsyncJob} The proxy is tunneled through the {@link IServiceTunnel} provided on
+ * the {@link IClientSession}.
+ * <p>
+ * The factory supports {@link ServiceConstants#SERVICE_SCOPE} and expects an {@link IClientSession} class
+ * <p>
+ * Visiblity: ClientJob.getCurrentSession()!=null && FE, see also {@link IService} for details
+ * <p>
+ * This proxy service factory can be used on an interface (default) where it creates an ad-hoc proxy on each operation
+ * call, but it also can be used on an implementation, where it is similar to the {@link ClientServiceFactory} but
+ * scopes as a proxy. This is useful when creating "pseudo" proxies as in AccessControlClientProxy etc.
+ */
+public class ClientProxyServiceFactory implements IServiceFactory {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(ClientProxyServiceFactory.class);
+
+ private Bundle m_bundle;
+ private final Class<?> m_serviceClass;
+ private String m_sessionType;
+ private Class<? extends IClientSession> m_sessionClass;
+ // lazy creation
+ private Object m_serviceImpl;
+ private final Object m_serviceLock = new Object();
+
+ public ClientProxyServiceFactory(Class<?> serviceClass) {
+ if (serviceClass == null) {
+ throw new IllegalArgumentException("service type must not be null");
+ }
+ m_serviceClass = serviceClass;
+ }
+
+ @Override
+ public void serviceRegistered(final ServiceRegistration registration) throws Throwable {
+ if (!m_serviceClass.isInterface()) {
+ Boolean createImmediately = (Boolean) registration.getReference().getProperty(ServiceConstants.SERVICE_CREATE_IMMEDIATELY);
+ if (createImmediately != null && createImmediately) {
+ Job job = new Job("create service " + m_serviceClass.getSimpleName()) {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ updateClassCache(registration);
+ updateInstanceCache(registration);
+ return Status.OK_STATUS;
+ }
+ };
+ job.setRule(new CreateServiceImmediatelySchedulingRule());
+ job.schedule();
+ }
+ }
+ }
+
+ @Override
+ public Object getService(Bundle bundle, ServiceRegistration registration) {
+ updateClassCache(registration);
+ IClientSession session = ClientJob.getCurrentSession(m_sessionClass);
+ if (session != null) {
+ if (TierState.get() == Tier.FrontEnd || TierState.get() == Tier.Undefined) {
+ updateInstanceCache(registration);
+ if (m_serviceClass.isInterface()) {
+ Object service = ServiceTunnelUtility.createProxy(m_serviceClass, session.getServiceTunnel());
+ return service;
+ }
+ else {
+ return m_serviceImpl;
+ }
+ }
+ }
+ return ServiceUtility.NULL_SERVICE;
+ }
+
+ @Override
+ public void ungetService(Bundle bundle, ServiceRegistration registration, Object service) {
+ }
+
+ @SuppressWarnings("unchecked")
+ private void updateClassCache(ServiceRegistration registration) {
+ synchronized (m_serviceLock) {
+ if (m_bundle == null) {
+ m_bundle = registration.getReference().getBundle();
+ }
+ if (m_sessionType == null) {
+ m_sessionType = (String) registration.getReference().getProperty(ServiceConstants.SERVICE_SCOPE);
+ }
+ try {
+ if (m_sessionClass == null) {
+ if (m_sessionType == null) {
+ m_sessionClass = IClientSession.class;
+ }
+ else {
+ m_sessionClass = (Class<? extends IClientSession>) m_bundle.loadClass(m_sessionType);
+ if (!IClientSession.class.isAssignableFrom(m_sessionClass)) {
+ throw new IllegalArgumentException("session type must be a subtype of " + IClientSession.class + ": " + m_sessionType);
+ }
+ }
+ }
+ }
+ catch (Throwable t) {
+ LOG.error("Failed creating proxy class for " + m_serviceClass, t);
+ }
+ }
+ }
+
+ private void updateInstanceCache(ServiceRegistration registration) {
+ synchronized (m_serviceLock) {
+ if (m_serviceImpl == null) {
+ try {
+ if (!m_serviceClass.isInterface()) {
+ m_serviceImpl = m_serviceClass.newInstance();
+ if (m_serviceImpl instanceof IService2) {
+ ((IService2) m_serviceImpl).initializeService(registration);
+ }
+ else if (m_serviceImpl instanceof IService) {
+ ((IService) m_serviceImpl).initializeService();
+ }
+
+ }
+ }
+ catch (Throwable t) {
+ LOG.error("Failed creating proxy instance for " + m_serviceClass, t);
+ }
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/ClientServiceFactory.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/ClientServiceFactory.java
index dda653a698..0a574d9bbc 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/ClientServiceFactory.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/ClientServiceFactory.java
@@ -1,144 +1,144 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ClientAsyncJob;
-import org.eclipse.scout.rt.client.ClientJob;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.client.IClientSessionProvider;
-import org.eclipse.scout.service.CreateServiceImmediatelySchedulingRule;
-import org.eclipse.scout.service.IService;
-import org.eclipse.scout.service.IService2;
-import org.eclipse.scout.service.IServiceFactory;
-import org.eclipse.scout.service.ServiceConstants;
-import org.eclipse.scout.service.ServiceUtility;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.ServiceRegistration;
-
-/**
- * Service factory handling client services based on a {@link IClientSession}.
- * The service exists once per osgi environment and is cached persistent. The
- * service is only available within a {@link Job} that implements {@link IClientSessionProvider} with a compatible
- * {@link IClientSession} type.
- * see {@link ClientJob}, {@link ClientSyncJob}, {@link ClientAsyncJob}
- * <p>
- * The factory supports {@link ServiceConstants#SERVICE_SCOPE} with an {@link IClientSession} class.<br>
- * The factory supports {@link ServiceConstants#SERVICE_CREATE_IMMEDIATELY}
- * <p>
- * Visiblity: ClientJob.getCurrentSession()!=null, see also {@link IService} for details
- */
-public class ClientServiceFactory implements IServiceFactory {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(ClientServiceFactory.class);
-
- private Bundle m_bundle;
- private final Class<?> m_serviceClass;
- private String m_sessionType;
- private Class<? extends IClientSession> m_sessionClass;
- // lazy creation
- private Object m_service;
- private final Object m_serviceLock = new Object();
-
- public ClientServiceFactory(Class<?> serviceClass) {
- if (serviceClass == null) {
- throw new IllegalArgumentException("service type must not be null");
- }
- if (serviceClass.isInterface()) {
- throw new IllegalArgumentException("service type must not be an interface: " + serviceClass);
- }
- m_serviceClass = serviceClass;
- }
-
- @Override
- public void serviceRegistered(final ServiceRegistration registration) throws Throwable {
- Boolean createImmediately = (Boolean) registration.getReference().getProperty(ServiceConstants.SERVICE_CREATE_IMMEDIATELY);
- if (createImmediately != null && createImmediately) {
- Job job = new Job("create service " + m_serviceClass.getSimpleName()) {
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- updateClassCache(registration);
- updateInstanceCache(registration);
- return Status.OK_STATUS;
- }
- };
- job.setRule(new CreateServiceImmediatelySchedulingRule());
- job.schedule();
- }
- }
-
- @Override
- public Object getService(Bundle bundle, ServiceRegistration registration) {
- updateClassCache(registration);
- IClientSession session = ClientJob.getCurrentSession(m_sessionClass);
- if (session != null) {
- updateInstanceCache(registration);
- return m_service;
- }
- return ServiceUtility.NULL_SERVICE;
- }
-
- @Override
- public void ungetService(Bundle bundle, ServiceRegistration registration, Object service) {
- }
-
- @SuppressWarnings("unchecked")
- private void updateClassCache(ServiceRegistration registration) {
- synchronized (m_serviceLock) {
- if (m_bundle == null) {
- m_bundle = registration.getReference().getBundle();
- }
- if (m_sessionType == null) {
- m_sessionType = (String) registration.getReference().getProperty(ServiceConstants.SERVICE_SCOPE);
- }
- try {
- if (m_sessionClass == null) {
- if (m_sessionType == null) {
- m_sessionClass = IClientSession.class;
- }
- else {
- m_sessionClass = (Class<? extends IClientSession>) m_bundle.loadClass(m_sessionType);
- if (!IClientSession.class.isAssignableFrom(m_sessionClass)) {
- throw new IllegalArgumentException("session type must be a subtype of " + IClientSession.class + ": " + m_sessionType);
- }
- }
- }
- }
- catch (Throwable t) {
- LOG.error("Failed creating class of " + m_serviceClass, t);
- }
- }
- }
-
- private void updateInstanceCache(ServiceRegistration registration) {
- synchronized (m_serviceLock) {
- if (m_service == null) {
- try {
- m_service = m_serviceClass.newInstance();
- if (m_service instanceof IService2) {
- ((IService2) m_service).initializeService(registration);
- }
- else if (m_service instanceof IService) {
- ((IService) m_service).initializeService();
- }
- }
- catch (Throwable t) {
- LOG.error("Failed creating instance of " + m_serviceClass, t);
- }
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ClientAsyncJob;
+import org.eclipse.scout.rt.client.ClientJob;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.client.IClientSessionProvider;
+import org.eclipse.scout.service.CreateServiceImmediatelySchedulingRule;
+import org.eclipse.scout.service.IService;
+import org.eclipse.scout.service.IService2;
+import org.eclipse.scout.service.IServiceFactory;
+import org.eclipse.scout.service.ServiceConstants;
+import org.eclipse.scout.service.ServiceUtility;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.ServiceRegistration;
+
+/**
+ * Service factory handling client services based on a {@link IClientSession}.
+ * The service exists once per osgi environment and is cached persistent. The
+ * service is only available within a {@link Job} that implements {@link IClientSessionProvider} with a compatible
+ * {@link IClientSession} type.
+ * see {@link ClientJob}, {@link ClientSyncJob}, {@link ClientAsyncJob}
+ * <p>
+ * The factory supports {@link ServiceConstants#SERVICE_SCOPE} with an {@link IClientSession} class.<br>
+ * The factory supports {@link ServiceConstants#SERVICE_CREATE_IMMEDIATELY}
+ * <p>
+ * Visiblity: ClientJob.getCurrentSession()!=null, see also {@link IService} for details
+ */
+public class ClientServiceFactory implements IServiceFactory {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(ClientServiceFactory.class);
+
+ private Bundle m_bundle;
+ private final Class<?> m_serviceClass;
+ private String m_sessionType;
+ private Class<? extends IClientSession> m_sessionClass;
+ // lazy creation
+ private Object m_service;
+ private final Object m_serviceLock = new Object();
+
+ public ClientServiceFactory(Class<?> serviceClass) {
+ if (serviceClass == null) {
+ throw new IllegalArgumentException("service type must not be null");
+ }
+ if (serviceClass.isInterface()) {
+ throw new IllegalArgumentException("service type must not be an interface: " + serviceClass);
+ }
+ m_serviceClass = serviceClass;
+ }
+
+ @Override
+ public void serviceRegistered(final ServiceRegistration registration) throws Throwable {
+ Boolean createImmediately = (Boolean) registration.getReference().getProperty(ServiceConstants.SERVICE_CREATE_IMMEDIATELY);
+ if (createImmediately != null && createImmediately) {
+ Job job = new Job("create service " + m_serviceClass.getSimpleName()) {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ updateClassCache(registration);
+ updateInstanceCache(registration);
+ return Status.OK_STATUS;
+ }
+ };
+ job.setRule(new CreateServiceImmediatelySchedulingRule());
+ job.schedule();
+ }
+ }
+
+ @Override
+ public Object getService(Bundle bundle, ServiceRegistration registration) {
+ updateClassCache(registration);
+ IClientSession session = ClientJob.getCurrentSession(m_sessionClass);
+ if (session != null) {
+ updateInstanceCache(registration);
+ return m_service;
+ }
+ return ServiceUtility.NULL_SERVICE;
+ }
+
+ @Override
+ public void ungetService(Bundle bundle, ServiceRegistration registration, Object service) {
+ }
+
+ @SuppressWarnings("unchecked")
+ private void updateClassCache(ServiceRegistration registration) {
+ synchronized (m_serviceLock) {
+ if (m_bundle == null) {
+ m_bundle = registration.getReference().getBundle();
+ }
+ if (m_sessionType == null) {
+ m_sessionType = (String) registration.getReference().getProperty(ServiceConstants.SERVICE_SCOPE);
+ }
+ try {
+ if (m_sessionClass == null) {
+ if (m_sessionType == null) {
+ m_sessionClass = IClientSession.class;
+ }
+ else {
+ m_sessionClass = (Class<? extends IClientSession>) m_bundle.loadClass(m_sessionType);
+ if (!IClientSession.class.isAssignableFrom(m_sessionClass)) {
+ throw new IllegalArgumentException("session type must be a subtype of " + IClientSession.class + ": " + m_sessionType);
+ }
+ }
+ }
+ }
+ catch (Throwable t) {
+ LOG.error("Failed creating class of " + m_serviceClass, t);
+ }
+ }
+ }
+
+ private void updateInstanceCache(ServiceRegistration registration) {
+ synchronized (m_serviceLock) {
+ if (m_service == null) {
+ try {
+ m_service = m_serviceClass.newInstance();
+ if (m_service instanceof IService2) {
+ ((IService2) m_service).initializeService(registration);
+ }
+ else if (m_service instanceof IService) {
+ ((IService) m_service).initializeService();
+ }
+ }
+ catch (Throwable t) {
+ LOG.error("Failed creating instance of " + m_serviceClass, t);
+ }
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/bookmark/BookmarkServiceEvent.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/bookmark/BookmarkServiceEvent.java
index f1bb1d29db..fccc073ce6 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/bookmark/BookmarkServiceEvent.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/bookmark/BookmarkServiceEvent.java
@@ -1,35 +1,35 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.bookmark;
-
-import java.util.EventObject;
-
-public class BookmarkServiceEvent extends EventObject {
- private static final long serialVersionUID = 1L;
-
- private int m_type;
-
- public static final int TYPE_CHANGED = 10;
-
- public BookmarkServiceEvent(IBookmarkService service, int type) {
- super(service);
- m_type = type;
- }
-
- public IBookmarkService getBookmarkService() {
- return (IBookmarkService) getSource();
- }
-
- public int getType() {
- return m_type;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.bookmark;
+
+import java.util.EventObject;
+
+public class BookmarkServiceEvent extends EventObject {
+ private static final long serialVersionUID = 1L;
+
+ private int m_type;
+
+ public static final int TYPE_CHANGED = 10;
+
+ public BookmarkServiceEvent(IBookmarkService service, int type) {
+ super(service);
+ m_type = type;
+ }
+
+ public IBookmarkService getBookmarkService() {
+ return (IBookmarkService) getSource();
+ }
+
+ public int getType() {
+ return m_type;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/bookmark/BookmarkServiceListener.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/bookmark/BookmarkServiceListener.java
index 84cb15a8aa..12fe648dd9 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/bookmark/BookmarkServiceListener.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/bookmark/BookmarkServiceListener.java
@@ -1,19 +1,19 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.bookmark;
-
-import java.util.EventListener;
-
-public interface BookmarkServiceListener extends EventListener {
-
- void bookmarksChanged(BookmarkServiceEvent e);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.bookmark;
+
+import java.util.EventListener;
+
+public interface BookmarkServiceListener extends EventListener {
+
+ void bookmarksChanged(BookmarkServiceEvent e);
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/bookmark/IBookmarkService.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/bookmark/IBookmarkService.java
index 3754731b60..baad38a271 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/bookmark/IBookmarkService.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/bookmark/IBookmarkService.java
@@ -1,67 +1,67 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.bookmark;
-
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.shared.services.common.bookmark.Bookmark;
-import org.eclipse.scout.rt.shared.services.common.bookmark.BookmarkData;
-import org.eclipse.scout.service.IService;
-
-@Priority(-3)
-public interface IBookmarkService extends IService {
-
- void addBookmarkServiceListener(BookmarkServiceListener listener);
-
- void removeBookmarkServiceListener(BookmarkServiceListener listener);
-
- /**
- * @return life reference to current model, this reference is always valid and will never change
- */
- BookmarkData getBookmarkData();
-
- /**
- * (re)load bookmarks from back-end
- */
- void loadBookmarks() throws ProcessingException;
-
- /**
- * store the BookmarkModel
- */
- void storeBookmarks() throws ProcessingException;
-
- /**
- * @return life array of bookmarks
- */
- Bookmark getStartBookmark();
-
- /**
- * don't saves automatically
- */
- void setStartBookmark() throws ProcessingException;
-
- /**
- * don't saves automatically
- */
- void deleteStartBookmark() throws ProcessingException;
-
- /**
- * Convenience method that simply calls {@link IDesktop#activateBookmark(Bookmark, false)}
- */
- void activate(Bookmark bm) throws ProcessingException;
-
- /**
- * Finds the given bookmark among the user's bookmark and updates it
- * with the currently visible view (analog to setting start-up view).
- */
- void updateBookmark(Bookmark bm) throws ProcessingException;
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.bookmark;
+
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.shared.services.common.bookmark.Bookmark;
+import org.eclipse.scout.rt.shared.services.common.bookmark.BookmarkData;
+import org.eclipse.scout.service.IService;
+
+@Priority(-3)
+public interface IBookmarkService extends IService {
+
+ void addBookmarkServiceListener(BookmarkServiceListener listener);
+
+ void removeBookmarkServiceListener(BookmarkServiceListener listener);
+
+ /**
+ * @return life reference to current model, this reference is always valid and will never change
+ */
+ BookmarkData getBookmarkData();
+
+ /**
+ * (re)load bookmarks from back-end
+ */
+ void loadBookmarks() throws ProcessingException;
+
+ /**
+ * store the BookmarkModel
+ */
+ void storeBookmarks() throws ProcessingException;
+
+ /**
+ * @return life array of bookmarks
+ */
+ Bookmark getStartBookmark();
+
+ /**
+ * don't saves automatically
+ */
+ void setStartBookmark() throws ProcessingException;
+
+ /**
+ * don't saves automatically
+ */
+ void deleteStartBookmark() throws ProcessingException;
+
+ /**
+ * Convenience method that simply calls {@link IDesktop#activateBookmark(Bookmark, false)}
+ */
+ void activate(Bookmark bm) throws ProcessingException;
+
+ /**
+ * Finds the given bookmark among the user's bookmark and updates it
+ * with the currently visible view (analog to setting start-up view).
+ */
+ void updateBookmark(Bookmark bm) throws ProcessingException;
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/bookmark/internal/BookmarkService.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/bookmark/internal/BookmarkService.java
index b98c4ce13e..583ba01588 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/bookmark/internal/BookmarkService.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/bookmark/internal/BookmarkService.java
@@ -1,243 +1,243 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.bookmark.internal;
-
-import java.util.ArrayList;
-import java.util.EventListener;
-import java.util.List;
-
-import org.eclipse.scout.commons.EventListenerList;
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ClientJob;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.client.services.common.bookmark.BookmarkServiceEvent;
-import org.eclipse.scout.rt.client.services.common.bookmark.BookmarkServiceListener;
-import org.eclipse.scout.rt.client.services.common.bookmark.IBookmarkService;
-import org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke;
-import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
-import org.eclipse.scout.rt.client.ui.desktop.bookmark.menu.ActivateBookmarkKeyStroke;
-import org.eclipse.scout.rt.shared.services.common.bookmark.Bookmark;
-import org.eclipse.scout.rt.shared.services.common.bookmark.BookmarkData;
-import org.eclipse.scout.rt.shared.services.common.bookmark.BookmarkFolder;
-import org.eclipse.scout.rt.shared.services.common.bookmark.IBookmarkStorageService;
-import org.eclipse.scout.rt.shared.services.common.bookmark.IBookmarkVisitor;
-import org.eclipse.scout.service.AbstractService;
-import org.eclipse.scout.service.SERVICES;
-
-/**
- * Client side service for bookmark support
- * <p>
- * Uses the server side {@link org.eclipse.scout.rt.client.ui.desktop.bookmark.IBookmarkStorageService} for data
- * persistence
- * <p>
- * service state is per {@link IClientSession} instance
- */
-@Priority(-3)
-public class BookmarkService extends AbstractService implements IBookmarkService {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(BookmarkService.class);
- private static final String SESSION_DATA_KEY = "bookmarkServiceState";
-
- public BookmarkService() {
- }
-
- private ServiceState getServiceState() {
- IClientSession session = ClientJob.getCurrentSession();
- if (session == null) {
- throw new IllegalStateException("null client session in current job context");
- }
- ServiceState data = (ServiceState) session.getData(SESSION_DATA_KEY);
- if (data == null) {
- data = new ServiceState();
- data.m_model = new BookmarkData();
- session.setData(SESSION_DATA_KEY, data);
- }
- return data;
- }
-
- @SuppressWarnings("deprecation")
- @Override
- public void initializeService() {
- super.initializeService();
- addBookmarkServiceListener(new BookmarkServiceListener() {
- @Override
- public void bookmarksChanged(BookmarkServiceEvent e) {
- handleBookmarksChangedInternal(e);
- }
- });
- }
-
- protected void handleBookmarksChangedInternal(BookmarkServiceEvent e) {
- switch (e.getType()) {
- case BookmarkServiceEvent.TYPE_CHANGED: {
- //refresh global keystrokes
- final ArrayList<Bookmark> list = new ArrayList<Bookmark>();
- IBookmarkVisitor visitor = new IBookmarkVisitor() {
- @Override
- public boolean visitFolder(List<BookmarkFolder> path) {
- return true;
- }
-
- @Override
- public boolean visitBookmark(List<BookmarkFolder> path, Bookmark b) {
- if (b.getKeyStroke() != null) {
- list.add(b);
- }
- return true;
- }
- };
- getBookmarkData().getUserBookmarks().visit(visitor);
- getBookmarkData().getGlobalBookmarks().visit(visitor);
- if (list.size() > 0) {
- IDesktop desktop = ClientSyncJob.getCurrentSession().getDesktop();
- if (desktop != null) {
- ArrayList<IKeyStroke> newKeyStrokes = new ArrayList<IKeyStroke>();
- for (IKeyStroke k : desktop.getKeyStrokes()) {
- if (k instanceof ActivateBookmarkKeyStroke) {
- //remove
- }
- else {
- newKeyStrokes.add(k);
- }
- }
- for (Bookmark b : list) {
- ActivateBookmarkKeyStroke k = new ActivateBookmarkKeyStroke(b);
- k.prepareAction();
- newKeyStrokes.add(k);
- }
- desktop.setKeyStrokes(newKeyStrokes.toArray(new IKeyStroke[newKeyStrokes.size()]));
- }
- }
- break;
- }
- }
- }
-
- @Override
- public void loadBookmarks() throws ProcessingException {
- IBookmarkStorageService storageService = SERVICES.getService(IBookmarkStorageService.class);
- importBookmarks(storageService.getBookmarkData());
- }
-
- @Override
- public void storeBookmarks() throws ProcessingException {
- ServiceState state = getServiceState();
- IBookmarkStorageService storageService = SERVICES.getService(IBookmarkStorageService.class);
- importBookmarks(storageService.storeBookmarkData(state.m_model));
- }
-
- @Override
- public void setStartBookmark() throws ProcessingException {
- ServiceState state = getServiceState();
- Bookmark b = ClientSyncJob.getCurrentSession().getDesktop().createBookmark();
- b.setKind(Bookmark.USER_BOOKMARK);
- state.m_model.getUserBookmarks().setStartupBookmark(b);
- }
-
- @Override
- public void deleteStartBookmark() throws ProcessingException {
- ServiceState state = getServiceState();
- state.m_model.getUserBookmarks().setStartupBookmark(null);
- }
-
- @Override
- public Bookmark getStartBookmark() {
- ServiceState state = getServiceState();
- Bookmark b = state.m_model.getUserBookmarks().getStartupBookmark();
- if (b == null) {
- b = state.m_model.getGlobalBookmarks().getStartupBookmark();
- }
- return b;
- }
-
- @Override
- public final BookmarkData getBookmarkData() {
- ServiceState state = getServiceState();
- return state.m_model;
- }
-
- @Override
- public void activate(Bookmark b) throws ProcessingException {
- if (b != null) {
- try {
- ClientSyncJob.getCurrentSession().getDesktop().activateBookmark(b, false);
- }
- catch (Throwable t) {
- LOG.error(null, t);
- }
- }
- }
-
- @Override
- public void updateBookmark(Bookmark bm) throws ProcessingException {
-
- // Create a new bookmark from the current view:
- Bookmark newBookmark = ClientSyncJob.getCurrentSession().getDesktop().createBookmark();
-
- // We want to preserve certain aspects of the old bookmark:
- int cachedKind = bm.getKind();
- String cachedIconId = bm.getIconId();
- String cachedTitle = bm.getTitle();
- String cachedKeyStroke = bm.getKeyStroke();
-
- // Fill the old bookmark with the data from the new one:
- bm.setSerializedData(newBookmark.getSerializedData());
- // "setSerializedData" overwrites all attributes - restore them from the old bookmark:
- bm.setKind(cachedKind);
- bm.setIconId(cachedIconId);
- bm.setTitle(cachedTitle);
- bm.setKeyStroke(cachedKeyStroke);
- // The bookmark's "text" should not be preserved - it is not editable by
- // the user and the only way to tell what the bookmark does.
- }
-
- @Override
- public void addBookmarkServiceListener(BookmarkServiceListener listener) {
- ServiceState state = getServiceState();
- state.m_listenerList.add(BookmarkServiceListener.class, listener);
- }
-
- @Override
- public void removeBookmarkServiceListener(BookmarkServiceListener listener) {
- ServiceState state = getServiceState();
- state.m_listenerList.remove(BookmarkServiceListener.class, listener);
- }
-
- private void fireBookmarksChanged() {
- BookmarkServiceEvent e = new BookmarkServiceEvent(this, BookmarkServiceEvent.TYPE_CHANGED);
- fireBookmarkSeviceEvent(e);
- }
-
- private void fireBookmarkSeviceEvent(BookmarkServiceEvent e) {
- ServiceState state = getServiceState();
- EventListener[] a = state.m_listenerList.getListeners(BookmarkServiceListener.class);
- if (a != null) {
- for (int i = 0; i < a.length; i++) {
- ((BookmarkServiceListener) a[i]).bookmarksChanged(e);
- }
- }
- }
-
- private void importBookmarks(BookmarkData model) throws ProcessingException {
- ServiceState state = getServiceState();
- state.m_model.setUserBookmarks(model.getUserBookmarks());
- state.m_model.setGlobalBookmarks(model.getGlobalBookmarks());
- fireBookmarksChanged();
- }
-
- private static class ServiceState {
- EventListenerList m_listenerList = new EventListenerList();
- BookmarkData m_model;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.bookmark.internal;
+
+import java.util.ArrayList;
+import java.util.EventListener;
+import java.util.List;
+
+import org.eclipse.scout.commons.EventListenerList;
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ClientJob;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.client.services.common.bookmark.BookmarkServiceEvent;
+import org.eclipse.scout.rt.client.services.common.bookmark.BookmarkServiceListener;
+import org.eclipse.scout.rt.client.services.common.bookmark.IBookmarkService;
+import org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke;
+import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
+import org.eclipse.scout.rt.client.ui.desktop.bookmark.menu.ActivateBookmarkKeyStroke;
+import org.eclipse.scout.rt.shared.services.common.bookmark.Bookmark;
+import org.eclipse.scout.rt.shared.services.common.bookmark.BookmarkData;
+import org.eclipse.scout.rt.shared.services.common.bookmark.BookmarkFolder;
+import org.eclipse.scout.rt.shared.services.common.bookmark.IBookmarkStorageService;
+import org.eclipse.scout.rt.shared.services.common.bookmark.IBookmarkVisitor;
+import org.eclipse.scout.service.AbstractService;
+import org.eclipse.scout.service.SERVICES;
+
+/**
+ * Client side service for bookmark support
+ * <p>
+ * Uses the server side {@link org.eclipse.scout.rt.client.ui.desktop.bookmark.IBookmarkStorageService} for data
+ * persistence
+ * <p>
+ * service state is per {@link IClientSession} instance
+ */
+@Priority(-3)
+public class BookmarkService extends AbstractService implements IBookmarkService {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(BookmarkService.class);
+ private static final String SESSION_DATA_KEY = "bookmarkServiceState";
+
+ public BookmarkService() {
+ }
+
+ private ServiceState getServiceState() {
+ IClientSession session = ClientJob.getCurrentSession();
+ if (session == null) {
+ throw new IllegalStateException("null client session in current job context");
+ }
+ ServiceState data = (ServiceState) session.getData(SESSION_DATA_KEY);
+ if (data == null) {
+ data = new ServiceState();
+ data.m_model = new BookmarkData();
+ session.setData(SESSION_DATA_KEY, data);
+ }
+ return data;
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public void initializeService() {
+ super.initializeService();
+ addBookmarkServiceListener(new BookmarkServiceListener() {
+ @Override
+ public void bookmarksChanged(BookmarkServiceEvent e) {
+ handleBookmarksChangedInternal(e);
+ }
+ });
+ }
+
+ protected void handleBookmarksChangedInternal(BookmarkServiceEvent e) {
+ switch (e.getType()) {
+ case BookmarkServiceEvent.TYPE_CHANGED: {
+ //refresh global keystrokes
+ final ArrayList<Bookmark> list = new ArrayList<Bookmark>();
+ IBookmarkVisitor visitor = new IBookmarkVisitor() {
+ @Override
+ public boolean visitFolder(List<BookmarkFolder> path) {
+ return true;
+ }
+
+ @Override
+ public boolean visitBookmark(List<BookmarkFolder> path, Bookmark b) {
+ if (b.getKeyStroke() != null) {
+ list.add(b);
+ }
+ return true;
+ }
+ };
+ getBookmarkData().getUserBookmarks().visit(visitor);
+ getBookmarkData().getGlobalBookmarks().visit(visitor);
+ if (list.size() > 0) {
+ IDesktop desktop = ClientSyncJob.getCurrentSession().getDesktop();
+ if (desktop != null) {
+ ArrayList<IKeyStroke> newKeyStrokes = new ArrayList<IKeyStroke>();
+ for (IKeyStroke k : desktop.getKeyStrokes()) {
+ if (k instanceof ActivateBookmarkKeyStroke) {
+ //remove
+ }
+ else {
+ newKeyStrokes.add(k);
+ }
+ }
+ for (Bookmark b : list) {
+ ActivateBookmarkKeyStroke k = new ActivateBookmarkKeyStroke(b);
+ k.prepareAction();
+ newKeyStrokes.add(k);
+ }
+ desktop.setKeyStrokes(newKeyStrokes.toArray(new IKeyStroke[newKeyStrokes.size()]));
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ @Override
+ public void loadBookmarks() throws ProcessingException {
+ IBookmarkStorageService storageService = SERVICES.getService(IBookmarkStorageService.class);
+ importBookmarks(storageService.getBookmarkData());
+ }
+
+ @Override
+ public void storeBookmarks() throws ProcessingException {
+ ServiceState state = getServiceState();
+ IBookmarkStorageService storageService = SERVICES.getService(IBookmarkStorageService.class);
+ importBookmarks(storageService.storeBookmarkData(state.m_model));
+ }
+
+ @Override
+ public void setStartBookmark() throws ProcessingException {
+ ServiceState state = getServiceState();
+ Bookmark b = ClientSyncJob.getCurrentSession().getDesktop().createBookmark();
+ b.setKind(Bookmark.USER_BOOKMARK);
+ state.m_model.getUserBookmarks().setStartupBookmark(b);
+ }
+
+ @Override
+ public void deleteStartBookmark() throws ProcessingException {
+ ServiceState state = getServiceState();
+ state.m_model.getUserBookmarks().setStartupBookmark(null);
+ }
+
+ @Override
+ public Bookmark getStartBookmark() {
+ ServiceState state = getServiceState();
+ Bookmark b = state.m_model.getUserBookmarks().getStartupBookmark();
+ if (b == null) {
+ b = state.m_model.getGlobalBookmarks().getStartupBookmark();
+ }
+ return b;
+ }
+
+ @Override
+ public final BookmarkData getBookmarkData() {
+ ServiceState state = getServiceState();
+ return state.m_model;
+ }
+
+ @Override
+ public void activate(Bookmark b) throws ProcessingException {
+ if (b != null) {
+ try {
+ ClientSyncJob.getCurrentSession().getDesktop().activateBookmark(b, false);
+ }
+ catch (Throwable t) {
+ LOG.error(null, t);
+ }
+ }
+ }
+
+ @Override
+ public void updateBookmark(Bookmark bm) throws ProcessingException {
+
+ // Create a new bookmark from the current view:
+ Bookmark newBookmark = ClientSyncJob.getCurrentSession().getDesktop().createBookmark();
+
+ // We want to preserve certain aspects of the old bookmark:
+ int cachedKind = bm.getKind();
+ String cachedIconId = bm.getIconId();
+ String cachedTitle = bm.getTitle();
+ String cachedKeyStroke = bm.getKeyStroke();
+
+ // Fill the old bookmark with the data from the new one:
+ bm.setSerializedData(newBookmark.getSerializedData());
+ // "setSerializedData" overwrites all attributes - restore them from the old bookmark:
+ bm.setKind(cachedKind);
+ bm.setIconId(cachedIconId);
+ bm.setTitle(cachedTitle);
+ bm.setKeyStroke(cachedKeyStroke);
+ // The bookmark's "text" should not be preserved - it is not editable by
+ // the user and the only way to tell what the bookmark does.
+ }
+
+ @Override
+ public void addBookmarkServiceListener(BookmarkServiceListener listener) {
+ ServiceState state = getServiceState();
+ state.m_listenerList.add(BookmarkServiceListener.class, listener);
+ }
+
+ @Override
+ public void removeBookmarkServiceListener(BookmarkServiceListener listener) {
+ ServiceState state = getServiceState();
+ state.m_listenerList.remove(BookmarkServiceListener.class, listener);
+ }
+
+ private void fireBookmarksChanged() {
+ BookmarkServiceEvent e = new BookmarkServiceEvent(this, BookmarkServiceEvent.TYPE_CHANGED);
+ fireBookmarkSeviceEvent(e);
+ }
+
+ private void fireBookmarkSeviceEvent(BookmarkServiceEvent e) {
+ ServiceState state = getServiceState();
+ EventListener[] a = state.m_listenerList.getListeners(BookmarkServiceListener.class);
+ if (a != null) {
+ for (int i = 0; i < a.length; i++) {
+ ((BookmarkServiceListener) a[i]).bookmarksChanged(e);
+ }
+ }
+ }
+
+ private void importBookmarks(BookmarkData model) throws ProcessingException {
+ ServiceState state = getServiceState();
+ state.m_model.setUserBookmarks(model.getUserBookmarks());
+ state.m_model.setGlobalBookmarks(model.getGlobalBookmarks());
+ fireBookmarksChanged();
+ }
+
+ private static class ServiceState {
+ EventListenerList m_listenerList = new EventListenerList();
+ BookmarkData m_model;
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/bookmark/internal/BookmarkUtility.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/bookmark/internal/BookmarkUtility.java
index 273c69dfc6..37275eafe4 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/bookmark/internal/BookmarkUtility.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/bookmark/internal/BookmarkUtility.java
@@ -1,771 +1,771 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.bookmark.internal;
-
-import java.io.ByteArrayOutputStream;
-import java.io.ObjectOutputStream;
-import java.lang.reflect.Array;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.TreeMap;
-import java.util.zip.CRC32;
-
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.commons.CompositeObject;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.exception.ProcessingStatus;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.basic.table.ColumnSet;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.customizer.ITableCustomizer;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
-import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithNodes;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.ISearchForm;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.services.common.bookmark.AbstractPageState;
-import org.eclipse.scout.rt.shared.services.common.bookmark.Bookmark;
-import org.eclipse.scout.rt.shared.services.common.bookmark.NodePageState;
-import org.eclipse.scout.rt.shared.services.common.bookmark.TableColumnState;
-import org.eclipse.scout.rt.shared.services.common.bookmark.TablePageState;
-import org.eclipse.scout.rt.shared.services.common.jdbc.SearchFilter;
-
-public final class BookmarkUtility {
-
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(BookmarkUtility.class);
-
- private BookmarkUtility() {
- }
-
- public static IOutline resolveOutline(IOutline[] outlines, String className) {
- if (className == null) {
- return null;
- }
- // pass 1: fully qualified name
- for (IOutline o : outlines) {
- if (o.getClass().getName().equals(className)) {
- return o;
- }
- }
- // pass 2: simple name, not case sensitive
- String simpleClassName = className.replaceAll("^.*\\.", "");
- for (IOutline o : outlines) {
- if (o.getClass().getSimpleName().equalsIgnoreCase(simpleClassName)) {
- return o;
- }
- }
- return null;
- }
-
- /**
- * @param columns
- * is the set of available columns to search in
- * @param className
- * is the columnId, simple class name or class name of the columns to find
- */
- public static IColumn resolveColumn(IColumn[] columns, String identifier) {
- if (identifier == null) {
- return null;
- }
- // pass 1: fully qualified name
- for (IColumn c : columns) {
- if (identifier.equals(c.getClass().getName())) {
- return c;
- }
- }
- // pass 2: columnId
- for (IColumn c : columns) {
- if (identifier.equals(c.getColumnId())) {
- return c;
- }
- }
- // pass 3: simple name, not case sensitive
- String simpleClassName = identifier.replaceAll("^.*\\.", "");
- for (IColumn c : columns) {
- if (simpleClassName.equalsIgnoreCase(c.getClass().getSimpleName())) {
- return c;
- }
- }
- return null;
- }
-
- public static IPage resolvePage(IPage[] pages, String className, String userPreferenceContext) {
- if (className == null) {
- return null;
- }
- TreeMap<CompositeObject, IPage> sortMap = new TreeMap<CompositeObject, IPage>();
- String simpleClassName = className.replaceAll("^.*\\.", "");
- int index = 0;
- for (IPage p : pages) {
- int classNameScore = 0;
- int userPreferenceContextScore = 0;
- if (p.getClass().getName().equals(className)) {
- classNameScore = -2;
- }
- else if (p.getClass().getSimpleName().equalsIgnoreCase(simpleClassName)) {
- classNameScore = -1;
- }
- if (userPreferenceContext == null || userPreferenceContext.equalsIgnoreCase(p.getUserPreferenceContext())) {
- userPreferenceContextScore = -1;
- }
- if (classNameScore != 0 && userPreferenceContextScore != 0) {
- sortMap.put(new CompositeObject(classNameScore, userPreferenceContextScore, index), p);
- }
- index++;
- }
- if (sortMap.isEmpty()) {
- return null;
- }
- CompositeObject bestMatchingKey = sortMap.firstKey();
- IPage bestMatchingPage = sortMap.remove(bestMatchingKey);
- if (!sortMap.isEmpty()) {
- // check ambiguity
- CompositeObject nextKey = sortMap.firstKey();
- if (CompareUtility.equals(bestMatchingKey.getComponent(0), nextKey.getComponent(0)) && CompareUtility.equals(bestMatchingKey.getComponent(1), nextKey.getComponent(1))) {
- LOG.warn("More than one pages found for page class [" + className + "] and user preference context [" + userPreferenceContext + "]");
- }
- }
- return bestMatchingPage;
- }
-
- /**
- * intercept objects that are not remoting-capable or not serializable and
- * replace by strings
- */
- public static Object[] makeSerializableKeys(Object[] a) {
- return (Object[]) makeSerializableKey(a);
- }
-
- public static Object makeSerializableKey(Object o) {
- if (o == null) {
- return o;
- }
- else if (o instanceof Number) {
- return o;
- }
- else if (o instanceof String) {
- return o;
- }
- else if (o instanceof Boolean) {
- return o;
- }
- else if (o instanceof Date) {
- return o;
- }
- else if (o.getClass().isArray()) {
- ArrayList<Integer> dimList = new ArrayList<Integer>();
- Class xc = o.getClass();
- Object xo = o;
- while (xc.isArray()) {
- int len = xo != null ? Array.getLength(xo) : 0;
- dimList.add(len);
- xc = xc.getComponentType();
- if (xo != null && len > 0) {
- xo = Array.get(xo, 0);
- }
- }
- int[] dim = new int[dimList.size()];
- for (int i = 0; i < dim.length; i++) {
- dim[i] = dimList.get(i);
- }
- Object b = Array.newInstance(makeSerializableClass(xc), dim);
- for (int i = 0; i < dim[0]; i++) {
- Array.set(b, i, makeSerializableKey(Array.get(o, i)));
- }
- return b;
- }
- else {
- return o.toString();
- }
- }
-
- /**
- * return String.class for classes that are not remoting-capable or not
- * serializable
- */
- public static Class makeSerializableClass(Class c) {
- if (c == null) {
- throw new IllegalArgumentException("class must not be null");
- }
- if (c.isArray()) {
- throw new IllegalArgumentException("class must not be an array class");
- }
- if (c.isPrimitive()) {
- return c;
- }
- else if (Number.class.isAssignableFrom(c)) {
- return c;
- }
- else if (String.class.isAssignableFrom(c)) {
- return c;
- }
- else if (Boolean.class.isAssignableFrom(c)) {
- return c;
- }
- else if (Date.class.isAssignableFrom(c)) {
- return c;
- }
- else if (Object.class == c) {
- return c;
- }
- else {
- return String.class;
- }
- }
-
- public static void activateBookmark(IDesktop desktop, Bookmark bm, boolean forceReload) throws ProcessingException {
- if (bm.getOutlineClassName() == null) {
- return;
- }
- IOutline outline = BookmarkUtility.resolveOutline(desktop.getAvailableOutlines(), bm.getOutlineClassName());
- if (outline == null) {
- throw new ProcessingException("outline '" + bm.getOutlineClassName() + "' was not found");
- }
- if (!(outline.isVisible() && outline.isEnabled())) {
- throw new ProcessingException("activate outline " + outline.getTitle() + " denied");
- }
- desktop.setOutline(outline);
- try {
- outline.setTreeChanging(true);
- //
- IPage parentPage = outline.getRootPage();
- boolean pathFullyRestored = true;
- List<AbstractPageState> path = bm.getPath();
- AbstractPageState parentPageState = path.get(0);
- boolean resetViewAndWarnOnFail = bm.getId() != 0;
- for (int i = 1; i < path.size(); i++) {
- // try to find correct child page (next parentPage)
- IPage childPage = null;
- AbstractPageState childState = path.get(i);
- if (parentPageState instanceof TablePageState) {
- TablePageState tablePageState = (TablePageState) parentPageState;
- if (parentPage instanceof IPageWithTable) {
- IPageWithTable tablePage = (IPageWithTable) parentPage;
- childPage = bmLoadTablePage(tablePage, tablePageState, false, resetViewAndWarnOnFail);
- }
- }
- else if (parentPageState instanceof NodePageState) {
- NodePageState nodePageState = (NodePageState) parentPageState;
- if (parentPage instanceof IPageWithNodes) {
- IPageWithNodes nodePage = (IPageWithNodes) parentPage;
- childPage = bmLoadNodePage(nodePage, nodePageState, childState, resetViewAndWarnOnFail);
- }
- }
- // next
- if (childPage != null) {
- parentPage = childPage;
- parentPageState = childState;
- }
- else if (i < path.size()) {
- pathFullyRestored = false;
- break;
- }
- }
- if (pathFullyRestored) {
- if (parentPageState instanceof TablePageState && parentPage instanceof IPageWithTable) {
- bmLoadTablePage((IPageWithTable) parentPage, (TablePageState) parentPageState, true, resetViewAndWarnOnFail);
- }
- else if (parentPage instanceof IPageWithNodes) {
- bmLoadNodePage((IPageWithNodes) parentPage, (NodePageState) parentPageState, null, resetViewAndWarnOnFail);
- }
- }
- /*
- * Expansions of the restored tree path
- */
- IPage p = parentPage;
- // last element
- if (pathFullyRestored && parentPageState.isExpanded() != null) {
- p.setExpanded(parentPageState.isExpanded());
- }
- else {
- if (!(p instanceof IPageWithTable)) {
- p.setExpanded(true);
- }
- }
- // ancestor elements
- p = p.getParentPage();
- while (p != null) {
- p.setExpanded(true);
- p = p.getParentPage();
- }
- outline.selectNode(parentPage, false);
- }
- finally {
- outline.setTreeChanging(false);
- }
- }
-
- /**
- * Constructs a list of {@link TableColumnState} objects which
- * describe the set of columns of the given {@link ITable}.
- *
- * @param table
- * The table with the columns to back-up.
- * @return A {@link List} of {@link TableColumnState} objects that
- * can be restored via {@link #restoreTableColumns(ITable, List)}
- */
- public static List<TableColumnState> backupTableColumns(ITable table) {
- ArrayList<TableColumnState> allColumns = new ArrayList<TableColumnState>();
- ColumnSet columnSet = table.getColumnSet();
- //add all columns but in user order
- for (IColumn<?> c : columnSet.getAllColumnsInUserOrder()) {
- TableColumnState colState = new TableColumnState();
- colState.setColumnClassName(c.getColumnId());
- colState.setDisplayable(c.isDisplayable());
- colState.setVisible(c.isDisplayable() && c.isVisible());
- colState.setWidth(c.getWidth());
- if (columnSet.isUserSortColumn(c) && c.isSortExplicit()) {
- int sortOrder = columnSet.getSortColumnIndex(c);
- if (sortOrder >= 0) {
- colState.setSortOrder(sortOrder);
- colState.setSortAscending(c.isSortAscending());
- }
- else {
- colState.setSortOrder(-1);
- }
- }
- if (table.getColumnFilterManager() != null && c.isColumnFilterActive()) {
- colState.setColumnFilterData(table.getColumnFilterManager().getSerializedFilter(c));
- }
- allColumns.add(colState);
- }
- return allColumns;
- }
-
- /**
- * Restores a tables columns from the given list of {@link TableColumnState} objects.
- *
- * @param table
- * The table to be restored.
- * @param oldColumns
- * A {@link List} of {@link TableColumnState} objects to
- * restore. Such can be retrieved by the {@link #backupTableColumns(ITable)} method.
- */
- public static void restoreTableColumns(ITable table, List<TableColumnState> oldColumns) throws ProcessingException {
- if (oldColumns != null && oldColumns.size() > 0 && table != null) {
- ColumnSet columnSet = table.getColumnSet();
- // visible columns and width
- ArrayList<IColumn> visibleColumns = new ArrayList<IColumn>();
- for (TableColumnState colState : oldColumns) {
- //legacy support: null=true
- if (colState.getVisible() == null || colState.getVisible()) {
- IColumn col = resolveColumn(columnSet.getDisplayableColumns(), colState.getClassName());
- if (col != null && col.isDisplayable()) {
- if (colState.getWidth() > 0) {
- col.setWidth(colState.getWidth());
- }
- visibleColumns.add(col);
- }
- }
- }
- List<IColumn> existingVisibleCols = Arrays.asList(columnSet.getVisibleColumns());
- if (!existingVisibleCols.equals(visibleColumns)) {
- columnSet.setVisibleColumns(visibleColumns.toArray(new IColumn[0]));
- }
- // filters
- if (table.getColumnFilterManager() != null) {
- // If a column filter was set, but did not have one before
- // the change, it will not be reset.
- // So reset all column filters beforehand:
- table.getColumnFilterManager().reset();
- for (TableColumnState colState : oldColumns) {
- if (colState.getColumnFilterData() != null) {
- IColumn col = BookmarkUtility.resolveColumn(columnSet.getColumns(), colState.getClassName());
- if (col != null) {
- table.getColumnFilterManager().setSerializedFilter(colState.getColumnFilterData(), col);
- }
- }
- }
- }
- //sort order (only respect visible and user-sort columns)
- boolean userSortValid = true;
- TreeMap<Integer, IColumn> sortColMap = new TreeMap<Integer, IColumn>();
- HashMap<IColumn, Boolean> sortColAscMap = new HashMap<IColumn, Boolean>();
- for (TableColumnState colState : oldColumns) {
- if (colState.getSortOrder() >= 0) {
- IColumn col = BookmarkUtility.resolveColumn(columnSet.getColumns(), colState.getClassName());
- if (col != null) {
- sortColMap.put(colState.getSortOrder(), col);
- sortColAscMap.put(col, colState.isSortAscending());
- if (col.getSortIndex() != colState.getSortOrder()) {
- userSortValid = false;
- }
- if (col.isSortAscending() != colState.isSortAscending()) {
- userSortValid = false;
- }
- }
- }
- }
- HashSet<IColumn<?>> existingExplicitUserSortCols = new HashSet<IColumn<?>>();
- for (IColumn<?> c : columnSet.getUserSortColumns()) {
- if (c.isSortExplicit()) {
- existingExplicitUserSortCols.add(c);
- }
- }
- if (!sortColMap.values().containsAll(existingExplicitUserSortCols)) {
- userSortValid = false;
- }
- if (!userSortValid) {
- columnSet.clearSortColumns();
- for (IColumn col : sortColMap.values()) {
- columnSet.addSortColumn(col, sortColAscMap.get(col));
- }
- table.sort();
- }
- }
- }
-
- public static Bookmark createBookmark(IDesktop desktop) throws ProcessingException {
- IOutline outline = desktop.getOutline();
- if (outline == null) {
- return null;
- }
-
- IPage activePage = outline.getActivePage();
- return createBookmark(activePage);
- }
-
- public static Bookmark createBookmark(IPage page) throws ProcessingException {
- if (page == null || page.getOutline() == null) {
- return null;
- }
-
- IOutline outline = page.getOutline();
- Bookmark b = new Bookmark();
- b.setIconId(page.getCell().getIconId());
- // outline
- b.setOutlineClassName(outline.getClass().getName());
- ArrayList<IPage> path = new ArrayList<IPage>();
- ArrayList<String> titleSegments = new ArrayList<String>();
- while (page != null) {
- path.add(0, page);
- String s = page.getCell().getText();
- if (s != null) {
- titleSegments.add(0, s);
- }
- // next
- page = (IPage) page.getParentNode();
- }
- if (outline.getTitle() != null) {
- titleSegments.add(0, outline.getTitle());
- }
- // title
- int len = 0;
- if (titleSegments.size() > 0) {
- len += titleSegments.get(0).length();
- }
- if (titleSegments.size() > 1) {
- len += titleSegments.get(titleSegments.size() - 1).length();
- }
- for (int i = titleSegments.size() - 1; i > 0; i--) {
- if (len > 200) {
- titleSegments.remove(i);
- }
- else if (len + titleSegments.get(i).length() <= 200) {
- len += titleSegments.get(i).length();
- }
- else {
- titleSegments.set(i, "...");
- len = 201;
- }
- }
- StringBuilder buf = new StringBuilder();
- for (String s : titleSegments) {
- if (buf.length() > 0) {
- buf.append(" - ");
- }
- buf.append(s);
- }
- b.setTitle(buf.toString());
- // text
- StringBuffer text = new StringBuffer();
- // add constraints texts
- String prefix = "";
- for (int i = 0; i < path.size(); i++) {
- page = path.get(i);
- if (i > 0 || outline.isRootNodeVisible()) {
- text.append(prefix + page.getCell().getText());
- text.append("\n");
- if (page instanceof IPageWithTable) {
- IPageWithTable tablePage = (IPageWithTable) page;
- SearchFilter search = tablePage.getSearchFilter();
- if (search != null) {
- for (String s : search.getDisplayTexts()) {
- if (s != null) {
- String indent = prefix + " ";
- s = s.trim().replaceAll("[\\n]", "\n" + indent);
- if (s.length() > 0) {
- text.append(indent + s);
- text.append("\n");
- }
- }
- }
- }
- }
- prefix += " ";
- }
- }
- b.setText(text.toString().trim());
- // path
- for (int i = 0; i < path.size(); i++) {
- page = path.get(i);
- if (page instanceof IPageWithTable) {
- IPageWithTable tablePage = (IPageWithTable) page;
- IPage childPage = null;
- if (i + 1 < path.size()) {
- childPage = path.get(i + 1);
- }
- b.addPathElement(bmStoreTablePage(tablePage, childPage));
- }
- else if (page instanceof IPageWithNodes) {
- IPageWithNodes nodePage = (IPageWithNodes) page;
- b.addPathElement(bmStoreNodePage(nodePage));
- }
- }
- return b;
- }
-
- private static IPage bmLoadTablePage(IPageWithTable tablePage, TablePageState tablePageState, boolean leafState, boolean resetViewAndWarnOnFail) throws ProcessingException {
- ITable table = tablePage.getTable();
- if (tablePageState.getTableCustomizerData() != null && tablePage.getTable().getTableCustomizer() != null) {
- byte[] newData = tablePageState.getTableCustomizerData();
- ITableCustomizer tc = tablePage.getTable().getTableCustomizer();
- byte[] curData = tc.getSerializedData();
- if (!CompareUtility.equals(curData, newData)) {
- tc.removeAllColumns();
- tc.setSerializedData(tablePageState.getTableCustomizerData());
- tablePage.getTable().resetColumnConfiguration();
- tablePage.setChildrenLoaded(false);
- }
- }
- // starts search form
- tablePage.getSearchFilter();
- // setup table
- try {
- table.setTableChanging(true);
- //legacy support
- @SuppressWarnings("deprecation")
- List<TableColumnState> allColumns = tablePageState.getVisibleColumns();
- if (allColumns == null || allColumns.size() == 0) {
- allColumns = tablePageState.getAvailableColumns();
- }
- restoreTableColumns(tablePage.getTable(), allColumns);
- }
- finally {
- table.setTableChanging(false);
- }
- // setup search
- if (tablePageState.getSearchFormState() != null) {
- ISearchForm searchForm = tablePage.getSearchFormInternal();
- if (searchForm != null) {
- boolean doSearch = true;
- String newSearchFilterState = tablePageState.getSearchFilterState();
- String oldSearchFilterState = "" + createSearchFilterCRC(searchForm.getSearchFilter());
- if (CompareUtility.equals(oldSearchFilterState, newSearchFilterState)) {
- String newSearchFormState = tablePageState.getSearchFormState();
- String oldSearchFormState = searchForm.getXML("UTF-8");
- if (CompareUtility.equals(oldSearchFormState, newSearchFormState)) {
- doSearch = false;
- }
- }
- // in case search form is in correct state, but no search has been executed, force search
- if (tablePage.getTable().getRowCount() == 0) {
- doSearch = true;
- }
- if (doSearch) {
- searchForm.setXML(tablePageState.getSearchFormState());
- if (tablePageState.isSearchFilterComplete()) {
- searchForm.doSaveWithoutMarkerChange();
- }
- }
- }
- }
- IPage childPage = null;
- boolean loadChildren = !leafState;
- if (tablePage.isChildrenDirty() || tablePage.isChildrenVolatile()) {
- loadChildren = true;
- tablePage.setChildrenLoaded(false);
- }
- if (loadChildren) {
- tablePage.ensureChildrenLoaded();
- tablePage.setChildrenDirty(false);
- CompositeObject childPk = tablePageState.getExpandedChildPrimaryKey();
- if (childPk != null) {
- for (int r = 0; r < table.getRowCount(); r++) {
- CompositeObject testPk = new CompositeObject(BookmarkUtility.makeSerializableKeys(table.getRowKeys(r)));
- if (testPk.equals(childPk)) {
- if (r < tablePage.getChildNodeCount()) {
- childPage = tablePage.getChildPage(r);
- }
- break;
- }
- }
- }
- else {
- ITreeNode[] filteredChildNodes = tablePage.getFilteredChildNodes();
- if (filteredChildNodes.length > 0) {
- childPage = (IPage) filteredChildNodes[0];
- }
- else if (tablePage.getChildNodeCount() > 0) {
- childPage = tablePage.getChildPage(0);
- }
- }
- }
- // load selections
- if (leafState) {
- if (tablePageState.getSelectedChildrenPrimaryKeys().size() > 0) {
- tablePage.ensureChildrenLoaded();
- HashSet<CompositeObject> selectionSet = new HashSet<CompositeObject>(tablePageState.getSelectedChildrenPrimaryKeys());
- ArrayList<ITableRow> rowList = new ArrayList<ITableRow>();
- for (ITableRow row : table.getRows()) {
- CompositeObject testPk = new CompositeObject(BookmarkUtility.makeSerializableKeys(row.getKeyValues()));
- if (selectionSet.contains(testPk)) {
- //row must not be filtered out
- if (row.isFilterAccepted()) {
- rowList.add(row);
- }
- }
- }
- if (rowList.size() > 0) {
- table.selectRows(rowList.toArray(new ITableRow[0]));
- }
- }
-
- return childPage;
- }
-
- // check, whether table column filter must be reset
- if (resetViewAndWarnOnFail) {
- if (childPage == null
- || (!childPage.isFilterAccepted() && table.getColumnFilterManager() != null && table.getColumnFilterManager().isEnabled())) {
- table.getColumnFilterManager().reset();
- tablePage.setPagePopulateStatus(new ProcessingStatus(ScoutTexts.get("BookmarkResetColumnFilters"), ProcessingStatus.WARNING));
- }
- }
-
- // child page is not available or filtered out
- if (childPage == null || !childPage.isFilterAccepted()) {
- if (resetViewAndWarnOnFail) {
- // set appropriate warning
- if (tablePage.isSearchActive() && tablePage.getSearchFormInternal() != null) {
- tablePage.setPagePopulateStatus(new ProcessingStatus(ScoutTexts.get("BookmarkResolutionCanceledCheckSearchCriteria"), ProcessingStatus.WARNING));
- }
- else {
- tablePage.setPagePopulateStatus(new ProcessingStatus(ScoutTexts.get("BookmarkResolutionCanceled"), ProcessingStatus.WARNING));
- }
- }
- childPage = null;
- }
-
- return childPage;
- }
-
- private static IPage bmLoadNodePage(IPageWithNodes nodePage, NodePageState nodePageState, AbstractPageState childState, boolean resetViewAndWarnOnFail) throws ProcessingException {
- IPage childPage = null;
- if (childState != null) {
- nodePage.ensureChildrenLoaded();
- IPage p = BookmarkUtility.resolvePage(nodePage.getChildPages(), childState.getPageClassName(), childState.getBookmarkIdentifier());
- if (p != null) {
- ITable table = nodePage.getInternalTable();
- // reset table column filter if requested
- if (resetViewAndWarnOnFail && !p.isFilterAccepted() && table.getColumnFilterManager() != null && table.getColumnFilterManager().isEnabled()) {
- table.getColumnFilterManager().reset();
- }
-
- // check table column filter
- if (p.isFilterAccepted()) {
- childPage = p;
- }
- }
- // set appropriate warning if child page is not available or filtered out
- if (childPage == null && resetViewAndWarnOnFail) {
- nodePage.setPagePopulateStatus(new ProcessingStatus(ScoutTexts.get("BookmarkResolutionCanceled"), ProcessingStatus.WARNING));
- }
- }
- return childPage;
- }
-
- private static TablePageState bmStoreTablePage(IPageWithTable page, IPage childPage) throws ProcessingException {
- ITable table = page.getTable();
- TablePageState state = new TablePageState();
- state.setPageClassName(page.getClass().getName());
- state.setBookmarkIdentifier(page.getUserPreferenceContext());
- state.setLabel(page.getCell().getText());
- state.setExpanded(page.isExpanded());
- IForm searchForm = page.getSearchFormInternal();
- if (searchForm != null) {
- state.setSearchFormState(searchForm.getXML("UTF-8"));
- state.setSearchFilterState(searchForm.getSearchFilter().isCompleted(), "" + createSearchFilterCRC(searchForm.getSearchFilter()));
- }
- if (page.getTable().getTableCustomizer() != null) {
- state.setTableCustomizerData(page.getTable().getTableCustomizer().getSerializedData());
- }
- List<TableColumnState> allColumns = backupTableColumns(page.getTable());
- state.setAvailableColumns(allColumns);
- //
- ArrayList<CompositeObject> pkList = new ArrayList<CompositeObject>();
- for (ITableRow row : table.getSelectedRows()) {
- pkList.add(new CompositeObject(BookmarkUtility.makeSerializableKeys(row.getKeyValues())));
- }
- state.setSelectedChildrenPrimaryKeys(pkList);
- //
- if (childPage != null) {
- for (int j = 0; j < table.getRowCount(); j++) {
- if (page.getChildNode(j) == childPage) {
- ITableRow childRow = table.getRow(j);
- state.setExpandedChildPrimaryKey(new CompositeObject(BookmarkUtility.makeSerializableKeys(childRow.getKeyValues())));
- break;
- }
- }
- }
- return state;
- }
-
- private static NodePageState bmStoreNodePage(IPageWithNodes page) throws ProcessingException {
- NodePageState state = new NodePageState();
- state.setPageClassName(page.getClass().getName());
- state.setBookmarkIdentifier(page.getUserPreferenceContext());
- state.setLabel(page.getCell().getText());
- state.setExpanded(page.isExpanded());
- return state;
- }
-
- private static long createSearchFilterCRC(SearchFilter filter) {
- if (filter == null) {
- return 0L;
- }
- try {
- CRC32 crc = new CRC32();
- ByteArrayOutputStream bo = new ByteArrayOutputStream();
- ObjectOutputStream oo = new ObjectOutputStream(bo);
- oo.writeObject(filter);
- oo.close();
- crc.update(bo.toByteArray());
- return crc.getValue();
- }
- catch (Throwable t) {
- // nop
- return -1L;
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.bookmark.internal;
+
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectOutputStream;
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.TreeMap;
+import java.util.zip.CRC32;
+
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.commons.CompositeObject;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.exception.ProcessingStatus;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.basic.table.ColumnSet;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.customizer.ITableCustomizer;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
+import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithNodes;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.ISearchForm;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.services.common.bookmark.AbstractPageState;
+import org.eclipse.scout.rt.shared.services.common.bookmark.Bookmark;
+import org.eclipse.scout.rt.shared.services.common.bookmark.NodePageState;
+import org.eclipse.scout.rt.shared.services.common.bookmark.TableColumnState;
+import org.eclipse.scout.rt.shared.services.common.bookmark.TablePageState;
+import org.eclipse.scout.rt.shared.services.common.jdbc.SearchFilter;
+
+public final class BookmarkUtility {
+
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(BookmarkUtility.class);
+
+ private BookmarkUtility() {
+ }
+
+ public static IOutline resolveOutline(IOutline[] outlines, String className) {
+ if (className == null) {
+ return null;
+ }
+ // pass 1: fully qualified name
+ for (IOutline o : outlines) {
+ if (o.getClass().getName().equals(className)) {
+ return o;
+ }
+ }
+ // pass 2: simple name, not case sensitive
+ String simpleClassName = className.replaceAll("^.*\\.", "");
+ for (IOutline o : outlines) {
+ if (o.getClass().getSimpleName().equalsIgnoreCase(simpleClassName)) {
+ return o;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @param columns
+ * is the set of available columns to search in
+ * @param className
+ * is the columnId, simple class name or class name of the columns to find
+ */
+ public static IColumn resolveColumn(IColumn[] columns, String identifier) {
+ if (identifier == null) {
+ return null;
+ }
+ // pass 1: fully qualified name
+ for (IColumn c : columns) {
+ if (identifier.equals(c.getClass().getName())) {
+ return c;
+ }
+ }
+ // pass 2: columnId
+ for (IColumn c : columns) {
+ if (identifier.equals(c.getColumnId())) {
+ return c;
+ }
+ }
+ // pass 3: simple name, not case sensitive
+ String simpleClassName = identifier.replaceAll("^.*\\.", "");
+ for (IColumn c : columns) {
+ if (simpleClassName.equalsIgnoreCase(c.getClass().getSimpleName())) {
+ return c;
+ }
+ }
+ return null;
+ }
+
+ public static IPage resolvePage(IPage[] pages, String className, String userPreferenceContext) {
+ if (className == null) {
+ return null;
+ }
+ TreeMap<CompositeObject, IPage> sortMap = new TreeMap<CompositeObject, IPage>();
+ String simpleClassName = className.replaceAll("^.*\\.", "");
+ int index = 0;
+ for (IPage p : pages) {
+ int classNameScore = 0;
+ int userPreferenceContextScore = 0;
+ if (p.getClass().getName().equals(className)) {
+ classNameScore = -2;
+ }
+ else if (p.getClass().getSimpleName().equalsIgnoreCase(simpleClassName)) {
+ classNameScore = -1;
+ }
+ if (userPreferenceContext == null || userPreferenceContext.equalsIgnoreCase(p.getUserPreferenceContext())) {
+ userPreferenceContextScore = -1;
+ }
+ if (classNameScore != 0 && userPreferenceContextScore != 0) {
+ sortMap.put(new CompositeObject(classNameScore, userPreferenceContextScore, index), p);
+ }
+ index++;
+ }
+ if (sortMap.isEmpty()) {
+ return null;
+ }
+ CompositeObject bestMatchingKey = sortMap.firstKey();
+ IPage bestMatchingPage = sortMap.remove(bestMatchingKey);
+ if (!sortMap.isEmpty()) {
+ // check ambiguity
+ CompositeObject nextKey = sortMap.firstKey();
+ if (CompareUtility.equals(bestMatchingKey.getComponent(0), nextKey.getComponent(0)) && CompareUtility.equals(bestMatchingKey.getComponent(1), nextKey.getComponent(1))) {
+ LOG.warn("More than one pages found for page class [" + className + "] and user preference context [" + userPreferenceContext + "]");
+ }
+ }
+ return bestMatchingPage;
+ }
+
+ /**
+ * intercept objects that are not remoting-capable or not serializable and
+ * replace by strings
+ */
+ public static Object[] makeSerializableKeys(Object[] a) {
+ return (Object[]) makeSerializableKey(a);
+ }
+
+ public static Object makeSerializableKey(Object o) {
+ if (o == null) {
+ return o;
+ }
+ else if (o instanceof Number) {
+ return o;
+ }
+ else if (o instanceof String) {
+ return o;
+ }
+ else if (o instanceof Boolean) {
+ return o;
+ }
+ else if (o instanceof Date) {
+ return o;
+ }
+ else if (o.getClass().isArray()) {
+ ArrayList<Integer> dimList = new ArrayList<Integer>();
+ Class xc = o.getClass();
+ Object xo = o;
+ while (xc.isArray()) {
+ int len = xo != null ? Array.getLength(xo) : 0;
+ dimList.add(len);
+ xc = xc.getComponentType();
+ if (xo != null && len > 0) {
+ xo = Array.get(xo, 0);
+ }
+ }
+ int[] dim = new int[dimList.size()];
+ for (int i = 0; i < dim.length; i++) {
+ dim[i] = dimList.get(i);
+ }
+ Object b = Array.newInstance(makeSerializableClass(xc), dim);
+ for (int i = 0; i < dim[0]; i++) {
+ Array.set(b, i, makeSerializableKey(Array.get(o, i)));
+ }
+ return b;
+ }
+ else {
+ return o.toString();
+ }
+ }
+
+ /**
+ * return String.class for classes that are not remoting-capable or not
+ * serializable
+ */
+ public static Class makeSerializableClass(Class c) {
+ if (c == null) {
+ throw new IllegalArgumentException("class must not be null");
+ }
+ if (c.isArray()) {
+ throw new IllegalArgumentException("class must not be an array class");
+ }
+ if (c.isPrimitive()) {
+ return c;
+ }
+ else if (Number.class.isAssignableFrom(c)) {
+ return c;
+ }
+ else if (String.class.isAssignableFrom(c)) {
+ return c;
+ }
+ else if (Boolean.class.isAssignableFrom(c)) {
+ return c;
+ }
+ else if (Date.class.isAssignableFrom(c)) {
+ return c;
+ }
+ else if (Object.class == c) {
+ return c;
+ }
+ else {
+ return String.class;
+ }
+ }
+
+ public static void activateBookmark(IDesktop desktop, Bookmark bm, boolean forceReload) throws ProcessingException {
+ if (bm.getOutlineClassName() == null) {
+ return;
+ }
+ IOutline outline = BookmarkUtility.resolveOutline(desktop.getAvailableOutlines(), bm.getOutlineClassName());
+ if (outline == null) {
+ throw new ProcessingException("outline '" + bm.getOutlineClassName() + "' was not found");
+ }
+ if (!(outline.isVisible() && outline.isEnabled())) {
+ throw new ProcessingException("activate outline " + outline.getTitle() + " denied");
+ }
+ desktop.setOutline(outline);
+ try {
+ outline.setTreeChanging(true);
+ //
+ IPage parentPage = outline.getRootPage();
+ boolean pathFullyRestored = true;
+ List<AbstractPageState> path = bm.getPath();
+ AbstractPageState parentPageState = path.get(0);
+ boolean resetViewAndWarnOnFail = bm.getId() != 0;
+ for (int i = 1; i < path.size(); i++) {
+ // try to find correct child page (next parentPage)
+ IPage childPage = null;
+ AbstractPageState childState = path.get(i);
+ if (parentPageState instanceof TablePageState) {
+ TablePageState tablePageState = (TablePageState) parentPageState;
+ if (parentPage instanceof IPageWithTable) {
+ IPageWithTable tablePage = (IPageWithTable) parentPage;
+ childPage = bmLoadTablePage(tablePage, tablePageState, false, resetViewAndWarnOnFail);
+ }
+ }
+ else if (parentPageState instanceof NodePageState) {
+ NodePageState nodePageState = (NodePageState) parentPageState;
+ if (parentPage instanceof IPageWithNodes) {
+ IPageWithNodes nodePage = (IPageWithNodes) parentPage;
+ childPage = bmLoadNodePage(nodePage, nodePageState, childState, resetViewAndWarnOnFail);
+ }
+ }
+ // next
+ if (childPage != null) {
+ parentPage = childPage;
+ parentPageState = childState;
+ }
+ else if (i < path.size()) {
+ pathFullyRestored = false;
+ break;
+ }
+ }
+ if (pathFullyRestored) {
+ if (parentPageState instanceof TablePageState && parentPage instanceof IPageWithTable) {
+ bmLoadTablePage((IPageWithTable) parentPage, (TablePageState) parentPageState, true, resetViewAndWarnOnFail);
+ }
+ else if (parentPage instanceof IPageWithNodes) {
+ bmLoadNodePage((IPageWithNodes) parentPage, (NodePageState) parentPageState, null, resetViewAndWarnOnFail);
+ }
+ }
+ /*
+ * Expansions of the restored tree path
+ */
+ IPage p = parentPage;
+ // last element
+ if (pathFullyRestored && parentPageState.isExpanded() != null) {
+ p.setExpanded(parentPageState.isExpanded());
+ }
+ else {
+ if (!(p instanceof IPageWithTable)) {
+ p.setExpanded(true);
+ }
+ }
+ // ancestor elements
+ p = p.getParentPage();
+ while (p != null) {
+ p.setExpanded(true);
+ p = p.getParentPage();
+ }
+ outline.selectNode(parentPage, false);
+ }
+ finally {
+ outline.setTreeChanging(false);
+ }
+ }
+
+ /**
+ * Constructs a list of {@link TableColumnState} objects which
+ * describe the set of columns of the given {@link ITable}.
+ *
+ * @param table
+ * The table with the columns to back-up.
+ * @return A {@link List} of {@link TableColumnState} objects that
+ * can be restored via {@link #restoreTableColumns(ITable, List)}
+ */
+ public static List<TableColumnState> backupTableColumns(ITable table) {
+ ArrayList<TableColumnState> allColumns = new ArrayList<TableColumnState>();
+ ColumnSet columnSet = table.getColumnSet();
+ //add all columns but in user order
+ for (IColumn<?> c : columnSet.getAllColumnsInUserOrder()) {
+ TableColumnState colState = new TableColumnState();
+ colState.setColumnClassName(c.getColumnId());
+ colState.setDisplayable(c.isDisplayable());
+ colState.setVisible(c.isDisplayable() && c.isVisible());
+ colState.setWidth(c.getWidth());
+ if (columnSet.isUserSortColumn(c) && c.isSortExplicit()) {
+ int sortOrder = columnSet.getSortColumnIndex(c);
+ if (sortOrder >= 0) {
+ colState.setSortOrder(sortOrder);
+ colState.setSortAscending(c.isSortAscending());
+ }
+ else {
+ colState.setSortOrder(-1);
+ }
+ }
+ if (table.getColumnFilterManager() != null && c.isColumnFilterActive()) {
+ colState.setColumnFilterData(table.getColumnFilterManager().getSerializedFilter(c));
+ }
+ allColumns.add(colState);
+ }
+ return allColumns;
+ }
+
+ /**
+ * Restores a tables columns from the given list of {@link TableColumnState} objects.
+ *
+ * @param table
+ * The table to be restored.
+ * @param oldColumns
+ * A {@link List} of {@link TableColumnState} objects to
+ * restore. Such can be retrieved by the {@link #backupTableColumns(ITable)} method.
+ */
+ public static void restoreTableColumns(ITable table, List<TableColumnState> oldColumns) throws ProcessingException {
+ if (oldColumns != null && oldColumns.size() > 0 && table != null) {
+ ColumnSet columnSet = table.getColumnSet();
+ // visible columns and width
+ ArrayList<IColumn> visibleColumns = new ArrayList<IColumn>();
+ for (TableColumnState colState : oldColumns) {
+ //legacy support: null=true
+ if (colState.getVisible() == null || colState.getVisible()) {
+ IColumn col = resolveColumn(columnSet.getDisplayableColumns(), colState.getClassName());
+ if (col != null && col.isDisplayable()) {
+ if (colState.getWidth() > 0) {
+ col.setWidth(colState.getWidth());
+ }
+ visibleColumns.add(col);
+ }
+ }
+ }
+ List<IColumn> existingVisibleCols = Arrays.asList(columnSet.getVisibleColumns());
+ if (!existingVisibleCols.equals(visibleColumns)) {
+ columnSet.setVisibleColumns(visibleColumns.toArray(new IColumn[0]));
+ }
+ // filters
+ if (table.getColumnFilterManager() != null) {
+ // If a column filter was set, but did not have one before
+ // the change, it will not be reset.
+ // So reset all column filters beforehand:
+ table.getColumnFilterManager().reset();
+ for (TableColumnState colState : oldColumns) {
+ if (colState.getColumnFilterData() != null) {
+ IColumn col = BookmarkUtility.resolveColumn(columnSet.getColumns(), colState.getClassName());
+ if (col != null) {
+ table.getColumnFilterManager().setSerializedFilter(colState.getColumnFilterData(), col);
+ }
+ }
+ }
+ }
+ //sort order (only respect visible and user-sort columns)
+ boolean userSortValid = true;
+ TreeMap<Integer, IColumn> sortColMap = new TreeMap<Integer, IColumn>();
+ HashMap<IColumn, Boolean> sortColAscMap = new HashMap<IColumn, Boolean>();
+ for (TableColumnState colState : oldColumns) {
+ if (colState.getSortOrder() >= 0) {
+ IColumn col = BookmarkUtility.resolveColumn(columnSet.getColumns(), colState.getClassName());
+ if (col != null) {
+ sortColMap.put(colState.getSortOrder(), col);
+ sortColAscMap.put(col, colState.isSortAscending());
+ if (col.getSortIndex() != colState.getSortOrder()) {
+ userSortValid = false;
+ }
+ if (col.isSortAscending() != colState.isSortAscending()) {
+ userSortValid = false;
+ }
+ }
+ }
+ }
+ HashSet<IColumn<?>> existingExplicitUserSortCols = new HashSet<IColumn<?>>();
+ for (IColumn<?> c : columnSet.getUserSortColumns()) {
+ if (c.isSortExplicit()) {
+ existingExplicitUserSortCols.add(c);
+ }
+ }
+ if (!sortColMap.values().containsAll(existingExplicitUserSortCols)) {
+ userSortValid = false;
+ }
+ if (!userSortValid) {
+ columnSet.clearSortColumns();
+ for (IColumn col : sortColMap.values()) {
+ columnSet.addSortColumn(col, sortColAscMap.get(col));
+ }
+ table.sort();
+ }
+ }
+ }
+
+ public static Bookmark createBookmark(IDesktop desktop) throws ProcessingException {
+ IOutline outline = desktop.getOutline();
+ if (outline == null) {
+ return null;
+ }
+
+ IPage activePage = outline.getActivePage();
+ return createBookmark(activePage);
+ }
+
+ public static Bookmark createBookmark(IPage page) throws ProcessingException {
+ if (page == null || page.getOutline() == null) {
+ return null;
+ }
+
+ IOutline outline = page.getOutline();
+ Bookmark b = new Bookmark();
+ b.setIconId(page.getCell().getIconId());
+ // outline
+ b.setOutlineClassName(outline.getClass().getName());
+ ArrayList<IPage> path = new ArrayList<IPage>();
+ ArrayList<String> titleSegments = new ArrayList<String>();
+ while (page != null) {
+ path.add(0, page);
+ String s = page.getCell().getText();
+ if (s != null) {
+ titleSegments.add(0, s);
+ }
+ // next
+ page = (IPage) page.getParentNode();
+ }
+ if (outline.getTitle() != null) {
+ titleSegments.add(0, outline.getTitle());
+ }
+ // title
+ int len = 0;
+ if (titleSegments.size() > 0) {
+ len += titleSegments.get(0).length();
+ }
+ if (titleSegments.size() > 1) {
+ len += titleSegments.get(titleSegments.size() - 1).length();
+ }
+ for (int i = titleSegments.size() - 1; i > 0; i--) {
+ if (len > 200) {
+ titleSegments.remove(i);
+ }
+ else if (len + titleSegments.get(i).length() <= 200) {
+ len += titleSegments.get(i).length();
+ }
+ else {
+ titleSegments.set(i, "...");
+ len = 201;
+ }
+ }
+ StringBuilder buf = new StringBuilder();
+ for (String s : titleSegments) {
+ if (buf.length() > 0) {
+ buf.append(" - ");
+ }
+ buf.append(s);
+ }
+ b.setTitle(buf.toString());
+ // text
+ StringBuffer text = new StringBuffer();
+ // add constraints texts
+ String prefix = "";
+ for (int i = 0; i < path.size(); i++) {
+ page = path.get(i);
+ if (i > 0 || outline.isRootNodeVisible()) {
+ text.append(prefix + page.getCell().getText());
+ text.append("\n");
+ if (page instanceof IPageWithTable) {
+ IPageWithTable tablePage = (IPageWithTable) page;
+ SearchFilter search = tablePage.getSearchFilter();
+ if (search != null) {
+ for (String s : search.getDisplayTexts()) {
+ if (s != null) {
+ String indent = prefix + " ";
+ s = s.trim().replaceAll("[\\n]", "\n" + indent);
+ if (s.length() > 0) {
+ text.append(indent + s);
+ text.append("\n");
+ }
+ }
+ }
+ }
+ }
+ prefix += " ";
+ }
+ }
+ b.setText(text.toString().trim());
+ // path
+ for (int i = 0; i < path.size(); i++) {
+ page = path.get(i);
+ if (page instanceof IPageWithTable) {
+ IPageWithTable tablePage = (IPageWithTable) page;
+ IPage childPage = null;
+ if (i + 1 < path.size()) {
+ childPage = path.get(i + 1);
+ }
+ b.addPathElement(bmStoreTablePage(tablePage, childPage));
+ }
+ else if (page instanceof IPageWithNodes) {
+ IPageWithNodes nodePage = (IPageWithNodes) page;
+ b.addPathElement(bmStoreNodePage(nodePage));
+ }
+ }
+ return b;
+ }
+
+ private static IPage bmLoadTablePage(IPageWithTable tablePage, TablePageState tablePageState, boolean leafState, boolean resetViewAndWarnOnFail) throws ProcessingException {
+ ITable table = tablePage.getTable();
+ if (tablePageState.getTableCustomizerData() != null && tablePage.getTable().getTableCustomizer() != null) {
+ byte[] newData = tablePageState.getTableCustomizerData();
+ ITableCustomizer tc = tablePage.getTable().getTableCustomizer();
+ byte[] curData = tc.getSerializedData();
+ if (!CompareUtility.equals(curData, newData)) {
+ tc.removeAllColumns();
+ tc.setSerializedData(tablePageState.getTableCustomizerData());
+ tablePage.getTable().resetColumnConfiguration();
+ tablePage.setChildrenLoaded(false);
+ }
+ }
+ // starts search form
+ tablePage.getSearchFilter();
+ // setup table
+ try {
+ table.setTableChanging(true);
+ //legacy support
+ @SuppressWarnings("deprecation")
+ List<TableColumnState> allColumns = tablePageState.getVisibleColumns();
+ if (allColumns == null || allColumns.size() == 0) {
+ allColumns = tablePageState.getAvailableColumns();
+ }
+ restoreTableColumns(tablePage.getTable(), allColumns);
+ }
+ finally {
+ table.setTableChanging(false);
+ }
+ // setup search
+ if (tablePageState.getSearchFormState() != null) {
+ ISearchForm searchForm = tablePage.getSearchFormInternal();
+ if (searchForm != null) {
+ boolean doSearch = true;
+ String newSearchFilterState = tablePageState.getSearchFilterState();
+ String oldSearchFilterState = "" + createSearchFilterCRC(searchForm.getSearchFilter());
+ if (CompareUtility.equals(oldSearchFilterState, newSearchFilterState)) {
+ String newSearchFormState = tablePageState.getSearchFormState();
+ String oldSearchFormState = searchForm.getXML("UTF-8");
+ if (CompareUtility.equals(oldSearchFormState, newSearchFormState)) {
+ doSearch = false;
+ }
+ }
+ // in case search form is in correct state, but no search has been executed, force search
+ if (tablePage.getTable().getRowCount() == 0) {
+ doSearch = true;
+ }
+ if (doSearch) {
+ searchForm.setXML(tablePageState.getSearchFormState());
+ if (tablePageState.isSearchFilterComplete()) {
+ searchForm.doSaveWithoutMarkerChange();
+ }
+ }
+ }
+ }
+ IPage childPage = null;
+ boolean loadChildren = !leafState;
+ if (tablePage.isChildrenDirty() || tablePage.isChildrenVolatile()) {
+ loadChildren = true;
+ tablePage.setChildrenLoaded(false);
+ }
+ if (loadChildren) {
+ tablePage.ensureChildrenLoaded();
+ tablePage.setChildrenDirty(false);
+ CompositeObject childPk = tablePageState.getExpandedChildPrimaryKey();
+ if (childPk != null) {
+ for (int r = 0; r < table.getRowCount(); r++) {
+ CompositeObject testPk = new CompositeObject(BookmarkUtility.makeSerializableKeys(table.getRowKeys(r)));
+ if (testPk.equals(childPk)) {
+ if (r < tablePage.getChildNodeCount()) {
+ childPage = tablePage.getChildPage(r);
+ }
+ break;
+ }
+ }
+ }
+ else {
+ ITreeNode[] filteredChildNodes = tablePage.getFilteredChildNodes();
+ if (filteredChildNodes.length > 0) {
+ childPage = (IPage) filteredChildNodes[0];
+ }
+ else if (tablePage.getChildNodeCount() > 0) {
+ childPage = tablePage.getChildPage(0);
+ }
+ }
+ }
+ // load selections
+ if (leafState) {
+ if (tablePageState.getSelectedChildrenPrimaryKeys().size() > 0) {
+ tablePage.ensureChildrenLoaded();
+ HashSet<CompositeObject> selectionSet = new HashSet<CompositeObject>(tablePageState.getSelectedChildrenPrimaryKeys());
+ ArrayList<ITableRow> rowList = new ArrayList<ITableRow>();
+ for (ITableRow row : table.getRows()) {
+ CompositeObject testPk = new CompositeObject(BookmarkUtility.makeSerializableKeys(row.getKeyValues()));
+ if (selectionSet.contains(testPk)) {
+ //row must not be filtered out
+ if (row.isFilterAccepted()) {
+ rowList.add(row);
+ }
+ }
+ }
+ if (rowList.size() > 0) {
+ table.selectRows(rowList.toArray(new ITableRow[0]));
+ }
+ }
+
+ return childPage;
+ }
+
+ // check, whether table column filter must be reset
+ if (resetViewAndWarnOnFail) {
+ if (childPage == null
+ || (!childPage.isFilterAccepted() && table.getColumnFilterManager() != null && table.getColumnFilterManager().isEnabled())) {
+ table.getColumnFilterManager().reset();
+ tablePage.setPagePopulateStatus(new ProcessingStatus(ScoutTexts.get("BookmarkResetColumnFilters"), ProcessingStatus.WARNING));
+ }
+ }
+
+ // child page is not available or filtered out
+ if (childPage == null || !childPage.isFilterAccepted()) {
+ if (resetViewAndWarnOnFail) {
+ // set appropriate warning
+ if (tablePage.isSearchActive() && tablePage.getSearchFormInternal() != null) {
+ tablePage.setPagePopulateStatus(new ProcessingStatus(ScoutTexts.get("BookmarkResolutionCanceledCheckSearchCriteria"), ProcessingStatus.WARNING));
+ }
+ else {
+ tablePage.setPagePopulateStatus(new ProcessingStatus(ScoutTexts.get("BookmarkResolutionCanceled"), ProcessingStatus.WARNING));
+ }
+ }
+ childPage = null;
+ }
+
+ return childPage;
+ }
+
+ private static IPage bmLoadNodePage(IPageWithNodes nodePage, NodePageState nodePageState, AbstractPageState childState, boolean resetViewAndWarnOnFail) throws ProcessingException {
+ IPage childPage = null;
+ if (childState != null) {
+ nodePage.ensureChildrenLoaded();
+ IPage p = BookmarkUtility.resolvePage(nodePage.getChildPages(), childState.getPageClassName(), childState.getBookmarkIdentifier());
+ if (p != null) {
+ ITable table = nodePage.getInternalTable();
+ // reset table column filter if requested
+ if (resetViewAndWarnOnFail && !p.isFilterAccepted() && table.getColumnFilterManager() != null && table.getColumnFilterManager().isEnabled()) {
+ table.getColumnFilterManager().reset();
+ }
+
+ // check table column filter
+ if (p.isFilterAccepted()) {
+ childPage = p;
+ }
+ }
+ // set appropriate warning if child page is not available or filtered out
+ if (childPage == null && resetViewAndWarnOnFail) {
+ nodePage.setPagePopulateStatus(new ProcessingStatus(ScoutTexts.get("BookmarkResolutionCanceled"), ProcessingStatus.WARNING));
+ }
+ }
+ return childPage;
+ }
+
+ private static TablePageState bmStoreTablePage(IPageWithTable page, IPage childPage) throws ProcessingException {
+ ITable table = page.getTable();
+ TablePageState state = new TablePageState();
+ state.setPageClassName(page.getClass().getName());
+ state.setBookmarkIdentifier(page.getUserPreferenceContext());
+ state.setLabel(page.getCell().getText());
+ state.setExpanded(page.isExpanded());
+ IForm searchForm = page.getSearchFormInternal();
+ if (searchForm != null) {
+ state.setSearchFormState(searchForm.getXML("UTF-8"));
+ state.setSearchFilterState(searchForm.getSearchFilter().isCompleted(), "" + createSearchFilterCRC(searchForm.getSearchFilter()));
+ }
+ if (page.getTable().getTableCustomizer() != null) {
+ state.setTableCustomizerData(page.getTable().getTableCustomizer().getSerializedData());
+ }
+ List<TableColumnState> allColumns = backupTableColumns(page.getTable());
+ state.setAvailableColumns(allColumns);
+ //
+ ArrayList<CompositeObject> pkList = new ArrayList<CompositeObject>();
+ for (ITableRow row : table.getSelectedRows()) {
+ pkList.add(new CompositeObject(BookmarkUtility.makeSerializableKeys(row.getKeyValues())));
+ }
+ state.setSelectedChildrenPrimaryKeys(pkList);
+ //
+ if (childPage != null) {
+ for (int j = 0; j < table.getRowCount(); j++) {
+ if (page.getChildNode(j) == childPage) {
+ ITableRow childRow = table.getRow(j);
+ state.setExpandedChildPrimaryKey(new CompositeObject(BookmarkUtility.makeSerializableKeys(childRow.getKeyValues())));
+ break;
+ }
+ }
+ }
+ return state;
+ }
+
+ private static NodePageState bmStoreNodePage(IPageWithNodes page) throws ProcessingException {
+ NodePageState state = new NodePageState();
+ state.setPageClassName(page.getClass().getName());
+ state.setBookmarkIdentifier(page.getUserPreferenceContext());
+ state.setLabel(page.getCell().getText());
+ state.setExpanded(page.isExpanded());
+ return state;
+ }
+
+ private static long createSearchFilterCRC(SearchFilter filter) {
+ if (filter == null) {
+ return 0L;
+ }
+ try {
+ CRC32 crc = new CRC32();
+ ByteArrayOutputStream bo = new ByteArrayOutputStream();
+ ObjectOutputStream oo = new ObjectOutputStream(bo);
+ oo.writeObject(filter);
+ oo.close();
+ crc.update(bo.toByteArray());
+ return crc.getValue();
+ }
+ catch (Throwable t) {
+ // nop
+ return -1L;
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/bookmark/internal/TestBookmarkUtility.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/bookmark/internal/TestBookmarkUtility.java
index 4d5ead9ca5..d2ca1ce2cb 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/bookmark/internal/TestBookmarkUtility.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/bookmark/internal/TestBookmarkUtility.java
@@ -1,38 +1,38 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.bookmark.internal;
-
-import org.eclipse.scout.commons.VerboseUtility;
-import org.eclipse.scout.rt.shared.services.common.bookmark.Bookmark;
-
-public final class TestBookmarkUtility {
-
- private TestBookmarkUtility() {
- }
-
- public static void main(String[] args) {
- test(null);
- test(new String[0]);
- test(new String[1]);
- test(new String[1][0]);
- test(new String[0][1]);
- test(new String[][]{new String[]{"aaa", "bbb"}, new String[]{"ccc",}});
- test(new int[]{3, 2, 1});
- test(new Bookmark[]{new Bookmark()});
- }
-
- public static void test(Object a) {
- Object b = BookmarkUtility.makeSerializableKey(a);
- System.out.println("Input: " + (a != null ? a.getClass() : null) + " " + VerboseUtility.dumpObject(a));
- System.out.println("Output: " + (b != null ? b.getClass() : null) + " " + VerboseUtility.dumpObject(b));
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.bookmark.internal;
+
+import org.eclipse.scout.commons.VerboseUtility;
+import org.eclipse.scout.rt.shared.services.common.bookmark.Bookmark;
+
+public final class TestBookmarkUtility {
+
+ private TestBookmarkUtility() {
+ }
+
+ public static void main(String[] args) {
+ test(null);
+ test(new String[0]);
+ test(new String[1]);
+ test(new String[1][0]);
+ test(new String[0][1]);
+ test(new String[][]{new String[]{"aaa", "bbb"}, new String[]{"ccc",}});
+ test(new int[]{3, 2, 1});
+ test(new Bookmark[]{new Bookmark()});
+ }
+
+ public static void test(Object a) {
+ Object b = BookmarkUtility.makeSerializableKey(a);
+ System.out.println("Input: " + (a != null ? a.getClass() : null) + " " + VerboseUtility.dumpObject(a));
+ System.out.println("Output: " + (b != null ? b.getClass() : null) + " " + VerboseUtility.dumpObject(b));
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/clientnotification/ClientNotificationConsumerEvent.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/clientnotification/ClientNotificationConsumerEvent.java
index babbf874d1..5ce4ed1ebe 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/clientnotification/ClientNotificationConsumerEvent.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/clientnotification/ClientNotificationConsumerEvent.java
@@ -1,51 +1,51 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.clientnotification;
-
-import java.util.EventObject;
-
-import org.eclipse.scout.rt.shared.services.common.clientnotification.IClientNotification;
-
-public class ClientNotificationConsumerEvent extends EventObject {
- private static final long serialVersionUID = 1L;
-
- private final IClientNotification m_notification;
- private boolean m_seen;
- private boolean m_consumed;
-
- public ClientNotificationConsumerEvent(IClientNotificationConsumerService service, IClientNotification n) {
- super(service);
- m_notification = n;
- }
-
- @Override
- public final IClientNotificationConsumerService getSource() {
- return (IClientNotificationConsumerService) super.getSource();
- }
-
- public final IClientNotification getClientNotification() {
- return m_notification;
- }
-
- public final boolean isConsumed() {
- return m_consumed;
- }
-
- /**
- * When set to true, the event dispatching of this event is not ended, the
- * other listeners will also see this event. use {@link #isConsumed()} to
- * check for this property
- */
- public final void consume() {
- m_consumed = true;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.clientnotification;
+
+import java.util.EventObject;
+
+import org.eclipse.scout.rt.shared.services.common.clientnotification.IClientNotification;
+
+public class ClientNotificationConsumerEvent extends EventObject {
+ private static final long serialVersionUID = 1L;
+
+ private final IClientNotification m_notification;
+ private boolean m_seen;
+ private boolean m_consumed;
+
+ public ClientNotificationConsumerEvent(IClientNotificationConsumerService service, IClientNotification n) {
+ super(service);
+ m_notification = n;
+ }
+
+ @Override
+ public final IClientNotificationConsumerService getSource() {
+ return (IClientNotificationConsumerService) super.getSource();
+ }
+
+ public final IClientNotification getClientNotification() {
+ return m_notification;
+ }
+
+ public final boolean isConsumed() {
+ return m_consumed;
+ }
+
+ /**
+ * When set to true, the event dispatching of this event is not ended, the
+ * other listeners will also see this event. use {@link #isConsumed()} to
+ * check for this property
+ */
+ public final void consume() {
+ m_consumed = true;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/clientnotification/IClientNotificationConsumerListener.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/clientnotification/IClientNotificationConsumerListener.java
index 4f7f574101..2d4555b2f0 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/clientnotification/IClientNotificationConsumerListener.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/clientnotification/IClientNotificationConsumerListener.java
@@ -1,41 +1,41 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.clientnotification;
-
-import java.util.EventListener;
-
-import org.eclipse.core.runtime.jobs.IJobManager;
-import org.eclipse.scout.rt.client.ClientAsyncJob;
-import org.eclipse.scout.rt.client.ClientJob;
-import org.eclipse.scout.rt.client.ClientRule;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.servicetunnel.IServiceTunnel;
-
-public interface IClientNotificationConsumerListener extends EventListener {
-
- /**
- * @param e
- * the event
- * @param sync
- * true if {@link IJobManager#currentJob()} instanceof {@link ClientJob} and {@link ClientJob#isSync()}
- * <p>
- * If a {@link ClientSyncJob} calls
- * {@link IServiceTunnel#invokeService(Class, java.lang.reflect.Method, Object[])} which directly returns
- * notifications, then these notifications are handled immediately.
- * <p>
- * Otherwise this method is called within a {@link ClientAsyncJob}.
- * <p>
- * Therefore when performing operations on the model check {@link ClientJob#isSync()} and eventually use
- * {@link ClientSyncJob} to have proper session monitors used. see {@link ClientSyncJob}, {@link ClientRule}
- */
- void handleEvent(ClientNotificationConsumerEvent e, boolean sync);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.clientnotification;
+
+import java.util.EventListener;
+
+import org.eclipse.core.runtime.jobs.IJobManager;
+import org.eclipse.scout.rt.client.ClientAsyncJob;
+import org.eclipse.scout.rt.client.ClientJob;
+import org.eclipse.scout.rt.client.ClientRule;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.servicetunnel.IServiceTunnel;
+
+public interface IClientNotificationConsumerListener extends EventListener {
+
+ /**
+ * @param e
+ * the event
+ * @param sync
+ * true if {@link IJobManager#currentJob()} instanceof {@link ClientJob} and {@link ClientJob#isSync()}
+ * <p>
+ * If a {@link ClientSyncJob} calls
+ * {@link IServiceTunnel#invokeService(Class, java.lang.reflect.Method, Object[])} which directly returns
+ * notifications, then these notifications are handled immediately.
+ * <p>
+ * Otherwise this method is called within a {@link ClientAsyncJob}.
+ * <p>
+ * Therefore when performing operations on the model check {@link ClientJob#isSync()} and eventually use
+ * {@link ClientSyncJob} to have proper session monitors used. see {@link ClientSyncJob}, {@link ClientRule}
+ */
+ void handleEvent(ClientNotificationConsumerEvent e, boolean sync);
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/clientnotification/IClientNotificationConsumerService.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/clientnotification/IClientNotificationConsumerService.java
index d8a1b2c9c4..7097710195 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/clientnotification/IClientNotificationConsumerService.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/clientnotification/IClientNotificationConsumerService.java
@@ -1,73 +1,73 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.clientnotification;
-
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.client.servicetunnel.IServiceTunnel;
-import org.eclipse.scout.rt.shared.services.common.clientnotification.IClientNotification;
-import org.eclipse.scout.service.IService;
-
-/**
- * This service is used to listen for and handle client notifications. It is
- * also used by {@link IServiceTunnel} to dispatch notifications received by
- * every service response.
- */
-@Priority(-3)
-public interface IClientNotificationConsumerService extends IService {
-
- /**
- * The {@link IServiceTunnel} calles this method whenever client notifications
- * have been received. This method is normally not called by clients
- */
- void dispatchClientNotifications(IClientNotification[] notifications, IClientSession session);
-
- /**
- * A consumer of client notifications can add a listener to this service. The
- * listener is notified immediately on new notifications, in whatever Thread
- *
- * @deprecated use {@link #addClientNotificationConsumerListener(IClientSession, IClientNotificationConsumerListener)}
- * instead. Services that register in their {@link IService#initializeService()} phase normally use
- * {@link #addGlobalClientNotificationConsumerListener(IClientNotificationConsumerListener)}
- */
- @Deprecated
- void addClientNotificationConsumerListener(IClientNotificationConsumerListener listener);
-
- /**
- * @deprecated use
- * {@link #removeClientNotificationConsumerListener(IClientSession, IClientNotificationConsumerListener)}
- * instead
- */
- @Deprecated
- void removeClientNotificationConsumerListener(IClientNotificationConsumerListener listener);
-
- /**
- * A consumer of client notifications can add a listener on this service. The
- * listener is notified immediately on new notifications, in whatever thread
- */
- void addClientNotificationConsumerListener(IClientSession session, IClientNotificationConsumerListener listener);
-
- void removeClientNotificationConsumerListener(IClientSession session, IClientNotificationConsumerListener listener);
-
- /**
- * A consumer of client notifications can add a global listener on this service. The
- * listener is notified immediately on new notifications, in whatever thread.
- * A global listener is notified on any client session, this can be used to attach generic functionality for any
- * session.
- * Note that this does not imply that a client notification is broadcast to any client session. It simply means that
- * whenever a client session receives a notification,
- * this listener is informed.
- */
- void addGlobalClientNotificationConsumerListener(IClientNotificationConsumerListener listener);
-
- void removeGlobalClientNotificationConsumerListener(IClientNotificationConsumerListener listener);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.clientnotification;
+
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.client.servicetunnel.IServiceTunnel;
+import org.eclipse.scout.rt.shared.services.common.clientnotification.IClientNotification;
+import org.eclipse.scout.service.IService;
+
+/**
+ * This service is used to listen for and handle client notifications. It is
+ * also used by {@link IServiceTunnel} to dispatch notifications received by
+ * every service response.
+ */
+@Priority(-3)
+public interface IClientNotificationConsumerService extends IService {
+
+ /**
+ * The {@link IServiceTunnel} calles this method whenever client notifications
+ * have been received. This method is normally not called by clients
+ */
+ void dispatchClientNotifications(IClientNotification[] notifications, IClientSession session);
+
+ /**
+ * A consumer of client notifications can add a listener to this service. The
+ * listener is notified immediately on new notifications, in whatever Thread
+ *
+ * @deprecated use {@link #addClientNotificationConsumerListener(IClientSession, IClientNotificationConsumerListener)}
+ * instead. Services that register in their {@link IService#initializeService()} phase normally use
+ * {@link #addGlobalClientNotificationConsumerListener(IClientNotificationConsumerListener)}
+ */
+ @Deprecated
+ void addClientNotificationConsumerListener(IClientNotificationConsumerListener listener);
+
+ /**
+ * @deprecated use
+ * {@link #removeClientNotificationConsumerListener(IClientSession, IClientNotificationConsumerListener)}
+ * instead
+ */
+ @Deprecated
+ void removeClientNotificationConsumerListener(IClientNotificationConsumerListener listener);
+
+ /**
+ * A consumer of client notifications can add a listener on this service. The
+ * listener is notified immediately on new notifications, in whatever thread
+ */
+ void addClientNotificationConsumerListener(IClientSession session, IClientNotificationConsumerListener listener);
+
+ void removeClientNotificationConsumerListener(IClientSession session, IClientNotificationConsumerListener listener);
+
+ /**
+ * A consumer of client notifications can add a global listener on this service. The
+ * listener is notified immediately on new notifications, in whatever thread.
+ * A global listener is notified on any client session, this can be used to attach generic functionality for any
+ * session.
+ * Note that this does not imply that a client notification is broadcast to any client session. It simply means that
+ * whenever a client session receives a notification,
+ * this listener is informed.
+ */
+ void addGlobalClientNotificationConsumerListener(IClientNotificationConsumerListener listener);
+
+ void removeGlobalClientNotificationConsumerListener(IClientNotificationConsumerListener listener);
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/clientnotification/internal/ClientNotificationConsumerService.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/clientnotification/internal/ClientNotificationConsumerService.java
index 796310fef6..997001e2f0 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/clientnotification/internal/ClientNotificationConsumerService.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/clientnotification/internal/ClientNotificationConsumerService.java
@@ -1,136 +1,136 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.clientnotification.internal;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.scout.commons.EventListenerList;
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ClientAsyncJob;
-import org.eclipse.scout.rt.client.ClientJob;
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.client.services.common.clientnotification.ClientNotificationConsumerEvent;
-import org.eclipse.scout.rt.client.services.common.clientnotification.IClientNotificationConsumerListener;
-import org.eclipse.scout.rt.client.services.common.clientnotification.IClientNotificationConsumerService;
-import org.eclipse.scout.rt.shared.services.common.clientnotification.IClientNotification;
-import org.eclipse.scout.service.AbstractService;
-
-@Priority(-3)
-@SuppressWarnings("deprecation")
-public class ClientNotificationConsumerService extends AbstractService implements IClientNotificationConsumerService {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(ClientNotificationConsumerService.class);
- private static final String SESSION_DATA_KEY = "clientNotificationConsumerServiceState";
-
- private final EventListenerList m_globalListenerList = new EventListenerList();
-
- public ClientNotificationConsumerService() {
- }
-
- private ServiceState getServiceState(IClientSession session) {
- if (session == null) {
- throw new IllegalStateException("session is null");
- }
- ServiceState data = (ServiceState) session.getData(SESSION_DATA_KEY);
- if (data == null) {
- data = new ServiceState();
- session.setData(SESSION_DATA_KEY, data);
- }
- return data;
- }
-
- @Override
- public void dispatchClientNotifications(final IClientNotification[] notifications, final IClientSession session) {
- if (notifications == null || notifications.length == 0) {
- return;
- }
- if (ClientJob.getCurrentSession() == session) {
- // we are sync
- for (IClientNotification n : notifications) {
- fireEvent(session, n, true);
- }
- }
- else {
- // async
- new ClientAsyncJob("Dispatch client notifications", session) {
- @Override
- protected void runVoid(IProgressMonitor monitor) throws Throwable {
- for (IClientNotification n : notifications) {
- fireEvent(session, n, false);
- }
- }
- }.schedule();
- }
- }
-
- @Override
- @Deprecated
- public void addClientNotificationConsumerListener(IClientNotificationConsumerListener listener) {
- addClientNotificationConsumerListener(ClientJob.getCurrentSession(), listener);
- }
-
- @Override
- @Deprecated
- public void removeClientNotificationConsumerListener(IClientNotificationConsumerListener listener) {
- removeClientNotificationConsumerListener(ClientJob.getCurrentSession(), listener);
- }
-
- @Override
- public void addClientNotificationConsumerListener(IClientSession session, IClientNotificationConsumerListener listener) {
- getServiceState(session).m_listenerList.add(IClientNotificationConsumerListener.class, listener);
- }
-
- @Override
- public void removeClientNotificationConsumerListener(IClientSession session, IClientNotificationConsumerListener listener) {
- getServiceState(session).m_listenerList.remove(IClientNotificationConsumerListener.class, listener);
- }
-
- @Override
- public void addGlobalClientNotificationConsumerListener(IClientNotificationConsumerListener listener) {
- m_globalListenerList.add(IClientNotificationConsumerListener.class, listener);
- }
-
- @Override
- public void removeGlobalClientNotificationConsumerListener(IClientNotificationConsumerListener listener) {
- m_globalListenerList.remove(IClientNotificationConsumerListener.class, listener);
- }
-
- private void fireEvent(IClientSession session, IClientNotification notification, boolean sync) {
- ClientNotificationConsumerEvent e = new ClientNotificationConsumerEvent(this, notification);
- IClientNotificationConsumerListener[] globalListeners = m_globalListenerList.getListeners(IClientNotificationConsumerListener.class);
- IClientNotificationConsumerListener[] listeners = getServiceState(session).m_listenerList.getListeners(IClientNotificationConsumerListener.class);
- if (globalListeners != null) {
- for (IClientNotificationConsumerListener listener : globalListeners) {
- try {
- listener.handleEvent(e, sync);
- }
- catch (Throwable t) {
- LOG.error("Listener " + listener.getClass().getName() + " on event " + notification, t);
- }
- }
- }
- if (listeners != null) {
- for (IClientNotificationConsumerListener listener : listeners) {
- try {
- listener.handleEvent(e, sync);
- }
- catch (Throwable t) {
- LOG.error("Listener " + listener.getClass().getName() + " on event " + notification, t);
- }
- }
- }
- }
-
- private static class ServiceState {
- EventListenerList m_listenerList = new EventListenerList();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.clientnotification.internal;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.scout.commons.EventListenerList;
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ClientAsyncJob;
+import org.eclipse.scout.rt.client.ClientJob;
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.client.services.common.clientnotification.ClientNotificationConsumerEvent;
+import org.eclipse.scout.rt.client.services.common.clientnotification.IClientNotificationConsumerListener;
+import org.eclipse.scout.rt.client.services.common.clientnotification.IClientNotificationConsumerService;
+import org.eclipse.scout.rt.shared.services.common.clientnotification.IClientNotification;
+import org.eclipse.scout.service.AbstractService;
+
+@Priority(-3)
+@SuppressWarnings("deprecation")
+public class ClientNotificationConsumerService extends AbstractService implements IClientNotificationConsumerService {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(ClientNotificationConsumerService.class);
+ private static final String SESSION_DATA_KEY = "clientNotificationConsumerServiceState";
+
+ private final EventListenerList m_globalListenerList = new EventListenerList();
+
+ public ClientNotificationConsumerService() {
+ }
+
+ private ServiceState getServiceState(IClientSession session) {
+ if (session == null) {
+ throw new IllegalStateException("session is null");
+ }
+ ServiceState data = (ServiceState) session.getData(SESSION_DATA_KEY);
+ if (data == null) {
+ data = new ServiceState();
+ session.setData(SESSION_DATA_KEY, data);
+ }
+ return data;
+ }
+
+ @Override
+ public void dispatchClientNotifications(final IClientNotification[] notifications, final IClientSession session) {
+ if (notifications == null || notifications.length == 0) {
+ return;
+ }
+ if (ClientJob.getCurrentSession() == session) {
+ // we are sync
+ for (IClientNotification n : notifications) {
+ fireEvent(session, n, true);
+ }
+ }
+ else {
+ // async
+ new ClientAsyncJob("Dispatch client notifications", session) {
+ @Override
+ protected void runVoid(IProgressMonitor monitor) throws Throwable {
+ for (IClientNotification n : notifications) {
+ fireEvent(session, n, false);
+ }
+ }
+ }.schedule();
+ }
+ }
+
+ @Override
+ @Deprecated
+ public void addClientNotificationConsumerListener(IClientNotificationConsumerListener listener) {
+ addClientNotificationConsumerListener(ClientJob.getCurrentSession(), listener);
+ }
+
+ @Override
+ @Deprecated
+ public void removeClientNotificationConsumerListener(IClientNotificationConsumerListener listener) {
+ removeClientNotificationConsumerListener(ClientJob.getCurrentSession(), listener);
+ }
+
+ @Override
+ public void addClientNotificationConsumerListener(IClientSession session, IClientNotificationConsumerListener listener) {
+ getServiceState(session).m_listenerList.add(IClientNotificationConsumerListener.class, listener);
+ }
+
+ @Override
+ public void removeClientNotificationConsumerListener(IClientSession session, IClientNotificationConsumerListener listener) {
+ getServiceState(session).m_listenerList.remove(IClientNotificationConsumerListener.class, listener);
+ }
+
+ @Override
+ public void addGlobalClientNotificationConsumerListener(IClientNotificationConsumerListener listener) {
+ m_globalListenerList.add(IClientNotificationConsumerListener.class, listener);
+ }
+
+ @Override
+ public void removeGlobalClientNotificationConsumerListener(IClientNotificationConsumerListener listener) {
+ m_globalListenerList.remove(IClientNotificationConsumerListener.class, listener);
+ }
+
+ private void fireEvent(IClientSession session, IClientNotification notification, boolean sync) {
+ ClientNotificationConsumerEvent e = new ClientNotificationConsumerEvent(this, notification);
+ IClientNotificationConsumerListener[] globalListeners = m_globalListenerList.getListeners(IClientNotificationConsumerListener.class);
+ IClientNotificationConsumerListener[] listeners = getServiceState(session).m_listenerList.getListeners(IClientNotificationConsumerListener.class);
+ if (globalListeners != null) {
+ for (IClientNotificationConsumerListener listener : globalListeners) {
+ try {
+ listener.handleEvent(e, sync);
+ }
+ catch (Throwable t) {
+ LOG.error("Listener " + listener.getClass().getName() + " on event " + notification, t);
+ }
+ }
+ }
+ if (listeners != null) {
+ for (IClientNotificationConsumerListener listener : listeners) {
+ try {
+ listener.handleEvent(e, sync);
+ }
+ catch (Throwable t) {
+ LOG.error("Listener " + listener.getClass().getName() + " on event " + notification, t);
+ }
+ }
+ }
+ }
+
+ private static class ServiceState {
+ EventListenerList m_listenerList = new EventListenerList();
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/clipboard/IClipboardConsumer.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/clipboard/IClipboardConsumer.java
index 3340bba9a9..1ae9abf0c1 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/clipboard/IClipboardConsumer.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/clipboard/IClipboardConsumer.java
@@ -1,30 +1,30 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.clipboard;
-
-import org.eclipse.scout.commons.dnd.TransferObject;
-import org.eclipse.scout.commons.exception.ProcessingException;
-
-/**
- * Call back interface for clipboard consumers.
- */
-public interface IClipboardConsumer {
-
- /**
- * Call back method invoked by the
- * {@link IClipboardService#consumeContents(IClipboardConsumer, com.bsiag.commons.dnd.TransferObjectRequest...)}
- * service.
- *
- * @param transferObjects
- * @throws ProcessingException
- */
- void consume(TransferObject... transferObjects) throws ProcessingException;
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.clipboard;
+
+import org.eclipse.scout.commons.dnd.TransferObject;
+import org.eclipse.scout.commons.exception.ProcessingException;
+
+/**
+ * Call back interface for clipboard consumers.
+ */
+public interface IClipboardConsumer {
+
+ /**
+ * Call back method invoked by the
+ * {@link IClipboardService#consumeContents(IClipboardConsumer, com.bsiag.commons.dnd.TransferObjectRequest...)}
+ * service.
+ *
+ * @param transferObjects
+ * @throws ProcessingException
+ */
+ void consume(TransferObject... transferObjects) throws ProcessingException;
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/clipboard/IClipboardService.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/clipboard/IClipboardService.java
index df2f8154c2..02676ac6e0 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/clipboard/IClipboardService.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/clipboard/IClipboardService.java
@@ -1,57 +1,57 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.clipboard;
-
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.commons.dnd.TransferObject;
-import org.eclipse.scout.commons.dnd.TransferObjectRequest;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.service.IService;
-
-/**
- * This service provides access to the system clipboard and therefore to exchange
- * data with other applications. It is not intended to be used for application-internal
- * communication. In particular, all methods of this interface are considered to be
- * executed asynchronously (in fact, this is a requirement by the underlying
- * implementations which use UI resources for accessing the system clipboard).
- */
-@Priority(-3)
-public interface IClipboardService extends IService {
-
- /**
- * Puts the given transfer object into the system clipboard. Typically this is done
- * asynchronously because the clipboard is a UI resource.
- *
- * @param transferObject
- * @throws ProcessingException
- */
- void setContents(TransferObject transferObject) throws ProcessingException;
-
- /**
- * Reads the requested contents of the clipboard and invokes the call back clipboard
- * consumer. The optional requests var arg parameter conditions the parameters of the
- * call back method {@link IClipboardConsumer#consume(TransferObject...)}.
- *
- * @param clipboardConsumer
- * @param requests
- * @throws ProcessingException
- */
- void consumeContents(IClipboardConsumer clipboardConsumer, TransferObjectRequest... requests) throws ProcessingException;
-
- /**
- * Convenience method for putting the given string into the system clipboard.See {@link #setContents(TransferObject)}
- * for semantics.
- *
- * @param textContents
- * @throws ProcessingException
- */
- void setTextContents(String textContents) throws ProcessingException;
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.clipboard;
+
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.commons.dnd.TransferObject;
+import org.eclipse.scout.commons.dnd.TransferObjectRequest;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.service.IService;
+
+/**
+ * This service provides access to the system clipboard and therefore to exchange
+ * data with other applications. It is not intended to be used for application-internal
+ * communication. In particular, all methods of this interface are considered to be
+ * executed asynchronously (in fact, this is a requirement by the underlying
+ * implementations which use UI resources for accessing the system clipboard).
+ */
+@Priority(-3)
+public interface IClipboardService extends IService {
+
+ /**
+ * Puts the given transfer object into the system clipboard. Typically this is done
+ * asynchronously because the clipboard is a UI resource.
+ *
+ * @param transferObject
+ * @throws ProcessingException
+ */
+ void setContents(TransferObject transferObject) throws ProcessingException;
+
+ /**
+ * Reads the requested contents of the clipboard and invokes the call back clipboard
+ * consumer. The optional requests var arg parameter conditions the parameters of the
+ * call back method {@link IClipboardConsumer#consume(TransferObject...)}.
+ *
+ * @param clipboardConsumer
+ * @param requests
+ * @throws ProcessingException
+ */
+ void consumeContents(IClipboardConsumer clipboardConsumer, TransferObjectRequest... requests) throws ProcessingException;
+
+ /**
+ * Convenience method for putting the given string into the system clipboard.See {@link #setContents(TransferObject)}
+ * for semantics.
+ *
+ * @param textContents
+ * @throws ProcessingException
+ */
+ void setTextContents(String textContents) throws ProcessingException;
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/code/CodeServiceClientProxy.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/code/CodeServiceClientProxy.java
index f66870c6d3..cfeb283092 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/code/CodeServiceClientProxy.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/code/CodeServiceClientProxy.java
@@ -1,398 +1,398 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.code;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.scout.commons.CompositeObject;
-import org.eclipse.scout.commons.LocaleThreadLocal;
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.commons.holders.Holder;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.commons.osgi.BundleClassDescriptor;
-import org.eclipse.scout.rt.client.ClientJob;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.client.services.common.clientnotification.ClientNotificationConsumerEvent;
-import org.eclipse.scout.rt.client.services.common.clientnotification.IClientNotificationConsumerListener;
-import org.eclipse.scout.rt.client.services.common.clientnotification.IClientNotificationConsumerService;
-import org.eclipse.scout.rt.client.servicetunnel.ServiceTunnelUtility;
-import org.eclipse.scout.rt.shared.services.common.code.CodeTypeChangedNotification;
-import org.eclipse.scout.rt.shared.services.common.code.ICode;
-import org.eclipse.scout.rt.shared.services.common.code.ICodeService;
-import org.eclipse.scout.rt.shared.services.common.code.ICodeType;
-import org.eclipse.scout.rt.shared.services.common.code.ICodeVisitor;
-import org.eclipse.scout.service.AbstractService;
-import org.eclipse.scout.service.SERVICES;
-
-/**
- * maintains a cache of ICodeType objects that can be (re)loaded using the
- * methods loadCodeType, loadCodeTypes if getters and finders are called with
- * partitionId, cache is not used.
- * <p>
- * Service state is per [{@link IClientSession}.class,{@link LocaleThreadLocal#get()},partitionId]
- */
-@Priority(-3)
-public class CodeServiceClientProxy extends AbstractService implements ICodeService {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(CodeServiceClientProxy.class);
-
- private final Object m_stateLock = new Object();
- private final HashMap<CompositeObject, ServiceState> m_stateMap = new HashMap<CompositeObject, ServiceState>();
-
- public CodeServiceClientProxy() {
- }
-
- private ServiceState getServiceState() {
- return getServiceState(null);
- }
-
- private ServiceState getServiceState(Long partitionId) {
- IClientSession session = ClientJob.getCurrentSession();
- if (session == null) {
- LOG.warn("could not find a client session");
- return null;
- }
- if (partitionId == null) {
- if (session.getSharedVariableMap().containsKey(ICodeType.PROP_PARTITION_ID)) {
- partitionId = (Long) session.getSharedVariableMap().get(ICodeType.PROP_PARTITION_ID);
- }
- }
- CompositeObject key = new CompositeObject(session.getClass(), LocaleThreadLocal.get(), partitionId);
- synchronized (m_stateLock) {
- ServiceState data = (ServiceState) m_stateMap.get(key);
- if (data == null) {
- data = new ServiceState();
- m_stateMap.put(key, data);
- }
- return data;
- }
- }
-
- @SuppressWarnings("deprecation")
- @Override
- public void initializeService() {
- super.initializeService();
- // add client notification listener
- SERVICES.getService(IClientNotificationConsumerService.class).addGlobalClientNotificationConsumerListener(new IClientNotificationConsumerListener() {
- @Override
- public void handleEvent(final ClientNotificationConsumerEvent e, boolean sync) {
- if (e.getClientNotification().getClass() == CodeTypeChangedNotification.class) {
- if (sync) {
- try {
- reloadCodeTypes(((CodeTypeChangedNotification) e.getClientNotification()).getCodeTypes());
- }
- catch (Throwable t) {
- LOG.error("update due to client notification", t);
- // nop
- }
- }
- else {
- new ClientSyncJob("Reload code types", ClientSyncJob.getCurrentSession()) {
- @Override
- protected void runVoid(IProgressMonitor monitor) throws Throwable {
- reloadCodeTypes(((CodeTypeChangedNotification) e.getClientNotification()).getCodeTypes());
- }
- }.schedule();
- }
- }
- }
- });
- }
-
- @Override
- public <T extends ICodeType> T getCodeType(Class<T> type) {
- ServiceState state = getServiceState();
- synchronized (state.m_cacheLock) {
- @SuppressWarnings("unchecked")
- T instance = (T) state.m_cache.get(type);
- if (instance == null) {
- instance = getRemoteService().getCodeType(type);
- if (instance != null) {
- state.m_cache.put(type, instance);
- }
- }
- return instance;
- }
- }
-
- @Override
- public <T extends ICodeType> T getCodeType(Long partitionId, Class<T> type) {
- T instance = getRemoteService().getCodeType(partitionId, type);
- return instance;
- }
-
- @Override
- public ICodeType findCodeTypeById(Object id) {
- if (id == null) {
- return null;
- }
- ICodeType ct = findCodeTypeByIdInternal(id);
- if (ct != null) {
- return ct;
- }
- // populate code type cache
- getAllCodeTypes("");
- return findCodeTypeByIdInternal(id);
- }
-
- /**
- * @return Returns the code type with the given id or <code>null</code> if it is not found in the cache.
- */
- private ICodeType findCodeTypeByIdInternal(Object id) {
- ServiceState state = getServiceState();
- synchronized (state.m_cacheLock) {
- for (ICodeType ct : state.m_cache.values()) {
- if (id.equals(ct.getId())) {
- return ct;
- }
- }
- }
- return null;
- }
-
- @Override
- public ICodeType findCodeTypeById(Long partitionId, Object id) {
- if (id == null) {
- return null;
- }
- ICodeType ct = findCodeTypeByIdInternal(partitionId, id);
- if (ct != null) {
- return ct;
- }
- // populate code type cache
- getAllCodeTypes("");
- return findCodeTypeByIdInternal(partitionId, id);
- }
-
- /**
- * @return Returns the code type with the given id and partition or <code>null</code> if it is not found in the cache.
- */
- private ICodeType findCodeTypeByIdInternal(Long partitionId, Object id) {
- ServiceState state = getServiceState(partitionId);
- synchronized (state.m_cacheLock) {
- for (ICodeType ct : state.m_cache.values()) {
- if (id.equals(ct.getId())) {
- return ct;
- }
- }
- }
- return null;
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public ICodeType[] getCodeTypes(Class... types) {
- ArrayList<Class> missingTypes = new ArrayList<Class>();
- ICodeType[] instances = new ICodeType[types.length];
- ServiceState state = getServiceState();
- synchronized (state.m_cacheLock) {
- for (int i = 0; i < types.length; i++) {
- instances[i] = state.m_cache.get(types[i]);
- if (instances[i] == null) {
- missingTypes.add(types[i]);
- }
- }
- }
- if (missingTypes.size() > 0) {
- ICodeType[] newInstances = getRemoteService().getCodeTypes(missingTypes.toArray(new Class[0]));
- synchronized (state.m_cacheLock) {
- int k = 0;
- for (int i = 0; i < types.length; i++) {
- if (instances[i] == null) {
- instances[i] = newInstances[k];
- if (instances[i] != null) {
- state.m_cache.put(types[i], instances[i]);
- }
- k++;
- }
- }
- }
- }
- return instances;
- }
-
- @Override
- public ICodeType[] getCodeTypes(Long partitionId, Class... types) {
- ICodeType[] codeTypes = getRemoteService().getCodeTypes(partitionId, types);
- return codeTypes;
- }
-
- private <T extends ICode> Class getDeclaringCodeTypeClass(final Class<T> type) {
- if (type == null) {
- return null;
- }
- Class declaringCodeTypeClass = null;
- if (type.getDeclaringClass() != null) {
- // code is inner type of code type or another code
- Class c = type.getDeclaringClass();
- while (c != null && !(ICodeType.class.isAssignableFrom(c))) {
- c = c.getDeclaringClass();
- }
- declaringCodeTypeClass = c;
- }
- if (declaringCodeTypeClass == null) {
- try {
- declaringCodeTypeClass = type.newInstance().getCodeType().getClass();
- }
- catch (Throwable t) {
- LOG.error("find code " + type, t);
- }
- }
- return declaringCodeTypeClass;
- }
-
- @SuppressWarnings("unchecked")
- private <T> T findCode(final Class<T> type, ICodeType codeType) {
- final Holder<ICode> codeHolder = new Holder<ICode>(ICode.class);
- ICodeVisitor v = new ICodeVisitor() {
- @Override
- public boolean visit(ICode code, int treeLevel) {
- if (code.getClass() == type) {
- codeHolder.setValue(code);
- return false;
- }
- return true;
- }
- };
- codeType.visit(v);
- return (T) codeHolder.getValue();
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public <T extends ICode> T getCode(final Class<T> type) {
- Class declaringCodeTypeClass = getDeclaringCodeTypeClass(type);
- ICodeType codeType = getCodeType(declaringCodeTypeClass);
- return findCode(type, codeType);
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public <T extends ICode> T getCode(Long partitionId, final Class<T> type) {
- Class declaringCodeTypeClass = getDeclaringCodeTypeClass(type);
- ICodeType codeType = getCodeType(partitionId, declaringCodeTypeClass);
- return findCode(type, codeType);
- }
-
- @Override
- public <T extends ICodeType> T reloadCodeType(Class<T> type) {
- unloadCodeType(type);
- // do NOT call reload on the backend service, clients can not reload codes,
- // they can just refresh their local cache
- // In order to reload a code, the call to reload has to be placed on the
- // server
- T instance = getRemoteService().getCodeType(type);
- ServiceState state = getServiceState();
- synchronized (state.m_cacheLock) {
- if (instance != null) {
- state.m_cache.put(type, instance);
- }
- }
- return instance;
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public ICodeType[] reloadCodeTypes(Class... types) {
- for (int i = 0; i < types.length; i++) {
- unloadCodeType(types[i]);
- }
- // do NOT call reload on the backend service, clients can not reload codes,
- // they can just refresh their local cache
- // In order to reload a code, the call to reload has to be placed on the
- // server
- ICodeType[] instances = getRemoteService().getCodeTypes(types);
- ServiceState state = getServiceState();
- synchronized (state.m_cacheLock) {
- for (int i = 0; i < types.length; i++) {
- if (instances[i] != null) {
- state.m_cache.put(types[i], instances[i]);
- }
- }
- }
- return instances;
- }
-
- @Override
- public BundleClassDescriptor[] getAllCodeTypeClasses(String classPrefix) {
- if (classPrefix == null) {
- return new BundleClassDescriptor[0];
- }
- ServiceState state = getServiceState();
- synchronized (state.m_codeTypeClassDescriptorMapLock) {
- BundleClassDescriptor[] a = state.m_codeTypeClassDescriptorMap.get(classPrefix);
- if (a != null) {
- return a;
- }
- // load code types from server-side
- HashSet<BundleClassDescriptor> verifiedCodeTypes = new HashSet<BundleClassDescriptor>();
- BundleClassDescriptor[] remoteCodeTypes = getRemoteService().getAllCodeTypeClasses(classPrefix);
- for (BundleClassDescriptor d : remoteCodeTypes) {
- try {
- // check whether code type is available on client-side
- Platform.getBundle(d.getBundleSymbolicName()).loadClass(d.getClassName());
- verifiedCodeTypes.add(d);
- }
- catch (Throwable t) {
- LOG.error("Missing code-type in client: " + d.getClassName() + ", defined in server-side bundle " + d.getBundleSymbolicName());
- }
- }
- //
- a = verifiedCodeTypes.toArray(new BundleClassDescriptor[verifiedCodeTypes.size()]);
- state.m_codeTypeClassDescriptorMap.put(classPrefix, a);
- return a;
- }
- }
-
- @Override
- public ICodeType[] getAllCodeTypes(String classPrefix) {
- ArrayList<Class> list = new ArrayList<Class>();
- for (BundleClassDescriptor d : getAllCodeTypeClasses(classPrefix)) {
- try {
- list.add(Platform.getBundle(d.getBundleSymbolicName()).loadClass(d.getClassName()));
- }
- catch (Throwable t) {
- LOG.warn("Loading " + d.getClassName() + " of bundle " + d.getBundleSymbolicName(), t);
- continue;
- }
- }
- return getCodeTypes(list.toArray(new Class[list.size()]));
- }
-
- @Override
- public ICodeType[] getAllCodeTypes(String classPrefix, Long partitionId) {
- return getAllCodeTypes(classPrefix);
- }
-
- private <T extends ICodeType> void unloadCodeType(Class<T> type) {
- ServiceState state = getServiceState();
- synchronized (state.m_cacheLock) {
- state.m_cache.remove(type);
- }
- }
-
- private ICodeService getRemoteService() {
- return ServiceTunnelUtility.createProxy(ICodeService.class, ClientSyncJob.getCurrentSession().getServiceTunnel());
- }
-
- private static class ServiceState {
- final Object m_cacheLock = new Object();
- final HashMap<Class<? extends ICodeType>, ICodeType> m_cache = new HashMap<Class<? extends ICodeType>, ICodeType>();
- //
- final Object m_codeTypeClassDescriptorMapLock = new Object();
- final HashMap<String, BundleClassDescriptor[]> m_codeTypeClassDescriptorMap = new HashMap<String, BundleClassDescriptor[]>();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.code;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.scout.commons.CompositeObject;
+import org.eclipse.scout.commons.LocaleThreadLocal;
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.commons.holders.Holder;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.commons.osgi.BundleClassDescriptor;
+import org.eclipse.scout.rt.client.ClientJob;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.client.services.common.clientnotification.ClientNotificationConsumerEvent;
+import org.eclipse.scout.rt.client.services.common.clientnotification.IClientNotificationConsumerListener;
+import org.eclipse.scout.rt.client.services.common.clientnotification.IClientNotificationConsumerService;
+import org.eclipse.scout.rt.client.servicetunnel.ServiceTunnelUtility;
+import org.eclipse.scout.rt.shared.services.common.code.CodeTypeChangedNotification;
+import org.eclipse.scout.rt.shared.services.common.code.ICode;
+import org.eclipse.scout.rt.shared.services.common.code.ICodeService;
+import org.eclipse.scout.rt.shared.services.common.code.ICodeType;
+import org.eclipse.scout.rt.shared.services.common.code.ICodeVisitor;
+import org.eclipse.scout.service.AbstractService;
+import org.eclipse.scout.service.SERVICES;
+
+/**
+ * maintains a cache of ICodeType objects that can be (re)loaded using the
+ * methods loadCodeType, loadCodeTypes if getters and finders are called with
+ * partitionId, cache is not used.
+ * <p>
+ * Service state is per [{@link IClientSession}.class,{@link LocaleThreadLocal#get()},partitionId]
+ */
+@Priority(-3)
+public class CodeServiceClientProxy extends AbstractService implements ICodeService {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(CodeServiceClientProxy.class);
+
+ private final Object m_stateLock = new Object();
+ private final HashMap<CompositeObject, ServiceState> m_stateMap = new HashMap<CompositeObject, ServiceState>();
+
+ public CodeServiceClientProxy() {
+ }
+
+ private ServiceState getServiceState() {
+ return getServiceState(null);
+ }
+
+ private ServiceState getServiceState(Long partitionId) {
+ IClientSession session = ClientJob.getCurrentSession();
+ if (session == null) {
+ LOG.warn("could not find a client session");
+ return null;
+ }
+ if (partitionId == null) {
+ if (session.getSharedVariableMap().containsKey(ICodeType.PROP_PARTITION_ID)) {
+ partitionId = (Long) session.getSharedVariableMap().get(ICodeType.PROP_PARTITION_ID);
+ }
+ }
+ CompositeObject key = new CompositeObject(session.getClass(), LocaleThreadLocal.get(), partitionId);
+ synchronized (m_stateLock) {
+ ServiceState data = (ServiceState) m_stateMap.get(key);
+ if (data == null) {
+ data = new ServiceState();
+ m_stateMap.put(key, data);
+ }
+ return data;
+ }
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public void initializeService() {
+ super.initializeService();
+ // add client notification listener
+ SERVICES.getService(IClientNotificationConsumerService.class).addGlobalClientNotificationConsumerListener(new IClientNotificationConsumerListener() {
+ @Override
+ public void handleEvent(final ClientNotificationConsumerEvent e, boolean sync) {
+ if (e.getClientNotification().getClass() == CodeTypeChangedNotification.class) {
+ if (sync) {
+ try {
+ reloadCodeTypes(((CodeTypeChangedNotification) e.getClientNotification()).getCodeTypes());
+ }
+ catch (Throwable t) {
+ LOG.error("update due to client notification", t);
+ // nop
+ }
+ }
+ else {
+ new ClientSyncJob("Reload code types", ClientSyncJob.getCurrentSession()) {
+ @Override
+ protected void runVoid(IProgressMonitor monitor) throws Throwable {
+ reloadCodeTypes(((CodeTypeChangedNotification) e.getClientNotification()).getCodeTypes());
+ }
+ }.schedule();
+ }
+ }
+ }
+ });
+ }
+
+ @Override
+ public <T extends ICodeType> T getCodeType(Class<T> type) {
+ ServiceState state = getServiceState();
+ synchronized (state.m_cacheLock) {
+ @SuppressWarnings("unchecked")
+ T instance = (T) state.m_cache.get(type);
+ if (instance == null) {
+ instance = getRemoteService().getCodeType(type);
+ if (instance != null) {
+ state.m_cache.put(type, instance);
+ }
+ }
+ return instance;
+ }
+ }
+
+ @Override
+ public <T extends ICodeType> T getCodeType(Long partitionId, Class<T> type) {
+ T instance = getRemoteService().getCodeType(partitionId, type);
+ return instance;
+ }
+
+ @Override
+ public ICodeType findCodeTypeById(Object id) {
+ if (id == null) {
+ return null;
+ }
+ ICodeType ct = findCodeTypeByIdInternal(id);
+ if (ct != null) {
+ return ct;
+ }
+ // populate code type cache
+ getAllCodeTypes("");
+ return findCodeTypeByIdInternal(id);
+ }
+
+ /**
+ * @return Returns the code type with the given id or <code>null</code> if it is not found in the cache.
+ */
+ private ICodeType findCodeTypeByIdInternal(Object id) {
+ ServiceState state = getServiceState();
+ synchronized (state.m_cacheLock) {
+ for (ICodeType ct : state.m_cache.values()) {
+ if (id.equals(ct.getId())) {
+ return ct;
+ }
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public ICodeType findCodeTypeById(Long partitionId, Object id) {
+ if (id == null) {
+ return null;
+ }
+ ICodeType ct = findCodeTypeByIdInternal(partitionId, id);
+ if (ct != null) {
+ return ct;
+ }
+ // populate code type cache
+ getAllCodeTypes("");
+ return findCodeTypeByIdInternal(partitionId, id);
+ }
+
+ /**
+ * @return Returns the code type with the given id and partition or <code>null</code> if it is not found in the cache.
+ */
+ private ICodeType findCodeTypeByIdInternal(Long partitionId, Object id) {
+ ServiceState state = getServiceState(partitionId);
+ synchronized (state.m_cacheLock) {
+ for (ICodeType ct : state.m_cache.values()) {
+ if (id.equals(ct.getId())) {
+ return ct;
+ }
+ }
+ }
+ return null;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public ICodeType[] getCodeTypes(Class... types) {
+ ArrayList<Class> missingTypes = new ArrayList<Class>();
+ ICodeType[] instances = new ICodeType[types.length];
+ ServiceState state = getServiceState();
+ synchronized (state.m_cacheLock) {
+ for (int i = 0; i < types.length; i++) {
+ instances[i] = state.m_cache.get(types[i]);
+ if (instances[i] == null) {
+ missingTypes.add(types[i]);
+ }
+ }
+ }
+ if (missingTypes.size() > 0) {
+ ICodeType[] newInstances = getRemoteService().getCodeTypes(missingTypes.toArray(new Class[0]));
+ synchronized (state.m_cacheLock) {
+ int k = 0;
+ for (int i = 0; i < types.length; i++) {
+ if (instances[i] == null) {
+ instances[i] = newInstances[k];
+ if (instances[i] != null) {
+ state.m_cache.put(types[i], instances[i]);
+ }
+ k++;
+ }
+ }
+ }
+ }
+ return instances;
+ }
+
+ @Override
+ public ICodeType[] getCodeTypes(Long partitionId, Class... types) {
+ ICodeType[] codeTypes = getRemoteService().getCodeTypes(partitionId, types);
+ return codeTypes;
+ }
+
+ private <T extends ICode> Class getDeclaringCodeTypeClass(final Class<T> type) {
+ if (type == null) {
+ return null;
+ }
+ Class declaringCodeTypeClass = null;
+ if (type.getDeclaringClass() != null) {
+ // code is inner type of code type or another code
+ Class c = type.getDeclaringClass();
+ while (c != null && !(ICodeType.class.isAssignableFrom(c))) {
+ c = c.getDeclaringClass();
+ }
+ declaringCodeTypeClass = c;
+ }
+ if (declaringCodeTypeClass == null) {
+ try {
+ declaringCodeTypeClass = type.newInstance().getCodeType().getClass();
+ }
+ catch (Throwable t) {
+ LOG.error("find code " + type, t);
+ }
+ }
+ return declaringCodeTypeClass;
+ }
+
+ @SuppressWarnings("unchecked")
+ private <T> T findCode(final Class<T> type, ICodeType codeType) {
+ final Holder<ICode> codeHolder = new Holder<ICode>(ICode.class);
+ ICodeVisitor v = new ICodeVisitor() {
+ @Override
+ public boolean visit(ICode code, int treeLevel) {
+ if (code.getClass() == type) {
+ codeHolder.setValue(code);
+ return false;
+ }
+ return true;
+ }
+ };
+ codeType.visit(v);
+ return (T) codeHolder.getValue();
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public <T extends ICode> T getCode(final Class<T> type) {
+ Class declaringCodeTypeClass = getDeclaringCodeTypeClass(type);
+ ICodeType codeType = getCodeType(declaringCodeTypeClass);
+ return findCode(type, codeType);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public <T extends ICode> T getCode(Long partitionId, final Class<T> type) {
+ Class declaringCodeTypeClass = getDeclaringCodeTypeClass(type);
+ ICodeType codeType = getCodeType(partitionId, declaringCodeTypeClass);
+ return findCode(type, codeType);
+ }
+
+ @Override
+ public <T extends ICodeType> T reloadCodeType(Class<T> type) {
+ unloadCodeType(type);
+ // do NOT call reload on the backend service, clients can not reload codes,
+ // they can just refresh their local cache
+ // In order to reload a code, the call to reload has to be placed on the
+ // server
+ T instance = getRemoteService().getCodeType(type);
+ ServiceState state = getServiceState();
+ synchronized (state.m_cacheLock) {
+ if (instance != null) {
+ state.m_cache.put(type, instance);
+ }
+ }
+ return instance;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public ICodeType[] reloadCodeTypes(Class... types) {
+ for (int i = 0; i < types.length; i++) {
+ unloadCodeType(types[i]);
+ }
+ // do NOT call reload on the backend service, clients can not reload codes,
+ // they can just refresh their local cache
+ // In order to reload a code, the call to reload has to be placed on the
+ // server
+ ICodeType[] instances = getRemoteService().getCodeTypes(types);
+ ServiceState state = getServiceState();
+ synchronized (state.m_cacheLock) {
+ for (int i = 0; i < types.length; i++) {
+ if (instances[i] != null) {
+ state.m_cache.put(types[i], instances[i]);
+ }
+ }
+ }
+ return instances;
+ }
+
+ @Override
+ public BundleClassDescriptor[] getAllCodeTypeClasses(String classPrefix) {
+ if (classPrefix == null) {
+ return new BundleClassDescriptor[0];
+ }
+ ServiceState state = getServiceState();
+ synchronized (state.m_codeTypeClassDescriptorMapLock) {
+ BundleClassDescriptor[] a = state.m_codeTypeClassDescriptorMap.get(classPrefix);
+ if (a != null) {
+ return a;
+ }
+ // load code types from server-side
+ HashSet<BundleClassDescriptor> verifiedCodeTypes = new HashSet<BundleClassDescriptor>();
+ BundleClassDescriptor[] remoteCodeTypes = getRemoteService().getAllCodeTypeClasses(classPrefix);
+ for (BundleClassDescriptor d : remoteCodeTypes) {
+ try {
+ // check whether code type is available on client-side
+ Platform.getBundle(d.getBundleSymbolicName()).loadClass(d.getClassName());
+ verifiedCodeTypes.add(d);
+ }
+ catch (Throwable t) {
+ LOG.error("Missing code-type in client: " + d.getClassName() + ", defined in server-side bundle " + d.getBundleSymbolicName());
+ }
+ }
+ //
+ a = verifiedCodeTypes.toArray(new BundleClassDescriptor[verifiedCodeTypes.size()]);
+ state.m_codeTypeClassDescriptorMap.put(classPrefix, a);
+ return a;
+ }
+ }
+
+ @Override
+ public ICodeType[] getAllCodeTypes(String classPrefix) {
+ ArrayList<Class> list = new ArrayList<Class>();
+ for (BundleClassDescriptor d : getAllCodeTypeClasses(classPrefix)) {
+ try {
+ list.add(Platform.getBundle(d.getBundleSymbolicName()).loadClass(d.getClassName()));
+ }
+ catch (Throwable t) {
+ LOG.warn("Loading " + d.getClassName() + " of bundle " + d.getBundleSymbolicName(), t);
+ continue;
+ }
+ }
+ return getCodeTypes(list.toArray(new Class[list.size()]));
+ }
+
+ @Override
+ public ICodeType[] getAllCodeTypes(String classPrefix, Long partitionId) {
+ return getAllCodeTypes(classPrefix);
+ }
+
+ private <T extends ICodeType> void unloadCodeType(Class<T> type) {
+ ServiceState state = getServiceState();
+ synchronized (state.m_cacheLock) {
+ state.m_cache.remove(type);
+ }
+ }
+
+ private ICodeService getRemoteService() {
+ return ServiceTunnelUtility.createProxy(ICodeService.class, ClientSyncJob.getCurrentSession().getServiceTunnel());
+ }
+
+ private static class ServiceState {
+ final Object m_cacheLock = new Object();
+ final HashMap<Class<? extends ICodeType>, ICodeType> m_cache = new HashMap<Class<? extends ICodeType>, ICodeType>();
+ //
+ final Object m_codeTypeClassDescriptorMapLock = new Object();
+ final HashMap<String, BundleClassDescriptor[]> m_codeTypeClassDescriptorMap = new HashMap<String, BundleClassDescriptor[]>();
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/exceptionhandler/ClientExceptionHandlerService.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/exceptionhandler/ClientExceptionHandlerService.java
index f4d592750a..a4f39e644b 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/exceptionhandler/ClientExceptionHandlerService.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/exceptionhandler/ClientExceptionHandlerService.java
@@ -1,29 +1,29 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.exceptionhandler;
-
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.services.common.exceptionhandler.internal.InternalClientExceptionHandlerService;
-
-@Priority(-1)
-public class ClientExceptionHandlerService extends InternalClientExceptionHandlerService {
-
- @Override
- public void handleException(ProcessingException pe) {
- super.handleException(pe);
- }
-
- @Override
- protected void showExceptionInUI(ProcessingException pe) {
- super.showExceptionInUI(pe);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.exceptionhandler;
+
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.services.common.exceptionhandler.internal.InternalClientExceptionHandlerService;
+
+@Priority(-1)
+public class ClientExceptionHandlerService extends InternalClientExceptionHandlerService {
+
+ @Override
+ public void handleException(ProcessingException pe) {
+ super.handleException(pe);
+ }
+
+ @Override
+ protected void showExceptionInUI(ProcessingException pe) {
+ super.showExceptionInUI(pe);
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/exceptionhandler/ErrorHandler.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/exceptionhandler/ErrorHandler.java
index 594ae63b32..c06d0b02b8 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/exceptionhandler/ErrorHandler.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/exceptionhandler/ErrorHandler.java
@@ -1,249 +1,249 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.exceptionhandler;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.lang.reflect.UndeclaredThrowableException;
-import java.net.MalformedURLException;
-import java.net.NoRouteToHostException;
-import java.net.SocketException;
-import java.net.UnknownHostException;
-import java.security.GeneralSecurityException;
-
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.exception.IProcessingStatus;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.exception.VetoException;
-import org.eclipse.scout.rt.client.ui.messagebox.MessageBox;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.servicetunnel.HttpException;
-import org.eclipse.scout.rt.shared.servicetunnel.VersionMismatchException;
-
-public class ErrorHandler {
- private String m_title;
- private String m_text;
- private String m_detail;
- private String m_acceptText;
- private String m_copyPasteText;
- private ProcessingException m_cause;
-
- public ErrorHandler(Throwable t) {
- parse(t);
- }
-
- public String getTitle() {
- return m_title;
- }
-
- public String getText() {
- return m_text;
- }
-
- public String getDetail() {
- return m_detail;
- }
-
- public String getCopyPasteText() {
- return m_copyPasteText;
- }
-
- public String getAcceptText() {
- return m_acceptText;
- }
-
- public ProcessingException getCause() {
- return m_cause;
- }
-
- public IProcessingStatus getStatus() {
- return m_cause.getStatus();
- }
-
- public void showMessageBox() {
- MessageBox mbox = new MessageBox(
- m_title,
- m_text,
- m_detail,
- m_acceptText,
- null,
- null,
- m_copyPasteText,
- null
- );
- mbox.setSeverity(m_cause.getStatus().getSeverity());
- mbox.startMessageBox();
- }
-
- private void parse(Throwable exception) {
- if (exception instanceof UndeclaredThrowableException) {
- exception = ((UndeclaredThrowableException) exception).getCause();
- }
- //
- if (exception instanceof ProcessingException) {
- m_cause = (ProcessingException) exception;
- }
- else {
- m_cause = new ProcessingException(ScoutTexts.get("Error"), ScoutTexts.get("ErrorAndRetryTextDefault"), exception);
- }
- m_text = m_cause.getStatus().getTitle();
- if (m_text == null || m_text.length() == 0) {
- m_text = ScoutTexts.get("Error");
- }
- m_detail = m_cause.getStatus().getMessage();
- m_acceptText = ScoutTexts.get("Ok");
- Throwable t = exception;
- while (t != null) {
- String msg = "\n\n" + StringUtility.wrapWord(ScoutTexts.get("OriginalErrorMessageIs", t.getClass().getSimpleName() + " " + t.getLocalizedMessage()), 80);
- if (t instanceof HttpException) {
- int statusCode = ((HttpException) t).getStatusCode();
- switch (statusCode) {
- case 401:
- case 403: {
- m_title = ScoutTexts.get("ErrorTitleLogin");
- m_text = ScoutTexts.get("ErrorTextLogin") + msg;
- break;
- }
- default: {
- m_title = ScoutTexts.get("NetErrorTitle");
- m_text = ScoutTexts.get("NetErrorText") + msg;
- m_detail = ScoutTexts.get("NetErrorInfo");
- }
- }
- return;
- }
- else if (t instanceof GeneralSecurityException) {
- m_title = ScoutTexts.get("ErrorTitleLogin");
- m_text = ScoutTexts.get("ErrorTextLogin") + msg;
- return;
- }
- else if (t instanceof SecurityException) {
- m_title = ScoutTexts.get("ErrorTitleSecurity");
- m_text = ScoutTexts.get("ErrorTextSecurity") + msg;
- return;
- }
- else if (t instanceof MalformedURLException) {
- m_title = ScoutTexts.get("NetErrorTitle");
- m_text = ScoutTexts.get("NetErrorText") + msg;
- m_detail = ScoutTexts.get("NetErrorInfo");
- return;
- }
- else if (t instanceof InterruptedException) {
- m_title = ScoutTexts.get("InterruptedErrorTitle");
- m_text = ScoutTexts.get("InterruptedErrorText");
- return;
- }
- else if (t instanceof UnknownHostException) {
- m_title = ScoutTexts.get("NetErrorTitle");
- m_text = ScoutTexts.get("NetErrorText") + msg;
- m_detail = ScoutTexts.get("NetErrorInfo");
- return;
- }
- else if (t instanceof FileNotFoundException) {
- m_title = ScoutTexts.get("FileNotFoundTitle");
- m_text = ScoutTexts.get("FileNotFoundMessage", ((FileNotFoundException) t).getMessage());
- return;
- }
- else if (t instanceof NoRouteToHostException) {
- m_title = ScoutTexts.get("NetErrorTitle");
- m_text = ScoutTexts.get("NetErrorText") + msg;
- m_detail = ScoutTexts.get("NetErrorInfo");
- return;
- }
- else if (t instanceof SocketException) {
- m_title = ScoutTexts.get("NetErrorTitle");
- m_text = ScoutTexts.get("NetErrorText") + msg;
- m_detail = ScoutTexts.get("NetErrorInfo");
- return;
- }
- else if (t instanceof UserInterruptedException) {
- m_title = ScoutTexts.get("IOErrorTitle");
- m_text = UserInterruptedException.class.getSimpleName();
- m_detail = ScoutTexts.get("IOErrorInfo");
- return;
- }
- else if (t instanceof IOException) {
- m_title = ScoutTexts.get("IOErrorTitle");
- m_text = ScoutTexts.get("IOErrorText") + ": " + t.getLocalizedMessage() + msg;
- m_detail = ScoutTexts.get("IOErrorInfo");
- return;
- }
- else if (t instanceof VersionMismatchException) {
- VersionMismatchException ve = (VersionMismatchException) t;
- m_title = ScoutTexts.get("VersionMismatchTitle");
- m_text = ScoutTexts.get("VersionMismatchTextXY", ve.getOldVersion(), ve.getNewVersion());
- m_detail = null;
- return;
- }
- else if (t instanceof VetoException) {
- m_text = ((VetoException) t).getStatus().getTitle();
- if (StringUtility.hasText(((VetoException) t).getStatus().getMessage())) {
- m_detail = ((VetoException) t).getStatus().getMessage();
- }
- else {
- m_detail = ScoutTexts.get("VetoErrorText") + msg;
- }
- return;
- }
- t = t.getCause();
- }
- // default proceed
- StringWriter buf = new StringWriter();
- t = exception;
- String indent = "";
- int index = 0;
- while (t != null) {
- String s = null;
- if (t instanceof ProcessingException) {
- s = ((ProcessingException) t).getStatus().getMessage();
- }
- else {
- s = t.getMessage();
- }
- buf.append(indent);
- if (s != null) {
- buf.append(s + (t.getClass() != ProcessingException.class ? " (" + t.getClass().getSimpleName() + ")" : ""));
- }
- else {
- buf.append(t.getClass().getSimpleName());
- }
- buf.append("\n");
- // next
- index++;
- indent += " ";
- t = t.getCause();
- }
- m_detail = StringUtility.wrapWord(ScoutTexts.get("OriginalErrorMessageIs", buf.toString()), 120);
- // copy-paste
- m_copyPasteText = createCopyPasteText(m_text, m_detail, m_cause);
- }
-
- private String createCopyPasteText(String text, String detail, Throwable cause) {
- StringWriter logText = new StringWriter();
- logText.append(m_title + "\n");
- logText.append("\n");
- if (text != null) {
- logText.append(text + "\n");
- logText.append("\n");
- }
- if (detail != null) {
- logText.append(detail + "\n");
- logText.append("\n");
- }
- if (cause != null) {
- cause.printStackTrace(new PrintWriter(logText, true));
- logText.append("\n");
- }
- return logText.toString();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.exceptionhandler;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.lang.reflect.UndeclaredThrowableException;
+import java.net.MalformedURLException;
+import java.net.NoRouteToHostException;
+import java.net.SocketException;
+import java.net.UnknownHostException;
+import java.security.GeneralSecurityException;
+
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.exception.IProcessingStatus;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.exception.VetoException;
+import org.eclipse.scout.rt.client.ui.messagebox.MessageBox;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.servicetunnel.HttpException;
+import org.eclipse.scout.rt.shared.servicetunnel.VersionMismatchException;
+
+public class ErrorHandler {
+ private String m_title;
+ private String m_text;
+ private String m_detail;
+ private String m_acceptText;
+ private String m_copyPasteText;
+ private ProcessingException m_cause;
+
+ public ErrorHandler(Throwable t) {
+ parse(t);
+ }
+
+ public String getTitle() {
+ return m_title;
+ }
+
+ public String getText() {
+ return m_text;
+ }
+
+ public String getDetail() {
+ return m_detail;
+ }
+
+ public String getCopyPasteText() {
+ return m_copyPasteText;
+ }
+
+ public String getAcceptText() {
+ return m_acceptText;
+ }
+
+ public ProcessingException getCause() {
+ return m_cause;
+ }
+
+ public IProcessingStatus getStatus() {
+ return m_cause.getStatus();
+ }
+
+ public void showMessageBox() {
+ MessageBox mbox = new MessageBox(
+ m_title,
+ m_text,
+ m_detail,
+ m_acceptText,
+ null,
+ null,
+ m_copyPasteText,
+ null
+ );
+ mbox.setSeverity(m_cause.getStatus().getSeverity());
+ mbox.startMessageBox();
+ }
+
+ private void parse(Throwable exception) {
+ if (exception instanceof UndeclaredThrowableException) {
+ exception = ((UndeclaredThrowableException) exception).getCause();
+ }
+ //
+ if (exception instanceof ProcessingException) {
+ m_cause = (ProcessingException) exception;
+ }
+ else {
+ m_cause = new ProcessingException(ScoutTexts.get("Error"), ScoutTexts.get("ErrorAndRetryTextDefault"), exception);
+ }
+ m_text = m_cause.getStatus().getTitle();
+ if (m_text == null || m_text.length() == 0) {
+ m_text = ScoutTexts.get("Error");
+ }
+ m_detail = m_cause.getStatus().getMessage();
+ m_acceptText = ScoutTexts.get("Ok");
+ Throwable t = exception;
+ while (t != null) {
+ String msg = "\n\n" + StringUtility.wrapWord(ScoutTexts.get("OriginalErrorMessageIs", t.getClass().getSimpleName() + " " + t.getLocalizedMessage()), 80);
+ if (t instanceof HttpException) {
+ int statusCode = ((HttpException) t).getStatusCode();
+ switch (statusCode) {
+ case 401:
+ case 403: {
+ m_title = ScoutTexts.get("ErrorTitleLogin");
+ m_text = ScoutTexts.get("ErrorTextLogin") + msg;
+ break;
+ }
+ default: {
+ m_title = ScoutTexts.get("NetErrorTitle");
+ m_text = ScoutTexts.get("NetErrorText") + msg;
+ m_detail = ScoutTexts.get("NetErrorInfo");
+ }
+ }
+ return;
+ }
+ else if (t instanceof GeneralSecurityException) {
+ m_title = ScoutTexts.get("ErrorTitleLogin");
+ m_text = ScoutTexts.get("ErrorTextLogin") + msg;
+ return;
+ }
+ else if (t instanceof SecurityException) {
+ m_title = ScoutTexts.get("ErrorTitleSecurity");
+ m_text = ScoutTexts.get("ErrorTextSecurity") + msg;
+ return;
+ }
+ else if (t instanceof MalformedURLException) {
+ m_title = ScoutTexts.get("NetErrorTitle");
+ m_text = ScoutTexts.get("NetErrorText") + msg;
+ m_detail = ScoutTexts.get("NetErrorInfo");
+ return;
+ }
+ else if (t instanceof InterruptedException) {
+ m_title = ScoutTexts.get("InterruptedErrorTitle");
+ m_text = ScoutTexts.get("InterruptedErrorText");
+ return;
+ }
+ else if (t instanceof UnknownHostException) {
+ m_title = ScoutTexts.get("NetErrorTitle");
+ m_text = ScoutTexts.get("NetErrorText") + msg;
+ m_detail = ScoutTexts.get("NetErrorInfo");
+ return;
+ }
+ else if (t instanceof FileNotFoundException) {
+ m_title = ScoutTexts.get("FileNotFoundTitle");
+ m_text = ScoutTexts.get("FileNotFoundMessage", ((FileNotFoundException) t).getMessage());
+ return;
+ }
+ else if (t instanceof NoRouteToHostException) {
+ m_title = ScoutTexts.get("NetErrorTitle");
+ m_text = ScoutTexts.get("NetErrorText") + msg;
+ m_detail = ScoutTexts.get("NetErrorInfo");
+ return;
+ }
+ else if (t instanceof SocketException) {
+ m_title = ScoutTexts.get("NetErrorTitle");
+ m_text = ScoutTexts.get("NetErrorText") + msg;
+ m_detail = ScoutTexts.get("NetErrorInfo");
+ return;
+ }
+ else if (t instanceof UserInterruptedException) {
+ m_title = ScoutTexts.get("IOErrorTitle");
+ m_text = UserInterruptedException.class.getSimpleName();
+ m_detail = ScoutTexts.get("IOErrorInfo");
+ return;
+ }
+ else if (t instanceof IOException) {
+ m_title = ScoutTexts.get("IOErrorTitle");
+ m_text = ScoutTexts.get("IOErrorText") + ": " + t.getLocalizedMessage() + msg;
+ m_detail = ScoutTexts.get("IOErrorInfo");
+ return;
+ }
+ else if (t instanceof VersionMismatchException) {
+ VersionMismatchException ve = (VersionMismatchException) t;
+ m_title = ScoutTexts.get("VersionMismatchTitle");
+ m_text = ScoutTexts.get("VersionMismatchTextXY", ve.getOldVersion(), ve.getNewVersion());
+ m_detail = null;
+ return;
+ }
+ else if (t instanceof VetoException) {
+ m_text = ((VetoException) t).getStatus().getTitle();
+ if (StringUtility.hasText(((VetoException) t).getStatus().getMessage())) {
+ m_detail = ((VetoException) t).getStatus().getMessage();
+ }
+ else {
+ m_detail = ScoutTexts.get("VetoErrorText") + msg;
+ }
+ return;
+ }
+ t = t.getCause();
+ }
+ // default proceed
+ StringWriter buf = new StringWriter();
+ t = exception;
+ String indent = "";
+ int index = 0;
+ while (t != null) {
+ String s = null;
+ if (t instanceof ProcessingException) {
+ s = ((ProcessingException) t).getStatus().getMessage();
+ }
+ else {
+ s = t.getMessage();
+ }
+ buf.append(indent);
+ if (s != null) {
+ buf.append(s + (t.getClass() != ProcessingException.class ? " (" + t.getClass().getSimpleName() + ")" : ""));
+ }
+ else {
+ buf.append(t.getClass().getSimpleName());
+ }
+ buf.append("\n");
+ // next
+ index++;
+ indent += " ";
+ t = t.getCause();
+ }
+ m_detail = StringUtility.wrapWord(ScoutTexts.get("OriginalErrorMessageIs", buf.toString()), 120);
+ // copy-paste
+ m_copyPasteText = createCopyPasteText(m_text, m_detail, m_cause);
+ }
+
+ private String createCopyPasteText(String text, String detail, Throwable cause) {
+ StringWriter logText = new StringWriter();
+ logText.append(m_title + "\n");
+ logText.append("\n");
+ if (text != null) {
+ logText.append(text + "\n");
+ logText.append("\n");
+ }
+ if (detail != null) {
+ logText.append(detail + "\n");
+ logText.append("\n");
+ }
+ if (cause != null) {
+ cause.printStackTrace(new PrintWriter(logText, true));
+ logText.append("\n");
+ }
+ return logText.toString();
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/exceptionhandler/UserInterruptedException.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/exceptionhandler/UserInterruptedException.java
index 2b929d9351..abeab5f31a 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/exceptionhandler/UserInterruptedException.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/exceptionhandler/UserInterruptedException.java
@@ -1,23 +1,23 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.exceptionhandler;
-
-import java.io.IOException;
-
-public class UserInterruptedException extends IOException {
-
- private static final long serialVersionUID = 1L;
-
- public UserInterruptedException(String message) {
- super(message);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.exceptionhandler;
+
+import java.io.IOException;
+
+public class UserInterruptedException extends IOException {
+
+ private static final long serialVersionUID = 1L;
+
+ public UserInterruptedException(String message) {
+ super(message);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/exceptionhandler/internal/InternalClientExceptionHandlerService.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/exceptionhandler/internal/InternalClientExceptionHandlerService.java
index 8c149ead45..cfa5e7bcd1 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/exceptionhandler/internal/InternalClientExceptionHandlerService.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/exceptionhandler/internal/InternalClientExceptionHandlerService.java
@@ -1,135 +1,135 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.exceptionhandler.internal;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.scout.commons.OptimisticLock;
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.commons.exception.IProcessingStatus;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.exception.VetoException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ClientJob;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.client.services.common.exceptionhandler.ErrorHandler;
-import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
-import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
-import org.eclipse.scout.service.AbstractService;
-
-@Priority(-1)
-public class InternalClientExceptionHandlerService extends AbstractService implements IExceptionHandlerService {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(InternalClientExceptionHandlerService.class);
- private static final String SESSION_DATA_KEY = "clientExceptionHandlerServiceState";
-
- public InternalClientExceptionHandlerService() {
- }
-
- private ServiceState getServiceState() {
- IClientSession session = ClientJob.getCurrentSession();
- if (session == null) {
- throw new IllegalStateException("null client session in current job context");
- }
- ServiceState data = (ServiceState) session.getData(SESSION_DATA_KEY);
- if (data == null) {
- data = new ServiceState();
- session.setData(SESSION_DATA_KEY, data);
- }
- return data;
- }
-
- @Override
- public void handleException(ProcessingException pe) {
- if (pe.isInterruption()) {
- return;
- }
- ServiceState state = getServiceState();
- try {
- if (state.m_handlerLock.acquire()) {
- if (!pe.isConsumed()) {
- if (Platform.inDevelopmentMode() || !(pe instanceof VetoException)) {
- IProcessingStatus s = pe.getStatus();
- boolean logThrowable = !(pe instanceof VetoException);
- int logLevel = IScoutLogger.LEVEL_ERROR;
- String logText = pe.getClass().getSimpleName() + ": " + s.toString();
- switch (s.getSeverity()) {
- case IProcessingStatus.INFO: {
- logLevel = IScoutLogger.LEVEL_INFO;
- break;
- }
- case IProcessingStatus.WARNING: {
- logLevel = IScoutLogger.LEVEL_WARN;
- break;
- }
- case IProcessingStatus.ERROR: {
- logLevel = IScoutLogger.LEVEL_ERROR;
- break;
- }
- case IProcessingStatus.FATAL: {
- logLevel = IScoutLogger.LEVEL_ERROR;
- break;
- }
- }
- differentiatedLog(InternalClientExceptionHandlerService.class.getName(), logLevel, logText, logThrowable ? pe : null);
- }
- // check if the desktop is observing this process
- IDesktop desktop = ClientSyncJob.getCurrentSession().getDesktop();
- if (desktop != null && desktop.isOpened()) {
- showExceptionInUI(pe);
- }
- }
- }
- else {
- LOG.error("loop detection in " + getClass().getSimpleName() + " when handling: " + pe + ". StackTrace is following", new Exception());
- }
- }
- finally {
- state.m_handlerLock.release();
- pe.consume();
- }
- }
-
- void differentiatedLog(String fqcn, int level, String m, Throwable t) {
- switch (level) {
- case IScoutLogger.LEVEL_TRACE:
- LOG.trace(m, t);
- break;
- case IScoutLogger.LEVEL_DEBUG:
- LOG.debug(m, t);
- break;
- case IScoutLogger.LEVEL_INFO:
- LOG.info(m, t);
- break;
- case IScoutLogger.LEVEL_WARN:
- LOG.warn(m, t);
- break;
- case IScoutLogger.LEVEL_ERROR:
- LOG.error(m, t);
- break;
- }
- }
-
- /**
- * To visualize the exception in the UI
- *
- * @param pe
- * the exception to be visualized
- */
- protected void showExceptionInUI(ProcessingException pe) {
- new ErrorHandler(pe).showMessageBox();
- }
-
- private static class ServiceState {
- final OptimisticLock m_handlerLock = new OptimisticLock();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.exceptionhandler.internal;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.scout.commons.OptimisticLock;
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.commons.exception.IProcessingStatus;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.exception.VetoException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ClientJob;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.client.services.common.exceptionhandler.ErrorHandler;
+import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
+import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
+import org.eclipse.scout.service.AbstractService;
+
+@Priority(-1)
+public class InternalClientExceptionHandlerService extends AbstractService implements IExceptionHandlerService {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(InternalClientExceptionHandlerService.class);
+ private static final String SESSION_DATA_KEY = "clientExceptionHandlerServiceState";
+
+ public InternalClientExceptionHandlerService() {
+ }
+
+ private ServiceState getServiceState() {
+ IClientSession session = ClientJob.getCurrentSession();
+ if (session == null) {
+ throw new IllegalStateException("null client session in current job context");
+ }
+ ServiceState data = (ServiceState) session.getData(SESSION_DATA_KEY);
+ if (data == null) {
+ data = new ServiceState();
+ session.setData(SESSION_DATA_KEY, data);
+ }
+ return data;
+ }
+
+ @Override
+ public void handleException(ProcessingException pe) {
+ if (pe.isInterruption()) {
+ return;
+ }
+ ServiceState state = getServiceState();
+ try {
+ if (state.m_handlerLock.acquire()) {
+ if (!pe.isConsumed()) {
+ if (Platform.inDevelopmentMode() || !(pe instanceof VetoException)) {
+ IProcessingStatus s = pe.getStatus();
+ boolean logThrowable = !(pe instanceof VetoException);
+ int logLevel = IScoutLogger.LEVEL_ERROR;
+ String logText = pe.getClass().getSimpleName() + ": " + s.toString();
+ switch (s.getSeverity()) {
+ case IProcessingStatus.INFO: {
+ logLevel = IScoutLogger.LEVEL_INFO;
+ break;
+ }
+ case IProcessingStatus.WARNING: {
+ logLevel = IScoutLogger.LEVEL_WARN;
+ break;
+ }
+ case IProcessingStatus.ERROR: {
+ logLevel = IScoutLogger.LEVEL_ERROR;
+ break;
+ }
+ case IProcessingStatus.FATAL: {
+ logLevel = IScoutLogger.LEVEL_ERROR;
+ break;
+ }
+ }
+ differentiatedLog(InternalClientExceptionHandlerService.class.getName(), logLevel, logText, logThrowable ? pe : null);
+ }
+ // check if the desktop is observing this process
+ IDesktop desktop = ClientSyncJob.getCurrentSession().getDesktop();
+ if (desktop != null && desktop.isOpened()) {
+ showExceptionInUI(pe);
+ }
+ }
+ }
+ else {
+ LOG.error("loop detection in " + getClass().getSimpleName() + " when handling: " + pe + ". StackTrace is following", new Exception());
+ }
+ }
+ finally {
+ state.m_handlerLock.release();
+ pe.consume();
+ }
+ }
+
+ void differentiatedLog(String fqcn, int level, String m, Throwable t) {
+ switch (level) {
+ case IScoutLogger.LEVEL_TRACE:
+ LOG.trace(m, t);
+ break;
+ case IScoutLogger.LEVEL_DEBUG:
+ LOG.debug(m, t);
+ break;
+ case IScoutLogger.LEVEL_INFO:
+ LOG.info(m, t);
+ break;
+ case IScoutLogger.LEVEL_WARN:
+ LOG.warn(m, t);
+ break;
+ case IScoutLogger.LEVEL_ERROR:
+ LOG.error(m, t);
+ break;
+ }
+ }
+
+ /**
+ * To visualize the exception in the UI
+ *
+ * @param pe
+ * the exception to be visualized
+ */
+ protected void showExceptionInUI(ProcessingException pe) {
+ new ErrorHandler(pe).showMessageBox();
+ }
+
+ private static class ServiceState {
+ final OptimisticLock m_handlerLock = new OptimisticLock();
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/file/FileService.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/file/FileService.java
index cfe8416f13..17e6b58774 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/file/FileService.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/file/FileService.java
@@ -1,294 +1,294 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.file;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.FilenameFilter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.Locale;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.shared.OfflineState;
-import org.eclipse.scout.rt.shared.services.common.file.IRemoteFileService;
-import org.eclipse.scout.rt.shared.services.common.file.RemoteFile;
-import org.eclipse.scout.service.AbstractService;
-import org.eclipse.scout.service.SERVICES;
-import org.osgi.framework.Bundle;
-
-@Priority(-1)
-public class FileService extends AbstractService implements IFileService {
- private String m_rootPath = null;
-
- private Bundle getBundle() {
- return ClientSyncJob.getCurrentSession().getBundle();
- }
-
- @Override
- public File getLocalFile(String dir, String simpleName) throws ProcessingException {
- return getFileLocation(dir, simpleName, true);
- }
-
- @Override
- public File getRemoteFile(String dir, String simpleName) throws ProcessingException {
- return getRemoteFile(dir, simpleName, null);
- }
-
- @Override
- public File getRemoteFile(String dir, String simpleName, Locale locale) throws ProcessingException {
- return getRemoteFile(dir, simpleName, locale, true);
- }
-
- @Override
- public File getRemoteFile(String dir, String simpleName, Locale locale, boolean checkCache) throws ProcessingException {
- RemoteFile spec = null;
- File f = null;
- if (locale != null && simpleName != null && simpleName.lastIndexOf(".") != -1) {
- String filename = simpleName;
- String language = locale.toString().replaceAll("__", "_");
- String prefix = filename.substring(0, filename.lastIndexOf(".")) + "_";
- String suffix = filename.substring(filename.lastIndexOf("."));
- filename = prefix + language + suffix;
- File test = getFileLocation(dir, filename, false);
- while (!test.exists()) {
- if (language.indexOf("_") == -1) {
- filename = simpleName;
- break;
- }
- language = language.substring(0, language.lastIndexOf("_"));
- filename = prefix + language + suffix;
- test = getFileLocation(dir, filename, false);
- }
- f = getFileLocation(dir, filename, false);
- spec = new RemoteFile(dir, filename, locale, 0L);
- }
- else {
- f = getFileLocation(dir, simpleName, false);
- spec = new RemoteFile(dir, simpleName, locale, 0L);
- }
- if (f.exists()) {
- spec.setLastModified(f.lastModified());
- }
- //
- if (checkCache && OfflineState.isOnlineInCurrentThread()) {
- IRemoteFileService svc = SERVICES.getService(IRemoteFileService.class);
- spec = svc.getRemoteFile(spec);
- try {
- if (spec.getName() != null && !spec.getName().equalsIgnoreCase(f.getName())) {
- if (locale != null && f.getName().length() > spec.getName().length()) {
- // if local file has longer name (including locale), this means that
- // this file was deleted on the server
- f.delete();
- }
- f = getFileLocation(spec.getDirectory(), spec.getName(), false);
- }
- if (spec.exists() && spec.hasContent()) {
- spec.writeData(new FileOutputStream(f));
- f.setLastModified(spec.getLastModified());
- }
- else if (!spec.exists()) {
- f.delete();
- }
- }
- catch (IOException e) {
- throw new ProcessingException("error writing remote file in local store", e);
- }
- }
- return f;
- }
-
- private String[][] getFiles(String folderBase, FilenameFilter filter, boolean useServerFolderStructureOnClient) throws ProcessingException {
- File path = getFileLocation(useServerFolderStructureOnClient ? folderBase : "", null, false);
- ArrayList<String> dirList = new ArrayList<String>();
- ArrayList<String> fileList = new ArrayList<String>();
- String[] dir = path.list(filter);
- for (int i = 0; i < dir.length; i++) {
- try {
- File file = new File(path.getCanonicalPath() + "/" + dir[i]);
- if (file.exists() && file.isDirectory()) {
- String[][] tmp = getFiles((folderBase == null ? dir[i] : folderBase + "/" + dir[i]), filter, true);
- for (String[] f : tmp) {
- dirList.add(f[0]);
- fileList.add(f[1]);
- }
- }
- else {
- dirList.add(folderBase);
- fileList.add(dir[i]);
- }
- }
- catch (IOException e) {
- throw new ProcessingException("FileService.getFiles:", e);
- }
- }
- String[][] retVal = new String[dirList.size()][2];
- for (int i = 0; i < dirList.size(); i++) {
- retVal[i][0] = dirList.get(i);
- retVal[i][1] = fileList.get(i);
- }
- return retVal;
- }
-
- @Override
- public void syncRemoteFilesToPath(String clientFolderPath, String serverFolderPath, FilenameFilter filter) throws ProcessingException {
- setDirectPath(clientFolderPath);
- syncRemoteFilesInternal(serverFolderPath, filter, false);
- setDirectPath(null);
- }
-
- @Override
- public void syncRemoteFiles(String serverFolderPath, FilenameFilter filter) throws ProcessingException {
- syncRemoteFilesInternal(serverFolderPath, filter, true);
- }
-
- private void syncRemoteFilesInternal(String serverFolderPath, FilenameFilter filter, boolean useServerFolderStructureOnClient) throws ProcessingException {
- IRemoteFileService svc = SERVICES.getService(IRemoteFileService.class);
- String[][] realFiles = getFiles(serverFolderPath, filter, useServerFolderStructureOnClient);
- RemoteFile[] existingFileInfoOnClient = new RemoteFile[realFiles.length];
- for (int i = 0; i < realFiles.length; i++) {
- RemoteFile rf = new RemoteFile(realFiles[i][0], realFiles[i][1], 0);
- String dir = m_rootPath == null ? realFiles[i][0] : "";
- File f = getFileLocation(dir, realFiles[i][1], false);
- if (f.exists()) {
- rf.setLastModified(f.lastModified());
- }
- existingFileInfoOnClient[i] = rf;
- }
- existingFileInfoOnClient = svc.getRemoteFiles(serverFolderPath, filter, existingFileInfoOnClient);
- for (RemoteFile spec : existingFileInfoOnClient) {
- String fileDirectory = useServerFolderStructureOnClient ? spec.getDirectory() : null;
- File f = getFileLocation(fileDirectory, spec.getName(), false);
- if (spec.exists() && spec.hasContent()) {
- try {
- if (spec.hasMoreParts()) {
- // file is splitted - get all parts
- int counter = 0;
- long fileDate = spec.getLastModified();
- File part = getFileLocation(fileDirectory, spec.getName() + "." + counter, false);
- spec.writeData(new FileOutputStream(part));
- part.setLastModified(fileDate);
- RemoteFile specPart = spec;
- while (specPart.hasMoreParts()) {
- counter++;
- part = getFileLocation(fileDirectory, spec.getName() + "." + counter, false);
- if (!part.exists() || fileDate != part.lastModified()) {
- specPart = svc.getRemoteFilePart(spec, counter);
- specPart.writeData(new FileOutputStream(part));
- part.setLastModified(fileDate);
- }
- else {
- // resuming canceled part: nothing to do
- }
- }
- // put together
- counter = 0;
- f = getFileLocation(fileDirectory, spec.getName(), false);
- OutputStream out = new FileOutputStream(f);
- part = getFileLocation(fileDirectory, spec.getName() + "." + counter, false);
- while (part.exists()) {
- InputStream in = new FileInputStream(part);
- byte[] buf = new byte[102400];
- int len;
- while ((len = in.read(buf)) > 0) {
- out.write(buf, 0, len);
- }
- out.flush();
- in.close();
- part.delete();
- counter++;
- part = getFileLocation(fileDirectory, spec.getName() + "." + counter, false);
- }
- out.close();
- f.setLastModified(fileDate);
- }
- else {
- // normal files
- spec.writeData(new FileOutputStream(f));
- f.setLastModified(spec.getLastModified());
- }
- }
- catch (IOException e) {
- throw new ProcessingException("error writing remote file in local store", e);
- }
- }
- else if (!spec.exists()) {
- f.delete();
- }
- }
- }
-
- /**
- * @since 21.10.2009
- */
- @Override
- public File getLocalFileLocation(String dir, String name) throws ProcessingException {
- return getFileLocation(dir, name, true);
- }
-
- /**
- * @since 21.10.2009
- */
- @Override
- public File getRemoteFileLocation(String dir, String name) throws ProcessingException {
- return getFileLocation(dir, name, false);
- }
-
- private File getFileLocation(String dir, String name, boolean local) throws ProcessingException {
- try {
- String path = m_rootPath;
- if (path == null) {
- path = Platform.getStateLocation(getBundle()).toFile().getCanonicalPath();
- if (!path.endsWith("/")) {
- path = path + "/";
- }
- if (local) {
- path = path + "local";
- }
- else {
- path = path + "remote";
- }
- }
- if (dir != null) {
- dir = dir.replace("\\", "/");
- if (!dir.startsWith("/")) {
- path = path + "/";
- }
- path = path + dir;
- }
- if (!path.endsWith("/")) {
- path = path + "/";
- }
- File file = new File(path);
- if (!file.exists()) {
- file.mkdirs();
- }
- if (name != null) {
- file = new File(path + name);
- }
- return file;
- }
- catch (IOException e) {
- throw new ProcessingException("io error getting file", e);
- }
- }
-
- private void setDirectPath(String rootPath) {
- m_rootPath = rootPath;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.file;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.Locale;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.shared.OfflineState;
+import org.eclipse.scout.rt.shared.services.common.file.IRemoteFileService;
+import org.eclipse.scout.rt.shared.services.common.file.RemoteFile;
+import org.eclipse.scout.service.AbstractService;
+import org.eclipse.scout.service.SERVICES;
+import org.osgi.framework.Bundle;
+
+@Priority(-1)
+public class FileService extends AbstractService implements IFileService {
+ private String m_rootPath = null;
+
+ private Bundle getBundle() {
+ return ClientSyncJob.getCurrentSession().getBundle();
+ }
+
+ @Override
+ public File getLocalFile(String dir, String simpleName) throws ProcessingException {
+ return getFileLocation(dir, simpleName, true);
+ }
+
+ @Override
+ public File getRemoteFile(String dir, String simpleName) throws ProcessingException {
+ return getRemoteFile(dir, simpleName, null);
+ }
+
+ @Override
+ public File getRemoteFile(String dir, String simpleName, Locale locale) throws ProcessingException {
+ return getRemoteFile(dir, simpleName, locale, true);
+ }
+
+ @Override
+ public File getRemoteFile(String dir, String simpleName, Locale locale, boolean checkCache) throws ProcessingException {
+ RemoteFile spec = null;
+ File f = null;
+ if (locale != null && simpleName != null && simpleName.lastIndexOf(".") != -1) {
+ String filename = simpleName;
+ String language = locale.toString().replaceAll("__", "_");
+ String prefix = filename.substring(0, filename.lastIndexOf(".")) + "_";
+ String suffix = filename.substring(filename.lastIndexOf("."));
+ filename = prefix + language + suffix;
+ File test = getFileLocation(dir, filename, false);
+ while (!test.exists()) {
+ if (language.indexOf("_") == -1) {
+ filename = simpleName;
+ break;
+ }
+ language = language.substring(0, language.lastIndexOf("_"));
+ filename = prefix + language + suffix;
+ test = getFileLocation(dir, filename, false);
+ }
+ f = getFileLocation(dir, filename, false);
+ spec = new RemoteFile(dir, filename, locale, 0L);
+ }
+ else {
+ f = getFileLocation(dir, simpleName, false);
+ spec = new RemoteFile(dir, simpleName, locale, 0L);
+ }
+ if (f.exists()) {
+ spec.setLastModified(f.lastModified());
+ }
+ //
+ if (checkCache && OfflineState.isOnlineInCurrentThread()) {
+ IRemoteFileService svc = SERVICES.getService(IRemoteFileService.class);
+ spec = svc.getRemoteFile(spec);
+ try {
+ if (spec.getName() != null && !spec.getName().equalsIgnoreCase(f.getName())) {
+ if (locale != null && f.getName().length() > spec.getName().length()) {
+ // if local file has longer name (including locale), this means that
+ // this file was deleted on the server
+ f.delete();
+ }
+ f = getFileLocation(spec.getDirectory(), spec.getName(), false);
+ }
+ if (spec.exists() && spec.hasContent()) {
+ spec.writeData(new FileOutputStream(f));
+ f.setLastModified(spec.getLastModified());
+ }
+ else if (!spec.exists()) {
+ f.delete();
+ }
+ }
+ catch (IOException e) {
+ throw new ProcessingException("error writing remote file in local store", e);
+ }
+ }
+ return f;
+ }
+
+ private String[][] getFiles(String folderBase, FilenameFilter filter, boolean useServerFolderStructureOnClient) throws ProcessingException {
+ File path = getFileLocation(useServerFolderStructureOnClient ? folderBase : "", null, false);
+ ArrayList<String> dirList = new ArrayList<String>();
+ ArrayList<String> fileList = new ArrayList<String>();
+ String[] dir = path.list(filter);
+ for (int i = 0; i < dir.length; i++) {
+ try {
+ File file = new File(path.getCanonicalPath() + "/" + dir[i]);
+ if (file.exists() && file.isDirectory()) {
+ String[][] tmp = getFiles((folderBase == null ? dir[i] : folderBase + "/" + dir[i]), filter, true);
+ for (String[] f : tmp) {
+ dirList.add(f[0]);
+ fileList.add(f[1]);
+ }
+ }
+ else {
+ dirList.add(folderBase);
+ fileList.add(dir[i]);
+ }
+ }
+ catch (IOException e) {
+ throw new ProcessingException("FileService.getFiles:", e);
+ }
+ }
+ String[][] retVal = new String[dirList.size()][2];
+ for (int i = 0; i < dirList.size(); i++) {
+ retVal[i][0] = dirList.get(i);
+ retVal[i][1] = fileList.get(i);
+ }
+ return retVal;
+ }
+
+ @Override
+ public void syncRemoteFilesToPath(String clientFolderPath, String serverFolderPath, FilenameFilter filter) throws ProcessingException {
+ setDirectPath(clientFolderPath);
+ syncRemoteFilesInternal(serverFolderPath, filter, false);
+ setDirectPath(null);
+ }
+
+ @Override
+ public void syncRemoteFiles(String serverFolderPath, FilenameFilter filter) throws ProcessingException {
+ syncRemoteFilesInternal(serverFolderPath, filter, true);
+ }
+
+ private void syncRemoteFilesInternal(String serverFolderPath, FilenameFilter filter, boolean useServerFolderStructureOnClient) throws ProcessingException {
+ IRemoteFileService svc = SERVICES.getService(IRemoteFileService.class);
+ String[][] realFiles = getFiles(serverFolderPath, filter, useServerFolderStructureOnClient);
+ RemoteFile[] existingFileInfoOnClient = new RemoteFile[realFiles.length];
+ for (int i = 0; i < realFiles.length; i++) {
+ RemoteFile rf = new RemoteFile(realFiles[i][0], realFiles[i][1], 0);
+ String dir = m_rootPath == null ? realFiles[i][0] : "";
+ File f = getFileLocation(dir, realFiles[i][1], false);
+ if (f.exists()) {
+ rf.setLastModified(f.lastModified());
+ }
+ existingFileInfoOnClient[i] = rf;
+ }
+ existingFileInfoOnClient = svc.getRemoteFiles(serverFolderPath, filter, existingFileInfoOnClient);
+ for (RemoteFile spec : existingFileInfoOnClient) {
+ String fileDirectory = useServerFolderStructureOnClient ? spec.getDirectory() : null;
+ File f = getFileLocation(fileDirectory, spec.getName(), false);
+ if (spec.exists() && spec.hasContent()) {
+ try {
+ if (spec.hasMoreParts()) {
+ // file is splitted - get all parts
+ int counter = 0;
+ long fileDate = spec.getLastModified();
+ File part = getFileLocation(fileDirectory, spec.getName() + "." + counter, false);
+ spec.writeData(new FileOutputStream(part));
+ part.setLastModified(fileDate);
+ RemoteFile specPart = spec;
+ while (specPart.hasMoreParts()) {
+ counter++;
+ part = getFileLocation(fileDirectory, spec.getName() + "." + counter, false);
+ if (!part.exists() || fileDate != part.lastModified()) {
+ specPart = svc.getRemoteFilePart(spec, counter);
+ specPart.writeData(new FileOutputStream(part));
+ part.setLastModified(fileDate);
+ }
+ else {
+ // resuming canceled part: nothing to do
+ }
+ }
+ // put together
+ counter = 0;
+ f = getFileLocation(fileDirectory, spec.getName(), false);
+ OutputStream out = new FileOutputStream(f);
+ part = getFileLocation(fileDirectory, spec.getName() + "." + counter, false);
+ while (part.exists()) {
+ InputStream in = new FileInputStream(part);
+ byte[] buf = new byte[102400];
+ int len;
+ while ((len = in.read(buf)) > 0) {
+ out.write(buf, 0, len);
+ }
+ out.flush();
+ in.close();
+ part.delete();
+ counter++;
+ part = getFileLocation(fileDirectory, spec.getName() + "." + counter, false);
+ }
+ out.close();
+ f.setLastModified(fileDate);
+ }
+ else {
+ // normal files
+ spec.writeData(new FileOutputStream(f));
+ f.setLastModified(spec.getLastModified());
+ }
+ }
+ catch (IOException e) {
+ throw new ProcessingException("error writing remote file in local store", e);
+ }
+ }
+ else if (!spec.exists()) {
+ f.delete();
+ }
+ }
+ }
+
+ /**
+ * @since 21.10.2009
+ */
+ @Override
+ public File getLocalFileLocation(String dir, String name) throws ProcessingException {
+ return getFileLocation(dir, name, true);
+ }
+
+ /**
+ * @since 21.10.2009
+ */
+ @Override
+ public File getRemoteFileLocation(String dir, String name) throws ProcessingException {
+ return getFileLocation(dir, name, false);
+ }
+
+ private File getFileLocation(String dir, String name, boolean local) throws ProcessingException {
+ try {
+ String path = m_rootPath;
+ if (path == null) {
+ path = Platform.getStateLocation(getBundle()).toFile().getCanonicalPath();
+ if (!path.endsWith("/")) {
+ path = path + "/";
+ }
+ if (local) {
+ path = path + "local";
+ }
+ else {
+ path = path + "remote";
+ }
+ }
+ if (dir != null) {
+ dir = dir.replace("\\", "/");
+ if (!dir.startsWith("/")) {
+ path = path + "/";
+ }
+ path = path + dir;
+ }
+ if (!path.endsWith("/")) {
+ path = path + "/";
+ }
+ File file = new File(path);
+ if (!file.exists()) {
+ file.mkdirs();
+ }
+ if (name != null) {
+ file = new File(path + name);
+ }
+ return file;
+ }
+ catch (IOException e) {
+ throw new ProcessingException("io error getting file", e);
+ }
+ }
+
+ private void setDirectPath(String rootPath) {
+ m_rootPath = rootPath;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/file/IFileService.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/file/IFileService.java
index 7ad7c36625..0311e8653e 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/file/IFileService.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/file/IFileService.java
@@ -1,63 +1,63 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.file;
-
-import java.io.File;
-import java.io.FilenameFilter;
-import java.util.Locale;
-
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.service.IService;
-
-@Priority(-3)
-public interface IFileService extends IService {
-
- /**
- * never returns null. Use {@link File#exists()} to check
- */
- File getLocalFile(String dir, String simpleName) throws ProcessingException;
-
- /**
- * Sync remote files.<br>
- * After a call to this method it is safe to call {@link #getRemoteFile(String, String, false)}
- */
- void syncRemoteFiles(String folderPath, FilenameFilter filter) throws ProcessingException;
-
- /**
- * Sync remote files directly into a specified user path.
- */
- void syncRemoteFilesToPath(String rootPath, String folderPath, FilenameFilter filter) throws ProcessingException;
-
- File getRemoteFile(String dir, String simpleName) throws ProcessingException;
-
- File getRemoteFile(String dir, String simpleName, Locale locale) throws ProcessingException;
-
- /**
- * @param checkCache
- * default true<br>
- * If {@link #syncRemoteFiles(String, FilenameFilter)} has been
- * called checkCache may be passed as false.<br>
- * This is used when a large number of files is processed.
- */
- File getRemoteFile(String dir, String simpleName, Locale locale, boolean checkCache) throws ProcessingException;
-
- /**
- * @since 21.10.2009
- */
- File getLocalFileLocation(String dir, String name) throws ProcessingException;
-
- /**
- * @since 21.10.2009
- */
- File getRemoteFileLocation(String dir, String name) throws ProcessingException;
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.file;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.util.Locale;
+
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.service.IService;
+
+@Priority(-3)
+public interface IFileService extends IService {
+
+ /**
+ * never returns null. Use {@link File#exists()} to check
+ */
+ File getLocalFile(String dir, String simpleName) throws ProcessingException;
+
+ /**
+ * Sync remote files.<br>
+ * After a call to this method it is safe to call {@link #getRemoteFile(String, String, false)}
+ */
+ void syncRemoteFiles(String folderPath, FilenameFilter filter) throws ProcessingException;
+
+ /**
+ * Sync remote files directly into a specified user path.
+ */
+ void syncRemoteFilesToPath(String rootPath, String folderPath, FilenameFilter filter) throws ProcessingException;
+
+ File getRemoteFile(String dir, String simpleName) throws ProcessingException;
+
+ File getRemoteFile(String dir, String simpleName, Locale locale) throws ProcessingException;
+
+ /**
+ * @param checkCache
+ * default true<br>
+ * If {@link #syncRemoteFiles(String, FilenameFilter)} has been
+ * called checkCache may be passed as false.<br>
+ * This is used when a large number of files is processed.
+ */
+ File getRemoteFile(String dir, String simpleName, Locale locale, boolean checkCache) throws ProcessingException;
+
+ /**
+ * @since 21.10.2009
+ */
+ File getLocalFileLocation(String dir, String name) throws ProcessingException;
+
+ /**
+ * @since 21.10.2009
+ */
+ File getRemoteFileLocation(String dir, String name) throws ProcessingException;
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/icon/AbstractIconProviderService.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/icon/AbstractIconProviderService.java
index 85b6eaf21c..b8d36f7e6f 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/icon/AbstractIconProviderService.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/icon/AbstractIconProviderService.java
@@ -1,147 +1,147 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.icon;
-
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.StringTokenizer;
-
-import org.eclipse.scout.commons.IOUtility;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.service.AbstractService;
-import org.osgi.framework.Constants;
-import org.osgi.framework.ServiceRegistration;
-
-/**
- *
- */
-public abstract class AbstractIconProviderService extends AbstractService implements IIconProviderService {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractIconProviderService.class);
-
- private String m_folderName = "resources/icons";
- private String m_iconExtensions = "png,gif,jpg";
- private String[] m_iconExtensionsArray;
- private int m_ranking;
-
- @Override
- public void initializeService(ServiceRegistration registration) {
- super.initializeService(registration);
- Object rankingProp = registration.getReference().getProperty(Constants.SERVICE_RANKING);
- if (rankingProp instanceof Integer) {
- m_ranking = ((Integer) rankingProp).intValue();
- }
- }
-
- @Override
- public int getRanking() {
- return m_ranking;
- }
-
- protected synchronized String[] getIconExtensionsArray() {
- if (m_iconExtensionsArray == null) {
- ArrayList<String> fileExtensions = new ArrayList<String>();
- if (getIconExtensions() != null) {
- StringTokenizer tokenizer = new StringTokenizer(getIconExtensions(), ",;");
- while (tokenizer.hasMoreTokens()) {
- String t = tokenizer.nextToken().trim();
- if (t.length() > 0) {
- fileExtensions.add(t);
- }
- }
- }
- m_iconExtensionsArray = fileExtensions.toArray(new String[fileExtensions.size()]);
- }
- return m_iconExtensionsArray;
- }
-
- @Override
- public IconSpec getIconSpec(String iconName) {
- String name = iconName;
- if (StringUtility.isNullOrEmpty(name)) {
- return null;
- }
- name = name.replaceAll("\\A[\\/\\\\]*", "");
- if (!name.startsWith(getFolderName())) {
- name = getFolderName() + "/" + iconName;
- }
- String[] fqns = new String[getIconExtensionsArray().length + 1];
- String[] iconNames = new String[getIconExtensionsArray().length + 1];
- fqns[0] = name;
- iconNames[0] = iconName;
- for (int i = 1; i < fqns.length; i++) {
- fqns[i] = name + "." + getIconExtensionsArray()[i - 1];
- iconNames[i] = iconName + "." + getIconExtensionsArray()[i - 1];
- }
-
- IconSpec spec = null;
- spec = findIconSpec(fqns, iconNames);
- return spec;
-
- }
-
- protected IconSpec findIconSpec(String[] fqns, String[] iconNames) {
- if (fqns != null && fqns.length > 0) {
- for (int i = 0; i < fqns.length; i++) {
- String fqn = fqns[i];
- String iconName = "";
- if (iconNames != null && iconNames.length > i) {
- iconName = iconNames[i];
- }
- URL url = findResource(fqn);
- if (url != null) {
- try {
- IconSpec iconSpec = new IconSpec();
- byte[] content = IOUtility.getContent(url.openStream(), true);
- if (content != null) {
- iconSpec.setContent(content);
- }
- iconSpec.setName(iconName);
- return iconSpec;
- }
- catch (Exception e) {
- LOG.error("could not read input stream from url '" + url + "'.", e);
- }
- }
- }
- }
- return null;
- }
-
- protected abstract URL findResource(String fullPath);
-
- public void setFolderName(String folderName) {
- m_folderName = folderName;
- }
-
- public String getFolderName() {
- return m_folderName;
- }
-
- public void setIconExtensions(String iconExtensions) {
- m_iconExtensions = iconExtensions;
- m_iconExtensionsArray = null;
- }
-
- /**
- * @return a comma separated list of all extensions e.g. 'gif,png,jpg'
- */
- public String getIconExtensions() {
- return m_iconExtensions;
- }
-
- @Override
- public String toString() {
- return getHostBundle() + ": " + getClass().getName() + ", ranking=" + getRanking();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.icon;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.StringTokenizer;
+
+import org.eclipse.scout.commons.IOUtility;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.service.AbstractService;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceRegistration;
+
+/**
+ *
+ */
+public abstract class AbstractIconProviderService extends AbstractService implements IIconProviderService {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractIconProviderService.class);
+
+ private String m_folderName = "resources/icons";
+ private String m_iconExtensions = "png,gif,jpg";
+ private String[] m_iconExtensionsArray;
+ private int m_ranking;
+
+ @Override
+ public void initializeService(ServiceRegistration registration) {
+ super.initializeService(registration);
+ Object rankingProp = registration.getReference().getProperty(Constants.SERVICE_RANKING);
+ if (rankingProp instanceof Integer) {
+ m_ranking = ((Integer) rankingProp).intValue();
+ }
+ }
+
+ @Override
+ public int getRanking() {
+ return m_ranking;
+ }
+
+ protected synchronized String[] getIconExtensionsArray() {
+ if (m_iconExtensionsArray == null) {
+ ArrayList<String> fileExtensions = new ArrayList<String>();
+ if (getIconExtensions() != null) {
+ StringTokenizer tokenizer = new StringTokenizer(getIconExtensions(), ",;");
+ while (tokenizer.hasMoreTokens()) {
+ String t = tokenizer.nextToken().trim();
+ if (t.length() > 0) {
+ fileExtensions.add(t);
+ }
+ }
+ }
+ m_iconExtensionsArray = fileExtensions.toArray(new String[fileExtensions.size()]);
+ }
+ return m_iconExtensionsArray;
+ }
+
+ @Override
+ public IconSpec getIconSpec(String iconName) {
+ String name = iconName;
+ if (StringUtility.isNullOrEmpty(name)) {
+ return null;
+ }
+ name = name.replaceAll("\\A[\\/\\\\]*", "");
+ if (!name.startsWith(getFolderName())) {
+ name = getFolderName() + "/" + iconName;
+ }
+ String[] fqns = new String[getIconExtensionsArray().length + 1];
+ String[] iconNames = new String[getIconExtensionsArray().length + 1];
+ fqns[0] = name;
+ iconNames[0] = iconName;
+ for (int i = 1; i < fqns.length; i++) {
+ fqns[i] = name + "." + getIconExtensionsArray()[i - 1];
+ iconNames[i] = iconName + "." + getIconExtensionsArray()[i - 1];
+ }
+
+ IconSpec spec = null;
+ spec = findIconSpec(fqns, iconNames);
+ return spec;
+
+ }
+
+ protected IconSpec findIconSpec(String[] fqns, String[] iconNames) {
+ if (fqns != null && fqns.length > 0) {
+ for (int i = 0; i < fqns.length; i++) {
+ String fqn = fqns[i];
+ String iconName = "";
+ if (iconNames != null && iconNames.length > i) {
+ iconName = iconNames[i];
+ }
+ URL url = findResource(fqn);
+ if (url != null) {
+ try {
+ IconSpec iconSpec = new IconSpec();
+ byte[] content = IOUtility.getContent(url.openStream(), true);
+ if (content != null) {
+ iconSpec.setContent(content);
+ }
+ iconSpec.setName(iconName);
+ return iconSpec;
+ }
+ catch (Exception e) {
+ LOG.error("could not read input stream from url '" + url + "'.", e);
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ protected abstract URL findResource(String fullPath);
+
+ public void setFolderName(String folderName) {
+ m_folderName = folderName;
+ }
+
+ public String getFolderName() {
+ return m_folderName;
+ }
+
+ public void setIconExtensions(String iconExtensions) {
+ m_iconExtensions = iconExtensions;
+ m_iconExtensionsArray = null;
+ }
+
+ /**
+ * @return a comma separated list of all extensions e.g. 'gif,png,jpg'
+ */
+ public String getIconExtensions() {
+ return m_iconExtensions;
+ }
+
+ @Override
+ public String toString() {
+ return getHostBundle() + ": " + getClass().getName() + ", ranking=" + getRanking();
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/icon/IIconProviderService.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/icon/IIconProviderService.java
index 4574764750..6c781d491e 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/icon/IIconProviderService.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/icon/IIconProviderService.java
@@ -1,36 +1,36 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.icon;
-
-import org.eclipse.scout.service.IService2;
-import org.osgi.framework.Bundle;
-
-/**
- *
- */
-public interface IIconProviderService extends IService2 {
-
- /**
- * the icon lookup can be called with a full icon name (with extension) e.g. 'myIcon.gif' or with a simple icon name
- * e.g. 'myIcon'. In case of calling this method without an extension the list of extensions will be looped and added
- * to the simple icon name. The first found icon is returned.
- *
- * @return the icon specification to the icon or null if not found.
- */
- IconSpec getIconSpec(String iconName);
-
- Bundle getHostBundle();
-
- /**
- * @return
- */
- int getRanking();
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.icon;
+
+import org.eclipse.scout.service.IService2;
+import org.osgi.framework.Bundle;
+
+/**
+ *
+ */
+public interface IIconProviderService extends IService2 {
+
+ /**
+ * the icon lookup can be called with a full icon name (with extension) e.g. 'myIcon.gif' or with a simple icon name
+ * e.g. 'myIcon'. In case of calling this method without an extension the list of extensions will be looped and added
+ * to the simple icon name. The first found icon is returned.
+ *
+ * @return the icon specification to the icon or null if not found.
+ */
+ IconSpec getIconSpec(String iconName);
+
+ Bundle getHostBundle();
+
+ /**
+ * @return
+ */
+ int getRanking();
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/icon/IconProviderService.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/icon/IconProviderService.java
index cec92b9121..d47e2539cc 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/icon/IconProviderService.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/icon/IconProviderService.java
@@ -1,68 +1,68 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.icon;
-
-import java.net.URL;
-
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.ServiceRegistration;
-
-/**
- * icon locator looking up bundle resources in a folder
- */
-public class IconProviderService extends AbstractIconProviderService implements IIconProviderService {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(IconProviderService.class);
-
- private Bundle m_hostBundle;
-
- @Override
- public void initializeService(ServiceRegistration registration) {
- super.initializeService(registration);
- setHostBundle(registration.getReference().getBundle());
- }
-
- @Override
- public Bundle getHostBundle() {
- return m_hostBundle;
- }
-
- public void setHostBundle(Bundle bundle) {
- URL[] iconEntries = FileLocator.findEntries(bundle, new Path(getFolderName()));
- if (iconEntries != null && iconEntries.length > 0) {
- m_hostBundle = bundle;
- }
- }
-
- @Override
- public IconSpec getIconSpec(String iconName) {
- if (m_hostBundle == null) {
- return null;
- }
- return super.getIconSpec(iconName);
- }
-
- @Override
- protected URL findResource(String fullPath) {
- URL[] entries = FileLocator.findEntries(m_hostBundle, new Path(fullPath));
- if (entries != null && entries.length > 0) {
- URL url = entries[entries.length - 1];
- if (LOG.isDebugEnabled()) {
- LOG.debug("find image " + fullPath + " in bundle " + m_hostBundle.getSymbolicName() + "->" + url);
- }
- return url;
- }
- return null;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.icon;
+
+import java.net.URL;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.ServiceRegistration;
+
+/**
+ * icon locator looking up bundle resources in a folder
+ */
+public class IconProviderService extends AbstractIconProviderService implements IIconProviderService {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(IconProviderService.class);
+
+ private Bundle m_hostBundle;
+
+ @Override
+ public void initializeService(ServiceRegistration registration) {
+ super.initializeService(registration);
+ setHostBundle(registration.getReference().getBundle());
+ }
+
+ @Override
+ public Bundle getHostBundle() {
+ return m_hostBundle;
+ }
+
+ public void setHostBundle(Bundle bundle) {
+ URL[] iconEntries = FileLocator.findEntries(bundle, new Path(getFolderName()));
+ if (iconEntries != null && iconEntries.length > 0) {
+ m_hostBundle = bundle;
+ }
+ }
+
+ @Override
+ public IconSpec getIconSpec(String iconName) {
+ if (m_hostBundle == null) {
+ return null;
+ }
+ return super.getIconSpec(iconName);
+ }
+
+ @Override
+ protected URL findResource(String fullPath) {
+ URL[] entries = FileLocator.findEntries(m_hostBundle, new Path(fullPath));
+ if (entries != null && entries.length > 0) {
+ URL url = entries[entries.length - 1];
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("find image " + fullPath + " in bundle " + m_hostBundle.getSymbolicName() + "->" + url);
+ }
+ return url;
+ }
+ return null;
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/icon/IconSpec.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/icon/IconSpec.java
index d8e82a872d..b5f5f40dfd 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/icon/IconSpec.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/icon/IconSpec.java
@@ -1,49 +1,49 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.icon;
-
-/**
- *
- */
-public class IconSpec {
- private String m_name;
- private byte[] m_content;
-
- public IconSpec() {
- this(null, null);
- }
-
- public IconSpec(byte[] content) {
- this(null, content);
- }
-
- public IconSpec(String name, byte[] content) {
- m_name = name;
- m_content = content;
- }
-
- public String getName() {
- return m_name;
- }
-
- public void setName(String name) {
- m_name = name;
- }
-
- public byte[] getContent() {
- return m_content;
- }
-
- public void setContent(byte[] content) {
- m_content = content;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.icon;
+
+/**
+ *
+ */
+public class IconSpec {
+ private String m_name;
+ private byte[] m_content;
+
+ public IconSpec() {
+ this(null, null);
+ }
+
+ public IconSpec(byte[] content) {
+ this(null, content);
+ }
+
+ public IconSpec(String name, byte[] content) {
+ m_name = name;
+ m_content = content;
+ }
+
+ public String getName() {
+ return m_name;
+ }
+
+ public void setName(String name) {
+ m_name = name;
+ }
+
+ public byte[] getContent() {
+ return m_content;
+ }
+
+ public void setContent(byte[] content) {
+ m_content = content;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/perf/IPerformanceAnalyzerService.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/perf/IPerformanceAnalyzerService.java
index 94205af1e3..3d9d50ba0d 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/perf/IPerformanceAnalyzerService.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/perf/IPerformanceAnalyzerService.java
@@ -1,29 +1,29 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.perf;
-
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.commons.beans.IPropertyObserver;
-import org.eclipse.scout.service.IService;
-
-@Priority(-3)
-public interface IPerformanceAnalyzerService extends IService, IPropertyObserver {
- String PROP_NETWORK_LATENCY = "networkLatency";
- String PROP_SERVER_EXECUTION_TIME = "serverExecutionTime";
-
- void addNetworkLatencySample(long millis);
-
- long getNetworkLatency();
-
- void addServerExecutionTimeSample(long millis);
-
- long getServerExecutionTime();
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.perf;
+
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.commons.beans.IPropertyObserver;
+import org.eclipse.scout.service.IService;
+
+@Priority(-3)
+public interface IPerformanceAnalyzerService extends IService, IPropertyObserver {
+ String PROP_NETWORK_LATENCY = "networkLatency";
+ String PROP_SERVER_EXECUTION_TIME = "serverExecutionTime";
+
+ void addNetworkLatencySample(long millis);
+
+ long getNetworkLatency();
+
+ void addServerExecutionTimeSample(long millis);
+
+ long getServerExecutionTime();
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/perf/internal/PerformanceAnalyzerService.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/perf/internal/PerformanceAnalyzerService.java
index f20d3220bc..2a7460be2f 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/perf/internal/PerformanceAnalyzerService.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/perf/internal/PerformanceAnalyzerService.java
@@ -1,91 +1,91 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.perf.internal;
-
-import java.beans.PropertyChangeListener;
-
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.commons.beans.BasicPropertySupport;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.services.common.perf.IPerformanceAnalyzerService;
-import org.eclipse.scout.service.AbstractService;
-
-@Priority(-1)
-public class PerformanceAnalyzerService extends AbstractService implements IPerformanceAnalyzerService {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(PerformanceAnalyzerService.class);
-
- private final PerformanceSampleSet m_networkLatency;
- private final PerformanceSampleSet m_serverExecutionTime;
- private final BasicPropertySupport m_propertySupport;
-
- public PerformanceAnalyzerService() {
- m_propertySupport = new BasicPropertySupport(this);
- m_networkLatency = new PerformanceSampleSet(10, 70);
- m_serverExecutionTime = new PerformanceSampleSet(10, 100);
- }
-
- @Override
- public void addNetworkLatencySample(long millis) {
- long oldValue = m_networkLatency.getValue();
- m_networkLatency.addSample(millis);
- long newValue = m_networkLatency.getValue();
- try {
- m_propertySupport.firePropertyChange(PROP_NETWORK_LATENCY, oldValue, newValue);
- }
- catch (Throwable t) {
- LOG.warn(null, t);
- }
- }
-
- @Override
- public long getNetworkLatency() {
- return m_networkLatency.getValue();
- }
-
- @Override
- public void addServerExecutionTimeSample(long millis) {
- long oldValue = m_serverExecutionTime.getValue();
- m_serverExecutionTime.addSample(millis);
- long newValue = m_serverExecutionTime.getValue();
- try {
- m_propertySupport.firePropertyChange(PROP_SERVER_EXECUTION_TIME, oldValue, newValue);
- }
- catch (Throwable t) {
- LOG.warn(null, t);
- }
- }
-
- @Override
- public long getServerExecutionTime() {
- return m_serverExecutionTime.getValue();
- }
-
- @Override
- public void addPropertyChangeListener(PropertyChangeListener listener) {
- m_propertySupport.addPropertyChangeListener(listener);
- }
-
- @Override
- public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
- m_propertySupport.addPropertyChangeListener(propertyName, listener);
- }
-
- @Override
- public void removePropertyChangeListener(PropertyChangeListener listener) {
- m_propertySupport.removePropertyChangeListener(listener);
- }
-
- @Override
- public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) {
- m_propertySupport.removePropertyChangeListener(propertyName, listener);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.perf.internal;
+
+import java.beans.PropertyChangeListener;
+
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.commons.beans.BasicPropertySupport;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.services.common.perf.IPerformanceAnalyzerService;
+import org.eclipse.scout.service.AbstractService;
+
+@Priority(-1)
+public class PerformanceAnalyzerService extends AbstractService implements IPerformanceAnalyzerService {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(PerformanceAnalyzerService.class);
+
+ private final PerformanceSampleSet m_networkLatency;
+ private final PerformanceSampleSet m_serverExecutionTime;
+ private final BasicPropertySupport m_propertySupport;
+
+ public PerformanceAnalyzerService() {
+ m_propertySupport = new BasicPropertySupport(this);
+ m_networkLatency = new PerformanceSampleSet(10, 70);
+ m_serverExecutionTime = new PerformanceSampleSet(10, 100);
+ }
+
+ @Override
+ public void addNetworkLatencySample(long millis) {
+ long oldValue = m_networkLatency.getValue();
+ m_networkLatency.addSample(millis);
+ long newValue = m_networkLatency.getValue();
+ try {
+ m_propertySupport.firePropertyChange(PROP_NETWORK_LATENCY, oldValue, newValue);
+ }
+ catch (Throwable t) {
+ LOG.warn(null, t);
+ }
+ }
+
+ @Override
+ public long getNetworkLatency() {
+ return m_networkLatency.getValue();
+ }
+
+ @Override
+ public void addServerExecutionTimeSample(long millis) {
+ long oldValue = m_serverExecutionTime.getValue();
+ m_serverExecutionTime.addSample(millis);
+ long newValue = m_serverExecutionTime.getValue();
+ try {
+ m_propertySupport.firePropertyChange(PROP_SERVER_EXECUTION_TIME, oldValue, newValue);
+ }
+ catch (Throwable t) {
+ LOG.warn(null, t);
+ }
+ }
+
+ @Override
+ public long getServerExecutionTime() {
+ return m_serverExecutionTime.getValue();
+ }
+
+ @Override
+ public void addPropertyChangeListener(PropertyChangeListener listener) {
+ m_propertySupport.addPropertyChangeListener(listener);
+ }
+
+ @Override
+ public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
+ m_propertySupport.addPropertyChangeListener(propertyName, listener);
+ }
+
+ @Override
+ public void removePropertyChangeListener(PropertyChangeListener listener) {
+ m_propertySupport.removePropertyChangeListener(listener);
+ }
+
+ @Override
+ public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) {
+ m_propertySupport.removePropertyChangeListener(propertyName, listener);
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/perf/internal/PerformanceSampleSet.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/perf/internal/PerformanceSampleSet.java
index 00a5f748db..42829e0c82 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/perf/internal/PerformanceSampleSet.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/perf/internal/PerformanceSampleSet.java
@@ -1,59 +1,59 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.perf.internal;
-
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-
-public class PerformanceSampleSet {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(PerformanceSampleSet.class);
-
- private Object m_samplesLock = new Object();
- private long[] m_samples;
- private int m_samplesLastIndex;
- private long m_samplesSum;
-
- public PerformanceSampleSet(int size, long initialValue) {
- m_samplesSum = 0;
- m_samples = new long[size];
- for (int i = 0; i < m_samples.length; i++) {
- m_samples[i] = initialValue;
- m_samplesSum += m_samples[i];
- }
- m_samplesLastIndex = m_samples.length - 1;
- }
-
- public void addSample(long millis) {
- if (millis < 0) {
- millis = 0;
- }
- synchronized (m_samplesLock) {
- long l = m_samplesSum;
- int i = (m_samplesLastIndex + 1) % m_samples.length;
- // remove last
- l -= m_samples[i];
- // add new
- m_samples[i] = millis;
- l += m_samples[i];
- // next
- m_samplesLastIndex = i;
- m_samplesSum = l;
- }
- }
-
- /**
- * @return the value in ms measured over the last n samples
- */
- public long getValue() {
- return m_samplesSum / m_samples.length;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.perf.internal;
+
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+
+public class PerformanceSampleSet {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(PerformanceSampleSet.class);
+
+ private Object m_samplesLock = new Object();
+ private long[] m_samples;
+ private int m_samplesLastIndex;
+ private long m_samplesSum;
+
+ public PerformanceSampleSet(int size, long initialValue) {
+ m_samplesSum = 0;
+ m_samples = new long[size];
+ for (int i = 0; i < m_samples.length; i++) {
+ m_samples[i] = initialValue;
+ m_samplesSum += m_samples[i];
+ }
+ m_samplesLastIndex = m_samples.length - 1;
+ }
+
+ public void addSample(long millis) {
+ if (millis < 0) {
+ millis = 0;
+ }
+ synchronized (m_samplesLock) {
+ long l = m_samplesSum;
+ int i = (m_samplesLastIndex + 1) % m_samples.length;
+ // remove last
+ l -= m_samples[i];
+ // add new
+ m_samples[i] = millis;
+ l += m_samples[i];
+ // next
+ m_samplesLastIndex = i;
+ m_samplesSum = l;
+ }
+ }
+
+ /**
+ * @return the value in ms measured over the last n samples
+ */
+ public long getValue() {
+ return m_samplesSum / m_samples.length;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/platform/IPlatformService.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/platform/IPlatformService.java
index fb4db554d1..099e75325e 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/platform/IPlatformService.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/platform/IPlatformService.java
@@ -1,30 +1,30 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.platform;
-
-import org.eclipse.scout.service.IService;
-
-public interface IPlatformService extends IService {
- /**
- * @return true if new value is different than old value
- */
- boolean setProperty(String key, String value);
-
- String getProperty(String key, String def);
-
- String getFile();
-
- String getFile(String ext, boolean open);
-
- String getFile(String ext, boolean open, String curPath);
-
- String getFile(String ext, boolean openMode, String curPath, boolean folderMode);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.platform;
+
+import org.eclipse.scout.service.IService;
+
+public interface IPlatformService extends IService {
+ /**
+ * @return true if new value is different than old value
+ */
+ boolean setProperty(String key, String value);
+
+ String getProperty(String key, String def);
+
+ String getFile();
+
+ String getFile(String ext, boolean open);
+
+ String getFile(String ext, boolean open, String curPath);
+
+ String getFile(String ext, boolean openMode, String curPath, boolean folderMode);
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/platform/PlatformService.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/platform/PlatformService.java
index 018c0fc515..090d07ecaf 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/platform/PlatformService.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/platform/PlatformService.java
@@ -1,117 +1,117 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.platform;
-
-import java.io.File;
-import java.io.IOException;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.preferences.IEclipsePreferences;
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.commons.prefs.UserScope;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.client.ui.basic.filechooser.FileChooser;
-import org.eclipse.scout.service.AbstractService;
-import org.osgi.service.prefs.BackingStoreException;
-
-@Priority(-1)
-public class PlatformService extends AbstractService implements IPlatformService {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(PlatformService.class);
-
- @Override
- public boolean setProperty(String key, String value) {
- IClientSession session = ClientSyncJob.getCurrentSession();
- String id = session.getBundle().getSymbolicName() + "-" + session.getUserId();
- IEclipsePreferences prefs = new UserScope().getNode(id);
- String oldValue = prefs.get(key, null);
- if (value == null) {
- prefs.remove(key);
- }
- else {
- prefs.put(key, value);
- try {
- prefs.flush();
- }
- catch (BackingStoreException e) {
- LOG.warn("storing property: " + key + "=" + value, e);
- }
- }
- return !CompareUtility.equals(oldValue, value);
- }
-
- @Override
- public String getProperty(String key, String def) {
- IClientSession session = ClientSyncJob.getCurrentSession();
- String id = session.getBundle().getSymbolicName() + "-" + session.getUserId();
- IEclipsePreferences prefs = new UserScope().getNode(id);
- return prefs.get(key, def);
- }
-
- @Override
- public String getFile() {
- return getFile(null, true);
- }
-
- @Override
- public String getFile(String ext, boolean open) {
- return getFile(ext, open, null);
- }
-
- @Override
- public String getFile(String ext, boolean open, String curPath) {
- return getFile(ext, open, curPath, false);
- }
-
- @Override
- public String getFile(String ext, boolean open, String curPath, boolean folderMode) {
- if (curPath == null) {
- curPath = FileChooser.getCurrentDirectory();
- if (curPath == null) {
- try {
- IClientSession session = ClientSyncJob.getCurrentSession();
- curPath = Platform.getStateLocation(session.getBundle()).toFile().getCanonicalPath();
- }
- catch (IOException io) {
- // throw new
- // ProcessingException("PlatformService.getFile(): unable to get current-dir",
- // io);
- curPath = null;
- }
- }
- }
- File f = null;
- File[] a = new FileChooser(new File(curPath), new String[]{ext}, open).startChooser();
- if (a != null && a.length > 0) {
- f = a[0];
- }
- //
- if (f == null) {
- /* nop */
- }
- else if (f.isDirectory() != folderMode) {
- f = null;
- }
- else if (f.getAbsolutePath().indexOf("*") >= 0) {
- f = null;
- }
- //
- if (f != null) {
- FileChooser.setCurrentDirectory(f.getParent());
- return f.getAbsolutePath();
- }
- return null;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.platform;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.commons.prefs.UserScope;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.client.ui.basic.filechooser.FileChooser;
+import org.eclipse.scout.service.AbstractService;
+import org.osgi.service.prefs.BackingStoreException;
+
+@Priority(-1)
+public class PlatformService extends AbstractService implements IPlatformService {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(PlatformService.class);
+
+ @Override
+ public boolean setProperty(String key, String value) {
+ IClientSession session = ClientSyncJob.getCurrentSession();
+ String id = session.getBundle().getSymbolicName() + "-" + session.getUserId();
+ IEclipsePreferences prefs = new UserScope().getNode(id);
+ String oldValue = prefs.get(key, null);
+ if (value == null) {
+ prefs.remove(key);
+ }
+ else {
+ prefs.put(key, value);
+ try {
+ prefs.flush();
+ }
+ catch (BackingStoreException e) {
+ LOG.warn("storing property: " + key + "=" + value, e);
+ }
+ }
+ return !CompareUtility.equals(oldValue, value);
+ }
+
+ @Override
+ public String getProperty(String key, String def) {
+ IClientSession session = ClientSyncJob.getCurrentSession();
+ String id = session.getBundle().getSymbolicName() + "-" + session.getUserId();
+ IEclipsePreferences prefs = new UserScope().getNode(id);
+ return prefs.get(key, def);
+ }
+
+ @Override
+ public String getFile() {
+ return getFile(null, true);
+ }
+
+ @Override
+ public String getFile(String ext, boolean open) {
+ return getFile(ext, open, null);
+ }
+
+ @Override
+ public String getFile(String ext, boolean open, String curPath) {
+ return getFile(ext, open, curPath, false);
+ }
+
+ @Override
+ public String getFile(String ext, boolean open, String curPath, boolean folderMode) {
+ if (curPath == null) {
+ curPath = FileChooser.getCurrentDirectory();
+ if (curPath == null) {
+ try {
+ IClientSession session = ClientSyncJob.getCurrentSession();
+ curPath = Platform.getStateLocation(session.getBundle()).toFile().getCanonicalPath();
+ }
+ catch (IOException io) {
+ // throw new
+ // ProcessingException("PlatformService.getFile(): unable to get current-dir",
+ // io);
+ curPath = null;
+ }
+ }
+ }
+ File f = null;
+ File[] a = new FileChooser(new File(curPath), new String[]{ext}, open).startChooser();
+ if (a != null && a.length > 0) {
+ f = a[0];
+ }
+ //
+ if (f == null) {
+ /* nop */
+ }
+ else if (f.isDirectory() != folderMode) {
+ f = null;
+ }
+ else if (f.getAbsolutePath().indexOf("*") >= 0) {
+ f = null;
+ }
+ //
+ if (f != null) {
+ FileChooser.setCurrentDirectory(f.getParent());
+ return f.getAbsolutePath();
+ }
+ return null;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/prefs/FileSystemUserPreferencesStorageService.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/prefs/FileSystemUserPreferencesStorageService.java
index 70b8b78e1d..459a6dee5a 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/prefs/FileSystemUserPreferencesStorageService.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/prefs/FileSystemUserPreferencesStorageService.java
@@ -1,34 +1,34 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.prefs;
-
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.commons.prefs.UserScope;
-import org.eclipse.scout.rt.client.Activator;
-import org.eclipse.scout.rt.shared.services.common.prefs.IUserPreferencesStorageService;
-import org.eclipse.scout.service.AbstractService;
-import org.osgi.service.prefs.Preferences;
-
-/**
- * Default implementation for storing UI preferences (Windows, Column widths, Table Customizers, ...) on local file
- * system in user area.
- */
-public class FileSystemUserPreferencesStorageService extends AbstractService implements IUserPreferencesStorageService {
-
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(FileSystemUserPreferencesStorageService.class);
-
- @Override
- public Preferences loadPreferences() {
- return new UserScope().getNode(Activator.PLUGIN_ID);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.prefs;
+
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.commons.prefs.UserScope;
+import org.eclipse.scout.rt.client.Activator;
+import org.eclipse.scout.rt.shared.services.common.prefs.IUserPreferencesStorageService;
+import org.eclipse.scout.service.AbstractService;
+import org.osgi.service.prefs.Preferences;
+
+/**
+ * Default implementation for storing UI preferences (Windows, Column widths, Table Customizers, ...) on local file
+ * system in user area.
+ */
+public class FileSystemUserPreferencesStorageService extends AbstractService implements IUserPreferencesStorageService {
+
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(FileSystemUserPreferencesStorageService.class);
+
+ @Override
+ public Preferences loadPreferences() {
+ return new UserScope().getNode(Activator.PLUGIN_ID);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/progress/ISimpleProgress.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/progress/ISimpleProgress.java
index 5c0f8070de..f698ca6956 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/progress/ISimpleProgress.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/progress/ISimpleProgress.java
@@ -1,23 +1,23 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.progress;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-
-public interface ISimpleProgress extends IProgressMonitor {
-
- void setProgress(String s);
-
- void setProgress(float f);
-
- void setProgress(float f, String s);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.progress;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+
+public interface ISimpleProgress extends IProgressMonitor {
+
+ void setProgress(String s);
+
+ void setProgress(float f);
+
+ void setProgress(float f, String s);
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/progress/ISimpleProgressService.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/progress/ISimpleProgressService.java
index 7f5110191e..d87b75a21a 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/progress/ISimpleProgressService.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/progress/ISimpleProgressService.java
@@ -1,35 +1,35 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.progress;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.service.IService;
-
-/**
- * Convenience for creating temporary progress monitors. This is accomplished by
- * creating a virtual Job that represents the progress monitor. The progress is
- * discarded be either calling {@link IProgressMonitor#done()} or {@link #removeProgress(ISimpleProgress)}
- */
-@Priority(-3)
-public interface ISimpleProgressService extends IService {
-
- /**
- * can be called from outside model thread
- */
- ISimpleProgress addProgress(String name);
-
- /**
- * can be called from outside model thread
- */
- void removeProgress(ISimpleProgress progress);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.progress;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.service.IService;
+
+/**
+ * Convenience for creating temporary progress monitors. This is accomplished by
+ * creating a virtual Job that represents the progress monitor. The progress is
+ * discarded be either calling {@link IProgressMonitor#done()} or {@link #removeProgress(ISimpleProgress)}
+ */
+@Priority(-3)
+public interface ISimpleProgressService extends IService {
+
+ /**
+ * can be called from outside model thread
+ */
+ ISimpleProgress addProgress(String name);
+
+ /**
+ * can be called from outside model thread
+ */
+ void removeProgress(ISimpleProgress progress);
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/progress/internal/SimpleProgress.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/progress/internal/SimpleProgress.java
index 0d75726f5d..b843b55989 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/progress/internal/SimpleProgress.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/progress/internal/SimpleProgress.java
@@ -1,86 +1,86 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.progress.internal;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.ProgressMonitorWrapper;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.scout.rt.client.services.common.progress.ISimpleProgress;
-
-public class SimpleProgress extends ProgressMonitorWrapper implements ISimpleProgress {
- private Job m_job;
- private String m_name;
- private int m_worked = -1;
-
- protected SimpleProgress(Job job, IProgressMonitor monitor) {
- super(monitor);
- m_job = job;
- }
-
- @Override
- public void beginTask(String name, int totalWork) {
- super.beginTask(name, totalWork);
- m_name = name;
- m_worked = 0;
- }
-
- @Override
- public void setTaskName(String name) {
- super.setTaskName(name);
- m_name = name;
- }
-
- @Override
- public void worked(int work) {
- super.worked(work);
- m_worked += work;
- }
-
- @Override
- public void setProgress(String s) {
- setTaskName(s);
- }
-
- @Override
- public void setProgress(float f) {
- if (m_worked < 0) {
- beginTask(m_name, 100);
- }
- int i = (int) (100 * f);
- if (i >= 0 && i < m_worked) {
- beginTask(m_name, 100);
- worked(i);
- }
- int delta = i - m_worked;
- if (delta > 0) {
- worked(delta);
- }
- }
-
- @Override
- public void setProgress(float f, String s) {
- setTaskName(s);
- //
- if (m_worked < 0) {
- beginTask(m_name, 100);
- }
- int i = (int) (100 * f);
- if (i >= 0 && i < m_worked) {
- beginTask(m_name, 100);
- worked(i);
- }
- int delta = i - m_worked;
- if (delta > 0) {
- worked(delta);
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.progress.internal;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.ProgressMonitorWrapper;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.scout.rt.client.services.common.progress.ISimpleProgress;
+
+public class SimpleProgress extends ProgressMonitorWrapper implements ISimpleProgress {
+ private Job m_job;
+ private String m_name;
+ private int m_worked = -1;
+
+ protected SimpleProgress(Job job, IProgressMonitor monitor) {
+ super(monitor);
+ m_job = job;
+ }
+
+ @Override
+ public void beginTask(String name, int totalWork) {
+ super.beginTask(name, totalWork);
+ m_name = name;
+ m_worked = 0;
+ }
+
+ @Override
+ public void setTaskName(String name) {
+ super.setTaskName(name);
+ m_name = name;
+ }
+
+ @Override
+ public void worked(int work) {
+ super.worked(work);
+ m_worked += work;
+ }
+
+ @Override
+ public void setProgress(String s) {
+ setTaskName(s);
+ }
+
+ @Override
+ public void setProgress(float f) {
+ if (m_worked < 0) {
+ beginTask(m_name, 100);
+ }
+ int i = (int) (100 * f);
+ if (i >= 0 && i < m_worked) {
+ beginTask(m_name, 100);
+ worked(i);
+ }
+ int delta = i - m_worked;
+ if (delta > 0) {
+ worked(delta);
+ }
+ }
+
+ @Override
+ public void setProgress(float f, String s) {
+ setTaskName(s);
+ //
+ if (m_worked < 0) {
+ beginTask(m_name, 100);
+ }
+ int i = (int) (100 * f);
+ if (i >= 0 && i < m_worked) {
+ beginTask(m_name, 100);
+ worked(i);
+ }
+ int delta = i - m_worked;
+ if (delta > 0) {
+ worked(delta);
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/progress/internal/SimpleProgressService.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/progress/internal/SimpleProgressService.java
index bf8c05b2f8..b3a9dd31d1 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/progress/internal/SimpleProgressService.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/progress/internal/SimpleProgressService.java
@@ -1,93 +1,93 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.progress.internal;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.commons.holders.Holder;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.services.common.progress.ISimpleProgress;
-import org.eclipse.scout.rt.client.services.common.progress.ISimpleProgressService;
-import org.eclipse.scout.service.AbstractService;
-
-/**
- * Thread-safe
- */
-@Priority(-1)
-public class SimpleProgressService extends AbstractService implements ISimpleProgressService {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(SimpleProgressService.class);
-
- public SimpleProgressService() {
- }
-
- @Override
- public ISimpleProgress addProgress(String name) {
- final Holder<SimpleProgress> monitorHolder = new Holder<SimpleProgress>(SimpleProgress.class);
- Job job = new Job(name) {
- private boolean m_done;
- private final Object m_doneLock = new Object();
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- synchronized (monitorHolder) {
- SimpleProgress p = new SimpleProgress(this, monitor) {
- @Override
- public void done() {
- super.done();
- synchronized (m_doneLock) {
- m_done = true;
- m_doneLock.notify();
- }
- }
- };
- monitorHolder.setValue(p);
- monitorHolder.notifyAll();
- }
- synchronized (m_doneLock) {
- while (!monitor.isCanceled() && !m_done) {
- try {
- m_doneLock.wait();
- }
- catch (InterruptedException e) {
- // nop
- }
- }
- }
- return Status.OK_STATUS;
- }
- };
- synchronized (monitorHolder) {
- job.schedule();
- try {
- monitorHolder.wait(10000L);
- if (monitorHolder.getValue() != null) {
- return monitorHolder.getValue();
- }
- }
- catch (InterruptedException e) {
- }
- return new SimpleProgress(job, new NullProgressMonitor());
- }
- }
-
- @Override
- public void removeProgress(ISimpleProgress monitor) {
- if (monitor != null) {
- monitor.done();
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.progress.internal;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.commons.holders.Holder;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.services.common.progress.ISimpleProgress;
+import org.eclipse.scout.rt.client.services.common.progress.ISimpleProgressService;
+import org.eclipse.scout.service.AbstractService;
+
+/**
+ * Thread-safe
+ */
+@Priority(-1)
+public class SimpleProgressService extends AbstractService implements ISimpleProgressService {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(SimpleProgressService.class);
+
+ public SimpleProgressService() {
+ }
+
+ @Override
+ public ISimpleProgress addProgress(String name) {
+ final Holder<SimpleProgress> monitorHolder = new Holder<SimpleProgress>(SimpleProgress.class);
+ Job job = new Job(name) {
+ private boolean m_done;
+ private final Object m_doneLock = new Object();
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ synchronized (monitorHolder) {
+ SimpleProgress p = new SimpleProgress(this, monitor) {
+ @Override
+ public void done() {
+ super.done();
+ synchronized (m_doneLock) {
+ m_done = true;
+ m_doneLock.notify();
+ }
+ }
+ };
+ monitorHolder.setValue(p);
+ monitorHolder.notifyAll();
+ }
+ synchronized (m_doneLock) {
+ while (!monitor.isCanceled() && !m_done) {
+ try {
+ m_doneLock.wait();
+ }
+ catch (InterruptedException e) {
+ // nop
+ }
+ }
+ }
+ return Status.OK_STATUS;
+ }
+ };
+ synchronized (monitorHolder) {
+ job.schedule();
+ try {
+ monitorHolder.wait(10000L);
+ if (monitorHolder.getValue() != null) {
+ return monitorHolder.getValue();
+ }
+ }
+ catch (InterruptedException e) {
+ }
+ return new SimpleProgress(job, new NullProgressMonitor());
+ }
+ }
+
+ @Override
+ public void removeProgress(ISimpleProgress monitor) {
+ if (monitor != null) {
+ monitor.done();
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/pwd/PasswordPolicyVerifier.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/pwd/PasswordPolicyVerifier.java
index d0b98b8329..8c67c367f3 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/pwd/PasswordPolicyVerifier.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/pwd/PasswordPolicyVerifier.java
@@ -1,111 +1,111 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.pwd;
-
-import java.util.Date;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
-import org.eclipse.scout.rt.client.ui.form.useradmin.DefaultPasswordForm;
-import org.eclipse.scout.rt.client.ui.messagebox.MessageBox;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
-import org.eclipse.scout.rt.shared.services.common.pwd.IPasswordManagementService;
-import org.eclipse.scout.service.SERVICES;
-
-/**
- * Runs the password verification process
- */
-public class PasswordPolicyVerifier {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(PasswordPolicyVerifier.class);
-
- /**
- * Calls {@link IPasswordManagementService#getPasswordExpirationDate(String)} to check whether the password has
- * expired. When desired, warns the user in
- * advance about the expiration. If expired, calls the {@link DefaultPasswordForm#startChange()} and - when closed -
- * re-checks the
- * expiry date. When still expired, exits the application (scout session).
- *
- * @param warnInAdvanceDays
- * number of days before the expiry when a warning shall occur, -1 to
- * omit this feature
- * @return true if the password is not expired, false if - after all - the
- * password has expired. Normally when returned false, the application
- * quits.
- */
- public boolean verify(String userId, int warnInAdvanceDays) {
- IPasswordManagementService service = SERVICES.getService(IPasswordManagementService.class);
- if (service == null) {
- LOG.error("missing client service proxy for " + IPasswordManagementService.class.getName() + "; check plugin extensions");
- return false;
- }
- IDesktop desktop = ClientSyncJob.getCurrentSession().getDesktop();
- if (desktop == null) {
- LOG.error("desktop is null");
- return false;
- }
- if (!desktop.isOpened()) {
- LOG.error("desktop is available, but there is not yet a GUI attached. Make sure to calll this verifier at earliest in the Desktop.execGuiAvailable callback");
- return false;
- }
- try {
- boolean changeNow = false;
- Date now = new Date();
- Date expiryDate = service.getPasswordExpirationDate(userId);
- if (expiryDate.after(now)) {
- // not expired
- long remainDays = (expiryDate.getTime() - now.getTime()) / 3600000L / 24L;
- if (remainDays < warnInAdvanceDays) {
- int answer = MessageBox.showYesNoCancelMessage(
- ScoutTexts.get("PasswordWillExpireTitle"),
- remainDays == 0 ?
- ScoutTexts.get("PasswordWillExpireHeaderX", ScoutTexts.get("Today")) :
- remainDays == 1 ?
- ScoutTexts.get("PasswordWillExpireHeaderX", ScoutTexts.get("Tomorrow")) :
- ScoutTexts.get("PasswordWillExpireHeaderX", ScoutTexts.get("InDaysX", "" + remainDays)),
- ScoutTexts.get("PasswordWillExpireInfo")
- );
- if (answer == MessageBox.YES_OPTION) {
- changeNow = true;
- }
- }
- }
- else {
- // has expired
- MessageBox.showOkMessage(ScoutTexts.get("PasswordHasExpiredTitle"), ScoutTexts.get("PasswordHasExpiredHeader"), null);
- changeNow = true;
- }
- //
- if (changeNow) {
- callPasswordForm(userId);
- // re-check
- expiryDate = service.getPasswordExpirationDate(userId);
- }
- return expiryDate.after(now);
- }
- catch (Throwable t) {
- ProcessingException pe = (t instanceof ProcessingException ? (ProcessingException) t : new ProcessingException("Unexpected", t));
- SERVICES.getService(IExceptionHandlerService.class).handleException(pe);
- return false;
- }
- }
-
- protected void callPasswordForm(String userId) throws ProcessingException {
- DefaultPasswordForm form = new DefaultPasswordForm();
- form.setUserId(userId);
- form.startChange();
- form.waitFor();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.pwd;
+
+import java.util.Date;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
+import org.eclipse.scout.rt.client.ui.form.useradmin.DefaultPasswordForm;
+import org.eclipse.scout.rt.client.ui.messagebox.MessageBox;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
+import org.eclipse.scout.rt.shared.services.common.pwd.IPasswordManagementService;
+import org.eclipse.scout.service.SERVICES;
+
+/**
+ * Runs the password verification process
+ */
+public class PasswordPolicyVerifier {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(PasswordPolicyVerifier.class);
+
+ /**
+ * Calls {@link IPasswordManagementService#getPasswordExpirationDate(String)} to check whether the password has
+ * expired. When desired, warns the user in
+ * advance about the expiration. If expired, calls the {@link DefaultPasswordForm#startChange()} and - when closed -
+ * re-checks the
+ * expiry date. When still expired, exits the application (scout session).
+ *
+ * @param warnInAdvanceDays
+ * number of days before the expiry when a warning shall occur, -1 to
+ * omit this feature
+ * @return true if the password is not expired, false if - after all - the
+ * password has expired. Normally when returned false, the application
+ * quits.
+ */
+ public boolean verify(String userId, int warnInAdvanceDays) {
+ IPasswordManagementService service = SERVICES.getService(IPasswordManagementService.class);
+ if (service == null) {
+ LOG.error("missing client service proxy for " + IPasswordManagementService.class.getName() + "; check plugin extensions");
+ return false;
+ }
+ IDesktop desktop = ClientSyncJob.getCurrentSession().getDesktop();
+ if (desktop == null) {
+ LOG.error("desktop is null");
+ return false;
+ }
+ if (!desktop.isOpened()) {
+ LOG.error("desktop is available, but there is not yet a GUI attached. Make sure to calll this verifier at earliest in the Desktop.execGuiAvailable callback");
+ return false;
+ }
+ try {
+ boolean changeNow = false;
+ Date now = new Date();
+ Date expiryDate = service.getPasswordExpirationDate(userId);
+ if (expiryDate.after(now)) {
+ // not expired
+ long remainDays = (expiryDate.getTime() - now.getTime()) / 3600000L / 24L;
+ if (remainDays < warnInAdvanceDays) {
+ int answer = MessageBox.showYesNoCancelMessage(
+ ScoutTexts.get("PasswordWillExpireTitle"),
+ remainDays == 0 ?
+ ScoutTexts.get("PasswordWillExpireHeaderX", ScoutTexts.get("Today")) :
+ remainDays == 1 ?
+ ScoutTexts.get("PasswordWillExpireHeaderX", ScoutTexts.get("Tomorrow")) :
+ ScoutTexts.get("PasswordWillExpireHeaderX", ScoutTexts.get("InDaysX", "" + remainDays)),
+ ScoutTexts.get("PasswordWillExpireInfo")
+ );
+ if (answer == MessageBox.YES_OPTION) {
+ changeNow = true;
+ }
+ }
+ }
+ else {
+ // has expired
+ MessageBox.showOkMessage(ScoutTexts.get("PasswordHasExpiredTitle"), ScoutTexts.get("PasswordHasExpiredHeader"), null);
+ changeNow = true;
+ }
+ //
+ if (changeNow) {
+ callPasswordForm(userId);
+ // re-check
+ expiryDate = service.getPasswordExpirationDate(userId);
+ }
+ return expiryDate.after(now);
+ }
+ catch (Throwable t) {
+ ProcessingException pe = (t instanceof ProcessingException ? (ProcessingException) t : new ProcessingException("Unexpected", t));
+ SERVICES.getService(IExceptionHandlerService.class).handleException(pe);
+ return false;
+ }
+ }
+
+ protected void callPasswordForm(String userId) throws ProcessingException {
+ DefaultPasswordForm form = new DefaultPasswordForm();
+ form.setUserId(userId);
+ form.startChange();
+ form.waitFor();
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/search/DefaultSearchFilterService.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/search/DefaultSearchFilterService.java
index a7af28b201..fce7d02dfa 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/search/DefaultSearchFilterService.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/search/DefaultSearchFilterService.java
@@ -1,126 +1,126 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.search;
-
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
-import org.eclipse.scout.rt.client.ui.form.fields.AbstractFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.AbstractValueField;
-import org.eclipse.scout.rt.client.ui.form.fields.ICompositeField;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.booleanfield.AbstractBooleanField;
-import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
-import org.eclipse.scout.rt.client.ui.form.fields.composer.AbstractComposerField;
-import org.eclipse.scout.rt.client.ui.form.fields.composer.internal.ComposerDisplayTextBuilder;
-import org.eclipse.scout.rt.client.ui.form.fields.htmlfield.AbstractHtmlField;
-import org.eclipse.scout.rt.client.ui.form.fields.labelfield.AbstractLabelField;
-import org.eclipse.scout.rt.client.ui.form.fields.listbox.AbstractListBox;
-import org.eclipse.scout.rt.client.ui.form.fields.radiobuttongroup.AbstractRadioButtonGroup;
-import org.eclipse.scout.rt.client.ui.form.fields.sequencebox.ISequenceBox;
-import org.eclipse.scout.rt.client.ui.form.fields.stringfield.AbstractStringField;
-import org.eclipse.scout.rt.client.ui.form.fields.treebox.AbstractTreeBox;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.services.common.jdbc.SearchFilter;
-import org.eclipse.scout.service.AbstractService;
-
-public class DefaultSearchFilterService extends AbstractService implements ISearchFilterService {
-
- @Override
- public SearchFilter createNewSearchFilter() {
- return new SearchFilter();
- }
-
- @Override
- public void applySearchDelegate(IFormField field, SearchFilter search, boolean includeChildren) {
- String label = field.getLabel();
- if (field.getParentField() instanceof ISequenceBox && field.getParentField() instanceof AbstractFormField) {
- AbstractFormField range = (AbstractFormField) field.getParentField();
- if (range.getInitialLabel() != null) {
- label = range.getInitialLabel() + " " + label;
- }
- }
- //
- //composer
- if (field instanceof AbstractComposerField) {
- AbstractComposerField composerField = (AbstractComposerField) field;
- ITreeNode rootNode = composerField.getTree().getRootNode();
- if (rootNode != null) {
- StringBuffer buf = new StringBuffer();
- new ComposerDisplayTextBuilder().build(rootNode, buf, "");
- String s = buf.toString();
- if (s.trim().length() > 0) {
- search.addDisplayText(s);
- }
- }
- return;
- }
- //list box
- if (field instanceof AbstractListBox<?>) {
- AbstractListBox<?> valueField = (AbstractListBox<?>) field;
- if (valueField.getValue() != null) {
- search.addDisplayText(label + " " + ScoutTexts.get("LogicIn") + " " + valueField.getDisplayText());
- }
- return;
- }
- //tree box
- if (field instanceof AbstractTreeBox<?>) {
- AbstractTreeBox<?> valueField = (AbstractTreeBox<?>) field;
- if (valueField.getValue() != null) {
- search.addDisplayText(label + " " + ScoutTexts.get("LogicIn") + " " + valueField.getDisplayText());
- }
- return;
- }
- //string, html, label field
- if (field instanceof AbstractStringField || field instanceof AbstractHtmlField || field instanceof AbstractLabelField) {
- AbstractValueField<?> valueField = (AbstractValueField<?>) field;
- if (valueField.getValue() != null) {
- search.addDisplayText(label + " " + ScoutTexts.get("LogicLike") + " " + valueField.getDisplayText());
- }
- return;
- }
- //boolean field
- if (field instanceof AbstractBooleanField) {
- AbstractBooleanField valueField = (AbstractBooleanField) field;
- if (valueField.getValue() != null && valueField.getValue()) {
- search.addDisplayText(label);
- }
- return;
- }
- //radiobuttongroup field
- if (field instanceof AbstractRadioButtonGroup<?>) {
- AbstractRadioButtonGroup<?> valueField = (AbstractRadioButtonGroup<?>) field;
- if (valueField.getValue() != null) {
- IButton selectedButton = valueField.getSelectedButton();
- search.addDisplayText(label + "=" + (selectedButton != null ? ("" + selectedButton.getLabel()).replace("&", "") : ""));
- }
- return;
- }
- //value field
- if (field instanceof AbstractValueField<?>) {
- AbstractValueField<?> valueField = (AbstractValueField<?>) field;
- if (valueField.getValue() != null) {
- search.addDisplayText(label + " " + ScoutTexts.get("LogicEQ") + " " + valueField.getDisplayText());
- }
- return;
- }
- if (includeChildren) {
- applySearchDelegateForChildren(field, search);
- }
- }
-
- protected void applySearchDelegateForChildren(IFormField field, SearchFilter search) {
- if (field instanceof ICompositeField) {
- for (IFormField f : ((ICompositeField) field).getFields()) {
- f.applySearch(search);
- }
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.search;
+
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
+import org.eclipse.scout.rt.client.ui.form.fields.AbstractFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.AbstractValueField;
+import org.eclipse.scout.rt.client.ui.form.fields.ICompositeField;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.booleanfield.AbstractBooleanField;
+import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
+import org.eclipse.scout.rt.client.ui.form.fields.composer.AbstractComposerField;
+import org.eclipse.scout.rt.client.ui.form.fields.composer.internal.ComposerDisplayTextBuilder;
+import org.eclipse.scout.rt.client.ui.form.fields.htmlfield.AbstractHtmlField;
+import org.eclipse.scout.rt.client.ui.form.fields.labelfield.AbstractLabelField;
+import org.eclipse.scout.rt.client.ui.form.fields.listbox.AbstractListBox;
+import org.eclipse.scout.rt.client.ui.form.fields.radiobuttongroup.AbstractRadioButtonGroup;
+import org.eclipse.scout.rt.client.ui.form.fields.sequencebox.ISequenceBox;
+import org.eclipse.scout.rt.client.ui.form.fields.stringfield.AbstractStringField;
+import org.eclipse.scout.rt.client.ui.form.fields.treebox.AbstractTreeBox;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.services.common.jdbc.SearchFilter;
+import org.eclipse.scout.service.AbstractService;
+
+public class DefaultSearchFilterService extends AbstractService implements ISearchFilterService {
+
+ @Override
+ public SearchFilter createNewSearchFilter() {
+ return new SearchFilter();
+ }
+
+ @Override
+ public void applySearchDelegate(IFormField field, SearchFilter search, boolean includeChildren) {
+ String label = field.getLabel();
+ if (field.getParentField() instanceof ISequenceBox && field.getParentField() instanceof AbstractFormField) {
+ AbstractFormField range = (AbstractFormField) field.getParentField();
+ if (range.getInitialLabel() != null) {
+ label = range.getInitialLabel() + " " + label;
+ }
+ }
+ //
+ //composer
+ if (field instanceof AbstractComposerField) {
+ AbstractComposerField composerField = (AbstractComposerField) field;
+ ITreeNode rootNode = composerField.getTree().getRootNode();
+ if (rootNode != null) {
+ StringBuffer buf = new StringBuffer();
+ new ComposerDisplayTextBuilder().build(rootNode, buf, "");
+ String s = buf.toString();
+ if (s.trim().length() > 0) {
+ search.addDisplayText(s);
+ }
+ }
+ return;
+ }
+ //list box
+ if (field instanceof AbstractListBox<?>) {
+ AbstractListBox<?> valueField = (AbstractListBox<?>) field;
+ if (valueField.getValue() != null) {
+ search.addDisplayText(label + " " + ScoutTexts.get("LogicIn") + " " + valueField.getDisplayText());
+ }
+ return;
+ }
+ //tree box
+ if (field instanceof AbstractTreeBox<?>) {
+ AbstractTreeBox<?> valueField = (AbstractTreeBox<?>) field;
+ if (valueField.getValue() != null) {
+ search.addDisplayText(label + " " + ScoutTexts.get("LogicIn") + " " + valueField.getDisplayText());
+ }
+ return;
+ }
+ //string, html, label field
+ if (field instanceof AbstractStringField || field instanceof AbstractHtmlField || field instanceof AbstractLabelField) {
+ AbstractValueField<?> valueField = (AbstractValueField<?>) field;
+ if (valueField.getValue() != null) {
+ search.addDisplayText(label + " " + ScoutTexts.get("LogicLike") + " " + valueField.getDisplayText());
+ }
+ return;
+ }
+ //boolean field
+ if (field instanceof AbstractBooleanField) {
+ AbstractBooleanField valueField = (AbstractBooleanField) field;
+ if (valueField.getValue() != null && valueField.getValue()) {
+ search.addDisplayText(label);
+ }
+ return;
+ }
+ //radiobuttongroup field
+ if (field instanceof AbstractRadioButtonGroup<?>) {
+ AbstractRadioButtonGroup<?> valueField = (AbstractRadioButtonGroup<?>) field;
+ if (valueField.getValue() != null) {
+ IButton selectedButton = valueField.getSelectedButton();
+ search.addDisplayText(label + "=" + (selectedButton != null ? ("" + selectedButton.getLabel()).replace("&", "") : ""));
+ }
+ return;
+ }
+ //value field
+ if (field instanceof AbstractValueField<?>) {
+ AbstractValueField<?> valueField = (AbstractValueField<?>) field;
+ if (valueField.getValue() != null) {
+ search.addDisplayText(label + " " + ScoutTexts.get("LogicEQ") + " " + valueField.getDisplayText());
+ }
+ return;
+ }
+ if (includeChildren) {
+ applySearchDelegateForChildren(field, search);
+ }
+ }
+
+ protected void applySearchDelegateForChildren(IFormField field, SearchFilter search) {
+ if (field instanceof ICompositeField) {
+ for (IFormField f : ((ICompositeField) field).getFields()) {
+ f.applySearch(search);
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/search/ISearchFilterService.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/search/ISearchFilterService.java
index 184fee7adc..5c78f5a131 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/search/ISearchFilterService.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/search/ISearchFilterService.java
@@ -1,28 +1,28 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.search;
-
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.shared.services.common.jdbc.SearchFilter;
-import org.eclipse.scout.service.IService;
-
-/**
- * Provides an implementation for new search filters
- */
-public interface ISearchFilterService extends IService {
-
- SearchFilter createNewSearchFilter();
-
- /**
- * whenever applySearch is called on any field, this methods is called
- */
- void applySearchDelegate(IFormField field, SearchFilter filter, boolean includeChildren);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.search;
+
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.shared.services.common.jdbc.SearchFilter;
+import org.eclipse.scout.service.IService;
+
+/**
+ * Provides an implementation for new search filters
+ */
+public interface ISearchFilterService extends IService {
+
+ SearchFilter createNewSearchFilter();
+
+ /**
+ * whenever applySearch is called on any field, this methods is called
+ */
+ void applySearchDelegate(IFormField field, SearchFilter filter, boolean includeChildren);
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/search/LegacySearchFilterService.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/search/LegacySearchFilterService.java
index 35d649b0c3..c680888b84 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/search/LegacySearchFilterService.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/search/LegacySearchFilterService.java
@@ -1,102 +1,102 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.search;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ClientJob;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
-import org.eclipse.scout.rt.client.ui.form.fields.AbstractValueField;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.composer.AbstractComposerField;
-import org.eclipse.scout.rt.client.ui.form.fields.composer.internal.LegacyComposerStatementBuilder;
-import org.eclipse.scout.rt.client.ui.form.fields.stringfield.AbstractStringField;
-import org.eclipse.scout.rt.shared.services.common.jdbc.LegacySearchFilter;
-import org.eclipse.scout.rt.shared.services.common.jdbc.SearchFilter;
-
-/**
- * @deprecated
- */
-@SuppressWarnings("deprecation")
-@Deprecated
-public class LegacySearchFilterService extends DefaultSearchFilterService {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(LegacySearchFilterService.class);
-
- @Override
- public SearchFilter createNewSearchFilter() {
- return new LegacySearchFilter();
- }
-
- public int resolveTokenIdByClass(Class<?> source) {
- throw new IllegalArgumentException("subclass should implement this method the resolve type to tokenId");
- }
-
- @Override
- public void applySearchDelegate(IFormField field, SearchFilter search, boolean includeChildren) {
- super.applySearchDelegate(field, search, false);
- if (search instanceof LegacySearchFilter) {
- if (applyInterceptor(field, (LegacySearchFilter) search)) {
- return;
- }
- }
- if (includeChildren) {
- applySearchDelegateForChildren(field, search);
- }
- }
-
- protected boolean applyInterceptor(IFormField field, LegacySearchFilter search) {
- //composer
- if (field instanceof AbstractComposerField) {
- AbstractComposerField composerField = (AbstractComposerField) field;
- ITreeNode rootNode = composerField.getTree().getRootNode();
- if (rootNode != null) {
- Object specialConstraint = new LegacyComposerStatementBuilder(search.getBindMap()).build(rootNode);
- if (specialConstraint != null) {
- try {
- search.addSpecialWhereToken(specialConstraint);
- }
- catch (ProcessingException e) {
- LOG.error("adding legacy search filter", e);
- }
- }
- }
- return true;
- }
- //string field
- if (field instanceof AbstractStringField) {
- AbstractStringField valueField = (AbstractStringField) field;
- String value = valueField.getValue();
- if (value != null && valueField.getLegacySearchTerm() != null) {
- if (ClientJob.getCurrentSession().getDesktop().isAutoPrefixWildcardForTextSearch()) {
- value = "*" + value;
- }
- try {
- search.addSpecialWhereToken(new LegacySearchFilter.StringLikeConstraint(valueField.getLegacySearchTerm(), value));
- }
- catch (ProcessingException e) {
- LOG.error("adding legacy search filter", e);
- }
- }
- return true;
- }
- //value
- if (field instanceof AbstractValueField<?>) {
- AbstractValueField<?> valueField = (AbstractValueField<?>) field;
- if (valueField.getValue() != null && valueField.getLegacySearchTerm() != null) {
- search.addWhereToken(valueField.getLegacySearchTerm(), valueField.getValue());
- }
- return true;
- }
- return false;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.search;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ClientJob;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
+import org.eclipse.scout.rt.client.ui.form.fields.AbstractValueField;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.composer.AbstractComposerField;
+import org.eclipse.scout.rt.client.ui.form.fields.composer.internal.LegacyComposerStatementBuilder;
+import org.eclipse.scout.rt.client.ui.form.fields.stringfield.AbstractStringField;
+import org.eclipse.scout.rt.shared.services.common.jdbc.LegacySearchFilter;
+import org.eclipse.scout.rt.shared.services.common.jdbc.SearchFilter;
+
+/**
+ * @deprecated
+ */
+@SuppressWarnings("deprecation")
+@Deprecated
+public class LegacySearchFilterService extends DefaultSearchFilterService {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(LegacySearchFilterService.class);
+
+ @Override
+ public SearchFilter createNewSearchFilter() {
+ return new LegacySearchFilter();
+ }
+
+ public int resolveTokenIdByClass(Class<?> source) {
+ throw new IllegalArgumentException("subclass should implement this method the resolve type to tokenId");
+ }
+
+ @Override
+ public void applySearchDelegate(IFormField field, SearchFilter search, boolean includeChildren) {
+ super.applySearchDelegate(field, search, false);
+ if (search instanceof LegacySearchFilter) {
+ if (applyInterceptor(field, (LegacySearchFilter) search)) {
+ return;
+ }
+ }
+ if (includeChildren) {
+ applySearchDelegateForChildren(field, search);
+ }
+ }
+
+ protected boolean applyInterceptor(IFormField field, LegacySearchFilter search) {
+ //composer
+ if (field instanceof AbstractComposerField) {
+ AbstractComposerField composerField = (AbstractComposerField) field;
+ ITreeNode rootNode = composerField.getTree().getRootNode();
+ if (rootNode != null) {
+ Object specialConstraint = new LegacyComposerStatementBuilder(search.getBindMap()).build(rootNode);
+ if (specialConstraint != null) {
+ try {
+ search.addSpecialWhereToken(specialConstraint);
+ }
+ catch (ProcessingException e) {
+ LOG.error("adding legacy search filter", e);
+ }
+ }
+ }
+ return true;
+ }
+ //string field
+ if (field instanceof AbstractStringField) {
+ AbstractStringField valueField = (AbstractStringField) field;
+ String value = valueField.getValue();
+ if (value != null && valueField.getLegacySearchTerm() != null) {
+ if (ClientJob.getCurrentSession().getDesktop().isAutoPrefixWildcardForTextSearch()) {
+ value = "*" + value;
+ }
+ try {
+ search.addSpecialWhereToken(new LegacySearchFilter.StringLikeConstraint(valueField.getLegacySearchTerm(), value));
+ }
+ catch (ProcessingException e) {
+ LOG.error("adding legacy search filter", e);
+ }
+ }
+ return true;
+ }
+ //value
+ if (field instanceof AbstractValueField<?>) {
+ AbstractValueField<?> valueField = (AbstractValueField<?>) field;
+ if (valueField.getValue() != null && valueField.getLegacySearchTerm() != null) {
+ search.addWhereToken(valueField.getLegacySearchTerm(), valueField.getValue());
+ }
+ return true;
+ }
+ return false;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/search/TokenBasedSearchFilterService.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/search/TokenBasedSearchFilterService.java
index ae5b9f8f8b..aafdffe245 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/search/TokenBasedSearchFilterService.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/search/TokenBasedSearchFilterService.java
@@ -1,78 +1,78 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.search;
-
-import org.eclipse.scout.rt.client.ClientJob;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
-import org.eclipse.scout.rt.client.ui.form.fields.AbstractValueField;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.composer.AbstractComposerField;
-import org.eclipse.scout.rt.client.ui.form.fields.composer.internal.TokenBasedComposerStatementBuilder;
-import org.eclipse.scout.rt.client.ui.form.fields.stringfield.AbstractStringField;
-import org.eclipse.scout.rt.shared.services.common.jdbc.SearchFilter;
-import org.eclipse.scout.rt.shared.services.common.jdbc.TokenBasedSearchFilter;
-import org.eclipse.scout.rt.shared.services.common.jdbc.TokenBasedSearchFilter.AndNodeToken;
-
-public class TokenBasedSearchFilterService extends DefaultSearchFilterService {
-
- @Override
- public SearchFilter createNewSearchFilter() {
- return new TokenBasedSearchFilter();
- }
-
- public Integer resolveTokenIdByClass(Class<?> source) {
- throw new IllegalArgumentException("subclass should implement this method the resolve type to tokenId");
- }
-
- @Override
- public void applySearchDelegate(IFormField field, SearchFilter search, boolean includeChildren) {
- if (search instanceof TokenBasedSearchFilter) {
- applyInterceptor(field, (TokenBasedSearchFilter) search);
- }
- super.applySearchDelegate(field, search, includeChildren);
- }
-
- protected void applyInterceptor(IFormField field, TokenBasedSearchFilter search) {
- //composer
- if (field instanceof AbstractComposerField) {
- AbstractComposerField composerField = (AbstractComposerField) field;
- ITreeNode rootNode = composerField.getTree().getRootNode();
- if (rootNode != null) {
- AndNodeToken rootTok = new TokenBasedComposerStatementBuilder(this).build(rootNode);
- if (rootTok != null) {
- search.addTreeToken(rootTok);
- }
- }
- return;
- }
- //string field
- if (field instanceof AbstractStringField) {
- AbstractStringField valueField = (AbstractStringField) field;
- String value = valueField.getValue();
- if (value != null) {
- if (ClientJob.getCurrentSession().getDesktop().isAutoPrefixWildcardForTextSearch()) {
- value = "*" + value;
- }
- search.addWildcardStringToken(resolveTokenIdByClass(field.getClass()), value);
- }
- return;
- }
- //value
- if (field instanceof AbstractValueField<?>) {
- AbstractValueField<?> valueField = (AbstractValueField<?>) field;
- if (valueField.getValue() != null) {
- search.addToken(resolveTokenIdByClass(field.getClass()), valueField.getValue());
- }
- return;
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.search;
+
+import org.eclipse.scout.rt.client.ClientJob;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
+import org.eclipse.scout.rt.client.ui.form.fields.AbstractValueField;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.composer.AbstractComposerField;
+import org.eclipse.scout.rt.client.ui.form.fields.composer.internal.TokenBasedComposerStatementBuilder;
+import org.eclipse.scout.rt.client.ui.form.fields.stringfield.AbstractStringField;
+import org.eclipse.scout.rt.shared.services.common.jdbc.SearchFilter;
+import org.eclipse.scout.rt.shared.services.common.jdbc.TokenBasedSearchFilter;
+import org.eclipse.scout.rt.shared.services.common.jdbc.TokenBasedSearchFilter.AndNodeToken;
+
+public class TokenBasedSearchFilterService extends DefaultSearchFilterService {
+
+ @Override
+ public SearchFilter createNewSearchFilter() {
+ return new TokenBasedSearchFilter();
+ }
+
+ public Integer resolveTokenIdByClass(Class<?> source) {
+ throw new IllegalArgumentException("subclass should implement this method the resolve type to tokenId");
+ }
+
+ @Override
+ public void applySearchDelegate(IFormField field, SearchFilter search, boolean includeChildren) {
+ if (search instanceof TokenBasedSearchFilter) {
+ applyInterceptor(field, (TokenBasedSearchFilter) search);
+ }
+ super.applySearchDelegate(field, search, includeChildren);
+ }
+
+ protected void applyInterceptor(IFormField field, TokenBasedSearchFilter search) {
+ //composer
+ if (field instanceof AbstractComposerField) {
+ AbstractComposerField composerField = (AbstractComposerField) field;
+ ITreeNode rootNode = composerField.getTree().getRootNode();
+ if (rootNode != null) {
+ AndNodeToken rootTok = new TokenBasedComposerStatementBuilder(this).build(rootNode);
+ if (rootTok != null) {
+ search.addTreeToken(rootTok);
+ }
+ }
+ return;
+ }
+ //string field
+ if (field instanceof AbstractStringField) {
+ AbstractStringField valueField = (AbstractStringField) field;
+ String value = valueField.getValue();
+ if (value != null) {
+ if (ClientJob.getCurrentSession().getDesktop().isAutoPrefixWildcardForTextSearch()) {
+ value = "*" + value;
+ }
+ search.addWildcardStringToken(resolveTokenIdByClass(field.getClass()), value);
+ }
+ return;
+ }
+ //value
+ if (field instanceof AbstractValueField<?>) {
+ AbstractValueField<?> valueField = (AbstractValueField<?>) field;
+ if (valueField.getValue() != null) {
+ search.addToken(resolveTokenIdByClass(field.getClass()), valueField.getValue());
+ }
+ return;
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/security/AccessControlServiceClientProxy.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/security/AccessControlServiceClientProxy.java
index 590b945398..776e6b2606 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/security/AccessControlServiceClientProxy.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/security/AccessControlServiceClientProxy.java
@@ -1,227 +1,227 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.security;
-
-import java.lang.reflect.Method;
-import java.security.AllPermission;
-import java.security.Permission;
-import java.security.Permissions;
-import java.util.Enumeration;
-import java.util.List;
-
-import org.eclipse.scout.commons.TTLCache;
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ClientJob;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.client.services.common.clientnotification.ClientNotificationConsumerEvent;
-import org.eclipse.scout.rt.client.services.common.clientnotification.IClientNotificationConsumerListener;
-import org.eclipse.scout.rt.client.services.common.clientnotification.IClientNotificationConsumerService;
-import org.eclipse.scout.rt.client.servicetunnel.ServiceTunnelUtility;
-import org.eclipse.scout.rt.shared.security.BasicHierarchyPermission;
-import org.eclipse.scout.rt.shared.security.FineGrainedAccessCheckRequiredException;
-import org.eclipse.scout.rt.shared.services.common.security.AccessControlChangedNotification;
-import org.eclipse.scout.rt.shared.services.common.security.IAccessControlService;
-import org.eclipse.scout.rt.shared.services.common.security.ResetAccessControlChangedNotification;
-import org.eclipse.scout.service.AbstractService;
-import org.eclipse.scout.service.SERVICES;
-
-/**
- * Access control permissions received from backend (JAAS permissions), cached for convenience and performance.
- * <p>
- * Service state is per [{@link IClientSession} instance and stored as {@link IClientSession#getData(String)}
- */
-@Priority(-3)
-public class AccessControlServiceClientProxy extends AbstractService implements IAccessControlService {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AccessControlServiceClientProxy.class);
- private static final String SESSION_DATA_KEY = "accessControlServiceState";
-
- public AccessControlServiceClientProxy() {
- }
-
- private ServiceState getServiceState() {
- IClientSession session = ClientJob.getCurrentSession();
- if (session == null) {
- LOG.warn("could not find a client session");
- return null;
- }
- ServiceState data = (ServiceState) session.getData(SESSION_DATA_KEY);
- if (data == null) {
- data = new ServiceState();
- session.setData(SESSION_DATA_KEY, data);
- }
- return data;
- }
-
- @SuppressWarnings("deprecation")
- @Override
- public void initializeService() {
- super.initializeService();
- // add client notification listener
- SERVICES.getService(IClientNotificationConsumerService.class).addGlobalClientNotificationConsumerListener(new IClientNotificationConsumerListener() {
- @Override
- public void handleEvent(ClientNotificationConsumerEvent e, boolean sync) {
- if (e.getClientNotification().getClass() == AccessControlChangedNotification.class) {
- ServiceState state = getServiceState();
- synchronized (state.m_cacheLock) {
- state.m_permissions = ((AccessControlChangedNotification) e.getClientNotification()).getPermissions();
- }
- }
- else if (e.getClientNotification().getClass() == ResetAccessControlChangedNotification.class) {
- clearCache();
- }
- }
- });
- }
-
- @Override
- public boolean checkPermission(Permission p) {
- ServiceState state = getServiceState();
- ensureCacheLoaded(state);
- if (p == null) {
- return true;
- }
- if (state.m_permissions == null) {
- return true;
- }
- else {
- Boolean b = state.m_checkPermissionCache.get(p.getName());
- if (b == null) {
- try {
- b = state.m_permissions.implies(p);
- }
- catch (FineGrainedAccessCheckRequiredException e) {
- // must be checked online
- b = getRemoteService().checkPermission(p);
- }
- state.m_checkPermissionCache.put(p.getName(), b);
- }
- return b;
- }
- }
-
- @Override
- public int getPermissionLevel(Permission p) {
- ServiceState state = getServiceState();
- ensureCacheLoaded(state);
- if (p == null) {
- return BasicHierarchyPermission.LEVEL_NONE;
- }
- if (!(p instanceof BasicHierarchyPermission)) {
- if (checkPermission(p)) {
- return BasicHierarchyPermission.LEVEL_ALL;
- }
- else {
- return BasicHierarchyPermission.LEVEL_NONE;
- }
- }
- BasicHierarchyPermission hp = (BasicHierarchyPermission) p;
- if (state.m_permissions == null) {
- List<Integer> levels = hp.getValidLevels();
- return levels.get(levels.size() - 1);
- }
- else {
- int maxLevel = BasicHierarchyPermission.LEVEL_UNDEFINED;
- Enumeration<Permission> en = state.m_permissions.elements();
- while (en.hasMoreElements()) {
- Permission grantedPermission = en.nextElement();
-
- // catch AllPermission
- if (grantedPermission instanceof AllPermission) {
- return BasicHierarchyPermission.LEVEL_ALL;
- }
-
- // process basic hierarchy permissions
- if (grantedPermission instanceof BasicHierarchyPermission) {
- BasicHierarchyPermission hgrantedPermission = (BasicHierarchyPermission) grantedPermission;
- if (hgrantedPermission.getClass().isAssignableFrom(hp.getClass())) {
- maxLevel = Math.max(maxLevel, hgrantedPermission.getLevel());
- if (maxLevel >= BasicHierarchyPermission.LEVEL_ALL) {
- break;
- }
- }
- }
- }
- return maxLevel;
- }
- }
-
- @Override
- public Permissions getPermissions() {
- ServiceState state = getServiceState();
- ensureCacheLoaded(state);
- return state.m_permissions;
- }
-
- private void ensureCacheLoaded(ServiceState state) {
- synchronized (state.m_cacheLock) {
- if (state.m_permissions == null) {
- // clear cache
- state.m_checkPermissionCache = new TTLCache<String, Boolean>(BasicHierarchyPermission.getCacheTimeoutMillis());
- // load permissions from backend
- state.m_permissions = getRemoteService().getPermissions();
- }
- }
- }
-
- @Override
- public boolean isProxyService() {
- return true;
- }
-
- @Override
- public String getUserIdOfCurrentSubject() {
- return getRemoteService().getUserIdOfCurrentSubject();
- }
-
- @Override
- public void clearCache() {
- ServiceState state = getServiceState();
- synchronized (state.m_cacheLock) {
- state.m_permissions = null;
- }
- }
-
- @Override
- public void clearCacheOfUserIds(String... userIds) {
- //nop
- }
-
- @SuppressWarnings("deprecation")
- @Deprecated
- @Override
- public void clearCacheOfPrincipals(String... userIds) {
- //nop
- }
-
- private IAccessControlService getRemoteService() {
- return ServiceTunnelUtility.createProxy(IAccessControlService.class, ClientSyncJob.getCurrentSession().getServiceTunnel());
- }
-
- /**
- * no service tunnel access on client side
- */
- @Override
- @SuppressWarnings("deprecation")
- public boolean checkServiceTunnelAccess(Class serviceInterface, Method method, Object[] args) {
- return false;
- }
-
- private static class ServiceState {
- final Object m_cacheLock = new Object();
- // permissions cache
- Permissions m_permissions;
- // query cache
- TTLCache<String, Boolean> m_checkPermissionCache = new TTLCache<String, Boolean>();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.security;
+
+import java.lang.reflect.Method;
+import java.security.AllPermission;
+import java.security.Permission;
+import java.security.Permissions;
+import java.util.Enumeration;
+import java.util.List;
+
+import org.eclipse.scout.commons.TTLCache;
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ClientJob;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.client.services.common.clientnotification.ClientNotificationConsumerEvent;
+import org.eclipse.scout.rt.client.services.common.clientnotification.IClientNotificationConsumerListener;
+import org.eclipse.scout.rt.client.services.common.clientnotification.IClientNotificationConsumerService;
+import org.eclipse.scout.rt.client.servicetunnel.ServiceTunnelUtility;
+import org.eclipse.scout.rt.shared.security.BasicHierarchyPermission;
+import org.eclipse.scout.rt.shared.security.FineGrainedAccessCheckRequiredException;
+import org.eclipse.scout.rt.shared.services.common.security.AccessControlChangedNotification;
+import org.eclipse.scout.rt.shared.services.common.security.IAccessControlService;
+import org.eclipse.scout.rt.shared.services.common.security.ResetAccessControlChangedNotification;
+import org.eclipse.scout.service.AbstractService;
+import org.eclipse.scout.service.SERVICES;
+
+/**
+ * Access control permissions received from backend (JAAS permissions), cached for convenience and performance.
+ * <p>
+ * Service state is per [{@link IClientSession} instance and stored as {@link IClientSession#getData(String)}
+ */
+@Priority(-3)
+public class AccessControlServiceClientProxy extends AbstractService implements IAccessControlService {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AccessControlServiceClientProxy.class);
+ private static final String SESSION_DATA_KEY = "accessControlServiceState";
+
+ public AccessControlServiceClientProxy() {
+ }
+
+ private ServiceState getServiceState() {
+ IClientSession session = ClientJob.getCurrentSession();
+ if (session == null) {
+ LOG.warn("could not find a client session");
+ return null;
+ }
+ ServiceState data = (ServiceState) session.getData(SESSION_DATA_KEY);
+ if (data == null) {
+ data = new ServiceState();
+ session.setData(SESSION_DATA_KEY, data);
+ }
+ return data;
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public void initializeService() {
+ super.initializeService();
+ // add client notification listener
+ SERVICES.getService(IClientNotificationConsumerService.class).addGlobalClientNotificationConsumerListener(new IClientNotificationConsumerListener() {
+ @Override
+ public void handleEvent(ClientNotificationConsumerEvent e, boolean sync) {
+ if (e.getClientNotification().getClass() == AccessControlChangedNotification.class) {
+ ServiceState state = getServiceState();
+ synchronized (state.m_cacheLock) {
+ state.m_permissions = ((AccessControlChangedNotification) e.getClientNotification()).getPermissions();
+ }
+ }
+ else if (e.getClientNotification().getClass() == ResetAccessControlChangedNotification.class) {
+ clearCache();
+ }
+ }
+ });
+ }
+
+ @Override
+ public boolean checkPermission(Permission p) {
+ ServiceState state = getServiceState();
+ ensureCacheLoaded(state);
+ if (p == null) {
+ return true;
+ }
+ if (state.m_permissions == null) {
+ return true;
+ }
+ else {
+ Boolean b = state.m_checkPermissionCache.get(p.getName());
+ if (b == null) {
+ try {
+ b = state.m_permissions.implies(p);
+ }
+ catch (FineGrainedAccessCheckRequiredException e) {
+ // must be checked online
+ b = getRemoteService().checkPermission(p);
+ }
+ state.m_checkPermissionCache.put(p.getName(), b);
+ }
+ return b;
+ }
+ }
+
+ @Override
+ public int getPermissionLevel(Permission p) {
+ ServiceState state = getServiceState();
+ ensureCacheLoaded(state);
+ if (p == null) {
+ return BasicHierarchyPermission.LEVEL_NONE;
+ }
+ if (!(p instanceof BasicHierarchyPermission)) {
+ if (checkPermission(p)) {
+ return BasicHierarchyPermission.LEVEL_ALL;
+ }
+ else {
+ return BasicHierarchyPermission.LEVEL_NONE;
+ }
+ }
+ BasicHierarchyPermission hp = (BasicHierarchyPermission) p;
+ if (state.m_permissions == null) {
+ List<Integer> levels = hp.getValidLevels();
+ return levels.get(levels.size() - 1);
+ }
+ else {
+ int maxLevel = BasicHierarchyPermission.LEVEL_UNDEFINED;
+ Enumeration<Permission> en = state.m_permissions.elements();
+ while (en.hasMoreElements()) {
+ Permission grantedPermission = en.nextElement();
+
+ // catch AllPermission
+ if (grantedPermission instanceof AllPermission) {
+ return BasicHierarchyPermission.LEVEL_ALL;
+ }
+
+ // process basic hierarchy permissions
+ if (grantedPermission instanceof BasicHierarchyPermission) {
+ BasicHierarchyPermission hgrantedPermission = (BasicHierarchyPermission) grantedPermission;
+ if (hgrantedPermission.getClass().isAssignableFrom(hp.getClass())) {
+ maxLevel = Math.max(maxLevel, hgrantedPermission.getLevel());
+ if (maxLevel >= BasicHierarchyPermission.LEVEL_ALL) {
+ break;
+ }
+ }
+ }
+ }
+ return maxLevel;
+ }
+ }
+
+ @Override
+ public Permissions getPermissions() {
+ ServiceState state = getServiceState();
+ ensureCacheLoaded(state);
+ return state.m_permissions;
+ }
+
+ private void ensureCacheLoaded(ServiceState state) {
+ synchronized (state.m_cacheLock) {
+ if (state.m_permissions == null) {
+ // clear cache
+ state.m_checkPermissionCache = new TTLCache<String, Boolean>(BasicHierarchyPermission.getCacheTimeoutMillis());
+ // load permissions from backend
+ state.m_permissions = getRemoteService().getPermissions();
+ }
+ }
+ }
+
+ @Override
+ public boolean isProxyService() {
+ return true;
+ }
+
+ @Override
+ public String getUserIdOfCurrentSubject() {
+ return getRemoteService().getUserIdOfCurrentSubject();
+ }
+
+ @Override
+ public void clearCache() {
+ ServiceState state = getServiceState();
+ synchronized (state.m_cacheLock) {
+ state.m_permissions = null;
+ }
+ }
+
+ @Override
+ public void clearCacheOfUserIds(String... userIds) {
+ //nop
+ }
+
+ @SuppressWarnings("deprecation")
+ @Deprecated
+ @Override
+ public void clearCacheOfPrincipals(String... userIds) {
+ //nop
+ }
+
+ private IAccessControlService getRemoteService() {
+ return ServiceTunnelUtility.createProxy(IAccessControlService.class, ClientSyncJob.getCurrentSession().getServiceTunnel());
+ }
+
+ /**
+ * no service tunnel access on client side
+ */
+ @Override
+ @SuppressWarnings("deprecation")
+ public boolean checkServiceTunnelAccess(Class serviceInterface, Method method, Object[] args) {
+ return false;
+ }
+
+ private static class ServiceState {
+ final Object m_cacheLock = new Object();
+ // permissions cache
+ Permissions m_permissions;
+ // query cache
+ TTLCache<String, Boolean> m_checkPermissionCache = new TTLCache<String, Boolean>();
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/security/PermissionServiceClientProxy.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/security/PermissionServiceClientProxy.java
index 3c38f89588..13393658a9 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/security/PermissionServiceClientProxy.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/security/PermissionServiceClientProxy.java
@@ -1,81 +1,81 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.security;
-
-import java.util.HashMap;
-
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.commons.osgi.BundleClassDescriptor;
-import org.eclipse.scout.rt.client.ClientJob;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.client.servicetunnel.ServiceTunnelUtility;
-import org.eclipse.scout.rt.shared.services.common.security.IPermissionService;
-import org.eclipse.scout.service.AbstractService;
-
-/**
- * Cache of available permission types (not instances)
- * <p>
- * Service state is per [{@link IClientSession} type and stored in global map
- */
-@Priority(-3)
-public class PermissionServiceClientProxy extends AbstractService implements IPermissionService {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(PermissionServiceClientProxy.class);
-
- private final Object m_stateLock = new Object();
- private final HashMap<Object, ServiceState> m_stateMap = new HashMap<Object, ServiceState>();
-
- public PermissionServiceClientProxy() {
- }
-
- private ServiceState getServiceState() {
- IClientSession session = ClientJob.getCurrentSession();
- if (session == null) {
- LOG.warn("could not find a client session");
- return null;
- }
- Object key = session.getClass();
- synchronized (m_stateLock) {
- ServiceState data = (ServiceState) m_stateMap.get(key);
- if (data == null) {
- data = new ServiceState();
- m_stateMap.put(key, data);
- }
- return data;
- }
- }
-
- @Override
- public BundleClassDescriptor[] getAllPermissionClasses() {
- ServiceState state = getServiceState();
- checkCache(state);
- return state.m_permissionClasses;
- }
-
- private void checkCache(ServiceState state) {
- synchronized (state.m_permissionClassesLock) {
- if (state.m_permissionClasses == null) {
- state.m_permissionClasses = getRemoteService().getAllPermissionClasses();
- }
- }
- }
-
- private IPermissionService getRemoteService() {
- return ServiceTunnelUtility.createProxy(IPermissionService.class, ClientSyncJob.getCurrentSession().getServiceTunnel());
- }
-
- private static class ServiceState {
- final Object m_permissionClassesLock = new Object();
- BundleClassDescriptor[] m_permissionClasses;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.security;
+
+import java.util.HashMap;
+
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.commons.osgi.BundleClassDescriptor;
+import org.eclipse.scout.rt.client.ClientJob;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.client.servicetunnel.ServiceTunnelUtility;
+import org.eclipse.scout.rt.shared.services.common.security.IPermissionService;
+import org.eclipse.scout.service.AbstractService;
+
+/**
+ * Cache of available permission types (not instances)
+ * <p>
+ * Service state is per [{@link IClientSession} type and stored in global map
+ */
+@Priority(-3)
+public class PermissionServiceClientProxy extends AbstractService implements IPermissionService {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(PermissionServiceClientProxy.class);
+
+ private final Object m_stateLock = new Object();
+ private final HashMap<Object, ServiceState> m_stateMap = new HashMap<Object, ServiceState>();
+
+ public PermissionServiceClientProxy() {
+ }
+
+ private ServiceState getServiceState() {
+ IClientSession session = ClientJob.getCurrentSession();
+ if (session == null) {
+ LOG.warn("could not find a client session");
+ return null;
+ }
+ Object key = session.getClass();
+ synchronized (m_stateLock) {
+ ServiceState data = (ServiceState) m_stateMap.get(key);
+ if (data == null) {
+ data = new ServiceState();
+ m_stateMap.put(key, data);
+ }
+ return data;
+ }
+ }
+
+ @Override
+ public BundleClassDescriptor[] getAllPermissionClasses() {
+ ServiceState state = getServiceState();
+ checkCache(state);
+ return state.m_permissionClasses;
+ }
+
+ private void checkCache(ServiceState state) {
+ synchronized (state.m_permissionClassesLock) {
+ if (state.m_permissionClasses == null) {
+ state.m_permissionClasses = getRemoteService().getAllPermissionClasses();
+ }
+ }
+ }
+
+ private IPermissionService getRemoteService() {
+ return ServiceTunnelUtility.createProxy(IPermissionService.class, ClientSyncJob.getCurrentSession().getServiceTunnel());
+ }
+
+ private static class ServiceState {
+ final Object m_permissionClassesLock = new Object();
+ BundleClassDescriptor[] m_permissionClasses;
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/session/DefaultClientSessionService.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/session/DefaultClientSessionService.java
index 8c9d1f8d93..60bcc951b8 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/session/DefaultClientSessionService.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/session/DefaultClientSessionService.java
@@ -1,73 +1,73 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.session;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.commons.job.JobEx;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ClientAsyncJob;
-import org.eclipse.scout.rt.client.ClientJob;
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.shared.services.common.session.IJobRunnable;
-import org.eclipse.scout.rt.shared.services.common.session.ISessionService;
-import org.eclipse.scout.service.AbstractService;
-
-/**
- * Default implementation of {@link ISessionService} used on client-side.
- *
- * @since 3.8.1
- */
-@Priority(-1)
-public class DefaultClientSessionService extends AbstractService implements ISessionService {
-
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(DefaultClientSessionService.class);
-
- @Override
- public IClientSession getCurrentSession() {
- return ClientJob.getCurrentSession();
- }
-
- @Override
- public JobEx createAsyncJob(IJobRunnable runnable) {
- return createAsyncJob(null, runnable);
- }
-
- @Override
- public JobEx createAsyncJob(String name, IJobRunnable runnable) {
- IClientSession session = getCurrentSession();
- if (session == null) {
- LOG.error("client session not available");
- return null;
- }
- if (name == null) {
- name = "client session async job";
- }
- return new P_ClientSessionAsyncJob(name, session, true, runnable);
- }
-
- private static class P_ClientSessionAsyncJob extends ClientAsyncJob {
-
- private final IJobRunnable m_runnable;
-
- public P_ClientSessionAsyncJob(String name, IClientSession session, boolean system, IJobRunnable runnable) {
- super(name, session, system);
- m_runnable = runnable;
- }
-
- @Override
- protected IStatus runStatus(IProgressMonitor monitor) {
- return m_runnable.run(monitor);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.session;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.commons.job.JobEx;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ClientAsyncJob;
+import org.eclipse.scout.rt.client.ClientJob;
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.shared.services.common.session.IJobRunnable;
+import org.eclipse.scout.rt.shared.services.common.session.ISessionService;
+import org.eclipse.scout.service.AbstractService;
+
+/**
+ * Default implementation of {@link ISessionService} used on client-side.
+ *
+ * @since 3.8.1
+ */
+@Priority(-1)
+public class DefaultClientSessionService extends AbstractService implements ISessionService {
+
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(DefaultClientSessionService.class);
+
+ @Override
+ public IClientSession getCurrentSession() {
+ return ClientJob.getCurrentSession();
+ }
+
+ @Override
+ public JobEx createAsyncJob(IJobRunnable runnable) {
+ return createAsyncJob(null, runnable);
+ }
+
+ @Override
+ public JobEx createAsyncJob(String name, IJobRunnable runnable) {
+ IClientSession session = getCurrentSession();
+ if (session == null) {
+ LOG.error("client session not available");
+ return null;
+ }
+ if (name == null) {
+ name = "client session async job";
+ }
+ return new P_ClientSessionAsyncJob(name, session, true, runnable);
+ }
+
+ private static class P_ClientSessionAsyncJob extends ClientAsyncJob {
+
+ private final IJobRunnable m_runnable;
+
+ public P_ClientSessionAsyncJob(String name, IClientSession session, boolean system, IJobRunnable runnable) {
+ super(name, session, system);
+ m_runnable = runnable;
+ }
+
+ @Override
+ protected IStatus runStatus(IProgressMonitor monitor) {
+ return m_runnable.run(monitor);
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/session/IClientSessionRegistryService.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/session/IClientSessionRegistryService.java
index ef0d1fbc96..305145fd2c 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/session/IClientSessionRegistryService.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/session/IClientSessionRegistryService.java
@@ -1,97 +1,97 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.session;
-
-import java.util.UUID;
-
-import javax.security.auth.Subject;
-
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.rt.client.ClientJob;
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.shared.ui.UserAgent;
-import org.eclipse.scout.service.IService;
-
-@Priority(-3)
-public interface IClientSessionRegistryService extends IService {
-
- /**
- * Creates and starts a new {@link IClientSession}. The session is started by the caller
- * thread.
- * </p>
- * <p>
- * Note: If the creation of the session requires a special jaas context call it only inside a
- * {@link Subject#doAs(Subject, java.security.PrivilegedAction)} section.
- * </p>
- * <p>
- * Warning: Only use this method if the client environment is a rich client (swt, swing, ...) and therefore supports
- * singleton user sessions. Don't use it with web clients (rap, wicket, ...). With web clients rather use
- * {@link #newClientSession(Class, Subject, String, UserAgent)} and provide a virtualSessionId.
- * </p>
- *
- * @param userAgent
- * the current {@link UserAgent} which will be set on the client session.
- * @return a new client session of type clazz
- * @see {@link IClientSession#startSession(org.osgi.framework.Bundle)},{@link IClientSession#getUserAgent()},
- * {@link IClientSession#isActive()}
- */
- <T extends IClientSession> T newClientSession(Class<T> clazz, UserAgent userAgent);
-
- /**
- * <p>
- * A new session is created and started. The session is started by the caller thread.
- * </p>
- * <p>
- * Note: If the creation of the session requires a special jaas context call it only inside a
- * {@link Subject#doAs(Subject, java.security.PrivilegedAction)} section.
- * </p>
- *
- * @param virtualSessionId
- * a unique id which will be set on the client session. Do not reuse an existing id. An id can be created by
- * using {@link UUID#randomUUID()}.
- * @param userAgent
- * the current {@link UserAgent} which will be set on the client session.
- * @return a new client session of type clazz
- * @see {@link IClientSession#startSession(org.osgi.framework.Bundle)}, {@link IClientSession#getVirtualSessionId()},
- * {@link IClientSession#getUserAgent()},{@link IClientSession#isActive()}
- */
- <T extends IClientSession> T newClientSession(Class<T> clazz, Subject subject, String virtualSessionId, UserAgent userAgent);
-
- /**
- * Creates and starts a new {@link IClientSession}. Such a new session is created and started once per osgi. It is
- * cached as long as it is active
- * <p>
- * Note: If the creation of the session requires a special jaas context call it only inside a
- * {@link Subject#doAs(Subject, java.security.PrivilegedAction)} section
- * <p>
- * Warning: Only use this method if the client environment is a rich client (swt, swing, ...) and therefore supports
- * singleton user sessions. Don't use it with web clients (rap, wicket, ...). With web clients rather use
- * {@link #newClientSession(Class, Subject, String, UserAgent)} and provide a virtualSessionId.
- *
- * @return the cached (if active) client session of type clazz or a new one if
- * none was cached
- * <p>
- * @deprecated Use {@link #newClientSession(Class, UserAgent)}, {@link ClientJob#getCurrentSession()} or
- * {@link #getClientSessionFor(Class)} instead.
- * Will be removed in 3.9.0
- * @see {@link IClientSession#isActive()}, {@link IClientSession#startSession(org.osgi.framework.Bundle)}
- */
- @Deprecated
- <T extends IClientSession> T getClientSession(Class<T> clazz);
-
- /**
- * @deprecated Use {@link #newClientSession(Class, Subject, String, UserAgent)} instead.<br/>
- * Will be removed in 3.9.0
- */
- @Deprecated
- <T extends IClientSession> T newClientSession(Class<T> clazz, Subject subject, String virtualSessionId);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.session;
+
+import java.util.UUID;
+
+import javax.security.auth.Subject;
+
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.rt.client.ClientJob;
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.shared.ui.UserAgent;
+import org.eclipse.scout.service.IService;
+
+@Priority(-3)
+public interface IClientSessionRegistryService extends IService {
+
+ /**
+ * Creates and starts a new {@link IClientSession}. The session is started by the caller
+ * thread.
+ * </p>
+ * <p>
+ * Note: If the creation of the session requires a special jaas context call it only inside a
+ * {@link Subject#doAs(Subject, java.security.PrivilegedAction)} section.
+ * </p>
+ * <p>
+ * Warning: Only use this method if the client environment is a rich client (swt, swing, ...) and therefore supports
+ * singleton user sessions. Don't use it with web clients (rap, wicket, ...). With web clients rather use
+ * {@link #newClientSession(Class, Subject, String, UserAgent)} and provide a virtualSessionId.
+ * </p>
+ *
+ * @param userAgent
+ * the current {@link UserAgent} which will be set on the client session.
+ * @return a new client session of type clazz
+ * @see {@link IClientSession#startSession(org.osgi.framework.Bundle)},{@link IClientSession#getUserAgent()},
+ * {@link IClientSession#isActive()}
+ */
+ <T extends IClientSession> T newClientSession(Class<T> clazz, UserAgent userAgent);
+
+ /**
+ * <p>
+ * A new session is created and started. The session is started by the caller thread.
+ * </p>
+ * <p>
+ * Note: If the creation of the session requires a special jaas context call it only inside a
+ * {@link Subject#doAs(Subject, java.security.PrivilegedAction)} section.
+ * </p>
+ *
+ * @param virtualSessionId
+ * a unique id which will be set on the client session. Do not reuse an existing id. An id can be created by
+ * using {@link UUID#randomUUID()}.
+ * @param userAgent
+ * the current {@link UserAgent} which will be set on the client session.
+ * @return a new client session of type clazz
+ * @see {@link IClientSession#startSession(org.osgi.framework.Bundle)}, {@link IClientSession#getVirtualSessionId()},
+ * {@link IClientSession#getUserAgent()},{@link IClientSession#isActive()}
+ */
+ <T extends IClientSession> T newClientSession(Class<T> clazz, Subject subject, String virtualSessionId, UserAgent userAgent);
+
+ /**
+ * Creates and starts a new {@link IClientSession}. Such a new session is created and started once per osgi. It is
+ * cached as long as it is active
+ * <p>
+ * Note: If the creation of the session requires a special jaas context call it only inside a
+ * {@link Subject#doAs(Subject, java.security.PrivilegedAction)} section
+ * <p>
+ * Warning: Only use this method if the client environment is a rich client (swt, swing, ...) and therefore supports
+ * singleton user sessions. Don't use it with web clients (rap, wicket, ...). With web clients rather use
+ * {@link #newClientSession(Class, Subject, String, UserAgent)} and provide a virtualSessionId.
+ *
+ * @return the cached (if active) client session of type clazz or a new one if
+ * none was cached
+ * <p>
+ * @deprecated Use {@link #newClientSession(Class, UserAgent)}, {@link ClientJob#getCurrentSession()} or
+ * {@link #getClientSessionFor(Class)} instead.
+ * Will be removed in 3.9.0
+ * @see {@link IClientSession#isActive()}, {@link IClientSession#startSession(org.osgi.framework.Bundle)}
+ */
+ @Deprecated
+ <T extends IClientSession> T getClientSession(Class<T> clazz);
+
+ /**
+ * @deprecated Use {@link #newClientSession(Class, Subject, String, UserAgent)} instead.<br/>
+ * Will be removed in 3.9.0
+ */
+ @Deprecated
+ <T extends IClientSession> T newClientSession(Class<T> clazz, Subject subject, String virtualSessionId);
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/session/internal/ClientSessionRegistryService.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/session/internal/ClientSessionRegistryService.java
index 2463b4fdb9..057b340be9 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/session/internal/ClientSessionRegistryService.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/session/internal/ClientSessionRegistryService.java
@@ -1,155 +1,155 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.session.internal;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.security.auth.Subject;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.client.services.common.session.IClientSessionRegistryService;
-import org.eclipse.scout.rt.shared.ui.UserAgent;
-import org.eclipse.scout.service.AbstractService;
-import org.osgi.framework.Bundle;
-
-@Priority(-1)
-public class ClientSessionRegistryService extends AbstractService implements IClientSessionRegistryService {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(ClientSessionRegistryService.class);
-
- private final Map<String, IClientSession> m_cache = new HashMap<String, IClientSession>();
- private final Object m_cacheLock = new Object();
-
- @Override
- public <T extends IClientSession> T newClientSession(Class<T> clazz, UserAgent userAgent) {
- final Bundle bundle = getDefiningBundle(clazz);
- if (bundle == null) {
- return null;
- }
-
- return createAndStartClientSession(clazz, bundle, null, null, userAgent);
- }
-
- @Override
- public <T extends IClientSession> T newClientSession(Class<T> clazz, Subject subject, String virtualSessionId, UserAgent userAgent) {
- final Bundle bundle = getDefiningBundle(clazz);
- if (bundle == null) {
- return null;
- }
-
- return createAndStartClientSession(clazz, bundle, subject, virtualSessionId, userAgent);
- }
-
- @SuppressWarnings("unchecked")
- private <T extends IClientSession> T createAndStartClientSession(Class<T> clazz, final Bundle bundle, Subject subject, String virtualSessionId, UserAgent userAgent) {
- try {
- IClientSession clientSession = clazz.newInstance();
- clientSession.setSubject(subject);
- if (virtualSessionId != null) {
- clientSession.setVirtualSessionId(virtualSessionId);
- }
- clientSession.setUserAgent(userAgent);
- ClientSyncJob job = new ClientSyncJob("Session startup", clientSession) {
- @Override
- protected void runVoid(IProgressMonitor monitor) throws Throwable {
- getCurrentSession().startSession(bundle);
- }
- };
- //must run now to use correct jaas and subject context of calling thread. Especially relevant when running in a servlet thread (rwt)
- job.runNow(new NullProgressMonitor());
- job.throwOnError();
-
- return (T) clientSession;
- }
- catch (Throwable t) {
- LOG.error("could not load session for " + bundle.getSymbolicName(), t);
- return null;
- }
- }
-
- private <T extends IClientSession> Bundle getDefiningBundle(Class<T> clazz) {
- String symbolicName = clazz.getPackage().getName();
- Bundle bundleLocator = null;
- while (symbolicName != null) {
- bundleLocator = Platform.getBundle(symbolicName);
- int i = symbolicName.lastIndexOf('.');
- if (bundleLocator != null || i < 0) {
- break;
- }
- symbolicName = symbolicName.substring(0, i);
- }
-
- return Platform.getBundle(symbolicName);
- }
-
- @SuppressWarnings({"deprecation", "unchecked"})
- @Override
- public <T extends IClientSession> T getClientSession(Class<T> clazz) {
- final Bundle bundle = getDefiningBundle(clazz);
- if (bundle == null) {
- return null;
- }
-
- synchronized (m_cacheLock) {
- IClientSession clientSession = m_cache.get(bundle.getSymbolicName());
- if (clientSession == null || !clientSession.isActive()) {
- clientSession = createAndStartClientSession(clazz, bundle, UserAgent.createDefault());
- m_cache.put(bundle.getSymbolicName(), clientSession);
- }
- return (T) clientSession;
- }
- }
-
- /**
- * Compared to {@link #createAndStartClientSession(Class, Bundle, Subject, String, UserAgent)} this method starts the
- * session in a separate thread.
- *
- * @deprecated Will be removed in 3.9.0
- */
- @SuppressWarnings("unchecked")
- @Deprecated
- private <T extends IClientSession> T createAndStartClientSession(Class<T> clazz, final Bundle bundle, UserAgent userAgent) {
- IClientSession clientSession;
- try {
- clientSession = clazz.newInstance();
- clientSession.setUserAgent(userAgent);
- ClientSyncJob job = new ClientSyncJob("Session startup", clientSession) {
- @Override
- protected void runVoid(IProgressMonitor monitor) throws Throwable {
- getCurrentSession().startSession(bundle);
- }
- };
- job.schedule();
- job.join();
- job.throwOnError();
-
- return (T) clientSession;
- }
- catch (Throwable t) {
- LOG.error("could not load session for " + bundle.getSymbolicName(), t);
- return null;
- }
- }
-
- @SuppressWarnings("deprecation")
- @Override
- public <T extends IClientSession> T newClientSession(Class<T> clazz, Subject subject, String virtualSessionId) {
- return newClientSession(clazz, subject, virtualSessionId, UserAgent.createDefault());
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.session.internal;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.security.auth.Subject;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.client.services.common.session.IClientSessionRegistryService;
+import org.eclipse.scout.rt.shared.ui.UserAgent;
+import org.eclipse.scout.service.AbstractService;
+import org.osgi.framework.Bundle;
+
+@Priority(-1)
+public class ClientSessionRegistryService extends AbstractService implements IClientSessionRegistryService {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(ClientSessionRegistryService.class);
+
+ private final Map<String, IClientSession> m_cache = new HashMap<String, IClientSession>();
+ private final Object m_cacheLock = new Object();
+
+ @Override
+ public <T extends IClientSession> T newClientSession(Class<T> clazz, UserAgent userAgent) {
+ final Bundle bundle = getDefiningBundle(clazz);
+ if (bundle == null) {
+ return null;
+ }
+
+ return createAndStartClientSession(clazz, bundle, null, null, userAgent);
+ }
+
+ @Override
+ public <T extends IClientSession> T newClientSession(Class<T> clazz, Subject subject, String virtualSessionId, UserAgent userAgent) {
+ final Bundle bundle = getDefiningBundle(clazz);
+ if (bundle == null) {
+ return null;
+ }
+
+ return createAndStartClientSession(clazz, bundle, subject, virtualSessionId, userAgent);
+ }
+
+ @SuppressWarnings("unchecked")
+ private <T extends IClientSession> T createAndStartClientSession(Class<T> clazz, final Bundle bundle, Subject subject, String virtualSessionId, UserAgent userAgent) {
+ try {
+ IClientSession clientSession = clazz.newInstance();
+ clientSession.setSubject(subject);
+ if (virtualSessionId != null) {
+ clientSession.setVirtualSessionId(virtualSessionId);
+ }
+ clientSession.setUserAgent(userAgent);
+ ClientSyncJob job = new ClientSyncJob("Session startup", clientSession) {
+ @Override
+ protected void runVoid(IProgressMonitor monitor) throws Throwable {
+ getCurrentSession().startSession(bundle);
+ }
+ };
+ //must run now to use correct jaas and subject context of calling thread. Especially relevant when running in a servlet thread (rwt)
+ job.runNow(new NullProgressMonitor());
+ job.throwOnError();
+
+ return (T) clientSession;
+ }
+ catch (Throwable t) {
+ LOG.error("could not load session for " + bundle.getSymbolicName(), t);
+ return null;
+ }
+ }
+
+ private <T extends IClientSession> Bundle getDefiningBundle(Class<T> clazz) {
+ String symbolicName = clazz.getPackage().getName();
+ Bundle bundleLocator = null;
+ while (symbolicName != null) {
+ bundleLocator = Platform.getBundle(symbolicName);
+ int i = symbolicName.lastIndexOf('.');
+ if (bundleLocator != null || i < 0) {
+ break;
+ }
+ symbolicName = symbolicName.substring(0, i);
+ }
+
+ return Platform.getBundle(symbolicName);
+ }
+
+ @SuppressWarnings({"deprecation", "unchecked"})
+ @Override
+ public <T extends IClientSession> T getClientSession(Class<T> clazz) {
+ final Bundle bundle = getDefiningBundle(clazz);
+ if (bundle == null) {
+ return null;
+ }
+
+ synchronized (m_cacheLock) {
+ IClientSession clientSession = m_cache.get(bundle.getSymbolicName());
+ if (clientSession == null || !clientSession.isActive()) {
+ clientSession = createAndStartClientSession(clazz, bundle, UserAgent.createDefault());
+ m_cache.put(bundle.getSymbolicName(), clientSession);
+ }
+ return (T) clientSession;
+ }
+ }
+
+ /**
+ * Compared to {@link #createAndStartClientSession(Class, Bundle, Subject, String, UserAgent)} this method starts the
+ * session in a separate thread.
+ *
+ * @deprecated Will be removed in 3.9.0
+ */
+ @SuppressWarnings("unchecked")
+ @Deprecated
+ private <T extends IClientSession> T createAndStartClientSession(Class<T> clazz, final Bundle bundle, UserAgent userAgent) {
+ IClientSession clientSession;
+ try {
+ clientSession = clazz.newInstance();
+ clientSession.setUserAgent(userAgent);
+ ClientSyncJob job = new ClientSyncJob("Session startup", clientSession) {
+ @Override
+ protected void runVoid(IProgressMonitor monitor) throws Throwable {
+ getCurrentSession().startSession(bundle);
+ }
+ };
+ job.schedule();
+ job.join();
+ job.throwOnError();
+
+ return (T) clientSession;
+ }
+ catch (Throwable t) {
+ LOG.error("could not load session for " + bundle.getSymbolicName(), t);
+ return null;
+ }
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public <T extends IClientSession> T newClientSession(Class<T> clazz, Subject subject, String virtualSessionId) {
+ return newClientSession(clazz, subject, virtualSessionId, UserAgent.createDefault());
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/shell/DefaultShellService.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/shell/DefaultShellService.java
index 50fe576df2..e5c415da04 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/shell/DefaultShellService.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/shell/DefaultShellService.java
@@ -1,90 +1,90 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.shell;
-
-import java.io.File;
-import java.io.IOException;
-
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.services.common.shell.IShellService;
-import org.eclipse.scout.rt.shared.ui.UserAgentUtility;
-import org.eclipse.scout.service.AbstractService;
-
-/**
- *
- */
-@Priority(0)
-public class DefaultShellService extends AbstractService implements IShellService {
-
- @Override
- public void shellOpen(String path) throws ProcessingException {
- if (UserAgentUtility.isWebClient()) {
- ClientSyncJob.getCurrentSession().getDesktop().openBrowserWindow(path);
- }
- else {
- openWithRuntimeExec(path);
- }
- }
-
- protected String validatePath(String path) throws IOException {
- path = path.replace('\\', File.separatorChar);
- if (new File(path).exists()) {
- path = new File(path).getCanonicalPath();
- String osName = System.getProperty("os.name");
- if (osName != null && osName.startsWith("Mac OS")) {
- //mac is not able to open files with a space, even when in quotes
- String ext = path.substring(path.lastIndexOf('.'));
- File f = new File(new File(path).getParentFile(), "" + System.nanoTime() + ext);
- new File(path).renameTo(f);
- f.deleteOnExit();
- path = f.getAbsolutePath();
- }
- }
- return path;
- }
-
- protected void openWithRuntimeExec(String path) throws ProcessingException {
- String osName = System.getProperty("os.name");
- if (osName == null) {
- return;
- }
- try {
- String commandline = null;
- if (osName.startsWith("Windows")) {
- String pathQuoted = "\"" + validatePath(path) + "\"";
- commandline = "cmd.exe /c start \"\" " + pathQuoted;
- }
- else if (osName.startsWith("Mac OS")) {
- //mac is not able to open files with a space, even when in quotes
- commandline = "open " + validatePath(path);
- }
- else if (osName.startsWith("Linux")) {
- String pathQuoted = "\"" + validatePath(path) + "\"";
- commandline = "xdg-open " + pathQuoted;
- }
- if (commandline == null) {
- return;
- }
- Process process = Runtime.getRuntime().exec(commandline);
- process.waitFor();
- }
- catch (InterruptedException ie) {
- throw new ProcessingException(ScoutTexts.get("Interrupted"), ie);
- }
- catch (Throwable t) {
- throw new ProcessingException("Unexpected: " + path, t);
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.shell;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.services.common.shell.IShellService;
+import org.eclipse.scout.rt.shared.ui.UserAgentUtility;
+import org.eclipse.scout.service.AbstractService;
+
+/**
+ *
+ */
+@Priority(0)
+public class DefaultShellService extends AbstractService implements IShellService {
+
+ @Override
+ public void shellOpen(String path) throws ProcessingException {
+ if (UserAgentUtility.isWebClient()) {
+ ClientSyncJob.getCurrentSession().getDesktop().openBrowserWindow(path);
+ }
+ else {
+ openWithRuntimeExec(path);
+ }
+ }
+
+ protected String validatePath(String path) throws IOException {
+ path = path.replace('\\', File.separatorChar);
+ if (new File(path).exists()) {
+ path = new File(path).getCanonicalPath();
+ String osName = System.getProperty("os.name");
+ if (osName != null && osName.startsWith("Mac OS")) {
+ //mac is not able to open files with a space, even when in quotes
+ String ext = path.substring(path.lastIndexOf('.'));
+ File f = new File(new File(path).getParentFile(), "" + System.nanoTime() + ext);
+ new File(path).renameTo(f);
+ f.deleteOnExit();
+ path = f.getAbsolutePath();
+ }
+ }
+ return path;
+ }
+
+ protected void openWithRuntimeExec(String path) throws ProcessingException {
+ String osName = System.getProperty("os.name");
+ if (osName == null) {
+ return;
+ }
+ try {
+ String commandline = null;
+ if (osName.startsWith("Windows")) {
+ String pathQuoted = "\"" + validatePath(path) + "\"";
+ commandline = "cmd.exe /c start \"\" " + pathQuoted;
+ }
+ else if (osName.startsWith("Mac OS")) {
+ //mac is not able to open files with a space, even when in quotes
+ commandline = "open " + validatePath(path);
+ }
+ else if (osName.startsWith("Linux")) {
+ String pathQuoted = "\"" + validatePath(path) + "\"";
+ commandline = "xdg-open " + pathQuoted;
+ }
+ if (commandline == null) {
+ return;
+ }
+ Process process = Runtime.getRuntime().exec(commandline);
+ process.waitFor();
+ }
+ catch (InterruptedException ie) {
+ throw new ProcessingException(ScoutTexts.get("Interrupted"), ie);
+ }
+ catch (Throwable t) {
+ throw new ProcessingException("Unexpected: " + path, t);
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/spellchecker/BundleResourceLocator.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/spellchecker/BundleResourceLocator.java
index 47fd8e4c0c..a2c0fe94bc 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/spellchecker/BundleResourceLocator.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/spellchecker/BundleResourceLocator.java
@@ -1,56 +1,56 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.spellchecker;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URL;
-
-import org.eclipse.scout.commons.IOUtility;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.services.common.file.IFileService;
-import org.eclipse.scout.service.SERVICES;
-import org.osgi.framework.Bundle;
-
-public class BundleResourceLocator implements IResourceLocator {
- private Bundle m_bundle;
- private String m_folder;
-
- /**
- * @param folder
- * for example /resources/spellchecker
- */
- public BundleResourceLocator(Bundle bundle, String folder) {
- m_bundle = bundle;
- m_folder = folder;
- }
-
- @Override
- public void initialize() throws ProcessingException {
- }
-
- @Override
- public File getFile(String name) throws ProcessingException {
- File f = SERVICES.getService(IFileService.class).getLocalFileLocation(m_folder, name);
- f.delete();
- URL url = m_bundle.getResource(m_folder + "/" + name);
- if (url != null) {
- try {
- IOUtility.writeContent(f.getAbsolutePath(), IOUtility.getContent(url.openStream()));
- }
- catch (IOException e) {
- throw new ProcessingException("reading bundle resource " + m_bundle.getSymbolicName() + ":" + m_folder + "/" + name);
- }
- }
- return f;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.spellchecker;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+
+import org.eclipse.scout.commons.IOUtility;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.services.common.file.IFileService;
+import org.eclipse.scout.service.SERVICES;
+import org.osgi.framework.Bundle;
+
+public class BundleResourceLocator implements IResourceLocator {
+ private Bundle m_bundle;
+ private String m_folder;
+
+ /**
+ * @param folder
+ * for example /resources/spellchecker
+ */
+ public BundleResourceLocator(Bundle bundle, String folder) {
+ m_bundle = bundle;
+ m_folder = folder;
+ }
+
+ @Override
+ public void initialize() throws ProcessingException {
+ }
+
+ @Override
+ public File getFile(String name) throws ProcessingException {
+ File f = SERVICES.getService(IFileService.class).getLocalFileLocation(m_folder, name);
+ f.delete();
+ URL url = m_bundle.getResource(m_folder + "/" + name);
+ if (url != null) {
+ try {
+ IOUtility.writeContent(f.getAbsolutePath(), IOUtility.getContent(url.openStream()));
+ }
+ catch (IOException e) {
+ throw new ProcessingException("reading bundle resource " + m_bundle.getSymbolicName() + ":" + m_folder + "/" + name);
+ }
+ }
+ return f;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/spellchecker/IResourceLocator.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/spellchecker/IResourceLocator.java
index ebbc1c6840..5e4a1baa3c 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/spellchecker/IResourceLocator.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/spellchecker/IResourceLocator.java
@@ -1,23 +1,23 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.spellchecker;
-
-import java.io.File;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-
-public interface IResourceLocator {
-
- void initialize() throws ProcessingException;
-
- File getFile(String name) throws ProcessingException;
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.spellchecker;
+
+import java.io.File;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+
+public interface IResourceLocator {
+
+ void initialize() throws ProcessingException;
+
+ File getFile(String name) throws ProcessingException;
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/spellchecker/ISpellCheckerService.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/spellchecker/ISpellCheckerService.java
index 87b6b735af..2168d2ce0d 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/spellchecker/ISpellCheckerService.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/spellchecker/ISpellCheckerService.java
@@ -1,300 +1,300 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.spellchecker;
-
-import java.util.List;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.service.IService;
-
-/**
- * SpellChecker Service looks expects a configuration.xml see
- * {@link ISpellCheckerService#initialize(String, IResourceLocator)} and {@link IResourceLocator} Sample
- * configuration.xml is: <xmp> <?xml
- * version="1.0" encoding="UTF-8"?> <spellchecker> <language id="any">
- * <dictionary>sc_dict_any_01.tlx</dictionary>
- * <dictionary>sc_dict_any_02.tlx</dictionary> <option
- * id="IGNORE_NON_ALPHA_WORD_OPT" >true</option> <option
- * id="REPORT_DOUBLED_WORD_OPT" >true</option> <option
- * id="SPLIT_HYPHENATED_WORDS_OPT">true</option> <option
- * id="REPORT_MIXED_CASE_OPT" >false</option> <!-- Setting to true can cause
- * performance problems --> </language> <language id="de_CH">
- * <dictionary>sc_dict_ge-ch_01.tlx</dictionary>
- * <dictionary>sc_dict_ge-ch_02.tlx</dictionary>
- * <dictionary>sc_dict_ge-de_03.clx</dictionary> <option
- * id="ALLOW_ACCENTED_CAPS_OPT">true</option> <option
- * id="SPLIT_CONTRACTED_WORDS_OPT">false</option> <option
- * id="STRIP_POSSESSIVES_OPT">true</option> <option
- * id="SPLIT_WORDS_OPT">true</option> </language> <language id="de_AT">
- * <dictionary>sc_dict_ge-at_01.tlx</dictionary>
- * <dictionary>sc_dict_ge-at_02.tlx</dictionary>
- * <dictionary>sc_dict_ge-de_03.clx</dictionary> <option
- * id="ALLOW_ACCENTED_CAPS_OPT">true</option> <option
- * id="SPLIT_CONTRACTED_WORDS_OPT" >false</option> <option
- * id="STRIP_POSSESSIVES_OPT" >true</option> <option id="SPLIT_WORDS_OPT"
- * >true</option> </language> </spellchecker> </xmp>
- */
-public interface ISpellCheckerService extends IService {
-
- /**
- * Initializes the spell checker and resets all settings.
- *
- * @param pathToUserDictionary
- * can be null to use the default path or non null (for example MS
- * Words user dictionary)
- */
- void initialize(String pathToUserDictionary) throws ProcessingException;
-
- /**
- * Initializes the spell checker and resets all settings.
- *
- * @param pathToUserDictionary
- * can be null to use the default path or non null (for example MS
- * Words user dictionary)
- * @param resourceLocator
- * used to get spellchecker files. Resources normally are part of a
- * plugin or are placed on the server via remote file service.
- * Passing null defaults to remote files with paths /spellchecker/*
- * see {@link RemoteFileResourceLocator} and {@link BundleResourceLocator}
- */
- void initialize(String pathToUserDictionary, IResourceLocator resourceLocator) throws ProcessingException;
-
- /**
- * Re initializes the spell checkers language profile without losing
- * previously set parameters
- */
- void reinitialize() throws ProcessingException;
-
- void switchLanguage(String locale) throws ProcessingException;
-
- void saveSettings();
-
- /**
- * Adds the given word to the temporary dictionary. Check-as-you-type fields
- * are automatically updated. Returns whether the word was successfully added.
- */
- boolean addWordToTempDictionary(String word);
-
- /**
- * Adds the given word to the user dictionary. Check-as-you-type fields are
- * automatically updated. Returns whether the word was successfully added.
- */
- boolean addWordToUserDictionary(String word);
-
- /**
- * Returns a list of language strings. see {@link #getLanguage()}
- */
- String[] getAvailableLanguages();
-
- /**
- * see {@link #getLanguage()}
- */
- boolean containsLanguage(String lang);
-
- /**
- * Returns the default for monitoring text areas. This is used if
- * check-as-you-type for multi-line text fields is set to application default
- * and if the programmer did not explicitly set the option for the field in
- * the Configurator.
- */
- boolean getDefaultForMonitoringTextAreas();
-
- void setDefaultForMonitoringTextAreas(boolean b);
-
- /**
- * Returns the default for monitoring text fields. This is used if
- * check-as-you-type for single-line text fields is set to application default
- * and if the programmer did not explicitly set the option for the field in
- * the Configurator.
- */
- boolean getDefaultForMonitoringTextFields();
-
- void setDefaultForMonitoringTextFields(boolean b);
-
- /**
- * @return locale of checking language as ;@link Locale#toString()} Examples:
- * de, de_CH, en, en_US
- */
- String getLanguage();
-
- /**
- * Returns a list of strings with correcting suggestions for the given word.
- */
- List<String> getSuggestions(String word, int maxNoSuggestions);
-
- void ignoreAll(String word);
-
- /**
- * Returns whether the spellchecker is initialized and enabled
- */
- boolean isInstalled();
-
- boolean isCorrectText(String text);
-
- boolean isCorrectWord(String word);
-
- /**
- * Returns whether the spell checker is enabled. Takes effect immediately, no
- * re-initialization needed.
- */
- boolean isEnabled();
-
- /**
- * Returns whether case is ignored.
- */
- boolean isIgnoreCase();
-
- /**
- * Returns whether domain names are ignored.
- */
- boolean isIgnoreDomainNames();
-
- /**
- * Returns whether words with numbers are ignored.
- */
- boolean isIgnoreWordsWithNumbers();
-
- /**
- * Returns whether the spell checker is initialized
- */
- boolean isInitialized();
-
- boolean isInUserDictionary(String word, boolean caseSensitive);
-
- /**
- * Returns whether multi-line text fields are monitored ("check as you type").
- * null = Application default true = Always check as you type, ignore
- * field-specific settings false = Never check as you type, ignore
- * field-specific settings
- */
- Boolean isMonitoringTextAreas();
-
- /**
- * Returns whether single-line text fields are monitored
- * ("check as you type"). null = Application default true = Always check as
- * you type, ignore field-specific settings false = Never check as you type,
- * ignore field-specific settings
- */
- Boolean isMonitoringTextFields();
-
- /**
- * Returns whether hyphenated words (e.g. bright-blue) are split and checked
- * separately.
- */
- boolean isSplittingHyphenatedWords();
-
- /**
- * Returns whether words are split and checked separately (e.g.
- * 'Zusammenführen' -> 'Zusammen' and 'führen').
- */
- boolean isSplittingWords();
-
- /**
- * Returns whether possessives of the form 's and s' are removed from words
- * before checking their spelling.
- */
- boolean isStrippingPossessives();
-
- /**
- * Resets all settings. Needs re-initialization to take effect.
- */
- void dispose();
-
- /**
- * Removes the given word from the user dictionary. Returns true if the word
- * was successfully removed.
- */
- boolean removeWordFromUserDictionary(String word);
-
- /**
- * Sets whether the spell checker is enabled. Takes effect immediately, no
- * re-initialization needed.
- */
- void setEnabled(boolean enabled);
-
- /**
- * Sets whether to ignore case. Takes effect immediately, no re-initialization
- * needed.
- */
- void setIgnoreCase(boolean ignoreCase);
-
- /**
- * Sets whether to ignore domain names. Takes effect immediately, no
- * re-initialization needed.
- */
- void setIgnoreDomainNames(boolean ignoreDomainNames);
-
- /**
- * Sets whether to ignore words with numbers. Takes effect immediately, no
- * re-initialization needed.
- */
- void setIgnoreWordsWithNumbers(boolean ignoreWordsWithNumbers);
-
- /**
- * Sets the language. Needs re-initialization to take effect.
- */
- void setLanguage(String language);
-
- void setMonitorTextAreas(Boolean monitorTextAreas);
-
- void setMonitorTextFields(Boolean monitorTextFields);
-
- /**
- * Sets the precision of the spelling session. The parameter can range from 1
- * (shallow but fast) to 100 (deep but slow). Takes effect immediately, no
- * re-initialization needed.
- */
- void setPrecision(int precision);
-
- /**
- * Sets the user dictionary. Needs re-initialization to take effect.
- */
- void setUserDictionary(String userDictionary);
-
- /**
- * Must be called in scout model thread.
- */
- void showOptionsDialog();
-
- /**
- * Must be called in scout model thread.
- */
- void showCompleteDialog();
-
- /**
- * Must be called in scout model thread.
- */
- boolean showCompleteForSelectionDialog();
-
- ISpellingMonitor[] getAllSpellingMonitors();
-
- IUserDictionary getUserDictionary();
-
- /**
- * validate the whole text of all monitored text components.
- */
- void validateAllSpellingMonitors();
-
- /**
- * Rechecks the given word in all monitored text components.
- */
- void validateAllSpellingMonitors(String word);
-
- /**
- * Normally this method is not invoked by clients This method is thread-safe.
- */
- void addSpellingMonitor(ISpellingMonitor m);
-
- /**
- * Normally this method is not invoked by clients This method is thread-safe.
- */
- void removeSpellingMonitor(ISpellingMonitor m);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.spellchecker;
+
+import java.util.List;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.service.IService;
+
+/**
+ * SpellChecker Service looks expects a configuration.xml see
+ * {@link ISpellCheckerService#initialize(String, IResourceLocator)} and {@link IResourceLocator} Sample
+ * configuration.xml is: <xmp> <?xml
+ * version="1.0" encoding="UTF-8"?> <spellchecker> <language id="any">
+ * <dictionary>sc_dict_any_01.tlx</dictionary>
+ * <dictionary>sc_dict_any_02.tlx</dictionary> <option
+ * id="IGNORE_NON_ALPHA_WORD_OPT" >true</option> <option
+ * id="REPORT_DOUBLED_WORD_OPT" >true</option> <option
+ * id="SPLIT_HYPHENATED_WORDS_OPT">true</option> <option
+ * id="REPORT_MIXED_CASE_OPT" >false</option> <!-- Setting to true can cause
+ * performance problems --> </language> <language id="de_CH">
+ * <dictionary>sc_dict_ge-ch_01.tlx</dictionary>
+ * <dictionary>sc_dict_ge-ch_02.tlx</dictionary>
+ * <dictionary>sc_dict_ge-de_03.clx</dictionary> <option
+ * id="ALLOW_ACCENTED_CAPS_OPT">true</option> <option
+ * id="SPLIT_CONTRACTED_WORDS_OPT">false</option> <option
+ * id="STRIP_POSSESSIVES_OPT">true</option> <option
+ * id="SPLIT_WORDS_OPT">true</option> </language> <language id="de_AT">
+ * <dictionary>sc_dict_ge-at_01.tlx</dictionary>
+ * <dictionary>sc_dict_ge-at_02.tlx</dictionary>
+ * <dictionary>sc_dict_ge-de_03.clx</dictionary> <option
+ * id="ALLOW_ACCENTED_CAPS_OPT">true</option> <option
+ * id="SPLIT_CONTRACTED_WORDS_OPT" >false</option> <option
+ * id="STRIP_POSSESSIVES_OPT" >true</option> <option id="SPLIT_WORDS_OPT"
+ * >true</option> </language> </spellchecker> </xmp>
+ */
+public interface ISpellCheckerService extends IService {
+
+ /**
+ * Initializes the spell checker and resets all settings.
+ *
+ * @param pathToUserDictionary
+ * can be null to use the default path or non null (for example MS
+ * Words user dictionary)
+ */
+ void initialize(String pathToUserDictionary) throws ProcessingException;
+
+ /**
+ * Initializes the spell checker and resets all settings.
+ *
+ * @param pathToUserDictionary
+ * can be null to use the default path or non null (for example MS
+ * Words user dictionary)
+ * @param resourceLocator
+ * used to get spellchecker files. Resources normally are part of a
+ * plugin or are placed on the server via remote file service.
+ * Passing null defaults to remote files with paths /spellchecker/*
+ * see {@link RemoteFileResourceLocator} and {@link BundleResourceLocator}
+ */
+ void initialize(String pathToUserDictionary, IResourceLocator resourceLocator) throws ProcessingException;
+
+ /**
+ * Re initializes the spell checkers language profile without losing
+ * previously set parameters
+ */
+ void reinitialize() throws ProcessingException;
+
+ void switchLanguage(String locale) throws ProcessingException;
+
+ void saveSettings();
+
+ /**
+ * Adds the given word to the temporary dictionary. Check-as-you-type fields
+ * are automatically updated. Returns whether the word was successfully added.
+ */
+ boolean addWordToTempDictionary(String word);
+
+ /**
+ * Adds the given word to the user dictionary. Check-as-you-type fields are
+ * automatically updated. Returns whether the word was successfully added.
+ */
+ boolean addWordToUserDictionary(String word);
+
+ /**
+ * Returns a list of language strings. see {@link #getLanguage()}
+ */
+ String[] getAvailableLanguages();
+
+ /**
+ * see {@link #getLanguage()}
+ */
+ boolean containsLanguage(String lang);
+
+ /**
+ * Returns the default for monitoring text areas. This is used if
+ * check-as-you-type for multi-line text fields is set to application default
+ * and if the programmer did not explicitly set the option for the field in
+ * the Configurator.
+ */
+ boolean getDefaultForMonitoringTextAreas();
+
+ void setDefaultForMonitoringTextAreas(boolean b);
+
+ /**
+ * Returns the default for monitoring text fields. This is used if
+ * check-as-you-type for single-line text fields is set to application default
+ * and if the programmer did not explicitly set the option for the field in
+ * the Configurator.
+ */
+ boolean getDefaultForMonitoringTextFields();
+
+ void setDefaultForMonitoringTextFields(boolean b);
+
+ /**
+ * @return locale of checking language as ;@link Locale#toString()} Examples:
+ * de, de_CH, en, en_US
+ */
+ String getLanguage();
+
+ /**
+ * Returns a list of strings with correcting suggestions for the given word.
+ */
+ List<String> getSuggestions(String word, int maxNoSuggestions);
+
+ void ignoreAll(String word);
+
+ /**
+ * Returns whether the spellchecker is initialized and enabled
+ */
+ boolean isInstalled();
+
+ boolean isCorrectText(String text);
+
+ boolean isCorrectWord(String word);
+
+ /**
+ * Returns whether the spell checker is enabled. Takes effect immediately, no
+ * re-initialization needed.
+ */
+ boolean isEnabled();
+
+ /**
+ * Returns whether case is ignored.
+ */
+ boolean isIgnoreCase();
+
+ /**
+ * Returns whether domain names are ignored.
+ */
+ boolean isIgnoreDomainNames();
+
+ /**
+ * Returns whether words with numbers are ignored.
+ */
+ boolean isIgnoreWordsWithNumbers();
+
+ /**
+ * Returns whether the spell checker is initialized
+ */
+ boolean isInitialized();
+
+ boolean isInUserDictionary(String word, boolean caseSensitive);
+
+ /**
+ * Returns whether multi-line text fields are monitored ("check as you type").
+ * null = Application default true = Always check as you type, ignore
+ * field-specific settings false = Never check as you type, ignore
+ * field-specific settings
+ */
+ Boolean isMonitoringTextAreas();
+
+ /**
+ * Returns whether single-line text fields are monitored
+ * ("check as you type"). null = Application default true = Always check as
+ * you type, ignore field-specific settings false = Never check as you type,
+ * ignore field-specific settings
+ */
+ Boolean isMonitoringTextFields();
+
+ /**
+ * Returns whether hyphenated words (e.g. bright-blue) are split and checked
+ * separately.
+ */
+ boolean isSplittingHyphenatedWords();
+
+ /**
+ * Returns whether words are split and checked separately (e.g.
+ * 'Zusammenführen' -> 'Zusammen' and 'führen').
+ */
+ boolean isSplittingWords();
+
+ /**
+ * Returns whether possessives of the form 's and s' are removed from words
+ * before checking their spelling.
+ */
+ boolean isStrippingPossessives();
+
+ /**
+ * Resets all settings. Needs re-initialization to take effect.
+ */
+ void dispose();
+
+ /**
+ * Removes the given word from the user dictionary. Returns true if the word
+ * was successfully removed.
+ */
+ boolean removeWordFromUserDictionary(String word);
+
+ /**
+ * Sets whether the spell checker is enabled. Takes effect immediately, no
+ * re-initialization needed.
+ */
+ void setEnabled(boolean enabled);
+
+ /**
+ * Sets whether to ignore case. Takes effect immediately, no re-initialization
+ * needed.
+ */
+ void setIgnoreCase(boolean ignoreCase);
+
+ /**
+ * Sets whether to ignore domain names. Takes effect immediately, no
+ * re-initialization needed.
+ */
+ void setIgnoreDomainNames(boolean ignoreDomainNames);
+
+ /**
+ * Sets whether to ignore words with numbers. Takes effect immediately, no
+ * re-initialization needed.
+ */
+ void setIgnoreWordsWithNumbers(boolean ignoreWordsWithNumbers);
+
+ /**
+ * Sets the language. Needs re-initialization to take effect.
+ */
+ void setLanguage(String language);
+
+ void setMonitorTextAreas(Boolean monitorTextAreas);
+
+ void setMonitorTextFields(Boolean monitorTextFields);
+
+ /**
+ * Sets the precision of the spelling session. The parameter can range from 1
+ * (shallow but fast) to 100 (deep but slow). Takes effect immediately, no
+ * re-initialization needed.
+ */
+ void setPrecision(int precision);
+
+ /**
+ * Sets the user dictionary. Needs re-initialization to take effect.
+ */
+ void setUserDictionary(String userDictionary);
+
+ /**
+ * Must be called in scout model thread.
+ */
+ void showOptionsDialog();
+
+ /**
+ * Must be called in scout model thread.
+ */
+ void showCompleteDialog();
+
+ /**
+ * Must be called in scout model thread.
+ */
+ boolean showCompleteForSelectionDialog();
+
+ ISpellingMonitor[] getAllSpellingMonitors();
+
+ IUserDictionary getUserDictionary();
+
+ /**
+ * validate the whole text of all monitored text components.
+ */
+ void validateAllSpellingMonitors();
+
+ /**
+ * Rechecks the given word in all monitored text components.
+ */
+ void validateAllSpellingMonitors(String word);
+
+ /**
+ * Normally this method is not invoked by clients This method is thread-safe.
+ */
+ void addSpellingMonitor(ISpellingMonitor m);
+
+ /**
+ * Normally this method is not invoked by clients This method is thread-safe.
+ */
+ void removeSpellingMonitor(ISpellingMonitor m);
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/spellchecker/ISpellingMonitor.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/spellchecker/ISpellingMonitor.java
index 209a1a1475..d8bbd3dd58 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/spellchecker/ISpellingMonitor.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/spellchecker/ISpellingMonitor.java
@@ -1,37 +1,37 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.spellchecker;
-
-/**
- * This class is Thread-safe
- */
-public interface ISpellingMonitor {
-
- void validate();
-
- void validate(String word);
-
- /**
- * to activate the monitor on the associated UI widget.
- */
- void activate();
-
- /**
- * to deactivate the monitor on the associated UI widget. Unlike {@link #dispose() dispose} the monitor is not
- * shutdown but still associated with the widget.
- */
- void deactivate();
-
- /**
- * to shutdown the monitor on the associated UI widget.
- */
- void dispose();
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.spellchecker;
+
+/**
+ * This class is Thread-safe
+ */
+public interface ISpellingMonitor {
+
+ void validate();
+
+ void validate(String word);
+
+ /**
+ * to activate the monitor on the associated UI widget.
+ */
+ void activate();
+
+ /**
+ * to deactivate the monitor on the associated UI widget. Unlike {@link #dispose() dispose} the monitor is not
+ * shutdown but still associated with the widget.
+ */
+ void deactivate();
+
+ /**
+ * to shutdown the monitor on the associated UI widget.
+ */
+ void dispose();
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/spellchecker/IUserDictionary.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/spellchecker/IUserDictionary.java
index ef3eb8d75a..97473e5d32 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/spellchecker/IUserDictionary.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/spellchecker/IUserDictionary.java
@@ -1,24 +1,24 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.spellchecker;
-
-import java.util.Enumeration;
-
-public interface IUserDictionary {
-
- void addWord(String word);
-
- void deleteWord(String word);
-
- Enumeration words();
-
- void clear();
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.spellchecker;
+
+import java.util.Enumeration;
+
+public interface IUserDictionary {
+
+ void addWord(String word);
+
+ void deleteWord(String word);
+
+ Enumeration words();
+
+ void clear();
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/spellchecker/RemoteFileResourceLocator.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/spellchecker/RemoteFileResourceLocator.java
index 308b4c3485..39c06f86e7 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/spellchecker/RemoteFileResourceLocator.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/spellchecker/RemoteFileResourceLocator.java
@@ -1,36 +1,36 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.spellchecker;
-
-import java.io.File;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.services.common.file.IFileService;
-import org.eclipse.scout.service.SERVICES;
-
-public class RemoteFileResourceLocator implements IResourceLocator {
- private String m_remoteFolder;
-
- public RemoteFileResourceLocator(String remoteFolder) {
- m_remoteFolder = remoteFolder;
- }
-
- @Override
- public void initialize() throws ProcessingException {
- SERVICES.getService(IFileService.class).syncRemoteFiles(m_remoteFolder, null);
- }
-
- @Override
- public File getFile(String name) throws ProcessingException {
- return SERVICES.getService(IFileService.class).getRemoteFile(m_remoteFolder, name, null, false);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.spellchecker;
+
+import java.io.File;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.services.common.file.IFileService;
+import org.eclipse.scout.service.SERVICES;
+
+public class RemoteFileResourceLocator implements IResourceLocator {
+ private String m_remoteFolder;
+
+ public RemoteFileResourceLocator(String remoteFolder) {
+ m_remoteFolder = remoteFolder;
+ }
+
+ @Override
+ public void initialize() throws ProcessingException {
+ SERVICES.getService(IFileService.class).syncRemoteFiles(m_remoteFolder, null);
+ }
+
+ @Override
+ public File getFile(String name) throws ProcessingException {
+ return SERVICES.getService(IFileService.class).getRemoteFile(m_remoteFolder, name, null, false);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/spellchecker/forms/SpellCheckerLanguageLookupCall.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/spellchecker/forms/SpellCheckerLanguageLookupCall.java
index 7e2921a7cf..6f911ebef9 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/spellchecker/forms/SpellCheckerLanguageLookupCall.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/spellchecker/forms/SpellCheckerLanguageLookupCall.java
@@ -1,52 +1,52 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.spellchecker.forms;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Locale;
-import java.util.TreeMap;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.nls.NlsUtility;
-import org.eclipse.scout.rt.client.services.common.spellchecker.ISpellCheckerService;
-import org.eclipse.scout.rt.shared.services.lookup.LocalLookupCall;
-import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
-import org.eclipse.scout.service.SERVICES;
-
-public class SpellCheckerLanguageLookupCall extends LocalLookupCall {
-
- private static final long serialVersionUID = 1L;
-
- @Override
- protected List<LookupRow> execCreateLookupRows() throws ProcessingException {
- TreeMap<String, LookupRow> sortMap = new TreeMap<String, LookupRow>();
- ISpellCheckerService sc = SERVICES.getService(ISpellCheckerService.class);
- if (sc != null) {
- for (String lang : sc.getAvailableLanguages()) {
- Locale loc = NlsUtility.parseLocale(lang);
- sortMap.put(lang, new LookupRow(lang, loc.getDisplayLanguage() + " (" + loc.getDisplayCountry() + ")"));
- }
- }
- return new ArrayList<LookupRow>(sortMap.values());
- }
-
- @Override
- public boolean equals(Object obj) {
- return super.equals(obj);
- }
-
- @Override
- public int hashCode() {
- return super.hashCode();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.spellchecker.forms;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+import java.util.TreeMap;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.nls.NlsUtility;
+import org.eclipse.scout.rt.client.services.common.spellchecker.ISpellCheckerService;
+import org.eclipse.scout.rt.shared.services.lookup.LocalLookupCall;
+import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
+import org.eclipse.scout.service.SERVICES;
+
+public class SpellCheckerLanguageLookupCall extends LocalLookupCall {
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ protected List<LookupRow> execCreateLookupRows() throws ProcessingException {
+ TreeMap<String, LookupRow> sortMap = new TreeMap<String, LookupRow>();
+ ISpellCheckerService sc = SERVICES.getService(ISpellCheckerService.class);
+ if (sc != null) {
+ for (String lang : sc.getAvailableLanguages()) {
+ Locale loc = NlsUtility.parseLocale(lang);
+ sortMap.put(lang, new LookupRow(lang, loc.getDisplayLanguage() + " (" + loc.getDisplayCountry() + ")"));
+ }
+ }
+ return new ArrayList<LookupRow>(sortMap.values());
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ return super.equals(obj);
+ }
+
+ @Override
+ public int hashCode() {
+ return super.hashCode();
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/spellchecker/forms/SpellCheckerOptionsForm.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/spellchecker/forms/SpellCheckerOptionsForm.java
index 667939dea1..f2658956af 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/spellchecker/forms/SpellCheckerOptionsForm.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/spellchecker/forms/SpellCheckerOptionsForm.java
@@ -1,488 +1,488 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.spellchecker.forms;
-
-import java.util.Enumeration;
-
-import org.eclipse.scout.commons.LocaleThreadLocal;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.services.common.spellchecker.ISpellCheckerService;
-import org.eclipse.scout.rt.client.services.common.spellchecker.IUserDictionary;
-import org.eclipse.scout.rt.client.services.common.spellchecker.forms.SpellCheckerOptionsForm.MainBox.CancelButton;
-import org.eclipse.scout.rt.client.services.common.spellchecker.forms.SpellCheckerOptionsForm.MainBox.GeneralSettingsBox;
-import org.eclipse.scout.rt.client.services.common.spellchecker.forms.SpellCheckerOptionsForm.MainBox.GeneralSettingsBox.EnabledField;
-import org.eclipse.scout.rt.client.services.common.spellchecker.forms.SpellCheckerOptionsForm.MainBox.GeneralSettingsBox.IgnoreCaseField;
-import org.eclipse.scout.rt.client.services.common.spellchecker.forms.SpellCheckerOptionsForm.MainBox.GeneralSettingsBox.IgnoreDomainNamesField;
-import org.eclipse.scout.rt.client.services.common.spellchecker.forms.SpellCheckerOptionsForm.MainBox.GeneralSettingsBox.IgnoreWordsWithNumbersField;
-import org.eclipse.scout.rt.client.services.common.spellchecker.forms.SpellCheckerOptionsForm.MainBox.GeneralSettingsBox.LanguageField;
-import org.eclipse.scout.rt.client.services.common.spellchecker.forms.SpellCheckerOptionsForm.MainBox.GeneralSettingsBox.ShortcutField;
-import org.eclipse.scout.rt.client.services.common.spellchecker.forms.SpellCheckerOptionsForm.MainBox.OkButton;
-import org.eclipse.scout.rt.client.services.common.spellchecker.forms.SpellCheckerOptionsForm.MainBox.ResetToStandardButton;
-import org.eclipse.scout.rt.client.services.common.spellchecker.forms.SpellCheckerOptionsForm.MainBox.UserDictionaryBox;
-import org.eclipse.scout.rt.client.services.common.spellchecker.forms.SpellCheckerOptionsForm.MainBox.UserDictionaryBox.EditorSequenceBox;
-import org.eclipse.scout.rt.client.services.common.spellchecker.forms.SpellCheckerOptionsForm.MainBox.UserDictionaryBox.EditorSequenceBox.EditorButton;
-import org.eclipse.scout.rt.client.services.common.spellchecker.forms.SpellCheckerOptionsForm.MainBox.UserDictionaryBox.EditorSequenceBox.EditorField;
-import org.eclipse.scout.rt.client.services.common.spellchecker.forms.SpellCheckerOptionsForm.MainBox.UserDictionaryBox.UserDictionaryTableField;
-import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
-import org.eclipse.scout.rt.client.ui.basic.table.AbstractTable;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractStringColumn;
-import org.eclipse.scout.rt.client.ui.form.AbstractForm;
-import org.eclipse.scout.rt.client.ui.form.AbstractFormHandler;
-import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractButton;
-import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractCancelButton;
-import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractOkButton;
-import org.eclipse.scout.rt.client.ui.form.fields.checkbox.AbstractCheckBox;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
-import org.eclipse.scout.rt.client.ui.form.fields.sequencebox.AbstractSequenceBox;
-import org.eclipse.scout.rt.client.ui.form.fields.smartfield.AbstractSmartField;
-import org.eclipse.scout.rt.client.ui.form.fields.stringfield.AbstractStringField;
-import org.eclipse.scout.rt.client.ui.form.fields.tablefield.AbstractTableField;
-import org.eclipse.scout.rt.client.ui.messagebox.MessageBox;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
-import org.eclipse.scout.service.SERVICES;
-
-public class SpellCheckerOptionsForm extends AbstractForm {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(SpellCheckerOptionsForm.class);
-
- public SpellCheckerOptionsForm() throws ProcessingException {
- super();
- }
-
- @Override
- protected String getConfiguredTitle() {
- return ScoutTexts.get("SC_DialogTitle_Options");
- }
-
- public MainBox getMainBox() {
- return (MainBox) getRootGroupBox();
- }
-
- public GeneralSettingsBox getGeneralSettingsBox() {
- return getFieldByClass(GeneralSettingsBox.class);
- }
-
- public UserDictionaryBox getUserDictionaryBox() {
- return getFieldByClass(UserDictionaryBox.class);
- }
-
- public EnabledField getEnabledField() {
- return getFieldByClass(EnabledField.class);
- }
-
- public ShortcutField getShortcutField() {
- return getFieldByClass(ShortcutField.class);
- }
-
- public LanguageField getLanguageField() {
- return getFieldByClass(LanguageField.class);
- }
-
- public IgnoreCaseField getIgnoreCaseField() {
- return getFieldByClass(IgnoreCaseField.class);
- }
-
- public IgnoreDomainNamesField getIgnoreDomainNamesField() {
- return getFieldByClass(IgnoreDomainNamesField.class);
- }
-
- public IgnoreWordsWithNumbersField getIgnoreWordsWithNumbersField() {
- return getFieldByClass(IgnoreWordsWithNumbersField.class);
- }
-
- public UserDictionaryTableField getUserDictionaryTableField() {
- return getFieldByClass(UserDictionaryTableField.class);
- }
-
- public EditorSequenceBox getEditorSequenceBox() {
- return getFieldByClass(EditorSequenceBox.class);
- }
-
- public EditorField getEditorField() {
- return getFieldByClass(EditorField.class);
- }
-
- public EditorButton getEditorButton() {
- return getFieldByClass(EditorButton.class);
- }
-
- public ResetToStandardButton getResetToStandardButton() {
- return getFieldByClass(ResetToStandardButton.class);
- }
-
- public OkButton getOkButton() {
- return getFieldByClass(OkButton.class);
- }
-
- public CancelButton getCancelButton() {
- return getFieldByClass(CancelButton.class);
- }
-
- public void startModify() throws ProcessingException {
- startInternal(new ModifyHandler());
- }
-
- @Order(10)
- public class MainBox extends AbstractGroupBox {
-
- @Override
- protected int getConfiguredGridColumnCount() {
- return 1;
- }
-
- @Order(10)
- public class GeneralSettingsBox extends AbstractGroupBox {
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("SC_Label_Main");
- }
-
- @Order(10)
- public class EnabledField extends AbstractCheckBox {
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("SC_Label_Enable");
- }
-
- @Override
- protected String getConfiguredTooltipText() {
- return ScoutTexts.get("SC_Help_Enable");
- }
-
- @Override
- protected void execChangedValue() throws ProcessingException {
- boolean on = getValue();
- getShortcutField().setEnabled(on);
- getLanguageField().setEnabled(on);
- getIgnoreCaseField().setEnabled(on);
- getIgnoreDomainNamesField().setEnabled(on);
- getIgnoreWordsWithNumbersField().setEnabled(on);
- }
- }
-
- @Order(20)
- public class ShortcutField extends AbstractSmartField<String> {
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("SC_Label_Shortcut");
- }
-
- @Override
- protected String getConfiguredTooltipText() {
- return ScoutTexts.get("SC_Help_Shortcut");
- }
-
- @Override
- protected Class<? extends LookupCall> getConfiguredLookupCall() {
- return SpellCheckerShortcutLookupCall.class;
- }
-
- }
-
- @Order(30)
- public class LanguageField extends AbstractSmartField<String> {
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("SC_Language");
- }
-
- @Override
- protected String getConfiguredTooltipText() {
- return ScoutTexts.get("SC_Help_Language");
- }
-
- @Override
- protected Class<? extends LookupCall> getConfiguredLookupCall() {
- return SpellCheckerLanguageLookupCall.class;
- }
-
- }
-
- @Order(40)
- public class IgnoreCaseField extends AbstractCheckBox {
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("SC_Label_IgnoreCase");
- }
-
- @Override
- protected String getConfiguredTooltipText() {
- return ScoutTexts.get("SC_Help_IgnoreCase");
- }
-
- }
-
- @Order(50)
- public class IgnoreDomainNamesField extends AbstractCheckBox {
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("SC_Label_IgnoreDomainNames");
- }
-
- @Override
- protected String getConfiguredTooltipText() {
- return ScoutTexts.get("SC_Help_IgnoreDomainNames");
- }
-
- }
-
- @Order(60)
- public class IgnoreWordsWithNumbersField extends AbstractCheckBox {
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("SC_Label_IgnoreWordsWithNumbers");
- }
-
- @Override
- protected String getConfiguredTooltipText() {
- return ScoutTexts.get("SC_Help_IgnoreWordsWithNumbers");
- }
-
- }
-
- }
-
- @Order(20)
- public class UserDictionaryBox extends AbstractGroupBox {
-
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("SC_Label_UserDictionary");
- }
-
- @Override
- protected String getConfiguredTooltipText() {
- return ScoutTexts.get("SC_Help_UserDictionary");
- }
-
- @Order(10)
- public class EditorSequenceBox extends AbstractSequenceBox {
- @Override
- protected boolean getConfiguredLabelVisible() {
- return false;
- }
-
- @Order(10)
- public class EditorField extends AbstractStringField {
- @Override
- public boolean isSpellCheckEnabled() {
- return false;
- }
- }
-
- @Order(20)
- public class EditorButton extends AbstractButton {
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("SC_Label_AddToDictionary");
- }
-
- @Override
- protected String getConfiguredTooltipText() {
- return ScoutTexts.get("SC_Help_AddToDictionary");
- }
-
- @Override
- protected void execClickAction() throws ProcessingException {
- String word = getEditorField().getValue();
- if (word != null) {
- if (!getUserDictionaryTableField().getTable().getWordColumn().contains(word)) {
- getUserDictionaryTableField().getTable().addRowByArray(new Object[]{word});
- }
- getEditorField().setValue(null);
- }
- }
- }
- }
-
- @Order(20)
- public class UserDictionaryTableField extends AbstractTableField<UserDictionaryTableField.Table> {
-
- @Override
- protected boolean getConfiguredLabelVisible() {
- return false;
- }
-
- @Override
- protected int getConfiguredGridH() {
- return 10;
- }
-
- @Order(10)
- public class Table extends AbstractTable {
- @Override
- protected boolean getConfiguredAutoResizeColumns() {
- return true;
- }
-
- public WordColumn getWordColumn() {
- return getColumnSet().getColumnByClass(WordColumn.class);
- }
-
- @Override
- protected void execRowsSelected(ITableRow[] rows) throws ProcessingException {
- if (rows.length > 0) {
- getEditorField().setValue(getWordColumn().getSelectedValue());
- }
- }
-
- @Order(10)
- public class WordColumn extends AbstractStringColumn {
- @Override
- protected boolean getConfiguredPrimaryKey() {
- return true;
- }
-
- @Override
- protected String getConfiguredHeaderText() {
- return ScoutTexts.get("SC_Label_IgnoredWord");
- }
- }
-
- @Order(20)
- public class RemoveWordMenu extends AbstractMenu {
- @Override
- protected String getConfiguredText() {
- return ScoutTexts.get("SC_Label_RemoveWord");
- }
-
- @Override
- protected String getConfiguredTooltipText() {
- return ScoutTexts.get("SC_Help_RemoveWord");
- }
-
- @Override
- protected boolean getConfiguredSingleSelectionAction() {
- return true;
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- if (MessageBox.showDeleteConfirmationMessage(getWordColumn().getSelectedDisplayText())) {
- deleteRow(getSelectedRow());
- }
- }
- }
-
- }
-
- }
-
- }
-
- @Order(50)
- public class ResetToStandardButton extends AbstractButton {
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("SC_Label_UseDefaults");
- }
-
- @Override
- protected String getConfiguredTooltipText() {
- return ScoutTexts.get("SC_Help_UseDefaults");
- }
-
- @Override
- protected void execClickAction() throws ProcessingException {
- getEnabledField().setValue(true);
- getShortcutField().setValue("f7");
- getLanguageField().setValue(LocaleThreadLocal.get().toString());
- getIgnoreCaseField().setValue(false);
- getIgnoreDomainNamesField().setValue(true);
- getIgnoreWordsWithNumbersField().setValue(true);
- }
- }
-
- @Order(60)
- public class OkButton extends AbstractOkButton {
- }
-
- @Order(70)
- public class CancelButton extends AbstractCancelButton {
- }
- }
-
- public class ModifyHandler extends AbstractFormHandler {
- @Override
- protected void execLoad() throws ProcessingException {
- getShortcutField().setEnabledGranted(false);
- //
- ISpellCheckerService sc = SERVICES.getService(ISpellCheckerService.class);
- getEnabledField().setValue(sc.isEnabled());
- getShortcutField().setValue("f7");
- getLanguageField().setValue(sc.getLanguage());
- getIgnoreCaseField().setValue(sc.isIgnoreCase());
- getIgnoreDomainNamesField().setValue(sc.isIgnoreDomainNames());
- getIgnoreWordsWithNumbersField().setValue(sc.isIgnoreWordsWithNumbers());
- // user dict
- UserDictionaryTableField.Table table = getUserDictionaryTableField().getTable();
- try {
- table.setTableChanging(true);
- //
- IUserDictionary dict = sc.getUserDictionary();
- // force dict reload
- try {
- dict.addWord("ReloadDictionaryTag");
- dict.deleteWord("ReloadDictionaryTag");
- }
- catch (Exception e) {
- // nop
- }
- Enumeration en = dict.words();
- while (en.hasMoreElements()) {
- String s = (String) en.nextElement();
- if (s != null && s.length() > 0) {
- table.addRowByArray(new Object[]{s});
- }
- }
- }
- finally {
- table.setTableChanging(false);
- }
- }
-
- @Override
- protected void execStore() throws ProcessingException {
- ISpellCheckerService sc = SERVICES.getService(ISpellCheckerService.class);
- boolean reinitNeeded = false;
- if (getUserDictionaryTableField().isSaveNeeded()) {
- reinitNeeded = true;
- UserDictionaryTableField.Table table = getUserDictionaryTableField().getTable();
- try {
- IUserDictionary dict = sc.getUserDictionary();
- dict.clear();
- for (String word : table.getWordColumn().getValues()) {
- dict.addWord(word);
- }
- }
- catch (Exception e) {
- LOG.warn(null, e);
- }
- }
- if (getGeneralSettingsBox().isSaveNeeded()) {
- reinitNeeded = true;
- sc.setEnabled(getEnabledField().getValue());
- sc.setLanguage(getLanguageField().getValue());
- sc.setIgnoreCase(getIgnoreCaseField().getValue());
- sc.setIgnoreDomainNames(getIgnoreDomainNamesField().getValue());
- sc.setIgnoreWordsWithNumbers(getIgnoreWordsWithNumbersField().getValue());
- }
- if (reinitNeeded) {
- sc.saveSettings();
- sc.reinitialize();
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.spellchecker.forms;
+
+import java.util.Enumeration;
+
+import org.eclipse.scout.commons.LocaleThreadLocal;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.services.common.spellchecker.ISpellCheckerService;
+import org.eclipse.scout.rt.client.services.common.spellchecker.IUserDictionary;
+import org.eclipse.scout.rt.client.services.common.spellchecker.forms.SpellCheckerOptionsForm.MainBox.CancelButton;
+import org.eclipse.scout.rt.client.services.common.spellchecker.forms.SpellCheckerOptionsForm.MainBox.GeneralSettingsBox;
+import org.eclipse.scout.rt.client.services.common.spellchecker.forms.SpellCheckerOptionsForm.MainBox.GeneralSettingsBox.EnabledField;
+import org.eclipse.scout.rt.client.services.common.spellchecker.forms.SpellCheckerOptionsForm.MainBox.GeneralSettingsBox.IgnoreCaseField;
+import org.eclipse.scout.rt.client.services.common.spellchecker.forms.SpellCheckerOptionsForm.MainBox.GeneralSettingsBox.IgnoreDomainNamesField;
+import org.eclipse.scout.rt.client.services.common.spellchecker.forms.SpellCheckerOptionsForm.MainBox.GeneralSettingsBox.IgnoreWordsWithNumbersField;
+import org.eclipse.scout.rt.client.services.common.spellchecker.forms.SpellCheckerOptionsForm.MainBox.GeneralSettingsBox.LanguageField;
+import org.eclipse.scout.rt.client.services.common.spellchecker.forms.SpellCheckerOptionsForm.MainBox.GeneralSettingsBox.ShortcutField;
+import org.eclipse.scout.rt.client.services.common.spellchecker.forms.SpellCheckerOptionsForm.MainBox.OkButton;
+import org.eclipse.scout.rt.client.services.common.spellchecker.forms.SpellCheckerOptionsForm.MainBox.ResetToStandardButton;
+import org.eclipse.scout.rt.client.services.common.spellchecker.forms.SpellCheckerOptionsForm.MainBox.UserDictionaryBox;
+import org.eclipse.scout.rt.client.services.common.spellchecker.forms.SpellCheckerOptionsForm.MainBox.UserDictionaryBox.EditorSequenceBox;
+import org.eclipse.scout.rt.client.services.common.spellchecker.forms.SpellCheckerOptionsForm.MainBox.UserDictionaryBox.EditorSequenceBox.EditorButton;
+import org.eclipse.scout.rt.client.services.common.spellchecker.forms.SpellCheckerOptionsForm.MainBox.UserDictionaryBox.EditorSequenceBox.EditorField;
+import org.eclipse.scout.rt.client.services.common.spellchecker.forms.SpellCheckerOptionsForm.MainBox.UserDictionaryBox.UserDictionaryTableField;
+import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
+import org.eclipse.scout.rt.client.ui.basic.table.AbstractTable;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractStringColumn;
+import org.eclipse.scout.rt.client.ui.form.AbstractForm;
+import org.eclipse.scout.rt.client.ui.form.AbstractFormHandler;
+import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractButton;
+import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractCancelButton;
+import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractOkButton;
+import org.eclipse.scout.rt.client.ui.form.fields.checkbox.AbstractCheckBox;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
+import org.eclipse.scout.rt.client.ui.form.fields.sequencebox.AbstractSequenceBox;
+import org.eclipse.scout.rt.client.ui.form.fields.smartfield.AbstractSmartField;
+import org.eclipse.scout.rt.client.ui.form.fields.stringfield.AbstractStringField;
+import org.eclipse.scout.rt.client.ui.form.fields.tablefield.AbstractTableField;
+import org.eclipse.scout.rt.client.ui.messagebox.MessageBox;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
+import org.eclipse.scout.service.SERVICES;
+
+public class SpellCheckerOptionsForm extends AbstractForm {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(SpellCheckerOptionsForm.class);
+
+ public SpellCheckerOptionsForm() throws ProcessingException {
+ super();
+ }
+
+ @Override
+ protected String getConfiguredTitle() {
+ return ScoutTexts.get("SC_DialogTitle_Options");
+ }
+
+ public MainBox getMainBox() {
+ return (MainBox) getRootGroupBox();
+ }
+
+ public GeneralSettingsBox getGeneralSettingsBox() {
+ return getFieldByClass(GeneralSettingsBox.class);
+ }
+
+ public UserDictionaryBox getUserDictionaryBox() {
+ return getFieldByClass(UserDictionaryBox.class);
+ }
+
+ public EnabledField getEnabledField() {
+ return getFieldByClass(EnabledField.class);
+ }
+
+ public ShortcutField getShortcutField() {
+ return getFieldByClass(ShortcutField.class);
+ }
+
+ public LanguageField getLanguageField() {
+ return getFieldByClass(LanguageField.class);
+ }
+
+ public IgnoreCaseField getIgnoreCaseField() {
+ return getFieldByClass(IgnoreCaseField.class);
+ }
+
+ public IgnoreDomainNamesField getIgnoreDomainNamesField() {
+ return getFieldByClass(IgnoreDomainNamesField.class);
+ }
+
+ public IgnoreWordsWithNumbersField getIgnoreWordsWithNumbersField() {
+ return getFieldByClass(IgnoreWordsWithNumbersField.class);
+ }
+
+ public UserDictionaryTableField getUserDictionaryTableField() {
+ return getFieldByClass(UserDictionaryTableField.class);
+ }
+
+ public EditorSequenceBox getEditorSequenceBox() {
+ return getFieldByClass(EditorSequenceBox.class);
+ }
+
+ public EditorField getEditorField() {
+ return getFieldByClass(EditorField.class);
+ }
+
+ public EditorButton getEditorButton() {
+ return getFieldByClass(EditorButton.class);
+ }
+
+ public ResetToStandardButton getResetToStandardButton() {
+ return getFieldByClass(ResetToStandardButton.class);
+ }
+
+ public OkButton getOkButton() {
+ return getFieldByClass(OkButton.class);
+ }
+
+ public CancelButton getCancelButton() {
+ return getFieldByClass(CancelButton.class);
+ }
+
+ public void startModify() throws ProcessingException {
+ startInternal(new ModifyHandler());
+ }
+
+ @Order(10)
+ public class MainBox extends AbstractGroupBox {
+
+ @Override
+ protected int getConfiguredGridColumnCount() {
+ return 1;
+ }
+
+ @Order(10)
+ public class GeneralSettingsBox extends AbstractGroupBox {
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("SC_Label_Main");
+ }
+
+ @Order(10)
+ public class EnabledField extends AbstractCheckBox {
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("SC_Label_Enable");
+ }
+
+ @Override
+ protected String getConfiguredTooltipText() {
+ return ScoutTexts.get("SC_Help_Enable");
+ }
+
+ @Override
+ protected void execChangedValue() throws ProcessingException {
+ boolean on = getValue();
+ getShortcutField().setEnabled(on);
+ getLanguageField().setEnabled(on);
+ getIgnoreCaseField().setEnabled(on);
+ getIgnoreDomainNamesField().setEnabled(on);
+ getIgnoreWordsWithNumbersField().setEnabled(on);
+ }
+ }
+
+ @Order(20)
+ public class ShortcutField extends AbstractSmartField<String> {
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("SC_Label_Shortcut");
+ }
+
+ @Override
+ protected String getConfiguredTooltipText() {
+ return ScoutTexts.get("SC_Help_Shortcut");
+ }
+
+ @Override
+ protected Class<? extends LookupCall> getConfiguredLookupCall() {
+ return SpellCheckerShortcutLookupCall.class;
+ }
+
+ }
+
+ @Order(30)
+ public class LanguageField extends AbstractSmartField<String> {
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("SC_Language");
+ }
+
+ @Override
+ protected String getConfiguredTooltipText() {
+ return ScoutTexts.get("SC_Help_Language");
+ }
+
+ @Override
+ protected Class<? extends LookupCall> getConfiguredLookupCall() {
+ return SpellCheckerLanguageLookupCall.class;
+ }
+
+ }
+
+ @Order(40)
+ public class IgnoreCaseField extends AbstractCheckBox {
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("SC_Label_IgnoreCase");
+ }
+
+ @Override
+ protected String getConfiguredTooltipText() {
+ return ScoutTexts.get("SC_Help_IgnoreCase");
+ }
+
+ }
+
+ @Order(50)
+ public class IgnoreDomainNamesField extends AbstractCheckBox {
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("SC_Label_IgnoreDomainNames");
+ }
+
+ @Override
+ protected String getConfiguredTooltipText() {
+ return ScoutTexts.get("SC_Help_IgnoreDomainNames");
+ }
+
+ }
+
+ @Order(60)
+ public class IgnoreWordsWithNumbersField extends AbstractCheckBox {
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("SC_Label_IgnoreWordsWithNumbers");
+ }
+
+ @Override
+ protected String getConfiguredTooltipText() {
+ return ScoutTexts.get("SC_Help_IgnoreWordsWithNumbers");
+ }
+
+ }
+
+ }
+
+ @Order(20)
+ public class UserDictionaryBox extends AbstractGroupBox {
+
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("SC_Label_UserDictionary");
+ }
+
+ @Override
+ protected String getConfiguredTooltipText() {
+ return ScoutTexts.get("SC_Help_UserDictionary");
+ }
+
+ @Order(10)
+ public class EditorSequenceBox extends AbstractSequenceBox {
+ @Override
+ protected boolean getConfiguredLabelVisible() {
+ return false;
+ }
+
+ @Order(10)
+ public class EditorField extends AbstractStringField {
+ @Override
+ public boolean isSpellCheckEnabled() {
+ return false;
+ }
+ }
+
+ @Order(20)
+ public class EditorButton extends AbstractButton {
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("SC_Label_AddToDictionary");
+ }
+
+ @Override
+ protected String getConfiguredTooltipText() {
+ return ScoutTexts.get("SC_Help_AddToDictionary");
+ }
+
+ @Override
+ protected void execClickAction() throws ProcessingException {
+ String word = getEditorField().getValue();
+ if (word != null) {
+ if (!getUserDictionaryTableField().getTable().getWordColumn().contains(word)) {
+ getUserDictionaryTableField().getTable().addRowByArray(new Object[]{word});
+ }
+ getEditorField().setValue(null);
+ }
+ }
+ }
+ }
+
+ @Order(20)
+ public class UserDictionaryTableField extends AbstractTableField<UserDictionaryTableField.Table> {
+
+ @Override
+ protected boolean getConfiguredLabelVisible() {
+ return false;
+ }
+
+ @Override
+ protected int getConfiguredGridH() {
+ return 10;
+ }
+
+ @Order(10)
+ public class Table extends AbstractTable {
+ @Override
+ protected boolean getConfiguredAutoResizeColumns() {
+ return true;
+ }
+
+ public WordColumn getWordColumn() {
+ return getColumnSet().getColumnByClass(WordColumn.class);
+ }
+
+ @Override
+ protected void execRowsSelected(ITableRow[] rows) throws ProcessingException {
+ if (rows.length > 0) {
+ getEditorField().setValue(getWordColumn().getSelectedValue());
+ }
+ }
+
+ @Order(10)
+ public class WordColumn extends AbstractStringColumn {
+ @Override
+ protected boolean getConfiguredPrimaryKey() {
+ return true;
+ }
+
+ @Override
+ protected String getConfiguredHeaderText() {
+ return ScoutTexts.get("SC_Label_IgnoredWord");
+ }
+ }
+
+ @Order(20)
+ public class RemoveWordMenu extends AbstractMenu {
+ @Override
+ protected String getConfiguredText() {
+ return ScoutTexts.get("SC_Label_RemoveWord");
+ }
+
+ @Override
+ protected String getConfiguredTooltipText() {
+ return ScoutTexts.get("SC_Help_RemoveWord");
+ }
+
+ @Override
+ protected boolean getConfiguredSingleSelectionAction() {
+ return true;
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ if (MessageBox.showDeleteConfirmationMessage(getWordColumn().getSelectedDisplayText())) {
+ deleteRow(getSelectedRow());
+ }
+ }
+ }
+
+ }
+
+ }
+
+ }
+
+ @Order(50)
+ public class ResetToStandardButton extends AbstractButton {
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("SC_Label_UseDefaults");
+ }
+
+ @Override
+ protected String getConfiguredTooltipText() {
+ return ScoutTexts.get("SC_Help_UseDefaults");
+ }
+
+ @Override
+ protected void execClickAction() throws ProcessingException {
+ getEnabledField().setValue(true);
+ getShortcutField().setValue("f7");
+ getLanguageField().setValue(LocaleThreadLocal.get().toString());
+ getIgnoreCaseField().setValue(false);
+ getIgnoreDomainNamesField().setValue(true);
+ getIgnoreWordsWithNumbersField().setValue(true);
+ }
+ }
+
+ @Order(60)
+ public class OkButton extends AbstractOkButton {
+ }
+
+ @Order(70)
+ public class CancelButton extends AbstractCancelButton {
+ }
+ }
+
+ public class ModifyHandler extends AbstractFormHandler {
+ @Override
+ protected void execLoad() throws ProcessingException {
+ getShortcutField().setEnabledGranted(false);
+ //
+ ISpellCheckerService sc = SERVICES.getService(ISpellCheckerService.class);
+ getEnabledField().setValue(sc.isEnabled());
+ getShortcutField().setValue("f7");
+ getLanguageField().setValue(sc.getLanguage());
+ getIgnoreCaseField().setValue(sc.isIgnoreCase());
+ getIgnoreDomainNamesField().setValue(sc.isIgnoreDomainNames());
+ getIgnoreWordsWithNumbersField().setValue(sc.isIgnoreWordsWithNumbers());
+ // user dict
+ UserDictionaryTableField.Table table = getUserDictionaryTableField().getTable();
+ try {
+ table.setTableChanging(true);
+ //
+ IUserDictionary dict = sc.getUserDictionary();
+ // force dict reload
+ try {
+ dict.addWord("ReloadDictionaryTag");
+ dict.deleteWord("ReloadDictionaryTag");
+ }
+ catch (Exception e) {
+ // nop
+ }
+ Enumeration en = dict.words();
+ while (en.hasMoreElements()) {
+ String s = (String) en.nextElement();
+ if (s != null && s.length() > 0) {
+ table.addRowByArray(new Object[]{s});
+ }
+ }
+ }
+ finally {
+ table.setTableChanging(false);
+ }
+ }
+
+ @Override
+ protected void execStore() throws ProcessingException {
+ ISpellCheckerService sc = SERVICES.getService(ISpellCheckerService.class);
+ boolean reinitNeeded = false;
+ if (getUserDictionaryTableField().isSaveNeeded()) {
+ reinitNeeded = true;
+ UserDictionaryTableField.Table table = getUserDictionaryTableField().getTable();
+ try {
+ IUserDictionary dict = sc.getUserDictionary();
+ dict.clear();
+ for (String word : table.getWordColumn().getValues()) {
+ dict.addWord(word);
+ }
+ }
+ catch (Exception e) {
+ LOG.warn(null, e);
+ }
+ }
+ if (getGeneralSettingsBox().isSaveNeeded()) {
+ reinitNeeded = true;
+ sc.setEnabled(getEnabledField().getValue());
+ sc.setLanguage(getLanguageField().getValue());
+ sc.setIgnoreCase(getIgnoreCaseField().getValue());
+ sc.setIgnoreDomainNames(getIgnoreDomainNamesField().getValue());
+ sc.setIgnoreWordsWithNumbers(getIgnoreWordsWithNumbersField().getValue());
+ }
+ if (reinitNeeded) {
+ sc.saveSettings();
+ sc.reinitialize();
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/spellchecker/forms/SpellCheckerShortcutLookupCall.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/spellchecker/forms/SpellCheckerShortcutLookupCall.java
index bef85f1d05..7fb0dbb95c 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/spellchecker/forms/SpellCheckerShortcutLookupCall.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/spellchecker/forms/SpellCheckerShortcutLookupCall.java
@@ -1,43 +1,43 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.spellchecker.forms;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.shared.services.lookup.LocalLookupCall;
-import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
-
-public class SpellCheckerShortcutLookupCall extends LocalLookupCall {
-
- private static final long serialVersionUID = 1L;
-
- @Override
- protected List<LookupRow> execCreateLookupRows() throws ProcessingException {
- ArrayList<LookupRow> list = new ArrayList<LookupRow>();
- for (int i = 1; i <= 12; i++) {
- list.add(new LookupRow("f" + i, "F" + i));
- }
- return list;
- }
-
- @Override
- public boolean equals(Object obj) {
- return super.equals(obj);
- }
-
- @Override
- public int hashCode() {
- return super.hashCode();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.spellchecker.forms;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.shared.services.lookup.LocalLookupCall;
+import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
+
+public class SpellCheckerShortcutLookupCall extends LocalLookupCall {
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ protected List<LookupRow> execCreateLookupRows() throws ProcessingException {
+ ArrayList<LookupRow> list = new ArrayList<LookupRow>();
+ for (int i = 1; i <= 12; i++) {
+ list.add(new LookupRow("f" + i, "F" + i));
+ }
+ return list;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ return super.equals(obj);
+ }
+
+ @Override
+ public int hashCode() {
+ return super.hashCode();
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/test/AbstractClientTest.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/test/AbstractClientTest.java
index f4b02a2a63..e0eedb66d9 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/test/AbstractClientTest.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/test/AbstractClientTest.java
@@ -1,34 +1,34 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.test;
-
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.shared.services.common.test.AbstractTest;
-import org.eclipse.scout.rt.shared.services.common.test.ITest;
-
-/**
- * Abstract client test implementation.
- * <p>
- * {@link #getConfiguredProduct()} has special default value calling session symbolic name
- */
-public abstract class AbstractClientTest extends AbstractTest implements ITest {
-
- @Override
- protected void initConfig() {
- super.initConfig();
- if (getProduct() == null) {
- IClientSession session = ClientTestUtility.getClientSession();
- if (session != null) {
- setProduct(session.getBundle().getSymbolicName());
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.test;
+
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.shared.services.common.test.AbstractTest;
+import org.eclipse.scout.rt.shared.services.common.test.ITest;
+
+/**
+ * Abstract client test implementation.
+ * <p>
+ * {@link #getConfiguredProduct()} has special default value calling session symbolic name
+ */
+public abstract class AbstractClientTest extends AbstractTest implements ITest {
+
+ @Override
+ protected void initConfig() {
+ super.initConfig();
+ if (getProduct() == null) {
+ IClientSession session = ClientTestUtility.getClientSession();
+ if (session != null) {
+ setProduct(session.getBundle().getSymbolicName());
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/test/ClientTestUtility.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/test/ClientTestUtility.java
index 9e904b49cb..d6c752a471 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/test/ClientTestUtility.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/test/ClientTestUtility.java
@@ -1,253 +1,253 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.test;
-
-import java.math.BigDecimal;
-import java.util.Date;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.scout.commons.TriState;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.BlockingCondition;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
-import org.eclipse.scout.rt.client.ui.desktop.outline.AbstractOutline;
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.AbstractPageWithTable;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.AbstractSearchForm;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.client.ui.form.AbstractForm;
-import org.eclipse.scout.rt.client.ui.form.fields.AbstractValueField;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.bigdecimalfield.AbstractBigDecimalField;
-import org.eclipse.scout.rt.client.ui.form.fields.datefield.AbstractDateField;
-import org.eclipse.scout.rt.client.ui.form.fields.listbox.AbstractListBox;
-import org.eclipse.scout.rt.client.ui.form.fields.numberfield.AbstractNumberField;
-import org.eclipse.scout.rt.client.ui.form.fields.smartfield.AbstractSmartField;
-import org.eclipse.scout.rt.client.ui.form.fields.stringfield.AbstractStringField;
-import org.eclipse.scout.rt.shared.data.form.fields.AbstractValueFieldData;
-import org.eclipse.scout.rt.shared.services.common.jdbc.SearchFilter;
-import org.eclipse.scout.rt.shared.services.lookup.CodeLookupCall;
-import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
-import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
-import org.osgi.framework.Bundle;
-
-public final class ClientTestUtility {
-
- private ClientTestUtility() {
- }
-
- public static void sleep(final int seconds) {
- if (seconds <= 0) {
- return;
- }
- final BlockingCondition bc = new BlockingCondition(true);
- new ClientSyncJob("sleep", ClientSyncJob.getCurrentSession()) {
- @Override
- protected void runVoid(IProgressMonitor monitor) throws Throwable {
- bc.release();
- }
- }.schedule(1000L * seconds);
- try {
- bc.waitFor();
- }
- catch (InterruptedException e) {
- // nop
- }
- }
-
- public static String getNowAsString() {
- return "" + new Date();
- }
-
- public static Date getNowAsDate() {
- return new Date();
- }
-
- @SuppressWarnings("unchecked")
- public static void searchEntityInOutline(AbstractPageWithTable<?> p, String formDataFieldId, long value) throws ProcessingException {
- AbstractSearchForm searchForm = (AbstractSearchForm) p.getSearchFormInternal();
- searchForm.rebuildSearchFilter();
- SearchFilter f = searchForm.getSearchFilter();
- f.clear();
- ((AbstractValueFieldData) f.getFormData().getFieldById(formDataFieldId)).setValue(value);
- f.setCompleted(true);
- p.getSearchFormInternal().doReset();
- p.reloadPage();
- }
-
- @SuppressWarnings("unchecked")
- public static void searchEntityInOutline(AbstractPageWithTable<?> p, String formDataFieldId, String value) throws ProcessingException {
- AbstractSearchForm searchForm = (AbstractSearchForm) p.getSearchFormInternal();
- searchForm.rebuildSearchFilter();
- SearchFilter f = searchForm.getSearchFilter();
- f.clear();
- ((AbstractValueFieldData) f.getFormData().getFieldById(formDataFieldId)).setValue(value);
- f.setCompleted(true);
- p.getSearchFormInternal().doReset();
- p.reloadPage();
- }
-
- public static IClientSession getClientSession() {
- return ClientSyncJob.getCurrentSession();
- }
-
- public static Bundle getClientBundle() {
- return ClientSyncJob.getCurrentSession().getBundle();
- }
-
- public static IDesktop getDesktop() {
- return ClientSyncJob.getCurrentSession().getDesktop();
- }
-
- public static String getFormsPackage() {
- return getClientBundle().getSymbolicName() + ".ui.forms";
- }
-
- /**
- * @rn aho, 09.03.2009:
- * @return the root page of the desired outline.
- */
- public static IPage gotoOutline(Class<? extends AbstractOutline> outlineClass) {
- IPage rootPage = null;
- IOutline[] availableOutlines = getDesktop().getAvailableOutlines();
- for (IOutline outline : availableOutlines) {
-
- if (outline.getClass().isAssignableFrom(outlineClass)) {
- getDesktop().setOutline(outline);
- System.out.println("Selected Outline: " + outline.getTitle());
- outline.releaseUnusedPages();
- rootPage = outline.getRootPage();
- }
-
- }
- return rootPage;
- }
-
- /**
- * @rn aho, 09.03.2009:
- * @return return the first child page of the given class, iff exists.
- */
- @SuppressWarnings("unchecked")
- public static <T extends IPage> T gotoChildPage(IPage parentPage, Class<T> childPageClass) {
- T childPage = null;
- IPage[] childPages = parentPage.getChildPages();
- for (IPage page : childPages) {
- if (childPageClass.isAssignableFrom(page.getClass())) {
- IOutline outline = getDesktop().getOutline();
- outline.selectNode(page);
- System.out.println("Selected Page: " + page);
- outline.releaseUnusedPages();
- childPage = (T) page;
- }
-
- }
- return childPage;
- }
-
- /**
- * @rn aho, 12.03.2009:
- * @return return the first child page of the given class, iff exists.
- */
- public static <T extends IPage> T gotoChildPage(Class<T> childPageClass) {
- IPage selectedNode = getDesktop().getOutline().getActivePage();
- return gotoChildPage(selectedNode, childPageClass);
- }
-
- @SuppressWarnings("unchecked")
- public static void fillForm(AbstractForm form, long testNr) throws ProcessingException {
- for (IFormField formField : form.getAllFields()) {
- if (formField.isEnabled() && formField.isVisible()) {
- if (formField instanceof AbstractValueField) {
- if (((AbstractValueField<?>) formField).getValue() == null) {
- // String Field
- if (formField instanceof AbstractStringField) {
- ((AbstractStringField) formField).setValue("test " + testNr);
- // Smart Field - set to 1st value
- }
- else if (formField instanceof AbstractSmartField) {
- LookupCall lookupCall = null;
- // SQL Lookup
- if (((AbstractSmartField<?>) formField).getLookupCall() != null) {
- lookupCall = ((AbstractSmartField<?>) formField).getLookupCall();
- ((AbstractSmartField<?>) formField).prepareKeyLookup(lookupCall, null);
- ((AbstractSmartField<?>) formField).prepareTextLookup(lookupCall, "abc");
- ((AbstractSmartField<?>) formField).prepareBrowseLookup(lookupCall, "abc", TriState.TRUE);
- }
- // CodeType Lookup
- else if (((AbstractSmartField<?>) formField).getCodeTypeClass() != null) {
- lookupCall = new CodeLookupCall(((AbstractSmartField<?>) formField).getCodeTypeClass());
- }
- if (lookupCall == null) {
- System.out.println("WARNING: Lookup Call for Field " + formField.getFieldId() + "is null!");
- }
- else {
- lookupCall.setActive(TriState.TRUE);
- lookupCall.setMaxRowCount(100);
- /* Test smartfield Key and Text */
- lookupCall.getDataByKey();
- lookupCall.getDataByText();
- /* Load data by all */
- final LookupRow[] rs = lookupCall.getDataByAll();
- if (rs.length > 0) {
- ((AbstractSmartField) formField).setValue(rs[0].getKey());
- }
- }
- // Number Field
- }
- else if (formField instanceof AbstractNumberField) {
- ((AbstractNumberField) formField).setValue(42L);
- // Big Decimal Field
- }
- else if (formField instanceof AbstractBigDecimalField) {
- ((AbstractBigDecimalField) formField).setValue(BigDecimal.valueOf(42.42));
- // Date Field
- }
- else if (formField instanceof AbstractDateField) {
- ((AbstractDateField) formField).setValue(new Date());
- }
- else if (formField instanceof AbstractListBox) {
- LookupCall lookupCall = null;
- // SQL Lookup
- if (((AbstractListBox<?>) formField).getLookupCall() != null) {
- lookupCall = ((AbstractListBox<?>) formField).getLookupCall();
- ((AbstractListBox<?>) formField).prepareLookupCall(lookupCall);
- }
- // CodeType Lookup
- else if (((AbstractListBox<?>) formField).getCodeTypeClass() != null) {
- lookupCall = new CodeLookupCall(((AbstractListBox<?>) formField).getCodeTypeClass());
- }
- if (lookupCall == null) {
- System.out.println("WARNING: Lookup Call for Field " + formField.getFieldId() + "is null!");
- }
- else {
- lookupCall.setActive(TriState.TRUE);
- lookupCall.setMaxRowCount(100);
- /* Test smartfield Key and Text */
- lookupCall.getDataByKey();
- lookupCall.getDataByText();
- /* Load data by all */
- final LookupRow[] rs = lookupCall.getDataByAll();
- if (rs.length > 0) {
- if ((((AbstractListBox) formField)).getCheckedKeyCount() == 0) {
- ((AbstractListBox) formField).checkKey(rs[0].getKey());
- }
- }
- }
- }
- }
- }
- }
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.test;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.scout.commons.TriState;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.BlockingCondition;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
+import org.eclipse.scout.rt.client.ui.desktop.outline.AbstractOutline;
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.AbstractPageWithTable;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.AbstractSearchForm;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.client.ui.form.AbstractForm;
+import org.eclipse.scout.rt.client.ui.form.fields.AbstractValueField;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.bigdecimalfield.AbstractBigDecimalField;
+import org.eclipse.scout.rt.client.ui.form.fields.datefield.AbstractDateField;
+import org.eclipse.scout.rt.client.ui.form.fields.listbox.AbstractListBox;
+import org.eclipse.scout.rt.client.ui.form.fields.numberfield.AbstractNumberField;
+import org.eclipse.scout.rt.client.ui.form.fields.smartfield.AbstractSmartField;
+import org.eclipse.scout.rt.client.ui.form.fields.stringfield.AbstractStringField;
+import org.eclipse.scout.rt.shared.data.form.fields.AbstractValueFieldData;
+import org.eclipse.scout.rt.shared.services.common.jdbc.SearchFilter;
+import org.eclipse.scout.rt.shared.services.lookup.CodeLookupCall;
+import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
+import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
+import org.osgi.framework.Bundle;
+
+public final class ClientTestUtility {
+
+ private ClientTestUtility() {
+ }
+
+ public static void sleep(final int seconds) {
+ if (seconds <= 0) {
+ return;
+ }
+ final BlockingCondition bc = new BlockingCondition(true);
+ new ClientSyncJob("sleep", ClientSyncJob.getCurrentSession()) {
+ @Override
+ protected void runVoid(IProgressMonitor monitor) throws Throwable {
+ bc.release();
+ }
+ }.schedule(1000L * seconds);
+ try {
+ bc.waitFor();
+ }
+ catch (InterruptedException e) {
+ // nop
+ }
+ }
+
+ public static String getNowAsString() {
+ return "" + new Date();
+ }
+
+ public static Date getNowAsDate() {
+ return new Date();
+ }
+
+ @SuppressWarnings("unchecked")
+ public static void searchEntityInOutline(AbstractPageWithTable<?> p, String formDataFieldId, long value) throws ProcessingException {
+ AbstractSearchForm searchForm = (AbstractSearchForm) p.getSearchFormInternal();
+ searchForm.rebuildSearchFilter();
+ SearchFilter f = searchForm.getSearchFilter();
+ f.clear();
+ ((AbstractValueFieldData) f.getFormData().getFieldById(formDataFieldId)).setValue(value);
+ f.setCompleted(true);
+ p.getSearchFormInternal().doReset();
+ p.reloadPage();
+ }
+
+ @SuppressWarnings("unchecked")
+ public static void searchEntityInOutline(AbstractPageWithTable<?> p, String formDataFieldId, String value) throws ProcessingException {
+ AbstractSearchForm searchForm = (AbstractSearchForm) p.getSearchFormInternal();
+ searchForm.rebuildSearchFilter();
+ SearchFilter f = searchForm.getSearchFilter();
+ f.clear();
+ ((AbstractValueFieldData) f.getFormData().getFieldById(formDataFieldId)).setValue(value);
+ f.setCompleted(true);
+ p.getSearchFormInternal().doReset();
+ p.reloadPage();
+ }
+
+ public static IClientSession getClientSession() {
+ return ClientSyncJob.getCurrentSession();
+ }
+
+ public static Bundle getClientBundle() {
+ return ClientSyncJob.getCurrentSession().getBundle();
+ }
+
+ public static IDesktop getDesktop() {
+ return ClientSyncJob.getCurrentSession().getDesktop();
+ }
+
+ public static String getFormsPackage() {
+ return getClientBundle().getSymbolicName() + ".ui.forms";
+ }
+
+ /**
+ * @rn aho, 09.03.2009:
+ * @return the root page of the desired outline.
+ */
+ public static IPage gotoOutline(Class<? extends AbstractOutline> outlineClass) {
+ IPage rootPage = null;
+ IOutline[] availableOutlines = getDesktop().getAvailableOutlines();
+ for (IOutline outline : availableOutlines) {
+
+ if (outline.getClass().isAssignableFrom(outlineClass)) {
+ getDesktop().setOutline(outline);
+ System.out.println("Selected Outline: " + outline.getTitle());
+ outline.releaseUnusedPages();
+ rootPage = outline.getRootPage();
+ }
+
+ }
+ return rootPage;
+ }
+
+ /**
+ * @rn aho, 09.03.2009:
+ * @return return the first child page of the given class, iff exists.
+ */
+ @SuppressWarnings("unchecked")
+ public static <T extends IPage> T gotoChildPage(IPage parentPage, Class<T> childPageClass) {
+ T childPage = null;
+ IPage[] childPages = parentPage.getChildPages();
+ for (IPage page : childPages) {
+ if (childPageClass.isAssignableFrom(page.getClass())) {
+ IOutline outline = getDesktop().getOutline();
+ outline.selectNode(page);
+ System.out.println("Selected Page: " + page);
+ outline.releaseUnusedPages();
+ childPage = (T) page;
+ }
+
+ }
+ return childPage;
+ }
+
+ /**
+ * @rn aho, 12.03.2009:
+ * @return return the first child page of the given class, iff exists.
+ */
+ public static <T extends IPage> T gotoChildPage(Class<T> childPageClass) {
+ IPage selectedNode = getDesktop().getOutline().getActivePage();
+ return gotoChildPage(selectedNode, childPageClass);
+ }
+
+ @SuppressWarnings("unchecked")
+ public static void fillForm(AbstractForm form, long testNr) throws ProcessingException {
+ for (IFormField formField : form.getAllFields()) {
+ if (formField.isEnabled() && formField.isVisible()) {
+ if (formField instanceof AbstractValueField) {
+ if (((AbstractValueField<?>) formField).getValue() == null) {
+ // String Field
+ if (formField instanceof AbstractStringField) {
+ ((AbstractStringField) formField).setValue("test " + testNr);
+ // Smart Field - set to 1st value
+ }
+ else if (formField instanceof AbstractSmartField) {
+ LookupCall lookupCall = null;
+ // SQL Lookup
+ if (((AbstractSmartField<?>) formField).getLookupCall() != null) {
+ lookupCall = ((AbstractSmartField<?>) formField).getLookupCall();
+ ((AbstractSmartField<?>) formField).prepareKeyLookup(lookupCall, null);
+ ((AbstractSmartField<?>) formField).prepareTextLookup(lookupCall, "abc");
+ ((AbstractSmartField<?>) formField).prepareBrowseLookup(lookupCall, "abc", TriState.TRUE);
+ }
+ // CodeType Lookup
+ else if (((AbstractSmartField<?>) formField).getCodeTypeClass() != null) {
+ lookupCall = new CodeLookupCall(((AbstractSmartField<?>) formField).getCodeTypeClass());
+ }
+ if (lookupCall == null) {
+ System.out.println("WARNING: Lookup Call for Field " + formField.getFieldId() + "is null!");
+ }
+ else {
+ lookupCall.setActive(TriState.TRUE);
+ lookupCall.setMaxRowCount(100);
+ /* Test smartfield Key and Text */
+ lookupCall.getDataByKey();
+ lookupCall.getDataByText();
+ /* Load data by all */
+ final LookupRow[] rs = lookupCall.getDataByAll();
+ if (rs.length > 0) {
+ ((AbstractSmartField) formField).setValue(rs[0].getKey());
+ }
+ }
+ // Number Field
+ }
+ else if (formField instanceof AbstractNumberField) {
+ ((AbstractNumberField) formField).setValue(42L);
+ // Big Decimal Field
+ }
+ else if (formField instanceof AbstractBigDecimalField) {
+ ((AbstractBigDecimalField) formField).setValue(BigDecimal.valueOf(42.42));
+ // Date Field
+ }
+ else if (formField instanceof AbstractDateField) {
+ ((AbstractDateField) formField).setValue(new Date());
+ }
+ else if (formField instanceof AbstractListBox) {
+ LookupCall lookupCall = null;
+ // SQL Lookup
+ if (((AbstractListBox<?>) formField).getLookupCall() != null) {
+ lookupCall = ((AbstractListBox<?>) formField).getLookupCall();
+ ((AbstractListBox<?>) formField).prepareLookupCall(lookupCall);
+ }
+ // CodeType Lookup
+ else if (((AbstractListBox<?>) formField).getCodeTypeClass() != null) {
+ lookupCall = new CodeLookupCall(((AbstractListBox<?>) formField).getCodeTypeClass());
+ }
+ if (lookupCall == null) {
+ System.out.println("WARNING: Lookup Call for Field " + formField.getFieldId() + "is null!");
+ }
+ else {
+ lookupCall.setActive(TriState.TRUE);
+ lookupCall.setMaxRowCount(100);
+ /* Test smartfield Key and Text */
+ lookupCall.getDataByKey();
+ lookupCall.getDataByText();
+ /* Load data by all */
+ final LookupRow[] rs = lookupCall.getDataByAll();
+ if (rs.length > 0) {
+ if ((((AbstractListBox) formField)).getCheckedKeyCount() == 0) {
+ ((AbstractListBox) formField).checkKey(rs[0].getKey());
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/useractivity/UserActivityEvent.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/useractivity/UserActivityEvent.java
index f1565469e3..53ee1eeaff 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/useractivity/UserActivityEvent.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/useractivity/UserActivityEvent.java
@@ -1,36 +1,36 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.useractivity;
-
-import java.util.EventObject;
-
-import org.eclipse.scout.rt.shared.services.common.useractivity.UserStatusMap;
-
-public class UserActivityEvent extends EventObject {
- private static final long serialVersionUID = 1L;
-
- private UserStatusMap m_userStatusMap;
-
- public UserActivityEvent(UserActivityManager source, UserStatusMap userStatusMap) {
- super(source);
- m_userStatusMap = userStatusMap;
- }
-
- @Override
- public UserActivityManager getSource() {
- return (UserActivityManager) super.getSource();
- }
-
- public UserStatusMap getUserStatusMap() {
- return m_userStatusMap;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.useractivity;
+
+import java.util.EventObject;
+
+import org.eclipse.scout.rt.shared.services.common.useractivity.UserStatusMap;
+
+public class UserActivityEvent extends EventObject {
+ private static final long serialVersionUID = 1L;
+
+ private UserStatusMap m_userStatusMap;
+
+ public UserActivityEvent(UserActivityManager source, UserStatusMap userStatusMap) {
+ super(source);
+ m_userStatusMap = userStatusMap;
+ }
+
+ @Override
+ public UserActivityManager getSource() {
+ return (UserActivityManager) super.getSource();
+ }
+
+ public UserStatusMap getUserStatusMap() {
+ return m_userStatusMap;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/useractivity/UserActivityListener.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/useractivity/UserActivityListener.java
index f40697661b..1f48d8c3dd 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/useractivity/UserActivityListener.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/useractivity/UserActivityListener.java
@@ -1,19 +1,19 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.useractivity;
-
-import java.util.EventListener;
-
-public interface UserActivityListener extends EventListener {
-
- void stateChanged(UserActivityEvent e);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.useractivity;
+
+import java.util.EventListener;
+
+public interface UserActivityListener extends EventListener {
+
+ void stateChanged(UserActivityEvent e);
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/useractivity/UserActivityManager.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/useractivity/UserActivityManager.java
index 122a612b33..110358642d 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/useractivity/UserActivityManager.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/common/useractivity/UserActivityManager.java
@@ -1,154 +1,154 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.common.useractivity;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.scout.commons.EventListenerList;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ClientAsyncJob;
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.client.services.common.clientnotification.ClientNotificationConsumerEvent;
-import org.eclipse.scout.rt.client.services.common.clientnotification.IClientNotificationConsumerListener;
-import org.eclipse.scout.rt.client.services.common.clientnotification.IClientNotificationConsumerService;
-import org.eclipse.scout.rt.shared.services.common.useractivity.IUserActivityProvider;
-import org.eclipse.scout.rt.shared.services.common.useractivity.IUserActivityStateService;
-import org.eclipse.scout.rt.shared.services.common.useractivity.UserActivityClientNotification;
-import org.eclipse.scout.rt.shared.services.common.useractivity.UserStatusMap;
-import org.eclipse.scout.service.SERVICES;
-
-public class UserActivityManager {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(UserActivityManager.class);
-
- private final IClientSession m_clientSession;
- private final PropertyChangeListener m_userActivityProviderListener;
- private final IClientNotificationConsumerListener m_clientNotificationConsumerListener;
- //
- private IUserActivityProvider m_provider;
- private final EventListenerList m_listenerList;
- private boolean m_started;
- private int m_currentState = IUserActivityStateService.STATUS_OFFLINE;
- private UserStatusMap m_statusMap;
-
- public UserActivityManager(IClientSession clientSession) {
- m_clientSession = clientSession;
- m_clientNotificationConsumerListener = new IClientNotificationConsumerListener() {
- @Override
- public void handleEvent(ClientNotificationConsumerEvent e, boolean sync) {
- if (e.getClientNotification() instanceof UserActivityClientNotification) {
- updateCache(((UserActivityClientNotification) e.getClientNotification()).getUserStatusMap());
- }
- }
- };
- m_userActivityProviderListener = new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent e) {
- providerStateChanged((Boolean) e.getNewValue() ? IUserActivityStateService.STATUS_ONLINE : IUserActivityStateService.STATUS_IDLE);
- }
- };
- m_listenerList = new EventListenerList();
- }
-
- public void addUserActivityListener(UserActivityListener listener) {
- m_listenerList.add(UserActivityListener.class, listener);
- }
-
- public void removeUserActivityListener(UserActivityListener listener) {
- m_listenerList.remove(UserActivityListener.class, listener);
- }
-
- public void start() {
- if (m_started) {
- return;
- }
- m_started = true;
- // initial state
- for (IUserActivityStateService s : SERVICES.getServices(IUserActivityStateService.class)) {
- try {
- updateCache(s.getUserStatusMap());
- }
- catch (Throwable t) {
- LOG.error("service " + s.getClass().getName(), t);
- }
- }
- // add client notification listener
- SERVICES.getService(IClientNotificationConsumerService.class).addClientNotificationConsumerListener(m_clientSession, m_clientNotificationConsumerListener);
- // add provider listener
- try {
- m_provider = SERVICES.getService(IUserActivityProvider.class);
- if (m_provider != null) {
- m_provider.addPropertyChangeListener(IUserActivityProvider.PROP_ACTIVE, m_userActivityProviderListener);
- }
- }
- catch (Throwable t) {
- LOG.error("provider " + m_provider, t);
- }
- // switch to online
- providerStateChanged(IUserActivityStateService.STATUS_ONLINE);
- }
-
- public void stop() {
- if (!m_started) {
- return;
- }
- m_started = false;
- // detach
- SERVICES.getService(IClientNotificationConsumerService.class).removeClientNotificationConsumerListener(m_clientSession, m_clientNotificationConsumerListener);
- if (m_provider != null) {
- m_provider.removePropertyChangeListener(IUserActivityProvider.PROP_ACTIVE, m_userActivityProviderListener);
- }
- m_provider = null;
- providerStateChanged(IUserActivityStateService.STATUS_OFFLINE);
- }
-
- public UserStatusMap getUserStatusMap() {
- return m_statusMap;
- }
-
- private void updateCache(UserStatusMap statusMap) {
- m_statusMap = statusMap;
- fireUserActivityEvent(new UserActivityEvent(this, m_statusMap));
- }
-
- private void fireUserActivityEvent(UserActivityEvent e) {
- for (UserActivityListener listener : m_listenerList.getListeners(UserActivityListener.class)) {
- try {
- listener.stateChanged(e);
- }
- catch (Throwable t) {
- LOG.error("listener " + listener.getClass().getName(), t);
- }
- }
- }
-
- private void providerStateChanged(final int newStatus) {
- if (newStatus != m_currentState) {
- m_currentState = newStatus;
- new ClientAsyncJob("user activity " + newStatus, m_clientSession) {
- @Override
- protected void runVoid(IProgressMonitor monitor) throws Throwable {
- for (IUserActivityStateService s : SERVICES.getServices(IUserActivityStateService.class)) {
- try {
- s.setStatus(newStatus);
- }
- catch (Throwable t) {
- LOG.error("service " + s.getClass().getName(), t);
- }
- }
- }
- }.schedule();
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.common.useractivity;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.scout.commons.EventListenerList;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ClientAsyncJob;
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.client.services.common.clientnotification.ClientNotificationConsumerEvent;
+import org.eclipse.scout.rt.client.services.common.clientnotification.IClientNotificationConsumerListener;
+import org.eclipse.scout.rt.client.services.common.clientnotification.IClientNotificationConsumerService;
+import org.eclipse.scout.rt.shared.services.common.useractivity.IUserActivityProvider;
+import org.eclipse.scout.rt.shared.services.common.useractivity.IUserActivityStateService;
+import org.eclipse.scout.rt.shared.services.common.useractivity.UserActivityClientNotification;
+import org.eclipse.scout.rt.shared.services.common.useractivity.UserStatusMap;
+import org.eclipse.scout.service.SERVICES;
+
+public class UserActivityManager {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(UserActivityManager.class);
+
+ private final IClientSession m_clientSession;
+ private final PropertyChangeListener m_userActivityProviderListener;
+ private final IClientNotificationConsumerListener m_clientNotificationConsumerListener;
+ //
+ private IUserActivityProvider m_provider;
+ private final EventListenerList m_listenerList;
+ private boolean m_started;
+ private int m_currentState = IUserActivityStateService.STATUS_OFFLINE;
+ private UserStatusMap m_statusMap;
+
+ public UserActivityManager(IClientSession clientSession) {
+ m_clientSession = clientSession;
+ m_clientNotificationConsumerListener = new IClientNotificationConsumerListener() {
+ @Override
+ public void handleEvent(ClientNotificationConsumerEvent e, boolean sync) {
+ if (e.getClientNotification() instanceof UserActivityClientNotification) {
+ updateCache(((UserActivityClientNotification) e.getClientNotification()).getUserStatusMap());
+ }
+ }
+ };
+ m_userActivityProviderListener = new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent e) {
+ providerStateChanged((Boolean) e.getNewValue() ? IUserActivityStateService.STATUS_ONLINE : IUserActivityStateService.STATUS_IDLE);
+ }
+ };
+ m_listenerList = new EventListenerList();
+ }
+
+ public void addUserActivityListener(UserActivityListener listener) {
+ m_listenerList.add(UserActivityListener.class, listener);
+ }
+
+ public void removeUserActivityListener(UserActivityListener listener) {
+ m_listenerList.remove(UserActivityListener.class, listener);
+ }
+
+ public void start() {
+ if (m_started) {
+ return;
+ }
+ m_started = true;
+ // initial state
+ for (IUserActivityStateService s : SERVICES.getServices(IUserActivityStateService.class)) {
+ try {
+ updateCache(s.getUserStatusMap());
+ }
+ catch (Throwable t) {
+ LOG.error("service " + s.getClass().getName(), t);
+ }
+ }
+ // add client notification listener
+ SERVICES.getService(IClientNotificationConsumerService.class).addClientNotificationConsumerListener(m_clientSession, m_clientNotificationConsumerListener);
+ // add provider listener
+ try {
+ m_provider = SERVICES.getService(IUserActivityProvider.class);
+ if (m_provider != null) {
+ m_provider.addPropertyChangeListener(IUserActivityProvider.PROP_ACTIVE, m_userActivityProviderListener);
+ }
+ }
+ catch (Throwable t) {
+ LOG.error("provider " + m_provider, t);
+ }
+ // switch to online
+ providerStateChanged(IUserActivityStateService.STATUS_ONLINE);
+ }
+
+ public void stop() {
+ if (!m_started) {
+ return;
+ }
+ m_started = false;
+ // detach
+ SERVICES.getService(IClientNotificationConsumerService.class).removeClientNotificationConsumerListener(m_clientSession, m_clientNotificationConsumerListener);
+ if (m_provider != null) {
+ m_provider.removePropertyChangeListener(IUserActivityProvider.PROP_ACTIVE, m_userActivityProviderListener);
+ }
+ m_provider = null;
+ providerStateChanged(IUserActivityStateService.STATUS_OFFLINE);
+ }
+
+ public UserStatusMap getUserStatusMap() {
+ return m_statusMap;
+ }
+
+ private void updateCache(UserStatusMap statusMap) {
+ m_statusMap = statusMap;
+ fireUserActivityEvent(new UserActivityEvent(this, m_statusMap));
+ }
+
+ private void fireUserActivityEvent(UserActivityEvent e) {
+ for (UserActivityListener listener : m_listenerList.getListeners(UserActivityListener.class)) {
+ try {
+ listener.stateChanged(e);
+ }
+ catch (Throwable t) {
+ LOG.error("listener " + listener.getClass().getName(), t);
+ }
+ }
+ }
+
+ private void providerStateChanged(final int newStatus) {
+ if (newStatus != m_currentState) {
+ m_currentState = newStatus;
+ new ClientAsyncJob("user activity " + newStatus, m_clientSession) {
+ @Override
+ protected void runVoid(IProgressMonitor monitor) throws Throwable {
+ for (IUserActivityStateService s : SERVICES.getServices(IUserActivityStateService.class)) {
+ try {
+ s.setStatus(newStatus);
+ }
+ catch (Throwable t) {
+ LOG.error("service " + s.getClass().getName(), t);
+ }
+ }
+ }
+ }.schedule();
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/lookup/BatchLookupServiceClientProxy.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/lookup/BatchLookupServiceClientProxy.java
index 422a315c3c..6229112d05 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/lookup/BatchLookupServiceClientProxy.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/lookup/BatchLookupServiceClientProxy.java
@@ -1,128 +1,128 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.lookup;
-
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.servicetunnel.ServiceTunnelUtility;
-import org.eclipse.scout.rt.shared.services.lookup.BatchLookupCall;
-import org.eclipse.scout.rt.shared.services.lookup.BatchLookupNormalizer;
-import org.eclipse.scout.rt.shared.services.lookup.BatchLookupResultCache;
-import org.eclipse.scout.rt.shared.services.lookup.IBatchLookupService;
-import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
-import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
-import org.eclipse.scout.service.AbstractService;
-
-@Priority(-3)
-public class BatchLookupServiceClientProxy extends AbstractService implements IBatchLookupService {
-
- public BatchLookupServiceClientProxy() {
- }
-
- @Override
- public LookupRow[][] getBatchDataByKey(BatchLookupCall batch) throws ProcessingException {
- LookupCall[] allCalls = batch.getCallBatch();
- //set calls with key==null to null
- for (int i = 0; i < allCalls.length; i++) {
- if (allCalls[i] != null && allCalls[i].getKey() == null) {
- allCalls[i] = null;
- }
- }
- BatchSplit split = new BatchSplit(allCalls);
- if (split.getLocalCallCount() > 0) {
- BatchLookupResultCache cache = new BatchLookupResultCache();
- LookupCall[] calls = split.getLocalCalls();
- LookupRow[][] resultArray = new LookupRow[calls.length][];
- for (int i = 0; i < calls.length; i++) {
- resultArray[i] = cache.getDataByKey(calls[i]);
- }
- split.setLocalResults(resultArray);
- }
- if (split.getRemoteCallCount() > 0) {
- BatchLookupNormalizer normalizer = new BatchLookupNormalizer();
- LookupCall[] normCallArray = normalizer.normalizeCalls(split.getRemoteCalls());
- LookupRow[][] normResultArray = getTargetService().getBatchDataByKey(new BatchLookupCall(normCallArray));
- LookupRow[][] resultArray = normalizer.denormalizeResults(normResultArray);
- split.setRemoteResults(resultArray);
- }
- LookupRow[][] results = split.getCombinedResults();
- //set null results to LookupRow[0]
- for (int i = 0; i < results.length; i++) {
- if (results[i] == null) {
- results[i] = LookupRow.EMPTY_ARRAY;
- }
- }
- return results;
- }
-
- @Override
- public LookupRow[][] getBatchDataByText(BatchLookupCall batch) throws ProcessingException {
- BatchSplit split = new BatchSplit(batch);
- if (split.getLocalCallCount() > 0) {
- BatchLookupResultCache cache = new BatchLookupResultCache();
- LookupCall[] calls = split.getLocalCalls();
- LookupRow[][] resultArray = new LookupRow[calls.length][];
- for (int i = 0; i < calls.length; i++) {
- resultArray[i] = cache.getDataByText(calls[i]);
- }
- split.setLocalResults(resultArray);
- }
- if (split.getRemoteCallCount() > 0) {
- LookupRow[][] resultArray = getTargetService().getBatchDataByText(new BatchLookupCall(split.getRemoteCalls()));
- split.setRemoteResults(resultArray);
- }
- return split.getCombinedResults();
- }
-
- @Override
- public LookupRow[][] getBatchDataByAll(BatchLookupCall batch) throws ProcessingException {
- BatchSplit split = new BatchSplit(batch);
- if (split.getLocalCallCount() > 0) {
- BatchLookupResultCache cache = new BatchLookupResultCache();
- LookupCall[] calls = split.getLocalCalls();
- LookupRow[][] resultArray = new LookupRow[calls.length][];
- for (int i = 0; i < calls.length; i++) {
- resultArray[i] = cache.getDataByAll(calls[i]);
- }
- split.setLocalResults(resultArray);
- }
- if (split.getRemoteCallCount() > 0) {
- LookupRow[][] resultArray = getTargetService().getBatchDataByAll(new BatchLookupCall(split.getRemoteCalls()));
- split.setRemoteResults(resultArray);
- }
- return split.getCombinedResults();
- }
-
- @Override
- public LookupRow[][] getBatchDataByRec(BatchLookupCall batch) throws ProcessingException {
- BatchSplit split = new BatchSplit(batch);
- if (split.getLocalCallCount() > 0) {
- BatchLookupResultCache cache = new BatchLookupResultCache();
- LookupCall[] calls = split.getLocalCalls();
- LookupRow[][] resultArray = new LookupRow[calls.length][];
- for (int i = 0; i < calls.length; i++) {
- resultArray[i] = cache.getDataByRec(calls[i]);
- }
- split.setLocalResults(resultArray);
- }
- if (split.getRemoteCallCount() > 0) {
- LookupRow[][] resultArray = getTargetService().getBatchDataByRec(new BatchLookupCall(split.getRemoteCalls()));
- split.setRemoteResults(resultArray);
- }
- return split.getCombinedResults();
- }
-
- private IBatchLookupService getTargetService() {
- return ServiceTunnelUtility.createProxy(IBatchLookupService.class, ClientSyncJob.getCurrentSession().getServiceTunnel());
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.lookup;
+
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.servicetunnel.ServiceTunnelUtility;
+import org.eclipse.scout.rt.shared.services.lookup.BatchLookupCall;
+import org.eclipse.scout.rt.shared.services.lookup.BatchLookupNormalizer;
+import org.eclipse.scout.rt.shared.services.lookup.BatchLookupResultCache;
+import org.eclipse.scout.rt.shared.services.lookup.IBatchLookupService;
+import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
+import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
+import org.eclipse.scout.service.AbstractService;
+
+@Priority(-3)
+public class BatchLookupServiceClientProxy extends AbstractService implements IBatchLookupService {
+
+ public BatchLookupServiceClientProxy() {
+ }
+
+ @Override
+ public LookupRow[][] getBatchDataByKey(BatchLookupCall batch) throws ProcessingException {
+ LookupCall[] allCalls = batch.getCallBatch();
+ //set calls with key==null to null
+ for (int i = 0; i < allCalls.length; i++) {
+ if (allCalls[i] != null && allCalls[i].getKey() == null) {
+ allCalls[i] = null;
+ }
+ }
+ BatchSplit split = new BatchSplit(allCalls);
+ if (split.getLocalCallCount() > 0) {
+ BatchLookupResultCache cache = new BatchLookupResultCache();
+ LookupCall[] calls = split.getLocalCalls();
+ LookupRow[][] resultArray = new LookupRow[calls.length][];
+ for (int i = 0; i < calls.length; i++) {
+ resultArray[i] = cache.getDataByKey(calls[i]);
+ }
+ split.setLocalResults(resultArray);
+ }
+ if (split.getRemoteCallCount() > 0) {
+ BatchLookupNormalizer normalizer = new BatchLookupNormalizer();
+ LookupCall[] normCallArray = normalizer.normalizeCalls(split.getRemoteCalls());
+ LookupRow[][] normResultArray = getTargetService().getBatchDataByKey(new BatchLookupCall(normCallArray));
+ LookupRow[][] resultArray = normalizer.denormalizeResults(normResultArray);
+ split.setRemoteResults(resultArray);
+ }
+ LookupRow[][] results = split.getCombinedResults();
+ //set null results to LookupRow[0]
+ for (int i = 0; i < results.length; i++) {
+ if (results[i] == null) {
+ results[i] = LookupRow.EMPTY_ARRAY;
+ }
+ }
+ return results;
+ }
+
+ @Override
+ public LookupRow[][] getBatchDataByText(BatchLookupCall batch) throws ProcessingException {
+ BatchSplit split = new BatchSplit(batch);
+ if (split.getLocalCallCount() > 0) {
+ BatchLookupResultCache cache = new BatchLookupResultCache();
+ LookupCall[] calls = split.getLocalCalls();
+ LookupRow[][] resultArray = new LookupRow[calls.length][];
+ for (int i = 0; i < calls.length; i++) {
+ resultArray[i] = cache.getDataByText(calls[i]);
+ }
+ split.setLocalResults(resultArray);
+ }
+ if (split.getRemoteCallCount() > 0) {
+ LookupRow[][] resultArray = getTargetService().getBatchDataByText(new BatchLookupCall(split.getRemoteCalls()));
+ split.setRemoteResults(resultArray);
+ }
+ return split.getCombinedResults();
+ }
+
+ @Override
+ public LookupRow[][] getBatchDataByAll(BatchLookupCall batch) throws ProcessingException {
+ BatchSplit split = new BatchSplit(batch);
+ if (split.getLocalCallCount() > 0) {
+ BatchLookupResultCache cache = new BatchLookupResultCache();
+ LookupCall[] calls = split.getLocalCalls();
+ LookupRow[][] resultArray = new LookupRow[calls.length][];
+ for (int i = 0; i < calls.length; i++) {
+ resultArray[i] = cache.getDataByAll(calls[i]);
+ }
+ split.setLocalResults(resultArray);
+ }
+ if (split.getRemoteCallCount() > 0) {
+ LookupRow[][] resultArray = getTargetService().getBatchDataByAll(new BatchLookupCall(split.getRemoteCalls()));
+ split.setRemoteResults(resultArray);
+ }
+ return split.getCombinedResults();
+ }
+
+ @Override
+ public LookupRow[][] getBatchDataByRec(BatchLookupCall batch) throws ProcessingException {
+ BatchSplit split = new BatchSplit(batch);
+ if (split.getLocalCallCount() > 0) {
+ BatchLookupResultCache cache = new BatchLookupResultCache();
+ LookupCall[] calls = split.getLocalCalls();
+ LookupRow[][] resultArray = new LookupRow[calls.length][];
+ for (int i = 0; i < calls.length; i++) {
+ resultArray[i] = cache.getDataByRec(calls[i]);
+ }
+ split.setLocalResults(resultArray);
+ }
+ if (split.getRemoteCallCount() > 0) {
+ LookupRow[][] resultArray = getTargetService().getBatchDataByRec(new BatchLookupCall(split.getRemoteCalls()));
+ split.setRemoteResults(resultArray);
+ }
+ return split.getCombinedResults();
+ }
+
+ private IBatchLookupService getTargetService() {
+ return ServiceTunnelUtility.createProxy(IBatchLookupService.class, ClientSyncJob.getCurrentSession().getServiceTunnel());
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/lookup/BatchSplit.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/lookup/BatchSplit.java
index 79320c9066..e53f7646c5 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/lookup/BatchSplit.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/lookup/BatchSplit.java
@@ -1,115 +1,115 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.lookup;
-
-import org.eclipse.scout.rt.shared.services.lookup.BatchLookupCall;
-import org.eclipse.scout.rt.shared.services.lookup.LocalLookupCall;
-import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
-import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
-
-/**
- * Split a batch into local calls and remote calls
- */
-public class BatchSplit {
- private LookupCall[] m_calls;
- private boolean[] m_local;
- private int m_localCount;
- private int m_remoteCount;
- //
- private LookupRow[][] m_results;
-
- public BatchSplit(BatchLookupCall batch) {
- this(batch.getCallBatch());
- }
-
- public BatchSplit(LookupCall[] calls) {
- m_calls = calls;
- m_local = new boolean[m_calls.length];
- for (int i = 0; i < m_calls.length; i++) {
- if (m_calls[i] != null) {
- if (m_calls[i] instanceof LocalLookupCall) {
- m_local[i] = true;
- m_localCount++;
- }
- else {
- m_local[i] = false;
- m_remoteCount++;
- }
- }
- }
- m_results = new LookupRow[m_calls.length][];
- }
-
- public int getLocalCallCount() {
- return m_localCount;
- }
-
- public LookupCall[] getLocalCalls() {
- LookupCall[] a = new LookupCall[m_localCount];
- int k = 0;
- for (int i = 0; i < m_calls.length; i++) {
- if (m_calls[i] != null) {
- if (m_local[i]) {
- a[k] = m_calls[i];
- k++;
- }
- }
- }
- return a;
- }
-
- public int getRemoteCallCount() {
- return m_remoteCount;
- }
-
- public LookupCall[] getRemoteCalls() {
- LookupCall[] a = new LookupCall[m_remoteCount];
- int k = 0;
- for (int i = 0; i < m_calls.length; i++) {
- if (m_calls[i] != null) {
- if (!m_local[i]) {
- a[k] = m_calls[i];
- k++;
- }
- }
- }
- return a;
- }
-
- public void setLocalResults(LookupRow[][] data) {
- int k = 0;
- for (int i = 0; i < m_calls.length; i++) {
- if (m_calls[i] != null) {
- if (m_local[i]) {
- m_results[i] = data[k];
- k++;
- }
- }
- }
- }
-
- public void setRemoteResults(LookupRow[][] data) {
- int k = 0;
- for (int i = 0; i < m_calls.length; i++) {
- if (m_calls[i] != null) {
- if (!m_local[i]) {
- m_results[i] = data[k];
- k++;
- }
- }
- }
- }
-
- public LookupRow[][] getCombinedResults() {
- return m_results;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.lookup;
+
+import org.eclipse.scout.rt.shared.services.lookup.BatchLookupCall;
+import org.eclipse.scout.rt.shared.services.lookup.LocalLookupCall;
+import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
+import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
+
+/**
+ * Split a batch into local calls and remote calls
+ */
+public class BatchSplit {
+ private LookupCall[] m_calls;
+ private boolean[] m_local;
+ private int m_localCount;
+ private int m_remoteCount;
+ //
+ private LookupRow[][] m_results;
+
+ public BatchSplit(BatchLookupCall batch) {
+ this(batch.getCallBatch());
+ }
+
+ public BatchSplit(LookupCall[] calls) {
+ m_calls = calls;
+ m_local = new boolean[m_calls.length];
+ for (int i = 0; i < m_calls.length; i++) {
+ if (m_calls[i] != null) {
+ if (m_calls[i] instanceof LocalLookupCall) {
+ m_local[i] = true;
+ m_localCount++;
+ }
+ else {
+ m_local[i] = false;
+ m_remoteCount++;
+ }
+ }
+ }
+ m_results = new LookupRow[m_calls.length][];
+ }
+
+ public int getLocalCallCount() {
+ return m_localCount;
+ }
+
+ public LookupCall[] getLocalCalls() {
+ LookupCall[] a = new LookupCall[m_localCount];
+ int k = 0;
+ for (int i = 0; i < m_calls.length; i++) {
+ if (m_calls[i] != null) {
+ if (m_local[i]) {
+ a[k] = m_calls[i];
+ k++;
+ }
+ }
+ }
+ return a;
+ }
+
+ public int getRemoteCallCount() {
+ return m_remoteCount;
+ }
+
+ public LookupCall[] getRemoteCalls() {
+ LookupCall[] a = new LookupCall[m_remoteCount];
+ int k = 0;
+ for (int i = 0; i < m_calls.length; i++) {
+ if (m_calls[i] != null) {
+ if (!m_local[i]) {
+ a[k] = m_calls[i];
+ k++;
+ }
+ }
+ }
+ return a;
+ }
+
+ public void setLocalResults(LookupRow[][] data) {
+ int k = 0;
+ for (int i = 0; i < m_calls.length; i++) {
+ if (m_calls[i] != null) {
+ if (m_local[i]) {
+ m_results[i] = data[k];
+ k++;
+ }
+ }
+ }
+ }
+
+ public void setRemoteResults(LookupRow[][] data) {
+ int k = 0;
+ for (int i = 0; i < m_calls.length; i++) {
+ if (m_calls[i] != null) {
+ if (!m_local[i]) {
+ m_results[i] = data[k];
+ k++;
+ }
+ }
+ }
+ }
+
+ public LookupRow[][] getCombinedResults() {
+ return m_results;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/lookup/DefaultLookupCallProvisioningService.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/lookup/DefaultLookupCallProvisioningService.java
index 24f3caee1d..0d9886b259 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/lookup/DefaultLookupCallProvisioningService.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/lookup/DefaultLookupCallProvisioningService.java
@@ -1,28 +1,28 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.lookup;
-
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
-import org.eclipse.scout.service.AbstractService;
-
-/**
- * @since 3.8.1
- */
-@Priority(-1)
-public class DefaultLookupCallProvisioningService extends AbstractService implements ILookupCallProvisioningService {
-
- @Override
- public LookupCall newClonedInstance(LookupCall templateCall, IProvisioningContext context) {
- return (LookupCall) templateCall.clone();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.lookup;
+
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
+import org.eclipse.scout.service.AbstractService;
+
+/**
+ * @since 3.8.1
+ */
+@Priority(-1)
+public class DefaultLookupCallProvisioningService extends AbstractService implements ILookupCallProvisioningService {
+
+ @Override
+ public LookupCall newClonedInstance(LookupCall templateCall, IProvisioningContext context) {
+ return (LookupCall) templateCall.clone();
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/lookup/FormFieldProvisioningContext.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/lookup/FormFieldProvisioningContext.java
index 5d88815579..54b25faca4 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/lookup/FormFieldProvisioningContext.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/lookup/FormFieldProvisioningContext.java
@@ -1,25 +1,25 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.lookup;
-
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-
-public class FormFieldProvisioningContext implements IProvisioningContext {
- private final IFormField m_field;
-
- public FormFieldProvisioningContext(IFormField f) {
- m_field = f;
- }
-
- public IFormField getField() {
- return m_field;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.lookup;
+
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+
+public class FormFieldProvisioningContext implements IProvisioningContext {
+ private final IFormField m_field;
+
+ public FormFieldProvisioningContext(IFormField f) {
+ m_field = f;
+ }
+
+ public IFormField getField() {
+ return m_field;
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/lookup/ILookupCallProvisioningService.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/lookup/ILookupCallProvisioningService.java
index 021d418701..508bff879b 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/lookup/ILookupCallProvisioningService.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/lookup/ILookupCallProvisioningService.java
@@ -1,40 +1,40 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.lookup;
-
-import org.eclipse.scout.rt.client.ui.basic.table.columns.ISmartColumn;
-import org.eclipse.scout.rt.client.ui.form.fields.listbox.IListBox;
-import org.eclipse.scout.rt.client.ui.form.fields.radiobuttongroup.IRadioButtonGroup;
-import org.eclipse.scout.rt.client.ui.form.fields.smartfield.ISmartField;
-import org.eclipse.scout.rt.client.ui.form.fields.treebox.ITreeBox;
-import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
-import org.eclipse.scout.service.IService;
-
-/**
- * This service creates lookup call instances from lookup call templates.
- * <p>
- * Callers are fields and components that deal with getConfiguredLookupCall and getConfiguredCodeType and create new
- * instances usign clone().
- * <p>
- * Known are {@link ISmartField}, {@link IListBox}, {@link ITreeBox}, {@link IRadioButtonGroup}, {@link ISmartColumn}
- * <p>
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=388242
- *
- * @since 3.8.1
- */
-public interface ILookupCallProvisioningService extends IService {
-
- /**
- * @return a new cloned and provisioned instance of the lookup call template.
- */
- LookupCall newClonedInstance(LookupCall templateCall, IProvisioningContext context);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.lookup;
+
+import org.eclipse.scout.rt.client.ui.basic.table.columns.ISmartColumn;
+import org.eclipse.scout.rt.client.ui.form.fields.listbox.IListBox;
+import org.eclipse.scout.rt.client.ui.form.fields.radiobuttongroup.IRadioButtonGroup;
+import org.eclipse.scout.rt.client.ui.form.fields.smartfield.ISmartField;
+import org.eclipse.scout.rt.client.ui.form.fields.treebox.ITreeBox;
+import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
+import org.eclipse.scout.service.IService;
+
+/**
+ * This service creates lookup call instances from lookup call templates.
+ * <p>
+ * Callers are fields and components that deal with getConfiguredLookupCall and getConfiguredCodeType and create new
+ * instances usign clone().
+ * <p>
+ * Known are {@link ISmartField}, {@link IListBox}, {@link ITreeBox}, {@link IRadioButtonGroup}, {@link ISmartColumn}
+ * <p>
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=388242
+ *
+ * @since 3.8.1
+ */
+public interface ILookupCallProvisioningService extends IService {
+
+ /**
+ * @return a new cloned and provisioned instance of the lookup call template.
+ */
+ LookupCall newClonedInstance(LookupCall templateCall, IProvisioningContext context);
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/lookup/IProvisioningContext.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/lookup/IProvisioningContext.java
index b3e5b266a2..f57996a8e4 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/lookup/IProvisioningContext.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/lookup/IProvisioningContext.java
@@ -1,18 +1,18 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.lookup;
-
-/**
- * Marker interface used for all {@link ILookupCallProvisioningService} context parameter types.
- */
-public interface IProvisioningContext {
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.lookup;
+
+/**
+ * Marker interface used for all {@link ILookupCallProvisioningService} context parameter types.
+ */
+public interface IProvisioningContext {
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/lookup/TableProvisioningContext.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/lookup/TableProvisioningContext.java
index c51a1b6825..deba36e4c8 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/lookup/TableProvisioningContext.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/services/lookup/TableProvisioningContext.java
@@ -1,39 +1,39 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.services.lookup;
-
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-
-public class TableProvisioningContext implements IProvisioningContext {
- private final ITable m_table;
- private final ITableRow m_row;
- private final IColumn<?> m_column;
-
- public TableProvisioningContext(ITable table, ITableRow row, IColumn<?> column) {
- m_table = table;
- m_row = row;
- m_column = column;
- }
-
- public ITable getTable() {
- return m_table;
- }
-
- public ITableRow getRow() {
- return m_row;
- }
-
- public IColumn<?> getColumn() {
- return m_column;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.services.lookup;
+
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+
+public class TableProvisioningContext implements IProvisioningContext {
+ private final ITable m_table;
+ private final ITableRow m_row;
+ private final IColumn<?> m_column;
+
+ public TableProvisioningContext(ITable table, ITableRow row, IColumn<?> column) {
+ m_table = table;
+ m_row = row;
+ m_column = column;
+ }
+
+ public ITable getTable() {
+ return m_table;
+ }
+
+ public ITableRow getRow() {
+ return m_row;
+ }
+
+ public IColumn<?> getColumn() {
+ return m_column;
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/servicetunnel/AbstractServiceTunnel.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/servicetunnel/AbstractServiceTunnel.java
index b2f4af6526..79329669bf 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/servicetunnel/AbstractServiceTunnel.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/servicetunnel/AbstractServiceTunnel.java
@@ -1,235 +1,235 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.servicetunnel;
-
-import java.lang.reflect.Method;
-import java.net.URL;
-import java.security.PrivilegedAction;
-import java.util.Arrays;
-
-import javax.security.auth.Subject;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.scout.commons.VerboseUtility;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ClientJob;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.client.services.common.clientnotification.IClientNotificationConsumerService;
-import org.eclipse.scout.rt.client.services.common.exceptionhandler.ErrorHandler;
-import org.eclipse.scout.rt.client.services.common.perf.IPerformanceAnalyzerService;
-import org.eclipse.scout.rt.shared.OfflineState;
-import org.eclipse.scout.rt.shared.services.common.offline.IOfflineDispatcherService;
-import org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelRequest;
-import org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelResponse;
-import org.eclipse.scout.rt.shared.servicetunnel.VersionMismatchException;
-import org.eclipse.scout.service.SERVICES;
-import org.eclipse.scout.service.ServiceUtility;
-
-/**
- * Service tunnel is Thread-Safe
- */
-public abstract class AbstractServiceTunnel implements IServiceTunnel {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractServiceTunnel.class);
-
- private final String m_version;
- private URL m_serverURL;
- private final IClientSession m_clientSession;
- private long m_pollInterval = -1L;
- private boolean m_analyzeNetworkLatency = true;
-
- /**
- * If the version parameter is null, the product bundle (e.g.
- * com.bsiag.crm.ui.swing) version is used
- */
- public AbstractServiceTunnel(IClientSession session, String version) {
- m_clientSession = session;
- if (version == null) {
- if (Platform.getProduct() != null) {
- version = (String) Platform.getProduct().getDefiningBundle().getHeaders().get("Bundle-Version");
- }
- }
- m_version = version;
- }
-
- @Override
- public void setClientNotificationPollInterval(long intervallMillis) {
- m_pollInterval = intervallMillis;
- }
-
- @Override
- public long getClientNotificationPollInterval() {
- return m_pollInterval;
- }
-
- @Override
- public boolean isAnalyzeNetworkLatency() {
- return m_analyzeNetworkLatency;
- }
-
- @Override
- public void setAnalyzeNetworkLatency(boolean b) {
- m_analyzeNetworkLatency = b;
- }
-
- public String getVersion() {
- return m_version;
- }
-
- @Override
- public URL getServerURL() {
- return m_serverURL;
- }
-
- @Override
- public void setServerURL(URL url) {
- m_serverURL = url;
- }
-
- public IClientSession getClientSession() {
- return m_clientSession;
- }
-
- @Override
- public Object invokeService(Class serviceInterfaceClass, Method operation, Object[] callerArgs) throws ProcessingException {
- if (getServerURL() == null) {
- throw new ProcessingException("serverURL is null. Check proxyHandler extension. Example value is: http://localhost:8080/myapp/process");
- }
- long t0 = System.nanoTime();
- try {
- if (callerArgs == null) {
- callerArgs = new Object[0];
- }
- if (LOG.isDebugEnabled()) {
- LOG.debug("" + serviceInterfaceClass + "." + operation + "(" + Arrays.asList(callerArgs) + ")");
- }
- Object[] serializableArgs = ServiceUtility.filterHolderArguments(callerArgs);
- ServiceTunnelRequest call = new ServiceTunnelRequest(getVersion(), serviceInterfaceClass, operation, serializableArgs);
- call.setClientSubject(getClientSession().getSubject());
- call.setVirtualSessionId(getClientSession().getVirtualSessionId());
- call.setUserAgent(getClientSession().getUserAgent().createIdentifier());
- //
- ServiceTunnelResponse response = tunnel(call);
- // check if response is interrupted (incomplete /null=interrupted)
- if (response == null) {
- response = new ServiceTunnelResponse(null, null, new InterruptedException());
- }
- // performance analyzer
- IPerformanceAnalyzerService perf = SERVICES.getService(IPerformanceAnalyzerService.class);
- if (perf != null) {
- long totalMillis = (System.nanoTime() - t0) / 1000000L;
- Long execMillis = response.getProcessingDuration();
- if (execMillis != null) {
- perf.addNetworkLatencySample(totalMillis - execMillis);
- perf.addServerExecutionTimeSample(execMillis);
- }
- else {
- perf.addNetworkLatencySample(totalMillis);
- }
- }
- // client notification handler
- IClientNotificationConsumerService cns = SERVICES.getService(IClientNotificationConsumerService.class);
- if (cns != null) {
- cns.dispatchClientNotifications(response.getClientNotifications(), m_clientSession);
- }
- // error handler
- Throwable t = response.getException();
- if (t != null) {
- String msg = "Calling " + serviceInterfaceClass.getSimpleName() + "." + operation.getName() + "()";
- ProcessingException pe;
- if (t instanceof VersionMismatchException) {
- VersionMismatchException ve = (VersionMismatchException) t;
- handleVersionMismatch(ve);
- pe = ve;
- }
- else if (t instanceof ProcessingException) {
- ((ProcessingException) t).addContextMessage(msg);
- pe = (ProcessingException) t;
- }
- else {
- pe = new ProcessingException(msg, t);
- }
- // combine local and remote stacktraces
- StackTraceElement[] trace1 = pe.getStackTrace();
- StackTraceElement[] trace2 = new Exception().getStackTrace();
- StackTraceElement[] both = new StackTraceElement[trace1.length + trace2.length];
- System.arraycopy(trace1, 0, both, 0, trace1.length);
- System.arraycopy(trace2, 0, both, trace1.length, trace2.length);
- pe.setStackTrace(both);
- throw pe;
- }
- ServiceUtility.updateHolderArguments(callerArgs, response.getOutVars(), false);
- return response.getData();
- }
- catch (Throwable t) {
- if (t instanceof ProcessingException) {
- throw (ProcessingException) t;
- }
- else {
- throw new ProcessingException(serviceInterfaceClass.getSimpleName() + "." + operation.getName() + "(" + VerboseUtility.dumpObjects(callerArgs) + ")", t);
- }
- }
- }
-
- protected ServiceTunnelResponse tunnel(ServiceTunnelRequest call) {
- boolean offline = OfflineState.isOfflineInCurrentThread();
- //
- if (offline) {
- return tunnelOffline(call);
- }
- else {
- return tunnelOnline(call);
- }
- }
-
- protected abstract ServiceTunnelResponse tunnelOnline(ServiceTunnelRequest call);
-
- /**
- * @deprecated version mismatch is handled in the {@link ErrorHandler}
- */
- @Deprecated
- protected void handleVersionMismatch(final VersionMismatchException ve) {
- }
-
- /**
- * Default for offline handling
- */
- protected ServiceTunnelResponse tunnelOffline(final ServiceTunnelRequest call) {
- final IProgressMonitor monitor;
- Job job = Job.getJobManager().currentJob();
- if (job instanceof ClientJob) {
- monitor = ((ClientJob) job).getMonitor();
- }
- else {
- monitor = new NullProgressMonitor();
- }
-
- IClientSession clientSession = ClientSyncJob.getCurrentSession();
- if (clientSession != null && clientSession.getOfflineSubject() != null) {
- Object response = Subject.doAs(clientSession.getOfflineSubject(), new PrivilegedAction<ServiceTunnelResponse>() {
- @Override
- public ServiceTunnelResponse run() {
- return SERVICES.getService(IOfflineDispatcherService.class).dispatch(call, monitor);
- }
- });
- return (ServiceTunnelResponse) response;
- }
- else {
- return SERVICES.getService(IOfflineDispatcherService.class).dispatch(call, monitor);
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.servicetunnel;
+
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.security.PrivilegedAction;
+import java.util.Arrays;
+
+import javax.security.auth.Subject;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.scout.commons.VerboseUtility;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ClientJob;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.client.services.common.clientnotification.IClientNotificationConsumerService;
+import org.eclipse.scout.rt.client.services.common.exceptionhandler.ErrorHandler;
+import org.eclipse.scout.rt.client.services.common.perf.IPerformanceAnalyzerService;
+import org.eclipse.scout.rt.shared.OfflineState;
+import org.eclipse.scout.rt.shared.services.common.offline.IOfflineDispatcherService;
+import org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelRequest;
+import org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelResponse;
+import org.eclipse.scout.rt.shared.servicetunnel.VersionMismatchException;
+import org.eclipse.scout.service.SERVICES;
+import org.eclipse.scout.service.ServiceUtility;
+
+/**
+ * Service tunnel is Thread-Safe
+ */
+public abstract class AbstractServiceTunnel implements IServiceTunnel {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractServiceTunnel.class);
+
+ private final String m_version;
+ private URL m_serverURL;
+ private final IClientSession m_clientSession;
+ private long m_pollInterval = -1L;
+ private boolean m_analyzeNetworkLatency = true;
+
+ /**
+ * If the version parameter is null, the product bundle (e.g.
+ * com.bsiag.crm.ui.swing) version is used
+ */
+ public AbstractServiceTunnel(IClientSession session, String version) {
+ m_clientSession = session;
+ if (version == null) {
+ if (Platform.getProduct() != null) {
+ version = (String) Platform.getProduct().getDefiningBundle().getHeaders().get("Bundle-Version");
+ }
+ }
+ m_version = version;
+ }
+
+ @Override
+ public void setClientNotificationPollInterval(long intervallMillis) {
+ m_pollInterval = intervallMillis;
+ }
+
+ @Override
+ public long getClientNotificationPollInterval() {
+ return m_pollInterval;
+ }
+
+ @Override
+ public boolean isAnalyzeNetworkLatency() {
+ return m_analyzeNetworkLatency;
+ }
+
+ @Override
+ public void setAnalyzeNetworkLatency(boolean b) {
+ m_analyzeNetworkLatency = b;
+ }
+
+ public String getVersion() {
+ return m_version;
+ }
+
+ @Override
+ public URL getServerURL() {
+ return m_serverURL;
+ }
+
+ @Override
+ public void setServerURL(URL url) {
+ m_serverURL = url;
+ }
+
+ public IClientSession getClientSession() {
+ return m_clientSession;
+ }
+
+ @Override
+ public Object invokeService(Class serviceInterfaceClass, Method operation, Object[] callerArgs) throws ProcessingException {
+ if (getServerURL() == null) {
+ throw new ProcessingException("serverURL is null. Check proxyHandler extension. Example value is: http://localhost:8080/myapp/process");
+ }
+ long t0 = System.nanoTime();
+ try {
+ if (callerArgs == null) {
+ callerArgs = new Object[0];
+ }
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("" + serviceInterfaceClass + "." + operation + "(" + Arrays.asList(callerArgs) + ")");
+ }
+ Object[] serializableArgs = ServiceUtility.filterHolderArguments(callerArgs);
+ ServiceTunnelRequest call = new ServiceTunnelRequest(getVersion(), serviceInterfaceClass, operation, serializableArgs);
+ call.setClientSubject(getClientSession().getSubject());
+ call.setVirtualSessionId(getClientSession().getVirtualSessionId());
+ call.setUserAgent(getClientSession().getUserAgent().createIdentifier());
+ //
+ ServiceTunnelResponse response = tunnel(call);
+ // check if response is interrupted (incomplete /null=interrupted)
+ if (response == null) {
+ response = new ServiceTunnelResponse(null, null, new InterruptedException());
+ }
+ // performance analyzer
+ IPerformanceAnalyzerService perf = SERVICES.getService(IPerformanceAnalyzerService.class);
+ if (perf != null) {
+ long totalMillis = (System.nanoTime() - t0) / 1000000L;
+ Long execMillis = response.getProcessingDuration();
+ if (execMillis != null) {
+ perf.addNetworkLatencySample(totalMillis - execMillis);
+ perf.addServerExecutionTimeSample(execMillis);
+ }
+ else {
+ perf.addNetworkLatencySample(totalMillis);
+ }
+ }
+ // client notification handler
+ IClientNotificationConsumerService cns = SERVICES.getService(IClientNotificationConsumerService.class);
+ if (cns != null) {
+ cns.dispatchClientNotifications(response.getClientNotifications(), m_clientSession);
+ }
+ // error handler
+ Throwable t = response.getException();
+ if (t != null) {
+ String msg = "Calling " + serviceInterfaceClass.getSimpleName() + "." + operation.getName() + "()";
+ ProcessingException pe;
+ if (t instanceof VersionMismatchException) {
+ VersionMismatchException ve = (VersionMismatchException) t;
+ handleVersionMismatch(ve);
+ pe = ve;
+ }
+ else if (t instanceof ProcessingException) {
+ ((ProcessingException) t).addContextMessage(msg);
+ pe = (ProcessingException) t;
+ }
+ else {
+ pe = new ProcessingException(msg, t);
+ }
+ // combine local and remote stacktraces
+ StackTraceElement[] trace1 = pe.getStackTrace();
+ StackTraceElement[] trace2 = new Exception().getStackTrace();
+ StackTraceElement[] both = new StackTraceElement[trace1.length + trace2.length];
+ System.arraycopy(trace1, 0, both, 0, trace1.length);
+ System.arraycopy(trace2, 0, both, trace1.length, trace2.length);
+ pe.setStackTrace(both);
+ throw pe;
+ }
+ ServiceUtility.updateHolderArguments(callerArgs, response.getOutVars(), false);
+ return response.getData();
+ }
+ catch (Throwable t) {
+ if (t instanceof ProcessingException) {
+ throw (ProcessingException) t;
+ }
+ else {
+ throw new ProcessingException(serviceInterfaceClass.getSimpleName() + "." + operation.getName() + "(" + VerboseUtility.dumpObjects(callerArgs) + ")", t);
+ }
+ }
+ }
+
+ protected ServiceTunnelResponse tunnel(ServiceTunnelRequest call) {
+ boolean offline = OfflineState.isOfflineInCurrentThread();
+ //
+ if (offline) {
+ return tunnelOffline(call);
+ }
+ else {
+ return tunnelOnline(call);
+ }
+ }
+
+ protected abstract ServiceTunnelResponse tunnelOnline(ServiceTunnelRequest call);
+
+ /**
+ * @deprecated version mismatch is handled in the {@link ErrorHandler}
+ */
+ @Deprecated
+ protected void handleVersionMismatch(final VersionMismatchException ve) {
+ }
+
+ /**
+ * Default for offline handling
+ */
+ protected ServiceTunnelResponse tunnelOffline(final ServiceTunnelRequest call) {
+ final IProgressMonitor monitor;
+ Job job = Job.getJobManager().currentJob();
+ if (job instanceof ClientJob) {
+ monitor = ((ClientJob) job).getMonitor();
+ }
+ else {
+ monitor = new NullProgressMonitor();
+ }
+
+ IClientSession clientSession = ClientSyncJob.getCurrentSession();
+ if (clientSession != null && clientSession.getOfflineSubject() != null) {
+ Object response = Subject.doAs(clientSession.getOfflineSubject(), new PrivilegedAction<ServiceTunnelResponse>() {
+ @Override
+ public ServiceTunnelResponse run() {
+ return SERVICES.getService(IOfflineDispatcherService.class).dispatch(call, monitor);
+ }
+ });
+ return (ServiceTunnelResponse) response;
+ }
+ else {
+ return SERVICES.getService(IOfflineDispatcherService.class).dispatch(call, monitor);
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/servicetunnel/IServiceTunnel.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/servicetunnel/IServiceTunnel.java
index f5f353caa5..03080065e9 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/servicetunnel/IServiceTunnel.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/servicetunnel/IServiceTunnel.java
@@ -1,62 +1,62 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.servicetunnel;
-
-import java.lang.reflect.Method;
-import java.net.URL;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.shared.services.common.clientnotification.IClientNotification;
-
-public interface IServiceTunnel {
-
- /**
- * Invoke a remote service through a service tunnel<br>
- * The argument array may contain IHolder values which are updated as OUT
- * parameters when the backend call has completed flags are custom flags not
- * used by the framework itself
- */
- Object invokeService(Class<?> serviceInterfaceClass, Method operation, Object[] args) throws ProcessingException;
-
- URL getServerURL();
-
- void setServerURL(URL url);
-
- /**
- * see {@link #setClientNotificationPollInterval(long)} default is -1L (turned
- * off), when activated a value of 2000L is recommended.
- */
- long getClientNotificationPollInterval();
-
- /**
- * Set the intervall to automatically read {@link IClientNotification}s from
- * the server. A negative value disables polling. Note: {@link IClientNotification}s are also recevied on every tunnel
- * reponse from
- * the server.
- */
- void setClientNotificationPollInterval(long intervallMillis);
-
- /**
- * see {@link #setAnalyzeNetworkLatency(boolean)} default is true
- */
- boolean isAnalyzeNetworkLatency();
-
- /**
- * If true the client notification polling process analyzes network latency to
- * optimize the poll interval in order to save the network. for Experts:
- * constant N is defined as: N=10 Assertion is: pollInterval >
- * N*networkLatency Example: the initial pollInterval is 2000ms and the moving
- * average of the networkLatency reaches 700ms, then the used polling interval
- * will be max(2000ms,N*700ms) -> 7000ms
- */
- void setAnalyzeNetworkLatency(boolean b);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.servicetunnel;
+
+import java.lang.reflect.Method;
+import java.net.URL;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.shared.services.common.clientnotification.IClientNotification;
+
+public interface IServiceTunnel {
+
+ /**
+ * Invoke a remote service through a service tunnel<br>
+ * The argument array may contain IHolder values which are updated as OUT
+ * parameters when the backend call has completed flags are custom flags not
+ * used by the framework itself
+ */
+ Object invokeService(Class<?> serviceInterfaceClass, Method operation, Object[] args) throws ProcessingException;
+
+ URL getServerURL();
+
+ void setServerURL(URL url);
+
+ /**
+ * see {@link #setClientNotificationPollInterval(long)} default is -1L (turned
+ * off), when activated a value of 2000L is recommended.
+ */
+ long getClientNotificationPollInterval();
+
+ /**
+ * Set the intervall to automatically read {@link IClientNotification}s from
+ * the server. A negative value disables polling. Note: {@link IClientNotification}s are also recevied on every tunnel
+ * reponse from
+ * the server.
+ */
+ void setClientNotificationPollInterval(long intervallMillis);
+
+ /**
+ * see {@link #setAnalyzeNetworkLatency(boolean)} default is true
+ */
+ boolean isAnalyzeNetworkLatency();
+
+ /**
+ * If true the client notification polling process analyzes network latency to
+ * optimize the poll interval in order to save the network. for Experts:
+ * constant N is defined as: N=10 Assertion is: pollInterval >
+ * N*networkLatency Example: the initial pollInterval is 2000ms and the moving
+ * average of the networkLatency reaches 700ms, then the used polling interval
+ * will be max(2000ms,N*700ms) -> 7000ms
+ */
+ void setAnalyzeNetworkLatency(boolean b);
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/servicetunnel/ServiceTunnelInvocationHandler.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/servicetunnel/ServiceTunnelInvocationHandler.java
index cf1c30e541..ba2e8fcde7 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/servicetunnel/ServiceTunnelInvocationHandler.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/servicetunnel/ServiceTunnelInvocationHandler.java
@@ -1,54 +1,54 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.servicetunnel;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-
-import org.eclipse.scout.commons.VerboseUtility;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-
-/**
- * java proxy handler through a service tunnel
- */
-public class ServiceTunnelInvocationHandler implements InvocationHandler {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(ServiceTunnelInvocationHandler.class);
-
- private final Class<?> m_serviceInterfaceClass;
- private final IServiceTunnel m_tunnel;
-
- public ServiceTunnelInvocationHandler(Class<?> serviceInterfaceClass, IServiceTunnel tunnel) {
- if (serviceInterfaceClass == null) {
- throw new IllegalArgumentException("serviceInterfaceClass must not be null");
- }
- if (tunnel == null) {
- throw new IllegalArgumentException("tunnel must not be null");
- }
- m_serviceInterfaceClass = serviceInterfaceClass;
- m_tunnel = tunnel;
- }
-
- @Override
- public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
- // only proxy methods that are on the IService interface
- if (Object.class.isAssignableFrom(method.getDeclaringClass())) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Soap call to " + m_serviceInterfaceClass.getName() + "." + method.getName() + "(" + VerboseUtility.dumpObjects(args) + ")");
- }
- return m_tunnel.invokeService(m_serviceInterfaceClass, method, args);
- }
- else {
- return getClass().getMethod(method.getName(), method.getParameterTypes()).invoke(this, args);
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.servicetunnel;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+
+import org.eclipse.scout.commons.VerboseUtility;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+
+/**
+ * java proxy handler through a service tunnel
+ */
+public class ServiceTunnelInvocationHandler implements InvocationHandler {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(ServiceTunnelInvocationHandler.class);
+
+ private final Class<?> m_serviceInterfaceClass;
+ private final IServiceTunnel m_tunnel;
+
+ public ServiceTunnelInvocationHandler(Class<?> serviceInterfaceClass, IServiceTunnel tunnel) {
+ if (serviceInterfaceClass == null) {
+ throw new IllegalArgumentException("serviceInterfaceClass must not be null");
+ }
+ if (tunnel == null) {
+ throw new IllegalArgumentException("tunnel must not be null");
+ }
+ m_serviceInterfaceClass = serviceInterfaceClass;
+ m_tunnel = tunnel;
+ }
+
+ @Override
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+ // only proxy methods that are on the IService interface
+ if (Object.class.isAssignableFrom(method.getDeclaringClass())) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Soap call to " + m_serviceInterfaceClass.getName() + "." + method.getName() + "(" + VerboseUtility.dumpObjects(args) + ")");
+ }
+ return m_tunnel.invokeService(m_serviceInterfaceClass, method, args);
+ }
+ else {
+ return getClass().getMethod(method.getName(), method.getParameterTypes()).invoke(this, args);
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/servicetunnel/ServiceTunnelUtility.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/servicetunnel/ServiceTunnelUtility.java
index ccce4ada45..a4a2929f32 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/servicetunnel/ServiceTunnelUtility.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/servicetunnel/ServiceTunnelUtility.java
@@ -1,47 +1,47 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.servicetunnel;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Proxy;
-
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-
-/**
- * Create a service proxy through a tunnel
- */
-public final class ServiceTunnelUtility {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(ServiceTunnelUtility.class);
-
- private ServiceTunnelUtility() {
- }
-
- public static <T> T createProxy(Class<T> serviceInterfaceClass, IServiceTunnel tunnel) {
- if (tunnel == null) {
- throw new IllegalArgumentException("tunnel is null");
- }
- return createProxy(serviceInterfaceClass, new ServiceTunnelInvocationHandler(serviceInterfaceClass, tunnel));
- }
-
- @SuppressWarnings("unchecked")
- public static <T> T createProxy(Class<T> serviceInterfaceClass, InvocationHandler handler) {
- if (handler == null) {
- throw new IllegalArgumentException("handler is null");
- }
- return (T) Proxy.newProxyInstance(
- serviceInterfaceClass.getClassLoader(),
- new Class[]{serviceInterfaceClass},
- handler
- );
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.servicetunnel;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Proxy;
+
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+
+/**
+ * Create a service proxy through a tunnel
+ */
+public final class ServiceTunnelUtility {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(ServiceTunnelUtility.class);
+
+ private ServiceTunnelUtility() {
+ }
+
+ public static <T> T createProxy(Class<T> serviceInterfaceClass, IServiceTunnel tunnel) {
+ if (tunnel == null) {
+ throw new IllegalArgumentException("tunnel is null");
+ }
+ return createProxy(serviceInterfaceClass, new ServiceTunnelInvocationHandler(serviceInterfaceClass, tunnel));
+ }
+
+ @SuppressWarnings("unchecked")
+ public static <T> T createProxy(Class<T> serviceInterfaceClass, InvocationHandler handler) {
+ if (handler == null) {
+ throw new IllegalArgumentException("handler is null");
+ }
+ return (T) Proxy.newProxyInstance(
+ serviceInterfaceClass.getClassLoader(),
+ new Class[]{serviceInterfaceClass},
+ handler
+ );
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/servicetunnel/http/HttpServiceTunnel.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/servicetunnel/http/HttpServiceTunnel.java
index b292eafb91..10c7073652 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/servicetunnel/http/HttpServiceTunnel.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/servicetunnel/http/HttpServiceTunnel.java
@@ -1,151 +1,151 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.servicetunnel.http;
-
-import java.io.IOException;
-import java.lang.reflect.Method;
-import java.net.URLConnection;
-
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.client.servicetunnel.http.internal.InternalHttpServiceTunnel;
-import org.eclipse.scout.rt.shared.servicetunnel.DefaultServiceTunnelContentHandler;
-import org.eclipse.scout.rt.shared.servicetunnel.IServiceTunnelContentHandler;
-import org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelRequest;
-import org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelResponse;
-
-public class HttpServiceTunnel extends InternalHttpServiceTunnel {
- public static final String HTTP_DEBUG_PARAM = "org.eclipse.scout.rt.client.http.debug";
-
- public HttpServiceTunnel(IClientSession session, String url) throws ProcessingException {
- super(session, url);
- }
-
- /**
- * @param url
- * @param version
- * the version that is sent down to the server with every request.
- * This allows the server to check client request and refuse old
- * clients. Check the servers HttpProxyHandlerServlet init-parameter
- * (example: min-version="0.0.0") If the version parameter is null,
- * the product bundle (for example com.myapp.ui.swing) version is
- * used
- */
- public HttpServiceTunnel(IClientSession session, String url, String version) throws ProcessingException {
- super(session, url, version);
- }
-
- @Override
- public void setAnalyzeNetworkLatency(boolean b) {
- super.setAnalyzeNetworkLatency(b);
- }
-
- @Override
- public void setClientNotificationPollInterval(long intervallMillis) {
- super.setClientNotificationPollInterval(intervallMillis);
- }
-
- /**
- * @param call
- * the original call
- * @param callData
- * the data created by the {@link IServiceTunnelContentHandler} used
- * by this tunnel Create url connection and write post data (if
- * required)
- * @throws IOException
- * override this method to customize the creation of the {@link URLConnection} see
- * {@link #addCustomHeaders(URLConnection, String)}
- */
- @Override
- protected URLConnection createURLConnection(ServiceTunnelRequest call, byte[] callData) throws IOException {
- return super.createURLConnection(call, callData);
- }
-
- /**
- * Signals the server to cancel processing jobs for the current session.
- *
- * @return true if cancel was successful and transaction was in fact cancelled, false otherwise
- */
- @Override
- protected boolean sendCancelRequest(long requestSequence) {
- return super.sendCancelRequest(requestSequence);
- }
-
- /**
- * @param method
- * GET or POST override this method to add custom HTTP headers
- */
- @Override
- protected void addCustomHeaders(URLConnection urlConn, String method) throws IOException {
- super.addCustomHeaders(urlConn, method);
- }
-
- /**
- * @return msgEncoder used to encode and decode a request / response to and
- * from the binary stream. Default is the {@link DefaultServiceTunnelContentHandler} which handles soap style
- * messages
- */
- @Override
- public IServiceTunnelContentHandler getContentHandler() {
- return super.getContentHandler();
- }
-
- /**
- * @param msgEncoder
- * that can encode and decode a request / response to and from the
- * binary stream. Default is the {@link DefaultServiceTunnelContentHandler} which handles soap
- * style messages
- */
- @Override
- public void setContentHandler(IServiceTunnelContentHandler e) {
- super.setContentHandler(e);
- }
-
- @Override
- public Object invokeService(Class serviceInterfaceClass, Method operation, Object[] callerArgs) throws ProcessingException {
- return super.invokeService(serviceInterfaceClass, operation, callerArgs);
- }
-
- @Override
- protected ServiceTunnelResponse tunnelOnline(final ServiceTunnelRequest call) {
- try {
- //if (!call.getOperation().equals("ping")) TuningUtility.startTimer();
- return super.tunnelOnline(call);
- }
- finally {
- //if (!call.getOperation().equals("ping")) TuningUtility.stopTimer("tunnelOnline " + call);
- }
- }
-
- /**
- * Override this method to decide when background jobs to the backend should be presented to the user or not (for
- * cancelling)
- * The default makes all jobs cancellable except IPingService (used for client notification polling)
- */
- @Override
- protected void decorateBackgroundJob(ServiceTunnelRequest call, Job backgroundJob) {
- super.decorateBackgroundJob(call, backgroundJob);
- }
-
- /**
- * This method is called just after the http response is received but before
- * the http response is processed by scout. This might be used to read and
- * interpret custom http headers.
- *
- * @since 06.07.2009
- */
- @Override
- protected void preprocessHttpRepsonse(URLConnection urlConn, ServiceTunnelRequest call, int httpCode) {
- super.preprocessHttpRepsonse(urlConn, call, httpCode);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.servicetunnel.http;
+
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.net.URLConnection;
+
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.client.servicetunnel.http.internal.InternalHttpServiceTunnel;
+import org.eclipse.scout.rt.shared.servicetunnel.DefaultServiceTunnelContentHandler;
+import org.eclipse.scout.rt.shared.servicetunnel.IServiceTunnelContentHandler;
+import org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelRequest;
+import org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelResponse;
+
+public class HttpServiceTunnel extends InternalHttpServiceTunnel {
+ public static final String HTTP_DEBUG_PARAM = "org.eclipse.scout.rt.client.http.debug";
+
+ public HttpServiceTunnel(IClientSession session, String url) throws ProcessingException {
+ super(session, url);
+ }
+
+ /**
+ * @param url
+ * @param version
+ * the version that is sent down to the server with every request.
+ * This allows the server to check client request and refuse old
+ * clients. Check the servers HttpProxyHandlerServlet init-parameter
+ * (example: min-version="0.0.0") If the version parameter is null,
+ * the product bundle (for example com.myapp.ui.swing) version is
+ * used
+ */
+ public HttpServiceTunnel(IClientSession session, String url, String version) throws ProcessingException {
+ super(session, url, version);
+ }
+
+ @Override
+ public void setAnalyzeNetworkLatency(boolean b) {
+ super.setAnalyzeNetworkLatency(b);
+ }
+
+ @Override
+ public void setClientNotificationPollInterval(long intervallMillis) {
+ super.setClientNotificationPollInterval(intervallMillis);
+ }
+
+ /**
+ * @param call
+ * the original call
+ * @param callData
+ * the data created by the {@link IServiceTunnelContentHandler} used
+ * by this tunnel Create url connection and write post data (if
+ * required)
+ * @throws IOException
+ * override this method to customize the creation of the {@link URLConnection} see
+ * {@link #addCustomHeaders(URLConnection, String)}
+ */
+ @Override
+ protected URLConnection createURLConnection(ServiceTunnelRequest call, byte[] callData) throws IOException {
+ return super.createURLConnection(call, callData);
+ }
+
+ /**
+ * Signals the server to cancel processing jobs for the current session.
+ *
+ * @return true if cancel was successful and transaction was in fact cancelled, false otherwise
+ */
+ @Override
+ protected boolean sendCancelRequest(long requestSequence) {
+ return super.sendCancelRequest(requestSequence);
+ }
+
+ /**
+ * @param method
+ * GET or POST override this method to add custom HTTP headers
+ */
+ @Override
+ protected void addCustomHeaders(URLConnection urlConn, String method) throws IOException {
+ super.addCustomHeaders(urlConn, method);
+ }
+
+ /**
+ * @return msgEncoder used to encode and decode a request / response to and
+ * from the binary stream. Default is the {@link DefaultServiceTunnelContentHandler} which handles soap style
+ * messages
+ */
+ @Override
+ public IServiceTunnelContentHandler getContentHandler() {
+ return super.getContentHandler();
+ }
+
+ /**
+ * @param msgEncoder
+ * that can encode and decode a request / response to and from the
+ * binary stream. Default is the {@link DefaultServiceTunnelContentHandler} which handles soap
+ * style messages
+ */
+ @Override
+ public void setContentHandler(IServiceTunnelContentHandler e) {
+ super.setContentHandler(e);
+ }
+
+ @Override
+ public Object invokeService(Class serviceInterfaceClass, Method operation, Object[] callerArgs) throws ProcessingException {
+ return super.invokeService(serviceInterfaceClass, operation, callerArgs);
+ }
+
+ @Override
+ protected ServiceTunnelResponse tunnelOnline(final ServiceTunnelRequest call) {
+ try {
+ //if (!call.getOperation().equals("ping")) TuningUtility.startTimer();
+ return super.tunnelOnline(call);
+ }
+ finally {
+ //if (!call.getOperation().equals("ping")) TuningUtility.stopTimer("tunnelOnline " + call);
+ }
+ }
+
+ /**
+ * Override this method to decide when background jobs to the backend should be presented to the user or not (for
+ * cancelling)
+ * The default makes all jobs cancellable except IPingService (used for client notification polling)
+ */
+ @Override
+ protected void decorateBackgroundJob(ServiceTunnelRequest call, Job backgroundJob) {
+ super.decorateBackgroundJob(call, backgroundJob);
+ }
+
+ /**
+ * This method is called just after the http response is received but before
+ * the http response is processed by scout. This might be used to read and
+ * interpret custom http headers.
+ *
+ * @since 06.07.2009
+ */
+ @Override
+ protected void preprocessHttpRepsonse(URLConnection urlConn, ServiceTunnelRequest call, int httpCode) {
+ super.preprocessHttpRepsonse(urlConn, call, httpCode);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/servicetunnel/http/internal/ClientNotificationPollingJob.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/servicetunnel/http/internal/ClientNotificationPollingJob.java
index 4265955358..10d163dee0 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/servicetunnel/http/internal/ClientNotificationPollingJob.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/servicetunnel/http/internal/ClientNotificationPollingJob.java
@@ -1,69 +1,69 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.servicetunnel.http.internal;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ClientAsyncJob;
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.client.services.common.perf.IPerformanceAnalyzerService;
-import org.eclipse.scout.rt.shared.services.common.ping.IPingService;
-import org.eclipse.scout.service.SERVICES;
-
-public class ClientNotificationPollingJob extends ClientAsyncJob {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(ClientNotificationPollingJob.class);
-
- private long m_pollInterval;
- private boolean m_analyzeNetworkLatency;
-
- public ClientNotificationPollingJob(IClientSession session, long pollInterval, boolean analyzeNetworkLatency) {
- super("Client notification fetcher", session, true);
- updatePollingValues(pollInterval, analyzeNetworkLatency);
- }
-
- public void updatePollingValues(long pollInterval, boolean analyzeNetworkLatency) {
- m_pollInterval = Math.max(1000L, pollInterval);
- m_analyzeNetworkLatency = analyzeNetworkLatency;
- }
-
- @Override
- protected IStatus runStatus(IProgressMonitor monitor) {
- IPingService pingService = SERVICES.getService(IPingService.class);
- try {
- // side-effect of every service call (whether ping or any other) is to get
- // client notifications
- pingService.ping("GetClientNotifications");
- }
- catch (Throwable t) {
- if (LOG.isInfoEnabled()) {
- LOG.info("polling", t);
- }
- }
- if (monitor.isCanceled()) {
- return Status.CANCEL_STATUS;
- }
- else {
- // re-schedule
- long netLatency = 0L;
- IPerformanceAnalyzerService perf = SERVICES.getService(IPerformanceAnalyzerService.class);
- if (perf != null) {
- netLatency = perf.getNetworkLatency();
- }
- long sleepInterval = m_analyzeNetworkLatency ? Math.max(m_pollInterval, 10 * netLatency) : m_pollInterval;
- schedule(sleepInterval);
- return Status.OK_STATUS;
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.servicetunnel.http.internal;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ClientAsyncJob;
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.client.services.common.perf.IPerformanceAnalyzerService;
+import org.eclipse.scout.rt.shared.services.common.ping.IPingService;
+import org.eclipse.scout.service.SERVICES;
+
+public class ClientNotificationPollingJob extends ClientAsyncJob {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(ClientNotificationPollingJob.class);
+
+ private long m_pollInterval;
+ private boolean m_analyzeNetworkLatency;
+
+ public ClientNotificationPollingJob(IClientSession session, long pollInterval, boolean analyzeNetworkLatency) {
+ super("Client notification fetcher", session, true);
+ updatePollingValues(pollInterval, analyzeNetworkLatency);
+ }
+
+ public void updatePollingValues(long pollInterval, boolean analyzeNetworkLatency) {
+ m_pollInterval = Math.max(1000L, pollInterval);
+ m_analyzeNetworkLatency = analyzeNetworkLatency;
+ }
+
+ @Override
+ protected IStatus runStatus(IProgressMonitor monitor) {
+ IPingService pingService = SERVICES.getService(IPingService.class);
+ try {
+ // side-effect of every service call (whether ping or any other) is to get
+ // client notifications
+ pingService.ping("GetClientNotifications");
+ }
+ catch (Throwable t) {
+ if (LOG.isInfoEnabled()) {
+ LOG.info("polling", t);
+ }
+ }
+ if (monitor.isCanceled()) {
+ return Status.CANCEL_STATUS;
+ }
+ else {
+ // re-schedule
+ long netLatency = 0L;
+ IPerformanceAnalyzerService perf = SERVICES.getService(IPerformanceAnalyzerService.class);
+ if (perf != null) {
+ netLatency = perf.getNetworkLatency();
+ }
+ long sleepInterval = m_analyzeNetworkLatency ? Math.max(m_pollInterval, 10 * netLatency) : m_pollInterval;
+ schedule(sleepInterval);
+ return Status.OK_STATUS;
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/servicetunnel/http/internal/HttpBackgroundJob.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/servicetunnel/http/internal/HttpBackgroundJob.java
index 7856b1dc67..16d4fedf69 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/servicetunnel/http/internal/HttpBackgroundJob.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/servicetunnel/http/internal/HttpBackgroundJob.java
@@ -1,130 +1,130 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.servicetunnel.http.internal;
-
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-import java.net.HttpURLConnection;
-import java.net.URLConnection;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.Activator;
-import org.eclipse.scout.rt.client.ClientAsyncJob;
-import org.eclipse.scout.rt.client.servicetunnel.http.HttpServiceTunnel;
-import org.eclipse.scout.rt.shared.servicetunnel.HttpException;
-import org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelRequest;
-import org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelResponse;
-
-public class HttpBackgroundJob extends ClientAsyncJob {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(HttpBackgroundJob.class);
-
- private final Object m_callerLock;
- private final ServiceTunnelRequest m_req;
- private ServiceTunnelResponse m_res;
- private final InternalHttpServiceTunnel m_tunnel;
- private URLConnection m_urlConn;
- private boolean m_debug;
-
- /**
- * @param name
- */
- public HttpBackgroundJob(String name, ServiceTunnelRequest req, Object callerLock, InternalHttpServiceTunnel tunnel) {
- super(name, tunnel.getClientSession(), true);
- m_req = req;
- m_callerLock = callerLock;
- m_tunnel = tunnel;
- String text = null;
- if (Activator.getDefault() != null) {
- text = Activator.getDefault().getBundle().getBundleContext().getProperty(HttpServiceTunnel.HTTP_DEBUG_PARAM);
- }
- if (text != null && text.equalsIgnoreCase("true")) {
- m_debug = true;
- }
- }
-
- public ServiceTunnelResponse getResponse() {
- return m_res;
- }
-
- @Override
- protected IStatus runStatus(IProgressMonitor monitor) {
- InputStream httpin = null;
- try {
- delayForDebug(m_req, 0);
- long time1 = 0, time2 = 0;
- //
- if (m_debug) {
- time1 = System.nanoTime();
- }
- // build soap request
- ByteArrayOutputStream msgout = new ByteArrayOutputStream();
- m_tunnel.getContentHandler().writeRequest(msgout, m_req);
- msgout.close();
- byte[] callData = msgout.toByteArray();
- // send
- m_urlConn = m_tunnel.createURLConnection(m_req, callData);
- // receive
- int code = (m_urlConn instanceof HttpURLConnection ? ((HttpURLConnection) m_urlConn).getResponseCode() : 200);
- m_tunnel.preprocessHttpRepsonse(m_urlConn, m_req, code);
- if (code == 0 || (code >= 200 && code <= 299)) {
- // ok
- }
- else {
- m_res = new ServiceTunnelResponse(code, null, null, new HttpException(code));
- return Status.CANCEL_STATUS;
- }
- httpin = m_urlConn.getInputStream();
- m_res = m_tunnel.getContentHandler().readResponse(httpin);
- httpin.close();
- httpin = null;
- if (m_debug) {
- time2 = System.nanoTime();
- }
- if (m_debug) {
- LOG.debug("TIME " + m_req.getServiceInterfaceClassName() + "." + m_req.getOperation() + " " + (time2 - time1) / 1000000L + "ms " + callData.length + " bytes");
- }
- return Status.OK_STATUS;
- }
- catch (Throwable e) {
- //cancel has precedence over failure
- if (m_res == null) {
- m_res = new ServiceTunnelResponse(null, null, e);
- }
- return Status.CANCEL_STATUS;
- }
- finally {
- if (httpin != null) {
- try {
- httpin.close();
- }
- catch (Throwable fatal) {
- }
- }
- synchronized (m_callerLock) {
- m_callerLock.notifyAll();
- }
- }
- }
-
- private void delayForDebug(ServiceTunnelRequest call, long millis) throws InterruptedException {
- if (millis <= 0) {
- return;
- }
- //
- System.out.println("#Delay " + millis + "ms for debugging " + call.getServiceInterfaceClassName() + "." + call.getOperation());
- Thread.sleep(millis);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.servicetunnel.http.internal;
+
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.net.HttpURLConnection;
+import java.net.URLConnection;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.Activator;
+import org.eclipse.scout.rt.client.ClientAsyncJob;
+import org.eclipse.scout.rt.client.servicetunnel.http.HttpServiceTunnel;
+import org.eclipse.scout.rt.shared.servicetunnel.HttpException;
+import org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelRequest;
+import org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelResponse;
+
+public class HttpBackgroundJob extends ClientAsyncJob {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(HttpBackgroundJob.class);
+
+ private final Object m_callerLock;
+ private final ServiceTunnelRequest m_req;
+ private ServiceTunnelResponse m_res;
+ private final InternalHttpServiceTunnel m_tunnel;
+ private URLConnection m_urlConn;
+ private boolean m_debug;
+
+ /**
+ * @param name
+ */
+ public HttpBackgroundJob(String name, ServiceTunnelRequest req, Object callerLock, InternalHttpServiceTunnel tunnel) {
+ super(name, tunnel.getClientSession(), true);
+ m_req = req;
+ m_callerLock = callerLock;
+ m_tunnel = tunnel;
+ String text = null;
+ if (Activator.getDefault() != null) {
+ text = Activator.getDefault().getBundle().getBundleContext().getProperty(HttpServiceTunnel.HTTP_DEBUG_PARAM);
+ }
+ if (text != null && text.equalsIgnoreCase("true")) {
+ m_debug = true;
+ }
+ }
+
+ public ServiceTunnelResponse getResponse() {
+ return m_res;
+ }
+
+ @Override
+ protected IStatus runStatus(IProgressMonitor monitor) {
+ InputStream httpin = null;
+ try {
+ delayForDebug(m_req, 0);
+ long time1 = 0, time2 = 0;
+ //
+ if (m_debug) {
+ time1 = System.nanoTime();
+ }
+ // build soap request
+ ByteArrayOutputStream msgout = new ByteArrayOutputStream();
+ m_tunnel.getContentHandler().writeRequest(msgout, m_req);
+ msgout.close();
+ byte[] callData = msgout.toByteArray();
+ // send
+ m_urlConn = m_tunnel.createURLConnection(m_req, callData);
+ // receive
+ int code = (m_urlConn instanceof HttpURLConnection ? ((HttpURLConnection) m_urlConn).getResponseCode() : 200);
+ m_tunnel.preprocessHttpRepsonse(m_urlConn, m_req, code);
+ if (code == 0 || (code >= 200 && code <= 299)) {
+ // ok
+ }
+ else {
+ m_res = new ServiceTunnelResponse(code, null, null, new HttpException(code));
+ return Status.CANCEL_STATUS;
+ }
+ httpin = m_urlConn.getInputStream();
+ m_res = m_tunnel.getContentHandler().readResponse(httpin);
+ httpin.close();
+ httpin = null;
+ if (m_debug) {
+ time2 = System.nanoTime();
+ }
+ if (m_debug) {
+ LOG.debug("TIME " + m_req.getServiceInterfaceClassName() + "." + m_req.getOperation() + " " + (time2 - time1) / 1000000L + "ms " + callData.length + " bytes");
+ }
+ return Status.OK_STATUS;
+ }
+ catch (Throwable e) {
+ //cancel has precedence over failure
+ if (m_res == null) {
+ m_res = new ServiceTunnelResponse(null, null, e);
+ }
+ return Status.CANCEL_STATUS;
+ }
+ finally {
+ if (httpin != null) {
+ try {
+ httpin.close();
+ }
+ catch (Throwable fatal) {
+ }
+ }
+ synchronized (m_callerLock) {
+ m_callerLock.notifyAll();
+ }
+ }
+ }
+
+ private void delayForDebug(ServiceTunnelRequest call, long millis) throws InterruptedException {
+ if (millis <= 0) {
+ return;
+ }
+ //
+ System.out.println("#Delay " + millis + "ms for debugging " + call.getServiceInterfaceClassName() + "." + call.getOperation());
+ Thread.sleep(millis);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/servicetunnel/http/internal/InternalHttpServiceTunnel.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/servicetunnel/http/internal/InternalHttpServiceTunnel.java
index f4a12a9394..979372621e 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/servicetunnel/http/internal/InternalHttpServiceTunnel.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/servicetunnel/http/internal/InternalHttpServiceTunnel.java
@@ -1,284 +1,284 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.servicetunnel.http.internal;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.lang.reflect.Method;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLConnection;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.job.JobEx;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.commons.osgi.BundleInspector;
-import org.eclipse.scout.rt.client.ClientJob;
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.client.servicetunnel.AbstractServiceTunnel;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.services.common.processing.IServerProcessingCancelService;
-import org.eclipse.scout.rt.shared.servicetunnel.DefaultServiceTunnelContentHandler;
-import org.eclipse.scout.rt.shared.servicetunnel.IServiceTunnelContentHandler;
-import org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelRequest;
-import org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelResponse;
-
-/**
- *
- */
-public class InternalHttpServiceTunnel extends AbstractServiceTunnel {
-
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(InternalHttpServiceTunnel.class);
-
- private IServiceTunnelContentHandler m_contentHandler;
- private ClientNotificationPollingJob m_pollingJob;
- private final Object m_pollingJobLock = new Object();
-
- public InternalHttpServiceTunnel(IClientSession session, String url) throws ProcessingException {
- this(session, url, null);
- }
-
- /**
- * @param url
- * @param version
- * the version that is sent down to the server with every request.
- * This allows the server to check client request and refuse old
- * clients. Check the servers HttpProxyHandlerServlet init-parameter
- * (example: min-version="0.0.0") If the version parameter is null,
- * the product bundle (for example com.myapp.ui.swing) version is
- * used
- */
- public InternalHttpServiceTunnel(IClientSession session, String url, String version) throws ProcessingException {
- super(session, version);
- try {
- if (url != null) {
- setServerURL(new URL(url));
- }
- }
- catch (MalformedURLException e) {
- throw new ProcessingException(url, e);
- }
- }
-
- @Override
- public void setAnalyzeNetworkLatency(boolean b) {
- super.setAnalyzeNetworkLatency(b);
- updatePollingJobInternal();
- }
-
- @Override
- public void setClientNotificationPollInterval(long intervallMillis) {
- super.setClientNotificationPollInterval(intervallMillis);
- updatePollingJobInternal();
- }
-
- /**
- * @param call
- * the original call
- * @param callData
- * the data created by the {@link IServiceTunnelContentHandler} used
- * by this tunnel Create url connection and write post data (if
- * required)
- * @throws IOException
- * override this method to customize the creation of the {@link URLConnection} see
- * {@link #addCustomHeaders(URLConnection, String)}
- */
- protected URLConnection createURLConnection(ServiceTunnelRequest call, byte[] callData) throws IOException {
- // fast check of dummy URL's
- if (getServerURL().getProtocol().startsWith("file")) {
- throw new IOException("File connection is not supporting HTTP: " + getServerURL());
- }
- URLConnection urlConn;
- // configure POST with text/xml
- urlConn = getServerURL().openConnection();
- String contentType = "text/xml";
- urlConn.setRequestProperty("Content-type", contentType);
- urlConn.setDoOutput(true);
- urlConn.setDoInput(true);
- urlConn.setDefaultUseCaches(false);
- urlConn.setUseCaches(false);
- addCustomHeaders(urlConn, "POST");
- OutputStream httpOut = urlConn.getOutputStream();
- httpOut.write(callData);
- httpOut.close();
- httpOut = null;
- return urlConn;
- }
-
- /**
- * @param method
- * GET or POST override this method to add custom HTTP headers
- */
- protected void addCustomHeaders(URLConnection urlConn, String method) throws IOException {
- }
-
- private void updatePollingJobInternal() {
- synchronized (m_pollingJobLock) {
- long p = getClientNotificationPollInterval();
- boolean b = isAnalyzeNetworkLatency();
- if (p > 0) {
- if (m_pollingJob == null) {
- m_pollingJob = new ClientNotificationPollingJob(getClientSession(), p, b);
- m_pollingJob.schedule();
- }
- else {
- m_pollingJob.updatePollingValues(p, b);
- }
- }
- else {
- if (m_pollingJob != null) {
- m_pollingJob.cancel();
- m_pollingJob = null;
- }
- }
- }
- }
-
- /**
- * @return msgEncoder used to encode and decode a request / response to and
- * from the binary stream. Default is the {@link DefaultServiceTunnelContentHandler} which handles soap style
- * messages
- */
- public IServiceTunnelContentHandler getContentHandler() {
- return m_contentHandler;
- }
-
- /**
- * @param msgEncoder
- * that can encode and decode a request / response to and from the
- * binary stream. Default is the {@link DefaultServiceTunnelContentHandler} which handles soap
- * style messages
- */
- public void setContentHandler(IServiceTunnelContentHandler e) {
- m_contentHandler = e;
- }
-
- @Override
- public Object invokeService(Class serviceInterfaceClass, Method operation, Object[] callerArgs) throws ProcessingException {
- if (m_contentHandler == null) {
- m_contentHandler = new DefaultServiceTunnelContentHandler();
- String prefix = getClientSession().getClass().getPackage().getName().replaceAll("^(.*\\.)(client|shared|server)(\\.core)?.*$", "$1");
- m_contentHandler.initialize(BundleInspector.getOrderedBundleList(prefix, "org.eclipse.scout."), getClientSession().getClass().getClassLoader());
- }
- return super.invokeService(serviceInterfaceClass, operation, callerArgs);
- }
-
- @Override
- protected ServiceTunnelResponse tunnelOnline(final ServiceTunnelRequest req) {
- if (ClientJob.isCurrentJobCanceled()) {
- return new ServiceTunnelResponse(null, null, new InterruptedException(ScoutTexts.get("UserInterrupted")));
- }
- final Object backgroundLock = new Object();
- HttpBackgroundJob backgroundJob = new HttpBackgroundJob(ScoutTexts.get("ServerCallProcessing"), req, backgroundLock, this);
- decorateBackgroundJob(req, backgroundJob);
- // wait until done
- ServiceTunnelResponse res = null;
- boolean cancelled = false;
- boolean sentCancelRequest = false;
- synchronized (backgroundLock) {
- backgroundJob.schedule();
-
- while (true) {
- res = backgroundJob.getResponse();
- if (res != null) {
- break;
- }
- IProgressMonitor mon = backgroundJob.getMonitor();
- if ((!sentCancelRequest) && (JobEx.isCurrentJobCanceled() || (mon != null && mon.isCanceled()))) {
- sentCancelRequest = true;
- boolean success = sendCancelRequest(req.getRequestSequence());
- if (success) {
- //in fact cancelled the job
- cancelled = true;
- break;
- }
- else {
- //cancel was not possible, continue
- }
- }
- if (backgroundJob.getState() == JobEx.NONE) {
- break;
- }
- try {
- backgroundLock.wait(500);
- }
- catch (InterruptedException ie) {
- break;
- }
- }
- }
- if (res == null || cancelled) {
- return new ServiceTunnelResponse(null, null, new InterruptedException(ScoutTexts.get("UserInterrupted")));
- }
- return res;
- }
-
- /**
- * Signals the server to cancel processing jobs for the current session.
- *
- * @return true if cancel was successful and transaction was in fact cancelled, false otherwise
- */
- protected boolean sendCancelRequest(long requestSequence) {
- try {
- ServiceTunnelRequest cancelCall = new ServiceTunnelRequest(getVersion(), IServerProcessingCancelService.class, IServerProcessingCancelService.class.getMethod("cancel", long.class), new Object[]{requestSequence});
- cancelCall.setClientSubject(getClientSession().getSubject());
- cancelCall.setVirtualSessionId(getClientSession().getVirtualSessionId());
- cancelCall.setUserAgent(getClientSession().getUserAgent().createIdentifier());
- HttpBackgroundJob cancelHttpJob = new HttpBackgroundJob(ScoutTexts.get("ServerCallCancelProcessing"), cancelCall, new Object(), this);
- cancelHttpJob.setSystem(true);
- cancelHttpJob.schedule();
- try {
- cancelHttpJob.join(10000L);
- ServiceTunnelResponse cancelResult = cancelHttpJob.getResponse();
- if (cancelResult == null) {
- return false;
- }
- if (cancelResult.getException() != null) {
- LOG.warn("cancel failed", cancelResult.getException());
- return false;
- }
- Boolean result = (Boolean) cancelResult.getData();
- return result != null && result.booleanValue();
- }
- catch (InterruptedException ie) {
- return false;
- }
- }
- catch (Throwable e) {
- LOG.warn("failed to cancel server processing", e);
- return false;
- }
- }
-
- /**
- * Override this method to decide when background jobs to the backend should be presented to the user or not (for
- * cancelling)
- * The default makes all jobs cancellable except IPingService (used for client notification polling)
- */
- protected void decorateBackgroundJob(ServiceTunnelRequest call, Job backgroundJob) {
- backgroundJob.setUser(false);
- backgroundJob.setSystem(true);
- }
-
- /**
- * This method is called just after the http response is received but before
- * the http response is processed by scout. This might be used to read and
- * interpret custom http headers.
- *
- * @since 06.07.2009
- */
- protected void preprocessHttpRepsonse(URLConnection urlConn, ServiceTunnelRequest call, int httpCode) {
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.servicetunnel.http.internal;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.lang.reflect.Method;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLConnection;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.job.JobEx;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.commons.osgi.BundleInspector;
+import org.eclipse.scout.rt.client.ClientJob;
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.client.servicetunnel.AbstractServiceTunnel;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.services.common.processing.IServerProcessingCancelService;
+import org.eclipse.scout.rt.shared.servicetunnel.DefaultServiceTunnelContentHandler;
+import org.eclipse.scout.rt.shared.servicetunnel.IServiceTunnelContentHandler;
+import org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelRequest;
+import org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelResponse;
+
+/**
+ *
+ */
+public class InternalHttpServiceTunnel extends AbstractServiceTunnel {
+
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(InternalHttpServiceTunnel.class);
+
+ private IServiceTunnelContentHandler m_contentHandler;
+ private ClientNotificationPollingJob m_pollingJob;
+ private final Object m_pollingJobLock = new Object();
+
+ public InternalHttpServiceTunnel(IClientSession session, String url) throws ProcessingException {
+ this(session, url, null);
+ }
+
+ /**
+ * @param url
+ * @param version
+ * the version that is sent down to the server with every request.
+ * This allows the server to check client request and refuse old
+ * clients. Check the servers HttpProxyHandlerServlet init-parameter
+ * (example: min-version="0.0.0") If the version parameter is null,
+ * the product bundle (for example com.myapp.ui.swing) version is
+ * used
+ */
+ public InternalHttpServiceTunnel(IClientSession session, String url, String version) throws ProcessingException {
+ super(session, version);
+ try {
+ if (url != null) {
+ setServerURL(new URL(url));
+ }
+ }
+ catch (MalformedURLException e) {
+ throw new ProcessingException(url, e);
+ }
+ }
+
+ @Override
+ public void setAnalyzeNetworkLatency(boolean b) {
+ super.setAnalyzeNetworkLatency(b);
+ updatePollingJobInternal();
+ }
+
+ @Override
+ public void setClientNotificationPollInterval(long intervallMillis) {
+ super.setClientNotificationPollInterval(intervallMillis);
+ updatePollingJobInternal();
+ }
+
+ /**
+ * @param call
+ * the original call
+ * @param callData
+ * the data created by the {@link IServiceTunnelContentHandler} used
+ * by this tunnel Create url connection and write post data (if
+ * required)
+ * @throws IOException
+ * override this method to customize the creation of the {@link URLConnection} see
+ * {@link #addCustomHeaders(URLConnection, String)}
+ */
+ protected URLConnection createURLConnection(ServiceTunnelRequest call, byte[] callData) throws IOException {
+ // fast check of dummy URL's
+ if (getServerURL().getProtocol().startsWith("file")) {
+ throw new IOException("File connection is not supporting HTTP: " + getServerURL());
+ }
+ URLConnection urlConn;
+ // configure POST with text/xml
+ urlConn = getServerURL().openConnection();
+ String contentType = "text/xml";
+ urlConn.setRequestProperty("Content-type", contentType);
+ urlConn.setDoOutput(true);
+ urlConn.setDoInput(true);
+ urlConn.setDefaultUseCaches(false);
+ urlConn.setUseCaches(false);
+ addCustomHeaders(urlConn, "POST");
+ OutputStream httpOut = urlConn.getOutputStream();
+ httpOut.write(callData);
+ httpOut.close();
+ httpOut = null;
+ return urlConn;
+ }
+
+ /**
+ * @param method
+ * GET or POST override this method to add custom HTTP headers
+ */
+ protected void addCustomHeaders(URLConnection urlConn, String method) throws IOException {
+ }
+
+ private void updatePollingJobInternal() {
+ synchronized (m_pollingJobLock) {
+ long p = getClientNotificationPollInterval();
+ boolean b = isAnalyzeNetworkLatency();
+ if (p > 0) {
+ if (m_pollingJob == null) {
+ m_pollingJob = new ClientNotificationPollingJob(getClientSession(), p, b);
+ m_pollingJob.schedule();
+ }
+ else {
+ m_pollingJob.updatePollingValues(p, b);
+ }
+ }
+ else {
+ if (m_pollingJob != null) {
+ m_pollingJob.cancel();
+ m_pollingJob = null;
+ }
+ }
+ }
+ }
+
+ /**
+ * @return msgEncoder used to encode and decode a request / response to and
+ * from the binary stream. Default is the {@link DefaultServiceTunnelContentHandler} which handles soap style
+ * messages
+ */
+ public IServiceTunnelContentHandler getContentHandler() {
+ return m_contentHandler;
+ }
+
+ /**
+ * @param msgEncoder
+ * that can encode and decode a request / response to and from the
+ * binary stream. Default is the {@link DefaultServiceTunnelContentHandler} which handles soap
+ * style messages
+ */
+ public void setContentHandler(IServiceTunnelContentHandler e) {
+ m_contentHandler = e;
+ }
+
+ @Override
+ public Object invokeService(Class serviceInterfaceClass, Method operation, Object[] callerArgs) throws ProcessingException {
+ if (m_contentHandler == null) {
+ m_contentHandler = new DefaultServiceTunnelContentHandler();
+ String prefix = getClientSession().getClass().getPackage().getName().replaceAll("^(.*\\.)(client|shared|server)(\\.core)?.*$", "$1");
+ m_contentHandler.initialize(BundleInspector.getOrderedBundleList(prefix, "org.eclipse.scout."), getClientSession().getClass().getClassLoader());
+ }
+ return super.invokeService(serviceInterfaceClass, operation, callerArgs);
+ }
+
+ @Override
+ protected ServiceTunnelResponse tunnelOnline(final ServiceTunnelRequest req) {
+ if (ClientJob.isCurrentJobCanceled()) {
+ return new ServiceTunnelResponse(null, null, new InterruptedException(ScoutTexts.get("UserInterrupted")));
+ }
+ final Object backgroundLock = new Object();
+ HttpBackgroundJob backgroundJob = new HttpBackgroundJob(ScoutTexts.get("ServerCallProcessing"), req, backgroundLock, this);
+ decorateBackgroundJob(req, backgroundJob);
+ // wait until done
+ ServiceTunnelResponse res = null;
+ boolean cancelled = false;
+ boolean sentCancelRequest = false;
+ synchronized (backgroundLock) {
+ backgroundJob.schedule();
+
+ while (true) {
+ res = backgroundJob.getResponse();
+ if (res != null) {
+ break;
+ }
+ IProgressMonitor mon = backgroundJob.getMonitor();
+ if ((!sentCancelRequest) && (JobEx.isCurrentJobCanceled() || (mon != null && mon.isCanceled()))) {
+ sentCancelRequest = true;
+ boolean success = sendCancelRequest(req.getRequestSequence());
+ if (success) {
+ //in fact cancelled the job
+ cancelled = true;
+ break;
+ }
+ else {
+ //cancel was not possible, continue
+ }
+ }
+ if (backgroundJob.getState() == JobEx.NONE) {
+ break;
+ }
+ try {
+ backgroundLock.wait(500);
+ }
+ catch (InterruptedException ie) {
+ break;
+ }
+ }
+ }
+ if (res == null || cancelled) {
+ return new ServiceTunnelResponse(null, null, new InterruptedException(ScoutTexts.get("UserInterrupted")));
+ }
+ return res;
+ }
+
+ /**
+ * Signals the server to cancel processing jobs for the current session.
+ *
+ * @return true if cancel was successful and transaction was in fact cancelled, false otherwise
+ */
+ protected boolean sendCancelRequest(long requestSequence) {
+ try {
+ ServiceTunnelRequest cancelCall = new ServiceTunnelRequest(getVersion(), IServerProcessingCancelService.class, IServerProcessingCancelService.class.getMethod("cancel", long.class), new Object[]{requestSequence});
+ cancelCall.setClientSubject(getClientSession().getSubject());
+ cancelCall.setVirtualSessionId(getClientSession().getVirtualSessionId());
+ cancelCall.setUserAgent(getClientSession().getUserAgent().createIdentifier());
+ HttpBackgroundJob cancelHttpJob = new HttpBackgroundJob(ScoutTexts.get("ServerCallCancelProcessing"), cancelCall, new Object(), this);
+ cancelHttpJob.setSystem(true);
+ cancelHttpJob.schedule();
+ try {
+ cancelHttpJob.join(10000L);
+ ServiceTunnelResponse cancelResult = cancelHttpJob.getResponse();
+ if (cancelResult == null) {
+ return false;
+ }
+ if (cancelResult.getException() != null) {
+ LOG.warn("cancel failed", cancelResult.getException());
+ return false;
+ }
+ Boolean result = (Boolean) cancelResult.getData();
+ return result != null && result.booleanValue();
+ }
+ catch (InterruptedException ie) {
+ return false;
+ }
+ }
+ catch (Throwable e) {
+ LOG.warn("failed to cancel server processing", e);
+ return false;
+ }
+ }
+
+ /**
+ * Override this method to decide when background jobs to the backend should be presented to the user or not (for
+ * cancelling)
+ * The default makes all jobs cancellable except IPingService (used for client notification polling)
+ */
+ protected void decorateBackgroundJob(ServiceTunnelRequest call, Job backgroundJob) {
+ backgroundJob.setUser(false);
+ backgroundJob.setSystem(true);
+ }
+
+ /**
+ * This method is called just after the http response is received but before
+ * the http response is processed by scout. This might be used to read and
+ * interpret custom http headers.
+ *
+ * @since 06.07.2009
+ */
+ protected void preprocessHttpRepsonse(URLConnection urlConn, ServiceTunnelRequest call, int httpCode) {
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/servicetunnel/http/internal/TestSoapXml.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/servicetunnel/http/internal/TestSoapXml.java
index 82fcf8c153..7c6526de2b 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/servicetunnel/http/internal/TestSoapXml.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/servicetunnel/http/internal/TestSoapXml.java
@@ -1,68 +1,68 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.servicetunnel.http.internal;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-
-import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument;
-import org.eclipse.scout.commons.xmlparser.ScoutXmlParser;
-import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
-import org.xml.sax.SAXException;
-
-public class TestSoapXml {
-
- public void run() throws Exception {
- String a = "Hello World";
- System.out.println("a:\n" + a);
- byte[] msg = send(a);
- System.out.println("msg:\n" + new String(msg, "UTF-8"));
- String b = receive(msg);
- System.out.println("b:\n" + b);
- }
-
- public byte[] send(String text) throws Exception {
- ScoutXmlDocument doc = new ScoutXmlDocument();
- doc.setXmlVersion("1.0");
- doc.setXmlEncoding("UTF-8");
- ScoutXmlElement env = doc.setRoot("");
- env.setNamespace("SOAP-ENV", "http://schemas.xmlsoap.org/soap/envelope/");
- env.setName("SOAP-ENV:Envelope");
- env.setAttribute("SOAP-ENV:encodingStyle", "http://schemas.xmlsoap.org/soap/encoding/");
- ScoutXmlElement body = env.addChild("SOAP-ENV:Body");
- ScoutXmlElement dataPart = body.addChild("data");
- dataPart.addContent(text);
- ScoutXmlElement infoPart = body.addChild("info");
- infoPart.addContent("For maximal performance, data is reduced, compressed, signed and base64 encoded.");
- //
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- doc.write(out);
- out.close();
- return out.toByteArray();
- }
-
- public String/* text */receive(byte[] msg) throws IOException, SAXException {
- ScoutXmlDocument doc = new ScoutXmlParser().parse(new ByteArrayInputStream(msg));
- ScoutXmlElement env = doc.getChild("{http://schemas.xmlsoap.org/soap/envelope/}Envelope");
- ScoutXmlElement body = env.getChild("{http://schemas.xmlsoap.org/soap/envelope/}Body");
- ScoutXmlElement dataPart = body.getChild("data");
- String text = dataPart.getText();
- ScoutXmlElement infoPart = body.getChild("info");
- String info = infoPart.getText();
- System.out.println("Info: " + info);
- return text;
- }
-
- public static void main(String[] args) throws Exception {
- new TestSoapXml().run();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.servicetunnel.http.internal;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+
+import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument;
+import org.eclipse.scout.commons.xmlparser.ScoutXmlParser;
+import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
+import org.xml.sax.SAXException;
+
+public class TestSoapXml {
+
+ public void run() throws Exception {
+ String a = "Hello World";
+ System.out.println("a:\n" + a);
+ byte[] msg = send(a);
+ System.out.println("msg:\n" + new String(msg, "UTF-8"));
+ String b = receive(msg);
+ System.out.println("b:\n" + b);
+ }
+
+ public byte[] send(String text) throws Exception {
+ ScoutXmlDocument doc = new ScoutXmlDocument();
+ doc.setXmlVersion("1.0");
+ doc.setXmlEncoding("UTF-8");
+ ScoutXmlElement env = doc.setRoot("");
+ env.setNamespace("SOAP-ENV", "http://schemas.xmlsoap.org/soap/envelope/");
+ env.setName("SOAP-ENV:Envelope");
+ env.setAttribute("SOAP-ENV:encodingStyle", "http://schemas.xmlsoap.org/soap/encoding/");
+ ScoutXmlElement body = env.addChild("SOAP-ENV:Body");
+ ScoutXmlElement dataPart = body.addChild("data");
+ dataPart.addContent(text);
+ ScoutXmlElement infoPart = body.addChild("info");
+ infoPart.addContent("For maximal performance, data is reduced, compressed, signed and base64 encoded.");
+ //
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ doc.write(out);
+ out.close();
+ return out.toByteArray();
+ }
+
+ public String/* text */receive(byte[] msg) throws IOException, SAXException {
+ ScoutXmlDocument doc = new ScoutXmlParser().parse(new ByteArrayInputStream(msg));
+ ScoutXmlElement env = doc.getChild("{http://schemas.xmlsoap.org/soap/envelope/}Envelope");
+ ScoutXmlElement body = env.getChild("{http://schemas.xmlsoap.org/soap/envelope/}Body");
+ ScoutXmlElement dataPart = body.getChild("data");
+ String text = dataPart.getText();
+ ScoutXmlElement infoPart = body.getChild("info");
+ String info = infoPart.getText();
+ System.out.println("Info: " + info);
+ return text;
+ }
+
+ public static void main(String[] args) throws Exception {
+ new TestSoapXml().run();
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/servicetunnel/http/tests/TestHttpServiceTunnel.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/servicetunnel/http/tests/TestHttpServiceTunnel.java
index e43fea08a6..9576c9d65d 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/servicetunnel/http/tests/TestHttpServiceTunnel.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/servicetunnel/http/tests/TestHttpServiceTunnel.java
@@ -1,49 +1,49 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.servicetunnel.http.tests;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.AbstractClientSession;
-import org.eclipse.scout.rt.client.servicetunnel.ServiceTunnelUtility;
-import org.eclipse.scout.rt.client.servicetunnel.http.HttpServiceTunnel;
-import org.eclipse.scout.rt.shared.services.common.ping.IPingService;
-
-/**
- *
- */
-public final class TestHttpServiceTunnel {
-
- private TestHttpServiceTunnel() {
- }
-
- public static void main(String[] args) {
- ClientSession session = new ClientSession();
- session.startSession(null);
- //
- IPingService service = ServiceTunnelUtility.createProxy(IPingService.class, session.getServiceTunnel());
- String s = service.ping("abc");
- System.out.println("ping: " + s);
- System.exit(0);
- }
-
- private static class ClientSession extends AbstractClientSession {
- public ClientSession() {
- super(true);
- }
-
- @Override
- protected void execLoadSession() throws ProcessingException {
- HttpServiceTunnel tunnel = new HttpServiceTunnel(this, "https://tools.bsiag.com/bsicrm/process", "999.999.999");
- tunnel.setClientNotificationPollInterval(-1);
- setServiceTunnel(tunnel);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.servicetunnel.http.tests;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.AbstractClientSession;
+import org.eclipse.scout.rt.client.servicetunnel.ServiceTunnelUtility;
+import org.eclipse.scout.rt.client.servicetunnel.http.HttpServiceTunnel;
+import org.eclipse.scout.rt.shared.services.common.ping.IPingService;
+
+/**
+ *
+ */
+public final class TestHttpServiceTunnel {
+
+ private TestHttpServiceTunnel() {
+ }
+
+ public static void main(String[] args) {
+ ClientSession session = new ClientSession();
+ session.startSession(null);
+ //
+ IPingService service = ServiceTunnelUtility.createProxy(IPingService.class, session.getServiceTunnel());
+ String s = service.ping("abc");
+ System.out.println("ping: " + s);
+ System.exit(0);
+ }
+
+ private static class ClientSession extends AbstractClientSession {
+ public ClientSession() {
+ super(true);
+ }
+
+ @Override
+ protected void execLoadSession() throws ProcessingException {
+ HttpServiceTunnel tunnel = new HttpServiceTunnel(this, "https://tools.bsiag.com/bsicrm/process", "999.999.999");
+ tunnel.setClientNotificationPollInterval(-1);
+ setServiceTunnel(tunnel);
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/CurrentOutlineSearchFormUnitTest.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/CurrentOutlineSearchFormUnitTest.java
index 1e666fc30b..19b9334f9d 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/CurrentOutlineSearchFormUnitTest.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/CurrentOutlineSearchFormUnitTest.java
@@ -1,33 +1,33 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.test;
-
-import org.eclipse.scout.rt.client.services.common.test.ClientTestUtility;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
-
-public class CurrentOutlineSearchFormUnitTest extends DrilldownOutlineUnitTest {
-
- @Override
- protected String getConfiguredTitle() {
- return "Current outline search form";
- }
-
- @Override
- public void run() throws Exception {
- clearVisitCache();
- IPage activePage = ClientTestUtility.getDesktop().getOutline().getActivePage();
- if (activePage instanceof IPageWithTable) {
- IPageWithTable page = (IPageWithTable) activePage;
- testSearchForm(page, page.getSearchFormInternal());
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.test;
+
+import org.eclipse.scout.rt.client.services.common.test.ClientTestUtility;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
+
+public class CurrentOutlineSearchFormUnitTest extends DrilldownOutlineUnitTest {
+
+ @Override
+ protected String getConfiguredTitle() {
+ return "Current outline search form";
+ }
+
+ @Override
+ public void run() throws Exception {
+ clearVisitCache();
+ IPage activePage = ClientTestUtility.getDesktop().getOutline().getActivePage();
+ if (activePage instanceof IPageWithTable) {
+ IPageWithTable page = (IPageWithTable) activePage;
+ testSearchForm(page, page.getSearchFormInternal());
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/DefaultClientTestForm.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/DefaultClientTestForm.java
index 7011b28d5e..1252c80aaa 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/DefaultClientTestForm.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/DefaultClientTestForm.java
@@ -1,655 +1,655 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.test;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashSet;
-
-import org.eclipse.scout.commons.annotations.FormData;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.services.common.progress.ISimpleProgress;
-import org.eclipse.scout.rt.client.services.common.progress.ISimpleProgressService;
-import org.eclipse.scout.rt.client.test.DefaultClientTestForm.MainBox.CloseButton;
-import org.eclipse.scout.rt.client.test.DefaultClientTestForm.MainBox.ResetButton;
-import org.eclipse.scout.rt.client.test.DefaultClientTestForm.MainBox.ResultsGroupBox;
-import org.eclipse.scout.rt.client.test.DefaultClientTestForm.MainBox.SettingsGroupBox;
-import org.eclipse.scout.rt.client.test.DefaultClientTestForm.MainBox.StatsGroupBox;
-import org.eclipse.scout.rt.client.test.DefaultClientTestForm.MainBox.TestButton;
-import org.eclipse.scout.rt.client.test.DefaultClientTestForm.MainBox.TestGroupBox;
-import org.eclipse.scout.rt.client.test.DefaultClientTestForm.MainBox.ResultsGroupBox.ResultsTableField;
-import org.eclipse.scout.rt.client.test.DefaultClientTestForm.MainBox.SettingsGroupBox.Level1Box;
-import org.eclipse.scout.rt.client.test.DefaultClientTestForm.MainBox.SettingsGroupBox.Level2Box;
-import org.eclipse.scout.rt.client.test.DefaultClientTestForm.MainBox.SettingsGroupBox.Level3Box;
-import org.eclipse.scout.rt.client.test.DefaultClientTestForm.MainBox.StatsGroupBox.FailedTestsField;
-import org.eclipse.scout.rt.client.test.DefaultClientTestForm.MainBox.StatsGroupBox.SuccessfulTestsField;
-import org.eclipse.scout.rt.client.test.DefaultClientTestForm.MainBox.StatsGroupBox.TotalTestsField;
-import org.eclipse.scout.rt.client.test.DefaultClientTestForm.MainBox.StatsGroupBox.WarningTestsField;
-import org.eclipse.scout.rt.client.test.DefaultClientTestForm.MainBox.TestGroupBox.TestsTableField;
-import org.eclipse.scout.rt.client.ui.basic.table.AbstractTable;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractLongColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractStringColumn;
-import org.eclipse.scout.rt.client.ui.form.AbstractForm;
-import org.eclipse.scout.rt.client.ui.form.AbstractFormHandler;
-import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractButton;
-import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractCloseButton;
-import org.eclipse.scout.rt.client.ui.form.fields.checkbox.AbstractCheckBox;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
-import org.eclipse.scout.rt.client.ui.form.fields.longfield.AbstractLongField;
-import org.eclipse.scout.rt.client.ui.form.fields.tablefield.AbstractTableField;
-import org.eclipse.scout.rt.shared.services.common.test.ITest;
-import org.eclipse.scout.rt.shared.services.common.test.TestUtility;
-import org.eclipse.scout.service.SERVICES;
-
-@FormData
-public class DefaultClientTestForm extends AbstractForm {
-
- public DefaultClientTestForm() throws ProcessingException {
- super();
- }
-
- @Override
- protected String getConfiguredTitle() {
- return "Auto-Test";
- }
-
- @Override
- protected boolean getConfiguredModal() {
- return false;
- }
-
- public MainBox getMainBox() {
- return (MainBox) getRootGroupBox();
- }
-
- public TestGroupBox getTestGroupBox() {
- return getFieldByClass(TestGroupBox.class);
- }
-
- public SettingsGroupBox getSettingsGroupBox() {
- return getFieldByClass(SettingsGroupBox.class);
- }
-
- public StatsGroupBox getStatsGroupBox() {
- return getFieldByClass(StatsGroupBox.class);
- }
-
- public Level1Box getLevel1Box() {
- return getFieldByClass(Level1Box.class);
- }
-
- public Level2Box getLevel2Box() {
- return getFieldByClass(Level2Box.class);
- }
-
- public Level3Box getLevel3Box() {
- return getFieldByClass(Level3Box.class);
- }
-
- public SuccessfulTestsField getSuccessfulTestsField() {
- return getFieldByClass(SuccessfulTestsField.class);
- }
-
- public FailedTestsField getFailedTestsField() {
- return getFieldByClass(FailedTestsField.class);
- }
-
- public TotalTestsField getTotalTestsField() {
- return getFieldByClass(TotalTestsField.class);
- }
-
- public WarningTestsField getWarningTestsField() {
- return getFieldByClass(WarningTestsField.class);
- }
-
- public ResultsGroupBox getResultsGroupBox() {
- return getFieldByClass(ResultsGroupBox.class);
- }
-
- public ResultsTableField getResultsTableField() {
- return getFieldByClass(ResultsTableField.class);
- }
-
- public TestsTableField getTestsTableField() {
- return getFieldByClass(TestsTableField.class);
- }
-
- public CloseButton getCloseButton() {
- return getFieldByClass(CloseButton.class);
- }
-
- public ResetButton getResetButton() {
- return getFieldByClass(ResetButton.class);
- }
-
- public TestButton getTestButton() {
- return getFieldByClass(TestButton.class);
- }
-
- @Order(20.0)
- public class MainBox extends AbstractGroupBox {
-
- @Override
- protected int getConfiguredGridColumnCount() {
- return 2;
- }
-
- @Order(10.0)
- public class TestGroupBox extends AbstractGroupBox {
-
- @Override
- protected int getConfiguredGridW() {
- return 2;
- }
-
- @Override
- protected int getConfiguredGridColumnCount() {
- return 2;
- }
-
- @Override
- protected String getConfiguredLabel() {
- return "Select Tests";
- }
-
- @Order(100.0)
- public class TestsTableField extends AbstractTableField<TestsTableField.Table> {
-
- @Order(10.0)
- public class Table extends AbstractTable {
-
- @Override
- protected boolean getConfiguredAutoResizeColumns() {
- return true;
- }
-
- public ProductColumn getProductColumn() {
- return getColumnSet().getColumnByClass(ProductColumn.class);
- }
-
- public SubTitleColumn getSubTitleColumn() {
- return getColumnSet().getColumnByClass(SubTitleColumn.class);
- }
-
- public TitleColumn getTitleColumn() {
- return getColumnSet().getColumnByClass(TitleColumn.class);
- }
-
- public ClazzColumn getClazzColumn() {
- return getColumnSet().getColumnByClass(ClazzColumn.class);
- }
-
- @Order(10.0)
- public class ProductColumn extends AbstractStringColumn {
- @Override
- protected int getConfiguredWidth() {
- return 120;
- }
-
- @Override
- protected String getConfiguredHeaderText() {
- return "Product";
- }
-
- }
-
- @Order(20.0)
- public class TitleColumn extends AbstractStringColumn {
- @Override
- protected int getConfiguredWidth() {
- return 170;
- }
-
- @Override
- protected String getConfiguredHeaderText() {
- return "Title";
- }
- }
-
- @Order(30.0)
- public class SubTitleColumn extends AbstractStringColumn {
- @Override
- protected int getConfiguredWidth() {
- return 120;
- }
-
- @Override
- protected String getConfiguredHeaderText() {
- return "SubTitle";
- }
- }
-
- @Order(80.0)
- public class ClazzColumn extends AbstractStringColumn {
- @Override
- protected int getConfiguredWidth() {
- return 310;
- }
-
- @Override
- protected String getConfiguredHeaderText() {
- return "Type";
- }
-
- }
-
- @Override
- protected void execInitTable() throws ProcessingException {
- }
- }
-
- @Override
- protected int getConfiguredGridW() {
- return 2;
- }
-
- @Override
- protected int getConfiguredGridH() {
- return 10;
- }
-
- @Override
- protected boolean getConfiguredLabelVisible() {
- return false;
- }
-
- }
-
- }
-
- @Order(20.0)
- public class SettingsGroupBox extends AbstractGroupBox {
-
- @Override
- protected int getConfiguredGridColumnCount() {
- return 1;
- }
-
- @Override
- protected int getConfiguredGridW() {
- return 1;
- }
-
- @Override
- protected String getConfiguredLabel() {
- return "Settings";
- }
-
- @Order(10.0)
- public class Level1Box extends AbstractCheckBox {
- @Override
- protected String getConfiguredLabel() {
- return "OK";
- }
- }
-
- @Order(20.0)
- public class Level2Box extends AbstractCheckBox {
- @Override
- protected String getConfiguredLabel() {
- return "WARNING";
- }
- }
-
- @Order(30.0)
- public class Level3Box extends AbstractCheckBox {
- @Override
- protected String getConfiguredLabel() {
- return "ERROR";
- }
- }
- }
-
- @Order(25.0)
- public class StatsGroupBox extends AbstractGroupBox {
-
- @Override
- protected int getConfiguredGridColumnCount() {
- return 1;
- }
-
- @Override
- protected int getConfiguredGridW() {
- return 1;
- }
-
- @Override
- protected String getConfiguredLabel() {
- return "Statistics";
- }
-
- @Order(10.0)
- public class SuccessfulTestsField extends AbstractLongField {
- @Override
- protected String getConfiguredLabel() {
- return "Successful Tests";
- }
-
- @Override
- protected boolean getConfiguredEnabled() {
- return false;
- }
-
- }
-
- @Order(20.0)
- public class WarningTestsField extends AbstractLongField {
- @Override
- protected String getConfiguredLabel() {
- return "Tests with Warnings";
- }
-
- @Override
- protected boolean getConfiguredEnabled() {
- return false;
- }
-
- }
-
- @Order(30.0)
- public class FailedTestsField extends AbstractLongField {
- @Override
- protected String getConfiguredLabel() {
- return "Failed Tests";
- }
-
- @Override
- protected boolean getConfiguredEnabled() {
- return false;
- }
-
- }
-
- @Order(40.0)
- public class TotalTestsField extends AbstractLongField {
- @Override
- protected String getConfiguredLabel() {
- return "Total Tests";
- }
-
- @Override
- protected boolean getConfiguredEnabled() {
- return false;
- }
-
- }
-
- }
-
- @Order(30.0)
- public class ResultsGroupBox extends AbstractGroupBox {
-
- @Override
- protected int getConfiguredGridW() {
- return 2;
- }
-
- @Override
- protected int getConfiguredGridColumnCount() {
- return 2;
- }
-
- @Override
- protected String getConfiguredLabel() {
- return "Results";
- }
-
- @Order(10.0)
- public class ResultsTableField extends AbstractTableField<ResultsTableField.Table> {
-
- @Order(10.0)
- public class Table extends AbstractTable {
-
- @Override
- protected boolean getConfiguredAutoResizeColumns() {
- return true;
- }
-
- public ProductColumn getProductColumn() {
- return getColumnSet().getColumnByClass(ProductColumn.class);
- }
-
- public SubTitleColumn getSubTitleColumn() {
- return getColumnSet().getColumnByClass(SubTitleColumn.class);
- }
-
- public TitleColumn getTitleColumn() {
- return getColumnSet().getColumnByClass(TitleColumn.class);
- }
-
- public ResultColumn getResultColumn() {
- return getColumnSet().getColumnByClass(ResultColumn.class);
- }
-
- public DurationColumn getDurationColumn() {
- return getColumnSet().getColumnByClass(DurationColumn.class);
- }
-
- @Order(10.0)
- public class ProductColumn extends AbstractStringColumn {
- @Override
- protected int getConfiguredWidth() {
- return 80;
- }
-
- @Override
- protected String getConfiguredHeaderText() {
- return "Product";
- }
-
- }
-
- @Order(20.0)
- public class TitleColumn extends AbstractStringColumn {
- @Override
- protected int getConfiguredWidth() {
- return 170;
- }
-
- @Override
- protected String getConfiguredHeaderText() {
- return "Title";
- }
-
- }
-
- @Order(30.0)
- public class SubTitleColumn extends AbstractStringColumn {
- @Override
- protected int getConfiguredWidth() {
- return 120;
- }
-
- @Override
- protected String getConfiguredHeaderText() {
- return "SubTitle";
- }
- }
-
- @Order(50.0)
- public class ResultColumn extends AbstractStringColumn {
- @Override
- protected int getConfiguredWidth() {
- return 80;
- }
-
- @Override
- protected String getConfiguredHeaderText() {
- return "Result";
- }
- }
-
- @Order(100.0)
- public class DurationColumn extends AbstractLongColumn {
- @Override
- protected int getConfiguredWidth() {
- return 40;
- }
-
- @Override
- protected String getConfiguredHeaderText() {
- return "Duration [ms]";
- }
-
- }
-
- @Override
- protected void execInitTable() throws ProcessingException {
- }
- }
-
- @Override
- protected int getConfiguredGridW() {
- return 2;
- }
-
- @Override
- protected int getConfiguredGridH() {
- return 10;
- }
-
- @Override
- protected boolean getConfiguredLabelVisible() {
- return false;
- }
- }
-
- @Override
- protected boolean getConfiguredLabelVisible() {
- return false;
- }
- }
-
- @Order(40.0)
- public class CloseButton extends AbstractCloseButton {
-
- @Override
- protected String getConfiguredLabel() {
- return "Close";
- }
- }
-
- @Order(50.0)
- public class TestButton extends AbstractButton {
-
- @Override
- protected String getConfiguredLabel() {
- return "Run Selected Tests";
- }
-
- @Override
- protected void execClickAction() throws ProcessingException {
- HashSet<String> selectedNames = new HashSet<String>();
- selectedNames.addAll(Arrays.asList(getTestsTableField().getTable().getClazzColumn().getSelectedValues()));
- ArrayList<ITest> tests = new ArrayList<ITest>();
- for (ITest t : SERVICES.getServices(ITest.class)) {
- if (selectedNames.contains(t.getClass().getSimpleName())) {
- tests.add(t);
- }
- }
- runTests(tests.toArray(new ITest[tests.size()]));
- }
- }
-
- @Order(55.0)
- public class ResetButton extends AbstractButton {
-
- @Override
- protected String getConfiguredLabel() {
- return "Reset Results";
- }
-
- @Override
- protected void execClickAction() throws ProcessingException {
- getResultsTableField().getTable().discardAllRows();
- getTotalTestsField().setValue(null);
- getFailedTestsField().setValue(null);
- getWarningTestsField().setValue(null);
- getSuccessfulTestsField().setValue(null);
- }
-
- }
-
- @Order(60.0)
- public class ExportButton extends AbstractButton {
-
- @Override
- protected String getConfiguredLabel() {
- return "Export to Excel";
- }
-
- @Override
- protected void execClickAction() throws ProcessingException {
- exportTestResults();
- }
- }
- }
-
- public void runTests(ITest[] tests) {
- ISimpleProgressService pgSvc = SERVICES.getService(ISimpleProgressService.class);
- ISimpleProgress pg = pgSvc.addProgress("Test...");
- try {
- FormBasedTestContext ctx = new FormBasedTestContext(DefaultClientTestForm.this);
- TestUtility.runTests(ctx, tests);
- }
- finally {
- pgSvc.removeProgress(pg);
- }
- }
-
- public void exportTestResults() throws ProcessingException {
- // nop
- }
-
- @Order(10.0)
- public class NewHandler extends AbstractFormHandler {
-
- @Override
- protected void execLoad() throws ProcessingException {
- super.execLoad();
- getLevel1Box().setValue(true);
- getLevel2Box().setValue(true);
- getLevel3Box().setValue(true);
- // load tests
- TestsTableField.Table table = getTestsTableField().getTable();
- try {
- table.setTableChanging(true);
- //
- for (ITest t : SERVICES.getServices(ITest.class)) {
- ITableRow r = table.createRow();
- table.getProductColumn().setValue(r, t.getProduct());
- table.getTitleColumn().setValue(r, t.getTitle());
- table.getSubTitleColumn().setValue(r, t.getSubTitle());
- table.getClazzColumn().setValue(r, t.getClass().getSimpleName());
- table.addRow(r);
- }
- }
- finally {
- table.setTableChanging(false);
- }
- //
- getTestsTableField().getTable().selectAllEnabledRows();
- }
-
- }
-
- public void startNew() throws ProcessingException {
- startInternal(new NewHandler());
- }
-
- @Override
- protected boolean getConfiguredMaximizeEnabled() {
- return true;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.test;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+
+import org.eclipse.scout.commons.annotations.FormData;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.services.common.progress.ISimpleProgress;
+import org.eclipse.scout.rt.client.services.common.progress.ISimpleProgressService;
+import org.eclipse.scout.rt.client.test.DefaultClientTestForm.MainBox.CloseButton;
+import org.eclipse.scout.rt.client.test.DefaultClientTestForm.MainBox.ResetButton;
+import org.eclipse.scout.rt.client.test.DefaultClientTestForm.MainBox.ResultsGroupBox;
+import org.eclipse.scout.rt.client.test.DefaultClientTestForm.MainBox.SettingsGroupBox;
+import org.eclipse.scout.rt.client.test.DefaultClientTestForm.MainBox.StatsGroupBox;
+import org.eclipse.scout.rt.client.test.DefaultClientTestForm.MainBox.TestButton;
+import org.eclipse.scout.rt.client.test.DefaultClientTestForm.MainBox.TestGroupBox;
+import org.eclipse.scout.rt.client.test.DefaultClientTestForm.MainBox.ResultsGroupBox.ResultsTableField;
+import org.eclipse.scout.rt.client.test.DefaultClientTestForm.MainBox.SettingsGroupBox.Level1Box;
+import org.eclipse.scout.rt.client.test.DefaultClientTestForm.MainBox.SettingsGroupBox.Level2Box;
+import org.eclipse.scout.rt.client.test.DefaultClientTestForm.MainBox.SettingsGroupBox.Level3Box;
+import org.eclipse.scout.rt.client.test.DefaultClientTestForm.MainBox.StatsGroupBox.FailedTestsField;
+import org.eclipse.scout.rt.client.test.DefaultClientTestForm.MainBox.StatsGroupBox.SuccessfulTestsField;
+import org.eclipse.scout.rt.client.test.DefaultClientTestForm.MainBox.StatsGroupBox.TotalTestsField;
+import org.eclipse.scout.rt.client.test.DefaultClientTestForm.MainBox.StatsGroupBox.WarningTestsField;
+import org.eclipse.scout.rt.client.test.DefaultClientTestForm.MainBox.TestGroupBox.TestsTableField;
+import org.eclipse.scout.rt.client.ui.basic.table.AbstractTable;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractLongColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractStringColumn;
+import org.eclipse.scout.rt.client.ui.form.AbstractForm;
+import org.eclipse.scout.rt.client.ui.form.AbstractFormHandler;
+import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractButton;
+import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractCloseButton;
+import org.eclipse.scout.rt.client.ui.form.fields.checkbox.AbstractCheckBox;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
+import org.eclipse.scout.rt.client.ui.form.fields.longfield.AbstractLongField;
+import org.eclipse.scout.rt.client.ui.form.fields.tablefield.AbstractTableField;
+import org.eclipse.scout.rt.shared.services.common.test.ITest;
+import org.eclipse.scout.rt.shared.services.common.test.TestUtility;
+import org.eclipse.scout.service.SERVICES;
+
+@FormData
+public class DefaultClientTestForm extends AbstractForm {
+
+ public DefaultClientTestForm() throws ProcessingException {
+ super();
+ }
+
+ @Override
+ protected String getConfiguredTitle() {
+ return "Auto-Test";
+ }
+
+ @Override
+ protected boolean getConfiguredModal() {
+ return false;
+ }
+
+ public MainBox getMainBox() {
+ return (MainBox) getRootGroupBox();
+ }
+
+ public TestGroupBox getTestGroupBox() {
+ return getFieldByClass(TestGroupBox.class);
+ }
+
+ public SettingsGroupBox getSettingsGroupBox() {
+ return getFieldByClass(SettingsGroupBox.class);
+ }
+
+ public StatsGroupBox getStatsGroupBox() {
+ return getFieldByClass(StatsGroupBox.class);
+ }
+
+ public Level1Box getLevel1Box() {
+ return getFieldByClass(Level1Box.class);
+ }
+
+ public Level2Box getLevel2Box() {
+ return getFieldByClass(Level2Box.class);
+ }
+
+ public Level3Box getLevel3Box() {
+ return getFieldByClass(Level3Box.class);
+ }
+
+ public SuccessfulTestsField getSuccessfulTestsField() {
+ return getFieldByClass(SuccessfulTestsField.class);
+ }
+
+ public FailedTestsField getFailedTestsField() {
+ return getFieldByClass(FailedTestsField.class);
+ }
+
+ public TotalTestsField getTotalTestsField() {
+ return getFieldByClass(TotalTestsField.class);
+ }
+
+ public WarningTestsField getWarningTestsField() {
+ return getFieldByClass(WarningTestsField.class);
+ }
+
+ public ResultsGroupBox getResultsGroupBox() {
+ return getFieldByClass(ResultsGroupBox.class);
+ }
+
+ public ResultsTableField getResultsTableField() {
+ return getFieldByClass(ResultsTableField.class);
+ }
+
+ public TestsTableField getTestsTableField() {
+ return getFieldByClass(TestsTableField.class);
+ }
+
+ public CloseButton getCloseButton() {
+ return getFieldByClass(CloseButton.class);
+ }
+
+ public ResetButton getResetButton() {
+ return getFieldByClass(ResetButton.class);
+ }
+
+ public TestButton getTestButton() {
+ return getFieldByClass(TestButton.class);
+ }
+
+ @Order(20.0)
+ public class MainBox extends AbstractGroupBox {
+
+ @Override
+ protected int getConfiguredGridColumnCount() {
+ return 2;
+ }
+
+ @Order(10.0)
+ public class TestGroupBox extends AbstractGroupBox {
+
+ @Override
+ protected int getConfiguredGridW() {
+ return 2;
+ }
+
+ @Override
+ protected int getConfiguredGridColumnCount() {
+ return 2;
+ }
+
+ @Override
+ protected String getConfiguredLabel() {
+ return "Select Tests";
+ }
+
+ @Order(100.0)
+ public class TestsTableField extends AbstractTableField<TestsTableField.Table> {
+
+ @Order(10.0)
+ public class Table extends AbstractTable {
+
+ @Override
+ protected boolean getConfiguredAutoResizeColumns() {
+ return true;
+ }
+
+ public ProductColumn getProductColumn() {
+ return getColumnSet().getColumnByClass(ProductColumn.class);
+ }
+
+ public SubTitleColumn getSubTitleColumn() {
+ return getColumnSet().getColumnByClass(SubTitleColumn.class);
+ }
+
+ public TitleColumn getTitleColumn() {
+ return getColumnSet().getColumnByClass(TitleColumn.class);
+ }
+
+ public ClazzColumn getClazzColumn() {
+ return getColumnSet().getColumnByClass(ClazzColumn.class);
+ }
+
+ @Order(10.0)
+ public class ProductColumn extends AbstractStringColumn {
+ @Override
+ protected int getConfiguredWidth() {
+ return 120;
+ }
+
+ @Override
+ protected String getConfiguredHeaderText() {
+ return "Product";
+ }
+
+ }
+
+ @Order(20.0)
+ public class TitleColumn extends AbstractStringColumn {
+ @Override
+ protected int getConfiguredWidth() {
+ return 170;
+ }
+
+ @Override
+ protected String getConfiguredHeaderText() {
+ return "Title";
+ }
+ }
+
+ @Order(30.0)
+ public class SubTitleColumn extends AbstractStringColumn {
+ @Override
+ protected int getConfiguredWidth() {
+ return 120;
+ }
+
+ @Override
+ protected String getConfiguredHeaderText() {
+ return "SubTitle";
+ }
+ }
+
+ @Order(80.0)
+ public class ClazzColumn extends AbstractStringColumn {
+ @Override
+ protected int getConfiguredWidth() {
+ return 310;
+ }
+
+ @Override
+ protected String getConfiguredHeaderText() {
+ return "Type";
+ }
+
+ }
+
+ @Override
+ protected void execInitTable() throws ProcessingException {
+ }
+ }
+
+ @Override
+ protected int getConfiguredGridW() {
+ return 2;
+ }
+
+ @Override
+ protected int getConfiguredGridH() {
+ return 10;
+ }
+
+ @Override
+ protected boolean getConfiguredLabelVisible() {
+ return false;
+ }
+
+ }
+
+ }
+
+ @Order(20.0)
+ public class SettingsGroupBox extends AbstractGroupBox {
+
+ @Override
+ protected int getConfiguredGridColumnCount() {
+ return 1;
+ }
+
+ @Override
+ protected int getConfiguredGridW() {
+ return 1;
+ }
+
+ @Override
+ protected String getConfiguredLabel() {
+ return "Settings";
+ }
+
+ @Order(10.0)
+ public class Level1Box extends AbstractCheckBox {
+ @Override
+ protected String getConfiguredLabel() {
+ return "OK";
+ }
+ }
+
+ @Order(20.0)
+ public class Level2Box extends AbstractCheckBox {
+ @Override
+ protected String getConfiguredLabel() {
+ return "WARNING";
+ }
+ }
+
+ @Order(30.0)
+ public class Level3Box extends AbstractCheckBox {
+ @Override
+ protected String getConfiguredLabel() {
+ return "ERROR";
+ }
+ }
+ }
+
+ @Order(25.0)
+ public class StatsGroupBox extends AbstractGroupBox {
+
+ @Override
+ protected int getConfiguredGridColumnCount() {
+ return 1;
+ }
+
+ @Override
+ protected int getConfiguredGridW() {
+ return 1;
+ }
+
+ @Override
+ protected String getConfiguredLabel() {
+ return "Statistics";
+ }
+
+ @Order(10.0)
+ public class SuccessfulTestsField extends AbstractLongField {
+ @Override
+ protected String getConfiguredLabel() {
+ return "Successful Tests";
+ }
+
+ @Override
+ protected boolean getConfiguredEnabled() {
+ return false;
+ }
+
+ }
+
+ @Order(20.0)
+ public class WarningTestsField extends AbstractLongField {
+ @Override
+ protected String getConfiguredLabel() {
+ return "Tests with Warnings";
+ }
+
+ @Override
+ protected boolean getConfiguredEnabled() {
+ return false;
+ }
+
+ }
+
+ @Order(30.0)
+ public class FailedTestsField extends AbstractLongField {
+ @Override
+ protected String getConfiguredLabel() {
+ return "Failed Tests";
+ }
+
+ @Override
+ protected boolean getConfiguredEnabled() {
+ return false;
+ }
+
+ }
+
+ @Order(40.0)
+ public class TotalTestsField extends AbstractLongField {
+ @Override
+ protected String getConfiguredLabel() {
+ return "Total Tests";
+ }
+
+ @Override
+ protected boolean getConfiguredEnabled() {
+ return false;
+ }
+
+ }
+
+ }
+
+ @Order(30.0)
+ public class ResultsGroupBox extends AbstractGroupBox {
+
+ @Override
+ protected int getConfiguredGridW() {
+ return 2;
+ }
+
+ @Override
+ protected int getConfiguredGridColumnCount() {
+ return 2;
+ }
+
+ @Override
+ protected String getConfiguredLabel() {
+ return "Results";
+ }
+
+ @Order(10.0)
+ public class ResultsTableField extends AbstractTableField<ResultsTableField.Table> {
+
+ @Order(10.0)
+ public class Table extends AbstractTable {
+
+ @Override
+ protected boolean getConfiguredAutoResizeColumns() {
+ return true;
+ }
+
+ public ProductColumn getProductColumn() {
+ return getColumnSet().getColumnByClass(ProductColumn.class);
+ }
+
+ public SubTitleColumn getSubTitleColumn() {
+ return getColumnSet().getColumnByClass(SubTitleColumn.class);
+ }
+
+ public TitleColumn getTitleColumn() {
+ return getColumnSet().getColumnByClass(TitleColumn.class);
+ }
+
+ public ResultColumn getResultColumn() {
+ return getColumnSet().getColumnByClass(ResultColumn.class);
+ }
+
+ public DurationColumn getDurationColumn() {
+ return getColumnSet().getColumnByClass(DurationColumn.class);
+ }
+
+ @Order(10.0)
+ public class ProductColumn extends AbstractStringColumn {
+ @Override
+ protected int getConfiguredWidth() {
+ return 80;
+ }
+
+ @Override
+ protected String getConfiguredHeaderText() {
+ return "Product";
+ }
+
+ }
+
+ @Order(20.0)
+ public class TitleColumn extends AbstractStringColumn {
+ @Override
+ protected int getConfiguredWidth() {
+ return 170;
+ }
+
+ @Override
+ protected String getConfiguredHeaderText() {
+ return "Title";
+ }
+
+ }
+
+ @Order(30.0)
+ public class SubTitleColumn extends AbstractStringColumn {
+ @Override
+ protected int getConfiguredWidth() {
+ return 120;
+ }
+
+ @Override
+ protected String getConfiguredHeaderText() {
+ return "SubTitle";
+ }
+ }
+
+ @Order(50.0)
+ public class ResultColumn extends AbstractStringColumn {
+ @Override
+ protected int getConfiguredWidth() {
+ return 80;
+ }
+
+ @Override
+ protected String getConfiguredHeaderText() {
+ return "Result";
+ }
+ }
+
+ @Order(100.0)
+ public class DurationColumn extends AbstractLongColumn {
+ @Override
+ protected int getConfiguredWidth() {
+ return 40;
+ }
+
+ @Override
+ protected String getConfiguredHeaderText() {
+ return "Duration [ms]";
+ }
+
+ }
+
+ @Override
+ protected void execInitTable() throws ProcessingException {
+ }
+ }
+
+ @Override
+ protected int getConfiguredGridW() {
+ return 2;
+ }
+
+ @Override
+ protected int getConfiguredGridH() {
+ return 10;
+ }
+
+ @Override
+ protected boolean getConfiguredLabelVisible() {
+ return false;
+ }
+ }
+
+ @Override
+ protected boolean getConfiguredLabelVisible() {
+ return false;
+ }
+ }
+
+ @Order(40.0)
+ public class CloseButton extends AbstractCloseButton {
+
+ @Override
+ protected String getConfiguredLabel() {
+ return "Close";
+ }
+ }
+
+ @Order(50.0)
+ public class TestButton extends AbstractButton {
+
+ @Override
+ protected String getConfiguredLabel() {
+ return "Run Selected Tests";
+ }
+
+ @Override
+ protected void execClickAction() throws ProcessingException {
+ HashSet<String> selectedNames = new HashSet<String>();
+ selectedNames.addAll(Arrays.asList(getTestsTableField().getTable().getClazzColumn().getSelectedValues()));
+ ArrayList<ITest> tests = new ArrayList<ITest>();
+ for (ITest t : SERVICES.getServices(ITest.class)) {
+ if (selectedNames.contains(t.getClass().getSimpleName())) {
+ tests.add(t);
+ }
+ }
+ runTests(tests.toArray(new ITest[tests.size()]));
+ }
+ }
+
+ @Order(55.0)
+ public class ResetButton extends AbstractButton {
+
+ @Override
+ protected String getConfiguredLabel() {
+ return "Reset Results";
+ }
+
+ @Override
+ protected void execClickAction() throws ProcessingException {
+ getResultsTableField().getTable().discardAllRows();
+ getTotalTestsField().setValue(null);
+ getFailedTestsField().setValue(null);
+ getWarningTestsField().setValue(null);
+ getSuccessfulTestsField().setValue(null);
+ }
+
+ }
+
+ @Order(60.0)
+ public class ExportButton extends AbstractButton {
+
+ @Override
+ protected String getConfiguredLabel() {
+ return "Export to Excel";
+ }
+
+ @Override
+ protected void execClickAction() throws ProcessingException {
+ exportTestResults();
+ }
+ }
+ }
+
+ public void runTests(ITest[] tests) {
+ ISimpleProgressService pgSvc = SERVICES.getService(ISimpleProgressService.class);
+ ISimpleProgress pg = pgSvc.addProgress("Test...");
+ try {
+ FormBasedTestContext ctx = new FormBasedTestContext(DefaultClientTestForm.this);
+ TestUtility.runTests(ctx, tests);
+ }
+ finally {
+ pgSvc.removeProgress(pg);
+ }
+ }
+
+ public void exportTestResults() throws ProcessingException {
+ // nop
+ }
+
+ @Order(10.0)
+ public class NewHandler extends AbstractFormHandler {
+
+ @Override
+ protected void execLoad() throws ProcessingException {
+ super.execLoad();
+ getLevel1Box().setValue(true);
+ getLevel2Box().setValue(true);
+ getLevel3Box().setValue(true);
+ // load tests
+ TestsTableField.Table table = getTestsTableField().getTable();
+ try {
+ table.setTableChanging(true);
+ //
+ for (ITest t : SERVICES.getServices(ITest.class)) {
+ ITableRow r = table.createRow();
+ table.getProductColumn().setValue(r, t.getProduct());
+ table.getTitleColumn().setValue(r, t.getTitle());
+ table.getSubTitleColumn().setValue(r, t.getSubTitle());
+ table.getClazzColumn().setValue(r, t.getClass().getSimpleName());
+ table.addRow(r);
+ }
+ }
+ finally {
+ table.setTableChanging(false);
+ }
+ //
+ getTestsTableField().getTable().selectAllEnabledRows();
+ }
+
+ }
+
+ public void startNew() throws ProcessingException {
+ startInternal(new NewHandler());
+ }
+
+ @Override
+ protected boolean getConfiguredMaximizeEnabled() {
+ return true;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/DrilldownOutlineUnitTest.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/DrilldownOutlineUnitTest.java
index 39d02b0398..888e524a0b 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/DrilldownOutlineUnitTest.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/DrilldownOutlineUnitTest.java
@@ -1,424 +1,424 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.test;
-
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.scout.commons.CompositeObject;
-import org.eclipse.scout.commons.DateUtility;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.exception.VetoException;
-import org.eclipse.scout.rt.client.services.common.test.AbstractClientTest;
-import org.eclipse.scout.rt.client.services.common.test.ClientTestUtility;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithNodes;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.ISearchForm;
-import org.eclipse.scout.rt.client.ui.form.FormEvent;
-import org.eclipse.scout.rt.client.ui.form.FormListener;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
-import org.eclipse.scout.rt.client.ui.form.fields.bigdecimalfield.IBigDecimalField;
-import org.eclipse.scout.rt.client.ui.form.fields.bigintegerfield.IBigIntegerField;
-import org.eclipse.scout.rt.client.ui.form.fields.booleanfield.IBooleanField;
-import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
-import org.eclipse.scout.rt.client.ui.form.fields.composer.IComposerField;
-import org.eclipse.scout.rt.client.ui.form.fields.datefield.IDateField;
-import org.eclipse.scout.rt.client.ui.form.fields.doublefield.IDoubleField;
-import org.eclipse.scout.rt.client.ui.form.fields.integerfield.IIntegerField;
-import org.eclipse.scout.rt.client.ui.form.fields.listbox.IListBox;
-import org.eclipse.scout.rt.client.ui.form.fields.longfield.ILongField;
-import org.eclipse.scout.rt.client.ui.form.fields.radiobuttongroup.IRadioButtonGroup;
-import org.eclipse.scout.rt.client.ui.form.fields.smartfield.ISmartField;
-import org.eclipse.scout.rt.client.ui.form.fields.stringfield.IStringField;
-import org.eclipse.scout.rt.client.ui.form.fields.treebox.ITreeBox;
-import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
-import org.eclipse.scout.service.SERVICES;
-
-public class DrilldownOutlineUnitTest extends AbstractClientTest {
-
- private final Set<CompositeObject> visitedPages = new HashSet<CompositeObject>();
- private IPageTest[] m_pageTester;
-
- protected void clearVisitCache() {
- visitedPages.clear();
- }
-
- @Override
- public void setUp() {
- m_pageTester = SERVICES.getServices(IPageTest.class);
- }
-
- @Override
- public void run() throws Exception {
- clearVisitCache();
- for (IOutline outline : ClientTestUtility.getDesktop().getAvailableOutlines()) {
- if (outline.isVisible() && outline.isEnabled()) {
- ClientTestUtility.getDesktop().setOutline(outline);
- testPage(outline.getRootPage());
- }
- }
- }
-
- @Override
- public void tearDown() throws Throwable {
- clearVisitCache();
- }
-
- protected void testPage(IPage page) throws ProcessingException {
- if (page == null) {
- return;
- }
- if (page != page.getTree().getRootNode()) {
- Class<? extends IPage> pageClass = page.getClass();
- Class<? extends IPage> parentClass = null;
- if (page.getParentPage() != null) {
- parentClass = page.getParentPage().getClass();
- }
- CompositeObject key = new CompositeObject(parentClass, pageClass);
- if (visitedPages.contains(key)) {
- return;
- }
- else {
- visitedPages.add(key);
- }
- }
- setSubTitle(page.getCell().getText() + " [" + page.getClass().getSimpleName() + "]");
- try {
- if (page.isVisible() && page.isEnabled()) {
- page.getOutline().selectNode(page);
-
- // is there a specific test for this page?
- for (IPageTest tester : m_pageTester) {
- if (tester.canHandle(page)) {
- page = tester.testPage(page); // continue testing with the result
- break;
- }
- }
-
- if (page != null && page.isVisible() && page.isEnabled()) {
- if (page instanceof IPageWithTable<?>) {
- testPageWithTable((IPageWithTable<?>) page);
- addOkStatus(null);
- }
- else if (page instanceof IPageWithNodes) {
- testPageWithNodes((IPageWithNodes) page);
- addOkStatus(null);
- }
- else {
- addWarningStatus("unsupported page type: " + page.getClass().getCanonicalName());
- }
- }
- }
- }
- catch (Throwable t) {
- addErrorStatus(t.getMessage(), t);
- }
- }
-
- protected void testPageWithTable(IPageWithTable<?> page) throws ProcessingException {
- ISearchForm searchForm = page.getSearchFormInternal();
- P_LimitingResultSetSearchFormListener searchFormListener = null;
- if (searchForm != null) {
- searchFormListener = new P_LimitingResultSetSearchFormListener(searchForm);
- searchForm.addFormListener(searchFormListener);
- testSearchForm(page, searchForm);
- if (page.isSearchRequired()) {
- searchForm.doReset();
- fillMandatoryFields(searchForm);
- searchForm.doSaveWithoutMarkerChange();
- }
- searchForm.removeFormListener(searchFormListener);
- }
- if (page.getChildNodeCount() > 0) {
- IPage child = page.getChildPage(0);
- testPage(child);
- }
- }
-
- protected void testPageWithNodes(IPageWithNodes page) throws ProcessingException {
- for (IPage childPage : page.getChildPages()) {
- testPage(childPage);
- }
- }
-
- protected void testSearchForm(IPageWithTable<?> page, final ISearchForm searchForm) throws ProcessingException {
- if (searchForm == null) {
- return;
- }
- for (IFormField field : searchForm.getAllFields()) {
- if (field instanceof IValueField) {
- setSubTitle(StringUtility.join(" > ", StringUtility.nvl(searchForm.getTitle(), searchForm.getClass().getSimpleName()), field.getLabel()) + " [" + field.getClass().getSimpleName() + "]");
- try {
- searchForm.doReset();
- try {
- fillMandatoryFields(searchForm);
- if (fillValueField((IValueField) field)) {
- searchForm.doSaveWithoutMarkerChange();
- addOkStatus(null);
- }
- }
- catch (VetoException e) {
- addWarningStatus("Veto", null);
- }
- }
- catch (Throwable t) {
- addErrorStatus(t.getMessage(), t);
- }
- }
- else if (field instanceof IComposerField) {
- testComposerField(searchForm, (IComposerField) field);
- }
- }
- }
-
- protected void testComposerField(ISearchForm searchForm, IComposerField field) {
- }
-
- protected void fillMandatoryFields(ISearchForm searchForm) throws ProcessingException {
- if (searchForm == null) {
- return;
- }
- for (IFormField field : searchForm.getAllFields()) {
- if (field instanceof IValueField && ((IValueField) field).isMandatory()) {
- fillValueField((IValueField) field);
- }
- }
- }
-
- protected boolean fillValueField(IValueField<?> field) throws ProcessingException {
- boolean successful = false;
- if (field.isEnabled() && field.isVisible()) {
- if (field instanceof IBooleanField) {
- successful = fillBooleanField((IBooleanField) field);
- }
- else if (field instanceof IDateField) {
- successful = fillDateField((IDateField) field);
- }
- else if (field instanceof IBigDecimalField) {
- successful = fillBigDecimalField((IBigDecimalField) field);
- }
- else if (field instanceof IDoubleField) {
- successful = fillDoubleField((IDoubleField) field);
- }
- else if (field instanceof IListBox) {
- successful = fillListBox((IListBox) field);
- }
- else if (field instanceof IBigIntegerField) {
- successful = fillBigIntegerField((IBigIntegerField) field);
- }
- else if (field instanceof IIntegerField) {
- successful = fillIntegerField((IIntegerField) field);
- }
- else if (field instanceof ILongField) {
- successful = fillLongField((ILongField) field);
- }
- else if (field instanceof IRadioButtonGroup) {
- successful = fillRadioButtonGroup((IRadioButtonGroup) field);
- }
- else if (field instanceof ISmartField) {
- successful = fillSmartField((ISmartField) field);
- }
- else if (field instanceof IStringField) {
- successful = fillStringField((IStringField) field);
- }
- else if (field instanceof ITreeBox) {
- successful = fillTreeBox((ITreeBox<?>) field);
- }
- else {
- return false;
- }
- }
- return successful && field.isContentValid();
- }
-
- protected boolean fillBooleanField(IBooleanField field) {
- field.setValue(true);
- return field.isContentValid();
- }
-
- protected boolean fillDateField(IDateField field) {
- if (field.isHasTime()) {
- field.setValue(new Date());
- }
- else {
- field.setValue(DateUtility.truncDate(new Date()));
- }
- return field.isContentValid();
- }
-
- protected boolean fillBigDecimalField(IBigDecimalField field) {
- BigDecimal value = field.getMinValue();
- if (value == null) {
- value = field.getMaxValue();
- }
- if (value == null) {
- value = BigDecimal.ONE;
- }
- field.setValue(value);
- return field.isContentValid();
- }
-
- protected boolean fillDoubleField(IDoubleField field) {
- Double value = field.getMinValue();
- if (value == null) {
- value = field.getMaxValue();
- }
- if (value == null) {
- value = Double.valueOf(1.2345d);
- }
- if (value.doubleValue() == value.longValue()) {
- // test with fractional value
- value = Double.valueOf(value.doubleValue() + 0.2345d);
- }
- field.setValue(value);
- return true;
- }
-
- @SuppressWarnings("unchecked")
- protected boolean fillListBox(IListBox field) {
- ITable table = field.getTable();
- if (table.getRowCount() > 0) {
- for (ITableRow row : table.getRows()) {
- if (row.isEnabled()) {
- Object[] keyValues = row.getKeyValues();
- if (keyValues.length > 0) {
- field.checkKey(keyValues[0]);
- return true;
- }
- }
- }
- }
- return false;
- }
-
- protected boolean fillBigIntegerField(IBigIntegerField field) {
- BigInteger value = field.getMinValue();
- if (value == null) {
- value = field.getMaxValue();
- }
- if (value == null) {
- value = BigInteger.ONE;
- }
- field.setValue(value);
- return true;
- }
-
- protected boolean fillIntegerField(IIntegerField field) {
- Integer value = field.getMinValue();
- if (value == null) {
- value = field.getMaxValue();
- }
- if (value == null) {
- value = Integer.valueOf(42);
- }
- field.setValue(value);
- return true;
- }
-
- protected boolean fillLongField(ILongField field) {
- Long value = field.getMinValue();
- if (value == null) {
- value = field.getMaxValue();
- }
- if (value == null) {
- value = Long.valueOf(192L);
- }
- field.setValue(value);
- return true;
- }
-
- protected boolean fillRadioButtonGroup(IRadioButtonGroup field) throws ProcessingException {
- IButton[] buttons = field.getButtons();
- if (buttons != null) {
- for (IButton button : buttons) {
- if (button.isVisible() && button.isEnabled()) {
- button.doClick();
- return true;
- }
- }
- }
- return false;
- }
-
- @SuppressWarnings("unchecked")
- protected boolean fillSmartField(ISmartField field) throws ProcessingException {
- LookupRow[] lookupRows = field.callBrowseLookup(null, 10);
- if (lookupRows != null && lookupRows.length > 0) {
- field.setValue(lookupRows[0].getKey());
- return true;
- }
- return false;
- }
-
- protected boolean fillStringField(IStringField field) {
- field.setValue("abcd1234");
- return field.isContentValid();
- }
-
- @SuppressWarnings("unchecked")
- protected boolean fillTreeBox(ITreeBox field) throws ProcessingException {
- ITreeNode node = getFirstSelectableNode(field.getTree().getRootNode());
- if (node != null) {
- field.setValue(node.getPrimaryKey());
- return true;
- }
- return false;
- }
-
- protected ITreeNode getFirstSelectableNode(ITreeNode... nodes) {
- if (nodes != null) {
- for (ITreeNode node : nodes) {
- if (node != null) {
- if (node.isEnabled() && node.isVisible() && node.getParentNode() != null) {
- return node;
- }
- else {
- ITreeNode selecteableNode = getFirstSelectableNode(node.getChildNodes());
- if (selecteableNode != null) {
- return selecteableNode;
- }
- }
- }
- }
- }
- return null;
- }
-
- @Override
- protected String getConfiguredTitle() {
- return "outline drill-down";
- }
-
- private static class P_LimitingResultSetSearchFormListener implements FormListener {
- final ISearchForm searchForm;
-
- public P_LimitingResultSetSearchFormListener(ISearchForm searchForm) {
- this.searchForm = searchForm;
- }
-
- @Override
- public void formChanged(FormEvent e) throws ProcessingException {
- if (e.getType() == FormEvent.TYPE_STORE_AFTER) {
- // TODO fill out searchForm
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.test;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.scout.commons.CompositeObject;
+import org.eclipse.scout.commons.DateUtility;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.exception.VetoException;
+import org.eclipse.scout.rt.client.services.common.test.AbstractClientTest;
+import org.eclipse.scout.rt.client.services.common.test.ClientTestUtility;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithNodes;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.ISearchForm;
+import org.eclipse.scout.rt.client.ui.form.FormEvent;
+import org.eclipse.scout.rt.client.ui.form.FormListener;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
+import org.eclipse.scout.rt.client.ui.form.fields.bigdecimalfield.IBigDecimalField;
+import org.eclipse.scout.rt.client.ui.form.fields.bigintegerfield.IBigIntegerField;
+import org.eclipse.scout.rt.client.ui.form.fields.booleanfield.IBooleanField;
+import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
+import org.eclipse.scout.rt.client.ui.form.fields.composer.IComposerField;
+import org.eclipse.scout.rt.client.ui.form.fields.datefield.IDateField;
+import org.eclipse.scout.rt.client.ui.form.fields.doublefield.IDoubleField;
+import org.eclipse.scout.rt.client.ui.form.fields.integerfield.IIntegerField;
+import org.eclipse.scout.rt.client.ui.form.fields.listbox.IListBox;
+import org.eclipse.scout.rt.client.ui.form.fields.longfield.ILongField;
+import org.eclipse.scout.rt.client.ui.form.fields.radiobuttongroup.IRadioButtonGroup;
+import org.eclipse.scout.rt.client.ui.form.fields.smartfield.ISmartField;
+import org.eclipse.scout.rt.client.ui.form.fields.stringfield.IStringField;
+import org.eclipse.scout.rt.client.ui.form.fields.treebox.ITreeBox;
+import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
+import org.eclipse.scout.service.SERVICES;
+
+public class DrilldownOutlineUnitTest extends AbstractClientTest {
+
+ private final Set<CompositeObject> visitedPages = new HashSet<CompositeObject>();
+ private IPageTest[] m_pageTester;
+
+ protected void clearVisitCache() {
+ visitedPages.clear();
+ }
+
+ @Override
+ public void setUp() {
+ m_pageTester = SERVICES.getServices(IPageTest.class);
+ }
+
+ @Override
+ public void run() throws Exception {
+ clearVisitCache();
+ for (IOutline outline : ClientTestUtility.getDesktop().getAvailableOutlines()) {
+ if (outline.isVisible() && outline.isEnabled()) {
+ ClientTestUtility.getDesktop().setOutline(outline);
+ testPage(outline.getRootPage());
+ }
+ }
+ }
+
+ @Override
+ public void tearDown() throws Throwable {
+ clearVisitCache();
+ }
+
+ protected void testPage(IPage page) throws ProcessingException {
+ if (page == null) {
+ return;
+ }
+ if (page != page.getTree().getRootNode()) {
+ Class<? extends IPage> pageClass = page.getClass();
+ Class<? extends IPage> parentClass = null;
+ if (page.getParentPage() != null) {
+ parentClass = page.getParentPage().getClass();
+ }
+ CompositeObject key = new CompositeObject(parentClass, pageClass);
+ if (visitedPages.contains(key)) {
+ return;
+ }
+ else {
+ visitedPages.add(key);
+ }
+ }
+ setSubTitle(page.getCell().getText() + " [" + page.getClass().getSimpleName() + "]");
+ try {
+ if (page.isVisible() && page.isEnabled()) {
+ page.getOutline().selectNode(page);
+
+ // is there a specific test for this page?
+ for (IPageTest tester : m_pageTester) {
+ if (tester.canHandle(page)) {
+ page = tester.testPage(page); // continue testing with the result
+ break;
+ }
+ }
+
+ if (page != null && page.isVisible() && page.isEnabled()) {
+ if (page instanceof IPageWithTable<?>) {
+ testPageWithTable((IPageWithTable<?>) page);
+ addOkStatus(null);
+ }
+ else if (page instanceof IPageWithNodes) {
+ testPageWithNodes((IPageWithNodes) page);
+ addOkStatus(null);
+ }
+ else {
+ addWarningStatus("unsupported page type: " + page.getClass().getCanonicalName());
+ }
+ }
+ }
+ }
+ catch (Throwable t) {
+ addErrorStatus(t.getMessage(), t);
+ }
+ }
+
+ protected void testPageWithTable(IPageWithTable<?> page) throws ProcessingException {
+ ISearchForm searchForm = page.getSearchFormInternal();
+ P_LimitingResultSetSearchFormListener searchFormListener = null;
+ if (searchForm != null) {
+ searchFormListener = new P_LimitingResultSetSearchFormListener(searchForm);
+ searchForm.addFormListener(searchFormListener);
+ testSearchForm(page, searchForm);
+ if (page.isSearchRequired()) {
+ searchForm.doReset();
+ fillMandatoryFields(searchForm);
+ searchForm.doSaveWithoutMarkerChange();
+ }
+ searchForm.removeFormListener(searchFormListener);
+ }
+ if (page.getChildNodeCount() > 0) {
+ IPage child = page.getChildPage(0);
+ testPage(child);
+ }
+ }
+
+ protected void testPageWithNodes(IPageWithNodes page) throws ProcessingException {
+ for (IPage childPage : page.getChildPages()) {
+ testPage(childPage);
+ }
+ }
+
+ protected void testSearchForm(IPageWithTable<?> page, final ISearchForm searchForm) throws ProcessingException {
+ if (searchForm == null) {
+ return;
+ }
+ for (IFormField field : searchForm.getAllFields()) {
+ if (field instanceof IValueField) {
+ setSubTitle(StringUtility.join(" > ", StringUtility.nvl(searchForm.getTitle(), searchForm.getClass().getSimpleName()), field.getLabel()) + " [" + field.getClass().getSimpleName() + "]");
+ try {
+ searchForm.doReset();
+ try {
+ fillMandatoryFields(searchForm);
+ if (fillValueField((IValueField) field)) {
+ searchForm.doSaveWithoutMarkerChange();
+ addOkStatus(null);
+ }
+ }
+ catch (VetoException e) {
+ addWarningStatus("Veto", null);
+ }
+ }
+ catch (Throwable t) {
+ addErrorStatus(t.getMessage(), t);
+ }
+ }
+ else if (field instanceof IComposerField) {
+ testComposerField(searchForm, (IComposerField) field);
+ }
+ }
+ }
+
+ protected void testComposerField(ISearchForm searchForm, IComposerField field) {
+ }
+
+ protected void fillMandatoryFields(ISearchForm searchForm) throws ProcessingException {
+ if (searchForm == null) {
+ return;
+ }
+ for (IFormField field : searchForm.getAllFields()) {
+ if (field instanceof IValueField && ((IValueField) field).isMandatory()) {
+ fillValueField((IValueField) field);
+ }
+ }
+ }
+
+ protected boolean fillValueField(IValueField<?> field) throws ProcessingException {
+ boolean successful = false;
+ if (field.isEnabled() && field.isVisible()) {
+ if (field instanceof IBooleanField) {
+ successful = fillBooleanField((IBooleanField) field);
+ }
+ else if (field instanceof IDateField) {
+ successful = fillDateField((IDateField) field);
+ }
+ else if (field instanceof IBigDecimalField) {
+ successful = fillBigDecimalField((IBigDecimalField) field);
+ }
+ else if (field instanceof IDoubleField) {
+ successful = fillDoubleField((IDoubleField) field);
+ }
+ else if (field instanceof IListBox) {
+ successful = fillListBox((IListBox) field);
+ }
+ else if (field instanceof IBigIntegerField) {
+ successful = fillBigIntegerField((IBigIntegerField) field);
+ }
+ else if (field instanceof IIntegerField) {
+ successful = fillIntegerField((IIntegerField) field);
+ }
+ else if (field instanceof ILongField) {
+ successful = fillLongField((ILongField) field);
+ }
+ else if (field instanceof IRadioButtonGroup) {
+ successful = fillRadioButtonGroup((IRadioButtonGroup) field);
+ }
+ else if (field instanceof ISmartField) {
+ successful = fillSmartField((ISmartField) field);
+ }
+ else if (field instanceof IStringField) {
+ successful = fillStringField((IStringField) field);
+ }
+ else if (field instanceof ITreeBox) {
+ successful = fillTreeBox((ITreeBox<?>) field);
+ }
+ else {
+ return false;
+ }
+ }
+ return successful && field.isContentValid();
+ }
+
+ protected boolean fillBooleanField(IBooleanField field) {
+ field.setValue(true);
+ return field.isContentValid();
+ }
+
+ protected boolean fillDateField(IDateField field) {
+ if (field.isHasTime()) {
+ field.setValue(new Date());
+ }
+ else {
+ field.setValue(DateUtility.truncDate(new Date()));
+ }
+ return field.isContentValid();
+ }
+
+ protected boolean fillBigDecimalField(IBigDecimalField field) {
+ BigDecimal value = field.getMinValue();
+ if (value == null) {
+ value = field.getMaxValue();
+ }
+ if (value == null) {
+ value = BigDecimal.ONE;
+ }
+ field.setValue(value);
+ return field.isContentValid();
+ }
+
+ protected boolean fillDoubleField(IDoubleField field) {
+ Double value = field.getMinValue();
+ if (value == null) {
+ value = field.getMaxValue();
+ }
+ if (value == null) {
+ value = Double.valueOf(1.2345d);
+ }
+ if (value.doubleValue() == value.longValue()) {
+ // test with fractional value
+ value = Double.valueOf(value.doubleValue() + 0.2345d);
+ }
+ field.setValue(value);
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ protected boolean fillListBox(IListBox field) {
+ ITable table = field.getTable();
+ if (table.getRowCount() > 0) {
+ for (ITableRow row : table.getRows()) {
+ if (row.isEnabled()) {
+ Object[] keyValues = row.getKeyValues();
+ if (keyValues.length > 0) {
+ field.checkKey(keyValues[0]);
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ protected boolean fillBigIntegerField(IBigIntegerField field) {
+ BigInteger value = field.getMinValue();
+ if (value == null) {
+ value = field.getMaxValue();
+ }
+ if (value == null) {
+ value = BigInteger.ONE;
+ }
+ field.setValue(value);
+ return true;
+ }
+
+ protected boolean fillIntegerField(IIntegerField field) {
+ Integer value = field.getMinValue();
+ if (value == null) {
+ value = field.getMaxValue();
+ }
+ if (value == null) {
+ value = Integer.valueOf(42);
+ }
+ field.setValue(value);
+ return true;
+ }
+
+ protected boolean fillLongField(ILongField field) {
+ Long value = field.getMinValue();
+ if (value == null) {
+ value = field.getMaxValue();
+ }
+ if (value == null) {
+ value = Long.valueOf(192L);
+ }
+ field.setValue(value);
+ return true;
+ }
+
+ protected boolean fillRadioButtonGroup(IRadioButtonGroup field) throws ProcessingException {
+ IButton[] buttons = field.getButtons();
+ if (buttons != null) {
+ for (IButton button : buttons) {
+ if (button.isVisible() && button.isEnabled()) {
+ button.doClick();
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ @SuppressWarnings("unchecked")
+ protected boolean fillSmartField(ISmartField field) throws ProcessingException {
+ LookupRow[] lookupRows = field.callBrowseLookup(null, 10);
+ if (lookupRows != null && lookupRows.length > 0) {
+ field.setValue(lookupRows[0].getKey());
+ return true;
+ }
+ return false;
+ }
+
+ protected boolean fillStringField(IStringField field) {
+ field.setValue("abcd1234");
+ return field.isContentValid();
+ }
+
+ @SuppressWarnings("unchecked")
+ protected boolean fillTreeBox(ITreeBox field) throws ProcessingException {
+ ITreeNode node = getFirstSelectableNode(field.getTree().getRootNode());
+ if (node != null) {
+ field.setValue(node.getPrimaryKey());
+ return true;
+ }
+ return false;
+ }
+
+ protected ITreeNode getFirstSelectableNode(ITreeNode... nodes) {
+ if (nodes != null) {
+ for (ITreeNode node : nodes) {
+ if (node != null) {
+ if (node.isEnabled() && node.isVisible() && node.getParentNode() != null) {
+ return node;
+ }
+ else {
+ ITreeNode selecteableNode = getFirstSelectableNode(node.getChildNodes());
+ if (selecteableNode != null) {
+ return selecteableNode;
+ }
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ @Override
+ protected String getConfiguredTitle() {
+ return "outline drill-down";
+ }
+
+ private static class P_LimitingResultSetSearchFormListener implements FormListener {
+ final ISearchForm searchForm;
+
+ public P_LimitingResultSetSearchFormListener(ISearchForm searchForm) {
+ this.searchForm = searchForm;
+ }
+
+ @Override
+ public void formChanged(FormEvent e) throws ProcessingException {
+ if (e.getType() == FormEvent.TYPE_STORE_AFTER) {
+ // TODO fill out searchForm
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/DuplicateKeyStrokeUnitTest.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/DuplicateKeyStrokeUnitTest.java
index 6b10225e80..ded2b792fa 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/DuplicateKeyStrokeUnitTest.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/DuplicateKeyStrokeUnitTest.java
@@ -1,59 +1,59 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.test;
-
-import java.util.ArrayList;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.services.common.test.AbstractClientTest;
-import org.eclipse.scout.rt.client.services.common.test.ClientTestUtility;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-
-public class DuplicateKeyStrokeUnitTest extends AbstractClientTest {
-
- ArrayList<String> keyStrokes = new ArrayList<String>();
-
- @Override
- public void run() throws Exception {
- for (IMenu menu : ClientTestUtility.getDesktop().getMenus()) {
- checkMenus(menu);
- }
- }
-
- @Override
- public void tearDown() throws Throwable {
- keyStrokes.clear();
- }
-
- public void checkMenus(IMenu menu) throws ProcessingException {
- setSubTitle(menu.getText() + " [" + menu.getClass().getSimpleName() + "]");
- String k = menu.getKeyStroke();
- if (k != null) {
- if (keyStrokes.contains(k)) {
- addWarningStatus(k);
- }
- else {
- addOkStatus(k);
- }
- keyStrokes.add(k);
- }
- // children
- for (IMenu sub : menu.getChildActions()) {
- checkMenus(sub);
- }
- }
-
- @Override
- protected String getConfiguredTitle() {
- return "menubar: duplicate key strokes";
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.test;
+
+import java.util.ArrayList;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.services.common.test.AbstractClientTest;
+import org.eclipse.scout.rt.client.services.common.test.ClientTestUtility;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+
+public class DuplicateKeyStrokeUnitTest extends AbstractClientTest {
+
+ ArrayList<String> keyStrokes = new ArrayList<String>();
+
+ @Override
+ public void run() throws Exception {
+ for (IMenu menu : ClientTestUtility.getDesktop().getMenus()) {
+ checkMenus(menu);
+ }
+ }
+
+ @Override
+ public void tearDown() throws Throwable {
+ keyStrokes.clear();
+ }
+
+ public void checkMenus(IMenu menu) throws ProcessingException {
+ setSubTitle(menu.getText() + " [" + menu.getClass().getSimpleName() + "]");
+ String k = menu.getKeyStroke();
+ if (k != null) {
+ if (keyStrokes.contains(k)) {
+ addWarningStatus(k);
+ }
+ else {
+ addOkStatus(k);
+ }
+ keyStrokes.add(k);
+ }
+ // children
+ for (IMenu sub : menu.getChildActions()) {
+ checkMenus(sub);
+ }
+ }
+
+ @Override
+ protected String getConfiguredTitle() {
+ return "menubar: duplicate key strokes";
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/DuplicateMnemonicUnitTest.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/DuplicateMnemonicUnitTest.java
index 010f012d84..be5a4af0b4 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/DuplicateMnemonicUnitTest.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/DuplicateMnemonicUnitTest.java
@@ -1,56 +1,56 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.test;
-
-import java.util.ArrayList;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.services.common.test.AbstractClientTest;
-import org.eclipse.scout.rt.client.services.common.test.ClientTestUtility;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-
-public class DuplicateMnemonicUnitTest extends AbstractClientTest {
-
- @Override
- public void run() throws Exception {
- checkMenus("top level", ClientTestUtility.getDesktop().getMenus());
- }
-
- public void checkMenus(String subTitle, IMenu[] menus) throws ProcessingException {
- setSubTitle(subTitle);
- ArrayList<Character> mnemonics = new ArrayList<Character>();
- for (IMenu menu : menus) {
- Character m = menu.getMnemonic();
- if (m != null && m.charValue() > 0) {
- if (mnemonics.contains(m)) {
- addWarningStatus("duplicate mnemonic " + m);
- }
- else {
- addOkStatus("mnemonic " + m);
- }
- mnemonics.add(m);
- }
- }
- // children
- for (IMenu menu : menus) {
- if (menu.getChildActions().size() > 0 && menu.isVisible()) {
- IMenu[] childs = menu.getChildActions().toArray(new IMenu[menu.getChildActions().size()]);
- checkMenus(menu.getText() + " [" + menu.getClass().getSimpleName() + "]", childs);
- }
- }
- }
-
- @Override
- protected String getConfiguredTitle() {
- return "menubar: duplicate mnemonic on any level";
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.test;
+
+import java.util.ArrayList;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.services.common.test.AbstractClientTest;
+import org.eclipse.scout.rt.client.services.common.test.ClientTestUtility;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+
+public class DuplicateMnemonicUnitTest extends AbstractClientTest {
+
+ @Override
+ public void run() throws Exception {
+ checkMenus("top level", ClientTestUtility.getDesktop().getMenus());
+ }
+
+ public void checkMenus(String subTitle, IMenu[] menus) throws ProcessingException {
+ setSubTitle(subTitle);
+ ArrayList<Character> mnemonics = new ArrayList<Character>();
+ for (IMenu menu : menus) {
+ Character m = menu.getMnemonic();
+ if (m != null && m.charValue() > 0) {
+ if (mnemonics.contains(m)) {
+ addWarningStatus("duplicate mnemonic " + m);
+ }
+ else {
+ addOkStatus("mnemonic " + m);
+ }
+ mnemonics.add(m);
+ }
+ }
+ // children
+ for (IMenu menu : menus) {
+ if (menu.getChildActions().size() > 0 && menu.isVisible()) {
+ IMenu[] childs = menu.getChildActions().toArray(new IMenu[menu.getChildActions().size()]);
+ checkMenus(menu.getText() + " [" + menu.getClass().getSimpleName() + "]", childs);
+ }
+ }
+ }
+
+ @Override
+ protected String getConfiguredTitle() {
+ return "menubar: duplicate mnemonic on any level";
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/ExistsLabelFieldsUnitTest.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/ExistsLabelFieldsUnitTest.java
index ffd707a0f6..66f6e60241 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/ExistsLabelFieldsUnitTest.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/ExistsLabelFieldsUnitTest.java
@@ -1,57 +1,57 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.test;
-
-import org.eclipse.scout.commons.runtime.BundleBrowser;
-import org.eclipse.scout.rt.client.services.common.test.AbstractClientTest;
-import org.eclipse.scout.rt.client.services.common.test.ClientTestUtility;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
-import org.osgi.framework.Bundle;
-
-public class ExistsLabelFieldsUnitTest extends AbstractClientTest {
-
- @Override
- public void run() throws Exception {
- Bundle clientBundle = ClientTestUtility.getClientBundle();
- BundleBrowser b = new BundleBrowser(clientBundle.getSymbolicName(), ClientTestUtility.getFormsPackage());
- for (String className : b.getClasses(false, false)) {
- Class<?> c = clientBundle.loadClass(className);
- try {
- IForm form = (IForm) c.newInstance();
- for (IFormField childField : form.getAllFields()) {
- if (childField instanceof IValueField) {
- // test
- setSubTitle(form.getTitle() + " > " + childField.getLabel() + form.getClass().getSimpleName() + "." + childField.getClass().getSimpleName());
- if (childField.getLabel() == null) {
- addErrorStatus("no label");
- }
- else if (childField.getLabel() != null && childField.getLabel().contains("{undefined")) {
- addWarningStatus("no label translation");
- }
- else {
- addOkStatus(childField.getLabel());
- }
- }
- }
- }
- catch (Exception e) {
- }
- }
- }
-
- @Override
- protected String getConfiguredTitle() {
- return "value fields without a label";
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.test;
+
+import org.eclipse.scout.commons.runtime.BundleBrowser;
+import org.eclipse.scout.rt.client.services.common.test.AbstractClientTest;
+import org.eclipse.scout.rt.client.services.common.test.ClientTestUtility;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
+import org.osgi.framework.Bundle;
+
+public class ExistsLabelFieldsUnitTest extends AbstractClientTest {
+
+ @Override
+ public void run() throws Exception {
+ Bundle clientBundle = ClientTestUtility.getClientBundle();
+ BundleBrowser b = new BundleBrowser(clientBundle.getSymbolicName(), ClientTestUtility.getFormsPackage());
+ for (String className : b.getClasses(false, false)) {
+ Class<?> c = clientBundle.loadClass(className);
+ try {
+ IForm form = (IForm) c.newInstance();
+ for (IFormField childField : form.getAllFields()) {
+ if (childField instanceof IValueField) {
+ // test
+ setSubTitle(form.getTitle() + " > " + childField.getLabel() + form.getClass().getSimpleName() + "." + childField.getClass().getSimpleName());
+ if (childField.getLabel() == null) {
+ addErrorStatus("no label");
+ }
+ else if (childField.getLabel() != null && childField.getLabel().contains("{undefined")) {
+ addWarningStatus("no label translation");
+ }
+ else {
+ addOkStatus(childField.getLabel());
+ }
+ }
+ }
+ }
+ catch (Exception e) {
+ }
+ }
+ }
+
+ @Override
+ protected String getConfiguredTitle() {
+ return "value fields without a label";
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/ExistsMnemonicUnitTest.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/ExistsMnemonicUnitTest.java
index a290ce7436..515cc69c4c 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/ExistsMnemonicUnitTest.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/ExistsMnemonicUnitTest.java
@@ -1,46 +1,46 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.test;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.services.common.test.AbstractClientTest;
-import org.eclipse.scout.rt.client.services.common.test.ClientTestUtility;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-
-public class ExistsMnemonicUnitTest extends AbstractClientTest {
-
- @Override
- public void run() throws Exception {
- for (IMenu menu : ClientTestUtility.getDesktop().getMenus()) {
- checkMainMenus(menu);
- }
- }
-
- public void checkMainMenus(IMenu menu) throws ProcessingException {
- setSubTitle(menu.getText() + " [" + menu.getClass().getSimpleName() + "]");
- if (!menu.isSeparator() && menu.getMnemonic() == 0x0 && menu.isVisible()) {
- addWarningStatus("no mnemonic");
- }
- else {
- addOkStatus("mnemonic " + menu.getMnemonic());
- }
- // children
- for (IMenu sub : menu.getChildActions()) {
- checkMainMenus(sub);
- }
- }
-
- @Override
- protected String getConfiguredTitle() {
- return "menubar: exists mnemonic on all items";
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.test;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.services.common.test.AbstractClientTest;
+import org.eclipse.scout.rt.client.services.common.test.ClientTestUtility;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+
+public class ExistsMnemonicUnitTest extends AbstractClientTest {
+
+ @Override
+ public void run() throws Exception {
+ for (IMenu menu : ClientTestUtility.getDesktop().getMenus()) {
+ checkMainMenus(menu);
+ }
+ }
+
+ public void checkMainMenus(IMenu menu) throws ProcessingException {
+ setSubTitle(menu.getText() + " [" + menu.getClass().getSimpleName() + "]");
+ if (!menu.isSeparator() && menu.getMnemonic() == 0x0 && menu.isVisible()) {
+ addWarningStatus("no mnemonic");
+ }
+ else {
+ addOkStatus("mnemonic " + menu.getMnemonic());
+ }
+ // children
+ for (IMenu sub : menu.getChildActions()) {
+ checkMainMenus(sub);
+ }
+ }
+
+ @Override
+ protected String getConfiguredTitle() {
+ return "menubar: exists mnemonic on all items";
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/FormBasedTestContext.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/FormBasedTestContext.java
index 4c74933e89..688d0fba88 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/FormBasedTestContext.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/FormBasedTestContext.java
@@ -1,73 +1,73 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.test;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.test.DefaultClientTestForm.MainBox.ResultsGroupBox.ResultsTableField;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.shared.services.common.test.BasicTestContext;
-import org.eclipse.scout.rt.shared.services.common.test.TestStatus;
-
-public class FormBasedTestContext extends BasicTestContext {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(FormBasedTestContext.class);
- private final DefaultClientTestForm m_form;
-
- public FormBasedTestContext(DefaultClientTestForm form) {
- m_form = form;
- }
-
- @Override
- public void begin() {
- super.begin();
- m_form.getResultsTableField().getTable().discardAllRows();
- m_form.getSuccessfulTestsField().setValue(null);
- m_form.getWarningTestsField().setValue(null);
- m_form.getFailedTestsField().setValue(null);
- m_form.getTotalTestsField().setValue(null);
- }
-
- @Override
- public void end() {
- super.end();
- // summary
- m_form.getSuccessfulTestsField().setValue((long) getSeverityCount(TestStatus.INFO));
- m_form.getWarningTestsField().setValue((long) getSeverityCount(TestStatus.WARNING));
- m_form.getFailedTestsField().setValue((long) (getSeverityCount(TestStatus.ERROR) + getSeverityCount(TestStatus.FATAL)));
- m_form.getTotalTestsField().setValue((long) getStatusList().size());
- }
-
- @Override
- public void addStatus(TestStatus s) {
- super.addStatus(s);
- if ((s.getSeverity() == TestStatus.INFO && m_form.getLevel1Box().getValue()) ||
- (s.getSeverity() == TestStatus.WARNING && m_form.getLevel2Box().getValue()) ||
- (s.getSeverity() == TestStatus.ERROR && m_form.getLevel3Box().getValue()) ||
- (s.getSeverity() == TestStatus.FATAL && m_form.getLevel3Box().getValue())) {
- try {
- ResultsTableField.Table table = m_form.getResultsTableField().getTable();
- ITableRow r = table.createRow();
- table.getProductColumn().setValue(r, s.getProduct());
- table.getTitleColumn().setValue(r, s.getTitle());
- table.getSubTitleColumn().setValue(r, s.getSubTitle());
- table.getResultColumn().setValue(r, TestStatus.getSeverityAsText(s.getSeverity()));
- table.getDurationColumn().setValue(r, s.getDuration());
- //
- table.addRow(r);
- }
- catch (ProcessingException e) {
- LOG.warn(null, e);
- }
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.test;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.test.DefaultClientTestForm.MainBox.ResultsGroupBox.ResultsTableField;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.shared.services.common.test.BasicTestContext;
+import org.eclipse.scout.rt.shared.services.common.test.TestStatus;
+
+public class FormBasedTestContext extends BasicTestContext {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(FormBasedTestContext.class);
+ private final DefaultClientTestForm m_form;
+
+ public FormBasedTestContext(DefaultClientTestForm form) {
+ m_form = form;
+ }
+
+ @Override
+ public void begin() {
+ super.begin();
+ m_form.getResultsTableField().getTable().discardAllRows();
+ m_form.getSuccessfulTestsField().setValue(null);
+ m_form.getWarningTestsField().setValue(null);
+ m_form.getFailedTestsField().setValue(null);
+ m_form.getTotalTestsField().setValue(null);
+ }
+
+ @Override
+ public void end() {
+ super.end();
+ // summary
+ m_form.getSuccessfulTestsField().setValue((long) getSeverityCount(TestStatus.INFO));
+ m_form.getWarningTestsField().setValue((long) getSeverityCount(TestStatus.WARNING));
+ m_form.getFailedTestsField().setValue((long) (getSeverityCount(TestStatus.ERROR) + getSeverityCount(TestStatus.FATAL)));
+ m_form.getTotalTestsField().setValue((long) getStatusList().size());
+ }
+
+ @Override
+ public void addStatus(TestStatus s) {
+ super.addStatus(s);
+ if ((s.getSeverity() == TestStatus.INFO && m_form.getLevel1Box().getValue()) ||
+ (s.getSeverity() == TestStatus.WARNING && m_form.getLevel2Box().getValue()) ||
+ (s.getSeverity() == TestStatus.ERROR && m_form.getLevel3Box().getValue()) ||
+ (s.getSeverity() == TestStatus.FATAL && m_form.getLevel3Box().getValue())) {
+ try {
+ ResultsTableField.Table table = m_form.getResultsTableField().getTable();
+ ITableRow r = table.createRow();
+ table.getProductColumn().setValue(r, s.getProduct());
+ table.getTitleColumn().setValue(r, s.getTitle());
+ table.getSubTitleColumn().setValue(r, s.getSubTitle());
+ table.getResultColumn().setValue(r, TestStatus.getSeverityAsText(s.getSeverity()));
+ table.getDurationColumn().setValue(r, s.getDuration());
+ //
+ table.addRow(r);
+ }
+ catch (ProcessingException e) {
+ LOG.warn(null, e);
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/IPageTest.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/IPageTest.java
index 1aa9c541b4..c2e3dfb412 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/IPageTest.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/IPageTest.java
@@ -1,43 +1,43 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.test;
-
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.service.IService;
-
-/**
- * A test for one or several pages, that performs specific tests for these
- * pages. The service is used together with the {@link DrilldownOutlineUnitTest} and
- * {@link CurrentOutlineSearchFormUnitTest}. These tests then use this more
- * specific test if {@link IPageTest.canHandle} returns true.
- */
-public interface IPageTest extends IService {
-
- /**
- * Can this IPageTest handle the page and perform a specific test for this page?
- *
- * @param page
- * The page to be tested.
- * @return
- */
- boolean canHandle(IPage page);
-
- /**
- * Perform a test on <code>page</code>. <code>canHandle(page) == true</code> can be assumed.
- *
- * @param page
- * The page to be tested.
- * @return Another page (typically a child page) for which further testing will be performed.
- * @throws Throwable
- */
- IPage testPage(IPage page) throws Throwable;
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.test;
+
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.service.IService;
+
+/**
+ * A test for one or several pages, that performs specific tests for these
+ * pages. The service is used together with the {@link DrilldownOutlineUnitTest} and
+ * {@link CurrentOutlineSearchFormUnitTest}. These tests then use this more
+ * specific test if {@link IPageTest.canHandle} returns true.
+ */
+public interface IPageTest extends IService {
+
+ /**
+ * Can this IPageTest handle the page and perform a specific test for this page?
+ *
+ * @param page
+ * The page to be tested.
+ * @return
+ */
+ boolean canHandle(IPage page);
+
+ /**
+ * Perform a test on <code>page</code>. <code>canHandle(page) == true</code> can be assumed.
+ *
+ * @param page
+ * The page to be tested.
+ * @return Another page (typically a child page) for which further testing will be performed.
+ * @throws Throwable
+ */
+ IPage testPage(IPage page) throws Throwable;
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/LengthStringFieldsUnitTest.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/LengthStringFieldsUnitTest.java
index d74ceb2840..d0106f266c 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/LengthStringFieldsUnitTest.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/LengthStringFieldsUnitTest.java
@@ -1,66 +1,66 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.test;
-
-import org.eclipse.scout.commons.runtime.BundleBrowser;
-import org.eclipse.scout.rt.client.services.common.test.AbstractClientTest;
-import org.eclipse.scout.rt.client.services.common.test.ClientTestUtility;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.stringfield.IStringField;
-import org.osgi.framework.Bundle;
-
-public class LengthStringFieldsUnitTest extends AbstractClientTest {
-
- @Override
- public void run() throws Exception {
- Bundle clientBundle = ClientTestUtility.getClientBundle();
- BundleBrowser b = new BundleBrowser(clientBundle.getSymbolicName(), ClientTestUtility.getFormsPackage());
- for (String className : b.getClasses(false, false)) {
- Class<?> c = clientBundle.loadClass(className);
- try {
- IForm form = (IForm) c.newInstance();
- for (IFormField field : form.getAllFields()) {
- if (field instanceof IStringField) {
- // test
- setSubTitle(form.getTitle() + " > " + field.getLabel() + " [" + form.getClass().getSimpleName() + "." + field.getClass().getSimpleName() + "]");
- int length = ((IStringField) field).getMaxLength();
- int area = field.getGridData().h * field.getGridData().w;
- if (length < area * 30) {
- addErrorStatus("length<area*30");
- }
- else if (length > area * 300) {
- addErrorStatus("length>area*300");
- }
- else if (length < 10 && area > 1) {
- addWarningStatus("length<10 but area>1");
- }
- else if (length > 1000000) {
- addWarningStatus("length>1'000'000");
- }
- else {
- addOkStatus("length=" + length + ", area=" + area);
- }
- }
- }
- }
- catch (Exception e) {
- addErrorStatus("analyzing form " + c, e);
- }
- }
- }
-
- @Override
- protected String getConfiguredTitle() {
- return "string fields: size to length comparison";
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.test;
+
+import org.eclipse.scout.commons.runtime.BundleBrowser;
+import org.eclipse.scout.rt.client.services.common.test.AbstractClientTest;
+import org.eclipse.scout.rt.client.services.common.test.ClientTestUtility;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.stringfield.IStringField;
+import org.osgi.framework.Bundle;
+
+public class LengthStringFieldsUnitTest extends AbstractClientTest {
+
+ @Override
+ public void run() throws Exception {
+ Bundle clientBundle = ClientTestUtility.getClientBundle();
+ BundleBrowser b = new BundleBrowser(clientBundle.getSymbolicName(), ClientTestUtility.getFormsPackage());
+ for (String className : b.getClasses(false, false)) {
+ Class<?> c = clientBundle.loadClass(className);
+ try {
+ IForm form = (IForm) c.newInstance();
+ for (IFormField field : form.getAllFields()) {
+ if (field instanceof IStringField) {
+ // test
+ setSubTitle(form.getTitle() + " > " + field.getLabel() + " [" + form.getClass().getSimpleName() + "." + field.getClass().getSimpleName() + "]");
+ int length = ((IStringField) field).getMaxLength();
+ int area = field.getGridData().h * field.getGridData().w;
+ if (length < area * 30) {
+ addErrorStatus("length<area*30");
+ }
+ else if (length > area * 300) {
+ addErrorStatus("length>area*300");
+ }
+ else if (length < 10 && area > 1) {
+ addWarningStatus("length<10 but area>1");
+ }
+ else if (length > 1000000) {
+ addWarningStatus("length>1'000'000");
+ }
+ else {
+ addOkStatus("length=" + length + ", area=" + area);
+ }
+ }
+ }
+ }
+ catch (Exception e) {
+ addErrorStatus("analyzing form " + c, e);
+ }
+ }
+ }
+
+ @Override
+ protected String getConfiguredTitle() {
+ return "string fields: size to length comparison";
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/UppercaseMnemonicUnitTest.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/UppercaseMnemonicUnitTest.java
index ca0aced077..25b67a1a63 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/UppercaseMnemonicUnitTest.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/UppercaseMnemonicUnitTest.java
@@ -1,46 +1,46 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.test;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.services.common.test.AbstractClientTest;
-import org.eclipse.scout.rt.client.services.common.test.ClientTestUtility;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-
-public class UppercaseMnemonicUnitTest extends AbstractClientTest {
-
- @Override
- public void run() throws Exception {
- for (IMenu menu : ClientTestUtility.getDesktop().getMenus()) {
- checkMenus(menu);
- }
- }
-
- public void checkMenus(IMenu menu) throws ProcessingException {
- // test
- setSubTitle(menu.getText() + " [" + menu.getClass().getSimpleName() + "]");
- if (!menu.isSeparator() && menu.getMnemonic() == 0x0 && menu.isVisible() && Character.isUpperCase(menu.getMnemonic())) {
- addErrorStatus("mnemonic " + menu.getMnemonic());
- }
- else {
- addOkStatus("mnemonic " + menu.getMnemonic());
- }
- // children
- for (IMenu sub : menu.getChildActions()) {
- checkMenus(sub);
- }
- }
-
- @Override
- protected String getConfiguredTitle() {
- return "menubar: uppercase mnemonics";
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.test;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.services.common.test.AbstractClientTest;
+import org.eclipse.scout.rt.client.services.common.test.ClientTestUtility;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+
+public class UppercaseMnemonicUnitTest extends AbstractClientTest {
+
+ @Override
+ public void run() throws Exception {
+ for (IMenu menu : ClientTestUtility.getDesktop().getMenus()) {
+ checkMenus(menu);
+ }
+ }
+
+ public void checkMenus(IMenu menu) throws ProcessingException {
+ // test
+ setSubTitle(menu.getText() + " [" + menu.getClass().getSimpleName() + "]");
+ if (!menu.isSeparator() && menu.getMnemonic() == 0x0 && menu.isVisible() && Character.isUpperCase(menu.getMnemonic())) {
+ addErrorStatus("mnemonic " + menu.getMnemonic());
+ }
+ else {
+ addOkStatus("mnemonic " + menu.getMnemonic());
+ }
+ // children
+ for (IMenu sub : menu.getChildActions()) {
+ checkMenus(sub);
+ }
+ }
+
+ @Override
+ protected String getConfiguredTitle() {
+ return "menubar: uppercase mnemonics";
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/VisibleColumnLabelUnitTest.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/VisibleColumnLabelUnitTest.java
index 516dda5fac..067ccb3048 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/VisibleColumnLabelUnitTest.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/VisibleColumnLabelUnitTest.java
@@ -1,66 +1,66 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.test;
-
-import javax.swing.JLabel;
-
-import org.eclipse.scout.commons.runtime.BundleBrowser;
-import org.eclipse.scout.rt.client.services.common.test.AbstractClientTest;
-import org.eclipse.scout.rt.client.services.common.test.ClientTestUtility;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.tablefield.ITableField;
-import org.osgi.framework.Bundle;
-
-public class VisibleColumnLabelUnitTest extends AbstractClientTest {
-
- @Override
- public void run() throws Exception {
- Bundle clientBundle = ClientTestUtility.getClientBundle();
- BundleBrowser b = new BundleBrowser(clientBundle.getSymbolicName(), ClientTestUtility.getFormsPackage());
- for (String className : b.getClasses(false, false)) {
- Class<?> c = clientBundle.loadClass(className);
- try {
- IForm form = (IForm) c.newInstance();
- for (IFormField childField : form.getAllFields()) {
- if (childField instanceof ITableField) {
- // / auch andere Tabellen durchsuchen?
- // / Pixel von AutoResize
- ITableField<?> tableField = (ITableField<?>) childField;
- ITable table = tableField.getTable();
- for (IColumn<?> column : table.getColumns()) {
- // test
- setSubTitle(form.getTitle() + " > " + childField.getLabel() + " [" + form.getClass().getSimpleName() + "." + childField.getClass().getSimpleName() + "]");
- JLabel l = new JLabel();
- int pix = l.getFontMetrics(l.getFont()).stringWidth(column.getHeaderCell().getText());
- int w = column.getWidth() - l.getInsets().left - l.getInsets().right;
- if (column.isVisible() && pix > w) {
- addWarningStatus("width (" + w + ") < label (" + pix + ")");
- }
- else {
- addOkStatus("width (" + w + ") > label (" + pix + ")");
- }
- }
- }
- }
- }
- catch (Exception e) {
- }
- }
- }
-
- @Override
- protected String getConfiguredTitle() {
- return "dialog tables: columns wide enough for label";
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.test;
+
+import javax.swing.JLabel;
+
+import org.eclipse.scout.commons.runtime.BundleBrowser;
+import org.eclipse.scout.rt.client.services.common.test.AbstractClientTest;
+import org.eclipse.scout.rt.client.services.common.test.ClientTestUtility;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.tablefield.ITableField;
+import org.osgi.framework.Bundle;
+
+public class VisibleColumnLabelUnitTest extends AbstractClientTest {
+
+ @Override
+ public void run() throws Exception {
+ Bundle clientBundle = ClientTestUtility.getClientBundle();
+ BundleBrowser b = new BundleBrowser(clientBundle.getSymbolicName(), ClientTestUtility.getFormsPackage());
+ for (String className : b.getClasses(false, false)) {
+ Class<?> c = clientBundle.loadClass(className);
+ try {
+ IForm form = (IForm) c.newInstance();
+ for (IFormField childField : form.getAllFields()) {
+ if (childField instanceof ITableField) {
+ // / auch andere Tabellen durchsuchen?
+ // / Pixel von AutoResize
+ ITableField<?> tableField = (ITableField<?>) childField;
+ ITable table = tableField.getTable();
+ for (IColumn<?> column : table.getColumns()) {
+ // test
+ setSubTitle(form.getTitle() + " > " + childField.getLabel() + " [" + form.getClass().getSimpleName() + "." + childField.getClass().getSimpleName() + "]");
+ JLabel l = new JLabel();
+ int pix = l.getFontMetrics(l.getFont()).stringWidth(column.getHeaderCell().getText());
+ int w = column.getWidth() - l.getInsets().left - l.getInsets().right;
+ if (column.isVisible() && pix > w) {
+ addWarningStatus("width (" + w + ") < label (" + pix + ")");
+ }
+ else {
+ addOkStatus("width (" + w + ") > label (" + pix + ")");
+ }
+ }
+ }
+ }
+ }
+ catch (Exception e) {
+ }
+ }
+ }
+
+ @Override
+ protected String getConfiguredTitle() {
+ return "dialog tables: columns wide enough for label";
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/VisibleFieldLabelUnitTest.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/VisibleFieldLabelUnitTest.java
index 2767ce41e9..333c101a81 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/VisibleFieldLabelUnitTest.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/test/VisibleFieldLabelUnitTest.java
@@ -1,64 +1,64 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.test;
-
-import javax.swing.JLabel;
-
-import org.eclipse.scout.commons.runtime.BundleBrowser;
-import org.eclipse.scout.rt.client.services.common.test.AbstractClientTest;
-import org.eclipse.scout.rt.client.services.common.test.ClientTestUtility;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractButton;
-import org.eclipse.scout.rt.client.ui.form.fields.datefield.AbstractDateField;
-import org.eclipse.scout.rt.client.ui.form.fields.doublefield.AbstractDoubleField;
-import org.eclipse.scout.rt.client.ui.form.fields.smartfield.AbstractSmartField;
-import org.eclipse.scout.rt.client.ui.form.fields.stringfield.AbstractStringField;
-import org.osgi.framework.Bundle;
-
-public class VisibleFieldLabelUnitTest extends AbstractClientTest {
-
- @Override
- public void run() throws Exception {
- Bundle clientBundle = ClientTestUtility.getClientBundle();
- BundleBrowser b = new BundleBrowser(clientBundle.getSymbolicName(), ClientTestUtility.getFormsPackage());
- for (String className : b.getClasses(false, false)) {
- Class<?> c = clientBundle.loadClass(className);
- try {
- IForm form = (IForm) c.newInstance();
- for (IFormField childField : form.getAllFields()) {
- if (childField.getLabel() != null) {
- // test
- setSubTitle(form.getTitle() + " > " + childField.getLabel() + " [" + form.getClass().getSimpleName() + "." + childField.getClass().getSimpleName() + "]");
- JLabel l = new JLabel();
- int pix = l.getFontMetrics(l.getFont()).stringWidth(childField.getLabel());
- if (pix > 130 && (AbstractDateField.class.isAssignableFrom(childField.getClass()) || AbstractDoubleField.class.isAssignableFrom(childField.getClass()) || AbstractSmartField.class.isAssignableFrom(childField.getClass()) || AbstractStringField.class.isAssignableFrom(childField.getClass()))) {
- addWarningStatus(childField.getLabel() + " (" + pix + "px) > 130px");
- }
- else if (pix > (185 * childField.getGridData().w) && AbstractButton.class.isAssignableFrom(childField.getClass()) || AbstractButton.class.isAssignableFrom(childField.getClass())) {
- addWarningStatus(childField.getLabel() + " (" + pix + "px) > " + (185 * childField.getGridData().w) + "px");
- }
- else {
- addOkStatus();
- }
- }
- }
- }
- catch (Exception e) {
- }
- }
- }
-
- @Override
- protected String getConfiguredTitle() {
- return "dialog fields: field wide enough for label";
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.test;
+
+import javax.swing.JLabel;
+
+import org.eclipse.scout.commons.runtime.BundleBrowser;
+import org.eclipse.scout.rt.client.services.common.test.AbstractClientTest;
+import org.eclipse.scout.rt.client.services.common.test.ClientTestUtility;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractButton;
+import org.eclipse.scout.rt.client.ui.form.fields.datefield.AbstractDateField;
+import org.eclipse.scout.rt.client.ui.form.fields.doublefield.AbstractDoubleField;
+import org.eclipse.scout.rt.client.ui.form.fields.smartfield.AbstractSmartField;
+import org.eclipse.scout.rt.client.ui.form.fields.stringfield.AbstractStringField;
+import org.osgi.framework.Bundle;
+
+public class VisibleFieldLabelUnitTest extends AbstractClientTest {
+
+ @Override
+ public void run() throws Exception {
+ Bundle clientBundle = ClientTestUtility.getClientBundle();
+ BundleBrowser b = new BundleBrowser(clientBundle.getSymbolicName(), ClientTestUtility.getFormsPackage());
+ for (String className : b.getClasses(false, false)) {
+ Class<?> c = clientBundle.loadClass(className);
+ try {
+ IForm form = (IForm) c.newInstance();
+ for (IFormField childField : form.getAllFields()) {
+ if (childField.getLabel() != null) {
+ // test
+ setSubTitle(form.getTitle() + " > " + childField.getLabel() + " [" + form.getClass().getSimpleName() + "." + childField.getClass().getSimpleName() + "]");
+ JLabel l = new JLabel();
+ int pix = l.getFontMetrics(l.getFont()).stringWidth(childField.getLabel());
+ if (pix > 130 && (AbstractDateField.class.isAssignableFrom(childField.getClass()) || AbstractDoubleField.class.isAssignableFrom(childField.getClass()) || AbstractSmartField.class.isAssignableFrom(childField.getClass()) || AbstractStringField.class.isAssignableFrom(childField.getClass()))) {
+ addWarningStatus(childField.getLabel() + " (" + pix + "px) > 130px");
+ }
+ else if (pix > (185 * childField.getGridData().w) && AbstractButton.class.isAssignableFrom(childField.getClass()) || AbstractButton.class.isAssignableFrom(childField.getClass())) {
+ addWarningStatus(childField.getLabel() + " (" + pix + "px) > " + (185 * childField.getGridData().w) + "px");
+ }
+ else {
+ addOkStatus();
+ }
+ }
+ }
+ }
+ catch (Exception e) {
+ }
+ }
+ }
+
+ @Override
+ protected String getConfiguredTitle() {
+ return "dialog fields: field wide enough for label";
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/AbstractEventHistory.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/AbstractEventHistory.java
index 2f433d2528..0b085ab8de 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/AbstractEventHistory.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/AbstractEventHistory.java
@@ -1,50 +1,50 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui;
-
-import java.util.Collection;
-
-import org.eclipse.scout.commons.TTLCache;
-
-/**
- * The events are kept in history for at most n milliseconds
- * using a {@link TTLCache}
- * <p>
- * This object is thread safe.
- *
- * @since 3.8
- */
-public abstract class AbstractEventHistory<T> implements IEventHistory<T> {
- private final TTLCache<Object, T> m_cache;
-
- public AbstractEventHistory(long timeToLiveMillis) {
- m_cache = new TTLCache<Object, T>(timeToLiveMillis);
- }
-
- /**
- * override and call {@link #addToCache(Object)} for relevant events
- */
- @Override
- public abstract void notifyEvent(T event);
-
- /**
- * Add event to cache map using the key. The key is used to manage single or multi-event of same type
- */
- protected void addToCache(Object uniquenessKey, T event) {
- m_cache.put(uniquenessKey, event);
- }
-
- @Override
- public Collection<T> getRecentEvents() {
- return m_cache.values();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui;
+
+import java.util.Collection;
+
+import org.eclipse.scout.commons.TTLCache;
+
+/**
+ * The events are kept in history for at most n milliseconds
+ * using a {@link TTLCache}
+ * <p>
+ * This object is thread safe.
+ *
+ * @since 3.8
+ */
+public abstract class AbstractEventHistory<T> implements IEventHistory<T> {
+ private final TTLCache<Object, T> m_cache;
+
+ public AbstractEventHistory(long timeToLiveMillis) {
+ m_cache = new TTLCache<Object, T>(timeToLiveMillis);
+ }
+
+ /**
+ * override and call {@link #addToCache(Object)} for relevant events
+ */
+ @Override
+ public abstract void notifyEvent(T event);
+
+ /**
+ * Add event to cache map using the key. The key is used to manage single or multi-event of same type
+ */
+ protected void addToCache(Object uniquenessKey, T event) {
+ m_cache.put(uniquenessKey, event);
+ }
+
+ @Override
+ public Collection<T> getRecentEvents() {
+ return m_cache.values();
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/BundleIconLocator.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/BundleIconLocator.java
index 0fba82796f..cd3cb97635 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/BundleIconLocator.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/BundleIconLocator.java
@@ -1,50 +1,50 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui;
-
-import org.eclipse.scout.rt.client.services.common.icon.IconProviderService;
-import org.eclipse.scout.rt.client.services.common.icon.IconSpec;
-import org.eclipse.scout.rt.shared.AbstractIcons;
-import org.osgi.framework.Bundle;
-
-/**
- *
- */
-public class BundleIconLocator implements IIconLocator {
-
- private final IconProviderService m_iconLocatorService;
-
- public BundleIconLocator(Bundle bundle) {
- m_iconLocatorService = new P_BundleIconProviderService(bundle);
- }
-
- @Override
- public IconSpec getIconSpec(String name) {
- if (name == null || AbstractIcons.Null.equals(name)) {
- return null;
- }
- IconSpec spec = m_iconLocatorService.getIconSpec(name);
- return spec;
- }
-
- public IconProviderService getIconLocatorService() {
- return m_iconLocatorService;
- }
-
- private class P_BundleIconProviderService extends IconProviderService {
-
- public P_BundleIconProviderService(Bundle bundle) {
- setHostBundle(bundle);
- }
-
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui;
+
+import org.eclipse.scout.rt.client.services.common.icon.IconProviderService;
+import org.eclipse.scout.rt.client.services.common.icon.IconSpec;
+import org.eclipse.scout.rt.shared.AbstractIcons;
+import org.osgi.framework.Bundle;
+
+/**
+ *
+ */
+public class BundleIconLocator implements IIconLocator {
+
+ private final IconProviderService m_iconLocatorService;
+
+ public BundleIconLocator(Bundle bundle) {
+ m_iconLocatorService = new P_BundleIconProviderService(bundle);
+ }
+
+ @Override
+ public IconSpec getIconSpec(String name) {
+ if (name == null || AbstractIcons.Null.equals(name)) {
+ return null;
+ }
+ IconSpec spec = m_iconLocatorService.getIconSpec(name);
+ return spec;
+ }
+
+ public IconProviderService getIconLocatorService() {
+ return m_iconLocatorService;
+ }
+
+ private class P_BundleIconProviderService extends IconProviderService {
+
+ public P_BundleIconProviderService(Bundle bundle) {
+ setHostBundle(bundle);
+ }
+
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/ClientUIPreferences.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/ClientUIPreferences.java
index 4b594dbcde..ff105e3d7b 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/ClientUIPreferences.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/ClientUIPreferences.java
@@ -1,878 +1,878 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui;
-
-import java.awt.Rectangle;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.util.List;
-import java.util.Locale;
-import java.util.StringTokenizer;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.scout.commons.LocaleThreadLocal;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.TypeCastUtility;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.commons.osgi.BundleObjectInputStream;
-import org.eclipse.scout.commons.osgi.BundleObjectOutputStream;
-import org.eclipse.scout.rt.client.ClientAsyncJob;
-import org.eclipse.scout.rt.client.ClientJob;
-import org.eclipse.scout.rt.client.ClientSessionThreadLocal;
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.client.ui.form.fields.splitbox.ISplitBox;
-import org.eclipse.scout.rt.shared.data.basic.BoundsSpec;
-import org.eclipse.scout.rt.shared.services.common.prefs.IUserPreferencesStorageService;
-import org.eclipse.scout.rt.shared.ui.IUiDeviceType;
-import org.eclipse.scout.rt.shared.ui.IUiLayer;
-import org.eclipse.scout.rt.shared.ui.UiDeviceType;
-import org.eclipse.scout.rt.shared.ui.UiLayer;
-import org.eclipse.scout.rt.shared.ui.UserAgent;
-import org.eclipse.scout.rt.shared.ui.UserAgentUtility;
-import org.eclipse.scout.service.SERVICES;
-import org.osgi.framework.Bundle;
-import org.osgi.service.prefs.Preferences;
-
-/**
- * UI model customization wrapping a {@link org.eclipse.core.runtime.Preferences} object with its location Stored
- * in user area.
- * <p>
- * Warning: Only use this class within a ClientJob with an {@link IClientSession}.
- * <p>
- * Calling from outside a {@link IClientSession} {@link ClientJob} will produce a warning. In release 3.9 (TODO) will
- * produce an error.
- */
-public class ClientUIPreferences {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(ClientUIPreferences.class);
-
- /**
- * @return a new instance of the {@link ClientUIPreferences} based on the {@link IUserPreferencesStorageService}
- * <p>
- * Warning: Only use this class within a ClientJob with an {@link IClientSession}.
- * <p>
- * Calling from outside a {@link IClientSession} {@link ClientJob} will produce a warning. Starting with
- * release 3.9 it will fail with an error.
- */
- public static ClientUIPreferences getInstance() {
- return new ClientUIPreferences(ClientSessionThreadLocal.get());
- }
-
- /**
- * @return a new instance of the {@link ClientUIPreferences} based on the {@link IUserPreferencesStorageService}
- */
- public static ClientUIPreferences getInstance(IClientSession session) {
- return new ClientUIPreferences(session);
- }
-
- private static final String TABLE_CUSTOMIZER_DATA = "table.customizer.data.";
- private static final String TABLE_COLUMN_UIINDEX = "table.column.viewIndex.";
- private static final String TABLE_COLUMN_WIDTH = "table.column.width.";
- private static final String TABLE_COLUMN_VISIBLE = "table.column.visible.";
- private static final String TABLE_COLUMN_SORT_INDEX = "table.column.sortIndex.";
- private static final String TABLE_COLUMN_SORT_ASC = "table.column.sortAsc.";
- private static final String TABLE_COLUMN_SORT_EXPLICIT = "table.column.sortExplicit.";
- private static final String APPLICATION_WINDOW_MAXIMIZED = "application.window.maximized";
- private static final String APPLICATION_WINDOW_BOUNDS = "application.window.bounds";
- private static final String CALENDAR_DISPLAY_MODE = "calendar.display.mode";
- private static final String CALENDAR_DISPLAY_CONDENSED = "calendar.display.condensed";
- private static final String DESKTOP_COLUMN_SPLITS = "desktop.columnSplits";
- private static final String FORM_BOUNDS = "form.bounds.";
-
- /**
- * @deprecated to be removed in release 3.9.0
- */
- @Deprecated
- private static final String NLS_LOCALE_ISO = "nls_locale_iso";
- /**
- * @deprecated to be removed in release 3.9.0
- */
- @Deprecated
- private static final String NLS_LOCALE_LANGUAGE = "locale.language";
- /**
- * @deprecated to be removed in release 3.9.0
- */
- @Deprecated
- private static final String NLS_LOCALE_COUNTRY = "locale.country";
-
- private final IClientSession m_session;
- private Preferences m_env;
-
- /**
- * @deprecated use {@link #getInstance()}
- */
- @Deprecated
- public ClientUIPreferences() {
- this(ClientSessionThreadLocal.get());
- }
-
- private ClientUIPreferences(IClientSession session) {
- m_session = session;
- if (m_session == null) {
- LOG.error("No scout client session context", new Exception("Calling client preferences from outside a scout client session job"));
- }
- load();
- }
-
- /**
- * Since this property depends on the user agent it is saved separately for each combination of {@link IUiLayer} and
- * {@link IUiDeviceType}.
- */
- public Rectangle getFormBounds(IForm form) {
- String key = form.computeCacheBoundsKey();
- if (key == null) {
- return null;
- }
-
- key = getUserAgentPrefix() + FORM_BOUNDS + key;
- String value = m_env.get(key, "");
- if (StringUtility.isNullOrEmpty(value)) {
- key = getLegacyFormBoundsKey(form);
- value = m_env.get(key, "");
- }
-
- if (!StringUtility.isNullOrEmpty(value)) {
- try {
- StringTokenizer tok = new StringTokenizer(value, ",");
- Rectangle r = new Rectangle(
- new Integer(tok.nextToken()).intValue(),
- new Integer(tok.nextToken()).intValue(),
- new Integer(tok.nextToken()).intValue(),
- new Integer(tok.nextToken()).intValue()
- );
- return r;
- }
- catch (Exception e) {
- LOG.warn("value=" + value, e);
- }
- }
- return null;
- }
-
- /**
- * Since this property depends on the user agent it is saved separately for each combination of {@link IUiLayer} and
- * {@link IUiDeviceType}.
- */
- public void setFormBounds(IForm form, Rectangle bounds) {
- String key = form.computeCacheBoundsKey();
- if (key == null) {
- return;
- }
-
- key = getUserAgentPrefix() + FORM_BOUNDS + key;
- if (bounds == null) {
- m_env.remove(key);
- }
- else {
- m_env.put(key, bounds.x + "," + bounds.y + "," + bounds.width + "," + bounds.height);
- }
- flush();
- }
-
- private String getLegacyFormBoundsKey(IForm form) {
- String key = form.computeCacheBoundsKey();
- if (key == null) {
- return null;
- }
-
- //Add prefix only if not already added.
- //This is mainly necessary due to backward compatibility because until 3.8.0 the prefix had to be returned by computeCacheBoundsKey
- if (!key.startsWith("form.bounds")) {
- key = "form.bounds_" + key;
- }
-
- //Explicitly don't consider user agent because before 3.8.0 there was no user agent and therefore the keys didn't contain this information.
-
- return key;
- }
-
- private String getUserAgentPrefix() {
- UserAgent currentUserAgent = null;
- if (m_session != null) {
- currentUserAgent = m_session.getUserAgent();
- }
- else {
- currentUserAgent = UserAgentUtility.getCurrentUserAgent();
- }
- if (currentUserAgent == null) {
- return "";
- }
-
- String uiLayer = null;
- if (!UiLayer.UNKNOWN.equals(currentUserAgent.getUiLayer())) {
- uiLayer = currentUserAgent.getUiLayer().getIdentifier();
- }
- String uiDeviceType = null;
- if (!UiDeviceType.UNKNOWN.equals(currentUserAgent.getUiDeviceType())) {
- uiDeviceType = currentUserAgent.getUiDeviceType().getIdentifier();
- }
-
- return StringUtility.concatenateTokens(uiLayer, ".", uiDeviceType, ".");
- }
-
- /**
- * Since this property depends on the user agent it is saved separately for each combination of {@link IUiLayer} and
- * {@link IUiDeviceType}.
- *
- * @since 3.8.0
- */
- public int[] getSplitterPosition(ISplitBox splitBox) {
- String baseKey = splitBox.getCacheSplitterPositionPropertyName();
- if (baseKey == null) {
- return null;
- }
-
- String key = getUserAgentPrefix() + baseKey;
- int[] value = getPropertyIntArray(key);
- if (value == null) {
- //If no value has been found try to load with the base key. Done due to backward compatibility.
- value = getPropertyIntArray(baseKey);
- }
-
- return value;
- }
-
- /**
- * Since this property depends on the user agent it is saved separately for each combination of {@link IUiLayer} and
- * {@link IUiDeviceType}.
- *
- * @since 3.8.0
- */
- public void setSplitterPosition(ISplitBox splitBox, int[] weights) {
- String key = splitBox.getCacheSplitterPositionPropertyName();
- if (key == null) {
- return;
- }
-
- key = getUserAgentPrefix() + key;
- setPropertyIntArray(key, weights);
- }
-
- public String getTableKey(ITable t) {
- String key = t.getClass().getName();
- String context = t.getUserPreferenceContext();
- if (context != null) {
- key += "#" + context;
- }
- return key;
- }
-
- public Object getTableCustomizerData(String customizerKey, Bundle loaderBundle) {
- String key = TABLE_CUSTOMIZER_DATA + customizerKey;
- byte[] serialData = m_env.getByteArray(key, null);
- if (serialData != null) {
- ObjectInputStream in = null;
- try {
- in = new BundleObjectInputStream(new ByteArrayInputStream(serialData), new Bundle[]{loaderBundle});
- Object customizerData = in.readObject();
- in.close();
- in = null;
- return customizerData;
- }
- catch (Throwable t) {
- LOG.error("Failed reading custom table data for " + key + ": " + t);
- m_env.remove(key);
- return null;
- }
- finally {
- if (in != null) {
- try {
- in.close();
- }
- catch (Throwable t) {
- }
- }
- }
- }
- else {
- return null;
- }
- }
-
- /**
- * store customizer data to persistent store
- */
- public void setTableCustomizerData(String customizerKey, Object customizerData) {
- String key = TABLE_CUSTOMIZER_DATA + customizerKey;
- if (customizerData != null) {
- ObjectOutputStream out = null;
- try {
- ByteArrayOutputStream serialData = new ByteArrayOutputStream();
- out = new BundleObjectOutputStream(serialData);
- out.writeObject(customizerData);
- out.close();
- out = null;
- m_env.putByteArray(key, serialData.toByteArray());
- }
- catch (Throwable t) {
- LOG.error("Failed storing custom table data for " + key, t);
- m_env.remove(key);
- }
- finally {
- if (out != null) {
- try {
- out.close();
- }
- catch (Throwable t) {
- }
- }
- }
- }
- else {
- m_env.remove(key);
- }
- //
- flush();
- }
-
- /**
- * @return the key prefix used to store column data
- */
- public String getColumnKey(IColumn c) {
- String key = c.getColumnId();
- if (c.getTable() != null) {
- key = getTableKey(c.getTable()) + "#" + key;
- }
- return key;
- }
-
- public void setTableColumnPreferences(IColumn col) {
- setTableColumnPreferences(col, true);
- }
-
- public void setTableColumnPreferences(IColumn col, boolean flush) {
- String keySuffix = getColumnKey(col);
- String key = TABLE_COLUMN_UIINDEX + keySuffix;
- int viewIndex = col.getVisibleColumnIndexHint();
- boolean visible = col.isVisibleInternal();
- int width = col.getWidth();
- int sortIndex = col.getSortIndex();
- boolean sortUp = col.isSortAscending();
- boolean sortExplicit = col.isSortExplicit();
- //
- if (viewIndex >= 0) {
- m_env.put(key, "" + viewIndex);
- }
- else {
- m_env.remove(key);
- }
- //
- key = TABLE_COLUMN_VISIBLE + keySuffix;
- if (!visible) {
- m_env.put(key, "no");
- }
- else {
- m_env.put(key, "yes");
- }
- //
- key = getUserAgentPrefix() + TABLE_COLUMN_WIDTH + keySuffix;
- if (width >= 0) {
- m_env.put(key, "" + width);
- }
- else {
- m_env.remove(key);
- }
- //
- key = TABLE_COLUMN_SORT_INDEX + keySuffix;
- if (sortIndex >= 0) {
- m_env.put(key, "" + sortIndex);
- }
- else {
- m_env.put(key, "-1");
- }
- //
- key = TABLE_COLUMN_SORT_ASC + keySuffix;
- if (sortIndex >= 0 && sortUp) {
- m_env.put(key, "true");
- }
- else {
- m_env.put(key, "false");
- }
- //
- key = TABLE_COLUMN_SORT_EXPLICIT + keySuffix;
- if (sortExplicit) {
- m_env.put(key, "true");
- }
- else {
- m_env.put(key, "false");
- }
-
- if (flush) {
- flush();
- }
- }
-
- public void updateTableColumnOrder(List<IColumn<?>> columnList, int[] visibleColumnIndexHints) {
- if (columnList.size() != visibleColumnIndexHints.length) {
- throw new IllegalArgumentException("columnList.size=" + columnList.size() + " hints.length=" + visibleColumnIndexHints.length);
- }
- for (int i = 0; i < visibleColumnIndexHints.length; i++) {
- IColumn<?> c = columnList.get(i);
- int viewIndex = visibleColumnIndexHints[i];
- String keySuffix = getColumnKey(c);
- String key = TABLE_COLUMN_UIINDEX + keySuffix;
- if (viewIndex >= 0) {
- m_env.put(key, "" + viewIndex);
- }
- else {
- m_env.remove(key);
- }
- }
- //
- flush();
- }
-
- public void removeTableColumnPreferences(IColumn col) {
- removeTableColumnPreferences(col, true, true, true, true);
- }
-
- public void removeTableColumnPreferences(IColumn col, boolean visibility, boolean order, boolean sorting, boolean widths) {
- removeTableColumnPreferences(col, visibility, order, sorting, widths, true);
- }
-
- private void removeTableColumnPreferences(IColumn col, boolean visibility, boolean order, boolean sorting, boolean widths, boolean flush) {
- if (col != null) {
- String keySuffix = getColumnKey(col);
- if (visibility) {
- m_env.remove(TABLE_COLUMN_VISIBLE + keySuffix);
- }
- if (order) {
- m_env.remove(TABLE_COLUMN_UIINDEX + keySuffix);
- }
- if (sorting) {
- m_env.remove(TABLE_COLUMN_SORT_INDEX + keySuffix);
- m_env.remove(TABLE_COLUMN_SORT_ASC + keySuffix);
- m_env.remove(TABLE_COLUMN_SORT_EXPLICIT + keySuffix);
- }
- if (widths) {
- m_env.remove(getUserAgentPrefix() + TABLE_COLUMN_WIDTH + keySuffix);
- }
-
- if (flush) {
- flush();
- }
- }
- }
-
- public void removeAllTableColumnPreferences(ITable table, boolean visibility, boolean order, boolean sorting, boolean widths) {
- if (table == null) {
- return;
- }
-
- for (IColumn<?> col : table.getColumns()) {
- removeTableColumnPreferences(col, visibility, order, sorting, widths, false);
- }
-
- flush();
- }
-
- public void setAllTableColumnPreferences(ITable table) {
- if (table == null) {
- return;
- }
-
- for (IColumn col : table.getColumns()) {
- if (col.isDisplayable()) {
- setTableColumnPreferences(col, false);
- }
- }
-
- flush();
- }
-
- /**
- * @return true if there are any user preferences for this tables columns
- */
- public boolean hasTableColumnPreferences(ITable table) {
- if (table != null) {
- for (IColumn col : table.getColumns()) {
- String keySuffix = getColumnKey(col);
- if (m_env.get(TABLE_COLUMN_VISIBLE + keySuffix, null) != null) {
- return true;
- }
- if (m_env.get(TABLE_COLUMN_UIINDEX + keySuffix, null) != null) {
- return true;
- }
- if (m_env.get(TABLE_COLUMN_SORT_INDEX + keySuffix, null) != null) {
- return true;
- }
- if (m_env.get(TABLE_COLUMN_SORT_ASC + keySuffix, null) != null) {
- return true;
- }
- if (m_env.get(TABLE_COLUMN_SORT_EXPLICIT + keySuffix, null) != null) {
- return true;
- }
- if (m_env.get(TABLE_COLUMN_WIDTH + keySuffix, null) != null) {
- return true;
- }
- }
- }
- return false;
- }
-
- /**
- * Since this property depends on the user agent it is saved separately for each combination of {@link IUiLayer} and
- * {@link IUiDeviceType}.
- */
- public int getTableColumnWidth(IColumn col, int defaultWidth) {
- String keySuffix = getColumnKey(col);
- String baseKey = TABLE_COLUMN_WIDTH + keySuffix;
- String key = getUserAgentPrefix() + baseKey;
-
- String value = m_env.get(key, null);
- if (value == null) {
- //If no value has been found try to load with the base key. Done due to backward compatibility.
- value = m_env.get(baseKey, null);
- }
- if (value != null) {
- try {
- return Integer.parseInt(value);
- }
- catch (Exception e) {
- LOG.warn("value=" + value, e);
- }
- }
- return defaultWidth;
- }
-
- public boolean getTableColumnVisible(IColumn col, boolean defaultValue) {
- String keySuffix = getColumnKey(col);
- String key = TABLE_COLUMN_VISIBLE + keySuffix;
- String value = m_env.get(key, null);
- if (value != null) {
- Boolean b = TypeCastUtility.castValue(value, Boolean.class);
- return b != null ? b.booleanValue() : defaultValue;
- }
- return defaultValue;
- }
-
- public int getTableColumnViewIndex(IColumn col, int defaultIndex) {
- String keySuffix = getColumnKey(col);
- String key = TABLE_COLUMN_UIINDEX + keySuffix;
- String value = m_env.get(key, null);
- if (value != null) {
- try {
- return Integer.parseInt(value);
- }
- catch (Exception e) {
- LOG.warn("value=" + value, e);
- }
- }
- return defaultIndex;
- }
-
- public int getTableColumnSortIndex(IColumn col, int defaultValue) {
- String keySuffix = getColumnKey(col);
- String key = TABLE_COLUMN_SORT_INDEX + keySuffix;
- String value = m_env.get(key, null);
- if (value != null) {
- Integer i = TypeCastUtility.castValue(value, Integer.class);
- return i.intValue();
- }
- return defaultValue;
- }
-
- public boolean getTableColumnSortAscending(IColumn col, boolean defaultValue) {
- String keySuffix = getColumnKey(col);
- String key = TABLE_COLUMN_SORT_ASC + keySuffix;
- String value = m_env.get(key, null);
- if (value != null) {
- Boolean b = TypeCastUtility.castValue(value, Boolean.class);
- return b != null ? b.booleanValue() : defaultValue;
- }
- return defaultValue;
- }
-
- public Boolean getTableColumnSortExplicit(IColumn col) {
- String keySuffix = getColumnKey(col);
- String key = TABLE_COLUMN_SORT_EXPLICIT + keySuffix;
- String value = m_env.get(key, null);
- if (value != null) {
- return TypeCastUtility.castValue(value, Boolean.class);
- }
- return null;
- }
-
- public void setApplicationWindowPreferences(BoundsSpec r, boolean maximized) {
- if (r != null) {
- String value = "" + r.x + "," + r.y + "," + r.width + "," + r.height;
- m_env.put(APPLICATION_WINDOW_BOUNDS, value);
- }
- else {
- m_env.remove(APPLICATION_WINDOW_BOUNDS);
- }
- //
- if (maximized) {
- m_env.put(APPLICATION_WINDOW_MAXIMIZED, "yes");
- }
- else {
- m_env.remove(APPLICATION_WINDOW_MAXIMIZED);
- }
- flush();
- }
-
- public boolean getApplicationWindowMaximized() {
- String key = APPLICATION_WINDOW_MAXIMIZED;
- String value = m_env.get(key, null);
- if (value != null) {
- return value.equalsIgnoreCase("yes");
- }
- return false;
- }
-
- public BoundsSpec getApplicationWindowBounds() {
- String key = APPLICATION_WINDOW_BOUNDS;
- String value = m_env.get(key, null);
- if (value != null) {
- try {
- StringTokenizer tok = new StringTokenizer(value, ",");
- BoundsSpec r = new BoundsSpec(
- new Integer(tok.nextToken()).intValue(),
- new Integer(tok.nextToken()).intValue(),
- new Integer(tok.nextToken()).intValue(),
- new Integer(tok.nextToken()).intValue()
- );
- return r;
- }
- catch (Exception e) {
- LOG.warn("value=" + value, e);
- }
- }
- return null;
- }
-
- public void setCalendarPreferences(int displayMode, boolean displayCondensed) {
- m_env.put(CALENDAR_DISPLAY_MODE, "" + displayMode);
- m_env.put(CALENDAR_DISPLAY_CONDENSED, "" + displayCondensed);
- flush();
- }
-
- public int getCalendarDisplayMode(int defaultValue) {
- String key = CALENDAR_DISPLAY_MODE;
- String value = m_env.get(key, null);
- if (value != null) {
- try {
- return Integer.parseInt(value);
- }
- catch (Exception e) {
- LOG.warn("value=" + value, e);
- }
- }
- return defaultValue;
- }
-
- public boolean getCalendarDisplayCondensed(boolean defaultValue) {
- String key = CALENDAR_DISPLAY_CONDENSED;
- String value = m_env.get(key, null);
- if (value != null) {
- try {
- return TypeCastUtility.castValue(value, Boolean.class);
- }
- catch (Exception e) {
- LOG.warn("value=" + value, e);
- }
- }
- return defaultValue;
- }
-
- public int getPropertyInteger(String propName, int defaultValue, boolean setDefaultAsProperty) {
- String value = m_env.get(propName, null);
- if (value != null) {
- try {
- return TypeCastUtility.castValue(value, Integer.class);
- }
- catch (Exception e) {
- LOG.warn("value=" + value, e);
- if (setDefaultAsProperty) {
- setPropertyInteger(propName, defaultValue);
- }
- }
- }
- else {
- if (setDefaultAsProperty) {
- setPropertyInteger(propName, defaultValue);
- }
- }
- return defaultValue;
- }
-
- public void setPropertyInteger(String propName, int value) {
- m_env.put(propName, "" + value);
- flush();
- }
-
- public int[] getPropertyIntArray(String propName) {
- String strVal = m_env.get(propName, null);
- if (!StringUtility.hasText(strVal)) {
- return null;
- }
-
- String[] split = strVal.split(";");
- int[] val = new int[split.length];
- for (int i = 0; i < split.length; i++) {
- val[i] = Integer.parseInt(split[i]);
- }
- return val;
- }
-
- public void setPropertyIntArray(String propName, int[] value) {
- StringBuilder builder = new StringBuilder();
- if (value != null) {
- for (int i = 0; i < value.length; i++) {
- builder.append(value[i]);
- if (i != value.length - 1) {
- builder.append(";");
- }
- }
- }
- m_env.put(propName, builder.toString());
- flush();
- }
-
- public Double getPropertyDouble(String propName) {
- String value = m_env.get(propName, null);
- if (value != null) {
- try {
- return TypeCastUtility.castValue(value, Double.class);
- }
- catch (Exception e) {
- LOG.warn("value=" + value, e);
- }
- }
- return null;
- }
-
- public void setPropertyDouble(String propName, Double value) {
- m_env.put(propName, "" + value);
- flush();
- }
-
- public int[][] getDesktopColumnSplits(int rowCount, int colCount) {
- //the row x col matrix is stored as flat int array, row per row, column per column
- int[] a = getPropertyIntArray(DESKTOP_COLUMN_SPLITS);
- if (a != null && a.length == rowCount * colCount) {
- int[][] splits = new int[rowCount][colCount];
- int index = 0;
- for (int r = 0; r < rowCount; r++) {
- for (int c = 0; c < colCount; c++) {
- splits[r][c] = a[index];
- index++;
- }
- }
- return splits;
- }
- return null;
- }
-
- /**
- * @deprecated use {@link LocaleThreadLocal#get()} or {@link Locale#getDefault()}
- */
- @Deprecated
- public Locale getLocale() {
- // >> legacy support. To be removed in release 3.9.0.
- String strLegacy = m_env.get(NLS_LOCALE_ISO, null);
- if (strLegacy != null) {
- m_env.remove(NLS_LOCALE_ISO); // remove legacy entry
- m_env.put(NLS_LOCALE_LANGUAGE, strLegacy);
- flush();
- }
- // << legacy support. To be removed in release 3.9.0.
-
- String strLanguage = m_env.get(NLS_LOCALE_LANGUAGE, null);
- String strCountry = m_env.get(NLS_LOCALE_COUNTRY, null);
- if (strLanguage != null && strCountry != null) {
- return new Locale(strLanguage, strCountry);
- }
- else if (strLanguage != null) {
- return new Locale(strLanguage, ClientUIPreferences.getHostLocale().getCountry());
- }
- return null;
- }
-
- /**
- * @deprecated use {@link LocaleThreadLocal#set(Locale)} or {@link Locale#setDefault(Locale)}
- */
- @Deprecated
- public void setLocale(Locale locale) {
- if (locale != null) {
- m_env.put(NLS_LOCALE_LANGUAGE, locale.getLanguage());
- m_env.put(NLS_LOCALE_COUNTRY, locale.getCountry());
- }
- else {
- m_env.remove(NLS_LOCALE_LANGUAGE);
- m_env.remove(NLS_LOCALE_COUNTRY);
- }
- flush();
- }
-
- /**
- * @deprecated to be removed in release 3.9.0
- */
- @Deprecated
- public static Locale getHostLocale() {
- return Locale.getDefault();
- }
-
- public void setDesktopColumnSplits(int[][] splits) {
- //the row x col matrix is stored as flat int array, row per row, column per column
- if (splits != null) {
- int rowCount = splits.length;
- int colCount = splits[0].length;
- int[] a = new int[rowCount * colCount];
- int index = 0;
- for (int r = 0; r < rowCount; r++) {
- for (int c = 0; c < colCount; c++) {
- a[index] = splits[r][c];
- index++;
- }
- }
- setPropertyIntArray(DESKTOP_COLUMN_SPLITS, a);
- }
- }
-
- protected void load() {
- if (m_session == null || ClientSessionThreadLocal.get() == m_session) {
- m_env = SERVICES.getService(IUserPreferencesStorageService.class).loadPreferences();
- }
- else {
- ClientAsyncJob job = new ClientAsyncJob("Load user preferences", m_session) {
- @Override
- protected void runVoid(IProgressMonitor monitor) throws Throwable {
- m_env = SERVICES.getService(IUserPreferencesStorageService.class).loadPreferences();
- }
- };
- job.schedule();
- try {
- job.join();
- }
- catch (InterruptedException e) {
- //nop
- }
- }
- if (m_env == null) {
- throw new IllegalStateException("Could not load preferences in client job");
- }
- }
-
- protected void flush() {
- try {
- m_env.flush();
- }
- catch (Throwable t) {
- t.printStackTrace();
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui;
+
+import java.awt.Rectangle;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.List;
+import java.util.Locale;
+import java.util.StringTokenizer;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.scout.commons.LocaleThreadLocal;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.TypeCastUtility;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.commons.osgi.BundleObjectInputStream;
+import org.eclipse.scout.commons.osgi.BundleObjectOutputStream;
+import org.eclipse.scout.rt.client.ClientAsyncJob;
+import org.eclipse.scout.rt.client.ClientJob;
+import org.eclipse.scout.rt.client.ClientSessionThreadLocal;
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.client.ui.form.fields.splitbox.ISplitBox;
+import org.eclipse.scout.rt.shared.data.basic.BoundsSpec;
+import org.eclipse.scout.rt.shared.services.common.prefs.IUserPreferencesStorageService;
+import org.eclipse.scout.rt.shared.ui.IUiDeviceType;
+import org.eclipse.scout.rt.shared.ui.IUiLayer;
+import org.eclipse.scout.rt.shared.ui.UiDeviceType;
+import org.eclipse.scout.rt.shared.ui.UiLayer;
+import org.eclipse.scout.rt.shared.ui.UserAgent;
+import org.eclipse.scout.rt.shared.ui.UserAgentUtility;
+import org.eclipse.scout.service.SERVICES;
+import org.osgi.framework.Bundle;
+import org.osgi.service.prefs.Preferences;
+
+/**
+ * UI model customization wrapping a {@link org.eclipse.core.runtime.Preferences} object with its location Stored
+ * in user area.
+ * <p>
+ * Warning: Only use this class within a ClientJob with an {@link IClientSession}.
+ * <p>
+ * Calling from outside a {@link IClientSession} {@link ClientJob} will produce a warning. In release 3.9 (TODO) will
+ * produce an error.
+ */
+public class ClientUIPreferences {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(ClientUIPreferences.class);
+
+ /**
+ * @return a new instance of the {@link ClientUIPreferences} based on the {@link IUserPreferencesStorageService}
+ * <p>
+ * Warning: Only use this class within a ClientJob with an {@link IClientSession}.
+ * <p>
+ * Calling from outside a {@link IClientSession} {@link ClientJob} will produce a warning. Starting with
+ * release 3.9 it will fail with an error.
+ */
+ public static ClientUIPreferences getInstance() {
+ return new ClientUIPreferences(ClientSessionThreadLocal.get());
+ }
+
+ /**
+ * @return a new instance of the {@link ClientUIPreferences} based on the {@link IUserPreferencesStorageService}
+ */
+ public static ClientUIPreferences getInstance(IClientSession session) {
+ return new ClientUIPreferences(session);
+ }
+
+ private static final String TABLE_CUSTOMIZER_DATA = "table.customizer.data.";
+ private static final String TABLE_COLUMN_UIINDEX = "table.column.viewIndex.";
+ private static final String TABLE_COLUMN_WIDTH = "table.column.width.";
+ private static final String TABLE_COLUMN_VISIBLE = "table.column.visible.";
+ private static final String TABLE_COLUMN_SORT_INDEX = "table.column.sortIndex.";
+ private static final String TABLE_COLUMN_SORT_ASC = "table.column.sortAsc.";
+ private static final String TABLE_COLUMN_SORT_EXPLICIT = "table.column.sortExplicit.";
+ private static final String APPLICATION_WINDOW_MAXIMIZED = "application.window.maximized";
+ private static final String APPLICATION_WINDOW_BOUNDS = "application.window.bounds";
+ private static final String CALENDAR_DISPLAY_MODE = "calendar.display.mode";
+ private static final String CALENDAR_DISPLAY_CONDENSED = "calendar.display.condensed";
+ private static final String DESKTOP_COLUMN_SPLITS = "desktop.columnSplits";
+ private static final String FORM_BOUNDS = "form.bounds.";
+
+ /**
+ * @deprecated to be removed in release 3.9.0
+ */
+ @Deprecated
+ private static final String NLS_LOCALE_ISO = "nls_locale_iso";
+ /**
+ * @deprecated to be removed in release 3.9.0
+ */
+ @Deprecated
+ private static final String NLS_LOCALE_LANGUAGE = "locale.language";
+ /**
+ * @deprecated to be removed in release 3.9.0
+ */
+ @Deprecated
+ private static final String NLS_LOCALE_COUNTRY = "locale.country";
+
+ private final IClientSession m_session;
+ private Preferences m_env;
+
+ /**
+ * @deprecated use {@link #getInstance()}
+ */
+ @Deprecated
+ public ClientUIPreferences() {
+ this(ClientSessionThreadLocal.get());
+ }
+
+ private ClientUIPreferences(IClientSession session) {
+ m_session = session;
+ if (m_session == null) {
+ LOG.error("No scout client session context", new Exception("Calling client preferences from outside a scout client session job"));
+ }
+ load();
+ }
+
+ /**
+ * Since this property depends on the user agent it is saved separately for each combination of {@link IUiLayer} and
+ * {@link IUiDeviceType}.
+ */
+ public Rectangle getFormBounds(IForm form) {
+ String key = form.computeCacheBoundsKey();
+ if (key == null) {
+ return null;
+ }
+
+ key = getUserAgentPrefix() + FORM_BOUNDS + key;
+ String value = m_env.get(key, "");
+ if (StringUtility.isNullOrEmpty(value)) {
+ key = getLegacyFormBoundsKey(form);
+ value = m_env.get(key, "");
+ }
+
+ if (!StringUtility.isNullOrEmpty(value)) {
+ try {
+ StringTokenizer tok = new StringTokenizer(value, ",");
+ Rectangle r = new Rectangle(
+ new Integer(tok.nextToken()).intValue(),
+ new Integer(tok.nextToken()).intValue(),
+ new Integer(tok.nextToken()).intValue(),
+ new Integer(tok.nextToken()).intValue()
+ );
+ return r;
+ }
+ catch (Exception e) {
+ LOG.warn("value=" + value, e);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Since this property depends on the user agent it is saved separately for each combination of {@link IUiLayer} and
+ * {@link IUiDeviceType}.
+ */
+ public void setFormBounds(IForm form, Rectangle bounds) {
+ String key = form.computeCacheBoundsKey();
+ if (key == null) {
+ return;
+ }
+
+ key = getUserAgentPrefix() + FORM_BOUNDS + key;
+ if (bounds == null) {
+ m_env.remove(key);
+ }
+ else {
+ m_env.put(key, bounds.x + "," + bounds.y + "," + bounds.width + "," + bounds.height);
+ }
+ flush();
+ }
+
+ private String getLegacyFormBoundsKey(IForm form) {
+ String key = form.computeCacheBoundsKey();
+ if (key == null) {
+ return null;
+ }
+
+ //Add prefix only if not already added.
+ //This is mainly necessary due to backward compatibility because until 3.8.0 the prefix had to be returned by computeCacheBoundsKey
+ if (!key.startsWith("form.bounds")) {
+ key = "form.bounds_" + key;
+ }
+
+ //Explicitly don't consider user agent because before 3.8.0 there was no user agent and therefore the keys didn't contain this information.
+
+ return key;
+ }
+
+ private String getUserAgentPrefix() {
+ UserAgent currentUserAgent = null;
+ if (m_session != null) {
+ currentUserAgent = m_session.getUserAgent();
+ }
+ else {
+ currentUserAgent = UserAgentUtility.getCurrentUserAgent();
+ }
+ if (currentUserAgent == null) {
+ return "";
+ }
+
+ String uiLayer = null;
+ if (!UiLayer.UNKNOWN.equals(currentUserAgent.getUiLayer())) {
+ uiLayer = currentUserAgent.getUiLayer().getIdentifier();
+ }
+ String uiDeviceType = null;
+ if (!UiDeviceType.UNKNOWN.equals(currentUserAgent.getUiDeviceType())) {
+ uiDeviceType = currentUserAgent.getUiDeviceType().getIdentifier();
+ }
+
+ return StringUtility.concatenateTokens(uiLayer, ".", uiDeviceType, ".");
+ }
+
+ /**
+ * Since this property depends on the user agent it is saved separately for each combination of {@link IUiLayer} and
+ * {@link IUiDeviceType}.
+ *
+ * @since 3.8.0
+ */
+ public int[] getSplitterPosition(ISplitBox splitBox) {
+ String baseKey = splitBox.getCacheSplitterPositionPropertyName();
+ if (baseKey == null) {
+ return null;
+ }
+
+ String key = getUserAgentPrefix() + baseKey;
+ int[] value = getPropertyIntArray(key);
+ if (value == null) {
+ //If no value has been found try to load with the base key. Done due to backward compatibility.
+ value = getPropertyIntArray(baseKey);
+ }
+
+ return value;
+ }
+
+ /**
+ * Since this property depends on the user agent it is saved separately for each combination of {@link IUiLayer} and
+ * {@link IUiDeviceType}.
+ *
+ * @since 3.8.0
+ */
+ public void setSplitterPosition(ISplitBox splitBox, int[] weights) {
+ String key = splitBox.getCacheSplitterPositionPropertyName();
+ if (key == null) {
+ return;
+ }
+
+ key = getUserAgentPrefix() + key;
+ setPropertyIntArray(key, weights);
+ }
+
+ public String getTableKey(ITable t) {
+ String key = t.getClass().getName();
+ String context = t.getUserPreferenceContext();
+ if (context != null) {
+ key += "#" + context;
+ }
+ return key;
+ }
+
+ public Object getTableCustomizerData(String customizerKey, Bundle loaderBundle) {
+ String key = TABLE_CUSTOMIZER_DATA + customizerKey;
+ byte[] serialData = m_env.getByteArray(key, null);
+ if (serialData != null) {
+ ObjectInputStream in = null;
+ try {
+ in = new BundleObjectInputStream(new ByteArrayInputStream(serialData), new Bundle[]{loaderBundle});
+ Object customizerData = in.readObject();
+ in.close();
+ in = null;
+ return customizerData;
+ }
+ catch (Throwable t) {
+ LOG.error("Failed reading custom table data for " + key + ": " + t);
+ m_env.remove(key);
+ return null;
+ }
+ finally {
+ if (in != null) {
+ try {
+ in.close();
+ }
+ catch (Throwable t) {
+ }
+ }
+ }
+ }
+ else {
+ return null;
+ }
+ }
+
+ /**
+ * store customizer data to persistent store
+ */
+ public void setTableCustomizerData(String customizerKey, Object customizerData) {
+ String key = TABLE_CUSTOMIZER_DATA + customizerKey;
+ if (customizerData != null) {
+ ObjectOutputStream out = null;
+ try {
+ ByteArrayOutputStream serialData = new ByteArrayOutputStream();
+ out = new BundleObjectOutputStream(serialData);
+ out.writeObject(customizerData);
+ out.close();
+ out = null;
+ m_env.putByteArray(key, serialData.toByteArray());
+ }
+ catch (Throwable t) {
+ LOG.error("Failed storing custom table data for " + key, t);
+ m_env.remove(key);
+ }
+ finally {
+ if (out != null) {
+ try {
+ out.close();
+ }
+ catch (Throwable t) {
+ }
+ }
+ }
+ }
+ else {
+ m_env.remove(key);
+ }
+ //
+ flush();
+ }
+
+ /**
+ * @return the key prefix used to store column data
+ */
+ public String getColumnKey(IColumn c) {
+ String key = c.getColumnId();
+ if (c.getTable() != null) {
+ key = getTableKey(c.getTable()) + "#" + key;
+ }
+ return key;
+ }
+
+ public void setTableColumnPreferences(IColumn col) {
+ setTableColumnPreferences(col, true);
+ }
+
+ public void setTableColumnPreferences(IColumn col, boolean flush) {
+ String keySuffix = getColumnKey(col);
+ String key = TABLE_COLUMN_UIINDEX + keySuffix;
+ int viewIndex = col.getVisibleColumnIndexHint();
+ boolean visible = col.isVisibleInternal();
+ int width = col.getWidth();
+ int sortIndex = col.getSortIndex();
+ boolean sortUp = col.isSortAscending();
+ boolean sortExplicit = col.isSortExplicit();
+ //
+ if (viewIndex >= 0) {
+ m_env.put(key, "" + viewIndex);
+ }
+ else {
+ m_env.remove(key);
+ }
+ //
+ key = TABLE_COLUMN_VISIBLE + keySuffix;
+ if (!visible) {
+ m_env.put(key, "no");
+ }
+ else {
+ m_env.put(key, "yes");
+ }
+ //
+ key = getUserAgentPrefix() + TABLE_COLUMN_WIDTH + keySuffix;
+ if (width >= 0) {
+ m_env.put(key, "" + width);
+ }
+ else {
+ m_env.remove(key);
+ }
+ //
+ key = TABLE_COLUMN_SORT_INDEX + keySuffix;
+ if (sortIndex >= 0) {
+ m_env.put(key, "" + sortIndex);
+ }
+ else {
+ m_env.put(key, "-1");
+ }
+ //
+ key = TABLE_COLUMN_SORT_ASC + keySuffix;
+ if (sortIndex >= 0 && sortUp) {
+ m_env.put(key, "true");
+ }
+ else {
+ m_env.put(key, "false");
+ }
+ //
+ key = TABLE_COLUMN_SORT_EXPLICIT + keySuffix;
+ if (sortExplicit) {
+ m_env.put(key, "true");
+ }
+ else {
+ m_env.put(key, "false");
+ }
+
+ if (flush) {
+ flush();
+ }
+ }
+
+ public void updateTableColumnOrder(List<IColumn<?>> columnList, int[] visibleColumnIndexHints) {
+ if (columnList.size() != visibleColumnIndexHints.length) {
+ throw new IllegalArgumentException("columnList.size=" + columnList.size() + " hints.length=" + visibleColumnIndexHints.length);
+ }
+ for (int i = 0; i < visibleColumnIndexHints.length; i++) {
+ IColumn<?> c = columnList.get(i);
+ int viewIndex = visibleColumnIndexHints[i];
+ String keySuffix = getColumnKey(c);
+ String key = TABLE_COLUMN_UIINDEX + keySuffix;
+ if (viewIndex >= 0) {
+ m_env.put(key, "" + viewIndex);
+ }
+ else {
+ m_env.remove(key);
+ }
+ }
+ //
+ flush();
+ }
+
+ public void removeTableColumnPreferences(IColumn col) {
+ removeTableColumnPreferences(col, true, true, true, true);
+ }
+
+ public void removeTableColumnPreferences(IColumn col, boolean visibility, boolean order, boolean sorting, boolean widths) {
+ removeTableColumnPreferences(col, visibility, order, sorting, widths, true);
+ }
+
+ private void removeTableColumnPreferences(IColumn col, boolean visibility, boolean order, boolean sorting, boolean widths, boolean flush) {
+ if (col != null) {
+ String keySuffix = getColumnKey(col);
+ if (visibility) {
+ m_env.remove(TABLE_COLUMN_VISIBLE + keySuffix);
+ }
+ if (order) {
+ m_env.remove(TABLE_COLUMN_UIINDEX + keySuffix);
+ }
+ if (sorting) {
+ m_env.remove(TABLE_COLUMN_SORT_INDEX + keySuffix);
+ m_env.remove(TABLE_COLUMN_SORT_ASC + keySuffix);
+ m_env.remove(TABLE_COLUMN_SORT_EXPLICIT + keySuffix);
+ }
+ if (widths) {
+ m_env.remove(getUserAgentPrefix() + TABLE_COLUMN_WIDTH + keySuffix);
+ }
+
+ if (flush) {
+ flush();
+ }
+ }
+ }
+
+ public void removeAllTableColumnPreferences(ITable table, boolean visibility, boolean order, boolean sorting, boolean widths) {
+ if (table == null) {
+ return;
+ }
+
+ for (IColumn<?> col : table.getColumns()) {
+ removeTableColumnPreferences(col, visibility, order, sorting, widths, false);
+ }
+
+ flush();
+ }
+
+ public void setAllTableColumnPreferences(ITable table) {
+ if (table == null) {
+ return;
+ }
+
+ for (IColumn col : table.getColumns()) {
+ if (col.isDisplayable()) {
+ setTableColumnPreferences(col, false);
+ }
+ }
+
+ flush();
+ }
+
+ /**
+ * @return true if there are any user preferences for this tables columns
+ */
+ public boolean hasTableColumnPreferences(ITable table) {
+ if (table != null) {
+ for (IColumn col : table.getColumns()) {
+ String keySuffix = getColumnKey(col);
+ if (m_env.get(TABLE_COLUMN_VISIBLE + keySuffix, null) != null) {
+ return true;
+ }
+ if (m_env.get(TABLE_COLUMN_UIINDEX + keySuffix, null) != null) {
+ return true;
+ }
+ if (m_env.get(TABLE_COLUMN_SORT_INDEX + keySuffix, null) != null) {
+ return true;
+ }
+ if (m_env.get(TABLE_COLUMN_SORT_ASC + keySuffix, null) != null) {
+ return true;
+ }
+ if (m_env.get(TABLE_COLUMN_SORT_EXPLICIT + keySuffix, null) != null) {
+ return true;
+ }
+ if (m_env.get(TABLE_COLUMN_WIDTH + keySuffix, null) != null) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Since this property depends on the user agent it is saved separately for each combination of {@link IUiLayer} and
+ * {@link IUiDeviceType}.
+ */
+ public int getTableColumnWidth(IColumn col, int defaultWidth) {
+ String keySuffix = getColumnKey(col);
+ String baseKey = TABLE_COLUMN_WIDTH + keySuffix;
+ String key = getUserAgentPrefix() + baseKey;
+
+ String value = m_env.get(key, null);
+ if (value == null) {
+ //If no value has been found try to load with the base key. Done due to backward compatibility.
+ value = m_env.get(baseKey, null);
+ }
+ if (value != null) {
+ try {
+ return Integer.parseInt(value);
+ }
+ catch (Exception e) {
+ LOG.warn("value=" + value, e);
+ }
+ }
+ return defaultWidth;
+ }
+
+ public boolean getTableColumnVisible(IColumn col, boolean defaultValue) {
+ String keySuffix = getColumnKey(col);
+ String key = TABLE_COLUMN_VISIBLE + keySuffix;
+ String value = m_env.get(key, null);
+ if (value != null) {
+ Boolean b = TypeCastUtility.castValue(value, Boolean.class);
+ return b != null ? b.booleanValue() : defaultValue;
+ }
+ return defaultValue;
+ }
+
+ public int getTableColumnViewIndex(IColumn col, int defaultIndex) {
+ String keySuffix = getColumnKey(col);
+ String key = TABLE_COLUMN_UIINDEX + keySuffix;
+ String value = m_env.get(key, null);
+ if (value != null) {
+ try {
+ return Integer.parseInt(value);
+ }
+ catch (Exception e) {
+ LOG.warn("value=" + value, e);
+ }
+ }
+ return defaultIndex;
+ }
+
+ public int getTableColumnSortIndex(IColumn col, int defaultValue) {
+ String keySuffix = getColumnKey(col);
+ String key = TABLE_COLUMN_SORT_INDEX + keySuffix;
+ String value = m_env.get(key, null);
+ if (value != null) {
+ Integer i = TypeCastUtility.castValue(value, Integer.class);
+ return i.intValue();
+ }
+ return defaultValue;
+ }
+
+ public boolean getTableColumnSortAscending(IColumn col, boolean defaultValue) {
+ String keySuffix = getColumnKey(col);
+ String key = TABLE_COLUMN_SORT_ASC + keySuffix;
+ String value = m_env.get(key, null);
+ if (value != null) {
+ Boolean b = TypeCastUtility.castValue(value, Boolean.class);
+ return b != null ? b.booleanValue() : defaultValue;
+ }
+ return defaultValue;
+ }
+
+ public Boolean getTableColumnSortExplicit(IColumn col) {
+ String keySuffix = getColumnKey(col);
+ String key = TABLE_COLUMN_SORT_EXPLICIT + keySuffix;
+ String value = m_env.get(key, null);
+ if (value != null) {
+ return TypeCastUtility.castValue(value, Boolean.class);
+ }
+ return null;
+ }
+
+ public void setApplicationWindowPreferences(BoundsSpec r, boolean maximized) {
+ if (r != null) {
+ String value = "" + r.x + "," + r.y + "," + r.width + "," + r.height;
+ m_env.put(APPLICATION_WINDOW_BOUNDS, value);
+ }
+ else {
+ m_env.remove(APPLICATION_WINDOW_BOUNDS);
+ }
+ //
+ if (maximized) {
+ m_env.put(APPLICATION_WINDOW_MAXIMIZED, "yes");
+ }
+ else {
+ m_env.remove(APPLICATION_WINDOW_MAXIMIZED);
+ }
+ flush();
+ }
+
+ public boolean getApplicationWindowMaximized() {
+ String key = APPLICATION_WINDOW_MAXIMIZED;
+ String value = m_env.get(key, null);
+ if (value != null) {
+ return value.equalsIgnoreCase("yes");
+ }
+ return false;
+ }
+
+ public BoundsSpec getApplicationWindowBounds() {
+ String key = APPLICATION_WINDOW_BOUNDS;
+ String value = m_env.get(key, null);
+ if (value != null) {
+ try {
+ StringTokenizer tok = new StringTokenizer(value, ",");
+ BoundsSpec r = new BoundsSpec(
+ new Integer(tok.nextToken()).intValue(),
+ new Integer(tok.nextToken()).intValue(),
+ new Integer(tok.nextToken()).intValue(),
+ new Integer(tok.nextToken()).intValue()
+ );
+ return r;
+ }
+ catch (Exception e) {
+ LOG.warn("value=" + value, e);
+ }
+ }
+ return null;
+ }
+
+ public void setCalendarPreferences(int displayMode, boolean displayCondensed) {
+ m_env.put(CALENDAR_DISPLAY_MODE, "" + displayMode);
+ m_env.put(CALENDAR_DISPLAY_CONDENSED, "" + displayCondensed);
+ flush();
+ }
+
+ public int getCalendarDisplayMode(int defaultValue) {
+ String key = CALENDAR_DISPLAY_MODE;
+ String value = m_env.get(key, null);
+ if (value != null) {
+ try {
+ return Integer.parseInt(value);
+ }
+ catch (Exception e) {
+ LOG.warn("value=" + value, e);
+ }
+ }
+ return defaultValue;
+ }
+
+ public boolean getCalendarDisplayCondensed(boolean defaultValue) {
+ String key = CALENDAR_DISPLAY_CONDENSED;
+ String value = m_env.get(key, null);
+ if (value != null) {
+ try {
+ return TypeCastUtility.castValue(value, Boolean.class);
+ }
+ catch (Exception e) {
+ LOG.warn("value=" + value, e);
+ }
+ }
+ return defaultValue;
+ }
+
+ public int getPropertyInteger(String propName, int defaultValue, boolean setDefaultAsProperty) {
+ String value = m_env.get(propName, null);
+ if (value != null) {
+ try {
+ return TypeCastUtility.castValue(value, Integer.class);
+ }
+ catch (Exception e) {
+ LOG.warn("value=" + value, e);
+ if (setDefaultAsProperty) {
+ setPropertyInteger(propName, defaultValue);
+ }
+ }
+ }
+ else {
+ if (setDefaultAsProperty) {
+ setPropertyInteger(propName, defaultValue);
+ }
+ }
+ return defaultValue;
+ }
+
+ public void setPropertyInteger(String propName, int value) {
+ m_env.put(propName, "" + value);
+ flush();
+ }
+
+ public int[] getPropertyIntArray(String propName) {
+ String strVal = m_env.get(propName, null);
+ if (!StringUtility.hasText(strVal)) {
+ return null;
+ }
+
+ String[] split = strVal.split(";");
+ int[] val = new int[split.length];
+ for (int i = 0; i < split.length; i++) {
+ val[i] = Integer.parseInt(split[i]);
+ }
+ return val;
+ }
+
+ public void setPropertyIntArray(String propName, int[] value) {
+ StringBuilder builder = new StringBuilder();
+ if (value != null) {
+ for (int i = 0; i < value.length; i++) {
+ builder.append(value[i]);
+ if (i != value.length - 1) {
+ builder.append(";");
+ }
+ }
+ }
+ m_env.put(propName, builder.toString());
+ flush();
+ }
+
+ public Double getPropertyDouble(String propName) {
+ String value = m_env.get(propName, null);
+ if (value != null) {
+ try {
+ return TypeCastUtility.castValue(value, Double.class);
+ }
+ catch (Exception e) {
+ LOG.warn("value=" + value, e);
+ }
+ }
+ return null;
+ }
+
+ public void setPropertyDouble(String propName, Double value) {
+ m_env.put(propName, "" + value);
+ flush();
+ }
+
+ public int[][] getDesktopColumnSplits(int rowCount, int colCount) {
+ //the row x col matrix is stored as flat int array, row per row, column per column
+ int[] a = getPropertyIntArray(DESKTOP_COLUMN_SPLITS);
+ if (a != null && a.length == rowCount * colCount) {
+ int[][] splits = new int[rowCount][colCount];
+ int index = 0;
+ for (int r = 0; r < rowCount; r++) {
+ for (int c = 0; c < colCount; c++) {
+ splits[r][c] = a[index];
+ index++;
+ }
+ }
+ return splits;
+ }
+ return null;
+ }
+
+ /**
+ * @deprecated use {@link LocaleThreadLocal#get()} or {@link Locale#getDefault()}
+ */
+ @Deprecated
+ public Locale getLocale() {
+ // >> legacy support. To be removed in release 3.9.0.
+ String strLegacy = m_env.get(NLS_LOCALE_ISO, null);
+ if (strLegacy != null) {
+ m_env.remove(NLS_LOCALE_ISO); // remove legacy entry
+ m_env.put(NLS_LOCALE_LANGUAGE, strLegacy);
+ flush();
+ }
+ // << legacy support. To be removed in release 3.9.0.
+
+ String strLanguage = m_env.get(NLS_LOCALE_LANGUAGE, null);
+ String strCountry = m_env.get(NLS_LOCALE_COUNTRY, null);
+ if (strLanguage != null && strCountry != null) {
+ return new Locale(strLanguage, strCountry);
+ }
+ else if (strLanguage != null) {
+ return new Locale(strLanguage, ClientUIPreferences.getHostLocale().getCountry());
+ }
+ return null;
+ }
+
+ /**
+ * @deprecated use {@link LocaleThreadLocal#set(Locale)} or {@link Locale#setDefault(Locale)}
+ */
+ @Deprecated
+ public void setLocale(Locale locale) {
+ if (locale != null) {
+ m_env.put(NLS_LOCALE_LANGUAGE, locale.getLanguage());
+ m_env.put(NLS_LOCALE_COUNTRY, locale.getCountry());
+ }
+ else {
+ m_env.remove(NLS_LOCALE_LANGUAGE);
+ m_env.remove(NLS_LOCALE_COUNTRY);
+ }
+ flush();
+ }
+
+ /**
+ * @deprecated to be removed in release 3.9.0
+ */
+ @Deprecated
+ public static Locale getHostLocale() {
+ return Locale.getDefault();
+ }
+
+ public void setDesktopColumnSplits(int[][] splits) {
+ //the row x col matrix is stored as flat int array, row per row, column per column
+ if (splits != null) {
+ int rowCount = splits.length;
+ int colCount = splits[0].length;
+ int[] a = new int[rowCount * colCount];
+ int index = 0;
+ for (int r = 0; r < rowCount; r++) {
+ for (int c = 0; c < colCount; c++) {
+ a[index] = splits[r][c];
+ index++;
+ }
+ }
+ setPropertyIntArray(DESKTOP_COLUMN_SPLITS, a);
+ }
+ }
+
+ protected void load() {
+ if (m_session == null || ClientSessionThreadLocal.get() == m_session) {
+ m_env = SERVICES.getService(IUserPreferencesStorageService.class).loadPreferences();
+ }
+ else {
+ ClientAsyncJob job = new ClientAsyncJob("Load user preferences", m_session) {
+ @Override
+ protected void runVoid(IProgressMonitor monitor) throws Throwable {
+ m_env = SERVICES.getService(IUserPreferencesStorageService.class).loadPreferences();
+ }
+ };
+ job.schedule();
+ try {
+ job.join();
+ }
+ catch (InterruptedException e) {
+ //nop
+ }
+ }
+ if (m_env == null) {
+ throw new IllegalStateException("Could not load preferences in client job");
+ }
+ }
+
+ protected void flush() {
+ try {
+ m_env.flush();
+ }
+ catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/DataChangeListener.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/DataChangeListener.java
index cb5be4e504..c843528588 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/DataChangeListener.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/DataChangeListener.java
@@ -1,27 +1,27 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui;
-
-import java.util.EventListener;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
-
-/**
- * Listener to observe arbitrary changes on any abstract data model or
- * enumerations see {@link IDesktop#addDataChangeListener(IDataChangeListener, Object...)} and
- * {@link IDesktop#removeDataChangeListener(IDataChangeListener, Object...)}
- */
-public interface DataChangeListener extends EventListener {
-
- void dataChanged(Object... dataTypes) throws ProcessingException;
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui;
+
+import java.util.EventListener;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
+
+/**
+ * Listener to observe arbitrary changes on any abstract data model or
+ * enumerations see {@link IDesktop#addDataChangeListener(IDataChangeListener, Object...)} and
+ * {@link IDesktop#removeDataChangeListener(IDataChangeListener, Object...)}
+ */
+public interface DataChangeListener extends EventListener {
+
+ void dataChanged(Object... dataTypes) throws ProcessingException;
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/IDNDSupport.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/IDNDSupport.java
index f6b956aec1..4c1c8cf7b8 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/IDNDSupport.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/IDNDSupport.java
@@ -1,67 +1,67 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui;
-
-import org.eclipse.scout.commons.dnd.FileListTransferObject;
-import org.eclipse.scout.commons.dnd.ImageTransferObject;
-import org.eclipse.scout.commons.dnd.JavaTransferObject;
-import org.eclipse.scout.commons.dnd.TextTransferObject;
-
-/**
- * <h3>IDNDSupport</h3>
- *
- * @since 3.1.12 24.07.2008
- * @see TextTransferObject
- * @see JavaTransferObject
- * @see ImageTransferObject
- * @see FileListTransferObject
- */
-public interface IDNDSupport {
- /*
- * Properties
- */
- String PROP_DRAG_TYPE = "dragType";
- String PROP_DROP_TYPE = "dropType";
- /*
- * drag n drop types
- */
- int TYPE_FILE_TRANSFER = 1 << 0;
- int TYPE_JAVA_ELEMENT_TRANSFER = 1 << 1;
- int TYPE_TEXT_TRANSFER = 1 << 2;
- int TYPE_IMAGE_TRANSFER = 1 << 3;
-
- /**
- * @param dragType
- * one of {@link IDNDSupport#TYPE_FILE_TRANSFER}, {@link IDNDSupport#TYPE_IMAGE_TRANSFER},
- * {@link IDNDSupport#TYPE_JAVA_ELEMENT_TRANSFER}, {@link IDNDSupport#TYPE_TEXT_TRANSFER}
- */
- void setDragType(int dragType);
-
- /**
- * @return one of {@link IDNDSupport#TYPE_FILE_TRANSFER}, {@link IDNDSupport#TYPE_IMAGE_TRANSFER},
- * {@link IDNDSupport#TYPE_JAVA_ELEMENT_TRANSFER}, {@link IDNDSupport#TYPE_TEXT_TRANSFER}
- */
- int getDragType();
-
- /**
- * @param dropType
- * one of {@link IDNDSupport#TYPE_FILE_TRANSFER}, {@link IDNDSupport#TYPE_IMAGE_TRANSFER},
- * {@link IDNDSupport#TYPE_JAVA_ELEMENT_TRANSFER}, {@link IDNDSupport#TYPE_TEXT_TRANSFER}
- */
- void setDropType(int dropType);
-
- /**
- * @return one of {@link IDNDSupport#TYPE_FILE_TRANSFER}, {@link IDNDSupport#TYPE_IMAGE_TRANSFER},
- * {@link IDNDSupport#TYPE_JAVA_ELEMENT_TRANSFER}, {@link IDNDSupport#TYPE_TEXT_TRANSFER}
- */
- int getDropType();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui;
+
+import org.eclipse.scout.commons.dnd.FileListTransferObject;
+import org.eclipse.scout.commons.dnd.ImageTransferObject;
+import org.eclipse.scout.commons.dnd.JavaTransferObject;
+import org.eclipse.scout.commons.dnd.TextTransferObject;
+
+/**
+ * <h3>IDNDSupport</h3>
+ *
+ * @since 3.1.12 24.07.2008
+ * @see TextTransferObject
+ * @see JavaTransferObject
+ * @see ImageTransferObject
+ * @see FileListTransferObject
+ */
+public interface IDNDSupport {
+ /*
+ * Properties
+ */
+ String PROP_DRAG_TYPE = "dragType";
+ String PROP_DROP_TYPE = "dropType";
+ /*
+ * drag n drop types
+ */
+ int TYPE_FILE_TRANSFER = 1 << 0;
+ int TYPE_JAVA_ELEMENT_TRANSFER = 1 << 1;
+ int TYPE_TEXT_TRANSFER = 1 << 2;
+ int TYPE_IMAGE_TRANSFER = 1 << 3;
+
+ /**
+ * @param dragType
+ * one of {@link IDNDSupport#TYPE_FILE_TRANSFER}, {@link IDNDSupport#TYPE_IMAGE_TRANSFER},
+ * {@link IDNDSupport#TYPE_JAVA_ELEMENT_TRANSFER}, {@link IDNDSupport#TYPE_TEXT_TRANSFER}
+ */
+ void setDragType(int dragType);
+
+ /**
+ * @return one of {@link IDNDSupport#TYPE_FILE_TRANSFER}, {@link IDNDSupport#TYPE_IMAGE_TRANSFER},
+ * {@link IDNDSupport#TYPE_JAVA_ELEMENT_TRANSFER}, {@link IDNDSupport#TYPE_TEXT_TRANSFER}
+ */
+ int getDragType();
+
+ /**
+ * @param dropType
+ * one of {@link IDNDSupport#TYPE_FILE_TRANSFER}, {@link IDNDSupport#TYPE_IMAGE_TRANSFER},
+ * {@link IDNDSupport#TYPE_JAVA_ELEMENT_TRANSFER}, {@link IDNDSupport#TYPE_TEXT_TRANSFER}
+ */
+ void setDropType(int dropType);
+
+ /**
+ * @return one of {@link IDNDSupport#TYPE_FILE_TRANSFER}, {@link IDNDSupport#TYPE_IMAGE_TRANSFER},
+ * {@link IDNDSupport#TYPE_JAVA_ELEMENT_TRANSFER}, {@link IDNDSupport#TYPE_TEXT_TRANSFER}
+ */
+ int getDropType();
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/IEventHistory.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/IEventHistory.java
index 390a948450..8d760edbae 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/IEventHistory.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/IEventHistory.java
@@ -1,46 +1,46 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui;
-
-import java.util.Collection;
-
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITree;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-
-/**
- * This interface collects some recent events of a model objects for the purpose of retaining them for late-attaching ui
- * widgets.
- * <p>
- * see https://bugs.eclipse.org/bugs/show_bug.cgi?id=375522
- * <p>
- * The history may contain all or just some events that are of special interest for late attaching ui components. This
- * basically just includes those events that have no state associated with it, such as requestFocus, scrollToSelection
- * (the trigger variant) etc.
- * <p>
- * see {@link ITree#getEventHistory()}, {@link ITable#getEventHistory()}, {@link IForm#getEventHistory()}
- * <p>
- * This object should be thread safe.
- *
- * @since 3.8
- */
-public interface IEventHistory<T> {
- /**
- * This method is called whenever the tree fires out an event
- */
- void notifyEvent(T event);
-
- /**
- * @return a list with the most recent events within the timeout range
- */
- Collection<T> getRecentEvents();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui;
+
+import java.util.Collection;
+
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITree;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+
+/**
+ * This interface collects some recent events of a model objects for the purpose of retaining them for late-attaching ui
+ * widgets.
+ * <p>
+ * see https://bugs.eclipse.org/bugs/show_bug.cgi?id=375522
+ * <p>
+ * The history may contain all or just some events that are of special interest for late attaching ui components. This
+ * basically just includes those events that have no state associated with it, such as requestFocus, scrollToSelection
+ * (the trigger variant) etc.
+ * <p>
+ * see {@link ITree#getEventHistory()}, {@link ITable#getEventHistory()}, {@link IForm#getEventHistory()}
+ * <p>
+ * This object should be thread safe.
+ *
+ * @since 3.8
+ */
+public interface IEventHistory<T> {
+ /**
+ * This method is called whenever the tree fires out an event
+ */
+ void notifyEvent(T event);
+
+ /**
+ * @return a list with the most recent events within the timeout range
+ */
+ Collection<T> getRecentEvents();
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/IIconLocator.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/IIconLocator.java
index 25fe89f0d5..37c09fe848 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/IIconLocator.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/IIconLocator.java
@@ -1,26 +1,26 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui;
-
-import org.eclipse.scout.rt.client.services.common.icon.IconSpec;
-
-/**
- *
- */
-public interface IIconLocator {
-
- /**
- * @param name
- * @return
- */
- IconSpec getIconSpec(String name);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui;
+
+import org.eclipse.scout.rt.client.services.common.icon.IconSpec;
+
+/**
+ *
+ */
+public interface IIconLocator {
+
+ /**
+ * @param name
+ * @return
+ */
+ IconSpec getIconSpec(String name);
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/IconLocator.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/IconLocator.java
index 36cb2f0edb..6838fed808 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/IconLocator.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/IconLocator.java
@@ -1,102 +1,102 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui;
-
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.TreeSet;
-
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.client.services.common.icon.IIconProviderService;
-import org.eclipse.scout.rt.client.services.common.icon.IconProviderService;
-import org.eclipse.scout.rt.client.services.common.icon.IconSpec;
-import org.eclipse.scout.rt.shared.AbstractIcons;
-import org.eclipse.scout.service.SERVICES;
-import org.osgi.framework.Bundle;
-
-/**
- *
- */
-public class IconLocator implements IIconLocator {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(IconLocator.class);
-
- private final IIconProviderService[] m_iconProviderServices;
-
- public IconLocator(IClientSession session) {
- Bundle clientBundle = session.getBundle();
- TreeSet<IIconProviderService> services = new TreeSet<IIconProviderService>(new P_ServiceComparator());
- IIconProviderService[] registeredServices = SERVICES.getServices(IIconProviderService.class);
- services.addAll(Arrays.asList(registeredServices));
- boolean containsClientBundle = false;
- for (IIconProviderService service : registeredServices) {
- if (CompareUtility.equals(service.getHostBundle(), clientBundle)) {
- containsClientBundle = true;
- break;
- }
- }
- if (!containsClientBundle) {
- services.add(new P_ClientIconProviderService(clientBundle));
- }
- m_iconProviderServices = services.toArray(new IIconProviderService[services.size()]);
- }
-
- @Override
- public IconSpec getIconSpec(String name) {
- if (name == null || AbstractIcons.Null.equals(name)) {
- return null;
- }
- IconSpec spec = null;
- for (IIconProviderService service : m_iconProviderServices) {
- spec = service.getIconSpec(name);
- if (spec != null) {
- break;
- }
- }
- return spec;
- }
-
- private class P_ServiceComparator implements Comparator<IIconProviderService> {
- @Override
- public int compare(IIconProviderService o1, IIconProviderService o2) {
- if (o1 == o2) {
- return 0;
- }
- if (o1 == null) {
- return -1;
- }
- if (o2 == null) {
- return 1;
- }
- int result = o2.getRanking() - o1.getRanking();
- if (result == 0) {
- LOG.warn("Multiple IIconProviderServices with the same ranking found. A clear definition of the rankings is necessary to properly enable the icon overriding. Affected services: " + o1 + ", " + o2);
- return -1;
- }
- return result;
- }
- }
-
- private class P_ClientIconProviderService extends IconProviderService {
-
- public P_ClientIconProviderService(Bundle clientBundle) {
- setHostBundle(clientBundle);
- }
-
- @Override
- public int getRanking() {
- return -20;
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui;
+
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.TreeSet;
+
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.client.services.common.icon.IIconProviderService;
+import org.eclipse.scout.rt.client.services.common.icon.IconProviderService;
+import org.eclipse.scout.rt.client.services.common.icon.IconSpec;
+import org.eclipse.scout.rt.shared.AbstractIcons;
+import org.eclipse.scout.service.SERVICES;
+import org.osgi.framework.Bundle;
+
+/**
+ *
+ */
+public class IconLocator implements IIconLocator {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(IconLocator.class);
+
+ private final IIconProviderService[] m_iconProviderServices;
+
+ public IconLocator(IClientSession session) {
+ Bundle clientBundle = session.getBundle();
+ TreeSet<IIconProviderService> services = new TreeSet<IIconProviderService>(new P_ServiceComparator());
+ IIconProviderService[] registeredServices = SERVICES.getServices(IIconProviderService.class);
+ services.addAll(Arrays.asList(registeredServices));
+ boolean containsClientBundle = false;
+ for (IIconProviderService service : registeredServices) {
+ if (CompareUtility.equals(service.getHostBundle(), clientBundle)) {
+ containsClientBundle = true;
+ break;
+ }
+ }
+ if (!containsClientBundle) {
+ services.add(new P_ClientIconProviderService(clientBundle));
+ }
+ m_iconProviderServices = services.toArray(new IIconProviderService[services.size()]);
+ }
+
+ @Override
+ public IconSpec getIconSpec(String name) {
+ if (name == null || AbstractIcons.Null.equals(name)) {
+ return null;
+ }
+ IconSpec spec = null;
+ for (IIconProviderService service : m_iconProviderServices) {
+ spec = service.getIconSpec(name);
+ if (spec != null) {
+ break;
+ }
+ }
+ return spec;
+ }
+
+ private class P_ServiceComparator implements Comparator<IIconProviderService> {
+ @Override
+ public int compare(IIconProviderService o1, IIconProviderService o2) {
+ if (o1 == o2) {
+ return 0;
+ }
+ if (o1 == null) {
+ return -1;
+ }
+ if (o2 == null) {
+ return 1;
+ }
+ int result = o2.getRanking() - o1.getRanking();
+ if (result == 0) {
+ LOG.warn("Multiple IIconProviderServices with the same ranking found. A clear definition of the rankings is necessary to properly enable the icon overriding. Affected services: " + o1 + ", " + o2);
+ return -1;
+ }
+ return result;
+ }
+ }
+
+ private class P_ClientIconProviderService extends IconProviderService {
+
+ public P_ClientIconProviderService(Bundle clientBundle) {
+ setHostBundle(clientBundle);
+ }
+
+ @Override
+ public int getRanking() {
+ return -20;
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/WeakDataChangeListener.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/WeakDataChangeListener.java
index 3ecd6bd7e9..1c58a22fbc 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/WeakDataChangeListener.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/WeakDataChangeListener.java
@@ -1,20 +1,20 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui;
-
-import org.eclipse.scout.commons.WeakEventListener;
-
-/**
- * see {@link DataChangeListener}
- */
-public interface WeakDataChangeListener extends DataChangeListener, WeakEventListener {
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui;
+
+import org.eclipse.scout.commons.WeakEventListener;
+
+/**
+ * see {@link DataChangeListener}
+ */
+public interface WeakDataChangeListener extends DataChangeListener, WeakEventListener {
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/AbstractAction.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/AbstractAction.java
index 702d189a3f..1e365b2859 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/AbstractAction.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/AbstractAction.java
@@ -1,640 +1,640 @@
-/*******************************************************************************
- * Copyright (c) 2010,2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.action;
-
-import java.security.Permission;
-
-import org.eclipse.scout.commons.EventListenerList;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.annotations.ConfigOperation;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.beans.AbstractPropertyObserver;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.action.tree.IActionNode;
-import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
-import org.eclipse.scout.rt.shared.services.common.security.IAccessControlService;
-import org.eclipse.scout.service.SERVICES;
-
-public abstract class AbstractAction extends AbstractPropertyObserver implements IAction {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractAction.class);
-
- private boolean m_initialized;
- private final EventListenerList m_listenerList = new EventListenerList();
- private final IActionUIFacade m_uiFacade;
- private boolean m_inheritAccessibility;
- // enabled is defined as: enabledGranted && enabledProperty && enabledProcessing
- private boolean m_enabledGranted;
- private boolean m_enabledProperty;
- private boolean m_enabledProcessingAction;
- private boolean m_visibleProperty;
- private boolean m_visibleGranted;
- private boolean m_singleSelectionAction;
- private boolean m_multiSelectionAction;
- private boolean m_emptySpaceAction;
- private boolean m_toggleAction;
-
- public AbstractAction() {
- this(true);
- }
-
- public AbstractAction(boolean callInitializer) {
- m_uiFacade = createUIFacade();
- m_enabledGranted = true;
- m_enabledProcessingAction = true;
- m_visibleGranted = true;
- if (callInitializer) {
- callInitializer();
- }
- }
-
- protected void callInitializer() {
- if (!m_initialized) {
- initConfig();
- try {
- execInitAction();
- }
- catch (Throwable t) {
- LOG.warn("Action " + getClass().getName(), t);
- }
- m_initialized = true;
- }
- }
-
- /*
- * Configuration
- */
- @ConfigProperty(ConfigProperty.ICON_ID)
- @Order(30)
- @ConfigPropertyValue("null")
- protected String getConfiguredIconId() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.TEXT)
- @Order(40)
- @ConfigPropertyValue("null")
- protected String getConfiguredText() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.TEXT)
- @Order(50)
- @ConfigPropertyValue("null")
- protected String getConfiguredTooltipText() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.STRING)
- @Order(55)
- @ConfigPropertyValue("null")
- protected String getConfiguredKeyStroke() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(10)
- @ConfigPropertyValue("true")
- protected boolean getConfiguredEnabled() {
- return true;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(20)
- @ConfigPropertyValue("true")
- protected boolean getConfiguredVisible() {
- return true;
- }
-
- /**
- * @return true if {@link #prepareAction()} should in addition consider the
- * context of the action to decide for visibility and enabled.<br>
- * For example a menu of a table field with {@link #isInheritAccessibility()}==true is invisible when the
- * table
- * field is disabled or invisible
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(22)
- @ConfigPropertyValue("true")
- protected boolean getConfiguredInheritAccessibility() {
- return true;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(25)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredToggleAction() {
- return false;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(60)
- @ConfigPropertyValue("true")
- protected boolean getConfiguredSingleSelectionAction() {
- return true;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(70)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredMultiSelectionAction() {
- return false;
- }
-
- /**
- * @deprecated obsolete, not used anymore
- */
- @Deprecated
- protected boolean getConfiguredNonSelectionAction() {
- return false;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(90)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredEmptySpaceAction() {
- return false;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(100)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredSeparator() {
- return false;
- }
-
- @ConfigProperty(ConfigProperty.DOC)
- @Order(110)
- @ConfigPropertyValue("null")
- protected String getConfiguredDoc() {
- return null;
- }
-
- /**
- * called by constructor<br>
- * this way a menu can for example add/remove custom child menus
- */
- @ConfigOperation
- @Order(10)
- protected void execInitAction() throws ProcessingException {
- }
-
- /**
- * called by prepareAction before action is added to list or used<br>
- * this way a menu can be made dynamically visible / enabled
- */
- @ConfigOperation
- @Order(20)
- protected void execPrepareAction() throws ProcessingException {
- }
-
- /**
- * called when action is performed
- */
- @ConfigOperation
- @Order(30)
- protected void execAction() throws ProcessingException {
- }
-
- /**
- * called whenever the selection (of a toggle-action) is changed
- */
- @ConfigOperation
- @Order(31)
- protected void execToggleAction(boolean selected) throws ProcessingException {
- }
-
- protected void initConfig() {
- setIconId(getConfiguredIconId());
- setText(getConfiguredText());
- setTooltipText(getConfiguredTooltipText());
- setKeyStroke(getConfiguredKeyStroke());
- setInheritAccessibility(getConfiguredInheritAccessibility());
- setEnabled(getConfiguredEnabled());
- setVisible(getConfiguredVisible());
- setToggleAction(getConfiguredToggleAction());
- setSingleSelectionAction(getConfiguredSingleSelectionAction());
- setMultiSelectionAction(getConfiguredMultiSelectionAction());
- setEmptySpaceAction(getConfiguredEmptySpaceAction());
- setSeparator(getConfiguredSeparator());
- if (isSingleSelectionAction() || isMultiSelectionAction() || isEmptySpaceAction()) {
- // ok
- }
- else {
- // legacy case of implicit new menu
- setEmptySpaceAction(true);
- }
- }
-
- protected IActionUIFacade createUIFacade() {
- return new P_UIFacade();
- }
-
- @Override
- public int acceptVisitor(IActionVisitor visitor) {
- switch (visitor.visit(this)) {
- case IActionVisitor.CANCEL:
- return IActionVisitor.CANCEL;
- case IActionVisitor.CANCEL_SUBTREE:
- return IActionVisitor.CONTINUE;
- case IActionVisitor.CONTINUE_BRANCH:
- return IActionVisitor.CANCEL;
- default:
- return IActionVisitor.CONTINUE;
- }
- }
-
- @Override
- public Object getProperty(String name) {
- return propertySupport.getProperty(name);
- }
-
- @Override
- public void setProperty(String name, Object value) {
- propertySupport.setProperty(name, value);
- }
-
- @Override
- public boolean hasProperty(String name) {
- return propertySupport.hasProperty(name);
- }
-
- @Override
- public String getActionId() {
- String s = getClass().getName();
- int i = Math.max(s.lastIndexOf('$'), s.lastIndexOf('.'));
- s = s.substring(i + 1);
- return s;
- }
-
- @Override
- public void doAction() throws ProcessingException {
- if (isEnabled() && isVisible()) {
- try {
- setEnabledProcessingAction(false);
-
- execAction();
- }
- finally {
- setEnabledProcessingAction(true);
- }
- }
- }
-
- @Override
- public String getIconId() {
- return propertySupport.getPropertyString(PROP_ICON_ID);
- }
-
- @Override
- public void setIconId(String iconId) {
- propertySupport.setPropertyString(PROP_ICON_ID, iconId);
- }
-
- @Override
- public String getText() {
- return propertySupport.getPropertyString(PROP_TEXT);
- }
-
- @Override
- public void setText(String text) {
- if (text != null) {
- propertySupport.setPropertyString(PROP_TEXT, StringUtility.removeMnemonic(text));
- propertySupport.setProperty(PROP_MNEMONIC, StringUtility.getMnemonic(text));
- }
- else {
- propertySupport.setPropertyString(PROP_TEXT, null);
- propertySupport.setProperty(PROP_MNEMONIC, (char) 0x0);
- }
- }
-
- @Override
- public String getKeyStroke() {
- return propertySupport.getPropertyString(PROP_KEYSTROKE);
- }
-
- @Override
- public void setKeyStroke(String k) {
- // normalize key stroke format
- if (k != null) {
- k = k.toLowerCase();
- boolean shift = false;
- boolean ctrl = false;
- boolean alt = false;
- String key = null;
- if (k.endsWith(" ")) {
- key = " ";
- }
- for (String s : k.trim().split("[ -]")) {
- if (s.equals("shift")) {
- shift = true;
- }
- else if (s.equals("control")) {
- ctrl = true;
- }
- else if (s.equals("ctrl")) {
- ctrl = true;
- }
- else if (s.equals("strg")) {
- ctrl = true;
- }
- else if (s.equals("alt")) {
- alt = true;
- }
- else if (s.equals("alternate")) {
- alt = true;
- }
- else {
- key = s;
- }
- }
- if (key != null) {
- k = (shift ? "shift-" : "") + (ctrl ? "control-" : "") + (alt ? "alternate-" : "") + key;
- }
- else {
- k = null;
- }
- }
- propertySupport.setPropertyString(PROP_KEYSTROKE, k);
- }
-
- @Override
- public String getTooltipText() {
- return propertySupport.getPropertyString(PROP_TOOLTIP_TEXT);
- }
-
- @Override
- public void setTooltipText(String text) {
- propertySupport.setPropertyString(PROP_TOOLTIP_TEXT, text);
- }
-
- @Override
- public boolean isEnabled() {
- return propertySupport.getPropertyBool(PROP_ENABLED);
- }
-
- @Override
- public boolean isThisAndParentsEnabled() {
- if (!isEnabled()) {
- return false;
- }
- IAction temp = this;
- while (temp instanceof IActionNode) {
- temp = ((IActionNode) temp).getParent();
- if (temp == null) {
- return true;
- }
- if (!temp.isEnabled()) {
- return false;
- }
- }
- return true;
- }
-
- @Override
- public void setEnabled(boolean b) {
- m_enabledProperty = b;
- setEnabledInternal();
- }
-
- @Override
- public boolean isSelected() {
- return propertySupport.getPropertyBool(PROP_SELECTED);
- }
-
- @Override
- public void setSelected(boolean b) {
- boolean changed = propertySupport.setPropertyBool(PROP_SELECTED, b);
- if (changed) {
- try {
- execToggleAction(b);
- }
- catch (ProcessingException e) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- }
- }
-
- @Override
- public boolean isToggleAction() {
- return m_toggleAction;
- }
-
- @Override
- public void setToggleAction(boolean b) {
- m_toggleAction = b;
- }
-
- @Override
- public boolean isVisible() {
- return propertySupport.getPropertyBool(PROP_VISIBLE);
- }
-
- @Override
- public boolean isThisAndParentsVisible() {
- if (!isVisible()) {
- return false;
- }
- IAction temp = this;
- while (temp instanceof IActionNode) {
- temp = ((IActionNode) temp).getParent();
- if (temp == null) {
- return true;
- }
- if (!temp.isVisible()) {
- return false;
- }
- }
- return true;
- }
-
- @Override
- public void setVisible(boolean b) {
- m_visibleProperty = b;
- setVisibleInternal();
- }
-
- @Override
- public boolean isInheritAccessibility() {
- return m_inheritAccessibility;
- }
-
- @Override
- public void setInheritAccessibility(boolean b) {
- m_inheritAccessibility = b;
- }
-
- /**
- * Access control<br>
- * when false, overrides isEnabled with false
- */
- @Override
- public void setEnabledPermission(Permission p) {
- boolean b;
- if (p != null) {
- b = SERVICES.getService(IAccessControlService.class).checkPermission(p);
- }
- else {
- b = true;
- }
- setEnabledGranted(b);
- }
-
- @Override
- public boolean isEnabledGranted() {
- return m_enabledGranted;
- }
-
- /**
- * Access control<br>
- * when false, overrides isEnabled with false
- */
- @Override
- public void setEnabledGranted(boolean b) {
- m_enabledGranted = b;
- setEnabledInternal();
- }
-
- @Override
- public boolean isEnabledProcessingAction() {
- return m_enabledProcessingAction;
- }
-
- @Override
- public void setEnabledProcessingAction(boolean b) {
- m_enabledProcessingAction = b;
- setEnabledInternal();
- }
-
- private void setEnabledInternal() {
- propertySupport.setPropertyBool(PROP_ENABLED, m_enabledGranted && m_enabledProperty && m_enabledProcessingAction);
- }
-
- @Override
- public void setVisiblePermission(Permission p) {
- boolean b;
- if (p != null) {
- b = SERVICES.getService(IAccessControlService.class).checkPermission(p);
- }
- else {
- b = true;
- }
- setVisibleGranted(b);
- }
-
- @Override
- public boolean isVisibleGranted() {
- return m_visibleGranted;
- }
-
- @Override
- public void setVisibleGranted(boolean b) {
- m_visibleGranted = b;
- setVisibleInternal();
- }
-
- private void setVisibleInternal() {
- propertySupport.setPropertyBool(PROP_VISIBLE, m_visibleGranted && m_visibleProperty);
- }
-
- @Override
- public boolean isSeparator() {
- return propertySupport.getPropertyBool(PROP_SEPARATOR);
- }
-
- @Override
- public void setSeparator(boolean b) {
- propertySupport.setPropertyBool(PROP_SEPARATOR, b);
- }
-
- @Override
- public boolean isSingleSelectionAction() {
- return m_singleSelectionAction;
- }
-
- @Override
- public void setSingleSelectionAction(boolean b) {
- m_singleSelectionAction = b;
- }
-
- @Override
- public boolean isMultiSelectionAction() {
- return m_multiSelectionAction;
- }
-
- @Override
- public void setMultiSelectionAction(boolean b) {
- m_multiSelectionAction = b;
- }
-
- @Override
- public boolean isEmptySpaceAction() {
- return m_emptySpaceAction;
- }
-
- @Override
- public void setEmptySpaceAction(boolean b) {
- m_emptySpaceAction = b;
- }
-
- @Override
- public char getMnemonic() {
- Character c = (Character) propertySupport.getProperty(PROP_MNEMONIC);
- return c != null ? c.charValue() : 0x00;
- }
-
- @Override
- public final void prepareAction() {
- try {
- prepareActionInternal();
- execPrepareAction();
- }
- catch (Throwable t) {
- LOG.warn("Action " + getClass().getName(), t);
- }
- }
-
- @Override
- public IActionUIFacade getUIFacade() {
- return m_uiFacade;
- }
-
- /**
- * do not use this method, it is used internally by subclasses
- */
- protected void prepareActionInternal() throws ProcessingException {
- }
-
- protected class P_UIFacade implements IActionUIFacade {
- @Override
- public void fireActionFromUI() {
- try {
- if (isThisAndParentsEnabled() && isThisAndParentsVisible()) {
- doAction();
- }
- }
- catch (ProcessingException e) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- catch (Throwable e) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Unexpected exception", e));
- }
- }
-
- @Override
- public void setSelectedFromUI(boolean b) {
- setSelected(b);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010,2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.action;
+
+import java.security.Permission;
+
+import org.eclipse.scout.commons.EventListenerList;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.annotations.ConfigOperation;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.beans.AbstractPropertyObserver;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.action.tree.IActionNode;
+import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
+import org.eclipse.scout.rt.shared.services.common.security.IAccessControlService;
+import org.eclipse.scout.service.SERVICES;
+
+public abstract class AbstractAction extends AbstractPropertyObserver implements IAction {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractAction.class);
+
+ private boolean m_initialized;
+ private final EventListenerList m_listenerList = new EventListenerList();
+ private final IActionUIFacade m_uiFacade;
+ private boolean m_inheritAccessibility;
+ // enabled is defined as: enabledGranted && enabledProperty && enabledProcessing
+ private boolean m_enabledGranted;
+ private boolean m_enabledProperty;
+ private boolean m_enabledProcessingAction;
+ private boolean m_visibleProperty;
+ private boolean m_visibleGranted;
+ private boolean m_singleSelectionAction;
+ private boolean m_multiSelectionAction;
+ private boolean m_emptySpaceAction;
+ private boolean m_toggleAction;
+
+ public AbstractAction() {
+ this(true);
+ }
+
+ public AbstractAction(boolean callInitializer) {
+ m_uiFacade = createUIFacade();
+ m_enabledGranted = true;
+ m_enabledProcessingAction = true;
+ m_visibleGranted = true;
+ if (callInitializer) {
+ callInitializer();
+ }
+ }
+
+ protected void callInitializer() {
+ if (!m_initialized) {
+ initConfig();
+ try {
+ execInitAction();
+ }
+ catch (Throwable t) {
+ LOG.warn("Action " + getClass().getName(), t);
+ }
+ m_initialized = true;
+ }
+ }
+
+ /*
+ * Configuration
+ */
+ @ConfigProperty(ConfigProperty.ICON_ID)
+ @Order(30)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredIconId() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.TEXT)
+ @Order(40)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredText() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.TEXT)
+ @Order(50)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredTooltipText() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.STRING)
+ @Order(55)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredKeyStroke() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(10)
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredEnabled() {
+ return true;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(20)
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredVisible() {
+ return true;
+ }
+
+ /**
+ * @return true if {@link #prepareAction()} should in addition consider the
+ * context of the action to decide for visibility and enabled.<br>
+ * For example a menu of a table field with {@link #isInheritAccessibility()}==true is invisible when the
+ * table
+ * field is disabled or invisible
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(22)
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredInheritAccessibility() {
+ return true;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(25)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredToggleAction() {
+ return false;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(60)
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredSingleSelectionAction() {
+ return true;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(70)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredMultiSelectionAction() {
+ return false;
+ }
+
+ /**
+ * @deprecated obsolete, not used anymore
+ */
+ @Deprecated
+ protected boolean getConfiguredNonSelectionAction() {
+ return false;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(90)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredEmptySpaceAction() {
+ return false;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(100)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredSeparator() {
+ return false;
+ }
+
+ @ConfigProperty(ConfigProperty.DOC)
+ @Order(110)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredDoc() {
+ return null;
+ }
+
+ /**
+ * called by constructor<br>
+ * this way a menu can for example add/remove custom child menus
+ */
+ @ConfigOperation
+ @Order(10)
+ protected void execInitAction() throws ProcessingException {
+ }
+
+ /**
+ * called by prepareAction before action is added to list or used<br>
+ * this way a menu can be made dynamically visible / enabled
+ */
+ @ConfigOperation
+ @Order(20)
+ protected void execPrepareAction() throws ProcessingException {
+ }
+
+ /**
+ * called when action is performed
+ */
+ @ConfigOperation
+ @Order(30)
+ protected void execAction() throws ProcessingException {
+ }
+
+ /**
+ * called whenever the selection (of a toggle-action) is changed
+ */
+ @ConfigOperation
+ @Order(31)
+ protected void execToggleAction(boolean selected) throws ProcessingException {
+ }
+
+ protected void initConfig() {
+ setIconId(getConfiguredIconId());
+ setText(getConfiguredText());
+ setTooltipText(getConfiguredTooltipText());
+ setKeyStroke(getConfiguredKeyStroke());
+ setInheritAccessibility(getConfiguredInheritAccessibility());
+ setEnabled(getConfiguredEnabled());
+ setVisible(getConfiguredVisible());
+ setToggleAction(getConfiguredToggleAction());
+ setSingleSelectionAction(getConfiguredSingleSelectionAction());
+ setMultiSelectionAction(getConfiguredMultiSelectionAction());
+ setEmptySpaceAction(getConfiguredEmptySpaceAction());
+ setSeparator(getConfiguredSeparator());
+ if (isSingleSelectionAction() || isMultiSelectionAction() || isEmptySpaceAction()) {
+ // ok
+ }
+ else {
+ // legacy case of implicit new menu
+ setEmptySpaceAction(true);
+ }
+ }
+
+ protected IActionUIFacade createUIFacade() {
+ return new P_UIFacade();
+ }
+
+ @Override
+ public int acceptVisitor(IActionVisitor visitor) {
+ switch (visitor.visit(this)) {
+ case IActionVisitor.CANCEL:
+ return IActionVisitor.CANCEL;
+ case IActionVisitor.CANCEL_SUBTREE:
+ return IActionVisitor.CONTINUE;
+ case IActionVisitor.CONTINUE_BRANCH:
+ return IActionVisitor.CANCEL;
+ default:
+ return IActionVisitor.CONTINUE;
+ }
+ }
+
+ @Override
+ public Object getProperty(String name) {
+ return propertySupport.getProperty(name);
+ }
+
+ @Override
+ public void setProperty(String name, Object value) {
+ propertySupport.setProperty(name, value);
+ }
+
+ @Override
+ public boolean hasProperty(String name) {
+ return propertySupport.hasProperty(name);
+ }
+
+ @Override
+ public String getActionId() {
+ String s = getClass().getName();
+ int i = Math.max(s.lastIndexOf('$'), s.lastIndexOf('.'));
+ s = s.substring(i + 1);
+ return s;
+ }
+
+ @Override
+ public void doAction() throws ProcessingException {
+ if (isEnabled() && isVisible()) {
+ try {
+ setEnabledProcessingAction(false);
+
+ execAction();
+ }
+ finally {
+ setEnabledProcessingAction(true);
+ }
+ }
+ }
+
+ @Override
+ public String getIconId() {
+ return propertySupport.getPropertyString(PROP_ICON_ID);
+ }
+
+ @Override
+ public void setIconId(String iconId) {
+ propertySupport.setPropertyString(PROP_ICON_ID, iconId);
+ }
+
+ @Override
+ public String getText() {
+ return propertySupport.getPropertyString(PROP_TEXT);
+ }
+
+ @Override
+ public void setText(String text) {
+ if (text != null) {
+ propertySupport.setPropertyString(PROP_TEXT, StringUtility.removeMnemonic(text));
+ propertySupport.setProperty(PROP_MNEMONIC, StringUtility.getMnemonic(text));
+ }
+ else {
+ propertySupport.setPropertyString(PROP_TEXT, null);
+ propertySupport.setProperty(PROP_MNEMONIC, (char) 0x0);
+ }
+ }
+
+ @Override
+ public String getKeyStroke() {
+ return propertySupport.getPropertyString(PROP_KEYSTROKE);
+ }
+
+ @Override
+ public void setKeyStroke(String k) {
+ // normalize key stroke format
+ if (k != null) {
+ k = k.toLowerCase();
+ boolean shift = false;
+ boolean ctrl = false;
+ boolean alt = false;
+ String key = null;
+ if (k.endsWith(" ")) {
+ key = " ";
+ }
+ for (String s : k.trim().split("[ -]")) {
+ if (s.equals("shift")) {
+ shift = true;
+ }
+ else if (s.equals("control")) {
+ ctrl = true;
+ }
+ else if (s.equals("ctrl")) {
+ ctrl = true;
+ }
+ else if (s.equals("strg")) {
+ ctrl = true;
+ }
+ else if (s.equals("alt")) {
+ alt = true;
+ }
+ else if (s.equals("alternate")) {
+ alt = true;
+ }
+ else {
+ key = s;
+ }
+ }
+ if (key != null) {
+ k = (shift ? "shift-" : "") + (ctrl ? "control-" : "") + (alt ? "alternate-" : "") + key;
+ }
+ else {
+ k = null;
+ }
+ }
+ propertySupport.setPropertyString(PROP_KEYSTROKE, k);
+ }
+
+ @Override
+ public String getTooltipText() {
+ return propertySupport.getPropertyString(PROP_TOOLTIP_TEXT);
+ }
+
+ @Override
+ public void setTooltipText(String text) {
+ propertySupport.setPropertyString(PROP_TOOLTIP_TEXT, text);
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return propertySupport.getPropertyBool(PROP_ENABLED);
+ }
+
+ @Override
+ public boolean isThisAndParentsEnabled() {
+ if (!isEnabled()) {
+ return false;
+ }
+ IAction temp = this;
+ while (temp instanceof IActionNode) {
+ temp = ((IActionNode) temp).getParent();
+ if (temp == null) {
+ return true;
+ }
+ if (!temp.isEnabled()) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ @Override
+ public void setEnabled(boolean b) {
+ m_enabledProperty = b;
+ setEnabledInternal();
+ }
+
+ @Override
+ public boolean isSelected() {
+ return propertySupport.getPropertyBool(PROP_SELECTED);
+ }
+
+ @Override
+ public void setSelected(boolean b) {
+ boolean changed = propertySupport.setPropertyBool(PROP_SELECTED, b);
+ if (changed) {
+ try {
+ execToggleAction(b);
+ }
+ catch (ProcessingException e) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ }
+ }
+
+ @Override
+ public boolean isToggleAction() {
+ return m_toggleAction;
+ }
+
+ @Override
+ public void setToggleAction(boolean b) {
+ m_toggleAction = b;
+ }
+
+ @Override
+ public boolean isVisible() {
+ return propertySupport.getPropertyBool(PROP_VISIBLE);
+ }
+
+ @Override
+ public boolean isThisAndParentsVisible() {
+ if (!isVisible()) {
+ return false;
+ }
+ IAction temp = this;
+ while (temp instanceof IActionNode) {
+ temp = ((IActionNode) temp).getParent();
+ if (temp == null) {
+ return true;
+ }
+ if (!temp.isVisible()) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ @Override
+ public void setVisible(boolean b) {
+ m_visibleProperty = b;
+ setVisibleInternal();
+ }
+
+ @Override
+ public boolean isInheritAccessibility() {
+ return m_inheritAccessibility;
+ }
+
+ @Override
+ public void setInheritAccessibility(boolean b) {
+ m_inheritAccessibility = b;
+ }
+
+ /**
+ * Access control<br>
+ * when false, overrides isEnabled with false
+ */
+ @Override
+ public void setEnabledPermission(Permission p) {
+ boolean b;
+ if (p != null) {
+ b = SERVICES.getService(IAccessControlService.class).checkPermission(p);
+ }
+ else {
+ b = true;
+ }
+ setEnabledGranted(b);
+ }
+
+ @Override
+ public boolean isEnabledGranted() {
+ return m_enabledGranted;
+ }
+
+ /**
+ * Access control<br>
+ * when false, overrides isEnabled with false
+ */
+ @Override
+ public void setEnabledGranted(boolean b) {
+ m_enabledGranted = b;
+ setEnabledInternal();
+ }
+
+ @Override
+ public boolean isEnabledProcessingAction() {
+ return m_enabledProcessingAction;
+ }
+
+ @Override
+ public void setEnabledProcessingAction(boolean b) {
+ m_enabledProcessingAction = b;
+ setEnabledInternal();
+ }
+
+ private void setEnabledInternal() {
+ propertySupport.setPropertyBool(PROP_ENABLED, m_enabledGranted && m_enabledProperty && m_enabledProcessingAction);
+ }
+
+ @Override
+ public void setVisiblePermission(Permission p) {
+ boolean b;
+ if (p != null) {
+ b = SERVICES.getService(IAccessControlService.class).checkPermission(p);
+ }
+ else {
+ b = true;
+ }
+ setVisibleGranted(b);
+ }
+
+ @Override
+ public boolean isVisibleGranted() {
+ return m_visibleGranted;
+ }
+
+ @Override
+ public void setVisibleGranted(boolean b) {
+ m_visibleGranted = b;
+ setVisibleInternal();
+ }
+
+ private void setVisibleInternal() {
+ propertySupport.setPropertyBool(PROP_VISIBLE, m_visibleGranted && m_visibleProperty);
+ }
+
+ @Override
+ public boolean isSeparator() {
+ return propertySupport.getPropertyBool(PROP_SEPARATOR);
+ }
+
+ @Override
+ public void setSeparator(boolean b) {
+ propertySupport.setPropertyBool(PROP_SEPARATOR, b);
+ }
+
+ @Override
+ public boolean isSingleSelectionAction() {
+ return m_singleSelectionAction;
+ }
+
+ @Override
+ public void setSingleSelectionAction(boolean b) {
+ m_singleSelectionAction = b;
+ }
+
+ @Override
+ public boolean isMultiSelectionAction() {
+ return m_multiSelectionAction;
+ }
+
+ @Override
+ public void setMultiSelectionAction(boolean b) {
+ m_multiSelectionAction = b;
+ }
+
+ @Override
+ public boolean isEmptySpaceAction() {
+ return m_emptySpaceAction;
+ }
+
+ @Override
+ public void setEmptySpaceAction(boolean b) {
+ m_emptySpaceAction = b;
+ }
+
+ @Override
+ public char getMnemonic() {
+ Character c = (Character) propertySupport.getProperty(PROP_MNEMONIC);
+ return c != null ? c.charValue() : 0x00;
+ }
+
+ @Override
+ public final void prepareAction() {
+ try {
+ prepareActionInternal();
+ execPrepareAction();
+ }
+ catch (Throwable t) {
+ LOG.warn("Action " + getClass().getName(), t);
+ }
+ }
+
+ @Override
+ public IActionUIFacade getUIFacade() {
+ return m_uiFacade;
+ }
+
+ /**
+ * do not use this method, it is used internally by subclasses
+ */
+ protected void prepareActionInternal() throws ProcessingException {
+ }
+
+ protected class P_UIFacade implements IActionUIFacade {
+ @Override
+ public void fireActionFromUI() {
+ try {
+ if (isThisAndParentsEnabled() && isThisAndParentsVisible()) {
+ doAction();
+ }
+ }
+ catch (ProcessingException e) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ catch (Throwable e) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Unexpected exception", e));
+ }
+ }
+
+ @Override
+ public void setSelectedFromUI(boolean b) {
+ setSelected(b);
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/ActionFinder.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/ActionFinder.java
index 5f379aec0e..c83e630d72 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/ActionFinder.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/ActionFinder.java
@@ -1,68 +1,68 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.action;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.scout.rt.client.ui.action.tree.IActionNode;
-
-/**
- * search an actions tree to find an action
- */
-public class ActionFinder {
-
- public ActionFinder() {
- }
-
- public <T extends IAction> T findAction(IAction[] actionTree, Class<T> searchType) {
- return findAction(Arrays.asList(actionTree), searchType);
- }
-
- public <T extends IAction> T findAction(List<? extends IAction> actionTree, Class<T> searchType) {
- List<T> filteredActions = findActions(actionTree, searchType, true, true);
- if (filteredActions.size() > 0) {
- return filteredActions.get(0);
- }
- return null;
- }
-
- public <T extends IAction> List<T> findActions(IAction[] actionTree, Class<T> searchType, boolean recursive) {
- return findActions(Arrays.asList(actionTree), searchType, recursive);
- }
-
- public <T extends IAction> List<T> findActions(List<? extends IAction> actionTree, Class<T> searchType, boolean recursive) {
- return findActions(actionTree, searchType, recursive, false);
- }
-
- @SuppressWarnings("unchecked")
- private <T extends IAction> List<T> findActions(List<? extends IAction> actionTree, Class<T> searchType, boolean recursive, boolean oneMatchSearch) {
- List<T> list = new ArrayList<T>();
-
- for (IAction action : actionTree) {
- if (searchType.isAssignableFrom(action.getClass())) {
- list.add((T) action);
- if (oneMatchSearch) {
- return list;
- }
- }
-
- if (recursive && action instanceof IActionNode<?>) {
- List<? extends IAction> childActions = ((IActionNode<?>) action).getChildActions();
- List<T> filteredChildActions = findActions(childActions, searchType, true, oneMatchSearch);
- list.addAll(filteredChildActions);
- }
- }
-
- return list;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.action;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.scout.rt.client.ui.action.tree.IActionNode;
+
+/**
+ * search an actions tree to find an action
+ */
+public class ActionFinder {
+
+ public ActionFinder() {
+ }
+
+ public <T extends IAction> T findAction(IAction[] actionTree, Class<T> searchType) {
+ return findAction(Arrays.asList(actionTree), searchType);
+ }
+
+ public <T extends IAction> T findAction(List<? extends IAction> actionTree, Class<T> searchType) {
+ List<T> filteredActions = findActions(actionTree, searchType, true, true);
+ if (filteredActions.size() > 0) {
+ return filteredActions.get(0);
+ }
+ return null;
+ }
+
+ public <T extends IAction> List<T> findActions(IAction[] actionTree, Class<T> searchType, boolean recursive) {
+ return findActions(Arrays.asList(actionTree), searchType, recursive);
+ }
+
+ public <T extends IAction> List<T> findActions(List<? extends IAction> actionTree, Class<T> searchType, boolean recursive) {
+ return findActions(actionTree, searchType, recursive, false);
+ }
+
+ @SuppressWarnings("unchecked")
+ private <T extends IAction> List<T> findActions(List<? extends IAction> actionTree, Class<T> searchType, boolean recursive, boolean oneMatchSearch) {
+ List<T> list = new ArrayList<T>();
+
+ for (IAction action : actionTree) {
+ if (searchType.isAssignableFrom(action.getClass())) {
+ list.add((T) action);
+ if (oneMatchSearch) {
+ return list;
+ }
+ }
+
+ if (recursive && action instanceof IActionNode<?>) {
+ List<? extends IAction> childActions = ((IActionNode<?>) action).getChildActions();
+ List<T> filteredChildActions = findActions(childActions, searchType, true, oneMatchSearch);
+ list.addAll(filteredChildActions);
+ }
+ }
+
+ return list;
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/IAction.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/IAction.java
index db11e8e3fe..eb3fdaa061 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/IAction.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/IAction.java
@@ -1,218 +1,218 @@
-/*******************************************************************************
- * Copyright (c) 2010,2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.action;
-
-import java.security.Permission;
-
-import org.eclipse.scout.commons.beans.IPropertyObserver;
-import org.eclipse.scout.commons.exception.ProcessingException;
-
-/**
- * Actions have a trigger scope that is a combination of the "locations" {@link #isSingleSelectionAction()},
- * {@link #isMultiSelectionAction()}, {@link #isNonSelectionAction()}, {@link #isEmptySpaceAction()} and the
- * granting {@link #isInheritAccessibility()}
- * <p>
- * Examples:<br>
- * A typical NEW menu on a table that is only visible on the empty space of the table and only when the table field is
- * enabled would have emptySpaceAction=false;
- */
-public interface IAction extends IPropertyObserver {
-
- String PROP_ICON_ID = "iconId";
- String PROP_TEXT = "text";
- String PROP_TOOLTIP_TEXT = "tooltipText";
- String PROP_ENABLED = "enabled";
- String PROP_SELECTED = "selected";
- String PROP_VISIBLE = "visible";
- String PROP_MNEMONIC = "mnemonic";
- String PROP_KEYSTROKE = "keystroke";
- /**
- * property-type: String
- */
- String PROP_SEPARATOR = "separator";
-
- /**
- * called to perform action
- */
- void doAction() throws ProcessingException;
-
- Object getProperty(String name);
-
- /**
- * With this method it's possible to set (custom) properties.
- * <p>
- * <b>Important: </b> Although this method is intended to be used for custom properties, it's actually possible to
- * change main properties as well. Keep in mind that directly changing main properties may result in unexpected
- * behavior, so do it only if you really know what you are doing. Rather use the officially provided api instead. <br>
- * Example for an unexpected behavior: setVisible() does not only set the property PROP_VISIBLE but also executes
- * additional code. This code would NOT be executed by directly setting the property PROP_VISIBLE with setProperty().
- */
- void setProperty(String name, Object value);
-
- boolean hasProperty(String name);
-
- String getActionId();
-
- String getIconId();
-
- void setIconId(String iconId);
-
- boolean isSeparator();
-
- void setSeparator(boolean b);
-
- String getText();
-
- void setText(String text);
-
- /**
- * Key stroke with format lowercase [shift-] [control-] [alternate-] key
- * <p>
- * Examples:
- * <ul>
- * <li>"*"
- * <li>"space"
- * <li>"control-s"
- * <li>"shift-control-t"
- * </ul>
- */
- String getKeyStroke();
-
- void setKeyStroke(String text);
-
- String getTooltipText();
-
- void setTooltipText(String text);
-
- boolean isSelected();
-
- void setSelected(boolean b);
-
- boolean isEnabled();
-
- void setEnabled(boolean b);
-
- boolean isVisible();
-
- void setVisible(boolean b);
-
- /**
- * @return true if {@link #prepareAction()} should in addition consider the
- * context of the action to decide for visibility and enabled.<br>
- * For example a menu of a table field with {@link #isInheritAccessibility()}==true is invisible when the
- * table
- * field is disabled or invisible
- */
- boolean isInheritAccessibility();
-
- /**
- * @see #isInheritAccessibility()
- */
- void setInheritAccessibility(boolean b);
-
- /**
- * Access control<br>
- * when false, enabled property cannot be set to true
- */
- void setEnabledPermission(Permission p);
-
- /**
- * Access control<br>
- * when false, enabled property cannot be set to true
- */
- boolean isEnabledGranted();
-
- /**
- * Access control<br>
- * when false, enabled property cannot be set to true
- */
- void setEnabledGranted(boolean b);
-
- /**
- * Actions set the property to false while in work.
- *
- * @return true if action is not in {@link IAction#doAction()}
- */
- boolean isEnabledProcessingAction();
-
- void setEnabledProcessingAction(boolean b);
-
- /**
- * Access control<br>
- * when false, visible property cannot be set to true
- */
- void setVisiblePermission(Permission p);
-
- /**
- * Access control<br>
- * when false, visible property cannot be set to true
- */
- boolean isVisibleGranted();
-
- /**
- * Access control<br>
- * when false, visible property cannot be set to true
- */
- void setVisibleGranted(boolean b);
-
- /**
- * action is chosen on a single selected item
- */
- boolean isSingleSelectionAction();
-
- void setSingleSelectionAction(boolean b);
-
- /**
- * action is chosen on any of multiple (>=2) selected items
- */
- boolean isMultiSelectionAction();
-
- void setMultiSelectionAction(boolean b);
-
- /**
- * action is chosen on empty space (not on items)
- */
- boolean isEmptySpaceAction();
-
- void setEmptySpaceAction(boolean b);
-
- boolean isToggleAction();
-
- void setToggleAction(boolean b);
-
- char getMnemonic();
-
- /**
- * called before this action is used
- */
- void prepareAction();
-
- /**
- * UI processes
- */
- IActionUIFacade getUIFacade();
-
- int acceptVisitor(IActionVisitor visitor);
-
- /**
- * Looks this action and its every parent are enabled
- *
- * @since 3.8.1
- */
- boolean isThisAndParentsEnabled();
-
- /**
- * Looks this action and its every parent are visible
- *
- * @since 3.8.1
- */
- boolean isThisAndParentsVisible();
-}
+/*******************************************************************************
+ * Copyright (c) 2010,2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.action;
+
+import java.security.Permission;
+
+import org.eclipse.scout.commons.beans.IPropertyObserver;
+import org.eclipse.scout.commons.exception.ProcessingException;
+
+/**
+ * Actions have a trigger scope that is a combination of the "locations" {@link #isSingleSelectionAction()},
+ * {@link #isMultiSelectionAction()}, {@link #isNonSelectionAction()}, {@link #isEmptySpaceAction()} and the
+ * granting {@link #isInheritAccessibility()}
+ * <p>
+ * Examples:<br>
+ * A typical NEW menu on a table that is only visible on the empty space of the table and only when the table field is
+ * enabled would have emptySpaceAction=false;
+ */
+public interface IAction extends IPropertyObserver {
+
+ String PROP_ICON_ID = "iconId";
+ String PROP_TEXT = "text";
+ String PROP_TOOLTIP_TEXT = "tooltipText";
+ String PROP_ENABLED = "enabled";
+ String PROP_SELECTED = "selected";
+ String PROP_VISIBLE = "visible";
+ String PROP_MNEMONIC = "mnemonic";
+ String PROP_KEYSTROKE = "keystroke";
+ /**
+ * property-type: String
+ */
+ String PROP_SEPARATOR = "separator";
+
+ /**
+ * called to perform action
+ */
+ void doAction() throws ProcessingException;
+
+ Object getProperty(String name);
+
+ /**
+ * With this method it's possible to set (custom) properties.
+ * <p>
+ * <b>Important: </b> Although this method is intended to be used for custom properties, it's actually possible to
+ * change main properties as well. Keep in mind that directly changing main properties may result in unexpected
+ * behavior, so do it only if you really know what you are doing. Rather use the officially provided api instead. <br>
+ * Example for an unexpected behavior: setVisible() does not only set the property PROP_VISIBLE but also executes
+ * additional code. This code would NOT be executed by directly setting the property PROP_VISIBLE with setProperty().
+ */
+ void setProperty(String name, Object value);
+
+ boolean hasProperty(String name);
+
+ String getActionId();
+
+ String getIconId();
+
+ void setIconId(String iconId);
+
+ boolean isSeparator();
+
+ void setSeparator(boolean b);
+
+ String getText();
+
+ void setText(String text);
+
+ /**
+ * Key stroke with format lowercase [shift-] [control-] [alternate-] key
+ * <p>
+ * Examples:
+ * <ul>
+ * <li>"*"
+ * <li>"space"
+ * <li>"control-s"
+ * <li>"shift-control-t"
+ * </ul>
+ */
+ String getKeyStroke();
+
+ void setKeyStroke(String text);
+
+ String getTooltipText();
+
+ void setTooltipText(String text);
+
+ boolean isSelected();
+
+ void setSelected(boolean b);
+
+ boolean isEnabled();
+
+ void setEnabled(boolean b);
+
+ boolean isVisible();
+
+ void setVisible(boolean b);
+
+ /**
+ * @return true if {@link #prepareAction()} should in addition consider the
+ * context of the action to decide for visibility and enabled.<br>
+ * For example a menu of a table field with {@link #isInheritAccessibility()}==true is invisible when the
+ * table
+ * field is disabled or invisible
+ */
+ boolean isInheritAccessibility();
+
+ /**
+ * @see #isInheritAccessibility()
+ */
+ void setInheritAccessibility(boolean b);
+
+ /**
+ * Access control<br>
+ * when false, enabled property cannot be set to true
+ */
+ void setEnabledPermission(Permission p);
+
+ /**
+ * Access control<br>
+ * when false, enabled property cannot be set to true
+ */
+ boolean isEnabledGranted();
+
+ /**
+ * Access control<br>
+ * when false, enabled property cannot be set to true
+ */
+ void setEnabledGranted(boolean b);
+
+ /**
+ * Actions set the property to false while in work.
+ *
+ * @return true if action is not in {@link IAction#doAction()}
+ */
+ boolean isEnabledProcessingAction();
+
+ void setEnabledProcessingAction(boolean b);
+
+ /**
+ * Access control<br>
+ * when false, visible property cannot be set to true
+ */
+ void setVisiblePermission(Permission p);
+
+ /**
+ * Access control<br>
+ * when false, visible property cannot be set to true
+ */
+ boolean isVisibleGranted();
+
+ /**
+ * Access control<br>
+ * when false, visible property cannot be set to true
+ */
+ void setVisibleGranted(boolean b);
+
+ /**
+ * action is chosen on a single selected item
+ */
+ boolean isSingleSelectionAction();
+
+ void setSingleSelectionAction(boolean b);
+
+ /**
+ * action is chosen on any of multiple (>=2) selected items
+ */
+ boolean isMultiSelectionAction();
+
+ void setMultiSelectionAction(boolean b);
+
+ /**
+ * action is chosen on empty space (not on items)
+ */
+ boolean isEmptySpaceAction();
+
+ void setEmptySpaceAction(boolean b);
+
+ boolean isToggleAction();
+
+ void setToggleAction(boolean b);
+
+ char getMnemonic();
+
+ /**
+ * called before this action is used
+ */
+ void prepareAction();
+
+ /**
+ * UI processes
+ */
+ IActionUIFacade getUIFacade();
+
+ int acceptVisitor(IActionVisitor visitor);
+
+ /**
+ * Looks this action and its every parent are enabled
+ *
+ * @since 3.8.1
+ */
+ boolean isThisAndParentsEnabled();
+
+ /**
+ * Looks this action and its every parent are visible
+ *
+ * @since 3.8.1
+ */
+ boolean isThisAndParentsVisible();
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/IActionUIFacade.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/IActionUIFacade.java
index 1000e37eb8..13daa5902e 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/IActionUIFacade.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/IActionUIFacade.java
@@ -1,19 +1,19 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.action;
-
-public interface IActionUIFacade {
-
- void setSelectedFromUI(boolean b);
-
- void fireActionFromUI();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.action;
+
+public interface IActionUIFacade {
+
+ void setSelectedFromUI(boolean b);
+
+ void fireActionFromUI();
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/IActionVisitor.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/IActionVisitor.java
index 4f5939361d..22a9fd521e 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/IActionVisitor.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/IActionVisitor.java
@@ -1,34 +1,34 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.action;
-
-public interface IActionVisitor {
-
- /**
- * continues visiting the tree (load children if not loaded)
- */
- int CONTINUE = 1;
- /**
- * continues visiting the tree only on this branch (load children if not
- * loaded)
- */
- int CONTINUE_BRANCH = 2;
- /**
- * stop visiting the tree; used when the mission is completed.
- */
- int CANCEL = 0;
- /**
- * continues visiting with siblings of the parent node, aboard subtree.
- */
- int CANCEL_SUBTREE = 3;
-
- int visit(IAction action);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.action;
+
+public interface IActionVisitor {
+
+ /**
+ * continues visiting the tree (load children if not loaded)
+ */
+ int CONTINUE = 1;
+ /**
+ * continues visiting the tree only on this branch (load children if not
+ * loaded)
+ */
+ int CONTINUE_BRANCH = 2;
+ /**
+ * stop visiting the tree; used when the mission is completed.
+ */
+ int CANCEL = 0;
+ /**
+ * continues visiting with siblings of the parent node, aboard subtree.
+ */
+ int CANCEL_SUBTREE = 3;
+
+ int visit(IAction action);
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/keystroke/AbstractKeyStroke.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/keystroke/AbstractKeyStroke.java
index a359217196..b01fb7cff3 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/keystroke/AbstractKeyStroke.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/keystroke/AbstractKeyStroke.java
@@ -1,36 +1,36 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.action.keystroke;
-
-import org.eclipse.scout.rt.client.ui.action.AbstractAction;
-
-public abstract class AbstractKeyStroke extends AbstractAction implements IKeyStroke {
-
- /**
- * Constructor for configured entities
- */
- public AbstractKeyStroke() {
- this(true);
- }
-
- public AbstractKeyStroke(boolean callInitializer) {
- super(false);
- if (callInitializer) {
- callInitializer();
- }
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName() + "[key=" + getKeyStroke() + "]";
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.action.keystroke;
+
+import org.eclipse.scout.rt.client.ui.action.AbstractAction;
+
+public abstract class AbstractKeyStroke extends AbstractAction implements IKeyStroke {
+
+ /**
+ * Constructor for configured entities
+ */
+ public AbstractKeyStroke() {
+ this(true);
+ }
+
+ public AbstractKeyStroke(boolean callInitializer) {
+ super(false);
+ if (callInitializer) {
+ callInitializer();
+ }
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + "[key=" + getKeyStroke() + "]";
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/keystroke/DefaultFormEnterKeyStroke.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/keystroke/DefaultFormEnterKeyStroke.java
index 7647bbfbba..42f4b94d06 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/keystroke/DefaultFormEnterKeyStroke.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/keystroke/DefaultFormEnterKeyStroke.java
@@ -1,77 +1,77 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.action.keystroke;
-
-import java.util.TreeMap;
-
-import org.eclipse.scout.commons.CompositeLong;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
-
-/**
- * <h3>DefaultFormEnterKeyStroke</h3> ...
- *
- * @since 3.1.12 23.07.2008
- */
-public class DefaultFormEnterKeyStroke extends AbstractKeyStroke {
-
- private final IForm m_form;
-
- public DefaultFormEnterKeyStroke(IForm form) {
- m_form = form;
- }
-
- @Override
- protected String getConfiguredKeyStroke() {
- return "enter";
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- IForm f = m_form;
- while (f != null) {
- TreeMap<CompositeLong, IButton> prioMap = new TreeMap<CompositeLong, IButton>();
- for (IButton b : f.getRootGroupBox().getSystemProcessButtons()) {
- switch (b.getSystemType()) {
- case IButton.SYSTEM_TYPE_OK:
- prioMap.put(new CompositeLong(3, prioMap.size()), b);
- break;
- case IButton.SYSTEM_TYPE_SAVE:
- prioMap.put(new CompositeLong(4, prioMap.size()), b);
- break;
- case IButton.SYSTEM_TYPE_SAVE_WITHOUT_MARKER_CHANGE:
- prioMap.put(new CompositeLong(5, prioMap.size()), b);
- break;
- }
- }
- int visibleCount = 0;
- for (IButton b : prioMap.values()) {
- if (b.isEnabled() && b.isVisible() && b.isEnabledProcessingButton()) {
- b.doClick();
- return;
- }
- else if (b.isVisible()) {
- visibleCount++;
- }
- }
- // here, no action was taken
- // if there was no visible button at all, ONLY THEN try parent form
- if (visibleCount == 0) {
- f = f.getOuterForm();
- }
- else {
- f = null;
- }
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.action.keystroke;
+
+import java.util.TreeMap;
+
+import org.eclipse.scout.commons.CompositeLong;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
+
+/**
+ * <h3>DefaultFormEnterKeyStroke</h3> ...
+ *
+ * @since 3.1.12 23.07.2008
+ */
+public class DefaultFormEnterKeyStroke extends AbstractKeyStroke {
+
+ private final IForm m_form;
+
+ public DefaultFormEnterKeyStroke(IForm form) {
+ m_form = form;
+ }
+
+ @Override
+ protected String getConfiguredKeyStroke() {
+ return "enter";
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ IForm f = m_form;
+ while (f != null) {
+ TreeMap<CompositeLong, IButton> prioMap = new TreeMap<CompositeLong, IButton>();
+ for (IButton b : f.getRootGroupBox().getSystemProcessButtons()) {
+ switch (b.getSystemType()) {
+ case IButton.SYSTEM_TYPE_OK:
+ prioMap.put(new CompositeLong(3, prioMap.size()), b);
+ break;
+ case IButton.SYSTEM_TYPE_SAVE:
+ prioMap.put(new CompositeLong(4, prioMap.size()), b);
+ break;
+ case IButton.SYSTEM_TYPE_SAVE_WITHOUT_MARKER_CHANGE:
+ prioMap.put(new CompositeLong(5, prioMap.size()), b);
+ break;
+ }
+ }
+ int visibleCount = 0;
+ for (IButton b : prioMap.values()) {
+ if (b.isEnabled() && b.isVisible() && b.isEnabledProcessingButton()) {
+ b.doClick();
+ return;
+ }
+ else if (b.isVisible()) {
+ visibleCount++;
+ }
+ }
+ // here, no action was taken
+ // if there was no visible button at all, ONLY THEN try parent form
+ if (visibleCount == 0) {
+ f = f.getOuterForm();
+ }
+ else {
+ f = null;
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/keystroke/DefaultFormEscapeKeyStroke.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/keystroke/DefaultFormEscapeKeyStroke.java
index baf62207d3..3ed82e2fe6 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/keystroke/DefaultFormEscapeKeyStroke.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/keystroke/DefaultFormEscapeKeyStroke.java
@@ -1,75 +1,75 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.action.keystroke;
-
-import java.util.TreeMap;
-
-import org.eclipse.scout.commons.CompositeLong;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
-
-/**
- * <h3>DefaultFormEscapeKeyStroke</h3> ...
- *
- * @since 3.1.12 23.07.2008
- */
-public class DefaultFormEscapeKeyStroke extends AbstractKeyStroke {
-
- private final IForm m_form;
-
- public DefaultFormEscapeKeyStroke(IForm form) {
- m_form = form;
-
- }
-
- @Override
- protected String getConfiguredKeyStroke() {
- return "escape";
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- IForm f = m_form;
- while (f != null) {
- TreeMap<CompositeLong, IButton> prioMap = new TreeMap<CompositeLong, IButton>();
- for (IButton b : f.getRootGroupBox().getSystemProcessButtons()) {
- switch (b.getSystemType()) {
- case IButton.SYSTEM_TYPE_CANCEL:
- prioMap.put(new CompositeLong(2, prioMap.size()), b);
- break;
- case IButton.SYSTEM_TYPE_CLOSE:
- prioMap.put(new CompositeLong(3, prioMap.size()), b);
- break;
- }
- }
- int visibleCount = 0;
- for (IButton b : prioMap.values()) {
- if (b.isEnabled() && b.isVisible() && b.isEnabledProcessingButton()) {
- b.doClick();
- return;
- }
- else if (b.isVisible()) {
- visibleCount++;
- }
- }
- // here, no action was taken
- // if there was no visible button at all, ONLY THEN try parent form
- if (visibleCount == 0) {
- f = f.getOuterForm();
- }
- else {
- f = null;
- }
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.action.keystroke;
+
+import java.util.TreeMap;
+
+import org.eclipse.scout.commons.CompositeLong;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
+
+/**
+ * <h3>DefaultFormEscapeKeyStroke</h3> ...
+ *
+ * @since 3.1.12 23.07.2008
+ */
+public class DefaultFormEscapeKeyStroke extends AbstractKeyStroke {
+
+ private final IForm m_form;
+
+ public DefaultFormEscapeKeyStroke(IForm form) {
+ m_form = form;
+
+ }
+
+ @Override
+ protected String getConfiguredKeyStroke() {
+ return "escape";
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ IForm f = m_form;
+ while (f != null) {
+ TreeMap<CompositeLong, IButton> prioMap = new TreeMap<CompositeLong, IButton>();
+ for (IButton b : f.getRootGroupBox().getSystemProcessButtons()) {
+ switch (b.getSystemType()) {
+ case IButton.SYSTEM_TYPE_CANCEL:
+ prioMap.put(new CompositeLong(2, prioMap.size()), b);
+ break;
+ case IButton.SYSTEM_TYPE_CLOSE:
+ prioMap.put(new CompositeLong(3, prioMap.size()), b);
+ break;
+ }
+ }
+ int visibleCount = 0;
+ for (IButton b : prioMap.values()) {
+ if (b.isEnabled() && b.isVisible() && b.isEnabledProcessingButton()) {
+ b.doClick();
+ return;
+ }
+ else if (b.isVisible()) {
+ visibleCount++;
+ }
+ }
+ // here, no action was taken
+ // if there was no visible button at all, ONLY THEN try parent form
+ if (visibleCount == 0) {
+ f = f.getOuterForm();
+ }
+ else {
+ f = null;
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/keystroke/IKeyStroke.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/keystroke/IKeyStroke.java
index 01d1cfd30d..b265dbe99c 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/keystroke/IKeyStroke.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/keystroke/IKeyStroke.java
@@ -1,23 +1,23 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.action.keystroke;
-
-import org.eclipse.scout.rt.client.ui.action.IAction;
-
-/**
- * A key stroke consists of a action and a key spec<br>
- * The key spec is a key name together with the modifiers shift, control, alt
- *
- * @see IAction#getKeyStroke()
- */
-public interface IKeyStroke extends IAction {
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.action.keystroke;
+
+import org.eclipse.scout.rt.client.ui.action.IAction;
+
+/**
+ * A key stroke consists of a action and a key spec<br>
+ * The key spec is a key name together with the modifiers shift, control, alt
+ *
+ * @see IAction#getKeyStroke()
+ */
+public interface IKeyStroke extends IAction {
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/keystroke/KeyStroke.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/keystroke/KeyStroke.java
index 238b4fb6db..c88ba3b20d 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/keystroke/KeyStroke.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/keystroke/KeyStroke.java
@@ -1,59 +1,59 @@
-/*******************************************************************************
- * Copyright (c) 2010,2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.action.keystroke;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.action.IAction;
-
-public class KeyStroke extends AbstractKeyStroke {
- private IAction m_delegate;
- private String m_id;
-
- public KeyStroke(String keyStroke) {
- this(keyStroke, null);
- }
-
- public KeyStroke(String keyStroke, IAction delegate) {
- super(false);
- m_delegate = delegate;
- // create special id with key as part of name
- if (delegate != null) {
- m_id = delegate.getActionId() + ".keyStroke";
- }
- else {
- m_id = keyStroke;
- }
- callInitializer();
- setKeyStroke(keyStroke);
- }
-
- /*
- * ticket 76552 multiple KeyStrokes map to same action
- */
- @Override
- public String getActionId() {
- return m_id;
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- if (m_delegate != null) {
- m_delegate.prepareAction();
- if (m_delegate.isThisAndParentsVisible() && m_delegate.isThisAndParentsEnabled()) {
- m_delegate.doAction();
- }
- }
- else {
- super.execAction();
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010,2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.action.keystroke;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.action.IAction;
+
+public class KeyStroke extends AbstractKeyStroke {
+ private IAction m_delegate;
+ private String m_id;
+
+ public KeyStroke(String keyStroke) {
+ this(keyStroke, null);
+ }
+
+ public KeyStroke(String keyStroke, IAction delegate) {
+ super(false);
+ m_delegate = delegate;
+ // create special id with key as part of name
+ if (delegate != null) {
+ m_id = delegate.getActionId() + ".keyStroke";
+ }
+ else {
+ m_id = keyStroke;
+ }
+ callInitializer();
+ setKeyStroke(keyStroke);
+ }
+
+ /*
+ * ticket 76552 multiple KeyStrokes map to same action
+ */
+ @Override
+ public String getActionId() {
+ return m_id;
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ if (m_delegate != null) {
+ m_delegate.prepareAction();
+ if (m_delegate.isThisAndParentsVisible() && m_delegate.isThisAndParentsEnabled()) {
+ m_delegate.doAction();
+ }
+ }
+ else {
+ super.execAction();
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/menu/AbstractMenu.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/menu/AbstractMenu.java
index aaf224c8c4..a9f678627a 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/menu/AbstractMenu.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/menu/AbstractMenu.java
@@ -1,25 +1,25 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.action.menu;
-
-import org.eclipse.scout.rt.client.ui.action.tree.AbstractActionNode;
-
-public abstract class AbstractMenu extends AbstractActionNode<IMenu> implements IMenu {
-
- public AbstractMenu() {
- super();
- }
-
- public AbstractMenu(boolean callInitializer) {
- super(callInitializer);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.action.menu;
+
+import org.eclipse.scout.rt.client.ui.action.tree.AbstractActionNode;
+
+public abstract class AbstractMenu extends AbstractActionNode<IMenu> implements IMenu {
+
+ public AbstractMenu() {
+ super();
+ }
+
+ public AbstractMenu(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/menu/IMenu.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/menu/IMenu.java
index d774a78c20..5d228c8e8c 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/menu/IMenu.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/menu/IMenu.java
@@ -1,20 +1,20 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.action.menu;
-
-import org.eclipse.scout.rt.client.ui.action.tree.IActionNode;
-
-/**
- * Interface for menus that normally appear in the gui on the menubar
- */
-public interface IMenu extends IActionNode<IMenu> {
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.action.menu;
+
+import org.eclipse.scout.rt.client.ui.action.tree.IActionNode;
+
+/**
+ * Interface for menus that normally appear in the gui on the menubar
+ */
+public interface IMenu extends IActionNode<IMenu> {
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/menu/MenuSeparator.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/menu/MenuSeparator.java
index c4e942ff55..3c53f5a933 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/menu/MenuSeparator.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/menu/MenuSeparator.java
@@ -1,37 +1,37 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.action.menu;
-
-import org.eclipse.scout.commons.annotations.ConfigOperation;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-
-public class MenuSeparator extends AbstractMenu {
-
- public MenuSeparator() {
- super();
- }
-
- @Override
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @ConfigPropertyValue("true")
- @Order(10)
- protected boolean getConfiguredSeparator() {
- return true;
- }
-
- @Override
- @ConfigOperation
- @Order(10)
- protected void execAction() {
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.action.menu;
+
+import org.eclipse.scout.commons.annotations.ConfigOperation;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+
+public class MenuSeparator extends AbstractMenu {
+
+ public MenuSeparator() {
+ super();
+ }
+
+ @Override
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @ConfigPropertyValue("true")
+ @Order(10)
+ protected boolean getConfiguredSeparator() {
+ return true;
+ }
+
+ @Override
+ @ConfigOperation
+ @Order(10)
+ protected void execAction() {
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/menu/checkbox/AbstractCheckBoxMenu.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/menu/checkbox/AbstractCheckBoxMenu.java
index bae987e5ab..410682320f 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/menu/checkbox/AbstractCheckBoxMenu.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/menu/checkbox/AbstractCheckBoxMenu.java
@@ -1,34 +1,34 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.action.menu.checkbox;
-
-import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
-
-public abstract class AbstractCheckBoxMenu extends AbstractMenu implements ICheckBoxMenu {
-
- public AbstractCheckBoxMenu() {
- super();
- }
-
- public AbstractCheckBoxMenu(boolean callInitializer) {
- super(callInitializer);
- }
-
- /*
- * Runtime
- */
-
- @Override
- protected void execAction() {
- setSelected(!isSelected());
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.action.menu.checkbox;
+
+import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
+
+public abstract class AbstractCheckBoxMenu extends AbstractMenu implements ICheckBoxMenu {
+
+ public AbstractCheckBoxMenu() {
+ super();
+ }
+
+ public AbstractCheckBoxMenu(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ /*
+ * Runtime
+ */
+
+ @Override
+ protected void execAction() {
+ setSelected(!isSelected());
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/menu/checkbox/ICheckBoxMenu.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/menu/checkbox/ICheckBoxMenu.java
index 7bff8542af..653b58f67e 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/menu/checkbox/ICheckBoxMenu.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/menu/checkbox/ICheckBoxMenu.java
@@ -1,17 +1,17 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.action.menu.checkbox;
-
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-
-public interface ICheckBoxMenu extends IMenu {
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.action.menu.checkbox;
+
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+
+public interface ICheckBoxMenu extends IMenu {
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/print/PrintApplicationAction.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/print/PrintApplicationAction.java
index 8a8b9d1f8d..1ef4757ca9 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/print/PrintApplicationAction.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/print/PrintApplicationAction.java
@@ -1,293 +1,293 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.action.print;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.scout.commons.EventListenerList;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.exception.VetoException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.action.AbstractAction;
-import org.eclipse.scout.rt.client.ui.desktop.DesktopEvent;
-import org.eclipse.scout.rt.client.ui.desktop.DesktopListener;
-import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
-import org.eclipse.scout.rt.client.ui.form.FormEvent;
-import org.eclipse.scout.rt.client.ui.form.FormListener;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.client.ui.form.PrintDevice;
-import org.eclipse.scout.rt.client.ui.form.fields.ICompositeField;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox;
-import org.eclipse.scout.rt.client.ui.form.fields.tabbox.ITabBox;
-
-/**
- *
- */
-public class PrintApplicationAction extends AbstractAction {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(PrintApplicationAction.class);
-
- private final IDesktop m_desktop;
- private IFormFilter m_formFilter;
- private final List<ITask> m_taskList;
- private File m_destinationFolder;
- private boolean m_ignoreTabs;
- private final EventListenerList m_printListeners;
-
- public PrintApplicationAction(IDesktop desktop) {
- this(desktop, null);
- }
-
- public PrintApplicationAction(IDesktop desktop, File destinationFolder) {
- m_desktop = desktop;
- m_destinationFolder = destinationFolder;
- m_taskList = new ArrayList<ITask>();
- m_printListeners = new EventListenerList();
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- if (getDesktop() == null) {
- throw new VetoException("desktop is null");
- }
- if (getDestinationFolder() == null) {
- throw new VetoException("destinationFolder is null");
- }
- firePrintEvent(new PrintEvent(PrintApplicationAction.this, PrintEvent.TYPE_PRINT_START));
- if (m_formFilter == null) {
- // accept all filter
- m_formFilter = new IFormFilter() {
- @Override
- public boolean acceptForm(IForm form) {
- return true;
- }
- };
- }
- m_taskList.clear();
- getDestinationFolder().mkdirs();
- getDesktop().addDesktopListener(new P_DesktopListener());
- getDesktop().printDesktop(PrintDevice.File, createPrintParameters(createFile(getDestinationFolder(), "Desktop", "jpg")));
- for (IForm f : getDesktop().getDialogStack()) {
- if (getFormFilter().acceptForm(f)) {
- processForm(f);
- }
- }
- m_taskList.add(new P_EndTask());
- }
-
- private void processForm(IForm form) {
- // set all tabboxes visible
- for (IFormField field : form.getAllFields()) {
- if (field instanceof ITabBox && !field.isVisible()) {
- field.setVisible(true);
- }
- }
- m_taskList.add(new P_PrintFormTaks(form));
- if (!isIgnoreTabs()) {
- // collect all tabbox tabs and print them
- for (IFormField field : form.getAllFields()) {
- if (field instanceof ITabBox && field.isVisible()) {
- final ITabBox tabBox = (ITabBox) field;
- IGroupBox selectedTab = null;
- if (tabBox.isVisible()) {
- selectedTab = tabBox.getSelectedTab();
- }
- if (tabBox.isVisible()) {
- for (final IGroupBox g : tabBox.getGroupBoxes()) {
- if (g != selectedTab) {
- m_taskList.add(new P_PrintFormTaks(form, g));
- }
- }
- }
- // select originally selected tab
- if (selectedTab != null) {
- final IGroupBox selectedTabFinal = selectedTab;
- m_taskList.add(new ITask() {
- @Override
- public void run() throws ProcessingException {
- tabBox.setSelectedTab(selectedTabFinal);
- executeNextTask();
- }
- });
- }
- }
- }
- }
- }
-
- public IDesktop getDesktop() {
- return m_desktop;
- }
-
- public File getDestinationFolder() {
- return m_destinationFolder;
- }
-
- public void setDestinationFolder(File destinationFolder) {
- m_destinationFolder = destinationFolder;
- }
-
- public void setFormFilter(IFormFilter filter) {
- m_formFilter = filter;
- }
-
- public IFormFilter getFormFilter() {
- return m_formFilter;
- }
-
- public void setIgnoreTabs(boolean ignoreTabs) {
- m_ignoreTabs = ignoreTabs;
- }
-
- public boolean isIgnoreTabs() {
- return m_ignoreTabs;
- }
-
- public void addPrintListener(PrintListener listener) {
- m_printListeners.add(PrintListener.class, listener);
- }
-
- public void removePrintListener(PrintListener listener) {
- m_printListeners.remove(PrintListener.class, listener);
- }
-
- private void firePrintEvent(PrintEvent e) {
- for (PrintListener l : m_printListeners.getListeners(PrintListener.class)) {
- l.handlePrintEvent(e);
- }
- }
-
- private void executeNextTask() throws ProcessingException {
- if (m_taskList.isEmpty()) {
- return;
- }
- ITask task = m_taskList.remove(0);
- task.run();
- }
-
- private File createFile(File dir, String filename, String fileExtension) throws ProcessingException {
- IPath path = new Path(dir.getAbsolutePath()).append(filename);
- path = path.addFileExtension(fileExtension);
-
- File file = path.toFile();
- try {
- if (!file.createNewFile()) {
- throw new ProcessingException("Temporary file could not be created");
- }
- }
- catch (IOException e) {
- throw new ProcessingException("Temporary file could not be created", e);
- }
- return file;
- }
-
- private HashMap<String, Object> createPrintParameters(File printFile) {
- HashMap<String, Object> parameters = new HashMap<String, Object>();
- parameters.put("file", printFile);
- parameters.put("contentType", "image/jpg");
- return parameters;
- }
-
- private class P_PrintFormTaks implements ITask {
- private final IForm m_form;
- private final IGroupBox m_groupBox;
-
- private P_PrintFormTaks(IForm form) {
- this(form, null);
- }
-
- private P_PrintFormTaks(IForm form, IGroupBox groupBox) {
- m_form = form;
- m_groupBox = groupBox;
- }
-
- @Override
- public void run() throws ProcessingException {
- StringBuilder filename = new StringBuilder();
- filename.append(getForm().getFormId());
- if (getGroupBox() != null) {
- filename.append("_" + getGroupBox().getFieldId());
- ICompositeField parentField = getGroupBox().getParentField();
- if (parentField instanceof ITabBox) {
- ((ITabBox) parentField).setSelectedTab(getGroupBox());
- }
- }
- getForm().addFormListener(new P_FormListener(getForm()));
- getForm().printForm(PrintDevice.File, createPrintParameters(createFile(getDestinationFolder(), filename.toString(), "jpg")));
- }
-
- public IForm getForm() {
- return m_form;
- }
-
- public IGroupBox getGroupBox() {
- return m_groupBox;
- }
- } // end class P_PrintFormTaks
-
- private class P_EndTask implements ITask {
- @Override
- public void run() throws ProcessingException {
- firePrintEvent(new PrintEvent(PrintApplicationAction.this, PrintEvent.TYPE_PRINT_DONE));
- }
- } // end
-
- private class P_DesktopListener implements DesktopListener {
- @Override
- public void desktopChanged(DesktopEvent e) {
- if (e.getType() == DesktopEvent.TYPE_PRINTED) {
- getDesktop().removeDesktopListener(P_DesktopListener.this);
- try {
- executeNextTask();
- }
- catch (ProcessingException e1) {
- LOG.warn("could not execute task.", e);
- }
- }
- }
- }
-
- private class P_FormListener implements FormListener {
- private final IForm m_form;
-
- public P_FormListener(IForm form) {
- m_form = form;
- }
-
- @Override
- public void formChanged(FormEvent e) throws ProcessingException {
- if (e.getType() == FormEvent.TYPE_PRINTED) {
- getForm().removeFormListener(P_FormListener.this);
- executeNextTask();
- }
- }
-
- public IForm getForm() {
- return m_form;
- }
- } // end class P_FormListener
-
- private static interface ITask {
- void run() throws ProcessingException;
- }
-
- public static interface IFormFilter {
- public boolean acceptForm(IForm form);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.action.print;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.scout.commons.EventListenerList;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.exception.VetoException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.action.AbstractAction;
+import org.eclipse.scout.rt.client.ui.desktop.DesktopEvent;
+import org.eclipse.scout.rt.client.ui.desktop.DesktopListener;
+import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
+import org.eclipse.scout.rt.client.ui.form.FormEvent;
+import org.eclipse.scout.rt.client.ui.form.FormListener;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.client.ui.form.PrintDevice;
+import org.eclipse.scout.rt.client.ui.form.fields.ICompositeField;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox;
+import org.eclipse.scout.rt.client.ui.form.fields.tabbox.ITabBox;
+
+/**
+ *
+ */
+public class PrintApplicationAction extends AbstractAction {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(PrintApplicationAction.class);
+
+ private final IDesktop m_desktop;
+ private IFormFilter m_formFilter;
+ private final List<ITask> m_taskList;
+ private File m_destinationFolder;
+ private boolean m_ignoreTabs;
+ private final EventListenerList m_printListeners;
+
+ public PrintApplicationAction(IDesktop desktop) {
+ this(desktop, null);
+ }
+
+ public PrintApplicationAction(IDesktop desktop, File destinationFolder) {
+ m_desktop = desktop;
+ m_destinationFolder = destinationFolder;
+ m_taskList = new ArrayList<ITask>();
+ m_printListeners = new EventListenerList();
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ if (getDesktop() == null) {
+ throw new VetoException("desktop is null");
+ }
+ if (getDestinationFolder() == null) {
+ throw new VetoException("destinationFolder is null");
+ }
+ firePrintEvent(new PrintEvent(PrintApplicationAction.this, PrintEvent.TYPE_PRINT_START));
+ if (m_formFilter == null) {
+ // accept all filter
+ m_formFilter = new IFormFilter() {
+ @Override
+ public boolean acceptForm(IForm form) {
+ return true;
+ }
+ };
+ }
+ m_taskList.clear();
+ getDestinationFolder().mkdirs();
+ getDesktop().addDesktopListener(new P_DesktopListener());
+ getDesktop().printDesktop(PrintDevice.File, createPrintParameters(createFile(getDestinationFolder(), "Desktop", "jpg")));
+ for (IForm f : getDesktop().getDialogStack()) {
+ if (getFormFilter().acceptForm(f)) {
+ processForm(f);
+ }
+ }
+ m_taskList.add(new P_EndTask());
+ }
+
+ private void processForm(IForm form) {
+ // set all tabboxes visible
+ for (IFormField field : form.getAllFields()) {
+ if (field instanceof ITabBox && !field.isVisible()) {
+ field.setVisible(true);
+ }
+ }
+ m_taskList.add(new P_PrintFormTaks(form));
+ if (!isIgnoreTabs()) {
+ // collect all tabbox tabs and print them
+ for (IFormField field : form.getAllFields()) {
+ if (field instanceof ITabBox && field.isVisible()) {
+ final ITabBox tabBox = (ITabBox) field;
+ IGroupBox selectedTab = null;
+ if (tabBox.isVisible()) {
+ selectedTab = tabBox.getSelectedTab();
+ }
+ if (tabBox.isVisible()) {
+ for (final IGroupBox g : tabBox.getGroupBoxes()) {
+ if (g != selectedTab) {
+ m_taskList.add(new P_PrintFormTaks(form, g));
+ }
+ }
+ }
+ // select originally selected tab
+ if (selectedTab != null) {
+ final IGroupBox selectedTabFinal = selectedTab;
+ m_taskList.add(new ITask() {
+ @Override
+ public void run() throws ProcessingException {
+ tabBox.setSelectedTab(selectedTabFinal);
+ executeNextTask();
+ }
+ });
+ }
+ }
+ }
+ }
+ }
+
+ public IDesktop getDesktop() {
+ return m_desktop;
+ }
+
+ public File getDestinationFolder() {
+ return m_destinationFolder;
+ }
+
+ public void setDestinationFolder(File destinationFolder) {
+ m_destinationFolder = destinationFolder;
+ }
+
+ public void setFormFilter(IFormFilter filter) {
+ m_formFilter = filter;
+ }
+
+ public IFormFilter getFormFilter() {
+ return m_formFilter;
+ }
+
+ public void setIgnoreTabs(boolean ignoreTabs) {
+ m_ignoreTabs = ignoreTabs;
+ }
+
+ public boolean isIgnoreTabs() {
+ return m_ignoreTabs;
+ }
+
+ public void addPrintListener(PrintListener listener) {
+ m_printListeners.add(PrintListener.class, listener);
+ }
+
+ public void removePrintListener(PrintListener listener) {
+ m_printListeners.remove(PrintListener.class, listener);
+ }
+
+ private void firePrintEvent(PrintEvent e) {
+ for (PrintListener l : m_printListeners.getListeners(PrintListener.class)) {
+ l.handlePrintEvent(e);
+ }
+ }
+
+ private void executeNextTask() throws ProcessingException {
+ if (m_taskList.isEmpty()) {
+ return;
+ }
+ ITask task = m_taskList.remove(0);
+ task.run();
+ }
+
+ private File createFile(File dir, String filename, String fileExtension) throws ProcessingException {
+ IPath path = new Path(dir.getAbsolutePath()).append(filename);
+ path = path.addFileExtension(fileExtension);
+
+ File file = path.toFile();
+ try {
+ if (!file.createNewFile()) {
+ throw new ProcessingException("Temporary file could not be created");
+ }
+ }
+ catch (IOException e) {
+ throw new ProcessingException("Temporary file could not be created", e);
+ }
+ return file;
+ }
+
+ private HashMap<String, Object> createPrintParameters(File printFile) {
+ HashMap<String, Object> parameters = new HashMap<String, Object>();
+ parameters.put("file", printFile);
+ parameters.put("contentType", "image/jpg");
+ return parameters;
+ }
+
+ private class P_PrintFormTaks implements ITask {
+ private final IForm m_form;
+ private final IGroupBox m_groupBox;
+
+ private P_PrintFormTaks(IForm form) {
+ this(form, null);
+ }
+
+ private P_PrintFormTaks(IForm form, IGroupBox groupBox) {
+ m_form = form;
+ m_groupBox = groupBox;
+ }
+
+ @Override
+ public void run() throws ProcessingException {
+ StringBuilder filename = new StringBuilder();
+ filename.append(getForm().getFormId());
+ if (getGroupBox() != null) {
+ filename.append("_" + getGroupBox().getFieldId());
+ ICompositeField parentField = getGroupBox().getParentField();
+ if (parentField instanceof ITabBox) {
+ ((ITabBox) parentField).setSelectedTab(getGroupBox());
+ }
+ }
+ getForm().addFormListener(new P_FormListener(getForm()));
+ getForm().printForm(PrintDevice.File, createPrintParameters(createFile(getDestinationFolder(), filename.toString(), "jpg")));
+ }
+
+ public IForm getForm() {
+ return m_form;
+ }
+
+ public IGroupBox getGroupBox() {
+ return m_groupBox;
+ }
+ } // end class P_PrintFormTaks
+
+ private class P_EndTask implements ITask {
+ @Override
+ public void run() throws ProcessingException {
+ firePrintEvent(new PrintEvent(PrintApplicationAction.this, PrintEvent.TYPE_PRINT_DONE));
+ }
+ } // end
+
+ private class P_DesktopListener implements DesktopListener {
+ @Override
+ public void desktopChanged(DesktopEvent e) {
+ if (e.getType() == DesktopEvent.TYPE_PRINTED) {
+ getDesktop().removeDesktopListener(P_DesktopListener.this);
+ try {
+ executeNextTask();
+ }
+ catch (ProcessingException e1) {
+ LOG.warn("could not execute task.", e);
+ }
+ }
+ }
+ }
+
+ private class P_FormListener implements FormListener {
+ private final IForm m_form;
+
+ public P_FormListener(IForm form) {
+ m_form = form;
+ }
+
+ @Override
+ public void formChanged(FormEvent e) throws ProcessingException {
+ if (e.getType() == FormEvent.TYPE_PRINTED) {
+ getForm().removeFormListener(P_FormListener.this);
+ executeNextTask();
+ }
+ }
+
+ public IForm getForm() {
+ return m_form;
+ }
+ } // end class P_FormListener
+
+ private static interface ITask {
+ void run() throws ProcessingException;
+ }
+
+ public static interface IFormFilter {
+ public boolean acceptForm(IForm form);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/print/PrintEvent.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/print/PrintEvent.java
index a12665350a..8eef781268 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/print/PrintEvent.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/print/PrintEvent.java
@@ -1,36 +1,36 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.action.print;
-
-import java.util.EventObject;
-
-/**
- *
- */
-public class PrintEvent extends EventObject {
-
- private static final long serialVersionUID = 1L;
-
- public static final int TYPE_PRINT_START = 100;
- public static final int TYPE_PRINT_DONE = 200;
-
- private final int m_type;
-
- public PrintEvent(Object source, int type) {
- super(source);
- m_type = type;
- }
-
- public int getType() {
- return m_type;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.action.print;
+
+import java.util.EventObject;
+
+/**
+ *
+ */
+public class PrintEvent extends EventObject {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final int TYPE_PRINT_START = 100;
+ public static final int TYPE_PRINT_DONE = 200;
+
+ private final int m_type;
+
+ public PrintEvent(Object source, int type) {
+ super(source);
+ m_type = type;
+ }
+
+ public int getType() {
+ return m_type;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/print/PrintFormsAction.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/print/PrintFormsAction.java
index de232a6266..ed6c40af67 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/print/PrintFormsAction.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/print/PrintFormsAction.java
@@ -1,281 +1,281 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.action.print;
-
-import java.io.File;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.exception.VetoException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.commons.runtime.BundleBrowser;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.ui.action.AbstractAction;
-import org.eclipse.scout.rt.client.ui.form.AbstractForm;
-import org.eclipse.scout.rt.client.ui.form.AbstractFormHandler;
-import org.eclipse.scout.rt.client.ui.form.FormEvent;
-import org.eclipse.scout.rt.client.ui.form.FormListener;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.client.ui.form.IFormHandler;
-import org.eclipse.scout.rt.client.ui.form.PrintDevice;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox;
-import org.eclipse.scout.rt.client.ui.form.fields.tabbox.ITabBox;
-import org.osgi.framework.Bundle;
-
-/**
- * Create a screenshot of one or more form into a destination folder. For every {@link ITabBox} a separate image is
- * created for every tab. Default format is
- * image/jpg.
- * <ul>
- * <li>Naming for forms is &lt;form fully qualified class name&gt;.jpg</li>
- * <li>If a form type has multiple instances, the name is &lt;form fully qualified class name&gt;_&lt;index&gt;.jpg</li>
- * <li>Naming for tab boxes is &lt;form fully qualified class name&gt;_&lt;index&gt;_&lt;tabbox simple class
- * name&gt;_&lt;tab simple class name&gt;.jpg</li>
- * </ul>
- */
-public class PrintFormsAction extends AbstractAction {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(PrintFormsAction.class);
-
- private Class<?>[] m_formTypes;
- private String m_contentType;
- private File m_destinationFolder;
- // output files
- private final List<File> m_printedFiles;
- // printing index
- private int m_formImageIndex;
- // printing statistics
- private int m_formCount;
- private int m_imageCount;
- private int m_errorCount;
-
- public PrintFormsAction() {
- super();
- m_contentType = "image/jpg";
- m_printedFiles = new ArrayList<File>();
- }
-
- public Class<?>[] getFormTypes() {
- return m_formTypes;
- }
-
- public void setFormTypes(Class<?>[] formTypes) {
- m_formTypes = formTypes;
- }
-
- /**
- * Convenience setter to choose all existing form types in a specific plugin
- */
- public void setFormTypesByBundle(Bundle bundle) {
- BundleBrowser b = new BundleBrowser(bundle.getSymbolicName(), bundle.getSymbolicName());
- ArrayList<Class<?>> list = new ArrayList<Class<?>>();
- for (String name : b.getClasses(false, true)) {
- try {
- Class<?> c = bundle.loadClass(name);
- if (IForm.class.isAssignableFrom(c)) {
- list.add(c);
- }
- }
- catch (ClassNotFoundException e) {
- // nop
- }
- }
- m_formTypes = list.toArray(new Class[list.size()]);
- }
-
- public String getContentType() {
- return m_contentType;
- }
-
- public void setContentType(String s) {
- m_contentType = s;
- }
-
- public File getDestinationFolder() {
- return m_destinationFolder;
- }
-
- public void setDestinationFolder(File folder) {
- m_destinationFolder = folder;
- }
-
- public File[] getPrintedFiles() {
- return m_printedFiles.toArray(new File[m_printedFiles.size()]);
- }
-
- @SuppressWarnings("unchecked")
- @Override
- protected void execAction() throws ProcessingException {
- if (getFormTypes() == null) {
- throw new VetoException("formTypes array is null");
- }
- if (getDestinationFolder() == null) {
- throw new VetoException("destinationFolder is null");
- }
- m_printedFiles.clear();
- m_formCount = 0;
- m_imageCount = 0;
- m_errorCount = 0;
- for (Class<?> c : getFormTypes()) {
- try {
- m_formImageIndex = 0;
- if (IForm.class.isAssignableFrom(c)) {
- for (IForm f : createFormInstancesFor((Class<? extends IForm>) c)) {
- m_formCount++;
- processForm(f);
- }
- }
- }
- catch (Throwable t) {
- m_errorCount++;
- LOG.error(c.getName(), t);
- }
- }
- }
-
- protected List<IForm> createFormInstancesFor(Class<? extends IForm> formClass) throws Throwable {
- ArrayList<IForm> list = new ArrayList<IForm>();
- list.add(formClass.newInstance());
- return list;
- }
-
- protected void processForm(final IForm f) throws Throwable {
- f.setModal(false);
- f.setAutoAddRemoveOnDesktop(true);
- f.setDisplayHint(IForm.DISPLAY_HINT_DIALOG);
- f.setDisplayViewId(null);
- AbstractFormHandler handler = new AbstractFormHandler() {
- };
- Method m = AbstractForm.class.getDeclaredMethod("startInternal", IFormHandler.class);
- m.setAccessible(true);
- m.invoke(f, handler);
- final P_FormListener listener = new P_FormListener();
- f.addFormListener(listener);
-
- new ClientSyncJob("print " + f.getClass().getSimpleName(), ClientSyncJob.getCurrentSession()) {
- @Override
- protected void runVoid(IProgressMonitor monitor) throws Throwable {
- printForm(f, null);
- // set all tabboxes visible
- for (IFormField field : f.getAllFields()) {
- if (field instanceof ITabBox && !field.isVisible()) {
- field.setVisible(true);
- }
- }
- // collect all tabbox tabs and print them
- for (IFormField field : f.getAllFields()) {
- if (field instanceof ITabBox && field.isVisible()) {
- final ITabBox tabBox = (ITabBox) field;
- IGroupBox selectedTab = null;
- if (tabBox.isVisible()) {
- selectedTab = tabBox.getSelectedTab();
- }
- if (tabBox.isVisible()) {
- for (final IGroupBox g : tabBox.getGroupBoxes()) {
- if (g != selectedTab) {
- listener.addRunnable(new Runnable() {
- @Override
- public void run() {
- tabBox.setSelectedTab(g);
- printFormField(f, tabBox, "_" + g.getClass().getSimpleName());
- }
- });
- }
- }
- }
- }
- }
- // add form close runnable
- listener.addRunnable(new Runnable() {
- @Override
- public void run() {
- try {
- f.doClose();
- }
- catch (ProcessingException e) {
- LOG.error("could not close form '" + f.getClass().getSimpleName() + "'", e);
- }
- }
- });
-
- }
- }.schedule();
- f.waitFor();
- }
-
- private class P_FormListener implements FormListener {
- List<Runnable> m_runnables = Collections.synchronizedList(new ArrayList<Runnable>());
-
- @Override
- public void formChanged(FormEvent e) throws ProcessingException {
- if (e.getType() == FormEvent.TYPE_PRINTED) {
- m_printedFiles.add(e.getPrintedFile());
- if (!m_runnables.isEmpty()) {
- Runnable r = m_runnables.remove(0);
- r.run();
- }
- }
- }
-
- public void addRunnable(Runnable r) {
- m_runnables.add(r);
- }
- }
-
- protected int getFormImageIndex() {
- return m_formImageIndex;
- }
-
- protected void nextFormImageIndex() {
- m_formImageIndex++;
- }
-
- public int getResultFormCount() {
- return m_formCount;
- }
-
- public int getResultImageCount() {
- return m_imageCount;
- }
-
- public int getResultErrorCount() {
- return m_errorCount;
- }
-
- protected void printForm(IForm f, String contextName) {
- String name = f.getClass().getName() + (getFormImageIndex() > 0 ? "_" + getFormImageIndex() : "");
- String ext = getContentType().substring(getContentType().lastIndexOf("/") + 1);
- HashMap<String, Object> parameters = new HashMap<String, Object>();
- parameters.put("file", new File(getDestinationFolder(), name + (contextName != null ? contextName : "") + "." + ext));
- parameters.put("contentType", getContentType());
- f.printForm(PrintDevice.File, parameters);
- nextFormImageIndex();
- m_imageCount++;
- }
-
- protected void printFormField(IForm form, IFormField f, String contextName) {
- String name = form.getClass().getName() + "_" + getFormImageIndex() + "_" + f.getClass().getSimpleName();
- String ext = getContentType().substring(getContentType().lastIndexOf("/") + 1);
- HashMap<String, Object> parameters = new HashMap<String, Object>();
- parameters.put("file", new File(getDestinationFolder(), name + (contextName != null ? contextName : "") + "." + ext));
- parameters.put("contentType", getContentType());
- form.printField(f, PrintDevice.File, parameters);
- nextFormImageIndex();
- m_imageCount++;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.action.print;
+
+import java.io.File;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.exception.VetoException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.commons.runtime.BundleBrowser;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.ui.action.AbstractAction;
+import org.eclipse.scout.rt.client.ui.form.AbstractForm;
+import org.eclipse.scout.rt.client.ui.form.AbstractFormHandler;
+import org.eclipse.scout.rt.client.ui.form.FormEvent;
+import org.eclipse.scout.rt.client.ui.form.FormListener;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.client.ui.form.IFormHandler;
+import org.eclipse.scout.rt.client.ui.form.PrintDevice;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox;
+import org.eclipse.scout.rt.client.ui.form.fields.tabbox.ITabBox;
+import org.osgi.framework.Bundle;
+
+/**
+ * Create a screenshot of one or more form into a destination folder. For every {@link ITabBox} a separate image is
+ * created for every tab. Default format is
+ * image/jpg.
+ * <ul>
+ * <li>Naming for forms is &lt;form fully qualified class name&gt;.jpg</li>
+ * <li>If a form type has multiple instances, the name is &lt;form fully qualified class name&gt;_&lt;index&gt;.jpg</li>
+ * <li>Naming for tab boxes is &lt;form fully qualified class name&gt;_&lt;index&gt;_&lt;tabbox simple class
+ * name&gt;_&lt;tab simple class name&gt;.jpg</li>
+ * </ul>
+ */
+public class PrintFormsAction extends AbstractAction {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(PrintFormsAction.class);
+
+ private Class<?>[] m_formTypes;
+ private String m_contentType;
+ private File m_destinationFolder;
+ // output files
+ private final List<File> m_printedFiles;
+ // printing index
+ private int m_formImageIndex;
+ // printing statistics
+ private int m_formCount;
+ private int m_imageCount;
+ private int m_errorCount;
+
+ public PrintFormsAction() {
+ super();
+ m_contentType = "image/jpg";
+ m_printedFiles = new ArrayList<File>();
+ }
+
+ public Class<?>[] getFormTypes() {
+ return m_formTypes;
+ }
+
+ public void setFormTypes(Class<?>[] formTypes) {
+ m_formTypes = formTypes;
+ }
+
+ /**
+ * Convenience setter to choose all existing form types in a specific plugin
+ */
+ public void setFormTypesByBundle(Bundle bundle) {
+ BundleBrowser b = new BundleBrowser(bundle.getSymbolicName(), bundle.getSymbolicName());
+ ArrayList<Class<?>> list = new ArrayList<Class<?>>();
+ for (String name : b.getClasses(false, true)) {
+ try {
+ Class<?> c = bundle.loadClass(name);
+ if (IForm.class.isAssignableFrom(c)) {
+ list.add(c);
+ }
+ }
+ catch (ClassNotFoundException e) {
+ // nop
+ }
+ }
+ m_formTypes = list.toArray(new Class[list.size()]);
+ }
+
+ public String getContentType() {
+ return m_contentType;
+ }
+
+ public void setContentType(String s) {
+ m_contentType = s;
+ }
+
+ public File getDestinationFolder() {
+ return m_destinationFolder;
+ }
+
+ public void setDestinationFolder(File folder) {
+ m_destinationFolder = folder;
+ }
+
+ public File[] getPrintedFiles() {
+ return m_printedFiles.toArray(new File[m_printedFiles.size()]);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ protected void execAction() throws ProcessingException {
+ if (getFormTypes() == null) {
+ throw new VetoException("formTypes array is null");
+ }
+ if (getDestinationFolder() == null) {
+ throw new VetoException("destinationFolder is null");
+ }
+ m_printedFiles.clear();
+ m_formCount = 0;
+ m_imageCount = 0;
+ m_errorCount = 0;
+ for (Class<?> c : getFormTypes()) {
+ try {
+ m_formImageIndex = 0;
+ if (IForm.class.isAssignableFrom(c)) {
+ for (IForm f : createFormInstancesFor((Class<? extends IForm>) c)) {
+ m_formCount++;
+ processForm(f);
+ }
+ }
+ }
+ catch (Throwable t) {
+ m_errorCount++;
+ LOG.error(c.getName(), t);
+ }
+ }
+ }
+
+ protected List<IForm> createFormInstancesFor(Class<? extends IForm> formClass) throws Throwable {
+ ArrayList<IForm> list = new ArrayList<IForm>();
+ list.add(formClass.newInstance());
+ return list;
+ }
+
+ protected void processForm(final IForm f) throws Throwable {
+ f.setModal(false);
+ f.setAutoAddRemoveOnDesktop(true);
+ f.setDisplayHint(IForm.DISPLAY_HINT_DIALOG);
+ f.setDisplayViewId(null);
+ AbstractFormHandler handler = new AbstractFormHandler() {
+ };
+ Method m = AbstractForm.class.getDeclaredMethod("startInternal", IFormHandler.class);
+ m.setAccessible(true);
+ m.invoke(f, handler);
+ final P_FormListener listener = new P_FormListener();
+ f.addFormListener(listener);
+
+ new ClientSyncJob("print " + f.getClass().getSimpleName(), ClientSyncJob.getCurrentSession()) {
+ @Override
+ protected void runVoid(IProgressMonitor monitor) throws Throwable {
+ printForm(f, null);
+ // set all tabboxes visible
+ for (IFormField field : f.getAllFields()) {
+ if (field instanceof ITabBox && !field.isVisible()) {
+ field.setVisible(true);
+ }
+ }
+ // collect all tabbox tabs and print them
+ for (IFormField field : f.getAllFields()) {
+ if (field instanceof ITabBox && field.isVisible()) {
+ final ITabBox tabBox = (ITabBox) field;
+ IGroupBox selectedTab = null;
+ if (tabBox.isVisible()) {
+ selectedTab = tabBox.getSelectedTab();
+ }
+ if (tabBox.isVisible()) {
+ for (final IGroupBox g : tabBox.getGroupBoxes()) {
+ if (g != selectedTab) {
+ listener.addRunnable(new Runnable() {
+ @Override
+ public void run() {
+ tabBox.setSelectedTab(g);
+ printFormField(f, tabBox, "_" + g.getClass().getSimpleName());
+ }
+ });
+ }
+ }
+ }
+ }
+ }
+ // add form close runnable
+ listener.addRunnable(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ f.doClose();
+ }
+ catch (ProcessingException e) {
+ LOG.error("could not close form '" + f.getClass().getSimpleName() + "'", e);
+ }
+ }
+ });
+
+ }
+ }.schedule();
+ f.waitFor();
+ }
+
+ private class P_FormListener implements FormListener {
+ List<Runnable> m_runnables = Collections.synchronizedList(new ArrayList<Runnable>());
+
+ @Override
+ public void formChanged(FormEvent e) throws ProcessingException {
+ if (e.getType() == FormEvent.TYPE_PRINTED) {
+ m_printedFiles.add(e.getPrintedFile());
+ if (!m_runnables.isEmpty()) {
+ Runnable r = m_runnables.remove(0);
+ r.run();
+ }
+ }
+ }
+
+ public void addRunnable(Runnable r) {
+ m_runnables.add(r);
+ }
+ }
+
+ protected int getFormImageIndex() {
+ return m_formImageIndex;
+ }
+
+ protected void nextFormImageIndex() {
+ m_formImageIndex++;
+ }
+
+ public int getResultFormCount() {
+ return m_formCount;
+ }
+
+ public int getResultImageCount() {
+ return m_imageCount;
+ }
+
+ public int getResultErrorCount() {
+ return m_errorCount;
+ }
+
+ protected void printForm(IForm f, String contextName) {
+ String name = f.getClass().getName() + (getFormImageIndex() > 0 ? "_" + getFormImageIndex() : "");
+ String ext = getContentType().substring(getContentType().lastIndexOf("/") + 1);
+ HashMap<String, Object> parameters = new HashMap<String, Object>();
+ parameters.put("file", new File(getDestinationFolder(), name + (contextName != null ? contextName : "") + "." + ext));
+ parameters.put("contentType", getContentType());
+ f.printForm(PrintDevice.File, parameters);
+ nextFormImageIndex();
+ m_imageCount++;
+ }
+
+ protected void printFormField(IForm form, IFormField f, String contextName) {
+ String name = form.getClass().getName() + "_" + getFormImageIndex() + "_" + f.getClass().getSimpleName();
+ String ext = getContentType().substring(getContentType().lastIndexOf("/") + 1);
+ HashMap<String, Object> parameters = new HashMap<String, Object>();
+ parameters.put("file", new File(getDestinationFolder(), name + (contextName != null ? contextName : "") + "." + ext));
+ parameters.put("contentType", getContentType());
+ form.printField(f, PrintDevice.File, parameters);
+ nextFormImageIndex();
+ m_imageCount++;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/print/PrintListener.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/print/PrintListener.java
index 86dd665289..545b1b3dc5 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/print/PrintListener.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/print/PrintListener.java
@@ -1,21 +1,21 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.action.print;
-
-import java.util.EventListener;
-
-/**
- *
- */
-public interface PrintListener extends EventListener {
-
- void handlePrintEvent(PrintEvent e);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.action.print;
+
+import java.util.EventListener;
+
+/**
+ *
+ */
+public interface PrintListener extends EventListener {
+
+ void handlePrintEvent(PrintEvent e);
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/tool/AbstractToolButton.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/tool/AbstractToolButton.java
index 4295b029b0..fcb80d2158 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/tool/AbstractToolButton.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/tool/AbstractToolButton.java
@@ -1,24 +1,24 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.action.tool;
-
-import org.eclipse.scout.rt.client.ui.action.AbstractAction;
-
-public abstract class AbstractToolButton extends AbstractAction implements IToolButton {
-
- public AbstractToolButton() {
- super();
- }
-
- public AbstractToolButton(boolean callInitializer) {
- super(callInitializer);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.action.tool;
+
+import org.eclipse.scout.rt.client.ui.action.AbstractAction;
+
+public abstract class AbstractToolButton extends AbstractAction implements IToolButton {
+
+ public AbstractToolButton() {
+ super();
+ }
+
+ public AbstractToolButton(boolean callInitializer) {
+ super(callInitializer);
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/tool/IToolButton.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/tool/IToolButton.java
index 2400bc8222..3d1f3d16c1 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/tool/IToolButton.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/tool/IToolButton.java
@@ -1,21 +1,21 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.action.tool;
-
-import org.eclipse.scout.rt.client.ui.action.IAction;
-
-/**
- * Interface for action with menus that normally appear in the gui on the toolbar
- */
-
-public interface IToolButton extends IAction {
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.action.tool;
+
+import org.eclipse.scout.rt.client.ui.action.IAction;
+
+/**
+ * Interface for action with menus that normally appear in the gui on the toolbar
+ */
+
+public interface IToolButton extends IAction {
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/tool/ToolButtonSeparator.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/tool/ToolButtonSeparator.java
index 899fd39b71..8c7a8b1ed1 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/tool/ToolButtonSeparator.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/tool/ToolButtonSeparator.java
@@ -1,37 +1,37 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.action.tool;
-
-import org.eclipse.scout.commons.annotations.ConfigOperation;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-
-public class ToolButtonSeparator extends AbstractToolButton {
-
- public ToolButtonSeparator() {
- super();
- }
-
- @Override
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @ConfigPropertyValue("true")
- @Order(10)
- protected boolean getConfiguredSeparator() {
- return true;
- }
-
- @Override
- @ConfigOperation
- @Order(10)
- protected void execAction() {
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.action.tool;
+
+import org.eclipse.scout.commons.annotations.ConfigOperation;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+
+public class ToolButtonSeparator extends AbstractToolButton {
+
+ public ToolButtonSeparator() {
+ super();
+ }
+
+ @Override
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @ConfigPropertyValue("true")
+ @Order(10)
+ protected boolean getConfiguredSeparator() {
+ return true;
+ }
+
+ @Override
+ @ConfigOperation
+ @Order(10)
+ protected void execAction() {
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/tree/AbstractActionNode.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/tree/AbstractActionNode.java
index 30643c0284..884ad4617e 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/tree/AbstractActionNode.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/tree/AbstractActionNode.java
@@ -1,160 +1,160 @@
-/*******************************************************************************
- * Copyright (c) 2010,2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.action.tree;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.scout.commons.ConfigurationUtility;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.action.AbstractAction;
-import org.eclipse.scout.rt.client.ui.action.IAction;
-import org.eclipse.scout.rt.client.ui.action.IActionVisitor;
-
-public abstract class AbstractActionNode<T extends IActionNode> extends AbstractAction implements IActionNode<T> {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractActionNode.class);
- private T m_parent;
-
- public AbstractActionNode() {
- super();
- }
-
- public AbstractActionNode(boolean callInitializer) {
- super(callInitializer);
- }
-
- /*
- * Configuration
- */
- private Class<? extends IActionNode>[] getConfiguredChildActions() {
- Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
- return ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, IActionNode.class);
- }
-
- @Override
- @SuppressWarnings("unchecked")
- protected void initConfig() {
- super.initConfig();
- // menus
- ArrayList<T> nodeList = new ArrayList<T>();
- Class<? extends IActionNode>[] ma = getConfiguredChildActions();
- for (int i = 0; i < ma.length; i++) {
- try {
- IActionNode node = ConfigurationUtility.newInnerInstance(this, ma[i]);
- node.setParent(this);
- nodeList.add((T) node);
- }
- catch (Exception e) {
- LOG.warn(null, e);
- }
- }
-
- try {
- injectActionNodesInternal(nodeList);
- }
- catch (Exception e) {
- LOG.error("error occured while dynamically contribute action nodes.", e);
- }
-
- setChildActions(nodeList);
- }
-
- /**
- * Override this internal method only in order to make use of dynamic menus<br>
- * Used to manage menu list and add/remove menus
- *
- * @param fieldList
- * live and mutable list of configured menus, not yet initialized
- * and added to composite field
- */
- protected void injectActionNodesInternal(List<T> nodeList) {
- }
-
- /*
- * Runtime
- */
- @Override
- public T getParent() {
- return m_parent;
- }
-
- @Override
- public void setParent(T parent) {
- m_parent = parent;
- }
-
- /**
- * override to prepare child menus as well
- *
- * @throws ProcessingException
- */
- @Override
- protected void prepareActionInternal() throws ProcessingException {
- super.prepareActionInternal();
- // child menus
- for (T node : getChildActionsInternal()) {
- node.prepareAction();
- }
- }
-
- @SuppressWarnings("unchecked")
- private List<T> getChildActionsInternal() {
- return (List<T>) propertySupport.getProperty(PROP_CHILD_ACTIONS);
- }
-
- @Override
- public boolean hasChildActions() {
- return getChildActionsInternal().size() > 0;
- }
-
- @Override
- public int getChildActionCount() {
- return getChildActionsInternal().size();
- }
-
- @Override
- public List<T> getChildActions() {
- return new ArrayList<T>(getChildActionsInternal());
- }
-
- @Override
- public void setChildActions(List<T> newList) {
- propertySupport.setProperty(PROP_CHILD_ACTIONS, new ArrayList<T>(newList));
- }
-
- @Override
- public int acceptVisitor(IActionVisitor visitor) {
- switch (visitor.visit(this)) {
- case IActionVisitor.CANCEL:
- return IActionVisitor.CANCEL;
- case IActionVisitor.CANCEL_SUBTREE:
- return IActionVisitor.CONTINUE;
- case IActionVisitor.CONTINUE_BRANCH:
- visitChildren(visitor);
- return IActionVisitor.CANCEL;
- default:
- return visitChildren(visitor);
- }
- }
-
- private int visitChildren(IActionVisitor visitor) {
- for (IAction t : getChildActions()) {
- switch (t.acceptVisitor(visitor)) {
- case IActionVisitor.CANCEL:
- return IActionVisitor.CANCEL;
- }
- }
- return IActionVisitor.CONTINUE;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010,2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.action.tree;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.scout.commons.ConfigurationUtility;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.action.AbstractAction;
+import org.eclipse.scout.rt.client.ui.action.IAction;
+import org.eclipse.scout.rt.client.ui.action.IActionVisitor;
+
+public abstract class AbstractActionNode<T extends IActionNode> extends AbstractAction implements IActionNode<T> {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractActionNode.class);
+ private T m_parent;
+
+ public AbstractActionNode() {
+ super();
+ }
+
+ public AbstractActionNode(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ /*
+ * Configuration
+ */
+ private Class<? extends IActionNode>[] getConfiguredChildActions() {
+ Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
+ return ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, IActionNode.class);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ protected void initConfig() {
+ super.initConfig();
+ // menus
+ ArrayList<T> nodeList = new ArrayList<T>();
+ Class<? extends IActionNode>[] ma = getConfiguredChildActions();
+ for (int i = 0; i < ma.length; i++) {
+ try {
+ IActionNode node = ConfigurationUtility.newInnerInstance(this, ma[i]);
+ node.setParent(this);
+ nodeList.add((T) node);
+ }
+ catch (Exception e) {
+ LOG.warn(null, e);
+ }
+ }
+
+ try {
+ injectActionNodesInternal(nodeList);
+ }
+ catch (Exception e) {
+ LOG.error("error occured while dynamically contribute action nodes.", e);
+ }
+
+ setChildActions(nodeList);
+ }
+
+ /**
+ * Override this internal method only in order to make use of dynamic menus<br>
+ * Used to manage menu list and add/remove menus
+ *
+ * @param fieldList
+ * live and mutable list of configured menus, not yet initialized
+ * and added to composite field
+ */
+ protected void injectActionNodesInternal(List<T> nodeList) {
+ }
+
+ /*
+ * Runtime
+ */
+ @Override
+ public T getParent() {
+ return m_parent;
+ }
+
+ @Override
+ public void setParent(T parent) {
+ m_parent = parent;
+ }
+
+ /**
+ * override to prepare child menus as well
+ *
+ * @throws ProcessingException
+ */
+ @Override
+ protected void prepareActionInternal() throws ProcessingException {
+ super.prepareActionInternal();
+ // child menus
+ for (T node : getChildActionsInternal()) {
+ node.prepareAction();
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private List<T> getChildActionsInternal() {
+ return (List<T>) propertySupport.getProperty(PROP_CHILD_ACTIONS);
+ }
+
+ @Override
+ public boolean hasChildActions() {
+ return getChildActionsInternal().size() > 0;
+ }
+
+ @Override
+ public int getChildActionCount() {
+ return getChildActionsInternal().size();
+ }
+
+ @Override
+ public List<T> getChildActions() {
+ return new ArrayList<T>(getChildActionsInternal());
+ }
+
+ @Override
+ public void setChildActions(List<T> newList) {
+ propertySupport.setProperty(PROP_CHILD_ACTIONS, new ArrayList<T>(newList));
+ }
+
+ @Override
+ public int acceptVisitor(IActionVisitor visitor) {
+ switch (visitor.visit(this)) {
+ case IActionVisitor.CANCEL:
+ return IActionVisitor.CANCEL;
+ case IActionVisitor.CANCEL_SUBTREE:
+ return IActionVisitor.CONTINUE;
+ case IActionVisitor.CONTINUE_BRANCH:
+ visitChildren(visitor);
+ return IActionVisitor.CANCEL;
+ default:
+ return visitChildren(visitor);
+ }
+ }
+
+ private int visitChildren(IActionVisitor visitor) {
+ for (IAction t : getChildActions()) {
+ switch (t.acceptVisitor(visitor)) {
+ case IActionVisitor.CANCEL:
+ return IActionVisitor.CANCEL;
+ }
+ }
+ return IActionVisitor.CONTINUE;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/tree/IActionNode.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/tree/IActionNode.java
index 1c53588ea0..b221ecabb6 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/tree/IActionNode.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/tree/IActionNode.java
@@ -1,52 +1,52 @@
-/*******************************************************************************
- * Copyright (c) 2010,2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.action.tree;
-
-import java.util.List;
-
-import org.eclipse.scout.rt.client.ui.action.IAction;
-
-public interface IActionNode<T extends IActionNode> extends IAction {
-
- /**
- * property-type: {@link List}<T>
- */
- String PROP_CHILD_ACTIONS = "childActions";
-
- /*
- * Runtime
- */
- /**
- * @since 3.8.1
- */
- T getParent();
-
- /**
- * @since 3.8.1
- */
- void setParent(T parent);
-
- /**
- * @return if child has actions
- */
- boolean hasChildActions();
-
- int getChildActionCount();
-
- /**
- * @return a copy of the list of actions<br>
- * When changing this list, use {@link #setChildActions(List)} to
- * apply them to the model
- */
- List<T> getChildActions();
-
- void setChildActions(List<T> newList);
-}
+/*******************************************************************************
+ * Copyright (c) 2010,2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.action.tree;
+
+import java.util.List;
+
+import org.eclipse.scout.rt.client.ui.action.IAction;
+
+public interface IActionNode<T extends IActionNode> extends IAction {
+
+ /**
+ * property-type: {@link List}<T>
+ */
+ String PROP_CHILD_ACTIONS = "childActions";
+
+ /*
+ * Runtime
+ */
+ /**
+ * @since 3.8.1
+ */
+ T getParent();
+
+ /**
+ * @since 3.8.1
+ */
+ void setParent(T parent);
+
+ /**
+ * @return if child has actions
+ */
+ boolean hasChildActions();
+
+ int getChildActionCount();
+
+ /**
+ * @return a copy of the list of actions<br>
+ * When changing this list, use {@link #setChildActions(List)} to
+ * apply them to the model
+ */
+ List<T> getChildActions();
+
+ void setChildActions(List<T> newList);
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/view/AbstractViewButton.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/view/AbstractViewButton.java
index 0fc5d94c18..f554e2d8f3 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/view/AbstractViewButton.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/view/AbstractViewButton.java
@@ -1,24 +1,24 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.action.view;
-
-import org.eclipse.scout.rt.client.ui.action.AbstractAction;
-
-public abstract class AbstractViewButton extends AbstractAction implements IViewButton {
-
- public AbstractViewButton() {
- super();
- }
-
- public AbstractViewButton(boolean callInitializer) {
- super(callInitializer);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.action.view;
+
+import org.eclipse.scout.rt.client.ui.action.AbstractAction;
+
+public abstract class AbstractViewButton extends AbstractAction implements IViewButton {
+
+ public AbstractViewButton() {
+ super();
+ }
+
+ public AbstractViewButton(boolean callInitializer) {
+ super(callInitializer);
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/view/IViewButton.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/view/IViewButton.java
index d523e5596e..7ce6859902 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/view/IViewButton.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/action/view/IViewButton.java
@@ -1,20 +1,20 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.action.view;
-
-import org.eclipse.scout.rt.client.ui.action.IAction;
-
-/**
- * Interface for buttons that represent a view or an outline, normally displayed as tabs
- */
-public interface IViewButton extends IAction {
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.action.view;
+
+import org.eclipse.scout.rt.client.ui.action.IAction;
+
+/**
+ * Interface for buttons that represent a view or an outline, normally displayed as tabs
+ */
+public interface IViewButton extends IAction {
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/ActivityCell.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/ActivityCell.java
index 2ef5e978a5..970569e00d 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/ActivityCell.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/ActivityCell.java
@@ -1,331 +1,331 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.activitymap;
-
-import java.util.Date;
-
-import org.eclipse.scout.rt.shared.data.basic.MemoryOptimizedObject;
-
-/**
- * Representation of an activity containing an ActivityData
- */
-public class ActivityCell extends MemoryOptimizedObject {
- private static final long serialVersionUID = 1L;
-
- public static final int OBSERVER_BIT = 0;
-
- /**
- * long
- */
- public static final int RESOURCE_ID_BIT = 1;
-
- /**
- * long
- */
- public static final int ACTIVITY_ID_BIT = 2;
-
- /**
- * Date
- */
- public static final int BEGIN_TIME_BIT = 3;
-
- /**
- * Date
- */
- public static final int END_TIME_BIT = 4;
-
- /**
- * String
- */
- public static final int TEXT_BIT = 5;
-
- /**
- * String
- */
- public static final int BACKGROUND_COLOR_BIT = 6;
-
- /**
- * String
- */
- public static final int FOREGROUND_COLOR_BIT = 7;
-
- /**
- * float
- */
- public static final int MAJOR_VALUE_BIT = 8;
-
- /**
- * String
- */
- public static final int MAJOR_COLOR_BIT = 9;
-
- /**
- * float
- */
- public static final int MINOR_VALUE_BIT = 10;
-
- /**
- * String
- */
- public static final int MINOR_COLOR_BIT = 11;
-
- /**
- * int
- */
- public static final int DURATION_MINUTES_BIT = 12;
-
- /**
- * String
- */
- public static final int TOOLTIP_TEXT_BIT = 13;
-
- /**
- * String
- */
- public static final int ICON_ID_BIT = 14;
- /**
- * String
- */
- public static final int CUSTOM_DATA = 15;
-
- private ActivityCell() {
- }
-
- public ActivityCell(long resourceId, long activityId) {
- setValueInternal(RESOURCE_ID_BIT, resourceId);
- setValueInternal(ACTIVITY_ID_BIT, activityId);
- }
-
- /**
- * @param resourceId
- * @param activityId
- * @param startTime
- * @param endTime
- * @param text
- * @param tooltipText
- * @param iconId
- * @param majorValue
- * @param minorValue
- */
- public ActivityCell(long resourceId, long activityId, Date startTime, Date endTime, String text, String tooltipText, String iconId, float majorValue, float minorValue) {
- setValueInternal(RESOURCE_ID_BIT, resourceId);
- setValueInternal(ACTIVITY_ID_BIT, activityId);
- setValueInternal(BEGIN_TIME_BIT, startTime);
- setValueInternal(END_TIME_BIT, endTime);
- setValueInternal(TEXT_BIT, text);
- setValueInternal(TOOLTIP_TEXT_BIT, tooltipText);
- setValueInternal(ICON_ID_BIT, iconId);
- setValueInternal(MAJOR_VALUE_BIT, majorValue);
- setValueInternal(MINOR_VALUE_BIT, minorValue);
- }
-
- /**
- * @param resourceId
- * @param activityId
- * @param startTime
- * @param endTime
- * @param text
- * @param tooltipText
- * @param iconId
- * @param majorValue
- * @param minorValue
- */
- public ActivityCell(Object[] row) {
- if (row == null || row.length < 2) {
- throw new IllegalArgumentException("row must not be null or shorted than 2 elements");
- }
- if (row[0] == null) {
- throw new IllegalArgumentException("resourceId must not be null");
- }
- if (row[1] == null) {
- throw new IllegalArgumentException("itemid must not be null");
- }
- for (int i = 0; i < row.length; i++) {
- if (row[i] != null) {
- switch (i) {
- case 0: {
- setValueInternal(RESOURCE_ID_BIT, ((Number) row[i]).longValue());
- break;
- }
- case 1: {
- setValueInternal(ACTIVITY_ID_BIT, ((Number) row[i]).longValue());
- break;
- }
- case 2: {
- setValueInternal(BEGIN_TIME_BIT, row[i]);
- break;
- }
- case 3: {
- setValueInternal(END_TIME_BIT, row[i]);
- break;
- }
- case 4: {
- setText((String) row[i]);
- break;
- }
- case 5: {
- setTooltipText((String) row[i]);
- break;
- }
- case 6: {
- setIconId((String) row[i]);
- break;
- }
- case 7: {
- setMajorValue(((Number) row[i]).floatValue());
- break;
- }
- case 8: {
- setMinorValue(((Number) row[i]).floatValue());
- break;
- }
- }
- }
- }
- }
-
- public IActivityCellObserver getObserver() {
- return (IActivityCellObserver) getValueInternal(OBSERVER_BIT);
- }
-
- public void setObserver(IActivityCellObserver observer) {
- setValueInternal(OBSERVER_BIT, observer);
- }
-
- @Override
- protected boolean setValueInternal(int bitPos, Object o) {
- boolean b = super.setValueInternal(bitPos, o);
- if (getObserver() != null) {
- if (bitPos != OBSERVER_BIT) {
- getObserver().cellChanged(this, bitPos);
- }
- }
- return b;
- }
-
- public long getActivityId() {
- Object o = getValueInternal(ACTIVITY_ID_BIT);
- return o != null ? (Long) o : null;
- }
-
- public long getResourceId() {
- Object o = getValueInternal(RESOURCE_ID_BIT);
- return o != null ? (Long) o : null;
- }
-
- public Date getBeginTime() {
- return (Date) getValueInternal(BEGIN_TIME_BIT);
- }
-
- public void setBeginTime(Date d) {
- setValueInternal(BEGIN_TIME_BIT, d);
- }
-
- public Date getEndTime() {
- return (Date) getValueInternal(END_TIME_BIT);
- }
-
- public void setEndTime(Date d) {
- setValueInternal(END_TIME_BIT, d);
- }
-
- public int getDurationMinutes() {
- Integer o = (Integer) getValueInternal(DURATION_MINUTES_BIT);
- return o != null ? o : 0;
- }
-
- public float getMajorValue() {
- Float o = (Float) getValueInternal(MAJOR_VALUE_BIT);
- return o != null ? o : 0;
- }
-
- public void setMajorValue(float f) {
- setValueInternal(MAJOR_VALUE_BIT, f);
- }
-
- public float getMinorValue() {
- Float o = (Float) getValueInternal(MINOR_VALUE_BIT);
- return o != null ? o : 0;
- }
-
- public void setMinorValue(float f) {
- setValueInternal(MINOR_VALUE_BIT, f);
- }
-
- public String getMajorColor() {
- return (String) getValueInternal(MAJOR_COLOR_BIT);
- }
-
- public void setMajorColor(String s) {
- setValueInternal(MAJOR_COLOR_BIT, s);
- }
-
- public String getMinorColor() {
- return (String) getValueInternal(MINOR_COLOR_BIT);
- }
-
- public void setMinorColor(String s) {
- setValueInternal(MINOR_COLOR_BIT, s);
- }
-
- public String getTooltipText() {
- return (String) getValueInternal(TOOLTIP_TEXT_BIT);
- }
-
- public void setTooltipText(String s) {
- setValueInternal(TOOLTIP_TEXT_BIT, s);
- }
-
- public String getText() {
- return (String) getValueInternal(TEXT_BIT);
- }
-
- public void setText(String s) {
- setValueInternal(TEXT_BIT, s);
- }
-
- public String getIconId() {
- return (String) getValueInternal(ICON_ID_BIT);
- }
-
- public void setIconId(String icon) {
- setValueInternal(ICON_ID_BIT, icon);
- }
-
- public String getBackgroundColor() {
- return (String) getValueInternal(BACKGROUND_COLOR_BIT);
- }
-
- public void setBackgroundColor(String c) {
- setValueInternal(BACKGROUND_COLOR_BIT, c);
- }
-
- public String getForegroundColor() {
- return (String) getValueInternal(FOREGROUND_COLOR_BIT);
- }
-
- public void setForegroundColor(String c) {
- setValueInternal(FOREGROUND_COLOR_BIT, c);
- }
-
- public Object getCustomData() {
- return getValueInternal(CUSTOM_DATA);
- }
-
- public void setCustomData(Object o) {
- setValueInternal(CUSTOM_DATA, o);
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName() + "[" + getText() + "]";
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.activitymap;
+
+import java.util.Date;
+
+import org.eclipse.scout.rt.shared.data.basic.MemoryOptimizedObject;
+
+/**
+ * Representation of an activity containing an ActivityData
+ */
+public class ActivityCell extends MemoryOptimizedObject {
+ private static final long serialVersionUID = 1L;
+
+ public static final int OBSERVER_BIT = 0;
+
+ /**
+ * long
+ */
+ public static final int RESOURCE_ID_BIT = 1;
+
+ /**
+ * long
+ */
+ public static final int ACTIVITY_ID_BIT = 2;
+
+ /**
+ * Date
+ */
+ public static final int BEGIN_TIME_BIT = 3;
+
+ /**
+ * Date
+ */
+ public static final int END_TIME_BIT = 4;
+
+ /**
+ * String
+ */
+ public static final int TEXT_BIT = 5;
+
+ /**
+ * String
+ */
+ public static final int BACKGROUND_COLOR_BIT = 6;
+
+ /**
+ * String
+ */
+ public static final int FOREGROUND_COLOR_BIT = 7;
+
+ /**
+ * float
+ */
+ public static final int MAJOR_VALUE_BIT = 8;
+
+ /**
+ * String
+ */
+ public static final int MAJOR_COLOR_BIT = 9;
+
+ /**
+ * float
+ */
+ public static final int MINOR_VALUE_BIT = 10;
+
+ /**
+ * String
+ */
+ public static final int MINOR_COLOR_BIT = 11;
+
+ /**
+ * int
+ */
+ public static final int DURATION_MINUTES_BIT = 12;
+
+ /**
+ * String
+ */
+ public static final int TOOLTIP_TEXT_BIT = 13;
+
+ /**
+ * String
+ */
+ public static final int ICON_ID_BIT = 14;
+ /**
+ * String
+ */
+ public static final int CUSTOM_DATA = 15;
+
+ private ActivityCell() {
+ }
+
+ public ActivityCell(long resourceId, long activityId) {
+ setValueInternal(RESOURCE_ID_BIT, resourceId);
+ setValueInternal(ACTIVITY_ID_BIT, activityId);
+ }
+
+ /**
+ * @param resourceId
+ * @param activityId
+ * @param startTime
+ * @param endTime
+ * @param text
+ * @param tooltipText
+ * @param iconId
+ * @param majorValue
+ * @param minorValue
+ */
+ public ActivityCell(long resourceId, long activityId, Date startTime, Date endTime, String text, String tooltipText, String iconId, float majorValue, float minorValue) {
+ setValueInternal(RESOURCE_ID_BIT, resourceId);
+ setValueInternal(ACTIVITY_ID_BIT, activityId);
+ setValueInternal(BEGIN_TIME_BIT, startTime);
+ setValueInternal(END_TIME_BIT, endTime);
+ setValueInternal(TEXT_BIT, text);
+ setValueInternal(TOOLTIP_TEXT_BIT, tooltipText);
+ setValueInternal(ICON_ID_BIT, iconId);
+ setValueInternal(MAJOR_VALUE_BIT, majorValue);
+ setValueInternal(MINOR_VALUE_BIT, minorValue);
+ }
+
+ /**
+ * @param resourceId
+ * @param activityId
+ * @param startTime
+ * @param endTime
+ * @param text
+ * @param tooltipText
+ * @param iconId
+ * @param majorValue
+ * @param minorValue
+ */
+ public ActivityCell(Object[] row) {
+ if (row == null || row.length < 2) {
+ throw new IllegalArgumentException("row must not be null or shorted than 2 elements");
+ }
+ if (row[0] == null) {
+ throw new IllegalArgumentException("resourceId must not be null");
+ }
+ if (row[1] == null) {
+ throw new IllegalArgumentException("itemid must not be null");
+ }
+ for (int i = 0; i < row.length; i++) {
+ if (row[i] != null) {
+ switch (i) {
+ case 0: {
+ setValueInternal(RESOURCE_ID_BIT, ((Number) row[i]).longValue());
+ break;
+ }
+ case 1: {
+ setValueInternal(ACTIVITY_ID_BIT, ((Number) row[i]).longValue());
+ break;
+ }
+ case 2: {
+ setValueInternal(BEGIN_TIME_BIT, row[i]);
+ break;
+ }
+ case 3: {
+ setValueInternal(END_TIME_BIT, row[i]);
+ break;
+ }
+ case 4: {
+ setText((String) row[i]);
+ break;
+ }
+ case 5: {
+ setTooltipText((String) row[i]);
+ break;
+ }
+ case 6: {
+ setIconId((String) row[i]);
+ break;
+ }
+ case 7: {
+ setMajorValue(((Number) row[i]).floatValue());
+ break;
+ }
+ case 8: {
+ setMinorValue(((Number) row[i]).floatValue());
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ public IActivityCellObserver getObserver() {
+ return (IActivityCellObserver) getValueInternal(OBSERVER_BIT);
+ }
+
+ public void setObserver(IActivityCellObserver observer) {
+ setValueInternal(OBSERVER_BIT, observer);
+ }
+
+ @Override
+ protected boolean setValueInternal(int bitPos, Object o) {
+ boolean b = super.setValueInternal(bitPos, o);
+ if (getObserver() != null) {
+ if (bitPos != OBSERVER_BIT) {
+ getObserver().cellChanged(this, bitPos);
+ }
+ }
+ return b;
+ }
+
+ public long getActivityId() {
+ Object o = getValueInternal(ACTIVITY_ID_BIT);
+ return o != null ? (Long) o : null;
+ }
+
+ public long getResourceId() {
+ Object o = getValueInternal(RESOURCE_ID_BIT);
+ return o != null ? (Long) o : null;
+ }
+
+ public Date getBeginTime() {
+ return (Date) getValueInternal(BEGIN_TIME_BIT);
+ }
+
+ public void setBeginTime(Date d) {
+ setValueInternal(BEGIN_TIME_BIT, d);
+ }
+
+ public Date getEndTime() {
+ return (Date) getValueInternal(END_TIME_BIT);
+ }
+
+ public void setEndTime(Date d) {
+ setValueInternal(END_TIME_BIT, d);
+ }
+
+ public int getDurationMinutes() {
+ Integer o = (Integer) getValueInternal(DURATION_MINUTES_BIT);
+ return o != null ? o : 0;
+ }
+
+ public float getMajorValue() {
+ Float o = (Float) getValueInternal(MAJOR_VALUE_BIT);
+ return o != null ? o : 0;
+ }
+
+ public void setMajorValue(float f) {
+ setValueInternal(MAJOR_VALUE_BIT, f);
+ }
+
+ public float getMinorValue() {
+ Float o = (Float) getValueInternal(MINOR_VALUE_BIT);
+ return o != null ? o : 0;
+ }
+
+ public void setMinorValue(float f) {
+ setValueInternal(MINOR_VALUE_BIT, f);
+ }
+
+ public String getMajorColor() {
+ return (String) getValueInternal(MAJOR_COLOR_BIT);
+ }
+
+ public void setMajorColor(String s) {
+ setValueInternal(MAJOR_COLOR_BIT, s);
+ }
+
+ public String getMinorColor() {
+ return (String) getValueInternal(MINOR_COLOR_BIT);
+ }
+
+ public void setMinorColor(String s) {
+ setValueInternal(MINOR_COLOR_BIT, s);
+ }
+
+ public String getTooltipText() {
+ return (String) getValueInternal(TOOLTIP_TEXT_BIT);
+ }
+
+ public void setTooltipText(String s) {
+ setValueInternal(TOOLTIP_TEXT_BIT, s);
+ }
+
+ public String getText() {
+ return (String) getValueInternal(TEXT_BIT);
+ }
+
+ public void setText(String s) {
+ setValueInternal(TEXT_BIT, s);
+ }
+
+ public String getIconId() {
+ return (String) getValueInternal(ICON_ID_BIT);
+ }
+
+ public void setIconId(String icon) {
+ setValueInternal(ICON_ID_BIT, icon);
+ }
+
+ public String getBackgroundColor() {
+ return (String) getValueInternal(BACKGROUND_COLOR_BIT);
+ }
+
+ public void setBackgroundColor(String c) {
+ setValueInternal(BACKGROUND_COLOR_BIT, c);
+ }
+
+ public String getForegroundColor() {
+ return (String) getValueInternal(FOREGROUND_COLOR_BIT);
+ }
+
+ public void setForegroundColor(String c) {
+ setValueInternal(FOREGROUND_COLOR_BIT, c);
+ }
+
+ public Object getCustomData() {
+ return getValueInternal(CUSTOM_DATA);
+ }
+
+ public void setCustomData(Object o) {
+ setValueInternal(CUSTOM_DATA, o);
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + "[" + getText() + "]";
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/ActivityMapEvent.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/ActivityMapEvent.java
index 9f6d1345f6..9a36436962 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/ActivityMapEvent.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/ActivityMapEvent.java
@@ -1,222 +1,222 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.activitymap;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-
-@SuppressWarnings("serial")
-public class ActivityMapEvent extends java.util.EventObject {
- /**
- * Some activities have been added valid properties: activities,
- * firstActivity, lastActivity
- */
- public static final int TYPE_ACTIVITIES_INSERTED = 100;
- /**
- * Some activities have been updated valid properties: activities,
- * firstActivity, lastActivity
- */
- public static final int TYPE_ACTIVITIES_UPDATED = 101;
- /**
- * Some activities have been deleted valid properties: activities,
- * firstActivity, lastActivity
- */
- public static final int TYPE_ACTIVITIES_DELETED = 102;
- /**
- * A row has been activated valid properties: activities, firstActivity,
- * lastActivity, resourceId, column
- */
- public static final int TYPE_CELL_ACTION = 104;
- /**
- * All activities have been deleted valid properties: activities,
- * firstActivity, lastActivity
- */
- public static final int TYPE_ALL_ACTIVITIES_DELETED = 105;
- /**
- * Broadcast request to add actions for activities popup valid properties:
- * activities, firstActivity, lastActivity add actions to: popupActions
- */
- public static final int TYPE_EDIT_ACTIVITY_POPUP = 700;
- /**
- * Broadcast request to add actions for "new" popup valid properties: add
- * actions to: popupActions
- */
- public static final int TYPE_NEW_ACTIVITY_POPUP = 701;
-
- private int m_type;
- private ActivityCell[] m_activities = new ActivityCell[0];
- private List<IMenu> m_popupMenus;
- private long m_resourceId;
- private MinorTimeColumn m_column;
-
- public ActivityMapEvent(IActivityMap source, int type) {
- super(source);
- m_type = type;
- }
-
- public ActivityMapEvent(IActivityMap source, int type, ActivityCell activity) {
- super(source);
- m_type = type;
- if (activity != null) {
- m_activities = new ActivityCell[]{activity};
- }
- }
-
- public ActivityMapEvent(IActivityMap source, int type, ActivityCell[] activities) {
- super(source);
- m_type = type;
- if (activities != null && activities.length > 0) {
- m_activities = activities;
- }
- }
-
- public ActivityMapEvent(IActivityMap source, int type, long resourceId, MinorTimeColumn column, ActivityCell activity) {
- super(source);
- m_type = type;
- if (activity != null) {
- m_activities = new ActivityCell[]{activity};
- }
- m_resourceId = resourceId;
- m_column = column;
- }
-
- public IActivityMap getActivityMap() {
- return (IActivityMap) getSource();
- }
-
- public int getType() {
- return m_type;
- }
-
- public long getResourceId() {
- return m_resourceId;
- }
-
- public MinorTimeColumn getColumn() {
- return m_column;
- }
-
- public ActivityCell[] getActivities() {
- return m_activities;
- }
-
- protected void setActivities(ActivityCell[] activities) {
- m_activities = activities;
- }
-
- public int getActivityCount() {
- return m_activities != null ? m_activities.length : 0;
- }
-
- public ActivityCell getFirstActivity() {
- return m_activities.length > 0 ? m_activities[0] : null;
- }
-
- public ActivityCell getLastActivity() {
- return m_activities.length > 0 ? m_activities[m_activities.length - 1] : null;
- }
-
- /**
- * used by TYPE_NEW_ACTIVITY_POPUP and TYPE_EDIT_ACTIVITY_POPUP to add actions
- */
- public void addPopupMenu(IMenu menu) {
- if (menu != null) {
- if (m_popupMenus == null) {
- m_popupMenus = new ArrayList<IMenu>();
- }
- m_popupMenus.add(menu);
- }
- }
-
- /**
- * used by TYPE_NEW_ACTIVITY_POPUP and TYPE_EDIT_ACTIVITY_POPUP to add actions
- */
- public void addPopupMenus(IMenu[] menus) {
- if (menus != null) {
- if (m_popupMenus == null) {
- m_popupMenus = new ArrayList<IMenu>();
- }
- m_popupMenus.addAll(Arrays.asList(menus));
- }
- }
-
- /**
- * used by TYPE_NEW_ACTIVITY_POPUP and TYPE_EDIT_ACTIVITY_POPUP to add actions
- */
- public IMenu[] getPopupMenus() {
- if (m_popupMenus != null) {
- return m_popupMenus.toArray(new IMenu[0]);
- }
- else {
- return new IMenu[0];
- }
- }
-
- /**
- * used by TYPE_NEW_ACTIVITY_POPUP and TYPE_EDIT_ACTIVITY_POPUP to add actions
- */
- public int getPopupMenuCount() {
- if (m_popupMenus != null) {
- return m_popupMenus.size();
- }
- else {
- return 0;
- }
- }
-
- @Override
- public String toString() {
- StringBuffer buf = new StringBuffer();
- buf.append(getClass().getSimpleName() + "[");
- // decode type
- try {
- Field[] f = getClass().getDeclaredFields();
- for (int i = 0; i < f.length; i++) {
- if (Modifier.isPublic(f[i].getModifiers()) && Modifier.isStatic(f[i].getModifiers()) && f[i].getName().startsWith("TYPE_")) {
- if (((Number) f[i].get(null)).intValue() == m_type) {
- buf.append(f[i].getName());
- break;
- }
- }
- }
- }
- catch (Throwable t) {
- buf.append("#" + m_type);
- }
- buf.append(" ");
- // activities
- if (m_activities != null && m_activities.length > 0 && getActivityMap() != null) {
- if (m_activities.length == 1) {
- buf.append("row " + m_activities[0]);
- }
- else {
- buf.append("activities {");
- for (int i = 0; i < m_activities.length; i++) {
- if (i >= 0) {
- buf.append(",");
- }
- buf.append("" + m_activities[i]);
- }
- buf.append("}");
- }
- }
- else {
- buf.append("{}");
- }
- buf.append("]");
- return buf.toString();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.activitymap;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+
+@SuppressWarnings("serial")
+public class ActivityMapEvent extends java.util.EventObject {
+ /**
+ * Some activities have been added valid properties: activities,
+ * firstActivity, lastActivity
+ */
+ public static final int TYPE_ACTIVITIES_INSERTED = 100;
+ /**
+ * Some activities have been updated valid properties: activities,
+ * firstActivity, lastActivity
+ */
+ public static final int TYPE_ACTIVITIES_UPDATED = 101;
+ /**
+ * Some activities have been deleted valid properties: activities,
+ * firstActivity, lastActivity
+ */
+ public static final int TYPE_ACTIVITIES_DELETED = 102;
+ /**
+ * A row has been activated valid properties: activities, firstActivity,
+ * lastActivity, resourceId, column
+ */
+ public static final int TYPE_CELL_ACTION = 104;
+ /**
+ * All activities have been deleted valid properties: activities,
+ * firstActivity, lastActivity
+ */
+ public static final int TYPE_ALL_ACTIVITIES_DELETED = 105;
+ /**
+ * Broadcast request to add actions for activities popup valid properties:
+ * activities, firstActivity, lastActivity add actions to: popupActions
+ */
+ public static final int TYPE_EDIT_ACTIVITY_POPUP = 700;
+ /**
+ * Broadcast request to add actions for "new" popup valid properties: add
+ * actions to: popupActions
+ */
+ public static final int TYPE_NEW_ACTIVITY_POPUP = 701;
+
+ private int m_type;
+ private ActivityCell[] m_activities = new ActivityCell[0];
+ private List<IMenu> m_popupMenus;
+ private long m_resourceId;
+ private MinorTimeColumn m_column;
+
+ public ActivityMapEvent(IActivityMap source, int type) {
+ super(source);
+ m_type = type;
+ }
+
+ public ActivityMapEvent(IActivityMap source, int type, ActivityCell activity) {
+ super(source);
+ m_type = type;
+ if (activity != null) {
+ m_activities = new ActivityCell[]{activity};
+ }
+ }
+
+ public ActivityMapEvent(IActivityMap source, int type, ActivityCell[] activities) {
+ super(source);
+ m_type = type;
+ if (activities != null && activities.length > 0) {
+ m_activities = activities;
+ }
+ }
+
+ public ActivityMapEvent(IActivityMap source, int type, long resourceId, MinorTimeColumn column, ActivityCell activity) {
+ super(source);
+ m_type = type;
+ if (activity != null) {
+ m_activities = new ActivityCell[]{activity};
+ }
+ m_resourceId = resourceId;
+ m_column = column;
+ }
+
+ public IActivityMap getActivityMap() {
+ return (IActivityMap) getSource();
+ }
+
+ public int getType() {
+ return m_type;
+ }
+
+ public long getResourceId() {
+ return m_resourceId;
+ }
+
+ public MinorTimeColumn getColumn() {
+ return m_column;
+ }
+
+ public ActivityCell[] getActivities() {
+ return m_activities;
+ }
+
+ protected void setActivities(ActivityCell[] activities) {
+ m_activities = activities;
+ }
+
+ public int getActivityCount() {
+ return m_activities != null ? m_activities.length : 0;
+ }
+
+ public ActivityCell getFirstActivity() {
+ return m_activities.length > 0 ? m_activities[0] : null;
+ }
+
+ public ActivityCell getLastActivity() {
+ return m_activities.length > 0 ? m_activities[m_activities.length - 1] : null;
+ }
+
+ /**
+ * used by TYPE_NEW_ACTIVITY_POPUP and TYPE_EDIT_ACTIVITY_POPUP to add actions
+ */
+ public void addPopupMenu(IMenu menu) {
+ if (menu != null) {
+ if (m_popupMenus == null) {
+ m_popupMenus = new ArrayList<IMenu>();
+ }
+ m_popupMenus.add(menu);
+ }
+ }
+
+ /**
+ * used by TYPE_NEW_ACTIVITY_POPUP and TYPE_EDIT_ACTIVITY_POPUP to add actions
+ */
+ public void addPopupMenus(IMenu[] menus) {
+ if (menus != null) {
+ if (m_popupMenus == null) {
+ m_popupMenus = new ArrayList<IMenu>();
+ }
+ m_popupMenus.addAll(Arrays.asList(menus));
+ }
+ }
+
+ /**
+ * used by TYPE_NEW_ACTIVITY_POPUP and TYPE_EDIT_ACTIVITY_POPUP to add actions
+ */
+ public IMenu[] getPopupMenus() {
+ if (m_popupMenus != null) {
+ return m_popupMenus.toArray(new IMenu[0]);
+ }
+ else {
+ return new IMenu[0];
+ }
+ }
+
+ /**
+ * used by TYPE_NEW_ACTIVITY_POPUP and TYPE_EDIT_ACTIVITY_POPUP to add actions
+ */
+ public int getPopupMenuCount() {
+ if (m_popupMenus != null) {
+ return m_popupMenus.size();
+ }
+ else {
+ return 0;
+ }
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer buf = new StringBuffer();
+ buf.append(getClass().getSimpleName() + "[");
+ // decode type
+ try {
+ Field[] f = getClass().getDeclaredFields();
+ for (int i = 0; i < f.length; i++) {
+ if (Modifier.isPublic(f[i].getModifiers()) && Modifier.isStatic(f[i].getModifiers()) && f[i].getName().startsWith("TYPE_")) {
+ if (((Number) f[i].get(null)).intValue() == m_type) {
+ buf.append(f[i].getName());
+ break;
+ }
+ }
+ }
+ }
+ catch (Throwable t) {
+ buf.append("#" + m_type);
+ }
+ buf.append(" ");
+ // activities
+ if (m_activities != null && m_activities.length > 0 && getActivityMap() != null) {
+ if (m_activities.length == 1) {
+ buf.append("row " + m_activities[0]);
+ }
+ else {
+ buf.append("activities {");
+ for (int i = 0; i < m_activities.length; i++) {
+ if (i >= 0) {
+ buf.append(",");
+ }
+ buf.append("" + m_activities[i]);
+ }
+ buf.append("}");
+ }
+ }
+ else {
+ buf.append("{}");
+ }
+ buf.append("]");
+ return buf.toString();
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/ActivityMapListener.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/ActivityMapListener.java
index 8a4ec4d046..68f11b8e5c 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/ActivityMapListener.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/ActivityMapListener.java
@@ -1,19 +1,19 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.activitymap;
-
-import java.util.EventListener;
-
-public interface ActivityMapListener extends EventListener {
-
- void activityMapChanged(ActivityMapEvent e);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.activitymap;
+
+import java.util.EventListener;
+
+public interface ActivityMapListener extends EventListener {
+
+ void activityMapChanged(ActivityMapEvent e);
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/IActivityCellObserver.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/IActivityCellObserver.java
index 6dab40fdad..880414f3df 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/IActivityCellObserver.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/IActivityCellObserver.java
@@ -1,16 +1,16 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.activitymap;
-
-public interface IActivityCellObserver {
-
- void cellChanged(ActivityCell cell, int bitPos);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.activitymap;
+
+public interface IActivityCellObserver {
+
+ void cellChanged(ActivityCell cell, int bitPos);
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/IActivityMap.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/IActivityMap.java
index c764647cf6..1773ea8c63 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/IActivityMap.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/IActivityMap.java
@@ -1,336 +1,336 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.activitymap;
-
-import java.util.Date;
-
-import org.eclipse.scout.commons.beans.IPropertyObserver;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.form.fields.plannerfield.IPlannerField;
-
-/**
- * The activity map is a specialized model which contains a set of {@link ActivityCell}s that are grouped by resourceId.
- */
-public interface IActivityMap extends IPropertyObserver {
-
- /**
- * {@link java.util.Date}[] truncated to day using {@link com.bsiag.DateUtility#truncDate(Date)}
- */
- String PROP_DAYS = "days";
- /**
- * {@link Integer}
- */
- String PROP_WORK_DAY_COUNT = "workDayCount";
- /**
- * {@link Boolean}
- */
- String PROP_WORK_DAYS_ONLY = "workDaysOnly";
- /**
- * {@link Date}
- */
- String PROP_FIRST_HOUR_OF_DAY = "firstHourOfDay";
- /**
- * {@link Date}
- */
- String PROP_LAST_HOUR_OF_DAY = "lastHourOfDay";
- /**
- * {@link Long}
- */
- String PROP_INTRADAY_INTERVAL = "intradayInterval";
- /**
- * {@link #PLANNING_MODE_TIME},{@link #PLANNING_MODE_DAY}, {@link #PLANNING_MODE_WEEK}
- */
- String PROP_PLANNING_MODE = "planningMode";
- /**
- * {@link Long}[]
- */
- String PROP_RESOURCE_IDS = "resourceIds";
- /**
- * {@link Date}
- */
- String PROP_SELECTED_BEGIN_TIME = "selectedBeginTime";
- /**
- * {@link Date}
- */
- String PROP_SELECTED_END_TIME = "selectedEndTime";
- /**
- * {@link Long}[]
- */
- String PROP_SELECTED_RESOURCE_IDS = "selectedResourceIds";
- /**
- * {@link ActivityCell}
- */
- String PROP_SELECTED_ACTIVITY_CELL = "selectedActivityCell";
- /**
- * {@link TimeScale}
- */
- String PROP_TIME_SCALE = "timeScale";
- /**
- * {@link Boolean}
- */
- String PROP_DRAW_SECTIONS = "drawSections";
- /**
- * {@link Object} Container of this map, {@link IPlannerField} https://bugs.eclipse.org/bugs/show_bug.cgi?id=388227
- *
- * @since 3.8.1
- */
- String PROP_CONTAINER = "container";
-
- int PLANNING_MODE_INTRADAY = 0;
- int PLANNING_MODE_DAY = 1;
- int PLANNING_MODE_WEEK = 2;
-
- void initActivityMap() throws ProcessingException;
-
- void disposeActivityMap();
-
- void addActivityMapListener(ActivityMapListener listener);
-
- void removeActivityMapListener(ActivityMapListener listener);
-
- boolean isActivityMapChanging();
-
- /**
- * when performing a batch mutation use this marker like
- *
- * <pre>
- * try{
- * setActivityMapChanging(true);
- * ...modify data...
- * }
- * finally{
- * setActivityMapChanging(false);
- * }
- * </pre>
- */
- void setActivityMapChanging(boolean b);
-
- /**
- * Create a time scalewith {@link MajorTimeColumn}s and {@link MinorTimeColumn}s
- *
- * @see {@link #getPlanningMode()} and {@link #getDays()}
- */
- void createTimeScale();
-
- /**
- * ui model can use this objects to build the columns of the map
- */
- TimeScale getTimeScale();
-
- void setTimeScale(TimeScale scale);
-
- /**
- * All the days which are display in the activity map.<br>
- * Ordered ascending
- */
- Date[] getDays();
-
- void setDays(Date[] days);
-
- void addDay(Date day);
-
- void removeDay(Date day);
-
- void setDay(Date day);
-
- /**
- * @return begin time of activity map
- * <p>
- * Intraday: This is the first hour of the first day<br>
- * Day: This is the first day at 00:00<br>
- * Week: This is the first day at 00:00 of the first week
- */
- Date getBeginTime();
-
- /**
- * @return end time of activity map
- * <p>
- * Intraday: This is the last hour +1 of the first day<br>
- * Day: This is the day after the last day at 00:00<br>
- * Week: This is the monday of the week after the last week at 00:00
- */
- Date getEndTime();
-
- int getWorkDayCount();
-
- void setWorkDayCount(int n);
-
- boolean isWorkDaysOnly();
-
- void setWorkDaysOnly(boolean b);
-
- /**
- * @return the first hour of a day<br>
- * When a working day starts at 08:00 and ends at 17:00, this value is
- * 8.
- */
- int getFirstHourOfDay();
-
- /**
- * see {@link #getFirstHourOfDay()}
- */
- void setFirstHourOfDay(int i);
-
- /**
- * @return the last hour of a day<br>
- * When a working day starts at 08:00 and ends at 17:00, this value is
- * 16 since the last hour starts at 16:00 and ends at 16:59.
- */
- int getLastHourOfDay();
-
- /**
- * see {@link #getLastHourOfDay()}
- */
- void setLastHourOfDay(int i);
-
- /**
- * {@link #PLANNING_MODE_INTRADAY},{@link #PLANNING_MODE_DAY}, {@link #PLANNING_MODE_WEEK}
- */
- int getPlanningMode();
-
- /**
- * {@link #PLANNING_MODE_INTRADAY},{@link #PLANNING_MODE_DAY}, {@link #PLANNING_MODE_WEEK}
- */
- void setPlanningMode(int mode);
-
- /**
- * milliseconds
- */
- long getIntradayInterval();
-
- void setIntradayInterval(long millis);
-
- void setIntradayIntervalInMinutes(long minutes);
-
- long getMinimumActivityDuration();
-
- void setMinimumActivityDuration(long minDuration);
-
- void setMinimumActivityDurationInMinutes(long min);
-
- Date getSelectedBeginTime();
-
- Date getSelectedEndTime();
-
- void setSelectedTime(Date beginTime, Date endTime);
-
- void decorateActivityCell(ActivityCell p);
-
- /**
- * collect all selected days from starthour to endhour and intersect with
- * earliest and latest time range
- */
- MultiTimeRange calculateSelectedTimeRanges(Date earliestBeginTime, Date latestEndTime);
-
- /**
- * Create a planned activity that includes one of the selected persons.
- *
- * @param singleMatch
- * true=plan an activity for only one of the selected resource.
- * false=plan an activity for all of the selected resources
- * @param chooseRandom
- * only used in combination with singleMatch=true. true=a random
- * person is chosen, false=the first matching resource is chosen
- * @param earliestBeginTime
- * consider only matches that start after this time; {@link System#currentTimeMillis()} is used when null is
- * passed
- * @param latestEndTime
- * consider only matches that end before this time; {@link System#currentTimeMillis()}+10 years is used when
- * null is
- * passed
- * @param preferredDuration
- * (in milliseconds) the preferred duration of the planned activity;
- * 30 minutes is used when 0 is passed
- */
- void planActivityForSelectedResources(boolean singleMatch, boolean chooseRandom, Date earliestBeginTime, Date latestEndTime, long preferredDuration);
-
- ActivityCell resolveActivityCell(ActivityCell cell);
-
- ActivityCell[] resolveActivityCells(ActivityCell[] cells);
-
- ActivityCell[] getActivityCells(long resourceId);
-
- ActivityCell[] getActivityCells(Long[] resourceIds);
-
- ActivityCell[] getAllActivityCells();
-
- void addActivityCells(ActivityCell[] cells);
-
- void updateActivityCells(ActivityCell[] cells);
-
- void updateActivityCells(Long[] resourceIds);
-
- void removeActivityCells(ActivityCell[] cells);
-
- void removeActivityCells(Long[] resourceIds);
-
- void removeAllActivityCells();
-
- ActivityCell getSelectedActivityCell();
-
- void setSelectedActivityCell(ActivityCell cell);
-
- boolean isSelectedActivityCell(ActivityCell cell);
-
- /**
- * available resource ids in the same order as the resource table
- */
- Long[] getResourceIds();
-
- void setResourceIds(Long[] resourceIds);
-
- /**
- * selected resource ids in arbitrary order
- */
- Long[] getSelectedResourceIds();
-
- void setSelectedResourceIds(Long[] resourceIds);
-
- void isSelectedResourceId(Long resourceId);
-
- /**
- * Indicates whether the selected sections in the activity
- * map should be visualized (by a rectangle with red and
- * green borders).
- *
- * @return true if the activity map draws these sections,
- * false if not.
- */
- boolean isDrawSections();
-
- /**
- * Sets whether the selected sections in the activity
- * map should be visualized (by a rectangle with red and
- * green borders).
- *
- * @param drawSections
- * true if the activity map should draw these sections,
- * false if not.
- */
- void setDrawSections(boolean drawSections);
-
- /**
- * {@link Object}
- * <p>
- * Container of this map, {@link IPlannerField}
- * <p>
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=388227
- *
- * @since 3.8.1
- */
- Object getContainer();
-
- IMenu[] getMenus();
-
- IActivityMapUIFacade getUIFacade();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.activitymap;
+
+import java.util.Date;
+
+import org.eclipse.scout.commons.beans.IPropertyObserver;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.form.fields.plannerfield.IPlannerField;
+
+/**
+ * The activity map is a specialized model which contains a set of {@link ActivityCell}s that are grouped by resourceId.
+ */
+public interface IActivityMap extends IPropertyObserver {
+
+ /**
+ * {@link java.util.Date}[] truncated to day using {@link com.bsiag.DateUtility#truncDate(Date)}
+ */
+ String PROP_DAYS = "days";
+ /**
+ * {@link Integer}
+ */
+ String PROP_WORK_DAY_COUNT = "workDayCount";
+ /**
+ * {@link Boolean}
+ */
+ String PROP_WORK_DAYS_ONLY = "workDaysOnly";
+ /**
+ * {@link Date}
+ */
+ String PROP_FIRST_HOUR_OF_DAY = "firstHourOfDay";
+ /**
+ * {@link Date}
+ */
+ String PROP_LAST_HOUR_OF_DAY = "lastHourOfDay";
+ /**
+ * {@link Long}
+ */
+ String PROP_INTRADAY_INTERVAL = "intradayInterval";
+ /**
+ * {@link #PLANNING_MODE_TIME},{@link #PLANNING_MODE_DAY}, {@link #PLANNING_MODE_WEEK}
+ */
+ String PROP_PLANNING_MODE = "planningMode";
+ /**
+ * {@link Long}[]
+ */
+ String PROP_RESOURCE_IDS = "resourceIds";
+ /**
+ * {@link Date}
+ */
+ String PROP_SELECTED_BEGIN_TIME = "selectedBeginTime";
+ /**
+ * {@link Date}
+ */
+ String PROP_SELECTED_END_TIME = "selectedEndTime";
+ /**
+ * {@link Long}[]
+ */
+ String PROP_SELECTED_RESOURCE_IDS = "selectedResourceIds";
+ /**
+ * {@link ActivityCell}
+ */
+ String PROP_SELECTED_ACTIVITY_CELL = "selectedActivityCell";
+ /**
+ * {@link TimeScale}
+ */
+ String PROP_TIME_SCALE = "timeScale";
+ /**
+ * {@link Boolean}
+ */
+ String PROP_DRAW_SECTIONS = "drawSections";
+ /**
+ * {@link Object} Container of this map, {@link IPlannerField} https://bugs.eclipse.org/bugs/show_bug.cgi?id=388227
+ *
+ * @since 3.8.1
+ */
+ String PROP_CONTAINER = "container";
+
+ int PLANNING_MODE_INTRADAY = 0;
+ int PLANNING_MODE_DAY = 1;
+ int PLANNING_MODE_WEEK = 2;
+
+ void initActivityMap() throws ProcessingException;
+
+ void disposeActivityMap();
+
+ void addActivityMapListener(ActivityMapListener listener);
+
+ void removeActivityMapListener(ActivityMapListener listener);
+
+ boolean isActivityMapChanging();
+
+ /**
+ * when performing a batch mutation use this marker like
+ *
+ * <pre>
+ * try{
+ * setActivityMapChanging(true);
+ * ...modify data...
+ * }
+ * finally{
+ * setActivityMapChanging(false);
+ * }
+ * </pre>
+ */
+ void setActivityMapChanging(boolean b);
+
+ /**
+ * Create a time scalewith {@link MajorTimeColumn}s and {@link MinorTimeColumn}s
+ *
+ * @see {@link #getPlanningMode()} and {@link #getDays()}
+ */
+ void createTimeScale();
+
+ /**
+ * ui model can use this objects to build the columns of the map
+ */
+ TimeScale getTimeScale();
+
+ void setTimeScale(TimeScale scale);
+
+ /**
+ * All the days which are display in the activity map.<br>
+ * Ordered ascending
+ */
+ Date[] getDays();
+
+ void setDays(Date[] days);
+
+ void addDay(Date day);
+
+ void removeDay(Date day);
+
+ void setDay(Date day);
+
+ /**
+ * @return begin time of activity map
+ * <p>
+ * Intraday: This is the first hour of the first day<br>
+ * Day: This is the first day at 00:00<br>
+ * Week: This is the first day at 00:00 of the first week
+ */
+ Date getBeginTime();
+
+ /**
+ * @return end time of activity map
+ * <p>
+ * Intraday: This is the last hour +1 of the first day<br>
+ * Day: This is the day after the last day at 00:00<br>
+ * Week: This is the monday of the week after the last week at 00:00
+ */
+ Date getEndTime();
+
+ int getWorkDayCount();
+
+ void setWorkDayCount(int n);
+
+ boolean isWorkDaysOnly();
+
+ void setWorkDaysOnly(boolean b);
+
+ /**
+ * @return the first hour of a day<br>
+ * When a working day starts at 08:00 and ends at 17:00, this value is
+ * 8.
+ */
+ int getFirstHourOfDay();
+
+ /**
+ * see {@link #getFirstHourOfDay()}
+ */
+ void setFirstHourOfDay(int i);
+
+ /**
+ * @return the last hour of a day<br>
+ * When a working day starts at 08:00 and ends at 17:00, this value is
+ * 16 since the last hour starts at 16:00 and ends at 16:59.
+ */
+ int getLastHourOfDay();
+
+ /**
+ * see {@link #getLastHourOfDay()}
+ */
+ void setLastHourOfDay(int i);
+
+ /**
+ * {@link #PLANNING_MODE_INTRADAY},{@link #PLANNING_MODE_DAY}, {@link #PLANNING_MODE_WEEK}
+ */
+ int getPlanningMode();
+
+ /**
+ * {@link #PLANNING_MODE_INTRADAY},{@link #PLANNING_MODE_DAY}, {@link #PLANNING_MODE_WEEK}
+ */
+ void setPlanningMode(int mode);
+
+ /**
+ * milliseconds
+ */
+ long getIntradayInterval();
+
+ void setIntradayInterval(long millis);
+
+ void setIntradayIntervalInMinutes(long minutes);
+
+ long getMinimumActivityDuration();
+
+ void setMinimumActivityDuration(long minDuration);
+
+ void setMinimumActivityDurationInMinutes(long min);
+
+ Date getSelectedBeginTime();
+
+ Date getSelectedEndTime();
+
+ void setSelectedTime(Date beginTime, Date endTime);
+
+ void decorateActivityCell(ActivityCell p);
+
+ /**
+ * collect all selected days from starthour to endhour and intersect with
+ * earliest and latest time range
+ */
+ MultiTimeRange calculateSelectedTimeRanges(Date earliestBeginTime, Date latestEndTime);
+
+ /**
+ * Create a planned activity that includes one of the selected persons.
+ *
+ * @param singleMatch
+ * true=plan an activity for only one of the selected resource.
+ * false=plan an activity for all of the selected resources
+ * @param chooseRandom
+ * only used in combination with singleMatch=true. true=a random
+ * person is chosen, false=the first matching resource is chosen
+ * @param earliestBeginTime
+ * consider only matches that start after this time; {@link System#currentTimeMillis()} is used when null is
+ * passed
+ * @param latestEndTime
+ * consider only matches that end before this time; {@link System#currentTimeMillis()}+10 years is used when
+ * null is
+ * passed
+ * @param preferredDuration
+ * (in milliseconds) the preferred duration of the planned activity;
+ * 30 minutes is used when 0 is passed
+ */
+ void planActivityForSelectedResources(boolean singleMatch, boolean chooseRandom, Date earliestBeginTime, Date latestEndTime, long preferredDuration);
+
+ ActivityCell resolveActivityCell(ActivityCell cell);
+
+ ActivityCell[] resolveActivityCells(ActivityCell[] cells);
+
+ ActivityCell[] getActivityCells(long resourceId);
+
+ ActivityCell[] getActivityCells(Long[] resourceIds);
+
+ ActivityCell[] getAllActivityCells();
+
+ void addActivityCells(ActivityCell[] cells);
+
+ void updateActivityCells(ActivityCell[] cells);
+
+ void updateActivityCells(Long[] resourceIds);
+
+ void removeActivityCells(ActivityCell[] cells);
+
+ void removeActivityCells(Long[] resourceIds);
+
+ void removeAllActivityCells();
+
+ ActivityCell getSelectedActivityCell();
+
+ void setSelectedActivityCell(ActivityCell cell);
+
+ boolean isSelectedActivityCell(ActivityCell cell);
+
+ /**
+ * available resource ids in the same order as the resource table
+ */
+ Long[] getResourceIds();
+
+ void setResourceIds(Long[] resourceIds);
+
+ /**
+ * selected resource ids in arbitrary order
+ */
+ Long[] getSelectedResourceIds();
+
+ void setSelectedResourceIds(Long[] resourceIds);
+
+ void isSelectedResourceId(Long resourceId);
+
+ /**
+ * Indicates whether the selected sections in the activity
+ * map should be visualized (by a rectangle with red and
+ * green borders).
+ *
+ * @return true if the activity map draws these sections,
+ * false if not.
+ */
+ boolean isDrawSections();
+
+ /**
+ * Sets whether the selected sections in the activity
+ * map should be visualized (by a rectangle with red and
+ * green borders).
+ *
+ * @param drawSections
+ * true if the activity map should draw these sections,
+ * false if not.
+ */
+ void setDrawSections(boolean drawSections);
+
+ /**
+ * {@link Object}
+ * <p>
+ * Container of this map, {@link IPlannerField}
+ * <p>
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=388227
+ *
+ * @since 3.8.1
+ */
+ Object getContainer();
+
+ IMenu[] getMenus();
+
+ IActivityMapUIFacade getUIFacade();
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/IActivityMapUIFacade.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/IActivityMapUIFacade.java
index 500a142fc5..20cddf41fb 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/IActivityMapUIFacade.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/IActivityMapUIFacade.java
@@ -1,43 +1,43 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.activitymap;
-
-import java.util.Date;
-
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-
-public interface IActivityMapUIFacade {
-
- void setDaysFromUI(Date[] days);
-
- void setSelectedActivityCellFromUI(ActivityCell cell);
-
- void setSelectionFromUI(Long[] resourceIds, double[] normalizedRange);
-
- /**
- * Action on a empty cell or activity cell
- *
- * @param activityCell
- * may be null
- */
- void fireCellActionFromUI(long resourceId, double[] normalizedRange, ActivityCell activityCell);
-
- /**
- * Popup on activity
- */
- IMenu[] fireEditActivityPopupFromUI();
-
- /**
- * Popup on planned activity
- */
- IMenu[] fireNewActivityPopupFromUI();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.activitymap;
+
+import java.util.Date;
+
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+
+public interface IActivityMapUIFacade {
+
+ void setDaysFromUI(Date[] days);
+
+ void setSelectedActivityCellFromUI(ActivityCell cell);
+
+ void setSelectionFromUI(Long[] resourceIds, double[] normalizedRange);
+
+ /**
+ * Action on a empty cell or activity cell
+ *
+ * @param activityCell
+ * may be null
+ */
+ void fireCellActionFromUI(long resourceId, double[] normalizedRange, ActivityCell activityCell);
+
+ /**
+ * Popup on activity
+ */
+ IMenu[] fireEditActivityPopupFromUI();
+
+ /**
+ * Popup on planned activity
+ */
+ IMenu[] fireNewActivityPopupFromUI();
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/IntradayTimeScale.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/IntradayTimeScale.java
index 97940519ee..776fc87ac6 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/IntradayTimeScale.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/IntradayTimeScale.java
@@ -1,45 +1,45 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.activitymap;
-
-import java.util.Date;
-
-public class IntradayTimeScale extends TimeScale {
-
- @Override
- protected Integer getEndMinorColumnIndex(Date endTime) {
- if (endTime == null) {
- return null;
- }
- if (endTime.before(getBeginTime())) {
- return null;
- }
- MinorTimeColumn[] minCols = getMinorTimeColumns();
- if (endTime.after(getEndTime())) {
- return getMinorTimeColumns().length - 1;
- }
- //approach in ascending order
- for (int i = 0; i < minCols.length; i++) {
- if (endTime.compareTo(minCols[i].getEndTime()) <= 0) {
- // special handling: the minCols might contain a gap, i.e. the range is not contiguous.
- // In that case, check whether the end date is really in that range. Otherwise, ascribe the date to the previous column.
- // In this case the endTime has to be compared to the beginTime of the column and if the endTime is smaller or equal than
- // the beginTime, the previous column is returned. Compared to the super class TimeScale the comparator <= is used here
- // because the end boundaries of the columns contain the exact values.
- if (endTime.compareTo(minCols[i].getBeginTime()) <= 0) {
- return i > 0 ? i - 1 : null;
- }
- return i;
- }
- }
- return null;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.activitymap;
+
+import java.util.Date;
+
+public class IntradayTimeScale extends TimeScale {
+
+ @Override
+ protected Integer getEndMinorColumnIndex(Date endTime) {
+ if (endTime == null) {
+ return null;
+ }
+ if (endTime.before(getBeginTime())) {
+ return null;
+ }
+ MinorTimeColumn[] minCols = getMinorTimeColumns();
+ if (endTime.after(getEndTime())) {
+ return getMinorTimeColumns().length - 1;
+ }
+ //approach in ascending order
+ for (int i = 0; i < minCols.length; i++) {
+ if (endTime.compareTo(minCols[i].getEndTime()) <= 0) {
+ // special handling: the minCols might contain a gap, i.e. the range is not contiguous.
+ // In that case, check whether the end date is really in that range. Otherwise, ascribe the date to the previous column.
+ // In this case the endTime has to be compared to the beginTime of the column and if the endTime is smaller or equal than
+ // the beginTime, the previous column is returned. Compared to the super class TimeScale the comparator <= is used here
+ // because the end boundaries of the columns contain the exact values.
+ if (endTime.compareTo(minCols[i].getBeginTime()) <= 0) {
+ return i > 0 ? i - 1 : null;
+ }
+ return i;
+ }
+ }
+ return null;
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/MajorTimeColumn.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/MajorTimeColumn.java
index d637141fab..7db5ddd81a 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/MajorTimeColumn.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/MajorTimeColumn.java
@@ -1,112 +1,112 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.activitymap;
-
-import java.util.Date;
-import java.util.TreeMap;
-
-/**
- * Model to represent a day, a week, a month, ...
- */
-public class MajorTimeColumn {
- private TimeScale m_scale;
- private String m_smallText = "";
- private String m_mediumText = "";
- private String m_largeText = "";
- private String m_tooltipText;
- private TreeMap<Date, MinorTimeColumn> m_children = new TreeMap<Date, MinorTimeColumn>();
-
- public MajorTimeColumn(TimeScale scale) {
- m_scale = scale;
- m_scale.addMajorColumnNotify(this);
- }
-
- public TimeScale geTimeScale() {
- return m_scale;
- }
-
- public String getSmallText() {
- return m_smallText;
- }
-
- public void setSmallText(String s) {
- m_smallText = s;
- }
-
- public String getMediumText() {
- return m_mediumText;
- }
-
- public void setMediumText(String s) {
- m_mediumText = s;
- }
-
- public String getLargeText() {
- return m_largeText;
- }
-
- public void setLargeText(String s) {
- m_largeText = s;
- }
-
- public String getTooltipText() {
- return m_tooltipText;
- }
-
- public void setTooltipText(String s) {
- m_tooltipText = s;
- }
-
- public String getText(int size) {
- switch (size) {
- case TimeScale.SMALL: {
- return getSmallText();
- }
- case TimeScale.MEDIUM: {
- return getMediumText();
- }
- case TimeScale.LARGE: {
- return getLargeText();
- }
- default: {
- return "<UNKNOWN SIZE " + size + ">";
- }
- }
- }
-
- protected void addMinorColumnNotify(MinorTimeColumn c) {
- m_children.put(c.getBeginTime(), c);
- m_scale.addMinorColumnNotify(this, c);
- }
-
- public MinorTimeColumn[] getMinorTimeColumns() {
- return m_children.values().toArray(new MinorTimeColumn[m_children.size()]);
- }
-
- @Override
- public String toString() {
- return toString(TimeScale.LARGE);
- }
-
- public String toString(int size) {
- StringBuilder b = new StringBuilder();
- b.append(getClass().getSimpleName());
- b.append("[");
- b.append(getText(size));
- for (MinorTimeColumn c : getMinorTimeColumns()) {
- b.append(" ");
- b.append(c.toString(size));
- }
- b.append(" ]");
- return b.toString();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.activitymap;
+
+import java.util.Date;
+import java.util.TreeMap;
+
+/**
+ * Model to represent a day, a week, a month, ...
+ */
+public class MajorTimeColumn {
+ private TimeScale m_scale;
+ private String m_smallText = "";
+ private String m_mediumText = "";
+ private String m_largeText = "";
+ private String m_tooltipText;
+ private TreeMap<Date, MinorTimeColumn> m_children = new TreeMap<Date, MinorTimeColumn>();
+
+ public MajorTimeColumn(TimeScale scale) {
+ m_scale = scale;
+ m_scale.addMajorColumnNotify(this);
+ }
+
+ public TimeScale geTimeScale() {
+ return m_scale;
+ }
+
+ public String getSmallText() {
+ return m_smallText;
+ }
+
+ public void setSmallText(String s) {
+ m_smallText = s;
+ }
+
+ public String getMediumText() {
+ return m_mediumText;
+ }
+
+ public void setMediumText(String s) {
+ m_mediumText = s;
+ }
+
+ public String getLargeText() {
+ return m_largeText;
+ }
+
+ public void setLargeText(String s) {
+ m_largeText = s;
+ }
+
+ public String getTooltipText() {
+ return m_tooltipText;
+ }
+
+ public void setTooltipText(String s) {
+ m_tooltipText = s;
+ }
+
+ public String getText(int size) {
+ switch (size) {
+ case TimeScale.SMALL: {
+ return getSmallText();
+ }
+ case TimeScale.MEDIUM: {
+ return getMediumText();
+ }
+ case TimeScale.LARGE: {
+ return getLargeText();
+ }
+ default: {
+ return "<UNKNOWN SIZE " + size + ">";
+ }
+ }
+ }
+
+ protected void addMinorColumnNotify(MinorTimeColumn c) {
+ m_children.put(c.getBeginTime(), c);
+ m_scale.addMinorColumnNotify(this, c);
+ }
+
+ public MinorTimeColumn[] getMinorTimeColumns() {
+ return m_children.values().toArray(new MinorTimeColumn[m_children.size()]);
+ }
+
+ @Override
+ public String toString() {
+ return toString(TimeScale.LARGE);
+ }
+
+ public String toString(int size) {
+ StringBuilder b = new StringBuilder();
+ b.append(getClass().getSimpleName());
+ b.append("[");
+ b.append(getText(size));
+ for (MinorTimeColumn c : getMinorTimeColumns()) {
+ b.append(" ");
+ b.append(c.toString(size));
+ }
+ b.append(" ]");
+ return b.toString();
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/MinorTimeColumn.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/MinorTimeColumn.java
index a7f39f7e2c..cd4e08df27 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/MinorTimeColumn.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/MinorTimeColumn.java
@@ -1,117 +1,117 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.activitymap;
-
-import java.util.Calendar;
-import java.util.Date;
-
-/**
- * ui model to represent an intraday column (hour, half hour, quarter hour,
- * etc..)
- */
-public class MinorTimeColumn {
- private Date m_beginTime;
- private Date m_endTime;
- private String m_smallText = "";
- private String m_mediumText = "";
- private String m_largeText = "";
- private String m_tooltipText;
- private MajorTimeColumn m_majorTimeColumn;
-
- public MinorTimeColumn(MajorTimeColumn parent, Date beginTime, Date endTime) {
- m_beginTime = beginTime;
- m_endTime = endTime;
- m_majorTimeColumn = parent;
- m_majorTimeColumn.addMinorColumnNotify(this);
- }
-
- public MajorTimeColumn getMajorTimeColumn() {
- return m_majorTimeColumn;
- }
-
- public Date getBeginTime() {
- return m_beginTime;
- }
-
- public Date getEndTime() {
- return m_endTime;
- }
-
- public Calendar getBeginCalendar() {
- Calendar cal = Calendar.getInstance();
- cal.setTime(m_beginTime);
- return cal;
- }
-
- public String getSmallText() {
- return m_smallText;
- }
-
- public void setSmallText(String s) {
- m_smallText = s;
- }
-
- public String getMediumText() {
- return m_mediumText;
- }
-
- public void setMediumText(String s) {
- m_mediumText = s;
- }
-
- public String getLargeText() {
- return m_largeText;
- }
-
- public void setLargeText(String s) {
- m_largeText = s;
- }
-
- public String getTooltipText() {
- return m_tooltipText;
- }
-
- public void setTooltipText(String s) {
- m_tooltipText = s;
- }
-
- public String getText(int size) {
- switch (size) {
- case TimeScale.SMALL: {
- return getSmallText();
- }
- case TimeScale.MEDIUM: {
- return getMediumText();
- }
- case TimeScale.LARGE: {
- return getLargeText();
- }
- default: {
- return "<UNKNOWN SIZE " + size + ">";
- }
- }
- }
-
- @Override
- public String toString() {
- return toString(TimeScale.LARGE);
- }
-
- public String toString(int size) {
- StringBuilder b = new StringBuilder();
- b.append(getClass().getSimpleName());
- b.append("[");
- b.append(getText(size));
- b.append(" ]");
- return b.toString();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.activitymap;
+
+import java.util.Calendar;
+import java.util.Date;
+
+/**
+ * ui model to represent an intraday column (hour, half hour, quarter hour,
+ * etc..)
+ */
+public class MinorTimeColumn {
+ private Date m_beginTime;
+ private Date m_endTime;
+ private String m_smallText = "";
+ private String m_mediumText = "";
+ private String m_largeText = "";
+ private String m_tooltipText;
+ private MajorTimeColumn m_majorTimeColumn;
+
+ public MinorTimeColumn(MajorTimeColumn parent, Date beginTime, Date endTime) {
+ m_beginTime = beginTime;
+ m_endTime = endTime;
+ m_majorTimeColumn = parent;
+ m_majorTimeColumn.addMinorColumnNotify(this);
+ }
+
+ public MajorTimeColumn getMajorTimeColumn() {
+ return m_majorTimeColumn;
+ }
+
+ public Date getBeginTime() {
+ return m_beginTime;
+ }
+
+ public Date getEndTime() {
+ return m_endTime;
+ }
+
+ public Calendar getBeginCalendar() {
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(m_beginTime);
+ return cal;
+ }
+
+ public String getSmallText() {
+ return m_smallText;
+ }
+
+ public void setSmallText(String s) {
+ m_smallText = s;
+ }
+
+ public String getMediumText() {
+ return m_mediumText;
+ }
+
+ public void setMediumText(String s) {
+ m_mediumText = s;
+ }
+
+ public String getLargeText() {
+ return m_largeText;
+ }
+
+ public void setLargeText(String s) {
+ m_largeText = s;
+ }
+
+ public String getTooltipText() {
+ return m_tooltipText;
+ }
+
+ public void setTooltipText(String s) {
+ m_tooltipText = s;
+ }
+
+ public String getText(int size) {
+ switch (size) {
+ case TimeScale.SMALL: {
+ return getSmallText();
+ }
+ case TimeScale.MEDIUM: {
+ return getMediumText();
+ }
+ case TimeScale.LARGE: {
+ return getLargeText();
+ }
+ default: {
+ return "<UNKNOWN SIZE " + size + ">";
+ }
+ }
+ }
+
+ @Override
+ public String toString() {
+ return toString(TimeScale.LARGE);
+ }
+
+ public String toString(int size) {
+ StringBuilder b = new StringBuilder();
+ b.append(getClass().getSimpleName());
+ b.append("[");
+ b.append(getText(size));
+ b.append(" ]");
+ return b.toString();
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/MultiTimeRange.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/MultiTimeRange.java
index 450f1d03fc..48f42922ef 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/MultiTimeRange.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/MultiTimeRange.java
@@ -1,250 +1,250 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.activitymap;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Date;
-import java.util.SortedMap;
-import java.util.TreeMap;
-
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.basic.calendar.AbstractCalendar;
-
-/**
- * Description: Allows to store multiple time ranges. There
- * are no overlapping on the stored ranges.
- * <p>
- * e.g. {'1.1.2006 13:00'-'1.1.2006 14:00', '2.1.2006 12:00'-'3.1.2006 12:00'} Copyright (c) 2006 BSI AG Company: BSI AG
- * - www.bsiag.com
- *
- * @since 03.02.2006
- * @version 1.0
- */
-class MultiTimeRange implements Cloneable {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractCalendar.class);
-
- private TreeMap<Date/* fromDate */, TimeRange> m_multipleTimeRangeMap = new TreeMap<Date, TimeRange>();
-
- public MultiTimeRange() {
- }
-
- /**
- * add a time range to this timerange-collection.
- * <p>
- * if the new time range has overlappings with stored timeranges, the collection is updated accordingly.
- * <p>
- * restrictions: from and to must not be <code>null</code>. from < to.
- *
- * @param from
- * @param to
- * @return the really added {@link TimeRange}s.
- * @throws IllegalArgumentException
- * @since 03.02.2006 - tha@bsiag.com
- */
- public MultiTimeRange add(Date from, Date to) {
- checkParams(from, to);
- MultiTimeRange addedTimeRanges = new MultiTimeRange();
- addedTimeRanges.internalPutNoOldEntry(from, to);
- /* check overlapping */
- SortedMap<Date, TimeRange> headMap = m_multipleTimeRangeMap.headMap(to);
- boolean first = true;
- boolean finished = false;
- while (!finished && !headMap.isEmpty()) {
- final Object tailKey = headMap.lastKey();
- final TimeRange tail = headMap.get(tailKey);
- final Date tailTo = tail.getTo();
- if (first) {
- first = false;
- /* check old_to > new_to */
- if (tailTo.after(to)) {
- to = tailTo;
- }
- }
- final Date tailFrom = tail.getFrom();
- /* check no overlap */
- if (tailTo.before(from)) {
- finished = true;
- }
- else {
- /* check old_from < new_from */
- if (tailFrom.before(from)) {
- finished = true;
- from = tailFrom;
- }
- m_multipleTimeRangeMap.remove(tailKey);
- addedTimeRanges.remove(tailFrom, tailTo);
- }
- }
- internalPutNoOldEntry(from, to);
- return addedTimeRanges;
- }
-
- public void setSingleTimerange(Date from, Date to) {
- m_multipleTimeRangeMap = new TreeMap<Date, TimeRange>();
- internalPutNoOldEntry(from, to);
- }
-
- private void internalPutNoOldEntry(Date from, Date to) {
- try {
- checkParams(from, to);
- }
- catch (IllegalArgumentException iaex) {
- LOG.debug("adding [" + from + ", " + to + "] failed: " + iaex);
- return;
- }
- Object oldEntry = m_multipleTimeRangeMap.put(from, new TimeRange(from, to));
- if (oldEntry != null) {
- throw new RuntimeException("Error: should not have an entry for key: " + from);
- }
- }
-
- private void checkParams(Date from, Date to) {
- if (from == null || to == null) {
- throw new IllegalArgumentException("from and to must not be null.");
- }
- if (!to.after(from)) {
- throw new IllegalArgumentException("time range must be > 0.");
- }
- }
-
- /**
- * removes the given time range from the stored ones.
- * <p>
- * calculates overlapping and rearranges correspondingly.
- * <p>
- * restrictions: from and to must not be <code>null</code>. from < to.
- *
- * @param from
- * @param to
- * @return
- * @since 03.02.2006 - tha@bsiag.com
- */
- public Collection remove(Date from, Date to) {
- checkParams(from, to);
- ArrayList<TimeRange> removedTimeRanges = new ArrayList<TimeRange>();
- /* check overlapping */
- SortedMap<Date, TimeRange> headMap = m_multipleTimeRangeMap.headMap(to);
- boolean finished = false;
- while (!finished && !headMap.isEmpty()) {
- final Object tailKey = headMap.lastKey();
- final TimeRange tail = headMap.get(tailKey);
- final Date tailTo = tail.getTo();
- final Date tailFrom = tail.getFrom();
-
- if (tailTo.after(to) && tailFrom.before(to)) {
- /* tail range overlaps our to-time. we have to replace the tail element. */
- m_multipleTimeRangeMap.remove(tailKey);
- if (tailFrom.before(from)) {
- /* case that tail is bigger then given range on both sides! */
- removedTimeRanges.add(new TimeRange(from, to));
- internalPutNoOldEntry(tailFrom, from);
- internalPutNoOldEntry(to, tailTo);
- finished = true;
- }
- else {
- /* normal overlapping after given range */
- removedTimeRanges.add(new TimeRange(tailFrom, to));
- internalPutNoOldEntry(to, tailTo);
- }
- }
- else {
- /* tail range does not overlap our to-time. */
- if (from.after(tailTo)) {
- finished = true;
- }
- else if (tailFrom.after(from)) {
- removedTimeRanges.add(m_multipleTimeRangeMap.remove(tailKey));
- }
- else {
- /* tail range overlaps our from-time. we have to replace tail element. */
- m_multipleTimeRangeMap.remove(tailKey);
- internalPutNoOldEntry(tailFrom, from);
- removedTimeRanges.add(new TimeRange(from, tailTo));
- finished = true;
- }
- }
- }
-
- return removedTimeRanges;
- }
-
- /**
- * timerangeIterator()
- *
- * @since 06.02.2006 - tha@bsiag.com
- * @return an {@link Iterator} containing elememts of type {@link TimeRange}.
- */
- public TimeRange[] getTimeRanges() {
- return m_multipleTimeRangeMap.values().toArray(new TimeRange[m_multipleTimeRangeMap.size()]);
- }
-
- /**
- * sumDurationOfTimeranges()
- *
- * @since 06.02.2006 - tha@bsiag.com
- */
- public long sumDurationOfTimeranges() {
- long duration = 0;
- for (TimeRange range : getTimeRanges()) {
- duration += range.getTo().getTime() - range.getFrom().getTime();
- }
- return duration;
- }
-
- public boolean isEmpty() {
- return m_multipleTimeRangeMap.isEmpty();
- }
-
- /**
- * getBeginDate()
- *
- * @since 06.02.2006 - tha@bsiag.com
- */
- public Date getBeginDate() {
- if (m_multipleTimeRangeMap.isEmpty()) {
- return null;
- }
- return (m_multipleTimeRangeMap.get(m_multipleTimeRangeMap.firstKey())).getFrom();
- }
-
- /**
- * getEndDate()
- *
- * @since 06.02.2006 - tha@bsiag.com
- */
- public Date getEndDate() {
- if (m_multipleTimeRangeMap.isEmpty()) {
- return null;
- }
- return (m_multipleTimeRangeMap.get(m_multipleTimeRangeMap.lastKey())).getTo();
- }
-
- public boolean contains(Date representedDate) {
- if (representedDate == null || m_multipleTimeRangeMap.isEmpty()) {
- return false;
- }
- Date firstKeyAfterRepresentedDate = new Date(representedDate.getTime() + 1);
- SortedMap headMap = m_multipleTimeRangeMap.headMap(firstKeyAfterRepresentedDate);
- if (headMap.isEmpty()) {
- return false;
- }
- return (m_multipleTimeRangeMap.get(headMap.lastKey())).contains(representedDate);
- }
-
- @Override
- public Object clone() {
- MultiTimeRange m = new MultiTimeRange();
- m.m_multipleTimeRangeMap = new TreeMap<Date, TimeRange>(this.m_multipleTimeRangeMap);
- return m;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.activitymap;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.SortedMap;
+import java.util.TreeMap;
+
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.basic.calendar.AbstractCalendar;
+
+/**
+ * Description: Allows to store multiple time ranges. There
+ * are no overlapping on the stored ranges.
+ * <p>
+ * e.g. {'1.1.2006 13:00'-'1.1.2006 14:00', '2.1.2006 12:00'-'3.1.2006 12:00'} Copyright (c) 2006 BSI AG Company: BSI AG
+ * - www.bsiag.com
+ *
+ * @since 03.02.2006
+ * @version 1.0
+ */
+class MultiTimeRange implements Cloneable {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractCalendar.class);
+
+ private TreeMap<Date/* fromDate */, TimeRange> m_multipleTimeRangeMap = new TreeMap<Date, TimeRange>();
+
+ public MultiTimeRange() {
+ }
+
+ /**
+ * add a time range to this timerange-collection.
+ * <p>
+ * if the new time range has overlappings with stored timeranges, the collection is updated accordingly.
+ * <p>
+ * restrictions: from and to must not be <code>null</code>. from < to.
+ *
+ * @param from
+ * @param to
+ * @return the really added {@link TimeRange}s.
+ * @throws IllegalArgumentException
+ * @since 03.02.2006 - tha@bsiag.com
+ */
+ public MultiTimeRange add(Date from, Date to) {
+ checkParams(from, to);
+ MultiTimeRange addedTimeRanges = new MultiTimeRange();
+ addedTimeRanges.internalPutNoOldEntry(from, to);
+ /* check overlapping */
+ SortedMap<Date, TimeRange> headMap = m_multipleTimeRangeMap.headMap(to);
+ boolean first = true;
+ boolean finished = false;
+ while (!finished && !headMap.isEmpty()) {
+ final Object tailKey = headMap.lastKey();
+ final TimeRange tail = headMap.get(tailKey);
+ final Date tailTo = tail.getTo();
+ if (first) {
+ first = false;
+ /* check old_to > new_to */
+ if (tailTo.after(to)) {
+ to = tailTo;
+ }
+ }
+ final Date tailFrom = tail.getFrom();
+ /* check no overlap */
+ if (tailTo.before(from)) {
+ finished = true;
+ }
+ else {
+ /* check old_from < new_from */
+ if (tailFrom.before(from)) {
+ finished = true;
+ from = tailFrom;
+ }
+ m_multipleTimeRangeMap.remove(tailKey);
+ addedTimeRanges.remove(tailFrom, tailTo);
+ }
+ }
+ internalPutNoOldEntry(from, to);
+ return addedTimeRanges;
+ }
+
+ public void setSingleTimerange(Date from, Date to) {
+ m_multipleTimeRangeMap = new TreeMap<Date, TimeRange>();
+ internalPutNoOldEntry(from, to);
+ }
+
+ private void internalPutNoOldEntry(Date from, Date to) {
+ try {
+ checkParams(from, to);
+ }
+ catch (IllegalArgumentException iaex) {
+ LOG.debug("adding [" + from + ", " + to + "] failed: " + iaex);
+ return;
+ }
+ Object oldEntry = m_multipleTimeRangeMap.put(from, new TimeRange(from, to));
+ if (oldEntry != null) {
+ throw new RuntimeException("Error: should not have an entry for key: " + from);
+ }
+ }
+
+ private void checkParams(Date from, Date to) {
+ if (from == null || to == null) {
+ throw new IllegalArgumentException("from and to must not be null.");
+ }
+ if (!to.after(from)) {
+ throw new IllegalArgumentException("time range must be > 0.");
+ }
+ }
+
+ /**
+ * removes the given time range from the stored ones.
+ * <p>
+ * calculates overlapping and rearranges correspondingly.
+ * <p>
+ * restrictions: from and to must not be <code>null</code>. from < to.
+ *
+ * @param from
+ * @param to
+ * @return
+ * @since 03.02.2006 - tha@bsiag.com
+ */
+ public Collection remove(Date from, Date to) {
+ checkParams(from, to);
+ ArrayList<TimeRange> removedTimeRanges = new ArrayList<TimeRange>();
+ /* check overlapping */
+ SortedMap<Date, TimeRange> headMap = m_multipleTimeRangeMap.headMap(to);
+ boolean finished = false;
+ while (!finished && !headMap.isEmpty()) {
+ final Object tailKey = headMap.lastKey();
+ final TimeRange tail = headMap.get(tailKey);
+ final Date tailTo = tail.getTo();
+ final Date tailFrom = tail.getFrom();
+
+ if (tailTo.after(to) && tailFrom.before(to)) {
+ /* tail range overlaps our to-time. we have to replace the tail element. */
+ m_multipleTimeRangeMap.remove(tailKey);
+ if (tailFrom.before(from)) {
+ /* case that tail is bigger then given range on both sides! */
+ removedTimeRanges.add(new TimeRange(from, to));
+ internalPutNoOldEntry(tailFrom, from);
+ internalPutNoOldEntry(to, tailTo);
+ finished = true;
+ }
+ else {
+ /* normal overlapping after given range */
+ removedTimeRanges.add(new TimeRange(tailFrom, to));
+ internalPutNoOldEntry(to, tailTo);
+ }
+ }
+ else {
+ /* tail range does not overlap our to-time. */
+ if (from.after(tailTo)) {
+ finished = true;
+ }
+ else if (tailFrom.after(from)) {
+ removedTimeRanges.add(m_multipleTimeRangeMap.remove(tailKey));
+ }
+ else {
+ /* tail range overlaps our from-time. we have to replace tail element. */
+ m_multipleTimeRangeMap.remove(tailKey);
+ internalPutNoOldEntry(tailFrom, from);
+ removedTimeRanges.add(new TimeRange(from, tailTo));
+ finished = true;
+ }
+ }
+ }
+
+ return removedTimeRanges;
+ }
+
+ /**
+ * timerangeIterator()
+ *
+ * @since 06.02.2006 - tha@bsiag.com
+ * @return an {@link Iterator} containing elememts of type {@link TimeRange}.
+ */
+ public TimeRange[] getTimeRanges() {
+ return m_multipleTimeRangeMap.values().toArray(new TimeRange[m_multipleTimeRangeMap.size()]);
+ }
+
+ /**
+ * sumDurationOfTimeranges()
+ *
+ * @since 06.02.2006 - tha@bsiag.com
+ */
+ public long sumDurationOfTimeranges() {
+ long duration = 0;
+ for (TimeRange range : getTimeRanges()) {
+ duration += range.getTo().getTime() - range.getFrom().getTime();
+ }
+ return duration;
+ }
+
+ public boolean isEmpty() {
+ return m_multipleTimeRangeMap.isEmpty();
+ }
+
+ /**
+ * getBeginDate()
+ *
+ * @since 06.02.2006 - tha@bsiag.com
+ */
+ public Date getBeginDate() {
+ if (m_multipleTimeRangeMap.isEmpty()) {
+ return null;
+ }
+ return (m_multipleTimeRangeMap.get(m_multipleTimeRangeMap.firstKey())).getFrom();
+ }
+
+ /**
+ * getEndDate()
+ *
+ * @since 06.02.2006 - tha@bsiag.com
+ */
+ public Date getEndDate() {
+ if (m_multipleTimeRangeMap.isEmpty()) {
+ return null;
+ }
+ return (m_multipleTimeRangeMap.get(m_multipleTimeRangeMap.lastKey())).getTo();
+ }
+
+ public boolean contains(Date representedDate) {
+ if (representedDate == null || m_multipleTimeRangeMap.isEmpty()) {
+ return false;
+ }
+ Date firstKeyAfterRepresentedDate = new Date(representedDate.getTime() + 1);
+ SortedMap headMap = m_multipleTimeRangeMap.headMap(firstKeyAfterRepresentedDate);
+ if (headMap.isEmpty()) {
+ return false;
+ }
+ return (m_multipleTimeRangeMap.get(headMap.lastKey())).contains(representedDate);
+ }
+
+ @Override
+ public Object clone() {
+ MultiTimeRange m = new MultiTimeRange();
+ m.m_multipleTimeRangeMap = new TreeMap<Date, TimeRange>(this.m_multipleTimeRangeMap);
+ return m;
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/TestTimeScaleBuilder.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/TestTimeScaleBuilder.java
index 6c8700ba4f..e455990562 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/TestTimeScaleBuilder.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/TestTimeScaleBuilder.java
@@ -1,30 +1,30 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.activitymap;
-
-import java.util.Date;
-
-public final class TestTimeScaleBuilder {
-
- private TestTimeScaleBuilder() {
- }
-
- public static void main(String[] args) {
- IActivityMap map = new AbstractActivityMap() {
-
- };
- map.setDays(new Date[]{new Date(), new Date(System.currentTimeMillis() + 1000L * 3600L * 24L * 5), new Date(System.currentTimeMillis() + 1000L * 3600L * 24L * 7)});
- TimeScale scale = new TimeScaleBuilder(map).build();
- System.out.println("small: " + scale.toString(TimeScale.SMALL));
- System.out.println("medium: " + scale.toString(TimeScale.MEDIUM));
- System.out.println("large: " + scale.toString(TimeScale.LARGE));
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.activitymap;
+
+import java.util.Date;
+
+public final class TestTimeScaleBuilder {
+
+ private TestTimeScaleBuilder() {
+ }
+
+ public static void main(String[] args) {
+ IActivityMap map = new AbstractActivityMap() {
+
+ };
+ map.setDays(new Date[]{new Date(), new Date(System.currentTimeMillis() + 1000L * 3600L * 24L * 5), new Date(System.currentTimeMillis() + 1000L * 3600L * 24L * 7)});
+ TimeScale scale = new TimeScaleBuilder(map).build();
+ System.out.println("small: " + scale.toString(TimeScale.SMALL));
+ System.out.println("medium: " + scale.toString(TimeScale.MEDIUM));
+ System.out.println("large: " + scale.toString(TimeScale.LARGE));
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/TimeRange.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/TimeRange.java
index ea90307524..eef006f32a 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/TimeRange.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/TimeRange.java
@@ -1,51 +1,51 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.activitymap;
-
-import java.util.Date;
-
-/**
- * Description: Allows to store multiple time ranges. There
- * are no overlapping on the stored ranges.
- * <p>
- * e.g. {'1.1.2006 13:00'-'1.1.2006 14:00', '2.1.2006 12:00'-'3.1.2006 12:00'} Copyright (c) 2006 BSI AG Company: BSI AG
- * - www.bsiag.com
- */
-class TimeRange {
-
- private Date m_from;
- private Date m_to;
-
- public TimeRange(Date from, Date to) {
- m_from = from;
- m_to = to;
- }
-
- public boolean contains(Date representedDate) {
- return !(representedDate.after(m_to) || representedDate.before(m_from));
- }
-
- public Date getFrom() {
- return m_from;
- }
-
- public Date getTo() {
- return m_to;
- }
-
- public long getDurationMillis() {
- return m_to.getTime() - m_from.getTime();
- }
-
- public int getDurationMinutes() {
- return (int) (getDurationMillis() / 60000L);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.activitymap;
+
+import java.util.Date;
+
+/**
+ * Description: Allows to store multiple time ranges. There
+ * are no overlapping on the stored ranges.
+ * <p>
+ * e.g. {'1.1.2006 13:00'-'1.1.2006 14:00', '2.1.2006 12:00'-'3.1.2006 12:00'} Copyright (c) 2006 BSI AG Company: BSI AG
+ * - www.bsiag.com
+ */
+class TimeRange {
+
+ private Date m_from;
+ private Date m_to;
+
+ public TimeRange(Date from, Date to) {
+ m_from = from;
+ m_to = to;
+ }
+
+ public boolean contains(Date representedDate) {
+ return !(representedDate.after(m_to) || representedDate.before(m_from));
+ }
+
+ public Date getFrom() {
+ return m_from;
+ }
+
+ public Date getTo() {
+ return m_to;
+ }
+
+ public long getDurationMillis() {
+ return m_to.getTime() - m_from.getTime();
+ }
+
+ public int getDurationMinutes() {
+ return (int) (getDurationMillis() / 60000L);
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/TimeScale.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/TimeScale.java
index 3cdfa5cec9..078c85867d 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/TimeScale.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/TimeScale.java
@@ -1,309 +1,309 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.activitymap;
-
-import java.text.DateFormat;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.List;
-import java.util.TreeMap;
-
-import org.eclipse.scout.commons.CompositeObject;
-
-/**
- * ui model to represent time column model with a major scale and a minor scale
- * (contained in the major scale)
- */
-public class TimeScale {
- private DateFormat m_dateFormat;
- private final List<MajorTimeColumn> m_childrenUnsorted = new ArrayList<MajorTimeColumn>(0);
- // cache for sorted objects, only access using the provided methods, never
- // access this member directly
- private MajorTimeColumn[] m_majorColumnsSorted;
- private MinorTimeColumn[] m_minorColumnsSorted;
-
- public static final int SMALL = 0;
- public static final int MEDIUM = 1;
- public static final int LARGE = 2;
-
- public TimeScale() {
- }
-
- protected void addMajorColumnNotify(MajorTimeColumn majorCol) {
- m_childrenUnsorted.add(majorCol);
- // clear cache
- m_majorColumnsSorted = null;
- m_minorColumnsSorted = null;
- }
-
- protected void addMinorColumnNotify(MajorTimeColumn majorCol, MinorTimeColumn minorCol) {
- // clear cache
- m_majorColumnsSorted = null;
- m_minorColumnsSorted = null;
- }
-
- public MajorTimeColumn[] getMajorTimeColumns() {
- if (m_majorColumnsSorted == null) {
- TreeMap<CompositeObject, MajorTimeColumn> sortMap = new TreeMap<CompositeObject, MajorTimeColumn>();
- int index = 0;
- for (MajorTimeColumn c : m_childrenUnsorted) {
- MinorTimeColumn[] minorCols = c.getMinorTimeColumns();
- if (minorCols.length > 0) {
- sortMap.put(new CompositeObject(minorCols[0].getBeginTime(), index), c);
- }
- else {
- sortMap.put(new CompositeObject(new Date(), index), c);
- }
- index++;
- }
- m_majorColumnsSorted = sortMap.values().toArray(new MajorTimeColumn[sortMap.size()]);
- }
- return m_majorColumnsSorted;
- }
-
- public MinorTimeColumn[] getMinorTimeColumns() {
- if (m_minorColumnsSorted == null) {
- TreeMap<Date, MinorTimeColumn> sortMap = new TreeMap<Date, MinorTimeColumn>();
- for (MajorTimeColumn c : getMajorTimeColumns()) {
- for (MinorTimeColumn minorCol : c.getMinorTimeColumns()) {
- sortMap.put(minorCol.getBeginTime(), minorCol);
- }
- }
- m_minorColumnsSorted = sortMap.values().toArray(new MinorTimeColumn[sortMap.size()]);
- }
- return m_minorColumnsSorted;
- }
-
- public Date getBeginTime() {
- MinorTimeColumn[] cols = getMinorTimeColumns();
- if (cols.length > 0) {
- return cols[0].getBeginTime();
- }
- return new Date();
- }
-
- public Date getEndTime() {
- MinorTimeColumn[] cols = getMinorTimeColumns();
- if (cols.length > 0) {
- return cols[cols.length - 1].getEndTime();
- }
- return new Date();
- }
-
- public Calendar getBeginCalendar() {
- Calendar cal = Calendar.getInstance();
- cal.setTime(getBeginTime());
- return cal;
- }
-
- public DateFormat getDateFormat() {
- return m_dateFormat;
- }
-
- public void setDateFormat(DateFormat s) {
- m_dateFormat = s;
- }
-
- /**
- * Normalized range [begin,end] of the item The normalized space starts at 0.0
- * and ends at 1.0 Every minor column has the same with in this space
- *
- * @return float[begin,end] or null when item is not intersecting this time
- * scale. May return values <0 or >1 when item is reaching outside of
- * the range
- */
- public double[] getRangeOf(Date beginTime, Date endTime) {
- Integer a = null, b = null;
- a = getStartMinorColumnIndex(beginTime);
- if (a == null) {
- return null;
- }
- if (beginTime.equals(endTime)) {
- b = a;
- }
- if (b == null) {
- b = getEndMinorColumnIndex(endTime);
- }
- if (b == null) {
- return null;
- }
- return new double[]{indexToRange(a)[0], indexToRange(b)[1]};
- }
-
- protected Integer getStartMinorColumnIndex(Date startTime) {
- if (startTime == null) {
- return null;
- }
- if (startTime.before(getBeginTime())) {
- return 0;
- }
- if (startTime.after(getEndTime())) {
- return null;
- }
- MinorTimeColumn[] minCols = getMinorTimeColumns();
- //approach in descending order
- for (int i = minCols.length - 1; i >= 0; i--) {
- if (startTime.compareTo(minCols[i].getBeginTime()) >= 0) {
- return i;
- }
- }
- return null;
- }
-
- protected Integer getEndMinorColumnIndex(Date endTime) {
- if (endTime == null) {
- return null;
- }
- if (endTime.before(getBeginTime())) {
- return null;
- }
- MinorTimeColumn[] minCols = getMinorTimeColumns();
- if (endTime.after(getEndTime())) {
- return getMinorTimeColumns().length - 1;
- }
- //approach in ascending order
- for (int i = 0; i < minCols.length; i++) {
- if (endTime.compareTo(minCols[i].getEndTime()) <= 0) {
- // special handling: the minCols might contain a gap, i.e. the range is not contiguous.
- // In that case, check whether the end date is really in that range. Otherwise, ascribe the date to the previous column.
- // In this case the endTime has to be compared to the beginTime of the column and if the endTime is strictly smaller than
- // the beginTime, the previous column is returned. This is needed because 1ms is subtracted from the end boundary during
- // construction of MinorColumn.
- if (endTime.compareTo(minCols[i].getBeginTime()) < 0) {
- return i > 0 ? i - 1 : null;
- }
- return i;
- }
- }
- return null;
- }
-
- /**
- * Normalized range [begin,end] of the column The normalized space starts at
- * 0.0 and ends at 1.0
- *
- * @return float[begin,end]
- */
- public double[] getRangeOf(MajorTimeColumn column) {
- MinorTimeColumn[] minorCols = column.getMinorTimeColumns();
- if (minorCols.length > 0) {
- return new double[]{getRangeOf(minorCols[0])[0], getRangeOf(minorCols[minorCols.length - 1])[1]};
- }
- else {
- return null;
- }
- }
-
- /**
- * Normalized location [begin,end] of the column The normalized space starts
- * at 0.0 and ends at 1.0
- *
- * @return float[begin,end]
- */
- public double[] getRangeOf(MinorTimeColumn column) {
- MinorTimeColumn[] minCols = getMinorTimeColumns();
- int count = minCols.length;
- for (int i = 0; i < count; i++) {
- if (minCols[i] == column) {
- return indexToRange(i);
- }
- }
- return null;
- }
-
- private double[] indexToRange(int index) {
- int count = getMinorTimeColumns().length;
- return new double[]{1.0 * index / count, 1.0 * (index + 1.0) / count};
- }
-
- private int locationToIndex(double d) {
- int count = getMinorTimeColumns().length;
- if (count == 0) {
- return -1;
- }
- int i = (int) (d * count);
- if (i >= count) {
- i = count - 1;
- }
- else if (i < 0) {
- i = 0;
- }
- return i;
- }
-
- /**
- * Normalized snap to minor column in normalized space
- *
- * @return nearest double for input location
- */
- public double[] snapRange(double normalizedLocation) {
- int i = locationToIndex(normalizedLocation);
- if (i >= 0) {
- return indexToRange(i);
- }
- else {
- return new double[]{0, 0};
- }
- }
-
- /**
- * @return nearest {@link MinorTimeColumn} for normalized location
- */
- public MinorTimeColumn getMinorTimeColumn(double normalizedLocation) {
- MinorTimeColumn[] minorCols = getMinorTimeColumns();
- int i = locationToIndex(normalizedLocation);
- if (i >= 0) {
- return minorCols[i];
- }
- else {
- return null;
- }
- }
-
- public Date getTimeByLocation(double normalizedLocation) {
- int i = locationToIndex(normalizedLocation);
- if (i >= 0) {
- MinorTimeColumn minorCol = getMinorTimeColumns()[i];
- double[] a = indexToRange(i);
- if (normalizedLocation < a[0]) {
- return minorCol.getBeginTime();
- }
- else if (normalizedLocation <= a[1]) {
- double r = (normalizedLocation - a[0]) / (a[1] - a[0]);
- return new Date((long) ((1 - r) * minorCol.getBeginTime().getTime() + r * minorCol.getEndTime().getTime()));
- }
- else {
- return minorCol.getEndTime();
- }
- }
- else {
- return null;
- }
- }
-
- @Override
- public String toString() {
- return toString(LARGE);
- }
-
- public String toString(int size) {
- StringBuilder b = new StringBuilder();
- b.append(getClass().getSimpleName());
- b.append("[");
- for (MajorTimeColumn c : getMajorTimeColumns()) {
- b.append(" ");
- b.append(c.toString(size));
- }
- b.append(" ]");
- return b.toString();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.activitymap;
+
+import java.text.DateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+import java.util.TreeMap;
+
+import org.eclipse.scout.commons.CompositeObject;
+
+/**
+ * ui model to represent time column model with a major scale and a minor scale
+ * (contained in the major scale)
+ */
+public class TimeScale {
+ private DateFormat m_dateFormat;
+ private final List<MajorTimeColumn> m_childrenUnsorted = new ArrayList<MajorTimeColumn>(0);
+ // cache for sorted objects, only access using the provided methods, never
+ // access this member directly
+ private MajorTimeColumn[] m_majorColumnsSorted;
+ private MinorTimeColumn[] m_minorColumnsSorted;
+
+ public static final int SMALL = 0;
+ public static final int MEDIUM = 1;
+ public static final int LARGE = 2;
+
+ public TimeScale() {
+ }
+
+ protected void addMajorColumnNotify(MajorTimeColumn majorCol) {
+ m_childrenUnsorted.add(majorCol);
+ // clear cache
+ m_majorColumnsSorted = null;
+ m_minorColumnsSorted = null;
+ }
+
+ protected void addMinorColumnNotify(MajorTimeColumn majorCol, MinorTimeColumn minorCol) {
+ // clear cache
+ m_majorColumnsSorted = null;
+ m_minorColumnsSorted = null;
+ }
+
+ public MajorTimeColumn[] getMajorTimeColumns() {
+ if (m_majorColumnsSorted == null) {
+ TreeMap<CompositeObject, MajorTimeColumn> sortMap = new TreeMap<CompositeObject, MajorTimeColumn>();
+ int index = 0;
+ for (MajorTimeColumn c : m_childrenUnsorted) {
+ MinorTimeColumn[] minorCols = c.getMinorTimeColumns();
+ if (minorCols.length > 0) {
+ sortMap.put(new CompositeObject(minorCols[0].getBeginTime(), index), c);
+ }
+ else {
+ sortMap.put(new CompositeObject(new Date(), index), c);
+ }
+ index++;
+ }
+ m_majorColumnsSorted = sortMap.values().toArray(new MajorTimeColumn[sortMap.size()]);
+ }
+ return m_majorColumnsSorted;
+ }
+
+ public MinorTimeColumn[] getMinorTimeColumns() {
+ if (m_minorColumnsSorted == null) {
+ TreeMap<Date, MinorTimeColumn> sortMap = new TreeMap<Date, MinorTimeColumn>();
+ for (MajorTimeColumn c : getMajorTimeColumns()) {
+ for (MinorTimeColumn minorCol : c.getMinorTimeColumns()) {
+ sortMap.put(minorCol.getBeginTime(), minorCol);
+ }
+ }
+ m_minorColumnsSorted = sortMap.values().toArray(new MinorTimeColumn[sortMap.size()]);
+ }
+ return m_minorColumnsSorted;
+ }
+
+ public Date getBeginTime() {
+ MinorTimeColumn[] cols = getMinorTimeColumns();
+ if (cols.length > 0) {
+ return cols[0].getBeginTime();
+ }
+ return new Date();
+ }
+
+ public Date getEndTime() {
+ MinorTimeColumn[] cols = getMinorTimeColumns();
+ if (cols.length > 0) {
+ return cols[cols.length - 1].getEndTime();
+ }
+ return new Date();
+ }
+
+ public Calendar getBeginCalendar() {
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(getBeginTime());
+ return cal;
+ }
+
+ public DateFormat getDateFormat() {
+ return m_dateFormat;
+ }
+
+ public void setDateFormat(DateFormat s) {
+ m_dateFormat = s;
+ }
+
+ /**
+ * Normalized range [begin,end] of the item The normalized space starts at 0.0
+ * and ends at 1.0 Every minor column has the same with in this space
+ *
+ * @return float[begin,end] or null when item is not intersecting this time
+ * scale. May return values <0 or >1 when item is reaching outside of
+ * the range
+ */
+ public double[] getRangeOf(Date beginTime, Date endTime) {
+ Integer a = null, b = null;
+ a = getStartMinorColumnIndex(beginTime);
+ if (a == null) {
+ return null;
+ }
+ if (beginTime.equals(endTime)) {
+ b = a;
+ }
+ if (b == null) {
+ b = getEndMinorColumnIndex(endTime);
+ }
+ if (b == null) {
+ return null;
+ }
+ return new double[]{indexToRange(a)[0], indexToRange(b)[1]};
+ }
+
+ protected Integer getStartMinorColumnIndex(Date startTime) {
+ if (startTime == null) {
+ return null;
+ }
+ if (startTime.before(getBeginTime())) {
+ return 0;
+ }
+ if (startTime.after(getEndTime())) {
+ return null;
+ }
+ MinorTimeColumn[] minCols = getMinorTimeColumns();
+ //approach in descending order
+ for (int i = minCols.length - 1; i >= 0; i--) {
+ if (startTime.compareTo(minCols[i].getBeginTime()) >= 0) {
+ return i;
+ }
+ }
+ return null;
+ }
+
+ protected Integer getEndMinorColumnIndex(Date endTime) {
+ if (endTime == null) {
+ return null;
+ }
+ if (endTime.before(getBeginTime())) {
+ return null;
+ }
+ MinorTimeColumn[] minCols = getMinorTimeColumns();
+ if (endTime.after(getEndTime())) {
+ return getMinorTimeColumns().length - 1;
+ }
+ //approach in ascending order
+ for (int i = 0; i < minCols.length; i++) {
+ if (endTime.compareTo(minCols[i].getEndTime()) <= 0) {
+ // special handling: the minCols might contain a gap, i.e. the range is not contiguous.
+ // In that case, check whether the end date is really in that range. Otherwise, ascribe the date to the previous column.
+ // In this case the endTime has to be compared to the beginTime of the column and if the endTime is strictly smaller than
+ // the beginTime, the previous column is returned. This is needed because 1ms is subtracted from the end boundary during
+ // construction of MinorColumn.
+ if (endTime.compareTo(minCols[i].getBeginTime()) < 0) {
+ return i > 0 ? i - 1 : null;
+ }
+ return i;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Normalized range [begin,end] of the column The normalized space starts at
+ * 0.0 and ends at 1.0
+ *
+ * @return float[begin,end]
+ */
+ public double[] getRangeOf(MajorTimeColumn column) {
+ MinorTimeColumn[] minorCols = column.getMinorTimeColumns();
+ if (minorCols.length > 0) {
+ return new double[]{getRangeOf(minorCols[0])[0], getRangeOf(minorCols[minorCols.length - 1])[1]};
+ }
+ else {
+ return null;
+ }
+ }
+
+ /**
+ * Normalized location [begin,end] of the column The normalized space starts
+ * at 0.0 and ends at 1.0
+ *
+ * @return float[begin,end]
+ */
+ public double[] getRangeOf(MinorTimeColumn column) {
+ MinorTimeColumn[] minCols = getMinorTimeColumns();
+ int count = minCols.length;
+ for (int i = 0; i < count; i++) {
+ if (minCols[i] == column) {
+ return indexToRange(i);
+ }
+ }
+ return null;
+ }
+
+ private double[] indexToRange(int index) {
+ int count = getMinorTimeColumns().length;
+ return new double[]{1.0 * index / count, 1.0 * (index + 1.0) / count};
+ }
+
+ private int locationToIndex(double d) {
+ int count = getMinorTimeColumns().length;
+ if (count == 0) {
+ return -1;
+ }
+ int i = (int) (d * count);
+ if (i >= count) {
+ i = count - 1;
+ }
+ else if (i < 0) {
+ i = 0;
+ }
+ return i;
+ }
+
+ /**
+ * Normalized snap to minor column in normalized space
+ *
+ * @return nearest double for input location
+ */
+ public double[] snapRange(double normalizedLocation) {
+ int i = locationToIndex(normalizedLocation);
+ if (i >= 0) {
+ return indexToRange(i);
+ }
+ else {
+ return new double[]{0, 0};
+ }
+ }
+
+ /**
+ * @return nearest {@link MinorTimeColumn} for normalized location
+ */
+ public MinorTimeColumn getMinorTimeColumn(double normalizedLocation) {
+ MinorTimeColumn[] minorCols = getMinorTimeColumns();
+ int i = locationToIndex(normalizedLocation);
+ if (i >= 0) {
+ return minorCols[i];
+ }
+ else {
+ return null;
+ }
+ }
+
+ public Date getTimeByLocation(double normalizedLocation) {
+ int i = locationToIndex(normalizedLocation);
+ if (i >= 0) {
+ MinorTimeColumn minorCol = getMinorTimeColumns()[i];
+ double[] a = indexToRange(i);
+ if (normalizedLocation < a[0]) {
+ return minorCol.getBeginTime();
+ }
+ else if (normalizedLocation <= a[1]) {
+ double r = (normalizedLocation - a[0]) / (a[1] - a[0]);
+ return new Date((long) ((1 - r) * minorCol.getBeginTime().getTime() + r * minorCol.getEndTime().getTime()));
+ }
+ else {
+ return minorCol.getEndTime();
+ }
+ }
+ else {
+ return null;
+ }
+ }
+
+ @Override
+ public String toString() {
+ return toString(LARGE);
+ }
+
+ public String toString(int size) {
+ StringBuilder b = new StringBuilder();
+ b.append(getClass().getSimpleName());
+ b.append("[");
+ for (MajorTimeColumn c : getMajorTimeColumns()) {
+ b.append(" ");
+ b.append(c.toString(size));
+ }
+ b.append(" ]");
+ return b.toString();
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/TimeScaleBuilder.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/TimeScaleBuilder.java
index 67dec5fffc..b6f01368bd 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/TimeScaleBuilder.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/activitymap/TimeScaleBuilder.java
@@ -1,233 +1,233 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.activitymap;
-
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Date;
-
-import org.eclipse.scout.commons.DateUtility;
-import org.eclipse.scout.commons.LocaleThreadLocal;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-
-public class TimeScaleBuilder {
- private IActivityMap m_map;
-
- public TimeScaleBuilder(IActivityMap map) {
- m_map = map;
- }
-
- public TimeScale build() {
- Date[] days = m_map.getDays();
- TimeScale set = null;
- switch (m_map.getPlanningMode()) {
- case IActivityMap.PLANNING_MODE_INTRADAY: {
- set = new IntradayTimeScale();
- buildIntradayScale(days, set);
- break;
- }
- case IActivityMap.PLANNING_MODE_DAY: {
- set = new TimeScale();
- buildDayScale(days, set);
- break;
- }
- case IActivityMap.PLANNING_MODE_WEEK: {
- set = new TimeScale();
- buildWeekScale(days, set);
- break;
- }
- }
- return set;
- }
-
- protected void buildIntradayScale(Date[] days, TimeScale scale) {
- scale.setDateFormat(createIntradayFormatWithWeekDay(DateFormat.LONG, DateFormat.SHORT));
- Calendar timeCal = Calendar.getInstance();
- for (Date d : days) {
- MajorTimeColumn curDayColumn = createMajorDayColumn(scale, d);
- timeCal.setTime(d);
- timeCal.set(Calendar.HOUR_OF_DAY, m_map.getFirstHourOfDay());
- int intervalMinutes = (int) Math.max(1, m_map.getIntradayInterval() / 1000L / 60L);
- int n = (m_map.getLastHourOfDay() - m_map.getFirstHourOfDay() + 1) * 60 / intervalMinutes;
- for (int i = 0; i < n; i++) {
- createMinorIntradayColumn(curDayColumn, timeCal.getTime(), intervalMinutes);
- timeCal.add(Calendar.MINUTE, intervalMinutes);
- }
- }
- }
-
- protected void buildDayScale(Date[] days, TimeScale scale) {
- scale.setDateFormat(createDayFormatWithWeekDay(DateFormat.LONG));
- Calendar dayCal = Calendar.getInstance();
- MajorTimeColumn curMonthColumn = null;
- Calendar curMonthCal = Calendar.getInstance();
- for (Date d : days) {
- dayCal.setTime(d);
- if (curMonthColumn == null || dayCal.get(Calendar.MONTH) != curMonthCal.get(Calendar.MONTH)) {
- curMonthColumn = createMajorMonthColumn(scale, d);
- curMonthCal.setTime(dayCal.getTime());
- DateUtility.truncCalendarToMonth(curMonthCal);
- }
- createMinorDayColumn(curMonthColumn, dayCal.getTime());
- }
- }
-
- protected void buildWeekScale(Date[] days, TimeScale scale) {
- scale.setDateFormat(new SimpleDateFormat("'" + ScoutTexts.get("Week") + "' w, yyyy", LocaleThreadLocal.get()));
- Calendar weekCal = Calendar.getInstance();
- MajorTimeColumn curMonthColumn = null;
- Calendar curMonthCal = Calendar.getInstance();
- for (Date d : days) {
- weekCal.setTime(d);
- if (curMonthColumn == null || weekCal.get(Calendar.MONTH) != curMonthCal.get(Calendar.MONTH)) {
- curMonthColumn = createMajorMonthColumn(scale, d);
- curMonthCal.setTime(weekCal.getTime());
- DateUtility.truncCalendarToMonth(curMonthCal);
- }
- createMinorWeekColumn(curMonthColumn, weekCal.getTime());
- }
- }
-
- protected MajorTimeColumn createMajorMonthColumn(TimeScale scale, Date d) {
- Calendar cal = Calendar.getInstance();
- cal.setTime(d);
- DateUtility.truncCalendarToMonth(cal);
- Date a = cal.getTime();
- // cal.add(Calendar.MONTH,1);
- // Date b=cal.getTime();
- MajorTimeColumn col = new MajorTimeColumn(scale);
- col.setLargeText(new SimpleDateFormat("MMMMM, yyyy", LocaleThreadLocal.get()).format(a));
- col.setMediumText(new SimpleDateFormat("MMM yy", LocaleThreadLocal.get()).format(a));
- col.setSmallText(new SimpleDateFormat("MMM", LocaleThreadLocal.get()).format(a));
- return col;
- }
-
- protected MinorTimeColumn createMinorWeekColumn(MajorTimeColumn parent, Date d) {
- Calendar cal = Calendar.getInstance();
- cal.setTime(d);
- Date a = cal.getTime();
- if (m_map.isWorkDaysOnly()) {
- cal.add(Calendar.DATE, m_map.getWorkDayCount());
- }
- else {
- cal.add(Calendar.WEEK_OF_YEAR, 1);
- }
- cal.setTimeInMillis(cal.getTimeInMillis() - 1);
- Date justBeforeEnd = cal.getTime();
- MinorTimeColumn col = new MinorTimeColumn(parent, a, justBeforeEnd);
- col.setLargeText(new SimpleDateFormat("'" + ScoutTexts.get("Week") + "' w", LocaleThreadLocal.get()).format(a));
- col.setMediumText(new SimpleDateFormat("w", LocaleThreadLocal.get()).format(a));
- col.setSmallText(new SimpleDateFormat("w", LocaleThreadLocal.get()).format(a));
- StringBuilder ttBuf = new StringBuilder();
- ttBuf.append(new SimpleDateFormat("EEEEE", LocaleThreadLocal.get()).format(a));
- ttBuf.append(", ");
- ttBuf.append(DateFormat.getDateInstance(DateFormat.LONG, LocaleThreadLocal.get()).format(a));
- ttBuf.append(" - ");
- ttBuf.append(new SimpleDateFormat("EEEEE", LocaleThreadLocal.get()).format(justBeforeEnd));
- ttBuf.append(", ");
- ttBuf.append(DateFormat.getDateInstance(DateFormat.LONG, LocaleThreadLocal.get()).format(justBeforeEnd));
- col.setTooltipText(ttBuf.toString());
- return col;
- }
-
- protected MajorTimeColumn createMajorDayColumn(TimeScale scale, Date d) {
- Calendar cal = Calendar.getInstance();
- cal.setTime(d);
- cal.set(Calendar.HOUR_OF_DAY, m_map.getFirstHourOfDay());
- Date a = cal.getTime();
- // cal.set(Calendar.HOUR_OF_DAY,m_map.getLastHourOfDay()+1);
- // Date b=cal.getTime();
- MajorTimeColumn col = new MajorTimeColumn(scale);
- col.setLargeText(createDayFormatWithWeekDay(DateFormat.MEDIUM).format(a));
- col.setMediumText(DateFormat.getDateInstance(DateFormat.SHORT, LocaleThreadLocal.get()).format(a));
- col.setSmallText(new SimpleDateFormat("dd.MM.", LocaleThreadLocal.get()).format(a));
- return col;
- }
-
- protected MinorTimeColumn createMinorDayColumn(MajorTimeColumn parent, Date d) {
- Calendar cal = Calendar.getInstance();
- cal.setTime(d);
- Date a = cal.getTime();
- cal.add(Calendar.DATE, 1);
- cal.setTimeInMillis(cal.getTimeInMillis() - 1);
- Date justBeforeEnd = cal.getTime();
- MinorTimeColumn col = new MinorTimeColumn(parent, a, justBeforeEnd);
- col.setLargeText(new SimpleDateFormat("dd", LocaleThreadLocal.get()).format(a));
- col.setMediumText(new SimpleDateFormat("dd", LocaleThreadLocal.get()).format(a));
- col.setSmallText(new SimpleDateFormat("dd", LocaleThreadLocal.get()).format(a));
- StringBuilder ttBuf = new StringBuilder();
- ttBuf.append(new SimpleDateFormat("EEEEE", LocaleThreadLocal.get()).format(a));
- ttBuf.append(", ");
- ttBuf.append(DateFormat.getDateInstance(DateFormat.LONG, LocaleThreadLocal.get()).format(a));
- col.setTooltipText(ttBuf.toString());
- return col;
- }
-
- protected MinorTimeColumn createMinorIntradayColumn(MajorTimeColumn parent, Date d, int durationInMinutes) {
- Calendar cal = Calendar.getInstance();
- cal.setTime(d);
- int hour = -1;
- if (cal.get(Calendar.MINUTE) == 0) {
- hour = cal.get(Calendar.HOUR_OF_DAY);
- }
- Date a = cal.getTime();
- cal.add(Calendar.MINUTE, durationInMinutes);
- Date b = cal.getTime();
- Date justBeforeEnd = b;
- MinorTimeColumn col = new MinorTimeColumn(parent, a, b);
- if (hour >= 0) {
- col.setLargeText(new SimpleDateFormat("HH:mm", LocaleThreadLocal.get()).format(a));
- if (hour == m_map.getFirstHourOfDay() || hour == 12) {
- col.setMediumText(new SimpleDateFormat("HH:mm", LocaleThreadLocal.get()).format(a));
- }
- col.setSmallText("");
- }
- StringBuilder ttBuf = new StringBuilder();
- ttBuf.append(new SimpleDateFormat("EEEEE", LocaleThreadLocal.get()).format(a));
- ttBuf.append(", ");
- ttBuf.append(DateFormat.getDateInstance(DateFormat.LONG, LocaleThreadLocal.get()).format(a));
- ttBuf.append(", ");
- ttBuf.append(new SimpleDateFormat("HH:mm", LocaleThreadLocal.get()).format(a));
- ttBuf.append(" - ");
- ttBuf.append(new SimpleDateFormat("HH:mm", LocaleThreadLocal.get()).format(justBeforeEnd));
- col.setTooltipText(ttBuf.toString());
- return col;
- }
-
- protected SimpleDateFormat createDayFormatWithWeekDay(int dateStyle) {
- String pat;
- DateFormat df = DateFormat.getDateInstance(dateStyle, LocaleThreadLocal.get());
- if (df instanceof SimpleDateFormat) {
- pat = ((SimpleDateFormat) df).toPattern();
- }
- else {
- pat = "dd.MM.yyyy";
- }
- pat = "EE " + pat;
- //
- return new SimpleDateFormat(pat, LocaleThreadLocal.get());
- }
-
- protected SimpleDateFormat createIntradayFormatWithWeekDay(int dateStyle, int timeStyle) {
- String pat;
- DateFormat df = DateFormat.getDateTimeInstance(dateStyle, timeStyle, LocaleThreadLocal.get());
- if (df instanceof SimpleDateFormat) {
- pat = ((SimpleDateFormat) df).toPattern();
- }
- else {
- pat = "dd.MM.yyyy HH:mm";
- }
- pat = "EE " + pat;
- return new SimpleDateFormat(pat, LocaleThreadLocal.get());
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.activitymap;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+
+import org.eclipse.scout.commons.DateUtility;
+import org.eclipse.scout.commons.LocaleThreadLocal;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+
+public class TimeScaleBuilder {
+ private IActivityMap m_map;
+
+ public TimeScaleBuilder(IActivityMap map) {
+ m_map = map;
+ }
+
+ public TimeScale build() {
+ Date[] days = m_map.getDays();
+ TimeScale set = null;
+ switch (m_map.getPlanningMode()) {
+ case IActivityMap.PLANNING_MODE_INTRADAY: {
+ set = new IntradayTimeScale();
+ buildIntradayScale(days, set);
+ break;
+ }
+ case IActivityMap.PLANNING_MODE_DAY: {
+ set = new TimeScale();
+ buildDayScale(days, set);
+ break;
+ }
+ case IActivityMap.PLANNING_MODE_WEEK: {
+ set = new TimeScale();
+ buildWeekScale(days, set);
+ break;
+ }
+ }
+ return set;
+ }
+
+ protected void buildIntradayScale(Date[] days, TimeScale scale) {
+ scale.setDateFormat(createIntradayFormatWithWeekDay(DateFormat.LONG, DateFormat.SHORT));
+ Calendar timeCal = Calendar.getInstance();
+ for (Date d : days) {
+ MajorTimeColumn curDayColumn = createMajorDayColumn(scale, d);
+ timeCal.setTime(d);
+ timeCal.set(Calendar.HOUR_OF_DAY, m_map.getFirstHourOfDay());
+ int intervalMinutes = (int) Math.max(1, m_map.getIntradayInterval() / 1000L / 60L);
+ int n = (m_map.getLastHourOfDay() - m_map.getFirstHourOfDay() + 1) * 60 / intervalMinutes;
+ for (int i = 0; i < n; i++) {
+ createMinorIntradayColumn(curDayColumn, timeCal.getTime(), intervalMinutes);
+ timeCal.add(Calendar.MINUTE, intervalMinutes);
+ }
+ }
+ }
+
+ protected void buildDayScale(Date[] days, TimeScale scale) {
+ scale.setDateFormat(createDayFormatWithWeekDay(DateFormat.LONG));
+ Calendar dayCal = Calendar.getInstance();
+ MajorTimeColumn curMonthColumn = null;
+ Calendar curMonthCal = Calendar.getInstance();
+ for (Date d : days) {
+ dayCal.setTime(d);
+ if (curMonthColumn == null || dayCal.get(Calendar.MONTH) != curMonthCal.get(Calendar.MONTH)) {
+ curMonthColumn = createMajorMonthColumn(scale, d);
+ curMonthCal.setTime(dayCal.getTime());
+ DateUtility.truncCalendarToMonth(curMonthCal);
+ }
+ createMinorDayColumn(curMonthColumn, dayCal.getTime());
+ }
+ }
+
+ protected void buildWeekScale(Date[] days, TimeScale scale) {
+ scale.setDateFormat(new SimpleDateFormat("'" + ScoutTexts.get("Week") + "' w, yyyy", LocaleThreadLocal.get()));
+ Calendar weekCal = Calendar.getInstance();
+ MajorTimeColumn curMonthColumn = null;
+ Calendar curMonthCal = Calendar.getInstance();
+ for (Date d : days) {
+ weekCal.setTime(d);
+ if (curMonthColumn == null || weekCal.get(Calendar.MONTH) != curMonthCal.get(Calendar.MONTH)) {
+ curMonthColumn = createMajorMonthColumn(scale, d);
+ curMonthCal.setTime(weekCal.getTime());
+ DateUtility.truncCalendarToMonth(curMonthCal);
+ }
+ createMinorWeekColumn(curMonthColumn, weekCal.getTime());
+ }
+ }
+
+ protected MajorTimeColumn createMajorMonthColumn(TimeScale scale, Date d) {
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(d);
+ DateUtility.truncCalendarToMonth(cal);
+ Date a = cal.getTime();
+ // cal.add(Calendar.MONTH,1);
+ // Date b=cal.getTime();
+ MajorTimeColumn col = new MajorTimeColumn(scale);
+ col.setLargeText(new SimpleDateFormat("MMMMM, yyyy", LocaleThreadLocal.get()).format(a));
+ col.setMediumText(new SimpleDateFormat("MMM yy", LocaleThreadLocal.get()).format(a));
+ col.setSmallText(new SimpleDateFormat("MMM", LocaleThreadLocal.get()).format(a));
+ return col;
+ }
+
+ protected MinorTimeColumn createMinorWeekColumn(MajorTimeColumn parent, Date d) {
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(d);
+ Date a = cal.getTime();
+ if (m_map.isWorkDaysOnly()) {
+ cal.add(Calendar.DATE, m_map.getWorkDayCount());
+ }
+ else {
+ cal.add(Calendar.WEEK_OF_YEAR, 1);
+ }
+ cal.setTimeInMillis(cal.getTimeInMillis() - 1);
+ Date justBeforeEnd = cal.getTime();
+ MinorTimeColumn col = new MinorTimeColumn(parent, a, justBeforeEnd);
+ col.setLargeText(new SimpleDateFormat("'" + ScoutTexts.get("Week") + "' w", LocaleThreadLocal.get()).format(a));
+ col.setMediumText(new SimpleDateFormat("w", LocaleThreadLocal.get()).format(a));
+ col.setSmallText(new SimpleDateFormat("w", LocaleThreadLocal.get()).format(a));
+ StringBuilder ttBuf = new StringBuilder();
+ ttBuf.append(new SimpleDateFormat("EEEEE", LocaleThreadLocal.get()).format(a));
+ ttBuf.append(", ");
+ ttBuf.append(DateFormat.getDateInstance(DateFormat.LONG, LocaleThreadLocal.get()).format(a));
+ ttBuf.append(" - ");
+ ttBuf.append(new SimpleDateFormat("EEEEE", LocaleThreadLocal.get()).format(justBeforeEnd));
+ ttBuf.append(", ");
+ ttBuf.append(DateFormat.getDateInstance(DateFormat.LONG, LocaleThreadLocal.get()).format(justBeforeEnd));
+ col.setTooltipText(ttBuf.toString());
+ return col;
+ }
+
+ protected MajorTimeColumn createMajorDayColumn(TimeScale scale, Date d) {
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(d);
+ cal.set(Calendar.HOUR_OF_DAY, m_map.getFirstHourOfDay());
+ Date a = cal.getTime();
+ // cal.set(Calendar.HOUR_OF_DAY,m_map.getLastHourOfDay()+1);
+ // Date b=cal.getTime();
+ MajorTimeColumn col = new MajorTimeColumn(scale);
+ col.setLargeText(createDayFormatWithWeekDay(DateFormat.MEDIUM).format(a));
+ col.setMediumText(DateFormat.getDateInstance(DateFormat.SHORT, LocaleThreadLocal.get()).format(a));
+ col.setSmallText(new SimpleDateFormat("dd.MM.", LocaleThreadLocal.get()).format(a));
+ return col;
+ }
+
+ protected MinorTimeColumn createMinorDayColumn(MajorTimeColumn parent, Date d) {
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(d);
+ Date a = cal.getTime();
+ cal.add(Calendar.DATE, 1);
+ cal.setTimeInMillis(cal.getTimeInMillis() - 1);
+ Date justBeforeEnd = cal.getTime();
+ MinorTimeColumn col = new MinorTimeColumn(parent, a, justBeforeEnd);
+ col.setLargeText(new SimpleDateFormat("dd", LocaleThreadLocal.get()).format(a));
+ col.setMediumText(new SimpleDateFormat("dd", LocaleThreadLocal.get()).format(a));
+ col.setSmallText(new SimpleDateFormat("dd", LocaleThreadLocal.get()).format(a));
+ StringBuilder ttBuf = new StringBuilder();
+ ttBuf.append(new SimpleDateFormat("EEEEE", LocaleThreadLocal.get()).format(a));
+ ttBuf.append(", ");
+ ttBuf.append(DateFormat.getDateInstance(DateFormat.LONG, LocaleThreadLocal.get()).format(a));
+ col.setTooltipText(ttBuf.toString());
+ return col;
+ }
+
+ protected MinorTimeColumn createMinorIntradayColumn(MajorTimeColumn parent, Date d, int durationInMinutes) {
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(d);
+ int hour = -1;
+ if (cal.get(Calendar.MINUTE) == 0) {
+ hour = cal.get(Calendar.HOUR_OF_DAY);
+ }
+ Date a = cal.getTime();
+ cal.add(Calendar.MINUTE, durationInMinutes);
+ Date b = cal.getTime();
+ Date justBeforeEnd = b;
+ MinorTimeColumn col = new MinorTimeColumn(parent, a, b);
+ if (hour >= 0) {
+ col.setLargeText(new SimpleDateFormat("HH:mm", LocaleThreadLocal.get()).format(a));
+ if (hour == m_map.getFirstHourOfDay() || hour == 12) {
+ col.setMediumText(new SimpleDateFormat("HH:mm", LocaleThreadLocal.get()).format(a));
+ }
+ col.setSmallText("");
+ }
+ StringBuilder ttBuf = new StringBuilder();
+ ttBuf.append(new SimpleDateFormat("EEEEE", LocaleThreadLocal.get()).format(a));
+ ttBuf.append(", ");
+ ttBuf.append(DateFormat.getDateInstance(DateFormat.LONG, LocaleThreadLocal.get()).format(a));
+ ttBuf.append(", ");
+ ttBuf.append(new SimpleDateFormat("HH:mm", LocaleThreadLocal.get()).format(a));
+ ttBuf.append(" - ");
+ ttBuf.append(new SimpleDateFormat("HH:mm", LocaleThreadLocal.get()).format(justBeforeEnd));
+ col.setTooltipText(ttBuf.toString());
+ return col;
+ }
+
+ protected SimpleDateFormat createDayFormatWithWeekDay(int dateStyle) {
+ String pat;
+ DateFormat df = DateFormat.getDateInstance(dateStyle, LocaleThreadLocal.get());
+ if (df instanceof SimpleDateFormat) {
+ pat = ((SimpleDateFormat) df).toPattern();
+ }
+ else {
+ pat = "dd.MM.yyyy";
+ }
+ pat = "EE " + pat;
+ //
+ return new SimpleDateFormat(pat, LocaleThreadLocal.get());
+ }
+
+ protected SimpleDateFormat createIntradayFormatWithWeekDay(int dateStyle, int timeStyle) {
+ String pat;
+ DateFormat df = DateFormat.getDateTimeInstance(dateStyle, timeStyle, LocaleThreadLocal.get());
+ if (df instanceof SimpleDateFormat) {
+ pat = ((SimpleDateFormat) df).toPattern();
+ }
+ else {
+ pat = "dd.MM.yyyy HH:mm";
+ }
+ pat = "EE " + pat;
+ return new SimpleDateFormat(pat, LocaleThreadLocal.get());
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/calendar/CalendarAdapter.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/calendar/CalendarAdapter.java
index 038554a222..f03f770888 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/calendar/CalendarAdapter.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/calendar/CalendarAdapter.java
@@ -1,29 +1,29 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.calendar;
-
-/**
- * inside gui handling or in non-model threads don't use this adapter because it
- * might reduce performance when batch events are handled as single events
- */
-public class CalendarAdapter implements CalendarListener {
-
- @Override
- public void calendarChangedBatch(CalendarEvent[] batch) {
- for (int i = 0; i < batch.length; i++) {
- calendarChanged(batch[i]);
- }
- }
-
- @Override
- public void calendarChanged(CalendarEvent e) {
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.calendar;
+
+/**
+ * inside gui handling or in non-model threads don't use this adapter because it
+ * might reduce performance when batch events are handled as single events
+ */
+public class CalendarAdapter implements CalendarListener {
+
+ @Override
+ public void calendarChangedBatch(CalendarEvent[] batch) {
+ for (int i = 0; i < batch.length; i++) {
+ calendarChanged(batch[i]);
+ }
+ }
+
+ @Override
+ public void calendarChanged(CalendarEvent e) {
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/calendar/CalendarComponent.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/calendar/CalendarComponent.java
index 116b9ab29d..29440a0ab3 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/calendar/CalendarComponent.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/calendar/CalendarComponent.java
@@ -1,223 +1,223 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.calendar;
-
-import java.text.DateFormat;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
-
-import org.eclipse.scout.commons.DateUtility;
-import org.eclipse.scout.rt.client.ui.basic.calendar.provider.ICalendarItemProvider;
-import org.eclipse.scout.rt.client.ui.basic.cell.ICell;
-import org.eclipse.scout.rt.shared.services.common.calendar.ICalendarAppointment;
-import org.eclipse.scout.rt.shared.services.common.calendar.ICalendarItem;
-import org.eclipse.scout.rt.shared.services.common.calendar.ICalendarTask;
-
-public class CalendarComponent {
- private ICalendar m_calendar;
- private ICalendarItemProvider m_producer;
- private ICalendarItem m_item;
- private ICell m_cell;
- // cache
- private Date m_fromDate;
- private Date m_toDate;
- private Date[] m_coveredDays;
- private boolean m_fullDay;
-
- protected CalendarComponent(ICalendar calendar, ICalendarItemProvider producer, ICalendarItem item, ICell cell) {
- m_calendar = calendar;
- m_producer = producer;
- m_item = item;
- m_cell = cell;
- // cache FROM date
- Date d = null;
- if (m_item instanceof ICalendarAppointment) {
- ICalendarAppointment app = (ICalendarAppointment) m_item;
- d = DateUtility.min(app.getStart(), app.getEnd());
- }
- if (m_item instanceof ICalendarTask) {
- ICalendarTask task = (ICalendarTask) m_item;
- d = DateUtility.min(task.getStart(), task.getDue(), task.getComplete());
- }
- //
- if (d == null) {
- d = new Date(0);
- }
- m_fromDate = d;
- // cache TO date
- d = null;
- if (m_item instanceof ICalendarAppointment) {
- ICalendarAppointment app = (ICalendarAppointment) m_item;
- d = DateUtility.max(app.getStart(), app.getEnd());
- }
- if (m_item instanceof ICalendarTask) {
- ICalendarTask task = (ICalendarTask) m_item;
- d = DateUtility.max(task.getStart(), task.getDue(), task.getComplete());
- }
- //
- if (d == null) {
- d = new Date(0);
- }
- m_toDate = d;
- // cache covered days
- ArrayList<Date> dayList = new ArrayList<Date>();
- Calendar a = Calendar.getInstance();
- a.setTime(m_fromDate);
- DateUtility.truncCalendar(a);
- Calendar b = Calendar.getInstance();
- b.setTime(m_toDate);
- DateUtility.truncCalendar(b);
- while (a.compareTo(b) <= 0) {
- dayList.add(a.getTime());
- a.add(Calendar.DATE, 1);
- }
- m_coveredDays = DateUtility.getCoveredDays(m_fromDate, m_toDate);
- // cache full day flag
- if (m_item instanceof ICalendarAppointment) {
- m_fullDay = ((ICalendarAppointment) m_item).isFullDay();
- }
- else if (m_item instanceof ICalendarTask) {
- m_fullDay = true;
- }
- else {
- m_fullDay = true;
- }
- }
-
- public ICell getCell() {
- return m_cell;
- }
-
- public ICalendarItem getItem() {
- return m_item;
- }
-
- /**
- * producer that created the item in this component
- */
- public ICalendarItemProvider getProvider() {
- return m_producer;
- }
-
- public ICalendar getCalendar() {
- return m_calendar;
- }
-
- /**
- * Convenience for getting the start date of the item Guaranteed to be never
- * null
- */
- public Date getFromDate() {
- return m_fromDate;
- }
-
- /**
- * Convenience for getting the end date of the item Guaranteed to be never
- * null
- */
- public Date getToDate() {
- return m_toDate;
- }
-
- /**
- * Convenience for getting the specific (composite) displayed label of an item
- * for a specific day This includes the start date, the end date and the label
- * of the item
- */
- public String getLabel(Date day) {
- /* day=DateUtility.truncDate(day); */
- switch (m_calendar.getDisplayMode()) {
- case ICalendar.DISPLAY_MODE_MONTH: {
- return m_cell.getText();
- }
- case ICalendar.DISPLAY_MODE_WEEK:
- case ICalendar.DISPLAY_MODE_WORKWEEK: {
- return m_cell.getText();
- }
- case ICalendar.DISPLAY_MODE_DAY: {
- return m_cell.getText();
- }
- default: {
- return m_cell.getText();
- }
- }
- }
-
- /**
- * Convenience for getting the specific (composite) displayed tooltip of an
- * item for a specific day This includes the start date, the end date and the
- * label of the item
- */
- public String getTooltip(Date day) {
- day = DateUtility.truncDate(day);
- String s = createDayTooltip(day);
- String s2 = m_cell.getTooltipText();
- if (s2 != null && s2.length() > 0) {
- s = s + "\n" + s2;
- }
- return s;
- }
-
- /**
- * Convenience for getting all days this item is covering the dates returned
- * have all time 00:00:00
- */
- public Date[] getCoveredDays() {
- return m_coveredDays;
- }
-
- private String createDayTooltip(Date dayTruncated) {
- Date a = getFromDate();
- Date b = getToDate();
- DateFormat timeFmt = m_calendar.getDateTimeFormatFactory().getHourMinute();
- DateFormat dayFmt = m_calendar.getDateTimeFormatFactory().getDayMonth(DateFormat.MEDIUM);
- if (m_coveredDays.length == 1) {
- if (isFullDay()) {
- return m_cell.getText();
- }
- else if (DateUtility.equals(a, b)) {
- if (DateUtility.equals(a, dayTruncated)) {
- // the date is at 00:00 so probably time is irrelevant
- return m_cell.getText();
- }
- else {
- return timeFmt.format(a) + " " + m_cell.getText();
- }
- }
- else {
- return timeFmt.format(a) + "-" + timeFmt.format(b) + " " + m_cell.getText();
- }
- }
- else {// not just one day
- if (isFullDay()) {
- return dayFmt.format(a) + " - " + dayFmt.format(b) + " " + m_cell.getText();
- }
- else {
- return dayFmt.format(a) + " " + timeFmt.format(a) + " - " + dayFmt.format(b) + " " + timeFmt.format(b) + " " + m_cell.getText();
- }
- }
- }
-
- /**
- * Convenience for getting the full day flag (if applicable) of the item
- */
- public boolean isFullDay() {
- return m_fullDay;
- }
-
- /**
- * Convenience for getting the draggable property from the item producer
- */
- public boolean isDraggable() {
- return m_producer.isMoveItemEnabled();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.calendar;
+
+import java.text.DateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+
+import org.eclipse.scout.commons.DateUtility;
+import org.eclipse.scout.rt.client.ui.basic.calendar.provider.ICalendarItemProvider;
+import org.eclipse.scout.rt.client.ui.basic.cell.ICell;
+import org.eclipse.scout.rt.shared.services.common.calendar.ICalendarAppointment;
+import org.eclipse.scout.rt.shared.services.common.calendar.ICalendarItem;
+import org.eclipse.scout.rt.shared.services.common.calendar.ICalendarTask;
+
+public class CalendarComponent {
+ private ICalendar m_calendar;
+ private ICalendarItemProvider m_producer;
+ private ICalendarItem m_item;
+ private ICell m_cell;
+ // cache
+ private Date m_fromDate;
+ private Date m_toDate;
+ private Date[] m_coveredDays;
+ private boolean m_fullDay;
+
+ protected CalendarComponent(ICalendar calendar, ICalendarItemProvider producer, ICalendarItem item, ICell cell) {
+ m_calendar = calendar;
+ m_producer = producer;
+ m_item = item;
+ m_cell = cell;
+ // cache FROM date
+ Date d = null;
+ if (m_item instanceof ICalendarAppointment) {
+ ICalendarAppointment app = (ICalendarAppointment) m_item;
+ d = DateUtility.min(app.getStart(), app.getEnd());
+ }
+ if (m_item instanceof ICalendarTask) {
+ ICalendarTask task = (ICalendarTask) m_item;
+ d = DateUtility.min(task.getStart(), task.getDue(), task.getComplete());
+ }
+ //
+ if (d == null) {
+ d = new Date(0);
+ }
+ m_fromDate = d;
+ // cache TO date
+ d = null;
+ if (m_item instanceof ICalendarAppointment) {
+ ICalendarAppointment app = (ICalendarAppointment) m_item;
+ d = DateUtility.max(app.getStart(), app.getEnd());
+ }
+ if (m_item instanceof ICalendarTask) {
+ ICalendarTask task = (ICalendarTask) m_item;
+ d = DateUtility.max(task.getStart(), task.getDue(), task.getComplete());
+ }
+ //
+ if (d == null) {
+ d = new Date(0);
+ }
+ m_toDate = d;
+ // cache covered days
+ ArrayList<Date> dayList = new ArrayList<Date>();
+ Calendar a = Calendar.getInstance();
+ a.setTime(m_fromDate);
+ DateUtility.truncCalendar(a);
+ Calendar b = Calendar.getInstance();
+ b.setTime(m_toDate);
+ DateUtility.truncCalendar(b);
+ while (a.compareTo(b) <= 0) {
+ dayList.add(a.getTime());
+ a.add(Calendar.DATE, 1);
+ }
+ m_coveredDays = DateUtility.getCoveredDays(m_fromDate, m_toDate);
+ // cache full day flag
+ if (m_item instanceof ICalendarAppointment) {
+ m_fullDay = ((ICalendarAppointment) m_item).isFullDay();
+ }
+ else if (m_item instanceof ICalendarTask) {
+ m_fullDay = true;
+ }
+ else {
+ m_fullDay = true;
+ }
+ }
+
+ public ICell getCell() {
+ return m_cell;
+ }
+
+ public ICalendarItem getItem() {
+ return m_item;
+ }
+
+ /**
+ * producer that created the item in this component
+ */
+ public ICalendarItemProvider getProvider() {
+ return m_producer;
+ }
+
+ public ICalendar getCalendar() {
+ return m_calendar;
+ }
+
+ /**
+ * Convenience for getting the start date of the item Guaranteed to be never
+ * null
+ */
+ public Date getFromDate() {
+ return m_fromDate;
+ }
+
+ /**
+ * Convenience for getting the end date of the item Guaranteed to be never
+ * null
+ */
+ public Date getToDate() {
+ return m_toDate;
+ }
+
+ /**
+ * Convenience for getting the specific (composite) displayed label of an item
+ * for a specific day This includes the start date, the end date and the label
+ * of the item
+ */
+ public String getLabel(Date day) {
+ /* day=DateUtility.truncDate(day); */
+ switch (m_calendar.getDisplayMode()) {
+ case ICalendar.DISPLAY_MODE_MONTH: {
+ return m_cell.getText();
+ }
+ case ICalendar.DISPLAY_MODE_WEEK:
+ case ICalendar.DISPLAY_MODE_WORKWEEK: {
+ return m_cell.getText();
+ }
+ case ICalendar.DISPLAY_MODE_DAY: {
+ return m_cell.getText();
+ }
+ default: {
+ return m_cell.getText();
+ }
+ }
+ }
+
+ /**
+ * Convenience for getting the specific (composite) displayed tooltip of an
+ * item for a specific day This includes the start date, the end date and the
+ * label of the item
+ */
+ public String getTooltip(Date day) {
+ day = DateUtility.truncDate(day);
+ String s = createDayTooltip(day);
+ String s2 = m_cell.getTooltipText();
+ if (s2 != null && s2.length() > 0) {
+ s = s + "\n" + s2;
+ }
+ return s;
+ }
+
+ /**
+ * Convenience for getting all days this item is covering the dates returned
+ * have all time 00:00:00
+ */
+ public Date[] getCoveredDays() {
+ return m_coveredDays;
+ }
+
+ private String createDayTooltip(Date dayTruncated) {
+ Date a = getFromDate();
+ Date b = getToDate();
+ DateFormat timeFmt = m_calendar.getDateTimeFormatFactory().getHourMinute();
+ DateFormat dayFmt = m_calendar.getDateTimeFormatFactory().getDayMonth(DateFormat.MEDIUM);
+ if (m_coveredDays.length == 1) {
+ if (isFullDay()) {
+ return m_cell.getText();
+ }
+ else if (DateUtility.equals(a, b)) {
+ if (DateUtility.equals(a, dayTruncated)) {
+ // the date is at 00:00 so probably time is irrelevant
+ return m_cell.getText();
+ }
+ else {
+ return timeFmt.format(a) + " " + m_cell.getText();
+ }
+ }
+ else {
+ return timeFmt.format(a) + "-" + timeFmt.format(b) + " " + m_cell.getText();
+ }
+ }
+ else {// not just one day
+ if (isFullDay()) {
+ return dayFmt.format(a) + " - " + dayFmt.format(b) + " " + m_cell.getText();
+ }
+ else {
+ return dayFmt.format(a) + " " + timeFmt.format(a) + " - " + dayFmt.format(b) + " " + timeFmt.format(b) + " " + m_cell.getText();
+ }
+ }
+ }
+
+ /**
+ * Convenience for getting the full day flag (if applicable) of the item
+ */
+ public boolean isFullDay() {
+ return m_fullDay;
+ }
+
+ /**
+ * Convenience for getting the draggable property from the item producer
+ */
+ public boolean isDraggable() {
+ return m_producer.isMoveItemEnabled();
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/calendar/CalendarEvent.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/calendar/CalendarEvent.java
index bf56805031..24a95cde09 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/calendar/CalendarEvent.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/calendar/CalendarEvent.java
@@ -1,145 +1,145 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.calendar;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-
-@SuppressWarnings("serial")
-public class CalendarEvent extends java.util.EventObject {
-
- /**
- * valid properties: component
- */
- public static final int TYPE_COMPONENT_ACTION = 20;
-
- /**
- * Broadcast request to add actions for component popup valid properties:
- * component add actions to: popupActions
- */
- public static final int TYPE_COMPONENT_POPUP = 30;
-
- /**
- * Broadcast request to add actions for "new" popup valid properties: add
- * actions to: popupActions
- */
- public static final int TYPE_NEW_POPUP = 31;
-
- private int m_type;
- private CalendarComponent m_component;
- private List<IMenu> m_popupMenus;
-
- public CalendarEvent(ICalendar source, int type) {
- super(source);
- m_type = type;
- }
-
- public CalendarEvent(ICalendar source, int type, CalendarComponent comp) {
- super(source);
- m_type = type;
- m_component = comp;
- }
-
- public ICalendar getCalendar() {
- return (ICalendar) getSource();
- }
-
- public int getType() {
- return m_type;
- }
-
- public CalendarComponent getComponent() {
- return m_component;
- }
-
- /**
- * used by {@value #TYPE_COMPONENT_POPUP} and {@link #TYPE_NEW_POPUP} to add
- * actions
- */
- public void addPopupMenu(IMenu menu) {
- if (menu != null) {
- if (m_popupMenus == null) {
- m_popupMenus = new ArrayList<IMenu>();
- }
- m_popupMenus.add(menu);
- }
- }
-
- /**
- * used by {@value #TYPE_COMPONENT_POPUP} and {@link #TYPE_NEW_POPUP} to add
- * actions
- */
- public void addPopupMenus(IMenu[] menus) {
- if (menus != null) {
- if (m_popupMenus == null) {
- m_popupMenus = new ArrayList<IMenu>();
- }
- m_popupMenus.addAll(Arrays.asList(menus));
- }
- }
-
- /**
- * used by {@value #TYPE_COMPONENT_POPUP} and {@link #TYPE_NEW_POPUP} to
- * collect actions
- */
- public IMenu[] getPopupMenus() {
- if (m_popupMenus != null) {
- return m_popupMenus.toArray(new IMenu[0]);
- }
- else {
- return new IMenu[0];
- }
- }
-
- /**
- * used by {@value #TYPE_COMPONENT_POPUP} and {@link #TYPE_NEW_POPUP} to
- * collect actions
- */
- public int getPopupMenuCount() {
- if (m_popupMenus != null) {
- return m_popupMenus.size();
- }
- else {
- return 0;
- }
- }
-
- @Override
- public String toString() {
- StringBuffer buf = new StringBuffer();
- buf.append("CalendarEvent[");
- // decode type
- try {
- Field[] f = getClass().getDeclaredFields();
- for (int i = 0; i < f.length; i++) {
- if (Modifier.isPublic(f[i].getModifiers()) && Modifier.isStatic(f[i].getModifiers()) && f[i].getName().startsWith("TYPE_")) {
- if (((Number) f[i].get(null)).intValue() == m_type) {
- buf.append(f[i].getName());
- break;
- }
- }
- }
- }
- catch (Throwable t) {
- buf.append("#" + m_type);
- }
- if (m_component != null) {
- buf.append(", component=" + m_component.getCell().getText());
- }
- buf.append("]");
- return buf.toString();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.calendar;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+
+@SuppressWarnings("serial")
+public class CalendarEvent extends java.util.EventObject {
+
+ /**
+ * valid properties: component
+ */
+ public static final int TYPE_COMPONENT_ACTION = 20;
+
+ /**
+ * Broadcast request to add actions for component popup valid properties:
+ * component add actions to: popupActions
+ */
+ public static final int TYPE_COMPONENT_POPUP = 30;
+
+ /**
+ * Broadcast request to add actions for "new" popup valid properties: add
+ * actions to: popupActions
+ */
+ public static final int TYPE_NEW_POPUP = 31;
+
+ private int m_type;
+ private CalendarComponent m_component;
+ private List<IMenu> m_popupMenus;
+
+ public CalendarEvent(ICalendar source, int type) {
+ super(source);
+ m_type = type;
+ }
+
+ public CalendarEvent(ICalendar source, int type, CalendarComponent comp) {
+ super(source);
+ m_type = type;
+ m_component = comp;
+ }
+
+ public ICalendar getCalendar() {
+ return (ICalendar) getSource();
+ }
+
+ public int getType() {
+ return m_type;
+ }
+
+ public CalendarComponent getComponent() {
+ return m_component;
+ }
+
+ /**
+ * used by {@value #TYPE_COMPONENT_POPUP} and {@link #TYPE_NEW_POPUP} to add
+ * actions
+ */
+ public void addPopupMenu(IMenu menu) {
+ if (menu != null) {
+ if (m_popupMenus == null) {
+ m_popupMenus = new ArrayList<IMenu>();
+ }
+ m_popupMenus.add(menu);
+ }
+ }
+
+ /**
+ * used by {@value #TYPE_COMPONENT_POPUP} and {@link #TYPE_NEW_POPUP} to add
+ * actions
+ */
+ public void addPopupMenus(IMenu[] menus) {
+ if (menus != null) {
+ if (m_popupMenus == null) {
+ m_popupMenus = new ArrayList<IMenu>();
+ }
+ m_popupMenus.addAll(Arrays.asList(menus));
+ }
+ }
+
+ /**
+ * used by {@value #TYPE_COMPONENT_POPUP} and {@link #TYPE_NEW_POPUP} to
+ * collect actions
+ */
+ public IMenu[] getPopupMenus() {
+ if (m_popupMenus != null) {
+ return m_popupMenus.toArray(new IMenu[0]);
+ }
+ else {
+ return new IMenu[0];
+ }
+ }
+
+ /**
+ * used by {@value #TYPE_COMPONENT_POPUP} and {@link #TYPE_NEW_POPUP} to
+ * collect actions
+ */
+ public int getPopupMenuCount() {
+ if (m_popupMenus != null) {
+ return m_popupMenus.size();
+ }
+ else {
+ return 0;
+ }
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer buf = new StringBuffer();
+ buf.append("CalendarEvent[");
+ // decode type
+ try {
+ Field[] f = getClass().getDeclaredFields();
+ for (int i = 0; i < f.length; i++) {
+ if (Modifier.isPublic(f[i].getModifiers()) && Modifier.isStatic(f[i].getModifiers()) && f[i].getName().startsWith("TYPE_")) {
+ if (((Number) f[i].get(null)).intValue() == m_type) {
+ buf.append(f[i].getName());
+ break;
+ }
+ }
+ }
+ }
+ catch (Throwable t) {
+ buf.append("#" + m_type);
+ }
+ if (m_component != null) {
+ buf.append(", component=" + m_component.getCell().getText());
+ }
+ buf.append("]");
+ return buf.toString();
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/calendar/CalendarItemConflict.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/calendar/CalendarItemConflict.java
index f8bd1289c7..eb64f62fcf 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/calendar/CalendarItemConflict.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/calendar/CalendarItemConflict.java
@@ -1,60 +1,60 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.calendar;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.scout.rt.client.ui.basic.calendar.provider.ICalendarItemProvider;
-
-/**
- * Two or more items of different {@link ICalendarItemProvider}s that have same
- * subject and overlapping dates.
- */
-public class CalendarItemConflict {
- private Map<Class<? extends ICalendarItemProvider>, Collection<CalendarComponent>> m_componentsByProvider;
- private List<CalendarComponent> m_components;
- private CalendarComponent m_c2;
- private double m_match;
-
- public CalendarItemConflict(Map<Class<? extends ICalendarItemProvider>, Collection<CalendarComponent>> componentsByProvider, List<CalendarComponent> components, double match) {
- m_componentsByProvider = componentsByProvider;
- m_components = components;
- m_match = match;
- }
-
- /**
- * Average match in percent. 1.0 = full match (appointment[subject, start,
- * end], task[subject, start, due, complete]) ... 0.5 = date ranges overlap in
- * 50% ... 0.0 = date ranges just touch
- */
- public double getMatch() {
- return m_match;
- }
-
- public List<CalendarComponent> getComponents() {
- return m_components;
- }
-
- /**
- * Accept only the component of this provider, all other items are removed
- * from the componentsByProvider map.
- */
- public void acceptComponentOf(Class<? extends ICalendarItemProvider> providerType) {
- for (CalendarComponent comp : m_components) {
- Class<? extends ICalendarItemProvider> pcls = comp.getProvider().getClass();
- if (!providerType.isAssignableFrom(pcls)) {
- m_componentsByProvider.get(pcls).remove(comp);
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.calendar;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.scout.rt.client.ui.basic.calendar.provider.ICalendarItemProvider;
+
+/**
+ * Two or more items of different {@link ICalendarItemProvider}s that have same
+ * subject and overlapping dates.
+ */
+public class CalendarItemConflict {
+ private Map<Class<? extends ICalendarItemProvider>, Collection<CalendarComponent>> m_componentsByProvider;
+ private List<CalendarComponent> m_components;
+ private CalendarComponent m_c2;
+ private double m_match;
+
+ public CalendarItemConflict(Map<Class<? extends ICalendarItemProvider>, Collection<CalendarComponent>> componentsByProvider, List<CalendarComponent> components, double match) {
+ m_componentsByProvider = componentsByProvider;
+ m_components = components;
+ m_match = match;
+ }
+
+ /**
+ * Average match in percent. 1.0 = full match (appointment[subject, start,
+ * end], task[subject, start, due, complete]) ... 0.5 = date ranges overlap in
+ * 50% ... 0.0 = date ranges just touch
+ */
+ public double getMatch() {
+ return m_match;
+ }
+
+ public List<CalendarComponent> getComponents() {
+ return m_components;
+ }
+
+ /**
+ * Accept only the component of this provider, all other items are removed
+ * from the componentsByProvider map.
+ */
+ public void acceptComponentOf(Class<? extends ICalendarItemProvider> providerType) {
+ for (CalendarComponent comp : m_components) {
+ Class<? extends ICalendarItemProvider> pcls = comp.getProvider().getClass();
+ if (!providerType.isAssignableFrom(pcls)) {
+ m_componentsByProvider.get(pcls).remove(comp);
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/calendar/CalendarListener.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/calendar/CalendarListener.java
index 9e2f553f9f..bf7e9b6fc2 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/calendar/CalendarListener.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/calendar/CalendarListener.java
@@ -1,23 +1,23 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.calendar;
-
-import java.util.EventListener;
-
-public interface CalendarListener extends EventListener {
-
- void calendarChanged(CalendarEvent e);
-
- /**
- * batch event for fast processing of batch changes
- */
- void calendarChangedBatch(CalendarEvent[] batch);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.calendar;
+
+import java.util.EventListener;
+
+public interface CalendarListener extends EventListener {
+
+ void calendarChanged(CalendarEvent e);
+
+ /**
+ * batch event for fast processing of batch changes
+ */
+ void calendarChangedBatch(CalendarEvent[] batch);
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/calendar/DateTimeFormatFactory.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/calendar/DateTimeFormatFactory.java
index 69871a00aa..39b2ae4eb4 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/calendar/DateTimeFormatFactory.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/calendar/DateTimeFormatFactory.java
@@ -1,56 +1,56 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.calendar;
-
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-
-import org.eclipse.scout.commons.LocaleThreadLocal;
-
-public class DateTimeFormatFactory {
-
- public DateTimeFormatFactory() {
- }
-
- public DateFormat getDayMonthYear(int style) {
- return DateFormat.getDateInstance(style, LocaleThreadLocal.get());
- }
-
- public DateFormat getHourMinute() {
- return DateFormat.getTimeInstance(DateFormat.SHORT, LocaleThreadLocal.get());
- }
-
- public DateFormat getHourMinuteSecond() {
- return DateFormat.getTimeInstance(DateFormat.MEDIUM, LocaleThreadLocal.get());
- }
-
- public DateFormat getDayMonthYearHourMinuteSecond(int dateStyle, int timeStyle) {
- return DateFormat.getDateTimeInstance(dateStyle, timeStyle, LocaleThreadLocal.get());
- }
-
- /**
- * Derived formats
- */
- public DateFormat getDayMonth(int style) {
- DateFormat fmt = getDayMonthYear(style);
- if (fmt instanceof SimpleDateFormat) {
- String pattern = ((SimpleDateFormat) fmt).toPattern();
- pattern = removeYear(pattern);
- ((SimpleDateFormat) fmt).applyPattern(pattern);
- }
- return fmt;
- }
-
- private String removeYear(String s) {
- return s.replaceAll("[/\\-,. ]*[y]+[/\\-,.]*", "").trim();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.calendar;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+
+import org.eclipse.scout.commons.LocaleThreadLocal;
+
+public class DateTimeFormatFactory {
+
+ public DateTimeFormatFactory() {
+ }
+
+ public DateFormat getDayMonthYear(int style) {
+ return DateFormat.getDateInstance(style, LocaleThreadLocal.get());
+ }
+
+ public DateFormat getHourMinute() {
+ return DateFormat.getTimeInstance(DateFormat.SHORT, LocaleThreadLocal.get());
+ }
+
+ public DateFormat getHourMinuteSecond() {
+ return DateFormat.getTimeInstance(DateFormat.MEDIUM, LocaleThreadLocal.get());
+ }
+
+ public DateFormat getDayMonthYearHourMinuteSecond(int dateStyle, int timeStyle) {
+ return DateFormat.getDateTimeInstance(dateStyle, timeStyle, LocaleThreadLocal.get());
+ }
+
+ /**
+ * Derived formats
+ */
+ public DateFormat getDayMonth(int style) {
+ DateFormat fmt = getDayMonthYear(style);
+ if (fmt instanceof SimpleDateFormat) {
+ String pattern = ((SimpleDateFormat) fmt).toPattern();
+ pattern = removeYear(pattern);
+ ((SimpleDateFormat) fmt).applyPattern(pattern);
+ }
+ return fmt;
+ }
+
+ private String removeYear(String s) {
+ return s.replaceAll("[/\\-,. ]*[y]+[/\\-,.]*", "").trim();
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/calendar/ICalendar.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/calendar/ICalendar.java
index b532119ac9..192c8e1d3d 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/calendar/ICalendar.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/calendar/ICalendar.java
@@ -1,164 +1,164 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.calendar;
-
-import java.util.Date;
-
-import org.eclipse.scout.commons.beans.IPropertyObserver;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.form.fields.calendarfield.ICalendarField;
-import org.eclipse.scout.rt.client.ui.form.fields.listbox.IListBox;
-import org.eclipse.scout.rt.shared.services.common.calendar.ICalendarItem;
-
-public interface ICalendar extends IPropertyObserver {
-
- // never change final constants (properties files might have references)
- int DISPLAY_MODE_DAY = 1;
- int DISPLAY_MODE_WEEK = 2;
- int DISPLAY_MODE_MONTH = 3;
- int DISPLAY_MODE_WORKWEEK = 4;
-
- /**
- * type {@link CalendarComponent}[]
- */
- String PROP_COMPONENTS = "components";
- /**
- * type {@link CalendarComponent}
- */
- String PROP_SELECTED_COMPONENT = "selectedComponent";
- /**
- * type int (DISPLAY_MODE_DAY,DISPLAY_MODE_WEEK,DISPLAY_MODE_MONTH,
- * DISPLAY_MODE_WORKWEEK)
- */
- String PROP_DISPLAY_MODE = "displayMode";
- /**
- * type boolean
- */
- String PROP_DISPLAY_CONDENSED = "displayCondensed";
- /**
- * type String
- */
- String PROP_TITLE = "title";
- /**
- * type {@link Date}[2]
- */
- String PROP_VIEW_RANGE = "viewRange";
- /**
- * type {@link Date}
- */
- String PROP_SELECTED_DATE = "selectedDate";
- /**
- * type {@link Boolean}
- */
- String PROP_LOAD_IN_PROGRESS = "loadInProgress";
- /**
- * {@link Object}
- * <p>
- * Container of this calendar, {@link ICalendarField}
- * <p>
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=388227
- *
- * @since 3.8.1
- */
- String PROP_CONTAINER = "container";
-
- void initCalendar() throws ProcessingException;
-
- void disposeCalendar();
-
- String getTitle();
-
- void setTitle(String s);
-
- int getDisplayMode();
-
- void setDisplayMode(int mode);
-
- boolean isDisplayCondensed();
-
- void setDisplayCondensed(boolean condensed);
-
- /**
- * @return a Date tupel [begin, end]
- */
- Date[] getViewRange();
-
- void setViewRange(Date viewDateStart, Date viewDateEnd);
-
- Date getSelectedDate();
-
- void setSelectedDate(Date d);
-
- CalendarComponent getSelectedComponent();
-
- void setSelectedComponent(CalendarComponent comp);
-
- /**
- * @return selected item if it is of the requested type
- */
- <T extends ICalendarItem> T getSelectedItem(Class<T> c);
-
- boolean isLoadInProgress();
-
- void setLoadInProgress(boolean b);
-
- /**
- * @return all calendar components sorted by {@link CalendarComponent#getFromDate()}
- */
- CalendarComponent[] getComponents();
-
- DateTimeFormatFactory getDateTimeFormatFactory();
-
- /**
- * reload all calendar items
- */
- void reloadCalendarItems();
-
- /*
- * modification observer
- */
- void addCalendarListener(CalendarListener listener);
-
- void removeCalendarListener(CalendarListener listener);
-
- /**
- * when performing a batch mutation use this marker like
- *
- * <pre>
- * try{
- * setCalendarChanging(true);
- * ...modify data, etc.
- * }
- * finally{
- * setCalendarChanging(false);
- * }
- * </pre>
- */
- void setCalendarChanging(boolean b);
-
- boolean isCalendarChanging();
-
- /**
- * {@link Object}
- * <p>
- * Container of this calendar, {@link ICalendarField}
- * <p>
- * {@link IListBox} https://bugs.eclipse.org/bugs/show_bug.cgi?id=388227
- *
- * @since 3.8.1
- */
- Object getContainer();
-
- /*
- * UI interface
- */
- ICalendarUIFacade getUIFacade();
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.calendar;
+
+import java.util.Date;
+
+import org.eclipse.scout.commons.beans.IPropertyObserver;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.form.fields.calendarfield.ICalendarField;
+import org.eclipse.scout.rt.client.ui.form.fields.listbox.IListBox;
+import org.eclipse.scout.rt.shared.services.common.calendar.ICalendarItem;
+
+public interface ICalendar extends IPropertyObserver {
+
+ // never change final constants (properties files might have references)
+ int DISPLAY_MODE_DAY = 1;
+ int DISPLAY_MODE_WEEK = 2;
+ int DISPLAY_MODE_MONTH = 3;
+ int DISPLAY_MODE_WORKWEEK = 4;
+
+ /**
+ * type {@link CalendarComponent}[]
+ */
+ String PROP_COMPONENTS = "components";
+ /**
+ * type {@link CalendarComponent}
+ */
+ String PROP_SELECTED_COMPONENT = "selectedComponent";
+ /**
+ * type int (DISPLAY_MODE_DAY,DISPLAY_MODE_WEEK,DISPLAY_MODE_MONTH,
+ * DISPLAY_MODE_WORKWEEK)
+ */
+ String PROP_DISPLAY_MODE = "displayMode";
+ /**
+ * type boolean
+ */
+ String PROP_DISPLAY_CONDENSED = "displayCondensed";
+ /**
+ * type String
+ */
+ String PROP_TITLE = "title";
+ /**
+ * type {@link Date}[2]
+ */
+ String PROP_VIEW_RANGE = "viewRange";
+ /**
+ * type {@link Date}
+ */
+ String PROP_SELECTED_DATE = "selectedDate";
+ /**
+ * type {@link Boolean}
+ */
+ String PROP_LOAD_IN_PROGRESS = "loadInProgress";
+ /**
+ * {@link Object}
+ * <p>
+ * Container of this calendar, {@link ICalendarField}
+ * <p>
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=388227
+ *
+ * @since 3.8.1
+ */
+ String PROP_CONTAINER = "container";
+
+ void initCalendar() throws ProcessingException;
+
+ void disposeCalendar();
+
+ String getTitle();
+
+ void setTitle(String s);
+
+ int getDisplayMode();
+
+ void setDisplayMode(int mode);
+
+ boolean isDisplayCondensed();
+
+ void setDisplayCondensed(boolean condensed);
+
+ /**
+ * @return a Date tupel [begin, end]
+ */
+ Date[] getViewRange();
+
+ void setViewRange(Date viewDateStart, Date viewDateEnd);
+
+ Date getSelectedDate();
+
+ void setSelectedDate(Date d);
+
+ CalendarComponent getSelectedComponent();
+
+ void setSelectedComponent(CalendarComponent comp);
+
+ /**
+ * @return selected item if it is of the requested type
+ */
+ <T extends ICalendarItem> T getSelectedItem(Class<T> c);
+
+ boolean isLoadInProgress();
+
+ void setLoadInProgress(boolean b);
+
+ /**
+ * @return all calendar components sorted by {@link CalendarComponent#getFromDate()}
+ */
+ CalendarComponent[] getComponents();
+
+ DateTimeFormatFactory getDateTimeFormatFactory();
+
+ /**
+ * reload all calendar items
+ */
+ void reloadCalendarItems();
+
+ /*
+ * modification observer
+ */
+ void addCalendarListener(CalendarListener listener);
+
+ void removeCalendarListener(CalendarListener listener);
+
+ /**
+ * when performing a batch mutation use this marker like
+ *
+ * <pre>
+ * try{
+ * setCalendarChanging(true);
+ * ...modify data, etc.
+ * }
+ * finally{
+ * setCalendarChanging(false);
+ * }
+ * </pre>
+ */
+ void setCalendarChanging(boolean b);
+
+ boolean isCalendarChanging();
+
+ /**
+ * {@link Object}
+ * <p>
+ * Container of this calendar, {@link ICalendarField}
+ * <p>
+ * {@link IListBox} https://bugs.eclipse.org/bugs/show_bug.cgi?id=388227
+ *
+ * @since 3.8.1
+ */
+ Object getContainer();
+
+ /*
+ * UI interface
+ */
+ ICalendarUIFacade getUIFacade();
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/calendar/ICalendarUIFacade.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/calendar/ICalendarUIFacade.java
index 35b632c217..6e4fbec88f 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/calendar/ICalendarUIFacade.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/calendar/ICalendarUIFacade.java
@@ -1,35 +1,35 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.calendar;
-
-import java.util.Date;
-
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-
-public interface ICalendarUIFacade {
-
- boolean isUIProcessing();
-
- void fireComponentActionFromUI();
-
- void fireComponentMovedFromUI(CalendarComponent comp, Date newDate);
-
- IMenu[] fireComponentPopupFromUI();
-
- IMenu[] fireNewPopupFromUI();
-
- void fireReloadFromUI();
-
- void setVisibleRangeFromUI(Date minDate, Date maxDate);
-
- void setSelectionFromUI(Date date, CalendarComponent comp);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.calendar;
+
+import java.util.Date;
+
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+
+public interface ICalendarUIFacade {
+
+ boolean isUIProcessing();
+
+ void fireComponentActionFromUI();
+
+ void fireComponentMovedFromUI(CalendarComponent comp, Date newDate);
+
+ IMenu[] fireComponentPopupFromUI();
+
+ IMenu[] fireNewPopupFromUI();
+
+ void fireReloadFromUI();
+
+ void setVisibleRangeFromUI(Date minDate, Date maxDate);
+
+ void setSelectionFromUI(Date date, CalendarComponent comp);
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/calendar/provider/AbstractCalendarItemProvider.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/calendar/provider/AbstractCalendarItemProvider.java
index b690e19ae8..5cae7a1217 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/calendar/provider/AbstractCalendarItemProvider.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/calendar/provider/AbstractCalendarItemProvider.java
@@ -1,450 +1,450 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.calendar.provider;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.scout.commons.ConfigurationUtility;
-import org.eclipse.scout.commons.DateUtility;
-import org.eclipse.scout.commons.annotations.ConfigOperation;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.beans.AbstractPropertyObserver;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.holders.Holder;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ClientAsyncJob;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
-import org.eclipse.scout.rt.shared.services.common.calendar.ICalendarAppointment;
-import org.eclipse.scout.rt.shared.services.common.calendar.ICalendarItem;
-import org.eclipse.scout.rt.shared.services.common.calendar.ICalendarTask;
-import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
-import org.eclipse.scout.service.SERVICES;
-
-public abstract class AbstractCalendarItemProvider extends AbstractPropertyObserver implements ICalendarItemProvider {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractCalendarItemProvider.class);
-
- public static final long DAY_MILLIS = 24L * 3600L * 1000L;
- public static final long MONTH_MILLIS = DAY_MILLIS * 32L;
-
- private P_ReloadJob m_reloadJob;
-
- private boolean m_initialized;
- private IMenu[] m_menus;
- private Date m_minDateLoaded;
- private Date m_maxDateLoaded;
-
- public AbstractCalendarItemProvider() {
- this(true);
- }
-
- public AbstractCalendarItemProvider(boolean callInitializer) {
- if (callInitializer) {
- callInitializer();
- }
- }
-
- protected void callInitializer() {
- if (!m_initialized) {
- initConfig();
- ensureItemsLoadedInternal(new Date(System.currentTimeMillis() - MONTH_MILLIS), new Date(System.currentTimeMillis() + MONTH_MILLIS));
- m_initialized = true;
- }
- }
-
- /*
- * Configuration
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(10)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredMoveItemEnabled() {
- return false;
- }
-
- @ConfigProperty(ConfigProperty.LONG)
- @Order(20)
- @ConfigPropertyValue("0")
- protected long getConfiguredRefreshIntervallMillis() {
- return 0;
- }
-
- private Class<? extends IMenu>[] getConfiguredMenus() {
- Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
- return ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, IMenu.class);
- }
-
- /**
- * Produce items in the time range [minDate,maxDate]<br>
- * The result is stored in the out parameter resutlHolder
- * <p>
- * Due to an outparameter instead of a return value this method can (for performance optimization) start a background
- * process and return immediately
- * <p>
- * This method is called in the default model thread
- */
- @ConfigOperation
- @Order(30)
- protected void execLoadItems(final Date minDate, final Date maxDate, final Holder<ICalendarItem[]> resultHolder) throws ProcessingException {
- }
-
- /**
- * Produce items in the time range [minDate,maxDate]<br>
- * The result is stored in the out parameter resutlHolder
- * <p>
- * Note: This method is NOT called in the default model thread, but in a background thread
- */
- @ConfigOperation
- @Order(40)
- protected void execLoadItemsInBackground(final IClientSession session, final Date minDate, final Date maxDate, final Holder<ICalendarItem[]> resultHolder) throws ProcessingException {
- ClientSyncJob job = new ClientSyncJob(getClass().getSimpleName() + " load items", session) {
- @Override
- protected void runVoid(IProgressMonitor monitor) throws Throwable {
- execLoadItems(minDate, maxDate, resultHolder);
- }
- };
- job.schedule();
- try {
- job.join();
- }
- catch (InterruptedException e) {
- // nop
- }
- }
-
- @ConfigOperation
- @Order(10)
- protected void execDecorateCell(Cell cell, ICalendarItem item) throws ProcessingException {
- }
-
- /**
- * item was moved using drag & drop
- */
- @ConfigOperation
- @Order(20)
- protected void execItemMoved(ICalendarItem item, Date newDate) throws ProcessingException {
- }
-
- @ConfigOperation
- @Order(50)
- protected void execItemAction(ICalendarItem item) throws ProcessingException {
- }
-
- protected void initConfig() {
- setMoveItemEnabled(getConfiguredMoveItemEnabled());
- setRefreshIntervalMillis(getConfiguredRefreshIntervallMillis());
- // menus
- ArrayList<IMenu> menuList = new ArrayList<IMenu>();
- Class<? extends IMenu>[] ma = getConfiguredMenus();
- for (int i = 0; i < ma.length; i++) {
- try {
- IMenu menu = ConfigurationUtility.newInnerInstance(this, ma[i]);
- menuList.add(menu);
- }
- catch (Exception e) {
- LOG.warn(null, e);
- }
- }
-
- try {
- injectMenusInternal(menuList);
- }
- catch (Exception e) {
- LOG.error("error occured while dynamically contribute menus.", e);
- }
- m_menus = menuList.toArray(new IMenu[0]);
- }
-
- /**
- * Override this internal method only in order to make use of dynamic menus<br>
- * Used to manage menu list and add/remove menus
- *
- * @param menuList
- * live and mutable list of configured menus
- */
- protected void injectMenusInternal(List<IMenu> menuList) {
- }
-
- /*
- * Runtime
- */
- @Override
- public void disposeProvider() {
- P_ReloadJob job = m_reloadJob;
- if (job != null) {
- job.cancel();
- m_reloadJob = null;
- }
- }
-
- @Override
- public final void decorateCell(Cell cell, ICalendarItem item) {
- decorateCellInternal(cell, item);
- try {
- execDecorateCell(cell, item);
- }
- catch (ProcessingException e) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- catch (Throwable e) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Unexpected", e));
- }
- }
-
- protected void decorateCellInternal(Cell cell, ICalendarItem item) {
- if (item instanceof ICalendarAppointment) {
- ICalendarAppointment app = (ICalendarAppointment) item;
- cell.setText(app.getSubject());
- StringBuffer buf = new StringBuffer();
- if (app.getLocation() != null) {
- if (buf.length() > 0) {
- buf.append("\n");
- }
- buf.append(app.getLocation());
- }
- if (app.getBody() != null) {
- if (buf.length() > 0) {
- buf.append("\n");
- }
- buf.append(app.getBody());
- }
- if (buf.length() > 0) {
- cell.setTooltipText(buf.toString());
- }
- }
- if (item instanceof ICalendarTask) {
- ICalendarTask task = (ICalendarTask) item;
- cell.setText(task.getSubject());
- StringBuffer buf = new StringBuffer();
- if (task.getBody() != null) {
- if (buf.length() > 0) {
- buf.append("\n");
- }
- buf.append(task.getBody());
- }
- if (buf.length() > 0) {
- cell.setTooltipText(buf.toString());
- }
- }
- cell.setBackgroundColor((item.getColor()));
- }
-
- @Override
- public ICalendarItem[] getItems(Date minDate, Date maxDate) {
- ensureItemsLoadedInternal(minDate, maxDate);
- ArrayList<ICalendarItem> list = new ArrayList<ICalendarItem>();
- ICalendarItem[] a = (ICalendarItem[]) propertySupport.getProperty(PROP_ITEMS);
- if (a != null) {
- for (ICalendarItem item : a) {
- if (item.isIntersecting(minDate, maxDate)) {
- list.add(item);
- }
- }
- }
- return list.toArray(new ICalendarItem[list.size()]);
- }
-
- @Override
- public void reloadProvider() {
- loadItemsAsyncInternal(ClientSyncJob.getCurrentSession(), m_minDateLoaded, m_maxDateLoaded, 250);
- }
-
- private void setItemsInternal(Date minDate, Date maxDate, ICalendarItem[] items) {
- m_minDateLoaded = minDate;
- m_maxDateLoaded = maxDate;
- propertySupport.setProperty(PROP_ITEMS, items);
- }
-
- @Override
- public IMenu[] getMenus() {
- return m_menus;
- }
-
- @Override
- public boolean isMoveItemEnabled() {
- return propertySupport.getPropertyBool(PROP_MOVE_ITEM_ENABLED);
- }
-
- @Override
- public void setMoveItemEnabled(boolean b) {
- propertySupport.setPropertyBool(PROP_MOVE_ITEM_ENABLED, b);
- }
-
- @Override
- public boolean isLoadInProgress() {
- return propertySupport.getPropertyBool(PROP_LOAD_IN_PROGRESS);
- }
-
- @Override
- public void setLoadInProgress(boolean b) {
- propertySupport.setPropertyBool(PROP_LOAD_IN_PROGRESS, b);
- }
-
- @Override
- public long getRefreshIntervalMillis() {
- return propertySupport.getPropertyLong(PROP_REFRESH_INTERVAL_MILLIS);
- }
-
- @Override
- public void setRefreshIntervalMillis(long m) {
- propertySupport.setPropertyLong(PROP_REFRESH_INTERVAL_MILLIS, m);
- if (m > 0) {
- loadItemsAsyncInternal(ClientSyncJob.getCurrentSession(), m_minDateLoaded, m_maxDateLoaded, m);
- }
- }
-
- @Override
- public void onItemAction(ICalendarItem item) throws ProcessingException {
- try {
- execItemAction(item);
- }
- catch (ProcessingException e) {
- throw e;
- }
- catch (Throwable e) {
- throw new ProcessingException("Unexpected", e);
- }
- }
-
- @Override
- public void onItemMoved(ICalendarItem item, Date newDate) throws ProcessingException {
- try {
- execItemMoved(item, newDate);
- }
- catch (ProcessingException e) {
- throw e;
- }
- catch (Throwable e) {
- throw new ProcessingException("Unexpected", e);
- }
- }
-
- private void ensureItemsLoadedInternal(Date minDate, Date maxDate) {
- if (DateUtility.isInRange(m_minDateLoaded, minDate, m_maxDateLoaded) && DateUtility.isInRange(m_minDateLoaded, maxDate, m_maxDateLoaded)) {
- // nop. [minDate,maxDate] is inside loaded range
- }
- else {
- loadItemsAsyncInternal(ClientSyncJob.getCurrentSession(), minDate, maxDate, 250);
- }
- }
-
- private synchronized void loadItemsAsyncInternal(IClientSession session, Date minDate, Date maxDate, long startDelayMillis) {
- P_ReloadJob oldJob = m_reloadJob;
- if (oldJob != null) {
- oldJob.cancel();
- m_reloadJob = null;
- }
- if (minDate != null && maxDate != null) {
- m_reloadJob = new P_ReloadJob(session, minDate, maxDate);
- m_reloadJob.schedule(startDelayMillis);
- }
- }
-
- /**
- * Reload Job
- */
- private class P_ReloadJob extends ClientAsyncJob {
- private final Holder<ICalendarItem[]> m_result;
- private final Date m_loadingMinDate;
- private final Date m_loadingMaxDate;
-
- public P_ReloadJob(IClientSession session, Date loadingMinDate, Date loadingMaxDate) {
- super(AbstractCalendarItemProvider.this.getClass().getSimpleName() + " reload", session);
- m_result = new Holder<ICalendarItem[]>(null);
- m_loadingMinDate = loadingMinDate;
- m_loadingMaxDate = loadingMaxDate;
- }
-
- @Override
- protected IStatus runStatus(IProgressMonitor monitor) {
- try {
- // set loading property in scout
- ClientSyncJob job = new ClientSyncJob(AbstractCalendarItemProvider.this.getClass().getSimpleName() + " prepare", ClientSyncJob.getCurrentSession()) {
- @Override
- protected void runVoid(IProgressMonitor monitor2) throws Throwable {
- setLoadInProgress(true);
- }
- };
- job.schedule();
- if (monitor != null && monitor.isCanceled()) {
- return Status.OK_STATUS;
- }
- // call user code
- try {
- execLoadItemsInBackground(ClientSyncJob.getCurrentSession(), m_loadingMinDate, m_loadingMaxDate, m_result);
- }
- catch (ProcessingException e) {
- if (!e.isInterruption()) {
- LOG.error(null, e);
- }
- return Status.OK_STATUS;
- }
- // wait for result
- while (true) {
- if (monitor != null && monitor.isCanceled()) {
- return Status.OK_STATUS;
- }
- synchronized (m_result) {
- if (m_result != null) {
- break;
- }
- try {
- m_result.wait(2000L);
- }
- catch (InterruptedException e) {
- return Status.OK_STATUS;
- }
- }
- }
- if (monitor != null && monitor.isCanceled()) {
- return Status.OK_STATUS;
- }
- if (m_result != null) {
- new ClientSyncJob(AbstractCalendarItemProvider.this.getClass().getSimpleName() + " setItems", ClientSyncJob.getCurrentSession()) {
- @Override
- protected void runVoid(IProgressMonitor monitor2) throws Throwable {
- setItemsInternal(m_loadingMinDate, m_loadingMaxDate, m_result.getValue());
- }
- }.schedule();
- }
- return Status.OK_STATUS;
- }
- finally {
- // reset loading property in scout
- new ClientSyncJob(AbstractCalendarItemProvider.this.getClass().getSimpleName() + " complete", ClientSyncJob.getCurrentSession()) {
- @Override
- protected void runVoid(IProgressMonitor monitor2) throws Throwable {
- setLoadInProgress(false);
- }
- }.schedule();
- // re-schedule
- long n = getRefreshIntervalMillis();
- if (n > 0 && m_minDateLoaded != null && m_maxDateLoaded != null) {
- //m_minDateLoaded and m_maxDateLoaded might not have been set yet.
- //-> Rescheduling (and cancelling a currently running job) should only happen,
- // if a previous job actually succeeded in loading the calendar items.
- loadItemsAsyncInternal(ClientSyncJob.getCurrentSession(), m_minDateLoaded, m_maxDateLoaded, n);
- }
- }
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.calendar.provider;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.scout.commons.ConfigurationUtility;
+import org.eclipse.scout.commons.DateUtility;
+import org.eclipse.scout.commons.annotations.ConfigOperation;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.beans.AbstractPropertyObserver;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.holders.Holder;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ClientAsyncJob;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
+import org.eclipse.scout.rt.shared.services.common.calendar.ICalendarAppointment;
+import org.eclipse.scout.rt.shared.services.common.calendar.ICalendarItem;
+import org.eclipse.scout.rt.shared.services.common.calendar.ICalendarTask;
+import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
+import org.eclipse.scout.service.SERVICES;
+
+public abstract class AbstractCalendarItemProvider extends AbstractPropertyObserver implements ICalendarItemProvider {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractCalendarItemProvider.class);
+
+ public static final long DAY_MILLIS = 24L * 3600L * 1000L;
+ public static final long MONTH_MILLIS = DAY_MILLIS * 32L;
+
+ private P_ReloadJob m_reloadJob;
+
+ private boolean m_initialized;
+ private IMenu[] m_menus;
+ private Date m_minDateLoaded;
+ private Date m_maxDateLoaded;
+
+ public AbstractCalendarItemProvider() {
+ this(true);
+ }
+
+ public AbstractCalendarItemProvider(boolean callInitializer) {
+ if (callInitializer) {
+ callInitializer();
+ }
+ }
+
+ protected void callInitializer() {
+ if (!m_initialized) {
+ initConfig();
+ ensureItemsLoadedInternal(new Date(System.currentTimeMillis() - MONTH_MILLIS), new Date(System.currentTimeMillis() + MONTH_MILLIS));
+ m_initialized = true;
+ }
+ }
+
+ /*
+ * Configuration
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(10)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredMoveItemEnabled() {
+ return false;
+ }
+
+ @ConfigProperty(ConfigProperty.LONG)
+ @Order(20)
+ @ConfigPropertyValue("0")
+ protected long getConfiguredRefreshIntervallMillis() {
+ return 0;
+ }
+
+ private Class<? extends IMenu>[] getConfiguredMenus() {
+ Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
+ return ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, IMenu.class);
+ }
+
+ /**
+ * Produce items in the time range [minDate,maxDate]<br>
+ * The result is stored in the out parameter resutlHolder
+ * <p>
+ * Due to an outparameter instead of a return value this method can (for performance optimization) start a background
+ * process and return immediately
+ * <p>
+ * This method is called in the default model thread
+ */
+ @ConfigOperation
+ @Order(30)
+ protected void execLoadItems(final Date minDate, final Date maxDate, final Holder<ICalendarItem[]> resultHolder) throws ProcessingException {
+ }
+
+ /**
+ * Produce items in the time range [minDate,maxDate]<br>
+ * The result is stored in the out parameter resutlHolder
+ * <p>
+ * Note: This method is NOT called in the default model thread, but in a background thread
+ */
+ @ConfigOperation
+ @Order(40)
+ protected void execLoadItemsInBackground(final IClientSession session, final Date minDate, final Date maxDate, final Holder<ICalendarItem[]> resultHolder) throws ProcessingException {
+ ClientSyncJob job = new ClientSyncJob(getClass().getSimpleName() + " load items", session) {
+ @Override
+ protected void runVoid(IProgressMonitor monitor) throws Throwable {
+ execLoadItems(minDate, maxDate, resultHolder);
+ }
+ };
+ job.schedule();
+ try {
+ job.join();
+ }
+ catch (InterruptedException e) {
+ // nop
+ }
+ }
+
+ @ConfigOperation
+ @Order(10)
+ protected void execDecorateCell(Cell cell, ICalendarItem item) throws ProcessingException {
+ }
+
+ /**
+ * item was moved using drag & drop
+ */
+ @ConfigOperation
+ @Order(20)
+ protected void execItemMoved(ICalendarItem item, Date newDate) throws ProcessingException {
+ }
+
+ @ConfigOperation
+ @Order(50)
+ protected void execItemAction(ICalendarItem item) throws ProcessingException {
+ }
+
+ protected void initConfig() {
+ setMoveItemEnabled(getConfiguredMoveItemEnabled());
+ setRefreshIntervalMillis(getConfiguredRefreshIntervallMillis());
+ // menus
+ ArrayList<IMenu> menuList = new ArrayList<IMenu>();
+ Class<? extends IMenu>[] ma = getConfiguredMenus();
+ for (int i = 0; i < ma.length; i++) {
+ try {
+ IMenu menu = ConfigurationUtility.newInnerInstance(this, ma[i]);
+ menuList.add(menu);
+ }
+ catch (Exception e) {
+ LOG.warn(null, e);
+ }
+ }
+
+ try {
+ injectMenusInternal(menuList);
+ }
+ catch (Exception e) {
+ LOG.error("error occured while dynamically contribute menus.", e);
+ }
+ m_menus = menuList.toArray(new IMenu[0]);
+ }
+
+ /**
+ * Override this internal method only in order to make use of dynamic menus<br>
+ * Used to manage menu list and add/remove menus
+ *
+ * @param menuList
+ * live and mutable list of configured menus
+ */
+ protected void injectMenusInternal(List<IMenu> menuList) {
+ }
+
+ /*
+ * Runtime
+ */
+ @Override
+ public void disposeProvider() {
+ P_ReloadJob job = m_reloadJob;
+ if (job != null) {
+ job.cancel();
+ m_reloadJob = null;
+ }
+ }
+
+ @Override
+ public final void decorateCell(Cell cell, ICalendarItem item) {
+ decorateCellInternal(cell, item);
+ try {
+ execDecorateCell(cell, item);
+ }
+ catch (ProcessingException e) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ catch (Throwable e) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Unexpected", e));
+ }
+ }
+
+ protected void decorateCellInternal(Cell cell, ICalendarItem item) {
+ if (item instanceof ICalendarAppointment) {
+ ICalendarAppointment app = (ICalendarAppointment) item;
+ cell.setText(app.getSubject());
+ StringBuffer buf = new StringBuffer();
+ if (app.getLocation() != null) {
+ if (buf.length() > 0) {
+ buf.append("\n");
+ }
+ buf.append(app.getLocation());
+ }
+ if (app.getBody() != null) {
+ if (buf.length() > 0) {
+ buf.append("\n");
+ }
+ buf.append(app.getBody());
+ }
+ if (buf.length() > 0) {
+ cell.setTooltipText(buf.toString());
+ }
+ }
+ if (item instanceof ICalendarTask) {
+ ICalendarTask task = (ICalendarTask) item;
+ cell.setText(task.getSubject());
+ StringBuffer buf = new StringBuffer();
+ if (task.getBody() != null) {
+ if (buf.length() > 0) {
+ buf.append("\n");
+ }
+ buf.append(task.getBody());
+ }
+ if (buf.length() > 0) {
+ cell.setTooltipText(buf.toString());
+ }
+ }
+ cell.setBackgroundColor((item.getColor()));
+ }
+
+ @Override
+ public ICalendarItem[] getItems(Date minDate, Date maxDate) {
+ ensureItemsLoadedInternal(minDate, maxDate);
+ ArrayList<ICalendarItem> list = new ArrayList<ICalendarItem>();
+ ICalendarItem[] a = (ICalendarItem[]) propertySupport.getProperty(PROP_ITEMS);
+ if (a != null) {
+ for (ICalendarItem item : a) {
+ if (item.isIntersecting(minDate, maxDate)) {
+ list.add(item);
+ }
+ }
+ }
+ return list.toArray(new ICalendarItem[list.size()]);
+ }
+
+ @Override
+ public void reloadProvider() {
+ loadItemsAsyncInternal(ClientSyncJob.getCurrentSession(), m_minDateLoaded, m_maxDateLoaded, 250);
+ }
+
+ private void setItemsInternal(Date minDate, Date maxDate, ICalendarItem[] items) {
+ m_minDateLoaded = minDate;
+ m_maxDateLoaded = maxDate;
+ propertySupport.setProperty(PROP_ITEMS, items);
+ }
+
+ @Override
+ public IMenu[] getMenus() {
+ return m_menus;
+ }
+
+ @Override
+ public boolean isMoveItemEnabled() {
+ return propertySupport.getPropertyBool(PROP_MOVE_ITEM_ENABLED);
+ }
+
+ @Override
+ public void setMoveItemEnabled(boolean b) {
+ propertySupport.setPropertyBool(PROP_MOVE_ITEM_ENABLED, b);
+ }
+
+ @Override
+ public boolean isLoadInProgress() {
+ return propertySupport.getPropertyBool(PROP_LOAD_IN_PROGRESS);
+ }
+
+ @Override
+ public void setLoadInProgress(boolean b) {
+ propertySupport.setPropertyBool(PROP_LOAD_IN_PROGRESS, b);
+ }
+
+ @Override
+ public long getRefreshIntervalMillis() {
+ return propertySupport.getPropertyLong(PROP_REFRESH_INTERVAL_MILLIS);
+ }
+
+ @Override
+ public void setRefreshIntervalMillis(long m) {
+ propertySupport.setPropertyLong(PROP_REFRESH_INTERVAL_MILLIS, m);
+ if (m > 0) {
+ loadItemsAsyncInternal(ClientSyncJob.getCurrentSession(), m_minDateLoaded, m_maxDateLoaded, m);
+ }
+ }
+
+ @Override
+ public void onItemAction(ICalendarItem item) throws ProcessingException {
+ try {
+ execItemAction(item);
+ }
+ catch (ProcessingException e) {
+ throw e;
+ }
+ catch (Throwable e) {
+ throw new ProcessingException("Unexpected", e);
+ }
+ }
+
+ @Override
+ public void onItemMoved(ICalendarItem item, Date newDate) throws ProcessingException {
+ try {
+ execItemMoved(item, newDate);
+ }
+ catch (ProcessingException e) {
+ throw e;
+ }
+ catch (Throwable e) {
+ throw new ProcessingException("Unexpected", e);
+ }
+ }
+
+ private void ensureItemsLoadedInternal(Date minDate, Date maxDate) {
+ if (DateUtility.isInRange(m_minDateLoaded, minDate, m_maxDateLoaded) && DateUtility.isInRange(m_minDateLoaded, maxDate, m_maxDateLoaded)) {
+ // nop. [minDate,maxDate] is inside loaded range
+ }
+ else {
+ loadItemsAsyncInternal(ClientSyncJob.getCurrentSession(), minDate, maxDate, 250);
+ }
+ }
+
+ private synchronized void loadItemsAsyncInternal(IClientSession session, Date minDate, Date maxDate, long startDelayMillis) {
+ P_ReloadJob oldJob = m_reloadJob;
+ if (oldJob != null) {
+ oldJob.cancel();
+ m_reloadJob = null;
+ }
+ if (minDate != null && maxDate != null) {
+ m_reloadJob = new P_ReloadJob(session, minDate, maxDate);
+ m_reloadJob.schedule(startDelayMillis);
+ }
+ }
+
+ /**
+ * Reload Job
+ */
+ private class P_ReloadJob extends ClientAsyncJob {
+ private final Holder<ICalendarItem[]> m_result;
+ private final Date m_loadingMinDate;
+ private final Date m_loadingMaxDate;
+
+ public P_ReloadJob(IClientSession session, Date loadingMinDate, Date loadingMaxDate) {
+ super(AbstractCalendarItemProvider.this.getClass().getSimpleName() + " reload", session);
+ m_result = new Holder<ICalendarItem[]>(null);
+ m_loadingMinDate = loadingMinDate;
+ m_loadingMaxDate = loadingMaxDate;
+ }
+
+ @Override
+ protected IStatus runStatus(IProgressMonitor monitor) {
+ try {
+ // set loading property in scout
+ ClientSyncJob job = new ClientSyncJob(AbstractCalendarItemProvider.this.getClass().getSimpleName() + " prepare", ClientSyncJob.getCurrentSession()) {
+ @Override
+ protected void runVoid(IProgressMonitor monitor2) throws Throwable {
+ setLoadInProgress(true);
+ }
+ };
+ job.schedule();
+ if (monitor != null && monitor.isCanceled()) {
+ return Status.OK_STATUS;
+ }
+ // call user code
+ try {
+ execLoadItemsInBackground(ClientSyncJob.getCurrentSession(), m_loadingMinDate, m_loadingMaxDate, m_result);
+ }
+ catch (ProcessingException e) {
+ if (!e.isInterruption()) {
+ LOG.error(null, e);
+ }
+ return Status.OK_STATUS;
+ }
+ // wait for result
+ while (true) {
+ if (monitor != null && monitor.isCanceled()) {
+ return Status.OK_STATUS;
+ }
+ synchronized (m_result) {
+ if (m_result != null) {
+ break;
+ }
+ try {
+ m_result.wait(2000L);
+ }
+ catch (InterruptedException e) {
+ return Status.OK_STATUS;
+ }
+ }
+ }
+ if (monitor != null && monitor.isCanceled()) {
+ return Status.OK_STATUS;
+ }
+ if (m_result != null) {
+ new ClientSyncJob(AbstractCalendarItemProvider.this.getClass().getSimpleName() + " setItems", ClientSyncJob.getCurrentSession()) {
+ @Override
+ protected void runVoid(IProgressMonitor monitor2) throws Throwable {
+ setItemsInternal(m_loadingMinDate, m_loadingMaxDate, m_result.getValue());
+ }
+ }.schedule();
+ }
+ return Status.OK_STATUS;
+ }
+ finally {
+ // reset loading property in scout
+ new ClientSyncJob(AbstractCalendarItemProvider.this.getClass().getSimpleName() + " complete", ClientSyncJob.getCurrentSession()) {
+ @Override
+ protected void runVoid(IProgressMonitor monitor2) throws Throwable {
+ setLoadInProgress(false);
+ }
+ }.schedule();
+ // re-schedule
+ long n = getRefreshIntervalMillis();
+ if (n > 0 && m_minDateLoaded != null && m_maxDateLoaded != null) {
+ //m_minDateLoaded and m_maxDateLoaded might not have been set yet.
+ //-> Rescheduling (and cancelling a currently running job) should only happen,
+ // if a previous job actually succeeded in loading the calendar items.
+ loadItemsAsyncInternal(ClientSyncJob.getCurrentSession(), m_minDateLoaded, m_maxDateLoaded, n);
+ }
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/calendar/provider/AbstractHolidayItemProvider.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/calendar/provider/AbstractHolidayItemProvider.java
index d593337d8a..0a5d43456a 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/calendar/provider/AbstractHolidayItemProvider.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/calendar/provider/AbstractHolidayItemProvider.java
@@ -1,61 +1,61 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.calendar.provider;
-
-import java.util.Date;
-
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.holders.Holder;
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
-import org.eclipse.scout.rt.shared.services.common.calendar.HolidayItem;
-import org.eclipse.scout.rt.shared.services.common.calendar.ICalendarItem;
-import org.eclipse.scout.rt.shared.services.common.calendar.IHolidayCalendarService;
-import org.eclipse.scout.rt.shared.services.common.file.RemoteFile;
-import org.eclipse.scout.service.SERVICES;
-
-/**
- * Produces holiday calendar items
- */
-public abstract class AbstractHolidayItemProvider extends AbstractCalendarItemProvider {
-
- @Override
- @ConfigPropertyValue("false")
- protected boolean getConfiguredMoveItemEnabled() {
- return false;
- }
-
- @ConfigProperty(ConfigProperty.STRING)
- @ConfigPropertyValue("\"calendar/holidays.xml\"")
- @Order(100)
- protected String getConfiguredRemoteFile() {
- return "calendar/holidays.xml";
- }
-
- @Override
- protected void execLoadItemsInBackground(IClientSession session, Date minDate, Date maxDate, Holder<ICalendarItem[]> resultHolder) throws ProcessingException {
- IHolidayCalendarService service = SERVICES.getService(IHolidayCalendarService.class);
- if (service != null) {
- RemoteFile f = new RemoteFile(getConfiguredRemoteFile(), 0);
- resultHolder.setValue(service.getItems(f, minDate, maxDate));
- }
- }
-
- @Override
- protected void execDecorateCell(Cell cell, ICalendarItem item) {
- HolidayItem h = (HolidayItem) item;
- cell.setBackgroundColor((h.getColor()));
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.calendar.provider;
+
+import java.util.Date;
+
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.holders.Holder;
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
+import org.eclipse.scout.rt.shared.services.common.calendar.HolidayItem;
+import org.eclipse.scout.rt.shared.services.common.calendar.ICalendarItem;
+import org.eclipse.scout.rt.shared.services.common.calendar.IHolidayCalendarService;
+import org.eclipse.scout.rt.shared.services.common.file.RemoteFile;
+import org.eclipse.scout.service.SERVICES;
+
+/**
+ * Produces holiday calendar items
+ */
+public abstract class AbstractHolidayItemProvider extends AbstractCalendarItemProvider {
+
+ @Override
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredMoveItemEnabled() {
+ return false;
+ }
+
+ @ConfigProperty(ConfigProperty.STRING)
+ @ConfigPropertyValue("\"calendar/holidays.xml\"")
+ @Order(100)
+ protected String getConfiguredRemoteFile() {
+ return "calendar/holidays.xml";
+ }
+
+ @Override
+ protected void execLoadItemsInBackground(IClientSession session, Date minDate, Date maxDate, Holder<ICalendarItem[]> resultHolder) throws ProcessingException {
+ IHolidayCalendarService service = SERVICES.getService(IHolidayCalendarService.class);
+ if (service != null) {
+ RemoteFile f = new RemoteFile(getConfiguredRemoteFile(), 0);
+ resultHolder.setValue(service.getItems(f, minDate, maxDate));
+ }
+ }
+
+ @Override
+ protected void execDecorateCell(Cell cell, ICalendarItem item) {
+ HolidayItem h = (HolidayItem) item;
+ cell.setBackgroundColor((h.getColor()));
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/calendar/provider/ICalendarItemProvider.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/calendar/provider/ICalendarItemProvider.java
index 3211b0080f..faa710b3e2 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/calendar/provider/ICalendarItemProvider.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/calendar/provider/ICalendarItemProvider.java
@@ -1,73 +1,73 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.calendar.provider;
-
-import java.util.Date;
-
-import org.eclipse.scout.commons.beans.IPropertyObserver;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
-import org.eclipse.scout.rt.shared.services.common.calendar.ICalendarItem;
-
-public interface ICalendarItemProvider extends IPropertyObserver {
-
- /**
- * type {@link ICalendarItem}[]
- */
- String PROP_ITEMS = "items";
- /**
- * type boolean
- */
- String PROP_MOVE_ITEM_ENABLED = "moveItemEnabled";
- /**
- * type long
- */
- String PROP_REFRESH_INTERVAL_MILLIS = "refreshIntervalMillis";
- /**
- * type boolean
- */
- String PROP_LOAD_IN_PROGRESS = "loadInProgress";
-
- void disposeProvider();
-
- void decorateCell(Cell cell, ICalendarItem item);
-
- boolean isMoveItemEnabled();
-
- void setMoveItemEnabled(boolean b);
-
- boolean isLoadInProgress();
-
- void setLoadInProgress(boolean b);
-
- long getRefreshIntervalMillis();
-
- void setRefreshIntervalMillis(long millis);
-
- /**
- * @return the current set of items in the requested range
- * <p>
- * is the currently loaded range is just a part of the requested range, a call to
- * {@link #execItemMovedAction(ICalendarItem, Date)} is launched and will result in a
- * PropertyChangeEvent("items")
- */
- ICalendarItem[] getItems(Date minDate, Date maxDate);
-
- void reloadProvider();
-
- IMenu[] getMenus();
-
- void onItemAction(ICalendarItem item) throws ProcessingException;
-
- void onItemMoved(ICalendarItem item, Date newDate) throws ProcessingException;
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.calendar.provider;
+
+import java.util.Date;
+
+import org.eclipse.scout.commons.beans.IPropertyObserver;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
+import org.eclipse.scout.rt.shared.services.common.calendar.ICalendarItem;
+
+public interface ICalendarItemProvider extends IPropertyObserver {
+
+ /**
+ * type {@link ICalendarItem}[]
+ */
+ String PROP_ITEMS = "items";
+ /**
+ * type boolean
+ */
+ String PROP_MOVE_ITEM_ENABLED = "moveItemEnabled";
+ /**
+ * type long
+ */
+ String PROP_REFRESH_INTERVAL_MILLIS = "refreshIntervalMillis";
+ /**
+ * type boolean
+ */
+ String PROP_LOAD_IN_PROGRESS = "loadInProgress";
+
+ void disposeProvider();
+
+ void decorateCell(Cell cell, ICalendarItem item);
+
+ boolean isMoveItemEnabled();
+
+ void setMoveItemEnabled(boolean b);
+
+ boolean isLoadInProgress();
+
+ void setLoadInProgress(boolean b);
+
+ long getRefreshIntervalMillis();
+
+ void setRefreshIntervalMillis(long millis);
+
+ /**
+ * @return the current set of items in the requested range
+ * <p>
+ * is the currently loaded range is just a part of the requested range, a call to
+ * {@link #execItemMovedAction(ICalendarItem, Date)} is launched and will result in a
+ * PropertyChangeEvent("items")
+ */
+ ICalendarItem[] getItems(Date minDate, Date maxDate);
+
+ void reloadProvider();
+
+ IMenu[] getMenus();
+
+ void onItemAction(ICalendarItem item) throws ProcessingException;
+
+ void onItemMoved(ICalendarItem item, Date newDate) throws ProcessingException;
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/cell/Cell.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/cell/Cell.java
index df34bdd8fc..835d936120 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/cell/Cell.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/cell/Cell.java
@@ -1,293 +1,293 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.cell;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractColumn;
-import org.eclipse.scout.rt.shared.data.basic.FontSpec;
-
-/**
- * A Cell represents model properties of a tree node or table cell.
- * <p>
- * This implementation shares graphical aspects with other cell instances and uses a {@link CellExtension} to store
- * rarely used properties.
- */
-public class Cell implements ICell {
-
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(Cell.class);
-
- private static final Map<CellStyle, CellStyle> SHARED_STYLE_STORE;
- private static final Object SHARED_STYLE_STORE_LOCK = new Object();
- private static final CellStyle DEFAULT_CELL_STYLE;
-
- static {
- SHARED_STYLE_STORE = new HashMap<CellStyle, CellStyle>();
- DEFAULT_CELL_STYLE = new CellStyle();
- SHARED_STYLE_STORE.put(DEFAULT_CELL_STYLE, DEFAULT_CELL_STYLE);
- }
-
- private ICellObserver m_observer;
- private Object m_value;
- private String m_text;
- private ICellSpecialization m_cellSpecialization = DEFAULT_CELL_STYLE;
-
- public Cell() {
- super();
- }
-
- public Cell(ICell c) {
- super();
- try {
- updateFrom(c);
- }
- catch (ProcessingException e) {
- //should never happen
- LOG.error("Unexpected", e);
- }
- }
-
- public Cell(ICellObserver observer) {
- super();
- setObserver(observer);
- }
-
- public Cell(ICellObserver observer, ICell c) throws ProcessingException {
- super();
- updateFrom(c);
- setObserver(observer);
- }
-
- public void updateFrom(ICell c) throws ProcessingException {
- if (c != null) {
- setFont(c.getFont());
- setForegroundColor(c.getForegroundColor());
- setBackgroundColor(c.getBackgroundColor());
- setHorizontalAlignment(c.getHorizontalAlignment());
- setTooltipText(c.getTooltipText());
- setIconId(c.getIconId());
- setText(c.getText());
- setValue(c.getValue());
- setEnabled(c.isEnabled());
- //do not reset observer
- }
- }
-
- @Override
- public Object getValue() {
- return m_value;
- }
-
- /**
- * @return true if the value has in fact changed
- */
- public boolean setValue(Object value) throws ProcessingException {
- if (getObserver() != null) {
- value = getObserver().validateValue(this, value);
- }
- if (CompareUtility.equals(m_value, value)) {
- return false;
- }
- else {
- m_value = value;
- if (getObserver() != null) {
- getObserver().cellChanged(this, VALUE_BIT);
- }
- return true;
- }
- }
-
- @Override
- public String getText() {
- return m_text;
- }
-
- public void setText(String s) {
- if (CompareUtility.notEquals(m_text, s)) {
- m_text = s;
- if (getObserver() != null) {
- getObserver().cellChanged(this, TEXT_BIT);
- }
- }
- }
-
- @Override
- public String getIconId() {
- return m_cellSpecialization.getIconId();
- }
-
- public void setIconId(String s) {
- if (CompareUtility.notEquals(m_cellSpecialization.getIconId(), s)) {
- ICellSpecialization newStyle = m_cellSpecialization.copy();
- newStyle.setIconId(s);
- setValueInternal(ICON_ID_BIT, newStyle);
- }
- }
-
- @Override
- public String getTooltipText() {
- return m_cellSpecialization.getTooltipText();
- }
-
- public void setTooltipText(String s) {
- if (m_cellSpecialization instanceof CellStyle) {
- if (!StringUtility.isNullOrEmpty(s)) {
- ICellSpecialization newStyle = new CellExtension(m_cellSpecialization);
- newStyle.setTooltipText(s);
- setValueInternal(TOOLTIP_BIT, newStyle);
- }
- }
- else if (CompareUtility.notEquals(m_cellSpecialization.getIconId(), s)) {
- ICellSpecialization newStyle = m_cellSpecialization.copy();
- newStyle.setTooltipText(s);
- setValueInternal(TOOLTIP_BIT, newStyle);
- }
- }
-
- @Override
- public int getHorizontalAlignment() {
- return m_cellSpecialization.getHorizontalAlignment();
- }
-
- public void setHorizontalAlignment(int a) {
- if (m_cellSpecialization.getHorizontalAlignment() != a) {
- ICellSpecialization newStyle = m_cellSpecialization.copy();
- newStyle.setHorizontalAlignment(a);
- setValueInternal(H_ALIGN_BIT, newStyle);
- }
- }
-
- @Override
- public String getBackgroundColor() {
- return m_cellSpecialization.getBackgroundColor();
- }
-
- public void setBackgroundColor(String c) {
- if (CompareUtility.notEquals(m_cellSpecialization.getBackgroundColor(), c)) {
- ICellSpecialization newStyle = m_cellSpecialization.copy();
- newStyle.setBackgroundColor(c);
- setValueInternal(BG_COLOR_BIT, newStyle);
- }
- }
-
- @Override
- public String getForegroundColor() {
- return m_cellSpecialization.getForegroundColor();
- }
-
- public void setForegroundColor(String c) {
- if (CompareUtility.notEquals(m_cellSpecialization.getForegroundColor(), c)) {
- ICellSpecialization newStyle = m_cellSpecialization.copy();
- newStyle.setForegroundColor(c);
- setValueInternal(FG_COLOR_BIT, newStyle);
- }
- }
-
- @Override
- public FontSpec getFont() {
- return m_cellSpecialization.getFont();
- }
-
- public void setFont(FontSpec f) {
- if (m_cellSpecialization.getFont() == null && f != null
- || m_cellSpecialization.getFont() != null && f == null
- || CompareUtility.notEquals(m_cellSpecialization.getFont(), f)) {
- ICellSpecialization newStyle = m_cellSpecialization.copy();
- newStyle.setFont(f);
- setValueInternal(FONT_BIT, newStyle);
- }
- }
-
- @Override
- public boolean isEnabled() {
- return m_cellSpecialization.isEnabled();
- }
-
- public void setEnabled(boolean b) {
- if (m_cellSpecialization instanceof CellStyle) {
- if (!b) {
- ICellSpecialization newStyle = new CellExtension(m_cellSpecialization);
- newStyle.setEnabled(b);
- setValueInternal(ENABLED_BIT, newStyle);
- }
- }
- else if (m_cellSpecialization.isEnabled() != b) {
- ICellSpecialization newStyle = m_cellSpecialization.copy();
- newStyle.setEnabled(b);
- setValueInternal(ENABLED_BIT, newStyle);
- }
- }
-
- @Override
- public boolean isEditable() {
- return m_cellSpecialization.isEditable();
- }
-
- /**
- * do not use or override this internal method. Use {@link AbstractColumn#execIsEditable()} instead which covers
- * various other checks. Refer to its JavaDoc for more detail.
- */
- public void setEditableInternal(boolean b) {
- if (m_cellSpecialization instanceof CellStyle) {
- if (b) {
- ICellSpecialization newStyle = new CellExtension(m_cellSpecialization);
- newStyle.setEditable(b);
- setValueInternal(EDITABLE_BIT, newStyle);
- }
- }
- else if (m_cellSpecialization.isEditable() != b) {
- ICellSpecialization newStyle = m_cellSpecialization.copy();
- newStyle.setEditable(b);
- setValueInternal(EDITABLE_BIT, newStyle);
- }
- }
-
- @Override
- public ICellObserver getObserver() {
- return m_observer;
- }
-
- public void setObserver(ICellObserver observer) {
- m_observer = observer;
- }
-
- private void setValueInternal(int bitPos, ICellSpecialization cellSpecialization) {
- synchronized (SHARED_STYLE_STORE_LOCK) {
- CellStyle newStyle = cellSpecialization.getCellStyle();
- CellStyle sharedStyle = SHARED_STYLE_STORE.get(newStyle);
- if (sharedStyle == null) {
- SHARED_STYLE_STORE.put(newStyle, newStyle);
- m_cellSpecialization = cellSpecialization.reconcile(newStyle);
- }
- else {
- m_cellSpecialization = cellSpecialization.reconcile(sharedStyle);
- }
- }
- if (getObserver() != null) {
- getObserver().cellChanged(this, bitPos);
- }
- }
-
- @Override
- public String toString() {
- String s = getText();
- if (s == null) {
- s = StringUtility.emptyIfNull(getValue());
- }
- return s;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.cell;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractColumn;
+import org.eclipse.scout.rt.shared.data.basic.FontSpec;
+
+/**
+ * A Cell represents model properties of a tree node or table cell.
+ * <p>
+ * This implementation shares graphical aspects with other cell instances and uses a {@link CellExtension} to store
+ * rarely used properties.
+ */
+public class Cell implements ICell {
+
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(Cell.class);
+
+ private static final Map<CellStyle, CellStyle> SHARED_STYLE_STORE;
+ private static final Object SHARED_STYLE_STORE_LOCK = new Object();
+ private static final CellStyle DEFAULT_CELL_STYLE;
+
+ static {
+ SHARED_STYLE_STORE = new HashMap<CellStyle, CellStyle>();
+ DEFAULT_CELL_STYLE = new CellStyle();
+ SHARED_STYLE_STORE.put(DEFAULT_CELL_STYLE, DEFAULT_CELL_STYLE);
+ }
+
+ private ICellObserver m_observer;
+ private Object m_value;
+ private String m_text;
+ private ICellSpecialization m_cellSpecialization = DEFAULT_CELL_STYLE;
+
+ public Cell() {
+ super();
+ }
+
+ public Cell(ICell c) {
+ super();
+ try {
+ updateFrom(c);
+ }
+ catch (ProcessingException e) {
+ //should never happen
+ LOG.error("Unexpected", e);
+ }
+ }
+
+ public Cell(ICellObserver observer) {
+ super();
+ setObserver(observer);
+ }
+
+ public Cell(ICellObserver observer, ICell c) throws ProcessingException {
+ super();
+ updateFrom(c);
+ setObserver(observer);
+ }
+
+ public void updateFrom(ICell c) throws ProcessingException {
+ if (c != null) {
+ setFont(c.getFont());
+ setForegroundColor(c.getForegroundColor());
+ setBackgroundColor(c.getBackgroundColor());
+ setHorizontalAlignment(c.getHorizontalAlignment());
+ setTooltipText(c.getTooltipText());
+ setIconId(c.getIconId());
+ setText(c.getText());
+ setValue(c.getValue());
+ setEnabled(c.isEnabled());
+ //do not reset observer
+ }
+ }
+
+ @Override
+ public Object getValue() {
+ return m_value;
+ }
+
+ /**
+ * @return true if the value has in fact changed
+ */
+ public boolean setValue(Object value) throws ProcessingException {
+ if (getObserver() != null) {
+ value = getObserver().validateValue(this, value);
+ }
+ if (CompareUtility.equals(m_value, value)) {
+ return false;
+ }
+ else {
+ m_value = value;
+ if (getObserver() != null) {
+ getObserver().cellChanged(this, VALUE_BIT);
+ }
+ return true;
+ }
+ }
+
+ @Override
+ public String getText() {
+ return m_text;
+ }
+
+ public void setText(String s) {
+ if (CompareUtility.notEquals(m_text, s)) {
+ m_text = s;
+ if (getObserver() != null) {
+ getObserver().cellChanged(this, TEXT_BIT);
+ }
+ }
+ }
+
+ @Override
+ public String getIconId() {
+ return m_cellSpecialization.getIconId();
+ }
+
+ public void setIconId(String s) {
+ if (CompareUtility.notEquals(m_cellSpecialization.getIconId(), s)) {
+ ICellSpecialization newStyle = m_cellSpecialization.copy();
+ newStyle.setIconId(s);
+ setValueInternal(ICON_ID_BIT, newStyle);
+ }
+ }
+
+ @Override
+ public String getTooltipText() {
+ return m_cellSpecialization.getTooltipText();
+ }
+
+ public void setTooltipText(String s) {
+ if (m_cellSpecialization instanceof CellStyle) {
+ if (!StringUtility.isNullOrEmpty(s)) {
+ ICellSpecialization newStyle = new CellExtension(m_cellSpecialization);
+ newStyle.setTooltipText(s);
+ setValueInternal(TOOLTIP_BIT, newStyle);
+ }
+ }
+ else if (CompareUtility.notEquals(m_cellSpecialization.getIconId(), s)) {
+ ICellSpecialization newStyle = m_cellSpecialization.copy();
+ newStyle.setTooltipText(s);
+ setValueInternal(TOOLTIP_BIT, newStyle);
+ }
+ }
+
+ @Override
+ public int getHorizontalAlignment() {
+ return m_cellSpecialization.getHorizontalAlignment();
+ }
+
+ public void setHorizontalAlignment(int a) {
+ if (m_cellSpecialization.getHorizontalAlignment() != a) {
+ ICellSpecialization newStyle = m_cellSpecialization.copy();
+ newStyle.setHorizontalAlignment(a);
+ setValueInternal(H_ALIGN_BIT, newStyle);
+ }
+ }
+
+ @Override
+ public String getBackgroundColor() {
+ return m_cellSpecialization.getBackgroundColor();
+ }
+
+ public void setBackgroundColor(String c) {
+ if (CompareUtility.notEquals(m_cellSpecialization.getBackgroundColor(), c)) {
+ ICellSpecialization newStyle = m_cellSpecialization.copy();
+ newStyle.setBackgroundColor(c);
+ setValueInternal(BG_COLOR_BIT, newStyle);
+ }
+ }
+
+ @Override
+ public String getForegroundColor() {
+ return m_cellSpecialization.getForegroundColor();
+ }
+
+ public void setForegroundColor(String c) {
+ if (CompareUtility.notEquals(m_cellSpecialization.getForegroundColor(), c)) {
+ ICellSpecialization newStyle = m_cellSpecialization.copy();
+ newStyle.setForegroundColor(c);
+ setValueInternal(FG_COLOR_BIT, newStyle);
+ }
+ }
+
+ @Override
+ public FontSpec getFont() {
+ return m_cellSpecialization.getFont();
+ }
+
+ public void setFont(FontSpec f) {
+ if (m_cellSpecialization.getFont() == null && f != null
+ || m_cellSpecialization.getFont() != null && f == null
+ || CompareUtility.notEquals(m_cellSpecialization.getFont(), f)) {
+ ICellSpecialization newStyle = m_cellSpecialization.copy();
+ newStyle.setFont(f);
+ setValueInternal(FONT_BIT, newStyle);
+ }
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return m_cellSpecialization.isEnabled();
+ }
+
+ public void setEnabled(boolean b) {
+ if (m_cellSpecialization instanceof CellStyle) {
+ if (!b) {
+ ICellSpecialization newStyle = new CellExtension(m_cellSpecialization);
+ newStyle.setEnabled(b);
+ setValueInternal(ENABLED_BIT, newStyle);
+ }
+ }
+ else if (m_cellSpecialization.isEnabled() != b) {
+ ICellSpecialization newStyle = m_cellSpecialization.copy();
+ newStyle.setEnabled(b);
+ setValueInternal(ENABLED_BIT, newStyle);
+ }
+ }
+
+ @Override
+ public boolean isEditable() {
+ return m_cellSpecialization.isEditable();
+ }
+
+ /**
+ * do not use or override this internal method. Use {@link AbstractColumn#execIsEditable()} instead which covers
+ * various other checks. Refer to its JavaDoc for more detail.
+ */
+ public void setEditableInternal(boolean b) {
+ if (m_cellSpecialization instanceof CellStyle) {
+ if (b) {
+ ICellSpecialization newStyle = new CellExtension(m_cellSpecialization);
+ newStyle.setEditable(b);
+ setValueInternal(EDITABLE_BIT, newStyle);
+ }
+ }
+ else if (m_cellSpecialization.isEditable() != b) {
+ ICellSpecialization newStyle = m_cellSpecialization.copy();
+ newStyle.setEditable(b);
+ setValueInternal(EDITABLE_BIT, newStyle);
+ }
+ }
+
+ @Override
+ public ICellObserver getObserver() {
+ return m_observer;
+ }
+
+ public void setObserver(ICellObserver observer) {
+ m_observer = observer;
+ }
+
+ private void setValueInternal(int bitPos, ICellSpecialization cellSpecialization) {
+ synchronized (SHARED_STYLE_STORE_LOCK) {
+ CellStyle newStyle = cellSpecialization.getCellStyle();
+ CellStyle sharedStyle = SHARED_STYLE_STORE.get(newStyle);
+ if (sharedStyle == null) {
+ SHARED_STYLE_STORE.put(newStyle, newStyle);
+ m_cellSpecialization = cellSpecialization.reconcile(newStyle);
+ }
+ else {
+ m_cellSpecialization = cellSpecialization.reconcile(sharedStyle);
+ }
+ }
+ if (getObserver() != null) {
+ getObserver().cellChanged(this, bitPos);
+ }
+ }
+
+ @Override
+ public String toString() {
+ String s = getText();
+ if (s == null) {
+ s = StringUtility.emptyIfNull(getValue());
+ }
+ return s;
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/cell/CellExtension.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/cell/CellExtension.java
index 46205bd817..35124231e6 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/cell/CellExtension.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/cell/CellExtension.java
@@ -1,133 +1,133 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.cell;
-
-import org.eclipse.scout.rt.shared.data.basic.FontSpec;
-
-/**
- * Rarely used attributes of a {@link Cell} are stored in this class. It references a probably shared instance of a
- * {@link CellStyle} class.
- * <p>
- * <b>Note</b>: Instances of this class are not expected to be shared between multiple {@link Cell}s.
- */
-public class CellExtension implements ICellSpecialization {
-
- private String m_tooltipText;
- private boolean m_enabled;
- private boolean m_editable;
- private CellStyle m_cellStyle;
-
- public CellExtension(ICellSpecialization specialization) {
- m_enabled = true;
- m_cellStyle = specialization.getCellStyle();
- }
-
- @Override
- public ICellSpecialization copy() {
- setCellStyle(getCellStyle().copy());
- return this;
- }
-
- @Override
- public ICellSpecialization reconcile(CellStyle cellStyle) {
- setCellStyle(cellStyle);
- return this;
- }
-
- @Override
- public String getTooltipText() {
- return m_tooltipText;
- }
-
- @Override
- public void setTooltipText(String tooltipText) {
- m_tooltipText = tooltipText;
- }
-
- @Override
- public boolean isEnabled() {
- return m_enabled;
- }
-
- @Override
- public void setEnabled(boolean enabled) {
- m_enabled = enabled;
- }
-
- @Override
- public boolean isEditable() {
- return m_editable;
- }
-
- @Override
- public void setEditable(boolean editable) {
- m_editable = editable;
- }
-
- @Override
- public CellStyle getCellStyle() {
- return m_cellStyle;
- }
-
- public void setCellStyle(CellStyle cellStyle) {
- m_cellStyle = cellStyle;
- }
-
- @Override
- public String getBackgroundColor() {
- return m_cellStyle.getBackgroundColor();
- }
-
- @Override
- public FontSpec getFont() {
- return m_cellStyle.getFont();
- }
-
- @Override
- public String getForegroundColor() {
- return m_cellStyle.getForegroundColor();
- }
-
- @Override
- public int getHorizontalAlignment() {
- return m_cellStyle.getHorizontalAlignment();
- }
-
- @Override
- public String getIconId() {
- return m_cellStyle.getIconId();
- }
-
- @Override
- public void setBackgroundColor(String backgroundColor) {
- m_cellStyle.setBackgroundColor(backgroundColor);
- }
-
- @Override
- public void setFont(FontSpec font) {
- m_cellStyle.setFont(font);
- }
-
- @Override
- public void setForegroundColor(String foregroundColor) {
- m_cellStyle.setForegroundColor(foregroundColor);
- }
-
- @Override
- public void setHorizontalAlignment(int horizontalAlignment) {
- m_cellStyle.setHorizontalAlignment(horizontalAlignment);
- }
-
- @Override
- public void setIconId(String iconId) {
- m_cellStyle.setIconId(iconId);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.cell;
+
+import org.eclipse.scout.rt.shared.data.basic.FontSpec;
+
+/**
+ * Rarely used attributes of a {@link Cell} are stored in this class. It references a probably shared instance of a
+ * {@link CellStyle} class.
+ * <p>
+ * <b>Note</b>: Instances of this class are not expected to be shared between multiple {@link Cell}s.
+ */
+public class CellExtension implements ICellSpecialization {
+
+ private String m_tooltipText;
+ private boolean m_enabled;
+ private boolean m_editable;
+ private CellStyle m_cellStyle;
+
+ public CellExtension(ICellSpecialization specialization) {
+ m_enabled = true;
+ m_cellStyle = specialization.getCellStyle();
+ }
+
+ @Override
+ public ICellSpecialization copy() {
+ setCellStyle(getCellStyle().copy());
+ return this;
+ }
+
+ @Override
+ public ICellSpecialization reconcile(CellStyle cellStyle) {
+ setCellStyle(cellStyle);
+ return this;
+ }
+
+ @Override
+ public String getTooltipText() {
+ return m_tooltipText;
+ }
+
+ @Override
+ public void setTooltipText(String tooltipText) {
+ m_tooltipText = tooltipText;
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return m_enabled;
+ }
+
+ @Override
+ public void setEnabled(boolean enabled) {
+ m_enabled = enabled;
+ }
+
+ @Override
+ public boolean isEditable() {
+ return m_editable;
+ }
+
+ @Override
+ public void setEditable(boolean editable) {
+ m_editable = editable;
+ }
+
+ @Override
+ public CellStyle getCellStyle() {
+ return m_cellStyle;
+ }
+
+ public void setCellStyle(CellStyle cellStyle) {
+ m_cellStyle = cellStyle;
+ }
+
+ @Override
+ public String getBackgroundColor() {
+ return m_cellStyle.getBackgroundColor();
+ }
+
+ @Override
+ public FontSpec getFont() {
+ return m_cellStyle.getFont();
+ }
+
+ @Override
+ public String getForegroundColor() {
+ return m_cellStyle.getForegroundColor();
+ }
+
+ @Override
+ public int getHorizontalAlignment() {
+ return m_cellStyle.getHorizontalAlignment();
+ }
+
+ @Override
+ public String getIconId() {
+ return m_cellStyle.getIconId();
+ }
+
+ @Override
+ public void setBackgroundColor(String backgroundColor) {
+ m_cellStyle.setBackgroundColor(backgroundColor);
+ }
+
+ @Override
+ public void setFont(FontSpec font) {
+ m_cellStyle.setFont(font);
+ }
+
+ @Override
+ public void setForegroundColor(String foregroundColor) {
+ m_cellStyle.setForegroundColor(foregroundColor);
+ }
+
+ @Override
+ public void setHorizontalAlignment(int horizontalAlignment) {
+ m_cellStyle.setHorizontalAlignment(horizontalAlignment);
+ }
+
+ @Override
+ public void setIconId(String iconId) {
+ m_cellStyle.setIconId(iconId);
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/cell/CellStyle.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/cell/CellStyle.java
index bb8f6d99c1..bbf8e9b808 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/cell/CellStyle.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/cell/CellStyle.java
@@ -1,195 +1,195 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.cell;
-
-import org.eclipse.scout.rt.shared.data.basic.FontSpec;
-
-/**
- * A cell style represents the graphical properties of a particular cell. These values are kept in a
- * different class so that they can be shared between {@link Cell} instances.
- */
-public class CellStyle implements ICellSpecialization {
-
- private String m_iconId;
- private String m_backgroundColor;
- private String m_foregroundColor;
- private FontSpec m_fontSpec;
- private int m_horizontalAlignment;
-
- public CellStyle() {
- m_horizontalAlignment = -1;
- }
-
- public CellStyle(CellStyle cell) {
- setIconId(cell.getIconId());
- setBackgroundColor(cell.getBackgroundColor());
- setForegroundColor(cell.getForegroundColor());
- setFont(cell.getFont());
- setHorizontalAlignment(cell.getHorizontalAlignment());
- }
-
- @Override
- public CellStyle copy() {
- return new CellStyle(this);
- }
-
- @Override
- public void setEnabled(boolean enabled) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void setTooltipText(String tooltip) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void setEditable(boolean editable) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public String getTooltipText() {
- return null;
- }
-
- @Override
- public boolean isEnabled() {
- return true;
- }
-
- @Override
- public boolean isEditable() {
- return false;
- }
-
- @Override
- public CellStyle getCellStyle() {
- return this;
- }
-
- @Override
- public ICellSpecialization reconcile(CellStyle cellStyle) {
- return cellStyle;
- }
-
- @Override
- public String getIconId() {
- return m_iconId;
- }
-
- @Override
- public void setIconId(String iconId) {
- m_iconId = iconId;
- }
-
- @Override
- public String getBackgroundColor() {
- return m_backgroundColor;
- }
-
- @Override
- public void setBackgroundColor(String backgroundColor) {
- m_backgroundColor = backgroundColor;
- }
-
- @Override
- public String getForegroundColor() {
- return m_foregroundColor;
- }
-
- @Override
- public void setForegroundColor(String foregroundColor) {
- m_foregroundColor = foregroundColor;
- }
-
- @Override
- public FontSpec getFont() {
- return m_fontSpec;
- }
-
- @Override
- public void setFont(FontSpec font) {
- m_fontSpec = font;
- }
-
- @Override
- public int getHorizontalAlignment() {
- return m_horizontalAlignment;
- }
-
- @Override
- public void setHorizontalAlignment(int horizontalAlignment) {
- m_horizontalAlignment = horizontalAlignment;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((m_backgroundColor == null) ? 0 : m_backgroundColor.hashCode());
- result = prime * result + ((m_fontSpec == null) ? 0 : m_fontSpec.hashCode());
- result = prime * result + ((m_foregroundColor == null) ? 0 : m_foregroundColor.hashCode());
- result = prime * result + m_horizontalAlignment;
- result = prime * result + ((m_iconId == null) ? 0 : m_iconId.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;
- }
- CellStyle other = (CellStyle) obj;
- if (m_backgroundColor == null) {
- if (other.m_backgroundColor != null) {
- return false;
- }
- }
- else if (!m_backgroundColor.equals(other.m_backgroundColor)) {
- return false;
- }
- if (m_fontSpec == null) {
- if (other.m_fontSpec != null) {
- return false;
- }
- }
- else if (!m_fontSpec.equals(other.m_fontSpec)) {
- return false;
- }
- if (m_foregroundColor == null) {
- if (other.m_foregroundColor != null) {
- return false;
- }
- }
- else if (!m_foregroundColor.equals(other.m_foregroundColor)) {
- return false;
- }
- if (m_horizontalAlignment != other.m_horizontalAlignment) {
- return false;
- }
- if (m_iconId == null) {
- if (other.m_iconId != null) {
- return false;
- }
- }
- else if (!m_iconId.equals(other.m_iconId)) {
- return false;
- }
- return true;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.cell;
+
+import org.eclipse.scout.rt.shared.data.basic.FontSpec;
+
+/**
+ * A cell style represents the graphical properties of a particular cell. These values are kept in a
+ * different class so that they can be shared between {@link Cell} instances.
+ */
+public class CellStyle implements ICellSpecialization {
+
+ private String m_iconId;
+ private String m_backgroundColor;
+ private String m_foregroundColor;
+ private FontSpec m_fontSpec;
+ private int m_horizontalAlignment;
+
+ public CellStyle() {
+ m_horizontalAlignment = -1;
+ }
+
+ public CellStyle(CellStyle cell) {
+ setIconId(cell.getIconId());
+ setBackgroundColor(cell.getBackgroundColor());
+ setForegroundColor(cell.getForegroundColor());
+ setFont(cell.getFont());
+ setHorizontalAlignment(cell.getHorizontalAlignment());
+ }
+
+ @Override
+ public CellStyle copy() {
+ return new CellStyle(this);
+ }
+
+ @Override
+ public void setEnabled(boolean enabled) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void setTooltipText(String tooltip) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void setEditable(boolean editable) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public String getTooltipText() {
+ return null;
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return true;
+ }
+
+ @Override
+ public boolean isEditable() {
+ return false;
+ }
+
+ @Override
+ public CellStyle getCellStyle() {
+ return this;
+ }
+
+ @Override
+ public ICellSpecialization reconcile(CellStyle cellStyle) {
+ return cellStyle;
+ }
+
+ @Override
+ public String getIconId() {
+ return m_iconId;
+ }
+
+ @Override
+ public void setIconId(String iconId) {
+ m_iconId = iconId;
+ }
+
+ @Override
+ public String getBackgroundColor() {
+ return m_backgroundColor;
+ }
+
+ @Override
+ public void setBackgroundColor(String backgroundColor) {
+ m_backgroundColor = backgroundColor;
+ }
+
+ @Override
+ public String getForegroundColor() {
+ return m_foregroundColor;
+ }
+
+ @Override
+ public void setForegroundColor(String foregroundColor) {
+ m_foregroundColor = foregroundColor;
+ }
+
+ @Override
+ public FontSpec getFont() {
+ return m_fontSpec;
+ }
+
+ @Override
+ public void setFont(FontSpec font) {
+ m_fontSpec = font;
+ }
+
+ @Override
+ public int getHorizontalAlignment() {
+ return m_horizontalAlignment;
+ }
+
+ @Override
+ public void setHorizontalAlignment(int horizontalAlignment) {
+ m_horizontalAlignment = horizontalAlignment;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((m_backgroundColor == null) ? 0 : m_backgroundColor.hashCode());
+ result = prime * result + ((m_fontSpec == null) ? 0 : m_fontSpec.hashCode());
+ result = prime * result + ((m_foregroundColor == null) ? 0 : m_foregroundColor.hashCode());
+ result = prime * result + m_horizontalAlignment;
+ result = prime * result + ((m_iconId == null) ? 0 : m_iconId.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;
+ }
+ CellStyle other = (CellStyle) obj;
+ if (m_backgroundColor == null) {
+ if (other.m_backgroundColor != null) {
+ return false;
+ }
+ }
+ else if (!m_backgroundColor.equals(other.m_backgroundColor)) {
+ return false;
+ }
+ if (m_fontSpec == null) {
+ if (other.m_fontSpec != null) {
+ return false;
+ }
+ }
+ else if (!m_fontSpec.equals(other.m_fontSpec)) {
+ return false;
+ }
+ if (m_foregroundColor == null) {
+ if (other.m_foregroundColor != null) {
+ return false;
+ }
+ }
+ else if (!m_foregroundColor.equals(other.m_foregroundColor)) {
+ return false;
+ }
+ if (m_horizontalAlignment != other.m_horizontalAlignment) {
+ return false;
+ }
+ if (m_iconId == null) {
+ if (other.m_iconId != null) {
+ return false;
+ }
+ }
+ else if (!m_iconId.equals(other.m_iconId)) {
+ return false;
+ }
+ return true;
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/cell/ICell.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/cell/ICell.java
index d6883933fa..3a1c6bd335 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/cell/ICell.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/cell/ICell.java
@@ -1,58 +1,58 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.cell;
-
-import org.eclipse.scout.rt.client.ClientJob;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.shared.data.basic.FontSpec;
-
-public interface ICell {
- int OBSERVER_BIT = 0;// tree, table, matrix etc.
- int VALUE_BIT = 1;
- int TEXT_BIT = 2;
- int ICON_ID_BIT = 3;
- int TOOLTIP_BIT = 4;
- int H_ALIGN_BIT = 5;// default -1, value byte
- int BG_COLOR_BIT = 6;
- int FG_COLOR_BIT = 7;
- int FONT_BIT = 8;
- int ENABLED_BIT = 9;// default true, value Boolean
- int EDITABLE_BIT = 10;// default false, value Boolean
-
- Object getValue();
-
- String getText();
-
- String getIconId();
-
- String getTooltipText();
-
- int getHorizontalAlignment();
-
- String getBackgroundColor();
-
- String getForegroundColor();
-
- FontSpec getFont();
-
- boolean isEnabled();
-
- /**
- * @return true if the cell is <b>basically</b> editable. This flag is used primarly to decorate editable cells. It
- * does not regard
- * the visible state of the column, table and container.
- * To check for effective editable use {@link ITable#isCellEditable(int, int)} inside a {@link ClientJob}
- */
- boolean isEditable();
-
- ICellObserver getObserver();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.cell;
+
+import org.eclipse.scout.rt.client.ClientJob;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.shared.data.basic.FontSpec;
+
+public interface ICell {
+ int OBSERVER_BIT = 0;// tree, table, matrix etc.
+ int VALUE_BIT = 1;
+ int TEXT_BIT = 2;
+ int ICON_ID_BIT = 3;
+ int TOOLTIP_BIT = 4;
+ int H_ALIGN_BIT = 5;// default -1, value byte
+ int BG_COLOR_BIT = 6;
+ int FG_COLOR_BIT = 7;
+ int FONT_BIT = 8;
+ int ENABLED_BIT = 9;// default true, value Boolean
+ int EDITABLE_BIT = 10;// default false, value Boolean
+
+ Object getValue();
+
+ String getText();
+
+ String getIconId();
+
+ String getTooltipText();
+
+ int getHorizontalAlignment();
+
+ String getBackgroundColor();
+
+ String getForegroundColor();
+
+ FontSpec getFont();
+
+ boolean isEnabled();
+
+ /**
+ * @return true if the cell is <b>basically</b> editable. This flag is used primarly to decorate editable cells. It
+ * does not regard
+ * the visible state of the column, table and container.
+ * To check for effective editable use {@link ITable#isCellEditable(int, int)} inside a {@link ClientJob}
+ */
+ boolean isEditable();
+
+ ICellObserver getObserver();
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/cell/ICellObserver.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/cell/ICellObserver.java
index 053e8df667..d899458584 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/cell/ICellObserver.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/cell/ICellObserver.java
@@ -1,29 +1,29 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.cell;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-
-public interface ICellObserver {
-
- /**
- * before the fact report before a new value is stored in the cell
- *
- * @return validated value
- */
- Object validateValue(ICell cell, Object value) throws ProcessingException;
-
- /**
- * after the fact report after a value was stored inthe cell
- */
- void cellChanged(ICell cell, int changedBit);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.cell;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+
+public interface ICellObserver {
+
+ /**
+ * before the fact report before a new value is stored in the cell
+ *
+ * @return validated value
+ */
+ Object validateValue(ICell cell, Object value) throws ProcessingException;
+
+ /**
+ * after the fact report after a value was stored inthe cell
+ */
+ void cellChanged(ICell cell, int changedBit);
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/cell/ICellSpecialization.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/cell/ICellSpecialization.java
index a783f52596..0e5c2b89ab 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/cell/ICellSpecialization.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/cell/ICellSpecialization.java
@@ -1,70 +1,70 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.cell;
-
-import org.eclipse.scout.rt.shared.data.basic.FontSpec;
-
-/**
- * A cell specialization carries rarely used cell properties as well as style attributes.
- */
-public interface ICellSpecialization {
-
- /**
- * Creates a copy of this object. Subclasses may copy only values shared with other instances of this interface.
- *
- * @return returns a copy of this object.
- */
- ICellSpecialization copy();
-
- /**
- * Reconciles the given cell style with this instance and returns the reconciled result. In general, the resulting
- * object is not the same as the one the method is called on.
- *
- * @param cellStyle
- * the cell style to reconcile.
- * @return the potentially new object with the reconciled cell style.
- */
- ICellSpecialization reconcile(CellStyle cellStyle);
-
- CellStyle getCellStyle();
-
- String getTooltipText();
-
- void setTooltipText(String tooltip);
-
- boolean isEnabled();
-
- void setEnabled(boolean enabled);
-
- boolean isEditable();
-
- void setEditable(boolean editable);
-
- String getIconId();
-
- void setIconId(String iconId);
-
- String getBackgroundColor();
-
- void setBackgroundColor(String backgroundColor);
-
- String getForegroundColor();
-
- void setForegroundColor(String foregroundColor);
-
- FontSpec getFont();
-
- void setFont(FontSpec font);
-
- int getHorizontalAlignment();
-
- void setHorizontalAlignment(int horizontalAlignment);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.cell;
+
+import org.eclipse.scout.rt.shared.data.basic.FontSpec;
+
+/**
+ * A cell specialization carries rarely used cell properties as well as style attributes.
+ */
+public interface ICellSpecialization {
+
+ /**
+ * Creates a copy of this object. Subclasses may copy only values shared with other instances of this interface.
+ *
+ * @return returns a copy of this object.
+ */
+ ICellSpecialization copy();
+
+ /**
+ * Reconciles the given cell style with this instance and returns the reconciled result. In general, the resulting
+ * object is not the same as the one the method is called on.
+ *
+ * @param cellStyle
+ * the cell style to reconcile.
+ * @return the potentially new object with the reconciled cell style.
+ */
+ ICellSpecialization reconcile(CellStyle cellStyle);
+
+ CellStyle getCellStyle();
+
+ String getTooltipText();
+
+ void setTooltipText(String tooltip);
+
+ boolean isEnabled();
+
+ void setEnabled(boolean enabled);
+
+ boolean isEditable();
+
+ void setEditable(boolean editable);
+
+ String getIconId();
+
+ void setIconId(String iconId);
+
+ String getBackgroundColor();
+
+ void setBackgroundColor(String backgroundColor);
+
+ String getForegroundColor();
+
+ void setForegroundColor(String foregroundColor);
+
+ FontSpec getFont();
+
+ void setFont(FontSpec font);
+
+ int getHorizontalAlignment();
+
+ void setHorizontalAlignment(int horizontalAlignment);
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/filechooser/FileChooser.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/filechooser/FileChooser.java
index 07b6a50039..41a553f146 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/filechooser/FileChooser.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/filechooser/FileChooser.java
@@ -1,167 +1,167 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.filechooser;
-
-import java.io.File;
-
-import org.eclipse.core.runtime.preferences.IEclipsePreferences;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.commons.prefs.UserScope;
-import org.eclipse.scout.rt.client.BlockingCondition;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.osgi.service.prefs.BackingStoreException;
-
-public class FileChooser implements IFileChooser {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(FileChooser.class);
-
- private File m_directory;
- private String m_fileName;
- private String[] m_fileExtensions;
- private boolean m_folderMode;
- private boolean m_load;
- private boolean m_multiSelect;
- // result
- private File[] m_files;
- private final BlockingCondition m_blockingCondition = new BlockingCondition(false);
-
- public FileChooser() {
- }
-
- public FileChooser(File directory, String[] fileExtensions, boolean load) {
- m_directory = directory;
- m_fileExtensions = fileExtensions;
- m_load = load;
- }
-
- @Override
- public File getDirectory() {
- return m_directory;
- }
-
- public void setDirectory(File directory) {
- this.m_directory = directory;
- }
-
- @Override
- public String[] getFileExtensions() {
- return m_fileExtensions;
- }
-
- public void setFileExtensions(String[] fileExtensions) {
- this.m_fileExtensions = fileExtensions;
- }
-
- @Override
- public String getFileName() {
- return m_fileName;
- }
-
- public void setFileName(String fileName) {
- this.m_fileName = fileName;
- }
-
- @Override
- public boolean isFolderMode() {
- return m_folderMode;
- }
-
- public void setFolderMode(boolean folderMode) {
- this.m_folderMode = folderMode;
- }
-
- @Override
- public boolean isTypeLoad() {
- return m_load;
- }
-
- public void setTypeLoad(boolean load) {
- this.m_load = load;
- }
-
- @Override
- public boolean isMultiSelect() {
- return m_multiSelect;
- }
-
- public void setMultiSelect(boolean multiSelect) {
- this.m_multiSelect = multiSelect;
- }
-
- public static String getCurrentDirectory() {
- IClientSession session = ClientSyncJob.getCurrentSession();
- if (session == null) {
- return null;
- }
- String id = session.getBundle().getSymbolicName() + "-" + session.getUserId();
- IEclipsePreferences props = new UserScope().getNode(id);
- return props.get("current-dir", null);
- }
-
- public static void setCurrentDirectory(String dir) {
- IClientSession session = ClientSyncJob.getCurrentSession();
- if (session == null) {
- return;
- }
- String id = session.getBundle().getSymbolicName() + "-" + session.getUserId();
- IEclipsePreferences props = new UserScope().getNode(id);
- props.put("current-dir", dir);
- try {
- props.flush();
- }
- catch (BackingStoreException e) {
- //nop
- }
- }
-
- @Override
- public File[] getFiles() {
- return m_files != null ? m_files : new File[0];
- }
-
- @Override
- public void setFiles(File[] f) {
- m_files = f;
- m_blockingCondition.release();
- }
-
- @Override
- public File[] startChooser() {
- m_files = null;
- m_blockingCondition.setBlocking(true);
- ClientSyncJob.getCurrentSession().getDesktop().addFileChooser(this);
- try {
- waitFor();
- }
- catch (ProcessingException e) {
- LOG.error(null, e);
- }
- return getFiles();
- }
-
- private void waitFor() throws ProcessingException {
- // check if the desktop is observing this process
- IDesktop desktop = ClientSyncJob.getCurrentSession().getDesktop();
- if (desktop == null || !desktop.isOpened()) {
- throw new ProcessingException("Cannot wait for " + getClass().getName() + ". There is no desktop or the desktop has not yet been opened in the ui");
- }
- try {
- m_blockingCondition.waitFor();
- }
- catch (InterruptedException e) {
- throw new ProcessingException(ScoutTexts.get("UserInterrupted"), e);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.filechooser;
+
+import java.io.File;
+
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.commons.prefs.UserScope;
+import org.eclipse.scout.rt.client.BlockingCondition;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.osgi.service.prefs.BackingStoreException;
+
+public class FileChooser implements IFileChooser {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(FileChooser.class);
+
+ private File m_directory;
+ private String m_fileName;
+ private String[] m_fileExtensions;
+ private boolean m_folderMode;
+ private boolean m_load;
+ private boolean m_multiSelect;
+ // result
+ private File[] m_files;
+ private final BlockingCondition m_blockingCondition = new BlockingCondition(false);
+
+ public FileChooser() {
+ }
+
+ public FileChooser(File directory, String[] fileExtensions, boolean load) {
+ m_directory = directory;
+ m_fileExtensions = fileExtensions;
+ m_load = load;
+ }
+
+ @Override
+ public File getDirectory() {
+ return m_directory;
+ }
+
+ public void setDirectory(File directory) {
+ this.m_directory = directory;
+ }
+
+ @Override
+ public String[] getFileExtensions() {
+ return m_fileExtensions;
+ }
+
+ public void setFileExtensions(String[] fileExtensions) {
+ this.m_fileExtensions = fileExtensions;
+ }
+
+ @Override
+ public String getFileName() {
+ return m_fileName;
+ }
+
+ public void setFileName(String fileName) {
+ this.m_fileName = fileName;
+ }
+
+ @Override
+ public boolean isFolderMode() {
+ return m_folderMode;
+ }
+
+ public void setFolderMode(boolean folderMode) {
+ this.m_folderMode = folderMode;
+ }
+
+ @Override
+ public boolean isTypeLoad() {
+ return m_load;
+ }
+
+ public void setTypeLoad(boolean load) {
+ this.m_load = load;
+ }
+
+ @Override
+ public boolean isMultiSelect() {
+ return m_multiSelect;
+ }
+
+ public void setMultiSelect(boolean multiSelect) {
+ this.m_multiSelect = multiSelect;
+ }
+
+ public static String getCurrentDirectory() {
+ IClientSession session = ClientSyncJob.getCurrentSession();
+ if (session == null) {
+ return null;
+ }
+ String id = session.getBundle().getSymbolicName() + "-" + session.getUserId();
+ IEclipsePreferences props = new UserScope().getNode(id);
+ return props.get("current-dir", null);
+ }
+
+ public static void setCurrentDirectory(String dir) {
+ IClientSession session = ClientSyncJob.getCurrentSession();
+ if (session == null) {
+ return;
+ }
+ String id = session.getBundle().getSymbolicName() + "-" + session.getUserId();
+ IEclipsePreferences props = new UserScope().getNode(id);
+ props.put("current-dir", dir);
+ try {
+ props.flush();
+ }
+ catch (BackingStoreException e) {
+ //nop
+ }
+ }
+
+ @Override
+ public File[] getFiles() {
+ return m_files != null ? m_files : new File[0];
+ }
+
+ @Override
+ public void setFiles(File[] f) {
+ m_files = f;
+ m_blockingCondition.release();
+ }
+
+ @Override
+ public File[] startChooser() {
+ m_files = null;
+ m_blockingCondition.setBlocking(true);
+ ClientSyncJob.getCurrentSession().getDesktop().addFileChooser(this);
+ try {
+ waitFor();
+ }
+ catch (ProcessingException e) {
+ LOG.error(null, e);
+ }
+ return getFiles();
+ }
+
+ private void waitFor() throws ProcessingException {
+ // check if the desktop is observing this process
+ IDesktop desktop = ClientSyncJob.getCurrentSession().getDesktop();
+ if (desktop == null || !desktop.isOpened()) {
+ throw new ProcessingException("Cannot wait for " + getClass().getName() + ". There is no desktop or the desktop has not yet been opened in the ui");
+ }
+ try {
+ m_blockingCondition.waitFor();
+ }
+ catch (InterruptedException e) {
+ throw new ProcessingException(ScoutTexts.get("UserInterrupted"), e);
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/filechooser/IFileChooser.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/filechooser/IFileChooser.java
index 911510f626..25776ad41e 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/filechooser/IFileChooser.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/filechooser/IFileChooser.java
@@ -1,54 +1,54 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.filechooser;
-
-import java.io.File;
-
-public interface IFileChooser {
-
- File getDirectory();
-
- String getFileName();
-
- String[] getFileExtensions();
-
- /**
- * Load or Save
- * <ul>
- * <li><code>true</code> loads the file from the file system into the application.</li>
- * <li><code>false</code> saves the file from the application to the file system. Attention: This does not work in
- * RAP/Web-UI</li>
- * </ul>
- */
- boolean isTypeLoad();
-
- /**
- * Folder or File
- */
- boolean isFolderMode();
-
- boolean isMultiSelect();
-
- /**
- * start file choosing and block until a result is available
- *
- * @return {@link #getFiles()}
- */
- File[] startChooser();
-
- /**
- * set result value and close chooser
- */
- void setFiles(File[] files);
-
- File[] getFiles();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.filechooser;
+
+import java.io.File;
+
+public interface IFileChooser {
+
+ File getDirectory();
+
+ String getFileName();
+
+ String[] getFileExtensions();
+
+ /**
+ * Load or Save
+ * <ul>
+ * <li><code>true</code> loads the file from the file system into the application.</li>
+ * <li><code>false</code> saves the file from the application to the file system. Attention: This does not work in
+ * RAP/Web-UI</li>
+ * </ul>
+ */
+ boolean isTypeLoad();
+
+ /**
+ * Folder or File
+ */
+ boolean isFolderMode();
+
+ boolean isMultiSelect();
+
+ /**
+ * start file choosing and block until a result is available
+ *
+ * @return {@link #getFiles()}
+ */
+ File[] startChooser();
+
+ /**
+ * set result value and close chooser
+ */
+ void setFiles(File[] files);
+
+ File[] getFiles();
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/AbstractCheckableTable.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/AbstractCheckableTable.java
index 5c00028950..ba6c5035a3 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/AbstractCheckableTable.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/AbstractCheckableTable.java
@@ -1,205 +1,205 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.action.keystroke.AbstractKeyStroke;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IBooleanColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-
-/**
- * Legacy
- *
- * @deprecated use {@link ITable} with {@link ITable#setCheckable(boolean)}
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-public abstract class AbstractCheckableTable extends AbstractTable implements ICheckableTable {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractCheckableTable.class);
-
- private IBooleanColumn m_checkboxColumn;
-
- @Override
- protected boolean getConfiguredAutoResizeColumns() {
- return true;
- }
-
- @Override
- protected boolean getConfiguredMultiSelect() {
- return false;
- }
-
- @Override
- protected final boolean getConfiguredCheckable() {
- return false;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(200)
- @ConfigPropertyValue("true")
- protected boolean getConfiguredMultiCheckable() {
- return true;
- }
-
- @Override
- protected void initConfig() {
- super.initConfig();
- setMultiCheckable(getConfiguredMultiCheckable());
- // default behaviour take the first boolean column as checkboxColumn
- for (IColumn<?> c : getColumns()) {
- if (c instanceof IBooleanColumn) {
- setCheckboxColumn((IBooleanColumn) c);
- break;
- }
- LOG.warn("could not find a check box column (column implements IBooleanColumn) in the checkable table.");
- }
-
- }
-
- public void setCheckboxColumn(IBooleanColumn checkboxColumn) {
- m_checkboxColumn = checkboxColumn;
- }
-
- @Override
- public IBooleanColumn getCheckboxColumn() {
- return m_checkboxColumn;
- }
-
- public boolean isMultiCheckable() {
- return propertySupport.getPropertyBool(PROP_MULTI_CHECKABLE);
- }
-
- public void setMultiCheckable(boolean on) {
- propertySupport.setPropertyBool(PROP_MULTI_CHECKABLE, on);
- }
-
- @Override
- protected void execRowClick(ITableRow row) throws ProcessingException {
- if (isEnabled()) {
- if (row != null && getContextColumn() == getCheckboxColumn()) {
- Boolean oldValue = getCheckboxColumn().getValue(row);
- if (getCheckboxColumn() != null) {
- if (oldValue == null) {
- oldValue = false;
- }
- checkRow(row, !oldValue);
- }
- }
- }
- }
-
- @Order(10)
- public class SpaceKeyStroke extends AbstractKeyStroke {
- @Override
- protected String getConfiguredKeyStroke() {
- return "space";
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- if (AbstractCheckableTable.this.isEnabled()) {
- for (ITableRow row : getSelectedRows()) {
- Boolean b = getCheckboxColumn().getValue(row);
- if (b == null) {
- b = false;
- }
- b = !b;
- checkRow(row, b);
- }
- }
- }
- }
-
- @Override
- public void checkRow(ITableRow row, Boolean value) throws ProcessingException {
- if (!row.isEnabled()) {
- return;
- }
- if (!isMultiCheckable() && value && getCheckedRowCount() > 0) {
- uncheckAllRows();
- }
- getCheckboxColumn().setValue(row, value);
- }
-
- @Override
- public void checkRow(int row, Boolean value) throws ProcessingException {
- checkRow(getRow(row), value);
- }
-
- @Override
- public ITableRow[] getCheckedRows() {
- List<ITableRow> rows = new LinkedList<ITableRow>();
- boolean checked = false;
- for (int i = 0; i < getRowCount(); i++) {
- checked = (getCheckboxColumn().getValue(i) != null && getCheckboxColumn().getValue(i));
- if (checked) {
- rows.add(getRow(i));
- }
- }
-
- return rows.toArray(new ITableRow[]{});
- }
-
- @Override
- public ITableRow getCheckedRow() {
- if (getCheckedRowCount() > 0) {
- return getCheckedRows()[0];
- }
- else {
- return null;
- }
- }
-
- public int getCheckedRowCount() {
- return getCheckedRows().length;
- }
-
- @Override
- public void checkAllRows() {
- try {
- setTableChanging(true);
- for (int i = 0; i < getRowCount(); i++) {
- checkRow(i, Boolean.TRUE);
- }
- }
- catch (ProcessingException e) {
- LOG.warn(null, e);
- }
- finally {
- setTableChanging(false);
- }
- }
-
- @Override
- public void uncheckAllRows() {
- try {
- setTableChanging(true);
- for (int i = 0; i < getRowCount(); i++) {
- checkRow(i, Boolean.FALSE);
- }
- }
- catch (ProcessingException e) {
- LOG.warn(null, e);
- }
- finally {
- setTableChanging(false);
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.action.keystroke.AbstractKeyStroke;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IBooleanColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+
+/**
+ * Legacy
+ *
+ * @deprecated use {@link ITable} with {@link ITable#setCheckable(boolean)}
+ */
+@Deprecated
+@SuppressWarnings("deprecation")
+public abstract class AbstractCheckableTable extends AbstractTable implements ICheckableTable {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractCheckableTable.class);
+
+ private IBooleanColumn m_checkboxColumn;
+
+ @Override
+ protected boolean getConfiguredAutoResizeColumns() {
+ return true;
+ }
+
+ @Override
+ protected boolean getConfiguredMultiSelect() {
+ return false;
+ }
+
+ @Override
+ protected final boolean getConfiguredCheckable() {
+ return false;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(200)
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredMultiCheckable() {
+ return true;
+ }
+
+ @Override
+ protected void initConfig() {
+ super.initConfig();
+ setMultiCheckable(getConfiguredMultiCheckable());
+ // default behaviour take the first boolean column as checkboxColumn
+ for (IColumn<?> c : getColumns()) {
+ if (c instanceof IBooleanColumn) {
+ setCheckboxColumn((IBooleanColumn) c);
+ break;
+ }
+ LOG.warn("could not find a check box column (column implements IBooleanColumn) in the checkable table.");
+ }
+
+ }
+
+ public void setCheckboxColumn(IBooleanColumn checkboxColumn) {
+ m_checkboxColumn = checkboxColumn;
+ }
+
+ @Override
+ public IBooleanColumn getCheckboxColumn() {
+ return m_checkboxColumn;
+ }
+
+ public boolean isMultiCheckable() {
+ return propertySupport.getPropertyBool(PROP_MULTI_CHECKABLE);
+ }
+
+ public void setMultiCheckable(boolean on) {
+ propertySupport.setPropertyBool(PROP_MULTI_CHECKABLE, on);
+ }
+
+ @Override
+ protected void execRowClick(ITableRow row) throws ProcessingException {
+ if (isEnabled()) {
+ if (row != null && getContextColumn() == getCheckboxColumn()) {
+ Boolean oldValue = getCheckboxColumn().getValue(row);
+ if (getCheckboxColumn() != null) {
+ if (oldValue == null) {
+ oldValue = false;
+ }
+ checkRow(row, !oldValue);
+ }
+ }
+ }
+ }
+
+ @Order(10)
+ public class SpaceKeyStroke extends AbstractKeyStroke {
+ @Override
+ protected String getConfiguredKeyStroke() {
+ return "space";
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ if (AbstractCheckableTable.this.isEnabled()) {
+ for (ITableRow row : getSelectedRows()) {
+ Boolean b = getCheckboxColumn().getValue(row);
+ if (b == null) {
+ b = false;
+ }
+ b = !b;
+ checkRow(row, b);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void checkRow(ITableRow row, Boolean value) throws ProcessingException {
+ if (!row.isEnabled()) {
+ return;
+ }
+ if (!isMultiCheckable() && value && getCheckedRowCount() > 0) {
+ uncheckAllRows();
+ }
+ getCheckboxColumn().setValue(row, value);
+ }
+
+ @Override
+ public void checkRow(int row, Boolean value) throws ProcessingException {
+ checkRow(getRow(row), value);
+ }
+
+ @Override
+ public ITableRow[] getCheckedRows() {
+ List<ITableRow> rows = new LinkedList<ITableRow>();
+ boolean checked = false;
+ for (int i = 0; i < getRowCount(); i++) {
+ checked = (getCheckboxColumn().getValue(i) != null && getCheckboxColumn().getValue(i));
+ if (checked) {
+ rows.add(getRow(i));
+ }
+ }
+
+ return rows.toArray(new ITableRow[]{});
+ }
+
+ @Override
+ public ITableRow getCheckedRow() {
+ if (getCheckedRowCount() > 0) {
+ return getCheckedRows()[0];
+ }
+ else {
+ return null;
+ }
+ }
+
+ public int getCheckedRowCount() {
+ return getCheckedRows().length;
+ }
+
+ @Override
+ public void checkAllRows() {
+ try {
+ setTableChanging(true);
+ for (int i = 0; i < getRowCount(); i++) {
+ checkRow(i, Boolean.TRUE);
+ }
+ }
+ catch (ProcessingException e) {
+ LOG.warn(null, e);
+ }
+ finally {
+ setTableChanging(false);
+ }
+ }
+
+ @Override
+ public void uncheckAllRows() {
+ try {
+ setTableChanging(true);
+ for (int i = 0; i < getRowCount(); i++) {
+ checkRow(i, Boolean.FALSE);
+ }
+ }
+ catch (ProcessingException e) {
+ LOG.warn(null, e);
+ }
+ finally {
+ setTableChanging(false);
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/AbstractSortOrderColumn.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/AbstractSortOrderColumn.java
index 1c7c03ba41..b73cc947e1 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/AbstractSortOrderColumn.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/AbstractSortOrderColumn.java
@@ -1,21 +1,21 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table;
-
-import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-
-/**
- *
- */
-public class AbstractSortOrderColumn extends AbstractColumn<IColumn> implements ISortOrderColumn {
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table;
+
+import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+
+/**
+ *
+ */
+public class AbstractSortOrderColumn extends AbstractColumn<IColumn> implements ISortOrderColumn {
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/AbstractTable.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/AbstractTable.java
index efcb08a85b..ace921f25a 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/AbstractTable.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/AbstractTable.java
@@ -1,4337 +1,4337 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table;
-
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.EventListener;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.TreeMap;
-import java.util.TreeSet;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.scout.commons.BooleanUtility;
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.commons.CompositeObject;
-import org.eclipse.scout.commons.ConfigurationUtility;
-import org.eclipse.scout.commons.EventListenerList;
-import org.eclipse.scout.commons.HTMLUtility;
-import org.eclipse.scout.commons.OptimisticLock;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.annotations.ConfigOperation;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.beans.AbstractPropertyObserver;
-import org.eclipse.scout.commons.dnd.TextTransferObject;
-import org.eclipse.scout.commons.dnd.TransferObject;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.services.common.icon.IIconProviderService;
-import org.eclipse.scout.rt.client.ui.ClientUIPreferences;
-import org.eclipse.scout.rt.client.ui.IDNDSupport;
-import org.eclipse.scout.rt.client.ui.IEventHistory;
-import org.eclipse.scout.rt.client.ui.action.ActionFinder;
-import org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke;
-import org.eclipse.scout.rt.client.ui.action.keystroke.KeyStroke;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.action.menu.MenuSeparator;
-import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
-import org.eclipse.scout.rt.client.ui.basic.cell.ICell;
-import org.eclipse.scout.rt.client.ui.basic.table.columnfilter.ColumnFilterMenu;
-import org.eclipse.scout.rt.client.ui.basic.table.columnfilter.DefaultTableColumnFilterManager;
-import org.eclipse.scout.rt.client.ui.basic.table.columnfilter.ITableColumnFilter;
-import org.eclipse.scout.rt.client.ui.basic.table.columnfilter.ITableColumnFilterManager;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractBooleanColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractStringColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IBooleanColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.ISmartColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.customizer.AddCustomColumnMenu;
-import org.eclipse.scout.rt.client.ui.basic.table.customizer.ITableCustomizer;
-import org.eclipse.scout.rt.client.ui.basic.table.customizer.ModifyCustomColumnMenu;
-import org.eclipse.scout.rt.client.ui.basic.table.customizer.RemoveCustomColumnMenu;
-import org.eclipse.scout.rt.client.ui.basic.table.internal.InternalTableRow;
-import org.eclipse.scout.rt.client.ui.basic.table.menus.CopyWidthsOfColumnsMenu;
-import org.eclipse.scout.rt.client.ui.basic.table.menus.OrganizeColumnsMenu;
-import org.eclipse.scout.rt.client.ui.basic.table.menus.ResetColumnsMenu;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.booleanfield.IBooleanField;
-import org.eclipse.scout.rt.client.ui.form.fields.tablefield.AbstractTableField;
-import org.eclipse.scout.rt.client.ui.profiler.DesktopProfiler;
-import org.eclipse.scout.rt.shared.data.form.fields.tablefield.AbstractTableFieldData;
-import org.eclipse.scout.rt.shared.services.common.code.ICode;
-import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
-import org.eclipse.scout.rt.shared.services.lookup.BatchLookupCall;
-import org.eclipse.scout.rt.shared.services.lookup.BatchLookupResultCache;
-import org.eclipse.scout.rt.shared.services.lookup.IBatchLookupService;
-import org.eclipse.scout.rt.shared.services.lookup.LocalLookupCall;
-import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
-import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
-import org.eclipse.scout.service.SERVICES;
-
-/**
- * Columns are defined as inner classes<br>
- * for every inner column class there is a generated getXYColumn method directly
- * on the table
- */
-public abstract class AbstractTable extends AbstractPropertyObserver implements ITable {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractTable.class);
-
- private boolean m_initialized;
- private final OptimisticLock m_initLock;
- private ColumnSet m_columnSet;
- /**
- * synchronized list
- */
- private final List<ITableRow> m_rows;
- private final Object m_cachedRowsLock;
- private ITableRow[] m_cachedRows;
- private final HashMap<CompositeObject, ITableRow> m_deletedRows;
- private TreeSet<ITableRow/* ordered by rowIndex */> m_selectedRows = new TreeSet<ITableRow>(new RowIndexComparator());
- private IMenu[] m_menus;
- private ITableUIFacade m_uiFacade;
- private final ArrayList<ITableRowFilter> m_rowFilters;
- private String m_userPreferenceContext;
- // batch mutation
- private boolean m_autoDiscardOnDelete;
- private boolean m_sortEnabled;
- private boolean m_sortValid;
- private boolean m_initialMultiLineText;
- private int m_tableChanging;
- private ArrayList<TableEvent> m_tableEventBuffer = new ArrayList<TableEvent>();
- private final HashSet<P_CellLookup> m_cellLookupBuffer = new HashSet<P_CellLookup>();
- private HashSet<ITableRow> m_rowDecorationBuffer = new HashSet<ITableRow>();
- // key stroke buffer for select-as-you-type
- private final KeyStrokeBuffer m_keyStrokeBuffer;
- private final EventListenerList m_listenerList = new EventListenerList();
- //cell editing
- private P_CellEditorContext m_editContext;
- //checkable table
- private IBooleanColumn m_checkableColumn;
- //auto filter
- private final Object m_cachedFilteredRowsLock;
- private ITableRow[] m_cachedFilteredRows;
- private ITableColumnFilterManager m_columnFilterManager;
- private ITableCustomizer m_tableCustomizer;
- private IEventHistory<TableEvent> m_eventHistory;
- // only do one action at a time
- private boolean m_actionRunning;
-
- public AbstractTable() {
- this(true);
- }
-
- public AbstractTable(boolean callInitializer) {
- if (DesktopProfiler.getInstance().isEnabled()) {
- DesktopProfiler.getInstance().registerTable(this);
- }
- m_cachedRowsLock = new Object();
- m_cachedFilteredRowsLock = new Object();
- m_rows = Collections.synchronizedList(new ArrayList<ITableRow>(1));
- m_deletedRows = new HashMap<CompositeObject, ITableRow>();
- m_keyStrokeBuffer = new KeyStrokeBuffer(500L);
- m_rowFilters = new ArrayList<ITableRowFilter>(1);
- m_initLock = new OptimisticLock();
- m_actionRunning = false;
- //add single observer listener
- addTableListener(new P_TableListener());
- if (callInitializer) {
- callInitializer();
- }
- }
-
- protected void callInitializer() {
- initConfig();
- }
-
- /*
- * Configuration
- */
-
- /**
- * Configures the title of this table. The title of the table is rarely used because a table is usually surrounded by
- * an {@link AbstractTableField} having its own title / label.
- * <p>
- * Subclasses can override this method. Default is {@code null}.
- *
- * @return Title of this table.
- */
- @ConfigProperty(ConfigProperty.TEXT)
- @Order(10)
- @ConfigPropertyValue("null")
- protected String getConfiguredTitle() {
- return null;
- }
-
- /**
- * Configures the default icon for this table. The default icon is used for each row in the table.
- * <p>
- * Subclasses can override this method. Default is {@code null}.
- *
- * @return the ID (name) of the icon
- * @see IIconProviderService
- */
- @ConfigProperty(ConfigProperty.ICON_ID)
- @Order(20)
- @ConfigPropertyValue("null")
- protected String getConfiguredDefaultIconId() {
- return null;
- }
-
- /**
- * Configures whether only one row can be selected at once in this table.
- * <p>
- * Subclasses can override this method. Default is {@code true}.
- *
- * @return {@code true} if more then one row in this table can be selected at once, {@code false} otherwise.
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(30)
- @ConfigPropertyValue("true")
- protected boolean getConfiguredMultiSelect() {
- return true;
- }
-
- /**
- * Configures whether only one row can be checked in this table. This configuration is only useful if
- * {@link #getConfiguredCheckable()} is {@code true} .
- * <p>
- * Subclasses can override this method. Default is {@code true}.
- *
- * @return {@code true} if more then one row in this table can be checked, {@code false} otherwise.
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(32)
- @ConfigPropertyValue("true")
- protected boolean getConfiguredMultiCheck() {
- return true;
- }
-
- /**
- * Configures the default menu that is used on the ENTER (action key) or the double click on a table row.
- * <p>
- * Subclasses can override this method. Default is {@code null}.
- *
- * @return The default menu to use.
- */
- @ConfigProperty(ConfigProperty.MENU_CLASS)
- @Order(35)
- @ConfigPropertyValue("null")
- protected Class<? extends IMenu> getConfiguredDefaultMenu() {
- return null;
- }
-
- /**
- * Interception method used for customizing the default menu. Should be used by the framework only.
- *
- * @since 3.8.1
- */
- protected Class<? extends IMenu> getDefaultMenuInternal() {
- return getConfiguredDefaultMenu();
- }
-
- /**
- * Configures whether deleted rows are automatically erased or cached for later processing (service deletion).
- * <p>
- * Subclasses can override this method. Default is {@code false}.
- *
- * @return {@code true} if deleted rows are automatically erased, {@code false} if deleted nodes are cached for later
- * processing.
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(50)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredAutoDiscardOnDelete() {
- return false;
- }
-
- /**
- * Configures whether sort is enabled for this table. If sort is enabled, the table rows are sorted based on their
- * sort index (see {@link AbstractColumn#getConfiguredSortIndex()}) and the user might change the sorting at run time.
- * If sort is disabled, the table rows are not sorted and the user cannot change the sorting.
- * <p>
- * Subclasses can override this method. Default is {@code true}.
- *
- * @return {@code true} if sort is enabled, {@code false} otherwise.
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(60)
- @ConfigPropertyValue("true")
- protected boolean getConfiguredSortEnabled() {
- return true;
- }
-
- /**
- * Configures whether the header row is visible. The header row contains the titles of each column.
- * <p>
- * Subclasses can override this method. Default is {@code true}.
- *
- * @return {@code true} if the header row is visible, {@code false} otherwise.
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(70)
- @ConfigPropertyValue("true")
- protected boolean getConfiguredHeaderVisible() {
- return true;
- }
-
- /**
- * Configures whether the columns are auto resized. If true, all columns are resized so that the table never needs
- * horizontal scrolling. This is especially useful for tables inside a form.
- * <p>
- * Subclasses can override this method. Default is {@code true}.
- *
- * @return {@code true} if the columns are auto resized, {@code false} otherwise.
- * @see {@link AbstractColumn#getConfiguredWidth()}
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(80)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredAutoResizeColumns() {
- return false;
- }
-
- /**
- * Configures whether the table supports multiline text. If multiline text is supported and a string column has set
- * the {@link AbstractStringColumn#getConfiguredTextWrap()} property to true, the text is wrapped and uses two or more
- * lines.
- * <p>
- * Subclasses can override this method. Default is {@code false}. If the method is not overridden and at least one
- * string column has set the {@link AbstractStringColumn#getConfiguredTextWrap()} to true, the multiline property is
- * set automatically to true.
- *
- * @return {@code true} if the table supports multiline text, {@code false} otherwise.
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(90)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredMultilineText() {
- return false;
- }
-
- /**
- * Configures the row height hint. This is a hint for the UI if and only if it is not capable of having variable table
- * row height based on cell contents (such as rap/rwt).
- * <p>
- * This hint defines the table row height in pixels being used as the fixed row height for all table rows of this
- * table.
- * <p>
- * Subclasses can override this method. Default is {@code -1}.
- *
- * @return Table row height hint in pixels.
- */
- @ConfigProperty(ConfigProperty.INTEGER)
- @Order(92)
- @ConfigPropertyValue("-1")
- protected int getConfiguredRowHeightHint() {
- return -1;
- }
-
- /**
- * Configures whether the table is checkable.
- * <p>
- * Subclasses can override this method. Default is {@code false}.
- *
- * @return {@code true} if the table is checkable, {@code false} otherwise.
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(100)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredCheckable() {
- return false;
- }
-
- /**
- * Configures the checkable column. The checkable column represents the check state of the row, i.e. if it is checked
- * or not. If no checkable column is configured, only the row itself represents if the row was checked or not.
- * <p>
- * Subclasses can override this method. Default is {@code null}.
- *
- * @return A column class extending {@link AbstractBooleanColumn} that represents the row check state.
- */
- @ConfigProperty(ConfigProperty.TABLE_COLUMN)
- @Order(102)
- @ConfigPropertyValue("false")
- protected Class<? extends AbstractBooleanColumn> getConfiguredCheckableColumn() {
- return null;
- }
-
- /**
- * Configures the drop support of this table.
- * <p>
- * Subclasses can override this method. Default is {@code 0} (no drop support).
- *
- * @return {@code 0} for no support or one or more of {@link IDNDSupport#TYPE_FILE_TRANSFER},
- * {@link IDNDSupport#TYPE_IMAGE_TRANSFER}, {@link IDNDSupport#TYPE_JAVA_ELEMENT_TRANSFER} or
- * {@link IDNDSupport#TYPE_TEXT_TRANSFER} (e.g. {@code TYPE_TEXT_TRANSFER | TYPE_FILE_TRANSFER}).
- */
- @ConfigProperty(ConfigProperty.DRAG_AND_DROP_TYPE)
- @Order(190)
- @ConfigPropertyValue("0")
- protected int getConfiguredDropType() {
- return 0;
- }
-
- /**
- * Configures the drag support of this table.
- * <p>
- * Subclasses can override this method. Default is {@code 0} (no drag support).
- *
- * @return {@code 0} for no support or one or more of {@link IDNDSupport#TYPE_FILE_TRANSFER},
- * {@link IDNDSupport#TYPE_IMAGE_TRANSFER}, {@link IDNDSupport#TYPE_JAVA_ELEMENT_TRANSFER} or
- * {@link IDNDSupport#TYPE_TEXT_TRANSFER} (e.g. {@code TYPE_TEXT_TRANSFER | TYPE_FILE_TRANSFER}).
- */
- @ConfigProperty(ConfigProperty.DRAG_AND_DROP_TYPE)
- @Order(190)
- @ConfigPropertyValue("0")
- protected int getConfiguredDragType() {
- return 0;
- }
-
- /**
- * Configures whether the keyboard can be used for navigation in table. When activated, the user can click on a column
- * in the table. Now starting to type some letters, the row matching the typed letters in the column will be selected.
- * <p>
- * Subclasses can override this method. Default is {@code true}.
- *
- * @return {@code true} if the keyboard navigation is supported, {@code false} otherwise.
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(200)
- @ConfigPropertyValue("true")
- protected boolean getConfiguredKeyboardNavigation() {
- return true;
- }
-
- /**
- * Configures whether the table always scrolls to the selection. When activated and the selection in a table changes,
- * the table is scrolled to the selection so that the selected row is visible.
- * <p>
- * Subclasses can override this method. Default is {@code false}.
- *
- * @return {@code true} if the table scrolls to the selection, {@code false} otherwise.
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(230)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredScrollToSelection() {
- return false;
- }
-
- /**
- * Called after a drag operation was executed on one or several table rows.
- * <p>
- * Subclasses can override this method. The default does nothing.
- *
- * @param rows
- * Table rows that were dragged.
- * @return A transferable object representing the given rows.
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(10)
- protected TransferObject execDrag(ITableRow[] rows) throws ProcessingException {
- return null;
- }
-
- /**
- * Called after a drop operation was executed on the table.
- * <p>
- * Subclasses can override this method. The default does nothing.
- *
- * @param row
- * Table row on which the transferable object was dropped (row may be null for empty space drop).
- * @param t
- * Transferable object that was dropped on the row.
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(20)
- protected void execDrop(ITableRow row, TransferObject t) throws ProcessingException {
- }
-
- /**
- * Called by a <code>CTRL-C</code> event on the table to copy the given rows into the clipboard.
- * <p>
- * Subclasses can override this method. The default creates a {@link TextTransferObject} of the table content (HTML
- * table).
- *
- * @param rows
- * The selected table rows to copy.
- * @return A transferable object representing the given rows or null to not populate the clipboard.
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(30)
- protected TransferObject execCopy(ITableRow[] rows) throws ProcessingException {
- if (rows.length == 0) {
- return null;
- }
-
- StringBuilder plainText = new StringBuilder();
- StringBuilder htmlText = new StringBuilder("<html>");
- // Adding the following MS-office specific style information will cause Excel
- // to put all line-break-delimited entries of a <td> cell into a single Excel cell,
- // instead of one sub-cell for each <br />
- htmlText.append("<head><style type=\"text/css\"> br {mso-data-placement:same-cell;} </style></head>");
- htmlText.append("<body><table border=\"0\">");
-
- IColumn<?>[] columns = getColumnSet().getVisibleColumns();
- Pattern patternHtmlCheck = Pattern.compile(".*?<\\s*html.*?>.*", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL);
- Pattern patternBodyContent = Pattern.compile("<\\s*body.*?>(.*?)<\\s*/\\s*body\\s*>", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL);
-
- boolean firstRow = true;
- for (ITableRow row : rows) {
- // text/html
- htmlText.append("<tr>");
- // text/plain
- if (!firstRow) {
- plainText.append(System.getProperty("line.separator"));
- }
-
- boolean firstColumn = true;
- for (IColumn<?> column : columns) {
- String text;
- if (column instanceof IBooleanColumn) {
- boolean value = BooleanUtility.nvl(((IBooleanColumn) column).getValue(row), false);
- text = value ? "X" : "";
- }
- else {
- text = StringUtility.emptyIfNull(row.getCell(column).getText());
- }
-
- // text/plain
- if (!firstColumn) {
- plainText.append("\t");
- }
- plainText.append(StringUtility.emptyIfNull(StringUtility.unwrapText(text)));
-
- // text/html
- String html = null;
- if (patternHtmlCheck.matcher(text).matches()) {
- // ensure proper HTML and extract body content
- Matcher matcher = patternBodyContent.matcher(HTMLUtility.cleanupHtml(text, false, false, null));
- if (matcher.find()) {
- html = matcher.group(1);
- }
- }
- if (html == null) {
- html = StringUtility.htmlEncode(text);
- }
- htmlText.append("<td>");
- htmlText.append(html);
- htmlText.append("</td>");
- firstColumn = false;
- }
- htmlText.append("</tr>");
- firstRow = false;
- }
- htmlText.append("</table></body></html>");
-
- TextTransferObject transferObject = new TextTransferObject(plainText.toString(), htmlText.toString());
- return transferObject;
- }
-
- /**
- * Called after the table content changed, rows were added, removed or changed.
- * <p>
- * Subclasses can override this method. The default does nothing.
- *
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(40)
- protected void execContentChanged() throws ProcessingException {
- }
-
- /**
- * Called after {@link AbstractColumn#execDecorateCell(Cell,ITableRow)} on the column to decorate the cell.
- * <p>
- * Subclasses can override this method. The default does nothing.
- *
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(50)
- protected void execDecorateCell(Cell view, ITableRow row, IColumn<?> col) throws ProcessingException {
- }
-
- /**
- * Called during initialization of this table, after the columns were initialized.
- * <p>
- * Subclasses can override this method. The default does nothing.
- *
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(60)
- protected void execInitTable() throws ProcessingException {
- }
-
- /**
- * Called when this table is disposed, after the columns were disposed.
- * <p>
- * Subclasses can override this method. The default does nothing.
- *
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(70)
- protected void execDisposeTable() throws ProcessingException {
- }
-
- /**
- * Called when the user clicks on a row in this table.
- * <p>
- * Subclasses can override this method. The default fires a {@link TableEvent#TYPE_ROW_CLICK} event.
- *
- * @param Row
- * that was clicked (never null).
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(80)
- protected void execRowClick(ITableRow row) throws ProcessingException {
- TableEvent e = new TableEvent(this, TableEvent.TYPE_ROW_CLICK, new ITableRow[]{row});
- fireTableEventInternal(e);
- }
-
- /**
- * Called when the row has been activated.
- * <p>
- * Subclasses can override this method. The default opens the configured default menu or if no default menu is
- * configured, fires a {@link TableEvent#TYPE_ROW_ACTION} event.
- *
- * @param Row
- * that was activated (never null).
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(90)
- protected void execRowAction(ITableRow row) throws ProcessingException {
- Class<? extends IMenu> defaultMenuType = getDefaultMenuInternal();
- if (defaultMenuType != null) {
- try {
- runMenu(defaultMenuType);
- }
- catch (ProcessingException ex) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(ex);
- }
- catch (Throwable t) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Unexpected", t));
- }
- }
- else {
- TableEvent e = new TableEvent(this, TableEvent.TYPE_ROW_ACTION, new ITableRow[]{row});
- fireTableEventInternal(e);
- }
- }
-
- /**
- * Called when one or more rows are selected.
- * <p>
- * Subclasses can override this method. The default does nothing.
- *
- * @param rows
- * that were selected.
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(100)
- protected void execRowsSelected(ITableRow[] rows) throws ProcessingException {
- }
-
- /**
- * Called when the row is going to be decorated.
- * <p>
- * Subclasses can override this method. The default does nothing.
- *
- * @param row
- * that is going to be decorated.
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(110)
- protected void execDecorateRow(ITableRow row) throws ProcessingException {
- }
-
- /**
- * Called when a hyperlink is used within the table. The hyperlink's table row is the selected row and the column is
- * the context column ({@link #getContextColumn()}).
- * <p>
- * Subclasses can override this method. The default does nothing.
- *
- * @param url
- * Hyperlink to process.
- * @param path
- * Path of URL ({@link URL#getPath()}).
- * @param local
- * {@code true} if the url is not a valid external url but a local model url (http://local/...)
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(120)
- protected void execHyperlinkAction(URL url, String path, boolean local) throws ProcessingException {
- }
-
- private Class<? extends IMenu>[] getConfiguredMenus() {
- Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
- return ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, IMenu.class);
- }
-
- private Class<? extends IColumn>[] getConfiguredColumns() {
- Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
- return ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, IColumn.class);
- }
-
- private Class<? extends IKeyStroke>[] getConfiguredKeyStrokes() {
- Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
- return ConfigurationUtility.filterClasses(dca, IKeyStroke.class);
- }
-
- protected void initConfig() {
- m_eventHistory = createEventHistory();
- m_uiFacade = createUIFacade();
- setTitle(getConfiguredTitle());
- setAutoDiscardOnDelete(getConfiguredAutoDiscardOnDelete());
- setSortEnabled(getConfiguredSortEnabled());
- setDefaultIconId(getConfiguredDefaultIconId());
- setHeaderVisible(getConfiguredHeaderVisible());
- setAutoResizeColumns(getConfiguredAutoResizeColumns());
- setCheckable(getConfiguredCheckable());
- setMultiCheck(getConfiguredMultiCheck());
- setMultiSelect(getConfiguredMultiSelect());
- setInitialMultilineText(getConfiguredMultilineText());
- setMultilineText(getConfiguredMultilineText());
- setRowHeightHint(getConfiguredRowHeightHint());
- setKeyboardNavigation(getConfiguredKeyboardNavigation());
- setDragType(getConfiguredDragType());
- setDropType(getConfiguredDropType());
- setScrollToSelection(getConfiguredScrollToSelection());
- if (getTableCustomizer() == null) {
- setTableCustomizer(createTableCustomizer());
- }
- // columns
- createColumnsInternal();
- // menus
- ArrayList<IMenu> menuList = new ArrayList<IMenu>();
- Class<? extends IMenu>[] ma = getConfiguredMenus();
- for (int i = 0; i < ma.length; i++) {
- try {
- IMenu menu = ConfigurationUtility.newInnerInstance(this, ma[i]);
- menuList.add(menu);
- }
- catch (Throwable t) {
- LOG.error("create " + ma[i].getName(), t);
- }
- }
-
- try {
- injectMenusInternal(menuList);
- }
- catch (Exception e) {
- LOG.error("error occured while dynamically contributing menus.", e);
- }
- m_menus = menuList.toArray(new IMenu[0]);
- // key strokes
- ArrayList<IKeyStroke> ksList = new ArrayList<IKeyStroke>();
- Class<? extends IKeyStroke>[] ksArray = getConfiguredKeyStrokes();
- for (int i = 0; i < ksArray.length; i++) {
- try {
- IKeyStroke ks = ConfigurationUtility.newInnerInstance(this, ksArray[i]);
- ksList.add(ks);
- }
- catch (Throwable t) {
- LOG.error("create " + ksArray[i].getName(), t);
- }
- }
- //add ENTER key stroke when default menu is used or execRowAction has an override
- Class<? extends IMenu> defaultMenuType = getDefaultMenuInternal();
- if (defaultMenuType != null || ConfigurationUtility.isMethodOverwrite(AbstractTable.class, "execRowAction", new Class[]{ITableRow.class}, this.getClass())) {
- ksList.add(new KeyStroke("ENTER") {
- @Override
- protected void execAction() throws ProcessingException {
- fireRowAction(getSelectedRow());
- }
- });
- }
- setKeyStrokes(ksList.toArray(new IKeyStroke[ksList.size()]));
- // add Convenience observer for drag & drop callbacks and event history
- addTableListener(new TableAdapter() {
- @Override
- public void tableChanged(TableEvent e) {
- //event history
- IEventHistory<TableEvent> h = getEventHistory();
- if (h != null) {
- h.notifyEvent(e);
- }
- //dnd
- switch (e.getType()) {
- case TableEvent.TYPE_ROWS_DRAG_REQUEST: {
- if (e.getDragObject() == null) {
- try {
- e.setDragObject(execDrag(e.getRows()));
- }
- catch (ProcessingException ex) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(ex);
- }
- }
- break;
- }
- case TableEvent.TYPE_ROW_DROP_ACTION: {
- if (e.getDropObject() != null) {
- try {
- execDrop(e.getFirstRow(), e.getDropObject());
- }
- catch (ProcessingException ex) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(ex);
- }
- }
- break;
- }
- case TableEvent.TYPE_ROWS_COPY_REQUEST: {
- if (e.getCopyObject() == null) {
- try {
- e.setCopyObject(execCopy(e.getRows()));
- }
- catch (ProcessingException ex) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(ex);
- }
- }
- break;
- }
- case TableEvent.TYPE_ALL_ROWS_DELETED:
- case TableEvent.TYPE_ROWS_DELETED:
- case TableEvent.TYPE_ROWS_INSERTED:
- case TableEvent.TYPE_ROWS_UPDATED: {
- try {
- execContentChanged();
- }
- catch (ProcessingException ex) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(ex);
- }
- break;
- }
- }
- }
- });
- }
-
- private void initColumnsInternal() {
- for (IColumn<?> c : getColumnSet().getColumns()) {
- try {
- c.initColumn();
- }
- catch (Throwable t) {
- LOG.error("column " + c, t);
- }
- }
- getColumnSet().initialize();
- }
-
- private void disposeColumnsInternal() {
- for (IColumn<?> c : getColumnSet().getColumns()) {
- try {
- c.disposeColumn();
- }
- catch (Throwable t) {
- LOG.error("column " + c, t);
- }
- }
- }
-
- private void createColumnsInternal() {
- Class<? extends IColumn>[] ca = getConfiguredColumns();
- ArrayList<IColumn<?>> colList = new ArrayList<IColumn<?>>();
- for (int i = 0; i < ca.length; i++) {
- try {
- IColumn<?> column = ConfigurationUtility.newInnerInstance(this, ca[i]);
- colList.add(column);
- }
- catch (Exception e) {
- LOG.warn(null, e);
- }
- }
- try {
- injectColumnsInternal(colList);
- }
- catch (Exception e) {
- LOG.error("error occured while dynamically contribute columns.", e);
- }
- ArrayList<IColumn> completeList = new ArrayList<IColumn>();
- completeList.addAll(colList);
- m_columnSet = new ColumnSet(this, completeList);
- if (getConfiguredCheckableColumn() != null) {
- AbstractBooleanColumn checkableColumn = getColumnSet().getColumnByClass(getConfiguredCheckableColumn());
- setCheckableColumn(checkableColumn);
- }
- }
-
- /**
- * Override this internal method only in order to make use of dynamic fields<br>
- * Used to manage column list and add/remove columns
- *
- * @param columnList
- * live and mutable list of configured columns, not yet initialized
- */
- protected void injectColumnsInternal(List<IColumn<?>> columnList) {
- ITableCustomizer c = getTableCustomizer();
- if (c != null) {
- c.injectCustomColumns(columnList);
- }
- }
-
- /**
- * Override this internal method only in order to make use of dynamic menus<br>
- * Used to manage menu list and add/remove menus
- *
- * @param menuList
- * live and mutable list of configured menus
- */
- protected void injectMenusInternal(List<IMenu> menuList) {
- }
-
- protected ITableUIFacade createUIFacade() {
- return new P_TableUIFacade();
- }
-
- /*
- * Runtime
- */
-
- @Override
- public String getUserPreferenceContext() {
- return m_userPreferenceContext;
- }
-
- @Override
- public void setUserPreferenceContext(String context) {
- m_userPreferenceContext = context;
- if (isTableInitialized()) {
- //re-initialize
- try {
- initTable();
- }
- catch (ProcessingException e) {
- LOG.error("Failed re-initializing table " + getClass().getName(), e);
- }
- }
- }
-
- /**
- * This is the init of the runtime model after the table and columns are built
- * and configured
- */
- @Override
- public final void initTable() throws ProcessingException {
- try {
- if (m_initLock.acquire()) {
- try {
- setTableChanging(true);
- //
- initTableInternal();
- execInitTable();
- }
- finally {
- setTableChanging(false);
- }
- }
- }
- finally {
- m_initialized = true;
- m_initLock.release();
- }
- }
-
- protected void initTableInternal() throws ProcessingException {
- initColumnsInternal();
- if (getColumnFilterManager() == null) {
- setColumnFilterManager(createColumnFilterManager());
- }
- }
-
- @Override
- public final void disposeTable() {
- try {
- disposeTableInternal();
- execDisposeTable();
- }
- catch (Throwable t) {
- LOG.warn(getClass().getName(), t);
- }
- }
-
- protected void disposeTableInternal() throws ProcessingException {
- disposeColumnsInternal();
- }
-
- @Override
- public void doHyperlinkAction(ITableRow row, IColumn<?> col, URL url) throws ProcessingException {
- if (!m_actionRunning) {
- try {
- m_actionRunning = true;
- if (row != null) {
- selectRow(row);
- }
- if (col != null) {
- setContextColumn(col);
- }
- execHyperlinkAction(url, url.getPath(), url != null && url.getHost().equals(LOCAL_URL_HOST));
- }
- finally {
- m_actionRunning = false;
- }
- }
- }
-
- @Override
- public ITableRowFilter[] getRowFilters() {
- return m_rowFilters.toArray(new ITableRowFilter[m_rowFilters.size()]);
- }
-
- @Override
- public void addRowFilter(ITableRowFilter filter) {
- if (filter != null) {
- //avoid duplicate add
- boolean exists = false;
- for (ITableRowFilter existingFilter : m_rowFilters) {
- if (existingFilter == filter) {
- exists = true;
- break;
- }
- }
- if (!exists) {
- m_rowFilters.add(filter);
- }
- applyRowFilters();
- }
- }
-
- @Override
- public void removeRowFilter(ITableRowFilter filter) {
- if (filter != null) {
- m_rowFilters.remove(filter);
- applyRowFilters();
- }
- }
-
- @Override
- public void applyRowFilters() {
- applyRowFiltersInternal();
- fireRowFilterChanged();
- }
-
- private void applyRowFiltersInternal() {
- for (ITableRow row : m_rows) {
- applyRowFiltersInternal((InternalTableRow) row);
- }
- }
-
- private void applyRowFiltersInternal(InternalTableRow row) {
- row.setFilterAcceptedInternal(true);
- if (m_rowFilters.size() > 0) {
- for (ITableRowFilter filter : m_rowFilters) {
- if (!filter.accept(row)) {
- row.setFilterAcceptedInternal(false);
- /*
- * ticket 95770
- */
- if (isSelectedRow(row)) {
- deselectRow(row);
- }
- break;
- }
- }
- }
- }
-
- @Override
- public String getTitle() {
- return propertySupport.getPropertyString(PROP_TITLE);
- }
-
- @Override
- public void setTitle(String s) {
- propertySupport.setPropertyString(PROP_TITLE, s);
- }
-
- @Override
- public boolean isAutoResizeColumns() {
- return propertySupport.getPropertyBool(PROP_AUTO_RESIZE_COLUMNS);
- }
-
- @Override
- public void setAutoResizeColumns(boolean b) {
- propertySupport.setPropertyBool(PROP_AUTO_RESIZE_COLUMNS, b);
- }
-
- @Override
- public ColumnSet getColumnSet() {
- return m_columnSet;
- }
-
- @Override
- public int getColumnCount() {
- return getColumnSet().getColumnCount();
- }
-
- @Override
- public IColumn<?>[] getColumns() {
- return getColumnSet().getColumns();
- }
-
- @Override
- public String[] getColumnNames() {
- String[] a = new String[getColumnCount()];
- for (int i = 0; i < a.length; i++) {
- a[i] = getColumnSet().getColumn(i).getHeaderCell().getText();
- }
- return a;
- }
-
- @Override
- public int getVisibleColumnCount() {
- return getColumnSet().getVisibleColumnCount();
- }
-
- @Override
- public IHeaderCell getVisibleHeaderCell(int visibleColumnIndex) {
- return getHeaderCell(getColumnSet().getVisibleColumn(visibleColumnIndex));
- }
-
- @Override
- public IHeaderCell getHeaderCell(int columnIndex) {
- return getHeaderCell(getColumnSet().getColumn(columnIndex));
- }
-
- @Override
- public IHeaderCell getHeaderCell(IColumn<?> col) {
- return col.getHeaderCell();
- }
-
- @Override
- public ICell getVisibleCell(int rowIndex, int visibleColumnIndex) {
- return getVisibleCell(getRow(rowIndex), visibleColumnIndex);
- }
-
- @Override
- public ICell getVisibleCell(ITableRow row, int visibleColumnIndex) {
- return getCell(row, getColumnSet().getVisibleColumn(visibleColumnIndex));
- }
-
- @Override
- public ICell getCell(int rowIndex, int columnIndex) {
- return getCell(getRow(rowIndex), getColumnSet().getColumn(columnIndex));
- }
-
- @Override
- public ICell getSummaryCell(int rowIndex) {
- return getSummaryCell(getRow(rowIndex));
- }
-
- @Override
- public ICell getSummaryCell(ITableRow row) {
- IColumn<?>[] a = getColumnSet().getSummaryColumns();
- if (a.length == 0) {
- IColumn<?> col = getColumnSet().getFirstDefinedVisibileColumn();
- if (col != null) {
- a = new IColumn<?>[]{col};
- }
- }
- if (a.length == 0) {
- return new Cell();
- }
- else if (a.length == 1) {
- Cell cell = new Cell(getCell(row, a[0]));
- if (cell.getIconId() == null) {
- // use icon of row
- cell.setIconId(row.getIconId());
- }
- return cell;
- }
- else {
- Cell cell = new Cell(getCell(row, a[0]));
- if (cell.getIconId() == null) {
- // use icon of row
- cell.setIconId(row.getIconId());
- }
- StringBuilder b = new StringBuilder();
- for (IColumn<?> c : a) {
- if (b.length() > 0) {
- b.append(" ");
- }
- b.append(getCell(row, c).getText());
- }
- cell.setText(b.toString());
- return cell;
- }
- }
-
- @Override
- public ICell getCell(ITableRow row, IColumn<?> col) {
- row = resolveRow(row);
- if (row == null || col == null) {
- return null;
- }
- return row.getCell(col.getColumnIndex());
- }
-
- /**
- * Note that this is not a java bean method and thus not thread-safe
- */
- @Override
- public boolean isCellEditable(int rowIndex, int columnIndex) {
- return isCellEditable(getRow(rowIndex), getColumnSet().getColumn(columnIndex));
- }
-
- /**
- * Note that this is not a java bean method and thus not thread-safe
- */
- @Override
- public boolean isCellEditable(ITableRow row, int visibleColumnIndex) {
- return isCellEditable(row, getColumnSet().getVisibleColumn(visibleColumnIndex));
- }
-
- /**
- * Note that this is not a java bean method and thus not thread-safe
- */
- @Override
- public boolean isCellEditable(ITableRow row, IColumn<?> column) {
- return row != null && column != null && column.isVisible() && column.isCellEditable(row);
- }
-
- @Override
- public Object getProperty(String name) {
- return propertySupport.getProperty(name);
- }
-
- @Override
- public void setProperty(String name, Object value) {
- propertySupport.setProperty(name, value);
- }
-
- @Override
- public boolean hasProperty(String name) {
- return propertySupport.hasProperty(name);
- }
-
- @Override
- public boolean isCheckable() {
- return propertySupport.getPropertyBool(PROP_CHECKABLE);
- }
-
- @Override
- public void setCheckable(boolean b) {
- propertySupport.setPropertyBool(PROP_CHECKABLE, b);
- }
-
- @Override
- public void setDragType(int dragType) {
- propertySupport.setPropertyInt(PROP_DRAG_TYPE, dragType);
- }
-
- @Override
- public int getDragType() {
- return propertySupport.getPropertyInt(PROP_DRAG_TYPE);
- }
-
- @Override
- public void setDropType(int dropType) {
- propertySupport.setPropertyInt(PROP_DROP_TYPE, dropType);
- }
-
- @Override
- public int getDropType() {
- return propertySupport.getPropertyInt(PROP_DROP_TYPE);
- }
-
- @Override
- public boolean isMultilineText() {
- return propertySupport.getPropertyBool(PROP_MULTILINE_TEXT);
- }
-
- @Override
- public void setMultilineText(boolean on) {
- propertySupport.setPropertyBool(PROP_MULTILINE_TEXT, on);
- }
-
- @Override
- public int getRowHeightHint() {
- return propertySupport.getPropertyInt(PROP_ROW_HEIGHT_HINT);
- }
-
- @Override
- public void setRowHeightHint(int h) {
- propertySupport.setPropertyInt(PROP_ROW_HEIGHT_HINT, h);
- }
-
- @Override
- public boolean isInitialMultilineText() {
- return m_initialMultiLineText;
- }
-
- @Override
- public void setInitialMultilineText(boolean on) {
- m_initialMultiLineText = on;
- }
-
- @Override
- public boolean hasKeyboardNavigation() {
- return propertySupport.getPropertyBool(PROP_KEYBOARD_NAVIGATION);
- }
-
- @Override
- public void setKeyboardNavigation(boolean on) {
- propertySupport.setPropertyBool(PROP_KEYBOARD_NAVIGATION, on);
- }
-
- @Override
- public boolean isMultiSelect() {
- return propertySupport.getPropertyBool(PROP_MULTI_SELECT);
- }
-
- @Override
- public void setMultiSelect(boolean b) {
- propertySupport.setPropertyBool(PROP_MULTI_SELECT, b);
- }
-
- @Override
- public boolean isMultiCheck() {
- return propertySupport.getPropertyBool(PROP_MULTI_CHECK);
- }
-
- @Override
- public void setMultiCheck(boolean b) {
- propertySupport.setPropertyBool(PROP_MULTI_CHECK, b);
- }
-
- @Override
- public IBooleanColumn getCheckableColumn() {
- return m_checkableColumn;
- }
-
- @Override
- public void setCheckableColumn(IBooleanColumn checkableColumn) {
- m_checkableColumn = checkableColumn;
- }
-
- @Override
- public boolean isAutoDiscardOnDelete() {
- return m_autoDiscardOnDelete;
- }
-
- @Override
- public void setAutoDiscardOnDelete(boolean on) {
- m_autoDiscardOnDelete = on;
- }
-
- @Override
- public boolean isTableInitialized() {
- return m_initialized;
- }
-
- @Override
- public boolean isTableChanging() {
- return m_tableChanging > 0;
- }
-
- @Override
- public void setTableChanging(boolean b) {
- // use a stack counter because setTableChanging might be called in nested
- // loops
- if (b) {
- m_tableChanging++;
- if (m_tableChanging == 1) {
- // 0 --> 1
- propertySupport.setPropertiesChanging(true);
- }
- }
- else {
- // all calls to further methods are wrapped into a try-catch block so that the change counters are adjusted correctly
- if (m_tableChanging > 0) {
- Throwable saveEx = null;
- if (m_tableChanging == 1) {
- try {
- //will be going to zero, but process decorations here, so events are added to the event buffer
- processDecorationBuffer();
- if (!m_sortValid) {
- sort();
- }
- }
- catch (Throwable t) {
- saveEx = t;
- }
- }
- m_tableChanging--;
- if (m_tableChanging == 0) {
- try {
- processEventBuffer();
- }
- catch (Throwable t) {
- if (saveEx == null) {
- saveEx = t;
- }
- }
- try {
- propertySupport.setPropertiesChanging(false);
- }
- catch (Throwable t) {
- if (saveEx == null) {
- saveEx = t;
- }
- }
- }
- if (saveEx == null) {
- return;
- }
- else if (saveEx instanceof RuntimeException) {
- throw (RuntimeException) saveEx;
- }
- else if (saveEx instanceof Error) {
- throw (Error) saveEx;
- }
- }
- }
- }
-
- @Override
- public IKeyStroke[] getKeyStrokes() {
- IKeyStroke[] keyStrokes = (IKeyStroke[]) propertySupport.getProperty(PROP_KEY_STROKES);
- if (keyStrokes == null) {
- keyStrokes = new IKeyStroke[0];
- }
- return keyStrokes;
- }
-
- @Override
- public void setKeyStrokes(IKeyStroke[] keyStrokes) {
- propertySupport.setProperty(PROP_KEY_STROKES, keyStrokes);
- }
-
- @Override
- public void requestFocus() {
- fireRequestFocus();
- }
-
- @Override
- public void requestFocusInCell(IColumn<?> column, ITableRow row) {
- if (isCellEditable(row, column)) {
- fireRequestFocusInCell(column, row);
- }
- }
-
- @Override
- public void extractTableData(AbstractTableFieldData target) throws ProcessingException {
- for (int i = 0, ni = getRowCount(); i < ni; i++) {
- ITableRow row = getRow(i);
- int newRowIndex = target.addRow();
- for (int j = 0, nj = row.getCellCount(); j < nj; j++) {
- target.setValueAt(newRowIndex, j, row.getCellValue(j));
- }
- target.setRowState(newRowIndex, row.getStatus());
- }
- ITableRow[] deletedRows = getDeletedRows();
- for (int i = 0, ni = deletedRows.length; i < ni; i++) {
- ITableRow row = deletedRows[i];
- int newRowIndex = target.addRow();
- for (int j = 0, nj = row.getCellCount(); j < nj; j++) {
- target.setValueAt(newRowIndex, j, row.getCellValue(j));
- }
- target.setRowState(newRowIndex, AbstractTableFieldData.STATUS_DELETED);
- }
- target.setValueSet(true);
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public void updateTable(AbstractTableFieldData source) throws ProcessingException {
- if (source.isValueSet()) {
- clearDeletedRows();
- int deleteCount = 0;
- ArrayList<ITableRow> newRows = new ArrayList<ITableRow>();
- for (int i = 0, ni = source.getRowCount(); i < ni; i++) {
- int importState = source.getRowState(i);
- if (importState != AbstractTableFieldData.STATUS_DELETED) {
- ITableRow newTableRow = new TableRow(getColumnSet());
- for (int j = 0, nj = source.getColumnCount(); j < nj; j++) {
- if (j < getColumnCount()) {
- getColumnSet().getColumn(j).setValue(newTableRow, source.getValueAt(i, j));
- }
- else {
- newTableRow.setCellValue(j, source.getValueAt(i, j));
- }
- }
- newTableRow.setStatus(importState);
- newRows.add(newTableRow);
- }
- else {
- deleteCount++;
- }
- }
- replaceRows(newRows.toArray(new ITableRow[newRows.size()]));
- if (deleteCount > 0) {
- try {
- setTableChanging(true);
- //
- for (int i = 0, ni = source.getRowCount(); i < ni; i++) {
- int importState = source.getRowState(i);
- if (importState == AbstractTableFieldData.STATUS_DELETED) {
- ITableRow newTableRow = new TableRow(getColumnSet());
- for (int j = 0, nj = source.getColumnCount(); j < nj; j++) {
- if (j < getColumnCount()) {
- getColumnSet().getColumn(j).setValue(newTableRow, source.getValueAt(i, j));
- }
- else {
- newTableRow.setCellValue(j, source.getValueAt(i, j));
- }
- }
- newTableRow.setStatus(ITableRow.STATUS_NON_CHANGED);
- ITableRow addedRow = addRow(newTableRow);
- deleteRow(addedRow);
- }
- }
- }
- finally {
- setTableChanging(false);
- }
- }
- }
- }
-
- @Override
- public IMenu[] getMenus() {
- return m_menus;
- }
-
- @Override
- public <T extends IMenu> T getMenu(Class<T> menuType) throws ProcessingException {
- return new ActionFinder().findAction(getMenus(), menuType);
- }
-
- @Override
- public boolean runMenu(Class<? extends IMenu> menuType) throws ProcessingException {
- for (IMenu m : getMenus()) {
- if (m.getClass() == menuType) {
- if ((!m.isInheritAccessibility()) || isEnabled()) {
- m.prepareAction();
- if (m.isVisible() && m.isEnabled()) {
- m.doAction();
- return true;
- }
- else {
- return false;
- }
- }
- }
- }
- return false;
- }
-
- /**
- * factory to manage table column filters
- * <p>
- * default creates a {@link DefaultTableColumnFilterManager}
- */
- protected ITableColumnFilterManager createColumnFilterManager() {
- return new DefaultTableColumnFilterManager(this);
- }
-
- /**
- * factory to manage custom columns
- * <p>
- * default creates null
- */
- protected ITableCustomizer createTableCustomizer() {
- return null;
- }
-
- /*
- * Row handling methods. Operate on a Row instance.
- */
-
- public ITableRow createRow() throws ProcessingException {
- return new P_TableRowBuilder().createRow();
- }
-
- public ITableRow createRow(Object rowValues) throws ProcessingException {
- return new P_TableRowBuilder().createRow(rowValues);
- }
-
- public ITableRow[] createRowsByArray(Object dataArray) throws ProcessingException {
- return new P_TableRowBuilder().createRowsByArray(dataArray);
- }
-
- public ITableRow[] createRowsByArray(Object dataArray, int rowStatus) throws ProcessingException {
- return new P_TableRowBuilder().createRowsByArray(dataArray, rowStatus);
- }
-
- /**
- * Performance note:<br>
- * Since the matrix may contain large amount of data, the Object[][] can be passed as new
- * AtomicReference<Object>(Object[][])
- * so that the further processing can set the content of the holder to null while processing.
- */
- public ITableRow[] createRowsByMatrix(Object dataMatrixOrReference) throws ProcessingException {
- return new P_TableRowBuilder().createRowsByMatrix(dataMatrixOrReference);
- }
-
- /**
- * Performance note:<br>
- * Since the matrix may contain large amount of data, the Object[][] can be passed as new
- * AtomicReference<Object>(Object[][])
- * so that the further processing can set the content of the holder to null while processing.
- */
- public ITableRow[] createRowsByMatrix(Object dataMatrixOrReference, int rowStatus) throws ProcessingException {
- return new P_TableRowBuilder().createRowsByMatrix(dataMatrixOrReference, rowStatus);
- }
-
- public ITableRow[] createRowsByCodes(ICode[] codes) throws ProcessingException {
- return new P_TableRowBuilder().createRowsByCodes(codes);
- }
-
- /**
- * Performance note:<br>
- * Since the matrix may contain large amount of data, the Object[][] can be passed as new
- * AtomicReference<Object>(Object[][])
- * so that the further processing can set the content of the holder to null while processing.
- */
- @Override
- public void replaceRowsByMatrix(Object dataMatrixOrReference) throws ProcessingException {
- replaceRows(createRowsByMatrix(dataMatrixOrReference));
- }
-
- @Override
- public void replaceRowsByArray(Object dataArray) throws ProcessingException {
- replaceRows(createRowsByArray(dataArray));
- }
-
- @Override
- public void replaceRows(ITableRow[] newRows) throws ProcessingException {
- /*
- * There are two ways to replace: (1) Completely replace all rows by
- * discarding all rows and adding new rows when - autoDiscardOnDelete=true
- * (2) Replace rows by applying insert/update/delete on existing rows by
- * primary key match when - autoDiscardOnDelete=false
- */
- if (isAutoDiscardOnDelete()) {
- replaceRowsCase1(newRows);
- }
- else {
- replaceRowsCase2(newRows);
- }
- }
-
- private void replaceRowsCase1(ITableRow[] newRows) throws ProcessingException {
- try {
- setTableChanging(true);
- //
- ArrayList<CompositeObject> selectedKeys = new ArrayList<CompositeObject>();
- for (ITableRow r : getSelectedRows()) {
- selectedKeys.add(new CompositeObject(getRowKeys(r)));
- }
- discardAllRows();
- addRows(newRows, false);
- // restore selection
- ArrayList<ITableRow> selectedRows = new ArrayList<ITableRow>();
- if (selectedKeys.size() > 0) {
- for (ITableRow r : m_rows) {
- if (selectedKeys.remove(new CompositeObject(getRowKeys(r)))) {
- selectedRows.add(r);
- if (selectedKeys.size() == 0) {
- break;
- }
- }
- }
- }
- selectRows(selectedRows.toArray(new ITableRow[selectedRows.size()]), false);
- }
- finally {
- setTableChanging(false);
- }
- }
-
- private void replaceRowsCase2(ITableRow[] newRows) throws ProcessingException {
- try {
- setTableChanging(true);
- //
- int[] oldToNew = new int[getRowCount()];
- int[] newToOld = new int[newRows.length];
- Arrays.fill(oldToNew, -1);
- Arrays.fill(newToOld, -1);
- HashMap<CompositeObject, Integer> newRowIndexMap = new HashMap<CompositeObject, Integer>();
- for (int i = newRows.length - 1; i >= 0; i--) {
- newRowIndexMap.put(new CompositeObject(getRowKeys(newRows[i])), new Integer(i));
- }
- int mappedCount = 0;
- for (int i = 0, ni = getRowCount(); i < ni; i++) {
- ITableRow existingRow = m_rows.get(i);
- Integer newIndex = newRowIndexMap.remove(new CompositeObject(getRowKeys(existingRow)));
- if (newIndex != null) {
- oldToNew[i] = newIndex.intValue();
- newToOld[newIndex.intValue()] = i;
- mappedCount++;
- }
- }
- ITableRow[] updatedRows = new ITableRow[mappedCount];
- int index = 0;
- for (int i = 0; i < oldToNew.length; i++) {
- if (oldToNew[i] >= 0) {
- ITableRow oldRow = getRow(i);
- ITableRow newRow = newRows[oldToNew[i]];
- try {
- oldRow.setRowChanging(true);
- //
- oldRow.setEnabled(newRow.isEnabled());
- oldRow.setStatus(newRow.getStatus());
- for (int columnIndex = 0; columnIndex < getColumnCount(); columnIndex++) {
- if (columnIndex < newRow.getCellCount()) {
- oldRow.getCellForUpdate(columnIndex).updateFrom(newRow.getCell(columnIndex));
- }
- else {
- // reset the visible values
- oldRow.getCellForUpdate(columnIndex).setText(null);
- oldRow.getCellForUpdate(columnIndex).setValue(null);
- }
- }
- }
- finally {
- oldRow.setRowPropertiesChanged(false);
- oldRow.setRowChanging(false);
- }
- //
- updatedRows[index] = oldRow;
- index++;
- }
- }
- ITableRow[] deletedRows = new ITableRow[getRowCount() - mappedCount];
- index = 0;
- for (int i = 0; i < oldToNew.length; i++) {
- if (oldToNew[i] < 0) {
- deletedRows[index] = m_rows.get(i);
- index++;
- }
- }
- ITableRow[] insertedRows = new ITableRow[newRows.length - mappedCount];
- int[] insertedRowIndexes = new int[newRows.length - mappedCount];
- index = 0;
- for (int i = 0; i < newToOld.length; i++) {
- if (newToOld[i] < 0) {
- insertedRows[index] = newRows[i];
- insertedRowIndexes[index] = i;
- index++;
- }
- }
- //
- updateRows(updatedRows);
- deleteRows(deletedRows);
- addRows(insertedRows, false, insertedRowIndexes);
- }
- finally {
- setTableChanging(false);
- }
- }
-
- @Override
- public void updateRow(ITableRow row) {
- if (row != null) {
- updateRows(new ITableRow[]{row});
- }
- }
-
- @Override
- public void updateAllRows() {
- ITableRow[] rows = getRows();
- updateRows(rows);
- }
-
- @Override
- public void setRowState(ITableRow row, int rowState) throws ProcessingException {
- setRowState(new ITableRow[]{row}, rowState);
- }
-
- @Override
- public void setAllRowState(int rowState) throws ProcessingException {
- setRowState(getRows(), rowState);
- }
-
- @Override
- public void setRowState(ITableRow[] rows, int rowState) throws ProcessingException {
- try {
- setTableChanging(true);
- //
- for (int i = 0; i < rows.length; i++) {
- rows[i].setStatus(rowState);
- }
- }
- finally {
- setTableChanging(false);
- }
- }
-
- @Override
- public void updateRows(ITableRow[] rows) {
- try {
- setTableChanging(true);
- //
- ArrayList<ITableRow> resolvedRowList = new ArrayList<ITableRow>(rows.length);
- for (int i = 0; i < rows.length; i++) {
- ITableRow resolvedRow = resolveRow(rows[i]);
- if (resolvedRow != null) {
- resolvedRowList.add(resolvedRow);
- updateRowImpl(resolvedRow);
- }
- }
- if (resolvedRowList.size() > 0) {
- fireRowsUpdated(resolvedRowList.toArray(new ITableRow[0]));
- }
- if (getColumnSet().getSortColumnCount() > 0) {
- // restore order of rows according to sort criteria
- if (isTableChanging()) {
- m_sortValid = false;
- }
- else {
- sort();
- }
- }
- }
- finally {
- setTableChanging(false);
- }
- }
-
- private void updateRowImpl(ITableRow row) {
- if (row != null) {
- /*
- * do NOT use ITableRow#setRowChanging, this might cause a stack overflow
- */
- enqueueDecorationTasks(row);
- }
- }
-
- @Override
- public int getRowCount() {
- return m_rows.size();
- }
-
- @Override
- public int getDeletedRowCount() {
- return m_deletedRows.size();
- }
-
- @Override
- public int getSelectedRowCount() {
- return m_selectedRows.size();
- }
-
- @Override
- public ITableRow getSelectedRow() {
- if (m_selectedRows.size() > 0) {
- return m_selectedRows.first();
- }
- else {
- return null;
- }
- }
-
- @Override
- public ITableRow[] getSelectedRows() {
- return m_selectedRows.toArray(new ITableRow[m_selectedRows.size()]);
- }
-
- @Override
- public boolean isSelectedRow(ITableRow row) {
- row = resolveRow(row);
- if (row == null) {
- return false;
- }
- else {
- return m_selectedRows.contains(row);
- }
- }
-
- @Override
- public void selectRow(int rowIndex) {
- selectRow(getRow(rowIndex));
- }
-
- @Override
- public void selectRow(ITableRow row) {
- selectRow(row, false);
- }
-
- @Override
- public void selectRow(ITableRow row, boolean append) {
- if (row != null) {
- selectRows(new ITableRow[]{row}, append);
- }
- else {
- selectRows(new ITableRow[0], append);
- }
- }
-
- @Override
- public void selectRows(ITableRow[] rows) {
- selectRows(rows, false);
- }
-
- @Override
- public void selectRows(ITableRow[] rows, boolean append) {
- rows = resolveRows(rows);
- TreeSet<ITableRow> newSelection = new TreeSet<ITableRow>(new RowIndexComparator());
- if (append) {
- newSelection.addAll(m_selectedRows);
- newSelection.addAll(Arrays.asList(rows));
- }
- else {
- newSelection.addAll(Arrays.asList(rows));
- }
- // check selection count with multiselect
- if (newSelection.size() > 1 && !isMultiSelect()) {
- ITableRow first = newSelection.first();
- newSelection.clear();
- newSelection.add(first);
- }
- if (!m_selectedRows.equals(newSelection)) {
- m_selectedRows = newSelection;
- fireRowsSelected(m_selectedRows.toArray(new ITableRow[0]));
- }
- }
-
- @Override
- public void selectFirstRow() {
- selectRow(getRow(0));
- }
-
- @Override
- public void selectNextRow() {
- ITableRow row = getSelectedRow();
- if (row != null && row.getRowIndex() + 1 < getRowCount()) {
- selectRow(getRow(row.getRowIndex() + 1));
- }
- else if (row == null && getRowCount() > 0) {
- selectRow(0);
- }
- }
-
- @Override
- public void selectPreviousRow() {
- ITableRow row = getSelectedRow();
- if (row != null && row.getRowIndex() - 1 >= 0) {
- selectRow(getRow(row.getRowIndex() - 1));
- }
- else if (row == null && getRowCount() > 0) {
- selectRow(getRowCount() - 1);
- }
- }
-
- @Override
- public void selectLastRow() {
- selectRow(getRow(getRowCount() - 1));
- }
-
- @Override
- public void deselectRow(ITableRow row) {
- if (row != null) {
- deselectRows(new ITableRow[]{row});
- }
- else {
- deselectRows(new ITableRow[0]);
- }
- }
-
- @Override
- public void deselectRows(ITableRow[] rows) {
- rows = resolveRows(rows);
- if (rows != null && rows.length > 0) {
- TreeSet<ITableRow> newSelection = new TreeSet<ITableRow>(new RowIndexComparator());
- newSelection.addAll(m_selectedRows);
- if (newSelection.removeAll(Arrays.asList(rows))) {
- m_selectedRows = newSelection;
- fireRowsSelected(m_selectedRows.toArray(new ITableRow[0]));
- }
- }
- }
-
- @Override
- public void selectAllRows() {
- selectRows(getRows(), false);
- }
-
- @Override
- public void deselectAllRows() {
- selectRow(null, false);
- }
-
- @Override
- public void selectAllEnabledRows() {
- ArrayList<ITableRow> newList = new ArrayList<ITableRow>();
- for (int i = 0, ni = getRowCount(); i < ni; i++) {
- ITableRow row = getRow(i);
- if (row.isEnabled()) {
- newList.add(row);
- }
- else if (isSelectedRow(row)) {
- newList.add(row);
- }
- }
- selectRows(newList.toArray(new ITableRow[0]), false);
- }
-
- @Override
- public void deselectAllEnabledRows() {
- ITableRow[] selectedRows = getSelectedRows();
- ArrayList<ITableRow> newList = new ArrayList<ITableRow>();
- for (int i = 0; i < selectedRows.length; i++) {
- if (selectedRows[i].isEnabled()) {
- newList.add(selectedRows[i]);
- }
- }
- deselectRows(newList.toArray(new ITableRow[0]));
- }
-
- @Override
- public ITableRow[] getCheckedRows() {
- final ArrayList<ITableRow> list = new ArrayList<ITableRow>();
- for (ITableRow row : getRows()) {
- if (row.isChecked()) {
- list.add(row);
- }
- }
- return list.toArray(new ITableRow[list.size()]);
- }
-
- @Override
- public void checkRow(int row, boolean value) throws ProcessingException {
- checkRow(getRow(row), value);
- }
-
- @Override
- public void checkRow(ITableRow row, boolean value) throws ProcessingException {
- if (!row.isEnabled()) {
- return;
- }
- if (!isMultiCheck() && value && getCheckedRows().length > 0) {
- uncheckAllRows();
- }
- row.setChecked(value);
- if (getCheckableColumn() != null) {
- getCheckableColumn().setValue(row, value);
- }
- }
-
- @Override
- public void checkRows(ITableRow[] rows, boolean value) throws ProcessingException {
- rows = resolveRows(rows);
- // check checked count with multicheck
- if (rows.length > 1 && !isMultiCheck()) {
- ITableRow first = rows[0];
- first.setChecked(value);
- }
- else {
- for (ITableRow row : rows) {
- checkRow(row, value);
- }
- }
- }
-
- @Override
- public void checkAllRows() throws ProcessingException {
- try {
- setTableChanging(true);
- for (int i = 0; i < getRowCount(); i++) {
- checkRow(i, true);
- }
- }
- finally {
- setTableChanging(false);
- }
- }
-
- @Override
- public void uncheckAllRows() throws ProcessingException {
- try {
- setTableChanging(true);
- for (int i = 0; i < getRowCount(); i++) {
- checkRow(i, false);
- }
- }
- finally {
- setTableChanging(false);
- }
- }
-
- @Override
- public String getDefaultIconId() {
- String iconId = propertySupport.getPropertyString(PROP_DEFAULT_ICON);
- if (iconId != null && iconId.length() == 0) {
- iconId = null;
- }
- return iconId;
- }
-
- @Override
- public void setDefaultIconId(String iconId) {
- propertySupport.setPropertyString(PROP_DEFAULT_ICON, iconId);
- }
-
- @Override
- public boolean isEnabled() {
- return propertySupport.getPropertyBool(PROP_ENABLED);
- }
-
- @Override
- public final void setEnabled(boolean b) {
- boolean changed = propertySupport.setPropertyBool(PROP_ENABLED, b);
- if (changed) {
- //update the state of all current cell beans that are out there
- try {
- setTableChanging(true);
- //
- ITableRow[] rows = getRows();
- for (ITableRow row : rows) {
- enqueueDecorationTasks(row);
- }
- }
- finally {
- setTableChanging(false);
- }
- }
- }
-
- @Override
- public boolean isScrollToSelection() {
- return propertySupport.getPropertyBool(PROP_SCROLL_TO_SELECTION);
- }
-
- @Override
- public void setScrollToSelection(boolean b) {
- propertySupport.setPropertyBool(PROP_SCROLL_TO_SELECTION, b);
- }
-
- @Override
- public void scrollToSelection() {
- fireTableEventInternal(new TableEvent(this, TableEvent.TYPE_SCROLL_TO_SELECTION));
- }
-
- /**
- * @return a copy of a row<br>
- * when the row is changed it has to be applied to the table using
- * modifyRow(row);
- */
- @Override
- public ITableRow getRow(int rowIndex) {
- ITableRow row = null;
- ITableRow[] rows = getRows();
- if (rowIndex >= 0 && rowIndex < rows.length) {
- row = rows[rowIndex];
- }
- return row;
- }
-
- @Override
- public ITableRow[] getRows() {
- //lazy create list in getter, make sure to be thread-safe since getters may be called from "wild" threads
- synchronized (m_cachedRowsLock) {
- if (m_cachedRows == null) {
- //this code must be thread-safe
- m_cachedRows = m_rows.toArray(new ITableRow[m_rows.size()]);
- }
- return m_cachedRows;
- }
- }
-
- @Override
- public ITableRow[] getFilteredRows() {
- ITableRow[] rows = getRows();
- if (m_rowFilters.size() > 0) {
- //lazy create list in getter, make sure to be thread-safe since getters may be called from "wild" threads
- synchronized (m_cachedFilteredRowsLock) {
- if (m_cachedFilteredRows == null) {
- //this code must be thread-safe
- if (m_rowFilters.size() > 0) {
- ArrayList<ITableRow> list = new ArrayList<ITableRow>(getRowCount());
- for (ITableRow row : rows) {
- if (row != null && row.isFilterAccepted()) {
- list.add(row);
- }
- }
- m_cachedFilteredRows = list.toArray(new ITableRow[list.size()]);
- }
- else {
- m_cachedFilteredRows = new ITableRow[0];
- }
- }
- return m_cachedFilteredRows;
- }
- }
- else {
- return rows;
- }
- }
-
- @Override
- public int getFilteredRowCount() {
- if (m_rowFilters.size() > 0) {
- return getFilteredRows().length;
- }
- else {
- return getRowCount();
- }
- }
-
- @Override
- public ITableRow getFilteredRow(int index) {
- if (m_rowFilters.size() > 0) {
- ITableRow row = null;
- ITableRow[] filteredRows = getFilteredRows();
- if (index >= 0 && index < filteredRows.length) {
- row = filteredRows[index];
- }
- return row;
- }
- else {
- return getRow(index);
- }
- }
-
- @Override
- public int getFilteredRowIndex(ITableRow row) {
- ITableRow[] filteredRows = getFilteredRows();
- for (int i = 0; i < filteredRows.length; i++) {
- if (filteredRows[i].equals(row)) {
- return i;
- }
- }
- return -1;
- }
-
- @Override
- public Object[][] getTableData() {
- Object[][] data = new Object[getRowCount()][getColumnCount()];
- for (int r = 0; r < getRowCount(); r++) {
- for (int c = 0; c < getColumnCount(); c++) {
- data[r][c] = getRow(r).getCellValue(c);
- }
- }
- return data;
- }
-
- @Override
- public Object[][] exportTableRowsAsCSV(ITableRow[] rows, IColumn<?>[] columns, boolean includeLineForColumnNames, boolean includeLineForColumnTypes, boolean includeLineForColumnFormats) {
- return TableUtility.exportRowsAsCSV(rows, columns, includeLineForColumnNames, includeLineForColumnTypes, includeLineForColumnFormats);
- }
-
- @Override
- public ITableRow[] getRows(int[] rowIndexes) {
- if (rowIndexes == null) {
- return new ITableRow[0];
- }
- ITableRow[] rows = new ITableRow[rowIndexes.length];
- int missingCount = 0;
- for (int i = 0; i < rowIndexes.length; i++) {
- rows[i] = getRow(rowIndexes[i]);
- if (rows[i] == null) {
- missingCount++;
- }
- }
- if (missingCount > 0) {
- ITableRow[] newRows = new ITableRow[rowIndexes.length - missingCount];
- int index = 0;
- for (int i = 0; i < rows.length; i++) {
- if (rows[i] != null) {
- newRows[index] = rows[i];
- index++;
- }
- }
- rows = newRows;
- }
- return rows;
- }
-
- /**
- * @return a copy of a deleted row<br>
- * when the row is changed it has to be applied to the table using
- * modifyRow(row);
- */
- @Override
- public ITableRow[] getDeletedRows() {
- return m_deletedRows.values().toArray(new ITableRow[0]);
- }
-
- @Override
- public int getInsertedRowCount() {
- int count = 0;
- ITableRow[] rows = getRows();
- for (int i = 0, ni = rows.length; i < ni; i++) {
- if (rows[i].getStatus() == ITableRow.STATUS_INSERTED) {
- count++;
- }
- }
- return count;
- }
-
- @Override
- public ITableRow[] getInsertedRows() {
- ArrayList<ITableRow> rowList = new ArrayList<ITableRow>();
- ITableRow[] rows = getRows();
- for (int i = 0, ni = rows.length; i < ni; i++) {
- ITableRow row = rows[i];
- if (row.getStatus() == ITableRow.STATUS_INSERTED) {
- rowList.add(row);
- }
- }
- return rowList.toArray(new ITableRow[rowList.size()]);
- }
-
- @Override
- public int getUpdatedRowCount() {
- int count = 0;
- ITableRow[] rows = getRows();
- for (int i = 0, ni = rows.length; i < ni; i++) {
- if (rows[i].getStatus() == ITableRow.STATUS_UPDATED) {
- count++;
- }
- }
- return count;
- }
-
- @Override
- public ITableRow[] getUpdatedRows() {
- ArrayList<ITableRow> rowList = new ArrayList<ITableRow>();
- ITableRow[] rows = getRows();
- for (int i = 0, ni = rows.length; i < ni; i++) {
- ITableRow row = rows[i];
- if (row.getStatus() == ITableRow.STATUS_UPDATED) {
- rowList.add(row);
- }
- }
- return rowList.toArray(new ITableRow[rowList.size()]);
- }
-
- /**
- * Convenience to add row by data only
- */
- @Override
- public ITableRow addRowByArray(Object dataArray) throws ProcessingException {
- if (dataArray == null) {
- return null;
- }
- ITableRow[] a = addRowsByMatrix(new Object[]{dataArray});
- if (a.length > 0) {
- return a[0];
- }
- else {
- return null;
- }
- }
-
- @Override
- public ITableRow[] addRowsByMatrix(Object dataMatrix) throws ProcessingException {
- return addRowsByMatrix(dataMatrix, ITableRow.STATUS_INSERTED);
- }
-
- @Override
- public ITableRow[] addRowsByMatrix(Object dataMatrix, int rowStatus) throws ProcessingException {
- return addRows(createRowsByMatrix(dataMatrix, rowStatus));
- }
-
- @Override
- public ITableRow[] addRowsByArray(Object dataArray) throws ProcessingException {
- return addRowsByArray(dataArray, ITableRow.STATUS_INSERTED);
- }
-
- @Override
- public ITableRow[] addRowsByArray(Object dataArray, int rowStatus) throws ProcessingException {
- return addRows(createRowsByArray(dataArray, rowStatus));
- }
-
- @Override
- public ITableRow addRow(ITableRow newRow) throws ProcessingException {
- return addRow(newRow, false);
- }
-
- @Override
- public ITableRow addRow(ITableRow newRow, boolean markAsInserted) throws ProcessingException {
- ITableRow[] addedRows = addRows(new ITableRow[]{newRow}, markAsInserted);
- if (addedRows.length > 0) {
- return addedRows[0];
- }
- else {
- return null;
- }
- }
-
- @Override
- public ITableRow[] addRows(ITableRow[] newRows) throws ProcessingException {
- return addRows(newRows, false);
- }
-
- @Override
- public ITableRow[] addRows(ITableRow[] newRows, boolean markAsInserted) throws ProcessingException {
- return addRows(newRows, markAsInserted, null);
- }
-
- @Override
- public ITableRow[] addRows(ITableRow[] newRows, boolean markAsInserted, int[] insertIndexes) throws ProcessingException {
- if (newRows == null || newRows.length == 0) {
- return new ITableRow[0];
- }
- try {
- setTableChanging(true);
- //
- int oldRowCount = m_rows.size();
- //m_rows.ensureCapacity(m_rows.size() + newRows.length);
- ITableRow[] newIRows = new ITableRow[newRows.length];
- for (int i = 0; i < newRows.length; i++) {
- newIRows[i] = addRowImpl(newRows[i], markAsInserted);
- }
- fireRowsInserted(newIRows);
- if (getColumnSet().getSortColumnCount() > 0) {
- // restore order of rows according to sort criteria
- if (isTableChanging()) {
- m_sortValid = false;
- }
- else {
- sort();
- }
- }
- else if (insertIndexes != null) {
- ITableRow[] sortArray = new ITableRow[m_rows.size()];
- // add new rows that have a given sortIndex
- for (int i = 0; i < insertIndexes.length; i++) {
- sortArray[insertIndexes[i]] = newIRows[i];
- }
- int sortArrayIndex = 0;
- // add existing rows
- for (int i = 0; i < oldRowCount; i++) {
- // find next empty slot
- while (sortArray[sortArrayIndex] != null) {
- sortArrayIndex++;
- }
- sortArray[sortArrayIndex] = m_rows.get(i);
- }
- // add new rows that have no given sortIndex
- for (int i = insertIndexes.length; i < newIRows.length; i++) {
- // find next empty slot
- while (sortArray[sortArrayIndex] != null) {
- sortArrayIndex++;
- }
- sortArray[sortArrayIndex] = newIRows[i];
- }
- sortInternal(sortArray);
- }
- return newIRows;
- }
- finally {
- setTableChanging(false);
- }
- }
-
- private ITableRow addRowImpl(ITableRow newRow, boolean markAsInserted) throws ProcessingException {
- if (markAsInserted) {
- newRow.setStatus(ITableRow.STATUS_INSERTED);
- }
- InternalTableRow newIRow = new InternalTableRow(this, newRow);
- synchronized (m_cachedRowsLock) {
- m_cachedRows = null;
- }
- int newIndex = m_rows.size();
- newIRow.setRowIndex(newIndex);
- newIRow.setTableInternal(this);
- m_rows.add(newIRow);
- enqueueDecorationTasks(newIRow);
- return newIRow;
- }
-
- @Override
- public void moveRow(int sourceIndex, int targetIndex) {
- moveRowImpl(sourceIndex, targetIndex);
- }
-
- /**
- * move the movingRow to the location just before the target row
- */
- @Override
- public void moveRowBefore(ITableRow movingRow, ITableRow targetRow) {
- movingRow = resolveRow(movingRow);
- targetRow = resolveRow(targetRow);
- if (movingRow != null && targetRow != null) {
- moveRowImpl(movingRow.getRowIndex(), targetRow.getRowIndex());
- }
- }
-
- /**
- * move the movingRow to the location just after the target row
- */
- @Override
- public void moveRowAfter(ITableRow movingRow, ITableRow targetRow) {
- movingRow = resolveRow(movingRow);
- targetRow = resolveRow(targetRow);
- if (movingRow != null && targetRow != null) {
- moveRowImpl(movingRow.getRowIndex(), targetRow.getRowIndex() + 1);
- }
- }
-
- private void moveRowImpl(int sourceIndex, int targetIndex) {
- if (sourceIndex < 0) {
- sourceIndex = 0;
- }
- if (sourceIndex >= getRowCount()) {
- sourceIndex = getRowCount() - 1;
- }
- if (targetIndex < 0) {
- targetIndex = 0;
- }
- if (targetIndex >= getRowCount()) {
- targetIndex = getRowCount() - 1;
- }
- if (targetIndex != sourceIndex) {
- synchronized (m_cachedRowsLock) {
- m_cachedRows = null;
- }
- ITableRow row = m_rows.remove(sourceIndex);
- m_rows.add(targetIndex, row);
- // update row indexes
- int min = Math.min(sourceIndex, targetIndex);
- int max = Math.max(sourceIndex, targetIndex);
- ITableRow[] changedRows = new ITableRow[max - min + 1];
- for (int i = min; i <= max; i++) {
- changedRows[i - min] = getRow(i);
- ((InternalTableRow) changedRows[i - min]).setRowIndex(i);
- }
- fireRowOrderChanged();
- // rebuild selection
- selectRows(getSelectedRows(), false);
- }
- }
-
- @Override
- public void deleteRow(int rowIndex) {
- deleteRows(new int[]{rowIndex});
- }
-
- @Override
- public void deleteRows(int[] rowIndexes) {
- ArrayList<ITableRow> rowList = new ArrayList<ITableRow>();
- for (int i = 0; i < rowIndexes.length; i++) {
- ITableRow row = getRow(rowIndexes[i]);
- if (row != null) {
- rowList.add(row);
- }
- }
- deleteRows(rowList.toArray(new ITableRow[0]));
- }
-
- @Override
- public void deleteRow(ITableRow row) {
- if (row != null) {
- deleteRows(new ITableRow[]{row});
- }
- }
-
- @Override
- public void deleteAllRows() {
- deleteRows(getRows());
- }
-
- @Override
- public void deleteRows(ITableRow[] rows) {
- ITableRow[] existingRows = getRows();
- //peformance quick-check
- if (rows != existingRows) {
- rows = resolveRows(rows);
- }
- if (rows != null && rows.length > 0) {
- try {
- setTableChanging(true);
- //
- int rowCountBefore = getRowCount();
- int min = getRowCount();
- int max = 0;
- for (int i = 0; i < rows.length; i++) {
- ITableRow row = rows[i];
- min = Math.min(min, row.getRowIndex());
- max = Math.max(max, row.getRowIndex());
- }
- ITableRow[] deletedRows = rows;
- // remove from selection
- deselectRows(deletedRows);
- //delete impl
- //peformance quick-check
- if (rows == existingRows) {
- //remove all of them
- m_rows.clear();
- synchronized (m_cachedRowsLock) {
- m_cachedRows = null;
- }
- for (int i = deletedRows.length - 1; i >= 0; i--) {
- ITableRow candidateRow = deletedRows[i];
- if (candidateRow != null) {
- deleteRowImpl(candidateRow);
- }
- }
- }
- else {
- for (int i = deletedRows.length - 1; i >= 0; i--) {
- ITableRow candidateRow = deletedRows[i];
- if (candidateRow != null) {
- // delete regardless if index is right
- boolean removed = m_rows.remove(candidateRow);
- if (removed) {
- synchronized (m_cachedRowsLock) {
- m_cachedRows = null;
- }
- deleteRowImpl(candidateRow);
- }
- }
- }
- }
- // get affected rows
- HashSet<ITableRow> selectionRows = new HashSet<ITableRow>(Arrays.asList(getSelectedRows()));
- int minAffectedIndex = Math.max(min - 1, 0);
- ITableRow[] affectedRows = new ITableRow[getRowCount() - minAffectedIndex];
- for (int i = minAffectedIndex; i < getRowCount(); i++) {
- affectedRows[i - minAffectedIndex] = getRow(i);
- ((InternalTableRow) affectedRows[i - minAffectedIndex]).setRowIndex(i);
- selectionRows.remove(getRow(i));
- }
- if (rowCountBefore == deletedRows.length) {
- fireAllRowsDeleted(deletedRows);
- }
- else {
- fireRowsDeleted(deletedRows);
- }
- selectRows(selectionRows.toArray(new ITableRow[selectionRows.size()]), false);
- }
- finally {
- setTableChanging(false);
- }
- }
- }
-
- private void deleteRowImpl(ITableRow row) {
- if (!(row instanceof InternalTableRow)) {
- return;
- }
- InternalTableRow internalRow = (InternalTableRow) row;
- if (isAutoDiscardOnDelete()) {
- internalRow.setTableInternal(null);
- // don't manage deleted rows any further
- }
- else if (internalRow.getStatus() == ITableRow.STATUS_INSERTED) {
- internalRow.setTableInternal(null);
- // it was new and now it is gone, no further action required
- }
- else {
- internalRow.setStatus(ITableRow.STATUS_DELETED);
- m_deletedRows.put(new CompositeObject(getRowKeys(internalRow)), internalRow);
- }
- }
-
- @Override
- public void discardRow(int rowIndex) {
- discardRows(new int[]{rowIndex});
- }
-
- @Override
- public void discardRows(int[] rowIndexes) {
- ArrayList<ITableRow> rowList = new ArrayList<ITableRow>();
- for (int i = 0; i < rowIndexes.length; i++) {
- ITableRow row = getRow(rowIndexes[i]);
- if (row != null) {
- rowList.add(row);
- }
- }
- discardRows(rowList.toArray(new ITableRow[0]));
- }
-
- @Override
- public void discardRow(ITableRow row) {
- if (row != null) {
- discardRows(new ITableRow[]{row});
- }
- }
-
- @Override
- public void discardAllRows() {
- discardRows(getRows());
- }
-
- /**
- * discard is the same as delete with the exception that discarded rows are
- * not collected in the deletedRows list
- */
- @Override
- public void discardRows(ITableRow[] rows) {
- try {
- setTableChanging(true);
- //
- for (int i = 0; i < rows.length; i++) {
- ((InternalTableRow) rows[i]).setStatus(ITableRow.STATUS_INSERTED);
- }
- deleteRows(rows);
- }
- finally {
- setTableChanging(false);
- }
- }
-
- @Override
- public void discardAllDeletedRows() {
- for (Iterator<ITableRow> it = m_deletedRows.values().iterator(); it.hasNext();) {
- ((InternalTableRow) it.next()).setTableInternal(null);
- }
- m_deletedRows.clear();
- }
-
- @Override
- public void discardDeletedRow(ITableRow deletedRow) {
- if (deletedRow != null) {
- discardDeletedRows(new ITableRow[]{deletedRow});
- }
- }
-
- @Override
- public void discardDeletedRows(ITableRow[] deletedRows) {
- if (deletedRows != null) {
- for (ITableRow row : deletedRows) {
- m_deletedRows.remove(new CompositeObject(getRowKeys(row)));
- ((InternalTableRow) row).setTableInternal(null);
- }
- }
- }
-
- @Override
- public void setContextColumn(IColumn<?> col) {
- propertySupport.setProperty(PROP_CONTEXT_COLUMN, col);
- }
-
- @Override
- public IColumn<?> getContextColumn() {
- return (IColumn<?>) propertySupport.getProperty(PROP_CONTEXT_COLUMN);
- }
-
- @SuppressWarnings("deprecation")
- @Deprecated
- @Override
- public void clearDeletedRows() {
- discardAllDeletedRows();
- }
-
- @Override
- public Object[] getRowKeys(int rowIndex) {
- ITableRow row = getRow(rowIndex);
- return getRowKeys(row);
- }
-
- @Override
- public Object[] getRowKeys(ITableRow row) {
- // do not resolve
- Object[] keys = new Object[0];
- if (row != null) {
- keys = row.getKeyValues();
- }
- return keys;
- }
-
- @Override
- public ITableRow findRowByKey(Object[] keys) {
- IColumn<?>[] keyColumns = getColumnSet().getKeyColumns();
- if (keyColumns.length == 0) {
- keyColumns = getColumnSet().getColumns();
- }
- for (ITableRow row : m_rows) {
- boolean match = true;
- if (keys != null && keys.length > 0) {
- for (int i = 0; i < keyColumns.length && i < keys.length; i++) {
- if (!CompareUtility.equals(keyColumns[i].getValue(row), keys[i])) {
- match = false;
- break;
- }
- }
- }
- if (match) {
- return row;
- }
- }
- return null;
- }
-
- @Override
- public ITableColumnFilterManager getColumnFilterManager() {
- return m_columnFilterManager;
- }
-
- @Override
- public void setColumnFilterManager(ITableColumnFilterManager m) {
- m_columnFilterManager = m;
- }
-
- @Override
- public ITableCustomizer getTableCustomizer() {
- return m_tableCustomizer;
- }
-
- @Override
- public void setTableCustomizer(ITableCustomizer c) {
- m_tableCustomizer = c;
- }
-
- @Override
- public Object getContainer() {
- return propertySupport.getProperty(PROP_CONTAINER);
- }
-
- /**
- * do not use this internal method unless you are implementing a container that holds and controls an {@link ITable}
- */
- public void setContainerInternal(Object container) {
- propertySupport.setProperty(PROP_CONTAINER, container);
- }
-
- @Override
- public boolean isSortEnabled() {
- return m_sortEnabled;
- }
-
- @Override
- public void setSortEnabled(boolean b) {
- m_sortEnabled = b;
- }
-
- @Override
- public void sort() {
- try {
- if (isSortEnabled()) {
- // Consider any active sort-column, not only explicit ones.
- // This is to support reverse (implicit) sorting of columns, meaning that multiple column sort is done
- // without CTRL-key held. In contrast to explicit multiple column sort, the first clicked column
- // is the least significant sort column.
- IColumn<?>[] sortCols = getColumnSet().getSortColumns();
- if (sortCols.length > 0) {
- // first make sure decorations and lookups are up-to-date
- processDecorationBuffer();
- ITableRow[] a = getRows();
- Arrays.sort(a, new TableRowComparator(sortCols));
- sortInternal(a);
- }
- }
- }
- finally {
- m_sortValid = true;
- }
- }
-
- @Override
- public void sort(ITableRow[] rowsInNewOrder) {
- ITableRow[] resolvedRows = resolveRows(rowsInNewOrder);
- if (resolvedRows.length == rowsInNewOrder.length) {
- sortInternal(resolvedRows);
- }
- else {
- // check which rows could not be mapped
- ArrayList<ITableRow> list = new ArrayList<ITableRow>();
- list.addAll(m_rows);
- list.removeAll(Arrays.asList(resolvedRows));
- ArrayList<ITableRow> sortedList = new ArrayList<ITableRow>();
- sortedList.addAll(Arrays.asList(resolvedRows));
- sortedList.addAll(list);
- sortInternal(sortedList.toArray(new ITableRow[sortedList.size()]));
- }
- }
-
- private void sortInternal(ITableRow[] resolvedRows) {
- for (int i = 0; i < resolvedRows.length; i++) {
- ((InternalTableRow) resolvedRows[i]).setRowIndex(i);
- }
- synchronized (m_cachedRowsLock) {
- m_cachedRows = null;
- m_rows.clear();
- m_rows.addAll(Arrays.asList(resolvedRows));
- }
- //sort selection without firing an event
- if (m_selectedRows != null && m_selectedRows.size() > 0) {
- TreeSet<ITableRow> newSelection = new TreeSet<ITableRow>(new RowIndexComparator());
- newSelection.addAll(m_selectedRows);
- m_selectedRows = newSelection;
- }
- fireRowOrderChanged();
- }
-
- @Override
- public void resetColumnConfiguration() {
- discardAllRows();
- //
- try {
- setTableChanging(true);
- // save displayable state
- HashMap<String, Boolean> displayableState = new HashMap<String, Boolean>();
- for (IColumn<?> col : getColumns()) {
- displayableState.put(col.getColumnId(), col.isDisplayable());
- }
- // reset columns
- disposeColumnsInternal();
- createColumnsInternal();
- initColumnsInternal();
- // re-apply displayable
- for (IColumn<?> col : getColumns()) {
- if (displayableState.get(col.getColumnId()) != null) {
- col.setDisplayable(displayableState.get(col.getColumnId()));
- }
- }
- // re-apply existing filters to new columns
- ITableColumnFilterManager filterManager = getColumnFilterManager();
- if (filterManager != null && filterManager.getFilters() != null) {
- for (IColumn<?> col : getColumns()) {
- for (ITableColumnFilter<?> filter : filterManager.getFilters()) {
- if (filter.getColumn().getClass().equals(col.getClass())) {
- filter.setColumn(col);
- }
- }
- filterManager.refresh();
- }
- }
- fireTableEventInternal(new TableEvent(this, TableEvent.TYPE_COLUMN_STRUCTURE_CHANGED));
- }
- finally {
- setTableChanging(false);
- }
- }
-
- @Override
- public void resetColumnVisibilities() {
- resetColumns(true, false, false, false);
- }
-
- @Override
- public void resetColumnOrder() {
- resetColumns(false, true, false, false);
- }
-
- @Override
- public void resetColumnSortOrder() {
- resetColumns(false, false, true, false);
- }
-
- @Override
- public void resetColumnWidths() {
- resetColumns(false, false, false, true);
- }
-
- @Override
- public void resetDisplayableColumns() {
- resetColumns(true, true, true, true);
- }
-
- @Override
- public void resetColumns(boolean visibility, boolean order, boolean sorting, boolean widths) {
- try {
- setTableChanging(true);
- //
- try {
- if (sorting) {
- m_sortValid = false;
- }
- resetColumnsInternal(visibility, order, sorting, widths);
- execResetColumns(visibility, order, sorting, widths);
- }
- catch (Throwable t) {
- LOG.error("reset columns " + visibility + "," + order + "," + sorting + "," + widths, t);
- }
- }
- finally {
- setTableChanging(false);
- }
- }
-
- private void resetColumnsInternal(boolean visibility, boolean order, boolean sorting, boolean widths) {
- ClientUIPreferences env = ClientUIPreferences.getInstance();
- env.removeAllTableColumnPreferences(this, visibility, order, sorting, widths);
-
- //Visibilities
- if (visibility) {
- ArrayList<IColumn<?>> list = new ArrayList<IColumn<?>>();
- for (IColumn<?> col : getColumnSet().getAllColumnsInUserOrder()) {
- if (col.isDisplayable()) {
- boolean configuredVisible = ((AbstractColumn<?>) col).isInitialVisible();
- if (configuredVisible) {
- list.add(col);
- }
- }
- }
- getColumnSet().setVisibleColumns(list.toArray(new IColumn<?>[list.size()]));
- }
- //Order
- if (order) {
- TreeMap<CompositeObject, IColumn<?>> orderMap = new TreeMap<CompositeObject, IColumn<?>>();
- int index = 0;
- for (IColumn<?> col : getColumns()) {
- if (col.isDisplayable() && col.isVisible()) {
- orderMap.put(new CompositeObject(col.getViewOrder(), index), col);
- index++;
- }
- }
- getColumnSet().setVisibleColumns(orderMap.values().toArray(new IColumn[orderMap.size()]));
- }
- //Sorting
- if (sorting) {
- TreeMap<CompositeObject, IColumn<?>> sortMap = new TreeMap<CompositeObject, IColumn<?>>();
- int index = 0;
- for (IColumn<?> col : getColumns()) {
- if (col.getInitialSortIndex() >= 0) {
- sortMap.put(new CompositeObject(col.getInitialSortIndex(), index), col);
- }
- index++;
- }
- //
- getColumnSet().clearSortColumns();
- getColumnSet().clearPermanentHeadSortColumns();
- getColumnSet().clearPermanentTailSortColumns();
- for (IColumn<?> col : sortMap.values()) {
- if (col.isInitialAlwaysIncludeSortAtBegin()) {
- getColumnSet().addPermanentHeadSortColumn(col, col.isInitialSortAscending());
- }
- else if (col.isInitialAlwaysIncludeSortAtEnd()) {
- getColumnSet().addPermanentTailSortColumn(col, col.isInitialSortAscending());
- }
- else {
- getColumnSet().addSortColumn(col, col.isInitialSortAscending());
- }
- }
- }
- //Widths
- if (widths) {
- for (IColumn<?> col : getColumns()) {
- if (col.isDisplayable()) {
- col.setWidth(col.getInitialWidth());
- }
- }
- }
- }
-
- /**
- * Affects columns with lookup calls or code types<br>
- * cells that have changed values fetch new texts/decorations from the lookup
- * service in one single batch call lookup (performance optimization)
- */
- private void processDecorationBuffer() {
- /*
- * 1. process lookup service calls
- */
- try {
- BatchLookupCall batchCall = null;
- ArrayList<ITableRow> tableRowList = null;
- ArrayList<Integer> columnIndexList = null;
- if (m_cellLookupBuffer.size() > 0) {
- batchCall = new BatchLookupCall();
- tableRowList = new ArrayList<ITableRow>();
- columnIndexList = new ArrayList<Integer>();
- BatchLookupResultCache lookupResultCache = new BatchLookupResultCache();
- for (P_CellLookup lookup : m_cellLookupBuffer) {
- ITableRow row = lookup.getRow();
- if (row.getTable() == AbstractTable.this) {
- ISmartColumn<?> col = lookup.getColumn();
- LookupCall call = col.prepareLookupCall(row);
- if (call != null && call.getKey() != null) {
- //split: local vs remote
- if (call instanceof LocalLookupCall) {
- LookupRow[] result = lookupResultCache.getDataByKey(call);
- applyLookupResult((InternalTableRow) row, col.getColumnIndex(), result);
- }
- else {
- tableRowList.add(row);
- columnIndexList.add(new Integer(col.getColumnIndex()));
- batchCall.addLookupCall(call);
- }
- }
- else {
- applyLookupResult((InternalTableRow) row, col.getColumnIndex(), LookupRow.EMPTY_ARRAY);
- }
- }
- }
- }
- m_cellLookupBuffer.clear();
- //
- if (batchCall != null && tableRowList != null && columnIndexList != null && !batchCall.isEmpty()) {
- ITableRow[] tableRows = tableRowList.toArray(new ITableRow[0]);
- LookupRow[][] resultArray;
- IBatchLookupService service = SERVICES.getService(IBatchLookupService.class);
- resultArray = service.getBatchDataByKey(batchCall);
- for (int i = 0; i < tableRows.length; i++) {
- applyLookupResult((InternalTableRow) tableRows[i], ((Number) columnIndexList.get(i)).intValue(), resultArray[i]);
- }
- }
- }
- catch (ProcessingException e) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- finally {
- m_cellLookupBuffer.clear();
- }
- /*
- * 2. update row decorations
- */
- HashSet<ITableRow> set = m_rowDecorationBuffer;
- m_rowDecorationBuffer = new HashSet<ITableRow>();
- for (ITableRow row : set) {
- if (row.getTable() == AbstractTable.this) {
- applyRowDecorationsImpl(row);
- }
- }
- /*
- * check row filters
- */
- if (m_rowFilters.size() > 0) {
- boolean filterChanged = false;
- for (ITableRow row : set) {
- if (row.getTable() == AbstractTable.this) {
- if (row instanceof InternalTableRow) {
- InternalTableRow irow = (InternalTableRow) row;
- boolean oldFlag = irow.isFilterAccepted();
- applyRowFiltersInternal(irow);
- boolean newFlag = irow.isFilterAccepted();
- filterChanged = filterChanged || (oldFlag != newFlag);
- }
- }
- }
- if (filterChanged) {
- fireRowFilterChanged();
- }
- }
- }
-
- private int m_processEventBufferLoopDetection;
-
- /**
- * Fire events in form of one batch<br>
- * fire all buffered events<br>
- * coalesce all TableEvents of same type and sort according to their type
- */
- private void processEventBuffer() {
- //loop detection
- try {
- m_processEventBufferLoopDetection++;
- if (m_processEventBufferLoopDetection > 100) {
- LOG.error("LOOP DETECTION in " + getClass() + ". see stack trace for more details.", new Exception("LOOP DETECTION"));
- return;
- }
- //
- ArrayList<TableEvent> list = m_tableEventBuffer;
- m_tableEventBuffer = new ArrayList<TableEvent>();
- if (list.size() > 0) {
- HashMap<Integer, List<TableEvent>> coalesceMap = new HashMap<Integer, List<TableEvent>>();
- for (TableEvent e : list) {
- List<TableEvent> subList = coalesceMap.get(e.getType());
- if (subList == null) {
- subList = new ArrayList<TableEvent>();
- coalesceMap.put(e.getType(), subList);
- }
- subList.add(e);
- }
- TreeMap<Integer, TableEvent> sortedCoalescedMap = new TreeMap<Integer, TableEvent>();
- for (Map.Entry<Integer, List<TableEvent>> entry : coalesceMap.entrySet()) {
- int type = entry.getKey();
- List<TableEvent> subList = entry.getValue();
- int lastIndex = subList.size() - 1;
- switch (type) {
- case TableEvent.TYPE_ALL_ROWS_DELETED: {
- ArrayList<TableEvent> singleList = new ArrayList<TableEvent>(1);
- singleList.add(subList.get(lastIndex));// use last
- sortedCoalescedMap.put(10, coalesceTableEvents(singleList, false, true));
- break;
- }
- case TableEvent.TYPE_ROWS_DELETED: {
- sortedCoalescedMap.put(20, coalesceTableEvents(subList, false, true));// merge
- break;
- }
- case TableEvent.TYPE_ROWS_INSERTED: {
- sortedCoalescedMap.put(30, coalesceTableEvents(subList, true, false));// merge
- break;
- }
- case TableEvent.TYPE_ROWS_UPDATED: {
- sortedCoalescedMap.put(40, coalesceTableEvents(subList, true, false));// merge
- break;
- }
- case TableEvent.TYPE_COLUMN_HEADERS_UPDATED: {
- sortedCoalescedMap.put(60, coalesceTableEvents(subList, false, false));// merge
- break;
- }
- case TableEvent.TYPE_COLUMN_ORDER_CHANGED: {
- sortedCoalescedMap.put(70, coalesceTableEvents(subList, false, false));// merge
- break;
- }
- case TableEvent.TYPE_COLUMN_STRUCTURE_CHANGED: {
- sortedCoalescedMap.put(80, subList.get(lastIndex));// use last
- break;
- }
- case TableEvent.TYPE_ROW_ORDER_CHANGED: {
- sortedCoalescedMap.put(90, subList.get(lastIndex));// use last
- break;
- }
- case TableEvent.TYPE_ROWS_DRAG_REQUEST: {
- sortedCoalescedMap.put(100, subList.get(lastIndex));// use last
- break;
- }
- case TableEvent.TYPE_ROW_DROP_ACTION: {
- sortedCoalescedMap.put(110, subList.get(lastIndex));// use last
- break;
- }
- case TableEvent.TYPE_HEADER_POPUP: {
- sortedCoalescedMap.put(130, subList.get(lastIndex));// use last
- break;
- }
- case TableEvent.TYPE_EMPTY_SPACE_POPUP: {
- sortedCoalescedMap.put(140, subList.get(lastIndex));// use last
- break;
- }
- case TableEvent.TYPE_ROW_POPUP: {
- sortedCoalescedMap.put(150, subList.get(lastIndex));// use last
- break;
- }
- case TableEvent.TYPE_ROW_ACTION: {
- sortedCoalescedMap.put(160, subList.get(lastIndex));// use last
- break;
- }
- case TableEvent.TYPE_ROWS_SELECTED: {
- sortedCoalescedMap.put(170, subList.get(lastIndex));// use last
- break;
- }
- case TableEvent.TYPE_SCROLL_TO_SELECTION: {
- sortedCoalescedMap.put(180, subList.get(lastIndex));// use last
- break;
- }
- default: {
- sortedCoalescedMap.put(-type, subList.get(lastIndex));// use last
- }
- }
- }
- // fire the batch and set tree to changing, otherwise a listener might trigger another events that then are processed before all other listeners received that batch
- try {
- setTableChanging(true);
- //
- fireTableEventBatchInternal(sortedCoalescedMap.values().toArray(new TableEvent[0]));
- }
- finally {
- setTableChanging(false);
- }
- }
- }
- finally {
- m_processEventBufferLoopDetection--;
- }
- }
-
- private TableEvent coalesceTableEvents(List<TableEvent> list, boolean includeExistingRows, boolean includeRemovedRows) {
- if (list.size() == 1) {
- return list.get(0);
- }
- else {
- TableEvent last = list.get(list.size() - 1);
- TableEvent ce = new TableEvent(last.getTable(), last.getType());
- //
- ce.setSortInMemoryAllowed(last.isSortInMemoryAllowed());
- ce.setDragObject(last.getDragObject());
- ce.setDropObject(last.getDropObject());
- ce.setCopyObject(last.getCopyObject());
- ce.addPopupMenus(last.getPopupMenus());
- //columns
- HashSet<IColumn> colList = new HashSet<IColumn>();
- for (TableEvent t : list) {
- if (t.getColumns() != null) {
- colList.addAll(Arrays.asList(t.getColumns()));
- }
- }
- ce.setColumns(colList.toArray(new IColumn<?>[0]));
- //rows
- HashSet<ITableRow> rowList = new HashSet<ITableRow>();
- for (TableEvent t : list) {
- if (t.getRowCount() > 0) {
- for (ITableRow row : t.getRows()) {
- if (row.getTable() == AbstractTable.this && includeExistingRows) {
- rowList.add(row);
- }
- else if (row.getTable() != AbstractTable.this && includeRemovedRows) {
- rowList.add(row);
- }
- }
- }
- }
- ce.setRows(rowList.toArray(new ITableRow[0]));
- //
- return ce;
- }
- }
-
- /**
- * do decoration and filtering later
- */
- private void enqueueDecorationTasks(ITableRow row) {
- if (row != null) {
- for (int i = 0; i < row.getCellCount(); i++) {
- IColumn<?> column = getColumnSet().getColumn(i);
- // lookups
- if (column instanceof ISmartColumn) {
- ISmartColumn<?> smartColumn = (ISmartColumn<?>) column;
- if (smartColumn.getLookupCall() != null) {
- m_cellLookupBuffer.add(new P_CellLookup(row, smartColumn));
- }
- }
- }
- m_rowDecorationBuffer.add(row);
- }
- }
-
- /*
- * does not use setTableChanging()
- */
- private void applyRowDecorationsImpl(ITableRow tableRow) {
- // disable row changed trigger on row
- try {
- tableRow.setRowChanging(true);
- //
- // row decorator on table
- this.decorateRow(tableRow);
- // row decorator on columns
- ColumnSet cset = getColumnSet();
- for (int c = 0; c < tableRow.getCellCount(); c++) {
- // cell decorator on column
- IColumn<?> col = cset.getColumn(c);
- col.decorateCell(tableRow);
- // cell decorator on table
- this.decorateCell(tableRow, col);
- }
- }
- catch (Throwable t) {
- LOG.error("Error occured while applying row decoration", t);
- }
- finally {
- tableRow.setRowPropertiesChanged(false);
- tableRow.setRowChanging(false);
- }
- }
-
- private void applyLookupResult(InternalTableRow tableRow, int columnIndex, LookupRow[] result) {
- // disable row changed trigger on row
- try {
- tableRow.setRowChanging(true);
- //
- Cell cell = (Cell) tableRow.getCell(columnIndex);
- if (result.length == 1) {
- cell.setText(result[0].getText());
- cell.setTooltipText(result[0].getTooltipText());
- }
- else if (result.length > 1) {
- StringBuffer buf = new StringBuffer();
- StringBuffer bufTooltip = new StringBuffer();
- for (int i = 0; i < result.length; i++) {
- if (i > 0) {
- if (isMultilineText()) {
- buf.append("\n");
- bufTooltip.append("\n");
- }
- else {
- buf.append(", ");
- bufTooltip.append(", ");
- }
- }
- buf.append(result[i].getText());
- bufTooltip.append(result[i].getTooltipText());
- }
- cell.setText(buf.toString());
- cell.setTooltipText(bufTooltip.toString());
- }
- else {
- cell.setText("");
- cell.setTooltipText("");
- }
- }
- finally {
- tableRow.setRowPropertiesChanged(false);
- tableRow.setRowChanging(false);
- }
- }
-
- @Override
- public void tablePopulated() {
- if (m_tableEventBuffer.isEmpty()) {
- synchronized (m_cachedFilteredRowsLock) {
- m_cachedFilteredRows = null;
- }
- fireTableEventInternal(new TableEvent(this, TableEvent.TYPE_TABLE_POPULATED, null));
- }
- }
-
- @Override
- public ITableRow resolveRow(ITableRow row) {
- if (row == null) {
- return null;
- }
- if (!(row instanceof InternalTableRow)) {
- throw new IllegalArgumentException("only accept InternalTableRow, not " + (row != null ? row.getClass() : null));
- }
- // check owner
- if (row.getTable() == this) {
- return row;
- }
- else {
- return null;
- }
- }
-
- @Override
- public ITableRow[] resolveRows(ITableRow[] rows) {
- if (rows == null) {
- rows = new ITableRow[0];
- }
- int mismatchCount = 0;
- for (int i = 0; i < rows.length; i++) {
- if (resolveRow(rows[i]) != rows[i]) {
- LOG.warn("could not resolve row " + rows[i]);
- mismatchCount++;
- }
- }
- if (mismatchCount > 0) {
- ITableRow[] resolvedRows = new ITableRow[rows.length - mismatchCount];
- int index = 0;
- for (int i = 0; i < rows.length; i++) {
- if (resolveRow(rows[i]) == rows[i]) {
- resolvedRows[index] = rows[i];
- index++;
- }
- }
- rows = resolvedRows;
- }
- return rows;
- }
-
- @Override
- public boolean isHeaderVisible() {
- return propertySupport.getPropertyBool(PROP_HEADER_VISIBLE);
- }
-
- @Override
- public void setHeaderVisible(boolean b) {
- propertySupport.setPropertyBool(PROP_HEADER_VISIBLE, b);
- }
-
- @Override
- public final void decorateCell(ITableRow row, IColumn<?> col) {
- Cell cell = row.getCellForUpdate(col.getColumnIndex());
- decorateCellInternal(cell, row, col);
- try {
- execDecorateCell(cell, row, col);
- }
- catch (ProcessingException e) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- catch (Throwable t) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Unexpected", t));
- }
- }
-
- protected void decorateCellInternal(Cell view, ITableRow row, IColumn<?> col) {
- }
-
- @Override
- public final void decorateRow(ITableRow row) {
- decorateRowInternal(row);
- try {
- execDecorateRow(row);
- }
- catch (ProcessingException e) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- catch (Throwable t) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Unexpected", t));
- }
- }
-
- protected void decorateRowInternal(ITableRow row) {
- // icon
- if (row.getIconId() == null) {
- String s = getDefaultIconId();
- if (s != null) {
- row.setIconId(s);
- }
- }
- }
-
- /**
- * Called when the columns are reset.
- * <p>
- * Subclasses can override this method. The default does nothing.
- *
- * @param visiblity
- * {@code true} if the visibility is reset.
- * @param order
- * {@code true} if the order is reset.
- * @param sorting
- * {@code true} if the sorting is reset.
- * @param widths
- * {@code true} if the column widths are reset.
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(90)
- protected void execResetColumns(boolean visibility, boolean order, boolean sorting, boolean widths) throws ProcessingException {
- }
-
- /**
- * Model Observer
- */
- @Override
- public void addTableListener(TableListener listener) {
- m_listenerList.add(TableListener.class, listener);
- }
-
- @Override
- public void removeTableListener(TableListener listener) {
- m_listenerList.remove(TableListener.class, listener);
- }
-
- @Override
- public void addUITableListener(TableListener listener) {
- m_listenerList.insertAtFront(TableListener.class, listener);
- }
-
- protected IEventHistory<TableEvent> createEventHistory() {
- return new DefaultTableEventHistory(5000L);
- }
-
- @Override
- public IEventHistory<TableEvent> getEventHistory() {
- return m_eventHistory;
- }
-
- @Override
- public IMenu[] fetchMenusForRowsInternal(ITableRow[] rows) {
- TableEvent e;
- if (rows.length == 0) {
- e = new TableEvent(this, TableEvent.TYPE_EMPTY_SPACE_POPUP);
- }
- else {
- e = new TableEvent(this, TableEvent.TYPE_ROW_POPUP, rows);
- }
- fireTableEventInternal(e);
- return e.getPopupMenus();
- }
-
- private void fireRowsInserted(ITableRow[] rows) {
- synchronized (m_cachedFilteredRowsLock) {
- m_cachedFilteredRows = null;
- }
- fireTableEventInternal(new TableEvent(this, TableEvent.TYPE_ROWS_INSERTED, rows));
- }
-
- private void fireRowsUpdated(ITableRow[] rows) {
- synchronized (m_cachedFilteredRowsLock) {
- m_cachedFilteredRows = null;
- }
- fireTableEventInternal(new TableEvent(this, TableEvent.TYPE_ROWS_UPDATED, rows));
- }
-
- /**
- * Request to reload/replace table data with refreshed data
- */
- private void fireRowsDeleted(ITableRow[] rows) {
- synchronized (m_cachedFilteredRowsLock) {
- m_cachedFilteredRows = null;
- }
- fireTableEventInternal(new TableEvent(this, TableEvent.TYPE_ROWS_DELETED, rows));
- }
-
- private void fireAllRowsDeleted(ITableRow[] rows) {
- synchronized (m_cachedFilteredRowsLock) {
- m_cachedFilteredRows = null;
- }
- fireTableEventInternal(new TableEvent(this, TableEvent.TYPE_ALL_ROWS_DELETED, rows));
- }
-
- private void fireRowsSelected(ITableRow[] rows) {
- fireTableEventInternal(new TableEvent(this, TableEvent.TYPE_ROWS_SELECTED, rows));
- }
-
- private void fireRowClick(ITableRow row) {
- if (row != null) {
- try {
- interceptRowClickSingleObserver(row);
- execRowClick(row);
- }
- catch (ProcessingException ex) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(ex);
- }
- catch (Throwable t) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Unexpected", t));
- }
- }
- }
-
- protected void interceptRowClickSingleObserver(ITableRow row) throws ProcessingException {
- // single observer for checkable tables
- // if row click is targetted to cell editor, do not interpret click as check/uncheck event
- if (row.isEnabled() && isEnabled()) {
- IColumn<?> ctxCol = getContextColumn();
- if (isCellEditable(row, ctxCol)) {
- //cell-level checkbox
- if (ctxCol instanceof IBooleanColumn) {
- //editable boolean columns consume this click
- IFormField field = ctxCol.prepareEdit(row);
- if (field instanceof IBooleanField) {
- IBooleanField bfield = (IBooleanField) field;
- bfield.setChecked(!bfield.isChecked());
- ctxCol.completeEdit(row, field);
- }
- }
- else {
- //other editable columns have no effect HERE, the ui will open an editor
- }
- }
- else {
- //row-level checkbox
- if (isCheckable()) {
- row.setChecked(!row.isChecked());
- }
- }
- }
- }
-
- private void fireRowAction(ITableRow row) {
- if (!m_actionRunning) {
- try {
- m_actionRunning = true;
- if (row != null) {
- try {
- execRowAction(row);
- }
- catch (ProcessingException ex) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(ex);
- }
- catch (Throwable t) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Unexpected", t));
- }
- }
- }
- finally {
- m_actionRunning = false;
- }
- }
- }
-
- private void fireRowOrderChanged() {
- synchronized (m_cachedFilteredRowsLock) {
- m_cachedFilteredRows = null;
- }
- fireTableEventInternal(new TableEvent(this, TableEvent.TYPE_ROW_ORDER_CHANGED, getRows()));
- }
-
- private void fireRequestFocus() {
- fireTableEventInternal(new TableEvent(this, TableEvent.TYPE_REQUEST_FOCUS));
- }
-
- private void fireRequestFocusInCell(IColumn<?> column, ITableRow row) {
- TableEvent e = new TableEvent(this, TableEvent.TYPE_REQUEST_FOCUS_IN_CELL);
- e.setColumns(new IColumn<?>[]{column});
- e.setRows(new ITableRow[]{row});
- fireTableEventInternal(e);
- }
-
- private void fireRowFilterChanged() {
- synchronized (m_cachedFilteredRowsLock) {
- m_cachedFilteredRows = null;
- }
- fireTableEventInternal(new TableEvent(this, TableEvent.TYPE_ROW_FILTER_CHANGED));
- }
-
- private TransferObject fireRowsDragRequest() {
- ITableRow[] rows = getSelectedRows();
- if (rows != null && rows.length > 0) {
- TableEvent e = new TableEvent(this, TableEvent.TYPE_ROWS_DRAG_REQUEST, rows);
- fireTableEventInternal(e);
- return e.getDragObject();
- }
- else {
- return null;
- }
- }
-
- private void fireRowDropAction(ITableRow row, TransferObject dropData) {
- ITableRow[] rows = null;
- if (row != null) {
- rows = new ITableRow[]{row};
- }
- TableEvent e = new TableEvent(this, TableEvent.TYPE_ROW_DROP_ACTION, rows);
- e.setDropObject(dropData);
- fireTableEventInternal(e);
- }
-
- private TransferObject fireRowsCopyRequest() {
- ITableRow[] rows = getSelectedRows();
- if (rows != null && rows.length > 0) {
- TableEvent e = new TableEvent(this, TableEvent.TYPE_ROWS_COPY_REQUEST, rows);
- fireTableEventInternal(e);
- return e.getCopyObject();
- }
- else {
- return null;
- }
- }
-
- private IMenu[] fireEmptySpacePopup() {
- TableEvent e = new TableEvent(this, TableEvent.TYPE_EMPTY_SPACE_POPUP);
- fireTableEventInternal(e);
- return e.getPopupMenus();
- }
-
- private IMenu[] fireRowPopup() {
- TableEvent e = new TableEvent(this, TableEvent.TYPE_ROW_POPUP, getSelectedRows());
- fireTableEventInternal(e);
- return e.getPopupMenus();
- }
-
- private void addLocalPopupMenus(TableEvent e) {
- boolean singleSelect = getSelectedRowCount() == 1;
- boolean multiSelect = getSelectedRowCount() >= 2;
- boolean allRowsEnabled = true;
- for (ITableRow row : getSelectedRows()) {
- if (!row.isEnabled()) {
- allRowsEnabled = false;
- break;
- }
- }
- IMenu[] a = getMenus();
- for (IMenu menu : a) {
- IMenu validMenu = null;
- switch (e.getType()) {
- case TableEvent.TYPE_HEADER_POPUP:
- case TableEvent.TYPE_EMPTY_SPACE_POPUP: {
- if (menu.isEmptySpaceAction()) {
- if ((!menu.isInheritAccessibility()) || (isEnabled())) {
- validMenu = menu;
- }
- }
- break;
- }
- case TableEvent.TYPE_ROW_POPUP: {
- if (multiSelect) {
- if (menu.isMultiSelectionAction()) {
- if ((!menu.isInheritAccessibility()) || (isEnabled() && allRowsEnabled)) {
- validMenu = menu;
- }
- }
- }
- else if (singleSelect) {
- if (menu.isSingleSelectionAction()) {
- if ((!menu.isInheritAccessibility()) || (isEnabled() && allRowsEnabled)) {
- validMenu = menu;
- }
- }
- }
- break;
- }
- }
- if (validMenu != null) {
- validMenu.prepareAction();
- if (validMenu.isVisible()) {
- e.addPopupMenu(validMenu);
- }
- }
- }
- }
-
- /**
- * Called before the header menus are displayed.
- * <p>
- * Subclasses can override this method. The default add menus for add, modifying and removing custom column and menus
- * for reseting, organizing and filtering the columns.
- *
- * @param e
- * Table event of type {@link TableEvent#TYPE_HEADER_POPUP}.
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(100)
- protected void execAddHeaderMenus(TableEvent e) throws ProcessingException {
- if (getTableCustomizer() != null) {
- if (e.getPopupMenuCount() > 0) {
- e.addPopupMenu(new MenuSeparator());
- }
- for (IMenu m : new IMenu[]{new AddCustomColumnMenu(this), new ModifyCustomColumnMenu(this), new RemoveCustomColumnMenu(this)}) {
- m.prepareAction();
- if (m.isVisible()) {
- e.addPopupMenu(m);
- }
- }
- }
- if (e.getPopupMenuCount() > 0) {
- e.addPopupMenu(new MenuSeparator());
- }
- for (IMenu m : new IMenu[]{new ResetColumnsMenu(this), new OrganizeColumnsMenu(this), new ColumnFilterMenu(this), new CopyWidthsOfColumnsMenu(this)}) {
- m.prepareAction();
- if (m.isVisible()) {
- e.addPopupMenu(m);
- }
- }
- }
-
- private IMenu[] fireHeaderPopup() {
- TableEvent e = new TableEvent(this, TableEvent.TYPE_HEADER_POPUP);
- fireTableEventInternal(e);
- try {
- execAddHeaderMenus(e);
- }
- catch (ProcessingException ex) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(ex);
- }
- return e.getPopupMenus();
- }
-
- // main handler
- protected void fireTableEventInternal(TableEvent e) {
- if (isTableChanging()) {
- // buffer the event for later batch firing
- m_tableEventBuffer.add(e);
- }
- else {
- EventListener[] listeners = m_listenerList.getListeners(TableListener.class);
- if (listeners != null && listeners.length > 0) {
- for (int i = 0; i < listeners.length; i++) {
- try {
- ((TableListener) listeners[i]).tableChanged(e);
- }
- catch (Throwable t) {
- LOG.error("fire " + e, t);
- }
- }
- }
- }
- }
-
- // batch handler
- private void fireTableEventBatchInternal(TableEvent[] batch) {
- if (batch.length == 0) {
- return;
- }
- if (batch.length > 0) {
- EventListener[] listeners = m_listenerList.getListeners(TableListener.class);
- if (listeners != null && listeners.length > 0) {
- for (int i = 0; i < listeners.length; i++) {
- ((TableListener) listeners[i]).tableChangedBatch(batch);
- }
- }
- }
- }
-
- protected boolean handleKeyStroke(String keyName, char keyChar) {
- if (keyName == null) {
- return false;
- }
- keyName = keyName.toLowerCase();
- // check if there is no menu keystroke with that name
- for (IMenu m : getMenus()) {
- if (m.getKeyStroke() != null && m.getKeyStroke().equalsIgnoreCase(keyName)) {
- return false;
- }
- }
- // check if there is no keystroke with that name (ticket 78234)
- for (IKeyStroke k : getKeyStrokes()) {
- if (k.getKeyStroke() != null && k.getKeyStroke().equalsIgnoreCase(keyName)) {
- return false;
- }
- }
- if (keyChar > ' ' && (!keyName.contains("control")) && (!keyName.contains("ctrl")) && (!keyName.contains("alt"))) {
- // select first/next line with corresponding character
- String newText = "" + Character.toLowerCase(keyChar);
- m_keyStrokeBuffer.append(newText);
- String prefix = m_keyStrokeBuffer.getText();
-
- IColumn<?> col = getContextColumn();
- if (col == null) {
- IColumn<?>[] sortCols = getColumnSet().getSortColumns();
- if (sortCols.length > 0) {
- col = sortCols[sortCols.length - 1];
- }
- else {
- TreeMap<CompositeObject, IColumn<?>> sortMap = new TreeMap<CompositeObject, IColumn<?>>();
- int index = 0;
- for (IColumn<?> c : getColumnSet().getVisibleColumns()) {
- if (c.getDataType() == String.class) {
- sortMap.put(new CompositeObject(1, index), c);
- }
- else if (c.getDataType() == Boolean.class) {
- sortMap.put(new CompositeObject(3, index), c);
- }
- else {
- sortMap.put(new CompositeObject(2, index), c);
- }
- index++;
- }
- if (sortMap.size() > 0) {
- col = sortMap.get(sortMap.firstKey());
- }
- }
- }
- if (col != null) {
- int colIndex = col.getColumnIndex();
- String pattern = StringUtility.toRegExPattern(prefix.toLowerCase());
- pattern = pattern + ".*";
- if (LOG.isInfoEnabled()) {
- LOG.info("finding regex:" + pattern + " in column " + getColumnSet().getColumn(colIndex).getHeaderCell().getText());
- }
- // loop over values and find matching one
- int rowCount = getRowCount();
- ITableRow selRow = getSelectedRow();
- int startIndex = 0;
- if (selRow != null) {
- if (prefix.length() <= 1) {
- startIndex = selRow.getRowIndex() + 1;
- }
- else {
- startIndex = selRow.getRowIndex();
- }
- }
- for (int i = 0; i < rowCount; i++) {
- ITableRow row = m_rows.get((startIndex + i) % rowCount);
- String text = row.getCell(colIndex).getText();
- if (text != null && text.toLowerCase().matches(pattern)) {
- // handled
- selectRow(row, false);
- return true;
- }
- }
- }
- }
- return false;
- }
-
- @Override
- public ITableUIFacade getUIFacade() {
- return m_uiFacade;
- }
-
- /*
- * UI Notifications
- */
- protected class P_TableUIFacade implements ITableUIFacade {
- private int m_uiProcessorCount = 0;
-
- protected void pushUIProcessor() {
- m_uiProcessorCount++;
- }
-
- protected void popUIProcessor() {
- m_uiProcessorCount--;
- }
-
- @Override
- public boolean isUIProcessing() {
- return m_uiProcessorCount > 0;
- }
-
- @Override
- public void fireRowClickFromUI(ITableRow row) {
- try {
- pushUIProcessor();
- //
- row = resolveRow(row);
- if (row != null) {
- fireRowClick(resolveRow(row));
- }
- }
- finally {
- popUIProcessor();
- }
- }
-
- @Override
- public void fireRowActionFromUI(ITableRow row) {
- try {
- pushUIProcessor();
- //
- row = resolveRow(row);
- if (row != null) {
- fireRowAction(row);
- }
- }
- finally {
- popUIProcessor();
- }
- }
-
- @Override
- public IMenu[] fireRowPopupFromUI() {
- try {
- pushUIProcessor();
- //
- return fireRowPopup();
- }
- finally {
- popUIProcessor();
- }
- }
-
- @Override
- public IMenu[] fireEmptySpacePopupFromUI() {
- try {
- pushUIProcessor();
- //
- return fireEmptySpacePopup();
- }
- finally {
- popUIProcessor();
- }
- }
-
- @Override
- public IMenu[] fireHeaderPopupFromUI() {
- try {
- pushUIProcessor();
- //
- return fireHeaderPopup();
- }
- finally {
- popUIProcessor();
- }
- }
-
- @Override
- public boolean fireKeyTypedFromUI(String keyStrokeText, char keyChar) {
- try {
- pushUIProcessor();
- //
- return handleKeyStroke(keyStrokeText, keyChar);
- }
- finally {
- popUIProcessor();
- }
- }
-
- @Override
- public void fireVisibleColumnsChangedFromUI(IColumn<?>[] visibleColumns) {
- try {
- pushUIProcessor();
- //
- getColumnSet().setVisibleColumns(visibleColumns);
- ClientUIPreferences.getInstance().setAllTableColumnPreferences(AbstractTable.this);
- }
- finally {
- popUIProcessor();
- }
- }
-
- @Override
- public void fireColumnMovedFromUI(IColumn<?> c, int toViewIndex) {
- try {
- pushUIProcessor();
- //
- c = getColumnSet().resolveColumn(c);
- if (c != null) {
- getColumnSet().moveColumnToVisibleIndex(c.getColumnIndex(), toViewIndex);
- ClientUIPreferences.getInstance().setAllTableColumnPreferences(AbstractTable.this);
- }
- }
- finally {
- popUIProcessor();
- }
- }
-
- @Override
- public void setColumnWidthFromUI(IColumn<?> c, int newWidth) {
- try {
- pushUIProcessor();
- //
- c = getColumnSet().resolveColumn(c);
- if (c != null) {
- c.setWidthInternal(newWidth);
- ClientUIPreferences.getInstance().setAllTableColumnPreferences(AbstractTable.this);
- }
- }
- finally {
- popUIProcessor();
- }
- }
-
- @Override
- public void fireHeaderSortFromUI(IColumn<?> c, boolean multiSort) {
- try {
- pushUIProcessor();
- //
- if (isSortEnabled()) {
- c = getColumnSet().resolveColumn(c);
- if (c != null) {
- getColumnSet().handleSortEvent(c, multiSort);
- ClientUIPreferences.getInstance().setAllTableColumnPreferences(AbstractTable.this);
- sort();
- }
- }
- }
- finally {
- popUIProcessor();
- }
- }
-
- @Override
- public void setSelectedRowsFromUI(ITableRow[] rows) {
- try {
- pushUIProcessor();
- //
- HashSet<ITableRow> requestedRows = new HashSet<ITableRow>(Arrays.asList(resolveRows(rows)));
- ArrayList<ITableRow> validRows = new ArrayList<ITableRow>();
- // add existing selected rows that are masked by filter
- for (ITableRow row : getSelectedRows()) {
- if (!row.isFilterAccepted()) {
- validRows.add(row);
- }
- }
- // remove all filtered from requested
- requestedRows.removeAll(validRows);
- // add remainder
- for (ITableRow row : requestedRows) {
- validRows.add(row);
- }
- selectRows(validRows.toArray(new ITableRow[validRows.size()]), false);
- }
- finally {
- popUIProcessor();
- }
- }
-
- @Override
- public TransferObject fireRowsDragRequestFromUI() {
- try {
- pushUIProcessor();
- return fireRowsDragRequest();
- }
- finally {
- popUIProcessor();
- }
- }
-
- @Override
- public void fireRowDropActionFromUI(ITableRow row, TransferObject dropData) {
- try {
- pushUIProcessor();
- row = resolveRow(row);
- fireRowDropAction(row, dropData);
- }
- finally {
- popUIProcessor();
- }
- }
-
- @Override
- public TransferObject fireRowsCopyRequestFromUI() {
- try {
- pushUIProcessor();
- return fireRowsCopyRequest();
- }
- finally {
- popUIProcessor();
- }
- }
-
- @Override
- public void fireHyperlinkActionFromUI(ITableRow row, IColumn<?> col, URL url) {
- try {
- pushUIProcessor();
- //
- doHyperlinkAction(resolveRow(row), col, url);
- }
- catch (ProcessingException e) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- finally {
- popUIProcessor();
- }
- }
-
- @Override
- public void setContextColumnFromUI(IColumn<?> col) {
- try {
- pushUIProcessor();
- //
- if (col != null && col.getTable() != AbstractTable.this) {
- col = null;
- }
- setContextColumn(col);
- }
- finally {
- popUIProcessor();
- }
- }
-
- @Override
- public IFormField prepareCellEditFromUI(ITableRow row, IColumn<?> col) {
- try {
- pushUIProcessor();
- //
- m_editContext = null;
- row = resolveRow(row);
- if (row != null && col != null) {
- try {
- // ensure the editable row to be selected.
- // This is crucial if the cell's value is changed right away in @{link IColumn#prepareEdit(ITableRow)}, e.g. in @{link AbstractBooleanColumn}
- row.getTable().selectRow(row);
- IFormField f = col.prepareEdit(row);
- if (f != null) {
- m_editContext = new P_CellEditorContext(row, col, f);
- }
- return f;
- }
- catch (ProcessingException e) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- catch (Throwable t) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Unexpected", t));
- }
- }
- }
- finally {
- popUIProcessor();
- }
- return null;
- }
-
- @Override
- public void completeCellEditFromUI() {
- try {
- pushUIProcessor();
- //
- if (m_editContext != null) {
- try {
- m_editContext.getColumn().completeEdit(m_editContext.getRow(), m_editContext.getFormField());
- }
- catch (ProcessingException e) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- catch (Throwable t) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Unexpected", t));
- }
- finally {
- m_editContext = null;
- }
- }
- }
- finally {
- popUIProcessor();
- }
- }
-
- @Override
- public void cancelCellEditFromUI() {
- try {
- pushUIProcessor();
- //
- m_editContext = null;
- }
- finally {
- popUIProcessor();
- }
- }
-
- }
-
- private class P_CellLookup {
- private final ITableRow m_row;
- private final ISmartColumn<?> m_column;
-
- public P_CellLookup(ITableRow row, ISmartColumn<?> col) {
- m_row = row;
- m_column = col;
- }
-
- public ITableRow getRow() {
- return m_row;
- }
-
- public ISmartColumn<?> getColumn() {
- return m_column;
- }
- }// end private class
-
- private class P_TableRowBuilder extends AbstractTableRowBuilder {
-
- @Override
- protected ITableRow createEmptyTableRow() {
- return new TableRow(getColumnSet());
- }
-
- }
-
- private class P_TableListener extends TableAdapter {
- @Override
- public void tableChanged(TableEvent e) {
- switch (e.getType()) {
- case TableEvent.TYPE_EMPTY_SPACE_POPUP: {
- // single observer for table-defined menus
- addLocalPopupMenus(e);
- break;
- }
- case TableEvent.TYPE_HEADER_POPUP: {
- // single observer for table-owned menus
- addLocalPopupMenus(e);
- break;
- }
- case TableEvent.TYPE_ROW_POPUP: {
- // single observer for table-defined menus
- addLocalPopupMenus(e);
- break;
- }
- case TableEvent.TYPE_ROWS_SELECTED: {
- // single observer exec
- try {
- execRowsSelected(e.getRows());
- }
- catch (ProcessingException ex) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(ex);
- }
- catch (Throwable t) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Unexpected", t));
- }
- break;
- }
- }
- }
- }
-
- private static class P_CellEditorContext {
- private final ITableRow m_row;
- private final IColumn<?> m_column;
- private final IFormField m_formField;
-
- public P_CellEditorContext(ITableRow row, IColumn<?> col, IFormField f) {
- m_row = row;
- m_column = col;
- m_formField = f;
- }
-
- public ITableRow getRow() {
- return m_row;
- }
-
- public IColumn<?> getColumn() {
- return m_column;
- }
-
- public IFormField getFormField() {
- return m_formField;
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.EventListener;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+import java.util.TreeSet;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.scout.commons.BooleanUtility;
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.commons.CompositeObject;
+import org.eclipse.scout.commons.ConfigurationUtility;
+import org.eclipse.scout.commons.EventListenerList;
+import org.eclipse.scout.commons.HTMLUtility;
+import org.eclipse.scout.commons.OptimisticLock;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.annotations.ConfigOperation;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.beans.AbstractPropertyObserver;
+import org.eclipse.scout.commons.dnd.TextTransferObject;
+import org.eclipse.scout.commons.dnd.TransferObject;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.services.common.icon.IIconProviderService;
+import org.eclipse.scout.rt.client.ui.ClientUIPreferences;
+import org.eclipse.scout.rt.client.ui.IDNDSupport;
+import org.eclipse.scout.rt.client.ui.IEventHistory;
+import org.eclipse.scout.rt.client.ui.action.ActionFinder;
+import org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke;
+import org.eclipse.scout.rt.client.ui.action.keystroke.KeyStroke;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.action.menu.MenuSeparator;
+import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
+import org.eclipse.scout.rt.client.ui.basic.cell.ICell;
+import org.eclipse.scout.rt.client.ui.basic.table.columnfilter.ColumnFilterMenu;
+import org.eclipse.scout.rt.client.ui.basic.table.columnfilter.DefaultTableColumnFilterManager;
+import org.eclipse.scout.rt.client.ui.basic.table.columnfilter.ITableColumnFilter;
+import org.eclipse.scout.rt.client.ui.basic.table.columnfilter.ITableColumnFilterManager;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractBooleanColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractStringColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IBooleanColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.ISmartColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.customizer.AddCustomColumnMenu;
+import org.eclipse.scout.rt.client.ui.basic.table.customizer.ITableCustomizer;
+import org.eclipse.scout.rt.client.ui.basic.table.customizer.ModifyCustomColumnMenu;
+import org.eclipse.scout.rt.client.ui.basic.table.customizer.RemoveCustomColumnMenu;
+import org.eclipse.scout.rt.client.ui.basic.table.internal.InternalTableRow;
+import org.eclipse.scout.rt.client.ui.basic.table.menus.CopyWidthsOfColumnsMenu;
+import org.eclipse.scout.rt.client.ui.basic.table.menus.OrganizeColumnsMenu;
+import org.eclipse.scout.rt.client.ui.basic.table.menus.ResetColumnsMenu;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.booleanfield.IBooleanField;
+import org.eclipse.scout.rt.client.ui.form.fields.tablefield.AbstractTableField;
+import org.eclipse.scout.rt.client.ui.profiler.DesktopProfiler;
+import org.eclipse.scout.rt.shared.data.form.fields.tablefield.AbstractTableFieldData;
+import org.eclipse.scout.rt.shared.services.common.code.ICode;
+import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
+import org.eclipse.scout.rt.shared.services.lookup.BatchLookupCall;
+import org.eclipse.scout.rt.shared.services.lookup.BatchLookupResultCache;
+import org.eclipse.scout.rt.shared.services.lookup.IBatchLookupService;
+import org.eclipse.scout.rt.shared.services.lookup.LocalLookupCall;
+import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
+import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
+import org.eclipse.scout.service.SERVICES;
+
+/**
+ * Columns are defined as inner classes<br>
+ * for every inner column class there is a generated getXYColumn method directly
+ * on the table
+ */
+public abstract class AbstractTable extends AbstractPropertyObserver implements ITable {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractTable.class);
+
+ private boolean m_initialized;
+ private final OptimisticLock m_initLock;
+ private ColumnSet m_columnSet;
+ /**
+ * synchronized list
+ */
+ private final List<ITableRow> m_rows;
+ private final Object m_cachedRowsLock;
+ private ITableRow[] m_cachedRows;
+ private final HashMap<CompositeObject, ITableRow> m_deletedRows;
+ private TreeSet<ITableRow/* ordered by rowIndex */> m_selectedRows = new TreeSet<ITableRow>(new RowIndexComparator());
+ private IMenu[] m_menus;
+ private ITableUIFacade m_uiFacade;
+ private final ArrayList<ITableRowFilter> m_rowFilters;
+ private String m_userPreferenceContext;
+ // batch mutation
+ private boolean m_autoDiscardOnDelete;
+ private boolean m_sortEnabled;
+ private boolean m_sortValid;
+ private boolean m_initialMultiLineText;
+ private int m_tableChanging;
+ private ArrayList<TableEvent> m_tableEventBuffer = new ArrayList<TableEvent>();
+ private final HashSet<P_CellLookup> m_cellLookupBuffer = new HashSet<P_CellLookup>();
+ private HashSet<ITableRow> m_rowDecorationBuffer = new HashSet<ITableRow>();
+ // key stroke buffer for select-as-you-type
+ private final KeyStrokeBuffer m_keyStrokeBuffer;
+ private final EventListenerList m_listenerList = new EventListenerList();
+ //cell editing
+ private P_CellEditorContext m_editContext;
+ //checkable table
+ private IBooleanColumn m_checkableColumn;
+ //auto filter
+ private final Object m_cachedFilteredRowsLock;
+ private ITableRow[] m_cachedFilteredRows;
+ private ITableColumnFilterManager m_columnFilterManager;
+ private ITableCustomizer m_tableCustomizer;
+ private IEventHistory<TableEvent> m_eventHistory;
+ // only do one action at a time
+ private boolean m_actionRunning;
+
+ public AbstractTable() {
+ this(true);
+ }
+
+ public AbstractTable(boolean callInitializer) {
+ if (DesktopProfiler.getInstance().isEnabled()) {
+ DesktopProfiler.getInstance().registerTable(this);
+ }
+ m_cachedRowsLock = new Object();
+ m_cachedFilteredRowsLock = new Object();
+ m_rows = Collections.synchronizedList(new ArrayList<ITableRow>(1));
+ m_deletedRows = new HashMap<CompositeObject, ITableRow>();
+ m_keyStrokeBuffer = new KeyStrokeBuffer(500L);
+ m_rowFilters = new ArrayList<ITableRowFilter>(1);
+ m_initLock = new OptimisticLock();
+ m_actionRunning = false;
+ //add single observer listener
+ addTableListener(new P_TableListener());
+ if (callInitializer) {
+ callInitializer();
+ }
+ }
+
+ protected void callInitializer() {
+ initConfig();
+ }
+
+ /*
+ * Configuration
+ */
+
+ /**
+ * Configures the title of this table. The title of the table is rarely used because a table is usually surrounded by
+ * an {@link AbstractTableField} having its own title / label.
+ * <p>
+ * Subclasses can override this method. Default is {@code null}.
+ *
+ * @return Title of this table.
+ */
+ @ConfigProperty(ConfigProperty.TEXT)
+ @Order(10)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredTitle() {
+ return null;
+ }
+
+ /**
+ * Configures the default icon for this table. The default icon is used for each row in the table.
+ * <p>
+ * Subclasses can override this method. Default is {@code null}.
+ *
+ * @return the ID (name) of the icon
+ * @see IIconProviderService
+ */
+ @ConfigProperty(ConfigProperty.ICON_ID)
+ @Order(20)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredDefaultIconId() {
+ return null;
+ }
+
+ /**
+ * Configures whether only one row can be selected at once in this table.
+ * <p>
+ * Subclasses can override this method. Default is {@code true}.
+ *
+ * @return {@code true} if more then one row in this table can be selected at once, {@code false} otherwise.
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(30)
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredMultiSelect() {
+ return true;
+ }
+
+ /**
+ * Configures whether only one row can be checked in this table. This configuration is only useful if
+ * {@link #getConfiguredCheckable()} is {@code true} .
+ * <p>
+ * Subclasses can override this method. Default is {@code true}.
+ *
+ * @return {@code true} if more then one row in this table can be checked, {@code false} otherwise.
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(32)
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredMultiCheck() {
+ return true;
+ }
+
+ /**
+ * Configures the default menu that is used on the ENTER (action key) or the double click on a table row.
+ * <p>
+ * Subclasses can override this method. Default is {@code null}.
+ *
+ * @return The default menu to use.
+ */
+ @ConfigProperty(ConfigProperty.MENU_CLASS)
+ @Order(35)
+ @ConfigPropertyValue("null")
+ protected Class<? extends IMenu> getConfiguredDefaultMenu() {
+ return null;
+ }
+
+ /**
+ * Interception method used for customizing the default menu. Should be used by the framework only.
+ *
+ * @since 3.8.1
+ */
+ protected Class<? extends IMenu> getDefaultMenuInternal() {
+ return getConfiguredDefaultMenu();
+ }
+
+ /**
+ * Configures whether deleted rows are automatically erased or cached for later processing (service deletion).
+ * <p>
+ * Subclasses can override this method. Default is {@code false}.
+ *
+ * @return {@code true} if deleted rows are automatically erased, {@code false} if deleted nodes are cached for later
+ * processing.
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(50)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredAutoDiscardOnDelete() {
+ return false;
+ }
+
+ /**
+ * Configures whether sort is enabled for this table. If sort is enabled, the table rows are sorted based on their
+ * sort index (see {@link AbstractColumn#getConfiguredSortIndex()}) and the user might change the sorting at run time.
+ * If sort is disabled, the table rows are not sorted and the user cannot change the sorting.
+ * <p>
+ * Subclasses can override this method. Default is {@code true}.
+ *
+ * @return {@code true} if sort is enabled, {@code false} otherwise.
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(60)
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredSortEnabled() {
+ return true;
+ }
+
+ /**
+ * Configures whether the header row is visible. The header row contains the titles of each column.
+ * <p>
+ * Subclasses can override this method. Default is {@code true}.
+ *
+ * @return {@code true} if the header row is visible, {@code false} otherwise.
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(70)
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredHeaderVisible() {
+ return true;
+ }
+
+ /**
+ * Configures whether the columns are auto resized. If true, all columns are resized so that the table never needs
+ * horizontal scrolling. This is especially useful for tables inside a form.
+ * <p>
+ * Subclasses can override this method. Default is {@code true}.
+ *
+ * @return {@code true} if the columns are auto resized, {@code false} otherwise.
+ * @see {@link AbstractColumn#getConfiguredWidth()}
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(80)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredAutoResizeColumns() {
+ return false;
+ }
+
+ /**
+ * Configures whether the table supports multiline text. If multiline text is supported and a string column has set
+ * the {@link AbstractStringColumn#getConfiguredTextWrap()} property to true, the text is wrapped and uses two or more
+ * lines.
+ * <p>
+ * Subclasses can override this method. Default is {@code false}. If the method is not overridden and at least one
+ * string column has set the {@link AbstractStringColumn#getConfiguredTextWrap()} to true, the multiline property is
+ * set automatically to true.
+ *
+ * @return {@code true} if the table supports multiline text, {@code false} otherwise.
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(90)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredMultilineText() {
+ return false;
+ }
+
+ /**
+ * Configures the row height hint. This is a hint for the UI if and only if it is not capable of having variable table
+ * row height based on cell contents (such as rap/rwt).
+ * <p>
+ * This hint defines the table row height in pixels being used as the fixed row height for all table rows of this
+ * table.
+ * <p>
+ * Subclasses can override this method. Default is {@code -1}.
+ *
+ * @return Table row height hint in pixels.
+ */
+ @ConfigProperty(ConfigProperty.INTEGER)
+ @Order(92)
+ @ConfigPropertyValue("-1")
+ protected int getConfiguredRowHeightHint() {
+ return -1;
+ }
+
+ /**
+ * Configures whether the table is checkable.
+ * <p>
+ * Subclasses can override this method. Default is {@code false}.
+ *
+ * @return {@code true} if the table is checkable, {@code false} otherwise.
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(100)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredCheckable() {
+ return false;
+ }
+
+ /**
+ * Configures the checkable column. The checkable column represents the check state of the row, i.e. if it is checked
+ * or not. If no checkable column is configured, only the row itself represents if the row was checked or not.
+ * <p>
+ * Subclasses can override this method. Default is {@code null}.
+ *
+ * @return A column class extending {@link AbstractBooleanColumn} that represents the row check state.
+ */
+ @ConfigProperty(ConfigProperty.TABLE_COLUMN)
+ @Order(102)
+ @ConfigPropertyValue("false")
+ protected Class<? extends AbstractBooleanColumn> getConfiguredCheckableColumn() {
+ return null;
+ }
+
+ /**
+ * Configures the drop support of this table.
+ * <p>
+ * Subclasses can override this method. Default is {@code 0} (no drop support).
+ *
+ * @return {@code 0} for no support or one or more of {@link IDNDSupport#TYPE_FILE_TRANSFER},
+ * {@link IDNDSupport#TYPE_IMAGE_TRANSFER}, {@link IDNDSupport#TYPE_JAVA_ELEMENT_TRANSFER} or
+ * {@link IDNDSupport#TYPE_TEXT_TRANSFER} (e.g. {@code TYPE_TEXT_TRANSFER | TYPE_FILE_TRANSFER}).
+ */
+ @ConfigProperty(ConfigProperty.DRAG_AND_DROP_TYPE)
+ @Order(190)
+ @ConfigPropertyValue("0")
+ protected int getConfiguredDropType() {
+ return 0;
+ }
+
+ /**
+ * Configures the drag support of this table.
+ * <p>
+ * Subclasses can override this method. Default is {@code 0} (no drag support).
+ *
+ * @return {@code 0} for no support or one or more of {@link IDNDSupport#TYPE_FILE_TRANSFER},
+ * {@link IDNDSupport#TYPE_IMAGE_TRANSFER}, {@link IDNDSupport#TYPE_JAVA_ELEMENT_TRANSFER} or
+ * {@link IDNDSupport#TYPE_TEXT_TRANSFER} (e.g. {@code TYPE_TEXT_TRANSFER | TYPE_FILE_TRANSFER}).
+ */
+ @ConfigProperty(ConfigProperty.DRAG_AND_DROP_TYPE)
+ @Order(190)
+ @ConfigPropertyValue("0")
+ protected int getConfiguredDragType() {
+ return 0;
+ }
+
+ /**
+ * Configures whether the keyboard can be used for navigation in table. When activated, the user can click on a column
+ * in the table. Now starting to type some letters, the row matching the typed letters in the column will be selected.
+ * <p>
+ * Subclasses can override this method. Default is {@code true}.
+ *
+ * @return {@code true} if the keyboard navigation is supported, {@code false} otherwise.
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(200)
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredKeyboardNavigation() {
+ return true;
+ }
+
+ /**
+ * Configures whether the table always scrolls to the selection. When activated and the selection in a table changes,
+ * the table is scrolled to the selection so that the selected row is visible.
+ * <p>
+ * Subclasses can override this method. Default is {@code false}.
+ *
+ * @return {@code true} if the table scrolls to the selection, {@code false} otherwise.
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(230)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredScrollToSelection() {
+ return false;
+ }
+
+ /**
+ * Called after a drag operation was executed on one or several table rows.
+ * <p>
+ * Subclasses can override this method. The default does nothing.
+ *
+ * @param rows
+ * Table rows that were dragged.
+ * @return A transferable object representing the given rows.
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(10)
+ protected TransferObject execDrag(ITableRow[] rows) throws ProcessingException {
+ return null;
+ }
+
+ /**
+ * Called after a drop operation was executed on the table.
+ * <p>
+ * Subclasses can override this method. The default does nothing.
+ *
+ * @param row
+ * Table row on which the transferable object was dropped (row may be null for empty space drop).
+ * @param t
+ * Transferable object that was dropped on the row.
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(20)
+ protected void execDrop(ITableRow row, TransferObject t) throws ProcessingException {
+ }
+
+ /**
+ * Called by a <code>CTRL-C</code> event on the table to copy the given rows into the clipboard.
+ * <p>
+ * Subclasses can override this method. The default creates a {@link TextTransferObject} of the table content (HTML
+ * table).
+ *
+ * @param rows
+ * The selected table rows to copy.
+ * @return A transferable object representing the given rows or null to not populate the clipboard.
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(30)
+ protected TransferObject execCopy(ITableRow[] rows) throws ProcessingException {
+ if (rows.length == 0) {
+ return null;
+ }
+
+ StringBuilder plainText = new StringBuilder();
+ StringBuilder htmlText = new StringBuilder("<html>");
+ // Adding the following MS-office specific style information will cause Excel
+ // to put all line-break-delimited entries of a <td> cell into a single Excel cell,
+ // instead of one sub-cell for each <br />
+ htmlText.append("<head><style type=\"text/css\"> br {mso-data-placement:same-cell;} </style></head>");
+ htmlText.append("<body><table border=\"0\">");
+
+ IColumn<?>[] columns = getColumnSet().getVisibleColumns();
+ Pattern patternHtmlCheck = Pattern.compile(".*?<\\s*html.*?>.*", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL);
+ Pattern patternBodyContent = Pattern.compile("<\\s*body.*?>(.*?)<\\s*/\\s*body\\s*>", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL);
+
+ boolean firstRow = true;
+ for (ITableRow row : rows) {
+ // text/html
+ htmlText.append("<tr>");
+ // text/plain
+ if (!firstRow) {
+ plainText.append(System.getProperty("line.separator"));
+ }
+
+ boolean firstColumn = true;
+ for (IColumn<?> column : columns) {
+ String text;
+ if (column instanceof IBooleanColumn) {
+ boolean value = BooleanUtility.nvl(((IBooleanColumn) column).getValue(row), false);
+ text = value ? "X" : "";
+ }
+ else {
+ text = StringUtility.emptyIfNull(row.getCell(column).getText());
+ }
+
+ // text/plain
+ if (!firstColumn) {
+ plainText.append("\t");
+ }
+ plainText.append(StringUtility.emptyIfNull(StringUtility.unwrapText(text)));
+
+ // text/html
+ String html = null;
+ if (patternHtmlCheck.matcher(text).matches()) {
+ // ensure proper HTML and extract body content
+ Matcher matcher = patternBodyContent.matcher(HTMLUtility.cleanupHtml(text, false, false, null));
+ if (matcher.find()) {
+ html = matcher.group(1);
+ }
+ }
+ if (html == null) {
+ html = StringUtility.htmlEncode(text);
+ }
+ htmlText.append("<td>");
+ htmlText.append(html);
+ htmlText.append("</td>");
+ firstColumn = false;
+ }
+ htmlText.append("</tr>");
+ firstRow = false;
+ }
+ htmlText.append("</table></body></html>");
+
+ TextTransferObject transferObject = new TextTransferObject(plainText.toString(), htmlText.toString());
+ return transferObject;
+ }
+
+ /**
+ * Called after the table content changed, rows were added, removed or changed.
+ * <p>
+ * Subclasses can override this method. The default does nothing.
+ *
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(40)
+ protected void execContentChanged() throws ProcessingException {
+ }
+
+ /**
+ * Called after {@link AbstractColumn#execDecorateCell(Cell,ITableRow)} on the column to decorate the cell.
+ * <p>
+ * Subclasses can override this method. The default does nothing.
+ *
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(50)
+ protected void execDecorateCell(Cell view, ITableRow row, IColumn<?> col) throws ProcessingException {
+ }
+
+ /**
+ * Called during initialization of this table, after the columns were initialized.
+ * <p>
+ * Subclasses can override this method. The default does nothing.
+ *
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(60)
+ protected void execInitTable() throws ProcessingException {
+ }
+
+ /**
+ * Called when this table is disposed, after the columns were disposed.
+ * <p>
+ * Subclasses can override this method. The default does nothing.
+ *
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(70)
+ protected void execDisposeTable() throws ProcessingException {
+ }
+
+ /**
+ * Called when the user clicks on a row in this table.
+ * <p>
+ * Subclasses can override this method. The default fires a {@link TableEvent#TYPE_ROW_CLICK} event.
+ *
+ * @param Row
+ * that was clicked (never null).
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(80)
+ protected void execRowClick(ITableRow row) throws ProcessingException {
+ TableEvent e = new TableEvent(this, TableEvent.TYPE_ROW_CLICK, new ITableRow[]{row});
+ fireTableEventInternal(e);
+ }
+
+ /**
+ * Called when the row has been activated.
+ * <p>
+ * Subclasses can override this method. The default opens the configured default menu or if no default menu is
+ * configured, fires a {@link TableEvent#TYPE_ROW_ACTION} event.
+ *
+ * @param Row
+ * that was activated (never null).
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(90)
+ protected void execRowAction(ITableRow row) throws ProcessingException {
+ Class<? extends IMenu> defaultMenuType = getDefaultMenuInternal();
+ if (defaultMenuType != null) {
+ try {
+ runMenu(defaultMenuType);
+ }
+ catch (ProcessingException ex) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(ex);
+ }
+ catch (Throwable t) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Unexpected", t));
+ }
+ }
+ else {
+ TableEvent e = new TableEvent(this, TableEvent.TYPE_ROW_ACTION, new ITableRow[]{row});
+ fireTableEventInternal(e);
+ }
+ }
+
+ /**
+ * Called when one or more rows are selected.
+ * <p>
+ * Subclasses can override this method. The default does nothing.
+ *
+ * @param rows
+ * that were selected.
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(100)
+ protected void execRowsSelected(ITableRow[] rows) throws ProcessingException {
+ }
+
+ /**
+ * Called when the row is going to be decorated.
+ * <p>
+ * Subclasses can override this method. The default does nothing.
+ *
+ * @param row
+ * that is going to be decorated.
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(110)
+ protected void execDecorateRow(ITableRow row) throws ProcessingException {
+ }
+
+ /**
+ * Called when a hyperlink is used within the table. The hyperlink's table row is the selected row and the column is
+ * the context column ({@link #getContextColumn()}).
+ * <p>
+ * Subclasses can override this method. The default does nothing.
+ *
+ * @param url
+ * Hyperlink to process.
+ * @param path
+ * Path of URL ({@link URL#getPath()}).
+ * @param local
+ * {@code true} if the url is not a valid external url but a local model url (http://local/...)
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(120)
+ protected void execHyperlinkAction(URL url, String path, boolean local) throws ProcessingException {
+ }
+
+ private Class<? extends IMenu>[] getConfiguredMenus() {
+ Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
+ return ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, IMenu.class);
+ }
+
+ private Class<? extends IColumn>[] getConfiguredColumns() {
+ Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
+ return ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, IColumn.class);
+ }
+
+ private Class<? extends IKeyStroke>[] getConfiguredKeyStrokes() {
+ Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
+ return ConfigurationUtility.filterClasses(dca, IKeyStroke.class);
+ }
+
+ protected void initConfig() {
+ m_eventHistory = createEventHistory();
+ m_uiFacade = createUIFacade();
+ setTitle(getConfiguredTitle());
+ setAutoDiscardOnDelete(getConfiguredAutoDiscardOnDelete());
+ setSortEnabled(getConfiguredSortEnabled());
+ setDefaultIconId(getConfiguredDefaultIconId());
+ setHeaderVisible(getConfiguredHeaderVisible());
+ setAutoResizeColumns(getConfiguredAutoResizeColumns());
+ setCheckable(getConfiguredCheckable());
+ setMultiCheck(getConfiguredMultiCheck());
+ setMultiSelect(getConfiguredMultiSelect());
+ setInitialMultilineText(getConfiguredMultilineText());
+ setMultilineText(getConfiguredMultilineText());
+ setRowHeightHint(getConfiguredRowHeightHint());
+ setKeyboardNavigation(getConfiguredKeyboardNavigation());
+ setDragType(getConfiguredDragType());
+ setDropType(getConfiguredDropType());
+ setScrollToSelection(getConfiguredScrollToSelection());
+ if (getTableCustomizer() == null) {
+ setTableCustomizer(createTableCustomizer());
+ }
+ // columns
+ createColumnsInternal();
+ // menus
+ ArrayList<IMenu> menuList = new ArrayList<IMenu>();
+ Class<? extends IMenu>[] ma = getConfiguredMenus();
+ for (int i = 0; i < ma.length; i++) {
+ try {
+ IMenu menu = ConfigurationUtility.newInnerInstance(this, ma[i]);
+ menuList.add(menu);
+ }
+ catch (Throwable t) {
+ LOG.error("create " + ma[i].getName(), t);
+ }
+ }
+
+ try {
+ injectMenusInternal(menuList);
+ }
+ catch (Exception e) {
+ LOG.error("error occured while dynamically contributing menus.", e);
+ }
+ m_menus = menuList.toArray(new IMenu[0]);
+ // key strokes
+ ArrayList<IKeyStroke> ksList = new ArrayList<IKeyStroke>();
+ Class<? extends IKeyStroke>[] ksArray = getConfiguredKeyStrokes();
+ for (int i = 0; i < ksArray.length; i++) {
+ try {
+ IKeyStroke ks = ConfigurationUtility.newInnerInstance(this, ksArray[i]);
+ ksList.add(ks);
+ }
+ catch (Throwable t) {
+ LOG.error("create " + ksArray[i].getName(), t);
+ }
+ }
+ //add ENTER key stroke when default menu is used or execRowAction has an override
+ Class<? extends IMenu> defaultMenuType = getDefaultMenuInternal();
+ if (defaultMenuType != null || ConfigurationUtility.isMethodOverwrite(AbstractTable.class, "execRowAction", new Class[]{ITableRow.class}, this.getClass())) {
+ ksList.add(new KeyStroke("ENTER") {
+ @Override
+ protected void execAction() throws ProcessingException {
+ fireRowAction(getSelectedRow());
+ }
+ });
+ }
+ setKeyStrokes(ksList.toArray(new IKeyStroke[ksList.size()]));
+ // add Convenience observer for drag & drop callbacks and event history
+ addTableListener(new TableAdapter() {
+ @Override
+ public void tableChanged(TableEvent e) {
+ //event history
+ IEventHistory<TableEvent> h = getEventHistory();
+ if (h != null) {
+ h.notifyEvent(e);
+ }
+ //dnd
+ switch (e.getType()) {
+ case TableEvent.TYPE_ROWS_DRAG_REQUEST: {
+ if (e.getDragObject() == null) {
+ try {
+ e.setDragObject(execDrag(e.getRows()));
+ }
+ catch (ProcessingException ex) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(ex);
+ }
+ }
+ break;
+ }
+ case TableEvent.TYPE_ROW_DROP_ACTION: {
+ if (e.getDropObject() != null) {
+ try {
+ execDrop(e.getFirstRow(), e.getDropObject());
+ }
+ catch (ProcessingException ex) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(ex);
+ }
+ }
+ break;
+ }
+ case TableEvent.TYPE_ROWS_COPY_REQUEST: {
+ if (e.getCopyObject() == null) {
+ try {
+ e.setCopyObject(execCopy(e.getRows()));
+ }
+ catch (ProcessingException ex) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(ex);
+ }
+ }
+ break;
+ }
+ case TableEvent.TYPE_ALL_ROWS_DELETED:
+ case TableEvent.TYPE_ROWS_DELETED:
+ case TableEvent.TYPE_ROWS_INSERTED:
+ case TableEvent.TYPE_ROWS_UPDATED: {
+ try {
+ execContentChanged();
+ }
+ catch (ProcessingException ex) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(ex);
+ }
+ break;
+ }
+ }
+ }
+ });
+ }
+
+ private void initColumnsInternal() {
+ for (IColumn<?> c : getColumnSet().getColumns()) {
+ try {
+ c.initColumn();
+ }
+ catch (Throwable t) {
+ LOG.error("column " + c, t);
+ }
+ }
+ getColumnSet().initialize();
+ }
+
+ private void disposeColumnsInternal() {
+ for (IColumn<?> c : getColumnSet().getColumns()) {
+ try {
+ c.disposeColumn();
+ }
+ catch (Throwable t) {
+ LOG.error("column " + c, t);
+ }
+ }
+ }
+
+ private void createColumnsInternal() {
+ Class<? extends IColumn>[] ca = getConfiguredColumns();
+ ArrayList<IColumn<?>> colList = new ArrayList<IColumn<?>>();
+ for (int i = 0; i < ca.length; i++) {
+ try {
+ IColumn<?> column = ConfigurationUtility.newInnerInstance(this, ca[i]);
+ colList.add(column);
+ }
+ catch (Exception e) {
+ LOG.warn(null, e);
+ }
+ }
+ try {
+ injectColumnsInternal(colList);
+ }
+ catch (Exception e) {
+ LOG.error("error occured while dynamically contribute columns.", e);
+ }
+ ArrayList<IColumn> completeList = new ArrayList<IColumn>();
+ completeList.addAll(colList);
+ m_columnSet = new ColumnSet(this, completeList);
+ if (getConfiguredCheckableColumn() != null) {
+ AbstractBooleanColumn checkableColumn = getColumnSet().getColumnByClass(getConfiguredCheckableColumn());
+ setCheckableColumn(checkableColumn);
+ }
+ }
+
+ /**
+ * Override this internal method only in order to make use of dynamic fields<br>
+ * Used to manage column list and add/remove columns
+ *
+ * @param columnList
+ * live and mutable list of configured columns, not yet initialized
+ */
+ protected void injectColumnsInternal(List<IColumn<?>> columnList) {
+ ITableCustomizer c = getTableCustomizer();
+ if (c != null) {
+ c.injectCustomColumns(columnList);
+ }
+ }
+
+ /**
+ * Override this internal method only in order to make use of dynamic menus<br>
+ * Used to manage menu list and add/remove menus
+ *
+ * @param menuList
+ * live and mutable list of configured menus
+ */
+ protected void injectMenusInternal(List<IMenu> menuList) {
+ }
+
+ protected ITableUIFacade createUIFacade() {
+ return new P_TableUIFacade();
+ }
+
+ /*
+ * Runtime
+ */
+
+ @Override
+ public String getUserPreferenceContext() {
+ return m_userPreferenceContext;
+ }
+
+ @Override
+ public void setUserPreferenceContext(String context) {
+ m_userPreferenceContext = context;
+ if (isTableInitialized()) {
+ //re-initialize
+ try {
+ initTable();
+ }
+ catch (ProcessingException e) {
+ LOG.error("Failed re-initializing table " + getClass().getName(), e);
+ }
+ }
+ }
+
+ /**
+ * This is the init of the runtime model after the table and columns are built
+ * and configured
+ */
+ @Override
+ public final void initTable() throws ProcessingException {
+ try {
+ if (m_initLock.acquire()) {
+ try {
+ setTableChanging(true);
+ //
+ initTableInternal();
+ execInitTable();
+ }
+ finally {
+ setTableChanging(false);
+ }
+ }
+ }
+ finally {
+ m_initialized = true;
+ m_initLock.release();
+ }
+ }
+
+ protected void initTableInternal() throws ProcessingException {
+ initColumnsInternal();
+ if (getColumnFilterManager() == null) {
+ setColumnFilterManager(createColumnFilterManager());
+ }
+ }
+
+ @Override
+ public final void disposeTable() {
+ try {
+ disposeTableInternal();
+ execDisposeTable();
+ }
+ catch (Throwable t) {
+ LOG.warn(getClass().getName(), t);
+ }
+ }
+
+ protected void disposeTableInternal() throws ProcessingException {
+ disposeColumnsInternal();
+ }
+
+ @Override
+ public void doHyperlinkAction(ITableRow row, IColumn<?> col, URL url) throws ProcessingException {
+ if (!m_actionRunning) {
+ try {
+ m_actionRunning = true;
+ if (row != null) {
+ selectRow(row);
+ }
+ if (col != null) {
+ setContextColumn(col);
+ }
+ execHyperlinkAction(url, url.getPath(), url != null && url.getHost().equals(LOCAL_URL_HOST));
+ }
+ finally {
+ m_actionRunning = false;
+ }
+ }
+ }
+
+ @Override
+ public ITableRowFilter[] getRowFilters() {
+ return m_rowFilters.toArray(new ITableRowFilter[m_rowFilters.size()]);
+ }
+
+ @Override
+ public void addRowFilter(ITableRowFilter filter) {
+ if (filter != null) {
+ //avoid duplicate add
+ boolean exists = false;
+ for (ITableRowFilter existingFilter : m_rowFilters) {
+ if (existingFilter == filter) {
+ exists = true;
+ break;
+ }
+ }
+ if (!exists) {
+ m_rowFilters.add(filter);
+ }
+ applyRowFilters();
+ }
+ }
+
+ @Override
+ public void removeRowFilter(ITableRowFilter filter) {
+ if (filter != null) {
+ m_rowFilters.remove(filter);
+ applyRowFilters();
+ }
+ }
+
+ @Override
+ public void applyRowFilters() {
+ applyRowFiltersInternal();
+ fireRowFilterChanged();
+ }
+
+ private void applyRowFiltersInternal() {
+ for (ITableRow row : m_rows) {
+ applyRowFiltersInternal((InternalTableRow) row);
+ }
+ }
+
+ private void applyRowFiltersInternal(InternalTableRow row) {
+ row.setFilterAcceptedInternal(true);
+ if (m_rowFilters.size() > 0) {
+ for (ITableRowFilter filter : m_rowFilters) {
+ if (!filter.accept(row)) {
+ row.setFilterAcceptedInternal(false);
+ /*
+ * ticket 95770
+ */
+ if (isSelectedRow(row)) {
+ deselectRow(row);
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ @Override
+ public String getTitle() {
+ return propertySupport.getPropertyString(PROP_TITLE);
+ }
+
+ @Override
+ public void setTitle(String s) {
+ propertySupport.setPropertyString(PROP_TITLE, s);
+ }
+
+ @Override
+ public boolean isAutoResizeColumns() {
+ return propertySupport.getPropertyBool(PROP_AUTO_RESIZE_COLUMNS);
+ }
+
+ @Override
+ public void setAutoResizeColumns(boolean b) {
+ propertySupport.setPropertyBool(PROP_AUTO_RESIZE_COLUMNS, b);
+ }
+
+ @Override
+ public ColumnSet getColumnSet() {
+ return m_columnSet;
+ }
+
+ @Override
+ public int getColumnCount() {
+ return getColumnSet().getColumnCount();
+ }
+
+ @Override
+ public IColumn<?>[] getColumns() {
+ return getColumnSet().getColumns();
+ }
+
+ @Override
+ public String[] getColumnNames() {
+ String[] a = new String[getColumnCount()];
+ for (int i = 0; i < a.length; i++) {
+ a[i] = getColumnSet().getColumn(i).getHeaderCell().getText();
+ }
+ return a;
+ }
+
+ @Override
+ public int getVisibleColumnCount() {
+ return getColumnSet().getVisibleColumnCount();
+ }
+
+ @Override
+ public IHeaderCell getVisibleHeaderCell(int visibleColumnIndex) {
+ return getHeaderCell(getColumnSet().getVisibleColumn(visibleColumnIndex));
+ }
+
+ @Override
+ public IHeaderCell getHeaderCell(int columnIndex) {
+ return getHeaderCell(getColumnSet().getColumn(columnIndex));
+ }
+
+ @Override
+ public IHeaderCell getHeaderCell(IColumn<?> col) {
+ return col.getHeaderCell();
+ }
+
+ @Override
+ public ICell getVisibleCell(int rowIndex, int visibleColumnIndex) {
+ return getVisibleCell(getRow(rowIndex), visibleColumnIndex);
+ }
+
+ @Override
+ public ICell getVisibleCell(ITableRow row, int visibleColumnIndex) {
+ return getCell(row, getColumnSet().getVisibleColumn(visibleColumnIndex));
+ }
+
+ @Override
+ public ICell getCell(int rowIndex, int columnIndex) {
+ return getCell(getRow(rowIndex), getColumnSet().getColumn(columnIndex));
+ }
+
+ @Override
+ public ICell getSummaryCell(int rowIndex) {
+ return getSummaryCell(getRow(rowIndex));
+ }
+
+ @Override
+ public ICell getSummaryCell(ITableRow row) {
+ IColumn<?>[] a = getColumnSet().getSummaryColumns();
+ if (a.length == 0) {
+ IColumn<?> col = getColumnSet().getFirstDefinedVisibileColumn();
+ if (col != null) {
+ a = new IColumn<?>[]{col};
+ }
+ }
+ if (a.length == 0) {
+ return new Cell();
+ }
+ else if (a.length == 1) {
+ Cell cell = new Cell(getCell(row, a[0]));
+ if (cell.getIconId() == null) {
+ // use icon of row
+ cell.setIconId(row.getIconId());
+ }
+ return cell;
+ }
+ else {
+ Cell cell = new Cell(getCell(row, a[0]));
+ if (cell.getIconId() == null) {
+ // use icon of row
+ cell.setIconId(row.getIconId());
+ }
+ StringBuilder b = new StringBuilder();
+ for (IColumn<?> c : a) {
+ if (b.length() > 0) {
+ b.append(" ");
+ }
+ b.append(getCell(row, c).getText());
+ }
+ cell.setText(b.toString());
+ return cell;
+ }
+ }
+
+ @Override
+ public ICell getCell(ITableRow row, IColumn<?> col) {
+ row = resolveRow(row);
+ if (row == null || col == null) {
+ return null;
+ }
+ return row.getCell(col.getColumnIndex());
+ }
+
+ /**
+ * Note that this is not a java bean method and thus not thread-safe
+ */
+ @Override
+ public boolean isCellEditable(int rowIndex, int columnIndex) {
+ return isCellEditable(getRow(rowIndex), getColumnSet().getColumn(columnIndex));
+ }
+
+ /**
+ * Note that this is not a java bean method and thus not thread-safe
+ */
+ @Override
+ public boolean isCellEditable(ITableRow row, int visibleColumnIndex) {
+ return isCellEditable(row, getColumnSet().getVisibleColumn(visibleColumnIndex));
+ }
+
+ /**
+ * Note that this is not a java bean method and thus not thread-safe
+ */
+ @Override
+ public boolean isCellEditable(ITableRow row, IColumn<?> column) {
+ return row != null && column != null && column.isVisible() && column.isCellEditable(row);
+ }
+
+ @Override
+ public Object getProperty(String name) {
+ return propertySupport.getProperty(name);
+ }
+
+ @Override
+ public void setProperty(String name, Object value) {
+ propertySupport.setProperty(name, value);
+ }
+
+ @Override
+ public boolean hasProperty(String name) {
+ return propertySupport.hasProperty(name);
+ }
+
+ @Override
+ public boolean isCheckable() {
+ return propertySupport.getPropertyBool(PROP_CHECKABLE);
+ }
+
+ @Override
+ public void setCheckable(boolean b) {
+ propertySupport.setPropertyBool(PROP_CHECKABLE, b);
+ }
+
+ @Override
+ public void setDragType(int dragType) {
+ propertySupport.setPropertyInt(PROP_DRAG_TYPE, dragType);
+ }
+
+ @Override
+ public int getDragType() {
+ return propertySupport.getPropertyInt(PROP_DRAG_TYPE);
+ }
+
+ @Override
+ public void setDropType(int dropType) {
+ propertySupport.setPropertyInt(PROP_DROP_TYPE, dropType);
+ }
+
+ @Override
+ public int getDropType() {
+ return propertySupport.getPropertyInt(PROP_DROP_TYPE);
+ }
+
+ @Override
+ public boolean isMultilineText() {
+ return propertySupport.getPropertyBool(PROP_MULTILINE_TEXT);
+ }
+
+ @Override
+ public void setMultilineText(boolean on) {
+ propertySupport.setPropertyBool(PROP_MULTILINE_TEXT, on);
+ }
+
+ @Override
+ public int getRowHeightHint() {
+ return propertySupport.getPropertyInt(PROP_ROW_HEIGHT_HINT);
+ }
+
+ @Override
+ public void setRowHeightHint(int h) {
+ propertySupport.setPropertyInt(PROP_ROW_HEIGHT_HINT, h);
+ }
+
+ @Override
+ public boolean isInitialMultilineText() {
+ return m_initialMultiLineText;
+ }
+
+ @Override
+ public void setInitialMultilineText(boolean on) {
+ m_initialMultiLineText = on;
+ }
+
+ @Override
+ public boolean hasKeyboardNavigation() {
+ return propertySupport.getPropertyBool(PROP_KEYBOARD_NAVIGATION);
+ }
+
+ @Override
+ public void setKeyboardNavigation(boolean on) {
+ propertySupport.setPropertyBool(PROP_KEYBOARD_NAVIGATION, on);
+ }
+
+ @Override
+ public boolean isMultiSelect() {
+ return propertySupport.getPropertyBool(PROP_MULTI_SELECT);
+ }
+
+ @Override
+ public void setMultiSelect(boolean b) {
+ propertySupport.setPropertyBool(PROP_MULTI_SELECT, b);
+ }
+
+ @Override
+ public boolean isMultiCheck() {
+ return propertySupport.getPropertyBool(PROP_MULTI_CHECK);
+ }
+
+ @Override
+ public void setMultiCheck(boolean b) {
+ propertySupport.setPropertyBool(PROP_MULTI_CHECK, b);
+ }
+
+ @Override
+ public IBooleanColumn getCheckableColumn() {
+ return m_checkableColumn;
+ }
+
+ @Override
+ public void setCheckableColumn(IBooleanColumn checkableColumn) {
+ m_checkableColumn = checkableColumn;
+ }
+
+ @Override
+ public boolean isAutoDiscardOnDelete() {
+ return m_autoDiscardOnDelete;
+ }
+
+ @Override
+ public void setAutoDiscardOnDelete(boolean on) {
+ m_autoDiscardOnDelete = on;
+ }
+
+ @Override
+ public boolean isTableInitialized() {
+ return m_initialized;
+ }
+
+ @Override
+ public boolean isTableChanging() {
+ return m_tableChanging > 0;
+ }
+
+ @Override
+ public void setTableChanging(boolean b) {
+ // use a stack counter because setTableChanging might be called in nested
+ // loops
+ if (b) {
+ m_tableChanging++;
+ if (m_tableChanging == 1) {
+ // 0 --> 1
+ propertySupport.setPropertiesChanging(true);
+ }
+ }
+ else {
+ // all calls to further methods are wrapped into a try-catch block so that the change counters are adjusted correctly
+ if (m_tableChanging > 0) {
+ Throwable saveEx = null;
+ if (m_tableChanging == 1) {
+ try {
+ //will be going to zero, but process decorations here, so events are added to the event buffer
+ processDecorationBuffer();
+ if (!m_sortValid) {
+ sort();
+ }
+ }
+ catch (Throwable t) {
+ saveEx = t;
+ }
+ }
+ m_tableChanging--;
+ if (m_tableChanging == 0) {
+ try {
+ processEventBuffer();
+ }
+ catch (Throwable t) {
+ if (saveEx == null) {
+ saveEx = t;
+ }
+ }
+ try {
+ propertySupport.setPropertiesChanging(false);
+ }
+ catch (Throwable t) {
+ if (saveEx == null) {
+ saveEx = t;
+ }
+ }
+ }
+ if (saveEx == null) {
+ return;
+ }
+ else if (saveEx instanceof RuntimeException) {
+ throw (RuntimeException) saveEx;
+ }
+ else if (saveEx instanceof Error) {
+ throw (Error) saveEx;
+ }
+ }
+ }
+ }
+
+ @Override
+ public IKeyStroke[] getKeyStrokes() {
+ IKeyStroke[] keyStrokes = (IKeyStroke[]) propertySupport.getProperty(PROP_KEY_STROKES);
+ if (keyStrokes == null) {
+ keyStrokes = new IKeyStroke[0];
+ }
+ return keyStrokes;
+ }
+
+ @Override
+ public void setKeyStrokes(IKeyStroke[] keyStrokes) {
+ propertySupport.setProperty(PROP_KEY_STROKES, keyStrokes);
+ }
+
+ @Override
+ public void requestFocus() {
+ fireRequestFocus();
+ }
+
+ @Override
+ public void requestFocusInCell(IColumn<?> column, ITableRow row) {
+ if (isCellEditable(row, column)) {
+ fireRequestFocusInCell(column, row);
+ }
+ }
+
+ @Override
+ public void extractTableData(AbstractTableFieldData target) throws ProcessingException {
+ for (int i = 0, ni = getRowCount(); i < ni; i++) {
+ ITableRow row = getRow(i);
+ int newRowIndex = target.addRow();
+ for (int j = 0, nj = row.getCellCount(); j < nj; j++) {
+ target.setValueAt(newRowIndex, j, row.getCellValue(j));
+ }
+ target.setRowState(newRowIndex, row.getStatus());
+ }
+ ITableRow[] deletedRows = getDeletedRows();
+ for (int i = 0, ni = deletedRows.length; i < ni; i++) {
+ ITableRow row = deletedRows[i];
+ int newRowIndex = target.addRow();
+ for (int j = 0, nj = row.getCellCount(); j < nj; j++) {
+ target.setValueAt(newRowIndex, j, row.getCellValue(j));
+ }
+ target.setRowState(newRowIndex, AbstractTableFieldData.STATUS_DELETED);
+ }
+ target.setValueSet(true);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public void updateTable(AbstractTableFieldData source) throws ProcessingException {
+ if (source.isValueSet()) {
+ clearDeletedRows();
+ int deleteCount = 0;
+ ArrayList<ITableRow> newRows = new ArrayList<ITableRow>();
+ for (int i = 0, ni = source.getRowCount(); i < ni; i++) {
+ int importState = source.getRowState(i);
+ if (importState != AbstractTableFieldData.STATUS_DELETED) {
+ ITableRow newTableRow = new TableRow(getColumnSet());
+ for (int j = 0, nj = source.getColumnCount(); j < nj; j++) {
+ if (j < getColumnCount()) {
+ getColumnSet().getColumn(j).setValue(newTableRow, source.getValueAt(i, j));
+ }
+ else {
+ newTableRow.setCellValue(j, source.getValueAt(i, j));
+ }
+ }
+ newTableRow.setStatus(importState);
+ newRows.add(newTableRow);
+ }
+ else {
+ deleteCount++;
+ }
+ }
+ replaceRows(newRows.toArray(new ITableRow[newRows.size()]));
+ if (deleteCount > 0) {
+ try {
+ setTableChanging(true);
+ //
+ for (int i = 0, ni = source.getRowCount(); i < ni; i++) {
+ int importState = source.getRowState(i);
+ if (importState == AbstractTableFieldData.STATUS_DELETED) {
+ ITableRow newTableRow = new TableRow(getColumnSet());
+ for (int j = 0, nj = source.getColumnCount(); j < nj; j++) {
+ if (j < getColumnCount()) {
+ getColumnSet().getColumn(j).setValue(newTableRow, source.getValueAt(i, j));
+ }
+ else {
+ newTableRow.setCellValue(j, source.getValueAt(i, j));
+ }
+ }
+ newTableRow.setStatus(ITableRow.STATUS_NON_CHANGED);
+ ITableRow addedRow = addRow(newTableRow);
+ deleteRow(addedRow);
+ }
+ }
+ }
+ finally {
+ setTableChanging(false);
+ }
+ }
+ }
+ }
+
+ @Override
+ public IMenu[] getMenus() {
+ return m_menus;
+ }
+
+ @Override
+ public <T extends IMenu> T getMenu(Class<T> menuType) throws ProcessingException {
+ return new ActionFinder().findAction(getMenus(), menuType);
+ }
+
+ @Override
+ public boolean runMenu(Class<? extends IMenu> menuType) throws ProcessingException {
+ for (IMenu m : getMenus()) {
+ if (m.getClass() == menuType) {
+ if ((!m.isInheritAccessibility()) || isEnabled()) {
+ m.prepareAction();
+ if (m.isVisible() && m.isEnabled()) {
+ m.doAction();
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * factory to manage table column filters
+ * <p>
+ * default creates a {@link DefaultTableColumnFilterManager}
+ */
+ protected ITableColumnFilterManager createColumnFilterManager() {
+ return new DefaultTableColumnFilterManager(this);
+ }
+
+ /**
+ * factory to manage custom columns
+ * <p>
+ * default creates null
+ */
+ protected ITableCustomizer createTableCustomizer() {
+ return null;
+ }
+
+ /*
+ * Row handling methods. Operate on a Row instance.
+ */
+
+ public ITableRow createRow() throws ProcessingException {
+ return new P_TableRowBuilder().createRow();
+ }
+
+ public ITableRow createRow(Object rowValues) throws ProcessingException {
+ return new P_TableRowBuilder().createRow(rowValues);
+ }
+
+ public ITableRow[] createRowsByArray(Object dataArray) throws ProcessingException {
+ return new P_TableRowBuilder().createRowsByArray(dataArray);
+ }
+
+ public ITableRow[] createRowsByArray(Object dataArray, int rowStatus) throws ProcessingException {
+ return new P_TableRowBuilder().createRowsByArray(dataArray, rowStatus);
+ }
+
+ /**
+ * Performance note:<br>
+ * Since the matrix may contain large amount of data, the Object[][] can be passed as new
+ * AtomicReference<Object>(Object[][])
+ * so that the further processing can set the content of the holder to null while processing.
+ */
+ public ITableRow[] createRowsByMatrix(Object dataMatrixOrReference) throws ProcessingException {
+ return new P_TableRowBuilder().createRowsByMatrix(dataMatrixOrReference);
+ }
+
+ /**
+ * Performance note:<br>
+ * Since the matrix may contain large amount of data, the Object[][] can be passed as new
+ * AtomicReference<Object>(Object[][])
+ * so that the further processing can set the content of the holder to null while processing.
+ */
+ public ITableRow[] createRowsByMatrix(Object dataMatrixOrReference, int rowStatus) throws ProcessingException {
+ return new P_TableRowBuilder().createRowsByMatrix(dataMatrixOrReference, rowStatus);
+ }
+
+ public ITableRow[] createRowsByCodes(ICode[] codes) throws ProcessingException {
+ return new P_TableRowBuilder().createRowsByCodes(codes);
+ }
+
+ /**
+ * Performance note:<br>
+ * Since the matrix may contain large amount of data, the Object[][] can be passed as new
+ * AtomicReference<Object>(Object[][])
+ * so that the further processing can set the content of the holder to null while processing.
+ */
+ @Override
+ public void replaceRowsByMatrix(Object dataMatrixOrReference) throws ProcessingException {
+ replaceRows(createRowsByMatrix(dataMatrixOrReference));
+ }
+
+ @Override
+ public void replaceRowsByArray(Object dataArray) throws ProcessingException {
+ replaceRows(createRowsByArray(dataArray));
+ }
+
+ @Override
+ public void replaceRows(ITableRow[] newRows) throws ProcessingException {
+ /*
+ * There are two ways to replace: (1) Completely replace all rows by
+ * discarding all rows and adding new rows when - autoDiscardOnDelete=true
+ * (2) Replace rows by applying insert/update/delete on existing rows by
+ * primary key match when - autoDiscardOnDelete=false
+ */
+ if (isAutoDiscardOnDelete()) {
+ replaceRowsCase1(newRows);
+ }
+ else {
+ replaceRowsCase2(newRows);
+ }
+ }
+
+ private void replaceRowsCase1(ITableRow[] newRows) throws ProcessingException {
+ try {
+ setTableChanging(true);
+ //
+ ArrayList<CompositeObject> selectedKeys = new ArrayList<CompositeObject>();
+ for (ITableRow r : getSelectedRows()) {
+ selectedKeys.add(new CompositeObject(getRowKeys(r)));
+ }
+ discardAllRows();
+ addRows(newRows, false);
+ // restore selection
+ ArrayList<ITableRow> selectedRows = new ArrayList<ITableRow>();
+ if (selectedKeys.size() > 0) {
+ for (ITableRow r : m_rows) {
+ if (selectedKeys.remove(new CompositeObject(getRowKeys(r)))) {
+ selectedRows.add(r);
+ if (selectedKeys.size() == 0) {
+ break;
+ }
+ }
+ }
+ }
+ selectRows(selectedRows.toArray(new ITableRow[selectedRows.size()]), false);
+ }
+ finally {
+ setTableChanging(false);
+ }
+ }
+
+ private void replaceRowsCase2(ITableRow[] newRows) throws ProcessingException {
+ try {
+ setTableChanging(true);
+ //
+ int[] oldToNew = new int[getRowCount()];
+ int[] newToOld = new int[newRows.length];
+ Arrays.fill(oldToNew, -1);
+ Arrays.fill(newToOld, -1);
+ HashMap<CompositeObject, Integer> newRowIndexMap = new HashMap<CompositeObject, Integer>();
+ for (int i = newRows.length - 1; i >= 0; i--) {
+ newRowIndexMap.put(new CompositeObject(getRowKeys(newRows[i])), new Integer(i));
+ }
+ int mappedCount = 0;
+ for (int i = 0, ni = getRowCount(); i < ni; i++) {
+ ITableRow existingRow = m_rows.get(i);
+ Integer newIndex = newRowIndexMap.remove(new CompositeObject(getRowKeys(existingRow)));
+ if (newIndex != null) {
+ oldToNew[i] = newIndex.intValue();
+ newToOld[newIndex.intValue()] = i;
+ mappedCount++;
+ }
+ }
+ ITableRow[] updatedRows = new ITableRow[mappedCount];
+ int index = 0;
+ for (int i = 0; i < oldToNew.length; i++) {
+ if (oldToNew[i] >= 0) {
+ ITableRow oldRow = getRow(i);
+ ITableRow newRow = newRows[oldToNew[i]];
+ try {
+ oldRow.setRowChanging(true);
+ //
+ oldRow.setEnabled(newRow.isEnabled());
+ oldRow.setStatus(newRow.getStatus());
+ for (int columnIndex = 0; columnIndex < getColumnCount(); columnIndex++) {
+ if (columnIndex < newRow.getCellCount()) {
+ oldRow.getCellForUpdate(columnIndex).updateFrom(newRow.getCell(columnIndex));
+ }
+ else {
+ // reset the visible values
+ oldRow.getCellForUpdate(columnIndex).setText(null);
+ oldRow.getCellForUpdate(columnIndex).setValue(null);
+ }
+ }
+ }
+ finally {
+ oldRow.setRowPropertiesChanged(false);
+ oldRow.setRowChanging(false);
+ }
+ //
+ updatedRows[index] = oldRow;
+ index++;
+ }
+ }
+ ITableRow[] deletedRows = new ITableRow[getRowCount() - mappedCount];
+ index = 0;
+ for (int i = 0; i < oldToNew.length; i++) {
+ if (oldToNew[i] < 0) {
+ deletedRows[index] = m_rows.get(i);
+ index++;
+ }
+ }
+ ITableRow[] insertedRows = new ITableRow[newRows.length - mappedCount];
+ int[] insertedRowIndexes = new int[newRows.length - mappedCount];
+ index = 0;
+ for (int i = 0; i < newToOld.length; i++) {
+ if (newToOld[i] < 0) {
+ insertedRows[index] = newRows[i];
+ insertedRowIndexes[index] = i;
+ index++;
+ }
+ }
+ //
+ updateRows(updatedRows);
+ deleteRows(deletedRows);
+ addRows(insertedRows, false, insertedRowIndexes);
+ }
+ finally {
+ setTableChanging(false);
+ }
+ }
+
+ @Override
+ public void updateRow(ITableRow row) {
+ if (row != null) {
+ updateRows(new ITableRow[]{row});
+ }
+ }
+
+ @Override
+ public void updateAllRows() {
+ ITableRow[] rows = getRows();
+ updateRows(rows);
+ }
+
+ @Override
+ public void setRowState(ITableRow row, int rowState) throws ProcessingException {
+ setRowState(new ITableRow[]{row}, rowState);
+ }
+
+ @Override
+ public void setAllRowState(int rowState) throws ProcessingException {
+ setRowState(getRows(), rowState);
+ }
+
+ @Override
+ public void setRowState(ITableRow[] rows, int rowState) throws ProcessingException {
+ try {
+ setTableChanging(true);
+ //
+ for (int i = 0; i < rows.length; i++) {
+ rows[i].setStatus(rowState);
+ }
+ }
+ finally {
+ setTableChanging(false);
+ }
+ }
+
+ @Override
+ public void updateRows(ITableRow[] rows) {
+ try {
+ setTableChanging(true);
+ //
+ ArrayList<ITableRow> resolvedRowList = new ArrayList<ITableRow>(rows.length);
+ for (int i = 0; i < rows.length; i++) {
+ ITableRow resolvedRow = resolveRow(rows[i]);
+ if (resolvedRow != null) {
+ resolvedRowList.add(resolvedRow);
+ updateRowImpl(resolvedRow);
+ }
+ }
+ if (resolvedRowList.size() > 0) {
+ fireRowsUpdated(resolvedRowList.toArray(new ITableRow[0]));
+ }
+ if (getColumnSet().getSortColumnCount() > 0) {
+ // restore order of rows according to sort criteria
+ if (isTableChanging()) {
+ m_sortValid = false;
+ }
+ else {
+ sort();
+ }
+ }
+ }
+ finally {
+ setTableChanging(false);
+ }
+ }
+
+ private void updateRowImpl(ITableRow row) {
+ if (row != null) {
+ /*
+ * do NOT use ITableRow#setRowChanging, this might cause a stack overflow
+ */
+ enqueueDecorationTasks(row);
+ }
+ }
+
+ @Override
+ public int getRowCount() {
+ return m_rows.size();
+ }
+
+ @Override
+ public int getDeletedRowCount() {
+ return m_deletedRows.size();
+ }
+
+ @Override
+ public int getSelectedRowCount() {
+ return m_selectedRows.size();
+ }
+
+ @Override
+ public ITableRow getSelectedRow() {
+ if (m_selectedRows.size() > 0) {
+ return m_selectedRows.first();
+ }
+ else {
+ return null;
+ }
+ }
+
+ @Override
+ public ITableRow[] getSelectedRows() {
+ return m_selectedRows.toArray(new ITableRow[m_selectedRows.size()]);
+ }
+
+ @Override
+ public boolean isSelectedRow(ITableRow row) {
+ row = resolveRow(row);
+ if (row == null) {
+ return false;
+ }
+ else {
+ return m_selectedRows.contains(row);
+ }
+ }
+
+ @Override
+ public void selectRow(int rowIndex) {
+ selectRow(getRow(rowIndex));
+ }
+
+ @Override
+ public void selectRow(ITableRow row) {
+ selectRow(row, false);
+ }
+
+ @Override
+ public void selectRow(ITableRow row, boolean append) {
+ if (row != null) {
+ selectRows(new ITableRow[]{row}, append);
+ }
+ else {
+ selectRows(new ITableRow[0], append);
+ }
+ }
+
+ @Override
+ public void selectRows(ITableRow[] rows) {
+ selectRows(rows, false);
+ }
+
+ @Override
+ public void selectRows(ITableRow[] rows, boolean append) {
+ rows = resolveRows(rows);
+ TreeSet<ITableRow> newSelection = new TreeSet<ITableRow>(new RowIndexComparator());
+ if (append) {
+ newSelection.addAll(m_selectedRows);
+ newSelection.addAll(Arrays.asList(rows));
+ }
+ else {
+ newSelection.addAll(Arrays.asList(rows));
+ }
+ // check selection count with multiselect
+ if (newSelection.size() > 1 && !isMultiSelect()) {
+ ITableRow first = newSelection.first();
+ newSelection.clear();
+ newSelection.add(first);
+ }
+ if (!m_selectedRows.equals(newSelection)) {
+ m_selectedRows = newSelection;
+ fireRowsSelected(m_selectedRows.toArray(new ITableRow[0]));
+ }
+ }
+
+ @Override
+ public void selectFirstRow() {
+ selectRow(getRow(0));
+ }
+
+ @Override
+ public void selectNextRow() {
+ ITableRow row = getSelectedRow();
+ if (row != null && row.getRowIndex() + 1 < getRowCount()) {
+ selectRow(getRow(row.getRowIndex() + 1));
+ }
+ else if (row == null && getRowCount() > 0) {
+ selectRow(0);
+ }
+ }
+
+ @Override
+ public void selectPreviousRow() {
+ ITableRow row = getSelectedRow();
+ if (row != null && row.getRowIndex() - 1 >= 0) {
+ selectRow(getRow(row.getRowIndex() - 1));
+ }
+ else if (row == null && getRowCount() > 0) {
+ selectRow(getRowCount() - 1);
+ }
+ }
+
+ @Override
+ public void selectLastRow() {
+ selectRow(getRow(getRowCount() - 1));
+ }
+
+ @Override
+ public void deselectRow(ITableRow row) {
+ if (row != null) {
+ deselectRows(new ITableRow[]{row});
+ }
+ else {
+ deselectRows(new ITableRow[0]);
+ }
+ }
+
+ @Override
+ public void deselectRows(ITableRow[] rows) {
+ rows = resolveRows(rows);
+ if (rows != null && rows.length > 0) {
+ TreeSet<ITableRow> newSelection = new TreeSet<ITableRow>(new RowIndexComparator());
+ newSelection.addAll(m_selectedRows);
+ if (newSelection.removeAll(Arrays.asList(rows))) {
+ m_selectedRows = newSelection;
+ fireRowsSelected(m_selectedRows.toArray(new ITableRow[0]));
+ }
+ }
+ }
+
+ @Override
+ public void selectAllRows() {
+ selectRows(getRows(), false);
+ }
+
+ @Override
+ public void deselectAllRows() {
+ selectRow(null, false);
+ }
+
+ @Override
+ public void selectAllEnabledRows() {
+ ArrayList<ITableRow> newList = new ArrayList<ITableRow>();
+ for (int i = 0, ni = getRowCount(); i < ni; i++) {
+ ITableRow row = getRow(i);
+ if (row.isEnabled()) {
+ newList.add(row);
+ }
+ else if (isSelectedRow(row)) {
+ newList.add(row);
+ }
+ }
+ selectRows(newList.toArray(new ITableRow[0]), false);
+ }
+
+ @Override
+ public void deselectAllEnabledRows() {
+ ITableRow[] selectedRows = getSelectedRows();
+ ArrayList<ITableRow> newList = new ArrayList<ITableRow>();
+ for (int i = 0; i < selectedRows.length; i++) {
+ if (selectedRows[i].isEnabled()) {
+ newList.add(selectedRows[i]);
+ }
+ }
+ deselectRows(newList.toArray(new ITableRow[0]));
+ }
+
+ @Override
+ public ITableRow[] getCheckedRows() {
+ final ArrayList<ITableRow> list = new ArrayList<ITableRow>();
+ for (ITableRow row : getRows()) {
+ if (row.isChecked()) {
+ list.add(row);
+ }
+ }
+ return list.toArray(new ITableRow[list.size()]);
+ }
+
+ @Override
+ public void checkRow(int row, boolean value) throws ProcessingException {
+ checkRow(getRow(row), value);
+ }
+
+ @Override
+ public void checkRow(ITableRow row, boolean value) throws ProcessingException {
+ if (!row.isEnabled()) {
+ return;
+ }
+ if (!isMultiCheck() && value && getCheckedRows().length > 0) {
+ uncheckAllRows();
+ }
+ row.setChecked(value);
+ if (getCheckableColumn() != null) {
+ getCheckableColumn().setValue(row, value);
+ }
+ }
+
+ @Override
+ public void checkRows(ITableRow[] rows, boolean value) throws ProcessingException {
+ rows = resolveRows(rows);
+ // check checked count with multicheck
+ if (rows.length > 1 && !isMultiCheck()) {
+ ITableRow first = rows[0];
+ first.setChecked(value);
+ }
+ else {
+ for (ITableRow row : rows) {
+ checkRow(row, value);
+ }
+ }
+ }
+
+ @Override
+ public void checkAllRows() throws ProcessingException {
+ try {
+ setTableChanging(true);
+ for (int i = 0; i < getRowCount(); i++) {
+ checkRow(i, true);
+ }
+ }
+ finally {
+ setTableChanging(false);
+ }
+ }
+
+ @Override
+ public void uncheckAllRows() throws ProcessingException {
+ try {
+ setTableChanging(true);
+ for (int i = 0; i < getRowCount(); i++) {
+ checkRow(i, false);
+ }
+ }
+ finally {
+ setTableChanging(false);
+ }
+ }
+
+ @Override
+ public String getDefaultIconId() {
+ String iconId = propertySupport.getPropertyString(PROP_DEFAULT_ICON);
+ if (iconId != null && iconId.length() == 0) {
+ iconId = null;
+ }
+ return iconId;
+ }
+
+ @Override
+ public void setDefaultIconId(String iconId) {
+ propertySupport.setPropertyString(PROP_DEFAULT_ICON, iconId);
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return propertySupport.getPropertyBool(PROP_ENABLED);
+ }
+
+ @Override
+ public final void setEnabled(boolean b) {
+ boolean changed = propertySupport.setPropertyBool(PROP_ENABLED, b);
+ if (changed) {
+ //update the state of all current cell beans that are out there
+ try {
+ setTableChanging(true);
+ //
+ ITableRow[] rows = getRows();
+ for (ITableRow row : rows) {
+ enqueueDecorationTasks(row);
+ }
+ }
+ finally {
+ setTableChanging(false);
+ }
+ }
+ }
+
+ @Override
+ public boolean isScrollToSelection() {
+ return propertySupport.getPropertyBool(PROP_SCROLL_TO_SELECTION);
+ }
+
+ @Override
+ public void setScrollToSelection(boolean b) {
+ propertySupport.setPropertyBool(PROP_SCROLL_TO_SELECTION, b);
+ }
+
+ @Override
+ public void scrollToSelection() {
+ fireTableEventInternal(new TableEvent(this, TableEvent.TYPE_SCROLL_TO_SELECTION));
+ }
+
+ /**
+ * @return a copy of a row<br>
+ * when the row is changed it has to be applied to the table using
+ * modifyRow(row);
+ */
+ @Override
+ public ITableRow getRow(int rowIndex) {
+ ITableRow row = null;
+ ITableRow[] rows = getRows();
+ if (rowIndex >= 0 && rowIndex < rows.length) {
+ row = rows[rowIndex];
+ }
+ return row;
+ }
+
+ @Override
+ public ITableRow[] getRows() {
+ //lazy create list in getter, make sure to be thread-safe since getters may be called from "wild" threads
+ synchronized (m_cachedRowsLock) {
+ if (m_cachedRows == null) {
+ //this code must be thread-safe
+ m_cachedRows = m_rows.toArray(new ITableRow[m_rows.size()]);
+ }
+ return m_cachedRows;
+ }
+ }
+
+ @Override
+ public ITableRow[] getFilteredRows() {
+ ITableRow[] rows = getRows();
+ if (m_rowFilters.size() > 0) {
+ //lazy create list in getter, make sure to be thread-safe since getters may be called from "wild" threads
+ synchronized (m_cachedFilteredRowsLock) {
+ if (m_cachedFilteredRows == null) {
+ //this code must be thread-safe
+ if (m_rowFilters.size() > 0) {
+ ArrayList<ITableRow> list = new ArrayList<ITableRow>(getRowCount());
+ for (ITableRow row : rows) {
+ if (row != null && row.isFilterAccepted()) {
+ list.add(row);
+ }
+ }
+ m_cachedFilteredRows = list.toArray(new ITableRow[list.size()]);
+ }
+ else {
+ m_cachedFilteredRows = new ITableRow[0];
+ }
+ }
+ return m_cachedFilteredRows;
+ }
+ }
+ else {
+ return rows;
+ }
+ }
+
+ @Override
+ public int getFilteredRowCount() {
+ if (m_rowFilters.size() > 0) {
+ return getFilteredRows().length;
+ }
+ else {
+ return getRowCount();
+ }
+ }
+
+ @Override
+ public ITableRow getFilteredRow(int index) {
+ if (m_rowFilters.size() > 0) {
+ ITableRow row = null;
+ ITableRow[] filteredRows = getFilteredRows();
+ if (index >= 0 && index < filteredRows.length) {
+ row = filteredRows[index];
+ }
+ return row;
+ }
+ else {
+ return getRow(index);
+ }
+ }
+
+ @Override
+ public int getFilteredRowIndex(ITableRow row) {
+ ITableRow[] filteredRows = getFilteredRows();
+ for (int i = 0; i < filteredRows.length; i++) {
+ if (filteredRows[i].equals(row)) {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+ @Override
+ public Object[][] getTableData() {
+ Object[][] data = new Object[getRowCount()][getColumnCount()];
+ for (int r = 0; r < getRowCount(); r++) {
+ for (int c = 0; c < getColumnCount(); c++) {
+ data[r][c] = getRow(r).getCellValue(c);
+ }
+ }
+ return data;
+ }
+
+ @Override
+ public Object[][] exportTableRowsAsCSV(ITableRow[] rows, IColumn<?>[] columns, boolean includeLineForColumnNames, boolean includeLineForColumnTypes, boolean includeLineForColumnFormats) {
+ return TableUtility.exportRowsAsCSV(rows, columns, includeLineForColumnNames, includeLineForColumnTypes, includeLineForColumnFormats);
+ }
+
+ @Override
+ public ITableRow[] getRows(int[] rowIndexes) {
+ if (rowIndexes == null) {
+ return new ITableRow[0];
+ }
+ ITableRow[] rows = new ITableRow[rowIndexes.length];
+ int missingCount = 0;
+ for (int i = 0; i < rowIndexes.length; i++) {
+ rows[i] = getRow(rowIndexes[i]);
+ if (rows[i] == null) {
+ missingCount++;
+ }
+ }
+ if (missingCount > 0) {
+ ITableRow[] newRows = new ITableRow[rowIndexes.length - missingCount];
+ int index = 0;
+ for (int i = 0; i < rows.length; i++) {
+ if (rows[i] != null) {
+ newRows[index] = rows[i];
+ index++;
+ }
+ }
+ rows = newRows;
+ }
+ return rows;
+ }
+
+ /**
+ * @return a copy of a deleted row<br>
+ * when the row is changed it has to be applied to the table using
+ * modifyRow(row);
+ */
+ @Override
+ public ITableRow[] getDeletedRows() {
+ return m_deletedRows.values().toArray(new ITableRow[0]);
+ }
+
+ @Override
+ public int getInsertedRowCount() {
+ int count = 0;
+ ITableRow[] rows = getRows();
+ for (int i = 0, ni = rows.length; i < ni; i++) {
+ if (rows[i].getStatus() == ITableRow.STATUS_INSERTED) {
+ count++;
+ }
+ }
+ return count;
+ }
+
+ @Override
+ public ITableRow[] getInsertedRows() {
+ ArrayList<ITableRow> rowList = new ArrayList<ITableRow>();
+ ITableRow[] rows = getRows();
+ for (int i = 0, ni = rows.length; i < ni; i++) {
+ ITableRow row = rows[i];
+ if (row.getStatus() == ITableRow.STATUS_INSERTED) {
+ rowList.add(row);
+ }
+ }
+ return rowList.toArray(new ITableRow[rowList.size()]);
+ }
+
+ @Override
+ public int getUpdatedRowCount() {
+ int count = 0;
+ ITableRow[] rows = getRows();
+ for (int i = 0, ni = rows.length; i < ni; i++) {
+ if (rows[i].getStatus() == ITableRow.STATUS_UPDATED) {
+ count++;
+ }
+ }
+ return count;
+ }
+
+ @Override
+ public ITableRow[] getUpdatedRows() {
+ ArrayList<ITableRow> rowList = new ArrayList<ITableRow>();
+ ITableRow[] rows = getRows();
+ for (int i = 0, ni = rows.length; i < ni; i++) {
+ ITableRow row = rows[i];
+ if (row.getStatus() == ITableRow.STATUS_UPDATED) {
+ rowList.add(row);
+ }
+ }
+ return rowList.toArray(new ITableRow[rowList.size()]);
+ }
+
+ /**
+ * Convenience to add row by data only
+ */
+ @Override
+ public ITableRow addRowByArray(Object dataArray) throws ProcessingException {
+ if (dataArray == null) {
+ return null;
+ }
+ ITableRow[] a = addRowsByMatrix(new Object[]{dataArray});
+ if (a.length > 0) {
+ return a[0];
+ }
+ else {
+ return null;
+ }
+ }
+
+ @Override
+ public ITableRow[] addRowsByMatrix(Object dataMatrix) throws ProcessingException {
+ return addRowsByMatrix(dataMatrix, ITableRow.STATUS_INSERTED);
+ }
+
+ @Override
+ public ITableRow[] addRowsByMatrix(Object dataMatrix, int rowStatus) throws ProcessingException {
+ return addRows(createRowsByMatrix(dataMatrix, rowStatus));
+ }
+
+ @Override
+ public ITableRow[] addRowsByArray(Object dataArray) throws ProcessingException {
+ return addRowsByArray(dataArray, ITableRow.STATUS_INSERTED);
+ }
+
+ @Override
+ public ITableRow[] addRowsByArray(Object dataArray, int rowStatus) throws ProcessingException {
+ return addRows(createRowsByArray(dataArray, rowStatus));
+ }
+
+ @Override
+ public ITableRow addRow(ITableRow newRow) throws ProcessingException {
+ return addRow(newRow, false);
+ }
+
+ @Override
+ public ITableRow addRow(ITableRow newRow, boolean markAsInserted) throws ProcessingException {
+ ITableRow[] addedRows = addRows(new ITableRow[]{newRow}, markAsInserted);
+ if (addedRows.length > 0) {
+ return addedRows[0];
+ }
+ else {
+ return null;
+ }
+ }
+
+ @Override
+ public ITableRow[] addRows(ITableRow[] newRows) throws ProcessingException {
+ return addRows(newRows, false);
+ }
+
+ @Override
+ public ITableRow[] addRows(ITableRow[] newRows, boolean markAsInserted) throws ProcessingException {
+ return addRows(newRows, markAsInserted, null);
+ }
+
+ @Override
+ public ITableRow[] addRows(ITableRow[] newRows, boolean markAsInserted, int[] insertIndexes) throws ProcessingException {
+ if (newRows == null || newRows.length == 0) {
+ return new ITableRow[0];
+ }
+ try {
+ setTableChanging(true);
+ //
+ int oldRowCount = m_rows.size();
+ //m_rows.ensureCapacity(m_rows.size() + newRows.length);
+ ITableRow[] newIRows = new ITableRow[newRows.length];
+ for (int i = 0; i < newRows.length; i++) {
+ newIRows[i] = addRowImpl(newRows[i], markAsInserted);
+ }
+ fireRowsInserted(newIRows);
+ if (getColumnSet().getSortColumnCount() > 0) {
+ // restore order of rows according to sort criteria
+ if (isTableChanging()) {
+ m_sortValid = false;
+ }
+ else {
+ sort();
+ }
+ }
+ else if (insertIndexes != null) {
+ ITableRow[] sortArray = new ITableRow[m_rows.size()];
+ // add new rows that have a given sortIndex
+ for (int i = 0; i < insertIndexes.length; i++) {
+ sortArray[insertIndexes[i]] = newIRows[i];
+ }
+ int sortArrayIndex = 0;
+ // add existing rows
+ for (int i = 0; i < oldRowCount; i++) {
+ // find next empty slot
+ while (sortArray[sortArrayIndex] != null) {
+ sortArrayIndex++;
+ }
+ sortArray[sortArrayIndex] = m_rows.get(i);
+ }
+ // add new rows that have no given sortIndex
+ for (int i = insertIndexes.length; i < newIRows.length; i++) {
+ // find next empty slot
+ while (sortArray[sortArrayIndex] != null) {
+ sortArrayIndex++;
+ }
+ sortArray[sortArrayIndex] = newIRows[i];
+ }
+ sortInternal(sortArray);
+ }
+ return newIRows;
+ }
+ finally {
+ setTableChanging(false);
+ }
+ }
+
+ private ITableRow addRowImpl(ITableRow newRow, boolean markAsInserted) throws ProcessingException {
+ if (markAsInserted) {
+ newRow.setStatus(ITableRow.STATUS_INSERTED);
+ }
+ InternalTableRow newIRow = new InternalTableRow(this, newRow);
+ synchronized (m_cachedRowsLock) {
+ m_cachedRows = null;
+ }
+ int newIndex = m_rows.size();
+ newIRow.setRowIndex(newIndex);
+ newIRow.setTableInternal(this);
+ m_rows.add(newIRow);
+ enqueueDecorationTasks(newIRow);
+ return newIRow;
+ }
+
+ @Override
+ public void moveRow(int sourceIndex, int targetIndex) {
+ moveRowImpl(sourceIndex, targetIndex);
+ }
+
+ /**
+ * move the movingRow to the location just before the target row
+ */
+ @Override
+ public void moveRowBefore(ITableRow movingRow, ITableRow targetRow) {
+ movingRow = resolveRow(movingRow);
+ targetRow = resolveRow(targetRow);
+ if (movingRow != null && targetRow != null) {
+ moveRowImpl(movingRow.getRowIndex(), targetRow.getRowIndex());
+ }
+ }
+
+ /**
+ * move the movingRow to the location just after the target row
+ */
+ @Override
+ public void moveRowAfter(ITableRow movingRow, ITableRow targetRow) {
+ movingRow = resolveRow(movingRow);
+ targetRow = resolveRow(targetRow);
+ if (movingRow != null && targetRow != null) {
+ moveRowImpl(movingRow.getRowIndex(), targetRow.getRowIndex() + 1);
+ }
+ }
+
+ private void moveRowImpl(int sourceIndex, int targetIndex) {
+ if (sourceIndex < 0) {
+ sourceIndex = 0;
+ }
+ if (sourceIndex >= getRowCount()) {
+ sourceIndex = getRowCount() - 1;
+ }
+ if (targetIndex < 0) {
+ targetIndex = 0;
+ }
+ if (targetIndex >= getRowCount()) {
+ targetIndex = getRowCount() - 1;
+ }
+ if (targetIndex != sourceIndex) {
+ synchronized (m_cachedRowsLock) {
+ m_cachedRows = null;
+ }
+ ITableRow row = m_rows.remove(sourceIndex);
+ m_rows.add(targetIndex, row);
+ // update row indexes
+ int min = Math.min(sourceIndex, targetIndex);
+ int max = Math.max(sourceIndex, targetIndex);
+ ITableRow[] changedRows = new ITableRow[max - min + 1];
+ for (int i = min; i <= max; i++) {
+ changedRows[i - min] = getRow(i);
+ ((InternalTableRow) changedRows[i - min]).setRowIndex(i);
+ }
+ fireRowOrderChanged();
+ // rebuild selection
+ selectRows(getSelectedRows(), false);
+ }
+ }
+
+ @Override
+ public void deleteRow(int rowIndex) {
+ deleteRows(new int[]{rowIndex});
+ }
+
+ @Override
+ public void deleteRows(int[] rowIndexes) {
+ ArrayList<ITableRow> rowList = new ArrayList<ITableRow>();
+ for (int i = 0; i < rowIndexes.length; i++) {
+ ITableRow row = getRow(rowIndexes[i]);
+ if (row != null) {
+ rowList.add(row);
+ }
+ }
+ deleteRows(rowList.toArray(new ITableRow[0]));
+ }
+
+ @Override
+ public void deleteRow(ITableRow row) {
+ if (row != null) {
+ deleteRows(new ITableRow[]{row});
+ }
+ }
+
+ @Override
+ public void deleteAllRows() {
+ deleteRows(getRows());
+ }
+
+ @Override
+ public void deleteRows(ITableRow[] rows) {
+ ITableRow[] existingRows = getRows();
+ //peformance quick-check
+ if (rows != existingRows) {
+ rows = resolveRows(rows);
+ }
+ if (rows != null && rows.length > 0) {
+ try {
+ setTableChanging(true);
+ //
+ int rowCountBefore = getRowCount();
+ int min = getRowCount();
+ int max = 0;
+ for (int i = 0; i < rows.length; i++) {
+ ITableRow row = rows[i];
+ min = Math.min(min, row.getRowIndex());
+ max = Math.max(max, row.getRowIndex());
+ }
+ ITableRow[] deletedRows = rows;
+ // remove from selection
+ deselectRows(deletedRows);
+ //delete impl
+ //peformance quick-check
+ if (rows == existingRows) {
+ //remove all of them
+ m_rows.clear();
+ synchronized (m_cachedRowsLock) {
+ m_cachedRows = null;
+ }
+ for (int i = deletedRows.length - 1; i >= 0; i--) {
+ ITableRow candidateRow = deletedRows[i];
+ if (candidateRow != null) {
+ deleteRowImpl(candidateRow);
+ }
+ }
+ }
+ else {
+ for (int i = deletedRows.length - 1; i >= 0; i--) {
+ ITableRow candidateRow = deletedRows[i];
+ if (candidateRow != null) {
+ // delete regardless if index is right
+ boolean removed = m_rows.remove(candidateRow);
+ if (removed) {
+ synchronized (m_cachedRowsLock) {
+ m_cachedRows = null;
+ }
+ deleteRowImpl(candidateRow);
+ }
+ }
+ }
+ }
+ // get affected rows
+ HashSet<ITableRow> selectionRows = new HashSet<ITableRow>(Arrays.asList(getSelectedRows()));
+ int minAffectedIndex = Math.max(min - 1, 0);
+ ITableRow[] affectedRows = new ITableRow[getRowCount() - minAffectedIndex];
+ for (int i = minAffectedIndex; i < getRowCount(); i++) {
+ affectedRows[i - minAffectedIndex] = getRow(i);
+ ((InternalTableRow) affectedRows[i - minAffectedIndex]).setRowIndex(i);
+ selectionRows.remove(getRow(i));
+ }
+ if (rowCountBefore == deletedRows.length) {
+ fireAllRowsDeleted(deletedRows);
+ }
+ else {
+ fireRowsDeleted(deletedRows);
+ }
+ selectRows(selectionRows.toArray(new ITableRow[selectionRows.size()]), false);
+ }
+ finally {
+ setTableChanging(false);
+ }
+ }
+ }
+
+ private void deleteRowImpl(ITableRow row) {
+ if (!(row instanceof InternalTableRow)) {
+ return;
+ }
+ InternalTableRow internalRow = (InternalTableRow) row;
+ if (isAutoDiscardOnDelete()) {
+ internalRow.setTableInternal(null);
+ // don't manage deleted rows any further
+ }
+ else if (internalRow.getStatus() == ITableRow.STATUS_INSERTED) {
+ internalRow.setTableInternal(null);
+ // it was new and now it is gone, no further action required
+ }
+ else {
+ internalRow.setStatus(ITableRow.STATUS_DELETED);
+ m_deletedRows.put(new CompositeObject(getRowKeys(internalRow)), internalRow);
+ }
+ }
+
+ @Override
+ public void discardRow(int rowIndex) {
+ discardRows(new int[]{rowIndex});
+ }
+
+ @Override
+ public void discardRows(int[] rowIndexes) {
+ ArrayList<ITableRow> rowList = new ArrayList<ITableRow>();
+ for (int i = 0; i < rowIndexes.length; i++) {
+ ITableRow row = getRow(rowIndexes[i]);
+ if (row != null) {
+ rowList.add(row);
+ }
+ }
+ discardRows(rowList.toArray(new ITableRow[0]));
+ }
+
+ @Override
+ public void discardRow(ITableRow row) {
+ if (row != null) {
+ discardRows(new ITableRow[]{row});
+ }
+ }
+
+ @Override
+ public void discardAllRows() {
+ discardRows(getRows());
+ }
+
+ /**
+ * discard is the same as delete with the exception that discarded rows are
+ * not collected in the deletedRows list
+ */
+ @Override
+ public void discardRows(ITableRow[] rows) {
+ try {
+ setTableChanging(true);
+ //
+ for (int i = 0; i < rows.length; i++) {
+ ((InternalTableRow) rows[i]).setStatus(ITableRow.STATUS_INSERTED);
+ }
+ deleteRows(rows);
+ }
+ finally {
+ setTableChanging(false);
+ }
+ }
+
+ @Override
+ public void discardAllDeletedRows() {
+ for (Iterator<ITableRow> it = m_deletedRows.values().iterator(); it.hasNext();) {
+ ((InternalTableRow) it.next()).setTableInternal(null);
+ }
+ m_deletedRows.clear();
+ }
+
+ @Override
+ public void discardDeletedRow(ITableRow deletedRow) {
+ if (deletedRow != null) {
+ discardDeletedRows(new ITableRow[]{deletedRow});
+ }
+ }
+
+ @Override
+ public void discardDeletedRows(ITableRow[] deletedRows) {
+ if (deletedRows != null) {
+ for (ITableRow row : deletedRows) {
+ m_deletedRows.remove(new CompositeObject(getRowKeys(row)));
+ ((InternalTableRow) row).setTableInternal(null);
+ }
+ }
+ }
+
+ @Override
+ public void setContextColumn(IColumn<?> col) {
+ propertySupport.setProperty(PROP_CONTEXT_COLUMN, col);
+ }
+
+ @Override
+ public IColumn<?> getContextColumn() {
+ return (IColumn<?>) propertySupport.getProperty(PROP_CONTEXT_COLUMN);
+ }
+
+ @SuppressWarnings("deprecation")
+ @Deprecated
+ @Override
+ public void clearDeletedRows() {
+ discardAllDeletedRows();
+ }
+
+ @Override
+ public Object[] getRowKeys(int rowIndex) {
+ ITableRow row = getRow(rowIndex);
+ return getRowKeys(row);
+ }
+
+ @Override
+ public Object[] getRowKeys(ITableRow row) {
+ // do not resolve
+ Object[] keys = new Object[0];
+ if (row != null) {
+ keys = row.getKeyValues();
+ }
+ return keys;
+ }
+
+ @Override
+ public ITableRow findRowByKey(Object[] keys) {
+ IColumn<?>[] keyColumns = getColumnSet().getKeyColumns();
+ if (keyColumns.length == 0) {
+ keyColumns = getColumnSet().getColumns();
+ }
+ for (ITableRow row : m_rows) {
+ boolean match = true;
+ if (keys != null && keys.length > 0) {
+ for (int i = 0; i < keyColumns.length && i < keys.length; i++) {
+ if (!CompareUtility.equals(keyColumns[i].getValue(row), keys[i])) {
+ match = false;
+ break;
+ }
+ }
+ }
+ if (match) {
+ return row;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public ITableColumnFilterManager getColumnFilterManager() {
+ return m_columnFilterManager;
+ }
+
+ @Override
+ public void setColumnFilterManager(ITableColumnFilterManager m) {
+ m_columnFilterManager = m;
+ }
+
+ @Override
+ public ITableCustomizer getTableCustomizer() {
+ return m_tableCustomizer;
+ }
+
+ @Override
+ public void setTableCustomizer(ITableCustomizer c) {
+ m_tableCustomizer = c;
+ }
+
+ @Override
+ public Object getContainer() {
+ return propertySupport.getProperty(PROP_CONTAINER);
+ }
+
+ /**
+ * do not use this internal method unless you are implementing a container that holds and controls an {@link ITable}
+ */
+ public void setContainerInternal(Object container) {
+ propertySupport.setProperty(PROP_CONTAINER, container);
+ }
+
+ @Override
+ public boolean isSortEnabled() {
+ return m_sortEnabled;
+ }
+
+ @Override
+ public void setSortEnabled(boolean b) {
+ m_sortEnabled = b;
+ }
+
+ @Override
+ public void sort() {
+ try {
+ if (isSortEnabled()) {
+ // Consider any active sort-column, not only explicit ones.
+ // This is to support reverse (implicit) sorting of columns, meaning that multiple column sort is done
+ // without CTRL-key held. In contrast to explicit multiple column sort, the first clicked column
+ // is the least significant sort column.
+ IColumn<?>[] sortCols = getColumnSet().getSortColumns();
+ if (sortCols.length > 0) {
+ // first make sure decorations and lookups are up-to-date
+ processDecorationBuffer();
+ ITableRow[] a = getRows();
+ Arrays.sort(a, new TableRowComparator(sortCols));
+ sortInternal(a);
+ }
+ }
+ }
+ finally {
+ m_sortValid = true;
+ }
+ }
+
+ @Override
+ public void sort(ITableRow[] rowsInNewOrder) {
+ ITableRow[] resolvedRows = resolveRows(rowsInNewOrder);
+ if (resolvedRows.length == rowsInNewOrder.length) {
+ sortInternal(resolvedRows);
+ }
+ else {
+ // check which rows could not be mapped
+ ArrayList<ITableRow> list = new ArrayList<ITableRow>();
+ list.addAll(m_rows);
+ list.removeAll(Arrays.asList(resolvedRows));
+ ArrayList<ITableRow> sortedList = new ArrayList<ITableRow>();
+ sortedList.addAll(Arrays.asList(resolvedRows));
+ sortedList.addAll(list);
+ sortInternal(sortedList.toArray(new ITableRow[sortedList.size()]));
+ }
+ }
+
+ private void sortInternal(ITableRow[] resolvedRows) {
+ for (int i = 0; i < resolvedRows.length; i++) {
+ ((InternalTableRow) resolvedRows[i]).setRowIndex(i);
+ }
+ synchronized (m_cachedRowsLock) {
+ m_cachedRows = null;
+ m_rows.clear();
+ m_rows.addAll(Arrays.asList(resolvedRows));
+ }
+ //sort selection without firing an event
+ if (m_selectedRows != null && m_selectedRows.size() > 0) {
+ TreeSet<ITableRow> newSelection = new TreeSet<ITableRow>(new RowIndexComparator());
+ newSelection.addAll(m_selectedRows);
+ m_selectedRows = newSelection;
+ }
+ fireRowOrderChanged();
+ }
+
+ @Override
+ public void resetColumnConfiguration() {
+ discardAllRows();
+ //
+ try {
+ setTableChanging(true);
+ // save displayable state
+ HashMap<String, Boolean> displayableState = new HashMap<String, Boolean>();
+ for (IColumn<?> col : getColumns()) {
+ displayableState.put(col.getColumnId(), col.isDisplayable());
+ }
+ // reset columns
+ disposeColumnsInternal();
+ createColumnsInternal();
+ initColumnsInternal();
+ // re-apply displayable
+ for (IColumn<?> col : getColumns()) {
+ if (displayableState.get(col.getColumnId()) != null) {
+ col.setDisplayable(displayableState.get(col.getColumnId()));
+ }
+ }
+ // re-apply existing filters to new columns
+ ITableColumnFilterManager filterManager = getColumnFilterManager();
+ if (filterManager != null && filterManager.getFilters() != null) {
+ for (IColumn<?> col : getColumns()) {
+ for (ITableColumnFilter<?> filter : filterManager.getFilters()) {
+ if (filter.getColumn().getClass().equals(col.getClass())) {
+ filter.setColumn(col);
+ }
+ }
+ filterManager.refresh();
+ }
+ }
+ fireTableEventInternal(new TableEvent(this, TableEvent.TYPE_COLUMN_STRUCTURE_CHANGED));
+ }
+ finally {
+ setTableChanging(false);
+ }
+ }
+
+ @Override
+ public void resetColumnVisibilities() {
+ resetColumns(true, false, false, false);
+ }
+
+ @Override
+ public void resetColumnOrder() {
+ resetColumns(false, true, false, false);
+ }
+
+ @Override
+ public void resetColumnSortOrder() {
+ resetColumns(false, false, true, false);
+ }
+
+ @Override
+ public void resetColumnWidths() {
+ resetColumns(false, false, false, true);
+ }
+
+ @Override
+ public void resetDisplayableColumns() {
+ resetColumns(true, true, true, true);
+ }
+
+ @Override
+ public void resetColumns(boolean visibility, boolean order, boolean sorting, boolean widths) {
+ try {
+ setTableChanging(true);
+ //
+ try {
+ if (sorting) {
+ m_sortValid = false;
+ }
+ resetColumnsInternal(visibility, order, sorting, widths);
+ execResetColumns(visibility, order, sorting, widths);
+ }
+ catch (Throwable t) {
+ LOG.error("reset columns " + visibility + "," + order + "," + sorting + "," + widths, t);
+ }
+ }
+ finally {
+ setTableChanging(false);
+ }
+ }
+
+ private void resetColumnsInternal(boolean visibility, boolean order, boolean sorting, boolean widths) {
+ ClientUIPreferences env = ClientUIPreferences.getInstance();
+ env.removeAllTableColumnPreferences(this, visibility, order, sorting, widths);
+
+ //Visibilities
+ if (visibility) {
+ ArrayList<IColumn<?>> list = new ArrayList<IColumn<?>>();
+ for (IColumn<?> col : getColumnSet().getAllColumnsInUserOrder()) {
+ if (col.isDisplayable()) {
+ boolean configuredVisible = ((AbstractColumn<?>) col).isInitialVisible();
+ if (configuredVisible) {
+ list.add(col);
+ }
+ }
+ }
+ getColumnSet().setVisibleColumns(list.toArray(new IColumn<?>[list.size()]));
+ }
+ //Order
+ if (order) {
+ TreeMap<CompositeObject, IColumn<?>> orderMap = new TreeMap<CompositeObject, IColumn<?>>();
+ int index = 0;
+ for (IColumn<?> col : getColumns()) {
+ if (col.isDisplayable() && col.isVisible()) {
+ orderMap.put(new CompositeObject(col.getViewOrder(), index), col);
+ index++;
+ }
+ }
+ getColumnSet().setVisibleColumns(orderMap.values().toArray(new IColumn[orderMap.size()]));
+ }
+ //Sorting
+ if (sorting) {
+ TreeMap<CompositeObject, IColumn<?>> sortMap = new TreeMap<CompositeObject, IColumn<?>>();
+ int index = 0;
+ for (IColumn<?> col : getColumns()) {
+ if (col.getInitialSortIndex() >= 0) {
+ sortMap.put(new CompositeObject(col.getInitialSortIndex(), index), col);
+ }
+ index++;
+ }
+ //
+ getColumnSet().clearSortColumns();
+ getColumnSet().clearPermanentHeadSortColumns();
+ getColumnSet().clearPermanentTailSortColumns();
+ for (IColumn<?> col : sortMap.values()) {
+ if (col.isInitialAlwaysIncludeSortAtBegin()) {
+ getColumnSet().addPermanentHeadSortColumn(col, col.isInitialSortAscending());
+ }
+ else if (col.isInitialAlwaysIncludeSortAtEnd()) {
+ getColumnSet().addPermanentTailSortColumn(col, col.isInitialSortAscending());
+ }
+ else {
+ getColumnSet().addSortColumn(col, col.isInitialSortAscending());
+ }
+ }
+ }
+ //Widths
+ if (widths) {
+ for (IColumn<?> col : getColumns()) {
+ if (col.isDisplayable()) {
+ col.setWidth(col.getInitialWidth());
+ }
+ }
+ }
+ }
+
+ /**
+ * Affects columns with lookup calls or code types<br>
+ * cells that have changed values fetch new texts/decorations from the lookup
+ * service in one single batch call lookup (performance optimization)
+ */
+ private void processDecorationBuffer() {
+ /*
+ * 1. process lookup service calls
+ */
+ try {
+ BatchLookupCall batchCall = null;
+ ArrayList<ITableRow> tableRowList = null;
+ ArrayList<Integer> columnIndexList = null;
+ if (m_cellLookupBuffer.size() > 0) {
+ batchCall = new BatchLookupCall();
+ tableRowList = new ArrayList<ITableRow>();
+ columnIndexList = new ArrayList<Integer>();
+ BatchLookupResultCache lookupResultCache = new BatchLookupResultCache();
+ for (P_CellLookup lookup : m_cellLookupBuffer) {
+ ITableRow row = lookup.getRow();
+ if (row.getTable() == AbstractTable.this) {
+ ISmartColumn<?> col = lookup.getColumn();
+ LookupCall call = col.prepareLookupCall(row);
+ if (call != null && call.getKey() != null) {
+ //split: local vs remote
+ if (call instanceof LocalLookupCall) {
+ LookupRow[] result = lookupResultCache.getDataByKey(call);
+ applyLookupResult((InternalTableRow) row, col.getColumnIndex(), result);
+ }
+ else {
+ tableRowList.add(row);
+ columnIndexList.add(new Integer(col.getColumnIndex()));
+ batchCall.addLookupCall(call);
+ }
+ }
+ else {
+ applyLookupResult((InternalTableRow) row, col.getColumnIndex(), LookupRow.EMPTY_ARRAY);
+ }
+ }
+ }
+ }
+ m_cellLookupBuffer.clear();
+ //
+ if (batchCall != null && tableRowList != null && columnIndexList != null && !batchCall.isEmpty()) {
+ ITableRow[] tableRows = tableRowList.toArray(new ITableRow[0]);
+ LookupRow[][] resultArray;
+ IBatchLookupService service = SERVICES.getService(IBatchLookupService.class);
+ resultArray = service.getBatchDataByKey(batchCall);
+ for (int i = 0; i < tableRows.length; i++) {
+ applyLookupResult((InternalTableRow) tableRows[i], ((Number) columnIndexList.get(i)).intValue(), resultArray[i]);
+ }
+ }
+ }
+ catch (ProcessingException e) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ finally {
+ m_cellLookupBuffer.clear();
+ }
+ /*
+ * 2. update row decorations
+ */
+ HashSet<ITableRow> set = m_rowDecorationBuffer;
+ m_rowDecorationBuffer = new HashSet<ITableRow>();
+ for (ITableRow row : set) {
+ if (row.getTable() == AbstractTable.this) {
+ applyRowDecorationsImpl(row);
+ }
+ }
+ /*
+ * check row filters
+ */
+ if (m_rowFilters.size() > 0) {
+ boolean filterChanged = false;
+ for (ITableRow row : set) {
+ if (row.getTable() == AbstractTable.this) {
+ if (row instanceof InternalTableRow) {
+ InternalTableRow irow = (InternalTableRow) row;
+ boolean oldFlag = irow.isFilterAccepted();
+ applyRowFiltersInternal(irow);
+ boolean newFlag = irow.isFilterAccepted();
+ filterChanged = filterChanged || (oldFlag != newFlag);
+ }
+ }
+ }
+ if (filterChanged) {
+ fireRowFilterChanged();
+ }
+ }
+ }
+
+ private int m_processEventBufferLoopDetection;
+
+ /**
+ * Fire events in form of one batch<br>
+ * fire all buffered events<br>
+ * coalesce all TableEvents of same type and sort according to their type
+ */
+ private void processEventBuffer() {
+ //loop detection
+ try {
+ m_processEventBufferLoopDetection++;
+ if (m_processEventBufferLoopDetection > 100) {
+ LOG.error("LOOP DETECTION in " + getClass() + ". see stack trace for more details.", new Exception("LOOP DETECTION"));
+ return;
+ }
+ //
+ ArrayList<TableEvent> list = m_tableEventBuffer;
+ m_tableEventBuffer = new ArrayList<TableEvent>();
+ if (list.size() > 0) {
+ HashMap<Integer, List<TableEvent>> coalesceMap = new HashMap<Integer, List<TableEvent>>();
+ for (TableEvent e : list) {
+ List<TableEvent> subList = coalesceMap.get(e.getType());
+ if (subList == null) {
+ subList = new ArrayList<TableEvent>();
+ coalesceMap.put(e.getType(), subList);
+ }
+ subList.add(e);
+ }
+ TreeMap<Integer, TableEvent> sortedCoalescedMap = new TreeMap<Integer, TableEvent>();
+ for (Map.Entry<Integer, List<TableEvent>> entry : coalesceMap.entrySet()) {
+ int type = entry.getKey();
+ List<TableEvent> subList = entry.getValue();
+ int lastIndex = subList.size() - 1;
+ switch (type) {
+ case TableEvent.TYPE_ALL_ROWS_DELETED: {
+ ArrayList<TableEvent> singleList = new ArrayList<TableEvent>(1);
+ singleList.add(subList.get(lastIndex));// use last
+ sortedCoalescedMap.put(10, coalesceTableEvents(singleList, false, true));
+ break;
+ }
+ case TableEvent.TYPE_ROWS_DELETED: {
+ sortedCoalescedMap.put(20, coalesceTableEvents(subList, false, true));// merge
+ break;
+ }
+ case TableEvent.TYPE_ROWS_INSERTED: {
+ sortedCoalescedMap.put(30, coalesceTableEvents(subList, true, false));// merge
+ break;
+ }
+ case TableEvent.TYPE_ROWS_UPDATED: {
+ sortedCoalescedMap.put(40, coalesceTableEvents(subList, true, false));// merge
+ break;
+ }
+ case TableEvent.TYPE_COLUMN_HEADERS_UPDATED: {
+ sortedCoalescedMap.put(60, coalesceTableEvents(subList, false, false));// merge
+ break;
+ }
+ case TableEvent.TYPE_COLUMN_ORDER_CHANGED: {
+ sortedCoalescedMap.put(70, coalesceTableEvents(subList, false, false));// merge
+ break;
+ }
+ case TableEvent.TYPE_COLUMN_STRUCTURE_CHANGED: {
+ sortedCoalescedMap.put(80, subList.get(lastIndex));// use last
+ break;
+ }
+ case TableEvent.TYPE_ROW_ORDER_CHANGED: {
+ sortedCoalescedMap.put(90, subList.get(lastIndex));// use last
+ break;
+ }
+ case TableEvent.TYPE_ROWS_DRAG_REQUEST: {
+ sortedCoalescedMap.put(100, subList.get(lastIndex));// use last
+ break;
+ }
+ case TableEvent.TYPE_ROW_DROP_ACTION: {
+ sortedCoalescedMap.put(110, subList.get(lastIndex));// use last
+ break;
+ }
+ case TableEvent.TYPE_HEADER_POPUP: {
+ sortedCoalescedMap.put(130, subList.get(lastIndex));// use last
+ break;
+ }
+ case TableEvent.TYPE_EMPTY_SPACE_POPUP: {
+ sortedCoalescedMap.put(140, subList.get(lastIndex));// use last
+ break;
+ }
+ case TableEvent.TYPE_ROW_POPUP: {
+ sortedCoalescedMap.put(150, subList.get(lastIndex));// use last
+ break;
+ }
+ case TableEvent.TYPE_ROW_ACTION: {
+ sortedCoalescedMap.put(160, subList.get(lastIndex));// use last
+ break;
+ }
+ case TableEvent.TYPE_ROWS_SELECTED: {
+ sortedCoalescedMap.put(170, subList.get(lastIndex));// use last
+ break;
+ }
+ case TableEvent.TYPE_SCROLL_TO_SELECTION: {
+ sortedCoalescedMap.put(180, subList.get(lastIndex));// use last
+ break;
+ }
+ default: {
+ sortedCoalescedMap.put(-type, subList.get(lastIndex));// use last
+ }
+ }
+ }
+ // fire the batch and set tree to changing, otherwise a listener might trigger another events that then are processed before all other listeners received that batch
+ try {
+ setTableChanging(true);
+ //
+ fireTableEventBatchInternal(sortedCoalescedMap.values().toArray(new TableEvent[0]));
+ }
+ finally {
+ setTableChanging(false);
+ }
+ }
+ }
+ finally {
+ m_processEventBufferLoopDetection--;
+ }
+ }
+
+ private TableEvent coalesceTableEvents(List<TableEvent> list, boolean includeExistingRows, boolean includeRemovedRows) {
+ if (list.size() == 1) {
+ return list.get(0);
+ }
+ else {
+ TableEvent last = list.get(list.size() - 1);
+ TableEvent ce = new TableEvent(last.getTable(), last.getType());
+ //
+ ce.setSortInMemoryAllowed(last.isSortInMemoryAllowed());
+ ce.setDragObject(last.getDragObject());
+ ce.setDropObject(last.getDropObject());
+ ce.setCopyObject(last.getCopyObject());
+ ce.addPopupMenus(last.getPopupMenus());
+ //columns
+ HashSet<IColumn> colList = new HashSet<IColumn>();
+ for (TableEvent t : list) {
+ if (t.getColumns() != null) {
+ colList.addAll(Arrays.asList(t.getColumns()));
+ }
+ }
+ ce.setColumns(colList.toArray(new IColumn<?>[0]));
+ //rows
+ HashSet<ITableRow> rowList = new HashSet<ITableRow>();
+ for (TableEvent t : list) {
+ if (t.getRowCount() > 0) {
+ for (ITableRow row : t.getRows()) {
+ if (row.getTable() == AbstractTable.this && includeExistingRows) {
+ rowList.add(row);
+ }
+ else if (row.getTable() != AbstractTable.this && includeRemovedRows) {
+ rowList.add(row);
+ }
+ }
+ }
+ }
+ ce.setRows(rowList.toArray(new ITableRow[0]));
+ //
+ return ce;
+ }
+ }
+
+ /**
+ * do decoration and filtering later
+ */
+ private void enqueueDecorationTasks(ITableRow row) {
+ if (row != null) {
+ for (int i = 0; i < row.getCellCount(); i++) {
+ IColumn<?> column = getColumnSet().getColumn(i);
+ // lookups
+ if (column instanceof ISmartColumn) {
+ ISmartColumn<?> smartColumn = (ISmartColumn<?>) column;
+ if (smartColumn.getLookupCall() != null) {
+ m_cellLookupBuffer.add(new P_CellLookup(row, smartColumn));
+ }
+ }
+ }
+ m_rowDecorationBuffer.add(row);
+ }
+ }
+
+ /*
+ * does not use setTableChanging()
+ */
+ private void applyRowDecorationsImpl(ITableRow tableRow) {
+ // disable row changed trigger on row
+ try {
+ tableRow.setRowChanging(true);
+ //
+ // row decorator on table
+ this.decorateRow(tableRow);
+ // row decorator on columns
+ ColumnSet cset = getColumnSet();
+ for (int c = 0; c < tableRow.getCellCount(); c++) {
+ // cell decorator on column
+ IColumn<?> col = cset.getColumn(c);
+ col.decorateCell(tableRow);
+ // cell decorator on table
+ this.decorateCell(tableRow, col);
+ }
+ }
+ catch (Throwable t) {
+ LOG.error("Error occured while applying row decoration", t);
+ }
+ finally {
+ tableRow.setRowPropertiesChanged(false);
+ tableRow.setRowChanging(false);
+ }
+ }
+
+ private void applyLookupResult(InternalTableRow tableRow, int columnIndex, LookupRow[] result) {
+ // disable row changed trigger on row
+ try {
+ tableRow.setRowChanging(true);
+ //
+ Cell cell = (Cell) tableRow.getCell(columnIndex);
+ if (result.length == 1) {
+ cell.setText(result[0].getText());
+ cell.setTooltipText(result[0].getTooltipText());
+ }
+ else if (result.length > 1) {
+ StringBuffer buf = new StringBuffer();
+ StringBuffer bufTooltip = new StringBuffer();
+ for (int i = 0; i < result.length; i++) {
+ if (i > 0) {
+ if (isMultilineText()) {
+ buf.append("\n");
+ bufTooltip.append("\n");
+ }
+ else {
+ buf.append(", ");
+ bufTooltip.append(", ");
+ }
+ }
+ buf.append(result[i].getText());
+ bufTooltip.append(result[i].getTooltipText());
+ }
+ cell.setText(buf.toString());
+ cell.setTooltipText(bufTooltip.toString());
+ }
+ else {
+ cell.setText("");
+ cell.setTooltipText("");
+ }
+ }
+ finally {
+ tableRow.setRowPropertiesChanged(false);
+ tableRow.setRowChanging(false);
+ }
+ }
+
+ @Override
+ public void tablePopulated() {
+ if (m_tableEventBuffer.isEmpty()) {
+ synchronized (m_cachedFilteredRowsLock) {
+ m_cachedFilteredRows = null;
+ }
+ fireTableEventInternal(new TableEvent(this, TableEvent.TYPE_TABLE_POPULATED, null));
+ }
+ }
+
+ @Override
+ public ITableRow resolveRow(ITableRow row) {
+ if (row == null) {
+ return null;
+ }
+ if (!(row instanceof InternalTableRow)) {
+ throw new IllegalArgumentException("only accept InternalTableRow, not " + (row != null ? row.getClass() : null));
+ }
+ // check owner
+ if (row.getTable() == this) {
+ return row;
+ }
+ else {
+ return null;
+ }
+ }
+
+ @Override
+ public ITableRow[] resolveRows(ITableRow[] rows) {
+ if (rows == null) {
+ rows = new ITableRow[0];
+ }
+ int mismatchCount = 0;
+ for (int i = 0; i < rows.length; i++) {
+ if (resolveRow(rows[i]) != rows[i]) {
+ LOG.warn("could not resolve row " + rows[i]);
+ mismatchCount++;
+ }
+ }
+ if (mismatchCount > 0) {
+ ITableRow[] resolvedRows = new ITableRow[rows.length - mismatchCount];
+ int index = 0;
+ for (int i = 0; i < rows.length; i++) {
+ if (resolveRow(rows[i]) == rows[i]) {
+ resolvedRows[index] = rows[i];
+ index++;
+ }
+ }
+ rows = resolvedRows;
+ }
+ return rows;
+ }
+
+ @Override
+ public boolean isHeaderVisible() {
+ return propertySupport.getPropertyBool(PROP_HEADER_VISIBLE);
+ }
+
+ @Override
+ public void setHeaderVisible(boolean b) {
+ propertySupport.setPropertyBool(PROP_HEADER_VISIBLE, b);
+ }
+
+ @Override
+ public final void decorateCell(ITableRow row, IColumn<?> col) {
+ Cell cell = row.getCellForUpdate(col.getColumnIndex());
+ decorateCellInternal(cell, row, col);
+ try {
+ execDecorateCell(cell, row, col);
+ }
+ catch (ProcessingException e) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ catch (Throwable t) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Unexpected", t));
+ }
+ }
+
+ protected void decorateCellInternal(Cell view, ITableRow row, IColumn<?> col) {
+ }
+
+ @Override
+ public final void decorateRow(ITableRow row) {
+ decorateRowInternal(row);
+ try {
+ execDecorateRow(row);
+ }
+ catch (ProcessingException e) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ catch (Throwable t) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Unexpected", t));
+ }
+ }
+
+ protected void decorateRowInternal(ITableRow row) {
+ // icon
+ if (row.getIconId() == null) {
+ String s = getDefaultIconId();
+ if (s != null) {
+ row.setIconId(s);
+ }
+ }
+ }
+
+ /**
+ * Called when the columns are reset.
+ * <p>
+ * Subclasses can override this method. The default does nothing.
+ *
+ * @param visiblity
+ * {@code true} if the visibility is reset.
+ * @param order
+ * {@code true} if the order is reset.
+ * @param sorting
+ * {@code true} if the sorting is reset.
+ * @param widths
+ * {@code true} if the column widths are reset.
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(90)
+ protected void execResetColumns(boolean visibility, boolean order, boolean sorting, boolean widths) throws ProcessingException {
+ }
+
+ /**
+ * Model Observer
+ */
+ @Override
+ public void addTableListener(TableListener listener) {
+ m_listenerList.add(TableListener.class, listener);
+ }
+
+ @Override
+ public void removeTableListener(TableListener listener) {
+ m_listenerList.remove(TableListener.class, listener);
+ }
+
+ @Override
+ public void addUITableListener(TableListener listener) {
+ m_listenerList.insertAtFront(TableListener.class, listener);
+ }
+
+ protected IEventHistory<TableEvent> createEventHistory() {
+ return new DefaultTableEventHistory(5000L);
+ }
+
+ @Override
+ public IEventHistory<TableEvent> getEventHistory() {
+ return m_eventHistory;
+ }
+
+ @Override
+ public IMenu[] fetchMenusForRowsInternal(ITableRow[] rows) {
+ TableEvent e;
+ if (rows.length == 0) {
+ e = new TableEvent(this, TableEvent.TYPE_EMPTY_SPACE_POPUP);
+ }
+ else {
+ e = new TableEvent(this, TableEvent.TYPE_ROW_POPUP, rows);
+ }
+ fireTableEventInternal(e);
+ return e.getPopupMenus();
+ }
+
+ private void fireRowsInserted(ITableRow[] rows) {
+ synchronized (m_cachedFilteredRowsLock) {
+ m_cachedFilteredRows = null;
+ }
+ fireTableEventInternal(new TableEvent(this, TableEvent.TYPE_ROWS_INSERTED, rows));
+ }
+
+ private void fireRowsUpdated(ITableRow[] rows) {
+ synchronized (m_cachedFilteredRowsLock) {
+ m_cachedFilteredRows = null;
+ }
+ fireTableEventInternal(new TableEvent(this, TableEvent.TYPE_ROWS_UPDATED, rows));
+ }
+
+ /**
+ * Request to reload/replace table data with refreshed data
+ */
+ private void fireRowsDeleted(ITableRow[] rows) {
+ synchronized (m_cachedFilteredRowsLock) {
+ m_cachedFilteredRows = null;
+ }
+ fireTableEventInternal(new TableEvent(this, TableEvent.TYPE_ROWS_DELETED, rows));
+ }
+
+ private void fireAllRowsDeleted(ITableRow[] rows) {
+ synchronized (m_cachedFilteredRowsLock) {
+ m_cachedFilteredRows = null;
+ }
+ fireTableEventInternal(new TableEvent(this, TableEvent.TYPE_ALL_ROWS_DELETED, rows));
+ }
+
+ private void fireRowsSelected(ITableRow[] rows) {
+ fireTableEventInternal(new TableEvent(this, TableEvent.TYPE_ROWS_SELECTED, rows));
+ }
+
+ private void fireRowClick(ITableRow row) {
+ if (row != null) {
+ try {
+ interceptRowClickSingleObserver(row);
+ execRowClick(row);
+ }
+ catch (ProcessingException ex) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(ex);
+ }
+ catch (Throwable t) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Unexpected", t));
+ }
+ }
+ }
+
+ protected void interceptRowClickSingleObserver(ITableRow row) throws ProcessingException {
+ // single observer for checkable tables
+ // if row click is targetted to cell editor, do not interpret click as check/uncheck event
+ if (row.isEnabled() && isEnabled()) {
+ IColumn<?> ctxCol = getContextColumn();
+ if (isCellEditable(row, ctxCol)) {
+ //cell-level checkbox
+ if (ctxCol instanceof IBooleanColumn) {
+ //editable boolean columns consume this click
+ IFormField field = ctxCol.prepareEdit(row);
+ if (field instanceof IBooleanField) {
+ IBooleanField bfield = (IBooleanField) field;
+ bfield.setChecked(!bfield.isChecked());
+ ctxCol.completeEdit(row, field);
+ }
+ }
+ else {
+ //other editable columns have no effect HERE, the ui will open an editor
+ }
+ }
+ else {
+ //row-level checkbox
+ if (isCheckable()) {
+ row.setChecked(!row.isChecked());
+ }
+ }
+ }
+ }
+
+ private void fireRowAction(ITableRow row) {
+ if (!m_actionRunning) {
+ try {
+ m_actionRunning = true;
+ if (row != null) {
+ try {
+ execRowAction(row);
+ }
+ catch (ProcessingException ex) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(ex);
+ }
+ catch (Throwable t) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Unexpected", t));
+ }
+ }
+ }
+ finally {
+ m_actionRunning = false;
+ }
+ }
+ }
+
+ private void fireRowOrderChanged() {
+ synchronized (m_cachedFilteredRowsLock) {
+ m_cachedFilteredRows = null;
+ }
+ fireTableEventInternal(new TableEvent(this, TableEvent.TYPE_ROW_ORDER_CHANGED, getRows()));
+ }
+
+ private void fireRequestFocus() {
+ fireTableEventInternal(new TableEvent(this, TableEvent.TYPE_REQUEST_FOCUS));
+ }
+
+ private void fireRequestFocusInCell(IColumn<?> column, ITableRow row) {
+ TableEvent e = new TableEvent(this, TableEvent.TYPE_REQUEST_FOCUS_IN_CELL);
+ e.setColumns(new IColumn<?>[]{column});
+ e.setRows(new ITableRow[]{row});
+ fireTableEventInternal(e);
+ }
+
+ private void fireRowFilterChanged() {
+ synchronized (m_cachedFilteredRowsLock) {
+ m_cachedFilteredRows = null;
+ }
+ fireTableEventInternal(new TableEvent(this, TableEvent.TYPE_ROW_FILTER_CHANGED));
+ }
+
+ private TransferObject fireRowsDragRequest() {
+ ITableRow[] rows = getSelectedRows();
+ if (rows != null && rows.length > 0) {
+ TableEvent e = new TableEvent(this, TableEvent.TYPE_ROWS_DRAG_REQUEST, rows);
+ fireTableEventInternal(e);
+ return e.getDragObject();
+ }
+ else {
+ return null;
+ }
+ }
+
+ private void fireRowDropAction(ITableRow row, TransferObject dropData) {
+ ITableRow[] rows = null;
+ if (row != null) {
+ rows = new ITableRow[]{row};
+ }
+ TableEvent e = new TableEvent(this, TableEvent.TYPE_ROW_DROP_ACTION, rows);
+ e.setDropObject(dropData);
+ fireTableEventInternal(e);
+ }
+
+ private TransferObject fireRowsCopyRequest() {
+ ITableRow[] rows = getSelectedRows();
+ if (rows != null && rows.length > 0) {
+ TableEvent e = new TableEvent(this, TableEvent.TYPE_ROWS_COPY_REQUEST, rows);
+ fireTableEventInternal(e);
+ return e.getCopyObject();
+ }
+ else {
+ return null;
+ }
+ }
+
+ private IMenu[] fireEmptySpacePopup() {
+ TableEvent e = new TableEvent(this, TableEvent.TYPE_EMPTY_SPACE_POPUP);
+ fireTableEventInternal(e);
+ return e.getPopupMenus();
+ }
+
+ private IMenu[] fireRowPopup() {
+ TableEvent e = new TableEvent(this, TableEvent.TYPE_ROW_POPUP, getSelectedRows());
+ fireTableEventInternal(e);
+ return e.getPopupMenus();
+ }
+
+ private void addLocalPopupMenus(TableEvent e) {
+ boolean singleSelect = getSelectedRowCount() == 1;
+ boolean multiSelect = getSelectedRowCount() >= 2;
+ boolean allRowsEnabled = true;
+ for (ITableRow row : getSelectedRows()) {
+ if (!row.isEnabled()) {
+ allRowsEnabled = false;
+ break;
+ }
+ }
+ IMenu[] a = getMenus();
+ for (IMenu menu : a) {
+ IMenu validMenu = null;
+ switch (e.getType()) {
+ case TableEvent.TYPE_HEADER_POPUP:
+ case TableEvent.TYPE_EMPTY_SPACE_POPUP: {
+ if (menu.isEmptySpaceAction()) {
+ if ((!menu.isInheritAccessibility()) || (isEnabled())) {
+ validMenu = menu;
+ }
+ }
+ break;
+ }
+ case TableEvent.TYPE_ROW_POPUP: {
+ if (multiSelect) {
+ if (menu.isMultiSelectionAction()) {
+ if ((!menu.isInheritAccessibility()) || (isEnabled() && allRowsEnabled)) {
+ validMenu = menu;
+ }
+ }
+ }
+ else if (singleSelect) {
+ if (menu.isSingleSelectionAction()) {
+ if ((!menu.isInheritAccessibility()) || (isEnabled() && allRowsEnabled)) {
+ validMenu = menu;
+ }
+ }
+ }
+ break;
+ }
+ }
+ if (validMenu != null) {
+ validMenu.prepareAction();
+ if (validMenu.isVisible()) {
+ e.addPopupMenu(validMenu);
+ }
+ }
+ }
+ }
+
+ /**
+ * Called before the header menus are displayed.
+ * <p>
+ * Subclasses can override this method. The default add menus for add, modifying and removing custom column and menus
+ * for reseting, organizing and filtering the columns.
+ *
+ * @param e
+ * Table event of type {@link TableEvent#TYPE_HEADER_POPUP}.
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(100)
+ protected void execAddHeaderMenus(TableEvent e) throws ProcessingException {
+ if (getTableCustomizer() != null) {
+ if (e.getPopupMenuCount() > 0) {
+ e.addPopupMenu(new MenuSeparator());
+ }
+ for (IMenu m : new IMenu[]{new AddCustomColumnMenu(this), new ModifyCustomColumnMenu(this), new RemoveCustomColumnMenu(this)}) {
+ m.prepareAction();
+ if (m.isVisible()) {
+ e.addPopupMenu(m);
+ }
+ }
+ }
+ if (e.getPopupMenuCount() > 0) {
+ e.addPopupMenu(new MenuSeparator());
+ }
+ for (IMenu m : new IMenu[]{new ResetColumnsMenu(this), new OrganizeColumnsMenu(this), new ColumnFilterMenu(this), new CopyWidthsOfColumnsMenu(this)}) {
+ m.prepareAction();
+ if (m.isVisible()) {
+ e.addPopupMenu(m);
+ }
+ }
+ }
+
+ private IMenu[] fireHeaderPopup() {
+ TableEvent e = new TableEvent(this, TableEvent.TYPE_HEADER_POPUP);
+ fireTableEventInternal(e);
+ try {
+ execAddHeaderMenus(e);
+ }
+ catch (ProcessingException ex) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(ex);
+ }
+ return e.getPopupMenus();
+ }
+
+ // main handler
+ protected void fireTableEventInternal(TableEvent e) {
+ if (isTableChanging()) {
+ // buffer the event for later batch firing
+ m_tableEventBuffer.add(e);
+ }
+ else {
+ EventListener[] listeners = m_listenerList.getListeners(TableListener.class);
+ if (listeners != null && listeners.length > 0) {
+ for (int i = 0; i < listeners.length; i++) {
+ try {
+ ((TableListener) listeners[i]).tableChanged(e);
+ }
+ catch (Throwable t) {
+ LOG.error("fire " + e, t);
+ }
+ }
+ }
+ }
+ }
+
+ // batch handler
+ private void fireTableEventBatchInternal(TableEvent[] batch) {
+ if (batch.length == 0) {
+ return;
+ }
+ if (batch.length > 0) {
+ EventListener[] listeners = m_listenerList.getListeners(TableListener.class);
+ if (listeners != null && listeners.length > 0) {
+ for (int i = 0; i < listeners.length; i++) {
+ ((TableListener) listeners[i]).tableChangedBatch(batch);
+ }
+ }
+ }
+ }
+
+ protected boolean handleKeyStroke(String keyName, char keyChar) {
+ if (keyName == null) {
+ return false;
+ }
+ keyName = keyName.toLowerCase();
+ // check if there is no menu keystroke with that name
+ for (IMenu m : getMenus()) {
+ if (m.getKeyStroke() != null && m.getKeyStroke().equalsIgnoreCase(keyName)) {
+ return false;
+ }
+ }
+ // check if there is no keystroke with that name (ticket 78234)
+ for (IKeyStroke k : getKeyStrokes()) {
+ if (k.getKeyStroke() != null && k.getKeyStroke().equalsIgnoreCase(keyName)) {
+ return false;
+ }
+ }
+ if (keyChar > ' ' && (!keyName.contains("control")) && (!keyName.contains("ctrl")) && (!keyName.contains("alt"))) {
+ // select first/next line with corresponding character
+ String newText = "" + Character.toLowerCase(keyChar);
+ m_keyStrokeBuffer.append(newText);
+ String prefix = m_keyStrokeBuffer.getText();
+
+ IColumn<?> col = getContextColumn();
+ if (col == null) {
+ IColumn<?>[] sortCols = getColumnSet().getSortColumns();
+ if (sortCols.length > 0) {
+ col = sortCols[sortCols.length - 1];
+ }
+ else {
+ TreeMap<CompositeObject, IColumn<?>> sortMap = new TreeMap<CompositeObject, IColumn<?>>();
+ int index = 0;
+ for (IColumn<?> c : getColumnSet().getVisibleColumns()) {
+ if (c.getDataType() == String.class) {
+ sortMap.put(new CompositeObject(1, index), c);
+ }
+ else if (c.getDataType() == Boolean.class) {
+ sortMap.put(new CompositeObject(3, index), c);
+ }
+ else {
+ sortMap.put(new CompositeObject(2, index), c);
+ }
+ index++;
+ }
+ if (sortMap.size() > 0) {
+ col = sortMap.get(sortMap.firstKey());
+ }
+ }
+ }
+ if (col != null) {
+ int colIndex = col.getColumnIndex();
+ String pattern = StringUtility.toRegExPattern(prefix.toLowerCase());
+ pattern = pattern + ".*";
+ if (LOG.isInfoEnabled()) {
+ LOG.info("finding regex:" + pattern + " in column " + getColumnSet().getColumn(colIndex).getHeaderCell().getText());
+ }
+ // loop over values and find matching one
+ int rowCount = getRowCount();
+ ITableRow selRow = getSelectedRow();
+ int startIndex = 0;
+ if (selRow != null) {
+ if (prefix.length() <= 1) {
+ startIndex = selRow.getRowIndex() + 1;
+ }
+ else {
+ startIndex = selRow.getRowIndex();
+ }
+ }
+ for (int i = 0; i < rowCount; i++) {
+ ITableRow row = m_rows.get((startIndex + i) % rowCount);
+ String text = row.getCell(colIndex).getText();
+ if (text != null && text.toLowerCase().matches(pattern)) {
+ // handled
+ selectRow(row, false);
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public ITableUIFacade getUIFacade() {
+ return m_uiFacade;
+ }
+
+ /*
+ * UI Notifications
+ */
+ protected class P_TableUIFacade implements ITableUIFacade {
+ private int m_uiProcessorCount = 0;
+
+ protected void pushUIProcessor() {
+ m_uiProcessorCount++;
+ }
+
+ protected void popUIProcessor() {
+ m_uiProcessorCount--;
+ }
+
+ @Override
+ public boolean isUIProcessing() {
+ return m_uiProcessorCount > 0;
+ }
+
+ @Override
+ public void fireRowClickFromUI(ITableRow row) {
+ try {
+ pushUIProcessor();
+ //
+ row = resolveRow(row);
+ if (row != null) {
+ fireRowClick(resolveRow(row));
+ }
+ }
+ finally {
+ popUIProcessor();
+ }
+ }
+
+ @Override
+ public void fireRowActionFromUI(ITableRow row) {
+ try {
+ pushUIProcessor();
+ //
+ row = resolveRow(row);
+ if (row != null) {
+ fireRowAction(row);
+ }
+ }
+ finally {
+ popUIProcessor();
+ }
+ }
+
+ @Override
+ public IMenu[] fireRowPopupFromUI() {
+ try {
+ pushUIProcessor();
+ //
+ return fireRowPopup();
+ }
+ finally {
+ popUIProcessor();
+ }
+ }
+
+ @Override
+ public IMenu[] fireEmptySpacePopupFromUI() {
+ try {
+ pushUIProcessor();
+ //
+ return fireEmptySpacePopup();
+ }
+ finally {
+ popUIProcessor();
+ }
+ }
+
+ @Override
+ public IMenu[] fireHeaderPopupFromUI() {
+ try {
+ pushUIProcessor();
+ //
+ return fireHeaderPopup();
+ }
+ finally {
+ popUIProcessor();
+ }
+ }
+
+ @Override
+ public boolean fireKeyTypedFromUI(String keyStrokeText, char keyChar) {
+ try {
+ pushUIProcessor();
+ //
+ return handleKeyStroke(keyStrokeText, keyChar);
+ }
+ finally {
+ popUIProcessor();
+ }
+ }
+
+ @Override
+ public void fireVisibleColumnsChangedFromUI(IColumn<?>[] visibleColumns) {
+ try {
+ pushUIProcessor();
+ //
+ getColumnSet().setVisibleColumns(visibleColumns);
+ ClientUIPreferences.getInstance().setAllTableColumnPreferences(AbstractTable.this);
+ }
+ finally {
+ popUIProcessor();
+ }
+ }
+
+ @Override
+ public void fireColumnMovedFromUI(IColumn<?> c, int toViewIndex) {
+ try {
+ pushUIProcessor();
+ //
+ c = getColumnSet().resolveColumn(c);
+ if (c != null) {
+ getColumnSet().moveColumnToVisibleIndex(c.getColumnIndex(), toViewIndex);
+ ClientUIPreferences.getInstance().setAllTableColumnPreferences(AbstractTable.this);
+ }
+ }
+ finally {
+ popUIProcessor();
+ }
+ }
+
+ @Override
+ public void setColumnWidthFromUI(IColumn<?> c, int newWidth) {
+ try {
+ pushUIProcessor();
+ //
+ c = getColumnSet().resolveColumn(c);
+ if (c != null) {
+ c.setWidthInternal(newWidth);
+ ClientUIPreferences.getInstance().setAllTableColumnPreferences(AbstractTable.this);
+ }
+ }
+ finally {
+ popUIProcessor();
+ }
+ }
+
+ @Override
+ public void fireHeaderSortFromUI(IColumn<?> c, boolean multiSort) {
+ try {
+ pushUIProcessor();
+ //
+ if (isSortEnabled()) {
+ c = getColumnSet().resolveColumn(c);
+ if (c != null) {
+ getColumnSet().handleSortEvent(c, multiSort);
+ ClientUIPreferences.getInstance().setAllTableColumnPreferences(AbstractTable.this);
+ sort();
+ }
+ }
+ }
+ finally {
+ popUIProcessor();
+ }
+ }
+
+ @Override
+ public void setSelectedRowsFromUI(ITableRow[] rows) {
+ try {
+ pushUIProcessor();
+ //
+ HashSet<ITableRow> requestedRows = new HashSet<ITableRow>(Arrays.asList(resolveRows(rows)));
+ ArrayList<ITableRow> validRows = new ArrayList<ITableRow>();
+ // add existing selected rows that are masked by filter
+ for (ITableRow row : getSelectedRows()) {
+ if (!row.isFilterAccepted()) {
+ validRows.add(row);
+ }
+ }
+ // remove all filtered from requested
+ requestedRows.removeAll(validRows);
+ // add remainder
+ for (ITableRow row : requestedRows) {
+ validRows.add(row);
+ }
+ selectRows(validRows.toArray(new ITableRow[validRows.size()]), false);
+ }
+ finally {
+ popUIProcessor();
+ }
+ }
+
+ @Override
+ public TransferObject fireRowsDragRequestFromUI() {
+ try {
+ pushUIProcessor();
+ return fireRowsDragRequest();
+ }
+ finally {
+ popUIProcessor();
+ }
+ }
+
+ @Override
+ public void fireRowDropActionFromUI(ITableRow row, TransferObject dropData) {
+ try {
+ pushUIProcessor();
+ row = resolveRow(row);
+ fireRowDropAction(row, dropData);
+ }
+ finally {
+ popUIProcessor();
+ }
+ }
+
+ @Override
+ public TransferObject fireRowsCopyRequestFromUI() {
+ try {
+ pushUIProcessor();
+ return fireRowsCopyRequest();
+ }
+ finally {
+ popUIProcessor();
+ }
+ }
+
+ @Override
+ public void fireHyperlinkActionFromUI(ITableRow row, IColumn<?> col, URL url) {
+ try {
+ pushUIProcessor();
+ //
+ doHyperlinkAction(resolveRow(row), col, url);
+ }
+ catch (ProcessingException e) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ finally {
+ popUIProcessor();
+ }
+ }
+
+ @Override
+ public void setContextColumnFromUI(IColumn<?> col) {
+ try {
+ pushUIProcessor();
+ //
+ if (col != null && col.getTable() != AbstractTable.this) {
+ col = null;
+ }
+ setContextColumn(col);
+ }
+ finally {
+ popUIProcessor();
+ }
+ }
+
+ @Override
+ public IFormField prepareCellEditFromUI(ITableRow row, IColumn<?> col) {
+ try {
+ pushUIProcessor();
+ //
+ m_editContext = null;
+ row = resolveRow(row);
+ if (row != null && col != null) {
+ try {
+ // ensure the editable row to be selected.
+ // This is crucial if the cell's value is changed right away in @{link IColumn#prepareEdit(ITableRow)}, e.g. in @{link AbstractBooleanColumn}
+ row.getTable().selectRow(row);
+ IFormField f = col.prepareEdit(row);
+ if (f != null) {
+ m_editContext = new P_CellEditorContext(row, col, f);
+ }
+ return f;
+ }
+ catch (ProcessingException e) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ catch (Throwable t) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Unexpected", t));
+ }
+ }
+ }
+ finally {
+ popUIProcessor();
+ }
+ return null;
+ }
+
+ @Override
+ public void completeCellEditFromUI() {
+ try {
+ pushUIProcessor();
+ //
+ if (m_editContext != null) {
+ try {
+ m_editContext.getColumn().completeEdit(m_editContext.getRow(), m_editContext.getFormField());
+ }
+ catch (ProcessingException e) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ catch (Throwable t) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Unexpected", t));
+ }
+ finally {
+ m_editContext = null;
+ }
+ }
+ }
+ finally {
+ popUIProcessor();
+ }
+ }
+
+ @Override
+ public void cancelCellEditFromUI() {
+ try {
+ pushUIProcessor();
+ //
+ m_editContext = null;
+ }
+ finally {
+ popUIProcessor();
+ }
+ }
+
+ }
+
+ private class P_CellLookup {
+ private final ITableRow m_row;
+ private final ISmartColumn<?> m_column;
+
+ public P_CellLookup(ITableRow row, ISmartColumn<?> col) {
+ m_row = row;
+ m_column = col;
+ }
+
+ public ITableRow getRow() {
+ return m_row;
+ }
+
+ public ISmartColumn<?> getColumn() {
+ return m_column;
+ }
+ }// end private class
+
+ private class P_TableRowBuilder extends AbstractTableRowBuilder {
+
+ @Override
+ protected ITableRow createEmptyTableRow() {
+ return new TableRow(getColumnSet());
+ }
+
+ }
+
+ private class P_TableListener extends TableAdapter {
+ @Override
+ public void tableChanged(TableEvent e) {
+ switch (e.getType()) {
+ case TableEvent.TYPE_EMPTY_SPACE_POPUP: {
+ // single observer for table-defined menus
+ addLocalPopupMenus(e);
+ break;
+ }
+ case TableEvent.TYPE_HEADER_POPUP: {
+ // single observer for table-owned menus
+ addLocalPopupMenus(e);
+ break;
+ }
+ case TableEvent.TYPE_ROW_POPUP: {
+ // single observer for table-defined menus
+ addLocalPopupMenus(e);
+ break;
+ }
+ case TableEvent.TYPE_ROWS_SELECTED: {
+ // single observer exec
+ try {
+ execRowsSelected(e.getRows());
+ }
+ catch (ProcessingException ex) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(ex);
+ }
+ catch (Throwable t) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Unexpected", t));
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ private static class P_CellEditorContext {
+ private final ITableRow m_row;
+ private final IColumn<?> m_column;
+ private final IFormField m_formField;
+
+ public P_CellEditorContext(ITableRow row, IColumn<?> col, IFormField f) {
+ m_row = row;
+ m_column = col;
+ m_formField = f;
+ }
+
+ public ITableRow getRow() {
+ return m_row;
+ }
+
+ public IColumn<?> getColumn() {
+ return m_column;
+ }
+
+ public IFormField getFormField() {
+ return m_formField;
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/AbstractTableRowBuilder.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/AbstractTableRowBuilder.java
index a1161d82db..4c28d9d3e1 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/AbstractTableRowBuilder.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/AbstractTableRowBuilder.java
@@ -1,157 +1,157 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table;
-
-import java.lang.reflect.Array;
-import java.util.Collection;
-import java.util.concurrent.atomic.AtomicReference;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
-import org.eclipse.scout.rt.shared.services.common.code.ICode;
-import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
-
-public abstract class AbstractTableRowBuilder {
-
- public ITableRow createTableRow(LookupRow dataRow) throws ProcessingException {
- ITableRow tableRow = createEmptyTableRow();
- tableRow.setEnabled(dataRow.isEnabled());
- Cell cell = tableRow.getCellForUpdate(1);
- if (dataRow.getTooltipText() != null) {
- cell.setTooltipText(dataRow.getTooltipText());
- }
- if (dataRow.getIconId() != null) {
- cell.setIconId(dataRow.getIconId());
- }
- if (dataRow.getBackgroundColor() != null) {
- cell.setBackgroundColor(dataRow.getBackgroundColor());
- }
- if (dataRow.getForegroundColor() != null) {
- cell.setForegroundColor(dataRow.getForegroundColor());
- }
- if (dataRow.getFont() != null) {
- cell.setFont(dataRow.getFont());
- }
- tableRow.setStatusNonchanged();
- return tableRow;
- }
-
- public ITableRow createRow() throws ProcessingException {
- return createEmptyTableRow();
- }
-
- public ITableRow createRow(Object rowValues) throws ProcessingException {
- if (!rowValues.getClass().isArray()) {
- throw new IllegalArgumentException("argument must be an array value []");
- }
- ITableRow row = createEmptyTableRow();
- for (int c = 0, nc = Array.getLength(rowValues); c < nc; c++) {
- row.setCellValue(c, Array.get(rowValues, c));
- }
- return row;
- }
-
- public ITableRow[] createRowsByArray(Object dataArray) throws ProcessingException {
- return createRowsByArray(dataArray, ITableRow.STATUS_INSERTED);
- }
-
- public ITableRow[] createRowsByArray(Object dataArray, int rowStatus) throws ProcessingException {
- if (dataArray == null) {
- dataArray = new Object[0];
- }
- if (dataArray instanceof Collection) {
- dataArray = ((Collection) dataArray).toArray();
- }
- if (!dataArray.getClass().isArray()) {
- throw new IllegalArgumentException("argument must be a matrix value [][]");
- }
- ITableRow[] rows = new ITableRow[Array.getLength(dataArray)];
- for (int r = 0; r < rows.length; r++) {
- rows[r] = createRow(new Object[]{Array.get(dataArray, r)});
- }
- return rows;
- }
-
- /**
- * Performance note:<br>
- * Since the matrix may contain large amount of data, the Object[][] can be passed as new
- * AtomicReference<Object>(Object[][])
- * so that the further processing can set the content of the holder to null while processing.
- */
- public ITableRow[] createRowsByMatrix(Object dataMatrixOrReference) throws ProcessingException {
- return createRowsByMatrix(dataMatrixOrReference, ITableRow.STATUS_INSERTED);
- }
-
- /**
- * Performance note:<br>
- * Since the matrix may contain large amount of data, the Object[][] can be passed as new
- * AtomicReference<Object>(Object[][])
- * so that the further processing can set the content of the holder to null while processing.
- */
- public ITableRow[] createRowsByMatrix(Object dataMatrixOrReference, int rowStatus) throws ProcessingException {
- Object dataMatrix;
- boolean isRef;
- if (dataMatrixOrReference instanceof AtomicReference<?>) {
- isRef = true;
- dataMatrix = ((AtomicReference<?>) dataMatrixOrReference).get();
- }
- else {
- isRef = false;
- dataMatrix = dataMatrixOrReference;
- }
- if (dataMatrix == null) {
- dataMatrix = new Object[0][0];
- }
- if (!dataMatrix.getClass().isArray()) {
- throw new IllegalArgumentException("argument must be a matrix value [][]");
- }
- //
- ITableRow[] rows = new ITableRow[Array.getLength(dataMatrix)];
- if (isRef) {
- Object[] refData = new Object[rows.length];
- for (int r = 0; r < rows.length; r++) {
- refData[r] = Array.get(dataMatrix, r);
- }
- //clear the atomic reference
- dataMatrix = null;
- ((AtomicReference<?>) dataMatrixOrReference).set(null);
- dataMatrix = null;
- for (int r = 0; r < rows.length; r++) {
- rows[r] = createRow(refData[r]);
- //clear the row immediately to help gc
- refData[r] = null;
- rows[r].setStatus(rowStatus);
- }
- }
- else {
- for (int r = 0; r < rows.length; r++) {
- rows[r] = createRow(Array.get(dataMatrix, r));
- rows[r].setStatus(rowStatus);
- }
- }
- return rows;
- }
-
- public ITableRow[] createRowsByCodes(ICode[] codes) throws ProcessingException {
- ITableRow[] rows = new ITableRow[codes.length];
- for (int i = 0; i < rows.length; i++) {
- rows[i] = createRow(new Object[]{codes[i].getId(), codes[i].getText()});
- rows[i].setIconId(codes[i].getIconId());
- rows[i].setBackgroundColor(codes[i].getBackgroundColor());
- rows[i].setForegroundColor(codes[i].getForegroundColor());
- rows[i].setFont(codes[i].getFont());
- }
- return rows;
- }
-
- protected abstract ITableRow createEmptyTableRow();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table;
+
+import java.lang.reflect.Array;
+import java.util.Collection;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
+import org.eclipse.scout.rt.shared.services.common.code.ICode;
+import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
+
+public abstract class AbstractTableRowBuilder {
+
+ public ITableRow createTableRow(LookupRow dataRow) throws ProcessingException {
+ ITableRow tableRow = createEmptyTableRow();
+ tableRow.setEnabled(dataRow.isEnabled());
+ Cell cell = tableRow.getCellForUpdate(1);
+ if (dataRow.getTooltipText() != null) {
+ cell.setTooltipText(dataRow.getTooltipText());
+ }
+ if (dataRow.getIconId() != null) {
+ cell.setIconId(dataRow.getIconId());
+ }
+ if (dataRow.getBackgroundColor() != null) {
+ cell.setBackgroundColor(dataRow.getBackgroundColor());
+ }
+ if (dataRow.getForegroundColor() != null) {
+ cell.setForegroundColor(dataRow.getForegroundColor());
+ }
+ if (dataRow.getFont() != null) {
+ cell.setFont(dataRow.getFont());
+ }
+ tableRow.setStatusNonchanged();
+ return tableRow;
+ }
+
+ public ITableRow createRow() throws ProcessingException {
+ return createEmptyTableRow();
+ }
+
+ public ITableRow createRow(Object rowValues) throws ProcessingException {
+ if (!rowValues.getClass().isArray()) {
+ throw new IllegalArgumentException("argument must be an array value []");
+ }
+ ITableRow row = createEmptyTableRow();
+ for (int c = 0, nc = Array.getLength(rowValues); c < nc; c++) {
+ row.setCellValue(c, Array.get(rowValues, c));
+ }
+ return row;
+ }
+
+ public ITableRow[] createRowsByArray(Object dataArray) throws ProcessingException {
+ return createRowsByArray(dataArray, ITableRow.STATUS_INSERTED);
+ }
+
+ public ITableRow[] createRowsByArray(Object dataArray, int rowStatus) throws ProcessingException {
+ if (dataArray == null) {
+ dataArray = new Object[0];
+ }
+ if (dataArray instanceof Collection) {
+ dataArray = ((Collection) dataArray).toArray();
+ }
+ if (!dataArray.getClass().isArray()) {
+ throw new IllegalArgumentException("argument must be a matrix value [][]");
+ }
+ ITableRow[] rows = new ITableRow[Array.getLength(dataArray)];
+ for (int r = 0; r < rows.length; r++) {
+ rows[r] = createRow(new Object[]{Array.get(dataArray, r)});
+ }
+ return rows;
+ }
+
+ /**
+ * Performance note:<br>
+ * Since the matrix may contain large amount of data, the Object[][] can be passed as new
+ * AtomicReference<Object>(Object[][])
+ * so that the further processing can set the content of the holder to null while processing.
+ */
+ public ITableRow[] createRowsByMatrix(Object dataMatrixOrReference) throws ProcessingException {
+ return createRowsByMatrix(dataMatrixOrReference, ITableRow.STATUS_INSERTED);
+ }
+
+ /**
+ * Performance note:<br>
+ * Since the matrix may contain large amount of data, the Object[][] can be passed as new
+ * AtomicReference<Object>(Object[][])
+ * so that the further processing can set the content of the holder to null while processing.
+ */
+ public ITableRow[] createRowsByMatrix(Object dataMatrixOrReference, int rowStatus) throws ProcessingException {
+ Object dataMatrix;
+ boolean isRef;
+ if (dataMatrixOrReference instanceof AtomicReference<?>) {
+ isRef = true;
+ dataMatrix = ((AtomicReference<?>) dataMatrixOrReference).get();
+ }
+ else {
+ isRef = false;
+ dataMatrix = dataMatrixOrReference;
+ }
+ if (dataMatrix == null) {
+ dataMatrix = new Object[0][0];
+ }
+ if (!dataMatrix.getClass().isArray()) {
+ throw new IllegalArgumentException("argument must be a matrix value [][]");
+ }
+ //
+ ITableRow[] rows = new ITableRow[Array.getLength(dataMatrix)];
+ if (isRef) {
+ Object[] refData = new Object[rows.length];
+ for (int r = 0; r < rows.length; r++) {
+ refData[r] = Array.get(dataMatrix, r);
+ }
+ //clear the atomic reference
+ dataMatrix = null;
+ ((AtomicReference<?>) dataMatrixOrReference).set(null);
+ dataMatrix = null;
+ for (int r = 0; r < rows.length; r++) {
+ rows[r] = createRow(refData[r]);
+ //clear the row immediately to help gc
+ refData[r] = null;
+ rows[r].setStatus(rowStatus);
+ }
+ }
+ else {
+ for (int r = 0; r < rows.length; r++) {
+ rows[r] = createRow(Array.get(dataMatrix, r));
+ rows[r].setStatus(rowStatus);
+ }
+ }
+ return rows;
+ }
+
+ public ITableRow[] createRowsByCodes(ICode[] codes) throws ProcessingException {
+ ITableRow[] rows = new ITableRow[codes.length];
+ for (int i = 0; i < rows.length; i++) {
+ rows[i] = createRow(new Object[]{codes[i].getId(), codes[i].getText()});
+ rows[i].setIconId(codes[i].getIconId());
+ rows[i].setBackgroundColor(codes[i].getBackgroundColor());
+ rows[i].setForegroundColor(codes[i].getForegroundColor());
+ rows[i].setFont(codes[i].getFont());
+ }
+ return rows;
+ }
+
+ protected abstract ITableRow createEmptyTableRow();
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/ColumnSet.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/ColumnSet.java
index 5337c75f7e..b9b2629bdb 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/ColumnSet.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/ColumnSet.java
@@ -1,1013 +1,1013 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.TreeMap;
-
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.commons.CompositeObject;
-import org.eclipse.scout.commons.ConfigurationUtility;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.ClientUIPreferences;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IStringColumn;
-import org.eclipse.scout.rt.shared.data.basic.table.SortSpec;
-
-public class ColumnSet {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(ColumnSet.class);
-
- private final AbstractTable m_table;
- private final IColumn[] m_columns;
- private final ArrayList<IColumn> m_userSortColumns;
- private final ArrayList<IColumn> m_permanentHeadSortColumns;
- private final ArrayList<IColumn> m_permanentTailSortColumns;
- /**
- * key index to model index
- */
- private int[] m_keyIndexes = new int[0];
- /**
- * view index to model index (regardless of visibility)
- */
- private int[] m_displayableIndexes = new int[0];
- /**
- * view index to model index (only visible columns)
- */
- private int[] m_visibleIndexes = new int[0];
- /**
- * class to model
- */
- private final HashMap<Class, IColumn> m_classIndexes = new HashMap<Class, IColumn>();
-
- /**
- * ID to model
- */
- private final HashMap<String, IColumn> m_idIndexes = new HashMap<String, IColumn>();
-
- public ColumnSet(AbstractTable table, Collection<IColumn> columns) {
- m_table = table;
- m_columns = new IColumn[columns.size()];
- m_userSortColumns = new ArrayList<IColumn>();
- m_permanentHeadSortColumns = new ArrayList<IColumn>();
- m_permanentTailSortColumns = new ArrayList<IColumn>();
- PropertyChangeListener columnListener = new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent e) {
- IColumn c = (IColumn) e.getSource();
- if (IColumn.PROP_VIEW_COLUMN_INDEX_HINT.equals(e.getPropertyName())) {
- //ignore
- }
- else if (IColumn.PROP_VIEW_ORDER.equals(e.getPropertyName())) {
- resetColumnsViewOrder();
- }
- else {
- updateColumnStructure(c);
- }
- }
- };
- int index = 0;
- for (IColumn col : columns) {
- if (col instanceof AbstractColumn) {
- ((AbstractColumn) col).setColumnIndexInternal(index);
- ((AbstractColumn) col).setTableInternal(m_table);
- }
- rebuildHeaderCell(col);
- m_columns[index] = col;
- m_classIndexes.put(col.getClass(), col);
- m_idIndexes.put(col.getColumnId(), col);
- col.addPropertyChangeListener(columnListener);
- index++;
- }
- reorganizeIndexes();
- }
-
- public void initialize() {
- ClientUIPreferences prefs = ClientUIPreferences.getInstance();
- //clean up visible column index hints, make as permutation of model indices
- int n = getColumnCount();
- TreeMap<CompositeObject, IColumn> sortMap = new TreeMap<CompositeObject, IColumn>();
- int viewIndex = 0;
- for (int modelIndex = 0; modelIndex < n; modelIndex++) {
- IColumn col = getColumn(modelIndex);
- double viewHint = col.getVisibleColumnIndexHint();
- if (viewHint < 0) {
- viewHint = col.getViewOrder();
- }
- if (viewHint < 0) {
- viewHint = viewIndex;
- }
- sortMap.put(new CompositeObject(viewHint, viewIndex), col);
- // next
- viewIndex++;
- }
- viewIndex = 0;
- for (Map.Entry<CompositeObject, IColumn> e : sortMap.entrySet()) {
- e.getValue().setVisibleColumnIndexHint(viewIndex);
- viewIndex++;
- }
- reorganizeIndexes();
- //initialize sorting
- sortMap.clear();
- int index = 0;
- for (IColumn col : getColumns()) {
- int sortIndex = -1;
- if (col.isInitialAlwaysIncludeSortAtBegin()) {
- sortIndex = col.getInitialSortIndex();
- if (sortIndex < 0) {
- LOG.warn("AlwaysIncludeSortAtBegin is set but no sort index configured. Table: " + m_table.getClass().getName());
- }
- }
- else if (col.isInitialAlwaysIncludeSortAtEnd()) {
- sortIndex = col.getInitialSortIndex();
- if (sortIndex < 0) {
- LOG.warn("AlwaysIncludeSortAtEnd is set but no sort index configured. Table: " + m_table.getClass().getName());
- }
- }
- else {
- sortIndex = prefs.getTableColumnSortIndex(col, col.getInitialSortIndex());
- }
- if (sortIndex >= 0) {
- sortMap.put(new CompositeObject(sortIndex, index), col);
- }
- index++;
- }
- //
- clearSortColumns();
- clearPermanentHeadSortColumns();
- clearPermanentTailSortColumns();
- for (IColumn col : sortMap.values()) {
- if (col.isInitialAlwaysIncludeSortAtBegin()) {
- boolean asc = col.isInitialSortAscending();
- addPermanentHeadSortColumn(col, asc);
- }
- else if (col.isInitialAlwaysIncludeSortAtEnd()) {
- boolean asc = col.isInitialSortAscending();
- addPermanentTailSortColumn(col, asc);
- }
- else {
- boolean asc = prefs.getTableColumnSortAscending(col, col.isInitialSortAscending());
- addSortColumn(col, asc);
- }
- }
- //restore explicit flag on user sort columns (after sort is built)
- for (IColumn col : getUserSortColumns()) {
- Boolean explicit = prefs.getTableColumnSortExplicit(col);
- if (explicit != null) {
- HeaderCell cell = (HeaderCell) col.getHeaderCell();
- cell.setSortExplicit(explicit.booleanValue());
- }
- }
- /*
- * ticket 93309
- * sanity check: when there is no visible column at all, reset visibilities to model init defaults
- */
- if (getVisibleColumnCount() == 0) {
- viewIndex = 0;
- for (IColumn c : getColumns()) {
- if (c.isDisplayable() && c.isInitialVisible()) {
- c.setVisible(true);
- }
- else {
- c.setVisible(false);
- }
- c.setWidth(c.getInitialWidth());
- c.setVisibleColumnIndexHint(viewIndex);
- prefs.removeTableColumnPreferences(c);
- //next
- viewIndex++;
- }
- reorganizeIndexes();
- }
- checkMultiline();
- }
-
- public int getColumnCount() {
- return m_columns.length;
- }
-
- public int getKeyColumnCount() {
- return m_keyIndexes.length;
- }
-
- public int getDisplayableColumnCount() {
- return m_displayableIndexes.length;
- }
-
- public int getVisibleColumnCount() {
- return m_visibleIndexes.length;
- }
-
- public int[] getKeyColumnIndexes() {
- int[] a = new int[m_keyIndexes.length];
- System.arraycopy(m_keyIndexes, 0, a, 0, a.length);
- return a;
- }
-
- public int[] getAllColumnIndexes() {
- int[] a = new int[m_columns.length];
- for (int i = 0; i < a.length; i++) {
- a[i] = i;
- }
- return a;
- }
-
- public IColumn[] getAllColumnsInUserOrder() {
- double[] visibleOrdersSorted = new double[getVisibleColumnCount()];
- IColumn[] visibleCols = getVisibleColumns();
- for (int i = 0; i < visibleOrdersSorted.length; i++) {
- visibleOrdersSorted[i] = visibleCols[i].getViewOrder();
- }
- Arrays.sort(visibleOrdersSorted);
- //
- int counter = 0;
- TreeMap<CompositeObject, IColumn> sortMap = new TreeMap<CompositeObject, IColumn>();
- for (int i = 0; i < visibleCols.length; i++) {
- sortMap.put(new CompositeObject(visibleOrdersSorted[i], counter++), visibleCols[i]);
- }
- //
- for (IColumn column : getColumns()) {
- if (column.isDisplayable() && column.isVisible()) {
- //already in map
- }
- else {
- sortMap.put(new CompositeObject(column.getViewOrder(), counter++), column);
- }
- }
- return sortMap.values().toArray(new IColumn[sortMap.size()]);
- }
-
- public int[] getDisplayableColumnIndexes() {
- int[] a = new int[m_displayableIndexes.length];
- System.arraycopy(m_displayableIndexes, 0, a, 0, a.length);
- return a;
- }
-
- public int[] getVisibleColumnIndexes() {
- int[] a = new int[m_visibleIndexes.length];
- System.arraycopy(m_visibleIndexes, 0, a, 0, a.length);
- return a;
- }
-
- public int getKeyColumnIndex(int keyIndex) {
- return m_keyIndexes[keyIndex];
- }
-
- public int getDisplayableColumnIndex(int displayableIndex) {
- return m_displayableIndexes[displayableIndex];
- }
-
- public int getVisibleColumnIndex(int visibleIndex) {
- return m_visibleIndexes[visibleIndex];
- }
-
- public IColumn getColumn(int index) {
- if (index >= 0 && index < m_columns.length) {
- return m_columns[index];
- }
- else {
- return null;
- }
- }
-
- @SuppressWarnings("unchecked")
- public <T extends IColumn> T getColumnByClass(Class<T> c) {
- T col = (T) m_classIndexes.get(c);
- return col;
- }
-
- @SuppressWarnings("unchecked")
- public <T extends IColumn> T getColumnById(String id) {
- return (T) m_idIndexes.get(id);
- }
-
- public IColumn getDisplayableColumn(int index) {
- if (index >= 0 && index < m_displayableIndexes.length) {
- return m_columns[m_displayableIndexes[index]];
- }
- else {
- return null;
- }
- }
-
- public IColumn getVisibleColumn(int index) {
- if (index >= 0 && index < m_visibleIndexes.length) {
- return m_columns[m_visibleIndexes[index]];
- }
- else {
- return null;
- }
- }
-
- public IColumn[] getColumns() {
- IColumn[] a = new IColumn[m_columns.length];
- System.arraycopy(m_columns, 0, a, 0, m_columns.length);
- return a;
- }
-
- public IColumn[] getKeyColumns() {
- IColumn[] a = new IColumn[m_keyIndexes.length];
- for (int i = 0; i < m_keyIndexes.length; i++) {
- a[i] = getColumn(m_keyIndexes[i]);
- }
- return a;
- }
-
- public IColumn[] getDisplayableColumns() {
- IColumn[] a = new IColumn[m_displayableIndexes.length];
- for (int i = 0; i < m_displayableIndexes.length; i++) {
- a[i] = getColumn(m_displayableIndexes[i]);
- }
- return a;
- }
-
- public IColumn[] getVisibleColumns() {
- IColumn[] a = new IColumn[m_visibleIndexes.length];
- for (int i = 0; i < m_visibleIndexes.length; i++) {
- a[i] = getColumn(m_visibleIndexes[i]);
- }
- return a;
- }
-
- public IColumn getFirstVisibleColumn() {
- if (m_visibleIndexes.length > 0) {
- return m_columns[m_visibleIndexes[0]];
- }
- else {
- return null;
- }
- }
-
- public IColumn getFirstDefinedVisibileColumn() {
- int colIdx = m_columns.length;
- for (int i = 0; i < m_visibleIndexes.length; i++) {
- if (CompareUtility.compareTo(m_visibleIndexes[i], colIdx) < 0) {
- colIdx = m_visibleIndexes[i];
- }
- }
- if (colIdx != m_columns.length) {
- return m_columns[colIdx];
- }
- else {
- return null;
- }
- }
-
- public IColumn[] getSummaryColumns() {
- ArrayList<IColumn> list = new ArrayList<IColumn>();
- for (IColumn c : getColumns()) {
- if (c.isSummary()) {
- list.add(c);
- }
- }
- return list.toArray(new IColumn[0]);
- }
-
- public int getIndexFor(IColumn column) {
- for (int i = 0; i < m_columns.length; i++) {
- if (m_columns[i] == column) {
- return i;
- }
- }
- return -1;
- }
-
- public void moveColumnToVisibleIndex(int fromIndex, int toVisibleIndex) {
- // find view index
- int fromVisibleIndex = modelToVisibleIndex(fromIndex);
- if (fromVisibleIndex >= 0 && toVisibleIndex >= 0) {
- moveVisibleColumnToVisibleIndex(fromVisibleIndex, toVisibleIndex);
- }
- }
-
- public void moveVisibleColumnToVisibleIndex(int fromVisibleIndex, int toVisibleIndex) {
- if (fromVisibleIndex != toVisibleIndex) {
- IColumn fromCol = getVisibleColumn(fromVisibleIndex);
- IColumn toCol = getVisibleColumn(toVisibleIndex);
- if (fromCol != null && toCol != null) {
- boolean traversedFrom = false;
- ArrayList<IColumn> list = new ArrayList<IColumn>();
- for (IColumn c : getAllColumnsInUserOrder()) {
- if (c == fromCol) {
- traversedFrom = true;
- //nop
- }
- else if (c == toCol) {
- if (traversedFrom) {
- list.add(c);
- list.add(fromCol);
- }
- else {
- list.add(fromCol);
- list.add(c);
- }
- }
- else {
- list.add(c);
- }
- }
- int viewHint = 0;
- for (IColumn c : list) {
- c.setVisibleColumnIndexHint(viewHint);
- viewHint++;
- }
- reorganizeIndexes();
- fireColumnOrderChanged();
- }
- }
- }
-
- /**
- * set visible columns and put them in specific order
- */
- public void setVisibleColumns(IColumn[] columns) {
- try {
- m_table.setTableChanging(true);
- //
- IColumn[] resolvedColumns = resolveColumns(columns);
- if (resolvedColumns.length > 0) {
- ArrayList<IColumn> newColumns = new ArrayList<IColumn>();
- for (IColumn col : columns) {
- if (col.isDisplayable()) {
- // sanity check
- if (col.getInitialWidth() == 0 && col.getWidth() == 0) {
- col.setInitialWidth(60);
- col.setWidth(60);
- }
- newColumns.add(col);
- }
- }
- int viewHint = 0;
- int nextNewIndex = 0;
- for (IColumn col : getAllColumnsInUserOrder()) {
- if (newColumns.contains(col)) {
- //use next in list since the list is pre-ordered
- IColumn nextSortedCol = newColumns.get(nextNewIndex);
- nextNewIndex++;
- nextSortedCol.setVisible(true);
- nextSortedCol.setVisibleColumnIndexHint(viewHint);
- }
- else {
- col.setVisible(false);
- col.setVisibleColumnIndexHint(viewHint);
- }
- viewHint++;
- }
- reorganizeIndexes();
- IColumn[] a = getDisplayableColumns();
- for (IColumn col : a) {
- rebuildHeaderCell(col);
- }
- fireColumnHeadersUpdated(a);
- fireColumnStructureChanged();
- checkMultiline();
- }
- }
- finally {
- m_table.setTableChanging(false);
- }
- }
-
- private int visibleToModelIndex(int visibleIndex) {
- if (visibleIndex < 0 || visibleIndex >= m_visibleIndexes.length) {
- LOG.warn("viewIndex " + visibleIndex + " out of range [" + 0 + "," + (m_visibleIndexes.length - 1) + "]");
- return -1;
- }
- return m_visibleIndexes[visibleIndex];
- }
-
- private int keyToModelIndex(int keyIndex) {
- if (keyIndex < 0 || keyIndex >= m_keyIndexes.length) {
- LOG.warn("keyIndex " + keyIndex + " out of range [" + 0 + "," + (m_keyIndexes.length - 1) + "]");
- return -1;
- }
- return m_keyIndexes[keyIndex];
- }
-
- private int modelToVisibleIndex(int index) {
- for (int i = 0; i < m_visibleIndexes.length; i++) {
- if (m_visibleIndexes[i] == index) {
- return i;
- }
- }
- return -1;
- }
-
- public IColumn resolveColumn(IColumn c) {
- if (c.getTable() == m_table) {
- return c;
- }
- else {
- return null;
- }
- }
-
- public IColumn[] resolveColumns(IColumn[] a) {
- ArrayList<IColumn> list = new ArrayList<IColumn>();
- if (a != null) {
- for (IColumn col : a) {
- IColumn resolvedCol = resolveColumn(col);
- if (resolvedCol != null) {
- list.add(resolvedCol);
- }
- }
- }
- return list.toArray(new IColumn[0]);
- }
-
- /*
- * Sorting
- */
-
- /**
- * @param column
- * @param multiSort
- * true = multiple sort columns are supported, every event toggles
- * the current column between the states ON-ASCENDING (add to tail of
- * sort columns), ON-DESCENDING. False = the selected column is set
- * as the (new) primary sort column, if already set it is toggled
- * between ascending and descending
- */
- public void handleSortEvent(IColumn col, boolean multiSort) {
- col = resolveColumn(col);
- if (col == null) {
- return;
- }
- //
- try {
- m_table.setTableChanging(true);
- //
- if (multiSort) {
- if (isSortColumn(col) && col.isSortExplicit()) {
- toggleSortColumn(col);
- }
- else {
- addSortColumn(col, true);
- }
- }
- else {
- int explicitCount = 0;
- for (IColumn c : m_userSortColumns) {
- if (c.isSortExplicit()) {
- explicitCount++;
- }
- }
- if (isSortColumn(col) && col.isSortExplicit() && explicitCount == 1) {
- toggleSortColumn(col);
- }
- else {
- setSortColumn(col, true, 5);
- }
- }
- }
- finally {
- m_table.setTableChanging(false);
- }
- }
-
- public int getSortColumnCount() {
- return m_userSortColumns.size() + m_permanentHeadSortColumns.size() + m_permanentTailSortColumns.size();
- }
-
- /**
- * @return all sort columns including permanent-head, user, permanent-tail
- */
- public IColumn[] getSortColumns() {
- ArrayList<IColumn> list = new ArrayList<IColumn>(getSortColumnCount());
- list.addAll(m_permanentHeadSortColumns);
- list.addAll(m_userSortColumns);
- list.addAll(m_permanentTailSortColumns);
- return list.toArray(new IColumn[list.size()]);
- }
-
- /**
- * @return only user sort columns
- */
- public IColumn<?>[] getUserSortColumns() {
- return m_userSortColumns.toArray(new IColumn[m_userSortColumns.size()]);
- }
-
- /**
- * @return only permanent head sort columns
- */
- public IColumn<?>[] getPermanentHeadSortColumns() {
- return m_permanentHeadSortColumns.toArray(new IColumn[m_permanentHeadSortColumns.size()]);
- }
-
- /**
- * @return only permanent tail sort columns
- */
- public IColumn<?>[] getPermanentTailSortColumns() {
- return m_permanentTailSortColumns.toArray(new IColumn[m_permanentTailSortColumns.size()]);
- }
-
- public SortSpec getSortSpec() {
- ArrayList<IColumn> sortColumns = new ArrayList<IColumn>();
- for (IColumn c : getSortColumns()) {
- if (c.isSortExplicit()) {
- sortColumns.add(c);
- }
- }
- if (sortColumns.size() > 0) {
- int[] indexes = new int[sortColumns.size()];
- boolean[] asc = new boolean[sortColumns.size()];
- for (int i = 0; i < sortColumns.size(); i++) {
- indexes[i] = sortColumns.get(i).getColumnIndex();
- asc[i] = sortColumns.get(i).isSortAscending();
- }
- return new SortSpec(indexes, asc);
- }
- else {
- return null;
- }
- }
-
- public void setSortSpec(SortSpec spec) {
- if (spec != null) {
- for (IColumn col : m_userSortColumns) {
- HeaderCell cell = (HeaderCell) col.getHeaderCell();
- cell.setSortActive(false);
- cell.setSortAscending(false);
- cell.setSortExplicit(false);
- }
- m_userSortColumns.clear();
- ArrayList<IColumn> colList = new ArrayList<IColumn>();
- for (int i = 0; i < spec.size(); i++) {
- IColumn col = getColumn(spec.getColumnIndex(i));
- if (col != null && (!isSortColumn(col))) {
- HeaderCell cell = (HeaderCell) col.getHeaderCell();
- cell.setSortActive(true);
- cell.setSortExplicit(true);
- cell.setSortAscending(spec.isColumnAscending(i));
- colList.add(col);
- }
- }
- m_userSortColumns.addAll(colList);
- for (IColumn col : colList) {
- rebuildHeaderCell(col);
- }
- fireColumnHeadersUpdated(colList.toArray(new IColumn[0]));
- }
- else {
- clearSortColumns();
- }
- }
-
- /**
- * @return true if the column is either a permanent-head, user or permanent-tail sort column
- */
- public boolean isSortColumn(IColumn col) {
- return m_permanentHeadSortColumns.contains(col) || m_userSortColumns.contains(col) || m_permanentTailSortColumns.contains(col);
- }
-
- /**
- * @return true if the column is a user sort column
- */
- public boolean isUserSortColumn(IColumn<?> col) {
- return m_userSortColumns.contains(col);
- }
-
- /**
- * @return true if the column is a permanent-head sort column
- */
- public boolean isPermanentHeadSortColumn(IColumn<?> col) {
- return m_permanentHeadSortColumns.contains(col);
- }
-
- /**
- * @return true if the column is a permanent-tail sort column
- */
- public boolean isPermanentTailSortColumn(IColumn<?> col) {
- return m_permanentTailSortColumns.contains(col);
- }
-
- /**
- * @return the absolut sort index
- */
- public int getSortColumnIndex(IColumn col) {
- if (isPermanentHeadSortColumn(col)) {
- return m_permanentHeadSortColumns.indexOf(col);
- }
- if (isUserSortColumn(col)) {
- return m_permanentHeadSortColumns.size() + m_userSortColumns.indexOf(col);
- }
- if (isPermanentTailSortColumn(col)) {
- return m_permanentHeadSortColumns.size() + m_userSortColumns.size() + m_permanentTailSortColumns.indexOf(col);
- }
- return -1;
- }
-
- /**
- * add column at beginning of sort columns but keep sort history of max
- * keepHistoryCount last columns
- * <p>
- * The column is added as a user sort column
- */
- public void setSortColumn(IColumn col, boolean ascending, int keepHistoryCount) {
- col = resolveColumn(col);
- if (col != null) {
- m_userSortColumns.remove(col);
- if (!isSortColumn(col)) {
- while (m_userSortColumns.size() > keepHistoryCount) {
- IColumn c = m_userSortColumns.remove(m_userSortColumns.size() - 1);
- HeaderCell cell = (HeaderCell) c.getHeaderCell();
- cell.setSortActive(false);
- cell.setSortExplicit(false);
- cell.setSortAscending(false);
- rebuildHeaderCell(c);
- }
- for (IColumn c : m_userSortColumns) {
- HeaderCell cell = (HeaderCell) c.getHeaderCell();
- cell.setSortExplicit(false);
- rebuildHeaderCell(c);
- }
- HeaderCell cell = (HeaderCell) col.getHeaderCell();
- cell.setSortActive(true);
- cell.setSortExplicit(true);
- cell.setSortAscending(ascending);
- m_userSortColumns.add(0, col);
- rebuildHeaderCell(col);
- fireColumnHeadersUpdated(new IColumn[]{col});
- }
- }
- }
-
- /**
- * add column to the user sort columns
- * <p>
- * see also {@link #addPermanentHeadSortColumn(IColumn, boolean)} and
- * {@link #addPermanentTailSortColumn(IColumn, boolean)}
- */
- public void addSortColumn(IColumn col, boolean ascending) {
- col = resolveColumn(col);
- if (col != null) {
- m_userSortColumns.remove(col);
- if (!isSortColumn(col)) {
- for (Iterator<IColumn> it = m_userSortColumns.iterator(); it.hasNext();) {
- IColumn c = it.next();
- if (!c.isSortExplicit()) {
- it.remove();
- HeaderCell cell = (HeaderCell) c.getHeaderCell();
- cell.setSortActive(false);
- cell.setSortExplicit(false);
- cell.setSortAscending(false);
- rebuildHeaderCell(c);
- }
- }
- HeaderCell cell = (HeaderCell) col.getHeaderCell();
- cell.setSortActive(true);
- cell.setSortExplicit(true);
- cell.setSortAscending(ascending);
- m_userSortColumns.add(col);
- rebuildHeaderCell(col);
- fireColumnHeadersUpdated(new IColumn[]{col});
- }
- }
- }
-
- public void toggleSortColumn(IColumn col) {
- col = resolveColumn(col);
- if (col != null && isSortColumn(col) && !col.isSortPermanent()) {
- HeaderCell cell = (HeaderCell) col.getHeaderCell();
- cell.setSortAscending(!cell.isSortAscending());
- rebuildHeaderCell(col);
- fireColumnHeadersUpdated(new IColumn[]{col});
- }
- }
-
- private void updateColumnStructure(IColumn column) {
- reorganizeIndexes();
- checkMultiline();
- fireColumnStructureChanged();
- }
-
- private void resetColumnsViewOrder() {
- for (IColumn c : getColumns()) {
- c.setVisibleColumnIndexHint(-1);
- }
- reorganizeIndexes();
- fireColumnOrderChanged();
- }
-
- public void updateColumn(IColumn column) {
- checkMultiline();
- fireColumnHeadersUpdated(new IColumn[]{column});
- }
-
- public void removeSortColumn(IColumn col) {
- col = resolveColumn(col);
- if (col != null) {
- m_userSortColumns.remove(col);
- if (!isSortColumn(col)) {
- HeaderCell cell = (HeaderCell) col.getHeaderCell();
- cell.setSortActive(false);
- cell.setSortExplicit(false);
- rebuildHeaderCell(col);
- fireColumnHeadersUpdated(new IColumn[]{col});
- }
- }
- }
-
- /**
- * only clears user sort columns.
- * <p>
- * see also {@link #clearPermanentHeadSortColumns()} and {@link #clearPermanentTailSortColumns()}
- */
- public void clearSortColumns() {
- if (m_userSortColumns.size() == 0) {
- return;
- }
- IColumn[] a = m_userSortColumns.toArray(new IColumn[m_userSortColumns.size()]);
- m_userSortColumns.clear();
- for (IColumn col : a) {
- HeaderCell cell = (HeaderCell) col.getHeaderCell();
- cell.setSortActive(false);
- cell.setSortExplicit(false);
- }
- for (IColumn c : a) {
- rebuildHeaderCell(c);
- }
- fireColumnHeadersUpdated(a);
- }
-
- public void clearPermanentHeadSortColumns() {
- if (m_permanentHeadSortColumns.size() == 0) {
- return;
- }
- IColumn[] a = m_permanentHeadSortColumns.toArray(new IColumn[m_permanentHeadSortColumns.size()]);
- m_permanentHeadSortColumns.clear();
- for (IColumn col : a) {
- HeaderCell cell = (HeaderCell) col.getHeaderCell();
- cell.setSortActive(false);
- cell.setSortExplicit(false);
- cell.setSortPermanent(false);
- }
- for (int i = 0; i < a.length; i++) {
- rebuildHeaderCell(a[i]);
- }
- fireColumnHeadersUpdated(a);
- }
-
- public void clearPermanentTailSortColumns() {
- if (m_permanentTailSortColumns.size() == 0) {
- return;
- }
- IColumn[] a = m_permanentTailSortColumns.toArray(new IColumn[m_permanentTailSortColumns.size()]);
- m_permanentTailSortColumns.clear();
- for (IColumn col : a) {
- HeaderCell cell = (HeaderCell) col.getHeaderCell();
- cell.setSortActive(false);
- cell.setSortExplicit(false);
- cell.setSortPermanent(false);
- }
- for (int i = 0; i < a.length; i++) {
- rebuildHeaderCell(a[i]);
- }
- fireColumnHeadersUpdated(a);
- }
-
- public void addPermanentHeadSortColumn(IColumn col, boolean ascending) {
- col = resolveColumn(col);
- if (col != null) {
- m_permanentHeadSortColumns.remove(col);
- //
- HeaderCell cell = (HeaderCell) col.getHeaderCell();
- cell.setSortActive(true);
- cell.setSortExplicit(true);
- cell.setSortPermanent(true);
- cell.setSortAscending(ascending);
- m_permanentHeadSortColumns.add(col);
- rebuildHeaderCell(col);
- fireColumnHeadersUpdated(new IColumn[]{col});
- }
- }
-
- public void addPermanentTailSortColumn(IColumn col, boolean ascending) {
- col = resolveColumn(col);
- if (col != null) {
- m_permanentTailSortColumns.remove(col);
- //
- HeaderCell cell = (HeaderCell) col.getHeaderCell();
- cell.setSortActive(true);
- cell.setSortExplicit(true);
- cell.setSortPermanent(true);
- cell.setSortAscending(ascending);
- m_permanentTailSortColumns.add(col);
- rebuildHeaderCell(col);
- fireColumnHeadersUpdated(new IColumn[]{col});
- }
- }
-
- /**
- * mapping int array functions
- */
- private void reorganizeIndexes() {
- int n = getColumnCount();
- int viewIndex;
- TreeMap<CompositeObject, Integer> sortMap;
- // displayable map
- viewIndex = 0;
- sortMap = new TreeMap<CompositeObject, Integer>();
- for (int modelIndex = 0; modelIndex < n; modelIndex++) {
- IColumn col = getColumn(modelIndex);
- if (col.isDisplayable()) {
- sortMap.put(new CompositeObject(modelIndex), modelIndex);
- }
- }
- m_displayableIndexes = new int[sortMap.size()];
- viewIndex = 0;
- for (int modelIndex : sortMap.values()) {
- m_displayableIndexes[viewIndex++] = modelIndex;
- }
- // visible map
- viewIndex = 0;
- sortMap = new TreeMap<CompositeObject, Integer>();
- for (int modelIndex = 0; modelIndex < n; modelIndex++) {
- IColumn col = getColumn(modelIndex);
- if (col.isDisplayable() && col.isVisible()) {
- double viewHint = col.getVisibleColumnIndexHint();
- if (viewHint < 0) {
- viewHint = col.getViewOrder();
- }
- if (viewHint < 0) {
- viewHint = viewIndex;
- }
- sortMap.put(new CompositeObject(viewHint, viewIndex), modelIndex);
- // next
- viewIndex++;
- }
- }
- m_visibleIndexes = new int[sortMap.size()];
- viewIndex = 0;
- for (int modelIndex : sortMap.values()) {
- m_visibleIndexes[viewIndex++] = modelIndex;
- }
- // key map
- n = getColumnCount();
- ArrayList<Integer> keyIndexes = new ArrayList<Integer>();
- for (int modelIndex = 0; modelIndex < n; modelIndex++) {
- IColumn col = getColumn(modelIndex);
- if (col.isPrimaryKey()) {
- keyIndexes.add(modelIndex);
- }
- }
- m_keyIndexes = new int[keyIndexes.size()];
- viewIndex = 0;
- for (int modelIndex : keyIndexes) {
- m_keyIndexes[viewIndex++] = modelIndex;
- }
- }
-
- private void rebuildHeaderCell(IColumn col) {
- col.decorateHeaderCell();
- }
-
- private void fireColumnHeadersUpdated(IColumn[] a) {
- TableEvent e = new TableEvent(m_table, TableEvent.TYPE_COLUMN_HEADERS_UPDATED);
- e.setColumns(a);
- m_table.fireTableEventInternal(e);
- }
-
- private void fireColumnOrderChanged() {
- TableEvent e = new TableEvent(m_table, TableEvent.TYPE_COLUMN_ORDER_CHANGED);
- m_table.fireTableEventInternal(e);
- }
-
- private void fireColumnStructureChanged() {
- TableEvent e = new TableEvent(m_table, TableEvent.TYPE_COLUMN_STRUCTURE_CHANGED);
- m_table.fireTableEventInternal(e);
- }
-
- private void checkMultiline() {
- if (m_table != null) {
- if (!m_table.isInitialMultilineText() && !ConfigurationUtility.isMethodOverwrite(AbstractTable.class, "getConfiguredMultilineText", null, this.getClass())) {
- //do automatic check for wrapping columns
- boolean m = false;
- for (IColumn<?> col : getVisibleColumns()) {
- if (col instanceof IStringColumn && ((IStringColumn) col).isTextWrap()) {
- m = true;
- break;
- }
- }
- m_table.setMultilineText(m);
- }
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.commons.CompositeObject;
+import org.eclipse.scout.commons.ConfigurationUtility;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.ClientUIPreferences;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IStringColumn;
+import org.eclipse.scout.rt.shared.data.basic.table.SortSpec;
+
+public class ColumnSet {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(ColumnSet.class);
+
+ private final AbstractTable m_table;
+ private final IColumn[] m_columns;
+ private final ArrayList<IColumn> m_userSortColumns;
+ private final ArrayList<IColumn> m_permanentHeadSortColumns;
+ private final ArrayList<IColumn> m_permanentTailSortColumns;
+ /**
+ * key index to model index
+ */
+ private int[] m_keyIndexes = new int[0];
+ /**
+ * view index to model index (regardless of visibility)
+ */
+ private int[] m_displayableIndexes = new int[0];
+ /**
+ * view index to model index (only visible columns)
+ */
+ private int[] m_visibleIndexes = new int[0];
+ /**
+ * class to model
+ */
+ private final HashMap<Class, IColumn> m_classIndexes = new HashMap<Class, IColumn>();
+
+ /**
+ * ID to model
+ */
+ private final HashMap<String, IColumn> m_idIndexes = new HashMap<String, IColumn>();
+
+ public ColumnSet(AbstractTable table, Collection<IColumn> columns) {
+ m_table = table;
+ m_columns = new IColumn[columns.size()];
+ m_userSortColumns = new ArrayList<IColumn>();
+ m_permanentHeadSortColumns = new ArrayList<IColumn>();
+ m_permanentTailSortColumns = new ArrayList<IColumn>();
+ PropertyChangeListener columnListener = new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent e) {
+ IColumn c = (IColumn) e.getSource();
+ if (IColumn.PROP_VIEW_COLUMN_INDEX_HINT.equals(e.getPropertyName())) {
+ //ignore
+ }
+ else if (IColumn.PROP_VIEW_ORDER.equals(e.getPropertyName())) {
+ resetColumnsViewOrder();
+ }
+ else {
+ updateColumnStructure(c);
+ }
+ }
+ };
+ int index = 0;
+ for (IColumn col : columns) {
+ if (col instanceof AbstractColumn) {
+ ((AbstractColumn) col).setColumnIndexInternal(index);
+ ((AbstractColumn) col).setTableInternal(m_table);
+ }
+ rebuildHeaderCell(col);
+ m_columns[index] = col;
+ m_classIndexes.put(col.getClass(), col);
+ m_idIndexes.put(col.getColumnId(), col);
+ col.addPropertyChangeListener(columnListener);
+ index++;
+ }
+ reorganizeIndexes();
+ }
+
+ public void initialize() {
+ ClientUIPreferences prefs = ClientUIPreferences.getInstance();
+ //clean up visible column index hints, make as permutation of model indices
+ int n = getColumnCount();
+ TreeMap<CompositeObject, IColumn> sortMap = new TreeMap<CompositeObject, IColumn>();
+ int viewIndex = 0;
+ for (int modelIndex = 0; modelIndex < n; modelIndex++) {
+ IColumn col = getColumn(modelIndex);
+ double viewHint = col.getVisibleColumnIndexHint();
+ if (viewHint < 0) {
+ viewHint = col.getViewOrder();
+ }
+ if (viewHint < 0) {
+ viewHint = viewIndex;
+ }
+ sortMap.put(new CompositeObject(viewHint, viewIndex), col);
+ // next
+ viewIndex++;
+ }
+ viewIndex = 0;
+ for (Map.Entry<CompositeObject, IColumn> e : sortMap.entrySet()) {
+ e.getValue().setVisibleColumnIndexHint(viewIndex);
+ viewIndex++;
+ }
+ reorganizeIndexes();
+ //initialize sorting
+ sortMap.clear();
+ int index = 0;
+ for (IColumn col : getColumns()) {
+ int sortIndex = -1;
+ if (col.isInitialAlwaysIncludeSortAtBegin()) {
+ sortIndex = col.getInitialSortIndex();
+ if (sortIndex < 0) {
+ LOG.warn("AlwaysIncludeSortAtBegin is set but no sort index configured. Table: " + m_table.getClass().getName());
+ }
+ }
+ else if (col.isInitialAlwaysIncludeSortAtEnd()) {
+ sortIndex = col.getInitialSortIndex();
+ if (sortIndex < 0) {
+ LOG.warn("AlwaysIncludeSortAtEnd is set but no sort index configured. Table: " + m_table.getClass().getName());
+ }
+ }
+ else {
+ sortIndex = prefs.getTableColumnSortIndex(col, col.getInitialSortIndex());
+ }
+ if (sortIndex >= 0) {
+ sortMap.put(new CompositeObject(sortIndex, index), col);
+ }
+ index++;
+ }
+ //
+ clearSortColumns();
+ clearPermanentHeadSortColumns();
+ clearPermanentTailSortColumns();
+ for (IColumn col : sortMap.values()) {
+ if (col.isInitialAlwaysIncludeSortAtBegin()) {
+ boolean asc = col.isInitialSortAscending();
+ addPermanentHeadSortColumn(col, asc);
+ }
+ else if (col.isInitialAlwaysIncludeSortAtEnd()) {
+ boolean asc = col.isInitialSortAscending();
+ addPermanentTailSortColumn(col, asc);
+ }
+ else {
+ boolean asc = prefs.getTableColumnSortAscending(col, col.isInitialSortAscending());
+ addSortColumn(col, asc);
+ }
+ }
+ //restore explicit flag on user sort columns (after sort is built)
+ for (IColumn col : getUserSortColumns()) {
+ Boolean explicit = prefs.getTableColumnSortExplicit(col);
+ if (explicit != null) {
+ HeaderCell cell = (HeaderCell) col.getHeaderCell();
+ cell.setSortExplicit(explicit.booleanValue());
+ }
+ }
+ /*
+ * ticket 93309
+ * sanity check: when there is no visible column at all, reset visibilities to model init defaults
+ */
+ if (getVisibleColumnCount() == 0) {
+ viewIndex = 0;
+ for (IColumn c : getColumns()) {
+ if (c.isDisplayable() && c.isInitialVisible()) {
+ c.setVisible(true);
+ }
+ else {
+ c.setVisible(false);
+ }
+ c.setWidth(c.getInitialWidth());
+ c.setVisibleColumnIndexHint(viewIndex);
+ prefs.removeTableColumnPreferences(c);
+ //next
+ viewIndex++;
+ }
+ reorganizeIndexes();
+ }
+ checkMultiline();
+ }
+
+ public int getColumnCount() {
+ return m_columns.length;
+ }
+
+ public int getKeyColumnCount() {
+ return m_keyIndexes.length;
+ }
+
+ public int getDisplayableColumnCount() {
+ return m_displayableIndexes.length;
+ }
+
+ public int getVisibleColumnCount() {
+ return m_visibleIndexes.length;
+ }
+
+ public int[] getKeyColumnIndexes() {
+ int[] a = new int[m_keyIndexes.length];
+ System.arraycopy(m_keyIndexes, 0, a, 0, a.length);
+ return a;
+ }
+
+ public int[] getAllColumnIndexes() {
+ int[] a = new int[m_columns.length];
+ for (int i = 0; i < a.length; i++) {
+ a[i] = i;
+ }
+ return a;
+ }
+
+ public IColumn[] getAllColumnsInUserOrder() {
+ double[] visibleOrdersSorted = new double[getVisibleColumnCount()];
+ IColumn[] visibleCols = getVisibleColumns();
+ for (int i = 0; i < visibleOrdersSorted.length; i++) {
+ visibleOrdersSorted[i] = visibleCols[i].getViewOrder();
+ }
+ Arrays.sort(visibleOrdersSorted);
+ //
+ int counter = 0;
+ TreeMap<CompositeObject, IColumn> sortMap = new TreeMap<CompositeObject, IColumn>();
+ for (int i = 0; i < visibleCols.length; i++) {
+ sortMap.put(new CompositeObject(visibleOrdersSorted[i], counter++), visibleCols[i]);
+ }
+ //
+ for (IColumn column : getColumns()) {
+ if (column.isDisplayable() && column.isVisible()) {
+ //already in map
+ }
+ else {
+ sortMap.put(new CompositeObject(column.getViewOrder(), counter++), column);
+ }
+ }
+ return sortMap.values().toArray(new IColumn[sortMap.size()]);
+ }
+
+ public int[] getDisplayableColumnIndexes() {
+ int[] a = new int[m_displayableIndexes.length];
+ System.arraycopy(m_displayableIndexes, 0, a, 0, a.length);
+ return a;
+ }
+
+ public int[] getVisibleColumnIndexes() {
+ int[] a = new int[m_visibleIndexes.length];
+ System.arraycopy(m_visibleIndexes, 0, a, 0, a.length);
+ return a;
+ }
+
+ public int getKeyColumnIndex(int keyIndex) {
+ return m_keyIndexes[keyIndex];
+ }
+
+ public int getDisplayableColumnIndex(int displayableIndex) {
+ return m_displayableIndexes[displayableIndex];
+ }
+
+ public int getVisibleColumnIndex(int visibleIndex) {
+ return m_visibleIndexes[visibleIndex];
+ }
+
+ public IColumn getColumn(int index) {
+ if (index >= 0 && index < m_columns.length) {
+ return m_columns[index];
+ }
+ else {
+ return null;
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T extends IColumn> T getColumnByClass(Class<T> c) {
+ T col = (T) m_classIndexes.get(c);
+ return col;
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T extends IColumn> T getColumnById(String id) {
+ return (T) m_idIndexes.get(id);
+ }
+
+ public IColumn getDisplayableColumn(int index) {
+ if (index >= 0 && index < m_displayableIndexes.length) {
+ return m_columns[m_displayableIndexes[index]];
+ }
+ else {
+ return null;
+ }
+ }
+
+ public IColumn getVisibleColumn(int index) {
+ if (index >= 0 && index < m_visibleIndexes.length) {
+ return m_columns[m_visibleIndexes[index]];
+ }
+ else {
+ return null;
+ }
+ }
+
+ public IColumn[] getColumns() {
+ IColumn[] a = new IColumn[m_columns.length];
+ System.arraycopy(m_columns, 0, a, 0, m_columns.length);
+ return a;
+ }
+
+ public IColumn[] getKeyColumns() {
+ IColumn[] a = new IColumn[m_keyIndexes.length];
+ for (int i = 0; i < m_keyIndexes.length; i++) {
+ a[i] = getColumn(m_keyIndexes[i]);
+ }
+ return a;
+ }
+
+ public IColumn[] getDisplayableColumns() {
+ IColumn[] a = new IColumn[m_displayableIndexes.length];
+ for (int i = 0; i < m_displayableIndexes.length; i++) {
+ a[i] = getColumn(m_displayableIndexes[i]);
+ }
+ return a;
+ }
+
+ public IColumn[] getVisibleColumns() {
+ IColumn[] a = new IColumn[m_visibleIndexes.length];
+ for (int i = 0; i < m_visibleIndexes.length; i++) {
+ a[i] = getColumn(m_visibleIndexes[i]);
+ }
+ return a;
+ }
+
+ public IColumn getFirstVisibleColumn() {
+ if (m_visibleIndexes.length > 0) {
+ return m_columns[m_visibleIndexes[0]];
+ }
+ else {
+ return null;
+ }
+ }
+
+ public IColumn getFirstDefinedVisibileColumn() {
+ int colIdx = m_columns.length;
+ for (int i = 0; i < m_visibleIndexes.length; i++) {
+ if (CompareUtility.compareTo(m_visibleIndexes[i], colIdx) < 0) {
+ colIdx = m_visibleIndexes[i];
+ }
+ }
+ if (colIdx != m_columns.length) {
+ return m_columns[colIdx];
+ }
+ else {
+ return null;
+ }
+ }
+
+ public IColumn[] getSummaryColumns() {
+ ArrayList<IColumn> list = new ArrayList<IColumn>();
+ for (IColumn c : getColumns()) {
+ if (c.isSummary()) {
+ list.add(c);
+ }
+ }
+ return list.toArray(new IColumn[0]);
+ }
+
+ public int getIndexFor(IColumn column) {
+ for (int i = 0; i < m_columns.length; i++) {
+ if (m_columns[i] == column) {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+ public void moveColumnToVisibleIndex(int fromIndex, int toVisibleIndex) {
+ // find view index
+ int fromVisibleIndex = modelToVisibleIndex(fromIndex);
+ if (fromVisibleIndex >= 0 && toVisibleIndex >= 0) {
+ moveVisibleColumnToVisibleIndex(fromVisibleIndex, toVisibleIndex);
+ }
+ }
+
+ public void moveVisibleColumnToVisibleIndex(int fromVisibleIndex, int toVisibleIndex) {
+ if (fromVisibleIndex != toVisibleIndex) {
+ IColumn fromCol = getVisibleColumn(fromVisibleIndex);
+ IColumn toCol = getVisibleColumn(toVisibleIndex);
+ if (fromCol != null && toCol != null) {
+ boolean traversedFrom = false;
+ ArrayList<IColumn> list = new ArrayList<IColumn>();
+ for (IColumn c : getAllColumnsInUserOrder()) {
+ if (c == fromCol) {
+ traversedFrom = true;
+ //nop
+ }
+ else if (c == toCol) {
+ if (traversedFrom) {
+ list.add(c);
+ list.add(fromCol);
+ }
+ else {
+ list.add(fromCol);
+ list.add(c);
+ }
+ }
+ else {
+ list.add(c);
+ }
+ }
+ int viewHint = 0;
+ for (IColumn c : list) {
+ c.setVisibleColumnIndexHint(viewHint);
+ viewHint++;
+ }
+ reorganizeIndexes();
+ fireColumnOrderChanged();
+ }
+ }
+ }
+
+ /**
+ * set visible columns and put them in specific order
+ */
+ public void setVisibleColumns(IColumn[] columns) {
+ try {
+ m_table.setTableChanging(true);
+ //
+ IColumn[] resolvedColumns = resolveColumns(columns);
+ if (resolvedColumns.length > 0) {
+ ArrayList<IColumn> newColumns = new ArrayList<IColumn>();
+ for (IColumn col : columns) {
+ if (col.isDisplayable()) {
+ // sanity check
+ if (col.getInitialWidth() == 0 && col.getWidth() == 0) {
+ col.setInitialWidth(60);
+ col.setWidth(60);
+ }
+ newColumns.add(col);
+ }
+ }
+ int viewHint = 0;
+ int nextNewIndex = 0;
+ for (IColumn col : getAllColumnsInUserOrder()) {
+ if (newColumns.contains(col)) {
+ //use next in list since the list is pre-ordered
+ IColumn nextSortedCol = newColumns.get(nextNewIndex);
+ nextNewIndex++;
+ nextSortedCol.setVisible(true);
+ nextSortedCol.setVisibleColumnIndexHint(viewHint);
+ }
+ else {
+ col.setVisible(false);
+ col.setVisibleColumnIndexHint(viewHint);
+ }
+ viewHint++;
+ }
+ reorganizeIndexes();
+ IColumn[] a = getDisplayableColumns();
+ for (IColumn col : a) {
+ rebuildHeaderCell(col);
+ }
+ fireColumnHeadersUpdated(a);
+ fireColumnStructureChanged();
+ checkMultiline();
+ }
+ }
+ finally {
+ m_table.setTableChanging(false);
+ }
+ }
+
+ private int visibleToModelIndex(int visibleIndex) {
+ if (visibleIndex < 0 || visibleIndex >= m_visibleIndexes.length) {
+ LOG.warn("viewIndex " + visibleIndex + " out of range [" + 0 + "," + (m_visibleIndexes.length - 1) + "]");
+ return -1;
+ }
+ return m_visibleIndexes[visibleIndex];
+ }
+
+ private int keyToModelIndex(int keyIndex) {
+ if (keyIndex < 0 || keyIndex >= m_keyIndexes.length) {
+ LOG.warn("keyIndex " + keyIndex + " out of range [" + 0 + "," + (m_keyIndexes.length - 1) + "]");
+ return -1;
+ }
+ return m_keyIndexes[keyIndex];
+ }
+
+ private int modelToVisibleIndex(int index) {
+ for (int i = 0; i < m_visibleIndexes.length; i++) {
+ if (m_visibleIndexes[i] == index) {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+ public IColumn resolveColumn(IColumn c) {
+ if (c.getTable() == m_table) {
+ return c;
+ }
+ else {
+ return null;
+ }
+ }
+
+ public IColumn[] resolveColumns(IColumn[] a) {
+ ArrayList<IColumn> list = new ArrayList<IColumn>();
+ if (a != null) {
+ for (IColumn col : a) {
+ IColumn resolvedCol = resolveColumn(col);
+ if (resolvedCol != null) {
+ list.add(resolvedCol);
+ }
+ }
+ }
+ return list.toArray(new IColumn[0]);
+ }
+
+ /*
+ * Sorting
+ */
+
+ /**
+ * @param column
+ * @param multiSort
+ * true = multiple sort columns are supported, every event toggles
+ * the current column between the states ON-ASCENDING (add to tail of
+ * sort columns), ON-DESCENDING. False = the selected column is set
+ * as the (new) primary sort column, if already set it is toggled
+ * between ascending and descending
+ */
+ public void handleSortEvent(IColumn col, boolean multiSort) {
+ col = resolveColumn(col);
+ if (col == null) {
+ return;
+ }
+ //
+ try {
+ m_table.setTableChanging(true);
+ //
+ if (multiSort) {
+ if (isSortColumn(col) && col.isSortExplicit()) {
+ toggleSortColumn(col);
+ }
+ else {
+ addSortColumn(col, true);
+ }
+ }
+ else {
+ int explicitCount = 0;
+ for (IColumn c : m_userSortColumns) {
+ if (c.isSortExplicit()) {
+ explicitCount++;
+ }
+ }
+ if (isSortColumn(col) && col.isSortExplicit() && explicitCount == 1) {
+ toggleSortColumn(col);
+ }
+ else {
+ setSortColumn(col, true, 5);
+ }
+ }
+ }
+ finally {
+ m_table.setTableChanging(false);
+ }
+ }
+
+ public int getSortColumnCount() {
+ return m_userSortColumns.size() + m_permanentHeadSortColumns.size() + m_permanentTailSortColumns.size();
+ }
+
+ /**
+ * @return all sort columns including permanent-head, user, permanent-tail
+ */
+ public IColumn[] getSortColumns() {
+ ArrayList<IColumn> list = new ArrayList<IColumn>(getSortColumnCount());
+ list.addAll(m_permanentHeadSortColumns);
+ list.addAll(m_userSortColumns);
+ list.addAll(m_permanentTailSortColumns);
+ return list.toArray(new IColumn[list.size()]);
+ }
+
+ /**
+ * @return only user sort columns
+ */
+ public IColumn<?>[] getUserSortColumns() {
+ return m_userSortColumns.toArray(new IColumn[m_userSortColumns.size()]);
+ }
+
+ /**
+ * @return only permanent head sort columns
+ */
+ public IColumn<?>[] getPermanentHeadSortColumns() {
+ return m_permanentHeadSortColumns.toArray(new IColumn[m_permanentHeadSortColumns.size()]);
+ }
+
+ /**
+ * @return only permanent tail sort columns
+ */
+ public IColumn<?>[] getPermanentTailSortColumns() {
+ return m_permanentTailSortColumns.toArray(new IColumn[m_permanentTailSortColumns.size()]);
+ }
+
+ public SortSpec getSortSpec() {
+ ArrayList<IColumn> sortColumns = new ArrayList<IColumn>();
+ for (IColumn c : getSortColumns()) {
+ if (c.isSortExplicit()) {
+ sortColumns.add(c);
+ }
+ }
+ if (sortColumns.size() > 0) {
+ int[] indexes = new int[sortColumns.size()];
+ boolean[] asc = new boolean[sortColumns.size()];
+ for (int i = 0; i < sortColumns.size(); i++) {
+ indexes[i] = sortColumns.get(i).getColumnIndex();
+ asc[i] = sortColumns.get(i).isSortAscending();
+ }
+ return new SortSpec(indexes, asc);
+ }
+ else {
+ return null;
+ }
+ }
+
+ public void setSortSpec(SortSpec spec) {
+ if (spec != null) {
+ for (IColumn col : m_userSortColumns) {
+ HeaderCell cell = (HeaderCell) col.getHeaderCell();
+ cell.setSortActive(false);
+ cell.setSortAscending(false);
+ cell.setSortExplicit(false);
+ }
+ m_userSortColumns.clear();
+ ArrayList<IColumn> colList = new ArrayList<IColumn>();
+ for (int i = 0; i < spec.size(); i++) {
+ IColumn col = getColumn(spec.getColumnIndex(i));
+ if (col != null && (!isSortColumn(col))) {
+ HeaderCell cell = (HeaderCell) col.getHeaderCell();
+ cell.setSortActive(true);
+ cell.setSortExplicit(true);
+ cell.setSortAscending(spec.isColumnAscending(i));
+ colList.add(col);
+ }
+ }
+ m_userSortColumns.addAll(colList);
+ for (IColumn col : colList) {
+ rebuildHeaderCell(col);
+ }
+ fireColumnHeadersUpdated(colList.toArray(new IColumn[0]));
+ }
+ else {
+ clearSortColumns();
+ }
+ }
+
+ /**
+ * @return true if the column is either a permanent-head, user or permanent-tail sort column
+ */
+ public boolean isSortColumn(IColumn col) {
+ return m_permanentHeadSortColumns.contains(col) || m_userSortColumns.contains(col) || m_permanentTailSortColumns.contains(col);
+ }
+
+ /**
+ * @return true if the column is a user sort column
+ */
+ public boolean isUserSortColumn(IColumn<?> col) {
+ return m_userSortColumns.contains(col);
+ }
+
+ /**
+ * @return true if the column is a permanent-head sort column
+ */
+ public boolean isPermanentHeadSortColumn(IColumn<?> col) {
+ return m_permanentHeadSortColumns.contains(col);
+ }
+
+ /**
+ * @return true if the column is a permanent-tail sort column
+ */
+ public boolean isPermanentTailSortColumn(IColumn<?> col) {
+ return m_permanentTailSortColumns.contains(col);
+ }
+
+ /**
+ * @return the absolut sort index
+ */
+ public int getSortColumnIndex(IColumn col) {
+ if (isPermanentHeadSortColumn(col)) {
+ return m_permanentHeadSortColumns.indexOf(col);
+ }
+ if (isUserSortColumn(col)) {
+ return m_permanentHeadSortColumns.size() + m_userSortColumns.indexOf(col);
+ }
+ if (isPermanentTailSortColumn(col)) {
+ return m_permanentHeadSortColumns.size() + m_userSortColumns.size() + m_permanentTailSortColumns.indexOf(col);
+ }
+ return -1;
+ }
+
+ /**
+ * add column at beginning of sort columns but keep sort history of max
+ * keepHistoryCount last columns
+ * <p>
+ * The column is added as a user sort column
+ */
+ public void setSortColumn(IColumn col, boolean ascending, int keepHistoryCount) {
+ col = resolveColumn(col);
+ if (col != null) {
+ m_userSortColumns.remove(col);
+ if (!isSortColumn(col)) {
+ while (m_userSortColumns.size() > keepHistoryCount) {
+ IColumn c = m_userSortColumns.remove(m_userSortColumns.size() - 1);
+ HeaderCell cell = (HeaderCell) c.getHeaderCell();
+ cell.setSortActive(false);
+ cell.setSortExplicit(false);
+ cell.setSortAscending(false);
+ rebuildHeaderCell(c);
+ }
+ for (IColumn c : m_userSortColumns) {
+ HeaderCell cell = (HeaderCell) c.getHeaderCell();
+ cell.setSortExplicit(false);
+ rebuildHeaderCell(c);
+ }
+ HeaderCell cell = (HeaderCell) col.getHeaderCell();
+ cell.setSortActive(true);
+ cell.setSortExplicit(true);
+ cell.setSortAscending(ascending);
+ m_userSortColumns.add(0, col);
+ rebuildHeaderCell(col);
+ fireColumnHeadersUpdated(new IColumn[]{col});
+ }
+ }
+ }
+
+ /**
+ * add column to the user sort columns
+ * <p>
+ * see also {@link #addPermanentHeadSortColumn(IColumn, boolean)} and
+ * {@link #addPermanentTailSortColumn(IColumn, boolean)}
+ */
+ public void addSortColumn(IColumn col, boolean ascending) {
+ col = resolveColumn(col);
+ if (col != null) {
+ m_userSortColumns.remove(col);
+ if (!isSortColumn(col)) {
+ for (Iterator<IColumn> it = m_userSortColumns.iterator(); it.hasNext();) {
+ IColumn c = it.next();
+ if (!c.isSortExplicit()) {
+ it.remove();
+ HeaderCell cell = (HeaderCell) c.getHeaderCell();
+ cell.setSortActive(false);
+ cell.setSortExplicit(false);
+ cell.setSortAscending(false);
+ rebuildHeaderCell(c);
+ }
+ }
+ HeaderCell cell = (HeaderCell) col.getHeaderCell();
+ cell.setSortActive(true);
+ cell.setSortExplicit(true);
+ cell.setSortAscending(ascending);
+ m_userSortColumns.add(col);
+ rebuildHeaderCell(col);
+ fireColumnHeadersUpdated(new IColumn[]{col});
+ }
+ }
+ }
+
+ public void toggleSortColumn(IColumn col) {
+ col = resolveColumn(col);
+ if (col != null && isSortColumn(col) && !col.isSortPermanent()) {
+ HeaderCell cell = (HeaderCell) col.getHeaderCell();
+ cell.setSortAscending(!cell.isSortAscending());
+ rebuildHeaderCell(col);
+ fireColumnHeadersUpdated(new IColumn[]{col});
+ }
+ }
+
+ private void updateColumnStructure(IColumn column) {
+ reorganizeIndexes();
+ checkMultiline();
+ fireColumnStructureChanged();
+ }
+
+ private void resetColumnsViewOrder() {
+ for (IColumn c : getColumns()) {
+ c.setVisibleColumnIndexHint(-1);
+ }
+ reorganizeIndexes();
+ fireColumnOrderChanged();
+ }
+
+ public void updateColumn(IColumn column) {
+ checkMultiline();
+ fireColumnHeadersUpdated(new IColumn[]{column});
+ }
+
+ public void removeSortColumn(IColumn col) {
+ col = resolveColumn(col);
+ if (col != null) {
+ m_userSortColumns.remove(col);
+ if (!isSortColumn(col)) {
+ HeaderCell cell = (HeaderCell) col.getHeaderCell();
+ cell.setSortActive(false);
+ cell.setSortExplicit(false);
+ rebuildHeaderCell(col);
+ fireColumnHeadersUpdated(new IColumn[]{col});
+ }
+ }
+ }
+
+ /**
+ * only clears user sort columns.
+ * <p>
+ * see also {@link #clearPermanentHeadSortColumns()} and {@link #clearPermanentTailSortColumns()}
+ */
+ public void clearSortColumns() {
+ if (m_userSortColumns.size() == 0) {
+ return;
+ }
+ IColumn[] a = m_userSortColumns.toArray(new IColumn[m_userSortColumns.size()]);
+ m_userSortColumns.clear();
+ for (IColumn col : a) {
+ HeaderCell cell = (HeaderCell) col.getHeaderCell();
+ cell.setSortActive(false);
+ cell.setSortExplicit(false);
+ }
+ for (IColumn c : a) {
+ rebuildHeaderCell(c);
+ }
+ fireColumnHeadersUpdated(a);
+ }
+
+ public void clearPermanentHeadSortColumns() {
+ if (m_permanentHeadSortColumns.size() == 0) {
+ return;
+ }
+ IColumn[] a = m_permanentHeadSortColumns.toArray(new IColumn[m_permanentHeadSortColumns.size()]);
+ m_permanentHeadSortColumns.clear();
+ for (IColumn col : a) {
+ HeaderCell cell = (HeaderCell) col.getHeaderCell();
+ cell.setSortActive(false);
+ cell.setSortExplicit(false);
+ cell.setSortPermanent(false);
+ }
+ for (int i = 0; i < a.length; i++) {
+ rebuildHeaderCell(a[i]);
+ }
+ fireColumnHeadersUpdated(a);
+ }
+
+ public void clearPermanentTailSortColumns() {
+ if (m_permanentTailSortColumns.size() == 0) {
+ return;
+ }
+ IColumn[] a = m_permanentTailSortColumns.toArray(new IColumn[m_permanentTailSortColumns.size()]);
+ m_permanentTailSortColumns.clear();
+ for (IColumn col : a) {
+ HeaderCell cell = (HeaderCell) col.getHeaderCell();
+ cell.setSortActive(false);
+ cell.setSortExplicit(false);
+ cell.setSortPermanent(false);
+ }
+ for (int i = 0; i < a.length; i++) {
+ rebuildHeaderCell(a[i]);
+ }
+ fireColumnHeadersUpdated(a);
+ }
+
+ public void addPermanentHeadSortColumn(IColumn col, boolean ascending) {
+ col = resolveColumn(col);
+ if (col != null) {
+ m_permanentHeadSortColumns.remove(col);
+ //
+ HeaderCell cell = (HeaderCell) col.getHeaderCell();
+ cell.setSortActive(true);
+ cell.setSortExplicit(true);
+ cell.setSortPermanent(true);
+ cell.setSortAscending(ascending);
+ m_permanentHeadSortColumns.add(col);
+ rebuildHeaderCell(col);
+ fireColumnHeadersUpdated(new IColumn[]{col});
+ }
+ }
+
+ public void addPermanentTailSortColumn(IColumn col, boolean ascending) {
+ col = resolveColumn(col);
+ if (col != null) {
+ m_permanentTailSortColumns.remove(col);
+ //
+ HeaderCell cell = (HeaderCell) col.getHeaderCell();
+ cell.setSortActive(true);
+ cell.setSortExplicit(true);
+ cell.setSortPermanent(true);
+ cell.setSortAscending(ascending);
+ m_permanentTailSortColumns.add(col);
+ rebuildHeaderCell(col);
+ fireColumnHeadersUpdated(new IColumn[]{col});
+ }
+ }
+
+ /**
+ * mapping int array functions
+ */
+ private void reorganizeIndexes() {
+ int n = getColumnCount();
+ int viewIndex;
+ TreeMap<CompositeObject, Integer> sortMap;
+ // displayable map
+ viewIndex = 0;
+ sortMap = new TreeMap<CompositeObject, Integer>();
+ for (int modelIndex = 0; modelIndex < n; modelIndex++) {
+ IColumn col = getColumn(modelIndex);
+ if (col.isDisplayable()) {
+ sortMap.put(new CompositeObject(modelIndex), modelIndex);
+ }
+ }
+ m_displayableIndexes = new int[sortMap.size()];
+ viewIndex = 0;
+ for (int modelIndex : sortMap.values()) {
+ m_displayableIndexes[viewIndex++] = modelIndex;
+ }
+ // visible map
+ viewIndex = 0;
+ sortMap = new TreeMap<CompositeObject, Integer>();
+ for (int modelIndex = 0; modelIndex < n; modelIndex++) {
+ IColumn col = getColumn(modelIndex);
+ if (col.isDisplayable() && col.isVisible()) {
+ double viewHint = col.getVisibleColumnIndexHint();
+ if (viewHint < 0) {
+ viewHint = col.getViewOrder();
+ }
+ if (viewHint < 0) {
+ viewHint = viewIndex;
+ }
+ sortMap.put(new CompositeObject(viewHint, viewIndex), modelIndex);
+ // next
+ viewIndex++;
+ }
+ }
+ m_visibleIndexes = new int[sortMap.size()];
+ viewIndex = 0;
+ for (int modelIndex : sortMap.values()) {
+ m_visibleIndexes[viewIndex++] = modelIndex;
+ }
+ // key map
+ n = getColumnCount();
+ ArrayList<Integer> keyIndexes = new ArrayList<Integer>();
+ for (int modelIndex = 0; modelIndex < n; modelIndex++) {
+ IColumn col = getColumn(modelIndex);
+ if (col.isPrimaryKey()) {
+ keyIndexes.add(modelIndex);
+ }
+ }
+ m_keyIndexes = new int[keyIndexes.size()];
+ viewIndex = 0;
+ for (int modelIndex : keyIndexes) {
+ m_keyIndexes[viewIndex++] = modelIndex;
+ }
+ }
+
+ private void rebuildHeaderCell(IColumn col) {
+ col.decorateHeaderCell();
+ }
+
+ private void fireColumnHeadersUpdated(IColumn[] a) {
+ TableEvent e = new TableEvent(m_table, TableEvent.TYPE_COLUMN_HEADERS_UPDATED);
+ e.setColumns(a);
+ m_table.fireTableEventInternal(e);
+ }
+
+ private void fireColumnOrderChanged() {
+ TableEvent e = new TableEvent(m_table, TableEvent.TYPE_COLUMN_ORDER_CHANGED);
+ m_table.fireTableEventInternal(e);
+ }
+
+ private void fireColumnStructureChanged() {
+ TableEvent e = new TableEvent(m_table, TableEvent.TYPE_COLUMN_STRUCTURE_CHANGED);
+ m_table.fireTableEventInternal(e);
+ }
+
+ private void checkMultiline() {
+ if (m_table != null) {
+ if (!m_table.isInitialMultilineText() && !ConfigurationUtility.isMethodOverwrite(AbstractTable.class, "getConfiguredMultilineText", null, this.getClass())) {
+ //do automatic check for wrapping columns
+ boolean m = false;
+ for (IColumn<?> col : getVisibleColumns()) {
+ if (col instanceof IStringColumn && ((IStringColumn) col).isTextWrap()) {
+ m = true;
+ break;
+ }
+ }
+ m_table.setMultilineText(m);
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/DefaultTableEventHistory.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/DefaultTableEventHistory.java
index 74a6c6c4aa..dbf837dbeb 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/DefaultTableEventHistory.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/DefaultTableEventHistory.java
@@ -1,48 +1,48 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table;
-
-import org.eclipse.scout.rt.client.ui.AbstractEventHistory;
-
-/**
- * The default implementation is created in {@link AbstractTable#createEventHistory()} and tracks
- * <ul>
- * <li>{@link TableEvent#TYPE_REQUEST_FOCUS}</li>
- * <li>{@link TableEvent#TYPE_REQUEST_FOCUS_IN_CELL}</li>
- * <li>{@link TableEvent#TYPE_SCROLL_TO_SELECTION}</li>
- * </ul>
- * <p>
- * This object is thread safe.
- *
- * @since 3.8
- */
-public class DefaultTableEventHistory extends AbstractEventHistory<TableEvent> {
-
- /**
- * @param timeToLiveMillis
- */
- public DefaultTableEventHistory(long timeToLiveMillis) {
- super(timeToLiveMillis);
- }
-
- @Override
- public void notifyEvent(TableEvent event) {
- switch (event.getType()) {
- case TableEvent.TYPE_REQUEST_FOCUS:
- case TableEvent.TYPE_REQUEST_FOCUS_IN_CELL:
- case TableEvent.TYPE_SCROLL_TO_SELECTION: {
- addToCache(event.getType(), event);
- break;
- }
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table;
+
+import org.eclipse.scout.rt.client.ui.AbstractEventHistory;
+
+/**
+ * The default implementation is created in {@link AbstractTable#createEventHistory()} and tracks
+ * <ul>
+ * <li>{@link TableEvent#TYPE_REQUEST_FOCUS}</li>
+ * <li>{@link TableEvent#TYPE_REQUEST_FOCUS_IN_CELL}</li>
+ * <li>{@link TableEvent#TYPE_SCROLL_TO_SELECTION}</li>
+ * </ul>
+ * <p>
+ * This object is thread safe.
+ *
+ * @since 3.8
+ */
+public class DefaultTableEventHistory extends AbstractEventHistory<TableEvent> {
+
+ /**
+ * @param timeToLiveMillis
+ */
+ public DefaultTableEventHistory(long timeToLiveMillis) {
+ super(timeToLiveMillis);
+ }
+
+ @Override
+ public void notifyEvent(TableEvent event) {
+ switch (event.getType()) {
+ case TableEvent.TYPE_REQUEST_FOCUS:
+ case TableEvent.TYPE_REQUEST_FOCUS_IN_CELL:
+ case TableEvent.TYPE_SCROLL_TO_SELECTION: {
+ addToCache(event.getType(), event);
+ break;
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/HeaderCell.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/HeaderCell.java
index a8fdb0ea63..19631b24c4 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/HeaderCell.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/HeaderCell.java
@@ -1,156 +1,156 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table;
-
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.shared.data.basic.FontSpec;
-
-public class HeaderCell implements IHeaderCell {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(HeaderCell.class);
-
- private int m_columnIndex = -1;
- private boolean m_sortAscending;
- private boolean m_sortActive;
- private boolean m_sortPermanent;
- private boolean m_sortExplicit;
- private String m_iconId;
- private String m_text;
- private String m_tooltip;
- private int m_horizontalAlignment = -1;
- private String m_foregroundColor;
- private String m_backgroundColor;
- private FontSpec m_font;
-
- public HeaderCell() {
- }
-
- @Override
- public int getColumnIndex() {
- return m_columnIndex;
- }
-
- /**
- * do not use this internal method
- */
- public void setColumnIndexInternal(int index) {
- if (m_columnIndex < 0) {
- m_columnIndex = index;
- }
- else {
- LOG.warn(null, new IllegalAccessException("do not use this internal method"));
- }
- }
-
- @Override
- public boolean isSortAscending() {
- return m_sortAscending;
- }
-
- public void setSortAscending(boolean b) {
- m_sortAscending = b;
- }
-
- @Override
- public String getBackgroundColor() {
- return m_backgroundColor;
- }
-
- public void setBackgroundColor(String c) {
- m_backgroundColor = c;
- }
-
- @Override
- public FontSpec getFont() {
- return m_font;
- }
-
- public void setFont(FontSpec f) {
- m_font = f;
- }
-
- @Override
- public String getForegroundColor() {
- return m_foregroundColor;
- }
-
- public void setForegroundColor(String c) {
- m_foregroundColor = c;
- }
-
- @Override
- public int getHorizontalAlignment() {
- return m_horizontalAlignment;
- }
-
- public void setHorizontalAlignment(int a) {
- m_horizontalAlignment = a;
- }
-
- @Override
- public String getIconId() {
- return m_iconId;
- }
-
- public void setIconId(String id) {
- m_iconId = id;
- }
-
- @Override
- public String getText() {
- return m_text;
- }
-
- /**
- * this method is not in interface, use {@link #IColumn.decorateHeaderCell()} and
- * {@link #IColumn.execDecorateHeaderCell()}
- */
- public void setText(String s) {
- m_text = s;
- }
-
- @Override
- public String getTooltipText() {
- return m_tooltip;
- }
-
- public void setTooltipText(String s) {
- m_tooltip = s;
- }
-
- @Override
- public boolean isSortActive() {
- return m_sortActive;
- }
-
- public void setSortActive(boolean b) {
- m_sortActive = b;
- }
-
- @Override
- public boolean isSortPermanent() {
- return m_sortPermanent;
- }
-
- public void setSortPermanent(boolean b) {
- m_sortPermanent = b;
- }
-
- @Override
- public boolean isSortExplicit() {
- return m_sortExplicit;
- }
-
- public void setSortExplicit(boolean b) {
- m_sortExplicit = b;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table;
+
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.shared.data.basic.FontSpec;
+
+public class HeaderCell implements IHeaderCell {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(HeaderCell.class);
+
+ private int m_columnIndex = -1;
+ private boolean m_sortAscending;
+ private boolean m_sortActive;
+ private boolean m_sortPermanent;
+ private boolean m_sortExplicit;
+ private String m_iconId;
+ private String m_text;
+ private String m_tooltip;
+ private int m_horizontalAlignment = -1;
+ private String m_foregroundColor;
+ private String m_backgroundColor;
+ private FontSpec m_font;
+
+ public HeaderCell() {
+ }
+
+ @Override
+ public int getColumnIndex() {
+ return m_columnIndex;
+ }
+
+ /**
+ * do not use this internal method
+ */
+ public void setColumnIndexInternal(int index) {
+ if (m_columnIndex < 0) {
+ m_columnIndex = index;
+ }
+ else {
+ LOG.warn(null, new IllegalAccessException("do not use this internal method"));
+ }
+ }
+
+ @Override
+ public boolean isSortAscending() {
+ return m_sortAscending;
+ }
+
+ public void setSortAscending(boolean b) {
+ m_sortAscending = b;
+ }
+
+ @Override
+ public String getBackgroundColor() {
+ return m_backgroundColor;
+ }
+
+ public void setBackgroundColor(String c) {
+ m_backgroundColor = c;
+ }
+
+ @Override
+ public FontSpec getFont() {
+ return m_font;
+ }
+
+ public void setFont(FontSpec f) {
+ m_font = f;
+ }
+
+ @Override
+ public String getForegroundColor() {
+ return m_foregroundColor;
+ }
+
+ public void setForegroundColor(String c) {
+ m_foregroundColor = c;
+ }
+
+ @Override
+ public int getHorizontalAlignment() {
+ return m_horizontalAlignment;
+ }
+
+ public void setHorizontalAlignment(int a) {
+ m_horizontalAlignment = a;
+ }
+
+ @Override
+ public String getIconId() {
+ return m_iconId;
+ }
+
+ public void setIconId(String id) {
+ m_iconId = id;
+ }
+
+ @Override
+ public String getText() {
+ return m_text;
+ }
+
+ /**
+ * this method is not in interface, use {@link #IColumn.decorateHeaderCell()} and
+ * {@link #IColumn.execDecorateHeaderCell()}
+ */
+ public void setText(String s) {
+ m_text = s;
+ }
+
+ @Override
+ public String getTooltipText() {
+ return m_tooltip;
+ }
+
+ public void setTooltipText(String s) {
+ m_tooltip = s;
+ }
+
+ @Override
+ public boolean isSortActive() {
+ return m_sortActive;
+ }
+
+ public void setSortActive(boolean b) {
+ m_sortActive = b;
+ }
+
+ @Override
+ public boolean isSortPermanent() {
+ return m_sortPermanent;
+ }
+
+ public void setSortPermanent(boolean b) {
+ m_sortPermanent = b;
+ }
+
+ @Override
+ public boolean isSortExplicit() {
+ return m_sortExplicit;
+ }
+
+ public void setSortExplicit(boolean b) {
+ m_sortExplicit = b;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/ICheckableTable.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/ICheckableTable.java
index b0b2a83f3e..f74f12322d 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/ICheckableTable.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/ICheckableTable.java
@@ -1,37 +1,37 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IBooleanColumn;
-
-/**
- * Legacy
- *
- * @deprecated use {@link ITable} with {@link ITable#setCheckable(boolean)}
- */
-@Deprecated
-public interface ICheckableTable extends ITable {
-
- String PROP_MULTI_CHECKABLE = "multiCheckable";
-
- IBooleanColumn getCheckboxColumn();
-
- void checkRow(ITableRow row, Boolean value) throws ProcessingException;
-
- void checkRow(int row, Boolean value) throws ProcessingException;
-
- @Override
- ITableRow[] getCheckedRows();
-
- ITableRow getCheckedRow();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IBooleanColumn;
+
+/**
+ * Legacy
+ *
+ * @deprecated use {@link ITable} with {@link ITable#setCheckable(boolean)}
+ */
+@Deprecated
+public interface ICheckableTable extends ITable {
+
+ String PROP_MULTI_CHECKABLE = "multiCheckable";
+
+ IBooleanColumn getCheckboxColumn();
+
+ void checkRow(ITableRow row, Boolean value) throws ProcessingException;
+
+ void checkRow(int row, Boolean value) throws ProcessingException;
+
+ @Override
+ ITableRow[] getCheckedRows();
+
+ ITableRow getCheckedRow();
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/IHeaderCell.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/IHeaderCell.java
index f7acd314a1..e875b1bb12 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/IHeaderCell.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/IHeaderCell.java
@@ -1,57 +1,57 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table;
-
-import org.eclipse.scout.rt.shared.data.basic.FontSpec;
-
-public interface IHeaderCell {
-
- int getColumnIndex();
-
- /**
- * When doing single column sort, all previous columns are kept as implicit
- * history and are marked sortExplicit=false
- * <p>
- * When doing multi-column sort, all columns are kept as explicit history and are marked sortExplicit=true
- */
- boolean isSortExplicit();
-
- boolean isSortAscending();
-
- boolean isSortActive();
-
- /**
- * @return true if column is either a permanent head sort column or a
- * permanent tail sort column.<br>
- * This means that the column remains sort column unlesss explicitly
- * removed using {@link ColumnSet#clearPermanentHeadSortColumns()} or
- * {@link ColumnSet#clearPermanentTailSortColumns()}
- */
- boolean isSortPermanent();
-
- /**
- * there is no setText method in interface,<br>
- * use {@link #IColumn.decorateHeaderCell()} and {@link #IColumn.execDecorateHeaderCell()}
- */
- String getText();
-
- String getIconId();
-
- String getTooltipText();
-
- int getHorizontalAlignment();
-
- String getBackgroundColor();
-
- String getForegroundColor();
-
- FontSpec getFont();
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table;
+
+import org.eclipse.scout.rt.shared.data.basic.FontSpec;
+
+public interface IHeaderCell {
+
+ int getColumnIndex();
+
+ /**
+ * When doing single column sort, all previous columns are kept as implicit
+ * history and are marked sortExplicit=false
+ * <p>
+ * When doing multi-column sort, all columns are kept as explicit history and are marked sortExplicit=true
+ */
+ boolean isSortExplicit();
+
+ boolean isSortAscending();
+
+ boolean isSortActive();
+
+ /**
+ * @return true if column is either a permanent head sort column or a
+ * permanent tail sort column.<br>
+ * This means that the column remains sort column unlesss explicitly
+ * removed using {@link ColumnSet#clearPermanentHeadSortColumns()} or
+ * {@link ColumnSet#clearPermanentTailSortColumns()}
+ */
+ boolean isSortPermanent();
+
+ /**
+ * there is no setText method in interface,<br>
+ * use {@link #IColumn.decorateHeaderCell()} and {@link #IColumn.execDecorateHeaderCell()}
+ */
+ String getText();
+
+ String getIconId();
+
+ String getTooltipText();
+
+ int getHorizontalAlignment();
+
+ String getBackgroundColor();
+
+ String getForegroundColor();
+
+ FontSpec getFont();
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/ISortOrderColumn.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/ISortOrderColumn.java
index 828dccb6c6..c937a5d3ad 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/ISortOrderColumn.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/ISortOrderColumn.java
@@ -1,20 +1,20 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table;
-
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-
-/**
- * The sort state of the column is displayed as icon in each cell. Usage in {@link OrganizeColumnsForm}
- */
-public interface ISortOrderColumn extends IColumn<IColumn> {
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table;
+
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+
+/**
+ * The sort state of the column is displayed as icon in each cell. Usage in {@link OrganizeColumnsForm}
+ */
+public interface ISortOrderColumn extends IColumn<IColumn> {
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/ITable.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/ITable.java
index 171ee1c279..cb24031790 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/ITable.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/ITable.java
@@ -1,843 +1,843 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table;
-
-import java.net.URL;
-
-import org.eclipse.scout.commons.beans.IPropertyObserver;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ClientRule;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.ui.ClientUIPreferences;
-import org.eclipse.scout.rt.client.ui.IDNDSupport;
-import org.eclipse.scout.rt.client.ui.IEventHistory;
-import org.eclipse.scout.rt.client.ui.action.ActionFinder;
-import org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.basic.cell.ICell;
-import org.eclipse.scout.rt.client.ui.basic.table.columnfilter.ITableColumnFilterManager;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IBooleanColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.customizer.ITableCustomizer;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
-import org.eclipse.scout.rt.client.ui.form.fields.listbox.IListBox;
-import org.eclipse.scout.rt.client.ui.form.fields.plannerfield.IPlannerField;
-import org.eclipse.scout.rt.client.ui.form.fields.tablefield.ITableField;
-import org.eclipse.scout.rt.shared.data.form.fields.tablefield.AbstractTableFieldData;
-
-/**
- * The table is by default multi-select Columns are defined as inner classes for
- * every inner column class there is a generated getXYColumn method directly on
- * the table use isValueChangeTriggerEnabled() when formfieldata is being loaded
- * <p>
- * You can write html into the table cells.
- * <p>
- * You can use local urls that call back to the table itself and can be handled by overriding
- * {@link AbstractTable#execHyperlinkAction(URL, String, boolean)}. A local URL is one of the form http://local/...
- * <p>
- */
-public interface ITable extends IPropertyObserver, IDNDSupport {
-
- /**
- * String
- */
- String PROP_TITLE = "title";
- /**
- * Boolean
- */
- String PROP_ENABLED = "enabled";
- /**
- * String
- */
- String PROP_DEFAULT_ICON = "defaultIcon";
- /**
- * Boolean
- */
- String PROP_MULTI_SELECT = "multiSelect";
- /**
- * Boolean
- */
- String PROP_MULTI_CHECK = "multiCheck";
- /**
- * Boolean
- */
- String PROP_MULTILINE_TEXT = "multilineText";
- /**
- * Integer default -1
- */
- String PROP_ROW_HEIGHT_HINT = "rowHeightHint";
-
- /**
- * Boolean
- */
- String PROP_CHECKABLE = "checkable";
- /**
- * Boolean
- */
- String PROP_HEADER_VISIBLE = "headerVisible";
- /**
- * Boolean
- */
- String PROP_KEYBOARD_NAVIGATION = "keyboardNavigation";
- /**
- * Boolean
- */
- String PROP_AUTO_RESIZE_COLUMNS = "autoResizeColumns";
- /**
- * {@link IColumn}
- */
- String PROP_CONTEXT_COLUMN = "contextColumn";
- /**
- * {@link IKeyStroke}[]
- */
- String PROP_KEY_STROKES = "keyStroks";
- /**
- * Boolean
- */
- String PROP_SCROLL_TO_SELECTION = "scrollToSelection";
- /**
- * Object
- * <p>
- * Container of this table, {@link IPage}, {@link ITableField}, {@link IListBox}, {@link IPlannerField}
- * <p>
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=388227
- *
- * @since 3.8.1
- */
- String PROP_CONTAINER = "container";
- /**
- * Host for local urls that call back to the table itself and can be handled by overriding
- * {@link AbstractTable#execHyperlinkAction(URL, String, boolean)}.
- */
- String LOCAL_URL_HOST = "local";
-
- /**
- * Prefix for local urls that call back to the table itself and can be handled by overriding
- * {@link AbstractTable#execHyperlinkAction(URL, String, boolean)}.
- */
- String LOCAL_URL_PREFIX = "http://" + LOCAL_URL_HOST + "/";
-
- void initTable() throws ProcessingException;
-
- void disposeTable();
-
- /**
- * set the context column and processes the url.
- * <p>
- * see {@link #setContextColumn(IColumn)}
- */
- void doHyperlinkAction(ITableRow row, IColumn<?> col, URL url) throws ProcessingException;
-
- ITableRowFilter[] getRowFilters();
-
- /**
- * adding a filter multiple times is supported. This only adds it the first time. The other times it just calls
- * {@link #applyRowFilters()}
- */
- void addRowFilter(ITableRowFilter filter);
-
- void removeRowFilter(ITableRowFilter filter);
-
- /**
- * (Re-) applies all row filters to the table.
- * <p>
- * This can be useful when the state of a row filter was changed without adding or removing it.
- * <p>
- * {@link #addRowFilter(ITableRowFilter)} and {@link #removeRowFilter(ITableRowFilter)} automatically apply the
- * filters to the table.
- */
- void applyRowFilters();
-
- String getTitle();
-
- void setTitle(String s);
-
- /**
- * @return the context in which the table and column settings (order, width,
- * visible,...) are loaded and stored from the {@link ClientUIPreferences}
- */
- String getUserPreferenceContext();
-
- /**
- * Set the context in which the table and column settings (order, width,
- * visible,...) are loaded and stored from the {@link ClientUIPreferences}
- * <p>
- * Be very careful when changing this property during runtime and when the table is initialized. Use the constructor
- * argument instead.
- */
- void setUserPreferenceContext(String context);
-
- /**
- * true: all columns are resized so that the table never needs horizontal
- * scrolling
- */
- boolean isAutoResizeColumns();
-
- void setAutoResizeColumns(boolean b);
-
- /**
- * Convenience for getColumnSet().getColumnCount()
- */
- int getColumnCount();
-
- /**
- * short form for getColumnSet().getColumns()
- */
- IColumn<?>[] getColumns();
-
- String[] getColumnNames();
-
- /**
- * Convenience for getColumnSet().getVisibleColumnCount()
- */
- int getVisibleColumnCount();
-
- ColumnSet getColumnSet();
-
- int getRowCount();
-
- ITableRow getRow(int rowIndex);
-
- ITableRow[] getRows(int[] rowIndexes);
-
- /**
- * This method is Thread-Safe.
- * <p>
- * For performance reasons, this method returns the life array. Do NOT change the array contents directly!
- */
- ITableRow[] getRows();
-
- /**
- * see {@link #setRowFilter(ITableRowFilter)} and {@link #getRowFilter()} This
- * method is Thread-Safe.
- * <p>
- * For performance reasons, this method returns the life array. Do NOT change the array contents directly!
- */
- ITableRow[] getFilteredRows();
-
- /**
- * see {@link #setRowFilter(ITableRowFilter)} and {@link #getRowFilter()} This
- * method is Thread-Safe.
- */
- int getFilteredRowCount();
-
- /**
- * see {@link #setRowFilter(ITableRowFilter)} and {@link #getRowFilter()} This
- * method is Thread-Safe.
- */
- ITableRow getFilteredRow(int index);
-
- /**
- * see {@link #setRowFilter(ITableRowFilter)} and {@link #getRowFilter()} This
- * method is Thread-Safe.
- */
- int getFilteredRowIndex(ITableRow row);
-
- /**
- * @return matrix[rowCount][columnCount] with cell values all calls (also
- * invisible and primary key) are considered
- */
- Object[][] getTableData();
-
- /**
- * see {@link TableUtility#exportRowsAsCSV(ITableRow[], IColumn[], boolean, boolean, boolean)}
- */
- Object[][] exportTableRowsAsCSV(ITableRow[] rows, IColumn<?>[] columns, boolean includeLineForColumnNames, boolean includeLineForColumnTypes, boolean includeLineForColumnFormat);
-
- int getInsertedRowCount();
-
- ITableRow[] getInsertedRows();
-
- int getUpdatedRowCount();
-
- ITableRow[] getUpdatedRows();
-
- int getDeletedRowCount();
-
- ITableRow[] getDeletedRows();
-
- Object[] getRowKeys(int rowIndex);
-
- Object[] getRowKeys(ITableRow row);
-
- ITableRow findRowByKey(Object[] keys);
-
- /*
- * Service aspect
- */
-
- /**
- * extract transfer data to be sent to the backend
- */
- void extractTableData(AbstractTableFieldData target) throws ProcessingException;
-
- /**
- * apply transfer data to this table
- */
- void updateTable(AbstractTableFieldData source) throws ProcessingException;
-
- /**
- * get all menus (new, edit, both)
- */
- IMenu[] getMenus();
-
- /**
- * Convenience to find a menu, uses {@link ActionFinder}
- */
- <T extends IMenu> T getMenu(Class<T> menuType) throws ProcessingException;
-
- IKeyStroke[] getKeyStrokes();
-
- void setKeyStrokes(IKeyStroke[] keyStrokes);
-
- /**
- * Run a menu The menu is first prepared and only executed when it is visible
- * and enabled
- *
- * @return true if menu was executed
- */
- boolean runMenu(Class<? extends IMenu> menuType) throws ProcessingException;
-
- /**
- * @see #setScrollToSelection()
- */
- boolean isScrollToSelection();
-
- /**
- * @param b
- * true: advices the attached ui to make the current selection visible.
- * The current selection will be scrolled to visible (again, whenever the table size changes).
- */
- void setScrollToSelection(boolean b);
-
- /**
- * May be used when {@link #isScrollToSelection()} = false for a one-time scroll. The property scrollToVisible however
- * remains untouched.
- * <p>
- * This is a one-time scroll advise to the ui
- */
- void scrollToSelection();
-
- /*
- * display
- */
- IHeaderCell getVisibleHeaderCell(int visibleColumnIndex);
-
- IHeaderCell getHeaderCell(int columnIndex);
-
- IHeaderCell getHeaderCell(IColumn<?> col);
-
- ICell getVisibleCell(ITableRow row, int visibleColumnIndex);
-
- ICell getVisibleCell(int rowIndex, int visibleColumnIndex);
-
- ICell getCell(int rowIndex, int columnIndex);
-
- ICell getCell(ITableRow row, IColumn<?> column);
-
- /**
- * @see #getSummaryCell(ITableRow)
- */
- ICell getSummaryCell(int rowIndex);
-
- /**
- * composite cell containing the union of all values of this rows that are in
- * a column with property summary=true when no summary column visible or there
- * are none, this defaults to the first defined visible column
- *
- * @see IColumn#isSummary()
- */
- ICell getSummaryCell(ITableRow row);
-
- /**
- * @return the effective live editable state ( {@link IColumn#isCellEditable(ITableRow)} and
- * {@link IColumn#isVisible()} )
- * <p>
- * Note that this is not a java bean getter and thus not thread-safe. Calls to this method must be inside a
- * {@link ClientSyncJob} resp. a job using the {@link ClientRule}.
- */
- boolean isCellEditable(int rowIndex, int columnIndex);
-
- /**
- * @return the effective live editable state ( {@link IColumn#isCellEditable(ITableRow)} and
- * {@link IColumn#isVisible()} )
- * <p>
- * Note that this is not a java bean getter and thus not thread-safe. Calls to this method must be inside a
- * {@link ClientSyncJob} resp. a job using the {@link ClientRule}.
- */
- boolean isCellEditable(ITableRow row, int visibleColumnIndex);
-
- /**
- * @return the effective live editable state ( {@link IColumn#isCellEditable(ITableRow)} and
- * {@link IColumn#isVisible()} )
- * <p>
- * Note that this is not a java bean getter and thus not thread-safe. Calls to this method must be inside a
- * {@link ClientSyncJob} resp. a job using the {@link ClientRule}.
- */
- boolean isCellEditable(ITableRow row, IColumn<?> column);
-
- /*
- * Properties observer section
- */
-
- Object getProperty(String name);
-
- /**
- * With this method it's possible to set (custom) properties.
- * <p>
- * <b>Important: </b> Although this method is intended to be used for custom properties, it's actually possible to
- * change main properties as well. Keep in mind that directly changing main properties may result in unexpected
- * behavior, so do it only if you really know what you are doing. Rather use the officially provided api instead. <br>
- * Example for an unexpected behavior: setVisible() does not only set the property PROP_VISIBLE but also executes
- * additional code. This code would NOT be executed by directly setting the property PROP_VISIBLE with setProperty().
- */
- void setProperty(String name, Object value);
-
- boolean hasProperty(String name);
-
- boolean isCheckable();
-
- void setCheckable(boolean b);
-
- boolean isHeaderVisible();
-
- void setHeaderVisible(boolean b);
-
- boolean isMultilineText();
-
- void setMultilineText(boolean on);
-
- /**
- * This is a hint for the UI iff it is not capable of
- * having variable table row height based on cell contents (such as rap/rwt).
- * <p>
- * This hint defines the table row height in pixels being used as the fixed row height for all table rows of this
- * table.
- *
- * @return the hint in pixels, default is -1
- */
- int getRowHeightHint();
-
- /**
- * see {@link #getRowHeightHint()}
- */
- void setRowHeightHint(int h);
-
- /**
- * other than isMultilineText this property reflects the default multiLine state of the table that is used when
- * wrapping columns become
- * visible or get hidden
- */
- boolean isInitialMultilineText();
-
- /**
- * see {@link #isInitialMultilineText()}
- */
- void setInitialMultilineText(boolean on);
-
- /**
- * this property is used to enable keyboard navigation of a table.
- * The row starting with the typed string will be selected. The considered
- * column is the context column; either the last selected column or the column
- * having a sort order.
- */
- boolean hasKeyboardNavigation();
-
- void setKeyboardNavigation(boolean on);
-
- /**
- * true if multiple rows can be selected (default false)
- */
- boolean isMultiSelect();
-
- void setMultiSelect(boolean on);
-
- /**
- * true if multiple rows can be checked (default true)
- */
- boolean isMultiCheck();
-
- void setMultiCheck(boolean b);
-
- boolean isEnabled();
-
- void setEnabled(boolean b);
-
- /**
- * This property changes the behaviour of {@link #replaceRows(ITableRow[])} and {@link #deleteRows(int[])} true
- * discards rows when deleted, false keeps
- * them in the cache for later usage in change management Default value is
- * true for {@link IPageWithTable} and false for {@link ITableField}
- */
- boolean isAutoDiscardOnDelete();
-
- /**
- * see {@link #isAutoDiscardOnDelete()}
- */
- void setAutoDiscardOnDelete(boolean on);
-
- String getDefaultIconId();
-
- void setDefaultIconId(String iconId);
-
- /**
- * Notify the ui factory to give focus to the table
- */
- void requestFocus();
-
- /**
- * Notify the ui factory to give focus to the table cell.
- * <p>
- * This will only work if the table cell is editable.
- */
- void requestFocusInCell(IColumn<?> column, ITableRow row);
-
- void addTableListener(TableListener listener);
-
- void removeTableListener(TableListener listener);
-
- /**
- * Add the listener at the top (front) of the listener list (so it is called as LAST listener).
- * <p>
- * This method is normally only used by the ui layer to update its state before other listeners handle them
- * <p>
- * Use {@link #addTableListener(TableListener)} in all other cases
- */
- void addUITableListener(TableListener listener);
-
- /**
- * @return the {@link IEventHistory} associated with this table
- * <p>
- * The default implementation is a {@link DefaultTableEventHistory} and created by
- * {@link AbstractTable#createEventHistory()}
- * <p>
- * This method is thread safe.
- * @since 3.8
- */
- IEventHistory<TableEvent> getEventHistory();
-
- /**
- * when performing a batch mutation use this marker like try{
- * setTableChanging(true); ...modify columns, rows, perform sorting etc. }
- * finally{ setTableChanging(false); }
- */
- void setTableChanging(boolean b);
-
- boolean isTableChanging();
-
- boolean isTableInitialized();
-
- void setRowState(ITableRow row, int rowState) throws ProcessingException;
-
- void setRowState(ITableRow[] rows, int rowState) throws ProcessingException;
-
- void setAllRowState(int rowState) throws ProcessingException;
-
- void updateRow(ITableRow modifiedRow);
-
- void updateRows(ITableRow[] modifiedRows);
-
- void updateAllRows();
-
- /**
- * replace rows based on a comparison of their primary keys similar to
- * updateRows(), this method modifies existing rows the difference is that
- * newRows is a NEW set of rows whereas updateRows processes changes on
- * existing rows the idea is that a reload of table data does not delete and
- * (re)add rows but intelligently update existing rows if their primary key
- * matches the key of a new row in detail: for every argument newRow: 1. if
- * for an existingRow the check getRowKeys(newRow)==getRowKeys(existingRow) is
- * true, then existingRow is replaced by newRow when there are multiple
- * existingRow's that match, only the first one is replaced and the others are
- * removed 2. if for no existingRow the check
- * getRowKeys(newRow)==getRowKeys(existingRow) is true then the newRow is
- * added to the table as a really new row 3. all existing rows that do not
- * match any newRow are deleted
- */
- void replaceRows(ITableRow[] newRows) throws ProcessingException;
-
- void replaceRowsByArray(Object dataArray) throws ProcessingException;
-
- /**
- * Performance note:<br>
- * Since the matrix may contain large amount of data, the Object[][] can be passed as new
- * AtomicReference<Object>(Object[][])
- * so that the further processing can set the content of the holder to null while processing.
- */
- void replaceRowsByMatrix(Object dataMatrix) throws ProcessingException;
-
- int getSelectedRowCount();
-
- ITableRow getSelectedRow();
-
- ITableRow[] getSelectedRows();
-
- boolean isSelectedRow(ITableRow row);
-
- void selectRow(int rowIndex);
-
- void selectRow(ITableRow row);
-
- void selectRow(ITableRow row, boolean append);
-
- void selectRows(ITableRow[] rows);
-
- void selectRows(ITableRow[] rows, boolean append);
-
- void selectFirstRow();
-
- void selectPreviousRow();
-
- void selectNextRow();
-
- void selectLastRow();
-
- void selectAllRows();
-
- void selectAllEnabledRows();
-
- void deselectRow(ITableRow row);
-
- void deselectRows(ITableRow[] row);
-
- void deselectAllRows();
-
- void deselectAllEnabledRows();
-
- void setCheckableColumn(IBooleanColumn checkboxColumn);
-
- IBooleanColumn getCheckableColumn();
-
- ITableRow[] getCheckedRows();
-
- void checkRow(int rowIndex, boolean value) throws ProcessingException;
-
- void checkRow(ITableRow row, boolean value) throws ProcessingException;
-
- void checkRows(ITableRow[] rows, boolean value) throws ProcessingException;
-
- void checkAllRows() throws ProcessingException;
-
- void uncheckAllRows() throws ProcessingException;
-
- /**
- * column that represented the last ui (mouse click) context
- * {@link ITableUIFacade#setContextCellFromUI(ITableRow,IColumn)} see {@link #setContextCell(ITableRow, IColumn)}
- */
- IColumn<?> getContextColumn();
-
- /**
- * Set the column that represents the last ui (mouse click) column context, normally
- * called by {@link ITableUIFacade#setContextColumnFromUI(IColumn)} and not by client code. see
- * {@link #getContextColumn()}
- */
- void setContextColumn(IColumn<?> col);
-
- /**
- * calls {@link #addRow(ITableRow, false)}
- */
- ITableRow addRow(ITableRow newRow) throws ProcessingException;
-
- /**
- * the newRow is added to the table. After the add succeeds the argument row
- * newRow has a valid reference to its coresponding ITableRow and the new
- * ITableRow is returned
- */
- ITableRow addRow(ITableRow newRow, boolean markAsInserted) throws ProcessingException;
-
- /**
- * calls {@link #addRows(ITableRow[], false)}
- */
- ITableRow[] addRows(ITableRow[] newRows) throws ProcessingException;
-
- /**
- * calls {@link #addRows(ITableRow[], markAsInserted, null)}
- */
- ITableRow[] addRows(ITableRow[] newRows, boolean markAsInserted) throws ProcessingException;
-
- /**
- * all newRows are added to the table. After the add succeeds the argument
- * rows newRows have valid references to their coresponding ITableRow and the
- * new ITableRows are returned Using insertIndexes: assume the rows have been
- * added to the table; insertIndexes = what indexes should they cover
- *
- * @return added rows in order as they were passed to the method
- */
- ITableRow[] addRows(ITableRow[] newRows, boolean markAsInserted, int[] insertIndexes) throws ProcessingException;
-
- /**
- * Convenience to add one row by its data
- */
- ITableRow addRowByArray(Object dataArray) throws ProcessingException;
-
- /**
- * Convenience to add one row by its data
- */
- ITableRow[] addRowsByArray(Object dataArray, int rowStatus) throws ProcessingException;
-
- /**
- * Convenience to add multiple rows by their data arrays
- */
- ITableRow[] addRowsByMatrix(Object dataMatrix) throws ProcessingException;
-
- /**
- * Convenience to add multiple rows by their data arrays
- */
- ITableRow[] addRowsByMatrix(Object dataMatrix, int rowStatus) throws ProcessingException;
-
- /**
- * Convenience to add multiple rows by their single value (key value)
- */
- ITableRow[] addRowsByArray(Object dataArray) throws ProcessingException;
-
- void moveRow(int sourceIndex, int targetIndex);
-
- void moveRowBefore(ITableRow movingRow, ITableRow targetRow);
-
- void moveRowAfter(ITableRow movingRow, ITableRow targetRow);
-
- void deleteRow(int rowIndex);
-
- void deleteRows(int[] rowIndexes);
-
- void deleteRow(ITableRow row);
-
- void deleteAllRows();
-
- void deleteRows(ITableRow[] rows);
-
- void discardRow(int rowIndex);
-
- void discardRows(int[] rowIndexes);
-
- void discardRow(ITableRow row);
-
- void discardAllRows();
-
- void discardRows(ITableRow[] rows);
-
- void discardAllDeletedRows();
-
- void discardDeletedRow(ITableRow deletedRow);
-
- void discardDeletedRows(ITableRow[] deletedRows);
-
- /**
- * @deprecated use {@link #discardAllDeletedRows()} instead.
- */
- @Deprecated
- void clearDeletedRows();
-
- /**
- * @return this row if it is in fact a valid table row, null otherwise
- */
- ITableRow resolveRow(ITableRow row);
-
- /**
- * @return this array if all rows are valid table row, reduced array otherwise
- */
- ITableRow[] resolveRows(ITableRow[] rows);
-
- void tablePopulated();
-
- void sort();
-
- void sort(ITableRow[] rowsInNewOrder);
-
- boolean isSortEnabled();
-
- void setSortEnabled(boolean b);
-
- ITableColumnFilterManager getColumnFilterManager();
-
- void setColumnFilterManager(ITableColumnFilterManager m);
-
- ITableCustomizer getTableCustomizer();
-
- void setTableCustomizer(ITableCustomizer c);
-
- /**
- * Container of this table, {@link IPage}, {@link ITableField}, {@link IListBox}, {@link IPlannerField}
- * <p>
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=388227
- *
- * @since 3.8.1
- */
- Object getContainer();
-
- /**
- * Initialize and reset all columns. This operation removes all columns from the table and adds them as if the table
- * was created again.
- * <p>
- * Note that this operation discards all table content by calling {@link #discardAllRows()} before rebuilding the
- * columns.
- * <p>
- * When done a {@link TableEvent#TYPE_COLUMN_STRUCTURE_CHANGED} event is sent.
- * <p>
- * This can be useful on tables with dynamic injected columns that need to be refreshed after a state change.
- */
- void resetColumnConfiguration();
-
- /**
- * initialize column visibility of all displayable columns
- */
- void resetColumnVisibilities();
-
- /**
- * initialize column sort order
- */
- void resetColumnSortOrder();
-
- /**
- * initialize column widths
- */
- void resetColumnWidths();
-
- /**
- * initialize column order
- */
- void resetColumnOrder();
-
- /**
- * initialize all columns: visible/invisible, order, sorting, width
- * <p>
- * same as calling {@link #resetColumns(true, true, true, true)}
- */
- void resetDisplayableColumns();
-
- /**
- * initialize columns
- */
- void resetColumns(boolean visibility, boolean order, boolean sorting, boolean widths);
-
- void decorateRow(ITableRow row);
-
- void decorateCell(ITableRow row, IColumn<?> col);
-
- /**
- * To obtain the menus that passed checks such as visibility, empty space action, ... for the given rows.
- * Please be cautious as depending on the given rows, there might be a row mismatch among the selected table rows and
- * the menu context row.
- * This method is not part of the public API.
- *
- * @param rows
- * the rows whose menus should be returned
- * @return
- */
- IMenu[] fetchMenusForRowsInternal(ITableRow[] rows);
-
- /*
- * UI interface
- */
- ITableUIFacade getUIFacade();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table;
+
+import java.net.URL;
+
+import org.eclipse.scout.commons.beans.IPropertyObserver;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ClientRule;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.ui.ClientUIPreferences;
+import org.eclipse.scout.rt.client.ui.IDNDSupport;
+import org.eclipse.scout.rt.client.ui.IEventHistory;
+import org.eclipse.scout.rt.client.ui.action.ActionFinder;
+import org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.basic.cell.ICell;
+import org.eclipse.scout.rt.client.ui.basic.table.columnfilter.ITableColumnFilterManager;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IBooleanColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.customizer.ITableCustomizer;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
+import org.eclipse.scout.rt.client.ui.form.fields.listbox.IListBox;
+import org.eclipse.scout.rt.client.ui.form.fields.plannerfield.IPlannerField;
+import org.eclipse.scout.rt.client.ui.form.fields.tablefield.ITableField;
+import org.eclipse.scout.rt.shared.data.form.fields.tablefield.AbstractTableFieldData;
+
+/**
+ * The table is by default multi-select Columns are defined as inner classes for
+ * every inner column class there is a generated getXYColumn method directly on
+ * the table use isValueChangeTriggerEnabled() when formfieldata is being loaded
+ * <p>
+ * You can write html into the table cells.
+ * <p>
+ * You can use local urls that call back to the table itself and can be handled by overriding
+ * {@link AbstractTable#execHyperlinkAction(URL, String, boolean)}. A local URL is one of the form http://local/...
+ * <p>
+ */
+public interface ITable extends IPropertyObserver, IDNDSupport {
+
+ /**
+ * String
+ */
+ String PROP_TITLE = "title";
+ /**
+ * Boolean
+ */
+ String PROP_ENABLED = "enabled";
+ /**
+ * String
+ */
+ String PROP_DEFAULT_ICON = "defaultIcon";
+ /**
+ * Boolean
+ */
+ String PROP_MULTI_SELECT = "multiSelect";
+ /**
+ * Boolean
+ */
+ String PROP_MULTI_CHECK = "multiCheck";
+ /**
+ * Boolean
+ */
+ String PROP_MULTILINE_TEXT = "multilineText";
+ /**
+ * Integer default -1
+ */
+ String PROP_ROW_HEIGHT_HINT = "rowHeightHint";
+
+ /**
+ * Boolean
+ */
+ String PROP_CHECKABLE = "checkable";
+ /**
+ * Boolean
+ */
+ String PROP_HEADER_VISIBLE = "headerVisible";
+ /**
+ * Boolean
+ */
+ String PROP_KEYBOARD_NAVIGATION = "keyboardNavigation";
+ /**
+ * Boolean
+ */
+ String PROP_AUTO_RESIZE_COLUMNS = "autoResizeColumns";
+ /**
+ * {@link IColumn}
+ */
+ String PROP_CONTEXT_COLUMN = "contextColumn";
+ /**
+ * {@link IKeyStroke}[]
+ */
+ String PROP_KEY_STROKES = "keyStroks";
+ /**
+ * Boolean
+ */
+ String PROP_SCROLL_TO_SELECTION = "scrollToSelection";
+ /**
+ * Object
+ * <p>
+ * Container of this table, {@link IPage}, {@link ITableField}, {@link IListBox}, {@link IPlannerField}
+ * <p>
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=388227
+ *
+ * @since 3.8.1
+ */
+ String PROP_CONTAINER = "container";
+ /**
+ * Host for local urls that call back to the table itself and can be handled by overriding
+ * {@link AbstractTable#execHyperlinkAction(URL, String, boolean)}.
+ */
+ String LOCAL_URL_HOST = "local";
+
+ /**
+ * Prefix for local urls that call back to the table itself and can be handled by overriding
+ * {@link AbstractTable#execHyperlinkAction(URL, String, boolean)}.
+ */
+ String LOCAL_URL_PREFIX = "http://" + LOCAL_URL_HOST + "/";
+
+ void initTable() throws ProcessingException;
+
+ void disposeTable();
+
+ /**
+ * set the context column and processes the url.
+ * <p>
+ * see {@link #setContextColumn(IColumn)}
+ */
+ void doHyperlinkAction(ITableRow row, IColumn<?> col, URL url) throws ProcessingException;
+
+ ITableRowFilter[] getRowFilters();
+
+ /**
+ * adding a filter multiple times is supported. This only adds it the first time. The other times it just calls
+ * {@link #applyRowFilters()}
+ */
+ void addRowFilter(ITableRowFilter filter);
+
+ void removeRowFilter(ITableRowFilter filter);
+
+ /**
+ * (Re-) applies all row filters to the table.
+ * <p>
+ * This can be useful when the state of a row filter was changed without adding or removing it.
+ * <p>
+ * {@link #addRowFilter(ITableRowFilter)} and {@link #removeRowFilter(ITableRowFilter)} automatically apply the
+ * filters to the table.
+ */
+ void applyRowFilters();
+
+ String getTitle();
+
+ void setTitle(String s);
+
+ /**
+ * @return the context in which the table and column settings (order, width,
+ * visible,...) are loaded and stored from the {@link ClientUIPreferences}
+ */
+ String getUserPreferenceContext();
+
+ /**
+ * Set the context in which the table and column settings (order, width,
+ * visible,...) are loaded and stored from the {@link ClientUIPreferences}
+ * <p>
+ * Be very careful when changing this property during runtime and when the table is initialized. Use the constructor
+ * argument instead.
+ */
+ void setUserPreferenceContext(String context);
+
+ /**
+ * true: all columns are resized so that the table never needs horizontal
+ * scrolling
+ */
+ boolean isAutoResizeColumns();
+
+ void setAutoResizeColumns(boolean b);
+
+ /**
+ * Convenience for getColumnSet().getColumnCount()
+ */
+ int getColumnCount();
+
+ /**
+ * short form for getColumnSet().getColumns()
+ */
+ IColumn<?>[] getColumns();
+
+ String[] getColumnNames();
+
+ /**
+ * Convenience for getColumnSet().getVisibleColumnCount()
+ */
+ int getVisibleColumnCount();
+
+ ColumnSet getColumnSet();
+
+ int getRowCount();
+
+ ITableRow getRow(int rowIndex);
+
+ ITableRow[] getRows(int[] rowIndexes);
+
+ /**
+ * This method is Thread-Safe.
+ * <p>
+ * For performance reasons, this method returns the life array. Do NOT change the array contents directly!
+ */
+ ITableRow[] getRows();
+
+ /**
+ * see {@link #setRowFilter(ITableRowFilter)} and {@link #getRowFilter()} This
+ * method is Thread-Safe.
+ * <p>
+ * For performance reasons, this method returns the life array. Do NOT change the array contents directly!
+ */
+ ITableRow[] getFilteredRows();
+
+ /**
+ * see {@link #setRowFilter(ITableRowFilter)} and {@link #getRowFilter()} This
+ * method is Thread-Safe.
+ */
+ int getFilteredRowCount();
+
+ /**
+ * see {@link #setRowFilter(ITableRowFilter)} and {@link #getRowFilter()} This
+ * method is Thread-Safe.
+ */
+ ITableRow getFilteredRow(int index);
+
+ /**
+ * see {@link #setRowFilter(ITableRowFilter)} and {@link #getRowFilter()} This
+ * method is Thread-Safe.
+ */
+ int getFilteredRowIndex(ITableRow row);
+
+ /**
+ * @return matrix[rowCount][columnCount] with cell values all calls (also
+ * invisible and primary key) are considered
+ */
+ Object[][] getTableData();
+
+ /**
+ * see {@link TableUtility#exportRowsAsCSV(ITableRow[], IColumn[], boolean, boolean, boolean)}
+ */
+ Object[][] exportTableRowsAsCSV(ITableRow[] rows, IColumn<?>[] columns, boolean includeLineForColumnNames, boolean includeLineForColumnTypes, boolean includeLineForColumnFormat);
+
+ int getInsertedRowCount();
+
+ ITableRow[] getInsertedRows();
+
+ int getUpdatedRowCount();
+
+ ITableRow[] getUpdatedRows();
+
+ int getDeletedRowCount();
+
+ ITableRow[] getDeletedRows();
+
+ Object[] getRowKeys(int rowIndex);
+
+ Object[] getRowKeys(ITableRow row);
+
+ ITableRow findRowByKey(Object[] keys);
+
+ /*
+ * Service aspect
+ */
+
+ /**
+ * extract transfer data to be sent to the backend
+ */
+ void extractTableData(AbstractTableFieldData target) throws ProcessingException;
+
+ /**
+ * apply transfer data to this table
+ */
+ void updateTable(AbstractTableFieldData source) throws ProcessingException;
+
+ /**
+ * get all menus (new, edit, both)
+ */
+ IMenu[] getMenus();
+
+ /**
+ * Convenience to find a menu, uses {@link ActionFinder}
+ */
+ <T extends IMenu> T getMenu(Class<T> menuType) throws ProcessingException;
+
+ IKeyStroke[] getKeyStrokes();
+
+ void setKeyStrokes(IKeyStroke[] keyStrokes);
+
+ /**
+ * Run a menu The menu is first prepared and only executed when it is visible
+ * and enabled
+ *
+ * @return true if menu was executed
+ */
+ boolean runMenu(Class<? extends IMenu> menuType) throws ProcessingException;
+
+ /**
+ * @see #setScrollToSelection()
+ */
+ boolean isScrollToSelection();
+
+ /**
+ * @param b
+ * true: advices the attached ui to make the current selection visible.
+ * The current selection will be scrolled to visible (again, whenever the table size changes).
+ */
+ void setScrollToSelection(boolean b);
+
+ /**
+ * May be used when {@link #isScrollToSelection()} = false for a one-time scroll. The property scrollToVisible however
+ * remains untouched.
+ * <p>
+ * This is a one-time scroll advise to the ui
+ */
+ void scrollToSelection();
+
+ /*
+ * display
+ */
+ IHeaderCell getVisibleHeaderCell(int visibleColumnIndex);
+
+ IHeaderCell getHeaderCell(int columnIndex);
+
+ IHeaderCell getHeaderCell(IColumn<?> col);
+
+ ICell getVisibleCell(ITableRow row, int visibleColumnIndex);
+
+ ICell getVisibleCell(int rowIndex, int visibleColumnIndex);
+
+ ICell getCell(int rowIndex, int columnIndex);
+
+ ICell getCell(ITableRow row, IColumn<?> column);
+
+ /**
+ * @see #getSummaryCell(ITableRow)
+ */
+ ICell getSummaryCell(int rowIndex);
+
+ /**
+ * composite cell containing the union of all values of this rows that are in
+ * a column with property summary=true when no summary column visible or there
+ * are none, this defaults to the first defined visible column
+ *
+ * @see IColumn#isSummary()
+ */
+ ICell getSummaryCell(ITableRow row);
+
+ /**
+ * @return the effective live editable state ( {@link IColumn#isCellEditable(ITableRow)} and
+ * {@link IColumn#isVisible()} )
+ * <p>
+ * Note that this is not a java bean getter and thus not thread-safe. Calls to this method must be inside a
+ * {@link ClientSyncJob} resp. a job using the {@link ClientRule}.
+ */
+ boolean isCellEditable(int rowIndex, int columnIndex);
+
+ /**
+ * @return the effective live editable state ( {@link IColumn#isCellEditable(ITableRow)} and
+ * {@link IColumn#isVisible()} )
+ * <p>
+ * Note that this is not a java bean getter and thus not thread-safe. Calls to this method must be inside a
+ * {@link ClientSyncJob} resp. a job using the {@link ClientRule}.
+ */
+ boolean isCellEditable(ITableRow row, int visibleColumnIndex);
+
+ /**
+ * @return the effective live editable state ( {@link IColumn#isCellEditable(ITableRow)} and
+ * {@link IColumn#isVisible()} )
+ * <p>
+ * Note that this is not a java bean getter and thus not thread-safe. Calls to this method must be inside a
+ * {@link ClientSyncJob} resp. a job using the {@link ClientRule}.
+ */
+ boolean isCellEditable(ITableRow row, IColumn<?> column);
+
+ /*
+ * Properties observer section
+ */
+
+ Object getProperty(String name);
+
+ /**
+ * With this method it's possible to set (custom) properties.
+ * <p>
+ * <b>Important: </b> Although this method is intended to be used for custom properties, it's actually possible to
+ * change main properties as well. Keep in mind that directly changing main properties may result in unexpected
+ * behavior, so do it only if you really know what you are doing. Rather use the officially provided api instead. <br>
+ * Example for an unexpected behavior: setVisible() does not only set the property PROP_VISIBLE but also executes
+ * additional code. This code would NOT be executed by directly setting the property PROP_VISIBLE with setProperty().
+ */
+ void setProperty(String name, Object value);
+
+ boolean hasProperty(String name);
+
+ boolean isCheckable();
+
+ void setCheckable(boolean b);
+
+ boolean isHeaderVisible();
+
+ void setHeaderVisible(boolean b);
+
+ boolean isMultilineText();
+
+ void setMultilineText(boolean on);
+
+ /**
+ * This is a hint for the UI iff it is not capable of
+ * having variable table row height based on cell contents (such as rap/rwt).
+ * <p>
+ * This hint defines the table row height in pixels being used as the fixed row height for all table rows of this
+ * table.
+ *
+ * @return the hint in pixels, default is -1
+ */
+ int getRowHeightHint();
+
+ /**
+ * see {@link #getRowHeightHint()}
+ */
+ void setRowHeightHint(int h);
+
+ /**
+ * other than isMultilineText this property reflects the default multiLine state of the table that is used when
+ * wrapping columns become
+ * visible or get hidden
+ */
+ boolean isInitialMultilineText();
+
+ /**
+ * see {@link #isInitialMultilineText()}
+ */
+ void setInitialMultilineText(boolean on);
+
+ /**
+ * this property is used to enable keyboard navigation of a table.
+ * The row starting with the typed string will be selected. The considered
+ * column is the context column; either the last selected column or the column
+ * having a sort order.
+ */
+ boolean hasKeyboardNavigation();
+
+ void setKeyboardNavigation(boolean on);
+
+ /**
+ * true if multiple rows can be selected (default false)
+ */
+ boolean isMultiSelect();
+
+ void setMultiSelect(boolean on);
+
+ /**
+ * true if multiple rows can be checked (default true)
+ */
+ boolean isMultiCheck();
+
+ void setMultiCheck(boolean b);
+
+ boolean isEnabled();
+
+ void setEnabled(boolean b);
+
+ /**
+ * This property changes the behaviour of {@link #replaceRows(ITableRow[])} and {@link #deleteRows(int[])} true
+ * discards rows when deleted, false keeps
+ * them in the cache for later usage in change management Default value is
+ * true for {@link IPageWithTable} and false for {@link ITableField}
+ */
+ boolean isAutoDiscardOnDelete();
+
+ /**
+ * see {@link #isAutoDiscardOnDelete()}
+ */
+ void setAutoDiscardOnDelete(boolean on);
+
+ String getDefaultIconId();
+
+ void setDefaultIconId(String iconId);
+
+ /**
+ * Notify the ui factory to give focus to the table
+ */
+ void requestFocus();
+
+ /**
+ * Notify the ui factory to give focus to the table cell.
+ * <p>
+ * This will only work if the table cell is editable.
+ */
+ void requestFocusInCell(IColumn<?> column, ITableRow row);
+
+ void addTableListener(TableListener listener);
+
+ void removeTableListener(TableListener listener);
+
+ /**
+ * Add the listener at the top (front) of the listener list (so it is called as LAST listener).
+ * <p>
+ * This method is normally only used by the ui layer to update its state before other listeners handle them
+ * <p>
+ * Use {@link #addTableListener(TableListener)} in all other cases
+ */
+ void addUITableListener(TableListener listener);
+
+ /**
+ * @return the {@link IEventHistory} associated with this table
+ * <p>
+ * The default implementation is a {@link DefaultTableEventHistory} and created by
+ * {@link AbstractTable#createEventHistory()}
+ * <p>
+ * This method is thread safe.
+ * @since 3.8
+ */
+ IEventHistory<TableEvent> getEventHistory();
+
+ /**
+ * when performing a batch mutation use this marker like try{
+ * setTableChanging(true); ...modify columns, rows, perform sorting etc. }
+ * finally{ setTableChanging(false); }
+ */
+ void setTableChanging(boolean b);
+
+ boolean isTableChanging();
+
+ boolean isTableInitialized();
+
+ void setRowState(ITableRow row, int rowState) throws ProcessingException;
+
+ void setRowState(ITableRow[] rows, int rowState) throws ProcessingException;
+
+ void setAllRowState(int rowState) throws ProcessingException;
+
+ void updateRow(ITableRow modifiedRow);
+
+ void updateRows(ITableRow[] modifiedRows);
+
+ void updateAllRows();
+
+ /**
+ * replace rows based on a comparison of their primary keys similar to
+ * updateRows(), this method modifies existing rows the difference is that
+ * newRows is a NEW set of rows whereas updateRows processes changes on
+ * existing rows the idea is that a reload of table data does not delete and
+ * (re)add rows but intelligently update existing rows if their primary key
+ * matches the key of a new row in detail: for every argument newRow: 1. if
+ * for an existingRow the check getRowKeys(newRow)==getRowKeys(existingRow) is
+ * true, then existingRow is replaced by newRow when there are multiple
+ * existingRow's that match, only the first one is replaced and the others are
+ * removed 2. if for no existingRow the check
+ * getRowKeys(newRow)==getRowKeys(existingRow) is true then the newRow is
+ * added to the table as a really new row 3. all existing rows that do not
+ * match any newRow are deleted
+ */
+ void replaceRows(ITableRow[] newRows) throws ProcessingException;
+
+ void replaceRowsByArray(Object dataArray) throws ProcessingException;
+
+ /**
+ * Performance note:<br>
+ * Since the matrix may contain large amount of data, the Object[][] can be passed as new
+ * AtomicReference<Object>(Object[][])
+ * so that the further processing can set the content of the holder to null while processing.
+ */
+ void replaceRowsByMatrix(Object dataMatrix) throws ProcessingException;
+
+ int getSelectedRowCount();
+
+ ITableRow getSelectedRow();
+
+ ITableRow[] getSelectedRows();
+
+ boolean isSelectedRow(ITableRow row);
+
+ void selectRow(int rowIndex);
+
+ void selectRow(ITableRow row);
+
+ void selectRow(ITableRow row, boolean append);
+
+ void selectRows(ITableRow[] rows);
+
+ void selectRows(ITableRow[] rows, boolean append);
+
+ void selectFirstRow();
+
+ void selectPreviousRow();
+
+ void selectNextRow();
+
+ void selectLastRow();
+
+ void selectAllRows();
+
+ void selectAllEnabledRows();
+
+ void deselectRow(ITableRow row);
+
+ void deselectRows(ITableRow[] row);
+
+ void deselectAllRows();
+
+ void deselectAllEnabledRows();
+
+ void setCheckableColumn(IBooleanColumn checkboxColumn);
+
+ IBooleanColumn getCheckableColumn();
+
+ ITableRow[] getCheckedRows();
+
+ void checkRow(int rowIndex, boolean value) throws ProcessingException;
+
+ void checkRow(ITableRow row, boolean value) throws ProcessingException;
+
+ void checkRows(ITableRow[] rows, boolean value) throws ProcessingException;
+
+ void checkAllRows() throws ProcessingException;
+
+ void uncheckAllRows() throws ProcessingException;
+
+ /**
+ * column that represented the last ui (mouse click) context
+ * {@link ITableUIFacade#setContextCellFromUI(ITableRow,IColumn)} see {@link #setContextCell(ITableRow, IColumn)}
+ */
+ IColumn<?> getContextColumn();
+
+ /**
+ * Set the column that represents the last ui (mouse click) column context, normally
+ * called by {@link ITableUIFacade#setContextColumnFromUI(IColumn)} and not by client code. see
+ * {@link #getContextColumn()}
+ */
+ void setContextColumn(IColumn<?> col);
+
+ /**
+ * calls {@link #addRow(ITableRow, false)}
+ */
+ ITableRow addRow(ITableRow newRow) throws ProcessingException;
+
+ /**
+ * the newRow is added to the table. After the add succeeds the argument row
+ * newRow has a valid reference to its coresponding ITableRow and the new
+ * ITableRow is returned
+ */
+ ITableRow addRow(ITableRow newRow, boolean markAsInserted) throws ProcessingException;
+
+ /**
+ * calls {@link #addRows(ITableRow[], false)}
+ */
+ ITableRow[] addRows(ITableRow[] newRows) throws ProcessingException;
+
+ /**
+ * calls {@link #addRows(ITableRow[], markAsInserted, null)}
+ */
+ ITableRow[] addRows(ITableRow[] newRows, boolean markAsInserted) throws ProcessingException;
+
+ /**
+ * all newRows are added to the table. After the add succeeds the argument
+ * rows newRows have valid references to their coresponding ITableRow and the
+ * new ITableRows are returned Using insertIndexes: assume the rows have been
+ * added to the table; insertIndexes = what indexes should they cover
+ *
+ * @return added rows in order as they were passed to the method
+ */
+ ITableRow[] addRows(ITableRow[] newRows, boolean markAsInserted, int[] insertIndexes) throws ProcessingException;
+
+ /**
+ * Convenience to add one row by its data
+ */
+ ITableRow addRowByArray(Object dataArray) throws ProcessingException;
+
+ /**
+ * Convenience to add one row by its data
+ */
+ ITableRow[] addRowsByArray(Object dataArray, int rowStatus) throws ProcessingException;
+
+ /**
+ * Convenience to add multiple rows by their data arrays
+ */
+ ITableRow[] addRowsByMatrix(Object dataMatrix) throws ProcessingException;
+
+ /**
+ * Convenience to add multiple rows by their data arrays
+ */
+ ITableRow[] addRowsByMatrix(Object dataMatrix, int rowStatus) throws ProcessingException;
+
+ /**
+ * Convenience to add multiple rows by their single value (key value)
+ */
+ ITableRow[] addRowsByArray(Object dataArray) throws ProcessingException;
+
+ void moveRow(int sourceIndex, int targetIndex);
+
+ void moveRowBefore(ITableRow movingRow, ITableRow targetRow);
+
+ void moveRowAfter(ITableRow movingRow, ITableRow targetRow);
+
+ void deleteRow(int rowIndex);
+
+ void deleteRows(int[] rowIndexes);
+
+ void deleteRow(ITableRow row);
+
+ void deleteAllRows();
+
+ void deleteRows(ITableRow[] rows);
+
+ void discardRow(int rowIndex);
+
+ void discardRows(int[] rowIndexes);
+
+ void discardRow(ITableRow row);
+
+ void discardAllRows();
+
+ void discardRows(ITableRow[] rows);
+
+ void discardAllDeletedRows();
+
+ void discardDeletedRow(ITableRow deletedRow);
+
+ void discardDeletedRows(ITableRow[] deletedRows);
+
+ /**
+ * @deprecated use {@link #discardAllDeletedRows()} instead.
+ */
+ @Deprecated
+ void clearDeletedRows();
+
+ /**
+ * @return this row if it is in fact a valid table row, null otherwise
+ */
+ ITableRow resolveRow(ITableRow row);
+
+ /**
+ * @return this array if all rows are valid table row, reduced array otherwise
+ */
+ ITableRow[] resolveRows(ITableRow[] rows);
+
+ void tablePopulated();
+
+ void sort();
+
+ void sort(ITableRow[] rowsInNewOrder);
+
+ boolean isSortEnabled();
+
+ void setSortEnabled(boolean b);
+
+ ITableColumnFilterManager getColumnFilterManager();
+
+ void setColumnFilterManager(ITableColumnFilterManager m);
+
+ ITableCustomizer getTableCustomizer();
+
+ void setTableCustomizer(ITableCustomizer c);
+
+ /**
+ * Container of this table, {@link IPage}, {@link ITableField}, {@link IListBox}, {@link IPlannerField}
+ * <p>
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=388227
+ *
+ * @since 3.8.1
+ */
+ Object getContainer();
+
+ /**
+ * Initialize and reset all columns. This operation removes all columns from the table and adds them as if the table
+ * was created again.
+ * <p>
+ * Note that this operation discards all table content by calling {@link #discardAllRows()} before rebuilding the
+ * columns.
+ * <p>
+ * When done a {@link TableEvent#TYPE_COLUMN_STRUCTURE_CHANGED} event is sent.
+ * <p>
+ * This can be useful on tables with dynamic injected columns that need to be refreshed after a state change.
+ */
+ void resetColumnConfiguration();
+
+ /**
+ * initialize column visibility of all displayable columns
+ */
+ void resetColumnVisibilities();
+
+ /**
+ * initialize column sort order
+ */
+ void resetColumnSortOrder();
+
+ /**
+ * initialize column widths
+ */
+ void resetColumnWidths();
+
+ /**
+ * initialize column order
+ */
+ void resetColumnOrder();
+
+ /**
+ * initialize all columns: visible/invisible, order, sorting, width
+ * <p>
+ * same as calling {@link #resetColumns(true, true, true, true)}
+ */
+ void resetDisplayableColumns();
+
+ /**
+ * initialize columns
+ */
+ void resetColumns(boolean visibility, boolean order, boolean sorting, boolean widths);
+
+ void decorateRow(ITableRow row);
+
+ void decorateCell(ITableRow row, IColumn<?> col);
+
+ /**
+ * To obtain the menus that passed checks such as visibility, empty space action, ... for the given rows.
+ * Please be cautious as depending on the given rows, there might be a row mismatch among the selected table rows and
+ * the menu context row.
+ * This method is not part of the public API.
+ *
+ * @param rows
+ * the rows whose menus should be returned
+ * @return
+ */
+ IMenu[] fetchMenusForRowsInternal(ITableRow[] rows);
+
+ /*
+ * UI interface
+ */
+ ITableUIFacade getUIFacade();
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/ITableRow.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/ITableRow.java
index 4f3abc0624..f042e30018 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/ITableRow.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/ITableRow.java
@@ -1,187 +1,187 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
-import org.eclipse.scout.rt.client.ui.basic.cell.ICell;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-import org.eclipse.scout.rt.shared.data.basic.FontSpec;
-import org.eclipse.scout.rt.shared.data.form.fields.tablefield.AbstractTableFieldData;
-
-/**
- * Note: TableRows are equal-consistent by their rowIndex
- */
-public interface ITableRow {
- /**
- * same number as
- *
- * @see AbstractTableFieldData
- */
- int STATUS_NON_CHANGED = 0;
- /**
- * same number as
- *
- * @see AbstractTableFieldData
- */
- int STATUS_INSERTED = 1;
- /**
- * same number as
- *
- * @see AbstractTableFieldData
- */
- int STATUS_UPDATED = 2;
- /**
- * same number as
- *
- * @see AbstractTableFieldData
- */
- int STATUS_DELETED = 3;
-
- ITable getTable();
-
- int getRowIndex();
-
- boolean isEnabled();
-
- void setEnabled(boolean b);
-
- boolean isSelected();
-
- boolean isChecked();
-
- void setChecked(boolean b);
-
- boolean isFilterAccepted();
-
- int getCellCount();
-
- ICell getCell(IColumn column);
-
- ICell getCell(int columnIndex);
-
- void setCell(IColumn column, ICell cell) throws ProcessingException;
-
- void setCell(int columnIndex, ICell cell) throws ProcessingException;
-
- Cell getCellForUpdate(IColumn column);
-
- Cell getCellForUpdate(int columnIndex);
-
- Object getCellValue(int columnIndex);
-
- /**
- * Warning: this method is not validating the new value against the
- * corresponding table column use {@link IColumn#setValue(ITableRow, Object)} instead
- *
- * @return true if value was in fact changed
- */
- boolean setCellValue(int columnIndex, Object value) throws ProcessingException;
-
- /**
- * Warning: this method is not validating the new value against the
- * corresponding table column use {@link IColumn#setValue(ITableRow, Object)} instead
- *
- * @return true if value was in fact changed
- */
- boolean setCellValues(Object[] values) throws ProcessingException;
-
- Object[] getKeyValues();
-
- int getStatus();
-
- void setStatus(int rowStatus);
-
- boolean isStatusInserted();
-
- void setStatusInserted();
-
- boolean isStatusUpdated();
-
- void setStatusUpdated();
-
- boolean isStatusDeleted();
-
- void setStatusDeleted();
-
- boolean isStatusNonchanged();
-
- void setStatusNonchanged();
-
- /**
- * Convenience method for forced table row change
- */
- void touch() throws ProcessingException;
-
- /**
- * Convenience method for getTable().deleteRow(this);
- */
- void delete() throws ProcessingException;
-
- /**
- * Convenience method for setting background on all cells of this row
- */
- void setBackgroundColor(String c);
-
- /**
- * Convenience method for setting foreground on all cells of this row
- */
- void setForegroundColor(String c);
-
- /**
- * Convenience method for setting font on all cells of this row
- */
- void setFont(FontSpec f);
-
- /**
- * Convenience method for setting tooltipText on all cells of this row
- */
- void setTooltipText(String s);
-
- String getIconId();
-
- void setIconId(String id);
-
- boolean isRowPropertiesChanged();
-
- void setRowPropertiesChanged(boolean b);
-
- boolean isRowChanging();
-
- /**
- * if this is the top level caller calling with b=false, then calls {@link ITable#updateRow(ITableRow)}
- */
- void setRowChanging(boolean b);
-
- /**
- * move this row to the top this method has no effect if sorting is activated
- * on the table
- */
- void moveToTop();
-
- /**
- * move this row to the bottom this method has no effect if sorting is
- * activated on the table
- */
- void moveToBottom();
-
- /**
- * move this row one up this method has no effect if sorting is activated on
- * the table
- */
- void moveUp();
-
- /**
- * move this row one down this method has no effect if sorting is activated on
- * the table
- */
- void moveDown();
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
+import org.eclipse.scout.rt.client.ui.basic.cell.ICell;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+import org.eclipse.scout.rt.shared.data.basic.FontSpec;
+import org.eclipse.scout.rt.shared.data.form.fields.tablefield.AbstractTableFieldData;
+
+/**
+ * Note: TableRows are equal-consistent by their rowIndex
+ */
+public interface ITableRow {
+ /**
+ * same number as
+ *
+ * @see AbstractTableFieldData
+ */
+ int STATUS_NON_CHANGED = 0;
+ /**
+ * same number as
+ *
+ * @see AbstractTableFieldData
+ */
+ int STATUS_INSERTED = 1;
+ /**
+ * same number as
+ *
+ * @see AbstractTableFieldData
+ */
+ int STATUS_UPDATED = 2;
+ /**
+ * same number as
+ *
+ * @see AbstractTableFieldData
+ */
+ int STATUS_DELETED = 3;
+
+ ITable getTable();
+
+ int getRowIndex();
+
+ boolean isEnabled();
+
+ void setEnabled(boolean b);
+
+ boolean isSelected();
+
+ boolean isChecked();
+
+ void setChecked(boolean b);
+
+ boolean isFilterAccepted();
+
+ int getCellCount();
+
+ ICell getCell(IColumn column);
+
+ ICell getCell(int columnIndex);
+
+ void setCell(IColumn column, ICell cell) throws ProcessingException;
+
+ void setCell(int columnIndex, ICell cell) throws ProcessingException;
+
+ Cell getCellForUpdate(IColumn column);
+
+ Cell getCellForUpdate(int columnIndex);
+
+ Object getCellValue(int columnIndex);
+
+ /**
+ * Warning: this method is not validating the new value against the
+ * corresponding table column use {@link IColumn#setValue(ITableRow, Object)} instead
+ *
+ * @return true if value was in fact changed
+ */
+ boolean setCellValue(int columnIndex, Object value) throws ProcessingException;
+
+ /**
+ * Warning: this method is not validating the new value against the
+ * corresponding table column use {@link IColumn#setValue(ITableRow, Object)} instead
+ *
+ * @return true if value was in fact changed
+ */
+ boolean setCellValues(Object[] values) throws ProcessingException;
+
+ Object[] getKeyValues();
+
+ int getStatus();
+
+ void setStatus(int rowStatus);
+
+ boolean isStatusInserted();
+
+ void setStatusInserted();
+
+ boolean isStatusUpdated();
+
+ void setStatusUpdated();
+
+ boolean isStatusDeleted();
+
+ void setStatusDeleted();
+
+ boolean isStatusNonchanged();
+
+ void setStatusNonchanged();
+
+ /**
+ * Convenience method for forced table row change
+ */
+ void touch() throws ProcessingException;
+
+ /**
+ * Convenience method for getTable().deleteRow(this);
+ */
+ void delete() throws ProcessingException;
+
+ /**
+ * Convenience method for setting background on all cells of this row
+ */
+ void setBackgroundColor(String c);
+
+ /**
+ * Convenience method for setting foreground on all cells of this row
+ */
+ void setForegroundColor(String c);
+
+ /**
+ * Convenience method for setting font on all cells of this row
+ */
+ void setFont(FontSpec f);
+
+ /**
+ * Convenience method for setting tooltipText on all cells of this row
+ */
+ void setTooltipText(String s);
+
+ String getIconId();
+
+ void setIconId(String id);
+
+ boolean isRowPropertiesChanged();
+
+ void setRowPropertiesChanged(boolean b);
+
+ boolean isRowChanging();
+
+ /**
+ * if this is the top level caller calling with b=false, then calls {@link ITable#updateRow(ITableRow)}
+ */
+ void setRowChanging(boolean b);
+
+ /**
+ * move this row to the top this method has no effect if sorting is activated
+ * on the table
+ */
+ void moveToTop();
+
+ /**
+ * move this row to the bottom this method has no effect if sorting is
+ * activated on the table
+ */
+ void moveToBottom();
+
+ /**
+ * move this row one up this method has no effect if sorting is activated on
+ * the table
+ */
+ void moveUp();
+
+ /**
+ * move this row one down this method has no effect if sorting is activated on
+ * the table
+ */
+ void moveDown();
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/ITableRowFilter.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/ITableRowFilter.java
index cdad9b390a..fa91a399b1 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/ITableRowFilter.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/ITableRowFilter.java
@@ -1,22 +1,22 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table;
-
-/**
- * A table filter is used to mask out certain rows from the table {@link ITable#getFilteredRows()}. The methods
- * {@link ITable#getRows()} and {@link ITable#getRowCount()} are unaffected by the filter. The UI should use
- * {@link ITable#getFilteredRows()}
- */
-public interface ITableRowFilter {
-
- boolean accept(ITableRow row);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table;
+
+/**
+ * A table filter is used to mask out certain rows from the table {@link ITable#getFilteredRows()}. The methods
+ * {@link ITable#getRows()} and {@link ITable#getRowCount()} are unaffected by the filter. The UI should use
+ * {@link ITable#getFilteredRows()}
+ */
+public interface ITableRowFilter {
+
+ boolean accept(ITableRow row);
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/ITableUIFacade.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/ITableUIFacade.java
index 9ad75faa79..ab8cbd06f1 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/ITableUIFacade.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/ITableUIFacade.java
@@ -1,103 +1,103 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table;
-
-import java.net.URL;
-
-import org.eclipse.scout.commons.dnd.TransferObject;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-
-/**
- * Columns are defined as inner classes for every inner column class there is a
- * generated getXYColumn method directly on the table
- */
-public interface ITableUIFacade {
-
- boolean isUIProcessing();
-
- /**
- * A mouse single click on a row or (for checkable tables) the space key triggers this action
- */
- void fireRowClickFromUI(ITableRow row);
-
- /**
- * A mouse double click on a row triggers this action
- */
- void fireRowActionFromUI(ITableRow row);
-
- /**
- * Popup on selected row(s)
- */
- IMenu[] fireRowPopupFromUI();
-
- /**
- * Popup on empty space
- */
- IMenu[] fireEmptySpacePopupFromUI();
-
- IMenu[] fireHeaderPopupFromUI();
-
- void fireColumnMovedFromUI(IColumn<?> c, int toViewIndex);
-
- /**
- * @param visibleColumns
- */
- void fireVisibleColumnsChangedFromUI(IColumn<?>[] visibleColumns);
-
- void setColumnWidthFromUI(IColumn<?> c, int newWidth);
-
- /**
- * @param column
- * @param multiSort
- * true = multiple sort columns are supported, every event toggles
- * the current column between the states ON-ASCENDING (add to tail of
- * sort columns), ON-DESCENDING. False = the selected column is set
- * as the (new) primary sort column, if already set it is toggled
- * between ascending and descending
- */
- void fireHeaderSortFromUI(IColumn<?> column, boolean multiSort);
-
- void setSelectedRowsFromUI(ITableRow[] rows);
-
- /**
- * Drag selected rows
- */
- TransferObject fireRowsDragRequestFromUI();
-
- /**
- * To copy selected rows into clipboard
- */
- TransferObject fireRowsCopyRequestFromUI();
-
- void fireRowDropActionFromUI(ITableRow row, TransferObject dropData);
-
- /**
- * Set the column that represents the last ui (mouse click) column context
- */
- void setContextColumnFromUI(IColumn<?> col);
-
- /**
- * @return the editing field or group box or null if no editing is available right now
- * <p>
- * The ui should call {@link #completeCellEditFromUI()} or {@link #cancelCellEditFromUI()} at some time.
- */
- IFormField prepareCellEditFromUI(ITableRow row, IColumn<?> col);
-
- void completeCellEditFromUI();
-
- void cancelCellEditFromUI();
-
- boolean fireKeyTypedFromUI(String keyStrokeText, char keyChar);
-
- void fireHyperlinkActionFromUI(ITableRow row, IColumn<?> column, URL url);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table;
+
+import java.net.URL;
+
+import org.eclipse.scout.commons.dnd.TransferObject;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+
+/**
+ * Columns are defined as inner classes for every inner column class there is a
+ * generated getXYColumn method directly on the table
+ */
+public interface ITableUIFacade {
+
+ boolean isUIProcessing();
+
+ /**
+ * A mouse single click on a row or (for checkable tables) the space key triggers this action
+ */
+ void fireRowClickFromUI(ITableRow row);
+
+ /**
+ * A mouse double click on a row triggers this action
+ */
+ void fireRowActionFromUI(ITableRow row);
+
+ /**
+ * Popup on selected row(s)
+ */
+ IMenu[] fireRowPopupFromUI();
+
+ /**
+ * Popup on empty space
+ */
+ IMenu[] fireEmptySpacePopupFromUI();
+
+ IMenu[] fireHeaderPopupFromUI();
+
+ void fireColumnMovedFromUI(IColumn<?> c, int toViewIndex);
+
+ /**
+ * @param visibleColumns
+ */
+ void fireVisibleColumnsChangedFromUI(IColumn<?>[] visibleColumns);
+
+ void setColumnWidthFromUI(IColumn<?> c, int newWidth);
+
+ /**
+ * @param column
+ * @param multiSort
+ * true = multiple sort columns are supported, every event toggles
+ * the current column between the states ON-ASCENDING (add to tail of
+ * sort columns), ON-DESCENDING. False = the selected column is set
+ * as the (new) primary sort column, if already set it is toggled
+ * between ascending and descending
+ */
+ void fireHeaderSortFromUI(IColumn<?> column, boolean multiSort);
+
+ void setSelectedRowsFromUI(ITableRow[] rows);
+
+ /**
+ * Drag selected rows
+ */
+ TransferObject fireRowsDragRequestFromUI();
+
+ /**
+ * To copy selected rows into clipboard
+ */
+ TransferObject fireRowsCopyRequestFromUI();
+
+ void fireRowDropActionFromUI(ITableRow row, TransferObject dropData);
+
+ /**
+ * Set the column that represents the last ui (mouse click) column context
+ */
+ void setContextColumnFromUI(IColumn<?> col);
+
+ /**
+ * @return the editing field or group box or null if no editing is available right now
+ * <p>
+ * The ui should call {@link #completeCellEditFromUI()} or {@link #cancelCellEditFromUI()} at some time.
+ */
+ IFormField prepareCellEditFromUI(ITableRow row, IColumn<?> col);
+
+ void completeCellEditFromUI();
+
+ void cancelCellEditFromUI();
+
+ boolean fireKeyTypedFromUI(String keyStrokeText, char keyChar);
+
+ void fireHyperlinkActionFromUI(ITableRow row, IColumn<?> column, URL url);
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/KeyStrokeBuffer.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/KeyStrokeBuffer.java
index 2abaeadea9..d7f323fb64 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/KeyStrokeBuffer.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/KeyStrokeBuffer.java
@@ -1,40 +1,40 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table;
-
-public class KeyStrokeBuffer {
- private StringBuffer m_buf;
- private long m_lastActivity;
- private long m_resetTimeoutMillis;
-
- public KeyStrokeBuffer(long resetTimeoutMillis) {
- m_buf = new StringBuffer();
- m_resetTimeoutMillis = resetTimeoutMillis;
- m_lastActivity = System.currentTimeMillis();
- }
-
- public void append(String s) {
- checkTimeout();
- m_buf.append(s);
- m_lastActivity = System.currentTimeMillis();
- }
-
- public String getText() {
- checkTimeout();
- return m_buf.toString();
- }
-
- private void checkTimeout() {
- if (System.currentTimeMillis() - m_lastActivity >= m_resetTimeoutMillis) {
- m_buf.setLength(0);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table;
+
+public class KeyStrokeBuffer {
+ private StringBuffer m_buf;
+ private long m_lastActivity;
+ private long m_resetTimeoutMillis;
+
+ public KeyStrokeBuffer(long resetTimeoutMillis) {
+ m_buf = new StringBuffer();
+ m_resetTimeoutMillis = resetTimeoutMillis;
+ m_lastActivity = System.currentTimeMillis();
+ }
+
+ public void append(String s) {
+ checkTimeout();
+ m_buf.append(s);
+ m_lastActivity = System.currentTimeMillis();
+ }
+
+ public String getText() {
+ checkTimeout();
+ return m_buf.toString();
+ }
+
+ private void checkTimeout() {
+ if (System.currentTimeMillis() - m_lastActivity >= m_resetTimeoutMillis) {
+ m_buf.setLength(0);
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/OrganizeColumnsForm.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/OrganizeColumnsForm.java
index 79ee8e5820..c4ec7e89a9 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/OrganizeColumnsForm.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/OrganizeColumnsForm.java
@@ -1,1191 +1,1191 @@
-package org.eclipse.scout.rt.client.ui.basic.table;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.scout.commons.BooleanUtility;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.dnd.JavaTransferObject;
-import org.eclipse.scout.commons.dnd.TransferObject;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.exception.VetoException;
-import org.eclipse.scout.rt.client.services.common.bookmark.internal.BookmarkUtility;
-import org.eclipse.scout.rt.client.ui.ClientUIPreferences;
-import org.eclipse.scout.rt.client.ui.IDNDSupport;
-import org.eclipse.scout.rt.client.ui.action.keystroke.AbstractKeyStroke;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.basic.table.OrganizeColumnsForm.MainBox.CancelButton;
-import org.eclipse.scout.rt.client.ui.basic.table.OrganizeColumnsForm.MainBox.GroupBox;
-import org.eclipse.scout.rt.client.ui.basic.table.OrganizeColumnsForm.MainBox.GroupBox.ColumnSortingBox;
-import org.eclipse.scout.rt.client.ui.basic.table.OrganizeColumnsForm.MainBox.GroupBox.ColumnSortingBox.AscendingButton;
-import org.eclipse.scout.rt.client.ui.basic.table.OrganizeColumnsForm.MainBox.GroupBox.ColumnSortingBox.DescendingButton;
-import org.eclipse.scout.rt.client.ui.basic.table.OrganizeColumnsForm.MainBox.GroupBox.ColumnSortingBox.WithoutButton;
-import org.eclipse.scout.rt.client.ui.basic.table.OrganizeColumnsForm.MainBox.GroupBox.ColumnsTableField;
-import org.eclipse.scout.rt.client.ui.basic.table.OrganizeColumnsForm.MainBox.GroupBox.FilterBox;
-import org.eclipse.scout.rt.client.ui.basic.table.OrganizeColumnsForm.MainBox.GroupBox.FilterBox.EditFilterButton;
-import org.eclipse.scout.rt.client.ui.basic.table.OrganizeColumnsForm.MainBox.GroupBox.FilterBox.RemoveFilterButton;
-import org.eclipse.scout.rt.client.ui.basic.table.OrganizeColumnsForm.MainBox.GroupBox.ResetBox;
-import org.eclipse.scout.rt.client.ui.basic.table.OrganizeColumnsForm.MainBox.GroupBox.ResetBox.ResetAllButton;
-import org.eclipse.scout.rt.client.ui.basic.table.OrganizeColumnsForm.MainBox.GroupBox.ResetBox.ResetColumnFiltersButton;
-import org.eclipse.scout.rt.client.ui.basic.table.OrganizeColumnsForm.MainBox.GroupBox.ResetBox.ResetSortingButton;
-import org.eclipse.scout.rt.client.ui.basic.table.OrganizeColumnsForm.MainBox.GroupBox.ResetBox.ResetViewButton;
-import org.eclipse.scout.rt.client.ui.basic.table.OrganizeColumnsForm.MainBox.GroupBox.ViewBox;
-import org.eclipse.scout.rt.client.ui.basic.table.OrganizeColumnsForm.MainBox.GroupBox.ViewBox.AddCustomColumnButton;
-import org.eclipse.scout.rt.client.ui.basic.table.OrganizeColumnsForm.MainBox.GroupBox.ViewBox.DeselectAllButton;
-import org.eclipse.scout.rt.client.ui.basic.table.OrganizeColumnsForm.MainBox.GroupBox.ViewBox.ModifyCustomColumnButton;
-import org.eclipse.scout.rt.client.ui.basic.table.OrganizeColumnsForm.MainBox.GroupBox.ViewBox.MoveDownButton;
-import org.eclipse.scout.rt.client.ui.basic.table.OrganizeColumnsForm.MainBox.GroupBox.ViewBox.MoveUpButton;
-import org.eclipse.scout.rt.client.ui.basic.table.OrganizeColumnsForm.MainBox.GroupBox.ViewBox.RemoveCustomColumnButton;
-import org.eclipse.scout.rt.client.ui.basic.table.OrganizeColumnsForm.MainBox.GroupBox.ViewBox.SelectAllButton;
-import org.eclipse.scout.rt.client.ui.basic.table.OrganizeColumnsForm.MainBox.OkButton;
-import org.eclipse.scout.rt.client.ui.basic.table.columnfilter.ITableColumnFilter;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractBooleanColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractStringColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.customizer.ICustomColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.menus.ResetColumnsMenu;
-import org.eclipse.scout.rt.client.ui.basic.table.menus.ResetColumnsMenu.ResetAllMenu;
-import org.eclipse.scout.rt.client.ui.basic.table.menus.ResetColumnsMenu.ResetColumnFiltersMenu;
-import org.eclipse.scout.rt.client.ui.basic.table.menus.ResetColumnsMenu.ResetSortingMenu;
-import org.eclipse.scout.rt.client.ui.basic.table.menus.ResetColumnsMenu.ResetViewMenu;
-import org.eclipse.scout.rt.client.ui.form.AbstractForm;
-import org.eclipse.scout.rt.client.ui.form.AbstractFormHandler;
-import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractCancelButton;
-import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractLinkButton;
-import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractOkButton;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
-import org.eclipse.scout.rt.client.ui.form.fields.tablefield.AbstractTableField;
-import org.eclipse.scout.rt.shared.AbstractIcons;
-import org.eclipse.scout.rt.shared.TEXTS;
-import org.eclipse.scout.rt.shared.data.basic.FontSpec;
-import org.eclipse.scout.rt.shared.security.CreateCustomColumnPermission;
-import org.eclipse.scout.rt.shared.security.DeleteCustomColumnPermission;
-import org.eclipse.scout.rt.shared.security.UpdateCustomColumnPermission;
-import org.eclipse.scout.rt.shared.services.common.bookmark.TableColumnState;
-
-public class OrganizeColumnsForm extends AbstractForm {
-
- ITable m_table;
-
- public OrganizeColumnsForm(ITable table) throws ProcessingException {
- super(false);
- m_table = table;
- callInitializer();
- }
-
- @Override
- protected String getConfiguredTitle() {
- return TEXTS.get("OrganizeTableColumnsTitle");
- }
-
- public AddCustomColumnButton getAddCustomColumnButton() {
- return getFieldByClass(AddCustomColumnButton.class);
- }
-
- public AscendingButton getAscendingButton() {
- return getFieldByClass(AscendingButton.class);
- }
-
- public CancelButton getCancelButton() {
- return getFieldByClass(CancelButton.class);
- }
-
- public void startModify() throws ProcessingException {
- startInternal(new OrganizeColumnsForm.ModifyHandler());
- }
-
- public ColumnSortingBox getColumnSortingBox() {
- return getFieldByClass(ColumnSortingBox.class);
- }
-
- public ColumnsTableField getColumnsTableField() {
- return getFieldByClass(ColumnsTableField.class);
- }
-
- public DescendingButton getDescendingButton() {
- return getFieldByClass(DescendingButton.class);
- }
-
- public DeselectAllButton getDeselectAllButton() {
- return getFieldByClass(DeselectAllButton.class);
- }
-
- public EditFilterButton getEditFilterButton() {
- return getFieldByClass(EditFilterButton.class);
- }
-
- public RemoveFilterButton getRemoveFilterButton() {
- return getFieldByClass(RemoveFilterButton.class);
- }
-
- public FilterBox getFilterBox() {
- return getFieldByClass(FilterBox.class);
- }
-
- public GroupBox getGroupBox() {
- return getFieldByClass(GroupBox.class);
- }
-
- public MainBox getMainBox() {
- return getFieldByClass(MainBox.class);
- }
-
- public ModifyCustomColumnButton getModifyCustomColumnButton() {
- return getFieldByClass(ModifyCustomColumnButton.class);
- }
-
- public MoveDownButton getMoveDownButton() {
- return getFieldByClass(MoveDownButton.class);
- }
-
- public MoveUpButton getMoveUpButton() {
- return getFieldByClass(MoveUpButton.class);
- }
-
- public OkButton getOkButton() {
- return getFieldByClass(OkButton.class);
- }
-
- public RemoveCustomColumnButton getRemoveCustomColumnButton() {
- return getFieldByClass(RemoveCustomColumnButton.class);
- }
-
- public ResetAllButton getResetAllButton() {
- return getFieldByClass(ResetAllButton.class);
- }
-
- public ResetBox getResetBox() {
- return getFieldByClass(ResetBox.class);
- }
-
- public ResetColumnFiltersButton getResetColumnFilters() {
- return getFieldByClass(ResetColumnFiltersButton.class);
- }
-
- public ResetSortingButton getResetSortingButton() {
- return getFieldByClass(ResetSortingButton.class);
- }
-
- public ResetViewButton getResetViewButton() {
- return getFieldByClass(ResetViewButton.class);
- }
-
- public SelectAllButton getSelectAllButton() {
- return getFieldByClass(SelectAllButton.class);
- }
-
- public ViewBox getViewBox() {
- return getFieldByClass(ViewBox.class);
- }
-
- public WithoutButton getWithoutButton() {
- return getFieldByClass(WithoutButton.class);
- }
-
- @Order(10.0)
- public class MainBox extends AbstractGroupBox {
-
- @Override
- protected int getConfiguredGridColumnCount() {
- return 3;
- }
-
- @Override
- protected int getConfiguredGridW() {
- return 2;
- }
-
- @Override
- protected int getConfiguredWidthInPixel() {
- return 520;
- }
-
- @Order(10.0)
- public class GroupBox extends AbstractGroupBox {
-
- @Override
- protected int getConfiguredGridW() {
- return 1;
- }
-
- @Order(10.0)
- public class ColumnsTableField extends AbstractTableField<ColumnsTableField.Table> {
-
- @Override
- protected int getConfiguredGridH() {
- return 5;
- }
-
- @Override
- protected int getConfiguredGridW() {
- return 2;
- }
-
- @Override
- protected String getConfiguredLabel() {
- return TEXTS.get("Columns");
- }
-
- @Override
- protected boolean getConfiguredLabelVisible() {
- return false;
- }
-
- @Override
- protected void execReloadTableData() throws ProcessingException {
- ArrayList<ITableRow> rowList = new ArrayList<ITableRow>();
- for (IColumn<?> col : m_table.getColumnSet().getAllColumnsInUserOrder()) {
- if (col.isDisplayable()) {
- if (col.isVisible() || col.isVisibleGranted()) {
- IHeaderCell headerCell = col.getHeaderCell();
- TableRow row = new TableRow(getTable().getColumnSet());
-
- // Key
- getTable().getKeyColumn().setValue(row, col);
-
- // Visible
- getTable().getVisibleColumn().setValue(row, col.isVisible());
-
- // Column Title
- String columnTitle = headerCell.getText();
- if (StringUtility.isNullOrEmpty(columnTitle)) {
- columnTitle = headerCell.getTooltipText();
- row.setFont(FontSpec.parse("ITALIC"));
- }
- getTable().getTitleColumn().setValue(row, columnTitle);
- if (Platform.inDevelopmentMode() && col.isSortActive()) {
- getTable().getTitleColumn().setValue(row, columnTitle + " (" + col.getSortIndex() + ")");
- }
-
- // Custom Column
- if (col instanceof ICustomColumn<?>) {
- row.getCellForUpdate(getTable().getCustomColumnColumn().getColumnIndex()).setIconId(AbstractIcons.TableCustomColumn);
- }
-
- // Sorting
- getTable().getSortingColumn().setValue(row, col);
- if (col.isSortActive()) {
- row.getCellForUpdate(getTable().getSortingColumn().getColumnIndex()).setIconId(col.isSortAscending() ? AbstractIcons.TableSortAsc : AbstractIcons.TableSortDesc);
- }
-
- // Filter
- if (col.isColumnFilterActive()) {
- row.getCellForUpdate(getTable().getFilterColumn().getColumnIndex()).setIconId(AbstractIcons.TableColumnFilterActive);
- }
-
- rowList.add(row);
- }
- }
- }
- try {
- getTable().setTableChanging(true);
- getTable().discardAllRows();
- getTable().addRows(rowList.toArray(new ITableRow[rowList.size()]));
- }
- finally {
- getTable().setTableChanging(false);
- }
- }
-
- @Order(10.0)
- public class Table extends AbstractTable {
-
- @Override
- protected int getConfiguredDragType() {
- return IDNDSupport.TYPE_JAVA_ELEMENT_TRANSFER;
- }
-
- @Override
- protected int getConfiguredDropType() {
- return IDNDSupport.TYPE_JAVA_ELEMENT_TRANSFER;
- }
-
- @Override
- protected TransferObject execDrag(ITableRow[] rows) throws ProcessingException {
- return new JavaTransferObject(rows);
- }
-
- @Override
- protected void execDrop(ITableRow row, TransferObject transfer) throws ProcessingException {
- if (transfer != null && transfer instanceof JavaTransferObject) {
- Object localObject = ((JavaTransferObject) transfer).getLocalObject();
- if (localObject != null) {
- if (localObject instanceof ITableRow[]) {
- ITableRow[] draggedRows = (ITableRow[]) localObject;
- if (draggedRows != null && draggedRows.length > 0) {
- ITableRow draggedRow = draggedRows[0];
- if (draggedRow.getRowIndex() != row.getRowIndex()) {
- // target row other than source row
- try {
- getTable().setTableChanging(true);
- if (draggedRow.getRowIndex() < row.getRowIndex()) {
- while (draggedRow.getRowIndex() <= row.getRowIndex()) {
- moveDown(draggedRow);
- }
- }
- else {
- while (draggedRow.getRowIndex() >= row.getRowIndex()) {
- moveUp(draggedRow);
- }
- }
- updateColumnVisibilityAndOrder();
- }
- finally {
- getTable().setTableChanging(false);
- }
- }
- }
- }
- }
- }
- }
-
- @Override
- protected boolean getConfiguredAutoResizeColumns() {
- return true;
- }
-
- @Override
- protected boolean getConfiguredMultiSelect() {
- return false;
- }
-
- @Override
- protected boolean getConfiguredHeaderVisible() {
- return false;
- }
-
- public KeyColumn getKeyColumn() {
- return getColumnSet().getColumnByClass(KeyColumn.class);
- }
-
- public SortingColumn getSortingColumn() {
- return getColumnSet().getColumnByClass(SortingColumn.class);
- }
-
- public FilterColumn getFilterColumn() {
- return getColumnSet().getColumnByClass(FilterColumn.class);
- }
-
- public CustomColumnColumn getCustomColumnColumn() {
- return getColumnSet().getColumnByClass(CustomColumnColumn.class);
- }
-
- public TitleColumn getTitleColumn() {
- return getColumnSet().getColumnByClass(TitleColumn.class);
- }
-
- public VisibleColumn getVisibleColumn() {
- return getColumnSet().getColumnByClass(VisibleColumn.class);
- }
-
- @Override
- protected void execRowClick(ITableRow row) throws ProcessingException {
- if (row != null && getContextColumn() == getVisibleColumn() && getKeyColumn().getValue(row) != null) {
- Boolean oldValue = getVisibleColumn().getValue(row);
- setColumnVisible(row, !oldValue);
- }
- }
-
- @Override
- protected void execRowsSelected(ITableRow[] rows) throws ProcessingException {
- validateButtons();
- }
-
- @Order(10.0)
- public class SpaceKeyStroke extends AbstractKeyStroke {
- @Override
- protected String getConfiguredKeyStroke() {
- return "space";
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- for (ITableRow row : getSelectedRows()) {
- Boolean oldValue = BooleanUtility.nvl(getVisibleColumn().getValue(row));
- setColumnVisible(row, !oldValue);
- }
- }
- }
-
- @Order(20.0)
- public class UpKeyStroke extends AbstractKeyStroke {
- @Override
- protected String getConfiguredKeyStroke() {
- return "alt-up";
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- moveUp(getSelectedRow());
- }
- }
-
- @Order(30.0)
- public class DownKeyStroke extends AbstractKeyStroke {
- @Override
- protected String getConfiguredKeyStroke() {
- return "alt-down";
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- moveDown(getSelectedRow());
- }
- }
-
- @Order(10.0)
- public class KeyColumn extends AbstractColumn<IColumn<?>> {
-
- @Override
- protected boolean getConfiguredPrimaryKey() {
- return true;
- }
-
- @Override
- protected boolean getConfiguredDisplayable() {
- return false;
- }
- }
-
- @Order(20.0)
- public class VisibleColumn extends AbstractBooleanColumn {
-
- @Override
- protected String getConfiguredHeaderText() {
- return TEXTS.get("Visible");
- }
-
- @Override
- protected int getConfiguredWidth() {
- return 20;
- }
-
- }
-
- @Order(30.0)
- public class TitleColumn extends AbstractStringColumn {
-
- @Override
- protected String getConfiguredHeaderText() {
- return TEXTS.get("Title");
- }
-
- @Override
- protected int getConfiguredWidth() {
- return 200;
- }
-
- }
-
- @Order(40.0)
- public class SortingColumn extends AbstractSortOrderColumn {
-
- @Override
- protected String getConfiguredHeaderText() {
- return TEXTS.get("ColumnSorting");
- }
-
- @Override
- protected int getConfiguredWidth() {
- return 20;
- }
-
- }
-
- @Order(50.0)
- public class FilterColumn extends AbstractStringColumn {
-
- @Override
- protected String getConfiguredHeaderText() {
- return TEXTS.get("ResetTableColumnFilter");
- }
-
- @Override
- protected int getConfiguredWidth() {
- return 20;
- }
-
- }
-
- @Order(60.0)
- public class CustomColumnColumn extends AbstractStringColumn {
-
- @Override
- protected int getConfiguredWidth() {
- return 20;
- }
-
- }
-
- }
- }
-
- @Order(20.0)
- public class ViewBox extends AbstractGroupBox {
-
- @Override
- protected int getConfiguredGridColumnCount() {
- return 1;
- }
-
- @Override
- protected int getConfiguredGridW() {
- return 1;
- }
-
- @Override
- protected String getConfiguredLabel() {
- return TEXTS.get("ResetTableColumnsView");
- }
-
- @Order(10.0)
- public class SelectAllButton extends AbstractLinkButton {
-
- @Override
- protected String getConfiguredLabel() {
- return TEXTS.get("ButtonSelectAll");
- }
-
- @Override
- protected boolean getConfiguredProcessButton() {
- return false;
- }
-
- @Override
- protected void execClickAction() throws ProcessingException {
- for (ITableRow row : getColumnsTableField().getTable().getRows()) {
- setColumnVisible(row, true);
- }
- }
-
- }
-
- @Order(20.0)
- public class DeselectAllButton extends AbstractLinkButton {
-
- @Override
- protected String getConfiguredLabel() {
- return TEXTS.get("ButtonDeselectAll");
- }
-
- @Override
- protected boolean getConfiguredProcessButton() {
- return false;
- }
-
- @Override
- protected void execClickAction() throws ProcessingException {
- for (ITableRow row : getColumnsTableField().getTable().getRows()) {
- setColumnVisible(row, false);
- }
- }
-
- }
-
- @Order(30.0)
- public class MoveUpButton extends AbstractLinkButton {
-
- @Override
- protected String getConfiguredLabel() {
- return TEXTS.get("ButtonMoveUp");
- }
-
- @Override
- protected boolean getConfiguredProcessButton() {
- return false;
- }
-
- @Override
- protected void execClickAction() throws ProcessingException {
- moveUp(getColumnsTableField().getTable().getSelectedRow());
- }
-
- }
-
- @Order(40.0)
- public class MoveDownButton extends AbstractLinkButton {
-
- @Override
- protected String getConfiguredLabel() {
- return TEXTS.get("ButtonMoveDown");
- }
-
- @Override
- protected boolean getConfiguredProcessButton() {
- return false;
- }
-
- @Override
- protected void execClickAction() {
- moveDown(getColumnsTableField().getTable().getSelectedRow());
- }
-
- }
-
- @Order(50.0)
- public class AddCustomColumnButton extends AbstractLinkButton {
-
- @Override
- protected String getConfiguredLabel() {
- return TEXTS.get("AddCustomColumnMenu");
- }
-
- @Override
- protected boolean getConfiguredProcessButton() {
- return false;
- }
-
- @Override
- protected void execInitField() throws ProcessingException {
- setVisiblePermission(new CreateCustomColumnPermission());
- setVisible(m_table.getTableCustomizer() != null);
- }
-
- @Override
- protected void execClickAction() throws ProcessingException {
- if (m_table != null) {
- if (m_table.getTableCustomizer() != null) {
- ArrayList<String> existingColumns = new ArrayList<String>();
- for (IColumn c : m_table.getColumns()) {
- existingColumns.add(c.getColumnId());
- }
- m_table.getTableCustomizer().addColumn();
-
- // find target row (selected row or first row)
- ITableRow targetOrderRow = getColumnsTableField().getTable().getSelectedRow();
- if (targetOrderRow == null && getColumnsTableField().getTable().getRowCount() > 0) {
- targetOrderRow = getColumnsTableField().getTable().getRow(0);
- }
- if (targetOrderRow == null) {
- return;
- }
-
- // find new row
- getColumnsTableField().reloadTableData();
- for (ITableRow newColumnRow : getColumnsTableField().getTable().getRows()) {
- if (!existingColumns.contains(getColumnsTableField().getTable().getKeyColumn().getValue(newColumnRow).getColumnId())) {
- // move new column
- try {
- getColumnsTableField().getTable().setTableChanging(true);
- if (newColumnRow.getRowIndex() < targetOrderRow.getRowIndex()) {
- while (newColumnRow.getRowIndex() < targetOrderRow.getRowIndex()) {
- moveDown(newColumnRow);
- }
- }
- else {
- while (newColumnRow.getRowIndex() > targetOrderRow.getRowIndex()) {
- moveUp(newColumnRow);
- }
- }
- updateColumnVisibilityAndOrder();
-
- // select new row
- getColumnsTableField().getTable().selectRow(newColumnRow);
- }
- finally {
- getColumnsTableField().getTable().setTableChanging(false);
- }
- break;
- }
- }
- }
- }
- }
-
- }
-
- @Order(60.0)
- public class ModifyCustomColumnButton extends AbstractLinkButton {
-
- @Override
- protected String getConfiguredLabel() {
- return TEXTS.get("SC_Label_Change");
- }
-
- @Override
- protected boolean getConfiguredProcessButton() {
- return false;
- }
-
- @Override
- protected void execInitField() throws ProcessingException {
- setVisiblePermission(new UpdateCustomColumnPermission());
- }
-
- @Override
- protected void execClickAction() throws ProcessingException {
- if (m_table != null) {
- if (m_table.getTableCustomizer() != null) {
- if (getColumnsTableField().getTable().getSelectedRow() != null) {
- IColumn<?> selectedCol = getColumnsTableField().getTable().getKeyColumn().getValue(getColumnsTableField().getTable().getSelectedRow());
- if (selectedCol instanceof ICustomColumn<?>) {
- m_table.getTableCustomizer().modifyColumn((ICustomColumn<?>) selectedCol);
- }
- }
- }
- }
- getColumnsTableField().reloadTableData();
- }
-
- }
-
- @Order(70.0)
- public class RemoveCustomColumnButton extends AbstractLinkButton {
-
- @Override
- protected String getConfiguredLabel() {
- return TEXTS.get("Remove");
- }
-
- @Override
- protected boolean getConfiguredProcessButton() {
- return false;
- }
-
- @Override
- protected void execInitField() throws ProcessingException {
- setVisiblePermission(new DeleteCustomColumnPermission());
- }
-
- @Override
- protected void execClickAction() throws ProcessingException {
- if (m_table != null) {
- if (m_table.getTableCustomizer() != null) {
- if (getColumnsTableField().getTable().getSelectedRow() != null) {
- IColumn<?> selectedCol = getColumnsTableField().getTable().getKeyColumn().getValue(getColumnsTableField().getTable().getSelectedRow());
- if (selectedCol instanceof ICustomColumn<?>) {
- m_table.getTableCustomizer().removeColumn((ICustomColumn<?>) selectedCol);
- }
- }
- }
- }
- getColumnsTableField().reloadTableData();
- }
-
- }
- }
-
- @Order(30.0)
- public class ColumnSortingBox extends AbstractGroupBox {
-
- @Override
- protected int getConfiguredGridColumnCount() {
- return 1;
- }
-
- @Override
- protected int getConfiguredGridW() {
- return 1;
- }
-
- @Override
- protected String getConfiguredLabel() {
- return TEXTS.get("ColumnSorting");
- }
-
- @Order(10.0)
- public class AscendingButton extends AbstractLinkButton {
-
- @Override
- protected String getConfiguredLabel() {
- return TEXTS.get("Ascending");
- }
-
- @Override
- protected boolean getConfiguredProcessButton() {
- return false;
- }
-
- @Override
- protected void execClickAction() throws ProcessingException {
- setSort(true);
- }
-
- }
-
- @Order(20.0)
- public class DescendingButton extends AbstractLinkButton {
-
- @Override
- protected String getConfiguredLabel() {
- return TEXTS.get("Descending");
- }
-
- @Override
- protected boolean getConfiguredProcessButton() {
- return false;
- }
-
- @Override
- protected void execClickAction() throws ProcessingException {
- setSort(false);
- }
-
- }
-
- @Order(30.0)
- public class WithoutButton extends AbstractLinkButton {
-
- @Override
- protected String getConfiguredLabel() {
- return TEXTS.get("Without");
- }
-
- @Override
- protected boolean getConfiguredProcessButton() {
- return false;
- }
-
- @Override
- protected void execClickAction() throws ProcessingException {
- setSort(null);
- }
-
- }
- }
-
- @Order(40.0)
- public class FilterBox extends AbstractGroupBox {
-
- @Override
- protected int getConfiguredGridColumnCount() {
- return 1;
- }
-
- @Override
- protected int getConfiguredGridW() {
- return 1;
- }
-
- @Override
- protected String getConfiguredLabel() {
- return TEXTS.get("ResetTableColumnFilter");
- }
-
- @Order(10.0)
- public class EditFilterButton extends AbstractLinkButton {
-
- @Override
- protected String getConfiguredLabel() {
- return TEXTS.get("EditFilterMenu");
- }
-
- @Override
- protected boolean getConfiguredProcessButton() {
- return false;
- }
-
- @Override
- protected void execClickAction() throws ProcessingException {
- Integer selectedIndex = null;
- if (m_table != null && getColumnsTableField().getTable().getSelectedRow() != null) {
- selectedIndex = getColumnsTableField().getTable().getSelectedRow().getRowIndex();
- if (m_table.getColumnFilterManager() != null) {
- IColumn<?> col = getColumnsTableField().getTable().getKeyColumn().getValue(getColumnsTableField().getTable().getSelectedRow());
- if (col != null) {
- m_table.getColumnFilterManager().showFilterForm(col, false);
- }
- }
- }
- getColumnsTableField().reloadTableData();
- if (selectedIndex != null) {
- getColumnsTableField().getTable().selectRow(selectedIndex);
- }
- }
-
- }
-
- @Order(20.0)
- public class RemoveFilterButton extends AbstractLinkButton {
-
- @Override
- protected String getConfiguredLabel() {
- return TEXTS.get("Remove");
- }
-
- @Override
- protected boolean getConfiguredProcessButton() {
- return false;
- }
-
- @Override
- protected void execClickAction() throws ProcessingException {
- Integer selectedIndex = null;
- if (m_table != null && getColumnsTableField().getTable().getSelectedRow() != null) {
- selectedIndex = getColumnsTableField().getTable().getSelectedRow().getRowIndex();
- if (m_table.getColumnFilterManager() != null) {
- IColumn<?> col = getColumnsTableField().getTable().getKeyColumn().getValue(getColumnsTableField().getTable().getSelectedRow());
- if (col != null) {
- ITableColumnFilter<?> filter = m_table.getColumnFilterManager().getFilter(col);
- m_table.getColumnFilterManager().getFilters().remove(filter);
- m_table.applyRowFilters();
- }
- }
- }
- getColumnsTableField().reloadTableData();
- if (selectedIndex != null) {
- getColumnsTableField().getTable().selectRow(selectedIndex);
- }
- }
-
- }
-
- }
-
- @Order(50.0)
- public class ResetBox extends AbstractGroupBox {
-
- @Override
- protected int getConfiguredGridColumnCount() {
- return 1;
- }
-
- @Override
- protected int getConfiguredGridW() {
- return 1;
- }
-
- @Override
- protected String getConfiguredLabel() {
- return TEXTS.get("FormReset");
- }
-
- @Order(10.0)
- public class ResetAllButton extends AbstractLinkButton {
-
- @Override
- protected String getConfiguredLabel() {
- return TEXTS.get("ResetTableColumnsAll");
- }
-
- @Override
- protected boolean getConfiguredProcessButton() {
- return false;
- }
-
- @Override
- protected void execClickAction() throws ProcessingException {
- doResetAction(ResetAllMenu.class);
- }
-
- }
-
- @Order(20.0)
- public class ResetViewButton extends AbstractLinkButton {
-
- @Override
- protected String getConfiguredLabel() {
- return TEXTS.get("ResetTableColumnsView");
- }
-
- @Override
- protected boolean getConfiguredProcessButton() {
- return false;
- }
-
- @Override
- protected void execClickAction() throws ProcessingException {
- doResetAction(ResetViewMenu.class);
- }
-
- }
-
- @Order(30.0)
- public class ResetSortingButton extends AbstractLinkButton {
-
- @Override
- protected String getConfiguredLabel() {
- return TEXTS.get("ColumnSorting");
- }
-
- @Override
- protected boolean getConfiguredProcessButton() {
- return false;
- }
-
- @Override
- protected void execClickAction() throws ProcessingException {
- doResetAction(ResetSortingMenu.class);
- }
-
- }
-
- @Order(40.0)
- public class ResetColumnFiltersButton extends AbstractLinkButton {
-
- @Override
- protected String getConfiguredLabel() {
- return TEXTS.get("ResetTableColumnFilter");
- }
-
- @Override
- protected boolean getConfiguredProcessButton() {
- return false;
- }
-
- @Override
- protected void execClickAction() throws ProcessingException {
- doResetAction(ResetColumnFiltersMenu.class);
- }
-
- }
- }
-
- }
-
- @Order(20.0)
- public class OkButton extends AbstractOkButton {
- }
-
- @Order(30.0)
- public class CancelButton extends AbstractCancelButton {
- }
- }
-
- private void updateColumnVisibilityAndOrder() {
- IColumn<?>[] visibleColumns = getColumnsTableField().getTable().getKeyColumn().getValues(getColumnsTableField().getTable().getVisibleColumn().findRows(true));
- m_table.getColumnSet().setVisibleColumns(visibleColumns);
- }
-
- private void setColumnVisible(ITableRow row, Boolean visible) throws ProcessingException {
- getColumnsTableField().getTable().getVisibleColumn().setValue(row, visible);
- getColumnsTableField().getTable().getKeyColumn().getValue(row).setVisible(visible);
-
- updateColumnVisibilityAndOrder();
- }
-
- private void moveUp(ITableRow row) {
- if (row != null && row.getRowIndex() - 1 >= 0) {
- getColumnsTableField().getTable().moveRow(row.getRowIndex(), row.getRowIndex() - 1);
- }
-
- updateColumnVisibilityAndOrder();
- }
-
- private void moveDown(ITableRow row) {
- if (row != null && row.getRowIndex() + 1 < getColumnsTableField().getTable().getRowCount()) {
- getColumnsTableField().getTable().moveRow(row.getRowIndex(), row.getRowIndex() + 1);
- }
-
- updateColumnVisibilityAndOrder();
- }
-
- private void validateButtons() {
- ITableRow selectedRow = getColumnsTableField().getTable().getSelectedRow();
- boolean selectedRowExists = selectedRow != null;
- boolean isCustomColumn = selectedRow != null && getColumnsTableField().getTable().getKeyColumn().getValue(selectedRow) instanceof ICustomColumn<?>;
- boolean selectedRowHasFilter = selectedRowExists && getColumnsTableField().getTable().getKeyColumn().getValue(selectedRow).isColumnFilterActive();
- boolean sortEnabled = m_table.isSortEnabled();
- getModifyCustomColumnButton().setEnabled(isCustomColumn);
- getRemoveCustomColumnButton().setEnabled(isCustomColumn);
-
- getMoveDownButton().setEnabled(selectedRowExists);
- getMoveUpButton().setEnabled(selectedRowExists);
-
- getAscendingButton().setEnabled(sortEnabled && selectedRowExists);
- getDescendingButton().setEnabled(sortEnabled && selectedRowExists);
- getWithoutButton().setEnabled(sortEnabled && selectedRowExists);
-
- getEditFilterButton().setEnabled(selectedRowExists);
- getRemoveFilterButton().setEnabled(selectedRowHasFilter);
- }
-
- private void doResetAction(Class<? extends IMenu> action) throws ProcessingException {
- ResetColumnsMenu menu = new ResetColumnsMenu(m_table);
- List<IMenu> childs = menu.getChildActions();
- for (IMenu child : childs) {
- if (child.getClass().equals(action)) {
- child.doAction();
- }
- }
- getColumnsTableField().reloadTableData();
- }
-
- private void setSort(Boolean ascending) throws ProcessingException {
- ITableRow row = getColumnsTableField().getTable().getSelectedRow();
- if (row == null) {
- return;
- }
-
- try {
- getColumnsTableField().getTable().setTableChanging(true);
- IColumn selectedCol = getColumnsTableField().getTable().getKeyColumn().getValue(row);
- if (ascending == null) {
- m_table.getColumnSet().removeSortColumn(selectedCol);
- }
- else {
- if (m_table.getColumnSet().isSortColumn(selectedCol)) {
- m_table.getColumnSet().handleSortEvent(selectedCol, true);
- }
- else {
- m_table.getColumnSet().addSortColumn(selectedCol, ascending);
- }
- }
- m_table.sort();
-
- getColumnsTableField().reloadTableData();
- getColumnsTableField().getTable().selectRow(row.getRowIndex());
- }
- finally {
- getColumnsTableField().getTable().setTableChanging(false);
- }
- }
-
- @Override
- public void validateForm() throws ProcessingException {
- boolean oneColumnIsVisble = false;
- for (Boolean visible : getColumnsTableField().getTable().getVisibleColumn().getValues()) {
- if (BooleanUtility.nvl(visible)) {
- oneColumnIsVisble = true;
- break;
- }
- }
-
- if (!oneColumnIsVisble) {
- throw new VetoException(TEXTS.get("OrganizeTableColumnsMinimalColumnCountMessage"));
- }
- }
-
- public class ModifyHandler extends AbstractFormHandler {
-
- private List<TableColumnState> m_oldColumns;
-
- @Override
- protected void execLoad() throws ProcessingException {
- // Back-up the current columns so we may restore them if
- // the "organize columns" form is canceled:
- m_oldColumns = BookmarkUtility.backupTableColumns(m_table);
- getColumnsTableField().reloadTableData();
- }
-
- @Override
- protected void execPostLoad() throws ProcessingException {
- validateButtons();
- }
-
- @Override
- protected void execStore() throws ProcessingException {
- // make changes persistent
- ClientUIPreferences.getInstance().setAllTableColumnPreferences(m_table);
- }
-
- @Override
- protected void execFinally() throws ProcessingException {
- if (!isFormStored() && isSaveNeeded()) {
- // revert to original state
- try {
- m_table.setTableChanging(true);
- BookmarkUtility.restoreTableColumns(m_table, m_oldColumns);
- }
- finally {
- m_table.setTableChanging(false);
- }
- }
- }
-
- }
-}
+package org.eclipse.scout.rt.client.ui.basic.table;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.scout.commons.BooleanUtility;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.dnd.JavaTransferObject;
+import org.eclipse.scout.commons.dnd.TransferObject;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.exception.VetoException;
+import org.eclipse.scout.rt.client.services.common.bookmark.internal.BookmarkUtility;
+import org.eclipse.scout.rt.client.ui.ClientUIPreferences;
+import org.eclipse.scout.rt.client.ui.IDNDSupport;
+import org.eclipse.scout.rt.client.ui.action.keystroke.AbstractKeyStroke;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.basic.table.OrganizeColumnsForm.MainBox.CancelButton;
+import org.eclipse.scout.rt.client.ui.basic.table.OrganizeColumnsForm.MainBox.GroupBox;
+import org.eclipse.scout.rt.client.ui.basic.table.OrganizeColumnsForm.MainBox.GroupBox.ColumnSortingBox;
+import org.eclipse.scout.rt.client.ui.basic.table.OrganizeColumnsForm.MainBox.GroupBox.ColumnSortingBox.AscendingButton;
+import org.eclipse.scout.rt.client.ui.basic.table.OrganizeColumnsForm.MainBox.GroupBox.ColumnSortingBox.DescendingButton;
+import org.eclipse.scout.rt.client.ui.basic.table.OrganizeColumnsForm.MainBox.GroupBox.ColumnSortingBox.WithoutButton;
+import org.eclipse.scout.rt.client.ui.basic.table.OrganizeColumnsForm.MainBox.GroupBox.ColumnsTableField;
+import org.eclipse.scout.rt.client.ui.basic.table.OrganizeColumnsForm.MainBox.GroupBox.FilterBox;
+import org.eclipse.scout.rt.client.ui.basic.table.OrganizeColumnsForm.MainBox.GroupBox.FilterBox.EditFilterButton;
+import org.eclipse.scout.rt.client.ui.basic.table.OrganizeColumnsForm.MainBox.GroupBox.FilterBox.RemoveFilterButton;
+import org.eclipse.scout.rt.client.ui.basic.table.OrganizeColumnsForm.MainBox.GroupBox.ResetBox;
+import org.eclipse.scout.rt.client.ui.basic.table.OrganizeColumnsForm.MainBox.GroupBox.ResetBox.ResetAllButton;
+import org.eclipse.scout.rt.client.ui.basic.table.OrganizeColumnsForm.MainBox.GroupBox.ResetBox.ResetColumnFiltersButton;
+import org.eclipse.scout.rt.client.ui.basic.table.OrganizeColumnsForm.MainBox.GroupBox.ResetBox.ResetSortingButton;
+import org.eclipse.scout.rt.client.ui.basic.table.OrganizeColumnsForm.MainBox.GroupBox.ResetBox.ResetViewButton;
+import org.eclipse.scout.rt.client.ui.basic.table.OrganizeColumnsForm.MainBox.GroupBox.ViewBox;
+import org.eclipse.scout.rt.client.ui.basic.table.OrganizeColumnsForm.MainBox.GroupBox.ViewBox.AddCustomColumnButton;
+import org.eclipse.scout.rt.client.ui.basic.table.OrganizeColumnsForm.MainBox.GroupBox.ViewBox.DeselectAllButton;
+import org.eclipse.scout.rt.client.ui.basic.table.OrganizeColumnsForm.MainBox.GroupBox.ViewBox.ModifyCustomColumnButton;
+import org.eclipse.scout.rt.client.ui.basic.table.OrganizeColumnsForm.MainBox.GroupBox.ViewBox.MoveDownButton;
+import org.eclipse.scout.rt.client.ui.basic.table.OrganizeColumnsForm.MainBox.GroupBox.ViewBox.MoveUpButton;
+import org.eclipse.scout.rt.client.ui.basic.table.OrganizeColumnsForm.MainBox.GroupBox.ViewBox.RemoveCustomColumnButton;
+import org.eclipse.scout.rt.client.ui.basic.table.OrganizeColumnsForm.MainBox.GroupBox.ViewBox.SelectAllButton;
+import org.eclipse.scout.rt.client.ui.basic.table.OrganizeColumnsForm.MainBox.OkButton;
+import org.eclipse.scout.rt.client.ui.basic.table.columnfilter.ITableColumnFilter;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractBooleanColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractStringColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.customizer.ICustomColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.menus.ResetColumnsMenu;
+import org.eclipse.scout.rt.client.ui.basic.table.menus.ResetColumnsMenu.ResetAllMenu;
+import org.eclipse.scout.rt.client.ui.basic.table.menus.ResetColumnsMenu.ResetColumnFiltersMenu;
+import org.eclipse.scout.rt.client.ui.basic.table.menus.ResetColumnsMenu.ResetSortingMenu;
+import org.eclipse.scout.rt.client.ui.basic.table.menus.ResetColumnsMenu.ResetViewMenu;
+import org.eclipse.scout.rt.client.ui.form.AbstractForm;
+import org.eclipse.scout.rt.client.ui.form.AbstractFormHandler;
+import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractCancelButton;
+import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractLinkButton;
+import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractOkButton;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
+import org.eclipse.scout.rt.client.ui.form.fields.tablefield.AbstractTableField;
+import org.eclipse.scout.rt.shared.AbstractIcons;
+import org.eclipse.scout.rt.shared.TEXTS;
+import org.eclipse.scout.rt.shared.data.basic.FontSpec;
+import org.eclipse.scout.rt.shared.security.CreateCustomColumnPermission;
+import org.eclipse.scout.rt.shared.security.DeleteCustomColumnPermission;
+import org.eclipse.scout.rt.shared.security.UpdateCustomColumnPermission;
+import org.eclipse.scout.rt.shared.services.common.bookmark.TableColumnState;
+
+public class OrganizeColumnsForm extends AbstractForm {
+
+ ITable m_table;
+
+ public OrganizeColumnsForm(ITable table) throws ProcessingException {
+ super(false);
+ m_table = table;
+ callInitializer();
+ }
+
+ @Override
+ protected String getConfiguredTitle() {
+ return TEXTS.get("OrganizeTableColumnsTitle");
+ }
+
+ public AddCustomColumnButton getAddCustomColumnButton() {
+ return getFieldByClass(AddCustomColumnButton.class);
+ }
+
+ public AscendingButton getAscendingButton() {
+ return getFieldByClass(AscendingButton.class);
+ }
+
+ public CancelButton getCancelButton() {
+ return getFieldByClass(CancelButton.class);
+ }
+
+ public void startModify() throws ProcessingException {
+ startInternal(new OrganizeColumnsForm.ModifyHandler());
+ }
+
+ public ColumnSortingBox getColumnSortingBox() {
+ return getFieldByClass(ColumnSortingBox.class);
+ }
+
+ public ColumnsTableField getColumnsTableField() {
+ return getFieldByClass(ColumnsTableField.class);
+ }
+
+ public DescendingButton getDescendingButton() {
+ return getFieldByClass(DescendingButton.class);
+ }
+
+ public DeselectAllButton getDeselectAllButton() {
+ return getFieldByClass(DeselectAllButton.class);
+ }
+
+ public EditFilterButton getEditFilterButton() {
+ return getFieldByClass(EditFilterButton.class);
+ }
+
+ public RemoveFilterButton getRemoveFilterButton() {
+ return getFieldByClass(RemoveFilterButton.class);
+ }
+
+ public FilterBox getFilterBox() {
+ return getFieldByClass(FilterBox.class);
+ }
+
+ public GroupBox getGroupBox() {
+ return getFieldByClass(GroupBox.class);
+ }
+
+ public MainBox getMainBox() {
+ return getFieldByClass(MainBox.class);
+ }
+
+ public ModifyCustomColumnButton getModifyCustomColumnButton() {
+ return getFieldByClass(ModifyCustomColumnButton.class);
+ }
+
+ public MoveDownButton getMoveDownButton() {
+ return getFieldByClass(MoveDownButton.class);
+ }
+
+ public MoveUpButton getMoveUpButton() {
+ return getFieldByClass(MoveUpButton.class);
+ }
+
+ public OkButton getOkButton() {
+ return getFieldByClass(OkButton.class);
+ }
+
+ public RemoveCustomColumnButton getRemoveCustomColumnButton() {
+ return getFieldByClass(RemoveCustomColumnButton.class);
+ }
+
+ public ResetAllButton getResetAllButton() {
+ return getFieldByClass(ResetAllButton.class);
+ }
+
+ public ResetBox getResetBox() {
+ return getFieldByClass(ResetBox.class);
+ }
+
+ public ResetColumnFiltersButton getResetColumnFilters() {
+ return getFieldByClass(ResetColumnFiltersButton.class);
+ }
+
+ public ResetSortingButton getResetSortingButton() {
+ return getFieldByClass(ResetSortingButton.class);
+ }
+
+ public ResetViewButton getResetViewButton() {
+ return getFieldByClass(ResetViewButton.class);
+ }
+
+ public SelectAllButton getSelectAllButton() {
+ return getFieldByClass(SelectAllButton.class);
+ }
+
+ public ViewBox getViewBox() {
+ return getFieldByClass(ViewBox.class);
+ }
+
+ public WithoutButton getWithoutButton() {
+ return getFieldByClass(WithoutButton.class);
+ }
+
+ @Order(10.0)
+ public class MainBox extends AbstractGroupBox {
+
+ @Override
+ protected int getConfiguredGridColumnCount() {
+ return 3;
+ }
+
+ @Override
+ protected int getConfiguredGridW() {
+ return 2;
+ }
+
+ @Override
+ protected int getConfiguredWidthInPixel() {
+ return 520;
+ }
+
+ @Order(10.0)
+ public class GroupBox extends AbstractGroupBox {
+
+ @Override
+ protected int getConfiguredGridW() {
+ return 1;
+ }
+
+ @Order(10.0)
+ public class ColumnsTableField extends AbstractTableField<ColumnsTableField.Table> {
+
+ @Override
+ protected int getConfiguredGridH() {
+ return 5;
+ }
+
+ @Override
+ protected int getConfiguredGridW() {
+ return 2;
+ }
+
+ @Override
+ protected String getConfiguredLabel() {
+ return TEXTS.get("Columns");
+ }
+
+ @Override
+ protected boolean getConfiguredLabelVisible() {
+ return false;
+ }
+
+ @Override
+ protected void execReloadTableData() throws ProcessingException {
+ ArrayList<ITableRow> rowList = new ArrayList<ITableRow>();
+ for (IColumn<?> col : m_table.getColumnSet().getAllColumnsInUserOrder()) {
+ if (col.isDisplayable()) {
+ if (col.isVisible() || col.isVisibleGranted()) {
+ IHeaderCell headerCell = col.getHeaderCell();
+ TableRow row = new TableRow(getTable().getColumnSet());
+
+ // Key
+ getTable().getKeyColumn().setValue(row, col);
+
+ // Visible
+ getTable().getVisibleColumn().setValue(row, col.isVisible());
+
+ // Column Title
+ String columnTitle = headerCell.getText();
+ if (StringUtility.isNullOrEmpty(columnTitle)) {
+ columnTitle = headerCell.getTooltipText();
+ row.setFont(FontSpec.parse("ITALIC"));
+ }
+ getTable().getTitleColumn().setValue(row, columnTitle);
+ if (Platform.inDevelopmentMode() && col.isSortActive()) {
+ getTable().getTitleColumn().setValue(row, columnTitle + " (" + col.getSortIndex() + ")");
+ }
+
+ // Custom Column
+ if (col instanceof ICustomColumn<?>) {
+ row.getCellForUpdate(getTable().getCustomColumnColumn().getColumnIndex()).setIconId(AbstractIcons.TableCustomColumn);
+ }
+
+ // Sorting
+ getTable().getSortingColumn().setValue(row, col);
+ if (col.isSortActive()) {
+ row.getCellForUpdate(getTable().getSortingColumn().getColumnIndex()).setIconId(col.isSortAscending() ? AbstractIcons.TableSortAsc : AbstractIcons.TableSortDesc);
+ }
+
+ // Filter
+ if (col.isColumnFilterActive()) {
+ row.getCellForUpdate(getTable().getFilterColumn().getColumnIndex()).setIconId(AbstractIcons.TableColumnFilterActive);
+ }
+
+ rowList.add(row);
+ }
+ }
+ }
+ try {
+ getTable().setTableChanging(true);
+ getTable().discardAllRows();
+ getTable().addRows(rowList.toArray(new ITableRow[rowList.size()]));
+ }
+ finally {
+ getTable().setTableChanging(false);
+ }
+ }
+
+ @Order(10.0)
+ public class Table extends AbstractTable {
+
+ @Override
+ protected int getConfiguredDragType() {
+ return IDNDSupport.TYPE_JAVA_ELEMENT_TRANSFER;
+ }
+
+ @Override
+ protected int getConfiguredDropType() {
+ return IDNDSupport.TYPE_JAVA_ELEMENT_TRANSFER;
+ }
+
+ @Override
+ protected TransferObject execDrag(ITableRow[] rows) throws ProcessingException {
+ return new JavaTransferObject(rows);
+ }
+
+ @Override
+ protected void execDrop(ITableRow row, TransferObject transfer) throws ProcessingException {
+ if (transfer != null && transfer instanceof JavaTransferObject) {
+ Object localObject = ((JavaTransferObject) transfer).getLocalObject();
+ if (localObject != null) {
+ if (localObject instanceof ITableRow[]) {
+ ITableRow[] draggedRows = (ITableRow[]) localObject;
+ if (draggedRows != null && draggedRows.length > 0) {
+ ITableRow draggedRow = draggedRows[0];
+ if (draggedRow.getRowIndex() != row.getRowIndex()) {
+ // target row other than source row
+ try {
+ getTable().setTableChanging(true);
+ if (draggedRow.getRowIndex() < row.getRowIndex()) {
+ while (draggedRow.getRowIndex() <= row.getRowIndex()) {
+ moveDown(draggedRow);
+ }
+ }
+ else {
+ while (draggedRow.getRowIndex() >= row.getRowIndex()) {
+ moveUp(draggedRow);
+ }
+ }
+ updateColumnVisibilityAndOrder();
+ }
+ finally {
+ getTable().setTableChanging(false);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ protected boolean getConfiguredAutoResizeColumns() {
+ return true;
+ }
+
+ @Override
+ protected boolean getConfiguredMultiSelect() {
+ return false;
+ }
+
+ @Override
+ protected boolean getConfiguredHeaderVisible() {
+ return false;
+ }
+
+ public KeyColumn getKeyColumn() {
+ return getColumnSet().getColumnByClass(KeyColumn.class);
+ }
+
+ public SortingColumn getSortingColumn() {
+ return getColumnSet().getColumnByClass(SortingColumn.class);
+ }
+
+ public FilterColumn getFilterColumn() {
+ return getColumnSet().getColumnByClass(FilterColumn.class);
+ }
+
+ public CustomColumnColumn getCustomColumnColumn() {
+ return getColumnSet().getColumnByClass(CustomColumnColumn.class);
+ }
+
+ public TitleColumn getTitleColumn() {
+ return getColumnSet().getColumnByClass(TitleColumn.class);
+ }
+
+ public VisibleColumn getVisibleColumn() {
+ return getColumnSet().getColumnByClass(VisibleColumn.class);
+ }
+
+ @Override
+ protected void execRowClick(ITableRow row) throws ProcessingException {
+ if (row != null && getContextColumn() == getVisibleColumn() && getKeyColumn().getValue(row) != null) {
+ Boolean oldValue = getVisibleColumn().getValue(row);
+ setColumnVisible(row, !oldValue);
+ }
+ }
+
+ @Override
+ protected void execRowsSelected(ITableRow[] rows) throws ProcessingException {
+ validateButtons();
+ }
+
+ @Order(10.0)
+ public class SpaceKeyStroke extends AbstractKeyStroke {
+ @Override
+ protected String getConfiguredKeyStroke() {
+ return "space";
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ for (ITableRow row : getSelectedRows()) {
+ Boolean oldValue = BooleanUtility.nvl(getVisibleColumn().getValue(row));
+ setColumnVisible(row, !oldValue);
+ }
+ }
+ }
+
+ @Order(20.0)
+ public class UpKeyStroke extends AbstractKeyStroke {
+ @Override
+ protected String getConfiguredKeyStroke() {
+ return "alt-up";
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ moveUp(getSelectedRow());
+ }
+ }
+
+ @Order(30.0)
+ public class DownKeyStroke extends AbstractKeyStroke {
+ @Override
+ protected String getConfiguredKeyStroke() {
+ return "alt-down";
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ moveDown(getSelectedRow());
+ }
+ }
+
+ @Order(10.0)
+ public class KeyColumn extends AbstractColumn<IColumn<?>> {
+
+ @Override
+ protected boolean getConfiguredPrimaryKey() {
+ return true;
+ }
+
+ @Override
+ protected boolean getConfiguredDisplayable() {
+ return false;
+ }
+ }
+
+ @Order(20.0)
+ public class VisibleColumn extends AbstractBooleanColumn {
+
+ @Override
+ protected String getConfiguredHeaderText() {
+ return TEXTS.get("Visible");
+ }
+
+ @Override
+ protected int getConfiguredWidth() {
+ return 20;
+ }
+
+ }
+
+ @Order(30.0)
+ public class TitleColumn extends AbstractStringColumn {
+
+ @Override
+ protected String getConfiguredHeaderText() {
+ return TEXTS.get("Title");
+ }
+
+ @Override
+ protected int getConfiguredWidth() {
+ return 200;
+ }
+
+ }
+
+ @Order(40.0)
+ public class SortingColumn extends AbstractSortOrderColumn {
+
+ @Override
+ protected String getConfiguredHeaderText() {
+ return TEXTS.get("ColumnSorting");
+ }
+
+ @Override
+ protected int getConfiguredWidth() {
+ return 20;
+ }
+
+ }
+
+ @Order(50.0)
+ public class FilterColumn extends AbstractStringColumn {
+
+ @Override
+ protected String getConfiguredHeaderText() {
+ return TEXTS.get("ResetTableColumnFilter");
+ }
+
+ @Override
+ protected int getConfiguredWidth() {
+ return 20;
+ }
+
+ }
+
+ @Order(60.0)
+ public class CustomColumnColumn extends AbstractStringColumn {
+
+ @Override
+ protected int getConfiguredWidth() {
+ return 20;
+ }
+
+ }
+
+ }
+ }
+
+ @Order(20.0)
+ public class ViewBox extends AbstractGroupBox {
+
+ @Override
+ protected int getConfiguredGridColumnCount() {
+ return 1;
+ }
+
+ @Override
+ protected int getConfiguredGridW() {
+ return 1;
+ }
+
+ @Override
+ protected String getConfiguredLabel() {
+ return TEXTS.get("ResetTableColumnsView");
+ }
+
+ @Order(10.0)
+ public class SelectAllButton extends AbstractLinkButton {
+
+ @Override
+ protected String getConfiguredLabel() {
+ return TEXTS.get("ButtonSelectAll");
+ }
+
+ @Override
+ protected boolean getConfiguredProcessButton() {
+ return false;
+ }
+
+ @Override
+ protected void execClickAction() throws ProcessingException {
+ for (ITableRow row : getColumnsTableField().getTable().getRows()) {
+ setColumnVisible(row, true);
+ }
+ }
+
+ }
+
+ @Order(20.0)
+ public class DeselectAllButton extends AbstractLinkButton {
+
+ @Override
+ protected String getConfiguredLabel() {
+ return TEXTS.get("ButtonDeselectAll");
+ }
+
+ @Override
+ protected boolean getConfiguredProcessButton() {
+ return false;
+ }
+
+ @Override
+ protected void execClickAction() throws ProcessingException {
+ for (ITableRow row : getColumnsTableField().getTable().getRows()) {
+ setColumnVisible(row, false);
+ }
+ }
+
+ }
+
+ @Order(30.0)
+ public class MoveUpButton extends AbstractLinkButton {
+
+ @Override
+ protected String getConfiguredLabel() {
+ return TEXTS.get("ButtonMoveUp");
+ }
+
+ @Override
+ protected boolean getConfiguredProcessButton() {
+ return false;
+ }
+
+ @Override
+ protected void execClickAction() throws ProcessingException {
+ moveUp(getColumnsTableField().getTable().getSelectedRow());
+ }
+
+ }
+
+ @Order(40.0)
+ public class MoveDownButton extends AbstractLinkButton {
+
+ @Override
+ protected String getConfiguredLabel() {
+ return TEXTS.get("ButtonMoveDown");
+ }
+
+ @Override
+ protected boolean getConfiguredProcessButton() {
+ return false;
+ }
+
+ @Override
+ protected void execClickAction() {
+ moveDown(getColumnsTableField().getTable().getSelectedRow());
+ }
+
+ }
+
+ @Order(50.0)
+ public class AddCustomColumnButton extends AbstractLinkButton {
+
+ @Override
+ protected String getConfiguredLabel() {
+ return TEXTS.get("AddCustomColumnMenu");
+ }
+
+ @Override
+ protected boolean getConfiguredProcessButton() {
+ return false;
+ }
+
+ @Override
+ protected void execInitField() throws ProcessingException {
+ setVisiblePermission(new CreateCustomColumnPermission());
+ setVisible(m_table.getTableCustomizer() != null);
+ }
+
+ @Override
+ protected void execClickAction() throws ProcessingException {
+ if (m_table != null) {
+ if (m_table.getTableCustomizer() != null) {
+ ArrayList<String> existingColumns = new ArrayList<String>();
+ for (IColumn c : m_table.getColumns()) {
+ existingColumns.add(c.getColumnId());
+ }
+ m_table.getTableCustomizer().addColumn();
+
+ // find target row (selected row or first row)
+ ITableRow targetOrderRow = getColumnsTableField().getTable().getSelectedRow();
+ if (targetOrderRow == null && getColumnsTableField().getTable().getRowCount() > 0) {
+ targetOrderRow = getColumnsTableField().getTable().getRow(0);
+ }
+ if (targetOrderRow == null) {
+ return;
+ }
+
+ // find new row
+ getColumnsTableField().reloadTableData();
+ for (ITableRow newColumnRow : getColumnsTableField().getTable().getRows()) {
+ if (!existingColumns.contains(getColumnsTableField().getTable().getKeyColumn().getValue(newColumnRow).getColumnId())) {
+ // move new column
+ try {
+ getColumnsTableField().getTable().setTableChanging(true);
+ if (newColumnRow.getRowIndex() < targetOrderRow.getRowIndex()) {
+ while (newColumnRow.getRowIndex() < targetOrderRow.getRowIndex()) {
+ moveDown(newColumnRow);
+ }
+ }
+ else {
+ while (newColumnRow.getRowIndex() > targetOrderRow.getRowIndex()) {
+ moveUp(newColumnRow);
+ }
+ }
+ updateColumnVisibilityAndOrder();
+
+ // select new row
+ getColumnsTableField().getTable().selectRow(newColumnRow);
+ }
+ finally {
+ getColumnsTableField().getTable().setTableChanging(false);
+ }
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ }
+
+ @Order(60.0)
+ public class ModifyCustomColumnButton extends AbstractLinkButton {
+
+ @Override
+ protected String getConfiguredLabel() {
+ return TEXTS.get("SC_Label_Change");
+ }
+
+ @Override
+ protected boolean getConfiguredProcessButton() {
+ return false;
+ }
+
+ @Override
+ protected void execInitField() throws ProcessingException {
+ setVisiblePermission(new UpdateCustomColumnPermission());
+ }
+
+ @Override
+ protected void execClickAction() throws ProcessingException {
+ if (m_table != null) {
+ if (m_table.getTableCustomizer() != null) {
+ if (getColumnsTableField().getTable().getSelectedRow() != null) {
+ IColumn<?> selectedCol = getColumnsTableField().getTable().getKeyColumn().getValue(getColumnsTableField().getTable().getSelectedRow());
+ if (selectedCol instanceof ICustomColumn<?>) {
+ m_table.getTableCustomizer().modifyColumn((ICustomColumn<?>) selectedCol);
+ }
+ }
+ }
+ }
+ getColumnsTableField().reloadTableData();
+ }
+
+ }
+
+ @Order(70.0)
+ public class RemoveCustomColumnButton extends AbstractLinkButton {
+
+ @Override
+ protected String getConfiguredLabel() {
+ return TEXTS.get("Remove");
+ }
+
+ @Override
+ protected boolean getConfiguredProcessButton() {
+ return false;
+ }
+
+ @Override
+ protected void execInitField() throws ProcessingException {
+ setVisiblePermission(new DeleteCustomColumnPermission());
+ }
+
+ @Override
+ protected void execClickAction() throws ProcessingException {
+ if (m_table != null) {
+ if (m_table.getTableCustomizer() != null) {
+ if (getColumnsTableField().getTable().getSelectedRow() != null) {
+ IColumn<?> selectedCol = getColumnsTableField().getTable().getKeyColumn().getValue(getColumnsTableField().getTable().getSelectedRow());
+ if (selectedCol instanceof ICustomColumn<?>) {
+ m_table.getTableCustomizer().removeColumn((ICustomColumn<?>) selectedCol);
+ }
+ }
+ }
+ }
+ getColumnsTableField().reloadTableData();
+ }
+
+ }
+ }
+
+ @Order(30.0)
+ public class ColumnSortingBox extends AbstractGroupBox {
+
+ @Override
+ protected int getConfiguredGridColumnCount() {
+ return 1;
+ }
+
+ @Override
+ protected int getConfiguredGridW() {
+ return 1;
+ }
+
+ @Override
+ protected String getConfiguredLabel() {
+ return TEXTS.get("ColumnSorting");
+ }
+
+ @Order(10.0)
+ public class AscendingButton extends AbstractLinkButton {
+
+ @Override
+ protected String getConfiguredLabel() {
+ return TEXTS.get("Ascending");
+ }
+
+ @Override
+ protected boolean getConfiguredProcessButton() {
+ return false;
+ }
+
+ @Override
+ protected void execClickAction() throws ProcessingException {
+ setSort(true);
+ }
+
+ }
+
+ @Order(20.0)
+ public class DescendingButton extends AbstractLinkButton {
+
+ @Override
+ protected String getConfiguredLabel() {
+ return TEXTS.get("Descending");
+ }
+
+ @Override
+ protected boolean getConfiguredProcessButton() {
+ return false;
+ }
+
+ @Override
+ protected void execClickAction() throws ProcessingException {
+ setSort(false);
+ }
+
+ }
+
+ @Order(30.0)
+ public class WithoutButton extends AbstractLinkButton {
+
+ @Override
+ protected String getConfiguredLabel() {
+ return TEXTS.get("Without");
+ }
+
+ @Override
+ protected boolean getConfiguredProcessButton() {
+ return false;
+ }
+
+ @Override
+ protected void execClickAction() throws ProcessingException {
+ setSort(null);
+ }
+
+ }
+ }
+
+ @Order(40.0)
+ public class FilterBox extends AbstractGroupBox {
+
+ @Override
+ protected int getConfiguredGridColumnCount() {
+ return 1;
+ }
+
+ @Override
+ protected int getConfiguredGridW() {
+ return 1;
+ }
+
+ @Override
+ protected String getConfiguredLabel() {
+ return TEXTS.get("ResetTableColumnFilter");
+ }
+
+ @Order(10.0)
+ public class EditFilterButton extends AbstractLinkButton {
+
+ @Override
+ protected String getConfiguredLabel() {
+ return TEXTS.get("EditFilterMenu");
+ }
+
+ @Override
+ protected boolean getConfiguredProcessButton() {
+ return false;
+ }
+
+ @Override
+ protected void execClickAction() throws ProcessingException {
+ Integer selectedIndex = null;
+ if (m_table != null && getColumnsTableField().getTable().getSelectedRow() != null) {
+ selectedIndex = getColumnsTableField().getTable().getSelectedRow().getRowIndex();
+ if (m_table.getColumnFilterManager() != null) {
+ IColumn<?> col = getColumnsTableField().getTable().getKeyColumn().getValue(getColumnsTableField().getTable().getSelectedRow());
+ if (col != null) {
+ m_table.getColumnFilterManager().showFilterForm(col, false);
+ }
+ }
+ }
+ getColumnsTableField().reloadTableData();
+ if (selectedIndex != null) {
+ getColumnsTableField().getTable().selectRow(selectedIndex);
+ }
+ }
+
+ }
+
+ @Order(20.0)
+ public class RemoveFilterButton extends AbstractLinkButton {
+
+ @Override
+ protected String getConfiguredLabel() {
+ return TEXTS.get("Remove");
+ }
+
+ @Override
+ protected boolean getConfiguredProcessButton() {
+ return false;
+ }
+
+ @Override
+ protected void execClickAction() throws ProcessingException {
+ Integer selectedIndex = null;
+ if (m_table != null && getColumnsTableField().getTable().getSelectedRow() != null) {
+ selectedIndex = getColumnsTableField().getTable().getSelectedRow().getRowIndex();
+ if (m_table.getColumnFilterManager() != null) {
+ IColumn<?> col = getColumnsTableField().getTable().getKeyColumn().getValue(getColumnsTableField().getTable().getSelectedRow());
+ if (col != null) {
+ ITableColumnFilter<?> filter = m_table.getColumnFilterManager().getFilter(col);
+ m_table.getColumnFilterManager().getFilters().remove(filter);
+ m_table.applyRowFilters();
+ }
+ }
+ }
+ getColumnsTableField().reloadTableData();
+ if (selectedIndex != null) {
+ getColumnsTableField().getTable().selectRow(selectedIndex);
+ }
+ }
+
+ }
+
+ }
+
+ @Order(50.0)
+ public class ResetBox extends AbstractGroupBox {
+
+ @Override
+ protected int getConfiguredGridColumnCount() {
+ return 1;
+ }
+
+ @Override
+ protected int getConfiguredGridW() {
+ return 1;
+ }
+
+ @Override
+ protected String getConfiguredLabel() {
+ return TEXTS.get("FormReset");
+ }
+
+ @Order(10.0)
+ public class ResetAllButton extends AbstractLinkButton {
+
+ @Override
+ protected String getConfiguredLabel() {
+ return TEXTS.get("ResetTableColumnsAll");
+ }
+
+ @Override
+ protected boolean getConfiguredProcessButton() {
+ return false;
+ }
+
+ @Override
+ protected void execClickAction() throws ProcessingException {
+ doResetAction(ResetAllMenu.class);
+ }
+
+ }
+
+ @Order(20.0)
+ public class ResetViewButton extends AbstractLinkButton {
+
+ @Override
+ protected String getConfiguredLabel() {
+ return TEXTS.get("ResetTableColumnsView");
+ }
+
+ @Override
+ protected boolean getConfiguredProcessButton() {
+ return false;
+ }
+
+ @Override
+ protected void execClickAction() throws ProcessingException {
+ doResetAction(ResetViewMenu.class);
+ }
+
+ }
+
+ @Order(30.0)
+ public class ResetSortingButton extends AbstractLinkButton {
+
+ @Override
+ protected String getConfiguredLabel() {
+ return TEXTS.get("ColumnSorting");
+ }
+
+ @Override
+ protected boolean getConfiguredProcessButton() {
+ return false;
+ }
+
+ @Override
+ protected void execClickAction() throws ProcessingException {
+ doResetAction(ResetSortingMenu.class);
+ }
+
+ }
+
+ @Order(40.0)
+ public class ResetColumnFiltersButton extends AbstractLinkButton {
+
+ @Override
+ protected String getConfiguredLabel() {
+ return TEXTS.get("ResetTableColumnFilter");
+ }
+
+ @Override
+ protected boolean getConfiguredProcessButton() {
+ return false;
+ }
+
+ @Override
+ protected void execClickAction() throws ProcessingException {
+ doResetAction(ResetColumnFiltersMenu.class);
+ }
+
+ }
+ }
+
+ }
+
+ @Order(20.0)
+ public class OkButton extends AbstractOkButton {
+ }
+
+ @Order(30.0)
+ public class CancelButton extends AbstractCancelButton {
+ }
+ }
+
+ private void updateColumnVisibilityAndOrder() {
+ IColumn<?>[] visibleColumns = getColumnsTableField().getTable().getKeyColumn().getValues(getColumnsTableField().getTable().getVisibleColumn().findRows(true));
+ m_table.getColumnSet().setVisibleColumns(visibleColumns);
+ }
+
+ private void setColumnVisible(ITableRow row, Boolean visible) throws ProcessingException {
+ getColumnsTableField().getTable().getVisibleColumn().setValue(row, visible);
+ getColumnsTableField().getTable().getKeyColumn().getValue(row).setVisible(visible);
+
+ updateColumnVisibilityAndOrder();
+ }
+
+ private void moveUp(ITableRow row) {
+ if (row != null && row.getRowIndex() - 1 >= 0) {
+ getColumnsTableField().getTable().moveRow(row.getRowIndex(), row.getRowIndex() - 1);
+ }
+
+ updateColumnVisibilityAndOrder();
+ }
+
+ private void moveDown(ITableRow row) {
+ if (row != null && row.getRowIndex() + 1 < getColumnsTableField().getTable().getRowCount()) {
+ getColumnsTableField().getTable().moveRow(row.getRowIndex(), row.getRowIndex() + 1);
+ }
+
+ updateColumnVisibilityAndOrder();
+ }
+
+ private void validateButtons() {
+ ITableRow selectedRow = getColumnsTableField().getTable().getSelectedRow();
+ boolean selectedRowExists = selectedRow != null;
+ boolean isCustomColumn = selectedRow != null && getColumnsTableField().getTable().getKeyColumn().getValue(selectedRow) instanceof ICustomColumn<?>;
+ boolean selectedRowHasFilter = selectedRowExists && getColumnsTableField().getTable().getKeyColumn().getValue(selectedRow).isColumnFilterActive();
+ boolean sortEnabled = m_table.isSortEnabled();
+ getModifyCustomColumnButton().setEnabled(isCustomColumn);
+ getRemoveCustomColumnButton().setEnabled(isCustomColumn);
+
+ getMoveDownButton().setEnabled(selectedRowExists);
+ getMoveUpButton().setEnabled(selectedRowExists);
+
+ getAscendingButton().setEnabled(sortEnabled && selectedRowExists);
+ getDescendingButton().setEnabled(sortEnabled && selectedRowExists);
+ getWithoutButton().setEnabled(sortEnabled && selectedRowExists);
+
+ getEditFilterButton().setEnabled(selectedRowExists);
+ getRemoveFilterButton().setEnabled(selectedRowHasFilter);
+ }
+
+ private void doResetAction(Class<? extends IMenu> action) throws ProcessingException {
+ ResetColumnsMenu menu = new ResetColumnsMenu(m_table);
+ List<IMenu> childs = menu.getChildActions();
+ for (IMenu child : childs) {
+ if (child.getClass().equals(action)) {
+ child.doAction();
+ }
+ }
+ getColumnsTableField().reloadTableData();
+ }
+
+ private void setSort(Boolean ascending) throws ProcessingException {
+ ITableRow row = getColumnsTableField().getTable().getSelectedRow();
+ if (row == null) {
+ return;
+ }
+
+ try {
+ getColumnsTableField().getTable().setTableChanging(true);
+ IColumn selectedCol = getColumnsTableField().getTable().getKeyColumn().getValue(row);
+ if (ascending == null) {
+ m_table.getColumnSet().removeSortColumn(selectedCol);
+ }
+ else {
+ if (m_table.getColumnSet().isSortColumn(selectedCol)) {
+ m_table.getColumnSet().handleSortEvent(selectedCol, true);
+ }
+ else {
+ m_table.getColumnSet().addSortColumn(selectedCol, ascending);
+ }
+ }
+ m_table.sort();
+
+ getColumnsTableField().reloadTableData();
+ getColumnsTableField().getTable().selectRow(row.getRowIndex());
+ }
+ finally {
+ getColumnsTableField().getTable().setTableChanging(false);
+ }
+ }
+
+ @Override
+ public void validateForm() throws ProcessingException {
+ boolean oneColumnIsVisble = false;
+ for (Boolean visible : getColumnsTableField().getTable().getVisibleColumn().getValues()) {
+ if (BooleanUtility.nvl(visible)) {
+ oneColumnIsVisble = true;
+ break;
+ }
+ }
+
+ if (!oneColumnIsVisble) {
+ throw new VetoException(TEXTS.get("OrganizeTableColumnsMinimalColumnCountMessage"));
+ }
+ }
+
+ public class ModifyHandler extends AbstractFormHandler {
+
+ private List<TableColumnState> m_oldColumns;
+
+ @Override
+ protected void execLoad() throws ProcessingException {
+ // Back-up the current columns so we may restore them if
+ // the "organize columns" form is canceled:
+ m_oldColumns = BookmarkUtility.backupTableColumns(m_table);
+ getColumnsTableField().reloadTableData();
+ }
+
+ @Override
+ protected void execPostLoad() throws ProcessingException {
+ validateButtons();
+ }
+
+ @Override
+ protected void execStore() throws ProcessingException {
+ // make changes persistent
+ ClientUIPreferences.getInstance().setAllTableColumnPreferences(m_table);
+ }
+
+ @Override
+ protected void execFinally() throws ProcessingException {
+ if (!isFormStored() && isSaveNeeded()) {
+ // revert to original state
+ try {
+ m_table.setTableChanging(true);
+ BookmarkUtility.restoreTableColumns(m_table, m_oldColumns);
+ }
+ finally {
+ m_table.setTableChanging(false);
+ }
+ }
+ }
+
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/RowIndexComparator.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/RowIndexComparator.java
index 414d8a6a16..6625f6aa12 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/RowIndexComparator.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/RowIndexComparator.java
@@ -1,32 +1,32 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table;
-
-import java.util.Comparator;
-
-public class RowIndexComparator implements Comparator<ITableRow> {
-
- @Override
- public int compare(ITableRow row1, ITableRow row2) {
- int x1 = row1.getRowIndex();
- int x2 = row2.getRowIndex();
- if (x1 < x2) {
- return -1;
- }
- else if (x1 > x2) {
- return 1;
- }
- else {
- return 0;
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table;
+
+import java.util.Comparator;
+
+public class RowIndexComparator implements Comparator<ITableRow> {
+
+ @Override
+ public int compare(ITableRow row1, ITableRow row2) {
+ int x1 = row1.getRowIndex();
+ int x2 = row2.getRowIndex();
+ if (x1 < x2) {
+ return -1;
+ }
+ else if (x1 > x2) {
+ return 1;
+ }
+ else {
+ return 0;
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/TableAdapter.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/TableAdapter.java
index 7a9151ecc2..fe7d9dcaac 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/TableAdapter.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/TableAdapter.java
@@ -1,29 +1,29 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table;
-
-/**
- * inside gui handling or in non-model threads don't use this adapter because it
- * might reduce performance when batch events are handled as single events
- */
-public class TableAdapter implements TableListener {
-
- @Override
- public void tableChangedBatch(TableEvent[] batch) {
- for (int i = 0; i < batch.length; i++) {
- tableChanged(batch[i]);
- }
- }
-
- @Override
- public void tableChanged(TableEvent e) {
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table;
+
+/**
+ * inside gui handling or in non-model threads don't use this adapter because it
+ * might reduce performance when batch events are handled as single events
+ */
+public class TableAdapter implements TableListener {
+
+ @Override
+ public void tableChangedBatch(TableEvent[] batch) {
+ for (int i = 0; i < batch.length; i++) {
+ tableChanged(batch[i]);
+ }
+ }
+
+ @Override
+ public void tableChanged(TableEvent e) {
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/TableEvent.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/TableEvent.java
index a01860d742..f69b631484 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/TableEvent.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/TableEvent.java
@@ -1,358 +1,358 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.scout.commons.dnd.TransferObject;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-
-@SuppressWarnings("serial")
-public class TableEvent extends java.util.EventObject {
- /**
- * Column visibility and/or order and/or width changed
- */
- public static final int TYPE_COLUMN_STRUCTURE_CHANGED = 1;
- /**
- * Some rows have been added
- * <p>
- * valid properties: rows, firstRow, lastRow
- */
- public static final int TYPE_ROWS_INSERTED = 100;
- /**
- * Some rows have been updated
- * <p>
- * valid properties: rows, firstRow, lastRow
- */
- public static final int TYPE_ROWS_UPDATED = 101;
- /**
- * Some rows have been deleted
- * <p>
- * valid properties: rows, firstRow, lastRow
- */
- public static final int TYPE_ROWS_DELETED = 102;
- /**
- * Some rows have been selected
- * <p>
- * valid properties: rows, firstRow, lastRow
- */
- public static final int TYPE_ROWS_SELECTED = 103;
- /**
- * A row has been activated
- * <p>
- * valid properties: rows, firstRow, lastRow
- */
- public static final int TYPE_ROW_ACTION = 104;
- /**
- * All rows have been deleted
- * <p>
- * valid properties: rows, firstRow, lastRow
- */
- public static final int TYPE_ALL_ROWS_DELETED = 105;
- /**
- * Sorting has been performed
- */
- public static final int TYPE_ROW_ORDER_CHANGED = 200;
- /**
- * Filter has changed
- */
- public static final int TYPE_ROW_FILTER_CHANGED = 210;
- /**
- * Broadcast request to add actions for popup on selected rows valid
- * properties: rows, firstRow, lastRow add actions to: popupActions
- */
- public static final int TYPE_ROW_POPUP = 700;
- /**
- * Broadcast request to add actions for popup on empty space (not on rows)
- * <p>
- * valid properties: add actions to: popupActions
- */
- public static final int TYPE_EMPTY_SPACE_POPUP = 701;
- /**
- * Broadcast request to add actions for header popup
- * <p>
- * valid properties: add actions to: popupActions
- */
- public static final int TYPE_HEADER_POPUP = 750;
- /**
- * Broadcast request to get drag object
- * <p>
- * valid properties: rows, firstRow, lastRow set property: dragObject
- */
- public static final int TYPE_ROWS_DRAG_REQUEST = 730;
- /**
- * Drop action was received
- * <p>
- * valid properties: rows, firstRow, lastRow, dropAction
- */
- public static final int TYPE_ROW_DROP_ACTION = 740;
-
- /**
- * Copy-To-Clipboard action was received
- * <p>
- * valid properties: rows, firstRow, lastRow, copyAction
- */
- public static final int TYPE_ROWS_COPY_REQUEST = 760;
-
- /**
- * Column order changed
- * <p>
- * valid properties:
- */
- public static final int TYPE_COLUMN_ORDER_CHANGED = 770;
- /**
- * Column headers were changed, sort status changed
- * <p>
- * valid properties: columns
- */
- public static final int TYPE_COLUMN_HEADERS_UPDATED = 780;
-
- /**
- * Request ui to set focus to the table
- */
- public static final int TYPE_REQUEST_FOCUS = 800;
-
- /**
- * Request ui to activate editing of the cell and set focus to it
- * <p>
- * Only for editable cells
- */
- public static final int TYPE_REQUEST_FOCUS_IN_CELL = 805;
-
- /**
- * A row has been clicked (by the mouse)
- * <p>
- * valid properties: rows, firstRow, lastRow
- */
- public static final int TYPE_ROW_CLICK = 810;
-
- public static final int TYPE_TABLE_POPULATED = 820;
- /**
- * Advise to scroll to selection
- */
- public static final int TYPE_SCROLL_TO_SELECTION = 830;
- //next 840, check method AbstractTable.processEventBuffer
-
- private final int m_type;
- private ITableRow[] m_rows = new ITableRow[0];
- private List<IMenu> m_popupMenus;
- private boolean m_consumed;
- private TransferObject m_dragObject;
- private TransferObject m_dropObject;
- private TransferObject m_copyObject;
- private IColumn[] m_columns;
- private boolean m_sortInMemoryAllowed;
-
- public TableEvent(ITable source, int type) {
- super(source);
- m_type = type;
- }
-
- public TableEvent(ITable source, int type, ITableRow[] rows) {
- super(source);
- m_type = type;
- if (rows != null && rows.length > 0) {
- m_rows = rows;
- }
- }
-
- public ITable getTable() {
- return (ITable) getSource();
- }
-
- public int getType() {
- return m_type;
- }
-
- public ITableRow[] getRows() {
- return m_rows;
- }
-
- protected void setRows(ITableRow[] rows) {
- m_rows = rows;
- }
-
- public int getRowCount() {
- return m_rows != null ? m_rows.length : 0;
- }
-
- public ITableRow getFirstRow() {
- return m_rows.length > 0 ? m_rows[0] : null;
- }
-
- public ITableRow getLastRow() {
- return m_rows.length > 0 ? m_rows[m_rows.length - 1] : null;
- }
-
- /**
- * used by TYPE_ROW_POPUP and TYPE_HEADER_POPUP to add actions
- */
- public void addPopupMenu(IMenu menu) {
- if (menu != null) {
- if (m_popupMenus == null) {
- m_popupMenus = new ArrayList<IMenu>();
- }
- m_popupMenus.add(menu);
- }
- }
-
- /**
- * used by TYPE_ROW_POPUP to add actions
- */
- public void addPopupMenus(IMenu[] menus) {
- if (menus != null) {
- if (m_popupMenus == null) {
- m_popupMenus = new ArrayList<IMenu>();
- }
- m_popupMenus.addAll(Arrays.asList(menus));
- }
- }
-
- /**
- * used by TYPE_ROW_POPUP to add actions
- */
- public IMenu[] getPopupMenus() {
- if (m_popupMenus != null) {
- return m_popupMenus.toArray(new IMenu[0]);
- }
- else {
- return new IMenu[0];
- }
- }
-
- /**
- * used by TYPE_ROW_POPUP to add actions
- */
- public int getPopupMenuCount() {
- if (m_popupMenus != null) {
- return m_popupMenus.size();
- }
- else {
- return 0;
- }
- }
-
- public boolean isConsumed() {
- return m_consumed;
- }
-
- public void consume() {
- m_consumed = true;
- }
-
- /**
- * used by TYPE_ROW_DRAG_REQUEST
- */
- public TransferObject getDragObject() {
- return m_dragObject;
- }
-
- public void setDragObject(TransferObject t) {
- m_dragObject = t;
- }
-
- /**
- * used by TYPE_ROW_DROP_ACTION
- */
- public TransferObject getDropObject() {
- return m_dropObject;
- }
-
- protected void setDropObject(TransferObject t) {
- m_dropObject = t;
- }
-
- /**
- * used by {@link TableEvent#TYPE_ROWS_COPY_REQUEST}
- */
- public TransferObject getCopyObject() {
- return m_copyObject;
- }
-
- protected void setCopyObject(TransferObject t) {
- m_copyObject = t;
- }
-
- /**
- * used by
- * TYPE_COLUMN_ORDER_CHANGED,TYPE_SORT_REQUEST,TYPE_COLUMN_HEADERS_CHANGED
- */
- public IColumn[] getColumns() {
- return m_columns;
- }
-
- public IColumn getFirstColumn() {
- return m_columns.length > 0 ? m_columns[0] : null;
- }
-
- protected void setColumns(IColumn[] columns) {
- m_columns = columns;
- }
-
- /**
- * used by TYPE_SORT_REQUEST
- */
- public boolean isSortInMemoryAllowed() {
- return m_sortInMemoryAllowed;
- }
-
- protected void setSortInMemoryAllowed(boolean b) {
- m_sortInMemoryAllowed = b;
- }
-
- @Override
- public String toString() {
- StringBuffer buf = new StringBuffer();
- buf.append(getClass().getSimpleName() + "[");
- // decode type
- try {
- Field[] f = getClass().getDeclaredFields();
- for (int i = 0; i < f.length; i++) {
- if (Modifier.isPublic(f[i].getModifiers()) && Modifier.isStatic(f[i].getModifiers()) && f[i].getName().startsWith("TYPE_")) {
- if (((Number) f[i].get(null)).intValue() == m_type) {
- buf.append(f[i].getName());
- break;
- }
- }
- }
- }
- catch (Throwable t) {
- buf.append("#" + m_type);
- }
- buf.append(" ");
- // rows
- if (m_rows != null && m_rows.length > 0 && getTable() != null) {
- if (m_rows.length == 1) {
- buf.append("row " + m_rows[0]);
- }
- else {
- buf.append("rows {");
- for (int i = 0; i < m_rows.length; i++) {
- if (i >= 0) {
- buf.append(",");
- }
- buf.append("" + m_rows[i]);
- }
- buf.append("}");
- }
- }
- else {
- buf.append("{}");
- }
- buf.append("]");
- return buf.toString();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.scout.commons.dnd.TransferObject;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+
+@SuppressWarnings("serial")
+public class TableEvent extends java.util.EventObject {
+ /**
+ * Column visibility and/or order and/or width changed
+ */
+ public static final int TYPE_COLUMN_STRUCTURE_CHANGED = 1;
+ /**
+ * Some rows have been added
+ * <p>
+ * valid properties: rows, firstRow, lastRow
+ */
+ public static final int TYPE_ROWS_INSERTED = 100;
+ /**
+ * Some rows have been updated
+ * <p>
+ * valid properties: rows, firstRow, lastRow
+ */
+ public static final int TYPE_ROWS_UPDATED = 101;
+ /**
+ * Some rows have been deleted
+ * <p>
+ * valid properties: rows, firstRow, lastRow
+ */
+ public static final int TYPE_ROWS_DELETED = 102;
+ /**
+ * Some rows have been selected
+ * <p>
+ * valid properties: rows, firstRow, lastRow
+ */
+ public static final int TYPE_ROWS_SELECTED = 103;
+ /**
+ * A row has been activated
+ * <p>
+ * valid properties: rows, firstRow, lastRow
+ */
+ public static final int TYPE_ROW_ACTION = 104;
+ /**
+ * All rows have been deleted
+ * <p>
+ * valid properties: rows, firstRow, lastRow
+ */
+ public static final int TYPE_ALL_ROWS_DELETED = 105;
+ /**
+ * Sorting has been performed
+ */
+ public static final int TYPE_ROW_ORDER_CHANGED = 200;
+ /**
+ * Filter has changed
+ */
+ public static final int TYPE_ROW_FILTER_CHANGED = 210;
+ /**
+ * Broadcast request to add actions for popup on selected rows valid
+ * properties: rows, firstRow, lastRow add actions to: popupActions
+ */
+ public static final int TYPE_ROW_POPUP = 700;
+ /**
+ * Broadcast request to add actions for popup on empty space (not on rows)
+ * <p>
+ * valid properties: add actions to: popupActions
+ */
+ public static final int TYPE_EMPTY_SPACE_POPUP = 701;
+ /**
+ * Broadcast request to add actions for header popup
+ * <p>
+ * valid properties: add actions to: popupActions
+ */
+ public static final int TYPE_HEADER_POPUP = 750;
+ /**
+ * Broadcast request to get drag object
+ * <p>
+ * valid properties: rows, firstRow, lastRow set property: dragObject
+ */
+ public static final int TYPE_ROWS_DRAG_REQUEST = 730;
+ /**
+ * Drop action was received
+ * <p>
+ * valid properties: rows, firstRow, lastRow, dropAction
+ */
+ public static final int TYPE_ROW_DROP_ACTION = 740;
+
+ /**
+ * Copy-To-Clipboard action was received
+ * <p>
+ * valid properties: rows, firstRow, lastRow, copyAction
+ */
+ public static final int TYPE_ROWS_COPY_REQUEST = 760;
+
+ /**
+ * Column order changed
+ * <p>
+ * valid properties:
+ */
+ public static final int TYPE_COLUMN_ORDER_CHANGED = 770;
+ /**
+ * Column headers were changed, sort status changed
+ * <p>
+ * valid properties: columns
+ */
+ public static final int TYPE_COLUMN_HEADERS_UPDATED = 780;
+
+ /**
+ * Request ui to set focus to the table
+ */
+ public static final int TYPE_REQUEST_FOCUS = 800;
+
+ /**
+ * Request ui to activate editing of the cell and set focus to it
+ * <p>
+ * Only for editable cells
+ */
+ public static final int TYPE_REQUEST_FOCUS_IN_CELL = 805;
+
+ /**
+ * A row has been clicked (by the mouse)
+ * <p>
+ * valid properties: rows, firstRow, lastRow
+ */
+ public static final int TYPE_ROW_CLICK = 810;
+
+ public static final int TYPE_TABLE_POPULATED = 820;
+ /**
+ * Advise to scroll to selection
+ */
+ public static final int TYPE_SCROLL_TO_SELECTION = 830;
+ //next 840, check method AbstractTable.processEventBuffer
+
+ private final int m_type;
+ private ITableRow[] m_rows = new ITableRow[0];
+ private List<IMenu> m_popupMenus;
+ private boolean m_consumed;
+ private TransferObject m_dragObject;
+ private TransferObject m_dropObject;
+ private TransferObject m_copyObject;
+ private IColumn[] m_columns;
+ private boolean m_sortInMemoryAllowed;
+
+ public TableEvent(ITable source, int type) {
+ super(source);
+ m_type = type;
+ }
+
+ public TableEvent(ITable source, int type, ITableRow[] rows) {
+ super(source);
+ m_type = type;
+ if (rows != null && rows.length > 0) {
+ m_rows = rows;
+ }
+ }
+
+ public ITable getTable() {
+ return (ITable) getSource();
+ }
+
+ public int getType() {
+ return m_type;
+ }
+
+ public ITableRow[] getRows() {
+ return m_rows;
+ }
+
+ protected void setRows(ITableRow[] rows) {
+ m_rows = rows;
+ }
+
+ public int getRowCount() {
+ return m_rows != null ? m_rows.length : 0;
+ }
+
+ public ITableRow getFirstRow() {
+ return m_rows.length > 0 ? m_rows[0] : null;
+ }
+
+ public ITableRow getLastRow() {
+ return m_rows.length > 0 ? m_rows[m_rows.length - 1] : null;
+ }
+
+ /**
+ * used by TYPE_ROW_POPUP and TYPE_HEADER_POPUP to add actions
+ */
+ public void addPopupMenu(IMenu menu) {
+ if (menu != null) {
+ if (m_popupMenus == null) {
+ m_popupMenus = new ArrayList<IMenu>();
+ }
+ m_popupMenus.add(menu);
+ }
+ }
+
+ /**
+ * used by TYPE_ROW_POPUP to add actions
+ */
+ public void addPopupMenus(IMenu[] menus) {
+ if (menus != null) {
+ if (m_popupMenus == null) {
+ m_popupMenus = new ArrayList<IMenu>();
+ }
+ m_popupMenus.addAll(Arrays.asList(menus));
+ }
+ }
+
+ /**
+ * used by TYPE_ROW_POPUP to add actions
+ */
+ public IMenu[] getPopupMenus() {
+ if (m_popupMenus != null) {
+ return m_popupMenus.toArray(new IMenu[0]);
+ }
+ else {
+ return new IMenu[0];
+ }
+ }
+
+ /**
+ * used by TYPE_ROW_POPUP to add actions
+ */
+ public int getPopupMenuCount() {
+ if (m_popupMenus != null) {
+ return m_popupMenus.size();
+ }
+ else {
+ return 0;
+ }
+ }
+
+ public boolean isConsumed() {
+ return m_consumed;
+ }
+
+ public void consume() {
+ m_consumed = true;
+ }
+
+ /**
+ * used by TYPE_ROW_DRAG_REQUEST
+ */
+ public TransferObject getDragObject() {
+ return m_dragObject;
+ }
+
+ public void setDragObject(TransferObject t) {
+ m_dragObject = t;
+ }
+
+ /**
+ * used by TYPE_ROW_DROP_ACTION
+ */
+ public TransferObject getDropObject() {
+ return m_dropObject;
+ }
+
+ protected void setDropObject(TransferObject t) {
+ m_dropObject = t;
+ }
+
+ /**
+ * used by {@link TableEvent#TYPE_ROWS_COPY_REQUEST}
+ */
+ public TransferObject getCopyObject() {
+ return m_copyObject;
+ }
+
+ protected void setCopyObject(TransferObject t) {
+ m_copyObject = t;
+ }
+
+ /**
+ * used by
+ * TYPE_COLUMN_ORDER_CHANGED,TYPE_SORT_REQUEST,TYPE_COLUMN_HEADERS_CHANGED
+ */
+ public IColumn[] getColumns() {
+ return m_columns;
+ }
+
+ public IColumn getFirstColumn() {
+ return m_columns.length > 0 ? m_columns[0] : null;
+ }
+
+ protected void setColumns(IColumn[] columns) {
+ m_columns = columns;
+ }
+
+ /**
+ * used by TYPE_SORT_REQUEST
+ */
+ public boolean isSortInMemoryAllowed() {
+ return m_sortInMemoryAllowed;
+ }
+
+ protected void setSortInMemoryAllowed(boolean b) {
+ m_sortInMemoryAllowed = b;
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer buf = new StringBuffer();
+ buf.append(getClass().getSimpleName() + "[");
+ // decode type
+ try {
+ Field[] f = getClass().getDeclaredFields();
+ for (int i = 0; i < f.length; i++) {
+ if (Modifier.isPublic(f[i].getModifiers()) && Modifier.isStatic(f[i].getModifiers()) && f[i].getName().startsWith("TYPE_")) {
+ if (((Number) f[i].get(null)).intValue() == m_type) {
+ buf.append(f[i].getName());
+ break;
+ }
+ }
+ }
+ }
+ catch (Throwable t) {
+ buf.append("#" + m_type);
+ }
+ buf.append(" ");
+ // rows
+ if (m_rows != null && m_rows.length > 0 && getTable() != null) {
+ if (m_rows.length == 1) {
+ buf.append("row " + m_rows[0]);
+ }
+ else {
+ buf.append("rows {");
+ for (int i = 0; i < m_rows.length; i++) {
+ if (i >= 0) {
+ buf.append(",");
+ }
+ buf.append("" + m_rows[i]);
+ }
+ buf.append("}");
+ }
+ }
+ else {
+ buf.append("{}");
+ }
+ buf.append("]");
+ return buf.toString();
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/TableListener.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/TableListener.java
index ebba1c6502..ec8be88cb9 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/TableListener.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/TableListener.java
@@ -1,23 +1,23 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table;
-
-import java.util.EventListener;
-
-public interface TableListener extends EventListener {
-
- void tableChanged(TableEvent e);
-
- /**
- * batch event for fast processing of batch changes
- */
- void tableChangedBatch(TableEvent[] batch);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table;
+
+import java.util.EventListener;
+
+public interface TableListener extends EventListener {
+
+ void tableChanged(TableEvent e);
+
+ /**
+ * batch event for fast processing of batch changes
+ */
+ void tableChangedBatch(TableEvent[] batch);
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/TableRow.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/TableRow.java
index 2d15c241c0..ccbdd592e5 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/TableRow.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/TableRow.java
@@ -1,385 +1,385 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table;
-
-import java.util.ArrayList;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
-import org.eclipse.scout.rt.client.ui.basic.cell.ICell;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-import org.eclipse.scout.rt.client.ui.profiler.DesktopProfiler;
-import org.eclipse.scout.rt.shared.data.basic.FontSpec;
-
-public class TableRow implements ITableRow {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(TableRow.class);
-
- private final ColumnSet m_columnSet;
- private int m_status = STATUS_NON_CHANGED;
- private boolean m_enabled;
- private boolean m_checked;
- private final ArrayList<Cell> m_cells;
- private boolean m_rowPropertiesChanged;
- private int m_rowChanging = 0;
-
- /**
- * @param columnSet
- * may be null
- */
- public TableRow(ColumnSet columnSet) {
- m_columnSet = columnSet;
- m_enabled = true;
- m_status = STATUS_NON_CHANGED;
- int colCount = columnSet != null ? columnSet.getColumnCount() : 0;
- m_cells = new ArrayList<Cell>(colCount);
- for (int i = 0; i < colCount; i++) {
- m_cells.add(new Cell());
- }
- if (DesktopProfiler.getInstance().isEnabled()) {
- DesktopProfiler.getInstance().registerTableRow(this);
- }
- }
-
- public TableRow(ColumnSet columnSet, Object[] values) throws ProcessingException {
- this(columnSet);
- if (values == null) {
- values = new Object[0];
- }
- for (int i = 0; i < values.length; i++) {
- Cell cell = getCellForUpdate(i);
- cell.setValue(values[i]);
- }
- }
-
- @Override
- public int getRowIndex() {
- return -1;
- }
-
- @Override
- public int getStatus() {
- return m_status;
- }
-
- @Override
- public void setStatus(int status) {
- m_status = status;
- }
-
- @Override
- public boolean isStatusInserted() {
- return m_status == STATUS_INSERTED;
- }
-
- @Override
- public void setStatusInserted() {
- setStatus(STATUS_INSERTED);
- }
-
- @Override
- public boolean isStatusUpdated() {
- return m_status == STATUS_UPDATED;
- }
-
- @Override
- public void setStatusUpdated() {
- setStatus(STATUS_UPDATED);
- }
-
- @Override
- public boolean isStatusDeleted() {
- return m_status == STATUS_DELETED;
- }
-
- @Override
- public void setStatusDeleted() {
- setStatus(STATUS_DELETED);
- }
-
- @Override
- public boolean isStatusNonchanged() {
- return m_status == STATUS_NON_CHANGED;
- }
-
- @Override
- public void setStatusNonchanged() {
- setStatus(STATUS_NON_CHANGED);
- }
-
- @Override
- public boolean isEnabled() {
- return m_enabled;
- }
-
- @Override
- public void setEnabled(boolean b) {
- m_enabled = b;
- for (int i = 0; i < m_cells.size(); i++) {
- m_cells.get(i).setEnabled(b);
- }
- }
-
- @Override
- public boolean isSelected() {
- return false;
- }
-
- @Override
- public boolean isChecked() {
- return m_checked;
- }
-
- @Override
- public void setChecked(boolean b) {
- m_checked = b;
- }
-
- @Override
- public boolean isFilterAccepted() {
- return true;
- }
-
- @Override
- public int getCellCount() {
- return m_cells.size();
- }
-
- @Override
- public ICell getCell(IColumn column) {
- return getCell(column.getColumnIndex());
- }
-
- @Override
- public ICell getCell(int columnIndex) {
- if (columnIndex < m_cells.size()) {
- return m_cells.get(columnIndex);
- }
- else {
- return null;
- }
- }
-
- @Override
- public void setCell(IColumn column, ICell cell) throws ProcessingException {
- setCell(column.getColumnIndex(), cell);
- }
-
- @Override
- public void setCell(int columnIndex, ICell cell) throws ProcessingException {
- if (cell != null) {
- getCellForUpdate(columnIndex);
- m_cells.set(columnIndex, new Cell(null, cell));
- }
- }
-
- @Override
- public Cell getCellForUpdate(IColumn column) {
- return getCellForUpdate(column.getColumnIndex());
- }
-
- @Override
- public Cell getCellForUpdate(int columnIndex) {
- while (columnIndex >= m_cells.size()) {
- m_cells.add(new Cell());
- }
- return m_cells.get(columnIndex);
- }
-
- @Override
- public Object getCellValue(int columnIndex) {
- ICell cell = getCell(columnIndex);
- if (cell != null) {
- return cell.getValue();
- }
- else {
- return null;
- }
- }
-
- @Override
- public Object[] getKeyValues() {
- if (m_columnSet == null) {
- throw new UnsupportedOperationException("can only be called when TableRow was constructed with a non-null columnSet");
- }
- int[] keyColumns = m_columnSet.getKeyColumnIndexes();
- if (keyColumns.length == 0) {
- keyColumns = m_columnSet.getAllColumnIndexes();
- }
- Object[] pk = new Object[keyColumns.length];
- for (int i = 0; i < keyColumns.length; i++) {
- pk[i] = getCellValue(keyColumns[i]);
- }
- return pk;
- }
-
- @Override
- public boolean isRowChanging() {
- return false;
- }
-
- @Override
- public void setRowChanging(boolean b) {
- if (b) {
- m_rowChanging++;
- }
- else {
- m_rowChanging--;
- }
- }
-
- @Override
- public boolean/* changed */setCellValue(int columnIndex, Object value) throws ProcessingException {
- try {
- setRowChanging(true);
- //
- Object oldValue = getCellValue(columnIndex);
- if (oldValue == value || (oldValue != null && oldValue.equals(value))) {
- // no change in value
- return false;
- }
- else {
- getCellForUpdate(columnIndex);
- m_cells.get(columnIndex).setValue(value);
- if (isStatusNonchanged()) {
- setStatusUpdated();
- }
- else {
- // keep inserted, deleted
- }
- return true;
- }
- }
- finally {
- setRowChanging(false);
- }
- }
-
- @Override
- public boolean setCellValues(Object[] values) throws ProcessingException {
- try {
- setRowChanging(true);
- //
- boolean changed = false;
- for (int i = 0; i < values.length; i++) {
- boolean b = setCellValue(i, values[i]);
- changed = changed || b;
- }
- return changed;
- }
- finally {
- setRowChanging(false);
- }
- }
-
- @Override
- public ITable getTable() {
- return null;
- }
-
- @Override
- public void touch() throws ProcessingException {
- }
-
- @Override
- public void delete() throws ProcessingException {
- }
-
- @Override
- public void setBackgroundColor(String c) {
- for (int i = 0; i < m_cells.size(); i++) {
- m_cells.get(i).setBackgroundColor(c);
- }
- }
-
- @Override
- public void setForegroundColor(String c) {
- for (int i = 0; i < m_cells.size(); i++) {
- m_cells.get(i).setForegroundColor(c);
- }
- }
-
- @Override
- public void setFont(FontSpec f) {
- for (int i = 0; i < m_cells.size(); i++) {
- m_cells.get(i).setFont(f);
- }
- }
-
- @Override
- public void setTooltipText(String s) {
- for (int i = 0; i < m_cells.size(); i++) {
- m_cells.get(i).setTooltipText(s);
- }
- }
-
- @Override
- public void setIconId(String id) {
- if (m_columnSet == null) {
- throw new UnsupportedOperationException("can only be called when TableRow was constructed with a non-null columnSet");
- }
- IColumn col = m_columnSet.getFirstVisibleColumn();
- if (col != null) {
- m_cells.get(col.getColumnIndex()).setIconId(id);
- }
- }
-
- @Override
- public String getIconId() {
- if (m_columnSet == null) {
- throw new UnsupportedOperationException("can only be called when TableRow was constructed with a non-null columnSet");
- }
- IColumn col = m_columnSet.getFirstVisibleColumn();
- if (col != null) {
- return m_cells.get(col.getColumnIndex()).getIconId();
- }
- else {
- return null;
- }
- }
-
- @Override
- public void moveDown() {
- // no effect
- }
-
- @Override
- public void moveToBottom() {
- // no effect
- }
-
- @Override
- public void moveToTop() {
- // no effect
- }
-
- @Override
- public void moveUp() {
- // no effect
- }
-
- @Override
- public boolean isRowPropertiesChanged() {
- return m_rowPropertiesChanged;
- }
-
- @Override
- public void setRowPropertiesChanged(boolean b) {
- m_rowPropertiesChanged = b;
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName() + m_cells;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table;
+
+import java.util.ArrayList;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
+import org.eclipse.scout.rt.client.ui.basic.cell.ICell;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+import org.eclipse.scout.rt.client.ui.profiler.DesktopProfiler;
+import org.eclipse.scout.rt.shared.data.basic.FontSpec;
+
+public class TableRow implements ITableRow {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(TableRow.class);
+
+ private final ColumnSet m_columnSet;
+ private int m_status = STATUS_NON_CHANGED;
+ private boolean m_enabled;
+ private boolean m_checked;
+ private final ArrayList<Cell> m_cells;
+ private boolean m_rowPropertiesChanged;
+ private int m_rowChanging = 0;
+
+ /**
+ * @param columnSet
+ * may be null
+ */
+ public TableRow(ColumnSet columnSet) {
+ m_columnSet = columnSet;
+ m_enabled = true;
+ m_status = STATUS_NON_CHANGED;
+ int colCount = columnSet != null ? columnSet.getColumnCount() : 0;
+ m_cells = new ArrayList<Cell>(colCount);
+ for (int i = 0; i < colCount; i++) {
+ m_cells.add(new Cell());
+ }
+ if (DesktopProfiler.getInstance().isEnabled()) {
+ DesktopProfiler.getInstance().registerTableRow(this);
+ }
+ }
+
+ public TableRow(ColumnSet columnSet, Object[] values) throws ProcessingException {
+ this(columnSet);
+ if (values == null) {
+ values = new Object[0];
+ }
+ for (int i = 0; i < values.length; i++) {
+ Cell cell = getCellForUpdate(i);
+ cell.setValue(values[i]);
+ }
+ }
+
+ @Override
+ public int getRowIndex() {
+ return -1;
+ }
+
+ @Override
+ public int getStatus() {
+ return m_status;
+ }
+
+ @Override
+ public void setStatus(int status) {
+ m_status = status;
+ }
+
+ @Override
+ public boolean isStatusInserted() {
+ return m_status == STATUS_INSERTED;
+ }
+
+ @Override
+ public void setStatusInserted() {
+ setStatus(STATUS_INSERTED);
+ }
+
+ @Override
+ public boolean isStatusUpdated() {
+ return m_status == STATUS_UPDATED;
+ }
+
+ @Override
+ public void setStatusUpdated() {
+ setStatus(STATUS_UPDATED);
+ }
+
+ @Override
+ public boolean isStatusDeleted() {
+ return m_status == STATUS_DELETED;
+ }
+
+ @Override
+ public void setStatusDeleted() {
+ setStatus(STATUS_DELETED);
+ }
+
+ @Override
+ public boolean isStatusNonchanged() {
+ return m_status == STATUS_NON_CHANGED;
+ }
+
+ @Override
+ public void setStatusNonchanged() {
+ setStatus(STATUS_NON_CHANGED);
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return m_enabled;
+ }
+
+ @Override
+ public void setEnabled(boolean b) {
+ m_enabled = b;
+ for (int i = 0; i < m_cells.size(); i++) {
+ m_cells.get(i).setEnabled(b);
+ }
+ }
+
+ @Override
+ public boolean isSelected() {
+ return false;
+ }
+
+ @Override
+ public boolean isChecked() {
+ return m_checked;
+ }
+
+ @Override
+ public void setChecked(boolean b) {
+ m_checked = b;
+ }
+
+ @Override
+ public boolean isFilterAccepted() {
+ return true;
+ }
+
+ @Override
+ public int getCellCount() {
+ return m_cells.size();
+ }
+
+ @Override
+ public ICell getCell(IColumn column) {
+ return getCell(column.getColumnIndex());
+ }
+
+ @Override
+ public ICell getCell(int columnIndex) {
+ if (columnIndex < m_cells.size()) {
+ return m_cells.get(columnIndex);
+ }
+ else {
+ return null;
+ }
+ }
+
+ @Override
+ public void setCell(IColumn column, ICell cell) throws ProcessingException {
+ setCell(column.getColumnIndex(), cell);
+ }
+
+ @Override
+ public void setCell(int columnIndex, ICell cell) throws ProcessingException {
+ if (cell != null) {
+ getCellForUpdate(columnIndex);
+ m_cells.set(columnIndex, new Cell(null, cell));
+ }
+ }
+
+ @Override
+ public Cell getCellForUpdate(IColumn column) {
+ return getCellForUpdate(column.getColumnIndex());
+ }
+
+ @Override
+ public Cell getCellForUpdate(int columnIndex) {
+ while (columnIndex >= m_cells.size()) {
+ m_cells.add(new Cell());
+ }
+ return m_cells.get(columnIndex);
+ }
+
+ @Override
+ public Object getCellValue(int columnIndex) {
+ ICell cell = getCell(columnIndex);
+ if (cell != null) {
+ return cell.getValue();
+ }
+ else {
+ return null;
+ }
+ }
+
+ @Override
+ public Object[] getKeyValues() {
+ if (m_columnSet == null) {
+ throw new UnsupportedOperationException("can only be called when TableRow was constructed with a non-null columnSet");
+ }
+ int[] keyColumns = m_columnSet.getKeyColumnIndexes();
+ if (keyColumns.length == 0) {
+ keyColumns = m_columnSet.getAllColumnIndexes();
+ }
+ Object[] pk = new Object[keyColumns.length];
+ for (int i = 0; i < keyColumns.length; i++) {
+ pk[i] = getCellValue(keyColumns[i]);
+ }
+ return pk;
+ }
+
+ @Override
+ public boolean isRowChanging() {
+ return false;
+ }
+
+ @Override
+ public void setRowChanging(boolean b) {
+ if (b) {
+ m_rowChanging++;
+ }
+ else {
+ m_rowChanging--;
+ }
+ }
+
+ @Override
+ public boolean/* changed */setCellValue(int columnIndex, Object value) throws ProcessingException {
+ try {
+ setRowChanging(true);
+ //
+ Object oldValue = getCellValue(columnIndex);
+ if (oldValue == value || (oldValue != null && oldValue.equals(value))) {
+ // no change in value
+ return false;
+ }
+ else {
+ getCellForUpdate(columnIndex);
+ m_cells.get(columnIndex).setValue(value);
+ if (isStatusNonchanged()) {
+ setStatusUpdated();
+ }
+ else {
+ // keep inserted, deleted
+ }
+ return true;
+ }
+ }
+ finally {
+ setRowChanging(false);
+ }
+ }
+
+ @Override
+ public boolean setCellValues(Object[] values) throws ProcessingException {
+ try {
+ setRowChanging(true);
+ //
+ boolean changed = false;
+ for (int i = 0; i < values.length; i++) {
+ boolean b = setCellValue(i, values[i]);
+ changed = changed || b;
+ }
+ return changed;
+ }
+ finally {
+ setRowChanging(false);
+ }
+ }
+
+ @Override
+ public ITable getTable() {
+ return null;
+ }
+
+ @Override
+ public void touch() throws ProcessingException {
+ }
+
+ @Override
+ public void delete() throws ProcessingException {
+ }
+
+ @Override
+ public void setBackgroundColor(String c) {
+ for (int i = 0; i < m_cells.size(); i++) {
+ m_cells.get(i).setBackgroundColor(c);
+ }
+ }
+
+ @Override
+ public void setForegroundColor(String c) {
+ for (int i = 0; i < m_cells.size(); i++) {
+ m_cells.get(i).setForegroundColor(c);
+ }
+ }
+
+ @Override
+ public void setFont(FontSpec f) {
+ for (int i = 0; i < m_cells.size(); i++) {
+ m_cells.get(i).setFont(f);
+ }
+ }
+
+ @Override
+ public void setTooltipText(String s) {
+ for (int i = 0; i < m_cells.size(); i++) {
+ m_cells.get(i).setTooltipText(s);
+ }
+ }
+
+ @Override
+ public void setIconId(String id) {
+ if (m_columnSet == null) {
+ throw new UnsupportedOperationException("can only be called when TableRow was constructed with a non-null columnSet");
+ }
+ IColumn col = m_columnSet.getFirstVisibleColumn();
+ if (col != null) {
+ m_cells.get(col.getColumnIndex()).setIconId(id);
+ }
+ }
+
+ @Override
+ public String getIconId() {
+ if (m_columnSet == null) {
+ throw new UnsupportedOperationException("can only be called when TableRow was constructed with a non-null columnSet");
+ }
+ IColumn col = m_columnSet.getFirstVisibleColumn();
+ if (col != null) {
+ return m_cells.get(col.getColumnIndex()).getIconId();
+ }
+ else {
+ return null;
+ }
+ }
+
+ @Override
+ public void moveDown() {
+ // no effect
+ }
+
+ @Override
+ public void moveToBottom() {
+ // no effect
+ }
+
+ @Override
+ public void moveToTop() {
+ // no effect
+ }
+
+ @Override
+ public void moveUp() {
+ // no effect
+ }
+
+ @Override
+ public boolean isRowPropertiesChanged() {
+ return m_rowPropertiesChanged;
+ }
+
+ @Override
+ public void setRowPropertiesChanged(boolean b) {
+ m_rowPropertiesChanged = b;
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + m_cells;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/TableRowComparator.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/TableRowComparator.java
index 3ff262331e..b3db7afe31 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/TableRowComparator.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/TableRowComparator.java
@@ -1,50 +1,50 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table;
-
-import java.util.Comparator;
-
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-
-/**
- * compares two TableRow objects based on 1 ore more columns
- */
-public class TableRowComparator implements Comparator<ITableRow> {
- private final IColumn[] m_columns;
-
- public TableRowComparator(IColumn[] columns) {
- m_columns = columns;
- }
-
- @Override
- public int compare(ITableRow row1, ITableRow row2) {
- for (int i = 0; i < m_columns.length; i++) {
- int c = m_columns[i].compareTableRows(row1, row2);
- if (!m_columns[i].getHeaderCell().isSortAscending()) {
- c = -c;
- }
- if (c != 0) {
- return c;
- }
- }
- return 0;
- }
-
- @Override
- public boolean equals(Object obj) {
- return obj != null && obj.getClass() == this.getClass() && ((TableRowComparator) obj).m_columns == this.m_columns;
- }
-
- @Override
- public int hashCode() {
- return 0;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table;
+
+import java.util.Comparator;
+
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+
+/**
+ * compares two TableRow objects based on 1 ore more columns
+ */
+public class TableRowComparator implements Comparator<ITableRow> {
+ private final IColumn[] m_columns;
+
+ public TableRowComparator(IColumn[] columns) {
+ m_columns = columns;
+ }
+
+ @Override
+ public int compare(ITableRow row1, ITableRow row2) {
+ for (int i = 0; i < m_columns.length; i++) {
+ int c = m_columns[i].compareTableRows(row1, row2);
+ if (!m_columns[i].getHeaderCell().isSortAscending()) {
+ c = -c;
+ }
+ if (c != 0) {
+ return c;
+ }
+ }
+ return 0;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ return obj != null && obj.getClass() == this.getClass() && ((TableRowComparator) obj).m_columns == this.m_columns;
+ }
+
+ @Override
+ public int hashCode() {
+ return 0;
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/TableRowMapper.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/TableRowMapper.java
index 7055f68247..d422de04bf 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/TableRowMapper.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/TableRowMapper.java
@@ -1,100 +1,100 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table;
-
-import java.util.ArrayList;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.holders.IHolder;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.internal.HolderToRowMapper;
-import org.eclipse.scout.rt.client.ui.basic.table.internal.RowToHolderMapper;
-
-public class TableRowMapper {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(TableRowMapper.class);
-
- private ITableRow m_row;
- private ArrayList<RowToHolderMapper> m_exportMappings;
- private ArrayList<HolderToRowMapper> m_importMappings;
-
- public TableRowMapper(ITableRow row) {
- m_row = row;
- }
-
- public ITableRow getRow() {
- return m_row;
- }
-
- /**
- * short form for addMapping(col,holder,true,true) {@link #addMapping(IColumn, IHolder, boolean, boolean)}
- */
- public <T> void addMapping(IColumn<T> col, IHolder<T> holder) {
- addMapping(col, holder, true, true);
- }
-
- /**
- * Convenience for mapping the values of this row to holders such as form
- * fields and value containers
- *
- * @see #exportRowData() and @see {@link #importRowData()}
- * @param enableExport
- * if true then the corresponding row value is included in {@link #exportRowData()}
- * @param enableImport
- * if true then the corresponding row value is included in {@link #importRowData()}
- */
- public <T> void addMapping(IColumn<T> col, IHolder<T> holder, boolean enableExport, boolean enableImport) {
- if (enableExport) {
- if (m_exportMappings == null) {
- m_exportMappings = new ArrayList<RowToHolderMapper>();
- }
- m_exportMappings.add(new RowToHolderMapper<T>(m_row, col, holder));
- }
- if (enableImport) {
- if (m_importMappings == null) {
- m_importMappings = new ArrayList<HolderToRowMapper>();
- }
- m_importMappings.add(new HolderToRowMapper<T>(m_row, col, holder));
- }
- }
-
- public void exportRowData() {
- if (m_exportMappings != null) {
- try {
- m_row.setRowChanging(true);
- //
- for (RowToHolderMapper m : m_exportMappings) {
- m.exportRowValue();
- }
- }
- finally {
- m_row.setRowChanging(false);
- }
- }
- }
-
- public void importRowData() throws ProcessingException {
- if (m_importMappings != null) {
- try {
- m_row.setRowChanging(true);
- //
- for (HolderToRowMapper m : m_importMappings) {
- m.importRowValue();
- }
- }
- finally {
- m_row.setRowChanging(false);
- }
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table;
+
+import java.util.ArrayList;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.holders.IHolder;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.internal.HolderToRowMapper;
+import org.eclipse.scout.rt.client.ui.basic.table.internal.RowToHolderMapper;
+
+public class TableRowMapper {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(TableRowMapper.class);
+
+ private ITableRow m_row;
+ private ArrayList<RowToHolderMapper> m_exportMappings;
+ private ArrayList<HolderToRowMapper> m_importMappings;
+
+ public TableRowMapper(ITableRow row) {
+ m_row = row;
+ }
+
+ public ITableRow getRow() {
+ return m_row;
+ }
+
+ /**
+ * short form for addMapping(col,holder,true,true) {@link #addMapping(IColumn, IHolder, boolean, boolean)}
+ */
+ public <T> void addMapping(IColumn<T> col, IHolder<T> holder) {
+ addMapping(col, holder, true, true);
+ }
+
+ /**
+ * Convenience for mapping the values of this row to holders such as form
+ * fields and value containers
+ *
+ * @see #exportRowData() and @see {@link #importRowData()}
+ * @param enableExport
+ * if true then the corresponding row value is included in {@link #exportRowData()}
+ * @param enableImport
+ * if true then the corresponding row value is included in {@link #importRowData()}
+ */
+ public <T> void addMapping(IColumn<T> col, IHolder<T> holder, boolean enableExport, boolean enableImport) {
+ if (enableExport) {
+ if (m_exportMappings == null) {
+ m_exportMappings = new ArrayList<RowToHolderMapper>();
+ }
+ m_exportMappings.add(new RowToHolderMapper<T>(m_row, col, holder));
+ }
+ if (enableImport) {
+ if (m_importMappings == null) {
+ m_importMappings = new ArrayList<HolderToRowMapper>();
+ }
+ m_importMappings.add(new HolderToRowMapper<T>(m_row, col, holder));
+ }
+ }
+
+ public void exportRowData() {
+ if (m_exportMappings != null) {
+ try {
+ m_row.setRowChanging(true);
+ //
+ for (RowToHolderMapper m : m_exportMappings) {
+ m.exportRowValue();
+ }
+ }
+ finally {
+ m_row.setRowChanging(false);
+ }
+ }
+ }
+
+ public void importRowData() throws ProcessingException {
+ if (m_importMappings != null) {
+ try {
+ m_row.setRowChanging(true);
+ //
+ for (HolderToRowMapper m : m_importMappings) {
+ m.importRowValue();
+ }
+ }
+ finally {
+ m_row.setRowChanging(false);
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/TableUtility.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/TableUtility.java
index 13c0e4e538..68c8c0c18c 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/TableUtility.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/TableUtility.java
@@ -1,373 +1,373 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-import java.sql.Timestamp;
-import java.util.Date;
-import java.util.Map;
-
-import org.eclipse.scout.commons.ConfigurationUtility;
-import org.eclipse.scout.commons.HTMLUtility;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.TypeCastUtility;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IBigDecimalColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IBooleanColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IDateColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IDoubleColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IIntegerColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.ILongColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.ISmartColumn;
-import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
-import org.eclipse.scout.rt.shared.services.lookup.LocalLookupCall;
-import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
-import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
-import org.eclipse.scout.service.SERVICES;
-
-/**
- * TODO imo these methods are from AbstractTable, move them over here in release jun/2011.
- */
-public final class TableUtility {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(TableUtility.class);
-
- private TableUtility() {
- }
-
- /**
- * synchronous resolving of lookup values to text
- * <p>
- * Note that remote lookup calls are evaluated one by one, no batch processing.
- */
- public static void resolveLookupCall(Map<LookupCall, LookupRow[]> lookupCache, ITableRow row, ISmartColumn<?> col, boolean multilineText) {
- try {
- LookupCall call = col.prepareLookupCall(row);
- if (call != null) {
- LookupRow[] result = null;
- boolean verifiedQuality = verifyLookupCallBeanQuality(call);
- //optimize local calls by caching the results
- if (verifiedQuality) {
- result = lookupCache.get(call);
- }
- if (result == null) {
- result = call.getDataByKey();
- if (verifiedQuality) {
- lookupCache.put(call, result);
- }
- }
- applyLookupResult(row, col, result, multilineText);
- }
- }
- catch (ProcessingException e) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- }
-
- /**
- * In order to use caching of results on lookup calls, it is crucial that the javabean concepts are valid,
- * especially hashCode and equals (when the subclass has additional member fields).
- * <p>
- * Scout tries to help developers to find problems related to this issue and write a warning in development mode on
- * all local lookup call subclasses that do not overwrite hashCode and equals.
- */
- public static boolean verifyLookupCallBeanQuality(LookupCall call) {
- Class<?> clazz = call.getClass();
- if (LocalLookupCall.class == clazz) {
- return true;
- }
- if (LookupCall.class == clazz) {
- return true;
- }
- if (LocalLookupCall.class.isAssignableFrom(clazz)) {
- Class<?> tmp = clazz;
- while (tmp != LocalLookupCall.class) {
- if (ConfigurationUtility.isMethodOverwrite(LocalLookupCall.class, "equals", new Class[]{Object.class}, tmp)) {
- return true;
- }
- Field[] fields = tmp.getDeclaredFields();
- if (fields != null && fields.length > 0) {
- for (int i = 0; i < fields.length; i++) {
- if ((fields[i].getModifiers() & (Modifier.STATIC | Modifier.FINAL)) == 0) {
- LOG.warn("" + clazz + " subclasses LocalLookupCall with additional member " + fields[i].getName() + " and should therefore override the 'equals' and 'hashCode' methods");
- return false;
- }
- }
- }
- //next
- tmp = tmp.getSuperclass();
- }
- return true;
- }
- if (LookupCall.class.isAssignableFrom(clazz)) {
- Class<?> tmp = clazz;
- while (tmp != LookupCall.class) {
- if (ConfigurationUtility.isMethodOverwrite(LookupCall.class, "equals", new Class[]{Object.class}, tmp)) {
- return true;
- }
- Field[] fields = tmp.getDeclaredFields();
- if (fields != null && fields.length > 0) {
- for (int i = 0; i < fields.length; i++) {
- if ((fields[i].getModifiers() & (Modifier.STATIC | Modifier.FINAL)) == 0) {
- LOG.warn("" + clazz + " subclasses LookupCall with additional member " + fields[i].getName() + " and should therefore override the 'equals' and 'hashCode' methods");
- return false;
- }
- }
- }
- //next
- tmp = tmp.getSuperclass();
- }
- return true;
- }
- return false;
- }
-
- public static void applyLookupResult(ITableRow row, IColumn<?> col, LookupRow[] result, boolean multilineText) {
- // disable row changed trigger on row
- try {
- row.setRowChanging(true);
- //
- Cell cell = (Cell) row.getCell(col.getColumnIndex());
- if (result.length == 1) {
- cell.setText(result[0].getText());
- }
- else if (result.length > 1) {
- StringBuffer buf = new StringBuffer();
- for (int i = 0; i < result.length; i++) {
- if (i > 0) {
- if (multilineText) {
- buf.append("\n");
- }
- else {
- buf.append(", ");
- }
- }
- buf.append(result[i].getText());
- }
- cell.setText(buf.toString());
- }
- else {
- cell.setText("");
- }
- }
- finally {
- row.setRowPropertiesChanged(false);
- row.setRowChanging(false);
- }
- }
-
- /**
- * @return matrix[rowCount][columnCount] with cell as CSV cells
- * <p>
- * The returned csv will be:
- * <ul>
- * <li>Optional row: column names (Strings)</li>
- * <li>Optional row: column types (Classes)</li>
- * <li>Optional row: column formats (Strings)</li>
- * <li>Data row (Objects)</li>
- * <li>Data row (Objects)</li>
- * <li>...</li>
- * </ul>
- * <p>
- * valid exported csv types include:
- * <ul>
- * <li>java.lang.String</li>
- * <li>java.lang.Long</li>
- * <li>java.lang.Integer</li>
- * <li>java.lang.Float</li>
- * <li>java.lang.Double</li>
- * <li>java.lang.Boolean</li>
- * <li>java.util.Date</li>
- * </ul>
- */
- public static Object[][] exportRowsAsCSV(ITableRow[] rows, IColumn<?>[] columns, boolean includeLineForColumnNames, boolean includeLineForColumnTypes, boolean includeLineForColumnFormats) {
- int nr = rows.length;
- Object[][] a = new Object[nr + (includeLineForColumnNames ? 1 : 0) + (includeLineForColumnTypes ? 1 : 0) + (includeLineForColumnFormats ? 1 : 0)][columns.length];
- for (int c = 0; c < columns.length; c++) {
- IColumn<?> col = columns[c];
- Class<?> type;
- boolean byValue;
- String format;
- if (col instanceof IDateColumn) {
- if (((IDateColumn) col).isHasTime()) {
- type = Timestamp.class;
- byValue = true;
- format = ((IDateColumn) col).getFormat();
- }
- else {
- type = Date.class;
- byValue = true;
- format = ((IDateColumn) col).getFormat();
- }
- }
- else if (col instanceof IDoubleColumn) {
- type = Double.class;
- byValue = true;
- format = ((IDoubleColumn) col).getFormat();
- }
- else if (col instanceof IIntegerColumn) {
- type = Integer.class;
- byValue = true;
- format = ((IIntegerColumn) col).getFormat();
- }
- else if (col instanceof ILongColumn) {
- type = Long.class;
- byValue = true;
- format = ((ILongColumn) col).getFormat();
- }
- else if (col instanceof IBigDecimalColumn) {
- type = Long.class;
- byValue = true;
- format = ((IBigDecimalColumn) col).getFormat();
- }
- else if (col instanceof ISmartColumn<?>) {
- type = String.class;
- byValue = false;
- format = null;
- }
- else if (col instanceof IBooleanColumn) {
- type = Boolean.class;
- byValue = false;
- format = null;
- }
- else {
- type = String.class;
- byValue = false;
- format = null;
- }
- //
- int csvRowIndex = 0;
- if (includeLineForColumnNames) {
- a[csvRowIndex][c] = columns[c].getHeaderCell().getText();
- csvRowIndex++;
- }
- if (includeLineForColumnTypes) {
- a[csvRowIndex][c] = type;
- csvRowIndex++;
- }
- if (includeLineForColumnFormats) {
- a[csvRowIndex][c] = format;
- csvRowIndex++;
- }
- for (int r = 0; r < nr; r++) {
- if (byValue) {
- if (type == Timestamp.class) {
- a[csvRowIndex][c] = TypeCastUtility.castValue(columns[c].getValue(rows[r]), Timestamp.class);
- }
- else {
- a[csvRowIndex][c] = columns[c].getValue(rows[r]);
- }
- }
- else {
- String text = columns[c].getDisplayText(rows[r]);
- //special intercept for boolean
- if (type == Boolean.class) {
- Boolean b = TypeCastUtility.castValue(columns[c].getValue(rows[r]), Boolean.class);
- if (b != null && b.booleanValue()) {
- // only use X if no display text is set
- if (!StringUtility.hasText(text)) {
- text = "X";
- }
- }
- }
- //special intercept for html
- if (type == String.class) {
- if (text != null && text.startsWith("<html")) {
- text = HTMLUtility.getPlainText(text);
- }
- }
- a[csvRowIndex][c] = text;
- }
- csvRowIndex++;
- }
- }
- return a;
- }
-
- public static interface ITableCellEditorFilter {
- boolean accept(ITableRow row, IColumn<?> col);
- }
-
- /**
- * based on row and column, find the next visible cell and start editing
- *
- * @param table
- * @param row
- * @param col
- * @param forward
- * @param filter
- * (optional) is used to further narrow which cells are editable. This filter is checked after the check to
- * {@link ITable#isCellEditable(ITableRow, IColumn)}
- */
- public static void editNextTableCell(ITable table, ITableRow currentRow, IColumn<?> currentCol, boolean forward, ITableCellEditorFilter filter) {
- if (table == null) {
- return;
- }
- int rowCount = table.getFilteredRowCount();
- int colCount = table.getVisibleColumnCount();
- if (rowCount <= 0 || colCount <= 0) {
- return;
- }
- currentRow = table.resolveRow(currentRow);
- currentCol = table.getColumnSet().resolveColumn(currentCol);
- if (currentRow == null || currentCol == null) {
- return;
- }
- int row = table.getFilteredRowIndex(currentRow);
- int modelCol = currentCol.getColumnIndex();
- int[] visibleIndexes = table.getColumnSet().getVisibleColumnIndexes();
- int col = -1;
- for (int i = 0; i < visibleIndexes.length; i++) {
- if (visibleIndexes[i] == modelCol) {
- col = i;
- break;
- }
- }
- if (row < 0 || col < 0) {
- return;
- }
- int a = rowCount * colCount;
- while (a > 1) {
- a--;
- if (forward) {
- col++;
- if (col >= colCount) {
- row++;
- col = 0;
- }
- if (row >= rowCount) {
- row = 0;
- }
- }
- else {
- col--;
- if (col < 0) {
- row--;
- col = colCount - 1;
- }
- if (row < 0) {
- row = rowCount - 1;
- }
- }
- ITableRow tr = table.getFilteredRow(row);
- IColumn<?> tc = table.getColumnSet().getVisibleColumn(col);
- if (tr != null && tc != null && table.isCellEditable(tr, tc) && (filter == null || filter.accept(tr, tc))) {
- table.requestFocusInCell(tc, tr);
- return;
- }
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.sql.Timestamp;
+import java.util.Date;
+import java.util.Map;
+
+import org.eclipse.scout.commons.ConfigurationUtility;
+import org.eclipse.scout.commons.HTMLUtility;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.TypeCastUtility;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IBigDecimalColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IBooleanColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IDateColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IDoubleColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IIntegerColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.ILongColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.ISmartColumn;
+import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
+import org.eclipse.scout.rt.shared.services.lookup.LocalLookupCall;
+import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
+import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
+import org.eclipse.scout.service.SERVICES;
+
+/**
+ * TODO imo these methods are from AbstractTable, move them over here in release jun/2011.
+ */
+public final class TableUtility {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(TableUtility.class);
+
+ private TableUtility() {
+ }
+
+ /**
+ * synchronous resolving of lookup values to text
+ * <p>
+ * Note that remote lookup calls are evaluated one by one, no batch processing.
+ */
+ public static void resolveLookupCall(Map<LookupCall, LookupRow[]> lookupCache, ITableRow row, ISmartColumn<?> col, boolean multilineText) {
+ try {
+ LookupCall call = col.prepareLookupCall(row);
+ if (call != null) {
+ LookupRow[] result = null;
+ boolean verifiedQuality = verifyLookupCallBeanQuality(call);
+ //optimize local calls by caching the results
+ if (verifiedQuality) {
+ result = lookupCache.get(call);
+ }
+ if (result == null) {
+ result = call.getDataByKey();
+ if (verifiedQuality) {
+ lookupCache.put(call, result);
+ }
+ }
+ applyLookupResult(row, col, result, multilineText);
+ }
+ }
+ catch (ProcessingException e) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ }
+
+ /**
+ * In order to use caching of results on lookup calls, it is crucial that the javabean concepts are valid,
+ * especially hashCode and equals (when the subclass has additional member fields).
+ * <p>
+ * Scout tries to help developers to find problems related to this issue and write a warning in development mode on
+ * all local lookup call subclasses that do not overwrite hashCode and equals.
+ */
+ public static boolean verifyLookupCallBeanQuality(LookupCall call) {
+ Class<?> clazz = call.getClass();
+ if (LocalLookupCall.class == clazz) {
+ return true;
+ }
+ if (LookupCall.class == clazz) {
+ return true;
+ }
+ if (LocalLookupCall.class.isAssignableFrom(clazz)) {
+ Class<?> tmp = clazz;
+ while (tmp != LocalLookupCall.class) {
+ if (ConfigurationUtility.isMethodOverwrite(LocalLookupCall.class, "equals", new Class[]{Object.class}, tmp)) {
+ return true;
+ }
+ Field[] fields = tmp.getDeclaredFields();
+ if (fields != null && fields.length > 0) {
+ for (int i = 0; i < fields.length; i++) {
+ if ((fields[i].getModifiers() & (Modifier.STATIC | Modifier.FINAL)) == 0) {
+ LOG.warn("" + clazz + " subclasses LocalLookupCall with additional member " + fields[i].getName() + " and should therefore override the 'equals' and 'hashCode' methods");
+ return false;
+ }
+ }
+ }
+ //next
+ tmp = tmp.getSuperclass();
+ }
+ return true;
+ }
+ if (LookupCall.class.isAssignableFrom(clazz)) {
+ Class<?> tmp = clazz;
+ while (tmp != LookupCall.class) {
+ if (ConfigurationUtility.isMethodOverwrite(LookupCall.class, "equals", new Class[]{Object.class}, tmp)) {
+ return true;
+ }
+ Field[] fields = tmp.getDeclaredFields();
+ if (fields != null && fields.length > 0) {
+ for (int i = 0; i < fields.length; i++) {
+ if ((fields[i].getModifiers() & (Modifier.STATIC | Modifier.FINAL)) == 0) {
+ LOG.warn("" + clazz + " subclasses LookupCall with additional member " + fields[i].getName() + " and should therefore override the 'equals' and 'hashCode' methods");
+ return false;
+ }
+ }
+ }
+ //next
+ tmp = tmp.getSuperclass();
+ }
+ return true;
+ }
+ return false;
+ }
+
+ public static void applyLookupResult(ITableRow row, IColumn<?> col, LookupRow[] result, boolean multilineText) {
+ // disable row changed trigger on row
+ try {
+ row.setRowChanging(true);
+ //
+ Cell cell = (Cell) row.getCell(col.getColumnIndex());
+ if (result.length == 1) {
+ cell.setText(result[0].getText());
+ }
+ else if (result.length > 1) {
+ StringBuffer buf = new StringBuffer();
+ for (int i = 0; i < result.length; i++) {
+ if (i > 0) {
+ if (multilineText) {
+ buf.append("\n");
+ }
+ else {
+ buf.append(", ");
+ }
+ }
+ buf.append(result[i].getText());
+ }
+ cell.setText(buf.toString());
+ }
+ else {
+ cell.setText("");
+ }
+ }
+ finally {
+ row.setRowPropertiesChanged(false);
+ row.setRowChanging(false);
+ }
+ }
+
+ /**
+ * @return matrix[rowCount][columnCount] with cell as CSV cells
+ * <p>
+ * The returned csv will be:
+ * <ul>
+ * <li>Optional row: column names (Strings)</li>
+ * <li>Optional row: column types (Classes)</li>
+ * <li>Optional row: column formats (Strings)</li>
+ * <li>Data row (Objects)</li>
+ * <li>Data row (Objects)</li>
+ * <li>...</li>
+ * </ul>
+ * <p>
+ * valid exported csv types include:
+ * <ul>
+ * <li>java.lang.String</li>
+ * <li>java.lang.Long</li>
+ * <li>java.lang.Integer</li>
+ * <li>java.lang.Float</li>
+ * <li>java.lang.Double</li>
+ * <li>java.lang.Boolean</li>
+ * <li>java.util.Date</li>
+ * </ul>
+ */
+ public static Object[][] exportRowsAsCSV(ITableRow[] rows, IColumn<?>[] columns, boolean includeLineForColumnNames, boolean includeLineForColumnTypes, boolean includeLineForColumnFormats) {
+ int nr = rows.length;
+ Object[][] a = new Object[nr + (includeLineForColumnNames ? 1 : 0) + (includeLineForColumnTypes ? 1 : 0) + (includeLineForColumnFormats ? 1 : 0)][columns.length];
+ for (int c = 0; c < columns.length; c++) {
+ IColumn<?> col = columns[c];
+ Class<?> type;
+ boolean byValue;
+ String format;
+ if (col instanceof IDateColumn) {
+ if (((IDateColumn) col).isHasTime()) {
+ type = Timestamp.class;
+ byValue = true;
+ format = ((IDateColumn) col).getFormat();
+ }
+ else {
+ type = Date.class;
+ byValue = true;
+ format = ((IDateColumn) col).getFormat();
+ }
+ }
+ else if (col instanceof IDoubleColumn) {
+ type = Double.class;
+ byValue = true;
+ format = ((IDoubleColumn) col).getFormat();
+ }
+ else if (col instanceof IIntegerColumn) {
+ type = Integer.class;
+ byValue = true;
+ format = ((IIntegerColumn) col).getFormat();
+ }
+ else if (col instanceof ILongColumn) {
+ type = Long.class;
+ byValue = true;
+ format = ((ILongColumn) col).getFormat();
+ }
+ else if (col instanceof IBigDecimalColumn) {
+ type = Long.class;
+ byValue = true;
+ format = ((IBigDecimalColumn) col).getFormat();
+ }
+ else if (col instanceof ISmartColumn<?>) {
+ type = String.class;
+ byValue = false;
+ format = null;
+ }
+ else if (col instanceof IBooleanColumn) {
+ type = Boolean.class;
+ byValue = false;
+ format = null;
+ }
+ else {
+ type = String.class;
+ byValue = false;
+ format = null;
+ }
+ //
+ int csvRowIndex = 0;
+ if (includeLineForColumnNames) {
+ a[csvRowIndex][c] = columns[c].getHeaderCell().getText();
+ csvRowIndex++;
+ }
+ if (includeLineForColumnTypes) {
+ a[csvRowIndex][c] = type;
+ csvRowIndex++;
+ }
+ if (includeLineForColumnFormats) {
+ a[csvRowIndex][c] = format;
+ csvRowIndex++;
+ }
+ for (int r = 0; r < nr; r++) {
+ if (byValue) {
+ if (type == Timestamp.class) {
+ a[csvRowIndex][c] = TypeCastUtility.castValue(columns[c].getValue(rows[r]), Timestamp.class);
+ }
+ else {
+ a[csvRowIndex][c] = columns[c].getValue(rows[r]);
+ }
+ }
+ else {
+ String text = columns[c].getDisplayText(rows[r]);
+ //special intercept for boolean
+ if (type == Boolean.class) {
+ Boolean b = TypeCastUtility.castValue(columns[c].getValue(rows[r]), Boolean.class);
+ if (b != null && b.booleanValue()) {
+ // only use X if no display text is set
+ if (!StringUtility.hasText(text)) {
+ text = "X";
+ }
+ }
+ }
+ //special intercept for html
+ if (type == String.class) {
+ if (text != null && text.startsWith("<html")) {
+ text = HTMLUtility.getPlainText(text);
+ }
+ }
+ a[csvRowIndex][c] = text;
+ }
+ csvRowIndex++;
+ }
+ }
+ return a;
+ }
+
+ public static interface ITableCellEditorFilter {
+ boolean accept(ITableRow row, IColumn<?> col);
+ }
+
+ /**
+ * based on row and column, find the next visible cell and start editing
+ *
+ * @param table
+ * @param row
+ * @param col
+ * @param forward
+ * @param filter
+ * (optional) is used to further narrow which cells are editable. This filter is checked after the check to
+ * {@link ITable#isCellEditable(ITableRow, IColumn)}
+ */
+ public static void editNextTableCell(ITable table, ITableRow currentRow, IColumn<?> currentCol, boolean forward, ITableCellEditorFilter filter) {
+ if (table == null) {
+ return;
+ }
+ int rowCount = table.getFilteredRowCount();
+ int colCount = table.getVisibleColumnCount();
+ if (rowCount <= 0 || colCount <= 0) {
+ return;
+ }
+ currentRow = table.resolveRow(currentRow);
+ currentCol = table.getColumnSet().resolveColumn(currentCol);
+ if (currentRow == null || currentCol == null) {
+ return;
+ }
+ int row = table.getFilteredRowIndex(currentRow);
+ int modelCol = currentCol.getColumnIndex();
+ int[] visibleIndexes = table.getColumnSet().getVisibleColumnIndexes();
+ int col = -1;
+ for (int i = 0; i < visibleIndexes.length; i++) {
+ if (visibleIndexes[i] == modelCol) {
+ col = i;
+ break;
+ }
+ }
+ if (row < 0 || col < 0) {
+ return;
+ }
+ int a = rowCount * colCount;
+ while (a > 1) {
+ a--;
+ if (forward) {
+ col++;
+ if (col >= colCount) {
+ row++;
+ col = 0;
+ }
+ if (row >= rowCount) {
+ row = 0;
+ }
+ }
+ else {
+ col--;
+ if (col < 0) {
+ row--;
+ col = colCount - 1;
+ }
+ if (row < 0) {
+ row = rowCount - 1;
+ }
+ }
+ ITableRow tr = table.getFilteredRow(row);
+ IColumn<?> tc = table.getColumnSet().getVisibleColumn(col);
+ if (tr != null && tc != null && table.isCellEditable(tr, tc) && (filter == null || filter.accept(tr, tc))) {
+ table.requestFocusInCell(tc, tr);
+ return;
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/TestMemoryUsage.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/TestMemoryUsage.java
index df1106837f..aedbeb944c 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/TestMemoryUsage.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/TestMemoryUsage.java
@@ -1,56 +1,56 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
-
-public final class TestMemoryUsage {
- private final Cell[] mv;
-
- private TestMemoryUsage(int rows, int cols) throws ProcessingException {
- mv = new Cell[rows * cols];
- for (int r = 0; r < rows; r++) {
- for (int c = 0; c < cols; c++) {
- Cell v = new Cell();
- String s = "Hello World " + r + "," + c;
- v.setText(s);
- v.setValue(new Long(r * cols + c));
- mv[r * cols + c] = v;
- }
- }
- }
-
- public static void main(String[] args) throws ProcessingException {
- System.gc();
- long max0 = Runtime.getRuntime().maxMemory();
- long total0 = Runtime.getRuntime().totalMemory();
- long free0 = Runtime.getRuntime().freeMemory();
-
- // consumeMemory
- int rows = 100000;
- int cols = 10;
- int cells = rows * cols;
- @SuppressWarnings("unused")
- TestMemoryUsage t = new TestMemoryUsage(rows, cols);
-
- System.gc();
- long max1 = Runtime.getRuntime().maxMemory();
- long total1 = Runtime.getRuntime().totalMemory();
- long free1 = Runtime.getRuntime().freeMemory();
- System.out.println("DELTA max/total/consumed=" + (max1 - max0) + "/" + (total1 - total0) + "/" + (free0 - free1));
- System.out.println("DELTA/N max/total/consumed=" + (max1 - max0) / cells + "/" + (total1 - total0) / cells + "/" + (free0 - free1) / cells);
- System.out.println("DELTA total+consumed=" + ((max1 - max0) + (total1 - total0) + (free0 - free1)));
- long d = ((max1 - max0) + (total1 - total0) + (free0 - free1)) / cells;
- System.out.println("DELTA/N total+consumed=43+" + (d - 43));
- System.exit(0);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
+
+public final class TestMemoryUsage {
+ private final Cell[] mv;
+
+ private TestMemoryUsage(int rows, int cols) throws ProcessingException {
+ mv = new Cell[rows * cols];
+ for (int r = 0; r < rows; r++) {
+ for (int c = 0; c < cols; c++) {
+ Cell v = new Cell();
+ String s = "Hello World " + r + "," + c;
+ v.setText(s);
+ v.setValue(new Long(r * cols + c));
+ mv[r * cols + c] = v;
+ }
+ }
+ }
+
+ public static void main(String[] args) throws ProcessingException {
+ System.gc();
+ long max0 = Runtime.getRuntime().maxMemory();
+ long total0 = Runtime.getRuntime().totalMemory();
+ long free0 = Runtime.getRuntime().freeMemory();
+
+ // consumeMemory
+ int rows = 100000;
+ int cols = 10;
+ int cells = rows * cols;
+ @SuppressWarnings("unused")
+ TestMemoryUsage t = new TestMemoryUsage(rows, cols);
+
+ System.gc();
+ long max1 = Runtime.getRuntime().maxMemory();
+ long total1 = Runtime.getRuntime().totalMemory();
+ long free1 = Runtime.getRuntime().freeMemory();
+ System.out.println("DELTA max/total/consumed=" + (max1 - max0) + "/" + (total1 - total0) + "/" + (free0 - free1));
+ System.out.println("DELTA/N max/total/consumed=" + (max1 - max0) / cells + "/" + (total1 - total0) / cells + "/" + (free0 - free1) / cells);
+ System.out.println("DELTA total+consumed=" + ((max1 - max0) + (total1 - total0) + (free0 - free1)));
+ long d = ((max1 - max0) + (total1 - total0) + (free0 - free1)) / cells;
+ System.out.println("DELTA/N total+consumed=43+" + (d - 43));
+ System.exit(0);
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columnfilter/BooleanColumnFilter.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columnfilter/BooleanColumnFilter.java
index e8ee6cf0a1..67353fa728 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columnfilter/BooleanColumnFilter.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columnfilter/BooleanColumnFilter.java
@@ -1,99 +1,99 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table.columnfilter;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeMap;
-
-import org.eclipse.scout.commons.BooleanUtility;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
-
-/**
- * Checkboxes, Boolean values
- */
-public class BooleanColumnFilter<T extends Comparable<Boolean>> implements ITableColumnFilter<Boolean>, Serializable {
- private static final long serialVersionUID = 1L;
- private IColumn<Boolean> m_column;
- private Set<Boolean> m_selectedValues;
-
- public BooleanColumnFilter(IColumn<Boolean> column) {
- m_column = column;
- }
-
- @Override
- public IColumn<Boolean> getColumn() {
- return m_column;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public void setColumn(IColumn column) {
- m_column = column;
- }
-
- @Override
- public Set<Boolean> getSelectedValues() {
- return m_selectedValues;
- }
-
- @Override
- public void setSelectedValues(Set<Boolean> set) {
- m_selectedValues = set;
- }
-
- @Override
- public List<LookupRow> createHistogram() {
- TreeMap<Boolean, LookupRow> hist = new TreeMap<Boolean, LookupRow>();
- HashMap<Boolean, Integer> countMap = new HashMap<Boolean, Integer>();
- hist.put(true, new LookupRow(true, "(" + ScoutTexts.get("ColumnFilterCheckedText") + ")"));
- hist.put(false, new LookupRow(false, "(" + ScoutTexts.get("ColumnFilterUncheckedText") + ")"));
- for (ITableRow row : m_column.getTable().getRows()) {
- Boolean key = BooleanUtility.nvl(m_column.getValue(row), false);
- Integer count = countMap.get(key);
- countMap.put(key, count != null ? count + 1 : 1);
- }
- for (Map.Entry<Boolean, LookupRow> e : hist.entrySet()) {
- Integer count = countMap.get(e.getKey());
- if (count != null && count > 1) {
- LookupRow row = e.getValue();
- row.setText(row.getText() + " (" + count + ")");
- }
- }
- ArrayList<LookupRow> list = new ArrayList<LookupRow>();
- list.addAll(hist.values());
- return list;
- }
-
- @Override
- public boolean isEmpty() {
- return (m_selectedValues == null || m_selectedValues.isEmpty());
- }
-
- @Override
- public boolean accept(ITableRow row) {
- Boolean value = BooleanUtility.nvl(m_column.getValue(row), false);
- if (m_selectedValues != null) {
- if (!m_selectedValues.contains(value)) {
- return false;
- }
- }
- return true;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table.columnfilter;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+
+import org.eclipse.scout.commons.BooleanUtility;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
+
+/**
+ * Checkboxes, Boolean values
+ */
+public class BooleanColumnFilter<T extends Comparable<Boolean>> implements ITableColumnFilter<Boolean>, Serializable {
+ private static final long serialVersionUID = 1L;
+ private IColumn<Boolean> m_column;
+ private Set<Boolean> m_selectedValues;
+
+ public BooleanColumnFilter(IColumn<Boolean> column) {
+ m_column = column;
+ }
+
+ @Override
+ public IColumn<Boolean> getColumn() {
+ return m_column;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public void setColumn(IColumn column) {
+ m_column = column;
+ }
+
+ @Override
+ public Set<Boolean> getSelectedValues() {
+ return m_selectedValues;
+ }
+
+ @Override
+ public void setSelectedValues(Set<Boolean> set) {
+ m_selectedValues = set;
+ }
+
+ @Override
+ public List<LookupRow> createHistogram() {
+ TreeMap<Boolean, LookupRow> hist = new TreeMap<Boolean, LookupRow>();
+ HashMap<Boolean, Integer> countMap = new HashMap<Boolean, Integer>();
+ hist.put(true, new LookupRow(true, "(" + ScoutTexts.get("ColumnFilterCheckedText") + ")"));
+ hist.put(false, new LookupRow(false, "(" + ScoutTexts.get("ColumnFilterUncheckedText") + ")"));
+ for (ITableRow row : m_column.getTable().getRows()) {
+ Boolean key = BooleanUtility.nvl(m_column.getValue(row), false);
+ Integer count = countMap.get(key);
+ countMap.put(key, count != null ? count + 1 : 1);
+ }
+ for (Map.Entry<Boolean, LookupRow> e : hist.entrySet()) {
+ Integer count = countMap.get(e.getKey());
+ if (count != null && count > 1) {
+ LookupRow row = e.getValue();
+ row.setText(row.getText() + " (" + count + ")");
+ }
+ }
+ ArrayList<LookupRow> list = new ArrayList<LookupRow>();
+ list.addAll(hist.values());
+ return list;
+ }
+
+ @Override
+ public boolean isEmpty() {
+ return (m_selectedValues == null || m_selectedValues.isEmpty());
+ }
+
+ @Override
+ public boolean accept(ITableRow row) {
+ Boolean value = BooleanUtility.nvl(m_column.getValue(row), false);
+ if (m_selectedValues != null) {
+ if (!m_selectedValues.contains(value)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columnfilter/ColumnFilterForm.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columnfilter/ColumnFilterForm.java
index 0c1e46361e..9750f63b01 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columnfilter/ColumnFilterForm.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columnfilter/ColumnFilterForm.java
@@ -1,573 +1,573 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table.columnfilter;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.scout.commons.TypeCastUtility;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.basic.table.AbstractTable;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.client.ui.basic.table.TableRow;
-import org.eclipse.scout.rt.client.ui.basic.table.columnfilter.ColumnFilterForm.MainBox.CloseButton;
-import org.eclipse.scout.rt.client.ui.basic.table.columnfilter.ColumnFilterForm.MainBox.DateDetailBox;
-import org.eclipse.scout.rt.client.ui.basic.table.columnfilter.ColumnFilterForm.MainBox.DateDetailBox.DateSequenceBox.DateFromField;
-import org.eclipse.scout.rt.client.ui.basic.table.columnfilter.ColumnFilterForm.MainBox.DateDetailBox.DateSequenceBox.DateToField;
-import org.eclipse.scout.rt.client.ui.basic.table.columnfilter.ColumnFilterForm.MainBox.NumberDetailBox;
-import org.eclipse.scout.rt.client.ui.basic.table.columnfilter.ColumnFilterForm.MainBox.NumberDetailBox.NumberSequenceBox.NumberFromField;
-import org.eclipse.scout.rt.client.ui.basic.table.columnfilter.ColumnFilterForm.MainBox.NumberDetailBox.NumberSequenceBox.NumberToField;
-import org.eclipse.scout.rt.client.ui.basic.table.columnfilter.ColumnFilterForm.MainBox.OkButton;
-import org.eclipse.scout.rt.client.ui.basic.table.columnfilter.ColumnFilterForm.MainBox.StringDetailBox;
-import org.eclipse.scout.rt.client.ui.basic.table.columnfilter.ColumnFilterForm.MainBox.StringDetailBox.PatternField;
-import org.eclipse.scout.rt.client.ui.basic.table.columnfilter.ColumnFilterForm.MainBox.ValuesBox.ValuesTableField;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractObjectColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractStringColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IDateColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IDoubleColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IIntegerColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.ILongColumn;
-import org.eclipse.scout.rt.client.ui.form.AbstractForm;
-import org.eclipse.scout.rt.client.ui.form.AbstractFormHandler;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
-import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractButton;
-import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractCloseButton;
-import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractLinkButton;
-import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractOkButton;
-import org.eclipse.scout.rt.client.ui.form.fields.datefield.AbstractDateField;
-import org.eclipse.scout.rt.client.ui.form.fields.datefield.IDateField;
-import org.eclipse.scout.rt.client.ui.form.fields.doublefield.AbstractDoubleField;
-import org.eclipse.scout.rt.client.ui.form.fields.doublefield.IDoubleField;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
-import org.eclipse.scout.rt.client.ui.form.fields.sequencebox.AbstractSequenceBox;
-import org.eclipse.scout.rt.client.ui.form.fields.stringfield.AbstractStringField;
-import org.eclipse.scout.rt.client.ui.form.fields.tablefield.AbstractTableField;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
-
-public class ColumnFilterForm extends AbstractForm {
- private ITableColumnFilter<?> m_columnFilter;
-
- public ColumnFilterForm() throws ProcessingException {
- }
-
- @Override
- protected String getConfiguredTitle() {
- return ScoutTexts.get("ColumnFilter");
- }
-
- @Override
- protected boolean getConfiguredModal() {
- return true;
- }
-
- public ITableColumnFilter<?> getColumnFilter() {
- return m_columnFilter;
- }
-
- public void setColumnFilter(ITableColumnFilter<?> columnFilter) {
- m_columnFilter = columnFilter;
- }
-
- public MainBox getMainBox() {
- return (MainBox) getRootGroupBox();
- }
-
- public ValuesTableField getValuesTableField() {
- return getFieldByClass(ValuesTableField.class);
- }
-
- public StringDetailBox getStringDetailBox() {
- return getFieldByClass(StringDetailBox.class);
- }
-
- public PatternField getPatternField() {
- return getFieldByClass(PatternField.class);
- }
-
- public DateDetailBox getDateDetailBox() {
- return getFieldByClass(DateDetailBox.class);
- }
-
- public DateFromField getDateFromField() {
- return getFieldByClass(DateFromField.class);
- }
-
- public DateToField getDateToField() {
- return getFieldByClass(DateToField.class);
- }
-
- public NumberDetailBox getNumberDetailBox() {
- return getFieldByClass(NumberDetailBox.class);
- }
-
- public NumberFromField getNumberFromField() {
- return getFieldByClass(NumberFromField.class);
- }
-
- public NumberToField getNumberToField() {
- return getFieldByClass(NumberToField.class);
- }
-
- public OkButton getOkButton() {
- return getFieldByClass(OkButton.class);
- }
-
- public CloseButton getCloseButton() {
- return getFieldByClass(CloseButton.class);
- }
-
- public void startModify() throws ProcessingException {
- startInternal(new ModifyHandler());
- }
-
- private void setupDateField(IDateField f, IColumn<?> obj) {
- if (obj instanceof IDateColumn) {
- IDateColumn col = (IDateColumn) obj;
- f.setHasTime(col.isHasTime());
- f.setFormat(col.getFormat());
- }
- }
-
- private void setupNumberField(IDoubleField f, IColumn<?> obj) {
- if (obj instanceof IDoubleColumn) {
- IDoubleColumn col = (IDoubleColumn) obj;
- f.setFormat(col.getFormat());
- f.setGroupingUsed(col.isGroupingUsed());
- f.setMaxFractionDigits(col.getMaxFractionDigits());
- f.setMinFractionDigits(col.getMinFractionDigits());
- f.setMultiplier(col.getMultiplier());
- f.setPercent(col.isPercent());
- }
- else if (obj instanceof IIntegerColumn) {
- IIntegerColumn col = (IIntegerColumn) obj;
- f.setFormat(col.getFormat());
- f.setGroupingUsed(col.isGroupingUsed());
- f.setMaxFractionDigits(0);
- f.setMinFractionDigits(0);
- }
- else if (obj instanceof ILongColumn) {
- ILongColumn col = (ILongColumn) obj;
- f.setFormat(col.getFormat());
- f.setGroupingUsed(col.isGroupingUsed());
- f.setMaxFractionDigits(0);
- f.setMinFractionDigits(0);
- }
- }
-
- @Order(10)
- public class MainBox extends AbstractGroupBox {
-
- @Override
- protected int getConfiguredGridW() {
- return 1;
- }
-
- @Order(20)
- public class ValuesBox extends AbstractGroupBox {
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("ColumnFilterValuesSection");
- }
-
- @Override
- protected int getConfiguredGridColumnCount() {
- return 1;
- }
-
- @Order(10)
- public class ButtonsSequenceBox extends AbstractSequenceBox {
- @Override
- protected boolean getConfiguredLabelVisible() {
- return false;
- }
-
- @Override
- protected boolean getConfiguredAutoCheckFromTo() {
- return false;
- }
-
- @Order(10)
- public class CheckAllButton extends AbstractLinkButton {
-
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("CheckAll");
- }
-
- @Override
- protected boolean getConfiguredProcessButton() {
- return false;
- }
-
- @Override
- protected void execClickAction() throws ProcessingException {
- for (ITableRow row : getValuesTableField().getTable().getRows()) {
- row.setChecked(true);
- }
- }
- }
-
- @Order(20)
- public class UncheckAllButton extends AbstractLinkButton {
-
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("UncheckAll");
- }
-
- @Override
- protected boolean getConfiguredProcessButton() {
- return false;
- }
-
- @Override
- protected void execClickAction() throws ProcessingException {
- for (ITableRow row : getValuesTableField().getTable().getRows()) {
- row.setChecked(false);
- }
- }
- }
- }
-
- @Order(30)
- public class ValuesTableField extends AbstractTableField<ValuesTableField.Table> {
- @Override
- protected int getConfiguredGridW() {
- return 1;
- }
-
- @Override
- protected int getConfiguredGridH() {
- return 8;
- }
-
- @Override
- protected boolean getConfiguredLabelVisible() {
- return false;
- }
-
- @Override
- protected void execReloadTableData() throws ProcessingException {
- List<LookupRow> hist = getColumnFilter().createHistogram();
- ArrayList<ITableRow> rowList = new ArrayList<ITableRow>(hist.size() + 1);
- for (LookupRow histRow : hist) {
- TableRow tableRow = new TableRow(getTable().getColumnSet(), new Object[]{histRow.getKey(), histRow.getText()});
- tableRow.setIconId(histRow.getIconId());
- tableRow.setForegroundColor(histRow.getForegroundColor());
- tableRow.setBackgroundColor(histRow.getBackgroundColor());
- tableRow.setFont(histRow.getFont());
- rowList.add(tableRow);
- }
- getTable().discardAllRows();
- getTable().addRows(rowList.toArray(new ITableRow[rowList.size()]));
- //set checks
- Set<?> selectedKeys = getColumnFilter().getSelectedValues();
- if (selectedKeys != null) {
- Table.KeyColumn keyCol = getTable().getKeyColumn();
- for (ITableRow row : getTable().getRows()) {
- if (selectedKeys.contains(keyCol.getValue(row))) {
- row.setChecked(true);
- }
- }
- }
- }
-
- public class Table extends AbstractTable {
- @Override
- protected boolean getConfiguredCheckable() {
- return true;
- }
-
- @Override
- protected boolean getConfiguredHeaderVisible() {
- return false;
- }
-
- @Override
- protected boolean getConfiguredAutoResizeColumns() {
- return true;
- }
-
- public KeyColumn getKeyColumn() {
- return getColumnSet().getColumnByClass(KeyColumn.class);
- }
-
- public TextColumn getTextColumn() {
- return getColumnSet().getColumnByClass(TextColumn.class);
- }
-
- @Order(10)
- public class KeyColumn extends AbstractObjectColumn {
-
- @Override
- protected boolean getConfiguredDisplayable() {
- return false;
- }
-
- @Override
- protected boolean getConfiguredPrimaryKey() {
- return true;
- }
- }
-
- @Order(20)
- public class TextColumn extends AbstractStringColumn {
- @Override
- protected String getConfiguredHeaderText() {
- return ScoutTexts.get("ColumnValues");
- }
-
- @Override
- protected int getConfiguredHorizontalAlignment() {
- return -1;
- }
-
- @Override
- protected int getConfiguredWidth() {
- return 200;
- }
- }
-
- }
- }
- }
-
- @Order(30)
- public class StringDetailBox extends AbstractGroupBox {
-
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("ColumnFilterStringSection");
- }
-
- @Override
- protected boolean getConfiguredVisible() {
- return false;
- }
-
- @Override
- protected int getConfiguredGridColumnCount() {
- return 1;
- }
-
- @Order(10)
- public class PatternField extends AbstractStringField {
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("StringPattern");
- }
-
- @Override
- protected boolean getConfiguredLabelVisible() {
- return false;
- }
-
- @Override
- public boolean isSpellCheckEnabled() {
- return false;
- }
- }
- }
-
- @Order(40)
- public class DateDetailBox extends AbstractGroupBox {
-
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("ColumnFilterDateSection");
- }
-
- @Override
- protected boolean getConfiguredVisible() {
- return false;
- }
-
- @Order(10)
- public class DateSequenceBox extends AbstractSequenceBox {
- @Override
- protected boolean getConfiguredLabelVisible() {
- return false;
- }
-
- @Order(10)
- public class DateFromField extends AbstractDateField {
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("from");
- }
- }
-
- @Order(20)
- public class DateToField extends AbstractDateField {
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("to");
- }
- }
- }
- }
-
- @Order(40)
- public class NumberDetailBox extends AbstractGroupBox {
-
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("ColumnFilterNumberSection");
- }
-
- @Override
- protected boolean getConfiguredVisible() {
- return false;
- }
-
- @Order(10)
- public class NumberSequenceBox extends AbstractSequenceBox {
- @Override
- protected boolean getConfiguredLabelVisible() {
- return false;
- }
-
- @Order(10)
- public class NumberFromField extends AbstractDoubleField {
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("from");
- }
- }
-
- @Order(20)
- public class NumberToField extends AbstractDoubleField {
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("to");
- }
- }
- }
- }
-
- /**
- * Button "ok"
- */
- @Order(100)
- public class OkButton extends AbstractOkButton {
- }
-
- /**
- * Button "close"
- */
- @Order(110)
- public class CloseButton extends AbstractCloseButton {
- }
-
- /**
- * Button "reset"
- */
- @Order(120)
- public class RemoveButton extends AbstractButton {
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("ColumnFilterRemoveButton");
- }
-
- @Override
- protected void execClickAction() throws ProcessingException {
- for (ITableRow r : getValuesTableField().getTable().getRows()) {
- r.setChecked(false);
- }
- for (IFormField f : getAllFields()) {
- if (f instanceof IValueField<?>) {
- ((IValueField<?>) f).setValue(null);
- }
- }
- doOk();
- }
- }
-
- }
-
- /**
- * Handler for "Modify"
- */
- public class ModifyHandler extends AbstractFormHandler {
-
- @Override
- protected void execLoad() throws ProcessingException {
- setTitle(getColumnFilter().getColumn().getHeaderCell().getText());
- getValuesTableField().reloadTableData();
- //
- if (getColumnFilter() instanceof StringColumnFilter) {
- StringColumnFilter filter = (StringColumnFilter) getColumnFilter();
- getStringDetailBox().setVisible(true);
- getPatternField().setValue(filter.getPattern());
- }
- else if (getColumnFilter() instanceof ComparableColumnFilter) {
- ComparableColumnFilter filter = (ComparableColumnFilter) getColumnFilter();
- Class dataType = filter.getColumn().getDataType();
- if (Date.class.isAssignableFrom(dataType)) {
- getDateDetailBox().setVisible(true);
- setupDateField(getDateFromField(), getColumnFilter().getColumn());
- setupDateField(getDateToField(), getColumnFilter().getColumn());
- getDateFromField().setValue((Date) filter.getMinimumValue());
- getDateToField().setValue((Date) filter.getMaximumValue());
- }
- else if (Number.class.isAssignableFrom(dataType)) {
- getNumberDetailBox().setVisible(true);
- setupNumberField(getNumberFromField(), getColumnFilter().getColumn());
- setupNumberField(getNumberToField(), getColumnFilter().getColumn());
- getNumberFromField().setValue(TypeCastUtility.castValue(filter.getMinimumValue(), Double.class));
- getNumberToField().setValue(TypeCastUtility.castValue(filter.getMaximumValue(), Double.class));
- }
- }
- }
-
- @Override
- protected void execPostLoad() throws ProcessingException {
- touch();
- }
-
- @SuppressWarnings("unchecked")
- @Override
- protected void execStore() throws ProcessingException {
- Object[] checkedKeys = getValuesTableField().getTable().getKeyColumn().getValues(getValuesTableField().getTable().getCheckedRows());
- if (checkedKeys.length > 0) {
- getColumnFilter().setSelectedValues(new HashSet(Arrays.asList(checkedKeys)));
- }
- else {
- getColumnFilter().setSelectedValues(null);
- }
- //
- if (getColumnFilter() instanceof StringColumnFilter) {
- StringColumnFilter filter = (StringColumnFilter) getColumnFilter();
- filter.setPattern(getPatternField().getValue());
- }
- else if (getColumnFilter() instanceof ComparableColumnFilter) {
- ComparableColumnFilter filter = (ComparableColumnFilter) getColumnFilter();
- Class dataType = filter.getColumn().getDataType();
- if (Date.class.isAssignableFrom(dataType)) {
- filter.setMinimumValue(getDateFromField().getValue());
- filter.setMaximumValue(getDateToField().getValue());
- }
- else if (Number.class.isAssignableFrom(dataType)) {
- filter.setMinimumValue((Comparable) TypeCastUtility.castValue(getNumberFromField().getValue(), dataType));
- filter.setMaximumValue((Comparable) TypeCastUtility.castValue(getNumberToField().getValue(), dataType));
- }
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table.columnfilter;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.scout.commons.TypeCastUtility;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.basic.table.AbstractTable;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.client.ui.basic.table.TableRow;
+import org.eclipse.scout.rt.client.ui.basic.table.columnfilter.ColumnFilterForm.MainBox.CloseButton;
+import org.eclipse.scout.rt.client.ui.basic.table.columnfilter.ColumnFilterForm.MainBox.DateDetailBox;
+import org.eclipse.scout.rt.client.ui.basic.table.columnfilter.ColumnFilterForm.MainBox.DateDetailBox.DateSequenceBox.DateFromField;
+import org.eclipse.scout.rt.client.ui.basic.table.columnfilter.ColumnFilterForm.MainBox.DateDetailBox.DateSequenceBox.DateToField;
+import org.eclipse.scout.rt.client.ui.basic.table.columnfilter.ColumnFilterForm.MainBox.NumberDetailBox;
+import org.eclipse.scout.rt.client.ui.basic.table.columnfilter.ColumnFilterForm.MainBox.NumberDetailBox.NumberSequenceBox.NumberFromField;
+import org.eclipse.scout.rt.client.ui.basic.table.columnfilter.ColumnFilterForm.MainBox.NumberDetailBox.NumberSequenceBox.NumberToField;
+import org.eclipse.scout.rt.client.ui.basic.table.columnfilter.ColumnFilterForm.MainBox.OkButton;
+import org.eclipse.scout.rt.client.ui.basic.table.columnfilter.ColumnFilterForm.MainBox.StringDetailBox;
+import org.eclipse.scout.rt.client.ui.basic.table.columnfilter.ColumnFilterForm.MainBox.StringDetailBox.PatternField;
+import org.eclipse.scout.rt.client.ui.basic.table.columnfilter.ColumnFilterForm.MainBox.ValuesBox.ValuesTableField;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractObjectColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractStringColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IDateColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IDoubleColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IIntegerColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.ILongColumn;
+import org.eclipse.scout.rt.client.ui.form.AbstractForm;
+import org.eclipse.scout.rt.client.ui.form.AbstractFormHandler;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
+import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractButton;
+import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractCloseButton;
+import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractLinkButton;
+import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractOkButton;
+import org.eclipse.scout.rt.client.ui.form.fields.datefield.AbstractDateField;
+import org.eclipse.scout.rt.client.ui.form.fields.datefield.IDateField;
+import org.eclipse.scout.rt.client.ui.form.fields.doublefield.AbstractDoubleField;
+import org.eclipse.scout.rt.client.ui.form.fields.doublefield.IDoubleField;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
+import org.eclipse.scout.rt.client.ui.form.fields.sequencebox.AbstractSequenceBox;
+import org.eclipse.scout.rt.client.ui.form.fields.stringfield.AbstractStringField;
+import org.eclipse.scout.rt.client.ui.form.fields.tablefield.AbstractTableField;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
+
+public class ColumnFilterForm extends AbstractForm {
+ private ITableColumnFilter<?> m_columnFilter;
+
+ public ColumnFilterForm() throws ProcessingException {
+ }
+
+ @Override
+ protected String getConfiguredTitle() {
+ return ScoutTexts.get("ColumnFilter");
+ }
+
+ @Override
+ protected boolean getConfiguredModal() {
+ return true;
+ }
+
+ public ITableColumnFilter<?> getColumnFilter() {
+ return m_columnFilter;
+ }
+
+ public void setColumnFilter(ITableColumnFilter<?> columnFilter) {
+ m_columnFilter = columnFilter;
+ }
+
+ public MainBox getMainBox() {
+ return (MainBox) getRootGroupBox();
+ }
+
+ public ValuesTableField getValuesTableField() {
+ return getFieldByClass(ValuesTableField.class);
+ }
+
+ public StringDetailBox getStringDetailBox() {
+ return getFieldByClass(StringDetailBox.class);
+ }
+
+ public PatternField getPatternField() {
+ return getFieldByClass(PatternField.class);
+ }
+
+ public DateDetailBox getDateDetailBox() {
+ return getFieldByClass(DateDetailBox.class);
+ }
+
+ public DateFromField getDateFromField() {
+ return getFieldByClass(DateFromField.class);
+ }
+
+ public DateToField getDateToField() {
+ return getFieldByClass(DateToField.class);
+ }
+
+ public NumberDetailBox getNumberDetailBox() {
+ return getFieldByClass(NumberDetailBox.class);
+ }
+
+ public NumberFromField getNumberFromField() {
+ return getFieldByClass(NumberFromField.class);
+ }
+
+ public NumberToField getNumberToField() {
+ return getFieldByClass(NumberToField.class);
+ }
+
+ public OkButton getOkButton() {
+ return getFieldByClass(OkButton.class);
+ }
+
+ public CloseButton getCloseButton() {
+ return getFieldByClass(CloseButton.class);
+ }
+
+ public void startModify() throws ProcessingException {
+ startInternal(new ModifyHandler());
+ }
+
+ private void setupDateField(IDateField f, IColumn<?> obj) {
+ if (obj instanceof IDateColumn) {
+ IDateColumn col = (IDateColumn) obj;
+ f.setHasTime(col.isHasTime());
+ f.setFormat(col.getFormat());
+ }
+ }
+
+ private void setupNumberField(IDoubleField f, IColumn<?> obj) {
+ if (obj instanceof IDoubleColumn) {
+ IDoubleColumn col = (IDoubleColumn) obj;
+ f.setFormat(col.getFormat());
+ f.setGroupingUsed(col.isGroupingUsed());
+ f.setMaxFractionDigits(col.getMaxFractionDigits());
+ f.setMinFractionDigits(col.getMinFractionDigits());
+ f.setMultiplier(col.getMultiplier());
+ f.setPercent(col.isPercent());
+ }
+ else if (obj instanceof IIntegerColumn) {
+ IIntegerColumn col = (IIntegerColumn) obj;
+ f.setFormat(col.getFormat());
+ f.setGroupingUsed(col.isGroupingUsed());
+ f.setMaxFractionDigits(0);
+ f.setMinFractionDigits(0);
+ }
+ else if (obj instanceof ILongColumn) {
+ ILongColumn col = (ILongColumn) obj;
+ f.setFormat(col.getFormat());
+ f.setGroupingUsed(col.isGroupingUsed());
+ f.setMaxFractionDigits(0);
+ f.setMinFractionDigits(0);
+ }
+ }
+
+ @Order(10)
+ public class MainBox extends AbstractGroupBox {
+
+ @Override
+ protected int getConfiguredGridW() {
+ return 1;
+ }
+
+ @Order(20)
+ public class ValuesBox extends AbstractGroupBox {
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("ColumnFilterValuesSection");
+ }
+
+ @Override
+ protected int getConfiguredGridColumnCount() {
+ return 1;
+ }
+
+ @Order(10)
+ public class ButtonsSequenceBox extends AbstractSequenceBox {
+ @Override
+ protected boolean getConfiguredLabelVisible() {
+ return false;
+ }
+
+ @Override
+ protected boolean getConfiguredAutoCheckFromTo() {
+ return false;
+ }
+
+ @Order(10)
+ public class CheckAllButton extends AbstractLinkButton {
+
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("CheckAll");
+ }
+
+ @Override
+ protected boolean getConfiguredProcessButton() {
+ return false;
+ }
+
+ @Override
+ protected void execClickAction() throws ProcessingException {
+ for (ITableRow row : getValuesTableField().getTable().getRows()) {
+ row.setChecked(true);
+ }
+ }
+ }
+
+ @Order(20)
+ public class UncheckAllButton extends AbstractLinkButton {
+
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("UncheckAll");
+ }
+
+ @Override
+ protected boolean getConfiguredProcessButton() {
+ return false;
+ }
+
+ @Override
+ protected void execClickAction() throws ProcessingException {
+ for (ITableRow row : getValuesTableField().getTable().getRows()) {
+ row.setChecked(false);
+ }
+ }
+ }
+ }
+
+ @Order(30)
+ public class ValuesTableField extends AbstractTableField<ValuesTableField.Table> {
+ @Override
+ protected int getConfiguredGridW() {
+ return 1;
+ }
+
+ @Override
+ protected int getConfiguredGridH() {
+ return 8;
+ }
+
+ @Override
+ protected boolean getConfiguredLabelVisible() {
+ return false;
+ }
+
+ @Override
+ protected void execReloadTableData() throws ProcessingException {
+ List<LookupRow> hist = getColumnFilter().createHistogram();
+ ArrayList<ITableRow> rowList = new ArrayList<ITableRow>(hist.size() + 1);
+ for (LookupRow histRow : hist) {
+ TableRow tableRow = new TableRow(getTable().getColumnSet(), new Object[]{histRow.getKey(), histRow.getText()});
+ tableRow.setIconId(histRow.getIconId());
+ tableRow.setForegroundColor(histRow.getForegroundColor());
+ tableRow.setBackgroundColor(histRow.getBackgroundColor());
+ tableRow.setFont(histRow.getFont());
+ rowList.add(tableRow);
+ }
+ getTable().discardAllRows();
+ getTable().addRows(rowList.toArray(new ITableRow[rowList.size()]));
+ //set checks
+ Set<?> selectedKeys = getColumnFilter().getSelectedValues();
+ if (selectedKeys != null) {
+ Table.KeyColumn keyCol = getTable().getKeyColumn();
+ for (ITableRow row : getTable().getRows()) {
+ if (selectedKeys.contains(keyCol.getValue(row))) {
+ row.setChecked(true);
+ }
+ }
+ }
+ }
+
+ public class Table extends AbstractTable {
+ @Override
+ protected boolean getConfiguredCheckable() {
+ return true;
+ }
+
+ @Override
+ protected boolean getConfiguredHeaderVisible() {
+ return false;
+ }
+
+ @Override
+ protected boolean getConfiguredAutoResizeColumns() {
+ return true;
+ }
+
+ public KeyColumn getKeyColumn() {
+ return getColumnSet().getColumnByClass(KeyColumn.class);
+ }
+
+ public TextColumn getTextColumn() {
+ return getColumnSet().getColumnByClass(TextColumn.class);
+ }
+
+ @Order(10)
+ public class KeyColumn extends AbstractObjectColumn {
+
+ @Override
+ protected boolean getConfiguredDisplayable() {
+ return false;
+ }
+
+ @Override
+ protected boolean getConfiguredPrimaryKey() {
+ return true;
+ }
+ }
+
+ @Order(20)
+ public class TextColumn extends AbstractStringColumn {
+ @Override
+ protected String getConfiguredHeaderText() {
+ return ScoutTexts.get("ColumnValues");
+ }
+
+ @Override
+ protected int getConfiguredHorizontalAlignment() {
+ return -1;
+ }
+
+ @Override
+ protected int getConfiguredWidth() {
+ return 200;
+ }
+ }
+
+ }
+ }
+ }
+
+ @Order(30)
+ public class StringDetailBox extends AbstractGroupBox {
+
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("ColumnFilterStringSection");
+ }
+
+ @Override
+ protected boolean getConfiguredVisible() {
+ return false;
+ }
+
+ @Override
+ protected int getConfiguredGridColumnCount() {
+ return 1;
+ }
+
+ @Order(10)
+ public class PatternField extends AbstractStringField {
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("StringPattern");
+ }
+
+ @Override
+ protected boolean getConfiguredLabelVisible() {
+ return false;
+ }
+
+ @Override
+ public boolean isSpellCheckEnabled() {
+ return false;
+ }
+ }
+ }
+
+ @Order(40)
+ public class DateDetailBox extends AbstractGroupBox {
+
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("ColumnFilterDateSection");
+ }
+
+ @Override
+ protected boolean getConfiguredVisible() {
+ return false;
+ }
+
+ @Order(10)
+ public class DateSequenceBox extends AbstractSequenceBox {
+ @Override
+ protected boolean getConfiguredLabelVisible() {
+ return false;
+ }
+
+ @Order(10)
+ public class DateFromField extends AbstractDateField {
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("from");
+ }
+ }
+
+ @Order(20)
+ public class DateToField extends AbstractDateField {
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("to");
+ }
+ }
+ }
+ }
+
+ @Order(40)
+ public class NumberDetailBox extends AbstractGroupBox {
+
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("ColumnFilterNumberSection");
+ }
+
+ @Override
+ protected boolean getConfiguredVisible() {
+ return false;
+ }
+
+ @Order(10)
+ public class NumberSequenceBox extends AbstractSequenceBox {
+ @Override
+ protected boolean getConfiguredLabelVisible() {
+ return false;
+ }
+
+ @Order(10)
+ public class NumberFromField extends AbstractDoubleField {
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("from");
+ }
+ }
+
+ @Order(20)
+ public class NumberToField extends AbstractDoubleField {
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("to");
+ }
+ }
+ }
+ }
+
+ /**
+ * Button "ok"
+ */
+ @Order(100)
+ public class OkButton extends AbstractOkButton {
+ }
+
+ /**
+ * Button "close"
+ */
+ @Order(110)
+ public class CloseButton extends AbstractCloseButton {
+ }
+
+ /**
+ * Button "reset"
+ */
+ @Order(120)
+ public class RemoveButton extends AbstractButton {
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("ColumnFilterRemoveButton");
+ }
+
+ @Override
+ protected void execClickAction() throws ProcessingException {
+ for (ITableRow r : getValuesTableField().getTable().getRows()) {
+ r.setChecked(false);
+ }
+ for (IFormField f : getAllFields()) {
+ if (f instanceof IValueField<?>) {
+ ((IValueField<?>) f).setValue(null);
+ }
+ }
+ doOk();
+ }
+ }
+
+ }
+
+ /**
+ * Handler for "Modify"
+ */
+ public class ModifyHandler extends AbstractFormHandler {
+
+ @Override
+ protected void execLoad() throws ProcessingException {
+ setTitle(getColumnFilter().getColumn().getHeaderCell().getText());
+ getValuesTableField().reloadTableData();
+ //
+ if (getColumnFilter() instanceof StringColumnFilter) {
+ StringColumnFilter filter = (StringColumnFilter) getColumnFilter();
+ getStringDetailBox().setVisible(true);
+ getPatternField().setValue(filter.getPattern());
+ }
+ else if (getColumnFilter() instanceof ComparableColumnFilter) {
+ ComparableColumnFilter filter = (ComparableColumnFilter) getColumnFilter();
+ Class dataType = filter.getColumn().getDataType();
+ if (Date.class.isAssignableFrom(dataType)) {
+ getDateDetailBox().setVisible(true);
+ setupDateField(getDateFromField(), getColumnFilter().getColumn());
+ setupDateField(getDateToField(), getColumnFilter().getColumn());
+ getDateFromField().setValue((Date) filter.getMinimumValue());
+ getDateToField().setValue((Date) filter.getMaximumValue());
+ }
+ else if (Number.class.isAssignableFrom(dataType)) {
+ getNumberDetailBox().setVisible(true);
+ setupNumberField(getNumberFromField(), getColumnFilter().getColumn());
+ setupNumberField(getNumberToField(), getColumnFilter().getColumn());
+ getNumberFromField().setValue(TypeCastUtility.castValue(filter.getMinimumValue(), Double.class));
+ getNumberToField().setValue(TypeCastUtility.castValue(filter.getMaximumValue(), Double.class));
+ }
+ }
+ }
+
+ @Override
+ protected void execPostLoad() throws ProcessingException {
+ touch();
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ protected void execStore() throws ProcessingException {
+ Object[] checkedKeys = getValuesTableField().getTable().getKeyColumn().getValues(getValuesTableField().getTable().getCheckedRows());
+ if (checkedKeys.length > 0) {
+ getColumnFilter().setSelectedValues(new HashSet(Arrays.asList(checkedKeys)));
+ }
+ else {
+ getColumnFilter().setSelectedValues(null);
+ }
+ //
+ if (getColumnFilter() instanceof StringColumnFilter) {
+ StringColumnFilter filter = (StringColumnFilter) getColumnFilter();
+ filter.setPattern(getPatternField().getValue());
+ }
+ else if (getColumnFilter() instanceof ComparableColumnFilter) {
+ ComparableColumnFilter filter = (ComparableColumnFilter) getColumnFilter();
+ Class dataType = filter.getColumn().getDataType();
+ if (Date.class.isAssignableFrom(dataType)) {
+ filter.setMinimumValue(getDateFromField().getValue());
+ filter.setMaximumValue(getDateToField().getValue());
+ }
+ else if (Number.class.isAssignableFrom(dataType)) {
+ filter.setMinimumValue((Comparable) TypeCastUtility.castValue(getNumberFromField().getValue(), dataType));
+ filter.setMaximumValue((Comparable) TypeCastUtility.castValue(getNumberToField().getValue(), dataType));
+ }
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columnfilter/ColumnFilterMenu.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columnfilter/ColumnFilterMenu.java
index c91cdabf21..64204c6a84 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columnfilter/ColumnFilterMenu.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columnfilter/ColumnFilterMenu.java
@@ -1,47 +1,47 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table.columnfilter;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-
-public class ColumnFilterMenu extends AbstractMenu {
- private final ITable m_table;
-
- public ColumnFilterMenu(ITable table) {
- m_table = table;
- }
-
- @Override
- protected String getConfiguredText() {
- return ScoutTexts.get("ColumnFilterMenu");
- }
-
- @Override
- protected void execPrepareAction() throws ProcessingException {
- setVisible(m_table != null && m_table.getColumnFilterManager() != null && m_table.getContextColumn() != null);
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- if (m_table != null) {
- if (m_table.getColumnFilterManager() != null) {
- IColumn<?> col = m_table.getContextColumn();
- if (col != null) {
- m_table.getColumnFilterManager().showFilterForm(col, true);
- }
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table.columnfilter;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+
+public class ColumnFilterMenu extends AbstractMenu {
+ private final ITable m_table;
+
+ public ColumnFilterMenu(ITable table) {
+ m_table = table;
+ }
+
+ @Override
+ protected String getConfiguredText() {
+ return ScoutTexts.get("ColumnFilterMenu");
+ }
+
+ @Override
+ protected void execPrepareAction() throws ProcessingException {
+ setVisible(m_table != null && m_table.getColumnFilterManager() != null && m_table.getContextColumn() != null);
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ if (m_table != null) {
+ if (m_table.getColumnFilterManager() != null) {
+ IColumn<?> col = m_table.getContextColumn();
+ if (col != null) {
+ m_table.getColumnFilterManager().showFilterForm(col, true);
+ }
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columnfilter/ComparableColumnFilter.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columnfilter/ComparableColumnFilter.java
index 3f07e68f35..6ff794133e 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columnfilter/ComparableColumnFilter.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columnfilter/ComparableColumnFilter.java
@@ -1,139 +1,139 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table.columnfilter;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeMap;
-
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.data.basic.FontSpec;
-import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
-
-/**
- *
- */
-public class ComparableColumnFilter<T extends Comparable<T>> implements ITableColumnFilter<T>, Serializable {
- private static final long serialVersionUID = 1L;
- private IColumn<T> m_column;
- private Set<T> m_selectedValues;
- private T m_minimumValue;
- private T m_maximumValue;
-
- public ComparableColumnFilter(IColumn<T> column) {
- m_column = column;
- }
-
- @Override
- public IColumn<T> getColumn() {
- return m_column;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public void setColumn(IColumn column) {
- m_column = column;
- }
-
- @Override
- public Set<T> getSelectedValues() {
- return m_selectedValues;
- }
-
- @Override
- public void setSelectedValues(Set<T> set) {
- m_selectedValues = set;
- }
-
- public T getMinimumValue() {
- return m_minimumValue;
- }
-
- public void setMinimumValue(T minimumValue) {
- m_minimumValue = minimumValue;
- }
-
- public T getMaximumValue() {
- return m_maximumValue;
- }
-
- public void setMaximumValue(T maximumValue) {
- m_maximumValue = maximumValue;
- }
-
- @Override
- public List<LookupRow> createHistogram() {
- TreeMap<T, LookupRow> hist = new TreeMap<T, LookupRow>();
- HashMap<T, Integer> countMap = new HashMap<T, Integer>();
- for (ITableRow row : m_column.getTable().getRows()) {
- T key = m_column.getValue(row);
- String text = m_column.getDisplayText(row);
- if (key != null && !hist.containsKey(key)) {
- FontSpec font = (row.isFilterAccepted() ? null : FontSpec.parse("italic"));
- hist.put(key, new LookupRow(key, text, null, null, null, null, font));
- }
- Integer count = countMap.get(key);
- countMap.put(key, count != null ? count + 1 : 1);
- }
- for (Map.Entry<T, LookupRow> e : hist.entrySet()) {
- Integer count = countMap.get(e.getKey());
- if (count != null && count > 1) {
- LookupRow row = e.getValue();
- row.setText(row.getText() + " (" + count + ")");
- }
- }
- ArrayList<LookupRow> list = new ArrayList<LookupRow>();
- list.addAll(hist.values());
- //
- Integer nullCount = countMap.get(null);
- list.add(new LookupRow(null, "(" + ScoutTexts.get("ColumnFilterNullText") + ")" + (nullCount != null && nullCount > 1 ? " (" + nullCount + ")" : "")));
- return list;
- }
-
- @Override
- public boolean isEmpty() {
- return (m_selectedValues == null || m_selectedValues.isEmpty()) && m_minimumValue == null && m_maximumValue == null;
- }
-
- @Override
- public boolean accept(ITableRow row) {
- T value = m_column.getValue(row);
- if (m_minimumValue != null) {
- if (value == null) {
- return false;
- }
- if (value.compareTo(m_minimumValue) < 0) {
- return false;
- }
- }
- if (m_maximumValue != null) {
- if (value == null) {
- return false;
- }
- if (value.compareTo(m_maximumValue) > 0) {
- return false;
- }
- }
- if (m_selectedValues != null) {
- if (!m_selectedValues.contains(value)) {
- return false;
- }
- }
- return true;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table.columnfilter;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.data.basic.FontSpec;
+import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
+
+/**
+ *
+ */
+public class ComparableColumnFilter<T extends Comparable<T>> implements ITableColumnFilter<T>, Serializable {
+ private static final long serialVersionUID = 1L;
+ private IColumn<T> m_column;
+ private Set<T> m_selectedValues;
+ private T m_minimumValue;
+ private T m_maximumValue;
+
+ public ComparableColumnFilter(IColumn<T> column) {
+ m_column = column;
+ }
+
+ @Override
+ public IColumn<T> getColumn() {
+ return m_column;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public void setColumn(IColumn column) {
+ m_column = column;
+ }
+
+ @Override
+ public Set<T> getSelectedValues() {
+ return m_selectedValues;
+ }
+
+ @Override
+ public void setSelectedValues(Set<T> set) {
+ m_selectedValues = set;
+ }
+
+ public T getMinimumValue() {
+ return m_minimumValue;
+ }
+
+ public void setMinimumValue(T minimumValue) {
+ m_minimumValue = minimumValue;
+ }
+
+ public T getMaximumValue() {
+ return m_maximumValue;
+ }
+
+ public void setMaximumValue(T maximumValue) {
+ m_maximumValue = maximumValue;
+ }
+
+ @Override
+ public List<LookupRow> createHistogram() {
+ TreeMap<T, LookupRow> hist = new TreeMap<T, LookupRow>();
+ HashMap<T, Integer> countMap = new HashMap<T, Integer>();
+ for (ITableRow row : m_column.getTable().getRows()) {
+ T key = m_column.getValue(row);
+ String text = m_column.getDisplayText(row);
+ if (key != null && !hist.containsKey(key)) {
+ FontSpec font = (row.isFilterAccepted() ? null : FontSpec.parse("italic"));
+ hist.put(key, new LookupRow(key, text, null, null, null, null, font));
+ }
+ Integer count = countMap.get(key);
+ countMap.put(key, count != null ? count + 1 : 1);
+ }
+ for (Map.Entry<T, LookupRow> e : hist.entrySet()) {
+ Integer count = countMap.get(e.getKey());
+ if (count != null && count > 1) {
+ LookupRow row = e.getValue();
+ row.setText(row.getText() + " (" + count + ")");
+ }
+ }
+ ArrayList<LookupRow> list = new ArrayList<LookupRow>();
+ list.addAll(hist.values());
+ //
+ Integer nullCount = countMap.get(null);
+ list.add(new LookupRow(null, "(" + ScoutTexts.get("ColumnFilterNullText") + ")" + (nullCount != null && nullCount > 1 ? " (" + nullCount + ")" : "")));
+ return list;
+ }
+
+ @Override
+ public boolean isEmpty() {
+ return (m_selectedValues == null || m_selectedValues.isEmpty()) && m_minimumValue == null && m_maximumValue == null;
+ }
+
+ @Override
+ public boolean accept(ITableRow row) {
+ T value = m_column.getValue(row);
+ if (m_minimumValue != null) {
+ if (value == null) {
+ return false;
+ }
+ if (value.compareTo(m_minimumValue) < 0) {
+ return false;
+ }
+ }
+ if (m_maximumValue != null) {
+ if (value == null) {
+ return false;
+ }
+ if (value.compareTo(m_maximumValue) > 0) {
+ return false;
+ }
+ }
+ if (m_selectedValues != null) {
+ if (!m_selectedValues.contains(value)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columnfilter/DefaultTableColumnFilterManager.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columnfilter/DefaultTableColumnFilterManager.java
index 20b2746aa4..59918851b6 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columnfilter/DefaultTableColumnFilterManager.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columnfilter/DefaultTableColumnFilterManager.java
@@ -1,303 +1,303 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table.columnfilter;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.scout.commons.EventListenerList;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.commons.osgi.BundleObjectInputStream;
-import org.eclipse.scout.commons.osgi.BundleObjectOutputStream;
-import org.eclipse.scout.rt.client.Activator;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRowFilter;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.ISmartColumn;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.osgi.framework.Bundle;
-
-/**
- * Default implementation for {@link ITableColumnFilterManager}
- */
-public class DefaultTableColumnFilterManager implements ITableColumnFilterManager, ITableRowFilter {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(DefaultTableColumnFilterManager.class);
-
- private final ITable m_table;
- private final Map<IColumn, ITableColumnFilter> m_filterMap;
- private final EventListenerList m_listenerList;
- private boolean m_enabled;
-
- public DefaultTableColumnFilterManager(ITable table) {
- m_table = table;
- m_filterMap = Collections.synchronizedMap(new HashMap<IColumn, ITableColumnFilter>());
- m_listenerList = new EventListenerList();
- setEnabled(true);
- }
-
- @Override
- public boolean isEnabled() {
- return m_enabled;
- }
-
- @Override
- public void setEnabled(boolean enabled) {
- if (m_enabled != enabled) {
- m_enabled = enabled;
- m_table.removeRowFilter(this);
- if (m_enabled) {
- m_table.addRowFilter(this);
- }
- }
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public <T> ITableColumnFilter<T> getFilter(IColumn<T> col) {
- return m_filterMap.get(col);
- }
-
- @Override
- public void reset() throws ProcessingException {
- try {
- m_table.setTableChanging(true);
- //
- for (IColumn col : m_filterMap.keySet()) {
- m_table.getColumnSet().updateColumn(col);
- }
- m_filterMap.clear();
- m_table.applyRowFilters();
- fireFiltersReset();
- }
- finally {
- m_table.setTableChanging(false);
- }
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public void showFilterForm(IColumn col, boolean showAsPopupDialog) throws ProcessingException {
- ITableColumnFilter<?> filter = m_filterMap.get(col);
- boolean created = false;
- if (filter == null) {
- created = true;
- if (col instanceof ISmartColumn<?>) {
- filter = new StringColumnFilter(col);
- }
- else if (String.class.isAssignableFrom(col.getDataType())) {
- filter = new StringColumnFilter(col);
- }
- else if (Boolean.class.isAssignableFrom(col.getDataType())) {
- filter = new BooleanColumnFilter(col);
- }
- else if (Comparable.class.isAssignableFrom(col.getDataType())) {
- filter = new ComparableColumnFilter(col);
- }
- }
- if (filter != null) {
- ColumnFilterForm f = new ColumnFilterForm();
- if (showAsPopupDialog) {
- f.setDisplayHint(IForm.DISPLAY_HINT_POPUP_DIALOG);
- }
- f.setModal(true);
- f.setColumnFilter(filter);
- f.startModify();
- f.waitFor();
- if (f.isFormStored()) {
- if (filter.isEmpty()) {
- m_filterMap.remove(col);
- if (!created) {
- fireFilterRemoved(col);
- }
- }
- else {
- m_filterMap.put(col, filter);
- if (created) {
- fireFilterAdded(col);
- }
- else {
- fireFilterChanged(col);
- }
- }
- m_table.getColumnSet().updateColumn(col);
- m_table.applyRowFilters();
- }
- }
- }
-
- @Override
- public boolean accept(ITableRow row) {
- for (ITableColumnFilter f : m_filterMap.values()) {
- if (!f.accept(row)) {
- return false;
- }
- }
- return true;
- }
-
- @Override
- public List<String> getDisplayTexts() {
- ArrayList<String> list = new ArrayList<String>();
- for (ITableColumnFilter<?> filter : m_filterMap.values()) {
- if (filter != null && !filter.isEmpty()) {
- list.add(ScoutTexts.get("Column") + " \"" + filter.getColumn().getHeaderCell().getText() + "\"");
- }
- }
- return list;
- }
-
- @Override
- public Collection<ITableColumnFilter> getFilters() {
- return m_filterMap.values();
- }
-
- @Override
- public void refresh() {
- Collection<ITableColumnFilter> data = new ArrayList<ITableColumnFilter>();
- data.addAll(m_filterMap.values());
- m_filterMap.clear();
- for (ITableColumnFilter filter : data) {
- m_filterMap.put(filter.getColumn(), filter);
- m_table.getColumnSet().updateColumn(filter.getColumn());
- }
- m_table.applyRowFilters();
- }
-
- @Override
- public byte[] getSerializedFilter(IColumn col) {
- ITableColumnFilter filter = m_filterMap.get(col);
- if (filter != null) {
- ObjectOutputStream out = null;
- ByteArrayOutputStream serialData = new ByteArrayOutputStream();
- try {
- out = new BundleObjectOutputStream(serialData);
- filter.setColumn(null);
- out.writeObject(filter);
- out.close();
- out = null;
- }
- catch (Throwable t) {
- LOG.error("Failed storing filter data for " + t);
- }
- finally {
- if (out != null) {
- try {
- out.close();
- }
- catch (Throwable t) {
- LOG.error("Failed closing ObjectOutputStream");
- }
- }
- filter.setColumn(col);
- }
- return serialData.toByteArray();
- }
- return null;
- }
-
- @Override
- public void setSerializedFilter(byte[] filterData, IColumn col) {
- ObjectInputStream in = null;
- try {
- in = new BundleObjectInputStream(new ByteArrayInputStream(filterData), new Bundle[]{Activator.getDefault().getBundle()});
- Object customizerData = in.readObject();
- in.close();
- in = null;
- ITableColumnFilter filter = (ITableColumnFilter) customizerData;
- if (col != null) {
- filter.setColumn(col);
- this.m_filterMap.put(col, filter);
- }
- m_table.applyRowFilters();
- }
- catch (Throwable t) {
- LOG.error("Failed reading filter data: " + t);
- }
- finally {
- if (in != null) {
- try {
- in.close();
- }
- catch (Throwable t) {
- LOG.error("Failed closing ObjectInputStream");
- }
- }
- }
- }
-
- @Override
- public void addListener(TableColumnFilterListener listener) {
- m_listenerList.add(TableColumnFilterListener.class, listener);
- }
-
- @Override
- public void removeListener(TableColumnFilterListener listener) {
- m_listenerList.remove(TableColumnFilterListener.class, listener);
- }
-
- private void fireFilterAdded(IColumn<?> column) throws ProcessingException {
- fireFilterEvent(new TableColumnFilterEvent(m_table, TableColumnFilterEvent.TYPE_FILTER_ADDED, column));
- }
-
- private void fireFilterChanged(IColumn<?> column) throws ProcessingException {
- fireFilterEvent(new TableColumnFilterEvent(m_table, TableColumnFilterEvent.TYPE_FILTER_CHANGED, column));
- }
-
- private void fireFilterRemoved(IColumn<?> column) throws ProcessingException {
- fireFilterEvent(new TableColumnFilterEvent(m_table, TableColumnFilterEvent.TYPE_FILTER_REMOVED, column));
- }
-
- private void fireFiltersReset() {
- try {
- fireFilterEvent(new TableColumnFilterEvent(m_table, TableColumnFilterEvent.TYPE_FILTERS_RESET));
- }
- catch (ProcessingException e) {
- LOG.warn(null, e);
- }
- }
-
- private void fireFilterEvent(TableColumnFilterEvent e) throws ProcessingException {
- TableColumnFilterListener[] listeners = m_listenerList.getListeners(TableColumnFilterListener.class);
- if (listeners != null && listeners.length > 0) {
- ProcessingException pe = null;
- for (TableColumnFilterListener listener : listeners) {
- try {
- listener.tableColumnFilterChanged(e);
- }
- catch (ProcessingException ex) {
- if (pe == null) {
- pe = ex;
- }
- }
- catch (Throwable t) {
- if (pe == null) {
- pe = new ProcessingException("Unexpected", t);
- }
- }
- }
- if (pe != null) {
- throw pe;
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table.columnfilter;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.scout.commons.EventListenerList;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.commons.osgi.BundleObjectInputStream;
+import org.eclipse.scout.commons.osgi.BundleObjectOutputStream;
+import org.eclipse.scout.rt.client.Activator;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRowFilter;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.ISmartColumn;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.osgi.framework.Bundle;
+
+/**
+ * Default implementation for {@link ITableColumnFilterManager}
+ */
+public class DefaultTableColumnFilterManager implements ITableColumnFilterManager, ITableRowFilter {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(DefaultTableColumnFilterManager.class);
+
+ private final ITable m_table;
+ private final Map<IColumn, ITableColumnFilter> m_filterMap;
+ private final EventListenerList m_listenerList;
+ private boolean m_enabled;
+
+ public DefaultTableColumnFilterManager(ITable table) {
+ m_table = table;
+ m_filterMap = Collections.synchronizedMap(new HashMap<IColumn, ITableColumnFilter>());
+ m_listenerList = new EventListenerList();
+ setEnabled(true);
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return m_enabled;
+ }
+
+ @Override
+ public void setEnabled(boolean enabled) {
+ if (m_enabled != enabled) {
+ m_enabled = enabled;
+ m_table.removeRowFilter(this);
+ if (m_enabled) {
+ m_table.addRowFilter(this);
+ }
+ }
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public <T> ITableColumnFilter<T> getFilter(IColumn<T> col) {
+ return m_filterMap.get(col);
+ }
+
+ @Override
+ public void reset() throws ProcessingException {
+ try {
+ m_table.setTableChanging(true);
+ //
+ for (IColumn col : m_filterMap.keySet()) {
+ m_table.getColumnSet().updateColumn(col);
+ }
+ m_filterMap.clear();
+ m_table.applyRowFilters();
+ fireFiltersReset();
+ }
+ finally {
+ m_table.setTableChanging(false);
+ }
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public void showFilterForm(IColumn col, boolean showAsPopupDialog) throws ProcessingException {
+ ITableColumnFilter<?> filter = m_filterMap.get(col);
+ boolean created = false;
+ if (filter == null) {
+ created = true;
+ if (col instanceof ISmartColumn<?>) {
+ filter = new StringColumnFilter(col);
+ }
+ else if (String.class.isAssignableFrom(col.getDataType())) {
+ filter = new StringColumnFilter(col);
+ }
+ else if (Boolean.class.isAssignableFrom(col.getDataType())) {
+ filter = new BooleanColumnFilter(col);
+ }
+ else if (Comparable.class.isAssignableFrom(col.getDataType())) {
+ filter = new ComparableColumnFilter(col);
+ }
+ }
+ if (filter != null) {
+ ColumnFilterForm f = new ColumnFilterForm();
+ if (showAsPopupDialog) {
+ f.setDisplayHint(IForm.DISPLAY_HINT_POPUP_DIALOG);
+ }
+ f.setModal(true);
+ f.setColumnFilter(filter);
+ f.startModify();
+ f.waitFor();
+ if (f.isFormStored()) {
+ if (filter.isEmpty()) {
+ m_filterMap.remove(col);
+ if (!created) {
+ fireFilterRemoved(col);
+ }
+ }
+ else {
+ m_filterMap.put(col, filter);
+ if (created) {
+ fireFilterAdded(col);
+ }
+ else {
+ fireFilterChanged(col);
+ }
+ }
+ m_table.getColumnSet().updateColumn(col);
+ m_table.applyRowFilters();
+ }
+ }
+ }
+
+ @Override
+ public boolean accept(ITableRow row) {
+ for (ITableColumnFilter f : m_filterMap.values()) {
+ if (!f.accept(row)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ @Override
+ public List<String> getDisplayTexts() {
+ ArrayList<String> list = new ArrayList<String>();
+ for (ITableColumnFilter<?> filter : m_filterMap.values()) {
+ if (filter != null && !filter.isEmpty()) {
+ list.add(ScoutTexts.get("Column") + " \"" + filter.getColumn().getHeaderCell().getText() + "\"");
+ }
+ }
+ return list;
+ }
+
+ @Override
+ public Collection<ITableColumnFilter> getFilters() {
+ return m_filterMap.values();
+ }
+
+ @Override
+ public void refresh() {
+ Collection<ITableColumnFilter> data = new ArrayList<ITableColumnFilter>();
+ data.addAll(m_filterMap.values());
+ m_filterMap.clear();
+ for (ITableColumnFilter filter : data) {
+ m_filterMap.put(filter.getColumn(), filter);
+ m_table.getColumnSet().updateColumn(filter.getColumn());
+ }
+ m_table.applyRowFilters();
+ }
+
+ @Override
+ public byte[] getSerializedFilter(IColumn col) {
+ ITableColumnFilter filter = m_filterMap.get(col);
+ if (filter != null) {
+ ObjectOutputStream out = null;
+ ByteArrayOutputStream serialData = new ByteArrayOutputStream();
+ try {
+ out = new BundleObjectOutputStream(serialData);
+ filter.setColumn(null);
+ out.writeObject(filter);
+ out.close();
+ out = null;
+ }
+ catch (Throwable t) {
+ LOG.error("Failed storing filter data for " + t);
+ }
+ finally {
+ if (out != null) {
+ try {
+ out.close();
+ }
+ catch (Throwable t) {
+ LOG.error("Failed closing ObjectOutputStream");
+ }
+ }
+ filter.setColumn(col);
+ }
+ return serialData.toByteArray();
+ }
+ return null;
+ }
+
+ @Override
+ public void setSerializedFilter(byte[] filterData, IColumn col) {
+ ObjectInputStream in = null;
+ try {
+ in = new BundleObjectInputStream(new ByteArrayInputStream(filterData), new Bundle[]{Activator.getDefault().getBundle()});
+ Object customizerData = in.readObject();
+ in.close();
+ in = null;
+ ITableColumnFilter filter = (ITableColumnFilter) customizerData;
+ if (col != null) {
+ filter.setColumn(col);
+ this.m_filterMap.put(col, filter);
+ }
+ m_table.applyRowFilters();
+ }
+ catch (Throwable t) {
+ LOG.error("Failed reading filter data: " + t);
+ }
+ finally {
+ if (in != null) {
+ try {
+ in.close();
+ }
+ catch (Throwable t) {
+ LOG.error("Failed closing ObjectInputStream");
+ }
+ }
+ }
+ }
+
+ @Override
+ public void addListener(TableColumnFilterListener listener) {
+ m_listenerList.add(TableColumnFilterListener.class, listener);
+ }
+
+ @Override
+ public void removeListener(TableColumnFilterListener listener) {
+ m_listenerList.remove(TableColumnFilterListener.class, listener);
+ }
+
+ private void fireFilterAdded(IColumn<?> column) throws ProcessingException {
+ fireFilterEvent(new TableColumnFilterEvent(m_table, TableColumnFilterEvent.TYPE_FILTER_ADDED, column));
+ }
+
+ private void fireFilterChanged(IColumn<?> column) throws ProcessingException {
+ fireFilterEvent(new TableColumnFilterEvent(m_table, TableColumnFilterEvent.TYPE_FILTER_CHANGED, column));
+ }
+
+ private void fireFilterRemoved(IColumn<?> column) throws ProcessingException {
+ fireFilterEvent(new TableColumnFilterEvent(m_table, TableColumnFilterEvent.TYPE_FILTER_REMOVED, column));
+ }
+
+ private void fireFiltersReset() {
+ try {
+ fireFilterEvent(new TableColumnFilterEvent(m_table, TableColumnFilterEvent.TYPE_FILTERS_RESET));
+ }
+ catch (ProcessingException e) {
+ LOG.warn(null, e);
+ }
+ }
+
+ private void fireFilterEvent(TableColumnFilterEvent e) throws ProcessingException {
+ TableColumnFilterListener[] listeners = m_listenerList.getListeners(TableColumnFilterListener.class);
+ if (listeners != null && listeners.length > 0) {
+ ProcessingException pe = null;
+ for (TableColumnFilterListener listener : listeners) {
+ try {
+ listener.tableColumnFilterChanged(e);
+ }
+ catch (ProcessingException ex) {
+ if (pe == null) {
+ pe = ex;
+ }
+ }
+ catch (Throwable t) {
+ if (pe == null) {
+ pe = new ProcessingException("Unexpected", t);
+ }
+ }
+ }
+ if (pe != null) {
+ throw pe;
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columnfilter/ITableColumnFilter.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columnfilter/ITableColumnFilter.java
index d5700e73a1..816b0b4914 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columnfilter/ITableColumnFilter.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columnfilter/ITableColumnFilter.java
@@ -1,37 +1,37 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table.columnfilter;
-
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRowFilter;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
-
-/**
- * Used by {@link DefaultTableColumnFilterManager}
- */
-public interface ITableColumnFilter<T> extends ITableRowFilter {
-
- IColumn<T> getColumn();
-
- void setColumn(IColumn column);
-
- Set<T> getSelectedValues();
-
- void setSelectedValues(Set<T> set);
-
- List<LookupRow> createHistogram();
-
- boolean isEmpty();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table.columnfilter;
+
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRowFilter;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
+
+/**
+ * Used by {@link DefaultTableColumnFilterManager}
+ */
+public interface ITableColumnFilter<T> extends ITableRowFilter {
+
+ IColumn<T> getColumn();
+
+ void setColumn(IColumn column);
+
+ Set<T> getSelectedValues();
+
+ void setSelectedValues(Set<T> set);
+
+ List<LookupRow> createHistogram();
+
+ boolean isEmpty();
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columnfilter/ITableColumnFilterManager.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columnfilter/ITableColumnFilterManager.java
index b0ab3172f6..5de3b11ee5 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columnfilter/ITableColumnFilterManager.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columnfilter/ITableColumnFilterManager.java
@@ -1,81 +1,81 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table.columnfilter;
-
-import java.util.Collection;
-import java.util.List;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-
-/**
- * A handler to perform table content filtering when {@link ITable#isColumnFilterEnabled()} is activated
- */
-public interface ITableColumnFilterManager {
-
- boolean isEnabled();
-
- void setEnabled(boolean enabled);
-
- <T> ITableColumnFilter<T> getFilter(IColumn<T> col);
-
- byte[] getSerializedFilter(IColumn col);
-
- void setSerializedFilter(byte[] filterData, IColumn col);
-
- /**
- * @return a collection of all filters of all rows
- */
- Collection<ITableColumnFilter> getFilters();
-
- /**
- * clears all filters from the table, sets and applies them again
- */
- void refresh();
-
- /**
- * @return the display texts of all filters contained in the column filter manager
- */
- List<String> getDisplayTexts();
-
- /**
- * Shows a form to create or modify a column filter
- *
- * @param col
- * the filtered column
- * @param showAsPopupDialog
- * true: {@link IForm.DISPLAY_HINT_POPUP_DIALOG} will be used for display of the form
- * @throws ProcessingException
- */
- void showFilterForm(IColumn col, boolean showAsPopupDialog) throws ProcessingException;
-
- void reset() throws ProcessingException;
-
- /**
- * Adds a column filter listener.
- * <p/>
- * <b>Note:</b> The method does not check whether a listener is already in the listener list.
- *
- * @param listener
- * @since 3.8.0
- */
- void addListener(TableColumnFilterListener listener);
-
- /**
- * Removes the given table column listener.
- *
- * @param listener
- * @since 3.8.0
- */
- void removeListener(TableColumnFilterListener listener);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table.columnfilter;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+
+/**
+ * A handler to perform table content filtering when {@link ITable#isColumnFilterEnabled()} is activated
+ */
+public interface ITableColumnFilterManager {
+
+ boolean isEnabled();
+
+ void setEnabled(boolean enabled);
+
+ <T> ITableColumnFilter<T> getFilter(IColumn<T> col);
+
+ byte[] getSerializedFilter(IColumn col);
+
+ void setSerializedFilter(byte[] filterData, IColumn col);
+
+ /**
+ * @return a collection of all filters of all rows
+ */
+ Collection<ITableColumnFilter> getFilters();
+
+ /**
+ * clears all filters from the table, sets and applies them again
+ */
+ void refresh();
+
+ /**
+ * @return the display texts of all filters contained in the column filter manager
+ */
+ List<String> getDisplayTexts();
+
+ /**
+ * Shows a form to create or modify a column filter
+ *
+ * @param col
+ * the filtered column
+ * @param showAsPopupDialog
+ * true: {@link IForm.DISPLAY_HINT_POPUP_DIALOG} will be used for display of the form
+ * @throws ProcessingException
+ */
+ void showFilterForm(IColumn col, boolean showAsPopupDialog) throws ProcessingException;
+
+ void reset() throws ProcessingException;
+
+ /**
+ * Adds a column filter listener.
+ * <p/>
+ * <b>Note:</b> The method does not check whether a listener is already in the listener list.
+ *
+ * @param listener
+ * @since 3.8.0
+ */
+ void addListener(TableColumnFilterListener listener);
+
+ /**
+ * Removes the given table column listener.
+ *
+ * @param listener
+ * @since 3.8.0
+ */
+ void removeListener(TableColumnFilterListener listener);
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columnfilter/SmartColumnFilter.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columnfilter/SmartColumnFilter.java
index 6c3a42efdf..ab8f7e156d 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columnfilter/SmartColumnFilter.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columnfilter/SmartColumnFilter.java
@@ -1,113 +1,113 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table.columnfilter;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeMap;
-
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.ISmartColumn;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.data.basic.FontSpec;
-import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
-
-/**
- * @deprecated This class will be removed in the next release because it is not used anymore.
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-public class SmartColumnFilter<T> implements ITableColumnFilter<T>, Serializable {
- private static final long serialVersionUID = 1L;
- private ISmartColumn<T> m_column;
- private Set<T> m_selectedValues;
-
- public SmartColumnFilter(ISmartColumn<T> column) {
- m_column = column;
- }
-
- @Override
- public IColumn<T> getColumn() {
- return m_column;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public void setColumn(IColumn column) {
- if (column instanceof ISmartColumn) {
- m_column = (ISmartColumn<T>) column;
- }
- else {
- throw new IllegalArgumentException();
- }
- }
-
- @Override
- public Set<T> getSelectedValues() {
- return m_selectedValues;
- }
-
- @Override
- public void setSelectedValues(Set<T> set) {
- m_selectedValues = set;
- }
-
- @Override
- public List<LookupRow> createHistogram() {
- TreeMap<String, LookupRow> hist = new TreeMap<String, LookupRow>();
- HashMap<String, Integer> countMap = new HashMap<String, Integer>();
- for (ITableRow row : m_column.getTable().getRows()) {
- T key = m_column.getValue(row);
- String text = m_column.getDisplayText(row);
- if (text != null && !hist.containsKey(text)) {
- FontSpec font = (row.isFilterAccepted() ? null : FontSpec.parse("italic"));
- hist.put(text, new LookupRow(key, text, null, null, null, null, font));
- }
- Integer count = countMap.get(text);
- countMap.put(text, count != null ? count + 1 : 1);
- }
- for (Map.Entry<String, LookupRow> e : hist.entrySet()) {
- Integer count = countMap.get(e.getKey());
- if (count != null && count > 1) {
- LookupRow row = e.getValue();
- row.setText(row.getText() + " (" + count + ")");
- }
- }
- ArrayList<LookupRow> list = new ArrayList<LookupRow>();
- list.addAll(hist.values());
- //
- Integer nullCount = countMap.get(null);
- list.add(new LookupRow(null, "(" + ScoutTexts.get("ColumnFilterNullText") + ")" + (nullCount != null && nullCount > 1 ? " (" + nullCount + ")" : "")));
- return list;
- }
-
- @Override
- public boolean isEmpty() {
- return m_selectedValues == null || m_selectedValues.isEmpty();
- }
-
- @Override
- public boolean accept(ITableRow row) {
- T value = m_column.getValue(row);
- if (m_selectedValues != null) {
- if (!m_selectedValues.contains(value)) {
- return false;
- }
- }
- return true;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table.columnfilter;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.ISmartColumn;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.data.basic.FontSpec;
+import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
+
+/**
+ * @deprecated This class will be removed in the next release because it is not used anymore.
+ */
+@Deprecated
+@SuppressWarnings("deprecation")
+public class SmartColumnFilter<T> implements ITableColumnFilter<T>, Serializable {
+ private static final long serialVersionUID = 1L;
+ private ISmartColumn<T> m_column;
+ private Set<T> m_selectedValues;
+
+ public SmartColumnFilter(ISmartColumn<T> column) {
+ m_column = column;
+ }
+
+ @Override
+ public IColumn<T> getColumn() {
+ return m_column;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public void setColumn(IColumn column) {
+ if (column instanceof ISmartColumn) {
+ m_column = (ISmartColumn<T>) column;
+ }
+ else {
+ throw new IllegalArgumentException();
+ }
+ }
+
+ @Override
+ public Set<T> getSelectedValues() {
+ return m_selectedValues;
+ }
+
+ @Override
+ public void setSelectedValues(Set<T> set) {
+ m_selectedValues = set;
+ }
+
+ @Override
+ public List<LookupRow> createHistogram() {
+ TreeMap<String, LookupRow> hist = new TreeMap<String, LookupRow>();
+ HashMap<String, Integer> countMap = new HashMap<String, Integer>();
+ for (ITableRow row : m_column.getTable().getRows()) {
+ T key = m_column.getValue(row);
+ String text = m_column.getDisplayText(row);
+ if (text != null && !hist.containsKey(text)) {
+ FontSpec font = (row.isFilterAccepted() ? null : FontSpec.parse("italic"));
+ hist.put(text, new LookupRow(key, text, null, null, null, null, font));
+ }
+ Integer count = countMap.get(text);
+ countMap.put(text, count != null ? count + 1 : 1);
+ }
+ for (Map.Entry<String, LookupRow> e : hist.entrySet()) {
+ Integer count = countMap.get(e.getKey());
+ if (count != null && count > 1) {
+ LookupRow row = e.getValue();
+ row.setText(row.getText() + " (" + count + ")");
+ }
+ }
+ ArrayList<LookupRow> list = new ArrayList<LookupRow>();
+ list.addAll(hist.values());
+ //
+ Integer nullCount = countMap.get(null);
+ list.add(new LookupRow(null, "(" + ScoutTexts.get("ColumnFilterNullText") + ")" + (nullCount != null && nullCount > 1 ? " (" + nullCount + ")" : "")));
+ return list;
+ }
+
+ @Override
+ public boolean isEmpty() {
+ return m_selectedValues == null || m_selectedValues.isEmpty();
+ }
+
+ @Override
+ public boolean accept(ITableRow row) {
+ T value = m_column.getValue(row);
+ if (m_selectedValues != null) {
+ if (!m_selectedValues.contains(value)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columnfilter/StringColumnFilter.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columnfilter/StringColumnFilter.java
index ee0c8421b8..bd4ec09313 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columnfilter/StringColumnFilter.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columnfilter/StringColumnFilter.java
@@ -1,137 +1,137 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table.columnfilter;
-
-import java.io.Serializable;
-import java.text.Collator;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeMap;
-import java.util.regex.Pattern;
-
-import org.eclipse.scout.commons.LocaleThreadLocal;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.data.basic.FontSpec;
-import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
-
-/**
- *
- */
-public class StringColumnFilter implements ITableColumnFilter<String>, Serializable {
- private static final long serialVersionUID = 1L;
- private IColumn<String> m_column;
- private Set<String> m_selectedValues;
- private String m_pattern;
- //cache
- private transient Pattern m_regexPat;
-
- public StringColumnFilter(IColumn<String> column) {
- m_column = column;
- }
-
- @Override
- public IColumn<String> getColumn() {
- return m_column;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public void setColumn(IColumn column) {
- m_column = column;
- }
-
- @Override
- public Set<String> getSelectedValues() {
- return m_selectedValues;
- }
-
- @Override
- public void setSelectedValues(Set<String> set) {
- m_selectedValues = set;
- }
-
- public String getPattern() {
- return m_pattern;
- }
-
- public void setPattern(String pattern) {
- m_pattern = pattern;
- m_regexPat = null;
- }
-
- @Override
- public List<LookupRow> createHistogram() {
- TreeMap<String, LookupRow> hist = new TreeMap<String, LookupRow>(Collator.getInstance(LocaleThreadLocal.get()));
- HashMap<String, Integer> countMap = new HashMap<String, Integer>();
- for (ITableRow row : m_column.getTable().getRows()) {
- String s = m_column.getDisplayText(row);
- if (!StringUtility.hasText(s)) {
- s = null;
- }
- if (s != null && !hist.containsKey(s)) {
- FontSpec font = (row.isFilterAccepted() ? null : FontSpec.parse("italic"));
- hist.put(s, new LookupRow(s, s, null, null, null, null, font));
- }
- Integer count = countMap.get(s);
- countMap.put(s, count != null ? count + 1 : 1);
- }
- for (Map.Entry<String, LookupRow> e : hist.entrySet()) {
- Integer count = countMap.get(e.getKey());
- if (count != null && count > 1) {
- LookupRow row = e.getValue();
- row.setText(row.getText() + " (" + count + ")");
- }
- }
- ArrayList<LookupRow> list = new ArrayList<LookupRow>();
- list.addAll(hist.values());
- //
- Integer nullCount = countMap.get(null);
- list.add(new LookupRow(null, "(" + ScoutTexts.get("ColumnFilterNullText") + ")" + (nullCount != null && nullCount > 1 ? " (" + nullCount + ")" : "")));
- return list;
- }
-
- @Override
- public boolean isEmpty() {
- return (m_selectedValues == null || m_selectedValues.isEmpty()) && m_pattern == null;
- }
-
- @Override
- public boolean accept(ITableRow row) {
- String value = m_column.getDisplayText(row);
- if (!StringUtility.hasText(value)) {
- value = null;
- }
- if (m_pattern != null) {
- if (m_regexPat == null) {
- m_regexPat = Pattern.compile(StringUtility.toRegExPattern("*" + m_pattern.toLowerCase() + "*"), Pattern.DOTALL);
- }
- if (value == null) {
- return false;
- }
- if (!m_regexPat.matcher(value.toLowerCase()).matches()) {
- return false;
- }
- }
- if (m_selectedValues != null) {
- if (!m_selectedValues.contains(value)) {
- return false;
- }
- }
- return true;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table.columnfilter;
+
+import java.io.Serializable;
+import java.text.Collator;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.regex.Pattern;
+
+import org.eclipse.scout.commons.LocaleThreadLocal;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.data.basic.FontSpec;
+import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
+
+/**
+ *
+ */
+public class StringColumnFilter implements ITableColumnFilter<String>, Serializable {
+ private static final long serialVersionUID = 1L;
+ private IColumn<String> m_column;
+ private Set<String> m_selectedValues;
+ private String m_pattern;
+ //cache
+ private transient Pattern m_regexPat;
+
+ public StringColumnFilter(IColumn<String> column) {
+ m_column = column;
+ }
+
+ @Override
+ public IColumn<String> getColumn() {
+ return m_column;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public void setColumn(IColumn column) {
+ m_column = column;
+ }
+
+ @Override
+ public Set<String> getSelectedValues() {
+ return m_selectedValues;
+ }
+
+ @Override
+ public void setSelectedValues(Set<String> set) {
+ m_selectedValues = set;
+ }
+
+ public String getPattern() {
+ return m_pattern;
+ }
+
+ public void setPattern(String pattern) {
+ m_pattern = pattern;
+ m_regexPat = null;
+ }
+
+ @Override
+ public List<LookupRow> createHistogram() {
+ TreeMap<String, LookupRow> hist = new TreeMap<String, LookupRow>(Collator.getInstance(LocaleThreadLocal.get()));
+ HashMap<String, Integer> countMap = new HashMap<String, Integer>();
+ for (ITableRow row : m_column.getTable().getRows()) {
+ String s = m_column.getDisplayText(row);
+ if (!StringUtility.hasText(s)) {
+ s = null;
+ }
+ if (s != null && !hist.containsKey(s)) {
+ FontSpec font = (row.isFilterAccepted() ? null : FontSpec.parse("italic"));
+ hist.put(s, new LookupRow(s, s, null, null, null, null, font));
+ }
+ Integer count = countMap.get(s);
+ countMap.put(s, count != null ? count + 1 : 1);
+ }
+ for (Map.Entry<String, LookupRow> e : hist.entrySet()) {
+ Integer count = countMap.get(e.getKey());
+ if (count != null && count > 1) {
+ LookupRow row = e.getValue();
+ row.setText(row.getText() + " (" + count + ")");
+ }
+ }
+ ArrayList<LookupRow> list = new ArrayList<LookupRow>();
+ list.addAll(hist.values());
+ //
+ Integer nullCount = countMap.get(null);
+ list.add(new LookupRow(null, "(" + ScoutTexts.get("ColumnFilterNullText") + ")" + (nullCount != null && nullCount > 1 ? " (" + nullCount + ")" : "")));
+ return list;
+ }
+
+ @Override
+ public boolean isEmpty() {
+ return (m_selectedValues == null || m_selectedValues.isEmpty()) && m_pattern == null;
+ }
+
+ @Override
+ public boolean accept(ITableRow row) {
+ String value = m_column.getDisplayText(row);
+ if (!StringUtility.hasText(value)) {
+ value = null;
+ }
+ if (m_pattern != null) {
+ if (m_regexPat == null) {
+ m_regexPat = Pattern.compile(StringUtility.toRegExPattern("*" + m_pattern.toLowerCase() + "*"), Pattern.DOTALL);
+ }
+ if (value == null) {
+ return false;
+ }
+ if (!m_regexPat.matcher(value.toLowerCase()).matches()) {
+ return false;
+ }
+ }
+ if (m_selectedValues != null) {
+ if (!m_selectedValues.contains(value)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columnfilter/TableColumnFilterEvent.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columnfilter/TableColumnFilterEvent.java
index 9356cf66ab..c789ec85d7 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columnfilter/TableColumnFilterEvent.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columnfilter/TableColumnFilterEvent.java
@@ -1,93 +1,93 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table.columnfilter;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-import java.util.EventObject;
-
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-
-/**
- * @since 3.8.0
- */
-public class TableColumnFilterEvent extends EventObject {
-
- private static final long serialVersionUID = 1L;
-
- public static final int TYPE_FILTER_ADDED = 10;
- public static final int TYPE_FILTER_CHANGED = 20;
- public static final int TYPE_FILTER_REMOVED = 30;
- public static final int TYPE_FILTERS_RESET = 40;
-
- private final int m_type;
- private final IColumn<?> m_column;
-
- /**
- * @param source
- */
- public TableColumnFilterEvent(ITable table, int type) {
- this(table, type, null);
- }
-
- public TableColumnFilterEvent(ITable table, int type, IColumn<?> column) {
- super(table);
- m_type = type;
- m_column = column;
- }
-
- public ITable getTable() {
- return (ITable) getSource();
- }
-
- public ITableColumnFilterManager getColumnFilterManager() {
- if (getTable() == null) {
- return null;
- }
- return getTable().getColumnFilterManager();
- }
-
- public int getType() {
- return m_type;
- }
-
- public IColumn<?> getColumn() {
- return m_column;
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append("DialogEvent[");
- // decode type
- try {
- Field[] f = getClass().getDeclaredFields();
- for (int i = 0; i < f.length; i++) {
- if (Modifier.isPublic(f[i].getModifiers()) && Modifier.isStatic(f[i].getModifiers()) && f[i].getName().startsWith("TYPE_")) {
- if (((Number) f[i].get(null)).intValue() == m_type) {
- sb.append(f[i].getName());
- break;
- }
- }
- }
- }
- catch (Throwable t) {
- sb.append("#" + m_type);
- }
- // table
- if (getTable() != null) {
- sb.append(" " + getTable().getClass());
- }
- sb.append("]");
- return sb.toString();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table.columnfilter;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.util.EventObject;
+
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+
+/**
+ * @since 3.8.0
+ */
+public class TableColumnFilterEvent extends EventObject {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final int TYPE_FILTER_ADDED = 10;
+ public static final int TYPE_FILTER_CHANGED = 20;
+ public static final int TYPE_FILTER_REMOVED = 30;
+ public static final int TYPE_FILTERS_RESET = 40;
+
+ private final int m_type;
+ private final IColumn<?> m_column;
+
+ /**
+ * @param source
+ */
+ public TableColumnFilterEvent(ITable table, int type) {
+ this(table, type, null);
+ }
+
+ public TableColumnFilterEvent(ITable table, int type, IColumn<?> column) {
+ super(table);
+ m_type = type;
+ m_column = column;
+ }
+
+ public ITable getTable() {
+ return (ITable) getSource();
+ }
+
+ public ITableColumnFilterManager getColumnFilterManager() {
+ if (getTable() == null) {
+ return null;
+ }
+ return getTable().getColumnFilterManager();
+ }
+
+ public int getType() {
+ return m_type;
+ }
+
+ public IColumn<?> getColumn() {
+ return m_column;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("DialogEvent[");
+ // decode type
+ try {
+ Field[] f = getClass().getDeclaredFields();
+ for (int i = 0; i < f.length; i++) {
+ if (Modifier.isPublic(f[i].getModifiers()) && Modifier.isStatic(f[i].getModifiers()) && f[i].getName().startsWith("TYPE_")) {
+ if (((Number) f[i].get(null)).intValue() == m_type) {
+ sb.append(f[i].getName());
+ break;
+ }
+ }
+ }
+ }
+ catch (Throwable t) {
+ sb.append("#" + m_type);
+ }
+ // table
+ if (getTable() != null) {
+ sb.append(" " + getTable().getClass());
+ }
+ sb.append("]");
+ return sb.toString();
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columnfilter/TableColumnFilterListener.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columnfilter/TableColumnFilterListener.java
index 40b488ca29..5b81f45cad 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columnfilter/TableColumnFilterListener.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columnfilter/TableColumnFilterListener.java
@@ -1,23 +1,23 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table.columnfilter;
-
-import java.util.EventListener;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-
-/**
- * @since 3.8.0
- */
-public interface TableColumnFilterListener extends EventListener {
-
- void tableColumnFilterChanged(TableColumnFilterEvent e) throws ProcessingException;
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table.columnfilter;
+
+import java.util.EventListener;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+
+/**
+ * @since 3.8.0
+ */
+public interface TableColumnFilterListener extends EventListener {
+
+ void tableColumnFilterChanged(TableColumnFilterEvent e) throws ProcessingException;
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractBigDecimalColumn.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractBigDecimalColumn.java
index 8180be73df..a18f73c728 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractBigDecimalColumn.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractBigDecimalColumn.java
@@ -1,308 +1,308 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table.columns;
-
-/**
- * C
- */
-import java.math.BigDecimal;
-import java.text.DecimalFormat;
-import java.text.NumberFormat;
-
-import org.eclipse.scout.commons.LocaleThreadLocal;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.bigdecimalfield.AbstractBigDecimalField;
-
-/**
- * Column holding Double
- */
-public abstract class AbstractBigDecimalColumn extends AbstractColumn<BigDecimal> implements IBigDecimalColumn {
- // DO NOT init members, this has the same effect as if they were set AFTER
- // initConfig()
- private String m_format = null;
- private boolean m_groupingUsed;
- private int m_maxFractionDigits;
- private int m_minFractionDigits;
- private boolean m_percent;
- private int m_multiplier;
- private NumberFormat m_fmt;
-
- public AbstractBigDecimalColumn() {
- super();
- }
-
- /*
- * Configuration
- */
-
- /**
- * Configures the format used to render the value. See {@link DecimalFormat#applyPattern(String)} for more information
- * about the expected format.
- * <p>
- * Subclasses can override this method. Default is {@code null}.
- *
- * @return Format of this column.
- */
- @ConfigProperty(ConfigProperty.STRING)
- @Order(140)
- @ConfigPropertyValue("null")
- protected String getConfiguredFormat() {
- return null;
- }
-
- /**
- * Configures the minimum number of fraction digits used to display the value. To use an exact number of fraction
- * digits, the same number as for {@link #getConfiguredMaxFractionDigits()} must be returned.
- * <p>
- * Subclasses can override this method. Default is {@code 2}.
- *
- * @return Minimum number of fraction digits of this column.
- */
- @ConfigProperty(ConfigProperty.INTEGER)
- @Order(150)
- @ConfigPropertyValue("2")
- protected int getConfiguredMinFractionDigits() {
- return 2;
- }
-
- /**
- * Configures the maximum number of fraction digits used to display the value. To use an exact number of fraction
- * digits, the same number as for {@link #getConfiguredMinFractionDigits()} must be returned.
- * <p>
- * Subclasses can override this method. Default is {@code 2}.
- *
- * @return maximum number of fraction digits of this column.
- */
- @ConfigProperty(ConfigProperty.INTEGER)
- @Order(160)
- @ConfigPropertyValue("2")
- protected int getConfiguredMaxFractionDigits() {
- return 2;
- }
-
- /**
- * Configures whether grouping is used for this column. If grouping is used, the values may be displayed with a digit
- * group separator.
- * <p>
- * Subclasses can override this method. Default is {@code true}.
- *
- * @return {@code true} if grouping is used for this column, {@code false} otherwise.
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(170)
- @ConfigPropertyValue("true")
- protected boolean getConfiguredGroupingUsed() {
- return true;
- }
-
- /**
- * Configures whether the value is a percentage and is displayed with the appropriate sign. A value of 12 is displayed
- * as 12 % (depending on the locale). Use {@link #getConfiguredMultiplier()} to handle the value differently (e.g.
- * display a value of 0.12 as 12 %).
- * <p>
- * Subclasses can override this method. Default is {@code false}.
- *
- * @return {@code true} if the column represents a percentage value, {@code false} otherwise.
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(180)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredPercent() {
- return false;
- }
-
- /**
- * Configures the multiplier used to display the value. See {@link DecimalFormat#setMultiplier(int)} for more
- * information about multipliers.
- * <p>
- * Subclasses can override this method. Default is {@code 1}.
- *
- * @return The multiplier used to display the value.
- */
- @ConfigProperty(ConfigProperty.INTEGER)
- @Order(190)
- @ConfigPropertyValue("1")
- protected int getConfiguredMultiplier() {
- return 1;
- }
-
- @Override
- protected int getConfiguredHorizontalAlignment() {
- return 1;
- }
-
- @Override
- protected void initConfig() {
- super.initConfig();
- setFormat(getConfiguredFormat());
- setMinFractionDigits(getConfiguredMinFractionDigits());
- setMaxFractionDigits(getConfiguredMaxFractionDigits());
- setGroupingUsed(getConfiguredGroupingUsed());
- setPercent(getConfiguredPercent());
- setMultiplier(getConfiguredMultiplier());
- }
-
- /*
- * Runtime
- */
- @Override
- public void setFormat(String s) {
- m_format = s;
- m_fmt = null;
- }
-
- @Override
- public String getFormat() {
- return m_format;
- }
-
- @Override
- public void setMinFractionDigits(int i) {
- if (i > getMaxFractionDigits()) {
- m_maxFractionDigits = i;
- }
- m_minFractionDigits = i;
- m_fmt = null;
- }
-
- @Override
- public int getMinFractionDigits() {
- return m_minFractionDigits;
- }
-
- @Override
- public void setMaxFractionDigits(int i) {
- if (i < getMinFractionDigits()) {
- m_minFractionDigits = i;
- }
- m_maxFractionDigits = i;
- m_fmt = null;
- }
-
- @Override
- public int getMaxFractionDigits() {
- return m_maxFractionDigits;
- }
-
- @Override
- public void setGroupingUsed(boolean b) {
- m_groupingUsed = b;
- m_fmt = null;
- }
-
- @Override
- public boolean isGroupingUsed() {
- return m_groupingUsed;
- }
-
- @Override
- public void setPercent(boolean b) {
- m_percent = b;
- m_fmt = null;
- }
-
- @Override
- public boolean isPercent() {
- return m_percent;
- }
-
- @Override
- public void setMultiplier(int i) {
- m_multiplier = i;
- m_fmt = null;
- }
-
- @Override
- public int getMultiplier() {
- return m_multiplier;
- }
-
- @Override
- protected BigDecimal parseValueInternal(ITableRow row, Object rawValue) throws ProcessingException {
- BigDecimal validValue = null;
- if (rawValue == null) {
- validValue = null;
- }
- else if (rawValue instanceof BigDecimal) {
- validValue = (BigDecimal) rawValue;
- }
- else if (rawValue instanceof Long) {
- validValue = new BigDecimal(((Long) rawValue).toString());
- }
- else if (rawValue instanceof Double) {
- validValue = BigDecimal.valueOf((Double) rawValue);
- }
- else {
- throw new ProcessingException("invalid BigDecimal value in column '" + getClass().getSimpleName() + "': " + rawValue + " class=" + rawValue.getClass());
- }
- return validValue;
- }
-
- @Override
- protected IFormField prepareEditInternal(ITableRow row) throws ProcessingException {
- AbstractBigDecimalField f = new AbstractBigDecimalField() {
- };
- f.setFormat(getFormat());
- f.setMaxFractionDigits(getMaxFractionDigits());
- f.setMinFractionDigits(getMinFractionDigits());
- f.setMultiplier(getMultiplier());
- f.setGroupingUsed(isGroupingUsed());
- f.setPercent(isPercent());
- return f;
- }
-
- @Override
- protected void decorateCellInternal(Cell cell, ITableRow row) {
- super.decorateCellInternal(cell, row);
- if (cell.getValue() != null) {
- cell.setText(getNumberFormat().format(cell.getValue()));
- }
- else {
- cell.setText("");
- }
- }
-
- @Override
- public NumberFormat getNumberFormat() {
- if (m_fmt == null) {
- if (isPercent()) {
- m_fmt = NumberFormat.getPercentInstance(LocaleThreadLocal.get());
- }
- else {
- m_fmt = NumberFormat.getNumberInstance(LocaleThreadLocal.get());
- }
- if (m_fmt instanceof DecimalFormat) {
- ((DecimalFormat) m_fmt).setMultiplier(getMultiplier());
- if (getFormat() != null) {
- ((DecimalFormat) m_fmt).applyPattern(getFormat());
- }
- else {
- m_fmt.setMinimumFractionDigits(getMinFractionDigits());
- m_fmt.setMaximumFractionDigits(getMaxFractionDigits());
- m_fmt.setGroupingUsed(isGroupingUsed());
- }
- }
- else {
- m_fmt.setMinimumFractionDigits(getMinFractionDigits());
- m_fmt.setMaximumFractionDigits(getMaxFractionDigits());
- m_fmt.setGroupingUsed(isGroupingUsed());
- }
- }
- return m_fmt;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table.columns;
+
+/**
+ * C
+ */
+import java.math.BigDecimal;
+import java.text.DecimalFormat;
+import java.text.NumberFormat;
+
+import org.eclipse.scout.commons.LocaleThreadLocal;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.bigdecimalfield.AbstractBigDecimalField;
+
+/**
+ * Column holding Double
+ */
+public abstract class AbstractBigDecimalColumn extends AbstractColumn<BigDecimal> implements IBigDecimalColumn {
+ // DO NOT init members, this has the same effect as if they were set AFTER
+ // initConfig()
+ private String m_format = null;
+ private boolean m_groupingUsed;
+ private int m_maxFractionDigits;
+ private int m_minFractionDigits;
+ private boolean m_percent;
+ private int m_multiplier;
+ private NumberFormat m_fmt;
+
+ public AbstractBigDecimalColumn() {
+ super();
+ }
+
+ /*
+ * Configuration
+ */
+
+ /**
+ * Configures the format used to render the value. See {@link DecimalFormat#applyPattern(String)} for more information
+ * about the expected format.
+ * <p>
+ * Subclasses can override this method. Default is {@code null}.
+ *
+ * @return Format of this column.
+ */
+ @ConfigProperty(ConfigProperty.STRING)
+ @Order(140)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredFormat() {
+ return null;
+ }
+
+ /**
+ * Configures the minimum number of fraction digits used to display the value. To use an exact number of fraction
+ * digits, the same number as for {@link #getConfiguredMaxFractionDigits()} must be returned.
+ * <p>
+ * Subclasses can override this method. Default is {@code 2}.
+ *
+ * @return Minimum number of fraction digits of this column.
+ */
+ @ConfigProperty(ConfigProperty.INTEGER)
+ @Order(150)
+ @ConfigPropertyValue("2")
+ protected int getConfiguredMinFractionDigits() {
+ return 2;
+ }
+
+ /**
+ * Configures the maximum number of fraction digits used to display the value. To use an exact number of fraction
+ * digits, the same number as for {@link #getConfiguredMinFractionDigits()} must be returned.
+ * <p>
+ * Subclasses can override this method. Default is {@code 2}.
+ *
+ * @return maximum number of fraction digits of this column.
+ */
+ @ConfigProperty(ConfigProperty.INTEGER)
+ @Order(160)
+ @ConfigPropertyValue("2")
+ protected int getConfiguredMaxFractionDigits() {
+ return 2;
+ }
+
+ /**
+ * Configures whether grouping is used for this column. If grouping is used, the values may be displayed with a digit
+ * group separator.
+ * <p>
+ * Subclasses can override this method. Default is {@code true}.
+ *
+ * @return {@code true} if grouping is used for this column, {@code false} otherwise.
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(170)
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredGroupingUsed() {
+ return true;
+ }
+
+ /**
+ * Configures whether the value is a percentage and is displayed with the appropriate sign. A value of 12 is displayed
+ * as 12 % (depending on the locale). Use {@link #getConfiguredMultiplier()} to handle the value differently (e.g.
+ * display a value of 0.12 as 12 %).
+ * <p>
+ * Subclasses can override this method. Default is {@code false}.
+ *
+ * @return {@code true} if the column represents a percentage value, {@code false} otherwise.
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(180)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredPercent() {
+ return false;
+ }
+
+ /**
+ * Configures the multiplier used to display the value. See {@link DecimalFormat#setMultiplier(int)} for more
+ * information about multipliers.
+ * <p>
+ * Subclasses can override this method. Default is {@code 1}.
+ *
+ * @return The multiplier used to display the value.
+ */
+ @ConfigProperty(ConfigProperty.INTEGER)
+ @Order(190)
+ @ConfigPropertyValue("1")
+ protected int getConfiguredMultiplier() {
+ return 1;
+ }
+
+ @Override
+ protected int getConfiguredHorizontalAlignment() {
+ return 1;
+ }
+
+ @Override
+ protected void initConfig() {
+ super.initConfig();
+ setFormat(getConfiguredFormat());
+ setMinFractionDigits(getConfiguredMinFractionDigits());
+ setMaxFractionDigits(getConfiguredMaxFractionDigits());
+ setGroupingUsed(getConfiguredGroupingUsed());
+ setPercent(getConfiguredPercent());
+ setMultiplier(getConfiguredMultiplier());
+ }
+
+ /*
+ * Runtime
+ */
+ @Override
+ public void setFormat(String s) {
+ m_format = s;
+ m_fmt = null;
+ }
+
+ @Override
+ public String getFormat() {
+ return m_format;
+ }
+
+ @Override
+ public void setMinFractionDigits(int i) {
+ if (i > getMaxFractionDigits()) {
+ m_maxFractionDigits = i;
+ }
+ m_minFractionDigits = i;
+ m_fmt = null;
+ }
+
+ @Override
+ public int getMinFractionDigits() {
+ return m_minFractionDigits;
+ }
+
+ @Override
+ public void setMaxFractionDigits(int i) {
+ if (i < getMinFractionDigits()) {
+ m_minFractionDigits = i;
+ }
+ m_maxFractionDigits = i;
+ m_fmt = null;
+ }
+
+ @Override
+ public int getMaxFractionDigits() {
+ return m_maxFractionDigits;
+ }
+
+ @Override
+ public void setGroupingUsed(boolean b) {
+ m_groupingUsed = b;
+ m_fmt = null;
+ }
+
+ @Override
+ public boolean isGroupingUsed() {
+ return m_groupingUsed;
+ }
+
+ @Override
+ public void setPercent(boolean b) {
+ m_percent = b;
+ m_fmt = null;
+ }
+
+ @Override
+ public boolean isPercent() {
+ return m_percent;
+ }
+
+ @Override
+ public void setMultiplier(int i) {
+ m_multiplier = i;
+ m_fmt = null;
+ }
+
+ @Override
+ public int getMultiplier() {
+ return m_multiplier;
+ }
+
+ @Override
+ protected BigDecimal parseValueInternal(ITableRow row, Object rawValue) throws ProcessingException {
+ BigDecimal validValue = null;
+ if (rawValue == null) {
+ validValue = null;
+ }
+ else if (rawValue instanceof BigDecimal) {
+ validValue = (BigDecimal) rawValue;
+ }
+ else if (rawValue instanceof Long) {
+ validValue = new BigDecimal(((Long) rawValue).toString());
+ }
+ else if (rawValue instanceof Double) {
+ validValue = BigDecimal.valueOf((Double) rawValue);
+ }
+ else {
+ throw new ProcessingException("invalid BigDecimal value in column '" + getClass().getSimpleName() + "': " + rawValue + " class=" + rawValue.getClass());
+ }
+ return validValue;
+ }
+
+ @Override
+ protected IFormField prepareEditInternal(ITableRow row) throws ProcessingException {
+ AbstractBigDecimalField f = new AbstractBigDecimalField() {
+ };
+ f.setFormat(getFormat());
+ f.setMaxFractionDigits(getMaxFractionDigits());
+ f.setMinFractionDigits(getMinFractionDigits());
+ f.setMultiplier(getMultiplier());
+ f.setGroupingUsed(isGroupingUsed());
+ f.setPercent(isPercent());
+ return f;
+ }
+
+ @Override
+ protected void decorateCellInternal(Cell cell, ITableRow row) {
+ super.decorateCellInternal(cell, row);
+ if (cell.getValue() != null) {
+ cell.setText(getNumberFormat().format(cell.getValue()));
+ }
+ else {
+ cell.setText("");
+ }
+ }
+
+ @Override
+ public NumberFormat getNumberFormat() {
+ if (m_fmt == null) {
+ if (isPercent()) {
+ m_fmt = NumberFormat.getPercentInstance(LocaleThreadLocal.get());
+ }
+ else {
+ m_fmt = NumberFormat.getNumberInstance(LocaleThreadLocal.get());
+ }
+ if (m_fmt instanceof DecimalFormat) {
+ ((DecimalFormat) m_fmt).setMultiplier(getMultiplier());
+ if (getFormat() != null) {
+ ((DecimalFormat) m_fmt).applyPattern(getFormat());
+ }
+ else {
+ m_fmt.setMinimumFractionDigits(getMinFractionDigits());
+ m_fmt.setMaximumFractionDigits(getMaxFractionDigits());
+ m_fmt.setGroupingUsed(isGroupingUsed());
+ }
+ }
+ else {
+ m_fmt.setMinimumFractionDigits(getMinFractionDigits());
+ m_fmt.setMaximumFractionDigits(getMaxFractionDigits());
+ m_fmt.setGroupingUsed(isGroupingUsed());
+ }
+ }
+ return m_fmt;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractBooleanColumn.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractBooleanColumn.java
index 4c332ccd86..c38dad6985 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractBooleanColumn.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractBooleanColumn.java
@@ -1,103 +1,103 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table.columns;
-
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.booleanfield.AbstractBooleanField;
-
-/**
- * Column holding Boolean values
- */
-public abstract class AbstractBooleanColumn extends AbstractColumn<Boolean> implements IBooleanColumn {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractBooleanColumn.class);
-
- // DO NOT init members, this has the same effect as if they were set AFTER
- // initConfig()
-
- public AbstractBooleanColumn() {
- super();
- }
-
- @Override
- protected void initConfig() {
- super.initConfig();
- setVerticalAlignment(getConfiguredVerticalAlignment());
- }
-
- @Override
- public int getVerticalAlignment() {
- return propertySupport.getPropertyInt(PROP_VERTICAL_ALIGNMENT);
- }
-
- @Override
- public void setVerticalAlignment(int verticalAlignment) {
- propertySupport.setProperty(PROP_VERTICAL_ALIGNMENT, verticalAlignment);
- }
-
- @Override
- protected Boolean parseValueInternal(ITableRow row, Object rawValue) throws ProcessingException {
- Boolean validValue = null;
- if (rawValue == null) {
- validValue = null;
- }
- else if (rawValue instanceof Boolean) {
- validValue = (Boolean) rawValue;
- }
- else if (rawValue instanceof Number) {
- validValue = (((Number) rawValue).intValue() == 1);
- }
- else {
- throw new ProcessingException("invalid Boolean value in column '" + getClass().getSimpleName() + "': " + rawValue + " class=" + rawValue.getClass());
- }
- return validValue;
- }
-
- @Override
- protected IFormField prepareEditInternal(final ITableRow row) throws ProcessingException {
- AbstractBooleanField f = new AbstractBooleanField() {
- };
- return f;
- }
-
- /**
- * Configures the horizontal alignment of text inside this column (including header text).
- * <p>
- * Subclasses can override this method. For boolean columns, the default is {@code 0} (center
- * alignment).
- *
- * @return {@code -1} for left, {@code 0} for center and {@code 1} for right alignment.
- */
- @Override
- protected int getConfiguredHorizontalAlignment() {
- return 0; // center position
- }
-
- /**
- * Configures the vertical alignment of text inside this column (including header text).
- * <p>
- * Subclasses can override this method. Default is {@code -1} (top alignment).
- *
- * @return {@code -1} for top, {@code 0} for center and {@code 1} for bottom alignment.
- */
- @ConfigProperty(ConfigProperty.INTEGER)
- @Order(200)
- @ConfigPropertyValue("-1")
- protected int getConfiguredVerticalAlignment() {
- return -1; // top position
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table.columns;
+
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.booleanfield.AbstractBooleanField;
+
+/**
+ * Column holding Boolean values
+ */
+public abstract class AbstractBooleanColumn extends AbstractColumn<Boolean> implements IBooleanColumn {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractBooleanColumn.class);
+
+ // DO NOT init members, this has the same effect as if they were set AFTER
+ // initConfig()
+
+ public AbstractBooleanColumn() {
+ super();
+ }
+
+ @Override
+ protected void initConfig() {
+ super.initConfig();
+ setVerticalAlignment(getConfiguredVerticalAlignment());
+ }
+
+ @Override
+ public int getVerticalAlignment() {
+ return propertySupport.getPropertyInt(PROP_VERTICAL_ALIGNMENT);
+ }
+
+ @Override
+ public void setVerticalAlignment(int verticalAlignment) {
+ propertySupport.setProperty(PROP_VERTICAL_ALIGNMENT, verticalAlignment);
+ }
+
+ @Override
+ protected Boolean parseValueInternal(ITableRow row, Object rawValue) throws ProcessingException {
+ Boolean validValue = null;
+ if (rawValue == null) {
+ validValue = null;
+ }
+ else if (rawValue instanceof Boolean) {
+ validValue = (Boolean) rawValue;
+ }
+ else if (rawValue instanceof Number) {
+ validValue = (((Number) rawValue).intValue() == 1);
+ }
+ else {
+ throw new ProcessingException("invalid Boolean value in column '" + getClass().getSimpleName() + "': " + rawValue + " class=" + rawValue.getClass());
+ }
+ return validValue;
+ }
+
+ @Override
+ protected IFormField prepareEditInternal(final ITableRow row) throws ProcessingException {
+ AbstractBooleanField f = new AbstractBooleanField() {
+ };
+ return f;
+ }
+
+ /**
+ * Configures the horizontal alignment of text inside this column (including header text).
+ * <p>
+ * Subclasses can override this method. For boolean columns, the default is {@code 0} (center
+ * alignment).
+ *
+ * @return {@code -1} for left, {@code 0} for center and {@code 1} for right alignment.
+ */
+ @Override
+ protected int getConfiguredHorizontalAlignment() {
+ return 0; // center position
+ }
+
+ /**
+ * Configures the vertical alignment of text inside this column (including header text).
+ * <p>
+ * Subclasses can override this method. Default is {@code -1} (top alignment).
+ *
+ * @return {@code -1} for top, {@code 0} for center and {@code 1} for bottom alignment.
+ */
+ @ConfigProperty(ConfigProperty.INTEGER)
+ @Order(200)
+ @ConfigPropertyValue("-1")
+ protected int getConfiguredVerticalAlignment() {
+ return -1; // top position
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractColumn.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractColumn.java
index f8fc5bb8f3..9872985f70 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractColumn.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractColumn.java
@@ -1,1419 +1,1419 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table.columns;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.lang.reflect.Array;
-import java.security.Permission;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashSet;
-
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.TypeCastUtility;
-import org.eclipse.scout.commons.annotations.ConfigOperation;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.beans.AbstractPropertyObserver;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.ClientUIPreferences;
-import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
-import org.eclipse.scout.rt.client.ui.basic.table.AbstractTable;
-import org.eclipse.scout.rt.client.ui.basic.table.ColumnSet;
-import org.eclipse.scout.rt.client.ui.basic.table.HeaderCell;
-import org.eclipse.scout.rt.client.ui.basic.table.IHeaderCell;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.client.ui.basic.table.columnfilter.ITableColumnFilterManager;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.AbstractPageWithTable;
-import org.eclipse.scout.rt.client.ui.form.AbstractForm;
-import org.eclipse.scout.rt.client.ui.form.fields.AbstractValueField;
-import org.eclipse.scout.rt.client.ui.form.fields.GridData;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
-import org.eclipse.scout.rt.client.ui.form.fields.tablefield.AbstractTableField;
-import org.eclipse.scout.rt.shared.data.basic.FontSpec;
-import org.eclipse.scout.rt.shared.data.form.AbstractFormData;
-import org.eclipse.scout.rt.shared.services.common.security.IAccessControlService;
-import org.eclipse.scout.service.SERVICES;
-
-public abstract class AbstractColumn<T> extends AbstractPropertyObserver implements IColumn<T> {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractColumn.class);
-
- // DO NOT init members, this has the same effect as if they were set AFTER
- // initConfig()
- private ITable m_table;
- private final HeaderCell m_headerCell;
- private boolean m_primaryKey;
- private boolean m_summary;
- /**
- * A column is presented to the user when it is displayable AND visible this
- * column is visible to the user only used when displayable=true
- */
- private boolean m_visibleProperty;
- private boolean m_visibleGranted;
- private int m_initialWidth;
- private boolean m_initialVisible;
- private int m_initialSortIndex;
- private boolean m_initialSortAscending;
- private boolean m_initialAlwaysIncludeSortAtBegin;
- private boolean m_initialAlwaysIncludeSortAtEnd;
-
- public AbstractColumn() {
- m_headerCell = new HeaderCell();
- initConfig();
- propertySupport.addPropertyChangeListener(new PropertyChangeListener() {
-
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- // force decoration of rows on property change.
- // This is important to recalculate editability of editable cells.
- ITable table = getTable();
- if (table != null) {
- table.updateAllRows();
- }
- }
- });
- }
-
- /*
- * Configuration
- */
-
- /**
- * Configures the visibility of this column. If the column must be visible for the user, it must be displayable too
- * (see {@link #getConfiguredDisplayable()}).
- * <p>
- * Subclasses can override this method. Default is {@code true}.
- *
- * @return {@code true} if this column is visible, {@code false} otherwise.
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(10)
- @ConfigPropertyValue("true")
- protected boolean getConfiguredVisible() {
- return true;
- }
-
- /**
- * Configures the header text of this column.
- * <p>
- * Subclasses can override this method. Default is {@code null}.
- *
- * @return Header text of this column.
- */
- @ConfigProperty(ConfigProperty.TEXT)
- @Order(20)
- @ConfigPropertyValue("null")
- protected String getConfiguredHeaderText() {
- return null;
- }
-
- /**
- * Configures the header tooltip of this column.
- * <p>
- * Subclasses can override this method. Default is {@code null}.
- *
- * @return Tooltip of this column.
- */
- @ConfigProperty(ConfigProperty.TEXT)
- @Order(30)
- @ConfigPropertyValue("null")
- protected String getConfiguredHeaderTooltipText() {
- return null;
- }
-
- /**
- * Configures the color of this column header text. The color is represented by the HEX value (e.g. FFFFFF).
- * <p>
- * Subclasses can override this method. Default is {@code null}.
- *
- * @return Foreground color HEX value of this column header text.
- */
- @ConfigProperty(ConfigProperty.COLOR)
- @Order(40)
- @ConfigPropertyValue("null")
- protected String getConfiguredHeaderForegroundColor() {
- return null;
- }
-
- /**
- * Configures the background color of this column header. The color is represented by the HEX value (e.g. FFFFFF).
- * <p>
- * Subclasses can override this method. Default is {@code null}.
- *
- * @return Background color HEX value of this column header.
- */
- @ConfigProperty(ConfigProperty.COLOR)
- @Order(50)
- @ConfigPropertyValue("null")
- protected String getConfiguredHeaderBackgroundColor() {
- return null;
- }
-
- /**
- * Configures the font of this column header text. See {@link FontSpec#parse(String)} for the appropriate format.
- * <p>
- * Subclasses can override this method. Default is {@code null}.
- *
- * @return Font of this column header text.
- */
- @ConfigProperty(ConfigProperty.STRING)
- @Order(60)
- @ConfigPropertyValue("null")
- protected String getConfiguredHeaderFont() {
- return null;
- }
-
- /**
- * Configures the width of this column. The width of a column is represented by an {@code int}. If the table's auto
- * resize flag is set (see {@link AbstractTable#getConfiguredAutoResizeColumns()} ), the ratio of the column widths
- * determines the real column width. If the flag is not set, the column's width is represented by the configured
- * width.
- * <p>
- * Subclasses can override this method. Default is {@code 60}.
- *
- * @return Width of this column.
- */
- @ConfigProperty(ConfigProperty.INTEGER)
- @Order(70)
- @ConfigPropertyValue("60")
- protected int getConfiguredWidth() {
- return 60;
- }
-
- /**
- * Configures whether the column is displayable or not. A non-displayable column is always invisible for the user. A
- * displayable column may be visible for a user, depending on {@link #getConfiguredVisible()}.
- * <p>
- * Subclasses can override this method. Default is {@code true}.
- *
- * @return {@code true} if this column is displayable, {@code false} otherwise.
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(80)
- @ConfigPropertyValue("true")
- protected boolean getConfiguredDisplayable() {
- return true;
- }
-
- /**
- * Configures whether this column value belongs to the primary key of the surrounding table. The table's primary key
- * might consist of several columns. The primary key can be used to find the appropriate row by calling
- * {@link AbstractTable#findRowByKey(Object[])}.
- * <p>
- * Subclasses can override this method. Default is {@code false}.
- *
- * @return {@code true} if this column value belongs to the primary key of the surrounding table, {@code false}
- * otherwise.
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(90)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredPrimaryKey() {
- return false;
- }
-
- /**
- * Configures whether this column is editable or not. A user might directly modify the value of an editable column. A
- * non-editable column is read-only.
- * <p>
- * Subclasses can override this method. Default is {@code false}.
- *
- * @return {@code true} if this column is editable, {@code false} otherwise.
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(95)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredEditable() {
- return false;
- }
-
- /**
- * Configures whether this column is a summary column. Summary columns are used in case of a table with children. The
- * label of the child node is based on the value of the summary columns. See {@link ITable#getSummaryCell(ITableRow)}
- * for more information.
- * <p>
- * Subclasses can override this method. Default is {@code false}.
- *
- * @return {@code true} if this column is a summary column, {@code false} otherwise.
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(100)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredSummary() {
- return false;
- }
-
- /**
- * Configures the color of this column text (except color of header text, see
- * {@link #getConfiguredHeaderForegroundColor()}). The color is represented by the HEX value (e.g. FFFFFF).
- * <p>
- * Subclasses can override this method. Default is {@code null}.
- *
- * @return Foreground color HEX value of this column text.
- */
- @ConfigProperty(ConfigProperty.COLOR)
- @Order(110)
- @ConfigPropertyValue("null")
- protected String getConfiguredForegroundColor() {
- return null;
- }
-
- /**
- * Configures the background color of this column (except background color of header, see
- * {@link #getConfiguredHeaderBackgroundColor()}. The color is represented by the HEX value (e.g. FFFFFF).
- * <p>
- * Subclasses can override this method. Default is {@code null}.
- *
- * @return Background color HEX value of this column.
- */
- @ConfigProperty(ConfigProperty.COLOR)
- @Order(120)
- @ConfigPropertyValue("null")
- protected String getConfiguredBackgroundColor() {
- return null;
- }
-
- /**
- * Configures the font of this column text (except header text, see {@link #getConfiguredHeaderFont()}). See
- * {@link FontSpec#parse(String)} for the appropriate format.
- * <p>
- * Subclasses can override this method. Default is {@code null}.
- *
- * @return Font of this column text.
- */
- @ConfigProperty(ConfigProperty.STRING)
- @Order(130)
- @ConfigPropertyValue("null")
- protected String getConfiguredFont() {
- return null;
- }
-
- /**
- * Configures the sort index of this column. A sort index {@code < 0} means that the column is not considered for
- * sorting. For a column to be considered for sorting, the sort index must be {@code >= 0}. Several columns
- * might have set a sort index. Sorting starts with the column having the the lowest sort index ({@code >= 0}).
- * <p>
- * Subclasses can override this method. Default is {@code -1}.
- *
- * @return Sort index of this column.
- */
- @ConfigProperty(ConfigProperty.INTEGER)
- @Order(140)
- @ConfigPropertyValue("-1")
- protected int getConfiguredSortIndex() {
- return -1;
- }
-
- /**
- * Configures the view order of this column. The view order determines the order in which the columns appear. The view
- * order of column with no view order configured ({@code < 0}) is initialized based on the order annotation of the
- * column class.
- * <p>
- * Subclasses can override this method. Default is {@code -1}.
- *
- * @return View order of this column.
- */
- @ConfigProperty(ConfigProperty.DOUBLE)
- @Order(145)
- @ConfigPropertyValue("-1")
- protected double getConfiguredViewOrder() {
- return -1;
- }
-
- /**
- * Configures whether this column is sorted ascending or descending. For a column to be sorted at all, a sort index
- * must be set (see {@link #getConfiguredSortIndex()}).
- * <p>
- * Subclasses can override this method. Default is {@code true}.
- *
- * @return {@code true} if this column is sorted ascending, {@code false} otherwise.
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(150)
- @ConfigPropertyValue("true")
- protected boolean getConfiguredSortAscending() {
- return true;
- }
-
- /**
- * Configures whether this column is always included for sort at begin, independent of a sort change by the user. If
- * set to {@code true}, the sort index (see {@link #getConfiguredSortIndex()}) must be set.
- * <p>
- * Subclasses can override this method. Default is {@code false}.
- *
- * @return {@code true} if this column is always included for sort at begin, {@code false} otherwise.
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(160)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredAlwaysIncludeSortAtBegin() {
- return false;
- }
-
- /**
- * Configures whether this column is always included for sort at end, independent of a sort change by the user. If set
- * to {@code true}, the sort index (see {@link #getConfiguredSortIndex()}) must be set.
- * <p>
- * Subclasses can override this method. Default is {@code false}.
- *
- * @return {@code true} if this column is always included for sort at end, {@code false} otherwise.
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(170)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredAlwaysIncludeSortAtEnd() {
- return false;
- }
-
- /**
- * Configures the horizontal alignment of text inside this column (including header text).
- * <p>
- * Subclasses can override this method. Default is {@code -1} (left alignment).
- *
- * @return {@code -1} for left, {@code 0} for center and {@code 1} for right alignment.
- */
- @ConfigProperty(ConfigProperty.INTEGER)
- @Order(180)
- @ConfigPropertyValue("-1")
- protected int getConfiguredHorizontalAlignment() {
- return -1;
- }
-
- /**
- * Configures whether the column width is auto optimized. If true: Whenever the table content changes, the optimized
- * column width is automatically calculated so that all column content is displayed without cropping.
- * <p>
- * This may display a horizontal scroll bar on the table.
- * <p>
- * This feature is not supported in SWT and RWT since SWT does not offer such an API method.
- * <p>
- * Subclasses can override this method. Default is {@code false}.
- *
- * @return {@code true} if this column width is auto optimized, {@code false} otherwise.
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(190)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredAutoOptimizeWidth() {
- return false;
- }
-
- /**
- * Provides a documentation text or description of this column. The text is intended to be included in external
- * documentation. This method is typically processed by a documentation generation tool or similar.
- * <p>
- * Subclasses can override this method. Default is {@code null}.
- *
- * @return a documentation text, suitable to be included in external documents
- */
- @ConfigProperty(ConfigProperty.DOC)
- @Order(200)
- @ConfigPropertyValue("null")
- protected String getConfiguredDoc() {
- return null;
- }
-
- /**
- * Configures whether this column value is mandatory / required. This only affects editable columns (see
- * {@link #getConfiguredEditable()} ).
- * <p>
- * Subclasses can override this method. Default is {@code false}.
- *
- * @return {@code true} if this column value is mandatory, {@code false} otherwise.
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(210)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredMandatory() {
- return false;
- }
-
- /**
- * Called after this column has been added to the column set of the surrounding table. This method may execute
- * additional initialization for this column (e.g. register listeners).
- * <p>
- * Do not load table data here, this should be done lazily in {@link AbstractPageWithTable#execLoadTableData()},
- * {@link AbstractTableField#reloadTableData()} or via {@link AbstractForm#importFormData(AbstractFormData)}.
- * <p>
- * Subclasses can override this method. The default does nothing.
- *
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(10)
- protected void execInitColumn() throws ProcessingException {
- }
-
- /**
- * Called when the surrounding table is disposed. This method may execute additional cleanup.
- * <p>
- * Subclasses can override this method. The default does nothing.
- *
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(15)
- protected void execDisposeColumn() throws ProcessingException {
- }
-
- /**
- * Parse is the process of transforming an arbitrary object to the correct type or throwing an exception.
- * <p>
- * see also {@link #execValidateValue(ITableRow, Object)}
- * <p>
- * Subclasses can override this method. The default calls {@link #parseValueInternal(ITableRow, Object)}.
- *
- * @param row
- * Table row for which to parse the raw value.
- * @param rawValue
- * Raw value to parse.
- * @return Value in correct type, derived from rawValue.
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(20)
- protected T/* validValue */execParseValue(ITableRow row, Object rawValue) throws ProcessingException {
- return parseValueInternal(row, rawValue);
- }
-
- /**
- * Validate is the process of checking range, domain, bounds, correctness etc. of an already correctly typed value or
- * throwing an exception.
- * <p>
- * see also {@link #execParseValue(ITableRow, Object)}
- * <p>
- * Subclasses can override this method. The default calls {@link #validateValueInternal(ITableRow, Object)}.
- *
- * @param row
- * Table row for which to validate the raw value.
- * @param rawValue
- * Already parsed raw value to validate.
- * @return Validated value
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(30)
- protected T/* validValue */execValidateValue(ITableRow row, T rawValue) throws ProcessingException {
- return validateValueInternal(row, rawValue);
- }
-
- /**
- * Called when decorating the table cell. This method may add additional decorations to the table cell.
- * <p>
- * Subclasses can override this method. The default does nothing.
- *
- * @param cell
- * Cell to decorate.
- * @param row
- * Table row of cell.
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(40)
- protected void execDecorateCell(Cell cell, ITableRow row) throws ProcessingException {
- }
-
- /**
- * Called when decorating the table header cell. This method may add additional decorations to the table header cell.
- * <p>
- * Subclasses can override this method. The default does nothing.
- *
- * @param cell
- * Header cell to decorate.
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(50)
- protected void execDecorateHeaderCell(HeaderCell cell) throws ProcessingException {
- }
-
- /**
- * Only called if {@link #getConfiguredEditable()} is true and cell, row and table are enabled. Use this method only
- * for dynamic checks of editablility, otherwise use {@link #getConfiguredEditable()}.
- * <p>
- * Subclasses can override this method. Default is {@code true}.
- *
- * @param row
- * for which to determine editability dynamically.
- * @return {@code true} if the cell (row, column) is editable, {@code false} otherwise.
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(60)
- protected boolean execIsEditable(ITableRow row) throws ProcessingException {
- return true;
- }
-
- /**
- * Prepares the editing of a cell in the table.
- * <p>
- * Cell editing is canceled (normally by typing escape) or saved (normally by clicking another cell, typing enter).
- * <p>
- * When saved, the method {@link #completeEdit(ITableRow, IFormField)} /
- * {@link #execCompleteEdit(ITableRow, IFormField)} is called on this column.
- * <p>
- * Subclasses can override this method. The default returns an appropriate field based on the column data type.
- *
- * @param row
- * on which editing occurs
- * @return a field for editing or null to install an empty cell editor.
- */
- @SuppressWarnings("unchecked")
- @ConfigOperation
- @Order(61)
- protected IFormField execPrepareEdit(ITableRow row) throws ProcessingException {
- IFormField f = prepareEditInternal(row);
- if (f != null) {
- f.setLabelVisible(false);
- if (getConfiguredMandatory()) {
- f.setMandatory(true);
- }
- GridData gd = f.getGridDataHints();
- // apply horizontal alignment of column to respective editor field
- gd.horizontalAlignment = getHorizontalAlignment();
- f.setGridDataHints(gd);
- if (f instanceof IValueField<?>) {
- ((IValueField<T>) f).setValue(getValue(row));
- }
- f.markSaved();
- }
- return f;
- }
-
- /**
- * Completes editing of a cell.
- * <p>
- * Subclasses can override this method. The default calls {@link #applyValueInternal(ITableRow, Object)} and delegates
- * to {@link #execParseValue(ITableRow, Object)} and {@link #execValidateValue(ITableRow, Object)}.
- *
- * @param row
- * on which editing occurred.
- * @param editingField
- * Field which was used to edit cell value (as returned by {@link #execPrepareEdit(ITableRow)}).
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(62)
- protected void execCompleteEdit(ITableRow row, IFormField editingField) throws ProcessingException {
- if (editingField instanceof IValueField) {
- IValueField v = (IValueField) editingField;
- if (v.isSaveNeeded()) {
- applyValueInternal(row, parseValue(row, ((IValueField) editingField).getValue()));
- }
- }
- }
-
- /**
- * <p>
- * Updates the value of the cell with the given value.
- * </p>
- * <p>
- * Thereby, if sorting is enabled on table, it is temporarily suspended to prevent rows from scampering.
- * </p>
- *
- * @param row
- * @param newValue
- * @throws ProcessingException
- */
- protected void applyValueInternal(ITableRow row, T newValue) throws ProcessingException {
- if (!getTable().isSortEnabled()) {
- setValue(row, newValue);
- }
- else {
- // suspend sorting to prevent rows from scampering
- try {
- getTable().setSortEnabled(false);
- setValue(row, newValue);
- }
- finally {
- getTable().setSortEnabled(true);
- }
- }
- }
-
- protected void initConfig() {
- setAutoOptimizeWidth(getConfiguredAutoOptimizeWidth());
- m_visibleGranted = true;
- m_headerCell.setText(getConfiguredHeaderText());
- if (getConfiguredHeaderTooltipText() != null) {
- m_headerCell.setTooltipText(getConfiguredHeaderTooltipText());
- }
- if (getConfiguredHeaderForegroundColor() != null) {
- m_headerCell.setForegroundColor((getConfiguredHeaderForegroundColor()));
- }
- if (getConfiguredHeaderBackgroundColor() != null) {
- m_headerCell.setBackgroundColor((getConfiguredHeaderBackgroundColor()));
- }
- if (getConfiguredHeaderFont() != null) {
- m_headerCell.setFont(FontSpec.parse(getConfiguredHeaderFont()));
- }
- m_headerCell.setHorizontalAlignment(getConfiguredHorizontalAlignment());
- setHorizontalAlignment(getConfiguredHorizontalAlignment());
-
- setDisplayable(getConfiguredDisplayable());
- setVisible(getConfiguredVisible());
-
- setInitialWidth(getConfiguredWidth());
- setInitialVisible(getConfiguredVisible());
- setInitialSortIndex(getConfiguredSortIndex());
- setInitialSortAscending(getConfiguredSortAscending());
- setInitialAlwaysIncludeSortAtBegin(getConfiguredAlwaysIncludeSortAtBegin());
- setInitialAlwaysIncludeSortAtEnd(getConfiguredAlwaysIncludeSortAtEnd());
- //
- double viewOrder = getConfiguredViewOrder();
- if (viewOrder < 0) {
- if (getClass().isAnnotationPresent(Order.class)) {
- Order order = (Order) getClass().getAnnotation(Order.class);
- viewOrder = order.value();
- }
- }
- setViewOrder(viewOrder);
- //
- setWidth(getConfiguredWidth());
- m_primaryKey = getConfiguredPrimaryKey();
- m_summary = getConfiguredSummary();
- setEditable(getConfiguredEditable());
- setVisibleColumnIndexHint(-1);
- if (getConfiguredForegroundColor() != null) {
- setForegroundColor((getConfiguredForegroundColor()));
- }
- if (getConfiguredBackgroundColor() != null) {
- setBackgroundColor((getConfiguredBackgroundColor()));
- }
- if (getConfiguredFont() != null) {
- setFont(FontSpec.parse(getConfiguredFont()));
- }
- }
-
- /*
- * Runtime
- */
-
- @Override
- public void initColumn() throws ProcessingException {
- ClientUIPreferences env = ClientUIPreferences.getInstance();
- setVisible(env.getTableColumnVisible(this, m_visibleProperty));
- setWidth(env.getTableColumnWidth(this, getWidth()));
- setVisibleColumnIndexHint(env.getTableColumnViewIndex(this, getVisibleColumnIndexHint()));
- //
- execInitColumn();
- }
-
- @Override
- public void disposeColumn() throws ProcessingException {
- execDisposeColumn();
- }
-
- @Override
- public boolean isInitialVisible() {
- return m_initialVisible;
- }
-
- @Override
- public void setInitialVisible(boolean b) {
- m_initialVisible = b;
- }
-
- @Override
- public int getInitialSortIndex() {
- return m_initialSortIndex;
- }
-
- @Override
- public void setInitialSortIndex(int i) {
- m_initialSortIndex = i;
- }
-
- @Override
- public boolean isInitialSortAscending() {
- return m_initialSortAscending;
- }
-
- @Override
- public void setInitialSortAscending(boolean b) {
- m_initialSortAscending = b;
- }
-
- @Override
- public boolean isInitialAlwaysIncludeSortAtBegin() {
- return m_initialAlwaysIncludeSortAtBegin;
- }
-
- @Override
- public void setInitialAlwaysIncludeSortAtBegin(boolean b) {
- m_initialAlwaysIncludeSortAtBegin = b;
- }
-
- @Override
- public boolean isInitialAlwaysIncludeSortAtEnd() {
- return m_initialAlwaysIncludeSortAtEnd;
- }
-
- @Override
- public void setInitialAlwaysIncludeSortAtEnd(boolean b) {
- m_initialAlwaysIncludeSortAtEnd = b;
- }
-
- /**
- * controls the displayable property of the column
- */
- @Override
- public void setVisiblePermission(Permission p) {
- boolean b;
- if (p != null) {
- b = SERVICES.getService(IAccessControlService.class).checkPermission(p);
- }
- else {
- b = true;
- }
- setVisibleGranted(b);
- }
-
- @Override
- public boolean isVisibleGranted() {
- return m_visibleGranted;
- }
-
- @Override
- public void setVisibleGranted(boolean b) {
- m_visibleGranted = b;
- calculateVisible();
- }
-
- @Override
- public ITable getTable() {
- return m_table;
- }
-
- /**
- * do not use this internal method
- */
- public void setTableInternal(ITable table) {
- m_table = table;
- }
-
- @Override
- public int getColumnIndex() {
- return m_headerCell.getColumnIndex();
- }
-
- @Override
- public String getColumnId() {
- String s = getClass().getSimpleName();
- if (s.endsWith("Column")) {
- s = s.replaceAll("Column$", "");
- }
- //do not remove other suffixes
- return s;
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public T getValue(ITableRow r) {
- return (r != null) ? (T) r.getCellValue(getColumnIndex()) : null;
- }
-
- @Override
- public T getValue(int rowIndex) {
- return getValue(getTable().getRow(rowIndex));
- }
-
- @Override
- public void setValue(int rowIndex, T rawValue) throws ProcessingException {
- setValue(getTable().getRow(rowIndex), rawValue);
- }
-
- @Override
- public void setValue(ITableRow r, T rawValue) throws ProcessingException {
- T newValue = validateValue(r, rawValue);
- r.setCellValue(getColumnIndex(), newValue);
- }
-
- @Override
- public void fill(T rawValue) throws ProcessingException {
- ITableRow[] rows = getTable().getRows();
- for (ITableRow row : rows) {
- setValue(row, rawValue);
- }
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public Class<T> getDataType() {
- return TypeCastUtility.getGenericsParameterClass(getClass(), IColumn.class);
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public T[] getValues() {
- T[] values = (T[]) Array.newInstance(getDataType(), m_table.getRowCount());
- for (int i = 0, ni = m_table.getRowCount(); i < ni; i++) {
- values[i] = getValue(m_table.getRow(i));
- }
- return values;
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public T[] getValues(ITableRow[] rows) {
- T[] values = (T[]) Array.newInstance(getDataType(), rows.length);
- for (int i = 0; i < rows.length; i++) {
- values[i] = getValue(rows[i]);
- }
- return values;
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public T[] getSelectedValues() {
- ITableRow[] rows = m_table.getSelectedRows();
- T[] values = (T[]) Array.newInstance(getDataType(), rows.length);
- for (int i = 0; i < rows.length; i++) {
- values[i] = getValue(rows[i]);
- }
- return values;
- }
-
- @Override
- public T getSelectedValue() {
- ITableRow row = m_table.getSelectedRow();
- if (row != null) {
- return getValue(row);
- }
- else {
- return null;
- }
- }
-
- @Override
- public String getDisplayText(ITableRow r) {
- return r.getCell(getColumnIndex()).getText();
- }
-
- @Override
- public String[] getDisplayTexts() {
- String[] values = new String[m_table.getRowCount()];
- for (int i = 0, ni = m_table.getRowCount(); i < ni; i++) {
- values[i] = getDisplayText(m_table.getRow(i));
- }
- return values;
- }
-
- @Override
- public String getSelectedDisplayText() {
- ITableRow row = m_table.getSelectedRow();
- if (row != null) {
- return getDisplayText(row);
- }
- else {
- return null;
- }
- }
-
- @Override
- public String[] getSelectedDisplayTexts() {
- ITableRow[] rows = m_table.getSelectedRows();
- String[] values = new String[rows.length];
- for (int i = 0; i < rows.length; i++) {
- values[i] = getDisplayText(rows[i]);
- }
- return values;
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public T[] getInsertedValues() {
- ITableRow[] rows = m_table.getInsertedRows();
- T[] values = (T[]) Array.newInstance(getDataType(), rows.length);
- for (int i = 0; i < rows.length; i++) {
- values[i] = getValue(rows[i]);
- }
- return values;
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public T[] getUpdatedValues() {
- ITableRow[] rows = m_table.getUpdatedRows();
- T[] values = (T[]) Array.newInstance(getDataType(), rows.length);
- for (int i = 0; i < rows.length; i++) {
- values[i] = getValue(rows[i]);
- }
- return values;
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public T[] getDeletedValues() {
- ITableRow[] rows = m_table.getDeletedRows();
- T[] values = (T[]) Array.newInstance(getDataType(), rows.length);
- for (int i = 0; i < rows.length; i++) {
- values[i] = getValue(rows[i]);
- }
- return values;
- }
-
- @Override
- public ITableRow[] findRows(T[] values) {
- ArrayList<ITableRow> rowList = new ArrayList<ITableRow>();
- if (values != null) {
- for (int i = 0; i < values.length; i++) {
- ITableRow row = findRow(values[i]);
- if (row != null) {
- rowList.add(row);
- }
- }
- }
- return rowList.toArray(new ITableRow[0]);
- }
-
- @Override
- public ITableRow[] findRows(T value) {
- ArrayList<ITableRow> rowList = new ArrayList<ITableRow>();
- for (int i = 0, ni = m_table.getRowCount(); i < ni; i++) {
- ITableRow row = m_table.getRow(i);
- if (CompareUtility.equals(value, getValue(row))) {
- rowList.add(row);
- }
- }
- return rowList.toArray(new ITableRow[0]);
- }
-
- @Override
- public ITableRow findRow(T value) {
- for (int i = 0, ni = m_table.getRowCount(); i < ni; i++) {
- ITableRow row = m_table.getRow(i);
- if (CompareUtility.equals(value, getValue(row))) {
- return row;
- }
- }
- return null;
- }
-
- @Override
- public boolean contains(T value) {
- for (int i = 0, ni = m_table.getRowCount(); i < ni; i++) {
- ITableRow row = m_table.getRow(i);
- if (CompareUtility.equals(value, getValue(row))) {
- return true;
- }
- }
- return false;
- }
-
- @Override
- public boolean containsDuplicateValues() {
- return new HashSet<T>(Arrays.asList(getValues())).size() < getValues().length;
- }
-
- @Override
- public boolean isEmpty() {
- if (m_table != null) {
- for (int i = 0, ni = m_table.getRowCount(); i < ni; i++) {
- Object value = getValue(m_table.getRow(i));
- if (value != null) {
- return false;
- }
- }
- }
- return true;
- }
-
- public void setColumnIndexInternal(int index) {
- m_headerCell.setColumnIndexInternal(index);
- }
-
- @Override
- public boolean isSortActive() {
- return getHeaderCell().isSortActive();
- }
-
- @Override
- public boolean isSortExplicit() {
- return getHeaderCell().isSortExplicit();
- }
-
- @Override
- public boolean isSortAscending() {
- return getHeaderCell().isSortAscending();
- }
-
- @Override
- public boolean isSortPermanent() {
- return getHeaderCell().isSortPermanent();
- }
-
- @Override
- public int getSortIndex() {
- ITable table = getTable();
- if (table != null) {
- ColumnSet cs = table.getColumnSet();
- if (cs != null) {
- return cs.getSortColumnIndex(this);
- }
- }
- return -1;
- }
-
- @Override
- public boolean isColumnFilterActive() {
- ITable table = getTable();
- if (table != null) {
- ITableColumnFilterManager m = table.getColumnFilterManager();
- if (m != null) {
- return m.getFilter(this) != null;
- }
- }
- return false;
- }
-
- /**
- * sorting of rows based on this column<br>
- * default: compare objects by Comparable interface or use value
- */
- @Override
- @SuppressWarnings("unchecked")
- public int compareTableRows(ITableRow r1, ITableRow r2) {
- int c;
- T o1 = getValue(r1);
- T o2 = getValue(r2);
- if (o1 == null && o2 == null) {
- c = 0;
- }
- else if (o1 == null) {
- c = -1;
- }
- else if (o2 == null) {
- c = 1;
- }
- else if ((o1 instanceof Comparable) && (o2 instanceof Comparable)) {
- c = ((Comparable) o1).compareTo(o2);
- }
- else {
- c = StringUtility.compareIgnoreCase(o1.toString(), o2.toString());
- }
- return c;
- }
-
- @Override
- public final T/* validValue */parseValue(ITableRow row, Object rawValue) throws ProcessingException {
- T parsedValue = execParseValue(row, rawValue);
- return validateValue(row, parsedValue);
- }
-
- /**
- * do not use or override this internal method<br>
- * subclasses perform specific value validations here and set the
- * default textual representation of the value
- */
- protected T/* validValue */parseValueInternal(ITableRow row, Object rawValue) throws ProcessingException {
- return TypeCastUtility.castValue(rawValue, getDataType());
- }
-
- @Override
- public T/* validValue */validateValue(ITableRow row, T rawValue) throws ProcessingException {
- return execValidateValue(row, rawValue);
- }
-
- /**
- * do not use or override this internal method<br>
- * subclasses perform specific value validations here and set the
- * default textual representation of the value
- */
- protected T/* validValue */validateValueInternal(ITableRow row, T rawValue) throws ProcessingException {
- return rawValue;
- }
-
- @Override
- public final IFormField prepareEdit(ITableRow row) throws ProcessingException {
- ITable table = getTable();
- if (table == null || !this.isCellEditable(row)) {
- return null;
- }
- IFormField f = execPrepareEdit(row);
- if (f != null) {
- f.setLabelVisible(false);
- GridData gd = f.getGridDataHints();
- gd.weightY = 1;
- f.setGridDataHints(gd);
- }
- return f;
- }
-
- /**
- * do not use or override this internal method
- */
- protected IFormField prepareEditInternal(ITableRow row) throws ProcessingException {
- AbstractValueField<T> f = new AbstractValueField<T>() {
- @Override
- public Class<T> getHolderType() {
- return AbstractColumn.this.getDataType();
- }
- };
- return f;
- }
-
- /**
- * Complete editing of a cell
- * <p>
- * By default this calls {@link #setValue(ITableRow, Object)} and delegates to
- * {@link #execParseValue(ITableRow, Object)} and {@link #execValidateValue(ITableRow, Object)}.
- */
- @Override
- public final void completeEdit(ITableRow row, IFormField editingField) throws ProcessingException {
- ITable table = getTable();
- if (table == null || !table.isCellEditable(row, this)) {
- return;
- }
- execCompleteEdit(row, editingField);
- }
-
- @Override
- public void decorateCell(ITableRow row) {
- Cell cell = row.getCellForUpdate(getColumnIndex());
- decorateCellInternal(cell, row);
- try {
- execDecorateCell(cell, row);
- }
- catch (ProcessingException e) {
- LOG.warn(null, e);
- }
- catch (Throwable t) {
- LOG.warn(null, t);
- }
- }
-
- /**
- * do not use or override this internal method
- */
- protected void decorateCellInternal(Cell cell, ITableRow row) {
- if (getForegroundColor() != null) {
- cell.setForegroundColor(getForegroundColor());
- }
- if (getBackgroundColor() != null) {
- cell.setBackgroundColor(getBackgroundColor());
- }
- if (getFont() != null) {
- cell.setFont(getFont());
- }
- cell.setHorizontalAlignment(getHorizontalAlignment());
- cell.setEditableInternal(isCellEditable(row));
- }
-
- @Override
- public void decorateHeaderCell() {
- HeaderCell cell = m_headerCell;
- decorateHeaderCellInternal(cell);
- try {
- execDecorateHeaderCell(cell);
- }
- catch (ProcessingException e) {
- LOG.warn(null, e);
- }
- catch (Throwable t) {
- LOG.warn(null, t);
- }
- }
-
- /**
- * do not use or override this internal method
- */
- protected void decorateHeaderCellInternal(HeaderCell cell) {
- }
-
- @Override
- public IHeaderCell getHeaderCell() {
- return m_headerCell;
- }
-
- @Override
- public int getVisibleColumnIndexHint() {
- return propertySupport.getPropertyInt(PROP_VIEW_COLUMN_INDEX_HINT);
- }
-
- @Override
- public void setVisibleColumnIndexHint(int index) {
- int oldIndex = getVisibleColumnIndexHint();
- if (oldIndex != index) {
- propertySupport.setPropertyInt(PROP_VIEW_COLUMN_INDEX_HINT, index);
- }
- }
-
- @Override
- public int getInitialWidth() {
- return m_initialWidth;
- }
-
- @Override
- public void setInitialWidth(int w) {
- m_initialWidth = w;
- }
-
- @Override
- public double getViewOrder() {
- return propertySupport.getPropertyDouble(PROP_VIEW_ORDER);
- }
-
- @Override
- public void setViewOrder(double order) {
- propertySupport.setPropertyDouble(PROP_VIEW_ORDER, order);
- }
-
- @Override
- public int getWidth() {
- return propertySupport.getPropertyInt(PROP_WIDTH);
- }
-
- @Override
- public void setWidth(int w) {
- propertySupport.setPropertyInt(PROP_WIDTH, w);
- }
-
- @Override
- public void setWidthInternal(int w) {
- propertySupport.setPropertyNoFire(PROP_WIDTH, w);
- }
-
- @Override
- public void setHorizontalAlignment(int hAglin) {
- propertySupport.setPropertyInt(PROP_HORIZONTAL_ALIGNMENT, hAglin);
- }
-
- @Override
- public int getHorizontalAlignment() {
- return propertySupport.getPropertyInt(PROP_HORIZONTAL_ALIGNMENT);
- }
-
- @Override
- public boolean isDisplayable() {
- return propertySupport.getPropertyBool(PROP_DISPLAYABLE);
- }
-
- @Override
- public void setDisplayable(boolean b) {
- propertySupport.setPropertyBool(PROP_DISPLAYABLE, b);
- calculateVisible();
- }
-
- @Override
- public boolean isVisible() {
- return propertySupport.getPropertyBool(PROP_VISIBLE);
- }
-
- @Override
- public void setVisible(boolean b) {
- m_visibleProperty = b;
- calculateVisible();
- }
-
- private void calculateVisible() {
- propertySupport.setPropertyBool(PROP_VISIBLE, m_visibleGranted && isDisplayable() && m_visibleProperty);
- }
-
- @Override
- public boolean isVisibleInternal() {
- return m_visibleProperty;
- }
-
- @Override
- public boolean isPrimaryKey() {
- return m_primaryKey;
- }
-
- @Override
- public boolean isSummary() {
- return m_summary;
- }
-
- @Override
- public boolean isEditable() {
- return propertySupport.getPropertyBool(PROP_EDITABLE);
- }
-
- @Override
- public void setEditable(boolean b) {
- propertySupport.setPropertyBool(PROP_EDITABLE, b);
- }
-
- @Override
- public boolean isCellEditable(ITableRow row) {
- if (getTable() != null && getTable().isEnabled() && this.isEditable() && row != null && row.isEnabled() && row.getCell(this).isEnabled()) {
- try {
- return execIsEditable(row);
- }
- catch (Throwable t) {
- LOG.error("checking row " + row, t);
- return false;
- }
- }
- return false;
- }
-
- @Override
- public String getForegroundColor() {
- return (String) propertySupport.getProperty(PROP_FOREGROUND_COLOR);
- }
-
- @Override
- public void setForegroundColor(String c) {
- propertySupport.setProperty(PROP_FOREGROUND_COLOR, c);
- }
-
- @Override
- public String getBackgroundColor() {
- return (String) propertySupport.getProperty(PROP_BACKGROUND_COLOR);
- }
-
- @Override
- public void setBackgroundColor(String c) {
- propertySupport.setProperty(PROP_BACKGROUND_COLOR, c);
- }
-
- @Override
- public FontSpec getFont() {
- return (FontSpec) propertySupport.getProperty(PROP_FONT);
- }
-
- @Override
- public void setFont(FontSpec f) {
- propertySupport.setProperty(PROP_FONT, f);
- }
-
- /**
- * true: Whenever table content changes, automatically calculate optimized column width so that all column content is
- * displayed without
- * cropping.
- * <p>
- * This may display a horizontal scroll bar on the table.
- */
- @Override
- public boolean isAutoOptimizeWidth() {
- return propertySupport.getPropertyBool(PROP_AUTO_OPTIMIZE_WIDTH);
- }
-
- @Override
- public void setAutoOptimizeWidth(boolean optimize) {
- propertySupport.setPropertyBool(PROP_AUTO_OPTIMIZE_WIDTH, optimize);
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName() + "[" + getHeaderCell().getText() + " width=" + getWidth() + (isPrimaryKey() ? " primaryKey" : "") + (isSummary() ? " summary" : "") + " viewIndexHint=" + getVisibleColumnIndexHint() + "]";
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table.columns;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.lang.reflect.Array;
+import java.security.Permission;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.TypeCastUtility;
+import org.eclipse.scout.commons.annotations.ConfigOperation;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.beans.AbstractPropertyObserver;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.ClientUIPreferences;
+import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
+import org.eclipse.scout.rt.client.ui.basic.table.AbstractTable;
+import org.eclipse.scout.rt.client.ui.basic.table.ColumnSet;
+import org.eclipse.scout.rt.client.ui.basic.table.HeaderCell;
+import org.eclipse.scout.rt.client.ui.basic.table.IHeaderCell;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.client.ui.basic.table.columnfilter.ITableColumnFilterManager;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.AbstractPageWithTable;
+import org.eclipse.scout.rt.client.ui.form.AbstractForm;
+import org.eclipse.scout.rt.client.ui.form.fields.AbstractValueField;
+import org.eclipse.scout.rt.client.ui.form.fields.GridData;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
+import org.eclipse.scout.rt.client.ui.form.fields.tablefield.AbstractTableField;
+import org.eclipse.scout.rt.shared.data.basic.FontSpec;
+import org.eclipse.scout.rt.shared.data.form.AbstractFormData;
+import org.eclipse.scout.rt.shared.services.common.security.IAccessControlService;
+import org.eclipse.scout.service.SERVICES;
+
+public abstract class AbstractColumn<T> extends AbstractPropertyObserver implements IColumn<T> {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractColumn.class);
+
+ // DO NOT init members, this has the same effect as if they were set AFTER
+ // initConfig()
+ private ITable m_table;
+ private final HeaderCell m_headerCell;
+ private boolean m_primaryKey;
+ private boolean m_summary;
+ /**
+ * A column is presented to the user when it is displayable AND visible this
+ * column is visible to the user only used when displayable=true
+ */
+ private boolean m_visibleProperty;
+ private boolean m_visibleGranted;
+ private int m_initialWidth;
+ private boolean m_initialVisible;
+ private int m_initialSortIndex;
+ private boolean m_initialSortAscending;
+ private boolean m_initialAlwaysIncludeSortAtBegin;
+ private boolean m_initialAlwaysIncludeSortAtEnd;
+
+ public AbstractColumn() {
+ m_headerCell = new HeaderCell();
+ initConfig();
+ propertySupport.addPropertyChangeListener(new PropertyChangeListener() {
+
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ // force decoration of rows on property change.
+ // This is important to recalculate editability of editable cells.
+ ITable table = getTable();
+ if (table != null) {
+ table.updateAllRows();
+ }
+ }
+ });
+ }
+
+ /*
+ * Configuration
+ */
+
+ /**
+ * Configures the visibility of this column. If the column must be visible for the user, it must be displayable too
+ * (see {@link #getConfiguredDisplayable()}).
+ * <p>
+ * Subclasses can override this method. Default is {@code true}.
+ *
+ * @return {@code true} if this column is visible, {@code false} otherwise.
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(10)
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredVisible() {
+ return true;
+ }
+
+ /**
+ * Configures the header text of this column.
+ * <p>
+ * Subclasses can override this method. Default is {@code null}.
+ *
+ * @return Header text of this column.
+ */
+ @ConfigProperty(ConfigProperty.TEXT)
+ @Order(20)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredHeaderText() {
+ return null;
+ }
+
+ /**
+ * Configures the header tooltip of this column.
+ * <p>
+ * Subclasses can override this method. Default is {@code null}.
+ *
+ * @return Tooltip of this column.
+ */
+ @ConfigProperty(ConfigProperty.TEXT)
+ @Order(30)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredHeaderTooltipText() {
+ return null;
+ }
+
+ /**
+ * Configures the color of this column header text. The color is represented by the HEX value (e.g. FFFFFF).
+ * <p>
+ * Subclasses can override this method. Default is {@code null}.
+ *
+ * @return Foreground color HEX value of this column header text.
+ */
+ @ConfigProperty(ConfigProperty.COLOR)
+ @Order(40)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredHeaderForegroundColor() {
+ return null;
+ }
+
+ /**
+ * Configures the background color of this column header. The color is represented by the HEX value (e.g. FFFFFF).
+ * <p>
+ * Subclasses can override this method. Default is {@code null}.
+ *
+ * @return Background color HEX value of this column header.
+ */
+ @ConfigProperty(ConfigProperty.COLOR)
+ @Order(50)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredHeaderBackgroundColor() {
+ return null;
+ }
+
+ /**
+ * Configures the font of this column header text. See {@link FontSpec#parse(String)} for the appropriate format.
+ * <p>
+ * Subclasses can override this method. Default is {@code null}.
+ *
+ * @return Font of this column header text.
+ */
+ @ConfigProperty(ConfigProperty.STRING)
+ @Order(60)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredHeaderFont() {
+ return null;
+ }
+
+ /**
+ * Configures the width of this column. The width of a column is represented by an {@code int}. If the table's auto
+ * resize flag is set (see {@link AbstractTable#getConfiguredAutoResizeColumns()} ), the ratio of the column widths
+ * determines the real column width. If the flag is not set, the column's width is represented by the configured
+ * width.
+ * <p>
+ * Subclasses can override this method. Default is {@code 60}.
+ *
+ * @return Width of this column.
+ */
+ @ConfigProperty(ConfigProperty.INTEGER)
+ @Order(70)
+ @ConfigPropertyValue("60")
+ protected int getConfiguredWidth() {
+ return 60;
+ }
+
+ /**
+ * Configures whether the column is displayable or not. A non-displayable column is always invisible for the user. A
+ * displayable column may be visible for a user, depending on {@link #getConfiguredVisible()}.
+ * <p>
+ * Subclasses can override this method. Default is {@code true}.
+ *
+ * @return {@code true} if this column is displayable, {@code false} otherwise.
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(80)
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredDisplayable() {
+ return true;
+ }
+
+ /**
+ * Configures whether this column value belongs to the primary key of the surrounding table. The table's primary key
+ * might consist of several columns. The primary key can be used to find the appropriate row by calling
+ * {@link AbstractTable#findRowByKey(Object[])}.
+ * <p>
+ * Subclasses can override this method. Default is {@code false}.
+ *
+ * @return {@code true} if this column value belongs to the primary key of the surrounding table, {@code false}
+ * otherwise.
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(90)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredPrimaryKey() {
+ return false;
+ }
+
+ /**
+ * Configures whether this column is editable or not. A user might directly modify the value of an editable column. A
+ * non-editable column is read-only.
+ * <p>
+ * Subclasses can override this method. Default is {@code false}.
+ *
+ * @return {@code true} if this column is editable, {@code false} otherwise.
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(95)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredEditable() {
+ return false;
+ }
+
+ /**
+ * Configures whether this column is a summary column. Summary columns are used in case of a table with children. The
+ * label of the child node is based on the value of the summary columns. See {@link ITable#getSummaryCell(ITableRow)}
+ * for more information.
+ * <p>
+ * Subclasses can override this method. Default is {@code false}.
+ *
+ * @return {@code true} if this column is a summary column, {@code false} otherwise.
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(100)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredSummary() {
+ return false;
+ }
+
+ /**
+ * Configures the color of this column text (except color of header text, see
+ * {@link #getConfiguredHeaderForegroundColor()}). The color is represented by the HEX value (e.g. FFFFFF).
+ * <p>
+ * Subclasses can override this method. Default is {@code null}.
+ *
+ * @return Foreground color HEX value of this column text.
+ */
+ @ConfigProperty(ConfigProperty.COLOR)
+ @Order(110)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredForegroundColor() {
+ return null;
+ }
+
+ /**
+ * Configures the background color of this column (except background color of header, see
+ * {@link #getConfiguredHeaderBackgroundColor()}. The color is represented by the HEX value (e.g. FFFFFF).
+ * <p>
+ * Subclasses can override this method. Default is {@code null}.
+ *
+ * @return Background color HEX value of this column.
+ */
+ @ConfigProperty(ConfigProperty.COLOR)
+ @Order(120)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredBackgroundColor() {
+ return null;
+ }
+
+ /**
+ * Configures the font of this column text (except header text, see {@link #getConfiguredHeaderFont()}). See
+ * {@link FontSpec#parse(String)} for the appropriate format.
+ * <p>
+ * Subclasses can override this method. Default is {@code null}.
+ *
+ * @return Font of this column text.
+ */
+ @ConfigProperty(ConfigProperty.STRING)
+ @Order(130)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredFont() {
+ return null;
+ }
+
+ /**
+ * Configures the sort index of this column. A sort index {@code < 0} means that the column is not considered for
+ * sorting. For a column to be considered for sorting, the sort index must be {@code >= 0}. Several columns
+ * might have set a sort index. Sorting starts with the column having the the lowest sort index ({@code >= 0}).
+ * <p>
+ * Subclasses can override this method. Default is {@code -1}.
+ *
+ * @return Sort index of this column.
+ */
+ @ConfigProperty(ConfigProperty.INTEGER)
+ @Order(140)
+ @ConfigPropertyValue("-1")
+ protected int getConfiguredSortIndex() {
+ return -1;
+ }
+
+ /**
+ * Configures the view order of this column. The view order determines the order in which the columns appear. The view
+ * order of column with no view order configured ({@code < 0}) is initialized based on the order annotation of the
+ * column class.
+ * <p>
+ * Subclasses can override this method. Default is {@code -1}.
+ *
+ * @return View order of this column.
+ */
+ @ConfigProperty(ConfigProperty.DOUBLE)
+ @Order(145)
+ @ConfigPropertyValue("-1")
+ protected double getConfiguredViewOrder() {
+ return -1;
+ }
+
+ /**
+ * Configures whether this column is sorted ascending or descending. For a column to be sorted at all, a sort index
+ * must be set (see {@link #getConfiguredSortIndex()}).
+ * <p>
+ * Subclasses can override this method. Default is {@code true}.
+ *
+ * @return {@code true} if this column is sorted ascending, {@code false} otherwise.
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(150)
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredSortAscending() {
+ return true;
+ }
+
+ /**
+ * Configures whether this column is always included for sort at begin, independent of a sort change by the user. If
+ * set to {@code true}, the sort index (see {@link #getConfiguredSortIndex()}) must be set.
+ * <p>
+ * Subclasses can override this method. Default is {@code false}.
+ *
+ * @return {@code true} if this column is always included for sort at begin, {@code false} otherwise.
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(160)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredAlwaysIncludeSortAtBegin() {
+ return false;
+ }
+
+ /**
+ * Configures whether this column is always included for sort at end, independent of a sort change by the user. If set
+ * to {@code true}, the sort index (see {@link #getConfiguredSortIndex()}) must be set.
+ * <p>
+ * Subclasses can override this method. Default is {@code false}.
+ *
+ * @return {@code true} if this column is always included for sort at end, {@code false} otherwise.
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(170)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredAlwaysIncludeSortAtEnd() {
+ return false;
+ }
+
+ /**
+ * Configures the horizontal alignment of text inside this column (including header text).
+ * <p>
+ * Subclasses can override this method. Default is {@code -1} (left alignment).
+ *
+ * @return {@code -1} for left, {@code 0} for center and {@code 1} for right alignment.
+ */
+ @ConfigProperty(ConfigProperty.INTEGER)
+ @Order(180)
+ @ConfigPropertyValue("-1")
+ protected int getConfiguredHorizontalAlignment() {
+ return -1;
+ }
+
+ /**
+ * Configures whether the column width is auto optimized. If true: Whenever the table content changes, the optimized
+ * column width is automatically calculated so that all column content is displayed without cropping.
+ * <p>
+ * This may display a horizontal scroll bar on the table.
+ * <p>
+ * This feature is not supported in SWT and RWT since SWT does not offer such an API method.
+ * <p>
+ * Subclasses can override this method. Default is {@code false}.
+ *
+ * @return {@code true} if this column width is auto optimized, {@code false} otherwise.
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(190)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredAutoOptimizeWidth() {
+ return false;
+ }
+
+ /**
+ * Provides a documentation text or description of this column. The text is intended to be included in external
+ * documentation. This method is typically processed by a documentation generation tool or similar.
+ * <p>
+ * Subclasses can override this method. Default is {@code null}.
+ *
+ * @return a documentation text, suitable to be included in external documents
+ */
+ @ConfigProperty(ConfigProperty.DOC)
+ @Order(200)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredDoc() {
+ return null;
+ }
+
+ /**
+ * Configures whether this column value is mandatory / required. This only affects editable columns (see
+ * {@link #getConfiguredEditable()} ).
+ * <p>
+ * Subclasses can override this method. Default is {@code false}.
+ *
+ * @return {@code true} if this column value is mandatory, {@code false} otherwise.
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(210)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredMandatory() {
+ return false;
+ }
+
+ /**
+ * Called after this column has been added to the column set of the surrounding table. This method may execute
+ * additional initialization for this column (e.g. register listeners).
+ * <p>
+ * Do not load table data here, this should be done lazily in {@link AbstractPageWithTable#execLoadTableData()},
+ * {@link AbstractTableField#reloadTableData()} or via {@link AbstractForm#importFormData(AbstractFormData)}.
+ * <p>
+ * Subclasses can override this method. The default does nothing.
+ *
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(10)
+ protected void execInitColumn() throws ProcessingException {
+ }
+
+ /**
+ * Called when the surrounding table is disposed. This method may execute additional cleanup.
+ * <p>
+ * Subclasses can override this method. The default does nothing.
+ *
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(15)
+ protected void execDisposeColumn() throws ProcessingException {
+ }
+
+ /**
+ * Parse is the process of transforming an arbitrary object to the correct type or throwing an exception.
+ * <p>
+ * see also {@link #execValidateValue(ITableRow, Object)}
+ * <p>
+ * Subclasses can override this method. The default calls {@link #parseValueInternal(ITableRow, Object)}.
+ *
+ * @param row
+ * Table row for which to parse the raw value.
+ * @param rawValue
+ * Raw value to parse.
+ * @return Value in correct type, derived from rawValue.
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(20)
+ protected T/* validValue */execParseValue(ITableRow row, Object rawValue) throws ProcessingException {
+ return parseValueInternal(row, rawValue);
+ }
+
+ /**
+ * Validate is the process of checking range, domain, bounds, correctness etc. of an already correctly typed value or
+ * throwing an exception.
+ * <p>
+ * see also {@link #execParseValue(ITableRow, Object)}
+ * <p>
+ * Subclasses can override this method. The default calls {@link #validateValueInternal(ITableRow, Object)}.
+ *
+ * @param row
+ * Table row for which to validate the raw value.
+ * @param rawValue
+ * Already parsed raw value to validate.
+ * @return Validated value
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(30)
+ protected T/* validValue */execValidateValue(ITableRow row, T rawValue) throws ProcessingException {
+ return validateValueInternal(row, rawValue);
+ }
+
+ /**
+ * Called when decorating the table cell. This method may add additional decorations to the table cell.
+ * <p>
+ * Subclasses can override this method. The default does nothing.
+ *
+ * @param cell
+ * Cell to decorate.
+ * @param row
+ * Table row of cell.
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(40)
+ protected void execDecorateCell(Cell cell, ITableRow row) throws ProcessingException {
+ }
+
+ /**
+ * Called when decorating the table header cell. This method may add additional decorations to the table header cell.
+ * <p>
+ * Subclasses can override this method. The default does nothing.
+ *
+ * @param cell
+ * Header cell to decorate.
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(50)
+ protected void execDecorateHeaderCell(HeaderCell cell) throws ProcessingException {
+ }
+
+ /**
+ * Only called if {@link #getConfiguredEditable()} is true and cell, row and table are enabled. Use this method only
+ * for dynamic checks of editablility, otherwise use {@link #getConfiguredEditable()}.
+ * <p>
+ * Subclasses can override this method. Default is {@code true}.
+ *
+ * @param row
+ * for which to determine editability dynamically.
+ * @return {@code true} if the cell (row, column) is editable, {@code false} otherwise.
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(60)
+ protected boolean execIsEditable(ITableRow row) throws ProcessingException {
+ return true;
+ }
+
+ /**
+ * Prepares the editing of a cell in the table.
+ * <p>
+ * Cell editing is canceled (normally by typing escape) or saved (normally by clicking another cell, typing enter).
+ * <p>
+ * When saved, the method {@link #completeEdit(ITableRow, IFormField)} /
+ * {@link #execCompleteEdit(ITableRow, IFormField)} is called on this column.
+ * <p>
+ * Subclasses can override this method. The default returns an appropriate field based on the column data type.
+ *
+ * @param row
+ * on which editing occurs
+ * @return a field for editing or null to install an empty cell editor.
+ */
+ @SuppressWarnings("unchecked")
+ @ConfigOperation
+ @Order(61)
+ protected IFormField execPrepareEdit(ITableRow row) throws ProcessingException {
+ IFormField f = prepareEditInternal(row);
+ if (f != null) {
+ f.setLabelVisible(false);
+ if (getConfiguredMandatory()) {
+ f.setMandatory(true);
+ }
+ GridData gd = f.getGridDataHints();
+ // apply horizontal alignment of column to respective editor field
+ gd.horizontalAlignment = getHorizontalAlignment();
+ f.setGridDataHints(gd);
+ if (f instanceof IValueField<?>) {
+ ((IValueField<T>) f).setValue(getValue(row));
+ }
+ f.markSaved();
+ }
+ return f;
+ }
+
+ /**
+ * Completes editing of a cell.
+ * <p>
+ * Subclasses can override this method. The default calls {@link #applyValueInternal(ITableRow, Object)} and delegates
+ * to {@link #execParseValue(ITableRow, Object)} and {@link #execValidateValue(ITableRow, Object)}.
+ *
+ * @param row
+ * on which editing occurred.
+ * @param editingField
+ * Field which was used to edit cell value (as returned by {@link #execPrepareEdit(ITableRow)}).
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(62)
+ protected void execCompleteEdit(ITableRow row, IFormField editingField) throws ProcessingException {
+ if (editingField instanceof IValueField) {
+ IValueField v = (IValueField) editingField;
+ if (v.isSaveNeeded()) {
+ applyValueInternal(row, parseValue(row, ((IValueField) editingField).getValue()));
+ }
+ }
+ }
+
+ /**
+ * <p>
+ * Updates the value of the cell with the given value.
+ * </p>
+ * <p>
+ * Thereby, if sorting is enabled on table, it is temporarily suspended to prevent rows from scampering.
+ * </p>
+ *
+ * @param row
+ * @param newValue
+ * @throws ProcessingException
+ */
+ protected void applyValueInternal(ITableRow row, T newValue) throws ProcessingException {
+ if (!getTable().isSortEnabled()) {
+ setValue(row, newValue);
+ }
+ else {
+ // suspend sorting to prevent rows from scampering
+ try {
+ getTable().setSortEnabled(false);
+ setValue(row, newValue);
+ }
+ finally {
+ getTable().setSortEnabled(true);
+ }
+ }
+ }
+
+ protected void initConfig() {
+ setAutoOptimizeWidth(getConfiguredAutoOptimizeWidth());
+ m_visibleGranted = true;
+ m_headerCell.setText(getConfiguredHeaderText());
+ if (getConfiguredHeaderTooltipText() != null) {
+ m_headerCell.setTooltipText(getConfiguredHeaderTooltipText());
+ }
+ if (getConfiguredHeaderForegroundColor() != null) {
+ m_headerCell.setForegroundColor((getConfiguredHeaderForegroundColor()));
+ }
+ if (getConfiguredHeaderBackgroundColor() != null) {
+ m_headerCell.setBackgroundColor((getConfiguredHeaderBackgroundColor()));
+ }
+ if (getConfiguredHeaderFont() != null) {
+ m_headerCell.setFont(FontSpec.parse(getConfiguredHeaderFont()));
+ }
+ m_headerCell.setHorizontalAlignment(getConfiguredHorizontalAlignment());
+ setHorizontalAlignment(getConfiguredHorizontalAlignment());
+
+ setDisplayable(getConfiguredDisplayable());
+ setVisible(getConfiguredVisible());
+
+ setInitialWidth(getConfiguredWidth());
+ setInitialVisible(getConfiguredVisible());
+ setInitialSortIndex(getConfiguredSortIndex());
+ setInitialSortAscending(getConfiguredSortAscending());
+ setInitialAlwaysIncludeSortAtBegin(getConfiguredAlwaysIncludeSortAtBegin());
+ setInitialAlwaysIncludeSortAtEnd(getConfiguredAlwaysIncludeSortAtEnd());
+ //
+ double viewOrder = getConfiguredViewOrder();
+ if (viewOrder < 0) {
+ if (getClass().isAnnotationPresent(Order.class)) {
+ Order order = (Order) getClass().getAnnotation(Order.class);
+ viewOrder = order.value();
+ }
+ }
+ setViewOrder(viewOrder);
+ //
+ setWidth(getConfiguredWidth());
+ m_primaryKey = getConfiguredPrimaryKey();
+ m_summary = getConfiguredSummary();
+ setEditable(getConfiguredEditable());
+ setVisibleColumnIndexHint(-1);
+ if (getConfiguredForegroundColor() != null) {
+ setForegroundColor((getConfiguredForegroundColor()));
+ }
+ if (getConfiguredBackgroundColor() != null) {
+ setBackgroundColor((getConfiguredBackgroundColor()));
+ }
+ if (getConfiguredFont() != null) {
+ setFont(FontSpec.parse(getConfiguredFont()));
+ }
+ }
+
+ /*
+ * Runtime
+ */
+
+ @Override
+ public void initColumn() throws ProcessingException {
+ ClientUIPreferences env = ClientUIPreferences.getInstance();
+ setVisible(env.getTableColumnVisible(this, m_visibleProperty));
+ setWidth(env.getTableColumnWidth(this, getWidth()));
+ setVisibleColumnIndexHint(env.getTableColumnViewIndex(this, getVisibleColumnIndexHint()));
+ //
+ execInitColumn();
+ }
+
+ @Override
+ public void disposeColumn() throws ProcessingException {
+ execDisposeColumn();
+ }
+
+ @Override
+ public boolean isInitialVisible() {
+ return m_initialVisible;
+ }
+
+ @Override
+ public void setInitialVisible(boolean b) {
+ m_initialVisible = b;
+ }
+
+ @Override
+ public int getInitialSortIndex() {
+ return m_initialSortIndex;
+ }
+
+ @Override
+ public void setInitialSortIndex(int i) {
+ m_initialSortIndex = i;
+ }
+
+ @Override
+ public boolean isInitialSortAscending() {
+ return m_initialSortAscending;
+ }
+
+ @Override
+ public void setInitialSortAscending(boolean b) {
+ m_initialSortAscending = b;
+ }
+
+ @Override
+ public boolean isInitialAlwaysIncludeSortAtBegin() {
+ return m_initialAlwaysIncludeSortAtBegin;
+ }
+
+ @Override
+ public void setInitialAlwaysIncludeSortAtBegin(boolean b) {
+ m_initialAlwaysIncludeSortAtBegin = b;
+ }
+
+ @Override
+ public boolean isInitialAlwaysIncludeSortAtEnd() {
+ return m_initialAlwaysIncludeSortAtEnd;
+ }
+
+ @Override
+ public void setInitialAlwaysIncludeSortAtEnd(boolean b) {
+ m_initialAlwaysIncludeSortAtEnd = b;
+ }
+
+ /**
+ * controls the displayable property of the column
+ */
+ @Override
+ public void setVisiblePermission(Permission p) {
+ boolean b;
+ if (p != null) {
+ b = SERVICES.getService(IAccessControlService.class).checkPermission(p);
+ }
+ else {
+ b = true;
+ }
+ setVisibleGranted(b);
+ }
+
+ @Override
+ public boolean isVisibleGranted() {
+ return m_visibleGranted;
+ }
+
+ @Override
+ public void setVisibleGranted(boolean b) {
+ m_visibleGranted = b;
+ calculateVisible();
+ }
+
+ @Override
+ public ITable getTable() {
+ return m_table;
+ }
+
+ /**
+ * do not use this internal method
+ */
+ public void setTableInternal(ITable table) {
+ m_table = table;
+ }
+
+ @Override
+ public int getColumnIndex() {
+ return m_headerCell.getColumnIndex();
+ }
+
+ @Override
+ public String getColumnId() {
+ String s = getClass().getSimpleName();
+ if (s.endsWith("Column")) {
+ s = s.replaceAll("Column$", "");
+ }
+ //do not remove other suffixes
+ return s;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public T getValue(ITableRow r) {
+ return (r != null) ? (T) r.getCellValue(getColumnIndex()) : null;
+ }
+
+ @Override
+ public T getValue(int rowIndex) {
+ return getValue(getTable().getRow(rowIndex));
+ }
+
+ @Override
+ public void setValue(int rowIndex, T rawValue) throws ProcessingException {
+ setValue(getTable().getRow(rowIndex), rawValue);
+ }
+
+ @Override
+ public void setValue(ITableRow r, T rawValue) throws ProcessingException {
+ T newValue = validateValue(r, rawValue);
+ r.setCellValue(getColumnIndex(), newValue);
+ }
+
+ @Override
+ public void fill(T rawValue) throws ProcessingException {
+ ITableRow[] rows = getTable().getRows();
+ for (ITableRow row : rows) {
+ setValue(row, rawValue);
+ }
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Class<T> getDataType() {
+ return TypeCastUtility.getGenericsParameterClass(getClass(), IColumn.class);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public T[] getValues() {
+ T[] values = (T[]) Array.newInstance(getDataType(), m_table.getRowCount());
+ for (int i = 0, ni = m_table.getRowCount(); i < ni; i++) {
+ values[i] = getValue(m_table.getRow(i));
+ }
+ return values;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public T[] getValues(ITableRow[] rows) {
+ T[] values = (T[]) Array.newInstance(getDataType(), rows.length);
+ for (int i = 0; i < rows.length; i++) {
+ values[i] = getValue(rows[i]);
+ }
+ return values;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public T[] getSelectedValues() {
+ ITableRow[] rows = m_table.getSelectedRows();
+ T[] values = (T[]) Array.newInstance(getDataType(), rows.length);
+ for (int i = 0; i < rows.length; i++) {
+ values[i] = getValue(rows[i]);
+ }
+ return values;
+ }
+
+ @Override
+ public T getSelectedValue() {
+ ITableRow row = m_table.getSelectedRow();
+ if (row != null) {
+ return getValue(row);
+ }
+ else {
+ return null;
+ }
+ }
+
+ @Override
+ public String getDisplayText(ITableRow r) {
+ return r.getCell(getColumnIndex()).getText();
+ }
+
+ @Override
+ public String[] getDisplayTexts() {
+ String[] values = new String[m_table.getRowCount()];
+ for (int i = 0, ni = m_table.getRowCount(); i < ni; i++) {
+ values[i] = getDisplayText(m_table.getRow(i));
+ }
+ return values;
+ }
+
+ @Override
+ public String getSelectedDisplayText() {
+ ITableRow row = m_table.getSelectedRow();
+ if (row != null) {
+ return getDisplayText(row);
+ }
+ else {
+ return null;
+ }
+ }
+
+ @Override
+ public String[] getSelectedDisplayTexts() {
+ ITableRow[] rows = m_table.getSelectedRows();
+ String[] values = new String[rows.length];
+ for (int i = 0; i < rows.length; i++) {
+ values[i] = getDisplayText(rows[i]);
+ }
+ return values;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public T[] getInsertedValues() {
+ ITableRow[] rows = m_table.getInsertedRows();
+ T[] values = (T[]) Array.newInstance(getDataType(), rows.length);
+ for (int i = 0; i < rows.length; i++) {
+ values[i] = getValue(rows[i]);
+ }
+ return values;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public T[] getUpdatedValues() {
+ ITableRow[] rows = m_table.getUpdatedRows();
+ T[] values = (T[]) Array.newInstance(getDataType(), rows.length);
+ for (int i = 0; i < rows.length; i++) {
+ values[i] = getValue(rows[i]);
+ }
+ return values;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public T[] getDeletedValues() {
+ ITableRow[] rows = m_table.getDeletedRows();
+ T[] values = (T[]) Array.newInstance(getDataType(), rows.length);
+ for (int i = 0; i < rows.length; i++) {
+ values[i] = getValue(rows[i]);
+ }
+ return values;
+ }
+
+ @Override
+ public ITableRow[] findRows(T[] values) {
+ ArrayList<ITableRow> rowList = new ArrayList<ITableRow>();
+ if (values != null) {
+ for (int i = 0; i < values.length; i++) {
+ ITableRow row = findRow(values[i]);
+ if (row != null) {
+ rowList.add(row);
+ }
+ }
+ }
+ return rowList.toArray(new ITableRow[0]);
+ }
+
+ @Override
+ public ITableRow[] findRows(T value) {
+ ArrayList<ITableRow> rowList = new ArrayList<ITableRow>();
+ for (int i = 0, ni = m_table.getRowCount(); i < ni; i++) {
+ ITableRow row = m_table.getRow(i);
+ if (CompareUtility.equals(value, getValue(row))) {
+ rowList.add(row);
+ }
+ }
+ return rowList.toArray(new ITableRow[0]);
+ }
+
+ @Override
+ public ITableRow findRow(T value) {
+ for (int i = 0, ni = m_table.getRowCount(); i < ni; i++) {
+ ITableRow row = m_table.getRow(i);
+ if (CompareUtility.equals(value, getValue(row))) {
+ return row;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public boolean contains(T value) {
+ for (int i = 0, ni = m_table.getRowCount(); i < ni; i++) {
+ ITableRow row = m_table.getRow(i);
+ if (CompareUtility.equals(value, getValue(row))) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public boolean containsDuplicateValues() {
+ return new HashSet<T>(Arrays.asList(getValues())).size() < getValues().length;
+ }
+
+ @Override
+ public boolean isEmpty() {
+ if (m_table != null) {
+ for (int i = 0, ni = m_table.getRowCount(); i < ni; i++) {
+ Object value = getValue(m_table.getRow(i));
+ if (value != null) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ public void setColumnIndexInternal(int index) {
+ m_headerCell.setColumnIndexInternal(index);
+ }
+
+ @Override
+ public boolean isSortActive() {
+ return getHeaderCell().isSortActive();
+ }
+
+ @Override
+ public boolean isSortExplicit() {
+ return getHeaderCell().isSortExplicit();
+ }
+
+ @Override
+ public boolean isSortAscending() {
+ return getHeaderCell().isSortAscending();
+ }
+
+ @Override
+ public boolean isSortPermanent() {
+ return getHeaderCell().isSortPermanent();
+ }
+
+ @Override
+ public int getSortIndex() {
+ ITable table = getTable();
+ if (table != null) {
+ ColumnSet cs = table.getColumnSet();
+ if (cs != null) {
+ return cs.getSortColumnIndex(this);
+ }
+ }
+ return -1;
+ }
+
+ @Override
+ public boolean isColumnFilterActive() {
+ ITable table = getTable();
+ if (table != null) {
+ ITableColumnFilterManager m = table.getColumnFilterManager();
+ if (m != null) {
+ return m.getFilter(this) != null;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * sorting of rows based on this column<br>
+ * default: compare objects by Comparable interface or use value
+ */
+ @Override
+ @SuppressWarnings("unchecked")
+ public int compareTableRows(ITableRow r1, ITableRow r2) {
+ int c;
+ T o1 = getValue(r1);
+ T o2 = getValue(r2);
+ if (o1 == null && o2 == null) {
+ c = 0;
+ }
+ else if (o1 == null) {
+ c = -1;
+ }
+ else if (o2 == null) {
+ c = 1;
+ }
+ else if ((o1 instanceof Comparable) && (o2 instanceof Comparable)) {
+ c = ((Comparable) o1).compareTo(o2);
+ }
+ else {
+ c = StringUtility.compareIgnoreCase(o1.toString(), o2.toString());
+ }
+ return c;
+ }
+
+ @Override
+ public final T/* validValue */parseValue(ITableRow row, Object rawValue) throws ProcessingException {
+ T parsedValue = execParseValue(row, rawValue);
+ return validateValue(row, parsedValue);
+ }
+
+ /**
+ * do not use or override this internal method<br>
+ * subclasses perform specific value validations here and set the
+ * default textual representation of the value
+ */
+ protected T/* validValue */parseValueInternal(ITableRow row, Object rawValue) throws ProcessingException {
+ return TypeCastUtility.castValue(rawValue, getDataType());
+ }
+
+ @Override
+ public T/* validValue */validateValue(ITableRow row, T rawValue) throws ProcessingException {
+ return execValidateValue(row, rawValue);
+ }
+
+ /**
+ * do not use or override this internal method<br>
+ * subclasses perform specific value validations here and set the
+ * default textual representation of the value
+ */
+ protected T/* validValue */validateValueInternal(ITableRow row, T rawValue) throws ProcessingException {
+ return rawValue;
+ }
+
+ @Override
+ public final IFormField prepareEdit(ITableRow row) throws ProcessingException {
+ ITable table = getTable();
+ if (table == null || !this.isCellEditable(row)) {
+ return null;
+ }
+ IFormField f = execPrepareEdit(row);
+ if (f != null) {
+ f.setLabelVisible(false);
+ GridData gd = f.getGridDataHints();
+ gd.weightY = 1;
+ f.setGridDataHints(gd);
+ }
+ return f;
+ }
+
+ /**
+ * do not use or override this internal method
+ */
+ protected IFormField prepareEditInternal(ITableRow row) throws ProcessingException {
+ AbstractValueField<T> f = new AbstractValueField<T>() {
+ @Override
+ public Class<T> getHolderType() {
+ return AbstractColumn.this.getDataType();
+ }
+ };
+ return f;
+ }
+
+ /**
+ * Complete editing of a cell
+ * <p>
+ * By default this calls {@link #setValue(ITableRow, Object)} and delegates to
+ * {@link #execParseValue(ITableRow, Object)} and {@link #execValidateValue(ITableRow, Object)}.
+ */
+ @Override
+ public final void completeEdit(ITableRow row, IFormField editingField) throws ProcessingException {
+ ITable table = getTable();
+ if (table == null || !table.isCellEditable(row, this)) {
+ return;
+ }
+ execCompleteEdit(row, editingField);
+ }
+
+ @Override
+ public void decorateCell(ITableRow row) {
+ Cell cell = row.getCellForUpdate(getColumnIndex());
+ decorateCellInternal(cell, row);
+ try {
+ execDecorateCell(cell, row);
+ }
+ catch (ProcessingException e) {
+ LOG.warn(null, e);
+ }
+ catch (Throwable t) {
+ LOG.warn(null, t);
+ }
+ }
+
+ /**
+ * do not use or override this internal method
+ */
+ protected void decorateCellInternal(Cell cell, ITableRow row) {
+ if (getForegroundColor() != null) {
+ cell.setForegroundColor(getForegroundColor());
+ }
+ if (getBackgroundColor() != null) {
+ cell.setBackgroundColor(getBackgroundColor());
+ }
+ if (getFont() != null) {
+ cell.setFont(getFont());
+ }
+ cell.setHorizontalAlignment(getHorizontalAlignment());
+ cell.setEditableInternal(isCellEditable(row));
+ }
+
+ @Override
+ public void decorateHeaderCell() {
+ HeaderCell cell = m_headerCell;
+ decorateHeaderCellInternal(cell);
+ try {
+ execDecorateHeaderCell(cell);
+ }
+ catch (ProcessingException e) {
+ LOG.warn(null, e);
+ }
+ catch (Throwable t) {
+ LOG.warn(null, t);
+ }
+ }
+
+ /**
+ * do not use or override this internal method
+ */
+ protected void decorateHeaderCellInternal(HeaderCell cell) {
+ }
+
+ @Override
+ public IHeaderCell getHeaderCell() {
+ return m_headerCell;
+ }
+
+ @Override
+ public int getVisibleColumnIndexHint() {
+ return propertySupport.getPropertyInt(PROP_VIEW_COLUMN_INDEX_HINT);
+ }
+
+ @Override
+ public void setVisibleColumnIndexHint(int index) {
+ int oldIndex = getVisibleColumnIndexHint();
+ if (oldIndex != index) {
+ propertySupport.setPropertyInt(PROP_VIEW_COLUMN_INDEX_HINT, index);
+ }
+ }
+
+ @Override
+ public int getInitialWidth() {
+ return m_initialWidth;
+ }
+
+ @Override
+ public void setInitialWidth(int w) {
+ m_initialWidth = w;
+ }
+
+ @Override
+ public double getViewOrder() {
+ return propertySupport.getPropertyDouble(PROP_VIEW_ORDER);
+ }
+
+ @Override
+ public void setViewOrder(double order) {
+ propertySupport.setPropertyDouble(PROP_VIEW_ORDER, order);
+ }
+
+ @Override
+ public int getWidth() {
+ return propertySupport.getPropertyInt(PROP_WIDTH);
+ }
+
+ @Override
+ public void setWidth(int w) {
+ propertySupport.setPropertyInt(PROP_WIDTH, w);
+ }
+
+ @Override
+ public void setWidthInternal(int w) {
+ propertySupport.setPropertyNoFire(PROP_WIDTH, w);
+ }
+
+ @Override
+ public void setHorizontalAlignment(int hAglin) {
+ propertySupport.setPropertyInt(PROP_HORIZONTAL_ALIGNMENT, hAglin);
+ }
+
+ @Override
+ public int getHorizontalAlignment() {
+ return propertySupport.getPropertyInt(PROP_HORIZONTAL_ALIGNMENT);
+ }
+
+ @Override
+ public boolean isDisplayable() {
+ return propertySupport.getPropertyBool(PROP_DISPLAYABLE);
+ }
+
+ @Override
+ public void setDisplayable(boolean b) {
+ propertySupport.setPropertyBool(PROP_DISPLAYABLE, b);
+ calculateVisible();
+ }
+
+ @Override
+ public boolean isVisible() {
+ return propertySupport.getPropertyBool(PROP_VISIBLE);
+ }
+
+ @Override
+ public void setVisible(boolean b) {
+ m_visibleProperty = b;
+ calculateVisible();
+ }
+
+ private void calculateVisible() {
+ propertySupport.setPropertyBool(PROP_VISIBLE, m_visibleGranted && isDisplayable() && m_visibleProperty);
+ }
+
+ @Override
+ public boolean isVisibleInternal() {
+ return m_visibleProperty;
+ }
+
+ @Override
+ public boolean isPrimaryKey() {
+ return m_primaryKey;
+ }
+
+ @Override
+ public boolean isSummary() {
+ return m_summary;
+ }
+
+ @Override
+ public boolean isEditable() {
+ return propertySupport.getPropertyBool(PROP_EDITABLE);
+ }
+
+ @Override
+ public void setEditable(boolean b) {
+ propertySupport.setPropertyBool(PROP_EDITABLE, b);
+ }
+
+ @Override
+ public boolean isCellEditable(ITableRow row) {
+ if (getTable() != null && getTable().isEnabled() && this.isEditable() && row != null && row.isEnabled() && row.getCell(this).isEnabled()) {
+ try {
+ return execIsEditable(row);
+ }
+ catch (Throwable t) {
+ LOG.error("checking row " + row, t);
+ return false;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public String getForegroundColor() {
+ return (String) propertySupport.getProperty(PROP_FOREGROUND_COLOR);
+ }
+
+ @Override
+ public void setForegroundColor(String c) {
+ propertySupport.setProperty(PROP_FOREGROUND_COLOR, c);
+ }
+
+ @Override
+ public String getBackgroundColor() {
+ return (String) propertySupport.getProperty(PROP_BACKGROUND_COLOR);
+ }
+
+ @Override
+ public void setBackgroundColor(String c) {
+ propertySupport.setProperty(PROP_BACKGROUND_COLOR, c);
+ }
+
+ @Override
+ public FontSpec getFont() {
+ return (FontSpec) propertySupport.getProperty(PROP_FONT);
+ }
+
+ @Override
+ public void setFont(FontSpec f) {
+ propertySupport.setProperty(PROP_FONT, f);
+ }
+
+ /**
+ * true: Whenever table content changes, automatically calculate optimized column width so that all column content is
+ * displayed without
+ * cropping.
+ * <p>
+ * This may display a horizontal scroll bar on the table.
+ */
+ @Override
+ public boolean isAutoOptimizeWidth() {
+ return propertySupport.getPropertyBool(PROP_AUTO_OPTIMIZE_WIDTH);
+ }
+
+ @Override
+ public void setAutoOptimizeWidth(boolean optimize) {
+ propertySupport.setPropertyBool(PROP_AUTO_OPTIMIZE_WIDTH, optimize);
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + "[" + getHeaderCell().getText() + " width=" + getWidth() + (isPrimaryKey() ? " primaryKey" : "") + (isSummary() ? " summary" : "") + " viewIndexHint=" + getVisibleColumnIndexHint() + "]";
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractDateColumn.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractDateColumn.java
index 5a6af0ce93..7d02f40643 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractDateColumn.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractDateColumn.java
@@ -1,213 +1,213 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table.columns;
-
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Date;
-
-import org.eclipse.scout.commons.LocaleThreadLocal;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.datefield.AbstractDateField;
-
-/**
- * Column holding Date
- */
-public abstract class AbstractDateColumn extends AbstractColumn<Date> implements IDateColumn {
- // DO NOT init members, this has the same effect as if they were set AFTER
- // initConfig()
- private String m_format;
- private boolean m_hasTime;
- private boolean m_hasDate;
- private DateFormat m_fmt;
-
- public AbstractDateColumn() {
- super();
- }
-
- /*
- * Configuration
- */
-
- /**
- * Configures the format used to render the value. See the {@link DateFormat} class for more information about the
- * expected format.
- * <p>
- * Subclasses can override this method. Default is {@code null}.
- *
- * @return Format of this column.
- */
- @ConfigProperty(ConfigProperty.STRING)
- @Order(140)
- @ConfigPropertyValue("null")
- protected String getConfiguredFormat() {
- return null;
- }
-
- /**
- * Configures whether the value represented by this column has a date. If {@link #getConfiguredFormat()} is set, this
- * configuration has no effect.
- * <p>
- * Subclasses can override this method. Default is {@code true}.
- *
- * @return {@code true} if the value represented by this column has a date, {@code false} otherwise.
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(150)
- @ConfigPropertyValue("true")
- protected boolean getConfiguredHasDate() {
- return true;
- }
-
- /**
- * Configures whether the value represented by this column has a time. If {@link #getConfiguredFormat()} is set, this
- * configuration has no effect.
- * <p>
- * Subclasses can override this method. Default is {@code false}.
- *
- * @return {@code true} if the value represented by this column has a time, {@code false} otherwise.
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(151)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredHasTime() {
- return false;
- }
-
- @Override
- protected void initConfig() {
- super.initConfig();
- setFormat(getConfiguredFormat());
- setHasDate(getConfiguredHasDate());
- setHasTime(getConfiguredHasTime());
- }
-
- /*
- * Runtime
- */
- @Override
- public void setFormat(String s) {
- m_format = s;
- m_fmt = null;
- }
-
- @Override
- public String getFormat() {
- return m_format;
- }
-
- @Override
- public void setHasDate(boolean b) {
- m_hasDate = b;
- m_fmt = null;
- }
-
- @Override
- public void setHasTime(boolean b) {
- m_hasTime = b;
- m_fmt = null;
- }
-
- @Override
- public boolean isHasDate() {
- return m_hasDate;
- }
-
- @Override
- public boolean isHasTime() {
- return m_hasTime;
- }
-
- @Override
- protected Date parseValueInternal(ITableRow row, Object rawValue) throws ProcessingException {
- //legacy support
- if (rawValue instanceof Number) {
- rawValue = convertDoubleTimeToDate((Number) rawValue);
- }
- Date validValue = null;
- if (rawValue == null) {
- validValue = null;
- }
- else if (rawValue instanceof Date) {
- validValue = (Date) rawValue;
- }
- else {
- throw new ProcessingException("invalid Date value in column '" + getClass().getSimpleName() + "': " + rawValue + " class=" + rawValue.getClass());
- }
- return validValue;
- }
-
- private Date convertDoubleTimeToDate(Number d) {
- if (d == null) {
- return null;
- }
- int m = (int) (((long) (d.doubleValue() * MILLIS_PER_DAY + 0.5)) % MILLIS_PER_DAY);
- Calendar c = Calendar.getInstance();
- c.clear();
- c.set(Calendar.MILLISECOND, m % 1000);
- m = m / 1000;
- c.set(Calendar.SECOND, m % 60);
- m = m / 60;
- c.set(Calendar.MINUTE, m % 60);
- m = m / 60;
- c.set(Calendar.HOUR_OF_DAY, m % 24);
- return c.getTime();
- }
-
- @Override
- protected IFormField prepareEditInternal(ITableRow row) throws ProcessingException {
- AbstractDateField f = new AbstractDateField() {
- };
- f.setFormat(getFormat());
- f.setHasDate(isHasDate());
- f.setHasTime(isHasTime());
- return f;
- }
-
- @Override
- protected void decorateCellInternal(Cell cell, ITableRow row) {
- super.decorateCellInternal(cell, row);
- if (cell.getValue() != null) {
- cell.setText(getDateFormat().format((Date) cell.getValue()));
- }
- else {
- cell.setText("");
- }
- }
-
- private DateFormat getDateFormat() {
- DateFormat df = null;
- if (getFormat() != null) {
- df = new SimpleDateFormat(getFormat(), LocaleThreadLocal.get());
- }
- else {
- if (isHasDate() && !isHasTime()) {
- df = DateFormat.getDateInstance(DateFormat.MEDIUM, LocaleThreadLocal.get());
- }
- else if (!isHasDate() && isHasTime()) {
- df = DateFormat.getTimeInstance(DateFormat.SHORT, LocaleThreadLocal.get());
- }
- else {
- df = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, LocaleThreadLocal.get());
- }
- df.setLenient(true);
- }
- return df;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table.columns;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+
+import org.eclipse.scout.commons.LocaleThreadLocal;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.datefield.AbstractDateField;
+
+/**
+ * Column holding Date
+ */
+public abstract class AbstractDateColumn extends AbstractColumn<Date> implements IDateColumn {
+ // DO NOT init members, this has the same effect as if they were set AFTER
+ // initConfig()
+ private String m_format;
+ private boolean m_hasTime;
+ private boolean m_hasDate;
+ private DateFormat m_fmt;
+
+ public AbstractDateColumn() {
+ super();
+ }
+
+ /*
+ * Configuration
+ */
+
+ /**
+ * Configures the format used to render the value. See the {@link DateFormat} class for more information about the
+ * expected format.
+ * <p>
+ * Subclasses can override this method. Default is {@code null}.
+ *
+ * @return Format of this column.
+ */
+ @ConfigProperty(ConfigProperty.STRING)
+ @Order(140)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredFormat() {
+ return null;
+ }
+
+ /**
+ * Configures whether the value represented by this column has a date. If {@link #getConfiguredFormat()} is set, this
+ * configuration has no effect.
+ * <p>
+ * Subclasses can override this method. Default is {@code true}.
+ *
+ * @return {@code true} if the value represented by this column has a date, {@code false} otherwise.
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(150)
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredHasDate() {
+ return true;
+ }
+
+ /**
+ * Configures whether the value represented by this column has a time. If {@link #getConfiguredFormat()} is set, this
+ * configuration has no effect.
+ * <p>
+ * Subclasses can override this method. Default is {@code false}.
+ *
+ * @return {@code true} if the value represented by this column has a time, {@code false} otherwise.
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(151)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredHasTime() {
+ return false;
+ }
+
+ @Override
+ protected void initConfig() {
+ super.initConfig();
+ setFormat(getConfiguredFormat());
+ setHasDate(getConfiguredHasDate());
+ setHasTime(getConfiguredHasTime());
+ }
+
+ /*
+ * Runtime
+ */
+ @Override
+ public void setFormat(String s) {
+ m_format = s;
+ m_fmt = null;
+ }
+
+ @Override
+ public String getFormat() {
+ return m_format;
+ }
+
+ @Override
+ public void setHasDate(boolean b) {
+ m_hasDate = b;
+ m_fmt = null;
+ }
+
+ @Override
+ public void setHasTime(boolean b) {
+ m_hasTime = b;
+ m_fmt = null;
+ }
+
+ @Override
+ public boolean isHasDate() {
+ return m_hasDate;
+ }
+
+ @Override
+ public boolean isHasTime() {
+ return m_hasTime;
+ }
+
+ @Override
+ protected Date parseValueInternal(ITableRow row, Object rawValue) throws ProcessingException {
+ //legacy support
+ if (rawValue instanceof Number) {
+ rawValue = convertDoubleTimeToDate((Number) rawValue);
+ }
+ Date validValue = null;
+ if (rawValue == null) {
+ validValue = null;
+ }
+ else if (rawValue instanceof Date) {
+ validValue = (Date) rawValue;
+ }
+ else {
+ throw new ProcessingException("invalid Date value in column '" + getClass().getSimpleName() + "': " + rawValue + " class=" + rawValue.getClass());
+ }
+ return validValue;
+ }
+
+ private Date convertDoubleTimeToDate(Number d) {
+ if (d == null) {
+ return null;
+ }
+ int m = (int) (((long) (d.doubleValue() * MILLIS_PER_DAY + 0.5)) % MILLIS_PER_DAY);
+ Calendar c = Calendar.getInstance();
+ c.clear();
+ c.set(Calendar.MILLISECOND, m % 1000);
+ m = m / 1000;
+ c.set(Calendar.SECOND, m % 60);
+ m = m / 60;
+ c.set(Calendar.MINUTE, m % 60);
+ m = m / 60;
+ c.set(Calendar.HOUR_OF_DAY, m % 24);
+ return c.getTime();
+ }
+
+ @Override
+ protected IFormField prepareEditInternal(ITableRow row) throws ProcessingException {
+ AbstractDateField f = new AbstractDateField() {
+ };
+ f.setFormat(getFormat());
+ f.setHasDate(isHasDate());
+ f.setHasTime(isHasTime());
+ return f;
+ }
+
+ @Override
+ protected void decorateCellInternal(Cell cell, ITableRow row) {
+ super.decorateCellInternal(cell, row);
+ if (cell.getValue() != null) {
+ cell.setText(getDateFormat().format((Date) cell.getValue()));
+ }
+ else {
+ cell.setText("");
+ }
+ }
+
+ private DateFormat getDateFormat() {
+ DateFormat df = null;
+ if (getFormat() != null) {
+ df = new SimpleDateFormat(getFormat(), LocaleThreadLocal.get());
+ }
+ else {
+ if (isHasDate() && !isHasTime()) {
+ df = DateFormat.getDateInstance(DateFormat.MEDIUM, LocaleThreadLocal.get());
+ }
+ else if (!isHasDate() && isHasTime()) {
+ df = DateFormat.getTimeInstance(DateFormat.SHORT, LocaleThreadLocal.get());
+ }
+ else {
+ df = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, LocaleThreadLocal.get());
+ }
+ df.setLenient(true);
+ }
+ return df;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractDateTimeColumn.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractDateTimeColumn.java
index 443766af51..d6d82204b1 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractDateTimeColumn.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractDateTimeColumn.java
@@ -1,30 +1,30 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table.columns;
-
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-
-/**
- * convenience subclass of {@link AbstractDateColumn} with hasDate=true and hasTime=true
- */
-public abstract class AbstractDateTimeColumn extends AbstractDateColumn {
-
- public AbstractDateTimeColumn() {
- super();
- }
-
- @ConfigPropertyValue("true")
- @Override
- protected boolean getConfiguredHasTime() {
- return true;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table.columns;
+
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+
+/**
+ * convenience subclass of {@link AbstractDateColumn} with hasDate=true and hasTime=true
+ */
+public abstract class AbstractDateTimeColumn extends AbstractDateColumn {
+
+ public AbstractDateTimeColumn() {
+ super();
+ }
+
+ @ConfigPropertyValue("true")
+ @Override
+ protected boolean getConfiguredHasTime() {
+ return true;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractDoubleColumn.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractDoubleColumn.java
index 402720788a..aed4d91bf6 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractDoubleColumn.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractDoubleColumn.java
@@ -1,301 +1,301 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table.columns;
-
-import java.text.DecimalFormat;
-import java.text.NumberFormat;
-
-import org.eclipse.scout.commons.LocaleThreadLocal;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.doublefield.AbstractDoubleField;
-
-/**
- * Column holding Double
- */
-public abstract class AbstractDoubleColumn extends AbstractColumn<Double> implements IDoubleColumn {
- // DO NOT init members, this has the same effect as if they were set AFTER
- // initConfig()
- private String m_format = null;
- private boolean m_groupingUsed;
- private int m_maxFractionDigits;
- private int m_minFractionDigits;
- private boolean m_percent;
- private int m_multiplier;
- private NumberFormat m_fmt;
-
- public AbstractDoubleColumn() {
- super();
- }
-
- @Override
- protected int getConfiguredHorizontalAlignment() {
- return 1;
- }
-
- /*
- * Configuration
- */
-
- /**
- * Configures the format used to render the value. See {@link DecimalFormat#applyPattern(String)} for more information
- * about the expected format.
- * <p>
- * Subclasses can override this method. Default is {@code null}.
- *
- * @return Format of this column.
- */
- @ConfigProperty(ConfigProperty.STRING)
- @Order(140)
- @ConfigPropertyValue("null")
- protected String getConfiguredFormat() {
- return null;
- }
-
- /**
- * Configures the minimum number of fraction digits used to display the value. To use an exact number of fraction
- * digits, the same number as for {@link #getConfiguredMaxFractionDigits()} must be returned.
- * <p>
- * Subclasses can override this method. Default is {@code 2}.
- *
- * @return Minimum number of fraction digits of this column.
- */
- @ConfigProperty(ConfigProperty.INTEGER)
- @Order(150)
- @ConfigPropertyValue("2")
- protected int getConfiguredMinFractionDigits() {
- return 2;
- }
-
- /**
- * Configures the maximum number of fraction digits used to display the value. To use an exact number of fraction
- * digits, the same number as for {@link #getConfiguredMinFractionDigits()} must be returned.
- * <p>
- * Subclasses can override this method. Default is {@code 2}.
- *
- * @return maximum number of fraction digits of this column.
- */
- @ConfigProperty(ConfigProperty.INTEGER)
- @Order(160)
- @ConfigPropertyValue("2")
- protected int getConfiguredMaxFractionDigits() {
- return 2;
- }
-
- /**
- * Configures whether grouping is used for this column. If grouping is used, the values may be displayed with a digit
- * group separator.
- * <p>
- * Subclasses can override this method. Default is {@code true}.
- *
- * @return {@code true} if grouping is used for this column, {@code false} otherwise.
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(170)
- @ConfigPropertyValue("true")
- protected boolean getConfiguredGroupingUsed() {
- return true;
- }
-
- /**
- * Configures whether the value is a percentage and is displayed with the appropriate sign. A value of 12 is displayed
- * as 12 % (depending on the locale). Use {@link #getConfiguredMultiplier()} to handle the value differently (e.g.
- * display a value of 0.12 as 12 %).
- * <p>
- * Subclasses can override this method. Default is {@code false}.
- *
- * @return {@code true} if the column represents a percentage value, {@code false} otherwise.
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(180)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredPercent() {
- return false;
- }
-
- /**
- * Configures the multiplier used to display the value. See {@link DecimalFormat#setMultiplier(int)} for more
- * information about multipliers.
- * <p>
- * Subclasses can override this method. Default is {@code 1}.
- *
- * @return The multiplier used to display the value.
- */
- @ConfigProperty(ConfigProperty.INTEGER)
- @Order(190)
- @ConfigPropertyValue("1")
- protected int getConfiguredMultiplier() {
- return 1;
- }
-
- @Override
- protected void initConfig() {
- super.initConfig();
- setFormat(getConfiguredFormat());
- setMinFractionDigits(getConfiguredMinFractionDigits());
- setMaxFractionDigits(getConfiguredMaxFractionDigits());
- setGroupingUsed(getConfiguredGroupingUsed());
- setPercent(getConfiguredPercent());
- setMultiplier(getConfiguredMultiplier());
- }
-
- /*
- * Runtime
- */
- @Override
- public void setFormat(String s) {
- m_format = s;
- m_fmt = null;
- }
-
- @Override
- public String getFormat() {
- return m_format;
- }
-
- @Override
- public void setMinFractionDigits(int i) {
- if (i > getMaxFractionDigits()) {
- m_maxFractionDigits = i;
- }
- m_minFractionDigits = i;
- m_fmt = null;
- }
-
- @Override
- public int getMinFractionDigits() {
- return m_minFractionDigits;
- }
-
- @Override
- public void setMaxFractionDigits(int i) {
- if (i < getMinFractionDigits()) {
- m_minFractionDigits = i;
- }
- m_maxFractionDigits = i;
- m_fmt = null;
- }
-
- @Override
- public int getMaxFractionDigits() {
- return m_maxFractionDigits;
- }
-
- @Override
- public void setGroupingUsed(boolean b) {
- m_groupingUsed = b;
- m_fmt = null;
- }
-
- @Override
- public boolean isGroupingUsed() {
- return m_groupingUsed;
- }
-
- @Override
- public void setPercent(boolean b) {
- m_percent = b;
- m_fmt = null;
- }
-
- @Override
- public boolean isPercent() {
- return m_percent;
- }
-
- @Override
- public void setMultiplier(int i) {
- m_multiplier = i;
- m_fmt = null;
- }
-
- @Override
- public int getMultiplier() {
- return m_multiplier;
- }
-
- @Override
- protected Double parseValueInternal(ITableRow row, Object rawValue) throws ProcessingException {
- Double validValue = null;
- if (rawValue == null) {
- validValue = null;
- }
- else if (rawValue instanceof Double) {
- validValue = (Double) rawValue;
- }
- else if (rawValue instanceof Number) {
- validValue = ((Number) rawValue).doubleValue();
- }
- else {
- throw new ProcessingException("invalid Double value in column '" + getClass().getSimpleName() + "': " + rawValue + " class=" + rawValue.getClass());
- }
- return validValue;
- }
-
- @Override
- protected IFormField prepareEditInternal(ITableRow row) throws ProcessingException {
- AbstractDoubleField f = new AbstractDoubleField() {
- };
- f.setFormat(getFormat());
- f.setMaxFractionDigits(getMaxFractionDigits());
- f.setMinFractionDigits(getMinFractionDigits());
- f.setMultiplier(getMultiplier());
- f.setGroupingUsed(isGroupingUsed());
- f.setPercent(isPercent());
- return f;
- }
-
- @Override
- protected void decorateCellInternal(Cell cell, ITableRow row) {
- super.decorateCellInternal(cell, row);
- if (cell.getValue() != null) {
- cell.setText(getNumberFormat().format(((Double) cell.getValue()).doubleValue()));
- }
- else {
- cell.setText("");
- }
- }
-
- @Override
- public NumberFormat getNumberFormat() {
- if (m_fmt == null) {
- if (isPercent()) {
- m_fmt = NumberFormat.getPercentInstance(LocaleThreadLocal.get());
- }
- else {
- m_fmt = NumberFormat.getNumberInstance(LocaleThreadLocal.get());
- }
- if (m_fmt instanceof DecimalFormat) {
- ((DecimalFormat) m_fmt).setMultiplier(getMultiplier());
- if (getFormat() != null) {
- ((DecimalFormat) m_fmt).applyPattern(getFormat());
- }
- else {
- m_fmt.setMinimumFractionDigits(getMinFractionDigits());
- m_fmt.setMaximumFractionDigits(getMaxFractionDigits());
- m_fmt.setGroupingUsed(isGroupingUsed());
- }
- }
- else {
- m_fmt.setMinimumFractionDigits(getMinFractionDigits());
- m_fmt.setMaximumFractionDigits(getMaxFractionDigits());
- m_fmt.setGroupingUsed(isGroupingUsed());
- }
- }
- return m_fmt;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table.columns;
+
+import java.text.DecimalFormat;
+import java.text.NumberFormat;
+
+import org.eclipse.scout.commons.LocaleThreadLocal;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.doublefield.AbstractDoubleField;
+
+/**
+ * Column holding Double
+ */
+public abstract class AbstractDoubleColumn extends AbstractColumn<Double> implements IDoubleColumn {
+ // DO NOT init members, this has the same effect as if they were set AFTER
+ // initConfig()
+ private String m_format = null;
+ private boolean m_groupingUsed;
+ private int m_maxFractionDigits;
+ private int m_minFractionDigits;
+ private boolean m_percent;
+ private int m_multiplier;
+ private NumberFormat m_fmt;
+
+ public AbstractDoubleColumn() {
+ super();
+ }
+
+ @Override
+ protected int getConfiguredHorizontalAlignment() {
+ return 1;
+ }
+
+ /*
+ * Configuration
+ */
+
+ /**
+ * Configures the format used to render the value. See {@link DecimalFormat#applyPattern(String)} for more information
+ * about the expected format.
+ * <p>
+ * Subclasses can override this method. Default is {@code null}.
+ *
+ * @return Format of this column.
+ */
+ @ConfigProperty(ConfigProperty.STRING)
+ @Order(140)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredFormat() {
+ return null;
+ }
+
+ /**
+ * Configures the minimum number of fraction digits used to display the value. To use an exact number of fraction
+ * digits, the same number as for {@link #getConfiguredMaxFractionDigits()} must be returned.
+ * <p>
+ * Subclasses can override this method. Default is {@code 2}.
+ *
+ * @return Minimum number of fraction digits of this column.
+ */
+ @ConfigProperty(ConfigProperty.INTEGER)
+ @Order(150)
+ @ConfigPropertyValue("2")
+ protected int getConfiguredMinFractionDigits() {
+ return 2;
+ }
+
+ /**
+ * Configures the maximum number of fraction digits used to display the value. To use an exact number of fraction
+ * digits, the same number as for {@link #getConfiguredMinFractionDigits()} must be returned.
+ * <p>
+ * Subclasses can override this method. Default is {@code 2}.
+ *
+ * @return maximum number of fraction digits of this column.
+ */
+ @ConfigProperty(ConfigProperty.INTEGER)
+ @Order(160)
+ @ConfigPropertyValue("2")
+ protected int getConfiguredMaxFractionDigits() {
+ return 2;
+ }
+
+ /**
+ * Configures whether grouping is used for this column. If grouping is used, the values may be displayed with a digit
+ * group separator.
+ * <p>
+ * Subclasses can override this method. Default is {@code true}.
+ *
+ * @return {@code true} if grouping is used for this column, {@code false} otherwise.
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(170)
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredGroupingUsed() {
+ return true;
+ }
+
+ /**
+ * Configures whether the value is a percentage and is displayed with the appropriate sign. A value of 12 is displayed
+ * as 12 % (depending on the locale). Use {@link #getConfiguredMultiplier()} to handle the value differently (e.g.
+ * display a value of 0.12 as 12 %).
+ * <p>
+ * Subclasses can override this method. Default is {@code false}.
+ *
+ * @return {@code true} if the column represents a percentage value, {@code false} otherwise.
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(180)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredPercent() {
+ return false;
+ }
+
+ /**
+ * Configures the multiplier used to display the value. See {@link DecimalFormat#setMultiplier(int)} for more
+ * information about multipliers.
+ * <p>
+ * Subclasses can override this method. Default is {@code 1}.
+ *
+ * @return The multiplier used to display the value.
+ */
+ @ConfigProperty(ConfigProperty.INTEGER)
+ @Order(190)
+ @ConfigPropertyValue("1")
+ protected int getConfiguredMultiplier() {
+ return 1;
+ }
+
+ @Override
+ protected void initConfig() {
+ super.initConfig();
+ setFormat(getConfiguredFormat());
+ setMinFractionDigits(getConfiguredMinFractionDigits());
+ setMaxFractionDigits(getConfiguredMaxFractionDigits());
+ setGroupingUsed(getConfiguredGroupingUsed());
+ setPercent(getConfiguredPercent());
+ setMultiplier(getConfiguredMultiplier());
+ }
+
+ /*
+ * Runtime
+ */
+ @Override
+ public void setFormat(String s) {
+ m_format = s;
+ m_fmt = null;
+ }
+
+ @Override
+ public String getFormat() {
+ return m_format;
+ }
+
+ @Override
+ public void setMinFractionDigits(int i) {
+ if (i > getMaxFractionDigits()) {
+ m_maxFractionDigits = i;
+ }
+ m_minFractionDigits = i;
+ m_fmt = null;
+ }
+
+ @Override
+ public int getMinFractionDigits() {
+ return m_minFractionDigits;
+ }
+
+ @Override
+ public void setMaxFractionDigits(int i) {
+ if (i < getMinFractionDigits()) {
+ m_minFractionDigits = i;
+ }
+ m_maxFractionDigits = i;
+ m_fmt = null;
+ }
+
+ @Override
+ public int getMaxFractionDigits() {
+ return m_maxFractionDigits;
+ }
+
+ @Override
+ public void setGroupingUsed(boolean b) {
+ m_groupingUsed = b;
+ m_fmt = null;
+ }
+
+ @Override
+ public boolean isGroupingUsed() {
+ return m_groupingUsed;
+ }
+
+ @Override
+ public void setPercent(boolean b) {
+ m_percent = b;
+ m_fmt = null;
+ }
+
+ @Override
+ public boolean isPercent() {
+ return m_percent;
+ }
+
+ @Override
+ public void setMultiplier(int i) {
+ m_multiplier = i;
+ m_fmt = null;
+ }
+
+ @Override
+ public int getMultiplier() {
+ return m_multiplier;
+ }
+
+ @Override
+ protected Double parseValueInternal(ITableRow row, Object rawValue) throws ProcessingException {
+ Double validValue = null;
+ if (rawValue == null) {
+ validValue = null;
+ }
+ else if (rawValue instanceof Double) {
+ validValue = (Double) rawValue;
+ }
+ else if (rawValue instanceof Number) {
+ validValue = ((Number) rawValue).doubleValue();
+ }
+ else {
+ throw new ProcessingException("invalid Double value in column '" + getClass().getSimpleName() + "': " + rawValue + " class=" + rawValue.getClass());
+ }
+ return validValue;
+ }
+
+ @Override
+ protected IFormField prepareEditInternal(ITableRow row) throws ProcessingException {
+ AbstractDoubleField f = new AbstractDoubleField() {
+ };
+ f.setFormat(getFormat());
+ f.setMaxFractionDigits(getMaxFractionDigits());
+ f.setMinFractionDigits(getMinFractionDigits());
+ f.setMultiplier(getMultiplier());
+ f.setGroupingUsed(isGroupingUsed());
+ f.setPercent(isPercent());
+ return f;
+ }
+
+ @Override
+ protected void decorateCellInternal(Cell cell, ITableRow row) {
+ super.decorateCellInternal(cell, row);
+ if (cell.getValue() != null) {
+ cell.setText(getNumberFormat().format(((Double) cell.getValue()).doubleValue()));
+ }
+ else {
+ cell.setText("");
+ }
+ }
+
+ @Override
+ public NumberFormat getNumberFormat() {
+ if (m_fmt == null) {
+ if (isPercent()) {
+ m_fmt = NumberFormat.getPercentInstance(LocaleThreadLocal.get());
+ }
+ else {
+ m_fmt = NumberFormat.getNumberInstance(LocaleThreadLocal.get());
+ }
+ if (m_fmt instanceof DecimalFormat) {
+ ((DecimalFormat) m_fmt).setMultiplier(getMultiplier());
+ if (getFormat() != null) {
+ ((DecimalFormat) m_fmt).applyPattern(getFormat());
+ }
+ else {
+ m_fmt.setMinimumFractionDigits(getMinFractionDigits());
+ m_fmt.setMaximumFractionDigits(getMaxFractionDigits());
+ m_fmt.setGroupingUsed(isGroupingUsed());
+ }
+ }
+ else {
+ m_fmt.setMinimumFractionDigits(getMinFractionDigits());
+ m_fmt.setMaximumFractionDigits(getMaxFractionDigits());
+ m_fmt.setGroupingUsed(isGroupingUsed());
+ }
+ }
+ return m_fmt;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractIntegerColumn.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractIntegerColumn.java
index 423d3fdf47..6ef22bf50a 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractIntegerColumn.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractIntegerColumn.java
@@ -1,169 +1,169 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table.columns;
-
-import java.text.DecimalFormat;
-import java.text.NumberFormat;
-
-import org.eclipse.scout.commons.LocaleThreadLocal;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.integerfield.AbstractIntegerField;
-
-/**
- * Column holding Integer
- */
-public abstract class AbstractIntegerColumn extends AbstractColumn<Integer> implements IIntegerColumn {
- // DO NOT init members, this has the same effect as if they were set AFTER
- // initConfig()
- private String m_format;
- private boolean m_groupingUsed;
- private NumberFormat m_fmt;
-
- public AbstractIntegerColumn() {
- super();
- }
-
- @Override
- protected int getConfiguredHorizontalAlignment() {
- return 1;
- }
-
- /*
- * Configuration
- */
-
- /**
- * Configures the format used to render the value. See {@link DecimalFormat#applyPattern(String)} for more information
- * about the expected format.
- * <p>
- * Subclasses can override this method. Default is {@code null}.
- *
- * @return Format of this column.
- */
- @ConfigProperty(ConfigProperty.STRING)
- @Order(140)
- @ConfigPropertyValue("null")
- protected String getConfiguredFormat() {
- return null;
- }
-
- /**
- * Configures whether grouping is used for this column. If grouping is used, the values may be displayed with a digit
- * group separator.
- * <p>
- * Subclasses can override this method. Default is {@code true}.
- *
- * @return {@code true} if grouping is used for this column, {@code false} otherwise.
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(150)
- @ConfigPropertyValue("true")
- protected boolean getConfiguredGroupingUsed() {
- return true;
- }
-
- @Override
- protected void initConfig() {
- super.initConfig();
- setFormat(getConfiguredFormat());
- setGroupingUsed(getConfiguredGroupingUsed());
- }
-
- /*
- * Runtime
- */
- @Override
- public void setFormat(String s) {
- m_format = s;
- m_fmt = null;
- }
-
- @Override
- public String getFormat() {
- return m_format;
- }
-
- @Override
- public void setGroupingUsed(boolean b) {
- m_groupingUsed = b;
- m_fmt = null;
- }
-
- @Override
- public boolean isGroupingUsed() {
- return m_groupingUsed;
- }
-
- @Override
- protected Integer parseValueInternal(ITableRow row, Object rawValue) throws ProcessingException {
- Integer validValue = null;
- if (rawValue == null) {
- validValue = null;
- }
- else if (rawValue instanceof Integer) {
- validValue = (Integer) rawValue;
- }
- else if (rawValue instanceof Number) {
- validValue = ((Number) rawValue).intValue();
- }
- else {
- throw new ProcessingException("invalid Integer value in column '" + getClass().getSimpleName() + "': " + rawValue + " class=" + rawValue.getClass());
- }
- return validValue;
- }
-
- @Override
- protected IFormField prepareEditInternal(ITableRow row) throws ProcessingException {
- AbstractIntegerField f = new AbstractIntegerField() {
- };
- f.setFormat(getFormat());
- f.setGroupingUsed(isGroupingUsed());
- return f;
- }
-
- @Override
- protected void decorateCellInternal(Cell cell, ITableRow row) {
- super.decorateCellInternal(cell, row);
- if (cell.getValue() != null) {
- cell.setText(getNumberFormat().format(((Integer) cell.getValue()).intValue()));
- }
- else {
- cell.setText("");
- }
- }
-
- @Override
- public NumberFormat getNumberFormat() {
- if (m_fmt == null) {
- if (getFormat() != null) {
- DecimalFormat x = (DecimalFormat) DecimalFormat.getNumberInstance(LocaleThreadLocal.get());
- x.applyPattern(getFormat());
- x.setMinimumFractionDigits(0);
- x.setMaximumFractionDigits(0);
- m_fmt = x;
- }
- else {
- m_fmt = NumberFormat.getNumberInstance(LocaleThreadLocal.get());
- m_fmt.setMinimumFractionDigits(0);
- m_fmt.setMaximumFractionDigits(0);
- m_fmt.setGroupingUsed(isGroupingUsed());
- }
- }
- return m_fmt;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table.columns;
+
+import java.text.DecimalFormat;
+import java.text.NumberFormat;
+
+import org.eclipse.scout.commons.LocaleThreadLocal;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.integerfield.AbstractIntegerField;
+
+/**
+ * Column holding Integer
+ */
+public abstract class AbstractIntegerColumn extends AbstractColumn<Integer> implements IIntegerColumn {
+ // DO NOT init members, this has the same effect as if they were set AFTER
+ // initConfig()
+ private String m_format;
+ private boolean m_groupingUsed;
+ private NumberFormat m_fmt;
+
+ public AbstractIntegerColumn() {
+ super();
+ }
+
+ @Override
+ protected int getConfiguredHorizontalAlignment() {
+ return 1;
+ }
+
+ /*
+ * Configuration
+ */
+
+ /**
+ * Configures the format used to render the value. See {@link DecimalFormat#applyPattern(String)} for more information
+ * about the expected format.
+ * <p>
+ * Subclasses can override this method. Default is {@code null}.
+ *
+ * @return Format of this column.
+ */
+ @ConfigProperty(ConfigProperty.STRING)
+ @Order(140)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredFormat() {
+ return null;
+ }
+
+ /**
+ * Configures whether grouping is used for this column. If grouping is used, the values may be displayed with a digit
+ * group separator.
+ * <p>
+ * Subclasses can override this method. Default is {@code true}.
+ *
+ * @return {@code true} if grouping is used for this column, {@code false} otherwise.
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(150)
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredGroupingUsed() {
+ return true;
+ }
+
+ @Override
+ protected void initConfig() {
+ super.initConfig();
+ setFormat(getConfiguredFormat());
+ setGroupingUsed(getConfiguredGroupingUsed());
+ }
+
+ /*
+ * Runtime
+ */
+ @Override
+ public void setFormat(String s) {
+ m_format = s;
+ m_fmt = null;
+ }
+
+ @Override
+ public String getFormat() {
+ return m_format;
+ }
+
+ @Override
+ public void setGroupingUsed(boolean b) {
+ m_groupingUsed = b;
+ m_fmt = null;
+ }
+
+ @Override
+ public boolean isGroupingUsed() {
+ return m_groupingUsed;
+ }
+
+ @Override
+ protected Integer parseValueInternal(ITableRow row, Object rawValue) throws ProcessingException {
+ Integer validValue = null;
+ if (rawValue == null) {
+ validValue = null;
+ }
+ else if (rawValue instanceof Integer) {
+ validValue = (Integer) rawValue;
+ }
+ else if (rawValue instanceof Number) {
+ validValue = ((Number) rawValue).intValue();
+ }
+ else {
+ throw new ProcessingException("invalid Integer value in column '" + getClass().getSimpleName() + "': " + rawValue + " class=" + rawValue.getClass());
+ }
+ return validValue;
+ }
+
+ @Override
+ protected IFormField prepareEditInternal(ITableRow row) throws ProcessingException {
+ AbstractIntegerField f = new AbstractIntegerField() {
+ };
+ f.setFormat(getFormat());
+ f.setGroupingUsed(isGroupingUsed());
+ return f;
+ }
+
+ @Override
+ protected void decorateCellInternal(Cell cell, ITableRow row) {
+ super.decorateCellInternal(cell, row);
+ if (cell.getValue() != null) {
+ cell.setText(getNumberFormat().format(((Integer) cell.getValue()).intValue()));
+ }
+ else {
+ cell.setText("");
+ }
+ }
+
+ @Override
+ public NumberFormat getNumberFormat() {
+ if (m_fmt == null) {
+ if (getFormat() != null) {
+ DecimalFormat x = (DecimalFormat) DecimalFormat.getNumberInstance(LocaleThreadLocal.get());
+ x.applyPattern(getFormat());
+ x.setMinimumFractionDigits(0);
+ x.setMaximumFractionDigits(0);
+ m_fmt = x;
+ }
+ else {
+ m_fmt = NumberFormat.getNumberInstance(LocaleThreadLocal.get());
+ m_fmt.setMinimumFractionDigits(0);
+ m_fmt.setMaximumFractionDigits(0);
+ m_fmt.setGroupingUsed(isGroupingUsed());
+ }
+ }
+ return m_fmt;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractLongColumn.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractLongColumn.java
index 23af5f015a..b6debd191d 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractLongColumn.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractLongColumn.java
@@ -1,169 +1,169 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table.columns;
-
-import java.text.DecimalFormat;
-import java.text.NumberFormat;
-
-import org.eclipse.scout.commons.LocaleThreadLocal;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.longfield.AbstractLongField;
-
-/**
- * Column holding Long
- */
-public abstract class AbstractLongColumn extends AbstractColumn<Long> implements ILongColumn {
- // DO NOT init members, this has the same effect as if they were set AFTER
- // initConfig()
- private String m_format;
- private boolean m_groupingUsed;
- private NumberFormat m_fmt;
-
- public AbstractLongColumn() {
- super();
- }
-
- @Override
- protected int getConfiguredHorizontalAlignment() {
- return 1;
- }
-
- /*
- * Configuration
- */
-
- /**
- * Configures the format used to render the value. See {@link DecimalFormat#applyPattern(String)} for more information
- * about the expected format.
- * <p>
- * Subclasses can override this method. Default is {@code null}.
- *
- * @return Format of this column.
- */
- @ConfigProperty(ConfigProperty.STRING)
- @Order(140)
- @ConfigPropertyValue("null")
- protected String getConfiguredFormat() {
- return null;
- }
-
- /**
- * Configures whether grouping is used for this column. If grouping is used, the values may be displayed with a digit
- * group separator.
- * <p>
- * Subclasses can override this method. Default is {@code true}.
- *
- * @return {@code true} if grouping is used for this column, {@code false} otherwise.
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(150)
- @ConfigPropertyValue("true")
- protected boolean getConfiguredGroupingUsed() {
- return true;
- }
-
- @Override
- protected void initConfig() {
- super.initConfig();
- setFormat(getConfiguredFormat());
- setGroupingUsed(getConfiguredGroupingUsed());
- }
-
- /*
- * Runtime
- */
- @Override
- public void setFormat(String s) {
- m_format = s;
- m_fmt = null;
- }
-
- @Override
- public String getFormat() {
- return m_format;
- }
-
- @Override
- public void setGroupingUsed(boolean b) {
- m_groupingUsed = b;
- m_fmt = null;
- }
-
- @Override
- public boolean isGroupingUsed() {
- return m_groupingUsed;
- }
-
- @Override
- protected Long parseValueInternal(ITableRow row, Object rawValue) throws ProcessingException {
- Long validValue = null;
- if (rawValue == null) {
- validValue = null;
- }
- else if (rawValue instanceof Long) {
- validValue = (Long) rawValue;
- }
- else if (rawValue instanceof Number) {
- validValue = ((Number) rawValue).longValue();
- }
- else {
- throw new ProcessingException("invalid Long value in column '" + getClass().getSimpleName() + "': " + rawValue + " class=" + rawValue.getClass());
- }
- return validValue;
- }
-
- @Override
- protected IFormField prepareEditInternal(ITableRow row) throws ProcessingException {
- AbstractLongField f = new AbstractLongField() {
- };
- f.setFormat(getFormat());
- f.setGroupingUsed(isGroupingUsed());
- return f;
- }
-
- @Override
- protected void decorateCellInternal(Cell cell, ITableRow row) {
- super.decorateCellInternal(cell, row);
- if (cell.getValue() != null) {
- cell.setText(getNumberFormat().format(((Long) cell.getValue()).longValue()));
- }
- else {
- cell.setText("");
- }
- }
-
- @Override
- public NumberFormat getNumberFormat() {
- if (m_fmt == null) {
- if (getFormat() != null) {
- DecimalFormat x = (DecimalFormat) DecimalFormat.getNumberInstance(LocaleThreadLocal.get());
- x.applyPattern(getFormat());
- x.setMinimumFractionDigits(0);
- x.setMaximumFractionDigits(0);
- m_fmt = x;
- }
- else {
- m_fmt = NumberFormat.getNumberInstance(LocaleThreadLocal.get());
- m_fmt.setMinimumFractionDigits(0);
- m_fmt.setMaximumFractionDigits(0);
- m_fmt.setGroupingUsed(isGroupingUsed());
- }
- }
- return m_fmt;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table.columns;
+
+import java.text.DecimalFormat;
+import java.text.NumberFormat;
+
+import org.eclipse.scout.commons.LocaleThreadLocal;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.longfield.AbstractLongField;
+
+/**
+ * Column holding Long
+ */
+public abstract class AbstractLongColumn extends AbstractColumn<Long> implements ILongColumn {
+ // DO NOT init members, this has the same effect as if they were set AFTER
+ // initConfig()
+ private String m_format;
+ private boolean m_groupingUsed;
+ private NumberFormat m_fmt;
+
+ public AbstractLongColumn() {
+ super();
+ }
+
+ @Override
+ protected int getConfiguredHorizontalAlignment() {
+ return 1;
+ }
+
+ /*
+ * Configuration
+ */
+
+ /**
+ * Configures the format used to render the value. See {@link DecimalFormat#applyPattern(String)} for more information
+ * about the expected format.
+ * <p>
+ * Subclasses can override this method. Default is {@code null}.
+ *
+ * @return Format of this column.
+ */
+ @ConfigProperty(ConfigProperty.STRING)
+ @Order(140)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredFormat() {
+ return null;
+ }
+
+ /**
+ * Configures whether grouping is used for this column. If grouping is used, the values may be displayed with a digit
+ * group separator.
+ * <p>
+ * Subclasses can override this method. Default is {@code true}.
+ *
+ * @return {@code true} if grouping is used for this column, {@code false} otherwise.
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(150)
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredGroupingUsed() {
+ return true;
+ }
+
+ @Override
+ protected void initConfig() {
+ super.initConfig();
+ setFormat(getConfiguredFormat());
+ setGroupingUsed(getConfiguredGroupingUsed());
+ }
+
+ /*
+ * Runtime
+ */
+ @Override
+ public void setFormat(String s) {
+ m_format = s;
+ m_fmt = null;
+ }
+
+ @Override
+ public String getFormat() {
+ return m_format;
+ }
+
+ @Override
+ public void setGroupingUsed(boolean b) {
+ m_groupingUsed = b;
+ m_fmt = null;
+ }
+
+ @Override
+ public boolean isGroupingUsed() {
+ return m_groupingUsed;
+ }
+
+ @Override
+ protected Long parseValueInternal(ITableRow row, Object rawValue) throws ProcessingException {
+ Long validValue = null;
+ if (rawValue == null) {
+ validValue = null;
+ }
+ else if (rawValue instanceof Long) {
+ validValue = (Long) rawValue;
+ }
+ else if (rawValue instanceof Number) {
+ validValue = ((Number) rawValue).longValue();
+ }
+ else {
+ throw new ProcessingException("invalid Long value in column '" + getClass().getSimpleName() + "': " + rawValue + " class=" + rawValue.getClass());
+ }
+ return validValue;
+ }
+
+ @Override
+ protected IFormField prepareEditInternal(ITableRow row) throws ProcessingException {
+ AbstractLongField f = new AbstractLongField() {
+ };
+ f.setFormat(getFormat());
+ f.setGroupingUsed(isGroupingUsed());
+ return f;
+ }
+
+ @Override
+ protected void decorateCellInternal(Cell cell, ITableRow row) {
+ super.decorateCellInternal(cell, row);
+ if (cell.getValue() != null) {
+ cell.setText(getNumberFormat().format(((Long) cell.getValue()).longValue()));
+ }
+ else {
+ cell.setText("");
+ }
+ }
+
+ @Override
+ public NumberFormat getNumberFormat() {
+ if (m_fmt == null) {
+ if (getFormat() != null) {
+ DecimalFormat x = (DecimalFormat) DecimalFormat.getNumberInstance(LocaleThreadLocal.get());
+ x.applyPattern(getFormat());
+ x.setMinimumFractionDigits(0);
+ x.setMaximumFractionDigits(0);
+ m_fmt = x;
+ }
+ else {
+ m_fmt = NumberFormat.getNumberInstance(LocaleThreadLocal.get());
+ m_fmt.setMinimumFractionDigits(0);
+ m_fmt.setMaximumFractionDigits(0);
+ m_fmt.setGroupingUsed(isGroupingUsed());
+ }
+ }
+ return m_fmt;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractObjectColumn.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractObjectColumn.java
index df3e1e2b62..a9e71d94e7 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractObjectColumn.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractObjectColumn.java
@@ -1,51 +1,51 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table.columns;
-
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-
-/**
- * Column holding Objects
- */
-public abstract class AbstractObjectColumn extends AbstractColumn<Object> implements IObjectColumn {
- // DO NOT init members, this has the same effect as if they were set AFTER
- // initConfig()
-
- public AbstractObjectColumn() {
- super();
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public int compareTableRows(ITableRow r1, ITableRow r2) {
- int c;
- Object o1 = getValue(r1);
- Object o2 = getValue(r2);
-
- if (o1 == null && o2 == null) {
- c = 0;
- }
- else if (o1 == null) {
- c = -1;
- }
- else if (o2 == null) {
- c = 1;
- }
- else if ((o1 instanceof Comparable) && (o2 instanceof Comparable) && o1.getClass().isAssignableFrom(o2.getClass())) {
- c = ((Comparable) o1).compareTo(o2);
- }
- else {
- c = StringUtility.compareIgnoreCase(o1.toString(), o2.toString());
- }
- return c;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table.columns;
+
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+
+/**
+ * Column holding Objects
+ */
+public abstract class AbstractObjectColumn extends AbstractColumn<Object> implements IObjectColumn {
+ // DO NOT init members, this has the same effect as if they were set AFTER
+ // initConfig()
+
+ public AbstractObjectColumn() {
+ super();
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public int compareTableRows(ITableRow r1, ITableRow r2) {
+ int c;
+ Object o1 = getValue(r1);
+ Object o2 = getValue(r2);
+
+ if (o1 == null && o2 == null) {
+ c = 0;
+ }
+ else if (o1 == null) {
+ c = -1;
+ }
+ else if (o2 == null) {
+ c = 1;
+ }
+ else if ((o1 instanceof Comparable) && (o2 instanceof Comparable) && o1.getClass().isAssignableFrom(o2.getClass())) {
+ c = ((Comparable) o1).compareTo(o2);
+ }
+ else {
+ c = StringUtility.compareIgnoreCase(o1.toString(), o2.toString());
+ }
+ return c;
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractSmartColumn.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractSmartColumn.java
index afd795782d..f4c0262acf 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractSmartColumn.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractSmartColumn.java
@@ -1,270 +1,270 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table.columns;
-
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.TypeCastUtility;
-import org.eclipse.scout.commons.annotations.ConfigOperation;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.services.lookup.ILookupCallProvisioningService;
-import org.eclipse.scout.rt.client.services.lookup.TableProvisioningContext;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.smartfield.AbstractSmartField;
-import org.eclipse.scout.rt.shared.services.common.code.CODES;
-import org.eclipse.scout.rt.shared.services.common.code.ICodeType;
-import org.eclipse.scout.rt.shared.services.lookup.CodeLookupCall;
-import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
-import org.eclipse.scout.service.SERVICES;
-
-public abstract class AbstractSmartColumn<T> extends AbstractColumn<T> implements ISmartColumn<T> {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractSmartColumn.class);
-
- // DO NOT init members, this has the same effect as if they were set AFTER
- // initConfig()
- private Class<? extends ICodeType> m_codeTypeClass;
- private LookupCall m_lookupCall;
- private boolean m_sortCodesByDisplayText;
-
- public AbstractSmartColumn() {
- super();
- }
-
- /*
- * Configuration
- */
-
- /**
- * Configures the lookup call used to determine the display text of the smart column value.
- * <p>
- * Subclasses can override this method. Default is {@code null}.
- *
- * @return Lookup call class for this column.
- */
- @ConfigProperty(ConfigProperty.LOOKUP_CALL)
- @Order(140)
- @ConfigPropertyValue("null")
- protected Class<? extends LookupCall> getConfiguredLookupCall() {
- return null;
- }
-
- /**
- * Configures the code type used to determine the display text of the smart column value. If a lookup call is set (
- * {@link #getConfiguredLookupCall()}), this configuration has no effect (lookup call is used instead of code type).
- * <p>
- * Subclasses can override this method. Default is {@code null}.
- *
- * @return Code type class for this column.
- */
- @ConfigProperty(ConfigProperty.CODE_TYPE)
- @Order(150)
- @ConfigPropertyValue("null")
- protected Class<? extends ICodeType> getConfiguredCodeType() {
- return null;
- }
-
- /**
- * Configures whether the smartfield used for editable cells should represent the data as a list or as a tree (flat
- * vs. hierarchical data).
- * <p>
- * Subclasses can override this method. Default is {@code false}.
- *
- * @return {@code true} if data behind the smart column is hierarchical (and the smartfield should represent it that
- * way), {@code false} otherwise.
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(310)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredBrowseHierarchy() {
- return false;
- }
-
- /**
- * Configures whether the values are sorted by display text or by sort code in case of a code type class. This
- * configuration only is useful if a code type class is set (see {@link #getConfiguredCodeType()}). In case of a
- * lookup call, the values are sorted by display text.
- * <p>
- * Subclasses can override this method. Default is {@code false}.
- *
- * @return {@code true} if values are sorted by display text, {@code false} otherwise.
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(160)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredSortCodesByDisplayText() {
- return false;
- }
-
- @ConfigOperation
- @Order(140)
- protected void execPrepareLookup(LookupCall call, ITableRow row) {
- }
-
- @Override
- protected void initConfig() {
- super.initConfig();
- setSortCodesByDisplayText(getConfiguredSortCodesByDisplayText());
- // code type
- if (getConfiguredCodeType() != null) {
- setCodeTypeClass(getConfiguredCodeType());
- }
- // lazy lookup decorator
- Class<? extends LookupCall> lookupCallClass = getConfiguredLookupCall();
- if (lookupCallClass != null) {
- LookupCall call;
- try {
- call = lookupCallClass.newInstance();
- setLookupCall(call);
- }
- catch (InstantiationException e) {
- LOG.warn(null, e);
- }
- catch (IllegalAccessException e) {
- LOG.warn(null, e);
- }
- }
- }
-
- /*
- * Runtime
- */
-
- @Override
- public Class<? extends ICodeType> getCodeTypeClass() {
- return m_codeTypeClass;
- }
-
- @Override
- public void setCodeTypeClass(Class<? extends ICodeType> codeTypeClass) {
- m_codeTypeClass = codeTypeClass;
- // create lookup service call
- m_lookupCall = null;
- if (m_codeTypeClass != null) {
- m_lookupCall = CodeLookupCall.newInstanceByService(m_codeTypeClass);
- }
- }
-
- @Override
- public LookupCall getLookupCall() {
- return m_lookupCall;
- }
-
- @Override
- public void setLookupCall(LookupCall call) {
- m_lookupCall = call;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isSortCodesByDisplayText() {
- return m_sortCodesByDisplayText;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setSortCodesByDisplayText(boolean b) {
- m_sortCodesByDisplayText = b;
- }
-
- @Override
- public LookupCall prepareLookupCall(ITableRow row) {
- if (getLookupCall() != null) {
- LookupCall call = SERVICES.getService(ILookupCallProvisioningService.class).newClonedInstance(getLookupCall(), new TableProvisioningContext(getTable(), row, AbstractSmartColumn.this));
- call.setKey(getValue(row));
- call.setText(null);
- call.setAll(null);
- call.setRec(null);
- execPrepareLookup(call, row);
- return call;
- }
- else {
- return null;
- }
- }
-
- @SuppressWarnings("unchecked")
- @Override
- protected T parseValueInternal(ITableRow row, Object rawValue) throws ProcessingException {
- T validValue = null;
- if (rawValue == null) {
- validValue = null;
- }
- else if (getDataType().isAssignableFrom(rawValue.getClass())) {
- validValue = (T) rawValue;
- }
- else {
- try {
- validValue = TypeCastUtility.castValue(rawValue, getDataType());
- }
- catch (Exception e) {
- throw new ProcessingException("invalid " + getDataType().getSimpleName() + " value in column '" + getClass().getName() + "': " + rawValue + " class=" + rawValue.getClass());
- }
- }
- return validValue;
- }
-
- @Override
- protected IFormField prepareEditInternal(final ITableRow row) throws ProcessingException {
- AbstractSmartField<T> f = new AbstractSmartField<T>() {
- @Override
- public Class<T> getHolderType() {
- return AbstractSmartColumn.this.getDataType();
- }
-
- @Override
- protected void execPrepareLookup(LookupCall call) throws ProcessingException {
- AbstractSmartColumn.this.execPrepareLookup(call, row);
- }
- };
-
- f.setLookupCall(getLookupCall());
- f.setBrowseHierarchy(getConfiguredBrowseHierarchy());
- return f;
- }
-
- @Override
- public int compareTableRows(ITableRow r1, ITableRow r2) {
- ICodeType codeType = getCodeTypeClass() != null ? CODES.getCodeType(getCodeTypeClass()) : null;
- LookupCall call = getLookupCall() != null ? getLookupCall() : null;
- if (codeType != null) {
- if (isSortCodesByDisplayText()) {
- String s1 = getDisplayText(r1);
- String s2 = getDisplayText(r2);
- return StringUtility.compareIgnoreCase(s1, s2);
- }
- else {
- T t1 = getValue(r1);
- T t2 = getValue(r2);
- Integer sort1 = (t1 != null ? codeType.getCodeIndex(t1) : -1);
- Integer sort2 = (t2 != null ? codeType.getCodeIndex(t2) : -1);
- int c = sort1.compareTo(sort2);
- return c;
- }
- }
- else if (call != null) {
- String s1 = getDisplayText(r1);
- String s2 = getDisplayText(r2);
- return StringUtility.compareIgnoreCase(s1, s2);
- }
- else {
- return super.compareTableRows(r1, r2);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table.columns;
+
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.TypeCastUtility;
+import org.eclipse.scout.commons.annotations.ConfigOperation;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.services.lookup.ILookupCallProvisioningService;
+import org.eclipse.scout.rt.client.services.lookup.TableProvisioningContext;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.smartfield.AbstractSmartField;
+import org.eclipse.scout.rt.shared.services.common.code.CODES;
+import org.eclipse.scout.rt.shared.services.common.code.ICodeType;
+import org.eclipse.scout.rt.shared.services.lookup.CodeLookupCall;
+import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
+import org.eclipse.scout.service.SERVICES;
+
+public abstract class AbstractSmartColumn<T> extends AbstractColumn<T> implements ISmartColumn<T> {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractSmartColumn.class);
+
+ // DO NOT init members, this has the same effect as if they were set AFTER
+ // initConfig()
+ private Class<? extends ICodeType> m_codeTypeClass;
+ private LookupCall m_lookupCall;
+ private boolean m_sortCodesByDisplayText;
+
+ public AbstractSmartColumn() {
+ super();
+ }
+
+ /*
+ * Configuration
+ */
+
+ /**
+ * Configures the lookup call used to determine the display text of the smart column value.
+ * <p>
+ * Subclasses can override this method. Default is {@code null}.
+ *
+ * @return Lookup call class for this column.
+ */
+ @ConfigProperty(ConfigProperty.LOOKUP_CALL)
+ @Order(140)
+ @ConfigPropertyValue("null")
+ protected Class<? extends LookupCall> getConfiguredLookupCall() {
+ return null;
+ }
+
+ /**
+ * Configures the code type used to determine the display text of the smart column value. If a lookup call is set (
+ * {@link #getConfiguredLookupCall()}), this configuration has no effect (lookup call is used instead of code type).
+ * <p>
+ * Subclasses can override this method. Default is {@code null}.
+ *
+ * @return Code type class for this column.
+ */
+ @ConfigProperty(ConfigProperty.CODE_TYPE)
+ @Order(150)
+ @ConfigPropertyValue("null")
+ protected Class<? extends ICodeType> getConfiguredCodeType() {
+ return null;
+ }
+
+ /**
+ * Configures whether the smartfield used for editable cells should represent the data as a list or as a tree (flat
+ * vs. hierarchical data).
+ * <p>
+ * Subclasses can override this method. Default is {@code false}.
+ *
+ * @return {@code true} if data behind the smart column is hierarchical (and the smartfield should represent it that
+ * way), {@code false} otherwise.
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(310)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredBrowseHierarchy() {
+ return false;
+ }
+
+ /**
+ * Configures whether the values are sorted by display text or by sort code in case of a code type class. This
+ * configuration only is useful if a code type class is set (see {@link #getConfiguredCodeType()}). In case of a
+ * lookup call, the values are sorted by display text.
+ * <p>
+ * Subclasses can override this method. Default is {@code false}.
+ *
+ * @return {@code true} if values are sorted by display text, {@code false} otherwise.
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(160)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredSortCodesByDisplayText() {
+ return false;
+ }
+
+ @ConfigOperation
+ @Order(140)
+ protected void execPrepareLookup(LookupCall call, ITableRow row) {
+ }
+
+ @Override
+ protected void initConfig() {
+ super.initConfig();
+ setSortCodesByDisplayText(getConfiguredSortCodesByDisplayText());
+ // code type
+ if (getConfiguredCodeType() != null) {
+ setCodeTypeClass(getConfiguredCodeType());
+ }
+ // lazy lookup decorator
+ Class<? extends LookupCall> lookupCallClass = getConfiguredLookupCall();
+ if (lookupCallClass != null) {
+ LookupCall call;
+ try {
+ call = lookupCallClass.newInstance();
+ setLookupCall(call);
+ }
+ catch (InstantiationException e) {
+ LOG.warn(null, e);
+ }
+ catch (IllegalAccessException e) {
+ LOG.warn(null, e);
+ }
+ }
+ }
+
+ /*
+ * Runtime
+ */
+
+ @Override
+ public Class<? extends ICodeType> getCodeTypeClass() {
+ return m_codeTypeClass;
+ }
+
+ @Override
+ public void setCodeTypeClass(Class<? extends ICodeType> codeTypeClass) {
+ m_codeTypeClass = codeTypeClass;
+ // create lookup service call
+ m_lookupCall = null;
+ if (m_codeTypeClass != null) {
+ m_lookupCall = CodeLookupCall.newInstanceByService(m_codeTypeClass);
+ }
+ }
+
+ @Override
+ public LookupCall getLookupCall() {
+ return m_lookupCall;
+ }
+
+ @Override
+ public void setLookupCall(LookupCall call) {
+ m_lookupCall = call;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isSortCodesByDisplayText() {
+ return m_sortCodesByDisplayText;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setSortCodesByDisplayText(boolean b) {
+ m_sortCodesByDisplayText = b;
+ }
+
+ @Override
+ public LookupCall prepareLookupCall(ITableRow row) {
+ if (getLookupCall() != null) {
+ LookupCall call = SERVICES.getService(ILookupCallProvisioningService.class).newClonedInstance(getLookupCall(), new TableProvisioningContext(getTable(), row, AbstractSmartColumn.this));
+ call.setKey(getValue(row));
+ call.setText(null);
+ call.setAll(null);
+ call.setRec(null);
+ execPrepareLookup(call, row);
+ return call;
+ }
+ else {
+ return null;
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ protected T parseValueInternal(ITableRow row, Object rawValue) throws ProcessingException {
+ T validValue = null;
+ if (rawValue == null) {
+ validValue = null;
+ }
+ else if (getDataType().isAssignableFrom(rawValue.getClass())) {
+ validValue = (T) rawValue;
+ }
+ else {
+ try {
+ validValue = TypeCastUtility.castValue(rawValue, getDataType());
+ }
+ catch (Exception e) {
+ throw new ProcessingException("invalid " + getDataType().getSimpleName() + " value in column '" + getClass().getName() + "': " + rawValue + " class=" + rawValue.getClass());
+ }
+ }
+ return validValue;
+ }
+
+ @Override
+ protected IFormField prepareEditInternal(final ITableRow row) throws ProcessingException {
+ AbstractSmartField<T> f = new AbstractSmartField<T>() {
+ @Override
+ public Class<T> getHolderType() {
+ return AbstractSmartColumn.this.getDataType();
+ }
+
+ @Override
+ protected void execPrepareLookup(LookupCall call) throws ProcessingException {
+ AbstractSmartColumn.this.execPrepareLookup(call, row);
+ }
+ };
+
+ f.setLookupCall(getLookupCall());
+ f.setBrowseHierarchy(getConfiguredBrowseHierarchy());
+ return f;
+ }
+
+ @Override
+ public int compareTableRows(ITableRow r1, ITableRow r2) {
+ ICodeType codeType = getCodeTypeClass() != null ? CODES.getCodeType(getCodeTypeClass()) : null;
+ LookupCall call = getLookupCall() != null ? getLookupCall() : null;
+ if (codeType != null) {
+ if (isSortCodesByDisplayText()) {
+ String s1 = getDisplayText(r1);
+ String s2 = getDisplayText(r2);
+ return StringUtility.compareIgnoreCase(s1, s2);
+ }
+ else {
+ T t1 = getValue(r1);
+ T t2 = getValue(r2);
+ Integer sort1 = (t1 != null ? codeType.getCodeIndex(t1) : -1);
+ Integer sort2 = (t2 != null ? codeType.getCodeIndex(t2) : -1);
+ int c = sort1.compareTo(sort2);
+ return c;
+ }
+ }
+ else if (call != null) {
+ String s1 = getDisplayText(r1);
+ String s2 = getDisplayText(r2);
+ return StringUtility.compareIgnoreCase(s1, s2);
+ }
+ else {
+ return super.compareTableRows(r1, r2);
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractStringColumn.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractStringColumn.java
index dba2a40707..7d8431cb58 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractStringColumn.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractStringColumn.java
@@ -1,206 +1,206 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table.columns;
-
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.stringfield.AbstractStringField;
-
-/**
- * Column holding Strings
- */
-public abstract class AbstractStringColumn extends AbstractColumn<String> implements IStringColumn {
- // DO NOT init members, this has the same effect as if they were set AFTER
- // initConfig()
- private boolean m_inputMasked;
- private String m_format;
- private boolean m_wrap;
-
- public AbstractStringColumn() {
- super();
- }
-
- /*
- * Configuration
- */
-
- /**
- * Configures the maximum length of text in this column. This configuration only limits the text length
- * in case of editable cells.
- * <p>
- * Subclasses can override this method. Default is {@code 4000}.
- *
- * @return Maximum length of text in an editable cell.
- */
- @ConfigProperty(ConfigProperty.INTEGER)
- @Order(130)
- @ConfigPropertyValue("4000")
- protected int getConfiguredMaxLength() {
- return 4000;
- }
-
- /**
- * Configures whether the input is masked (e.g. similar as when entering a password in a text field). This
- * configuration only masks the input in the string field in case of an editable cell.
- * <p>
- * Subclasses can override this method. Default is {@code false}.
- *
- * @return {@code true} if the input in the string field in case of an editable cell is masked, {@code false}
- * otherwise.
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(140)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredInputMasked() {
- return false;
- }
-
- /**
- * Configures the display format of this column.
- * <p>
- * Subclasses can override this method. Default is {@code null}.
- *
- * @return Either {@code null}, {@link IStringColumn#FORMAT_LOWER} or {@link IStringColumn#FORMAT_LOWER}.
- */
- @ConfigProperty(ConfigProperty.STRING)
- @Order(150)
- @ConfigPropertyValue("null")
- protected String getConfiguredDisplayFormat() {
- return null;
- }
-
- /**
- * Configures whether the text is automatically wrapped in the table cell / string field for editable cells. The text
- * is only wrapped if the text is too long to fit in one row.
- * <p>
- * Subclasses can override this method. Default is {@code false}.
- *
- * @return {@code true} if the text is wrapped, {@code false} otherwise.
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(160)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredTextWrap() {
- return false;
- }
-
- @Override
- protected void initConfig() {
- super.initConfig();
- setInputMasked(getConfiguredInputMasked());
- setDisplayFormat(getConfiguredDisplayFormat());
- setTextWrap(getConfiguredTextWrap());
- }
-
- /*
- * Runtime
- */
- @Override
- public void setInputMasked(boolean b) {
- m_inputMasked = b;
- }
-
- @Override
- public boolean isInputMasked() {
- return m_inputMasked;
- }
-
- @Override
- public void setDisplayFormat(String s) {
- m_format = s;
- }
-
- @Override
- public String getDisplayFormat() {
- return m_format;
- }
-
- @Override
- public void setTextWrap(boolean b) {
- m_wrap = b;
- }
-
- @Override
- public boolean isTextWrap() {
- return m_wrap;
- }
-
- @Override
- public boolean isEmpty() {
- ITable table = getTable();
- if (table != null) {
- for (int i = 0, ni = table.getRowCount(); i < ni; i++) {
- String value = getValue(table.getRow(i));
- if (value != null && value.length() > 0) {
- return false;
- }
- }
- }
- return true;
- }
-
- @Override
- protected String parseValueInternal(ITableRow row, Object rawValue) throws ProcessingException {
- String validValue = null;
- if (rawValue == null) {
- validValue = null;
- }
- else if (rawValue instanceof String) {
- validValue = (String) rawValue;
- }
- else {
- validValue = rawValue.toString();
- }
- return validValue;
- }
-
- @Override
- protected IFormField prepareEditInternal(ITableRow row) throws ProcessingException {
- AbstractStringField f = new AbstractStringField() {
- };
- f.setMaxLength(getConfiguredMaxLength());
- f.setInputMasked(isInputMasked());
- boolean multi = (getTable() != null ? getTable().isMultilineText() : isTextWrap());
- f.setMultilineText(multi);
- f.setWrapText(true); // avoid to have an horizontal scroll bar
- return f;
- }
-
- @Override
- protected void decorateCellInternal(Cell cell, ITableRow row) {
- super.decorateCellInternal(cell, row);
- if (m_format != null && cell.getValue() != null) {
- if (FORMAT_LOWER.equals(m_format)) {
- cell.setText(((String) cell.getValue()).toLowerCase());
- }
- else if (FORMAT_UPPER.equals(m_format)) {
- cell.setText(((String) cell.getValue()).toUpperCase());
- }
- }
- else {
- cell.setText((String) cell.getValue());
- }
- }
-
- @Override
- public int compareTableRows(ITableRow r1, ITableRow r2) {
- String s1 = getValue(r1);
- String s2 = getValue(r2);
- return StringUtility.compareIgnoreCase(s1, s2);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table.columns;
+
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.stringfield.AbstractStringField;
+
+/**
+ * Column holding Strings
+ */
+public abstract class AbstractStringColumn extends AbstractColumn<String> implements IStringColumn {
+ // DO NOT init members, this has the same effect as if they were set AFTER
+ // initConfig()
+ private boolean m_inputMasked;
+ private String m_format;
+ private boolean m_wrap;
+
+ public AbstractStringColumn() {
+ super();
+ }
+
+ /*
+ * Configuration
+ */
+
+ /**
+ * Configures the maximum length of text in this column. This configuration only limits the text length
+ * in case of editable cells.
+ * <p>
+ * Subclasses can override this method. Default is {@code 4000}.
+ *
+ * @return Maximum length of text in an editable cell.
+ */
+ @ConfigProperty(ConfigProperty.INTEGER)
+ @Order(130)
+ @ConfigPropertyValue("4000")
+ protected int getConfiguredMaxLength() {
+ return 4000;
+ }
+
+ /**
+ * Configures whether the input is masked (e.g. similar as when entering a password in a text field). This
+ * configuration only masks the input in the string field in case of an editable cell.
+ * <p>
+ * Subclasses can override this method. Default is {@code false}.
+ *
+ * @return {@code true} if the input in the string field in case of an editable cell is masked, {@code false}
+ * otherwise.
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(140)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredInputMasked() {
+ return false;
+ }
+
+ /**
+ * Configures the display format of this column.
+ * <p>
+ * Subclasses can override this method. Default is {@code null}.
+ *
+ * @return Either {@code null}, {@link IStringColumn#FORMAT_LOWER} or {@link IStringColumn#FORMAT_LOWER}.
+ */
+ @ConfigProperty(ConfigProperty.STRING)
+ @Order(150)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredDisplayFormat() {
+ return null;
+ }
+
+ /**
+ * Configures whether the text is automatically wrapped in the table cell / string field for editable cells. The text
+ * is only wrapped if the text is too long to fit in one row.
+ * <p>
+ * Subclasses can override this method. Default is {@code false}.
+ *
+ * @return {@code true} if the text is wrapped, {@code false} otherwise.
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(160)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredTextWrap() {
+ return false;
+ }
+
+ @Override
+ protected void initConfig() {
+ super.initConfig();
+ setInputMasked(getConfiguredInputMasked());
+ setDisplayFormat(getConfiguredDisplayFormat());
+ setTextWrap(getConfiguredTextWrap());
+ }
+
+ /*
+ * Runtime
+ */
+ @Override
+ public void setInputMasked(boolean b) {
+ m_inputMasked = b;
+ }
+
+ @Override
+ public boolean isInputMasked() {
+ return m_inputMasked;
+ }
+
+ @Override
+ public void setDisplayFormat(String s) {
+ m_format = s;
+ }
+
+ @Override
+ public String getDisplayFormat() {
+ return m_format;
+ }
+
+ @Override
+ public void setTextWrap(boolean b) {
+ m_wrap = b;
+ }
+
+ @Override
+ public boolean isTextWrap() {
+ return m_wrap;
+ }
+
+ @Override
+ public boolean isEmpty() {
+ ITable table = getTable();
+ if (table != null) {
+ for (int i = 0, ni = table.getRowCount(); i < ni; i++) {
+ String value = getValue(table.getRow(i));
+ if (value != null && value.length() > 0) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ @Override
+ protected String parseValueInternal(ITableRow row, Object rawValue) throws ProcessingException {
+ String validValue = null;
+ if (rawValue == null) {
+ validValue = null;
+ }
+ else if (rawValue instanceof String) {
+ validValue = (String) rawValue;
+ }
+ else {
+ validValue = rawValue.toString();
+ }
+ return validValue;
+ }
+
+ @Override
+ protected IFormField prepareEditInternal(ITableRow row) throws ProcessingException {
+ AbstractStringField f = new AbstractStringField() {
+ };
+ f.setMaxLength(getConfiguredMaxLength());
+ f.setInputMasked(isInputMasked());
+ boolean multi = (getTable() != null ? getTable().isMultilineText() : isTextWrap());
+ f.setMultilineText(multi);
+ f.setWrapText(true); // avoid to have an horizontal scroll bar
+ return f;
+ }
+
+ @Override
+ protected void decorateCellInternal(Cell cell, ITableRow row) {
+ super.decorateCellInternal(cell, row);
+ if (m_format != null && cell.getValue() != null) {
+ if (FORMAT_LOWER.equals(m_format)) {
+ cell.setText(((String) cell.getValue()).toLowerCase());
+ }
+ else if (FORMAT_UPPER.equals(m_format)) {
+ cell.setText(((String) cell.getValue()).toUpperCase());
+ }
+ }
+ else {
+ cell.setText((String) cell.getValue());
+ }
+ }
+
+ @Override
+ public int compareTableRows(ITableRow r1, ITableRow r2) {
+ String s1 = getValue(r1);
+ String s2 = getValue(r2);
+ return StringUtility.compareIgnoreCase(s1, s2);
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractTimeColumn.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractTimeColumn.java
index e414bb79d3..ed3211371f 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractTimeColumn.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractTimeColumn.java
@@ -1,36 +1,36 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table.columns;
-
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-
-/**
- * convenience subclass of {@link AbstractDateColumn} with hasDate=false and hasTime=true
- */
-public abstract class AbstractTimeColumn extends AbstractDateColumn {
-
- public AbstractTimeColumn() {
- super();
- }
-
- @ConfigPropertyValue("false")
- @Override
- protected boolean getConfiguredHasDate() {
- return false;
- }
-
- @ConfigPropertyValue("true")
- @Override
- protected boolean getConfiguredHasTime() {
- return true;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table.columns;
+
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+
+/**
+ * convenience subclass of {@link AbstractDateColumn} with hasDate=false and hasTime=true
+ */
+public abstract class AbstractTimeColumn extends AbstractDateColumn {
+
+ public AbstractTimeColumn() {
+ super();
+ }
+
+ @ConfigPropertyValue("false")
+ @Override
+ protected boolean getConfiguredHasDate() {
+ return false;
+ }
+
+ @ConfigPropertyValue("true")
+ @Override
+ protected boolean getConfiguredHasTime() {
+ return true;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/DefaultCellEditorForm.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/DefaultCellEditorForm.java
index 5915dee327..327ead3797 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/DefaultCellEditorForm.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/DefaultCellEditorForm.java
@@ -1,47 +1,47 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table.columns;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.form.AbstractForm;
-import org.eclipse.scout.rt.client.ui.form.AbstractFormHandler;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox;
-
-/**
- * form to build an ad-hoc cell editor field
- */
-public class DefaultCellEditorForm extends AbstractForm {
- private final IGroupBox m_mainBox;
-
- public DefaultCellEditorForm(IFormField editorField) throws ProcessingException {
- super(false);
- m_mainBox = new DefaultCellEditorMainBox(editorField);
- callInitializer();
- }
-
- @Override
- protected void initConfig() throws ProcessingException {
- super.initConfig();
- setAutoAddRemoveOnDesktop(false);
- }
-
- @Override
- public IGroupBox getRootGroupBox() {
- return m_mainBox;
- }
-
- public void start() throws ProcessingException {
- startInternal(new AbstractFormHandler() {
- });
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table.columns;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.form.AbstractForm;
+import org.eclipse.scout.rt.client.ui.form.AbstractFormHandler;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox;
+
+/**
+ * form to build an ad-hoc cell editor field
+ */
+public class DefaultCellEditorForm extends AbstractForm {
+ private final IGroupBox m_mainBox;
+
+ public DefaultCellEditorForm(IFormField editorField) throws ProcessingException {
+ super(false);
+ m_mainBox = new DefaultCellEditorMainBox(editorField);
+ callInitializer();
+ }
+
+ @Override
+ protected void initConfig() throws ProcessingException {
+ super.initConfig();
+ setAutoAddRemoveOnDesktop(false);
+ }
+
+ @Override
+ public IGroupBox getRootGroupBox() {
+ return m_mainBox;
+ }
+
+ public void start() throws ProcessingException {
+ startInternal(new AbstractFormHandler() {
+ });
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/DefaultCellEditorMainBox.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/DefaultCellEditorMainBox.java
index 50210f30e8..37a9c5e1ba 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/DefaultCellEditorMainBox.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/DefaultCellEditorMainBox.java
@@ -1,41 +1,41 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table.columns;
-
-import java.util.List;
-
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
-
-/**
- * Dynamic group box to build an ad-hoc form for cell editing
- */
-public class DefaultCellEditorMainBox extends AbstractGroupBox {
- private final IFormField[] m_injectedFields;
-
- public DefaultCellEditorMainBox(IFormField... fields) {
- super(false);
- m_injectedFields = fields;
- callInitializer();
- }
-
- /**
- * This is the place to inject fields dynamically
- */
- @Override
- protected void injectFieldsInternal(List<IFormField> fieldList) {
- if (m_injectedFields != null) {
- for (IFormField f : m_injectedFields) {
- fieldList.add(f);
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table.columns;
+
+import java.util.List;
+
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
+
+/**
+ * Dynamic group box to build an ad-hoc form for cell editing
+ */
+public class DefaultCellEditorMainBox extends AbstractGroupBox {
+ private final IFormField[] m_injectedFields;
+
+ public DefaultCellEditorMainBox(IFormField... fields) {
+ super(false);
+ m_injectedFields = fields;
+ callInitializer();
+ }
+
+ /**
+ * This is the place to inject fields dynamically
+ */
+ @Override
+ protected void injectFieldsInternal(List<IFormField> fieldList) {
+ if (m_injectedFields != null) {
+ for (IFormField f : m_injectedFields) {
+ fieldList.add(f);
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/IBigDecimalColumn.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/IBigDecimalColumn.java
index 40728b3bb1..af24da0714 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/IBigDecimalColumn.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/IBigDecimalColumn.java
@@ -1,44 +1,44 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table.columns;
-
-import java.math.BigDecimal;
-import java.text.NumberFormat;
-
-public interface IBigDecimalColumn extends IColumn<BigDecimal> {
-
- void setFormat(String s);
-
- String getFormat();
-
- void setMinFractionDigits(int i);
-
- int getMinFractionDigits();
-
- void setMaxFractionDigits(int i);
-
- int getMaxFractionDigits();
-
- void setGroupingUsed(boolean b);
-
- boolean isGroupingUsed();
-
- void setPercent(boolean b);
-
- boolean isPercent();
-
- void setMultiplier(int b);
-
- int getMultiplier();
-
- NumberFormat getNumberFormat();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table.columns;
+
+import java.math.BigDecimal;
+import java.text.NumberFormat;
+
+public interface IBigDecimalColumn extends IColumn<BigDecimal> {
+
+ void setFormat(String s);
+
+ String getFormat();
+
+ void setMinFractionDigits(int i);
+
+ int getMinFractionDigits();
+
+ void setMaxFractionDigits(int i);
+
+ int getMaxFractionDigits();
+
+ void setGroupingUsed(boolean b);
+
+ boolean isGroupingUsed();
+
+ void setPercent(boolean b);
+
+ boolean isPercent();
+
+ void setMultiplier(int b);
+
+ int getMultiplier();
+
+ NumberFormat getNumberFormat();
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/IBooleanColumn.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/IBooleanColumn.java
index a017ee63f7..35cd24b51d 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/IBooleanColumn.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/IBooleanColumn.java
@@ -1,28 +1,28 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table.columns;
-
-public interface IBooleanColumn extends IColumn<Boolean> {
-
- String PROP_VERTICAL_ALIGNMENT = "verticalAlignment";
-
- void setVerticalAlignment(int verticalAlignment);
-
- /**
- * <ul>
- * <li>-1: top alignment</li>
- * <li>0: middle alignment</li>
- * <li>1: bottom alignment</li>
- * </ul>
- * The vertical alignment of the checkbox
- */
- int getVerticalAlignment();
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table.columns;
+
+public interface IBooleanColumn extends IColumn<Boolean> {
+
+ String PROP_VERTICAL_ALIGNMENT = "verticalAlignment";
+
+ void setVerticalAlignment(int verticalAlignment);
+
+ /**
+ * <ul>
+ * <li>-1: top alignment</li>
+ * <li>0: middle alignment</li>
+ * <li>1: bottom alignment</li>
+ * </ul>
+ * The vertical alignment of the checkbox
+ */
+ int getVerticalAlignment();
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/IColumn.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/IColumn.java
index 9b18890221..80a0f1bcb0 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/IColumn.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/IColumn.java
@@ -1,400 +1,400 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table.columns;
-
-import java.security.Permission;
-
-import org.eclipse.scout.commons.beans.IPropertyObserver;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.basic.table.ColumnSet;
-import org.eclipse.scout.rt.client.ui.basic.table.IHeaderCell;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.shared.data.basic.FontSpec;
-
-public interface IColumn<T> extends IPropertyObserver {
- /**
- * type boolean
- */
- String PROP_VISIBLE = "visible";// defined as: visibleGranted &&
- // displayable && visibleProperty
- /**
- * type boolean
- */
- String PROP_DISPLAYABLE = "displayable";
- /**
- * type int
- */
- String PROP_WIDTH = "width";
- /**
- * type int
- */
- String PROP_VIEW_COLUMN_INDEX_HINT = "viewColumnIndexHint";
-
- /**
- * type {@link String}
- */
- String PROP_BACKGROUND_COLOR = "backgroundColor";
- /**
- * type {@link String}
- */
- String PROP_FOREGROUND_COLOR = "foregroundColor";
- /**
- * type {@link ScoutFont}
- */
- String PROP_FONT = "font";
- /**
- * type int
- */
- String PROP_HORIZONTAL_ALIGNMENT = "horizontalAlignment";
- /**
- * type boolean
- */
- String PROP_AUTO_OPTIMIZE_WIDTH = "autoOptimizeWidth";
-
- String PROP_EDITABLE = "editable";
-
- String PROP_VIEW_ORDER = "viewOrder";
-
- void initColumn() throws ProcessingException;
-
- void disposeColumn() throws ProcessingException;
-
- void setVisiblePermission(Permission p);
-
- boolean isVisibleGranted();
-
- void setVisibleGranted(boolean b);
-
- int getColumnIndex();
-
- /**
- * the field ID is the simple class name of a column without the suffix "Column"
- */
- String getColumnId();
-
- ITable getTable();
-
- int compareTableRows(ITableRow r1, ITableRow r2);
-
- T getValue(int rowIndex);
-
- T getValue(ITableRow r);
-
- T[] getValues(ITableRow[] rows);
-
- /**
- * <p>
- * Updates the value of the given row.
- * </p>
- * <p>
- * If any cell editor is active, editing is canceled and it's value rejected.
- * </p>
- *
- * @param r
- * @param value
- * @throws ProcessingException
- */
- void setValue(ITableRow r, T value) throws ProcessingException;
-
- /**
- * <p>
- * Updates the value of the given row.
- * </p>
- * <p>
- * If any cell editor is active, editing is canceled and it's value rejected.
- * </p>
- *
- * @param r
- * @param value
- * @throws ProcessingException
- */
- void setValue(int rowIndex, T value) throws ProcessingException;
-
- /**
- * fill all values in this column with the new value
- */
- void fill(T rawValue) throws ProcessingException;
-
- T[] getValues();
-
- T[] getSelectedValues();
-
- T[] getInsertedValues();
-
- T[] getUpdatedValues();
-
- T[] getDeletedValues();
-
- /**
- * @return display text for this row's cell on this column
- */
- String getDisplayText(ITableRow r);
-
- /**
- * @return display texts for all row's cells on this column
- */
- String[] getDisplayTexts();
-
- /**
- * @return display text for selected row's cell on this column
- */
- String getSelectedDisplayText();
-
- /**
- * @return display texts for all selected row's cells on this column
- */
- String[] getSelectedDisplayTexts();
-
- Class<T> getDataType();
-
- /**
- * first selected value
- */
- T getSelectedValue();
-
- ITableRow[] findRows(T[] values);
-
- ITableRow[] findRows(T value);
-
- ITableRow findRow(T value);
-
- /**
- * @return true if column contains value at least one time
- */
- boolean contains(T value);
-
- /**
- * @return true if column is not unique, that means at least one value occurs
- * more than one time
- */
- boolean containsDuplicateValues();
-
- /**
- * @return true if column contains no values or all values are null
- */
- boolean isEmpty();
-
- IHeaderCell getHeaderCell();
-
- int getInitialWidth();
-
- void setInitialWidth(int w);
-
- boolean isInitialVisible();
-
- void setInitialVisible(boolean b);
-
- /**
- * @return Returns the column's view order. It determines where this column is arranged in the view.
- */
- double getViewOrder();
-
- /**
- * Sets the column's view order used for ordering all columns of a table. It is initialized with the column's model
- * order (given by @Order annotation), i.e. the column order values are filled into the table.
- *
- * @param order
- */
- void setViewOrder(double order);
-
- int getInitialSortIndex();
-
- void setInitialSortIndex(int i);
-
- boolean isInitialSortAscending();
-
- void setInitialSortAscending(boolean b);
-
- boolean isInitialAlwaysIncludeSortAtBegin();
-
- void setInitialAlwaysIncludeSortAtBegin(boolean b);
-
- boolean isInitialAlwaysIncludeSortAtEnd();
-
- void setInitialAlwaysIncludeSortAtEnd(boolean b);
-
- int getWidth();
-
- void setWidth(int w);
-
- /**
- * set the width of the column without firing events
- */
- void setWidthInternal(int w);
-
- int getVisibleColumnIndexHint();
-
- void setVisibleColumnIndexHint(int index);
-
- /**
- * A column is presented to the user in the table when it is displayable AND
- * visible<br>
- * this column is basically displayable to the user<br>
- * this property is used in combination with isVisible
- */
- boolean isDisplayable();
-
- void setDisplayable(boolean b);
-
- /**
- * @return Returns whether the column is visible to the user using the three properties
- * visible, dispalyable and visiblePermission.
- */
- boolean isVisible();
-
- void setVisible(boolean b);
-
- /**
- * @return Returns the column's internal visible state that does no take
- * permissions or the displayable property into account. This method is used by
- * the framework only.
- * @see IColumn#isVisible()
- */
- boolean isVisibleInternal();
-
- /**
- * the value in this column is part of the row primary key
- */
- boolean isPrimaryKey();
-
- /**
- * the value in this column is part of the row summary text (for example in a
- * explorer tree node)
- */
- boolean isSummary();
-
- boolean isEditable();
-
- void setEditable(boolean editable);
-
- /**
- * @return true if this cell (row, column) is editable <b>and</b> the column is editable {@link #isEditable()}
- * <p>
- * It does NOT check if the column is visible, this is done in {@link ITable#isCellEditable(int, int)} et al.
- * <p>
- * Note that this is not a java bean method and thus not thread-safe
- */
- boolean isCellEditable(ITableRow row);
-
- String getForegroundColor();
-
- void setForegroundColor(String c);
-
- String getBackgroundColor();
-
- void setBackgroundColor(String c);
-
- FontSpec getFont();
-
- void setFont(FontSpec f);
-
- void setHorizontalAlignment(int hAglin);
-
- /**
- * <0 for left alignment 0 for center alignment and > 0 for right alignment.
- * This alignment is used for header cell and all column cells. Cell specific alignments can be
- * applied by overriding the decorateCell methods.
- */
- int getHorizontalAlignment();
-
- /**
- * <p>
- * When doing single column sort, all previous columns are kept as implicit history and are marked sortExplicit=false
- * <p>
- * When doing multi-column sort, all columns are kept as explicit history and are marked sortExplicit=true
- * <p>
- * Convenience for {@link IHeaderCell#isSortExplicit()}
- */
- boolean isSortExplicit();
-
- /**
- * Convenience for {@link IHeaderCell#isSortActive()}
- */
- boolean isSortActive();
-
- /**
- * Convenience to find out if a filter is active
- */
- boolean isColumnFilterActive();
-
- /**
- * Convenience for {@link IHeaderCell#isSortPermanent()}
- */
- boolean isSortPermanent();
-
- /**
- * Convenience for {@link IHeaderCell#isSortAscending()}
- */
- boolean isSortAscending();
-
- /**
- * Convenience for {@link ColumnSet#getSortColumns()} and finding the index
- */
- int getSortIndex();
-
- /**
- * @param rawValue
- * @return value in correct type, derived from rawValue
- * @throws ProcessingException
- * parse AND validate value
- */
- T/* validValue */parseValue(ITableRow row, Object rawValue) throws ProcessingException;
-
- /**
- * validate cell value on a row
- */
- T/* validValue */validateValue(ITableRow row, T rawValue) throws ProcessingException;
-
- /**
- * Prepare editing of a cell in the table.
- * <p>
- * Cell editing is canceled (normally by typing escape) or saved (normally by clicking another cell, typing enter).
- * <p>
- * When saved, the method {@link #completeEdit(ITableRow, IFormField)} /
- * {@link #execCompleteEdit(ITableRow, IFormField)} is called on this column.
- *
- * @param row
- * on which editing occurs
- * @return a field for editing, use super.{@link #execPrepareEdit(ITableRow)} for the default implementation.
- */
- IFormField prepareEdit(ITableRow row) throws ProcessingException;
-
- /**
- * Complete editing of a cell
- * <p>
- * By default this calls {@link #setValue(ITableRow, Object)} and delegates to
- * {@link #execParseValue(ITableRow, Object)} and {@link #execValidateValue(ITableRow, Object)}.
- */
- void completeEdit(ITableRow row, IFormField editingField) throws ProcessingException;
-
- void decorateCell(ITableRow row);
-
- void decorateHeaderCell();
-
- /**
- * true: Whenever table content changes, automatically calculate optimized column width so that all column content is
- * displayed without
- * cropping.
- * <p>
- * This may display a horizontal scroll bar on the table.
- * <p>
- * This feature is not supported in SWT and RWT since SWT does not offer such an api method.
- */
- boolean isAutoOptimizeWidth();
-
- /**
- * see {@link #isAutoOptimizeWidth()}
- */
- void setAutoOptimizeWidth(boolean optimize);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table.columns;
+
+import java.security.Permission;
+
+import org.eclipse.scout.commons.beans.IPropertyObserver;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.basic.table.ColumnSet;
+import org.eclipse.scout.rt.client.ui.basic.table.IHeaderCell;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.shared.data.basic.FontSpec;
+
+public interface IColumn<T> extends IPropertyObserver {
+ /**
+ * type boolean
+ */
+ String PROP_VISIBLE = "visible";// defined as: visibleGranted &&
+ // displayable && visibleProperty
+ /**
+ * type boolean
+ */
+ String PROP_DISPLAYABLE = "displayable";
+ /**
+ * type int
+ */
+ String PROP_WIDTH = "width";
+ /**
+ * type int
+ */
+ String PROP_VIEW_COLUMN_INDEX_HINT = "viewColumnIndexHint";
+
+ /**
+ * type {@link String}
+ */
+ String PROP_BACKGROUND_COLOR = "backgroundColor";
+ /**
+ * type {@link String}
+ */
+ String PROP_FOREGROUND_COLOR = "foregroundColor";
+ /**
+ * type {@link ScoutFont}
+ */
+ String PROP_FONT = "font";
+ /**
+ * type int
+ */
+ String PROP_HORIZONTAL_ALIGNMENT = "horizontalAlignment";
+ /**
+ * type boolean
+ */
+ String PROP_AUTO_OPTIMIZE_WIDTH = "autoOptimizeWidth";
+
+ String PROP_EDITABLE = "editable";
+
+ String PROP_VIEW_ORDER = "viewOrder";
+
+ void initColumn() throws ProcessingException;
+
+ void disposeColumn() throws ProcessingException;
+
+ void setVisiblePermission(Permission p);
+
+ boolean isVisibleGranted();
+
+ void setVisibleGranted(boolean b);
+
+ int getColumnIndex();
+
+ /**
+ * the field ID is the simple class name of a column without the suffix "Column"
+ */
+ String getColumnId();
+
+ ITable getTable();
+
+ int compareTableRows(ITableRow r1, ITableRow r2);
+
+ T getValue(int rowIndex);
+
+ T getValue(ITableRow r);
+
+ T[] getValues(ITableRow[] rows);
+
+ /**
+ * <p>
+ * Updates the value of the given row.
+ * </p>
+ * <p>
+ * If any cell editor is active, editing is canceled and it's value rejected.
+ * </p>
+ *
+ * @param r
+ * @param value
+ * @throws ProcessingException
+ */
+ void setValue(ITableRow r, T value) throws ProcessingException;
+
+ /**
+ * <p>
+ * Updates the value of the given row.
+ * </p>
+ * <p>
+ * If any cell editor is active, editing is canceled and it's value rejected.
+ * </p>
+ *
+ * @param r
+ * @param value
+ * @throws ProcessingException
+ */
+ void setValue(int rowIndex, T value) throws ProcessingException;
+
+ /**
+ * fill all values in this column with the new value
+ */
+ void fill(T rawValue) throws ProcessingException;
+
+ T[] getValues();
+
+ T[] getSelectedValues();
+
+ T[] getInsertedValues();
+
+ T[] getUpdatedValues();
+
+ T[] getDeletedValues();
+
+ /**
+ * @return display text for this row's cell on this column
+ */
+ String getDisplayText(ITableRow r);
+
+ /**
+ * @return display texts for all row's cells on this column
+ */
+ String[] getDisplayTexts();
+
+ /**
+ * @return display text for selected row's cell on this column
+ */
+ String getSelectedDisplayText();
+
+ /**
+ * @return display texts for all selected row's cells on this column
+ */
+ String[] getSelectedDisplayTexts();
+
+ Class<T> getDataType();
+
+ /**
+ * first selected value
+ */
+ T getSelectedValue();
+
+ ITableRow[] findRows(T[] values);
+
+ ITableRow[] findRows(T value);
+
+ ITableRow findRow(T value);
+
+ /**
+ * @return true if column contains value at least one time
+ */
+ boolean contains(T value);
+
+ /**
+ * @return true if column is not unique, that means at least one value occurs
+ * more than one time
+ */
+ boolean containsDuplicateValues();
+
+ /**
+ * @return true if column contains no values or all values are null
+ */
+ boolean isEmpty();
+
+ IHeaderCell getHeaderCell();
+
+ int getInitialWidth();
+
+ void setInitialWidth(int w);
+
+ boolean isInitialVisible();
+
+ void setInitialVisible(boolean b);
+
+ /**
+ * @return Returns the column's view order. It determines where this column is arranged in the view.
+ */
+ double getViewOrder();
+
+ /**
+ * Sets the column's view order used for ordering all columns of a table. It is initialized with the column's model
+ * order (given by @Order annotation), i.e. the column order values are filled into the table.
+ *
+ * @param order
+ */
+ void setViewOrder(double order);
+
+ int getInitialSortIndex();
+
+ void setInitialSortIndex(int i);
+
+ boolean isInitialSortAscending();
+
+ void setInitialSortAscending(boolean b);
+
+ boolean isInitialAlwaysIncludeSortAtBegin();
+
+ void setInitialAlwaysIncludeSortAtBegin(boolean b);
+
+ boolean isInitialAlwaysIncludeSortAtEnd();
+
+ void setInitialAlwaysIncludeSortAtEnd(boolean b);
+
+ int getWidth();
+
+ void setWidth(int w);
+
+ /**
+ * set the width of the column without firing events
+ */
+ void setWidthInternal(int w);
+
+ int getVisibleColumnIndexHint();
+
+ void setVisibleColumnIndexHint(int index);
+
+ /**
+ * A column is presented to the user in the table when it is displayable AND
+ * visible<br>
+ * this column is basically displayable to the user<br>
+ * this property is used in combination with isVisible
+ */
+ boolean isDisplayable();
+
+ void setDisplayable(boolean b);
+
+ /**
+ * @return Returns whether the column is visible to the user using the three properties
+ * visible, dispalyable and visiblePermission.
+ */
+ boolean isVisible();
+
+ void setVisible(boolean b);
+
+ /**
+ * @return Returns the column's internal visible state that does no take
+ * permissions or the displayable property into account. This method is used by
+ * the framework only.
+ * @see IColumn#isVisible()
+ */
+ boolean isVisibleInternal();
+
+ /**
+ * the value in this column is part of the row primary key
+ */
+ boolean isPrimaryKey();
+
+ /**
+ * the value in this column is part of the row summary text (for example in a
+ * explorer tree node)
+ */
+ boolean isSummary();
+
+ boolean isEditable();
+
+ void setEditable(boolean editable);
+
+ /**
+ * @return true if this cell (row, column) is editable <b>and</b> the column is editable {@link #isEditable()}
+ * <p>
+ * It does NOT check if the column is visible, this is done in {@link ITable#isCellEditable(int, int)} et al.
+ * <p>
+ * Note that this is not a java bean method and thus not thread-safe
+ */
+ boolean isCellEditable(ITableRow row);
+
+ String getForegroundColor();
+
+ void setForegroundColor(String c);
+
+ String getBackgroundColor();
+
+ void setBackgroundColor(String c);
+
+ FontSpec getFont();
+
+ void setFont(FontSpec f);
+
+ void setHorizontalAlignment(int hAglin);
+
+ /**
+ * <0 for left alignment 0 for center alignment and > 0 for right alignment.
+ * This alignment is used for header cell and all column cells. Cell specific alignments can be
+ * applied by overriding the decorateCell methods.
+ */
+ int getHorizontalAlignment();
+
+ /**
+ * <p>
+ * When doing single column sort, all previous columns are kept as implicit history and are marked sortExplicit=false
+ * <p>
+ * When doing multi-column sort, all columns are kept as explicit history and are marked sortExplicit=true
+ * <p>
+ * Convenience for {@link IHeaderCell#isSortExplicit()}
+ */
+ boolean isSortExplicit();
+
+ /**
+ * Convenience for {@link IHeaderCell#isSortActive()}
+ */
+ boolean isSortActive();
+
+ /**
+ * Convenience to find out if a filter is active
+ */
+ boolean isColumnFilterActive();
+
+ /**
+ * Convenience for {@link IHeaderCell#isSortPermanent()}
+ */
+ boolean isSortPermanent();
+
+ /**
+ * Convenience for {@link IHeaderCell#isSortAscending()}
+ */
+ boolean isSortAscending();
+
+ /**
+ * Convenience for {@link ColumnSet#getSortColumns()} and finding the index
+ */
+ int getSortIndex();
+
+ /**
+ * @param rawValue
+ * @return value in correct type, derived from rawValue
+ * @throws ProcessingException
+ * parse AND validate value
+ */
+ T/* validValue */parseValue(ITableRow row, Object rawValue) throws ProcessingException;
+
+ /**
+ * validate cell value on a row
+ */
+ T/* validValue */validateValue(ITableRow row, T rawValue) throws ProcessingException;
+
+ /**
+ * Prepare editing of a cell in the table.
+ * <p>
+ * Cell editing is canceled (normally by typing escape) or saved (normally by clicking another cell, typing enter).
+ * <p>
+ * When saved, the method {@link #completeEdit(ITableRow, IFormField)} /
+ * {@link #execCompleteEdit(ITableRow, IFormField)} is called on this column.
+ *
+ * @param row
+ * on which editing occurs
+ * @return a field for editing, use super.{@link #execPrepareEdit(ITableRow)} for the default implementation.
+ */
+ IFormField prepareEdit(ITableRow row) throws ProcessingException;
+
+ /**
+ * Complete editing of a cell
+ * <p>
+ * By default this calls {@link #setValue(ITableRow, Object)} and delegates to
+ * {@link #execParseValue(ITableRow, Object)} and {@link #execValidateValue(ITableRow, Object)}.
+ */
+ void completeEdit(ITableRow row, IFormField editingField) throws ProcessingException;
+
+ void decorateCell(ITableRow row);
+
+ void decorateHeaderCell();
+
+ /**
+ * true: Whenever table content changes, automatically calculate optimized column width so that all column content is
+ * displayed without
+ * cropping.
+ * <p>
+ * This may display a horizontal scroll bar on the table.
+ * <p>
+ * This feature is not supported in SWT and RWT since SWT does not offer such an api method.
+ */
+ boolean isAutoOptimizeWidth();
+
+ /**
+ * see {@link #isAutoOptimizeWidth()}
+ */
+ void setAutoOptimizeWidth(boolean optimize);
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/IDateColumn.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/IDateColumn.java
index 87022835f1..c6b734f83f 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/IDateColumn.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/IDateColumn.java
@@ -1,30 +1,30 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table.columns;
-
-import java.util.Date;
-
-public interface IDateColumn extends IColumn<Date> {
- double MILLIS_PER_DAY = 1000.0 * 3600.0 * 24.0;
-
- void setFormat(String s);
-
- String getFormat();
-
- boolean isHasDate();
-
- void setHasDate(boolean b);
-
- boolean isHasTime();
-
- void setHasTime(boolean b);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table.columns;
+
+import java.util.Date;
+
+public interface IDateColumn extends IColumn<Date> {
+ double MILLIS_PER_DAY = 1000.0 * 3600.0 * 24.0;
+
+ void setFormat(String s);
+
+ String getFormat();
+
+ boolean isHasDate();
+
+ void setHasDate(boolean b);
+
+ boolean isHasTime();
+
+ void setHasTime(boolean b);
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/IDoubleColumn.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/IDoubleColumn.java
index e203b18a28..78f71558ff 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/IDoubleColumn.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/IDoubleColumn.java
@@ -1,42 +1,42 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table.columns;
-
-import java.text.NumberFormat;
-
-public interface IDoubleColumn extends IColumn<Double> {
-
- void setFormat(String s);
-
- String getFormat();
-
- void setMinFractionDigits(int i);
-
- int getMinFractionDigits();
-
- void setMaxFractionDigits(int i);
-
- int getMaxFractionDigits();
-
- void setGroupingUsed(boolean b);
-
- boolean isGroupingUsed();
-
- void setPercent(boolean b);
-
- boolean isPercent();
-
- void setMultiplier(int b);
-
- int getMultiplier();
-
- NumberFormat getNumberFormat();
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table.columns;
+
+import java.text.NumberFormat;
+
+public interface IDoubleColumn extends IColumn<Double> {
+
+ void setFormat(String s);
+
+ String getFormat();
+
+ void setMinFractionDigits(int i);
+
+ int getMinFractionDigits();
+
+ void setMaxFractionDigits(int i);
+
+ int getMaxFractionDigits();
+
+ void setGroupingUsed(boolean b);
+
+ boolean isGroupingUsed();
+
+ void setPercent(boolean b);
+
+ boolean isPercent();
+
+ void setMultiplier(int b);
+
+ int getMultiplier();
+
+ NumberFormat getNumberFormat();
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/IIntegerColumn.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/IIntegerColumn.java
index a4d2928503..09cbb94b51 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/IIntegerColumn.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/IIntegerColumn.java
@@ -1,26 +1,26 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table.columns;
-
-import java.text.NumberFormat;
-
-public interface IIntegerColumn extends IColumn<Integer> {
-
- void setFormat(String s);
-
- String getFormat();
-
- void setGroupingUsed(boolean b);
-
- boolean isGroupingUsed();
-
- NumberFormat getNumberFormat();
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table.columns;
+
+import java.text.NumberFormat;
+
+public interface IIntegerColumn extends IColumn<Integer> {
+
+ void setFormat(String s);
+
+ String getFormat();
+
+ void setGroupingUsed(boolean b);
+
+ boolean isGroupingUsed();
+
+ NumberFormat getNumberFormat();
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/ILongColumn.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/ILongColumn.java
index ff1227558c..f9f16f6b6b 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/ILongColumn.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/ILongColumn.java
@@ -1,26 +1,26 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table.columns;
-
-import java.text.NumberFormat;
-
-public interface ILongColumn extends IColumn<Long> {
-
- void setFormat(String s);
-
- String getFormat();
-
- void setGroupingUsed(boolean b);
-
- boolean isGroupingUsed();
-
- NumberFormat getNumberFormat();
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table.columns;
+
+import java.text.NumberFormat;
+
+public interface ILongColumn extends IColumn<Long> {
+
+ void setFormat(String s);
+
+ String getFormat();
+
+ void setGroupingUsed(boolean b);
+
+ boolean isGroupingUsed();
+
+ NumberFormat getNumberFormat();
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/IObjectColumn.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/IObjectColumn.java
index a912c855e5..522abda3e6 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/IObjectColumn.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/IObjectColumn.java
@@ -1,15 +1,15 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table.columns;
-
-public interface IObjectColumn extends IColumn<Object> {
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table.columns;
+
+public interface IObjectColumn extends IColumn<Object> {
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/ISmartColumn.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/ISmartColumn.java
index d1c9d92c06..52b375964a 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/ISmartColumn.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/ISmartColumn.java
@@ -1,51 +1,51 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table.columns;
-
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.shared.services.common.code.ICodeType;
-import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
-
-public interface ISmartColumn<T> extends IColumn<T> {
-
- /**
- * code value decorator
- */
- Class<? extends ICodeType> getCodeTypeClass();
-
- void setCodeTypeClass(Class<? extends ICodeType> t);
-
- /**
- * custom value decorator
- */
- LookupCall getLookupCall();
-
- void setLookupCall(LookupCall c);
-
- LookupCall prepareLookupCall(ITableRow row);
-
- /**
- * see {@link #setSortCodesByDisplayText(boolean)}
- *
- * @since 04.11.2009
- */
- boolean isSortCodesByDisplayText();
-
- /**
- * Sorting of columns with attached {@link ICodeType} can be based on the
- * codes sort order or their display texts. Default is sort by codes sort
- * order.
- *
- * @since 04.11.2009 ticket 82478
- */
- void setSortCodesByDisplayText(boolean b);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table.columns;
+
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.shared.services.common.code.ICodeType;
+import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
+
+public interface ISmartColumn<T> extends IColumn<T> {
+
+ /**
+ * code value decorator
+ */
+ Class<? extends ICodeType> getCodeTypeClass();
+
+ void setCodeTypeClass(Class<? extends ICodeType> t);
+
+ /**
+ * custom value decorator
+ */
+ LookupCall getLookupCall();
+
+ void setLookupCall(LookupCall c);
+
+ LookupCall prepareLookupCall(ITableRow row);
+
+ /**
+ * see {@link #setSortCodesByDisplayText(boolean)}
+ *
+ * @since 04.11.2009
+ */
+ boolean isSortCodesByDisplayText();
+
+ /**
+ * Sorting of columns with attached {@link ICodeType} can be based on the
+ * codes sort order or their display texts. Default is sort by codes sort
+ * order.
+ *
+ * @since 04.11.2009 ticket 82478
+ */
+ void setSortCodesByDisplayText(boolean b);
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/IStringColumn.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/IStringColumn.java
index 6a77bf4821..6178f3aab5 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/IStringColumn.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/columns/IStringColumn.java
@@ -1,38 +1,38 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table.columns;
-
-public interface IStringColumn extends IColumn<String> {
- /* enum for formats */
-
- /**
- * Display format for upper case letters.
- */
- String FORMAT_UPPER = "A";
-
- /**
- * Display format for lower case letters.
- */
- String FORMAT_LOWER = "a";
-
- void setInputMasked(boolean b);
-
- boolean isInputMasked();
-
- void setDisplayFormat(String s);
-
- String getDisplayFormat();
-
- void setTextWrap(boolean b);
-
- boolean isTextWrap();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table.columns;
+
+public interface IStringColumn extends IColumn<String> {
+ /* enum for formats */
+
+ /**
+ * Display format for upper case letters.
+ */
+ String FORMAT_UPPER = "A";
+
+ /**
+ * Display format for lower case letters.
+ */
+ String FORMAT_LOWER = "a";
+
+ void setInputMasked(boolean b);
+
+ boolean isInputMasked();
+
+ void setDisplayFormat(String s);
+
+ String getDisplayFormat();
+
+ void setTextWrap(boolean b);
+
+ boolean isTextWrap();
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/customizer/AbstractTableCustomizer.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/customizer/AbstractTableCustomizer.java
index a6848b50f7..a920142d1c 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/customizer/AbstractTableCustomizer.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/customizer/AbstractTableCustomizer.java
@@ -1,52 +1,52 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table.customizer;
-
-import java.util.List;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-
-/**
- * empty implementation
- */
-public class AbstractTableCustomizer implements ITableCustomizer {
-
- @Override
- public void addColumn() throws ProcessingException {
- }
-
- @Override
- public void injectCustomColumns(List<IColumn<?>> columnList) {
- }
-
- @Override
- public void modifyColumn(ICustomColumn<?> col) throws ProcessingException {
- }
-
- @Override
- public void removeAllColumns() throws ProcessingException {
- }
-
- @Override
- public void removeColumn(ICustomColumn<?> col) throws ProcessingException {
- }
-
- @Override
- public byte[] getSerializedData() throws ProcessingException {
- return null;
- }
-
- @Override
- public void setSerializedData(byte[] data) throws ProcessingException {
-
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table.customizer;
+
+import java.util.List;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+
+/**
+ * empty implementation
+ */
+public class AbstractTableCustomizer implements ITableCustomizer {
+
+ @Override
+ public void addColumn() throws ProcessingException {
+ }
+
+ @Override
+ public void injectCustomColumns(List<IColumn<?>> columnList) {
+ }
+
+ @Override
+ public void modifyColumn(ICustomColumn<?> col) throws ProcessingException {
+ }
+
+ @Override
+ public void removeAllColumns() throws ProcessingException {
+ }
+
+ @Override
+ public void removeColumn(ICustomColumn<?> col) throws ProcessingException {
+ }
+
+ @Override
+ public byte[] getSerializedData() throws ProcessingException {
+ return null;
+ }
+
+ @Override
+ public void setSerializedData(byte[] data) throws ProcessingException {
+
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/customizer/AddCustomColumnMenu.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/customizer/AddCustomColumnMenu.java
index a128d5850e..9d21947eb3 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/customizer/AddCustomColumnMenu.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/customizer/AddCustomColumnMenu.java
@@ -1,49 +1,49 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table.customizer;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.security.CreateCustomColumnPermission;
-
-public class AddCustomColumnMenu extends AbstractMenu {
- private final ITable m_table;
-
- public AddCustomColumnMenu(ITable table) {
- m_table = table;
- }
-
- @Override
- protected String getConfiguredText() {
- return ScoutTexts.get("AddCustomColumnMenu");
- }
-
- @Override
- protected void execInitAction() throws ProcessingException {
- setVisiblePermission(new CreateCustomColumnPermission());
- }
-
- @Override
- protected void execPrepareAction() throws ProcessingException {
- setVisible(m_table.getTableCustomizer() != null);
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- if (m_table != null) {
- if (m_table.getTableCustomizer() != null) {
- m_table.getTableCustomizer().addColumn();
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table.customizer;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.security.CreateCustomColumnPermission;
+
+public class AddCustomColumnMenu extends AbstractMenu {
+ private final ITable m_table;
+
+ public AddCustomColumnMenu(ITable table) {
+ m_table = table;
+ }
+
+ @Override
+ protected String getConfiguredText() {
+ return ScoutTexts.get("AddCustomColumnMenu");
+ }
+
+ @Override
+ protected void execInitAction() throws ProcessingException {
+ setVisiblePermission(new CreateCustomColumnPermission());
+ }
+
+ @Override
+ protected void execPrepareAction() throws ProcessingException {
+ setVisible(m_table.getTableCustomizer() != null);
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ if (m_table != null) {
+ if (m_table.getTableCustomizer() != null) {
+ m_table.getTableCustomizer().addColumn();
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/customizer/ICustomColumn.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/customizer/ICustomColumn.java
index b095c49fdf..c8ccbde024 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/customizer/ICustomColumn.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/customizer/ICustomColumn.java
@@ -1,20 +1,20 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table.customizer;
-
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-
-/**
- * Marker interface for dynamic custom columns that were added (injected) to a table
- */
-public interface ICustomColumn<T> extends IColumn<T> {
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table.customizer;
+
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+
+/**
+ * Marker interface for dynamic custom columns that were added (injected) to a table
+ */
+public interface ICustomColumn<T> extends IColumn<T> {
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/customizer/ITableCustomizer.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/customizer/ITableCustomizer.java
index 32ca1bf69a..a5130fa4fb 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/customizer/ITableCustomizer.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/customizer/ITableCustomizer.java
@@ -1,61 +1,61 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table.customizer;
-
-import java.util.List;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-
-/**
- * Perform table customization, such as adding custom columns
- */
-public interface ITableCustomizer {
-
- /**
- * Append custom columns
- *
- * @param columnList
- * live and mutable list of configured columns, not yet initialized
- */
- void injectCustomColumns(List<IColumn<?>> columnList);
-
- /**
- * Add a new custom column to the table by for example showing a form with potential candidates
- */
- void addColumn() throws ProcessingException;
-
- /**
- * Modify an existing custom column
- */
- void modifyColumn(ICustomColumn<?> col) throws ProcessingException;
-
- /**
- * Remove an existing custom column
- */
- void removeColumn(ICustomColumn<?> col) throws ProcessingException;
-
- /**
- * Remove all existing custom columns
- */
- void removeAllColumns() throws ProcessingException;
-
- /**
- * Get the serialized data of the TableCustomizer for further processing (e.g. storing a bookmark)
- */
- byte[] getSerializedData() throws ProcessingException;
-
- /**
- * Import the serialized data, e.g. after restoring from a bookmark
- */
- void setSerializedData(byte[] data) throws ProcessingException;
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table.customizer;
+
+import java.util.List;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+
+/**
+ * Perform table customization, such as adding custom columns
+ */
+public interface ITableCustomizer {
+
+ /**
+ * Append custom columns
+ *
+ * @param columnList
+ * live and mutable list of configured columns, not yet initialized
+ */
+ void injectCustomColumns(List<IColumn<?>> columnList);
+
+ /**
+ * Add a new custom column to the table by for example showing a form with potential candidates
+ */
+ void addColumn() throws ProcessingException;
+
+ /**
+ * Modify an existing custom column
+ */
+ void modifyColumn(ICustomColumn<?> col) throws ProcessingException;
+
+ /**
+ * Remove an existing custom column
+ */
+ void removeColumn(ICustomColumn<?> col) throws ProcessingException;
+
+ /**
+ * Remove all existing custom columns
+ */
+ void removeAllColumns() throws ProcessingException;
+
+ /**
+ * Get the serialized data of the TableCustomizer for further processing (e.g. storing a bookmark)
+ */
+ byte[] getSerializedData() throws ProcessingException;
+
+ /**
+ * Import the serialized data, e.g. after restoring from a bookmark
+ */
+ void setSerializedData(byte[] data) throws ProcessingException;
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/customizer/ModifyCustomColumnMenu.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/customizer/ModifyCustomColumnMenu.java
index 78517c3bb8..c0c0c2540d 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/customizer/ModifyCustomColumnMenu.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/customizer/ModifyCustomColumnMenu.java
@@ -1,54 +1,54 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table.customizer;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.security.UpdateCustomColumnPermission;
-
-public class ModifyCustomColumnMenu extends AbstractMenu {
- private final ITable m_table;
-
- public ModifyCustomColumnMenu(ITable table) {
- m_table = table;
- }
-
- @Override
- protected String getConfiguredText() {
- return ScoutTexts.get("ModifyCustomColumnMenu");
- }
-
- @Override
- protected void execInitAction() throws ProcessingException {
- setVisiblePermission(new UpdateCustomColumnPermission());
- }
-
- @Override
- protected void execPrepareAction() throws ProcessingException {
- ITableCustomizer cst = m_table.getTableCustomizer();
- IColumn<?> col = m_table.getContextColumn();
- setVisible(cst != null && col instanceof ICustomColumn<?>);
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- if (m_table != null) {
- ITableCustomizer cst = m_table.getTableCustomizer();
- IColumn<?> col = m_table.getContextColumn();
- if (cst != null && col instanceof ICustomColumn<?>) {
- cst.modifyColumn((ICustomColumn<?>) col);
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table.customizer;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.security.UpdateCustomColumnPermission;
+
+public class ModifyCustomColumnMenu extends AbstractMenu {
+ private final ITable m_table;
+
+ public ModifyCustomColumnMenu(ITable table) {
+ m_table = table;
+ }
+
+ @Override
+ protected String getConfiguredText() {
+ return ScoutTexts.get("ModifyCustomColumnMenu");
+ }
+
+ @Override
+ protected void execInitAction() throws ProcessingException {
+ setVisiblePermission(new UpdateCustomColumnPermission());
+ }
+
+ @Override
+ protected void execPrepareAction() throws ProcessingException {
+ ITableCustomizer cst = m_table.getTableCustomizer();
+ IColumn<?> col = m_table.getContextColumn();
+ setVisible(cst != null && col instanceof ICustomColumn<?>);
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ if (m_table != null) {
+ ITableCustomizer cst = m_table.getTableCustomizer();
+ IColumn<?> col = m_table.getContextColumn();
+ if (cst != null && col instanceof ICustomColumn<?>) {
+ cst.modifyColumn((ICustomColumn<?>) col);
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/customizer/RemoveCustomColumnMenu.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/customizer/RemoveCustomColumnMenu.java
index 11dd7c91f0..15e74f450d 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/customizer/RemoveCustomColumnMenu.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/customizer/RemoveCustomColumnMenu.java
@@ -1,58 +1,58 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table.customizer;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-import org.eclipse.scout.rt.client.ui.messagebox.MessageBox;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.TEXTS;
-import org.eclipse.scout.rt.shared.security.DeleteCustomColumnPermission;
-
-public class RemoveCustomColumnMenu extends AbstractMenu {
- private final ITable m_table;
-
- public RemoveCustomColumnMenu(ITable table) {
- m_table = table;
- }
-
- @Override
- protected String getConfiguredText() {
- return ScoutTexts.get("RemoveCustomColumnMenu");
- }
-
- @Override
- protected void execInitAction() throws ProcessingException {
- setVisiblePermission(new DeleteCustomColumnPermission());
- }
-
- @Override
- protected void execPrepareAction() throws ProcessingException {
- ITableCustomizer cst = m_table.getTableCustomizer();
- IColumn<?> col = m_table.getContextColumn();
- setVisible(cst != null && col instanceof ICustomColumn<?>);
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- if (m_table != null) {
- ITableCustomizer cst = m_table.getTableCustomizer();
- IColumn<?> col = m_table.getContextColumn();
- if (cst != null && col instanceof ICustomColumn<?>) {
- if (MessageBox.showDeleteConfirmationMessage(TEXTS.get("Columns"), col.getHeaderCell().getText())) {
- cst.removeColumn((ICustomColumn<?>) col);
- }
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table.customizer;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+import org.eclipse.scout.rt.client.ui.messagebox.MessageBox;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.TEXTS;
+import org.eclipse.scout.rt.shared.security.DeleteCustomColumnPermission;
+
+public class RemoveCustomColumnMenu extends AbstractMenu {
+ private final ITable m_table;
+
+ public RemoveCustomColumnMenu(ITable table) {
+ m_table = table;
+ }
+
+ @Override
+ protected String getConfiguredText() {
+ return ScoutTexts.get("RemoveCustomColumnMenu");
+ }
+
+ @Override
+ protected void execInitAction() throws ProcessingException {
+ setVisiblePermission(new DeleteCustomColumnPermission());
+ }
+
+ @Override
+ protected void execPrepareAction() throws ProcessingException {
+ ITableCustomizer cst = m_table.getTableCustomizer();
+ IColumn<?> col = m_table.getContextColumn();
+ setVisible(cst != null && col instanceof ICustomColumn<?>);
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ if (m_table != null) {
+ ITableCustomizer cst = m_table.getTableCustomizer();
+ IColumn<?> col = m_table.getContextColumn();
+ if (cst != null && col instanceof ICustomColumn<?>) {
+ if (MessageBox.showDeleteConfirmationMessage(TEXTS.get("Columns"), col.getHeaderCell().getText())) {
+ cst.removeColumn((ICustomColumn<?>) col);
+ }
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/internal/HolderToRowMapper.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/internal/HolderToRowMapper.java
index d08d50ff8a..373e33ee0e 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/internal/HolderToRowMapper.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/internal/HolderToRowMapper.java
@@ -1,32 +1,32 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table.internal;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.holders.IHolder;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-
-public class HolderToRowMapper<T> {
- private ITableRow m_row;
- private IColumn<T> m_col;
- private IHolder<T> m_holder;
-
- public HolderToRowMapper(ITableRow row, IColumn<T> col, IHolder<T> holder) {
- m_row = row;
- m_col = col;
- m_holder = holder;
- }
-
- public void importRowValue() throws ProcessingException {
- m_col.setValue(m_row, m_holder.getValue());
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table.internal;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.holders.IHolder;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+
+public class HolderToRowMapper<T> {
+ private ITableRow m_row;
+ private IColumn<T> m_col;
+ private IHolder<T> m_holder;
+
+ public HolderToRowMapper(ITableRow row, IColumn<T> col, IHolder<T> holder) {
+ m_row = row;
+ m_col = col;
+ m_holder = holder;
+ }
+
+ public void importRowValue() throws ProcessingException {
+ m_col.setValue(m_row, m_holder.getValue());
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/internal/InternalTableRow.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/internal/InternalTableRow.java
index f442ec3ab0..def6ea61eb 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/internal/InternalTableRow.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/internal/InternalTableRow.java
@@ -1,526 +1,526 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table.internal;
-
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.commons.VerboseUtility;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
-import org.eclipse.scout.rt.client.ui.basic.cell.ICell;
-import org.eclipse.scout.rt.client.ui.basic.cell.ICellObserver;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-import org.eclipse.scout.rt.client.ui.profiler.DesktopProfiler;
-import org.eclipse.scout.rt.shared.data.basic.FontSpec;
-
-public class InternalTableRow implements ITableRow, ICellObserver {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(InternalTableRow.class);
-
- private ITable m_table;
- private int m_rowIndex;
- private boolean m_enabled;
- private boolean m_checked;
- private String m_iconId;
- private int m_status = STATUS_NON_CHANGED;
- private Cell[] m_cells;
- private int m_rowChanging = 0;
- private boolean m_rowPropertiesChanged;
- private boolean m_filterAccepted;
-
- private InternalTableRow() {
- if (DesktopProfiler.getInstance().isEnabled()) {
- DesktopProfiler.getInstance().registerTableRow(this);
- }
- }
-
- public InternalTableRow(ITable table) {
- this();
- m_table = table;
- m_enabled = true;
- m_status = STATUS_NON_CHANGED;
- m_filterAccepted = true;
- m_cells = new Cell[table.getColumnCount()];
- for (int i = 0; i < m_cells.length; i++) {
- m_cells[i] = new Cell(this);
- }
- }
-
- public InternalTableRow(ITable table, ITableRow row) throws ProcessingException {
- this();
- m_rowIndex = row.getRowIndex();
- m_enabled = row.isEnabled();
- m_checked = row.isChecked();
- m_status = row.getStatus();
- m_cells = new Cell[table.getColumnCount()];
- for (int i = 0; i < m_cells.length; i++) {
- m_cells[i] = new Cell(this, row.getCell(i));
- }
- // validate values
- IColumn[] cols = table.getColumns();
- for (int i = 0; i < m_cells.length && i < cols.length; i++) {
- Object value = m_cells[i].getValue();
- value = cols[i].parseValue(this, value);
- m_cells[i].setValue(value);
- }
- // reset status
- m_status = row.getStatus();
- // set table at end to avoid events before the row is even attached
- m_table = table;
- }
-
- @Override
- public int getRowIndex() {
- return m_rowIndex;
- }
-
- public void setRowIndex(int index) {
- m_rowIndex = index;
- }
-
- @Override
- public int getStatus() {
- return m_status;
- }
-
- @Override
- public void setStatus(int status) {
- try {
- setRowChanging(true);
- //
- if (m_status != status) {
- m_status = status;
- m_rowPropertiesChanged = true;
- }
- }
- finally {
- setRowChanging(false);
- }
- }
-
- @Override
- public boolean isStatusInserted() {
- return m_status == STATUS_INSERTED;
- }
-
- @Override
- public void setStatusInserted() {
- setStatus(STATUS_INSERTED);
- }
-
- @Override
- public boolean isStatusUpdated() {
- return m_status == STATUS_UPDATED;
- }
-
- @Override
- public void setStatusUpdated() {
- setStatus(STATUS_UPDATED);
- }
-
- @Override
- public boolean isStatusDeleted() {
- return m_status == STATUS_DELETED;
- }
-
- @Override
- public void setStatusDeleted() {
- setStatus(STATUS_DELETED);
- }
-
- @Override
- public boolean isStatusNonchanged() {
- return m_status == STATUS_NON_CHANGED;
- }
-
- @Override
- public void setStatusNonchanged() {
- setStatus(STATUS_NON_CHANGED);
- }
-
- @Override
- public boolean isEnabled() {
- return m_enabled;
- }
-
- @Override
- public void setEnabled(boolean b) {
- try {
- setRowChanging(true);
- //
- m_enabled = b;
- for (int i = 0; i < m_cells.length; i++) {
- m_cells[i].setEnabled(m_enabled);
- }
- }
- finally {
- setRowChanging(false);
- }
- }
-
- @Override
- public boolean isSelected() {
- return getTable().isSelectedRow(this);
- }
-
- @Override
- public boolean isChecked() {
- return m_checked;
- }
-
- @Override
- public void setChecked(boolean b) {
- if (m_checked != b) {
- try {
- setRowChanging(true);
- //
- m_checked = b;
- m_rowPropertiesChanged = true;
- //
- //uncheck others in single-check mode
- ITable table = getTable();
- if (table != null) {
- if (table.getCheckableColumn() != null) {
- try {
- table.getCheckableColumn().setValue(this, b);
- }
- catch (ProcessingException e) {
- LOG.warn("Value could not be set on CheckableColumn", e);
- }
- }
- if (b && !table.isMultiCheck()) {
- for (ITableRow cr : table.getCheckedRows()) {
- if (cr != this) {
- cr.setChecked(false);
- }
- }
- }
- }
- }
- finally {
- setRowChanging(false);
- }
- }
- }
-
- @Override
- public boolean isFilterAccepted() {
- return m_filterAccepted;
- }
-
- /**
- * do not use this internal method
- */
- public void setFilterAcceptedInternal(boolean b) {
- m_filterAccepted = b;
- }
-
- @Override
- public int getCellCount() {
- return m_cells.length;
- }
-
- @Override
- public ICell getCell(IColumn column) {
- return getCell(column.getColumnIndex());
- }
-
- @Override
- public ICell getCell(int columnIndex) {
- if (columnIndex < 0 || columnIndex >= m_cells.length) {
- return new Cell();
- }
- return m_cells[columnIndex];
- }
-
- @Override
- public void setCell(IColumn column, ICell cell) throws ProcessingException {
- setCell(column.getColumnIndex(), cell);
- }
-
- @Override
- public void setCell(int columnIndex, ICell cell) throws ProcessingException {
- if (cell != null) {
- try {
- setRowChanging(true);
- //
- // copy all fields
- m_cells[columnIndex] = new Cell(this, cell);
- }
- finally {
- setRowChanging(false);
- }
- }
- }
-
- @Override
- public Cell getCellForUpdate(IColumn column) {
- return getCellForUpdate(column.getColumnIndex());
- }
-
- @Override
- public Cell getCellForUpdate(int columnIndex) {
- return m_cells[columnIndex];
- }
-
- @Override
- public Object getCellValue(int columnIndex) {
- return m_cells[columnIndex].getValue();
- }
-
- @Override
- public Object[] getKeyValues() {
- int[] keyColumns = getTable().getColumnSet().getKeyColumnIndexes();
- if (keyColumns.length == 0) {
- keyColumns = getTable().getColumnSet().getAllColumnIndexes();
- }
- Object[] pk = new Object[keyColumns.length];
- for (int i = 0; i < keyColumns.length; i++) {
- pk[i] = m_cells[keyColumns[i]].getValue();
- }
- return pk;
- }
-
- @Override
- public boolean isRowChanging() {
- return m_rowChanging > 0;
- }
-
- @Override
- public void setRowChanging(boolean b) {
- if (b) {
- m_rowChanging++;
- }
- else {
- m_rowChanging--;
- if (m_rowChanging == 0 && m_rowPropertiesChanged) {
- m_rowPropertiesChanged = false;
- if (getTable() != null) {
- getTable().updateRow(this);
- }
- }
- }
- }
-
- @Override
- public boolean isRowPropertiesChanged() {
- return m_rowPropertiesChanged;
- }
-
- @Override
- public void setRowPropertiesChanged(boolean b) {
- m_rowPropertiesChanged = b;
- }
-
- @Override
- public boolean/* changed */setCellValue(int columnIndex, Object value) throws ProcessingException {
- return m_cells[columnIndex].setValue(value);
- }
-
- @Override
- public boolean setCellValues(Object[] values) throws ProcessingException {
- boolean changed = false;
- for (int i = 0; i < values.length; i++) {
- boolean b = setCellValue(i, values[i]);
- changed = changed || b;
- }
- return changed;
- }
-
- @Override
- public ITable getTable() {
- return m_table;
- }
-
- /**
- * do not use this internal method
- */
- public void setTableInternal(ITable table) {
- m_table = table;
- }
-
- @Override
- public void touch() throws ProcessingException {
- try {
- setRowChanging(true);
- //
- m_rowPropertiesChanged = true;
- }
- finally {
- setRowChanging(false);
- }
- }
-
- @Override
- public void delete() throws ProcessingException {
- if (getTable() != null) {
- getTable().deleteRow(this);
- }
- }
-
- @Override
- public void setBackgroundColor(String c) {
- try {
- setRowChanging(true);
- //
- for (int i = 0; i < m_cells.length; i++) {
- m_cells[i].setBackgroundColor(c);
- }
- }
- finally {
- setRowChanging(false);
- }
- }
-
- @Override
- public void setForegroundColor(String c) {
- try {
- setRowChanging(true);
- //
- for (int i = 0; i < m_cells.length; i++) {
- m_cells[i].setForegroundColor(c);
- }
- }
- finally {
- setRowChanging(false);
- }
- }
-
- @Override
- public void setFont(FontSpec f) {
- try {
- setRowChanging(true);
- //
- for (int i = 0; i < m_cells.length; i++) {
- m_cells[i].setFont(f);
- }
- }
- finally {
- setRowChanging(false);
- }
- }
-
- @Override
- public void setTooltipText(String s) {
- try {
- setRowChanging(true);
- //
- for (int i = 0; i < m_cells.length; i++) {
- m_cells[i].setTooltipText(s);
- }
- }
- finally {
- setRowChanging(false);
- }
- }
-
- @Override
- public void setIconId(String id) {
- try {
- setRowChanging(true);
- //
- m_iconId = id;
- m_rowPropertiesChanged = true;
- }
- finally {
- setRowChanging(false);
- }
- }
-
- @Override
- public String getIconId() {
- return m_iconId;
- }
-
- @Override
- public void moveToTop() {
- if (getTable() != null) {
- getTable().moveRow(getRowIndex(), 0);
- }
- }
-
- @Override
- public void moveToBottom() {
- if (getTable() != null) {
- getTable().moveRow(getRowIndex(), getTable().getRowCount());
- }
- }
-
- @Override
- public void moveUp() {
- if (getTable() != null) {
- getTable().moveRow(getRowIndex(), getRowIndex() - 1);
- }
- }
-
- @Override
- public void moveDown() {
- if (getTable() != null) {
- getTable().moveRow(getRowIndex(), getRowIndex() + 1);
- }
- }
-
- /*
- * Implementation of ICellObserver
- */
- @Override
- public Object validateValue(ICell cell, Object value) throws ProcessingException {
- Object oldValue = cell.getValue();
- if (CompareUtility.equals(oldValue, value)) {
- // no change in value
- return value;
- }
- else {
- // validate value
- if (getTable() != null) {
- int colIndex = -1;
- for (int i = 0; i < m_cells.length; i++) {
- if (m_cells[i] == cell) {
- colIndex = i;
- break;
- }
- }
- if (colIndex >= 0) {
- IColumn column = getTable().getColumnSet().getColumn(colIndex);
- value = column.parseValue(this, value);
- }
- }
- return value;
- }
- }
-
- @Override
- public void cellChanged(ICell cell, int changedBit) {
- try {
- setRowChanging(true);
- //
- if (changedBit == ICell.VALUE_BIT) {
- if (isStatusNonchanged()) {
- setStatusUpdated();
- }
- else {
- // keep inserted, deleted
- }
- }
- m_rowPropertiesChanged = true;
- }
- finally {
- setRowChanging(false);
- }
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName() + "[" + VerboseUtility.dumpObjects(m_cells) + "]";
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table.internal;
+
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.commons.VerboseUtility;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
+import org.eclipse.scout.rt.client.ui.basic.cell.ICell;
+import org.eclipse.scout.rt.client.ui.basic.cell.ICellObserver;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+import org.eclipse.scout.rt.client.ui.profiler.DesktopProfiler;
+import org.eclipse.scout.rt.shared.data.basic.FontSpec;
+
+public class InternalTableRow implements ITableRow, ICellObserver {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(InternalTableRow.class);
+
+ private ITable m_table;
+ private int m_rowIndex;
+ private boolean m_enabled;
+ private boolean m_checked;
+ private String m_iconId;
+ private int m_status = STATUS_NON_CHANGED;
+ private Cell[] m_cells;
+ private int m_rowChanging = 0;
+ private boolean m_rowPropertiesChanged;
+ private boolean m_filterAccepted;
+
+ private InternalTableRow() {
+ if (DesktopProfiler.getInstance().isEnabled()) {
+ DesktopProfiler.getInstance().registerTableRow(this);
+ }
+ }
+
+ public InternalTableRow(ITable table) {
+ this();
+ m_table = table;
+ m_enabled = true;
+ m_status = STATUS_NON_CHANGED;
+ m_filterAccepted = true;
+ m_cells = new Cell[table.getColumnCount()];
+ for (int i = 0; i < m_cells.length; i++) {
+ m_cells[i] = new Cell(this);
+ }
+ }
+
+ public InternalTableRow(ITable table, ITableRow row) throws ProcessingException {
+ this();
+ m_rowIndex = row.getRowIndex();
+ m_enabled = row.isEnabled();
+ m_checked = row.isChecked();
+ m_status = row.getStatus();
+ m_cells = new Cell[table.getColumnCount()];
+ for (int i = 0; i < m_cells.length; i++) {
+ m_cells[i] = new Cell(this, row.getCell(i));
+ }
+ // validate values
+ IColumn[] cols = table.getColumns();
+ for (int i = 0; i < m_cells.length && i < cols.length; i++) {
+ Object value = m_cells[i].getValue();
+ value = cols[i].parseValue(this, value);
+ m_cells[i].setValue(value);
+ }
+ // reset status
+ m_status = row.getStatus();
+ // set table at end to avoid events before the row is even attached
+ m_table = table;
+ }
+
+ @Override
+ public int getRowIndex() {
+ return m_rowIndex;
+ }
+
+ public void setRowIndex(int index) {
+ m_rowIndex = index;
+ }
+
+ @Override
+ public int getStatus() {
+ return m_status;
+ }
+
+ @Override
+ public void setStatus(int status) {
+ try {
+ setRowChanging(true);
+ //
+ if (m_status != status) {
+ m_status = status;
+ m_rowPropertiesChanged = true;
+ }
+ }
+ finally {
+ setRowChanging(false);
+ }
+ }
+
+ @Override
+ public boolean isStatusInserted() {
+ return m_status == STATUS_INSERTED;
+ }
+
+ @Override
+ public void setStatusInserted() {
+ setStatus(STATUS_INSERTED);
+ }
+
+ @Override
+ public boolean isStatusUpdated() {
+ return m_status == STATUS_UPDATED;
+ }
+
+ @Override
+ public void setStatusUpdated() {
+ setStatus(STATUS_UPDATED);
+ }
+
+ @Override
+ public boolean isStatusDeleted() {
+ return m_status == STATUS_DELETED;
+ }
+
+ @Override
+ public void setStatusDeleted() {
+ setStatus(STATUS_DELETED);
+ }
+
+ @Override
+ public boolean isStatusNonchanged() {
+ return m_status == STATUS_NON_CHANGED;
+ }
+
+ @Override
+ public void setStatusNonchanged() {
+ setStatus(STATUS_NON_CHANGED);
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return m_enabled;
+ }
+
+ @Override
+ public void setEnabled(boolean b) {
+ try {
+ setRowChanging(true);
+ //
+ m_enabled = b;
+ for (int i = 0; i < m_cells.length; i++) {
+ m_cells[i].setEnabled(m_enabled);
+ }
+ }
+ finally {
+ setRowChanging(false);
+ }
+ }
+
+ @Override
+ public boolean isSelected() {
+ return getTable().isSelectedRow(this);
+ }
+
+ @Override
+ public boolean isChecked() {
+ return m_checked;
+ }
+
+ @Override
+ public void setChecked(boolean b) {
+ if (m_checked != b) {
+ try {
+ setRowChanging(true);
+ //
+ m_checked = b;
+ m_rowPropertiesChanged = true;
+ //
+ //uncheck others in single-check mode
+ ITable table = getTable();
+ if (table != null) {
+ if (table.getCheckableColumn() != null) {
+ try {
+ table.getCheckableColumn().setValue(this, b);
+ }
+ catch (ProcessingException e) {
+ LOG.warn("Value could not be set on CheckableColumn", e);
+ }
+ }
+ if (b && !table.isMultiCheck()) {
+ for (ITableRow cr : table.getCheckedRows()) {
+ if (cr != this) {
+ cr.setChecked(false);
+ }
+ }
+ }
+ }
+ }
+ finally {
+ setRowChanging(false);
+ }
+ }
+ }
+
+ @Override
+ public boolean isFilterAccepted() {
+ return m_filterAccepted;
+ }
+
+ /**
+ * do not use this internal method
+ */
+ public void setFilterAcceptedInternal(boolean b) {
+ m_filterAccepted = b;
+ }
+
+ @Override
+ public int getCellCount() {
+ return m_cells.length;
+ }
+
+ @Override
+ public ICell getCell(IColumn column) {
+ return getCell(column.getColumnIndex());
+ }
+
+ @Override
+ public ICell getCell(int columnIndex) {
+ if (columnIndex < 0 || columnIndex >= m_cells.length) {
+ return new Cell();
+ }
+ return m_cells[columnIndex];
+ }
+
+ @Override
+ public void setCell(IColumn column, ICell cell) throws ProcessingException {
+ setCell(column.getColumnIndex(), cell);
+ }
+
+ @Override
+ public void setCell(int columnIndex, ICell cell) throws ProcessingException {
+ if (cell != null) {
+ try {
+ setRowChanging(true);
+ //
+ // copy all fields
+ m_cells[columnIndex] = new Cell(this, cell);
+ }
+ finally {
+ setRowChanging(false);
+ }
+ }
+ }
+
+ @Override
+ public Cell getCellForUpdate(IColumn column) {
+ return getCellForUpdate(column.getColumnIndex());
+ }
+
+ @Override
+ public Cell getCellForUpdate(int columnIndex) {
+ return m_cells[columnIndex];
+ }
+
+ @Override
+ public Object getCellValue(int columnIndex) {
+ return m_cells[columnIndex].getValue();
+ }
+
+ @Override
+ public Object[] getKeyValues() {
+ int[] keyColumns = getTable().getColumnSet().getKeyColumnIndexes();
+ if (keyColumns.length == 0) {
+ keyColumns = getTable().getColumnSet().getAllColumnIndexes();
+ }
+ Object[] pk = new Object[keyColumns.length];
+ for (int i = 0; i < keyColumns.length; i++) {
+ pk[i] = m_cells[keyColumns[i]].getValue();
+ }
+ return pk;
+ }
+
+ @Override
+ public boolean isRowChanging() {
+ return m_rowChanging > 0;
+ }
+
+ @Override
+ public void setRowChanging(boolean b) {
+ if (b) {
+ m_rowChanging++;
+ }
+ else {
+ m_rowChanging--;
+ if (m_rowChanging == 0 && m_rowPropertiesChanged) {
+ m_rowPropertiesChanged = false;
+ if (getTable() != null) {
+ getTable().updateRow(this);
+ }
+ }
+ }
+ }
+
+ @Override
+ public boolean isRowPropertiesChanged() {
+ return m_rowPropertiesChanged;
+ }
+
+ @Override
+ public void setRowPropertiesChanged(boolean b) {
+ m_rowPropertiesChanged = b;
+ }
+
+ @Override
+ public boolean/* changed */setCellValue(int columnIndex, Object value) throws ProcessingException {
+ return m_cells[columnIndex].setValue(value);
+ }
+
+ @Override
+ public boolean setCellValues(Object[] values) throws ProcessingException {
+ boolean changed = false;
+ for (int i = 0; i < values.length; i++) {
+ boolean b = setCellValue(i, values[i]);
+ changed = changed || b;
+ }
+ return changed;
+ }
+
+ @Override
+ public ITable getTable() {
+ return m_table;
+ }
+
+ /**
+ * do not use this internal method
+ */
+ public void setTableInternal(ITable table) {
+ m_table = table;
+ }
+
+ @Override
+ public void touch() throws ProcessingException {
+ try {
+ setRowChanging(true);
+ //
+ m_rowPropertiesChanged = true;
+ }
+ finally {
+ setRowChanging(false);
+ }
+ }
+
+ @Override
+ public void delete() throws ProcessingException {
+ if (getTable() != null) {
+ getTable().deleteRow(this);
+ }
+ }
+
+ @Override
+ public void setBackgroundColor(String c) {
+ try {
+ setRowChanging(true);
+ //
+ for (int i = 0; i < m_cells.length; i++) {
+ m_cells[i].setBackgroundColor(c);
+ }
+ }
+ finally {
+ setRowChanging(false);
+ }
+ }
+
+ @Override
+ public void setForegroundColor(String c) {
+ try {
+ setRowChanging(true);
+ //
+ for (int i = 0; i < m_cells.length; i++) {
+ m_cells[i].setForegroundColor(c);
+ }
+ }
+ finally {
+ setRowChanging(false);
+ }
+ }
+
+ @Override
+ public void setFont(FontSpec f) {
+ try {
+ setRowChanging(true);
+ //
+ for (int i = 0; i < m_cells.length; i++) {
+ m_cells[i].setFont(f);
+ }
+ }
+ finally {
+ setRowChanging(false);
+ }
+ }
+
+ @Override
+ public void setTooltipText(String s) {
+ try {
+ setRowChanging(true);
+ //
+ for (int i = 0; i < m_cells.length; i++) {
+ m_cells[i].setTooltipText(s);
+ }
+ }
+ finally {
+ setRowChanging(false);
+ }
+ }
+
+ @Override
+ public void setIconId(String id) {
+ try {
+ setRowChanging(true);
+ //
+ m_iconId = id;
+ m_rowPropertiesChanged = true;
+ }
+ finally {
+ setRowChanging(false);
+ }
+ }
+
+ @Override
+ public String getIconId() {
+ return m_iconId;
+ }
+
+ @Override
+ public void moveToTop() {
+ if (getTable() != null) {
+ getTable().moveRow(getRowIndex(), 0);
+ }
+ }
+
+ @Override
+ public void moveToBottom() {
+ if (getTable() != null) {
+ getTable().moveRow(getRowIndex(), getTable().getRowCount());
+ }
+ }
+
+ @Override
+ public void moveUp() {
+ if (getTable() != null) {
+ getTable().moveRow(getRowIndex(), getRowIndex() - 1);
+ }
+ }
+
+ @Override
+ public void moveDown() {
+ if (getTable() != null) {
+ getTable().moveRow(getRowIndex(), getRowIndex() + 1);
+ }
+ }
+
+ /*
+ * Implementation of ICellObserver
+ */
+ @Override
+ public Object validateValue(ICell cell, Object value) throws ProcessingException {
+ Object oldValue = cell.getValue();
+ if (CompareUtility.equals(oldValue, value)) {
+ // no change in value
+ return value;
+ }
+ else {
+ // validate value
+ if (getTable() != null) {
+ int colIndex = -1;
+ for (int i = 0; i < m_cells.length; i++) {
+ if (m_cells[i] == cell) {
+ colIndex = i;
+ break;
+ }
+ }
+ if (colIndex >= 0) {
+ IColumn column = getTable().getColumnSet().getColumn(colIndex);
+ value = column.parseValue(this, value);
+ }
+ }
+ return value;
+ }
+ }
+
+ @Override
+ public void cellChanged(ICell cell, int changedBit) {
+ try {
+ setRowChanging(true);
+ //
+ if (changedBit == ICell.VALUE_BIT) {
+ if (isStatusNonchanged()) {
+ setStatusUpdated();
+ }
+ else {
+ // keep inserted, deleted
+ }
+ }
+ m_rowPropertiesChanged = true;
+ }
+ finally {
+ setRowChanging(false);
+ }
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + "[" + VerboseUtility.dumpObjects(m_cells) + "]";
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/internal/RowToHolderMapper.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/internal/RowToHolderMapper.java
index d091a694cc..d8c92b7ca6 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/internal/RowToHolderMapper.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/internal/RowToHolderMapper.java
@@ -1,31 +1,31 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table.internal;
-
-import org.eclipse.scout.commons.holders.IHolder;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-
-public class RowToHolderMapper<T> {
- private ITableRow m_row;
- private IColumn<T> m_col;
- private IHolder<T> m_holder;
-
- public RowToHolderMapper(ITableRow row, IColumn<T> col, IHolder<T> holder) {
- m_row = row;
- m_col = col;
- m_holder = holder;
- }
-
- public void exportRowValue() {
- m_holder.setValue(m_col.getValue(m_row));
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table.internal;
+
+import org.eclipse.scout.commons.holders.IHolder;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+
+public class RowToHolderMapper<T> {
+ private ITableRow m_row;
+ private IColumn<T> m_col;
+ private IHolder<T> m_holder;
+
+ public RowToHolderMapper(ITableRow row, IColumn<T> col, IHolder<T> holder) {
+ m_row = row;
+ m_col = col;
+ m_holder = holder;
+ }
+
+ public void exportRowValue() {
+ m_holder.setValue(m_col.getValue(m_row));
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/menus/CopyWidthsOfColumnsMenu.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/menus/CopyWidthsOfColumnsMenu.java
index 483b6d323c..b83d8d07e2 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/menus/CopyWidthsOfColumnsMenu.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/menus/CopyWidthsOfColumnsMenu.java
@@ -1,80 +1,80 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table.menus;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.services.common.clipboard.IClipboardService;
-import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
-import org.eclipse.scout.service.SERVICES;
-
-public class CopyWidthsOfColumnsMenu extends AbstractMenu {
-
- public static final String COLUMN_COPY_CLIPBOARD_IDENTIFIER = "dev.table.menu.column.width.copy.ident";
- private final ITable m_table;
-
- public CopyWidthsOfColumnsMenu(ITable table) {
- m_table = table;
- }
-
- @Override
- protected String getConfiguredText() {
- return ScoutTexts.get("CopyWidthsOfColumnsMenu");
- }
-
- /**
- * This menu is only visible in development mode
- */
- @Override
- protected void execPrepareAction() throws ProcessingException {
- setVisible(Platform.inDevelopmentMode());
- }
-
- /**
- * This menu exports the fully qualified column class names and their widths to the clipboard
- * using the following format for each column:
- * [fully qualified column class name]\t[column width]\n
- */
- @Override
- protected void execAction() {
- try {
- StringBuffer buf = new StringBuffer();
-
- // Add an identifier for fast identification
- buf.append(COLUMN_COPY_CLIPBOARD_IDENTIFIER);
- buf.append("\n");
-
- // only visible columns are of interest
- for (IColumn<?> column : getTable().getColumnSet().getVisibleColumns()) {
- buf.append(column.getClass().getName());
- buf.append("\t");
- buf.append(column.getWidth());
- buf.append("\n");
- }
-
- // calling the service to write the buffer to the clipboard
- IClipboardService svc = SERVICES.getService(IClipboardService.class);
- svc.setTextContents(buf.toString());
- }
- catch (ProcessingException se) {
- se.addContextMessage(getText());
- SERVICES.getService(IExceptionHandlerService.class).handleException(se);
- }
- }
-
- public ITable getTable() {
- return m_table;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table.menus;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.services.common.clipboard.IClipboardService;
+import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
+import org.eclipse.scout.service.SERVICES;
+
+public class CopyWidthsOfColumnsMenu extends AbstractMenu {
+
+ public static final String COLUMN_COPY_CLIPBOARD_IDENTIFIER = "dev.table.menu.column.width.copy.ident";
+ private final ITable m_table;
+
+ public CopyWidthsOfColumnsMenu(ITable table) {
+ m_table = table;
+ }
+
+ @Override
+ protected String getConfiguredText() {
+ return ScoutTexts.get("CopyWidthsOfColumnsMenu");
+ }
+
+ /**
+ * This menu is only visible in development mode
+ */
+ @Override
+ protected void execPrepareAction() throws ProcessingException {
+ setVisible(Platform.inDevelopmentMode());
+ }
+
+ /**
+ * This menu exports the fully qualified column class names and their widths to the clipboard
+ * using the following format for each column:
+ * [fully qualified column class name]\t[column width]\n
+ */
+ @Override
+ protected void execAction() {
+ try {
+ StringBuffer buf = new StringBuffer();
+
+ // Add an identifier for fast identification
+ buf.append(COLUMN_COPY_CLIPBOARD_IDENTIFIER);
+ buf.append("\n");
+
+ // only visible columns are of interest
+ for (IColumn<?> column : getTable().getColumnSet().getVisibleColumns()) {
+ buf.append(column.getClass().getName());
+ buf.append("\t");
+ buf.append(column.getWidth());
+ buf.append("\n");
+ }
+
+ // calling the service to write the buffer to the clipboard
+ IClipboardService svc = SERVICES.getService(IClipboardService.class);
+ svc.setTextContents(buf.toString());
+ }
+ catch (ProcessingException se) {
+ se.addContextMessage(getText());
+ SERVICES.getService(IExceptionHandlerService.class).handleException(se);
+ }
+ }
+
+ public ITable getTable() {
+ return m_table;
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/menus/OrganizeColumnsMenu.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/menus/OrganizeColumnsMenu.java
index 910e845332..ea68613905 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/menus/OrganizeColumnsMenu.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/menus/OrganizeColumnsMenu.java
@@ -1,50 +1,50 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table.menus;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.basic.table.OrganizeColumnsForm;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
-import org.eclipse.scout.service.SERVICES;
-
-public class OrganizeColumnsMenu extends AbstractMenu {
- private final ITable m_table;
-
- public OrganizeColumnsMenu(ITable table) {
- m_table = table;
- }
-
- @Override
- protected String getConfiguredText() {
- return ScoutTexts.get("OrganizeTableColumnsMenu");
- }
-
- @Override
- protected void execAction() {
- try {
- OrganizeColumnsForm dlg = new OrganizeColumnsForm(m_table);
- dlg.startModify();
- dlg.waitFor();
- }
- catch (ProcessingException se) {
- se.addContextMessage(getText());
- SERVICES.getService(IExceptionHandlerService.class).handleException(se);
- }
- }
-
- public ITable getTable() {
- return m_table;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table.menus;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.basic.table.OrganizeColumnsForm;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
+import org.eclipse.scout.service.SERVICES;
+
+public class OrganizeColumnsMenu extends AbstractMenu {
+ private final ITable m_table;
+
+ public OrganizeColumnsMenu(ITable table) {
+ m_table = table;
+ }
+
+ @Override
+ protected String getConfiguredText() {
+ return ScoutTexts.get("OrganizeTableColumnsMenu");
+ }
+
+ @Override
+ protected void execAction() {
+ try {
+ OrganizeColumnsForm dlg = new OrganizeColumnsForm(m_table);
+ dlg.startModify();
+ dlg.waitFor();
+ }
+ catch (ProcessingException se) {
+ se.addContextMessage(getText());
+ SERVICES.getService(IExceptionHandlerService.class).handleException(se);
+ }
+ }
+
+ public ITable getTable() {
+ return m_table;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/menus/ResetColumnsMenu.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/menus/ResetColumnsMenu.java
index 773041473f..00582e9f29 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/menus/ResetColumnsMenu.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/table/menus/ResetColumnsMenu.java
@@ -1,144 +1,144 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.table.menus;
-
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
-import org.eclipse.scout.rt.client.ui.action.menu.MenuSeparator;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.basic.table.columnfilter.ITableColumnFilterManager;
-import org.eclipse.scout.rt.client.ui.basic.table.customizer.ITableCustomizer;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-
-public class ResetColumnsMenu extends AbstractMenu {
- private final ITable m_table;
-
- public ResetColumnsMenu(ITable table) {
- m_table = table;
- }
-
- @Override
- protected String getConfiguredText() {
- return ScoutTexts.get("ResetTableColumns");
- }
-
- @Order(10.0)
- public class ResetAllMenu extends AbstractMenu {
-
- @Override
- protected String getConfiguredText() {
- return ScoutTexts.get("ResetTableColumnsAll");
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- try {
- m_table.setTableChanging(true);
- //
- m_table.resetDisplayableColumns();
- ITableColumnFilterManager m = m_table.getColumnFilterManager();
- if (m != null) {
- m.reset();
- }
- ITableCustomizer cst = m_table.getTableCustomizer();
- if (cst != null) {
- cst.removeAllColumns();
- }
- }
- finally {
- m_table.setTableChanging(false);
- }
- }
- }
-
- @Order(20.0)
- public class Separator1Menu extends MenuSeparator {
- }
-
- @Order(30.0)
- public class ResetViewMenu extends AbstractMenu {
-
- @Override
- protected String getConfiguredText() {
- return ScoutTexts.get("ResetTableColumnsView");
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- try {
- m_table.setTableChanging(true);
- //
- m_table.resetColumnVisibilities();
- m_table.resetColumnWidths();
- m_table.resetColumnOrder();
- ITableCustomizer cst = m_table.getTableCustomizer();
- if (cst != null) {
- cst.removeAllColumns();
- }
- }
- finally {
- m_table.setTableChanging(false);
- }
- }
- }
-
- @Order(40.0)
- public class ResetSortingMenu extends AbstractMenu {
-
- @Override
- protected String getConfiguredText() {
- return ScoutTexts.get("ResetTableColumnsSorting");
- }
-
- @Override
- protected void execAction() {
- try {
- m_table.setTableChanging(true);
- //
- m_table.resetColumnSortOrder();
- }
- finally {
- m_table.setTableChanging(false);
- }
- }
- }
-
- @Order(50.0)
- public class ResetColumnFiltersMenu extends AbstractMenu {
-
- @Override
- protected String getConfiguredText() {
- return ScoutTexts.get("ResetTableColumnFilter");
- }
-
- @Override
- protected void execPrepareAction() throws ProcessingException {
- setVisible(m_table.getColumnFilterManager() != null);
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- try {
- m_table.setTableChanging(true);
- //
- ITableColumnFilterManager m = m_table.getColumnFilterManager();
- if (m != null) {
- m.reset();
- }
- }
- finally {
- m_table.setTableChanging(false);
- }
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.table.menus;
+
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
+import org.eclipse.scout.rt.client.ui.action.menu.MenuSeparator;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.basic.table.columnfilter.ITableColumnFilterManager;
+import org.eclipse.scout.rt.client.ui.basic.table.customizer.ITableCustomizer;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+
+public class ResetColumnsMenu extends AbstractMenu {
+ private final ITable m_table;
+
+ public ResetColumnsMenu(ITable table) {
+ m_table = table;
+ }
+
+ @Override
+ protected String getConfiguredText() {
+ return ScoutTexts.get("ResetTableColumns");
+ }
+
+ @Order(10.0)
+ public class ResetAllMenu extends AbstractMenu {
+
+ @Override
+ protected String getConfiguredText() {
+ return ScoutTexts.get("ResetTableColumnsAll");
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ try {
+ m_table.setTableChanging(true);
+ //
+ m_table.resetDisplayableColumns();
+ ITableColumnFilterManager m = m_table.getColumnFilterManager();
+ if (m != null) {
+ m.reset();
+ }
+ ITableCustomizer cst = m_table.getTableCustomizer();
+ if (cst != null) {
+ cst.removeAllColumns();
+ }
+ }
+ finally {
+ m_table.setTableChanging(false);
+ }
+ }
+ }
+
+ @Order(20.0)
+ public class Separator1Menu extends MenuSeparator {
+ }
+
+ @Order(30.0)
+ public class ResetViewMenu extends AbstractMenu {
+
+ @Override
+ protected String getConfiguredText() {
+ return ScoutTexts.get("ResetTableColumnsView");
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ try {
+ m_table.setTableChanging(true);
+ //
+ m_table.resetColumnVisibilities();
+ m_table.resetColumnWidths();
+ m_table.resetColumnOrder();
+ ITableCustomizer cst = m_table.getTableCustomizer();
+ if (cst != null) {
+ cst.removeAllColumns();
+ }
+ }
+ finally {
+ m_table.setTableChanging(false);
+ }
+ }
+ }
+
+ @Order(40.0)
+ public class ResetSortingMenu extends AbstractMenu {
+
+ @Override
+ protected String getConfiguredText() {
+ return ScoutTexts.get("ResetTableColumnsSorting");
+ }
+
+ @Override
+ protected void execAction() {
+ try {
+ m_table.setTableChanging(true);
+ //
+ m_table.resetColumnSortOrder();
+ }
+ finally {
+ m_table.setTableChanging(false);
+ }
+ }
+ }
+
+ @Order(50.0)
+ public class ResetColumnFiltersMenu extends AbstractMenu {
+
+ @Override
+ protected String getConfiguredText() {
+ return ScoutTexts.get("ResetTableColumnFilter");
+ }
+
+ @Override
+ protected void execPrepareAction() throws ProcessingException {
+ setVisible(m_table.getColumnFilterManager() != null);
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ try {
+ m_table.setTableChanging(true);
+ //
+ ITableColumnFilterManager m = m_table.getColumnFilterManager();
+ if (m != null) {
+ m.reset();
+ }
+ }
+ finally {
+ m_table.setTableChanging(false);
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/AbstractTreeNode.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/AbstractTreeNode.java
index 7a2b41bf09..802609b8d9 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/AbstractTreeNode.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/AbstractTreeNode.java
@@ -1,961 +1,961 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.tree;
-
-import java.security.Permission;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.scout.commons.ConfigurationUtility;
-import org.eclipse.scout.commons.OptimisticLock;
-import org.eclipse.scout.commons.annotations.ConfigOperation;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.action.ActionFinder;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
-import org.eclipse.scout.rt.client.ui.basic.cell.ICell;
-import org.eclipse.scout.rt.client.ui.basic.cell.ICellObserver;
-import org.eclipse.scout.rt.client.ui.profiler.DesktopProfiler;
-import org.eclipse.scout.rt.shared.services.common.security.IAccessControlService;
-import org.eclipse.scout.service.SERVICES;
-
-public abstract class AbstractTreeNode implements ITreeNode, ICellObserver {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractTreeNode.class);
-
- private boolean m_initialized;
- private ITree m_tree;
- private ITreeNode m_parentNode;
- private final Object m_childNodeListLock;
- private List<ITreeNode> m_childNodeList;
- private final Object m_filteredChildNodesLock;
- private ITreeNode[] m_filteredChildNodes;
- private int m_status;
- private final Cell m_cell;
- private IMenu[] m_menus;
- private int m_childNodeIndex;
- private boolean m_childrenLoaded;
- private final OptimisticLock m_childrenLoadedLock = new OptimisticLock();
- private boolean m_leaf;
- private boolean m_checked;
- private boolean m_defaultExpanded;
- private boolean m_expanded;
- private boolean m_childrenVolatile;
- private boolean m_childrenDirty;
- private boolean m_filterAccepted;
- private Object m_primaryKey;// user object
- // enabled is defined as: enabledGranted && enabledProperty
- private boolean m_enabledGranted;
- private boolean m_enabledProperty;
- // visible is defined as: visibleGranted && visibleProperty
- private boolean m_visible;
- private boolean m_visibleGranted;
- private boolean m_visibleProperty;
- // hash code is received from a virtual tree node when resolving to this node
- // this node is not attached to a virtual node if m_hashCode is null
- private Integer m_hashCode = null;
-
- public AbstractTreeNode() {
- this(true);
- }
-
- public AbstractTreeNode(boolean callInitializer) {
- if (DesktopProfiler.getInstance().isEnabled()) {
- DesktopProfiler.getInstance().registerTreeNode(this);
- }
- m_filterAccepted = true;
- m_visibleGranted = true;
- m_visibleProperty = true;
- calculateVisible();
- m_enabledGranted = true;
- m_childNodeListLock = new Object();
- m_childNodeList = new ArrayList<ITreeNode>(0);
- m_filteredChildNodesLock = new Object();
- m_cell = new Cell(this);
- if (callInitializer) {
- callInitializer();
- }
- }
-
- protected void callInitializer() {
- if (!m_initialized) {
- initConfig();
- initTreeNode();
- m_initialized = true;
- }
- }
-
- protected void ensureInitialized() {
- if (!m_initialized) {
- callInitializer();
- }
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(20)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredLeaf() {
- return false;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(30)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredExpanded() {
- return false;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(10)
- @ConfigPropertyValue("true")
- protected boolean getConfiguredEnabled() {
- return true;
- }
-
- @ConfigOperation
- @Order(20)
- protected void execInitTreeNode() {
- }
-
- @ConfigOperation
- @Order(10)
- protected void execDecorateCell(Cell cell) {
- }
-
- @ConfigOperation
- @Order(30)
- protected ITreeNode execResolveVirtualChildNode(IVirtualTreeNode node) throws ProcessingException {
- return node;
- }
-
- private Class<? extends IMenu>[] getConfiguredMenus() {
- Class<?>[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
- return ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, IMenu.class);
- }
-
- protected void initConfig() {
- setLeafInternal(getConfiguredLeaf());
- setEnabledInternal(getConfiguredEnabled());
- setExpandedInternal(getConfiguredExpanded());
- m_defaultExpanded = getConfiguredExpanded();
- // menus
- ArrayList<IMenu> menuList = new ArrayList<IMenu>();
- Class<? extends IMenu>[] ma = getConfiguredMenus();
- for (int i = 0; i < ma.length; i++) {
- try {
- IMenu menu = ConfigurationUtility.newInnerInstance(this, ma[i]);
- menuList.add(menu);
- }
- catch (Exception e) {
- LOG.warn(null, e);
- }
- }
-
- try {
- injectMenusInternal(menuList);
- }
- catch (Exception e) {
- LOG.error("error occured while dynamically contribute menus.", e);
- }
- m_menus = menuList.toArray(new IMenu[0]);
- }
-
- /**
- * Override this internal method only in order to make use of dynamic menus<br>
- * Used to manage menu list and add/remove menus
- *
- * @param menuList
- * live and mutable list of configured menus
- */
- protected void injectMenusInternal(List<IMenu> menuList) {
- }
-
- @Override
- public int hashCode() {
- if (m_hashCode != null) {
- return m_hashCode.intValue();
- }
- return super.hashCode();
- }
-
- /**
- * This method sets the internally used hash code. Should only be used by {@link VirtualTreeNode} when resolving this
- * real node.
- *
- * @param hashCode
- */
- void setHashCode(int hashCode) {
- if (m_hashCode != null) {
- LOG.warn("Overriding the hash code of an object will lead to inconsistent behavior of hash maps etc." +
- " setHashCode() must not be called more than once.");
- }
- m_hashCode = Integer.valueOf(hashCode);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof IVirtualTreeNode && ((IVirtualTreeNode) obj).getResolvedNode() == this) {
- return true;
- }
- return super.equals(obj);
- }
-
- /*
- * Runtime
- */
- @Override
- public void initTreeNode() {
- execInitTreeNode();
- }
-
- @Override
- public String getNodeId() {
- String s = getClass().getName();
- int i = Math.max(s.lastIndexOf('$'), s.lastIndexOf('.'));
- s = s.substring(i + 1);
- return s;
- }
-
- @Override
- public int getStatus() {
- return m_status;
- }
-
- /**
- * do not use this method directly use ITree.setNodeStatus...(node,b)
- */
- @Override
- public void setStatusInternal(int status) {
- m_status = status;
- }
-
- @Override
- public void setStatus(int status) {
- if (getTree() != null) {
- getTree().setNodeStatus(this, status);
- }
- else {
- setStatusInternal(status);
- }
- }
-
- @Override
- public boolean isStatusInserted() {
- return m_status == STATUS_INSERTED;
- }
-
- @Override
- public boolean isStatusUpdated() {
- return m_status == STATUS_UPDATED;
- }
-
- @Override
- public boolean isStatusDeleted() {
- return m_status == STATUS_DELETED;
- }
-
- @Override
- public boolean isStatusNonchanged() {
- return m_status == STATUS_NON_CHANGED;
- }
-
- @Override
- public boolean isSelectedNode() {
- if (getTree() != null) {
- return getTree().isSelectedNode(this);
- }
- else {
- return false;
- }
- }
-
- @Override
- public boolean isFilterAccepted() {
- return m_filterAccepted;
- }
-
- /**
- * do not use this method directly, use {@link ITree#addNodeFilter(ITreeNodeFilter)},
- * {@link ITree#removeNodeFilter(ITreeNodeFilter)}
- */
- @Override
- public void setFilterAccepted(boolean b) {
- if (m_filterAccepted != b) {
- m_filterAccepted = b;
- if (getParentNode() != null) {
- getParentNode().resetFilterCache();
- }
- }
- }
-
- @Override
- public void resetFilterCache() {
- synchronized (m_filteredChildNodesLock) {
- m_filteredChildNodes = null;
- }
- }
-
- @Override
- public ITreeNode resolveVirtualChildNode(ITreeNode node) throws ProcessingException {
- if (m_tree != null) {
- if (node instanceof IVirtualTreeNode) {
- if (node.getTree() == m_tree && node.getParentNode() == this) {
- try {
- m_tree.setTreeChanging(true);
- //
- ITreeNode resolvedNode = execResolveVirtualChildNode((IVirtualTreeNode) node);
- if (node != resolvedNode) {
- if (resolvedNode == null) {
- m_tree.removeChildNode(this, node);
- }
- else {
- replaceChildNodeInternal(node.getChildNodeIndex(), resolvedNode);
- m_tree.updateNode(resolvedNode);
- }
- return resolvedNode;
- }
- }
- finally {
- m_tree.setTreeChanging(false);
- }
- }
- }
- }
- return node;
- }
-
- @Override
- public final ICell getCell() {
- return m_cell;
- }
-
- @Override
- public final Cell getCellForUpdate() {
- return m_cell;
- }
-
- @Override
- public final void decorateCell() {
- try {
- execDecorateCell(m_cell);
- }
- catch (Throwable t) {
- LOG.warn("node " + getClass() + " " + getCell().getText(), t);
- }
- }
-
- @Override
- public boolean isLeaf() {
- return m_leaf;
- }
-
- /**
- * do not use this method directly use ITree.setNodeLeaf(node,b)
- */
- @Override
- public void setLeafInternal(boolean b) {
- m_leaf = b;
- }
-
- @Override
- public void setLeaf(boolean b) {
- if (getTree() != null) {
- getTree().setNodeLeaf(this, b);
- }
- else {
- setLeafInternal(b);
- }
- }
-
- @Override
- public boolean isChecked() {
- return m_checked;
- }
-
- /**
- * do not use this method directly use ITree.setNodeLeaf(node,b)
- */
- @Override
- public void setCheckedInternal(boolean b) {
- m_checked = b;
- }
-
- @Override
- public void setChecked(boolean b) {
- if (getTree() != null) {
- getTree().setNodeChecked(this, b);
- }
- else {
- setCheckedInternal(b);
- }
- }
-
- @Override
- public boolean isExpanded() {
- return m_expanded;
- }
-
- @Override
- public void setExpandedInternal(boolean b) {
- m_expanded = b;
- }
-
- @Override
- public boolean isInitialExpanded() {
- return m_defaultExpanded;
- }
-
- @Override
- public void setInitialExpanded(boolean b) {
- m_defaultExpanded = b;
- }
-
- @Override
- public void setExpanded(boolean b) {
- if (getTree() != null) {
- getTree().setNodeExpanded(this, b);
- }
- else {
- setExpandedInternal(b);
- }
- }
-
- @Override
- public void setVisiblePermissionInternal(Permission p) {
- boolean b;
- if (p != null) {
- b = SERVICES.getService(IAccessControlService.class).checkPermission(p);
- }
- else {
- b = true;
- }
- setVisibleGrantedInternal(b);
- }
-
- @Override
- public boolean isVisible() {
- return m_visible;
- }
-
- @Override
- public boolean isVisibleGranted() {
- return m_visibleGranted;
- }
-
- @Override
- public void setVisibleInternal(boolean b) {
- m_visibleProperty = b;
- calculateVisible();
- }
-
- @Override
- public void setVisibleGrantedInternal(boolean b) {
- m_visibleGranted = b;
- calculateVisible();
- }
-
- private void calculateVisible() {
- m_visible = m_visibleGranted && m_visibleProperty;
- }
-
- @Override
- public void setVisiblePermission(Permission p) {
- if (getTree() != null) {
- getTree().setNodeVisiblePermission(this, p);
- }
- else {
- setVisiblePermissionInternal(p);
- }
- }
-
- @Override
- public void setVisible(boolean b) {
- if (getTree() != null) {
- getTree().setNodeVisible(this, b);
- }
- else {
- setVisibleInternal(b);
- }
- }
-
- @Override
- public void setVisibleGranted(boolean b) {
- if (getTree() != null) {
- getTree().setNodeVisibleGranted(this, b);
- }
- else {
- setVisibleGrantedInternal(b);
- }
- }
-
- @Override
- public void setEnabledPermissionInternal(Permission p) {
- boolean b;
- if (p != null) {
- b = SERVICES.getService(IAccessControlService.class).checkPermission(p);
- }
- else {
- b = true;
- }
- setEnabledGrantedInternal(b);
- }
-
- @Override
- public boolean isEnabled() {
- return m_cell.isEnabled();
- }
-
- @Override
- public boolean isEnabledGranted() {
- return m_enabledGranted;
- }
-
- @Override
- public void setEnabledInternal(boolean b) {
- m_enabledProperty = b;
- calculateEnabled();
- }
-
- @Override
- public void setEnabledGrantedInternal(boolean b) {
- m_enabledGranted = b;
- calculateEnabled();
- }
-
- private void calculateEnabled() {
- m_cell.setEnabled(m_enabledGranted && m_enabledProperty);
- }
-
- @Override
- public void setEnabledPermission(Permission p) {
- if (getTree() != null) {
- getTree().setNodeEnabledPermission(this, p);
- }
- else {
- setEnabledPermissionInternal(p);
- }
- }
-
- @Override
- public void setEnabled(boolean b) {
- if (getTree() != null) {
- getTree().setNodeEnabled(this, b);
- }
- else {
- setEnabledInternal(b);
- }
- }
-
- @Override
- public void setEnabledGranted(boolean b) {
- if (getTree() != null) {
- getTree().setNodeEnabledGranted(this, b);
- }
- else {
- setEnabledGrantedInternal(b);
- }
- }
-
- @Override
- public boolean isChildrenVolatile() {
- return m_childrenVolatile;
- }
-
- @Override
- public void setChildrenVolatile(boolean childrenVolatile) {
- m_childrenVolatile = childrenVolatile;
- }
-
- @Override
- public boolean isChildrenDirty() {
- return m_childrenDirty;
- }
-
- @Override
- public void setChildrenDirty(boolean dirty) {
- m_childrenDirty = dirty;
- }
-
- @Override
- public Object getPrimaryKey() {
- return m_primaryKey;
- }
-
- @Override
- public void setPrimaryKey(Object key) {
- m_primaryKey = key;
- }
-
- @Override
- public IMenu[] getMenus() {
- return m_menus;
- }
-
- @Override
- public <T extends IMenu> T getMenu(Class<T> menuType) throws ProcessingException {
- return new ActionFinder().findAction(getMenus(), menuType);
- }
-
- @Override
- public void setMenus(IMenu[] a) {
- m_menus = a;
- }
-
- @Override
- public ITreeNode getParentNode() {
- return m_parentNode;
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public <T extends ITreeNode> T getParentNode(Class<T> type) {
- ITreeNode node = getParentNode();
- if (node != null && type.isAssignableFrom(node.getClass())) {
- return (T) node;
- }
- else {
- return null;
- }
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public <T extends ITreeNode> T getParentNode(Class<T> type, int backCount) {
- ITreeNode node = this;
- while (node != null && backCount > 0) {
- node = node.getParentNode();
- backCount--;
- }
- if (backCount == 0 && node != null && type.isAssignableFrom(node.getClass())) {
- return (T) node;
- }
- else {
- return null;
- }
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public <T extends ITreeNode> T getAncestorNode(Class<T> type) {
- ITreeNode node = getParentNode();
- while (node != null && !type.isAssignableFrom(node.getClass())) {
- node = node.getParentNode();
- }
- return (T) node;
- }
-
- /**
- * do not use this internal method
- */
- @Override
- public void setParentNodeInternal(ITreeNode parent) {
- m_parentNode = parent;
- }
-
- @Override
- public int getChildNodeCount() {
- return m_childNodeList.size();
- }
-
- @Override
- public int getChildNodeIndex() {
- return m_childNodeIndex;
- }
-
- @Override
- public void setChildNodeIndexInternal(int index) {
- m_childNodeIndex = index;
- }
-
- @Override
- public ITreeNode[] getFilteredChildNodes() {
- synchronized (m_filteredChildNodesLock) {
- if (m_filteredChildNodes == null) {
- synchronized (m_childNodeListLock) {
- ArrayList<ITreeNode> list = new ArrayList<ITreeNode>(m_childNodeList.size());
- for (ITreeNode node : m_childNodeList) {
- if (node.isFilterAccepted()) {
- list.add(node);
- }
- }
- m_filteredChildNodes = list.toArray(new ITreeNode[list.size()]);
- }
- }
- }
- return m_filteredChildNodes;
- }
-
- @Override
- public int getTreeLevel() {
- int level = 0;
- ITreeNode parent = getParentNode();
- while (parent != null) {
- level++;
- parent = parent.getParentNode();
- }
- return level;
- }
-
- @Override
- public ITreeNode getChildNode(int childIndex) {
- synchronized (m_childNodeListLock) {
- if (childIndex >= 0 && childIndex < m_childNodeList.size()) {
- return m_childNodeList.get(childIndex);
- }
- else {
- return null;
- }
- }
- }
-
- @Override
- public ITreeNode[] getChildNodes() {
- synchronized (m_childNodeListLock) {
- return m_childNodeList.toArray(new ITreeNode[m_childNodeList.size()]);
- }
- }
-
- @Override
- public ITreeNode findParentNode(Class<?> interfaceType) {
- ITreeNode test = getParentNode();
- while (test != null) {
- if (interfaceType.isInstance(test)) {
- break;
- }
- test = test.getParentNode();
- }
- return test;
- }
-
- /**
- * do not use this internal method
- */
- public final void setChildNodeOrderInternal(ITreeNode[] nodes) {
- synchronized (m_childNodeListLock) {
- ArrayList<ITreeNode> newList = new ArrayList<ITreeNode>(m_childNodeList.size());
- int index = 0;
- for (ITreeNode n : nodes) {
- n.setChildNodeIndexInternal(index);
- newList.add(n);
- index++;
- }
- m_childNodeList = newList;
- }
- resetFilterCache();
- }
-
- /**
- * do not use this internal method
- */
- public final void addChildNodesInternal(int startIndex, ITreeNode[] nodes, boolean includeSubtree) {
- for (int i = 0; i < nodes.length; i++) {
- nodes[i].setTreeInternal(m_tree, true);
- nodes[i].setParentNodeInternal(this);
- }
- synchronized (m_childNodeListLock) {
- m_childNodeList.addAll(startIndex, Arrays.asList(nodes));
- int endIndex = m_childNodeList.size() - 1;
- for (int i = startIndex; i <= endIndex; i++) {
- m_childNodeList.get(i).setChildNodeIndexInternal(i);
- }
- }
- // traverse subtree for add / remove notify
- for (ITreeNode node : nodes) {
- postProcessAddRec(node, includeSubtree);
- }
- resetFilterCache();
- }
-
- /**
- * do not use this internal method
- */
- public final void removeChildNodesInternal(ITreeNode[] nodes, boolean includeSubtree) {
- boolean[] removed = new boolean[nodes.length];
- synchronized (m_childNodeListLock) {
- for (int i = 0; i < nodes.length; i++) {
- removed[i] = m_childNodeList.remove(nodes[i]);
- nodes[i].setTreeInternal(null, true);
- nodes[i].setParentNodeInternal(null);
- }
- int startIndex = 0;
- int endIndex = m_childNodeList.size() - 1;
- for (int i = startIndex; i <= endIndex; i++) {
- m_childNodeList.get(i).setChildNodeIndexInternal(i);
- }
- }
- // inform nodes of remove
- for (int i = 0; i < nodes.length; i++) {
- if (removed[i]) {
- postProcessRemoveRec(nodes[i], getTree(), includeSubtree);
- }
- }
- resetFilterCache();
- }
-
- /**
- * do not use this internal method
- */
- public final void replaceChildNodeInternal(int index, ITreeNode newNode) {
- ITreeNode oldNode;
- synchronized (m_childNodeListLock) {
- //remove old
- oldNode = m_childNodeList.get(index);
- oldNode.setTreeInternal(null, true);
- oldNode.setParentNodeInternal(null);
- //add new
- m_childNodeList.set(index, newNode);
- newNode.setTreeInternal(m_tree, true);
- newNode.setParentNodeInternal(this);
- m_childNodeList.get(index).setChildNodeIndexInternal(index);
- }
- postProcessRemoveRec(oldNode, m_tree, true);
- postProcessAddRec(newNode, true);
- resetFilterCache();
- }
-
- private void postProcessAddRec(ITreeNode node, boolean includeSubtree) {
- if (node.getTree() != null) {
- try {
- node.nodeAddedNotify();
- }
- catch (Throwable t) {
- t.printStackTrace();
- }
- // access control after adding the page. The add triggers the
- // page.initPage() which eventually
- // changed the visible property for the page
- if (!node.isVisible()) {
- if (node instanceof AbstractTreeNode) {
- ((AbstractTreeNode) node.getParentNode()).removeChildNodesInternal(new ITreeNode[]{node}, false);
- }
- return;
- }
- }
- if (node.isChildrenLoaded()) {
- node.setLeafInternal(node.getChildNodeCount() == 0);
- }
- if (includeSubtree) {
- for (ITreeNode ch : node.getChildNodes()) {
- //quick-check: is node child of itself
- if (ch != node) {
- postProcessAddRec(ch, includeSubtree);
- }
- else {
- LOG.warn("The node " + node + " is child of itself!");
- }
- }
- }
- }
-
- @Override
- public void nodeAddedNotify() {
- }
-
- @Override
- public void nodeRemovedNotify() {
- }
-
- private void postProcessRemoveRec(ITreeNode node, ITree formerTree, boolean includeSubtree) {
- if (includeSubtree) {
- for (ITreeNode ch : node.getChildNodes()) {
- postProcessRemoveRec(ch, formerTree, includeSubtree);
- }
- }
- if (formerTree != null) {
- try {
- node.nodeRemovedNotify();
- }
- catch (Throwable t) {
- t.printStackTrace();
- }
- }
- }
-
- @Override
- public boolean isChildrenLoaded() {
- return m_childrenLoaded;
- }
-
- /**
- * do not use this internal method
- */
- @Override
- public void setChildrenLoaded(boolean b) {
- m_childrenLoaded = b;
- }
-
- @Override
- public final void ensureChildrenLoaded() throws ProcessingException {
- if (!isChildrenLoaded()) {
- // avoid loop
- try {
- if (m_childrenLoadedLock.acquire()) {
- loadChildren();
- }
- }
- finally {
- m_childrenLoadedLock.release();
- }
- }
- }
-
- @Override
- public ITree getTree() {
- return m_tree;
- }
-
- /**
- * do not use this internal method
- */
- @Override
- public void setTreeInternal(ITree tree, boolean includeSubtree) {
- m_tree = tree;
- if (includeSubtree) {
- synchronized (m_childNodeListLock) {
- for (Iterator<ITreeNode> it = m_childNodeList.iterator(); it.hasNext();) {
- (it.next()).setTreeInternal(tree, includeSubtree);
- }
- }
- }
- }
-
- @Override
- public void loadChildren() throws ProcessingException {
- }
-
- @Override
- public void update() {
- getTree().updateNode(this);
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName() + "[" + getCell() + "]";
- }
-
- /*
- * internal cell observer
- */
- @Override
- public void cellChanged(ICell cell, int changedBit) {
- }
-
- @Override
- public Object validateValue(ICell cell, Object value) throws ProcessingException {
- return value;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.tree;
+
+import java.security.Permission;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.scout.commons.ConfigurationUtility;
+import org.eclipse.scout.commons.OptimisticLock;
+import org.eclipse.scout.commons.annotations.ConfigOperation;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.action.ActionFinder;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
+import org.eclipse.scout.rt.client.ui.basic.cell.ICell;
+import org.eclipse.scout.rt.client.ui.basic.cell.ICellObserver;
+import org.eclipse.scout.rt.client.ui.profiler.DesktopProfiler;
+import org.eclipse.scout.rt.shared.services.common.security.IAccessControlService;
+import org.eclipse.scout.service.SERVICES;
+
+public abstract class AbstractTreeNode implements ITreeNode, ICellObserver {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractTreeNode.class);
+
+ private boolean m_initialized;
+ private ITree m_tree;
+ private ITreeNode m_parentNode;
+ private final Object m_childNodeListLock;
+ private List<ITreeNode> m_childNodeList;
+ private final Object m_filteredChildNodesLock;
+ private ITreeNode[] m_filteredChildNodes;
+ private int m_status;
+ private final Cell m_cell;
+ private IMenu[] m_menus;
+ private int m_childNodeIndex;
+ private boolean m_childrenLoaded;
+ private final OptimisticLock m_childrenLoadedLock = new OptimisticLock();
+ private boolean m_leaf;
+ private boolean m_checked;
+ private boolean m_defaultExpanded;
+ private boolean m_expanded;
+ private boolean m_childrenVolatile;
+ private boolean m_childrenDirty;
+ private boolean m_filterAccepted;
+ private Object m_primaryKey;// user object
+ // enabled is defined as: enabledGranted && enabledProperty
+ private boolean m_enabledGranted;
+ private boolean m_enabledProperty;
+ // visible is defined as: visibleGranted && visibleProperty
+ private boolean m_visible;
+ private boolean m_visibleGranted;
+ private boolean m_visibleProperty;
+ // hash code is received from a virtual tree node when resolving to this node
+ // this node is not attached to a virtual node if m_hashCode is null
+ private Integer m_hashCode = null;
+
+ public AbstractTreeNode() {
+ this(true);
+ }
+
+ public AbstractTreeNode(boolean callInitializer) {
+ if (DesktopProfiler.getInstance().isEnabled()) {
+ DesktopProfiler.getInstance().registerTreeNode(this);
+ }
+ m_filterAccepted = true;
+ m_visibleGranted = true;
+ m_visibleProperty = true;
+ calculateVisible();
+ m_enabledGranted = true;
+ m_childNodeListLock = new Object();
+ m_childNodeList = new ArrayList<ITreeNode>(0);
+ m_filteredChildNodesLock = new Object();
+ m_cell = new Cell(this);
+ if (callInitializer) {
+ callInitializer();
+ }
+ }
+
+ protected void callInitializer() {
+ if (!m_initialized) {
+ initConfig();
+ initTreeNode();
+ m_initialized = true;
+ }
+ }
+
+ protected void ensureInitialized() {
+ if (!m_initialized) {
+ callInitializer();
+ }
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(20)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredLeaf() {
+ return false;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(30)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredExpanded() {
+ return false;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(10)
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredEnabled() {
+ return true;
+ }
+
+ @ConfigOperation
+ @Order(20)
+ protected void execInitTreeNode() {
+ }
+
+ @ConfigOperation
+ @Order(10)
+ protected void execDecorateCell(Cell cell) {
+ }
+
+ @ConfigOperation
+ @Order(30)
+ protected ITreeNode execResolveVirtualChildNode(IVirtualTreeNode node) throws ProcessingException {
+ return node;
+ }
+
+ private Class<? extends IMenu>[] getConfiguredMenus() {
+ Class<?>[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
+ return ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, IMenu.class);
+ }
+
+ protected void initConfig() {
+ setLeafInternal(getConfiguredLeaf());
+ setEnabledInternal(getConfiguredEnabled());
+ setExpandedInternal(getConfiguredExpanded());
+ m_defaultExpanded = getConfiguredExpanded();
+ // menus
+ ArrayList<IMenu> menuList = new ArrayList<IMenu>();
+ Class<? extends IMenu>[] ma = getConfiguredMenus();
+ for (int i = 0; i < ma.length; i++) {
+ try {
+ IMenu menu = ConfigurationUtility.newInnerInstance(this, ma[i]);
+ menuList.add(menu);
+ }
+ catch (Exception e) {
+ LOG.warn(null, e);
+ }
+ }
+
+ try {
+ injectMenusInternal(menuList);
+ }
+ catch (Exception e) {
+ LOG.error("error occured while dynamically contribute menus.", e);
+ }
+ m_menus = menuList.toArray(new IMenu[0]);
+ }
+
+ /**
+ * Override this internal method only in order to make use of dynamic menus<br>
+ * Used to manage menu list and add/remove menus
+ *
+ * @param menuList
+ * live and mutable list of configured menus
+ */
+ protected void injectMenusInternal(List<IMenu> menuList) {
+ }
+
+ @Override
+ public int hashCode() {
+ if (m_hashCode != null) {
+ return m_hashCode.intValue();
+ }
+ return super.hashCode();
+ }
+
+ /**
+ * This method sets the internally used hash code. Should only be used by {@link VirtualTreeNode} when resolving this
+ * real node.
+ *
+ * @param hashCode
+ */
+ void setHashCode(int hashCode) {
+ if (m_hashCode != null) {
+ LOG.warn("Overriding the hash code of an object will lead to inconsistent behavior of hash maps etc." +
+ " setHashCode() must not be called more than once.");
+ }
+ m_hashCode = Integer.valueOf(hashCode);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof IVirtualTreeNode && ((IVirtualTreeNode) obj).getResolvedNode() == this) {
+ return true;
+ }
+ return super.equals(obj);
+ }
+
+ /*
+ * Runtime
+ */
+ @Override
+ public void initTreeNode() {
+ execInitTreeNode();
+ }
+
+ @Override
+ public String getNodeId() {
+ String s = getClass().getName();
+ int i = Math.max(s.lastIndexOf('$'), s.lastIndexOf('.'));
+ s = s.substring(i + 1);
+ return s;
+ }
+
+ @Override
+ public int getStatus() {
+ return m_status;
+ }
+
+ /**
+ * do not use this method directly use ITree.setNodeStatus...(node,b)
+ */
+ @Override
+ public void setStatusInternal(int status) {
+ m_status = status;
+ }
+
+ @Override
+ public void setStatus(int status) {
+ if (getTree() != null) {
+ getTree().setNodeStatus(this, status);
+ }
+ else {
+ setStatusInternal(status);
+ }
+ }
+
+ @Override
+ public boolean isStatusInserted() {
+ return m_status == STATUS_INSERTED;
+ }
+
+ @Override
+ public boolean isStatusUpdated() {
+ return m_status == STATUS_UPDATED;
+ }
+
+ @Override
+ public boolean isStatusDeleted() {
+ return m_status == STATUS_DELETED;
+ }
+
+ @Override
+ public boolean isStatusNonchanged() {
+ return m_status == STATUS_NON_CHANGED;
+ }
+
+ @Override
+ public boolean isSelectedNode() {
+ if (getTree() != null) {
+ return getTree().isSelectedNode(this);
+ }
+ else {
+ return false;
+ }
+ }
+
+ @Override
+ public boolean isFilterAccepted() {
+ return m_filterAccepted;
+ }
+
+ /**
+ * do not use this method directly, use {@link ITree#addNodeFilter(ITreeNodeFilter)},
+ * {@link ITree#removeNodeFilter(ITreeNodeFilter)}
+ */
+ @Override
+ public void setFilterAccepted(boolean b) {
+ if (m_filterAccepted != b) {
+ m_filterAccepted = b;
+ if (getParentNode() != null) {
+ getParentNode().resetFilterCache();
+ }
+ }
+ }
+
+ @Override
+ public void resetFilterCache() {
+ synchronized (m_filteredChildNodesLock) {
+ m_filteredChildNodes = null;
+ }
+ }
+
+ @Override
+ public ITreeNode resolveVirtualChildNode(ITreeNode node) throws ProcessingException {
+ if (m_tree != null) {
+ if (node instanceof IVirtualTreeNode) {
+ if (node.getTree() == m_tree && node.getParentNode() == this) {
+ try {
+ m_tree.setTreeChanging(true);
+ //
+ ITreeNode resolvedNode = execResolveVirtualChildNode((IVirtualTreeNode) node);
+ if (node != resolvedNode) {
+ if (resolvedNode == null) {
+ m_tree.removeChildNode(this, node);
+ }
+ else {
+ replaceChildNodeInternal(node.getChildNodeIndex(), resolvedNode);
+ m_tree.updateNode(resolvedNode);
+ }
+ return resolvedNode;
+ }
+ }
+ finally {
+ m_tree.setTreeChanging(false);
+ }
+ }
+ }
+ }
+ return node;
+ }
+
+ @Override
+ public final ICell getCell() {
+ return m_cell;
+ }
+
+ @Override
+ public final Cell getCellForUpdate() {
+ return m_cell;
+ }
+
+ @Override
+ public final void decorateCell() {
+ try {
+ execDecorateCell(m_cell);
+ }
+ catch (Throwable t) {
+ LOG.warn("node " + getClass() + " " + getCell().getText(), t);
+ }
+ }
+
+ @Override
+ public boolean isLeaf() {
+ return m_leaf;
+ }
+
+ /**
+ * do not use this method directly use ITree.setNodeLeaf(node,b)
+ */
+ @Override
+ public void setLeafInternal(boolean b) {
+ m_leaf = b;
+ }
+
+ @Override
+ public void setLeaf(boolean b) {
+ if (getTree() != null) {
+ getTree().setNodeLeaf(this, b);
+ }
+ else {
+ setLeafInternal(b);
+ }
+ }
+
+ @Override
+ public boolean isChecked() {
+ return m_checked;
+ }
+
+ /**
+ * do not use this method directly use ITree.setNodeLeaf(node,b)
+ */
+ @Override
+ public void setCheckedInternal(boolean b) {
+ m_checked = b;
+ }
+
+ @Override
+ public void setChecked(boolean b) {
+ if (getTree() != null) {
+ getTree().setNodeChecked(this, b);
+ }
+ else {
+ setCheckedInternal(b);
+ }
+ }
+
+ @Override
+ public boolean isExpanded() {
+ return m_expanded;
+ }
+
+ @Override
+ public void setExpandedInternal(boolean b) {
+ m_expanded = b;
+ }
+
+ @Override
+ public boolean isInitialExpanded() {
+ return m_defaultExpanded;
+ }
+
+ @Override
+ public void setInitialExpanded(boolean b) {
+ m_defaultExpanded = b;
+ }
+
+ @Override
+ public void setExpanded(boolean b) {
+ if (getTree() != null) {
+ getTree().setNodeExpanded(this, b);
+ }
+ else {
+ setExpandedInternal(b);
+ }
+ }
+
+ @Override
+ public void setVisiblePermissionInternal(Permission p) {
+ boolean b;
+ if (p != null) {
+ b = SERVICES.getService(IAccessControlService.class).checkPermission(p);
+ }
+ else {
+ b = true;
+ }
+ setVisibleGrantedInternal(b);
+ }
+
+ @Override
+ public boolean isVisible() {
+ return m_visible;
+ }
+
+ @Override
+ public boolean isVisibleGranted() {
+ return m_visibleGranted;
+ }
+
+ @Override
+ public void setVisibleInternal(boolean b) {
+ m_visibleProperty = b;
+ calculateVisible();
+ }
+
+ @Override
+ public void setVisibleGrantedInternal(boolean b) {
+ m_visibleGranted = b;
+ calculateVisible();
+ }
+
+ private void calculateVisible() {
+ m_visible = m_visibleGranted && m_visibleProperty;
+ }
+
+ @Override
+ public void setVisiblePermission(Permission p) {
+ if (getTree() != null) {
+ getTree().setNodeVisiblePermission(this, p);
+ }
+ else {
+ setVisiblePermissionInternal(p);
+ }
+ }
+
+ @Override
+ public void setVisible(boolean b) {
+ if (getTree() != null) {
+ getTree().setNodeVisible(this, b);
+ }
+ else {
+ setVisibleInternal(b);
+ }
+ }
+
+ @Override
+ public void setVisibleGranted(boolean b) {
+ if (getTree() != null) {
+ getTree().setNodeVisibleGranted(this, b);
+ }
+ else {
+ setVisibleGrantedInternal(b);
+ }
+ }
+
+ @Override
+ public void setEnabledPermissionInternal(Permission p) {
+ boolean b;
+ if (p != null) {
+ b = SERVICES.getService(IAccessControlService.class).checkPermission(p);
+ }
+ else {
+ b = true;
+ }
+ setEnabledGrantedInternal(b);
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return m_cell.isEnabled();
+ }
+
+ @Override
+ public boolean isEnabledGranted() {
+ return m_enabledGranted;
+ }
+
+ @Override
+ public void setEnabledInternal(boolean b) {
+ m_enabledProperty = b;
+ calculateEnabled();
+ }
+
+ @Override
+ public void setEnabledGrantedInternal(boolean b) {
+ m_enabledGranted = b;
+ calculateEnabled();
+ }
+
+ private void calculateEnabled() {
+ m_cell.setEnabled(m_enabledGranted && m_enabledProperty);
+ }
+
+ @Override
+ public void setEnabledPermission(Permission p) {
+ if (getTree() != null) {
+ getTree().setNodeEnabledPermission(this, p);
+ }
+ else {
+ setEnabledPermissionInternal(p);
+ }
+ }
+
+ @Override
+ public void setEnabled(boolean b) {
+ if (getTree() != null) {
+ getTree().setNodeEnabled(this, b);
+ }
+ else {
+ setEnabledInternal(b);
+ }
+ }
+
+ @Override
+ public void setEnabledGranted(boolean b) {
+ if (getTree() != null) {
+ getTree().setNodeEnabledGranted(this, b);
+ }
+ else {
+ setEnabledGrantedInternal(b);
+ }
+ }
+
+ @Override
+ public boolean isChildrenVolatile() {
+ return m_childrenVolatile;
+ }
+
+ @Override
+ public void setChildrenVolatile(boolean childrenVolatile) {
+ m_childrenVolatile = childrenVolatile;
+ }
+
+ @Override
+ public boolean isChildrenDirty() {
+ return m_childrenDirty;
+ }
+
+ @Override
+ public void setChildrenDirty(boolean dirty) {
+ m_childrenDirty = dirty;
+ }
+
+ @Override
+ public Object getPrimaryKey() {
+ return m_primaryKey;
+ }
+
+ @Override
+ public void setPrimaryKey(Object key) {
+ m_primaryKey = key;
+ }
+
+ @Override
+ public IMenu[] getMenus() {
+ return m_menus;
+ }
+
+ @Override
+ public <T extends IMenu> T getMenu(Class<T> menuType) throws ProcessingException {
+ return new ActionFinder().findAction(getMenus(), menuType);
+ }
+
+ @Override
+ public void setMenus(IMenu[] a) {
+ m_menus = a;
+ }
+
+ @Override
+ public ITreeNode getParentNode() {
+ return m_parentNode;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public <T extends ITreeNode> T getParentNode(Class<T> type) {
+ ITreeNode node = getParentNode();
+ if (node != null && type.isAssignableFrom(node.getClass())) {
+ return (T) node;
+ }
+ else {
+ return null;
+ }
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public <T extends ITreeNode> T getParentNode(Class<T> type, int backCount) {
+ ITreeNode node = this;
+ while (node != null && backCount > 0) {
+ node = node.getParentNode();
+ backCount--;
+ }
+ if (backCount == 0 && node != null && type.isAssignableFrom(node.getClass())) {
+ return (T) node;
+ }
+ else {
+ return null;
+ }
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public <T extends ITreeNode> T getAncestorNode(Class<T> type) {
+ ITreeNode node = getParentNode();
+ while (node != null && !type.isAssignableFrom(node.getClass())) {
+ node = node.getParentNode();
+ }
+ return (T) node;
+ }
+
+ /**
+ * do not use this internal method
+ */
+ @Override
+ public void setParentNodeInternal(ITreeNode parent) {
+ m_parentNode = parent;
+ }
+
+ @Override
+ public int getChildNodeCount() {
+ return m_childNodeList.size();
+ }
+
+ @Override
+ public int getChildNodeIndex() {
+ return m_childNodeIndex;
+ }
+
+ @Override
+ public void setChildNodeIndexInternal(int index) {
+ m_childNodeIndex = index;
+ }
+
+ @Override
+ public ITreeNode[] getFilteredChildNodes() {
+ synchronized (m_filteredChildNodesLock) {
+ if (m_filteredChildNodes == null) {
+ synchronized (m_childNodeListLock) {
+ ArrayList<ITreeNode> list = new ArrayList<ITreeNode>(m_childNodeList.size());
+ for (ITreeNode node : m_childNodeList) {
+ if (node.isFilterAccepted()) {
+ list.add(node);
+ }
+ }
+ m_filteredChildNodes = list.toArray(new ITreeNode[list.size()]);
+ }
+ }
+ }
+ return m_filteredChildNodes;
+ }
+
+ @Override
+ public int getTreeLevel() {
+ int level = 0;
+ ITreeNode parent = getParentNode();
+ while (parent != null) {
+ level++;
+ parent = parent.getParentNode();
+ }
+ return level;
+ }
+
+ @Override
+ public ITreeNode getChildNode(int childIndex) {
+ synchronized (m_childNodeListLock) {
+ if (childIndex >= 0 && childIndex < m_childNodeList.size()) {
+ return m_childNodeList.get(childIndex);
+ }
+ else {
+ return null;
+ }
+ }
+ }
+
+ @Override
+ public ITreeNode[] getChildNodes() {
+ synchronized (m_childNodeListLock) {
+ return m_childNodeList.toArray(new ITreeNode[m_childNodeList.size()]);
+ }
+ }
+
+ @Override
+ public ITreeNode findParentNode(Class<?> interfaceType) {
+ ITreeNode test = getParentNode();
+ while (test != null) {
+ if (interfaceType.isInstance(test)) {
+ break;
+ }
+ test = test.getParentNode();
+ }
+ return test;
+ }
+
+ /**
+ * do not use this internal method
+ */
+ public final void setChildNodeOrderInternal(ITreeNode[] nodes) {
+ synchronized (m_childNodeListLock) {
+ ArrayList<ITreeNode> newList = new ArrayList<ITreeNode>(m_childNodeList.size());
+ int index = 0;
+ for (ITreeNode n : nodes) {
+ n.setChildNodeIndexInternal(index);
+ newList.add(n);
+ index++;
+ }
+ m_childNodeList = newList;
+ }
+ resetFilterCache();
+ }
+
+ /**
+ * do not use this internal method
+ */
+ public final void addChildNodesInternal(int startIndex, ITreeNode[] nodes, boolean includeSubtree) {
+ for (int i = 0; i < nodes.length; i++) {
+ nodes[i].setTreeInternal(m_tree, true);
+ nodes[i].setParentNodeInternal(this);
+ }
+ synchronized (m_childNodeListLock) {
+ m_childNodeList.addAll(startIndex, Arrays.asList(nodes));
+ int endIndex = m_childNodeList.size() - 1;
+ for (int i = startIndex; i <= endIndex; i++) {
+ m_childNodeList.get(i).setChildNodeIndexInternal(i);
+ }
+ }
+ // traverse subtree for add / remove notify
+ for (ITreeNode node : nodes) {
+ postProcessAddRec(node, includeSubtree);
+ }
+ resetFilterCache();
+ }
+
+ /**
+ * do not use this internal method
+ */
+ public final void removeChildNodesInternal(ITreeNode[] nodes, boolean includeSubtree) {
+ boolean[] removed = new boolean[nodes.length];
+ synchronized (m_childNodeListLock) {
+ for (int i = 0; i < nodes.length; i++) {
+ removed[i] = m_childNodeList.remove(nodes[i]);
+ nodes[i].setTreeInternal(null, true);
+ nodes[i].setParentNodeInternal(null);
+ }
+ int startIndex = 0;
+ int endIndex = m_childNodeList.size() - 1;
+ for (int i = startIndex; i <= endIndex; i++) {
+ m_childNodeList.get(i).setChildNodeIndexInternal(i);
+ }
+ }
+ // inform nodes of remove
+ for (int i = 0; i < nodes.length; i++) {
+ if (removed[i]) {
+ postProcessRemoveRec(nodes[i], getTree(), includeSubtree);
+ }
+ }
+ resetFilterCache();
+ }
+
+ /**
+ * do not use this internal method
+ */
+ public final void replaceChildNodeInternal(int index, ITreeNode newNode) {
+ ITreeNode oldNode;
+ synchronized (m_childNodeListLock) {
+ //remove old
+ oldNode = m_childNodeList.get(index);
+ oldNode.setTreeInternal(null, true);
+ oldNode.setParentNodeInternal(null);
+ //add new
+ m_childNodeList.set(index, newNode);
+ newNode.setTreeInternal(m_tree, true);
+ newNode.setParentNodeInternal(this);
+ m_childNodeList.get(index).setChildNodeIndexInternal(index);
+ }
+ postProcessRemoveRec(oldNode, m_tree, true);
+ postProcessAddRec(newNode, true);
+ resetFilterCache();
+ }
+
+ private void postProcessAddRec(ITreeNode node, boolean includeSubtree) {
+ if (node.getTree() != null) {
+ try {
+ node.nodeAddedNotify();
+ }
+ catch (Throwable t) {
+ t.printStackTrace();
+ }
+ // access control after adding the page. The add triggers the
+ // page.initPage() which eventually
+ // changed the visible property for the page
+ if (!node.isVisible()) {
+ if (node instanceof AbstractTreeNode) {
+ ((AbstractTreeNode) node.getParentNode()).removeChildNodesInternal(new ITreeNode[]{node}, false);
+ }
+ return;
+ }
+ }
+ if (node.isChildrenLoaded()) {
+ node.setLeafInternal(node.getChildNodeCount() == 0);
+ }
+ if (includeSubtree) {
+ for (ITreeNode ch : node.getChildNodes()) {
+ //quick-check: is node child of itself
+ if (ch != node) {
+ postProcessAddRec(ch, includeSubtree);
+ }
+ else {
+ LOG.warn("The node " + node + " is child of itself!");
+ }
+ }
+ }
+ }
+
+ @Override
+ public void nodeAddedNotify() {
+ }
+
+ @Override
+ public void nodeRemovedNotify() {
+ }
+
+ private void postProcessRemoveRec(ITreeNode node, ITree formerTree, boolean includeSubtree) {
+ if (includeSubtree) {
+ for (ITreeNode ch : node.getChildNodes()) {
+ postProcessRemoveRec(ch, formerTree, includeSubtree);
+ }
+ }
+ if (formerTree != null) {
+ try {
+ node.nodeRemovedNotify();
+ }
+ catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+ }
+
+ @Override
+ public boolean isChildrenLoaded() {
+ return m_childrenLoaded;
+ }
+
+ /**
+ * do not use this internal method
+ */
+ @Override
+ public void setChildrenLoaded(boolean b) {
+ m_childrenLoaded = b;
+ }
+
+ @Override
+ public final void ensureChildrenLoaded() throws ProcessingException {
+ if (!isChildrenLoaded()) {
+ // avoid loop
+ try {
+ if (m_childrenLoadedLock.acquire()) {
+ loadChildren();
+ }
+ }
+ finally {
+ m_childrenLoadedLock.release();
+ }
+ }
+ }
+
+ @Override
+ public ITree getTree() {
+ return m_tree;
+ }
+
+ /**
+ * do not use this internal method
+ */
+ @Override
+ public void setTreeInternal(ITree tree, boolean includeSubtree) {
+ m_tree = tree;
+ if (includeSubtree) {
+ synchronized (m_childNodeListLock) {
+ for (Iterator<ITreeNode> it = m_childNodeList.iterator(); it.hasNext();) {
+ (it.next()).setTreeInternal(tree, includeSubtree);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void loadChildren() throws ProcessingException {
+ }
+
+ @Override
+ public void update() {
+ getTree().updateNode(this);
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + "[" + getCell() + "]";
+ }
+
+ /*
+ * internal cell observer
+ */
+ @Override
+ public void cellChanged(ICell cell, int changedBit) {
+ }
+
+ @Override
+ public Object validateValue(ICell cell, Object value) throws ProcessingException {
+ return value;
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/AbstractTreeNodeBuilder.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/AbstractTreeNodeBuilder.java
index 94ba993175..94729c098c 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/AbstractTreeNodeBuilder.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/AbstractTreeNodeBuilder.java
@@ -1,98 +1,98 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.tree;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.data.basic.FontSpec;
-import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
-
-public abstract class AbstractTreeNodeBuilder {
-
- public AbstractTreeNodeBuilder() {
- }
-
- protected abstract ITreeNode createEmptyTreeNode() throws ProcessingException;
-
- public ITreeNode createTreeNode(Object primaryKey, String text, int nodeStatus, boolean markChildrenLoaded) throws ProcessingException {
- return createTreeNode(new LookupRow(primaryKey, text), nodeStatus, markChildrenLoaded);
- }
-
- public ITreeNode[] createTreeNodes(LookupRow[] lookupRows, int nodeStatus, boolean markChildrenLoaded) throws ProcessingException {
- ArrayList<ITreeNode> rootNodes = new ArrayList<ITreeNode>();
- HashMap<Object, ITreeNode> nodeMap = new HashMap<Object, ITreeNode>();
- HashMap<Object, ArrayList<ITreeNode>> parentChildMap = new HashMap<Object, ArrayList<ITreeNode>>();
- for (LookupRow row : lookupRows) {
- ITreeNode node = createTreeNode(row, nodeStatus, markChildrenLoaded);
- nodeMap.put(node.getPrimaryKey(), node);
- if (row.getParentKey() != null) {
- // child
- ArrayList<ITreeNode> list = parentChildMap.get(row.getParentKey());
- if (list == null) {
- list = new ArrayList<ITreeNode>();
- parentChildMap.put(row.getParentKey(), list);
- }
- list.add(node);
- }
- else {
- // root
- rootNodes.add(node);
- }
- }
- for (Map.Entry<Object, ArrayList<ITreeNode>> e : parentChildMap.entrySet()) {
- Object parentKey = e.getKey();
- ITreeNode[] childNodes = e.getValue().toArray(new ITreeNode[0]);
- ITreeNode parentNode = nodeMap.get(parentKey);
- if (parentNode instanceof AbstractTreeNode) {
- ((AbstractTreeNode) parentNode).addChildNodesInternal(parentNode.getChildNodeCount(), childNodes, true);
- }
- else {
- rootNodes.addAll(e.getValue());
- }
- }
- return rootNodes.toArray(new ITreeNode[0]);
- }
-
- public ITreeNode createTreeNode(LookupRow lookupRow, int nodeStatus, boolean markChildrenLoaded) throws ProcessingException {
- ITreeNode treeNode = createEmptyTreeNode();
- // fill values to treeNode
- treeNode.setPrimaryKey(lookupRow.getKey());
- treeNode.setEnabledInternal(lookupRow.isEnabled());
- treeNode.setStatusInternal(nodeStatus);
- if (markChildrenLoaded) {
- treeNode.setChildrenLoaded(markChildrenLoaded);
- }
- Cell cell = treeNode.getCellForUpdate();
- cell.setValue(lookupRow);
- cell.setText(lookupRow.getText());
- cell.setTooltipText(lookupRow.getTooltipText());
- if (cell.getIconId() == null) {
- cell.setIconId(lookupRow.getIconId());
- }
- cell.setBackgroundColor(lookupRow.getBackgroundColor());
- cell.setForegroundColor(lookupRow.getForegroundColor());
- cell.setFont(lookupRow.getFont());
- // hint for inactive codes
- if (!lookupRow.isActive()) {
- if (cell.getFont() == null) {
- cell.setFont(FontSpec.parse("italic"));
- }
- cell.setText(lookupRow.getText() + " (" + ScoutTexts.get("InactiveState") + ")");
- }
- return treeNode;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.tree;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.data.basic.FontSpec;
+import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
+
+public abstract class AbstractTreeNodeBuilder {
+
+ public AbstractTreeNodeBuilder() {
+ }
+
+ protected abstract ITreeNode createEmptyTreeNode() throws ProcessingException;
+
+ public ITreeNode createTreeNode(Object primaryKey, String text, int nodeStatus, boolean markChildrenLoaded) throws ProcessingException {
+ return createTreeNode(new LookupRow(primaryKey, text), nodeStatus, markChildrenLoaded);
+ }
+
+ public ITreeNode[] createTreeNodes(LookupRow[] lookupRows, int nodeStatus, boolean markChildrenLoaded) throws ProcessingException {
+ ArrayList<ITreeNode> rootNodes = new ArrayList<ITreeNode>();
+ HashMap<Object, ITreeNode> nodeMap = new HashMap<Object, ITreeNode>();
+ HashMap<Object, ArrayList<ITreeNode>> parentChildMap = new HashMap<Object, ArrayList<ITreeNode>>();
+ for (LookupRow row : lookupRows) {
+ ITreeNode node = createTreeNode(row, nodeStatus, markChildrenLoaded);
+ nodeMap.put(node.getPrimaryKey(), node);
+ if (row.getParentKey() != null) {
+ // child
+ ArrayList<ITreeNode> list = parentChildMap.get(row.getParentKey());
+ if (list == null) {
+ list = new ArrayList<ITreeNode>();
+ parentChildMap.put(row.getParentKey(), list);
+ }
+ list.add(node);
+ }
+ else {
+ // root
+ rootNodes.add(node);
+ }
+ }
+ for (Map.Entry<Object, ArrayList<ITreeNode>> e : parentChildMap.entrySet()) {
+ Object parentKey = e.getKey();
+ ITreeNode[] childNodes = e.getValue().toArray(new ITreeNode[0]);
+ ITreeNode parentNode = nodeMap.get(parentKey);
+ if (parentNode instanceof AbstractTreeNode) {
+ ((AbstractTreeNode) parentNode).addChildNodesInternal(parentNode.getChildNodeCount(), childNodes, true);
+ }
+ else {
+ rootNodes.addAll(e.getValue());
+ }
+ }
+ return rootNodes.toArray(new ITreeNode[0]);
+ }
+
+ public ITreeNode createTreeNode(LookupRow lookupRow, int nodeStatus, boolean markChildrenLoaded) throws ProcessingException {
+ ITreeNode treeNode = createEmptyTreeNode();
+ // fill values to treeNode
+ treeNode.setPrimaryKey(lookupRow.getKey());
+ treeNode.setEnabledInternal(lookupRow.isEnabled());
+ treeNode.setStatusInternal(nodeStatus);
+ if (markChildrenLoaded) {
+ treeNode.setChildrenLoaded(markChildrenLoaded);
+ }
+ Cell cell = treeNode.getCellForUpdate();
+ cell.setValue(lookupRow);
+ cell.setText(lookupRow.getText());
+ cell.setTooltipText(lookupRow.getTooltipText());
+ if (cell.getIconId() == null) {
+ cell.setIconId(lookupRow.getIconId());
+ }
+ cell.setBackgroundColor(lookupRow.getBackgroundColor());
+ cell.setForegroundColor(lookupRow.getForegroundColor());
+ cell.setFont(lookupRow.getFont());
+ // hint for inactive codes
+ if (!lookupRow.isActive()) {
+ if (cell.getFont() == null) {
+ cell.setFont(FontSpec.parse("italic"));
+ }
+ cell.setText(lookupRow.getText() + " (" + ScoutTexts.get("InactiveState") + ")");
+ }
+ return treeNode;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/DefaultTreeEventHistory.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/DefaultTreeEventHistory.java
index 6774d6d587..5e5906f37d 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/DefaultTreeEventHistory.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/DefaultTreeEventHistory.java
@@ -1,50 +1,50 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.tree;
-
-import org.eclipse.scout.rt.client.ui.AbstractEventHistory;
-
-/**
- * The default implementation is created in {@link AbstractTree#createEventHistory()} and tracks
- * <ul>
- * <li>{@link TreeEvent#TYPE_NODE_ENSURE_VISIBLE}</li>
- * <li>{@link TreeEvent#TYPE_NODE_REQUEST_FOCUS}</li>
- * <li>{@link TreeEvent#TYPE_REQUEST_FOCUS}</li>
- * <li>{@link TreeEvent#TYPE_SCROLL_TO_SELECTION}</li>
- * </ul>
- * <p>
- * This object is thread safe.
- *
- * @since 3.8
- */
-public class DefaultTreeEventHistory extends AbstractEventHistory<TreeEvent> {
-
- /**
- * @param timeToLiveMillis
- */
- public DefaultTreeEventHistory(long timeToLiveMillis) {
- super(timeToLiveMillis);
- }
-
- @Override
- public void notifyEvent(TreeEvent event) {
- switch (event.getType()) {
- case TreeEvent.TYPE_NODE_ENSURE_VISIBLE:
- case TreeEvent.TYPE_NODE_REQUEST_FOCUS:
- case TreeEvent.TYPE_REQUEST_FOCUS:
- case TreeEvent.TYPE_SCROLL_TO_SELECTION: {
- addToCache(event.getType(), event);
- break;
- }
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.tree;
+
+import org.eclipse.scout.rt.client.ui.AbstractEventHistory;
+
+/**
+ * The default implementation is created in {@link AbstractTree#createEventHistory()} and tracks
+ * <ul>
+ * <li>{@link TreeEvent#TYPE_NODE_ENSURE_VISIBLE}</li>
+ * <li>{@link TreeEvent#TYPE_NODE_REQUEST_FOCUS}</li>
+ * <li>{@link TreeEvent#TYPE_REQUEST_FOCUS}</li>
+ * <li>{@link TreeEvent#TYPE_SCROLL_TO_SELECTION}</li>
+ * </ul>
+ * <p>
+ * This object is thread safe.
+ *
+ * @since 3.8
+ */
+public class DefaultTreeEventHistory extends AbstractEventHistory<TreeEvent> {
+
+ /**
+ * @param timeToLiveMillis
+ */
+ public DefaultTreeEventHistory(long timeToLiveMillis) {
+ super(timeToLiveMillis);
+ }
+
+ @Override
+ public void notifyEvent(TreeEvent event) {
+ switch (event.getType()) {
+ case TreeEvent.TYPE_NODE_ENSURE_VISIBLE:
+ case TreeEvent.TYPE_NODE_REQUEST_FOCUS:
+ case TreeEvent.TYPE_REQUEST_FOCUS:
+ case TreeEvent.TYPE_SCROLL_TO_SELECTION: {
+ addToCache(event.getType(), event);
+ break;
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/ITree.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/ITree.java
index ed418a8bb3..db112a3f67 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/ITree.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/ITree.java
@@ -1,478 +1,478 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.tree;
-
-import java.net.URL;
-import java.security.Permission;
-
-import org.eclipse.scout.commons.beans.IPropertyObserver;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.IDNDSupport;
-import org.eclipse.scout.rt.client.ui.IEventHistory;
-import org.eclipse.scout.rt.client.ui.action.ActionFinder;
-import org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.VirtualPage;
-import org.eclipse.scout.rt.client.ui.form.fields.treebox.ITreeBox;
-import org.eclipse.scout.rt.client.ui.form.fields.treefield.ITreeField;
-import org.eclipse.scout.rt.shared.data.form.fields.treefield.AbstractTreeFieldData;
-
-public interface ITree extends IPropertyObserver, IDNDSupport {
-
- String PROP_TITLE = "title";
- String PROP_ENABLED = "enabled";
- String PROP_DRAG_ENABLED = "dragEnabled";
- String PROP_ICON_ID = "iconId";
- String PROP_MULTI_SELECT = "multiSelect";
- String PROP_MULTI_CHECK = "multiCheck";
- String PROP_CHECKABLE = "checkable";
- /**
- * Integer default -1
- */
- String PROP_NODE_HEIGHT_HINT = "propNodeHeightHint";
- String PROP_ROOT_NODE_VISIBLE = "rootNodeVisible";
- String PROP_ROOT_HANDLES_VISIBLE = "rootHandlesVisible";
- String PROP_KEY_STROKES = "keyStroks";
- String PROP_SCROLL_TO_SELECTION = "scrollToSelection";
- /**
- * Object
- * <p>
- * Container of this tree, {@link IPage}, {@link ITreeField}, {@link ITreeBox}
- * <p>
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=388227
- *
- * @since 3.8.1
- */
- String PROP_CONTAINER = "container";
-
- void initTree() throws ProcessingException;
-
- void disposeTree();
-
- /**
- * sets the node as selected node and processes the url.
- * <p>
- * see {@link #selectNode(ITreeNode)}
- */
- void doHyperlinkAction(ITreeNode node, URL url) throws ProcessingException;
-
- void requestFocus();
-
- IMenu[] getMenus();
-
- void setMenus(IMenu[] a);
-
- /**
- * Convenience to find a menu, uses {@link ActionFinder}
- */
- <T extends IMenu> T getMenu(Class<T> menuType) throws ProcessingException;
-
- /**
- * @see #setScrollToSelection()
- */
- boolean isScrollToSelection();
-
- /**
- * @param b
- * true: advices the attached ui to make the current selection visible.
- * The current selection will be scrolled to visible (again, whenever the table size changes).
- */
- void setScrollToSelection(boolean b);
-
- /**
- * May be used when {@link #isScrollToSelection()} = false on individual occasion where selection shall be scrolled to
- * visible, the property scrollToVisible remains untouched.
- * <p>
- * This is a one-time scroll advise to the ui
- */
- void scrollToSelection();
-
- ITreeNodeFilter[] getNodeFilters();
-
- boolean hasNodeFilters();
-
- /**
- * adding a filter multiple times is supported. This only adds it the first time. The other times it just calls
- * {@link #applyNodeFilters()}
- */
- void addNodeFilter(ITreeNodeFilter filter);
-
- void removeNodeFilter(ITreeNodeFilter filter);
-
- /**
- * (Re-) applies all node filters to the tree.
- * <p>
- * This can be useful when the state of a node filter was changed without adding or removing it.
- * <p>
- * {@link #addNodeFilter(ITreeNodeFilter)} and {@link #removeNodeFilter(ITreeNodeFilter)} automatically apply the
- * filters to the tree.
- */
- void applyNodeFilters();
-
- ITreeNode getRootNode();
-
- void setRootNode(ITreeNode root);
-
- String getTitle();
-
- void setTitle(String s);
-
- String getIconId();
-
- void setIconId(String iconId);
-
- /**
- * @return path using delimiter " - "
- */
- String getPathText(ITreeNode node);
-
- String getPathText(ITreeNode node, String delimiter);
-
- /**
- * A virtual node is a marker tree node used to optimize performance in large trees.
- * It is used mainly in the {@link IPage}, {@link IOutline} area with {@link VirtualPage}s
- * <p>
- * This method resolves a virtual node by its real node and generates a {@link TreeEvent#TYPE_NODES_UPDATED} event.
- * <p>
- * Basically all ui calls such as drag, drop, select, expand etc. automatically call this method. Further also
- * {@link IPage#getChildPage(int)} and {@link IPage#getChildPages()} automatically calls this method.
- * <p>
- * see {@link IVirtualTreeNode} and {@link VirtualPage}
- */
- ITreeNode resolveVirtualNode(ITreeNode node) throws ProcessingException;
-
- /**
- * see {@link #resolveVirtualNode(ITreeNode)}
- */
- ITreeNode[] resolveVirtualNodes(ITreeNode[] nodes) throws ProcessingException;
-
- Object getProperty(String name);
-
- /**
- * With this method it's possible to set (custom) properties.
- * <p>
- * <b>Important: </b> Although this method is intended to be used for custom properties, it's actually possible to
- * change main properties as well. Keep in mind that directly changing main properties may result in unexpected
- * behavior, so do it only if you really know what you are doing. Rather use the officially provided api instead. <br>
- * Example for an unexpected behavior: setVisible() does not only set the property PROP_VISIBLE but also executes
- * additional code. This code would NOT be executed by directly setting the property PROP_VISIBLE with setProperty().
- */
- void setProperty(String name, Object value);
-
- boolean hasProperty(String name);
-
- boolean isAutoTitle();
-
- void setAutoTitle(boolean b);
-
- boolean isDragEnabled();
-
- void setDragEnabled(boolean b);
-
- ITreeNode findNode(Object primaryKey);
-
- ITreeNode[] findNodes(Object[] primaryKeys);
-
- boolean isRootNodeVisible();
-
- void setRootNodeVisible(boolean b);
-
- boolean isRootHandlesVisible();
-
- void setRootHandlesVisible(boolean b);
-
- void ensureVisible(ITreeNode node);
-
- void expandAll(ITreeNode parent);
-
- void collapseAll(ITreeNode parent);
-
- boolean isEnabled();
-
- void setEnabled(boolean b);
-
- boolean isEnabledGranted();
-
- void setEnabledGranted(boolean b);
-
- void setEnabledPermission(Permission p);
-
- int getSelectedNodeCount();
-
- ITreeNode getSelectedNode();
-
- ITreeNode[] getSelectedNodes();
-
- boolean isSelectedNode(ITreeNode node);
-
- void selectNode(ITreeNode node);
-
- void selectNode(ITreeNode node, boolean append);
-
- void selectNodes(ITreeNode[] node, boolean append);
-
- void deselectNode(ITreeNode node);
-
- void deselectNodes(ITreeNode[] nodes);
-
- /**
- * Select the previous selectable node in this tree. Does not expand any
- * nodes.
- */
- void selectPreviousNode();
-
- /**
- * Select the next visible and selectable node in this tree. Does not expand
- * any nodes.
- */
- void selectNextNode();
-
- /**
- * Select the first visible and selectable node in this tree. Does not expand
- * any nodes.
- */
- void selectFirstNode();
-
- /**
- * Select the last visible and selectable node in this tree. Does not expand
- * any nodes.
- */
- void selectLastNode();
-
- /**
- * Expand current selected node and then select next.
- */
- void selectNextChildNode();
-
- /**
- * Select parent of current selected node.
- */
- void selectPreviousParentNode();
-
- /**
- * @return a flat array of all checked nodes
- */
- ITreeNode[] getCheckedNodes();
-
- /**
- * Container of this tree, {@link IPage}, {@link ITreeField}, {@link ITreeBox}
- * <p>
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=388227
- *
- * @since 3.8.1
- */
- Object getContainer();
-
- /**
- * @return true if parent is equal to child or parent is an ancestor of child
- * @since 03.07.2009
- */
- boolean isAncestorNodeOf(ITreeNode parent, ITreeNode child);
-
- void addTreeListener(TreeListener listener);
-
- void removeTreeListener(TreeListener listener);
-
- /**
- * Add the listener at the top (front) of the listener list (so it is called as LAST listener).
- * <p>
- * This method is normally only used by the ui layer to update its state before other listeners handle them
- * <p>
- * Use {@link #addTreeListener(TreeListener)} in all other cases
- */
- void addUITreeListener(TreeListener listener);
-
- /**
- * @return the {@link IEventHistory} associated with this tree
- * <p>
- * The default implementation is a {@link DefaultTreeEventHistory} and created by
- * {@link AbstractTree#createEventHistory()}
- * <p>
- * This method is thread safe.
- * @since 3.8
- */
- IEventHistory<TreeEvent> getEventHistory();
-
- /**
- * true if multiple nodes can be selected (default false)
- */
- boolean isMultiSelect();
-
- void setMultiSelect(boolean b);
-
- /**
- * true if multiple nodes can be checked (default true)
- */
- boolean isMultiCheck();
-
- void setMultiCheck(boolean b);
-
- boolean isCheckable();
-
- void setCheckable(boolean b);
-
- /**
- * This is a hint for the UI if it is not capable of having variable node height based on node contents
- * (such as rap/rwt).
- * <p>
- * This hint defines the node height in pixels being used as the fixed node height for all nodes of this tree.
- *
- * @return the hint in pixels, default is -1
- */
- int getNodeHeightHint();
-
- /**
- * see {@link #getNodeHeightHint()}
- */
- void setNodeHeightHint(int h);
-
- boolean isAutoDiscardOnDelete();
-
- void setAutoDiscardOnDelete(boolean on);
-
- boolean isTreeChanging();
-
- void setTreeChanging(boolean b);
-
- boolean isNodeExpanded(ITreeNode node);
-
- void setNodeExpanded(ITreeNode node, boolean b);
-
- void setNodeEnabledPermission(ITreeNode node, Permission p);
-
- boolean isNodeEnabled(ITreeNode node);
-
- void setNodeEnabled(ITreeNode node, boolean b);
-
- boolean isNodeEnabledGranted(ITreeNode node);
-
- void setNodeEnabledGranted(ITreeNode node, boolean b);
-
- void setNodeVisiblePermission(ITreeNode node, Permission p);
-
- boolean isNodeVisible(ITreeNode node);
-
- void setNodeVisible(ITreeNode node, boolean b);
-
- boolean isNodeVisibleGranted(ITreeNode node);
-
- void setNodeVisibleGranted(ITreeNode node, boolean b);
-
- boolean isNodeLeaf(ITreeNode node);
-
- void setNodeLeaf(ITreeNode node, boolean b);
-
- void setNodeChecked(ITreeNode node, boolean b);
-
- boolean isNodeChecked(ITreeNode node);
-
- int getNodeStatus(ITreeNode node);
-
- void setNodeStatus(ITreeNode node, int status);
-
- IKeyStroke[] getKeyStrokes();
-
- void setKeyStrokes(IKeyStroke[] keyStrokes);
-
- /*
- * modifications
- */
-
- /**
- * append a child node to the end of the children of parent
- */
- void addChildNode(ITreeNode parent, ITreeNode child);
-
- /**
- * append a list of child nodes or a complete subtree to the end of the
- * children of parent
- */
- void addChildNodes(ITreeNode parent, ITreeNode[] children);
-
- void addChildNode(int startIndex, ITreeNode parent, ITreeNode child);
-
- void addChildNodes(int startIndex, ITreeNode parent, ITreeNode[] children);
-
- void updateNode(ITreeNode node);
-
- void updateChildNodes(ITreeNode parent, ITreeNode[] children);
-
- void updateChildNodeOrder(ITreeNode parent, ITreeNode[] newChildren);
-
- void removeChildNode(ITreeNode parent, ITreeNode child);
-
- void removeChildNodes(ITreeNode parent, ITreeNode[] children);
-
- void removeAllChildNodes(ITreeNode parent);
-
- void removeNode(ITreeNode node);
-
- /**
- * clear removed rows from cache
- */
- void clearDeletedNodes();
-
- int getDeletedNodeCount();
-
- ITreeNode[] getDeletedNodes();
-
- int getInsertedNodeCount();
-
- ITreeNode[] getInsertedNodes();
-
- int getUpdatedNodeCount();
-
- ITreeNode[] getUpdatedNodes();
-
- boolean visitTree(ITreeVisitor v);
-
- boolean visitVisibleTree(ITreeVisitor v);
-
- boolean visitNode(ITreeNode node, ITreeVisitor v);
-
- /**
- * unload all children and mark node as not loaded
- */
- void unloadNode(ITreeNode node) throws ProcessingException;
-
- /**
- * extract transfer data to be sent to the backend
- * <p>
- * The single root node is not exported, the export starts with the first level after the root node
- */
- void exportTreeData(AbstractTreeFieldData target) throws ProcessingException;
-
- /**
- * apply transfer data to this tree
- * <p>
- * All nodes are imported starting under the (existing) root node
- */
- void importTreeData(AbstractTreeFieldData source) throws ProcessingException;
-
- /**
- * To obtain the menus that passed checks such as visibility, empty space action, ... for the given nodes.
- * Please be cautious as depending on the given nodes, there might be a node mismatch among the selected tree nodes
- * and the menu context node.
- * This method is not part of the public API.
- *
- * @param nodes
- * the nodes whose menus should be returned
- * @return
- */
- IMenu[] fetchMenusForNodesInternal(ITreeNode[] nodes);
-
- /*
- * UI Processes
- */
- ITreeUIFacade getUIFacade();
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.tree;
+
+import java.net.URL;
+import java.security.Permission;
+
+import org.eclipse.scout.commons.beans.IPropertyObserver;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.IDNDSupport;
+import org.eclipse.scout.rt.client.ui.IEventHistory;
+import org.eclipse.scout.rt.client.ui.action.ActionFinder;
+import org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.VirtualPage;
+import org.eclipse.scout.rt.client.ui.form.fields.treebox.ITreeBox;
+import org.eclipse.scout.rt.client.ui.form.fields.treefield.ITreeField;
+import org.eclipse.scout.rt.shared.data.form.fields.treefield.AbstractTreeFieldData;
+
+public interface ITree extends IPropertyObserver, IDNDSupport {
+
+ String PROP_TITLE = "title";
+ String PROP_ENABLED = "enabled";
+ String PROP_DRAG_ENABLED = "dragEnabled";
+ String PROP_ICON_ID = "iconId";
+ String PROP_MULTI_SELECT = "multiSelect";
+ String PROP_MULTI_CHECK = "multiCheck";
+ String PROP_CHECKABLE = "checkable";
+ /**
+ * Integer default -1
+ */
+ String PROP_NODE_HEIGHT_HINT = "propNodeHeightHint";
+ String PROP_ROOT_NODE_VISIBLE = "rootNodeVisible";
+ String PROP_ROOT_HANDLES_VISIBLE = "rootHandlesVisible";
+ String PROP_KEY_STROKES = "keyStroks";
+ String PROP_SCROLL_TO_SELECTION = "scrollToSelection";
+ /**
+ * Object
+ * <p>
+ * Container of this tree, {@link IPage}, {@link ITreeField}, {@link ITreeBox}
+ * <p>
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=388227
+ *
+ * @since 3.8.1
+ */
+ String PROP_CONTAINER = "container";
+
+ void initTree() throws ProcessingException;
+
+ void disposeTree();
+
+ /**
+ * sets the node as selected node and processes the url.
+ * <p>
+ * see {@link #selectNode(ITreeNode)}
+ */
+ void doHyperlinkAction(ITreeNode node, URL url) throws ProcessingException;
+
+ void requestFocus();
+
+ IMenu[] getMenus();
+
+ void setMenus(IMenu[] a);
+
+ /**
+ * Convenience to find a menu, uses {@link ActionFinder}
+ */
+ <T extends IMenu> T getMenu(Class<T> menuType) throws ProcessingException;
+
+ /**
+ * @see #setScrollToSelection()
+ */
+ boolean isScrollToSelection();
+
+ /**
+ * @param b
+ * true: advices the attached ui to make the current selection visible.
+ * The current selection will be scrolled to visible (again, whenever the table size changes).
+ */
+ void setScrollToSelection(boolean b);
+
+ /**
+ * May be used when {@link #isScrollToSelection()} = false on individual occasion where selection shall be scrolled to
+ * visible, the property scrollToVisible remains untouched.
+ * <p>
+ * This is a one-time scroll advise to the ui
+ */
+ void scrollToSelection();
+
+ ITreeNodeFilter[] getNodeFilters();
+
+ boolean hasNodeFilters();
+
+ /**
+ * adding a filter multiple times is supported. This only adds it the first time. The other times it just calls
+ * {@link #applyNodeFilters()}
+ */
+ void addNodeFilter(ITreeNodeFilter filter);
+
+ void removeNodeFilter(ITreeNodeFilter filter);
+
+ /**
+ * (Re-) applies all node filters to the tree.
+ * <p>
+ * This can be useful when the state of a node filter was changed without adding or removing it.
+ * <p>
+ * {@link #addNodeFilter(ITreeNodeFilter)} and {@link #removeNodeFilter(ITreeNodeFilter)} automatically apply the
+ * filters to the tree.
+ */
+ void applyNodeFilters();
+
+ ITreeNode getRootNode();
+
+ void setRootNode(ITreeNode root);
+
+ String getTitle();
+
+ void setTitle(String s);
+
+ String getIconId();
+
+ void setIconId(String iconId);
+
+ /**
+ * @return path using delimiter " - "
+ */
+ String getPathText(ITreeNode node);
+
+ String getPathText(ITreeNode node, String delimiter);
+
+ /**
+ * A virtual node is a marker tree node used to optimize performance in large trees.
+ * It is used mainly in the {@link IPage}, {@link IOutline} area with {@link VirtualPage}s
+ * <p>
+ * This method resolves a virtual node by its real node and generates a {@link TreeEvent#TYPE_NODES_UPDATED} event.
+ * <p>
+ * Basically all ui calls such as drag, drop, select, expand etc. automatically call this method. Further also
+ * {@link IPage#getChildPage(int)} and {@link IPage#getChildPages()} automatically calls this method.
+ * <p>
+ * see {@link IVirtualTreeNode} and {@link VirtualPage}
+ */
+ ITreeNode resolveVirtualNode(ITreeNode node) throws ProcessingException;
+
+ /**
+ * see {@link #resolveVirtualNode(ITreeNode)}
+ */
+ ITreeNode[] resolveVirtualNodes(ITreeNode[] nodes) throws ProcessingException;
+
+ Object getProperty(String name);
+
+ /**
+ * With this method it's possible to set (custom) properties.
+ * <p>
+ * <b>Important: </b> Although this method is intended to be used for custom properties, it's actually possible to
+ * change main properties as well. Keep in mind that directly changing main properties may result in unexpected
+ * behavior, so do it only if you really know what you are doing. Rather use the officially provided api instead. <br>
+ * Example for an unexpected behavior: setVisible() does not only set the property PROP_VISIBLE but also executes
+ * additional code. This code would NOT be executed by directly setting the property PROP_VISIBLE with setProperty().
+ */
+ void setProperty(String name, Object value);
+
+ boolean hasProperty(String name);
+
+ boolean isAutoTitle();
+
+ void setAutoTitle(boolean b);
+
+ boolean isDragEnabled();
+
+ void setDragEnabled(boolean b);
+
+ ITreeNode findNode(Object primaryKey);
+
+ ITreeNode[] findNodes(Object[] primaryKeys);
+
+ boolean isRootNodeVisible();
+
+ void setRootNodeVisible(boolean b);
+
+ boolean isRootHandlesVisible();
+
+ void setRootHandlesVisible(boolean b);
+
+ void ensureVisible(ITreeNode node);
+
+ void expandAll(ITreeNode parent);
+
+ void collapseAll(ITreeNode parent);
+
+ boolean isEnabled();
+
+ void setEnabled(boolean b);
+
+ boolean isEnabledGranted();
+
+ void setEnabledGranted(boolean b);
+
+ void setEnabledPermission(Permission p);
+
+ int getSelectedNodeCount();
+
+ ITreeNode getSelectedNode();
+
+ ITreeNode[] getSelectedNodes();
+
+ boolean isSelectedNode(ITreeNode node);
+
+ void selectNode(ITreeNode node);
+
+ void selectNode(ITreeNode node, boolean append);
+
+ void selectNodes(ITreeNode[] node, boolean append);
+
+ void deselectNode(ITreeNode node);
+
+ void deselectNodes(ITreeNode[] nodes);
+
+ /**
+ * Select the previous selectable node in this tree. Does not expand any
+ * nodes.
+ */
+ void selectPreviousNode();
+
+ /**
+ * Select the next visible and selectable node in this tree. Does not expand
+ * any nodes.
+ */
+ void selectNextNode();
+
+ /**
+ * Select the first visible and selectable node in this tree. Does not expand
+ * any nodes.
+ */
+ void selectFirstNode();
+
+ /**
+ * Select the last visible and selectable node in this tree. Does not expand
+ * any nodes.
+ */
+ void selectLastNode();
+
+ /**
+ * Expand current selected node and then select next.
+ */
+ void selectNextChildNode();
+
+ /**
+ * Select parent of current selected node.
+ */
+ void selectPreviousParentNode();
+
+ /**
+ * @return a flat array of all checked nodes
+ */
+ ITreeNode[] getCheckedNodes();
+
+ /**
+ * Container of this tree, {@link IPage}, {@link ITreeField}, {@link ITreeBox}
+ * <p>
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=388227
+ *
+ * @since 3.8.1
+ */
+ Object getContainer();
+
+ /**
+ * @return true if parent is equal to child or parent is an ancestor of child
+ * @since 03.07.2009
+ */
+ boolean isAncestorNodeOf(ITreeNode parent, ITreeNode child);
+
+ void addTreeListener(TreeListener listener);
+
+ void removeTreeListener(TreeListener listener);
+
+ /**
+ * Add the listener at the top (front) of the listener list (so it is called as LAST listener).
+ * <p>
+ * This method is normally only used by the ui layer to update its state before other listeners handle them
+ * <p>
+ * Use {@link #addTreeListener(TreeListener)} in all other cases
+ */
+ void addUITreeListener(TreeListener listener);
+
+ /**
+ * @return the {@link IEventHistory} associated with this tree
+ * <p>
+ * The default implementation is a {@link DefaultTreeEventHistory} and created by
+ * {@link AbstractTree#createEventHistory()}
+ * <p>
+ * This method is thread safe.
+ * @since 3.8
+ */
+ IEventHistory<TreeEvent> getEventHistory();
+
+ /**
+ * true if multiple nodes can be selected (default false)
+ */
+ boolean isMultiSelect();
+
+ void setMultiSelect(boolean b);
+
+ /**
+ * true if multiple nodes can be checked (default true)
+ */
+ boolean isMultiCheck();
+
+ void setMultiCheck(boolean b);
+
+ boolean isCheckable();
+
+ void setCheckable(boolean b);
+
+ /**
+ * This is a hint for the UI if it is not capable of having variable node height based on node contents
+ * (such as rap/rwt).
+ * <p>
+ * This hint defines the node height in pixels being used as the fixed node height for all nodes of this tree.
+ *
+ * @return the hint in pixels, default is -1
+ */
+ int getNodeHeightHint();
+
+ /**
+ * see {@link #getNodeHeightHint()}
+ */
+ void setNodeHeightHint(int h);
+
+ boolean isAutoDiscardOnDelete();
+
+ void setAutoDiscardOnDelete(boolean on);
+
+ boolean isTreeChanging();
+
+ void setTreeChanging(boolean b);
+
+ boolean isNodeExpanded(ITreeNode node);
+
+ void setNodeExpanded(ITreeNode node, boolean b);
+
+ void setNodeEnabledPermission(ITreeNode node, Permission p);
+
+ boolean isNodeEnabled(ITreeNode node);
+
+ void setNodeEnabled(ITreeNode node, boolean b);
+
+ boolean isNodeEnabledGranted(ITreeNode node);
+
+ void setNodeEnabledGranted(ITreeNode node, boolean b);
+
+ void setNodeVisiblePermission(ITreeNode node, Permission p);
+
+ boolean isNodeVisible(ITreeNode node);
+
+ void setNodeVisible(ITreeNode node, boolean b);
+
+ boolean isNodeVisibleGranted(ITreeNode node);
+
+ void setNodeVisibleGranted(ITreeNode node, boolean b);
+
+ boolean isNodeLeaf(ITreeNode node);
+
+ void setNodeLeaf(ITreeNode node, boolean b);
+
+ void setNodeChecked(ITreeNode node, boolean b);
+
+ boolean isNodeChecked(ITreeNode node);
+
+ int getNodeStatus(ITreeNode node);
+
+ void setNodeStatus(ITreeNode node, int status);
+
+ IKeyStroke[] getKeyStrokes();
+
+ void setKeyStrokes(IKeyStroke[] keyStrokes);
+
+ /*
+ * modifications
+ */
+
+ /**
+ * append a child node to the end of the children of parent
+ */
+ void addChildNode(ITreeNode parent, ITreeNode child);
+
+ /**
+ * append a list of child nodes or a complete subtree to the end of the
+ * children of parent
+ */
+ void addChildNodes(ITreeNode parent, ITreeNode[] children);
+
+ void addChildNode(int startIndex, ITreeNode parent, ITreeNode child);
+
+ void addChildNodes(int startIndex, ITreeNode parent, ITreeNode[] children);
+
+ void updateNode(ITreeNode node);
+
+ void updateChildNodes(ITreeNode parent, ITreeNode[] children);
+
+ void updateChildNodeOrder(ITreeNode parent, ITreeNode[] newChildren);
+
+ void removeChildNode(ITreeNode parent, ITreeNode child);
+
+ void removeChildNodes(ITreeNode parent, ITreeNode[] children);
+
+ void removeAllChildNodes(ITreeNode parent);
+
+ void removeNode(ITreeNode node);
+
+ /**
+ * clear removed rows from cache
+ */
+ void clearDeletedNodes();
+
+ int getDeletedNodeCount();
+
+ ITreeNode[] getDeletedNodes();
+
+ int getInsertedNodeCount();
+
+ ITreeNode[] getInsertedNodes();
+
+ int getUpdatedNodeCount();
+
+ ITreeNode[] getUpdatedNodes();
+
+ boolean visitTree(ITreeVisitor v);
+
+ boolean visitVisibleTree(ITreeVisitor v);
+
+ boolean visitNode(ITreeNode node, ITreeVisitor v);
+
+ /**
+ * unload all children and mark node as not loaded
+ */
+ void unloadNode(ITreeNode node) throws ProcessingException;
+
+ /**
+ * extract transfer data to be sent to the backend
+ * <p>
+ * The single root node is not exported, the export starts with the first level after the root node
+ */
+ void exportTreeData(AbstractTreeFieldData target) throws ProcessingException;
+
+ /**
+ * apply transfer data to this tree
+ * <p>
+ * All nodes are imported starting under the (existing) root node
+ */
+ void importTreeData(AbstractTreeFieldData source) throws ProcessingException;
+
+ /**
+ * To obtain the menus that passed checks such as visibility, empty space action, ... for the given nodes.
+ * Please be cautious as depending on the given nodes, there might be a node mismatch among the selected tree nodes
+ * and the menu context node.
+ * This method is not part of the public API.
+ *
+ * @param nodes
+ * the nodes whose menus should be returned
+ * @return
+ */
+ IMenu[] fetchMenusForNodesInternal(ITreeNode[] nodes);
+
+ /*
+ * UI Processes
+ */
+ ITreeUIFacade getUIFacade();
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/ITreeNode.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/ITreeNode.java
index 98a94a9d04..360da672d2 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/ITreeNode.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/ITreeNode.java
@@ -1,332 +1,332 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.tree;
-
-import java.security.Permission;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.action.ActionFinder;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
-import org.eclipse.scout.rt.client.ui.basic.cell.ICell;
-
-/**
- * Tree node used in {@link ITree}.
- * <p>
- * Note that a {@link IVirtualTreeNode} is equal to its resolved node {@link IVirtualTreeNode#getResolvedNode()} with
- * regard to {@link #equals(Object)} and {@link #hashCode()}
- */
-public interface ITreeNode {
- int STATUS_NON_CHANGED = 0;
- int STATUS_INSERTED = 1;
- int STATUS_UPDATED = 2;
- int STATUS_DELETED = 3;
-
- void initTreeNode();
-
- String getNodeId();
-
- /**
- * called after the node has been added to a tree
- */
- void nodeAddedNotify();
-
- /**
- * called after the node has been removed from a tree
- */
- void nodeRemovedNotify();
-
- int getStatus();
-
- boolean isStatusInserted();
-
- boolean isStatusUpdated();
-
- boolean isStatusDeleted();
-
- boolean isStatusNonchanged();
-
- /**
- * do not use this method directly use {@link ITree#setNodeExpanded(ITreeNode, boolean)}
- */
- void setExpandedInternal(boolean b);
-
- /**
- * Note: this method is a Convenience for {@link ITree#setNodeExpanded(this, boolean)}
- */
- void setExpanded(boolean b);
-
- /**
- * do not use this method directly use {@link ITree#setNodeEnabledPermission(ITreeNode, boolean)}
- */
- void setEnabledPermissionInternal(Permission p);
-
- /**
- * Note: this method is a Convenience for {@link ITree#setNodeEnabledPermission(this, boolean)}
- */
- void setEnabledPermission(Permission p);
-
- /**
- * do not use this method directly use {@link ITree#setNodeEnabledGranted(ITreeNode, boolean)}
- */
- void setEnabledGrantedInternal(boolean b);
-
- /**
- * Note: this method is a Convenience for {@link ITree#setNodeEnabledGranted(this, boolean)}
- */
- void setEnabledGranted(boolean b);
-
- /**
- * do not use this method directly use {@link ITree#setNodeEnabled(ITreeNode, boolean)}
- */
- void setEnabledInternal(boolean b);
-
- /**
- * Note: this method is a Convenience for {@link ITree#setNodeEnabled(this, boolean)}
- */
- void setEnabled(boolean b);
-
- /**
- * do not use this method directly use {@link ITree#setNodeVisiblePermission(ITreeNode, boolean)}
- */
- void setVisiblePermissionInternal(Permission p);
-
- /**
- * Note: this method is a Convenience for {@link ITree#setNodeVisiblePermission(this, boolean)}
- */
- void setVisiblePermission(Permission p);
-
- /**
- * do not use this method directly use {@link ITree#setNodeVisibleGranted(ITreeNode, boolean)}
- */
- void setVisibleGrantedInternal(boolean b);
-
- /**
- * Note: this method is a Convenience for {@link ITree#setNodeVisibleGranted(this, boolean)}
- */
- void setVisibleGranted(boolean b);
-
- /**
- * do not use this method directly use {@link ITree#setNodeVisible(ITreeNode, boolean)}
- */
- void setVisibleInternal(boolean b);
-
- /**
- * Note: this method is a Convenience for {@link ITree#setNodeVisible(this, boolean)}
- */
- void setVisible(boolean b);
-
- /**
- * do not use this method directly use {@link ITree#setNodeLeaf(ITreeNode, boolean)}
- */
- void setLeafInternal(boolean b);
-
- /**
- * do not use this method directly use {@link ITree#setNodeChecked(ITreeNode, boolean)}
- */
- void setCheckedInternal(boolean b);
-
- /**
- * Note: this method is a Convenience for {@link ITree#setNodeLeaf(this, boolean)}
- */
- void setLeaf(boolean b);
-
- /**
- * valid only when {@link ITree#isCheckable()}==true
- */
- boolean isChecked();
-
- void setChecked(boolean b);
-
- /**
- * do not use this method directly use {@link ITree#setNodeStatus(ITreeNode, int)}
- */
- void setStatusInternal(int status);
-
- /**
- * Note: this method is a Convenience for {@link ITree#setNodeStatus(this, int)}
- */
- void setStatus(int status);
-
- ICell getCell();
-
- Cell getCellForUpdate();
-
- Object getPrimaryKey();
-
- void setPrimaryKey(Object key);
-
- void decorateCell();
-
- boolean isLeaf();
-
- /**
- * alias for {@link ITree#isSelectedNode(ITreeNode)}
- */
- boolean isSelectedNode();
-
- /**
- * see {@link ITree#addNodeFilter(ITreeNodeFilter)}
- */
- boolean isFilterAccepted();
-
- /**
- * do not use this method directly, use {@link ITree#addNodeFilter(ITreeNodeFilter)},
- * {@link ITree#removeNodeFilter(ITreeNodeFilter)}
- */
- void setFilterAccepted(boolean b);
-
- void resetFilterCache();
-
- /**
- * a dirty marked node is marked for child reload its children are reloaded on
- * the next ui call to {@link ITreeUIFacade#setNodeExpandedFromUI(ITreeNode, boolean)}
- * {@link ITreeUIFacade#setNodeSelectedAndExpandedFromUI(ITreeNode)}
- * {@link ITreeUIFacade#setNodesSelectedFromUI(ITreeNode[])} and the dirty
- * flag is reset to false default is false
- */
- boolean isChildrenDirty();
-
- /**
- * mark a node as dirty
- */
- void setChildrenDirty(boolean b);
-
- /**
- * a node with volatile (rapidly and constantly changing) children is reloaded
- * on ANY ui call to {@link ITreeUIFacade#setNodeExpandedFromUI(ITreeNode, boolean)}
- * {@link ITreeUIFacade#setNodeSelectedAndExpandedFromUI(ITreeNode)}
- * {@link ITreeUIFacade#setNodesSelectedFromUI(ITreeNode[])} default is false
- */
- boolean isChildrenVolatile();
-
- /**
- * mark node as containing volatile children
- */
- void setChildrenVolatile(boolean b);
-
- /**
- * @return true if node is enabled and enabled is granted
- */
- boolean isEnabled();
-
- boolean isEnabledGranted();
-
- /**
- * @return true if node is visible and visible is granted
- */
- boolean isVisible();
-
- boolean isVisibleGranted();
-
- boolean isInitialExpanded();
-
- void setInitialExpanded(boolean b);
-
- boolean isExpanded();
-
- IMenu[] getMenus();
-
- /**
- * Convenience to find a menu, uses {@link ActionFinder}
- */
- <T extends IMenu> T getMenu(Class<T> menuType) throws ProcessingException;
-
- void setMenus(IMenu[] a);
-
- /**
- * get tree containing this node
- */
- ITree getTree();
-
- /**
- * do not use this internal method
- */
- void setTreeInternal(ITree tree, boolean includeSubtree);
-
- /**
- * parent
- */
- ITreeNode getParentNode();
-
- /**
- * @return the immediate parent node if it is of type T, null otherwise
- */
- <T extends ITreeNode> T getParentNode(Class<T> type);
-
- /**
- * @return the parent node if it is of type T, null otherwise
- */
- <T extends ITreeNode> T getParentNode(Class<T> type, int backCount);
-
- /**
- * @return first node in parent path that is of type T, null otherwise
- */
- <T extends ITreeNode> T getAncestorNode(Class<T> type);
-
- /**
- * do not use this internal method
- */
- void setParentNodeInternal(ITreeNode parent);
-
- ITreeNode findParentNode(Class<?> interfaceType);
-
- /**
- * children
- */
- int getChildNodeCount();
-
- /**
- * @return index of this node in its parent child array
- */
- int getChildNodeIndex();
-
- /**
- * do not use this internal method
- */
- void setChildNodeIndexInternal(int childNodeIndex);
-
- ITreeNode getChildNode(int childIndex);
-
- ITreeNode[] getChildNodes();
-
- /**
- * @see ITree#getNodeFilters() This method is Thread-Safe
- */
- ITreeNode[] getFilteredChildNodes();
-
- /**
- * @return the level from top to bottom if root is invisible then it is not
- * counted as a level
- */
- int getTreeLevel();
-
- /**
- * (re)load all children
- */
- void loadChildren() throws ProcessingException;
-
- boolean isChildrenLoaded();
-
- void setChildrenLoaded(boolean b);
-
- void ensureChildrenLoaded() throws ProcessingException;
-
- /**
- * see {@link ITree#resolveVirtualNode(ITreeNode)}
- */
- ITreeNode resolveVirtualChildNode(ITreeNode node) throws ProcessingException;
-
- /**
- * Convenience for getTree().updateNode(this);
- */
- void update();
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.tree;
+
+import java.security.Permission;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.action.ActionFinder;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
+import org.eclipse.scout.rt.client.ui.basic.cell.ICell;
+
+/**
+ * Tree node used in {@link ITree}.
+ * <p>
+ * Note that a {@link IVirtualTreeNode} is equal to its resolved node {@link IVirtualTreeNode#getResolvedNode()} with
+ * regard to {@link #equals(Object)} and {@link #hashCode()}
+ */
+public interface ITreeNode {
+ int STATUS_NON_CHANGED = 0;
+ int STATUS_INSERTED = 1;
+ int STATUS_UPDATED = 2;
+ int STATUS_DELETED = 3;
+
+ void initTreeNode();
+
+ String getNodeId();
+
+ /**
+ * called after the node has been added to a tree
+ */
+ void nodeAddedNotify();
+
+ /**
+ * called after the node has been removed from a tree
+ */
+ void nodeRemovedNotify();
+
+ int getStatus();
+
+ boolean isStatusInserted();
+
+ boolean isStatusUpdated();
+
+ boolean isStatusDeleted();
+
+ boolean isStatusNonchanged();
+
+ /**
+ * do not use this method directly use {@link ITree#setNodeExpanded(ITreeNode, boolean)}
+ */
+ void setExpandedInternal(boolean b);
+
+ /**
+ * Note: this method is a Convenience for {@link ITree#setNodeExpanded(this, boolean)}
+ */
+ void setExpanded(boolean b);
+
+ /**
+ * do not use this method directly use {@link ITree#setNodeEnabledPermission(ITreeNode, boolean)}
+ */
+ void setEnabledPermissionInternal(Permission p);
+
+ /**
+ * Note: this method is a Convenience for {@link ITree#setNodeEnabledPermission(this, boolean)}
+ */
+ void setEnabledPermission(Permission p);
+
+ /**
+ * do not use this method directly use {@link ITree#setNodeEnabledGranted(ITreeNode, boolean)}
+ */
+ void setEnabledGrantedInternal(boolean b);
+
+ /**
+ * Note: this method is a Convenience for {@link ITree#setNodeEnabledGranted(this, boolean)}
+ */
+ void setEnabledGranted(boolean b);
+
+ /**
+ * do not use this method directly use {@link ITree#setNodeEnabled(ITreeNode, boolean)}
+ */
+ void setEnabledInternal(boolean b);
+
+ /**
+ * Note: this method is a Convenience for {@link ITree#setNodeEnabled(this, boolean)}
+ */
+ void setEnabled(boolean b);
+
+ /**
+ * do not use this method directly use {@link ITree#setNodeVisiblePermission(ITreeNode, boolean)}
+ */
+ void setVisiblePermissionInternal(Permission p);
+
+ /**
+ * Note: this method is a Convenience for {@link ITree#setNodeVisiblePermission(this, boolean)}
+ */
+ void setVisiblePermission(Permission p);
+
+ /**
+ * do not use this method directly use {@link ITree#setNodeVisibleGranted(ITreeNode, boolean)}
+ */
+ void setVisibleGrantedInternal(boolean b);
+
+ /**
+ * Note: this method is a Convenience for {@link ITree#setNodeVisibleGranted(this, boolean)}
+ */
+ void setVisibleGranted(boolean b);
+
+ /**
+ * do not use this method directly use {@link ITree#setNodeVisible(ITreeNode, boolean)}
+ */
+ void setVisibleInternal(boolean b);
+
+ /**
+ * Note: this method is a Convenience for {@link ITree#setNodeVisible(this, boolean)}
+ */
+ void setVisible(boolean b);
+
+ /**
+ * do not use this method directly use {@link ITree#setNodeLeaf(ITreeNode, boolean)}
+ */
+ void setLeafInternal(boolean b);
+
+ /**
+ * do not use this method directly use {@link ITree#setNodeChecked(ITreeNode, boolean)}
+ */
+ void setCheckedInternal(boolean b);
+
+ /**
+ * Note: this method is a Convenience for {@link ITree#setNodeLeaf(this, boolean)}
+ */
+ void setLeaf(boolean b);
+
+ /**
+ * valid only when {@link ITree#isCheckable()}==true
+ */
+ boolean isChecked();
+
+ void setChecked(boolean b);
+
+ /**
+ * do not use this method directly use {@link ITree#setNodeStatus(ITreeNode, int)}
+ */
+ void setStatusInternal(int status);
+
+ /**
+ * Note: this method is a Convenience for {@link ITree#setNodeStatus(this, int)}
+ */
+ void setStatus(int status);
+
+ ICell getCell();
+
+ Cell getCellForUpdate();
+
+ Object getPrimaryKey();
+
+ void setPrimaryKey(Object key);
+
+ void decorateCell();
+
+ boolean isLeaf();
+
+ /**
+ * alias for {@link ITree#isSelectedNode(ITreeNode)}
+ */
+ boolean isSelectedNode();
+
+ /**
+ * see {@link ITree#addNodeFilter(ITreeNodeFilter)}
+ */
+ boolean isFilterAccepted();
+
+ /**
+ * do not use this method directly, use {@link ITree#addNodeFilter(ITreeNodeFilter)},
+ * {@link ITree#removeNodeFilter(ITreeNodeFilter)}
+ */
+ void setFilterAccepted(boolean b);
+
+ void resetFilterCache();
+
+ /**
+ * a dirty marked node is marked for child reload its children are reloaded on
+ * the next ui call to {@link ITreeUIFacade#setNodeExpandedFromUI(ITreeNode, boolean)}
+ * {@link ITreeUIFacade#setNodeSelectedAndExpandedFromUI(ITreeNode)}
+ * {@link ITreeUIFacade#setNodesSelectedFromUI(ITreeNode[])} and the dirty
+ * flag is reset to false default is false
+ */
+ boolean isChildrenDirty();
+
+ /**
+ * mark a node as dirty
+ */
+ void setChildrenDirty(boolean b);
+
+ /**
+ * a node with volatile (rapidly and constantly changing) children is reloaded
+ * on ANY ui call to {@link ITreeUIFacade#setNodeExpandedFromUI(ITreeNode, boolean)}
+ * {@link ITreeUIFacade#setNodeSelectedAndExpandedFromUI(ITreeNode)}
+ * {@link ITreeUIFacade#setNodesSelectedFromUI(ITreeNode[])} default is false
+ */
+ boolean isChildrenVolatile();
+
+ /**
+ * mark node as containing volatile children
+ */
+ void setChildrenVolatile(boolean b);
+
+ /**
+ * @return true if node is enabled and enabled is granted
+ */
+ boolean isEnabled();
+
+ boolean isEnabledGranted();
+
+ /**
+ * @return true if node is visible and visible is granted
+ */
+ boolean isVisible();
+
+ boolean isVisibleGranted();
+
+ boolean isInitialExpanded();
+
+ void setInitialExpanded(boolean b);
+
+ boolean isExpanded();
+
+ IMenu[] getMenus();
+
+ /**
+ * Convenience to find a menu, uses {@link ActionFinder}
+ */
+ <T extends IMenu> T getMenu(Class<T> menuType) throws ProcessingException;
+
+ void setMenus(IMenu[] a);
+
+ /**
+ * get tree containing this node
+ */
+ ITree getTree();
+
+ /**
+ * do not use this internal method
+ */
+ void setTreeInternal(ITree tree, boolean includeSubtree);
+
+ /**
+ * parent
+ */
+ ITreeNode getParentNode();
+
+ /**
+ * @return the immediate parent node if it is of type T, null otherwise
+ */
+ <T extends ITreeNode> T getParentNode(Class<T> type);
+
+ /**
+ * @return the parent node if it is of type T, null otherwise
+ */
+ <T extends ITreeNode> T getParentNode(Class<T> type, int backCount);
+
+ /**
+ * @return first node in parent path that is of type T, null otherwise
+ */
+ <T extends ITreeNode> T getAncestorNode(Class<T> type);
+
+ /**
+ * do not use this internal method
+ */
+ void setParentNodeInternal(ITreeNode parent);
+
+ ITreeNode findParentNode(Class<?> interfaceType);
+
+ /**
+ * children
+ */
+ int getChildNodeCount();
+
+ /**
+ * @return index of this node in its parent child array
+ */
+ int getChildNodeIndex();
+
+ /**
+ * do not use this internal method
+ */
+ void setChildNodeIndexInternal(int childNodeIndex);
+
+ ITreeNode getChildNode(int childIndex);
+
+ ITreeNode[] getChildNodes();
+
+ /**
+ * @see ITree#getNodeFilters() This method is Thread-Safe
+ */
+ ITreeNode[] getFilteredChildNodes();
+
+ /**
+ * @return the level from top to bottom if root is invisible then it is not
+ * counted as a level
+ */
+ int getTreeLevel();
+
+ /**
+ * (re)load all children
+ */
+ void loadChildren() throws ProcessingException;
+
+ boolean isChildrenLoaded();
+
+ void setChildrenLoaded(boolean b);
+
+ void ensureChildrenLoaded() throws ProcessingException;
+
+ /**
+ * see {@link ITree#resolveVirtualNode(ITreeNode)}
+ */
+ ITreeNode resolveVirtualChildNode(ITreeNode node) throws ProcessingException;
+
+ /**
+ * Convenience for getTree().updateNode(this);
+ */
+ void update();
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/ITreeNodeFilter.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/ITreeNodeFilter.java
index 8fffe7f128..8cef866243 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/ITreeNodeFilter.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/ITreeNodeFilter.java
@@ -1,24 +1,24 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.tree;
-
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-
-/**
- * A table filter is used to mask out certain rows from the table {@link ITable#getFilteredRows()}. The methods
- * {@link ITable#getRows()} and {@link ITable#getRowCount()} are unaffected by the filter. The UI should use
- * {@link ITreeNode#getChildNodes()}
- */
-public interface ITreeNodeFilter {
-
- boolean accept(ITreeNode node, int level);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.tree;
+
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+
+/**
+ * A table filter is used to mask out certain rows from the table {@link ITable#getFilteredRows()}. The methods
+ * {@link ITable#getRows()} and {@link ITable#getRowCount()} are unaffected by the filter. The UI should use
+ * {@link ITreeNode#getChildNodes()}
+ */
+public interface ITreeNodeFilter {
+
+ boolean accept(ITreeNode node, int level);
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/ITreeUIFacade.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/ITreeUIFacade.java
index 60aa2b24a0..3060cc21d0 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/ITreeUIFacade.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/ITreeUIFacade.java
@@ -1,49 +1,49 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.tree;
-
-import java.net.URL;
-
-import org.eclipse.scout.commons.dnd.TransferObject;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-
-public interface ITreeUIFacade {
-
- boolean isUIProcessing();
-
- void setNodeExpandedFromUI(ITreeNode node, boolean on);
-
- void setNodeSelectedAndExpandedFromUI(ITreeNode node);
-
- void setNodesSelectedFromUI(ITreeNode[] nodes);
-
- IMenu[] fireNodePopupFromUI();
-
- IMenu[] fireEmptySpacePopupFromUI();
-
- /**
- * Single mouse click on a node or (for checkable trees) the space key
- */
- void fireNodeClickFromUI(ITreeNode node);
-
- /**
- * Double mouse click on a node or enter
- */
- void fireNodeActionFromUI(ITreeNode node);
-
- boolean getNodesDragEnabledFromUI();
-
- TransferObject fireNodesDragRequestFromUI();
-
- void fireNodeDropActionFromUI(ITreeNode node, TransferObject dropData);
-
- void fireHyperlinkActionFromUI(ITreeNode node, URL url);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.tree;
+
+import java.net.URL;
+
+import org.eclipse.scout.commons.dnd.TransferObject;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+
+public interface ITreeUIFacade {
+
+ boolean isUIProcessing();
+
+ void setNodeExpandedFromUI(ITreeNode node, boolean on);
+
+ void setNodeSelectedAndExpandedFromUI(ITreeNode node);
+
+ void setNodesSelectedFromUI(ITreeNode[] nodes);
+
+ IMenu[] fireNodePopupFromUI();
+
+ IMenu[] fireEmptySpacePopupFromUI();
+
+ /**
+ * Single mouse click on a node or (for checkable trees) the space key
+ */
+ void fireNodeClickFromUI(ITreeNode node);
+
+ /**
+ * Double mouse click on a node or enter
+ */
+ void fireNodeActionFromUI(ITreeNode node);
+
+ boolean getNodesDragEnabledFromUI();
+
+ TransferObject fireNodesDragRequestFromUI();
+
+ void fireNodeDropActionFromUI(ITreeNode node, TransferObject dropData);
+
+ void fireHyperlinkActionFromUI(ITreeNode node, URL url);
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/ITreeVisitor.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/ITreeVisitor.java
index 46b5a7ebdd..bbd44a9647 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/ITreeVisitor.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/ITreeVisitor.java
@@ -1,17 +1,17 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.tree;
-
-public interface ITreeVisitor {
-
- boolean visit(ITreeNode node);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.tree;
+
+public interface ITreeVisitor {
+
+ boolean visit(ITreeNode node);
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/IVirtualTreeNode.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/IVirtualTreeNode.java
index b1b0a8fe82..42db3725de 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/IVirtualTreeNode.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/IVirtualTreeNode.java
@@ -1,39 +1,39 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.tree;
-
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.VirtualPage;
-
-/**
- * A virtual node is a marker tree node used to optimize performance in large trees.
- * <p>
- * It is used mainly in the {@link IPage}, {@link IOutline} area with {@link VirtualPage}s
- * <p>
- * Note that a {@link IVirtualTreeNode} is equal to its resolved node with regard to {@link #equals(Object)} and
- * {@link #hashCode()}
- */
-public interface IVirtualTreeNode extends ITreeNode {
- /**
- * @return the real node if the virtual node has been resolved, <code>null</code> otherwise.<br/>
- * This value is used when a (old) reference to a {@link IVirtualTreeNode} is interested in the real node to
- * update its reference.
- */
- ITreeNode getResolvedNode();
-
- /**
- * Attaches the real node to this virtual node. This method takes care
- * to establish the contract of {@link IVirtualTreeNode} and {@link ITreeNode} with respect to the methods
- * <code>equals(Object)</code> and <code>hashCode()</code>.
- */
- void setResolvedNode(ITreeNode resolvedNode);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.tree;
+
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.VirtualPage;
+
+/**
+ * A virtual node is a marker tree node used to optimize performance in large trees.
+ * <p>
+ * It is used mainly in the {@link IPage}, {@link IOutline} area with {@link VirtualPage}s
+ * <p>
+ * Note that a {@link IVirtualTreeNode} is equal to its resolved node with regard to {@link #equals(Object)} and
+ * {@link #hashCode()}
+ */
+public interface IVirtualTreeNode extends ITreeNode {
+ /**
+ * @return the real node if the virtual node has been resolved, <code>null</code> otherwise.<br/>
+ * This value is used when a (old) reference to a {@link IVirtualTreeNode} is interested in the real node to
+ * update its reference.
+ */
+ ITreeNode getResolvedNode();
+
+ /**
+ * Attaches the real node to this virtual node. This method takes care
+ * to establish the contract of {@link IVirtualTreeNode} and {@link ITreeNode} with respect to the methods
+ * <code>equals(Object)</code> and <code>hashCode()</code>.
+ */
+ void setResolvedNode(ITreeNode resolvedNode);
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/TreeAdapter.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/TreeAdapter.java
index 50ffd3d9cb..e314eaed50 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/TreeAdapter.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/TreeAdapter.java
@@ -1,29 +1,29 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.tree;
-
-/**
- * inside gui handling or in non-model threads don't use this adapter because it
- * might reduce performance when batch events are handled as single events
- */
-public class TreeAdapter implements TreeListener {
-
- @Override
- public void treeChangedBatch(TreeEvent[] batch) {
- for (int i = 0; i < batch.length; i++) {
- treeChanged(batch[i]);
- }
- }
-
- @Override
- public void treeChanged(TreeEvent e) {
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.tree;
+
+/**
+ * inside gui handling or in non-model threads don't use this adapter because it
+ * might reduce performance when batch events are handled as single events
+ */
+public class TreeAdapter implements TreeListener {
+
+ @Override
+ public void treeChangedBatch(TreeEvent[] batch) {
+ for (int i = 0; i < batch.length; i++) {
+ treeChanged(batch[i]);
+ }
+ }
+
+ @Override
+ public void treeChanged(TreeEvent e) {
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/TreeEvent.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/TreeEvent.java
index a68649a8d9..5aa514a175 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/TreeEvent.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/TreeEvent.java
@@ -1,357 +1,357 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.tree;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.EventObject;
-import java.util.List;
-
-import org.eclipse.scout.commons.dnd.TransferObject;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-
-public class TreeEvent extends EventObject {
- private static final long serialVersionUID = 1L;
-
- /**
- * valid attributes are parentNode,childNodes
- */
- public static final int TYPE_NODES_INSERTED = 10;
- /**
- * valid attributes are parentNode,childNodes
- */
- public static final int TYPE_NODES_UPDATED = 20;
- /**
- * no attributes
- */
- public static final int TYPE_NODE_FILTER_CHANGED = 400;
- /**
- * valid attributes are parentNode,childNodes
- */
- public static final int TYPE_NODES_DELETED = 30;
- /**
- * valid attributes are nodes, deselectedNodes parentNode is null
- */
- public static final int TYPE_BEFORE_NODES_SELECTED = 35;
- /**
- * valid attributes are nodes, deselectedNodes parentNode is null
- */
- public static final int TYPE_NODES_SELECTED = 40;
- /**
- * valid attributes are parentNode,childNodes
- */
- public static final int TYPE_CHILD_NODE_ORDER_CHANGED = 50;
- /**
- * valid attributes are node
- */
- public static final int TYPE_NODE_EXPANDED = 100;
- /**
- * valid attributes are node
- */
- public static final int TYPE_NODE_COLLAPSED = 101;
- /**
- * valid attributes are node contribute to menus using the addPopupMenu
- * methods
- */
- public static final int TYPE_NODE_POPUP = 700;
- /**
- * valid attributes are node
- */
- public static final int TYPE_NODE_ACTION = 705;
-
- /**
- * valid attributes are parentNode (if common parent of all nodes), nodes
- * register the drag object using the setDragObject method
- */
- public static final int TYPE_NODES_DRAG_REQUEST = 730;
- /**
- * valid attributes are node get the drop object using the getDropObject
- * method
- */
- public static final int TYPE_NODE_DROP_ACTION = 740;
- /**
- * Gui targeted event valid attributes are node
- */
- public static final int TYPE_NODE_REQUEST_FOCUS = 200;
- /**
- * Gui targeted event valid attributes are node
- */
- public static final int TYPE_NODE_ENSURE_VISIBLE = 300;
-
- public static final int TYPE_REQUEST_FOCUS = 800;
-
- /**
- * valid attributes are node
- */
- public static final int TYPE_NODE_CLICK = 820;
-
- /**
- * Advise to scroll to selection
- */
- public static final int TYPE_SCROLL_TO_SELECTION = 830;
- // next 840
-
- private final int m_type;
- private ITreeNode m_commonParentNode;
- private ITreeNode[] m_nodes;
- private ITreeNode[] m_deselectedNodes;
- private ITreeNode[] m_newSelectedNodes;
- private List<IMenu> m_popupMenus;
- private boolean m_consumed;
- private TransferObject m_dragObject;
- private TransferObject m_dropObject;
-
- public TreeEvent(ITree source, int type) {
- super(source);
- m_type = type;
- }
-
- public TreeEvent(ITree source, int type, ITreeNode node) {
- super(source);
- m_type = type;
- if (node != null) {
- m_nodes = new ITreeNode[]{node};
- }
- m_commonParentNode = TreeUtility.calculateCommonParentNode(m_nodes);
- }
-
- public TreeEvent(ITree source, int type, ITreeNode[] nodes) {
- super(source);
- m_type = type;
- if (nodes != null) {
- m_nodes = nodes;
- }
- m_commonParentNode = TreeUtility.calculateCommonParentNode(m_nodes);
- }
-
- public TreeEvent(ITree source, int type, ITreeNode parentNode, ITreeNode[] childNodes) {
- super(source);
- m_type = type;
- if (childNodes != null) {
- m_nodes = childNodes;
- }
- m_commonParentNode = parentNode;
- if (m_commonParentNode == null) {
- m_commonParentNode = TreeUtility.calculateCommonParentNode(m_nodes);
- }
- }
-
- public ITree getTree() {
- return (ITree) getSource();
- }
-
- public int getType() {
- return m_type;
- }
-
- public ITreeNode getCommonParentNode() {
- return m_commonParentNode;
- }
-
- public ITreeNode getDeselectedNode() {
- if (m_deselectedNodes != null && m_deselectedNodes.length > 0) {
- return m_deselectedNodes[0];
- }
- else {
- return null;
- }
- }
-
- public ITreeNode[] getDeselectedNodes() {
- if (m_deselectedNodes != null) {
- return m_deselectedNodes;
- }
- else {
- return new ITreeNode[0];
- }
- }
-
- protected void setDeselectedNodes(ITreeNode[] deselectedNodes) {
- m_deselectedNodes = deselectedNodes;
- }
-
- public ITreeNode getNewSelectedNode() {
- if (m_newSelectedNodes != null && m_newSelectedNodes.length > 0) {
- return m_newSelectedNodes[0];
- }
- else {
- return null;
- }
- }
-
- public ITreeNode[] getNewSelectedNodes() {
- if (m_newSelectedNodes != null) {
- return m_newSelectedNodes;
- }
- else {
- return new ITreeNode[0];
- }
- }
-
- protected void setNewSelectedNodes(ITreeNode[] newSelectedNodes) {
- m_newSelectedNodes = newSelectedNodes;
- }
-
- public ITreeNode getNode() {
- if (m_nodes != null && m_nodes.length > 0) {
- return m_nodes[0];
- }
- else {
- return null;
- }
- }
-
- public ITreeNode[] getNodes() {
- if (m_nodes != null) {
- return m_nodes;
- }
- else {
- return new ITreeNode[0];
- }
- }
-
- public ITreeNode getChildNode() {
- return getNode();
- }
-
- public ITreeNode[] getChildNodes() {
- return getNodes();
- }
-
- public void addPopupMenu(IMenu menu) {
- if (menu != null) {
- if (m_popupMenus == null) {
- m_popupMenus = new ArrayList<IMenu>();
- }
- m_popupMenus.add(menu);
- }
- }
-
- /**
- * used by TYPE_ROW_POPUP to add actions
- */
- public void addPopupMenus(IMenu[] menus) {
- if (menus != null) {
- if (m_popupMenus == null) {
- m_popupMenus = new ArrayList<IMenu>();
- }
- m_popupMenus.addAll(Arrays.asList(menus));
- }
- }
-
- /**
- * used by TYPE_ROW_POPUP to add actions
- */
- public IMenu[] getPopupMenus() {
- if (m_popupMenus != null) {
- return m_popupMenus.toArray(new IMenu[0]);
- }
- else {
- return new IMenu[0];
- }
- }
-
- /**
- * used by TYPE_ROW_POPUP to add actions
- */
- public int getPopupMenuCount() {
- if (m_popupMenus != null) {
- return m_popupMenus.size();
- }
- else {
- return 0;
- }
- }
-
- /**
- * used by TYPE_ROW_DRAG_REQUEST
- */
- public TransferObject getDragObject() {
- return m_dragObject;
- }
-
- public void setDragObject(TransferObject t) {
- m_dragObject = t;
- }
-
- /**
- * used by TYPE_ROW_DROP_ACTION
- */
- public TransferObject getDropObject() {
- return m_dropObject;
- }
-
- protected void setDropObject(TransferObject t) {
- m_dropObject = t;
- }
-
- /**
- * @deprecated Use {@link TreeUtility#calculateCommonParentNode(ITreeNode[])};
- */
- @Deprecated
- public static ITreeNode calculateCommonParentNode(ITreeNode[] nodes) {
- return TreeUtility.calculateCommonParentNode(nodes);
- }
-
- public boolean isConsumed() {
- return m_consumed;
- }
-
- public void consume() {
- m_consumed = true;
- }
-
- @Override
- public String toString() {
- StringBuffer buf = new StringBuffer();
- buf.append("TreeEvent[");
- // nodes
- if (m_nodes != null && m_nodes.length > 0 && getTree() != null) {
- if (m_nodes.length == 1) {
- buf.append("\"" + m_nodes[0] + "\"");
- }
- else {
- buf.append("{");
- for (int i = 0; i < m_nodes.length; i++) {
- if (i >= 0) {
- buf.append(",");
- }
- buf.append("\"" + m_nodes[i] + "\"");
- }
- buf.append("}");
- }
- }
- else {
- buf.append("{}");
- }
- buf.append(" ");
- // decode type
- try {
- Field[] f = getClass().getDeclaredFields();
- for (int i = 0; i < f.length; i++) {
- if (Modifier.isPublic(f[i].getModifiers()) && Modifier.isStatic(f[i].getModifiers()) && f[i].getName().startsWith("TYPE_")) {
- if (((Number) f[i].get(null)).intValue() == m_type) {
- buf.append(f[i].getName());
- break;
- }
- }
- }
- }
- catch (Throwable t) {
- buf.append("#" + m_type);
- }
- buf.append("]");
- return buf.toString();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.tree;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.EventObject;
+import java.util.List;
+
+import org.eclipse.scout.commons.dnd.TransferObject;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+
+public class TreeEvent extends EventObject {
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * valid attributes are parentNode,childNodes
+ */
+ public static final int TYPE_NODES_INSERTED = 10;
+ /**
+ * valid attributes are parentNode,childNodes
+ */
+ public static final int TYPE_NODES_UPDATED = 20;
+ /**
+ * no attributes
+ */
+ public static final int TYPE_NODE_FILTER_CHANGED = 400;
+ /**
+ * valid attributes are parentNode,childNodes
+ */
+ public static final int TYPE_NODES_DELETED = 30;
+ /**
+ * valid attributes are nodes, deselectedNodes parentNode is null
+ */
+ public static final int TYPE_BEFORE_NODES_SELECTED = 35;
+ /**
+ * valid attributes are nodes, deselectedNodes parentNode is null
+ */
+ public static final int TYPE_NODES_SELECTED = 40;
+ /**
+ * valid attributes are parentNode,childNodes
+ */
+ public static final int TYPE_CHILD_NODE_ORDER_CHANGED = 50;
+ /**
+ * valid attributes are node
+ */
+ public static final int TYPE_NODE_EXPANDED = 100;
+ /**
+ * valid attributes are node
+ */
+ public static final int TYPE_NODE_COLLAPSED = 101;
+ /**
+ * valid attributes are node contribute to menus using the addPopupMenu
+ * methods
+ */
+ public static final int TYPE_NODE_POPUP = 700;
+ /**
+ * valid attributes are node
+ */
+ public static final int TYPE_NODE_ACTION = 705;
+
+ /**
+ * valid attributes are parentNode (if common parent of all nodes), nodes
+ * register the drag object using the setDragObject method
+ */
+ public static final int TYPE_NODES_DRAG_REQUEST = 730;
+ /**
+ * valid attributes are node get the drop object using the getDropObject
+ * method
+ */
+ public static final int TYPE_NODE_DROP_ACTION = 740;
+ /**
+ * Gui targeted event valid attributes are node
+ */
+ public static final int TYPE_NODE_REQUEST_FOCUS = 200;
+ /**
+ * Gui targeted event valid attributes are node
+ */
+ public static final int TYPE_NODE_ENSURE_VISIBLE = 300;
+
+ public static final int TYPE_REQUEST_FOCUS = 800;
+
+ /**
+ * valid attributes are node
+ */
+ public static final int TYPE_NODE_CLICK = 820;
+
+ /**
+ * Advise to scroll to selection
+ */
+ public static final int TYPE_SCROLL_TO_SELECTION = 830;
+ // next 840
+
+ private final int m_type;
+ private ITreeNode m_commonParentNode;
+ private ITreeNode[] m_nodes;
+ private ITreeNode[] m_deselectedNodes;
+ private ITreeNode[] m_newSelectedNodes;
+ private List<IMenu> m_popupMenus;
+ private boolean m_consumed;
+ private TransferObject m_dragObject;
+ private TransferObject m_dropObject;
+
+ public TreeEvent(ITree source, int type) {
+ super(source);
+ m_type = type;
+ }
+
+ public TreeEvent(ITree source, int type, ITreeNode node) {
+ super(source);
+ m_type = type;
+ if (node != null) {
+ m_nodes = new ITreeNode[]{node};
+ }
+ m_commonParentNode = TreeUtility.calculateCommonParentNode(m_nodes);
+ }
+
+ public TreeEvent(ITree source, int type, ITreeNode[] nodes) {
+ super(source);
+ m_type = type;
+ if (nodes != null) {
+ m_nodes = nodes;
+ }
+ m_commonParentNode = TreeUtility.calculateCommonParentNode(m_nodes);
+ }
+
+ public TreeEvent(ITree source, int type, ITreeNode parentNode, ITreeNode[] childNodes) {
+ super(source);
+ m_type = type;
+ if (childNodes != null) {
+ m_nodes = childNodes;
+ }
+ m_commonParentNode = parentNode;
+ if (m_commonParentNode == null) {
+ m_commonParentNode = TreeUtility.calculateCommonParentNode(m_nodes);
+ }
+ }
+
+ public ITree getTree() {
+ return (ITree) getSource();
+ }
+
+ public int getType() {
+ return m_type;
+ }
+
+ public ITreeNode getCommonParentNode() {
+ return m_commonParentNode;
+ }
+
+ public ITreeNode getDeselectedNode() {
+ if (m_deselectedNodes != null && m_deselectedNodes.length > 0) {
+ return m_deselectedNodes[0];
+ }
+ else {
+ return null;
+ }
+ }
+
+ public ITreeNode[] getDeselectedNodes() {
+ if (m_deselectedNodes != null) {
+ return m_deselectedNodes;
+ }
+ else {
+ return new ITreeNode[0];
+ }
+ }
+
+ protected void setDeselectedNodes(ITreeNode[] deselectedNodes) {
+ m_deselectedNodes = deselectedNodes;
+ }
+
+ public ITreeNode getNewSelectedNode() {
+ if (m_newSelectedNodes != null && m_newSelectedNodes.length > 0) {
+ return m_newSelectedNodes[0];
+ }
+ else {
+ return null;
+ }
+ }
+
+ public ITreeNode[] getNewSelectedNodes() {
+ if (m_newSelectedNodes != null) {
+ return m_newSelectedNodes;
+ }
+ else {
+ return new ITreeNode[0];
+ }
+ }
+
+ protected void setNewSelectedNodes(ITreeNode[] newSelectedNodes) {
+ m_newSelectedNodes = newSelectedNodes;
+ }
+
+ public ITreeNode getNode() {
+ if (m_nodes != null && m_nodes.length > 0) {
+ return m_nodes[0];
+ }
+ else {
+ return null;
+ }
+ }
+
+ public ITreeNode[] getNodes() {
+ if (m_nodes != null) {
+ return m_nodes;
+ }
+ else {
+ return new ITreeNode[0];
+ }
+ }
+
+ public ITreeNode getChildNode() {
+ return getNode();
+ }
+
+ public ITreeNode[] getChildNodes() {
+ return getNodes();
+ }
+
+ public void addPopupMenu(IMenu menu) {
+ if (menu != null) {
+ if (m_popupMenus == null) {
+ m_popupMenus = new ArrayList<IMenu>();
+ }
+ m_popupMenus.add(menu);
+ }
+ }
+
+ /**
+ * used by TYPE_ROW_POPUP to add actions
+ */
+ public void addPopupMenus(IMenu[] menus) {
+ if (menus != null) {
+ if (m_popupMenus == null) {
+ m_popupMenus = new ArrayList<IMenu>();
+ }
+ m_popupMenus.addAll(Arrays.asList(menus));
+ }
+ }
+
+ /**
+ * used by TYPE_ROW_POPUP to add actions
+ */
+ public IMenu[] getPopupMenus() {
+ if (m_popupMenus != null) {
+ return m_popupMenus.toArray(new IMenu[0]);
+ }
+ else {
+ return new IMenu[0];
+ }
+ }
+
+ /**
+ * used by TYPE_ROW_POPUP to add actions
+ */
+ public int getPopupMenuCount() {
+ if (m_popupMenus != null) {
+ return m_popupMenus.size();
+ }
+ else {
+ return 0;
+ }
+ }
+
+ /**
+ * used by TYPE_ROW_DRAG_REQUEST
+ */
+ public TransferObject getDragObject() {
+ return m_dragObject;
+ }
+
+ public void setDragObject(TransferObject t) {
+ m_dragObject = t;
+ }
+
+ /**
+ * used by TYPE_ROW_DROP_ACTION
+ */
+ public TransferObject getDropObject() {
+ return m_dropObject;
+ }
+
+ protected void setDropObject(TransferObject t) {
+ m_dropObject = t;
+ }
+
+ /**
+ * @deprecated Use {@link TreeUtility#calculateCommonParentNode(ITreeNode[])};
+ */
+ @Deprecated
+ public static ITreeNode calculateCommonParentNode(ITreeNode[] nodes) {
+ return TreeUtility.calculateCommonParentNode(nodes);
+ }
+
+ public boolean isConsumed() {
+ return m_consumed;
+ }
+
+ public void consume() {
+ m_consumed = true;
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer buf = new StringBuffer();
+ buf.append("TreeEvent[");
+ // nodes
+ if (m_nodes != null && m_nodes.length > 0 && getTree() != null) {
+ if (m_nodes.length == 1) {
+ buf.append("\"" + m_nodes[0] + "\"");
+ }
+ else {
+ buf.append("{");
+ for (int i = 0; i < m_nodes.length; i++) {
+ if (i >= 0) {
+ buf.append(",");
+ }
+ buf.append("\"" + m_nodes[i] + "\"");
+ }
+ buf.append("}");
+ }
+ }
+ else {
+ buf.append("{}");
+ }
+ buf.append(" ");
+ // decode type
+ try {
+ Field[] f = getClass().getDeclaredFields();
+ for (int i = 0; i < f.length; i++) {
+ if (Modifier.isPublic(f[i].getModifiers()) && Modifier.isStatic(f[i].getModifiers()) && f[i].getName().startsWith("TYPE_")) {
+ if (((Number) f[i].get(null)).intValue() == m_type) {
+ buf.append(f[i].getName());
+ break;
+ }
+ }
+ }
+ }
+ catch (Throwable t) {
+ buf.append("#" + m_type);
+ }
+ buf.append("]");
+ return buf.toString();
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/TreeListener.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/TreeListener.java
index 099bd116c6..48e3527ff5 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/TreeListener.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/TreeListener.java
@@ -1,23 +1,23 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.tree;
-
-import java.util.EventListener;
-
-public interface TreeListener extends EventListener {
-
- void treeChanged(TreeEvent e);
-
- /**
- * batch event for fast processing of batch changes
- */
- void treeChangedBatch(TreeEvent[] batch);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.tree;
+
+import java.util.EventListener;
+
+public interface TreeListener extends EventListener {
+
+ void treeChanged(TreeEvent e);
+
+ /**
+ * batch event for fast processing of batch changes
+ */
+ void treeChangedBatch(TreeEvent[] batch);
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/TreeUtility.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/TreeUtility.java
index 1de0864bb2..4d94416161 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/TreeUtility.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/TreeUtility.java
@@ -1,117 +1,117 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.tree;
-
-import java.util.List;
-
-/**
- * @since 3.8.0
- */
-public final class TreeUtility {
-
- /**
- * If every given node has the same parent, that common parent node will be returned, else null.
- */
- public static ITreeNode calculateCommonParentNode(ITreeNode[] nodes) {
- if (nodes == null || nodes.length == 0) {
- return null;
- }
-
- if (nodes.length == 1) {
- return nodes[0].getParentNode();
- }
-
- ITreeNode test = nodes[0].getParentNode();
- for (int i = 1; i < nodes.length; i++) {
- if (nodes[i].getParentNode() != test) {
- test = null;
- break;
- }
- }
-
- return test;
- }
-
- /**
- * Searches for the lowest common ancestor of the given node. Lowest means farthest away from root.
- */
- public static ITreeNode findLowestCommonAncestorNode(List<ITreeNode> nodes) {
- if (nodes == null || nodes.size() == 0) {
- return null;
- }
-
- if (nodes.size() == 1) {
- return nodes.get(0).getParentNode();
- }
-
- ITreeNode commonParent = nodes.get(0).getParentNode();
-
- for (int i = 1; i < nodes.size(); i++) {
- ITreeNode parentNode = nodes.get(i).getParentNode();
- if (parentNode != commonParent) {
- commonParent = findLowestCommonAncestorNode(commonParent, parentNode);
- }
- }
-
- return commonParent;
- }
-
- public static ITreeNode findLowestCommonAncestorNode(ITreeNode firstNode, ITreeNode secondNode) {
- if (firstNode == null || secondNode == null) {
- return null;
- }
-
- if (firstNode.getTree() != secondNode.getTree()) {
- return null;
- }
-
- if (firstNode.getParentNode() == secondNode.getParentNode()) {
- return firstNode.getParentNode();
- }
-
- if (secondNode.getTreeLevel() > firstNode.getTreeLevel()) {
- secondNode = findAncestorNodeAtLevel(secondNode, firstNode.getTreeLevel());
- }
- else if (firstNode.getTreeLevel() > secondNode.getTreeLevel()) {
- firstNode = findAncestorNodeAtLevel(firstNode, secondNode.getTreeLevel());
- }
-
- while (firstNode.getParentNode() != secondNode.getParentNode()) {
- firstNode = firstNode.getParentNode();
- secondNode = secondNode.getParentNode();
- }
-
- return firstNode.getParentNode();
- }
-
- /**
- * Returns the ancestor of the given node which resides at the given level.
- *
- * @param level
- * The level to look for the ancestor. The level has to be <= than node.getLevel(); Otherwise null will
- * returned.
- */
- public static ITreeNode findAncestorNodeAtLevel(ITreeNode node, int level) {
- if (node == null) {
- return null;
- }
-
- if (node.getTreeLevel() < level) {
- return null;
- }
-
- while (node.getTreeLevel() > level) {
- node = node.getParentNode();
- }
-
- return node;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.tree;
+
+import java.util.List;
+
+/**
+ * @since 3.8.0
+ */
+public final class TreeUtility {
+
+ /**
+ * If every given node has the same parent, that common parent node will be returned, else null.
+ */
+ public static ITreeNode calculateCommonParentNode(ITreeNode[] nodes) {
+ if (nodes == null || nodes.length == 0) {
+ return null;
+ }
+
+ if (nodes.length == 1) {
+ return nodes[0].getParentNode();
+ }
+
+ ITreeNode test = nodes[0].getParentNode();
+ for (int i = 1; i < nodes.length; i++) {
+ if (nodes[i].getParentNode() != test) {
+ test = null;
+ break;
+ }
+ }
+
+ return test;
+ }
+
+ /**
+ * Searches for the lowest common ancestor of the given node. Lowest means farthest away from root.
+ */
+ public static ITreeNode findLowestCommonAncestorNode(List<ITreeNode> nodes) {
+ if (nodes == null || nodes.size() == 0) {
+ return null;
+ }
+
+ if (nodes.size() == 1) {
+ return nodes.get(0).getParentNode();
+ }
+
+ ITreeNode commonParent = nodes.get(0).getParentNode();
+
+ for (int i = 1; i < nodes.size(); i++) {
+ ITreeNode parentNode = nodes.get(i).getParentNode();
+ if (parentNode != commonParent) {
+ commonParent = findLowestCommonAncestorNode(commonParent, parentNode);
+ }
+ }
+
+ return commonParent;
+ }
+
+ public static ITreeNode findLowestCommonAncestorNode(ITreeNode firstNode, ITreeNode secondNode) {
+ if (firstNode == null || secondNode == null) {
+ return null;
+ }
+
+ if (firstNode.getTree() != secondNode.getTree()) {
+ return null;
+ }
+
+ if (firstNode.getParentNode() == secondNode.getParentNode()) {
+ return firstNode.getParentNode();
+ }
+
+ if (secondNode.getTreeLevel() > firstNode.getTreeLevel()) {
+ secondNode = findAncestorNodeAtLevel(secondNode, firstNode.getTreeLevel());
+ }
+ else if (firstNode.getTreeLevel() > secondNode.getTreeLevel()) {
+ firstNode = findAncestorNodeAtLevel(firstNode, secondNode.getTreeLevel());
+ }
+
+ while (firstNode.getParentNode() != secondNode.getParentNode()) {
+ firstNode = firstNode.getParentNode();
+ secondNode = secondNode.getParentNode();
+ }
+
+ return firstNode.getParentNode();
+ }
+
+ /**
+ * Returns the ancestor of the given node which resides at the given level.
+ *
+ * @param level
+ * The level to look for the ancestor. The level has to be <= than node.getLevel(); Otherwise null will
+ * returned.
+ */
+ public static ITreeNode findAncestorNodeAtLevel(ITreeNode node, int level) {
+ if (node == null) {
+ return null;
+ }
+
+ if (node.getTreeLevel() < level) {
+ return null;
+ }
+
+ while (node.getTreeLevel() > level) {
+ node = node.getParentNode();
+ }
+
+ return node;
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/VirtualTreeNode.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/VirtualTreeNode.java
index c3e87d5463..449af99ea3 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/VirtualTreeNode.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/basic/tree/VirtualTreeNode.java
@@ -1,476 +1,476 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.basic.tree;
-
-import java.security.Permission;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
-import org.eclipse.scout.rt.client.ui.basic.cell.ICell;
-import org.eclipse.scout.rt.client.ui.basic.cell.ICellObserver;
-
-public class VirtualTreeNode implements IVirtualTreeNode, ICellObserver {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(VirtualTreeNode.class);
-
- private ITree m_tree;
- private ITreeNode m_parentNode;
- private ITreeNode m_resolvedNode;
- private boolean m_filterAccepted;
- private final Cell m_cell;
- private int m_childNodeIndex;
-
- public VirtualTreeNode() {
- m_cell = new Cell(this);
- }
-
- /**
- * do NOT change this hashCode
- */
- @Override
- public final int hashCode() {
- return super.hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj != null && obj == m_resolvedNode) {
- return true;
- }
- return super.equals(obj);
- }
-
- @Override
- public void initTreeNode() {
- }
-
- @Override
- public ITreeNode getResolvedNode() {
- return m_resolvedNode;
- }
-
- @Override
- public void setResolvedNode(ITreeNode resolvedNode) {
- m_resolvedNode = resolvedNode;
- if (resolvedNode instanceof AbstractTreeNode) {
- ((AbstractTreeNode) resolvedNode).setHashCode(this.hashCode());
- }
- }
-
- @Override
- public String getNodeId() {
- String s = getClass().getName();
- int i = Math.max(s.lastIndexOf('$'), s.lastIndexOf('.'));
- s = s.substring(i + 1);
- return s;
- }
-
- @Override
- public int getStatus() {
- return STATUS_NON_CHANGED;
- }
-
- @Override
- public void setStatusInternal(int status) {
- }
-
- @Override
- public void setStatus(int status) {
- }
-
- @Override
- public boolean isStatusInserted() {
- return false;
- }
-
- @Override
- public boolean isStatusUpdated() {
- return false;
- }
-
- @Override
- public boolean isStatusDeleted() {
- return false;
- }
-
- @Override
- public boolean isStatusNonchanged() {
- return true;
- }
-
- @Override
- public boolean isSelectedNode() {
- return false;
- }
-
- @Override
- public boolean isFilterAccepted() {
- return m_filterAccepted;
- }
-
- /**
- * do not use this method directly, use {@link ITree#addNodeFilter(ITreeNodeFilter)},
- * {@link ITree#removeNodeFilter(ITreeNodeFilter)}
- */
- @Override
- public void setFilterAccepted(boolean b) {
- if (m_filterAccepted != b) {
- m_filterAccepted = b;
- if (getParentNode() != null) {
- getParentNode().resetFilterCache();
- }
- }
- }
-
- @Override
- public void resetFilterCache() {
- }
-
- @Override
- public ITreeNode resolveVirtualChildNode(ITreeNode node) throws ProcessingException {
- return node;
- }
-
- @Override
- public final ICell getCell() {
- return m_cell;
- }
-
- @Override
- public final Cell getCellForUpdate() {
- return m_cell;
- }
-
- @Override
- public final void decorateCell() {
- }
-
- @Override
- public boolean isLeaf() {
- return false;
- }
-
- @Override
- public void setLeafInternal(boolean b) {
- }
-
- @Override
- public void setLeaf(boolean b) {
- }
-
- @Override
- public boolean isChecked() {
- return false;
- }
-
- @Override
- public void setCheckedInternal(boolean b) {
- }
-
- @Override
- public void setChecked(boolean b) {
- }
-
- @Override
- public boolean isExpanded() {
- return false;
- }
-
- @Override
- public void setExpandedInternal(boolean b) {
- }
-
- @Override
- public boolean isInitialExpanded() {
- return false;
- }
-
- @Override
- public void setInitialExpanded(boolean b) {
- }
-
- @Override
- public void setExpanded(boolean b) {
- }
-
- @Override
- public void setVisiblePermissionInternal(Permission p) {
- }
-
- @Override
- public boolean isVisible() {
- return true;
- }
-
- @Override
- public boolean isVisibleGranted() {
- return true;
- }
-
- @Override
- public void setVisibleInternal(boolean b) {
- }
-
- @Override
- public void setVisibleGrantedInternal(boolean b) {
- }
-
- @Override
- public void setVisiblePermission(Permission p) {
- }
-
- @Override
- public void setVisible(boolean b) {
- }
-
- @Override
- public void setVisibleGranted(boolean b) {
- }
-
- @Override
- public void setEnabledPermissionInternal(Permission p) {
- }
-
- @Override
- public boolean isEnabled() {
- return true;
- }
-
- @Override
- public boolean isEnabledGranted() {
- return true;
- }
-
- @Override
- public void setEnabledInternal(boolean b) {
- }
-
- @Override
- public void setEnabledGrantedInternal(boolean b) {
- }
-
- @Override
- public void setEnabledPermission(Permission p) {
- }
-
- @Override
- public void setEnabled(boolean b) {
- }
-
- @Override
- public void setEnabledGranted(boolean b) {
- }
-
- @Override
- public boolean isChildrenVolatile() {
- return false;
- }
-
- @Override
- public void setChildrenVolatile(boolean childrenVolatile) {
- }
-
- @Override
- public boolean isChildrenDirty() {
- return false;
- }
-
- @Override
- public void setChildrenDirty(boolean dirty) {
- }
-
- @Override
- public Object getPrimaryKey() {
- return null;
- }
-
- @Override
- public void setPrimaryKey(Object key) {
- }
-
- @Override
- public IMenu[] getMenus() {
- return new IMenu[0];
- }
-
- @Override
- public <T extends IMenu> T getMenu(Class<T> menuType) throws ProcessingException {
- return null;
- }
-
- @Override
- public void setMenus(IMenu[] a) {
- }
-
- @Override
- public ITreeNode getParentNode() {
- return m_parentNode;
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public <T extends ITreeNode> T getParentNode(Class<T> type) {
- ITreeNode node = getParentNode();
- if (node != null && type.isAssignableFrom(node.getClass())) {
- return (T) node;
- }
- else {
- return null;
- }
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public <T extends ITreeNode> T getParentNode(Class<T> type, int backCount) {
- ITreeNode node = this;
- while (node != null && backCount > 0) {
- node = node.getParentNode();
- backCount--;
- }
- if (backCount == 0 && node != null && type.isAssignableFrom(node.getClass())) {
- return (T) node;
- }
- else {
- return null;
- }
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public <T extends ITreeNode> T getAncestorNode(Class<T> type) {
- ITreeNode node = getParentNode();
- while (node != null && !type.isAssignableFrom(node.getClass())) {
- node = node.getParentNode();
- }
- return (T) node;
- }
-
- /**
- * do not use this internal method
- */
- @Override
- public void setParentNodeInternal(ITreeNode parent) {
- m_parentNode = parent;
- }
-
- @Override
- public int getChildNodeCount() {
- return 0;
- }
-
- @Override
- public void setChildNodeIndexInternal(int childNodeIndex) {
- m_childNodeIndex = childNodeIndex;
- }
-
- @Override
- public int getChildNodeIndex() {
- return m_childNodeIndex;
- }
-
- @Override
- public ITreeNode[] getFilteredChildNodes() {
- return new ITreeNode[0];
- }
-
- @Override
- public int getTreeLevel() {
- int level = 0;
- ITreeNode parent = getParentNode();
- while (parent != null) {
- level++;
- parent = parent.getParentNode();
- }
- return level;
- }
-
- @Override
- public ITreeNode getChildNode(int childIndex) {
- return null;
- }
-
- @Override
- public ITreeNode[] getChildNodes() {
- return new ITreeNode[0];
- }
-
- @Override
- public ITreeNode findParentNode(Class interfaceType) {
- ITreeNode test = getParentNode();
- while (test != null) {
- if (interfaceType.isInstance(test)) {
- break;
- }
- test = test.getParentNode();
- }
- return test;
- }
-
- @Override
- public void nodeAddedNotify() {
- }
-
- @Override
- public void nodeRemovedNotify() {
- }
-
- @Override
- public boolean isChildrenLoaded() {
- return true;
- }
-
- @Override
- public void setChildrenLoaded(boolean b) {
- }
-
- @Override
- public final void ensureChildrenLoaded() throws ProcessingException {
- }
-
- @Override
- public ITree getTree() {
- return m_tree;
- }
-
- /**
- * do not use this internal method
- */
- @Override
- public void setTreeInternal(ITree tree, boolean includeSubtree) {
- m_tree = tree;
- }
-
- @Override
- public void loadChildren() throws ProcessingException {
- }
-
- @Override
- public void update() {
- getTree().updateNode(this);
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName() + "[" + getCell() + "]";
- }
-
- @Override
- public void cellChanged(ICell cell, int changedBit) {
- }
-
- @Override
- public Object validateValue(ICell cell, Object value) throws ProcessingException {
- return value;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.basic.tree;
+
+import java.security.Permission;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
+import org.eclipse.scout.rt.client.ui.basic.cell.ICell;
+import org.eclipse.scout.rt.client.ui.basic.cell.ICellObserver;
+
+public class VirtualTreeNode implements IVirtualTreeNode, ICellObserver {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(VirtualTreeNode.class);
+
+ private ITree m_tree;
+ private ITreeNode m_parentNode;
+ private ITreeNode m_resolvedNode;
+ private boolean m_filterAccepted;
+ private final Cell m_cell;
+ private int m_childNodeIndex;
+
+ public VirtualTreeNode() {
+ m_cell = new Cell(this);
+ }
+
+ /**
+ * do NOT change this hashCode
+ */
+ @Override
+ public final int hashCode() {
+ return super.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj != null && obj == m_resolvedNode) {
+ return true;
+ }
+ return super.equals(obj);
+ }
+
+ @Override
+ public void initTreeNode() {
+ }
+
+ @Override
+ public ITreeNode getResolvedNode() {
+ return m_resolvedNode;
+ }
+
+ @Override
+ public void setResolvedNode(ITreeNode resolvedNode) {
+ m_resolvedNode = resolvedNode;
+ if (resolvedNode instanceof AbstractTreeNode) {
+ ((AbstractTreeNode) resolvedNode).setHashCode(this.hashCode());
+ }
+ }
+
+ @Override
+ public String getNodeId() {
+ String s = getClass().getName();
+ int i = Math.max(s.lastIndexOf('$'), s.lastIndexOf('.'));
+ s = s.substring(i + 1);
+ return s;
+ }
+
+ @Override
+ public int getStatus() {
+ return STATUS_NON_CHANGED;
+ }
+
+ @Override
+ public void setStatusInternal(int status) {
+ }
+
+ @Override
+ public void setStatus(int status) {
+ }
+
+ @Override
+ public boolean isStatusInserted() {
+ return false;
+ }
+
+ @Override
+ public boolean isStatusUpdated() {
+ return false;
+ }
+
+ @Override
+ public boolean isStatusDeleted() {
+ return false;
+ }
+
+ @Override
+ public boolean isStatusNonchanged() {
+ return true;
+ }
+
+ @Override
+ public boolean isSelectedNode() {
+ return false;
+ }
+
+ @Override
+ public boolean isFilterAccepted() {
+ return m_filterAccepted;
+ }
+
+ /**
+ * do not use this method directly, use {@link ITree#addNodeFilter(ITreeNodeFilter)},
+ * {@link ITree#removeNodeFilter(ITreeNodeFilter)}
+ */
+ @Override
+ public void setFilterAccepted(boolean b) {
+ if (m_filterAccepted != b) {
+ m_filterAccepted = b;
+ if (getParentNode() != null) {
+ getParentNode().resetFilterCache();
+ }
+ }
+ }
+
+ @Override
+ public void resetFilterCache() {
+ }
+
+ @Override
+ public ITreeNode resolveVirtualChildNode(ITreeNode node) throws ProcessingException {
+ return node;
+ }
+
+ @Override
+ public final ICell getCell() {
+ return m_cell;
+ }
+
+ @Override
+ public final Cell getCellForUpdate() {
+ return m_cell;
+ }
+
+ @Override
+ public final void decorateCell() {
+ }
+
+ @Override
+ public boolean isLeaf() {
+ return false;
+ }
+
+ @Override
+ public void setLeafInternal(boolean b) {
+ }
+
+ @Override
+ public void setLeaf(boolean b) {
+ }
+
+ @Override
+ public boolean isChecked() {
+ return false;
+ }
+
+ @Override
+ public void setCheckedInternal(boolean b) {
+ }
+
+ @Override
+ public void setChecked(boolean b) {
+ }
+
+ @Override
+ public boolean isExpanded() {
+ return false;
+ }
+
+ @Override
+ public void setExpandedInternal(boolean b) {
+ }
+
+ @Override
+ public boolean isInitialExpanded() {
+ return false;
+ }
+
+ @Override
+ public void setInitialExpanded(boolean b) {
+ }
+
+ @Override
+ public void setExpanded(boolean b) {
+ }
+
+ @Override
+ public void setVisiblePermissionInternal(Permission p) {
+ }
+
+ @Override
+ public boolean isVisible() {
+ return true;
+ }
+
+ @Override
+ public boolean isVisibleGranted() {
+ return true;
+ }
+
+ @Override
+ public void setVisibleInternal(boolean b) {
+ }
+
+ @Override
+ public void setVisibleGrantedInternal(boolean b) {
+ }
+
+ @Override
+ public void setVisiblePermission(Permission p) {
+ }
+
+ @Override
+ public void setVisible(boolean b) {
+ }
+
+ @Override
+ public void setVisibleGranted(boolean b) {
+ }
+
+ @Override
+ public void setEnabledPermissionInternal(Permission p) {
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return true;
+ }
+
+ @Override
+ public boolean isEnabledGranted() {
+ return true;
+ }
+
+ @Override
+ public void setEnabledInternal(boolean b) {
+ }
+
+ @Override
+ public void setEnabledGrantedInternal(boolean b) {
+ }
+
+ @Override
+ public void setEnabledPermission(Permission p) {
+ }
+
+ @Override
+ public void setEnabled(boolean b) {
+ }
+
+ @Override
+ public void setEnabledGranted(boolean b) {
+ }
+
+ @Override
+ public boolean isChildrenVolatile() {
+ return false;
+ }
+
+ @Override
+ public void setChildrenVolatile(boolean childrenVolatile) {
+ }
+
+ @Override
+ public boolean isChildrenDirty() {
+ return false;
+ }
+
+ @Override
+ public void setChildrenDirty(boolean dirty) {
+ }
+
+ @Override
+ public Object getPrimaryKey() {
+ return null;
+ }
+
+ @Override
+ public void setPrimaryKey(Object key) {
+ }
+
+ @Override
+ public IMenu[] getMenus() {
+ return new IMenu[0];
+ }
+
+ @Override
+ public <T extends IMenu> T getMenu(Class<T> menuType) throws ProcessingException {
+ return null;
+ }
+
+ @Override
+ public void setMenus(IMenu[] a) {
+ }
+
+ @Override
+ public ITreeNode getParentNode() {
+ return m_parentNode;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public <T extends ITreeNode> T getParentNode(Class<T> type) {
+ ITreeNode node = getParentNode();
+ if (node != null && type.isAssignableFrom(node.getClass())) {
+ return (T) node;
+ }
+ else {
+ return null;
+ }
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public <T extends ITreeNode> T getParentNode(Class<T> type, int backCount) {
+ ITreeNode node = this;
+ while (node != null && backCount > 0) {
+ node = node.getParentNode();
+ backCount--;
+ }
+ if (backCount == 0 && node != null && type.isAssignableFrom(node.getClass())) {
+ return (T) node;
+ }
+ else {
+ return null;
+ }
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public <T extends ITreeNode> T getAncestorNode(Class<T> type) {
+ ITreeNode node = getParentNode();
+ while (node != null && !type.isAssignableFrom(node.getClass())) {
+ node = node.getParentNode();
+ }
+ return (T) node;
+ }
+
+ /**
+ * do not use this internal method
+ */
+ @Override
+ public void setParentNodeInternal(ITreeNode parent) {
+ m_parentNode = parent;
+ }
+
+ @Override
+ public int getChildNodeCount() {
+ return 0;
+ }
+
+ @Override
+ public void setChildNodeIndexInternal(int childNodeIndex) {
+ m_childNodeIndex = childNodeIndex;
+ }
+
+ @Override
+ public int getChildNodeIndex() {
+ return m_childNodeIndex;
+ }
+
+ @Override
+ public ITreeNode[] getFilteredChildNodes() {
+ return new ITreeNode[0];
+ }
+
+ @Override
+ public int getTreeLevel() {
+ int level = 0;
+ ITreeNode parent = getParentNode();
+ while (parent != null) {
+ level++;
+ parent = parent.getParentNode();
+ }
+ return level;
+ }
+
+ @Override
+ public ITreeNode getChildNode(int childIndex) {
+ return null;
+ }
+
+ @Override
+ public ITreeNode[] getChildNodes() {
+ return new ITreeNode[0];
+ }
+
+ @Override
+ public ITreeNode findParentNode(Class interfaceType) {
+ ITreeNode test = getParentNode();
+ while (test != null) {
+ if (interfaceType.isInstance(test)) {
+ break;
+ }
+ test = test.getParentNode();
+ }
+ return test;
+ }
+
+ @Override
+ public void nodeAddedNotify() {
+ }
+
+ @Override
+ public void nodeRemovedNotify() {
+ }
+
+ @Override
+ public boolean isChildrenLoaded() {
+ return true;
+ }
+
+ @Override
+ public void setChildrenLoaded(boolean b) {
+ }
+
+ @Override
+ public final void ensureChildrenLoaded() throws ProcessingException {
+ }
+
+ @Override
+ public ITree getTree() {
+ return m_tree;
+ }
+
+ /**
+ * do not use this internal method
+ */
+ @Override
+ public void setTreeInternal(ITree tree, boolean includeSubtree) {
+ m_tree = tree;
+ }
+
+ @Override
+ public void loadChildren() throws ProcessingException {
+ }
+
+ @Override
+ public void update() {
+ getTree().updateNode(this);
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + "[" + getCell() + "]";
+ }
+
+ @Override
+ public void cellChanged(ICell cell, int changedBit) {
+ }
+
+ @Override
+ public Object validateValue(ICell cell, Object value) throws ProcessingException {
+ return value;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/AbstractDesktop.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/AbstractDesktop.java
index fb3fa5b848..23e2c9eec1 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/AbstractDesktop.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/AbstractDesktop.java
@@ -1,1881 +1,1881 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.desktop;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.io.File;
-import java.lang.ref.WeakReference;
-import java.lang.reflect.Array;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.EventListener;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.scout.commons.ConfigurationUtility;
-import org.eclipse.scout.commons.EventListenerList;
-import org.eclipse.scout.commons.annotations.ConfigOperation;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.beans.AbstractPropertyObserver;
-import org.eclipse.scout.commons.exception.IProcessingStatus;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.exception.ProcessingStatus;
-import org.eclipse.scout.commons.holders.Holder;
-import org.eclipse.scout.commons.holders.IHolder;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.services.common.bookmark.internal.BookmarkUtility;
-import org.eclipse.scout.rt.client.ui.DataChangeListener;
-import org.eclipse.scout.rt.client.ui.action.ActionFinder;
-import org.eclipse.scout.rt.client.ui.action.IAction;
-import org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke;
-import org.eclipse.scout.rt.client.ui.action.keystroke.KeyStroke;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.action.tool.IToolButton;
-import org.eclipse.scout.rt.client.ui.action.view.IViewButton;
-import org.eclipse.scout.rt.client.ui.basic.filechooser.IFileChooser;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
-import org.eclipse.scout.rt.client.ui.basic.tree.TreeAdapter;
-import org.eclipse.scout.rt.client.ui.basic.tree.TreeEvent;
-import org.eclipse.scout.rt.client.ui.desktop.navigation.INavigationHistoryService;
-import org.eclipse.scout.rt.client.ui.desktop.outline.AbstractFormToolButton;
-import org.eclipse.scout.rt.client.ui.desktop.outline.AbstractOutlineViewButton;
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutlineTableForm;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.ISearchForm;
-import org.eclipse.scout.rt.client.ui.form.FormEvent;
-import org.eclipse.scout.rt.client.ui.form.FormListener;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.client.ui.form.PrintDevice;
-import org.eclipse.scout.rt.client.ui.form.fields.GridData;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.messagebox.IMessageBox;
-import org.eclipse.scout.rt.client.ui.messagebox.MessageBoxEvent;
-import org.eclipse.scout.rt.client.ui.messagebox.MessageBoxListener;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.services.common.bookmark.Bookmark;
-import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
-import org.eclipse.scout.service.SERVICES;
-
-/**
- * The desktop model (may) consist of
- * <ul>
- * <li>set of available outlines
- * <li>active outline
- * <li>active table view
- * <li>active detail form
- * <li>active search form
- * <li>form stack (swing: dialogs on desktop as {@code JInternalFrame}s; SWT: editors or views)
- * <li>dialog stack of modal and non-modal dialogs (swing: dialogs as {@code JDialog}, {@code JFrame}; SWT: dialogs in a
- * new Shell)
- * <li>active message box stack
- * <li>menubar menus
- * <li>toolbar and viewbar actions
- * </ul>
- * The Eclipse Scout SDK creates a subclass of this class that can be used as
- * initial desktop.
- */
-public abstract class AbstractDesktop extends AbstractPropertyObserver implements IDesktop {
-
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractDesktop.class);
-
- private final IDesktopExtension m_localDesktopExtension;
- private List<IDesktopExtension> m_desktopExtensions;
- private final EventListenerList m_listenerList;
- private final Map<Object, EventListenerList> m_dataChangeListenerList;
- private final IDesktopUIFacade m_uiFacade;
- private IOutline[] m_availableOutlines;
- private IOutline m_outline;
- private boolean m_outlineChanging = false;
- private P_ActiveOutlineListener m_activeOutlineListener;
- private final P_ActivatedFormListener m_activatedFormListener;
- private final LinkedList<WeakReference<IForm>> m_lastActiveFormList;
- private ITable m_pageDetailTable;
- private IOutlineTableForm m_outlineTableForm;
- private boolean m_outlineTableFormVisible;
- private IForm m_pageDetailForm;
- private IForm m_pageSearchForm;
- private final ArrayList<IForm> m_viewStack;
- private final ArrayList<IForm> m_dialogStack;
- private final ArrayList<IMessageBox> m_messageBoxStack;
- private IMenu[] m_menus;
- private IViewButton[] m_viewButtons;
- private IToolButton[] m_toolButtons;
- private boolean m_autoPrefixWildcardForTextSearch;
- private boolean m_desktopInited;
- private boolean m_trayVisible;
-
- /**
- * do not instantiate a new desktop<br>
- * get it via {@code ClientScoutSession.getSession().getModelManager()}
- */
- public AbstractDesktop() {
- m_localDesktopExtension = new P_LocalDesktopExtension();
- m_listenerList = new EventListenerList();
- m_dataChangeListenerList = new HashMap<Object, EventListenerList>();
- m_viewStack = new ArrayList<IForm>();
- m_dialogStack = new ArrayList<IForm>();
- m_messageBoxStack = new ArrayList<IMessageBox>();
- m_uiFacade = new P_UIFacade();
- m_outlineTableFormVisible = true;
- m_activatedFormListener = new P_ActivatedFormListener();
- m_lastActiveFormList = new LinkedList<WeakReference<IForm>>();
- initConfig();
- }
-
- /*
- * Configuration
- */
- /**
- * Configures the title of this desktop. The title is typically used as title for the main application
- * window.
- * <p>
- * Subclasses can override this method. Default is {@code null}.
- *
- * @return the title of this desktop
- */
- @ConfigProperty(ConfigProperty.TEXT)
- @Order(10)
- @ConfigPropertyValue("null")
- protected String getConfiguredTitle() {
- return null;
- }
-
- /**
- * Configures whether this Scout application should be represented within the OS system tray.
- * Representations in the system tray might differ for different operating systems or different UI.
- * A system tray may not be available at all.
- * <p>
- * Subclasses can override this method. Default is {@code false}.
- *
- * @return {@code true} if this application should be visible in the system tray, {@code false} otherwise
- * @see #execAddTrayMenus(List)
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(15)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredTrayVisible() {
- return false;
- }
-
- /**
- * Configures the outlines associated with this desktop. If multiple outlines are configured,
- * there is typically a need to provide some means of switching between different outlines,
- * such as a {@link AbstractOutlineViewButton}.
- * <p>
- * Note that {@linkplain IDesktopExtension desktop extensions} might contribute additional outlines to this desktop.
- * <p>
- * Subclasses can override this method. Default is {@code null}.
- *
- * @return an array of outline type tokens
- * @see IOutline
- */
- @ConfigProperty(ConfigProperty.OUTLINES)
- @Order(20)
- @ConfigPropertyValue("null")
- protected Class<? extends IOutline>[] getConfiguredOutlines() {
- return null;
- }
-
- private Class<? extends IAction>[] getConfiguredActions() {
- Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
- return ConfigurationUtility.filterClasses(dca, IAction.class);
- }
-
- /**
- * Called while this desktop is initialized.
- * <p>
- * Subclasses can override this method. The default does nothing.
- *
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(10)
- protected void execInit() throws ProcessingException {
- }
-
- /**
- * Called after this desktop was opened and displayed on the GUI.
- * <p>
- * Subclasses can override this method. The default does nothing.
- *
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(12)
- protected void execOpened() throws ProcessingException {
- }
-
- /**
- * Called before this desktop is being closed.
- * <p>
- * Subclasses can override this method. The default does nothing.
- *
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(15)
- protected void execClosing() throws ProcessingException {
- }
-
- /**
- * Called after a UI has been attached to this desktop. This desktop must not necessarily be open.
- * <p>
- * Subclasses can override this method. The default does nothing.
- *
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(20)
- protected void execGuiAttached() throws ProcessingException {
- }
-
- /**
- * Called after a UI has been detached from this desktop. This desktop must not necessarily be open.
- * <p>
- * Subclasses can override this method. The default does nothing.
- *
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(25)
- protected void execGuiDetached() throws ProcessingException {
- }
-
- /**
- * Called whenever a new outline has been activated on this desktop.
- * <p>
- * Subclasses can override this method. The default does nothing.
- *
- * @param oldOutline
- * old outline that was active before
- * @param newOutline
- * new outline that is active after the change
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(30)
- protected void execOutlineChanged(IOutline oldOutline, IOutline newOutline) throws ProcessingException {
- }
-
- /**
- * Called whenever a new page has been activated (selected) on this desktop.
- * <p>
- * Subclasses can override this method.<br/>
- * This default implementation {@linkplain #removeForm(IForm) removes} the old form from this desktop and
- * {@linkplain #addForm(IForm) adds} the new form to this desktop.
- *
- * @param oldForm
- * is the search form of the old (not selected anymore) page or {@code null}
- * @param newForm
- * is the search form of the new (selected) page or {@code null}
- * @throws ProcessingException
- */
- @Order(40)
- @ConfigOperation
- protected void execPageSearchFormChanged(IForm oldForm, IForm newForm) throws ProcessingException {
- if (oldForm != null) {
- removeForm(oldForm);
- }
- if (newForm != null) {
- //ticket 89617: make new form height fixed, non-resizable
- GridData gd = newForm.getRootGroupBox().getGridData();
- if (gd.weightY <= 0) {
- gd.weightY = 0;
- newForm.getRootGroupBox().setGridDataInternal(gd);
- }
- addForm(newForm);
- }
- }
-
- /**
- * Called whenever a new page has been activated (selected) on this desktop.
- * <p>
- * Subclasses can override this method.<br/>
- * This default implementation {@linkplain #removeForm(IForm) removes} the old form from this desktop and
- * {@linkplain #addForm(IForm) adds} the new form to this desktop.
- *
- * @param oldForm
- * is the detail form of the old (not selected anymore) page or {@code null}
- * @param newForm
- * is the detail form of the new (selected) page or {@code null}
- * @throws ProcessingException
- */
- @Order(50)
- @ConfigOperation
- protected void execPageDetailFormChanged(IForm oldForm, IForm newForm) throws ProcessingException {
- if (oldForm != null) {
- removeForm(oldForm);
- }
- if (newForm != null) {
- addForm(newForm);
- }
- }
-
- /**
- * Called whenever a new page has been activated (selected) on this desktop.
- * <p>
- * Subclasses can override this method.<br/>
- * This default implementation keeps track of the current outline table form and updates it accordingly (including
- * visibility). See also {@link #getOutlineTableForm()}.
- *
- * @param oldTable
- * is the table of the old (not selected anymore) table page or {@code null}
- * @param newTable
- * is the table of the new (selected) table page or {@code null}
- * @throws ProcessingException
- */
- @Order(60)
- @ConfigOperation
- protected void execPageDetailTableChanged(ITable oldTable, ITable newTable) throws ProcessingException {
- if (m_outlineTableForm != null) {
- m_outlineTableForm.setCurrentTable(newTable);
- }
- setOutlineTableFormVisible(newTable != null);
- }
-
- /**
- * Called after a table page was loaded or reloaded.
- * <p>
- * Subclasses can override this method.<br/>
- * This default implementation minimizes the page search form when data has been found.
- *
- * @param tablePage
- * the table page that has been (re)loaded
- * @throws ProcessingException
- */
- @Order(62)
- @ConfigOperation
- protected void execTablePageLoaded(IPageWithTable<?> tablePage) throws ProcessingException {
- ISearchForm searchForm = tablePage.getSearchFormInternal();
- if (searchForm != null) {
- searchForm.setMinimized(tablePage.getTable().getRowCount() > 0);
- }
- }
-
- /**
- * Called while the tray popup is being built. This method may call {@link #getMenu(Class)} to find an existing
- * menu on this desktop by class type.
- * <p>
- * The (potential) menus added to the {@code menus} list will be post processed. {@link IMenu#prepareAction()} is
- * called on each and then checked if the menu is visible.
- * <p>
- * Subclasses can override this method. The default does nothing.
- *
- * @param menus
- * a live list to add menus to the tray
- * @throws ProcessingException
- */
- @Order(70)
- @ConfigOperation
- protected void execAddTrayMenus(List<IMenu> menus) throws ProcessingException {
- }
-
- public IDesktopExtension[] getDesktopExtensions() {
- return m_desktopExtensions.toArray(new IDesktopExtension[m_desktopExtensions.size()]);
- }
-
- /**
- * @return the special extension that contributes the contents of this desktop itself
- */
- protected IDesktopExtension getLocalDesktopExtension() {
- return m_localDesktopExtension;
- }
-
- protected void initConfig() {
- initDesktopExtensions();
- setTitle(getConfiguredTitle());
- setTrayVisible(getConfiguredTrayVisible());
- propertySupport.setProperty(PROP_KEY_STROKES, new IKeyStroke[0]);
- IDesktopExtension[] extensions = getDesktopExtensions();
- //outlines
- ArrayList<IOutline> outlineList = new ArrayList<IOutline>();
- if (extensions != null) {
- for (IDesktopExtension ext : extensions) {
- try {
- ext.contributeOutlines(outlineList);
- }
- catch (Throwable t) {
- LOG.error("contrinuting outlines by " + ext, t);
- }
- }
- }
- m_availableOutlines = ConfigurationUtility.sortByOrder(outlineList).toArray(new IOutline[outlineList.size()]);
- //actions (keyStroke, menu, viewButton, toolButton)
- ArrayList<IAction> actionList = new ArrayList<IAction>();
- if (extensions != null) {
- for (IDesktopExtension ext : extensions) {
- try {
- ext.contributeActions(actionList);
- }
- catch (Throwable t) {
- LOG.error("contrinuting actions by " + ext, t);
- }
- }
- }
- //extract keystroke hints from menus
- for (IMenu menu : new ActionFinder().findActions(actionList, IMenu.class, true)) {
- if (menu.getKeyStroke() != null) {
- try {
- IKeyStroke ks = new KeyStroke(menu.getKeyStroke(), menu);
- actionList.add(ks);
- }
- catch (Throwable t) {
- LOG.error(null, t);
- }
- }
- }
- //build completed menu, viewButton, toolButton arrays
- List<IMenu> menuList = new ActionFinder().findActions(actionList, IMenu.class, false); // only top level menus
- m_menus = ConfigurationUtility.sortByOrder(menuList).toArray(new IMenu[menuList.size()]);
- List<IViewButton> viewButtonList = new ActionFinder().findActions(actionList, IViewButton.class, false);
- m_viewButtons = ConfigurationUtility.sortByOrder(viewButtonList).toArray(new IViewButton[viewButtonList.size()]);
- List<IToolButton> toolButtonList = new ActionFinder().findActions(actionList, IToolButton.class, false);
- m_toolButtons = ConfigurationUtility.sortByOrder(toolButtonList).toArray(new IToolButton[toolButtonList.size()]);
- //add dynamic keyStrokes
- List<IKeyStroke> ksList = new ActionFinder().findActions(actionList, IKeyStroke.class, true);
- addKeyStrokes(ksList.toArray(new IKeyStroke[ksList.size()]));
- //init outlines
- for (IOutline o : m_availableOutlines) {
- try {
- o.initTree();
- }
- catch (Throwable t) {
- LOG.error(null, t);
- }
- }
- }
-
- private void initDesktopExtensions() {
- m_desktopExtensions = new LinkedList<IDesktopExtension>();
- m_desktopExtensions.add(getLocalDesktopExtension());
-
- injectDesktopExtensions(m_desktopExtensions);
- }
-
- /**
- * Override to provide a set of extensions (modules) that contribute their content to this desktop.
- * <p>
- * The default list contains only the {@link #getLocalDesktopExtension()}
- * </p>
- * <p>
- * The extension that are held by this desktop must call {@link IDesktopExtension#setCoreDesktop(this)} before using
- * the extension. That way the extension can use and access this desktop's methods.
- * </p>
- */
- protected void injectDesktopExtensions(List<IDesktopExtension> desktopExtensions) {
- }
-
- @Override
- public void initDesktop() throws ProcessingException {
- if (!m_desktopInited) {
- m_desktopInited = true;
- //local
- prepareAllMenus();
- //extensions
- IDesktopExtension[] extensions = getDesktopExtensions();
- if (extensions != null) {
- for (IDesktopExtension ext : extensions) {
- try {
- ContributionCommand cc = ext.initDelegate();
- if (cc == ContributionCommand.Stop) {
- break;
- }
- }
- catch (Throwable t) {
- LOG.error("extension " + ext);
- }
- }
- }
- }
- }
-
- @Override
- public boolean isTrayVisible() {
- return m_trayVisible;
- }
-
- @Override
- public void setTrayVisible(boolean b) {
- m_trayVisible = b;
- }
-
- @Override
- public boolean isShowing(IForm form) {
- for (IForm f : m_viewStack) {
- if (f == form) {
- return true;
- }
- }
- for (IForm f : m_dialogStack) {
- if (f == form) {
- return true;
- }
- }
- return false;
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public <T extends IForm> T findForm(Class<T> formType) {
- ArrayList<IForm> list = new ArrayList<IForm>();
- list.addAll(m_viewStack);
- list.addAll(m_dialogStack);
- for (IForm f : list) {
- if (formType.isAssignableFrom(f.getClass())) {
- return (T) f;
- }
- }
- return null;
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public <T extends IOutline> T findOutline(Class<T> outlineType) {
- for (IOutline o : getAvailableOutlines()) {
- if (outlineType.isAssignableFrom(o.getClass())) {
- return (T) o;
- }
- }
- return null;
- }
-
- @Override
- public <T extends IAction> T findAction(Class<T> actionType) {
- return new ActionFinder().findAction(getActions(), actionType);
- }
-
- @Override
- public <T extends IToolButton> T findToolButton(Class<T> toolButtonType) {
- return findAction(toolButtonType);
- }
-
- @Override
- public <T extends IViewButton> T findViewButton(Class<T> viewButtonType) {
- return findAction(viewButtonType);
- }
-
- @Override
- public IFormField getFocusOwner() {
- return fireFindFocusOwner();
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public <T extends IForm> T[] findForms(Class<T> formType) {
- ArrayList<T> resultList = new ArrayList<T>();
- if (formType != null) {
- ArrayList<IForm> list = new ArrayList<IForm>();
- list.addAll(m_viewStack);
- list.addAll(m_dialogStack);
- for (IForm f : list) {
- if (formType.isAssignableFrom(f.getClass())) {
- resultList.add((T) f);
- }
- }
- }
- return resultList.toArray((T[]) Array.newInstance(formType, resultList.size()));
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public <T extends IForm> T findLastActiveForm(Class<T> formType) {
- if (m_lastActiveFormList != null && formType != null) {
- for (WeakReference<IForm> formRef : m_lastActiveFormList) {
- if (formRef.get() != null && formType.isAssignableFrom(formRef.get().getClass())) {
- return (T) formRef.get();
- }
- }
- }
- return null;
- }
-
- @Override
- public <T extends IMenu> T getMenu(Class<? extends T> searchType) {
- return new ActionFinder().findAction(getMenus(), searchType);
- }
-
- @Override
- public IForm[] getViewStack() {
- return m_viewStack.toArray(new IForm[m_viewStack.size()]);
- }
-
- @Override
- public IForm[] getDialogStack() {
- return m_dialogStack.toArray(new IForm[m_dialogStack.size()]);
- }
-
- /**
- * returns all forms except the searchform and the current detail form with
- * the same fully qualified classname and an equal primary key different from
- * null.
- *
- * @param form
- * @return
- */
- @Override
- public IForm[] getSimilarViewForms(IForm form) {
- ArrayList<IForm> forms = new ArrayList<IForm>(3);
- try {
- if (form != null && form.computeExclusiveKey() != null) {
- Object originalKey = form.computeExclusiveKey();
- for (IForm f : m_viewStack) {
- Object candidateKey = f.computeExclusiveKey();
- if (getPageDetailForm() == f || getPageSearchForm() == f) {
- continue;
- }
- else if (candidateKey == null || originalKey == null) {
- continue;
- }
- else {
- if (LOG.isDebugEnabled()) {
- LOG.debug("form: " + candidateKey + " vs " + originalKey);
- }
-
- if (f.getClass().getName().equals(form.getClass().getName()) && originalKey.equals(candidateKey)) {
- forms.add(f);
- }
- }
- }
- }
- }
- catch (ProcessingException e) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- return forms.toArray(new IForm[forms.size()]);
- }
-
- @Override
- public void ensureViewStackVisible() {
- IForm[] viewStack = getViewStack();
- for (IForm form : viewStack) {
- ensureVisible(form);
- }
- }
-
- @Override
- public void ensureVisible(IForm form) {
- if (form != null) {
- if (m_viewStack.contains(form) || m_dialogStack.contains(form)) {
- fireFormEnsureVisible(form);
- }
- }
- }
-
- @Override
- public void addForm(IForm form) {
- //Allow DesktopExtensions to do any modifications on forms before UI is informed
- IDesktopExtension[] extensions = getDesktopExtensions();
- if (extensions != null) {
- final IHolder<IForm> formHolder = new Holder<IForm>(IForm.class, form);
- for (IDesktopExtension ext : extensions) {
- try {
- ContributionCommand cc = ext.customFormModificationDelegate(formHolder);
- if (cc == ContributionCommand.Stop) {
- break;
- }
- }
- catch (ProcessingException e) {
- formHolder.setValue(form);
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- catch (Throwable t) {
- formHolder.setValue(form);
- SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Formmodification error: " + form, t));
- }
- }
- form = formHolder.getValue();
- }
- if (form != null) {
- switch (form.getDisplayHint()) {
- case IForm.DISPLAY_HINT_POPUP_WINDOW:
- case IForm.DISPLAY_HINT_POPUP_DIALOG:
- case IForm.DISPLAY_HINT_DIALOG: {
- if (m_viewStack.remove(form)) {
- fireFormRemoved(form);
- }
- //remove all open popup windows
- if (form.getDisplayHint() == IForm.DISPLAY_HINT_POPUP_WINDOW) {
- for (IForm f : new ArrayList<IForm>(m_dialogStack)) {
- if (f.getDisplayHint() == IForm.DISPLAY_HINT_POPUP_WINDOW) {
- try {
- f.doClose();
- }
- catch (Throwable t) {
- LOG.error("Failed closing popup " + f, t);
- }
- }
- }
- }
- if (!m_dialogStack.contains(form)) {
- m_dialogStack.add(form);
- fireFormAdded(form);
- }
- break;
- }
- case IForm.DISPLAY_HINT_VIEW: {
- if (m_dialogStack.remove(form)) {
- fireFormRemoved(form);
- }
- if (!m_viewStack.contains(form)) {
- m_viewStack.add(form);
- fireFormAdded(form);
- }
- break;
- }
- }
- m_lastActiveFormList.add(new WeakReference<IForm>(form));
- form.addFormListener(m_activatedFormListener);
- }
- }
-
- @Override
- public void removeForm(IForm form) {
- if (form != null) {
- // remove form from last active form list
- if (m_lastActiveFormList != null) {
- for (Iterator<WeakReference<IForm>> it = m_lastActiveFormList.iterator(); it.hasNext();) {
- WeakReference<IForm> formRef = it.next();
- if (formRef.get() == null || form.equals(formRef.get())) {
- it.remove();
- }
- }
- }
- form.removeFormListener(m_activatedFormListener);
- boolean b1 = m_dialogStack.remove(form);
- boolean b2 = m_viewStack.remove(form);
- if (b1 || b2) {
- fireFormRemoved(form);
- }
- }
- }
-
- @Override
- public IMessageBox[] getMessageBoxStack() {
- return m_messageBoxStack.toArray(new IMessageBox[0]);
- }
-
- @Override
- public void addMessageBox(final IMessageBox mb) {
- m_messageBoxStack.add(mb);
- mb.addMessageBoxListener(new MessageBoxListener() {
- @Override
- public void messageBoxChanged(MessageBoxEvent e) {
- switch (e.getType()) {
- case MessageBoxEvent.TYPE_CLOSED: {
- removeMessageBoxInternal(mb);
- }
- }
- }
- });
- fireMessageBoxAdded(mb);
- }
-
- private void removeMessageBoxInternal(IMessageBox mb) {
- m_messageBoxStack.remove(mb);
- }
-
- @Override
- public IOutline[] getAvailableOutlines() {
- return m_availableOutlines;
- }
-
- @Override
- public void setAvailableOutlines(IOutline[] availableOutlines) {
- setOutline((IOutline) null);
- m_availableOutlines = availableOutlines != null ? availableOutlines : new IOutline[0];
- }
-
- @Override
- public IOutline getOutline() {
- return m_outline;
- }
-
- @Override
- public void setOutline(IOutline outline) {
- outline = resolveOutline(outline);
- if (m_outline == outline
- || m_outlineChanging) {
- return;
- }
- synchronized (this) {
- try {
- m_outlineChanging = true;
- if (m_outline != null) {
- IPage oldActivePage = m_outline.getActivePage();
- if (oldActivePage != null) {
- SERVICES.getService(INavigationHistoryService.class).addStep(0, oldActivePage);
- }
- }
- //
- IOutline oldOutline = m_outline;
- if (m_activeOutlineListener != null && oldOutline != null) {
- oldOutline.removeTreeListener(m_activeOutlineListener);
- oldOutline.removePropertyChangeListener(m_activeOutlineListener);
- m_activeOutlineListener = null;
- }
- // set new outline to set facts
- m_outline = outline;
- // deactivate old page
- if (oldOutline != null) {
- oldOutline.clearContextPage();
- }
- //
- if (m_outline != null) {
- m_activeOutlineListener = new P_ActiveOutlineListener();
- m_outline.addTreeListener(m_activeOutlineListener);
- m_outline.addPropertyChangeListener(m_activeOutlineListener);
- }
- // <bsh 2010-10-15>
- // Those three "setXyz(null)" statements used to be called unconditionally. Now, they
- // are only called when the new outline is null. When the new outline is _not_ null, we
- // will override the "null" anyway (see below).
- // This change is needed for the "on/off semantics" of the tool tab buttons to work correctly.
- if (m_outline == null) {
- setPageDetailForm(null);
- setPageDetailTable(null);
- setPageSearchForm(null, true);
- }
- // </bsh>
- fireOutlineChanged(oldOutline, m_outline);
- if (m_outline != null) {
- // reload selected page in case it is marked dirty
- if (m_outline.getActivePage() != null) {
- try {
- m_outline.getActivePage().ensureChildrenLoaded();
- }
- catch (ProcessingException e) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- }
- m_outline.setNodeExpanded(m_outline.getRootNode(), true);
- setPageDetailForm(m_outline.getDetailForm());
- setPageDetailTable(m_outline.getDetailTable());
- setPageSearchForm(m_outline.getSearchForm(), true);
- m_outline.makeActivePageToContextPage();
- IPage newActivePage = m_outline.getActivePage();
- if (newActivePage == null) {
- // if there is no active page, set it now
- if (m_outline.isRootNodeVisible()) {
- m_outline.selectNode(m_outline.getRootNode(), false);
- }
- else {
- ITreeNode[] children = m_outline.getRootNode().getChildNodes();
- if (children.length > 0) {
- for (ITreeNode node : children) {
- if (node.isVisible() && node.isEnabled()) {
- m_outline.selectNode(node, false);
- break;
- }
- }
- }
- }
- newActivePage = m_outline.getActivePage();
- }
- if (newActivePage != null) {
- SERVICES.getService(INavigationHistoryService.class).addStep(0, newActivePage);
- }
- }
- }
- finally {
- m_outlineChanging = false;
- }
- }
- }
-
- private IOutline resolveOutline(IOutline outline) {
- for (IOutline o : getAvailableOutlines()) {
- if (o == outline) {
- return o;
- }
- }
- return null;
- }
-
- @Override
- public void setOutline(Class<? extends IOutline> outlineType) {
- for (IOutline o : getAvailableOutlines()) {
- if (o.getClass() == outlineType) {
- setOutline(o);
- return;
- }
- }
- }
-
- @Override
- public IKeyStroke[] getKeyStrokes() {
- return (IKeyStroke[]) propertySupport.getProperty(PROP_KEY_STROKES);
- }
-
- @Override
- public void setKeyStrokes(IKeyStroke[] ks) {
- if (ks == null) {
- ks = new IKeyStroke[0];
- }
- propertySupport.setProperty(PROP_KEY_STROKES, ks);
- }
-
- @Override
- public void addKeyStrokes(IKeyStroke... keyStrokes) {
- if (keyStrokes != null && keyStrokes.length > 0) {
- HashMap<String, IKeyStroke> map = new HashMap<String, IKeyStroke>();
- for (IKeyStroke ks : getKeyStrokes()) {
- map.put(ks.getKeyStroke(), ks);
- }
- for (IKeyStroke ks : keyStrokes) {
- map.put(ks.getKeyStroke(), ks);
- }
- setKeyStrokes(map.values().toArray(new IKeyStroke[map.size()]));
- }
- }
-
- @Override
- public void removeKeyStrokes(IKeyStroke... keyStrokes) {
- if (keyStrokes != null && keyStrokes.length > 0) {
- HashMap<String, IKeyStroke> map = new HashMap<String, IKeyStroke>();
- for (IKeyStroke ks : getKeyStrokes()) {
- map.put(ks.getKeyStroke(), ks);
- }
- for (IKeyStroke ks : keyStrokes) {
- map.remove(ks.getKeyStroke());
- }
- setKeyStrokes(map.values().toArray(new IKeyStroke[map.size()]));
- }
- }
-
- @Override
- public IMenu[] getMenus() {
- IMenu[] a = new IMenu[m_menus.length];
- System.arraycopy(m_menus, 0, a, 0, a.length);
- return a;
- }
-
- @Override
- public void prepareAllMenus() {
- for (IMenu child : getMenus()) {
- prepareMenuRec(child);
- }
- }
-
- private void prepareMenuRec(IMenu menu) {
- menu.prepareAction();
- for (IMenu child : menu.getChildActions()) {
- prepareMenuRec(child);
- }
- }
-
- @Override
- public IAction[] getActions() {
- IAction[] a = getKeyStrokes();
- IAction[] b = getMenus();
- IAction[] c = getViewButtons();
- IAction[] d = getToolButtons();
- if (a == null) {
- a = new IAction[0];
- }
- if (b == null) {
- b = new IAction[0];
- }
- if (c == null) {
- c = new IAction[0];
- }
- if (d == null) {
- d = new IAction[0];
- }
- IAction[] all = new IAction[a.length + b.length + c.length + d.length];
- int offset = 0;
- System.arraycopy(a, 0, all, offset, a.length);
- offset += a.length;
- System.arraycopy(b, 0, all, offset, b.length);
- offset += b.length;
- System.arraycopy(c, 0, all, offset, c.length);
- offset += c.length;
- System.arraycopy(d, 0, all, offset, d.length);
- return all;
- }
-
- @Override
- public IToolButton[] getToolButtons() {
- IToolButton[] a = new IToolButton[m_toolButtons.length];
- System.arraycopy(m_toolButtons, 0, a, 0, a.length);
- return a;
- }
-
- @Override
- public IViewButton[] getViewButtons() {
- IViewButton[] a = new IViewButton[m_viewButtons.length];
- System.arraycopy(m_viewButtons, 0, a, 0, a.length);
- return a;
- }
-
- @Override
- public IForm getPageDetailForm() {
- return m_pageDetailForm;
- }
-
- @Override
- public void setPageDetailForm(IForm f) {
- if (m_pageDetailForm != f) {
- IForm oldForm = m_pageDetailForm;
- m_pageDetailForm = f;
- //extensions
- IDesktopExtension[] extensions = getDesktopExtensions();
- if (extensions != null) {
- for (IDesktopExtension ext : extensions) {
- try {
- ContributionCommand cc = ext.pageDetailFormChangedDelegate(oldForm, m_pageDetailForm);
- if (cc == ContributionCommand.Stop) {
- break;
- }
- }
- catch (Throwable t) {
- LOG.error("extension " + ext, t);
- }
- }
- }
- }
- }
-
- @Override
- public IForm getPageSearchForm() {
- return m_pageSearchForm;
- }
-
- @Override
- public void setPageSearchForm(IForm f) {
- setPageSearchForm(f, false);
- }
-
- public void setPageSearchForm(IForm f, boolean force) {
- if (force || m_pageSearchForm != f) {
- IForm oldForm = m_pageSearchForm;
- m_pageSearchForm = f;
- //extensions
- IDesktopExtension[] extensions = getDesktopExtensions();
- if (extensions != null) {
- for (IDesktopExtension ext : extensions) {
- try {
- ContributionCommand cc = ext.pageSearchFormChangedDelegate(oldForm, m_pageSearchForm);
- if (cc == ContributionCommand.Stop) {
- break;
- }
- }
- catch (Throwable t) {
- LOG.error("extension " + ext, t);
- }
- }
- }
- }
- }
-
- @Override
- public IOutlineTableForm getOutlineTableForm() {
- return m_outlineTableForm;
- }
-
- @Override
- public void setOutlineTableForm(IOutlineTableForm f) {
- if (f != m_outlineTableForm) {
- if (m_outlineTableForm != null) {
- removeForm(m_outlineTableForm);
- }
- m_outlineTableForm = f;
- if (m_outlineTableForm != null) {
- m_outlineTableForm.setCurrentTable(getPageDetailTable());
- setOutlineTableFormVisible(getPageDetailTable() != null);
- }
- if (m_outlineTableForm != null && m_outlineTableFormVisible) {
- addForm(m_outlineTableForm);
- }
- }
- }
-
- @Override
- public boolean isOutlineTableFormVisible() {
- return m_outlineTableFormVisible;
- }
-
- @Override
- public void setOutlineTableFormVisible(boolean b) {
- if (m_outlineTableFormVisible != b) {
- m_outlineTableFormVisible = b;
- if (m_outlineTableForm != null) {
- if (m_outlineTableFormVisible) {
- addForm(m_outlineTableForm);
- }
- else {
- removeForm(m_outlineTableForm);
- }
- }
- }
- }
-
- @Override
- public ITable getPageDetailTable() {
- return m_pageDetailTable;
- }
-
- @Override
- public void setPageDetailTable(ITable t) {
- if (m_pageDetailTable != t) {
- ITable oldTable = m_pageDetailTable;
- m_pageDetailTable = t;
- //extensions
- IDesktopExtension[] extensions = getDesktopExtensions();
- if (extensions != null) {
- for (IDesktopExtension ext : extensions) {
- try {
- ContributionCommand cc = ext.pageDetailTableChangedDelegate(oldTable, m_pageDetailTable);
- if (cc == ContributionCommand.Stop) {
- break;
- }
- }
- catch (Throwable x) {
- LOG.error("extension " + ext, x);
- }
- }
- }
- }
- }
-
- @Override
- public String getTitle() {
- return propertySupport.getPropertyString(PROP_TITLE);
- }
-
- @Override
- public void setTitle(String s) {
- propertySupport.setPropertyString(PROP_TITLE, s);
- }
-
- @Override
- public IProcessingStatus getStatus() {
- return (IProcessingStatus) propertySupport.getProperty(PROP_STATUS);
- }
-
- @Override
- public void setStatus(IProcessingStatus status) {
- propertySupport.setProperty(PROP_STATUS, status);
- }
-
- @Override
- public void setStatusText(String s) {
- if (s != null) {
- setStatus(new ProcessingStatus(s, null, 0, IProcessingStatus.INFO));
- }
- else {
- setStatus(null);
- }
- }
-
- @Override
- public void printDesktop(PrintDevice device, Map<String, Object> parameters) {
- try {
- firePrint(device, parameters);
- }
- catch (ProcessingException e) {
- e.addContextMessage(ScoutTexts.get("FormPrint") + " " + getTitle());
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- }
-
- @Override
- public void addFileChooser(IFileChooser fc) {
- fireFileChooserAdded(fc);
- }
-
- @Override
- public void openBrowserWindow(String path) {
- fireOpenBrowserWindow(path);
- }
-
- @Override
- public boolean isAutoPrefixWildcardForTextSearch() {
- return m_autoPrefixWildcardForTextSearch;
- }
-
- @Override
- public void setAutoPrefixWildcardForTextSearch(boolean b) {
- m_autoPrefixWildcardForTextSearch = b;
- }
-
- @Override
- public boolean isOpened() {
- return propertySupport.getPropertyBool(PROP_OPENED);
- }
-
- private void setOpenedInternal(boolean b) {
- propertySupport.setPropertyBool(PROP_OPENED, b);
- }
-
- private void setGuiAvailableInternal(boolean guiAvailable) {
- propertySupport.setPropertyBool(PROP_GUI_AVAILABLE, guiAvailable);
- }
-
- @Override
- public boolean isGuiAvailable() {
- return propertySupport.getPropertyBool(PROP_GUI_AVAILABLE);
- }
-
- @Override
- public void addDesktopListener(DesktopListener l) {
- m_listenerList.add(DesktopListener.class, l);
- }
-
- @Override
- public void removeDesktopListener(DesktopListener l) {
- m_listenerList.remove(DesktopListener.class, l);
- }
-
- @Override
- public void addDataChangeListener(DataChangeListener listener, Object... dataTypes) {
- if (dataTypes == null || dataTypes.length == 0) {
- EventListenerList list = m_dataChangeListenerList.get(null);
- if (list == null) {
- list = new EventListenerList();
- m_dataChangeListenerList.put(null, list);
- }
- list.add(DataChangeListener.class, listener);
- }
- else {
- for (Object dataType : dataTypes) {
- if (dataType != null) {
- EventListenerList list = m_dataChangeListenerList.get(dataType);
- if (list == null) {
- list = new EventListenerList();
- m_dataChangeListenerList.put(dataType, list);
- }
- list.add(DataChangeListener.class, listener);
- }
- }
- }
- }
-
- @Override
- public void removeDataChangeListener(DataChangeListener listener, Object... dataTypes) {
- if (dataTypes == null || dataTypes.length == 0) {
- for (Iterator<EventListenerList> it = m_dataChangeListenerList.values().iterator(); it.hasNext();) {
- EventListenerList list = it.next();
- list.remove(DataChangeListener.class, listener);
- if (list.getListenerCount(DataChangeListener.class) == 0) {
- it.remove();
- }
- }
- }
- else {
- for (Object dataType : dataTypes) {
- if (dataType != null) {
- EventListenerList list = m_dataChangeListenerList.get(dataType);
- if (list != null) {
- list.remove(DataChangeListener.class, listener);
- if (list.getListenerCount(DataChangeListener.class) == 0) {
- m_dataChangeListenerList.remove(dataType);
- }
- }
- }
- }
- }
- }
-
- @Override
- public void dataChanged(Object... dataTypes) {
- if (dataTypes != null && dataTypes.length > 0) {
- HashMap<DataChangeListener, Set<Object>> map = new HashMap<DataChangeListener, Set<Object>>();
- for (Object dataType : dataTypes) {
- if (dataType != null) {
- EventListenerList list = m_dataChangeListenerList.get(dataType);
- if (list != null) {
- for (DataChangeListener listener : list.getListeners(DataChangeListener.class)) {
- Set<Object> typeSet = map.get(listener);
- if (typeSet == null) {
- typeSet = new HashSet<Object>();
- map.put(listener, typeSet);
- }
- typeSet.add(dataType);
- }
- }
- }
- }
- for (Map.Entry<DataChangeListener, Set<Object>> e : map.entrySet()) {
- DataChangeListener listener = e.getKey();
- Set<Object> typeSet = e.getValue();
- try {
- listener.dataChanged(typeSet.toArray());
- }
- catch (Throwable t) {
- LOG.error(null, t);
- }
- }
- }
- }
-
- private void fireDesktopClosed() {
- DesktopEvent e = new DesktopEvent(this, DesktopEvent.TYPE_DESKTOP_CLOSED);
- fireDesktopEvent(e);
- }
-
- private void firePrint(PrintDevice device, Map<String, Object> parameters) throws ProcessingException {
- fireDesktopEvent(new DesktopEvent(this, DesktopEvent.TYPE_PRINT, device, parameters));
- }
-
- private IMenu[] fireTrayPopup() {
- DesktopEvent e = new DesktopEvent(this, DesktopEvent.TYPE_TRAY_POPUP);
- // single observer for exec callback
- addLocalPopupMenus(e);
- fireDesktopEvent(e);
- return e.getPopupMenus();
- }
-
- /**
- * @param printedFile
- */
- private void fireDesktopPrinted(File printedFile) {
- DesktopEvent e = new DesktopEvent(this, DesktopEvent.TYPE_PRINTED, printedFile);
- fireDesktopEvent(e);
- }
-
- private void fireOutlineChanged(IOutline oldOutline, IOutline newOutline) {
- if (oldOutline != newOutline) {
- //extensions
- IDesktopExtension[] extensions = getDesktopExtensions();
- if (extensions != null) {
- for (IDesktopExtension ext : extensions) {
- try {
- ContributionCommand cc = ext.outlineChangedDelegate(oldOutline, newOutline);
- if (cc == ContributionCommand.Stop) {
- break;
- }
- }
- catch (ProcessingException e) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- catch (Throwable t) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException(oldOutline + " -> " + newOutline, t));
- }
- }
- }
- }
- // fire
- DesktopEvent e = new DesktopEvent(this, DesktopEvent.TYPE_OUTLINE_CHANGED, newOutline);
- fireDesktopEvent(e);
- }
-
- private void fireFormAdded(IForm form) {
- DesktopEvent e = new DesktopEvent(this, DesktopEvent.TYPE_FORM_ADDED, form);
- fireDesktopEvent(e);
- }
-
- private void fireFormEnsureVisible(IForm form) {
- DesktopEvent e = new DesktopEvent(this, DesktopEvent.TYPE_FORM_ENSURE_VISIBLE, form);
- fireDesktopEvent(e);
- }
-
- private void fireFormRemoved(IForm form) {
- DesktopEvent e = new DesktopEvent(this, DesktopEvent.TYPE_FORM_REMOVED, form);
- fireDesktopEvent(e);
- }
-
- private void fireMessageBoxAdded(IMessageBox mb) {
- DesktopEvent e = new DesktopEvent(this, DesktopEvent.TYPE_MESSAGE_BOX_ADDED, mb);
- fireDesktopEvent(e);
- }
-
- private void fireFileChooserAdded(IFileChooser fc) {
- DesktopEvent e = new DesktopEvent(this, DesktopEvent.TYPE_FILE_CHOOSER_ADDED, fc);
- fireDesktopEvent(e);
- }
-
- private void fireOpenBrowserWindow(String path) {
- DesktopEvent e = new DesktopEvent(this, DesktopEvent.TYPE_OPEN_BROWSER_WINDOW, path);
- fireDesktopEvent(e);
- }
-
- private IFormField fireFindFocusOwner() {
- DesktopEvent e = new DesktopEvent(this, DesktopEvent.TYPE_FIND_FOCUS_OWNER);
- fireDesktopEvent(e);
- return e.getFocusedField();
- }
-
- // main handler
- private void fireDesktopEvent(DesktopEvent e) {
- EventListener[] listeners = m_listenerList.getListeners(DesktopListener.class);
- if (listeners != null && listeners.length > 0) {
- for (EventListener element : listeners) {
- try {
- ((DesktopListener) element).desktopChanged(e);
- }
- catch (Throwable t) {
- LOG.error(null, t);
- }
- }
- }
- }
-
- private void addLocalPopupMenus(DesktopEvent event) {
- try {
- ArrayList<IMenu> list = new ArrayList<IMenu>();
- //extensions
- IDesktopExtension[] extensions = getDesktopExtensions();
- if (extensions != null) {
- for (IDesktopExtension ext : extensions) {
- try {
- ContributionCommand cc = ext.addTrayMenusDelegate(list);
- if (cc == ContributionCommand.Stop) {
- break;
- }
- }
- catch (Throwable t) {
- LOG.error("extension " + ext, t);
- }
- }
- }
- for (IMenu m : list) {
- if (m != null) {
- m.prepareAction();
- }
- }
- for (IMenu m : list) {
- if (m != null && m.isVisible()) {
- event.addPopupMenu(m);
- }
- }
- }
- catch (Throwable t) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Unexpected", t));
- }
- }
-
- @Override
- public void activateBookmark(Bookmark bm, boolean forceReload) throws ProcessingException {
- BookmarkUtility.activateBookmark(this, bm, forceReload);
- }
-
- @Override
- public Bookmark createBookmark() throws ProcessingException {
- return BookmarkUtility.createBookmark(this);
- }
-
- @Override
- public Bookmark createBookmark(IPage page) throws ProcessingException {
- return BookmarkUtility.createBookmark(page);
- }
-
- @Override
- public void refreshPages(Class... pageTypes) {
- for (IOutline outline : getAvailableOutlines()) {
- outline.refreshPages(pageTypes);
- }
- }
-
- @Override
- public void releaseUnusedPages() {
- for (IOutline outline : getAvailableOutlines()) {
- outline.releaseUnusedPages();
- }
- }
-
- @Override
- public void afterTablePageLoaded(IPageWithTable<?> tablePage) throws ProcessingException {
- //extensions
- IDesktopExtension[] extensions = getDesktopExtensions();
- if (extensions != null) {
- for (IDesktopExtension ext : extensions) {
- try {
- ContributionCommand cc = ext.tablePageLoadedDelegate(tablePage);
- if (cc == ContributionCommand.Stop) {
- break;
- }
- }
- catch (Throwable t) {
- LOG.error("extension " + ext, t);
- }
- }
- }
- }
-
- @Override
- public void closeInternal() throws ProcessingException {
- List<IForm> openForms = new ArrayList<IForm>();
- // remove views
- for (IForm view : getViewStack()) {
- removeForm(view);
- openForms.add(view);
- }
- // remove forms
- for (IForm dialog : getDialogStack()) {
- removeForm(dialog);
- openForms.add(dialog);
- }
- //extensions
- IDesktopExtension[] extensions = getDesktopExtensions();
- if (extensions != null) {
- for (IDesktopExtension ext : extensions) {
- try {
- ContributionCommand cc = ext.desktopClosingDelegate();
- if (cc == ContributionCommand.Stop) {
- break;
- }
- }
- catch (Throwable t) {
- LOG.error("extension " + ext, t);
- }
- }
- }
-
- // gather tool button forms
- for (IToolButton toolButton : getToolButtons()) {
- if (toolButton instanceof AbstractFormToolButton) {
- AbstractFormToolButton<?> formToolButton = (AbstractFormToolButton<?>) toolButton;
- IForm form = formToolButton.getForm();
- if (form != null) {
- openForms.add(form);
- formToolButton.setForm(null);
- }
- }
- }
-
- // close open forms
- for (IForm form : openForms) {
- if (form != null) {
- try {
- form.doClose();
- }
- catch (ProcessingException e) {
- LOG.error("Exception while closing form", e);
- }
- }
- }
-
- // outlines
- for (IOutline outline : getAvailableOutlines()) {
- outline.removeAllChildNodes(outline.getRootNode());
- outline.disposeTree();
- }
-
- fireDesktopClosed();
- }
-
- public boolean runMenu(Class<? extends IMenu> menuType) throws ProcessingException {
- for (IMenu m : getMenus()) {
- if (runMenuRec(m, menuType)) {
- return true;
- }
- }
- return false;
- }
-
- private boolean runMenuRec(IMenu m, Class<? extends IMenu> menuType) throws ProcessingException {
- if (m.getClass() == menuType) {
- m.prepareAction();
- if (m.isVisible() && m.isEnabled()) {
- m.doAction();
- return true;
- }
- else {
- return false;
- }
- }
- // children
- for (IMenu c : m.getChildActions()) {
- if (runMenuRec(c, menuType)) {
- return true;
- }
- }
- return false;
- }
-
- @Override
- public IDesktopUIFacade getUIFacade() {
- return m_uiFacade;
- }
-
- /**
- * local desktop extension that calls local exec methods and returns local contributions in this class itself
- */
- private class P_LocalDesktopExtension implements IDesktopExtension {
- @Override
- public IDesktop getCoreDesktop() {
- return AbstractDesktop.this;
- }
-
- @Override
- public void setCoreDesktop(IDesktop desktop) {
- //nop
- }
-
- @Override
- public void contributeOutlines(Collection<IOutline> outlines) {
- Class<?>[] a = getConfiguredOutlines();
- if (a != null) {
- for (Class<?> element : a) {
- try {
- IOutline o = (IOutline) element.newInstance();
- outlines.add(o);
- }
- catch (Throwable t) {
- LOG.error("adding outline " + element, t);
- }
- }
- }
- }
-
- @Override
- public void contributeActions(Collection<IAction> actions) {
- Class<? extends IAction>[] actionArray = getConfiguredActions();
- for (Class<? extends IAction> element : actionArray) {
- try {
- IAction tool = ConfigurationUtility.newInnerInstance(AbstractDesktop.this, element);
- actions.add(tool);
- }
- catch (Exception e) {
- LOG.error("adding action " + element, e);
- }
- }
- }
-
- @Override
- public ContributionCommand initDelegate() throws ProcessingException {
- execInit();
- return ContributionCommand.Continue;
- }
-
- @Override
- public ContributionCommand desktopOpenedDelegate() throws ProcessingException {
- execOpened();
- return ContributionCommand.Continue;
- }
-
- @Override
- public ContributionCommand desktopClosingDelegate() throws ProcessingException {
- execClosing();
- return ContributionCommand.Continue;
- }
-
- @Override
- public ContributionCommand guiAttachedDelegate() throws ProcessingException {
- execGuiAttached();
- return ContributionCommand.Continue;
- }
-
- @Override
- public ContributionCommand guiDetachedDelegate() throws ProcessingException {
- execGuiDetached();
- return ContributionCommand.Continue;
- }
-
- @Override
- public ContributionCommand outlineChangedDelegate(IOutline oldOutline, IOutline newOutline) throws ProcessingException {
- execOutlineChanged(oldOutline, newOutline);
- return ContributionCommand.Continue;
- }
-
- @Override
- public ContributionCommand customFormModificationDelegate(IHolder<IForm> formHolder) throws ProcessingException {
- return ContributionCommand.Continue;
- }
-
- @Override
- public ContributionCommand pageSearchFormChangedDelegate(IForm oldForm, IForm newForm) throws ProcessingException {
- execPageSearchFormChanged(oldForm, newForm);
- return ContributionCommand.Continue;
- }
-
- @Override
- public ContributionCommand pageDetailFormChangedDelegate(IForm oldForm, IForm newForm) throws ProcessingException {
- execPageDetailFormChanged(oldForm, newForm);
- return ContributionCommand.Continue;
- }
-
- @Override
- public ContributionCommand pageDetailTableChangedDelegate(ITable oldTable, ITable newTable) throws ProcessingException {
- execPageDetailTableChanged(oldTable, newTable);
- return ContributionCommand.Continue;
- }
-
- @Override
- public ContributionCommand tablePageLoadedDelegate(IPageWithTable<?> tablePage) throws ProcessingException {
- execTablePageLoaded(tablePage);
- return ContributionCommand.Continue;
- }
-
- @Override
- public ContributionCommand addTrayMenusDelegate(List<IMenu> menus) throws ProcessingException {
- execAddTrayMenus(menus);
- return ContributionCommand.Continue;
- }
- }
-
- private class P_UIFacade implements IDesktopUIFacade {
-
- @Override
- public void fireGuiAttached() {
- setGuiAvailableInternal(true);
- //extensions
- IDesktopExtension[] extensions = getDesktopExtensions();
- if (extensions != null) {
- for (IDesktopExtension ext : extensions) {
- try {
- ContributionCommand cc = ext.guiAttachedDelegate();
- if (cc == ContributionCommand.Stop) {
- break;
- }
- }
- catch (ProcessingException e) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- catch (Throwable t) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Unexpected by " + ext, t));
- }
- }
- }
- }
-
- @Override
- public void fireGuiDetached() {
- setGuiAvailableInternal(false);
- //extensions
- IDesktopExtension[] extensions = getDesktopExtensions();
- if (extensions != null) {
- for (IDesktopExtension ext : extensions) {
- try {
- ContributionCommand cc = ext.guiDetachedDelegate();
- if (cc == ContributionCommand.Stop) {
- break;
- }
- }
- catch (ProcessingException e) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- catch (Throwable t) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Unexpected by " + ext, t));
- }
- }
- }
- }
-
- @Override
- public void fireDesktopOpenedFromUI() {
- setOpenedInternal(true);
- //extensions
- IDesktopExtension[] extensions = getDesktopExtensions();
- if (extensions != null) {
- for (IDesktopExtension ext : extensions) {
- try {
- ContributionCommand cc = ext.desktopOpenedDelegate();
- if (cc == ContributionCommand.Stop) {
- break;
- }
- }
- catch (ProcessingException e) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- catch (Throwable t) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Unexpected by " + ext, t));
- }
- }
- }
- }
-
- @Override
- public void fireDesktopClosingFromUI() {
- setOpenedInternal(false);
- ClientSyncJob.getCurrentSession().stopSession();
- }
-
- @Override
- public IMenu[] fireTrayPopupFromUI() {
- return fireTrayPopup();
- }
-
- @Override
- public void fireDesktopPrintedFromUI(File printedFile) {
- fireDesktopPrinted(printedFile);
- }
-
- }
-
- private class P_ActiveOutlineListener extends TreeAdapter implements PropertyChangeListener {
- @Override
- public void treeChanged(TreeEvent e) {
- switch (e.getType()) {
- case TreeEvent.TYPE_BEFORE_NODES_SELECTED: {
- if (e.getDeselectedNode() instanceof IPage) {
- IPage deselectedPage = (IPage) e.getDeselectedNode();
- SERVICES.getService(INavigationHistoryService.class).addStep(0, deselectedPage);
- }
- break;
- }
- case TreeEvent.TYPE_NODES_SELECTED: {
- IPage page = m_outline.getActivePage();
- if (page != null) {
- SERVICES.getService(INavigationHistoryService.class).addStep(0, page);
- }
- try {
- ClientSyncJob.getCurrentSession().getMemoryPolicy().afterOutlineSelectionChanged(AbstractDesktop.this);
- }
- catch (Throwable t) {
- LOG.warn("MemoryPolicy.afterOutlineSelectionChanged", t);
- }
- break;
- }
- }
- }
-
- @Override
- public void propertyChange(PropertyChangeEvent e) {
- if (e.getPropertyName().equals(IOutline.PROP_DETAIL_FORM)) {
- setPageDetailForm(((IOutline) e.getSource()).getDetailForm());
- }
- else if (e.getPropertyName().equals(IOutline.PROP_DETAIL_TABLE)) {
- setPageDetailTable(((IOutline) e.getSource()).getDetailTable());
- }
- else if (e.getPropertyName().equals(IOutline.PROP_SEARCH_FORM)) {
- setPageSearchForm(((IOutline) e.getSource()).getSearchForm());
- }
- }
- }
-
- private class P_ActivatedFormListener implements FormListener {
- @Override
- public void formChanged(FormEvent e) throws ProcessingException {
- if (e.getType() != FormEvent.TYPE_ACTIVATED) {
- return;
- }
- // remove garbage collected references and the one of the given form event
- for (Iterator<WeakReference<IForm>> it = m_lastActiveFormList.iterator(); it.hasNext();) {
- WeakReference<IForm> formRef = it.next();
- if (formRef.get() == null || formRef.get().equals(e.getForm())) {
- it.remove();
- }
- }
-
- // add changed form at the beginning -> last activated form
- m_lastActiveFormList.add(0, new WeakReference<IForm>(e.getForm()));
- }
- }
-
- @Override
- public void changeVisibilityAfterOfflineSwitch() {
- return;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.desktop;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.io.File;
+import java.lang.ref.WeakReference;
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.EventListener;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.scout.commons.ConfigurationUtility;
+import org.eclipse.scout.commons.EventListenerList;
+import org.eclipse.scout.commons.annotations.ConfigOperation;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.beans.AbstractPropertyObserver;
+import org.eclipse.scout.commons.exception.IProcessingStatus;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.exception.ProcessingStatus;
+import org.eclipse.scout.commons.holders.Holder;
+import org.eclipse.scout.commons.holders.IHolder;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.services.common.bookmark.internal.BookmarkUtility;
+import org.eclipse.scout.rt.client.ui.DataChangeListener;
+import org.eclipse.scout.rt.client.ui.action.ActionFinder;
+import org.eclipse.scout.rt.client.ui.action.IAction;
+import org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke;
+import org.eclipse.scout.rt.client.ui.action.keystroke.KeyStroke;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.action.tool.IToolButton;
+import org.eclipse.scout.rt.client.ui.action.view.IViewButton;
+import org.eclipse.scout.rt.client.ui.basic.filechooser.IFileChooser;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
+import org.eclipse.scout.rt.client.ui.basic.tree.TreeAdapter;
+import org.eclipse.scout.rt.client.ui.basic.tree.TreeEvent;
+import org.eclipse.scout.rt.client.ui.desktop.navigation.INavigationHistoryService;
+import org.eclipse.scout.rt.client.ui.desktop.outline.AbstractFormToolButton;
+import org.eclipse.scout.rt.client.ui.desktop.outline.AbstractOutlineViewButton;
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutlineTableForm;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.ISearchForm;
+import org.eclipse.scout.rt.client.ui.form.FormEvent;
+import org.eclipse.scout.rt.client.ui.form.FormListener;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.client.ui.form.PrintDevice;
+import org.eclipse.scout.rt.client.ui.form.fields.GridData;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.messagebox.IMessageBox;
+import org.eclipse.scout.rt.client.ui.messagebox.MessageBoxEvent;
+import org.eclipse.scout.rt.client.ui.messagebox.MessageBoxListener;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.services.common.bookmark.Bookmark;
+import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
+import org.eclipse.scout.service.SERVICES;
+
+/**
+ * The desktop model (may) consist of
+ * <ul>
+ * <li>set of available outlines
+ * <li>active outline
+ * <li>active table view
+ * <li>active detail form
+ * <li>active search form
+ * <li>form stack (swing: dialogs on desktop as {@code JInternalFrame}s; SWT: editors or views)
+ * <li>dialog stack of modal and non-modal dialogs (swing: dialogs as {@code JDialog}, {@code JFrame}; SWT: dialogs in a
+ * new Shell)
+ * <li>active message box stack
+ * <li>menubar menus
+ * <li>toolbar and viewbar actions
+ * </ul>
+ * The Eclipse Scout SDK creates a subclass of this class that can be used as
+ * initial desktop.
+ */
+public abstract class AbstractDesktop extends AbstractPropertyObserver implements IDesktop {
+
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractDesktop.class);
+
+ private final IDesktopExtension m_localDesktopExtension;
+ private List<IDesktopExtension> m_desktopExtensions;
+ private final EventListenerList m_listenerList;
+ private final Map<Object, EventListenerList> m_dataChangeListenerList;
+ private final IDesktopUIFacade m_uiFacade;
+ private IOutline[] m_availableOutlines;
+ private IOutline m_outline;
+ private boolean m_outlineChanging = false;
+ private P_ActiveOutlineListener m_activeOutlineListener;
+ private final P_ActivatedFormListener m_activatedFormListener;
+ private final LinkedList<WeakReference<IForm>> m_lastActiveFormList;
+ private ITable m_pageDetailTable;
+ private IOutlineTableForm m_outlineTableForm;
+ private boolean m_outlineTableFormVisible;
+ private IForm m_pageDetailForm;
+ private IForm m_pageSearchForm;
+ private final ArrayList<IForm> m_viewStack;
+ private final ArrayList<IForm> m_dialogStack;
+ private final ArrayList<IMessageBox> m_messageBoxStack;
+ private IMenu[] m_menus;
+ private IViewButton[] m_viewButtons;
+ private IToolButton[] m_toolButtons;
+ private boolean m_autoPrefixWildcardForTextSearch;
+ private boolean m_desktopInited;
+ private boolean m_trayVisible;
+
+ /**
+ * do not instantiate a new desktop<br>
+ * get it via {@code ClientScoutSession.getSession().getModelManager()}
+ */
+ public AbstractDesktop() {
+ m_localDesktopExtension = new P_LocalDesktopExtension();
+ m_listenerList = new EventListenerList();
+ m_dataChangeListenerList = new HashMap<Object, EventListenerList>();
+ m_viewStack = new ArrayList<IForm>();
+ m_dialogStack = new ArrayList<IForm>();
+ m_messageBoxStack = new ArrayList<IMessageBox>();
+ m_uiFacade = new P_UIFacade();
+ m_outlineTableFormVisible = true;
+ m_activatedFormListener = new P_ActivatedFormListener();
+ m_lastActiveFormList = new LinkedList<WeakReference<IForm>>();
+ initConfig();
+ }
+
+ /*
+ * Configuration
+ */
+ /**
+ * Configures the title of this desktop. The title is typically used as title for the main application
+ * window.
+ * <p>
+ * Subclasses can override this method. Default is {@code null}.
+ *
+ * @return the title of this desktop
+ */
+ @ConfigProperty(ConfigProperty.TEXT)
+ @Order(10)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredTitle() {
+ return null;
+ }
+
+ /**
+ * Configures whether this Scout application should be represented within the OS system tray.
+ * Representations in the system tray might differ for different operating systems or different UI.
+ * A system tray may not be available at all.
+ * <p>
+ * Subclasses can override this method. Default is {@code false}.
+ *
+ * @return {@code true} if this application should be visible in the system tray, {@code false} otherwise
+ * @see #execAddTrayMenus(List)
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(15)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredTrayVisible() {
+ return false;
+ }
+
+ /**
+ * Configures the outlines associated with this desktop. If multiple outlines are configured,
+ * there is typically a need to provide some means of switching between different outlines,
+ * such as a {@link AbstractOutlineViewButton}.
+ * <p>
+ * Note that {@linkplain IDesktopExtension desktop extensions} might contribute additional outlines to this desktop.
+ * <p>
+ * Subclasses can override this method. Default is {@code null}.
+ *
+ * @return an array of outline type tokens
+ * @see IOutline
+ */
+ @ConfigProperty(ConfigProperty.OUTLINES)
+ @Order(20)
+ @ConfigPropertyValue("null")
+ protected Class<? extends IOutline>[] getConfiguredOutlines() {
+ return null;
+ }
+
+ private Class<? extends IAction>[] getConfiguredActions() {
+ Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
+ return ConfigurationUtility.filterClasses(dca, IAction.class);
+ }
+
+ /**
+ * Called while this desktop is initialized.
+ * <p>
+ * Subclasses can override this method. The default does nothing.
+ *
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(10)
+ protected void execInit() throws ProcessingException {
+ }
+
+ /**
+ * Called after this desktop was opened and displayed on the GUI.
+ * <p>
+ * Subclasses can override this method. The default does nothing.
+ *
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(12)
+ protected void execOpened() throws ProcessingException {
+ }
+
+ /**
+ * Called before this desktop is being closed.
+ * <p>
+ * Subclasses can override this method. The default does nothing.
+ *
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(15)
+ protected void execClosing() throws ProcessingException {
+ }
+
+ /**
+ * Called after a UI has been attached to this desktop. This desktop must not necessarily be open.
+ * <p>
+ * Subclasses can override this method. The default does nothing.
+ *
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(20)
+ protected void execGuiAttached() throws ProcessingException {
+ }
+
+ /**
+ * Called after a UI has been detached from this desktop. This desktop must not necessarily be open.
+ * <p>
+ * Subclasses can override this method. The default does nothing.
+ *
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(25)
+ protected void execGuiDetached() throws ProcessingException {
+ }
+
+ /**
+ * Called whenever a new outline has been activated on this desktop.
+ * <p>
+ * Subclasses can override this method. The default does nothing.
+ *
+ * @param oldOutline
+ * old outline that was active before
+ * @param newOutline
+ * new outline that is active after the change
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(30)
+ protected void execOutlineChanged(IOutline oldOutline, IOutline newOutline) throws ProcessingException {
+ }
+
+ /**
+ * Called whenever a new page has been activated (selected) on this desktop.
+ * <p>
+ * Subclasses can override this method.<br/>
+ * This default implementation {@linkplain #removeForm(IForm) removes} the old form from this desktop and
+ * {@linkplain #addForm(IForm) adds} the new form to this desktop.
+ *
+ * @param oldForm
+ * is the search form of the old (not selected anymore) page or {@code null}
+ * @param newForm
+ * is the search form of the new (selected) page or {@code null}
+ * @throws ProcessingException
+ */
+ @Order(40)
+ @ConfigOperation
+ protected void execPageSearchFormChanged(IForm oldForm, IForm newForm) throws ProcessingException {
+ if (oldForm != null) {
+ removeForm(oldForm);
+ }
+ if (newForm != null) {
+ //ticket 89617: make new form height fixed, non-resizable
+ GridData gd = newForm.getRootGroupBox().getGridData();
+ if (gd.weightY <= 0) {
+ gd.weightY = 0;
+ newForm.getRootGroupBox().setGridDataInternal(gd);
+ }
+ addForm(newForm);
+ }
+ }
+
+ /**
+ * Called whenever a new page has been activated (selected) on this desktop.
+ * <p>
+ * Subclasses can override this method.<br/>
+ * This default implementation {@linkplain #removeForm(IForm) removes} the old form from this desktop and
+ * {@linkplain #addForm(IForm) adds} the new form to this desktop.
+ *
+ * @param oldForm
+ * is the detail form of the old (not selected anymore) page or {@code null}
+ * @param newForm
+ * is the detail form of the new (selected) page or {@code null}
+ * @throws ProcessingException
+ */
+ @Order(50)
+ @ConfigOperation
+ protected void execPageDetailFormChanged(IForm oldForm, IForm newForm) throws ProcessingException {
+ if (oldForm != null) {
+ removeForm(oldForm);
+ }
+ if (newForm != null) {
+ addForm(newForm);
+ }
+ }
+
+ /**
+ * Called whenever a new page has been activated (selected) on this desktop.
+ * <p>
+ * Subclasses can override this method.<br/>
+ * This default implementation keeps track of the current outline table form and updates it accordingly (including
+ * visibility). See also {@link #getOutlineTableForm()}.
+ *
+ * @param oldTable
+ * is the table of the old (not selected anymore) table page or {@code null}
+ * @param newTable
+ * is the table of the new (selected) table page or {@code null}
+ * @throws ProcessingException
+ */
+ @Order(60)
+ @ConfigOperation
+ protected void execPageDetailTableChanged(ITable oldTable, ITable newTable) throws ProcessingException {
+ if (m_outlineTableForm != null) {
+ m_outlineTableForm.setCurrentTable(newTable);
+ }
+ setOutlineTableFormVisible(newTable != null);
+ }
+
+ /**
+ * Called after a table page was loaded or reloaded.
+ * <p>
+ * Subclasses can override this method.<br/>
+ * This default implementation minimizes the page search form when data has been found.
+ *
+ * @param tablePage
+ * the table page that has been (re)loaded
+ * @throws ProcessingException
+ */
+ @Order(62)
+ @ConfigOperation
+ protected void execTablePageLoaded(IPageWithTable<?> tablePage) throws ProcessingException {
+ ISearchForm searchForm = tablePage.getSearchFormInternal();
+ if (searchForm != null) {
+ searchForm.setMinimized(tablePage.getTable().getRowCount() > 0);
+ }
+ }
+
+ /**
+ * Called while the tray popup is being built. This method may call {@link #getMenu(Class)} to find an existing
+ * menu on this desktop by class type.
+ * <p>
+ * The (potential) menus added to the {@code menus} list will be post processed. {@link IMenu#prepareAction()} is
+ * called on each and then checked if the menu is visible.
+ * <p>
+ * Subclasses can override this method. The default does nothing.
+ *
+ * @param menus
+ * a live list to add menus to the tray
+ * @throws ProcessingException
+ */
+ @Order(70)
+ @ConfigOperation
+ protected void execAddTrayMenus(List<IMenu> menus) throws ProcessingException {
+ }
+
+ public IDesktopExtension[] getDesktopExtensions() {
+ return m_desktopExtensions.toArray(new IDesktopExtension[m_desktopExtensions.size()]);
+ }
+
+ /**
+ * @return the special extension that contributes the contents of this desktop itself
+ */
+ protected IDesktopExtension getLocalDesktopExtension() {
+ return m_localDesktopExtension;
+ }
+
+ protected void initConfig() {
+ initDesktopExtensions();
+ setTitle(getConfiguredTitle());
+ setTrayVisible(getConfiguredTrayVisible());
+ propertySupport.setProperty(PROP_KEY_STROKES, new IKeyStroke[0]);
+ IDesktopExtension[] extensions = getDesktopExtensions();
+ //outlines
+ ArrayList<IOutline> outlineList = new ArrayList<IOutline>();
+ if (extensions != null) {
+ for (IDesktopExtension ext : extensions) {
+ try {
+ ext.contributeOutlines(outlineList);
+ }
+ catch (Throwable t) {
+ LOG.error("contrinuting outlines by " + ext, t);
+ }
+ }
+ }
+ m_availableOutlines = ConfigurationUtility.sortByOrder(outlineList).toArray(new IOutline[outlineList.size()]);
+ //actions (keyStroke, menu, viewButton, toolButton)
+ ArrayList<IAction> actionList = new ArrayList<IAction>();
+ if (extensions != null) {
+ for (IDesktopExtension ext : extensions) {
+ try {
+ ext.contributeActions(actionList);
+ }
+ catch (Throwable t) {
+ LOG.error("contrinuting actions by " + ext, t);
+ }
+ }
+ }
+ //extract keystroke hints from menus
+ for (IMenu menu : new ActionFinder().findActions(actionList, IMenu.class, true)) {
+ if (menu.getKeyStroke() != null) {
+ try {
+ IKeyStroke ks = new KeyStroke(menu.getKeyStroke(), menu);
+ actionList.add(ks);
+ }
+ catch (Throwable t) {
+ LOG.error(null, t);
+ }
+ }
+ }
+ //build completed menu, viewButton, toolButton arrays
+ List<IMenu> menuList = new ActionFinder().findActions(actionList, IMenu.class, false); // only top level menus
+ m_menus = ConfigurationUtility.sortByOrder(menuList).toArray(new IMenu[menuList.size()]);
+ List<IViewButton> viewButtonList = new ActionFinder().findActions(actionList, IViewButton.class, false);
+ m_viewButtons = ConfigurationUtility.sortByOrder(viewButtonList).toArray(new IViewButton[viewButtonList.size()]);
+ List<IToolButton> toolButtonList = new ActionFinder().findActions(actionList, IToolButton.class, false);
+ m_toolButtons = ConfigurationUtility.sortByOrder(toolButtonList).toArray(new IToolButton[toolButtonList.size()]);
+ //add dynamic keyStrokes
+ List<IKeyStroke> ksList = new ActionFinder().findActions(actionList, IKeyStroke.class, true);
+ addKeyStrokes(ksList.toArray(new IKeyStroke[ksList.size()]));
+ //init outlines
+ for (IOutline o : m_availableOutlines) {
+ try {
+ o.initTree();
+ }
+ catch (Throwable t) {
+ LOG.error(null, t);
+ }
+ }
+ }
+
+ private void initDesktopExtensions() {
+ m_desktopExtensions = new LinkedList<IDesktopExtension>();
+ m_desktopExtensions.add(getLocalDesktopExtension());
+
+ injectDesktopExtensions(m_desktopExtensions);
+ }
+
+ /**
+ * Override to provide a set of extensions (modules) that contribute their content to this desktop.
+ * <p>
+ * The default list contains only the {@link #getLocalDesktopExtension()}
+ * </p>
+ * <p>
+ * The extension that are held by this desktop must call {@link IDesktopExtension#setCoreDesktop(this)} before using
+ * the extension. That way the extension can use and access this desktop's methods.
+ * </p>
+ */
+ protected void injectDesktopExtensions(List<IDesktopExtension> desktopExtensions) {
+ }
+
+ @Override
+ public void initDesktop() throws ProcessingException {
+ if (!m_desktopInited) {
+ m_desktopInited = true;
+ //local
+ prepareAllMenus();
+ //extensions
+ IDesktopExtension[] extensions = getDesktopExtensions();
+ if (extensions != null) {
+ for (IDesktopExtension ext : extensions) {
+ try {
+ ContributionCommand cc = ext.initDelegate();
+ if (cc == ContributionCommand.Stop) {
+ break;
+ }
+ }
+ catch (Throwable t) {
+ LOG.error("extension " + ext);
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ public boolean isTrayVisible() {
+ return m_trayVisible;
+ }
+
+ @Override
+ public void setTrayVisible(boolean b) {
+ m_trayVisible = b;
+ }
+
+ @Override
+ public boolean isShowing(IForm form) {
+ for (IForm f : m_viewStack) {
+ if (f == form) {
+ return true;
+ }
+ }
+ for (IForm f : m_dialogStack) {
+ if (f == form) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public <T extends IForm> T findForm(Class<T> formType) {
+ ArrayList<IForm> list = new ArrayList<IForm>();
+ list.addAll(m_viewStack);
+ list.addAll(m_dialogStack);
+ for (IForm f : list) {
+ if (formType.isAssignableFrom(f.getClass())) {
+ return (T) f;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public <T extends IOutline> T findOutline(Class<T> outlineType) {
+ for (IOutline o : getAvailableOutlines()) {
+ if (outlineType.isAssignableFrom(o.getClass())) {
+ return (T) o;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public <T extends IAction> T findAction(Class<T> actionType) {
+ return new ActionFinder().findAction(getActions(), actionType);
+ }
+
+ @Override
+ public <T extends IToolButton> T findToolButton(Class<T> toolButtonType) {
+ return findAction(toolButtonType);
+ }
+
+ @Override
+ public <T extends IViewButton> T findViewButton(Class<T> viewButtonType) {
+ return findAction(viewButtonType);
+ }
+
+ @Override
+ public IFormField getFocusOwner() {
+ return fireFindFocusOwner();
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public <T extends IForm> T[] findForms(Class<T> formType) {
+ ArrayList<T> resultList = new ArrayList<T>();
+ if (formType != null) {
+ ArrayList<IForm> list = new ArrayList<IForm>();
+ list.addAll(m_viewStack);
+ list.addAll(m_dialogStack);
+ for (IForm f : list) {
+ if (formType.isAssignableFrom(f.getClass())) {
+ resultList.add((T) f);
+ }
+ }
+ }
+ return resultList.toArray((T[]) Array.newInstance(formType, resultList.size()));
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public <T extends IForm> T findLastActiveForm(Class<T> formType) {
+ if (m_lastActiveFormList != null && formType != null) {
+ for (WeakReference<IForm> formRef : m_lastActiveFormList) {
+ if (formRef.get() != null && formType.isAssignableFrom(formRef.get().getClass())) {
+ return (T) formRef.get();
+ }
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public <T extends IMenu> T getMenu(Class<? extends T> searchType) {
+ return new ActionFinder().findAction(getMenus(), searchType);
+ }
+
+ @Override
+ public IForm[] getViewStack() {
+ return m_viewStack.toArray(new IForm[m_viewStack.size()]);
+ }
+
+ @Override
+ public IForm[] getDialogStack() {
+ return m_dialogStack.toArray(new IForm[m_dialogStack.size()]);
+ }
+
+ /**
+ * returns all forms except the searchform and the current detail form with
+ * the same fully qualified classname and an equal primary key different from
+ * null.
+ *
+ * @param form
+ * @return
+ */
+ @Override
+ public IForm[] getSimilarViewForms(IForm form) {
+ ArrayList<IForm> forms = new ArrayList<IForm>(3);
+ try {
+ if (form != null && form.computeExclusiveKey() != null) {
+ Object originalKey = form.computeExclusiveKey();
+ for (IForm f : m_viewStack) {
+ Object candidateKey = f.computeExclusiveKey();
+ if (getPageDetailForm() == f || getPageSearchForm() == f) {
+ continue;
+ }
+ else if (candidateKey == null || originalKey == null) {
+ continue;
+ }
+ else {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("form: " + candidateKey + " vs " + originalKey);
+ }
+
+ if (f.getClass().getName().equals(form.getClass().getName()) && originalKey.equals(candidateKey)) {
+ forms.add(f);
+ }
+ }
+ }
+ }
+ }
+ catch (ProcessingException e) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ return forms.toArray(new IForm[forms.size()]);
+ }
+
+ @Override
+ public void ensureViewStackVisible() {
+ IForm[] viewStack = getViewStack();
+ for (IForm form : viewStack) {
+ ensureVisible(form);
+ }
+ }
+
+ @Override
+ public void ensureVisible(IForm form) {
+ if (form != null) {
+ if (m_viewStack.contains(form) || m_dialogStack.contains(form)) {
+ fireFormEnsureVisible(form);
+ }
+ }
+ }
+
+ @Override
+ public void addForm(IForm form) {
+ //Allow DesktopExtensions to do any modifications on forms before UI is informed
+ IDesktopExtension[] extensions = getDesktopExtensions();
+ if (extensions != null) {
+ final IHolder<IForm> formHolder = new Holder<IForm>(IForm.class, form);
+ for (IDesktopExtension ext : extensions) {
+ try {
+ ContributionCommand cc = ext.customFormModificationDelegate(formHolder);
+ if (cc == ContributionCommand.Stop) {
+ break;
+ }
+ }
+ catch (ProcessingException e) {
+ formHolder.setValue(form);
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ catch (Throwable t) {
+ formHolder.setValue(form);
+ SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Formmodification error: " + form, t));
+ }
+ }
+ form = formHolder.getValue();
+ }
+ if (form != null) {
+ switch (form.getDisplayHint()) {
+ case IForm.DISPLAY_HINT_POPUP_WINDOW:
+ case IForm.DISPLAY_HINT_POPUP_DIALOG:
+ case IForm.DISPLAY_HINT_DIALOG: {
+ if (m_viewStack.remove(form)) {
+ fireFormRemoved(form);
+ }
+ //remove all open popup windows
+ if (form.getDisplayHint() == IForm.DISPLAY_HINT_POPUP_WINDOW) {
+ for (IForm f : new ArrayList<IForm>(m_dialogStack)) {
+ if (f.getDisplayHint() == IForm.DISPLAY_HINT_POPUP_WINDOW) {
+ try {
+ f.doClose();
+ }
+ catch (Throwable t) {
+ LOG.error("Failed closing popup " + f, t);
+ }
+ }
+ }
+ }
+ if (!m_dialogStack.contains(form)) {
+ m_dialogStack.add(form);
+ fireFormAdded(form);
+ }
+ break;
+ }
+ case IForm.DISPLAY_HINT_VIEW: {
+ if (m_dialogStack.remove(form)) {
+ fireFormRemoved(form);
+ }
+ if (!m_viewStack.contains(form)) {
+ m_viewStack.add(form);
+ fireFormAdded(form);
+ }
+ break;
+ }
+ }
+ m_lastActiveFormList.add(new WeakReference<IForm>(form));
+ form.addFormListener(m_activatedFormListener);
+ }
+ }
+
+ @Override
+ public void removeForm(IForm form) {
+ if (form != null) {
+ // remove form from last active form list
+ if (m_lastActiveFormList != null) {
+ for (Iterator<WeakReference<IForm>> it = m_lastActiveFormList.iterator(); it.hasNext();) {
+ WeakReference<IForm> formRef = it.next();
+ if (formRef.get() == null || form.equals(formRef.get())) {
+ it.remove();
+ }
+ }
+ }
+ form.removeFormListener(m_activatedFormListener);
+ boolean b1 = m_dialogStack.remove(form);
+ boolean b2 = m_viewStack.remove(form);
+ if (b1 || b2) {
+ fireFormRemoved(form);
+ }
+ }
+ }
+
+ @Override
+ public IMessageBox[] getMessageBoxStack() {
+ return m_messageBoxStack.toArray(new IMessageBox[0]);
+ }
+
+ @Override
+ public void addMessageBox(final IMessageBox mb) {
+ m_messageBoxStack.add(mb);
+ mb.addMessageBoxListener(new MessageBoxListener() {
+ @Override
+ public void messageBoxChanged(MessageBoxEvent e) {
+ switch (e.getType()) {
+ case MessageBoxEvent.TYPE_CLOSED: {
+ removeMessageBoxInternal(mb);
+ }
+ }
+ }
+ });
+ fireMessageBoxAdded(mb);
+ }
+
+ private void removeMessageBoxInternal(IMessageBox mb) {
+ m_messageBoxStack.remove(mb);
+ }
+
+ @Override
+ public IOutline[] getAvailableOutlines() {
+ return m_availableOutlines;
+ }
+
+ @Override
+ public void setAvailableOutlines(IOutline[] availableOutlines) {
+ setOutline((IOutline) null);
+ m_availableOutlines = availableOutlines != null ? availableOutlines : new IOutline[0];
+ }
+
+ @Override
+ public IOutline getOutline() {
+ return m_outline;
+ }
+
+ @Override
+ public void setOutline(IOutline outline) {
+ outline = resolveOutline(outline);
+ if (m_outline == outline
+ || m_outlineChanging) {
+ return;
+ }
+ synchronized (this) {
+ try {
+ m_outlineChanging = true;
+ if (m_outline != null) {
+ IPage oldActivePage = m_outline.getActivePage();
+ if (oldActivePage != null) {
+ SERVICES.getService(INavigationHistoryService.class).addStep(0, oldActivePage);
+ }
+ }
+ //
+ IOutline oldOutline = m_outline;
+ if (m_activeOutlineListener != null && oldOutline != null) {
+ oldOutline.removeTreeListener(m_activeOutlineListener);
+ oldOutline.removePropertyChangeListener(m_activeOutlineListener);
+ m_activeOutlineListener = null;
+ }
+ // set new outline to set facts
+ m_outline = outline;
+ // deactivate old page
+ if (oldOutline != null) {
+ oldOutline.clearContextPage();
+ }
+ //
+ if (m_outline != null) {
+ m_activeOutlineListener = new P_ActiveOutlineListener();
+ m_outline.addTreeListener(m_activeOutlineListener);
+ m_outline.addPropertyChangeListener(m_activeOutlineListener);
+ }
+ // <bsh 2010-10-15>
+ // Those three "setXyz(null)" statements used to be called unconditionally. Now, they
+ // are only called when the new outline is null. When the new outline is _not_ null, we
+ // will override the "null" anyway (see below).
+ // This change is needed for the "on/off semantics" of the tool tab buttons to work correctly.
+ if (m_outline == null) {
+ setPageDetailForm(null);
+ setPageDetailTable(null);
+ setPageSearchForm(null, true);
+ }
+ // </bsh>
+ fireOutlineChanged(oldOutline, m_outline);
+ if (m_outline != null) {
+ // reload selected page in case it is marked dirty
+ if (m_outline.getActivePage() != null) {
+ try {
+ m_outline.getActivePage().ensureChildrenLoaded();
+ }
+ catch (ProcessingException e) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ }
+ m_outline.setNodeExpanded(m_outline.getRootNode(), true);
+ setPageDetailForm(m_outline.getDetailForm());
+ setPageDetailTable(m_outline.getDetailTable());
+ setPageSearchForm(m_outline.getSearchForm(), true);
+ m_outline.makeActivePageToContextPage();
+ IPage newActivePage = m_outline.getActivePage();
+ if (newActivePage == null) {
+ // if there is no active page, set it now
+ if (m_outline.isRootNodeVisible()) {
+ m_outline.selectNode(m_outline.getRootNode(), false);
+ }
+ else {
+ ITreeNode[] children = m_outline.getRootNode().getChildNodes();
+ if (children.length > 0) {
+ for (ITreeNode node : children) {
+ if (node.isVisible() && node.isEnabled()) {
+ m_outline.selectNode(node, false);
+ break;
+ }
+ }
+ }
+ }
+ newActivePage = m_outline.getActivePage();
+ }
+ if (newActivePage != null) {
+ SERVICES.getService(INavigationHistoryService.class).addStep(0, newActivePage);
+ }
+ }
+ }
+ finally {
+ m_outlineChanging = false;
+ }
+ }
+ }
+
+ private IOutline resolveOutline(IOutline outline) {
+ for (IOutline o : getAvailableOutlines()) {
+ if (o == outline) {
+ return o;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public void setOutline(Class<? extends IOutline> outlineType) {
+ for (IOutline o : getAvailableOutlines()) {
+ if (o.getClass() == outlineType) {
+ setOutline(o);
+ return;
+ }
+ }
+ }
+
+ @Override
+ public IKeyStroke[] getKeyStrokes() {
+ return (IKeyStroke[]) propertySupport.getProperty(PROP_KEY_STROKES);
+ }
+
+ @Override
+ public void setKeyStrokes(IKeyStroke[] ks) {
+ if (ks == null) {
+ ks = new IKeyStroke[0];
+ }
+ propertySupport.setProperty(PROP_KEY_STROKES, ks);
+ }
+
+ @Override
+ public void addKeyStrokes(IKeyStroke... keyStrokes) {
+ if (keyStrokes != null && keyStrokes.length > 0) {
+ HashMap<String, IKeyStroke> map = new HashMap<String, IKeyStroke>();
+ for (IKeyStroke ks : getKeyStrokes()) {
+ map.put(ks.getKeyStroke(), ks);
+ }
+ for (IKeyStroke ks : keyStrokes) {
+ map.put(ks.getKeyStroke(), ks);
+ }
+ setKeyStrokes(map.values().toArray(new IKeyStroke[map.size()]));
+ }
+ }
+
+ @Override
+ public void removeKeyStrokes(IKeyStroke... keyStrokes) {
+ if (keyStrokes != null && keyStrokes.length > 0) {
+ HashMap<String, IKeyStroke> map = new HashMap<String, IKeyStroke>();
+ for (IKeyStroke ks : getKeyStrokes()) {
+ map.put(ks.getKeyStroke(), ks);
+ }
+ for (IKeyStroke ks : keyStrokes) {
+ map.remove(ks.getKeyStroke());
+ }
+ setKeyStrokes(map.values().toArray(new IKeyStroke[map.size()]));
+ }
+ }
+
+ @Override
+ public IMenu[] getMenus() {
+ IMenu[] a = new IMenu[m_menus.length];
+ System.arraycopy(m_menus, 0, a, 0, a.length);
+ return a;
+ }
+
+ @Override
+ public void prepareAllMenus() {
+ for (IMenu child : getMenus()) {
+ prepareMenuRec(child);
+ }
+ }
+
+ private void prepareMenuRec(IMenu menu) {
+ menu.prepareAction();
+ for (IMenu child : menu.getChildActions()) {
+ prepareMenuRec(child);
+ }
+ }
+
+ @Override
+ public IAction[] getActions() {
+ IAction[] a = getKeyStrokes();
+ IAction[] b = getMenus();
+ IAction[] c = getViewButtons();
+ IAction[] d = getToolButtons();
+ if (a == null) {
+ a = new IAction[0];
+ }
+ if (b == null) {
+ b = new IAction[0];
+ }
+ if (c == null) {
+ c = new IAction[0];
+ }
+ if (d == null) {
+ d = new IAction[0];
+ }
+ IAction[] all = new IAction[a.length + b.length + c.length + d.length];
+ int offset = 0;
+ System.arraycopy(a, 0, all, offset, a.length);
+ offset += a.length;
+ System.arraycopy(b, 0, all, offset, b.length);
+ offset += b.length;
+ System.arraycopy(c, 0, all, offset, c.length);
+ offset += c.length;
+ System.arraycopy(d, 0, all, offset, d.length);
+ return all;
+ }
+
+ @Override
+ public IToolButton[] getToolButtons() {
+ IToolButton[] a = new IToolButton[m_toolButtons.length];
+ System.arraycopy(m_toolButtons, 0, a, 0, a.length);
+ return a;
+ }
+
+ @Override
+ public IViewButton[] getViewButtons() {
+ IViewButton[] a = new IViewButton[m_viewButtons.length];
+ System.arraycopy(m_viewButtons, 0, a, 0, a.length);
+ return a;
+ }
+
+ @Override
+ public IForm getPageDetailForm() {
+ return m_pageDetailForm;
+ }
+
+ @Override
+ public void setPageDetailForm(IForm f) {
+ if (m_pageDetailForm != f) {
+ IForm oldForm = m_pageDetailForm;
+ m_pageDetailForm = f;
+ //extensions
+ IDesktopExtension[] extensions = getDesktopExtensions();
+ if (extensions != null) {
+ for (IDesktopExtension ext : extensions) {
+ try {
+ ContributionCommand cc = ext.pageDetailFormChangedDelegate(oldForm, m_pageDetailForm);
+ if (cc == ContributionCommand.Stop) {
+ break;
+ }
+ }
+ catch (Throwable t) {
+ LOG.error("extension " + ext, t);
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ public IForm getPageSearchForm() {
+ return m_pageSearchForm;
+ }
+
+ @Override
+ public void setPageSearchForm(IForm f) {
+ setPageSearchForm(f, false);
+ }
+
+ public void setPageSearchForm(IForm f, boolean force) {
+ if (force || m_pageSearchForm != f) {
+ IForm oldForm = m_pageSearchForm;
+ m_pageSearchForm = f;
+ //extensions
+ IDesktopExtension[] extensions = getDesktopExtensions();
+ if (extensions != null) {
+ for (IDesktopExtension ext : extensions) {
+ try {
+ ContributionCommand cc = ext.pageSearchFormChangedDelegate(oldForm, m_pageSearchForm);
+ if (cc == ContributionCommand.Stop) {
+ break;
+ }
+ }
+ catch (Throwable t) {
+ LOG.error("extension " + ext, t);
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ public IOutlineTableForm getOutlineTableForm() {
+ return m_outlineTableForm;
+ }
+
+ @Override
+ public void setOutlineTableForm(IOutlineTableForm f) {
+ if (f != m_outlineTableForm) {
+ if (m_outlineTableForm != null) {
+ removeForm(m_outlineTableForm);
+ }
+ m_outlineTableForm = f;
+ if (m_outlineTableForm != null) {
+ m_outlineTableForm.setCurrentTable(getPageDetailTable());
+ setOutlineTableFormVisible(getPageDetailTable() != null);
+ }
+ if (m_outlineTableForm != null && m_outlineTableFormVisible) {
+ addForm(m_outlineTableForm);
+ }
+ }
+ }
+
+ @Override
+ public boolean isOutlineTableFormVisible() {
+ return m_outlineTableFormVisible;
+ }
+
+ @Override
+ public void setOutlineTableFormVisible(boolean b) {
+ if (m_outlineTableFormVisible != b) {
+ m_outlineTableFormVisible = b;
+ if (m_outlineTableForm != null) {
+ if (m_outlineTableFormVisible) {
+ addForm(m_outlineTableForm);
+ }
+ else {
+ removeForm(m_outlineTableForm);
+ }
+ }
+ }
+ }
+
+ @Override
+ public ITable getPageDetailTable() {
+ return m_pageDetailTable;
+ }
+
+ @Override
+ public void setPageDetailTable(ITable t) {
+ if (m_pageDetailTable != t) {
+ ITable oldTable = m_pageDetailTable;
+ m_pageDetailTable = t;
+ //extensions
+ IDesktopExtension[] extensions = getDesktopExtensions();
+ if (extensions != null) {
+ for (IDesktopExtension ext : extensions) {
+ try {
+ ContributionCommand cc = ext.pageDetailTableChangedDelegate(oldTable, m_pageDetailTable);
+ if (cc == ContributionCommand.Stop) {
+ break;
+ }
+ }
+ catch (Throwable x) {
+ LOG.error("extension " + ext, x);
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ public String getTitle() {
+ return propertySupport.getPropertyString(PROP_TITLE);
+ }
+
+ @Override
+ public void setTitle(String s) {
+ propertySupport.setPropertyString(PROP_TITLE, s);
+ }
+
+ @Override
+ public IProcessingStatus getStatus() {
+ return (IProcessingStatus) propertySupport.getProperty(PROP_STATUS);
+ }
+
+ @Override
+ public void setStatus(IProcessingStatus status) {
+ propertySupport.setProperty(PROP_STATUS, status);
+ }
+
+ @Override
+ public void setStatusText(String s) {
+ if (s != null) {
+ setStatus(new ProcessingStatus(s, null, 0, IProcessingStatus.INFO));
+ }
+ else {
+ setStatus(null);
+ }
+ }
+
+ @Override
+ public void printDesktop(PrintDevice device, Map<String, Object> parameters) {
+ try {
+ firePrint(device, parameters);
+ }
+ catch (ProcessingException e) {
+ e.addContextMessage(ScoutTexts.get("FormPrint") + " " + getTitle());
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ }
+
+ @Override
+ public void addFileChooser(IFileChooser fc) {
+ fireFileChooserAdded(fc);
+ }
+
+ @Override
+ public void openBrowserWindow(String path) {
+ fireOpenBrowserWindow(path);
+ }
+
+ @Override
+ public boolean isAutoPrefixWildcardForTextSearch() {
+ return m_autoPrefixWildcardForTextSearch;
+ }
+
+ @Override
+ public void setAutoPrefixWildcardForTextSearch(boolean b) {
+ m_autoPrefixWildcardForTextSearch = b;
+ }
+
+ @Override
+ public boolean isOpened() {
+ return propertySupport.getPropertyBool(PROP_OPENED);
+ }
+
+ private void setOpenedInternal(boolean b) {
+ propertySupport.setPropertyBool(PROP_OPENED, b);
+ }
+
+ private void setGuiAvailableInternal(boolean guiAvailable) {
+ propertySupport.setPropertyBool(PROP_GUI_AVAILABLE, guiAvailable);
+ }
+
+ @Override
+ public boolean isGuiAvailable() {
+ return propertySupport.getPropertyBool(PROP_GUI_AVAILABLE);
+ }
+
+ @Override
+ public void addDesktopListener(DesktopListener l) {
+ m_listenerList.add(DesktopListener.class, l);
+ }
+
+ @Override
+ public void removeDesktopListener(DesktopListener l) {
+ m_listenerList.remove(DesktopListener.class, l);
+ }
+
+ @Override
+ public void addDataChangeListener(DataChangeListener listener, Object... dataTypes) {
+ if (dataTypes == null || dataTypes.length == 0) {
+ EventListenerList list = m_dataChangeListenerList.get(null);
+ if (list == null) {
+ list = new EventListenerList();
+ m_dataChangeListenerList.put(null, list);
+ }
+ list.add(DataChangeListener.class, listener);
+ }
+ else {
+ for (Object dataType : dataTypes) {
+ if (dataType != null) {
+ EventListenerList list = m_dataChangeListenerList.get(dataType);
+ if (list == null) {
+ list = new EventListenerList();
+ m_dataChangeListenerList.put(dataType, list);
+ }
+ list.add(DataChangeListener.class, listener);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void removeDataChangeListener(DataChangeListener listener, Object... dataTypes) {
+ if (dataTypes == null || dataTypes.length == 0) {
+ for (Iterator<EventListenerList> it = m_dataChangeListenerList.values().iterator(); it.hasNext();) {
+ EventListenerList list = it.next();
+ list.remove(DataChangeListener.class, listener);
+ if (list.getListenerCount(DataChangeListener.class) == 0) {
+ it.remove();
+ }
+ }
+ }
+ else {
+ for (Object dataType : dataTypes) {
+ if (dataType != null) {
+ EventListenerList list = m_dataChangeListenerList.get(dataType);
+ if (list != null) {
+ list.remove(DataChangeListener.class, listener);
+ if (list.getListenerCount(DataChangeListener.class) == 0) {
+ m_dataChangeListenerList.remove(dataType);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ public void dataChanged(Object... dataTypes) {
+ if (dataTypes != null && dataTypes.length > 0) {
+ HashMap<DataChangeListener, Set<Object>> map = new HashMap<DataChangeListener, Set<Object>>();
+ for (Object dataType : dataTypes) {
+ if (dataType != null) {
+ EventListenerList list = m_dataChangeListenerList.get(dataType);
+ if (list != null) {
+ for (DataChangeListener listener : list.getListeners(DataChangeListener.class)) {
+ Set<Object> typeSet = map.get(listener);
+ if (typeSet == null) {
+ typeSet = new HashSet<Object>();
+ map.put(listener, typeSet);
+ }
+ typeSet.add(dataType);
+ }
+ }
+ }
+ }
+ for (Map.Entry<DataChangeListener, Set<Object>> e : map.entrySet()) {
+ DataChangeListener listener = e.getKey();
+ Set<Object> typeSet = e.getValue();
+ try {
+ listener.dataChanged(typeSet.toArray());
+ }
+ catch (Throwable t) {
+ LOG.error(null, t);
+ }
+ }
+ }
+ }
+
+ private void fireDesktopClosed() {
+ DesktopEvent e = new DesktopEvent(this, DesktopEvent.TYPE_DESKTOP_CLOSED);
+ fireDesktopEvent(e);
+ }
+
+ private void firePrint(PrintDevice device, Map<String, Object> parameters) throws ProcessingException {
+ fireDesktopEvent(new DesktopEvent(this, DesktopEvent.TYPE_PRINT, device, parameters));
+ }
+
+ private IMenu[] fireTrayPopup() {
+ DesktopEvent e = new DesktopEvent(this, DesktopEvent.TYPE_TRAY_POPUP);
+ // single observer for exec callback
+ addLocalPopupMenus(e);
+ fireDesktopEvent(e);
+ return e.getPopupMenus();
+ }
+
+ /**
+ * @param printedFile
+ */
+ private void fireDesktopPrinted(File printedFile) {
+ DesktopEvent e = new DesktopEvent(this, DesktopEvent.TYPE_PRINTED, printedFile);
+ fireDesktopEvent(e);
+ }
+
+ private void fireOutlineChanged(IOutline oldOutline, IOutline newOutline) {
+ if (oldOutline != newOutline) {
+ //extensions
+ IDesktopExtension[] extensions = getDesktopExtensions();
+ if (extensions != null) {
+ for (IDesktopExtension ext : extensions) {
+ try {
+ ContributionCommand cc = ext.outlineChangedDelegate(oldOutline, newOutline);
+ if (cc == ContributionCommand.Stop) {
+ break;
+ }
+ }
+ catch (ProcessingException e) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ catch (Throwable t) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException(oldOutline + " -> " + newOutline, t));
+ }
+ }
+ }
+ }
+ // fire
+ DesktopEvent e = new DesktopEvent(this, DesktopEvent.TYPE_OUTLINE_CHANGED, newOutline);
+ fireDesktopEvent(e);
+ }
+
+ private void fireFormAdded(IForm form) {
+ DesktopEvent e = new DesktopEvent(this, DesktopEvent.TYPE_FORM_ADDED, form);
+ fireDesktopEvent(e);
+ }
+
+ private void fireFormEnsureVisible(IForm form) {
+ DesktopEvent e = new DesktopEvent(this, DesktopEvent.TYPE_FORM_ENSURE_VISIBLE, form);
+ fireDesktopEvent(e);
+ }
+
+ private void fireFormRemoved(IForm form) {
+ DesktopEvent e = new DesktopEvent(this, DesktopEvent.TYPE_FORM_REMOVED, form);
+ fireDesktopEvent(e);
+ }
+
+ private void fireMessageBoxAdded(IMessageBox mb) {
+ DesktopEvent e = new DesktopEvent(this, DesktopEvent.TYPE_MESSAGE_BOX_ADDED, mb);
+ fireDesktopEvent(e);
+ }
+
+ private void fireFileChooserAdded(IFileChooser fc) {
+ DesktopEvent e = new DesktopEvent(this, DesktopEvent.TYPE_FILE_CHOOSER_ADDED, fc);
+ fireDesktopEvent(e);
+ }
+
+ private void fireOpenBrowserWindow(String path) {
+ DesktopEvent e = new DesktopEvent(this, DesktopEvent.TYPE_OPEN_BROWSER_WINDOW, path);
+ fireDesktopEvent(e);
+ }
+
+ private IFormField fireFindFocusOwner() {
+ DesktopEvent e = new DesktopEvent(this, DesktopEvent.TYPE_FIND_FOCUS_OWNER);
+ fireDesktopEvent(e);
+ return e.getFocusedField();
+ }
+
+ // main handler
+ private void fireDesktopEvent(DesktopEvent e) {
+ EventListener[] listeners = m_listenerList.getListeners(DesktopListener.class);
+ if (listeners != null && listeners.length > 0) {
+ for (EventListener element : listeners) {
+ try {
+ ((DesktopListener) element).desktopChanged(e);
+ }
+ catch (Throwable t) {
+ LOG.error(null, t);
+ }
+ }
+ }
+ }
+
+ private void addLocalPopupMenus(DesktopEvent event) {
+ try {
+ ArrayList<IMenu> list = new ArrayList<IMenu>();
+ //extensions
+ IDesktopExtension[] extensions = getDesktopExtensions();
+ if (extensions != null) {
+ for (IDesktopExtension ext : extensions) {
+ try {
+ ContributionCommand cc = ext.addTrayMenusDelegate(list);
+ if (cc == ContributionCommand.Stop) {
+ break;
+ }
+ }
+ catch (Throwable t) {
+ LOG.error("extension " + ext, t);
+ }
+ }
+ }
+ for (IMenu m : list) {
+ if (m != null) {
+ m.prepareAction();
+ }
+ }
+ for (IMenu m : list) {
+ if (m != null && m.isVisible()) {
+ event.addPopupMenu(m);
+ }
+ }
+ }
+ catch (Throwable t) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Unexpected", t));
+ }
+ }
+
+ @Override
+ public void activateBookmark(Bookmark bm, boolean forceReload) throws ProcessingException {
+ BookmarkUtility.activateBookmark(this, bm, forceReload);
+ }
+
+ @Override
+ public Bookmark createBookmark() throws ProcessingException {
+ return BookmarkUtility.createBookmark(this);
+ }
+
+ @Override
+ public Bookmark createBookmark(IPage page) throws ProcessingException {
+ return BookmarkUtility.createBookmark(page);
+ }
+
+ @Override
+ public void refreshPages(Class... pageTypes) {
+ for (IOutline outline : getAvailableOutlines()) {
+ outline.refreshPages(pageTypes);
+ }
+ }
+
+ @Override
+ public void releaseUnusedPages() {
+ for (IOutline outline : getAvailableOutlines()) {
+ outline.releaseUnusedPages();
+ }
+ }
+
+ @Override
+ public void afterTablePageLoaded(IPageWithTable<?> tablePage) throws ProcessingException {
+ //extensions
+ IDesktopExtension[] extensions = getDesktopExtensions();
+ if (extensions != null) {
+ for (IDesktopExtension ext : extensions) {
+ try {
+ ContributionCommand cc = ext.tablePageLoadedDelegate(tablePage);
+ if (cc == ContributionCommand.Stop) {
+ break;
+ }
+ }
+ catch (Throwable t) {
+ LOG.error("extension " + ext, t);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void closeInternal() throws ProcessingException {
+ List<IForm> openForms = new ArrayList<IForm>();
+ // remove views
+ for (IForm view : getViewStack()) {
+ removeForm(view);
+ openForms.add(view);
+ }
+ // remove forms
+ for (IForm dialog : getDialogStack()) {
+ removeForm(dialog);
+ openForms.add(dialog);
+ }
+ //extensions
+ IDesktopExtension[] extensions = getDesktopExtensions();
+ if (extensions != null) {
+ for (IDesktopExtension ext : extensions) {
+ try {
+ ContributionCommand cc = ext.desktopClosingDelegate();
+ if (cc == ContributionCommand.Stop) {
+ break;
+ }
+ }
+ catch (Throwable t) {
+ LOG.error("extension " + ext, t);
+ }
+ }
+ }
+
+ // gather tool button forms
+ for (IToolButton toolButton : getToolButtons()) {
+ if (toolButton instanceof AbstractFormToolButton) {
+ AbstractFormToolButton<?> formToolButton = (AbstractFormToolButton<?>) toolButton;
+ IForm form = formToolButton.getForm();
+ if (form != null) {
+ openForms.add(form);
+ formToolButton.setForm(null);
+ }
+ }
+ }
+
+ // close open forms
+ for (IForm form : openForms) {
+ if (form != null) {
+ try {
+ form.doClose();
+ }
+ catch (ProcessingException e) {
+ LOG.error("Exception while closing form", e);
+ }
+ }
+ }
+
+ // outlines
+ for (IOutline outline : getAvailableOutlines()) {
+ outline.removeAllChildNodes(outline.getRootNode());
+ outline.disposeTree();
+ }
+
+ fireDesktopClosed();
+ }
+
+ public boolean runMenu(Class<? extends IMenu> menuType) throws ProcessingException {
+ for (IMenu m : getMenus()) {
+ if (runMenuRec(m, menuType)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private boolean runMenuRec(IMenu m, Class<? extends IMenu> menuType) throws ProcessingException {
+ if (m.getClass() == menuType) {
+ m.prepareAction();
+ if (m.isVisible() && m.isEnabled()) {
+ m.doAction();
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+ // children
+ for (IMenu c : m.getChildActions()) {
+ if (runMenuRec(c, menuType)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public IDesktopUIFacade getUIFacade() {
+ return m_uiFacade;
+ }
+
+ /**
+ * local desktop extension that calls local exec methods and returns local contributions in this class itself
+ */
+ private class P_LocalDesktopExtension implements IDesktopExtension {
+ @Override
+ public IDesktop getCoreDesktop() {
+ return AbstractDesktop.this;
+ }
+
+ @Override
+ public void setCoreDesktop(IDesktop desktop) {
+ //nop
+ }
+
+ @Override
+ public void contributeOutlines(Collection<IOutline> outlines) {
+ Class<?>[] a = getConfiguredOutlines();
+ if (a != null) {
+ for (Class<?> element : a) {
+ try {
+ IOutline o = (IOutline) element.newInstance();
+ outlines.add(o);
+ }
+ catch (Throwable t) {
+ LOG.error("adding outline " + element, t);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void contributeActions(Collection<IAction> actions) {
+ Class<? extends IAction>[] actionArray = getConfiguredActions();
+ for (Class<? extends IAction> element : actionArray) {
+ try {
+ IAction tool = ConfigurationUtility.newInnerInstance(AbstractDesktop.this, element);
+ actions.add(tool);
+ }
+ catch (Exception e) {
+ LOG.error("adding action " + element, e);
+ }
+ }
+ }
+
+ @Override
+ public ContributionCommand initDelegate() throws ProcessingException {
+ execInit();
+ return ContributionCommand.Continue;
+ }
+
+ @Override
+ public ContributionCommand desktopOpenedDelegate() throws ProcessingException {
+ execOpened();
+ return ContributionCommand.Continue;
+ }
+
+ @Override
+ public ContributionCommand desktopClosingDelegate() throws ProcessingException {
+ execClosing();
+ return ContributionCommand.Continue;
+ }
+
+ @Override
+ public ContributionCommand guiAttachedDelegate() throws ProcessingException {
+ execGuiAttached();
+ return ContributionCommand.Continue;
+ }
+
+ @Override
+ public ContributionCommand guiDetachedDelegate() throws ProcessingException {
+ execGuiDetached();
+ return ContributionCommand.Continue;
+ }
+
+ @Override
+ public ContributionCommand outlineChangedDelegate(IOutline oldOutline, IOutline newOutline) throws ProcessingException {
+ execOutlineChanged(oldOutline, newOutline);
+ return ContributionCommand.Continue;
+ }
+
+ @Override
+ public ContributionCommand customFormModificationDelegate(IHolder<IForm> formHolder) throws ProcessingException {
+ return ContributionCommand.Continue;
+ }
+
+ @Override
+ public ContributionCommand pageSearchFormChangedDelegate(IForm oldForm, IForm newForm) throws ProcessingException {
+ execPageSearchFormChanged(oldForm, newForm);
+ return ContributionCommand.Continue;
+ }
+
+ @Override
+ public ContributionCommand pageDetailFormChangedDelegate(IForm oldForm, IForm newForm) throws ProcessingException {
+ execPageDetailFormChanged(oldForm, newForm);
+ return ContributionCommand.Continue;
+ }
+
+ @Override
+ public ContributionCommand pageDetailTableChangedDelegate(ITable oldTable, ITable newTable) throws ProcessingException {
+ execPageDetailTableChanged(oldTable, newTable);
+ return ContributionCommand.Continue;
+ }
+
+ @Override
+ public ContributionCommand tablePageLoadedDelegate(IPageWithTable<?> tablePage) throws ProcessingException {
+ execTablePageLoaded(tablePage);
+ return ContributionCommand.Continue;
+ }
+
+ @Override
+ public ContributionCommand addTrayMenusDelegate(List<IMenu> menus) throws ProcessingException {
+ execAddTrayMenus(menus);
+ return ContributionCommand.Continue;
+ }
+ }
+
+ private class P_UIFacade implements IDesktopUIFacade {
+
+ @Override
+ public void fireGuiAttached() {
+ setGuiAvailableInternal(true);
+ //extensions
+ IDesktopExtension[] extensions = getDesktopExtensions();
+ if (extensions != null) {
+ for (IDesktopExtension ext : extensions) {
+ try {
+ ContributionCommand cc = ext.guiAttachedDelegate();
+ if (cc == ContributionCommand.Stop) {
+ break;
+ }
+ }
+ catch (ProcessingException e) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ catch (Throwable t) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Unexpected by " + ext, t));
+ }
+ }
+ }
+ }
+
+ @Override
+ public void fireGuiDetached() {
+ setGuiAvailableInternal(false);
+ //extensions
+ IDesktopExtension[] extensions = getDesktopExtensions();
+ if (extensions != null) {
+ for (IDesktopExtension ext : extensions) {
+ try {
+ ContributionCommand cc = ext.guiDetachedDelegate();
+ if (cc == ContributionCommand.Stop) {
+ break;
+ }
+ }
+ catch (ProcessingException e) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ catch (Throwable t) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Unexpected by " + ext, t));
+ }
+ }
+ }
+ }
+
+ @Override
+ public void fireDesktopOpenedFromUI() {
+ setOpenedInternal(true);
+ //extensions
+ IDesktopExtension[] extensions = getDesktopExtensions();
+ if (extensions != null) {
+ for (IDesktopExtension ext : extensions) {
+ try {
+ ContributionCommand cc = ext.desktopOpenedDelegate();
+ if (cc == ContributionCommand.Stop) {
+ break;
+ }
+ }
+ catch (ProcessingException e) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ catch (Throwable t) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Unexpected by " + ext, t));
+ }
+ }
+ }
+ }
+
+ @Override
+ public void fireDesktopClosingFromUI() {
+ setOpenedInternal(false);
+ ClientSyncJob.getCurrentSession().stopSession();
+ }
+
+ @Override
+ public IMenu[] fireTrayPopupFromUI() {
+ return fireTrayPopup();
+ }
+
+ @Override
+ public void fireDesktopPrintedFromUI(File printedFile) {
+ fireDesktopPrinted(printedFile);
+ }
+
+ }
+
+ private class P_ActiveOutlineListener extends TreeAdapter implements PropertyChangeListener {
+ @Override
+ public void treeChanged(TreeEvent e) {
+ switch (e.getType()) {
+ case TreeEvent.TYPE_BEFORE_NODES_SELECTED: {
+ if (e.getDeselectedNode() instanceof IPage) {
+ IPage deselectedPage = (IPage) e.getDeselectedNode();
+ SERVICES.getService(INavigationHistoryService.class).addStep(0, deselectedPage);
+ }
+ break;
+ }
+ case TreeEvent.TYPE_NODES_SELECTED: {
+ IPage page = m_outline.getActivePage();
+ if (page != null) {
+ SERVICES.getService(INavigationHistoryService.class).addStep(0, page);
+ }
+ try {
+ ClientSyncJob.getCurrentSession().getMemoryPolicy().afterOutlineSelectionChanged(AbstractDesktop.this);
+ }
+ catch (Throwable t) {
+ LOG.warn("MemoryPolicy.afterOutlineSelectionChanged", t);
+ }
+ break;
+ }
+ }
+ }
+
+ @Override
+ public void propertyChange(PropertyChangeEvent e) {
+ if (e.getPropertyName().equals(IOutline.PROP_DETAIL_FORM)) {
+ setPageDetailForm(((IOutline) e.getSource()).getDetailForm());
+ }
+ else if (e.getPropertyName().equals(IOutline.PROP_DETAIL_TABLE)) {
+ setPageDetailTable(((IOutline) e.getSource()).getDetailTable());
+ }
+ else if (e.getPropertyName().equals(IOutline.PROP_SEARCH_FORM)) {
+ setPageSearchForm(((IOutline) e.getSource()).getSearchForm());
+ }
+ }
+ }
+
+ private class P_ActivatedFormListener implements FormListener {
+ @Override
+ public void formChanged(FormEvent e) throws ProcessingException {
+ if (e.getType() != FormEvent.TYPE_ACTIVATED) {
+ return;
+ }
+ // remove garbage collected references and the one of the given form event
+ for (Iterator<WeakReference<IForm>> it = m_lastActiveFormList.iterator(); it.hasNext();) {
+ WeakReference<IForm> formRef = it.next();
+ if (formRef.get() == null || formRef.get().equals(e.getForm())) {
+ it.remove();
+ }
+ }
+
+ // add changed form at the beginning -> last activated form
+ m_lastActiveFormList.add(0, new WeakReference<IForm>(e.getForm()));
+ }
+ }
+
+ @Override
+ public void changeVisibilityAfterOfflineSwitch() {
+ return;
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/AbstractDesktopExtension.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/AbstractDesktopExtension.java
index 71dcf20087..3f4b95763d 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/AbstractDesktopExtension.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/AbstractDesktopExtension.java
@@ -1,379 +1,379 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.desktop;
-
-import java.util.Collection;
-import java.util.List;
-
-import org.eclipse.scout.commons.ConfigurationUtility;
-import org.eclipse.scout.commons.annotations.ConfigOperation;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.holders.IHolder;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.action.IAction;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-
-/**
- * base implementation of {@link IDesktopExtension}
- */
-public abstract class AbstractDesktopExtension implements IDesktopExtension {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractDesktopExtension.class);
-
- private IDesktop m_coreDesktop;
-
- public AbstractDesktopExtension() {
- }
-
- @Override
- public ContributionCommand initDelegate() throws ProcessingException {
- return execInit();
- }
-
- @Override
- public ContributionCommand desktopOpenedDelegate() throws ProcessingException {
- return execOpened();
- }
-
- @Override
- public ContributionCommand desktopClosingDelegate() throws ProcessingException {
- return execClosing();
- }
-
- @Override
- public ContributionCommand guiAttachedDelegate() throws ProcessingException {
- return execGuiAttached();
- }
-
- @Override
- public ContributionCommand guiDetachedDelegate() throws ProcessingException {
- return execGuiDetached();
- }
-
- @Override
- public ContributionCommand outlineChangedDelegate(IOutline oldOutline, IOutline newOutline) throws ProcessingException {
- return execOutlineChanged(oldOutline, newOutline);
- }
-
- @Override
- public ContributionCommand customFormModificationDelegate(IHolder<IForm> formHolder) throws ProcessingException {
- return execCustomFormModification(formHolder);
- }
-
- @Override
- public ContributionCommand pageSearchFormChangedDelegate(IForm oldForm, IForm newForm) throws ProcessingException {
- return execPageSearchFormChanged(oldForm, newForm);
- }
-
- @Override
- public ContributionCommand pageDetailFormChangedDelegate(IForm oldForm, IForm newForm) throws ProcessingException {
- return execPageDetailFormChanged(oldForm, newForm);
- }
-
- @Override
- public ContributionCommand pageDetailTableChangedDelegate(ITable oldTable, ITable newTable) throws ProcessingException {
- return execPageDetailTableChanged(oldTable, newTable);
- }
-
- @Override
- public ContributionCommand tablePageLoadedDelegate(IPageWithTable<?> tablePage) throws ProcessingException {
- return execTablePageLoaded(tablePage);
- }
-
- @Override
- public ContributionCommand addTrayMenusDelegate(List<IMenu> menus) throws ProcessingException {
- return execAddTrayMenus(menus);
- }
-
- @Override
- public void contributeOutlines(Collection<IOutline> outlines) {
- Class<? extends IOutline>[] array = getConfiguredOutlines();
- if (array == null) {
- return;
- }
- for (Class<? extends IOutline> element : array) {
- try {
- IOutline o = element.newInstance();
- outlines.add(o);
- }
- catch (Throwable t) {
- LOG.error(null, t);
- }
- }
- }
-
- @Override
- public void contributeActions(Collection<IAction> actions) {
- Class<? extends IAction>[] array = getConfiguredActions();
- if (array == null) {
- return;
- }
- for (Class<? extends IAction> element : array) {
- try {
- IAction a = ConfigurationUtility.newInnerInstance(this, element);
- actions.add(a);
- }
- catch (Exception e) {
- LOG.error(null, e);
- }
- }
- }
-
- @Override
- public IDesktop getCoreDesktop() {
- return m_coreDesktop;
- }
-
- @Override
- public void setCoreDesktop(IDesktop desktop) {
- m_coreDesktop = desktop;
- }
-
- /**
- * Called while this desktop extension is initialized.
- * <p>
- * Subclasses can override this method. The default simply returns {@link ContributionCommand.Continue}.
- *
- * @return {@code ContributionCommand.Continue} if further extensions should be processed,
- * {@code ContributionCommand.Stop} otherwise
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(10)
- protected ContributionCommand execInit() throws ProcessingException {
- return ContributionCommand.Continue;
- }
-
- /*
- * Runtime
- */
-
- /**
- * Called after the core desktop was opened and displayed on the GUI.
- * <p>
- * Subclasses can override this method. The default simply returns {@link ContributionCommand.Continue}.
- *
- * @return {@code ContributionCommand.Continue} if further extensions should be processed,
- * {@code ContributionCommand.Stop} otherwise
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(12)
- protected ContributionCommand execOpened() throws ProcessingException {
- return ContributionCommand.Continue;
- }
-
- /**
- * Called before the core desktop is being closed.
- * <p>
- * Subclasses can override this method. The default simply returns {@link ContributionCommand.Continue}.
- *
- * @return {@code ContributionCommand.Continue} if further extensions should be processed,
- * {@code ContributionCommand.Stop} otherwise
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(15)
- protected ContributionCommand execClosing() throws ProcessingException {
- return ContributionCommand.Continue;
- }
-
- /**
- * Called after a UI has been attached to the core desktop. The desktop must not necessarily be open.
- * <p>
- * Subclasses can override this method. The default simply returns {@link ContributionCommand.Continue}.
- *
- * @return {@code ContributionCommand.Continue} if further extensions should be processed,
- * {@code ContributionCommand.Stop} otherwise
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(20)
- protected ContributionCommand execGuiAttached() throws ProcessingException {
- return ContributionCommand.Continue;
- }
-
- /**
- * Called after a UI has been detached from the core desktop. The desktop must not necessarily be open.
- * <p>
- * Subclasses can override this method. The default simply returns {@link ContributionCommand.Continue}.
- *
- * @return {@code ContributionCommand.Continue} if further extensions should be processed,
- * {@code ContributionCommand.Stop} otherwise
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(25)
- protected ContributionCommand execGuiDetached() throws ProcessingException {
- return ContributionCommand.Continue;
- }
-
- /**
- * Called whenever a new outline has been activated on the core desktop.
- * <p>
- * Subclasses can override this method. The default simply returns {@link ContributionCommand.Continue}.
- *
- * @param oldOutline
- * old outline that was active before
- * @param newOutline
- * new outline that is active after the change
- * @return {@code ContributionCommand.Continue} if further extensions should be processed,
- * {@code ContributionCommand.Stop} otherwise
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(30)
- protected ContributionCommand execOutlineChanged(IOutline oldOutline, IOutline newOutline) throws ProcessingException {
- return ContributionCommand.Continue;
- }
-
- /**
- * Called right before a form is added to the core desktop. This means this method is called
- * before any UI is informed about the new form. The form is provided in a
- * holder. This allows it to prevent the form being added to the desktop (set
- * reference to {@code null}), do some general modifications needed to be done prior UI instantiation,
- * or even replace it with a different instance.
- * <p>
- * Subclasses can override this method. The default simply returns {@link ContributionCommand.Continue}.
- *
- * @param formHolder
- * contains the form that will be added to the core desktop
- * @return {@code ContributionCommand.Continue} if further extensions should be processed,
- * {@code ContributionCommand.Stop} otherwise
- */
- protected ContributionCommand execCustomFormModification(IHolder<IForm> formHolder) {
- return ContributionCommand.Continue;
- }
-
- /**
- * Called whenever a new page has been activated (selected) on the core desktop.
- * <p>
- * Subclasses can override this method. The default simply returns {@link ContributionCommand.Continue}.
- *
- * @param oldForm
- * is the search form of the old (not selected anymore) page or {@code null}
- * @param newForm
- * is the search form of the new (selected) page or {@code null}
- * @return {@code ContributionCommand.Continue} if further extensions should be processed,
- * {@code ContributionCommand.Stop} otherwise
- * @throws ProcessingException
- */
- @Order(40)
- @ConfigOperation
- protected ContributionCommand execPageSearchFormChanged(IForm oldForm, IForm newForm) throws ProcessingException {
- return ContributionCommand.Continue;
- }
-
- /**
- * Called whenever a new page has been activated (selected) on the core desktop.
- * <p>
- * Subclasses can override this method. The default simply returns {@link ContributionCommand.Continue}.
- *
- * @param oldForm
- * is the detail form of the old (not selected anymore) page or {@code null}
- * @param newForm
- * is the detail form of the new (selected) page or {@code null}
- * @return {@code ContributionCommand.Continue} if further extensions should be processed,
- * {@code ContributionCommand.Stop} otherwise
- * @throws ProcessingException
- */
- @Order(50)
- @ConfigOperation
- protected ContributionCommand execPageDetailFormChanged(IForm oldForm, IForm newForm) throws ProcessingException {
- return ContributionCommand.Continue;
- }
-
- /**
- * Called whenever a new page has been activated (selected) on the core desktop.
- * <p>
- * Subclasses can override this method. The default simply returns {@link ContributionCommand.Continue}.
- *
- * @param oldTable
- * is the table of the old (not selected anymore) table page or {@code null}
- * @param newTable
- * is the table of the new (selected) table page or {@code null}
- * @return {@code ContributionCommand.Continue} if further extensions should be processed,
- * {@code ContributionCommand.Stop} otherwise
- * @throws ProcessingException
- */
- @Order(60)
- @ConfigOperation
- protected ContributionCommand execPageDetailTableChanged(ITable oldTable, ITable newTable) throws ProcessingException {
- return ContributionCommand.Continue;
- }
-
- /**
- * Called after a table page was loaded or reloaded.
- * <p>
- * Subclasses can override this method. The default simply returns {@link ContributionCommand.Continue}.
- *
- * @param tablePage
- * the table page that has been (re)loaded
- * @return {@code ContributionCommand.Continue} if further extensions should be processed,
- * {@code ContributionCommand.Stop} otherwise
- * @throws ProcessingException
- */
- @Order(62)
- @ConfigOperation
- protected ContributionCommand execTablePageLoaded(IPageWithTable<?> tablePage) throws ProcessingException {
- return ContributionCommand.Continue;
- }
-
- /**
- * Called while the tray popup is being built. This method may call {@code getMenu(Class)} on the core desktop
- * to find an existing menu on the core desktop by class type.
- * <p>
- * The (potential) menus added to the {@code menus} list will be post processed. {@link IMenu#prepareAction()} is
- * called on each and then checked if the menu is visible.
- * <p>
- * Subclasses can override this method. The default simply returns {@link ContributionCommand.Continue}.
- *
- * @param menus
- * a live list to add menus to the tray
- * @return {@code ContributionCommand.Continue} if further extensions should be processed,
- * {@code ContributionCommand.Stop} otherwise
- * @throws ProcessingException
- */
- @Order(70)
- @ConfigOperation
- protected ContributionCommand execAddTrayMenus(List<IMenu> menus) throws ProcessingException {
- return ContributionCommand.Continue;
- }
-
- /**
- * Configures the outlines contributed by this desktop extension. These outlines
- * are automatically added to the core desktop which holds this extension.
- * <p>
- * Subclasses can override this method. Default is {@code null}.
- *
- * @return an array of outline type tokens
- * @see IOutline
- */
- @ConfigProperty(ConfigProperty.OUTLINES)
- @Order(20)
- @ConfigPropertyValue("null")
- protected Class<? extends IOutline>[] getConfiguredOutlines() {
- return null;
- }
-
- private Class<? extends IAction>[] getConfiguredActions() {
- Class<?>[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
- return ConfigurationUtility.filterClasses(dca, IAction.class);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.desktop;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.scout.commons.ConfigurationUtility;
+import org.eclipse.scout.commons.annotations.ConfigOperation;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.holders.IHolder;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.action.IAction;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+
+/**
+ * base implementation of {@link IDesktopExtension}
+ */
+public abstract class AbstractDesktopExtension implements IDesktopExtension {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractDesktopExtension.class);
+
+ private IDesktop m_coreDesktop;
+
+ public AbstractDesktopExtension() {
+ }
+
+ @Override
+ public ContributionCommand initDelegate() throws ProcessingException {
+ return execInit();
+ }
+
+ @Override
+ public ContributionCommand desktopOpenedDelegate() throws ProcessingException {
+ return execOpened();
+ }
+
+ @Override
+ public ContributionCommand desktopClosingDelegate() throws ProcessingException {
+ return execClosing();
+ }
+
+ @Override
+ public ContributionCommand guiAttachedDelegate() throws ProcessingException {
+ return execGuiAttached();
+ }
+
+ @Override
+ public ContributionCommand guiDetachedDelegate() throws ProcessingException {
+ return execGuiDetached();
+ }
+
+ @Override
+ public ContributionCommand outlineChangedDelegate(IOutline oldOutline, IOutline newOutline) throws ProcessingException {
+ return execOutlineChanged(oldOutline, newOutline);
+ }
+
+ @Override
+ public ContributionCommand customFormModificationDelegate(IHolder<IForm> formHolder) throws ProcessingException {
+ return execCustomFormModification(formHolder);
+ }
+
+ @Override
+ public ContributionCommand pageSearchFormChangedDelegate(IForm oldForm, IForm newForm) throws ProcessingException {
+ return execPageSearchFormChanged(oldForm, newForm);
+ }
+
+ @Override
+ public ContributionCommand pageDetailFormChangedDelegate(IForm oldForm, IForm newForm) throws ProcessingException {
+ return execPageDetailFormChanged(oldForm, newForm);
+ }
+
+ @Override
+ public ContributionCommand pageDetailTableChangedDelegate(ITable oldTable, ITable newTable) throws ProcessingException {
+ return execPageDetailTableChanged(oldTable, newTable);
+ }
+
+ @Override
+ public ContributionCommand tablePageLoadedDelegate(IPageWithTable<?> tablePage) throws ProcessingException {
+ return execTablePageLoaded(tablePage);
+ }
+
+ @Override
+ public ContributionCommand addTrayMenusDelegate(List<IMenu> menus) throws ProcessingException {
+ return execAddTrayMenus(menus);
+ }
+
+ @Override
+ public void contributeOutlines(Collection<IOutline> outlines) {
+ Class<? extends IOutline>[] array = getConfiguredOutlines();
+ if (array == null) {
+ return;
+ }
+ for (Class<? extends IOutline> element : array) {
+ try {
+ IOutline o = element.newInstance();
+ outlines.add(o);
+ }
+ catch (Throwable t) {
+ LOG.error(null, t);
+ }
+ }
+ }
+
+ @Override
+ public void contributeActions(Collection<IAction> actions) {
+ Class<? extends IAction>[] array = getConfiguredActions();
+ if (array == null) {
+ return;
+ }
+ for (Class<? extends IAction> element : array) {
+ try {
+ IAction a = ConfigurationUtility.newInnerInstance(this, element);
+ actions.add(a);
+ }
+ catch (Exception e) {
+ LOG.error(null, e);
+ }
+ }
+ }
+
+ @Override
+ public IDesktop getCoreDesktop() {
+ return m_coreDesktop;
+ }
+
+ @Override
+ public void setCoreDesktop(IDesktop desktop) {
+ m_coreDesktop = desktop;
+ }
+
+ /**
+ * Called while this desktop extension is initialized.
+ * <p>
+ * Subclasses can override this method. The default simply returns {@link ContributionCommand.Continue}.
+ *
+ * @return {@code ContributionCommand.Continue} if further extensions should be processed,
+ * {@code ContributionCommand.Stop} otherwise
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(10)
+ protected ContributionCommand execInit() throws ProcessingException {
+ return ContributionCommand.Continue;
+ }
+
+ /*
+ * Runtime
+ */
+
+ /**
+ * Called after the core desktop was opened and displayed on the GUI.
+ * <p>
+ * Subclasses can override this method. The default simply returns {@link ContributionCommand.Continue}.
+ *
+ * @return {@code ContributionCommand.Continue} if further extensions should be processed,
+ * {@code ContributionCommand.Stop} otherwise
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(12)
+ protected ContributionCommand execOpened() throws ProcessingException {
+ return ContributionCommand.Continue;
+ }
+
+ /**
+ * Called before the core desktop is being closed.
+ * <p>
+ * Subclasses can override this method. The default simply returns {@link ContributionCommand.Continue}.
+ *
+ * @return {@code ContributionCommand.Continue} if further extensions should be processed,
+ * {@code ContributionCommand.Stop} otherwise
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(15)
+ protected ContributionCommand execClosing() throws ProcessingException {
+ return ContributionCommand.Continue;
+ }
+
+ /**
+ * Called after a UI has been attached to the core desktop. The desktop must not necessarily be open.
+ * <p>
+ * Subclasses can override this method. The default simply returns {@link ContributionCommand.Continue}.
+ *
+ * @return {@code ContributionCommand.Continue} if further extensions should be processed,
+ * {@code ContributionCommand.Stop} otherwise
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(20)
+ protected ContributionCommand execGuiAttached() throws ProcessingException {
+ return ContributionCommand.Continue;
+ }
+
+ /**
+ * Called after a UI has been detached from the core desktop. The desktop must not necessarily be open.
+ * <p>
+ * Subclasses can override this method. The default simply returns {@link ContributionCommand.Continue}.
+ *
+ * @return {@code ContributionCommand.Continue} if further extensions should be processed,
+ * {@code ContributionCommand.Stop} otherwise
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(25)
+ protected ContributionCommand execGuiDetached() throws ProcessingException {
+ return ContributionCommand.Continue;
+ }
+
+ /**
+ * Called whenever a new outline has been activated on the core desktop.
+ * <p>
+ * Subclasses can override this method. The default simply returns {@link ContributionCommand.Continue}.
+ *
+ * @param oldOutline
+ * old outline that was active before
+ * @param newOutline
+ * new outline that is active after the change
+ * @return {@code ContributionCommand.Continue} if further extensions should be processed,
+ * {@code ContributionCommand.Stop} otherwise
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(30)
+ protected ContributionCommand execOutlineChanged(IOutline oldOutline, IOutline newOutline) throws ProcessingException {
+ return ContributionCommand.Continue;
+ }
+
+ /**
+ * Called right before a form is added to the core desktop. This means this method is called
+ * before any UI is informed about the new form. The form is provided in a
+ * holder. This allows it to prevent the form being added to the desktop (set
+ * reference to {@code null}), do some general modifications needed to be done prior UI instantiation,
+ * or even replace it with a different instance.
+ * <p>
+ * Subclasses can override this method. The default simply returns {@link ContributionCommand.Continue}.
+ *
+ * @param formHolder
+ * contains the form that will be added to the core desktop
+ * @return {@code ContributionCommand.Continue} if further extensions should be processed,
+ * {@code ContributionCommand.Stop} otherwise
+ */
+ protected ContributionCommand execCustomFormModification(IHolder<IForm> formHolder) {
+ return ContributionCommand.Continue;
+ }
+
+ /**
+ * Called whenever a new page has been activated (selected) on the core desktop.
+ * <p>
+ * Subclasses can override this method. The default simply returns {@link ContributionCommand.Continue}.
+ *
+ * @param oldForm
+ * is the search form of the old (not selected anymore) page or {@code null}
+ * @param newForm
+ * is the search form of the new (selected) page or {@code null}
+ * @return {@code ContributionCommand.Continue} if further extensions should be processed,
+ * {@code ContributionCommand.Stop} otherwise
+ * @throws ProcessingException
+ */
+ @Order(40)
+ @ConfigOperation
+ protected ContributionCommand execPageSearchFormChanged(IForm oldForm, IForm newForm) throws ProcessingException {
+ return ContributionCommand.Continue;
+ }
+
+ /**
+ * Called whenever a new page has been activated (selected) on the core desktop.
+ * <p>
+ * Subclasses can override this method. The default simply returns {@link ContributionCommand.Continue}.
+ *
+ * @param oldForm
+ * is the detail form of the old (not selected anymore) page or {@code null}
+ * @param newForm
+ * is the detail form of the new (selected) page or {@code null}
+ * @return {@code ContributionCommand.Continue} if further extensions should be processed,
+ * {@code ContributionCommand.Stop} otherwise
+ * @throws ProcessingException
+ */
+ @Order(50)
+ @ConfigOperation
+ protected ContributionCommand execPageDetailFormChanged(IForm oldForm, IForm newForm) throws ProcessingException {
+ return ContributionCommand.Continue;
+ }
+
+ /**
+ * Called whenever a new page has been activated (selected) on the core desktop.
+ * <p>
+ * Subclasses can override this method. The default simply returns {@link ContributionCommand.Continue}.
+ *
+ * @param oldTable
+ * is the table of the old (not selected anymore) table page or {@code null}
+ * @param newTable
+ * is the table of the new (selected) table page or {@code null}
+ * @return {@code ContributionCommand.Continue} if further extensions should be processed,
+ * {@code ContributionCommand.Stop} otherwise
+ * @throws ProcessingException
+ */
+ @Order(60)
+ @ConfigOperation
+ protected ContributionCommand execPageDetailTableChanged(ITable oldTable, ITable newTable) throws ProcessingException {
+ return ContributionCommand.Continue;
+ }
+
+ /**
+ * Called after a table page was loaded or reloaded.
+ * <p>
+ * Subclasses can override this method. The default simply returns {@link ContributionCommand.Continue}.
+ *
+ * @param tablePage
+ * the table page that has been (re)loaded
+ * @return {@code ContributionCommand.Continue} if further extensions should be processed,
+ * {@code ContributionCommand.Stop} otherwise
+ * @throws ProcessingException
+ */
+ @Order(62)
+ @ConfigOperation
+ protected ContributionCommand execTablePageLoaded(IPageWithTable<?> tablePage) throws ProcessingException {
+ return ContributionCommand.Continue;
+ }
+
+ /**
+ * Called while the tray popup is being built. This method may call {@code getMenu(Class)} on the core desktop
+ * to find an existing menu on the core desktop by class type.
+ * <p>
+ * The (potential) menus added to the {@code menus} list will be post processed. {@link IMenu#prepareAction()} is
+ * called on each and then checked if the menu is visible.
+ * <p>
+ * Subclasses can override this method. The default simply returns {@link ContributionCommand.Continue}.
+ *
+ * @param menus
+ * a live list to add menus to the tray
+ * @return {@code ContributionCommand.Continue} if further extensions should be processed,
+ * {@code ContributionCommand.Stop} otherwise
+ * @throws ProcessingException
+ */
+ @Order(70)
+ @ConfigOperation
+ protected ContributionCommand execAddTrayMenus(List<IMenu> menus) throws ProcessingException {
+ return ContributionCommand.Continue;
+ }
+
+ /**
+ * Configures the outlines contributed by this desktop extension. These outlines
+ * are automatically added to the core desktop which holds this extension.
+ * <p>
+ * Subclasses can override this method. Default is {@code null}.
+ *
+ * @return an array of outline type tokens
+ * @see IOutline
+ */
+ @ConfigProperty(ConfigProperty.OUTLINES)
+ @Order(20)
+ @ConfigPropertyValue("null")
+ protected Class<? extends IOutline>[] getConfiguredOutlines() {
+ return null;
+ }
+
+ private Class<? extends IAction>[] getConfiguredActions() {
+ Class<?>[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
+ return ConfigurationUtility.filterClasses(dca, IAction.class);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/ContributionCommand.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/ContributionCommand.java
index c369b29bb7..c03471440e 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/ContributionCommand.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/ContributionCommand.java
@@ -1,27 +1,27 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.desktop;
-
-/**
- * The command that decides how to continue after calling a contribution
- */
-public enum ContributionCommand {
- /**
- * returning this value in a contributed method is the default and execution continues and calls the next extension.
- */
- Continue,
- /**
- * returning this value in a contributed method, disables calling further extensions
- * <p>
- * Be careful when returning this value, since it prevents other extensions from being called.
- */
- Stop,
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.desktop;
+
+/**
+ * The command that decides how to continue after calling a contribution
+ */
+public enum ContributionCommand {
+ /**
+ * returning this value in a contributed method is the default and execution continues and calls the next extension.
+ */
+ Continue,
+ /**
+ * returning this value in a contributed method, disables calling further extensions
+ * <p>
+ * Be careful when returning this value, since it prevents other extensions from being called.
+ */
+ Stop,
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/DesktopEvent.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/DesktopEvent.java
index 7eada2da76..3f2e1de76a 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/DesktopEvent.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/DesktopEvent.java
@@ -1,263 +1,263 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.desktop;
-
-import java.io.File;
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.EventObject;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.basic.filechooser.IFileChooser;
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.ISearchForm;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.client.ui.form.PrintDevice;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.messagebox.IMessageBox;
-
-public class DesktopEvent extends EventObject {
- private static final long serialVersionUID = 1L;
-
- public static final int TYPE_DESKTOP_CLOSED = 100;
- /**
- * A new page is activated
- */
- public static final int TYPE_OUTLINE_CHANGED = 200;
- public static final int TYPE_FORM_ADDED = 600;
- /**
- * Necessary for page forms that "close" in the gui even if they are not
- * closed in model
- */
- public static final int TYPE_FORM_REMOVED = 610;
- public static final int TYPE_FORM_ENSURE_VISIBLE = 620;
- public static final int TYPE_MESSAGE_BOX_ADDED = 700;
- /**
- * print a form using properties printDevice, printParameters
- */
- public static final int TYPE_PRINT = 900;
- /**
- *
- */
- public static final int TYPE_PRINTED = 901;
- public static final int TYPE_FILE_CHOOSER_ADDED = 910;
- /**
- * Creates and opens a browser window to download a file or open an url via user interface (only supported in web ui),
- * see {@link IDesktop#openBrowserWindow(String)}
- */
- public static final int TYPE_OPEN_BROWSER_WINDOW = 920;
- /**
- * Send a broadcast event to find the {@link IFormField} that owns the focus
- * The listener can store the result using {@link #setFocusedField()} The event waits some time to give asynchronous
- * jobs a chance to complete (default is 2000 ms)
- */
- public static final int TYPE_FIND_FOCUS_OWNER = 1000;
- /**
- * Broadcast request to add all popup menus for the tray menu
- * collector: popupMenus
- */
- public static final int TYPE_TRAY_POPUP = 1010;
-
- private final int m_type;
- private IOutline m_outline;
- private IForm m_form;
- private IFormField m_focusedField;
- private IMessageBox m_messageBox;
- private IFileChooser m_fileChooser;
- private String m_path;
- private PrintDevice m_printDevice;
- private Map<String, Object> m_printParameters;
- private List<IMenu> m_popupMenus;
- private File m_printedFile;
-
- public DesktopEvent(IDesktop source, int type) {
- super(source);
- m_type = type;
- }
-
- public DesktopEvent(IDesktop source, int type, File printedFile) {
- this(source, type);
- m_printedFile = printedFile;
- }
-
- public DesktopEvent(IDesktop source, int type, IForm form) {
- this(source, type);
- m_form = form;
- }
-
- public DesktopEvent(IDesktop source, int type, IMessageBox messageBox) {
- this(source, type);
- m_messageBox = messageBox;
- }
-
- public DesktopEvent(IDesktop source, int type, IOutline outline) {
- this(source, type);
- m_outline = outline;
- }
-
- public DesktopEvent(IDesktop source, int type, IFileChooser fc) {
- this(source, type);
- m_fileChooser = fc;
- }
-
- public DesktopEvent(IDesktop source, int type, String path) {
- this(source, type);
- m_path = path;
- }
-
- public DesktopEvent(IDesktop source, int type, PrintDevice printDevice, Map<String, Object> printParameters) {
- super(source);
- m_type = type;
- m_printDevice = printDevice;
- m_printParameters = printParameters;
- }
-
- public IDesktop getDesktop() {
- return (IDesktop) getSource();
- }
-
- public int getType() {
- return m_type;
- }
-
- public IForm getForm() {
- return m_form;
- }
-
- public ISearchForm getSearchForm() {
- return (ISearchForm) m_form;
- }
-
- public IForm getDetailForm() {
- return m_form;
- }
-
- public IFileChooser getFileChooser() {
- return m_fileChooser;
- }
-
- public String getPath() {
- return m_path;
- }
-
- public IMessageBox getMessageBox() {
- return m_messageBox;
- }
-
- public IOutline getOutline() {
- return m_outline;
- }
-
- public IFormField getFocusedField() {
- return m_focusedField;
- }
-
- public void setFocusedField(IFormField f) {
- m_focusedField = f;
- }
-
- public PrintDevice getPrintDevice() {
- return m_printDevice;
- }
-
- public File getPrintedFile() {
- return m_printedFile;
- }
-
- /**
- * used by TYPE_TRAY_POPUP to add menus
- */
- public void addPopupMenu(IMenu menu) {
- if (menu != null) {
- if (m_popupMenus == null) {
- m_popupMenus = new ArrayList<IMenu>();
- }
- m_popupMenus.add(menu);
- }
- }
-
- /**
- * used by TYPE_TRAY_POPUP to add menus
- */
- public void addPopupMenus(IMenu[] menus) {
- if (menus != null) {
- if (m_popupMenus == null) {
- m_popupMenus = new ArrayList<IMenu>();
- }
- m_popupMenus.addAll(Arrays.asList(menus));
- }
- }
-
- /**
- * used by TYPE_TRAY_POPUP to add menus
- */
- public IMenu[] getPopupMenus() {
- if (m_popupMenus != null) {
- return m_popupMenus.toArray(new IMenu[0]);
- }
- else {
- return new IMenu[0];
- }
- }
-
- /**
- * used by TYPE_TRAY_POPUP to add menus
- */
- public int getPopupMenuCount() {
- if (m_popupMenus != null) {
- return m_popupMenus.size();
- }
- else {
- return 0;
- }
- }
-
- public Map<String, Object> getPrintParameters() {
- return new HashMap<String, Object>(m_printParameters);
- }
-
- @Override
- public String toString() {
- StringBuffer buf = new StringBuffer();
- buf.append(getClass().getSimpleName() + "[");
- // decode type
- try {
- Field[] f = getClass().getDeclaredFields();
- for (int i = 0; i < f.length; i++) {
- if (Modifier.isPublic(f[i].getModifiers()) && Modifier.isStatic(f[i].getModifiers()) && f[i].getName().startsWith("TYPE_")) {
- if (((Number) f[i].get(null)).intValue() == m_type) {
- buf.append(f[i].getName());
- break;
- }
- }
- }
- }
- catch (Throwable t) {
- buf.append("#" + m_type);
- }
- if (m_form != null) {
- buf.append(" " + m_form.getTitle());
- }
- if (m_messageBox != null) {
- buf.append(" " + m_messageBox.getTitle());
- }
- if (m_outline != null) {
- buf.append(" " + m_outline.getRootNode().getCell().getText());
- }
- buf.append("]");
- return buf.toString();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.desktop;
+
+import java.io.File;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.EventObject;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.basic.filechooser.IFileChooser;
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.ISearchForm;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.client.ui.form.PrintDevice;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.messagebox.IMessageBox;
+
+public class DesktopEvent extends EventObject {
+ private static final long serialVersionUID = 1L;
+
+ public static final int TYPE_DESKTOP_CLOSED = 100;
+ /**
+ * A new page is activated
+ */
+ public static final int TYPE_OUTLINE_CHANGED = 200;
+ public static final int TYPE_FORM_ADDED = 600;
+ /**
+ * Necessary for page forms that "close" in the gui even if they are not
+ * closed in model
+ */
+ public static final int TYPE_FORM_REMOVED = 610;
+ public static final int TYPE_FORM_ENSURE_VISIBLE = 620;
+ public static final int TYPE_MESSAGE_BOX_ADDED = 700;
+ /**
+ * print a form using properties printDevice, printParameters
+ */
+ public static final int TYPE_PRINT = 900;
+ /**
+ *
+ */
+ public static final int TYPE_PRINTED = 901;
+ public static final int TYPE_FILE_CHOOSER_ADDED = 910;
+ /**
+ * Creates and opens a browser window to download a file or open an url via user interface (only supported in web ui),
+ * see {@link IDesktop#openBrowserWindow(String)}
+ */
+ public static final int TYPE_OPEN_BROWSER_WINDOW = 920;
+ /**
+ * Send a broadcast event to find the {@link IFormField} that owns the focus
+ * The listener can store the result using {@link #setFocusedField()} The event waits some time to give asynchronous
+ * jobs a chance to complete (default is 2000 ms)
+ */
+ public static final int TYPE_FIND_FOCUS_OWNER = 1000;
+ /**
+ * Broadcast request to add all popup menus for the tray menu
+ * collector: popupMenus
+ */
+ public static final int TYPE_TRAY_POPUP = 1010;
+
+ private final int m_type;
+ private IOutline m_outline;
+ private IForm m_form;
+ private IFormField m_focusedField;
+ private IMessageBox m_messageBox;
+ private IFileChooser m_fileChooser;
+ private String m_path;
+ private PrintDevice m_printDevice;
+ private Map<String, Object> m_printParameters;
+ private List<IMenu> m_popupMenus;
+ private File m_printedFile;
+
+ public DesktopEvent(IDesktop source, int type) {
+ super(source);
+ m_type = type;
+ }
+
+ public DesktopEvent(IDesktop source, int type, File printedFile) {
+ this(source, type);
+ m_printedFile = printedFile;
+ }
+
+ public DesktopEvent(IDesktop source, int type, IForm form) {
+ this(source, type);
+ m_form = form;
+ }
+
+ public DesktopEvent(IDesktop source, int type, IMessageBox messageBox) {
+ this(source, type);
+ m_messageBox = messageBox;
+ }
+
+ public DesktopEvent(IDesktop source, int type, IOutline outline) {
+ this(source, type);
+ m_outline = outline;
+ }
+
+ public DesktopEvent(IDesktop source, int type, IFileChooser fc) {
+ this(source, type);
+ m_fileChooser = fc;
+ }
+
+ public DesktopEvent(IDesktop source, int type, String path) {
+ this(source, type);
+ m_path = path;
+ }
+
+ public DesktopEvent(IDesktop source, int type, PrintDevice printDevice, Map<String, Object> printParameters) {
+ super(source);
+ m_type = type;
+ m_printDevice = printDevice;
+ m_printParameters = printParameters;
+ }
+
+ public IDesktop getDesktop() {
+ return (IDesktop) getSource();
+ }
+
+ public int getType() {
+ return m_type;
+ }
+
+ public IForm getForm() {
+ return m_form;
+ }
+
+ public ISearchForm getSearchForm() {
+ return (ISearchForm) m_form;
+ }
+
+ public IForm getDetailForm() {
+ return m_form;
+ }
+
+ public IFileChooser getFileChooser() {
+ return m_fileChooser;
+ }
+
+ public String getPath() {
+ return m_path;
+ }
+
+ public IMessageBox getMessageBox() {
+ return m_messageBox;
+ }
+
+ public IOutline getOutline() {
+ return m_outline;
+ }
+
+ public IFormField getFocusedField() {
+ return m_focusedField;
+ }
+
+ public void setFocusedField(IFormField f) {
+ m_focusedField = f;
+ }
+
+ public PrintDevice getPrintDevice() {
+ return m_printDevice;
+ }
+
+ public File getPrintedFile() {
+ return m_printedFile;
+ }
+
+ /**
+ * used by TYPE_TRAY_POPUP to add menus
+ */
+ public void addPopupMenu(IMenu menu) {
+ if (menu != null) {
+ if (m_popupMenus == null) {
+ m_popupMenus = new ArrayList<IMenu>();
+ }
+ m_popupMenus.add(menu);
+ }
+ }
+
+ /**
+ * used by TYPE_TRAY_POPUP to add menus
+ */
+ public void addPopupMenus(IMenu[] menus) {
+ if (menus != null) {
+ if (m_popupMenus == null) {
+ m_popupMenus = new ArrayList<IMenu>();
+ }
+ m_popupMenus.addAll(Arrays.asList(menus));
+ }
+ }
+
+ /**
+ * used by TYPE_TRAY_POPUP to add menus
+ */
+ public IMenu[] getPopupMenus() {
+ if (m_popupMenus != null) {
+ return m_popupMenus.toArray(new IMenu[0]);
+ }
+ else {
+ return new IMenu[0];
+ }
+ }
+
+ /**
+ * used by TYPE_TRAY_POPUP to add menus
+ */
+ public int getPopupMenuCount() {
+ if (m_popupMenus != null) {
+ return m_popupMenus.size();
+ }
+ else {
+ return 0;
+ }
+ }
+
+ public Map<String, Object> getPrintParameters() {
+ return new HashMap<String, Object>(m_printParameters);
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer buf = new StringBuffer();
+ buf.append(getClass().getSimpleName() + "[");
+ // decode type
+ try {
+ Field[] f = getClass().getDeclaredFields();
+ for (int i = 0; i < f.length; i++) {
+ if (Modifier.isPublic(f[i].getModifiers()) && Modifier.isStatic(f[i].getModifiers()) && f[i].getName().startsWith("TYPE_")) {
+ if (((Number) f[i].get(null)).intValue() == m_type) {
+ buf.append(f[i].getName());
+ break;
+ }
+ }
+ }
+ }
+ catch (Throwable t) {
+ buf.append("#" + m_type);
+ }
+ if (m_form != null) {
+ buf.append(" " + m_form.getTitle());
+ }
+ if (m_messageBox != null) {
+ buf.append(" " + m_messageBox.getTitle());
+ }
+ if (m_outline != null) {
+ buf.append(" " + m_outline.getRootNode().getCell().getText());
+ }
+ buf.append("]");
+ return buf.toString();
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/DesktopListener.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/DesktopListener.java
index 1d88e2d9ef..f1efa0e49f 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/DesktopListener.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/DesktopListener.java
@@ -1,17 +1,17 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.desktop;
-
-import java.util.EventListener;
-
-public interface DesktopListener extends EventListener {
- void desktopChanged(DesktopEvent e);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.desktop;
+
+import java.util.EventListener;
+
+public interface DesktopListener extends EventListener {
+ void desktopChanged(DesktopEvent e);
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/IDesktop.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/IDesktop.java
index ce2a2d7ba9..3bb5089be2 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/IDesktop.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/IDesktop.java
@@ -1,439 +1,439 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.desktop;
-
-import java.beans.PropertyChangeListener;
-import java.util.Map;
-
-import org.eclipse.scout.commons.beans.IPropertyObserver;
-import org.eclipse.scout.commons.exception.IProcessingStatus;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.DataChangeListener;
-import org.eclipse.scout.rt.client.ui.action.ActionFinder;
-import org.eclipse.scout.rt.client.ui.action.IAction;
-import org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke;
-import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.action.tool.IToolButton;
-import org.eclipse.scout.rt.client.ui.action.view.IViewButton;
-import org.eclipse.scout.rt.client.ui.basic.filechooser.IFileChooser;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutlineTableForm;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.AbstractPage;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
-import org.eclipse.scout.rt.client.ui.form.AbstractForm;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.client.ui.form.PrintDevice;
-import org.eclipse.scout.rt.client.ui.form.fields.AbstractFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.messagebox.IMessageBox;
-import org.eclipse.scout.rt.shared.services.common.bookmark.Bookmark;
-
-/**
- * The desktop model (may) consist of
- * <ul>
- * <li>set of available outline
- * <li>active outline
- * <li>active tableview
- * <li>active detail form
- * <li>active search form
- * <li>form stack (swing: dialogs on desktop as JInternalFrames; eclipse: editors or views)
- * <li>dialog stack of model and non-modal dialogs (swing: dialogs as JDialog, JFrame; eclipse: dialogs in a new Shell)
- * <li>active message box stack
- * <li>top-level menus (menu tree)
- * </ul>
- */
-public interface IDesktop extends IPropertyObserver {
- /**
- * String
- */
- String PROP_TITLE = "title";
- /**
- * {@link IProcessingStatus}
- */
- String PROP_STATUS = "status";
- /**
- * {@link IKeyStroke}[]
- */
- String PROP_KEY_STROKES = "keyStrokes";
- /**
- * {@link Boolean}
- */
- String PROP_OPENED = "opened";
- /**
- * {@link Boolean}
- */
- String PROP_GUI_AVAILABLE = "guiAvailable";
-
- void initDesktop() throws ProcessingException;
-
- <T extends IForm> T findForm(Class<T> formType);
-
- <T extends IForm> T[] findForms(Class<T> formType);
-
- <T extends IForm> T findLastActiveForm(Class<T> formType);
-
- /**
- * @return an available outline of this type ({@link #getAvailableOutlines()}
- */
- <T extends IOutline> T findOutline(Class<T> outlineType);
-
- /**
- * Find a toolButton or a viewButton in the desktop
- */
- <T extends IAction> T findAction(Class<T> actionType);
-
- /**
- * Convenience alias for {@link #findAction(Class)}
- */
- <T extends IToolButton> T findToolButton(Class<T> toolButtonType);
-
- /**
- * Convenience alias for {@link #findAction(Class)}
- */
- <T extends IViewButton> T findViewButton(Class<T> viewButtonType);
-
- boolean isTrayVisible();
-
- void setTrayVisible(boolean b);
-
- /**
- * @param form
- * @return all forms except the searchform and the current detail form with
- * the same fully qualified classname and the same primary key.
- */
- IForm[] getSimilarViewForms(IForm form);
-
- /**
- * @return the {@link IFormField} that owns the focus
- */
- IFormField getFocusOwner();
-
- /**
- * fires a ensure visible event for every form in viewStack
- */
- void ensureViewStackVisible();
-
- /**
- * fires a ensure visible event
- *
- * @param form
- */
- void ensureVisible(IForm form);
-
- /**
- * DISPLAY_HINT_VIEW
- */
- IForm[] getViewStack();
-
- /**
- * DISPLAY_HINT_DIALOG
- */
- IForm[] getDialogStack();
-
- /**
- * add form to desktop and notify attached listeners (incl. gui)
- */
- void addForm(IForm form);
-
- /**
- * remove form from desktop and notify attached listeners (incl. gui)
- */
- void removeForm(IForm form);
-
- IMessageBox[] getMessageBoxStack();
-
- void addMessageBox(IMessageBox mb);
-
- IOutline[] getAvailableOutlines();
-
- void setAvailableOutlines(IOutline[] availableOutlines);
-
- IKeyStroke[] getKeyStrokes();
-
- void setKeyStrokes(IKeyStroke[] ks);
-
- void addKeyStrokes(IKeyStroke... keyStrokes);
-
- void removeKeyStrokes(IKeyStroke... keyStrokes);
-
- /**
- * @return true if the form is currently attached to the desktop, false if the
- * form is not attached to the desktop<br>
- * This method can be used to determine if a possibly active form
- * (started with a running form handler) is currently showing on the
- * desktop.
- */
- boolean isShowing(IForm form);
-
- /**
- * @return true after desktop was opened and setup in any UI.
- */
- boolean isOpened();
-
- /**
- * @return the currently active outline on the desktop
- */
- IOutline getOutline();
-
- /**
- * set the currently active outline on the desktop
- */
- void setOutline(IOutline outline);
-
- /**
- * set the currently active outline on the desktop using its type
- */
- void setOutline(Class<? extends IOutline> outlineType);
-
- /**
- * Call this method to refresh all existing pages in all outlines<br>
- * If currently active page(s) are affected they reload their data, otherwise
- * the pages is simply marked dirty and reloaded on next activation
- */
- void refreshPages(Class... pageTypes);
-
- /**
- * add Property Observer
- */
- @Override
- void addPropertyChangeListener(PropertyChangeListener listener);
-
- @Override
- void removePropertyChangeListener(PropertyChangeListener listener);
-
- /**
- * add Property Observer
- */
- @Override
- void addPropertyChangeListener(String propertyName, PropertyChangeListener listener);
-
- @Override
- void removePropertyChangeListener(String propertyName, PropertyChangeListener listener);
-
- /**
- * add Model Observer
- */
- void addDesktopListener(DesktopListener l);
-
- void removeDesktopListener(DesktopListener l);
-
- /**
- * add Data Change Observer
- */
- void addDataChangeListener(DataChangeListener listener, Object... dataTypes);
-
- void removeDataChangeListener(DataChangeListener listener, Object... dataTypes);
-
- /**
- * Call this method to refresh all listeners on that dataTypes.<br>
- * These might include pages, forms, fields etc.<br>
- *
- * @see {@link AbstractForm#execDataChanged(Object...)} {@link AbstractForm#execDataChanged(Object...)}
- * {@link AbstractFormField#execDataChanged(Object...)} {@link AbstractFormField#execDataChanged(Object...)}
- * {@link AbstractPage#execDataChanged(Object...)} {@link AbstractPage#execDataChanged(Object...)}
- */
- void dataChanged(Object... dataTypes);
-
- /**
- * Called after a page was loaded or reloaded.
- * <p>
- * Default minimizes page search form when data was found.
- *
- * @param page
- */
- void afterTablePageLoaded(IPageWithTable<?> page) throws ProcessingException;
-
- /**
- * Unload and release unused pages in all outlines, such as closed and
- * non-selected nodes
- */
- void releaseUnusedPages();
-
- /**
- * @return the top level menus
- * <p>
- * normally presented in the menubar
- */
- IMenu[] getMenus();
-
- /**
- * Convenience to find a menu in the desktop, uses {@link ActionFinder}
- */
- <T extends IMenu> T getMenu(Class<? extends T> searchType);
-
- /**
- * Prepare all (menubar) menus on the desktop.<br>
- * Calls {@link AbstractMenu#execPrepareAction()} on every menu in the menu
- * tree recursively
- */
- void prepareAllMenus();
-
- /**
- * @return all actions including keyStroke, menu, toolButton and viewButton
- */
- IAction[] getActions();
-
- /**
- * @return all {@link IToolButton} actions
- */
- IToolButton[] getToolButtons();
-
- /**
- * @return all {@link IViewButton} actions
- */
- IViewButton[] getViewButtons();
-
- /**
- * @return the detail form of the active (selected) page {@link IPage#getDetailForm()} of the active outline
- * {@link IOutline#getDetailForm()}
- */
- IForm getPageDetailForm();
-
- /**
- * see {@link #getPageDetailForm()}, {@link AbstractDesktop#execChangedPageDetailForm(IForm)}
- */
- void setPageDetailForm(IForm f);
-
- /**
- * @return the detail table of the active (selected) page {@link IPage#getDetailTable()} of the active outline
- * {@link IOutline#getDetailTable()}
- */
- ITable getPageDetailTable();
-
- /**
- * see {@link #getPageDetailTable()}, {@link AbstractDesktop#execChangedPageDetailTable(IForm)}
- */
- void setPageDetailTable(ITable t);
-
- /**
- * @return the form that displays the table of the (selected) page {@link IPage#getTable()} of the active outline
- * {@link IOutline#getDetailTable()}<br>
- * @see {@link #isOutlineTableFormVisible()}
- */
- IOutlineTableForm getOutlineTableForm();
-
- /**
- * set the detail table form of the active (selected) page {@link IPage#getTable()} of the active outline
- * {@link IOutline#getDetailTable()}
- *
- * @see {@link #setOutlineTableFormVisible(boolean)}
- */
- void setOutlineTableForm(IOutlineTableForm f);
-
- /**
- * @return true if the outline table form is visible
- */
- boolean isOutlineTableFormVisible();
-
- /**
- * set the detail table form of the active (selected) page {@link IPage#getTable()} of the active outline
- * {@link IOutline#getDetailTable()}
- */
- void setOutlineTableFormVisible(boolean b);
-
- /**
- * @return the search form of the active (selected) page {@link IPageWithTable#getSearchFormInternal()} of the active
- * outline {@link IOutline#getSearchForm()}
- */
- IForm getPageSearchForm();
-
- /**
- * see {@link #getPageSearchForm()}, {@link AbstractDesktop#execChangedPageSearchForm(IForm)}
- */
- void setPageSearchForm(IForm f);
-
- String getTitle();
-
- void setTitle(String s);
-
- /**
- * @return true: automatically prefix a * on any text field's search value
- */
- boolean isAutoPrefixWildcardForTextSearch();
-
- void setAutoPrefixWildcardForTextSearch(boolean b);
-
- /**
- * get the status of the desktop
- * <p>
- * see also {@link IForm#getFormStatus(IProcessingStatus)}
- */
- IProcessingStatus getStatus();
-
- /**
- * set a status on the desktop
- * <p>
- * this is normally displayed in as a tray message box
- * <p>
- * see also {@link IForm#setFormStatus(IProcessingStatus)}
- */
- void setStatus(IProcessingStatus status);
-
- /**
- * set a status on the desktop
- * <p>
- * this is normally displayed in as a tray message box
- * <p>
- * see also {@link IForm#setFormStatusText(String)}
- */
- void setStatusText(String s);
-
- /**
- * Retrieve files via a user interface
- */
- void addFileChooser(IFileChooser fc);
-
- /**
- * Creates and opens a browser window to download a file or open an url via user interface (only in web ui)
- */
- void openBrowserWindow(String path);
-
- /**
- * Prints the desktop
- * <p>
- * The method returns immediately, the print is done int the background.
- * <p>
- * For details and parameter details see {@link PrintDevice}
- */
- void printDesktop(PrintDevice device, Map<String, Object> parameters);
-
- /**
- * Activates a bookmark
- */
- void activateBookmark(Bookmark bm, boolean forceReload) throws ProcessingException;
-
- /**
- * Creates a bookmark of the active page
- */
- Bookmark createBookmark() throws ProcessingException;
-
- /**
- * Creates a bookmark of the given page
- *
- * @since 3.8.0
- */
- Bookmark createBookmark(IPage page) throws ProcessingException;
-
- /**
- * do not use this internal method.<br>
- * for closing scout see <code>ClientScoutSession.getSession().close()</code>
- */
- void closeInternal() throws ProcessingException;
-
- IDesktopUIFacade getUIFacade();
-
- boolean isGuiAvailable();
-
- void changeVisibilityAfterOfflineSwitch();
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.desktop;
+
+import java.beans.PropertyChangeListener;
+import java.util.Map;
+
+import org.eclipse.scout.commons.beans.IPropertyObserver;
+import org.eclipse.scout.commons.exception.IProcessingStatus;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.DataChangeListener;
+import org.eclipse.scout.rt.client.ui.action.ActionFinder;
+import org.eclipse.scout.rt.client.ui.action.IAction;
+import org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke;
+import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.action.tool.IToolButton;
+import org.eclipse.scout.rt.client.ui.action.view.IViewButton;
+import org.eclipse.scout.rt.client.ui.basic.filechooser.IFileChooser;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutlineTableForm;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.AbstractPage;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
+import org.eclipse.scout.rt.client.ui.form.AbstractForm;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.client.ui.form.PrintDevice;
+import org.eclipse.scout.rt.client.ui.form.fields.AbstractFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.messagebox.IMessageBox;
+import org.eclipse.scout.rt.shared.services.common.bookmark.Bookmark;
+
+/**
+ * The desktop model (may) consist of
+ * <ul>
+ * <li>set of available outline
+ * <li>active outline
+ * <li>active tableview
+ * <li>active detail form
+ * <li>active search form
+ * <li>form stack (swing: dialogs on desktop as JInternalFrames; eclipse: editors or views)
+ * <li>dialog stack of model and non-modal dialogs (swing: dialogs as JDialog, JFrame; eclipse: dialogs in a new Shell)
+ * <li>active message box stack
+ * <li>top-level menus (menu tree)
+ * </ul>
+ */
+public interface IDesktop extends IPropertyObserver {
+ /**
+ * String
+ */
+ String PROP_TITLE = "title";
+ /**
+ * {@link IProcessingStatus}
+ */
+ String PROP_STATUS = "status";
+ /**
+ * {@link IKeyStroke}[]
+ */
+ String PROP_KEY_STROKES = "keyStrokes";
+ /**
+ * {@link Boolean}
+ */
+ String PROP_OPENED = "opened";
+ /**
+ * {@link Boolean}
+ */
+ String PROP_GUI_AVAILABLE = "guiAvailable";
+
+ void initDesktop() throws ProcessingException;
+
+ <T extends IForm> T findForm(Class<T> formType);
+
+ <T extends IForm> T[] findForms(Class<T> formType);
+
+ <T extends IForm> T findLastActiveForm(Class<T> formType);
+
+ /**
+ * @return an available outline of this type ({@link #getAvailableOutlines()}
+ */
+ <T extends IOutline> T findOutline(Class<T> outlineType);
+
+ /**
+ * Find a toolButton or a viewButton in the desktop
+ */
+ <T extends IAction> T findAction(Class<T> actionType);
+
+ /**
+ * Convenience alias for {@link #findAction(Class)}
+ */
+ <T extends IToolButton> T findToolButton(Class<T> toolButtonType);
+
+ /**
+ * Convenience alias for {@link #findAction(Class)}
+ */
+ <T extends IViewButton> T findViewButton(Class<T> viewButtonType);
+
+ boolean isTrayVisible();
+
+ void setTrayVisible(boolean b);
+
+ /**
+ * @param form
+ * @return all forms except the searchform and the current detail form with
+ * the same fully qualified classname and the same primary key.
+ */
+ IForm[] getSimilarViewForms(IForm form);
+
+ /**
+ * @return the {@link IFormField} that owns the focus
+ */
+ IFormField getFocusOwner();
+
+ /**
+ * fires a ensure visible event for every form in viewStack
+ */
+ void ensureViewStackVisible();
+
+ /**
+ * fires a ensure visible event
+ *
+ * @param form
+ */
+ void ensureVisible(IForm form);
+
+ /**
+ * DISPLAY_HINT_VIEW
+ */
+ IForm[] getViewStack();
+
+ /**
+ * DISPLAY_HINT_DIALOG
+ */
+ IForm[] getDialogStack();
+
+ /**
+ * add form to desktop and notify attached listeners (incl. gui)
+ */
+ void addForm(IForm form);
+
+ /**
+ * remove form from desktop and notify attached listeners (incl. gui)
+ */
+ void removeForm(IForm form);
+
+ IMessageBox[] getMessageBoxStack();
+
+ void addMessageBox(IMessageBox mb);
+
+ IOutline[] getAvailableOutlines();
+
+ void setAvailableOutlines(IOutline[] availableOutlines);
+
+ IKeyStroke[] getKeyStrokes();
+
+ void setKeyStrokes(IKeyStroke[] ks);
+
+ void addKeyStrokes(IKeyStroke... keyStrokes);
+
+ void removeKeyStrokes(IKeyStroke... keyStrokes);
+
+ /**
+ * @return true if the form is currently attached to the desktop, false if the
+ * form is not attached to the desktop<br>
+ * This method can be used to determine if a possibly active form
+ * (started with a running form handler) is currently showing on the
+ * desktop.
+ */
+ boolean isShowing(IForm form);
+
+ /**
+ * @return true after desktop was opened and setup in any UI.
+ */
+ boolean isOpened();
+
+ /**
+ * @return the currently active outline on the desktop
+ */
+ IOutline getOutline();
+
+ /**
+ * set the currently active outline on the desktop
+ */
+ void setOutline(IOutline outline);
+
+ /**
+ * set the currently active outline on the desktop using its type
+ */
+ void setOutline(Class<? extends IOutline> outlineType);
+
+ /**
+ * Call this method to refresh all existing pages in all outlines<br>
+ * If currently active page(s) are affected they reload their data, otherwise
+ * the pages is simply marked dirty and reloaded on next activation
+ */
+ void refreshPages(Class... pageTypes);
+
+ /**
+ * add Property Observer
+ */
+ @Override
+ void addPropertyChangeListener(PropertyChangeListener listener);
+
+ @Override
+ void removePropertyChangeListener(PropertyChangeListener listener);
+
+ /**
+ * add Property Observer
+ */
+ @Override
+ void addPropertyChangeListener(String propertyName, PropertyChangeListener listener);
+
+ @Override
+ void removePropertyChangeListener(String propertyName, PropertyChangeListener listener);
+
+ /**
+ * add Model Observer
+ */
+ void addDesktopListener(DesktopListener l);
+
+ void removeDesktopListener(DesktopListener l);
+
+ /**
+ * add Data Change Observer
+ */
+ void addDataChangeListener(DataChangeListener listener, Object... dataTypes);
+
+ void removeDataChangeListener(DataChangeListener listener, Object... dataTypes);
+
+ /**
+ * Call this method to refresh all listeners on that dataTypes.<br>
+ * These might include pages, forms, fields etc.<br>
+ *
+ * @see {@link AbstractForm#execDataChanged(Object...)} {@link AbstractForm#execDataChanged(Object...)}
+ * {@link AbstractFormField#execDataChanged(Object...)} {@link AbstractFormField#execDataChanged(Object...)}
+ * {@link AbstractPage#execDataChanged(Object...)} {@link AbstractPage#execDataChanged(Object...)}
+ */
+ void dataChanged(Object... dataTypes);
+
+ /**
+ * Called after a page was loaded or reloaded.
+ * <p>
+ * Default minimizes page search form when data was found.
+ *
+ * @param page
+ */
+ void afterTablePageLoaded(IPageWithTable<?> page) throws ProcessingException;
+
+ /**
+ * Unload and release unused pages in all outlines, such as closed and
+ * non-selected nodes
+ */
+ void releaseUnusedPages();
+
+ /**
+ * @return the top level menus
+ * <p>
+ * normally presented in the menubar
+ */
+ IMenu[] getMenus();
+
+ /**
+ * Convenience to find a menu in the desktop, uses {@link ActionFinder}
+ */
+ <T extends IMenu> T getMenu(Class<? extends T> searchType);
+
+ /**
+ * Prepare all (menubar) menus on the desktop.<br>
+ * Calls {@link AbstractMenu#execPrepareAction()} on every menu in the menu
+ * tree recursively
+ */
+ void prepareAllMenus();
+
+ /**
+ * @return all actions including keyStroke, menu, toolButton and viewButton
+ */
+ IAction[] getActions();
+
+ /**
+ * @return all {@link IToolButton} actions
+ */
+ IToolButton[] getToolButtons();
+
+ /**
+ * @return all {@link IViewButton} actions
+ */
+ IViewButton[] getViewButtons();
+
+ /**
+ * @return the detail form of the active (selected) page {@link IPage#getDetailForm()} of the active outline
+ * {@link IOutline#getDetailForm()}
+ */
+ IForm getPageDetailForm();
+
+ /**
+ * see {@link #getPageDetailForm()}, {@link AbstractDesktop#execChangedPageDetailForm(IForm)}
+ */
+ void setPageDetailForm(IForm f);
+
+ /**
+ * @return the detail table of the active (selected) page {@link IPage#getDetailTable()} of the active outline
+ * {@link IOutline#getDetailTable()}
+ */
+ ITable getPageDetailTable();
+
+ /**
+ * see {@link #getPageDetailTable()}, {@link AbstractDesktop#execChangedPageDetailTable(IForm)}
+ */
+ void setPageDetailTable(ITable t);
+
+ /**
+ * @return the form that displays the table of the (selected) page {@link IPage#getTable()} of the active outline
+ * {@link IOutline#getDetailTable()}<br>
+ * @see {@link #isOutlineTableFormVisible()}
+ */
+ IOutlineTableForm getOutlineTableForm();
+
+ /**
+ * set the detail table form of the active (selected) page {@link IPage#getTable()} of the active outline
+ * {@link IOutline#getDetailTable()}
+ *
+ * @see {@link #setOutlineTableFormVisible(boolean)}
+ */
+ void setOutlineTableForm(IOutlineTableForm f);
+
+ /**
+ * @return true if the outline table form is visible
+ */
+ boolean isOutlineTableFormVisible();
+
+ /**
+ * set the detail table form of the active (selected) page {@link IPage#getTable()} of the active outline
+ * {@link IOutline#getDetailTable()}
+ */
+ void setOutlineTableFormVisible(boolean b);
+
+ /**
+ * @return the search form of the active (selected) page {@link IPageWithTable#getSearchFormInternal()} of the active
+ * outline {@link IOutline#getSearchForm()}
+ */
+ IForm getPageSearchForm();
+
+ /**
+ * see {@link #getPageSearchForm()}, {@link AbstractDesktop#execChangedPageSearchForm(IForm)}
+ */
+ void setPageSearchForm(IForm f);
+
+ String getTitle();
+
+ void setTitle(String s);
+
+ /**
+ * @return true: automatically prefix a * on any text field's search value
+ */
+ boolean isAutoPrefixWildcardForTextSearch();
+
+ void setAutoPrefixWildcardForTextSearch(boolean b);
+
+ /**
+ * get the status of the desktop
+ * <p>
+ * see also {@link IForm#getFormStatus(IProcessingStatus)}
+ */
+ IProcessingStatus getStatus();
+
+ /**
+ * set a status on the desktop
+ * <p>
+ * this is normally displayed in as a tray message box
+ * <p>
+ * see also {@link IForm#setFormStatus(IProcessingStatus)}
+ */
+ void setStatus(IProcessingStatus status);
+
+ /**
+ * set a status on the desktop
+ * <p>
+ * this is normally displayed in as a tray message box
+ * <p>
+ * see also {@link IForm#setFormStatusText(String)}
+ */
+ void setStatusText(String s);
+
+ /**
+ * Retrieve files via a user interface
+ */
+ void addFileChooser(IFileChooser fc);
+
+ /**
+ * Creates and opens a browser window to download a file or open an url via user interface (only in web ui)
+ */
+ void openBrowserWindow(String path);
+
+ /**
+ * Prints the desktop
+ * <p>
+ * The method returns immediately, the print is done int the background.
+ * <p>
+ * For details and parameter details see {@link PrintDevice}
+ */
+ void printDesktop(PrintDevice device, Map<String, Object> parameters);
+
+ /**
+ * Activates a bookmark
+ */
+ void activateBookmark(Bookmark bm, boolean forceReload) throws ProcessingException;
+
+ /**
+ * Creates a bookmark of the active page
+ */
+ Bookmark createBookmark() throws ProcessingException;
+
+ /**
+ * Creates a bookmark of the given page
+ *
+ * @since 3.8.0
+ */
+ Bookmark createBookmark(IPage page) throws ProcessingException;
+
+ /**
+ * do not use this internal method.<br>
+ * for closing scout see <code>ClientScoutSession.getSession().close()</code>
+ */
+ void closeInternal() throws ProcessingException;
+
+ IDesktopUIFacade getUIFacade();
+
+ boolean isGuiAvailable();
+
+ void changeVisibilityAfterOfflineSwitch();
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/IDesktopExtension.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/IDesktopExtension.java
index c83d2b3a54..16c8257e88 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/IDesktopExtension.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/IDesktopExtension.java
@@ -1,215 +1,215 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.desktop;
-
-import java.util.Collection;
-import java.util.List;
-
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.holders.IHolder;
-import org.eclipse.scout.rt.client.ui.action.IAction;
-import org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.action.tool.IToolButton;
-import org.eclipse.scout.rt.client.ui.action.view.IViewButton;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-
-/**
- * A desktop extension can contribute to a core {@link IDesktop} and react on desktop state changes using the
- * {@code exec* } methods defined in {@link AbstractDesktopExtension}.
- * <ul>
- * <li>outlines (with pages)</li>
- * <li>actions (menu, keyStroke, toolButton, viewButton)</li>
- * </ul>
- */
-public interface IDesktopExtension {
-
- /**
- * Returns the core desktop that holds this desktop extension.
- *
- * @return the desktop that holds this extension
- */
- IDesktop getCoreDesktop();
-
- /**
- * Sets the core desktop that holds this desktop extension.
- *
- * @param desktop
- * the desktop that holds this extension
- */
- void setCoreDesktop(IDesktop desktop);
-
- /**
- * Called while this desktop extension is initialized.
- *
- * @return {@code ContributionCommand.Continue} if further extensions should be processed,
- * {@code ContributionCommand.Stop} otherwise
- * @throws ProcessingException
- */
- ContributionCommand initDelegate() throws ProcessingException;
-
- /**
- * Called after the core desktop was opened and displayed on the GUI.
- *
- * @return {@code ContributionCommand.Continue} if further extensions should be processed,
- * {@code ContributionCommand.Stop} otherwise
- * @throws ProcessingException
- */
- ContributionCommand desktopOpenedDelegate() throws ProcessingException;
-
- /**
- * Called before the core desktop is being closed.
- *
- * @return {@code ContributionCommand.Continue} if further extensions should be processed,
- * {@code ContributionCommand.Stop} otherwise
- * @throws ProcessingException
- */
- ContributionCommand desktopClosingDelegate() throws ProcessingException;
-
- /**
- * Called after a UI has been attached to the core desktop. The desktop must not necessarily be open.
- *
- * @return {@code ContributionCommand.Continue} if further extensions should be processed,
- * {@code ContributionCommand.Stop} otherwise
- * @throws ProcessingException
- */
- ContributionCommand guiAttachedDelegate() throws ProcessingException;
-
- /**
- * Called after a UI has been detached from the core desktop. The desktop must not necessarily be open.
- *
- * @return {@code ContributionCommand.Continue} if further extensions should be processed,
- * {@code ContributionCommand.Stop} otherwise
- * @throws ProcessingException
- */
- ContributionCommand guiDetachedDelegate() throws ProcessingException;
-
- /**
- * Called whenever a new outline has been activated on the core desktop.
- *
- * @param oldOutline
- * old outline that was active before
- * @param newOutline
- * new outline that is active after the change
- * @return {@code ContributionCommand.Continue} if further extensions should be processed,
- * {@code ContributionCommand.Stop} otherwise
- * @throws ProcessingException
- */
- ContributionCommand outlineChangedDelegate(IOutline oldOutline, IOutline newOutline) throws ProcessingException;
-
- /**
- * Called right before a form is added to the core desktop. This means this method is called
- * before any UI is informed about the new form. The form is provided in a
- * holder. This allows it to prevent the form being added to the desktop (set
- * reference to {@code null}), do some general modifications needed to be done prior UI instantiation,
- * or even replace it with a different instance.
- *
- * @param formHolder
- * contains the form that will be added to the core desktop
- * @return {@code ContributionCommand.Continue} if further extensions should be processed,
- * {@code ContributionCommand.Stop} otherwise
- * @throws ProcessingException
- */
- ContributionCommand customFormModificationDelegate(IHolder<IForm> formHolder) throws ProcessingException;
-
- /**
- * Called whenever a new page has been activated (selected) on the core desktop.
- *
- * @param oldForm
- * is the search form of the old (not selected anymore) page or {@code null}
- * @param newForm
- * is the search form of the new (selected) page or {@code null}
- * @return {@code ContributionCommand.Continue} if further extensions should be processed,
- * {@code ContributionCommand.Stop} otherwise
- * @throws ProcessingException
- */
- ContributionCommand pageSearchFormChangedDelegate(IForm oldForm, IForm newForm) throws ProcessingException;
-
- /**
- * Called whenever a new page has been activated (selected) on the core desktop.
- *
- * @param oldForm
- * is the detail form of the old (not selected anymore) page or {@code null}
- * @param newForm
- * is the detail form of the new (selected) page or {@code null}
- * @return {@code ContributionCommand.Continue} if further extensions should be processed,
- * {@code ContributionCommand.Stop} otherwise
- * @throws ProcessingException
- */
- ContributionCommand pageDetailFormChangedDelegate(IForm oldForm, IForm newForm) throws ProcessingException;
-
- /**
- * Called whenever a new page has been activated (selected) on the core desktop.
- *
- * @param oldTable
- * is the table of the old (not selected anymore) table page or {@code null}
- * @param newTable
- * is the table of the new (selected) table page or {@code null}
- * @return {@code ContributionCommand.Continue} if further extensions should be processed,
- * {@code ContributionCommand.Stop} otherwise
- * @throws ProcessingException
- */
- ContributionCommand pageDetailTableChangedDelegate(ITable oldTable, ITable newTable) throws ProcessingException;
-
- /**
- * Called after a table page was loaded or reloaded.
- *
- * @param tablePage
- * the table page that has been (re)loaded
- * @return {@code ContributionCommand.Continue} if further extensions should be processed,
- * {@code ContributionCommand.Stop} otherwise
- * @throws ProcessingException
- */
- ContributionCommand tablePageLoadedDelegate(IPageWithTable<?> tablePage) throws ProcessingException;
-
- /**
- * Called while the tray popup is being built. This method may call {@code getMenu(Class)} on the core desktop
- * to find an existing menu on the core desktop by class type.
- * <p>
- * The (potential) menus added to the {@code menus} list will be post processed. {@link IMenu#prepareAction()} is
- * called on each and then checked if the menu is visible.
- *
- * @param menus
- * a live list to add menus to the tray
- * @return {@code ContributionCommand.Continue} if further extensions should be processed,
- * {@code ContributionCommand.Stop} otherwise
- * @throws ProcessingException
- */
- ContributionCommand addTrayMenusDelegate(List<IMenu> menus) throws ProcessingException;
-
- /**
- * Adds the outlines configured with this extension to the {@code outlines} collection. This is a live list of
- * contributed outlines. They are NOT yet initialized.
- * <p>
- * Use the {@link Order} annotation to define the sort order of the contributed outlines.
- *
- * @param outlines
- * a live list to which the contributed outlines are added
- */
- void contributeOutlines(Collection<IOutline> outlines);
-
- /**
- * Adds the actions configured with this extension to the {@code actions} collection. This is a live list of
- * contributed actions ({@link IMenu}, {@link IKeyStroke}, {@link IToolButton}, {@link IViewButton}).
- * They are NOT yet initialized.
- * <p>
- * Use the {@link Order} annotation to define the sort order of the contributed actions.
- *
- * @param actions
- * a live list to which the contributed actions are added
- */
- void contributeActions(Collection<IAction> actions);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.desktop;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.holders.IHolder;
+import org.eclipse.scout.rt.client.ui.action.IAction;
+import org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.action.tool.IToolButton;
+import org.eclipse.scout.rt.client.ui.action.view.IViewButton;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+
+/**
+ * A desktop extension can contribute to a core {@link IDesktop} and react on desktop state changes using the
+ * {@code exec* } methods defined in {@link AbstractDesktopExtension}.
+ * <ul>
+ * <li>outlines (with pages)</li>
+ * <li>actions (menu, keyStroke, toolButton, viewButton)</li>
+ * </ul>
+ */
+public interface IDesktopExtension {
+
+ /**
+ * Returns the core desktop that holds this desktop extension.
+ *
+ * @return the desktop that holds this extension
+ */
+ IDesktop getCoreDesktop();
+
+ /**
+ * Sets the core desktop that holds this desktop extension.
+ *
+ * @param desktop
+ * the desktop that holds this extension
+ */
+ void setCoreDesktop(IDesktop desktop);
+
+ /**
+ * Called while this desktop extension is initialized.
+ *
+ * @return {@code ContributionCommand.Continue} if further extensions should be processed,
+ * {@code ContributionCommand.Stop} otherwise
+ * @throws ProcessingException
+ */
+ ContributionCommand initDelegate() throws ProcessingException;
+
+ /**
+ * Called after the core desktop was opened and displayed on the GUI.
+ *
+ * @return {@code ContributionCommand.Continue} if further extensions should be processed,
+ * {@code ContributionCommand.Stop} otherwise
+ * @throws ProcessingException
+ */
+ ContributionCommand desktopOpenedDelegate() throws ProcessingException;
+
+ /**
+ * Called before the core desktop is being closed.
+ *
+ * @return {@code ContributionCommand.Continue} if further extensions should be processed,
+ * {@code ContributionCommand.Stop} otherwise
+ * @throws ProcessingException
+ */
+ ContributionCommand desktopClosingDelegate() throws ProcessingException;
+
+ /**
+ * Called after a UI has been attached to the core desktop. The desktop must not necessarily be open.
+ *
+ * @return {@code ContributionCommand.Continue} if further extensions should be processed,
+ * {@code ContributionCommand.Stop} otherwise
+ * @throws ProcessingException
+ */
+ ContributionCommand guiAttachedDelegate() throws ProcessingException;
+
+ /**
+ * Called after a UI has been detached from the core desktop. The desktop must not necessarily be open.
+ *
+ * @return {@code ContributionCommand.Continue} if further extensions should be processed,
+ * {@code ContributionCommand.Stop} otherwise
+ * @throws ProcessingException
+ */
+ ContributionCommand guiDetachedDelegate() throws ProcessingException;
+
+ /**
+ * Called whenever a new outline has been activated on the core desktop.
+ *
+ * @param oldOutline
+ * old outline that was active before
+ * @param newOutline
+ * new outline that is active after the change
+ * @return {@code ContributionCommand.Continue} if further extensions should be processed,
+ * {@code ContributionCommand.Stop} otherwise
+ * @throws ProcessingException
+ */
+ ContributionCommand outlineChangedDelegate(IOutline oldOutline, IOutline newOutline) throws ProcessingException;
+
+ /**
+ * Called right before a form is added to the core desktop. This means this method is called
+ * before any UI is informed about the new form. The form is provided in a
+ * holder. This allows it to prevent the form being added to the desktop (set
+ * reference to {@code null}), do some general modifications needed to be done prior UI instantiation,
+ * or even replace it with a different instance.
+ *
+ * @param formHolder
+ * contains the form that will be added to the core desktop
+ * @return {@code ContributionCommand.Continue} if further extensions should be processed,
+ * {@code ContributionCommand.Stop} otherwise
+ * @throws ProcessingException
+ */
+ ContributionCommand customFormModificationDelegate(IHolder<IForm> formHolder) throws ProcessingException;
+
+ /**
+ * Called whenever a new page has been activated (selected) on the core desktop.
+ *
+ * @param oldForm
+ * is the search form of the old (not selected anymore) page or {@code null}
+ * @param newForm
+ * is the search form of the new (selected) page or {@code null}
+ * @return {@code ContributionCommand.Continue} if further extensions should be processed,
+ * {@code ContributionCommand.Stop} otherwise
+ * @throws ProcessingException
+ */
+ ContributionCommand pageSearchFormChangedDelegate(IForm oldForm, IForm newForm) throws ProcessingException;
+
+ /**
+ * Called whenever a new page has been activated (selected) on the core desktop.
+ *
+ * @param oldForm
+ * is the detail form of the old (not selected anymore) page or {@code null}
+ * @param newForm
+ * is the detail form of the new (selected) page or {@code null}
+ * @return {@code ContributionCommand.Continue} if further extensions should be processed,
+ * {@code ContributionCommand.Stop} otherwise
+ * @throws ProcessingException
+ */
+ ContributionCommand pageDetailFormChangedDelegate(IForm oldForm, IForm newForm) throws ProcessingException;
+
+ /**
+ * Called whenever a new page has been activated (selected) on the core desktop.
+ *
+ * @param oldTable
+ * is the table of the old (not selected anymore) table page or {@code null}
+ * @param newTable
+ * is the table of the new (selected) table page or {@code null}
+ * @return {@code ContributionCommand.Continue} if further extensions should be processed,
+ * {@code ContributionCommand.Stop} otherwise
+ * @throws ProcessingException
+ */
+ ContributionCommand pageDetailTableChangedDelegate(ITable oldTable, ITable newTable) throws ProcessingException;
+
+ /**
+ * Called after a table page was loaded or reloaded.
+ *
+ * @param tablePage
+ * the table page that has been (re)loaded
+ * @return {@code ContributionCommand.Continue} if further extensions should be processed,
+ * {@code ContributionCommand.Stop} otherwise
+ * @throws ProcessingException
+ */
+ ContributionCommand tablePageLoadedDelegate(IPageWithTable<?> tablePage) throws ProcessingException;
+
+ /**
+ * Called while the tray popup is being built. This method may call {@code getMenu(Class)} on the core desktop
+ * to find an existing menu on the core desktop by class type.
+ * <p>
+ * The (potential) menus added to the {@code menus} list will be post processed. {@link IMenu#prepareAction()} is
+ * called on each and then checked if the menu is visible.
+ *
+ * @param menus
+ * a live list to add menus to the tray
+ * @return {@code ContributionCommand.Continue} if further extensions should be processed,
+ * {@code ContributionCommand.Stop} otherwise
+ * @throws ProcessingException
+ */
+ ContributionCommand addTrayMenusDelegate(List<IMenu> menus) throws ProcessingException;
+
+ /**
+ * Adds the outlines configured with this extension to the {@code outlines} collection. This is a live list of
+ * contributed outlines. They are NOT yet initialized.
+ * <p>
+ * Use the {@link Order} annotation to define the sort order of the contributed outlines.
+ *
+ * @param outlines
+ * a live list to which the contributed outlines are added
+ */
+ void contributeOutlines(Collection<IOutline> outlines);
+
+ /**
+ * Adds the actions configured with this extension to the {@code actions} collection. This is a live list of
+ * contributed actions ({@link IMenu}, {@link IKeyStroke}, {@link IToolButton}, {@link IViewButton}).
+ * They are NOT yet initialized.
+ * <p>
+ * Use the {@link Order} annotation to define the sort order of the contributed actions.
+ *
+ * @param actions
+ * a live list to which the contributed actions are added
+ */
+ void contributeActions(Collection<IAction> actions);
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/IDesktopUIFacade.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/IDesktopUIFacade.java
index fec095d28a..28f4102b64 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/IDesktopUIFacade.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/IDesktopUIFacade.java
@@ -1,64 +1,64 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.desktop;
-
-import java.io.File;
-
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-
-/**
- * The desktop model (may) consist of
- * <ul>
- * <li>set of available outline
- * <li>active outline
- * <li>active tableview
- * <li>active detail form
- * <li>active search form
- * <li>form stack (swing: dialogs on desktop as JInternalFrames; eclipse: editors or views)
- * <li>dialog stack of model and non-modal dialogs (swing: dialogs as JDialog, JFrame; eclipse: dialogs in a new Shell)
- * <li>active message box stack
- * </ul>
- */
-public interface IDesktopUIFacade {
-
- /**
- * GUI fires this event as soon as the desktop was completely setup and
- * displayed
- */
- void fireDesktopOpenedFromUI();
-
- /**
- * GUI fires this event when it is in the process of closing the workbench /
- * application
- */
- void fireDesktopClosingFromUI();
-
- /**
- * GUI fires this event as soon as a gui is available
- */
- void fireGuiAttached();
-
- /**
- * GUI fires this event when the application/workbench is closing
- */
- void fireGuiDetached();
-
- /**
- * GUI fires this event to collect the tray popup menus
- */
- IMenu[] fireTrayPopupFromUI();
-
- /**
- * @param printedFile
- * may be null in case a print device has been given to the print event.
- */
- void fireDesktopPrintedFromUI(File printedFile);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.desktop;
+
+import java.io.File;
+
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+
+/**
+ * The desktop model (may) consist of
+ * <ul>
+ * <li>set of available outline
+ * <li>active outline
+ * <li>active tableview
+ * <li>active detail form
+ * <li>active search form
+ * <li>form stack (swing: dialogs on desktop as JInternalFrames; eclipse: editors or views)
+ * <li>dialog stack of model and non-modal dialogs (swing: dialogs as JDialog, JFrame; eclipse: dialogs in a new Shell)
+ * <li>active message box stack
+ * </ul>
+ */
+public interface IDesktopUIFacade {
+
+ /**
+ * GUI fires this event as soon as the desktop was completely setup and
+ * displayed
+ */
+ void fireDesktopOpenedFromUI();
+
+ /**
+ * GUI fires this event when it is in the process of closing the workbench /
+ * application
+ */
+ void fireDesktopClosingFromUI();
+
+ /**
+ * GUI fires this event as soon as a gui is available
+ */
+ void fireGuiAttached();
+
+ /**
+ * GUI fires this event when the application/workbench is closing
+ */
+ void fireGuiDetached();
+
+ /**
+ * GUI fires this event to collect the tray popup menus
+ */
+ IMenu[] fireTrayPopupFromUI();
+
+ /**
+ * @param printedFile
+ * may be null in case a print device has been given to the print event.
+ */
+ void fireDesktopPrintedFromUI(File printedFile);
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/AbstractBookmarkTreeField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/AbstractBookmarkTreeField.java
index 659bba0be0..78c8b44730 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/AbstractBookmarkTreeField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/AbstractBookmarkTreeField.java
@@ -1,990 +1,990 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.desktop.bookmark;
-
-import java.security.Permission;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicReference;
-
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.dnd.JavaTransferObject;
-import org.eclipse.scout.commons.dnd.TransferObject;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.services.common.bookmark.IBookmarkService;
-import org.eclipse.scout.rt.client.ui.action.keystroke.AbstractKeyStroke;
-import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.action.menu.MenuSeparator;
-import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
-import org.eclipse.scout.rt.client.ui.basic.tree.AbstractTree;
-import org.eclipse.scout.rt.client.ui.basic.tree.AbstractTreeNode;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITree;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeVisitor;
-import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
-import org.eclipse.scout.rt.client.ui.desktop.bookmark.view.IOpenBookmarkCommand;
-import org.eclipse.scout.rt.client.ui.desktop.bookmark.view.IPublishBookmarkCommand;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.client.ui.form.fields.treefield.AbstractTreeField;
-import org.eclipse.scout.rt.client.ui.messagebox.MessageBox;
-import org.eclipse.scout.rt.shared.AbstractIcons;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.data.basic.FontSpec;
-import org.eclipse.scout.rt.shared.security.PublishUserBookmarkPermission;
-import org.eclipse.scout.rt.shared.services.common.bookmark.AbstractPageState;
-import org.eclipse.scout.rt.shared.services.common.bookmark.Bookmark;
-import org.eclipse.scout.rt.shared.services.common.bookmark.BookmarkFolder;
-import org.eclipse.scout.rt.shared.services.common.bookmark.TablePageState;
-import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
-import org.eclipse.scout.rt.shared.services.common.security.ACCESS;
-import org.eclipse.scout.service.SERVICES;
-
-public abstract class AbstractBookmarkTreeField extends AbstractTreeField {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractBookmarkTreeField.class);
-
- private BookmarkFolder m_bookmarkRootFolder;
- private IPublishBookmarkCommand m_publishBookmarkCommand;
- private IOpenBookmarkCommand m_openBookmarkCommand;
-
- public AbstractBookmarkTreeField() {
- this(true);
- }
-
- public AbstractBookmarkTreeField(boolean callInitializer) {
- super(callInitializer);
- }
-
- public BookmarkFolder getBookmarkRootFolder() {
- return m_bookmarkRootFolder;
- }
-
- public void setBookmarkRootFolder(BookmarkFolder bookmarkRootFolder) {
- m_bookmarkRootFolder = bookmarkRootFolder;
- }
-
- private static boolean isBookmarkNode(ITreeNode node) {
- return node instanceof BookmarkNode;
- }
-
- private static boolean isFolderNode(ITreeNode node) {
- return node instanceof FolderNode;
- }
-
- /**
- * It's up to the Eclipse Scout implementation to handle bookmark publishing,
- * e.g. selection of receivers of the published bookmark
- *
- * @param command
- * the command to publish a bookmark
- */
- public void injectPublishBookmarkCommand(IPublishBookmarkCommand command) {
- m_publishBookmarkCommand = command;
- }
-
- /**
- * If an application needs to execute additional code when a bookmark is opened,
- * it can inject a command here.
- * Please note: The command should at least open the bookmark, by calling {@link IDesktop#activateBookmark()}
- *
- * @param command
- * the command to be executed when a user opens a bookmark
- */
- public void injectOpenBookmarkCommand(IOpenBookmarkCommand command) {
- m_openBookmarkCommand = command;
- }
-
- private BookmarkFolder getParentBookmarkFolder(ITreeNode node) {
- BookmarkFolder folder = getBookmarkRootFolder();
- ITreeNode parentNode = node.getParentNode();
- if (isFolderNode(parentNode)) {
- folder = (BookmarkFolder) parentNode.getCell().getValue();
- }
- return folder;
- }
-
- @Override
- protected int getConfiguredGridW() {
- return 1;
- }
-
- @Override
- protected int getConfiguredGridH() {
- return 8;
- }
-
- @Override
- protected boolean getConfiguredAutoLoad() {
- return false;
- }
-
- @Override
- protected boolean getConfiguredLabelVisible() {
- return false;
- }
-
- @ConfigProperty(ConfigProperty.TEXT)
- @Order(10)
- @ConfigPropertyValue("null")
- protected String getConfiguredGlobalBookmarkLabel() {
- return ScoutTexts.get("GlobalBookmarks");
- }
-
- @ConfigProperty(ConfigProperty.TEXT)
- @Order(20)
- @ConfigPropertyValue("null")
- protected String getConfiguredPrivateBookmarkLabel() {
- return ScoutTexts.get("PrivateBookmarks");
- }
-
- @ConfigProperty(ConfigProperty.FORM)
- @Order(30)
- @ConfigPropertyValue("null")
- protected Class<? extends IBookmarkForm> getConfiguredBookmarkForm() {
- return BookmarkForm.class;
- }
-
- /**
- * @param bookmarks
- * selected for deletion
- * @return the row-level permission to delete bookmarks, default is {@link getDeletePermission()}
- * @throws ProcessingException
- */
- protected Permission getDeletePermission(ArrayList<Bookmark> bookmarks) throws ProcessingException {
- return getDeletePermission();
- }
-
- /**
- * @param bookmarks
- * selected for update
- * @return the row-level permission to update bookmarks, default is {@link getUpdatePermission()}
- * @throws ProcessingException
- */
- protected Permission getUpdatePermission(ArrayList<Bookmark> bookmarks) throws ProcessingException {
- return getUpdatePermission();
- }
-
- /**
- * @param bookmark
- * selected for publishing
- * @return the row-level permission to publish this bookmark, default is {@link getPublishPermission()}
- * @throws ProcessingException
- */
- protected Permission getPublishPermission(Bookmark bookmark) throws ProcessingException {
- return getPublishPermission();
- }
-
- protected Permission getDeletePermission() {
- return null;
- }
-
- protected Permission getUpdatePermission() {
- return null;
- }
-
- protected Permission getPublishPermission() {
- return new PublishUserBookmarkPermission();
- }
-
- public void populateTree() {
- try {
- getTree().setTreeChanging(true);
- getTree().removeAllChildNodes(getTree().getRootNode());
- populateFolderContentRec(getTree().getRootNode(), getBookmarkRootFolder());
- }
- catch (ProcessingException e) {
- LOG.error(null, e);
- }
- finally {
- getTree().setTreeChanging(false);
- }
- getTree().expandAll(getTree().getRootNode());
- }
-
- /**
- * @return true if populate of delta was successful
- */
- private void populateFolderContentRec(ITreeNode parent, BookmarkFolder newParent) throws ProcessingException {
- for (BookmarkFolder newFolder : newParent.getFolders()) {
- FolderNode newNode = new FolderNode();
- newNode.getCellForUpdate().setValue(newFolder);
- getTree().addChildNode(parent, newNode);
- populateFolderContentRec(newNode, newFolder);
- }
- for (Bookmark b : newParent.getBookmarks()) {
- BookmarkNode newNode = new BookmarkNode();
- newNode.getCellForUpdate().setValue(b);
- getTree().addChildNode(parent, newNode);
- }
- }
-
- /**
- * The structure of the folders has changed, completely rebuild the model
- *
- * @throws ProcessingException
- */
- private void rebuildBookmarkModel() throws ProcessingException {
- getTree().visitTree(new ITreeVisitor() {
- @Override
- public boolean visit(ITreeNode node) {
- BookmarkFolder bmFolder = null;
- if (node == getTree().getRootNode()) {
- bmFolder = getBookmarkRootFolder();
- }
- else if (isFolderNode(node)) {
- bmFolder = (BookmarkFolder) node.getCell().getValue();
- }
- if (bmFolder != null) {
- bmFolder.getFolders().clear();
- bmFolder.getBookmarks().clear();
- //sort folders
- ArrayList<BookmarkFolder> folderList = new ArrayList<BookmarkFolder>();
- for (ITreeNode n : node.getChildNodes()) {
- if (isFolderNode(n)) {
- BookmarkFolder f = (BookmarkFolder) n.getCell().getValue();
- folderList.add(f);
- }
- }
- Collections.sort(folderList, new Comparator<BookmarkFolder>() {
- @Override
- public int compare(BookmarkFolder f1, BookmarkFolder f2) {
- return StringUtility.compareIgnoreCase(f1.getTitle(), f2.getTitle());
- }
- });
- bmFolder.getFolders().addAll(folderList);
- for (ITreeNode n : node.getChildNodes()) {
- if (isBookmarkNode(n)) {
- bmFolder.getBookmarks().add((Bookmark) n.getCell().getValue());
- }
- }
- }
- return true;
- }
- });
- //save
- SERVICES.getService(IBookmarkService.class).storeBookmarks();
- }
-
- /**
- * Only some values have changed, just save the model
- *
- * @throws ProcessingException
- */
- private void refreshBookmarkModel() throws ProcessingException {
- getTree().visitTree(new ITreeVisitor() {
- @Override
- public boolean visit(ITreeNode node) {
- BookmarkFolder bmFolder = null;
- if (node == getTree().getRootNode()) {
- bmFolder = getBookmarkRootFolder();
- }
- else if (isFolderNode(node)) {
- bmFolder = (BookmarkFolder) node.getCell().getValue();
- }
- if (bmFolder != null) {
- bmFolder.getFolders().clear();
- bmFolder.getBookmarks().clear();
- for (ITreeNode n : node.getChildNodes()) {
- if (isFolderNode(n)) {
- bmFolder.getFolders().add((BookmarkFolder) n.getCell().getValue());
- }
- else if (isBookmarkNode(n)) {
- bmFolder.getBookmarks().add((Bookmark) n.getCell().getValue());
- }
- }
- }
- return true;
- }
- });
- //save
- SERVICES.getService(IBookmarkService.class).storeBookmarks();
- }
-
- @Order(10)
- public class Tree extends AbstractTree {
-
- @Override
- protected boolean getConfiguredMultiSelect() {
- return true;
- }
-
- @Override
- protected boolean getConfiguredDragEnabled() {
- return true;
- }
-
- @Override
- protected int getConfiguredDragType() {
- return TYPE_JAVA_ELEMENT_TRANSFER;
- }
-
- @Override
- protected int getConfiguredDropType() {
- return TYPE_JAVA_ELEMENT_TRANSFER;
- }
-
- @Override
- protected void execNodeAction(ITreeNode node) throws ProcessingException {
- if (isBookmarkNode(node)) {
- Bookmark bm = (Bookmark) node.getCell().getValue();
- ClientSyncJob.getCurrentSession().getDesktop().activateBookmark(bm, false);
- }
- }
-
- @Override
- protected TransferObject execDrag(ITreeNode[] nodes) {
- if (ACCESS.check(getUpdatePermission())) {
- return new JavaTransferObject(nodes);
- }
- return null;
- }
-
- @Override
- protected void execDrop(ITreeNode dropNode, TransferObject t) {
- if (t instanceof JavaTransferObject) {
- try {
- getTree().setTreeChanging(true);
- //
- if (((JavaTransferObject) t).getLocalObject() instanceof ITreeNode[]) {
- boolean updateTree = false;
- ITreeNode[] dragNodes = (ITreeNode[]) ((JavaTransferObject) t).getLocalObject();
- HashSet<ITreeNode> draggedFolders = new HashSet<ITreeNode>();
- for (ITreeNode source : dragNodes) {
- if (source != dropNode && source.getTree() == getTree()) {
- ITreeNode target = dropNode;
- if (isFolderNode(source)) {
- if (isBookmarkNode(target)) {
- target = target.getParentNode();
- }
- }
- //
- if (isBookmarkNode(source) && isFolderNode(target)) {
- //append to folder
- getTree().removeNode(source);
- getTree().addChildNode(target, source);
- updateTree = true;
- }
- else if (isBookmarkNode(source) && isBookmarkNode(target)) {
- //insert before dropNode
- getTree().removeNode(source);
- int pos = target.getChildNodeIndex();
- getTree().addChildNode(pos, target.getParentNode(), source);
- }
- else if (isFolderNode(source) && target == null) {
- //move to top
- getTree().removeNode(source);
- getTree().addChildNode(getTree().getRootNode(), source);
- }
- else if (isFolderNode(source) && isFolderNode(target)) {
- boolean parentWasDragged = false;
- for (ITreeNode parent : draggedFolders) {
- if (getTree().isAncestorNodeOf(parent, source)) {
- parentWasDragged = true;
- draggedFolders.add(source);
- }
- }
-
- if (!parentWasDragged) {
- //append to folder, NOTE: the drag node may be an ancestor of the drop node!
- if (getTree().isAncestorNodeOf(source, target)) {
- ITreeNode sourceParent = source.getParentNode();
- if (sourceParent != null) {
- int dragPos = source.getChildNodeIndex();
- ITreeNode targetAncestor = target;
- ITreeNode targetAncestorWalkThrough = target;
- while (targetAncestorWalkThrough.getParentNode() != source) {
- if (!Arrays.asList(dragNodes).contains(targetAncestor.getParentNode())) {
- targetAncestor = targetAncestorWalkThrough.getParentNode();
- }
- targetAncestorWalkThrough = targetAncestorWalkThrough.getParentNode();
- }
-
- getTree().removeNode(targetAncestor);
- getTree().removeNode(source);
- getTree().addChildNode(dragPos, sourceParent, targetAncestor);
- getTree().addChildNode(target, source);
- }
- }
- else {
- getTree().removeNode(source);
- getTree().addChildNode(target, source);
- }
- }
- }
- }
- }
- if (updateTree) {
- refreshBookmarkModel();
- }
- }
- }
- catch (ProcessingException e) {
- e.printStackTrace();
- }
- finally {
- getTree().setTreeChanging(false);
- }
- try {
- rebuildBookmarkModel();
- }
- catch (ProcessingException e) {
- LOG.error(null, e);
- }
- }
- }
-
- private void addNewFolder(ITreeNode parentNode) throws ProcessingException {
- if (parentNode == null) {
- parentNode = getRootNode();
- }
- BookmarkFolderForm form = new BookmarkFolderForm();
- form.startModify();
- form.waitFor();
- if (form.isFormStored()) {
- ITreeNode newNode = new FolderNode();
- BookmarkFolder bmFolder = new BookmarkFolder();
- bmFolder.setTitle(form.getNameField().getValue());
- newNode.getCellForUpdate().setValue(bmFolder);
- //append after last folder
- ITreeNode lastFolderNode = null;
- for (ITreeNode tmp : parentNode.getChildNodes()) {
- if (isFolderNode(tmp)) {
- lastFolderNode = tmp;
- }
- else {
- break;
- }
- }
- int pos = lastFolderNode != null ? lastFolderNode.getChildNodeIndex() + 1 : 0;
- getTree().addChildNode(pos, parentNode, newNode);
- rebuildBookmarkModel();
- }
- }
-
- @Order(10)
- public class NewRootFolderMenu extends AbstractMenu {
- @Override
- protected String getConfiguredText() {
- return ScoutTexts.get("NewBookmarkFolderMenu");
- }
-
- @Override
- protected boolean getConfiguredSingleSelectionAction() {
- return false;
- }
-
- @Override
- protected boolean getConfiguredEmptySpaceAction() {
- return true;
- }
-
- @Override
- protected void execPrepareAction() {
- setVisiblePermission(getUpdatePermission());
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- addNewFolder(null);
- }
- }
-
- @Order(11)
- public class NewChildFolderMenu extends AbstractMenu {
- @Override
- protected String getConfiguredText() {
- return ScoutTexts.get("NewBookmarkFolderMenu");
- }
-
- @Override
- protected void execPrepareAction() {
- ITreeNode node = getSelectedNode();
- setVisible(!isBookmarkNode(node));
- setVisiblePermission(getUpdatePermission());
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- addNewFolder(getSelectedNode());
- }
- }
-
- @Order(20)
- public class Separator1Menu extends MenuSeparator {
-
- @Override
- protected void execPrepareAction() throws ProcessingException {
- ITreeNode node = getSelectedNode();
- setVisible(!isBookmarkNode(node));
- setVisiblePermission(getUpdatePermission());
- }
-
- }
-
- @Order(40)
- public class DeleteKeyStroke extends AbstractKeyStroke {
- @Override
- protected String getConfiguredKeyStroke() {
- return "DELETE";
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- ITreeNode node = getSelectedNode();
- if (node != null) {
- for (IMenu m : node.getMenus()) {
- if (m.getClass().getSimpleName().equals("DeleteMenu")) {
- m.prepareAction();
- if (m.isVisible() && m.isEnabled()) {
- m.doAction();
- }
- break;
- }
- }
- }
- }
- }
-
- }
-
- private class FolderNode extends AbstractTreeNode {
- @Override
- protected void execDecorateCell(Cell cell) {
- BookmarkFolder bmFolder = (BookmarkFolder) getCell().getValue();
- String title = bmFolder.getTitle();
- if (Bookmark.INBOX_FOLDER_NAME.equals(title)) {
- title = getConfiguredGlobalBookmarkLabel();
- }
- cell.setText(title);
- cell.setIconId(AbstractIcons.TreeNode);
- }
-
- @Order(30)
- public class RenameMenu extends AbstractMenu {
- @Override
- protected String getConfiguredText() {
- return ScoutTexts.get("RenameBookmarkFolderMenu");
- }
-
- @Override
- protected void execPrepareAction() {
- setEnabled(!isProtected());
- setVisiblePermission(getUpdatePermission());
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- ITreeNode node = FolderNode.this;
- BookmarkFolder bmFolder = (BookmarkFolder) node.getCell().getValue();
- BookmarkFolderForm form = new BookmarkFolderForm();
- form.getNameField().setValue(bmFolder.getTitle());
- form.startModify();
- form.waitFor();
- if (form.isFormStored()) {
- bmFolder.setTitle(form.getNameField().getValue());
- getTree().updateNode(node);
- refreshBookmarkModel();
- }
- }
- }
-
- @Order(40)
- public class DeleteMenu extends AbstractMenu {
- @Override
- protected String getConfiguredText() {
- return ScoutTexts.get("DeleteFolderMenu");
- }
-
- @Override
- protected boolean getConfiguredMultiSelectionAction() {
- return true;
- }
-
- @Override
- protected void execPrepareAction() {
- setEnabled(!isProtected());
- setVisiblePermission(getDeletePermission());
- setText(getConfiguredText());
- for (ITreeNode node : getTree().getSelectedNodes()) {
- if (!(node instanceof FolderNode)) {
- setText(ScoutTexts.get("DeleteMenu"));
- }
- }
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- ITree tree = getTree();
- Set<ITreeNode> folders = new HashSet<ITreeNode>();
- Set<ITreeNode> bookmarks = new HashSet<ITreeNode>();
- for (ITreeNode node : tree.getSelectedNodes()) {
- addNodeFoldersToSet(folders, node);
- addNodeBookmarksToSet(bookmarks, node);
- }
- ArrayList<String> names = new ArrayList<String>();
- for (ITreeNode folder : folders) {
- names.add(((BookmarkFolder) folder.getCell().getValue()).getTitle());
- }
- for (ITreeNode bookmark : bookmarks) {
- ArrayList<Bookmark> check = new ArrayList<Bookmark>();
- check.add(((Bookmark) bookmark.getCell().getValue()));
- if (ACCESS.check(getDeletePermission(check))) {
- names.add(((Bookmark) bookmark.getCell().getValue()).getTitle());
- }
- }
- if (MessageBox.showDeleteConfirmationMessage(names.toArray(new String[names.size()]))) {
- // delete bookmarks
- for (ITreeNode bookmark : bookmarks) {
- tree.removeNode(bookmark);
- }
- // delete folders
- for (ITreeNode bookmark : folders) {
- tree.removeNode(bookmark);
- }
- refreshBookmarkModel();
- }
- }
-
- private void addNodeBookmarksToSet(Set<ITreeNode> items, ITreeNode node) {
- if (isFolderNode(node)) {
- for (ITreeNode child : node.getChildNodes()) {
- addNodeBookmarksToSet(items, child);
- }
- }
- else if (isBookmarkNode(node)) {
- items.add(node);
- }
- }
-
- private void addNodeFoldersToSet(Set<ITreeNode> items, ITreeNode node) {
- if (isFolderNode(node)) {
- items.add(node);
- for (ITreeNode child : node.getChildNodes()) {
- addNodeFoldersToSet(items, child);
- }
- }
- }
-
- }
-
- private boolean isProtected() {
- ITreeNode node = FolderNode.this;
- BookmarkFolder bmFolder = (BookmarkFolder) node.getCell().getValue();
- if (Bookmark.INBOX_FOLDER_NAME.equals(bmFolder.getTitle()) ||
- Bookmark.SPOOL_FOLDER_NAME.equals(bmFolder.getTitle())) {
- return true;
- }
- return false;
- }
-
- }
-
- private class BookmarkNode extends AbstractTreeNode implements IBookmarkNode {
- @Override
- protected boolean getConfiguredLeaf() {
- return true;
- }
-
- @Override
- protected void execDecorateCell(Cell cell) {
- Bookmark bm = (Bookmark) cell.getValue();
- if (bm != null) {
- if (bm.getKeyStroke() != null) {
- cell.setText(bm.getTitle() + " [" + bm.getKeyStroke() + "]");
- }
- else {
- cell.setText(bm.getTitle());
- }
- cell.setTooltipText(bm.getText());
- if (StringUtility.isNullOrEmpty(bm.getIconId())) {
- cell.setIconId(AbstractIcons.Bookmark);
- }
- else {
- cell.setIconId(bm.getIconId());
- }
- if (bm.isNew()) {
- cell.setFont(new FontSpec(null, FontSpec.STYLE_BOLD, 0));
- }
- }
- }
-
- @Order(40)
- public class OpenMenu extends AbstractMenu {
- @Override
- protected String getConfiguredText() {
- return ScoutTexts.get("ActivateBookmarkMenu");
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- ITreeNode node = BookmarkNode.this;
- Bookmark bm = (Bookmark) node.getCell().getValue();
- if (m_openBookmarkCommand != null) {
- m_openBookmarkCommand.openBookmark(bm);
- }
- else {
- ClientSyncJob.getCurrentSession().getDesktop().activateBookmark(bm, false);
- }
- }
- }
-
- @Order(50)
- public class EditMenu extends AbstractMenu {
- @Override
- protected String getConfiguredText() {
- return ScoutTexts.get("EditBookmarkMenu");
- }
-
- @Override
- protected void execPrepareAction() throws ProcessingException {
- ArrayList<Bookmark> bookmarks = new ArrayList<Bookmark>();
- ITree tree = getTree();
- for (ITreeNode node : tree.getSelectedNodes()) {
- if (isBookmarkNode(node)) {
- bookmarks.add((Bookmark) node.getCell().getValue());
- }
- }
- setEnabledPermission(getUpdatePermission(bookmarks));
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- ITreeNode node = BookmarkNode.this;
- Bookmark bm = (Bookmark) node.getCell().getValue();
- IBookmarkForm form = null;
- if (getConfiguredBookmarkForm() != null) {
- try {
- form = getConfiguredBookmarkForm().newInstance();
- }
- catch (Exception e) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException(this.getClass().getSimpleName(), e));
- }
- }
- if (form == null) {
- form = new BookmarkForm();
- }
- form.setBookmark(bm);
- form.setBookmarkRootFolder(getBookmarkRootFolder());
- BookmarkFolder oldBmFolder = getParentBookmarkFolder(BookmarkNode.this);
- boolean oldIsNew = bm.isNew();
- if (oldBmFolder != form.getBookmarkRootFolder()) {
- form.setFolder(oldBmFolder);
- }
- form.startModify();
- form.waitFor();
- if (form.isFormStored()) {
- ITree tree = getTree();
- bm.setTitle(form.getBookmark().getTitle());
- bm.setKeyStroke(form.getBookmark().getKeyStroke());
- bm.setKind(form.getBookmark().getKind());
- bm.setIconId(form.getBookmark().getIconId());
- final BookmarkFolder newBmFolder = form.getFolder() != null ? form.getFolder() : form.getBookmarkRootFolder();
- if (!CompareUtility.equals(oldBmFolder, newBmFolder)) {
- //find new folder node
- final AtomicReference<ITreeNode> newContainerNode = new AtomicReference<ITreeNode>(getTree().getRootNode());
- tree.visitTree(new ITreeVisitor() {
- @Override
- public boolean visit(ITreeNode n) {
- if (isFolderNode(n) && newBmFolder.equals(n.getCell().getValue())) {
- newContainerNode.set(n);
- return false;
- }
- return true;
- }
- });
- tree.removeNode(node);
- tree.addChildNode(newContainerNode.get(), node);
- rebuildBookmarkModel();
- }
- else {
- tree.updateNode(node);
- refreshBookmarkModel();
- }
- }
- else if (oldIsNew != form.getBookmark().isNew()) {
- refreshBookmarkModel();
- }
- }
- }
-
- @Order(60)
- public class UpdateWithCurrentMenu extends AbstractMenu {
-
- @Override
- protected String getConfiguredText() {
- return ScoutTexts.get("UpdateBookmarkMenu");
- }
-
- @Override
- protected void execPrepareAction() throws ProcessingException {
- // The permission to use the "update bookmark" function
- // is the same as to delete one:
- ArrayList<Bookmark> bookmarks = new ArrayList<Bookmark>();
- ITree tree = getTree();
- for (ITreeNode node : tree.getSelectedNodes()) {
- if (isBookmarkNode(node)) {
- bookmarks.add((Bookmark) node.getCell().getValue());
- }
- }
- setEnabledPermission(getDeletePermission(bookmarks));
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- ITreeNode node = BookmarkNode.this;
- Bookmark bm = (Bookmark) node.getCell().getValue();
-
- IBookmarkService service = SERVICES.getService(IBookmarkService.class);
- service.updateBookmark(bm);
- service.storeBookmarks();
- }
- }
-
- @Order(70)
- public class DeleteMenu extends AbstractMenu {
- @Override
- protected String getConfiguredText() {
- return ScoutTexts.get("DeleteBookmarkMenu");
- }
-
- @Override
- protected boolean getConfiguredMultiSelectionAction() {
- return true;
- }
-
- @Override
- protected void execPrepareAction() throws ProcessingException {
- ArrayList<Bookmark> bookmarks = new ArrayList<Bookmark>();
- ITree tree = getTree();
- for (ITreeNode node : tree.getSelectedNodes()) {
- if (isBookmarkNode(node)) {
- bookmarks.add((Bookmark) node.getCell().getValue());
- }
- }
- setEnabledPermission(getDeletePermission(bookmarks));
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- ArrayList<String> items = new ArrayList<String>();
- ArrayList<ITreeNode> filteredNodes = new ArrayList<ITreeNode>();
- ITree tree = getTree();
- for (ITreeNode node : tree.getSelectedNodes()) {
- if (isBookmarkNode(node)) {
- items.add(node.getCell().getText());
- filteredNodes.add(node);
- }
- }
- if (items.size() <= 1 || MessageBox.showDeleteConfirmationMessage(items.toArray(new String[0]))) {
- for (ITreeNode node : filteredNodes) {
- tree.removeNode(node);
- }
- rebuildBookmarkModel();
- }
- }
- }
-
- @Order(80)
- public class SeparatorMenu1 extends MenuSeparator {
- }
-
- @Order(90)
- public class PublishMenu extends AbstractMenu {
- @Override
- protected String getConfiguredText() {
- return ScoutTexts.get("BookmarksPublishMenu");
- }
-
- @Override
- protected void execPrepareAction() throws ProcessingException {
- Bookmark bookmark = null;
- ITreeNode selectedNode = getTree().getSelectedNode();
- if (isBookmarkNode(selectedNode)) {
- bookmark = (Bookmark) selectedNode.getCell().getValue();
- }
- setVisiblePermission(getPublishPermission(bookmark));
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- if (m_publishBookmarkCommand != null) {
- ITreeNode node = BookmarkNode.this;
- Bookmark bm = (Bookmark) node.getCell().getValue();
- BookmarkFolder spoolFolder = new BookmarkFolder();
- spoolFolder.getBookmarks().add(bm);
- m_publishBookmarkCommand.publishBookmark(spoolFolder);
- }
- }
- }
-
- @Order(100)
- public class ApplyToSearchMenu extends AbstractMenu {
- @Override
- protected String getConfiguredText() {
- return ScoutTexts.get("BookmarksApplyToCurrentSearch");
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- ITreeNode node = BookmarkNode.this;
- Bookmark bm = (Bookmark) node.getCell().getValue();
- IDesktop desktop = ClientSyncJob.getCurrentSession().getDesktop();
- Boolean success = null;
- if (desktop != null) {
- IForm searchForm = desktop.getPageSearchForm();
- if (searchForm != null) {
- for (AbstractPageState state : bm.getPath()) {
- if (state instanceof TablePageState) {
- TablePageState tablePageState = (TablePageState) state;
- try {
- searchForm.setXML(tablePageState.getSearchFormState());
- searchForm.doSaveWithoutMarkerChange();
- success = true;
- break;
- }
- catch (ProcessingException e) {
- success = false;
- }
- }
- }
- }
- }
- if (success != null && !success) {
- MessageBox.showOkMessage(null, null, ScoutTexts.get("ApplyBookmarkToSearchFailedMessage"));
- }
- }
- }
-
- @Override
- public Bookmark getBookmark() {
- ITreeNode node = BookmarkNode.this;
- return (Bookmark) node.getCell().getValue();
- }
-
- @Override
- public BookmarkFolder getParentFolder() {
- ITreeNode node = BookmarkNode.this;
- return (BookmarkFolder) node.getParentNode().getCell().getValue();
- }
-
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.desktop.bookmark;
+
+import java.security.Permission;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.dnd.JavaTransferObject;
+import org.eclipse.scout.commons.dnd.TransferObject;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.services.common.bookmark.IBookmarkService;
+import org.eclipse.scout.rt.client.ui.action.keystroke.AbstractKeyStroke;
+import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.action.menu.MenuSeparator;
+import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
+import org.eclipse.scout.rt.client.ui.basic.tree.AbstractTree;
+import org.eclipse.scout.rt.client.ui.basic.tree.AbstractTreeNode;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITree;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeVisitor;
+import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
+import org.eclipse.scout.rt.client.ui.desktop.bookmark.view.IOpenBookmarkCommand;
+import org.eclipse.scout.rt.client.ui.desktop.bookmark.view.IPublishBookmarkCommand;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.client.ui.form.fields.treefield.AbstractTreeField;
+import org.eclipse.scout.rt.client.ui.messagebox.MessageBox;
+import org.eclipse.scout.rt.shared.AbstractIcons;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.data.basic.FontSpec;
+import org.eclipse.scout.rt.shared.security.PublishUserBookmarkPermission;
+import org.eclipse.scout.rt.shared.services.common.bookmark.AbstractPageState;
+import org.eclipse.scout.rt.shared.services.common.bookmark.Bookmark;
+import org.eclipse.scout.rt.shared.services.common.bookmark.BookmarkFolder;
+import org.eclipse.scout.rt.shared.services.common.bookmark.TablePageState;
+import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
+import org.eclipse.scout.rt.shared.services.common.security.ACCESS;
+import org.eclipse.scout.service.SERVICES;
+
+public abstract class AbstractBookmarkTreeField extends AbstractTreeField {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractBookmarkTreeField.class);
+
+ private BookmarkFolder m_bookmarkRootFolder;
+ private IPublishBookmarkCommand m_publishBookmarkCommand;
+ private IOpenBookmarkCommand m_openBookmarkCommand;
+
+ public AbstractBookmarkTreeField() {
+ this(true);
+ }
+
+ public AbstractBookmarkTreeField(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ public BookmarkFolder getBookmarkRootFolder() {
+ return m_bookmarkRootFolder;
+ }
+
+ public void setBookmarkRootFolder(BookmarkFolder bookmarkRootFolder) {
+ m_bookmarkRootFolder = bookmarkRootFolder;
+ }
+
+ private static boolean isBookmarkNode(ITreeNode node) {
+ return node instanceof BookmarkNode;
+ }
+
+ private static boolean isFolderNode(ITreeNode node) {
+ return node instanceof FolderNode;
+ }
+
+ /**
+ * It's up to the Eclipse Scout implementation to handle bookmark publishing,
+ * e.g. selection of receivers of the published bookmark
+ *
+ * @param command
+ * the command to publish a bookmark
+ */
+ public void injectPublishBookmarkCommand(IPublishBookmarkCommand command) {
+ m_publishBookmarkCommand = command;
+ }
+
+ /**
+ * If an application needs to execute additional code when a bookmark is opened,
+ * it can inject a command here.
+ * Please note: The command should at least open the bookmark, by calling {@link IDesktop#activateBookmark()}
+ *
+ * @param command
+ * the command to be executed when a user opens a bookmark
+ */
+ public void injectOpenBookmarkCommand(IOpenBookmarkCommand command) {
+ m_openBookmarkCommand = command;
+ }
+
+ private BookmarkFolder getParentBookmarkFolder(ITreeNode node) {
+ BookmarkFolder folder = getBookmarkRootFolder();
+ ITreeNode parentNode = node.getParentNode();
+ if (isFolderNode(parentNode)) {
+ folder = (BookmarkFolder) parentNode.getCell().getValue();
+ }
+ return folder;
+ }
+
+ @Override
+ protected int getConfiguredGridW() {
+ return 1;
+ }
+
+ @Override
+ protected int getConfiguredGridH() {
+ return 8;
+ }
+
+ @Override
+ protected boolean getConfiguredAutoLoad() {
+ return false;
+ }
+
+ @Override
+ protected boolean getConfiguredLabelVisible() {
+ return false;
+ }
+
+ @ConfigProperty(ConfigProperty.TEXT)
+ @Order(10)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredGlobalBookmarkLabel() {
+ return ScoutTexts.get("GlobalBookmarks");
+ }
+
+ @ConfigProperty(ConfigProperty.TEXT)
+ @Order(20)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredPrivateBookmarkLabel() {
+ return ScoutTexts.get("PrivateBookmarks");
+ }
+
+ @ConfigProperty(ConfigProperty.FORM)
+ @Order(30)
+ @ConfigPropertyValue("null")
+ protected Class<? extends IBookmarkForm> getConfiguredBookmarkForm() {
+ return BookmarkForm.class;
+ }
+
+ /**
+ * @param bookmarks
+ * selected for deletion
+ * @return the row-level permission to delete bookmarks, default is {@link getDeletePermission()}
+ * @throws ProcessingException
+ */
+ protected Permission getDeletePermission(ArrayList<Bookmark> bookmarks) throws ProcessingException {
+ return getDeletePermission();
+ }
+
+ /**
+ * @param bookmarks
+ * selected for update
+ * @return the row-level permission to update bookmarks, default is {@link getUpdatePermission()}
+ * @throws ProcessingException
+ */
+ protected Permission getUpdatePermission(ArrayList<Bookmark> bookmarks) throws ProcessingException {
+ return getUpdatePermission();
+ }
+
+ /**
+ * @param bookmark
+ * selected for publishing
+ * @return the row-level permission to publish this bookmark, default is {@link getPublishPermission()}
+ * @throws ProcessingException
+ */
+ protected Permission getPublishPermission(Bookmark bookmark) throws ProcessingException {
+ return getPublishPermission();
+ }
+
+ protected Permission getDeletePermission() {
+ return null;
+ }
+
+ protected Permission getUpdatePermission() {
+ return null;
+ }
+
+ protected Permission getPublishPermission() {
+ return new PublishUserBookmarkPermission();
+ }
+
+ public void populateTree() {
+ try {
+ getTree().setTreeChanging(true);
+ getTree().removeAllChildNodes(getTree().getRootNode());
+ populateFolderContentRec(getTree().getRootNode(), getBookmarkRootFolder());
+ }
+ catch (ProcessingException e) {
+ LOG.error(null, e);
+ }
+ finally {
+ getTree().setTreeChanging(false);
+ }
+ getTree().expandAll(getTree().getRootNode());
+ }
+
+ /**
+ * @return true if populate of delta was successful
+ */
+ private void populateFolderContentRec(ITreeNode parent, BookmarkFolder newParent) throws ProcessingException {
+ for (BookmarkFolder newFolder : newParent.getFolders()) {
+ FolderNode newNode = new FolderNode();
+ newNode.getCellForUpdate().setValue(newFolder);
+ getTree().addChildNode(parent, newNode);
+ populateFolderContentRec(newNode, newFolder);
+ }
+ for (Bookmark b : newParent.getBookmarks()) {
+ BookmarkNode newNode = new BookmarkNode();
+ newNode.getCellForUpdate().setValue(b);
+ getTree().addChildNode(parent, newNode);
+ }
+ }
+
+ /**
+ * The structure of the folders has changed, completely rebuild the model
+ *
+ * @throws ProcessingException
+ */
+ private void rebuildBookmarkModel() throws ProcessingException {
+ getTree().visitTree(new ITreeVisitor() {
+ @Override
+ public boolean visit(ITreeNode node) {
+ BookmarkFolder bmFolder = null;
+ if (node == getTree().getRootNode()) {
+ bmFolder = getBookmarkRootFolder();
+ }
+ else if (isFolderNode(node)) {
+ bmFolder = (BookmarkFolder) node.getCell().getValue();
+ }
+ if (bmFolder != null) {
+ bmFolder.getFolders().clear();
+ bmFolder.getBookmarks().clear();
+ //sort folders
+ ArrayList<BookmarkFolder> folderList = new ArrayList<BookmarkFolder>();
+ for (ITreeNode n : node.getChildNodes()) {
+ if (isFolderNode(n)) {
+ BookmarkFolder f = (BookmarkFolder) n.getCell().getValue();
+ folderList.add(f);
+ }
+ }
+ Collections.sort(folderList, new Comparator<BookmarkFolder>() {
+ @Override
+ public int compare(BookmarkFolder f1, BookmarkFolder f2) {
+ return StringUtility.compareIgnoreCase(f1.getTitle(), f2.getTitle());
+ }
+ });
+ bmFolder.getFolders().addAll(folderList);
+ for (ITreeNode n : node.getChildNodes()) {
+ if (isBookmarkNode(n)) {
+ bmFolder.getBookmarks().add((Bookmark) n.getCell().getValue());
+ }
+ }
+ }
+ return true;
+ }
+ });
+ //save
+ SERVICES.getService(IBookmarkService.class).storeBookmarks();
+ }
+
+ /**
+ * Only some values have changed, just save the model
+ *
+ * @throws ProcessingException
+ */
+ private void refreshBookmarkModel() throws ProcessingException {
+ getTree().visitTree(new ITreeVisitor() {
+ @Override
+ public boolean visit(ITreeNode node) {
+ BookmarkFolder bmFolder = null;
+ if (node == getTree().getRootNode()) {
+ bmFolder = getBookmarkRootFolder();
+ }
+ else if (isFolderNode(node)) {
+ bmFolder = (BookmarkFolder) node.getCell().getValue();
+ }
+ if (bmFolder != null) {
+ bmFolder.getFolders().clear();
+ bmFolder.getBookmarks().clear();
+ for (ITreeNode n : node.getChildNodes()) {
+ if (isFolderNode(n)) {
+ bmFolder.getFolders().add((BookmarkFolder) n.getCell().getValue());
+ }
+ else if (isBookmarkNode(n)) {
+ bmFolder.getBookmarks().add((Bookmark) n.getCell().getValue());
+ }
+ }
+ }
+ return true;
+ }
+ });
+ //save
+ SERVICES.getService(IBookmarkService.class).storeBookmarks();
+ }
+
+ @Order(10)
+ public class Tree extends AbstractTree {
+
+ @Override
+ protected boolean getConfiguredMultiSelect() {
+ return true;
+ }
+
+ @Override
+ protected boolean getConfiguredDragEnabled() {
+ return true;
+ }
+
+ @Override
+ protected int getConfiguredDragType() {
+ return TYPE_JAVA_ELEMENT_TRANSFER;
+ }
+
+ @Override
+ protected int getConfiguredDropType() {
+ return TYPE_JAVA_ELEMENT_TRANSFER;
+ }
+
+ @Override
+ protected void execNodeAction(ITreeNode node) throws ProcessingException {
+ if (isBookmarkNode(node)) {
+ Bookmark bm = (Bookmark) node.getCell().getValue();
+ ClientSyncJob.getCurrentSession().getDesktop().activateBookmark(bm, false);
+ }
+ }
+
+ @Override
+ protected TransferObject execDrag(ITreeNode[] nodes) {
+ if (ACCESS.check(getUpdatePermission())) {
+ return new JavaTransferObject(nodes);
+ }
+ return null;
+ }
+
+ @Override
+ protected void execDrop(ITreeNode dropNode, TransferObject t) {
+ if (t instanceof JavaTransferObject) {
+ try {
+ getTree().setTreeChanging(true);
+ //
+ if (((JavaTransferObject) t).getLocalObject() instanceof ITreeNode[]) {
+ boolean updateTree = false;
+ ITreeNode[] dragNodes = (ITreeNode[]) ((JavaTransferObject) t).getLocalObject();
+ HashSet<ITreeNode> draggedFolders = new HashSet<ITreeNode>();
+ for (ITreeNode source : dragNodes) {
+ if (source != dropNode && source.getTree() == getTree()) {
+ ITreeNode target = dropNode;
+ if (isFolderNode(source)) {
+ if (isBookmarkNode(target)) {
+ target = target.getParentNode();
+ }
+ }
+ //
+ if (isBookmarkNode(source) && isFolderNode(target)) {
+ //append to folder
+ getTree().removeNode(source);
+ getTree().addChildNode(target, source);
+ updateTree = true;
+ }
+ else if (isBookmarkNode(source) && isBookmarkNode(target)) {
+ //insert before dropNode
+ getTree().removeNode(source);
+ int pos = target.getChildNodeIndex();
+ getTree().addChildNode(pos, target.getParentNode(), source);
+ }
+ else if (isFolderNode(source) && target == null) {
+ //move to top
+ getTree().removeNode(source);
+ getTree().addChildNode(getTree().getRootNode(), source);
+ }
+ else if (isFolderNode(source) && isFolderNode(target)) {
+ boolean parentWasDragged = false;
+ for (ITreeNode parent : draggedFolders) {
+ if (getTree().isAncestorNodeOf(parent, source)) {
+ parentWasDragged = true;
+ draggedFolders.add(source);
+ }
+ }
+
+ if (!parentWasDragged) {
+ //append to folder, NOTE: the drag node may be an ancestor of the drop node!
+ if (getTree().isAncestorNodeOf(source, target)) {
+ ITreeNode sourceParent = source.getParentNode();
+ if (sourceParent != null) {
+ int dragPos = source.getChildNodeIndex();
+ ITreeNode targetAncestor = target;
+ ITreeNode targetAncestorWalkThrough = target;
+ while (targetAncestorWalkThrough.getParentNode() != source) {
+ if (!Arrays.asList(dragNodes).contains(targetAncestor.getParentNode())) {
+ targetAncestor = targetAncestorWalkThrough.getParentNode();
+ }
+ targetAncestorWalkThrough = targetAncestorWalkThrough.getParentNode();
+ }
+
+ getTree().removeNode(targetAncestor);
+ getTree().removeNode(source);
+ getTree().addChildNode(dragPos, sourceParent, targetAncestor);
+ getTree().addChildNode(target, source);
+ }
+ }
+ else {
+ getTree().removeNode(source);
+ getTree().addChildNode(target, source);
+ }
+ }
+ }
+ }
+ }
+ if (updateTree) {
+ refreshBookmarkModel();
+ }
+ }
+ }
+ catch (ProcessingException e) {
+ e.printStackTrace();
+ }
+ finally {
+ getTree().setTreeChanging(false);
+ }
+ try {
+ rebuildBookmarkModel();
+ }
+ catch (ProcessingException e) {
+ LOG.error(null, e);
+ }
+ }
+ }
+
+ private void addNewFolder(ITreeNode parentNode) throws ProcessingException {
+ if (parentNode == null) {
+ parentNode = getRootNode();
+ }
+ BookmarkFolderForm form = new BookmarkFolderForm();
+ form.startModify();
+ form.waitFor();
+ if (form.isFormStored()) {
+ ITreeNode newNode = new FolderNode();
+ BookmarkFolder bmFolder = new BookmarkFolder();
+ bmFolder.setTitle(form.getNameField().getValue());
+ newNode.getCellForUpdate().setValue(bmFolder);
+ //append after last folder
+ ITreeNode lastFolderNode = null;
+ for (ITreeNode tmp : parentNode.getChildNodes()) {
+ if (isFolderNode(tmp)) {
+ lastFolderNode = tmp;
+ }
+ else {
+ break;
+ }
+ }
+ int pos = lastFolderNode != null ? lastFolderNode.getChildNodeIndex() + 1 : 0;
+ getTree().addChildNode(pos, parentNode, newNode);
+ rebuildBookmarkModel();
+ }
+ }
+
+ @Order(10)
+ public class NewRootFolderMenu extends AbstractMenu {
+ @Override
+ protected String getConfiguredText() {
+ return ScoutTexts.get("NewBookmarkFolderMenu");
+ }
+
+ @Override
+ protected boolean getConfiguredSingleSelectionAction() {
+ return false;
+ }
+
+ @Override
+ protected boolean getConfiguredEmptySpaceAction() {
+ return true;
+ }
+
+ @Override
+ protected void execPrepareAction() {
+ setVisiblePermission(getUpdatePermission());
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ addNewFolder(null);
+ }
+ }
+
+ @Order(11)
+ public class NewChildFolderMenu extends AbstractMenu {
+ @Override
+ protected String getConfiguredText() {
+ return ScoutTexts.get("NewBookmarkFolderMenu");
+ }
+
+ @Override
+ protected void execPrepareAction() {
+ ITreeNode node = getSelectedNode();
+ setVisible(!isBookmarkNode(node));
+ setVisiblePermission(getUpdatePermission());
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ addNewFolder(getSelectedNode());
+ }
+ }
+
+ @Order(20)
+ public class Separator1Menu extends MenuSeparator {
+
+ @Override
+ protected void execPrepareAction() throws ProcessingException {
+ ITreeNode node = getSelectedNode();
+ setVisible(!isBookmarkNode(node));
+ setVisiblePermission(getUpdatePermission());
+ }
+
+ }
+
+ @Order(40)
+ public class DeleteKeyStroke extends AbstractKeyStroke {
+ @Override
+ protected String getConfiguredKeyStroke() {
+ return "DELETE";
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ ITreeNode node = getSelectedNode();
+ if (node != null) {
+ for (IMenu m : node.getMenus()) {
+ if (m.getClass().getSimpleName().equals("DeleteMenu")) {
+ m.prepareAction();
+ if (m.isVisible() && m.isEnabled()) {
+ m.doAction();
+ }
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ }
+
+ private class FolderNode extends AbstractTreeNode {
+ @Override
+ protected void execDecorateCell(Cell cell) {
+ BookmarkFolder bmFolder = (BookmarkFolder) getCell().getValue();
+ String title = bmFolder.getTitle();
+ if (Bookmark.INBOX_FOLDER_NAME.equals(title)) {
+ title = getConfiguredGlobalBookmarkLabel();
+ }
+ cell.setText(title);
+ cell.setIconId(AbstractIcons.TreeNode);
+ }
+
+ @Order(30)
+ public class RenameMenu extends AbstractMenu {
+ @Override
+ protected String getConfiguredText() {
+ return ScoutTexts.get("RenameBookmarkFolderMenu");
+ }
+
+ @Override
+ protected void execPrepareAction() {
+ setEnabled(!isProtected());
+ setVisiblePermission(getUpdatePermission());
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ ITreeNode node = FolderNode.this;
+ BookmarkFolder bmFolder = (BookmarkFolder) node.getCell().getValue();
+ BookmarkFolderForm form = new BookmarkFolderForm();
+ form.getNameField().setValue(bmFolder.getTitle());
+ form.startModify();
+ form.waitFor();
+ if (form.isFormStored()) {
+ bmFolder.setTitle(form.getNameField().getValue());
+ getTree().updateNode(node);
+ refreshBookmarkModel();
+ }
+ }
+ }
+
+ @Order(40)
+ public class DeleteMenu extends AbstractMenu {
+ @Override
+ protected String getConfiguredText() {
+ return ScoutTexts.get("DeleteFolderMenu");
+ }
+
+ @Override
+ protected boolean getConfiguredMultiSelectionAction() {
+ return true;
+ }
+
+ @Override
+ protected void execPrepareAction() {
+ setEnabled(!isProtected());
+ setVisiblePermission(getDeletePermission());
+ setText(getConfiguredText());
+ for (ITreeNode node : getTree().getSelectedNodes()) {
+ if (!(node instanceof FolderNode)) {
+ setText(ScoutTexts.get("DeleteMenu"));
+ }
+ }
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ ITree tree = getTree();
+ Set<ITreeNode> folders = new HashSet<ITreeNode>();
+ Set<ITreeNode> bookmarks = new HashSet<ITreeNode>();
+ for (ITreeNode node : tree.getSelectedNodes()) {
+ addNodeFoldersToSet(folders, node);
+ addNodeBookmarksToSet(bookmarks, node);
+ }
+ ArrayList<String> names = new ArrayList<String>();
+ for (ITreeNode folder : folders) {
+ names.add(((BookmarkFolder) folder.getCell().getValue()).getTitle());
+ }
+ for (ITreeNode bookmark : bookmarks) {
+ ArrayList<Bookmark> check = new ArrayList<Bookmark>();
+ check.add(((Bookmark) bookmark.getCell().getValue()));
+ if (ACCESS.check(getDeletePermission(check))) {
+ names.add(((Bookmark) bookmark.getCell().getValue()).getTitle());
+ }
+ }
+ if (MessageBox.showDeleteConfirmationMessage(names.toArray(new String[names.size()]))) {
+ // delete bookmarks
+ for (ITreeNode bookmark : bookmarks) {
+ tree.removeNode(bookmark);
+ }
+ // delete folders
+ for (ITreeNode bookmark : folders) {
+ tree.removeNode(bookmark);
+ }
+ refreshBookmarkModel();
+ }
+ }
+
+ private void addNodeBookmarksToSet(Set<ITreeNode> items, ITreeNode node) {
+ if (isFolderNode(node)) {
+ for (ITreeNode child : node.getChildNodes()) {
+ addNodeBookmarksToSet(items, child);
+ }
+ }
+ else if (isBookmarkNode(node)) {
+ items.add(node);
+ }
+ }
+
+ private void addNodeFoldersToSet(Set<ITreeNode> items, ITreeNode node) {
+ if (isFolderNode(node)) {
+ items.add(node);
+ for (ITreeNode child : node.getChildNodes()) {
+ addNodeFoldersToSet(items, child);
+ }
+ }
+ }
+
+ }
+
+ private boolean isProtected() {
+ ITreeNode node = FolderNode.this;
+ BookmarkFolder bmFolder = (BookmarkFolder) node.getCell().getValue();
+ if (Bookmark.INBOX_FOLDER_NAME.equals(bmFolder.getTitle()) ||
+ Bookmark.SPOOL_FOLDER_NAME.equals(bmFolder.getTitle())) {
+ return true;
+ }
+ return false;
+ }
+
+ }
+
+ private class BookmarkNode extends AbstractTreeNode implements IBookmarkNode {
+ @Override
+ protected boolean getConfiguredLeaf() {
+ return true;
+ }
+
+ @Override
+ protected void execDecorateCell(Cell cell) {
+ Bookmark bm = (Bookmark) cell.getValue();
+ if (bm != null) {
+ if (bm.getKeyStroke() != null) {
+ cell.setText(bm.getTitle() + " [" + bm.getKeyStroke() + "]");
+ }
+ else {
+ cell.setText(bm.getTitle());
+ }
+ cell.setTooltipText(bm.getText());
+ if (StringUtility.isNullOrEmpty(bm.getIconId())) {
+ cell.setIconId(AbstractIcons.Bookmark);
+ }
+ else {
+ cell.setIconId(bm.getIconId());
+ }
+ if (bm.isNew()) {
+ cell.setFont(new FontSpec(null, FontSpec.STYLE_BOLD, 0));
+ }
+ }
+ }
+
+ @Order(40)
+ public class OpenMenu extends AbstractMenu {
+ @Override
+ protected String getConfiguredText() {
+ return ScoutTexts.get("ActivateBookmarkMenu");
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ ITreeNode node = BookmarkNode.this;
+ Bookmark bm = (Bookmark) node.getCell().getValue();
+ if (m_openBookmarkCommand != null) {
+ m_openBookmarkCommand.openBookmark(bm);
+ }
+ else {
+ ClientSyncJob.getCurrentSession().getDesktop().activateBookmark(bm, false);
+ }
+ }
+ }
+
+ @Order(50)
+ public class EditMenu extends AbstractMenu {
+ @Override
+ protected String getConfiguredText() {
+ return ScoutTexts.get("EditBookmarkMenu");
+ }
+
+ @Override
+ protected void execPrepareAction() throws ProcessingException {
+ ArrayList<Bookmark> bookmarks = new ArrayList<Bookmark>();
+ ITree tree = getTree();
+ for (ITreeNode node : tree.getSelectedNodes()) {
+ if (isBookmarkNode(node)) {
+ bookmarks.add((Bookmark) node.getCell().getValue());
+ }
+ }
+ setEnabledPermission(getUpdatePermission(bookmarks));
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ ITreeNode node = BookmarkNode.this;
+ Bookmark bm = (Bookmark) node.getCell().getValue();
+ IBookmarkForm form = null;
+ if (getConfiguredBookmarkForm() != null) {
+ try {
+ form = getConfiguredBookmarkForm().newInstance();
+ }
+ catch (Exception e) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException(this.getClass().getSimpleName(), e));
+ }
+ }
+ if (form == null) {
+ form = new BookmarkForm();
+ }
+ form.setBookmark(bm);
+ form.setBookmarkRootFolder(getBookmarkRootFolder());
+ BookmarkFolder oldBmFolder = getParentBookmarkFolder(BookmarkNode.this);
+ boolean oldIsNew = bm.isNew();
+ if (oldBmFolder != form.getBookmarkRootFolder()) {
+ form.setFolder(oldBmFolder);
+ }
+ form.startModify();
+ form.waitFor();
+ if (form.isFormStored()) {
+ ITree tree = getTree();
+ bm.setTitle(form.getBookmark().getTitle());
+ bm.setKeyStroke(form.getBookmark().getKeyStroke());
+ bm.setKind(form.getBookmark().getKind());
+ bm.setIconId(form.getBookmark().getIconId());
+ final BookmarkFolder newBmFolder = form.getFolder() != null ? form.getFolder() : form.getBookmarkRootFolder();
+ if (!CompareUtility.equals(oldBmFolder, newBmFolder)) {
+ //find new folder node
+ final AtomicReference<ITreeNode> newContainerNode = new AtomicReference<ITreeNode>(getTree().getRootNode());
+ tree.visitTree(new ITreeVisitor() {
+ @Override
+ public boolean visit(ITreeNode n) {
+ if (isFolderNode(n) && newBmFolder.equals(n.getCell().getValue())) {
+ newContainerNode.set(n);
+ return false;
+ }
+ return true;
+ }
+ });
+ tree.removeNode(node);
+ tree.addChildNode(newContainerNode.get(), node);
+ rebuildBookmarkModel();
+ }
+ else {
+ tree.updateNode(node);
+ refreshBookmarkModel();
+ }
+ }
+ else if (oldIsNew != form.getBookmark().isNew()) {
+ refreshBookmarkModel();
+ }
+ }
+ }
+
+ @Order(60)
+ public class UpdateWithCurrentMenu extends AbstractMenu {
+
+ @Override
+ protected String getConfiguredText() {
+ return ScoutTexts.get("UpdateBookmarkMenu");
+ }
+
+ @Override
+ protected void execPrepareAction() throws ProcessingException {
+ // The permission to use the "update bookmark" function
+ // is the same as to delete one:
+ ArrayList<Bookmark> bookmarks = new ArrayList<Bookmark>();
+ ITree tree = getTree();
+ for (ITreeNode node : tree.getSelectedNodes()) {
+ if (isBookmarkNode(node)) {
+ bookmarks.add((Bookmark) node.getCell().getValue());
+ }
+ }
+ setEnabledPermission(getDeletePermission(bookmarks));
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ ITreeNode node = BookmarkNode.this;
+ Bookmark bm = (Bookmark) node.getCell().getValue();
+
+ IBookmarkService service = SERVICES.getService(IBookmarkService.class);
+ service.updateBookmark(bm);
+ service.storeBookmarks();
+ }
+ }
+
+ @Order(70)
+ public class DeleteMenu extends AbstractMenu {
+ @Override
+ protected String getConfiguredText() {
+ return ScoutTexts.get("DeleteBookmarkMenu");
+ }
+
+ @Override
+ protected boolean getConfiguredMultiSelectionAction() {
+ return true;
+ }
+
+ @Override
+ protected void execPrepareAction() throws ProcessingException {
+ ArrayList<Bookmark> bookmarks = new ArrayList<Bookmark>();
+ ITree tree = getTree();
+ for (ITreeNode node : tree.getSelectedNodes()) {
+ if (isBookmarkNode(node)) {
+ bookmarks.add((Bookmark) node.getCell().getValue());
+ }
+ }
+ setEnabledPermission(getDeletePermission(bookmarks));
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ ArrayList<String> items = new ArrayList<String>();
+ ArrayList<ITreeNode> filteredNodes = new ArrayList<ITreeNode>();
+ ITree tree = getTree();
+ for (ITreeNode node : tree.getSelectedNodes()) {
+ if (isBookmarkNode(node)) {
+ items.add(node.getCell().getText());
+ filteredNodes.add(node);
+ }
+ }
+ if (items.size() <= 1 || MessageBox.showDeleteConfirmationMessage(items.toArray(new String[0]))) {
+ for (ITreeNode node : filteredNodes) {
+ tree.removeNode(node);
+ }
+ rebuildBookmarkModel();
+ }
+ }
+ }
+
+ @Order(80)
+ public class SeparatorMenu1 extends MenuSeparator {
+ }
+
+ @Order(90)
+ public class PublishMenu extends AbstractMenu {
+ @Override
+ protected String getConfiguredText() {
+ return ScoutTexts.get("BookmarksPublishMenu");
+ }
+
+ @Override
+ protected void execPrepareAction() throws ProcessingException {
+ Bookmark bookmark = null;
+ ITreeNode selectedNode = getTree().getSelectedNode();
+ if (isBookmarkNode(selectedNode)) {
+ bookmark = (Bookmark) selectedNode.getCell().getValue();
+ }
+ setVisiblePermission(getPublishPermission(bookmark));
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ if (m_publishBookmarkCommand != null) {
+ ITreeNode node = BookmarkNode.this;
+ Bookmark bm = (Bookmark) node.getCell().getValue();
+ BookmarkFolder spoolFolder = new BookmarkFolder();
+ spoolFolder.getBookmarks().add(bm);
+ m_publishBookmarkCommand.publishBookmark(spoolFolder);
+ }
+ }
+ }
+
+ @Order(100)
+ public class ApplyToSearchMenu extends AbstractMenu {
+ @Override
+ protected String getConfiguredText() {
+ return ScoutTexts.get("BookmarksApplyToCurrentSearch");
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ ITreeNode node = BookmarkNode.this;
+ Bookmark bm = (Bookmark) node.getCell().getValue();
+ IDesktop desktop = ClientSyncJob.getCurrentSession().getDesktop();
+ Boolean success = null;
+ if (desktop != null) {
+ IForm searchForm = desktop.getPageSearchForm();
+ if (searchForm != null) {
+ for (AbstractPageState state : bm.getPath()) {
+ if (state instanceof TablePageState) {
+ TablePageState tablePageState = (TablePageState) state;
+ try {
+ searchForm.setXML(tablePageState.getSearchFormState());
+ searchForm.doSaveWithoutMarkerChange();
+ success = true;
+ break;
+ }
+ catch (ProcessingException e) {
+ success = false;
+ }
+ }
+ }
+ }
+ }
+ if (success != null && !success) {
+ MessageBox.showOkMessage(null, null, ScoutTexts.get("ApplyBookmarkToSearchFailedMessage"));
+ }
+ }
+ }
+
+ @Override
+ public Bookmark getBookmark() {
+ ITreeNode node = BookmarkNode.this;
+ return (Bookmark) node.getCell().getValue();
+ }
+
+ @Override
+ public BookmarkFolder getParentFolder() {
+ ITreeNode node = BookmarkNode.this;
+ return (BookmarkFolder) node.getParentNode().getCell().getValue();
+ }
+
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/BookmarkFolderForm.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/BookmarkFolderForm.java
index dc3bd7221b..a6efbb4a04 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/BookmarkFolderForm.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/BookmarkFolderForm.java
@@ -1,102 +1,102 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.desktop.bookmark;
-
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.desktop.bookmark.BookmarkFolderForm.MainBox.GroupBox.NameField;
-import org.eclipse.scout.rt.client.ui.form.AbstractForm;
-import org.eclipse.scout.rt.client.ui.form.AbstractFormHandler;
-import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractCancelButton;
-import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractOkButton;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
-import org.eclipse.scout.rt.client.ui.form.fields.stringfield.AbstractStringField;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-
-public class BookmarkFolderForm extends AbstractForm {
-
- public BookmarkFolderForm() throws ProcessingException {
- super();
- }
-
- @Override
- protected String getConfiguredTitle() {
- return ScoutTexts.get("Folders");
- }
-
- public void startNew() throws ProcessingException {
- startInternal(new NewHandler());
- }
-
- public void startModify() throws ProcessingException {
- startInternal(new ModifyHandler());
- }
-
- public MainBox getMainBox() {
- return (MainBox) getRootGroupBox();
- }
-
- public NameField getNameField() {
- return getFieldByClass(NameField.class);
- }
-
- @Order(10f)
- public class MainBox extends AbstractGroupBox {
-
- @Override
- protected int getConfiguredGridColumnCount() {
- return 1;
- }
-
- @Order(10f)
- public class GroupBox extends AbstractGroupBox {
-
- @Order(10f)
- public class NameField extends AbstractStringField {
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("Name");
- }
-
- @Override
- protected boolean getConfiguredMandatory() {
- return true;
- }
-
- @Override
- protected int getConfiguredMaxLength() {
- return 4000;
- }
-
- @Override
- protected String execValidateValue(String rawValue) throws ProcessingException {
- return rawValue.replaceAll("[\\/]", " ").trim();
- }
- }
- }
-
- @Order(40f)
- public class OkButton extends AbstractOkButton {
- }
-
- @Order(50f)
- public class CancelButton extends AbstractCancelButton {
- }
- }
-
- @Order(20f)
- public class NewHandler extends AbstractFormHandler {
- }
-
- @Order(20f)
- public class ModifyHandler extends AbstractFormHandler {
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.desktop.bookmark;
+
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.desktop.bookmark.BookmarkFolderForm.MainBox.GroupBox.NameField;
+import org.eclipse.scout.rt.client.ui.form.AbstractForm;
+import org.eclipse.scout.rt.client.ui.form.AbstractFormHandler;
+import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractCancelButton;
+import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractOkButton;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
+import org.eclipse.scout.rt.client.ui.form.fields.stringfield.AbstractStringField;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+
+public class BookmarkFolderForm extends AbstractForm {
+
+ public BookmarkFolderForm() throws ProcessingException {
+ super();
+ }
+
+ @Override
+ protected String getConfiguredTitle() {
+ return ScoutTexts.get("Folders");
+ }
+
+ public void startNew() throws ProcessingException {
+ startInternal(new NewHandler());
+ }
+
+ public void startModify() throws ProcessingException {
+ startInternal(new ModifyHandler());
+ }
+
+ public MainBox getMainBox() {
+ return (MainBox) getRootGroupBox();
+ }
+
+ public NameField getNameField() {
+ return getFieldByClass(NameField.class);
+ }
+
+ @Order(10f)
+ public class MainBox extends AbstractGroupBox {
+
+ @Override
+ protected int getConfiguredGridColumnCount() {
+ return 1;
+ }
+
+ @Order(10f)
+ public class GroupBox extends AbstractGroupBox {
+
+ @Order(10f)
+ public class NameField extends AbstractStringField {
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("Name");
+ }
+
+ @Override
+ protected boolean getConfiguredMandatory() {
+ return true;
+ }
+
+ @Override
+ protected int getConfiguredMaxLength() {
+ return 4000;
+ }
+
+ @Override
+ protected String execValidateValue(String rawValue) throws ProcessingException {
+ return rawValue.replaceAll("[\\/]", " ").trim();
+ }
+ }
+ }
+
+ @Order(40f)
+ public class OkButton extends AbstractOkButton {
+ }
+
+ @Order(50f)
+ public class CancelButton extends AbstractCancelButton {
+ }
+ }
+
+ @Order(20f)
+ public class NewHandler extends AbstractFormHandler {
+ }
+
+ @Order(20f)
+ public class ModifyHandler extends AbstractFormHandler {
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/BookmarkFolderLookupCall.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/BookmarkFolderLookupCall.java
index 69771c6249..f348087fc8 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/BookmarkFolderLookupCall.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/BookmarkFolderLookupCall.java
@@ -1,70 +1,70 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.desktop.bookmark;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.shared.AbstractIcons;
-import org.eclipse.scout.rt.shared.services.common.bookmark.Bookmark;
-import org.eclipse.scout.rt.shared.services.common.bookmark.BookmarkFolder;
-import org.eclipse.scout.rt.shared.services.common.bookmark.IBookmarkVisitor;
-import org.eclipse.scout.rt.shared.services.lookup.LocalLookupCall;
-import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
-
-/**
- * hierarchy lookup call for bookmark folder tree
- */
-public class BookmarkFolderLookupCall extends LocalLookupCall {
- private static final long serialVersionUID = 1L;
-
- private BookmarkFolder m_rootFolder;
-
- public BookmarkFolder getRootFolder() {
- return m_rootFolder;
- }
-
- public void setRootFolder(BookmarkFolder rootFolder) {
- m_rootFolder = rootFolder;
- }
-
- @Override
- public List<LookupRow> execCreateLookupRows() throws ProcessingException {
- final ArrayList<LookupRow> rows = new ArrayList<LookupRow>();
- if (m_rootFolder != null) {
- m_rootFolder.visit(new IBookmarkVisitor() {
- @Override
- public boolean visitFolder(List<BookmarkFolder> path) {
- if (path.size() >= 2) {
- BookmarkFolder f = path.get(path.size() - 1);
- if (!Bookmark.INBOX_FOLDER_NAME.equals(f.getTitle())) {
- BookmarkFolder parent = null;
- if (path.size() >= 3) {
- parent = path.get(path.size() - 2);
- }
- LookupRow row = new LookupRow(f, f.getTitle(), f.getIconId() != null ? f.getIconId() : AbstractIcons.TreeNode);
- row.setParentKey(parent);
- rows.add(row);
- }
- }
- return true;
- }
-
- @Override
- public boolean visitBookmark(List<BookmarkFolder> path, Bookmark b) {
- return true;
- }
- });
- }
- return rows;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.desktop.bookmark;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.shared.AbstractIcons;
+import org.eclipse.scout.rt.shared.services.common.bookmark.Bookmark;
+import org.eclipse.scout.rt.shared.services.common.bookmark.BookmarkFolder;
+import org.eclipse.scout.rt.shared.services.common.bookmark.IBookmarkVisitor;
+import org.eclipse.scout.rt.shared.services.lookup.LocalLookupCall;
+import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
+
+/**
+ * hierarchy lookup call for bookmark folder tree
+ */
+public class BookmarkFolderLookupCall extends LocalLookupCall {
+ private static final long serialVersionUID = 1L;
+
+ private BookmarkFolder m_rootFolder;
+
+ public BookmarkFolder getRootFolder() {
+ return m_rootFolder;
+ }
+
+ public void setRootFolder(BookmarkFolder rootFolder) {
+ m_rootFolder = rootFolder;
+ }
+
+ @Override
+ public List<LookupRow> execCreateLookupRows() throws ProcessingException {
+ final ArrayList<LookupRow> rows = new ArrayList<LookupRow>();
+ if (m_rootFolder != null) {
+ m_rootFolder.visit(new IBookmarkVisitor() {
+ @Override
+ public boolean visitFolder(List<BookmarkFolder> path) {
+ if (path.size() >= 2) {
+ BookmarkFolder f = path.get(path.size() - 1);
+ if (!Bookmark.INBOX_FOLDER_NAME.equals(f.getTitle())) {
+ BookmarkFolder parent = null;
+ if (path.size() >= 3) {
+ parent = path.get(path.size() - 2);
+ }
+ LookupRow row = new LookupRow(f, f.getTitle(), f.getIconId() != null ? f.getIconId() : AbstractIcons.TreeNode);
+ row.setParentKey(parent);
+ rows.add(row);
+ }
+ }
+ return true;
+ }
+
+ @Override
+ public boolean visitBookmark(List<BookmarkFolder> path, Bookmark b) {
+ return true;
+ }
+ });
+ }
+ return rows;
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/BookmarkForm.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/BookmarkForm.java
index dea9ec7ff7..d7b31b672b 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/BookmarkForm.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/BookmarkForm.java
@@ -1,238 +1,238 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.desktop.bookmark;
-
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.desktop.bookmark.BookmarkForm.MainBox.GroupBox.DescriptionField;
-import org.eclipse.scout.rt.client.ui.desktop.bookmark.BookmarkForm.MainBox.GroupBox.FolderField;
-import org.eclipse.scout.rt.client.ui.desktop.bookmark.BookmarkForm.MainBox.GroupBox.KeyStrokeField;
-import org.eclipse.scout.rt.client.ui.desktop.bookmark.BookmarkForm.MainBox.GroupBox.TitleField;
-import org.eclipse.scout.rt.client.ui.form.AbstractForm;
-import org.eclipse.scout.rt.client.ui.form.AbstractFormHandler;
-import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractCancelButton;
-import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractOkButton;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
-import org.eclipse.scout.rt.client.ui.form.fields.smartfield.AbstractSmartField;
-import org.eclipse.scout.rt.client.ui.form.fields.stringfield.AbstractStringField;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.services.common.bookmark.Bookmark;
-import org.eclipse.scout.rt.shared.services.common.bookmark.BookmarkFolder;
-import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
-
-public class BookmarkForm extends AbstractForm implements IBookmarkForm {
- private BookmarkFolder m_bookmarkRootFolder;
- private Bookmark m_bookmark;
-
- public BookmarkForm() throws ProcessingException {
- super();
- }
-
- @Override
- public BookmarkFolder getBookmarkRootFolder() {
- return m_bookmarkRootFolder;
- }
-
- @Override
- public void setBookmarkRootFolder(BookmarkFolder bookmarkRootFolder) {
- m_bookmarkRootFolder = bookmarkRootFolder;
- ((BookmarkFolderLookupCall) getFolderField().getLookupCall()).setRootFolder(m_bookmarkRootFolder);
- }
-
- @Override
- public Bookmark getBookmark() {
- if (m_bookmark != null) {
- m_bookmark.setTitle(getTitleField().getValue());
- m_bookmark.setKeyStroke(getKeyStrokeField().getValue());
- m_bookmark.setText(getDescriptionField().getValue());
- }
- return m_bookmark;
- }
-
- @Override
- public void setBookmark(Bookmark bookmark) {
- m_bookmark = bookmark;
- if (bookmark != null) {
- getTitleField().setValue(bookmark.getTitle());
- getKeyStrokeField().setValue(bookmark.getKeyStroke());
- getDescriptionField().setValue(bookmark.getText());
- }
- }
-
- @Override
- protected String getConfiguredTitle() {
- return ScoutTexts.get("Bookmark");
- }
-
- @Override
- public void startModify() throws ProcessingException {
- startInternal(new ModifyHandler());
- }
-
- @Override
- public void startNew() throws ProcessingException {
- startInternal(new NewHandler());
- }
-
- public MainBox getMainBox() {
- return (MainBox) getRootGroupBox();
- }
-
- public TitleField getTitleField() {
- return getFieldByClass(TitleField.class);
- }
-
- public KeyStrokeField getKeyStrokeField() {
- return getFieldByClass(KeyStrokeField.class);
- }
-
- public DescriptionField getDescriptionField() {
- return getFieldByClass(DescriptionField.class);
- }
-
- public FolderField getFolderField() {
- return getFieldByClass(FolderField.class);
- }
-
- @Order(10f)
- public class MainBox extends AbstractGroupBox {
- @Override
- protected int getConfiguredGridColumnCount() {
- return 1;
- }
-
- @Order(10)
- public class GroupBox extends AbstractGroupBox {
-
- @Order(10)
- public class TitleField extends AbstractStringField {
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("Name");
- }
-
- @Override
- protected boolean getConfiguredMandatory() {
- return true;
- }
-
- @Override
- protected int getConfiguredMaxLength() {
- return 4000;
- }
- }
-
- @Order(20)
- public class FolderField extends AbstractSmartField<BookmarkFolder> {
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("BookmarkFolder");
- }
-
- @Override
- protected boolean getConfiguredBrowseHierarchy() {
- return true;
- }
-
- @Override
- protected Class<? extends LookupCall> getConfiguredLookupCall() {
- return BookmarkFolderLookupCall.class;
- }
- }
-
- @Order(30)
- public class KeyStrokeField extends AbstractSmartField<String> {
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("KeyStroke");
- }
-
- @Override
- protected Class<? extends LookupCall> getConfiguredLookupCall() {
- return KeyStrokeLookupCall.class;
- }
-
- @Override
- protected void execPrepareLookup(LookupCall call) {
- ((KeyStrokeLookupCall) call).setCurrentKeyStroke(getValue());
- }
- }
-
- @Order(40)
- public class DescriptionField extends AbstractStringField {
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("Path");
- }
-
- @Override
- protected boolean getConfiguredLabelVisible() {
- return false;
- }
-
- @Override
- protected boolean getConfiguredMultilineText() {
- return true;
- }
-
- @Override
- protected boolean getConfiguredEnabled() {
- return false;
- }
-
- @Override
- protected int getConfiguredMaxLength() {
- return 4000;
- }
-
- @Override
- protected int getConfiguredGridW() {
- return 1;
- }
-
- @Override
- protected int getConfiguredGridH() {
- return 6;
- }
- }
- }
-
- @Order(40f)
- public class OkButton extends AbstractOkButton {
- }
-
- @Order(50f)
- public class CancelButton extends AbstractCancelButton {
- }
- }
-
- @Order(20f)
- public class ModifyHandler extends AbstractFormHandler {
- }
-
- @Order(20f)
- public class NewHandler extends AbstractFormHandler {
- @Override
- protected void execPostLoad() throws ProcessingException {
- touch();
- }
- }
-
- @Override
- public BookmarkFolder getFolder() throws ProcessingException {
- return getFolderField().getValue();
- }
-
- @Override
- public void setFolder(BookmarkFolder folder) throws ProcessingException {
- getFolderField().setValue(folder);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.desktop.bookmark;
+
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.desktop.bookmark.BookmarkForm.MainBox.GroupBox.DescriptionField;
+import org.eclipse.scout.rt.client.ui.desktop.bookmark.BookmarkForm.MainBox.GroupBox.FolderField;
+import org.eclipse.scout.rt.client.ui.desktop.bookmark.BookmarkForm.MainBox.GroupBox.KeyStrokeField;
+import org.eclipse.scout.rt.client.ui.desktop.bookmark.BookmarkForm.MainBox.GroupBox.TitleField;
+import org.eclipse.scout.rt.client.ui.form.AbstractForm;
+import org.eclipse.scout.rt.client.ui.form.AbstractFormHandler;
+import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractCancelButton;
+import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractOkButton;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
+import org.eclipse.scout.rt.client.ui.form.fields.smartfield.AbstractSmartField;
+import org.eclipse.scout.rt.client.ui.form.fields.stringfield.AbstractStringField;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.services.common.bookmark.Bookmark;
+import org.eclipse.scout.rt.shared.services.common.bookmark.BookmarkFolder;
+import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
+
+public class BookmarkForm extends AbstractForm implements IBookmarkForm {
+ private BookmarkFolder m_bookmarkRootFolder;
+ private Bookmark m_bookmark;
+
+ public BookmarkForm() throws ProcessingException {
+ super();
+ }
+
+ @Override
+ public BookmarkFolder getBookmarkRootFolder() {
+ return m_bookmarkRootFolder;
+ }
+
+ @Override
+ public void setBookmarkRootFolder(BookmarkFolder bookmarkRootFolder) {
+ m_bookmarkRootFolder = bookmarkRootFolder;
+ ((BookmarkFolderLookupCall) getFolderField().getLookupCall()).setRootFolder(m_bookmarkRootFolder);
+ }
+
+ @Override
+ public Bookmark getBookmark() {
+ if (m_bookmark != null) {
+ m_bookmark.setTitle(getTitleField().getValue());
+ m_bookmark.setKeyStroke(getKeyStrokeField().getValue());
+ m_bookmark.setText(getDescriptionField().getValue());
+ }
+ return m_bookmark;
+ }
+
+ @Override
+ public void setBookmark(Bookmark bookmark) {
+ m_bookmark = bookmark;
+ if (bookmark != null) {
+ getTitleField().setValue(bookmark.getTitle());
+ getKeyStrokeField().setValue(bookmark.getKeyStroke());
+ getDescriptionField().setValue(bookmark.getText());
+ }
+ }
+
+ @Override
+ protected String getConfiguredTitle() {
+ return ScoutTexts.get("Bookmark");
+ }
+
+ @Override
+ public void startModify() throws ProcessingException {
+ startInternal(new ModifyHandler());
+ }
+
+ @Override
+ public void startNew() throws ProcessingException {
+ startInternal(new NewHandler());
+ }
+
+ public MainBox getMainBox() {
+ return (MainBox) getRootGroupBox();
+ }
+
+ public TitleField getTitleField() {
+ return getFieldByClass(TitleField.class);
+ }
+
+ public KeyStrokeField getKeyStrokeField() {
+ return getFieldByClass(KeyStrokeField.class);
+ }
+
+ public DescriptionField getDescriptionField() {
+ return getFieldByClass(DescriptionField.class);
+ }
+
+ public FolderField getFolderField() {
+ return getFieldByClass(FolderField.class);
+ }
+
+ @Order(10f)
+ public class MainBox extends AbstractGroupBox {
+ @Override
+ protected int getConfiguredGridColumnCount() {
+ return 1;
+ }
+
+ @Order(10)
+ public class GroupBox extends AbstractGroupBox {
+
+ @Order(10)
+ public class TitleField extends AbstractStringField {
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("Name");
+ }
+
+ @Override
+ protected boolean getConfiguredMandatory() {
+ return true;
+ }
+
+ @Override
+ protected int getConfiguredMaxLength() {
+ return 4000;
+ }
+ }
+
+ @Order(20)
+ public class FolderField extends AbstractSmartField<BookmarkFolder> {
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("BookmarkFolder");
+ }
+
+ @Override
+ protected boolean getConfiguredBrowseHierarchy() {
+ return true;
+ }
+
+ @Override
+ protected Class<? extends LookupCall> getConfiguredLookupCall() {
+ return BookmarkFolderLookupCall.class;
+ }
+ }
+
+ @Order(30)
+ public class KeyStrokeField extends AbstractSmartField<String> {
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("KeyStroke");
+ }
+
+ @Override
+ protected Class<? extends LookupCall> getConfiguredLookupCall() {
+ return KeyStrokeLookupCall.class;
+ }
+
+ @Override
+ protected void execPrepareLookup(LookupCall call) {
+ ((KeyStrokeLookupCall) call).setCurrentKeyStroke(getValue());
+ }
+ }
+
+ @Order(40)
+ public class DescriptionField extends AbstractStringField {
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("Path");
+ }
+
+ @Override
+ protected boolean getConfiguredLabelVisible() {
+ return false;
+ }
+
+ @Override
+ protected boolean getConfiguredMultilineText() {
+ return true;
+ }
+
+ @Override
+ protected boolean getConfiguredEnabled() {
+ return false;
+ }
+
+ @Override
+ protected int getConfiguredMaxLength() {
+ return 4000;
+ }
+
+ @Override
+ protected int getConfiguredGridW() {
+ return 1;
+ }
+
+ @Override
+ protected int getConfiguredGridH() {
+ return 6;
+ }
+ }
+ }
+
+ @Order(40f)
+ public class OkButton extends AbstractOkButton {
+ }
+
+ @Order(50f)
+ public class CancelButton extends AbstractCancelButton {
+ }
+ }
+
+ @Order(20f)
+ public class ModifyHandler extends AbstractFormHandler {
+ }
+
+ @Order(20f)
+ public class NewHandler extends AbstractFormHandler {
+ @Override
+ protected void execPostLoad() throws ProcessingException {
+ touch();
+ }
+ }
+
+ @Override
+ public BookmarkFolder getFolder() throws ProcessingException {
+ return getFolderField().getValue();
+ }
+
+ @Override
+ public void setFolder(BookmarkFolder folder) throws ProcessingException {
+ getFolderField().setValue(folder);
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/IBookmarkForm.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/IBookmarkForm.java
index afdf822eed..d8f261d474 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/IBookmarkForm.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/IBookmarkForm.java
@@ -1,70 +1,70 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.desktop.bookmark;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.shared.services.common.bookmark.Bookmark;
-import org.eclipse.scout.rt.shared.services.common.bookmark.BookmarkFolder;
-
-public interface IBookmarkForm extends IForm {
-
- /**
- * @param bookmark
- * the bookmark to be modified
- */
- void setBookmark(Bookmark bookmark);
-
- /**
- * @return the bookmark for further processing
- */
- Bookmark getBookmark();
-
- /**
- * Set the top-level folder where the bookmark is located
- *
- * @param rootFolder
- * top-level folder
- */
- void setBookmarkRootFolder(BookmarkFolder rootFolder);
-
- /**
- * @return the top-level folder where the bookmark is located
- */
- BookmarkFolder getBookmarkRootFolder();
-
- /**
- * @return the folder where the bookmark is located
- * @throws ProcessingException
- */
- BookmarkFolder getFolder() throws ProcessingException;
-
- /**
- * @param folder
- * the folder where the bookmark is located
- * @throws ProcessingException
- */
- void setFolder(BookmarkFolder folder) throws ProcessingException;
-
- /**
- * Opens the form for modification of an existing bookmark
- *
- * @throws ProcessingException
- */
- void startModify() throws ProcessingException;
-
- /**
- * Opens the form for creation of a new bookmark
- *
- * @throws ProcessingException
- */
- void startNew() throws ProcessingException;
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.desktop.bookmark;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.shared.services.common.bookmark.Bookmark;
+import org.eclipse.scout.rt.shared.services.common.bookmark.BookmarkFolder;
+
+public interface IBookmarkForm extends IForm {
+
+ /**
+ * @param bookmark
+ * the bookmark to be modified
+ */
+ void setBookmark(Bookmark bookmark);
+
+ /**
+ * @return the bookmark for further processing
+ */
+ Bookmark getBookmark();
+
+ /**
+ * Set the top-level folder where the bookmark is located
+ *
+ * @param rootFolder
+ * top-level folder
+ */
+ void setBookmarkRootFolder(BookmarkFolder rootFolder);
+
+ /**
+ * @return the top-level folder where the bookmark is located
+ */
+ BookmarkFolder getBookmarkRootFolder();
+
+ /**
+ * @return the folder where the bookmark is located
+ * @throws ProcessingException
+ */
+ BookmarkFolder getFolder() throws ProcessingException;
+
+ /**
+ * @param folder
+ * the folder where the bookmark is located
+ * @throws ProcessingException
+ */
+ void setFolder(BookmarkFolder folder) throws ProcessingException;
+
+ /**
+ * Opens the form for modification of an existing bookmark
+ *
+ * @throws ProcessingException
+ */
+ void startModify() throws ProcessingException;
+
+ /**
+ * Opens the form for creation of a new bookmark
+ *
+ * @throws ProcessingException
+ */
+ void startNew() throws ProcessingException;
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/IBookmarkNode.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/IBookmarkNode.java
index 1218f743a1..c28a09ff1c 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/IBookmarkNode.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/IBookmarkNode.java
@@ -1,33 +1,33 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.desktop.bookmark;
-
-import org.eclipse.scout.commons.dnd.JavaTransferObject;
-import org.eclipse.scout.rt.shared.services.common.bookmark.Bookmark;
-import org.eclipse.scout.rt.shared.services.common.bookmark.BookmarkFolder;
-
-/**
- * A bookmark node in {@link AbstractBookmarkTreeField}. Could be used to handle a drop request and read the node data
- * from a {@link JavaTransferObject}
- */
-public interface IBookmarkNode {
-
- /**
- * @return the bookmark for further processing
- */
- Bookmark getBookmark();
-
- /**
- * @return the folder where the bookmark was located for further processing
- */
- BookmarkFolder getParentFolder();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.desktop.bookmark;
+
+import org.eclipse.scout.commons.dnd.JavaTransferObject;
+import org.eclipse.scout.rt.shared.services.common.bookmark.Bookmark;
+import org.eclipse.scout.rt.shared.services.common.bookmark.BookmarkFolder;
+
+/**
+ * A bookmark node in {@link AbstractBookmarkTreeField}. Could be used to handle a drop request and read the node data
+ * from a {@link JavaTransferObject}
+ */
+public interface IBookmarkNode {
+
+ /**
+ * @return the bookmark for further processing
+ */
+ Bookmark getBookmark();
+
+ /**
+ * @return the folder where the bookmark was located for further processing
+ */
+ BookmarkFolder getParentFolder();
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/KeyStrokeLookupCall.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/KeyStrokeLookupCall.java
index 43ec3ad820..2d0545b77d 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/KeyStrokeLookupCall.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/KeyStrokeLookupCall.java
@@ -1,83 +1,83 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.desktop.bookmark;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Locale;
-import java.util.TreeSet;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.services.common.bookmark.IBookmarkService;
-import org.eclipse.scout.rt.shared.services.common.bookmark.Bookmark;
-import org.eclipse.scout.rt.shared.services.common.bookmark.BookmarkFolder;
-import org.eclipse.scout.rt.shared.services.common.bookmark.IBookmarkVisitor;
-import org.eclipse.scout.rt.shared.services.lookup.LocalLookupCall;
-import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
-import org.eclipse.scout.service.SERVICES;
-
-public class KeyStrokeLookupCall extends LocalLookupCall {
- private static final long serialVersionUID = 1L;
-
- private String m_currentKeyStroke;
-
- public String getCurrentKeyStroke() {
- return m_currentKeyStroke;
- }
-
- public void setCurrentKeyStroke(String s) {
- m_currentKeyStroke = s;
- }
-
- @Override
- protected List<LookupRow> execCreateLookupRows() throws ProcessingException {
- final HashMap<String, Integer> keyStrokesUpper = new HashMap<String, Integer>();
- //build possible keyStrokes
- for (int i = 1; i <= 12; i++) {
- keyStrokesUpper.put("SHIFT-F" + i, new Integer(i));
- }
- //remove used keyStrokes
- IBookmarkService service = SERVICES.getService(IBookmarkService.class);
- IBookmarkVisitor v = new IBookmarkVisitor() {
- @Override
- public boolean visitFolder(List<BookmarkFolder> path) {
- return true;
- }
-
- @Override
- public boolean visitBookmark(List<BookmarkFolder> path, Bookmark b) {
- String keyStroke = b.getKeyStroke();
- if (keyStroke != null) {
- if (m_currentKeyStroke != null && m_currentKeyStroke.equalsIgnoreCase(keyStroke)) {
- //keep it
- }
- else {
- keyStrokesUpper.remove(keyStroke.toUpperCase(Locale.ENGLISH));
- }
- }
- return true;
- }
- };
- service.getBookmarkData().getGlobalBookmarks().visit(v);
- service.getBookmarkData().getUserBookmarks().visit(v);
- //
- TreeSet<Integer> availableNumbers = new TreeSet<Integer>(keyStrokesUpper.values());
- ArrayList<LookupRow> resultList = new ArrayList<LookupRow>();
- for (Integer i : availableNumbers) {
- String key = "Shift-F" + i;
- String text = "Shift-F" + i;
- LookupRow row = new LookupRow(key, text);
- resultList.add(row);
- }
- return resultList;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.desktop.bookmark;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.TreeSet;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.services.common.bookmark.IBookmarkService;
+import org.eclipse.scout.rt.shared.services.common.bookmark.Bookmark;
+import org.eclipse.scout.rt.shared.services.common.bookmark.BookmarkFolder;
+import org.eclipse.scout.rt.shared.services.common.bookmark.IBookmarkVisitor;
+import org.eclipse.scout.rt.shared.services.lookup.LocalLookupCall;
+import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
+import org.eclipse.scout.service.SERVICES;
+
+public class KeyStrokeLookupCall extends LocalLookupCall {
+ private static final long serialVersionUID = 1L;
+
+ private String m_currentKeyStroke;
+
+ public String getCurrentKeyStroke() {
+ return m_currentKeyStroke;
+ }
+
+ public void setCurrentKeyStroke(String s) {
+ m_currentKeyStroke = s;
+ }
+
+ @Override
+ protected List<LookupRow> execCreateLookupRows() throws ProcessingException {
+ final HashMap<String, Integer> keyStrokesUpper = new HashMap<String, Integer>();
+ //build possible keyStrokes
+ for (int i = 1; i <= 12; i++) {
+ keyStrokesUpper.put("SHIFT-F" + i, new Integer(i));
+ }
+ //remove used keyStrokes
+ IBookmarkService service = SERVICES.getService(IBookmarkService.class);
+ IBookmarkVisitor v = new IBookmarkVisitor() {
+ @Override
+ public boolean visitFolder(List<BookmarkFolder> path) {
+ return true;
+ }
+
+ @Override
+ public boolean visitBookmark(List<BookmarkFolder> path, Bookmark b) {
+ String keyStroke = b.getKeyStroke();
+ if (keyStroke != null) {
+ if (m_currentKeyStroke != null && m_currentKeyStroke.equalsIgnoreCase(keyStroke)) {
+ //keep it
+ }
+ else {
+ keyStrokesUpper.remove(keyStroke.toUpperCase(Locale.ENGLISH));
+ }
+ }
+ return true;
+ }
+ };
+ service.getBookmarkData().getGlobalBookmarks().visit(v);
+ service.getBookmarkData().getUserBookmarks().visit(v);
+ //
+ TreeSet<Integer> availableNumbers = new TreeSet<Integer>(keyStrokesUpper.values());
+ ArrayList<LookupRow> resultList = new ArrayList<LookupRow>();
+ for (Integer i : availableNumbers) {
+ String key = "Shift-F" + i;
+ String text = "Shift-F" + i;
+ LookupRow row = new LookupRow(key, text);
+ resultList.add(row);
+ }
+ return resultList;
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/internal/ManageBookmarksForm.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/internal/ManageBookmarksForm.java
index c8f42f0864..06d3efbc15 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/internal/ManageBookmarksForm.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/internal/ManageBookmarksForm.java
@@ -1,212 +1,212 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.desktop.bookmark.internal;
-
-import java.security.Permission;
-
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.services.common.bookmark.BookmarkServiceEvent;
-import org.eclipse.scout.rt.client.services.common.bookmark.BookmarkServiceListener;
-import org.eclipse.scout.rt.client.services.common.bookmark.IBookmarkService;
-import org.eclipse.scout.rt.client.ui.desktop.bookmark.AbstractBookmarkTreeField;
-import org.eclipse.scout.rt.client.ui.desktop.bookmark.internal.ManageBookmarksForm.MainBox.CancelButton;
-import org.eclipse.scout.rt.client.ui.desktop.bookmark.internal.ManageBookmarksForm.MainBox.GlobalBox;
-import org.eclipse.scout.rt.client.ui.desktop.bookmark.internal.ManageBookmarksForm.MainBox.OkButton;
-import org.eclipse.scout.rt.client.ui.desktop.bookmark.internal.ManageBookmarksForm.MainBox.UserBox;
-import org.eclipse.scout.rt.client.ui.desktop.bookmark.internal.ManageBookmarksForm.MainBox.GlobalBox.GlobalBookmarkTreeField;
-import org.eclipse.scout.rt.client.ui.desktop.bookmark.internal.ManageBookmarksForm.MainBox.UserBox.UserBookmarkTreeField;
-import org.eclipse.scout.rt.client.ui.form.AbstractForm;
-import org.eclipse.scout.rt.client.ui.form.AbstractFormHandler;
-import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractCancelButton;
-import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractOkButton;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.security.DeleteGlobalBookmarkPermission;
-import org.eclipse.scout.rt.shared.security.DeleteUserBookmarkPermission;
-import org.eclipse.scout.rt.shared.security.ReadUserBookmarkPermission;
-import org.eclipse.scout.rt.shared.security.UpdateGlobalBookmarkPermission;
-import org.eclipse.scout.rt.shared.security.UpdateUserBookmarkPermission;
-import org.eclipse.scout.service.SERVICES;
-
-public class ManageBookmarksForm extends AbstractForm implements BookmarkServiceListener {
-
- public ManageBookmarksForm() throws ProcessingException {
- super();
- }
-
- @Override
- protected String getConfiguredTitle() {
- return ScoutTexts.get("Bookmarks");
- }
-
- @Override
- public void bookmarksChanged(BookmarkServiceEvent e) {
- getGlobalBookmarkTreeField().setBookmarkRootFolder(e.getBookmarkService().getBookmarkData().getGlobalBookmarks());
- getUserBookmarkTreeField().setBookmarkRootFolder(e.getBookmarkService().getBookmarkData().getUserBookmarks());
- }
-
- public void startModify() throws ProcessingException {
- startInternal(new ModifyHandler());
- }
-
- public MainBox getMainBox() {
- return (MainBox) getRootGroupBox();
- }
-
- public GlobalBox getGlobalBox() {
- return getFieldByClass(GlobalBox.class);
- }
-
- public UserBox getUserBox() {
- return getFieldByClass(UserBox.class);
- }
-
- public OkButton getOkButton() {
- return getFieldByClass(OkButton.class);
- }
-
- public CancelButton getCancelButton() {
- return getFieldByClass(CancelButton.class);
- }
-
- public UserBookmarkTreeField getUserBookmarkTreeField() {
- return getFieldByClass(UserBookmarkTreeField.class);
- }
-
- public GlobalBookmarkTreeField getGlobalBookmarkTreeField() {
- return getFieldByClass(GlobalBookmarkTreeField.class);
- }
-
- @Order(10f)
- public class MainBox extends AbstractGroupBox {
-
- @Order(11)
- public class GlobalBox extends AbstractGroupBox {
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("GlobalBookmarks");
- }
-
- @Override
- protected void execInitField() throws ProcessingException {
- setVisiblePermission(new UpdateGlobalBookmarkPermission());
- }
-
- @Order(10)
- public class GlobalBookmarkTreeField extends AbstractBookmarkTreeField {
- @Override
- protected int getConfiguredGridW() {
- return 2;
- }
-
- @Override
- protected int getConfiguredGridH() {
- return 10;
- }
-
- @Override
- protected Permission getDeletePermission() {
- return new DeleteGlobalBookmarkPermission();
- }
-
- @Override
- protected Permission getUpdatePermission() {
- return new UpdateGlobalBookmarkPermission();
- }
- }
- }
-
- @Order(20f)
- public class UserBox extends AbstractGroupBox {
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("Bookmarks");
- }
-
- @Override
- protected void execInitField() throws ProcessingException {
- setVisiblePermission(new ReadUserBookmarkPermission());
- }
-
- @Order(10)
- public class UserBookmarkTreeField extends AbstractBookmarkTreeField {
- @Override
- protected int getConfiguredGridW() {
- return 2;
- }
-
- @Override
- protected int getConfiguredGridH() {
- return 10;
- }
-
- @Override
- protected Permission getDeletePermission() {
- return new DeleteUserBookmarkPermission();
- }
-
- @Override
- protected Permission getUpdatePermission() {
- return new UpdateUserBookmarkPermission();
- }
- }
- }// end group box
-
- @Order(40f)
- public class OkButton extends AbstractOkButton {
- }
-
- @Order(50f)
- public class CancelButton extends AbstractCancelButton {
- }
-
- }// end main box
-
- @Order(20f)
- public class ModifyHandler extends AbstractFormHandler {
-
- @Override
- protected void execLoad() throws ProcessingException {
- IBookmarkService service = SERVICES.getService(IBookmarkService.class);
- //get notified about changes
- service.addBookmarkServiceListener(ManageBookmarksForm.this);
- service.loadBookmarks();//load most recent state
- getGlobalBookmarkTreeField().setBookmarkRootFolder(service.getBookmarkData().getGlobalBookmarks());
- getUserBookmarkTreeField().setBookmarkRootFolder(service.getBookmarkData().getUserBookmarks());
- getGlobalBookmarkTreeField().populateTree();
- getUserBookmarkTreeField().populateTree();
- }
-
- @Override
- public void execPostLoad() throws ProcessingException {
- touch();
- }
-
- @Override
- public void execStore() throws ProcessingException {
- SERVICES.getService(IBookmarkService.class).storeBookmarks();
- }
-
- @Override
- public void execDiscard() throws ProcessingException {
- //revert all changes
- SERVICES.getService(IBookmarkService.class).loadBookmarks();
- }
-
- @Override
- protected void execFinally() throws ProcessingException {
- IBookmarkService service = SERVICES.getService(IBookmarkService.class);
- service.removeBookmarkServiceListener(ManageBookmarksForm.this);
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.desktop.bookmark.internal;
+
+import java.security.Permission;
+
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.services.common.bookmark.BookmarkServiceEvent;
+import org.eclipse.scout.rt.client.services.common.bookmark.BookmarkServiceListener;
+import org.eclipse.scout.rt.client.services.common.bookmark.IBookmarkService;
+import org.eclipse.scout.rt.client.ui.desktop.bookmark.AbstractBookmarkTreeField;
+import org.eclipse.scout.rt.client.ui.desktop.bookmark.internal.ManageBookmarksForm.MainBox.CancelButton;
+import org.eclipse.scout.rt.client.ui.desktop.bookmark.internal.ManageBookmarksForm.MainBox.GlobalBox;
+import org.eclipse.scout.rt.client.ui.desktop.bookmark.internal.ManageBookmarksForm.MainBox.OkButton;
+import org.eclipse.scout.rt.client.ui.desktop.bookmark.internal.ManageBookmarksForm.MainBox.UserBox;
+import org.eclipse.scout.rt.client.ui.desktop.bookmark.internal.ManageBookmarksForm.MainBox.GlobalBox.GlobalBookmarkTreeField;
+import org.eclipse.scout.rt.client.ui.desktop.bookmark.internal.ManageBookmarksForm.MainBox.UserBox.UserBookmarkTreeField;
+import org.eclipse.scout.rt.client.ui.form.AbstractForm;
+import org.eclipse.scout.rt.client.ui.form.AbstractFormHandler;
+import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractCancelButton;
+import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractOkButton;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.security.DeleteGlobalBookmarkPermission;
+import org.eclipse.scout.rt.shared.security.DeleteUserBookmarkPermission;
+import org.eclipse.scout.rt.shared.security.ReadUserBookmarkPermission;
+import org.eclipse.scout.rt.shared.security.UpdateGlobalBookmarkPermission;
+import org.eclipse.scout.rt.shared.security.UpdateUserBookmarkPermission;
+import org.eclipse.scout.service.SERVICES;
+
+public class ManageBookmarksForm extends AbstractForm implements BookmarkServiceListener {
+
+ public ManageBookmarksForm() throws ProcessingException {
+ super();
+ }
+
+ @Override
+ protected String getConfiguredTitle() {
+ return ScoutTexts.get("Bookmarks");
+ }
+
+ @Override
+ public void bookmarksChanged(BookmarkServiceEvent e) {
+ getGlobalBookmarkTreeField().setBookmarkRootFolder(e.getBookmarkService().getBookmarkData().getGlobalBookmarks());
+ getUserBookmarkTreeField().setBookmarkRootFolder(e.getBookmarkService().getBookmarkData().getUserBookmarks());
+ }
+
+ public void startModify() throws ProcessingException {
+ startInternal(new ModifyHandler());
+ }
+
+ public MainBox getMainBox() {
+ return (MainBox) getRootGroupBox();
+ }
+
+ public GlobalBox getGlobalBox() {
+ return getFieldByClass(GlobalBox.class);
+ }
+
+ public UserBox getUserBox() {
+ return getFieldByClass(UserBox.class);
+ }
+
+ public OkButton getOkButton() {
+ return getFieldByClass(OkButton.class);
+ }
+
+ public CancelButton getCancelButton() {
+ return getFieldByClass(CancelButton.class);
+ }
+
+ public UserBookmarkTreeField getUserBookmarkTreeField() {
+ return getFieldByClass(UserBookmarkTreeField.class);
+ }
+
+ public GlobalBookmarkTreeField getGlobalBookmarkTreeField() {
+ return getFieldByClass(GlobalBookmarkTreeField.class);
+ }
+
+ @Order(10f)
+ public class MainBox extends AbstractGroupBox {
+
+ @Order(11)
+ public class GlobalBox extends AbstractGroupBox {
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("GlobalBookmarks");
+ }
+
+ @Override
+ protected void execInitField() throws ProcessingException {
+ setVisiblePermission(new UpdateGlobalBookmarkPermission());
+ }
+
+ @Order(10)
+ public class GlobalBookmarkTreeField extends AbstractBookmarkTreeField {
+ @Override
+ protected int getConfiguredGridW() {
+ return 2;
+ }
+
+ @Override
+ protected int getConfiguredGridH() {
+ return 10;
+ }
+
+ @Override
+ protected Permission getDeletePermission() {
+ return new DeleteGlobalBookmarkPermission();
+ }
+
+ @Override
+ protected Permission getUpdatePermission() {
+ return new UpdateGlobalBookmarkPermission();
+ }
+ }
+ }
+
+ @Order(20f)
+ public class UserBox extends AbstractGroupBox {
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("Bookmarks");
+ }
+
+ @Override
+ protected void execInitField() throws ProcessingException {
+ setVisiblePermission(new ReadUserBookmarkPermission());
+ }
+
+ @Order(10)
+ public class UserBookmarkTreeField extends AbstractBookmarkTreeField {
+ @Override
+ protected int getConfiguredGridW() {
+ return 2;
+ }
+
+ @Override
+ protected int getConfiguredGridH() {
+ return 10;
+ }
+
+ @Override
+ protected Permission getDeletePermission() {
+ return new DeleteUserBookmarkPermission();
+ }
+
+ @Override
+ protected Permission getUpdatePermission() {
+ return new UpdateUserBookmarkPermission();
+ }
+ }
+ }// end group box
+
+ @Order(40f)
+ public class OkButton extends AbstractOkButton {
+ }
+
+ @Order(50f)
+ public class CancelButton extends AbstractCancelButton {
+ }
+
+ }// end main box
+
+ @Order(20f)
+ public class ModifyHandler extends AbstractFormHandler {
+
+ @Override
+ protected void execLoad() throws ProcessingException {
+ IBookmarkService service = SERVICES.getService(IBookmarkService.class);
+ //get notified about changes
+ service.addBookmarkServiceListener(ManageBookmarksForm.this);
+ service.loadBookmarks();//load most recent state
+ getGlobalBookmarkTreeField().setBookmarkRootFolder(service.getBookmarkData().getGlobalBookmarks());
+ getUserBookmarkTreeField().setBookmarkRootFolder(service.getBookmarkData().getUserBookmarks());
+ getGlobalBookmarkTreeField().populateTree();
+ getUserBookmarkTreeField().populateTree();
+ }
+
+ @Override
+ public void execPostLoad() throws ProcessingException {
+ touch();
+ }
+
+ @Override
+ public void execStore() throws ProcessingException {
+ SERVICES.getService(IBookmarkService.class).storeBookmarks();
+ }
+
+ @Override
+ public void execDiscard() throws ProcessingException {
+ //revert all changes
+ SERVICES.getService(IBookmarkService.class).loadBookmarks();
+ }
+
+ @Override
+ protected void execFinally() throws ProcessingException {
+ IBookmarkService service = SERVICES.getService(IBookmarkService.class);
+ service.removeBookmarkServiceListener(ManageBookmarksForm.this);
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/menu/AbstractBookmarkMenu.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/menu/AbstractBookmarkMenu.java
index b8dd315671..4daa0cd732 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/menu/AbstractBookmarkMenu.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/menu/AbstractBookmarkMenu.java
@@ -1,300 +1,300 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.desktop.bookmark.menu;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.scout.commons.annotations.ConfigOperation;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.services.common.bookmark.BookmarkServiceEvent;
-import org.eclipse.scout.rt.client.services.common.bookmark.BookmarkServiceListener;
-import org.eclipse.scout.rt.client.services.common.bookmark.IBookmarkService;
-import org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke;
-import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.action.menu.MenuSeparator;
-import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
-import org.eclipse.scout.rt.client.ui.desktop.bookmark.BookmarkForm;
-import org.eclipse.scout.rt.client.ui.desktop.bookmark.IBookmarkForm;
-import org.eclipse.scout.rt.client.ui.desktop.bookmark.internal.ManageBookmarksForm;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.security.CreateGlobalBookmarkPermission;
-import org.eclipse.scout.rt.shared.security.CreateUserBookmarkPermission;
-import org.eclipse.scout.rt.shared.services.common.bookmark.Bookmark;
-import org.eclipse.scout.rt.shared.services.common.bookmark.BookmarkFolder;
-import org.eclipse.scout.service.SERVICES;
-
-/**
- * Maintain a menu per bookmark and its key stroke on the desktop
- */
-@Order(1f)
-public abstract class AbstractBookmarkMenu extends AbstractMenu {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractBookmarkMenu.class);
-
- private ArrayList<IKeyStroke> m_keyStrokes;
-
- public AbstractBookmarkMenu() {
- }
-
- public AbstractBookmarkMenu(IDesktop desktop) {
- }
-
- @Override
- @ConfigProperty(ConfigProperty.TEXT)
- @ConfigPropertyValue("ScoutTexts.get(\"BookmarksMainMenu\")")
- @Order(10)
- protected String getConfiguredText() {
- return ScoutTexts.get("BookmarksMainMenu");
- }
-
- @Override
- @ConfigOperation
- @Order(10)
- protected void execInitAction() {
- SERVICES.getService(IBookmarkService.class).addBookmarkServiceListener(
- new BookmarkServiceListener() {
- @Override
- public void bookmarksChanged(BookmarkServiceEvent e) {
- handleBookmarksChanged();
- }
- }
- );
- handleBookmarksChanged();
- }
-
- @ConfigProperty(ConfigProperty.FORM)
- @Order(20)
- @ConfigPropertyValue("null")
- protected Class<? extends IBookmarkForm> getConfiguredBookmarkForm() {
- return BookmarkForm.class;
- }
-
- private void createNewBookmark(int kind) throws ProcessingException {
- Bookmark b = ClientSyncJob.getCurrentSession().getDesktop().createBookmark();
- if (b != null) {
- IBookmarkService service = SERVICES.getService(IBookmarkService.class);
- b.setKind(kind);
- IBookmarkForm form = null;
- if (getConfiguredBookmarkForm() != null) {
- try {
- form = getConfiguredBookmarkForm().newInstance();
- }
- catch (Exception e) {
- LOG.warn(null, e);
- }
- }
- if (form == null) {
- form = new BookmarkForm();
- }
- if (kind == Bookmark.GLOBAL_BOOKMARK) {
- form.setBookmarkRootFolder(service.getBookmarkData().getGlobalBookmarks());
- }
- else if (kind == Bookmark.USER_BOOKMARK) {
- form.setBookmarkRootFolder(service.getBookmarkData().getUserBookmarks());
- }
- form.setBookmark(b);
- form.startNew();
- form.waitFor();
- if (form.isFormStored()) {
- b.setTitle(form.getBookmark().getTitle());
- b.setKeyStroke(form.getBookmark().getKeyStroke());
- BookmarkFolder folder = form.getFolder();
- if (folder == null) {
- folder = form.getBookmarkRootFolder();
- }
- folder.getBookmarks().add(b);
- service.storeBookmarks();
- }
- }
- }
-
- private void handleBookmarksChanged() {
- IBookmarkService service = SERVICES.getService(IBookmarkService.class);
- List<IMenu> oldList = getChildActions();
- ArrayList<IMenu> newList = new ArrayList<IMenu>();
- for (IMenu m : oldList) {
- if (m.getClass() == AddUserBookmarkMenu.class) {
- newList.add(m);
- }
- else if (m.getClass() == AddGlobalBookmarkMenu.class) {
- newList.add(m);
- }
- else if (m.getClass() == ManageBookmarksMenu.class) {
- newList.add(m);
- }
- else if (m.getClass() == StartBookmarkMenu.class) {
- newList.add(m);
- }
- else if (m.getClass() == Separator1Menu.class) {
- newList.add(m);
- }
- else {
- // ignore the rest
- break;
- }
- }
- //add global bookmarks
- newList.add(new MenuSeparator());
- addBookmarkTreeInternal(service.getBookmarkData().getGlobalBookmarks(), newList);
- //add user bookmarks
- newList.add(new MenuSeparator());
- addBookmarkTreeInternal(service.getBookmarkData().getUserBookmarks(), newList);
- setChildActions(newList);
- }
-
- @Order(1f)
- public class AddUserBookmarkMenu extends AbstractMenu {
- @Override
- protected String getConfiguredText() {
- return ScoutTexts.get("BookmarksAddMenu");
- }
-
- @Override
- protected void execPrepareAction() {
- setVisiblePermission(new CreateUserBookmarkPermission());
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- createNewBookmark(Bookmark.USER_BOOKMARK);
- }
- }
-
- @Order(2f)
- public class AddGlobalBookmarkMenu extends AbstractMenu {
- @Override
- protected String getConfiguredText() {
- return ScoutTexts.get("GlobalBookmarksAddMenu");
- }
-
- @Override
- protected void execPrepareAction() {
- setVisiblePermission(new CreateGlobalBookmarkPermission());
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- SERVICES.getService(IBookmarkService.class).loadBookmarks();
- createNewBookmark(Bookmark.GLOBAL_BOOKMARK);
- }
- }
-
- @Order(3f)
- public class ManageBookmarksMenu extends AbstractMenu {
- @Override
- protected String getConfiguredText() {
- return ScoutTexts.get("BookmarksManageMenu");
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- ManageBookmarksForm form = new ManageBookmarksForm();
- form.startModify();
- }
- }
-
- @Order(4f)
- public class StartBookmarkMenu extends AbstractMenu {
- @Override
- protected String getConfiguredText() {
- return ScoutTexts.get("BookmarksStartPageMenu");
- }
-
- @Order(1f)
- public class ActivateStartBookmarkMenu extends AbstractMenu {
- @Override
- protected String getConfiguredText() {
- return ScoutTexts.get("BookmarksStartPageMenuGoto");
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- IBookmarkService service = SERVICES.getService(IBookmarkService.class);
- Bookmark b = service.getStartBookmark();
- if (b != null) {
- try {
- ClientSyncJob.getCurrentSession().getDesktop().activateBookmark(b, false);
- }
- catch (Throwable t) {
- LOG.error(null, t);
- }
- }
- }
- }
-
- @Order(2f)
- public class Separator1Menu extends AbstractMenu {
- @Override
- protected boolean getConfiguredSeparator() {
- return true;
- }
- }
-
- @Order(3f)
- public class SetStartBookmarkMenu extends AbstractMenu {
- @Override
- protected String getConfiguredText() {
- return ScoutTexts.get("BookmarksStartPageMenuSet");
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- IBookmarkService service = SERVICES.getService(IBookmarkService.class);
- service.setStartBookmark();
- service.storeBookmarks();
- }
- }
-
- @Order(4f)
- public class DeleteStartBookmarkMenu extends AbstractMenu {
- @Override
- protected String getConfiguredText() {
- return ScoutTexts.get("BookmarksStartPageMenuClear");
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- IBookmarkService service = SERVICES.getService(IBookmarkService.class);
- service.deleteStartBookmark();
- service.storeBookmarks();
- }
- }
-
- }
-
- @Order(5f)
- public class Separator1Menu extends MenuSeparator {
- }
-
- private void addBookmarkTreeInternal(BookmarkFolder folder, List<IMenu> actionList) {
- for (BookmarkFolder f : folder.getFolders()) {
- IMenu group = new MenuSeparator();
- group.setSeparator(false);
- group.setText(f.getTitle());
- group.setIconId(f.getIconId());
- List<IMenu> childActionList = new ArrayList<IMenu>();
- addBookmarkTreeInternal(f, childActionList);
- group.setChildActions(childActionList);
- actionList.add(group);
- }
- for (Bookmark b : folder.getBookmarks()) {
- actionList.add(new ActivateBookmarkMenu(b));
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.desktop.bookmark.menu;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.scout.commons.annotations.ConfigOperation;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.services.common.bookmark.BookmarkServiceEvent;
+import org.eclipse.scout.rt.client.services.common.bookmark.BookmarkServiceListener;
+import org.eclipse.scout.rt.client.services.common.bookmark.IBookmarkService;
+import org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke;
+import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.action.menu.MenuSeparator;
+import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
+import org.eclipse.scout.rt.client.ui.desktop.bookmark.BookmarkForm;
+import org.eclipse.scout.rt.client.ui.desktop.bookmark.IBookmarkForm;
+import org.eclipse.scout.rt.client.ui.desktop.bookmark.internal.ManageBookmarksForm;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.security.CreateGlobalBookmarkPermission;
+import org.eclipse.scout.rt.shared.security.CreateUserBookmarkPermission;
+import org.eclipse.scout.rt.shared.services.common.bookmark.Bookmark;
+import org.eclipse.scout.rt.shared.services.common.bookmark.BookmarkFolder;
+import org.eclipse.scout.service.SERVICES;
+
+/**
+ * Maintain a menu per bookmark and its key stroke on the desktop
+ */
+@Order(1f)
+public abstract class AbstractBookmarkMenu extends AbstractMenu {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractBookmarkMenu.class);
+
+ private ArrayList<IKeyStroke> m_keyStrokes;
+
+ public AbstractBookmarkMenu() {
+ }
+
+ public AbstractBookmarkMenu(IDesktop desktop) {
+ }
+
+ @Override
+ @ConfigProperty(ConfigProperty.TEXT)
+ @ConfigPropertyValue("ScoutTexts.get(\"BookmarksMainMenu\")")
+ @Order(10)
+ protected String getConfiguredText() {
+ return ScoutTexts.get("BookmarksMainMenu");
+ }
+
+ @Override
+ @ConfigOperation
+ @Order(10)
+ protected void execInitAction() {
+ SERVICES.getService(IBookmarkService.class).addBookmarkServiceListener(
+ new BookmarkServiceListener() {
+ @Override
+ public void bookmarksChanged(BookmarkServiceEvent e) {
+ handleBookmarksChanged();
+ }
+ }
+ );
+ handleBookmarksChanged();
+ }
+
+ @ConfigProperty(ConfigProperty.FORM)
+ @Order(20)
+ @ConfigPropertyValue("null")
+ protected Class<? extends IBookmarkForm> getConfiguredBookmarkForm() {
+ return BookmarkForm.class;
+ }
+
+ private void createNewBookmark(int kind) throws ProcessingException {
+ Bookmark b = ClientSyncJob.getCurrentSession().getDesktop().createBookmark();
+ if (b != null) {
+ IBookmarkService service = SERVICES.getService(IBookmarkService.class);
+ b.setKind(kind);
+ IBookmarkForm form = null;
+ if (getConfiguredBookmarkForm() != null) {
+ try {
+ form = getConfiguredBookmarkForm().newInstance();
+ }
+ catch (Exception e) {
+ LOG.warn(null, e);
+ }
+ }
+ if (form == null) {
+ form = new BookmarkForm();
+ }
+ if (kind == Bookmark.GLOBAL_BOOKMARK) {
+ form.setBookmarkRootFolder(service.getBookmarkData().getGlobalBookmarks());
+ }
+ else if (kind == Bookmark.USER_BOOKMARK) {
+ form.setBookmarkRootFolder(service.getBookmarkData().getUserBookmarks());
+ }
+ form.setBookmark(b);
+ form.startNew();
+ form.waitFor();
+ if (form.isFormStored()) {
+ b.setTitle(form.getBookmark().getTitle());
+ b.setKeyStroke(form.getBookmark().getKeyStroke());
+ BookmarkFolder folder = form.getFolder();
+ if (folder == null) {
+ folder = form.getBookmarkRootFolder();
+ }
+ folder.getBookmarks().add(b);
+ service.storeBookmarks();
+ }
+ }
+ }
+
+ private void handleBookmarksChanged() {
+ IBookmarkService service = SERVICES.getService(IBookmarkService.class);
+ List<IMenu> oldList = getChildActions();
+ ArrayList<IMenu> newList = new ArrayList<IMenu>();
+ for (IMenu m : oldList) {
+ if (m.getClass() == AddUserBookmarkMenu.class) {
+ newList.add(m);
+ }
+ else if (m.getClass() == AddGlobalBookmarkMenu.class) {
+ newList.add(m);
+ }
+ else if (m.getClass() == ManageBookmarksMenu.class) {
+ newList.add(m);
+ }
+ else if (m.getClass() == StartBookmarkMenu.class) {
+ newList.add(m);
+ }
+ else if (m.getClass() == Separator1Menu.class) {
+ newList.add(m);
+ }
+ else {
+ // ignore the rest
+ break;
+ }
+ }
+ //add global bookmarks
+ newList.add(new MenuSeparator());
+ addBookmarkTreeInternal(service.getBookmarkData().getGlobalBookmarks(), newList);
+ //add user bookmarks
+ newList.add(new MenuSeparator());
+ addBookmarkTreeInternal(service.getBookmarkData().getUserBookmarks(), newList);
+ setChildActions(newList);
+ }
+
+ @Order(1f)
+ public class AddUserBookmarkMenu extends AbstractMenu {
+ @Override
+ protected String getConfiguredText() {
+ return ScoutTexts.get("BookmarksAddMenu");
+ }
+
+ @Override
+ protected void execPrepareAction() {
+ setVisiblePermission(new CreateUserBookmarkPermission());
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ createNewBookmark(Bookmark.USER_BOOKMARK);
+ }
+ }
+
+ @Order(2f)
+ public class AddGlobalBookmarkMenu extends AbstractMenu {
+ @Override
+ protected String getConfiguredText() {
+ return ScoutTexts.get("GlobalBookmarksAddMenu");
+ }
+
+ @Override
+ protected void execPrepareAction() {
+ setVisiblePermission(new CreateGlobalBookmarkPermission());
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ SERVICES.getService(IBookmarkService.class).loadBookmarks();
+ createNewBookmark(Bookmark.GLOBAL_BOOKMARK);
+ }
+ }
+
+ @Order(3f)
+ public class ManageBookmarksMenu extends AbstractMenu {
+ @Override
+ protected String getConfiguredText() {
+ return ScoutTexts.get("BookmarksManageMenu");
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ ManageBookmarksForm form = new ManageBookmarksForm();
+ form.startModify();
+ }
+ }
+
+ @Order(4f)
+ public class StartBookmarkMenu extends AbstractMenu {
+ @Override
+ protected String getConfiguredText() {
+ return ScoutTexts.get("BookmarksStartPageMenu");
+ }
+
+ @Order(1f)
+ public class ActivateStartBookmarkMenu extends AbstractMenu {
+ @Override
+ protected String getConfiguredText() {
+ return ScoutTexts.get("BookmarksStartPageMenuGoto");
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ IBookmarkService service = SERVICES.getService(IBookmarkService.class);
+ Bookmark b = service.getStartBookmark();
+ if (b != null) {
+ try {
+ ClientSyncJob.getCurrentSession().getDesktop().activateBookmark(b, false);
+ }
+ catch (Throwable t) {
+ LOG.error(null, t);
+ }
+ }
+ }
+ }
+
+ @Order(2f)
+ public class Separator1Menu extends AbstractMenu {
+ @Override
+ protected boolean getConfiguredSeparator() {
+ return true;
+ }
+ }
+
+ @Order(3f)
+ public class SetStartBookmarkMenu extends AbstractMenu {
+ @Override
+ protected String getConfiguredText() {
+ return ScoutTexts.get("BookmarksStartPageMenuSet");
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ IBookmarkService service = SERVICES.getService(IBookmarkService.class);
+ service.setStartBookmark();
+ service.storeBookmarks();
+ }
+ }
+
+ @Order(4f)
+ public class DeleteStartBookmarkMenu extends AbstractMenu {
+ @Override
+ protected String getConfiguredText() {
+ return ScoutTexts.get("BookmarksStartPageMenuClear");
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ IBookmarkService service = SERVICES.getService(IBookmarkService.class);
+ service.deleteStartBookmark();
+ service.storeBookmarks();
+ }
+ }
+
+ }
+
+ @Order(5f)
+ public class Separator1Menu extends MenuSeparator {
+ }
+
+ private void addBookmarkTreeInternal(BookmarkFolder folder, List<IMenu> actionList) {
+ for (BookmarkFolder f : folder.getFolders()) {
+ IMenu group = new MenuSeparator();
+ group.setSeparator(false);
+ group.setText(f.getTitle());
+ group.setIconId(f.getIconId());
+ List<IMenu> childActionList = new ArrayList<IMenu>();
+ addBookmarkTreeInternal(f, childActionList);
+ group.setChildActions(childActionList);
+ actionList.add(group);
+ }
+ for (Bookmark b : folder.getBookmarks()) {
+ actionList.add(new ActivateBookmarkMenu(b));
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/menu/ActivateBookmarkKeyStroke.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/menu/ActivateBookmarkKeyStroke.java
index aba727a1b8..49fa49cec1 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/menu/ActivateBookmarkKeyStroke.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/menu/ActivateBookmarkKeyStroke.java
@@ -1,46 +1,46 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.desktop.bookmark.menu;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.ui.action.keystroke.KeyStroke;
-import org.eclipse.scout.rt.shared.services.common.bookmark.Bookmark;
-
-public class ActivateBookmarkKeyStroke extends KeyStroke {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(ActivateBookmarkKeyStroke.class);
-
- private final Bookmark m_bookmark;
-
- public ActivateBookmarkKeyStroke(Bookmark b) {
- super(b.getKeyStroke());
- m_bookmark = b;
- callInitializer();
- }
-
- public Bookmark getBookmark() {
- return m_bookmark;
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- if (m_bookmark != null) {
- try {
- ClientSyncJob.getCurrentSession().getDesktop().activateBookmark(m_bookmark, false);
- }
- catch (Throwable t) {
- LOG.error(null, t);
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.desktop.bookmark.menu;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.ui.action.keystroke.KeyStroke;
+import org.eclipse.scout.rt.shared.services.common.bookmark.Bookmark;
+
+public class ActivateBookmarkKeyStroke extends KeyStroke {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(ActivateBookmarkKeyStroke.class);
+
+ private final Bookmark m_bookmark;
+
+ public ActivateBookmarkKeyStroke(Bookmark b) {
+ super(b.getKeyStroke());
+ m_bookmark = b;
+ callInitializer();
+ }
+
+ public Bookmark getBookmark() {
+ return m_bookmark;
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ if (m_bookmark != null) {
+ try {
+ ClientSyncJob.getCurrentSession().getDesktop().activateBookmark(m_bookmark, false);
+ }
+ catch (Throwable t) {
+ LOG.error(null, t);
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/menu/ActivateBookmarkMenu.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/menu/ActivateBookmarkMenu.java
index 234f4ce6f3..50405b2d53 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/menu/ActivateBookmarkMenu.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/menu/ActivateBookmarkMenu.java
@@ -1,62 +1,62 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.desktop.bookmark.menu;
-
-import org.eclipse.scout.commons.annotations.ConfigOperation;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
-import org.eclipse.scout.rt.shared.services.common.bookmark.Bookmark;
-
-public class ActivateBookmarkMenu extends AbstractMenu {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(ActivateBookmarkMenu.class);
-
- private final Bookmark m_bookmark;
-
- public ActivateBookmarkMenu(Bookmark b) {
- super(false);
- m_bookmark = b;
- callInitializer();
- }
-
- public Bookmark getBookmark() {
- return m_bookmark;
- }
-
- @Override
- @ConfigOperation
- @Order(10)
- protected void execInitAction() {
- if (m_bookmark != null) {
- setText(m_bookmark.getTitle());
- setIconId(m_bookmark.getIconId());
- setKeyStroke(m_bookmark.getKeyStroke());
- }
- else {
- setText("...");
- }
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- if (m_bookmark != null) {
- try {
- ClientSyncJob.getCurrentSession().getDesktop().activateBookmark(m_bookmark, false);
- }
- catch (Throwable t) {
- LOG.error(null, t);
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.desktop.bookmark.menu;
+
+import org.eclipse.scout.commons.annotations.ConfigOperation;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
+import org.eclipse.scout.rt.shared.services.common.bookmark.Bookmark;
+
+public class ActivateBookmarkMenu extends AbstractMenu {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(ActivateBookmarkMenu.class);
+
+ private final Bookmark m_bookmark;
+
+ public ActivateBookmarkMenu(Bookmark b) {
+ super(false);
+ m_bookmark = b;
+ callInitializer();
+ }
+
+ public Bookmark getBookmark() {
+ return m_bookmark;
+ }
+
+ @Override
+ @ConfigOperation
+ @Order(10)
+ protected void execInitAction() {
+ if (m_bookmark != null) {
+ setText(m_bookmark.getTitle());
+ setIconId(m_bookmark.getIconId());
+ setKeyStroke(m_bookmark.getKeyStroke());
+ }
+ else {
+ setText("...");
+ }
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ if (m_bookmark != null) {
+ try {
+ ClientSyncJob.getCurrentSession().getDesktop().activateBookmark(m_bookmark, false);
+ }
+ catch (Throwable t) {
+ LOG.error(null, t);
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/view/BookmarkViewForm.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/view/BookmarkViewForm.java
index 23bab45bde..747a184d02 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/view/BookmarkViewForm.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/view/BookmarkViewForm.java
@@ -1,378 +1,378 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.desktop.bookmark.view;
-
-import java.security.Permission;
-import java.util.regex.Pattern;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.services.common.bookmark.BookmarkServiceEvent;
-import org.eclipse.scout.rt.client.services.common.bookmark.BookmarkServiceListener;
-import org.eclipse.scout.rt.client.services.common.bookmark.IBookmarkService;
-import org.eclipse.scout.rt.client.services.common.clientnotification.ClientNotificationConsumerEvent;
-import org.eclipse.scout.rt.client.services.common.clientnotification.IClientNotificationConsumerListener;
-import org.eclipse.scout.rt.client.services.common.clientnotification.IClientNotificationConsumerService;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNodeFilter;
-import org.eclipse.scout.rt.client.ui.desktop.bookmark.AbstractBookmarkTreeField;
-import org.eclipse.scout.rt.client.ui.desktop.bookmark.BookmarkForm;
-import org.eclipse.scout.rt.client.ui.desktop.bookmark.IBookmarkForm;
-import org.eclipse.scout.rt.client.ui.desktop.bookmark.view.BookmarkViewForm.MainBox.TabBox.BookmarksBox;
-import org.eclipse.scout.rt.client.ui.desktop.bookmark.view.BookmarkViewForm.MainBox.TabBox.BookmarksBox.AddBookmarksLinkButton;
-import org.eclipse.scout.rt.client.ui.desktop.bookmark.view.BookmarkViewForm.MainBox.TabBox.BookmarksBox.ClearStartPageLinkButton;
-import org.eclipse.scout.rt.client.ui.desktop.bookmark.view.BookmarkViewForm.MainBox.TabBox.BookmarksBox.SetStartPageLinkButton;
-import org.eclipse.scout.rt.client.ui.desktop.bookmark.view.BookmarkViewForm.MainBox.TabBox.BookmarksBox.UserBookmarkSearchField;
-import org.eclipse.scout.rt.client.ui.desktop.bookmark.view.BookmarkViewForm.MainBox.TabBox.BookmarksBox.UserBookmarkTreeField;
-import org.eclipse.scout.rt.client.ui.form.AbstractForm;
-import org.eclipse.scout.rt.client.ui.form.AbstractFormHandler;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractLinkButton;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
-import org.eclipse.scout.rt.client.ui.form.fields.stringfield.AbstractStringField;
-import org.eclipse.scout.rt.client.ui.form.fields.tabbox.AbstractTabBox;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.security.CreateUserBookmarkPermission;
-import org.eclipse.scout.rt.shared.security.DeleteUserBookmarkPermission;
-import org.eclipse.scout.rt.shared.security.UpdateUserBookmarkPermission;
-import org.eclipse.scout.rt.shared.services.common.bookmark.Bookmark;
-import org.eclipse.scout.rt.shared.services.common.bookmark.BookmarkChangedClientNotification;
-import org.eclipse.scout.rt.shared.services.common.bookmark.BookmarkFolder;
-import org.eclipse.scout.service.SERVICES;
-
-public class BookmarkViewForm extends AbstractForm {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(BookmarkViewForm.class);
-
- public BookmarkViewForm() throws ProcessingException {
- super();
- }
-
- @ConfigProperty(ConfigProperty.FORM)
- @Order(10)
- @ConfigPropertyValue("null")
- protected Class<? extends IBookmarkForm> getConfiguredBookmarkForm() {
- return BookmarkForm.class;
- }
-
- @Override
- protected String getConfiguredTitle() {
- return ScoutTexts.get("Bookmarks");
- }
-
- public void startView() throws ProcessingException {
- startInternal(new ViewHandler());
- }
-
- public MainBox getMainBox() {
- return (MainBox) getRootGroupBox();
- }
-
- public BookmarksBox getBookmarksBox() {
- return getFieldByClass(BookmarksBox.class);
- }
-
- public UserBookmarkTreeField getUserBookmarkTreeField() {
- return getFieldByClass(UserBookmarkTreeField.class);
- }
-
- public UserBookmarkSearchField getUserBookmarkSearchField() {
- return getFieldByClass(UserBookmarkSearchField.class);
- }
-
- public AddBookmarksLinkButton getOkButton() {
- return getFieldByClass(AddBookmarksLinkButton.class);
- }
-
- public SetStartPageLinkButton getSetStartPageLinkButton() {
- return getFieldByClass(SetStartPageLinkButton.class);
- }
-
- public ClearStartPageLinkButton getClearStartPageLinkButton() {
- return getFieldByClass(ClearStartPageLinkButton.class);
- }
-
- @Order(10)
- public class MainBox extends AbstractGroupBox {
-
- @Order(10)
- public class TabBox extends AbstractTabBox {
-
- @Order(10)
- public class BookmarksBox extends AbstractGroupBox {
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("Bookmarks");
- }
-
- @Override
- protected int getConfiguredGridColumnCount() {
- return 1;
- }
-
- @Order(20)
- public class UserBookmarkSearchField extends AbstractStringField implements ITreeNodeFilter {
- private Pattern m_lowercaseFilterPattern;
-
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("FilterBookmarkTree");
- }
-
- @Override
- protected String getConfiguredTooltipText() {
- return ScoutTexts.get("SmartFindLabel");
- }
-
- @Override
- protected boolean getConfiguredLabelVisible() {
- return false;
- }
-
- @Override
- public int getConfiguredLabelPosition() {
- return IFormField.LABEL_POSITION_ON_FIELD;
- }
-
- @Override
- protected boolean getConfiguredValidateOnAnyKey() {
- return true;
- }
-
- @Override
- protected void execChangedValue() throws ProcessingException {
- String s = StringUtility.emptyIfNull(getValue()).trim();
- if (s.length() > 0) {
- if (!s.endsWith("*")) {
- s = s + "*";
- }
- m_lowercaseFilterPattern = Pattern.compile(StringUtility.toRegExPattern(s.toLowerCase()));
- getUserBookmarkTreeField().getTree().addNodeFilter(this);
- }
- else {
- getUserBookmarkTreeField().getTree().removeNodeFilter(this);
- }
- }
-
- /**
- * Implementation of ITreeNodeFilter
- */
- @Override
- public boolean accept(ITreeNode node, int level) {
- String text = node.getCell().getText();
- return text == null || m_lowercaseFilterPattern == null || m_lowercaseFilterPattern.matcher(text.toLowerCase()).matches();
- }
- }
-
- @Order(20)
- public class UserBookmarkTreeField extends AbstractBookmarkTreeField {
- @Override
- protected int getConfiguredGridW() {
- return 1;
- }
-
- @Override
- protected int getConfiguredGridH() {
- return 10;
- }
-
- @Override
- protected Permission getDeletePermission() {
- return new DeleteUserBookmarkPermission();
- }
-
- @Override
- protected Permission getUpdatePermission() {
- return new UpdateUserBookmarkPermission();
- }
- }
-
- @Order(100)
- public class AddBookmarksLinkButton extends AbstractLinkButton {
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("BookmarksAddMenu");
- }
-
- @Override
- protected boolean getConfiguredProcessButton() {
- return false;
- }
-
- @Override
- protected void execInitField() throws ProcessingException {
- setVisiblePermission(new CreateUserBookmarkPermission());
- }
-
- @Override
- protected void execClickAction() throws ProcessingException {
- //createNewBookmark
- int kind = Bookmark.USER_BOOKMARK;
- Bookmark b = ClientSyncJob.getCurrentSession().getDesktop().createBookmark();
- if (b != null) {
- b.setKind(kind);
- IBookmarkForm form = null;
- if (getConfiguredBookmarkForm() != null) {
- try {
- form = getConfiguredBookmarkForm().newInstance();
- }
- catch (Exception e) {
- LOG.warn(null, e);
- }
- }
- if (form == null) {
- form = new BookmarkForm();
- }
- form.setBookmarkRootFolder(getUserBookmarkTreeField().getBookmarkRootFolder());
- form.setBookmark(b);
- if (form.getBookmarkRootFolder() != form.getBookmarkRootFolder()) {
- form.setFolder(form.getBookmarkRootFolder());
- }
- form.startNew();
- form.waitFor();
- if (form.isFormStored()) {
- b.setTitle(b.getTitle());
- b.setKeyStroke(b.getKeyStroke());
- BookmarkFolder folder = form.getFolder();
- if (folder == null) {
- folder = form.getBookmarkRootFolder();
- }
- folder.getBookmarks().add(b);
- IBookmarkService service = SERVICES.getService(IBookmarkService.class);
- service.storeBookmarks();
- }
- }
- }
- }
-
- @Order(110)
- public class SetStartPageLinkButton extends AbstractLinkButton {
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("BookmarksStartPageMenuSet");
- }
-
- @Override
- protected boolean getConfiguredProcessButton() {
- return false;
- }
-
- @Override
- protected void execInitField() throws ProcessingException {
- setVisiblePermission(new CreateUserBookmarkPermission());
- }
-
- @Override
- protected void execClickAction() throws ProcessingException {
- IBookmarkService service = SERVICES.getService(IBookmarkService.class);
- service.setStartBookmark();
- service.storeBookmarks();
- }
- }
-
- @Order(120)
- public class ClearStartPageLinkButton extends AbstractLinkButton {
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("BookmarksStartPageMenuClear");
- }
-
- @Override
- protected boolean getConfiguredProcessButton() {
- return false;
- }
-
- @Override
- protected void execInitField() throws ProcessingException {
- setVisiblePermission(new CreateUserBookmarkPermission());
- }
-
- @Override
- protected void execClickAction() throws ProcessingException {
- IBookmarkService service = SERVICES.getService(IBookmarkService.class);
- service.deleteStartBookmark();
- service.storeBookmarks();
- }
- }
- }
- }
- }
-
- private void refreshFormState() {
- IBookmarkService bmService = SERVICES.getService(IBookmarkService.class);
- getUserBookmarkTreeField().setBookmarkRootFolder(bmService.getBookmarkData().getUserBookmarks());
- getUserBookmarkTreeField().populateTree();
- }
-
- @Order(20f)
- public class ViewHandler extends AbstractFormHandler {
-
- private final IClientNotificationConsumerListener m_cncListener = new IClientNotificationConsumerListener() {
- @Override
- public void handleEvent(ClientNotificationConsumerEvent e, boolean sync) {
- if (e.getClientNotification() instanceof BookmarkChangedClientNotification) {
- new ClientSyncJob("Bookmarks changed", ClientSyncJob.getCurrentSession()) {
- @Override
- protected void runVoid(IProgressMonitor monitor) throws Throwable {
- SERVICES.getService(IBookmarkService.class).loadBookmarks();
- }
- }.schedule();
- }
- }
- };
-
- private final BookmarkServiceListener m_bmListener = new BookmarkServiceListener() {
- @Override
- public void bookmarksChanged(BookmarkServiceEvent e) {
- switch (e.getType()) {
- case BookmarkServiceEvent.TYPE_CHANGED: {
- refreshFormState();
- break;
- }
- }
- }
- };
-
- @Override
- protected void execLoad() throws ProcessingException {
- //add listeners
- IClientNotificationConsumerService cncService = SERVICES.getService(IClientNotificationConsumerService.class);
- if (cncService != null) {
- cncService.removeClientNotificationConsumerListener(ClientSyncJob.getCurrentSession(), m_cncListener);
- cncService.addClientNotificationConsumerListener(ClientSyncJob.getCurrentSession(), m_cncListener);
- }
- IBookmarkService bmService = SERVICES.getService(IBookmarkService.class);
- if (bmService != null) {
- bmService.removeBookmarkServiceListener(m_bmListener);
- bmService.addBookmarkServiceListener(m_bmListener);
- bmService.loadBookmarks();
- }
- }
-
- @Override
- protected void execFinally() throws ProcessingException {
- IBookmarkService bmService = SERVICES.getService(IBookmarkService.class);
- IClientNotificationConsumerService cncService = SERVICES.getService(IClientNotificationConsumerService.class);
- if (bmService != null) {
- bmService.removeBookmarkServiceListener(m_bmListener);
- }
- if (cncService != null) {
- cncService.removeClientNotificationConsumerListener(ClientSyncJob.getCurrentSession(), m_cncListener);
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.desktop.bookmark.view;
+
+import java.security.Permission;
+import java.util.regex.Pattern;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.services.common.bookmark.BookmarkServiceEvent;
+import org.eclipse.scout.rt.client.services.common.bookmark.BookmarkServiceListener;
+import org.eclipse.scout.rt.client.services.common.bookmark.IBookmarkService;
+import org.eclipse.scout.rt.client.services.common.clientnotification.ClientNotificationConsumerEvent;
+import org.eclipse.scout.rt.client.services.common.clientnotification.IClientNotificationConsumerListener;
+import org.eclipse.scout.rt.client.services.common.clientnotification.IClientNotificationConsumerService;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNodeFilter;
+import org.eclipse.scout.rt.client.ui.desktop.bookmark.AbstractBookmarkTreeField;
+import org.eclipse.scout.rt.client.ui.desktop.bookmark.BookmarkForm;
+import org.eclipse.scout.rt.client.ui.desktop.bookmark.IBookmarkForm;
+import org.eclipse.scout.rt.client.ui.desktop.bookmark.view.BookmarkViewForm.MainBox.TabBox.BookmarksBox;
+import org.eclipse.scout.rt.client.ui.desktop.bookmark.view.BookmarkViewForm.MainBox.TabBox.BookmarksBox.AddBookmarksLinkButton;
+import org.eclipse.scout.rt.client.ui.desktop.bookmark.view.BookmarkViewForm.MainBox.TabBox.BookmarksBox.ClearStartPageLinkButton;
+import org.eclipse.scout.rt.client.ui.desktop.bookmark.view.BookmarkViewForm.MainBox.TabBox.BookmarksBox.SetStartPageLinkButton;
+import org.eclipse.scout.rt.client.ui.desktop.bookmark.view.BookmarkViewForm.MainBox.TabBox.BookmarksBox.UserBookmarkSearchField;
+import org.eclipse.scout.rt.client.ui.desktop.bookmark.view.BookmarkViewForm.MainBox.TabBox.BookmarksBox.UserBookmarkTreeField;
+import org.eclipse.scout.rt.client.ui.form.AbstractForm;
+import org.eclipse.scout.rt.client.ui.form.AbstractFormHandler;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractLinkButton;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
+import org.eclipse.scout.rt.client.ui.form.fields.stringfield.AbstractStringField;
+import org.eclipse.scout.rt.client.ui.form.fields.tabbox.AbstractTabBox;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.security.CreateUserBookmarkPermission;
+import org.eclipse.scout.rt.shared.security.DeleteUserBookmarkPermission;
+import org.eclipse.scout.rt.shared.security.UpdateUserBookmarkPermission;
+import org.eclipse.scout.rt.shared.services.common.bookmark.Bookmark;
+import org.eclipse.scout.rt.shared.services.common.bookmark.BookmarkChangedClientNotification;
+import org.eclipse.scout.rt.shared.services.common.bookmark.BookmarkFolder;
+import org.eclipse.scout.service.SERVICES;
+
+public class BookmarkViewForm extends AbstractForm {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(BookmarkViewForm.class);
+
+ public BookmarkViewForm() throws ProcessingException {
+ super();
+ }
+
+ @ConfigProperty(ConfigProperty.FORM)
+ @Order(10)
+ @ConfigPropertyValue("null")
+ protected Class<? extends IBookmarkForm> getConfiguredBookmarkForm() {
+ return BookmarkForm.class;
+ }
+
+ @Override
+ protected String getConfiguredTitle() {
+ return ScoutTexts.get("Bookmarks");
+ }
+
+ public void startView() throws ProcessingException {
+ startInternal(new ViewHandler());
+ }
+
+ public MainBox getMainBox() {
+ return (MainBox) getRootGroupBox();
+ }
+
+ public BookmarksBox getBookmarksBox() {
+ return getFieldByClass(BookmarksBox.class);
+ }
+
+ public UserBookmarkTreeField getUserBookmarkTreeField() {
+ return getFieldByClass(UserBookmarkTreeField.class);
+ }
+
+ public UserBookmarkSearchField getUserBookmarkSearchField() {
+ return getFieldByClass(UserBookmarkSearchField.class);
+ }
+
+ public AddBookmarksLinkButton getOkButton() {
+ return getFieldByClass(AddBookmarksLinkButton.class);
+ }
+
+ public SetStartPageLinkButton getSetStartPageLinkButton() {
+ return getFieldByClass(SetStartPageLinkButton.class);
+ }
+
+ public ClearStartPageLinkButton getClearStartPageLinkButton() {
+ return getFieldByClass(ClearStartPageLinkButton.class);
+ }
+
+ @Order(10)
+ public class MainBox extends AbstractGroupBox {
+
+ @Order(10)
+ public class TabBox extends AbstractTabBox {
+
+ @Order(10)
+ public class BookmarksBox extends AbstractGroupBox {
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("Bookmarks");
+ }
+
+ @Override
+ protected int getConfiguredGridColumnCount() {
+ return 1;
+ }
+
+ @Order(20)
+ public class UserBookmarkSearchField extends AbstractStringField implements ITreeNodeFilter {
+ private Pattern m_lowercaseFilterPattern;
+
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("FilterBookmarkTree");
+ }
+
+ @Override
+ protected String getConfiguredTooltipText() {
+ return ScoutTexts.get("SmartFindLabel");
+ }
+
+ @Override
+ protected boolean getConfiguredLabelVisible() {
+ return false;
+ }
+
+ @Override
+ public int getConfiguredLabelPosition() {
+ return IFormField.LABEL_POSITION_ON_FIELD;
+ }
+
+ @Override
+ protected boolean getConfiguredValidateOnAnyKey() {
+ return true;
+ }
+
+ @Override
+ protected void execChangedValue() throws ProcessingException {
+ String s = StringUtility.emptyIfNull(getValue()).trim();
+ if (s.length() > 0) {
+ if (!s.endsWith("*")) {
+ s = s + "*";
+ }
+ m_lowercaseFilterPattern = Pattern.compile(StringUtility.toRegExPattern(s.toLowerCase()));
+ getUserBookmarkTreeField().getTree().addNodeFilter(this);
+ }
+ else {
+ getUserBookmarkTreeField().getTree().removeNodeFilter(this);
+ }
+ }
+
+ /**
+ * Implementation of ITreeNodeFilter
+ */
+ @Override
+ public boolean accept(ITreeNode node, int level) {
+ String text = node.getCell().getText();
+ return text == null || m_lowercaseFilterPattern == null || m_lowercaseFilterPattern.matcher(text.toLowerCase()).matches();
+ }
+ }
+
+ @Order(20)
+ public class UserBookmarkTreeField extends AbstractBookmarkTreeField {
+ @Override
+ protected int getConfiguredGridW() {
+ return 1;
+ }
+
+ @Override
+ protected int getConfiguredGridH() {
+ return 10;
+ }
+
+ @Override
+ protected Permission getDeletePermission() {
+ return new DeleteUserBookmarkPermission();
+ }
+
+ @Override
+ protected Permission getUpdatePermission() {
+ return new UpdateUserBookmarkPermission();
+ }
+ }
+
+ @Order(100)
+ public class AddBookmarksLinkButton extends AbstractLinkButton {
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("BookmarksAddMenu");
+ }
+
+ @Override
+ protected boolean getConfiguredProcessButton() {
+ return false;
+ }
+
+ @Override
+ protected void execInitField() throws ProcessingException {
+ setVisiblePermission(new CreateUserBookmarkPermission());
+ }
+
+ @Override
+ protected void execClickAction() throws ProcessingException {
+ //createNewBookmark
+ int kind = Bookmark.USER_BOOKMARK;
+ Bookmark b = ClientSyncJob.getCurrentSession().getDesktop().createBookmark();
+ if (b != null) {
+ b.setKind(kind);
+ IBookmarkForm form = null;
+ if (getConfiguredBookmarkForm() != null) {
+ try {
+ form = getConfiguredBookmarkForm().newInstance();
+ }
+ catch (Exception e) {
+ LOG.warn(null, e);
+ }
+ }
+ if (form == null) {
+ form = new BookmarkForm();
+ }
+ form.setBookmarkRootFolder(getUserBookmarkTreeField().getBookmarkRootFolder());
+ form.setBookmark(b);
+ if (form.getBookmarkRootFolder() != form.getBookmarkRootFolder()) {
+ form.setFolder(form.getBookmarkRootFolder());
+ }
+ form.startNew();
+ form.waitFor();
+ if (form.isFormStored()) {
+ b.setTitle(b.getTitle());
+ b.setKeyStroke(b.getKeyStroke());
+ BookmarkFolder folder = form.getFolder();
+ if (folder == null) {
+ folder = form.getBookmarkRootFolder();
+ }
+ folder.getBookmarks().add(b);
+ IBookmarkService service = SERVICES.getService(IBookmarkService.class);
+ service.storeBookmarks();
+ }
+ }
+ }
+ }
+
+ @Order(110)
+ public class SetStartPageLinkButton extends AbstractLinkButton {
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("BookmarksStartPageMenuSet");
+ }
+
+ @Override
+ protected boolean getConfiguredProcessButton() {
+ return false;
+ }
+
+ @Override
+ protected void execInitField() throws ProcessingException {
+ setVisiblePermission(new CreateUserBookmarkPermission());
+ }
+
+ @Override
+ protected void execClickAction() throws ProcessingException {
+ IBookmarkService service = SERVICES.getService(IBookmarkService.class);
+ service.setStartBookmark();
+ service.storeBookmarks();
+ }
+ }
+
+ @Order(120)
+ public class ClearStartPageLinkButton extends AbstractLinkButton {
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("BookmarksStartPageMenuClear");
+ }
+
+ @Override
+ protected boolean getConfiguredProcessButton() {
+ return false;
+ }
+
+ @Override
+ protected void execInitField() throws ProcessingException {
+ setVisiblePermission(new CreateUserBookmarkPermission());
+ }
+
+ @Override
+ protected void execClickAction() throws ProcessingException {
+ IBookmarkService service = SERVICES.getService(IBookmarkService.class);
+ service.deleteStartBookmark();
+ service.storeBookmarks();
+ }
+ }
+ }
+ }
+ }
+
+ private void refreshFormState() {
+ IBookmarkService bmService = SERVICES.getService(IBookmarkService.class);
+ getUserBookmarkTreeField().setBookmarkRootFolder(bmService.getBookmarkData().getUserBookmarks());
+ getUserBookmarkTreeField().populateTree();
+ }
+
+ @Order(20f)
+ public class ViewHandler extends AbstractFormHandler {
+
+ private final IClientNotificationConsumerListener m_cncListener = new IClientNotificationConsumerListener() {
+ @Override
+ public void handleEvent(ClientNotificationConsumerEvent e, boolean sync) {
+ if (e.getClientNotification() instanceof BookmarkChangedClientNotification) {
+ new ClientSyncJob("Bookmarks changed", ClientSyncJob.getCurrentSession()) {
+ @Override
+ protected void runVoid(IProgressMonitor monitor) throws Throwable {
+ SERVICES.getService(IBookmarkService.class).loadBookmarks();
+ }
+ }.schedule();
+ }
+ }
+ };
+
+ private final BookmarkServiceListener m_bmListener = new BookmarkServiceListener() {
+ @Override
+ public void bookmarksChanged(BookmarkServiceEvent e) {
+ switch (e.getType()) {
+ case BookmarkServiceEvent.TYPE_CHANGED: {
+ refreshFormState();
+ break;
+ }
+ }
+ }
+ };
+
+ @Override
+ protected void execLoad() throws ProcessingException {
+ //add listeners
+ IClientNotificationConsumerService cncService = SERVICES.getService(IClientNotificationConsumerService.class);
+ if (cncService != null) {
+ cncService.removeClientNotificationConsumerListener(ClientSyncJob.getCurrentSession(), m_cncListener);
+ cncService.addClientNotificationConsumerListener(ClientSyncJob.getCurrentSession(), m_cncListener);
+ }
+ IBookmarkService bmService = SERVICES.getService(IBookmarkService.class);
+ if (bmService != null) {
+ bmService.removeBookmarkServiceListener(m_bmListener);
+ bmService.addBookmarkServiceListener(m_bmListener);
+ bmService.loadBookmarks();
+ }
+ }
+
+ @Override
+ protected void execFinally() throws ProcessingException {
+ IBookmarkService bmService = SERVICES.getService(IBookmarkService.class);
+ IClientNotificationConsumerService cncService = SERVICES.getService(IClientNotificationConsumerService.class);
+ if (bmService != null) {
+ bmService.removeBookmarkServiceListener(m_bmListener);
+ }
+ if (cncService != null) {
+ cncService.removeClientNotificationConsumerListener(ClientSyncJob.getCurrentSession(), m_cncListener);
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/view/IOpenBookmarkCommand.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/view/IOpenBookmarkCommand.java
index a7ddd6a9af..7b94984c92 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/view/IOpenBookmarkCommand.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/view/IOpenBookmarkCommand.java
@@ -1,29 +1,29 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.desktop.bookmark.view;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.desktop.bookmark.AbstractBookmarkTreeField;
-import org.eclipse.scout.rt.shared.services.common.bookmark.Bookmark;
-
-/**
- * Injection command for {@link BookmarkViewForm#getUserBookmarkTreeField()} and
- * {@link AbstractBookmarkTreeField#injectOpenBookmarkCommand(IInjectOpenBookmarkCommand)}
- */
-public interface IOpenBookmarkCommand {
-
- /**
- * Opens the bookmark, it's up to the implementation to track additional features
- * <p>
- */
- void openBookmark(Bookmark bookmark) throws ProcessingException;
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.desktop.bookmark.view;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.desktop.bookmark.AbstractBookmarkTreeField;
+import org.eclipse.scout.rt.shared.services.common.bookmark.Bookmark;
+
+/**
+ * Injection command for {@link BookmarkViewForm#getUserBookmarkTreeField()} and
+ * {@link AbstractBookmarkTreeField#injectOpenBookmarkCommand(IInjectOpenBookmarkCommand)}
+ */
+public interface IOpenBookmarkCommand {
+
+ /**
+ * Opens the bookmark, it's up to the implementation to track additional features
+ * <p>
+ */
+ void openBookmark(Bookmark bookmark) throws ProcessingException;
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/view/IPublishBookmarkCommand.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/view/IPublishBookmarkCommand.java
index 5d136d44c9..8352421df4 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/view/IPublishBookmarkCommand.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/bookmark/view/IPublishBookmarkCommand.java
@@ -1,32 +1,32 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.desktop.bookmark.view;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.desktop.bookmark.AbstractBookmarkTreeField;
-import org.eclipse.scout.rt.shared.services.common.bookmark.BookmarkFolder;
-import org.eclipse.scout.rt.shared.services.common.bookmark.IBookmarkStorageService;
-
-/**
- * Injection command for {@link BookmarkViewForm#getUserBookmarkTreeField()} and
- * {@link AbstractBookmarkTreeField#injectPublishBookmarkCommand(IPublishBookmarkCommand)}
- */
-public interface IPublishBookmarkCommand {
-
- /**
- * Obtains the target group for the bookmark to be published to
- * <p>
- * and calls
- * {@link IBookmarkStorageService#publishBookmarkData(org.eclipse.scout.rt.shared.services.common.bookmark.BookmarkFolder, java.util.Map)}
- */
- void publishBookmark(BookmarkFolder publishFolder) throws ProcessingException;
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.desktop.bookmark.view;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.desktop.bookmark.AbstractBookmarkTreeField;
+import org.eclipse.scout.rt.shared.services.common.bookmark.BookmarkFolder;
+import org.eclipse.scout.rt.shared.services.common.bookmark.IBookmarkStorageService;
+
+/**
+ * Injection command for {@link BookmarkViewForm#getUserBookmarkTreeField()} and
+ * {@link AbstractBookmarkTreeField#injectPublishBookmarkCommand(IPublishBookmarkCommand)}
+ */
+public interface IPublishBookmarkCommand {
+
+ /**
+ * Obtains the target group for the bookmark to be published to
+ * <p>
+ * and calls
+ * {@link IBookmarkStorageService#publishBookmarkData(org.eclipse.scout.rt.shared.services.common.bookmark.BookmarkFolder, java.util.Map)}
+ */
+ void publishBookmark(BookmarkFolder publishFolder) throws ProcessingException;
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/internal/VirtualDesktop.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/internal/VirtualDesktop.java
index 7396524a37..83b4af4bf0 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/internal/VirtualDesktop.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/internal/VirtualDesktop.java
@@ -1,533 +1,533 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.desktop.internal;
-
-import java.beans.PropertyChangeListener;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.scout.commons.EventListenerList;
-import org.eclipse.scout.commons.exception.IProcessingStatus;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.client.ui.DataChangeListener;
-import org.eclipse.scout.rt.client.ui.action.IAction;
-import org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.action.tool.IToolButton;
-import org.eclipse.scout.rt.client.ui.action.view.IViewButton;
-import org.eclipse.scout.rt.client.ui.basic.filechooser.IFileChooser;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.desktop.DesktopListener;
-import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
-import org.eclipse.scout.rt.client.ui.desktop.IDesktopUIFacade;
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutlineTableForm;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.client.ui.form.PrintDevice;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.messagebox.IMessageBox;
-import org.eclipse.scout.rt.shared.services.common.bookmark.Bookmark;
-
-/**
- * Copyright (c) 2001,2008 BSI AG
- * @version 3.x
- */
-
-/**
- * This class is used as a placeholder of virtual desktop while the desktop is
- * loading until the desktop is set onto the {@link IClientSession}. Reasons for
- * that are observer attachments and data change registration in the init block
- * of forms, fields, pages that must be done while the desktop is loading. This
- * pattern solves the bird/egg problem in initialization of an object with
- * self-references.
- */
-public class VirtualDesktop implements IDesktop {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(VirtualDesktop.class);
-
- private final EventListenerList m_listenerList;
- private final Map<String, EventListenerList> m_propertyChangeListenerMap;
- private final Map<Object, EventListenerList> m_dataChangeListenerMap;
-
- public VirtualDesktop() {
- m_listenerList = new EventListenerList();
- m_propertyChangeListenerMap = new HashMap<String, EventListenerList>();
- m_dataChangeListenerMap = new HashMap<Object, EventListenerList>();
- }
-
- public DesktopListener[] getDesktopListeners() {
- return m_listenerList.getListeners(DesktopListener.class);
- }
-
- public Map<Object, EventListenerList> getDataChangeListenerMap() {
- return m_dataChangeListenerMap;
- }
-
- public Map<String, EventListenerList> getPropertyChangeListenerMap() {
- return m_propertyChangeListenerMap;
- }
-
- @Override
- public void addPropertyChangeListener(PropertyChangeListener listener) {
- EventListenerList list = m_propertyChangeListenerMap.get(null);
- if (list == null) {
- list = new EventListenerList();
- m_propertyChangeListenerMap.put(null, list);
- }
- list.add(PropertyChangeListener.class, listener);
- }
-
- @Override
- public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
- EventListenerList list = m_propertyChangeListenerMap.get(propertyName);
- if (list == null) {
- list = new EventListenerList();
- m_propertyChangeListenerMap.put(propertyName, list);
- }
- list.add(PropertyChangeListener.class, listener);
- }
-
- @Override
- public void removePropertyChangeListener(PropertyChangeListener listener) {
- for (Iterator<EventListenerList> it = m_dataChangeListenerMap.values().iterator(); it.hasNext();) {
- EventListenerList list = it.next();
- list.remove(PropertyChangeListener.class, listener);
- if (list.getListenerCount(DataChangeListener.class) == 0) {
- it.remove();
- }
- }
- }
-
- @Override
- public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) {
- for (Iterator<EventListenerList> it = m_dataChangeListenerMap.values().iterator(); it.hasNext();) {
- EventListenerList list = it.next();
- list.remove(PropertyChangeListener.class, listener);
- if (list.getListenerCount(DataChangeListener.class) == 0) {
- it.remove();
- }
- }
- }
-
- @Override
- public void addDesktopListener(DesktopListener l) {
- m_listenerList.add(DesktopListener.class, l);
- }
-
- @Override
- public void removeDesktopListener(DesktopListener l) {
- m_listenerList.remove(DesktopListener.class, l);
- }
-
- @Override
- public void addDataChangeListener(DataChangeListener listener, Object... dataTypes) {
- if (dataTypes == null || dataTypes.length == 0) {
- EventListenerList list = m_dataChangeListenerMap.get(null);
- if (list == null) {
- list = new EventListenerList();
- m_dataChangeListenerMap.put(null, list);
- }
- list.add(DataChangeListener.class, listener);
- }
- else {
- for (Object dataType : dataTypes) {
- if (dataType != null) {
- EventListenerList list = m_dataChangeListenerMap.get(dataType);
- if (list == null) {
- list = new EventListenerList();
- m_dataChangeListenerMap.put(dataType, list);
- }
- list.add(DataChangeListener.class, listener);
- }
- }
- }
- }
-
- @Override
- public void removeDataChangeListener(DataChangeListener listener, Object... dataTypes) {
- if (dataTypes == null || dataTypes.length == 0) {
- for (Iterator<EventListenerList> it = m_dataChangeListenerMap.values().iterator(); it.hasNext();) {
- EventListenerList list = it.next();
- list.remove(DataChangeListener.class, listener);
- if (list.getListenerCount(DataChangeListener.class) == 0) {
- it.remove();
- }
- }
- }
- else {
- for (Object dataType : dataTypes) {
- if (dataType != null) {
- EventListenerList list = m_dataChangeListenerMap.get(dataType);
- if (list != null) {
- list.remove(DataChangeListener.class, listener);
- if (list.getListenerCount(DataChangeListener.class) == 0) {
- m_dataChangeListenerMap.remove(dataType);
- }
- }
- }
- }
- }
- }
-
- private UnsupportedOperationException createUnsupportedOperationException() {
- return new UnsupportedOperationException("The desktop is currently loading. This method must be called after the desktop has loaded and is set onto the session");
- }
-
- /*
- * Not implemented methods
- */
-
- @Override
- public boolean isTrayVisible() {
- return false;
- }
-
- @Override
- public void setTrayVisible(boolean b) {
- }
-
- @Override
- public boolean isShowing(IForm form) {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public boolean isAutoPrefixWildcardForTextSearch() {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public void setAutoPrefixWildcardForTextSearch(boolean b) {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public void activateBookmark(Bookmark bm, boolean forceReload) throws ProcessingException {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public void addFileChooser(IFileChooser fc) {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public void openBrowserWindow(String path) {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public void addForm(IForm form) {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public void addKeyStrokes(IKeyStroke... keyStrokes) {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public void addMessageBox(IMessageBox mb) {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public void closeInternal() throws ProcessingException {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public Bookmark createBookmark() throws ProcessingException {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public Bookmark createBookmark(IPage page) throws ProcessingException {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public void dataChanged(Object... dataTypes) {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public void ensureViewStackVisible() {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public void ensureVisible(IForm form) {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public <T extends IForm> T findForm(Class<T> formType) {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public <T extends IForm> T[] findForms(Class<T> formType) {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public <T extends IOutline> T findOutline(Class<T> outlineType) {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public <T extends IAction> T findAction(Class<T> actionType) {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public <T extends IViewButton> T findViewButton(Class<T> viewButtonType) {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public <T extends IToolButton> T findToolButton(Class<T> toolButtonType) {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public <T extends IForm> T findLastActiveForm(Class<T> formType) {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public IOutline[] getAvailableOutlines() {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public void setAvailableOutlines(IOutline[] availableOutlines) {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public IForm[] getDialogStack() {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public IFormField getFocusOwner() {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public IKeyStroke[] getKeyStrokes() {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public IMenu[] getMenus() {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public <T extends IMenu> T getMenu(Class<? extends T> searchType) {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public IMessageBox[] getMessageBoxStack() {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public IOutline getOutline() {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public IForm getPageSearchForm() {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public void setPageSearchForm(IForm f) {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public IForm getPageDetailForm() {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public void setPageDetailForm(IForm f) {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public ITable getPageDetailTable() {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public void setPageDetailTable(ITable t) {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public void setOutlineTableForm(IOutlineTableForm f) {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public IOutlineTableForm getOutlineTableForm() {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public boolean isOutlineTableFormVisible() {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public void setOutlineTableFormVisible(boolean b) {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public IForm[] getSimilarViewForms(IForm form) {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public IProcessingStatus getStatus() {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public String getTitle() {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public IAction[] getActions() {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public IViewButton[] getViewButtons() {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public IToolButton[] getToolButtons() {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public IDesktopUIFacade getUIFacade() {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public IForm[] getViewStack() {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public void initDesktop() throws ProcessingException {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public boolean isOpened() {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public boolean isGuiAvailable() {
- throw createUnsupportedOperationException();
-
- }
-
- @Override
- public void prepareAllMenus() {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public void printDesktop(PrintDevice device, Map<String, Object> parameters) {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public void refreshPages(Class... pageTypes) {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public void releaseUnusedPages() {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public void afterTablePageLoaded(IPageWithTable<?> page) throws ProcessingException {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public void removeForm(IForm form) {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public void removeKeyStrokes(IKeyStroke... keyStrokes) {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public void setKeyStrokes(IKeyStroke[] ks) {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public void setOutline(IOutline outline) {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public void setOutline(Class<? extends IOutline> outlineType) {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public void setStatus(IProcessingStatus status) {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public void setStatusText(String s) {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public void setTitle(String s) {
- throw createUnsupportedOperationException();
- }
-
- @Override
- public void changeVisibilityAfterOfflineSwitch() {
- return;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.desktop.internal;
+
+import java.beans.PropertyChangeListener;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.scout.commons.EventListenerList;
+import org.eclipse.scout.commons.exception.IProcessingStatus;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.client.ui.DataChangeListener;
+import org.eclipse.scout.rt.client.ui.action.IAction;
+import org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.action.tool.IToolButton;
+import org.eclipse.scout.rt.client.ui.action.view.IViewButton;
+import org.eclipse.scout.rt.client.ui.basic.filechooser.IFileChooser;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.desktop.DesktopListener;
+import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
+import org.eclipse.scout.rt.client.ui.desktop.IDesktopUIFacade;
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutlineTableForm;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.client.ui.form.PrintDevice;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.messagebox.IMessageBox;
+import org.eclipse.scout.rt.shared.services.common.bookmark.Bookmark;
+
+/**
+ * Copyright (c) 2001,2008 BSI AG
+ * @version 3.x
+ */
+
+/**
+ * This class is used as a placeholder of virtual desktop while the desktop is
+ * loading until the desktop is set onto the {@link IClientSession}. Reasons for
+ * that are observer attachments and data change registration in the init block
+ * of forms, fields, pages that must be done while the desktop is loading. This
+ * pattern solves the bird/egg problem in initialization of an object with
+ * self-references.
+ */
+public class VirtualDesktop implements IDesktop {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(VirtualDesktop.class);
+
+ private final EventListenerList m_listenerList;
+ private final Map<String, EventListenerList> m_propertyChangeListenerMap;
+ private final Map<Object, EventListenerList> m_dataChangeListenerMap;
+
+ public VirtualDesktop() {
+ m_listenerList = new EventListenerList();
+ m_propertyChangeListenerMap = new HashMap<String, EventListenerList>();
+ m_dataChangeListenerMap = new HashMap<Object, EventListenerList>();
+ }
+
+ public DesktopListener[] getDesktopListeners() {
+ return m_listenerList.getListeners(DesktopListener.class);
+ }
+
+ public Map<Object, EventListenerList> getDataChangeListenerMap() {
+ return m_dataChangeListenerMap;
+ }
+
+ public Map<String, EventListenerList> getPropertyChangeListenerMap() {
+ return m_propertyChangeListenerMap;
+ }
+
+ @Override
+ public void addPropertyChangeListener(PropertyChangeListener listener) {
+ EventListenerList list = m_propertyChangeListenerMap.get(null);
+ if (list == null) {
+ list = new EventListenerList();
+ m_propertyChangeListenerMap.put(null, list);
+ }
+ list.add(PropertyChangeListener.class, listener);
+ }
+
+ @Override
+ public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
+ EventListenerList list = m_propertyChangeListenerMap.get(propertyName);
+ if (list == null) {
+ list = new EventListenerList();
+ m_propertyChangeListenerMap.put(propertyName, list);
+ }
+ list.add(PropertyChangeListener.class, listener);
+ }
+
+ @Override
+ public void removePropertyChangeListener(PropertyChangeListener listener) {
+ for (Iterator<EventListenerList> it = m_dataChangeListenerMap.values().iterator(); it.hasNext();) {
+ EventListenerList list = it.next();
+ list.remove(PropertyChangeListener.class, listener);
+ if (list.getListenerCount(DataChangeListener.class) == 0) {
+ it.remove();
+ }
+ }
+ }
+
+ @Override
+ public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) {
+ for (Iterator<EventListenerList> it = m_dataChangeListenerMap.values().iterator(); it.hasNext();) {
+ EventListenerList list = it.next();
+ list.remove(PropertyChangeListener.class, listener);
+ if (list.getListenerCount(DataChangeListener.class) == 0) {
+ it.remove();
+ }
+ }
+ }
+
+ @Override
+ public void addDesktopListener(DesktopListener l) {
+ m_listenerList.add(DesktopListener.class, l);
+ }
+
+ @Override
+ public void removeDesktopListener(DesktopListener l) {
+ m_listenerList.remove(DesktopListener.class, l);
+ }
+
+ @Override
+ public void addDataChangeListener(DataChangeListener listener, Object... dataTypes) {
+ if (dataTypes == null || dataTypes.length == 0) {
+ EventListenerList list = m_dataChangeListenerMap.get(null);
+ if (list == null) {
+ list = new EventListenerList();
+ m_dataChangeListenerMap.put(null, list);
+ }
+ list.add(DataChangeListener.class, listener);
+ }
+ else {
+ for (Object dataType : dataTypes) {
+ if (dataType != null) {
+ EventListenerList list = m_dataChangeListenerMap.get(dataType);
+ if (list == null) {
+ list = new EventListenerList();
+ m_dataChangeListenerMap.put(dataType, list);
+ }
+ list.add(DataChangeListener.class, listener);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void removeDataChangeListener(DataChangeListener listener, Object... dataTypes) {
+ if (dataTypes == null || dataTypes.length == 0) {
+ for (Iterator<EventListenerList> it = m_dataChangeListenerMap.values().iterator(); it.hasNext();) {
+ EventListenerList list = it.next();
+ list.remove(DataChangeListener.class, listener);
+ if (list.getListenerCount(DataChangeListener.class) == 0) {
+ it.remove();
+ }
+ }
+ }
+ else {
+ for (Object dataType : dataTypes) {
+ if (dataType != null) {
+ EventListenerList list = m_dataChangeListenerMap.get(dataType);
+ if (list != null) {
+ list.remove(DataChangeListener.class, listener);
+ if (list.getListenerCount(DataChangeListener.class) == 0) {
+ m_dataChangeListenerMap.remove(dataType);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private UnsupportedOperationException createUnsupportedOperationException() {
+ return new UnsupportedOperationException("The desktop is currently loading. This method must be called after the desktop has loaded and is set onto the session");
+ }
+
+ /*
+ * Not implemented methods
+ */
+
+ @Override
+ public boolean isTrayVisible() {
+ return false;
+ }
+
+ @Override
+ public void setTrayVisible(boolean b) {
+ }
+
+ @Override
+ public boolean isShowing(IForm form) {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public boolean isAutoPrefixWildcardForTextSearch() {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public void setAutoPrefixWildcardForTextSearch(boolean b) {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public void activateBookmark(Bookmark bm, boolean forceReload) throws ProcessingException {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public void addFileChooser(IFileChooser fc) {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public void openBrowserWindow(String path) {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public void addForm(IForm form) {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public void addKeyStrokes(IKeyStroke... keyStrokes) {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public void addMessageBox(IMessageBox mb) {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public void closeInternal() throws ProcessingException {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public Bookmark createBookmark() throws ProcessingException {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public Bookmark createBookmark(IPage page) throws ProcessingException {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public void dataChanged(Object... dataTypes) {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public void ensureViewStackVisible() {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public void ensureVisible(IForm form) {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public <T extends IForm> T findForm(Class<T> formType) {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public <T extends IForm> T[] findForms(Class<T> formType) {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public <T extends IOutline> T findOutline(Class<T> outlineType) {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public <T extends IAction> T findAction(Class<T> actionType) {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public <T extends IViewButton> T findViewButton(Class<T> viewButtonType) {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public <T extends IToolButton> T findToolButton(Class<T> toolButtonType) {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public <T extends IForm> T findLastActiveForm(Class<T> formType) {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public IOutline[] getAvailableOutlines() {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public void setAvailableOutlines(IOutline[] availableOutlines) {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public IForm[] getDialogStack() {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public IFormField getFocusOwner() {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public IKeyStroke[] getKeyStrokes() {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public IMenu[] getMenus() {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public <T extends IMenu> T getMenu(Class<? extends T> searchType) {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public IMessageBox[] getMessageBoxStack() {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public IOutline getOutline() {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public IForm getPageSearchForm() {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public void setPageSearchForm(IForm f) {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public IForm getPageDetailForm() {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public void setPageDetailForm(IForm f) {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public ITable getPageDetailTable() {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public void setPageDetailTable(ITable t) {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public void setOutlineTableForm(IOutlineTableForm f) {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public IOutlineTableForm getOutlineTableForm() {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public boolean isOutlineTableFormVisible() {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public void setOutlineTableFormVisible(boolean b) {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public IForm[] getSimilarViewForms(IForm form) {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public IProcessingStatus getStatus() {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public String getTitle() {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public IAction[] getActions() {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public IViewButton[] getViewButtons() {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public IToolButton[] getToolButtons() {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public IDesktopUIFacade getUIFacade() {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public IForm[] getViewStack() {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public void initDesktop() throws ProcessingException {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public boolean isOpened() {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public boolean isGuiAvailable() {
+ throw createUnsupportedOperationException();
+
+ }
+
+ @Override
+ public void prepareAllMenus() {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public void printDesktop(PrintDevice device, Map<String, Object> parameters) {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public void refreshPages(Class... pageTypes) {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public void releaseUnusedPages() {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public void afterTablePageLoaded(IPageWithTable<?> page) throws ProcessingException {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public void removeForm(IForm form) {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public void removeKeyStrokes(IKeyStroke... keyStrokes) {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public void setKeyStrokes(IKeyStroke[] ks) {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public void setOutline(IOutline outline) {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public void setOutline(Class<? extends IOutline> outlineType) {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public void setStatus(IProcessingStatus status) {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public void setStatusText(String s) {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public void setTitle(String s) {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public void changeVisibilityAfterOfflineSwitch() {
+ return;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/navigation/INavigationHistoryService.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/navigation/INavigationHistoryService.java
index d0ef71cba5..592d285217 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/navigation/INavigationHistoryService.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/navigation/INavigationHistoryService.java
@@ -1,81 +1,81 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.desktop.navigation;
-
-import java.util.List;
-
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.shared.services.common.bookmark.Bookmark;
-import org.eclipse.scout.service.IService2;
-
-@Priority(-3)
-public interface INavigationHistoryService extends IService2 {
- String SERVICE_DATA_KEY = "navigationHistoryServiceData";
-
- /**
- * add a navigation savepoint
- */
- Bookmark addStep(int level, String name, String iconId);
-
- /**
- * add a navigation savepoint for the given page
- *
- * @since 3.8.0
- */
- Bookmark addStep(int level, IPage page);
-
- List<Bookmark> getBookmarks();
-
- int getSize();
-
- int getIndex();
-
- /**
- * get the currently active bookmark
- */
- Bookmark getActiveBookmark();
-
- /**
- * get bookmarks before the current
- */
- List<Bookmark> getBackwardBookmarks();
-
- boolean hasBackwardBookmarks();
-
- /**
- * get bookmarks after the current
- */
- List<Bookmark> getForwardBookmarks();
-
- boolean hasForwardBookmarks();
-
- /**
- * step foreward in the history by one step and active that bookmark
- */
- void stepForward() throws ProcessingException;
-
- /**
- * step backward in the history by one step and active that bookmark
- */
- void stepBackward() throws ProcessingException;
-
- void stepTo(Bookmark bm) throws ProcessingException;
-
- IMenu[] getMenus();
-
- void addNavigationHistoryListener(NavigationHistoryListener listener);
-
- void removeNavigationHistoryListener(NavigationHistoryListener listener);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.desktop.navigation;
+
+import java.util.List;
+
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.shared.services.common.bookmark.Bookmark;
+import org.eclipse.scout.service.IService2;
+
+@Priority(-3)
+public interface INavigationHistoryService extends IService2 {
+ String SERVICE_DATA_KEY = "navigationHistoryServiceData";
+
+ /**
+ * add a navigation savepoint
+ */
+ Bookmark addStep(int level, String name, String iconId);
+
+ /**
+ * add a navigation savepoint for the given page
+ *
+ * @since 3.8.0
+ */
+ Bookmark addStep(int level, IPage page);
+
+ List<Bookmark> getBookmarks();
+
+ int getSize();
+
+ int getIndex();
+
+ /**
+ * get the currently active bookmark
+ */
+ Bookmark getActiveBookmark();
+
+ /**
+ * get bookmarks before the current
+ */
+ List<Bookmark> getBackwardBookmarks();
+
+ boolean hasBackwardBookmarks();
+
+ /**
+ * get bookmarks after the current
+ */
+ List<Bookmark> getForwardBookmarks();
+
+ boolean hasForwardBookmarks();
+
+ /**
+ * step foreward in the history by one step and active that bookmark
+ */
+ void stepForward() throws ProcessingException;
+
+ /**
+ * step backward in the history by one step and active that bookmark
+ */
+ void stepBackward() throws ProcessingException;
+
+ void stepTo(Bookmark bm) throws ProcessingException;
+
+ IMenu[] getMenus();
+
+ void addNavigationHistoryListener(NavigationHistoryListener listener);
+
+ void removeNavigationHistoryListener(NavigationHistoryListener listener);
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/navigation/NavigationHistoryEvent.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/navigation/NavigationHistoryEvent.java
index c36fa80e21..27059af9dd 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/navigation/NavigationHistoryEvent.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/navigation/NavigationHistoryEvent.java
@@ -1,49 +1,49 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.desktop.navigation;
-
-import java.util.EventObject;
-
-import org.eclipse.scout.rt.client.ui.desktop.navigation.internal.UserNavigationHistory;
-import org.eclipse.scout.rt.shared.services.common.bookmark.Bookmark;
-
-public class NavigationHistoryEvent extends EventObject {
- private static final long serialVersionUID = 1L;
- private final int m_type;
- private final Bookmark m_bookmark;
-
- public static final int TYPE_CHANGED = 10;
- public static final int TYPE_BOOKMARK_ADDED = 20;
- public static final int TYPE_BOOKMARK_REMOVDED = 30;
-
- public NavigationHistoryEvent(UserNavigationHistory service, int type) {
- this(service, type, null);
- }
-
- public NavigationHistoryEvent(UserNavigationHistory service, int type, Bookmark bookmark) {
- super(service);
- m_type = type;
- m_bookmark = bookmark;
- }
-
- public UserNavigationHistory getNavigationService() {
- return (UserNavigationHistory) getSource();
- }
-
- public int getType() {
- return m_type;
- }
-
- public Bookmark getBookmark() {
- return m_bookmark;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.desktop.navigation;
+
+import java.util.EventObject;
+
+import org.eclipse.scout.rt.client.ui.desktop.navigation.internal.UserNavigationHistory;
+import org.eclipse.scout.rt.shared.services.common.bookmark.Bookmark;
+
+public class NavigationHistoryEvent extends EventObject {
+ private static final long serialVersionUID = 1L;
+ private final int m_type;
+ private final Bookmark m_bookmark;
+
+ public static final int TYPE_CHANGED = 10;
+ public static final int TYPE_BOOKMARK_ADDED = 20;
+ public static final int TYPE_BOOKMARK_REMOVDED = 30;
+
+ public NavigationHistoryEvent(UserNavigationHistory service, int type) {
+ this(service, type, null);
+ }
+
+ public NavigationHistoryEvent(UserNavigationHistory service, int type, Bookmark bookmark) {
+ super(service);
+ m_type = type;
+ m_bookmark = bookmark;
+ }
+
+ public UserNavigationHistory getNavigationService() {
+ return (UserNavigationHistory) getSource();
+ }
+
+ public int getType() {
+ return m_type;
+ }
+
+ public Bookmark getBookmark() {
+ return m_bookmark;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/navigation/NavigationHistoryListener.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/navigation/NavigationHistoryListener.java
index ea37f455d3..33a91f2d62 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/navigation/NavigationHistoryListener.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/navigation/NavigationHistoryListener.java
@@ -1,19 +1,19 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.desktop.navigation;
-
-import java.util.EventListener;
-
-public interface NavigationHistoryListener extends EventListener {
-
- void navigationChanged(NavigationHistoryEvent e);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.desktop.navigation;
+
+import java.util.EventListener;
+
+public interface NavigationHistoryListener extends EventListener {
+
+ void navigationChanged(NavigationHistoryEvent e);
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/navigation/internal/ActivateNavigationHistoryMenu.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/navigation/internal/ActivateNavigationHistoryMenu.java
index d1b2e14193..e999342602 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/navigation/internal/ActivateNavigationHistoryMenu.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/navigation/internal/ActivateNavigationHistoryMenu.java
@@ -1,46 +1,46 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.desktop.navigation.internal;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
-import org.eclipse.scout.rt.client.ui.desktop.navigation.INavigationHistoryService;
-import org.eclipse.scout.rt.shared.services.common.bookmark.Bookmark;
-import org.eclipse.scout.service.SERVICES;
-
-public class ActivateNavigationHistoryMenu extends AbstractMenu {
- private final Bookmark m_bookmark;
-
- public ActivateNavigationHistoryMenu(Bookmark b) {
- super(false);
- m_bookmark = b;
- callInitializer();
- }
-
- public Bookmark getBookmark() {
- return m_bookmark;
- }
-
- @Override
- protected void execInitAction() {
- if (m_bookmark != null) {
- setText(m_bookmark.getTitle());
- setIconId(m_bookmark.getIconId());
- }
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- if (m_bookmark != null) {
- SERVICES.getService(INavigationHistoryService.class).stepTo(m_bookmark);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.desktop.navigation.internal;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
+import org.eclipse.scout.rt.client.ui.desktop.navigation.INavigationHistoryService;
+import org.eclipse.scout.rt.shared.services.common.bookmark.Bookmark;
+import org.eclipse.scout.service.SERVICES;
+
+public class ActivateNavigationHistoryMenu extends AbstractMenu {
+ private final Bookmark m_bookmark;
+
+ public ActivateNavigationHistoryMenu(Bookmark b) {
+ super(false);
+ m_bookmark = b;
+ callInitializer();
+ }
+
+ public Bookmark getBookmark() {
+ return m_bookmark;
+ }
+
+ @Override
+ protected void execInitAction() {
+ if (m_bookmark != null) {
+ setText(m_bookmark.getTitle());
+ setIconId(m_bookmark.getIconId());
+ }
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ if (m_bookmark != null) {
+ SERVICES.getService(INavigationHistoryService.class).stepTo(m_bookmark);
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/navigation/internal/NavigationHistoryService.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/navigation/internal/NavigationHistoryService.java
index 707ef41b89..bce451c54f 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/navigation/internal/NavigationHistoryService.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/navigation/internal/NavigationHistoryService.java
@@ -1,125 +1,125 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.desktop.navigation.internal;
-
-import java.util.List;
-
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ClientJob;
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.desktop.navigation.INavigationHistoryService;
-import org.eclipse.scout.rt.client.ui.desktop.navigation.NavigationHistoryListener;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.shared.services.common.bookmark.Bookmark;
-import org.eclipse.scout.service.AbstractService;
-
-@Priority(-1)
-public class NavigationHistoryService extends AbstractService implements INavigationHistoryService {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(NavigationHistoryService.class);
-
- @Override
- public Bookmark addStep(int level, String name, String iconId) {
- return getUserNavigationHistory().addStep(level, name, iconId);
- }
-
- @Override
- public Bookmark addStep(int level, IPage page) {
- return getUserNavigationHistory().addStep(level, page);
- }
-
- @Override
- public Bookmark getActiveBookmark() {
- return getUserNavigationHistory().getActiveBookmark();
- }
-
- @Override
- public List<Bookmark> getBookmarks() {
- return getUserNavigationHistory().getBookmarks();
- }
-
- @Override
- public List<Bookmark> getBackwardBookmarks() {
- return getUserNavigationHistory().getBackwardBookmarks();
- }
-
- @Override
- public boolean hasBackwardBookmarks() {
- return getUserNavigationHistory().hasBackwardBookmarks();
- }
-
- @Override
- public List<Bookmark> getForwardBookmarks() {
- return getUserNavigationHistory().getForwardBookmarks();
- }
-
- @Override
- public boolean hasForwardBookmarks() {
- return getUserNavigationHistory().hasForwardBookmarks();
- }
-
- @Override
- public void stepForward() throws ProcessingException {
- getUserNavigationHistory().stepForward();
- }
-
- @Override
- public void stepBackward() throws ProcessingException {
- getUserNavigationHistory().stepBackward();
-
- }
-
- @Override
- public void stepTo(Bookmark b) throws ProcessingException {
- getUserNavigationHistory().stepTo(b);
- }
-
- @Override
- public IMenu[] getMenus() {
- return getUserNavigationHistory().getMenus();
- }
-
- @Override
- public int getSize() {
- return getUserNavigationHistory().getSize();
- }
-
- @Override
- public int getIndex() {
- return getUserNavigationHistory().getIndex();
- }
-
- @Override
- public void addNavigationHistoryListener(NavigationHistoryListener listener) {
- getUserNavigationHistory().addNavigationHistoryListener(listener);
- }
-
- @Override
- public void removeNavigationHistoryListener(NavigationHistoryListener listener) {
- getUserNavigationHistory().removeNavigationHistoryListener(listener);
- }
-
- private UserNavigationHistory getUserNavigationHistory() {
- IClientSession session = ClientJob.getCurrentSession();
- if (session == null) {
- return new UserNavigationHistory();
- }
- UserNavigationHistory data = (UserNavigationHistory) session.getData(SERVICE_DATA_KEY);
- if (data == null) {
- data = new UserNavigationHistory();
- session.setData(SERVICE_DATA_KEY, data);
- }
- return data;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.desktop.navigation.internal;
+
+import java.util.List;
+
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ClientJob;
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.desktop.navigation.INavigationHistoryService;
+import org.eclipse.scout.rt.client.ui.desktop.navigation.NavigationHistoryListener;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.shared.services.common.bookmark.Bookmark;
+import org.eclipse.scout.service.AbstractService;
+
+@Priority(-1)
+public class NavigationHistoryService extends AbstractService implements INavigationHistoryService {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(NavigationHistoryService.class);
+
+ @Override
+ public Bookmark addStep(int level, String name, String iconId) {
+ return getUserNavigationHistory().addStep(level, name, iconId);
+ }
+
+ @Override
+ public Bookmark addStep(int level, IPage page) {
+ return getUserNavigationHistory().addStep(level, page);
+ }
+
+ @Override
+ public Bookmark getActiveBookmark() {
+ return getUserNavigationHistory().getActiveBookmark();
+ }
+
+ @Override
+ public List<Bookmark> getBookmarks() {
+ return getUserNavigationHistory().getBookmarks();
+ }
+
+ @Override
+ public List<Bookmark> getBackwardBookmarks() {
+ return getUserNavigationHistory().getBackwardBookmarks();
+ }
+
+ @Override
+ public boolean hasBackwardBookmarks() {
+ return getUserNavigationHistory().hasBackwardBookmarks();
+ }
+
+ @Override
+ public List<Bookmark> getForwardBookmarks() {
+ return getUserNavigationHistory().getForwardBookmarks();
+ }
+
+ @Override
+ public boolean hasForwardBookmarks() {
+ return getUserNavigationHistory().hasForwardBookmarks();
+ }
+
+ @Override
+ public void stepForward() throws ProcessingException {
+ getUserNavigationHistory().stepForward();
+ }
+
+ @Override
+ public void stepBackward() throws ProcessingException {
+ getUserNavigationHistory().stepBackward();
+
+ }
+
+ @Override
+ public void stepTo(Bookmark b) throws ProcessingException {
+ getUserNavigationHistory().stepTo(b);
+ }
+
+ @Override
+ public IMenu[] getMenus() {
+ return getUserNavigationHistory().getMenus();
+ }
+
+ @Override
+ public int getSize() {
+ return getUserNavigationHistory().getSize();
+ }
+
+ @Override
+ public int getIndex() {
+ return getUserNavigationHistory().getIndex();
+ }
+
+ @Override
+ public void addNavigationHistoryListener(NavigationHistoryListener listener) {
+ getUserNavigationHistory().addNavigationHistoryListener(listener);
+ }
+
+ @Override
+ public void removeNavigationHistoryListener(NavigationHistoryListener listener) {
+ getUserNavigationHistory().removeNavigationHistoryListener(listener);
+ }
+
+ private UserNavigationHistory getUserNavigationHistory() {
+ IClientSession session = ClientJob.getCurrentSession();
+ if (session == null) {
+ return new UserNavigationHistory();
+ }
+ UserNavigationHistory data = (UserNavigationHistory) session.getData(SERVICE_DATA_KEY);
+ if (data == null) {
+ data = new UserNavigationHistory();
+ session.setData(SERVICE_DATA_KEY, data);
+ }
+ return data;
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/navigation/internal/UserNavigationHistory.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/navigation/internal/UserNavigationHistory.java
index dde90132e7..483b18c039 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/navigation/internal/UserNavigationHistory.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/navigation/internal/UserNavigationHistory.java
@@ -1,398 +1,398 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.desktop.navigation.internal;
-
-import java.util.ArrayList;
-import java.util.EventListener;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.commons.EventListenerList;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
-import org.eclipse.scout.rt.client.ui.desktop.navigation.NavigationHistoryEvent;
-import org.eclipse.scout.rt.client.ui.desktop.navigation.NavigationHistoryListener;
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithNodes;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
-import org.eclipse.scout.rt.shared.AbstractIcons;
-import org.eclipse.scout.rt.shared.services.common.bookmark.AbstractPageState;
-import org.eclipse.scout.rt.shared.services.common.bookmark.Bookmark;
-import org.eclipse.scout.rt.shared.services.common.bookmark.TablePageState;
-
-/**
- *
- */
-public class UserNavigationHistory {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(UserNavigationHistory.class);
-
- private final EventListenerList m_listenerList;
- private final LinkedList<Bookmark> m_bookmarks;
- private int m_index;// 0...inf
- private boolean m_addStepEnabled;
-
- public UserNavigationHistory() {
- m_addStepEnabled = true;
- m_listenerList = new EventListenerList();
- m_bookmarks = new LinkedList<Bookmark>();
- }
-
- public Bookmark addStep(int level, IPage page) {
- if (!m_addStepEnabled) {
- return null;
- }
-
- Bookmark bm = null;
- try {
- bm = ClientSyncJob.getCurrentSession().getDesktop().createBookmark(page);
- if (bm == null) {
- return null;
- }
- decorateBookmark(bm, level, page.getCell().getText(), page.getCell().getIconId());
-
- return addStep(bm);
- }
- catch (Throwable t) {
- return handleAddStepError(t, bm);
- }
- }
-
- public Bookmark addStep(int level, String name, String iconId) {
- if (!m_addStepEnabled) {
- return null;
- }
-
- Bookmark bm = null;
- try {
- bm = ClientSyncJob.getCurrentSession().getDesktop().createBookmark();
- if (bm == null) {
- return null;
- }
- decorateBookmark(bm, level, name, iconId);
-
- return addStep(bm);
- }
- catch (Throwable t) {
- return handleAddStepError(t, bm);
- }
- }
-
- protected void decorateBookmark(Bookmark bm, int level, String name, String iconId) {
- bm.setTitle(StringUtility.rpad("", " ", level * 2) + name);
- bm.setIconId(iconId);
- }
-
- protected Bookmark handleAddStepError(Throwable t, Bookmark bm) {
- String bookmarkTitle = "";
- if (bm != null) {
- bookmarkTitle = bm.getText();
- }
- LOG.warn("Exception occured while adding step to navigation history for bookmark: " + bookmarkTitle, t);
- return null;
- }
-
- protected void activateBookmark(Bookmark b) throws ProcessingException {
- IDesktop desktop = ClientSyncJob.getCurrentSession().getDesktop();
- desktop.activateBookmark(b, false);
- //scroll to tree selection
- IOutline outline = desktop.getOutline();
- if (outline != null) {
- outline.scrollToSelection();
- //scroll to table selection
- IPage page = outline.getActivePage();
- if (page instanceof IPageWithTable<?>) {
- ITable table = ((IPageWithTable<?>) page).getTable();
- if (table != null) {
- table.scrollToSelection();
- }
- }
- else if (page instanceof IPageWithNodes) {
- ITable table = ((IPageWithNodes) page).getInternalTable();
- if (table != null) {
- table.scrollToSelection();
- }
- }
- }
- }
-
- public Bookmark addStep(Bookmark bm) {
- if (!m_addStepEnabled) {
- return null;
- }
- if (bm == null) {
- return null;
- }
-
- // if last position was same as new one, skip it
- if (m_index < m_bookmarks.size()) {
- Bookmark last = m_bookmarks.get(m_index);
- if (isSameBookmark(last, bm)) {
- // replace
- m_bookmarks.set(m_index, bm);
- fireNavigationChanged();
- return bm;
- }
- }
- int nextPos = m_index + 1;
- // check if existing position is already same as new one (keep later
- // objects), otherwise delete later history
- if (nextPos < m_bookmarks.size() && bm.equals(m_bookmarks.get(nextPos))) {
- m_bookmarks.set(nextPos, bm);
- m_index = nextPos;
- }
- else {
- while (nextPos < m_bookmarks.size()) {
- Bookmark removedBookmark = m_bookmarks.removeLast();
- m_index = m_index - 1;
- fireBookmarkRemoved(removedBookmark);
- }
- m_bookmarks.add(bm);
- m_index = m_bookmarks.size() - 1;
- fireBookmarkAdded(bm);
- }
- // size check, if list larger than 25 entries, truncate it
- while (m_bookmarks.size() > 25) {
- Bookmark removedBookmark = m_bookmarks.removeFirst();
- m_index = Math.max(0, m_index - 1);
- fireBookmarkRemoved(removedBookmark);
- }
- fireNavigationChanged();
- return bm;
- }
-
- private void saveCurrentStep() {
- try {
- // if last position was same as new one, overwrite it
- if (m_index == m_bookmarks.size() - 1) {
- Bookmark last = m_bookmarks.get(m_index);
- Bookmark bm = ClientSyncJob.getCurrentSession().getDesktop().createBookmark();
- if (bm != null) {
- bm.setTitle(last.getTitle());
- bm.setIconId(last.getIconId());
- // replace
- m_bookmarks.set(m_index, bm);
- }
- }
- }
- catch (Throwable t) {
- // nop
- }
- }
-
- private boolean isSameBookmark(Bookmark oldbm, Bookmark newbm) {
- if (CompareUtility.equals(oldbm.getTitle(), newbm.getTitle())) {
- TablePageState oldLastNode = null;
- TablePageState newLastNode = null;
- List<AbstractPageState> list = oldbm.getPath();
- if (list != null && list.size() > 0) {
- AbstractPageState s = list.get(list.size() - 1);
- if (s instanceof TablePageState) {
- oldLastNode = (TablePageState) s;
- }
- }
- list = newbm.getPath();
- if (list != null && list.size() > 0) {
- AbstractPageState s = list.get(list.size() - 1);
- if (s instanceof TablePageState) {
- newLastNode = (TablePageState) s;
- }
- }
- if (oldLastNode != null && newLastNode != null) {
- if (CompareUtility.equals(oldLastNode.getSearchFormState(), newLastNode.getSearchFormState())) {
- return true;
- }
- else {
- return false;
- }
- }
- else {
- return true;
- }
- }
- else {
- return false;
- }
- }
-
- public Bookmark getActiveBookmark() {
- if (m_index < m_bookmarks.size()) {
- return m_bookmarks.get(m_index);
- }
- else {
- return null;
- }
- }
-
- public List<Bookmark> getBookmarks() {
- return new ArrayList<Bookmark>(m_bookmarks);
- }
-
- public List<Bookmark> getBackwardBookmarks() {
- ArrayList<Bookmark> actions = new ArrayList<Bookmark>();
- int startIndex = 0;
- int endIndex = getIndex() - 1;
- if (startIndex <= endIndex) {
- for (int i = startIndex; i <= endIndex; i++) {
- Bookmark b = m_bookmarks.get(i);
- actions.add(b);
- }
- }
- return actions;
- }
-
- public boolean hasBackwardBookmarks() {
- int startIndex = 0;
- int endIndex = getIndex() - 1;
- return (startIndex <= endIndex);
- }
-
- public List<Bookmark> getForwardBookmarks() {
- ArrayList<Bookmark> actions = new ArrayList<Bookmark>();
- int startIndex = getIndex() + 1;
- int endIndex = m_bookmarks.size() - 1;
- if (startIndex >= 0 && endIndex >= startIndex) {
- for (int i = startIndex; i <= endIndex; i++) {
- Bookmark b = m_bookmarks.get(i);
- actions.add(b);
- }
- }
- return actions;
- }
-
- public boolean hasForwardBookmarks() {
- int startIndex = getIndex() + 1;
- int endIndex = m_bookmarks.size() - 1;
- return (startIndex >= 0 && endIndex >= startIndex);
- }
-
- public void stepForward() throws ProcessingException {
- int nextPos = m_index + 1;
- if (nextPos >= 0 && nextPos < m_bookmarks.size()) {
- saveCurrentStep();
- //
- m_index = nextPos;
- Bookmark b = m_bookmarks.get(m_index);
- try {
- m_addStepEnabled = false;
- //
- activateBookmark(b);
- }
- finally {
- m_addStepEnabled = true;
- }
- fireNavigationChanged();
- }
- }
-
- public void stepBackward() throws ProcessingException {
- int nextPos = m_index - 1;
- if (nextPos >= 0 && nextPos < m_bookmarks.size()) {
- saveCurrentStep();
- //
- m_index = nextPos;
- fireNavigationChanged();
- Bookmark b = m_bookmarks.get(m_index);
- try {
- m_addStepEnabled = false;
- //
- activateBookmark(b);
- }
- finally {
- m_addStepEnabled = true;
- }
- }
- }
-
- public void stepTo(Bookmark b) throws ProcessingException {
- for (int i = 0; i < m_bookmarks.size(); i++) {
- if (m_bookmarks.get(i) == b) {
- saveCurrentStep();
- //
- m_index = i;
- fireNavigationChanged();
- try {
- m_addStepEnabled = false;
- //
- activateBookmark(b);
- }
- finally {
- m_addStepEnabled = true;
- }
- break;
- }
- }
- }
-
- public IMenu[] getMenus() {
- List<Bookmark> bookmarks = getBookmarks();
- Bookmark current = getActiveBookmark();
- // children
- ArrayList<IMenu> newList = new ArrayList<IMenu>();
- for (Bookmark b : bookmarks) {
- ActivateNavigationHistoryMenu m = new ActivateNavigationHistoryMenu(b);
- if (b == current) {
- m.setIconId(AbstractIcons.NavigationCurrent);
- m.setEnabled(false);
- }
- newList.add(m);
- }
- return newList.toArray(new IMenu[newList.size()]);
- }
-
- public int getSize() {
- return m_bookmarks.size();
- }
-
- public int getIndex() {
- return m_index;
- }
-
- public void addNavigationHistoryListener(NavigationHistoryListener listener) {
- m_listenerList.add(NavigationHistoryListener.class, listener);
- }
-
- public void removeNavigationHistoryListener(NavigationHistoryListener listener) {
- m_listenerList.remove(NavigationHistoryListener.class, listener);
- }
-
- private void fireBookmarkAdded(Bookmark bookmark) {
- NavigationHistoryEvent e = new NavigationHistoryEvent(this, NavigationHistoryEvent.TYPE_BOOKMARK_ADDED, bookmark);
- fireNavigationHistoryEvent(e);
- }
-
- private void fireBookmarkRemoved(Bookmark bookmark) {
- NavigationHistoryEvent e = new NavigationHistoryEvent(this, NavigationHistoryEvent.TYPE_BOOKMARK_REMOVDED, bookmark);
- fireNavigationHistoryEvent(e);
- }
-
- private void fireNavigationChanged() {
- NavigationHistoryEvent e = new NavigationHistoryEvent(this, NavigationHistoryEvent.TYPE_CHANGED);
- fireNavigationHistoryEvent(e);
- }
-
- private void fireNavigationHistoryEvent(NavigationHistoryEvent e) {
- EventListener[] a = m_listenerList.getListeners(NavigationHistoryListener.class);
- if (a != null) {
- for (int i = 0; i < a.length; i++) {
- ((NavigationHistoryListener) a[i]).navigationChanged(e);
- }
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.desktop.navigation.internal;
+
+import java.util.ArrayList;
+import java.util.EventListener;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.commons.EventListenerList;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
+import org.eclipse.scout.rt.client.ui.desktop.navigation.NavigationHistoryEvent;
+import org.eclipse.scout.rt.client.ui.desktop.navigation.NavigationHistoryListener;
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithNodes;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
+import org.eclipse.scout.rt.shared.AbstractIcons;
+import org.eclipse.scout.rt.shared.services.common.bookmark.AbstractPageState;
+import org.eclipse.scout.rt.shared.services.common.bookmark.Bookmark;
+import org.eclipse.scout.rt.shared.services.common.bookmark.TablePageState;
+
+/**
+ *
+ */
+public class UserNavigationHistory {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(UserNavigationHistory.class);
+
+ private final EventListenerList m_listenerList;
+ private final LinkedList<Bookmark> m_bookmarks;
+ private int m_index;// 0...inf
+ private boolean m_addStepEnabled;
+
+ public UserNavigationHistory() {
+ m_addStepEnabled = true;
+ m_listenerList = new EventListenerList();
+ m_bookmarks = new LinkedList<Bookmark>();
+ }
+
+ public Bookmark addStep(int level, IPage page) {
+ if (!m_addStepEnabled) {
+ return null;
+ }
+
+ Bookmark bm = null;
+ try {
+ bm = ClientSyncJob.getCurrentSession().getDesktop().createBookmark(page);
+ if (bm == null) {
+ return null;
+ }
+ decorateBookmark(bm, level, page.getCell().getText(), page.getCell().getIconId());
+
+ return addStep(bm);
+ }
+ catch (Throwable t) {
+ return handleAddStepError(t, bm);
+ }
+ }
+
+ public Bookmark addStep(int level, String name, String iconId) {
+ if (!m_addStepEnabled) {
+ return null;
+ }
+
+ Bookmark bm = null;
+ try {
+ bm = ClientSyncJob.getCurrentSession().getDesktop().createBookmark();
+ if (bm == null) {
+ return null;
+ }
+ decorateBookmark(bm, level, name, iconId);
+
+ return addStep(bm);
+ }
+ catch (Throwable t) {
+ return handleAddStepError(t, bm);
+ }
+ }
+
+ protected void decorateBookmark(Bookmark bm, int level, String name, String iconId) {
+ bm.setTitle(StringUtility.rpad("", " ", level * 2) + name);
+ bm.setIconId(iconId);
+ }
+
+ protected Bookmark handleAddStepError(Throwable t, Bookmark bm) {
+ String bookmarkTitle = "";
+ if (bm != null) {
+ bookmarkTitle = bm.getText();
+ }
+ LOG.warn("Exception occured while adding step to navigation history for bookmark: " + bookmarkTitle, t);
+ return null;
+ }
+
+ protected void activateBookmark(Bookmark b) throws ProcessingException {
+ IDesktop desktop = ClientSyncJob.getCurrentSession().getDesktop();
+ desktop.activateBookmark(b, false);
+ //scroll to tree selection
+ IOutline outline = desktop.getOutline();
+ if (outline != null) {
+ outline.scrollToSelection();
+ //scroll to table selection
+ IPage page = outline.getActivePage();
+ if (page instanceof IPageWithTable<?>) {
+ ITable table = ((IPageWithTable<?>) page).getTable();
+ if (table != null) {
+ table.scrollToSelection();
+ }
+ }
+ else if (page instanceof IPageWithNodes) {
+ ITable table = ((IPageWithNodes) page).getInternalTable();
+ if (table != null) {
+ table.scrollToSelection();
+ }
+ }
+ }
+ }
+
+ public Bookmark addStep(Bookmark bm) {
+ if (!m_addStepEnabled) {
+ return null;
+ }
+ if (bm == null) {
+ return null;
+ }
+
+ // if last position was same as new one, skip it
+ if (m_index < m_bookmarks.size()) {
+ Bookmark last = m_bookmarks.get(m_index);
+ if (isSameBookmark(last, bm)) {
+ // replace
+ m_bookmarks.set(m_index, bm);
+ fireNavigationChanged();
+ return bm;
+ }
+ }
+ int nextPos = m_index + 1;
+ // check if existing position is already same as new one (keep later
+ // objects), otherwise delete later history
+ if (nextPos < m_bookmarks.size() && bm.equals(m_bookmarks.get(nextPos))) {
+ m_bookmarks.set(nextPos, bm);
+ m_index = nextPos;
+ }
+ else {
+ while (nextPos < m_bookmarks.size()) {
+ Bookmark removedBookmark = m_bookmarks.removeLast();
+ m_index = m_index - 1;
+ fireBookmarkRemoved(removedBookmark);
+ }
+ m_bookmarks.add(bm);
+ m_index = m_bookmarks.size() - 1;
+ fireBookmarkAdded(bm);
+ }
+ // size check, if list larger than 25 entries, truncate it
+ while (m_bookmarks.size() > 25) {
+ Bookmark removedBookmark = m_bookmarks.removeFirst();
+ m_index = Math.max(0, m_index - 1);
+ fireBookmarkRemoved(removedBookmark);
+ }
+ fireNavigationChanged();
+ return bm;
+ }
+
+ private void saveCurrentStep() {
+ try {
+ // if last position was same as new one, overwrite it
+ if (m_index == m_bookmarks.size() - 1) {
+ Bookmark last = m_bookmarks.get(m_index);
+ Bookmark bm = ClientSyncJob.getCurrentSession().getDesktop().createBookmark();
+ if (bm != null) {
+ bm.setTitle(last.getTitle());
+ bm.setIconId(last.getIconId());
+ // replace
+ m_bookmarks.set(m_index, bm);
+ }
+ }
+ }
+ catch (Throwable t) {
+ // nop
+ }
+ }
+
+ private boolean isSameBookmark(Bookmark oldbm, Bookmark newbm) {
+ if (CompareUtility.equals(oldbm.getTitle(), newbm.getTitle())) {
+ TablePageState oldLastNode = null;
+ TablePageState newLastNode = null;
+ List<AbstractPageState> list = oldbm.getPath();
+ if (list != null && list.size() > 0) {
+ AbstractPageState s = list.get(list.size() - 1);
+ if (s instanceof TablePageState) {
+ oldLastNode = (TablePageState) s;
+ }
+ }
+ list = newbm.getPath();
+ if (list != null && list.size() > 0) {
+ AbstractPageState s = list.get(list.size() - 1);
+ if (s instanceof TablePageState) {
+ newLastNode = (TablePageState) s;
+ }
+ }
+ if (oldLastNode != null && newLastNode != null) {
+ if (CompareUtility.equals(oldLastNode.getSearchFormState(), newLastNode.getSearchFormState())) {
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+ else {
+ return true;
+ }
+ }
+ else {
+ return false;
+ }
+ }
+
+ public Bookmark getActiveBookmark() {
+ if (m_index < m_bookmarks.size()) {
+ return m_bookmarks.get(m_index);
+ }
+ else {
+ return null;
+ }
+ }
+
+ public List<Bookmark> getBookmarks() {
+ return new ArrayList<Bookmark>(m_bookmarks);
+ }
+
+ public List<Bookmark> getBackwardBookmarks() {
+ ArrayList<Bookmark> actions = new ArrayList<Bookmark>();
+ int startIndex = 0;
+ int endIndex = getIndex() - 1;
+ if (startIndex <= endIndex) {
+ for (int i = startIndex; i <= endIndex; i++) {
+ Bookmark b = m_bookmarks.get(i);
+ actions.add(b);
+ }
+ }
+ return actions;
+ }
+
+ public boolean hasBackwardBookmarks() {
+ int startIndex = 0;
+ int endIndex = getIndex() - 1;
+ return (startIndex <= endIndex);
+ }
+
+ public List<Bookmark> getForwardBookmarks() {
+ ArrayList<Bookmark> actions = new ArrayList<Bookmark>();
+ int startIndex = getIndex() + 1;
+ int endIndex = m_bookmarks.size() - 1;
+ if (startIndex >= 0 && endIndex >= startIndex) {
+ for (int i = startIndex; i <= endIndex; i++) {
+ Bookmark b = m_bookmarks.get(i);
+ actions.add(b);
+ }
+ }
+ return actions;
+ }
+
+ public boolean hasForwardBookmarks() {
+ int startIndex = getIndex() + 1;
+ int endIndex = m_bookmarks.size() - 1;
+ return (startIndex >= 0 && endIndex >= startIndex);
+ }
+
+ public void stepForward() throws ProcessingException {
+ int nextPos = m_index + 1;
+ if (nextPos >= 0 && nextPos < m_bookmarks.size()) {
+ saveCurrentStep();
+ //
+ m_index = nextPos;
+ Bookmark b = m_bookmarks.get(m_index);
+ try {
+ m_addStepEnabled = false;
+ //
+ activateBookmark(b);
+ }
+ finally {
+ m_addStepEnabled = true;
+ }
+ fireNavigationChanged();
+ }
+ }
+
+ public void stepBackward() throws ProcessingException {
+ int nextPos = m_index - 1;
+ if (nextPos >= 0 && nextPos < m_bookmarks.size()) {
+ saveCurrentStep();
+ //
+ m_index = nextPos;
+ fireNavigationChanged();
+ Bookmark b = m_bookmarks.get(m_index);
+ try {
+ m_addStepEnabled = false;
+ //
+ activateBookmark(b);
+ }
+ finally {
+ m_addStepEnabled = true;
+ }
+ }
+ }
+
+ public void stepTo(Bookmark b) throws ProcessingException {
+ for (int i = 0; i < m_bookmarks.size(); i++) {
+ if (m_bookmarks.get(i) == b) {
+ saveCurrentStep();
+ //
+ m_index = i;
+ fireNavigationChanged();
+ try {
+ m_addStepEnabled = false;
+ //
+ activateBookmark(b);
+ }
+ finally {
+ m_addStepEnabled = true;
+ }
+ break;
+ }
+ }
+ }
+
+ public IMenu[] getMenus() {
+ List<Bookmark> bookmarks = getBookmarks();
+ Bookmark current = getActiveBookmark();
+ // children
+ ArrayList<IMenu> newList = new ArrayList<IMenu>();
+ for (Bookmark b : bookmarks) {
+ ActivateNavigationHistoryMenu m = new ActivateNavigationHistoryMenu(b);
+ if (b == current) {
+ m.setIconId(AbstractIcons.NavigationCurrent);
+ m.setEnabled(false);
+ }
+ newList.add(m);
+ }
+ return newList.toArray(new IMenu[newList.size()]);
+ }
+
+ public int getSize() {
+ return m_bookmarks.size();
+ }
+
+ public int getIndex() {
+ return m_index;
+ }
+
+ public void addNavigationHistoryListener(NavigationHistoryListener listener) {
+ m_listenerList.add(NavigationHistoryListener.class, listener);
+ }
+
+ public void removeNavigationHistoryListener(NavigationHistoryListener listener) {
+ m_listenerList.remove(NavigationHistoryListener.class, listener);
+ }
+
+ private void fireBookmarkAdded(Bookmark bookmark) {
+ NavigationHistoryEvent e = new NavigationHistoryEvent(this, NavigationHistoryEvent.TYPE_BOOKMARK_ADDED, bookmark);
+ fireNavigationHistoryEvent(e);
+ }
+
+ private void fireBookmarkRemoved(Bookmark bookmark) {
+ NavigationHistoryEvent e = new NavigationHistoryEvent(this, NavigationHistoryEvent.TYPE_BOOKMARK_REMOVDED, bookmark);
+ fireNavigationHistoryEvent(e);
+ }
+
+ private void fireNavigationChanged() {
+ NavigationHistoryEvent e = new NavigationHistoryEvent(this, NavigationHistoryEvent.TYPE_CHANGED);
+ fireNavigationHistoryEvent(e);
+ }
+
+ private void fireNavigationHistoryEvent(NavigationHistoryEvent e) {
+ EventListener[] a = m_listenerList.getListeners(NavigationHistoryListener.class);
+ if (a != null) {
+ for (int i = 0; i < a.length; i++) {
+ ((NavigationHistoryListener) a[i]).navigationChanged(e);
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/AbstractFormToolButton.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/AbstractFormToolButton.java
index 3f43de314e..1f2bca47f5 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/AbstractFormToolButton.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/AbstractFormToolButton.java
@@ -1,135 +1,135 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.desktop.outline;
-
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.ui.action.tool.AbstractToolButton;
-import org.eclipse.scout.rt.client.ui.action.tool.IToolButton;
-import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-
-/**
- * A tool button that can be used in the {@link IDesktop} to toggle a form in the tools area.
- */
-public abstract class AbstractFormToolButton<FORM extends IForm> extends AbstractToolButton implements IFormToolButton<FORM> {
-
- private FORM m_form;
- private boolean m_previousSelectionState = false;
-
- @ConfigPropertyValue("true")
- @Override
- protected boolean getConfiguredToggleAction() {
- return true;
- }
-
- @Override
- public final FORM getForm() {
- return m_form;
- }
-
- @Override
- public final void setForm(FORM f) {
- setForm(f, false);
- }
-
- @Override
- public final void setForm(FORM f, boolean force) {
- if (force || f != m_form) {
- if (f != null) {
- decorateForm(f);
- }
- FORM oldForm = m_form;
- m_form = f;
- //single observer
- IDesktop desktop = ClientSyncJob.getCurrentSession().getDesktop();
- if (desktop != null) {
- if (m_form == null) {
- // Close the "tab", when the form is null (but remember the previous state)
- desktop.removeForm(oldForm);
- m_previousSelectionState = isSelected();
- setSelected(false);
- setEnabled(false);
- }
- else {
- setEnabled(true);
- if (!isSelected()) { // restore selection
- setSelected(m_previousSelectionState);
- }
- if (isSelected()) {
- if (oldForm != null) {
- desktop.removeForm(oldForm);
- }
- desktop.addForm(m_form);
- }
- }
- }
- }
- }
-
- /**
- * Called every time the tool button is selected.
- * <p>
- * Check {@link #getForm()} to see what form is currently represented.
- * <p>
- * Example code is:<code><pre>
- * if(getForm()==null){
- * f=new MyForm();
- * decorate(f);
- * f.startForm()
- * setForm(f);
- * }
- * </pre></code> Call {@link #setForm(IForm)} to change the current form.
- */
- protected void execStartForm() throws ProcessingException {
- }
-
- @Override
- protected void execToggleAction(boolean selected) throws ProcessingException {
- IDesktop desktop = ClientSyncJob.getCurrentSession().getDesktop();
- if (desktop == null) {
- return;
- }
- if (selected) {
- if (isToggleAction()) {
- // unselect other form tool buttons
- for (IToolButton b : desktop.getToolButtons()) {
- if (b != this && b instanceof AbstractFormToolButton && b.isSelected()) {
- b.setSelected(false);
- }
- }
- }
- // show form
- FORM oldForm = getForm();
- execStartForm();
- if (oldForm == m_form) {
- if (m_form != null) {
- m_previousSelectionState = true;
- desktop.addForm(m_form);
- }
- }
- }
- else {
- // hide form
- if (m_form != null) {
- m_previousSelectionState = false;
- desktop.removeForm(m_form);
- }
- }
- }
-
- protected void decorateForm(FORM f) {
- f.setAutoAddRemoveOnDesktop(false);
- f.setDisplayHint(IForm.DISPLAY_HINT_VIEW);
- f.setDisplayViewId(IForm.VIEW_ID_E);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.desktop.outline;
+
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.ui.action.tool.AbstractToolButton;
+import org.eclipse.scout.rt.client.ui.action.tool.IToolButton;
+import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+
+/**
+ * A tool button that can be used in the {@link IDesktop} to toggle a form in the tools area.
+ */
+public abstract class AbstractFormToolButton<FORM extends IForm> extends AbstractToolButton implements IFormToolButton<FORM> {
+
+ private FORM m_form;
+ private boolean m_previousSelectionState = false;
+
+ @ConfigPropertyValue("true")
+ @Override
+ protected boolean getConfiguredToggleAction() {
+ return true;
+ }
+
+ @Override
+ public final FORM getForm() {
+ return m_form;
+ }
+
+ @Override
+ public final void setForm(FORM f) {
+ setForm(f, false);
+ }
+
+ @Override
+ public final void setForm(FORM f, boolean force) {
+ if (force || f != m_form) {
+ if (f != null) {
+ decorateForm(f);
+ }
+ FORM oldForm = m_form;
+ m_form = f;
+ //single observer
+ IDesktop desktop = ClientSyncJob.getCurrentSession().getDesktop();
+ if (desktop != null) {
+ if (m_form == null) {
+ // Close the "tab", when the form is null (but remember the previous state)
+ desktop.removeForm(oldForm);
+ m_previousSelectionState = isSelected();
+ setSelected(false);
+ setEnabled(false);
+ }
+ else {
+ setEnabled(true);
+ if (!isSelected()) { // restore selection
+ setSelected(m_previousSelectionState);
+ }
+ if (isSelected()) {
+ if (oldForm != null) {
+ desktop.removeForm(oldForm);
+ }
+ desktop.addForm(m_form);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Called every time the tool button is selected.
+ * <p>
+ * Check {@link #getForm()} to see what form is currently represented.
+ * <p>
+ * Example code is:<code><pre>
+ * if(getForm()==null){
+ * f=new MyForm();
+ * decorate(f);
+ * f.startForm()
+ * setForm(f);
+ * }
+ * </pre></code> Call {@link #setForm(IForm)} to change the current form.
+ */
+ protected void execStartForm() throws ProcessingException {
+ }
+
+ @Override
+ protected void execToggleAction(boolean selected) throws ProcessingException {
+ IDesktop desktop = ClientSyncJob.getCurrentSession().getDesktop();
+ if (desktop == null) {
+ return;
+ }
+ if (selected) {
+ if (isToggleAction()) {
+ // unselect other form tool buttons
+ for (IToolButton b : desktop.getToolButtons()) {
+ if (b != this && b instanceof AbstractFormToolButton && b.isSelected()) {
+ b.setSelected(false);
+ }
+ }
+ }
+ // show form
+ FORM oldForm = getForm();
+ execStartForm();
+ if (oldForm == m_form) {
+ if (m_form != null) {
+ m_previousSelectionState = true;
+ desktop.addForm(m_form);
+ }
+ }
+ }
+ else {
+ // hide form
+ if (m_form != null) {
+ m_previousSelectionState = false;
+ desktop.removeForm(m_form);
+ }
+ }
+ }
+
+ protected void decorateForm(FORM f) {
+ f.setAutoAddRemoveOnDesktop(false);
+ f.setDisplayHint(IForm.DISPLAY_HINT_VIEW);
+ f.setDisplayViewId(IForm.VIEW_ID_E);
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/AbstractOutline.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/AbstractOutline.java
index 4f5e0e40d0..667d8bd167 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/AbstractOutline.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/AbstractOutline.java
@@ -1,563 +1,563 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.desktop.outline;
-
-import java.security.Permission;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-
-import org.eclipse.scout.commons.OptimisticLock;
-import org.eclipse.scout.commons.annotations.ConfigOperation;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.dnd.TransferObject;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.holders.Holder;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.client.ui.basic.tree.AbstractTree;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNodeFilter;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeVisitor;
-import org.eclipse.scout.rt.client.ui.basic.tree.TreeAdapter;
-import org.eclipse.scout.rt.client.ui.basic.tree.TreeEvent;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.AbstractPageWithNodes;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithNodes;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.ISearchForm;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
-import org.eclipse.scout.rt.shared.services.common.security.IAccessControlService;
-import org.eclipse.scout.service.SERVICES;
-
-public abstract class AbstractOutline extends AbstractTree implements IOutline {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractOutline.class);
-
- // visible is defined as: visibleGranted && visibleProperty
- private boolean m_visibleGranted;
- private boolean m_visibleProperty;
- private IPage m_contextPage;
- private IPageChangeStrategy m_pageChangeStrategy;
- private OptimisticLock m_contextPageOptimisticLock;
- private OutlineMediator m_outlineMediator;
-
- public AbstractOutline() {
- super();
- }
-
- public AbstractOutline(boolean callInitialzier) {
- super(callInitialzier);
- }
-
- /*
- * Configuration
- */
-
- /**
- * Configures whether this outline is enabled.
- * <p>
- * Subclasses can override this method. Default is {@code true}.
- *
- * @return {@code true} if this outline is enabled, {@code false} otherwise
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(80)
- @ConfigPropertyValue("true")
- protected boolean getConfiguredEnabled() {
- return true;
- }
-
- /**
- * Configures the visibility of this outline.
- * <p>
- * Subclasses can override this method. Default is {@code true}.
- *
- * @return {@code true} if this outline is visible, {@code false} otherwise
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(90)
- @ConfigPropertyValue("true")
- protected boolean getConfiguredVisible() {
- return true;
- }
-
- /**
- * This method is no longer used and has no effect.
- * <p>
- * Use {@link Order} annotations to define the sort ordering of the outlines on the desktop instead.
- * <p>
- * Subclasses can override this method. Default is 0.
- *
- * @return the sort order of this outline.
- */
- @ConfigProperty(ConfigProperty.INTEGER)
- @Order(100)
- @ConfigPropertyValue("0")
- @Deprecated
- protected int getConfiguredSortNo() {
- return 0;
- }
-
- /**
- * Provides a documentation text or description of this outline. The text is intended to be included in external
- * documentation. This method is typically processed by a documentation generation tool or similar.
- * <p>
- * Subclasses can override this method. Default is {@code null}.
- *
- * @return a documentation text, suitable to be included in external documents
- */
- @ConfigProperty(ConfigProperty.DOC)
- @Order(110)
- @ConfigPropertyValue("null")
- protected String getConfiguredDoc() {
- return null;
- }
-
- /**
- * Called during initialization of this outline. Allows to add child pages to the outline tree. All added pages are
- * roots of the visible tree.
- * <p>
- * Subclasses can override this method. The default does nothing.
- *
- * @param pageList
- * live collection to add pages to the outline tree
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(90)
- protected void execCreateChildPages(Collection<IPage> pageList) throws ProcessingException {
- }
-
- protected void createChildPagesInternal(Collection<IPage> pageList) throws ProcessingException {
- execCreateChildPages(pageList);
- }
-
- /**
- * By default the outline tree tries to delegate the drop to the affected
- * page.
- */
- @Override
- protected void execDrop(ITreeNode node, TransferObject t) {
- if (node instanceof IPageWithTable) {
- ITable table = ((IPageWithTable) node).getTable();
- if (table.getDropType() != 0) {
- table.getUIFacade().fireRowDropActionFromUI(null, t);
- }
- }
- }
-
- @Override
- protected void initConfig() {
- m_visibleGranted = true;
- m_contextPageOptimisticLock = new OptimisticLock();
- setPageChangeStrategy(createPageChangeStrategy());
- m_outlineMediator = createOutlineMediator();
- addTreeListener(new P_OutlineListener());
- addNodeFilter(new P_TableFilterBasedTreeNodeFilter());
- super.initConfig();
- setRootNodeVisible(false);
- IPage rootPage = new InvisibleRootPage();
- setRootNode(rootPage);
- setEnabled(getConfiguredEnabled());
- setVisible(getConfiguredVisible());
- }
-
- /*
- * Runtime
- */
-
- @Override
- public IPage getActivePage() {
- return (IPage) getSelectedNode();
- }
-
- @Override
- public void refreshPages(final Class... pageTypes) {
- final ArrayList<IPage> candidates = new ArrayList<IPage>();
- ITreeVisitor v = new ITreeVisitor() {
- @Override
- public boolean visit(ITreeNode node) {
- IPage page = (IPage) node;
- if (page == null) {
- return true;
- }
- Class<? extends IPage> pageClass = page.getClass();
- for (Class<? extends IPage> c : pageTypes) {
- if (c.isAssignableFrom(pageClass)) {
- candidates.add(page);
- }
- }
- return true;
- }
- };
- visitNode(getRootNode(), v);
- for (IPage page : candidates) {
- if (page.getTree() != null) {
- page.dataChanged();
- }
- }
- }
-
- @Override
- public void releaseUnusedPages() {
- final HashSet<IPage> preservationSet = new HashSet<IPage>();
- IPage oldSelection = (IPage) getSelectedNode();
- IPage p = oldSelection;
- if (p != null) {
- while (p != null) {
- preservationSet.add(p);
- p = p.getParentPage();
- }
- }
- ITreeVisitor v = new ITreeVisitor() {
- @Override
- public boolean visit(ITreeNode node) {
- IPage page = (IPage) node;
- if (preservationSet.contains(page)) {
- // nop
- }
- else if (page.isChildrenLoaded() && (!page.isExpanded() || !(page.getParentPage() != null && page.getParentPage().isChildrenLoaded()))) {
- try {
- unloadNode(page);
- }
- catch (ProcessingException e) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- }
- return true;
- }
- };
- try {
- setTreeChanging(true);
- visitNode(getRootNode(), v);
- if (oldSelection != null) {
- IPage selectedPage = (IPage) getSelectedNode();
- if (selectedPage == null) {
- try {
- getRootNode().ensureChildrenLoaded();
- ITreeNode[] children = getRootNode().getFilteredChildNodes();
- if (children.length > 0) {
- selectNode(children[0]);
- }
- }
- catch (ProcessingException e) {
- LOG.warn(null, e);
- }
- }
- }
- }
- finally {
- setTreeChanging(false);
- }
- }
-
- @Override
- public <T extends IPage> T findPage(final Class<T> pageType) {
- final Holder<T> result = new Holder<T>(pageType, null);
- ITreeVisitor v = new ITreeVisitor() {
- @Override
- @SuppressWarnings("unchecked")
- public boolean visit(ITreeNode node) {
- IPage page = (IPage) node;
- Class<? extends IPage> pageClass = page.getClass();
- if (pageType.isAssignableFrom(pageClass)) {
- result.setValue((T) page);
- }
- return result.getValue() == null;
- }
- };
- visitNode(getRootNode(), v);
- return result.getValue();
- }
-
- @Override
- public void setVisiblePermission(Permission p) {
- boolean b;
- if (p != null) {
- b = SERVICES.getService(IAccessControlService.class).checkPermission(p);
- }
- else {
- b = true;
- }
- setVisibleGranted(b);
- }
-
- @Override
- public boolean isVisibleGranted() {
- return m_visibleGranted;
- }
-
- @Override
- public void setVisibleGranted(boolean b) {
- m_visibleGranted = b;
- calculateVisible();
- }
-
- @Override
- public boolean isVisible() {
- return propertySupport.getPropertyBool(PROP_VISIBLE);
- }
-
- @Override
- public void setVisible(boolean b) {
- m_visibleProperty = b;
- calculateVisible();
- }
-
- private void calculateVisible() {
- propertySupport.setPropertyBool(PROP_VISIBLE, m_visibleGranted && m_visibleProperty);
- }
-
- @Override
- public IForm getDetailForm() {
- return (IForm) propertySupport.getProperty(PROP_DETAIL_FORM);
- }
-
- @Override
- public void setDetailForm(IForm form) {
- propertySupport.setProperty(PROP_DETAIL_FORM, form);
- }
-
- @Override
- public ITable getDetailTable() {
- return (ITable) propertySupport.getProperty(PROP_DETAIL_TABLE);
- }
-
- @Override
- public void setDetailTable(ITable table) {
- propertySupport.setProperty(PROP_DETAIL_TABLE, table);
- }
-
- @Override
- public IForm getSearchForm() {
- return (IForm) propertySupport.getProperty(PROP_SEARCH_FORM);
- }
-
- @Override
- public void setSearchForm(IForm form) {
- propertySupport.setProperty(PROP_SEARCH_FORM, form);
- }
-
- @Override
- public IPage getRootPage() {
- return (IPage) getRootNode();
- }
-
- @Override
- public void unloadNode(ITreeNode node) throws ProcessingException {
- try {
- setTreeChanging(true);
- //
- super.unloadNode(node);
- if (node instanceof IPageWithTable) {
- ((IPageWithTable) node).getTable().deleteAllRows();
- }
- }
- finally {
- setTreeChanging(false);
- }
- }
-
- @Override
- public void resetOutline() throws ProcessingException {
- if (getRootNode() != null) {
- try {
- setTreeChanging(true);
- //
- selectNode(null);
- unloadNode(getRootNode());
- getRootNode().ensureChildrenLoaded();
- }
- finally {
- setTreeChanging(false);
- }
- ITreeNode root = getRootNode();
- if (root instanceof IPageWithTable) {
- ISearchForm searchForm = ((IPageWithTable) root).getSearchFormInternal();
- if (searchForm != null) {
- searchForm.doReset();
- }
- }
- if (!isRootNodeVisible()) {
- root.setExpanded(true);
- }
- selectFirstNode();
- if (getSelectedNode() instanceof IPageWithTable) {
- getSelectedNode().setExpanded(true);
- }
- }
- }
-
- @Override
- public void makeActivePageToContextPage() {
- IPage activePage = getActivePage();
- if (activePage != null && m_contextPage != activePage) {
- m_contextPage = activePage;
- activePage.pageActivatedNotify();
- }
- }
-
- @Override
- public void clearContextPage() {
- IPage page = m_contextPage;
- if (page != null) {
- m_contextPage = null;
- page.pageDeactivatedNotify();
- }
- }
-
- private void handleActivePageChanged(IPage deselectedPage, IPage selectedPage) {
- if (m_pageChangeStrategy == null) {
- return;
- }
-
- try {
- if (m_contextPageOptimisticLock.acquire()) {
- m_pageChangeStrategy.pageChanged(this, deselectedPage, selectedPage);
- }
- }
- finally {
- m_contextPageOptimisticLock.release();
- }
- }
-
- @Override
- public OutlineMediator getOutlineMediator() {
- return m_outlineMediator;
- }
-
- protected OutlineMediator createOutlineMediator() {
- return new OutlineMediator();
- }
-
- protected IPageChangeStrategy createPageChangeStrategy() {
- return new DefaultPageChangeStrategy();
- }
-
- @Override
- public void setPageChangeStrategy(IPageChangeStrategy pageChangeStrategy) {
- m_pageChangeStrategy = pageChangeStrategy;
- }
-
- @Override
- public IPageChangeStrategy getPageChangeStrategy() {
- return m_pageChangeStrategy;
- }
-
- private class P_OutlineListener extends TreeAdapter {
- @Override
- public void treeChanged(TreeEvent e) {
- switch (e.getType()) {
- case TreeEvent.TYPE_NODES_SELECTED: {
- handleActivePageChanged((IPage) e.getDeselectedNode(), (IPage) e.getNewSelectedNode());
- break;
- }
- case TreeEvent.TYPE_NODE_POPUP: {
- if (e.getNode() instanceof IPageWithTable<?>) {
- if (getOutlineMediator() != null) {
- IPageWithTable<? extends ITable> pageWithTable = (IPageWithTable<?>) e.getNode();
- getOutlineMediator().fetchTableEmptySpaceMenus(e, pageWithTable);
- }
- }
- break;
- }
- }
-
- ITreeNode commonParentNode = e.getCommonParentNode();
- if (commonParentNode instanceof IPageWithNodes) {
- handlePageWithNodesTreeEvent(e, (IPageWithNodes) commonParentNode);
- }
- else if (commonParentNode instanceof IPageWithTable<?>) {
- handlePageWithTableTreeEvent(e, (IPageWithTable<?>) commonParentNode);
- }
- }
-
- private void handlePageWithNodesTreeEvent(TreeEvent e, IPageWithNodes pageWithNodes) {
- OutlineMediator outlineMediator = getOutlineMediator();
- if (outlineMediator == null) {
- return;
- }
-
- switch (e.getType()) {
- case TreeEvent.TYPE_CHILD_NODE_ORDER_CHANGED:
- case TreeEvent.TYPE_NODES_DELETED:
- case TreeEvent.TYPE_NODES_INSERTED:
- case TreeEvent.TYPE_NODES_UPDATED: {
- outlineMediator.mediateTreeNodesChanged(pageWithNodes);
- break;
- }
- }
- }
-
- private void handlePageWithTableTreeEvent(TreeEvent e, IPageWithTable<? extends ITable> pageWithTable) {
- OutlineMediator outlineMediator = getOutlineMediator();
- if (outlineMediator == null) {
- return;
- }
-
- switch (e.getType()) {
- case TreeEvent.TYPE_NODE_POPUP: {
- outlineMediator.fetchTableRowMenus(e, pageWithTable);
- break;
- }
- case TreeEvent.TYPE_NODE_ACTION: {
- outlineMediator.mediateTreeNodeAction(e, pageWithTable);
- break;
- }
- case TreeEvent.TYPE_NODES_DRAG_REQUEST: {
- outlineMediator.mediateTreeNodesDragRequest(e, pageWithTable);
- break;
- }
- case TreeEvent.TYPE_NODE_DROP_ACTION: {
- outlineMediator.mediateTreeNodeDropAction(e, pageWithTable);
- break;
- }
- }
-
- }
- }
-
- private class P_TableFilterBasedTreeNodeFilter implements ITreeNodeFilter {
- @Override
- public boolean accept(ITreeNode node, int level) {
- ITreeNode parentNode = node.getParentNode();
- if (parentNode != null && !parentNode.isFilterAccepted()) {
- // hide page if parent page is filtered
- return false;
- }
- if (parentNode instanceof IPageWithTable<?>) {
- ITableRow tableRow = ((IPageWithTable<?>) parentNode).getTableRowFor(node);
- return tableRow == null || tableRow.isFilterAccepted();
- }
- else if (parentNode instanceof IPageWithNodes) {
- for (ITreeNode child : parentNode.getChildNodes()) {
- if (child.equals(node)) {
- return ((IPageWithNodes) parentNode).isFilterAcceptedForChildNode(node);
- }
- }
- }
- return true;
- }
- }
-
- private class InvisibleRootPage extends AbstractPageWithNodes {
- @Override
- protected void execCreateChildPages(Collection<IPage> pageList) throws ProcessingException {
- AbstractOutline.this.createChildPagesInternal(pageList);
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.desktop.outline;
+
+import java.security.Permission;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+
+import org.eclipse.scout.commons.OptimisticLock;
+import org.eclipse.scout.commons.annotations.ConfigOperation;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.dnd.TransferObject;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.holders.Holder;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.client.ui.basic.tree.AbstractTree;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNodeFilter;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeVisitor;
+import org.eclipse.scout.rt.client.ui.basic.tree.TreeAdapter;
+import org.eclipse.scout.rt.client.ui.basic.tree.TreeEvent;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.AbstractPageWithNodes;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithNodes;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.ISearchForm;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
+import org.eclipse.scout.rt.shared.services.common.security.IAccessControlService;
+import org.eclipse.scout.service.SERVICES;
+
+public abstract class AbstractOutline extends AbstractTree implements IOutline {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractOutline.class);
+
+ // visible is defined as: visibleGranted && visibleProperty
+ private boolean m_visibleGranted;
+ private boolean m_visibleProperty;
+ private IPage m_contextPage;
+ private IPageChangeStrategy m_pageChangeStrategy;
+ private OptimisticLock m_contextPageOptimisticLock;
+ private OutlineMediator m_outlineMediator;
+
+ public AbstractOutline() {
+ super();
+ }
+
+ public AbstractOutline(boolean callInitialzier) {
+ super(callInitialzier);
+ }
+
+ /*
+ * Configuration
+ */
+
+ /**
+ * Configures whether this outline is enabled.
+ * <p>
+ * Subclasses can override this method. Default is {@code true}.
+ *
+ * @return {@code true} if this outline is enabled, {@code false} otherwise
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(80)
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredEnabled() {
+ return true;
+ }
+
+ /**
+ * Configures the visibility of this outline.
+ * <p>
+ * Subclasses can override this method. Default is {@code true}.
+ *
+ * @return {@code true} if this outline is visible, {@code false} otherwise
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(90)
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredVisible() {
+ return true;
+ }
+
+ /**
+ * This method is no longer used and has no effect.
+ * <p>
+ * Use {@link Order} annotations to define the sort ordering of the outlines on the desktop instead.
+ * <p>
+ * Subclasses can override this method. Default is 0.
+ *
+ * @return the sort order of this outline.
+ */
+ @ConfigProperty(ConfigProperty.INTEGER)
+ @Order(100)
+ @ConfigPropertyValue("0")
+ @Deprecated
+ protected int getConfiguredSortNo() {
+ return 0;
+ }
+
+ /**
+ * Provides a documentation text or description of this outline. The text is intended to be included in external
+ * documentation. This method is typically processed by a documentation generation tool or similar.
+ * <p>
+ * Subclasses can override this method. Default is {@code null}.
+ *
+ * @return a documentation text, suitable to be included in external documents
+ */
+ @ConfigProperty(ConfigProperty.DOC)
+ @Order(110)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredDoc() {
+ return null;
+ }
+
+ /**
+ * Called during initialization of this outline. Allows to add child pages to the outline tree. All added pages are
+ * roots of the visible tree.
+ * <p>
+ * Subclasses can override this method. The default does nothing.
+ *
+ * @param pageList
+ * live collection to add pages to the outline tree
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(90)
+ protected void execCreateChildPages(Collection<IPage> pageList) throws ProcessingException {
+ }
+
+ protected void createChildPagesInternal(Collection<IPage> pageList) throws ProcessingException {
+ execCreateChildPages(pageList);
+ }
+
+ /**
+ * By default the outline tree tries to delegate the drop to the affected
+ * page.
+ */
+ @Override
+ protected void execDrop(ITreeNode node, TransferObject t) {
+ if (node instanceof IPageWithTable) {
+ ITable table = ((IPageWithTable) node).getTable();
+ if (table.getDropType() != 0) {
+ table.getUIFacade().fireRowDropActionFromUI(null, t);
+ }
+ }
+ }
+
+ @Override
+ protected void initConfig() {
+ m_visibleGranted = true;
+ m_contextPageOptimisticLock = new OptimisticLock();
+ setPageChangeStrategy(createPageChangeStrategy());
+ m_outlineMediator = createOutlineMediator();
+ addTreeListener(new P_OutlineListener());
+ addNodeFilter(new P_TableFilterBasedTreeNodeFilter());
+ super.initConfig();
+ setRootNodeVisible(false);
+ IPage rootPage = new InvisibleRootPage();
+ setRootNode(rootPage);
+ setEnabled(getConfiguredEnabled());
+ setVisible(getConfiguredVisible());
+ }
+
+ /*
+ * Runtime
+ */
+
+ @Override
+ public IPage getActivePage() {
+ return (IPage) getSelectedNode();
+ }
+
+ @Override
+ public void refreshPages(final Class... pageTypes) {
+ final ArrayList<IPage> candidates = new ArrayList<IPage>();
+ ITreeVisitor v = new ITreeVisitor() {
+ @Override
+ public boolean visit(ITreeNode node) {
+ IPage page = (IPage) node;
+ if (page == null) {
+ return true;
+ }
+ Class<? extends IPage> pageClass = page.getClass();
+ for (Class<? extends IPage> c : pageTypes) {
+ if (c.isAssignableFrom(pageClass)) {
+ candidates.add(page);
+ }
+ }
+ return true;
+ }
+ };
+ visitNode(getRootNode(), v);
+ for (IPage page : candidates) {
+ if (page.getTree() != null) {
+ page.dataChanged();
+ }
+ }
+ }
+
+ @Override
+ public void releaseUnusedPages() {
+ final HashSet<IPage> preservationSet = new HashSet<IPage>();
+ IPage oldSelection = (IPage) getSelectedNode();
+ IPage p = oldSelection;
+ if (p != null) {
+ while (p != null) {
+ preservationSet.add(p);
+ p = p.getParentPage();
+ }
+ }
+ ITreeVisitor v = new ITreeVisitor() {
+ @Override
+ public boolean visit(ITreeNode node) {
+ IPage page = (IPage) node;
+ if (preservationSet.contains(page)) {
+ // nop
+ }
+ else if (page.isChildrenLoaded() && (!page.isExpanded() || !(page.getParentPage() != null && page.getParentPage().isChildrenLoaded()))) {
+ try {
+ unloadNode(page);
+ }
+ catch (ProcessingException e) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ }
+ return true;
+ }
+ };
+ try {
+ setTreeChanging(true);
+ visitNode(getRootNode(), v);
+ if (oldSelection != null) {
+ IPage selectedPage = (IPage) getSelectedNode();
+ if (selectedPage == null) {
+ try {
+ getRootNode().ensureChildrenLoaded();
+ ITreeNode[] children = getRootNode().getFilteredChildNodes();
+ if (children.length > 0) {
+ selectNode(children[0]);
+ }
+ }
+ catch (ProcessingException e) {
+ LOG.warn(null, e);
+ }
+ }
+ }
+ }
+ finally {
+ setTreeChanging(false);
+ }
+ }
+
+ @Override
+ public <T extends IPage> T findPage(final Class<T> pageType) {
+ final Holder<T> result = new Holder<T>(pageType, null);
+ ITreeVisitor v = new ITreeVisitor() {
+ @Override
+ @SuppressWarnings("unchecked")
+ public boolean visit(ITreeNode node) {
+ IPage page = (IPage) node;
+ Class<? extends IPage> pageClass = page.getClass();
+ if (pageType.isAssignableFrom(pageClass)) {
+ result.setValue((T) page);
+ }
+ return result.getValue() == null;
+ }
+ };
+ visitNode(getRootNode(), v);
+ return result.getValue();
+ }
+
+ @Override
+ public void setVisiblePermission(Permission p) {
+ boolean b;
+ if (p != null) {
+ b = SERVICES.getService(IAccessControlService.class).checkPermission(p);
+ }
+ else {
+ b = true;
+ }
+ setVisibleGranted(b);
+ }
+
+ @Override
+ public boolean isVisibleGranted() {
+ return m_visibleGranted;
+ }
+
+ @Override
+ public void setVisibleGranted(boolean b) {
+ m_visibleGranted = b;
+ calculateVisible();
+ }
+
+ @Override
+ public boolean isVisible() {
+ return propertySupport.getPropertyBool(PROP_VISIBLE);
+ }
+
+ @Override
+ public void setVisible(boolean b) {
+ m_visibleProperty = b;
+ calculateVisible();
+ }
+
+ private void calculateVisible() {
+ propertySupport.setPropertyBool(PROP_VISIBLE, m_visibleGranted && m_visibleProperty);
+ }
+
+ @Override
+ public IForm getDetailForm() {
+ return (IForm) propertySupport.getProperty(PROP_DETAIL_FORM);
+ }
+
+ @Override
+ public void setDetailForm(IForm form) {
+ propertySupport.setProperty(PROP_DETAIL_FORM, form);
+ }
+
+ @Override
+ public ITable getDetailTable() {
+ return (ITable) propertySupport.getProperty(PROP_DETAIL_TABLE);
+ }
+
+ @Override
+ public void setDetailTable(ITable table) {
+ propertySupport.setProperty(PROP_DETAIL_TABLE, table);
+ }
+
+ @Override
+ public IForm getSearchForm() {
+ return (IForm) propertySupport.getProperty(PROP_SEARCH_FORM);
+ }
+
+ @Override
+ public void setSearchForm(IForm form) {
+ propertySupport.setProperty(PROP_SEARCH_FORM, form);
+ }
+
+ @Override
+ public IPage getRootPage() {
+ return (IPage) getRootNode();
+ }
+
+ @Override
+ public void unloadNode(ITreeNode node) throws ProcessingException {
+ try {
+ setTreeChanging(true);
+ //
+ super.unloadNode(node);
+ if (node instanceof IPageWithTable) {
+ ((IPageWithTable) node).getTable().deleteAllRows();
+ }
+ }
+ finally {
+ setTreeChanging(false);
+ }
+ }
+
+ @Override
+ public void resetOutline() throws ProcessingException {
+ if (getRootNode() != null) {
+ try {
+ setTreeChanging(true);
+ //
+ selectNode(null);
+ unloadNode(getRootNode());
+ getRootNode().ensureChildrenLoaded();
+ }
+ finally {
+ setTreeChanging(false);
+ }
+ ITreeNode root = getRootNode();
+ if (root instanceof IPageWithTable) {
+ ISearchForm searchForm = ((IPageWithTable) root).getSearchFormInternal();
+ if (searchForm != null) {
+ searchForm.doReset();
+ }
+ }
+ if (!isRootNodeVisible()) {
+ root.setExpanded(true);
+ }
+ selectFirstNode();
+ if (getSelectedNode() instanceof IPageWithTable) {
+ getSelectedNode().setExpanded(true);
+ }
+ }
+ }
+
+ @Override
+ public void makeActivePageToContextPage() {
+ IPage activePage = getActivePage();
+ if (activePage != null && m_contextPage != activePage) {
+ m_contextPage = activePage;
+ activePage.pageActivatedNotify();
+ }
+ }
+
+ @Override
+ public void clearContextPage() {
+ IPage page = m_contextPage;
+ if (page != null) {
+ m_contextPage = null;
+ page.pageDeactivatedNotify();
+ }
+ }
+
+ private void handleActivePageChanged(IPage deselectedPage, IPage selectedPage) {
+ if (m_pageChangeStrategy == null) {
+ return;
+ }
+
+ try {
+ if (m_contextPageOptimisticLock.acquire()) {
+ m_pageChangeStrategy.pageChanged(this, deselectedPage, selectedPage);
+ }
+ }
+ finally {
+ m_contextPageOptimisticLock.release();
+ }
+ }
+
+ @Override
+ public OutlineMediator getOutlineMediator() {
+ return m_outlineMediator;
+ }
+
+ protected OutlineMediator createOutlineMediator() {
+ return new OutlineMediator();
+ }
+
+ protected IPageChangeStrategy createPageChangeStrategy() {
+ return new DefaultPageChangeStrategy();
+ }
+
+ @Override
+ public void setPageChangeStrategy(IPageChangeStrategy pageChangeStrategy) {
+ m_pageChangeStrategy = pageChangeStrategy;
+ }
+
+ @Override
+ public IPageChangeStrategy getPageChangeStrategy() {
+ return m_pageChangeStrategy;
+ }
+
+ private class P_OutlineListener extends TreeAdapter {
+ @Override
+ public void treeChanged(TreeEvent e) {
+ switch (e.getType()) {
+ case TreeEvent.TYPE_NODES_SELECTED: {
+ handleActivePageChanged((IPage) e.getDeselectedNode(), (IPage) e.getNewSelectedNode());
+ break;
+ }
+ case TreeEvent.TYPE_NODE_POPUP: {
+ if (e.getNode() instanceof IPageWithTable<?>) {
+ if (getOutlineMediator() != null) {
+ IPageWithTable<? extends ITable> pageWithTable = (IPageWithTable<?>) e.getNode();
+ getOutlineMediator().fetchTableEmptySpaceMenus(e, pageWithTable);
+ }
+ }
+ break;
+ }
+ }
+
+ ITreeNode commonParentNode = e.getCommonParentNode();
+ if (commonParentNode instanceof IPageWithNodes) {
+ handlePageWithNodesTreeEvent(e, (IPageWithNodes) commonParentNode);
+ }
+ else if (commonParentNode instanceof IPageWithTable<?>) {
+ handlePageWithTableTreeEvent(e, (IPageWithTable<?>) commonParentNode);
+ }
+ }
+
+ private void handlePageWithNodesTreeEvent(TreeEvent e, IPageWithNodes pageWithNodes) {
+ OutlineMediator outlineMediator = getOutlineMediator();
+ if (outlineMediator == null) {
+ return;
+ }
+
+ switch (e.getType()) {
+ case TreeEvent.TYPE_CHILD_NODE_ORDER_CHANGED:
+ case TreeEvent.TYPE_NODES_DELETED:
+ case TreeEvent.TYPE_NODES_INSERTED:
+ case TreeEvent.TYPE_NODES_UPDATED: {
+ outlineMediator.mediateTreeNodesChanged(pageWithNodes);
+ break;
+ }
+ }
+ }
+
+ private void handlePageWithTableTreeEvent(TreeEvent e, IPageWithTable<? extends ITable> pageWithTable) {
+ OutlineMediator outlineMediator = getOutlineMediator();
+ if (outlineMediator == null) {
+ return;
+ }
+
+ switch (e.getType()) {
+ case TreeEvent.TYPE_NODE_POPUP: {
+ outlineMediator.fetchTableRowMenus(e, pageWithTable);
+ break;
+ }
+ case TreeEvent.TYPE_NODE_ACTION: {
+ outlineMediator.mediateTreeNodeAction(e, pageWithTable);
+ break;
+ }
+ case TreeEvent.TYPE_NODES_DRAG_REQUEST: {
+ outlineMediator.mediateTreeNodesDragRequest(e, pageWithTable);
+ break;
+ }
+ case TreeEvent.TYPE_NODE_DROP_ACTION: {
+ outlineMediator.mediateTreeNodeDropAction(e, pageWithTable);
+ break;
+ }
+ }
+
+ }
+ }
+
+ private class P_TableFilterBasedTreeNodeFilter implements ITreeNodeFilter {
+ @Override
+ public boolean accept(ITreeNode node, int level) {
+ ITreeNode parentNode = node.getParentNode();
+ if (parentNode != null && !parentNode.isFilterAccepted()) {
+ // hide page if parent page is filtered
+ return false;
+ }
+ if (parentNode instanceof IPageWithTable<?>) {
+ ITableRow tableRow = ((IPageWithTable<?>) parentNode).getTableRowFor(node);
+ return tableRow == null || tableRow.isFilterAccepted();
+ }
+ else if (parentNode instanceof IPageWithNodes) {
+ for (ITreeNode child : parentNode.getChildNodes()) {
+ if (child.equals(node)) {
+ return ((IPageWithNodes) parentNode).isFilterAcceptedForChildNode(node);
+ }
+ }
+ }
+ return true;
+ }
+ }
+
+ private class InvisibleRootPage extends AbstractPageWithNodes {
+ @Override
+ protected void execCreateChildPages(Collection<IPage> pageList) throws ProcessingException {
+ AbstractOutline.this.createChildPagesInternal(pageList);
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/AbstractOutlineButton.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/AbstractOutlineButton.java
index a45d1c026e..fd9ae9e381 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/AbstractOutlineButton.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/AbstractOutlineButton.java
@@ -1,163 +1,163 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.desktop.outline;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.ui.desktop.DesktopEvent;
-import org.eclipse.scout.rt.client.ui.desktop.DesktopListener;
-import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
-import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractButton;
-
-/**
- * An outline button is associated with an {@link IOutline} instance, a click on the
- * button activates the outline on the desktop.
- */
-public abstract class AbstractOutlineButton extends AbstractButton {
- private IOutline m_outline;
-
- public AbstractOutlineButton() {
- this(true);
- }
-
- public AbstractOutlineButton(boolean callInitializer) {
- super(callInitializer);
- }
-
- /**
- * Configuration: an outline button is a toggle button.
- *
- * @return {@code IButton.DISPLAY_STYLE_TOGGLE}
- */
- @ConfigPropertyValue("DISPLAY_STYLE_TOGGLE")
- @Override
- protected int getConfiguredDisplayStyle() {
- return DISPLAY_STYLE_TOGGLE;
- }
-
- /**
- * Configuration: an outline button is not a process button.
- *
- * @return {@code false}
- */
- @Override
- protected boolean getConfiguredProcessButton() {
- return false;
- }
-
- /**
- * Configures the outline associated with this outline button.
- * <p>
- * Subclasses can override this method. Default is {@code null}.
- *
- * @return a type token defining an outline
- * @see IOutline
- */
- @ConfigProperty(ConfigProperty.OUTLINE)
- @ConfigPropertyValue("null")
- protected Class<? extends IOutline> getConfiguredOutline() {
- return null;
- }
-
- /**
- * Initializes this outline button.
- * <p>
- * This implementation does the following:
- * <ul>
- * <li>find an instance of {@code IOutline} on the desktop consistent with the configured outline of this button, this
- * becomes the associated outline instance for this button
- * <li>icon and label for this button are taken from the outline
- * <li>a property change listener is registered with the outline such that this button can react on dynamic changes of
- * its associated outline (label, icon, visible, enabled etc.)
- * </ul>
- *
- * @throws ProcessingException
- * if initialization fails
- */
- @Override
- protected void execInitField() throws ProcessingException {
- final IDesktop desktop = ClientSyncJob.getCurrentSession().getDesktop();
- for (IOutline o : desktop.getAvailableOutlines()) {
- if (o.getClass() == getConfiguredOutline()) {
- m_outline = o;
- break;
- }
- }
- if (m_outline != null) {
- setVisible(m_outline.isVisible());
- setEnabled(m_outline.isEnabled());
- setLabel(m_outline.getTitle());
- setTooltipText(m_outline.getTitle());
- setIconId(m_outline.getIconId());
- setSelected(desktop.getOutline() == m_outline);
- // add selection listener
- desktop.addDesktopListener(
- new DesktopListener() {
- @Override
- public void desktopChanged(DesktopEvent e) {
- switch (e.getType()) {
- case DesktopEvent.TYPE_OUTLINE_CHANGED: {
- setSelected(e.getOutline() == m_outline);
- break;
- }
- }
- }
- }
- );
- // add change listener
- m_outline.addPropertyChangeListener(
- new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent e) {
- String n = e.getPropertyName();
- Object v = e.getNewValue();
- if (n.equals(IOutline.PROP_VISIBLE)) {
- setVisible((Boolean) v);
- }
- else if (n.equals(IOutline.PROP_ENABLED)) {
- setEnabled((Boolean) v);
- }
- else if (n.equals(IOutline.PROP_TITLE)) {
- setLabel((String) v);
- }
- else if (n.equals(IOutline.PROP_ICON_ID)) {
- setIconId((String) v);
- }
- }
- }
- );
- }
- }
-
- /**
- * Activates the outline associated with this outline button (i.e. sets
- * the outline as the active outline on the desktop) if {@code selected} is {@code true}, does nothing otherwise.
- *
- * @param selected
- * the state of the toggle button
- */
- @Override
- protected final void execToggleAction(boolean selected) {
- if (selected) {
- IDesktop desktop = ClientSyncJob.getCurrentSession().getDesktop();
- if (desktop != null) {
- // activate outline
- desktop.setOutline(m_outline);
- }
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.desktop.outline;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.ui.desktop.DesktopEvent;
+import org.eclipse.scout.rt.client.ui.desktop.DesktopListener;
+import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
+import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractButton;
+
+/**
+ * An outline button is associated with an {@link IOutline} instance, a click on the
+ * button activates the outline on the desktop.
+ */
+public abstract class AbstractOutlineButton extends AbstractButton {
+ private IOutline m_outline;
+
+ public AbstractOutlineButton() {
+ this(true);
+ }
+
+ public AbstractOutlineButton(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ /**
+ * Configuration: an outline button is a toggle button.
+ *
+ * @return {@code IButton.DISPLAY_STYLE_TOGGLE}
+ */
+ @ConfigPropertyValue("DISPLAY_STYLE_TOGGLE")
+ @Override
+ protected int getConfiguredDisplayStyle() {
+ return DISPLAY_STYLE_TOGGLE;
+ }
+
+ /**
+ * Configuration: an outline button is not a process button.
+ *
+ * @return {@code false}
+ */
+ @Override
+ protected boolean getConfiguredProcessButton() {
+ return false;
+ }
+
+ /**
+ * Configures the outline associated with this outline button.
+ * <p>
+ * Subclasses can override this method. Default is {@code null}.
+ *
+ * @return a type token defining an outline
+ * @see IOutline
+ */
+ @ConfigProperty(ConfigProperty.OUTLINE)
+ @ConfigPropertyValue("null")
+ protected Class<? extends IOutline> getConfiguredOutline() {
+ return null;
+ }
+
+ /**
+ * Initializes this outline button.
+ * <p>
+ * This implementation does the following:
+ * <ul>
+ * <li>find an instance of {@code IOutline} on the desktop consistent with the configured outline of this button, this
+ * becomes the associated outline instance for this button
+ * <li>icon and label for this button are taken from the outline
+ * <li>a property change listener is registered with the outline such that this button can react on dynamic changes of
+ * its associated outline (label, icon, visible, enabled etc.)
+ * </ul>
+ *
+ * @throws ProcessingException
+ * if initialization fails
+ */
+ @Override
+ protected void execInitField() throws ProcessingException {
+ final IDesktop desktop = ClientSyncJob.getCurrentSession().getDesktop();
+ for (IOutline o : desktop.getAvailableOutlines()) {
+ if (o.getClass() == getConfiguredOutline()) {
+ m_outline = o;
+ break;
+ }
+ }
+ if (m_outline != null) {
+ setVisible(m_outline.isVisible());
+ setEnabled(m_outline.isEnabled());
+ setLabel(m_outline.getTitle());
+ setTooltipText(m_outline.getTitle());
+ setIconId(m_outline.getIconId());
+ setSelected(desktop.getOutline() == m_outline);
+ // add selection listener
+ desktop.addDesktopListener(
+ new DesktopListener() {
+ @Override
+ public void desktopChanged(DesktopEvent e) {
+ switch (e.getType()) {
+ case DesktopEvent.TYPE_OUTLINE_CHANGED: {
+ setSelected(e.getOutline() == m_outline);
+ break;
+ }
+ }
+ }
+ }
+ );
+ // add change listener
+ m_outline.addPropertyChangeListener(
+ new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent e) {
+ String n = e.getPropertyName();
+ Object v = e.getNewValue();
+ if (n.equals(IOutline.PROP_VISIBLE)) {
+ setVisible((Boolean) v);
+ }
+ else if (n.equals(IOutline.PROP_ENABLED)) {
+ setEnabled((Boolean) v);
+ }
+ else if (n.equals(IOutline.PROP_TITLE)) {
+ setLabel((String) v);
+ }
+ else if (n.equals(IOutline.PROP_ICON_ID)) {
+ setIconId((String) v);
+ }
+ }
+ }
+ );
+ }
+ }
+
+ /**
+ * Activates the outline associated with this outline button (i.e. sets
+ * the outline as the active outline on the desktop) if {@code selected} is {@code true}, does nothing otherwise.
+ *
+ * @param selected
+ * the state of the toggle button
+ */
+ @Override
+ protected final void execToggleAction(boolean selected) {
+ if (selected) {
+ IDesktop desktop = ClientSyncJob.getCurrentSession().getDesktop();
+ if (desktop != null) {
+ // activate outline
+ desktop.setOutline(m_outline);
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/AbstractOutlineTableField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/AbstractOutlineTableField.java
index 0c4442b31d..73c8e847a7 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/AbstractOutlineTableField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/AbstractOutlineTableField.java
@@ -1,95 +1,95 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.desktop.outline;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-
-import org.eclipse.scout.commons.annotations.ConfigOperation;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.desktop.DesktopListener;
-import org.eclipse.scout.rt.client.ui.form.fields.tablefield.AbstractTableField;
-
-/**
- * This field can be used to place the default outline table (which changes on
- * every outline tree change) inside a custom form.<br>
- * The default outline table form makes use of this field.
- */
-public abstract class AbstractOutlineTableField extends AbstractTableField<ITable> {
- private DesktopListener m_desktopListener;
- private PropertyChangeListener m_tablePropertyListener;
-
- public AbstractOutlineTableField() {
- this(true);
- }
-
- public AbstractOutlineTableField(boolean callInitializer) {
- super(callInitializer);
- }
-
- @ConfigPropertyValue("false")
- @Override
- protected boolean getConfiguredLabelVisible() {
- return false;
- }
-
- /**
- * called whenever the table title changed
- */
- @ConfigOperation
- @Order(1000)
- protected void execTableTitleChanged() {
- if (getTable() != null) {
- setLabel(getTable().getTitle());
- }
- else {
- setLabel(null);
- }
- }
-
- @Override
- protected void execInitField() throws ProcessingException {
- m_tablePropertyListener = new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent e) {
- if (e.getPropertyName().equals(ITable.PROP_TITLE)) {
- execTableTitleChanged();
- }
- }
- };
- }
-
- @Override
- protected void execDisposeField() throws ProcessingException {
- super.execDisposeField();
- ClientSyncJob.getCurrentSession().getDesktop().removeDesktopListener(m_desktopListener);
- m_desktopListener = null;
- }
-
- public void installTable(ITable table) {
- if (getTable() == table) {
- return;
- }
- //
- if (getTable() != null) {
- getTable().removePropertyChangeListener(m_tablePropertyListener);
- }
- setTable(table, true);
- if (getTable() != null) {
- getTable().addPropertyChangeListener(m_tablePropertyListener);
- }
- execTableTitleChanged();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.desktop.outline;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import org.eclipse.scout.commons.annotations.ConfigOperation;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.desktop.DesktopListener;
+import org.eclipse.scout.rt.client.ui.form.fields.tablefield.AbstractTableField;
+
+/**
+ * This field can be used to place the default outline table (which changes on
+ * every outline tree change) inside a custom form.<br>
+ * The default outline table form makes use of this field.
+ */
+public abstract class AbstractOutlineTableField extends AbstractTableField<ITable> {
+ private DesktopListener m_desktopListener;
+ private PropertyChangeListener m_tablePropertyListener;
+
+ public AbstractOutlineTableField() {
+ this(true);
+ }
+
+ public AbstractOutlineTableField(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ @ConfigPropertyValue("false")
+ @Override
+ protected boolean getConfiguredLabelVisible() {
+ return false;
+ }
+
+ /**
+ * called whenever the table title changed
+ */
+ @ConfigOperation
+ @Order(1000)
+ protected void execTableTitleChanged() {
+ if (getTable() != null) {
+ setLabel(getTable().getTitle());
+ }
+ else {
+ setLabel(null);
+ }
+ }
+
+ @Override
+ protected void execInitField() throws ProcessingException {
+ m_tablePropertyListener = new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent e) {
+ if (e.getPropertyName().equals(ITable.PROP_TITLE)) {
+ execTableTitleChanged();
+ }
+ }
+ };
+ }
+
+ @Override
+ protected void execDisposeField() throws ProcessingException {
+ super.execDisposeField();
+ ClientSyncJob.getCurrentSession().getDesktop().removeDesktopListener(m_desktopListener);
+ m_desktopListener = null;
+ }
+
+ public void installTable(ITable table) {
+ if (getTable() == table) {
+ return;
+ }
+ //
+ if (getTable() != null) {
+ getTable().removePropertyChangeListener(m_tablePropertyListener);
+ }
+ setTable(table, true);
+ if (getTable() != null) {
+ getTable().addPropertyChangeListener(m_tablePropertyListener);
+ }
+ execTableTitleChanged();
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/AbstractOutlineToolButton.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/AbstractOutlineToolButton.java
index 74abfa28dc..345bf1469b 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/AbstractOutlineToolButton.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/AbstractOutlineToolButton.java
@@ -1,28 +1,28 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.desktop.outline;
-
-import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
-
-/**
- * @deprecated use {@link AbstractOutlineViewButton}
- */
-@Deprecated
-public abstract class AbstractOutlineToolButton extends AbstractOutlineViewButton {
-
- /**
- * @param desktop
- * @param outlineType
- */
- public AbstractOutlineToolButton(IDesktop desktop, Class<? extends IOutline> outlineType) {
- super(desktop, outlineType);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.desktop.outline;
+
+import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
+
+/**
+ * @deprecated use {@link AbstractOutlineViewButton}
+ */
+@Deprecated
+public abstract class AbstractOutlineToolButton extends AbstractOutlineViewButton {
+
+ /**
+ * @param desktop
+ * @param outlineType
+ */
+ public AbstractOutlineToolButton(IDesktop desktop, Class<? extends IOutline> outlineType) {
+ super(desktop, outlineType);
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/AbstractOutlineTreeField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/AbstractOutlineTreeField.java
index f828d25d01..e79e9ce100 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/AbstractOutlineTreeField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/AbstractOutlineTreeField.java
@@ -1,91 +1,91 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.desktop.outline;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITree;
-import org.eclipse.scout.rt.client.ui.desktop.DesktopEvent;
-import org.eclipse.scout.rt.client.ui.desktop.DesktopListener;
-import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
-import org.eclipse.scout.rt.client.ui.form.fields.treefield.AbstractTreeField;
-
-public abstract class AbstractOutlineTreeField extends AbstractTreeField {
- private DesktopListener m_desktopListener;
- private PropertyChangeListener m_treePropertyListener;
-
- public AbstractOutlineTreeField() {
- this(true);
- }
-
- public AbstractOutlineTreeField(boolean callInitializer) {
- super(callInitializer);
- }
-
- @ConfigPropertyValue("false")
- @Override
- protected boolean getConfiguredLabelVisible() {
- return false;
- }
-
- @Override
- protected void execInitField() throws ProcessingException {
- m_desktopListener = new DesktopListener() {
- @Override
- public void desktopChanged(DesktopEvent e) {
- switch (e.getType()) {
- case DesktopEvent.TYPE_OUTLINE_CHANGED: {
- installOutline(e.getOutline());
- break;
- }
- }
- }
- };
- m_treePropertyListener = new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent e) {
- if (e.getPropertyName().equals(ITree.PROP_TITLE)) {
- setLabel((String) e.getNewValue());
- }
- }
- };
- //
- IDesktop desktop = ClientSyncJob.getCurrentSession().getDesktop();
- desktop.addDesktopListener(m_desktopListener);
- installOutline(desktop.getOutline());
- }
-
- @Override
- protected void execDisposeField() throws ProcessingException {
- ClientSyncJob.getCurrentSession().getDesktop().removeDesktopListener(m_desktopListener);
- m_desktopListener = null;
- }
-
- private void installOutline(IOutline outline) {
- if (getTree() == outline) {
- return;
- }
- //
- if (getTree() != null) {
- getTree().removePropertyChangeListener(m_treePropertyListener);
- setLabel(null);
- }
- setTree(outline, true);
- if (getTree() != null) {
- getTree().addPropertyChangeListener(m_treePropertyListener);
- setLabel(getTree().getTitle());
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.desktop.outline;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITree;
+import org.eclipse.scout.rt.client.ui.desktop.DesktopEvent;
+import org.eclipse.scout.rt.client.ui.desktop.DesktopListener;
+import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
+import org.eclipse.scout.rt.client.ui.form.fields.treefield.AbstractTreeField;
+
+public abstract class AbstractOutlineTreeField extends AbstractTreeField {
+ private DesktopListener m_desktopListener;
+ private PropertyChangeListener m_treePropertyListener;
+
+ public AbstractOutlineTreeField() {
+ this(true);
+ }
+
+ public AbstractOutlineTreeField(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ @ConfigPropertyValue("false")
+ @Override
+ protected boolean getConfiguredLabelVisible() {
+ return false;
+ }
+
+ @Override
+ protected void execInitField() throws ProcessingException {
+ m_desktopListener = new DesktopListener() {
+ @Override
+ public void desktopChanged(DesktopEvent e) {
+ switch (e.getType()) {
+ case DesktopEvent.TYPE_OUTLINE_CHANGED: {
+ installOutline(e.getOutline());
+ break;
+ }
+ }
+ }
+ };
+ m_treePropertyListener = new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent e) {
+ if (e.getPropertyName().equals(ITree.PROP_TITLE)) {
+ setLabel((String) e.getNewValue());
+ }
+ }
+ };
+ //
+ IDesktop desktop = ClientSyncJob.getCurrentSession().getDesktop();
+ desktop.addDesktopListener(m_desktopListener);
+ installOutline(desktop.getOutline());
+ }
+
+ @Override
+ protected void execDisposeField() throws ProcessingException {
+ ClientSyncJob.getCurrentSession().getDesktop().removeDesktopListener(m_desktopListener);
+ m_desktopListener = null;
+ }
+
+ private void installOutline(IOutline outline) {
+ if (getTree() == outline) {
+ return;
+ }
+ //
+ if (getTree() != null) {
+ getTree().removePropertyChangeListener(m_treePropertyListener);
+ setLabel(null);
+ }
+ setTree(outline, true);
+ if (getTree() != null) {
+ getTree().addPropertyChangeListener(m_treePropertyListener);
+ setLabel(getTree().getTitle());
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/AbstractOutlineViewButton.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/AbstractOutlineViewButton.java
index e7ea4c1384..f5a92a9530 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/AbstractOutlineViewButton.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/AbstractOutlineViewButton.java
@@ -1,146 +1,146 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.desktop.outline;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.action.view.AbstractViewButton;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
-import org.eclipse.scout.rt.client.ui.desktop.AbstractDesktop;
-import org.eclipse.scout.rt.client.ui.desktop.AbstractDesktopExtension;
-import org.eclipse.scout.rt.client.ui.desktop.DesktopEvent;
-import org.eclipse.scout.rt.client.ui.desktop.DesktopListener;
-import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.AbstractPage;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-
-public abstract class AbstractOutlineViewButton extends AbstractViewButton {
-
- private final IDesktop m_desktop;
- private final IOutline m_outline;
-
- /**
- * call using {@link AbstractDesktop}.this or {@link AbstractDesktopExtension#getDelegatingDesktop()}
- */
- public AbstractOutlineViewButton(IDesktop desktop, Class<? extends IOutline> outlineType) {
- super(false);
- m_desktop = desktop;
- IOutline outline = null;
- for (IOutline o : desktop.getAvailableOutlines()) {
- if (o.getClass() == outlineType) {
- outline = o;
- break;
- }
- }
- m_outline = outline;
- if (m_desktop == null) {
- throw new IllegalArgumentException("Desktop can not be null");
- }
- if (m_outline == null) {
- throw new IllegalArgumentException("the outline type " + outlineType.getName() + " is not registered in the desktop");
- }
- callInitializer();
- }
-
- @Override
- protected void execInitAction() {
- setVisible(m_outline.isVisible());
- setEnabled(m_outline.isEnabled());
- setText(m_outline.getTitle());
- setIconId(m_outline.getIconId());
- setSelected(m_desktop.getOutline() == m_outline);
- // add selection listener
- m_desktop.addDesktopListener(
- new DesktopListener() {
- @Override
- public void desktopChanged(DesktopEvent e) {
- switch (e.getType()) {
- case DesktopEvent.TYPE_OUTLINE_CHANGED: {
- setSelected(e.getOutline() == m_outline);
- break;
- }
- }
- }
- }
- );
- // add change listener
- m_outline.addPropertyChangeListener(
- new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent e) {
- String n = e.getPropertyName();
- Object v = e.getNewValue();
- if (n.equals(IOutline.PROP_VISIBLE)) {
- setVisible((Boolean) v);
- }
- else if (n.equals(IOutline.PROP_ENABLED)) {
- setEnabled((Boolean) v);
- }
- else if (n.equals(IOutline.PROP_TITLE)) {
- setText((String) v);
- }
- else if (n.equals(IOutline.PROP_ICON_ID)) {
- setIconId((String) v);
- }
- }
- }
- );
- }
-
- @Override
- protected boolean getConfiguredToggleAction() {
- return true;
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- if (isSelected()) {
- if (m_desktop.getOutline() != null && m_desktop.getOutline() == m_outline) {
- //determine new selection
- ITreeNode newSelectedNode;
- if (m_outline.isRootNodeVisible()) {
- newSelectedNode = m_outline.getRootPage();
- }
- else {
- newSelectedNode = m_outline.getSelectedNode();
- while (newSelectedNode != null && newSelectedNode.getParentNode() != m_outline.getRootPage()) {
- newSelectedNode = newSelectedNode.getParentNode();
- }
- }
- m_outline.selectNode(newSelectedNode);
- // collapse outline
- if (m_outline.isRootNodeVisible()) {
- m_outline.collapseAll(m_outline.getRootPage());
- if (m_outline.getRootPage() instanceof AbstractPage && ((AbstractPage) m_outline.getRootPage()).isInitialExpanded()) {
- m_outline.setNodeExpanded(m_outline.getRootPage(), true);
- }
- }
- else {
- for (IPage root : m_outline.getRootPage().getChildPages()) {
- m_outline.collapseAll(root);
- }
- for (IPage root : m_outline.getRootPage().getChildPages()) {
- if (root instanceof AbstractPage && ((AbstractPage) root).isInitialExpanded()) {
- m_outline.setNodeExpanded(root, true);
- }
- }
- }
- }
- else {
- // activate outline
- m_desktop.setOutline(m_outline);
- }
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.desktop.outline;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.action.view.AbstractViewButton;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
+import org.eclipse.scout.rt.client.ui.desktop.AbstractDesktop;
+import org.eclipse.scout.rt.client.ui.desktop.AbstractDesktopExtension;
+import org.eclipse.scout.rt.client.ui.desktop.DesktopEvent;
+import org.eclipse.scout.rt.client.ui.desktop.DesktopListener;
+import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.AbstractPage;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+
+public abstract class AbstractOutlineViewButton extends AbstractViewButton {
+
+ private final IDesktop m_desktop;
+ private final IOutline m_outline;
+
+ /**
+ * call using {@link AbstractDesktop}.this or {@link AbstractDesktopExtension#getDelegatingDesktop()}
+ */
+ public AbstractOutlineViewButton(IDesktop desktop, Class<? extends IOutline> outlineType) {
+ super(false);
+ m_desktop = desktop;
+ IOutline outline = null;
+ for (IOutline o : desktop.getAvailableOutlines()) {
+ if (o.getClass() == outlineType) {
+ outline = o;
+ break;
+ }
+ }
+ m_outline = outline;
+ if (m_desktop == null) {
+ throw new IllegalArgumentException("Desktop can not be null");
+ }
+ if (m_outline == null) {
+ throw new IllegalArgumentException("the outline type " + outlineType.getName() + " is not registered in the desktop");
+ }
+ callInitializer();
+ }
+
+ @Override
+ protected void execInitAction() {
+ setVisible(m_outline.isVisible());
+ setEnabled(m_outline.isEnabled());
+ setText(m_outline.getTitle());
+ setIconId(m_outline.getIconId());
+ setSelected(m_desktop.getOutline() == m_outline);
+ // add selection listener
+ m_desktop.addDesktopListener(
+ new DesktopListener() {
+ @Override
+ public void desktopChanged(DesktopEvent e) {
+ switch (e.getType()) {
+ case DesktopEvent.TYPE_OUTLINE_CHANGED: {
+ setSelected(e.getOutline() == m_outline);
+ break;
+ }
+ }
+ }
+ }
+ );
+ // add change listener
+ m_outline.addPropertyChangeListener(
+ new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent e) {
+ String n = e.getPropertyName();
+ Object v = e.getNewValue();
+ if (n.equals(IOutline.PROP_VISIBLE)) {
+ setVisible((Boolean) v);
+ }
+ else if (n.equals(IOutline.PROP_ENABLED)) {
+ setEnabled((Boolean) v);
+ }
+ else if (n.equals(IOutline.PROP_TITLE)) {
+ setText((String) v);
+ }
+ else if (n.equals(IOutline.PROP_ICON_ID)) {
+ setIconId((String) v);
+ }
+ }
+ }
+ );
+ }
+
+ @Override
+ protected boolean getConfiguredToggleAction() {
+ return true;
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ if (isSelected()) {
+ if (m_desktop.getOutline() != null && m_desktop.getOutline() == m_outline) {
+ //determine new selection
+ ITreeNode newSelectedNode;
+ if (m_outline.isRootNodeVisible()) {
+ newSelectedNode = m_outline.getRootPage();
+ }
+ else {
+ newSelectedNode = m_outline.getSelectedNode();
+ while (newSelectedNode != null && newSelectedNode.getParentNode() != m_outline.getRootPage()) {
+ newSelectedNode = newSelectedNode.getParentNode();
+ }
+ }
+ m_outline.selectNode(newSelectedNode);
+ // collapse outline
+ if (m_outline.isRootNodeVisible()) {
+ m_outline.collapseAll(m_outline.getRootPage());
+ if (m_outline.getRootPage() instanceof AbstractPage && ((AbstractPage) m_outline.getRootPage()).isInitialExpanded()) {
+ m_outline.setNodeExpanded(m_outline.getRootPage(), true);
+ }
+ }
+ else {
+ for (IPage root : m_outline.getRootPage().getChildPages()) {
+ m_outline.collapseAll(root);
+ }
+ for (IPage root : m_outline.getRootPage().getChildPages()) {
+ if (root instanceof AbstractPage && ((AbstractPage) root).isInitialExpanded()) {
+ m_outline.setNodeExpanded(root, true);
+ }
+ }
+ }
+ }
+ else {
+ // activate outline
+ m_desktop.setOutline(m_outline);
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/DefaultPageChangeStrategy.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/DefaultPageChangeStrategy.java
index 7b1b8a3cdd..f4d4923a60 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/DefaultPageChangeStrategy.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/DefaultPageChangeStrategy.java
@@ -1,89 +1,89 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.desktop.outline;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithNodes;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.ISearchForm;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
-import org.eclipse.scout.service.SERVICES;
-
-/**
- * @since 3.8.1
- */
-public class DefaultPageChangeStrategy implements IPageChangeStrategy {
-
- @Override
- public void pageChanged(IOutline outline, IPage deselectedPage, IPage selectedPage) {
- if (outline == null) {
- return;
- }
-
- outline.clearContextPage();
- IForm detailForm = null;
- ITable detailTable = null;
- ISearchForm searchForm = null;
- // new active page
- outline.makeActivePageToContextPage();
- IPage activePage = outline.getActivePage();
- if (activePage != null) {
- try {
- activePage.ensureChildrenLoaded();
- }
- catch (ProcessingException e1) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(e1);
- }
- if (activePage instanceof IPageWithTable) {
- IPageWithTable tablePage = (IPageWithTable) activePage;
- detailForm = activePage.getDetailForm();
- if (activePage.isTableVisible()) {
- detailTable = tablePage.getTable();
- }
- if (tablePage.isSearchActive()) {
- searchForm = tablePage.getSearchFormInternal();
- }
- }
- else if (activePage instanceof IPageWithNodes) {
- IPageWithNodes nodePage = (IPageWithNodes) activePage;
- detailForm = activePage.getDetailForm();
- if (activePage.isTableVisible()) {
- detailTable = nodePage.getInternalTable();
- }
- }
- }
-
- // remove first
- if (detailForm == null) {
- outline.setDetailForm(null);
- }
- if (detailTable == null) {
- outline.setDetailTable(null);
- }
- if (searchForm == null) {
- outline.setSearchForm(null);
- }
- // add new
- if (detailForm != null) {
- outline.setDetailForm(detailForm);
- }
- if (detailTable != null) {
- outline.setDetailTable(detailTable);
- }
- if (searchForm != null) {
- outline.setSearchForm(searchForm);
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.desktop.outline;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithNodes;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.ISearchForm;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
+import org.eclipse.scout.service.SERVICES;
+
+/**
+ * @since 3.8.1
+ */
+public class DefaultPageChangeStrategy implements IPageChangeStrategy {
+
+ @Override
+ public void pageChanged(IOutline outline, IPage deselectedPage, IPage selectedPage) {
+ if (outline == null) {
+ return;
+ }
+
+ outline.clearContextPage();
+ IForm detailForm = null;
+ ITable detailTable = null;
+ ISearchForm searchForm = null;
+ // new active page
+ outline.makeActivePageToContextPage();
+ IPage activePage = outline.getActivePage();
+ if (activePage != null) {
+ try {
+ activePage.ensureChildrenLoaded();
+ }
+ catch (ProcessingException e1) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e1);
+ }
+ if (activePage instanceof IPageWithTable) {
+ IPageWithTable tablePage = (IPageWithTable) activePage;
+ detailForm = activePage.getDetailForm();
+ if (activePage.isTableVisible()) {
+ detailTable = tablePage.getTable();
+ }
+ if (tablePage.isSearchActive()) {
+ searchForm = tablePage.getSearchFormInternal();
+ }
+ }
+ else if (activePage instanceof IPageWithNodes) {
+ IPageWithNodes nodePage = (IPageWithNodes) activePage;
+ detailForm = activePage.getDetailForm();
+ if (activePage.isTableVisible()) {
+ detailTable = nodePage.getInternalTable();
+ }
+ }
+ }
+
+ // remove first
+ if (detailForm == null) {
+ outline.setDetailForm(null);
+ }
+ if (detailTable == null) {
+ outline.setDetailTable(null);
+ }
+ if (searchForm == null) {
+ outline.setSearchForm(null);
+ }
+ // add new
+ if (detailForm != null) {
+ outline.setDetailForm(detailForm);
+ }
+ if (detailTable != null) {
+ outline.setDetailTable(detailTable);
+ }
+ if (searchForm != null) {
+ outline.setSearchForm(searchForm);
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/IFormToolButton.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/IFormToolButton.java
index c9f373f87b..d5bd3cabe4 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/IFormToolButton.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/IFormToolButton.java
@@ -1,37 +1,37 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.desktop.outline;
-
-import org.eclipse.scout.rt.client.ui.action.tool.IToolButton;
-
-/**
- * @since 3.8.1
- */
-public interface IFormToolButton<FORM> extends IToolButton {
- FORM getForm();
-
- /**
- * Set a new <b>started</b> form to the tool.
- * <p>
- * The form is shown whenever the tool button is activated.
- */
- void setForm(FORM f);
-
- /**
- * Set a new <b>started</b> form to the tool.
- * <p>
- * The form is shown whenever the tool button is activated.
- *
- * @param force
- * set 'f' as the new form, event when it is equal to the old form
- */
- void setForm(FORM f, boolean force);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.desktop.outline;
+
+import org.eclipse.scout.rt.client.ui.action.tool.IToolButton;
+
+/**
+ * @since 3.8.1
+ */
+public interface IFormToolButton<FORM> extends IToolButton {
+ FORM getForm();
+
+ /**
+ * Set a new <b>started</b> form to the tool.
+ * <p>
+ * The form is shown whenever the tool button is activated.
+ */
+ void setForm(FORM f);
+
+ /**
+ * Set a new <b>started</b> form to the tool.
+ * <p>
+ * The form is shown whenever the tool button is activated.
+ *
+ * @param force
+ * set 'f' as the new form, event when it is equal to the old form
+ */
+ void setForm(FORM f, boolean force);
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/IOutline.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/IOutline.java
index 82ffef2984..6c70e120b8 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/IOutline.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/IOutline.java
@@ -1,123 +1,123 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.desktop.outline;
-
-import java.security.Permission;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITree;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-
-public interface IOutline extends ITree {
-
- /**
- * {@link Boolean}
- */
- String PROP_ENABLED = "enabled";
-
- /**
- * {@link Boolean}
- */
- String PROP_VISIBLE = "visible";
-
- /**
- * {@link IForm}
- */
- String PROP_DETAIL_FORM = "detailForm";
-
- /**
- * {@link ITable}
- */
- String PROP_DETAIL_TABLE = "detailTable";
-
- /**
- * {@link IForm}
- */
- String PROP_SEARCH_FORM = "searchForm";
-
- /**
- * alias to {@link ITree#getSelectedNode()}
- */
- IPage getActivePage();
-
- void makeActivePageToContextPage();
-
- void clearContextPage();
-
- /**
- * Find a specific page by its type in the outline tree
- *
- * @return the first found occurrence of the page
- */
- <T extends IPage> T findPage(final Class<T> pageType);
-
- /**
- * Call this method to refresh all existing pages in this outline<br>
- * If currently active page(s) are affected they reload their data, otherwise
- * the pages is simply marked dirty and reloaded on next activation
- */
- void refreshPages(Class... pageTypes);
-
- /**
- * Unload and release unused pages, such as closed and non-selected nodes
- */
- void releaseUnusedPages();
-
- /**
- * Reset outline as it would have been started again from scratch
- */
- void resetOutline() throws ProcessingException;
-
- boolean isVisible();
-
- void setVisible(boolean b);
-
- boolean isVisibleGranted();
-
- void setVisibleGranted(boolean b);
-
- void setVisiblePermission(Permission p);
-
- /**
- * @return the detail form of the active (selected) page {@link IPage#getDetailForm()}
- */
- IForm getDetailForm();
-
- void setDetailForm(IForm form);
-
- /**
- * @return the detail table of the active (selected) page {@link IPage#getTable()}
- */
- ITable getDetailTable();
-
- void setDetailTable(ITable table);
-
- /**
- * @return the search form of the active (selected) page {@link IPageWithTable#getSearchFormInternal()}
- */
- IForm getSearchForm();
-
- void setSearchForm(IForm form);
-
- /**
- * Convenience for (IPage)getRootNode()
- */
- IPage getRootPage();
-
- OutlineMediator getOutlineMediator();
-
- void setPageChangeStrategy(IPageChangeStrategy pageChangeStrategy);
-
- IPageChangeStrategy getPageChangeStrategy();
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.desktop.outline;
+
+import java.security.Permission;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITree;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+
+public interface IOutline extends ITree {
+
+ /**
+ * {@link Boolean}
+ */
+ String PROP_ENABLED = "enabled";
+
+ /**
+ * {@link Boolean}
+ */
+ String PROP_VISIBLE = "visible";
+
+ /**
+ * {@link IForm}
+ */
+ String PROP_DETAIL_FORM = "detailForm";
+
+ /**
+ * {@link ITable}
+ */
+ String PROP_DETAIL_TABLE = "detailTable";
+
+ /**
+ * {@link IForm}
+ */
+ String PROP_SEARCH_FORM = "searchForm";
+
+ /**
+ * alias to {@link ITree#getSelectedNode()}
+ */
+ IPage getActivePage();
+
+ void makeActivePageToContextPage();
+
+ void clearContextPage();
+
+ /**
+ * Find a specific page by its type in the outline tree
+ *
+ * @return the first found occurrence of the page
+ */
+ <T extends IPage> T findPage(final Class<T> pageType);
+
+ /**
+ * Call this method to refresh all existing pages in this outline<br>
+ * If currently active page(s) are affected they reload their data, otherwise
+ * the pages is simply marked dirty and reloaded on next activation
+ */
+ void refreshPages(Class... pageTypes);
+
+ /**
+ * Unload and release unused pages, such as closed and non-selected nodes
+ */
+ void releaseUnusedPages();
+
+ /**
+ * Reset outline as it would have been started again from scratch
+ */
+ void resetOutline() throws ProcessingException;
+
+ boolean isVisible();
+
+ void setVisible(boolean b);
+
+ boolean isVisibleGranted();
+
+ void setVisibleGranted(boolean b);
+
+ void setVisiblePermission(Permission p);
+
+ /**
+ * @return the detail form of the active (selected) page {@link IPage#getDetailForm()}
+ */
+ IForm getDetailForm();
+
+ void setDetailForm(IForm form);
+
+ /**
+ * @return the detail table of the active (selected) page {@link IPage#getTable()}
+ */
+ ITable getDetailTable();
+
+ void setDetailTable(ITable table);
+
+ /**
+ * @return the search form of the active (selected) page {@link IPageWithTable#getSearchFormInternal()}
+ */
+ IForm getSearchForm();
+
+ void setSearchForm(IForm form);
+
+ /**
+ * Convenience for (IPage)getRootNode()
+ */
+ IPage getRootPage();
+
+ OutlineMediator getOutlineMediator();
+
+ void setPageChangeStrategy(IPageChangeStrategy pageChangeStrategy);
+
+ IPageChangeStrategy getPageChangeStrategy();
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/IOutlineTableForm.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/IOutlineTableForm.java
index 6407eb462a..ff5ae2d17c 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/IOutlineTableForm.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/IOutlineTableForm.java
@@ -1,27 +1,27 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.desktop.outline;
-
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-
-/**
- * Interface for all outline table forms<br>
- * Is used at AbstractDesktop.P_UIFacade.firePreDesktopClosingFromUI() to
- * prevent Outlines to be closed.
- */
-public interface IOutlineTableForm extends IForm {
-
- void setCurrentTable(ITable table);
-
- ITable getCurrentTable();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.desktop.outline;
+
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+
+/**
+ * Interface for all outline table forms<br>
+ * Is used at AbstractDesktop.P_UIFacade.firePreDesktopClosingFromUI() to
+ * prevent Outlines to be closed.
+ */
+public interface IOutlineTableForm extends IForm {
+
+ void setCurrentTable(ITable table);
+
+ ITable getCurrentTable();
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/IOutlineTreeForm.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/IOutlineTreeForm.java
index 0307e3144d..847d09b551 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/IOutlineTreeForm.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/IOutlineTreeForm.java
@@ -1,22 +1,22 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.desktop.outline;
-
-import org.eclipse.scout.rt.client.ui.form.IForm;
-
-/**
- * Marker interface for all outline tree forms<br>
- * Is used at AbstractDesktop.P_UIFacade.firePreDesktopClosingFromUI() to
- * prevent Outlines to be closed.
- */
-public interface IOutlineTreeForm extends IForm {
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.desktop.outline;
+
+import org.eclipse.scout.rt.client.ui.form.IForm;
+
+/**
+ * Marker interface for all outline tree forms<br>
+ * Is used at AbstractDesktop.P_UIFacade.firePreDesktopClosingFromUI() to
+ * prevent Outlines to be closed.
+ */
+public interface IOutlineTreeForm extends IForm {
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/IPageChangeStrategy.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/IPageChangeStrategy.java
index bf7cb1ac98..f15030773c 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/IPageChangeStrategy.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/IPageChangeStrategy.java
@@ -1,21 +1,21 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.desktop.outline;
-
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-
-/**
- * @since 3.8.1
- */
-public interface IPageChangeStrategy {
- void pageChanged(IOutline outline, IPage deselectedPage, IPage selectedPage);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.desktop.outline;
+
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+
+/**
+ * @since 3.8.1
+ */
+public interface IPageChangeStrategy {
+ void pageChanged(IOutline outline, IPage deselectedPage, IPage selectedPage);
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/ISearchFormToolButton.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/ISearchFormToolButton.java
index de50ec55b9..59cfb8ca48 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/ISearchFormToolButton.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/ISearchFormToolButton.java
@@ -1,19 +1,19 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.desktop.outline;
-
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.ISearchForm;
-
-/**
- * @since 3.8.1
- */
-public interface ISearchFormToolButton<FORM extends ISearchForm> extends IFormToolButton<FORM> {
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.desktop.outline;
+
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.ISearchForm;
+
+/**
+ * @since 3.8.1
+ */
+public interface ISearchFormToolButton<FORM extends ISearchForm> extends IFormToolButton<FORM> {
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/OutlineMediator.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/OutlineMediator.java
index d49bf7ae45..e51d06ed39 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/OutlineMediator.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/OutlineMediator.java
@@ -1,198 +1,198 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.desktop.outline;
-
-import org.eclipse.scout.commons.dnd.TransferObject;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.client.ui.basic.table.TableEvent;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
-import org.eclipse.scout.rt.client.ui.basic.tree.TreeEvent;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithNodes;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
-import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
-import org.eclipse.scout.service.SERVICES;
-
-/**
- * @since 3.8.0
- */
-public class OutlineMediator {
-
- public void mediateTreeNodesChanged(IPageWithNodes pageWithNodes) {
- try {
- pageWithNodes.rebuildTableInternal();
- }
- catch (ProcessingException e1) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(e1);
- }
- }
-
- public void mediateTreeNodeDropAction(TreeEvent e, IPageWithTable<? extends ITable> pageWithTable) {
- ITableRow row = pageWithTable.getTableRowFor(e.getNode());
- ITable table = pageWithTable.getTable();
- if (row != null) {
- table.getUIFacade().fireRowDropActionFromUI(row, e.getDropObject());
- }
- }
-
- public void mediateTreeNodesDragRequest(TreeEvent e, IPageWithTable<? extends ITable> pageWithTable) {
- ITableRow[] rows = pageWithTable.getTableRowsFor(e.getNodes());
- ITable table = pageWithTable.getTable();
- table.getUIFacade().setSelectedRowsFromUI(rows);
- TransferObject t = table.getUIFacade().fireRowsDragRequestFromUI();
- if (t != null) {
- e.setDragObject(t);
- }
- }
-
- public void mediateTreeNodeAction(TreeEvent e, IPageWithTable<? extends ITable> pageWithTable) {
- if (e.isConsumed()) {
- return;
- }
-
- ITableRow row = pageWithTable.getTableRowFor(e.getNode());
- ITable table = pageWithTable.getTable();
- if (row != null) {
- e.consume();
- /*
- * ticket 78684: this line added
- */
- table.getUIFacade().setSelectedRowsFromUI(new ITableRow[]{row});
- table.getUIFacade().fireRowActionFromUI(row);
- }
- }
-
- public void fetchTableRowMenus(TreeEvent e, IPageWithTable<? extends ITable> pageWithTable) {
- if (!pageWithTable.isShowTableRowMenus()) {
- return;
- }
-
- ITableRow row = pageWithTable.getTableRowFor(e.getNode());
- ITable table = pageWithTable.getTable();
- if (row != null) {
- table.getUIFacade().setSelectedRowsFromUI(new ITableRow[]{row});
- IMenu[] menus = table.getUIFacade().fireRowPopupFromUI();
- if (menus != null) {
- e.addPopupMenus(menus);
- }
- }
- }
-
- public void fetchTableEmptySpaceMenus(TreeEvent e, IPageWithTable<? extends ITable> pageWithTable) {
- ITable table = pageWithTable.getTable();
- if (!pageWithTable.isShowEmptySpaceMenus()) {
- return;
- }
-
- IMenu[] menus = table.getUIFacade().fireEmptySpacePopupFromUI();
- if (menus != null) {
- e.addPopupMenus(menus);
- }
- }
-
- public void mediateTableRowFilterChanged(IPage page) {
- if (page == null || page.getTree() == null || page.isLeaf()) {
- return;
- }
-
- page.getTree().applyNodeFilters();
- }
-
- public void mediateTableRowOrderChanged(TableEvent e, IPageWithTable pageWithTable) {
- if (pageWithTable == null || pageWithTable.getTree() == null || pageWithTable.isLeaf()) {
- return;
- }
-
- IPage[] childNodes = pageWithTable.getUpdatedChildPagesFor(e.getRows());
- if (pageWithTable.getTree() != null) {
- pageWithTable.getTree().updateChildNodeOrder(pageWithTable, childNodes);
- }
- }
-
- public void mediateTableRowsUpdated(TableEvent e, IPageWithTable pageWithTable) {
- if (pageWithTable == null || pageWithTable.getTree() == null || pageWithTable.isLeaf()) {
- return;
- }
-
- IPage[] childNodes = pageWithTable.getUpdatedChildPagesFor(e.getRows());
- if (pageWithTable.getTree() != null) {
- pageWithTable.getTree().updateChildNodes(pageWithTable, childNodes);
- }
- }
-
- public void mediateTableRowsInserted(ITableRow[] tableRows, IPage[] childPages, IPageWithTable pageWithTable) {
- if (pageWithTable == null || pageWithTable.getTree() == null || pageWithTable.isLeaf()) {
- return;
- }
-
- pageWithTable.getTree().addChildNodes(pageWithTable, childPages);
- }
-
- public void mediateTableRowsDeleted(IPage[] childNodes, IPageWithTable pageWithTable) {
- if (pageWithTable == null || pageWithTable.getTree() == null || pageWithTable.isLeaf()) {
- return;
- }
-
- pageWithTable.getTree().removeChildNodes(pageWithTable, childNodes);
- }
-
- public void mediateTableRowAction(TableEvent e, IPage page) {
- if (e.isConsumed()) {
- return;
- }
-
- ITreeNode node = null;
- if (page instanceof IPageWithNodes) {
- node = ((IPageWithNodes) page).getTreeNodeFor(e.getFirstRow());
- }
- else if (page instanceof IPageWithTable<?>) {
- node = ((IPageWithTable<?>) page).getTreeNodeFor(e.getFirstRow());
- }
-
- if (node != null) {
- e.consume();
- if (page.getTree() != null) {
- page.getTree().getUIFacade().setNodeSelectedAndExpandedFromUI(node);
- }
- }
- }
-
- public void mediateTableRowDropAction(TableEvent e, IPageWithNodes pageWithNodes) {
- if (pageWithNodes == null || pageWithNodes.getTree() == null) {
- return;
- }
-
- ITreeNode node = pageWithNodes.getTreeNodeFor(e.getFirstRow());
- if (node != null) {
- pageWithNodes.getTree().getUIFacade().fireNodeDropActionFromUI(node, e.getDropObject());
- }
- }
-
- public void mediateTableRowPopup(TableEvent e, IPageWithNodes pageWithNodes) {
- ITreeNode node = pageWithNodes.getTreeNodeFor(e.getFirstRow());
- if (node instanceof IPageWithTable<?>) {
- IPageWithTable<?> tablePage = (IPageWithTable<?>) node;
- IMenu[] menus = tablePage.getTable().fetchMenusForRowsInternal(new ITableRow[0]);
- if (menus != null) {
- e.addPopupMenus(menus);
- }
- }
- else if (node instanceof IPageWithNodes) {
- IMenu[] menus = pageWithNodes.getTree().fetchMenusForNodesInternal(new ITreeNode[]{node});
- if (menus != null) {
- e.addPopupMenus(menus);
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.desktop.outline;
+
+import org.eclipse.scout.commons.dnd.TransferObject;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.client.ui.basic.table.TableEvent;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
+import org.eclipse.scout.rt.client.ui.basic.tree.TreeEvent;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithNodes;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
+import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
+import org.eclipse.scout.service.SERVICES;
+
+/**
+ * @since 3.8.0
+ */
+public class OutlineMediator {
+
+ public void mediateTreeNodesChanged(IPageWithNodes pageWithNodes) {
+ try {
+ pageWithNodes.rebuildTableInternal();
+ }
+ catch (ProcessingException e1) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e1);
+ }
+ }
+
+ public void mediateTreeNodeDropAction(TreeEvent e, IPageWithTable<? extends ITable> pageWithTable) {
+ ITableRow row = pageWithTable.getTableRowFor(e.getNode());
+ ITable table = pageWithTable.getTable();
+ if (row != null) {
+ table.getUIFacade().fireRowDropActionFromUI(row, e.getDropObject());
+ }
+ }
+
+ public void mediateTreeNodesDragRequest(TreeEvent e, IPageWithTable<? extends ITable> pageWithTable) {
+ ITableRow[] rows = pageWithTable.getTableRowsFor(e.getNodes());
+ ITable table = pageWithTable.getTable();
+ table.getUIFacade().setSelectedRowsFromUI(rows);
+ TransferObject t = table.getUIFacade().fireRowsDragRequestFromUI();
+ if (t != null) {
+ e.setDragObject(t);
+ }
+ }
+
+ public void mediateTreeNodeAction(TreeEvent e, IPageWithTable<? extends ITable> pageWithTable) {
+ if (e.isConsumed()) {
+ return;
+ }
+
+ ITableRow row = pageWithTable.getTableRowFor(e.getNode());
+ ITable table = pageWithTable.getTable();
+ if (row != null) {
+ e.consume();
+ /*
+ * ticket 78684: this line added
+ */
+ table.getUIFacade().setSelectedRowsFromUI(new ITableRow[]{row});
+ table.getUIFacade().fireRowActionFromUI(row);
+ }
+ }
+
+ public void fetchTableRowMenus(TreeEvent e, IPageWithTable<? extends ITable> pageWithTable) {
+ if (!pageWithTable.isShowTableRowMenus()) {
+ return;
+ }
+
+ ITableRow row = pageWithTable.getTableRowFor(e.getNode());
+ ITable table = pageWithTable.getTable();
+ if (row != null) {
+ table.getUIFacade().setSelectedRowsFromUI(new ITableRow[]{row});
+ IMenu[] menus = table.getUIFacade().fireRowPopupFromUI();
+ if (menus != null) {
+ e.addPopupMenus(menus);
+ }
+ }
+ }
+
+ public void fetchTableEmptySpaceMenus(TreeEvent e, IPageWithTable<? extends ITable> pageWithTable) {
+ ITable table = pageWithTable.getTable();
+ if (!pageWithTable.isShowEmptySpaceMenus()) {
+ return;
+ }
+
+ IMenu[] menus = table.getUIFacade().fireEmptySpacePopupFromUI();
+ if (menus != null) {
+ e.addPopupMenus(menus);
+ }
+ }
+
+ public void mediateTableRowFilterChanged(IPage page) {
+ if (page == null || page.getTree() == null || page.isLeaf()) {
+ return;
+ }
+
+ page.getTree().applyNodeFilters();
+ }
+
+ public void mediateTableRowOrderChanged(TableEvent e, IPageWithTable pageWithTable) {
+ if (pageWithTable == null || pageWithTable.getTree() == null || pageWithTable.isLeaf()) {
+ return;
+ }
+
+ IPage[] childNodes = pageWithTable.getUpdatedChildPagesFor(e.getRows());
+ if (pageWithTable.getTree() != null) {
+ pageWithTable.getTree().updateChildNodeOrder(pageWithTable, childNodes);
+ }
+ }
+
+ public void mediateTableRowsUpdated(TableEvent e, IPageWithTable pageWithTable) {
+ if (pageWithTable == null || pageWithTable.getTree() == null || pageWithTable.isLeaf()) {
+ return;
+ }
+
+ IPage[] childNodes = pageWithTable.getUpdatedChildPagesFor(e.getRows());
+ if (pageWithTable.getTree() != null) {
+ pageWithTable.getTree().updateChildNodes(pageWithTable, childNodes);
+ }
+ }
+
+ public void mediateTableRowsInserted(ITableRow[] tableRows, IPage[] childPages, IPageWithTable pageWithTable) {
+ if (pageWithTable == null || pageWithTable.getTree() == null || pageWithTable.isLeaf()) {
+ return;
+ }
+
+ pageWithTable.getTree().addChildNodes(pageWithTable, childPages);
+ }
+
+ public void mediateTableRowsDeleted(IPage[] childNodes, IPageWithTable pageWithTable) {
+ if (pageWithTable == null || pageWithTable.getTree() == null || pageWithTable.isLeaf()) {
+ return;
+ }
+
+ pageWithTable.getTree().removeChildNodes(pageWithTable, childNodes);
+ }
+
+ public void mediateTableRowAction(TableEvent e, IPage page) {
+ if (e.isConsumed()) {
+ return;
+ }
+
+ ITreeNode node = null;
+ if (page instanceof IPageWithNodes) {
+ node = ((IPageWithNodes) page).getTreeNodeFor(e.getFirstRow());
+ }
+ else if (page instanceof IPageWithTable<?>) {
+ node = ((IPageWithTable<?>) page).getTreeNodeFor(e.getFirstRow());
+ }
+
+ if (node != null) {
+ e.consume();
+ if (page.getTree() != null) {
+ page.getTree().getUIFacade().setNodeSelectedAndExpandedFromUI(node);
+ }
+ }
+ }
+
+ public void mediateTableRowDropAction(TableEvent e, IPageWithNodes pageWithNodes) {
+ if (pageWithNodes == null || pageWithNodes.getTree() == null) {
+ return;
+ }
+
+ ITreeNode node = pageWithNodes.getTreeNodeFor(e.getFirstRow());
+ if (node != null) {
+ pageWithNodes.getTree().getUIFacade().fireNodeDropActionFromUI(node, e.getDropObject());
+ }
+ }
+
+ public void mediateTableRowPopup(TableEvent e, IPageWithNodes pageWithNodes) {
+ ITreeNode node = pageWithNodes.getTreeNodeFor(e.getFirstRow());
+ if (node instanceof IPageWithTable<?>) {
+ IPageWithTable<?> tablePage = (IPageWithTable<?>) node;
+ IMenu[] menus = tablePage.getTable().fetchMenusForRowsInternal(new ITableRow[0]);
+ if (menus != null) {
+ e.addPopupMenus(menus);
+ }
+ }
+ else if (node instanceof IPageWithNodes) {
+ IMenu[] menus = pageWithNodes.getTree().fetchMenusForNodesInternal(new ITreeNode[]{node});
+ if (menus != null) {
+ e.addPopupMenus(menus);
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/pages/AbstractPage.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/pages/AbstractPage.java
index c6beb2373b..daff594d5b 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/pages/AbstractPage.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/pages/AbstractPage.java
@@ -1,582 +1,582 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.desktop.outline.pages;
-
-import java.util.Arrays;
-import java.util.HashSet;
-
-import org.eclipse.scout.commons.annotations.ConfigOperation;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.IProcessingStatus;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.IMemoryPolicy;
-import org.eclipse.scout.rt.client.services.common.icon.IIconProviderService;
-import org.eclipse.scout.rt.client.ui.DataChangeListener;
-import org.eclipse.scout.rt.client.ui.WeakDataChangeListener;
-import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
-import org.eclipse.scout.rt.client.ui.basic.tree.AbstractTreeNode;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITree;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
-import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.shared.ContextMap;
-import org.eclipse.scout.rt.shared.services.common.bookmark.Bookmark;
-import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
-import org.eclipse.scout.service.SERVICES;
-
-public abstract class AbstractPage extends AbstractTreeNode implements IPage {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractPage.class);
-
- private IForm m_detailForm;
- private final ContextMap m_contextMap;
- private boolean m_tableVisible;
- private DataChangeListener m_internalDataChangeListener;
- private final String m_userPreferenceContext;
- private IProcessingStatus m_pagePopulateStatus;
-
- /**
- * use this static method to create a string based on the vargs that can be used as userPreferenceContext
- */
- public static String createUserPreferenceContext(Object... vargs) {
- StringBuffer buf = new StringBuffer();
- if (vargs != null) {
- for (Object o : vargs) {
- if (buf.length() > 0) {
- buf.append(",");
- }
- if (o == null) {
- buf.append("null");
- }
- else if (o instanceof Object[]) {
- buf.append(Arrays.toString((Object[]) o));
- }
- else {
- buf.append(o.toString());
- }
- }
- }
- return buf.toString();
- }
-
- public AbstractPage() {
- this(true);
- }
-
- public AbstractPage(String userPreferenceContext) {
- this(true, null, userPreferenceContext);
- }
-
- public AbstractPage(boolean callInitializer) {
- this(callInitializer, null, null);
- }
-
- public AbstractPage(ContextMap contextMap) {
- this(true, contextMap, null);
- }
-
- public AbstractPage(boolean callInitializer, String userPreferenceContext) {
- this(callInitializer, null, userPreferenceContext);
- }
-
- public AbstractPage(boolean callInitializer, ContextMap contextMap) {
- this(callInitializer, contextMap, null);
- }
-
- public AbstractPage(boolean callInitializer, ContextMap contextMap, String userPreferenceContext) {
- super(false);
- m_contextMap = contextMap;
- m_userPreferenceContext = userPreferenceContext;
- if (callInitializer) {
- callInitializer();
- }
- }
-
- /*
- * Configuration
- */
-
- /**
- * Configures the visibility of this page's table. Typical subclasses of this abstract class use a tabular
- * structure to display data, this includes {@link AbstractPageWithTable} as well as {@link AbstractPageWithNodes}.
- * Set this property to {@code false} if you want to display a detail form within this page.
- * <p>
- * Subclasses can override this method. Default is {@code true}.
- *
- * @return {@code true} if this page's table is visible, {@code false} otherwise
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(35)
- @ConfigPropertyValue("true")
- protected boolean getConfiguredTableVisible() {
- return true;
- }
-
- /**
- * Configures the title of this page. The title is typically displayed on the GUI, e.g. as part of the representation
- * of this page as a tree node.
- * <p>
- * Subclasses can override this method. Default is {@code null}.
- *
- * @return the title for this page
- */
- @ConfigProperty(ConfigProperty.TEXT)
- @Order(40)
- @ConfigPropertyValue("null")
- protected String getConfiguredTitle() {
- return null;
- }
-
- /**
- * Configures the icon for this page. The icon is typically used to represent this page in the GUI, e.g. as part of
- * the representation of this page as a tree node.
- * <p>
- * Subclasses can override this method. Default is {@code null}.
- *
- * @return the ID (name) of the icon
- * @see IIconProviderService
- */
- @ConfigProperty(ConfigProperty.ICON_ID)
- @Order(50)
- @ConfigPropertyValue("null")
- protected String getConfiguredIconId() {
- return null;
- }
-
- /**
- * Provides a documentation text or description of this page. The text is intended to be included in external
- * documentation. This method is typically processed by a documentation generation tool or similar.
- * <p>
- * Subclasses can override this method. Default is {@code null}.
- *
- * @return a documentation text, suitable to be included in external documents
- */
- @ConfigProperty(ConfigProperty.DOC)
- @Order(60)
- @ConfigPropertyValue("null")
- protected String getConfiguredDoc() {
- return null;
- }
-
- /**
- * Called after this page has been added to the outline tree. This method may set a detail form or check
- * some parameters.
- * <p>
- * Do not load table data here, this should be done lazily in {@link AbstractPageWithTable.execLoadTableData}.
- * <p>
- * Subclasses can override this method. The default does nothing.
- *
- * @throws ProcessingException
- * @see #execPageActivated()
- */
- @ConfigOperation
- @Order(40)
- protected void execInitPage() throws ProcessingException {
- }
-
- /**
- * Called after this page has been removed from its associated outline tree.
- * <p>
- * Subclasses can override this method. The default does nothing.
- *
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(50)
- protected void execDisposePage() throws ProcessingException {
- }
-
- /**
- * Called by the data change listener registered with this page (and the current desktop) through
- * {@link #registerDataChangeListener(Object...)}. Use this callback method
- * to react to data change events by reloading current data, or throwing away cached data etc.
- * <p>
- * Subclasses can override this method.<br/>
- * This default implementation does the following:
- * <ol>
- * <li>if this page is an ancestor of the selected page (or is selected itself) and this page is in the active
- * outline, a full re-load of the page is performed
- * <li>else the children of this page are marked dirty and the page itself is unloaded
- * </ol>
- *
- * @see IDesktop#dataChanged(Object...)
- */
- @ConfigOperation
- @Order(55)
- protected void execDataChanged(Object... dataTypes) throws ProcessingException {
- if (getTree() == null) {
- return;
- }
- //
- HashSet<ITreeNode> pathsToSelections = new HashSet<ITreeNode>();
- for (ITreeNode node : getTree().getSelectedNodes()) {
- ITreeNode tmp = node;
- while (tmp != null) {
- pathsToSelections.add(tmp);
- tmp = tmp.getParentNode();
- }
- }
- IDesktop desktop = ClientSyncJob.getCurrentSession().getDesktop();
- final boolean isActiveOutline = (desktop != null ? desktop.getOutline() == this.getOutline() : false);
- if (isActiveOutline && pathsToSelections.contains(this)) {
- try {
- /*
- * Ticket 77332 (deleting a node in the tree) also requires a reload So
- * the selected and its ancestor nodes require same processing
- */
- if (desktop != null) {
- Bookmark bm = desktop.createBookmark();
- setChildrenDirty(true);
- desktop.activateBookmark(bm, false);
- }
- }
- catch (ProcessingException e) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- }
- else {
- // not active outline OR not on selection path
- setChildrenDirty(true);
- if (isExpanded()) {
- setExpanded(false);
- }
- try {
- if (isChildrenLoaded()) {
- getTree().unloadNode(this);
- }
- }
- catch (ProcessingException e) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- }
- }
-
- /**
- * Called after this page has (re)loaded its data. This method is called after {@link #loadChildren()} has been
- * called.
- * <p>
- * Subclasses can override this method. The default does nothing.
- *
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(60)
- protected void execPageDataLoaded() throws ProcessingException {
- }
-
- /**
- * Called whenever this page is selected in the outline tree.
- * <p>
- * Subclasses can override this method. The default does nothing.
- *
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(70)
- protected void execPageActivated() throws ProcessingException {
- }
-
- /**
- * Called whenever this page is de-selected in the outline tree.
- * <p>
- * Subclasses can override this method. The default does nothing.
- *
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(80)
- protected void execPageDeactivated() throws ProcessingException {
- }
-
- protected ContextMap getContextMap() {
- return m_contextMap;
- }
-
- @Override
- protected void initConfig() {
- setTableVisible(getConfiguredTableVisible());
- super.initConfig();
- }
-
- /*
- * Runtime
- */
- @Override
- public void initPage() throws ProcessingException {
- Cell cell = getCellForUpdate();
- if (cell.getText() == null && getConfiguredTitle() != null) {
- cell.setText(getConfiguredTitle());
- }
- if (cell.getIconId() == null && getConfiguredIconId() != null) {
- cell.setIconId(getConfiguredIconId());
- }
- execInitPage();
- }
-
- @Override
- public IProcessingStatus getPagePopulateStatus() {
- return m_pagePopulateStatus;
- }
-
- @Override
- public void setPagePopulateStatus(IProcessingStatus status) {
- m_pagePopulateStatus = status;
- }
-
- /**
- * @deprecated use {@link #getUserPreferenceContext()} instead
- */
- @Override
- @SuppressWarnings("deprecation")
- @Deprecated
- @ConfigOperation
- @Order(95)
- public String getBookmarkIdentifier() {
- return getUserPreferenceContext();
- }
-
- @Override
- @ConfigOperation
- @Order(95)
- public final String getUserPreferenceContext() {
- return m_userPreferenceContext;
- }
-
- @Override
- public IOutline getOutline() {
- return (IOutline) getTree();
- }
-
- @Override
- public IPage getParentPage() {
- return (IPage) getParentNode();
- }
-
- @Override
- public IPage getChildPage(final int childIndex) {
- ///make it model thread safe
- if (ClientSyncJob.isSyncClientJob()) {
- try {
- return (IPage) getTree().resolveVirtualNode(getChildNode(childIndex));
- }
- catch (ProcessingException e) {
- LOG.error("failed to create the real page from the virtual page", e);
- }
- }
- return (IPage) getChildNode(childIndex);
- }
-
- @Override
- public IPage[] getChildPages() {
- if (ClientSyncJob.isSyncClientJob()) {
- try {
- getTree().resolveVirtualNodes(getChildNodes());
- }
- catch (ProcessingException e) {
- LOG.error("failed to create the real page from the virtual page", e);
- }
- }
- ITreeNode[] a = getChildNodes();
- IPage[] b = new IPage[a.length];
- for (int i = 0; i < b.length; i++) {
- b[i] = (IPage) a[i];
- }
- return b;
- }
-
- @Override
- public void nodeAddedNotify() {
- try {
- initPage();
- //notify memory policy
- try {
- IMemoryPolicy policy = ClientSyncJob.getCurrentSession().getMemoryPolicy();
- if (policy != null) {
- policy.pageCreated(this);
- }
- }
- catch (Throwable t) {
- LOG.error("pageCreated " + getClass().getSimpleName(), t);
- }
- }
- catch (ProcessingException e) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- catch (Throwable t) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Unexpected", t));
- }
- }
-
- @Override
- public void nodeRemovedNotify() {
- try {
- execDisposePage();
- }
- catch (ProcessingException e) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- catch (Throwable t) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Unexpected", t));
- }
- // automatically remove all data change listeners
- if (m_internalDataChangeListener != null) {
- IDesktop desktop = ClientSyncJob.getCurrentSession().getDesktop();
- if (desktop != null) {
- desktop.removeDataChangeListener(m_internalDataChangeListener);
- }
- }
- }
-
- @Override
- public void pageActivatedNotify() {
- try {
- execPageActivated();
- }
- catch (Throwable t) {
- if (t instanceof ProcessingException && ((ProcessingException) t).isInterruption()) {
- //nop
- }
- else {
- //ticket 87361: only log a warning
- LOG.warn("Caught a failure, probably due to operation cancelation by the user", t);
- }
- }
- }
-
- @Override
- public void pageDeactivatedNotify() {
- try {
- execPageDeactivated();
- }
- catch (Throwable t) {
- if (t instanceof ProcessingException && ((ProcessingException) t).isInterruption()) {
- //nop
- }
- else {
- //ticket 87361: only log a warning
- LOG.warn("Caught a failure, probably due to operation cancelation by the user", t);
- }
- }
- }
-
- @Override
- public IForm getDetailForm() {
- return m_detailForm;
- }
-
- @Override
- public void setDetailForm(IForm form) {
- if (form != null) {
- if (form.getDisplayHint() != IForm.DISPLAY_HINT_VIEW) {
- form.setDisplayHint(IForm.DISPLAY_HINT_VIEW);
- }
- if (form.getDisplayViewId() == null) {
- form.setDisplayViewId(IForm.VIEW_ID_PAGE_DETAIL);
- }
- form.setAutoAddRemoveOnDesktop(false);
- }
- m_detailForm = form;
- if (isSelectedNode()) {
- getOutline().setDetailForm(m_detailForm);
- }
- }
-
- /**
- * Register a {@link DataChangeListener} on the desktop for these dataTypes<br>
- * Example:
- *
- * <pre>
- * registerDataChangeListener(CRMEnum.Company, CRMEnum.Project, CRMEnum.Task);
- * </pre>
- */
- public void registerDataChangeListener(Object... dataTypes) {
- if (m_internalDataChangeListener == null) {
- m_internalDataChangeListener = new WeakDataChangeListener() {
- @Override
- public void dataChanged(Object... innerDataTypes) throws ProcessingException {
- execDataChanged(innerDataTypes);
- }
- };
- }
- IDesktop desktop = ClientSyncJob.getCurrentSession().getDesktop();
- if (desktop == null) {
- desktop = ClientSyncJob.getCurrentSession().getVirtualDesktop();
- }
- desktop.addDataChangeListener(m_internalDataChangeListener, dataTypes);
- }
-
- @Override
- public void dataChanged(Object... dataTypes) {
- try {
- execDataChanged(dataTypes);
- }
- catch (ProcessingException e) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- catch (Throwable t) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Unexpected", t));
- }
- }
-
- /**
- * Unregister the {@link DataChangeListener} from the desktop for these
- * dataTypes<br>
- * Example:
- *
- * <pre>
- * unregisterDataChangeListener(CRMEnum.Company, CRMEnum.Project, CRMEnum.Task);
- * </pre>
- */
- public void unregisterDataChangeListener(Object... dataTypes) {
- if (m_internalDataChangeListener != null) {
- //sle Ticket 92'909: AbstractPage unregisterDataChangeListener NullPointer
- IDesktop desktop = ClientSyncJob.getCurrentSession().getDesktop();
- if (desktop == null) {
- desktop = ClientSyncJob.getCurrentSession().getVirtualDesktop();
- }
- desktop.removeDataChangeListener(m_internalDataChangeListener, dataTypes);
- }
- }
-
- @Override
- public final void reloadPage() throws ProcessingException {
- ITree tree = getTree();
- if (tree != null) {
- try {
- tree.setTreeChanging(true);
- //
- // do NOT unload page, because this will clear the selection
- // //getOutline().unloadNode(this);
- loadChildren();
- execPageDataLoaded();
- }
- finally {
- tree.setTreeChanging(false);
- }
- }
- }
-
- @Override
- public boolean isTableVisible() {
- return m_tableVisible;
- }
-
- @Override
- public void setTableVisible(boolean b) {
- m_tableVisible = b;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.desktop.outline.pages;
+
+import java.util.Arrays;
+import java.util.HashSet;
+
+import org.eclipse.scout.commons.annotations.ConfigOperation;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.IProcessingStatus;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.IMemoryPolicy;
+import org.eclipse.scout.rt.client.services.common.icon.IIconProviderService;
+import org.eclipse.scout.rt.client.ui.DataChangeListener;
+import org.eclipse.scout.rt.client.ui.WeakDataChangeListener;
+import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
+import org.eclipse.scout.rt.client.ui.basic.tree.AbstractTreeNode;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITree;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
+import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.shared.ContextMap;
+import org.eclipse.scout.rt.shared.services.common.bookmark.Bookmark;
+import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
+import org.eclipse.scout.service.SERVICES;
+
+public abstract class AbstractPage extends AbstractTreeNode implements IPage {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractPage.class);
+
+ private IForm m_detailForm;
+ private final ContextMap m_contextMap;
+ private boolean m_tableVisible;
+ private DataChangeListener m_internalDataChangeListener;
+ private final String m_userPreferenceContext;
+ private IProcessingStatus m_pagePopulateStatus;
+
+ /**
+ * use this static method to create a string based on the vargs that can be used as userPreferenceContext
+ */
+ public static String createUserPreferenceContext(Object... vargs) {
+ StringBuffer buf = new StringBuffer();
+ if (vargs != null) {
+ for (Object o : vargs) {
+ if (buf.length() > 0) {
+ buf.append(",");
+ }
+ if (o == null) {
+ buf.append("null");
+ }
+ else if (o instanceof Object[]) {
+ buf.append(Arrays.toString((Object[]) o));
+ }
+ else {
+ buf.append(o.toString());
+ }
+ }
+ }
+ return buf.toString();
+ }
+
+ public AbstractPage() {
+ this(true);
+ }
+
+ public AbstractPage(String userPreferenceContext) {
+ this(true, null, userPreferenceContext);
+ }
+
+ public AbstractPage(boolean callInitializer) {
+ this(callInitializer, null, null);
+ }
+
+ public AbstractPage(ContextMap contextMap) {
+ this(true, contextMap, null);
+ }
+
+ public AbstractPage(boolean callInitializer, String userPreferenceContext) {
+ this(callInitializer, null, userPreferenceContext);
+ }
+
+ public AbstractPage(boolean callInitializer, ContextMap contextMap) {
+ this(callInitializer, contextMap, null);
+ }
+
+ public AbstractPage(boolean callInitializer, ContextMap contextMap, String userPreferenceContext) {
+ super(false);
+ m_contextMap = contextMap;
+ m_userPreferenceContext = userPreferenceContext;
+ if (callInitializer) {
+ callInitializer();
+ }
+ }
+
+ /*
+ * Configuration
+ */
+
+ /**
+ * Configures the visibility of this page's table. Typical subclasses of this abstract class use a tabular
+ * structure to display data, this includes {@link AbstractPageWithTable} as well as {@link AbstractPageWithNodes}.
+ * Set this property to {@code false} if you want to display a detail form within this page.
+ * <p>
+ * Subclasses can override this method. Default is {@code true}.
+ *
+ * @return {@code true} if this page's table is visible, {@code false} otherwise
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(35)
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredTableVisible() {
+ return true;
+ }
+
+ /**
+ * Configures the title of this page. The title is typically displayed on the GUI, e.g. as part of the representation
+ * of this page as a tree node.
+ * <p>
+ * Subclasses can override this method. Default is {@code null}.
+ *
+ * @return the title for this page
+ */
+ @ConfigProperty(ConfigProperty.TEXT)
+ @Order(40)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredTitle() {
+ return null;
+ }
+
+ /**
+ * Configures the icon for this page. The icon is typically used to represent this page in the GUI, e.g. as part of
+ * the representation of this page as a tree node.
+ * <p>
+ * Subclasses can override this method. Default is {@code null}.
+ *
+ * @return the ID (name) of the icon
+ * @see IIconProviderService
+ */
+ @ConfigProperty(ConfigProperty.ICON_ID)
+ @Order(50)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredIconId() {
+ return null;
+ }
+
+ /**
+ * Provides a documentation text or description of this page. The text is intended to be included in external
+ * documentation. This method is typically processed by a documentation generation tool or similar.
+ * <p>
+ * Subclasses can override this method. Default is {@code null}.
+ *
+ * @return a documentation text, suitable to be included in external documents
+ */
+ @ConfigProperty(ConfigProperty.DOC)
+ @Order(60)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredDoc() {
+ return null;
+ }
+
+ /**
+ * Called after this page has been added to the outline tree. This method may set a detail form or check
+ * some parameters.
+ * <p>
+ * Do not load table data here, this should be done lazily in {@link AbstractPageWithTable.execLoadTableData}.
+ * <p>
+ * Subclasses can override this method. The default does nothing.
+ *
+ * @throws ProcessingException
+ * @see #execPageActivated()
+ */
+ @ConfigOperation
+ @Order(40)
+ protected void execInitPage() throws ProcessingException {
+ }
+
+ /**
+ * Called after this page has been removed from its associated outline tree.
+ * <p>
+ * Subclasses can override this method. The default does nothing.
+ *
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(50)
+ protected void execDisposePage() throws ProcessingException {
+ }
+
+ /**
+ * Called by the data change listener registered with this page (and the current desktop) through
+ * {@link #registerDataChangeListener(Object...)}. Use this callback method
+ * to react to data change events by reloading current data, or throwing away cached data etc.
+ * <p>
+ * Subclasses can override this method.<br/>
+ * This default implementation does the following:
+ * <ol>
+ * <li>if this page is an ancestor of the selected page (or is selected itself) and this page is in the active
+ * outline, a full re-load of the page is performed
+ * <li>else the children of this page are marked dirty and the page itself is unloaded
+ * </ol>
+ *
+ * @see IDesktop#dataChanged(Object...)
+ */
+ @ConfigOperation
+ @Order(55)
+ protected void execDataChanged(Object... dataTypes) throws ProcessingException {
+ if (getTree() == null) {
+ return;
+ }
+ //
+ HashSet<ITreeNode> pathsToSelections = new HashSet<ITreeNode>();
+ for (ITreeNode node : getTree().getSelectedNodes()) {
+ ITreeNode tmp = node;
+ while (tmp != null) {
+ pathsToSelections.add(tmp);
+ tmp = tmp.getParentNode();
+ }
+ }
+ IDesktop desktop = ClientSyncJob.getCurrentSession().getDesktop();
+ final boolean isActiveOutline = (desktop != null ? desktop.getOutline() == this.getOutline() : false);
+ if (isActiveOutline && pathsToSelections.contains(this)) {
+ try {
+ /*
+ * Ticket 77332 (deleting a node in the tree) also requires a reload So
+ * the selected and its ancestor nodes require same processing
+ */
+ if (desktop != null) {
+ Bookmark bm = desktop.createBookmark();
+ setChildrenDirty(true);
+ desktop.activateBookmark(bm, false);
+ }
+ }
+ catch (ProcessingException e) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ }
+ else {
+ // not active outline OR not on selection path
+ setChildrenDirty(true);
+ if (isExpanded()) {
+ setExpanded(false);
+ }
+ try {
+ if (isChildrenLoaded()) {
+ getTree().unloadNode(this);
+ }
+ }
+ catch (ProcessingException e) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ }
+ }
+
+ /**
+ * Called after this page has (re)loaded its data. This method is called after {@link #loadChildren()} has been
+ * called.
+ * <p>
+ * Subclasses can override this method. The default does nothing.
+ *
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(60)
+ protected void execPageDataLoaded() throws ProcessingException {
+ }
+
+ /**
+ * Called whenever this page is selected in the outline tree.
+ * <p>
+ * Subclasses can override this method. The default does nothing.
+ *
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(70)
+ protected void execPageActivated() throws ProcessingException {
+ }
+
+ /**
+ * Called whenever this page is de-selected in the outline tree.
+ * <p>
+ * Subclasses can override this method. The default does nothing.
+ *
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(80)
+ protected void execPageDeactivated() throws ProcessingException {
+ }
+
+ protected ContextMap getContextMap() {
+ return m_contextMap;
+ }
+
+ @Override
+ protected void initConfig() {
+ setTableVisible(getConfiguredTableVisible());
+ super.initConfig();
+ }
+
+ /*
+ * Runtime
+ */
+ @Override
+ public void initPage() throws ProcessingException {
+ Cell cell = getCellForUpdate();
+ if (cell.getText() == null && getConfiguredTitle() != null) {
+ cell.setText(getConfiguredTitle());
+ }
+ if (cell.getIconId() == null && getConfiguredIconId() != null) {
+ cell.setIconId(getConfiguredIconId());
+ }
+ execInitPage();
+ }
+
+ @Override
+ public IProcessingStatus getPagePopulateStatus() {
+ return m_pagePopulateStatus;
+ }
+
+ @Override
+ public void setPagePopulateStatus(IProcessingStatus status) {
+ m_pagePopulateStatus = status;
+ }
+
+ /**
+ * @deprecated use {@link #getUserPreferenceContext()} instead
+ */
+ @Override
+ @SuppressWarnings("deprecation")
+ @Deprecated
+ @ConfigOperation
+ @Order(95)
+ public String getBookmarkIdentifier() {
+ return getUserPreferenceContext();
+ }
+
+ @Override
+ @ConfigOperation
+ @Order(95)
+ public final String getUserPreferenceContext() {
+ return m_userPreferenceContext;
+ }
+
+ @Override
+ public IOutline getOutline() {
+ return (IOutline) getTree();
+ }
+
+ @Override
+ public IPage getParentPage() {
+ return (IPage) getParentNode();
+ }
+
+ @Override
+ public IPage getChildPage(final int childIndex) {
+ ///make it model thread safe
+ if (ClientSyncJob.isSyncClientJob()) {
+ try {
+ return (IPage) getTree().resolveVirtualNode(getChildNode(childIndex));
+ }
+ catch (ProcessingException e) {
+ LOG.error("failed to create the real page from the virtual page", e);
+ }
+ }
+ return (IPage) getChildNode(childIndex);
+ }
+
+ @Override
+ public IPage[] getChildPages() {
+ if (ClientSyncJob.isSyncClientJob()) {
+ try {
+ getTree().resolveVirtualNodes(getChildNodes());
+ }
+ catch (ProcessingException e) {
+ LOG.error("failed to create the real page from the virtual page", e);
+ }
+ }
+ ITreeNode[] a = getChildNodes();
+ IPage[] b = new IPage[a.length];
+ for (int i = 0; i < b.length; i++) {
+ b[i] = (IPage) a[i];
+ }
+ return b;
+ }
+
+ @Override
+ public void nodeAddedNotify() {
+ try {
+ initPage();
+ //notify memory policy
+ try {
+ IMemoryPolicy policy = ClientSyncJob.getCurrentSession().getMemoryPolicy();
+ if (policy != null) {
+ policy.pageCreated(this);
+ }
+ }
+ catch (Throwable t) {
+ LOG.error("pageCreated " + getClass().getSimpleName(), t);
+ }
+ }
+ catch (ProcessingException e) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ catch (Throwable t) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Unexpected", t));
+ }
+ }
+
+ @Override
+ public void nodeRemovedNotify() {
+ try {
+ execDisposePage();
+ }
+ catch (ProcessingException e) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ catch (Throwable t) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Unexpected", t));
+ }
+ // automatically remove all data change listeners
+ if (m_internalDataChangeListener != null) {
+ IDesktop desktop = ClientSyncJob.getCurrentSession().getDesktop();
+ if (desktop != null) {
+ desktop.removeDataChangeListener(m_internalDataChangeListener);
+ }
+ }
+ }
+
+ @Override
+ public void pageActivatedNotify() {
+ try {
+ execPageActivated();
+ }
+ catch (Throwable t) {
+ if (t instanceof ProcessingException && ((ProcessingException) t).isInterruption()) {
+ //nop
+ }
+ else {
+ //ticket 87361: only log a warning
+ LOG.warn("Caught a failure, probably due to operation cancelation by the user", t);
+ }
+ }
+ }
+
+ @Override
+ public void pageDeactivatedNotify() {
+ try {
+ execPageDeactivated();
+ }
+ catch (Throwable t) {
+ if (t instanceof ProcessingException && ((ProcessingException) t).isInterruption()) {
+ //nop
+ }
+ else {
+ //ticket 87361: only log a warning
+ LOG.warn("Caught a failure, probably due to operation cancelation by the user", t);
+ }
+ }
+ }
+
+ @Override
+ public IForm getDetailForm() {
+ return m_detailForm;
+ }
+
+ @Override
+ public void setDetailForm(IForm form) {
+ if (form != null) {
+ if (form.getDisplayHint() != IForm.DISPLAY_HINT_VIEW) {
+ form.setDisplayHint(IForm.DISPLAY_HINT_VIEW);
+ }
+ if (form.getDisplayViewId() == null) {
+ form.setDisplayViewId(IForm.VIEW_ID_PAGE_DETAIL);
+ }
+ form.setAutoAddRemoveOnDesktop(false);
+ }
+ m_detailForm = form;
+ if (isSelectedNode()) {
+ getOutline().setDetailForm(m_detailForm);
+ }
+ }
+
+ /**
+ * Register a {@link DataChangeListener} on the desktop for these dataTypes<br>
+ * Example:
+ *
+ * <pre>
+ * registerDataChangeListener(CRMEnum.Company, CRMEnum.Project, CRMEnum.Task);
+ * </pre>
+ */
+ public void registerDataChangeListener(Object... dataTypes) {
+ if (m_internalDataChangeListener == null) {
+ m_internalDataChangeListener = new WeakDataChangeListener() {
+ @Override
+ public void dataChanged(Object... innerDataTypes) throws ProcessingException {
+ execDataChanged(innerDataTypes);
+ }
+ };
+ }
+ IDesktop desktop = ClientSyncJob.getCurrentSession().getDesktop();
+ if (desktop == null) {
+ desktop = ClientSyncJob.getCurrentSession().getVirtualDesktop();
+ }
+ desktop.addDataChangeListener(m_internalDataChangeListener, dataTypes);
+ }
+
+ @Override
+ public void dataChanged(Object... dataTypes) {
+ try {
+ execDataChanged(dataTypes);
+ }
+ catch (ProcessingException e) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ catch (Throwable t) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Unexpected", t));
+ }
+ }
+
+ /**
+ * Unregister the {@link DataChangeListener} from the desktop for these
+ * dataTypes<br>
+ * Example:
+ *
+ * <pre>
+ * unregisterDataChangeListener(CRMEnum.Company, CRMEnum.Project, CRMEnum.Task);
+ * </pre>
+ */
+ public void unregisterDataChangeListener(Object... dataTypes) {
+ if (m_internalDataChangeListener != null) {
+ //sle Ticket 92'909: AbstractPage unregisterDataChangeListener NullPointer
+ IDesktop desktop = ClientSyncJob.getCurrentSession().getDesktop();
+ if (desktop == null) {
+ desktop = ClientSyncJob.getCurrentSession().getVirtualDesktop();
+ }
+ desktop.removeDataChangeListener(m_internalDataChangeListener, dataTypes);
+ }
+ }
+
+ @Override
+ public final void reloadPage() throws ProcessingException {
+ ITree tree = getTree();
+ if (tree != null) {
+ try {
+ tree.setTreeChanging(true);
+ //
+ // do NOT unload page, because this will clear the selection
+ // //getOutline().unloadNode(this);
+ loadChildren();
+ execPageDataLoaded();
+ }
+ finally {
+ tree.setTreeChanging(false);
+ }
+ }
+ }
+
+ @Override
+ public boolean isTableVisible() {
+ return m_tableVisible;
+ }
+
+ @Override
+ public void setTableVisible(boolean b) {
+ m_tableVisible = b;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/pages/AbstractPageWithTable.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/pages/AbstractPageWithTable.java
index 5ea2df737f..9ed7876f03 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/pages/AbstractPageWithTable.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/pages/AbstractPageWithTable.java
@@ -1,954 +1,954 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.desktop.outline.pages;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.concurrent.atomic.AtomicReference;
-
-import org.eclipse.scout.commons.ConfigurationUtility;
-import org.eclipse.scout.commons.annotations.ConfigOperation;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.IProcessingStatus;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.exception.ProcessingStatus;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.IMemoryPolicy;
-import org.eclipse.scout.rt.client.services.common.search.ISearchFilterService;
-import org.eclipse.scout.rt.client.ui.basic.cell.ICell;
-import org.eclipse.scout.rt.client.ui.basic.table.AbstractTable;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.client.ui.basic.table.TableAdapter;
-import org.eclipse.scout.rt.client.ui.basic.table.TableEvent;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITree;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
-import org.eclipse.scout.rt.client.ui.basic.tree.IVirtualTreeNode;
-import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
-import org.eclipse.scout.rt.client.ui.desktop.navigation.INavigationHistoryService;
-import org.eclipse.scout.rt.client.ui.desktop.outline.OutlineMediator;
-import org.eclipse.scout.rt.client.ui.form.FormEvent;
-import org.eclipse.scout.rt.client.ui.form.FormListener;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.shared.ContextMap;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
-import org.eclipse.scout.rt.shared.services.common.jdbc.SearchFilter;
-import org.eclipse.scout.service.SERVICES;
-
-/**
- * A page containing a list of "menu" entries<br>
- * child pages are explicitly added
- */
-public abstract class AbstractPageWithTable<T extends ITable> extends AbstractPage implements IPageWithTable<T> {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractPageWithTable.class);
-
- private T m_table;
- private ISearchForm m_searchForm;
- private FormListener m_searchFormListener;
- private boolean m_searchRequired;
- private boolean m_searchActive;
- private boolean m_showEmptySpaceMenus;
- private boolean m_showTableRowMenus;
- private final HashMap<ITableRow, IPage> m_tableRowToPageMap = new HashMap<ITableRow, IPage>();
- private final HashMap<IPage, ITableRow> m_pageToTableRowMap = new HashMap<IPage, ITableRow>();
-
- public AbstractPageWithTable() {
- this(true, null, null);
- }
-
- /**
- * calling the constructor with callInitializer == false means, the table won't be constructed upon init
- * but upon activation. this is a performance-optimization and especially recommended for tablepages
- * where the parent is directly another table page (and no folder- or plain page) in this case the parent page can
- * have a huge amount of child pages with a lot of tables to be constructed but never used.
- *
- * @param callInitializer
- */
- public AbstractPageWithTable(boolean callInitializer) {
- this(callInitializer, null, null);
- }
-
- public AbstractPageWithTable(ContextMap contextMap) {
- this(true, contextMap, null);
- }
-
- public AbstractPageWithTable(String userPreferenceContext) {
- this(true, null, userPreferenceContext);
- }
-
- public AbstractPageWithTable(boolean callInitializer, ContextMap contextMap) {
- this(callInitializer, contextMap, null);
- }
-
- public AbstractPageWithTable(boolean callInitializer, String userPreferenceContext) {
- this(callInitializer, null, userPreferenceContext);
- }
-
- public AbstractPageWithTable(boolean callInitializer, ContextMap contextMap, String userPreferenceContext) {
- super(callInitializer, contextMap, userPreferenceContext);
- if (!callInitializer) {
- callMinimalInitializer();
- }
- }
-
- protected void callMinimalInitializer() {
- setChildrenDirty(true);
- setLeafInternal(getConfiguredLeaf());
- setEnabledInternal(getConfiguredEnabled());
- setExpandedInternal(getConfiguredExpanded());
- }
-
- /*
- * Configuration
- */
- /**
- * Configures the search form to be used with this table page. The search form is lazily
- * {@linkplain #ensureSearchFormCreated() created} and {@linkplain #ensureSearchFormStarted() started}.
- * <p>
- * For legacy support, the search form can also be defined as an inner class. This usage is deprecated, override this
- * method in subclasses instead.
- * <p>
- * Subclasses can override this method. Default is {@code null}.
- *
- * @return a search form type token
- * @see ISearchForm
- */
- @ConfigProperty(ConfigProperty.SEARCH_FORM)
- @Order(90)
- @ConfigPropertyValue("null")
- protected Class<? extends ISearchForm> getConfiguredSearchForm() {
- return null;
- }
-
- /**
- * Configures whether table data is automatically loaded (through a search with default constraints)
- * or whether loading the table data must be triggered explicitly by the user. Set this property to {@code true} if
- * you expect large amount of data for an unconstrained search.
- * <p>
- * This property is read by {@link #execPopulateTable()}, if you override that method, this configuration property
- * might not have any effect. This configuration property does not have any effect if no search form is configured for
- * this table page.
- * <p>
- * Subclasses can override this method. Default is {@code false}.
- *
- * @return {@code true} if the table data should be loaded on explicit user interaction, {@code false} otherwise
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(100)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredSearchRequired() {
- return false;
- }
-
- /**
- * Configures the visibility of empty space menus on this page's table. Empty space menus are typically available
- * anywhere in a table field where no table rows are present (in the 'empty space'), as well as on the table header.
- * Typical empty space menus will affect no (existing) row (for example a 'New row...' menu), or all rows in the table
- * (for example a 'Clear all rows' menu).
- * <p>
- * Note that setting this property to {@code false} will effectively stop all empty space menus from being displayed
- * on the GUI. However, if this property is set to {@code true}, single menus can still individually be set to
- * invisible.
- * <p>
- * Subclasses can override this method. Default is {@code true}.
- *
- * @return {@code true} if empty space menus should generally be visible, {@code false} otherwise
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(110)
- @ConfigPropertyValue("true")
- protected boolean getConfiguredShowEmptySpaceMenus() {
- return true;
- }
-
- /**
- * Configures the visibility of table row menus on this page's table. Table row menus are typically available
- * on each existing row. Typical table row menus will affect exactly one existing row (for example an 'Edit row...'
- * menu or a 'Delete row' menu).
- * <p>
- * Note that setting this property to {@code false} will effectively stop all table row menus from being displayed on
- * the GUI. However, if this property is set to {@code true}, single menus can still individually be set to invisible.
- * <p>
- * Subclasses can override this method. Default is {@code true}.
- *
- * @return {@code true} if table row menus should generally be visible, {@code false} otherwise
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(120)
- @ConfigPropertyValue("true")
- protected boolean getConfiguredShowTableRowMenus() {
- return true;
- }
-
- /**
- * Fetches and returns tabular data to be displayed in this page's table.
- * Typically this method will query a (backend) service for the data. Make
- * sure the returned content (including type definitions) matches the table columns.
- * <p>
- * This method is called by {@link #execPopulateTable()} and overriding this method generally is the most convenient
- * way to populate a table page. If you need more control over populating a table page, consider overriding
- * {@code execPopulateTable()} instead.
- * <p>
- * Subclasses can override this method. The default returns {@code null}.
- *
- * @param filter
- * a search filter, guaranteed not to be {@code null}
- * @return an {@code Object[][]} representing tabular data to be displayed in this page's table
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(90)
- protected Object[][] execLoadTableData(SearchFilter filter) throws ProcessingException {
- return null;
- }
-
- /**
- * Populates this page's table.
- * <p>
- * It is good practice to populate table using {@code ITable.replaceRows} instead of {@code ITable.removeAllRows();
- * ITable.addRows} because in the former case the outline tree structure below the changing rows is not discarded but
- * only marked as dirty. The subtree is lazily reloaded when the user clicks next time on a child node.
- * <p>
- * Subclasses can override this method. In most cases it is sufficient to override
- * {@link #execLoadTableData(SearchFilter)} instead.<br/>
- * This default implementation does the following: It queries methods {@link #isSearchActive()} and
- * {@link #isSearchRequired()} and then calls {@code execLoadTableData} if appropriate.
- *
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(100)
- protected void execPopulateTable() throws ProcessingException {
- if (isSearchActive()) {
- SearchFilter filter = getSearchFilter();
- if (filter.isCompleted() || !isSearchRequired()) {
- // create a copy of the filter, just in case the subprocess is modifying
- // or extending the filter
- filter = (SearchFilter) filter.clone();
- //do NOT reference the result data object and warp it into a ref, so the processor is allowed to delete the contents to free up memory sooner
- getTable().replaceRowsByMatrix(new AtomicReference<Object>(execLoadTableData(filter)));
- }
- }
- else {
- // searchFilter should never be null
- //do NOT reference the result data object and warp it into a ref, so the processor is allowed to delete the contents to free up memory sooner
- getTable().replaceRowsByMatrix(new AtomicReference<Object>(execLoadTableData(new SearchFilter())));
- }
- //update table data status
- if (isSearchActive() && getSearchFilter() != null && (!getSearchFilter().isCompleted()) && isSearchRequired()) {
- setPagePopulateStatus(new ProcessingStatus(ScoutTexts.get("TooManyRows"), ProcessingStatus.WARNING));
- }
- else {
- setPagePopulateStatus(null);
- }
- }
-
- /**
- * Creates a child page for every table row that was added to this page's table. This method is called when
- * resolving a virtual tree node to a real node. Overriding this method is the recommended way to build the
- * outline tree structure.
- * <p>
- * Subclasses can override this method. The default returns {@code null}.
- *
- * @param row
- * a table row for which a new child page should be created
- * @return a new child page for {@code row}
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(110)
- protected IPage execCreateChildPage(ITableRow row) throws ProcessingException {
- return null;
- }
-
- protected IPage createChildPageInternal(ITableRow row) throws ProcessingException {
- return execCreateChildPage(row);
- }
-
- /**
- * Creates a virtual child page for every table row that was added to this page's table. The virtual page
- * is a place holder for a real page and is transformed (resolved) into the real page when it is activated for the
- * first time. This reduces memory consumption and improves performance for large table pages, where most of the child
- * pages are never activated, but solely displayed in the outline tree.
- * <p>
- * Subclasses can override this method. In most cases it is preferable to override
- * {@link #execCreateChildPage(ITableRow)} instead.<br/>
- * This default implementation checks whether {@code execCreateChildPage} is overridden and returns a new virtual
- * page, or {@code null} otherwise.
- *
- * @param row
- * a table row for which a new virtual child page should be created
- * @return a new virtual child page for {@code row}
- * @throws ProcessingException
- * @see VirtualPage
- * @see IVirtualTreeNode
- */
- @ConfigOperation
- @Order(111)
- protected IPage execCreateVirtualChildPage(ITableRow row) throws ProcessingException {
- if (ConfigurationUtility.isMethodOverwrite(AbstractPageWithTable.class, "execCreateChildPage", new Class[]{ITableRow.class}, AbstractPageWithTable.this.getClass())) {
- return new VirtualPage();
- }
- return null;
- }
-
- /**
- * Resolves a virtual tree node and returns the real tree node.
- * <p>
- * This implementation does the following:
- * <ul>
- * <li>returns {@code null} if no table row is linked to {@code node}
- * <li>else creates a new child page by calling {@link #execCreateChildPage(ITableRow)}, links the table row to the
- * new tree node and returns the new node.
- * </ul>
- *
- * @param node
- * the virtual tree node to be resolved
- * @return a new real tree node, replacing the virtual tree node
- * @throws ProcessingException
- */
- @Override
- protected ITreeNode execResolveVirtualChildNode(IVirtualTreeNode node) throws ProcessingException {
- ITableRow row = getTableRowFor(node);
- if (row == null) {
- return null;
- }
- //remove old association
- unlinkTableRowWithPage(row);
- //add new association
- IPage childPage = createChildPageInternal(row);
- if (childPage != null) {
- node.setResolvedNode(childPage);
- ICell tableCell = m_table.getSummaryCell(row);
- childPage.setFilterAccepted(row.isFilterAccepted());
- childPage.setEnabledInternal(row.isEnabled());
- childPage.getCellForUpdate().updateFrom(tableCell);
- linkTableRowWithPage(row, childPage);
- }
- return childPage;
- }
-
- private Class<? extends ITable> getConfiguredTable() {
- Class<?>[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
- return ConfigurationUtility.filterClass(dca, ITable.class);
- }
-
- @Override
- @SuppressWarnings("unchecked")
- protected void initConfig() {
- super.initConfig();
- m_searchActive = true;
- setSearchRequired(getConfiguredSearchRequired());
- setShowEmptySpaceMenus(getConfiguredShowEmptySpaceMenus());
- setShowTableRowMenus(getConfiguredShowTableRowMenus());
- Class<? extends ITable> tableClass = getConfiguredTable();
- if (tableClass != null) {
- try {
- m_table = (T) ConfigurationUtility.newInnerInstance(this, tableClass);
- if (m_table instanceof AbstractTable) {
- ((AbstractTable) m_table).setContainerInternal(this);
- }
- m_table.addTableListener(new P_TableListener());
- m_table.setEnabled(isEnabled());
- m_table.setAutoDiscardOnDelete(true);
- m_table.setUserPreferenceContext(getUserPreferenceContext());
- m_table.initTable();
- }
- catch (Exception e) {
- LOG.warn(null, e);
- }
- }
- // legacy-support for searchform-inner classes
- if (getConfiguredSearchForm() == null) {
- Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
- Class<? extends ISearchForm> searchFormClass = ConfigurationUtility.filterClass(dca, ISearchForm.class);
- if (searchFormClass != null) {
- LOG.warn("inner searchforms are deprecated...");
- try {
- setSearchForm(ConfigurationUtility.newInnerInstance(this, searchFormClass));
- }
- catch (Exception e) {
- LOG.warn(null, e);
- }
- }
- }
- }
-
- /**
- * Ensures that the search form is initialized but not started, if one is defined for this table at all. This allows
- * lazy
- * initialization of search forms.
- */
- protected void ensureSearchFormCreated() {
- if (m_searchForm == null && getConfiguredSearchForm() != null) {
- // there is no search form, but should be
- try {
- setSearchForm(getConfiguredSearchForm().newInstance());
- }
- catch (Exception e) {
- LOG.warn(null, e);
- }
- }
- }
-
- /**
- * Ensures that the search form is started (lazy starting)
- */
- protected void ensureSearchFormStarted() {
- if (m_searchForm != null && !m_searchForm.isFormOpen()) {
- try {
- m_searchForm.startSearch();
- notifyMemoryPolicyOfSearchFormStart();
- }
- catch (Exception e) {
- LOG.warn(null, e);
- }
- }
- }
-
- private void attachToSearchFormInternal() {
- if (m_searchForm == null) {
- return;
- }
- m_searchForm.setDisplayHint(ISearchForm.DISPLAY_HINT_VIEW);
- if (m_searchForm.getDisplayViewId() == null) {
- m_searchForm.setDisplayViewId(IForm.VIEW_ID_PAGE_SEARCH);
- }
- m_searchForm.setAutoAddRemoveOnDesktop(false);
- // listen for search action
- m_searchFormListener = new FormListener() {
- @Override
- public void formChanged(FormEvent e) throws ProcessingException {
- switch (e.getType()) {
- case FormEvent.TYPE_STORE_AFTER: {
- // save navigation history
- IDesktop desktop = ClientSyncJob.getCurrentSession().getDesktop();
- IPage page = AbstractPageWithTable.this;
- if (desktop != null && desktop.getOutline() != null && desktop.getOutline().getActivePage() == page) {
- SERVICES.getService(INavigationHistoryService.class).addStep(0, page);
- }
- // do page reload to execute search
- try {
- reloadPage();
- }
- catch (ProcessingException ex) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(ex);
- }
- break;
- }
- }
- }
- };
- m_searchForm.addFormListener(m_searchFormListener);
- try {
- execInitSearchForm();
- }
- catch (Exception e) {
- LOG.warn(null, e);
- }
- }
-
- private void detachFromSearchFormInternal() {
- if (m_searchForm == null) {
- return;
- }
- // listen for search action
- if (m_searchFormListener != null) {
- m_searchForm.removeFormListener(m_searchFormListener);
- m_searchFormListener = null;
- }
- }
-
- private void notifyMemoryPolicyOfSearchFormStart() {
- //use memory policy to handle content caching
- try {
- IMemoryPolicy policy = ClientSyncJob.getCurrentSession().getMemoryPolicy();
- if (policy != null) {
- policy.pageSearchFormStarted(this);
- }
- }
- catch (Throwable t) {
- LOG.error("pageCreated " + getClass().getSimpleName(), t);
- }
- }
-
- /**
- * Initializes the search form associated with this page. This method is called before the
- * search form is used for the first time.
- * <p>
- * Legacy: If the search form is defined as inner class, this method is called when this page is initialized.
- * <p>
- * Subclasses can override this method. The default does nothing.
- *
- * @throws ProcessingException
- * @see #ensureSearchFormCreated()
- * @see #ensureSearchFormStarted()
- */
- @ConfigOperation
- @Order(120)
- protected void execInitSearchForm() throws ProcessingException {
- }
-
- @Override
- public final T getTable() {
- if (m_table == null) {
- ensureInitialized();
- }
- return m_table;
- }
-
- @Override
- public boolean isShowEmptySpaceMenus() {
- return m_showEmptySpaceMenus;
- }
-
- @Override
- public void setShowEmptySpaceMenus(boolean showEmptySpaceMenus) {
- m_showEmptySpaceMenus = showEmptySpaceMenus;
- }
-
- @Override
- public boolean isShowTableRowMenus() {
- return m_showTableRowMenus;
- }
-
- @Override
- public void setShowTableRowMenus(boolean showTableRowMenus) {
- m_showTableRowMenus = showTableRowMenus;
- }
-
- @Override
- public ISearchForm getSearchFormInternal() {
- ensureSearchFormCreated();
- return m_searchForm;
- }
-
- public void setSearchForm(ISearchForm searchForm) {
- if (m_searchForm == searchForm) {
- return;
- }
- detachFromSearchFormInternal();
- m_searchForm = searchForm;
- attachToSearchFormInternal();
- }
-
- @Override
- public SearchFilter getSearchFilter() {
- ensureSearchFormCreated();
- ensureSearchFormStarted();
- if (getSearchFormInternal() != null) {
- return getSearchFormInternal().getSearchFilter();
- }
- else {
- ISearchFilterService sfs = SERVICES.getService(ISearchFilterService.class);
- if (sfs != null) {
- return sfs.createNewSearchFilter();
- }
- else {
- return new SearchFilter();
- }
- }
- }
-
- @Override
- public boolean isSearchRequired() {
- return m_searchRequired;
- }
-
- @Override
- public void setSearchRequired(boolean b) {
- m_searchRequired = b;
- }
-
- @Override
- public void setEnabled(boolean b) {
- super.setEnabled(b);
- if (m_table != null) {
- m_table.setEnabled(isEnabled());
- }
- }
-
- @Override
- public boolean isSearchActive() {
- return m_searchActive;
- }
-
- @Override
- public void setSearchActive(boolean b) {
- m_searchActive = b;
- if (isSelectedNode()) {
- getOutline().setSearchForm(m_searchActive ? getSearchFormInternal() : null);
- }
- }
-
- @Override
- public void pageActivatedNotify() {
- ensureInitialized();
- ensureSearchFormCreated();
- ensureSearchFormStarted();
- super.pageActivatedNotify();
- }
-
- @Override
- public void setPagePopulateStatus(IProcessingStatus status) {
- super.setPagePopulateStatus(status);
- getTable().tablePopulated();
- }
-
- @Override
- @SuppressWarnings("deprecation")
- public IProcessingStatus getTablePopulateStatus() {
- return getPagePopulateStatus();
- }
-
- @Override
- @SuppressWarnings("deprecation")
- public void setTablePopulateStatus(IProcessingStatus status) {
- setPagePopulateStatus(status);
- }
-
- /**
- * load table data
- */
- private void loadTableDataImpl() throws ProcessingException {
- if (m_table != null) {
- try {
- m_table.setTableChanging(true);
- //
- ensureSearchFormCreated();
- ensureSearchFormStarted();
- execPopulateTable();
- }
- catch (Throwable t) {
- m_table.discardAllRows();
- ProcessingException pe;
- if (t instanceof ProcessingException) {
- pe = (ProcessingException) t;
- }
- else {
- pe = new ProcessingException(t.getMessage(), t);
- }
- if (pe.isInterruption()) {
- setPagePopulateStatus(new ProcessingStatus(ScoutTexts.get("SearchWasCanceled"), ProcessingStatus.CANCEL));
- }
- else {
- setPagePopulateStatus(new ProcessingStatus(ScoutTexts.get("ErrorWhileLoadingData"), ProcessingStatus.CANCEL));
- }
- throw pe;
- }
- finally {
- m_table.setTableChanging(false);
- }
- }
- }
-
- /**
- * load tree children<br>
- * this method delegates to the table reload<br>
- * when the table is loaded and this node is not a leaf node then the table
- * rows are mirrored in child nodes
- */
- @Override
- public final void loadChildren() throws ProcessingException {
- ITree tree = getTree();
- try {
- if (tree != null) {
- tree.setTreeChanging(true);
- }
- //
- // backup currently selected tree node and its path to root
- boolean oldSelectionOwned = false;
- int oldSelectionDirectChildIndex = -1;
- ITreeNode oldSelectedNode = null;
- if (tree != null) {
- oldSelectedNode = tree.getSelectedNode();
- }
- Object[] oldSelectedRowKeys = null;
- if (oldSelectedNode != null) {
- ITreeNode t = oldSelectedNode;
- while (t != null && t.getParentNode() != null) {
- if (t.getParentNode() == this) {
- oldSelectionOwned = true;
- oldSelectedRowKeys = getTableRowFor(t).getKeyValues();
- oldSelectionDirectChildIndex = t.getChildNodeIndex();
- break;
- }
- t = t.getParentNode();
- }
- }
- //
- setChildrenLoaded(false);
- ClientSyncJob.getCurrentSession().getMemoryPolicy().beforeTablePageLoadData(this);
- try {
- loadTableDataImpl();
- }
- catch (ProcessingException pe) {
- if (!pe.isInterruption()) {
- throw pe;
- }
- }
- finally {
- ClientSyncJob.getCurrentSession().getMemoryPolicy().afterTablePageLoadData(this);
- }
- setChildrenLoaded(true);
- setChildrenDirty(false);
- // table events will handle automatic tree changes in case table is
- // mirrored in tree.
- // restore currently selected tree node when it was owned by our table
- // rows.
- // in case selection was lost, try to select similar index as before
-
- if (tree != null && oldSelectionOwned && tree.getSelectedNode() == null) {
- ITreeNode newSelectedNode = null;
- ITableRow row = getTable().getSelectedRow();
- if (row != null) {
- newSelectedNode = getTreeNodeFor(row);
- }
- else {
- row = getTable().findRowByKey(oldSelectedRowKeys);
- if (row != null) {
- newSelectedNode = getTreeNodeFor(row);
- }
- else if (oldSelectedNode != null && oldSelectedNode.getTree() == tree) {
- newSelectedNode = oldSelectedNode;
- }
- else {
- int index = Math.max(-1, Math.min(oldSelectionDirectChildIndex, getChildNodeCount() - 1));
- if (index >= 0 && index < getChildNodeCount()) {
- newSelectedNode = getChildNode(index);
- }
- else {
- newSelectedNode = this;
- }
- }
- }
- if (newSelectedNode != null) {
- newSelectedNode = tree.resolveVirtualNode(newSelectedNode);
- tree.selectNode(newSelectedNode);
- }
- }
- }
- finally {
- if (tree != null) {
- tree.setTreeChanging(false);
- }
- }
- IDesktop desktop = ClientSyncJob.getCurrentSession().getDesktop();
- if (desktop != null) {
- desktop.afterTablePageLoaded(this);
- }
- }
-
- private void linkTableRowWithPage(ITableRow tableRow, IPage page) {
- m_tableRowToPageMap.put(tableRow, page);
- m_pageToTableRowMap.put(page, tableRow);
- }
-
- private void unlinkTableRowWithPage(ITableRow tableRow) {
- IPage page = m_tableRowToPageMap.remove(tableRow);
- if (page != null) {
- m_pageToTableRowMap.remove(page);
- }
- }
-
- @Override
- public IPage[] getUpdatedChildPagesFor(ITableRow[] tableRows) {
- return getChildPagesFor(tableRows, true);
- }
-
- /**
- * Computes the list of linked child pages for the given table rows. Revalidates the the pages cell
- * if <code>updateChildPageCells</code> is true. Otherwise, the cells are not updated.
- */
- private IPage[] getChildPagesFor(ITableRow[] tableRows, boolean updateChildPageCells) {
- IPage[] pages = new IPage[tableRows.length];
- int missingCount = 0;
- try {
- for (int i = 0; i < tableRows.length; i++) {
- pages[i] = m_tableRowToPageMap.get(tableRows[i]);
- if (pages[i] != null) {
- if (updateChildPageCells) {
- // update tree nodes from table rows
- ICell tableCell = getTable().getSummaryCell(tableRows[i]);
- pages[i].setEnabledInternal(tableRows[i].isEnabled());
- pages[i].getCellForUpdate().updateFrom(tableCell);
- }
- }
- else {
- missingCount++;
- }
- }
- }
- catch (ProcessingException e) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- if (missingCount > 0) {
- IPage[] tmp = new IPage[pages.length - missingCount];
- int index = 0;
- for (IPage element : pages) {
- if (element != null) {
- tmp[index] = element;
- index++;
- }
- }
- pages = tmp;
- }
- return pages;
- }
-
- @Override
- public ITreeNode getTreeNodeFor(ITableRow tableRow) {
- if (tableRow == null) {
- return null;
- }
- else {
- return m_tableRowToPageMap.get(tableRow);
- }
- }
-
- @Override
- public ITableRow getTableRowFor(ITreeNode childPageNode) {
- return m_pageToTableRowMap.get(childPageNode);
- }
-
- @Override
- public ITableRow[] getTableRowsFor(ITreeNode[] childPageNodes) {
- ITableRow[] rows = new ITableRow[childPageNodes.length];
- int missingCount = 0;
- for (int i = 0; i < childPageNodes.length; i++) {
- rows[i] = m_pageToTableRowMap.get(childPageNodes[i]);
- if (rows[i] == null) {
- missingCount++;
- }
- }
- if (missingCount > 0) {
- ITableRow[] tmp = new ITableRow[rows.length - missingCount];
- int index = 0;
- for (ITableRow element : rows) {
- if (element != null) {
- tmp[index] = element;
- index++;
- }
- }
- rows = tmp;
- }
- return rows;
- }
-
- private OutlineMediator getOutlineMediator() {
- if (getOutline() == null) {
- return null;
- }
-
- return getOutline().getOutlineMediator();
- }
-
- /**
- * Table listener and tree controller<br>
- * the table is reflected in tree children only if the tree/page node is not
- * marked as being a leaf
- */
- private class P_TableListener extends TableAdapter {
- @Override
- public void tableChanged(TableEvent e) {
- OutlineMediator outlineMediator = getOutlineMediator();
-
- switch (e.getType()) {
- case TableEvent.TYPE_ROW_ACTION: {
- if (outlineMediator != null) {
- outlineMediator.mediateTableRowAction(e, AbstractPageWithTable.this);
- }
- break;
- }
- case TableEvent.TYPE_ALL_ROWS_DELETED:
- case TableEvent.TYPE_ROWS_DELETED: {
- if (!isLeaf()) {
- ITableRow[] tableRows = e.getRows();
- IPage[] childNodes = getChildPagesFor(tableRows, false);
- for (int i = 0; i < childNodes.length; i++) {
- unlinkTableRowWithPage(tableRows[i]);
- }
-
- if (outlineMediator != null) {
- outlineMediator.mediateTableRowsDeleted(childNodes, AbstractPageWithTable.this);
- }
- }
- break;
- }
- case TableEvent.TYPE_ROWS_INSERTED: {
- if (!isLeaf()) {
- ArrayList<IPage> childPageList = new ArrayList<IPage>();
- ITableRow[] tableRows = e.getRows();
- for (ITableRow element : tableRows) {
- try {
- IPage childPage = execCreateVirtualChildPage(element);
- if (childPage != null) {
- ICell tableCell = m_table.getSummaryCell(element);
- childPage.getCellForUpdate().updateFrom(tableCell);
- linkTableRowWithPage(element, childPage);
- childPageList.add(childPage);
- }
- }
- catch (ProcessingException ex) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(ex);
- }
- catch (Throwable t) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Page " + element, t));
- }
- }
-
- if (outlineMediator != null) {
- IPage[] childPages = childPageList.toArray(new IPage[childPageList.size()]);
- outlineMediator.mediateTableRowsInserted(tableRows, childPages, AbstractPageWithTable.this);
- }
-
- // check if a page was revoked
- for (ITableRow element : tableRows) {
- IPage page = m_tableRowToPageMap.get(element);
- if (page != null && page.getParentNode() == null) {
- unlinkTableRowWithPage(element);
- }
- }
- }
- break;
- }
- case TableEvent.TYPE_ROWS_UPDATED: {
- if (outlineMediator != null) {
- outlineMediator.mediateTableRowsUpdated(e, AbstractPageWithTable.this);
- }
- break;
- }
- case TableEvent.TYPE_ROW_ORDER_CHANGED: {
- if (outlineMediator != null) {
- outlineMediator.mediateTableRowOrderChanged(e, AbstractPageWithTable.this);
- }
- break;
- }
- case TableEvent.TYPE_ROWS_SELECTED: {
- break;
- }
- case TableEvent.TYPE_ROW_FILTER_CHANGED: {
- if (outlineMediator != null) {
- outlineMediator.mediateTableRowFilterChanged(AbstractPageWithTable.this);
- }
- break;
- }
- }// end switch
- }
-
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.desktop.outline.pages;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.eclipse.scout.commons.ConfigurationUtility;
+import org.eclipse.scout.commons.annotations.ConfigOperation;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.IProcessingStatus;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.exception.ProcessingStatus;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.IMemoryPolicy;
+import org.eclipse.scout.rt.client.services.common.search.ISearchFilterService;
+import org.eclipse.scout.rt.client.ui.basic.cell.ICell;
+import org.eclipse.scout.rt.client.ui.basic.table.AbstractTable;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.client.ui.basic.table.TableAdapter;
+import org.eclipse.scout.rt.client.ui.basic.table.TableEvent;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITree;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
+import org.eclipse.scout.rt.client.ui.basic.tree.IVirtualTreeNode;
+import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
+import org.eclipse.scout.rt.client.ui.desktop.navigation.INavigationHistoryService;
+import org.eclipse.scout.rt.client.ui.desktop.outline.OutlineMediator;
+import org.eclipse.scout.rt.client.ui.form.FormEvent;
+import org.eclipse.scout.rt.client.ui.form.FormListener;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.shared.ContextMap;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
+import org.eclipse.scout.rt.shared.services.common.jdbc.SearchFilter;
+import org.eclipse.scout.service.SERVICES;
+
+/**
+ * A page containing a list of "menu" entries<br>
+ * child pages are explicitly added
+ */
+public abstract class AbstractPageWithTable<T extends ITable> extends AbstractPage implements IPageWithTable<T> {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractPageWithTable.class);
+
+ private T m_table;
+ private ISearchForm m_searchForm;
+ private FormListener m_searchFormListener;
+ private boolean m_searchRequired;
+ private boolean m_searchActive;
+ private boolean m_showEmptySpaceMenus;
+ private boolean m_showTableRowMenus;
+ private final HashMap<ITableRow, IPage> m_tableRowToPageMap = new HashMap<ITableRow, IPage>();
+ private final HashMap<IPage, ITableRow> m_pageToTableRowMap = new HashMap<IPage, ITableRow>();
+
+ public AbstractPageWithTable() {
+ this(true, null, null);
+ }
+
+ /**
+ * calling the constructor with callInitializer == false means, the table won't be constructed upon init
+ * but upon activation. this is a performance-optimization and especially recommended for tablepages
+ * where the parent is directly another table page (and no folder- or plain page) in this case the parent page can
+ * have a huge amount of child pages with a lot of tables to be constructed but never used.
+ *
+ * @param callInitializer
+ */
+ public AbstractPageWithTable(boolean callInitializer) {
+ this(callInitializer, null, null);
+ }
+
+ public AbstractPageWithTable(ContextMap contextMap) {
+ this(true, contextMap, null);
+ }
+
+ public AbstractPageWithTable(String userPreferenceContext) {
+ this(true, null, userPreferenceContext);
+ }
+
+ public AbstractPageWithTable(boolean callInitializer, ContextMap contextMap) {
+ this(callInitializer, contextMap, null);
+ }
+
+ public AbstractPageWithTable(boolean callInitializer, String userPreferenceContext) {
+ this(callInitializer, null, userPreferenceContext);
+ }
+
+ public AbstractPageWithTable(boolean callInitializer, ContextMap contextMap, String userPreferenceContext) {
+ super(callInitializer, contextMap, userPreferenceContext);
+ if (!callInitializer) {
+ callMinimalInitializer();
+ }
+ }
+
+ protected void callMinimalInitializer() {
+ setChildrenDirty(true);
+ setLeafInternal(getConfiguredLeaf());
+ setEnabledInternal(getConfiguredEnabled());
+ setExpandedInternal(getConfiguredExpanded());
+ }
+
+ /*
+ * Configuration
+ */
+ /**
+ * Configures the search form to be used with this table page. The search form is lazily
+ * {@linkplain #ensureSearchFormCreated() created} and {@linkplain #ensureSearchFormStarted() started}.
+ * <p>
+ * For legacy support, the search form can also be defined as an inner class. This usage is deprecated, override this
+ * method in subclasses instead.
+ * <p>
+ * Subclasses can override this method. Default is {@code null}.
+ *
+ * @return a search form type token
+ * @see ISearchForm
+ */
+ @ConfigProperty(ConfigProperty.SEARCH_FORM)
+ @Order(90)
+ @ConfigPropertyValue("null")
+ protected Class<? extends ISearchForm> getConfiguredSearchForm() {
+ return null;
+ }
+
+ /**
+ * Configures whether table data is automatically loaded (through a search with default constraints)
+ * or whether loading the table data must be triggered explicitly by the user. Set this property to {@code true} if
+ * you expect large amount of data for an unconstrained search.
+ * <p>
+ * This property is read by {@link #execPopulateTable()}, if you override that method, this configuration property
+ * might not have any effect. This configuration property does not have any effect if no search form is configured for
+ * this table page.
+ * <p>
+ * Subclasses can override this method. Default is {@code false}.
+ *
+ * @return {@code true} if the table data should be loaded on explicit user interaction, {@code false} otherwise
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(100)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredSearchRequired() {
+ return false;
+ }
+
+ /**
+ * Configures the visibility of empty space menus on this page's table. Empty space menus are typically available
+ * anywhere in a table field where no table rows are present (in the 'empty space'), as well as on the table header.
+ * Typical empty space menus will affect no (existing) row (for example a 'New row...' menu), or all rows in the table
+ * (for example a 'Clear all rows' menu).
+ * <p>
+ * Note that setting this property to {@code false} will effectively stop all empty space menus from being displayed
+ * on the GUI. However, if this property is set to {@code true}, single menus can still individually be set to
+ * invisible.
+ * <p>
+ * Subclasses can override this method. Default is {@code true}.
+ *
+ * @return {@code true} if empty space menus should generally be visible, {@code false} otherwise
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(110)
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredShowEmptySpaceMenus() {
+ return true;
+ }
+
+ /**
+ * Configures the visibility of table row menus on this page's table. Table row menus are typically available
+ * on each existing row. Typical table row menus will affect exactly one existing row (for example an 'Edit row...'
+ * menu or a 'Delete row' menu).
+ * <p>
+ * Note that setting this property to {@code false} will effectively stop all table row menus from being displayed on
+ * the GUI. However, if this property is set to {@code true}, single menus can still individually be set to invisible.
+ * <p>
+ * Subclasses can override this method. Default is {@code true}.
+ *
+ * @return {@code true} if table row menus should generally be visible, {@code false} otherwise
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(120)
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredShowTableRowMenus() {
+ return true;
+ }
+
+ /**
+ * Fetches and returns tabular data to be displayed in this page's table.
+ * Typically this method will query a (backend) service for the data. Make
+ * sure the returned content (including type definitions) matches the table columns.
+ * <p>
+ * This method is called by {@link #execPopulateTable()} and overriding this method generally is the most convenient
+ * way to populate a table page. If you need more control over populating a table page, consider overriding
+ * {@code execPopulateTable()} instead.
+ * <p>
+ * Subclasses can override this method. The default returns {@code null}.
+ *
+ * @param filter
+ * a search filter, guaranteed not to be {@code null}
+ * @return an {@code Object[][]} representing tabular data to be displayed in this page's table
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(90)
+ protected Object[][] execLoadTableData(SearchFilter filter) throws ProcessingException {
+ return null;
+ }
+
+ /**
+ * Populates this page's table.
+ * <p>
+ * It is good practice to populate table using {@code ITable.replaceRows} instead of {@code ITable.removeAllRows();
+ * ITable.addRows} because in the former case the outline tree structure below the changing rows is not discarded but
+ * only marked as dirty. The subtree is lazily reloaded when the user clicks next time on a child node.
+ * <p>
+ * Subclasses can override this method. In most cases it is sufficient to override
+ * {@link #execLoadTableData(SearchFilter)} instead.<br/>
+ * This default implementation does the following: It queries methods {@link #isSearchActive()} and
+ * {@link #isSearchRequired()} and then calls {@code execLoadTableData} if appropriate.
+ *
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(100)
+ protected void execPopulateTable() throws ProcessingException {
+ if (isSearchActive()) {
+ SearchFilter filter = getSearchFilter();
+ if (filter.isCompleted() || !isSearchRequired()) {
+ // create a copy of the filter, just in case the subprocess is modifying
+ // or extending the filter
+ filter = (SearchFilter) filter.clone();
+ //do NOT reference the result data object and warp it into a ref, so the processor is allowed to delete the contents to free up memory sooner
+ getTable().replaceRowsByMatrix(new AtomicReference<Object>(execLoadTableData(filter)));
+ }
+ }
+ else {
+ // searchFilter should never be null
+ //do NOT reference the result data object and warp it into a ref, so the processor is allowed to delete the contents to free up memory sooner
+ getTable().replaceRowsByMatrix(new AtomicReference<Object>(execLoadTableData(new SearchFilter())));
+ }
+ //update table data status
+ if (isSearchActive() && getSearchFilter() != null && (!getSearchFilter().isCompleted()) && isSearchRequired()) {
+ setPagePopulateStatus(new ProcessingStatus(ScoutTexts.get("TooManyRows"), ProcessingStatus.WARNING));
+ }
+ else {
+ setPagePopulateStatus(null);
+ }
+ }
+
+ /**
+ * Creates a child page for every table row that was added to this page's table. This method is called when
+ * resolving a virtual tree node to a real node. Overriding this method is the recommended way to build the
+ * outline tree structure.
+ * <p>
+ * Subclasses can override this method. The default returns {@code null}.
+ *
+ * @param row
+ * a table row for which a new child page should be created
+ * @return a new child page for {@code row}
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(110)
+ protected IPage execCreateChildPage(ITableRow row) throws ProcessingException {
+ return null;
+ }
+
+ protected IPage createChildPageInternal(ITableRow row) throws ProcessingException {
+ return execCreateChildPage(row);
+ }
+
+ /**
+ * Creates a virtual child page for every table row that was added to this page's table. The virtual page
+ * is a place holder for a real page and is transformed (resolved) into the real page when it is activated for the
+ * first time. This reduces memory consumption and improves performance for large table pages, where most of the child
+ * pages are never activated, but solely displayed in the outline tree.
+ * <p>
+ * Subclasses can override this method. In most cases it is preferable to override
+ * {@link #execCreateChildPage(ITableRow)} instead.<br/>
+ * This default implementation checks whether {@code execCreateChildPage} is overridden and returns a new virtual
+ * page, or {@code null} otherwise.
+ *
+ * @param row
+ * a table row for which a new virtual child page should be created
+ * @return a new virtual child page for {@code row}
+ * @throws ProcessingException
+ * @see VirtualPage
+ * @see IVirtualTreeNode
+ */
+ @ConfigOperation
+ @Order(111)
+ protected IPage execCreateVirtualChildPage(ITableRow row) throws ProcessingException {
+ if (ConfigurationUtility.isMethodOverwrite(AbstractPageWithTable.class, "execCreateChildPage", new Class[]{ITableRow.class}, AbstractPageWithTable.this.getClass())) {
+ return new VirtualPage();
+ }
+ return null;
+ }
+
+ /**
+ * Resolves a virtual tree node and returns the real tree node.
+ * <p>
+ * This implementation does the following:
+ * <ul>
+ * <li>returns {@code null} if no table row is linked to {@code node}
+ * <li>else creates a new child page by calling {@link #execCreateChildPage(ITableRow)}, links the table row to the
+ * new tree node and returns the new node.
+ * </ul>
+ *
+ * @param node
+ * the virtual tree node to be resolved
+ * @return a new real tree node, replacing the virtual tree node
+ * @throws ProcessingException
+ */
+ @Override
+ protected ITreeNode execResolveVirtualChildNode(IVirtualTreeNode node) throws ProcessingException {
+ ITableRow row = getTableRowFor(node);
+ if (row == null) {
+ return null;
+ }
+ //remove old association
+ unlinkTableRowWithPage(row);
+ //add new association
+ IPage childPage = createChildPageInternal(row);
+ if (childPage != null) {
+ node.setResolvedNode(childPage);
+ ICell tableCell = m_table.getSummaryCell(row);
+ childPage.setFilterAccepted(row.isFilterAccepted());
+ childPage.setEnabledInternal(row.isEnabled());
+ childPage.getCellForUpdate().updateFrom(tableCell);
+ linkTableRowWithPage(row, childPage);
+ }
+ return childPage;
+ }
+
+ private Class<? extends ITable> getConfiguredTable() {
+ Class<?>[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
+ return ConfigurationUtility.filterClass(dca, ITable.class);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ protected void initConfig() {
+ super.initConfig();
+ m_searchActive = true;
+ setSearchRequired(getConfiguredSearchRequired());
+ setShowEmptySpaceMenus(getConfiguredShowEmptySpaceMenus());
+ setShowTableRowMenus(getConfiguredShowTableRowMenus());
+ Class<? extends ITable> tableClass = getConfiguredTable();
+ if (tableClass != null) {
+ try {
+ m_table = (T) ConfigurationUtility.newInnerInstance(this, tableClass);
+ if (m_table instanceof AbstractTable) {
+ ((AbstractTable) m_table).setContainerInternal(this);
+ }
+ m_table.addTableListener(new P_TableListener());
+ m_table.setEnabled(isEnabled());
+ m_table.setAutoDiscardOnDelete(true);
+ m_table.setUserPreferenceContext(getUserPreferenceContext());
+ m_table.initTable();
+ }
+ catch (Exception e) {
+ LOG.warn(null, e);
+ }
+ }
+ // legacy-support for searchform-inner classes
+ if (getConfiguredSearchForm() == null) {
+ Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
+ Class<? extends ISearchForm> searchFormClass = ConfigurationUtility.filterClass(dca, ISearchForm.class);
+ if (searchFormClass != null) {
+ LOG.warn("inner searchforms are deprecated...");
+ try {
+ setSearchForm(ConfigurationUtility.newInnerInstance(this, searchFormClass));
+ }
+ catch (Exception e) {
+ LOG.warn(null, e);
+ }
+ }
+ }
+ }
+
+ /**
+ * Ensures that the search form is initialized but not started, if one is defined for this table at all. This allows
+ * lazy
+ * initialization of search forms.
+ */
+ protected void ensureSearchFormCreated() {
+ if (m_searchForm == null && getConfiguredSearchForm() != null) {
+ // there is no search form, but should be
+ try {
+ setSearchForm(getConfiguredSearchForm().newInstance());
+ }
+ catch (Exception e) {
+ LOG.warn(null, e);
+ }
+ }
+ }
+
+ /**
+ * Ensures that the search form is started (lazy starting)
+ */
+ protected void ensureSearchFormStarted() {
+ if (m_searchForm != null && !m_searchForm.isFormOpen()) {
+ try {
+ m_searchForm.startSearch();
+ notifyMemoryPolicyOfSearchFormStart();
+ }
+ catch (Exception e) {
+ LOG.warn(null, e);
+ }
+ }
+ }
+
+ private void attachToSearchFormInternal() {
+ if (m_searchForm == null) {
+ return;
+ }
+ m_searchForm.setDisplayHint(ISearchForm.DISPLAY_HINT_VIEW);
+ if (m_searchForm.getDisplayViewId() == null) {
+ m_searchForm.setDisplayViewId(IForm.VIEW_ID_PAGE_SEARCH);
+ }
+ m_searchForm.setAutoAddRemoveOnDesktop(false);
+ // listen for search action
+ m_searchFormListener = new FormListener() {
+ @Override
+ public void formChanged(FormEvent e) throws ProcessingException {
+ switch (e.getType()) {
+ case FormEvent.TYPE_STORE_AFTER: {
+ // save navigation history
+ IDesktop desktop = ClientSyncJob.getCurrentSession().getDesktop();
+ IPage page = AbstractPageWithTable.this;
+ if (desktop != null && desktop.getOutline() != null && desktop.getOutline().getActivePage() == page) {
+ SERVICES.getService(INavigationHistoryService.class).addStep(0, page);
+ }
+ // do page reload to execute search
+ try {
+ reloadPage();
+ }
+ catch (ProcessingException ex) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(ex);
+ }
+ break;
+ }
+ }
+ }
+ };
+ m_searchForm.addFormListener(m_searchFormListener);
+ try {
+ execInitSearchForm();
+ }
+ catch (Exception e) {
+ LOG.warn(null, e);
+ }
+ }
+
+ private void detachFromSearchFormInternal() {
+ if (m_searchForm == null) {
+ return;
+ }
+ // listen for search action
+ if (m_searchFormListener != null) {
+ m_searchForm.removeFormListener(m_searchFormListener);
+ m_searchFormListener = null;
+ }
+ }
+
+ private void notifyMemoryPolicyOfSearchFormStart() {
+ //use memory policy to handle content caching
+ try {
+ IMemoryPolicy policy = ClientSyncJob.getCurrentSession().getMemoryPolicy();
+ if (policy != null) {
+ policy.pageSearchFormStarted(this);
+ }
+ }
+ catch (Throwable t) {
+ LOG.error("pageCreated " + getClass().getSimpleName(), t);
+ }
+ }
+
+ /**
+ * Initializes the search form associated with this page. This method is called before the
+ * search form is used for the first time.
+ * <p>
+ * Legacy: If the search form is defined as inner class, this method is called when this page is initialized.
+ * <p>
+ * Subclasses can override this method. The default does nothing.
+ *
+ * @throws ProcessingException
+ * @see #ensureSearchFormCreated()
+ * @see #ensureSearchFormStarted()
+ */
+ @ConfigOperation
+ @Order(120)
+ protected void execInitSearchForm() throws ProcessingException {
+ }
+
+ @Override
+ public final T getTable() {
+ if (m_table == null) {
+ ensureInitialized();
+ }
+ return m_table;
+ }
+
+ @Override
+ public boolean isShowEmptySpaceMenus() {
+ return m_showEmptySpaceMenus;
+ }
+
+ @Override
+ public void setShowEmptySpaceMenus(boolean showEmptySpaceMenus) {
+ m_showEmptySpaceMenus = showEmptySpaceMenus;
+ }
+
+ @Override
+ public boolean isShowTableRowMenus() {
+ return m_showTableRowMenus;
+ }
+
+ @Override
+ public void setShowTableRowMenus(boolean showTableRowMenus) {
+ m_showTableRowMenus = showTableRowMenus;
+ }
+
+ @Override
+ public ISearchForm getSearchFormInternal() {
+ ensureSearchFormCreated();
+ return m_searchForm;
+ }
+
+ public void setSearchForm(ISearchForm searchForm) {
+ if (m_searchForm == searchForm) {
+ return;
+ }
+ detachFromSearchFormInternal();
+ m_searchForm = searchForm;
+ attachToSearchFormInternal();
+ }
+
+ @Override
+ public SearchFilter getSearchFilter() {
+ ensureSearchFormCreated();
+ ensureSearchFormStarted();
+ if (getSearchFormInternal() != null) {
+ return getSearchFormInternal().getSearchFilter();
+ }
+ else {
+ ISearchFilterService sfs = SERVICES.getService(ISearchFilterService.class);
+ if (sfs != null) {
+ return sfs.createNewSearchFilter();
+ }
+ else {
+ return new SearchFilter();
+ }
+ }
+ }
+
+ @Override
+ public boolean isSearchRequired() {
+ return m_searchRequired;
+ }
+
+ @Override
+ public void setSearchRequired(boolean b) {
+ m_searchRequired = b;
+ }
+
+ @Override
+ public void setEnabled(boolean b) {
+ super.setEnabled(b);
+ if (m_table != null) {
+ m_table.setEnabled(isEnabled());
+ }
+ }
+
+ @Override
+ public boolean isSearchActive() {
+ return m_searchActive;
+ }
+
+ @Override
+ public void setSearchActive(boolean b) {
+ m_searchActive = b;
+ if (isSelectedNode()) {
+ getOutline().setSearchForm(m_searchActive ? getSearchFormInternal() : null);
+ }
+ }
+
+ @Override
+ public void pageActivatedNotify() {
+ ensureInitialized();
+ ensureSearchFormCreated();
+ ensureSearchFormStarted();
+ super.pageActivatedNotify();
+ }
+
+ @Override
+ public void setPagePopulateStatus(IProcessingStatus status) {
+ super.setPagePopulateStatus(status);
+ getTable().tablePopulated();
+ }
+
+ @Override
+ @SuppressWarnings("deprecation")
+ public IProcessingStatus getTablePopulateStatus() {
+ return getPagePopulateStatus();
+ }
+
+ @Override
+ @SuppressWarnings("deprecation")
+ public void setTablePopulateStatus(IProcessingStatus status) {
+ setPagePopulateStatus(status);
+ }
+
+ /**
+ * load table data
+ */
+ private void loadTableDataImpl() throws ProcessingException {
+ if (m_table != null) {
+ try {
+ m_table.setTableChanging(true);
+ //
+ ensureSearchFormCreated();
+ ensureSearchFormStarted();
+ execPopulateTable();
+ }
+ catch (Throwable t) {
+ m_table.discardAllRows();
+ ProcessingException pe;
+ if (t instanceof ProcessingException) {
+ pe = (ProcessingException) t;
+ }
+ else {
+ pe = new ProcessingException(t.getMessage(), t);
+ }
+ if (pe.isInterruption()) {
+ setPagePopulateStatus(new ProcessingStatus(ScoutTexts.get("SearchWasCanceled"), ProcessingStatus.CANCEL));
+ }
+ else {
+ setPagePopulateStatus(new ProcessingStatus(ScoutTexts.get("ErrorWhileLoadingData"), ProcessingStatus.CANCEL));
+ }
+ throw pe;
+ }
+ finally {
+ m_table.setTableChanging(false);
+ }
+ }
+ }
+
+ /**
+ * load tree children<br>
+ * this method delegates to the table reload<br>
+ * when the table is loaded and this node is not a leaf node then the table
+ * rows are mirrored in child nodes
+ */
+ @Override
+ public final void loadChildren() throws ProcessingException {
+ ITree tree = getTree();
+ try {
+ if (tree != null) {
+ tree.setTreeChanging(true);
+ }
+ //
+ // backup currently selected tree node and its path to root
+ boolean oldSelectionOwned = false;
+ int oldSelectionDirectChildIndex = -1;
+ ITreeNode oldSelectedNode = null;
+ if (tree != null) {
+ oldSelectedNode = tree.getSelectedNode();
+ }
+ Object[] oldSelectedRowKeys = null;
+ if (oldSelectedNode != null) {
+ ITreeNode t = oldSelectedNode;
+ while (t != null && t.getParentNode() != null) {
+ if (t.getParentNode() == this) {
+ oldSelectionOwned = true;
+ oldSelectedRowKeys = getTableRowFor(t).getKeyValues();
+ oldSelectionDirectChildIndex = t.getChildNodeIndex();
+ break;
+ }
+ t = t.getParentNode();
+ }
+ }
+ //
+ setChildrenLoaded(false);
+ ClientSyncJob.getCurrentSession().getMemoryPolicy().beforeTablePageLoadData(this);
+ try {
+ loadTableDataImpl();
+ }
+ catch (ProcessingException pe) {
+ if (!pe.isInterruption()) {
+ throw pe;
+ }
+ }
+ finally {
+ ClientSyncJob.getCurrentSession().getMemoryPolicy().afterTablePageLoadData(this);
+ }
+ setChildrenLoaded(true);
+ setChildrenDirty(false);
+ // table events will handle automatic tree changes in case table is
+ // mirrored in tree.
+ // restore currently selected tree node when it was owned by our table
+ // rows.
+ // in case selection was lost, try to select similar index as before
+
+ if (tree != null && oldSelectionOwned && tree.getSelectedNode() == null) {
+ ITreeNode newSelectedNode = null;
+ ITableRow row = getTable().getSelectedRow();
+ if (row != null) {
+ newSelectedNode = getTreeNodeFor(row);
+ }
+ else {
+ row = getTable().findRowByKey(oldSelectedRowKeys);
+ if (row != null) {
+ newSelectedNode = getTreeNodeFor(row);
+ }
+ else if (oldSelectedNode != null && oldSelectedNode.getTree() == tree) {
+ newSelectedNode = oldSelectedNode;
+ }
+ else {
+ int index = Math.max(-1, Math.min(oldSelectionDirectChildIndex, getChildNodeCount() - 1));
+ if (index >= 0 && index < getChildNodeCount()) {
+ newSelectedNode = getChildNode(index);
+ }
+ else {
+ newSelectedNode = this;
+ }
+ }
+ }
+ if (newSelectedNode != null) {
+ newSelectedNode = tree.resolveVirtualNode(newSelectedNode);
+ tree.selectNode(newSelectedNode);
+ }
+ }
+ }
+ finally {
+ if (tree != null) {
+ tree.setTreeChanging(false);
+ }
+ }
+ IDesktop desktop = ClientSyncJob.getCurrentSession().getDesktop();
+ if (desktop != null) {
+ desktop.afterTablePageLoaded(this);
+ }
+ }
+
+ private void linkTableRowWithPage(ITableRow tableRow, IPage page) {
+ m_tableRowToPageMap.put(tableRow, page);
+ m_pageToTableRowMap.put(page, tableRow);
+ }
+
+ private void unlinkTableRowWithPage(ITableRow tableRow) {
+ IPage page = m_tableRowToPageMap.remove(tableRow);
+ if (page != null) {
+ m_pageToTableRowMap.remove(page);
+ }
+ }
+
+ @Override
+ public IPage[] getUpdatedChildPagesFor(ITableRow[] tableRows) {
+ return getChildPagesFor(tableRows, true);
+ }
+
+ /**
+ * Computes the list of linked child pages for the given table rows. Revalidates the the pages cell
+ * if <code>updateChildPageCells</code> is true. Otherwise, the cells are not updated.
+ */
+ private IPage[] getChildPagesFor(ITableRow[] tableRows, boolean updateChildPageCells) {
+ IPage[] pages = new IPage[tableRows.length];
+ int missingCount = 0;
+ try {
+ for (int i = 0; i < tableRows.length; i++) {
+ pages[i] = m_tableRowToPageMap.get(tableRows[i]);
+ if (pages[i] != null) {
+ if (updateChildPageCells) {
+ // update tree nodes from table rows
+ ICell tableCell = getTable().getSummaryCell(tableRows[i]);
+ pages[i].setEnabledInternal(tableRows[i].isEnabled());
+ pages[i].getCellForUpdate().updateFrom(tableCell);
+ }
+ }
+ else {
+ missingCount++;
+ }
+ }
+ }
+ catch (ProcessingException e) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ if (missingCount > 0) {
+ IPage[] tmp = new IPage[pages.length - missingCount];
+ int index = 0;
+ for (IPage element : pages) {
+ if (element != null) {
+ tmp[index] = element;
+ index++;
+ }
+ }
+ pages = tmp;
+ }
+ return pages;
+ }
+
+ @Override
+ public ITreeNode getTreeNodeFor(ITableRow tableRow) {
+ if (tableRow == null) {
+ return null;
+ }
+ else {
+ return m_tableRowToPageMap.get(tableRow);
+ }
+ }
+
+ @Override
+ public ITableRow getTableRowFor(ITreeNode childPageNode) {
+ return m_pageToTableRowMap.get(childPageNode);
+ }
+
+ @Override
+ public ITableRow[] getTableRowsFor(ITreeNode[] childPageNodes) {
+ ITableRow[] rows = new ITableRow[childPageNodes.length];
+ int missingCount = 0;
+ for (int i = 0; i < childPageNodes.length; i++) {
+ rows[i] = m_pageToTableRowMap.get(childPageNodes[i]);
+ if (rows[i] == null) {
+ missingCount++;
+ }
+ }
+ if (missingCount > 0) {
+ ITableRow[] tmp = new ITableRow[rows.length - missingCount];
+ int index = 0;
+ for (ITableRow element : rows) {
+ if (element != null) {
+ tmp[index] = element;
+ index++;
+ }
+ }
+ rows = tmp;
+ }
+ return rows;
+ }
+
+ private OutlineMediator getOutlineMediator() {
+ if (getOutline() == null) {
+ return null;
+ }
+
+ return getOutline().getOutlineMediator();
+ }
+
+ /**
+ * Table listener and tree controller<br>
+ * the table is reflected in tree children only if the tree/page node is not
+ * marked as being a leaf
+ */
+ private class P_TableListener extends TableAdapter {
+ @Override
+ public void tableChanged(TableEvent e) {
+ OutlineMediator outlineMediator = getOutlineMediator();
+
+ switch (e.getType()) {
+ case TableEvent.TYPE_ROW_ACTION: {
+ if (outlineMediator != null) {
+ outlineMediator.mediateTableRowAction(e, AbstractPageWithTable.this);
+ }
+ break;
+ }
+ case TableEvent.TYPE_ALL_ROWS_DELETED:
+ case TableEvent.TYPE_ROWS_DELETED: {
+ if (!isLeaf()) {
+ ITableRow[] tableRows = e.getRows();
+ IPage[] childNodes = getChildPagesFor(tableRows, false);
+ for (int i = 0; i < childNodes.length; i++) {
+ unlinkTableRowWithPage(tableRows[i]);
+ }
+
+ if (outlineMediator != null) {
+ outlineMediator.mediateTableRowsDeleted(childNodes, AbstractPageWithTable.this);
+ }
+ }
+ break;
+ }
+ case TableEvent.TYPE_ROWS_INSERTED: {
+ if (!isLeaf()) {
+ ArrayList<IPage> childPageList = new ArrayList<IPage>();
+ ITableRow[] tableRows = e.getRows();
+ for (ITableRow element : tableRows) {
+ try {
+ IPage childPage = execCreateVirtualChildPage(element);
+ if (childPage != null) {
+ ICell tableCell = m_table.getSummaryCell(element);
+ childPage.getCellForUpdate().updateFrom(tableCell);
+ linkTableRowWithPage(element, childPage);
+ childPageList.add(childPage);
+ }
+ }
+ catch (ProcessingException ex) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(ex);
+ }
+ catch (Throwable t) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Page " + element, t));
+ }
+ }
+
+ if (outlineMediator != null) {
+ IPage[] childPages = childPageList.toArray(new IPage[childPageList.size()]);
+ outlineMediator.mediateTableRowsInserted(tableRows, childPages, AbstractPageWithTable.this);
+ }
+
+ // check if a page was revoked
+ for (ITableRow element : tableRows) {
+ IPage page = m_tableRowToPageMap.get(element);
+ if (page != null && page.getParentNode() == null) {
+ unlinkTableRowWithPage(element);
+ }
+ }
+ }
+ break;
+ }
+ case TableEvent.TYPE_ROWS_UPDATED: {
+ if (outlineMediator != null) {
+ outlineMediator.mediateTableRowsUpdated(e, AbstractPageWithTable.this);
+ }
+ break;
+ }
+ case TableEvent.TYPE_ROW_ORDER_CHANGED: {
+ if (outlineMediator != null) {
+ outlineMediator.mediateTableRowOrderChanged(e, AbstractPageWithTable.this);
+ }
+ break;
+ }
+ case TableEvent.TYPE_ROWS_SELECTED: {
+ break;
+ }
+ case TableEvent.TYPE_ROW_FILTER_CHANGED: {
+ if (outlineMediator != null) {
+ outlineMediator.mediateTableRowFilterChanged(AbstractPageWithTable.this);
+ }
+ break;
+ }
+ }// end switch
+ }
+
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/pages/AbstractSearchForm.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/pages/AbstractSearchForm.java
index 3aa43635b5..db1f421b00 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/pages/AbstractSearchForm.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/pages/AbstractSearchForm.java
@@ -1,50 +1,50 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.desktop.outline.pages;
-
-import org.eclipse.scout.commons.ConfigurationUtility;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.form.AbstractForm;
-import org.eclipse.scout.rt.client.ui.form.IFormHandler;
-
-/**
- * Search form for the outline must contain a SearchHandler<br>
- * The method startSearch() starts the first inner class of type IFormHandler
- * that is found
- */
-public abstract class AbstractSearchForm extends AbstractForm implements ISearchForm {
-
- public AbstractSearchForm() throws ProcessingException {
- super();
- }
-
- @ConfigPropertyValue("true")
- @Override
- protected boolean getConfiguredMinimizeEnabled() {
- return true;
- }
-
- @ConfigPropertyValue("false")
- @Override
- protected boolean getConfiguredAskIfNeedSave() {
- return false;
- }
-
- private Class<? extends IFormHandler> getConfiguredSearchHandler() {
- Class<?>[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
- return ConfigurationUtility.filterClass(dca, IFormHandler.class);
- }
-
- @Override
- public abstract void startSearch() throws ProcessingException;
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.desktop.outline.pages;
+
+import org.eclipse.scout.commons.ConfigurationUtility;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.form.AbstractForm;
+import org.eclipse.scout.rt.client.ui.form.IFormHandler;
+
+/**
+ * Search form for the outline must contain a SearchHandler<br>
+ * The method startSearch() starts the first inner class of type IFormHandler
+ * that is found
+ */
+public abstract class AbstractSearchForm extends AbstractForm implements ISearchForm {
+
+ public AbstractSearchForm() throws ProcessingException {
+ super();
+ }
+
+ @ConfigPropertyValue("true")
+ @Override
+ protected boolean getConfiguredMinimizeEnabled() {
+ return true;
+ }
+
+ @ConfigPropertyValue("false")
+ @Override
+ protected boolean getConfiguredAskIfNeedSave() {
+ return false;
+ }
+
+ private Class<? extends IFormHandler> getConfiguredSearchHandler() {
+ Class<?>[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
+ return ConfigurationUtility.filterClass(dca, IFormHandler.class);
+ }
+
+ @Override
+ public abstract void startSearch() throws ProcessingException;
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/pages/IPage.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/pages/IPage.java
index 9954e5d295..f04c0824f1 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/pages/IPage.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/pages/IPage.java
@@ -1,135 +1,135 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.desktop.outline.pages;
-
-import org.eclipse.scout.commons.exception.IProcessingStatus;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
-import org.eclipse.scout.rt.client.ui.form.AbstractForm;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.client.ui.form.fields.AbstractFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.tablefield.ITableField;
-
-/**
- * A page is a tree node for the outline and a table in the main view<br>
- * Depending on the source of your content, you should consider one of the two implementation type.
- * <dl>
- * <dt>Node page</dt>
- * <dd>Node-oriented page: the content is defined as child pages, the table in the main view display the list of child
- * pages see {@link IPageWithNodes}
- * <dt>Table page</dt>
- * <dd>Table-oriented page: the content is loaded from a outline service and displayed in the table of the main view see
- * {@link IPageWithTable} In the outline, it is possible to drill down the content of the node (except if the page is
- * configured as a leaf)
- */
-public abstract interface IPage extends ITreeNode {
-
- void initPage() throws ProcessingException;
-
- /**
- * @deprecated use {@link #getUserPreferenceContext()} instead
- */
- @Deprecated
- String getBookmarkIdentifier();
-
- /**
- * This method is used to override the bookmark identifier used for this page
- * in case multiple instances of this page are used in the same child list<br>
- * By default this returns null.
- * <p>
- * Note that the value of this id is final and <b>not</b> dynamic to prevent some unexpected behaviours due to id
- * changes during lifetime of the page. Such as persistent store of search context, table width, column order etc.
- */
- String getUserPreferenceContext();
-
- IOutline getOutline();
-
- /**
- * Reload this page content.<br>
- * This will first remove all child nodes, add new nodes/table rows and
- * trigger execPageDataLoaded
- */
- void reloadPage() throws ProcessingException;
-
- /**
- * @return the detail form, the detail form is not automatically started<br>
- * This returns the detail form for THIS node (page), NOT for child
- * nodes of this page
- */
- IForm getDetailForm();
-
- /**
- * set the detail form, the form must either be in non-started state or
- * displayHint must be {@link IForm#DISPLAY_HINT_VIEW} and {@link IForm#isAutoAddRemoveOnDesktop()} must be false
- */
- void setDetailForm(IForm form);
-
- /**
- * @return the child page at the index
- * Note that this is <b>not</b> exactly the same as (IPage)getChildNode().
- * see {@link VirtualPage} for more details.
- */
- IPage getChildPage(int index);
-
- /**
- * @return all child pages
- * Note that this is <b>not</b> exactly the same as (IPage[])getChildNodes().
- * see {@link VirtualPage} for more details.
- * <p>
- * Note: Calling this method effectively creates all child page objects and may be expensive on pages with
- * many child pages.
- */
- IPage[] getChildPages();
-
- /**
- * Convenience for (IPage)getParentNode()
- */
- IPage getParentPage();
-
- boolean isTableVisible();
-
- void setTableVisible(boolean b);
-
- /**
- * see {@link ITableField#getTablePopulateStatus()}
- * <p>
- * This method is temporary and will be removed in future releases (long term) when the {@link IPage} is legacy and
- * replaced by a simple page with just N forms.
- *
- * @since 3.8.2
- */
- IProcessingStatus getPagePopulateStatus();
-
- /**
- * see {@link ITableField#setTablePopulateStatus(IProcessingStatus)}
- * <p>
- * This method is temporary and will be removed in future releases (long term) when the {@link IPage} is legacy and
- * replaced by a simple page with just N forms.
- *
- * @since 3.8.2
- */
- void setPagePopulateStatus(IProcessingStatus status);
-
- /**
- * Call this method to refresh all listeners on that dataTypes.<br>
- * These might include pages, forms, fields etc.<br>
- *
- * @see {@link AbstractForm#execDataChanged(Object...)} {@link AbstractForm#execDataChanged(Object...)}
- * {@link AbstractFormField#execDataChanged(Object...)} {@link AbstractFormField#execDataChanged(Object...)}
- * {@link AbstractPage#execDataChanged(Object...)} {@link AbstractPage#execDataChanged(Object...)}
- */
- void dataChanged(Object... dataTypes);
-
- void pageActivatedNotify();
-
- void pageDeactivatedNotify();
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.desktop.outline.pages;
+
+import org.eclipse.scout.commons.exception.IProcessingStatus;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
+import org.eclipse.scout.rt.client.ui.form.AbstractForm;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.client.ui.form.fields.AbstractFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.tablefield.ITableField;
+
+/**
+ * A page is a tree node for the outline and a table in the main view<br>
+ * Depending on the source of your content, you should consider one of the two implementation type.
+ * <dl>
+ * <dt>Node page</dt>
+ * <dd>Node-oriented page: the content is defined as child pages, the table in the main view display the list of child
+ * pages see {@link IPageWithNodes}
+ * <dt>Table page</dt>
+ * <dd>Table-oriented page: the content is loaded from a outline service and displayed in the table of the main view see
+ * {@link IPageWithTable} In the outline, it is possible to drill down the content of the node (except if the page is
+ * configured as a leaf)
+ */
+public abstract interface IPage extends ITreeNode {
+
+ void initPage() throws ProcessingException;
+
+ /**
+ * @deprecated use {@link #getUserPreferenceContext()} instead
+ */
+ @Deprecated
+ String getBookmarkIdentifier();
+
+ /**
+ * This method is used to override the bookmark identifier used for this page
+ * in case multiple instances of this page are used in the same child list<br>
+ * By default this returns null.
+ * <p>
+ * Note that the value of this id is final and <b>not</b> dynamic to prevent some unexpected behaviours due to id
+ * changes during lifetime of the page. Such as persistent store of search context, table width, column order etc.
+ */
+ String getUserPreferenceContext();
+
+ IOutline getOutline();
+
+ /**
+ * Reload this page content.<br>
+ * This will first remove all child nodes, add new nodes/table rows and
+ * trigger execPageDataLoaded
+ */
+ void reloadPage() throws ProcessingException;
+
+ /**
+ * @return the detail form, the detail form is not automatically started<br>
+ * This returns the detail form for THIS node (page), NOT for child
+ * nodes of this page
+ */
+ IForm getDetailForm();
+
+ /**
+ * set the detail form, the form must either be in non-started state or
+ * displayHint must be {@link IForm#DISPLAY_HINT_VIEW} and {@link IForm#isAutoAddRemoveOnDesktop()} must be false
+ */
+ void setDetailForm(IForm form);
+
+ /**
+ * @return the child page at the index
+ * Note that this is <b>not</b> exactly the same as (IPage)getChildNode().
+ * see {@link VirtualPage} for more details.
+ */
+ IPage getChildPage(int index);
+
+ /**
+ * @return all child pages
+ * Note that this is <b>not</b> exactly the same as (IPage[])getChildNodes().
+ * see {@link VirtualPage} for more details.
+ * <p>
+ * Note: Calling this method effectively creates all child page objects and may be expensive on pages with
+ * many child pages.
+ */
+ IPage[] getChildPages();
+
+ /**
+ * Convenience for (IPage)getParentNode()
+ */
+ IPage getParentPage();
+
+ boolean isTableVisible();
+
+ void setTableVisible(boolean b);
+
+ /**
+ * see {@link ITableField#getTablePopulateStatus()}
+ * <p>
+ * This method is temporary and will be removed in future releases (long term) when the {@link IPage} is legacy and
+ * replaced by a simple page with just N forms.
+ *
+ * @since 3.8.2
+ */
+ IProcessingStatus getPagePopulateStatus();
+
+ /**
+ * see {@link ITableField#setTablePopulateStatus(IProcessingStatus)}
+ * <p>
+ * This method is temporary and will be removed in future releases (long term) when the {@link IPage} is legacy and
+ * replaced by a simple page with just N forms.
+ *
+ * @since 3.8.2
+ */
+ void setPagePopulateStatus(IProcessingStatus status);
+
+ /**
+ * Call this method to refresh all listeners on that dataTypes.<br>
+ * These might include pages, forms, fields etc.<br>
+ *
+ * @see {@link AbstractForm#execDataChanged(Object...)} {@link AbstractForm#execDataChanged(Object...)}
+ * {@link AbstractFormField#execDataChanged(Object...)} {@link AbstractFormField#execDataChanged(Object...)}
+ * {@link AbstractPage#execDataChanged(Object...)} {@link AbstractPage#execDataChanged(Object...)}
+ */
+ void dataChanged(Object... dataTypes);
+
+ void pageActivatedNotify();
+
+ void pageDeactivatedNotify();
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/pages/IPageWithNodes.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/pages/IPageWithNodes.java
index 5de6a4e932..60dec60aca 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/pages/IPageWithNodes.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/pages/IPageWithNodes.java
@@ -1,48 +1,48 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.desktop.outline.pages;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
-
-/**
- * Node-oriented page (one of the two types of IPage @see IPage)<br>
- * <p>
- * Contains a set of child pages (defined in execCreateChildPages() function)<br>
- * This page is suitable if you want to define the tree (the table is derived from the tree)<br>
- * If the note is not marked as leaf, it is possible to drill-down the child pages in the outline <br>
- * <p>
- * contains a table as data holder<br>
- * table events are handled by the configured inner table<br>
- * tree events are delegated to the table<br>
- */
-public interface IPageWithNodes extends IPage {
-
- ITable getInternalTable();
-
- ITreeNode getTreeNodeFor(ITableRow tableRow);
-
- /**
- * @since 3.8.2
- */
- ITableRow getTableRowFor(ITreeNode childPageNode);
-
- /**
- * @param childPageNode
- * @return the value {@link ITableRow#isFilterAccepted()} on the corresponding row of the inner table
- */
- boolean isFilterAcceptedForChildNode(ITreeNode childPageNode);
-
- void rebuildTableInternal() throws ProcessingException;
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.desktop.outline.pages;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
+
+/**
+ * Node-oriented page (one of the two types of IPage @see IPage)<br>
+ * <p>
+ * Contains a set of child pages (defined in execCreateChildPages() function)<br>
+ * This page is suitable if you want to define the tree (the table is derived from the tree)<br>
+ * If the note is not marked as leaf, it is possible to drill-down the child pages in the outline <br>
+ * <p>
+ * contains a table as data holder<br>
+ * table events are handled by the configured inner table<br>
+ * tree events are delegated to the table<br>
+ */
+public interface IPageWithNodes extends IPage {
+
+ ITable getInternalTable();
+
+ ITreeNode getTreeNodeFor(ITableRow tableRow);
+
+ /**
+ * @since 3.8.2
+ */
+ ITableRow getTableRowFor(ITreeNode childPageNode);
+
+ /**
+ * @param childPageNode
+ * @return the value {@link ITableRow#isFilterAccepted()} on the corresponding row of the inner table
+ */
+ boolean isFilterAcceptedForChildNode(ITreeNode childPageNode);
+
+ void rebuildTableInternal() throws ProcessingException;
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/pages/IPageWithTable.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/pages/IPageWithTable.java
index 76fcc6c18b..d571be88b9 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/pages/IPageWithTable.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/pages/IPageWithTable.java
@@ -1,85 +1,85 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.desktop.outline.pages;
-
-import org.eclipse.scout.commons.exception.IProcessingStatus;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
-import org.eclipse.scout.rt.shared.services.common.jdbc.SearchFilter;
-
-/**
- * Table-oriented page (one of the two types of IPage @see IPage)<br>
- * <p>
- * Main concern is the content of the table.<br>
- * Usually child pages are added (one for each row in the table) to provide the possibility to drill down the content of
- * the table. (defined in the execCreateChildPage(row))<br>
- * <p>
- * tree events are handled manually using exec.. methods<br>
- * table events are delegated to the tree<br>
- */
-public interface IPageWithTable<T extends ITable> extends IPage {
-
- T getTable();
-
- /**
- * @deprecated use {@link IPage#getPagePopulateStatus()}
- */
- @Deprecated
- IProcessingStatus getTablePopulateStatus();
-
- /**
- * @deprecated use {@link IPage#setPagePopulateStatus(IProcessingStatus)}
- */
- @Deprecated
- void setTablePopulateStatus(IProcessingStatus status);
-
- ITreeNode getTreeNodeFor(ITableRow tableRow);
-
- ITableRow getTableRowFor(ITreeNode childPageNode);
-
- ITableRow[] getTableRowsFor(ITreeNode[] childPageNodes);
-
- /**
- * Computes the list of linked child pages for the given table rows and updates their summary cell.
- */
- public IPage[] getUpdatedChildPagesFor(ITableRow[] tableRows);
-
- /**
- * @return search form that is used to filter table rows<br>
- * Note that the form will be started at latest after being added to
- * the outline tree inside {@link IPage#initPage()} resps in {@link IPage#execInitPage()}
- */
- ISearchForm getSearchFormInternal();
-
- boolean isSearchRequired();
-
- void setSearchRequired(boolean b);
-
- boolean isSearchActive();
-
- void setSearchActive(boolean b);
-
- /**
- * Convenience for getting the search filter from the page's search form
- *
- * @return life reference to the filter (never null)
- */
- SearchFilter getSearchFilter();
-
- boolean isShowTableRowMenus();
-
- void setShowTableRowMenus(boolean showTableRowMenus);
-
- boolean isShowEmptySpaceMenus();
-
- void setShowEmptySpaceMenus(boolean showEmptySpaceMenus);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.desktop.outline.pages;
+
+import org.eclipse.scout.commons.exception.IProcessingStatus;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
+import org.eclipse.scout.rt.shared.services.common.jdbc.SearchFilter;
+
+/**
+ * Table-oriented page (one of the two types of IPage @see IPage)<br>
+ * <p>
+ * Main concern is the content of the table.<br>
+ * Usually child pages are added (one for each row in the table) to provide the possibility to drill down the content of
+ * the table. (defined in the execCreateChildPage(row))<br>
+ * <p>
+ * tree events are handled manually using exec.. methods<br>
+ * table events are delegated to the tree<br>
+ */
+public interface IPageWithTable<T extends ITable> extends IPage {
+
+ T getTable();
+
+ /**
+ * @deprecated use {@link IPage#getPagePopulateStatus()}
+ */
+ @Deprecated
+ IProcessingStatus getTablePopulateStatus();
+
+ /**
+ * @deprecated use {@link IPage#setPagePopulateStatus(IProcessingStatus)}
+ */
+ @Deprecated
+ void setTablePopulateStatus(IProcessingStatus status);
+
+ ITreeNode getTreeNodeFor(ITableRow tableRow);
+
+ ITableRow getTableRowFor(ITreeNode childPageNode);
+
+ ITableRow[] getTableRowsFor(ITreeNode[] childPageNodes);
+
+ /**
+ * Computes the list of linked child pages for the given table rows and updates their summary cell.
+ */
+ public IPage[] getUpdatedChildPagesFor(ITableRow[] tableRows);
+
+ /**
+ * @return search form that is used to filter table rows<br>
+ * Note that the form will be started at latest after being added to
+ * the outline tree inside {@link IPage#initPage()} resps in {@link IPage#execInitPage()}
+ */
+ ISearchForm getSearchFormInternal();
+
+ boolean isSearchRequired();
+
+ void setSearchRequired(boolean b);
+
+ boolean isSearchActive();
+
+ void setSearchActive(boolean b);
+
+ /**
+ * Convenience for getting the search filter from the page's search form
+ *
+ * @return life reference to the filter (never null)
+ */
+ SearchFilter getSearchFilter();
+
+ boolean isShowTableRowMenus();
+
+ void setShowTableRowMenus(boolean showTableRowMenus);
+
+ boolean isShowEmptySpaceMenus();
+
+ void setShowEmptySpaceMenus(boolean showEmptySpaceMenus);
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/pages/ISearchForm.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/pages/ISearchForm.java
index f4cc8a84a9..59a2b3eb45 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/pages/ISearchForm.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/pages/ISearchForm.java
@@ -1,24 +1,24 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.desktop.outline.pages;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-
-/**
- * A search form contains a inner class SearchHandler and a process method
- * startSearch();
- */
-public interface ISearchForm extends IForm {
-
- void startSearch() throws ProcessingException;
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.desktop.outline.pages;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+
+/**
+ * A search form contains a inner class SearchHandler and a process method
+ * startSearch();
+ */
+public interface ISearchForm extends IForm {
+
+ void startSearch() throws ProcessingException;
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/pages/VirtualPage.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/pages/VirtualPage.java
index 906d4c6140..30fc3738a7 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/pages/VirtualPage.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/desktop/outline/pages/VirtualPage.java
@@ -1,116 +1,116 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.desktop.outline.pages;
-
-import org.eclipse.scout.commons.exception.IProcessingStatus;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.basic.tree.IVirtualTreeNode;
-import org.eclipse.scout.rt.client.ui.basic.tree.VirtualTreeNode;
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-
-/**
- * For performance optimizations, child pages are only loaded when needed.
- * Until then they are virtualized using VirtualPage objects.
- * <p>
- * A call to {@link IPage#getChildPage(int)}, {@link IPage#getChildPages()} or selecting a virtual page effectively
- * constructs the child page.
- * <p>
- * This construction involves calling
- * {@link AbstractPageWithTable#execCreateChildPage(org.eclipse.scout.rt.client.ui.basic.table.ITableRow)} resp.
- * {@link AbstractPageWithNodes#execCreateChildPages(java.util.Collection)}
- */
-public class VirtualPage extends VirtualTreeNode implements IPage, IVirtualTreeNode {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(VirtualPage.class);
-
- public VirtualPage() {
- }
-
- @Override
- public void initPage() throws ProcessingException {
- }
-
- @Override
- @SuppressWarnings("deprecation")
- public String getBookmarkIdentifier() {
- return null;
- }
-
- @Override
- public String getUserPreferenceContext() {
- return null;
- }
-
- @Override
- public IOutline getOutline() {
- return (IOutline) getTree();
- }
-
- @Override
- public IPage getParentPage() {
- return (IPage) getParentNode();
- }
-
- @Override
- public IPage getChildPage(final int childIndex) {
- return null;
- }
-
- @Override
- public IPage[] getChildPages() {
- return new IPage[0];
- }
-
- @Override
- public void pageActivatedNotify() {
- }
-
- @Override
- public void pageDeactivatedNotify() {
- }
-
- @Override
- public IForm getDetailForm() {
- return null;
- }
-
- @Override
- public void setDetailForm(IForm form) {
- }
-
- @Override
- public void dataChanged(Object... dataTypes) {
- }
-
- @Override
- public final void reloadPage() throws ProcessingException {
- }
-
- @Override
- public boolean isTableVisible() {
- return false;
- }
-
- @Override
- public void setTableVisible(boolean b) {
- }
-
- @Override
- public IProcessingStatus getPagePopulateStatus() {
- return null;
- }
-
- @Override
- public void setPagePopulateStatus(IProcessingStatus status) {
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.desktop.outline.pages;
+
+import org.eclipse.scout.commons.exception.IProcessingStatus;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.basic.tree.IVirtualTreeNode;
+import org.eclipse.scout.rt.client.ui.basic.tree.VirtualTreeNode;
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+
+/**
+ * For performance optimizations, child pages are only loaded when needed.
+ * Until then they are virtualized using VirtualPage objects.
+ * <p>
+ * A call to {@link IPage#getChildPage(int)}, {@link IPage#getChildPages()} or selecting a virtual page effectively
+ * constructs the child page.
+ * <p>
+ * This construction involves calling
+ * {@link AbstractPageWithTable#execCreateChildPage(org.eclipse.scout.rt.client.ui.basic.table.ITableRow)} resp.
+ * {@link AbstractPageWithNodes#execCreateChildPages(java.util.Collection)}
+ */
+public class VirtualPage extends VirtualTreeNode implements IPage, IVirtualTreeNode {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(VirtualPage.class);
+
+ public VirtualPage() {
+ }
+
+ @Override
+ public void initPage() throws ProcessingException {
+ }
+
+ @Override
+ @SuppressWarnings("deprecation")
+ public String getBookmarkIdentifier() {
+ return null;
+ }
+
+ @Override
+ public String getUserPreferenceContext() {
+ return null;
+ }
+
+ @Override
+ public IOutline getOutline() {
+ return (IOutline) getTree();
+ }
+
+ @Override
+ public IPage getParentPage() {
+ return (IPage) getParentNode();
+ }
+
+ @Override
+ public IPage getChildPage(final int childIndex) {
+ return null;
+ }
+
+ @Override
+ public IPage[] getChildPages() {
+ return new IPage[0];
+ }
+
+ @Override
+ public void pageActivatedNotify() {
+ }
+
+ @Override
+ public void pageDeactivatedNotify() {
+ }
+
+ @Override
+ public IForm getDetailForm() {
+ return null;
+ }
+
+ @Override
+ public void setDetailForm(IForm form) {
+ }
+
+ @Override
+ public void dataChanged(Object... dataTypes) {
+ }
+
+ @Override
+ public final void reloadPage() throws ProcessingException {
+ }
+
+ @Override
+ public boolean isTableVisible() {
+ return false;
+ }
+
+ @Override
+ public void setTableVisible(boolean b) {
+ }
+
+ @Override
+ public IProcessingStatus getPagePopulateStatus() {
+ return null;
+ }
+
+ @Override
+ public void setPagePopulateStatus(IProcessingStatus status) {
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/AbstractForm.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/AbstractForm.java
index 21a900cc5f..1f81368f25 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/AbstractForm.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/AbstractForm.java
@@ -1,2746 +1,2746 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.OutputStreamWriter;
-import java.io.Serializable;
-import java.nio.charset.Charset;
-import java.security.Permission;
-import java.util.ArrayList;
-import java.util.EventListener;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.scout.commons.BeanUtility;
-import org.eclipse.scout.commons.ConfigurationUtility;
-import org.eclipse.scout.commons.EventListenerList;
-import org.eclipse.scout.commons.StoppableThread;
-import org.eclipse.scout.commons.annotations.ConfigOperation;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.FormData;
-import org.eclipse.scout.commons.annotations.FormData.SdkCommand;
-import org.eclipse.scout.commons.annotations.InjectFieldTo;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.beans.AbstractPropertyObserver;
-import org.eclipse.scout.commons.beans.FastPropertyDescriptor;
-import org.eclipse.scout.commons.beans.IPropertyFilter;
-import org.eclipse.scout.commons.exception.IProcessingStatus;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.exception.VetoException;
-import org.eclipse.scout.commons.holders.Holder;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.commons.xmlparser.SimpleXmlElement;
-import org.eclipse.scout.rt.client.BlockingCondition;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.client.services.common.search.ISearchFilterService;
-import org.eclipse.scout.rt.client.ui.DataChangeListener;
-import org.eclipse.scout.rt.client.ui.IEventHistory;
-import org.eclipse.scout.rt.client.ui.WeakDataChangeListener;
-import org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke;
-import org.eclipse.scout.rt.client.ui.basic.filechooser.FileChooser;
-import org.eclipse.scout.rt.client.ui.desktop.AbstractDesktop;
-import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
-import org.eclipse.scout.rt.client.ui.form.fields.AbstractFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.IValidateContentDescriptor;
-import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
-import org.eclipse.scout.rt.client.ui.form.fields.button.ButtonEvent;
-import org.eclipse.scout.rt.client.ui.form.fields.button.ButtonListener;
-import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
-import org.eclipse.scout.rt.client.ui.form.fields.composer.IComposerField;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox;
-import org.eclipse.scout.rt.client.ui.form.fields.tabbox.ITabBox;
-import org.eclipse.scout.rt.client.ui.form.fields.wrappedform.IWrappedFormField;
-import org.eclipse.scout.rt.client.ui.form.internal.FindFieldByFormDataIdVisitor;
-import org.eclipse.scout.rt.client.ui.form.internal.FindFieldByXmlIdsVisitor;
-import org.eclipse.scout.rt.client.ui.form.internal.FormDataPropertyFilter;
-import org.eclipse.scout.rt.client.ui.messagebox.IMessageBox;
-import org.eclipse.scout.rt.client.ui.messagebox.MessageBox;
-import org.eclipse.scout.rt.client.ui.profiler.DesktopProfiler;
-import org.eclipse.scout.rt.client.ui.wizard.IWizard;
-import org.eclipse.scout.rt.client.ui.wizard.IWizardStep;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.TEXTS;
-import org.eclipse.scout.rt.shared.data.form.AbstractFormData;
-import org.eclipse.scout.rt.shared.data.form.fields.AbstractFormFieldData;
-import org.eclipse.scout.rt.shared.data.form.fields.AbstractValueFieldData;
-import org.eclipse.scout.rt.shared.data.form.fields.tablefield.AbstractTableFieldData;
-import org.eclipse.scout.rt.shared.data.form.properties.AbstractPropertyData;
-import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
-import org.eclipse.scout.rt.shared.services.common.jdbc.SearchFilter;
-import org.eclipse.scout.rt.shared.services.common.security.IAccessControlService;
-import org.eclipse.scout.service.SERVICES;
-
-@FormData(value = AbstractFormData.class, sdkCommand = SdkCommand.USE)
-public abstract class AbstractForm extends AbstractPropertyObserver implements IForm {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractForm.class);
-
- private boolean m_initialized;
- private final EventListenerList m_listenerList = new EventListenerList();
- private IFormUIFacade m_uiFacade;
- private IWizardStep m_wizardStep;
- private boolean m_modal;// no property, is fixed
- private boolean m_cacheBounds; // no property is fixed
- private boolean m_askIfNeedSave;
- private boolean m_buttonsArmed;
- private boolean m_closeTimerArmed;
- private boolean m_formStored;
- private boolean m_formLoading;
- private final BlockingCondition m_blockingCondition;
- private boolean m_autoRegisterInDesktopOnStart;
- private int m_displayHint;// no property, is fixed
- private String m_displayViewId;// no property, is fixed
- private boolean m_displayHintLocked = false;// no property, is fixed
- private int m_closeType = IButton.SYSTEM_TYPE_NONE;
- private String m_basicTitle;
- private String m_subTitle;
- private String m_cancelVerificationText;
- private File m_lastXmlFileForStorage;
- private IGroupBox m_mainBox;
- private IWrappedFormField m_wrappedFormField;
- private P_SystemButtonListener m_systemButtonListener;
-
- private IFormHandler m_handler;
- // access control
- private boolean m_enabledGranted;
- private boolean m_visibleGranted;
- // search
- private SearchFilter m_searchFilter;
- //validate content assistant
- private IValidateContentDescriptor m_currentValidateContentDescriptor;
-
- // current timers
- private P_CloseTimer m_scoutCloseTimer;
- private HashMap<String, P_Timer> m_scoutTimerMap;
- private String m_iconId;
- private DataChangeListener m_internalDataChangeListener;
- private IEventHistory<FormEvent> m_eventHistory;
-
- public AbstractForm() throws ProcessingException {
- this(true);
- }
-
- public AbstractForm(boolean callInitializer) throws ProcessingException {
- if (DesktopProfiler.getInstance().isEnabled()) {
- DesktopProfiler.getInstance().registerForm(this);
- }
- m_eventHistory = createEventHistory();
- m_enabledGranted = true;
- m_visibleGranted = true;
- m_formLoading = true;
- m_blockingCondition = new BlockingCondition(false);
- if (callInitializer) {
- callInitializer();
- }
- }
-
- protected void callInitializer() throws ProcessingException {
- if (!m_initialized) {
- initConfig();
- postInitConfig();
- m_initialized = true;
- }
- }
-
- /*
- * Configuration
- */
- @ConfigProperty(ConfigProperty.TEXT)
- @Order(10)
- @ConfigPropertyValue("null")
- protected String getConfiguredTitle() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.TEXT)
- @Order(11)
- @ConfigPropertyValue("null")
- protected String getConfiguredSubTitle() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.INTEGER)
- @Order(20)
- @ConfigPropertyValue("0")
- protected int/* seconds */getConfiguredCloseTimer() {
- return 0;
- }
-
- @ConfigProperty(ConfigProperty.INTEGER)
- @Order(40)
- @ConfigPropertyValue("0")
- protected int/* seconds */getConfiguredCustomTimer() {
- return 0;
- }
-
- @ConfigProperty(ConfigProperty.DOC)
- @Order(60)
- @ConfigPropertyValue("null")
- protected String getConfiguredDoc() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.TEXT)
- @Order(90)
- @ConfigPropertyValue("ScoutTexts.get(\"FormSaveChangesQuestion\")")
- protected String getConfiguredCancelVerificationText() {
- return ScoutTexts.get("FormSaveChangesQuestion");
- }
-
- @ConfigProperty(ConfigProperty.FORM_DISPLAY_HINT)
- @Order(100)
- @ConfigPropertyValue("DISPLAY_HINT_DIALOG")
- protected int getConfiguredDisplayHint() {
- return DISPLAY_HINT_DIALOG;
- }
-
- @ConfigProperty(ConfigProperty.FORM_VIEW_ID)
- @Order(105)
- @ConfigPropertyValue("null")
- protected String getConfiguredDisplayViewId() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(108)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredMinimizeEnabled() {
- return false;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(109)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredMaximizeEnabled() {
- return false;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(110)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredMinimized() {
- return false;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(112)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredMaximized() {
- return false;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(120)
- @ConfigPropertyValue("true")
- protected boolean getConfiguredModal() {
- return true;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(140)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredCacheBounds() {
- return false;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(150)
- @ConfigPropertyValue("true")
- protected boolean getConfiguredAskIfNeedSave() {
- return true;
- }
-
- @ConfigProperty(ConfigProperty.ICON_ID)
- @Order(160)
- @ConfigPropertyValue("null")
- protected String getConfiguredIconId() {
- return null;
- }
-
- /**
- * This method is called to get an exclusive key of the form. The key is used
- * to open the same form with the same handler only once. Obviously this
- * behavior can only be used for view forms.
- *
- * @see AbstractDesktop#getSimilarViewForms(IForm)
- * @return null for exclusive form behavior an exclusive key to ensure similar
- * handling.
- * @throws ProcessingException
- */
- @Override
- public Object computeExclusiveKey() throws ProcessingException {
- return null;
- }
-
- /**
- * Initialize the form and all of its fields.
- * By default any of the #start* methods of the form call this method
- * <p>
- * This method is called in the process of the initialization. The UI is not ready yet.
- *
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(10)
- protected void execInitForm() throws ProcessingException {
- }
-
- /**
- * This method is called when UI is ready.
- *
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(11)
- protected void execFormActivated() throws ProcessingException {
- }
-
- /**
- * see {@link IDesktop#dataChanged(Object...)}
- */
- @ConfigOperation
- @Order(13)
- protected void execDataChanged(Object... dataTypes) throws ProcessingException {
- }
-
- /**
- * This method is called in order to check field validity.<br>
- * This method is called before {@link IFormHandler#execCheckFields()} and
- * before the form is validated and stored.<br>
- * After this method, the form is checking fields itself and displaying a
- * dialog with missing and invalid fields.
- *
- * @return true when this check is done and further checks can continue, false
- * to silently cancel the current process
- * @throws ProcessingException
- * to cancel the current process with error handling and user
- * notification such as a dialog
- */
- @ConfigOperation
- @Order(13)
- protected boolean execCheckFields() throws ProcessingException {
- return true;
- }
-
- /**
- * This method is called in order to update derived states like button
- * enablings.<br>
- * This method is called before {@link IFormHandler#execValidate()} and before
- * the form is stored.
- *
- * @return true when validate is successful, false to silently cancel the
- * current process
- * @throws ProcessingException
- * to cancel the current process with error handling and user
- * notification such as a dialog
- */
- @ConfigOperation
- @Order(14)
- protected boolean execValidate() throws ProcessingException {
- return true;
- }
-
- /**
- * This method is called in order to update pages on the desktop after the
- * form stored data.<br>
- * This method is called after {@link IFormHandler#execStore()}.
- */
- @ConfigOperation
- @Order(16)
- protected void execStored() throws ProcessingException {
- }
-
- /**
- * @throws ProcessingException
- * / {@link VetoException} if the exception should produce further
- * info messages (default)
- */
- @ConfigOperation
- @Order(17)
- protected void execOnVetoException(VetoException e, int code) throws ProcessingException {
- throw e;
- }
-
- /**
- * @param kill
- * true if a widget close icon (normally the X on the titlebar) was
- * pressed or ESC was pressed
- * @param enabledButtonSystemTypes
- * set of all {@link IButton#SYSTEM_TYPE_*} of all enabled and
- * visible buttons of this form
- */
- @ConfigOperation
- @Order(18)
- protected void execOnCloseRequest(boolean kill, final HashSet<Integer> enabledButtonSystemTypes) throws ProcessingException {
- if (enabledButtonSystemTypes.contains(IButton.SYSTEM_TYPE_CLOSE)) {
- doClose();
- }
- else if (enabledButtonSystemTypes.contains(IButton.SYSTEM_TYPE_CANCEL)) {
- doCancel();
- }
- else if (!isAskIfNeedSave()) {
- doClose();
- }
- else {
- LOG.info("Trying to close a form (" + getClass().getName() + " - " + getTitle() + ") with no enabled close button! override getConfiguredAskIfNeedSave() to false to make this form is unsaveable.");
- }
- }
-
- @ConfigOperation
- @Order(19)
- protected void execDisposeForm() throws ProcessingException {
- }
-
- @ConfigOperation
- @Order(20)
- protected void execCloseTimer() throws ProcessingException {
- doClose();
- }
-
- @ConfigOperation
- @Order(30)
- protected void execInactivityTimer() throws ProcessingException {
- doClose();
- }
-
- @ConfigOperation
- @Order(40)
- protected void execTimer(String timerId) throws ProcessingException {
- LOG.info("execTimer " + timerId);
- }
-
- /**
- * add verbose information to the search filter
- */
- @ConfigOperation
- @Order(50)
- protected void execAddSearchTerms(SearchFilter search) {
- }
-
- private Class<? extends IKeyStroke>[] getConfiguredKeyStrokes() {
- Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
- return ConfigurationUtility.filterClasses(dca, IKeyStroke.class);
- }
-
- private Class<? extends IGroupBox> getConfiguredMainBox() {
- Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
- return ConfigurationUtility.filterClassIgnoringInjectFieldAnnotation(dca, IGroupBox.class);
- }
-
- private Class<? extends IFormField>[] getConfiguredInjectedFields() {
- Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
- return ConfigurationUtility.filterClassesWithInjectFieldAnnotation(dca, IFormField.class);
- }
-
- protected void initConfig() throws ProcessingException {
- m_uiFacade = new P_UIFacade();
- m_scoutTimerMap = new HashMap<String, P_Timer>();
- m_autoRegisterInDesktopOnStart = true;
- // prepare injected fields
- Class<? extends IFormField>[] fieldArray = getConfiguredInjectedFields();
- DefaultFormFieldInjection injectedFields = null;
- for (Class<? extends IFormField> clazz : fieldArray) {
- if (!clazz.isAnnotationPresent(InjectFieldTo.class)) {
- continue;
- }
- try {
- IFormField f = ConfigurationUtility.newInnerInstance(this, clazz);
- if (f != null) {
- if (injectedFields == null) {
- injectedFields = new DefaultFormFieldInjection();
- }
- injectedFields.addField(f);
- }
- }// end try
- catch (Throwable t) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("field: " + clazz.getName(), t));
- }
- }
- IGroupBox rootBox = getRootGroupBox();
- try {
- if (injectedFields != null) {
- FormFieldInjectionThreadLocal.push(injectedFields);
- }
- //
- // add mainbox if getter returns null
- if (rootBox == null) {
- Class<? extends IGroupBox> mainBoxClass = getConfiguredMainBox();
- try {
- m_mainBox = ConfigurationUtility.newInnerInstance(this, mainBoxClass);
- }
- catch (Throwable t) {
- throw new ProcessingException("mainBox: " + ((mainBoxClass == null) ? "not defined." : mainBoxClass.getName()), t);
- }
- rootBox = getRootGroupBox();
- }
- }
- finally {
- if (injectedFields != null) {
- FormFieldInjectionThreadLocal.pop(injectedFields);
- }
- }
- rootBox.setFormInternal(this);
- rootBox.setMainBox(true);
- rootBox.updateKeyStrokes();
- //
- if (getConfiguredCloseTimer() > 0) {
- setCloseTimer(getConfiguredCloseTimer());
- }
- if (getConfiguredCustomTimer() > 0) {
- setTimer("custom", getConfiguredCustomTimer());
- }
- setModal(getConfiguredModal());
- setDisplayHint(getConfiguredDisplayHint());
- setDisplayViewId(getConfiguredDisplayViewId());
- if (getConfiguredCancelVerificationText() != null) {
- setCancelVerificationText(getConfiguredCancelVerificationText());
- }
- if (getConfiguredTitle() != null) {
- setTitle(getConfiguredTitle());
- }
- if (getConfiguredSubTitle() != null) {
- setSubTitle(getConfiguredSubTitle());
- }
- setMinimizeEnabled(getConfiguredMinimizeEnabled());
- setMaximizeEnabled(getConfiguredMaximizeEnabled());
- setMinimized(getConfiguredMinimized());
- setMaximized(getConfiguredMaximized());
- setCacheBounds(getConfiguredCacheBounds());
- setAskIfNeedSave(getConfiguredAskIfNeedSave());
- setIconId(getConfiguredIconId());
-
- // visit all system buttons and attach observer
- m_systemButtonListener = new P_SystemButtonListener();// is auto-detaching
- IFormFieldVisitor v2 = new IFormFieldVisitor() {
- @Override
- public boolean visitField(IFormField field, int level, int fieldIndex) {
- if (field instanceof IButton) {
- if (((IButton) field).getSystemType() != IButton.SYSTEM_TYPE_NONE) {
- ((IButton) field).addButtonListener(m_systemButtonListener);
- }
- }
- return true;
- }
- };
- visitFields(v2);
- getRootGroupBox().addPropertyChangeListener(new P_MainBoxPropertyChangeProxy());
- setButtonsArmed(true);
- }
-
- @Override
- public void setEnabledPermission(Permission p) {
- boolean b;
- if (p != null) {
- b = SERVICES.getService(IAccessControlService.class).checkPermission(p);
- }
- else {
- b = true;
- }
- setEnabledGranted(b);
- }
-
- @Override
- public boolean isEnabledGranted() {
- return m_enabledGranted;
- }
-
- @Override
- public void setEnabledGranted(boolean b) {
- m_enabledGranted = b;
- IGroupBox box = getRootGroupBox();
- if (box != null) {
- box.setEnabledGranted(b);
- }
- }
-
- @Override
- public void setVisiblePermission(Permission p) {
- boolean b;
- if (p != null) {
- b = SERVICES.getService(IAccessControlService.class).checkPermission(p);
- }
- else {
- b = true;
- }
- setVisibleGranted(b);
- }
-
- @Override
- public boolean isVisibleGranted() {
- return m_visibleGranted;
- }
-
- @Override
- public void setVisibleGranted(boolean b) {
- m_visibleGranted = b;
- IGroupBox box = getRootGroupBox();
- if (box != null) {
- box.setVisibleGranted(b);
- }
- }
-
- @Override
- public String getIconId() {
- return propertySupport.getPropertyString(PROP_ICON_ID);
- }
-
- @Override
- public void setIconId(String iconId) {
- propertySupport.setPropertyString(PROP_ICON_ID, iconId);
- }
-
- @Override
- public String getPerspectiveId() {
- return propertySupport.getPropertyString(PROP_PERSPECTIVE_ID);
- }
-
- @Override
- public void setPerspectiveId(String perspectiveId) {
- propertySupport.setPropertyString(PROP_PERSPECTIVE_ID, perspectiveId);
- }
-
- /**
- * Register a {@link DataChangeListener} on the desktop for these dataTypes<br>
- * Example:
- *
- * <pre>
- * registerDataChangeListener(CRMEnum.Company, CRMEnum.Project, CRMEnum.Task);
- * </pre>
- */
- public void registerDataChangeListener(Object... dataTypes) {
- if (m_internalDataChangeListener == null) {
- m_internalDataChangeListener = new WeakDataChangeListener() {
- @Override
- public void dataChanged(Object... innerDataTypes) throws ProcessingException {
- execDataChanged(innerDataTypes);
- }
- };
- }
- IDesktop desktop = getDesktop();
- if (desktop == null) {
- desktop = ClientSyncJob.getCurrentSession().getVirtualDesktop();
- }
- desktop.addDataChangeListener(m_internalDataChangeListener, dataTypes);
- }
-
- /**
- * Unregister the {@link DataChangeListener} from the desktop for these
- * dataTypes<br>
- * Example:
- *
- * <pre>
- * unregisterDataChangeListener(CRMEnum.Company, CRMEnum.Project, CRMEnum.Task);
- * </pre>
- */
- public void unregisterDataChangeListener(Object... dataTypes) {
- if (m_internalDataChangeListener != null) {
- getDesktop().removeDataChangeListener(m_internalDataChangeListener, dataTypes);
- }
- }
-
- protected IForm startInternalExclusive(IFormHandler handler) throws ProcessingException {
- if (m_blockingCondition.isBlocking()) {
- throw new ProcessingException("The form " + getFormId() + " has already been started");
- }
- for (IForm simCandidate : getDesktop().getSimilarViewForms(this)) {
- if (handler != null && simCandidate.getHandler() != null && handler.getClass().getName() == simCandidate.getHandler().getClass().getName()) {
- if (simCandidate.getHandler().isOpenExclusive() && handler.isOpenExclusive()) {
- getDesktop().ensureVisible(simCandidate);
- return simCandidate;
- }
- }
- }
- return startInternal(handler);
- }
-
- /**
- * This method is called from the implemented handler methods in a explicit
- * form subclass
- */
- protected IForm startInternal(final IFormHandler handler) throws ProcessingException {
- if (m_blockingCondition.isBlocking()) {
- throw new ProcessingException("The form " + getFormId() + " has already been started");
- }
- setHandler(handler);
- m_closeType = IButton.SYSTEM_TYPE_NONE;
- m_displayHintLocked = true;
- m_blockingCondition.setBlocking(true);
- try {
- // check if form was made invisible ( = access control denied access)
- if (!getRootGroupBox().isVisible()) {
- disposeFormInternal();
- return this;
- }
- initForm();
- // check if form was made invisible ( = access control denied access)
- if (!getRootGroupBox().isVisible()) {
- // make sure the form is storing since it is not showing
- disposeFormInternal();
- return this;
- }
- loadStateInternal();
- // check if form was made invisible ( = access control denied access)
- if (!isFormOpen()) {
- disposeFormInternal();
- return this;
- }
- if (!getRootGroupBox().isVisible()) {
- disposeFormInternal();
- return this;
- }
- if (getHandler().isGuiLess()) {
- // make sure the form is storing since it is not showing
- storeStateInternal();
- markSaved();
- doFinally();
- disposeFormInternal();
- return this;
- }
- }
- catch (ProcessingException e) {
- e.addContextMessage(AbstractForm.this.getClass().getSimpleName());
- disposeFormInternal();
- if (e instanceof VetoException) {
- execOnVetoException((VetoException) e, e.getStatus().getCode());
- }
- else {
- throw e;
- }
- }
- catch (Throwable t) {
- disposeFormInternal();
- throw new ProcessingException("failed showing " + getTitle(), t);
- }
- // request a gui
- setButtonsArmed(true);
- setCloseTimerArmed(true);
- // register in desktop or wizard (legacy wizard only)
- if (isAutoAddRemoveOnDesktop()) {
- IDesktop desktop = getDesktop();
- if (desktop != null) {
- desktop.addForm(this);
- }
- }
- return this;
- }
-
- @Override
- public void startWizardStep(IWizardStep wizardStep, Class<? extends IFormHandler> handlerType) throws ProcessingException {
- setAutoAddRemoveOnDesktop(false);
- IFormHandler formHandler = null;
- if (handlerType != null) {
- try {
- formHandler = ConfigurationUtility.newInnerInstance(this, handlerType);
- }
- catch (Exception e) {
- throw new ProcessingException("" + handlerType + " is not an internal form handler", e);
- }
- }
- m_wizardStep = wizardStep;
- setModal(false);
- setAskIfNeedSave(false);
- // hide top level process buttons with a system type
- for (IFormField f : getRootGroupBox().getFields()) {
- if (f instanceof IButton) {
- IButton b = (IButton) f;
- if (b.getSystemType() != IButton.SYSTEM_TYPE_NONE) {
- // hide
- b.setVisible(false);
- b.setVisibleGranted(false);
- }
- }
- }
- //
- // start
- startInternal(formHandler);
- }
-
- @Override
- public void waitFor() throws ProcessingException {
- // check if the desktop is observing this process
- IDesktop desktop = ClientSyncJob.getCurrentSession().getDesktop();
- if (desktop == null || !desktop.isOpened()) {
- throw new ProcessingException("Cannot wait for " + getClass().getName() + ". There is no desktop or the desktop has not yet been opened in the ui", null, WAIT_FOR_ERROR_CODE);
- }
- // wait
- try {
- m_blockingCondition.waitFor();
- }
- catch (InterruptedException e) {
- throw new ProcessingException(ScoutTexts.get("UserInterrupted"), e);
- }
- }
-
- @Override
- public void exportFormData(AbstractFormData target) throws ProcessingException {
- // locally declared form properties
- Map<String, Object> properties = BeanUtility.getProperties(this, AbstractForm.class, new FormDataPropertyFilter());
- BeanUtility.setProperties(target, properties, false, null);
- // all fields
- Map<Integer, Map<String/* qualified field id */, AbstractFormFieldData>> breathFirstMap = target.getAllFieldsRec();
- for (Map<String/* qualified field id */, AbstractFormFieldData> targetMap : breathFirstMap.values()) {
- for (Map.Entry<String, AbstractFormFieldData> e : targetMap.entrySet()) {
- String fieldQId = e.getKey();
- AbstractFormFieldData data = e.getValue();
- FindFieldByFormDataIdVisitor v = new FindFieldByFormDataIdVisitor(fieldQId);
- visitFields(v);
- IFormField f = v.getField();
- if (f != null) {
- // locally declared field properties
- properties = BeanUtility.getProperties(f, AbstractFormField.class, new FormDataPropertyFilter());
- BeanUtility.setProperties(data, properties, false, null);
- // field state
- f.exportFormFieldData(data);
- }
- else {
- LOG.warn("cannot find field data for '" + fieldQId + " in form " + getClass().getName() + "'");
- }
- }
- }
- }
-
- @Override
- public void importFormData(AbstractFormData source) throws ProcessingException {
- importFormData(source, false, null);
- }
-
- @Override
- public void importFormData(AbstractFormData source, boolean valueChangeTriggersEnabled, IPropertyFilter filter) throws ProcessingException {
- if (filter == null) {
- filter = new FormDataPropertyFilter();
- }
- // locally declared form properties
- Map<String, Object> properties = BeanUtility.getProperties(source, AbstractFormData.class, filter);
- for (Iterator<String> it = properties.keySet().iterator(); it.hasNext();) {
- AbstractPropertyData pd = source.getPropertyById(it.next());
- if (pd != null && !pd.isValueSet()) {
- it.remove();
- }
- }
- BeanUtility.setProperties(this, properties, false, null);
- // sort fields, first non-slave fields, then slave fields in transitive
- // order
- LinkedList<IFormField> masterList = new LinkedList<IFormField>();
- LinkedList<IFormField> slaveList = new LinkedList<IFormField>();
- HashMap<IFormField, AbstractFormFieldData> dataMap = new HashMap<IFormField, AbstractFormFieldData>();
- // all fields
- Map<Integer, Map<String/* qualified field id */, AbstractFormFieldData>> breathFirstMap = source.getAllFieldsRec();
- for (Map<String/* qualified field id */, AbstractFormFieldData> sourceMap : breathFirstMap.values()) {
- for (Map.Entry<String, AbstractFormFieldData> e : sourceMap.entrySet()) {
- String fieldQId = e.getKey();
- AbstractFormFieldData data = e.getValue();
- FindFieldByFormDataIdVisitor v = new FindFieldByFormDataIdVisitor(fieldQId);
- visitFields(v);
- IFormField f = v.getField();
- if (f != null) {
- dataMap.put(f, data);
- if (f.getMasterField() != null) {
- int index = slaveList.indexOf(f.getMasterField());
- if (index >= 0) {
- slaveList.add(index + 1, f);
- }
- else {
- slaveList.add(0, f);
- }
- }
- else {
- masterList.add(f);
- }
- }
- else {
- LOG.warn("cannot find field data for '" + fieldQId + " in form " + getClass().getName() + "'");
- }
- }
- }
- for (IFormField f : masterList) {
- AbstractFormFieldData data = dataMap.get(f);
- // locally declared field properties
- Class stopClass;
- if (data instanceof AbstractTableFieldData) {
- stopClass = AbstractTableFieldData.class;
- }
- else if (data instanceof AbstractValueFieldData) {
- stopClass = AbstractValueFieldData.class;
- }
- else {
- stopClass = AbstractFormFieldData.class;
- }
- properties = BeanUtility.getProperties(data, stopClass, filter);
- for (Iterator<String> it = properties.keySet().iterator(); it.hasNext();) {
- AbstractPropertyData pd = data.getPropertyById(it.next());
- if (pd != null && !pd.isValueSet()) {
- it.remove();
- }
- }
- BeanUtility.setProperties(f, properties, false, null);
- // field state
- f.importFormFieldData(data, valueChangeTriggersEnabled);
- }
- for (IFormField f : slaveList) {
- AbstractFormFieldData data = dataMap.get(f);
- // locally declared field properties
- Class stopClass;
- if (data instanceof AbstractTableFieldData) {
- stopClass = AbstractTableFieldData.class;
- }
- else if (data instanceof AbstractValueFieldData) {
- stopClass = AbstractValueFieldData.class;
- }
- else {
- stopClass = AbstractFormFieldData.class;
- }
- properties = BeanUtility.getProperties(data, stopClass, filter);
- for (Iterator<String> it = properties.keySet().iterator(); it.hasNext();) {
- AbstractPropertyData pd = data.getPropertyById(it.next());
- if (pd != null && !pd.isValueSet()) {
- it.remove();
- }
- }
- BeanUtility.setProperties(f, properties, false, null);
- // field state
- f.importFormFieldData(data, valueChangeTriggersEnabled);
- }
- }
-
- public static String parseFormId(String className) {
- String s = className;
- int i = Math.max(s.lastIndexOf('$'), s.lastIndexOf('.'));
- s = s.substring(i + 1);
- return s;
- }
-
- @Override
- public String getFormId() {
- return parseFormId(getClass().getName());
- }
-
- @Override
- public IFormHandler getHandler() {
- return m_handler;
- }
-
- @Override
- public void setHandler(IFormHandler handler) {
- if (handler != m_handler) {
- if (m_handler != null) {
- m_handler.setFormInternal(null);
- }
- if (handler == null) {
- handler = new NullFormHandler();
- }
- m_handler = handler;
- m_handler.setFormInternal(this);
- }
- }
-
- @Override
- public IWizard getWizard() {
- return (getWizardStep() != null) ? getWizardStep().getWizard() : null;
- }
-
- @Override
- public IWizardStep getWizardStep() {
- return m_wizardStep;
- }
-
- @Override
- public IFormField getFocusOwner() {
- if (getDesktop() != null) {
- IFormField field = getDesktop().getFocusOwner();
- if (field != null) {
- IForm form = field.getForm();
- while (form != null) {
- if (form == this) {
- return field;
- }
- // next
- form = form.getOuterForm();
- }
- }
- }
- return null;
- }
-
- @Override
- public IFormField[] getAllFields() {
- P_AbstractCollectingFieldVisitor<IFormField> v = new P_AbstractCollectingFieldVisitor<IFormField>() {
- @Override
- public boolean visitField(IFormField field, int level, int fieldIndex) {
- collect(field);
- return true;
- }
- };
- visitFields(v);
- return v.getCollection().toArray(new IFormField[0]);
- }
-
- @Override
- public boolean visitFields(IFormFieldVisitor visitor) {
- return getRootGroupBox().visitFields(visitor, 0);
- }
-
- /**
- * Convenience for ClientJob.getCurrentSession().getDesktop()
- */
- public IDesktop getDesktop() {
- return ClientSyncJob.getCurrentSession().getDesktop();
- }
-
- @Override
- public final SearchFilter getSearchFilter() {
- if (m_searchFilter == null) {
- resetSearchFilter();
- }
- return m_searchFilter;
- }
-
- @Override
- public final void setSearchFilter(SearchFilter searchFilter) {
- m_searchFilter = searchFilter;
- }
-
- /**
- * Alias for {@link #resetSearchFilter()}
- */
- public void rebuildSearchFilter() {
- resetSearchFilter();
- }
-
- @Override
- public void resetSearchFilter() {
- if (m_searchFilter == null) {
- SearchFilter filter;
- ISearchFilterService sfs = SERVICES.getService(ISearchFilterService.class);
- if (sfs != null) {
- filter = sfs.createNewSearchFilter();
- }
- else {
- filter = new SearchFilter();
- }
- m_searchFilter = filter;
- }
- try {
- execResetSearchFilter(m_searchFilter);
- }
- catch (ProcessingException e) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- catch (Throwable t) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Unexpected", t));
- }
- }
-
- /**
- * Called when saving the form via {@link #resetSearchFilter()}.
- * <p>
- * This operation fills up the search filter and subclass override sets the formData property of the
- * {@link SearchFilter#setFormData(AbstractFormData)} and adds verbose texts with
- * {@link SearchFilter#addDisplayText(String)}
- * <p>
- * May call {@link #setSearchFilter(SearchFilter)}
- * <p>
- * Implement {@link #execCreateFormData()} to automatically attach a filled form data to the search filter (since
- * 3.8).
- *
- * @param searchFilter
- * is never null
- */
- @ConfigOperation
- @Order(10)
- protected void execResetSearchFilter(final SearchFilter searchFilter) throws ProcessingException {
- searchFilter.clear();
- // add verbose field texts
- // do not use visitor, so children can block traversal on whole subtrees
- getRootGroupBox().applySearch(searchFilter);
- // add verbose form texts
- execAddSearchTerms(searchFilter);
- // override may add form data
- try {
- AbstractFormData data = execCreateFormData();
- if (data != null) {
- exportFormData(data);
- getSearchFilter().setFormData(data);
- }
- }
- catch (ProcessingException e) {
- throw e;
- }
- catch (Throwable t) {
- throw new ProcessingException("Create form data", t);
- }
- }
-
- /**
- * Convenience to add form data to search filter and load/store form data.
- * override this method to create an empty search form data that can be used for example by
- * {@link #execResetSearchFilter(SearchFilter)}
- *
- * @since 3.8
- */
- @ConfigOperation
- @Order(11)
- protected AbstractFormData execCreateFormData() throws ProcessingException {
- return null;
- }
-
- @Override
- public boolean isFormStored() {
- return m_formStored;
- }
-
- @Override
- public void setFormStored(boolean b) {
- m_formStored = b;
- }
-
- @Override
- public boolean isFormLoading() {
- return m_formLoading;
- }
-
- private void setFormLoading(boolean b) {
- m_formLoading = b;
- }
-
- /**
- * Mainbox getter
- */
- @Override
- public IGroupBox getRootGroupBox() {
- return m_mainBox;
- }
-
- @Override
- public IForm getOuterForm() {
- return m_wrappedFormField != null ? m_wrappedFormField.getForm() : null;
- }
-
- @Override
- public IWrappedFormField getOuterFormField() {
- return m_wrappedFormField;
- }
-
- @Override
- public void setWrapperFieldInternal(IWrappedFormField w) {
- m_wrappedFormField = w;
- }
-
- @Override
- public IFormField getFieldById(final String id) {
- return getRootGroupBox().getFieldById(id);
- }
-
- @Override
- public <T extends IFormField> T getFieldById(String id, Class<T> type) {
- return getRootGroupBox().getFieldById(id, type);
- }
-
- @Override
- public <T extends IFormField> T getFieldByClass(Class<T> c) {
- return getRootGroupBox().getFieldByClass(c);
- }
-
- /**
- * override in subclasses to perform form initialization before handler starts
- */
- protected void postInitConfig() throws ProcessingException {
- FormUtility.postInitConfig(this);
- FormUtility.rebuildFieldGrid(this, true);
- }
-
- @Override
- public void initForm() throws ProcessingException {
- // form
- initFormInternal();
- // fields
- FormUtility.initFormFields(this);
- // custom
- execInitForm();
- }
-
- protected void initFormInternal() throws ProcessingException {
- }
-
- @Override
- public int getCloseSystemType() {
- return m_closeType;
- }
-
- @Override
- public void setCloseSystemType(int type) {
- m_closeType = type;
- }
-
- /**
- * do not use or override this internal method
- */
- protected void loadStateInternal() throws ProcessingException {
- fireFormLoadBefore();
- if (!isFormOpen()) {
- return;
- }
- getHandler().onLoad();
- if (!isFormOpen()) {
- return;
- }
- fireFormLoadAfter();
- if (!isFormOpen()) {
- return;
- }
- // set all values to 'unchanged'
- markSaved();
- setFormLoading(false);
- getHandler().onPostLoad();
- if (!isFormOpen()) {
- return;
- }
- // if not visible mode, mark form changed
- if (getHandler().isGuiLess()) {
- touch();
- }
- fireFormLoadComplete();
- }
-
- /**
- * Store state of form, regardless of validity and completeness do not use or
- * override this internal method directly
- */
- protected void storeStateInternal() throws ProcessingException {
- if (!m_blockingCondition.isBlocking()) {
- String msg = TEXTS.get("FormDisposedMessage", getTitle());
- LOG.error(msg);
- throw new VetoException(msg);
- }
- fireFormStoreBefore();
- m_formStored = true;
- try {
- rebuildSearchFilter();
- m_searchFilter.setCompleted(true);
- getHandler().onStore();
- execStored();
- }
- catch (ProcessingException e) {
- // clear search
- if (m_searchFilter != null) {
- m_searchFilter.clear();
- }
- // store was not successfully stored
- m_formStored = false;
- throwVetoExceptionInternal(e);
- // if exception was caught and suppressed, this form was after all successfully stored
- // normally this code is not reached since the exception will be passed out
- m_formStored = true;
- }
- catch (Throwable t) {
- // clear search
- if (m_searchFilter != null) {
- m_searchFilter.clear();
- }
- throw new ProcessingException("form: " + getTitle(), t);
- }
- fireFormStoreAfter();
- }
-
- /**
- * do not use or override this internal method
- */
- protected void discardStateInternal() throws ProcessingException {
- fireFormDiscarded();
- getHandler().onDiscard();
- }
-
- @Override
- public void setCloseTimer(int seconds) {
- if (seconds > 0) {
- setCloseTimerArmed(true);
- m_scoutCloseTimer = new P_CloseTimer(seconds);
- m_scoutCloseTimer.start();
- }
- else {
- removeCloseTimer();
- }
- }
-
- /**
- * do not use or override this internal method
- */
- protected void throwVetoExceptionInternal(ProcessingException e) throws ProcessingException {
- if (e instanceof VetoException) {
- if (!e.isConsumed()) {
- execOnVetoException((VetoException) e, e.getStatus().getCode());
- // if it was not re-thrown it is assumed to be consumed
- e.consume();
- }
- }
- throw e;
- }
-
- @Override
- public void removeCloseTimer() {
- setCloseTimerArmed(false);
- m_scoutCloseTimer = null;
- setSubTitle(null);
- }
-
- @Override
- public void validateForm() throws ProcessingException {
- m_currentValidateContentDescriptor = null;
- if (!execCheckFields()) {
- VetoException veto = new VetoException("Validate " + getClass().getSimpleName());
- veto.consume();
- throw veto;
- }
- if (!getHandler().onCheckFields()) {
- VetoException veto = new VetoException("Validate " + getClass().getSimpleName());
- veto.consume();
- throw veto;
- }
- // check all fields that might be invalid
- final ArrayList<String> invalidTexts = new ArrayList<String>();
- final ArrayList<String> mandatoryTexts = new ArrayList<String>();
- P_AbstractCollectingFieldVisitor<IValidateContentDescriptor> v = new P_AbstractCollectingFieldVisitor<IValidateContentDescriptor>() {
- @Override
- public boolean visitField(IFormField f, int level, int fieldIndex) {
- IValidateContentDescriptor desc = f.validateContent();
- if (desc != null) {
- if (desc.getErrorStatus() != null) {
- invalidTexts.add(desc.getDisplayText() + ": " + desc.getErrorStatus().getMessage());
- }
- else {
- mandatoryTexts.add(desc.getDisplayText());
- }
- if (getCollectionCount() == 0) {
- collect(desc);
- }
- }
- return true;
- }
- };
- visitFields(v);
- if (v.getCollectionCount() > 0) {
- IValidateContentDescriptor firstProblem = v.getCollection().get(0);
- if (LOG.isInfoEnabled()) {
- LOG.info("there are fields with errors");
- }
- StringBuffer buf = new StringBuffer();
- if (mandatoryTexts.size() > 0) {
- buf.append(ScoutTexts.get("FormEmptyMandatoryFieldsMessage") + "\n\n");
- for (Iterator it = mandatoryTexts.iterator(); it.hasNext();) {
- buf.append("- " + it.next() + "\n");
- }
- buf.append("\n");
- }
- if (invalidTexts.size() > 0) {
- buf.append(ScoutTexts.get("FormInvalidFieldsMessage") + "\n\n");
- for (Iterator it = invalidTexts.iterator(); it.hasNext();) {
- buf.append("- " + it.next() + "\n");
- }
- }
- String introText = ScoutTexts.get("FormIncompleteIntro");
- m_currentValidateContentDescriptor = firstProblem;
- //
- VetoException veto = new VetoException(introText, buf.toString());
- throw veto;
- }
- if (!execValidate()) {
- VetoException veto = new VetoException("Validate " + getClass().getSimpleName());
- veto.consume();
- throw veto;
- }
- if (!getHandler().onValidate()) {
- VetoException veto = new VetoException("Validate " + getClass().getSimpleName());
- veto.consume();
- throw veto;
- }
- }
-
- /**
- * attach a statement (mode) that is executed every interval
- *
- * @since Build 195 09.02.2005, imo
- */
- @Override
- public void setTimer(String timerId, int seconds) {
- removeTimer(timerId);
- if (seconds > 0) {
- P_Timer tim = new P_Timer(seconds, timerId);
- m_scoutTimerMap.put(timerId, tim);
- tim.start();
- }
- }
-
- /**
- * remove a statement (mode) that is executed every interval
- *
- * @since Build 195 09.02.2005, imo
- */
- @Override
- public void removeTimer(String timerId) {
- P_Timer tim = m_scoutTimerMap.remove(timerId);
- if (tim != null) {
- tim.setStopSignal();
- }
- }
-
- @Override
- public void doClose() throws ProcessingException {
- if (!isFormOpen()) {
- return;
- }
- m_closeType = IButton.SYSTEM_TYPE_CLOSE;
- discardStateInternal();
- doFinally();
- disposeFormInternal();
- }
-
- @Override
- public void doCancel() throws ProcessingException {
- if (!isFormOpen()) {
- return;
- }
- m_closeType = IButton.SYSTEM_TYPE_CANCEL;
- try {
- // ensure all fields have the right save-needed-state
- checkSaveNeeded();
- // find any fields that needs save
- P_AbstractCollectingFieldVisitor<IFormField> collector = new P_AbstractCollectingFieldVisitor<IFormField>() {
- @Override
- public boolean visitField(IFormField field, int level, int fieldIndex) {
- if (field.isSaveNeeded()) {
- collect(field);
- return false;
- }
- else {
- return true;
- }
- }
- };
- visitFields(collector);
- if (collector.getCollectionCount() > 0 && isAskIfNeedSave()) {
- MessageBox messageBox = new MessageBox(
- null,
- getCancelVerificationText(),
- null,
- TEXTS.get("YesButton"),
- TEXTS.get("NoButton"),
- TEXTS.get("CancelButton")
- );
- messageBox.setSeverity(IProcessingStatus.INFO);
- int result = messageBox.startMessageBox();
- if (result == IMessageBox.YES_OPTION) {
- doOk();
- return;
- }
- else if (result == IMessageBox.NO_OPTION) {
- doClose();
- return;
- }
- else {
- VetoException e = new VetoException(ScoutTexts.get("UserCancelledOperation"));
- e.consume();
- throw e;
- }
- }
- discardStateInternal();
- doFinally();
- disposeFormInternal();
- }
- catch (ProcessingException e) {
- m_closeType = IButton.SYSTEM_TYPE_NONE;
- throw e;
- }
- }
-
- @Override
- public void doReset() {
- setFormLoading(true);
- // reset values
- P_AbstractCollectingFieldVisitor v = new P_AbstractCollectingFieldVisitor() {
- @Override
- public boolean visitField(IFormField field, int level, int fieldIndex) {
- if (field instanceof IValueField) {
- IValueField f = (IValueField) field;
- f.resetValue();
- }
- else if (field instanceof IComposerField) {
- IComposerField f = (IComposerField) field;
- f.resetValue();
- }
- return true;
- }
- };
- visitFields(v);
- try {
- // init again
- initForm();
- // load again
- loadStateInternal();
- }
- catch (ProcessingException e) {
- e.addContextMessage(ScoutTexts.get("FormReset") + " " + getTitle());
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- }
-
- /**
- * Save data and close the form.
- * It will make this decision based on {@link #isSaveNeeded}.
- * Saving usually involves calling the <code>execStore</code> method
- * of the current form handler.
- *
- * @see AbstractFormHandler#execStore()
- */
- @Override
- public void doOk() throws ProcessingException {
- if (!isFormOpen()) {
- return;
- }
- try {
- m_closeType = IButton.SYSTEM_TYPE_NONE;
- checkSaveNeeded();
- validateForm();
- m_closeType = IButton.SYSTEM_TYPE_OK;
- if (isSaveNeeded()) {
- storeStateInternal();
- markSaved();
- }
- doFinally();
- disposeFormInternal();
- }
- catch (ProcessingException e) {
- m_closeType = IButton.SYSTEM_TYPE_NONE;
- throwVetoExceptionInternal(e);
- }
- }
-
- @Override
- public void doSaveWithoutMarkerChange() throws ProcessingException {
- if (!isFormOpen()) {
- return;
- }
- try {
- m_closeType = IButton.SYSTEM_TYPE_NONE;
- // ensure all fields have the right save-needed-state
- checkSaveNeeded();
- validateForm();
- m_closeType = IButton.SYSTEM_TYPE_SAVE_WITHOUT_MARKER_CHANGE;
- storeStateInternal();
- // do not set to "markSaved"
- }
- catch (ProcessingException e) {
- m_closeType = IButton.SYSTEM_TYPE_NONE;
- throwVetoExceptionInternal(e);
- }
- }
-
- @Override
- public void doSave() throws ProcessingException {
- if (!isFormOpen()) {
- return;
- }
- try {
- m_closeType = IButton.SYSTEM_TYPE_NONE;
- // ensure all fields have the right save-needed-state
- checkSaveNeeded();
- validateForm();
- m_closeType = IButton.SYSTEM_TYPE_SAVE;
- if (isSaveNeeded()) {
- storeStateInternal();
- markSaved();
- }
- }
- catch (ProcessingException e) {
- m_closeType = IButton.SYSTEM_TYPE_NONE;
- throwVetoExceptionInternal(e);
- }
- }
-
- @Override
- public void setAllEnabled(final boolean b) {
- P_AbstractCollectingFieldVisitor v = new P_AbstractCollectingFieldVisitor() {
- @Override
- public boolean visitField(IFormField f, int level, int fieldIndex) {
- boolean filteredB = b;
- /*
- * @since 3.0 all items are enabled/disabled. a dialog can still be
- * closed using the X in the window header if(f instanceof IButton){
- * IButton b=(IButton)f; if(b.isProcessButton()){
- * switch(b.getSystemType()){ case IButton.SYSTEM_TYPE_CLOSE: case
- * IButton.SYSTEM_TYPE_CANCEL:{ filteredB=true; break; } } } }
- */
- //
- f.setEnabled(filteredB);
- return true;
- }
- };
- visitFields(v);
- }
-
- @Override
- public void doFinally() {
- try {
- getHandler().onFinally();
- }
- catch (ProcessingException se) {
- se.addContextMessage(ScoutTexts.get("FormFinally") + " " + getTitle());
- SERVICES.getService(IExceptionHandlerService.class).handleException(se);
- }
- catch (Throwable t) {
- ProcessingException e = new ProcessingException(ScoutTexts.get("FormFinally") + " " + getTitle(), t);
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- }
-
- @Override
- public String getCancelVerificationText() {
- return m_cancelVerificationText;
- }
-
- @Override
- public void setCancelVerificationText(String text) {
- m_cancelVerificationText = text;
- }
-
- @Override
- public List<? extends IFormField> getInvalidFields() {
- // check all fields that might be invalid
- P_AbstractCollectingFieldVisitor<IFormField> v = new P_AbstractCollectingFieldVisitor<IFormField>() {
- @Override
- public boolean visitField(IFormField f, int level, int fieldIndex) {
- if (!f.isContentValid()) {
- collect(f);
- }
- return true;
- }
- };
- visitFields(v);
- return v.getCollection();
- }
-
- @Override
- public final void checkSaveNeeded() {
- // call checkSaveNeeded on all fields
- P_AbstractCollectingFieldVisitor<IFormField> v = new P_AbstractCollectingFieldVisitor<IFormField>() {
- @Override
- public boolean visitField(IFormField f, int level, int fieldIndex) {
- if (f instanceof IFormField) {
- f.checkSaveNeeded();
- }
- return true;
- }
- };
- visitFields(v);
- }
-
- private boolean/* ok */checkForVerifyingFields() {
- // check all fields that might be invalid
- P_AbstractCollectingFieldVisitor v = new P_AbstractCollectingFieldVisitor() {
- @Override
- public boolean visitField(IFormField field, int level, int fieldIndex) {
- if (field instanceof IValueField) {
- IValueField f = (IValueField) field;
- if (f.isValueChanging() || f.isValueParsing()) {
- return false;
- }
- }
- return true;
- }
- };
- return visitFields(v);
- }
-
- private void closeFormInternal(boolean kill) {
- if (isFormOpen()) {
- try {
- // check if there is an active close, cancel or finish button
- final HashSet<Integer> enabledSystemTypes = new HashSet<Integer>();
- final HashSet<IButton> enabledSystemButtons = new HashSet<IButton>();
- IFormFieldVisitor v = new IFormFieldVisitor() {
- @Override
- public boolean visitField(IFormField field, int level, int fieldIndex) {
- if (field instanceof IButton) {
- IButton b = (IButton) field;
- if (b.isEnabled() && b.isVisible() && b.isEnabledProcessingButton()) {
- enabledSystemTypes.add(b.getSystemType());
- enabledSystemButtons.add(b);
- }
- }
- return true;
- }
- };
- try {
- visitFields(v);
- for (IButton b : enabledSystemButtons) {
- b.setEnabledProcessingButton(false);
- }
- execOnCloseRequest(kill, enabledSystemTypes);
- }
- finally {
- for (IButton b : enabledSystemButtons) {
- b.setEnabledProcessingButton(true);
- }
- }
- }
- catch (ProcessingException se) {
- se.addContextMessage(ScoutTexts.get("FormClosing") + " " + getTitle());
- SERVICES.getService(IExceptionHandlerService.class).handleException(se);
- }
- catch (Throwable t) {
- ProcessingException e = new ProcessingException(ScoutTexts.get("FormClosing") + " " + getTitle(), t);
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- }
- }
-
- @Override
- public void touch() {
- getRootGroupBox().touch();
- }
-
- @Override
- public boolean isSaveNeeded() {
- return getRootGroupBox().isSaveNeeded();
- }
-
- @Override
- public void markSaved() {
- getRootGroupBox().markSaved();
- }
-
- @Override
- public boolean isEmpty() {
- return getRootGroupBox().isEmpty();
- }
-
- /**
- * do not use or override this internal method
- */
- protected void disposeFormInternal() {
- if (!isFormOpen()) {
- return;
- }
- try {
- setButtonsArmed(false);
- setCloseTimerArmed(false);
- //
- m_scoutCloseTimer = null;
- for (Iterator it = m_scoutTimerMap.values().iterator(); it.hasNext();) {
- ((P_Timer) it.next()).setStopSignal();
- }
- m_scoutTimerMap.clear();
- m_displayHintLocked = false;
- m_formLoading = true;
- }
- catch (Throwable t) {
- LOG.warn("Form " + getClass().getName(), t);
- }
- // dispose fields
- FormUtility.disposeFormFields(this);
- // dispose form configuration
- try {
- execDisposeForm();
- }
- catch (Throwable t) {
- LOG.warn("Form " + getClass().getName(), t);
- }
- try {
- // deregister of wizard / desktop
- if (isAutoAddRemoveOnDesktop()) {
- IDesktop desktop = getDesktop();
- if (desktop != null) {
- desktop.removeForm(this);
- }
- }
- }
- finally {
- // unlock
- m_blockingCondition.release();
- // fire
- fireFormClosed();
- }
- }
-
- @Override
- public boolean isShowing() {
- IDesktop desktop = getDesktop();
- if (desktop != null) {
- return desktop.isShowing(this);
- }
- else {
- return false;
- }
- }
-
- @Override
- public boolean isFormClosed() {
- return !isFormOpen();
- }
-
- @Override
- public boolean isFormOpen() {
- return m_blockingCondition.isBlocking();
- }
-
- @SuppressWarnings("deprecation")
- @Override
- public Object getCustomProperty(String propName) {
- return getProperty(propName);
- }
-
- @SuppressWarnings("deprecation")
- @Override
- public void setCustomProperty(String propName, Object o) {
- setProperty(propName, o);
- }
-
- @Override
- public Object getProperty(String name) {
- return propertySupport.getProperty(name);
- }
-
- @Override
- public void setProperty(String name, Object value) {
- propertySupport.setProperty(name, value);
- }
-
- @Override
- public boolean hasProperty(String name) {
- return propertySupport.hasProperty(name);
- }
-
- @Override
- public void setXML(String xml) throws ProcessingException {
- if (xml == null) {
- return;
- }
- SimpleXmlElement root = new SimpleXmlElement();
- try {
- root.parseString(xml);
- }
- catch (Throwable t) {
- throw new ProcessingException("Loading xml", t);
- }
- loadXML(root);
- }
-
- @Override
- public String getXML(String encoding) throws ProcessingException {
- if (encoding == null) {
- encoding = "UTF-8";
- }
- try {
- SimpleXmlElement e = storeXML();
- ByteArrayOutputStream bo = new ByteArrayOutputStream();
- e.writeDocument(bo, null, encoding);
- return new String(bo.toByteArray(), Charset.forName(encoding));
- }
- catch (Throwable e) {
- if (e instanceof ProcessingException) {
- throw (ProcessingException) e;
- }
- else {
- throw new ProcessingException("form : " + getTitle() + ", encoding: " + encoding, e);
- }
- }
- }
-
- @Override
- public SimpleXmlElement storeXML() throws ProcessingException {
- SimpleXmlElement root = new SimpleXmlElement("form-state");
- storeXML(root);
- return root;
- }
-
- @Override
- public void storeXML(SimpleXmlElement root) throws ProcessingException {
- root.setAttribute("formId", getFormId());
- root.setAttribute("formQname", getClass().getName());
- // add custom properties
- SimpleXmlElement xProps = new SimpleXmlElement("properties");
- root.addChild(xProps);
- IPropertyFilter filter = new IPropertyFilter() {
- @Override
- public boolean accept(FastPropertyDescriptor descriptor) {
- if (descriptor.getPropertyType().isInstance(IFormField.class)) {
- return false;
- }
- if (!descriptor.getPropertyType().isPrimitive() && !Serializable.class.isAssignableFrom(descriptor.getPropertyType())) {
- return false;
- }
- if (descriptor.getReadMethod() == null || descriptor.getWriteMethod() == null) {
- return false;
- }
- return true;
- }
- };
- Map props = BeanUtility.getProperties(this, AbstractForm.class, filter);
- for (Iterator it = props.entrySet().iterator(); it.hasNext();) {
- Map.Entry entry = (Map.Entry) it.next();
- try {
- SimpleXmlElement xProp = new SimpleXmlElement("property");
- xProps.addChild(xProp);
- xProp.setAttribute("name", entry.getKey());
- xProp.setObjectAttribute("value", entry.getValue());
- }
- catch (Exception e) {
- throw new ProcessingException("property " + entry.getKey() + " with value " + entry.getValue(), e);
- }
- }
- // add fields
- final SimpleXmlElement xFields = new SimpleXmlElement("fields");
- root.addChild(xFields);
- final Holder<ProcessingException> exceptionHolder = new Holder<ProcessingException>(ProcessingException.class);
- P_AbstractCollectingFieldVisitor v = new P_AbstractCollectingFieldVisitor() {
- @Override
- public boolean visitField(IFormField field, int level, int fieldIndex) {
- SimpleXmlElement xField = new SimpleXmlElement("field");
- try {
- field.storeXML(xField);
- xFields.addChild(xField);
- }
- catch (ProcessingException e) {
- exceptionHolder.setValue(e);
- return false;
- }
- return true;
- }
- };
- visitFields(v);
- if (exceptionHolder.getValue() != null) {
- throw exceptionHolder.getValue();
- }
- }
-
- @Override
- public void loadXML(SimpleXmlElement root) throws ProcessingException {
- String formId = getFormId();
- String xmlId = root.getStringAttribute("formId", "");
- if (!formId.equals(xmlId)) {
- throw new ProcessingException("xml id=" + xmlId + " does not match form id=" + formId);
- }
- // load properties
- HashMap<String, Object> props = new HashMap<String, Object>();
- SimpleXmlElement xProps = root.getChild("properties");
- if (xProps != null) {
- for (Iterator it = xProps.getChildren("property").iterator(); it.hasNext();) {
- SimpleXmlElement xProp = (SimpleXmlElement) it.next();
- String name = xProp.getStringAttribute("name");
- try {
- Object value = xProp.getObjectAttribute("value", null, getClass().getClassLoader());
- props.put(name, value);
- }
- catch (Exception e) {
- LOG.warn("property " + name, e);
- }
- }
- }
- BeanUtility.setProperties(this, props, true, null);
- // load fields
- SimpleXmlElement xFields = root.getChild("fields");
- if (xFields != null) {
- for (SimpleXmlElement xField : xFields.getChildren("field")) {
- List<String> xmlFieldIds = new LinkedList<String>();
- // add enclosing field path to xml field IDs
- for (SimpleXmlElement element : xField.getChildren("enclosingField")) {
- xmlFieldIds.add(element.getStringAttribute("fieldId"));
- }
- xmlFieldIds.add(xField.getStringAttribute("fieldId"));
- FindFieldByXmlIdsVisitor v = new FindFieldByXmlIdsVisitor(xmlFieldIds.toArray(new String[xmlFieldIds.size()]));
- visitFields(v);
- IFormField f = v.getField();
- if (f != null) {
- f.loadXML(xField);
- }
- }
- }
- // in all tabboxes select the first tab that contains data, iff the current
- // tab has no values set
- getRootGroupBox().visitFields(new IFormFieldVisitor() {
- @Override
- public boolean visitField(IFormField field, int level, int fieldIndex) {
- if (field instanceof ITabBox) {
- ITabBox tabBox = (ITabBox) field;
- IGroupBox selbox = tabBox.getSelectedTab();
- if (selbox == null || !selbox.isSaveNeeded()) {
- for (IGroupBox g : tabBox.getGroupBoxes()) {
- if (g.isSaveNeeded()) {
- tabBox.setSelectedTab(g);
- break;
- }
- }
- }
- }
- return true;
- }
- }, 0);
- }
-
- @Override
- public void doExportXml(boolean saveAs) {
- while (true) {
- File path = m_lastXmlFileForStorage;
- if (saveAs || path == null) {
- File dir = m_lastXmlFileForStorage;
- if (dir != null) {
- dir = dir.getParentFile();
- }
- File[] a = new FileChooser(dir, new String[]{"xml"}, false).startChooser();
- if (a.length == 0) {
- break;
- }
- else {
- path = a[0];
- }
- }
- // export search parameters
- try {
- storeXML().writeDocument(new OutputStreamWriter(new FileOutputStream(path), "UTF-8"), null, "UTF-8");
- if (path != null) {
- m_lastXmlFileForStorage = path;
- }
- break;
- }
- catch (Throwable t) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException(ScoutTexts.get("FormExportXml") + " " + getTitle(), t));
- saveAs = true;
- }
- }// end while nok
- }
-
- @Override
- public void doImportXml() {
- File dir = m_lastXmlFileForStorage;
- if (dir != null) {
- dir = dir.getParentFile();
- }
- File[] a = new FileChooser(dir, new String[]{"xml"}, true).startChooser();
- if (a.length == 1) {
- File newPath = a[0];
- String text = null;
- try {
- SimpleXmlElement e = new SimpleXmlElement();
- e.parseStream(new FileInputStream(newPath));
- // load xml to search
- m_lastXmlFileForStorage = newPath;
- loadXML(e);
- }
- catch (Exception e) {
- LOG.warn("loading: " + newPath + " text: " + text + " Exception: " + e);
- new MessageBox(
- null,
- TEXTS.get("LoadFormXmlFailedText"),
- null,
- TEXTS.get("OkButton"),
- null,
- null).startMessageBox();
- m_lastXmlFileForStorage = null;
- }
- }
- }
-
- @Override
- public void printForm(PrintDevice device, Map<String, Object> parameters) {
- try {
- firePrint(null, device, parameters);
- }
- catch (ProcessingException e) {
- e.addContextMessage(ScoutTexts.get("FormPrint") + " " + getTitle());
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- }
-
- @Override
- public void printField(IFormField field, PrintDevice device, Map<String, Object> parameters) {
- try {
- firePrint(field, device, parameters);
- }
- catch (ProcessingException e) {
- e.addContextMessage(ScoutTexts.get("FormPrint") + " " + (field != null ? field.getLabel() : getTitle()));
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- }
-
- @Override
- public void activate() {
- if (getDesktop() != null) {
- getDesktop().ensureVisible(this);
- }
- }
-
- @Override
- public void requestFocus(IFormField f) {
- if (f == null || f.getForm() != this) {
- return;
- }
- fireRequestFocus(f);
- }
-
- /**
- * Model Observer .
- */
- @Override
- public void addFormListener(FormListener listener) {
- m_listenerList.add(FormListener.class, listener);
- }
-
- @Override
- public void removeFormListener(FormListener listener) {
- m_listenerList.remove(FormListener.class, listener);
- }
-
- protected IEventHistory<FormEvent> createEventHistory() {
- return new DefaultFormEventHistory(5000L);
- }
-
- @Override
- public IEventHistory<FormEvent> getEventHistory() {
- return m_eventHistory;
- }
-
- private void fireFormLoadBefore() throws ProcessingException {
- fireFormEvent(new FormEvent(this, FormEvent.TYPE_LOAD_BEFORE));
- }
-
- private void fireFormLoadAfter() throws ProcessingException {
- fireFormEvent(new FormEvent(this, FormEvent.TYPE_LOAD_AFTER));
- }
-
- private void fireFormLoadComplete() throws ProcessingException {
- fireFormEvent(new FormEvent(this, FormEvent.TYPE_LOAD_COMPLETE));
- }
-
- private void fireFormStoreBefore() throws ProcessingException {
- fireFormEvent(new FormEvent(this, FormEvent.TYPE_STORE_BEFORE));
- }
-
- private void fireFormDiscarded() {
- try {
- fireFormEvent(new FormEvent(this, FormEvent.TYPE_DISCARDED));
- }
- catch (ProcessingException e) {
- e.addContextMessage(ScoutTexts.get("FormFireDiscarded") + " " + getTitle());
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- }
-
- private void fireFormStoreAfter() throws ProcessingException {
- fireFormEvent(new FormEvent(this, FormEvent.TYPE_STORE_AFTER));
- }
-
- private void firePrint(IFormField root, PrintDevice device, Map<String, Object> parameters) throws ProcessingException {
- fireFormEvent(new FormEvent(this, FormEvent.TYPE_PRINT, root, device, parameters));
- }
-
- private void fireFormPrinted(File outputFile) {
- try {
- fireFormEvent(new FormEvent(this, FormEvent.TYPE_PRINTED, outputFile));
- }
- catch (ProcessingException e) {
- e.addContextMessage(ScoutTexts.get("FormFirePrinted") + " " + getTitle());
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- }
-
- /**
- * send request that form was activated by gui
- */
- private void fireFormActivated() {
- try {
- execFormActivated();
- fireFormEvent(new FormEvent(this, FormEvent.TYPE_ACTIVATED));
-
- }
- catch (ProcessingException e) {
- e.addContextMessage(ScoutTexts.get("FormFireActivated") + " " + getTitle());
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- }
-
- /**
- * send request that form was closed by gui
- */
- private void fireFormClosed() {
- try {
- fireFormEvent(new FormEvent(this, FormEvent.TYPE_CLOSED));
- }
- catch (ProcessingException e) {
- e.addContextMessage(ScoutTexts.get("FormFireClosed") + " " + getTitle());
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- }
-
- private void fireFormEvent(FormEvent e) throws ProcessingException {
- EventListener[] listeners = m_listenerList.getListeners(FormListener.class);
- if (listeners != null && listeners.length > 0) {
- ProcessingException pe = null;
- for (int i = 0; i < listeners.length; i++) {
- try {
- ((FormListener) listeners[i]).formChanged(e);
- }
- catch (ProcessingException ex) {
- if (pe == null) {
- pe = ex;
- }
- }
- catch (Throwable t) {
- if (pe == null) {
- pe = new ProcessingException("Unexpected", t);
- }
- }
- }
- if (pe != null) {
- throw pe;
- }
- }
- IEventHistory<FormEvent> h = getEventHistory();
- if (h != null) {
- h.notifyEvent(e);
- }
- }
-
- @Override
- public void structureChanged(IFormField causingField) {
- fireFormStructureChanged(causingField);
- }
-
- private void fireFormStructureChanged(IFormField causingField) {
- try {
- fireFormEvent(new FormEvent(this, FormEvent.TYPE_STRUCTURE_CHANGED, causingField));
- }
- catch (ProcessingException e) {
- e.addContextMessage(ScoutTexts.get("FormFireStructureChanged") + " " + getTitle());
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- }
-
- private void fireFormToFront() {
- try {
- fireFormEvent(new FormEvent(this, FormEvent.TYPE_TO_FRONT));
- }
- catch (ProcessingException e) {
- e.addContextMessage(ScoutTexts.get("FormFireToFront") + " " + getTitle());
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- }
-
- private void fireFormToBack() {
- try {
- fireFormEvent(new FormEvent(this, FormEvent.TYPE_TO_BACK));
- }
- catch (ProcessingException e) {
- e.addContextMessage(ScoutTexts.get("FormFireToBack") + " " + getTitle());
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- }
-
- private void fireRequestFocus(IFormField f) {
- try {
- fireFormEvent(new FormEvent(this, FormEvent.TYPE_REQUEST_FOCUS, f));
- }
- catch (ProcessingException e) {
- e.addContextMessage(ScoutTexts.get("FormFireRequestFocus") + " " + getTitle() + " for " + f.getLabel());
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- }
-
- @Override
- public String getBasicTitle() {
- return m_basicTitle;
- }
-
- @Override
- public void setBasicTitle(String basicTitle) {
- m_basicTitle = basicTitle;
- composeTitle();
- }
-
- @Override
- public String getSubTitle() {
- return m_subTitle;
- }
-
- @Override
- public void setSubTitle(String subTitle) {
- m_subTitle = subTitle;
- composeTitle();
- }
-
- @Override
- public void setTitle(String s) {
- m_basicTitle = s;
- m_subTitle = null;
- composeTitle();
- }
-
- private void composeTitle() {
- StringBuffer buf = new StringBuffer();
- String basic = getBasicTitle();
- if (basic != null) {
- if (buf.length() > 0) {
- buf.append(" - ");
- }
- buf.append(basic);
- }
- String sub = getSubTitle();
- if (sub != null) {
- if (buf.length() > 0) {
- buf.append(" - ");
- }
- buf.append(sub);
- }
- propertySupport.setPropertyString(PROP_TITLE, buf.toString());
- }
-
- @Override
- public String getTitle() {
- return propertySupport.getPropertyString(PROP_TITLE);
- }
-
- @Override
- public boolean isMaximizeEnabled() {
- return propertySupport.getPropertyBool(PROP_MAXIMIZE_ENABLED);
- }
-
- @Override
- public void setMaximizeEnabled(boolean b) {
- propertySupport.setPropertyBool(PROP_MAXIMIZE_ENABLED, b);
- }
-
- @Override
- public boolean isMinimizeEnabled() {
- return propertySupport.getPropertyBool(PROP_MINIMIZE_ENABLED);
- }
-
- @Override
- public void setMinimizeEnabled(boolean b) {
- propertySupport.setPropertyBool(PROP_MINIMIZE_ENABLED, b);
- }
-
- @Override
- public boolean isMaximized() {
- return propertySupport.getPropertyBool(PROP_MAXIMIZED);
- }
-
- @Override
- public void setMaximized(boolean b) {
- if (isMaximizeEnabled()) {
- if (b) {
- propertySupport.setPropertyBool(PROP_MINIMIZED, false);
- }
- // maximized state of ui could be out of sync, fire always
- propertySupport.setPropertyAlwaysFire(PROP_MAXIMIZED, b);
- }
- }
-
- @Override
- public boolean isMinimized() {
- return propertySupport.getPropertyBool(PROP_MINIMIZED);
- }
-
- @Override
- public void setMinimized(boolean b) {
- if (isMinimizeEnabled()) {
- if (b) {
- propertySupport.setPropertyBool(PROP_MAXIMIZED, false);
- }
- // minimized state of ui could be out of sync, fire always
- propertySupport.setPropertyAlwaysFire(PROP_MINIMIZED, b);
-
- }
- }
-
- @Override
- public boolean isAutoAddRemoveOnDesktop() {
- return m_autoRegisterInDesktopOnStart;
- }
-
- @Override
- public void setAutoAddRemoveOnDesktop(boolean b) {
- m_autoRegisterInDesktopOnStart = b;
- }
-
- @Override
- public boolean isModal() {
- return m_modal;
- }
-
- @Override
- public void setModal(boolean b) {
- if (b) {
- switch (getDisplayHint()) {
- case DISPLAY_HINT_POPUP_DIALOG:
- case DISPLAY_HINT_DIALOG: {
- m_modal = b;
- break;
- }
- default: {
- LOG.warn("cannot set property 'modal' to true with current display hint type");
- }
- }
- }
- else {
- m_modal = b;
- }
- }
-
- @Override
- public void setCacheBounds(boolean cacheBounds) {
- m_cacheBounds = cacheBounds;
- }
-
- @Override
- public boolean isCacheBounds() {
- return m_cacheBounds;
- }
-
- @Override
- public String computeCacheBoundsKey() {
- return getClass().getName();
- }
-
- @Override
- public int getDisplayHint() {
- return m_displayHint;
- }
-
- @Override
- public void setDisplayHint(int i) {
- switch (i) {
- case DISPLAY_HINT_DIALOG: {
- m_displayHint = i;
- break;
- }
- case DISPLAY_HINT_POPUP_WINDOW: {
- m_displayHint = i;
- setModal(false);
- break;
- }
- case DISPLAY_HINT_POPUP_DIALOG: {
- m_displayHint = i;
- break;
- }
- case DISPLAY_HINT_VIEW: {
- m_displayHint = i;
- setModal(false);
- break;
- }
- default: {
- throw new IllegalArgumentException("invalid displayHint " + i);
- }
- }
- }
-
- @Override
- public String getDisplayViewId() {
- return m_displayViewId;
- }
-
- @Override
- public void setDisplayViewId(String viewId) {
- m_displayViewId = viewId;
- }
-
- @Override
- public boolean isAskIfNeedSave() {
- return m_askIfNeedSave;
- }
-
- @Override
- public void setAskIfNeedSave(boolean b) {
- m_askIfNeedSave = b;
- }
-
- @Override
- public void toFront() {
- fireFormToFront();
- }
-
- @Override
- public void toBack() {
- fireFormToBack();
- }
-
- @Override
- public boolean isButtonsArmed() {
- return m_buttonsArmed;
- }
-
- @Override
- public void setButtonsArmed(boolean b) {
- m_buttonsArmed = b;
- }
-
- @Override
- public boolean isCloseTimerArmed() {
- return m_closeTimerArmed;
- }
-
- @Override
- public void setCloseTimerArmed(boolean b) {
- m_closeTimerArmed = b;
- }
-
- @Override
- public String toString() {
- return "Form " + getFormId();
- }
-
- @Override
- public IFormUIFacade getUIFacade() {
- return m_uiFacade;
- }
-
- protected void handleSystemButtonEventInternal(ButtonEvent e) {
- switch (e.getType()) {
- case ButtonEvent.TYPE_CLICKED: {
- // disable close timer
- setCloseTimerArmed(false);
- if (isButtonsArmed()) {
- if (checkForVerifyingFields()) {
- try {
- IButton src = (IButton) e.getSource();
- switch (src.getSystemType()) {
- case IButton.SYSTEM_TYPE_CANCEL: {
- doCancel();
- break;
- }
- case IButton.SYSTEM_TYPE_CLOSE: {
- doClose();
- break;
- }
- case IButton.SYSTEM_TYPE_OK: {
- doOk();
- break;
- }
- case IButton.SYSTEM_TYPE_RESET: {
- doReset();
- break;
- }
- case IButton.SYSTEM_TYPE_SAVE: {
- doSave();
- break;
- }
- case IButton.SYSTEM_TYPE_SAVE_WITHOUT_MARKER_CHANGE: {
- doSaveWithoutMarkerChange();
- break;
- }
- }
- }
- catch (ProcessingException se) {
- se.addContextMessage(ScoutTexts.get("FormButtonClicked") + " " + getTitle() + "." + e.getButton().getLabel());
- SERVICES.getService(IExceptionHandlerService.class).handleException(se);
- }
- if (m_currentValidateContentDescriptor != null) {
- m_currentValidateContentDescriptor.activateProblemLocation();
- m_currentValidateContentDescriptor = null;
- }
- }// end
- }
- break;
- }
- }
- }
-
- /**
- * Button controller for ok,cancel, save etc.
- */
- private class P_SystemButtonListener implements ButtonListener {
- @Override
- public void buttonChanged(ButtonEvent e) {
- // auto-detaching
- if (m_systemButtonListener != this) {
- ((IButton) e.getSource()).removeButtonListener(this);
- return;
- }
- handleSystemButtonEventInternal(e);
- }
- }// end private class
-
- private class P_MainBoxPropertyChangeProxy implements PropertyChangeListener {
- @Override
- public void propertyChange(PropertyChangeEvent e) {
- if (IFormField.PROP_SAVE_NEEDED.equals(e.getPropertyName())) {
- propertySupport.firePropertyChange(PROP_SAVE_NEEDED, e.getOldValue(), e.getNewValue());
- }
- else if (IFormField.PROP_EMPTY.equals(e.getPropertyName())) {
- propertySupport.firePropertyChange(PROP_EMPTY, e.getOldValue(), e.getNewValue());
- }
- }
- }
-
- /**
- * form custom timer
- */
- private class P_Timer extends StoppableThread {
- private final long m_intervalMillis;
- private final String m_timerId;
- private boolean m_execPending = false;// do not execute while exec is pending
- private final IClientSession m_session;
-
- public P_Timer(long seconds, String timerId) {
- setDaemon(true);
- m_intervalMillis = seconds * 1000L;
- m_timerId = timerId;
- m_session = ClientSyncJob.getCurrentSession();
- }
-
- @Override
- public void run() {
- long next = ((System.currentTimeMillis() + 999L) / 1000L) * 1000L + m_intervalMillis;
- while (m_scoutTimerMap != null && !isStopSignal()) {
- try {
- sleep(250);
- }
- catch (InterruptedException ex) {
- }
- // active?
- if ((!m_execPending) && (!isStopSignal())) {
- // next ready?
- if (next < System.currentTimeMillis()) {
- m_execPending = true;
- new ClientSyncJob("Form timer", m_session) {
- @Override
- protected void runVoid(IProgressMonitor monitor) throws Throwable {
- try {
- if (LOG.isInfoEnabled()) {
- LOG.info("timer " + m_timerId);
- }
- execTimer(m_timerId);
- }
- catch (ProcessingException se) {
- se.addContextMessage(ScoutTexts.get("FormTimerActivated") + " " + getTitle() + "." + m_timerId);
- SERVICES.getService(IExceptionHandlerService.class).handleException(se);
- }
- finally {
- m_execPending = false;// continue scheduling
- }
- }
- }.schedule();
- }
- }
- // update next
- while (next < System.currentTimeMillis()) {
- next = next + m_intervalMillis;
- }
- }
- }
- }// end private class
-
- /**
- * form close timer
- */
- private class P_CloseTimer extends StoppableThread {
- private long m_seconds;
- private final IClientSession m_session;
-
- public P_CloseTimer(long seconds) {
- setName("IForm.P_CloseTimer");
- setDaemon(true);
- m_seconds = seconds;
- m_session = ClientSyncJob.getCurrentSession();
- }
-
- @Override
- public void run() {
- while (this == m_scoutCloseTimer && m_seconds > 0 && isCloseTimerArmed()) {
- new ClientSyncJob("Form close countdown", m_session) {
- @Override
- protected void runVoid(IProgressMonitor monitor) throws Throwable {
- setSubTitle("" + m_seconds);
- }
- }.schedule();
- try {
- sleep(1000);
- }
- catch (InterruptedException ex) {
- }
- m_seconds--;
- }
- if (this == m_scoutCloseTimer) {
- new ClientSyncJob("Form close timer", m_session) {
- @Override
- protected void runVoid(IProgressMonitor monitor) throws Throwable {
- try {
- if (isCloseTimerArmed()) {
- execCloseTimer();
- }
- else {
- setSubTitle(null);
- }
- }
- catch (ProcessingException se) {
- se.addContextMessage(ScoutTexts.get("FormCloseTimerActivated") + " " + getTitle());
- SERVICES.getService(IExceptionHandlerService.class).handleException(se);
- }
- }
- }.schedule();
- }
- }
- }// end private class
-
- private abstract static class P_AbstractCollectingFieldVisitor<T> implements IFormFieldVisitor {
- private final ArrayList<T> m_list = new ArrayList<T>();
-
- public void collect(T o) {
- m_list.add(o);
- }
-
- public int getCollectionCount() {
- return m_list.size();
- }
-
- public List<T> getCollection() {
- return m_list;
- }
-
- }
-
- private class P_UIFacade implements IFormUIFacade {
- @Override
- public void fireFormActivatedFromUI() {
- fireFormActivated();
- }
-
- @Override
- public void fireFormClosingFromUI() {
- // check if some field is verifying input. In this case cancel ui call
- if (!checkForVerifyingFields()) {
- return;
- }
- closeFormInternal(false);
- }
-
- @Override
- public void fireFormKilledFromUI() {
- closeFormInternal(true);
- }
-
- @Override
- public void fireFormPrintedFromUI(File outputFile) {
- fireFormPrinted(outputFile);
- }
- }// end private class
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Serializable;
+import java.nio.charset.Charset;
+import java.security.Permission;
+import java.util.ArrayList;
+import java.util.EventListener;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.scout.commons.BeanUtility;
+import org.eclipse.scout.commons.ConfigurationUtility;
+import org.eclipse.scout.commons.EventListenerList;
+import org.eclipse.scout.commons.StoppableThread;
+import org.eclipse.scout.commons.annotations.ConfigOperation;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.FormData;
+import org.eclipse.scout.commons.annotations.FormData.SdkCommand;
+import org.eclipse.scout.commons.annotations.InjectFieldTo;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.beans.AbstractPropertyObserver;
+import org.eclipse.scout.commons.beans.FastPropertyDescriptor;
+import org.eclipse.scout.commons.beans.IPropertyFilter;
+import org.eclipse.scout.commons.exception.IProcessingStatus;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.exception.VetoException;
+import org.eclipse.scout.commons.holders.Holder;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.commons.xmlparser.SimpleXmlElement;
+import org.eclipse.scout.rt.client.BlockingCondition;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.client.services.common.search.ISearchFilterService;
+import org.eclipse.scout.rt.client.ui.DataChangeListener;
+import org.eclipse.scout.rt.client.ui.IEventHistory;
+import org.eclipse.scout.rt.client.ui.WeakDataChangeListener;
+import org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke;
+import org.eclipse.scout.rt.client.ui.basic.filechooser.FileChooser;
+import org.eclipse.scout.rt.client.ui.desktop.AbstractDesktop;
+import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
+import org.eclipse.scout.rt.client.ui.form.fields.AbstractFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.IValidateContentDescriptor;
+import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
+import org.eclipse.scout.rt.client.ui.form.fields.button.ButtonEvent;
+import org.eclipse.scout.rt.client.ui.form.fields.button.ButtonListener;
+import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
+import org.eclipse.scout.rt.client.ui.form.fields.composer.IComposerField;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox;
+import org.eclipse.scout.rt.client.ui.form.fields.tabbox.ITabBox;
+import org.eclipse.scout.rt.client.ui.form.fields.wrappedform.IWrappedFormField;
+import org.eclipse.scout.rt.client.ui.form.internal.FindFieldByFormDataIdVisitor;
+import org.eclipse.scout.rt.client.ui.form.internal.FindFieldByXmlIdsVisitor;
+import org.eclipse.scout.rt.client.ui.form.internal.FormDataPropertyFilter;
+import org.eclipse.scout.rt.client.ui.messagebox.IMessageBox;
+import org.eclipse.scout.rt.client.ui.messagebox.MessageBox;
+import org.eclipse.scout.rt.client.ui.profiler.DesktopProfiler;
+import org.eclipse.scout.rt.client.ui.wizard.IWizard;
+import org.eclipse.scout.rt.client.ui.wizard.IWizardStep;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.TEXTS;
+import org.eclipse.scout.rt.shared.data.form.AbstractFormData;
+import org.eclipse.scout.rt.shared.data.form.fields.AbstractFormFieldData;
+import org.eclipse.scout.rt.shared.data.form.fields.AbstractValueFieldData;
+import org.eclipse.scout.rt.shared.data.form.fields.tablefield.AbstractTableFieldData;
+import org.eclipse.scout.rt.shared.data.form.properties.AbstractPropertyData;
+import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
+import org.eclipse.scout.rt.shared.services.common.jdbc.SearchFilter;
+import org.eclipse.scout.rt.shared.services.common.security.IAccessControlService;
+import org.eclipse.scout.service.SERVICES;
+
+@FormData(value = AbstractFormData.class, sdkCommand = SdkCommand.USE)
+public abstract class AbstractForm extends AbstractPropertyObserver implements IForm {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractForm.class);
+
+ private boolean m_initialized;
+ private final EventListenerList m_listenerList = new EventListenerList();
+ private IFormUIFacade m_uiFacade;
+ private IWizardStep m_wizardStep;
+ private boolean m_modal;// no property, is fixed
+ private boolean m_cacheBounds; // no property is fixed
+ private boolean m_askIfNeedSave;
+ private boolean m_buttonsArmed;
+ private boolean m_closeTimerArmed;
+ private boolean m_formStored;
+ private boolean m_formLoading;
+ private final BlockingCondition m_blockingCondition;
+ private boolean m_autoRegisterInDesktopOnStart;
+ private int m_displayHint;// no property, is fixed
+ private String m_displayViewId;// no property, is fixed
+ private boolean m_displayHintLocked = false;// no property, is fixed
+ private int m_closeType = IButton.SYSTEM_TYPE_NONE;
+ private String m_basicTitle;
+ private String m_subTitle;
+ private String m_cancelVerificationText;
+ private File m_lastXmlFileForStorage;
+ private IGroupBox m_mainBox;
+ private IWrappedFormField m_wrappedFormField;
+ private P_SystemButtonListener m_systemButtonListener;
+
+ private IFormHandler m_handler;
+ // access control
+ private boolean m_enabledGranted;
+ private boolean m_visibleGranted;
+ // search
+ private SearchFilter m_searchFilter;
+ //validate content assistant
+ private IValidateContentDescriptor m_currentValidateContentDescriptor;
+
+ // current timers
+ private P_CloseTimer m_scoutCloseTimer;
+ private HashMap<String, P_Timer> m_scoutTimerMap;
+ private String m_iconId;
+ private DataChangeListener m_internalDataChangeListener;
+ private IEventHistory<FormEvent> m_eventHistory;
+
+ public AbstractForm() throws ProcessingException {
+ this(true);
+ }
+
+ public AbstractForm(boolean callInitializer) throws ProcessingException {
+ if (DesktopProfiler.getInstance().isEnabled()) {
+ DesktopProfiler.getInstance().registerForm(this);
+ }
+ m_eventHistory = createEventHistory();
+ m_enabledGranted = true;
+ m_visibleGranted = true;
+ m_formLoading = true;
+ m_blockingCondition = new BlockingCondition(false);
+ if (callInitializer) {
+ callInitializer();
+ }
+ }
+
+ protected void callInitializer() throws ProcessingException {
+ if (!m_initialized) {
+ initConfig();
+ postInitConfig();
+ m_initialized = true;
+ }
+ }
+
+ /*
+ * Configuration
+ */
+ @ConfigProperty(ConfigProperty.TEXT)
+ @Order(10)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredTitle() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.TEXT)
+ @Order(11)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredSubTitle() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.INTEGER)
+ @Order(20)
+ @ConfigPropertyValue("0")
+ protected int/* seconds */getConfiguredCloseTimer() {
+ return 0;
+ }
+
+ @ConfigProperty(ConfigProperty.INTEGER)
+ @Order(40)
+ @ConfigPropertyValue("0")
+ protected int/* seconds */getConfiguredCustomTimer() {
+ return 0;
+ }
+
+ @ConfigProperty(ConfigProperty.DOC)
+ @Order(60)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredDoc() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.TEXT)
+ @Order(90)
+ @ConfigPropertyValue("ScoutTexts.get(\"FormSaveChangesQuestion\")")
+ protected String getConfiguredCancelVerificationText() {
+ return ScoutTexts.get("FormSaveChangesQuestion");
+ }
+
+ @ConfigProperty(ConfigProperty.FORM_DISPLAY_HINT)
+ @Order(100)
+ @ConfigPropertyValue("DISPLAY_HINT_DIALOG")
+ protected int getConfiguredDisplayHint() {
+ return DISPLAY_HINT_DIALOG;
+ }
+
+ @ConfigProperty(ConfigProperty.FORM_VIEW_ID)
+ @Order(105)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredDisplayViewId() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(108)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredMinimizeEnabled() {
+ return false;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(109)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredMaximizeEnabled() {
+ return false;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(110)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredMinimized() {
+ return false;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(112)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredMaximized() {
+ return false;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(120)
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredModal() {
+ return true;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(140)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredCacheBounds() {
+ return false;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(150)
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredAskIfNeedSave() {
+ return true;
+ }
+
+ @ConfigProperty(ConfigProperty.ICON_ID)
+ @Order(160)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredIconId() {
+ return null;
+ }
+
+ /**
+ * This method is called to get an exclusive key of the form. The key is used
+ * to open the same form with the same handler only once. Obviously this
+ * behavior can only be used for view forms.
+ *
+ * @see AbstractDesktop#getSimilarViewForms(IForm)
+ * @return null for exclusive form behavior an exclusive key to ensure similar
+ * handling.
+ * @throws ProcessingException
+ */
+ @Override
+ public Object computeExclusiveKey() throws ProcessingException {
+ return null;
+ }
+
+ /**
+ * Initialize the form and all of its fields.
+ * By default any of the #start* methods of the form call this method
+ * <p>
+ * This method is called in the process of the initialization. The UI is not ready yet.
+ *
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(10)
+ protected void execInitForm() throws ProcessingException {
+ }
+
+ /**
+ * This method is called when UI is ready.
+ *
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(11)
+ protected void execFormActivated() throws ProcessingException {
+ }
+
+ /**
+ * see {@link IDesktop#dataChanged(Object...)}
+ */
+ @ConfigOperation
+ @Order(13)
+ protected void execDataChanged(Object... dataTypes) throws ProcessingException {
+ }
+
+ /**
+ * This method is called in order to check field validity.<br>
+ * This method is called before {@link IFormHandler#execCheckFields()} and
+ * before the form is validated and stored.<br>
+ * After this method, the form is checking fields itself and displaying a
+ * dialog with missing and invalid fields.
+ *
+ * @return true when this check is done and further checks can continue, false
+ * to silently cancel the current process
+ * @throws ProcessingException
+ * to cancel the current process with error handling and user
+ * notification such as a dialog
+ */
+ @ConfigOperation
+ @Order(13)
+ protected boolean execCheckFields() throws ProcessingException {
+ return true;
+ }
+
+ /**
+ * This method is called in order to update derived states like button
+ * enablings.<br>
+ * This method is called before {@link IFormHandler#execValidate()} and before
+ * the form is stored.
+ *
+ * @return true when validate is successful, false to silently cancel the
+ * current process
+ * @throws ProcessingException
+ * to cancel the current process with error handling and user
+ * notification such as a dialog
+ */
+ @ConfigOperation
+ @Order(14)
+ protected boolean execValidate() throws ProcessingException {
+ return true;
+ }
+
+ /**
+ * This method is called in order to update pages on the desktop after the
+ * form stored data.<br>
+ * This method is called after {@link IFormHandler#execStore()}.
+ */
+ @ConfigOperation
+ @Order(16)
+ protected void execStored() throws ProcessingException {
+ }
+
+ /**
+ * @throws ProcessingException
+ * / {@link VetoException} if the exception should produce further
+ * info messages (default)
+ */
+ @ConfigOperation
+ @Order(17)
+ protected void execOnVetoException(VetoException e, int code) throws ProcessingException {
+ throw e;
+ }
+
+ /**
+ * @param kill
+ * true if a widget close icon (normally the X on the titlebar) was
+ * pressed or ESC was pressed
+ * @param enabledButtonSystemTypes
+ * set of all {@link IButton#SYSTEM_TYPE_*} of all enabled and
+ * visible buttons of this form
+ */
+ @ConfigOperation
+ @Order(18)
+ protected void execOnCloseRequest(boolean kill, final HashSet<Integer> enabledButtonSystemTypes) throws ProcessingException {
+ if (enabledButtonSystemTypes.contains(IButton.SYSTEM_TYPE_CLOSE)) {
+ doClose();
+ }
+ else if (enabledButtonSystemTypes.contains(IButton.SYSTEM_TYPE_CANCEL)) {
+ doCancel();
+ }
+ else if (!isAskIfNeedSave()) {
+ doClose();
+ }
+ else {
+ LOG.info("Trying to close a form (" + getClass().getName() + " - " + getTitle() + ") with no enabled close button! override getConfiguredAskIfNeedSave() to false to make this form is unsaveable.");
+ }
+ }
+
+ @ConfigOperation
+ @Order(19)
+ protected void execDisposeForm() throws ProcessingException {
+ }
+
+ @ConfigOperation
+ @Order(20)
+ protected void execCloseTimer() throws ProcessingException {
+ doClose();
+ }
+
+ @ConfigOperation
+ @Order(30)
+ protected void execInactivityTimer() throws ProcessingException {
+ doClose();
+ }
+
+ @ConfigOperation
+ @Order(40)
+ protected void execTimer(String timerId) throws ProcessingException {
+ LOG.info("execTimer " + timerId);
+ }
+
+ /**
+ * add verbose information to the search filter
+ */
+ @ConfigOperation
+ @Order(50)
+ protected void execAddSearchTerms(SearchFilter search) {
+ }
+
+ private Class<? extends IKeyStroke>[] getConfiguredKeyStrokes() {
+ Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
+ return ConfigurationUtility.filterClasses(dca, IKeyStroke.class);
+ }
+
+ private Class<? extends IGroupBox> getConfiguredMainBox() {
+ Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
+ return ConfigurationUtility.filterClassIgnoringInjectFieldAnnotation(dca, IGroupBox.class);
+ }
+
+ private Class<? extends IFormField>[] getConfiguredInjectedFields() {
+ Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
+ return ConfigurationUtility.filterClassesWithInjectFieldAnnotation(dca, IFormField.class);
+ }
+
+ protected void initConfig() throws ProcessingException {
+ m_uiFacade = new P_UIFacade();
+ m_scoutTimerMap = new HashMap<String, P_Timer>();
+ m_autoRegisterInDesktopOnStart = true;
+ // prepare injected fields
+ Class<? extends IFormField>[] fieldArray = getConfiguredInjectedFields();
+ DefaultFormFieldInjection injectedFields = null;
+ for (Class<? extends IFormField> clazz : fieldArray) {
+ if (!clazz.isAnnotationPresent(InjectFieldTo.class)) {
+ continue;
+ }
+ try {
+ IFormField f = ConfigurationUtility.newInnerInstance(this, clazz);
+ if (f != null) {
+ if (injectedFields == null) {
+ injectedFields = new DefaultFormFieldInjection();
+ }
+ injectedFields.addField(f);
+ }
+ }// end try
+ catch (Throwable t) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("field: " + clazz.getName(), t));
+ }
+ }
+ IGroupBox rootBox = getRootGroupBox();
+ try {
+ if (injectedFields != null) {
+ FormFieldInjectionThreadLocal.push(injectedFields);
+ }
+ //
+ // add mainbox if getter returns null
+ if (rootBox == null) {
+ Class<? extends IGroupBox> mainBoxClass = getConfiguredMainBox();
+ try {
+ m_mainBox = ConfigurationUtility.newInnerInstance(this, mainBoxClass);
+ }
+ catch (Throwable t) {
+ throw new ProcessingException("mainBox: " + ((mainBoxClass == null) ? "not defined." : mainBoxClass.getName()), t);
+ }
+ rootBox = getRootGroupBox();
+ }
+ }
+ finally {
+ if (injectedFields != null) {
+ FormFieldInjectionThreadLocal.pop(injectedFields);
+ }
+ }
+ rootBox.setFormInternal(this);
+ rootBox.setMainBox(true);
+ rootBox.updateKeyStrokes();
+ //
+ if (getConfiguredCloseTimer() > 0) {
+ setCloseTimer(getConfiguredCloseTimer());
+ }
+ if (getConfiguredCustomTimer() > 0) {
+ setTimer("custom", getConfiguredCustomTimer());
+ }
+ setModal(getConfiguredModal());
+ setDisplayHint(getConfiguredDisplayHint());
+ setDisplayViewId(getConfiguredDisplayViewId());
+ if (getConfiguredCancelVerificationText() != null) {
+ setCancelVerificationText(getConfiguredCancelVerificationText());
+ }
+ if (getConfiguredTitle() != null) {
+ setTitle(getConfiguredTitle());
+ }
+ if (getConfiguredSubTitle() != null) {
+ setSubTitle(getConfiguredSubTitle());
+ }
+ setMinimizeEnabled(getConfiguredMinimizeEnabled());
+ setMaximizeEnabled(getConfiguredMaximizeEnabled());
+ setMinimized(getConfiguredMinimized());
+ setMaximized(getConfiguredMaximized());
+ setCacheBounds(getConfiguredCacheBounds());
+ setAskIfNeedSave(getConfiguredAskIfNeedSave());
+ setIconId(getConfiguredIconId());
+
+ // visit all system buttons and attach observer
+ m_systemButtonListener = new P_SystemButtonListener();// is auto-detaching
+ IFormFieldVisitor v2 = new IFormFieldVisitor() {
+ @Override
+ public boolean visitField(IFormField field, int level, int fieldIndex) {
+ if (field instanceof IButton) {
+ if (((IButton) field).getSystemType() != IButton.SYSTEM_TYPE_NONE) {
+ ((IButton) field).addButtonListener(m_systemButtonListener);
+ }
+ }
+ return true;
+ }
+ };
+ visitFields(v2);
+ getRootGroupBox().addPropertyChangeListener(new P_MainBoxPropertyChangeProxy());
+ setButtonsArmed(true);
+ }
+
+ @Override
+ public void setEnabledPermission(Permission p) {
+ boolean b;
+ if (p != null) {
+ b = SERVICES.getService(IAccessControlService.class).checkPermission(p);
+ }
+ else {
+ b = true;
+ }
+ setEnabledGranted(b);
+ }
+
+ @Override
+ public boolean isEnabledGranted() {
+ return m_enabledGranted;
+ }
+
+ @Override
+ public void setEnabledGranted(boolean b) {
+ m_enabledGranted = b;
+ IGroupBox box = getRootGroupBox();
+ if (box != null) {
+ box.setEnabledGranted(b);
+ }
+ }
+
+ @Override
+ public void setVisiblePermission(Permission p) {
+ boolean b;
+ if (p != null) {
+ b = SERVICES.getService(IAccessControlService.class).checkPermission(p);
+ }
+ else {
+ b = true;
+ }
+ setVisibleGranted(b);
+ }
+
+ @Override
+ public boolean isVisibleGranted() {
+ return m_visibleGranted;
+ }
+
+ @Override
+ public void setVisibleGranted(boolean b) {
+ m_visibleGranted = b;
+ IGroupBox box = getRootGroupBox();
+ if (box != null) {
+ box.setVisibleGranted(b);
+ }
+ }
+
+ @Override
+ public String getIconId() {
+ return propertySupport.getPropertyString(PROP_ICON_ID);
+ }
+
+ @Override
+ public void setIconId(String iconId) {
+ propertySupport.setPropertyString(PROP_ICON_ID, iconId);
+ }
+
+ @Override
+ public String getPerspectiveId() {
+ return propertySupport.getPropertyString(PROP_PERSPECTIVE_ID);
+ }
+
+ @Override
+ public void setPerspectiveId(String perspectiveId) {
+ propertySupport.setPropertyString(PROP_PERSPECTIVE_ID, perspectiveId);
+ }
+
+ /**
+ * Register a {@link DataChangeListener} on the desktop for these dataTypes<br>
+ * Example:
+ *
+ * <pre>
+ * registerDataChangeListener(CRMEnum.Company, CRMEnum.Project, CRMEnum.Task);
+ * </pre>
+ */
+ public void registerDataChangeListener(Object... dataTypes) {
+ if (m_internalDataChangeListener == null) {
+ m_internalDataChangeListener = new WeakDataChangeListener() {
+ @Override
+ public void dataChanged(Object... innerDataTypes) throws ProcessingException {
+ execDataChanged(innerDataTypes);
+ }
+ };
+ }
+ IDesktop desktop = getDesktop();
+ if (desktop == null) {
+ desktop = ClientSyncJob.getCurrentSession().getVirtualDesktop();
+ }
+ desktop.addDataChangeListener(m_internalDataChangeListener, dataTypes);
+ }
+
+ /**
+ * Unregister the {@link DataChangeListener} from the desktop for these
+ * dataTypes<br>
+ * Example:
+ *
+ * <pre>
+ * unregisterDataChangeListener(CRMEnum.Company, CRMEnum.Project, CRMEnum.Task);
+ * </pre>
+ */
+ public void unregisterDataChangeListener(Object... dataTypes) {
+ if (m_internalDataChangeListener != null) {
+ getDesktop().removeDataChangeListener(m_internalDataChangeListener, dataTypes);
+ }
+ }
+
+ protected IForm startInternalExclusive(IFormHandler handler) throws ProcessingException {
+ if (m_blockingCondition.isBlocking()) {
+ throw new ProcessingException("The form " + getFormId() + " has already been started");
+ }
+ for (IForm simCandidate : getDesktop().getSimilarViewForms(this)) {
+ if (handler != null && simCandidate.getHandler() != null && handler.getClass().getName() == simCandidate.getHandler().getClass().getName()) {
+ if (simCandidate.getHandler().isOpenExclusive() && handler.isOpenExclusive()) {
+ getDesktop().ensureVisible(simCandidate);
+ return simCandidate;
+ }
+ }
+ }
+ return startInternal(handler);
+ }
+
+ /**
+ * This method is called from the implemented handler methods in a explicit
+ * form subclass
+ */
+ protected IForm startInternal(final IFormHandler handler) throws ProcessingException {
+ if (m_blockingCondition.isBlocking()) {
+ throw new ProcessingException("The form " + getFormId() + " has already been started");
+ }
+ setHandler(handler);
+ m_closeType = IButton.SYSTEM_TYPE_NONE;
+ m_displayHintLocked = true;
+ m_blockingCondition.setBlocking(true);
+ try {
+ // check if form was made invisible ( = access control denied access)
+ if (!getRootGroupBox().isVisible()) {
+ disposeFormInternal();
+ return this;
+ }
+ initForm();
+ // check if form was made invisible ( = access control denied access)
+ if (!getRootGroupBox().isVisible()) {
+ // make sure the form is storing since it is not showing
+ disposeFormInternal();
+ return this;
+ }
+ loadStateInternal();
+ // check if form was made invisible ( = access control denied access)
+ if (!isFormOpen()) {
+ disposeFormInternal();
+ return this;
+ }
+ if (!getRootGroupBox().isVisible()) {
+ disposeFormInternal();
+ return this;
+ }
+ if (getHandler().isGuiLess()) {
+ // make sure the form is storing since it is not showing
+ storeStateInternal();
+ markSaved();
+ doFinally();
+ disposeFormInternal();
+ return this;
+ }
+ }
+ catch (ProcessingException e) {
+ e.addContextMessage(AbstractForm.this.getClass().getSimpleName());
+ disposeFormInternal();
+ if (e instanceof VetoException) {
+ execOnVetoException((VetoException) e, e.getStatus().getCode());
+ }
+ else {
+ throw e;
+ }
+ }
+ catch (Throwable t) {
+ disposeFormInternal();
+ throw new ProcessingException("failed showing " + getTitle(), t);
+ }
+ // request a gui
+ setButtonsArmed(true);
+ setCloseTimerArmed(true);
+ // register in desktop or wizard (legacy wizard only)
+ if (isAutoAddRemoveOnDesktop()) {
+ IDesktop desktop = getDesktop();
+ if (desktop != null) {
+ desktop.addForm(this);
+ }
+ }
+ return this;
+ }
+
+ @Override
+ public void startWizardStep(IWizardStep wizardStep, Class<? extends IFormHandler> handlerType) throws ProcessingException {
+ setAutoAddRemoveOnDesktop(false);
+ IFormHandler formHandler = null;
+ if (handlerType != null) {
+ try {
+ formHandler = ConfigurationUtility.newInnerInstance(this, handlerType);
+ }
+ catch (Exception e) {
+ throw new ProcessingException("" + handlerType + " is not an internal form handler", e);
+ }
+ }
+ m_wizardStep = wizardStep;
+ setModal(false);
+ setAskIfNeedSave(false);
+ // hide top level process buttons with a system type
+ for (IFormField f : getRootGroupBox().getFields()) {
+ if (f instanceof IButton) {
+ IButton b = (IButton) f;
+ if (b.getSystemType() != IButton.SYSTEM_TYPE_NONE) {
+ // hide
+ b.setVisible(false);
+ b.setVisibleGranted(false);
+ }
+ }
+ }
+ //
+ // start
+ startInternal(formHandler);
+ }
+
+ @Override
+ public void waitFor() throws ProcessingException {
+ // check if the desktop is observing this process
+ IDesktop desktop = ClientSyncJob.getCurrentSession().getDesktop();
+ if (desktop == null || !desktop.isOpened()) {
+ throw new ProcessingException("Cannot wait for " + getClass().getName() + ". There is no desktop or the desktop has not yet been opened in the ui", null, WAIT_FOR_ERROR_CODE);
+ }
+ // wait
+ try {
+ m_blockingCondition.waitFor();
+ }
+ catch (InterruptedException e) {
+ throw new ProcessingException(ScoutTexts.get("UserInterrupted"), e);
+ }
+ }
+
+ @Override
+ public void exportFormData(AbstractFormData target) throws ProcessingException {
+ // locally declared form properties
+ Map<String, Object> properties = BeanUtility.getProperties(this, AbstractForm.class, new FormDataPropertyFilter());
+ BeanUtility.setProperties(target, properties, false, null);
+ // all fields
+ Map<Integer, Map<String/* qualified field id */, AbstractFormFieldData>> breathFirstMap = target.getAllFieldsRec();
+ for (Map<String/* qualified field id */, AbstractFormFieldData> targetMap : breathFirstMap.values()) {
+ for (Map.Entry<String, AbstractFormFieldData> e : targetMap.entrySet()) {
+ String fieldQId = e.getKey();
+ AbstractFormFieldData data = e.getValue();
+ FindFieldByFormDataIdVisitor v = new FindFieldByFormDataIdVisitor(fieldQId);
+ visitFields(v);
+ IFormField f = v.getField();
+ if (f != null) {
+ // locally declared field properties
+ properties = BeanUtility.getProperties(f, AbstractFormField.class, new FormDataPropertyFilter());
+ BeanUtility.setProperties(data, properties, false, null);
+ // field state
+ f.exportFormFieldData(data);
+ }
+ else {
+ LOG.warn("cannot find field data for '" + fieldQId + " in form " + getClass().getName() + "'");
+ }
+ }
+ }
+ }
+
+ @Override
+ public void importFormData(AbstractFormData source) throws ProcessingException {
+ importFormData(source, false, null);
+ }
+
+ @Override
+ public void importFormData(AbstractFormData source, boolean valueChangeTriggersEnabled, IPropertyFilter filter) throws ProcessingException {
+ if (filter == null) {
+ filter = new FormDataPropertyFilter();
+ }
+ // locally declared form properties
+ Map<String, Object> properties = BeanUtility.getProperties(source, AbstractFormData.class, filter);
+ for (Iterator<String> it = properties.keySet().iterator(); it.hasNext();) {
+ AbstractPropertyData pd = source.getPropertyById(it.next());
+ if (pd != null && !pd.isValueSet()) {
+ it.remove();
+ }
+ }
+ BeanUtility.setProperties(this, properties, false, null);
+ // sort fields, first non-slave fields, then slave fields in transitive
+ // order
+ LinkedList<IFormField> masterList = new LinkedList<IFormField>();
+ LinkedList<IFormField> slaveList = new LinkedList<IFormField>();
+ HashMap<IFormField, AbstractFormFieldData> dataMap = new HashMap<IFormField, AbstractFormFieldData>();
+ // all fields
+ Map<Integer, Map<String/* qualified field id */, AbstractFormFieldData>> breathFirstMap = source.getAllFieldsRec();
+ for (Map<String/* qualified field id */, AbstractFormFieldData> sourceMap : breathFirstMap.values()) {
+ for (Map.Entry<String, AbstractFormFieldData> e : sourceMap.entrySet()) {
+ String fieldQId = e.getKey();
+ AbstractFormFieldData data = e.getValue();
+ FindFieldByFormDataIdVisitor v = new FindFieldByFormDataIdVisitor(fieldQId);
+ visitFields(v);
+ IFormField f = v.getField();
+ if (f != null) {
+ dataMap.put(f, data);
+ if (f.getMasterField() != null) {
+ int index = slaveList.indexOf(f.getMasterField());
+ if (index >= 0) {
+ slaveList.add(index + 1, f);
+ }
+ else {
+ slaveList.add(0, f);
+ }
+ }
+ else {
+ masterList.add(f);
+ }
+ }
+ else {
+ LOG.warn("cannot find field data for '" + fieldQId + " in form " + getClass().getName() + "'");
+ }
+ }
+ }
+ for (IFormField f : masterList) {
+ AbstractFormFieldData data = dataMap.get(f);
+ // locally declared field properties
+ Class stopClass;
+ if (data instanceof AbstractTableFieldData) {
+ stopClass = AbstractTableFieldData.class;
+ }
+ else if (data instanceof AbstractValueFieldData) {
+ stopClass = AbstractValueFieldData.class;
+ }
+ else {
+ stopClass = AbstractFormFieldData.class;
+ }
+ properties = BeanUtility.getProperties(data, stopClass, filter);
+ for (Iterator<String> it = properties.keySet().iterator(); it.hasNext();) {
+ AbstractPropertyData pd = data.getPropertyById(it.next());
+ if (pd != null && !pd.isValueSet()) {
+ it.remove();
+ }
+ }
+ BeanUtility.setProperties(f, properties, false, null);
+ // field state
+ f.importFormFieldData(data, valueChangeTriggersEnabled);
+ }
+ for (IFormField f : slaveList) {
+ AbstractFormFieldData data = dataMap.get(f);
+ // locally declared field properties
+ Class stopClass;
+ if (data instanceof AbstractTableFieldData) {
+ stopClass = AbstractTableFieldData.class;
+ }
+ else if (data instanceof AbstractValueFieldData) {
+ stopClass = AbstractValueFieldData.class;
+ }
+ else {
+ stopClass = AbstractFormFieldData.class;
+ }
+ properties = BeanUtility.getProperties(data, stopClass, filter);
+ for (Iterator<String> it = properties.keySet().iterator(); it.hasNext();) {
+ AbstractPropertyData pd = data.getPropertyById(it.next());
+ if (pd != null && !pd.isValueSet()) {
+ it.remove();
+ }
+ }
+ BeanUtility.setProperties(f, properties, false, null);
+ // field state
+ f.importFormFieldData(data, valueChangeTriggersEnabled);
+ }
+ }
+
+ public static String parseFormId(String className) {
+ String s = className;
+ int i = Math.max(s.lastIndexOf('$'), s.lastIndexOf('.'));
+ s = s.substring(i + 1);
+ return s;
+ }
+
+ @Override
+ public String getFormId() {
+ return parseFormId(getClass().getName());
+ }
+
+ @Override
+ public IFormHandler getHandler() {
+ return m_handler;
+ }
+
+ @Override
+ public void setHandler(IFormHandler handler) {
+ if (handler != m_handler) {
+ if (m_handler != null) {
+ m_handler.setFormInternal(null);
+ }
+ if (handler == null) {
+ handler = new NullFormHandler();
+ }
+ m_handler = handler;
+ m_handler.setFormInternal(this);
+ }
+ }
+
+ @Override
+ public IWizard getWizard() {
+ return (getWizardStep() != null) ? getWizardStep().getWizard() : null;
+ }
+
+ @Override
+ public IWizardStep getWizardStep() {
+ return m_wizardStep;
+ }
+
+ @Override
+ public IFormField getFocusOwner() {
+ if (getDesktop() != null) {
+ IFormField field = getDesktop().getFocusOwner();
+ if (field != null) {
+ IForm form = field.getForm();
+ while (form != null) {
+ if (form == this) {
+ return field;
+ }
+ // next
+ form = form.getOuterForm();
+ }
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public IFormField[] getAllFields() {
+ P_AbstractCollectingFieldVisitor<IFormField> v = new P_AbstractCollectingFieldVisitor<IFormField>() {
+ @Override
+ public boolean visitField(IFormField field, int level, int fieldIndex) {
+ collect(field);
+ return true;
+ }
+ };
+ visitFields(v);
+ return v.getCollection().toArray(new IFormField[0]);
+ }
+
+ @Override
+ public boolean visitFields(IFormFieldVisitor visitor) {
+ return getRootGroupBox().visitFields(visitor, 0);
+ }
+
+ /**
+ * Convenience for ClientJob.getCurrentSession().getDesktop()
+ */
+ public IDesktop getDesktop() {
+ return ClientSyncJob.getCurrentSession().getDesktop();
+ }
+
+ @Override
+ public final SearchFilter getSearchFilter() {
+ if (m_searchFilter == null) {
+ resetSearchFilter();
+ }
+ return m_searchFilter;
+ }
+
+ @Override
+ public final void setSearchFilter(SearchFilter searchFilter) {
+ m_searchFilter = searchFilter;
+ }
+
+ /**
+ * Alias for {@link #resetSearchFilter()}
+ */
+ public void rebuildSearchFilter() {
+ resetSearchFilter();
+ }
+
+ @Override
+ public void resetSearchFilter() {
+ if (m_searchFilter == null) {
+ SearchFilter filter;
+ ISearchFilterService sfs = SERVICES.getService(ISearchFilterService.class);
+ if (sfs != null) {
+ filter = sfs.createNewSearchFilter();
+ }
+ else {
+ filter = new SearchFilter();
+ }
+ m_searchFilter = filter;
+ }
+ try {
+ execResetSearchFilter(m_searchFilter);
+ }
+ catch (ProcessingException e) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ catch (Throwable t) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Unexpected", t));
+ }
+ }
+
+ /**
+ * Called when saving the form via {@link #resetSearchFilter()}.
+ * <p>
+ * This operation fills up the search filter and subclass override sets the formData property of the
+ * {@link SearchFilter#setFormData(AbstractFormData)} and adds verbose texts with
+ * {@link SearchFilter#addDisplayText(String)}
+ * <p>
+ * May call {@link #setSearchFilter(SearchFilter)}
+ * <p>
+ * Implement {@link #execCreateFormData()} to automatically attach a filled form data to the search filter (since
+ * 3.8).
+ *
+ * @param searchFilter
+ * is never null
+ */
+ @ConfigOperation
+ @Order(10)
+ protected void execResetSearchFilter(final SearchFilter searchFilter) throws ProcessingException {
+ searchFilter.clear();
+ // add verbose field texts
+ // do not use visitor, so children can block traversal on whole subtrees
+ getRootGroupBox().applySearch(searchFilter);
+ // add verbose form texts
+ execAddSearchTerms(searchFilter);
+ // override may add form data
+ try {
+ AbstractFormData data = execCreateFormData();
+ if (data != null) {
+ exportFormData(data);
+ getSearchFilter().setFormData(data);
+ }
+ }
+ catch (ProcessingException e) {
+ throw e;
+ }
+ catch (Throwable t) {
+ throw new ProcessingException("Create form data", t);
+ }
+ }
+
+ /**
+ * Convenience to add form data to search filter and load/store form data.
+ * override this method to create an empty search form data that can be used for example by
+ * {@link #execResetSearchFilter(SearchFilter)}
+ *
+ * @since 3.8
+ */
+ @ConfigOperation
+ @Order(11)
+ protected AbstractFormData execCreateFormData() throws ProcessingException {
+ return null;
+ }
+
+ @Override
+ public boolean isFormStored() {
+ return m_formStored;
+ }
+
+ @Override
+ public void setFormStored(boolean b) {
+ m_formStored = b;
+ }
+
+ @Override
+ public boolean isFormLoading() {
+ return m_formLoading;
+ }
+
+ private void setFormLoading(boolean b) {
+ m_formLoading = b;
+ }
+
+ /**
+ * Mainbox getter
+ */
+ @Override
+ public IGroupBox getRootGroupBox() {
+ return m_mainBox;
+ }
+
+ @Override
+ public IForm getOuterForm() {
+ return m_wrappedFormField != null ? m_wrappedFormField.getForm() : null;
+ }
+
+ @Override
+ public IWrappedFormField getOuterFormField() {
+ return m_wrappedFormField;
+ }
+
+ @Override
+ public void setWrapperFieldInternal(IWrappedFormField w) {
+ m_wrappedFormField = w;
+ }
+
+ @Override
+ public IFormField getFieldById(final String id) {
+ return getRootGroupBox().getFieldById(id);
+ }
+
+ @Override
+ public <T extends IFormField> T getFieldById(String id, Class<T> type) {
+ return getRootGroupBox().getFieldById(id, type);
+ }
+
+ @Override
+ public <T extends IFormField> T getFieldByClass(Class<T> c) {
+ return getRootGroupBox().getFieldByClass(c);
+ }
+
+ /**
+ * override in subclasses to perform form initialization before handler starts
+ */
+ protected void postInitConfig() throws ProcessingException {
+ FormUtility.postInitConfig(this);
+ FormUtility.rebuildFieldGrid(this, true);
+ }
+
+ @Override
+ public void initForm() throws ProcessingException {
+ // form
+ initFormInternal();
+ // fields
+ FormUtility.initFormFields(this);
+ // custom
+ execInitForm();
+ }
+
+ protected void initFormInternal() throws ProcessingException {
+ }
+
+ @Override
+ public int getCloseSystemType() {
+ return m_closeType;
+ }
+
+ @Override
+ public void setCloseSystemType(int type) {
+ m_closeType = type;
+ }
+
+ /**
+ * do not use or override this internal method
+ */
+ protected void loadStateInternal() throws ProcessingException {
+ fireFormLoadBefore();
+ if (!isFormOpen()) {
+ return;
+ }
+ getHandler().onLoad();
+ if (!isFormOpen()) {
+ return;
+ }
+ fireFormLoadAfter();
+ if (!isFormOpen()) {
+ return;
+ }
+ // set all values to 'unchanged'
+ markSaved();
+ setFormLoading(false);
+ getHandler().onPostLoad();
+ if (!isFormOpen()) {
+ return;
+ }
+ // if not visible mode, mark form changed
+ if (getHandler().isGuiLess()) {
+ touch();
+ }
+ fireFormLoadComplete();
+ }
+
+ /**
+ * Store state of form, regardless of validity and completeness do not use or
+ * override this internal method directly
+ */
+ protected void storeStateInternal() throws ProcessingException {
+ if (!m_blockingCondition.isBlocking()) {
+ String msg = TEXTS.get("FormDisposedMessage", getTitle());
+ LOG.error(msg);
+ throw new VetoException(msg);
+ }
+ fireFormStoreBefore();
+ m_formStored = true;
+ try {
+ rebuildSearchFilter();
+ m_searchFilter.setCompleted(true);
+ getHandler().onStore();
+ execStored();
+ }
+ catch (ProcessingException e) {
+ // clear search
+ if (m_searchFilter != null) {
+ m_searchFilter.clear();
+ }
+ // store was not successfully stored
+ m_formStored = false;
+ throwVetoExceptionInternal(e);
+ // if exception was caught and suppressed, this form was after all successfully stored
+ // normally this code is not reached since the exception will be passed out
+ m_formStored = true;
+ }
+ catch (Throwable t) {
+ // clear search
+ if (m_searchFilter != null) {
+ m_searchFilter.clear();
+ }
+ throw new ProcessingException("form: " + getTitle(), t);
+ }
+ fireFormStoreAfter();
+ }
+
+ /**
+ * do not use or override this internal method
+ */
+ protected void discardStateInternal() throws ProcessingException {
+ fireFormDiscarded();
+ getHandler().onDiscard();
+ }
+
+ @Override
+ public void setCloseTimer(int seconds) {
+ if (seconds > 0) {
+ setCloseTimerArmed(true);
+ m_scoutCloseTimer = new P_CloseTimer(seconds);
+ m_scoutCloseTimer.start();
+ }
+ else {
+ removeCloseTimer();
+ }
+ }
+
+ /**
+ * do not use or override this internal method
+ */
+ protected void throwVetoExceptionInternal(ProcessingException e) throws ProcessingException {
+ if (e instanceof VetoException) {
+ if (!e.isConsumed()) {
+ execOnVetoException((VetoException) e, e.getStatus().getCode());
+ // if it was not re-thrown it is assumed to be consumed
+ e.consume();
+ }
+ }
+ throw e;
+ }
+
+ @Override
+ public void removeCloseTimer() {
+ setCloseTimerArmed(false);
+ m_scoutCloseTimer = null;
+ setSubTitle(null);
+ }
+
+ @Override
+ public void validateForm() throws ProcessingException {
+ m_currentValidateContentDescriptor = null;
+ if (!execCheckFields()) {
+ VetoException veto = new VetoException("Validate " + getClass().getSimpleName());
+ veto.consume();
+ throw veto;
+ }
+ if (!getHandler().onCheckFields()) {
+ VetoException veto = new VetoException("Validate " + getClass().getSimpleName());
+ veto.consume();
+ throw veto;
+ }
+ // check all fields that might be invalid
+ final ArrayList<String> invalidTexts = new ArrayList<String>();
+ final ArrayList<String> mandatoryTexts = new ArrayList<String>();
+ P_AbstractCollectingFieldVisitor<IValidateContentDescriptor> v = new P_AbstractCollectingFieldVisitor<IValidateContentDescriptor>() {
+ @Override
+ public boolean visitField(IFormField f, int level, int fieldIndex) {
+ IValidateContentDescriptor desc = f.validateContent();
+ if (desc != null) {
+ if (desc.getErrorStatus() != null) {
+ invalidTexts.add(desc.getDisplayText() + ": " + desc.getErrorStatus().getMessage());
+ }
+ else {
+ mandatoryTexts.add(desc.getDisplayText());
+ }
+ if (getCollectionCount() == 0) {
+ collect(desc);
+ }
+ }
+ return true;
+ }
+ };
+ visitFields(v);
+ if (v.getCollectionCount() > 0) {
+ IValidateContentDescriptor firstProblem = v.getCollection().get(0);
+ if (LOG.isInfoEnabled()) {
+ LOG.info("there are fields with errors");
+ }
+ StringBuffer buf = new StringBuffer();
+ if (mandatoryTexts.size() > 0) {
+ buf.append(ScoutTexts.get("FormEmptyMandatoryFieldsMessage") + "\n\n");
+ for (Iterator it = mandatoryTexts.iterator(); it.hasNext();) {
+ buf.append("- " + it.next() + "\n");
+ }
+ buf.append("\n");
+ }
+ if (invalidTexts.size() > 0) {
+ buf.append(ScoutTexts.get("FormInvalidFieldsMessage") + "\n\n");
+ for (Iterator it = invalidTexts.iterator(); it.hasNext();) {
+ buf.append("- " + it.next() + "\n");
+ }
+ }
+ String introText = ScoutTexts.get("FormIncompleteIntro");
+ m_currentValidateContentDescriptor = firstProblem;
+ //
+ VetoException veto = new VetoException(introText, buf.toString());
+ throw veto;
+ }
+ if (!execValidate()) {
+ VetoException veto = new VetoException("Validate " + getClass().getSimpleName());
+ veto.consume();
+ throw veto;
+ }
+ if (!getHandler().onValidate()) {
+ VetoException veto = new VetoException("Validate " + getClass().getSimpleName());
+ veto.consume();
+ throw veto;
+ }
+ }
+
+ /**
+ * attach a statement (mode) that is executed every interval
+ *
+ * @since Build 195 09.02.2005, imo
+ */
+ @Override
+ public void setTimer(String timerId, int seconds) {
+ removeTimer(timerId);
+ if (seconds > 0) {
+ P_Timer tim = new P_Timer(seconds, timerId);
+ m_scoutTimerMap.put(timerId, tim);
+ tim.start();
+ }
+ }
+
+ /**
+ * remove a statement (mode) that is executed every interval
+ *
+ * @since Build 195 09.02.2005, imo
+ */
+ @Override
+ public void removeTimer(String timerId) {
+ P_Timer tim = m_scoutTimerMap.remove(timerId);
+ if (tim != null) {
+ tim.setStopSignal();
+ }
+ }
+
+ @Override
+ public void doClose() throws ProcessingException {
+ if (!isFormOpen()) {
+ return;
+ }
+ m_closeType = IButton.SYSTEM_TYPE_CLOSE;
+ discardStateInternal();
+ doFinally();
+ disposeFormInternal();
+ }
+
+ @Override
+ public void doCancel() throws ProcessingException {
+ if (!isFormOpen()) {
+ return;
+ }
+ m_closeType = IButton.SYSTEM_TYPE_CANCEL;
+ try {
+ // ensure all fields have the right save-needed-state
+ checkSaveNeeded();
+ // find any fields that needs save
+ P_AbstractCollectingFieldVisitor<IFormField> collector = new P_AbstractCollectingFieldVisitor<IFormField>() {
+ @Override
+ public boolean visitField(IFormField field, int level, int fieldIndex) {
+ if (field.isSaveNeeded()) {
+ collect(field);
+ return false;
+ }
+ else {
+ return true;
+ }
+ }
+ };
+ visitFields(collector);
+ if (collector.getCollectionCount() > 0 && isAskIfNeedSave()) {
+ MessageBox messageBox = new MessageBox(
+ null,
+ getCancelVerificationText(),
+ null,
+ TEXTS.get("YesButton"),
+ TEXTS.get("NoButton"),
+ TEXTS.get("CancelButton")
+ );
+ messageBox.setSeverity(IProcessingStatus.INFO);
+ int result = messageBox.startMessageBox();
+ if (result == IMessageBox.YES_OPTION) {
+ doOk();
+ return;
+ }
+ else if (result == IMessageBox.NO_OPTION) {
+ doClose();
+ return;
+ }
+ else {
+ VetoException e = new VetoException(ScoutTexts.get("UserCancelledOperation"));
+ e.consume();
+ throw e;
+ }
+ }
+ discardStateInternal();
+ doFinally();
+ disposeFormInternal();
+ }
+ catch (ProcessingException e) {
+ m_closeType = IButton.SYSTEM_TYPE_NONE;
+ throw e;
+ }
+ }
+
+ @Override
+ public void doReset() {
+ setFormLoading(true);
+ // reset values
+ P_AbstractCollectingFieldVisitor v = new P_AbstractCollectingFieldVisitor() {
+ @Override
+ public boolean visitField(IFormField field, int level, int fieldIndex) {
+ if (field instanceof IValueField) {
+ IValueField f = (IValueField) field;
+ f.resetValue();
+ }
+ else if (field instanceof IComposerField) {
+ IComposerField f = (IComposerField) field;
+ f.resetValue();
+ }
+ return true;
+ }
+ };
+ visitFields(v);
+ try {
+ // init again
+ initForm();
+ // load again
+ loadStateInternal();
+ }
+ catch (ProcessingException e) {
+ e.addContextMessage(ScoutTexts.get("FormReset") + " " + getTitle());
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ }
+
+ /**
+ * Save data and close the form.
+ * It will make this decision based on {@link #isSaveNeeded}.
+ * Saving usually involves calling the <code>execStore</code> method
+ * of the current form handler.
+ *
+ * @see AbstractFormHandler#execStore()
+ */
+ @Override
+ public void doOk() throws ProcessingException {
+ if (!isFormOpen()) {
+ return;
+ }
+ try {
+ m_closeType = IButton.SYSTEM_TYPE_NONE;
+ checkSaveNeeded();
+ validateForm();
+ m_closeType = IButton.SYSTEM_TYPE_OK;
+ if (isSaveNeeded()) {
+ storeStateInternal();
+ markSaved();
+ }
+ doFinally();
+ disposeFormInternal();
+ }
+ catch (ProcessingException e) {
+ m_closeType = IButton.SYSTEM_TYPE_NONE;
+ throwVetoExceptionInternal(e);
+ }
+ }
+
+ @Override
+ public void doSaveWithoutMarkerChange() throws ProcessingException {
+ if (!isFormOpen()) {
+ return;
+ }
+ try {
+ m_closeType = IButton.SYSTEM_TYPE_NONE;
+ // ensure all fields have the right save-needed-state
+ checkSaveNeeded();
+ validateForm();
+ m_closeType = IButton.SYSTEM_TYPE_SAVE_WITHOUT_MARKER_CHANGE;
+ storeStateInternal();
+ // do not set to "markSaved"
+ }
+ catch (ProcessingException e) {
+ m_closeType = IButton.SYSTEM_TYPE_NONE;
+ throwVetoExceptionInternal(e);
+ }
+ }
+
+ @Override
+ public void doSave() throws ProcessingException {
+ if (!isFormOpen()) {
+ return;
+ }
+ try {
+ m_closeType = IButton.SYSTEM_TYPE_NONE;
+ // ensure all fields have the right save-needed-state
+ checkSaveNeeded();
+ validateForm();
+ m_closeType = IButton.SYSTEM_TYPE_SAVE;
+ if (isSaveNeeded()) {
+ storeStateInternal();
+ markSaved();
+ }
+ }
+ catch (ProcessingException e) {
+ m_closeType = IButton.SYSTEM_TYPE_NONE;
+ throwVetoExceptionInternal(e);
+ }
+ }
+
+ @Override
+ public void setAllEnabled(final boolean b) {
+ P_AbstractCollectingFieldVisitor v = new P_AbstractCollectingFieldVisitor() {
+ @Override
+ public boolean visitField(IFormField f, int level, int fieldIndex) {
+ boolean filteredB = b;
+ /*
+ * @since 3.0 all items are enabled/disabled. a dialog can still be
+ * closed using the X in the window header if(f instanceof IButton){
+ * IButton b=(IButton)f; if(b.isProcessButton()){
+ * switch(b.getSystemType()){ case IButton.SYSTEM_TYPE_CLOSE: case
+ * IButton.SYSTEM_TYPE_CANCEL:{ filteredB=true; break; } } } }
+ */
+ //
+ f.setEnabled(filteredB);
+ return true;
+ }
+ };
+ visitFields(v);
+ }
+
+ @Override
+ public void doFinally() {
+ try {
+ getHandler().onFinally();
+ }
+ catch (ProcessingException se) {
+ se.addContextMessage(ScoutTexts.get("FormFinally") + " " + getTitle());
+ SERVICES.getService(IExceptionHandlerService.class).handleException(se);
+ }
+ catch (Throwable t) {
+ ProcessingException e = new ProcessingException(ScoutTexts.get("FormFinally") + " " + getTitle(), t);
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ }
+
+ @Override
+ public String getCancelVerificationText() {
+ return m_cancelVerificationText;
+ }
+
+ @Override
+ public void setCancelVerificationText(String text) {
+ m_cancelVerificationText = text;
+ }
+
+ @Override
+ public List<? extends IFormField> getInvalidFields() {
+ // check all fields that might be invalid
+ P_AbstractCollectingFieldVisitor<IFormField> v = new P_AbstractCollectingFieldVisitor<IFormField>() {
+ @Override
+ public boolean visitField(IFormField f, int level, int fieldIndex) {
+ if (!f.isContentValid()) {
+ collect(f);
+ }
+ return true;
+ }
+ };
+ visitFields(v);
+ return v.getCollection();
+ }
+
+ @Override
+ public final void checkSaveNeeded() {
+ // call checkSaveNeeded on all fields
+ P_AbstractCollectingFieldVisitor<IFormField> v = new P_AbstractCollectingFieldVisitor<IFormField>() {
+ @Override
+ public boolean visitField(IFormField f, int level, int fieldIndex) {
+ if (f instanceof IFormField) {
+ f.checkSaveNeeded();
+ }
+ return true;
+ }
+ };
+ visitFields(v);
+ }
+
+ private boolean/* ok */checkForVerifyingFields() {
+ // check all fields that might be invalid
+ P_AbstractCollectingFieldVisitor v = new P_AbstractCollectingFieldVisitor() {
+ @Override
+ public boolean visitField(IFormField field, int level, int fieldIndex) {
+ if (field instanceof IValueField) {
+ IValueField f = (IValueField) field;
+ if (f.isValueChanging() || f.isValueParsing()) {
+ return false;
+ }
+ }
+ return true;
+ }
+ };
+ return visitFields(v);
+ }
+
+ private void closeFormInternal(boolean kill) {
+ if (isFormOpen()) {
+ try {
+ // check if there is an active close, cancel or finish button
+ final HashSet<Integer> enabledSystemTypes = new HashSet<Integer>();
+ final HashSet<IButton> enabledSystemButtons = new HashSet<IButton>();
+ IFormFieldVisitor v = new IFormFieldVisitor() {
+ @Override
+ public boolean visitField(IFormField field, int level, int fieldIndex) {
+ if (field instanceof IButton) {
+ IButton b = (IButton) field;
+ if (b.isEnabled() && b.isVisible() && b.isEnabledProcessingButton()) {
+ enabledSystemTypes.add(b.getSystemType());
+ enabledSystemButtons.add(b);
+ }
+ }
+ return true;
+ }
+ };
+ try {
+ visitFields(v);
+ for (IButton b : enabledSystemButtons) {
+ b.setEnabledProcessingButton(false);
+ }
+ execOnCloseRequest(kill, enabledSystemTypes);
+ }
+ finally {
+ for (IButton b : enabledSystemButtons) {
+ b.setEnabledProcessingButton(true);
+ }
+ }
+ }
+ catch (ProcessingException se) {
+ se.addContextMessage(ScoutTexts.get("FormClosing") + " " + getTitle());
+ SERVICES.getService(IExceptionHandlerService.class).handleException(se);
+ }
+ catch (Throwable t) {
+ ProcessingException e = new ProcessingException(ScoutTexts.get("FormClosing") + " " + getTitle(), t);
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ }
+ }
+
+ @Override
+ public void touch() {
+ getRootGroupBox().touch();
+ }
+
+ @Override
+ public boolean isSaveNeeded() {
+ return getRootGroupBox().isSaveNeeded();
+ }
+
+ @Override
+ public void markSaved() {
+ getRootGroupBox().markSaved();
+ }
+
+ @Override
+ public boolean isEmpty() {
+ return getRootGroupBox().isEmpty();
+ }
+
+ /**
+ * do not use or override this internal method
+ */
+ protected void disposeFormInternal() {
+ if (!isFormOpen()) {
+ return;
+ }
+ try {
+ setButtonsArmed(false);
+ setCloseTimerArmed(false);
+ //
+ m_scoutCloseTimer = null;
+ for (Iterator it = m_scoutTimerMap.values().iterator(); it.hasNext();) {
+ ((P_Timer) it.next()).setStopSignal();
+ }
+ m_scoutTimerMap.clear();
+ m_displayHintLocked = false;
+ m_formLoading = true;
+ }
+ catch (Throwable t) {
+ LOG.warn("Form " + getClass().getName(), t);
+ }
+ // dispose fields
+ FormUtility.disposeFormFields(this);
+ // dispose form configuration
+ try {
+ execDisposeForm();
+ }
+ catch (Throwable t) {
+ LOG.warn("Form " + getClass().getName(), t);
+ }
+ try {
+ // deregister of wizard / desktop
+ if (isAutoAddRemoveOnDesktop()) {
+ IDesktop desktop = getDesktop();
+ if (desktop != null) {
+ desktop.removeForm(this);
+ }
+ }
+ }
+ finally {
+ // unlock
+ m_blockingCondition.release();
+ // fire
+ fireFormClosed();
+ }
+ }
+
+ @Override
+ public boolean isShowing() {
+ IDesktop desktop = getDesktop();
+ if (desktop != null) {
+ return desktop.isShowing(this);
+ }
+ else {
+ return false;
+ }
+ }
+
+ @Override
+ public boolean isFormClosed() {
+ return !isFormOpen();
+ }
+
+ @Override
+ public boolean isFormOpen() {
+ return m_blockingCondition.isBlocking();
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public Object getCustomProperty(String propName) {
+ return getProperty(propName);
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public void setCustomProperty(String propName, Object o) {
+ setProperty(propName, o);
+ }
+
+ @Override
+ public Object getProperty(String name) {
+ return propertySupport.getProperty(name);
+ }
+
+ @Override
+ public void setProperty(String name, Object value) {
+ propertySupport.setProperty(name, value);
+ }
+
+ @Override
+ public boolean hasProperty(String name) {
+ return propertySupport.hasProperty(name);
+ }
+
+ @Override
+ public void setXML(String xml) throws ProcessingException {
+ if (xml == null) {
+ return;
+ }
+ SimpleXmlElement root = new SimpleXmlElement();
+ try {
+ root.parseString(xml);
+ }
+ catch (Throwable t) {
+ throw new ProcessingException("Loading xml", t);
+ }
+ loadXML(root);
+ }
+
+ @Override
+ public String getXML(String encoding) throws ProcessingException {
+ if (encoding == null) {
+ encoding = "UTF-8";
+ }
+ try {
+ SimpleXmlElement e = storeXML();
+ ByteArrayOutputStream bo = new ByteArrayOutputStream();
+ e.writeDocument(bo, null, encoding);
+ return new String(bo.toByteArray(), Charset.forName(encoding));
+ }
+ catch (Throwable e) {
+ if (e instanceof ProcessingException) {
+ throw (ProcessingException) e;
+ }
+ else {
+ throw new ProcessingException("form : " + getTitle() + ", encoding: " + encoding, e);
+ }
+ }
+ }
+
+ @Override
+ public SimpleXmlElement storeXML() throws ProcessingException {
+ SimpleXmlElement root = new SimpleXmlElement("form-state");
+ storeXML(root);
+ return root;
+ }
+
+ @Override
+ public void storeXML(SimpleXmlElement root) throws ProcessingException {
+ root.setAttribute("formId", getFormId());
+ root.setAttribute("formQname", getClass().getName());
+ // add custom properties
+ SimpleXmlElement xProps = new SimpleXmlElement("properties");
+ root.addChild(xProps);
+ IPropertyFilter filter = new IPropertyFilter() {
+ @Override
+ public boolean accept(FastPropertyDescriptor descriptor) {
+ if (descriptor.getPropertyType().isInstance(IFormField.class)) {
+ return false;
+ }
+ if (!descriptor.getPropertyType().isPrimitive() && !Serializable.class.isAssignableFrom(descriptor.getPropertyType())) {
+ return false;
+ }
+ if (descriptor.getReadMethod() == null || descriptor.getWriteMethod() == null) {
+ return false;
+ }
+ return true;
+ }
+ };
+ Map props = BeanUtility.getProperties(this, AbstractForm.class, filter);
+ for (Iterator it = props.entrySet().iterator(); it.hasNext();) {
+ Map.Entry entry = (Map.Entry) it.next();
+ try {
+ SimpleXmlElement xProp = new SimpleXmlElement("property");
+ xProps.addChild(xProp);
+ xProp.setAttribute("name", entry.getKey());
+ xProp.setObjectAttribute("value", entry.getValue());
+ }
+ catch (Exception e) {
+ throw new ProcessingException("property " + entry.getKey() + " with value " + entry.getValue(), e);
+ }
+ }
+ // add fields
+ final SimpleXmlElement xFields = new SimpleXmlElement("fields");
+ root.addChild(xFields);
+ final Holder<ProcessingException> exceptionHolder = new Holder<ProcessingException>(ProcessingException.class);
+ P_AbstractCollectingFieldVisitor v = new P_AbstractCollectingFieldVisitor() {
+ @Override
+ public boolean visitField(IFormField field, int level, int fieldIndex) {
+ SimpleXmlElement xField = new SimpleXmlElement("field");
+ try {
+ field.storeXML(xField);
+ xFields.addChild(xField);
+ }
+ catch (ProcessingException e) {
+ exceptionHolder.setValue(e);
+ return false;
+ }
+ return true;
+ }
+ };
+ visitFields(v);
+ if (exceptionHolder.getValue() != null) {
+ throw exceptionHolder.getValue();
+ }
+ }
+
+ @Override
+ public void loadXML(SimpleXmlElement root) throws ProcessingException {
+ String formId = getFormId();
+ String xmlId = root.getStringAttribute("formId", "");
+ if (!formId.equals(xmlId)) {
+ throw new ProcessingException("xml id=" + xmlId + " does not match form id=" + formId);
+ }
+ // load properties
+ HashMap<String, Object> props = new HashMap<String, Object>();
+ SimpleXmlElement xProps = root.getChild("properties");
+ if (xProps != null) {
+ for (Iterator it = xProps.getChildren("property").iterator(); it.hasNext();) {
+ SimpleXmlElement xProp = (SimpleXmlElement) it.next();
+ String name = xProp.getStringAttribute("name");
+ try {
+ Object value = xProp.getObjectAttribute("value", null, getClass().getClassLoader());
+ props.put(name, value);
+ }
+ catch (Exception e) {
+ LOG.warn("property " + name, e);
+ }
+ }
+ }
+ BeanUtility.setProperties(this, props, true, null);
+ // load fields
+ SimpleXmlElement xFields = root.getChild("fields");
+ if (xFields != null) {
+ for (SimpleXmlElement xField : xFields.getChildren("field")) {
+ List<String> xmlFieldIds = new LinkedList<String>();
+ // add enclosing field path to xml field IDs
+ for (SimpleXmlElement element : xField.getChildren("enclosingField")) {
+ xmlFieldIds.add(element.getStringAttribute("fieldId"));
+ }
+ xmlFieldIds.add(xField.getStringAttribute("fieldId"));
+ FindFieldByXmlIdsVisitor v = new FindFieldByXmlIdsVisitor(xmlFieldIds.toArray(new String[xmlFieldIds.size()]));
+ visitFields(v);
+ IFormField f = v.getField();
+ if (f != null) {
+ f.loadXML(xField);
+ }
+ }
+ }
+ // in all tabboxes select the first tab that contains data, iff the current
+ // tab has no values set
+ getRootGroupBox().visitFields(new IFormFieldVisitor() {
+ @Override
+ public boolean visitField(IFormField field, int level, int fieldIndex) {
+ if (field instanceof ITabBox) {
+ ITabBox tabBox = (ITabBox) field;
+ IGroupBox selbox = tabBox.getSelectedTab();
+ if (selbox == null || !selbox.isSaveNeeded()) {
+ for (IGroupBox g : tabBox.getGroupBoxes()) {
+ if (g.isSaveNeeded()) {
+ tabBox.setSelectedTab(g);
+ break;
+ }
+ }
+ }
+ }
+ return true;
+ }
+ }, 0);
+ }
+
+ @Override
+ public void doExportXml(boolean saveAs) {
+ while (true) {
+ File path = m_lastXmlFileForStorage;
+ if (saveAs || path == null) {
+ File dir = m_lastXmlFileForStorage;
+ if (dir != null) {
+ dir = dir.getParentFile();
+ }
+ File[] a = new FileChooser(dir, new String[]{"xml"}, false).startChooser();
+ if (a.length == 0) {
+ break;
+ }
+ else {
+ path = a[0];
+ }
+ }
+ // export search parameters
+ try {
+ storeXML().writeDocument(new OutputStreamWriter(new FileOutputStream(path), "UTF-8"), null, "UTF-8");
+ if (path != null) {
+ m_lastXmlFileForStorage = path;
+ }
+ break;
+ }
+ catch (Throwable t) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException(ScoutTexts.get("FormExportXml") + " " + getTitle(), t));
+ saveAs = true;
+ }
+ }// end while nok
+ }
+
+ @Override
+ public void doImportXml() {
+ File dir = m_lastXmlFileForStorage;
+ if (dir != null) {
+ dir = dir.getParentFile();
+ }
+ File[] a = new FileChooser(dir, new String[]{"xml"}, true).startChooser();
+ if (a.length == 1) {
+ File newPath = a[0];
+ String text = null;
+ try {
+ SimpleXmlElement e = new SimpleXmlElement();
+ e.parseStream(new FileInputStream(newPath));
+ // load xml to search
+ m_lastXmlFileForStorage = newPath;
+ loadXML(e);
+ }
+ catch (Exception e) {
+ LOG.warn("loading: " + newPath + " text: " + text + " Exception: " + e);
+ new MessageBox(
+ null,
+ TEXTS.get("LoadFormXmlFailedText"),
+ null,
+ TEXTS.get("OkButton"),
+ null,
+ null).startMessageBox();
+ m_lastXmlFileForStorage = null;
+ }
+ }
+ }
+
+ @Override
+ public void printForm(PrintDevice device, Map<String, Object> parameters) {
+ try {
+ firePrint(null, device, parameters);
+ }
+ catch (ProcessingException e) {
+ e.addContextMessage(ScoutTexts.get("FormPrint") + " " + getTitle());
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ }
+
+ @Override
+ public void printField(IFormField field, PrintDevice device, Map<String, Object> parameters) {
+ try {
+ firePrint(field, device, parameters);
+ }
+ catch (ProcessingException e) {
+ e.addContextMessage(ScoutTexts.get("FormPrint") + " " + (field != null ? field.getLabel() : getTitle()));
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ }
+
+ @Override
+ public void activate() {
+ if (getDesktop() != null) {
+ getDesktop().ensureVisible(this);
+ }
+ }
+
+ @Override
+ public void requestFocus(IFormField f) {
+ if (f == null || f.getForm() != this) {
+ return;
+ }
+ fireRequestFocus(f);
+ }
+
+ /**
+ * Model Observer .
+ */
+ @Override
+ public void addFormListener(FormListener listener) {
+ m_listenerList.add(FormListener.class, listener);
+ }
+
+ @Override
+ public void removeFormListener(FormListener listener) {
+ m_listenerList.remove(FormListener.class, listener);
+ }
+
+ protected IEventHistory<FormEvent> createEventHistory() {
+ return new DefaultFormEventHistory(5000L);
+ }
+
+ @Override
+ public IEventHistory<FormEvent> getEventHistory() {
+ return m_eventHistory;
+ }
+
+ private void fireFormLoadBefore() throws ProcessingException {
+ fireFormEvent(new FormEvent(this, FormEvent.TYPE_LOAD_BEFORE));
+ }
+
+ private void fireFormLoadAfter() throws ProcessingException {
+ fireFormEvent(new FormEvent(this, FormEvent.TYPE_LOAD_AFTER));
+ }
+
+ private void fireFormLoadComplete() throws ProcessingException {
+ fireFormEvent(new FormEvent(this, FormEvent.TYPE_LOAD_COMPLETE));
+ }
+
+ private void fireFormStoreBefore() throws ProcessingException {
+ fireFormEvent(new FormEvent(this, FormEvent.TYPE_STORE_BEFORE));
+ }
+
+ private void fireFormDiscarded() {
+ try {
+ fireFormEvent(new FormEvent(this, FormEvent.TYPE_DISCARDED));
+ }
+ catch (ProcessingException e) {
+ e.addContextMessage(ScoutTexts.get("FormFireDiscarded") + " " + getTitle());
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ }
+
+ private void fireFormStoreAfter() throws ProcessingException {
+ fireFormEvent(new FormEvent(this, FormEvent.TYPE_STORE_AFTER));
+ }
+
+ private void firePrint(IFormField root, PrintDevice device, Map<String, Object> parameters) throws ProcessingException {
+ fireFormEvent(new FormEvent(this, FormEvent.TYPE_PRINT, root, device, parameters));
+ }
+
+ private void fireFormPrinted(File outputFile) {
+ try {
+ fireFormEvent(new FormEvent(this, FormEvent.TYPE_PRINTED, outputFile));
+ }
+ catch (ProcessingException e) {
+ e.addContextMessage(ScoutTexts.get("FormFirePrinted") + " " + getTitle());
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ }
+
+ /**
+ * send request that form was activated by gui
+ */
+ private void fireFormActivated() {
+ try {
+ execFormActivated();
+ fireFormEvent(new FormEvent(this, FormEvent.TYPE_ACTIVATED));
+
+ }
+ catch (ProcessingException e) {
+ e.addContextMessage(ScoutTexts.get("FormFireActivated") + " " + getTitle());
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ }
+
+ /**
+ * send request that form was closed by gui
+ */
+ private void fireFormClosed() {
+ try {
+ fireFormEvent(new FormEvent(this, FormEvent.TYPE_CLOSED));
+ }
+ catch (ProcessingException e) {
+ e.addContextMessage(ScoutTexts.get("FormFireClosed") + " " + getTitle());
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ }
+
+ private void fireFormEvent(FormEvent e) throws ProcessingException {
+ EventListener[] listeners = m_listenerList.getListeners(FormListener.class);
+ if (listeners != null && listeners.length > 0) {
+ ProcessingException pe = null;
+ for (int i = 0; i < listeners.length; i++) {
+ try {
+ ((FormListener) listeners[i]).formChanged(e);
+ }
+ catch (ProcessingException ex) {
+ if (pe == null) {
+ pe = ex;
+ }
+ }
+ catch (Throwable t) {
+ if (pe == null) {
+ pe = new ProcessingException("Unexpected", t);
+ }
+ }
+ }
+ if (pe != null) {
+ throw pe;
+ }
+ }
+ IEventHistory<FormEvent> h = getEventHistory();
+ if (h != null) {
+ h.notifyEvent(e);
+ }
+ }
+
+ @Override
+ public void structureChanged(IFormField causingField) {
+ fireFormStructureChanged(causingField);
+ }
+
+ private void fireFormStructureChanged(IFormField causingField) {
+ try {
+ fireFormEvent(new FormEvent(this, FormEvent.TYPE_STRUCTURE_CHANGED, causingField));
+ }
+ catch (ProcessingException e) {
+ e.addContextMessage(ScoutTexts.get("FormFireStructureChanged") + " " + getTitle());
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ }
+
+ private void fireFormToFront() {
+ try {
+ fireFormEvent(new FormEvent(this, FormEvent.TYPE_TO_FRONT));
+ }
+ catch (ProcessingException e) {
+ e.addContextMessage(ScoutTexts.get("FormFireToFront") + " " + getTitle());
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ }
+
+ private void fireFormToBack() {
+ try {
+ fireFormEvent(new FormEvent(this, FormEvent.TYPE_TO_BACK));
+ }
+ catch (ProcessingException e) {
+ e.addContextMessage(ScoutTexts.get("FormFireToBack") + " " + getTitle());
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ }
+
+ private void fireRequestFocus(IFormField f) {
+ try {
+ fireFormEvent(new FormEvent(this, FormEvent.TYPE_REQUEST_FOCUS, f));
+ }
+ catch (ProcessingException e) {
+ e.addContextMessage(ScoutTexts.get("FormFireRequestFocus") + " " + getTitle() + " for " + f.getLabel());
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ }
+
+ @Override
+ public String getBasicTitle() {
+ return m_basicTitle;
+ }
+
+ @Override
+ public void setBasicTitle(String basicTitle) {
+ m_basicTitle = basicTitle;
+ composeTitle();
+ }
+
+ @Override
+ public String getSubTitle() {
+ return m_subTitle;
+ }
+
+ @Override
+ public void setSubTitle(String subTitle) {
+ m_subTitle = subTitle;
+ composeTitle();
+ }
+
+ @Override
+ public void setTitle(String s) {
+ m_basicTitle = s;
+ m_subTitle = null;
+ composeTitle();
+ }
+
+ private void composeTitle() {
+ StringBuffer buf = new StringBuffer();
+ String basic = getBasicTitle();
+ if (basic != null) {
+ if (buf.length() > 0) {
+ buf.append(" - ");
+ }
+ buf.append(basic);
+ }
+ String sub = getSubTitle();
+ if (sub != null) {
+ if (buf.length() > 0) {
+ buf.append(" - ");
+ }
+ buf.append(sub);
+ }
+ propertySupport.setPropertyString(PROP_TITLE, buf.toString());
+ }
+
+ @Override
+ public String getTitle() {
+ return propertySupport.getPropertyString(PROP_TITLE);
+ }
+
+ @Override
+ public boolean isMaximizeEnabled() {
+ return propertySupport.getPropertyBool(PROP_MAXIMIZE_ENABLED);
+ }
+
+ @Override
+ public void setMaximizeEnabled(boolean b) {
+ propertySupport.setPropertyBool(PROP_MAXIMIZE_ENABLED, b);
+ }
+
+ @Override
+ public boolean isMinimizeEnabled() {
+ return propertySupport.getPropertyBool(PROP_MINIMIZE_ENABLED);
+ }
+
+ @Override
+ public void setMinimizeEnabled(boolean b) {
+ propertySupport.setPropertyBool(PROP_MINIMIZE_ENABLED, b);
+ }
+
+ @Override
+ public boolean isMaximized() {
+ return propertySupport.getPropertyBool(PROP_MAXIMIZED);
+ }
+
+ @Override
+ public void setMaximized(boolean b) {
+ if (isMaximizeEnabled()) {
+ if (b) {
+ propertySupport.setPropertyBool(PROP_MINIMIZED, false);
+ }
+ // maximized state of ui could be out of sync, fire always
+ propertySupport.setPropertyAlwaysFire(PROP_MAXIMIZED, b);
+ }
+ }
+
+ @Override
+ public boolean isMinimized() {
+ return propertySupport.getPropertyBool(PROP_MINIMIZED);
+ }
+
+ @Override
+ public void setMinimized(boolean b) {
+ if (isMinimizeEnabled()) {
+ if (b) {
+ propertySupport.setPropertyBool(PROP_MAXIMIZED, false);
+ }
+ // minimized state of ui could be out of sync, fire always
+ propertySupport.setPropertyAlwaysFire(PROP_MINIMIZED, b);
+
+ }
+ }
+
+ @Override
+ public boolean isAutoAddRemoveOnDesktop() {
+ return m_autoRegisterInDesktopOnStart;
+ }
+
+ @Override
+ public void setAutoAddRemoveOnDesktop(boolean b) {
+ m_autoRegisterInDesktopOnStart = b;
+ }
+
+ @Override
+ public boolean isModal() {
+ return m_modal;
+ }
+
+ @Override
+ public void setModal(boolean b) {
+ if (b) {
+ switch (getDisplayHint()) {
+ case DISPLAY_HINT_POPUP_DIALOG:
+ case DISPLAY_HINT_DIALOG: {
+ m_modal = b;
+ break;
+ }
+ default: {
+ LOG.warn("cannot set property 'modal' to true with current display hint type");
+ }
+ }
+ }
+ else {
+ m_modal = b;
+ }
+ }
+
+ @Override
+ public void setCacheBounds(boolean cacheBounds) {
+ m_cacheBounds = cacheBounds;
+ }
+
+ @Override
+ public boolean isCacheBounds() {
+ return m_cacheBounds;
+ }
+
+ @Override
+ public String computeCacheBoundsKey() {
+ return getClass().getName();
+ }
+
+ @Override
+ public int getDisplayHint() {
+ return m_displayHint;
+ }
+
+ @Override
+ public void setDisplayHint(int i) {
+ switch (i) {
+ case DISPLAY_HINT_DIALOG: {
+ m_displayHint = i;
+ break;
+ }
+ case DISPLAY_HINT_POPUP_WINDOW: {
+ m_displayHint = i;
+ setModal(false);
+ break;
+ }
+ case DISPLAY_HINT_POPUP_DIALOG: {
+ m_displayHint = i;
+ break;
+ }
+ case DISPLAY_HINT_VIEW: {
+ m_displayHint = i;
+ setModal(false);
+ break;
+ }
+ default: {
+ throw new IllegalArgumentException("invalid displayHint " + i);
+ }
+ }
+ }
+
+ @Override
+ public String getDisplayViewId() {
+ return m_displayViewId;
+ }
+
+ @Override
+ public void setDisplayViewId(String viewId) {
+ m_displayViewId = viewId;
+ }
+
+ @Override
+ public boolean isAskIfNeedSave() {
+ return m_askIfNeedSave;
+ }
+
+ @Override
+ public void setAskIfNeedSave(boolean b) {
+ m_askIfNeedSave = b;
+ }
+
+ @Override
+ public void toFront() {
+ fireFormToFront();
+ }
+
+ @Override
+ public void toBack() {
+ fireFormToBack();
+ }
+
+ @Override
+ public boolean isButtonsArmed() {
+ return m_buttonsArmed;
+ }
+
+ @Override
+ public void setButtonsArmed(boolean b) {
+ m_buttonsArmed = b;
+ }
+
+ @Override
+ public boolean isCloseTimerArmed() {
+ return m_closeTimerArmed;
+ }
+
+ @Override
+ public void setCloseTimerArmed(boolean b) {
+ m_closeTimerArmed = b;
+ }
+
+ @Override
+ public String toString() {
+ return "Form " + getFormId();
+ }
+
+ @Override
+ public IFormUIFacade getUIFacade() {
+ return m_uiFacade;
+ }
+
+ protected void handleSystemButtonEventInternal(ButtonEvent e) {
+ switch (e.getType()) {
+ case ButtonEvent.TYPE_CLICKED: {
+ // disable close timer
+ setCloseTimerArmed(false);
+ if (isButtonsArmed()) {
+ if (checkForVerifyingFields()) {
+ try {
+ IButton src = (IButton) e.getSource();
+ switch (src.getSystemType()) {
+ case IButton.SYSTEM_TYPE_CANCEL: {
+ doCancel();
+ break;
+ }
+ case IButton.SYSTEM_TYPE_CLOSE: {
+ doClose();
+ break;
+ }
+ case IButton.SYSTEM_TYPE_OK: {
+ doOk();
+ break;
+ }
+ case IButton.SYSTEM_TYPE_RESET: {
+ doReset();
+ break;
+ }
+ case IButton.SYSTEM_TYPE_SAVE: {
+ doSave();
+ break;
+ }
+ case IButton.SYSTEM_TYPE_SAVE_WITHOUT_MARKER_CHANGE: {
+ doSaveWithoutMarkerChange();
+ break;
+ }
+ }
+ }
+ catch (ProcessingException se) {
+ se.addContextMessage(ScoutTexts.get("FormButtonClicked") + " " + getTitle() + "." + e.getButton().getLabel());
+ SERVICES.getService(IExceptionHandlerService.class).handleException(se);
+ }
+ if (m_currentValidateContentDescriptor != null) {
+ m_currentValidateContentDescriptor.activateProblemLocation();
+ m_currentValidateContentDescriptor = null;
+ }
+ }// end
+ }
+ break;
+ }
+ }
+ }
+
+ /**
+ * Button controller for ok,cancel, save etc.
+ */
+ private class P_SystemButtonListener implements ButtonListener {
+ @Override
+ public void buttonChanged(ButtonEvent e) {
+ // auto-detaching
+ if (m_systemButtonListener != this) {
+ ((IButton) e.getSource()).removeButtonListener(this);
+ return;
+ }
+ handleSystemButtonEventInternal(e);
+ }
+ }// end private class
+
+ private class P_MainBoxPropertyChangeProxy implements PropertyChangeListener {
+ @Override
+ public void propertyChange(PropertyChangeEvent e) {
+ if (IFormField.PROP_SAVE_NEEDED.equals(e.getPropertyName())) {
+ propertySupport.firePropertyChange(PROP_SAVE_NEEDED, e.getOldValue(), e.getNewValue());
+ }
+ else if (IFormField.PROP_EMPTY.equals(e.getPropertyName())) {
+ propertySupport.firePropertyChange(PROP_EMPTY, e.getOldValue(), e.getNewValue());
+ }
+ }
+ }
+
+ /**
+ * form custom timer
+ */
+ private class P_Timer extends StoppableThread {
+ private final long m_intervalMillis;
+ private final String m_timerId;
+ private boolean m_execPending = false;// do not execute while exec is pending
+ private final IClientSession m_session;
+
+ public P_Timer(long seconds, String timerId) {
+ setDaemon(true);
+ m_intervalMillis = seconds * 1000L;
+ m_timerId = timerId;
+ m_session = ClientSyncJob.getCurrentSession();
+ }
+
+ @Override
+ public void run() {
+ long next = ((System.currentTimeMillis() + 999L) / 1000L) * 1000L + m_intervalMillis;
+ while (m_scoutTimerMap != null && !isStopSignal()) {
+ try {
+ sleep(250);
+ }
+ catch (InterruptedException ex) {
+ }
+ // active?
+ if ((!m_execPending) && (!isStopSignal())) {
+ // next ready?
+ if (next < System.currentTimeMillis()) {
+ m_execPending = true;
+ new ClientSyncJob("Form timer", m_session) {
+ @Override
+ protected void runVoid(IProgressMonitor monitor) throws Throwable {
+ try {
+ if (LOG.isInfoEnabled()) {
+ LOG.info("timer " + m_timerId);
+ }
+ execTimer(m_timerId);
+ }
+ catch (ProcessingException se) {
+ se.addContextMessage(ScoutTexts.get("FormTimerActivated") + " " + getTitle() + "." + m_timerId);
+ SERVICES.getService(IExceptionHandlerService.class).handleException(se);
+ }
+ finally {
+ m_execPending = false;// continue scheduling
+ }
+ }
+ }.schedule();
+ }
+ }
+ // update next
+ while (next < System.currentTimeMillis()) {
+ next = next + m_intervalMillis;
+ }
+ }
+ }
+ }// end private class
+
+ /**
+ * form close timer
+ */
+ private class P_CloseTimer extends StoppableThread {
+ private long m_seconds;
+ private final IClientSession m_session;
+
+ public P_CloseTimer(long seconds) {
+ setName("IForm.P_CloseTimer");
+ setDaemon(true);
+ m_seconds = seconds;
+ m_session = ClientSyncJob.getCurrentSession();
+ }
+
+ @Override
+ public void run() {
+ while (this == m_scoutCloseTimer && m_seconds > 0 && isCloseTimerArmed()) {
+ new ClientSyncJob("Form close countdown", m_session) {
+ @Override
+ protected void runVoid(IProgressMonitor monitor) throws Throwable {
+ setSubTitle("" + m_seconds);
+ }
+ }.schedule();
+ try {
+ sleep(1000);
+ }
+ catch (InterruptedException ex) {
+ }
+ m_seconds--;
+ }
+ if (this == m_scoutCloseTimer) {
+ new ClientSyncJob("Form close timer", m_session) {
+ @Override
+ protected void runVoid(IProgressMonitor monitor) throws Throwable {
+ try {
+ if (isCloseTimerArmed()) {
+ execCloseTimer();
+ }
+ else {
+ setSubTitle(null);
+ }
+ }
+ catch (ProcessingException se) {
+ se.addContextMessage(ScoutTexts.get("FormCloseTimerActivated") + " " + getTitle());
+ SERVICES.getService(IExceptionHandlerService.class).handleException(se);
+ }
+ }
+ }.schedule();
+ }
+ }
+ }// end private class
+
+ private abstract static class P_AbstractCollectingFieldVisitor<T> implements IFormFieldVisitor {
+ private final ArrayList<T> m_list = new ArrayList<T>();
+
+ public void collect(T o) {
+ m_list.add(o);
+ }
+
+ public int getCollectionCount() {
+ return m_list.size();
+ }
+
+ public List<T> getCollection() {
+ return m_list;
+ }
+
+ }
+
+ private class P_UIFacade implements IFormUIFacade {
+ @Override
+ public void fireFormActivatedFromUI() {
+ fireFormActivated();
+ }
+
+ @Override
+ public void fireFormClosingFromUI() {
+ // check if some field is verifying input. In this case cancel ui call
+ if (!checkForVerifyingFields()) {
+ return;
+ }
+ closeFormInternal(false);
+ }
+
+ @Override
+ public void fireFormKilledFromUI() {
+ closeFormInternal(true);
+ }
+
+ @Override
+ public void fireFormPrintedFromUI(File outputFile) {
+ fireFormPrinted(outputFile);
+ }
+ }// end private class
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/AbstractFormHandler.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/AbstractFormHandler.java
index c62dc06673..4a5b6ef318 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/AbstractFormHandler.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/AbstractFormHandler.java
@@ -1,269 +1,269 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form;
-
-import org.eclipse.scout.commons.annotations.ConfigOperation;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-
-public abstract class AbstractFormHandler implements IFormHandler {
- private IForm m_form;
- private boolean m_openExclusive;
-
- public AbstractFormHandler() {
- initConfig();
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(10)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredGuiLess() {
- return false;
- }
-
- /**
- * @return false to open a new form anytime, true to open a form<br>
- * with a same {@link IForm#computeExclusiveKey()} only once.
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(20)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredOpenExclusive() {
- return false;
- }
-
- /**
- * Before the form is activated, this method loads its data.<br>
- * After this method call, the form is in the state "Saved / Unchanged" All
- * field value changes done here appear as unchanged in the form.
- */
- @ConfigOperation
- @Order(10)
- protected void execLoad() throws ProcessingException {
- }
-
- /**
- * Load additional form state<br>
- * this method call is after the form was loaded into the state
- * "Saved / Unchanged"<br>
- * any changes to fields might result in the form ot fields being changed and
- * therefore in the state "Save needed / Changed"
- */
- @ConfigOperation
- @Order(20)
- protected void execPostLoad() throws ProcessingException {
- }
-
- /**
- * This method is called in order to check field validity.<br>
- * This method is called just after the {@link IForm#execCheckFields()} but
- * before the form is validated and stored.<br>
- * After this method, the form is checking fields itself and displaying a
- * dialog with missing and invalid fields.
- *
- * @return true when this check is done and further checks can continue, false
- * to silently cancel the current process
- * @throws ProcessingException
- * to cancel the current process with error handling and user
- * notification such as a dialog
- */
- @ConfigOperation
- @Order(40)
- protected boolean execCheckFields() throws ProcessingException {
- return true;
- }
-
- /**
- * This method is called in order to update derived states like button
- * enablings.<br>
- * This method is called after the {@link IForm#execValidate()} but before the
- * form is stored.<br>
- *
- * @return true when validate is successful, false to silently cancel the
- * current process
- * @throws ProcessingException
- * to cancel the current process with error handling and user
- * notification such as a dialog
- */
- @ConfigOperation
- @Order(50)
- protected boolean execValidate() throws ProcessingException {
- return true;
- }
-
- /**
- * Store form state<br>
- * after this method call, the form is in the state "Saved / Unchanged" When
- * the form is closed using Ok, Save, Search, Next, etc.. this method is
- * called to apply the changes to the persistency layer
- */
- @ConfigOperation
- @Order(40)
- protected void execStore() throws ProcessingException {
- }
-
- /**
- * When the form is closed using cancel or close this method is called to
- * manage the case that no changes should be performed (revert case)
- */
- @ConfigOperation
- @Order(30)
- protected void execDiscard() throws ProcessingException {
- }
-
- /**
- * Finalize form state<br>
- * called whenever the handler is finished and the form is closed When the
- * form is closed in any way this method is called to dispose of resources or
- * deallocate services
- */
- @ConfigOperation
- @Order(60)
- protected void execFinally() throws ProcessingException {
- }
-
- /*
- * Runtime
- */
- protected void initConfig() {
- setOpenExclusive(getConfiguredOpenExclusive());
- }
-
- @Override
- public void setOpenExclusive(boolean openExclusive) {
- m_openExclusive = openExclusive;
- }
-
- @Override
- public boolean isOpenExclusive() {
- return m_openExclusive;
- }
-
- @Override
- public IForm getForm() {
- return m_form;
- }
-
- /**
- * do not use this internal method
- */
- @Override
- public void setFormInternal(IForm form) {
- m_form = form;
- }
-
- @Override
- public String getHandlerId() {
- String s = getClass().getName();
- int i = Math.max(s.lastIndexOf('$'), s.lastIndexOf('.'));
- s = s.substring(i + 1);
- return s;
- }
-
- @Override
- public boolean isGuiLess() {
- return getConfiguredGuiLess();
- }
-
- @Override
- public final void onLoad() throws ProcessingException {
- try {
- execLoad();
- }
- catch (ProcessingException e) {
- throw e;
- }
- catch (Throwable e) {
- throw new ProcessingException("Unexpected", e);
- }
- }
-
- @Override
- public final void onPostLoad() throws ProcessingException {
- try {
- execPostLoad();
- }
- catch (ProcessingException e) {
- throw e;
- }
- catch (Throwable e) {
- throw new ProcessingException("Unexpected", e);
- }
- }
-
- @Override
- public final boolean onCheckFields() throws ProcessingException {
- try {
- return execCheckFields();
- }
- catch (ProcessingException e) {
- throw e;
- }
- catch (Throwable e) {
- throw new ProcessingException("Unexpected", e);
- }
- }
-
- @Override
- public final boolean onValidate() throws ProcessingException {
- try {
- return execValidate();
- }
- catch (ProcessingException e) {
- throw e;
- }
- catch (Throwable e) {
- throw new ProcessingException("Unexpected", e);
- }
- }
-
- @Override
- public final void onStore() throws ProcessingException {
- try {
- execStore();
- }
- catch (ProcessingException e) {
- throw e;
- }
- catch (Throwable e) {
- throw new ProcessingException("Unexpected", e);
- }
- }
-
- @Override
- public final void onDiscard() throws ProcessingException {
- try {
- execDiscard();
- }
- catch (ProcessingException e) {
- throw e;
- }
- catch (Throwable e) {
- throw new ProcessingException("Unexpected", e);
- }
- }
-
- @Override
- public final void onFinally() throws ProcessingException {
- try {
- execFinally();
- }
- catch (ProcessingException e) {
- throw e;
- }
- catch (Throwable e) {
- throw new ProcessingException("Unexpected", e);
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form;
+
+import org.eclipse.scout.commons.annotations.ConfigOperation;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+
+public abstract class AbstractFormHandler implements IFormHandler {
+ private IForm m_form;
+ private boolean m_openExclusive;
+
+ public AbstractFormHandler() {
+ initConfig();
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(10)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredGuiLess() {
+ return false;
+ }
+
+ /**
+ * @return false to open a new form anytime, true to open a form<br>
+ * with a same {@link IForm#computeExclusiveKey()} only once.
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(20)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredOpenExclusive() {
+ return false;
+ }
+
+ /**
+ * Before the form is activated, this method loads its data.<br>
+ * After this method call, the form is in the state "Saved / Unchanged" All
+ * field value changes done here appear as unchanged in the form.
+ */
+ @ConfigOperation
+ @Order(10)
+ protected void execLoad() throws ProcessingException {
+ }
+
+ /**
+ * Load additional form state<br>
+ * this method call is after the form was loaded into the state
+ * "Saved / Unchanged"<br>
+ * any changes to fields might result in the form ot fields being changed and
+ * therefore in the state "Save needed / Changed"
+ */
+ @ConfigOperation
+ @Order(20)
+ protected void execPostLoad() throws ProcessingException {
+ }
+
+ /**
+ * This method is called in order to check field validity.<br>
+ * This method is called just after the {@link IForm#execCheckFields()} but
+ * before the form is validated and stored.<br>
+ * After this method, the form is checking fields itself and displaying a
+ * dialog with missing and invalid fields.
+ *
+ * @return true when this check is done and further checks can continue, false
+ * to silently cancel the current process
+ * @throws ProcessingException
+ * to cancel the current process with error handling and user
+ * notification such as a dialog
+ */
+ @ConfigOperation
+ @Order(40)
+ protected boolean execCheckFields() throws ProcessingException {
+ return true;
+ }
+
+ /**
+ * This method is called in order to update derived states like button
+ * enablings.<br>
+ * This method is called after the {@link IForm#execValidate()} but before the
+ * form is stored.<br>
+ *
+ * @return true when validate is successful, false to silently cancel the
+ * current process
+ * @throws ProcessingException
+ * to cancel the current process with error handling and user
+ * notification such as a dialog
+ */
+ @ConfigOperation
+ @Order(50)
+ protected boolean execValidate() throws ProcessingException {
+ return true;
+ }
+
+ /**
+ * Store form state<br>
+ * after this method call, the form is in the state "Saved / Unchanged" When
+ * the form is closed using Ok, Save, Search, Next, etc.. this method is
+ * called to apply the changes to the persistency layer
+ */
+ @ConfigOperation
+ @Order(40)
+ protected void execStore() throws ProcessingException {
+ }
+
+ /**
+ * When the form is closed using cancel or close this method is called to
+ * manage the case that no changes should be performed (revert case)
+ */
+ @ConfigOperation
+ @Order(30)
+ protected void execDiscard() throws ProcessingException {
+ }
+
+ /**
+ * Finalize form state<br>
+ * called whenever the handler is finished and the form is closed When the
+ * form is closed in any way this method is called to dispose of resources or
+ * deallocate services
+ */
+ @ConfigOperation
+ @Order(60)
+ protected void execFinally() throws ProcessingException {
+ }
+
+ /*
+ * Runtime
+ */
+ protected void initConfig() {
+ setOpenExclusive(getConfiguredOpenExclusive());
+ }
+
+ @Override
+ public void setOpenExclusive(boolean openExclusive) {
+ m_openExclusive = openExclusive;
+ }
+
+ @Override
+ public boolean isOpenExclusive() {
+ return m_openExclusive;
+ }
+
+ @Override
+ public IForm getForm() {
+ return m_form;
+ }
+
+ /**
+ * do not use this internal method
+ */
+ @Override
+ public void setFormInternal(IForm form) {
+ m_form = form;
+ }
+
+ @Override
+ public String getHandlerId() {
+ String s = getClass().getName();
+ int i = Math.max(s.lastIndexOf('$'), s.lastIndexOf('.'));
+ s = s.substring(i + 1);
+ return s;
+ }
+
+ @Override
+ public boolean isGuiLess() {
+ return getConfiguredGuiLess();
+ }
+
+ @Override
+ public final void onLoad() throws ProcessingException {
+ try {
+ execLoad();
+ }
+ catch (ProcessingException e) {
+ throw e;
+ }
+ catch (Throwable e) {
+ throw new ProcessingException("Unexpected", e);
+ }
+ }
+
+ @Override
+ public final void onPostLoad() throws ProcessingException {
+ try {
+ execPostLoad();
+ }
+ catch (ProcessingException e) {
+ throw e;
+ }
+ catch (Throwable e) {
+ throw new ProcessingException("Unexpected", e);
+ }
+ }
+
+ @Override
+ public final boolean onCheckFields() throws ProcessingException {
+ try {
+ return execCheckFields();
+ }
+ catch (ProcessingException e) {
+ throw e;
+ }
+ catch (Throwable e) {
+ throw new ProcessingException("Unexpected", e);
+ }
+ }
+
+ @Override
+ public final boolean onValidate() throws ProcessingException {
+ try {
+ return execValidate();
+ }
+ catch (ProcessingException e) {
+ throw e;
+ }
+ catch (Throwable e) {
+ throw new ProcessingException("Unexpected", e);
+ }
+ }
+
+ @Override
+ public final void onStore() throws ProcessingException {
+ try {
+ execStore();
+ }
+ catch (ProcessingException e) {
+ throw e;
+ }
+ catch (Throwable e) {
+ throw new ProcessingException("Unexpected", e);
+ }
+ }
+
+ @Override
+ public final void onDiscard() throws ProcessingException {
+ try {
+ execDiscard();
+ }
+ catch (ProcessingException e) {
+ throw e;
+ }
+ catch (Throwable e) {
+ throw new ProcessingException("Unexpected", e);
+ }
+ }
+
+ @Override
+ public final void onFinally() throws ProcessingException {
+ try {
+ execFinally();
+ }
+ catch (ProcessingException e) {
+ throw e;
+ }
+ catch (Throwable e) {
+ throw new ProcessingException("Unexpected", e);
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/DefaultFormEventHistory.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/DefaultFormEventHistory.java
index 45504471c7..a713e3699d 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/DefaultFormEventHistory.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/DefaultFormEventHistory.java
@@ -1,53 +1,53 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form;
-
-import org.eclipse.scout.rt.client.ui.AbstractEventHistory;
-
-/**
- * The default implementation is created in {@link AbstractForm#createEventHistory()} and tracks
- * <ul>
- * <li>{@link FormEvent#TYPE_REQUEST_FOCUS}</li>
- * <li>{@link FormEvent#TYPE_TO_BACK}</li>
- * <li>{@link FormEvent#TYPE_TO_FRONT}</li>
- * <li>{@link FormEvent#TYPE_PRINT}</li>
- * </ul>
- * <p>
- * This object is thread safe.
- *
- * @since 3.8
- */
-public class DefaultFormEventHistory extends AbstractEventHistory<FormEvent> {
-
- /**
- * @param timeToLiveMillis
- */
- public DefaultFormEventHistory(long timeToLiveMillis) {
- super(timeToLiveMillis);
- }
-
- @Override
- public void notifyEvent(FormEvent event) {
- switch (event.getType()) {
- case FormEvent.TYPE_REQUEST_FOCUS:
- case FormEvent.TYPE_TO_BACK:
- case FormEvent.TYPE_TO_FRONT: {
- addToCache(event.getType(), event);
- break;
- }
- case FormEvent.TYPE_PRINT: {
- addToCache(event, event);
- break;
- }
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form;
+
+import org.eclipse.scout.rt.client.ui.AbstractEventHistory;
+
+/**
+ * The default implementation is created in {@link AbstractForm#createEventHistory()} and tracks
+ * <ul>
+ * <li>{@link FormEvent#TYPE_REQUEST_FOCUS}</li>
+ * <li>{@link FormEvent#TYPE_TO_BACK}</li>
+ * <li>{@link FormEvent#TYPE_TO_FRONT}</li>
+ * <li>{@link FormEvent#TYPE_PRINT}</li>
+ * </ul>
+ * <p>
+ * This object is thread safe.
+ *
+ * @since 3.8
+ */
+public class DefaultFormEventHistory extends AbstractEventHistory<FormEvent> {
+
+ /**
+ * @param timeToLiveMillis
+ */
+ public DefaultFormEventHistory(long timeToLiveMillis) {
+ super(timeToLiveMillis);
+ }
+
+ @Override
+ public void notifyEvent(FormEvent event) {
+ switch (event.getType()) {
+ case FormEvent.TYPE_REQUEST_FOCUS:
+ case FormEvent.TYPE_TO_BACK:
+ case FormEvent.TYPE_TO_FRONT: {
+ addToCache(event.getType(), event);
+ break;
+ }
+ case FormEvent.TYPE_PRINT: {
+ addToCache(event, event);
+ break;
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/DefaultFormFieldInjection.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/DefaultFormFieldInjection.java
index 6aba92c303..9c4c222fac 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/DefaultFormFieldInjection.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/DefaultFormFieldInjection.java
@@ -1,77 +1,77 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.scout.commons.annotations.InjectFieldTo;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-
-/**
- * Default implementation that inserts the fields at the right place based on their {@link Order} annotation.
- *
- * @since 3.8.1
- */
-public class DefaultFormFieldInjection implements IFormFieldInjection {
- private final ArrayList<IFormField> m_list = new ArrayList<IFormField>();
-
- public void addField(IFormField f) {
- m_list.add(f);
- }
-
- @Override
- public void injectFields(IFormField container, List<IFormField> fieldList) {
- if (container == null || fieldList == null || m_list.isEmpty()) {
- return;
- }
- Class<?> containerClazz = container.getClass();
- for (IFormField f : m_list) {
- InjectFieldTo ann = f.getClass().getAnnotation(InjectFieldTo.class);
- if (ann == null) {
- continue;
- }
- if (ann.value() != containerClazz) {
- continue;
- }
- insertField(fieldList, f);
- }
- }
-
- /**
- * add the field f to the list at the right place regarding the {@link Order} annotation
- */
- protected void insertField(List<IFormField> list, IFormField f) {
- //check if list already contains f
- if (list.contains(f)) {
- return;
- }
- Class<?> c = f.getClass();
- if (!c.isAnnotationPresent(Order.class)) {
- list.add(f);
- return;
- }
- double newOrder = c.getAnnotation(Order.class).value();
- for (int i = 0, n = list.size(); i < n; i++) {
- Class<?> existingClazz = list.get(i).getClass();
- if (existingClazz.isAnnotationPresent(Order.class)) {
- double existingOrder = existingClazz.getAnnotation(Order.class).value();
- if (newOrder < existingOrder) {
- list.add(i, f);
- return;
- }
- }
- }
- //default at end
- list.add(f);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.scout.commons.annotations.InjectFieldTo;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+
+/**
+ * Default implementation that inserts the fields at the right place based on their {@link Order} annotation.
+ *
+ * @since 3.8.1
+ */
+public class DefaultFormFieldInjection implements IFormFieldInjection {
+ private final ArrayList<IFormField> m_list = new ArrayList<IFormField>();
+
+ public void addField(IFormField f) {
+ m_list.add(f);
+ }
+
+ @Override
+ public void injectFields(IFormField container, List<IFormField> fieldList) {
+ if (container == null || fieldList == null || m_list.isEmpty()) {
+ return;
+ }
+ Class<?> containerClazz = container.getClass();
+ for (IFormField f : m_list) {
+ InjectFieldTo ann = f.getClass().getAnnotation(InjectFieldTo.class);
+ if (ann == null) {
+ continue;
+ }
+ if (ann.value() != containerClazz) {
+ continue;
+ }
+ insertField(fieldList, f);
+ }
+ }
+
+ /**
+ * add the field f to the list at the right place regarding the {@link Order} annotation
+ */
+ protected void insertField(List<IFormField> list, IFormField f) {
+ //check if list already contains f
+ if (list.contains(f)) {
+ return;
+ }
+ Class<?> c = f.getClass();
+ if (!c.isAnnotationPresent(Order.class)) {
+ list.add(f);
+ return;
+ }
+ double newOrder = c.getAnnotation(Order.class).value();
+ for (int i = 0, n = list.size(); i < n; i++) {
+ Class<?> existingClazz = list.get(i).getClass();
+ if (existingClazz.isAnnotationPresent(Order.class)) {
+ double existingOrder = existingClazz.getAnnotation(Order.class).value();
+ if (newOrder < existingOrder) {
+ list.add(i, f);
+ return;
+ }
+ }
+ }
+ //default at end
+ list.add(f);
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/FormEvent.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/FormEvent.java
index e0a71844c8..4609305640 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/FormEvent.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/FormEvent.java
@@ -1,161 +1,161 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form;
-
-import java.io.File;
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-import java.util.EventObject;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.pagefield.IPageField;
-import org.eclipse.scout.rt.client.ui.form.fields.wrappedform.IWrappedFormField;
-
-/**
- * Form lifecycle for observing form "open" event attach to IDesktop and listen
- * for FORM_ADDED
- */
-public class FormEvent extends EventObject {
- private static final long serialVersionUID = 1L;
- // state
- public static final int TYPE_ACTIVATED = 510;
- public static final int TYPE_LOAD_BEFORE = 1000;
- public static final int TYPE_LOAD_AFTER = 1010;
- public static final int TYPE_LOAD_COMPLETE = 1020;
- public static final int TYPE_STORE_BEFORE = 2010;
- public static final int TYPE_STORE_AFTER = 2020;
- public static final int TYPE_DISCARDED = 3000;
- public static final int TYPE_CLOSED = 3010;
- /**
- * print a form using properties formField, printDevice, printParameters
- */
- public static final int TYPE_PRINT = 4000;
- /**
- * This event is sent once the async print job is done
- */
- public static final int TYPE_PRINTED = 4010;
- /**
- * When the field structure changes Examples: a field changes its "visible"
- * property a {@link IWrappedFormField} changes its inner form a {@link IPageField} changes its table/search/detail a
- * custom field changes
- * in a way that the form structure is different
- */
- public static final int TYPE_STRUCTURE_CHANGED = 5000;
- /**
- * see {@link IForm#toFront()}
- */
- public static final int TYPE_TO_FRONT = 6000;
- /**
- * see {@link IForm#toBack()}
- */
- public static final int TYPE_TO_BACK = 6010;
- /**
- * see {@link IFormField#requestFocus()}
- */
- public static final int TYPE_REQUEST_FOCUS = 6020;
- //next 6030
-
- private final int m_type;
- private IFormField m_formField;
- private PrintDevice m_printDevice;
- private Map<String, Object> m_printParameters;
- private File m_printedFile;
-
- /**
- * A form event is sent whenever a form changes. You can register
- * to receive such events via {@link IForm#addFormListener(FormListener)}.
- * The form listener will get sent form events via <code>formChanged</code>.
- * Once you implement your form listener and receive your form events, you'll
- * probably be interested in the <b>type</b> you get via <code>getType</code>.
- */
- public FormEvent(IForm form, int type) {
- super(form);
- m_type = type;
- }
-
- public FormEvent(IForm form, int type, File printedFile) {
- this(form, type);
- m_printedFile = printedFile;
- }
-
- public FormEvent(IForm form, int type, IFormField causingField) {
- super(form);
- m_type = type;
- m_formField = causingField;
- }
-
- public FormEvent(IForm form, int type, IFormField printRoot, PrintDevice printDevice, Map<String, Object> printParameters) {
- super(form);
- m_type = type;
- m_formField = printRoot;
- m_printDevice = printDevice;
- m_printParameters = printParameters;
- }
-
- public IForm getForm() {
- return (IForm) getSource();
- }
-
- public int getType() {
- return m_type;
- }
-
- public IFormField getFormField() {
- return m_formField;
- }
-
- public PrintDevice getPrintDevice() {
- return m_printDevice;
- }
-
- public File getPrintedFile() {
- return m_printedFile;
- }
-
- public Map<String, Object> getPrintParameters() {
- if (m_printParameters != null) {
- return new HashMap<String, Object>(m_printParameters);
- }
- else {
- return new HashMap<String, Object>();
- }
- }
-
- @Override
- public String toString() {
- StringBuffer buf = new StringBuffer();
- buf.append("DialogEvent[");
- // decode type
- try {
- Field[] f = getClass().getDeclaredFields();
- for (int i = 0; i < f.length; i++) {
- if (Modifier.isPublic(f[i].getModifiers()) && Modifier.isStatic(f[i].getModifiers()) && f[i].getName().startsWith("TYPE_")) {
- if (((Number) f[i].get(null)).intValue() == m_type) {
- buf.append(f[i].getName());
- break;
- }
- }
- }
- }
- catch (Throwable t) {
- buf.append("#" + m_type);
- }
- // dialog
- if (getForm() != null) {
- buf.append(" " + getForm().getFormId());
- }
- buf.append("]");
- return buf.toString();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form;
+
+import java.io.File;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.util.EventObject;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.pagefield.IPageField;
+import org.eclipse.scout.rt.client.ui.form.fields.wrappedform.IWrappedFormField;
+
+/**
+ * Form lifecycle for observing form "open" event attach to IDesktop and listen
+ * for FORM_ADDED
+ */
+public class FormEvent extends EventObject {
+ private static final long serialVersionUID = 1L;
+ // state
+ public static final int TYPE_ACTIVATED = 510;
+ public static final int TYPE_LOAD_BEFORE = 1000;
+ public static final int TYPE_LOAD_AFTER = 1010;
+ public static final int TYPE_LOAD_COMPLETE = 1020;
+ public static final int TYPE_STORE_BEFORE = 2010;
+ public static final int TYPE_STORE_AFTER = 2020;
+ public static final int TYPE_DISCARDED = 3000;
+ public static final int TYPE_CLOSED = 3010;
+ /**
+ * print a form using properties formField, printDevice, printParameters
+ */
+ public static final int TYPE_PRINT = 4000;
+ /**
+ * This event is sent once the async print job is done
+ */
+ public static final int TYPE_PRINTED = 4010;
+ /**
+ * When the field structure changes Examples: a field changes its "visible"
+ * property a {@link IWrappedFormField} changes its inner form a {@link IPageField} changes its table/search/detail a
+ * custom field changes
+ * in a way that the form structure is different
+ */
+ public static final int TYPE_STRUCTURE_CHANGED = 5000;
+ /**
+ * see {@link IForm#toFront()}
+ */
+ public static final int TYPE_TO_FRONT = 6000;
+ /**
+ * see {@link IForm#toBack()}
+ */
+ public static final int TYPE_TO_BACK = 6010;
+ /**
+ * see {@link IFormField#requestFocus()}
+ */
+ public static final int TYPE_REQUEST_FOCUS = 6020;
+ //next 6030
+
+ private final int m_type;
+ private IFormField m_formField;
+ private PrintDevice m_printDevice;
+ private Map<String, Object> m_printParameters;
+ private File m_printedFile;
+
+ /**
+ * A form event is sent whenever a form changes. You can register
+ * to receive such events via {@link IForm#addFormListener(FormListener)}.
+ * The form listener will get sent form events via <code>formChanged</code>.
+ * Once you implement your form listener and receive your form events, you'll
+ * probably be interested in the <b>type</b> you get via <code>getType</code>.
+ */
+ public FormEvent(IForm form, int type) {
+ super(form);
+ m_type = type;
+ }
+
+ public FormEvent(IForm form, int type, File printedFile) {
+ this(form, type);
+ m_printedFile = printedFile;
+ }
+
+ public FormEvent(IForm form, int type, IFormField causingField) {
+ super(form);
+ m_type = type;
+ m_formField = causingField;
+ }
+
+ public FormEvent(IForm form, int type, IFormField printRoot, PrintDevice printDevice, Map<String, Object> printParameters) {
+ super(form);
+ m_type = type;
+ m_formField = printRoot;
+ m_printDevice = printDevice;
+ m_printParameters = printParameters;
+ }
+
+ public IForm getForm() {
+ return (IForm) getSource();
+ }
+
+ public int getType() {
+ return m_type;
+ }
+
+ public IFormField getFormField() {
+ return m_formField;
+ }
+
+ public PrintDevice getPrintDevice() {
+ return m_printDevice;
+ }
+
+ public File getPrintedFile() {
+ return m_printedFile;
+ }
+
+ public Map<String, Object> getPrintParameters() {
+ if (m_printParameters != null) {
+ return new HashMap<String, Object>(m_printParameters);
+ }
+ else {
+ return new HashMap<String, Object>();
+ }
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer buf = new StringBuffer();
+ buf.append("DialogEvent[");
+ // decode type
+ try {
+ Field[] f = getClass().getDeclaredFields();
+ for (int i = 0; i < f.length; i++) {
+ if (Modifier.isPublic(f[i].getModifiers()) && Modifier.isStatic(f[i].getModifiers()) && f[i].getName().startsWith("TYPE_")) {
+ if (((Number) f[i].get(null)).intValue() == m_type) {
+ buf.append(f[i].getName());
+ break;
+ }
+ }
+ }
+ }
+ catch (Throwable t) {
+ buf.append("#" + m_type);
+ }
+ // dialog
+ if (getForm() != null) {
+ buf.append(" " + getForm().getFormId());
+ }
+ buf.append("]");
+ return buf.toString();
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/FormFieldInjectionThreadLocal.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/FormFieldInjectionThreadLocal.java
index d487defaaa..8257c88a31 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/FormFieldInjectionThreadLocal.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/FormFieldInjectionThreadLocal.java
@@ -1,97 +1,97 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.scout.commons.annotations.InjectFieldTo;
-import org.eclipse.scout.rt.client.ui.form.fields.AbstractFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-
-/**
- * Thread local used to inject form fields using the {@link InjectFieldTo} annotation
- * <p>
- * This thread local is used by {@link AbstractForm} and {@link AbstractFormField} to put its contributions.
- * <p>
- * The caller is responsible to call #push and #pop as in a stack manner using try...finally.
- *
- * @since 3.8.1
- */
-public final class FormFieldInjectionThreadLocal {
- private static final ThreadLocal<FormFieldInjectionThreadLocal> THREAD_LOCAL = new ThreadLocal<FormFieldInjectionThreadLocal>() {
- @Override
- protected FormFieldInjectionThreadLocal initialValue() {
- return new FormFieldInjectionThreadLocal();
- }
- };
-
- /**
- * @param injection
- * is an injection contributer fields to a container
- */
- public static void push(IFormFieldInjection injection) {
- THREAD_LOCAL.get().pushInternal(injection);
- }
-
- /**
- * @param injection
- * is an injection contributer fields to a container
- */
- public static void pop(IFormFieldInjection injection) {
- THREAD_LOCAL.get().popInternal(injection);
- }
-
- /**
- * @param container
- * is the container field that is being added potential injected fields
- * @param fieldList
- * live and mutable list of currently (configured) fields, not yet initialized
- * or added to the container field
- */
- public static void injectFields(IFormField container, List<IFormField> fieldList) {
- THREAD_LOCAL.get().injectFieldsInternal(container, fieldList);
- }
-
- private final ArrayList<IFormFieldInjection> m_stack = new ArrayList<IFormFieldInjection>();
-
- private FormFieldInjectionThreadLocal() {
- }
-
- private void pushInternal(IFormFieldInjection injection) {
- if (injection == null) {
- throw new IllegalArgumentException("injection is null");
- }
- m_stack.add(injection);
- }
-
- private void popInternal(IFormFieldInjection injection) {
- if (injection == null) {
- throw new IllegalArgumentException("injection is null");
- }
- if (m_stack.isEmpty()) {
- throw new IllegalArgumentException("push/pop asymmetry; expected nothing but got " + injection.getClass());
- }
- if (m_stack.isEmpty() || m_stack.get(m_stack.size() - 1) != injection) {
- throw new IllegalArgumentException("push/pop asymmetry; expected " + m_stack.get(m_stack.size() - 1).getClass() + " but got " + injection.getClass());
- }
- m_stack.remove(m_stack.size() - 1);
- }
-
- private void injectFieldsInternal(IFormField container, List<IFormField> fieldList) {
- if (m_stack.isEmpty()) {
- return;
- }
- for (IFormFieldInjection i : m_stack) {
- i.injectFields(container, fieldList);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.scout.commons.annotations.InjectFieldTo;
+import org.eclipse.scout.rt.client.ui.form.fields.AbstractFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+
+/**
+ * Thread local used to inject form fields using the {@link InjectFieldTo} annotation
+ * <p>
+ * This thread local is used by {@link AbstractForm} and {@link AbstractFormField} to put its contributions.
+ * <p>
+ * The caller is responsible to call #push and #pop as in a stack manner using try...finally.
+ *
+ * @since 3.8.1
+ */
+public final class FormFieldInjectionThreadLocal {
+ private static final ThreadLocal<FormFieldInjectionThreadLocal> THREAD_LOCAL = new ThreadLocal<FormFieldInjectionThreadLocal>() {
+ @Override
+ protected FormFieldInjectionThreadLocal initialValue() {
+ return new FormFieldInjectionThreadLocal();
+ }
+ };
+
+ /**
+ * @param injection
+ * is an injection contributer fields to a container
+ */
+ public static void push(IFormFieldInjection injection) {
+ THREAD_LOCAL.get().pushInternal(injection);
+ }
+
+ /**
+ * @param injection
+ * is an injection contributer fields to a container
+ */
+ public static void pop(IFormFieldInjection injection) {
+ THREAD_LOCAL.get().popInternal(injection);
+ }
+
+ /**
+ * @param container
+ * is the container field that is being added potential injected fields
+ * @param fieldList
+ * live and mutable list of currently (configured) fields, not yet initialized
+ * or added to the container field
+ */
+ public static void injectFields(IFormField container, List<IFormField> fieldList) {
+ THREAD_LOCAL.get().injectFieldsInternal(container, fieldList);
+ }
+
+ private final ArrayList<IFormFieldInjection> m_stack = new ArrayList<IFormFieldInjection>();
+
+ private FormFieldInjectionThreadLocal() {
+ }
+
+ private void pushInternal(IFormFieldInjection injection) {
+ if (injection == null) {
+ throw new IllegalArgumentException("injection is null");
+ }
+ m_stack.add(injection);
+ }
+
+ private void popInternal(IFormFieldInjection injection) {
+ if (injection == null) {
+ throw new IllegalArgumentException("injection is null");
+ }
+ if (m_stack.isEmpty()) {
+ throw new IllegalArgumentException("push/pop asymmetry; expected nothing but got " + injection.getClass());
+ }
+ if (m_stack.isEmpty() || m_stack.get(m_stack.size() - 1) != injection) {
+ throw new IllegalArgumentException("push/pop asymmetry; expected " + m_stack.get(m_stack.size() - 1).getClass() + " but got " + injection.getClass());
+ }
+ m_stack.remove(m_stack.size() - 1);
+ }
+
+ private void injectFieldsInternal(IFormField container, List<IFormField> fieldList) {
+ if (m_stack.isEmpty()) {
+ return;
+ }
+ for (IFormFieldInjection i : m_stack) {
+ i.injectFields(container, fieldList);
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/FormListener.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/FormListener.java
index fdd7e597d9..e7e307a300 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/FormListener.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/FormListener.java
@@ -1,27 +1,27 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form;
-
-import java.util.EventListener;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-
-/**
- * A form listener must implement the method {@link #formChanged}.
- * Register a listener via {@link IForm#addFormListener(FormListener)} in order to react to certain changes.
- */
-public interface FormListener extends EventListener {
- /**
- * When implementing a form listener, you will get a {@link FormEvent}.
- * Its type will tell you more about the event you're getting.
- */
- void formChanged(FormEvent e) throws ProcessingException;
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form;
+
+import java.util.EventListener;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+
+/**
+ * A form listener must implement the method {@link #formChanged}.
+ * Register a listener via {@link IForm#addFormListener(FormListener)} in order to react to certain changes.
+ */
+public interface FormListener extends EventListener {
+ /**
+ * When implementing a form listener, you will get a {@link FormEvent}.
+ * Its type will tell you more about the event you're getting.
+ */
+ void formChanged(FormEvent e) throws ProcessingException;
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/FormUtility.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/FormUtility.java
index ea583f5047..133955dd84 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/FormUtility.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/FormUtility.java
@@ -1,183 +1,183 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.ISearchForm;
-import org.eclipse.scout.rt.client.ui.form.fields.GridData;
-import org.eclipse.scout.rt.client.ui.form.fields.ICompositeField;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-
-public final class FormUtility {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(FormUtility.class);
-
- private FormUtility() {
- }
-
- /**
- * Complete the configurations of the complete field tree of the form. This
- * method is normally called by the form's constructor after the form
- * initConfig. This method is normally called before {@link #initFormFields(IForm)}.
- */
- public static void postInitConfig(IForm form) throws ProcessingException {
- PostInitConfigFieldVisitor v = new PostInitConfigFieldVisitor();
- form.visitFields(v);
- v.handleResult();
- }
-
- /**
- * Complete the configurations of the complete field tree of the form. This
- * method is normally called by the form's constructor after the form
- * initConfig and postInitConfig. This method is normally called before {@link #initFormFields(IForm)}.
- */
- public static void rebuildFieldGrid(IForm form, boolean initMainBoxGridData) throws ProcessingException {
- RebuildFieldGridVisitor v = new RebuildFieldGridVisitor();
- form.visitFields(v);
- v.handleResult();
- //
- if (initMainBoxGridData) {
- initRootBoxGridData(form, form.getRootGroupBox());
- }
- }
-
- private static void initRootBoxGridData(IForm form, ICompositeField rootBox) throws ProcessingException {
- // layout data for root group box
- GridData rootData = new GridData(rootBox.getGridDataHints());
- if (rootData.w == IFormField.FULL_WIDTH) {
- rootData.w = rootBox.getGridColumnCount();
- }
- //Legacy
- if (form instanceof ISearchForm && rootData.weightY < 0) {
- String viewId = ("" + form.getDisplayViewId()).toUpperCase();
- if (viewId.indexOf("SEARCH") >= 0 || viewId.indexOf("S") >= 0) {
- rootData.weightY = 0;
- }
- }
- rootData.x = 0;
- rootData.y = 0;
- rootBox.setGridDataInternal(rootData);
- }
-
- /**
- * Initialize the complete field tree of the form
- */
- public static void initFormFields(IForm form) throws ProcessingException {
- InitFieldVisitor v = new InitFieldVisitor();
- form.visitFields(v);
- v.handleResult();
- }
-
- /**
- * Dispose the complete field tree of the form
- */
- public static void disposeFormFields(IForm form) {
- DisposeFieldVisitor v = new DisposeFieldVisitor();
- form.visitFields(v);
- }
-
- private static class PostInitConfigFieldVisitor implements IFormFieldVisitor {
- private ProcessingException m_firstEx;
-
- @Override
- public boolean visitField(IFormField field, int level, int fieldIndex) {
- try {
- field.postInitConfig();
- }
- catch (ProcessingException e) {
- if (m_firstEx == null) {
- m_firstEx = e;
- }
- }
- catch (Throwable t) {
- if (m_firstEx == null) {
- m_firstEx = new ProcessingException("Unexpected", t);
- }
- }
- return true;
- }
-
- public void handleResult() throws ProcessingException {
- if (m_firstEx != null) {
- throw m_firstEx;
- }
- }
- }
-
- private static class RebuildFieldGridVisitor implements IFormFieldVisitor {
- private ProcessingException m_firstEx;
-
- @Override
- public boolean visitField(IFormField field, int level, int fieldIndex) {
- try {
- if (field instanceof ICompositeField) {
- ((ICompositeField) field).rebuildFieldGrid();
- }
- }
- catch (Throwable t) {
- if (m_firstEx == null) {
- m_firstEx = new ProcessingException("Unexpected", t);
- }
- }
- return true;
- }
-
- public void handleResult() throws ProcessingException {
- if (m_firstEx != null) {
- throw m_firstEx;
- }
- }
- }
-
- private static class InitFieldVisitor implements IFormFieldVisitor {
- private ProcessingException m_firstEx;
-
- @Override
- public boolean visitField(IFormField field, int level, int fieldIndex) {
- try {
- field.initField();
- }
- catch (ProcessingException e) {
- if (m_firstEx == null) {
- m_firstEx = e;
- }
- }
- catch (Throwable t) {
- if (m_firstEx == null) {
- m_firstEx = new ProcessingException("Unexpected", t);
- }
- }
- return true;
- }
-
- public void handleResult() throws ProcessingException {
- if (m_firstEx != null) {
- throw m_firstEx;
- }
- }
- }
-
- private static class DisposeFieldVisitor implements IFormFieldVisitor {
- @Override
- public boolean visitField(IFormField field, int level, int fieldIndex) {
- try {
- field.disposeField();
- }
- catch (Throwable t) {
- LOG.warn("dispose on " + field, t);
- // nop
- }
- return true;
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.ISearchForm;
+import org.eclipse.scout.rt.client.ui.form.fields.GridData;
+import org.eclipse.scout.rt.client.ui.form.fields.ICompositeField;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+
+public final class FormUtility {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(FormUtility.class);
+
+ private FormUtility() {
+ }
+
+ /**
+ * Complete the configurations of the complete field tree of the form. This
+ * method is normally called by the form's constructor after the form
+ * initConfig. This method is normally called before {@link #initFormFields(IForm)}.
+ */
+ public static void postInitConfig(IForm form) throws ProcessingException {
+ PostInitConfigFieldVisitor v = new PostInitConfigFieldVisitor();
+ form.visitFields(v);
+ v.handleResult();
+ }
+
+ /**
+ * Complete the configurations of the complete field tree of the form. This
+ * method is normally called by the form's constructor after the form
+ * initConfig and postInitConfig. This method is normally called before {@link #initFormFields(IForm)}.
+ */
+ public static void rebuildFieldGrid(IForm form, boolean initMainBoxGridData) throws ProcessingException {
+ RebuildFieldGridVisitor v = new RebuildFieldGridVisitor();
+ form.visitFields(v);
+ v.handleResult();
+ //
+ if (initMainBoxGridData) {
+ initRootBoxGridData(form, form.getRootGroupBox());
+ }
+ }
+
+ private static void initRootBoxGridData(IForm form, ICompositeField rootBox) throws ProcessingException {
+ // layout data for root group box
+ GridData rootData = new GridData(rootBox.getGridDataHints());
+ if (rootData.w == IFormField.FULL_WIDTH) {
+ rootData.w = rootBox.getGridColumnCount();
+ }
+ //Legacy
+ if (form instanceof ISearchForm && rootData.weightY < 0) {
+ String viewId = ("" + form.getDisplayViewId()).toUpperCase();
+ if (viewId.indexOf("SEARCH") >= 0 || viewId.indexOf("S") >= 0) {
+ rootData.weightY = 0;
+ }
+ }
+ rootData.x = 0;
+ rootData.y = 0;
+ rootBox.setGridDataInternal(rootData);
+ }
+
+ /**
+ * Initialize the complete field tree of the form
+ */
+ public static void initFormFields(IForm form) throws ProcessingException {
+ InitFieldVisitor v = new InitFieldVisitor();
+ form.visitFields(v);
+ v.handleResult();
+ }
+
+ /**
+ * Dispose the complete field tree of the form
+ */
+ public static void disposeFormFields(IForm form) {
+ DisposeFieldVisitor v = new DisposeFieldVisitor();
+ form.visitFields(v);
+ }
+
+ private static class PostInitConfigFieldVisitor implements IFormFieldVisitor {
+ private ProcessingException m_firstEx;
+
+ @Override
+ public boolean visitField(IFormField field, int level, int fieldIndex) {
+ try {
+ field.postInitConfig();
+ }
+ catch (ProcessingException e) {
+ if (m_firstEx == null) {
+ m_firstEx = e;
+ }
+ }
+ catch (Throwable t) {
+ if (m_firstEx == null) {
+ m_firstEx = new ProcessingException("Unexpected", t);
+ }
+ }
+ return true;
+ }
+
+ public void handleResult() throws ProcessingException {
+ if (m_firstEx != null) {
+ throw m_firstEx;
+ }
+ }
+ }
+
+ private static class RebuildFieldGridVisitor implements IFormFieldVisitor {
+ private ProcessingException m_firstEx;
+
+ @Override
+ public boolean visitField(IFormField field, int level, int fieldIndex) {
+ try {
+ if (field instanceof ICompositeField) {
+ ((ICompositeField) field).rebuildFieldGrid();
+ }
+ }
+ catch (Throwable t) {
+ if (m_firstEx == null) {
+ m_firstEx = new ProcessingException("Unexpected", t);
+ }
+ }
+ return true;
+ }
+
+ public void handleResult() throws ProcessingException {
+ if (m_firstEx != null) {
+ throw m_firstEx;
+ }
+ }
+ }
+
+ private static class InitFieldVisitor implements IFormFieldVisitor {
+ private ProcessingException m_firstEx;
+
+ @Override
+ public boolean visitField(IFormField field, int level, int fieldIndex) {
+ try {
+ field.initField();
+ }
+ catch (ProcessingException e) {
+ if (m_firstEx == null) {
+ m_firstEx = e;
+ }
+ }
+ catch (Throwable t) {
+ if (m_firstEx == null) {
+ m_firstEx = new ProcessingException("Unexpected", t);
+ }
+ }
+ return true;
+ }
+
+ public void handleResult() throws ProcessingException {
+ if (m_firstEx != null) {
+ throw m_firstEx;
+ }
+ }
+ }
+
+ private static class DisposeFieldVisitor implements IFormFieldVisitor {
+ @Override
+ public boolean visitField(IFormField field, int level, int fieldIndex) {
+ try {
+ field.disposeField();
+ }
+ catch (Throwable t) {
+ LOG.warn("dispose on " + field, t);
+ // nop
+ }
+ return true;
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/IForm.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/IForm.java
index 6b44426b4b..70d5c0a605 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/IForm.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/IForm.java
@@ -1,598 +1,598 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form;
-
-import java.security.Permission;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.scout.commons.annotations.ConfigOperation;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.beans.IPropertyFilter;
-import org.eclipse.scout.commons.beans.IPropertyObserver;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.xmlparser.SimpleXmlElement;
-import org.eclipse.scout.rt.client.ui.IEventHistory;
-import org.eclipse.scout.rt.client.ui.desktop.AbstractDesktop;
-import org.eclipse.scout.rt.client.ui.desktop.DesktopEvent;
-import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
-import org.eclipse.scout.rt.client.ui.form.fields.AbstractValueField;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox;
-import org.eclipse.scout.rt.client.ui.form.fields.wrappedform.IWrappedFormField;
-import org.eclipse.scout.rt.client.ui.wizard.IWizard;
-import org.eclipse.scout.rt.client.ui.wizard.IWizardStep;
-import org.eclipse.scout.rt.shared.data.form.AbstractFormData;
-import org.eclipse.scout.rt.shared.services.common.jdbc.SearchFilter;
-
-/**
- * A form is the model used for anything containing fields: a dialog, a step
- * of a wizard, the details of a page, a search. Each form is represented by
- * a class.
- * A form has fields, buttons, and handlers. These elements
- * are all part of the same class, they are <b>inner classes</b> of the form.
- * <p>
- * A <b>field</b> is where you enter data: a string, a number, a date, a list of values. A <b>button</b> is where you
- * trigger actions: save data, cancel whatever you are doing, go on to the next or return to the previous step. A
- * <b>handler</b> is reponsible for loading from data and storing data. This usually involves calling process services
- * on the server. These will in turn contact a persistence layer such as a database.
- */
-public interface IForm extends IPropertyObserver {
-
- String PROP_TITLE = "title";
- String PROP_MINIMIZE_ENABLED = "minimizeEnabled";
- String PROP_MAXIMIZE_ENABLED = "maximizeEnabled";
- String PROP_MINIMIZED = "minimized";
- String PROP_MAXIMIZED = "maximized";
- String PROP_EMPTY = "empty";
- String PROP_SAVE_NEEDED = "saveNeeded";
- String PROP_ICON_ID = "iconId";
- String PROP_PERSPECTIVE_ID = "perspectiveId";
-
- /**
- * Standalone window<br>
- * Swing: modal -> JDialog, nonmodal -> JFrame<br>
- * SWT: modal -> Dialog, nonmodal -> Dialog, Wizard Dialog
- */
- int DISPLAY_HINT_DIALOG = 0;
- /**
- * Popup view is a popup window that is automatically closed when mouse clicks outside of popup<br>
- * Swing: JPopup<br>
- * SWT: Window+Shell
- */
- int DISPLAY_HINT_POPUP_WINDOW = 10;
- /**
- * Popup dialog is a normal dialog, but placement is at the focus owner location instead of default dialog position
- * Swing: JPopup<br>
- * SWT: Window+Shell
- */
- int DISPLAY_HINT_POPUP_DIALOG = 12;
- /**
- * Inline view<br>
- * Swing: JInternalFrame<br>
- * SWT: View, Editor, , Wizard Editor
- */
- int DISPLAY_HINT_VIEW = 20;
-
- String VIEW_ID_N = "N";
- String VIEW_ID_NE = "NE";
- String VIEW_ID_E = "E";
- String VIEW_ID_SE = "SE";
- String VIEW_ID_S = "S";
- String VIEW_ID_SW = "SW";
- String VIEW_ID_W = "W";
- String VIEW_ID_NW = "NW";
- String VIEW_ID_CENTER = "C";
- String VIEW_ID_OUTLINE = "OUTLINE";
- String VIEW_ID_OUTLINE_SELECTOR = "OUTLINE_SELECTOR";
- String VIEW_ID_PAGE_DETAIL = "PAGE_DETAIL";
- String VIEW_ID_PAGE_SEARCH = "PAGE_SEARCH";
- String VIEW_ID_PAGE_TABLE = "PAGE_TABLE";
-
- String EDITOR_ID = "EDITOR";
-
- /**
- * Initialize the form and all of its fields.
- * By default any of the #start* methods of the form call this method
- */
- void initForm() throws ProcessingException;
-
- /**
- * This method is called to get an exclusive key of the form. The key is used
- * to open the same form with the same handler only once. Obviously this
- * behavior can only be used for view forms.
- *
- * @see AbstractDesktop#getSimilarViewForms(IForm)
- * @return null for exclusive form behavior an exclusive key to ensure similar
- * handling.
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(5)
- Object computeExclusiveKey() throws ProcessingException;
-
- /*
- * Runtime
- */
- void setEnabledPermission(Permission p);
-
- /**
- * Activate the form in terms of UI visibility / focus target<br>
- * This will send a desktop event {@link DesktopEvent#TYPE_FORM_ENSURE_VISIBLE}
- */
- void activate();
-
- /**
- * Puts the form to front in terms of UI visibility<br>
- * This will send a desktop event {@link FormEvent#TYPE_TO_FRONT}
- *
- * @since 06.07.2009
- */
- void toFront();
-
- /**
- * Puts the form to back in terms of UI visibility<br>
- * This will send a desktop event {@link FormEvent#TYPE_TO_BACK}
- */
- void toBack();
-
- boolean isEnabledGranted();
-
- void setEnabledGranted(boolean b);
-
- void setVisiblePermission(Permission p);
-
- boolean isVisibleGranted();
-
- void setVisibleGranted(boolean b);
-
- String getFormId();
-
- IFormHandler getHandler();
-
- void setHandler(IFormHandler handler);
-
- String getIconId();
-
- void setIconId(String s);
-
- String getPerspectiveId();
-
- void setPerspectiveId(String s);
-
- /**
- * @return the {@link IWizard} that contains the step that started this form
- * using startWizardStep
- */
- IWizard getWizard();
-
- /**
- * @return the {@link IWizardStep} that started this form using
- * startWizardStep
- */
- IWizardStep getWizardStep();
-
- /**
- * @param wizardStep
- * the step that starts this form
- * @param handlerType
- * the inner handler type used to load / store the form, null when no
- * automatic load/store should be performed
- */
- void startWizardStep(IWizardStep wizardStep, Class<? extends IFormHandler> handlerType) throws ProcessingException;
-
- /**
- * @return true if the form is currently attached to the desktop, false if the
- * form is not attached to the desktop<br>
- * This method can be used to determine if a possibly active form
- * (started with a running form handler) is currently showing on the
- * desktop.
- */
- boolean isShowing();
-
- /**
- * @return true if the form is not (yet) started with a form handler and
- * therefore not active
- */
- boolean isFormClosed();
-
- /**
- * @return true if the form is started with a form handler and therefore
- * active
- */
- boolean isFormOpen();
-
- /**
- * true while the {@link IFormHandler#execLoad()} method is running<br>
- * this is often used in {@link AbstractValueField#execChangedValue()}
- */
- boolean isFormLoading();
-
- /**
- * fill a FormData structure to be sent to the backend<br>
- * the configurator is creating typed subclasses of FormData and FormFieldData
- */
- void exportFormData(AbstractFormData target) throws ProcessingException;
-
- /**
- * apply FormData to this form
- */
- void importFormData(AbstractFormData source) throws ProcessingException;
-
- /**
- * apply FormData to this form<br>
- * value triggers can be deactivated if necessary
- */
- void importFormData(AbstractFormData source, boolean valueChangeTriggersEnabled, IPropertyFilter filter) throws ProcessingException;
-
- /**
- * @return the {@link IFormField} that owns the focus AND is inside this form.<br>
- * In order to get the global focus owner, use {@link IDesktop#getFocusOwner()}.
- */
- IFormField getFocusOwner();
-
- /**
- * traverse all fields recursive and return them as a list
- */
- IFormField[] getAllFields();
-
- List<? extends IFormField> getInvalidFields();
-
- void validateForm() throws ProcessingException;
-
- boolean visitFields(IFormFieldVisitor visitor);
-
- IGroupBox getRootGroupBox();
-
- /**
- * @return the outer form if this form is inside a {@link IWrappedFormField}
- */
- IForm getOuterForm();
-
- /**
- * @return the outer form field if this form is inside a {@link IWrappedFormField}
- */
- IWrappedFormField getOuterFormField();
-
- /**
- * When a form is set as the inner form of a {@link IWrappedFormField}<br>
- * Do not use this internal method directly, it is automatically called by
- * {@link IWrappedFormField#setInnerForm(IForm)}
- */
- void setWrapperFieldInternal(IWrappedFormField w);
-
- /**
- * the field ID is the simple class name of a field without the suffixes
- * "Box", "Field", "Button"
- */
- IFormField getFieldById(final String id);
-
- /**
- * the field ID is the simple class name of a field without the suffixes
- * "Box", "Field", "Button"
- * The field must be equal or a subtype of type
- */
- <T extends IFormField> T getFieldById(String id, Class<T> type);
-
- /**
- * @return the field with the exact type c in the subtree
- */
- <T extends IFormField> T getFieldByClass(Class<T> c);
-
- /**
- * see {@link FormEvent#TYPE_STRUCTURE_CHANGED}
- */
- void structureChanged(IFormField causingField);
-
- void doClose() throws ProcessingException;
-
- void doCancel() throws ProcessingException;
-
- /**
- * Save data and close the form.
- */
- void doOk() throws ProcessingException;
-
- /**
- * Validate the form, save it, and make all fields as saved.
- * The net result is that calling this method again on the unchanged form
- * will revalidate it, but will no longer save it.
- */
- void doSave() throws ProcessingException;
-
- /**
- * similar to {@link #doSave()} but do NOT set fields to state {@link #isSaveNeeded()}=false
- */
- void doSaveWithoutMarkerChange() throws ProcessingException;
-
- void doReset();
-
- void doFinally();
-
- void doExportXml(boolean saveAs);
-
- void doImportXml();
-
- /**
- * Property is true by default.<br>
- * This automatically calls {@link org.eclipse.scout.rt.client.ui.desktop.IDesktop#addForm(IForm)} when
- * the form is started.<br>
- * When using forms inside pages such as
- * {@link org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage#setDetailForm(IForm)} and
- * {@link org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable#getConfiguredSearchForm()} then this
- * flag is set to false, because then the form should not be
- * displayed unless the page it is contained in is activated. This activation
- * will then call {@link org.eclipse.scout.rt.client.ui.desktop.IDesktop#addForm(IForm)}
- */
- boolean isAutoAddRemoveOnDesktop();
-
- /**
- * @see #isAutoAddRemoveOnDesktop()
- */
- void setAutoAddRemoveOnDesktop(boolean b);
-
- void setCloseTimer(int seconds);
-
- void removeCloseTimer();
-
- void setTimer(String timerId, int seconds);
-
- void removeTimer(String timerId);
-
- void setAllEnabled(boolean b);
-
- String getCancelVerificationText();
-
- void setCancelVerificationText(String text);
-
- /**
- * Determine whether a save is needed for the form.
- */
- boolean isSaveNeeded();
-
- /**
- * this method calls execCheckSaveNeeded on every field<br>
- * to ensure that {@link #isSaveNeeded()} returns the correct value
- */
- void checkSaveNeeded();
-
- /**
- * Mark the form as saved so that a save is no longer needed.
- */
- void markSaved();
-
- /**
- * Touch the form so so that a save is needed.
- */
- void touch();
-
- boolean isEmpty();
-
- String getBasicTitle();
-
- void setBasicTitle(String basicTitle);
-
- String getSubTitle();
-
- void setSubTitle(String subTitle);
-
- /**
- * The system button (type) that triggered the save
- *
- * @see IButton.SYSTEM_TYPE_...
- */
- int getCloseSystemType();
-
- void setCloseSystemType(int saveType);
-
- String getTitle();
-
- void setTitle(String s);
-
- /**
- * UI hint that gui should be maximized
- */
- boolean isMaximized();
-
- void setMaximized(boolean b);
-
- boolean isMaximizeEnabled();
-
- void setMaximizeEnabled(boolean b);
-
- /**
- * UI hint that gui should be minimized
- */
- boolean isMinimized();
-
- void setMinimized(boolean b);
-
- boolean isMinimizeEnabled();
-
- void setMinimizeEnabled(boolean b);
-
- boolean isModal();
-
- void setModal(boolean modal);
-
- void setCacheBounds(boolean cacheBounds);
-
- boolean isCacheBounds();
-
- /**
- * Computes a key which is used when saving the bounds of the form.
- *
- * @return a key to distinguish the forms. It must not be null.
- */
- String computeCacheBoundsKey();
-
- /**
- * @return one of the DISPLAY_HINT_* constants or a custom value
- */
- int getDisplayHint();
-
- /**
- * use one ofe the DISPLAY_HINT constants or a custom value
- */
- void setDisplayHint(int i);
-
- /**
- * @return one of the VIEW_ID_* constants or a custom text
- */
- String getDisplayViewId();
-
- /**
- * use one ofe the VIEW_ID_ constants or a custom text
- */
- void setDisplayViewId(String viewId);
-
- boolean isAskIfNeedSave();
-
- void setAskIfNeedSave(boolean b);
-
- boolean isButtonsArmed();
-
- void setButtonsArmed(boolean b);
-
- boolean isCloseTimerArmed();
-
- void setCloseTimerArmed(boolean b);
-
- /**
- * marker property to signal that the form changed some data (using services,
- * backend)<br>
- * property is normally used after the form handler is returned
- */
- boolean isFormStored();
-
- /**
- * marker property to signal that the form changed some data (using services,
- * backend)<br>
- * this property is automatically set whenever the form has called the
- * handlers execStore (disregarding whether this was successful or not)
- */
- void setFormStored(boolean b);
-
- /**
- * @deprecated Use {@link #getProperty(String)} instead.
- */
- @Deprecated
- Object getCustomProperty(String propName);
-
- /**
- * @deprecated Use {@link #setProperty(String, Object)} instead.
- */
- @Deprecated
- void setCustomProperty(String propName, Object o);
-
- Object getProperty(String name);
-
- /**
- * With this method it's possible to set (custom) properties.
- * <p>
- * <b>Important: </b> Although this method is intended to be used for custom properties, it's actually possible to
- * change main properties as well. Keep in mind that directly changing main properties may result in unexpected
- * behavior, so do it only if you really know what you are doing. Rather use the officially provided api instead. <br>
- * Example for an unexpected behavior: setVisible() does not only set the property PROP_VISIBLE but also executes
- * additional code. This code would NOT be executed by directly setting the property PROP_VISIBLE with setProperty().
- */
- void setProperty(String name, Object value);
-
- boolean hasProperty(String name);
-
- /**
- * XML export/import of form state
- */
- void setXML(String xml) throws ProcessingException;
-
- String getXML(String encoding) throws ProcessingException;
-
- SimpleXmlElement storeXML() throws ProcessingException;
-
- void storeXML(SimpleXmlElement root) throws ProcessingException;
-
- void loadXML(SimpleXmlElement root) throws ProcessingException;
-
- /**
- * Wait until form is closed<br>
- * If the form is modal this method returns just after the modal handler has
- * terminated<br>
- * If the form is non-modal this starts a sub event dispatcher that loops (and
- * blocks) until form handling is false (i.e. form has been closed)
- */
- void waitFor() throws ProcessingException;
-
- int WAIT_FOR_ERROR_CODE = 69218;
-
- /**
- * reset, create, validate the search model that contains the form data, verbose search texts and a valid status
- * see {@link SearchFilter#clear()} see {@link #doSaveWithoutMarkerChange()} is also resetting the search model
- */
- void resetSearchFilter();
-
- /**
- * @return life reference to the filter (never null)<br>
- * For search filter validity check {@link SearchFilter#isCompleted()} in combination with
- * {@link org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable#isSearchRequired()}
- */
- SearchFilter getSearchFilter();
-
- void setSearchFilter(SearchFilter filter);
-
- /**
- * Prints the form<br>
- * <p>
- * The method returns immediately, the print is done int the background.
- * <p>
- * For details and parameter details see {@link PrintDevice}
- */
- void printForm(PrintDevice device, Map<String, Object> parameters);
-
- /**
- * Prints a form field<br>
- * <p>
- * The method returns immediately, the print is done int the background.
- * <p>
- * For details and parameter details see {@link PrintDevice}
- */
- void printField(IFormField field, PrintDevice device, Map<String, Object> parameters);
-
- /**
- * Request focus for the field by sending a {@link FormEvent#TYPE_REQUEST_FOCUS} event
- */
- void requestFocus(IFormField f);
-
- /**
- * Add a {@link FormListener}. These listeners will be called
- * when the form is activated, closed, discared, before loading,
- * after loading, before storing, after storing, when the structure changes, when it is
- * printed, etc.
- */
- void addFormListener(FormListener listener);
-
- /**
- * Remove a {@link FormListener} that was added to the form before.
- */
- void removeFormListener(FormListener listener);
-
- /**
- * @return the {@link IEventHistory} associated with this form
- * <p>
- * The default implementation is a {@link DefaultFormEventHistory} and created by
- * {@link AbstractForm#createEventHistory()}
- * <p>
- * This method is thread safe.
- * @since 3.8
- */
- IEventHistory<FormEvent> getEventHistory();
-
- IFormUIFacade getUIFacade();
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form;
+
+import java.security.Permission;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.scout.commons.annotations.ConfigOperation;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.beans.IPropertyFilter;
+import org.eclipse.scout.commons.beans.IPropertyObserver;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.xmlparser.SimpleXmlElement;
+import org.eclipse.scout.rt.client.ui.IEventHistory;
+import org.eclipse.scout.rt.client.ui.desktop.AbstractDesktop;
+import org.eclipse.scout.rt.client.ui.desktop.DesktopEvent;
+import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
+import org.eclipse.scout.rt.client.ui.form.fields.AbstractValueField;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox;
+import org.eclipse.scout.rt.client.ui.form.fields.wrappedform.IWrappedFormField;
+import org.eclipse.scout.rt.client.ui.wizard.IWizard;
+import org.eclipse.scout.rt.client.ui.wizard.IWizardStep;
+import org.eclipse.scout.rt.shared.data.form.AbstractFormData;
+import org.eclipse.scout.rt.shared.services.common.jdbc.SearchFilter;
+
+/**
+ * A form is the model used for anything containing fields: a dialog, a step
+ * of a wizard, the details of a page, a search. Each form is represented by
+ * a class.
+ * A form has fields, buttons, and handlers. These elements
+ * are all part of the same class, they are <b>inner classes</b> of the form.
+ * <p>
+ * A <b>field</b> is where you enter data: a string, a number, a date, a list of values. A <b>button</b> is where you
+ * trigger actions: save data, cancel whatever you are doing, go on to the next or return to the previous step. A
+ * <b>handler</b> is reponsible for loading from data and storing data. This usually involves calling process services
+ * on the server. These will in turn contact a persistence layer such as a database.
+ */
+public interface IForm extends IPropertyObserver {
+
+ String PROP_TITLE = "title";
+ String PROP_MINIMIZE_ENABLED = "minimizeEnabled";
+ String PROP_MAXIMIZE_ENABLED = "maximizeEnabled";
+ String PROP_MINIMIZED = "minimized";
+ String PROP_MAXIMIZED = "maximized";
+ String PROP_EMPTY = "empty";
+ String PROP_SAVE_NEEDED = "saveNeeded";
+ String PROP_ICON_ID = "iconId";
+ String PROP_PERSPECTIVE_ID = "perspectiveId";
+
+ /**
+ * Standalone window<br>
+ * Swing: modal -> JDialog, nonmodal -> JFrame<br>
+ * SWT: modal -> Dialog, nonmodal -> Dialog, Wizard Dialog
+ */
+ int DISPLAY_HINT_DIALOG = 0;
+ /**
+ * Popup view is a popup window that is automatically closed when mouse clicks outside of popup<br>
+ * Swing: JPopup<br>
+ * SWT: Window+Shell
+ */
+ int DISPLAY_HINT_POPUP_WINDOW = 10;
+ /**
+ * Popup dialog is a normal dialog, but placement is at the focus owner location instead of default dialog position
+ * Swing: JPopup<br>
+ * SWT: Window+Shell
+ */
+ int DISPLAY_HINT_POPUP_DIALOG = 12;
+ /**
+ * Inline view<br>
+ * Swing: JInternalFrame<br>
+ * SWT: View, Editor, , Wizard Editor
+ */
+ int DISPLAY_HINT_VIEW = 20;
+
+ String VIEW_ID_N = "N";
+ String VIEW_ID_NE = "NE";
+ String VIEW_ID_E = "E";
+ String VIEW_ID_SE = "SE";
+ String VIEW_ID_S = "S";
+ String VIEW_ID_SW = "SW";
+ String VIEW_ID_W = "W";
+ String VIEW_ID_NW = "NW";
+ String VIEW_ID_CENTER = "C";
+ String VIEW_ID_OUTLINE = "OUTLINE";
+ String VIEW_ID_OUTLINE_SELECTOR = "OUTLINE_SELECTOR";
+ String VIEW_ID_PAGE_DETAIL = "PAGE_DETAIL";
+ String VIEW_ID_PAGE_SEARCH = "PAGE_SEARCH";
+ String VIEW_ID_PAGE_TABLE = "PAGE_TABLE";
+
+ String EDITOR_ID = "EDITOR";
+
+ /**
+ * Initialize the form and all of its fields.
+ * By default any of the #start* methods of the form call this method
+ */
+ void initForm() throws ProcessingException;
+
+ /**
+ * This method is called to get an exclusive key of the form. The key is used
+ * to open the same form with the same handler only once. Obviously this
+ * behavior can only be used for view forms.
+ *
+ * @see AbstractDesktop#getSimilarViewForms(IForm)
+ * @return null for exclusive form behavior an exclusive key to ensure similar
+ * handling.
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(5)
+ Object computeExclusiveKey() throws ProcessingException;
+
+ /*
+ * Runtime
+ */
+ void setEnabledPermission(Permission p);
+
+ /**
+ * Activate the form in terms of UI visibility / focus target<br>
+ * This will send a desktop event {@link DesktopEvent#TYPE_FORM_ENSURE_VISIBLE}
+ */
+ void activate();
+
+ /**
+ * Puts the form to front in terms of UI visibility<br>
+ * This will send a desktop event {@link FormEvent#TYPE_TO_FRONT}
+ *
+ * @since 06.07.2009
+ */
+ void toFront();
+
+ /**
+ * Puts the form to back in terms of UI visibility<br>
+ * This will send a desktop event {@link FormEvent#TYPE_TO_BACK}
+ */
+ void toBack();
+
+ boolean isEnabledGranted();
+
+ void setEnabledGranted(boolean b);
+
+ void setVisiblePermission(Permission p);
+
+ boolean isVisibleGranted();
+
+ void setVisibleGranted(boolean b);
+
+ String getFormId();
+
+ IFormHandler getHandler();
+
+ void setHandler(IFormHandler handler);
+
+ String getIconId();
+
+ void setIconId(String s);
+
+ String getPerspectiveId();
+
+ void setPerspectiveId(String s);
+
+ /**
+ * @return the {@link IWizard} that contains the step that started this form
+ * using startWizardStep
+ */
+ IWizard getWizard();
+
+ /**
+ * @return the {@link IWizardStep} that started this form using
+ * startWizardStep
+ */
+ IWizardStep getWizardStep();
+
+ /**
+ * @param wizardStep
+ * the step that starts this form
+ * @param handlerType
+ * the inner handler type used to load / store the form, null when no
+ * automatic load/store should be performed
+ */
+ void startWizardStep(IWizardStep wizardStep, Class<? extends IFormHandler> handlerType) throws ProcessingException;
+
+ /**
+ * @return true if the form is currently attached to the desktop, false if the
+ * form is not attached to the desktop<br>
+ * This method can be used to determine if a possibly active form
+ * (started with a running form handler) is currently showing on the
+ * desktop.
+ */
+ boolean isShowing();
+
+ /**
+ * @return true if the form is not (yet) started with a form handler and
+ * therefore not active
+ */
+ boolean isFormClosed();
+
+ /**
+ * @return true if the form is started with a form handler and therefore
+ * active
+ */
+ boolean isFormOpen();
+
+ /**
+ * true while the {@link IFormHandler#execLoad()} method is running<br>
+ * this is often used in {@link AbstractValueField#execChangedValue()}
+ */
+ boolean isFormLoading();
+
+ /**
+ * fill a FormData structure to be sent to the backend<br>
+ * the configurator is creating typed subclasses of FormData and FormFieldData
+ */
+ void exportFormData(AbstractFormData target) throws ProcessingException;
+
+ /**
+ * apply FormData to this form
+ */
+ void importFormData(AbstractFormData source) throws ProcessingException;
+
+ /**
+ * apply FormData to this form<br>
+ * value triggers can be deactivated if necessary
+ */
+ void importFormData(AbstractFormData source, boolean valueChangeTriggersEnabled, IPropertyFilter filter) throws ProcessingException;
+
+ /**
+ * @return the {@link IFormField} that owns the focus AND is inside this form.<br>
+ * In order to get the global focus owner, use {@link IDesktop#getFocusOwner()}.
+ */
+ IFormField getFocusOwner();
+
+ /**
+ * traverse all fields recursive and return them as a list
+ */
+ IFormField[] getAllFields();
+
+ List<? extends IFormField> getInvalidFields();
+
+ void validateForm() throws ProcessingException;
+
+ boolean visitFields(IFormFieldVisitor visitor);
+
+ IGroupBox getRootGroupBox();
+
+ /**
+ * @return the outer form if this form is inside a {@link IWrappedFormField}
+ */
+ IForm getOuterForm();
+
+ /**
+ * @return the outer form field if this form is inside a {@link IWrappedFormField}
+ */
+ IWrappedFormField getOuterFormField();
+
+ /**
+ * When a form is set as the inner form of a {@link IWrappedFormField}<br>
+ * Do not use this internal method directly, it is automatically called by
+ * {@link IWrappedFormField#setInnerForm(IForm)}
+ */
+ void setWrapperFieldInternal(IWrappedFormField w);
+
+ /**
+ * the field ID is the simple class name of a field without the suffixes
+ * "Box", "Field", "Button"
+ */
+ IFormField getFieldById(final String id);
+
+ /**
+ * the field ID is the simple class name of a field without the suffixes
+ * "Box", "Field", "Button"
+ * The field must be equal or a subtype of type
+ */
+ <T extends IFormField> T getFieldById(String id, Class<T> type);
+
+ /**
+ * @return the field with the exact type c in the subtree
+ */
+ <T extends IFormField> T getFieldByClass(Class<T> c);
+
+ /**
+ * see {@link FormEvent#TYPE_STRUCTURE_CHANGED}
+ */
+ void structureChanged(IFormField causingField);
+
+ void doClose() throws ProcessingException;
+
+ void doCancel() throws ProcessingException;
+
+ /**
+ * Save data and close the form.
+ */
+ void doOk() throws ProcessingException;
+
+ /**
+ * Validate the form, save it, and make all fields as saved.
+ * The net result is that calling this method again on the unchanged form
+ * will revalidate it, but will no longer save it.
+ */
+ void doSave() throws ProcessingException;
+
+ /**
+ * similar to {@link #doSave()} but do NOT set fields to state {@link #isSaveNeeded()}=false
+ */
+ void doSaveWithoutMarkerChange() throws ProcessingException;
+
+ void doReset();
+
+ void doFinally();
+
+ void doExportXml(boolean saveAs);
+
+ void doImportXml();
+
+ /**
+ * Property is true by default.<br>
+ * This automatically calls {@link org.eclipse.scout.rt.client.ui.desktop.IDesktop#addForm(IForm)} when
+ * the form is started.<br>
+ * When using forms inside pages such as
+ * {@link org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage#setDetailForm(IForm)} and
+ * {@link org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable#getConfiguredSearchForm()} then this
+ * flag is set to false, because then the form should not be
+ * displayed unless the page it is contained in is activated. This activation
+ * will then call {@link org.eclipse.scout.rt.client.ui.desktop.IDesktop#addForm(IForm)}
+ */
+ boolean isAutoAddRemoveOnDesktop();
+
+ /**
+ * @see #isAutoAddRemoveOnDesktop()
+ */
+ void setAutoAddRemoveOnDesktop(boolean b);
+
+ void setCloseTimer(int seconds);
+
+ void removeCloseTimer();
+
+ void setTimer(String timerId, int seconds);
+
+ void removeTimer(String timerId);
+
+ void setAllEnabled(boolean b);
+
+ String getCancelVerificationText();
+
+ void setCancelVerificationText(String text);
+
+ /**
+ * Determine whether a save is needed for the form.
+ */
+ boolean isSaveNeeded();
+
+ /**
+ * this method calls execCheckSaveNeeded on every field<br>
+ * to ensure that {@link #isSaveNeeded()} returns the correct value
+ */
+ void checkSaveNeeded();
+
+ /**
+ * Mark the form as saved so that a save is no longer needed.
+ */
+ void markSaved();
+
+ /**
+ * Touch the form so so that a save is needed.
+ */
+ void touch();
+
+ boolean isEmpty();
+
+ String getBasicTitle();
+
+ void setBasicTitle(String basicTitle);
+
+ String getSubTitle();
+
+ void setSubTitle(String subTitle);
+
+ /**
+ * The system button (type) that triggered the save
+ *
+ * @see IButton.SYSTEM_TYPE_...
+ */
+ int getCloseSystemType();
+
+ void setCloseSystemType(int saveType);
+
+ String getTitle();
+
+ void setTitle(String s);
+
+ /**
+ * UI hint that gui should be maximized
+ */
+ boolean isMaximized();
+
+ void setMaximized(boolean b);
+
+ boolean isMaximizeEnabled();
+
+ void setMaximizeEnabled(boolean b);
+
+ /**
+ * UI hint that gui should be minimized
+ */
+ boolean isMinimized();
+
+ void setMinimized(boolean b);
+
+ boolean isMinimizeEnabled();
+
+ void setMinimizeEnabled(boolean b);
+
+ boolean isModal();
+
+ void setModal(boolean modal);
+
+ void setCacheBounds(boolean cacheBounds);
+
+ boolean isCacheBounds();
+
+ /**
+ * Computes a key which is used when saving the bounds of the form.
+ *
+ * @return a key to distinguish the forms. It must not be null.
+ */
+ String computeCacheBoundsKey();
+
+ /**
+ * @return one of the DISPLAY_HINT_* constants or a custom value
+ */
+ int getDisplayHint();
+
+ /**
+ * use one ofe the DISPLAY_HINT constants or a custom value
+ */
+ void setDisplayHint(int i);
+
+ /**
+ * @return one of the VIEW_ID_* constants or a custom text
+ */
+ String getDisplayViewId();
+
+ /**
+ * use one ofe the VIEW_ID_ constants or a custom text
+ */
+ void setDisplayViewId(String viewId);
+
+ boolean isAskIfNeedSave();
+
+ void setAskIfNeedSave(boolean b);
+
+ boolean isButtonsArmed();
+
+ void setButtonsArmed(boolean b);
+
+ boolean isCloseTimerArmed();
+
+ void setCloseTimerArmed(boolean b);
+
+ /**
+ * marker property to signal that the form changed some data (using services,
+ * backend)<br>
+ * property is normally used after the form handler is returned
+ */
+ boolean isFormStored();
+
+ /**
+ * marker property to signal that the form changed some data (using services,
+ * backend)<br>
+ * this property is automatically set whenever the form has called the
+ * handlers execStore (disregarding whether this was successful or not)
+ */
+ void setFormStored(boolean b);
+
+ /**
+ * @deprecated Use {@link #getProperty(String)} instead.
+ */
+ @Deprecated
+ Object getCustomProperty(String propName);
+
+ /**
+ * @deprecated Use {@link #setProperty(String, Object)} instead.
+ */
+ @Deprecated
+ void setCustomProperty(String propName, Object o);
+
+ Object getProperty(String name);
+
+ /**
+ * With this method it's possible to set (custom) properties.
+ * <p>
+ * <b>Important: </b> Although this method is intended to be used for custom properties, it's actually possible to
+ * change main properties as well. Keep in mind that directly changing main properties may result in unexpected
+ * behavior, so do it only if you really know what you are doing. Rather use the officially provided api instead. <br>
+ * Example for an unexpected behavior: setVisible() does not only set the property PROP_VISIBLE but also executes
+ * additional code. This code would NOT be executed by directly setting the property PROP_VISIBLE with setProperty().
+ */
+ void setProperty(String name, Object value);
+
+ boolean hasProperty(String name);
+
+ /**
+ * XML export/import of form state
+ */
+ void setXML(String xml) throws ProcessingException;
+
+ String getXML(String encoding) throws ProcessingException;
+
+ SimpleXmlElement storeXML() throws ProcessingException;
+
+ void storeXML(SimpleXmlElement root) throws ProcessingException;
+
+ void loadXML(SimpleXmlElement root) throws ProcessingException;
+
+ /**
+ * Wait until form is closed<br>
+ * If the form is modal this method returns just after the modal handler has
+ * terminated<br>
+ * If the form is non-modal this starts a sub event dispatcher that loops (and
+ * blocks) until form handling is false (i.e. form has been closed)
+ */
+ void waitFor() throws ProcessingException;
+
+ int WAIT_FOR_ERROR_CODE = 69218;
+
+ /**
+ * reset, create, validate the search model that contains the form data, verbose search texts and a valid status
+ * see {@link SearchFilter#clear()} see {@link #doSaveWithoutMarkerChange()} is also resetting the search model
+ */
+ void resetSearchFilter();
+
+ /**
+ * @return life reference to the filter (never null)<br>
+ * For search filter validity check {@link SearchFilter#isCompleted()} in combination with
+ * {@link org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable#isSearchRequired()}
+ */
+ SearchFilter getSearchFilter();
+
+ void setSearchFilter(SearchFilter filter);
+
+ /**
+ * Prints the form<br>
+ * <p>
+ * The method returns immediately, the print is done int the background.
+ * <p>
+ * For details and parameter details see {@link PrintDevice}
+ */
+ void printForm(PrintDevice device, Map<String, Object> parameters);
+
+ /**
+ * Prints a form field<br>
+ * <p>
+ * The method returns immediately, the print is done int the background.
+ * <p>
+ * For details and parameter details see {@link PrintDevice}
+ */
+ void printField(IFormField field, PrintDevice device, Map<String, Object> parameters);
+
+ /**
+ * Request focus for the field by sending a {@link FormEvent#TYPE_REQUEST_FOCUS} event
+ */
+ void requestFocus(IFormField f);
+
+ /**
+ * Add a {@link FormListener}. These listeners will be called
+ * when the form is activated, closed, discared, before loading,
+ * after loading, before storing, after storing, when the structure changes, when it is
+ * printed, etc.
+ */
+ void addFormListener(FormListener listener);
+
+ /**
+ * Remove a {@link FormListener} that was added to the form before.
+ */
+ void removeFormListener(FormListener listener);
+
+ /**
+ * @return the {@link IEventHistory} associated with this form
+ * <p>
+ * The default implementation is a {@link DefaultFormEventHistory} and created by
+ * {@link AbstractForm#createEventHistory()}
+ * <p>
+ * This method is thread safe.
+ * @since 3.8
+ */
+ IEventHistory<FormEvent> getEventHistory();
+
+ IFormUIFacade getUIFacade();
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/IFormFieldInjection.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/IFormFieldInjection.java
index 0eb6973499..45ab0ad1b0 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/IFormFieldInjection.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/IFormFieldInjection.java
@@ -1,36 +1,36 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form;
-
-import java.util.List;
-
-import org.eclipse.scout.commons.annotations.InjectFieldTo;
-import org.eclipse.scout.rt.client.ui.form.fields.AbstractCompositeField;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-
-/**
- * Instances of this interface are used with FormFieldInjectionThreadLocal to define a context within form fields are
- * created. {@link AbstractForm} and {@link AbstractCompositeField} use this mechanism to contribute fields using the
- * {@link InjectFieldTo} annotation.
- *
- * @since 3.8.1
- */
-public interface IFormFieldInjection {
- /**
- * @param container
- * is the container field that is being added potential injected fields
- * @param fieldList
- * live and mutable list of currently (configured) fields, not yet initialized
- * or added to the container field
- */
- void injectFields(IFormField container, List<IFormField> fieldList);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form;
+
+import java.util.List;
+
+import org.eclipse.scout.commons.annotations.InjectFieldTo;
+import org.eclipse.scout.rt.client.ui.form.fields.AbstractCompositeField;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+
+/**
+ * Instances of this interface are used with FormFieldInjectionThreadLocal to define a context within form fields are
+ * created. {@link AbstractForm} and {@link AbstractCompositeField} use this mechanism to contribute fields using the
+ * {@link InjectFieldTo} annotation.
+ *
+ * @since 3.8.1
+ */
+public interface IFormFieldInjection {
+ /**
+ * @param container
+ * is the container field that is being added potential injected fields
+ * @param fieldList
+ * live and mutable list of currently (configured) fields, not yet initialized
+ * or added to the container field
+ */
+ void injectFields(IFormField container, List<IFormField> fieldList);
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/IFormFieldVisitor.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/IFormFieldVisitor.java
index a1b7bd827b..a2bbbaa15c 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/IFormFieldVisitor.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/IFormFieldVisitor.java
@@ -1,17 +1,17 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form;
-
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-
-public interface IFormFieldVisitor {
- boolean visitField(IFormField field, int level, int fieldIndex);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form;
+
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+
+public interface IFormFieldVisitor {
+ boolean visitField(IFormField field, int level, int fieldIndex);
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/IFormHandler.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/IFormHandler.java
index 56e680beb7..43568788f5 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/IFormHandler.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/IFormHandler.java
@@ -1,109 +1,109 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-
-/**
- * A form handler is state-less!<br>
- * State is only held on a IForm
- */
-public interface IFormHandler {
-
- IForm getForm();
-
- /**
- * do not use this internal method
- */
- void setFormInternal(IForm form);
-
- String getHandlerId();
-
- boolean isGuiLess();
-
- /**
- * @param openExclusive
- */
- void setOpenExclusive(boolean openExclusive);
-
- /**
- * @return
- */
- boolean isOpenExclusive();
-
- /**
- * Before the form is activated, this method loads its data.<br>
- * After this method call, the form is in the state "Saved / Unchanged" All
- * field value changes done here appear as unchanged in the form.
- */
- void onLoad() throws ProcessingException;
-
- /**
- * Load additional form state<br>
- * this method call is after the form was loaded into the state
- * "Saved / Unchanged"<br>
- * any changes to fields might result in the form ot fields being changed and
- * therefore in the state "Save needed / Changed"
- */
- void onPostLoad() throws ProcessingException;
-
- /**
- * This method is called in order to check field validity.<br>
- * This method is called just after the {@link IForm#execCheckFields()} but
- * before the form is validated and stored.<br>
- * After this method, the form is checking fields itself and displaying a
- * dialog with missing and invalid fields.
- *
- * @return true when this check is done and further checks can continue, false
- * to silently cancel the current process
- * @throws ProcessingException
- * to cancel the current process with error handling and user
- * notification such as a dialog
- */
- boolean onCheckFields() throws ProcessingException;
-
- /**
- * This method is called in order to update derived states like button
- * enablings.<br>
- * This method is called after the {@link IForm#execValidate()} but before the
- * form is stored.<br>
- *
- * @return true when validate is successful, false to silently cancel the
- * current process
- * @throws ProcessingException
- * to cancel the current process with error handling and user
- * notification such as a dialog
- */
- boolean onValidate() throws ProcessingException;
-
- /**
- * Store form state<br>
- * after this method call, the form is in the state "Saved / Unchanged" When
- * the form is closed using Ok, Save, Search, Next, etc.. this method is
- * called to apply the changes to the persistency layer
- */
- void onStore() throws ProcessingException;
-
- /**
- * When the form is closed using cancel or close this method is called to
- * manage the case that no changes should be performed (revert case)
- */
- void onDiscard() throws ProcessingException;
-
- /**
- * Finalize form state<br>
- * called whenever the handler is finished and the form is closed When the
- * form is closed in any way this method is called to dispose of resources or
- * deallocate services
- */
- void onFinally() throws ProcessingException;
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+
+/**
+ * A form handler is state-less!<br>
+ * State is only held on a IForm
+ */
+public interface IFormHandler {
+
+ IForm getForm();
+
+ /**
+ * do not use this internal method
+ */
+ void setFormInternal(IForm form);
+
+ String getHandlerId();
+
+ boolean isGuiLess();
+
+ /**
+ * @param openExclusive
+ */
+ void setOpenExclusive(boolean openExclusive);
+
+ /**
+ * @return
+ */
+ boolean isOpenExclusive();
+
+ /**
+ * Before the form is activated, this method loads its data.<br>
+ * After this method call, the form is in the state "Saved / Unchanged" All
+ * field value changes done here appear as unchanged in the form.
+ */
+ void onLoad() throws ProcessingException;
+
+ /**
+ * Load additional form state<br>
+ * this method call is after the form was loaded into the state
+ * "Saved / Unchanged"<br>
+ * any changes to fields might result in the form ot fields being changed and
+ * therefore in the state "Save needed / Changed"
+ */
+ void onPostLoad() throws ProcessingException;
+
+ /**
+ * This method is called in order to check field validity.<br>
+ * This method is called just after the {@link IForm#execCheckFields()} but
+ * before the form is validated and stored.<br>
+ * After this method, the form is checking fields itself and displaying a
+ * dialog with missing and invalid fields.
+ *
+ * @return true when this check is done and further checks can continue, false
+ * to silently cancel the current process
+ * @throws ProcessingException
+ * to cancel the current process with error handling and user
+ * notification such as a dialog
+ */
+ boolean onCheckFields() throws ProcessingException;
+
+ /**
+ * This method is called in order to update derived states like button
+ * enablings.<br>
+ * This method is called after the {@link IForm#execValidate()} but before the
+ * form is stored.<br>
+ *
+ * @return true when validate is successful, false to silently cancel the
+ * current process
+ * @throws ProcessingException
+ * to cancel the current process with error handling and user
+ * notification such as a dialog
+ */
+ boolean onValidate() throws ProcessingException;
+
+ /**
+ * Store form state<br>
+ * after this method call, the form is in the state "Saved / Unchanged" When
+ * the form is closed using Ok, Save, Search, Next, etc.. this method is
+ * called to apply the changes to the persistency layer
+ */
+ void onStore() throws ProcessingException;
+
+ /**
+ * When the form is closed using cancel or close this method is called to
+ * manage the case that no changes should be performed (revert case)
+ */
+ void onDiscard() throws ProcessingException;
+
+ /**
+ * Finalize form state<br>
+ * called whenever the handler is finished and the form is closed When the
+ * form is closed in any way this method is called to dispose of resources or
+ * deallocate services
+ */
+ void onFinally() throws ProcessingException;
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/IFormUIFacade.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/IFormUIFacade.java
index 576d2df37d..47ba79d178 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/IFormUIFacade.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/IFormUIFacade.java
@@ -1,38 +1,38 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form;
-
-import java.io.File;
-
-public interface IFormUIFacade {
-
- void fireFormActivatedFromUI();
-
- /**
- * Request to close the form<br>
- * This request might be ignored when the form is not ready for closing or in
- * pending state.
- */
- void fireFormClosingFromUI();
-
- /**
- * Notification that ui closed the form view<br>
- * This request is a forced close of the form from the ui and closes the form
- * model regardless of its state.
- */
- void fireFormKilledFromUI();
-
- /**
- * Notification that ui has taken a print screen. The file given to this notification is written and closed.
- */
- void fireFormPrintedFromUI(File outputFile);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form;
+
+import java.io.File;
+
+public interface IFormUIFacade {
+
+ void fireFormActivatedFromUI();
+
+ /**
+ * Request to close the form<br>
+ * This request might be ignored when the form is not ready for closing or in
+ * pending state.
+ */
+ void fireFormClosingFromUI();
+
+ /**
+ * Notification that ui closed the form view<br>
+ * This request is a forced close of the form from the ui and closes the form
+ * model regardless of its state.
+ */
+ void fireFormKilledFromUI();
+
+ /**
+ * Notification that ui has taken a print screen. The file given to this notification is written and closed.
+ */
+ void fireFormPrintedFromUI(File outputFile);
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/NullFormHandler.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/NullFormHandler.java
index ca1f058155..9f19892357 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/NullFormHandler.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/NullFormHandler.java
@@ -1,15 +1,15 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form;
-
-public class NullFormHandler extends AbstractFormHandler {
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form;
+
+public class NullFormHandler extends AbstractFormHandler {
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/PrintDevice.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/PrintDevice.java
index 4c91b43d38..6bde6b6696 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/PrintDevice.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/PrintDevice.java
@@ -1,42 +1,42 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form;
-
-public enum PrintDevice {
- /**
- * <pre>
- * Print to a printer device
- * Further parameters are normally passed by a parameter map of type Map&lt;String,Object&gt;
- * printerName=String (optional)
- * jobName=String (optional)
- * </pre>
- */
- Printer(1),
- /**
- * <pre>
- * Print to a printer device
- * Further parameters are normally passed by a parameter map of type Map&lt;String,Object&gt;
- * file=java.io.File
- * contentType=String (optional)
- * </pre>
- *
- * since 3.8: The output is written to the file with an additional .tmp extension. Only after the complete file is
- * written, it is renamed to its desired name.
- * Therefore callers can wait until the file is created and are done.
- */
- File(2);
-
- private int value;
-
- PrintDevice(int value) {
- this.value = value;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form;
+
+public enum PrintDevice {
+ /**
+ * <pre>
+ * Print to a printer device
+ * Further parameters are normally passed by a parameter map of type Map&lt;String,Object&gt;
+ * printerName=String (optional)
+ * jobName=String (optional)
+ * </pre>
+ */
+ Printer(1),
+ /**
+ * <pre>
+ * Print to a printer device
+ * Further parameters are normally passed by a parameter map of type Map&lt;String,Object&gt;
+ * file=java.io.File
+ * contentType=String (optional)
+ * </pre>
+ *
+ * since 3.8: The output is written to the file with an additional .tmp extension. Only after the complete file is
+ * written, it is renamed to its desired name.
+ * Therefore callers can wait until the file is created and are done.
+ */
+ File(2);
+
+ private int value;
+
+ PrintDevice(int value) {
+ this.value = value;
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/ScoutInfoForm.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/ScoutInfoForm.java
index 2e5aed40f7..0efb2ff688 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/ScoutInfoForm.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/ScoutInfoForm.java
@@ -1,286 +1,286 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form;
-
-import java.io.ByteArrayInputStream;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
-
-import org.eclipse.core.runtime.IProduct;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.scout.commons.LocaleThreadLocal;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.client.services.common.icon.IconSpec;
-import org.eclipse.scout.rt.client.services.common.perf.IPerformanceAnalyzerService;
-import org.eclipse.scout.rt.client.ui.form.ScoutInfoForm.MainBox.CloseButton;
-import org.eclipse.scout.rt.client.ui.form.ScoutInfoForm.MainBox.GroupBox.HtmlField;
-import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractCloseButton;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
-import org.eclipse.scout.rt.client.ui.form.fields.htmlfield.AbstractHtmlField;
-import org.eclipse.scout.rt.shared.AbstractIcons;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.services.common.file.RemoteFile;
-import org.eclipse.scout.rt.shared.services.common.shell.IShellService;
-import org.eclipse.scout.rt.shared.ui.UserAgentUtility;
-import org.eclipse.scout.service.SERVICES;
-import org.osgi.framework.Version;
-
-public class ScoutInfoForm extends AbstractForm {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(ScoutInfoForm.class);
-
- private RemoteFile m_logoImage;
-
- public ScoutInfoForm() throws ProcessingException {
- super();
- m_logoImage = new RemoteFile("logo.png", 0);
- }
-
- public RemoteFile getLogoImage() {
- return m_logoImage;
- }
-
- public void setLogoImage(RemoteFile f) {
- m_logoImage = f;
- }
-
- @Override
- protected String getConfiguredTitle() {
- return ScoutTexts.get("Info");
- }
-
- @Override
- protected String getConfiguredDoc() {
- return "This is the InfoForm form";
- }
-
- public MainBox getMainBox() {
- return (MainBox) getRootGroupBox();
- }
-
- public HtmlField getHtmlField() {
- return getFieldByClass(HtmlField.class);
- }
-
- public CloseButton getCloseButton() {
- return getFieldByClass(CloseButton.class);
- }
-
- public void startModify() throws ProcessingException {
- startInternal(new ModifyHandler());
- }
-
- @Order(10.0f)
- public class MainBox extends AbstractGroupBox {
-
- @Override
- protected boolean getConfiguredGridUseUiWidth() {
- if (UserAgentUtility.isSwingUi()) {
- return true;
- }
- return false;
- }
-
- @Order(10.0f)
- public class GroupBox extends AbstractGroupBox {
-
- @Override
- protected boolean getConfiguredGridUseUiWidth() {
- if (UserAgentUtility.isSwingUi()) {
- return true;
- }
- return false;
- }
-
- @Order(10.0f)
- public class HtmlField extends AbstractHtmlField {
-
- @Override
- protected boolean getConfiguredLabelVisible() {
- return false;
- }
-
- @Override
- protected boolean getConfiguredEnabled() {
- return true;
- }
-
- @Override
- protected boolean getConfiguredScrollBarEnabled() {
- return false;
- }
-
- @Override
- protected boolean getConfiguredGridUseUiWidth() {
- if (UserAgentUtility.isSwingUi()) {
- return true;
- }
- return false;
- }
-
- @Override
- protected boolean getConfiguredGridUseUiHeight() {
- if (UserAgentUtility.isSwingUi()) {
- return true;
- }
- return false;
- }
-
- @Override
- protected int getConfiguredGridW() {
- if (UserAgentUtility.isSwingUi()) {
- return 1;
- }
- return 2;
- }
-
- @Override
- protected int getConfiguredGridH() {
- if (UserAgentUtility.isSwingUi()) {
- return 1;
- }
-
- // If the client is a webclient then some of these informations must be omitted (Security) so that the html
- // field is smaller @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=365761
- else if (UserAgentUtility.isWebClient()) {
- return 12;
- }
- return 20;
- }
-
- @Override
- protected void execHyperlinkAction(URL url, String path, boolean local) throws ProcessingException {
- if (!local) {
- SERVICES.getService(IShellService.class).shellOpen(url.toExternalForm());
- }
- }
- }
- }
-
- @Order(20.0f)
- public class CloseButton extends AbstractCloseButton {
- @Override
- protected String getConfiguredTooltipText() {
- return null;
- }
- }
- }
-
- protected void createHtmlAttachments(Collection<RemoteFile> collection) {
- RemoteFile f = getLogoImage();
- if (f != null && !f.hasContent()) {
- // try to load bundle resource
- try {
- IClientSession clientSession = ClientSyncJob.getCurrentSession();
- IconSpec iconSpec = clientSession.getIconLocator().getIconSpec(AbstractIcons.ApplicationLogo);
- ByteArrayInputStream is = new ByteArrayInputStream(iconSpec.getContent());
- f.readData(is);
- is.close();
- }
- catch (Exception ex2) {
- LOG.info(null, ex2);
- f = null;
- }
- }
- if (f != null && f.hasContent()) {
- collection.add(f);
- }
- }
-
- protected void createHtmlBody(StringBuffer buf) {
- String title = "unknown";
- Version v = Version.emptyVersion;
- IProduct product = Platform.getProduct();
- if (product != null) {
- title = product.getName();
- v = Version.parseVersion("" + product.getDefiningBundle().getHeaders().get("Bundle-Version"));
- }
- buf.append("<head>\n");
- buf.append("<style type=\"text/css\">\n");
- buf.append("h1 {font-family: sans-serif}\n");
- buf.append("h2 {font-family: sans-serif}\n");
- buf.append("h3 {font-family: sans-serif}\n");
- buf.append("body {font-family: sans-serif}\n");
- buf.append("p {font-family: sans-serif}\n");
- buf.append("</style>\n");
- buf.append("</head>\n");
- buf.append("<p>");
- RemoteFile f = getLogoImage();
- if (f != null) {
- buf.append("<img src=\"" + f.getPath() + "\">");
- }
- else {
- buf.append("<h3>" + title + "</h3>");
- }
- buf.append("<p>");
- buf.append("<h2>" + title + " " + v.getMajor() + "." + v.getMinor() + "." + v.getMicro() + "</h2>");
- buf.append("<table cellspacing=0 cellpadding=0>");
- //
- StringBuffer contentBuf = new StringBuffer();
- createHtmlPropertyTableContent(contentBuf);
- buf.append(contentBuf.toString());
- buf.append("<tr><td>" + ScoutTexts.get("DetailedVersion") + ":</td><td>&nbsp;</td><td>" + v.toString() + "</td></tr>");
- //
- buf.append("</table>");
- }
-
- protected void createHtmlPropertyTableContent(StringBuffer buf) {
- IClientSession session = ClientSyncJob.getCurrentSession();
- long memUsed = (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / 1024 / 1024;
- long memTotal = Runtime.getRuntime().totalMemory() / 1024 / 1024;
- long memMax = Runtime.getRuntime().maxMemory() / 1024 / 1024;
- //
- buf.append("<tr><td>" + ScoutTexts.get("Username") + ":</td><td>&nbsp;</td><td>" + session.getUserId() + "</td></tr>");
- buf.append("<tr><td>" + ScoutTexts.get("Language") + ":</td><td>&nbsp;</td><td>" + LocaleThreadLocal.get().getDisplayLanguage() + "</td></tr>");
- buf.append("<tr><td>" + ScoutTexts.get("FormattingLocale") + ":</td><td>&nbsp;</td><td>" + LocaleThreadLocal.get() + "</td></tr>");
-
- /**
- * These information must only be presented in the case of an richclient. If the client is a webclient (ui.rap) then
- * these informations must be omitted (Security) https://bugs.eclipse.org/bugs/show_bug.cgi?id=365761
- */
- if (UserAgentUtility.isRichClient()) {
- buf.append("<tr><td>" + ScoutTexts.get("JavaVersion") + ":</td><td>&nbsp;</td><td>" + System.getProperty("java.version") + "</td></tr>");
- buf.append("<tr><td>" + ScoutTexts.get("JavaVMVersion") + ":</td><td>&nbsp;</td><td>" + System.getProperty("java.vm.version") + "</td></tr>");
- buf.append("<tr><td>" + ScoutTexts.get("OSVersion") + ":</td><td>&nbsp;</td><td>" + System.getProperty("os.name") + " " + System.getProperty("os.version") + "</td></tr>");
- buf.append("<tr><td>" + ScoutTexts.get("OSUser") + ":</td><td>&nbsp;</td><td>" + System.getProperty("user.name") + "</td></tr>");
- buf.append("<tr><td>" + ScoutTexts.get("MemoryStatus") + ":</td><td>&nbsp;</td><td>" + memUsed + "MB (total " + memTotal + "MB / max " + memMax + "MB)</td></tr>");
- IPerformanceAnalyzerService perf = SERVICES.getService(IPerformanceAnalyzerService.class);
- if (perf != null) {
- buf.append("<tr><td>" + ScoutTexts.get("NetworkLatency") + ":</td><td>&nbsp;</td><td>" + perf.getNetworkLatency() + " ms</td></tr>");
- buf.append("<tr><td>" + ScoutTexts.get("ExecutionTime") + ":</td><td>&nbsp;</td><td>" + perf.getServerExecutionTime() + " ms</td></tr>");
- }
- if (session.getServiceTunnel() != null) {
- buf.append("<tr><td>" + ScoutTexts.get("Server") + ":</td><td>&nbsp;</td><td>" + session.getServiceTunnel().getServerURL() + "</td></tr>");
- }
- }
- }
-
- @Order(20.0f)
- public class ModifyHandler extends AbstractFormHandler {
-
- @Override
- protected void execLoad() throws ProcessingException {
- ArrayList<RemoteFile> attachments = new ArrayList<RemoteFile>();
- createHtmlAttachments(attachments);
- if (attachments.size() > 0) {
- getHtmlField().setAttachments(attachments.toArray(new RemoteFile[attachments.size()]));
- }
- StringBuffer buf = new StringBuffer();
- createHtmlBody(buf);
- getHtmlField().setValue(buf.toString());
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form;
+
+import java.io.ByteArrayInputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.eclipse.core.runtime.IProduct;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.scout.commons.LocaleThreadLocal;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.client.services.common.icon.IconSpec;
+import org.eclipse.scout.rt.client.services.common.perf.IPerformanceAnalyzerService;
+import org.eclipse.scout.rt.client.ui.form.ScoutInfoForm.MainBox.CloseButton;
+import org.eclipse.scout.rt.client.ui.form.ScoutInfoForm.MainBox.GroupBox.HtmlField;
+import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractCloseButton;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
+import org.eclipse.scout.rt.client.ui.form.fields.htmlfield.AbstractHtmlField;
+import org.eclipse.scout.rt.shared.AbstractIcons;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.services.common.file.RemoteFile;
+import org.eclipse.scout.rt.shared.services.common.shell.IShellService;
+import org.eclipse.scout.rt.shared.ui.UserAgentUtility;
+import org.eclipse.scout.service.SERVICES;
+import org.osgi.framework.Version;
+
+public class ScoutInfoForm extends AbstractForm {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(ScoutInfoForm.class);
+
+ private RemoteFile m_logoImage;
+
+ public ScoutInfoForm() throws ProcessingException {
+ super();
+ m_logoImage = new RemoteFile("logo.png", 0);
+ }
+
+ public RemoteFile getLogoImage() {
+ return m_logoImage;
+ }
+
+ public void setLogoImage(RemoteFile f) {
+ m_logoImage = f;
+ }
+
+ @Override
+ protected String getConfiguredTitle() {
+ return ScoutTexts.get("Info");
+ }
+
+ @Override
+ protected String getConfiguredDoc() {
+ return "This is the InfoForm form";
+ }
+
+ public MainBox getMainBox() {
+ return (MainBox) getRootGroupBox();
+ }
+
+ public HtmlField getHtmlField() {
+ return getFieldByClass(HtmlField.class);
+ }
+
+ public CloseButton getCloseButton() {
+ return getFieldByClass(CloseButton.class);
+ }
+
+ public void startModify() throws ProcessingException {
+ startInternal(new ModifyHandler());
+ }
+
+ @Order(10.0f)
+ public class MainBox extends AbstractGroupBox {
+
+ @Override
+ protected boolean getConfiguredGridUseUiWidth() {
+ if (UserAgentUtility.isSwingUi()) {
+ return true;
+ }
+ return false;
+ }
+
+ @Order(10.0f)
+ public class GroupBox extends AbstractGroupBox {
+
+ @Override
+ protected boolean getConfiguredGridUseUiWidth() {
+ if (UserAgentUtility.isSwingUi()) {
+ return true;
+ }
+ return false;
+ }
+
+ @Order(10.0f)
+ public class HtmlField extends AbstractHtmlField {
+
+ @Override
+ protected boolean getConfiguredLabelVisible() {
+ return false;
+ }
+
+ @Override
+ protected boolean getConfiguredEnabled() {
+ return true;
+ }
+
+ @Override
+ protected boolean getConfiguredScrollBarEnabled() {
+ return false;
+ }
+
+ @Override
+ protected boolean getConfiguredGridUseUiWidth() {
+ if (UserAgentUtility.isSwingUi()) {
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ protected boolean getConfiguredGridUseUiHeight() {
+ if (UserAgentUtility.isSwingUi()) {
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ protected int getConfiguredGridW() {
+ if (UserAgentUtility.isSwingUi()) {
+ return 1;
+ }
+ return 2;
+ }
+
+ @Override
+ protected int getConfiguredGridH() {
+ if (UserAgentUtility.isSwingUi()) {
+ return 1;
+ }
+
+ // If the client is a webclient then some of these informations must be omitted (Security) so that the html
+ // field is smaller @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=365761
+ else if (UserAgentUtility.isWebClient()) {
+ return 12;
+ }
+ return 20;
+ }
+
+ @Override
+ protected void execHyperlinkAction(URL url, String path, boolean local) throws ProcessingException {
+ if (!local) {
+ SERVICES.getService(IShellService.class).shellOpen(url.toExternalForm());
+ }
+ }
+ }
+ }
+
+ @Order(20.0f)
+ public class CloseButton extends AbstractCloseButton {
+ @Override
+ protected String getConfiguredTooltipText() {
+ return null;
+ }
+ }
+ }
+
+ protected void createHtmlAttachments(Collection<RemoteFile> collection) {
+ RemoteFile f = getLogoImage();
+ if (f != null && !f.hasContent()) {
+ // try to load bundle resource
+ try {
+ IClientSession clientSession = ClientSyncJob.getCurrentSession();
+ IconSpec iconSpec = clientSession.getIconLocator().getIconSpec(AbstractIcons.ApplicationLogo);
+ ByteArrayInputStream is = new ByteArrayInputStream(iconSpec.getContent());
+ f.readData(is);
+ is.close();
+ }
+ catch (Exception ex2) {
+ LOG.info(null, ex2);
+ f = null;
+ }
+ }
+ if (f != null && f.hasContent()) {
+ collection.add(f);
+ }
+ }
+
+ protected void createHtmlBody(StringBuffer buf) {
+ String title = "unknown";
+ Version v = Version.emptyVersion;
+ IProduct product = Platform.getProduct();
+ if (product != null) {
+ title = product.getName();
+ v = Version.parseVersion("" + product.getDefiningBundle().getHeaders().get("Bundle-Version"));
+ }
+ buf.append("<head>\n");
+ buf.append("<style type=\"text/css\">\n");
+ buf.append("h1 {font-family: sans-serif}\n");
+ buf.append("h2 {font-family: sans-serif}\n");
+ buf.append("h3 {font-family: sans-serif}\n");
+ buf.append("body {font-family: sans-serif}\n");
+ buf.append("p {font-family: sans-serif}\n");
+ buf.append("</style>\n");
+ buf.append("</head>\n");
+ buf.append("<p>");
+ RemoteFile f = getLogoImage();
+ if (f != null) {
+ buf.append("<img src=\"" + f.getPath() + "\">");
+ }
+ else {
+ buf.append("<h3>" + title + "</h3>");
+ }
+ buf.append("<p>");
+ buf.append("<h2>" + title + " " + v.getMajor() + "." + v.getMinor() + "." + v.getMicro() + "</h2>");
+ buf.append("<table cellspacing=0 cellpadding=0>");
+ //
+ StringBuffer contentBuf = new StringBuffer();
+ createHtmlPropertyTableContent(contentBuf);
+ buf.append(contentBuf.toString());
+ buf.append("<tr><td>" + ScoutTexts.get("DetailedVersion") + ":</td><td>&nbsp;</td><td>" + v.toString() + "</td></tr>");
+ //
+ buf.append("</table>");
+ }
+
+ protected void createHtmlPropertyTableContent(StringBuffer buf) {
+ IClientSession session = ClientSyncJob.getCurrentSession();
+ long memUsed = (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / 1024 / 1024;
+ long memTotal = Runtime.getRuntime().totalMemory() / 1024 / 1024;
+ long memMax = Runtime.getRuntime().maxMemory() / 1024 / 1024;
+ //
+ buf.append("<tr><td>" + ScoutTexts.get("Username") + ":</td><td>&nbsp;</td><td>" + session.getUserId() + "</td></tr>");
+ buf.append("<tr><td>" + ScoutTexts.get("Language") + ":</td><td>&nbsp;</td><td>" + LocaleThreadLocal.get().getDisplayLanguage() + "</td></tr>");
+ buf.append("<tr><td>" + ScoutTexts.get("FormattingLocale") + ":</td><td>&nbsp;</td><td>" + LocaleThreadLocal.get() + "</td></tr>");
+
+ /**
+ * These information must only be presented in the case of an richclient. If the client is a webclient (ui.rap) then
+ * these informations must be omitted (Security) https://bugs.eclipse.org/bugs/show_bug.cgi?id=365761
+ */
+ if (UserAgentUtility.isRichClient()) {
+ buf.append("<tr><td>" + ScoutTexts.get("JavaVersion") + ":</td><td>&nbsp;</td><td>" + System.getProperty("java.version") + "</td></tr>");
+ buf.append("<tr><td>" + ScoutTexts.get("JavaVMVersion") + ":</td><td>&nbsp;</td><td>" + System.getProperty("java.vm.version") + "</td></tr>");
+ buf.append("<tr><td>" + ScoutTexts.get("OSVersion") + ":</td><td>&nbsp;</td><td>" + System.getProperty("os.name") + " " + System.getProperty("os.version") + "</td></tr>");
+ buf.append("<tr><td>" + ScoutTexts.get("OSUser") + ":</td><td>&nbsp;</td><td>" + System.getProperty("user.name") + "</td></tr>");
+ buf.append("<tr><td>" + ScoutTexts.get("MemoryStatus") + ":</td><td>&nbsp;</td><td>" + memUsed + "MB (total " + memTotal + "MB / max " + memMax + "MB)</td></tr>");
+ IPerformanceAnalyzerService perf = SERVICES.getService(IPerformanceAnalyzerService.class);
+ if (perf != null) {
+ buf.append("<tr><td>" + ScoutTexts.get("NetworkLatency") + ":</td><td>&nbsp;</td><td>" + perf.getNetworkLatency() + " ms</td></tr>");
+ buf.append("<tr><td>" + ScoutTexts.get("ExecutionTime") + ":</td><td>&nbsp;</td><td>" + perf.getServerExecutionTime() + " ms</td></tr>");
+ }
+ if (session.getServiceTunnel() != null) {
+ buf.append("<tr><td>" + ScoutTexts.get("Server") + ":</td><td>&nbsp;</td><td>" + session.getServiceTunnel().getServerURL() + "</td></tr>");
+ }
+ }
+ }
+
+ @Order(20.0f)
+ public class ModifyHandler extends AbstractFormHandler {
+
+ @Override
+ protected void execLoad() throws ProcessingException {
+ ArrayList<RemoteFile> attachments = new ArrayList<RemoteFile>();
+ createHtmlAttachments(attachments);
+ if (attachments.size() > 0) {
+ getHtmlField().setAttachments(attachments.toArray(new RemoteFile[attachments.size()]));
+ }
+ StringBuffer buf = new StringBuffer();
+ createHtmlBody(buf);
+ getHtmlField().setValue(buf.toString());
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/AbstractCompositeField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/AbstractCompositeField.java
index 67c3515c8d..c6671dc244 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/AbstractCompositeField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/AbstractCompositeField.java
@@ -1,376 +1,376 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.scout.commons.ConfigurationUtility;
-import org.eclipse.scout.commons.annotations.InjectFieldTo;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.holders.Holder;
-import org.eclipse.scout.rt.client.ui.form.DefaultFormFieldInjection;
-import org.eclipse.scout.rt.client.ui.form.FormFieldInjectionThreadLocal;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.client.ui.form.IFormFieldVisitor;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
-import org.eclipse.scout.rt.client.ui.form.fields.wrappedform.IWrappedFormField;
-import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
-import org.eclipse.scout.service.SERVICES;
-
-public abstract class AbstractCompositeField extends AbstractFormField implements ICompositeField {
-
- private IFormField[] m_fields;
-
- public AbstractCompositeField() {
- this(true);
- }
-
- public AbstractCompositeField(boolean callInitializer) {
- super(callInitializer);
- }
-
- protected Class<? extends IFormField>[] getConfiguredFields() {
- Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
- return ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, IFormField.class);
- }
-
- /**
- * Full override: disable
- */
-
- @Override
- protected boolean execCalculateVisible() {
- return true;
- }
-
- @Override
- protected void initConfig() {
- /*
- * call first super initConfig to ensure all properties are applied to the field only.
- * E.g. setEnabled(getConfiguredEnabled()) would enable/disable all children when called
- * after field creation. -> all fields would have the enabled state of the MainBox.
- */
- m_fields = new IFormField[0];
- super.initConfig();
- Class<? extends IFormField>[] fieldArray = getConfiguredFields();
- // prepare injected fields
- DefaultFormFieldInjection injectedFields = null;
- for (Class<? extends IFormField> clazz : fieldArray) {
- if (!clazz.isAnnotationPresent(InjectFieldTo.class)) {
- continue;
- }
- try {
- IFormField f = ConfigurationUtility.newInnerInstance(this, clazz);
- if (f != null) {
- if (injectedFields == null) {
- injectedFields = new DefaultFormFieldInjection();
- }
- injectedFields.addField(f);
- }
- }// end try
- catch (Throwable t) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("field: " + clazz.getName(), t));
- }
- }
- ArrayList<IFormField> fieldList = new ArrayList<IFormField>();
- try {
- if (injectedFields != null) {
- FormFieldInjectionThreadLocal.push(injectedFields);
- }
- //
- for (Class<? extends IFormField> clazz : fieldArray) {
- if (clazz.isAnnotationPresent(InjectFieldTo.class)) {
- continue;
- }
- try {
- IFormField f = ConfigurationUtility.newInnerInstance(this, clazz);
- fieldList.add(f);
- }// end try
- catch (Throwable t) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("field: " + clazz.getName(), t));
- }
- }
- injectFieldsInternal(fieldList);
- }
- finally {
- if (injectedFields != null) {
- FormFieldInjectionThreadLocal.pop(injectedFields);
- }
- }
- for (IFormField f : fieldList) {
- f.setParentFieldInternal(this);
- }
- m_fields = fieldList.toArray(new IFormField[fieldList.size()]);
- // attach a proxy controller to each child field in the group for: visible, saveNeeded
- for (IFormField f : m_fields) {
- f.addPropertyChangeListener(new P_FieldPropertyChangeListener());
- }
- handleFieldVisibilityChanged();
- }
-
- /**
- * Override this internal method only in order to make use of dynamic fields<br>
- * Used to manage field list and add/remove fields (see {@link AbstractGroupBox} with wizard buttons)
- * <p>
- * The default implementation checks for {@link InjectFieldTo} annotations in the enclosing (runtime) classes.
- *
- * @param fieldList
- * live and mutable list of configured fields, not yet initialized
- * and added to composite field
- */
- protected void injectFieldsInternal(List<IFormField> fieldList) {
- FormFieldInjectionThreadLocal.injectFields(this, fieldList);
- }
-
- @Override
- public void setFormInternal(IForm form) {
- super.setFormInternal(form);
- IFormField[] a = m_fields;
- for (int i = 0; i < a.length; i++) {
- IFormField f = a[i];
- f.setFormInternal(form);
- }
- }
-
- @Override
- public int getFieldIndex(IFormField f) {
- for (int i = 0; i < m_fields.length; i++) {
- if (m_fields[i] == f) {
- return i;
- }
- }
- return -1;
- }
-
- @Override
- public int getFieldCount() {
- return m_fields.length;
- }
-
- @Override
- public IFormField getFieldById(final String id) {
- final Holder<IFormField> found = new Holder<IFormField>(IFormField.class);
- IFormFieldVisitor v = new IFormFieldVisitor() {
- @Override
- public boolean visitField(IFormField field, int level, int fieldIndex) {
- if (field.getFieldId().equals(id)) {
- found.setValue(field);
- }
- return found.getValue() == null;
- }
- };
- visitFields(v, 0);
- return found.getValue();
- }
-
- @Override
- public <T extends IFormField> T getFieldById(final String id, final Class<T> type) {
- final Holder<T> found = new Holder<T>(type);
- IFormFieldVisitor v = new IFormFieldVisitor() {
- @Override
- @SuppressWarnings("unchecked")
- public boolean visitField(IFormField field, int level, int fieldIndex) {
- if (type.isAssignableFrom(field.getClass()) && field.getFieldId().equals(id)) {
- found.setValue((T) field);
- }
- return found.getValue() == null;
- }
- };
- visitFields(v, 0);
- return found.getValue();
- }
-
- @Override
- public <T extends IFormField> T getFieldByClass(final Class<T> c) {
- final Holder<T> found = new Holder<T>(c);
- IFormFieldVisitor v = new IFormFieldVisitor() {
- @Override
- @SuppressWarnings("unchecked")
- public boolean visitField(IFormField field, int level, int fieldIndex) {
- if (field.getClass() == c) {
- found.setValue((T) field);
- }
- return found.getValue() == null;
- }
- };
- visitFields(v, 0);
- return found.getValue();
- }
-
- @Override
- public IFormField[] getFields() {
- IFormField[] a = new IFormField[m_fields.length];
- System.arraycopy(m_fields, 0, a, 0, a.length);
- return a;
- }
-
- @Override
- public boolean visitFields(IFormFieldVisitor visitor, int startLevel) {
- // myself
- if (!visitor.visitField(this, startLevel, 0)) {
- return false;
- }
- // children
- int index = 0;
- IFormField[] f = m_fields;
- for (int i = 0; i < f.length; i++) {
- if (f[i] instanceof ICompositeField) {
- if (!((ICompositeField) f[i]).visitFields(visitor, startLevel + 1)) {
- return false;
- }
- }
- else if (f[i] instanceof IWrappedFormField) {
- if (!((IWrappedFormField) f[i]).visitFields(visitor, startLevel + 1)) {
- return false;
- }
- }
- else {
- if (!visitor.visitField(f[i], startLevel, index)) {
- return false;
- }
- }
- index++;
- }
- return true;
- }
-
- @Override
- protected boolean execIsSaveNeeded() throws ProcessingException {
- for (IFormField f : m_fields) {
- if (f.isSaveNeeded()) {
- return true;
- }
- }
- return false;
- }
-
- @Override
- protected void execMarkSaved() throws ProcessingException {
- super.execMarkSaved();
- for (IFormField f : m_fields) {
- f.markSaved();
- }
- }
-
- @Override
- protected boolean execIsEmpty() throws ProcessingException {
- for (IFormField f : m_fields) {
- if (!f.isEmpty()) {
- return false;
- }
- }
- return true;
- }
-
- /**
- * broadcast this change to all children
- */
- @Override
- public void setMandatory(boolean b) {
- // recursively down all children
- for (IFormField f : m_fields) {
- f.setMandatory(b);
- }
- }
-
- /**
- * do not broadcast this change to all children
- */
- @Override
- public void setVisible(boolean b) {
- super.setVisible(b);
- }
-
- /**
- * when granting of enabled property changes, broadcast and set this property
- * on all children that have no permission set
- */
- @Override
- public void setEnabledGranted(boolean b) {
- super.setEnabledGranted(b);
- for (IFormField f : getFields()) {
- if (f.getEnabledPermission() == null) {
- f.setEnabledGranted(b);
- }
- }
- }
-
- /**
- * when granting of visible property changes, do not broadcast and set this
- * property on all children that have no permission set
- */
- @Override
- public void setVisibleGranted(boolean b) {
- super.setVisibleGranted(b);
- }
-
- /**
- * if initialized broadcast this change to all children.
- */
- @Override
- public void setEnabled(boolean b) {
- super.setEnabled(b);
- // recursively down all children only if initialized.
- if (isInitialized()) {
- for (IFormField f : m_fields) {
- f.setEnabled(b);
- }
- }
- }
-
- // box is only visible when it has at least one visible item
- protected void handleFieldVisibilityChanged() {
- int visCount = 0;
- IFormField[] f = m_fields;
- for (int i = 0; i < f.length; i++) {
- if (f[i].isVisible()) {
- visCount++;
- }
- }
- setVisibleFieldCount(visCount);
- calculateVisibleInternal();
- }
-
- @Override
- public void rebuildFieldGrid() {
- }
-
- private void setVisibleFieldCount(int n) {
- propertySupport.setPropertyInt(PROP_VISIBLE_FIELD_COUNT, n);
- }
-
- protected int getVisibleFieldCount() {
- return propertySupport.getPropertyInt(PROP_VISIBLE_FIELD_COUNT);
- }
-
- /**
- * Implementation of PropertyChangeListener Proxy on all attached fields (not
- * groups)
- */
- private class P_FieldPropertyChangeListener implements PropertyChangeListener {
- @Override
- public void propertyChange(PropertyChangeEvent e) {
- if (e.getPropertyName().equals(IFormField.PROP_VISIBLE)) {
- // fire group box visibility
- handleFieldVisibilityChanged();
- }
- else if (e.getPropertyName().equals(IFormField.PROP_SAVE_NEEDED)) {
- checkSaveNeeded();
- }
- else if (e.getPropertyName().equals(IFormField.PROP_EMPTY)) {
- checkEmpty();
- }
- }
- }// end private class
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.scout.commons.ConfigurationUtility;
+import org.eclipse.scout.commons.annotations.InjectFieldTo;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.holders.Holder;
+import org.eclipse.scout.rt.client.ui.form.DefaultFormFieldInjection;
+import org.eclipse.scout.rt.client.ui.form.FormFieldInjectionThreadLocal;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.client.ui.form.IFormFieldVisitor;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
+import org.eclipse.scout.rt.client.ui.form.fields.wrappedform.IWrappedFormField;
+import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
+import org.eclipse.scout.service.SERVICES;
+
+public abstract class AbstractCompositeField extends AbstractFormField implements ICompositeField {
+
+ private IFormField[] m_fields;
+
+ public AbstractCompositeField() {
+ this(true);
+ }
+
+ public AbstractCompositeField(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ protected Class<? extends IFormField>[] getConfiguredFields() {
+ Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
+ return ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, IFormField.class);
+ }
+
+ /**
+ * Full override: disable
+ */
+
+ @Override
+ protected boolean execCalculateVisible() {
+ return true;
+ }
+
+ @Override
+ protected void initConfig() {
+ /*
+ * call first super initConfig to ensure all properties are applied to the field only.
+ * E.g. setEnabled(getConfiguredEnabled()) would enable/disable all children when called
+ * after field creation. -> all fields would have the enabled state of the MainBox.
+ */
+ m_fields = new IFormField[0];
+ super.initConfig();
+ Class<? extends IFormField>[] fieldArray = getConfiguredFields();
+ // prepare injected fields
+ DefaultFormFieldInjection injectedFields = null;
+ for (Class<? extends IFormField> clazz : fieldArray) {
+ if (!clazz.isAnnotationPresent(InjectFieldTo.class)) {
+ continue;
+ }
+ try {
+ IFormField f = ConfigurationUtility.newInnerInstance(this, clazz);
+ if (f != null) {
+ if (injectedFields == null) {
+ injectedFields = new DefaultFormFieldInjection();
+ }
+ injectedFields.addField(f);
+ }
+ }// end try
+ catch (Throwable t) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("field: " + clazz.getName(), t));
+ }
+ }
+ ArrayList<IFormField> fieldList = new ArrayList<IFormField>();
+ try {
+ if (injectedFields != null) {
+ FormFieldInjectionThreadLocal.push(injectedFields);
+ }
+ //
+ for (Class<? extends IFormField> clazz : fieldArray) {
+ if (clazz.isAnnotationPresent(InjectFieldTo.class)) {
+ continue;
+ }
+ try {
+ IFormField f = ConfigurationUtility.newInnerInstance(this, clazz);
+ fieldList.add(f);
+ }// end try
+ catch (Throwable t) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("field: " + clazz.getName(), t));
+ }
+ }
+ injectFieldsInternal(fieldList);
+ }
+ finally {
+ if (injectedFields != null) {
+ FormFieldInjectionThreadLocal.pop(injectedFields);
+ }
+ }
+ for (IFormField f : fieldList) {
+ f.setParentFieldInternal(this);
+ }
+ m_fields = fieldList.toArray(new IFormField[fieldList.size()]);
+ // attach a proxy controller to each child field in the group for: visible, saveNeeded
+ for (IFormField f : m_fields) {
+ f.addPropertyChangeListener(new P_FieldPropertyChangeListener());
+ }
+ handleFieldVisibilityChanged();
+ }
+
+ /**
+ * Override this internal method only in order to make use of dynamic fields<br>
+ * Used to manage field list and add/remove fields (see {@link AbstractGroupBox} with wizard buttons)
+ * <p>
+ * The default implementation checks for {@link InjectFieldTo} annotations in the enclosing (runtime) classes.
+ *
+ * @param fieldList
+ * live and mutable list of configured fields, not yet initialized
+ * and added to composite field
+ */
+ protected void injectFieldsInternal(List<IFormField> fieldList) {
+ FormFieldInjectionThreadLocal.injectFields(this, fieldList);
+ }
+
+ @Override
+ public void setFormInternal(IForm form) {
+ super.setFormInternal(form);
+ IFormField[] a = m_fields;
+ for (int i = 0; i < a.length; i++) {
+ IFormField f = a[i];
+ f.setFormInternal(form);
+ }
+ }
+
+ @Override
+ public int getFieldIndex(IFormField f) {
+ for (int i = 0; i < m_fields.length; i++) {
+ if (m_fields[i] == f) {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+ @Override
+ public int getFieldCount() {
+ return m_fields.length;
+ }
+
+ @Override
+ public IFormField getFieldById(final String id) {
+ final Holder<IFormField> found = new Holder<IFormField>(IFormField.class);
+ IFormFieldVisitor v = new IFormFieldVisitor() {
+ @Override
+ public boolean visitField(IFormField field, int level, int fieldIndex) {
+ if (field.getFieldId().equals(id)) {
+ found.setValue(field);
+ }
+ return found.getValue() == null;
+ }
+ };
+ visitFields(v, 0);
+ return found.getValue();
+ }
+
+ @Override
+ public <T extends IFormField> T getFieldById(final String id, final Class<T> type) {
+ final Holder<T> found = new Holder<T>(type);
+ IFormFieldVisitor v = new IFormFieldVisitor() {
+ @Override
+ @SuppressWarnings("unchecked")
+ public boolean visitField(IFormField field, int level, int fieldIndex) {
+ if (type.isAssignableFrom(field.getClass()) && field.getFieldId().equals(id)) {
+ found.setValue((T) field);
+ }
+ return found.getValue() == null;
+ }
+ };
+ visitFields(v, 0);
+ return found.getValue();
+ }
+
+ @Override
+ public <T extends IFormField> T getFieldByClass(final Class<T> c) {
+ final Holder<T> found = new Holder<T>(c);
+ IFormFieldVisitor v = new IFormFieldVisitor() {
+ @Override
+ @SuppressWarnings("unchecked")
+ public boolean visitField(IFormField field, int level, int fieldIndex) {
+ if (field.getClass() == c) {
+ found.setValue((T) field);
+ }
+ return found.getValue() == null;
+ }
+ };
+ visitFields(v, 0);
+ return found.getValue();
+ }
+
+ @Override
+ public IFormField[] getFields() {
+ IFormField[] a = new IFormField[m_fields.length];
+ System.arraycopy(m_fields, 0, a, 0, a.length);
+ return a;
+ }
+
+ @Override
+ public boolean visitFields(IFormFieldVisitor visitor, int startLevel) {
+ // myself
+ if (!visitor.visitField(this, startLevel, 0)) {
+ return false;
+ }
+ // children
+ int index = 0;
+ IFormField[] f = m_fields;
+ for (int i = 0; i < f.length; i++) {
+ if (f[i] instanceof ICompositeField) {
+ if (!((ICompositeField) f[i]).visitFields(visitor, startLevel + 1)) {
+ return false;
+ }
+ }
+ else if (f[i] instanceof IWrappedFormField) {
+ if (!((IWrappedFormField) f[i]).visitFields(visitor, startLevel + 1)) {
+ return false;
+ }
+ }
+ else {
+ if (!visitor.visitField(f[i], startLevel, index)) {
+ return false;
+ }
+ }
+ index++;
+ }
+ return true;
+ }
+
+ @Override
+ protected boolean execIsSaveNeeded() throws ProcessingException {
+ for (IFormField f : m_fields) {
+ if (f.isSaveNeeded()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ protected void execMarkSaved() throws ProcessingException {
+ super.execMarkSaved();
+ for (IFormField f : m_fields) {
+ f.markSaved();
+ }
+ }
+
+ @Override
+ protected boolean execIsEmpty() throws ProcessingException {
+ for (IFormField f : m_fields) {
+ if (!f.isEmpty()) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * broadcast this change to all children
+ */
+ @Override
+ public void setMandatory(boolean b) {
+ // recursively down all children
+ for (IFormField f : m_fields) {
+ f.setMandatory(b);
+ }
+ }
+
+ /**
+ * do not broadcast this change to all children
+ */
+ @Override
+ public void setVisible(boolean b) {
+ super.setVisible(b);
+ }
+
+ /**
+ * when granting of enabled property changes, broadcast and set this property
+ * on all children that have no permission set
+ */
+ @Override
+ public void setEnabledGranted(boolean b) {
+ super.setEnabledGranted(b);
+ for (IFormField f : getFields()) {
+ if (f.getEnabledPermission() == null) {
+ f.setEnabledGranted(b);
+ }
+ }
+ }
+
+ /**
+ * when granting of visible property changes, do not broadcast and set this
+ * property on all children that have no permission set
+ */
+ @Override
+ public void setVisibleGranted(boolean b) {
+ super.setVisibleGranted(b);
+ }
+
+ /**
+ * if initialized broadcast this change to all children.
+ */
+ @Override
+ public void setEnabled(boolean b) {
+ super.setEnabled(b);
+ // recursively down all children only if initialized.
+ if (isInitialized()) {
+ for (IFormField f : m_fields) {
+ f.setEnabled(b);
+ }
+ }
+ }
+
+ // box is only visible when it has at least one visible item
+ protected void handleFieldVisibilityChanged() {
+ int visCount = 0;
+ IFormField[] f = m_fields;
+ for (int i = 0; i < f.length; i++) {
+ if (f[i].isVisible()) {
+ visCount++;
+ }
+ }
+ setVisibleFieldCount(visCount);
+ calculateVisibleInternal();
+ }
+
+ @Override
+ public void rebuildFieldGrid() {
+ }
+
+ private void setVisibleFieldCount(int n) {
+ propertySupport.setPropertyInt(PROP_VISIBLE_FIELD_COUNT, n);
+ }
+
+ protected int getVisibleFieldCount() {
+ return propertySupport.getPropertyInt(PROP_VISIBLE_FIELD_COUNT);
+ }
+
+ /**
+ * Implementation of PropertyChangeListener Proxy on all attached fields (not
+ * groups)
+ */
+ private class P_FieldPropertyChangeListener implements PropertyChangeListener {
+ @Override
+ public void propertyChange(PropertyChangeEvent e) {
+ if (e.getPropertyName().equals(IFormField.PROP_VISIBLE)) {
+ // fire group box visibility
+ handleFieldVisibilityChanged();
+ }
+ else if (e.getPropertyName().equals(IFormField.PROP_SAVE_NEEDED)) {
+ checkSaveNeeded();
+ }
+ else if (e.getPropertyName().equals(IFormField.PROP_EMPTY)) {
+ checkEmpty();
+ }
+ }
+ }// end private class
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/AbstractFormField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/AbstractFormField.java
index 67e31350f2..04b19d0eb3 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/AbstractFormField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/AbstractFormField.java
@@ -264,48 +264,48 @@ public abstract class AbstractFormField extends AbstractPropertyObserver impleme
}
/**
- * Configures the foreground color of the label. The color is represented by the HEX value (e.g. FFFFFF).
- * <p>
- * Subclasses can override this method. Default is {@code null}.
- *
- * @return Foreground color HEX value of the label.
- */
- @ConfigProperty(ConfigProperty.COLOR)
- @Order(60)
- @ConfigPropertyValue("null")
- protected String getConfiguredLabelForegroundColor() {
- return null;
- }
-
- /**
- * Configures the background color of the label. The color is represented by the HEX value (e.g. FFFFFF).
- * <p>
- * Subclasses can override this method. Default is {@code null}.
- *
- * @return Background color HEX value of the label.
- */
- @ConfigProperty(ConfigProperty.COLOR)
- @Order(70)
- @ConfigPropertyValue("null")
- protected String getConfiguredLabelBackgroundColor() {
- return null;
- }
-
- /**
- * Configures the font of the label. See {@link FontSpec#parse(String)} for the appropriate format.
- * <p>
- * Subclasses can override this method. Default is {@code null}.
- *
- * @return Font of the label.
- */
- @ConfigProperty(ConfigProperty.FONT)
- @Order(80)
- @ConfigPropertyValue("null")
- protected String getConfiguredLabelFont() {
- return null;
- }
-
- /**
+ * Configures the foreground color of the label. The color is represented by the HEX value (e.g. FFFFFF).
+ * <p>
+ * Subclasses can override this method. Default is {@code null}.
+ *
+ * @return Foreground color HEX value of the label.
+ */
+ @ConfigProperty(ConfigProperty.COLOR)
+ @Order(60)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredLabelForegroundColor() {
+ return null;
+ }
+
+ /**
+ * Configures the background color of the label. The color is represented by the HEX value (e.g. FFFFFF).
+ * <p>
+ * Subclasses can override this method. Default is {@code null}.
+ *
+ * @return Background color HEX value of the label.
+ */
+ @ConfigProperty(ConfigProperty.COLOR)
+ @Order(70)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredLabelBackgroundColor() {
+ return null;
+ }
+
+ /**
+ * Configures the font of the label. See {@link FontSpec#parse(String)} for the appropriate format.
+ * <p>
+ * Subclasses can override this method. Default is {@code null}.
+ *
+ * @return Font of the label.
+ */
+ @ConfigProperty(ConfigProperty.FONT)
+ @Order(80)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredLabelFont() {
+ return null;
+ }
+
+ /**
* Configures the horizontal alignment of the fields inside this group box.<br>
* This property typically only has an effect if fill horizontal is set to false which can be configured by
* {@link #getConfiguredFillHorizontal()}.
@@ -753,15 +753,15 @@ public abstract class AbstractFormField extends AbstractPropertyObserver impleme
if (getConfiguredFont() != null) {
setFont(FontSpec.parse(getConfiguredFont()));
}
- if (getConfiguredLabelBackgroundColor() != null) {
- setLabelBackgroundColor((getConfiguredLabelBackgroundColor()));
- }
- if (getConfiguredLabelForegroundColor() != null) {
- setLabelForegroundColor((getConfiguredLabelForegroundColor()));
- }
- if (getConfiguredLabelFont() != null) {
- setLabelFont(FontSpec.parse(getConfiguredLabelFont()));
- }
+ if (getConfiguredLabelBackgroundColor() != null) {
+ setLabelBackgroundColor((getConfiguredLabelBackgroundColor()));
+ }
+ if (getConfiguredLabelForegroundColor() != null) {
+ setLabelForegroundColor((getConfiguredLabelForegroundColor()));
+ }
+ if (getConfiguredLabelFont() != null) {
+ setLabelFont(FontSpec.parse(getConfiguredLabelFont()));
+ }
setFocusable(getConfiguredFocusable());
setGridDataHints(new GridData(getConfiguredGridX(), getConfiguredGridY(), getConfiguredGridW(), getConfiguredGridH(), getConfiguredGridWeightX(), getConfiguredGridWeightY(), getConfiguredGridUseUiWidth(), getConfiguredGridUseUiHeight(), getConfiguredHorizontalAlignment(), getConfiguredVerticalAlignment(), getConfiguredFillHorizontal(), getConfiguredFillVertical(), getConfiguredWidthInPixel(), getConfiguredHeightInPixel()));
setMasterRequired(getConfiguredMasterRequired());
@@ -1577,36 +1577,36 @@ public abstract class AbstractFormField extends AbstractPropertyObserver impleme
}
@Override
- public void setLabelForegroundColor(String c) {
- propertySupport.setProperty(PROP_LABEL_FOREGROUND_COLOR, c);
- }
-
- @Override
- public String getLabelForegroundColor() {
- return (String) propertySupport.getProperty(PROP_LABEL_FOREGROUND_COLOR);
- }
-
- @Override
- public void setLabelBackgroundColor(String c) {
- propertySupport.setProperty(PROP_LABEL_BACKGROUND_COLOR, c);
- }
-
- @Override
- public String getLabelBackgroundColor() {
- return (String) propertySupport.getProperty(PROP_LABEL_BACKGROUND_COLOR);
- }
-
- @Override
- public void setLabelFont(FontSpec f) {
- propertySupport.setProperty(PROP_LABEL_FONT, f);
- }
-
- @Override
- public FontSpec getLabelFont() {
- return (FontSpec) propertySupport.getProperty(PROP_LABEL_FONT);
- }
-
- @Override
+ public void setLabelForegroundColor(String c) {
+ propertySupport.setProperty(PROP_LABEL_FOREGROUND_COLOR, c);
+ }
+
+ @Override
+ public String getLabelForegroundColor() {
+ return (String) propertySupport.getProperty(PROP_LABEL_FOREGROUND_COLOR);
+ }
+
+ @Override
+ public void setLabelBackgroundColor(String c) {
+ propertySupport.setProperty(PROP_LABEL_BACKGROUND_COLOR, c);
+ }
+
+ @Override
+ public String getLabelBackgroundColor() {
+ return (String) propertySupport.getProperty(PROP_LABEL_BACKGROUND_COLOR);
+ }
+
+ @Override
+ public void setLabelFont(FontSpec f) {
+ propertySupport.setProperty(PROP_LABEL_FONT, f);
+ }
+
+ @Override
+ public FontSpec getLabelFont() {
+ return (FontSpec) propertySupport.getProperty(PROP_LABEL_FONT);
+ }
+
+ @Override
public GridData getGridData() {
return new GridData(m_gridData);
}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/AbstractValueField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/AbstractValueField.java
index 579cba425f..1bf05e4654 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/AbstractValueField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/AbstractValueField.java
@@ -1,582 +1,582 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields;
-
-import java.io.IOException;
-import java.util.EventListener;
-
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.commons.EventListenerList;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.TypeCastUtility;
-import org.eclipse.scout.commons.VerboseUtility;
-import org.eclipse.scout.commons.annotations.ConfigOperation;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.FormData;
-import org.eclipse.scout.commons.annotations.FormData.DefaultSubtypeSdkCommand;
-import org.eclipse.scout.commons.annotations.FormData.SdkCommand;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.IProcessingStatus;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.exception.VetoException;
-import org.eclipse.scout.commons.holders.IHolder;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.commons.xmlparser.SimpleXmlElement;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.data.form.fields.AbstractFormFieldData;
-import org.eclipse.scout.rt.shared.data.form.fields.AbstractValueFieldData;
-import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
-import org.eclipse.scout.service.SERVICES;
-
-@FormData(value = AbstractValueFieldData.class, defaultSubtypeSdkCommand = DefaultSubtypeSdkCommand.CREATE, sdkCommand = SdkCommand.USE, genericOrdinal = 0)
-public abstract class AbstractValueField<T> extends AbstractFormField implements IValueField<T> {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractValueField.class);
-
- private int m_valueChanging;
- private int m_valueParsing;
- private int m_valueValidating;
- private T m_initValue;
- private boolean m_autoDisplayText;
- private EventListenerList m_listeningSlaves;// my slaves
-
- public AbstractValueField() {
- this(true);
- }
-
- public AbstractValueField(boolean callInitializer) {
- super(callInitializer);
- }
-
- /*
- * Configuration
- */
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(200)
- @ConfigPropertyValue("true")
- protected boolean getConfiguredAutoDisplayText() {
- return true;
- }
-
- @Override
- protected void initConfig() {
- m_listeningSlaves = new EventListenerList();
- super.initConfig();
- setAutoDisplayText(getConfiguredAutoDisplayText());
- }
-
- /*
- * Data i/o
- */
- @SuppressWarnings("unchecked")
- @Override
- public void exportFormFieldData(AbstractFormFieldData target) throws ProcessingException {
- AbstractValueFieldData<T> v = (AbstractValueFieldData<T>) target;
- v.setValue(this.getValue());
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public void importFormFieldData(AbstractFormFieldData source, boolean valueChangeTriggersEnabled) {
- AbstractValueFieldData<T> v = (AbstractValueFieldData<T>) source;
- if (v.isValueSet()) {
- try {
- if (!valueChangeTriggersEnabled) {
- setValueChangeTriggerEnabled(false);
- }
- //
- T newValue;
- Object o = v.getValue();
- if (o != null) {
- Class castType = getHolderType();
- if (castType.isAssignableFrom(o.getClass())) {
- newValue = (T) o;
- }
- else {
- newValue = (T) TypeCastUtility.castValue(o, castType);
- }
- }
- else {
- newValue = null;
- }
- this.setValue(newValue);
- }
- finally {
- if (!valueChangeTriggersEnabled) {
- setValueChangeTriggerEnabled(true);
- }
- }
- }
- }
-
- /*
- * XML i/o
- */
- @Override
- public void storeXML(SimpleXmlElement x) throws ProcessingException {
- super.storeXML(x);
- T value = getValue();
- try {
- x.setObjectAttribute("value", value);
- }
- catch (IOException e) {
- if (LOG.isInfoEnabled()) {
- LOG.info("not serializable value in field " + getClass().getName() + "/" + getLabel() + ": " + e);
- }
- }
- }
-
- @Override
- public void loadXML(SimpleXmlElement x) throws ProcessingException {
- super.loadXML(x);
- try {
- T value = TypeCastUtility.castValue(x.getObjectAttribute("value", null, getClass().getClassLoader()), getHolderType());
- setValue(value);
- }
- catch (Exception e) {
- // be lenient, maybe the field was changed
- LOG.warn(null, e);
- }
- }
-
- @Override
- public void resetValue() {
- T newValue = getInitValue();
- setValue(newValue);
- checkSaveNeeded();
- checkEmpty();
- }
-
- @Override
- public void refreshDisplayText() {
- if (isAutoDisplayText()) {
- String t = execFormatValue(getValue());
- setDisplayText(t);
- }
- }
-
- @Override
- public void addMasterListener(MasterListener listener) {
- m_listeningSlaves.add(MasterListener.class, listener);
- }
-
- @Override
- public void removeMasterListener(MasterListener listener) {
- m_listeningSlaves.remove(MasterListener.class, listener);
- }
-
- private void fireMasterChanged() {
- // fire listeners
- EventListener[] a = m_listeningSlaves.getListeners(MasterListener.class);
- if (a != null && a.length > 0) {
- T masterValue = getValue();
- for (int i = 0; i < a.length; i++) {
- ((MasterListener) a[i]).masterChanged(masterValue);
- }
- }
- }
-
- @Override
- public void setInitValue(T initValue) {
- m_initValue = initValue;
- }
-
- @Override
- public T getInitValue() {
- return m_initValue;
- }
-
- @Override
- protected boolean execIsSaveNeeded() throws ProcessingException {
- T value = getValue();
- T initValue = getInitValue();
- if (CompareUtility.equals(value, initValue)) {
- return false;
- }
- else {
- return true;
- }
- }
-
- @Override
- protected void execMarkSaved() throws ProcessingException {
- super.execMarkSaved();
- T value = getValue();
- setInitValue(value);
- }
-
- @Override
- protected boolean execIsEmpty() throws ProcessingException {
- return getValue() == null;
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public T getValue() {
- if (isValueValidating() && ClientSyncJob.isSyncClientJob()) {
- throw new IllegalStateException("The value of " + getClass().getSimpleName() + " can not be accessed while the value is beeing validated");
- }
- else {
- //caller from outside thread (ui)
- //wait at most 10 seconds
- int i = 0;
- while (isValueValidating() && i < 100) {
- try {
- Thread.sleep(100);
- }
- catch (InterruptedException e) {
- //nop
- }
- i++;
- }
- }
- return (T) propertySupport.getProperty(PROP_VALUE);
- }
-
- @Override
- public final void setValue(T rawValue) {
- /**
- * @rn imo, 22.02.2006, set verifyInput flag while firing triggers when a
- * message box is shown, the doOK of the form might overrun this
- * command. setting isVerifyInput() cancels the ok task
- */
- if (isValueChanging()) {
- Exception caller1 = new Exception();
- LOG.warn("Loop detection in " + getClass().getName() + " with value " + rawValue, caller1);
- return;
- }
- try {
- setFieldChanging(true);
- setValueChanging(true);
- //
- T validatedValue = null;
-
- if (getErrorStatus() instanceof ValidationFailedStatus) {
- clearErrorStatus();
- }
- try {
- validatedValue = validateValue(rawValue);
-
- //parsing error may be cleared after successful validation
- if (getErrorStatus() instanceof ParsingFailedStatus) {
- clearErrorStatus();
- }
- }
- catch (Throwable t) {
- ProcessingException e = (t instanceof ProcessingException ? (ProcessingException) t : new ProcessingException("Unexpected", t));
-
- //parsing error remains unchanged, regardless of validation error
- if (!(getErrorStatus() instanceof ParsingFailedStatus)) {
- setErrorStatus(new ValidationFailedStatus(e.getStatus()));
- }
-
- e.consume();
- e.addContextMessage(getLabel() + " = " + rawValue);
- if (!(e instanceof VetoException)) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- // break up
- return;
- }
- //
- T oldValue = getValue();
- boolean changed = propertySupport.setPropertyNoFire(PROP_VALUE, validatedValue);
- // change text if auto-set-text enabled
- if (isAutoDisplayText()) {
- String t = execFormatValue(validatedValue);
- setDisplayText(t);
- }
- if (changed) {
- propertySupport.firePropertyChange(PROP_VALUE, oldValue, validatedValue);
- //
- valueChangedInternal();
- checkSaveNeeded();
- checkEmpty();
- fireMasterChanged();
- if (isValueChangeTriggerEnabled()) {
- try {
- execChangedValue();
- }
- catch (ProcessingException ex) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(ex);
- }
- }
- }
- }
- finally {
- setValueChanging(false);
- setFieldChanging(false);
- }
- }
-
- /**
- * internal single observer for value changed triggers
- */
- protected void valueChangedInternal() {
- if (LOG.isDebugEnabled()) {
- LOG.debug(getLabel() + " " + VerboseUtility.dumpObject(getValue()));
- }
- }
-
- @Override
- public boolean isValueChanging() {
- return m_valueChanging > 0;
- }
-
- private void setValueChanging(boolean b) {
- if (b) {
- m_valueChanging++;
- }
- else {
- m_valueChanging--;
- }
- }
-
- @Override
- public boolean isValueParsing() {
- return m_valueParsing > 0;
- }
-
- private void setValueParsing(boolean b) {
- if (b) {
- m_valueParsing++;
- }
- else {
- m_valueParsing--;
- }
- }
-
- @Override
- public boolean isValueValidating() {
- return m_valueValidating > 0;
- }
-
- private void setValueValidating(boolean b) {
- if (b) {
- m_valueValidating++;
- }
- else {
- m_valueValidating--;
- }
- }
-
- @Override
- public final void fireValueChanged() {
- try {
- setValueChanging(true);
- //
- try {
- execChangedValue();
- }
- catch (ProcessingException ex) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(ex);
- }
- fireMasterChanged();
- }
- finally {
- setValueChanging(false);
- }
- }
-
- private T validateValue(T rawValue) throws ProcessingException {
- try {
- setValueValidating(true);
- //
- T o = rawValue;
- o = validateValueInternal(o);
- o = execValidateValue(o);
- return o;
- }
- finally {
- setValueValidating(false);
- }
- }
-
- /**
- * override this method to perform detailed validation in subclasses
- */
- protected T validateValueInternal(T rawValue) throws ProcessingException {
- return rawValue;
- }
-
- /**
- * WHILE (not after) a new value is validating (that means the new value has
- * not yet been set), this methode is called.<br>
- * Check the new proposed value and either make it valid by returning this or
- * another valid value or reject by throwing a {@link VetoException}, it will
- * then appear red in the gui.
- *
- * @return the validated value or throws an exception
- */
- @ConfigOperation
- @Order(190)
- protected T execValidateValue(T rawValue) throws ProcessingException {
- return rawValue;
- }
-
- /**
- * AFTER a new valid value was stored (that means the value is valid), this
- * method is called and can be used to broadcast this change to other fields
- * by for example calling {@link IValueField#setValue(Object)} on another
- * field.<br>
- * If this new value seems to be invalid (even though it has been validated
- * correctly) use {@link #setErrorStatus(IProcessingStatus)} to mark the value
- * as incorrect. It will appear red in the gui.<br>
- * In case this method throws exceptions, this will NOT invalidate the value
- * of the field (like {@link #execValidateValue(Object)} does)
- */
- @ConfigOperation
- @Order(220)
- protected void execChangedValue() throws ProcessingException {
- }
-
- @Override
- public final boolean parseValue(String text) {
- if (isValueParsing()) {
- LOG.warn("Loop detection in " + getLabel() + " with text " + text);
- return false;
- }
- try {
- setFieldChanging(true);
- setValueParsing(true);
- //
- T parsedValue = execParseValue(text);
-
- //
- IProcessingStatus oldErrorStatus = getErrorStatus();
- String oldDisplayText = getDisplayText();
-
- if (getErrorStatus() instanceof ParsingFailedStatus) {
- clearErrorStatus();
- }
-
- setValue(parsedValue);
-
- //do not clear validation errors, if the display text has not changed
- if (oldErrorStatus instanceof ValidationFailedStatus && getErrorStatus() == null &&
- StringUtility.nvl(text, "").equals(StringUtility.nvl(oldDisplayText, ""))) {
- setErrorStatus(oldErrorStatus);
- }
- //convert validation error to parsing error
- else if (getErrorStatus() instanceof ValidationFailedStatus) {
- setErrorStatus(new ParsingFailedStatus(getErrorStatus()));
- }
- return true;
- }
- catch (Throwable t) {
- ProcessingException e;
- if (t instanceof ProcessingException) {
- e = (ProcessingException) t;
- }
- else {
- LOG.warn(null, t);
- e = new ProcessingException(ScoutTexts.get("InvalidValueMessageX", text), t);
- }
- ParsingFailedStatus internalStatus = new ParsingFailedStatus(e.getStatus());
- setErrorStatus(internalStatus);
- return false;
- }
- finally {
- setValueParsing(false);
- setFieldChanging(false);
- }
- }
-
- /**
- * override this method to perform detailed parsing in subclasses
- */
- protected T parseValueInternal(String text) throws ProcessingException {
- throw new ProcessingException("Not implemented");
- }
-
- /**
- * parse input text and create an appropriate value
- *
- * @return parsed value, not yet validated
- */
- @ConfigOperation
- @Order(200)
- protected T execParseValue(String text) throws ProcessingException {
- return parseValueInternal(text);
- }
-
- /**
- * format a valid value for display
- *
- * @return formatted value
- */
- @ConfigOperation
- @Order(210)
- protected String execFormatValue(T validValue) {
- return formatValueInternal(validValue);
- }
-
- /**
- * override this method to perform detailed formatting in subclasses
- */
- protected String formatValueInternal(T validValue) {
- return validValue != null ? validValue.toString() : "";
- }
-
- @Override
- public String getDisplayText() {
- return propertySupport.getPropertyString(PROP_DISPLAY_TEXT);
- }
-
- @Override
- public void setDisplayText(String s) {
- propertySupport.setPropertyStringAlwaysFire(PROP_DISPLAY_TEXT, s);
- }
-
- @Override
- public boolean isAutoDisplayText() {
- return m_autoDisplayText;
- }
-
- @Override
- public void setAutoDisplayText(boolean b) {
- m_autoDisplayText = b;
- }
-
- /**
- * Full override: set my value to null
- */
- @Override
- protected void execChangedMasterValue(Object newMasterValue) throws ProcessingException {
- setValue(null);
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public Class<T> getHolderType() {
- return TypeCastUtility.getGenericsParameterClass(getClass(), IHolder.class);
- }
-
- public void updateFrom(IHolder<T> other) {
- setValue(other.getValue());
- }
-
- @Override
- public boolean isContentValid() {
- boolean b = super.isContentValid();
- if (b) {
- if (isMandatory()) {
- if (getValue() == null) {
- return false;
- }
- }
- }
- return b;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields;
+
+import java.io.IOException;
+import java.util.EventListener;
+
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.commons.EventListenerList;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.TypeCastUtility;
+import org.eclipse.scout.commons.VerboseUtility;
+import org.eclipse.scout.commons.annotations.ConfigOperation;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.FormData;
+import org.eclipse.scout.commons.annotations.FormData.DefaultSubtypeSdkCommand;
+import org.eclipse.scout.commons.annotations.FormData.SdkCommand;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.IProcessingStatus;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.exception.VetoException;
+import org.eclipse.scout.commons.holders.IHolder;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.commons.xmlparser.SimpleXmlElement;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.data.form.fields.AbstractFormFieldData;
+import org.eclipse.scout.rt.shared.data.form.fields.AbstractValueFieldData;
+import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
+import org.eclipse.scout.service.SERVICES;
+
+@FormData(value = AbstractValueFieldData.class, defaultSubtypeSdkCommand = DefaultSubtypeSdkCommand.CREATE, sdkCommand = SdkCommand.USE, genericOrdinal = 0)
+public abstract class AbstractValueField<T> extends AbstractFormField implements IValueField<T> {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractValueField.class);
+
+ private int m_valueChanging;
+ private int m_valueParsing;
+ private int m_valueValidating;
+ private T m_initValue;
+ private boolean m_autoDisplayText;
+ private EventListenerList m_listeningSlaves;// my slaves
+
+ public AbstractValueField() {
+ this(true);
+ }
+
+ public AbstractValueField(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ /*
+ * Configuration
+ */
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(200)
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredAutoDisplayText() {
+ return true;
+ }
+
+ @Override
+ protected void initConfig() {
+ m_listeningSlaves = new EventListenerList();
+ super.initConfig();
+ setAutoDisplayText(getConfiguredAutoDisplayText());
+ }
+
+ /*
+ * Data i/o
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void exportFormFieldData(AbstractFormFieldData target) throws ProcessingException {
+ AbstractValueFieldData<T> v = (AbstractValueFieldData<T>) target;
+ v.setValue(this.getValue());
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public void importFormFieldData(AbstractFormFieldData source, boolean valueChangeTriggersEnabled) {
+ AbstractValueFieldData<T> v = (AbstractValueFieldData<T>) source;
+ if (v.isValueSet()) {
+ try {
+ if (!valueChangeTriggersEnabled) {
+ setValueChangeTriggerEnabled(false);
+ }
+ //
+ T newValue;
+ Object o = v.getValue();
+ if (o != null) {
+ Class castType = getHolderType();
+ if (castType.isAssignableFrom(o.getClass())) {
+ newValue = (T) o;
+ }
+ else {
+ newValue = (T) TypeCastUtility.castValue(o, castType);
+ }
+ }
+ else {
+ newValue = null;
+ }
+ this.setValue(newValue);
+ }
+ finally {
+ if (!valueChangeTriggersEnabled) {
+ setValueChangeTriggerEnabled(true);
+ }
+ }
+ }
+ }
+
+ /*
+ * XML i/o
+ */
+ @Override
+ public void storeXML(SimpleXmlElement x) throws ProcessingException {
+ super.storeXML(x);
+ T value = getValue();
+ try {
+ x.setObjectAttribute("value", value);
+ }
+ catch (IOException e) {
+ if (LOG.isInfoEnabled()) {
+ LOG.info("not serializable value in field " + getClass().getName() + "/" + getLabel() + ": " + e);
+ }
+ }
+ }
+
+ @Override
+ public void loadXML(SimpleXmlElement x) throws ProcessingException {
+ super.loadXML(x);
+ try {
+ T value = TypeCastUtility.castValue(x.getObjectAttribute("value", null, getClass().getClassLoader()), getHolderType());
+ setValue(value);
+ }
+ catch (Exception e) {
+ // be lenient, maybe the field was changed
+ LOG.warn(null, e);
+ }
+ }
+
+ @Override
+ public void resetValue() {
+ T newValue = getInitValue();
+ setValue(newValue);
+ checkSaveNeeded();
+ checkEmpty();
+ }
+
+ @Override
+ public void refreshDisplayText() {
+ if (isAutoDisplayText()) {
+ String t = execFormatValue(getValue());
+ setDisplayText(t);
+ }
+ }
+
+ @Override
+ public void addMasterListener(MasterListener listener) {
+ m_listeningSlaves.add(MasterListener.class, listener);
+ }
+
+ @Override
+ public void removeMasterListener(MasterListener listener) {
+ m_listeningSlaves.remove(MasterListener.class, listener);
+ }
+
+ private void fireMasterChanged() {
+ // fire listeners
+ EventListener[] a = m_listeningSlaves.getListeners(MasterListener.class);
+ if (a != null && a.length > 0) {
+ T masterValue = getValue();
+ for (int i = 0; i < a.length; i++) {
+ ((MasterListener) a[i]).masterChanged(masterValue);
+ }
+ }
+ }
+
+ @Override
+ public void setInitValue(T initValue) {
+ m_initValue = initValue;
+ }
+
+ @Override
+ public T getInitValue() {
+ return m_initValue;
+ }
+
+ @Override
+ protected boolean execIsSaveNeeded() throws ProcessingException {
+ T value = getValue();
+ T initValue = getInitValue();
+ if (CompareUtility.equals(value, initValue)) {
+ return false;
+ }
+ else {
+ return true;
+ }
+ }
+
+ @Override
+ protected void execMarkSaved() throws ProcessingException {
+ super.execMarkSaved();
+ T value = getValue();
+ setInitValue(value);
+ }
+
+ @Override
+ protected boolean execIsEmpty() throws ProcessingException {
+ return getValue() == null;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public T getValue() {
+ if (isValueValidating() && ClientSyncJob.isSyncClientJob()) {
+ throw new IllegalStateException("The value of " + getClass().getSimpleName() + " can not be accessed while the value is beeing validated");
+ }
+ else {
+ //caller from outside thread (ui)
+ //wait at most 10 seconds
+ int i = 0;
+ while (isValueValidating() && i < 100) {
+ try {
+ Thread.sleep(100);
+ }
+ catch (InterruptedException e) {
+ //nop
+ }
+ i++;
+ }
+ }
+ return (T) propertySupport.getProperty(PROP_VALUE);
+ }
+
+ @Override
+ public final void setValue(T rawValue) {
+ /**
+ * @rn imo, 22.02.2006, set verifyInput flag while firing triggers when a
+ * message box is shown, the doOK of the form might overrun this
+ * command. setting isVerifyInput() cancels the ok task
+ */
+ if (isValueChanging()) {
+ Exception caller1 = new Exception();
+ LOG.warn("Loop detection in " + getClass().getName() + " with value " + rawValue, caller1);
+ return;
+ }
+ try {
+ setFieldChanging(true);
+ setValueChanging(true);
+ //
+ T validatedValue = null;
+
+ if (getErrorStatus() instanceof ValidationFailedStatus) {
+ clearErrorStatus();
+ }
+ try {
+ validatedValue = validateValue(rawValue);
+
+ //parsing error may be cleared after successful validation
+ if (getErrorStatus() instanceof ParsingFailedStatus) {
+ clearErrorStatus();
+ }
+ }
+ catch (Throwable t) {
+ ProcessingException e = (t instanceof ProcessingException ? (ProcessingException) t : new ProcessingException("Unexpected", t));
+
+ //parsing error remains unchanged, regardless of validation error
+ if (!(getErrorStatus() instanceof ParsingFailedStatus)) {
+ setErrorStatus(new ValidationFailedStatus(e.getStatus()));
+ }
+
+ e.consume();
+ e.addContextMessage(getLabel() + " = " + rawValue);
+ if (!(e instanceof VetoException)) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ // break up
+ return;
+ }
+ //
+ T oldValue = getValue();
+ boolean changed = propertySupport.setPropertyNoFire(PROP_VALUE, validatedValue);
+ // change text if auto-set-text enabled
+ if (isAutoDisplayText()) {
+ String t = execFormatValue(validatedValue);
+ setDisplayText(t);
+ }
+ if (changed) {
+ propertySupport.firePropertyChange(PROP_VALUE, oldValue, validatedValue);
+ //
+ valueChangedInternal();
+ checkSaveNeeded();
+ checkEmpty();
+ fireMasterChanged();
+ if (isValueChangeTriggerEnabled()) {
+ try {
+ execChangedValue();
+ }
+ catch (ProcessingException ex) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(ex);
+ }
+ }
+ }
+ }
+ finally {
+ setValueChanging(false);
+ setFieldChanging(false);
+ }
+ }
+
+ /**
+ * internal single observer for value changed triggers
+ */
+ protected void valueChangedInternal() {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug(getLabel() + " " + VerboseUtility.dumpObject(getValue()));
+ }
+ }
+
+ @Override
+ public boolean isValueChanging() {
+ return m_valueChanging > 0;
+ }
+
+ private void setValueChanging(boolean b) {
+ if (b) {
+ m_valueChanging++;
+ }
+ else {
+ m_valueChanging--;
+ }
+ }
+
+ @Override
+ public boolean isValueParsing() {
+ return m_valueParsing > 0;
+ }
+
+ private void setValueParsing(boolean b) {
+ if (b) {
+ m_valueParsing++;
+ }
+ else {
+ m_valueParsing--;
+ }
+ }
+
+ @Override
+ public boolean isValueValidating() {
+ return m_valueValidating > 0;
+ }
+
+ private void setValueValidating(boolean b) {
+ if (b) {
+ m_valueValidating++;
+ }
+ else {
+ m_valueValidating--;
+ }
+ }
+
+ @Override
+ public final void fireValueChanged() {
+ try {
+ setValueChanging(true);
+ //
+ try {
+ execChangedValue();
+ }
+ catch (ProcessingException ex) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(ex);
+ }
+ fireMasterChanged();
+ }
+ finally {
+ setValueChanging(false);
+ }
+ }
+
+ private T validateValue(T rawValue) throws ProcessingException {
+ try {
+ setValueValidating(true);
+ //
+ T o = rawValue;
+ o = validateValueInternal(o);
+ o = execValidateValue(o);
+ return o;
+ }
+ finally {
+ setValueValidating(false);
+ }
+ }
+
+ /**
+ * override this method to perform detailed validation in subclasses
+ */
+ protected T validateValueInternal(T rawValue) throws ProcessingException {
+ return rawValue;
+ }
+
+ /**
+ * WHILE (not after) a new value is validating (that means the new value has
+ * not yet been set), this methode is called.<br>
+ * Check the new proposed value and either make it valid by returning this or
+ * another valid value or reject by throwing a {@link VetoException}, it will
+ * then appear red in the gui.
+ *
+ * @return the validated value or throws an exception
+ */
+ @ConfigOperation
+ @Order(190)
+ protected T execValidateValue(T rawValue) throws ProcessingException {
+ return rawValue;
+ }
+
+ /**
+ * AFTER a new valid value was stored (that means the value is valid), this
+ * method is called and can be used to broadcast this change to other fields
+ * by for example calling {@link IValueField#setValue(Object)} on another
+ * field.<br>
+ * If this new value seems to be invalid (even though it has been validated
+ * correctly) use {@link #setErrorStatus(IProcessingStatus)} to mark the value
+ * as incorrect. It will appear red in the gui.<br>
+ * In case this method throws exceptions, this will NOT invalidate the value
+ * of the field (like {@link #execValidateValue(Object)} does)
+ */
+ @ConfigOperation
+ @Order(220)
+ protected void execChangedValue() throws ProcessingException {
+ }
+
+ @Override
+ public final boolean parseValue(String text) {
+ if (isValueParsing()) {
+ LOG.warn("Loop detection in " + getLabel() + " with text " + text);
+ return false;
+ }
+ try {
+ setFieldChanging(true);
+ setValueParsing(true);
+ //
+ T parsedValue = execParseValue(text);
+
+ //
+ IProcessingStatus oldErrorStatus = getErrorStatus();
+ String oldDisplayText = getDisplayText();
+
+ if (getErrorStatus() instanceof ParsingFailedStatus) {
+ clearErrorStatus();
+ }
+
+ setValue(parsedValue);
+
+ //do not clear validation errors, if the display text has not changed
+ if (oldErrorStatus instanceof ValidationFailedStatus && getErrorStatus() == null &&
+ StringUtility.nvl(text, "").equals(StringUtility.nvl(oldDisplayText, ""))) {
+ setErrorStatus(oldErrorStatus);
+ }
+ //convert validation error to parsing error
+ else if (getErrorStatus() instanceof ValidationFailedStatus) {
+ setErrorStatus(new ParsingFailedStatus(getErrorStatus()));
+ }
+ return true;
+ }
+ catch (Throwable t) {
+ ProcessingException e;
+ if (t instanceof ProcessingException) {
+ e = (ProcessingException) t;
+ }
+ else {
+ LOG.warn(null, t);
+ e = new ProcessingException(ScoutTexts.get("InvalidValueMessageX", text), t);
+ }
+ ParsingFailedStatus internalStatus = new ParsingFailedStatus(e.getStatus());
+ setErrorStatus(internalStatus);
+ return false;
+ }
+ finally {
+ setValueParsing(false);
+ setFieldChanging(false);
+ }
+ }
+
+ /**
+ * override this method to perform detailed parsing in subclasses
+ */
+ protected T parseValueInternal(String text) throws ProcessingException {
+ throw new ProcessingException("Not implemented");
+ }
+
+ /**
+ * parse input text and create an appropriate value
+ *
+ * @return parsed value, not yet validated
+ */
+ @ConfigOperation
+ @Order(200)
+ protected T execParseValue(String text) throws ProcessingException {
+ return parseValueInternal(text);
+ }
+
+ /**
+ * format a valid value for display
+ *
+ * @return formatted value
+ */
+ @ConfigOperation
+ @Order(210)
+ protected String execFormatValue(T validValue) {
+ return formatValueInternal(validValue);
+ }
+
+ /**
+ * override this method to perform detailed formatting in subclasses
+ */
+ protected String formatValueInternal(T validValue) {
+ return validValue != null ? validValue.toString() : "";
+ }
+
+ @Override
+ public String getDisplayText() {
+ return propertySupport.getPropertyString(PROP_DISPLAY_TEXT);
+ }
+
+ @Override
+ public void setDisplayText(String s) {
+ propertySupport.setPropertyStringAlwaysFire(PROP_DISPLAY_TEXT, s);
+ }
+
+ @Override
+ public boolean isAutoDisplayText() {
+ return m_autoDisplayText;
+ }
+
+ @Override
+ public void setAutoDisplayText(boolean b) {
+ m_autoDisplayText = b;
+ }
+
+ /**
+ * Full override: set my value to null
+ */
+ @Override
+ protected void execChangedMasterValue(Object newMasterValue) throws ProcessingException {
+ setValue(null);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Class<T> getHolderType() {
+ return TypeCastUtility.getGenericsParameterClass(getClass(), IHolder.class);
+ }
+
+ public void updateFrom(IHolder<T> other) {
+ setValue(other.getValue());
+ }
+
+ @Override
+ public boolean isContentValid() {
+ boolean b = super.isContentValid();
+ if (b) {
+ if (isMandatory()) {
+ if (getValue() == null) {
+ return false;
+ }
+ }
+ }
+ return b;
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/GridData.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/GridData.java
index 1cca25822f..214a5ae356 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/GridData.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/GridData.java
@@ -1,74 +1,74 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields;
-
-/**
- * Title: BSI Scout V3
- * Copyright (c) 2001,2009 BSI AG
- * @version 3.x
- */
-
-/**
- * Grid Cell as container helper for dynamic layouting in scout
- */
-public final class GridData {
-
- public int x;
- public int y;
- public int w;
- public int h;
- public double weightX;
- public double weightY;
- public boolean useUiWidth;
- public boolean useUiHeight;
- /**
- * -1 left 0 center 1 right
- */
- public int horizontalAlignment;
- /**
- * -1 top 0 center 1 bottom
- */
- public int verticalAlignment;
- public boolean fillHorizontal;
- public boolean fillVertical;
- public int widthInPixel;
- public int heightInPixel;
-
- public GridData(GridData g) {
- this(g.x, g.y, g.w, g.h, g.weightX, g.weightY, g.useUiWidth, g.useUiHeight, g.horizontalAlignment, g.verticalAlignment, g.fillHorizontal, g.fillVertical, g.widthInPixel, g.heightInPixel);
- }
-
- public GridData(int x, int y, int w, int h, double weightX, double weightY) {
- this(x, y, w, h, weightX, weightY, false, false, -1, -1, true, true, 0, 0);
- }
-
- public GridData(int x, int y, int w, int h, double weightX, double weightY, boolean useUiWidth, boolean useUiHeight, int horizontalAlignment, int verticalAlignment, boolean fillHorizontal, boolean fillVertical, int widthInPixel, int heightInPixel) {
- this.x = x;
- this.y = y;
- this.w = w;
- this.h = h;
- this.weightX = weightX;
- this.weightY = weightY;
- this.useUiWidth = useUiWidth;
- this.useUiHeight = useUiHeight;
- this.horizontalAlignment = horizontalAlignment;
- this.verticalAlignment = verticalAlignment;
- this.fillHorizontal = fillHorizontal;
- this.fillVertical = fillVertical;
- this.widthInPixel = widthInPixel;
- this.heightInPixel = heightInPixel;
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName() + "[x=" + x + ", y=" + y + ", w=" + w + ", h=" + h + ", weightX=" + weightX + ", weightY=" + weightY + ", useUiWidth=" + useUiWidth + ", useUiHeight=" + useUiHeight + "]";
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields;
+
+/**
+ * Title: BSI Scout V3
+ * Copyright (c) 2001,2009 BSI AG
+ * @version 3.x
+ */
+
+/**
+ * Grid Cell as container helper for dynamic layouting in scout
+ */
+public final class GridData {
+
+ public int x;
+ public int y;
+ public int w;
+ public int h;
+ public double weightX;
+ public double weightY;
+ public boolean useUiWidth;
+ public boolean useUiHeight;
+ /**
+ * -1 left 0 center 1 right
+ */
+ public int horizontalAlignment;
+ /**
+ * -1 top 0 center 1 bottom
+ */
+ public int verticalAlignment;
+ public boolean fillHorizontal;
+ public boolean fillVertical;
+ public int widthInPixel;
+ public int heightInPixel;
+
+ public GridData(GridData g) {
+ this(g.x, g.y, g.w, g.h, g.weightX, g.weightY, g.useUiWidth, g.useUiHeight, g.horizontalAlignment, g.verticalAlignment, g.fillHorizontal, g.fillVertical, g.widthInPixel, g.heightInPixel);
+ }
+
+ public GridData(int x, int y, int w, int h, double weightX, double weightY) {
+ this(x, y, w, h, weightX, weightY, false, false, -1, -1, true, true, 0, 0);
+ }
+
+ public GridData(int x, int y, int w, int h, double weightX, double weightY, boolean useUiWidth, boolean useUiHeight, int horizontalAlignment, int verticalAlignment, boolean fillHorizontal, boolean fillVertical, int widthInPixel, int heightInPixel) {
+ this.x = x;
+ this.y = y;
+ this.w = w;
+ this.h = h;
+ this.weightX = weightX;
+ this.weightY = weightY;
+ this.useUiWidth = useUiWidth;
+ this.useUiHeight = useUiHeight;
+ this.horizontalAlignment = horizontalAlignment;
+ this.verticalAlignment = verticalAlignment;
+ this.fillHorizontal = fillHorizontal;
+ this.fillVertical = fillVertical;
+ this.widthInPixel = widthInPixel;
+ this.heightInPixel = heightInPixel;
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + "[x=" + x + ", y=" + y + ", w=" + w + ", h=" + h + ", weightX=" + weightX + ", weightY=" + weightY + ", useUiWidth=" + useUiWidth + ", useUiHeight=" + useUiHeight + "]";
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/ICompositeField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/ICompositeField.java
index 7b2c0319a2..3062c7f69b 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/ICompositeField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/ICompositeField.java
@@ -1,74 +1,74 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields;
-
-import org.eclipse.scout.rt.client.ui.form.IFormFieldVisitor;
-
-public interface ICompositeField extends IFormField {
-
- String PROP_VISIBLE_FIELD_COUNT = "visibleFieldCount";
-
- int getFieldIndex(IFormField comp);
-
- boolean visitFields(IFormFieldVisitor visitor, int startLevel);
-
- /**
- * recalculate and re-assign the logical x,y,w,h to each field in the groupbox
- */
- void rebuildFieldGrid();
-
- /**
- * direct child fields including groupboxes
- */
- int getFieldCount();
-
- /**
- * direct child fields including process buttons
- */
- IFormField[] getFields();
-
- /**
- * search all fields in this container and its subtree<br>
- * the field ID is the simple class name of a field without the suffixes
- * "Box", "Field", "Button"
- */
- IFormField getFieldById(String id);
-
- /**
- * search all fields in this container and its subtree<br>
- * the field ID is the simple class name of a field without the suffixes
- * "Box", "Field", "Button"
- * The field must be equal or a subtype of type
- */
- <T extends IFormField> T getFieldById(String id, Class<T> type);
-
- /**
- * @return the field with the exact type c in the subtree
- */
- <T extends IFormField> T getFieldByClass(Class<T> c);
-
- /**
- * for recursion
- */
- @Override
- void setMandatory(boolean b);
-
- /**
- * The grid column count for fields in this composite box
- */
- int getGridColumnCount();
-
- /**
- * The grid row count for fields in this composite box
- */
- int getGridRowCount();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields;
+
+import org.eclipse.scout.rt.client.ui.form.IFormFieldVisitor;
+
+public interface ICompositeField extends IFormField {
+
+ String PROP_VISIBLE_FIELD_COUNT = "visibleFieldCount";
+
+ int getFieldIndex(IFormField comp);
+
+ boolean visitFields(IFormFieldVisitor visitor, int startLevel);
+
+ /**
+ * recalculate and re-assign the logical x,y,w,h to each field in the groupbox
+ */
+ void rebuildFieldGrid();
+
+ /**
+ * direct child fields including groupboxes
+ */
+ int getFieldCount();
+
+ /**
+ * direct child fields including process buttons
+ */
+ IFormField[] getFields();
+
+ /**
+ * search all fields in this container and its subtree<br>
+ * the field ID is the simple class name of a field without the suffixes
+ * "Box", "Field", "Button"
+ */
+ IFormField getFieldById(String id);
+
+ /**
+ * search all fields in this container and its subtree<br>
+ * the field ID is the simple class name of a field without the suffixes
+ * "Box", "Field", "Button"
+ * The field must be equal or a subtype of type
+ */
+ <T extends IFormField> T getFieldById(String id, Class<T> type);
+
+ /**
+ * @return the field with the exact type c in the subtree
+ */
+ <T extends IFormField> T getFieldByClass(Class<T> c);
+
+ /**
+ * for recursion
+ */
+ @Override
+ void setMandatory(boolean b);
+
+ /**
+ * The grid column count for fields in this composite box
+ */
+ int getGridColumnCount();
+
+ /**
+ * The grid row count for fields in this composite box
+ */
+ int getGridRowCount();
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/IFormField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/IFormField.java
index 3d1f870108..ec9264c5ab 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/IFormField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/IFormField.java
@@ -1,628 +1,628 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields;
-
-import java.beans.PropertyChangeListener;
-import java.security.Permission;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.scout.commons.ConfigurationUtility;
-import org.eclipse.scout.commons.beans.IPropertyObserver;
-import org.eclipse.scout.commons.exception.IProcessingStatus;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.xmlparser.SimpleXmlElement;
-import org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke;
-import org.eclipse.scout.rt.client.ui.form.FormEvent;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.client.ui.form.PrintDevice;
-import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractCancelButton;
-import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractOkButton;
-import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
-import org.eclipse.scout.rt.client.ui.form.fields.datefield.IDateField;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox;
-import org.eclipse.scout.rt.client.ui.form.fields.internal.GridDataBuilder;
-import org.eclipse.scout.rt.client.ui.form.fields.sequencebox.ISequenceBox;
-import org.eclipse.scout.rt.client.ui.form.fields.smartfield.ISmartField;
-import org.eclipse.scout.rt.client.ui.form.fields.stringfield.IStringField;
-import org.eclipse.scout.rt.client.ui.form.fields.tabbox.ITabBox;
-import org.eclipse.scout.rt.shared.data.basic.FontSpec;
-import org.eclipse.scout.rt.shared.data.form.fields.AbstractFormFieldData;
-import org.eclipse.scout.rt.shared.services.common.jdbc.SearchFilter;
-
-/**
- * The {@link IForm} and <code>IFormField</code> classes are the prominent classes
- * of the application model: An <code>IForm</code> consists of multiple <code>IFormField</code>s.<br/>
- * A wide variety of form fields exist, the most important are the following:<br/>
- * <ul>
- * <li>{@link IValueField}:<br/>
- * Value fields allow user input through the GUI and contain a value of a certain type. Typical examples are:
- * <ul>
- * <li>{@link IStringField}: A text field containing a single line string (no line breaks).</li>
- * <li>{@link IDateField}: A field containing a formatted date.</li>
- * <li>{@link ISmartField}: A smart field allows to choose from a possibly predefined list of values.</li>
- * </ul>
- * </li>
- * <li>{@link IButton}:<br/>
- * Buttons allow the user to trigger events on the GUI. Typical examples on a form are the 'Ok' and 'Close' buttons (see
- * {@link AbstractOkButton} or {@link AbstractCancelButton}).</li>
- * <li>{@link IComposite}:<br/>
- * Composite fields group multiple form fields. The most common are:<br/>
- * <ul>
- * <li>{@link IGroupBox}: Groups multiple form fields and draws a border on the GUI.</li>
- * <li>{@link ITabBox}: Groups multiple form fields which are represented within tabs.</li>
- * </ul>
- * </li>
- * </ul>
- *
- * @see IForm
- */
-public interface IFormField extends IPropertyObserver {
- /*
- * Properties
- */
- /**
- * {@link ICompositeField}
- */
- String PROP_PARENT_FIELD = "parentField";
- String PROP_VISIBLE = "visible";
- String PROP_ENABLED = "enabled";
- String PROP_MANDATORY = "mandatory";
- String PROP_ERROR_STATUS = "errorStatus";
- String PROP_TOOLTIP_TEXT = "tooltipText";
- String PROP_FOREGROUND_COLOR = "foregroundColor";
- String PROP_BACKGROUND_COLOR = "backgroundColor";
- String PROP_FONT = "font";
- String PROP_LABEL_FOREGROUND_COLOR = "labelForegroundColor";
- String PROP_LABEL_BACKGROUND_COLOR = "labelBackgroundColor";
- String PROP_LABEL_FONT = "labelFont";
- String PROP_SAVE_NEEDED = "saveNeeded";
- String PROP_EMPTY = "empty";
- String PROP_LABEL = "label";
- String PROP_LABEL_VISIBLE = "labelVisible";
- String PROP_KEY_STROKES = "keyStrokes";
- /**
- * @deprecated since 3.8, sent via {@link FormEvent#TYPE_REQUEST_FOCUS}
- */
- @Deprecated
- String PROP_FOCUS_REQUESTED = "focusRequested";
- /**
- * if the field is focusable or not, value is of type {@link Boolean}
- */
- String PROP_FOCUSABLE = "focusable";// Build 205
-
- /**
- * see {@link #getGridDataHints()}<br>
- * this marker value defines the field to have a logical spanning all over the
- * group box width
- */
- int FULL_WIDTH = 0;
-
- /**
- * position the label at the default location (normally left of the field)<br>
- * see {@link #setLabelPosition(int)} and {@link #getLabelPosition()}
- */
- int LABEL_POSITION_DEFAULT = 0;
- /**
- * position the label left of the field<br>
- * see {@link #setLabelPosition(int)} and {@link #getLabelPosition()}
- */
- int LABEL_POSITION_LEFT = 1;
- /**
- * position the label on the field, meaning that the label is only displayed
- * when the field is empty (vista style)<br>
- * see {@link #setLabelPosition(int)} and {@link #getLabelPosition()}
- */
- int LABEL_POSITION_ON_FIELD = 2;
- /**
- * position the label right of the field<br>
- * see {@link #setLabelPosition(int)} and {@link #getLabelPosition()}
- */
- int LABEL_POSITION_RIGHT = 3;
-
- /**
- * position the label on the top of the field
- */
- int LABEL_POSITION_TOP = 4;
-
- /**
- * use the systemwide default label with see {@link #setLabelWidthInPixel(int)} and {@link #getLabelWidthInPixel()}
- */
- int LABEL_WIDTH_DEFAULT = 0;
-
- /**
- * use the ui-specific "real" with of the label see {@link #setLabelWidthInPixel(int)} and
- * {@link #getLabelWidthInPixel()}
- */
- int LABEL_WIDTH_UI = -1;
-
- /**
- * use the systemwide default label alignment
- */
- int LABEL_HORIZONTAL_ALIGNMENT_DEFAULT = 1000;
-
- IForm getForm();
-
- /**
- * Use this listener only in very rare cases and only if absolutely needed
- * (performance!)
- */
- void addSubtreePropertyChangeListener(PropertyChangeListener listener);
-
- /**
- * Use this listener only in very rare cases and only if absolutely needed
- * (performance!)
- */
- void addSubtreePropertyChangeListener(String propName, PropertyChangeListener listener);
-
- void removeSubtreePropertyChangeListener(PropertyChangeListener listener);
-
- void removeSubtreePropertyChangeListener(String propName, PropertyChangeListener listener);
-
- /**
- * do not use this internal method
- */
- void setFormInternal(IForm form);
-
- /**
- * get the first ancestor of this field (not including this field) which is of
- * type IGroupBox
- */
- IGroupBox getParentGroupBox();
-
- /**
- * get the first ancestor of this field (not including this field) which is of
- * type ICompositeField
- */
- ICompositeField getParentField();
-
- /**
- * do not use this internal method
- */
- void setParentFieldInternal(ICompositeField f);
-
- /**
- * do not use this internal method
- */
- void postInitConfig() throws ProcessingException;
-
- void initField() throws ProcessingException;
-
- void disposeField();
-
- /**
- * Convenience for {@link #getForm()} . {@link IForm#printField(IFormField, PrintDevice, Map)}
- * <p>
- * The method returns immediately, the print is done int the background.
- * <p>
- * For details and parameter details see {@link PrintDevice}
- */
- void printField(PrintDevice device, Map<String, Object> parameters);
-
- void setView(boolean visible, boolean enabled, boolean mandatory);
-
- /**
- * create a FormData structure to be sent to the backend the configurator is
- * creating typed subclasses of FormData and FormFieldData
- * <p>
- * Do not override this method
- */
- void exportFormFieldData(AbstractFormFieldData target) throws ProcessingException;
-
- /**
- * apply FormData to this form field
- * <p>
- * Do not override this method
- */
- void importFormFieldData(AbstractFormFieldData source, boolean valueChangeTriggersEnabled) throws ProcessingException;
-
- /*
- * XML i/o
- */
- String getXML() throws ProcessingException;
-
- void setXML(String xml) throws ProcessingException;
-
- void storeXML(SimpleXmlElement x) throws ProcessingException;
-
- void loadXML(SimpleXmlElement x) throws ProcessingException;
-
- /**
- * add verbose information to the search filter
- */
- void applySearch(SearchFilter search);
-
- boolean hasProperty(String name);
-
- /**
- * marks field as changing all model events and property events are cached
- * until the change is done
- * <p>
- * when done, all cached events are sent as a batch
- */
- void setFieldChanging(boolean b);
-
- boolean isFieldChanging();
-
- /**
- * This property controls whether value changes are calling {@link AbstractValueField#execChangedValue()}.
- * The {@link IValueField#PROP_VALUE} property change is always fired.
- * <p>
- * When FormFieldData is being applied this property may be set to false, see
- * {@link #importFormFieldData(AbstractFormFieldData, boolean)} to disable sideeffects when the new data is applied to
- * the form
- * <p>
- */
- boolean isValueChangeTriggerEnabled();
-
- /**
- * This property controls whether value changes are calling {@link AbstractValueField#execChangedValue()} The
- * {@link IValueField#PROP_VALUE} property change is always fired.
- * <p>
- * When FormFieldData is being applied this property may be set to false, see
- * {@link #importFormFieldData(AbstractFormFieldData, boolean)} to disable sideeffects when the new data is applied to
- * the form
- * <p>
- * This property is a transitive property, that means callers need not to care when setting and resetting this
- * property multiple times or nested. But they have to care to set/unset this property inside a try...finally block.
- * <p>
- * recommended: <code><xmp>
- * try{
- * setValueChangeTriggerEnabled(false);
- * ...
- * }
- * finally{
- * setValueChangeTriggerEnabled(true);
- * }
- * </xmp></code>
- * <p>
- * do <b>not</b> write: <code><xmp>
- * boolean oldValue=isValueChangeTriggerEnabled();
- * try{
- * setValueChangeTriggerEnabled(false);
- * ...
- * }
- * finally{
- * setValueChangeTriggerEnabled(oldValue);
- * }
- * </xmp></code>
- */
- void setValueChangeTriggerEnabled(boolean b);
-
- /**
- * the default field ID is the simple class name of a field
- */
- String getFieldId();
-
- /**
- * @return Returns the list of fields that are enclosing this field, starting with the furthermost (from outside to
- * inside). An enclosing field is part of the enclosing classes path that is abstract or the outermost
- * enclosing class. The latter is the primary type.
- * @see ConfigurationUtility#getEnclosingContainerType(Object)
- * @since 3.8.1
- */
- List<ICompositeField> getEnclosingFieldList();
-
- String getLabel();
-
- void setLabel(String name);
-
- String getInitialLabel();
-
- void setInitialLabel(String name);
-
- /**
- * @since 19.11.2009
- * @return one of the LABEL_POSITION_* constants or a custom constants
- * interpreted by the ui
- */
- int getLabelPosition();
-
- /**
- * @since 19.11.2009
- * @param pos
- * one of the LABEL_POSITION_* constants or a custom constants
- * interpreted by the ui
- */
- void setLabelPosition(int pos);
-
- /**
- * @since 19.11.2009
- * @return the fixed label witdh &gt;0 or LABEL_WIDTH_DEFAULT or
- * LABEL_WIDTH_UI for ui-dependent label width
- */
- int getLabelWidthInPixel();
-
- /**
- * @since 19.11.2009
- * @param w
- * the fixed label witdh &gt;0 or LABEL_WIDTH_DEFAULT or
- * LABEL_WIDTH_UI for ui-dependent label width
- */
- void setLabelWidthInPixel(int w);
-
- /**
- * @since 19.11.2009
- * @return negative for left, 0 for center and positive for right,
- * LABEL_HORIZONTAL_ALIGNMENT_DEFAULT for default of ui
- */
- int getLabelHorizontalAlignment();
-
- /**
- * @since 19.11.2009
- * @param a
- * negative for left, 0 for center and positive for right,
- * LABEL_HORIZONTAL_ALIGNMENT_DEFAULT for default of ui
- */
- void setLabelHorizontalAlignment(int a);
-
- /**
- * @return fully qualified label. This is the path in the container tree
- */
- String getFullyQualifiedLabel(String separator);
-
- boolean isLabelVisible();
-
- void setLabelVisible(boolean b);
-
- /**
- * Meta property over labelVisible<br>
- * This property is used to suppress the label even if it is visible<br>
- * see {@link ISequenceBox} where the label of the first visible child field
- * is suppressed and appended to the range box's label
- */
- boolean isLabelSuppressed();
-
- void setLabelSuppressed(boolean b);
-
- /**
- * @deprecated Use {@link #getProperty(String)} instead.
- */
- @Deprecated
- Object getCustomProperty(String propName);
-
- /**
- * @deprecated Use {@link #setProperty(String, Object)} instead.
- */
- @Deprecated
- void setCustomProperty(String propName, Object o);
-
- Object getProperty(String name);
-
- /**
- * With this method it's possible to set (custom) properties.
- * <p>
- * <b>Important: </b> Although this method is intended to be used for custom properties, it's actually possible to
- * change main properties as well. Keep in mind that directly changing main properties may result in unexpected
- * behavior, so do it only if you really know what you are doing. Rather use the officially provided api instead. <br>
- * Example for an unexpected behavior: setVisible() does not only set the property PROP_VISIBLE but also executes
- * additional code. This code would NOT be executed by directly setting the property PROP_VISIBLE with setProperty().
- */
- void setProperty(String name, Object value);
-
- boolean isInitialized();
-
- Permission getEnabledPermission();
-
- void setEnabledPermission(Permission p);
-
- /**
- * Enabling of a field has two levels: granting and property level.
- * <p>
- * This is the "harder" level of granting.
- * <p>
- * Note that a field with grantEnabled=false remains disabled even though setEnabled(true) was called.
- */
- boolean isEnabledGranted();
-
- /**
- * Enabling of a field has two levels: granting and property level.
- * <p>
- * This is the "softer" level of property.
- * <p>
- * Note that a field with grantEnabled=false remains disabled even though setEnabled(true) was called.
- */
- boolean getEnabledProperty();
-
- void setEnabledGranted(boolean b);
-
- /**
- * This property is used by buttons. Buttons set the property to false while in work.
- *
- * @return true if process button is not in {@link IButton#doClick()} action
- */
- boolean isEnabledProcessingButton();
-
- void setEnabledProcessingButton(boolean b);
-
- /**
- * @return {@link #isEnabledGranted()} && {@link #getEnabledProperty()}
- */
- boolean isEnabled();
-
- /**
- * do NOT override this method
- */
- void setEnabled(boolean b);
-
- Permission getVisiblePermission();
-
- void setVisiblePermission(Permission p);
-
- boolean isVisibleGranted();
-
- void setVisibleGranted(boolean b);
-
- boolean isVisible();
-
- void setVisible(boolean b);
-
- boolean isMandatory();
-
- void setMandatory(boolean b);
-
- /**
- * @return null iff value is valid, non-null if the currently set value has
- * semantic errors
- */
- IProcessingStatus getErrorStatus();
-
- /**
- * @param status
- * error status of currently set value In order to set a custom icon
- * as the field status, use {@link ScoutFieldStatus}
- */
- void setErrorStatus(IProcessingStatus status);
-
- /**
- * @param message
- * error status of currently set value In order to set a custom icon
- * as the field status, use {@link ScoutFieldStatus}
- */
- void setErrorStatus(String message);
-
- /**
- * @param clear
- * error status
- */
- void clearErrorStatus();
-
- /**
- * @return true if field content (value on value fields) is valid, no error status is set on field and mandatory
- * property is met.
- * Shorthand form for {@link #getContentProblemDescriptor()==null}
- */
- boolean isContentValid();
-
- /**
- * @return either null when everything is valid or a problem descriptor that contains more details.
- */
- IValidateContentDescriptor validateContent();
-
- String getTooltipText();
-
- void setTooltipText(String text);
-
- /**
- * Rebuild the {@link IFormField#PROP_KEY_STROKES} property using the internal
- * set of properties and by calling {@link #getContributedKeyStrokes()} and {@link #getLocalKeyStrokes()}
- */
- void updateKeyStrokes();
-
- /**
- * @return only contributed key strokes
- */
- IKeyStroke[] getContributedKeyStrokes();
-
- /**
- * @return only local key strokes
- */
- IKeyStroke[] getLocalKeyStrokes();
-
- /**
- * @return local and contributed key strokes
- */
- IKeyStroke[] getKeyStrokes();
-
- String getForegroundColor();
-
- void setForegroundColor(String c);
-
- String getBackgroundColor();
-
- void setBackgroundColor(String c);
-
- FontSpec getFont();
-
- void setFont(FontSpec f);
-
- String getLabelForegroundColor();
-
- void setLabelForegroundColor(String c);
-
- String getLabelBackgroundColor();
-
- void setLabelBackgroundColor(String c);
-
- FontSpec getLabelFont();
-
- void setLabelFont(FontSpec f);
-
- /**
- * @return the grid data hints used by the {@link GridDataBuilder} to create the final grid data which can be
- * accessed using {@link #getGridData()}.
- */
- GridData getGridDataHints();
-
- void setGridDataHints(GridData data);
-
- /**
- * @return the resulting (validated) grid data which is also used by the ui layout manager to layout this field
- * in a logical grid.
- */
- GridData getGridData();
-
- /**
- * Sets the life {@link GridData} of this field.<br>
- * Do not use this internal method, for grid layout hints use {@link #setGridDataHints(GridData)}.
- */
- void setGridDataInternal(GridData data);
-
- /**
- * true if the field has data that requires save
- */
- boolean isSaveNeeded();
-
- void checkSaveNeeded();
-
- /**
- * mark form so that<br>
- * {@link IFormField#isSaveNeeded()} returns true
- */
- void touch();
-
- void markSaved();
-
- /**
- * true if the field contains data (semantics)
- */
- boolean isEmpty();
-
- boolean isFocusable();
-
- void setFocusable(boolean b);
-
- /**
- * Convenience for {@link IForm#requestFocus(IFormField)}
- */
- void requestFocus();
-
- /**
- * @deprecated since 3.8
- */
- @Deprecated
- boolean fetchFocusRequested();
-
- /**
- * MasterSlave
- */
- IValueField getMasterField();
-
- void setMasterField(IValueField field);
-
- boolean isMasterRequired();
-
- void setMasterRequired(boolean b);
-
- // commodity helper
- Object getMasterValue();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields;
+
+import java.beans.PropertyChangeListener;
+import java.security.Permission;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.scout.commons.ConfigurationUtility;
+import org.eclipse.scout.commons.beans.IPropertyObserver;
+import org.eclipse.scout.commons.exception.IProcessingStatus;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.xmlparser.SimpleXmlElement;
+import org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke;
+import org.eclipse.scout.rt.client.ui.form.FormEvent;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.client.ui.form.PrintDevice;
+import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractCancelButton;
+import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractOkButton;
+import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
+import org.eclipse.scout.rt.client.ui.form.fields.datefield.IDateField;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox;
+import org.eclipse.scout.rt.client.ui.form.fields.internal.GridDataBuilder;
+import org.eclipse.scout.rt.client.ui.form.fields.sequencebox.ISequenceBox;
+import org.eclipse.scout.rt.client.ui.form.fields.smartfield.ISmartField;
+import org.eclipse.scout.rt.client.ui.form.fields.stringfield.IStringField;
+import org.eclipse.scout.rt.client.ui.form.fields.tabbox.ITabBox;
+import org.eclipse.scout.rt.shared.data.basic.FontSpec;
+import org.eclipse.scout.rt.shared.data.form.fields.AbstractFormFieldData;
+import org.eclipse.scout.rt.shared.services.common.jdbc.SearchFilter;
+
+/**
+ * The {@link IForm} and <code>IFormField</code> classes are the prominent classes
+ * of the application model: An <code>IForm</code> consists of multiple <code>IFormField</code>s.<br/>
+ * A wide variety of form fields exist, the most important are the following:<br/>
+ * <ul>
+ * <li>{@link IValueField}:<br/>
+ * Value fields allow user input through the GUI and contain a value of a certain type. Typical examples are:
+ * <ul>
+ * <li>{@link IStringField}: A text field containing a single line string (no line breaks).</li>
+ * <li>{@link IDateField}: A field containing a formatted date.</li>
+ * <li>{@link ISmartField}: A smart field allows to choose from a possibly predefined list of values.</li>
+ * </ul>
+ * </li>
+ * <li>{@link IButton}:<br/>
+ * Buttons allow the user to trigger events on the GUI. Typical examples on a form are the 'Ok' and 'Close' buttons (see
+ * {@link AbstractOkButton} or {@link AbstractCancelButton}).</li>
+ * <li>{@link IComposite}:<br/>
+ * Composite fields group multiple form fields. The most common are:<br/>
+ * <ul>
+ * <li>{@link IGroupBox}: Groups multiple form fields and draws a border on the GUI.</li>
+ * <li>{@link ITabBox}: Groups multiple form fields which are represented within tabs.</li>
+ * </ul>
+ * </li>
+ * </ul>
+ *
+ * @see IForm
+ */
+public interface IFormField extends IPropertyObserver {
+ /*
+ * Properties
+ */
+ /**
+ * {@link ICompositeField}
+ */
+ String PROP_PARENT_FIELD = "parentField";
+ String PROP_VISIBLE = "visible";
+ String PROP_ENABLED = "enabled";
+ String PROP_MANDATORY = "mandatory";
+ String PROP_ERROR_STATUS = "errorStatus";
+ String PROP_TOOLTIP_TEXT = "tooltipText";
+ String PROP_FOREGROUND_COLOR = "foregroundColor";
+ String PROP_BACKGROUND_COLOR = "backgroundColor";
+ String PROP_FONT = "font";
+ String PROP_LABEL_FOREGROUND_COLOR = "labelForegroundColor";
+ String PROP_LABEL_BACKGROUND_COLOR = "labelBackgroundColor";
+ String PROP_LABEL_FONT = "labelFont";
+ String PROP_SAVE_NEEDED = "saveNeeded";
+ String PROP_EMPTY = "empty";
+ String PROP_LABEL = "label";
+ String PROP_LABEL_VISIBLE = "labelVisible";
+ String PROP_KEY_STROKES = "keyStrokes";
+ /**
+ * @deprecated since 3.8, sent via {@link FormEvent#TYPE_REQUEST_FOCUS}
+ */
+ @Deprecated
+ String PROP_FOCUS_REQUESTED = "focusRequested";
+ /**
+ * if the field is focusable or not, value is of type {@link Boolean}
+ */
+ String PROP_FOCUSABLE = "focusable";// Build 205
+
+ /**
+ * see {@link #getGridDataHints()}<br>
+ * this marker value defines the field to have a logical spanning all over the
+ * group box width
+ */
+ int FULL_WIDTH = 0;
+
+ /**
+ * position the label at the default location (normally left of the field)<br>
+ * see {@link #setLabelPosition(int)} and {@link #getLabelPosition()}
+ */
+ int LABEL_POSITION_DEFAULT = 0;
+ /**
+ * position the label left of the field<br>
+ * see {@link #setLabelPosition(int)} and {@link #getLabelPosition()}
+ */
+ int LABEL_POSITION_LEFT = 1;
+ /**
+ * position the label on the field, meaning that the label is only displayed
+ * when the field is empty (vista style)<br>
+ * see {@link #setLabelPosition(int)} and {@link #getLabelPosition()}
+ */
+ int LABEL_POSITION_ON_FIELD = 2;
+ /**
+ * position the label right of the field<br>
+ * see {@link #setLabelPosition(int)} and {@link #getLabelPosition()}
+ */
+ int LABEL_POSITION_RIGHT = 3;
+
+ /**
+ * position the label on the top of the field
+ */
+ int LABEL_POSITION_TOP = 4;
+
+ /**
+ * use the systemwide default label with see {@link #setLabelWidthInPixel(int)} and {@link #getLabelWidthInPixel()}
+ */
+ int LABEL_WIDTH_DEFAULT = 0;
+
+ /**
+ * use the ui-specific "real" with of the label see {@link #setLabelWidthInPixel(int)} and
+ * {@link #getLabelWidthInPixel()}
+ */
+ int LABEL_WIDTH_UI = -1;
+
+ /**
+ * use the systemwide default label alignment
+ */
+ int LABEL_HORIZONTAL_ALIGNMENT_DEFAULT = 1000;
+
+ IForm getForm();
+
+ /**
+ * Use this listener only in very rare cases and only if absolutely needed
+ * (performance!)
+ */
+ void addSubtreePropertyChangeListener(PropertyChangeListener listener);
+
+ /**
+ * Use this listener only in very rare cases and only if absolutely needed
+ * (performance!)
+ */
+ void addSubtreePropertyChangeListener(String propName, PropertyChangeListener listener);
+
+ void removeSubtreePropertyChangeListener(PropertyChangeListener listener);
+
+ void removeSubtreePropertyChangeListener(String propName, PropertyChangeListener listener);
+
+ /**
+ * do not use this internal method
+ */
+ void setFormInternal(IForm form);
+
+ /**
+ * get the first ancestor of this field (not including this field) which is of
+ * type IGroupBox
+ */
+ IGroupBox getParentGroupBox();
+
+ /**
+ * get the first ancestor of this field (not including this field) which is of
+ * type ICompositeField
+ */
+ ICompositeField getParentField();
+
+ /**
+ * do not use this internal method
+ */
+ void setParentFieldInternal(ICompositeField f);
+
+ /**
+ * do not use this internal method
+ */
+ void postInitConfig() throws ProcessingException;
+
+ void initField() throws ProcessingException;
+
+ void disposeField();
+
+ /**
+ * Convenience for {@link #getForm()} . {@link IForm#printField(IFormField, PrintDevice, Map)}
+ * <p>
+ * The method returns immediately, the print is done int the background.
+ * <p>
+ * For details and parameter details see {@link PrintDevice}
+ */
+ void printField(PrintDevice device, Map<String, Object> parameters);
+
+ void setView(boolean visible, boolean enabled, boolean mandatory);
+
+ /**
+ * create a FormData structure to be sent to the backend the configurator is
+ * creating typed subclasses of FormData and FormFieldData
+ * <p>
+ * Do not override this method
+ */
+ void exportFormFieldData(AbstractFormFieldData target) throws ProcessingException;
+
+ /**
+ * apply FormData to this form field
+ * <p>
+ * Do not override this method
+ */
+ void importFormFieldData(AbstractFormFieldData source, boolean valueChangeTriggersEnabled) throws ProcessingException;
+
+ /*
+ * XML i/o
+ */
+ String getXML() throws ProcessingException;
+
+ void setXML(String xml) throws ProcessingException;
+
+ void storeXML(SimpleXmlElement x) throws ProcessingException;
+
+ void loadXML(SimpleXmlElement x) throws ProcessingException;
+
+ /**
+ * add verbose information to the search filter
+ */
+ void applySearch(SearchFilter search);
+
+ boolean hasProperty(String name);
+
+ /**
+ * marks field as changing all model events and property events are cached
+ * until the change is done
+ * <p>
+ * when done, all cached events are sent as a batch
+ */
+ void setFieldChanging(boolean b);
+
+ boolean isFieldChanging();
+
+ /**
+ * This property controls whether value changes are calling {@link AbstractValueField#execChangedValue()}.
+ * The {@link IValueField#PROP_VALUE} property change is always fired.
+ * <p>
+ * When FormFieldData is being applied this property may be set to false, see
+ * {@link #importFormFieldData(AbstractFormFieldData, boolean)} to disable sideeffects when the new data is applied to
+ * the form
+ * <p>
+ */
+ boolean isValueChangeTriggerEnabled();
+
+ /**
+ * This property controls whether value changes are calling {@link AbstractValueField#execChangedValue()} The
+ * {@link IValueField#PROP_VALUE} property change is always fired.
+ * <p>
+ * When FormFieldData is being applied this property may be set to false, see
+ * {@link #importFormFieldData(AbstractFormFieldData, boolean)} to disable sideeffects when the new data is applied to
+ * the form
+ * <p>
+ * This property is a transitive property, that means callers need not to care when setting and resetting this
+ * property multiple times or nested. But they have to care to set/unset this property inside a try...finally block.
+ * <p>
+ * recommended: <code><xmp>
+ * try{
+ * setValueChangeTriggerEnabled(false);
+ * ...
+ * }
+ * finally{
+ * setValueChangeTriggerEnabled(true);
+ * }
+ * </xmp></code>
+ * <p>
+ * do <b>not</b> write: <code><xmp>
+ * boolean oldValue=isValueChangeTriggerEnabled();
+ * try{
+ * setValueChangeTriggerEnabled(false);
+ * ...
+ * }
+ * finally{
+ * setValueChangeTriggerEnabled(oldValue);
+ * }
+ * </xmp></code>
+ */
+ void setValueChangeTriggerEnabled(boolean b);
+
+ /**
+ * the default field ID is the simple class name of a field
+ */
+ String getFieldId();
+
+ /**
+ * @return Returns the list of fields that are enclosing this field, starting with the furthermost (from outside to
+ * inside). An enclosing field is part of the enclosing classes path that is abstract or the outermost
+ * enclosing class. The latter is the primary type.
+ * @see ConfigurationUtility#getEnclosingContainerType(Object)
+ * @since 3.8.1
+ */
+ List<ICompositeField> getEnclosingFieldList();
+
+ String getLabel();
+
+ void setLabel(String name);
+
+ String getInitialLabel();
+
+ void setInitialLabel(String name);
+
+ /**
+ * @since 19.11.2009
+ * @return one of the LABEL_POSITION_* constants or a custom constants
+ * interpreted by the ui
+ */
+ int getLabelPosition();
+
+ /**
+ * @since 19.11.2009
+ * @param pos
+ * one of the LABEL_POSITION_* constants or a custom constants
+ * interpreted by the ui
+ */
+ void setLabelPosition(int pos);
+
+ /**
+ * @since 19.11.2009
+ * @return the fixed label witdh &gt;0 or LABEL_WIDTH_DEFAULT or
+ * LABEL_WIDTH_UI for ui-dependent label width
+ */
+ int getLabelWidthInPixel();
+
+ /**
+ * @since 19.11.2009
+ * @param w
+ * the fixed label witdh &gt;0 or LABEL_WIDTH_DEFAULT or
+ * LABEL_WIDTH_UI for ui-dependent label width
+ */
+ void setLabelWidthInPixel(int w);
+
+ /**
+ * @since 19.11.2009
+ * @return negative for left, 0 for center and positive for right,
+ * LABEL_HORIZONTAL_ALIGNMENT_DEFAULT for default of ui
+ */
+ int getLabelHorizontalAlignment();
+
+ /**
+ * @since 19.11.2009
+ * @param a
+ * negative for left, 0 for center and positive for right,
+ * LABEL_HORIZONTAL_ALIGNMENT_DEFAULT for default of ui
+ */
+ void setLabelHorizontalAlignment(int a);
+
+ /**
+ * @return fully qualified label. This is the path in the container tree
+ */
+ String getFullyQualifiedLabel(String separator);
+
+ boolean isLabelVisible();
+
+ void setLabelVisible(boolean b);
+
+ /**
+ * Meta property over labelVisible<br>
+ * This property is used to suppress the label even if it is visible<br>
+ * see {@link ISequenceBox} where the label of the first visible child field
+ * is suppressed and appended to the range box's label
+ */
+ boolean isLabelSuppressed();
+
+ void setLabelSuppressed(boolean b);
+
+ /**
+ * @deprecated Use {@link #getProperty(String)} instead.
+ */
+ @Deprecated
+ Object getCustomProperty(String propName);
+
+ /**
+ * @deprecated Use {@link #setProperty(String, Object)} instead.
+ */
+ @Deprecated
+ void setCustomProperty(String propName, Object o);
+
+ Object getProperty(String name);
+
+ /**
+ * With this method it's possible to set (custom) properties.
+ * <p>
+ * <b>Important: </b> Although this method is intended to be used for custom properties, it's actually possible to
+ * change main properties as well. Keep in mind that directly changing main properties may result in unexpected
+ * behavior, so do it only if you really know what you are doing. Rather use the officially provided api instead. <br>
+ * Example for an unexpected behavior: setVisible() does not only set the property PROP_VISIBLE but also executes
+ * additional code. This code would NOT be executed by directly setting the property PROP_VISIBLE with setProperty().
+ */
+ void setProperty(String name, Object value);
+
+ boolean isInitialized();
+
+ Permission getEnabledPermission();
+
+ void setEnabledPermission(Permission p);
+
+ /**
+ * Enabling of a field has two levels: granting and property level.
+ * <p>
+ * This is the "harder" level of granting.
+ * <p>
+ * Note that a field with grantEnabled=false remains disabled even though setEnabled(true) was called.
+ */
+ boolean isEnabledGranted();
+
+ /**
+ * Enabling of a field has two levels: granting and property level.
+ * <p>
+ * This is the "softer" level of property.
+ * <p>
+ * Note that a field with grantEnabled=false remains disabled even though setEnabled(true) was called.
+ */
+ boolean getEnabledProperty();
+
+ void setEnabledGranted(boolean b);
+
+ /**
+ * This property is used by buttons. Buttons set the property to false while in work.
+ *
+ * @return true if process button is not in {@link IButton#doClick()} action
+ */
+ boolean isEnabledProcessingButton();
+
+ void setEnabledProcessingButton(boolean b);
+
+ /**
+ * @return {@link #isEnabledGranted()} && {@link #getEnabledProperty()}
+ */
+ boolean isEnabled();
+
+ /**
+ * do NOT override this method
+ */
+ void setEnabled(boolean b);
+
+ Permission getVisiblePermission();
+
+ void setVisiblePermission(Permission p);
+
+ boolean isVisibleGranted();
+
+ void setVisibleGranted(boolean b);
+
+ boolean isVisible();
+
+ void setVisible(boolean b);
+
+ boolean isMandatory();
+
+ void setMandatory(boolean b);
+
+ /**
+ * @return null iff value is valid, non-null if the currently set value has
+ * semantic errors
+ */
+ IProcessingStatus getErrorStatus();
+
+ /**
+ * @param status
+ * error status of currently set value In order to set a custom icon
+ * as the field status, use {@link ScoutFieldStatus}
+ */
+ void setErrorStatus(IProcessingStatus status);
+
+ /**
+ * @param message
+ * error status of currently set value In order to set a custom icon
+ * as the field status, use {@link ScoutFieldStatus}
+ */
+ void setErrorStatus(String message);
+
+ /**
+ * @param clear
+ * error status
+ */
+ void clearErrorStatus();
+
+ /**
+ * @return true if field content (value on value fields) is valid, no error status is set on field and mandatory
+ * property is met.
+ * Shorthand form for {@link #getContentProblemDescriptor()==null}
+ */
+ boolean isContentValid();
+
+ /**
+ * @return either null when everything is valid or a problem descriptor that contains more details.
+ */
+ IValidateContentDescriptor validateContent();
+
+ String getTooltipText();
+
+ void setTooltipText(String text);
+
+ /**
+ * Rebuild the {@link IFormField#PROP_KEY_STROKES} property using the internal
+ * set of properties and by calling {@link #getContributedKeyStrokes()} and {@link #getLocalKeyStrokes()}
+ */
+ void updateKeyStrokes();
+
+ /**
+ * @return only contributed key strokes
+ */
+ IKeyStroke[] getContributedKeyStrokes();
+
+ /**
+ * @return only local key strokes
+ */
+ IKeyStroke[] getLocalKeyStrokes();
+
+ /**
+ * @return local and contributed key strokes
+ */
+ IKeyStroke[] getKeyStrokes();
+
+ String getForegroundColor();
+
+ void setForegroundColor(String c);
+
+ String getBackgroundColor();
+
+ void setBackgroundColor(String c);
+
+ FontSpec getFont();
+
+ void setFont(FontSpec f);
+
+ String getLabelForegroundColor();
+
+ void setLabelForegroundColor(String c);
+
+ String getLabelBackgroundColor();
+
+ void setLabelBackgroundColor(String c);
+
+ FontSpec getLabelFont();
+
+ void setLabelFont(FontSpec f);
+
+ /**
+ * @return the grid data hints used by the {@link GridDataBuilder} to create the final grid data which can be
+ * accessed using {@link #getGridData()}.
+ */
+ GridData getGridDataHints();
+
+ void setGridDataHints(GridData data);
+
+ /**
+ * @return the resulting (validated) grid data which is also used by the ui layout manager to layout this field
+ * in a logical grid.
+ */
+ GridData getGridData();
+
+ /**
+ * Sets the life {@link GridData} of this field.<br>
+ * Do not use this internal method, for grid layout hints use {@link #setGridDataHints(GridData)}.
+ */
+ void setGridDataInternal(GridData data);
+
+ /**
+ * true if the field has data that requires save
+ */
+ boolean isSaveNeeded();
+
+ void checkSaveNeeded();
+
+ /**
+ * mark form so that<br>
+ * {@link IFormField#isSaveNeeded()} returns true
+ */
+ void touch();
+
+ void markSaved();
+
+ /**
+ * true if the field contains data (semantics)
+ */
+ boolean isEmpty();
+
+ boolean isFocusable();
+
+ void setFocusable(boolean b);
+
+ /**
+ * Convenience for {@link IForm#requestFocus(IFormField)}
+ */
+ void requestFocus();
+
+ /**
+ * @deprecated since 3.8
+ */
+ @Deprecated
+ boolean fetchFocusRequested();
+
+ /**
+ * MasterSlave
+ */
+ IValueField getMasterField();
+
+ void setMasterField(IValueField field);
+
+ boolean isMasterRequired();
+
+ void setMasterRequired(boolean b);
+
+ // commodity helper
+ Object getMasterValue();
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/IValidateContentDescriptor.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/IValidateContentDescriptor.java
index 69e0e2cab0..edb1a10b7d 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/IValidateContentDescriptor.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/IValidateContentDescriptor.java
@@ -1,34 +1,34 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields;
-
-import org.eclipse.scout.commons.exception.IProcessingStatus;
-
-/**
- * This interface is used to check fields for valid content and - in case invalid - activate / select / focus the
- * appropriate location
- * <p>
- * see {@link IFormField#validateContent()}
- */
-public interface IValidateContentDescriptor {
-
- /**
- * @return the name of the location/field/part
- */
- String getDisplayText();
-
- IProcessingStatus getErrorStatus();
-
- /**
- * activate / select / focus the appropriate location
- */
- void activateProblemLocation();
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields;
+
+import org.eclipse.scout.commons.exception.IProcessingStatus;
+
+/**
+ * This interface is used to check fields for valid content and - in case invalid - activate / select / focus the
+ * appropriate location
+ * <p>
+ * see {@link IFormField#validateContent()}
+ */
+public interface IValidateContentDescriptor {
+
+ /**
+ * @return the name of the location/field/part
+ */
+ String getDisplayText();
+
+ IProcessingStatus getErrorStatus();
+
+ /**
+ * activate / select / focus the appropriate location
+ */
+ void activateProblemLocation();
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/IValueField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/IValueField.java
index e0abf0bb79..3268f3019f 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/IValueField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/IValueField.java
@@ -1,110 +1,110 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields;
-
-import org.eclipse.scout.commons.holders.IHolder;
-
-/**
- * Basic interface for all user fields where user inputs a value
- *
- * @see ITextField, ISmartField, INumberField, IDateField, IFileChooser,
- * IListBox, ITreeBox, ICheckBox, IRadioButton, IToogleButton
- */
-public interface IValueField<T> extends IFormField, IHolder<T> {
- /*
- * Properties
- */
- String PROP_DISPLAY_TEXT = "displayText";
- String PROP_VALUE = "value";
-
- /**
- * set field value to initValue and clear all error flags
- */
- void resetValue();
-
- void refreshDisplayText();
-
- /**
- * Property to signal that component value is being verified for example
- * smartfield text-> value resolution This flag indicates that the ui value of
- * the field changed and that the value needs to be resolved This is a
- * ui-to-model-process. This process contains the subprocess {@link #isValueChanging()}.
- */
- boolean isValueParsing();
-
- /**
- * Property to signal that component value is being set This flag indicates
- * that the component value changed and validate triggers as well as change
- * triggers are being processed This is a model-to-model-process This process
- * can be part of the {@link #isValueParsing()} process. This process contains
- * the subprocess {@link #isValueValidating()}.
- */
- boolean isValueChanging();
-
- /**
- * Property to signal that component value is being validated This flag
- * indicates that the component value changed and validate triggers as well as
- * change triggers are being processed This is a model-to-model-process This
- * process is part of the {@link #isValueChanging()} process.
- */
- boolean isValueValidating();
-
- void addMasterListener(MasterListener listener);
-
- void removeMasterListener(MasterListener listener);
-
- /**
- * Value
- */
- T getInitValue();
-
- void setInitValue(T initValue);
-
- /**
- * get currently validated value
- */
- @Override
- T getValue();
-
- /**
- * set a new value The new value is validated calls validateInternal and then
- * delegates to execValidateValue after setting the value calls
- * execChangedValue
- */
- @Override
- void setValue(T o);
-
- /**
- * parse a new value The new value is parsed calls execParseValue which
- * delegates to parseValueInternal Then the value is validated calls
- * validateInternal and then delegates to execValidateValue after setting the
- * value calls execChangedValue
- */
- boolean parseValue(String text);
-
- String getDisplayText();
-
- void setDisplayText(String s);
-
- boolean isAutoDisplayText();
-
- void setAutoDisplayText(boolean b);
-
- /**
- * force a fire of valueChanged even if the value has not changed This can be
- * used to manually re-trigger value change processing in complex business
- * logic
- *
- * @see setValue()
- */
- void fireValueChanged();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields;
+
+import org.eclipse.scout.commons.holders.IHolder;
+
+/**
+ * Basic interface for all user fields where user inputs a value
+ *
+ * @see ITextField, ISmartField, INumberField, IDateField, IFileChooser,
+ * IListBox, ITreeBox, ICheckBox, IRadioButton, IToogleButton
+ */
+public interface IValueField<T> extends IFormField, IHolder<T> {
+ /*
+ * Properties
+ */
+ String PROP_DISPLAY_TEXT = "displayText";
+ String PROP_VALUE = "value";
+
+ /**
+ * set field value to initValue and clear all error flags
+ */
+ void resetValue();
+
+ void refreshDisplayText();
+
+ /**
+ * Property to signal that component value is being verified for example
+ * smartfield text-> value resolution This flag indicates that the ui value of
+ * the field changed and that the value needs to be resolved This is a
+ * ui-to-model-process. This process contains the subprocess {@link #isValueChanging()}.
+ */
+ boolean isValueParsing();
+
+ /**
+ * Property to signal that component value is being set This flag indicates
+ * that the component value changed and validate triggers as well as change
+ * triggers are being processed This is a model-to-model-process This process
+ * can be part of the {@link #isValueParsing()} process. This process contains
+ * the subprocess {@link #isValueValidating()}.
+ */
+ boolean isValueChanging();
+
+ /**
+ * Property to signal that component value is being validated This flag
+ * indicates that the component value changed and validate triggers as well as
+ * change triggers are being processed This is a model-to-model-process This
+ * process is part of the {@link #isValueChanging()} process.
+ */
+ boolean isValueValidating();
+
+ void addMasterListener(MasterListener listener);
+
+ void removeMasterListener(MasterListener listener);
+
+ /**
+ * Value
+ */
+ T getInitValue();
+
+ void setInitValue(T initValue);
+
+ /**
+ * get currently validated value
+ */
+ @Override
+ T getValue();
+
+ /**
+ * set a new value The new value is validated calls validateInternal and then
+ * delegates to execValidateValue after setting the value calls
+ * execChangedValue
+ */
+ @Override
+ void setValue(T o);
+
+ /**
+ * parse a new value The new value is parsed calls execParseValue which
+ * delegates to parseValueInternal Then the value is validated calls
+ * validateInternal and then delegates to execValidateValue after setting the
+ * value calls execChangedValue
+ */
+ boolean parseValue(String text);
+
+ String getDisplayText();
+
+ void setDisplayText(String s);
+
+ boolean isAutoDisplayText();
+
+ void setAutoDisplayText(boolean b);
+
+ /**
+ * force a fire of valueChanged even if the value has not changed This can be
+ * used to manually re-trigger value change processing in complex business
+ * logic
+ *
+ * @see setValue()
+ */
+ void fireValueChanged();
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/MasterListener.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/MasterListener.java
index 79091c1d3e..2095d83d64 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/MasterListener.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/MasterListener.java
@@ -1,17 +1,17 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields;
-
-import java.util.EventListener;
-
-public interface MasterListener extends EventListener {
- void masterChanged(Object masterValue);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields;
+
+import java.util.EventListener;
+
+public interface MasterListener extends EventListener {
+ void masterChanged(Object masterValue);
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/ParsingFailedStatus.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/ParsingFailedStatus.java
index df0deee4f4..d8548635c2 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/ParsingFailedStatus.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/ParsingFailedStatus.java
@@ -1,30 +1,30 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields;
-
-import org.eclipse.scout.commons.exception.IProcessingStatus;
-
-/**
- * Marker subclass so we know inside setValue that a previous parse failure was
- * catched inside the local parse method and can safely be cleared once parsing
- * succeeded.
- */
-public class ParsingFailedStatus extends ScoutFieldStatus {
- private static final long serialVersionUID = 1L;
-
- public ParsingFailedStatus(String message) {
- super(message, ERROR);
- }
-
- public ParsingFailedStatus(IProcessingStatus s) {
- super(s, ERROR);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields;
+
+import org.eclipse.scout.commons.exception.IProcessingStatus;
+
+/**
+ * Marker subclass so we know inside setValue that a previous parse failure was
+ * catched inside the local parse method and can safely be cleared once parsing
+ * succeeded.
+ */
+public class ParsingFailedStatus extends ScoutFieldStatus {
+ private static final long serialVersionUID = 1L;
+
+ public ParsingFailedStatus(String message) {
+ super(message, ERROR);
+ }
+
+ public ParsingFailedStatus(IProcessingStatus s) {
+ super(s, ERROR);
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/ScoutFieldStatus.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/ScoutFieldStatus.java
index 2ea41bceb9..3bd0732baa 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/ScoutFieldStatus.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/ScoutFieldStatus.java
@@ -1,54 +1,54 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields;
-
-import org.eclipse.scout.commons.exception.IProcessingStatus;
-import org.eclipse.scout.commons.exception.ProcessingStatus;
-import org.eclipse.scout.rt.shared.AbstractIcons;
-
-/**
- * Status type for form fields with additional property "iconId"
- */
-public class ScoutFieldStatus extends ProcessingStatus {
- private static final long serialVersionUID = 1L;
-
- public ScoutFieldStatus(String message, int severity) {
- super(message, null, 0, severity);
- }
-
- public ScoutFieldStatus(String message, String iconId, int severity) {
- super(message, null, 0, severity);
- setIconId(iconId);
- }
-
- public ScoutFieldStatus(IProcessingStatus s, int severity) {
- super(s);
- setSeverity(severity);
- }
-
- private String m_iconId;
-
- /**
- * icon id are defined either in {@link AbstractIcons} or in the project
- * specific subclass named Icons
- */
- public String getIconId() {
- return m_iconId;
- }
-
- /**
- * icon id are defined either in {@link AbstractIcons} or in the project
- * specific subclass named Icons
- */
- public void setIconId(String s) {
- m_iconId = s;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields;
+
+import org.eclipse.scout.commons.exception.IProcessingStatus;
+import org.eclipse.scout.commons.exception.ProcessingStatus;
+import org.eclipse.scout.rt.shared.AbstractIcons;
+
+/**
+ * Status type for form fields with additional property "iconId"
+ */
+public class ScoutFieldStatus extends ProcessingStatus {
+ private static final long serialVersionUID = 1L;
+
+ public ScoutFieldStatus(String message, int severity) {
+ super(message, null, 0, severity);
+ }
+
+ public ScoutFieldStatus(String message, String iconId, int severity) {
+ super(message, null, 0, severity);
+ setIconId(iconId);
+ }
+
+ public ScoutFieldStatus(IProcessingStatus s, int severity) {
+ super(s);
+ setSeverity(severity);
+ }
+
+ private String m_iconId;
+
+ /**
+ * icon id are defined either in {@link AbstractIcons} or in the project
+ * specific subclass named Icons
+ */
+ public String getIconId() {
+ return m_iconId;
+ }
+
+ /**
+ * icon id are defined either in {@link AbstractIcons} or in the project
+ * specific subclass named Icons
+ */
+ public void setIconId(String s) {
+ m_iconId = s;
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/ValidateFormFieldDescriptor.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/ValidateFormFieldDescriptor.java
index a71c183978..1cdc956f8b 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/ValidateFormFieldDescriptor.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/ValidateFormFieldDescriptor.java
@@ -1,57 +1,57 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields;
-
-import org.eclipse.scout.commons.exception.IProcessingStatus;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox;
-import org.eclipse.scout.rt.client.ui.form.fields.tabbox.ITabBox;
-
-/**
- * This interface is used to check fields for valid content and - in case invalid - activate / select / focus the
- * appropriate location
- * <p>
- * see {@link IFormField#validateContent()}
- */
-public class ValidateFormFieldDescriptor implements IValidateContentDescriptor {
- private final IFormField m_field;
- private final IProcessingStatus m_errorStatus;
-
- public ValidateFormFieldDescriptor(IFormField field) {
- m_field = field;
- m_errorStatus = field.getErrorStatus();
- }
-
- @Override
- public String getDisplayText() {
- return m_field.getFullyQualifiedLabel(": ");
- }
-
- @Override
- public IProcessingStatus getErrorStatus() {
- return m_errorStatus;
- }
-
- @Override
- public void activateProblemLocation() {
- //make sure the table is showing (activate parent tabs)
- IGroupBox g = m_field.getParentGroupBox();
- while (g != null) {
- if (g.getParentField() instanceof ITabBox) {
- ITabBox t = (ITabBox) g.getParentField();
- if (t.getSelectedTab() != g) {
- t.setSelectedTab(g);
- }
- }
- g = g.getParentGroupBox();
- }
- m_field.requestFocus();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields;
+
+import org.eclipse.scout.commons.exception.IProcessingStatus;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox;
+import org.eclipse.scout.rt.client.ui.form.fields.tabbox.ITabBox;
+
+/**
+ * This interface is used to check fields for valid content and - in case invalid - activate / select / focus the
+ * appropriate location
+ * <p>
+ * see {@link IFormField#validateContent()}
+ */
+public class ValidateFormFieldDescriptor implements IValidateContentDescriptor {
+ private final IFormField m_field;
+ private final IProcessingStatus m_errorStatus;
+
+ public ValidateFormFieldDescriptor(IFormField field) {
+ m_field = field;
+ m_errorStatus = field.getErrorStatus();
+ }
+
+ @Override
+ public String getDisplayText() {
+ return m_field.getFullyQualifiedLabel(": ");
+ }
+
+ @Override
+ public IProcessingStatus getErrorStatus() {
+ return m_errorStatus;
+ }
+
+ @Override
+ public void activateProblemLocation() {
+ //make sure the table is showing (activate parent tabs)
+ IGroupBox g = m_field.getParentGroupBox();
+ while (g != null) {
+ if (g.getParentField() instanceof ITabBox) {
+ ITabBox t = (ITabBox) g.getParentField();
+ if (t.getSelectedTab() != g) {
+ t.setSelectedTab(g);
+ }
+ }
+ g = g.getParentGroupBox();
+ }
+ m_field.requestFocus();
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/ValidationFailedStatus.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/ValidationFailedStatus.java
index 2f670811a9..3782de12bb 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/ValidationFailedStatus.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/ValidationFailedStatus.java
@@ -1,30 +1,30 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields;
-
-import org.eclipse.scout.commons.exception.IProcessingStatus;
-
-/**
- * Marker subclass so we know inside setValue that this was a previous
- * validation failure that was catched. Once validation is successful the error
- * status of this type can safely be cleared.
- */
-public class ValidationFailedStatus extends ScoutFieldStatus {
- private static final long serialVersionUID = 1L;
-
- public ValidationFailedStatus(String message) {
- super(message, WARNING);
- }
-
- public ValidationFailedStatus(IProcessingStatus s) {
- super(s, WARNING);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields;
+
+import org.eclipse.scout.commons.exception.IProcessingStatus;
+
+/**
+ * Marker subclass so we know inside setValue that this was a previous
+ * validation failure that was catched. Once validation is successful the error
+ * status of this type can safely be cleared.
+ */
+public class ValidationFailedStatus extends ScoutFieldStatus {
+ private static final long serialVersionUID = 1L;
+
+ public ValidationFailedStatus(String message) {
+ super(message, WARNING);
+ }
+
+ public ValidationFailedStatus(IProcessingStatus s) {
+ super(s, WARNING);
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/bigdecimalfield/AbstractBigDecimalField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/bigdecimalfield/AbstractBigDecimalField.java
index c3391ef04b..cf39db5aa4 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/bigdecimalfield/AbstractBigDecimalField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/bigdecimalfield/AbstractBigDecimalField.java
@@ -1,107 +1,107 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.bigdecimalfield;
-
-import java.math.BigDecimal;
-import java.text.DecimalFormat;
-import java.text.NumberFormat;
-import java.text.ParsePosition;
-
-import org.eclipse.scout.commons.LocaleThreadLocal;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.form.fields.decimalfield.AbstractDecimalField;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.data.form.ValidationRule;
-
-public abstract class AbstractBigDecimalField extends AbstractDecimalField<BigDecimal> implements IBigDecimalField {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractBigDecimalField.class);
-
- public AbstractBigDecimalField() {
- this(true);
- }
-
- public AbstractBigDecimalField(boolean callInitializer) {
- super(callInitializer);
- }
-
- /*
- * Configuration
- */
- @ConfigProperty(ConfigProperty.DOUBLE)
- @Order(300)
- @ConfigPropertyValue("null")
- @ValidationRule(ValidationRule.MIN_VALUE)
- protected Double getConfiguredMinValue() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.DOUBLE)
- @Order(310)
- @ConfigPropertyValue("null")
- @ValidationRule(ValidationRule.MAX_VALUE)
- protected Double getConfiguredMaxValue() {
- return null;
- }
-
- @Override
- protected void initConfig() {
- super.initConfig();
- setMinValue(getConfiguredMinValue() != null ? BigDecimal.valueOf(getConfiguredMinValue()) : null);
- setMaxValue(getConfiguredMaxValue() != null ? BigDecimal.valueOf(getConfiguredMaxValue()) : null);
- }
-
- // convert string to a real long
- @Override
- protected BigDecimal parseValueInternal(String text) throws ProcessingException {
- BigDecimal retVal = null;
- if (text == null) {
- text = "";
- }
- else {
- text = text.trim();
- }
- if (text.length() > 0) {
- NumberFormat numberFormat = createNumberFormat();
- if (isPercent()) {
- if (text.endsWith("%")) {
- text = StringUtility.trim(text.substring(0, text.length() - 1));
- }
- String suffix = "%";
- if (numberFormat instanceof DecimalFormat) {
- suffix = ((DecimalFormat) numberFormat).getPositiveSuffix();
- }
- text = StringUtility.concatenateTokens(text, suffix);
- }
- ParsePosition p = new ParsePosition(0);
- Number n = numberFormat.parse(text, p);
- if (p.getErrorIndex() >= 0 || p.getIndex() != text.length()) {
- throw new ProcessingException(ScoutTexts.get("InvalidNumberMessageX", text));
- }
- NumberFormat fmt = NumberFormat.getNumberInstance(LocaleThreadLocal.get());
- /* add/preserve fraction digits for multiplier */
- int npc = ("" + Math.abs(getMultiplier())).length() - 1;
- fmt.setMaximumFractionDigits(getFractionDigits() + npc);
- p = new ParsePosition(0);
- String fmtText = fmt.format(n.doubleValue());
- retVal = BigDecimal.valueOf(fmt.parse(fmtText, p).doubleValue());
- if (p.getErrorIndex() >= 0 || p.getIndex() != fmtText.length()) {
- throw new ProcessingException(ScoutTexts.get("InvalidNumberMessageX", fmtText));
- }
- }
- return retVal;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.bigdecimalfield;
+
+import java.math.BigDecimal;
+import java.text.DecimalFormat;
+import java.text.NumberFormat;
+import java.text.ParsePosition;
+
+import org.eclipse.scout.commons.LocaleThreadLocal;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.form.fields.decimalfield.AbstractDecimalField;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.data.form.ValidationRule;
+
+public abstract class AbstractBigDecimalField extends AbstractDecimalField<BigDecimal> implements IBigDecimalField {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractBigDecimalField.class);
+
+ public AbstractBigDecimalField() {
+ this(true);
+ }
+
+ public AbstractBigDecimalField(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ /*
+ * Configuration
+ */
+ @ConfigProperty(ConfigProperty.DOUBLE)
+ @Order(300)
+ @ConfigPropertyValue("null")
+ @ValidationRule(ValidationRule.MIN_VALUE)
+ protected Double getConfiguredMinValue() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.DOUBLE)
+ @Order(310)
+ @ConfigPropertyValue("null")
+ @ValidationRule(ValidationRule.MAX_VALUE)
+ protected Double getConfiguredMaxValue() {
+ return null;
+ }
+
+ @Override
+ protected void initConfig() {
+ super.initConfig();
+ setMinValue(getConfiguredMinValue() != null ? BigDecimal.valueOf(getConfiguredMinValue()) : null);
+ setMaxValue(getConfiguredMaxValue() != null ? BigDecimal.valueOf(getConfiguredMaxValue()) : null);
+ }
+
+ // convert string to a real long
+ @Override
+ protected BigDecimal parseValueInternal(String text) throws ProcessingException {
+ BigDecimal retVal = null;
+ if (text == null) {
+ text = "";
+ }
+ else {
+ text = text.trim();
+ }
+ if (text.length() > 0) {
+ NumberFormat numberFormat = createNumberFormat();
+ if (isPercent()) {
+ if (text.endsWith("%")) {
+ text = StringUtility.trim(text.substring(0, text.length() - 1));
+ }
+ String suffix = "%";
+ if (numberFormat instanceof DecimalFormat) {
+ suffix = ((DecimalFormat) numberFormat).getPositiveSuffix();
+ }
+ text = StringUtility.concatenateTokens(text, suffix);
+ }
+ ParsePosition p = new ParsePosition(0);
+ Number n = numberFormat.parse(text, p);
+ if (p.getErrorIndex() >= 0 || p.getIndex() != text.length()) {
+ throw new ProcessingException(ScoutTexts.get("InvalidNumberMessageX", text));
+ }
+ NumberFormat fmt = NumberFormat.getNumberInstance(LocaleThreadLocal.get());
+ /* add/preserve fraction digits for multiplier */
+ int npc = ("" + Math.abs(getMultiplier())).length() - 1;
+ fmt.setMaximumFractionDigits(getFractionDigits() + npc);
+ p = new ParsePosition(0);
+ String fmtText = fmt.format(n.doubleValue());
+ retVal = BigDecimal.valueOf(fmt.parse(fmtText, p).doubleValue());
+ if (p.getErrorIndex() >= 0 || p.getIndex() != fmtText.length()) {
+ throw new ProcessingException(ScoutTexts.get("InvalidNumberMessageX", fmtText));
+ }
+ }
+ return retVal;
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/bigdecimalfield/IBigDecimalField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/bigdecimalfield/IBigDecimalField.java
index 2599a1f26e..7f254e73c2 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/bigdecimalfield/IBigDecimalField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/bigdecimalfield/IBigDecimalField.java
@@ -1,19 +1,19 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.bigdecimalfield;
-
-import java.math.BigDecimal;
-
-import org.eclipse.scout.rt.client.ui.form.fields.decimalfield.IDecimalField;
-
-public interface IBigDecimalField extends IDecimalField<BigDecimal> {
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.bigdecimalfield;
+
+import java.math.BigDecimal;
+
+import org.eclipse.scout.rt.client.ui.form.fields.decimalfield.IDecimalField;
+
+public interface IBigDecimalField extends IDecimalField<BigDecimal> {
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/bigintegerfield/AbstractBigIntegerField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/bigintegerfield/AbstractBigIntegerField.java
index 3112d1a13f..1c962d6eff 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/bigintegerfield/AbstractBigIntegerField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/bigintegerfield/AbstractBigIntegerField.java
@@ -1,83 +1,83 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.bigintegerfield;
-
-import java.math.BigInteger;
-import java.text.ParsePosition;
-
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.form.fields.numberfield.AbstractNumberField;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.data.form.ValidationRule;
-
-public abstract class AbstractBigIntegerField extends AbstractNumberField<BigInteger> implements IBigIntegerField {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractBigIntegerField.class);
-
- public AbstractBigIntegerField() {
- this(true);
- }
-
- public AbstractBigIntegerField(boolean callInitializer) {
- super(callInitializer);
- }
-
- /*
- * Configuration
- */
- @ConfigProperty(ConfigProperty.LONG)
- @Order(250)
- @ConfigPropertyValue("null")
- @ValidationRule(ValidationRule.MIN_VALUE)
- protected Long getConfiguredMinValue() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.LONG)
- @Order(260)
- @ConfigPropertyValue("null")
- @ValidationRule(ValidationRule.MAX_VALUE)
- protected Long getConfiguredMaxValue() {
- return null;
- }
-
- @Override
- protected void initConfig() {
- super.initConfig();
- setMinValue(getConfiguredMinValue() != null ? BigInteger.valueOf(getConfiguredMinValue()) : null);
- setMaxValue(getConfiguredMaxValue() != null ? BigInteger.valueOf(getConfiguredMaxValue()) : null);
- }
-
- @Override
- protected BigInteger parseValueInternal(String text) throws ProcessingException {
- BigInteger retVal = null;
- if (text == null) {
- text = "";
- }
- else {
- text = text.trim();
- }
- if (text.length() > 0) {
- ParsePosition p = new ParsePosition(0);
- Number n = createNumberFormat().parse(text, p);
- if (p.getErrorIndex() >= 0 || p.getIndex() != text.length()) {
- throw new ProcessingException(ScoutTexts.get("InvalidNumberMessageX", text));
- }
- retVal = new BigInteger("" + n.toString());
- }
- return retVal;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.bigintegerfield;
+
+import java.math.BigInteger;
+import java.text.ParsePosition;
+
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.form.fields.numberfield.AbstractNumberField;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.data.form.ValidationRule;
+
+public abstract class AbstractBigIntegerField extends AbstractNumberField<BigInteger> implements IBigIntegerField {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractBigIntegerField.class);
+
+ public AbstractBigIntegerField() {
+ this(true);
+ }
+
+ public AbstractBigIntegerField(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ /*
+ * Configuration
+ */
+ @ConfigProperty(ConfigProperty.LONG)
+ @Order(250)
+ @ConfigPropertyValue("null")
+ @ValidationRule(ValidationRule.MIN_VALUE)
+ protected Long getConfiguredMinValue() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.LONG)
+ @Order(260)
+ @ConfigPropertyValue("null")
+ @ValidationRule(ValidationRule.MAX_VALUE)
+ protected Long getConfiguredMaxValue() {
+ return null;
+ }
+
+ @Override
+ protected void initConfig() {
+ super.initConfig();
+ setMinValue(getConfiguredMinValue() != null ? BigInteger.valueOf(getConfiguredMinValue()) : null);
+ setMaxValue(getConfiguredMaxValue() != null ? BigInteger.valueOf(getConfiguredMaxValue()) : null);
+ }
+
+ @Override
+ protected BigInteger parseValueInternal(String text) throws ProcessingException {
+ BigInteger retVal = null;
+ if (text == null) {
+ text = "";
+ }
+ else {
+ text = text.trim();
+ }
+ if (text.length() > 0) {
+ ParsePosition p = new ParsePosition(0);
+ Number n = createNumberFormat().parse(text, p);
+ if (p.getErrorIndex() >= 0 || p.getIndex() != text.length()) {
+ throw new ProcessingException(ScoutTexts.get("InvalidNumberMessageX", text));
+ }
+ retVal = new BigInteger("" + n.toString());
+ }
+ return retVal;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/bigintegerfield/IBigIntegerField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/bigintegerfield/IBigIntegerField.java
index 4863644043..5e2e920518 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/bigintegerfield/IBigIntegerField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/bigintegerfield/IBigIntegerField.java
@@ -1,19 +1,19 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.bigintegerfield;
-
-import java.math.BigInteger;
-
-import org.eclipse.scout.rt.client.ui.form.fields.numberfield.INumberField;
-
-public interface IBigIntegerField extends INumberField<BigInteger> {
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.bigintegerfield;
+
+import java.math.BigInteger;
+
+import org.eclipse.scout.rt.client.ui.form.fields.numberfield.INumberField;
+
+public interface IBigIntegerField extends INumberField<BigInteger> {
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/booleanfield/AbstractBooleanField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/booleanfield/AbstractBooleanField.java
index 5d74db47af..a0fc383dab 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/booleanfield/AbstractBooleanField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/booleanfield/AbstractBooleanField.java
@@ -1,111 +1,111 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.booleanfield;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.form.fields.AbstractValueField;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-
-public abstract class AbstractBooleanField extends AbstractValueField<Boolean> implements IBooleanField {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractBooleanField.class);
-
- private IBooleanFieldUIFacade m_uiFacade;
-
- public AbstractBooleanField() {
- this(true);
- }
-
- public AbstractBooleanField(boolean callInitializer) {
- super(callInitializer);
- }
-
- @Override
- protected void initConfig() {
- m_uiFacade = new P_UIFacade();
- super.initConfig();
- // ticket 79554
- /* setAutoDisplayText(false); */
- propertySupport.setProperty(PROP_VALUE, false);
- // ticket 79554
- propertySupport.setProperty(PROP_DISPLAY_TEXT, execFormatValue(getValue()));
- }
-
- @Override
- public void setChecked(boolean b) {
- setValue(b);
- }
-
- @Override
- public boolean isChecked() {
- return getValue() != null && getValue().booleanValue();
- }
-
- // format value for display
- @Override
- protected String formatValueInternal(Boolean validValue) {
- if (validValue == null) {
- return "";
- }
- // ticket 79554
- return validValue ? ScoutTexts.get("Yes") : ScoutTexts.get("No");
- }
-
- // validate value for ranges
- @Override
- protected Boolean validateValueInternal(Boolean rawValue) throws ProcessingException {
- Boolean validValue = null;
- rawValue = super.validateValueInternal(rawValue);
- validValue = rawValue;
- if (validValue == null) {
- validValue = false;
- }
- return validValue;
- }
-
- // convert string to a boolean
- @Override
- protected Boolean parseValueInternal(String text) throws ProcessingException {
- Boolean retVal = null;
- if (text != null && text.length() == 0) {
- text = null;
- }
- if (text != null) {
- if (text.equals("1")) {
- retVal = true;
- }
- else if (text.equalsIgnoreCase("true")) {
- retVal = true;
- }
- else {
- retVal = false;
- }
- }
- return retVal;
- }
-
- @Override
- public IBooleanFieldUIFacade getUIFacade() {
- return m_uiFacade;
- }
-
- private class P_UIFacade implements IBooleanFieldUIFacade {
- @Override
- public void setSelectedFromUI(boolean checked) {
- if (isEnabled() && isVisible()) {
- setChecked(checked);
- }
- }
-
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.booleanfield;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.form.fields.AbstractValueField;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+
+public abstract class AbstractBooleanField extends AbstractValueField<Boolean> implements IBooleanField {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractBooleanField.class);
+
+ private IBooleanFieldUIFacade m_uiFacade;
+
+ public AbstractBooleanField() {
+ this(true);
+ }
+
+ public AbstractBooleanField(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ @Override
+ protected void initConfig() {
+ m_uiFacade = new P_UIFacade();
+ super.initConfig();
+ // ticket 79554
+ /* setAutoDisplayText(false); */
+ propertySupport.setProperty(PROP_VALUE, false);
+ // ticket 79554
+ propertySupport.setProperty(PROP_DISPLAY_TEXT, execFormatValue(getValue()));
+ }
+
+ @Override
+ public void setChecked(boolean b) {
+ setValue(b);
+ }
+
+ @Override
+ public boolean isChecked() {
+ return getValue() != null && getValue().booleanValue();
+ }
+
+ // format value for display
+ @Override
+ protected String formatValueInternal(Boolean validValue) {
+ if (validValue == null) {
+ return "";
+ }
+ // ticket 79554
+ return validValue ? ScoutTexts.get("Yes") : ScoutTexts.get("No");
+ }
+
+ // validate value for ranges
+ @Override
+ protected Boolean validateValueInternal(Boolean rawValue) throws ProcessingException {
+ Boolean validValue = null;
+ rawValue = super.validateValueInternal(rawValue);
+ validValue = rawValue;
+ if (validValue == null) {
+ validValue = false;
+ }
+ return validValue;
+ }
+
+ // convert string to a boolean
+ @Override
+ protected Boolean parseValueInternal(String text) throws ProcessingException {
+ Boolean retVal = null;
+ if (text != null && text.length() == 0) {
+ text = null;
+ }
+ if (text != null) {
+ if (text.equals("1")) {
+ retVal = true;
+ }
+ else if (text.equalsIgnoreCase("true")) {
+ retVal = true;
+ }
+ else {
+ retVal = false;
+ }
+ }
+ return retVal;
+ }
+
+ @Override
+ public IBooleanFieldUIFacade getUIFacade() {
+ return m_uiFacade;
+ }
+
+ private class P_UIFacade implements IBooleanFieldUIFacade {
+ @Override
+ public void setSelectedFromUI(boolean checked) {
+ if (isEnabled() && isVisible()) {
+ setChecked(checked);
+ }
+ }
+
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/booleanfield/IBooleanField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/booleanfield/IBooleanField.java
index d27668429c..9092be4e59 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/booleanfield/IBooleanField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/booleanfield/IBooleanField.java
@@ -1,25 +1,25 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.booleanfield;
-
-import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
-
-public interface IBooleanField extends IValueField<Boolean> {
- /**
- * Configuration
- */
-
- void setChecked(boolean b);
-
- boolean isChecked();
-
- IBooleanFieldUIFacade getUIFacade();
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.booleanfield;
+
+import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
+
+public interface IBooleanField extends IValueField<Boolean> {
+ /**
+ * Configuration
+ */
+
+ void setChecked(boolean b);
+
+ boolean isChecked();
+
+ IBooleanFieldUIFacade getUIFacade();
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/booleanfield/IBooleanFieldUIFacade.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/booleanfield/IBooleanFieldUIFacade.java
index d8c40c95c7..1b4582c579 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/booleanfield/IBooleanFieldUIFacade.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/booleanfield/IBooleanFieldUIFacade.java
@@ -1,16 +1,16 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.booleanfield;
-
-public interface IBooleanFieldUIFacade {
-
- void setSelectedFromUI(boolean checked);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.booleanfield;
+
+public interface IBooleanFieldUIFacade {
+
+ void setSelectedFromUI(boolean checked);
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/browserfield/AbstractBrowserField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/browserfield/AbstractBrowserField.java
index 0d1e3f9b33..b74c142bfc 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/browserfield/AbstractBrowserField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/browserfield/AbstractBrowserField.java
@@ -1,163 +1,163 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.browserfield;
-
-import java.net.URL;
-
-import org.eclipse.scout.commons.annotations.ConfigOperation;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.ui.form.fields.AbstractValueField;
-import org.eclipse.scout.rt.shared.services.common.file.RemoteFile;
-import org.eclipse.scout.rt.shared.services.common.jdbc.SearchFilter;
-
-public abstract class AbstractBrowserField extends AbstractValueField<RemoteFile> implements IBrowserField {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractBrowserField.class);
-
- private IBrowserFieldUIFacade m_uiFacade;
- private boolean m_scrollBarEnabled;
-
- public AbstractBrowserField() {
- this(true);
- }
-
- public AbstractBrowserField(boolean callInitializer) {
- super(callInitializer);
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(250)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredScrollBarEnabled() {
- return false;
- }
-
- /**
- * This callback is invoked before the link is followed, it can be used as handler and vetoer. The default returns
- * true.<br>
- * If there is more to do then simply return true/false, put the
- * code in a {@link ClientSyncJob} to prevent deadlocks and other problems
- *
- * @return true to accept this location, false to prevent the browser from going to that location (equal to browser
- * esc/stop button)
- * @param location
- * @param path
- * may be null for locations like about:blank or javascript:... {@link URL#getPath()}
- * @param local
- * true if the url is not a valid external url but a local model url
- * (http://local/...)
- */
- @ConfigOperation
- @Order(230)
- protected boolean execAcceptLocationChange(String location, String path, boolean local) throws ProcessingException {
- return true;
- }
-
- /**
- * This callback is invoked after the link was followed, thus it is already at that location
- * <p>
- * The default does noting.
- *
- * @param location
- * @param path
- * may be null for locations like about:blank or javascript:... {@link URL#getPath()}
- * @param local
- * true if the url is not a valid external url but a local model url
- * (http://local/...)
- */
- @ConfigOperation
- @Order(230)
- protected void execLocationChanged(String location, String path, boolean local) throws ProcessingException {
- }
-
- @Override
- protected void initConfig() {
- m_uiFacade = new P_UIFacade();
- super.initConfig();
- m_scrollBarEnabled = getConfiguredScrollBarEnabled();
- }
-
- @Override
- protected void applySearchInternal(SearchFilter search) {
- //nop
- }
-
- @Override
- public void doLocationChange(String location) throws ProcessingException {
- if (getUIFacade().fireBeforeLocationChangedFromUI(location)) {
- getUIFacade().fireAfterLocationChangedFromUI(location);
- }
- }
-
- @Override
- public void setLocation(String location) {
- propertySupport.setProperty(PROP_LOCATION, location);
- }
-
- @Override
- public String getLocation() {
- return (String) propertySupport.getProperty(PROP_LOCATION);
- }
-
- @Override
- public IBrowserFieldUIFacade getUIFacade() {
- return m_uiFacade;
- }
-
- @Override
- public boolean isScrollBarEnabled() {
- return m_scrollBarEnabled;
- }
-
- private class P_UIFacade implements IBrowserFieldUIFacade {
-
- @Override
- public boolean fireBeforeLocationChangedFromUI(String location) {
- try {
- URL url = null;
- try {
- url = new URL(location);
- }
- catch (Throwable t) {
- //nop
- }
- return execAcceptLocationChange(location, url != null ? url.getPath() : null, url != null && url.getHost().equals("local"));
- }
- catch (Throwable t) {
- LOG.error("location: " + location, t);
- }
- return false;
- }
-
- @Override
- public void fireAfterLocationChangedFromUI(String location) {
- try {
- URL url = null;
- try {
- url = new URL(location);
- }
- catch (Throwable t) {
- //nop
- }
- execLocationChanged(location, url != null ? url.getPath() : null, url != null && url.getHost().equals("local"));
- }
- catch (Throwable t) {
- LOG.error("location: " + location, t);
- }
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.browserfield;
+
+import java.net.URL;
+
+import org.eclipse.scout.commons.annotations.ConfigOperation;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.ui.form.fields.AbstractValueField;
+import org.eclipse.scout.rt.shared.services.common.file.RemoteFile;
+import org.eclipse.scout.rt.shared.services.common.jdbc.SearchFilter;
+
+public abstract class AbstractBrowserField extends AbstractValueField<RemoteFile> implements IBrowserField {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractBrowserField.class);
+
+ private IBrowserFieldUIFacade m_uiFacade;
+ private boolean m_scrollBarEnabled;
+
+ public AbstractBrowserField() {
+ this(true);
+ }
+
+ public AbstractBrowserField(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(250)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredScrollBarEnabled() {
+ return false;
+ }
+
+ /**
+ * This callback is invoked before the link is followed, it can be used as handler and vetoer. The default returns
+ * true.<br>
+ * If there is more to do then simply return true/false, put the
+ * code in a {@link ClientSyncJob} to prevent deadlocks and other problems
+ *
+ * @return true to accept this location, false to prevent the browser from going to that location (equal to browser
+ * esc/stop button)
+ * @param location
+ * @param path
+ * may be null for locations like about:blank or javascript:... {@link URL#getPath()}
+ * @param local
+ * true if the url is not a valid external url but a local model url
+ * (http://local/...)
+ */
+ @ConfigOperation
+ @Order(230)
+ protected boolean execAcceptLocationChange(String location, String path, boolean local) throws ProcessingException {
+ return true;
+ }
+
+ /**
+ * This callback is invoked after the link was followed, thus it is already at that location
+ * <p>
+ * The default does noting.
+ *
+ * @param location
+ * @param path
+ * may be null for locations like about:blank or javascript:... {@link URL#getPath()}
+ * @param local
+ * true if the url is not a valid external url but a local model url
+ * (http://local/...)
+ */
+ @ConfigOperation
+ @Order(230)
+ protected void execLocationChanged(String location, String path, boolean local) throws ProcessingException {
+ }
+
+ @Override
+ protected void initConfig() {
+ m_uiFacade = new P_UIFacade();
+ super.initConfig();
+ m_scrollBarEnabled = getConfiguredScrollBarEnabled();
+ }
+
+ @Override
+ protected void applySearchInternal(SearchFilter search) {
+ //nop
+ }
+
+ @Override
+ public void doLocationChange(String location) throws ProcessingException {
+ if (getUIFacade().fireBeforeLocationChangedFromUI(location)) {
+ getUIFacade().fireAfterLocationChangedFromUI(location);
+ }
+ }
+
+ @Override
+ public void setLocation(String location) {
+ propertySupport.setProperty(PROP_LOCATION, location);
+ }
+
+ @Override
+ public String getLocation() {
+ return (String) propertySupport.getProperty(PROP_LOCATION);
+ }
+
+ @Override
+ public IBrowserFieldUIFacade getUIFacade() {
+ return m_uiFacade;
+ }
+
+ @Override
+ public boolean isScrollBarEnabled() {
+ return m_scrollBarEnabled;
+ }
+
+ private class P_UIFacade implements IBrowserFieldUIFacade {
+
+ @Override
+ public boolean fireBeforeLocationChangedFromUI(String location) {
+ try {
+ URL url = null;
+ try {
+ url = new URL(location);
+ }
+ catch (Throwable t) {
+ //nop
+ }
+ return execAcceptLocationChange(location, url != null ? url.getPath() : null, url != null && url.getHost().equals("local"));
+ }
+ catch (Throwable t) {
+ LOG.error("location: " + location, t);
+ }
+ return false;
+ }
+
+ @Override
+ public void fireAfterLocationChangedFromUI(String location) {
+ try {
+ URL url = null;
+ try {
+ url = new URL(location);
+ }
+ catch (Throwable t) {
+ //nop
+ }
+ execLocationChanged(location, url != null ? url.getPath() : null, url != null && url.getHost().equals("local"));
+ }
+ catch (Throwable t) {
+ LOG.error("location: " + location, t);
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/browserfield/IBrowserField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/browserfield/IBrowserField.java
index 3ce2feadba..4c08770550 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/browserfield/IBrowserField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/browserfield/IBrowserField.java
@@ -1,58 +1,58 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.browserfield;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
-import org.eclipse.scout.rt.shared.services.common.file.RemoteFile;
-
-/**
- * This model represents a UI specific browser, in swing it is a JEditorPane html viewer/editor, in swt it is the native
- * browser.
- * This may be changed by adding a fragment that uses the swt Browser in swing
- * (org.eclipse.scout.rt.ui.swing.browser.swt.fragment)
- * <p>
- * The content is either the value (remote file) or the {@link #setExternalURL()}
- * <p>
- * The content of the website is contained in the remote file that is the value of this field. The remote file may be a
- * html file or a zip file containing a html file (with same name) and additional resources such as images, styles etc.
- * <p>
- * Uses {@link RemoteFile#writeZipContentToDirectory(java.io.File)} to unpack zipped content for viewing
- * <p>
- * You can use local urls that call back to the field itself and can be handled by overriding
- * {@link AbstractBrowserField#execLocationChanged(String, String, boolean)} A local URL is one of the form
- * http://local/...
- */
-public interface IBrowserField extends IValueField<RemoteFile> {
-
- String PROP_SCROLLBARS_ENABLED = "scrollBarsEnabled";
- /**
- * String
- */
- String PROP_LOCATION = "location";
-
- boolean isScrollBarEnabled();
-
- IBrowserFieldUIFacade getUIFacade();
-
- /**
- * emulate a location change in order to handle it in the model
- */
- void doLocationChange(String location) throws ProcessingException;
-
- /**
- * instead of using local content, show an external location
- */
- void setLocation(String url);
-
- String getLocation();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.browserfield;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
+import org.eclipse.scout.rt.shared.services.common.file.RemoteFile;
+
+/**
+ * This model represents a UI specific browser, in swing it is a JEditorPane html viewer/editor, in swt it is the native
+ * browser.
+ * This may be changed by adding a fragment that uses the swt Browser in swing
+ * (org.eclipse.scout.rt.ui.swing.browser.swt.fragment)
+ * <p>
+ * The content is either the value (remote file) or the {@link #setExternalURL()}
+ * <p>
+ * The content of the website is contained in the remote file that is the value of this field. The remote file may be a
+ * html file or a zip file containing a html file (with same name) and additional resources such as images, styles etc.
+ * <p>
+ * Uses {@link RemoteFile#writeZipContentToDirectory(java.io.File)} to unpack zipped content for viewing
+ * <p>
+ * You can use local urls that call back to the field itself and can be handled by overriding
+ * {@link AbstractBrowserField#execLocationChanged(String, String, boolean)} A local URL is one of the form
+ * http://local/...
+ */
+public interface IBrowserField extends IValueField<RemoteFile> {
+
+ String PROP_SCROLLBARS_ENABLED = "scrollBarsEnabled";
+ /**
+ * String
+ */
+ String PROP_LOCATION = "location";
+
+ boolean isScrollBarEnabled();
+
+ IBrowserFieldUIFacade getUIFacade();
+
+ /**
+ * emulate a location change in order to handle it in the model
+ */
+ void doLocationChange(String location) throws ProcessingException;
+
+ /**
+ * instead of using local content, show an external location
+ */
+ void setLocation(String url);
+
+ String getLocation();
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/browserfield/IBrowserFieldUIFacade.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/browserfield/IBrowserFieldUIFacade.java
index 78330b1aab..9ffaa220f4 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/browserfield/IBrowserFieldUIFacade.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/browserfield/IBrowserFieldUIFacade.java
@@ -1,22 +1,22 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.browserfield;
-
-public interface IBrowserFieldUIFacade {
-
- /**
- * return true to accept, false to veto the change
- */
- boolean fireBeforeLocationChangedFromUI(String location);
-
- void fireAfterLocationChangedFromUI(String location);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.browserfield;
+
+public interface IBrowserFieldUIFacade {
+
+ /**
+ * return true to accept, false to veto the change
+ */
+ boolean fireBeforeLocationChangedFromUI(String location);
+
+ void fireAfterLocationChangedFromUI(String location);
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractButton.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractButton.java
index 1c74e901a4..3230d17a43 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractButton.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractButton.java
@@ -1,476 +1,476 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.button;
-
-import java.util.ArrayList;
-import java.util.EventListener;
-import java.util.List;
-
-import org.eclipse.scout.commons.ConfigurationUtility;
-import org.eclipse.scout.commons.EventListenerList;
-import org.eclipse.scout.commons.OptimisticLock;
-import org.eclipse.scout.commons.annotations.ConfigOperation;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.services.common.icon.IIconProviderService;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.form.fields.AbstractFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.radiobuttongroup.AbstractRadioButtonGroup;
-import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
-import org.eclipse.scout.service.SERVICES;
-
-public abstract class AbstractButton extends AbstractFormField implements IButton {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractButton.class);
-
- private final EventListenerList m_listenerList = new EventListenerList();
- private int m_systemType;
- private int m_displayStyle;
- private boolean m_processButton;
- private Object m_radioValue;
- private IMenu[] m_menus;
- private final IButtonUIFacade m_uiFacade;
- private final OptimisticLock m_uiFacadeSetSelectedLock;
-
- public AbstractButton() {
- this(true);
- }
-
- public AbstractButton(boolean callInitializer) {
- super(false);
- m_uiFacade = new P_UIFacade();
- m_uiFacadeSetSelectedLock = new OptimisticLock();
- if (callInitializer) {
- callInitializer();
- }
- }
-
- /*
- * Configuration
- */
- /**
- * Configures the system type of this button. See {@code IButton.SYSTEM_TYPE_* } constants for valid values.
- * System buttons are buttons with pre-defined behavior (such as an 'Ok' button or a 'Cancel' button).
- * <p>
- * Subclasses can override this method. Default is {@code IButton.SYSTEM_TYPE_NONE}.
- *
- * @return the system type for a system button, or {@code IButton.SYSTEM_TYPE_NONE} for a non-system button
- * @see IButton
- */
- @ConfigProperty(ConfigProperty.BUTTON_SYSTEM_TYPE)
- @Order(200)
- @ConfigPropertyValue("SYSTEM_TYPE_NONE")
- protected int getConfiguredSystemType() {
- return SYSTEM_TYPE_NONE;
- }
-
- /**
- * Configures whether this button is a process button. Process buttons are typically displayed on a
- * dedicated button bar at the bottom of a form. Non-process buttons can be placed anywhere on a form.
- * <p>
- * Subclasses can override this method. Default is {@code true}.
- *
- * @return {@code true} if this button is a process button, {@code false} otherwise
- * @see IButton
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(220)
- @ConfigPropertyValue("true")
- protected boolean getConfiguredProcessButton() {
- return true;
- }
-
- /**
- * Configures the display style of this button. See {@code IButton.DISPLAY_STYLE_* } constants for valid values.
- * <p>
- * Subclasses can override this method. Default is {@code IButton.DISPLAY_STYLE_DEFAULT}.
- *
- * @return the display style of this button
- * @see IButton
- */
- @ConfigProperty(ConfigProperty.BUTTON_DISPLAY_STYLE)
- @Order(210)
- @ConfigPropertyValue("DISPLAY_STYLE_DEFAULT")
- protected int getConfiguredDisplayStyle() {
- return DISPLAY_STYLE_DEFAULT;
- }
-
- /**
- * {@inheritDoc} Default for buttons is false because they usually should only take as much place as is needed to
- * display the button label, but not necessarily more. See also {@link #getConfiguredGridUseUiWidth()}.
- */
- @ConfigPropertyValue("false")
- @Override
- protected boolean getConfiguredFillHorizontal() {
- return false;
- }
-
- /**
- * {@inheritDoc} Default for buttons is false because they usually should only take as much place as is needed to
- * display the button label, but not necessarily more.
- */
- @ConfigPropertyValue("false")
- @Override
- protected boolean getConfiguredFillVertical() {
- return false;
- }
-
- /**
- * {@inheritDoc} Default for buttons is true because they usually should only take as much place as is needed to
- * display the button label, but not necessarily more.
- */
- @ConfigPropertyValue("true")
- @Override
- protected boolean getConfiguredGridUseUiWidth() {
- return true;
- }
-
- /**
- * {@inheritDoc}
- */
- @ConfigPropertyValue("false")
- @Override
- protected boolean getConfiguredGridUseUiHeight() {
- return false;
- }
-
- /**
- * Configures the value represented by this radio button. This is the value that is
- * returned if you query a radio button group for the current value and this button is the
- * currently selected radio button.
- * <p>
- * Subclasses can override this method. Default is {@code null}.
- *
- * @return an {@code Object} representing the value of this radio button
- * @see AbstractRadioButton
- * @see AbstractRadioButtonGroup
- */
- @ConfigProperty(ConfigProperty.OBJECT)
- @Order(230)
- @ConfigPropertyValue("null")
- protected Object getConfiguredRadioValue() {
- return null;
- }
-
- /**
- * Configures the icon for this button. The icon is displayed on the button itself. Depending on UI and look and feel,
- * this button might support icon groups to represent different states of this button, such as enabled, disabled,
- * mouse-over etc.
- * <p>
- * Subclasses can override this method. Default is {@code null}.
- *
- * @return the ID (name) of the icon
- * @see IIconGroup
- * @see IIconProviderService
- */
- @ConfigProperty(ConfigProperty.ICON_ID)
- @Order(190)
- @ConfigPropertyValue("null")
- protected String getConfiguredIconId() {
- return null;
- }
-
- /**
- * Called whenever this button is clicked. This button is disabled and cannot be clicked again
- * until this method returns.
- * <p>
- * Subclasses can override this method. The default does nothing.
- *
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(190)
- protected void execClickAction() throws ProcessingException {
- }
-
- /**
- * Called whenever the state of a toggle button or radio button changes.
- * <p>
- * Subclasses can override this method. The default does nothing.
- *
- * @param selected
- * new state of the button
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(200)
- protected void execToggleAction(boolean selected) throws ProcessingException {
- }
-
- private Class<? extends IMenu>[] getConfiguredMenus() {
- Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
- return ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, IMenu.class);
- }
-
- @Override
- protected void initConfig() {
- super.initConfig();
- setSystemType(getConfiguredSystemType());
- setDisplayStyleInternal(getConfiguredDisplayStyle());
- setProcessButton(getConfiguredProcessButton());
- setIconId(getConfiguredIconId());
- setRadioValue(getConfiguredRadioValue());
- // menus
- ArrayList<IMenu> menuList = new ArrayList<IMenu>();
- Class<? extends IMenu>[] menuArray = getConfiguredMenus();
- for (int i = 0; i < menuArray.length; i++) {
- IMenu menu;
- try {
- menu = ConfigurationUtility.newInnerInstance(this, menuArray[i]);
- menuList.add(menu);
- }
- catch (Throwable t) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("menu: " + menuArray[i].getName(), t));
- }
- }
- try {
- injectMenusInternal(menuList);
- }
- catch (Exception e) {
- LOG.error("error occured while dynamically contributing menus.", e);
- }
- m_menus = menuList.toArray(new IMenu[0]);
- }
-
- /**
- * Override this internal method only in order to make use of dynamic menus<br>
- * Used to manage menu list and add/remove menus
- *
- * @param menuList
- * live and mutable list of configured menus
- */
- protected void injectMenusInternal(List<IMenu> menuList) {
- }
-
- /*
- * Properties
- */
- @Override
- public String getIconId() {
- return propertySupport.getPropertyString(PROP_ICON_ID);
- }
-
- @Override
- public void setIconId(String iconId) {
- propertySupport.setPropertyString(PROP_ICON_ID, iconId);
- }
-
- @Override
- public Object getImage() {
- return propertySupport.getProperty(PROP_IMAGE);
- }
-
- @Override
- public void setImage(Object nativeImg) {
- propertySupport.setProperty(PROP_IMAGE, nativeImg);
- }
-
- @Override
- public int getSystemType() {
- return m_systemType;
- }
-
- @Override
- public void setSystemType(int systemType) {
- m_systemType = systemType;
- }
-
- @Override
- public boolean isProcessButton() {
- return m_processButton;
- }
-
- @Override
- public void setProcessButton(boolean on) {
- m_processButton = on;
- }
-
- @Override
- public boolean hasMenus() {
- return m_menus.length > 0;
- }
-
- @Override
- public IMenu[] getMenus() {
- return m_menus;
- }
-
- @Override
- public void doClick() throws ProcessingException {
- if (isEnabled() && isVisible() && isEnabledProcessingButton()) {
- try {
- setEnabledProcessingButton(false);
-
- fireButtonClicked();
- execClickAction();
- }
- finally {
- setEnabledProcessingButton(true);
- }
- }
- }
-
- /*
- * Radio Buttons
- */
- @Override
- public Object getRadioValue() {
- return m_radioValue;
- }
-
- @Override
- public void setRadioValue(Object o) {
- m_radioValue = o;
- }
-
- /**
- * Toggle and Radio Buttons
- */
- @Override
- public boolean isSelected() {
- return propertySupport.getPropertyBool(PROP_SELECTED);
- }
-
- /**
- * Toggle and Radio Buttons
- */
- @Override
- public void setSelected(boolean b) {
- boolean changed = propertySupport.setPropertyBool(PROP_SELECTED, b);
- // single observer for config
- if (changed) {
- try {
- execToggleAction(b);
- }
- catch (ProcessingException e) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- }
- }
-
- @Override
- public void disarm() {
- fireDisarmButton();
- }
-
- @Override
- public void requestPopup() {
- fireRequestPopup();
- }
-
- @Override
- public int getDisplayStyle() {
- return m_displayStyle;
- }
-
- @Override
- public void setDisplayStyleInternal(int i) {
- m_displayStyle = i;
- }
-
- @Override
- public IButtonUIFacade getUIFacade() {
- return m_uiFacade;
- }
-
- /**
- * Model Observer
- */
- @Override
- public void addButtonListener(ButtonListener listener) {
- m_listenerList.add(ButtonListener.class, listener);
- }
-
- @Override
- public void removeButtonListener(ButtonListener listener) {
- m_listenerList.remove(ButtonListener.class, listener);
- }
-
- private void fireButtonClicked() {
- fireButtonEvent(new ButtonEvent(this, ButtonEvent.TYPE_CLICKED));
- }
-
- private void fireDisarmButton() {
- fireButtonEvent(new ButtonEvent(this, ButtonEvent.TYPE_DISARM));
- }
-
- private void fireRequestPopup() {
- fireButtonEvent(new ButtonEvent(this, ButtonEvent.TYPE_REQUEST_POPUP));
- }
-
- private IMenu[] fireButtonPopup() {
- ButtonEvent e = new ButtonEvent(this, ButtonEvent.TYPE_POPUP);
- // single observer add our menus
- IMenu[] a = getMenus();
- for (int i = 0; i < a.length; i++) {
- IMenu m = a[i];
- m.prepareAction();
- if (m.isVisible()) {
- e.addPopupMenu(m);
- }
- }
- fireButtonEvent(e);
- return e.getPopupMenus();
- }
-
- // main handler
- private void fireButtonEvent(ButtonEvent e) {
- EventListener[] listeners = m_listenerList.getListeners(ButtonListener.class);
- if (listeners != null && listeners.length > 0) {
- for (int i = 0; i < listeners.length; i++) {
- ((ButtonListener) listeners[i]).buttonChanged(e);
- }
- }
- }
-
- /**
- * Default implementation for buttons
- */
- private class P_UIFacade implements IButtonUIFacade {
- @Override
- public void fireButtonClickedFromUI() {
- try {
- if (isEnabled() && isVisible()) {
- doClick();
- }
- }
- catch (ProcessingException e) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- }
-
- @Override
- public IMenu[] fireButtonPopupFromUI() {
- return fireButtonPopup();
- }
-
- /**
- * Toggle and Radio Buttons
- */
- @Override
- public void setSelectedFromUI(boolean b) {
- try {
- /*
- * Ticket 76711: added optimistic lock
- */
- if (m_uiFacadeSetSelectedLock.acquire()) {
- setSelected(b);
- }
- }
- finally {
- m_uiFacadeSetSelectedLock.release();
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.button;
+
+import java.util.ArrayList;
+import java.util.EventListener;
+import java.util.List;
+
+import org.eclipse.scout.commons.ConfigurationUtility;
+import org.eclipse.scout.commons.EventListenerList;
+import org.eclipse.scout.commons.OptimisticLock;
+import org.eclipse.scout.commons.annotations.ConfigOperation;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.services.common.icon.IIconProviderService;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.form.fields.AbstractFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.radiobuttongroup.AbstractRadioButtonGroup;
+import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
+import org.eclipse.scout.service.SERVICES;
+
+public abstract class AbstractButton extends AbstractFormField implements IButton {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractButton.class);
+
+ private final EventListenerList m_listenerList = new EventListenerList();
+ private int m_systemType;
+ private int m_displayStyle;
+ private boolean m_processButton;
+ private Object m_radioValue;
+ private IMenu[] m_menus;
+ private final IButtonUIFacade m_uiFacade;
+ private final OptimisticLock m_uiFacadeSetSelectedLock;
+
+ public AbstractButton() {
+ this(true);
+ }
+
+ public AbstractButton(boolean callInitializer) {
+ super(false);
+ m_uiFacade = new P_UIFacade();
+ m_uiFacadeSetSelectedLock = new OptimisticLock();
+ if (callInitializer) {
+ callInitializer();
+ }
+ }
+
+ /*
+ * Configuration
+ */
+ /**
+ * Configures the system type of this button. See {@code IButton.SYSTEM_TYPE_* } constants for valid values.
+ * System buttons are buttons with pre-defined behavior (such as an 'Ok' button or a 'Cancel' button).
+ * <p>
+ * Subclasses can override this method. Default is {@code IButton.SYSTEM_TYPE_NONE}.
+ *
+ * @return the system type for a system button, or {@code IButton.SYSTEM_TYPE_NONE} for a non-system button
+ * @see IButton
+ */
+ @ConfigProperty(ConfigProperty.BUTTON_SYSTEM_TYPE)
+ @Order(200)
+ @ConfigPropertyValue("SYSTEM_TYPE_NONE")
+ protected int getConfiguredSystemType() {
+ return SYSTEM_TYPE_NONE;
+ }
+
+ /**
+ * Configures whether this button is a process button. Process buttons are typically displayed on a
+ * dedicated button bar at the bottom of a form. Non-process buttons can be placed anywhere on a form.
+ * <p>
+ * Subclasses can override this method. Default is {@code true}.
+ *
+ * @return {@code true} if this button is a process button, {@code false} otherwise
+ * @see IButton
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(220)
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredProcessButton() {
+ return true;
+ }
+
+ /**
+ * Configures the display style of this button. See {@code IButton.DISPLAY_STYLE_* } constants for valid values.
+ * <p>
+ * Subclasses can override this method. Default is {@code IButton.DISPLAY_STYLE_DEFAULT}.
+ *
+ * @return the display style of this button
+ * @see IButton
+ */
+ @ConfigProperty(ConfigProperty.BUTTON_DISPLAY_STYLE)
+ @Order(210)
+ @ConfigPropertyValue("DISPLAY_STYLE_DEFAULT")
+ protected int getConfiguredDisplayStyle() {
+ return DISPLAY_STYLE_DEFAULT;
+ }
+
+ /**
+ * {@inheritDoc} Default for buttons is false because they usually should only take as much place as is needed to
+ * display the button label, but not necessarily more. See also {@link #getConfiguredGridUseUiWidth()}.
+ */
+ @ConfigPropertyValue("false")
+ @Override
+ protected boolean getConfiguredFillHorizontal() {
+ return false;
+ }
+
+ /**
+ * {@inheritDoc} Default for buttons is false because they usually should only take as much place as is needed to
+ * display the button label, but not necessarily more.
+ */
+ @ConfigPropertyValue("false")
+ @Override
+ protected boolean getConfiguredFillVertical() {
+ return false;
+ }
+
+ /**
+ * {@inheritDoc} Default for buttons is true because they usually should only take as much place as is needed to
+ * display the button label, but not necessarily more.
+ */
+ @ConfigPropertyValue("true")
+ @Override
+ protected boolean getConfiguredGridUseUiWidth() {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @ConfigPropertyValue("false")
+ @Override
+ protected boolean getConfiguredGridUseUiHeight() {
+ return false;
+ }
+
+ /**
+ * Configures the value represented by this radio button. This is the value that is
+ * returned if you query a radio button group for the current value and this button is the
+ * currently selected radio button.
+ * <p>
+ * Subclasses can override this method. Default is {@code null}.
+ *
+ * @return an {@code Object} representing the value of this radio button
+ * @see AbstractRadioButton
+ * @see AbstractRadioButtonGroup
+ */
+ @ConfigProperty(ConfigProperty.OBJECT)
+ @Order(230)
+ @ConfigPropertyValue("null")
+ protected Object getConfiguredRadioValue() {
+ return null;
+ }
+
+ /**
+ * Configures the icon for this button. The icon is displayed on the button itself. Depending on UI and look and feel,
+ * this button might support icon groups to represent different states of this button, such as enabled, disabled,
+ * mouse-over etc.
+ * <p>
+ * Subclasses can override this method. Default is {@code null}.
+ *
+ * @return the ID (name) of the icon
+ * @see IIconGroup
+ * @see IIconProviderService
+ */
+ @ConfigProperty(ConfigProperty.ICON_ID)
+ @Order(190)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredIconId() {
+ return null;
+ }
+
+ /**
+ * Called whenever this button is clicked. This button is disabled and cannot be clicked again
+ * until this method returns.
+ * <p>
+ * Subclasses can override this method. The default does nothing.
+ *
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(190)
+ protected void execClickAction() throws ProcessingException {
+ }
+
+ /**
+ * Called whenever the state of a toggle button or radio button changes.
+ * <p>
+ * Subclasses can override this method. The default does nothing.
+ *
+ * @param selected
+ * new state of the button
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(200)
+ protected void execToggleAction(boolean selected) throws ProcessingException {
+ }
+
+ private Class<? extends IMenu>[] getConfiguredMenus() {
+ Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
+ return ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, IMenu.class);
+ }
+
+ @Override
+ protected void initConfig() {
+ super.initConfig();
+ setSystemType(getConfiguredSystemType());
+ setDisplayStyleInternal(getConfiguredDisplayStyle());
+ setProcessButton(getConfiguredProcessButton());
+ setIconId(getConfiguredIconId());
+ setRadioValue(getConfiguredRadioValue());
+ // menus
+ ArrayList<IMenu> menuList = new ArrayList<IMenu>();
+ Class<? extends IMenu>[] menuArray = getConfiguredMenus();
+ for (int i = 0; i < menuArray.length; i++) {
+ IMenu menu;
+ try {
+ menu = ConfigurationUtility.newInnerInstance(this, menuArray[i]);
+ menuList.add(menu);
+ }
+ catch (Throwable t) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("menu: " + menuArray[i].getName(), t));
+ }
+ }
+ try {
+ injectMenusInternal(menuList);
+ }
+ catch (Exception e) {
+ LOG.error("error occured while dynamically contributing menus.", e);
+ }
+ m_menus = menuList.toArray(new IMenu[0]);
+ }
+
+ /**
+ * Override this internal method only in order to make use of dynamic menus<br>
+ * Used to manage menu list and add/remove menus
+ *
+ * @param menuList
+ * live and mutable list of configured menus
+ */
+ protected void injectMenusInternal(List<IMenu> menuList) {
+ }
+
+ /*
+ * Properties
+ */
+ @Override
+ public String getIconId() {
+ return propertySupport.getPropertyString(PROP_ICON_ID);
+ }
+
+ @Override
+ public void setIconId(String iconId) {
+ propertySupport.setPropertyString(PROP_ICON_ID, iconId);
+ }
+
+ @Override
+ public Object getImage() {
+ return propertySupport.getProperty(PROP_IMAGE);
+ }
+
+ @Override
+ public void setImage(Object nativeImg) {
+ propertySupport.setProperty(PROP_IMAGE, nativeImg);
+ }
+
+ @Override
+ public int getSystemType() {
+ return m_systemType;
+ }
+
+ @Override
+ public void setSystemType(int systemType) {
+ m_systemType = systemType;
+ }
+
+ @Override
+ public boolean isProcessButton() {
+ return m_processButton;
+ }
+
+ @Override
+ public void setProcessButton(boolean on) {
+ m_processButton = on;
+ }
+
+ @Override
+ public boolean hasMenus() {
+ return m_menus.length > 0;
+ }
+
+ @Override
+ public IMenu[] getMenus() {
+ return m_menus;
+ }
+
+ @Override
+ public void doClick() throws ProcessingException {
+ if (isEnabled() && isVisible() && isEnabledProcessingButton()) {
+ try {
+ setEnabledProcessingButton(false);
+
+ fireButtonClicked();
+ execClickAction();
+ }
+ finally {
+ setEnabledProcessingButton(true);
+ }
+ }
+ }
+
+ /*
+ * Radio Buttons
+ */
+ @Override
+ public Object getRadioValue() {
+ return m_radioValue;
+ }
+
+ @Override
+ public void setRadioValue(Object o) {
+ m_radioValue = o;
+ }
+
+ /**
+ * Toggle and Radio Buttons
+ */
+ @Override
+ public boolean isSelected() {
+ return propertySupport.getPropertyBool(PROP_SELECTED);
+ }
+
+ /**
+ * Toggle and Radio Buttons
+ */
+ @Override
+ public void setSelected(boolean b) {
+ boolean changed = propertySupport.setPropertyBool(PROP_SELECTED, b);
+ // single observer for config
+ if (changed) {
+ try {
+ execToggleAction(b);
+ }
+ catch (ProcessingException e) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ }
+ }
+
+ @Override
+ public void disarm() {
+ fireDisarmButton();
+ }
+
+ @Override
+ public void requestPopup() {
+ fireRequestPopup();
+ }
+
+ @Override
+ public int getDisplayStyle() {
+ return m_displayStyle;
+ }
+
+ @Override
+ public void setDisplayStyleInternal(int i) {
+ m_displayStyle = i;
+ }
+
+ @Override
+ public IButtonUIFacade getUIFacade() {
+ return m_uiFacade;
+ }
+
+ /**
+ * Model Observer
+ */
+ @Override
+ public void addButtonListener(ButtonListener listener) {
+ m_listenerList.add(ButtonListener.class, listener);
+ }
+
+ @Override
+ public void removeButtonListener(ButtonListener listener) {
+ m_listenerList.remove(ButtonListener.class, listener);
+ }
+
+ private void fireButtonClicked() {
+ fireButtonEvent(new ButtonEvent(this, ButtonEvent.TYPE_CLICKED));
+ }
+
+ private void fireDisarmButton() {
+ fireButtonEvent(new ButtonEvent(this, ButtonEvent.TYPE_DISARM));
+ }
+
+ private void fireRequestPopup() {
+ fireButtonEvent(new ButtonEvent(this, ButtonEvent.TYPE_REQUEST_POPUP));
+ }
+
+ private IMenu[] fireButtonPopup() {
+ ButtonEvent e = new ButtonEvent(this, ButtonEvent.TYPE_POPUP);
+ // single observer add our menus
+ IMenu[] a = getMenus();
+ for (int i = 0; i < a.length; i++) {
+ IMenu m = a[i];
+ m.prepareAction();
+ if (m.isVisible()) {
+ e.addPopupMenu(m);
+ }
+ }
+ fireButtonEvent(e);
+ return e.getPopupMenus();
+ }
+
+ // main handler
+ private void fireButtonEvent(ButtonEvent e) {
+ EventListener[] listeners = m_listenerList.getListeners(ButtonListener.class);
+ if (listeners != null && listeners.length > 0) {
+ for (int i = 0; i < listeners.length; i++) {
+ ((ButtonListener) listeners[i]).buttonChanged(e);
+ }
+ }
+ }
+
+ /**
+ * Default implementation for buttons
+ */
+ private class P_UIFacade implements IButtonUIFacade {
+ @Override
+ public void fireButtonClickedFromUI() {
+ try {
+ if (isEnabled() && isVisible()) {
+ doClick();
+ }
+ }
+ catch (ProcessingException e) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ }
+
+ @Override
+ public IMenu[] fireButtonPopupFromUI() {
+ return fireButtonPopup();
+ }
+
+ /**
+ * Toggle and Radio Buttons
+ */
+ @Override
+ public void setSelectedFromUI(boolean b) {
+ try {
+ /*
+ * Ticket 76711: added optimistic lock
+ */
+ if (m_uiFacadeSetSelectedLock.acquire()) {
+ setSelected(b);
+ }
+ }
+ finally {
+ m_uiFacadeSetSelectedLock.release();
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractCancelButton.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractCancelButton.java
index a048debbab..9da9d50fc3 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractCancelButton.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractCancelButton.java
@@ -1,51 +1,51 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.button;
-
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-
-public abstract class AbstractCancelButton extends AbstractButton implements IButton {
-
- public AbstractCancelButton() {
- this(true);
- }
-
- public AbstractCancelButton(boolean callInitializer) {
- super(callInitializer);
- }
-
- /*
- * Configuration
- */
- @Override
- @ConfigPropertyValue("SYSTEM_TYPE_CANCEL")
- protected int getConfiguredSystemType() {
- return SYSTEM_TYPE_CANCEL;
- }
-
- @Override
- @ConfigPropertyValue("\"CancelButton\"")
- protected String getConfiguredLabel() {
- return ScoutTexts.get("CancelButton");
- }
-
- @Override
- @ConfigPropertyValue("\"CancelButtonTooltip\"")
- protected String getConfiguredTooltipText() {
- return ScoutTexts.get("CancelButtonTooltip");
- }
-
- @Override
- protected int getConfiguredHorizontalAlignment() {
- return 1;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.button;
+
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+
+public abstract class AbstractCancelButton extends AbstractButton implements IButton {
+
+ public AbstractCancelButton() {
+ this(true);
+ }
+
+ public AbstractCancelButton(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ /*
+ * Configuration
+ */
+ @Override
+ @ConfigPropertyValue("SYSTEM_TYPE_CANCEL")
+ protected int getConfiguredSystemType() {
+ return SYSTEM_TYPE_CANCEL;
+ }
+
+ @Override
+ @ConfigPropertyValue("\"CancelButton\"")
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("CancelButton");
+ }
+
+ @Override
+ @ConfigPropertyValue("\"CancelButtonTooltip\"")
+ protected String getConfiguredTooltipText() {
+ return ScoutTexts.get("CancelButtonTooltip");
+ }
+
+ @Override
+ protected int getConfiguredHorizontalAlignment() {
+ return 1;
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractCloseButton.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractCloseButton.java
index 245e7af91a..b3f712fac9 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractCloseButton.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractCloseButton.java
@@ -1,51 +1,51 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.button;
-
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-
-public abstract class AbstractCloseButton extends AbstractButton implements IButton {
-
- public AbstractCloseButton() {
- this(true);
- }
-
- public AbstractCloseButton(boolean callInitializer) {
- super(callInitializer);
- }
-
- /*
- * Configuration
- */
- @Override
- @ConfigPropertyValue("SYSTEM_TYPE_CLOSE")
- protected int getConfiguredSystemType() {
- return SYSTEM_TYPE_CLOSE;
- }
-
- @Override
- @ConfigPropertyValue("\"CloseButton\"")
- protected String getConfiguredLabel() {
- return ScoutTexts.get("CloseButton");
- }
-
- @Override
- @ConfigPropertyValue("\"CloseButtonTooltip\"")
- protected String getConfiguredTooltipText() {
- return ScoutTexts.get("CloseButtonTooltip");
- }
-
- @Override
- protected int getConfiguredHorizontalAlignment() {
- return 1;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.button;
+
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+
+public abstract class AbstractCloseButton extends AbstractButton implements IButton {
+
+ public AbstractCloseButton() {
+ this(true);
+ }
+
+ public AbstractCloseButton(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ /*
+ * Configuration
+ */
+ @Override
+ @ConfigPropertyValue("SYSTEM_TYPE_CLOSE")
+ protected int getConfiguredSystemType() {
+ return SYSTEM_TYPE_CLOSE;
+ }
+
+ @Override
+ @ConfigPropertyValue("\"CloseButton\"")
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("CloseButton");
+ }
+
+ @Override
+ @ConfigPropertyValue("\"CloseButtonTooltip\"")
+ protected String getConfiguredTooltipText() {
+ return ScoutTexts.get("CloseButtonTooltip");
+ }
+
+ @Override
+ protected int getConfiguredHorizontalAlignment() {
+ return 1;
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractFormStateButton.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractFormStateButton.java
index c77efc11ac..965f44f681 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractFormStateButton.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractFormStateButton.java
@@ -1,75 +1,75 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.button;
-
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-
-public abstract class AbstractFormStateButton extends AbstractButton implements IButton {
-
- public AbstractFormStateButton() {
- this(true);
- }
-
- public AbstractFormStateButton(boolean callInitializer) {
- super(callInitializer);
- }
-
- /*
- * Configuration
- */
- @Override
- @ConfigPropertyValue("\"FormStateLoad\"")
- protected String getConfiguredLabel() {
- return ScoutTexts.get("FormStateLoad");
- }
-
- @Override
- protected int getConfiguredHorizontalAlignment() {
- return -1;
- }
-
- @Override
- protected void execClickAction() throws ProcessingException {
- getForm().doImportXml();
- }
-
- @Order(10)
- public class SaveMenu extends AbstractMenu {
-
- @Override
- protected String getConfiguredText() {
- return ScoutTexts.get("FormStateStore");
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- getForm().doExportXml(false);
- }
- }
-
- @Order(20)
- public class SaveAsMenu extends AbstractMenu {
-
- @Override
- protected String getConfiguredText() {
- return ScoutTexts.get("FormStateStoreAs");
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- getForm().doExportXml(true);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.button;
+
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+
+public abstract class AbstractFormStateButton extends AbstractButton implements IButton {
+
+ public AbstractFormStateButton() {
+ this(true);
+ }
+
+ public AbstractFormStateButton(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ /*
+ * Configuration
+ */
+ @Override
+ @ConfigPropertyValue("\"FormStateLoad\"")
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("FormStateLoad");
+ }
+
+ @Override
+ protected int getConfiguredHorizontalAlignment() {
+ return -1;
+ }
+
+ @Override
+ protected void execClickAction() throws ProcessingException {
+ getForm().doImportXml();
+ }
+
+ @Order(10)
+ public class SaveMenu extends AbstractMenu {
+
+ @Override
+ protected String getConfiguredText() {
+ return ScoutTexts.get("FormStateStore");
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ getForm().doExportXml(false);
+ }
+ }
+
+ @Order(20)
+ public class SaveAsMenu extends AbstractMenu {
+
+ @Override
+ protected String getConfiguredText() {
+ return ScoutTexts.get("FormStateStoreAs");
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ getForm().doExportXml(true);
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractLinkButton.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractLinkButton.java
index 3feeccc09f..94cb261eab 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractLinkButton.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractLinkButton.java
@@ -1,30 +1,30 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.button;
-
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-
-public abstract class AbstractLinkButton extends AbstractButton implements IButton {
-
- public AbstractLinkButton() {
- this(true);
- }
-
- public AbstractLinkButton(boolean callInitializer) {
- super(callInitializer);
- }
-
- @Override
- @ConfigPropertyValue("DISPLAY_STYLE_LINK")
- protected int getConfiguredDisplayStyle() {
- return DISPLAY_STYLE_LINK;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.button;
+
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+
+public abstract class AbstractLinkButton extends AbstractButton implements IButton {
+
+ public AbstractLinkButton() {
+ this(true);
+ }
+
+ public AbstractLinkButton(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ @Override
+ @ConfigPropertyValue("DISPLAY_STYLE_LINK")
+ protected int getConfiguredDisplayStyle() {
+ return DISPLAY_STYLE_LINK;
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractNonFocusableButton.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractNonFocusableButton.java
index 2bec2dfc22..63e2f4f06f 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractNonFocusableButton.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractNonFocusableButton.java
@@ -1,33 +1,33 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.button;
-
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-
-public abstract class AbstractNonFocusableButton extends AbstractButton implements IButton {
-
- public AbstractNonFocusableButton() {
- this(true);
- }
-
- public AbstractNonFocusableButton(boolean callInitializer) {
- super(callInitializer);
- }
-
- /*
- * Configuration
- */
- @ConfigPropertyValue("false")
- @Override
- protected boolean getConfiguredFocusable() {
- return false;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.button;
+
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+
+public abstract class AbstractNonFocusableButton extends AbstractButton implements IButton {
+
+ public AbstractNonFocusableButton() {
+ this(true);
+ }
+
+ public AbstractNonFocusableButton(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ /*
+ * Configuration
+ */
+ @ConfigPropertyValue("false")
+ @Override
+ protected boolean getConfiguredFocusable() {
+ return false;
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractNonFocusableRadioButton.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractNonFocusableRadioButton.java
index a9b84ff697..f5fc34b44d 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractNonFocusableRadioButton.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractNonFocusableRadioButton.java
@@ -1,39 +1,39 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.button;
-
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-
-public abstract class AbstractNonFocusableRadioButton extends AbstractButton implements IButton {
-
- public AbstractNonFocusableRadioButton() {
- this(true);
- }
-
- public AbstractNonFocusableRadioButton(boolean callInitializer) {
- super(callInitializer);
- }
-
- /*
- * Configuration
- */
- @ConfigPropertyValue("false")
- @Override
- protected boolean getConfiguredFocusable() {
- return false;
- }
-
- @Override
- @ConfigPropertyValue("DISPLAY_STYLE_RADIO")
- protected int getConfiguredDisplayStyle() {
- return DISPLAY_STYLE_RADIO;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.button;
+
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+
+public abstract class AbstractNonFocusableRadioButton extends AbstractButton implements IButton {
+
+ public AbstractNonFocusableRadioButton() {
+ this(true);
+ }
+
+ public AbstractNonFocusableRadioButton(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ /*
+ * Configuration
+ */
+ @ConfigPropertyValue("false")
+ @Override
+ protected boolean getConfiguredFocusable() {
+ return false;
+ }
+
+ @Override
+ @ConfigPropertyValue("DISPLAY_STYLE_RADIO")
+ protected int getConfiguredDisplayStyle() {
+ return DISPLAY_STYLE_RADIO;
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractOkButton.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractOkButton.java
index 16cb7ec0e1..d69a788bb1 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractOkButton.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractOkButton.java
@@ -1,51 +1,51 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.button;
-
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-
-public abstract class AbstractOkButton extends AbstractButton implements IButton {
-
- public AbstractOkButton() {
- this(true);
- }
-
- public AbstractOkButton(boolean callInitializer) {
- super(callInitializer);
- }
-
- /*
- * Configuration
- */
- @Override
- @ConfigPropertyValue("SYSTEM_TYPE_OK")
- protected int getConfiguredSystemType() {
- return SYSTEM_TYPE_OK;
- }
-
- @Override
- @ConfigPropertyValue("\"OkButton\"")
- protected String getConfiguredLabel() {
- return ScoutTexts.get("OkButton");
- }
-
- @Override
- @ConfigPropertyValue("\"OkButtonTooltip\"")
- protected String getConfiguredTooltipText() {
- return ScoutTexts.get("OkButtonTooltip");
- }
-
- @Override
- protected int getConfiguredHorizontalAlignment() {
- return 1;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.button;
+
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+
+public abstract class AbstractOkButton extends AbstractButton implements IButton {
+
+ public AbstractOkButton() {
+ this(true);
+ }
+
+ public AbstractOkButton(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ /*
+ * Configuration
+ */
+ @Override
+ @ConfigPropertyValue("SYSTEM_TYPE_OK")
+ protected int getConfiguredSystemType() {
+ return SYSTEM_TYPE_OK;
+ }
+
+ @Override
+ @ConfigPropertyValue("\"OkButton\"")
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("OkButton");
+ }
+
+ @Override
+ @ConfigPropertyValue("\"OkButtonTooltip\"")
+ protected String getConfiguredTooltipText() {
+ return ScoutTexts.get("OkButtonTooltip");
+ }
+
+ @Override
+ protected int getConfiguredHorizontalAlignment() {
+ return 1;
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractRadioButton.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractRadioButton.java
index 57d697bb1c..810316d7f4 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractRadioButton.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractRadioButton.java
@@ -1,33 +1,33 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.button;
-
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-
-public abstract class AbstractRadioButton extends AbstractButton implements IButton {
-
- public AbstractRadioButton() {
- this(true);
- }
-
- public AbstractRadioButton(boolean callInitializer) {
- super(callInitializer);
- }
-
- /*
- * Configuration
- */
- @Override
- @ConfigPropertyValue("DISPLAY_STYLE_RADIO")
- protected int getConfiguredDisplayStyle() {
- return DISPLAY_STYLE_RADIO;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.button;
+
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+
+public abstract class AbstractRadioButton extends AbstractButton implements IButton {
+
+ public AbstractRadioButton() {
+ this(true);
+ }
+
+ public AbstractRadioButton(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ /*
+ * Configuration
+ */
+ @Override
+ @ConfigPropertyValue("DISPLAY_STYLE_RADIO")
+ protected int getConfiguredDisplayStyle() {
+ return DISPLAY_STYLE_RADIO;
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractResetButton.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractResetButton.java
index fdf2057e65..107da8b899 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractResetButton.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractResetButton.java
@@ -1,51 +1,51 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.button;
-
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-
-public abstract class AbstractResetButton extends AbstractButton implements IButton {
-
- public AbstractResetButton() {
- this(true);
- }
-
- public AbstractResetButton(boolean callInitializer) {
- super(callInitializer);
- }
-
- /*
- * Configuration
- */
- @Override
- @ConfigPropertyValue("SYSTEM_TYPE_RESET")
- protected int getConfiguredSystemType() {
- return SYSTEM_TYPE_RESET;
- }
-
- @Override
- @ConfigPropertyValue("\"ResetButton\"")
- protected String getConfiguredLabel() {
- return ScoutTexts.get("ResetButton");
- }
-
- @Override
- @ConfigPropertyValue("\"ResetButtonTooltip\"")
- protected String getConfiguredTooltipText() {
- return ScoutTexts.get("ResetButtonTooltip");
- }
-
- @Override
- protected int getConfiguredHorizontalAlignment() {
- return 1;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.button;
+
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+
+public abstract class AbstractResetButton extends AbstractButton implements IButton {
+
+ public AbstractResetButton() {
+ this(true);
+ }
+
+ public AbstractResetButton(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ /*
+ * Configuration
+ */
+ @Override
+ @ConfigPropertyValue("SYSTEM_TYPE_RESET")
+ protected int getConfiguredSystemType() {
+ return SYSTEM_TYPE_RESET;
+ }
+
+ @Override
+ @ConfigPropertyValue("\"ResetButton\"")
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("ResetButton");
+ }
+
+ @Override
+ @ConfigPropertyValue("\"ResetButtonTooltip\"")
+ protected String getConfiguredTooltipText() {
+ return ScoutTexts.get("ResetButtonTooltip");
+ }
+
+ @Override
+ protected int getConfiguredHorizontalAlignment() {
+ return 1;
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractSaveButton.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractSaveButton.java
index 6ff4a4e828..b406d85ad2 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractSaveButton.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractSaveButton.java
@@ -1,51 +1,51 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.button;
-
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-
-public abstract class AbstractSaveButton extends AbstractButton implements IButton {
-
- public AbstractSaveButton() {
- this(true);
- }
-
- public AbstractSaveButton(boolean callInitializer) {
- super(callInitializer);
- }
-
- /*
- * Configuration
- */
- @Override
- @ConfigPropertyValue("SYSTEM_TYPE_SAVE")
- protected int getConfiguredSystemType() {
- return SYSTEM_TYPE_SAVE;
- }
-
- @Override
- @ConfigPropertyValue("\"SaveButton\"")
- protected String getConfiguredLabel() {
- return ScoutTexts.get("SaveButton");
- }
-
- @Override
- @ConfigPropertyValue("\"SaveButtonTooltip\"")
- protected String getConfiguredTooltipText() {
- return ScoutTexts.get("SaveButtonTooltip");
- }
-
- @Override
- protected int getConfiguredHorizontalAlignment() {
- return -1;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.button;
+
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+
+public abstract class AbstractSaveButton extends AbstractButton implements IButton {
+
+ public AbstractSaveButton() {
+ this(true);
+ }
+
+ public AbstractSaveButton(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ /*
+ * Configuration
+ */
+ @Override
+ @ConfigPropertyValue("SYSTEM_TYPE_SAVE")
+ protected int getConfiguredSystemType() {
+ return SYSTEM_TYPE_SAVE;
+ }
+
+ @Override
+ @ConfigPropertyValue("\"SaveButton\"")
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("SaveButton");
+ }
+
+ @Override
+ @ConfigPropertyValue("\"SaveButtonTooltip\"")
+ protected String getConfiguredTooltipText() {
+ return ScoutTexts.get("SaveButtonTooltip");
+ }
+
+ @Override
+ protected int getConfiguredHorizontalAlignment() {
+ return -1;
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractSearchButton.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractSearchButton.java
index 3516c87b08..ad60eadf60 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractSearchButton.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractSearchButton.java
@@ -1,51 +1,51 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.button;
-
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-
-public abstract class AbstractSearchButton extends AbstractButton implements IButton {
-
- public AbstractSearchButton() {
- this(true);
- }
-
- public AbstractSearchButton(boolean callInitializer) {
- super(callInitializer);
- }
-
- /*
- * Configuration
- */
- @Override
- @ConfigPropertyValue("SYSTEM_TYPE_SAVE_SEARCH")
- protected int getConfiguredSystemType() {
- return SYSTEM_TYPE_SAVE_WITHOUT_MARKER_CHANGE;
- }
-
- @Override
- @ConfigPropertyValue("\"SearchButton\"")
- protected String getConfiguredLabel() {
- return ScoutTexts.get("SearchButton");
- }
-
- @Override
- @ConfigPropertyValue("\"SearchButtonTooltip\"")
- protected String getConfiguredTooltipText() {
- return ScoutTexts.get("SearchButtonTooltip");
- }
-
- @Override
- protected int getConfiguredHorizontalAlignment() {
- return 1;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.button;
+
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+
+public abstract class AbstractSearchButton extends AbstractButton implements IButton {
+
+ public AbstractSearchButton() {
+ this(true);
+ }
+
+ public AbstractSearchButton(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ /*
+ * Configuration
+ */
+ @Override
+ @ConfigPropertyValue("SYSTEM_TYPE_SAVE_SEARCH")
+ protected int getConfiguredSystemType() {
+ return SYSTEM_TYPE_SAVE_WITHOUT_MARKER_CHANGE;
+ }
+
+ @Override
+ @ConfigPropertyValue("\"SearchButton\"")
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("SearchButton");
+ }
+
+ @Override
+ @ConfigPropertyValue("\"SearchButtonTooltip\"")
+ protected String getConfiguredTooltipText() {
+ return ScoutTexts.get("SearchButtonTooltip");
+ }
+
+ @Override
+ protected int getConfiguredHorizontalAlignment() {
+ return 1;
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/ButtonEvent.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/ButtonEvent.java
index e38faccfee..0561f17b70 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/ButtonEvent.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/ButtonEvent.java
@@ -1,77 +1,77 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.button;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.EventObject;
-
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-
-public class ButtonEvent extends EventObject {
- private static final long serialVersionUID = 1L;
- /**
- * event when button was clicked
- */
- public static final int TYPE_CLICKED = 1;
- /**
- * broadcast event to collect contributed menus
- */
- public static final int TYPE_POPUP = 2;
- /**
- * In case button was pressed and armed, this event sets armed=false and
- * prevents the button from firing an action
- */
- public static final int TYPE_DISARM = 3;
- /**
- * event to ui to request showing the (dropdown) menu popup
- */
- public static final int TYPE_REQUEST_POPUP = 4;
-
- private final int m_type;
- private ArrayList<IMenu> m_popupMenuList;
-
- public ButtonEvent(IButton source, int type) {
- super(source);
- m_type = type;
- }
-
- public IButton getButton() {
- return (IButton) super.getSource();
- }
-
- public int getType() {
- return m_type;
- }
-
- public void addPopupMenus(IMenu[] menus) {
- if (m_popupMenuList == null) {
- m_popupMenuList = new ArrayList<IMenu>();
- }
- m_popupMenuList.addAll(Arrays.asList(menus));
- }
-
- public void addPopupMenu(IMenu menu) {
- if (m_popupMenuList == null) {
- m_popupMenuList = new ArrayList<IMenu>();
- }
- m_popupMenuList.add(menu);
- }
-
- public IMenu[] getPopupMenus() {
- if (m_popupMenuList == null) {
- return new IMenu[0];
- }
- else {
- return m_popupMenuList.toArray(new IMenu[0]);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.button;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.EventObject;
+
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+
+public class ButtonEvent extends EventObject {
+ private static final long serialVersionUID = 1L;
+ /**
+ * event when button was clicked
+ */
+ public static final int TYPE_CLICKED = 1;
+ /**
+ * broadcast event to collect contributed menus
+ */
+ public static final int TYPE_POPUP = 2;
+ /**
+ * In case button was pressed and armed, this event sets armed=false and
+ * prevents the button from firing an action
+ */
+ public static final int TYPE_DISARM = 3;
+ /**
+ * event to ui to request showing the (dropdown) menu popup
+ */
+ public static final int TYPE_REQUEST_POPUP = 4;
+
+ private final int m_type;
+ private ArrayList<IMenu> m_popupMenuList;
+
+ public ButtonEvent(IButton source, int type) {
+ super(source);
+ m_type = type;
+ }
+
+ public IButton getButton() {
+ return (IButton) super.getSource();
+ }
+
+ public int getType() {
+ return m_type;
+ }
+
+ public void addPopupMenus(IMenu[] menus) {
+ if (m_popupMenuList == null) {
+ m_popupMenuList = new ArrayList<IMenu>();
+ }
+ m_popupMenuList.addAll(Arrays.asList(menus));
+ }
+
+ public void addPopupMenu(IMenu menu) {
+ if (m_popupMenuList == null) {
+ m_popupMenuList = new ArrayList<IMenu>();
+ }
+ m_popupMenuList.add(menu);
+ }
+
+ public IMenu[] getPopupMenus() {
+ if (m_popupMenuList == null) {
+ return new IMenu[0];
+ }
+ else {
+ return m_popupMenuList.toArray(new IMenu[0]);
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/ButtonListener.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/ButtonListener.java
index 5bf655ae6c..5ac523d1ba 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/ButtonListener.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/ButtonListener.java
@@ -1,17 +1,17 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.button;
-
-import java.util.EventListener;
-
-public interface ButtonListener extends EventListener {
- void buttonChanged(ButtonEvent e);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.button;
+
+import java.util.EventListener;
+
+public interface ButtonListener extends EventListener {
+ void buttonChanged(ButtonEvent e);
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/IButton.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/IButton.java
index 9c07b44683..b891614233 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/IButton.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/IButton.java
@@ -1,124 +1,124 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.button;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-
-/**
- * A Button has 2 aspects
- * <ol>
- * <li>System-button / NonSystem-button is marked by getSystemType()<br>
- * System buttons in a dialog have a pre-defined action handling
- * <li>Process-button / NonProcess-button is marked by isProcessButton()<br>
- * Process buttons are normally placed on dialogs button bar on the lower dialog bar
- * </ol>
- */
-public interface IButton extends IFormField {
- /*
- * Properties
- */
- String PROP_ICON_ID = "iconId";
- String PROP_IMAGE = "image";
- String PROP_SELECTED = "selected";
-
- /*
- * System Types
- */
- int SYSTEM_TYPE_NONE = 0;
- int SYSTEM_TYPE_CANCEL = 1;
- int SYSTEM_TYPE_CLOSE = 2;
- int SYSTEM_TYPE_OK = 3;
- int SYSTEM_TYPE_RESET = 4;
- int SYSTEM_TYPE_SAVE = 5;
- int SYSTEM_TYPE_SAVE_WITHOUT_MARKER_CHANGE = 6;
- /*
- * Display Styles
- */
- int DISPLAY_STYLE_DEFAULT = 0;
- int DISPLAY_STYLE_TOGGLE = 1;
- int DISPLAY_STYLE_RADIO = 2;
- int DISPLAY_STYLE_LINK = 3;
-
- void doClick() throws ProcessingException;
-
- int getSystemType();
-
- void setSystemType(int systemType);
-
- boolean isProcessButton();
-
- void setProcessButton(boolean on);
-
- void addButtonListener(ButtonListener listener);
-
- void removeButtonListener(ButtonListener listener);
-
- String getIconId();
-
- void setIconId(String iconId);
-
- Object getImage();
-
- void setImage(Object nativeImg);
-
- boolean hasMenus();
-
- IMenu[] getMenus();
-
- /**
- * display style<br>
- * default, toggle, radio
- */
- int getDisplayStyle();
-
- /**
- * do not change this property when ui is attached<br>
- * major gui frameworks don't support runtime itemtype changes
- */
- void setDisplayStyleInternal(int i);
-
- /**
- * @return toggle and radio button state
- */
- boolean isSelected();
-
- /**
- * @param b
- * toggle and radio button state
- */
- void setSelected(boolean b);
-
- /**
- * In case button was pressed and armed, this event sets armed=false<br>
- * and prevents the button from firing an action
- */
- void disarm();
-
- /**
- * request showing the (dropdown) menu popup
- */
- void requestPopup();
-
- /**
- * @return radio button value
- */
- Object getRadioValue();
-
- /**
- * @param o
- * radio button value
- */
- void setRadioValue(Object o);
-
- IButtonUIFacade getUIFacade();
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.button;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+
+/**
+ * A Button has 2 aspects
+ * <ol>
+ * <li>System-button / NonSystem-button is marked by getSystemType()<br>
+ * System buttons in a dialog have a pre-defined action handling
+ * <li>Process-button / NonProcess-button is marked by isProcessButton()<br>
+ * Process buttons are normally placed on dialogs button bar on the lower dialog bar
+ * </ol>
+ */
+public interface IButton extends IFormField {
+ /*
+ * Properties
+ */
+ String PROP_ICON_ID = "iconId";
+ String PROP_IMAGE = "image";
+ String PROP_SELECTED = "selected";
+
+ /*
+ * System Types
+ */
+ int SYSTEM_TYPE_NONE = 0;
+ int SYSTEM_TYPE_CANCEL = 1;
+ int SYSTEM_TYPE_CLOSE = 2;
+ int SYSTEM_TYPE_OK = 3;
+ int SYSTEM_TYPE_RESET = 4;
+ int SYSTEM_TYPE_SAVE = 5;
+ int SYSTEM_TYPE_SAVE_WITHOUT_MARKER_CHANGE = 6;
+ /*
+ * Display Styles
+ */
+ int DISPLAY_STYLE_DEFAULT = 0;
+ int DISPLAY_STYLE_TOGGLE = 1;
+ int DISPLAY_STYLE_RADIO = 2;
+ int DISPLAY_STYLE_LINK = 3;
+
+ void doClick() throws ProcessingException;
+
+ int getSystemType();
+
+ void setSystemType(int systemType);
+
+ boolean isProcessButton();
+
+ void setProcessButton(boolean on);
+
+ void addButtonListener(ButtonListener listener);
+
+ void removeButtonListener(ButtonListener listener);
+
+ String getIconId();
+
+ void setIconId(String iconId);
+
+ Object getImage();
+
+ void setImage(Object nativeImg);
+
+ boolean hasMenus();
+
+ IMenu[] getMenus();
+
+ /**
+ * display style<br>
+ * default, toggle, radio
+ */
+ int getDisplayStyle();
+
+ /**
+ * do not change this property when ui is attached<br>
+ * major gui frameworks don't support runtime itemtype changes
+ */
+ void setDisplayStyleInternal(int i);
+
+ /**
+ * @return toggle and radio button state
+ */
+ boolean isSelected();
+
+ /**
+ * @param b
+ * toggle and radio button state
+ */
+ void setSelected(boolean b);
+
+ /**
+ * In case button was pressed and armed, this event sets armed=false<br>
+ * and prevents the button from firing an action
+ */
+ void disarm();
+
+ /**
+ * request showing the (dropdown) menu popup
+ */
+ void requestPopup();
+
+ /**
+ * @return radio button value
+ */
+ Object getRadioValue();
+
+ /**
+ * @param o
+ * radio button value
+ */
+ void setRadioValue(Object o);
+
+ IButtonUIFacade getUIFacade();
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/IButtonUIFacade.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/IButtonUIFacade.java
index 092cdbe261..20c4633860 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/IButtonUIFacade.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/button/IButtonUIFacade.java
@@ -1,32 +1,32 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.button;
-
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-
-/**
- * A Button has 2 aspects
- * <ol>
- * <li>System-button / NonSystem-button is marked by getSystemType()<br>
- * System buttons in a dialog have a pre-defined action handling
- * <li>Process-button / NonProcess-button is marked by isProcessButton()<br>
- * Process buttons are normally placed on dialogs button bar on the lower dialog bar
- * </ol>
- */
-public interface IButtonUIFacade {
-
- void fireButtonClickedFromUI();
-
- IMenu[] fireButtonPopupFromUI();
-
- void setSelectedFromUI(boolean b);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.button;
+
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+
+/**
+ * A Button has 2 aspects
+ * <ol>
+ * <li>System-button / NonSystem-button is marked by getSystemType()<br>
+ * System buttons in a dialog have a pre-defined action handling
+ * <li>Process-button / NonProcess-button is marked by isProcessButton()<br>
+ * Process buttons are normally placed on dialogs button bar on the lower dialog bar
+ * </ol>
+ */
+public interface IButtonUIFacade {
+
+ void fireButtonClickedFromUI();
+
+ IMenu[] fireButtonPopupFromUI();
+
+ void setSelectedFromUI(boolean b);
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/calendarfield/AbstractCalendarField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/calendarfield/AbstractCalendarField.java
index a7f5c26f81..b65a8a0517 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/calendarfield/AbstractCalendarField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/calendarfield/AbstractCalendarField.java
@@ -1,156 +1,156 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.calendarfield;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.Date;
-
-import org.eclipse.scout.commons.ConfigurationUtility;
-import org.eclipse.scout.commons.OptimisticLock;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.ClientUIPreferences;
-import org.eclipse.scout.rt.client.ui.basic.calendar.AbstractCalendar;
-import org.eclipse.scout.rt.client.ui.basic.calendar.ICalendar;
-import org.eclipse.scout.rt.client.ui.form.fields.AbstractValueField;
-
-public abstract class AbstractCalendarField<T extends ICalendar> extends AbstractValueField<Date> implements ICalendarField<T> {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractCalendarField.class);
-
- private T m_calendar;
- private OptimisticLock m_valueSelectionMediator;
-
- public AbstractCalendarField() {
- this(true);
- }
-
- public AbstractCalendarField(boolean callInitializer) {
- super(callInitializer);
- }
-
- /*
- * Configuration
- */
- private Class<? extends ICalendar> getConfiguredCalendar() {
- Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
- return ConfigurationUtility.filterClass(dca, ICalendar.class);
- }
-
- @Override
- @SuppressWarnings("unchecked")
- protected void initConfig() {
- m_valueSelectionMediator = new OptimisticLock();
- super.initConfig();
- final ClientUIPreferences env = ClientUIPreferences.getInstance();
- if (getConfiguredCalendar() != null) {
- try {
- m_calendar = (T) ConfigurationUtility.newInnerInstance(this, getConfiguredCalendar());
- if (m_calendar instanceof AbstractCalendar) {
- ((AbstractCalendar) m_calendar).setContainerInternal(this);
- }
- // restore calendar settings
- m_calendar.setDisplayMode(env.getCalendarDisplayMode(ICalendar.DISPLAY_MODE_MONTH));
- m_calendar.setDisplayCondensed(env.getCalendarDisplayCondensed(true));
- /*
- * add observer for: - selected date sync - persistence of calendar
- * settings
- */
- m_calendar.addPropertyChangeListener(
- new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent e) {
- if (e.getPropertyName().equals(ICalendar.PROP_SELECTED_DATE)) {
- syncCalendarToCalendarField();
- }
- }
- }
- );
- syncCalendarToCalendarField();
- }
- catch (Exception e) {
- LOG.warn(null, e);
- }
- }
- else {
- LOG.warn("there is no inner class of type ICalendar in " + getClass());
- }
- }
-
- /*
- * Runtime
- */
-
- @Override
- protected void initFieldInternal() throws ProcessingException {
- getCalendar().initCalendar();
- super.initFieldInternal();
- }
-
- @Override
- protected void disposeFieldInternal() {
- ClientUIPreferences.getInstance().setCalendarPreferences(getCalendar().getDisplayMode(), getCalendar().isDisplayCondensed());
- super.disposeFieldInternal();
- getCalendar().disposeCalendar();
- }
-
- @Override
- public final T getCalendar() {
- return m_calendar;
- }
-
- /**
- * Full override: reload calendar components
- */
- @Override
- protected void execChangedMasterValue(Object newMasterValue) throws ProcessingException {
- setValue(null);
- getCalendar().reloadCalendarItems();
- }
-
- @Override
- protected void valueChangedInternal() {
- super.valueChangedInternal();
- syncCalendarFieldToCalendar();
- }
-
- private void syncCalendarFieldToCalendar() {
- try {
- if (m_valueSelectionMediator.acquire()) {
- Date value = getValue();
- T cal = getCalendar();
- cal.setSelectedDate(value);
- }
- }
- finally {
- m_valueSelectionMediator.release();
- }
- }
-
- private void syncCalendarToCalendarField() {
- try {
- if (m_valueSelectionMediator.acquire()) {
- T cal = getCalendar();
- Date value = cal.getSelectedDate();
- setValue(value);
- }
- }
- finally {
- m_valueSelectionMediator.release();
- }
- }
-
- @Override
- public void reloadCalendarItems() {
- getCalendar().reloadCalendarItems();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.calendarfield;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.Date;
+
+import org.eclipse.scout.commons.ConfigurationUtility;
+import org.eclipse.scout.commons.OptimisticLock;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.ClientUIPreferences;
+import org.eclipse.scout.rt.client.ui.basic.calendar.AbstractCalendar;
+import org.eclipse.scout.rt.client.ui.basic.calendar.ICalendar;
+import org.eclipse.scout.rt.client.ui.form.fields.AbstractValueField;
+
+public abstract class AbstractCalendarField<T extends ICalendar> extends AbstractValueField<Date> implements ICalendarField<T> {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractCalendarField.class);
+
+ private T m_calendar;
+ private OptimisticLock m_valueSelectionMediator;
+
+ public AbstractCalendarField() {
+ this(true);
+ }
+
+ public AbstractCalendarField(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ /*
+ * Configuration
+ */
+ private Class<? extends ICalendar> getConfiguredCalendar() {
+ Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
+ return ConfigurationUtility.filterClass(dca, ICalendar.class);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ protected void initConfig() {
+ m_valueSelectionMediator = new OptimisticLock();
+ super.initConfig();
+ final ClientUIPreferences env = ClientUIPreferences.getInstance();
+ if (getConfiguredCalendar() != null) {
+ try {
+ m_calendar = (T) ConfigurationUtility.newInnerInstance(this, getConfiguredCalendar());
+ if (m_calendar instanceof AbstractCalendar) {
+ ((AbstractCalendar) m_calendar).setContainerInternal(this);
+ }
+ // restore calendar settings
+ m_calendar.setDisplayMode(env.getCalendarDisplayMode(ICalendar.DISPLAY_MODE_MONTH));
+ m_calendar.setDisplayCondensed(env.getCalendarDisplayCondensed(true));
+ /*
+ * add observer for: - selected date sync - persistence of calendar
+ * settings
+ */
+ m_calendar.addPropertyChangeListener(
+ new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent e) {
+ if (e.getPropertyName().equals(ICalendar.PROP_SELECTED_DATE)) {
+ syncCalendarToCalendarField();
+ }
+ }
+ }
+ );
+ syncCalendarToCalendarField();
+ }
+ catch (Exception e) {
+ LOG.warn(null, e);
+ }
+ }
+ else {
+ LOG.warn("there is no inner class of type ICalendar in " + getClass());
+ }
+ }
+
+ /*
+ * Runtime
+ */
+
+ @Override
+ protected void initFieldInternal() throws ProcessingException {
+ getCalendar().initCalendar();
+ super.initFieldInternal();
+ }
+
+ @Override
+ protected void disposeFieldInternal() {
+ ClientUIPreferences.getInstance().setCalendarPreferences(getCalendar().getDisplayMode(), getCalendar().isDisplayCondensed());
+ super.disposeFieldInternal();
+ getCalendar().disposeCalendar();
+ }
+
+ @Override
+ public final T getCalendar() {
+ return m_calendar;
+ }
+
+ /**
+ * Full override: reload calendar components
+ */
+ @Override
+ protected void execChangedMasterValue(Object newMasterValue) throws ProcessingException {
+ setValue(null);
+ getCalendar().reloadCalendarItems();
+ }
+
+ @Override
+ protected void valueChangedInternal() {
+ super.valueChangedInternal();
+ syncCalendarFieldToCalendar();
+ }
+
+ private void syncCalendarFieldToCalendar() {
+ try {
+ if (m_valueSelectionMediator.acquire()) {
+ Date value = getValue();
+ T cal = getCalendar();
+ cal.setSelectedDate(value);
+ }
+ }
+ finally {
+ m_valueSelectionMediator.release();
+ }
+ }
+
+ private void syncCalendarToCalendarField() {
+ try {
+ if (m_valueSelectionMediator.acquire()) {
+ T cal = getCalendar();
+ Date value = cal.getSelectedDate();
+ setValue(value);
+ }
+ }
+ finally {
+ m_valueSelectionMediator.release();
+ }
+ }
+
+ @Override
+ public void reloadCalendarItems() {
+ getCalendar().reloadCalendarItems();
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/calendarfield/ICalendarField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/calendarfield/ICalendarField.java
index 3647e7d14a..f4688fe6f4 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/calendarfield/ICalendarField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/calendarfield/ICalendarField.java
@@ -1,28 +1,28 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.calendarfield;
-
-import java.util.Date;
-
-import org.eclipse.scout.rt.client.ui.basic.calendar.ICalendar;
-import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
-
-public interface ICalendarField<T extends ICalendar> extends IValueField<Date> {
-
- T getCalendar();
-
- /**
- * reload all calendar items<br>
- * Convenience for {@link ICalendar#reloadCalendarItems()}
- */
- void reloadCalendarItems();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.calendarfield;
+
+import java.util.Date;
+
+import org.eclipse.scout.rt.client.ui.basic.calendar.ICalendar;
+import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
+
+public interface ICalendarField<T extends ICalendar> extends IValueField<Date> {
+
+ T getCalendar();
+
+ /**
+ * reload all calendar items<br>
+ * Convenience for {@link ICalendar#reloadCalendarItems()}
+ */
+ void reloadCalendarItems();
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/chartbox/AbstractChartBox.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/chartbox/AbstractChartBox.java
index c17c9bbea9..b5e1989513 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/chartbox/AbstractChartBox.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/chartbox/AbstractChartBox.java
@@ -1,108 +1,108 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.chartbox;
-
-import java.util.EventListener;
-
-import org.eclipse.scout.commons.EventListenerList;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.rt.client.ui.form.fields.AbstractFormField;
-
-public abstract class AbstractChartBox extends AbstractFormField implements IChartBox {
- private IChartBoxUIFacade m_uiFacade;
- private EventListenerList m_listenerList = new EventListenerList();
-
- public AbstractChartBox() {
- this(true);
- }
-
- public AbstractChartBox(boolean callInitializer) {
- super(callInitializer);
- }
-
- /*
- * Configuration
- */
- /**
- * Fully qualified class name of a ISwingChartProvider class with bundle
- * symbolic name prefix<br>
- * Example: <code>com.bsiag.crm.ui.swing / com.bsiag.crm.ui.swing.chart.ForecastChart</code>
- */
- @ConfigProperty(ConfigProperty.CHART_QNAME)
- @Order(190)
- @ConfigPropertyValue("null")
- protected String getConfiguredChartQName() {
- return null;
- }
-
- @Override
- protected void initConfig() {
- m_uiFacade = new P_UIFacade();
- super.initConfig();
- setChartQName(getConfiguredChartQName());
- }
-
- /*
- * Runtime
- */
-
- @Override
- public String getChartQName() {
- return propertySupport.getPropertyString(PROP_CHART_QNAME);
- }
-
- @Override
- public void setChartQName(String className) {
- propertySupport.setPropertyString(PROP_CHART_QNAME, className);
- }
-
- @Override
- public IChartBoxUIFacade getUIFacade() {
- return m_uiFacade;
- }
-
- @Override
- public void addChartBoxListener(ChartBoxListener listener) {
- m_listenerList.add(ChartBoxListener.class, listener);
- }
-
- @Override
- public void removeChartBoxListener(ChartBoxListener listener) {
- m_listenerList.remove(ChartBoxListener.class, listener);
- }
-
- @Override
- public void refreshChart() {
- fireDataChanged();
- }
-
- private void fireDataChanged() {
- fireChartBoxEvent(new ChartBoxEvent(this, ChartBoxEvent.TYPE_DATA_CHANGED));
- }
-
- // main handler
- private void fireChartBoxEvent(ChartBoxEvent e) {
- EventListener[] listeners = m_listenerList.getListeners(ChartBoxListener.class);
- if (listeners != null && listeners.length > 0) {
- for (int i = 0; i < listeners.length; i++) {
- ((ChartBoxListener) listeners[i]).chartBoxChanged(e);
- }
- }
- }
-
- private class P_UIFacade implements IChartBoxUIFacade {
- // empty so far
-
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.chartbox;
+
+import java.util.EventListener;
+
+import org.eclipse.scout.commons.EventListenerList;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.rt.client.ui.form.fields.AbstractFormField;
+
+public abstract class AbstractChartBox extends AbstractFormField implements IChartBox {
+ private IChartBoxUIFacade m_uiFacade;
+ private EventListenerList m_listenerList = new EventListenerList();
+
+ public AbstractChartBox() {
+ this(true);
+ }
+
+ public AbstractChartBox(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ /*
+ * Configuration
+ */
+ /**
+ * Fully qualified class name of a ISwingChartProvider class with bundle
+ * symbolic name prefix<br>
+ * Example: <code>com.bsiag.crm.ui.swing / com.bsiag.crm.ui.swing.chart.ForecastChart</code>
+ */
+ @ConfigProperty(ConfigProperty.CHART_QNAME)
+ @Order(190)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredChartQName() {
+ return null;
+ }
+
+ @Override
+ protected void initConfig() {
+ m_uiFacade = new P_UIFacade();
+ super.initConfig();
+ setChartQName(getConfiguredChartQName());
+ }
+
+ /*
+ * Runtime
+ */
+
+ @Override
+ public String getChartQName() {
+ return propertySupport.getPropertyString(PROP_CHART_QNAME);
+ }
+
+ @Override
+ public void setChartQName(String className) {
+ propertySupport.setPropertyString(PROP_CHART_QNAME, className);
+ }
+
+ @Override
+ public IChartBoxUIFacade getUIFacade() {
+ return m_uiFacade;
+ }
+
+ @Override
+ public void addChartBoxListener(ChartBoxListener listener) {
+ m_listenerList.add(ChartBoxListener.class, listener);
+ }
+
+ @Override
+ public void removeChartBoxListener(ChartBoxListener listener) {
+ m_listenerList.remove(ChartBoxListener.class, listener);
+ }
+
+ @Override
+ public void refreshChart() {
+ fireDataChanged();
+ }
+
+ private void fireDataChanged() {
+ fireChartBoxEvent(new ChartBoxEvent(this, ChartBoxEvent.TYPE_DATA_CHANGED));
+ }
+
+ // main handler
+ private void fireChartBoxEvent(ChartBoxEvent e) {
+ EventListener[] listeners = m_listenerList.getListeners(ChartBoxListener.class);
+ if (listeners != null && listeners.length > 0) {
+ for (int i = 0; i < listeners.length; i++) {
+ ((ChartBoxListener) listeners[i]).chartBoxChanged(e);
+ }
+ }
+ }
+
+ private class P_UIFacade implements IChartBoxUIFacade {
+ // empty so far
+
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/chartbox/ChartBoxEvent.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/chartbox/ChartBoxEvent.java
index 56b2ea6d0a..bed8336fae 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/chartbox/ChartBoxEvent.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/chartbox/ChartBoxEvent.java
@@ -1,33 +1,33 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.chartbox;
-
-import java.util.EventObject;
-
-public class ChartBoxEvent extends EventObject {
- private static final long serialVersionUID = 1L;
- public static final int TYPE_DATA_CHANGED = 100;
-
- private int m_type;
-
- public ChartBoxEvent(IChartBox source, int type) {
- super(source);
- m_type = type;
- }
-
- public IChartBox getChartBox() {
- return (IChartBox) getSource();
- }
-
- public int getType() {
- return m_type;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.chartbox;
+
+import java.util.EventObject;
+
+public class ChartBoxEvent extends EventObject {
+ private static final long serialVersionUID = 1L;
+ public static final int TYPE_DATA_CHANGED = 100;
+
+ private int m_type;
+
+ public ChartBoxEvent(IChartBox source, int type) {
+ super(source);
+ m_type = type;
+ }
+
+ public IChartBox getChartBox() {
+ return (IChartBox) getSource();
+ }
+
+ public int getType() {
+ return m_type;
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/chartbox/ChartBoxListener.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/chartbox/ChartBoxListener.java
index 16420aaf8a..7d2b63cb5e 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/chartbox/ChartBoxListener.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/chartbox/ChartBoxListener.java
@@ -1,17 +1,17 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.chartbox;
-
-import java.util.EventListener;
-
-public interface ChartBoxListener extends EventListener {
- void chartBoxChanged(ChartBoxEvent e);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.chartbox;
+
+import java.util.EventListener;
+
+public interface ChartBoxListener extends EventListener {
+ void chartBoxChanged(ChartBoxEvent e);
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/chartbox/IChartBox.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/chartbox/IChartBox.java
index 52044438d2..6c61e50cd4 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/chartbox/IChartBox.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/chartbox/IChartBox.java
@@ -1,34 +1,34 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.chartbox;
-
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-
-public interface IChartBox extends IFormField {
-
- String PROP_CHART_QNAME = "chartQName";
-
- String getChartQName();
-
- void setChartQName(String className);
-
- IChartBoxUIFacade getUIFacade();
-
- void refreshChart();
-
- /*
- * Model observer
- */
- void addChartBoxListener(ChartBoxListener listener);
-
- void removeChartBoxListener(ChartBoxListener listener);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.chartbox;
+
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+
+public interface IChartBox extends IFormField {
+
+ String PROP_CHART_QNAME = "chartQName";
+
+ String getChartQName();
+
+ void setChartQName(String className);
+
+ IChartBoxUIFacade getUIFacade();
+
+ void refreshChart();
+
+ /*
+ * Model observer
+ */
+ void addChartBoxListener(ChartBoxListener listener);
+
+ void removeChartBoxListener(ChartBoxListener listener);
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/chartbox/IChartBoxUIFacade.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/chartbox/IChartBoxUIFacade.java
index a403c9bde6..fb280176c7 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/chartbox/IChartBoxUIFacade.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/chartbox/IChartBoxUIFacade.java
@@ -1,15 +1,15 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.chartbox;
-
-public interface IChartBoxUIFacade {
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.chartbox;
+
+public interface IChartBoxUIFacade {
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/checkbox/AbstractCheckBox.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/checkbox/AbstractCheckBox.java
index cb64fb3090..03ef8b169c 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/checkbox/AbstractCheckBox.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/checkbox/AbstractCheckBox.java
@@ -1,29 +1,29 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.checkbox;
-
-import org.eclipse.scout.rt.client.ui.form.fields.booleanfield.AbstractBooleanField;
-
-/**
- * Convenience subclass for {@link AbstractBooleanField} due to popular usage of
- * the word "checkBox" instead of "booleanField"<br>
- * do not add further code or methods to this class
- */
-public abstract class AbstractCheckBox extends AbstractBooleanField implements ICheckBox {
-
- public AbstractCheckBox() {
- this(true);
- }
-
- public AbstractCheckBox(boolean callInitializer) {
- super(callInitializer);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.checkbox;
+
+import org.eclipse.scout.rt.client.ui.form.fields.booleanfield.AbstractBooleanField;
+
+/**
+ * Convenience subclass for {@link AbstractBooleanField} due to popular usage of
+ * the word "checkBox" instead of "booleanField"<br>
+ * do not add further code or methods to this class
+ */
+public abstract class AbstractCheckBox extends AbstractBooleanField implements ICheckBox {
+
+ public AbstractCheckBox() {
+ this(true);
+ }
+
+ public AbstractCheckBox(boolean callInitializer) {
+ super(callInitializer);
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/checkbox/ICheckBox.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/checkbox/ICheckBox.java
index 8a24338240..6dfd56c956 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/checkbox/ICheckBox.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/checkbox/ICheckBox.java
@@ -1,22 +1,22 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.checkbox;
-
-import org.eclipse.scout.rt.client.ui.form.fields.booleanfield.IBooleanField;
-
-/**
- * Convenience subclass for {@link IBooleanField} due to popular usage of the
- * word "checkBox" instead of "booleanField"<br>
- * do not add further code or methods to this class
- */
-public interface ICheckBox extends IBooleanField {
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.checkbox;
+
+import org.eclipse.scout.rt.client.ui.form.fields.booleanfield.IBooleanField;
+
+/**
+ * Convenience subclass for {@link IBooleanField} due to popular usage of the
+ * word "checkBox" instead of "booleanField"<br>
+ * do not add further code or methods to this class
+ */
+public interface ICheckBox extends IBooleanField {
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/AbstractComposerField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/AbstractComposerField.java
index 88dd62484d..895a279f21 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/AbstractComposerField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/AbstractComposerField.java
@@ -1,896 +1,896 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.composer;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.scout.commons.ConfigurationUtility;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.annotations.ConfigOperation;
-import org.eclipse.scout.commons.annotations.FormData;
-import org.eclipse.scout.commons.annotations.FormData.DefaultSubtypeSdkCommand;
-import org.eclipse.scout.commons.annotations.FormData.SdkCommand;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.commons.xmlparser.SimpleXmlElement;
-import org.eclipse.scout.rt.client.ui.action.keystroke.AbstractKeyStroke;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
-import org.eclipse.scout.rt.client.ui.basic.tree.AbstractTree;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITree;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeVisitor;
-import org.eclipse.scout.rt.client.ui.basic.tree.TreeAdapter;
-import org.eclipse.scout.rt.client.ui.basic.tree.TreeEvent;
-import org.eclipse.scout.rt.client.ui.form.fields.AbstractFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.composer.attribute.IComposerAttribute;
-import org.eclipse.scout.rt.client.ui.form.fields.composer.entity.IComposerEntity;
-import org.eclipse.scout.rt.client.ui.form.fields.composer.node.AttributeNode;
-import org.eclipse.scout.rt.client.ui.form.fields.composer.node.EitherOrNode;
-import org.eclipse.scout.rt.client.ui.form.fields.composer.node.EntityNode;
-import org.eclipse.scout.rt.client.ui.form.fields.composer.node.RootNode;
-import org.eclipse.scout.rt.shared.AbstractIcons;
-import org.eclipse.scout.rt.shared.data.form.fields.AbstractFormFieldData;
-import org.eclipse.scout.rt.shared.data.form.fields.composer.AbstractComposerData;
-import org.eclipse.scout.rt.shared.data.form.fields.composer.ComposerAttributeNodeData;
-import org.eclipse.scout.rt.shared.data.form.fields.composer.ComposerEitherOrNodeData;
-import org.eclipse.scout.rt.shared.data.form.fields.composer.ComposerEntityNodeData;
-import org.eclipse.scout.rt.shared.data.form.fields.treefield.AbstractTreeFieldData;
-import org.eclipse.scout.rt.shared.data.form.fields.treefield.TreeNodeData;
-import org.eclipse.scout.rt.shared.data.model.AttributePath;
-import org.eclipse.scout.rt.shared.data.model.DataModelAttributeOp;
-import org.eclipse.scout.rt.shared.data.model.DataModelConstants;
-import org.eclipse.scout.rt.shared.data.model.DataModelUtility;
-import org.eclipse.scout.rt.shared.data.model.EntityPath;
-import org.eclipse.scout.rt.shared.data.model.IDataModel;
-import org.eclipse.scout.rt.shared.data.model.IDataModelAttribute;
-import org.eclipse.scout.rt.shared.data.model.IDataModelAttributeOp;
-import org.eclipse.scout.rt.shared.data.model.IDataModelEntity;
-
-@SuppressWarnings("deprecation")
-@FormData(value = AbstractComposerData.class, sdkCommand = SdkCommand.USE, defaultSubtypeSdkCommand = DefaultSubtypeSdkCommand.CREATE)
-public abstract class AbstractComposerField extends AbstractFormField implements IComposerField {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractComposerField.class);
-
- private IComposerFieldUIFacade m_uiFacade;
- private ITree m_tree;
- private SimpleXmlElement m_initValue;
- private IDataModel m_dataModel;
-
- public AbstractComposerField() {
- this(true);
- }
-
- public AbstractComposerField(boolean callInitializer) {
- super(callInitializer);
- }
-
- @Override
- public IDataModel getDataModel() {
- return m_dataModel;
- }
-
- @Override
- public void setDataModel(IDataModel dm) {
- m_dataModel = dm;
- }
-
- /**
- * The default creates a data model with the inner entities and attributes
- * <p>
- * Other implementations may use a data model defined in the shared area
- */
- @ConfigOperation
- @Order(97)
- protected IDataModel execCreateDataModel() {
- ComposerFieldDataModel m = new ComposerFieldDataModel(this);
- m.init();
- return m;
- }
-
- /**
- * see {@link #execResolveEntityPath(EntityNode)}
- */
- @ConfigOperation
- @Order(98)
- protected void execResolveRootPathForTopLevelEntity(IDataModelEntity e, List<IDataModelEntity> lifeList) {
- IDataModelEntity tmp = (e != null ? e.getParentEntity() : null);
- while (tmp != null) {
- lifeList.add(0, tmp);
- tmp = tmp.getParentEntity();
- }
- }
-
- /**
- * see {@link #execResolveAttributePath(AttributeNode)}
- */
- @ConfigOperation
- @Order(98)
- protected void execResolveRootPathForTopLevelAttribute(IDataModelAttribute a, List<IDataModelEntity> lifeList) {
- IDataModelEntity tmp = (a != null ? a.getParentEntity() : null);
- while (tmp != null) {
- lifeList.add(0, tmp);
- tmp = tmp.getParentEntity();
- }
- }
-
- /**
- * For {@link #exportFormFieldData(AbstractFormFieldData)}, {@link AbstractTree#exportTreeData(AbstractTreeFieldData)}
- * and {@link #storeXML(SimpleXmlElement)} it is necessary to export {@link IDataModelEntity} and
- * {@link IDataModelAttribute} as external strings. see {@link EntityPath}
- * <p>
- * This callback completes an entity path to its root. The parameter path contains the entity path represented in the
- * composer tree of {@link EntityNode}s, the last element is the deepest tree node.
- * <p>
- * The default traverses the tree up to the root and collects all non-null {@link EntityNode#getEntity()}
- * <p>
- * This is prefixed with {@link #execResolveRootPathForTopLevelEntity(IDataModelEntity, List)}
- */
- @ConfigOperation
- @Order(99)
- protected EntityPath execResolveEntityPath(EntityNode node) {
- LinkedList<IDataModelEntity> list = new LinkedList<IDataModelEntity>();
- EntityNode tmp = node;
- while (tmp != null) {
- if (tmp.getEntity() != null) {
- list.add(0, tmp.getEntity());
- }
- //next
- tmp = tmp.getAncestorNode(EntityNode.class);
- }
- if (list.size() > 0) {
- execResolveRootPathForTopLevelEntity(list.get(0), list);
- }
- return new EntityPath(list);
- }
-
- /**
- * see {@link #execResolveEntityPathForEntityExport(EntityNode)}, {@link AttributePath} for more details
- * <p>
- * The path in the composer tree is prefixed with
- * {@link #execResolveRootPathForTopLevelAttribute(IDataModelAttribute, List)}
- */
- @ConfigOperation
- @Order(99)
- protected AttributePath execResolveAttributePath(AttributeNode node) {
- LinkedList<IDataModelEntity> list = new LinkedList<IDataModelEntity>();
- if (node == null) {
- return null;
- }
- EntityNode tmp = node.getAncestorNode(EntityNode.class);
- while (tmp != null) {
- if (tmp.getEntity() != null) {
- list.add(0, tmp.getEntity());
- }
- //next
- tmp = tmp.getAncestorNode(EntityNode.class);
- }
- if (list.size() > 0) {
- execResolveRootPathForTopLevelEntity(list.get(0), list);
- }
- else {
- execResolveRootPathForTopLevelAttribute(node.getAttribute(), list);
- }
- return new AttributePath(list, node.getAttribute());
- }
-
- /*
- * Configuration
- */
- private Class<? extends ITree> getConfiguredTree() {
- Class<?>[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
- Class<? extends ITree>[] f = ConfigurationUtility.filterClasses(dca, ITree.class);
- if (f.length == 1) {
- return f[0];
- }
- else {
- for (Class<? extends ITree> c : f) {
- if (c.getDeclaringClass() != AbstractComposerField.class) {
- return c;
- }
- }
- return null;
- }
- }
-
- /**
- * Override this method to decorate or enhance new nodes whenever they are created
- *
- * @return the new node, must not be null
- * <p>
- * Normally overrides call super. {@link #execCreateRootNode()}
- */
- @ConfigOperation
- @Order(100)
- protected RootNode execCreateRootNode() {
- return new RootNode(this);
- }
-
- /**
- * Override this method to decorate or enhance new nodes whenever they are created
- *
- * @return the new node or null to ignore the add of a new node of this type
- * <p>
- * Normally overrides call super.
- * {@link #execCreateEntityNode(ITreeNode, IDataModelEntity, boolean, Object[], String[])}
- */
- @ConfigOperation
- @Order(110)
- protected EntityNode execCreateEntityNode(ITreeNode parentNode, IDataModelEntity e, boolean negated, Object[] values, String[] texts) {
- EntityNode node = new EntityNode(this, e);
- node.setValues(values);
- node.setTexts(texts);
- node.setNegative(negated);
- node.setStatus(ITreeNode.STATUS_INSERTED);
- return node;
- }
-
- /**
- * Override this method to decorate or enhance new nodes whenever they are created
- *
- * @return the new node or null to ignore the add of a new node of this type
- * <p>
- * Normally overrides call super.
- * {@link #execCreateAttributeNode(ITreeNode, IDataModelAttribute, Integer, IComposerOp, Object[], String[])}
- */
- @ConfigOperation
- @Order(120)
- protected AttributeNode execCreateAttributeNode(ITreeNode parentNode, IDataModelAttribute a, Integer aggregationType, IDataModelAttributeOp op, Object[] values, String[] texts) {
- if (aggregationType != null && aggregationType == DataModelConstants.AGGREGATION_NONE) {
- aggregationType = null;
- }
- AttributeNode node = new AttributeNode(this, a);
- node.setAggregationType(aggregationType);
- node.setOp(op);
- node.setValues(values);
- node.setTexts(texts);
- node.setStatus(ITreeNode.STATUS_INSERTED);
- return node;
- }
-
- /**
- * Override this method to decorate or enhance new nodes whenever they are created
- *
- * @return the new node or null to ignore the add of a new node of this type
- * <p>
- * Normally overrides call super.{@link #execCreateEitherNode(ITreeNode, boolean)}
- */
- @ConfigOperation
- @Order(130)
- protected EitherOrNode execCreateEitherNode(ITreeNode parentNode, boolean negated) {
- EitherOrNode node = new EitherOrNode(this, true);
- node.setNegative(negated);
- node.setStatus(ITreeNode.STATUS_INSERTED);
- return node;
- }
-
- /**
- * Override this method to decorate or enhance new nodes whenever they are created
- *
- * @return the new node or null to ignore the add of a new node of this type
- * <p>
- * Normally overrides call super.{@link #execCreateAdditionalOrNode(ITreeNode, boolean)}
- */
- @ConfigOperation
- @Order(140)
- protected EitherOrNode execCreateAdditionalOrNode(ITreeNode parentNode, boolean negated) {
- EitherOrNode node = new EitherOrNode(this, false);
- node.setNegative(negated);
- node.setStatus(ITreeNode.STATUS_INSERTED);
- return node;
- }
-
- @Override
- protected void initConfig() {
- m_uiFacade = new P_UIFacade();
- super.initConfig();
- m_dataModel = execCreateDataModel();
- // tree
- if (getConfiguredTree() != null) {
- try {
- m_tree = ConfigurationUtility.newInnerInstance(this, getConfiguredTree());
- RootNode rootNode = execCreateRootNode();
- rootNode.getCellForUpdate().setText(getLabel());
- m_tree.setRootNode(rootNode);
- m_tree.setNodeExpanded(rootNode, true);
- m_tree.setEnabled(isEnabled());
- m_tree.addTreeListener(
- new TreeAdapter() {
- @Override
- public void treeChanged(TreeEvent e) {
- switch (e.getType()) {
- case TreeEvent.TYPE_NODES_DELETED:
- case TreeEvent.TYPE_NODES_INSERTED:
- case TreeEvent.TYPE_NODES_UPDATED: {
- checkSaveNeeded();
- checkEmpty();
- break;
- }
- }
- }
- }
- );
- }
- catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
- else {
- LOG.warn("there is no inner class of type ITree in " + getClass());
- }
- // local enabled listener
- addPropertyChangeListener(PROP_ENABLED, new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent e) {
- if (m_tree != null) {
- m_tree.setEnabled(isEnabled());
- }
- }
- });
- }
-
- /*
- * Runtime
- */
- @Override
- protected void initFieldInternal() throws ProcessingException {
- getTree().initTree();
- super.initFieldInternal();
- }
-
- @Override
- protected void disposeFieldInternal() {
- super.disposeFieldInternal();
- getTree().disposeTree();
- }
-
- @Override
- public final ITree getTree() {
- return m_tree;
- }
-
- @Override
- public void exportFormFieldData(AbstractFormFieldData target) throws ProcessingException {
- AbstractTreeFieldData treeFieldData = (AbstractTreeFieldData) target;
- if (m_tree != null) {
- m_tree.exportTreeData(treeFieldData);
- }
- }
-
- @Override
- public void importFormFieldData(AbstractFormFieldData source, boolean valueChangeTriggersEnabled) throws ProcessingException {
- AbstractTreeFieldData treeFieldData = (AbstractTreeFieldData) source;
- if (treeFieldData.isValueSet()) {
- if (m_tree != null) {
- try {
- if (!valueChangeTriggersEnabled) {
- setValueChangeTriggerEnabled(false);
- }
- //
- m_tree.importTreeData(treeFieldData);
- }
- finally {
- if (!valueChangeTriggersEnabled) {
- setValueChangeTriggerEnabled(true);
- }
- }
- }
- }
- }
-
- @Override
- public IDataModelAttribute[] getAttributes() {
- return m_dataModel.getAttributes();
- }
-
- @Override
- public IDataModelEntity[] getEntities() {
- return m_dataModel.getEntities();
- }
-
- /**
- * @deprecated use {@link #getEntities()} instead
- */
- @Deprecated
- public IComposerEntity[] getComposerEntities() {
- return (IComposerEntity[]) m_dataModel.getEntities();
- }
-
- /**
- * @deprecated use {@link #getAttributes()} instead
- */
- @Deprecated
- public IComposerAttribute[] getComposerAttributes() {
- return (IComposerAttribute[]) m_dataModel.getAttributes();
- }
-
- @Override
- public void loadXML(SimpleXmlElement x) throws ProcessingException {
- super.loadXML(x);
- ITree tree = getTree();
- try {
- tree.setTreeChanging(true);
- //
- getTree().removeAllChildNodes(getTree().getRootNode());
- loadXMLRec(x, getTree().getRootNode());
- }
- finally {
- tree.setTreeChanging(false);
- }
- }
-
- private void loadXMLRec(SimpleXmlElement x, ITreeNode parent) {
- // build tree
- for (SimpleXmlElement xmlElem : x.getChildren()) {
- if ("attribute".equals(xmlElem.getName())) {
- String id = xmlElem.getStringAttribute("id");
- IDataModelAttributeOp op;
- Integer aggregationType;
- try {
- op = DataModelAttributeOp.create(xmlElem.getIntAttribute("op", DataModelConstants.OPERATOR_EQ));
- aggregationType = xmlElem.getIntAttribute("aggregationType", 0);
- if (aggregationType == 0) {
- aggregationType = null;
- }
- }
- catch (Exception e) {
- LOG.warn("read op", e);
- continue;
- }
- ArrayList<Object> valueList = new ArrayList<Object>();
- try {
- for (int i = 1; i <= 5; i++) {
- String valueName = (i == 1 ? "value" : "value" + i);
- if (xmlElem.hasAttribute(valueName)) {
- valueList.add(xmlElem.getObjectAttribute(valueName, null, getClass().getClassLoader()));
- }
- }
- }
- catch (Exception e) {
- LOG.warn("read value for attribute " + id, e);
- continue;
- }
- ArrayList<String> displayValueList = new ArrayList<String>();
- for (int i = 1; i <= 5; i++) {
- String displayValueName = (i == 1 ? "displayValue" : "displayValue" + i);
- if (xmlElem.hasAttribute(displayValueName)) {
- displayValueList.add(xmlElem.getStringAttribute(displayValueName, null));
- }
- }
- // find definition
- AttributePath attPath = DataModelUtility.externalIdToAttributePath(getDataModel(), id);
- IDataModelAttribute foundAtt = (attPath != null ? attPath.getAttribute() : null);
- if (foundAtt == null) {
- LOG.warn("cannot find attribute with id=" + id);
- continue;
- }
- ITreeNode node = addAttributeNode(parent, foundAtt, aggregationType, op, valueList.toArray(), displayValueList.toArray(new String[1]));
- if (node != null) {
- // add children recursive
- loadXMLRec(xmlElem, node);
- }
- }
- else if ("entity".equals(xmlElem.getName())) {
- String id = xmlElem.getStringAttribute("id");
- boolean negated = xmlElem.getStringAttribute("negated", "false").equalsIgnoreCase("true");
- String text = xmlElem.getStringAttribute("displayValues", null);
- // find definition
- EntityPath entityPath = DataModelUtility.externalIdToEntityPath(getDataModel(), id);
- IDataModelEntity foundEntity = (entityPath != null ? entityPath.lastElement() : null);
- if (foundEntity == null) {
- LOG.warn("cannot find entity with id=" + id);
- continue;
- }
- ITreeNode node = addEntityNode(parent, foundEntity, negated, null, text != null ? new String[]{text} : null);
- if (node != null) {
- // add children recursive
- loadXMLRec(xmlElem, node);
- }
- }
- else if ("or".equals(xmlElem.getName())) {
- boolean beginning = xmlElem.getStringAttribute("begin", "false").equalsIgnoreCase("true");
- boolean negated = xmlElem.getStringAttribute("negated", "false").equalsIgnoreCase("true");
- ITreeNode node = null;
- if (beginning) {
- node = addEitherNode(parent, negated);
- }
- else {
- // find last EitherOrNode
- EitherOrNode orNode = null;
- for (ITreeNode n : parent.getChildNodes()) {
- if (n instanceof EitherOrNode && ((EitherOrNode) n).isBeginOfEitherOr()) {
- orNode = (EitherOrNode) n;
- }
- }
- if (orNode != null) {
- node = addAdditionalOrNode(orNode, negated);
- }
- }
- if (node != null) {
- // add children recursive
- loadXMLRec(xmlElem, node);
- }
- }
-
- }
- }
-
- @Override
- public void storeXML(SimpleXmlElement x) throws ProcessingException {
- super.storeXML(x);
- storeXMLRec(x, getTree().getRootNode());
- }
-
- private void createDataModelEntityPathRec(EntityNode node, List<IDataModelEntity> list) {
- }
-
- private void storeXMLRec(SimpleXmlElement x, ITreeNode parent) {
- for (ITreeNode node : parent.getChildNodes()) {
- if (node instanceof EntityNode) {
- EntityNode entityNode = (EntityNode) node;
- SimpleXmlElement xEntity = new SimpleXmlElement("entity");
- xEntity.setAttribute("id", DataModelUtility.entityPathToExternalId(getDataModel(), execResolveEntityPath(entityNode)));
- xEntity.setAttribute("negated", (entityNode.isNegative() ? "true" : "false"));
- String[] texts = entityNode.getTexts();
- xEntity.setAttribute("displayValues", texts != null && texts.length > 0 ? StringUtility.emptyIfNull(texts[0]) : null);
- x.addChild(xEntity);
- // recursion
- storeXMLRec(xEntity, node);
- }
- else if (node instanceof AttributeNode) {
- AttributeNode attNode = (AttributeNode) node;
- SimpleXmlElement xAtt = new SimpleXmlElement("attribute");
- xAtt.setAttribute("id", DataModelUtility.attributePathToExternalId(getDataModel(), execResolveAttributePath(attNode)));
- IDataModelAttributeOp op = attNode.getOp();
- try {
- xAtt.setAttribute("op", op.getOperator());
- if (attNode.getAggregationType() != null) {
- xAtt.setIntAttribute("aggregationType", attNode.getAggregationType());
- }
- }
- catch (Exception e) {
- LOG.warn("write op " + op, e);
- }
- String[] texts = attNode.getTexts();
- if (texts != null) {
- for (int i = 0; i < texts.length; i++) {
- String displayValueName = (i == 0 ? "displayValue" : "displayValue" + (i + 1));
- xAtt.setAttribute(displayValueName, StringUtility.emptyIfNull(texts[i]));
- }
- }
- Object[] values = attNode.getValues();
- if (values != null) {
- for (int i = 0; i < values.length; i++) {
- String valueName = (i == 0 ? "value" : "value" + (i + 1));
- try {
- xAtt.setObjectAttribute(valueName, values[i]);
- }
- catch (Exception e) {
- LOG.warn("write value[" + i + "] for attribute " + attNode.getAttribute() + ": " + values[i], e);
- }
- }
- }
- x.addChild(xAtt);
- }
- else if (node instanceof EitherOrNode) {
- EitherOrNode orNode = (EitherOrNode) node;
- SimpleXmlElement xOr = new SimpleXmlElement("or");
- xOr.setAttribute("begin", "" + orNode.isBeginOfEitherOr());
- xOr.setAttribute("negated", (orNode.isNegative() ? "true" : "false"));
- x.addChild(xOr);
- // recursion
- storeXMLRec(xOr, node);
- }
- }
- }
-
- @Override
- public void resetValue() {
- if (m_initValue == null) {
- getTree().removeAllChildNodes(getTree().getRootNode());
- }
- else {
- try {
- loadXML(m_initValue);
- }
- catch (ProcessingException e) {
- LOG.error("unexpected error occured while restoring initial value", e);
- getTree().removeAllChildNodes(getTree().getRootNode());
- }
- }
-
- checkSaveNeeded();
- checkEmpty();
- }
-
- @Override
- public EntityNode addEntityNode(ITreeNode parentNode, IDataModelEntity e, boolean negated, Object[] values, String[] texts) {
- EntityNode node = execCreateEntityNode(parentNode, e, negated, values, texts);
- if (node != null) {
- getTree().addChildNode(parentNode, node);
- getTree().setNodeExpanded(node, true);
- }
- return node;
- }
-
- @Override
- public EitherOrNode addEitherNode(ITreeNode parentNode, boolean negated) {
- EitherOrNode node = execCreateEitherNode(parentNode, negated);
- if (node != null) {
- getTree().addChildNode(parentNode, node);
- getTree().setNodeExpanded(node, true);
- }
- return node;
- }
-
- @Override
- public EitherOrNode addAdditionalOrNode(ITreeNode parentNode, boolean negated) {
- EitherOrNode node = execCreateAdditionalOrNode(parentNode, negated);
- if (node != null) {
- getTree().addChildNode(parentNode.getChildNodeIndex() + 1, parentNode.getParentNode(), node);
- getTree().setNodeExpanded(node, true);
- }
- return node;
- }
-
- @Override
- public AttributeNode addAttributeNode(ITreeNode parentNode, IDataModelAttribute a, Integer aggregationType, IDataModelAttributeOp op, Object[] values, String[] texts) {
- AttributeNode node = execCreateAttributeNode(parentNode, a, aggregationType, op, values, texts);
- if (node != null) {
- getTree().addChildNode(parentNode, node);
- }
- return node;
- }
-
- public void updateInitialValue() {
- try {
- // clone composer field by storing as XML
- SimpleXmlElement element = new SimpleXmlElement();
- storeXML(element);
- m_initValue = element;
- }
- catch (ProcessingException e) {
- LOG.warn("unexpected error occured while storing initial value", e);
- }
- }
-
- @Override
- protected boolean execIsSaveNeeded() throws ProcessingException {
- boolean b = false;
- if (b == false && m_tree.getDeletedNodeCount() > 0) {
- b = true;
- }
- if (b == false && m_tree.getInsertedNodeCount() > 0) {
- b = true;
- }
- if (b == false && m_tree.getUpdatedNodeCount() > 0) {
- b = true;
- }
- return b;
- }
-
- @Override
- protected void execMarkSaved() throws ProcessingException {
- try {
- m_tree.setTreeChanging(true);
- //
- ITreeVisitor v = new ITreeVisitor() {
- @Override
- public boolean visit(ITreeNode node) {
- if (!node.isStatusNonchanged()) {
- node.setStatusInternal(ITreeNode.STATUS_NON_CHANGED);
- m_tree.updateNode(node);
- }
- return true;
- }
- };
- m_tree.visitNode(m_tree.getRootNode(), v);
- m_tree.clearDeletedNodes();
-
- updateInitialValue();
- }
- finally {
- m_tree.setTreeChanging(false);
- }
- }
-
- @Override
- protected boolean execIsEmpty() throws ProcessingException {
- if (m_tree.getRootNode() != null && m_tree.getRootNode().getChildNodeCount() > 0) {
- return false;
- }
- return true;
- }
-
- @Override
- public IComposerFieldUIFacade getUIFacade() {
- return m_uiFacade;
- }
-
- /**
- * ui facade
- */
- private class P_UIFacade implements IComposerFieldUIFacade {
-
- }
-
- /**
- * inner tree type
- */
- public class Tree extends AbstractTree {
-
- @Override
- protected boolean getConfiguredRootNodeVisible() {
- return true;
- }
-
- @Override
- protected TreeNodeData exportTreeNodeData(ITreeNode node, AbstractTreeFieldData treeData) throws ProcessingException {
- if (node instanceof EntityNode) {
- EntityNode enode = (EntityNode) node;
- String externalId = DataModelUtility.entityPathToExternalId(getDataModel(), execResolveEntityPath(enode));
- if (externalId == null) {
- if (LOG.isInfoEnabled()) {
- LOG.info("could not find entity data for: " + enode.getEntity());
- }
- return null;
- }
- ComposerEntityNodeData data = new ComposerEntityNodeData();
- data.setEntityExternalId(externalId);
- data.setNegative(enode.isNegative());
- return data;
- }
- else if (node instanceof AttributeNode) {
- AttributeNode anode = (AttributeNode) node;
- String externalId = DataModelUtility.attributePathToExternalId(getDataModel(), execResolveAttributePath(anode));
- if (externalId == null) {
- if (LOG.isInfoEnabled()) {
- LOG.info("could not find attribute data for: " + anode.getAttribute());
- }
- return null;
- }
- ComposerAttributeNodeData data = new ComposerAttributeNodeData();
- data.setAttributeExternalId(externalId);
- data.setNegative(false);
- data.setAggregationType(anode.getAggregationType());
- data.setOperator(anode.getOp().getOperator());
- data.setValues(anode.getValues());
- return data;
- }
- else if (node instanceof EitherOrNode) {
- EitherOrNode eonode = (EitherOrNode) node;
- ComposerEitherOrNodeData data = new ComposerEitherOrNodeData();
- data.setNegative(eonode.isNegative());
- data.setBeginOfEitherOr(eonode.isBeginOfEitherOr());
- return data;
- }
- else {
- return null;
- }
- }
-
- @Override
- protected ITreeNode importTreeNodeData(ITreeNode parentNode, AbstractTreeFieldData treeData, TreeNodeData nodeData) throws ProcessingException {
- if (nodeData instanceof ComposerEntityNodeData) {
- ComposerEntityNodeData enodeData = (ComposerEntityNodeData) nodeData;
- String externalId = enodeData.getEntityExternalId();
- EntityPath entityPath = DataModelUtility.externalIdToEntityPath(getDataModel(), externalId);
- IDataModelEntity e = (entityPath != null ? entityPath.lastElement() : null);
- if (e == null) {
- LOG.warn("could not find entity for: " + enodeData.getEntityExternalId());
- return null;
- }
- return addEntityNode(parentNode, e, enodeData.isNegative(), null, enodeData.getTexts());
- }
- else if (nodeData instanceof ComposerAttributeNodeData) {
- ComposerAttributeNodeData anodeData = (ComposerAttributeNodeData) nodeData;
- String externalId = anodeData.getAttributeExternalId();
- AttributePath attPath = DataModelUtility.externalIdToAttributePath(getDataModel(), externalId);
- IDataModelAttribute a = (attPath != null ? attPath.getAttribute() : null);
- if (a == null) {
- LOG.warn("could not find attribute for: " + anodeData.getAttributeExternalId());
- return null;
- }
- IDataModelAttributeOp op;
- try {
- op = DataModelAttributeOp.create(anodeData.getOperator());
- }
- catch (Exception e) {
- LOG.warn("read op " + anodeData.getOperator(), e);
- return null;
- }
- return addAttributeNode(parentNode, a, anodeData.getAggregationType(), op, anodeData.getValues(), anodeData.getTexts());
- }
- else if (nodeData instanceof ComposerEitherOrNodeData) {
- ComposerEitherOrNodeData eonodeData = (ComposerEitherOrNodeData) nodeData;
- if (eonodeData.isBeginOfEitherOr()) {
- return addEitherNode(parentNode, eonodeData.isNegative());
- }
- else {
- return addAdditionalOrNode(parentNode, eonodeData.isNegative());
- }
- }
- else {
- return null;
- }
- }
-
- @Override
- protected void execDecorateCell(ITreeNode node, Cell cell) throws ProcessingException {
- node.decorateCell();
- if (getIconId() != null) {
- cell.setIconId(getIconId());
- }
- else {
- if (node instanceof RootNode) {
- cell.setIconId(AbstractIcons.ComposerFieldRoot);
- }
- else if (node instanceof EntityNode) {
- cell.setIconId(AbstractIcons.ComposerFieldEntity);
- }
- else if (node instanceof AttributeNode) {
- if (((AttributeNode) node).getAggregationType() != null) {
- cell.setIconId(AbstractIcons.ComposerFieldAggregation);
- }
- else {
- cell.setIconId(AbstractIcons.ComposerFieldAttribute);
- }
- }
- else if (node instanceof EitherOrNode) {
- cell.setIconId(AbstractIcons.ComposerFieldEitherOrNode);
- }
- }
- }
-
- @Order(10)
- public class DeleteKeyStroke extends AbstractKeyStroke {
-
- @Override
- protected String getConfiguredKeyStroke() {
- return "delete";
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- ITree tree = getTree();
- if (tree != null) {
- ITreeNode node = tree.getSelectedNode();
- //check if already deleted
- if (node != null && node.getTree() == tree) {
- IMenu menu = null;
- if (node instanceof AttributeNode) {
- menu = node.getMenu(AttributeNode.DeleteAttributeMenu.class);
- }
- else if (node instanceof EntityNode) {
- menu = node.getMenu(EntityNode.DeleteEntityMenu.class);
- }
- else if (node instanceof EitherOrNode) {
- menu = node.getMenu(EitherOrNode.DeleteEitherOrMenu.class);
- }
- if (menu != null) {
- menu.prepareAction();
- if (menu.isVisible() && menu.isEnabled()) {
- menu.doAction();
- }
- }
- }
- }
- }
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.composer;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.scout.commons.ConfigurationUtility;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.annotations.ConfigOperation;
+import org.eclipse.scout.commons.annotations.FormData;
+import org.eclipse.scout.commons.annotations.FormData.DefaultSubtypeSdkCommand;
+import org.eclipse.scout.commons.annotations.FormData.SdkCommand;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.commons.xmlparser.SimpleXmlElement;
+import org.eclipse.scout.rt.client.ui.action.keystroke.AbstractKeyStroke;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
+import org.eclipse.scout.rt.client.ui.basic.tree.AbstractTree;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITree;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeVisitor;
+import org.eclipse.scout.rt.client.ui.basic.tree.TreeAdapter;
+import org.eclipse.scout.rt.client.ui.basic.tree.TreeEvent;
+import org.eclipse.scout.rt.client.ui.form.fields.AbstractFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.composer.attribute.IComposerAttribute;
+import org.eclipse.scout.rt.client.ui.form.fields.composer.entity.IComposerEntity;
+import org.eclipse.scout.rt.client.ui.form.fields.composer.node.AttributeNode;
+import org.eclipse.scout.rt.client.ui.form.fields.composer.node.EitherOrNode;
+import org.eclipse.scout.rt.client.ui.form.fields.composer.node.EntityNode;
+import org.eclipse.scout.rt.client.ui.form.fields.composer.node.RootNode;
+import org.eclipse.scout.rt.shared.AbstractIcons;
+import org.eclipse.scout.rt.shared.data.form.fields.AbstractFormFieldData;
+import org.eclipse.scout.rt.shared.data.form.fields.composer.AbstractComposerData;
+import org.eclipse.scout.rt.shared.data.form.fields.composer.ComposerAttributeNodeData;
+import org.eclipse.scout.rt.shared.data.form.fields.composer.ComposerEitherOrNodeData;
+import org.eclipse.scout.rt.shared.data.form.fields.composer.ComposerEntityNodeData;
+import org.eclipse.scout.rt.shared.data.form.fields.treefield.AbstractTreeFieldData;
+import org.eclipse.scout.rt.shared.data.form.fields.treefield.TreeNodeData;
+import org.eclipse.scout.rt.shared.data.model.AttributePath;
+import org.eclipse.scout.rt.shared.data.model.DataModelAttributeOp;
+import org.eclipse.scout.rt.shared.data.model.DataModelConstants;
+import org.eclipse.scout.rt.shared.data.model.DataModelUtility;
+import org.eclipse.scout.rt.shared.data.model.EntityPath;
+import org.eclipse.scout.rt.shared.data.model.IDataModel;
+import org.eclipse.scout.rt.shared.data.model.IDataModelAttribute;
+import org.eclipse.scout.rt.shared.data.model.IDataModelAttributeOp;
+import org.eclipse.scout.rt.shared.data.model.IDataModelEntity;
+
+@SuppressWarnings("deprecation")
+@FormData(value = AbstractComposerData.class, sdkCommand = SdkCommand.USE, defaultSubtypeSdkCommand = DefaultSubtypeSdkCommand.CREATE)
+public abstract class AbstractComposerField extends AbstractFormField implements IComposerField {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractComposerField.class);
+
+ private IComposerFieldUIFacade m_uiFacade;
+ private ITree m_tree;
+ private SimpleXmlElement m_initValue;
+ private IDataModel m_dataModel;
+
+ public AbstractComposerField() {
+ this(true);
+ }
+
+ public AbstractComposerField(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ @Override
+ public IDataModel getDataModel() {
+ return m_dataModel;
+ }
+
+ @Override
+ public void setDataModel(IDataModel dm) {
+ m_dataModel = dm;
+ }
+
+ /**
+ * The default creates a data model with the inner entities and attributes
+ * <p>
+ * Other implementations may use a data model defined in the shared area
+ */
+ @ConfigOperation
+ @Order(97)
+ protected IDataModel execCreateDataModel() {
+ ComposerFieldDataModel m = new ComposerFieldDataModel(this);
+ m.init();
+ return m;
+ }
+
+ /**
+ * see {@link #execResolveEntityPath(EntityNode)}
+ */
+ @ConfigOperation
+ @Order(98)
+ protected void execResolveRootPathForTopLevelEntity(IDataModelEntity e, List<IDataModelEntity> lifeList) {
+ IDataModelEntity tmp = (e != null ? e.getParentEntity() : null);
+ while (tmp != null) {
+ lifeList.add(0, tmp);
+ tmp = tmp.getParentEntity();
+ }
+ }
+
+ /**
+ * see {@link #execResolveAttributePath(AttributeNode)}
+ */
+ @ConfigOperation
+ @Order(98)
+ protected void execResolveRootPathForTopLevelAttribute(IDataModelAttribute a, List<IDataModelEntity> lifeList) {
+ IDataModelEntity tmp = (a != null ? a.getParentEntity() : null);
+ while (tmp != null) {
+ lifeList.add(0, tmp);
+ tmp = tmp.getParentEntity();
+ }
+ }
+
+ /**
+ * For {@link #exportFormFieldData(AbstractFormFieldData)}, {@link AbstractTree#exportTreeData(AbstractTreeFieldData)}
+ * and {@link #storeXML(SimpleXmlElement)} it is necessary to export {@link IDataModelEntity} and
+ * {@link IDataModelAttribute} as external strings. see {@link EntityPath}
+ * <p>
+ * This callback completes an entity path to its root. The parameter path contains the entity path represented in the
+ * composer tree of {@link EntityNode}s, the last element is the deepest tree node.
+ * <p>
+ * The default traverses the tree up to the root and collects all non-null {@link EntityNode#getEntity()}
+ * <p>
+ * This is prefixed with {@link #execResolveRootPathForTopLevelEntity(IDataModelEntity, List)}
+ */
+ @ConfigOperation
+ @Order(99)
+ protected EntityPath execResolveEntityPath(EntityNode node) {
+ LinkedList<IDataModelEntity> list = new LinkedList<IDataModelEntity>();
+ EntityNode tmp = node;
+ while (tmp != null) {
+ if (tmp.getEntity() != null) {
+ list.add(0, tmp.getEntity());
+ }
+ //next
+ tmp = tmp.getAncestorNode(EntityNode.class);
+ }
+ if (list.size() > 0) {
+ execResolveRootPathForTopLevelEntity(list.get(0), list);
+ }
+ return new EntityPath(list);
+ }
+
+ /**
+ * see {@link #execResolveEntityPathForEntityExport(EntityNode)}, {@link AttributePath} for more details
+ * <p>
+ * The path in the composer tree is prefixed with
+ * {@link #execResolveRootPathForTopLevelAttribute(IDataModelAttribute, List)}
+ */
+ @ConfigOperation
+ @Order(99)
+ protected AttributePath execResolveAttributePath(AttributeNode node) {
+ LinkedList<IDataModelEntity> list = new LinkedList<IDataModelEntity>();
+ if (node == null) {
+ return null;
+ }
+ EntityNode tmp = node.getAncestorNode(EntityNode.class);
+ while (tmp != null) {
+ if (tmp.getEntity() != null) {
+ list.add(0, tmp.getEntity());
+ }
+ //next
+ tmp = tmp.getAncestorNode(EntityNode.class);
+ }
+ if (list.size() > 0) {
+ execResolveRootPathForTopLevelEntity(list.get(0), list);
+ }
+ else {
+ execResolveRootPathForTopLevelAttribute(node.getAttribute(), list);
+ }
+ return new AttributePath(list, node.getAttribute());
+ }
+
+ /*
+ * Configuration
+ */
+ private Class<? extends ITree> getConfiguredTree() {
+ Class<?>[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
+ Class<? extends ITree>[] f = ConfigurationUtility.filterClasses(dca, ITree.class);
+ if (f.length == 1) {
+ return f[0];
+ }
+ else {
+ for (Class<? extends ITree> c : f) {
+ if (c.getDeclaringClass() != AbstractComposerField.class) {
+ return c;
+ }
+ }
+ return null;
+ }
+ }
+
+ /**
+ * Override this method to decorate or enhance new nodes whenever they are created
+ *
+ * @return the new node, must not be null
+ * <p>
+ * Normally overrides call super. {@link #execCreateRootNode()}
+ */
+ @ConfigOperation
+ @Order(100)
+ protected RootNode execCreateRootNode() {
+ return new RootNode(this);
+ }
+
+ /**
+ * Override this method to decorate or enhance new nodes whenever they are created
+ *
+ * @return the new node or null to ignore the add of a new node of this type
+ * <p>
+ * Normally overrides call super.
+ * {@link #execCreateEntityNode(ITreeNode, IDataModelEntity, boolean, Object[], String[])}
+ */
+ @ConfigOperation
+ @Order(110)
+ protected EntityNode execCreateEntityNode(ITreeNode parentNode, IDataModelEntity e, boolean negated, Object[] values, String[] texts) {
+ EntityNode node = new EntityNode(this, e);
+ node.setValues(values);
+ node.setTexts(texts);
+ node.setNegative(negated);
+ node.setStatus(ITreeNode.STATUS_INSERTED);
+ return node;
+ }
+
+ /**
+ * Override this method to decorate or enhance new nodes whenever they are created
+ *
+ * @return the new node or null to ignore the add of a new node of this type
+ * <p>
+ * Normally overrides call super.
+ * {@link #execCreateAttributeNode(ITreeNode, IDataModelAttribute, Integer, IComposerOp, Object[], String[])}
+ */
+ @ConfigOperation
+ @Order(120)
+ protected AttributeNode execCreateAttributeNode(ITreeNode parentNode, IDataModelAttribute a, Integer aggregationType, IDataModelAttributeOp op, Object[] values, String[] texts) {
+ if (aggregationType != null && aggregationType == DataModelConstants.AGGREGATION_NONE) {
+ aggregationType = null;
+ }
+ AttributeNode node = new AttributeNode(this, a);
+ node.setAggregationType(aggregationType);
+ node.setOp(op);
+ node.setValues(values);
+ node.setTexts(texts);
+ node.setStatus(ITreeNode.STATUS_INSERTED);
+ return node;
+ }
+
+ /**
+ * Override this method to decorate or enhance new nodes whenever they are created
+ *
+ * @return the new node or null to ignore the add of a new node of this type
+ * <p>
+ * Normally overrides call super.{@link #execCreateEitherNode(ITreeNode, boolean)}
+ */
+ @ConfigOperation
+ @Order(130)
+ protected EitherOrNode execCreateEitherNode(ITreeNode parentNode, boolean negated) {
+ EitherOrNode node = new EitherOrNode(this, true);
+ node.setNegative(negated);
+ node.setStatus(ITreeNode.STATUS_INSERTED);
+ return node;
+ }
+
+ /**
+ * Override this method to decorate or enhance new nodes whenever they are created
+ *
+ * @return the new node or null to ignore the add of a new node of this type
+ * <p>
+ * Normally overrides call super.{@link #execCreateAdditionalOrNode(ITreeNode, boolean)}
+ */
+ @ConfigOperation
+ @Order(140)
+ protected EitherOrNode execCreateAdditionalOrNode(ITreeNode parentNode, boolean negated) {
+ EitherOrNode node = new EitherOrNode(this, false);
+ node.setNegative(negated);
+ node.setStatus(ITreeNode.STATUS_INSERTED);
+ return node;
+ }
+
+ @Override
+ protected void initConfig() {
+ m_uiFacade = new P_UIFacade();
+ super.initConfig();
+ m_dataModel = execCreateDataModel();
+ // tree
+ if (getConfiguredTree() != null) {
+ try {
+ m_tree = ConfigurationUtility.newInnerInstance(this, getConfiguredTree());
+ RootNode rootNode = execCreateRootNode();
+ rootNode.getCellForUpdate().setText(getLabel());
+ m_tree.setRootNode(rootNode);
+ m_tree.setNodeExpanded(rootNode, true);
+ m_tree.setEnabled(isEnabled());
+ m_tree.addTreeListener(
+ new TreeAdapter() {
+ @Override
+ public void treeChanged(TreeEvent e) {
+ switch (e.getType()) {
+ case TreeEvent.TYPE_NODES_DELETED:
+ case TreeEvent.TYPE_NODES_INSERTED:
+ case TreeEvent.TYPE_NODES_UPDATED: {
+ checkSaveNeeded();
+ checkEmpty();
+ break;
+ }
+ }
+ }
+ }
+ );
+ }
+ catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+ else {
+ LOG.warn("there is no inner class of type ITree in " + getClass());
+ }
+ // local enabled listener
+ addPropertyChangeListener(PROP_ENABLED, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent e) {
+ if (m_tree != null) {
+ m_tree.setEnabled(isEnabled());
+ }
+ }
+ });
+ }
+
+ /*
+ * Runtime
+ */
+ @Override
+ protected void initFieldInternal() throws ProcessingException {
+ getTree().initTree();
+ super.initFieldInternal();
+ }
+
+ @Override
+ protected void disposeFieldInternal() {
+ super.disposeFieldInternal();
+ getTree().disposeTree();
+ }
+
+ @Override
+ public final ITree getTree() {
+ return m_tree;
+ }
+
+ @Override
+ public void exportFormFieldData(AbstractFormFieldData target) throws ProcessingException {
+ AbstractTreeFieldData treeFieldData = (AbstractTreeFieldData) target;
+ if (m_tree != null) {
+ m_tree.exportTreeData(treeFieldData);
+ }
+ }
+
+ @Override
+ public void importFormFieldData(AbstractFormFieldData source, boolean valueChangeTriggersEnabled) throws ProcessingException {
+ AbstractTreeFieldData treeFieldData = (AbstractTreeFieldData) source;
+ if (treeFieldData.isValueSet()) {
+ if (m_tree != null) {
+ try {
+ if (!valueChangeTriggersEnabled) {
+ setValueChangeTriggerEnabled(false);
+ }
+ //
+ m_tree.importTreeData(treeFieldData);
+ }
+ finally {
+ if (!valueChangeTriggersEnabled) {
+ setValueChangeTriggerEnabled(true);
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ public IDataModelAttribute[] getAttributes() {
+ return m_dataModel.getAttributes();
+ }
+
+ @Override
+ public IDataModelEntity[] getEntities() {
+ return m_dataModel.getEntities();
+ }
+
+ /**
+ * @deprecated use {@link #getEntities()} instead
+ */
+ @Deprecated
+ public IComposerEntity[] getComposerEntities() {
+ return (IComposerEntity[]) m_dataModel.getEntities();
+ }
+
+ /**
+ * @deprecated use {@link #getAttributes()} instead
+ */
+ @Deprecated
+ public IComposerAttribute[] getComposerAttributes() {
+ return (IComposerAttribute[]) m_dataModel.getAttributes();
+ }
+
+ @Override
+ public void loadXML(SimpleXmlElement x) throws ProcessingException {
+ super.loadXML(x);
+ ITree tree = getTree();
+ try {
+ tree.setTreeChanging(true);
+ //
+ getTree().removeAllChildNodes(getTree().getRootNode());
+ loadXMLRec(x, getTree().getRootNode());
+ }
+ finally {
+ tree.setTreeChanging(false);
+ }
+ }
+
+ private void loadXMLRec(SimpleXmlElement x, ITreeNode parent) {
+ // build tree
+ for (SimpleXmlElement xmlElem : x.getChildren()) {
+ if ("attribute".equals(xmlElem.getName())) {
+ String id = xmlElem.getStringAttribute("id");
+ IDataModelAttributeOp op;
+ Integer aggregationType;
+ try {
+ op = DataModelAttributeOp.create(xmlElem.getIntAttribute("op", DataModelConstants.OPERATOR_EQ));
+ aggregationType = xmlElem.getIntAttribute("aggregationType", 0);
+ if (aggregationType == 0) {
+ aggregationType = null;
+ }
+ }
+ catch (Exception e) {
+ LOG.warn("read op", e);
+ continue;
+ }
+ ArrayList<Object> valueList = new ArrayList<Object>();
+ try {
+ for (int i = 1; i <= 5; i++) {
+ String valueName = (i == 1 ? "value" : "value" + i);
+ if (xmlElem.hasAttribute(valueName)) {
+ valueList.add(xmlElem.getObjectAttribute(valueName, null, getClass().getClassLoader()));
+ }
+ }
+ }
+ catch (Exception e) {
+ LOG.warn("read value for attribute " + id, e);
+ continue;
+ }
+ ArrayList<String> displayValueList = new ArrayList<String>();
+ for (int i = 1; i <= 5; i++) {
+ String displayValueName = (i == 1 ? "displayValue" : "displayValue" + i);
+ if (xmlElem.hasAttribute(displayValueName)) {
+ displayValueList.add(xmlElem.getStringAttribute(displayValueName, null));
+ }
+ }
+ // find definition
+ AttributePath attPath = DataModelUtility.externalIdToAttributePath(getDataModel(), id);
+ IDataModelAttribute foundAtt = (attPath != null ? attPath.getAttribute() : null);
+ if (foundAtt == null) {
+ LOG.warn("cannot find attribute with id=" + id);
+ continue;
+ }
+ ITreeNode node = addAttributeNode(parent, foundAtt, aggregationType, op, valueList.toArray(), displayValueList.toArray(new String[1]));
+ if (node != null) {
+ // add children recursive
+ loadXMLRec(xmlElem, node);
+ }
+ }
+ else if ("entity".equals(xmlElem.getName())) {
+ String id = xmlElem.getStringAttribute("id");
+ boolean negated = xmlElem.getStringAttribute("negated", "false").equalsIgnoreCase("true");
+ String text = xmlElem.getStringAttribute("displayValues", null);
+ // find definition
+ EntityPath entityPath = DataModelUtility.externalIdToEntityPath(getDataModel(), id);
+ IDataModelEntity foundEntity = (entityPath != null ? entityPath.lastElement() : null);
+ if (foundEntity == null) {
+ LOG.warn("cannot find entity with id=" + id);
+ continue;
+ }
+ ITreeNode node = addEntityNode(parent, foundEntity, negated, null, text != null ? new String[]{text} : null);
+ if (node != null) {
+ // add children recursive
+ loadXMLRec(xmlElem, node);
+ }
+ }
+ else if ("or".equals(xmlElem.getName())) {
+ boolean beginning = xmlElem.getStringAttribute("begin", "false").equalsIgnoreCase("true");
+ boolean negated = xmlElem.getStringAttribute("negated", "false").equalsIgnoreCase("true");
+ ITreeNode node = null;
+ if (beginning) {
+ node = addEitherNode(parent, negated);
+ }
+ else {
+ // find last EitherOrNode
+ EitherOrNode orNode = null;
+ for (ITreeNode n : parent.getChildNodes()) {
+ if (n instanceof EitherOrNode && ((EitherOrNode) n).isBeginOfEitherOr()) {
+ orNode = (EitherOrNode) n;
+ }
+ }
+ if (orNode != null) {
+ node = addAdditionalOrNode(orNode, negated);
+ }
+ }
+ if (node != null) {
+ // add children recursive
+ loadXMLRec(xmlElem, node);
+ }
+ }
+
+ }
+ }
+
+ @Override
+ public void storeXML(SimpleXmlElement x) throws ProcessingException {
+ super.storeXML(x);
+ storeXMLRec(x, getTree().getRootNode());
+ }
+
+ private void createDataModelEntityPathRec(EntityNode node, List<IDataModelEntity> list) {
+ }
+
+ private void storeXMLRec(SimpleXmlElement x, ITreeNode parent) {
+ for (ITreeNode node : parent.getChildNodes()) {
+ if (node instanceof EntityNode) {
+ EntityNode entityNode = (EntityNode) node;
+ SimpleXmlElement xEntity = new SimpleXmlElement("entity");
+ xEntity.setAttribute("id", DataModelUtility.entityPathToExternalId(getDataModel(), execResolveEntityPath(entityNode)));
+ xEntity.setAttribute("negated", (entityNode.isNegative() ? "true" : "false"));
+ String[] texts = entityNode.getTexts();
+ xEntity.setAttribute("displayValues", texts != null && texts.length > 0 ? StringUtility.emptyIfNull(texts[0]) : null);
+ x.addChild(xEntity);
+ // recursion
+ storeXMLRec(xEntity, node);
+ }
+ else if (node instanceof AttributeNode) {
+ AttributeNode attNode = (AttributeNode) node;
+ SimpleXmlElement xAtt = new SimpleXmlElement("attribute");
+ xAtt.setAttribute("id", DataModelUtility.attributePathToExternalId(getDataModel(), execResolveAttributePath(attNode)));
+ IDataModelAttributeOp op = attNode.getOp();
+ try {
+ xAtt.setAttribute("op", op.getOperator());
+ if (attNode.getAggregationType() != null) {
+ xAtt.setIntAttribute("aggregationType", attNode.getAggregationType());
+ }
+ }
+ catch (Exception e) {
+ LOG.warn("write op " + op, e);
+ }
+ String[] texts = attNode.getTexts();
+ if (texts != null) {
+ for (int i = 0; i < texts.length; i++) {
+ String displayValueName = (i == 0 ? "displayValue" : "displayValue" + (i + 1));
+ xAtt.setAttribute(displayValueName, StringUtility.emptyIfNull(texts[i]));
+ }
+ }
+ Object[] values = attNode.getValues();
+ if (values != null) {
+ for (int i = 0; i < values.length; i++) {
+ String valueName = (i == 0 ? "value" : "value" + (i + 1));
+ try {
+ xAtt.setObjectAttribute(valueName, values[i]);
+ }
+ catch (Exception e) {
+ LOG.warn("write value[" + i + "] for attribute " + attNode.getAttribute() + ": " + values[i], e);
+ }
+ }
+ }
+ x.addChild(xAtt);
+ }
+ else if (node instanceof EitherOrNode) {
+ EitherOrNode orNode = (EitherOrNode) node;
+ SimpleXmlElement xOr = new SimpleXmlElement("or");
+ xOr.setAttribute("begin", "" + orNode.isBeginOfEitherOr());
+ xOr.setAttribute("negated", (orNode.isNegative() ? "true" : "false"));
+ x.addChild(xOr);
+ // recursion
+ storeXMLRec(xOr, node);
+ }
+ }
+ }
+
+ @Override
+ public void resetValue() {
+ if (m_initValue == null) {
+ getTree().removeAllChildNodes(getTree().getRootNode());
+ }
+ else {
+ try {
+ loadXML(m_initValue);
+ }
+ catch (ProcessingException e) {
+ LOG.error("unexpected error occured while restoring initial value", e);
+ getTree().removeAllChildNodes(getTree().getRootNode());
+ }
+ }
+
+ checkSaveNeeded();
+ checkEmpty();
+ }
+
+ @Override
+ public EntityNode addEntityNode(ITreeNode parentNode, IDataModelEntity e, boolean negated, Object[] values, String[] texts) {
+ EntityNode node = execCreateEntityNode(parentNode, e, negated, values, texts);
+ if (node != null) {
+ getTree().addChildNode(parentNode, node);
+ getTree().setNodeExpanded(node, true);
+ }
+ return node;
+ }
+
+ @Override
+ public EitherOrNode addEitherNode(ITreeNode parentNode, boolean negated) {
+ EitherOrNode node = execCreateEitherNode(parentNode, negated);
+ if (node != null) {
+ getTree().addChildNode(parentNode, node);
+ getTree().setNodeExpanded(node, true);
+ }
+ return node;
+ }
+
+ @Override
+ public EitherOrNode addAdditionalOrNode(ITreeNode parentNode, boolean negated) {
+ EitherOrNode node = execCreateAdditionalOrNode(parentNode, negated);
+ if (node != null) {
+ getTree().addChildNode(parentNode.getChildNodeIndex() + 1, parentNode.getParentNode(), node);
+ getTree().setNodeExpanded(node, true);
+ }
+ return node;
+ }
+
+ @Override
+ public AttributeNode addAttributeNode(ITreeNode parentNode, IDataModelAttribute a, Integer aggregationType, IDataModelAttributeOp op, Object[] values, String[] texts) {
+ AttributeNode node = execCreateAttributeNode(parentNode, a, aggregationType, op, values, texts);
+ if (node != null) {
+ getTree().addChildNode(parentNode, node);
+ }
+ return node;
+ }
+
+ public void updateInitialValue() {
+ try {
+ // clone composer field by storing as XML
+ SimpleXmlElement element = new SimpleXmlElement();
+ storeXML(element);
+ m_initValue = element;
+ }
+ catch (ProcessingException e) {
+ LOG.warn("unexpected error occured while storing initial value", e);
+ }
+ }
+
+ @Override
+ protected boolean execIsSaveNeeded() throws ProcessingException {
+ boolean b = false;
+ if (b == false && m_tree.getDeletedNodeCount() > 0) {
+ b = true;
+ }
+ if (b == false && m_tree.getInsertedNodeCount() > 0) {
+ b = true;
+ }
+ if (b == false && m_tree.getUpdatedNodeCount() > 0) {
+ b = true;
+ }
+ return b;
+ }
+
+ @Override
+ protected void execMarkSaved() throws ProcessingException {
+ try {
+ m_tree.setTreeChanging(true);
+ //
+ ITreeVisitor v = new ITreeVisitor() {
+ @Override
+ public boolean visit(ITreeNode node) {
+ if (!node.isStatusNonchanged()) {
+ node.setStatusInternal(ITreeNode.STATUS_NON_CHANGED);
+ m_tree.updateNode(node);
+ }
+ return true;
+ }
+ };
+ m_tree.visitNode(m_tree.getRootNode(), v);
+ m_tree.clearDeletedNodes();
+
+ updateInitialValue();
+ }
+ finally {
+ m_tree.setTreeChanging(false);
+ }
+ }
+
+ @Override
+ protected boolean execIsEmpty() throws ProcessingException {
+ if (m_tree.getRootNode() != null && m_tree.getRootNode().getChildNodeCount() > 0) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public IComposerFieldUIFacade getUIFacade() {
+ return m_uiFacade;
+ }
+
+ /**
+ * ui facade
+ */
+ private class P_UIFacade implements IComposerFieldUIFacade {
+
+ }
+
+ /**
+ * inner tree type
+ */
+ public class Tree extends AbstractTree {
+
+ @Override
+ protected boolean getConfiguredRootNodeVisible() {
+ return true;
+ }
+
+ @Override
+ protected TreeNodeData exportTreeNodeData(ITreeNode node, AbstractTreeFieldData treeData) throws ProcessingException {
+ if (node instanceof EntityNode) {
+ EntityNode enode = (EntityNode) node;
+ String externalId = DataModelUtility.entityPathToExternalId(getDataModel(), execResolveEntityPath(enode));
+ if (externalId == null) {
+ if (LOG.isInfoEnabled()) {
+ LOG.info("could not find entity data for: " + enode.getEntity());
+ }
+ return null;
+ }
+ ComposerEntityNodeData data = new ComposerEntityNodeData();
+ data.setEntityExternalId(externalId);
+ data.setNegative(enode.isNegative());
+ return data;
+ }
+ else if (node instanceof AttributeNode) {
+ AttributeNode anode = (AttributeNode) node;
+ String externalId = DataModelUtility.attributePathToExternalId(getDataModel(), execResolveAttributePath(anode));
+ if (externalId == null) {
+ if (LOG.isInfoEnabled()) {
+ LOG.info("could not find attribute data for: " + anode.getAttribute());
+ }
+ return null;
+ }
+ ComposerAttributeNodeData data = new ComposerAttributeNodeData();
+ data.setAttributeExternalId(externalId);
+ data.setNegative(false);
+ data.setAggregationType(anode.getAggregationType());
+ data.setOperator(anode.getOp().getOperator());
+ data.setValues(anode.getValues());
+ return data;
+ }
+ else if (node instanceof EitherOrNode) {
+ EitherOrNode eonode = (EitherOrNode) node;
+ ComposerEitherOrNodeData data = new ComposerEitherOrNodeData();
+ data.setNegative(eonode.isNegative());
+ data.setBeginOfEitherOr(eonode.isBeginOfEitherOr());
+ return data;
+ }
+ else {
+ return null;
+ }
+ }
+
+ @Override
+ protected ITreeNode importTreeNodeData(ITreeNode parentNode, AbstractTreeFieldData treeData, TreeNodeData nodeData) throws ProcessingException {
+ if (nodeData instanceof ComposerEntityNodeData) {
+ ComposerEntityNodeData enodeData = (ComposerEntityNodeData) nodeData;
+ String externalId = enodeData.getEntityExternalId();
+ EntityPath entityPath = DataModelUtility.externalIdToEntityPath(getDataModel(), externalId);
+ IDataModelEntity e = (entityPath != null ? entityPath.lastElement() : null);
+ if (e == null) {
+ LOG.warn("could not find entity for: " + enodeData.getEntityExternalId());
+ return null;
+ }
+ return addEntityNode(parentNode, e, enodeData.isNegative(), null, enodeData.getTexts());
+ }
+ else if (nodeData instanceof ComposerAttributeNodeData) {
+ ComposerAttributeNodeData anodeData = (ComposerAttributeNodeData) nodeData;
+ String externalId = anodeData.getAttributeExternalId();
+ AttributePath attPath = DataModelUtility.externalIdToAttributePath(getDataModel(), externalId);
+ IDataModelAttribute a = (attPath != null ? attPath.getAttribute() : null);
+ if (a == null) {
+ LOG.warn("could not find attribute for: " + anodeData.getAttributeExternalId());
+ return null;
+ }
+ IDataModelAttributeOp op;
+ try {
+ op = DataModelAttributeOp.create(anodeData.getOperator());
+ }
+ catch (Exception e) {
+ LOG.warn("read op " + anodeData.getOperator(), e);
+ return null;
+ }
+ return addAttributeNode(parentNode, a, anodeData.getAggregationType(), op, anodeData.getValues(), anodeData.getTexts());
+ }
+ else if (nodeData instanceof ComposerEitherOrNodeData) {
+ ComposerEitherOrNodeData eonodeData = (ComposerEitherOrNodeData) nodeData;
+ if (eonodeData.isBeginOfEitherOr()) {
+ return addEitherNode(parentNode, eonodeData.isNegative());
+ }
+ else {
+ return addAdditionalOrNode(parentNode, eonodeData.isNegative());
+ }
+ }
+ else {
+ return null;
+ }
+ }
+
+ @Override
+ protected void execDecorateCell(ITreeNode node, Cell cell) throws ProcessingException {
+ node.decorateCell();
+ if (getIconId() != null) {
+ cell.setIconId(getIconId());
+ }
+ else {
+ if (node instanceof RootNode) {
+ cell.setIconId(AbstractIcons.ComposerFieldRoot);
+ }
+ else if (node instanceof EntityNode) {
+ cell.setIconId(AbstractIcons.ComposerFieldEntity);
+ }
+ else if (node instanceof AttributeNode) {
+ if (((AttributeNode) node).getAggregationType() != null) {
+ cell.setIconId(AbstractIcons.ComposerFieldAggregation);
+ }
+ else {
+ cell.setIconId(AbstractIcons.ComposerFieldAttribute);
+ }
+ }
+ else if (node instanceof EitherOrNode) {
+ cell.setIconId(AbstractIcons.ComposerFieldEitherOrNode);
+ }
+ }
+ }
+
+ @Order(10)
+ public class DeleteKeyStroke extends AbstractKeyStroke {
+
+ @Override
+ protected String getConfiguredKeyStroke() {
+ return "delete";
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ ITree tree = getTree();
+ if (tree != null) {
+ ITreeNode node = tree.getSelectedNode();
+ //check if already deleted
+ if (node != null && node.getTree() == tree) {
+ IMenu menu = null;
+ if (node instanceof AttributeNode) {
+ menu = node.getMenu(AttributeNode.DeleteAttributeMenu.class);
+ }
+ else if (node instanceof EntityNode) {
+ menu = node.getMenu(EntityNode.DeleteEntityMenu.class);
+ }
+ else if (node instanceof EitherOrNode) {
+ menu = node.getMenu(EitherOrNode.DeleteEitherOrMenu.class);
+ }
+ if (menu != null) {
+ menu.prepareAction();
+ if (menu.isVisible() && menu.isEnabled()) {
+ menu.doAction();
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/AbstractComposerValueBox.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/AbstractComposerValueBox.java
index 8611d87b41..574ad45e04 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/AbstractComposerValueBox.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/AbstractComposerValueBox.java
@@ -1,1302 +1,1302 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.composer;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.scout.commons.TriState;
-import org.eclipse.scout.commons.annotations.ConfigOperation;
-import org.eclipse.scout.commons.annotations.FormData;
-import org.eclipse.scout.commons.annotations.FormData.DefaultSubtypeSdkCommand;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
-import org.eclipse.scout.rt.client.ui.form.fields.datefield.AbstractDateField;
-import org.eclipse.scout.rt.client.ui.form.fields.datefield.AbstractTimeField;
-import org.eclipse.scout.rt.client.ui.form.fields.doublefield.AbstractDoubleField;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
-import org.eclipse.scout.rt.client.ui.form.fields.integerfield.AbstractIntegerField;
-import org.eclipse.scout.rt.client.ui.form.fields.listbox.AbstractListBox;
-import org.eclipse.scout.rt.client.ui.form.fields.longfield.AbstractLongField;
-import org.eclipse.scout.rt.client.ui.form.fields.sequencebox.AbstractSequenceBox;
-import org.eclipse.scout.rt.client.ui.form.fields.sequencebox.ISequenceBox;
-import org.eclipse.scout.rt.client.ui.form.fields.smartfield.AbstractSmartField;
-import org.eclipse.scout.rt.client.ui.form.fields.stringfield.AbstractStringField;
-import org.eclipse.scout.rt.client.ui.form.fields.treebox.AbstractTreeBox;
-import org.eclipse.scout.rt.shared.AbstractIcons;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.data.model.DataModelConstants;
-import org.eclipse.scout.rt.shared.data.model.IDataModelAttribute;
-import org.eclipse.scout.rt.shared.data.model.IDataModelAttributeOp;
-import org.eclipse.scout.rt.shared.services.common.jdbc.SearchFilter;
-import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
-
-/**
- * Template box containing all composer values.
- * <p>
- */
-public abstract class AbstractComposerValueBox extends AbstractGroupBox {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractComposerValueBox.class);
-
- private Map<Integer/*operator*/, Map<Integer/*dataType*/, IComposerValueField>> m_opTypeToFieldMap;
- //selection context
- private IDataModelAttribute m_attribute;
- private IComposerValueField m_selectedField;
- private PropertyChangeListener m_valueChangedListener;
-
- public AbstractComposerValueBox() {
- this(true);
- }
-
- public AbstractComposerValueBox(boolean callInitializer) {
- super(callInitializer);
- }
-
- @Override
- protected boolean getConfiguredBorderVisible() {
- return false;
- }
-
- @Override
- protected int getConfiguredGridColumnCount() {
- return 1;
- }
-
- @Override
- protected int getConfiguredGridW() {
- return 1;
- }
-
- /**
- * This callback is invoked whenever the active value field changed its value.
- */
- @ConfigOperation
- @Order(50)
- protected void execChangedValue() throws ProcessingException {
- }
-
- @Override
- protected void execAddSearchTerms(SearchFilter search) {
- //nop
- }
-
- @Override
- protected void initConfig() {
- super.initConfig();
- m_opTypeToFieldMap = new HashMap<Integer, Map<Integer, IComposerValueField>>();
- //specific operators
- HashMap<Integer, IComposerValueField> betweenMap = new HashMap<Integer, IComposerValueField>();
- betweenMap.put(IDataModelAttribute.TYPE_DATE, getFieldByClass(BetweenDateField.class));
- betweenMap.put(IDataModelAttribute.TYPE_DATE_TIME, getFieldByClass(BetweenDateTimeField.class));
- betweenMap.put(IDataModelAttribute.TYPE_DOUBLE, getFieldByClass(BetweenDoubleField.class));
- betweenMap.put(IDataModelAttribute.TYPE_AGGREGATE_COUNT, getFieldByClass(BetweenIntegerField.class));
- betweenMap.put(IDataModelAttribute.TYPE_INTEGER, getFieldByClass(BetweenIntegerField.class));
- betweenMap.put(IDataModelAttribute.TYPE_LONG, getFieldByClass(BetweenLongField.class));
- betweenMap.put(IDataModelAttribute.TYPE_PERCENT, getFieldByClass(BetweenDoubleField.class));
- betweenMap.put(IDataModelAttribute.TYPE_PLAIN_DOUBLE, getFieldByClass(BetweenDoubleField.class));
- betweenMap.put(IDataModelAttribute.TYPE_PLAIN_INTEGER, getFieldByClass(BetweenIntegerField.class));
- betweenMap.put(IDataModelAttribute.TYPE_PLAIN_LONG, getFieldByClass(BetweenLongField.class));
- betweenMap.put(IDataModelAttribute.TYPE_TIME, getFieldByClass(BetweenTimeField.class));
- m_opTypeToFieldMap.put(DataModelConstants.OPERATOR_BETWEEN, betweenMap);
- m_opTypeToFieldMap.put(DataModelConstants.OPERATOR_DATE_BETWEEN, betweenMap);
- m_opTypeToFieldMap.put(DataModelConstants.OPERATOR_DATE_TIME_BETWEEN, betweenMap);
- //type defaults
- HashMap<Integer, IComposerValueField> defaultMap = new HashMap<Integer, IComposerValueField>();
- defaultMap.put(IDataModelAttribute.TYPE_DATE, getFieldByClass(DateField.class));
- defaultMap.put(IDataModelAttribute.TYPE_DATE_TIME, getFieldByClass(DateTimeField.class));
- defaultMap.put(IDataModelAttribute.TYPE_DOUBLE, getFieldByClass(DoubleField.class));
- defaultMap.put(IDataModelAttribute.TYPE_AGGREGATE_COUNT, getFieldByClass(IntegerField.class));
- defaultMap.put(IDataModelAttribute.TYPE_INTEGER, getFieldByClass(IntegerField.class));
- defaultMap.put(IDataModelAttribute.TYPE_NUMBER_LIST, getFieldByClass(ListBoxField.class));
- defaultMap.put(IDataModelAttribute.TYPE_NUMBER_TREE, getFieldByClass(TreeBoxField.class));
- defaultMap.put(IDataModelAttribute.TYPE_CODE_LIST, getFieldByClass(ListBoxField.class));
- defaultMap.put(IDataModelAttribute.TYPE_CODE_TREE, getFieldByClass(TreeBoxField.class));
- defaultMap.put(IDataModelAttribute.TYPE_LONG, getFieldByClass(LongField.class));
- defaultMap.put(IDataModelAttribute.TYPE_PERCENT, getFieldByClass(DoubleField.class));
- defaultMap.put(IDataModelAttribute.TYPE_PLAIN_DOUBLE, getFieldByClass(DoubleField.class));
- defaultMap.put(IDataModelAttribute.TYPE_PLAIN_INTEGER, getFieldByClass(IntegerField.class));
- defaultMap.put(IDataModelAttribute.TYPE_PLAIN_LONG, getFieldByClass(LongField.class));
- defaultMap.put(IDataModelAttribute.TYPE_STRING, getFieldByClass(StringField.class));
- defaultMap.put(IDataModelAttribute.TYPE_FULL_TEXT, getFieldByClass(StringField.class));
- defaultMap.put(IDataModelAttribute.TYPE_SMART, getFieldByClass(SmartField.class));
- defaultMap.put(IDataModelAttribute.TYPE_TIME, getFieldByClass(TimeField.class));
- m_opTypeToFieldMap.put(0, defaultMap);
- //
- m_valueChangedListener = new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent e) {
- if (IValueField.PROP_VALUE.equals(e.getPropertyName())) {
- try {
- execChangedValue();
- }
- catch (Throwable t) {
- LOG.error("fire value change on " + e.getSource(), t);
- }
- }
- }
- };
- for (IFormField f : getFields()) {
- f.setLabelVisible(false);
- f.setLabel(ScoutTexts.get("Value"));
- f.setVisible(false);
- if (f instanceof ISequenceBox) {
- IFormField[] sequenceBoxChildFields = ((ISequenceBox) f).getFields();
- if (sequenceBoxChildFields.length > 0) {
- sequenceBoxChildFields[0].setLabelVisible(false);
- }
- if (sequenceBoxChildFields.length > 1 && sequenceBoxChildFields[1].getLabel() == null) {
- sequenceBoxChildFields[1].setLabel(ScoutTexts.get("and"));
- }
- }
- }
- }
-
- /**
- * @return the selected field (may be a sequence box) or null if no field is selected
- */
- public IComposerValueField getSelectedField() {
- return m_selectedField;
- }
-
- public void setSelectionContext(IDataModelAttribute attribute, IDataModelAttributeOp op, Object[] values) {
- if (op == null) {
- return;
- }
- if (values == null && getSelectedField() != null) {
- values = getSelectedField().getValues();
- }
- m_attribute = attribute;
- //
- int dataType = op.getType();
- if (dataType == IDataModelAttribute.TYPE_INHERITED) {
- dataType = attribute.getType();
- }
- Map<Integer, IComposerValueField> typeToFieldMap = m_opTypeToFieldMap.get(op.getOperator());
- if (typeToFieldMap == null) {
- //default
- typeToFieldMap = m_opTypeToFieldMap.get(0);
- }
- IComposerValueField valueField = typeToFieldMap.get(dataType);
- //clear old
- if (m_selectedField != null) {
- m_selectedField.removeValueChangeListenerFromTarget(m_valueChangedListener);
- m_selectedField.clearSelectionContext();
- }
- //set new
- m_selectedField = valueField;
- if (m_selectedField != null) {
- m_selectedField.addValueChangeListenerToTarget(m_valueChangedListener);
- m_selectedField.setSelectionContext(m_attribute, dataType, op, values);
- }
- for (IFormField f : getFields()) {
- if (f == m_selectedField) {
- f.setVisible(true);
- }
- else {
- f.setVisible(false);
- }
- }
- }
-
- public void clearSelectionContext() {
- //clear old
- if (m_selectedField != null) {
- m_selectedField.clearSelectionContext();
- }
- //set new
- m_selectedField = null;
- for (IFormField f : getFields()) {
- f.setVisible(false);
- }
- }
-
- @Order(10)
- @FormData(defaultSubtypeSdkCommand = DefaultSubtypeSdkCommand.IGNORE)
- public class ListBoxField extends AbstractListBox<Object> implements IComposerValueField {
-
- @Override
- protected boolean getConfiguredAutoLoad() {
- return false;
- }
-
- @Override
- protected int getConfiguredGridH() {
- return 4;
- }
-
- @Override
- protected void execPrepareLookup(LookupCall call) throws ProcessingException {
- if (m_attribute != null) {
- // if isFilterActiveRows() is true, do not use a filter to load rows
- // the list box is only populated one time and filtering for active/inactive is done afterwards
- call.setActive(isFilterActiveRows() ? null : TriState.TRUE);
- m_attribute.prepareLookup(call);
- }
- }
-
- @Override
- public void addValueChangeListenerToTarget(PropertyChangeListener listener) {
- this.addPropertyChangeListener(listener);
- }
-
- @Override
- public void removeValueChangeListenerFromTarget(PropertyChangeListener listener) {
- this.removePropertyChangeListener(listener);
- }
-
- @Override
- public void setSelectionContext(IDataModelAttribute attribute, int dataType, IDataModelAttributeOp op, Object[] values) {
- setFilterActiveRows(attribute.isActiveFilterEnabled());
- LookupCall newCall = attribute.getLookupCall();
- if (getLookupCall() != newCall) {
- setLookupCall(attribute.getLookupCall());
- try {
- loadListBoxData();
- }
- catch (Exception e) {
- LOG.warn(null, e);
- // nop
- }
- }
- try {
- if (values != null && values.length == 1 && values[0] instanceof Object[]) {
- setValue((Object[]) values[0]);
- }
- else {
- setValue(null);
- }
- }
- catch (Exception e) {
- // nop
- setValue(null);
- }
- }
-
- @Override
- public void clearSelectionContext() {
- setValue(null);
- }
-
- @Override
- public Object[] getValues() {
- if (getCheckedKeyCount() > 0) {
- return new Object[]{getValue()};
- }
- else {
- return null;
- }
- }
-
- @Override
- public String[] getTexts() {
- return new String[]{getDisplayText()};
- }
- }
-
- @Order(10)
- @FormData(defaultSubtypeSdkCommand = DefaultSubtypeSdkCommand.IGNORE)
- public class TreeBoxField extends AbstractTreeBox<Object> implements IComposerValueField {
-
- @Override
- protected boolean getConfiguredAutoLoad() {
- return false;
- }
-
- @Override
- protected int getConfiguredGridH() {
- return 4;
- }
-
- @Override
- protected void execPrepareLookup(LookupCall call, ITreeNode parent) throws ProcessingException {
- if (m_attribute != null) {
- // if isFilterActiveNodes() is true, do not use a filter to load nodes
- // the tree box is only populated one time and filtering for active/inactive is done afterwards
- call.setActive(isFilterActiveNodes() ? null : TriState.TRUE);
- m_attribute.prepareLookup(call);
- }
- }
-
- @Override
- public void addValueChangeListenerToTarget(PropertyChangeListener listener) {
- this.addPropertyChangeListener(listener);
- }
-
- @Override
- public void removeValueChangeListenerFromTarget(PropertyChangeListener listener) {
- this.removePropertyChangeListener(listener);
- }
-
- @Override
- public void setSelectionContext(IDataModelAttribute attribute, int dataType, IDataModelAttributeOp op, Object[] values) {
- setFilterActiveNodes(attribute.isActiveFilterEnabled());
- LookupCall newCall = attribute.getLookupCall();
- if (getLookupCall() != newCall) {
- setLookupCall(newCall);
- try {
- loadRootNode();
- getTree().setNodeExpanded(getTree().getRootNode(), true);
- }
- catch (Exception e) {
- LOG.warn(null, e);
- // nop
- }
- }
- try {
- if (values != null && values.length == 1 && values[0] instanceof Object[]) {
- setValue((Object[]) values[0]);
- }
- else {
- setValue(null);
- }
- }
- catch (Exception e) {
- // nop
- setValue(null);
- }
- }
-
- @Override
- public void clearSelectionContext() {
- setValue(null);
- }
-
- @Override
- public Object[] getValues() {
- if (getCheckedKeyCount() > 0) {
- return new Object[]{getValue()};
- }
- else {
- return null;
- }
- }
-
- @Override
- public String[] getTexts() {
- return new String[]{getDisplayText()};
- }
- }
-
- @Order(10)
- @FormData(defaultSubtypeSdkCommand = DefaultSubtypeSdkCommand.IGNORE)
- public class DateField extends AbstractDateField implements IComposerValueField {
- @Override
- public void addValueChangeListenerToTarget(PropertyChangeListener listener) {
- this.addPropertyChangeListener(listener);
- }
-
- @Override
- public void removeValueChangeListenerFromTarget(PropertyChangeListener listener) {
- this.removePropertyChangeListener(listener);
- }
-
- @Override
- public void setSelectionContext(IDataModelAttribute attribute, int dataType, IDataModelAttributeOp op, Object[] values) {
- try {
- if (values != null && values.length == 1 && values[0] instanceof Date) {
- setValue((Date) values[0]);
- }
- else {
- setValue(null);
- }
- }
- catch (Exception e) {
- // nop
- setValue(null);
- }
- }
-
- @Override
- public void clearSelectionContext() {
- setValue(null);
- }
-
- @Override
- public Object[] getValues() {
- if (getValue() != null) {
- return new Object[]{getValue()};
- }
- else {
- return null;
- }
- }
-
- @Override
- public String[] getTexts() {
- return new String[]{getDisplayText()};
- }
- }
-
- @Order(10)
- @FormData(defaultSubtypeSdkCommand = DefaultSubtypeSdkCommand.IGNORE)
- public class TimeField extends AbstractTimeField implements IComposerValueField {
- @Override
- public void addValueChangeListenerToTarget(PropertyChangeListener listener) {
- this.addPropertyChangeListener(listener);
- }
-
- @Override
- public void removeValueChangeListenerFromTarget(PropertyChangeListener listener) {
- this.removePropertyChangeListener(listener);
- }
-
- @Override
- public void setSelectionContext(IDataModelAttribute attribute, int dataType, IDataModelAttributeOp op, Object[] values) {
- try {
- if (values != null && values.length == 1) {
- if (values[0] instanceof Double) {
- setTimeValue((Double) values[0]);
- }
- else if (values[0] instanceof Date) {
- setValue((Date) values[0]);
- }
- else {
- setValue(null);
- }
- }
- else {
- setValue(null);
- }
- }
- catch (Exception e) {
- // nop
- setValue(null);
- }
- }
-
- @Override
- public void clearSelectionContext() {
- setValue(null);
- }
-
- @Override
- public Object[] getValues() {
- if (getValue() != null) {
- return new Object[]{getValue()};
- }
- else {
- return null;
- }
- }
-
- @Override
- public String[] getTexts() {
- return new String[]{getDisplayText()};
- }
- }
-
- @Order(10)
- @FormData(defaultSubtypeSdkCommand = DefaultSubtypeSdkCommand.IGNORE)
- public class DateTimeField extends AbstractDateField implements IComposerValueField {
-
- @Override
- protected boolean getConfiguredHasTime() {
- return true;
- }
-
- @Override
- public void addValueChangeListenerToTarget(PropertyChangeListener listener) {
- this.addPropertyChangeListener(listener);
- }
-
- @Override
- public void removeValueChangeListenerFromTarget(PropertyChangeListener listener) {
- this.removePropertyChangeListener(listener);
- }
-
- @Override
- public void setSelectionContext(IDataModelAttribute attribute, int dataType, IDataModelAttributeOp op, Object[] values) {
- try {
- if (values != null && values.length == 1 && values[0] instanceof Date) {
- setValue((Date) values[0]);
- }
- else {
- setValue(null);
- }
- }
- catch (Exception e) {
- // nop
- setValue(null);
- }
- }
-
- @Override
- public void clearSelectionContext() {
- setValue(null);
- }
-
- @Override
- public Object[] getValues() {
- if (getValue() != null) {
- return new Object[]{getValue()};
- }
- else {
- return null;
- }
- }
-
- @Override
- public String[] getTexts() {
- return new String[]{getDisplayText()};
- }
- }
-
- @Order(10)
- @FormData(defaultSubtypeSdkCommand = DefaultSubtypeSdkCommand.IGNORE)
- public class IntegerField extends AbstractIntegerField implements IComposerValueField {
- @Override
- public void addValueChangeListenerToTarget(PropertyChangeListener listener) {
- this.addPropertyChangeListener(listener);
- }
-
- @Override
- public void removeValueChangeListenerFromTarget(PropertyChangeListener listener) {
- this.removePropertyChangeListener(listener);
- }
-
- @Override
- public void setSelectionContext(IDataModelAttribute attribute, int dataType, IDataModelAttributeOp op, Object[] values) {
- switch (dataType) {
- case IDataModelAttribute.TYPE_INTEGER: {
- setGroupingUsed(true);
- break;
- }
- case IDataModelAttribute.TYPE_PLAIN_INTEGER: {
- setGroupingUsed(false);
- break;
- }
- }
- try {
- if (values != null && values.length == 1 && values[0] instanceof Integer) {
- setValue((Integer) values[0]);
- }
- else {
- setValue(null);
- }
- }
- catch (Exception e) {
- // nop
- setValue(null);
- }
- }
-
- @Override
- public void clearSelectionContext() {
- setValue(null);
- }
-
- @Override
- public Object[] getValues() {
- if (getValue() != null) {
- return new Object[]{getValue()};
- }
- else {
- return null;
- }
- }
-
- @Override
- public String[] getTexts() {
- return new String[]{getDisplayText()};
- }
- }
-
- @Order(10)
- @FormData(defaultSubtypeSdkCommand = DefaultSubtypeSdkCommand.IGNORE)
- public class LongField extends AbstractLongField implements IComposerValueField {
- @Override
- public void addValueChangeListenerToTarget(PropertyChangeListener listener) {
- this.addPropertyChangeListener(listener);
- }
-
- @Override
- public void removeValueChangeListenerFromTarget(PropertyChangeListener listener) {
- this.removePropertyChangeListener(listener);
- }
-
- @Override
- public void setSelectionContext(IDataModelAttribute attribute, int dataType, IDataModelAttributeOp op, Object[] values) {
- switch (dataType) {
- case IDataModelAttribute.TYPE_LONG: {
- setGroupingUsed(true);
- break;
- }
- case IDataModelAttribute.TYPE_PLAIN_LONG: {
- setGroupingUsed(false);
- break;
- }
- }
- try {
- if (values != null && values.length == 1 && values[0] instanceof Long) {
- setValue((Long) values[0]);
- }
- else {
- setValue(null);
- }
- }
- catch (Exception e) {
- // nop
- setValue(null);
- }
- }
-
- @Override
- public void clearSelectionContext() {
- setValue(null);
- }
-
- @Override
- public Object[] getValues() {
- if (getValue() != null) {
- return new Object[]{getValue()};
- }
- else {
- return null;
- }
- }
-
- @Override
- public String[] getTexts() {
- return new String[]{getDisplayText()};
- }
- }
-
- @Order(10)
- @FormData(defaultSubtypeSdkCommand = DefaultSubtypeSdkCommand.IGNORE)
- public class DoubleField extends AbstractDoubleField implements IComposerValueField {
- @Override
- public void addValueChangeListenerToTarget(PropertyChangeListener listener) {
- this.addPropertyChangeListener(listener);
- }
-
- @Override
- public void removeValueChangeListenerFromTarget(PropertyChangeListener listener) {
- this.removePropertyChangeListener(listener);
- }
-
- @Override
- public void setSelectionContext(IDataModelAttribute attribute, int dataType, IDataModelAttributeOp op, Object[] values) {
- switch (dataType) {
- case IDataModelAttribute.TYPE_DOUBLE: {
- setGroupingUsed(true);
- setPercent(false);
- break;
- }
- case IDataModelAttribute.TYPE_PERCENT: {
- setGroupingUsed(true);
- setPercent(true);
- break;
- }
- case IDataModelAttribute.TYPE_PLAIN_DOUBLE: {
- setGroupingUsed(false);
- setPercent(false);
- break;
- }
- }
- try {
- if (values != null && values.length == 1 && values[0] instanceof Double) {
- setValue((Double) values[0]);
- }
- else {
- setValue(null);
- }
- }
- catch (Exception e) {
- // nop
- setValue(null);
- }
- }
-
- @Override
- public void clearSelectionContext() {
- setValue(null);
- }
-
- @Override
- public Object[] getValues() {
- if (getValue() != null) {
- return new Object[]{getValue()};
- }
- else {
- return null;
- }
- }
-
- @Override
- public String[] getTexts() {
- return new String[]{getDisplayText()};
- }
- }
-
- @Order(10)
- @FormData(defaultSubtypeSdkCommand = DefaultSubtypeSdkCommand.IGNORE)
- public class StringField extends AbstractStringField implements IComposerValueField {
- @Override
- public void addValueChangeListenerToTarget(PropertyChangeListener listener) {
- this.addPropertyChangeListener(listener);
- }
-
- @Override
- public void removeValueChangeListenerFromTarget(PropertyChangeListener listener) {
- this.removePropertyChangeListener(listener);
- }
-
- @Override
- public void setSelectionContext(IDataModelAttribute attribute, int dataType, IDataModelAttributeOp op, Object[] values) {
- try {
- if (values != null && values.length == 1 && values[0] instanceof String) {
- setValue((String) values[0]);
- }
- else {
- setValue(null);
- }
- }
- catch (Exception e) {
- // nop
- setValue(null);
- }
- }
-
- @Override
- public void clearSelectionContext() {
- setValue(null);
- }
-
- @Override
- public Object[] getValues() {
- if (getValue() != null) {
- return new Object[]{getValue()};
- }
- else {
- return null;
- }
- }
-
- @Override
- public String[] getTexts() {
- return new String[]{getDisplayText()};
- }
- }
-
- @Order(10)
- @FormData(defaultSubtypeSdkCommand = DefaultSubtypeSdkCommand.IGNORE)
- public class SmartField extends AbstractSmartField<Object> implements IComposerValueField {
-
- @Override
- protected String getConfiguredBrowseIconId() {
- return AbstractIcons.Empty;
- }
-
- @Override
- protected void execPrepareLookup(LookupCall call) throws ProcessingException {
- if (m_attribute != null) {
- call.setActive(isActiveFilterEnabled() ? getActiveFilter() : TriState.TRUE);
- m_attribute.prepareLookup(call);
- }
- }
-
- @Override
- public void addValueChangeListenerToTarget(PropertyChangeListener listener) {
- this.addPropertyChangeListener(listener);
- }
-
- @Override
- public void removeValueChangeListenerFromTarget(PropertyChangeListener listener) {
- this.removePropertyChangeListener(listener);
- }
-
- @Override
- public void setSelectionContext(IDataModelAttribute attribute, int dataType, IDataModelAttributeOp op, Object[] values) {
- setActiveFilterEnabled(attribute.isActiveFilterEnabled());
- LookupCall newCall = attribute.getLookupCall();
- if (getLookupCall() != newCall) {
- setLookupCall(newCall);
- }
- try {
- if (values != null && values.length == 1) {
- setValue(values[0]);
- }
- else {
- setValue(null);
- }
- }
- catch (Exception e) {
- // nop
- setValue(null);
- }
- }
-
- @Override
- public void clearSelectionContext() {
- setValue(null);
- }
-
- @Override
- public Object[] getValues() {
- if (getValue() != null) {
- return new Object[]{getValue()};
- }
- else {
- return null;
- }
- }
-
- @Override
- public String[] getTexts() {
- return new String[]{getDisplayText()};
- }
- }
-
- //XXXXXXXXXXXXXXXXXXXXXXX
-
- @Order(10)
- @FormData(defaultSubtypeSdkCommand = DefaultSubtypeSdkCommand.IGNORE)
- public class BetweenDateField extends AbstractSequenceBox implements IComposerValueField {
- @Order(10)
- public class DateFromField extends AbstractDateField {
- }
-
- @Order(20)
- public class DateToField extends AbstractDateField {
- }
-
- @Override
- public void addValueChangeListenerToTarget(PropertyChangeListener listener) {
- for (IFormField f : getFields()) {
- f.addPropertyChangeListener(listener);
- }
- }
-
- @Override
- public void removeValueChangeListenerFromTarget(PropertyChangeListener listener) {
- for (IFormField f : getFields()) {
- f.removePropertyChangeListener(listener);
- }
- }
-
- @Override
- public void setSelectionContext(IDataModelAttribute attribute, int dataType, IDataModelAttributeOp op, Object[] values) {
- try {
- getFieldByClass(BetweenDateField.DateFromField.class).setValue(null);
- getFieldByClass(BetweenDateField.DateToField.class).setValue(null);
- if (values != null && values.length == 2) {
- if (values[0] instanceof Date) {
- getFieldByClass(BetweenDateField.DateFromField.class).setValue((Date) values[0]);
- }
- if (values[1] instanceof Date) {
- getFieldByClass(BetweenDateField.DateToField.class).setValue((Date) values[1]);
- }
- }
- }
- catch (Exception e) {
- // nop
- }
- }
-
- @Override
- public void clearSelectionContext() {
- getFieldByClass(BetweenDateField.DateFromField.class).setValue(null);
- getFieldByClass(BetweenDateField.DateToField.class).setValue(null);
- }
-
- @Override
- public Object[] getValues() {
- Object a = getFieldByClass(BetweenDateField.DateFromField.class).getValue();
- Object b = getFieldByClass(BetweenDateField.DateToField.class).getValue();
- if (a != null || b != null) {
- return new Object[]{a, b};
- }
- else {
- return null;
- }
- }
-
- @Override
- public String[] getTexts() {
- String a = getFieldByClass(BetweenDateField.DateFromField.class).getDisplayText();
- String b = getFieldByClass(BetweenDateField.DateToField.class).getDisplayText();
- return new String[]{a, b};
- }
- }
-
- @Order(10)
- @FormData(defaultSubtypeSdkCommand = DefaultSubtypeSdkCommand.IGNORE)
- public class BetweenTimeField extends AbstractSequenceBox implements IComposerValueField {
- @Order(10)
- public class TimeFromField extends AbstractTimeField {
- }
-
- @Order(20)
- public class TimeToField extends AbstractTimeField {
- }
-
- @Override
- public void addValueChangeListenerToTarget(PropertyChangeListener listener) {
- for (IFormField f : getFields()) {
- f.addPropertyChangeListener(listener);
- }
- }
-
- @Override
- public void removeValueChangeListenerFromTarget(PropertyChangeListener listener) {
- for (IFormField f : getFields()) {
- f.removePropertyChangeListener(listener);
- }
- }
-
- @Override
- public void setSelectionContext(IDataModelAttribute attribute, int dataType, IDataModelAttributeOp op, Object[] values) {
- try {
- getFieldByClass(BetweenTimeField.TimeFromField.class).setValue(null);
- getFieldByClass(BetweenTimeField.TimeToField.class).setValue(null);
- if (values != null && values.length == 2) {
- if (values[0] instanceof Double) {
- getFieldByClass(BetweenTimeField.TimeFromField.class).setTimeValue((Double) values[0]);
- }
- else if (values[0] instanceof Date) {
- getFieldByClass(BetweenTimeField.TimeFromField.class).setValue((Date) values[0]);
- }
- if (values[1] instanceof Double) {
- getFieldByClass(BetweenTimeField.TimeToField.class).setTimeValue((Double) values[1]);
- }
- else if (values[1] instanceof Date) {
- getFieldByClass(BetweenTimeField.TimeToField.class).setValue((Date) values[1]);
- }
- }
- }
- catch (Exception e) {
- // nop
- }
- }
-
- @Override
- public void clearSelectionContext() {
- getFieldByClass(BetweenTimeField.TimeFromField.class).setValue(null);
- getFieldByClass(BetweenTimeField.TimeToField.class).setValue(null);
- }
-
- @Override
- public Object[] getValues() {
- Object a = getFieldByClass(BetweenTimeField.TimeFromField.class).getValue();
- Object b = getFieldByClass(BetweenTimeField.TimeToField.class).getValue();
- if (a != null || b != null) {
- return new Object[]{a, b};
- }
- else {
- return null;
- }
- }
-
- @Override
- public String[] getTexts() {
- String a = getFieldByClass(BetweenTimeField.TimeFromField.class).getDisplayText();
- String b = getFieldByClass(BetweenTimeField.TimeToField.class).getDisplayText();
- return new String[]{a, b};
- }
- }
-
- @Order(10)
- @FormData(defaultSubtypeSdkCommand = DefaultSubtypeSdkCommand.IGNORE)
- public class BetweenDateTimeField extends AbstractSequenceBox implements IComposerValueField {
- @Order(10)
- public class DateTimeFromField extends AbstractDateField {
- @Override
- protected boolean getConfiguredHasTime() {
- return true;
- }
- }
-
- @Order(20)
- public class DateTimeToField extends AbstractDateField {
- @Override
- protected boolean getConfiguredHasTime() {
- return true;
- }
- }
-
- @Override
- public void addValueChangeListenerToTarget(PropertyChangeListener listener) {
- for (IFormField f : getFields()) {
- f.addPropertyChangeListener(listener);
- }
- }
-
- @Override
- public void removeValueChangeListenerFromTarget(PropertyChangeListener listener) {
- for (IFormField f : getFields()) {
- f.removePropertyChangeListener(listener);
- }
- }
-
- @Override
- public void setSelectionContext(IDataModelAttribute attribute, int dataType, IDataModelAttributeOp op, Object[] values) {
- try {
- getFieldByClass(BetweenDateTimeField.DateTimeFromField.class).setValue(null);
- getFieldByClass(BetweenDateTimeField.DateTimeToField.class).setValue(null);
- if (values != null && values.length == 2) {
- if (values[0] instanceof Date) {
- getFieldByClass(BetweenDateTimeField.DateTimeFromField.class).setValue((Date) values[0]);
- }
- if (values[1] instanceof Date) {
- getFieldByClass(BetweenDateTimeField.DateTimeToField.class).setValue((Date) values[1]);
- }
- }
- }
- catch (Exception e) {
- // nop
- }
- }
-
- @Override
- public void clearSelectionContext() {
- getFieldByClass(BetweenDateTimeField.DateTimeFromField.class).setValue(null);
- getFieldByClass(BetweenDateTimeField.DateTimeToField.class).setValue(null);
- }
-
- @Override
- public Object[] getValues() {
- Object a = getFieldByClass(BetweenDateTimeField.DateTimeFromField.class).getValue();
- Object b = getFieldByClass(BetweenDateTimeField.DateTimeToField.class).getValue();
- if (a != null || b != null) {
- return new Object[]{a, b};
- }
- else {
- return null;
- }
- }
-
- @Override
- public String[] getTexts() {
- String a = getFieldByClass(BetweenDateTimeField.DateTimeFromField.class).getDisplayText();
- String b = getFieldByClass(BetweenDateTimeField.DateTimeToField.class).getDisplayText();
- return new String[]{a, b};
- }
- }
-
- @Order(10)
- @FormData(defaultSubtypeSdkCommand = DefaultSubtypeSdkCommand.IGNORE)
- public class BetweenIntegerField extends AbstractSequenceBox implements IComposerValueField {
- @Order(10)
- public class IntegerFromField extends AbstractIntegerField {
- }
-
- @Order(20)
- public class IntegerToField extends AbstractIntegerField {
- }
-
- @Override
- public void addValueChangeListenerToTarget(PropertyChangeListener listener) {
- for (IFormField f : getFields()) {
- f.addPropertyChangeListener(listener);
- }
- }
-
- @Override
- public void removeValueChangeListenerFromTarget(PropertyChangeListener listener) {
- for (IFormField f : getFields()) {
- f.removePropertyChangeListener(listener);
- }
- }
-
- @Override
- public void setSelectionContext(IDataModelAttribute attribute, int dataType, IDataModelAttributeOp op, Object[] values) {
- try {
- getFieldByClass(BetweenIntegerField.IntegerFromField.class).setValue(null);
- getFieldByClass(BetweenIntegerField.IntegerToField.class).setValue(null);
- if (values != null && values.length == 2) {
- if (values[0] instanceof Integer) {
- getFieldByClass(BetweenIntegerField.IntegerFromField.class).setValue((Integer) values[0]);
- }
- if (values[1] instanceof Integer) {
- getFieldByClass(BetweenIntegerField.IntegerToField.class).setValue((Integer) values[1]);
- }
- }
- }
- catch (Exception e) {
- // nop
- }
- }
-
- @Override
- public void clearSelectionContext() {
- getFieldByClass(BetweenIntegerField.IntegerFromField.class).setValue(null);
- getFieldByClass(BetweenIntegerField.IntegerToField.class).setValue(null);
- }
-
- @Override
- public Object[] getValues() {
- Object a = getFieldByClass(BetweenIntegerField.IntegerFromField.class).getValue();
- Object b = getFieldByClass(BetweenIntegerField.IntegerToField.class).getValue();
- if (a != null || b != null) {
- return new Object[]{a, b};
- }
- else {
- return null;
- }
- }
-
- @Override
- public String[] getTexts() {
- String a = getFieldByClass(BetweenIntegerField.IntegerFromField.class).getDisplayText();
- String b = getFieldByClass(BetweenIntegerField.IntegerToField.class).getDisplayText();
- return new String[]{a, b};
- }
- }
-
- @Order(10)
- @FormData(defaultSubtypeSdkCommand = DefaultSubtypeSdkCommand.IGNORE)
- public class BetweenLongField extends AbstractSequenceBox implements IComposerValueField {
- @Order(10)
- public class LongFromField extends AbstractLongField {
- }
-
- @Order(20)
- public class LongToField extends AbstractLongField {
- }
-
- @Override
- public void addValueChangeListenerToTarget(PropertyChangeListener listener) {
- for (IFormField f : getFields()) {
- f.addPropertyChangeListener(listener);
- }
- }
-
- @Override
- public void removeValueChangeListenerFromTarget(PropertyChangeListener listener) {
- for (IFormField f : getFields()) {
- f.removePropertyChangeListener(listener);
- }
- }
-
- @Override
- public void setSelectionContext(IDataModelAttribute attribute, int dataType, IDataModelAttributeOp op, Object[] values) {
- try {
- getFieldByClass(BetweenLongField.LongFromField.class).setValue(null);
- getFieldByClass(BetweenLongField.LongToField.class).setValue(null);
- if (values != null && values.length == 2) {
- if (values[0] instanceof Long) {
- getFieldByClass(BetweenLongField.LongFromField.class).setValue((Long) values[0]);
- }
- if (values[1] instanceof Long) {
- getFieldByClass(BetweenLongField.LongToField.class).setValue((Long) values[1]);
- }
- }
- }
- catch (Exception e) {
- // nop
- }
- }
-
- @Override
- public void clearSelectionContext() {
- getFieldByClass(BetweenLongField.LongFromField.class).setValue(null);
- getFieldByClass(BetweenLongField.LongToField.class).setValue(null);
- }
-
- @Override
- public Object[] getValues() {
- Object a = getFieldByClass(BetweenLongField.LongFromField.class).getValue();
- Object b = getFieldByClass(BetweenLongField.LongToField.class).getValue();
- if (a != null || b != null) {
- return new Object[]{a, b};
- }
- else {
- return null;
- }
- }
-
- @Override
- public String[] getTexts() {
- String a = getFieldByClass(BetweenLongField.LongFromField.class).getDisplayText();
- String b = getFieldByClass(BetweenLongField.LongToField.class).getDisplayText();
- return new String[]{a, b};
- }
- }
-
- @Order(10)
- @FormData(defaultSubtypeSdkCommand = DefaultSubtypeSdkCommand.IGNORE)
- public class BetweenDoubleField extends AbstractSequenceBox implements IComposerValueField {
- @Order(10)
- public class DoubleFromField extends AbstractDoubleField {
- }
-
- @Order(20)
- public class DoubleToField extends AbstractDoubleField {
- }
-
- @Override
- public void addValueChangeListenerToTarget(PropertyChangeListener listener) {
- for (IFormField f : getFields()) {
- f.addPropertyChangeListener(listener);
- }
- }
-
- @Override
- public void removeValueChangeListenerFromTarget(PropertyChangeListener listener) {
- for (IFormField f : getFields()) {
- f.removePropertyChangeListener(listener);
- }
- }
-
- @Override
- public void setSelectionContext(IDataModelAttribute attribute, int dataType, IDataModelAttributeOp op, Object[] values) {
- try {
- getFieldByClass(BetweenDoubleField.DoubleFromField.class).setValue(null);
- getFieldByClass(BetweenDoubleField.DoubleToField.class).setValue(null);
- if (values != null && values.length == 2) {
- if (values[0] instanceof Double) {
- getFieldByClass(BetweenDoubleField.DoubleFromField.class).setValue((Double) values[0]);
- }
- if (values[1] instanceof Double) {
- getFieldByClass(BetweenDoubleField.DoubleToField.class).setValue((Double) values[1]);
- }
- }
- }
- catch (Exception e) {
- // nop
- }
- }
-
- @Override
- public void clearSelectionContext() {
- getFieldByClass(BetweenDoubleField.DoubleFromField.class).setValue(null);
- getFieldByClass(BetweenDoubleField.DoubleToField.class).setValue(null);
- }
-
- @Override
- public Object[] getValues() {
- Object a = getFieldByClass(BetweenDoubleField.DoubleFromField.class).getValue();
- Object b = getFieldByClass(BetweenDoubleField.DoubleToField.class).getValue();
- if (a != null || b != null) {
- return new Object[]{a, b};
- }
- else {
- return null;
- }
- }
-
- @Override
- public String[] getTexts() {
- String a = getFieldByClass(BetweenDoubleField.DoubleFromField.class).getDisplayText();
- String b = getFieldByClass(BetweenDoubleField.DoubleToField.class).getDisplayText();
- return new String[]{a, b};
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.composer;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.scout.commons.TriState;
+import org.eclipse.scout.commons.annotations.ConfigOperation;
+import org.eclipse.scout.commons.annotations.FormData;
+import org.eclipse.scout.commons.annotations.FormData.DefaultSubtypeSdkCommand;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
+import org.eclipse.scout.rt.client.ui.form.fields.datefield.AbstractDateField;
+import org.eclipse.scout.rt.client.ui.form.fields.datefield.AbstractTimeField;
+import org.eclipse.scout.rt.client.ui.form.fields.doublefield.AbstractDoubleField;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
+import org.eclipse.scout.rt.client.ui.form.fields.integerfield.AbstractIntegerField;
+import org.eclipse.scout.rt.client.ui.form.fields.listbox.AbstractListBox;
+import org.eclipse.scout.rt.client.ui.form.fields.longfield.AbstractLongField;
+import org.eclipse.scout.rt.client.ui.form.fields.sequencebox.AbstractSequenceBox;
+import org.eclipse.scout.rt.client.ui.form.fields.sequencebox.ISequenceBox;
+import org.eclipse.scout.rt.client.ui.form.fields.smartfield.AbstractSmartField;
+import org.eclipse.scout.rt.client.ui.form.fields.stringfield.AbstractStringField;
+import org.eclipse.scout.rt.client.ui.form.fields.treebox.AbstractTreeBox;
+import org.eclipse.scout.rt.shared.AbstractIcons;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.data.model.DataModelConstants;
+import org.eclipse.scout.rt.shared.data.model.IDataModelAttribute;
+import org.eclipse.scout.rt.shared.data.model.IDataModelAttributeOp;
+import org.eclipse.scout.rt.shared.services.common.jdbc.SearchFilter;
+import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
+
+/**
+ * Template box containing all composer values.
+ * <p>
+ */
+public abstract class AbstractComposerValueBox extends AbstractGroupBox {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractComposerValueBox.class);
+
+ private Map<Integer/*operator*/, Map<Integer/*dataType*/, IComposerValueField>> m_opTypeToFieldMap;
+ //selection context
+ private IDataModelAttribute m_attribute;
+ private IComposerValueField m_selectedField;
+ private PropertyChangeListener m_valueChangedListener;
+
+ public AbstractComposerValueBox() {
+ this(true);
+ }
+
+ public AbstractComposerValueBox(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ @Override
+ protected boolean getConfiguredBorderVisible() {
+ return false;
+ }
+
+ @Override
+ protected int getConfiguredGridColumnCount() {
+ return 1;
+ }
+
+ @Override
+ protected int getConfiguredGridW() {
+ return 1;
+ }
+
+ /**
+ * This callback is invoked whenever the active value field changed its value.
+ */
+ @ConfigOperation
+ @Order(50)
+ protected void execChangedValue() throws ProcessingException {
+ }
+
+ @Override
+ protected void execAddSearchTerms(SearchFilter search) {
+ //nop
+ }
+
+ @Override
+ protected void initConfig() {
+ super.initConfig();
+ m_opTypeToFieldMap = new HashMap<Integer, Map<Integer, IComposerValueField>>();
+ //specific operators
+ HashMap<Integer, IComposerValueField> betweenMap = new HashMap<Integer, IComposerValueField>();
+ betweenMap.put(IDataModelAttribute.TYPE_DATE, getFieldByClass(BetweenDateField.class));
+ betweenMap.put(IDataModelAttribute.TYPE_DATE_TIME, getFieldByClass(BetweenDateTimeField.class));
+ betweenMap.put(IDataModelAttribute.TYPE_DOUBLE, getFieldByClass(BetweenDoubleField.class));
+ betweenMap.put(IDataModelAttribute.TYPE_AGGREGATE_COUNT, getFieldByClass(BetweenIntegerField.class));
+ betweenMap.put(IDataModelAttribute.TYPE_INTEGER, getFieldByClass(BetweenIntegerField.class));
+ betweenMap.put(IDataModelAttribute.TYPE_LONG, getFieldByClass(BetweenLongField.class));
+ betweenMap.put(IDataModelAttribute.TYPE_PERCENT, getFieldByClass(BetweenDoubleField.class));
+ betweenMap.put(IDataModelAttribute.TYPE_PLAIN_DOUBLE, getFieldByClass(BetweenDoubleField.class));
+ betweenMap.put(IDataModelAttribute.TYPE_PLAIN_INTEGER, getFieldByClass(BetweenIntegerField.class));
+ betweenMap.put(IDataModelAttribute.TYPE_PLAIN_LONG, getFieldByClass(BetweenLongField.class));
+ betweenMap.put(IDataModelAttribute.TYPE_TIME, getFieldByClass(BetweenTimeField.class));
+ m_opTypeToFieldMap.put(DataModelConstants.OPERATOR_BETWEEN, betweenMap);
+ m_opTypeToFieldMap.put(DataModelConstants.OPERATOR_DATE_BETWEEN, betweenMap);
+ m_opTypeToFieldMap.put(DataModelConstants.OPERATOR_DATE_TIME_BETWEEN, betweenMap);
+ //type defaults
+ HashMap<Integer, IComposerValueField> defaultMap = new HashMap<Integer, IComposerValueField>();
+ defaultMap.put(IDataModelAttribute.TYPE_DATE, getFieldByClass(DateField.class));
+ defaultMap.put(IDataModelAttribute.TYPE_DATE_TIME, getFieldByClass(DateTimeField.class));
+ defaultMap.put(IDataModelAttribute.TYPE_DOUBLE, getFieldByClass(DoubleField.class));
+ defaultMap.put(IDataModelAttribute.TYPE_AGGREGATE_COUNT, getFieldByClass(IntegerField.class));
+ defaultMap.put(IDataModelAttribute.TYPE_INTEGER, getFieldByClass(IntegerField.class));
+ defaultMap.put(IDataModelAttribute.TYPE_NUMBER_LIST, getFieldByClass(ListBoxField.class));
+ defaultMap.put(IDataModelAttribute.TYPE_NUMBER_TREE, getFieldByClass(TreeBoxField.class));
+ defaultMap.put(IDataModelAttribute.TYPE_CODE_LIST, getFieldByClass(ListBoxField.class));
+ defaultMap.put(IDataModelAttribute.TYPE_CODE_TREE, getFieldByClass(TreeBoxField.class));
+ defaultMap.put(IDataModelAttribute.TYPE_LONG, getFieldByClass(LongField.class));
+ defaultMap.put(IDataModelAttribute.TYPE_PERCENT, getFieldByClass(DoubleField.class));
+ defaultMap.put(IDataModelAttribute.TYPE_PLAIN_DOUBLE, getFieldByClass(DoubleField.class));
+ defaultMap.put(IDataModelAttribute.TYPE_PLAIN_INTEGER, getFieldByClass(IntegerField.class));
+ defaultMap.put(IDataModelAttribute.TYPE_PLAIN_LONG, getFieldByClass(LongField.class));
+ defaultMap.put(IDataModelAttribute.TYPE_STRING, getFieldByClass(StringField.class));
+ defaultMap.put(IDataModelAttribute.TYPE_FULL_TEXT, getFieldByClass(StringField.class));
+ defaultMap.put(IDataModelAttribute.TYPE_SMART, getFieldByClass(SmartField.class));
+ defaultMap.put(IDataModelAttribute.TYPE_TIME, getFieldByClass(TimeField.class));
+ m_opTypeToFieldMap.put(0, defaultMap);
+ //
+ m_valueChangedListener = new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent e) {
+ if (IValueField.PROP_VALUE.equals(e.getPropertyName())) {
+ try {
+ execChangedValue();
+ }
+ catch (Throwable t) {
+ LOG.error("fire value change on " + e.getSource(), t);
+ }
+ }
+ }
+ };
+ for (IFormField f : getFields()) {
+ f.setLabelVisible(false);
+ f.setLabel(ScoutTexts.get("Value"));
+ f.setVisible(false);
+ if (f instanceof ISequenceBox) {
+ IFormField[] sequenceBoxChildFields = ((ISequenceBox) f).getFields();
+ if (sequenceBoxChildFields.length > 0) {
+ sequenceBoxChildFields[0].setLabelVisible(false);
+ }
+ if (sequenceBoxChildFields.length > 1 && sequenceBoxChildFields[1].getLabel() == null) {
+ sequenceBoxChildFields[1].setLabel(ScoutTexts.get("and"));
+ }
+ }
+ }
+ }
+
+ /**
+ * @return the selected field (may be a sequence box) or null if no field is selected
+ */
+ public IComposerValueField getSelectedField() {
+ return m_selectedField;
+ }
+
+ public void setSelectionContext(IDataModelAttribute attribute, IDataModelAttributeOp op, Object[] values) {
+ if (op == null) {
+ return;
+ }
+ if (values == null && getSelectedField() != null) {
+ values = getSelectedField().getValues();
+ }
+ m_attribute = attribute;
+ //
+ int dataType = op.getType();
+ if (dataType == IDataModelAttribute.TYPE_INHERITED) {
+ dataType = attribute.getType();
+ }
+ Map<Integer, IComposerValueField> typeToFieldMap = m_opTypeToFieldMap.get(op.getOperator());
+ if (typeToFieldMap == null) {
+ //default
+ typeToFieldMap = m_opTypeToFieldMap.get(0);
+ }
+ IComposerValueField valueField = typeToFieldMap.get(dataType);
+ //clear old
+ if (m_selectedField != null) {
+ m_selectedField.removeValueChangeListenerFromTarget(m_valueChangedListener);
+ m_selectedField.clearSelectionContext();
+ }
+ //set new
+ m_selectedField = valueField;
+ if (m_selectedField != null) {
+ m_selectedField.addValueChangeListenerToTarget(m_valueChangedListener);
+ m_selectedField.setSelectionContext(m_attribute, dataType, op, values);
+ }
+ for (IFormField f : getFields()) {
+ if (f == m_selectedField) {
+ f.setVisible(true);
+ }
+ else {
+ f.setVisible(false);
+ }
+ }
+ }
+
+ public void clearSelectionContext() {
+ //clear old
+ if (m_selectedField != null) {
+ m_selectedField.clearSelectionContext();
+ }
+ //set new
+ m_selectedField = null;
+ for (IFormField f : getFields()) {
+ f.setVisible(false);
+ }
+ }
+
+ @Order(10)
+ @FormData(defaultSubtypeSdkCommand = DefaultSubtypeSdkCommand.IGNORE)
+ public class ListBoxField extends AbstractListBox<Object> implements IComposerValueField {
+
+ @Override
+ protected boolean getConfiguredAutoLoad() {
+ return false;
+ }
+
+ @Override
+ protected int getConfiguredGridH() {
+ return 4;
+ }
+
+ @Override
+ protected void execPrepareLookup(LookupCall call) throws ProcessingException {
+ if (m_attribute != null) {
+ // if isFilterActiveRows() is true, do not use a filter to load rows
+ // the list box is only populated one time and filtering for active/inactive is done afterwards
+ call.setActive(isFilterActiveRows() ? null : TriState.TRUE);
+ m_attribute.prepareLookup(call);
+ }
+ }
+
+ @Override
+ public void addValueChangeListenerToTarget(PropertyChangeListener listener) {
+ this.addPropertyChangeListener(listener);
+ }
+
+ @Override
+ public void removeValueChangeListenerFromTarget(PropertyChangeListener listener) {
+ this.removePropertyChangeListener(listener);
+ }
+
+ @Override
+ public void setSelectionContext(IDataModelAttribute attribute, int dataType, IDataModelAttributeOp op, Object[] values) {
+ setFilterActiveRows(attribute.isActiveFilterEnabled());
+ LookupCall newCall = attribute.getLookupCall();
+ if (getLookupCall() != newCall) {
+ setLookupCall(attribute.getLookupCall());
+ try {
+ loadListBoxData();
+ }
+ catch (Exception e) {
+ LOG.warn(null, e);
+ // nop
+ }
+ }
+ try {
+ if (values != null && values.length == 1 && values[0] instanceof Object[]) {
+ setValue((Object[]) values[0]);
+ }
+ else {
+ setValue(null);
+ }
+ }
+ catch (Exception e) {
+ // nop
+ setValue(null);
+ }
+ }
+
+ @Override
+ public void clearSelectionContext() {
+ setValue(null);
+ }
+
+ @Override
+ public Object[] getValues() {
+ if (getCheckedKeyCount() > 0) {
+ return new Object[]{getValue()};
+ }
+ else {
+ return null;
+ }
+ }
+
+ @Override
+ public String[] getTexts() {
+ return new String[]{getDisplayText()};
+ }
+ }
+
+ @Order(10)
+ @FormData(defaultSubtypeSdkCommand = DefaultSubtypeSdkCommand.IGNORE)
+ public class TreeBoxField extends AbstractTreeBox<Object> implements IComposerValueField {
+
+ @Override
+ protected boolean getConfiguredAutoLoad() {
+ return false;
+ }
+
+ @Override
+ protected int getConfiguredGridH() {
+ return 4;
+ }
+
+ @Override
+ protected void execPrepareLookup(LookupCall call, ITreeNode parent) throws ProcessingException {
+ if (m_attribute != null) {
+ // if isFilterActiveNodes() is true, do not use a filter to load nodes
+ // the tree box is only populated one time and filtering for active/inactive is done afterwards
+ call.setActive(isFilterActiveNodes() ? null : TriState.TRUE);
+ m_attribute.prepareLookup(call);
+ }
+ }
+
+ @Override
+ public void addValueChangeListenerToTarget(PropertyChangeListener listener) {
+ this.addPropertyChangeListener(listener);
+ }
+
+ @Override
+ public void removeValueChangeListenerFromTarget(PropertyChangeListener listener) {
+ this.removePropertyChangeListener(listener);
+ }
+
+ @Override
+ public void setSelectionContext(IDataModelAttribute attribute, int dataType, IDataModelAttributeOp op, Object[] values) {
+ setFilterActiveNodes(attribute.isActiveFilterEnabled());
+ LookupCall newCall = attribute.getLookupCall();
+ if (getLookupCall() != newCall) {
+ setLookupCall(newCall);
+ try {
+ loadRootNode();
+ getTree().setNodeExpanded(getTree().getRootNode(), true);
+ }
+ catch (Exception e) {
+ LOG.warn(null, e);
+ // nop
+ }
+ }
+ try {
+ if (values != null && values.length == 1 && values[0] instanceof Object[]) {
+ setValue((Object[]) values[0]);
+ }
+ else {
+ setValue(null);
+ }
+ }
+ catch (Exception e) {
+ // nop
+ setValue(null);
+ }
+ }
+
+ @Override
+ public void clearSelectionContext() {
+ setValue(null);
+ }
+
+ @Override
+ public Object[] getValues() {
+ if (getCheckedKeyCount() > 0) {
+ return new Object[]{getValue()};
+ }
+ else {
+ return null;
+ }
+ }
+
+ @Override
+ public String[] getTexts() {
+ return new String[]{getDisplayText()};
+ }
+ }
+
+ @Order(10)
+ @FormData(defaultSubtypeSdkCommand = DefaultSubtypeSdkCommand.IGNORE)
+ public class DateField extends AbstractDateField implements IComposerValueField {
+ @Override
+ public void addValueChangeListenerToTarget(PropertyChangeListener listener) {
+ this.addPropertyChangeListener(listener);
+ }
+
+ @Override
+ public void removeValueChangeListenerFromTarget(PropertyChangeListener listener) {
+ this.removePropertyChangeListener(listener);
+ }
+
+ @Override
+ public void setSelectionContext(IDataModelAttribute attribute, int dataType, IDataModelAttributeOp op, Object[] values) {
+ try {
+ if (values != null && values.length == 1 && values[0] instanceof Date) {
+ setValue((Date) values[0]);
+ }
+ else {
+ setValue(null);
+ }
+ }
+ catch (Exception e) {
+ // nop
+ setValue(null);
+ }
+ }
+
+ @Override
+ public void clearSelectionContext() {
+ setValue(null);
+ }
+
+ @Override
+ public Object[] getValues() {
+ if (getValue() != null) {
+ return new Object[]{getValue()};
+ }
+ else {
+ return null;
+ }
+ }
+
+ @Override
+ public String[] getTexts() {
+ return new String[]{getDisplayText()};
+ }
+ }
+
+ @Order(10)
+ @FormData(defaultSubtypeSdkCommand = DefaultSubtypeSdkCommand.IGNORE)
+ public class TimeField extends AbstractTimeField implements IComposerValueField {
+ @Override
+ public void addValueChangeListenerToTarget(PropertyChangeListener listener) {
+ this.addPropertyChangeListener(listener);
+ }
+
+ @Override
+ public void removeValueChangeListenerFromTarget(PropertyChangeListener listener) {
+ this.removePropertyChangeListener(listener);
+ }
+
+ @Override
+ public void setSelectionContext(IDataModelAttribute attribute, int dataType, IDataModelAttributeOp op, Object[] values) {
+ try {
+ if (values != null && values.length == 1) {
+ if (values[0] instanceof Double) {
+ setTimeValue((Double) values[0]);
+ }
+ else if (values[0] instanceof Date) {
+ setValue((Date) values[0]);
+ }
+ else {
+ setValue(null);
+ }
+ }
+ else {
+ setValue(null);
+ }
+ }
+ catch (Exception e) {
+ // nop
+ setValue(null);
+ }
+ }
+
+ @Override
+ public void clearSelectionContext() {
+ setValue(null);
+ }
+
+ @Override
+ public Object[] getValues() {
+ if (getValue() != null) {
+ return new Object[]{getValue()};
+ }
+ else {
+ return null;
+ }
+ }
+
+ @Override
+ public String[] getTexts() {
+ return new String[]{getDisplayText()};
+ }
+ }
+
+ @Order(10)
+ @FormData(defaultSubtypeSdkCommand = DefaultSubtypeSdkCommand.IGNORE)
+ public class DateTimeField extends AbstractDateField implements IComposerValueField {
+
+ @Override
+ protected boolean getConfiguredHasTime() {
+ return true;
+ }
+
+ @Override
+ public void addValueChangeListenerToTarget(PropertyChangeListener listener) {
+ this.addPropertyChangeListener(listener);
+ }
+
+ @Override
+ public void removeValueChangeListenerFromTarget(PropertyChangeListener listener) {
+ this.removePropertyChangeListener(listener);
+ }
+
+ @Override
+ public void setSelectionContext(IDataModelAttribute attribute, int dataType, IDataModelAttributeOp op, Object[] values) {
+ try {
+ if (values != null && values.length == 1 && values[0] instanceof Date) {
+ setValue((Date) values[0]);
+ }
+ else {
+ setValue(null);
+ }
+ }
+ catch (Exception e) {
+ // nop
+ setValue(null);
+ }
+ }
+
+ @Override
+ public void clearSelectionContext() {
+ setValue(null);
+ }
+
+ @Override
+ public Object[] getValues() {
+ if (getValue() != null) {
+ return new Object[]{getValue()};
+ }
+ else {
+ return null;
+ }
+ }
+
+ @Override
+ public String[] getTexts() {
+ return new String[]{getDisplayText()};
+ }
+ }
+
+ @Order(10)
+ @FormData(defaultSubtypeSdkCommand = DefaultSubtypeSdkCommand.IGNORE)
+ public class IntegerField extends AbstractIntegerField implements IComposerValueField {
+ @Override
+ public void addValueChangeListenerToTarget(PropertyChangeListener listener) {
+ this.addPropertyChangeListener(listener);
+ }
+
+ @Override
+ public void removeValueChangeListenerFromTarget(PropertyChangeListener listener) {
+ this.removePropertyChangeListener(listener);
+ }
+
+ @Override
+ public void setSelectionContext(IDataModelAttribute attribute, int dataType, IDataModelAttributeOp op, Object[] values) {
+ switch (dataType) {
+ case IDataModelAttribute.TYPE_INTEGER: {
+ setGroupingUsed(true);
+ break;
+ }
+ case IDataModelAttribute.TYPE_PLAIN_INTEGER: {
+ setGroupingUsed(false);
+ break;
+ }
+ }
+ try {
+ if (values != null && values.length == 1 && values[0] instanceof Integer) {
+ setValue((Integer) values[0]);
+ }
+ else {
+ setValue(null);
+ }
+ }
+ catch (Exception e) {
+ // nop
+ setValue(null);
+ }
+ }
+
+ @Override
+ public void clearSelectionContext() {
+ setValue(null);
+ }
+
+ @Override
+ public Object[] getValues() {
+ if (getValue() != null) {
+ return new Object[]{getValue()};
+ }
+ else {
+ return null;
+ }
+ }
+
+ @Override
+ public String[] getTexts() {
+ return new String[]{getDisplayText()};
+ }
+ }
+
+ @Order(10)
+ @FormData(defaultSubtypeSdkCommand = DefaultSubtypeSdkCommand.IGNORE)
+ public class LongField extends AbstractLongField implements IComposerValueField {
+ @Override
+ public void addValueChangeListenerToTarget(PropertyChangeListener listener) {
+ this.addPropertyChangeListener(listener);
+ }
+
+ @Override
+ public void removeValueChangeListenerFromTarget(PropertyChangeListener listener) {
+ this.removePropertyChangeListener(listener);
+ }
+
+ @Override
+ public void setSelectionContext(IDataModelAttribute attribute, int dataType, IDataModelAttributeOp op, Object[] values) {
+ switch (dataType) {
+ case IDataModelAttribute.TYPE_LONG: {
+ setGroupingUsed(true);
+ break;
+ }
+ case IDataModelAttribute.TYPE_PLAIN_LONG: {
+ setGroupingUsed(false);
+ break;
+ }
+ }
+ try {
+ if (values != null && values.length == 1 && values[0] instanceof Long) {
+ setValue((Long) values[0]);
+ }
+ else {
+ setValue(null);
+ }
+ }
+ catch (Exception e) {
+ // nop
+ setValue(null);
+ }
+ }
+
+ @Override
+ public void clearSelectionContext() {
+ setValue(null);
+ }
+
+ @Override
+ public Object[] getValues() {
+ if (getValue() != null) {
+ return new Object[]{getValue()};
+ }
+ else {
+ return null;
+ }
+ }
+
+ @Override
+ public String[] getTexts() {
+ return new String[]{getDisplayText()};
+ }
+ }
+
+ @Order(10)
+ @FormData(defaultSubtypeSdkCommand = DefaultSubtypeSdkCommand.IGNORE)
+ public class DoubleField extends AbstractDoubleField implements IComposerValueField {
+ @Override
+ public void addValueChangeListenerToTarget(PropertyChangeListener listener) {
+ this.addPropertyChangeListener(listener);
+ }
+
+ @Override
+ public void removeValueChangeListenerFromTarget(PropertyChangeListener listener) {
+ this.removePropertyChangeListener(listener);
+ }
+
+ @Override
+ public void setSelectionContext(IDataModelAttribute attribute, int dataType, IDataModelAttributeOp op, Object[] values) {
+ switch (dataType) {
+ case IDataModelAttribute.TYPE_DOUBLE: {
+ setGroupingUsed(true);
+ setPercent(false);
+ break;
+ }
+ case IDataModelAttribute.TYPE_PERCENT: {
+ setGroupingUsed(true);
+ setPercent(true);
+ break;
+ }
+ case IDataModelAttribute.TYPE_PLAIN_DOUBLE: {
+ setGroupingUsed(false);
+ setPercent(false);
+ break;
+ }
+ }
+ try {
+ if (values != null && values.length == 1 && values[0] instanceof Double) {
+ setValue((Double) values[0]);
+ }
+ else {
+ setValue(null);
+ }
+ }
+ catch (Exception e) {
+ // nop
+ setValue(null);
+ }
+ }
+
+ @Override
+ public void clearSelectionContext() {
+ setValue(null);
+ }
+
+ @Override
+ public Object[] getValues() {
+ if (getValue() != null) {
+ return new Object[]{getValue()};
+ }
+ else {
+ return null;
+ }
+ }
+
+ @Override
+ public String[] getTexts() {
+ return new String[]{getDisplayText()};
+ }
+ }
+
+ @Order(10)
+ @FormData(defaultSubtypeSdkCommand = DefaultSubtypeSdkCommand.IGNORE)
+ public class StringField extends AbstractStringField implements IComposerValueField {
+ @Override
+ public void addValueChangeListenerToTarget(PropertyChangeListener listener) {
+ this.addPropertyChangeListener(listener);
+ }
+
+ @Override
+ public void removeValueChangeListenerFromTarget(PropertyChangeListener listener) {
+ this.removePropertyChangeListener(listener);
+ }
+
+ @Override
+ public void setSelectionContext(IDataModelAttribute attribute, int dataType, IDataModelAttributeOp op, Object[] values) {
+ try {
+ if (values != null && values.length == 1 && values[0] instanceof String) {
+ setValue((String) values[0]);
+ }
+ else {
+ setValue(null);
+ }
+ }
+ catch (Exception e) {
+ // nop
+ setValue(null);
+ }
+ }
+
+ @Override
+ public void clearSelectionContext() {
+ setValue(null);
+ }
+
+ @Override
+ public Object[] getValues() {
+ if (getValue() != null) {
+ return new Object[]{getValue()};
+ }
+ else {
+ return null;
+ }
+ }
+
+ @Override
+ public String[] getTexts() {
+ return new String[]{getDisplayText()};
+ }
+ }
+
+ @Order(10)
+ @FormData(defaultSubtypeSdkCommand = DefaultSubtypeSdkCommand.IGNORE)
+ public class SmartField extends AbstractSmartField<Object> implements IComposerValueField {
+
+ @Override
+ protected String getConfiguredBrowseIconId() {
+ return AbstractIcons.Empty;
+ }
+
+ @Override
+ protected void execPrepareLookup(LookupCall call) throws ProcessingException {
+ if (m_attribute != null) {
+ call.setActive(isActiveFilterEnabled() ? getActiveFilter() : TriState.TRUE);
+ m_attribute.prepareLookup(call);
+ }
+ }
+
+ @Override
+ public void addValueChangeListenerToTarget(PropertyChangeListener listener) {
+ this.addPropertyChangeListener(listener);
+ }
+
+ @Override
+ public void removeValueChangeListenerFromTarget(PropertyChangeListener listener) {
+ this.removePropertyChangeListener(listener);
+ }
+
+ @Override
+ public void setSelectionContext(IDataModelAttribute attribute, int dataType, IDataModelAttributeOp op, Object[] values) {
+ setActiveFilterEnabled(attribute.isActiveFilterEnabled());
+ LookupCall newCall = attribute.getLookupCall();
+ if (getLookupCall() != newCall) {
+ setLookupCall(newCall);
+ }
+ try {
+ if (values != null && values.length == 1) {
+ setValue(values[0]);
+ }
+ else {
+ setValue(null);
+ }
+ }
+ catch (Exception e) {
+ // nop
+ setValue(null);
+ }
+ }
+
+ @Override
+ public void clearSelectionContext() {
+ setValue(null);
+ }
+
+ @Override
+ public Object[] getValues() {
+ if (getValue() != null) {
+ return new Object[]{getValue()};
+ }
+ else {
+ return null;
+ }
+ }
+
+ @Override
+ public String[] getTexts() {
+ return new String[]{getDisplayText()};
+ }
+ }
+
+ //XXXXXXXXXXXXXXXXXXXXXXX
+
+ @Order(10)
+ @FormData(defaultSubtypeSdkCommand = DefaultSubtypeSdkCommand.IGNORE)
+ public class BetweenDateField extends AbstractSequenceBox implements IComposerValueField {
+ @Order(10)
+ public class DateFromField extends AbstractDateField {
+ }
+
+ @Order(20)
+ public class DateToField extends AbstractDateField {
+ }
+
+ @Override
+ public void addValueChangeListenerToTarget(PropertyChangeListener listener) {
+ for (IFormField f : getFields()) {
+ f.addPropertyChangeListener(listener);
+ }
+ }
+
+ @Override
+ public void removeValueChangeListenerFromTarget(PropertyChangeListener listener) {
+ for (IFormField f : getFields()) {
+ f.removePropertyChangeListener(listener);
+ }
+ }
+
+ @Override
+ public void setSelectionContext(IDataModelAttribute attribute, int dataType, IDataModelAttributeOp op, Object[] values) {
+ try {
+ getFieldByClass(BetweenDateField.DateFromField.class).setValue(null);
+ getFieldByClass(BetweenDateField.DateToField.class).setValue(null);
+ if (values != null && values.length == 2) {
+ if (values[0] instanceof Date) {
+ getFieldByClass(BetweenDateField.DateFromField.class).setValue((Date) values[0]);
+ }
+ if (values[1] instanceof Date) {
+ getFieldByClass(BetweenDateField.DateToField.class).setValue((Date) values[1]);
+ }
+ }
+ }
+ catch (Exception e) {
+ // nop
+ }
+ }
+
+ @Override
+ public void clearSelectionContext() {
+ getFieldByClass(BetweenDateField.DateFromField.class).setValue(null);
+ getFieldByClass(BetweenDateField.DateToField.class).setValue(null);
+ }
+
+ @Override
+ public Object[] getValues() {
+ Object a = getFieldByClass(BetweenDateField.DateFromField.class).getValue();
+ Object b = getFieldByClass(BetweenDateField.DateToField.class).getValue();
+ if (a != null || b != null) {
+ return new Object[]{a, b};
+ }
+ else {
+ return null;
+ }
+ }
+
+ @Override
+ public String[] getTexts() {
+ String a = getFieldByClass(BetweenDateField.DateFromField.class).getDisplayText();
+ String b = getFieldByClass(BetweenDateField.DateToField.class).getDisplayText();
+ return new String[]{a, b};
+ }
+ }
+
+ @Order(10)
+ @FormData(defaultSubtypeSdkCommand = DefaultSubtypeSdkCommand.IGNORE)
+ public class BetweenTimeField extends AbstractSequenceBox implements IComposerValueField {
+ @Order(10)
+ public class TimeFromField extends AbstractTimeField {
+ }
+
+ @Order(20)
+ public class TimeToField extends AbstractTimeField {
+ }
+
+ @Override
+ public void addValueChangeListenerToTarget(PropertyChangeListener listener) {
+ for (IFormField f : getFields()) {
+ f.addPropertyChangeListener(listener);
+ }
+ }
+
+ @Override
+ public void removeValueChangeListenerFromTarget(PropertyChangeListener listener) {
+ for (IFormField f : getFields()) {
+ f.removePropertyChangeListener(listener);
+ }
+ }
+
+ @Override
+ public void setSelectionContext(IDataModelAttribute attribute, int dataType, IDataModelAttributeOp op, Object[] values) {
+ try {
+ getFieldByClass(BetweenTimeField.TimeFromField.class).setValue(null);
+ getFieldByClass(BetweenTimeField.TimeToField.class).setValue(null);
+ if (values != null && values.length == 2) {
+ if (values[0] instanceof Double) {
+ getFieldByClass(BetweenTimeField.TimeFromField.class).setTimeValue((Double) values[0]);
+ }
+ else if (values[0] instanceof Date) {
+ getFieldByClass(BetweenTimeField.TimeFromField.class).setValue((Date) values[0]);
+ }
+ if (values[1] instanceof Double) {
+ getFieldByClass(BetweenTimeField.TimeToField.class).setTimeValue((Double) values[1]);
+ }
+ else if (values[1] instanceof Date) {
+ getFieldByClass(BetweenTimeField.TimeToField.class).setValue((Date) values[1]);
+ }
+ }
+ }
+ catch (Exception e) {
+ // nop
+ }
+ }
+
+ @Override
+ public void clearSelectionContext() {
+ getFieldByClass(BetweenTimeField.TimeFromField.class).setValue(null);
+ getFieldByClass(BetweenTimeField.TimeToField.class).setValue(null);
+ }
+
+ @Override
+ public Object[] getValues() {
+ Object a = getFieldByClass(BetweenTimeField.TimeFromField.class).getValue();
+ Object b = getFieldByClass(BetweenTimeField.TimeToField.class).getValue();
+ if (a != null || b != null) {
+ return new Object[]{a, b};
+ }
+ else {
+ return null;
+ }
+ }
+
+ @Override
+ public String[] getTexts() {
+ String a = getFieldByClass(BetweenTimeField.TimeFromField.class).getDisplayText();
+ String b = getFieldByClass(BetweenTimeField.TimeToField.class).getDisplayText();
+ return new String[]{a, b};
+ }
+ }
+
+ @Order(10)
+ @FormData(defaultSubtypeSdkCommand = DefaultSubtypeSdkCommand.IGNORE)
+ public class BetweenDateTimeField extends AbstractSequenceBox implements IComposerValueField {
+ @Order(10)
+ public class DateTimeFromField extends AbstractDateField {
+ @Override
+ protected boolean getConfiguredHasTime() {
+ return true;
+ }
+ }
+
+ @Order(20)
+ public class DateTimeToField extends AbstractDateField {
+ @Override
+ protected boolean getConfiguredHasTime() {
+ return true;
+ }
+ }
+
+ @Override
+ public void addValueChangeListenerToTarget(PropertyChangeListener listener) {
+ for (IFormField f : getFields()) {
+ f.addPropertyChangeListener(listener);
+ }
+ }
+
+ @Override
+ public void removeValueChangeListenerFromTarget(PropertyChangeListener listener) {
+ for (IFormField f : getFields()) {
+ f.removePropertyChangeListener(listener);
+ }
+ }
+
+ @Override
+ public void setSelectionContext(IDataModelAttribute attribute, int dataType, IDataModelAttributeOp op, Object[] values) {
+ try {
+ getFieldByClass(BetweenDateTimeField.DateTimeFromField.class).setValue(null);
+ getFieldByClass(BetweenDateTimeField.DateTimeToField.class).setValue(null);
+ if (values != null && values.length == 2) {
+ if (values[0] instanceof Date) {
+ getFieldByClass(BetweenDateTimeField.DateTimeFromField.class).setValue((Date) values[0]);
+ }
+ if (values[1] instanceof Date) {
+ getFieldByClass(BetweenDateTimeField.DateTimeToField.class).setValue((Date) values[1]);
+ }
+ }
+ }
+ catch (Exception e) {
+ // nop
+ }
+ }
+
+ @Override
+ public void clearSelectionContext() {
+ getFieldByClass(BetweenDateTimeField.DateTimeFromField.class).setValue(null);
+ getFieldByClass(BetweenDateTimeField.DateTimeToField.class).setValue(null);
+ }
+
+ @Override
+ public Object[] getValues() {
+ Object a = getFieldByClass(BetweenDateTimeField.DateTimeFromField.class).getValue();
+ Object b = getFieldByClass(BetweenDateTimeField.DateTimeToField.class).getValue();
+ if (a != null || b != null) {
+ return new Object[]{a, b};
+ }
+ else {
+ return null;
+ }
+ }
+
+ @Override
+ public String[] getTexts() {
+ String a = getFieldByClass(BetweenDateTimeField.DateTimeFromField.class).getDisplayText();
+ String b = getFieldByClass(BetweenDateTimeField.DateTimeToField.class).getDisplayText();
+ return new String[]{a, b};
+ }
+ }
+
+ @Order(10)
+ @FormData(defaultSubtypeSdkCommand = DefaultSubtypeSdkCommand.IGNORE)
+ public class BetweenIntegerField extends AbstractSequenceBox implements IComposerValueField {
+ @Order(10)
+ public class IntegerFromField extends AbstractIntegerField {
+ }
+
+ @Order(20)
+ public class IntegerToField extends AbstractIntegerField {
+ }
+
+ @Override
+ public void addValueChangeListenerToTarget(PropertyChangeListener listener) {
+ for (IFormField f : getFields()) {
+ f.addPropertyChangeListener(listener);
+ }
+ }
+
+ @Override
+ public void removeValueChangeListenerFromTarget(PropertyChangeListener listener) {
+ for (IFormField f : getFields()) {
+ f.removePropertyChangeListener(listener);
+ }
+ }
+
+ @Override
+ public void setSelectionContext(IDataModelAttribute attribute, int dataType, IDataModelAttributeOp op, Object[] values) {
+ try {
+ getFieldByClass(BetweenIntegerField.IntegerFromField.class).setValue(null);
+ getFieldByClass(BetweenIntegerField.IntegerToField.class).setValue(null);
+ if (values != null && values.length == 2) {
+ if (values[0] instanceof Integer) {
+ getFieldByClass(BetweenIntegerField.IntegerFromField.class).setValue((Integer) values[0]);
+ }
+ if (values[1] instanceof Integer) {
+ getFieldByClass(BetweenIntegerField.IntegerToField.class).setValue((Integer) values[1]);
+ }
+ }
+ }
+ catch (Exception e) {
+ // nop
+ }
+ }
+
+ @Override
+ public void clearSelectionContext() {
+ getFieldByClass(BetweenIntegerField.IntegerFromField.class).setValue(null);
+ getFieldByClass(BetweenIntegerField.IntegerToField.class).setValue(null);
+ }
+
+ @Override
+ public Object[] getValues() {
+ Object a = getFieldByClass(BetweenIntegerField.IntegerFromField.class).getValue();
+ Object b = getFieldByClass(BetweenIntegerField.IntegerToField.class).getValue();
+ if (a != null || b != null) {
+ return new Object[]{a, b};
+ }
+ else {
+ return null;
+ }
+ }
+
+ @Override
+ public String[] getTexts() {
+ String a = getFieldByClass(BetweenIntegerField.IntegerFromField.class).getDisplayText();
+ String b = getFieldByClass(BetweenIntegerField.IntegerToField.class).getDisplayText();
+ return new String[]{a, b};
+ }
+ }
+
+ @Order(10)
+ @FormData(defaultSubtypeSdkCommand = DefaultSubtypeSdkCommand.IGNORE)
+ public class BetweenLongField extends AbstractSequenceBox implements IComposerValueField {
+ @Order(10)
+ public class LongFromField extends AbstractLongField {
+ }
+
+ @Order(20)
+ public class LongToField extends AbstractLongField {
+ }
+
+ @Override
+ public void addValueChangeListenerToTarget(PropertyChangeListener listener) {
+ for (IFormField f : getFields()) {
+ f.addPropertyChangeListener(listener);
+ }
+ }
+
+ @Override
+ public void removeValueChangeListenerFromTarget(PropertyChangeListener listener) {
+ for (IFormField f : getFields()) {
+ f.removePropertyChangeListener(listener);
+ }
+ }
+
+ @Override
+ public void setSelectionContext(IDataModelAttribute attribute, int dataType, IDataModelAttributeOp op, Object[] values) {
+ try {
+ getFieldByClass(BetweenLongField.LongFromField.class).setValue(null);
+ getFieldByClass(BetweenLongField.LongToField.class).setValue(null);
+ if (values != null && values.length == 2) {
+ if (values[0] instanceof Long) {
+ getFieldByClass(BetweenLongField.LongFromField.class).setValue((Long) values[0]);
+ }
+ if (values[1] instanceof Long) {
+ getFieldByClass(BetweenLongField.LongToField.class).setValue((Long) values[1]);
+ }
+ }
+ }
+ catch (Exception e) {
+ // nop
+ }
+ }
+
+ @Override
+ public void clearSelectionContext() {
+ getFieldByClass(BetweenLongField.LongFromField.class).setValue(null);
+ getFieldByClass(BetweenLongField.LongToField.class).setValue(null);
+ }
+
+ @Override
+ public Object[] getValues() {
+ Object a = getFieldByClass(BetweenLongField.LongFromField.class).getValue();
+ Object b = getFieldByClass(BetweenLongField.LongToField.class).getValue();
+ if (a != null || b != null) {
+ return new Object[]{a, b};
+ }
+ else {
+ return null;
+ }
+ }
+
+ @Override
+ public String[] getTexts() {
+ String a = getFieldByClass(BetweenLongField.LongFromField.class).getDisplayText();
+ String b = getFieldByClass(BetweenLongField.LongToField.class).getDisplayText();
+ return new String[]{a, b};
+ }
+ }
+
+ @Order(10)
+ @FormData(defaultSubtypeSdkCommand = DefaultSubtypeSdkCommand.IGNORE)
+ public class BetweenDoubleField extends AbstractSequenceBox implements IComposerValueField {
+ @Order(10)
+ public class DoubleFromField extends AbstractDoubleField {
+ }
+
+ @Order(20)
+ public class DoubleToField extends AbstractDoubleField {
+ }
+
+ @Override
+ public void addValueChangeListenerToTarget(PropertyChangeListener listener) {
+ for (IFormField f : getFields()) {
+ f.addPropertyChangeListener(listener);
+ }
+ }
+
+ @Override
+ public void removeValueChangeListenerFromTarget(PropertyChangeListener listener) {
+ for (IFormField f : getFields()) {
+ f.removePropertyChangeListener(listener);
+ }
+ }
+
+ @Override
+ public void setSelectionContext(IDataModelAttribute attribute, int dataType, IDataModelAttributeOp op, Object[] values) {
+ try {
+ getFieldByClass(BetweenDoubleField.DoubleFromField.class).setValue(null);
+ getFieldByClass(BetweenDoubleField.DoubleToField.class).setValue(null);
+ if (values != null && values.length == 2) {
+ if (values[0] instanceof Double) {
+ getFieldByClass(BetweenDoubleField.DoubleFromField.class).setValue((Double) values[0]);
+ }
+ if (values[1] instanceof Double) {
+ getFieldByClass(BetweenDoubleField.DoubleToField.class).setValue((Double) values[1]);
+ }
+ }
+ }
+ catch (Exception e) {
+ // nop
+ }
+ }
+
+ @Override
+ public void clearSelectionContext() {
+ getFieldByClass(BetweenDoubleField.DoubleFromField.class).setValue(null);
+ getFieldByClass(BetweenDoubleField.DoubleToField.class).setValue(null);
+ }
+
+ @Override
+ public Object[] getValues() {
+ Object a = getFieldByClass(BetweenDoubleField.DoubleFromField.class).getValue();
+ Object b = getFieldByClass(BetweenDoubleField.DoubleToField.class).getValue();
+ if (a != null || b != null) {
+ return new Object[]{a, b};
+ }
+ else {
+ return null;
+ }
+ }
+
+ @Override
+ public String[] getTexts() {
+ String a = getFieldByClass(BetweenDoubleField.DoubleFromField.class).getDisplayText();
+ String b = getFieldByClass(BetweenDoubleField.DoubleToField.class).getDisplayText();
+ return new String[]{a, b};
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/AbstractDataModelAggregationField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/AbstractDataModelAggregationField.java
index 19a920fa98..5ed17bd61d 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/AbstractDataModelAggregationField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/AbstractDataModelAggregationField.java
@@ -1,114 +1,114 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.composer;
-
-import java.util.HashSet;
-
-import org.eclipse.scout.commons.annotations.ConfigOperation;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.form.fields.smartfield.AbstractSmartField;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.data.model.DataModelConstants;
-import org.eclipse.scout.rt.shared.data.model.IDataModelAttribute;
-import org.eclipse.scout.rt.shared.services.common.jdbc.SearchFilter;
-import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
-import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
-
-/**
- * Convenience field template to present {@link IDataModelAttribute#getAggregationTypes()}
- * <p>
- * Uses the lookup call {@link DataModelAggregationLookupCall}
- * <p>
- * Expects the property {@link #setAttribute(IDataModelAttribute)} to be set.
- */
-public abstract class AbstractDataModelAggregationField extends AbstractSmartField<Integer> {
-
- public AbstractDataModelAggregationField() {
- this(true);
- }
-
- public AbstractDataModelAggregationField(boolean callInitializer) {
- super(callInitializer);
- }
-
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("ComposerFieldAggregationLabel");
- }
-
- @Override
- protected Class<? extends LookupCall> getConfiguredLookupCall() {
- return DataModelAggregationLookupCall.class;
- }
-
- @Override
- protected boolean getConfiguredTreat0AsNull() {
- return false;
- }
-
- @Override
- protected void execAddSearchTerms(SearchFilter search) {
- //nop
- }
-
- public IDataModelAttribute getAttribute() {
- return ((DataModelAggregationLookupCall) getLookupCall()).getAttribute();
- }
-
- public void setAttribute(IDataModelAttribute attribute) throws ProcessingException {
- ((DataModelAggregationLookupCall) getLookupCall()).setAttribute(attribute);
- if (attribute != null) {
- setEnabled(true);
- }
- else {
- setEnabled(false);
- }
- execAttributeChanged(attribute);
- refreshDisplayText();
- }
-
- /**
- * Whenever the reference attribute changes, this method is called to customize the texts, values and new value of
- * this smart field.
- * <p>
- * This method is called after the lookap call was updated with the new attribute but before the value of this
- * smartfield is adapted.
- * <p>
- * The default sets the value to {@link DataModelConstants#AGGREGATION_NONE} if valid, else to
- * {@link DataModelConstants#AGGREGATION_COUNT} if valid and else to the first valid aggregation available or null.
- *
- * @param attribute
- * the new attribute
- */
- @ConfigOperation
- @Order(100)
- protected void execAttributeChanged(IDataModelAttribute attribute) throws ProcessingException {
- Integer newAg = null;
- if (attribute != null) {
- HashSet<Integer> agSet = new HashSet<Integer>();
- for (LookupRow row : ((DataModelAggregationLookupCall) getLookupCall()).getLookupRows()) {
- agSet.add((Integer) row.getKey());
- }
- if (agSet.contains(DataModelConstants.AGGREGATION_NONE)) {
- newAg = DataModelConstants.AGGREGATION_NONE;
- }
- else if (agSet.contains(DataModelConstants.AGGREGATION_COUNT)) {
- newAg = DataModelConstants.AGGREGATION_COUNT;
- }
- else if (agSet.size() > 0) {
- newAg = agSet.iterator().next();
- }
- }
- setValue(newAg);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.composer;
+
+import java.util.HashSet;
+
+import org.eclipse.scout.commons.annotations.ConfigOperation;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.form.fields.smartfield.AbstractSmartField;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.data.model.DataModelConstants;
+import org.eclipse.scout.rt.shared.data.model.IDataModelAttribute;
+import org.eclipse.scout.rt.shared.services.common.jdbc.SearchFilter;
+import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
+import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
+
+/**
+ * Convenience field template to present {@link IDataModelAttribute#getAggregationTypes()}
+ * <p>
+ * Uses the lookup call {@link DataModelAggregationLookupCall}
+ * <p>
+ * Expects the property {@link #setAttribute(IDataModelAttribute)} to be set.
+ */
+public abstract class AbstractDataModelAggregationField extends AbstractSmartField<Integer> {
+
+ public AbstractDataModelAggregationField() {
+ this(true);
+ }
+
+ public AbstractDataModelAggregationField(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("ComposerFieldAggregationLabel");
+ }
+
+ @Override
+ protected Class<? extends LookupCall> getConfiguredLookupCall() {
+ return DataModelAggregationLookupCall.class;
+ }
+
+ @Override
+ protected boolean getConfiguredTreat0AsNull() {
+ return false;
+ }
+
+ @Override
+ protected void execAddSearchTerms(SearchFilter search) {
+ //nop
+ }
+
+ public IDataModelAttribute getAttribute() {
+ return ((DataModelAggregationLookupCall) getLookupCall()).getAttribute();
+ }
+
+ public void setAttribute(IDataModelAttribute attribute) throws ProcessingException {
+ ((DataModelAggregationLookupCall) getLookupCall()).setAttribute(attribute);
+ if (attribute != null) {
+ setEnabled(true);
+ }
+ else {
+ setEnabled(false);
+ }
+ execAttributeChanged(attribute);
+ refreshDisplayText();
+ }
+
+ /**
+ * Whenever the reference attribute changes, this method is called to customize the texts, values and new value of
+ * this smart field.
+ * <p>
+ * This method is called after the lookap call was updated with the new attribute but before the value of this
+ * smartfield is adapted.
+ * <p>
+ * The default sets the value to {@link DataModelConstants#AGGREGATION_NONE} if valid, else to
+ * {@link DataModelConstants#AGGREGATION_COUNT} if valid and else to the first valid aggregation available or null.
+ *
+ * @param attribute
+ * the new attribute
+ */
+ @ConfigOperation
+ @Order(100)
+ protected void execAttributeChanged(IDataModelAttribute attribute) throws ProcessingException {
+ Integer newAg = null;
+ if (attribute != null) {
+ HashSet<Integer> agSet = new HashSet<Integer>();
+ for (LookupRow row : ((DataModelAggregationLookupCall) getLookupCall()).getLookupRows()) {
+ agSet.add((Integer) row.getKey());
+ }
+ if (agSet.contains(DataModelConstants.AGGREGATION_NONE)) {
+ newAg = DataModelConstants.AGGREGATION_NONE;
+ }
+ else if (agSet.contains(DataModelConstants.AGGREGATION_COUNT)) {
+ newAg = DataModelConstants.AGGREGATION_COUNT;
+ }
+ else if (agSet.size() > 0) {
+ newAg = agSet.iterator().next();
+ }
+ }
+ setValue(newAg);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/AbstractDataModelOperatorField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/AbstractDataModelOperatorField.java
index a026051c33..a15d8c5185 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/AbstractDataModelOperatorField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/AbstractDataModelOperatorField.java
@@ -1,81 +1,81 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.composer;
-
-import java.util.Arrays;
-import java.util.HashSet;
-
-import org.eclipse.scout.rt.client.ui.form.fields.smartfield.AbstractSmartField;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.data.model.IDataModelAttribute;
-import org.eclipse.scout.rt.shared.data.model.IDataModelAttributeOp;
-import org.eclipse.scout.rt.shared.services.common.jdbc.SearchFilter;
-import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
-
-/**
- * Convenience field template to present {@link IDataModelAttribute#getOperators()}
- * <p>
- * Uses the lookup call {@link DataModelOperatorLookupCall}
- * <p>
- * Expects the property {@link #setAttribute(IDataModelAttribute)} to be set.
- */
-public abstract class AbstractDataModelOperatorField extends AbstractSmartField<IDataModelAttributeOp> {
-
- public AbstractDataModelOperatorField() {
- this(true);
- }
-
- public AbstractDataModelOperatorField(boolean callInitializer) {
- super(callInitializer);
- }
-
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("Op");
- }
-
- @Override
- protected Class<? extends LookupCall> getConfiguredLookupCall() {
- return DataModelOperatorLookupCall.class;
- }
-
- @Override
- protected void execAddSearchTerms(SearchFilter search) {
- //nop
- }
-
- public void setAttribute(IDataModelAttribute attribute) {
- IDataModelAttributeOp oldOp = getValue();
- ((DataModelOperatorLookupCall) getLookupCall()).setAttribute(attribute);
- IDataModelAttributeOp newOp = null;
- if (attribute != null) {
- setView(true, true, false);
- HashSet<IDataModelAttributeOp> tmp = new HashSet<IDataModelAttributeOp>();
- IDataModelAttributeOp[] ops = attribute.getOperators();
- tmp.addAll(Arrays.asList(ops));
- if (tmp.contains(oldOp)) {
- newOp = oldOp;
- }
- else if (ops.length > 0) {
- newOp = ops[0];
- }
- }
- else {
- setView(false, false, false);
- }
- setValue(newOp);
- }
-
- public IDataModelAttribute getAttribute() {
- return ((DataModelOperatorLookupCall) getLookupCall()).getAttribute();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.composer;
+
+import java.util.Arrays;
+import java.util.HashSet;
+
+import org.eclipse.scout.rt.client.ui.form.fields.smartfield.AbstractSmartField;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.data.model.IDataModelAttribute;
+import org.eclipse.scout.rt.shared.data.model.IDataModelAttributeOp;
+import org.eclipse.scout.rt.shared.services.common.jdbc.SearchFilter;
+import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
+
+/**
+ * Convenience field template to present {@link IDataModelAttribute#getOperators()}
+ * <p>
+ * Uses the lookup call {@link DataModelOperatorLookupCall}
+ * <p>
+ * Expects the property {@link #setAttribute(IDataModelAttribute)} to be set.
+ */
+public abstract class AbstractDataModelOperatorField extends AbstractSmartField<IDataModelAttributeOp> {
+
+ public AbstractDataModelOperatorField() {
+ this(true);
+ }
+
+ public AbstractDataModelOperatorField(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("Op");
+ }
+
+ @Override
+ protected Class<? extends LookupCall> getConfiguredLookupCall() {
+ return DataModelOperatorLookupCall.class;
+ }
+
+ @Override
+ protected void execAddSearchTerms(SearchFilter search) {
+ //nop
+ }
+
+ public void setAttribute(IDataModelAttribute attribute) {
+ IDataModelAttributeOp oldOp = getValue();
+ ((DataModelOperatorLookupCall) getLookupCall()).setAttribute(attribute);
+ IDataModelAttributeOp newOp = null;
+ if (attribute != null) {
+ setView(true, true, false);
+ HashSet<IDataModelAttributeOp> tmp = new HashSet<IDataModelAttributeOp>();
+ IDataModelAttributeOp[] ops = attribute.getOperators();
+ tmp.addAll(Arrays.asList(ops));
+ if (tmp.contains(oldOp)) {
+ newOp = oldOp;
+ }
+ else if (ops.length > 0) {
+ newOp = ops[0];
+ }
+ }
+ else {
+ setView(false, false, false);
+ }
+ setValue(newOp);
+ }
+
+ public IDataModelAttribute getAttribute() {
+ return ((DataModelOperatorLookupCall) getLookupCall()).getAttribute();
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/ComposerFieldDataModel.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/ComposerFieldDataModel.java
index 12ffe23b3c..8245cd813a 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/ComposerFieldDataModel.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/ComposerFieldDataModel.java
@@ -1,69 +1,69 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.composer;
-
-import java.util.ArrayList;
-
-import org.eclipse.scout.commons.ConfigurationUtility;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.shared.data.model.AbstractDataModel;
-import org.eclipse.scout.rt.shared.data.model.IDataModelAttribute;
-import org.eclipse.scout.rt.shared.data.model.IDataModelEntity;
-
-/**
- * create a data model based on inner classes of the composer field
- */
-public class ComposerFieldDataModel extends AbstractDataModel {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(ComposerFieldDataModel.class);
- private static final long serialVersionUID = 1L;
-
- private final IComposerField m_field;
-
- public ComposerFieldDataModel(IComposerField field) {
- super(false);
- m_field = field;
- callInitializer();
- }
-
- @Override
- protected IDataModelAttribute[] createAttributes() {
- ArrayList<IDataModelAttribute> attributes = new ArrayList<IDataModelAttribute>();
- Class<?>[] all = ConfigurationUtility.getDeclaredPublicClasses(m_field.getClass());
- for (Class<? extends IDataModelAttribute> c : ConfigurationUtility.sortFilteredClassesByOrderAnnotation(all, IDataModelAttribute.class)) {
- try {
- IDataModelAttribute a = ConfigurationUtility.newInnerInstance(m_field, c);
- attributes.add(a);
- }
- catch (Exception e) {
- LOG.warn(null, e);
- }
- }
- return attributes.toArray(new IDataModelAttribute[attributes.size()]);
- }
-
- @Override
- protected IDataModelEntity[] createEntities() {
- ArrayList<IDataModelEntity> entities = new ArrayList<IDataModelEntity>();
- Class<?>[] all = ConfigurationUtility.getDeclaredPublicClasses(m_field.getClass());
- for (Class<? extends IDataModelEntity> c : ConfigurationUtility.sortFilteredClassesByOrderAnnotation(all, IDataModelEntity.class)) {
- try {
- IDataModelEntity e = ConfigurationUtility.newInnerInstance(m_field, c);
- entities.add(e);
- }
- catch (Exception e) {
- LOG.warn(null, e);
- }
- }
- return entities.toArray(new IDataModelEntity[entities.size()]);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.composer;
+
+import java.util.ArrayList;
+
+import org.eclipse.scout.commons.ConfigurationUtility;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.shared.data.model.AbstractDataModel;
+import org.eclipse.scout.rt.shared.data.model.IDataModelAttribute;
+import org.eclipse.scout.rt.shared.data.model.IDataModelEntity;
+
+/**
+ * create a data model based on inner classes of the composer field
+ */
+public class ComposerFieldDataModel extends AbstractDataModel {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(ComposerFieldDataModel.class);
+ private static final long serialVersionUID = 1L;
+
+ private final IComposerField m_field;
+
+ public ComposerFieldDataModel(IComposerField field) {
+ super(false);
+ m_field = field;
+ callInitializer();
+ }
+
+ @Override
+ protected IDataModelAttribute[] createAttributes() {
+ ArrayList<IDataModelAttribute> attributes = new ArrayList<IDataModelAttribute>();
+ Class<?>[] all = ConfigurationUtility.getDeclaredPublicClasses(m_field.getClass());
+ for (Class<? extends IDataModelAttribute> c : ConfigurationUtility.sortFilteredClassesByOrderAnnotation(all, IDataModelAttribute.class)) {
+ try {
+ IDataModelAttribute a = ConfigurationUtility.newInnerInstance(m_field, c);
+ attributes.add(a);
+ }
+ catch (Exception e) {
+ LOG.warn(null, e);
+ }
+ }
+ return attributes.toArray(new IDataModelAttribute[attributes.size()]);
+ }
+
+ @Override
+ protected IDataModelEntity[] createEntities() {
+ ArrayList<IDataModelEntity> entities = new ArrayList<IDataModelEntity>();
+ Class<?>[] all = ConfigurationUtility.getDeclaredPublicClasses(m_field.getClass());
+ for (Class<? extends IDataModelEntity> c : ConfigurationUtility.sortFilteredClassesByOrderAnnotation(all, IDataModelEntity.class)) {
+ try {
+ IDataModelEntity e = ConfigurationUtility.newInnerInstance(m_field, c);
+ entities.add(e);
+ }
+ catch (Exception e) {
+ LOG.warn(null, e);
+ }
+ }
+ return entities.toArray(new IDataModelEntity[entities.size()]);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/DataModelAggregationLookupCall.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/DataModelAggregationLookupCall.java
index 8963a859a7..26cf183901 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/DataModelAggregationLookupCall.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/DataModelAggregationLookupCall.java
@@ -1,138 +1,138 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.composer;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.data.model.DataModelConstants;
-import org.eclipse.scout.rt.shared.data.model.IDataModelAttribute;
-import org.eclipse.scout.rt.shared.services.lookup.LocalLookupCall;
-import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
-
-/**
- * Convenience lookup call to present {@link IDataModelAttribute#getAggregationTypes()}
- * <p>
- * This lookup call expects the property {@link #setAttribute(IDataModelAttribute)} to be set.
- */
-public class DataModelAggregationLookupCall extends LocalLookupCall {
- private static final long serialVersionUID = 1L;
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(DataModelAggregationLookupCall.class);
-
- private IDataModelAttribute m_attribute;
- private List<LookupRow> m_lookupRows;
-
- public void setAttribute(IDataModelAttribute attribute) {
- if (m_attribute != attribute) {
- m_attribute = attribute;
- try {
- updateLookupRows();
- }
- catch (Throwable t) {
- LOG.error("Failed updating aggregation lookup rows for attribute " + attribute);
- m_lookupRows = new ArrayList<LookupRow>();
- }
- }
- }
-
- public IDataModelAttribute getAttribute() {
- return m_attribute;
- }
-
- protected void updateLookupRows() throws ProcessingException {
- List<LookupRow> result = new ArrayList<LookupRow>();
- int[] ags = null;
- if (m_attribute != null) {
- if (m_attribute.getType() != DataModelConstants.TYPE_AGGREGATE_COUNT) {
- //add default entry
- result.add(new LookupRow(DataModelConstants.AGGREGATION_NONE, m_attribute.getText()));
- }
- //add valid entries
- ags = m_attribute.getAggregationTypes();
- if (ags != null && ags.length > 0) {
- for (int ag : ags) {
- String text = null;
- switch (ag) {
- case DataModelConstants.AGGREGATION_AVG: {
- text = ScoutTexts.get("ComposerFieldAggregationAvg", m_attribute.getText());
- break;
- }
- case DataModelConstants.AGGREGATION_COUNT: {
- if (m_attribute.getType() == IDataModelAttribute.TYPE_AGGREGATE_COUNT) {
- text = m_attribute.getText();
- }
- else {
- text = ScoutTexts.get("ComposerFieldAggregationCount", m_attribute.getText());
- }
- break;
- }
- case DataModelConstants.AGGREGATION_MAX: {
- text = ScoutTexts.get("ComposerFieldAggregationMax", m_attribute.getText());
- break;
- }
- case DataModelConstants.AGGREGATION_MEDIAN: {
- text = ScoutTexts.get("ComposerFieldAggregationMedian", m_attribute.getText());
- break;
- }
- case DataModelConstants.AGGREGATION_MIN: {
- text = ScoutTexts.get("ComposerFieldAggregationMin", m_attribute.getText());
- break;
- }
- case DataModelConstants.AGGREGATION_SUM: {
- text = ScoutTexts.get("ComposerFieldAggregationSum", m_attribute.getText());
- break;
- }
- }
- result.add(new LookupRow(ag, text));
- }
- }
- }
- m_lookupRows = result;
- }
-
- /**
- * @return the life list of lookup rows that were created for the current attribute
- * Changed whenever {@link #setAttribute(IDataModelAttribute)} is called with another attribute by
- * calling {@link #updateLookupRows()}.
- */
- public List<LookupRow> getLookupRows() {
- return m_lookupRows;
- }
-
- @Override
- protected List<LookupRow> execCreateLookupRows() throws ProcessingException {
- if (m_lookupRows != null) {
- return m_lookupRows;
- }
- else {
- return Collections.emptyList();
- }
- }
-
- @Override
- public int hashCode() {
- return super.hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (super.equals(obj)) {
- DataModelAggregationLookupCall other = (DataModelAggregationLookupCall) obj;
- return this.m_attribute == other.m_attribute;
- }
- return false;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.composer;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.data.model.DataModelConstants;
+import org.eclipse.scout.rt.shared.data.model.IDataModelAttribute;
+import org.eclipse.scout.rt.shared.services.lookup.LocalLookupCall;
+import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
+
+/**
+ * Convenience lookup call to present {@link IDataModelAttribute#getAggregationTypes()}
+ * <p>
+ * This lookup call expects the property {@link #setAttribute(IDataModelAttribute)} to be set.
+ */
+public class DataModelAggregationLookupCall extends LocalLookupCall {
+ private static final long serialVersionUID = 1L;
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(DataModelAggregationLookupCall.class);
+
+ private IDataModelAttribute m_attribute;
+ private List<LookupRow> m_lookupRows;
+
+ public void setAttribute(IDataModelAttribute attribute) {
+ if (m_attribute != attribute) {
+ m_attribute = attribute;
+ try {
+ updateLookupRows();
+ }
+ catch (Throwable t) {
+ LOG.error("Failed updating aggregation lookup rows for attribute " + attribute);
+ m_lookupRows = new ArrayList<LookupRow>();
+ }
+ }
+ }
+
+ public IDataModelAttribute getAttribute() {
+ return m_attribute;
+ }
+
+ protected void updateLookupRows() throws ProcessingException {
+ List<LookupRow> result = new ArrayList<LookupRow>();
+ int[] ags = null;
+ if (m_attribute != null) {
+ if (m_attribute.getType() != DataModelConstants.TYPE_AGGREGATE_COUNT) {
+ //add default entry
+ result.add(new LookupRow(DataModelConstants.AGGREGATION_NONE, m_attribute.getText()));
+ }
+ //add valid entries
+ ags = m_attribute.getAggregationTypes();
+ if (ags != null && ags.length > 0) {
+ for (int ag : ags) {
+ String text = null;
+ switch (ag) {
+ case DataModelConstants.AGGREGATION_AVG: {
+ text = ScoutTexts.get("ComposerFieldAggregationAvg", m_attribute.getText());
+ break;
+ }
+ case DataModelConstants.AGGREGATION_COUNT: {
+ if (m_attribute.getType() == IDataModelAttribute.TYPE_AGGREGATE_COUNT) {
+ text = m_attribute.getText();
+ }
+ else {
+ text = ScoutTexts.get("ComposerFieldAggregationCount", m_attribute.getText());
+ }
+ break;
+ }
+ case DataModelConstants.AGGREGATION_MAX: {
+ text = ScoutTexts.get("ComposerFieldAggregationMax", m_attribute.getText());
+ break;
+ }
+ case DataModelConstants.AGGREGATION_MEDIAN: {
+ text = ScoutTexts.get("ComposerFieldAggregationMedian", m_attribute.getText());
+ break;
+ }
+ case DataModelConstants.AGGREGATION_MIN: {
+ text = ScoutTexts.get("ComposerFieldAggregationMin", m_attribute.getText());
+ break;
+ }
+ case DataModelConstants.AGGREGATION_SUM: {
+ text = ScoutTexts.get("ComposerFieldAggregationSum", m_attribute.getText());
+ break;
+ }
+ }
+ result.add(new LookupRow(ag, text));
+ }
+ }
+ }
+ m_lookupRows = result;
+ }
+
+ /**
+ * @return the life list of lookup rows that were created for the current attribute
+ * Changed whenever {@link #setAttribute(IDataModelAttribute)} is called with another attribute by
+ * calling {@link #updateLookupRows()}.
+ */
+ public List<LookupRow> getLookupRows() {
+ return m_lookupRows;
+ }
+
+ @Override
+ protected List<LookupRow> execCreateLookupRows() throws ProcessingException {
+ if (m_lookupRows != null) {
+ return m_lookupRows;
+ }
+ else {
+ return Collections.emptyList();
+ }
+ }
+
+ @Override
+ public int hashCode() {
+ return super.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (super.equals(obj)) {
+ DataModelAggregationLookupCall other = (DataModelAggregationLookupCall) obj;
+ return this.m_attribute == other.m_attribute;
+ }
+ return false;
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/DataModelOperatorLookupCall.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/DataModelOperatorLookupCall.java
index 0065550a7d..1b9831e77f 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/DataModelOperatorLookupCall.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/DataModelOperatorLookupCall.java
@@ -1,62 +1,62 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.composer;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.shared.data.model.IDataModelAttribute;
-import org.eclipse.scout.rt.shared.data.model.IDataModelAttributeOp;
-import org.eclipse.scout.rt.shared.services.lookup.LocalLookupCall;
-import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
-
-/**
- * Convenience lookup call to present {@link IDataModelAttribute#getOperators()}
- * <p>
- * This lookup call expects the property {@link #setAttribute(IDataModelAttribute)} to be set.
- */
-public class DataModelOperatorLookupCall extends LocalLookupCall {
- private static final long serialVersionUID = 1L;
-
- private IDataModelAttribute m_attribute;
-
- public void setAttribute(IDataModelAttribute attribute) {
- m_attribute = attribute;
- }
-
- public IDataModelAttribute getAttribute() {
- return m_attribute;
- }
-
- @Override
- protected List<LookupRow> execCreateLookupRows() throws ProcessingException {
- List<LookupRow> result = new ArrayList<LookupRow>();
- IDataModelAttributeOp[] ops = null;
- if (m_attribute != null) {
- ops = m_attribute.getOperators();
- }
- if (ops != null) {
- for (IDataModelAttributeOp op : ops) {
- String text = op.getShortText();
- if (text != null && text.indexOf("{0}") >= 0) {
- text = text.replace("{0}", "n");
- }
- if (text != null && text.indexOf("{1}") >= 0) {
- text = text.replace("{1}", "m");
- }
- result.add(new LookupRow(op, text));
- }
- }
-
- return result;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.composer;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.shared.data.model.IDataModelAttribute;
+import org.eclipse.scout.rt.shared.data.model.IDataModelAttributeOp;
+import org.eclipse.scout.rt.shared.services.lookup.LocalLookupCall;
+import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
+
+/**
+ * Convenience lookup call to present {@link IDataModelAttribute#getOperators()}
+ * <p>
+ * This lookup call expects the property {@link #setAttribute(IDataModelAttribute)} to be set.
+ */
+public class DataModelOperatorLookupCall extends LocalLookupCall {
+ private static final long serialVersionUID = 1L;
+
+ private IDataModelAttribute m_attribute;
+
+ public void setAttribute(IDataModelAttribute attribute) {
+ m_attribute = attribute;
+ }
+
+ public IDataModelAttribute getAttribute() {
+ return m_attribute;
+ }
+
+ @Override
+ protected List<LookupRow> execCreateLookupRows() throws ProcessingException {
+ List<LookupRow> result = new ArrayList<LookupRow>();
+ IDataModelAttributeOp[] ops = null;
+ if (m_attribute != null) {
+ ops = m_attribute.getOperators();
+ }
+ if (ops != null) {
+ for (IDataModelAttributeOp op : ops) {
+ String text = op.getShortText();
+ if (text != null && text.indexOf("{0}") >= 0) {
+ text = text.replace("{0}", "n");
+ }
+ if (text != null && text.indexOf("{1}") >= 0) {
+ text = text.replace("{1}", "m");
+ }
+ result.add(new LookupRow(op, text));
+ }
+ }
+
+ return result;
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/IComposerField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/IComposerField.java
index 8e069f43b3..ca0440dbae 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/IComposerField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/IComposerField.java
@@ -1,56 +1,56 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.composer;
-
-import org.eclipse.scout.rt.client.ui.basic.tree.ITree;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.composer.node.AttributeNode;
-import org.eclipse.scout.rt.client.ui.form.fields.composer.node.EitherOrNode;
-import org.eclipse.scout.rt.client.ui.form.fields.composer.node.EntityNode;
-import org.eclipse.scout.rt.shared.data.model.IDataModel;
-import org.eclipse.scout.rt.shared.data.model.IDataModelAttribute;
-import org.eclipse.scout.rt.shared.data.model.IDataModelAttributeOp;
-import org.eclipse.scout.rt.shared.data.model.IDataModelEntity;
-
-public interface IComposerField extends IFormField {
-
- IDataModel getDataModel();
-
- void setDataModel(IDataModel dm);
-
- IComposerFieldUIFacade getUIFacade();
-
- ITree getTree();
-
- /**
- * convenience for getDataModel().getAttributes()
- */
- IDataModelAttribute[] getAttributes();
-
- /**
- * convenience for getDataModel().getEntities()
- */
- IDataModelEntity[] getEntities();
-
- EntityNode addEntityNode(ITreeNode parentNode, IDataModelEntity e, boolean negated, Object[] values, String[] texts);
-
- AttributeNode addAttributeNode(ITreeNode parentNode, IDataModelAttribute a, Integer aggregationType, IDataModelAttributeOp op, Object[] values, String[] texts);
-
- EitherOrNode addEitherNode(ITreeNode parentNode, boolean negated);
-
- EitherOrNode addAdditionalOrNode(ITreeNode eitherOrNode, boolean negated);
-
- /**
- * set field value to initValue and clear all error flags
- */
- void resetValue();
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.composer;
+
+import org.eclipse.scout.rt.client.ui.basic.tree.ITree;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.composer.node.AttributeNode;
+import org.eclipse.scout.rt.client.ui.form.fields.composer.node.EitherOrNode;
+import org.eclipse.scout.rt.client.ui.form.fields.composer.node.EntityNode;
+import org.eclipse.scout.rt.shared.data.model.IDataModel;
+import org.eclipse.scout.rt.shared.data.model.IDataModelAttribute;
+import org.eclipse.scout.rt.shared.data.model.IDataModelAttributeOp;
+import org.eclipse.scout.rt.shared.data.model.IDataModelEntity;
+
+public interface IComposerField extends IFormField {
+
+ IDataModel getDataModel();
+
+ void setDataModel(IDataModel dm);
+
+ IComposerFieldUIFacade getUIFacade();
+
+ ITree getTree();
+
+ /**
+ * convenience for getDataModel().getAttributes()
+ */
+ IDataModelAttribute[] getAttributes();
+
+ /**
+ * convenience for getDataModel().getEntities()
+ */
+ IDataModelEntity[] getEntities();
+
+ EntityNode addEntityNode(ITreeNode parentNode, IDataModelEntity e, boolean negated, Object[] values, String[] texts);
+
+ AttributeNode addAttributeNode(ITreeNode parentNode, IDataModelAttribute a, Integer aggregationType, IDataModelAttributeOp op, Object[] values, String[] texts);
+
+ EitherOrNode addEitherNode(ITreeNode parentNode, boolean negated);
+
+ EitherOrNode addAdditionalOrNode(ITreeNode eitherOrNode, boolean negated);
+
+ /**
+ * set field value to initValue and clear all error flags
+ */
+ void resetValue();
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/IComposerFieldUIFacade.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/IComposerFieldUIFacade.java
index dba49f4047..5dcea96259 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/IComposerFieldUIFacade.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/IComposerFieldUIFacade.java
@@ -1,15 +1,15 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.composer;
-
-public interface IComposerFieldUIFacade {
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.composer;
+
+public interface IComposerFieldUIFacade {
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/IComposerValueField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/IComposerValueField.java
index f20bb3cb9a..459ef29546 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/IComposerValueField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/IComposerValueField.java
@@ -1,46 +1,46 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.composer;
-
-import java.beans.PropertyChangeListener;
-
-import org.eclipse.scout.rt.shared.data.model.IDataModelAttribute;
-import org.eclipse.scout.rt.shared.data.model.IDataModelAttributeOp;
-
-/**
- * interface for all composer related generic values fields
- */
-public interface IComposerValueField {
-
- void addValueChangeListenerToTarget(PropertyChangeListener listener);
-
- void removeValueChangeListenerFromTarget(PropertyChangeListener listener);
-
- void setSelectionContext(IDataModelAttribute attribute, int dataType, IDataModelAttributeOp op, Object[] values);
-
- void clearSelectionContext();
-
- /**
- * @return array of field value(s), null when field has invalid or missing values
- * <p>
- * Note: listbox and treebox have <b>one</b> value that is an array, so returning an array with the first
- * element being an array: [[a,b,c,d] ]
- * <p>
- * Note: "between a and b" field has <b>two</b> values so returning an array with two elements: [a, b ]
- */
- Object[] getValues();
-
- /**
- * @return the texts of the values of the selected field
- */
- String[] getTexts();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.composer;
+
+import java.beans.PropertyChangeListener;
+
+import org.eclipse.scout.rt.shared.data.model.IDataModelAttribute;
+import org.eclipse.scout.rt.shared.data.model.IDataModelAttributeOp;
+
+/**
+ * interface for all composer related generic values fields
+ */
+public interface IComposerValueField {
+
+ void addValueChangeListenerToTarget(PropertyChangeListener listener);
+
+ void removeValueChangeListenerFromTarget(PropertyChangeListener listener);
+
+ void setSelectionContext(IDataModelAttribute attribute, int dataType, IDataModelAttributeOp op, Object[] values);
+
+ void clearSelectionContext();
+
+ /**
+ * @return array of field value(s), null when field has invalid or missing values
+ * <p>
+ * Note: listbox and treebox have <b>one</b> value that is an array, so returning an array with the first
+ * element being an array: [[a,b,c,d] ]
+ * <p>
+ * Note: "between a and b" field has <b>two</b> values so returning an array with two elements: [a, b ]
+ */
+ Object[] getValues();
+
+ /**
+ * @return the texts of the values of the selected field
+ */
+ String[] getTexts();
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/attribute/AbstractComposerAttribute.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/attribute/AbstractComposerAttribute.java
index 578603591f..0d23572daa 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/attribute/AbstractComposerAttribute.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/attribute/AbstractComposerAttribute.java
@@ -1,112 +1,112 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.composer.attribute;
-
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.form.fields.composer.IComposerField;
-import org.eclipse.scout.rt.shared.data.model.AbstractDataModelAttribute;
-
-/**
- * @deprecated use {@link AbstractDataModelAttribute}
- */
-@SuppressWarnings("deprecation")
-@Deprecated
-public abstract class AbstractComposerAttribute extends AbstractDataModelAttribute implements IComposerAttribute {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractComposerAttribute.class);
- private static final long serialVersionUID = 1L;
-
- private String m_id;
-
- public AbstractComposerAttribute() {
- }
-
- /*
- * Configuration
- */
-
- /**
- * @deprecated the id must always by the class simple name
- * for dynamic attributes use {@link IComposerField#getMetaDataOfAttribute(IComposerAttribute)}
- */
- @Deprecated
- @ConfigProperty(ConfigProperty.STRING)
- @Order(50)
- @ConfigPropertyValue("null")
- protected String getConfiguredId() {
- return null;
- }
-
- @Override
- protected void initConfig() {
- setId(getConfiguredId());
- super.initConfig();
- }
-
- /*
- * Runtime
- */
-
- @Override
- protected void injectOperators() {
- if (getLegacyStatement() != null) {
- new LegacyComposerAttributeInjector().injectOperators(this);
- }
- else {
- super.injectOperators();
- }
- }
-
- @Override
- protected void injectAggregationTypes() {
- if (getLegacyStatement() != null) {
- new LegacyComposerAttributeInjector().injectAggregationTypes(this);
- }
- else {
- super.injectAggregationTypes();
- }
- }
-
- @Override
- public String getId() {
- if (m_id != null) {
- return m_id;
- }
- else {
- return getClass().getSimpleName();
- }
- }
-
- @Override
- public void setId(String s) {
- m_id = s;
- }
-
- /**
- * @deprecated processing logic belongs to server
- */
- @Deprecated
- protected String getConfiguredStatement() {
- return null;
- }
-
- /**
- * @deprecated processing logic belongs to server
- */
- @Deprecated
- public String getLegacyStatement() {
- return getConfiguredStatement();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.composer.attribute;
+
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.form.fields.composer.IComposerField;
+import org.eclipse.scout.rt.shared.data.model.AbstractDataModelAttribute;
+
+/**
+ * @deprecated use {@link AbstractDataModelAttribute}
+ */
+@SuppressWarnings("deprecation")
+@Deprecated
+public abstract class AbstractComposerAttribute extends AbstractDataModelAttribute implements IComposerAttribute {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractComposerAttribute.class);
+ private static final long serialVersionUID = 1L;
+
+ private String m_id;
+
+ public AbstractComposerAttribute() {
+ }
+
+ /*
+ * Configuration
+ */
+
+ /**
+ * @deprecated the id must always by the class simple name
+ * for dynamic attributes use {@link IComposerField#getMetaDataOfAttribute(IComposerAttribute)}
+ */
+ @Deprecated
+ @ConfigProperty(ConfigProperty.STRING)
+ @Order(50)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredId() {
+ return null;
+ }
+
+ @Override
+ protected void initConfig() {
+ setId(getConfiguredId());
+ super.initConfig();
+ }
+
+ /*
+ * Runtime
+ */
+
+ @Override
+ protected void injectOperators() {
+ if (getLegacyStatement() != null) {
+ new LegacyComposerAttributeInjector().injectOperators(this);
+ }
+ else {
+ super.injectOperators();
+ }
+ }
+
+ @Override
+ protected void injectAggregationTypes() {
+ if (getLegacyStatement() != null) {
+ new LegacyComposerAttributeInjector().injectAggregationTypes(this);
+ }
+ else {
+ super.injectAggregationTypes();
+ }
+ }
+
+ @Override
+ public String getId() {
+ if (m_id != null) {
+ return m_id;
+ }
+ else {
+ return getClass().getSimpleName();
+ }
+ }
+
+ @Override
+ public void setId(String s) {
+ m_id = s;
+ }
+
+ /**
+ * @deprecated processing logic belongs to server
+ */
+ @Deprecated
+ protected String getConfiguredStatement() {
+ return null;
+ }
+
+ /**
+ * @deprecated processing logic belongs to server
+ */
+ @Deprecated
+ public String getLegacyStatement() {
+ return getConfiguredStatement();
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/attribute/IComposerAttribute.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/attribute/IComposerAttribute.java
index 8a0e834a7c..db904350aa 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/attribute/IComposerAttribute.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/attribute/IComposerAttribute.java
@@ -1,36 +1,36 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.composer.attribute;
-
-import org.eclipse.scout.rt.client.ui.form.fields.composer.IComposerField;
-import org.eclipse.scout.rt.shared.data.model.IDataModelAttribute;
-
-/**
- * @deprecated use {@link IDataModelAttribute}
- */
-@Deprecated
-public interface IComposerAttribute extends IDataModelAttribute {
-
- /**
- * @deprecated the id must always by the class simple name
- * for dynamic attributes use {@link IComposerField#getMetaDataOfAttribute(IComposerAttribute)}
- */
- @Deprecated
- String getId();
-
- /**
- * @deprecated the id must always by the class simple name
- * for dynamic attributes use {@link IComposerField#getMetaDataOfAttribute(IComposerAttribute)}
- */
- @Deprecated
- void setId(String s);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.composer.attribute;
+
+import org.eclipse.scout.rt.client.ui.form.fields.composer.IComposerField;
+import org.eclipse.scout.rt.shared.data.model.IDataModelAttribute;
+
+/**
+ * @deprecated use {@link IDataModelAttribute}
+ */
+@Deprecated
+public interface IComposerAttribute extends IDataModelAttribute {
+
+ /**
+ * @deprecated the id must always by the class simple name
+ * for dynamic attributes use {@link IComposerField#getMetaDataOfAttribute(IComposerAttribute)}
+ */
+ @Deprecated
+ String getId();
+
+ /**
+ * @deprecated the id must always by the class simple name
+ * for dynamic attributes use {@link IComposerField#getMetaDataOfAttribute(IComposerAttribute)}
+ */
+ @Deprecated
+ void setId(String s);
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/attribute/LegacyComposerAttributeInjector.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/attribute/LegacyComposerAttributeInjector.java
index c392bee334..723bdc5e8d 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/attribute/LegacyComposerAttributeInjector.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/attribute/LegacyComposerAttributeInjector.java
@@ -1,208 +1,208 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.composer.attribute;
-
-import java.util.ArrayList;
-
-import org.eclipse.scout.rt.shared.data.model.DataModelAttributeOp;
-import org.eclipse.scout.rt.shared.data.model.DataModelConstants;
-import org.eclipse.scout.rt.shared.data.model.IDataModelAttributeOp;
-
-/**
- *
- */
-@SuppressWarnings("deprecation")
-public class LegacyComposerAttributeInjector implements DataModelConstants {
-
- public void injectOperators(IComposerAttribute attribute) {
- ArrayList<IDataModelAttributeOp> opList = new ArrayList<IDataModelAttributeOp>();
- switch (attribute.getType()) {
- case IComposerAttribute.TYPE_SMART: {
- opList.add(DataModelAttributeOp.create(OPERATOR_EQ));
- if (attribute.isNotOperatorEnabled()) {
- opList.add(DataModelAttributeOp.create(OPERATOR_NEQ));
- }
- if (attribute.isNullOperatorEnabled()) {
- opList.add(DataModelAttributeOp.create(OPERATOR_NUMBER_NULL));
- }
- if (attribute.isNotOperatorEnabled() && attribute.isNullOperatorEnabled()) {
- opList.add(DataModelAttributeOp.create(OPERATOR_NUMBER_NOT_NULL));
- }
- break;
- }
- case IComposerAttribute.TYPE_CODE_LIST:
- case IComposerAttribute.TYPE_CODE_TREE:
- case IComposerAttribute.TYPE_NUMBER_LIST:
- case IComposerAttribute.TYPE_NUMBER_TREE: {
- opList.add(DataModelAttributeOp.create(OPERATOR_IN));
- if (attribute.isNotOperatorEnabled()) {
- opList.add(DataModelAttributeOp.create(OPERATOR_NOT_IN));
- }
- if (attribute.isNullOperatorEnabled()) {
- opList.add(DataModelAttributeOp.create(OPERATOR_NUMBER_NULL));
- }
- if (attribute.isNotOperatorEnabled() && attribute.isNullOperatorEnabled()) {
- opList.add(DataModelAttributeOp.create(OPERATOR_NUMBER_NOT_NULL));
- }
- break;
- }
- case IComposerAttribute.TYPE_DATE:
- case IComposerAttribute.TYPE_TIME:
- case IComposerAttribute.TYPE_DATE_TIME: {
- opList.add(DataModelAttributeOp.create(OPERATOR_EQ));
- if (attribute.isNotOperatorEnabled()) {
- opList.add(DataModelAttributeOp.create(OPERATOR_NEQ));
- }
- opList.add(DataModelAttributeOp.create(OPERATOR_LT));
- opList.add(DataModelAttributeOp.create(OPERATOR_LE));
- opList.add(DataModelAttributeOp.create(OPERATOR_GT));
- opList.add(DataModelAttributeOp.create(OPERATOR_GE));
- if (attribute.isNullOperatorEnabled()) {
- opList.add(DataModelAttributeOp.create(OPERATOR_NULL));
- }
- if (attribute.isNotOperatorEnabled() && attribute.isNullOperatorEnabled()) {
- opList.add(DataModelAttributeOp.create(OPERATOR_NOT_NULL));
- }
- switch (attribute.getType()) {
- case IComposerAttribute.TYPE_DATE: {
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_TODAY));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_LAST_DAYS));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_LAST_MONTHS));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_NEXT_DAYS));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_NEXT_MONTHS));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_DAYS));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_MONTHS));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_LE_DAYS));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_LE_MONTHS));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_GE_DAYS));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_GE_MONTHS));
- if (attribute.isNotOperatorEnabled()) {
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_NOT_TODAY));
- }
- break;
- }
- case IComposerAttribute.TYPE_TIME: {
- opList.add(DataModelAttributeOp.create(OPERATOR_TIME_IS_IN_GE_HOURS));
- opList.add(DataModelAttributeOp.create(OPERATOR_TIME_IS_IN_GE_MINUTES));
- opList.add(DataModelAttributeOp.create(OPERATOR_TIME_IS_IN_HOURS));
- // opList.add(DataModelAttributeOp.create(OPERATOR_Time_Is_In_Minutes,AGGREGATION_NONE));
- opList.add(DataModelAttributeOp.create(OPERATOR_TIME_IS_IN_LE_HOURS));
- opList.add(DataModelAttributeOp.create(OPERATOR_TIME_IS_IN_LE_MINUTES));
- opList.add(DataModelAttributeOp.create(OPERATOR_TIME_IS_NOW));
- break;
- }
- case IComposerAttribute.TYPE_DATE_TIME: {
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_TIME_IS_NOW));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_TODAY));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_LAST_DAYS));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_LAST_MONTHS));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_NEXT_DAYS));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_NEXT_MONTHS));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_DAYS));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_MONTHS));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_TIME_IS_IN_LE_MINUTES));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_TIME_IS_IN_LE_HOURS));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_LE_DAYS));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_LE_MONTHS));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_TIME_IS_IN_GE_MINUTES));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_TIME_IS_IN_GE_HOURS));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_GE_DAYS));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_GE_MONTHS));
- if (attribute.isNotOperatorEnabled()) {
- // opList.add(DataModelAttributeOp.create(OPERATOR_Date_TimeIs_NotNow,AGGREGATION_NONE));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_NOT_TODAY));
- }
- break;
- }
- }
- break;
- }
- case IComposerAttribute.TYPE_INTEGER:
- case IComposerAttribute.TYPE_LONG:
- case IComposerAttribute.TYPE_DOUBLE:
- case IComposerAttribute.TYPE_PLAIN_INTEGER:
- case IComposerAttribute.TYPE_PLAIN_LONG:
- case IComposerAttribute.TYPE_PLAIN_DOUBLE:
- case IComposerAttribute.TYPE_PERCENT: {
- opList.add(DataModelAttributeOp.create(OPERATOR_EQ));
- if (attribute.isNotOperatorEnabled()) {
- opList.add(DataModelAttributeOp.create(OPERATOR_NEQ));
- }
- opList.add(DataModelAttributeOp.create(OPERATOR_LT));
- opList.add(DataModelAttributeOp.create(OPERATOR_LE));
- opList.add(DataModelAttributeOp.create(OPERATOR_GT));
- opList.add(DataModelAttributeOp.create(OPERATOR_GE));
- if (attribute.isNullOperatorEnabled()) {
- opList.add(DataModelAttributeOp.create(OPERATOR_NULL));
- }
- if (attribute.isNotOperatorEnabled() && attribute.isNullOperatorEnabled()) {
- opList.add(DataModelAttributeOp.create(OPERATOR_NOT_NULL));
- }
- break;
- }
- case IComposerAttribute.TYPE_AGGREGATE_COUNT: {
- opList.add(DataModelAttributeOp.create(OPERATOR_EQ));
- if (attribute.isNotOperatorEnabled()) {
- opList.add(DataModelAttributeOp.create(OPERATOR_NEQ));
- }
- opList.add(DataModelAttributeOp.create(OPERATOR_LT));
- opList.add(DataModelAttributeOp.create(OPERATOR_LE));
- opList.add(DataModelAttributeOp.create(OPERATOR_GT));
- opList.add(DataModelAttributeOp.create(OPERATOR_GE));
- break;
- }
- case IComposerAttribute.TYPE_STRING: {
- opList.add(DataModelAttributeOp.create(OPERATOR_EQ));
- if (attribute.isNotOperatorEnabled()) {
- opList.add(DataModelAttributeOp.create(OPERATOR_NEQ));
- }
- opList.add(DataModelAttributeOp.create(OPERATOR_CONTAINS));
- if (attribute.isNotOperatorEnabled()) {
- opList.add(DataModelAttributeOp.create(OPERATOR_NOT_CONTAINS));
- }
- opList.add(DataModelAttributeOp.create(OPERATOR_STARTS_WITH));
- if (attribute.isNotOperatorEnabled()) {
- opList.add(DataModelAttributeOp.create(OPERATOR_NOT_STARTS_WITH));
- }
- opList.add(DataModelAttributeOp.create(OPERATOR_ENDS_WITH));
- if (attribute.isNotOperatorEnabled()) {
- opList.add(DataModelAttributeOp.create(OPERATOR_NOT_ENDS_WITH));
- }
- if (attribute.isNullOperatorEnabled()) {
- opList.add(DataModelAttributeOp.create(OPERATOR_NULL));
- }
- if (attribute.isNotOperatorEnabled() && attribute.isNullOperatorEnabled()) {
- opList.add(DataModelAttributeOp.create(OPERATOR_NOT_NULL));
- }
- break;
- }
- case IComposerAttribute.TYPE_FULL_TEXT: {
- opList.add(DataModelAttributeOp.create(OPERATOR_CONTAINS));
- if (attribute.isNotOperatorEnabled()) {
- opList.add(DataModelAttributeOp.create(OPERATOR_NOT_CONTAINS));
- }
- if (attribute.isNullOperatorEnabled()) {
- opList.add(DataModelAttributeOp.create(OPERATOR_NULL));
- }
- if (attribute.isNotOperatorEnabled() && attribute.isNullOperatorEnabled()) {
- opList.add(DataModelAttributeOp.create(OPERATOR_NOT_NULL));
- }
- break;
- }
- }
- //
- attribute.setOperators(opList.toArray(new IDataModelAttributeOp[opList.size()]));
- }
-
- public void injectAggregationTypes(IComposerAttribute attribute) {
- attribute.setAggregationTypes(new int[0]);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.composer.attribute;
+
+import java.util.ArrayList;
+
+import org.eclipse.scout.rt.shared.data.model.DataModelAttributeOp;
+import org.eclipse.scout.rt.shared.data.model.DataModelConstants;
+import org.eclipse.scout.rt.shared.data.model.IDataModelAttributeOp;
+
+/**
+ *
+ */
+@SuppressWarnings("deprecation")
+public class LegacyComposerAttributeInjector implements DataModelConstants {
+
+ public void injectOperators(IComposerAttribute attribute) {
+ ArrayList<IDataModelAttributeOp> opList = new ArrayList<IDataModelAttributeOp>();
+ switch (attribute.getType()) {
+ case IComposerAttribute.TYPE_SMART: {
+ opList.add(DataModelAttributeOp.create(OPERATOR_EQ));
+ if (attribute.isNotOperatorEnabled()) {
+ opList.add(DataModelAttributeOp.create(OPERATOR_NEQ));
+ }
+ if (attribute.isNullOperatorEnabled()) {
+ opList.add(DataModelAttributeOp.create(OPERATOR_NUMBER_NULL));
+ }
+ if (attribute.isNotOperatorEnabled() && attribute.isNullOperatorEnabled()) {
+ opList.add(DataModelAttributeOp.create(OPERATOR_NUMBER_NOT_NULL));
+ }
+ break;
+ }
+ case IComposerAttribute.TYPE_CODE_LIST:
+ case IComposerAttribute.TYPE_CODE_TREE:
+ case IComposerAttribute.TYPE_NUMBER_LIST:
+ case IComposerAttribute.TYPE_NUMBER_TREE: {
+ opList.add(DataModelAttributeOp.create(OPERATOR_IN));
+ if (attribute.isNotOperatorEnabled()) {
+ opList.add(DataModelAttributeOp.create(OPERATOR_NOT_IN));
+ }
+ if (attribute.isNullOperatorEnabled()) {
+ opList.add(DataModelAttributeOp.create(OPERATOR_NUMBER_NULL));
+ }
+ if (attribute.isNotOperatorEnabled() && attribute.isNullOperatorEnabled()) {
+ opList.add(DataModelAttributeOp.create(OPERATOR_NUMBER_NOT_NULL));
+ }
+ break;
+ }
+ case IComposerAttribute.TYPE_DATE:
+ case IComposerAttribute.TYPE_TIME:
+ case IComposerAttribute.TYPE_DATE_TIME: {
+ opList.add(DataModelAttributeOp.create(OPERATOR_EQ));
+ if (attribute.isNotOperatorEnabled()) {
+ opList.add(DataModelAttributeOp.create(OPERATOR_NEQ));
+ }
+ opList.add(DataModelAttributeOp.create(OPERATOR_LT));
+ opList.add(DataModelAttributeOp.create(OPERATOR_LE));
+ opList.add(DataModelAttributeOp.create(OPERATOR_GT));
+ opList.add(DataModelAttributeOp.create(OPERATOR_GE));
+ if (attribute.isNullOperatorEnabled()) {
+ opList.add(DataModelAttributeOp.create(OPERATOR_NULL));
+ }
+ if (attribute.isNotOperatorEnabled() && attribute.isNullOperatorEnabled()) {
+ opList.add(DataModelAttributeOp.create(OPERATOR_NOT_NULL));
+ }
+ switch (attribute.getType()) {
+ case IComposerAttribute.TYPE_DATE: {
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_TODAY));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_LAST_DAYS));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_LAST_MONTHS));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_NEXT_DAYS));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_NEXT_MONTHS));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_DAYS));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_MONTHS));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_LE_DAYS));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_LE_MONTHS));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_GE_DAYS));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_GE_MONTHS));
+ if (attribute.isNotOperatorEnabled()) {
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_NOT_TODAY));
+ }
+ break;
+ }
+ case IComposerAttribute.TYPE_TIME: {
+ opList.add(DataModelAttributeOp.create(OPERATOR_TIME_IS_IN_GE_HOURS));
+ opList.add(DataModelAttributeOp.create(OPERATOR_TIME_IS_IN_GE_MINUTES));
+ opList.add(DataModelAttributeOp.create(OPERATOR_TIME_IS_IN_HOURS));
+ // opList.add(DataModelAttributeOp.create(OPERATOR_Time_Is_In_Minutes,AGGREGATION_NONE));
+ opList.add(DataModelAttributeOp.create(OPERATOR_TIME_IS_IN_LE_HOURS));
+ opList.add(DataModelAttributeOp.create(OPERATOR_TIME_IS_IN_LE_MINUTES));
+ opList.add(DataModelAttributeOp.create(OPERATOR_TIME_IS_NOW));
+ break;
+ }
+ case IComposerAttribute.TYPE_DATE_TIME: {
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_TIME_IS_NOW));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_TODAY));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_LAST_DAYS));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_LAST_MONTHS));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_NEXT_DAYS));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_NEXT_MONTHS));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_DAYS));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_MONTHS));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_TIME_IS_IN_LE_MINUTES));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_TIME_IS_IN_LE_HOURS));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_LE_DAYS));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_LE_MONTHS));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_TIME_IS_IN_GE_MINUTES));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_TIME_IS_IN_GE_HOURS));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_GE_DAYS));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_GE_MONTHS));
+ if (attribute.isNotOperatorEnabled()) {
+ // opList.add(DataModelAttributeOp.create(OPERATOR_Date_TimeIs_NotNow,AGGREGATION_NONE));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_NOT_TODAY));
+ }
+ break;
+ }
+ }
+ break;
+ }
+ case IComposerAttribute.TYPE_INTEGER:
+ case IComposerAttribute.TYPE_LONG:
+ case IComposerAttribute.TYPE_DOUBLE:
+ case IComposerAttribute.TYPE_PLAIN_INTEGER:
+ case IComposerAttribute.TYPE_PLAIN_LONG:
+ case IComposerAttribute.TYPE_PLAIN_DOUBLE:
+ case IComposerAttribute.TYPE_PERCENT: {
+ opList.add(DataModelAttributeOp.create(OPERATOR_EQ));
+ if (attribute.isNotOperatorEnabled()) {
+ opList.add(DataModelAttributeOp.create(OPERATOR_NEQ));
+ }
+ opList.add(DataModelAttributeOp.create(OPERATOR_LT));
+ opList.add(DataModelAttributeOp.create(OPERATOR_LE));
+ opList.add(DataModelAttributeOp.create(OPERATOR_GT));
+ opList.add(DataModelAttributeOp.create(OPERATOR_GE));
+ if (attribute.isNullOperatorEnabled()) {
+ opList.add(DataModelAttributeOp.create(OPERATOR_NULL));
+ }
+ if (attribute.isNotOperatorEnabled() && attribute.isNullOperatorEnabled()) {
+ opList.add(DataModelAttributeOp.create(OPERATOR_NOT_NULL));
+ }
+ break;
+ }
+ case IComposerAttribute.TYPE_AGGREGATE_COUNT: {
+ opList.add(DataModelAttributeOp.create(OPERATOR_EQ));
+ if (attribute.isNotOperatorEnabled()) {
+ opList.add(DataModelAttributeOp.create(OPERATOR_NEQ));
+ }
+ opList.add(DataModelAttributeOp.create(OPERATOR_LT));
+ opList.add(DataModelAttributeOp.create(OPERATOR_LE));
+ opList.add(DataModelAttributeOp.create(OPERATOR_GT));
+ opList.add(DataModelAttributeOp.create(OPERATOR_GE));
+ break;
+ }
+ case IComposerAttribute.TYPE_STRING: {
+ opList.add(DataModelAttributeOp.create(OPERATOR_EQ));
+ if (attribute.isNotOperatorEnabled()) {
+ opList.add(DataModelAttributeOp.create(OPERATOR_NEQ));
+ }
+ opList.add(DataModelAttributeOp.create(OPERATOR_CONTAINS));
+ if (attribute.isNotOperatorEnabled()) {
+ opList.add(DataModelAttributeOp.create(OPERATOR_NOT_CONTAINS));
+ }
+ opList.add(DataModelAttributeOp.create(OPERATOR_STARTS_WITH));
+ if (attribute.isNotOperatorEnabled()) {
+ opList.add(DataModelAttributeOp.create(OPERATOR_NOT_STARTS_WITH));
+ }
+ opList.add(DataModelAttributeOp.create(OPERATOR_ENDS_WITH));
+ if (attribute.isNotOperatorEnabled()) {
+ opList.add(DataModelAttributeOp.create(OPERATOR_NOT_ENDS_WITH));
+ }
+ if (attribute.isNullOperatorEnabled()) {
+ opList.add(DataModelAttributeOp.create(OPERATOR_NULL));
+ }
+ if (attribute.isNotOperatorEnabled() && attribute.isNullOperatorEnabled()) {
+ opList.add(DataModelAttributeOp.create(OPERATOR_NOT_NULL));
+ }
+ break;
+ }
+ case IComposerAttribute.TYPE_FULL_TEXT: {
+ opList.add(DataModelAttributeOp.create(OPERATOR_CONTAINS));
+ if (attribute.isNotOperatorEnabled()) {
+ opList.add(DataModelAttributeOp.create(OPERATOR_NOT_CONTAINS));
+ }
+ if (attribute.isNullOperatorEnabled()) {
+ opList.add(DataModelAttributeOp.create(OPERATOR_NULL));
+ }
+ if (attribute.isNotOperatorEnabled() && attribute.isNullOperatorEnabled()) {
+ opList.add(DataModelAttributeOp.create(OPERATOR_NOT_NULL));
+ }
+ break;
+ }
+ }
+ //
+ attribute.setOperators(opList.toArray(new IDataModelAttributeOp[opList.size()]));
+ }
+
+ public void injectAggregationTypes(IComposerAttribute attribute) {
+ attribute.setAggregationTypes(new int[0]);
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/entity/AbstractComposerEntity.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/entity/AbstractComposerEntity.java
index feb9399ebb..30d00f76ec 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/entity/AbstractComposerEntity.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/entity/AbstractComposerEntity.java
@@ -1,82 +1,82 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.composer.entity;
-
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.shared.data.model.AbstractDataModelEntity;
-
-/**
- * @deprecated use {@link AbstractDataModelEntity}
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-public abstract class AbstractComposerEntity extends AbstractDataModelEntity implements IComposerEntity {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractComposerEntity.class);
- private static final long serialVersionUID = 1L;
-
- private String m_id;
-
- public AbstractComposerEntity() {
- }
-
- /**
- * @deprecated the id must always by the class simple name
- */
- @Deprecated
- @ConfigProperty(ConfigProperty.STRING)
- @Order(30)
- @ConfigPropertyValue("null")
- protected String getConfiguredId() {
- return null;
- }
-
- @Override
- protected void initConfig() {
- setId(getConfiguredId());
- super.initConfig();
- }
-
- @Override
- public String getId() {
- if (m_id != null) {
- return m_id;
- }
- else {
- return getClass().getSimpleName();
- }
- }
-
- @Override
- public void setId(String s) {
- m_id = s;
- }
-
- /**
- * @deprecated processing logic belongs to server
- */
- @Deprecated
- protected String getConfiguredStatement() {
- return null;
- }
-
- /**
- * @deprecated processing logic belongs to server
- */
- @Deprecated
- public String getLegacyStatement() {
- return getConfiguredStatement();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.composer.entity;
+
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.shared.data.model.AbstractDataModelEntity;
+
+/**
+ * @deprecated use {@link AbstractDataModelEntity}
+ */
+@Deprecated
+@SuppressWarnings("deprecation")
+public abstract class AbstractComposerEntity extends AbstractDataModelEntity implements IComposerEntity {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractComposerEntity.class);
+ private static final long serialVersionUID = 1L;
+
+ private String m_id;
+
+ public AbstractComposerEntity() {
+ }
+
+ /**
+ * @deprecated the id must always by the class simple name
+ */
+ @Deprecated
+ @ConfigProperty(ConfigProperty.STRING)
+ @Order(30)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredId() {
+ return null;
+ }
+
+ @Override
+ protected void initConfig() {
+ setId(getConfiguredId());
+ super.initConfig();
+ }
+
+ @Override
+ public String getId() {
+ if (m_id != null) {
+ return m_id;
+ }
+ else {
+ return getClass().getSimpleName();
+ }
+ }
+
+ @Override
+ public void setId(String s) {
+ m_id = s;
+ }
+
+ /**
+ * @deprecated processing logic belongs to server
+ */
+ @Deprecated
+ protected String getConfiguredStatement() {
+ return null;
+ }
+
+ /**
+ * @deprecated processing logic belongs to server
+ */
+ @Deprecated
+ public String getLegacyStatement() {
+ return getConfiguredStatement();
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/entity/IComposerEntity.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/entity/IComposerEntity.java
index a901addf0c..eea73bffc3 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/entity/IComposerEntity.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/entity/IComposerEntity.java
@@ -1,34 +1,34 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.composer.entity;
-
-import org.eclipse.scout.rt.shared.data.model.IDataModelEntity;
-
-/**
- * @deprecated use {@link IDataModelEntity}
- */
-
-@Deprecated
-public interface IComposerEntity extends IDataModelEntity {
-
- /**
- * @deprecated the id must always by the class simple name
- */
- @Deprecated
- String getId();
-
- /**
- * @deprecated the id must always by the class simple name
- */
- @Deprecated
- void setId(String s);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.composer.entity;
+
+import org.eclipse.scout.rt.shared.data.model.IDataModelEntity;
+
+/**
+ * @deprecated use {@link IDataModelEntity}
+ */
+
+@Deprecated
+public interface IComposerEntity extends IDataModelEntity {
+
+ /**
+ * @deprecated the id must always by the class simple name
+ */
+ @Deprecated
+ String getId();
+
+ /**
+ * @deprecated the id must always by the class simple name
+ */
+ @Deprecated
+ void setId(String s);
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/internal/ComposerAttributeForm.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/internal/ComposerAttributeForm.java
index 11dd1d9985..d834c8bbbc 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/internal/ComposerAttributeForm.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/internal/ComposerAttributeForm.java
@@ -1,396 +1,396 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.composer.internal;
-
-import java.util.ArrayList;
-
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.form.AbstractForm;
-import org.eclipse.scout.rt.client.ui.form.AbstractFormHandler;
-import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractCancelButton;
-import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractOkButton;
-import org.eclipse.scout.rt.client.ui.form.fields.composer.AbstractComposerValueBox;
-import org.eclipse.scout.rt.client.ui.form.fields.composer.IComposerValueField;
-import org.eclipse.scout.rt.client.ui.form.fields.composer.internal.ComposerAttributeForm.MainBox.CancelButton;
-import org.eclipse.scout.rt.client.ui.form.fields.composer.internal.ComposerAttributeForm.MainBox.OkButton;
-import org.eclipse.scout.rt.client.ui.form.fields.composer.internal.ComposerAttributeForm.MainBox.SequenceBox.AttributeField;
-import org.eclipse.scout.rt.client.ui.form.fields.composer.internal.ComposerAttributeForm.MainBox.SequenceBox.OperatorField;
-import org.eclipse.scout.rt.client.ui.form.fields.composer.internal.ComposerAttributeForm.MainBox.SequenceBox.ValueField;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
-import org.eclipse.scout.rt.client.ui.form.fields.listbox.AbstractListBox;
-import org.eclipse.scout.rt.client.ui.form.fields.sequencebox.AbstractSequenceBox;
-import org.eclipse.scout.rt.shared.AbstractIcons;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.data.model.IDataModelAttribute;
-import org.eclipse.scout.rt.shared.data.model.IDataModelAttributeOp;
-import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
-import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
-import org.eclipse.scout.service.SERVICES;
-
-public class ComposerAttributeForm extends AbstractForm {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(ComposerAttributeForm.class);
-
- private IDataModelAttribute[] m_validAttributes;
- /**
- * result values
- */
- private Object[] m_selectedValues;
- /**
- * result display values
- */
- private String[] m_selectedDisplayValues;
-
- public ComposerAttributeForm() throws ProcessingException {
- super();
- }
-
- /**
- * form property
- */
- public IDataModelAttribute[] getAvailableAttributes() {
- return m_validAttributes;
- }
-
- public void setAvailableAttributes(IDataModelAttribute[] a) throws ProcessingException {
- m_validAttributes = a;
- // single observer, reload attributes listbox
- getAttributeField().loadListBoxData();
- }
-
- /**
- * form properties
- */
- public Object[] getSelectedValues() {
- return m_selectedValues;
- }
-
- public void setSelectedValues(Object[] o) {
- setSelectedValuesInternal(o);
- // single observer
- activateValueField();
- }
-
- private void setSelectedValuesInternal(Object[] o) {
- m_selectedValues = o;
- }
-
- public String[] getSelectedDisplayValues() {
- return m_selectedDisplayValues;
- }
-
- public void setSelectedDisplayValues(String[] s) {
- setSelectedDisplayValuesInternal(s);
- }
-
- private void setSelectedDisplayValuesInternal(String[] s) {
- m_selectedDisplayValues = s;
- }
-
- public IDataModelAttribute getSelectedAttribute() {
- return getAttributeField().getCheckedKey();
- }
-
- public void setSelectedAttribute(IDataModelAttribute a) {
- getAttributeField().checkKey(a);
- }
-
- public IDataModelAttributeOp getSelectedOp() {
- return getOperatorField().getCheckedKey();
- }
-
- public void setSelectedOp(IDataModelAttributeOp op) {
- getOperatorField().checkKey(op);
- }
-
- @Override
- @ConfigPropertyValue("\"ExtendedSearchAddAttribute\"")
- protected String getConfiguredTitle() {
- return ScoutTexts.get("ExtendedSearchAddAttribute");
- }
-
- /**
- * activate value field function
- */
- private void activateValueField() {
- IDataModelAttribute att = getAttributeField().getCheckedKey();
- IDataModelAttributeOp op = getOperatorField().getCheckedKey();
- Object[] newValues = getSelectedValues();
- //
- if (att == null) {
- getValueField().clearSelectionContext();
- }
- else {
- getValueField().setSelectionContext(att, op, newValues);
- }
- }
-
- public MainBox getMainBox() {
- return (MainBox) getRootGroupBox();
- }
-
- public AttributeField getAttributeField() {
- return getRootGroupBox().getFieldByClass(AttributeField.class);
- }
-
- public OperatorField getOperatorField() {
- return getRootGroupBox().getFieldByClass(OperatorField.class);
- }
-
- public ValueField getValueField() {
- return getRootGroupBox().getFieldByClass(ValueField.class);
- }
-
- public OkButton getOkButton() {
- return getRootGroupBox().getFieldByClass(OkButton.class);
- }
-
- public CancelButton getCancelButton() {
- return getRootGroupBox().getFieldByClass(CancelButton.class);
- }
-
- @Order(1)
- public class MainBox extends AbstractGroupBox {
-
- @Override
- @ConfigPropertyValue("2")
- protected int getConfiguredGridColumnCount() {
- return 2;
- }
-
- @Order(1)
- public class SequenceBox extends AbstractSequenceBox {
-
- @Override
- protected boolean getConfiguredLabelVisible() {
- return false;
- }
-
- @Override
- protected int getConfiguredGridW() {
- return 2;
- }
-
- @Override
- protected int getConfiguredGridH() {
- return 12;
- }
-
- @Override
- protected boolean getConfiguredAutoCheckFromTo() {
- return false;
- }
-
- @Override
- protected boolean getConfiguredEqualColumnWidths() {
- return true;
- }
-
- @Order(1)
- public class AttributeField extends AbstractListBox<IDataModelAttribute> {
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("Attribute");
- }
-
- @Override
- protected String getConfiguredIconId() {
- return AbstractIcons.ComposerFieldAttribute;
- }
-
- @Override
- protected LookupRow[] execLoadTableData() throws ProcessingException {
- IDataModelAttribute[] a = getAvailableAttributes();
- ArrayList<LookupRow> list = new ArrayList<LookupRow>();
- if (a != null) {
- for (int i = 0; i < a.length; i++) {
- if (a[i].isVisible()) {
- list.add(new LookupRow(a[i], a[i].getText(), a[i].getIconId()));
- }
- }
- }
- LookupRow[] rows = new LookupRow[list.size()];
- return list.toArray(rows);
- }
-
- @Override
- protected boolean getConfiguredMandatory() {
- return true;
- }
-
- @Override
- protected boolean getConfiguredLabelVisible() {
- return false;
- }
-
- @Override
- protected int getConfiguredGridH() {
- return 12;
- }
-
- @Override
- protected void execInitField() throws ProcessingException {
- getTable().setMultiCheck(false);
- }
-
- @Override
- protected void execChangedValue() {
- // change operator set
- try {
- IDataModelAttributeOp oldOp = getOperatorField().getCheckedKey();
- getOperatorField().loadListBoxData();
- getOperatorField().checkKey(oldOp);
- if (getOperatorField().getCheckedKey() == null) {
- IDataModelAttributeOp[] ops = getOperatorField().getValue();
- if (ops != null && ops.length > 0) {
- getOperatorField().checkKey(ops[0]);
- }
- }
- }
- catch (ProcessingException e) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- // activate corresponding data field
- activateValueField();
- }
- }
-
- @Order(2)
- public class OperatorField extends AbstractListBox<IDataModelAttributeOp> {
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("Op");
- }
-
- @Override
- protected LookupRow[] execLoadTableData() throws ProcessingException {
- IDataModelAttributeOp[] ops = null;
- IDataModelAttribute att = getAttributeField().getCheckedKey();
- if (att != null) {
- ops = att.getOperators();
- }
- LookupRow[] rows = null;
- if (ops != null) {
- rows = new LookupRow[ops.length];
- for (int i = 0; i < rows.length; i++) {
- IDataModelAttributeOp id = ops[i];
- String text = ops[i].getText();
- if (text != null && text.indexOf("{0}") >= 0) {
- text = text.replace("{0}", "n");
- }
- if (text != null && text.indexOf("{1}") >= 0) {
- text = text.replace("{1}", "m");
- }
- rows[i] = new LookupRow(id, text);
- }
- }
- return rows;
- }
-
- @Override
- protected void execChangedValue() {
- // activate corresponding data field
- activateValueField();
- }
-
- @Override
- protected String getConfiguredIconId() {
- return null;
- }
-
- @Override
- protected boolean getConfiguredMandatory() {
- return true;
- }
-
- @Override
- protected boolean getConfiguredLabelVisible() {
- return false;
- }
-
- @Override
- protected int getConfiguredGridH() {
- return 12;
- }
-
- @Override
- protected void execInitField() throws ProcessingException {
- getTable().setMultiCheck(false);
- }
- }
-
- @Order(3)
- public class ValueField extends AbstractComposerValueBox {
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("Value");
- }
-
- @Override
- protected boolean getConfiguredLabelVisible() {
- return false;
- }
-
- @Override
- protected int getConfiguredGridH() {
- return 12;
- }
-
- @Override
- protected void execChangedValue() throws ProcessingException {
- IComposerValueField f = getSelectedField();
- if (f == null) {
- setSelectedValuesInternal(null);
- setSelectedDisplayValuesInternal(null);
- }
- else {
- setSelectedValuesInternal(f.getValues());
- setSelectedDisplayValuesInternal(f.getTexts());
- }
- }
- }
- }
-
- @Order(100)
- public class OkButton extends AbstractOkButton {
- }
-
- @Order(101)
- public class CancelButton extends AbstractCancelButton {
- }
- }
-
- public class NewHandler extends AbstractFormHandler {
- @Override
- protected void execLoad() throws ProcessingException {
- getAttributeField().getTable().selectFirstRow();
- getOperatorField().getTable().selectFirstRow();
- }
- }
-
- public class ModifyHandler extends AbstractFormHandler {
- @Override
- protected void execLoad() throws ProcessingException {
- }
- }
-
- public void startNew() throws ProcessingException {
- startInternal(new NewHandler());
- }
-
- public void startModify() throws ProcessingException {
- startInternal(new ModifyHandler());
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.composer.internal;
+
+import java.util.ArrayList;
+
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.form.AbstractForm;
+import org.eclipse.scout.rt.client.ui.form.AbstractFormHandler;
+import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractCancelButton;
+import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractOkButton;
+import org.eclipse.scout.rt.client.ui.form.fields.composer.AbstractComposerValueBox;
+import org.eclipse.scout.rt.client.ui.form.fields.composer.IComposerValueField;
+import org.eclipse.scout.rt.client.ui.form.fields.composer.internal.ComposerAttributeForm.MainBox.CancelButton;
+import org.eclipse.scout.rt.client.ui.form.fields.composer.internal.ComposerAttributeForm.MainBox.OkButton;
+import org.eclipse.scout.rt.client.ui.form.fields.composer.internal.ComposerAttributeForm.MainBox.SequenceBox.AttributeField;
+import org.eclipse.scout.rt.client.ui.form.fields.composer.internal.ComposerAttributeForm.MainBox.SequenceBox.OperatorField;
+import org.eclipse.scout.rt.client.ui.form.fields.composer.internal.ComposerAttributeForm.MainBox.SequenceBox.ValueField;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
+import org.eclipse.scout.rt.client.ui.form.fields.listbox.AbstractListBox;
+import org.eclipse.scout.rt.client.ui.form.fields.sequencebox.AbstractSequenceBox;
+import org.eclipse.scout.rt.shared.AbstractIcons;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.data.model.IDataModelAttribute;
+import org.eclipse.scout.rt.shared.data.model.IDataModelAttributeOp;
+import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
+import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
+import org.eclipse.scout.service.SERVICES;
+
+public class ComposerAttributeForm extends AbstractForm {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(ComposerAttributeForm.class);
+
+ private IDataModelAttribute[] m_validAttributes;
+ /**
+ * result values
+ */
+ private Object[] m_selectedValues;
+ /**
+ * result display values
+ */
+ private String[] m_selectedDisplayValues;
+
+ public ComposerAttributeForm() throws ProcessingException {
+ super();
+ }
+
+ /**
+ * form property
+ */
+ public IDataModelAttribute[] getAvailableAttributes() {
+ return m_validAttributes;
+ }
+
+ public void setAvailableAttributes(IDataModelAttribute[] a) throws ProcessingException {
+ m_validAttributes = a;
+ // single observer, reload attributes listbox
+ getAttributeField().loadListBoxData();
+ }
+
+ /**
+ * form properties
+ */
+ public Object[] getSelectedValues() {
+ return m_selectedValues;
+ }
+
+ public void setSelectedValues(Object[] o) {
+ setSelectedValuesInternal(o);
+ // single observer
+ activateValueField();
+ }
+
+ private void setSelectedValuesInternal(Object[] o) {
+ m_selectedValues = o;
+ }
+
+ public String[] getSelectedDisplayValues() {
+ return m_selectedDisplayValues;
+ }
+
+ public void setSelectedDisplayValues(String[] s) {
+ setSelectedDisplayValuesInternal(s);
+ }
+
+ private void setSelectedDisplayValuesInternal(String[] s) {
+ m_selectedDisplayValues = s;
+ }
+
+ public IDataModelAttribute getSelectedAttribute() {
+ return getAttributeField().getCheckedKey();
+ }
+
+ public void setSelectedAttribute(IDataModelAttribute a) {
+ getAttributeField().checkKey(a);
+ }
+
+ public IDataModelAttributeOp getSelectedOp() {
+ return getOperatorField().getCheckedKey();
+ }
+
+ public void setSelectedOp(IDataModelAttributeOp op) {
+ getOperatorField().checkKey(op);
+ }
+
+ @Override
+ @ConfigPropertyValue("\"ExtendedSearchAddAttribute\"")
+ protected String getConfiguredTitle() {
+ return ScoutTexts.get("ExtendedSearchAddAttribute");
+ }
+
+ /**
+ * activate value field function
+ */
+ private void activateValueField() {
+ IDataModelAttribute att = getAttributeField().getCheckedKey();
+ IDataModelAttributeOp op = getOperatorField().getCheckedKey();
+ Object[] newValues = getSelectedValues();
+ //
+ if (att == null) {
+ getValueField().clearSelectionContext();
+ }
+ else {
+ getValueField().setSelectionContext(att, op, newValues);
+ }
+ }
+
+ public MainBox getMainBox() {
+ return (MainBox) getRootGroupBox();
+ }
+
+ public AttributeField getAttributeField() {
+ return getRootGroupBox().getFieldByClass(AttributeField.class);
+ }
+
+ public OperatorField getOperatorField() {
+ return getRootGroupBox().getFieldByClass(OperatorField.class);
+ }
+
+ public ValueField getValueField() {
+ return getRootGroupBox().getFieldByClass(ValueField.class);
+ }
+
+ public OkButton getOkButton() {
+ return getRootGroupBox().getFieldByClass(OkButton.class);
+ }
+
+ public CancelButton getCancelButton() {
+ return getRootGroupBox().getFieldByClass(CancelButton.class);
+ }
+
+ @Order(1)
+ public class MainBox extends AbstractGroupBox {
+
+ @Override
+ @ConfigPropertyValue("2")
+ protected int getConfiguredGridColumnCount() {
+ return 2;
+ }
+
+ @Order(1)
+ public class SequenceBox extends AbstractSequenceBox {
+
+ @Override
+ protected boolean getConfiguredLabelVisible() {
+ return false;
+ }
+
+ @Override
+ protected int getConfiguredGridW() {
+ return 2;
+ }
+
+ @Override
+ protected int getConfiguredGridH() {
+ return 12;
+ }
+
+ @Override
+ protected boolean getConfiguredAutoCheckFromTo() {
+ return false;
+ }
+
+ @Override
+ protected boolean getConfiguredEqualColumnWidths() {
+ return true;
+ }
+
+ @Order(1)
+ public class AttributeField extends AbstractListBox<IDataModelAttribute> {
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("Attribute");
+ }
+
+ @Override
+ protected String getConfiguredIconId() {
+ return AbstractIcons.ComposerFieldAttribute;
+ }
+
+ @Override
+ protected LookupRow[] execLoadTableData() throws ProcessingException {
+ IDataModelAttribute[] a = getAvailableAttributes();
+ ArrayList<LookupRow> list = new ArrayList<LookupRow>();
+ if (a != null) {
+ for (int i = 0; i < a.length; i++) {
+ if (a[i].isVisible()) {
+ list.add(new LookupRow(a[i], a[i].getText(), a[i].getIconId()));
+ }
+ }
+ }
+ LookupRow[] rows = new LookupRow[list.size()];
+ return list.toArray(rows);
+ }
+
+ @Override
+ protected boolean getConfiguredMandatory() {
+ return true;
+ }
+
+ @Override
+ protected boolean getConfiguredLabelVisible() {
+ return false;
+ }
+
+ @Override
+ protected int getConfiguredGridH() {
+ return 12;
+ }
+
+ @Override
+ protected void execInitField() throws ProcessingException {
+ getTable().setMultiCheck(false);
+ }
+
+ @Override
+ protected void execChangedValue() {
+ // change operator set
+ try {
+ IDataModelAttributeOp oldOp = getOperatorField().getCheckedKey();
+ getOperatorField().loadListBoxData();
+ getOperatorField().checkKey(oldOp);
+ if (getOperatorField().getCheckedKey() == null) {
+ IDataModelAttributeOp[] ops = getOperatorField().getValue();
+ if (ops != null && ops.length > 0) {
+ getOperatorField().checkKey(ops[0]);
+ }
+ }
+ }
+ catch (ProcessingException e) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ // activate corresponding data field
+ activateValueField();
+ }
+ }
+
+ @Order(2)
+ public class OperatorField extends AbstractListBox<IDataModelAttributeOp> {
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("Op");
+ }
+
+ @Override
+ protected LookupRow[] execLoadTableData() throws ProcessingException {
+ IDataModelAttributeOp[] ops = null;
+ IDataModelAttribute att = getAttributeField().getCheckedKey();
+ if (att != null) {
+ ops = att.getOperators();
+ }
+ LookupRow[] rows = null;
+ if (ops != null) {
+ rows = new LookupRow[ops.length];
+ for (int i = 0; i < rows.length; i++) {
+ IDataModelAttributeOp id = ops[i];
+ String text = ops[i].getText();
+ if (text != null && text.indexOf("{0}") >= 0) {
+ text = text.replace("{0}", "n");
+ }
+ if (text != null && text.indexOf("{1}") >= 0) {
+ text = text.replace("{1}", "m");
+ }
+ rows[i] = new LookupRow(id, text);
+ }
+ }
+ return rows;
+ }
+
+ @Override
+ protected void execChangedValue() {
+ // activate corresponding data field
+ activateValueField();
+ }
+
+ @Override
+ protected String getConfiguredIconId() {
+ return null;
+ }
+
+ @Override
+ protected boolean getConfiguredMandatory() {
+ return true;
+ }
+
+ @Override
+ protected boolean getConfiguredLabelVisible() {
+ return false;
+ }
+
+ @Override
+ protected int getConfiguredGridH() {
+ return 12;
+ }
+
+ @Override
+ protected void execInitField() throws ProcessingException {
+ getTable().setMultiCheck(false);
+ }
+ }
+
+ @Order(3)
+ public class ValueField extends AbstractComposerValueBox {
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("Value");
+ }
+
+ @Override
+ protected boolean getConfiguredLabelVisible() {
+ return false;
+ }
+
+ @Override
+ protected int getConfiguredGridH() {
+ return 12;
+ }
+
+ @Override
+ protected void execChangedValue() throws ProcessingException {
+ IComposerValueField f = getSelectedField();
+ if (f == null) {
+ setSelectedValuesInternal(null);
+ setSelectedDisplayValuesInternal(null);
+ }
+ else {
+ setSelectedValuesInternal(f.getValues());
+ setSelectedDisplayValuesInternal(f.getTexts());
+ }
+ }
+ }
+ }
+
+ @Order(100)
+ public class OkButton extends AbstractOkButton {
+ }
+
+ @Order(101)
+ public class CancelButton extends AbstractCancelButton {
+ }
+ }
+
+ public class NewHandler extends AbstractFormHandler {
+ @Override
+ protected void execLoad() throws ProcessingException {
+ getAttributeField().getTable().selectFirstRow();
+ getOperatorField().getTable().selectFirstRow();
+ }
+ }
+
+ public class ModifyHandler extends AbstractFormHandler {
+ @Override
+ protected void execLoad() throws ProcessingException {
+ }
+ }
+
+ public void startNew() throws ProcessingException {
+ startInternal(new NewHandler());
+ }
+
+ public void startModify() throws ProcessingException {
+ startInternal(new ModifyHandler());
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/internal/ComposerDisplayTextBuilder.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/internal/ComposerDisplayTextBuilder.java
index 8f46c76b09..7b2ae59641 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/internal/ComposerDisplayTextBuilder.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/internal/ComposerDisplayTextBuilder.java
@@ -1,76 +1,76 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.composer.internal;
-
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
-import org.eclipse.scout.rt.client.ui.form.fields.composer.node.AttributeNode;
-import org.eclipse.scout.rt.client.ui.form.fields.composer.node.EitherOrNode;
-import org.eclipse.scout.rt.client.ui.form.fields.composer.node.EntityNode;
-
-public class ComposerDisplayTextBuilder {
-
- public ComposerDisplayTextBuilder() {
- }
-
- public void build(ITreeNode node, StringBuffer buf, String prefix) {
- visitAndNodes(node.getChildNodes(), buf, prefix);
- }
-
- private void visitAndNodes(ITreeNode[] nodes, StringBuffer buf, String prefix) {
- int i = 0;
- while (i < nodes.length) {
- if (nodes[i] instanceof EntityNode) {
- visitEntityNode((EntityNode) nodes[i], buf, prefix);
- i++;
- }
- else if (nodes[i] instanceof AttributeNode) {
- visitAttributeNode((AttributeNode) nodes[i], buf, prefix);
- i++;
- }
- else if (nodes[i] instanceof EitherOrNode) {
- int k = i;
- while (k + 1 < nodes.length && (nodes[k + 1] instanceof EitherOrNode) && !((EitherOrNode) nodes[k + 1]).isBeginOfEitherOr()) {
- k++;
- }
- EitherOrNode[] eNodes = new EitherOrNode[k - i + 1];
- System.arraycopy(nodes, i, eNodes, 0, eNodes.length);
- visitOrNodes(eNodes, buf, prefix);
- i = k + 1;
- }
- }
- }
-
- private void visitOrNodes(EitherOrNode[] nodes, StringBuffer buf, String prefix) {
- for (EitherOrNode node : nodes) {
- buf.append(prefix);
- buf.append(node.getCell().getText());
- buf.append("\n");
- // add children
- visitAndNodes(node.getChildNodes(), buf, prefix + " ");
- }
- }
-
- private void visitEntityNode(EntityNode node, StringBuffer buf, String prefix) {
- buf.append(prefix);
- buf.append(node.getCell().getText());
- buf.append("\n");
- // add children
- visitAndNodes(node.getChildNodes(), buf, prefix + " ");
- }
-
- private void visitAttributeNode(AttributeNode node, StringBuffer buf, String prefix) {
- buf.append(prefix);
- buf.append(node.getCell().getText());
- buf.append("\n");
- // add children
- visitAndNodes(node.getChildNodes(), buf, prefix + " ");
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.composer.internal;
+
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
+import org.eclipse.scout.rt.client.ui.form.fields.composer.node.AttributeNode;
+import org.eclipse.scout.rt.client.ui.form.fields.composer.node.EitherOrNode;
+import org.eclipse.scout.rt.client.ui.form.fields.composer.node.EntityNode;
+
+public class ComposerDisplayTextBuilder {
+
+ public ComposerDisplayTextBuilder() {
+ }
+
+ public void build(ITreeNode node, StringBuffer buf, String prefix) {
+ visitAndNodes(node.getChildNodes(), buf, prefix);
+ }
+
+ private void visitAndNodes(ITreeNode[] nodes, StringBuffer buf, String prefix) {
+ int i = 0;
+ while (i < nodes.length) {
+ if (nodes[i] instanceof EntityNode) {
+ visitEntityNode((EntityNode) nodes[i], buf, prefix);
+ i++;
+ }
+ else if (nodes[i] instanceof AttributeNode) {
+ visitAttributeNode((AttributeNode) nodes[i], buf, prefix);
+ i++;
+ }
+ else if (nodes[i] instanceof EitherOrNode) {
+ int k = i;
+ while (k + 1 < nodes.length && (nodes[k + 1] instanceof EitherOrNode) && !((EitherOrNode) nodes[k + 1]).isBeginOfEitherOr()) {
+ k++;
+ }
+ EitherOrNode[] eNodes = new EitherOrNode[k - i + 1];
+ System.arraycopy(nodes, i, eNodes, 0, eNodes.length);
+ visitOrNodes(eNodes, buf, prefix);
+ i = k + 1;
+ }
+ }
+ }
+
+ private void visitOrNodes(EitherOrNode[] nodes, StringBuffer buf, String prefix) {
+ for (EitherOrNode node : nodes) {
+ buf.append(prefix);
+ buf.append(node.getCell().getText());
+ buf.append("\n");
+ // add children
+ visitAndNodes(node.getChildNodes(), buf, prefix + " ");
+ }
+ }
+
+ private void visitEntityNode(EntityNode node, StringBuffer buf, String prefix) {
+ buf.append(prefix);
+ buf.append(node.getCell().getText());
+ buf.append("\n");
+ // add children
+ visitAndNodes(node.getChildNodes(), buf, prefix + " ");
+ }
+
+ private void visitAttributeNode(AttributeNode node, StringBuffer buf, String prefix) {
+ buf.append(prefix);
+ buf.append(node.getCell().getText());
+ buf.append("\n");
+ // add children
+ visitAndNodes(node.getChildNodes(), buf, prefix + " ");
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/internal/LegacyComposerStatementBuilder.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/internal/LegacyComposerStatementBuilder.java
index 37a181abd7..e2de265a08 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/internal/LegacyComposerStatementBuilder.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/internal/LegacyComposerStatementBuilder.java
@@ -1,233 +1,233 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.composer.internal;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.StringUtility.ITagProcessor;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
-import org.eclipse.scout.rt.client.ui.form.fields.composer.attribute.AbstractComposerAttribute;
-import org.eclipse.scout.rt.client.ui.form.fields.composer.entity.AbstractComposerEntity;
-import org.eclipse.scout.rt.client.ui.form.fields.composer.node.AttributeNode;
-import org.eclipse.scout.rt.client.ui.form.fields.composer.node.EitherOrNode;
-import org.eclipse.scout.rt.client.ui.form.fields.composer.node.EntityNode;
-import org.eclipse.scout.rt.shared.services.common.jdbc.LegacySearchFilter;
-
-/**
- * @deprecated processing logic belongs to server
- */
-@Deprecated
-@SuppressWarnings("deprecation")
-public class LegacyComposerStatementBuilder {
- private final Map<String, Object> m_bindMap;
- private Map<String, LegacySearchFilter.ComposerAttributeRef> m_attributeRefMap;
- private long m_bindSeqNo = 0;
-
- /**
- * @param bindMap
- * out parameter containing all necessary binds used in the created
- * statement
- */
- public LegacyComposerStatementBuilder(Map<String, Object> bindMap) {
- m_bindMap = bindMap;
- }
-
- public LegacySearchFilter.ComposerConstraint build(ITreeNode node) {
- m_attributeRefMap = new HashMap<String, LegacySearchFilter.ComposerAttributeRef>();
- String s = visitAndNodes(node.getChildNodes());
- return new LegacySearchFilter.ComposerConstraint(s, m_attributeRefMap);
- }
-
- private String visitAndNodes(ITreeNode[] nodes) {
- StringBuilder buf = new StringBuilder();
- int count = 0;
- int i = 0;
- while (i < nodes.length) {
- String s = null;
- if (nodes[i] instanceof EntityNode) {
- s = visitEntityNode((EntityNode) nodes[i]);
- i++;
- }
- else if (nodes[i] instanceof AttributeNode) {
- s = visitAttributeNode((AttributeNode) nodes[i]);
- i++;
- }
- else if (nodes[i] instanceof EitherOrNode) {
- int k = i;
- while (k + 1 < nodes.length && (nodes[k + 1] instanceof EitherOrNode) && !((EitherOrNode) nodes[k + 1]).isBeginOfEitherOr()) {
- k++;
- }
- EitherOrNode[] eNodes = new EitherOrNode[k - i + 1];
- System.arraycopy(nodes, i, eNodes, 0, eNodes.length);
- s = visitOrNodes(eNodes);
- i = k + 1;
- }
- if (s != null) {
- if (count > 0) {
- buf.append(" AND ");
- }
- buf.append(s);
- count++;
- }
- }
- if (count > 0) {
- return buf.toString();
- }
- else {
- return null;
- }
- }
-
- private String visitOrNodes(EitherOrNode[] nodes) {
- // check if only one condition
- StringBuilder buf = new StringBuilder();
- int count = 0;
- for (EitherOrNode node : nodes) {
- String s = visitAndNodes(node.getChildNodes());
- if (s != null) {
- if (count > 0) {
- buf.append(" OR ");
- if (node.isNegative()) {
- buf.append(" NOT ");
- }
- }
- buf.append("(");
- buf.append(s);
- buf.append(")");
- count++;
- }
- }
- if (count > 0) {
- if (count > 1) {
- buf.insert(0, "(");
- buf.append(")");
- return buf.toString();
- }
- else {
- String s = buf.toString();
- if (s.matches("\\(.*\\)")) {
- return s.substring(1, s.length() - 1).trim();
- }
- else {
- return s;
- }
- }
- }
- else {
- return null;
- }
- }
-
- private String visitEntityNode(EntityNode node) {
- String stm = ((AbstractComposerEntity) node.getEntity()).getLegacyStatement();
- if (stm == null) {
- stm = "";
- }
- // negation
- if (node.isNegative()) {
- stm = "NOT " + stm;
- }
- // add children
- String s = visitAndNodes(node.getChildNodes());
- if (s != null) {
- s = " AND " + s;
- }
- if (stm.indexOf("<attributes/>") >= 0) {
- stm = StringUtility.replace(stm, "<attributes/>", s);
- }
- else if (stm.indexOf("#W#") >= 0) {
- // legacy
- stm = StringUtility.replace(stm, "#W#", s);
- }
- else if (s != null) {
- stm = stm + s;
- }
- if (stm.length() > 0) {
- return stm;
- }
- else {
- return null;
- }
- }
-
- private String visitAttributeNode(final AttributeNode node) {
- String originalStatement = ((AbstractComposerAttribute) node.getAttribute()).getLegacyStatement();
- if (originalStatement == null) {
- originalStatement = "";
- }
- // replace the S in the string by the generated unique bind name
- final Map<String, String> bindTranslationTable = localizeBindNames("S");
- String stm = localizeStatement(originalStatement, bindTranslationTable);
- if (!stm.equals(originalStatement)) {
- // the attribute was of the form: P.PNAME = #S# (contains references to S)
- // this is legacy and is not supported for attribute decoration
- m_bindMap.put(bindTranslationTable.get("S"), node.getValues() != null && node.getValues().length > 0 ? node.getValues()[0] : null);
- return stm;
- }
- else {
- // the attribute was of the form: P.PNAME or
- // <attribute>P.PNAME</attribute>
- // make sure there is an attribute tag in the string, if none enclose all
- // by default
- if (stm.indexOf("<attribute>") < 0) {
- stm = "<attribute>" + stm + "</attribute>";
- }
- // tag replacement
- ITagProcessor processor = new ITagProcessor() {
- @Override
- public String processTag(String tagName, String attribute) {
- String key = "${attribute" + getNextBindSeqNo() + "}";
- m_attributeRefMap.put(key, new LegacySearchFilter.ComposerAttributeRef(node.getOp().getOperator(), attribute, bindTranslationTable.get("S"), node.getValues() != null && node.getValues().length > 0 ? node.getValues()[0] : null));
- return key;
- }
- };
- return StringUtility.replaceTags(stm, "attribute", processor);
- }
- }
-
- private long getNextBindSeqNo() {
- return m_bindSeqNo++;
- }
-
- /**
- * Replace all bind names by unique bind names so that this statement parts
- * bind names are not conflicting with other parts that use the same statement
- * part. For example S is replaces by __S123.
- */
- private Map<String, String> localizeBindNames(String... bindNames) {
- HashMap<String, String> map = new HashMap<String, String>();
- if (bindNames != null) {
- for (String bindName : bindNames) {
- String locName = "__" + bindName + getNextBindSeqNo();
- map.put(bindName, locName);
- }
- }
- return map;
- }
-
- /**
- * Replace all bind names by localized bind names
- */
- private String localizeStatement(String stm, Map<String, String> bindTranslationTable) {
- for (Map.Entry<String, String> e : bindTranslationTable.entrySet()) {
- String oldName = e.getKey();
- String newName = e.getValue();
- stm = stm.replaceAll("#" + oldName + "#", "#" + newName + "#");
- stm = stm.replaceAll("\\&" + oldName + "\\&", "&" + newName + "&");
- stm = stm.replaceAll(":" + oldName + "([^A-Za-z0-9])", ":" + newName + "$1");
- stm = stm.replaceAll(":" + oldName + "$", ":" + newName);
- }
- return stm;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.composer.internal;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.StringUtility.ITagProcessor;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
+import org.eclipse.scout.rt.client.ui.form.fields.composer.attribute.AbstractComposerAttribute;
+import org.eclipse.scout.rt.client.ui.form.fields.composer.entity.AbstractComposerEntity;
+import org.eclipse.scout.rt.client.ui.form.fields.composer.node.AttributeNode;
+import org.eclipse.scout.rt.client.ui.form.fields.composer.node.EitherOrNode;
+import org.eclipse.scout.rt.client.ui.form.fields.composer.node.EntityNode;
+import org.eclipse.scout.rt.shared.services.common.jdbc.LegacySearchFilter;
+
+/**
+ * @deprecated processing logic belongs to server
+ */
+@Deprecated
+@SuppressWarnings("deprecation")
+public class LegacyComposerStatementBuilder {
+ private final Map<String, Object> m_bindMap;
+ private Map<String, LegacySearchFilter.ComposerAttributeRef> m_attributeRefMap;
+ private long m_bindSeqNo = 0;
+
+ /**
+ * @param bindMap
+ * out parameter containing all necessary binds used in the created
+ * statement
+ */
+ public LegacyComposerStatementBuilder(Map<String, Object> bindMap) {
+ m_bindMap = bindMap;
+ }
+
+ public LegacySearchFilter.ComposerConstraint build(ITreeNode node) {
+ m_attributeRefMap = new HashMap<String, LegacySearchFilter.ComposerAttributeRef>();
+ String s = visitAndNodes(node.getChildNodes());
+ return new LegacySearchFilter.ComposerConstraint(s, m_attributeRefMap);
+ }
+
+ private String visitAndNodes(ITreeNode[] nodes) {
+ StringBuilder buf = new StringBuilder();
+ int count = 0;
+ int i = 0;
+ while (i < nodes.length) {
+ String s = null;
+ if (nodes[i] instanceof EntityNode) {
+ s = visitEntityNode((EntityNode) nodes[i]);
+ i++;
+ }
+ else if (nodes[i] instanceof AttributeNode) {
+ s = visitAttributeNode((AttributeNode) nodes[i]);
+ i++;
+ }
+ else if (nodes[i] instanceof EitherOrNode) {
+ int k = i;
+ while (k + 1 < nodes.length && (nodes[k + 1] instanceof EitherOrNode) && !((EitherOrNode) nodes[k + 1]).isBeginOfEitherOr()) {
+ k++;
+ }
+ EitherOrNode[] eNodes = new EitherOrNode[k - i + 1];
+ System.arraycopy(nodes, i, eNodes, 0, eNodes.length);
+ s = visitOrNodes(eNodes);
+ i = k + 1;
+ }
+ if (s != null) {
+ if (count > 0) {
+ buf.append(" AND ");
+ }
+ buf.append(s);
+ count++;
+ }
+ }
+ if (count > 0) {
+ return buf.toString();
+ }
+ else {
+ return null;
+ }
+ }
+
+ private String visitOrNodes(EitherOrNode[] nodes) {
+ // check if only one condition
+ StringBuilder buf = new StringBuilder();
+ int count = 0;
+ for (EitherOrNode node : nodes) {
+ String s = visitAndNodes(node.getChildNodes());
+ if (s != null) {
+ if (count > 0) {
+ buf.append(" OR ");
+ if (node.isNegative()) {
+ buf.append(" NOT ");
+ }
+ }
+ buf.append("(");
+ buf.append(s);
+ buf.append(")");
+ count++;
+ }
+ }
+ if (count > 0) {
+ if (count > 1) {
+ buf.insert(0, "(");
+ buf.append(")");
+ return buf.toString();
+ }
+ else {
+ String s = buf.toString();
+ if (s.matches("\\(.*\\)")) {
+ return s.substring(1, s.length() - 1).trim();
+ }
+ else {
+ return s;
+ }
+ }
+ }
+ else {
+ return null;
+ }
+ }
+
+ private String visitEntityNode(EntityNode node) {
+ String stm = ((AbstractComposerEntity) node.getEntity()).getLegacyStatement();
+ if (stm == null) {
+ stm = "";
+ }
+ // negation
+ if (node.isNegative()) {
+ stm = "NOT " + stm;
+ }
+ // add children
+ String s = visitAndNodes(node.getChildNodes());
+ if (s != null) {
+ s = " AND " + s;
+ }
+ if (stm.indexOf("<attributes/>") >= 0) {
+ stm = StringUtility.replace(stm, "<attributes/>", s);
+ }
+ else if (stm.indexOf("#W#") >= 0) {
+ // legacy
+ stm = StringUtility.replace(stm, "#W#", s);
+ }
+ else if (s != null) {
+ stm = stm + s;
+ }
+ if (stm.length() > 0) {
+ return stm;
+ }
+ else {
+ return null;
+ }
+ }
+
+ private String visitAttributeNode(final AttributeNode node) {
+ String originalStatement = ((AbstractComposerAttribute) node.getAttribute()).getLegacyStatement();
+ if (originalStatement == null) {
+ originalStatement = "";
+ }
+ // replace the S in the string by the generated unique bind name
+ final Map<String, String> bindTranslationTable = localizeBindNames("S");
+ String stm = localizeStatement(originalStatement, bindTranslationTable);
+ if (!stm.equals(originalStatement)) {
+ // the attribute was of the form: P.PNAME = #S# (contains references to S)
+ // this is legacy and is not supported for attribute decoration
+ m_bindMap.put(bindTranslationTable.get("S"), node.getValues() != null && node.getValues().length > 0 ? node.getValues()[0] : null);
+ return stm;
+ }
+ else {
+ // the attribute was of the form: P.PNAME or
+ // <attribute>P.PNAME</attribute>
+ // make sure there is an attribute tag in the string, if none enclose all
+ // by default
+ if (stm.indexOf("<attribute>") < 0) {
+ stm = "<attribute>" + stm + "</attribute>";
+ }
+ // tag replacement
+ ITagProcessor processor = new ITagProcessor() {
+ @Override
+ public String processTag(String tagName, String attribute) {
+ String key = "${attribute" + getNextBindSeqNo() + "}";
+ m_attributeRefMap.put(key, new LegacySearchFilter.ComposerAttributeRef(node.getOp().getOperator(), attribute, bindTranslationTable.get("S"), node.getValues() != null && node.getValues().length > 0 ? node.getValues()[0] : null));
+ return key;
+ }
+ };
+ return StringUtility.replaceTags(stm, "attribute", processor);
+ }
+ }
+
+ private long getNextBindSeqNo() {
+ return m_bindSeqNo++;
+ }
+
+ /**
+ * Replace all bind names by unique bind names so that this statement parts
+ * bind names are not conflicting with other parts that use the same statement
+ * part. For example S is replaces by __S123.
+ */
+ private Map<String, String> localizeBindNames(String... bindNames) {
+ HashMap<String, String> map = new HashMap<String, String>();
+ if (bindNames != null) {
+ for (String bindName : bindNames) {
+ String locName = "__" + bindName + getNextBindSeqNo();
+ map.put(bindName, locName);
+ }
+ }
+ return map;
+ }
+
+ /**
+ * Replace all bind names by localized bind names
+ */
+ private String localizeStatement(String stm, Map<String, String> bindTranslationTable) {
+ for (Map.Entry<String, String> e : bindTranslationTable.entrySet()) {
+ String oldName = e.getKey();
+ String newName = e.getValue();
+ stm = stm.replaceAll("#" + oldName + "#", "#" + newName + "#");
+ stm = stm.replaceAll("\\&" + oldName + "\\&", "&" + newName + "&");
+ stm = stm.replaceAll(":" + oldName + "([^A-Za-z0-9])", ":" + newName + "$1");
+ stm = stm.replaceAll(":" + oldName + "$", ":" + newName);
+ }
+ return stm;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/internal/TokenBasedComposerStatementBuilder.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/internal/TokenBasedComposerStatementBuilder.java
index f09f4a6967..7807bc0e4e 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/internal/TokenBasedComposerStatementBuilder.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/internal/TokenBasedComposerStatementBuilder.java
@@ -1,119 +1,119 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.composer.internal;
-
-import org.eclipse.scout.rt.client.services.common.search.TokenBasedSearchFilterService;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
-import org.eclipse.scout.rt.client.ui.form.fields.composer.attribute.AbstractComposerAttribute;
-import org.eclipse.scout.rt.client.ui.form.fields.composer.entity.AbstractComposerEntity;
-import org.eclipse.scout.rt.client.ui.form.fields.composer.node.AttributeNode;
-import org.eclipse.scout.rt.client.ui.form.fields.composer.node.EitherOrNode;
-import org.eclipse.scout.rt.client.ui.form.fields.composer.node.EntityNode;
-import org.eclipse.scout.rt.shared.services.common.jdbc.TokenBasedSearchFilter.AndNodeToken;
-import org.eclipse.scout.rt.shared.services.common.jdbc.TokenBasedSearchFilter.AttributeNodeToken;
-import org.eclipse.scout.rt.shared.services.common.jdbc.TokenBasedSearchFilter.EntityNodeToken;
-import org.eclipse.scout.rt.shared.services.common.jdbc.TokenBasedSearchFilter.OrNodeToken;
-import org.eclipse.scout.rt.shared.services.common.jdbc.TokenBasedSearchFilter.TreeNodeToken;
-
-@SuppressWarnings("deprecation")
-public class TokenBasedComposerStatementBuilder {
-
- TokenBasedSearchFilterService m_service;
-
- public TokenBasedComposerStatementBuilder(TokenBasedSearchFilterService service) {
- m_service = service;
- }
-
- public AndNodeToken build(ITreeNode node) {
- AndNodeToken rootTok = new AndNodeToken();
- visitAndNodes(rootTok, node.getChildNodes());
- return rootTok;
- }
-
- private void visitAndNodes(TreeNodeToken parentTok, ITreeNode[] nodes) {
- int i = 0;
- while (i < nodes.length) {
- if (nodes[i] instanceof EntityNode) {
- EntityNodeToken eTok = visitEntityNode((EntityNode) nodes[i]);
- if (eTok != null) {
- parentTok.addChild(eTok);
- }
- i++;
- }
- else if (nodes[i] instanceof AttributeNode) {
- AttributeNodeToken aTok = visitAttributeNode((AttributeNode) nodes[i]);
- if (aTok != null) {
- parentTok.addChild(aTok);
- }
- i++;
- }
- else if (nodes[i] instanceof EitherOrNode) {
- int k = i;
- while (k + 1 < nodes.length && (nodes[k + 1] instanceof EitherOrNode) && !((EitherOrNode) nodes[k + 1]).isBeginOfEitherOr()) {
- k++;
- }
- EitherOrNode[] eNodes = new EitherOrNode[k - i + 1];
- System.arraycopy(nodes, i, eNodes, 0, eNodes.length);
- OrNodeToken orTok = new OrNodeToken();
- visitOrNodes(orTok, eNodes);
- if (orTok.getChildren().size() >= 2) {
- parentTok.addChild(orTok);
- }
- else if (orTok.getChildren().size() == 1) {
- parentTok.addChild(orTok.getChildren().get(0));
- }
- i = k + 1;
- }
- }
- }
-
- private void visitOrNodes(TreeNodeToken parentTok, EitherOrNode[] nodes) {
- // check if only one condition
- for (EitherOrNode node : nodes) {
- AndNodeToken andTok = new AndNodeToken();
- visitAndNodes(andTok, node.getChildNodes());
- if (andTok.getChildren().size() >= 2) {
- andTok.setNegative(node.isNegative());
- parentTok.addChild(andTok);
- }
- else if (andTok.getChildren().size() == 1) {
- TreeNodeToken firstTok = andTok.getChildren().get(0);
- firstTok.setNegative(node.isNegative());
- parentTok.addChild(firstTok);
- }
- }
- }
-
- private EntityNodeToken visitEntityNode(EntityNode node) {
- Integer tokenId = m_service.resolveTokenIdByClass(((AbstractComposerEntity) node.getEntity()).getClass());
- if (tokenId == null) {
- return null;
- }
- EntityNodeToken eTok = new EntityNodeToken(tokenId);
- eTok.setNegative(node.isNegative());
- // add children
- AndNodeToken andTok = new AndNodeToken();
- visitAndNodes(andTok, node.getChildNodes());
- if (andTok.getChildren().size() > 0) {
- eTok.addChild(andTok);
- }
- return eTok;
- }
-
- private AttributeNodeToken visitAttributeNode(AttributeNode node) {
- Integer tokenId = m_service.resolveTokenIdByClass(((AbstractComposerAttribute) node.getAttribute()).getClass());
- if (tokenId == null) {
- return null;
- }
- AttributeNodeToken aTok = new AttributeNodeToken(tokenId, node.getOp().getOperator(), node.getValues());
- return aTok;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.composer.internal;
+
+import org.eclipse.scout.rt.client.services.common.search.TokenBasedSearchFilterService;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
+import org.eclipse.scout.rt.client.ui.form.fields.composer.attribute.AbstractComposerAttribute;
+import org.eclipse.scout.rt.client.ui.form.fields.composer.entity.AbstractComposerEntity;
+import org.eclipse.scout.rt.client.ui.form.fields.composer.node.AttributeNode;
+import org.eclipse.scout.rt.client.ui.form.fields.composer.node.EitherOrNode;
+import org.eclipse.scout.rt.client.ui.form.fields.composer.node.EntityNode;
+import org.eclipse.scout.rt.shared.services.common.jdbc.TokenBasedSearchFilter.AndNodeToken;
+import org.eclipse.scout.rt.shared.services.common.jdbc.TokenBasedSearchFilter.AttributeNodeToken;
+import org.eclipse.scout.rt.shared.services.common.jdbc.TokenBasedSearchFilter.EntityNodeToken;
+import org.eclipse.scout.rt.shared.services.common.jdbc.TokenBasedSearchFilter.OrNodeToken;
+import org.eclipse.scout.rt.shared.services.common.jdbc.TokenBasedSearchFilter.TreeNodeToken;
+
+@SuppressWarnings("deprecation")
+public class TokenBasedComposerStatementBuilder {
+
+ TokenBasedSearchFilterService m_service;
+
+ public TokenBasedComposerStatementBuilder(TokenBasedSearchFilterService service) {
+ m_service = service;
+ }
+
+ public AndNodeToken build(ITreeNode node) {
+ AndNodeToken rootTok = new AndNodeToken();
+ visitAndNodes(rootTok, node.getChildNodes());
+ return rootTok;
+ }
+
+ private void visitAndNodes(TreeNodeToken parentTok, ITreeNode[] nodes) {
+ int i = 0;
+ while (i < nodes.length) {
+ if (nodes[i] instanceof EntityNode) {
+ EntityNodeToken eTok = visitEntityNode((EntityNode) nodes[i]);
+ if (eTok != null) {
+ parentTok.addChild(eTok);
+ }
+ i++;
+ }
+ else if (nodes[i] instanceof AttributeNode) {
+ AttributeNodeToken aTok = visitAttributeNode((AttributeNode) nodes[i]);
+ if (aTok != null) {
+ parentTok.addChild(aTok);
+ }
+ i++;
+ }
+ else if (nodes[i] instanceof EitherOrNode) {
+ int k = i;
+ while (k + 1 < nodes.length && (nodes[k + 1] instanceof EitherOrNode) && !((EitherOrNode) nodes[k + 1]).isBeginOfEitherOr()) {
+ k++;
+ }
+ EitherOrNode[] eNodes = new EitherOrNode[k - i + 1];
+ System.arraycopy(nodes, i, eNodes, 0, eNodes.length);
+ OrNodeToken orTok = new OrNodeToken();
+ visitOrNodes(orTok, eNodes);
+ if (orTok.getChildren().size() >= 2) {
+ parentTok.addChild(orTok);
+ }
+ else if (orTok.getChildren().size() == 1) {
+ parentTok.addChild(orTok.getChildren().get(0));
+ }
+ i = k + 1;
+ }
+ }
+ }
+
+ private void visitOrNodes(TreeNodeToken parentTok, EitherOrNode[] nodes) {
+ // check if only one condition
+ for (EitherOrNode node : nodes) {
+ AndNodeToken andTok = new AndNodeToken();
+ visitAndNodes(andTok, node.getChildNodes());
+ if (andTok.getChildren().size() >= 2) {
+ andTok.setNegative(node.isNegative());
+ parentTok.addChild(andTok);
+ }
+ else if (andTok.getChildren().size() == 1) {
+ TreeNodeToken firstTok = andTok.getChildren().get(0);
+ firstTok.setNegative(node.isNegative());
+ parentTok.addChild(firstTok);
+ }
+ }
+ }
+
+ private EntityNodeToken visitEntityNode(EntityNode node) {
+ Integer tokenId = m_service.resolveTokenIdByClass(((AbstractComposerEntity) node.getEntity()).getClass());
+ if (tokenId == null) {
+ return null;
+ }
+ EntityNodeToken eTok = new EntityNodeToken(tokenId);
+ eTok.setNegative(node.isNegative());
+ // add children
+ AndNodeToken andTok = new AndNodeToken();
+ visitAndNodes(andTok, node.getChildNodes());
+ if (andTok.getChildren().size() > 0) {
+ eTok.addChild(andTok);
+ }
+ return eTok;
+ }
+
+ private AttributeNodeToken visitAttributeNode(AttributeNode node) {
+ Integer tokenId = m_service.resolveTokenIdByClass(((AbstractComposerAttribute) node.getAttribute()).getClass());
+ if (tokenId == null) {
+ return null;
+ }
+ AttributeNodeToken aTok = new AttributeNodeToken(tokenId, node.getOp().getOperator(), node.getValues());
+ return aTok;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/node/AbstractAddAttributeMenu.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/node/AbstractAddAttributeMenu.java
index 28e206fc00..cce5996197 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/node/AbstractAddAttributeMenu.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/node/AbstractAddAttributeMenu.java
@@ -1,88 +1,88 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.composer.node;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
-import org.eclipse.scout.rt.client.ui.form.fields.composer.IComposerField;
-import org.eclipse.scout.rt.client.ui.form.fields.composer.internal.ComposerAttributeForm;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.data.model.IDataModelAttribute;
-import org.eclipse.scout.rt.shared.data.model.IDataModelAttributeOp;
-
-public abstract class AbstractAddAttributeMenu extends AbstractMenu {
- private final IComposerField m_field;
- private final ITreeNode m_parentNode;
-
- public AbstractAddAttributeMenu(IComposerField field, ITreeNode parentNode) {
- super(false);
- m_field = field;
- m_parentNode = parentNode;
- callInitializer();
- }
-
- @Override
- protected String getConfiguredText() {
- return ScoutTexts.get("ExtendedSearchAddAttributeMenu");
- }
-
- @Override
- protected void execPrepareAction() throws ProcessingException {
- EntityNode eNode = null;
- ITreeNode n = m_parentNode;
- while (n != null) {
- if (n instanceof EntityNode) {
- eNode = (EntityNode) n;
- break;
- }
- n = n.getParentNode();
- }
- IDataModelAttribute[] atts;
- if (eNode != null) {
- atts = eNode.getEntity().getAttributes();
- }
- else {
- atts = m_field.getAttributes();
- }
- setVisible(atts.length > 0);
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- ComposerAttributeForm form = new ComposerAttributeForm();
- EntityNode eNode = null;
- ITreeNode n = m_parentNode;
- while (n != null) {
- if (n instanceof EntityNode) {
- eNode = (EntityNode) n;
- break;
- }
- n = n.getParentNode();
- }
- if (eNode != null) {
- form.setAvailableAttributes(eNode.getEntity().getAttributes());
- }
- else {
- form.setAvailableAttributes(m_field.getAttributes());
- }
- form.startNew();
- form.waitFor();
- if (form.isFormStored()) {
- IDataModelAttribute a = form.getSelectedAttribute();
- IDataModelAttributeOp op = form.getSelectedOp();
- Object[] values = form.getSelectedValues();
- String[] displayValues = form.getSelectedDisplayValues();
- m_field.addAttributeNode(m_parentNode, a, null, op, values, displayValues);
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.composer.node;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
+import org.eclipse.scout.rt.client.ui.form.fields.composer.IComposerField;
+import org.eclipse.scout.rt.client.ui.form.fields.composer.internal.ComposerAttributeForm;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.data.model.IDataModelAttribute;
+import org.eclipse.scout.rt.shared.data.model.IDataModelAttributeOp;
+
+public abstract class AbstractAddAttributeMenu extends AbstractMenu {
+ private final IComposerField m_field;
+ private final ITreeNode m_parentNode;
+
+ public AbstractAddAttributeMenu(IComposerField field, ITreeNode parentNode) {
+ super(false);
+ m_field = field;
+ m_parentNode = parentNode;
+ callInitializer();
+ }
+
+ @Override
+ protected String getConfiguredText() {
+ return ScoutTexts.get("ExtendedSearchAddAttributeMenu");
+ }
+
+ @Override
+ protected void execPrepareAction() throws ProcessingException {
+ EntityNode eNode = null;
+ ITreeNode n = m_parentNode;
+ while (n != null) {
+ if (n instanceof EntityNode) {
+ eNode = (EntityNode) n;
+ break;
+ }
+ n = n.getParentNode();
+ }
+ IDataModelAttribute[] atts;
+ if (eNode != null) {
+ atts = eNode.getEntity().getAttributes();
+ }
+ else {
+ atts = m_field.getAttributes();
+ }
+ setVisible(atts.length > 0);
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ ComposerAttributeForm form = new ComposerAttributeForm();
+ EntityNode eNode = null;
+ ITreeNode n = m_parentNode;
+ while (n != null) {
+ if (n instanceof EntityNode) {
+ eNode = (EntityNode) n;
+ break;
+ }
+ n = n.getParentNode();
+ }
+ if (eNode != null) {
+ form.setAvailableAttributes(eNode.getEntity().getAttributes());
+ }
+ else {
+ form.setAvailableAttributes(m_field.getAttributes());
+ }
+ form.startNew();
+ form.waitFor();
+ if (form.isFormStored()) {
+ IDataModelAttribute a = form.getSelectedAttribute();
+ IDataModelAttributeOp op = form.getSelectedOp();
+ Object[] values = form.getSelectedValues();
+ String[] displayValues = form.getSelectedDisplayValues();
+ m_field.addAttributeNode(m_parentNode, a, null, op, values, displayValues);
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/node/AbstractComposerNode.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/node/AbstractComposerNode.java
index 87aab1f027..ca8d77dbf0 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/node/AbstractComposerNode.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/node/AbstractComposerNode.java
@@ -1,106 +1,106 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.composer.node;
-
-import java.util.Collection;
-
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.basic.tree.AbstractTreeNode;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
-import org.eclipse.scout.rt.client.ui.form.fields.composer.IComposerField;
-import org.eclipse.scout.rt.shared.data.model.IDataModelEntity;
-
-/**
- * Control Structure node for NOT, OR, AND, etc.
- * <p>
- * Example of an extensive company search formula:
- *
- * <pre>
- * EITHER
- * name starts with "abb"
- * AND name ends with "ch"
- * AND has Region with
- * country is Switzerland
- * OR
- * name starts with "bsi"
- * AND name ends with "us"
- * </pre>
- */
-public abstract class AbstractComposerNode extends AbstractTreeNode {
- private final IComposerField m_composerField;
-
- public AbstractComposerNode(IComposerField composerField, boolean callInitializer) {
- super(false);
- m_composerField = composerField;
- if (callInitializer) {
- callInitializer();
- }
- }
-
- @Override
- public boolean isLeaf() {
- return getChildNodeCount() == 0;
- }
-
- protected ITreeNode getSiblingBefore() {
- if (getTree() != null && getParentNode() != null) {
- int index = getChildNodeIndex();
- if (index - 1 >= 0) {
- return getParentNode().getChildNode(index - 1);
- }
- }
- return null;
- }
-
- protected ITreeNode getSiblingAfter() {
- if (getTree() != null && getParentNode() != null) {
- int index = getChildNodeIndex();
- int count = getParentNode().getChildNodeCount();
- if (index + 1 < count) {
- return getParentNode().getChildNode(index + 1);
- }
- }
- return null;
- }
-
- public IComposerField getComposerField() {
- return m_composerField;
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName() + "[" + getCell().getText() + "]";
- }
-
- protected void attachAddEntityMenus(Collection<IMenu> menus) {
- EntityNode eNode = null;
- ITreeNode n = this;
- while (n != null) {
- if (n instanceof EntityNode) {
- eNode = (EntityNode) n;
- break;
- }
- n = n.getParentNode();
- }
-
- IDataModelEntity[] childEntitites;
- if (eNode != null) {
- childEntitites = eNode.getEntity().getEntities();
- }
- else {
- childEntitites = getComposerField().getEntities();
- }
- for (IDataModelEntity e : childEntitites) {
- menus.add(new AddEntityMenu(getComposerField(), this, e));
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.composer.node;
+
+import java.util.Collection;
+
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.basic.tree.AbstractTreeNode;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
+import org.eclipse.scout.rt.client.ui.form.fields.composer.IComposerField;
+import org.eclipse.scout.rt.shared.data.model.IDataModelEntity;
+
+/**
+ * Control Structure node for NOT, OR, AND, etc.
+ * <p>
+ * Example of an extensive company search formula:
+ *
+ * <pre>
+ * EITHER
+ * name starts with "abb"
+ * AND name ends with "ch"
+ * AND has Region with
+ * country is Switzerland
+ * OR
+ * name starts with "bsi"
+ * AND name ends with "us"
+ * </pre>
+ */
+public abstract class AbstractComposerNode extends AbstractTreeNode {
+ private final IComposerField m_composerField;
+
+ public AbstractComposerNode(IComposerField composerField, boolean callInitializer) {
+ super(false);
+ m_composerField = composerField;
+ if (callInitializer) {
+ callInitializer();
+ }
+ }
+
+ @Override
+ public boolean isLeaf() {
+ return getChildNodeCount() == 0;
+ }
+
+ protected ITreeNode getSiblingBefore() {
+ if (getTree() != null && getParentNode() != null) {
+ int index = getChildNodeIndex();
+ if (index - 1 >= 0) {
+ return getParentNode().getChildNode(index - 1);
+ }
+ }
+ return null;
+ }
+
+ protected ITreeNode getSiblingAfter() {
+ if (getTree() != null && getParentNode() != null) {
+ int index = getChildNodeIndex();
+ int count = getParentNode().getChildNodeCount();
+ if (index + 1 < count) {
+ return getParentNode().getChildNode(index + 1);
+ }
+ }
+ return null;
+ }
+
+ public IComposerField getComposerField() {
+ return m_composerField;
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + "[" + getCell().getText() + "]";
+ }
+
+ protected void attachAddEntityMenus(Collection<IMenu> menus) {
+ EntityNode eNode = null;
+ ITreeNode n = this;
+ while (n != null) {
+ if (n instanceof EntityNode) {
+ eNode = (EntityNode) n;
+ break;
+ }
+ n = n.getParentNode();
+ }
+
+ IDataModelEntity[] childEntitites;
+ if (eNode != null) {
+ childEntitites = eNode.getEntity().getEntities();
+ }
+ else {
+ childEntitites = getComposerField().getEntities();
+ }
+ for (IDataModelEntity e : childEntitites) {
+ menus.add(new AddEntityMenu(getComposerField(), this, e));
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/node/AddEntityMenu.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/node/AddEntityMenu.java
index 16842da3f3..a746f49a99 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/node/AddEntityMenu.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/node/AddEntityMenu.java
@@ -1,52 +1,52 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.composer.node;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
-import org.eclipse.scout.rt.client.ui.form.fields.composer.IComposerField;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.data.model.IDataModelEntity;
-
-/**
- * Dynamic menu to add a new entity to the composer tree
- */
-public class AddEntityMenu extends AbstractMenu {
- private final IComposerField m_field;
- private final ITreeNode m_parentNode;
- private final IDataModelEntity m_entity;
-
- public AddEntityMenu(IComposerField field, ITreeNode parentNode, IDataModelEntity e) {
- super(false);
- m_field = field;
- m_parentNode = parentNode;
- m_entity = e;
- callInitializer();
- }
-
- @Override
- protected void execInitAction() throws ProcessingException {
- setText(ScoutTexts.get("ExtendedSearchAddEntityPrefix") + " " + m_entity.getText());
- setIconId(m_entity.getIconId());
- }
-
- @Override
- protected void execPrepareAction() {
- setVisible(m_entity.isVisible());
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- m_field.addEntityNode(m_parentNode, m_entity, false, null, null);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.composer.node;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
+import org.eclipse.scout.rt.client.ui.form.fields.composer.IComposerField;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.data.model.IDataModelEntity;
+
+/**
+ * Dynamic menu to add a new entity to the composer tree
+ */
+public class AddEntityMenu extends AbstractMenu {
+ private final IComposerField m_field;
+ private final ITreeNode m_parentNode;
+ private final IDataModelEntity m_entity;
+
+ public AddEntityMenu(IComposerField field, ITreeNode parentNode, IDataModelEntity e) {
+ super(false);
+ m_field = field;
+ m_parentNode = parentNode;
+ m_entity = e;
+ callInitializer();
+ }
+
+ @Override
+ protected void execInitAction() throws ProcessingException {
+ setText(ScoutTexts.get("ExtendedSearchAddEntityPrefix") + " " + m_entity.getText());
+ setIconId(m_entity.getIconId());
+ }
+
+ @Override
+ protected void execPrepareAction() {
+ setVisible(m_entity.isVisible());
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ m_field.addEntityNode(m_parentNode, m_entity, false, null, null);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/node/AttributeNode.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/node/AttributeNode.java
index 02130ab58e..ff3a0aefc4 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/node/AttributeNode.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/node/AttributeNode.java
@@ -1,180 +1,180 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.composer.node;
-
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
-import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
-import org.eclipse.scout.rt.client.ui.form.fields.composer.IComposerField;
-import org.eclipse.scout.rt.client.ui.form.fields.composer.internal.ComposerAttributeForm;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.data.model.DataModelConstants;
-import org.eclipse.scout.rt.shared.data.model.IDataModelAttribute;
-import org.eclipse.scout.rt.shared.data.model.IDataModelAttributeOp;
-
-public class AttributeNode extends AbstractComposerNode {
- private IDataModelAttribute m_attribute;
- private Integer m_aggregationType;
- private IDataModelAttributeOp m_op;
- private String m_verbose;
- private Object[] m_values;
- private String[] m_texts;
-
- public AttributeNode(IComposerField composerField, IDataModelAttribute attrbiute) {
- super(composerField, false);
- m_attribute = attrbiute;
- callInitializer();
- }
-
- @Override
- protected void execDecorateCell(Cell cell) {
- // text
- int dataType = DataModelConstants.TYPE_NONE;
- if (m_op != null) {
- dataType = m_op.getType();
- }
- if (dataType == DataModelConstants.TYPE_INHERITED) {
- if (m_attribute != null) {
- dataType = m_attribute.getType();
- }
- }
- String prefix = "";
- if (getSiblingBefore() != null) {
- prefix = ScoutTexts.get("ExtendedSearchAnd") + " ";
- }
- if (m_op != null && m_attribute != null) {
- if (m_attribute.getType() == DataModelConstants.TYPE_AGGREGATE_COUNT) {
- cell.setText(prefix + m_op.createVerboseText(null, m_attribute.getText(), m_texts));
- }
- else {
- cell.setText(prefix + m_op.createVerboseText(getAggregationType(), m_attribute.getText(), m_texts));
- }
- }
- else if (m_attribute != null) {
- cell.setText(prefix + m_attribute.getText());
- }
- else {
- // nop
- }
- }
-
- /**
- * guaranteed to never return null
- */
- public Object[] getValues() {
- return m_values;
- }
-
- public void setValues(Object[] a) {
- m_values = a;
- }
-
- /**
- * guaranteed to never return null
- */
- public String[] getTexts() {
- return m_texts;
- }
-
- public void setTexts(String[] s) {
- m_texts = s;
- }
-
- public IDataModelAttribute getAttribute() {
- return m_attribute;
- }
-
- public void setAttribute(IDataModelAttribute a) {
- m_attribute = a;
- }
-
- public IDataModelAttributeOp getOp() {
- return m_op;
- }
-
- public void setOp(IDataModelAttributeOp op) {
- m_op = op;
- }
-
- /**
- * @return the operator type
- * see {@link ComposerConstants#AGGREGATION_*} values
- */
- public Integer getAggregationType() {
- return m_aggregationType;
- }
-
- /**
- * @return the operator type
- * see {@link ComposerConstants#AGGREGATION_*} values
- */
- public void setAggregationType(Integer a) {
- if (a != null && a == DataModelConstants.AGGREGATION_NONE) {
- a = null;
- }
- m_aggregationType = a;
- }
-
- @Order(1)
- public class EditAttributeMenu extends AbstractMenu {
-
- @Override
- protected String getConfiguredText() {
- return ScoutTexts.get("ExtendedSearchEditAttributeMenu");
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- ComposerAttributeForm form = new ComposerAttributeForm();
- ITreeNode parentEntity = findParentNode(EntityNode.class);
- if (parentEntity != null) {
- form.setAvailableAttributes(((EntityNode) parentEntity).getEntity().getAttributes());
- }
- else {
- form.setAvailableAttributes(getComposerField().getAttributes());
- }
- form.setSelectedAttribute(getAttribute());
- form.setSelectedOp(getOp());
- form.setSelectedValues(getValues());
- form.setSelectedDisplayValues(getTexts());
- form.startModify();
- form.waitFor();
- if (form.isFormStored()) {
- setAttribute(form.getSelectedAttribute());
- setOp(form.getSelectedOp());
- setValues(form.getSelectedValues());
- setTexts(form.getSelectedDisplayValues());
- if (!isStatusInserted()) {
- setStatusInternal(ITreeNode.STATUS_UPDATED);
- }
- update();
- }
- }
- }
-
- @Order(3)
- public class DeleteAttributeMenu extends AbstractMenu {
-
- @Override
- protected String getConfiguredText() {
- return ScoutTexts.get("ExtendedSearchRemoveAttributeMenu");
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- getTree().selectPreviousParentNode();
- getTree().removeNode(AttributeNode.this);
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.composer.node;
+
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
+import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
+import org.eclipse.scout.rt.client.ui.form.fields.composer.IComposerField;
+import org.eclipse.scout.rt.client.ui.form.fields.composer.internal.ComposerAttributeForm;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.data.model.DataModelConstants;
+import org.eclipse.scout.rt.shared.data.model.IDataModelAttribute;
+import org.eclipse.scout.rt.shared.data.model.IDataModelAttributeOp;
+
+public class AttributeNode extends AbstractComposerNode {
+ private IDataModelAttribute m_attribute;
+ private Integer m_aggregationType;
+ private IDataModelAttributeOp m_op;
+ private String m_verbose;
+ private Object[] m_values;
+ private String[] m_texts;
+
+ public AttributeNode(IComposerField composerField, IDataModelAttribute attrbiute) {
+ super(composerField, false);
+ m_attribute = attrbiute;
+ callInitializer();
+ }
+
+ @Override
+ protected void execDecorateCell(Cell cell) {
+ // text
+ int dataType = DataModelConstants.TYPE_NONE;
+ if (m_op != null) {
+ dataType = m_op.getType();
+ }
+ if (dataType == DataModelConstants.TYPE_INHERITED) {
+ if (m_attribute != null) {
+ dataType = m_attribute.getType();
+ }
+ }
+ String prefix = "";
+ if (getSiblingBefore() != null) {
+ prefix = ScoutTexts.get("ExtendedSearchAnd") + " ";
+ }
+ if (m_op != null && m_attribute != null) {
+ if (m_attribute.getType() == DataModelConstants.TYPE_AGGREGATE_COUNT) {
+ cell.setText(prefix + m_op.createVerboseText(null, m_attribute.getText(), m_texts));
+ }
+ else {
+ cell.setText(prefix + m_op.createVerboseText(getAggregationType(), m_attribute.getText(), m_texts));
+ }
+ }
+ else if (m_attribute != null) {
+ cell.setText(prefix + m_attribute.getText());
+ }
+ else {
+ // nop
+ }
+ }
+
+ /**
+ * guaranteed to never return null
+ */
+ public Object[] getValues() {
+ return m_values;
+ }
+
+ public void setValues(Object[] a) {
+ m_values = a;
+ }
+
+ /**
+ * guaranteed to never return null
+ */
+ public String[] getTexts() {
+ return m_texts;
+ }
+
+ public void setTexts(String[] s) {
+ m_texts = s;
+ }
+
+ public IDataModelAttribute getAttribute() {
+ return m_attribute;
+ }
+
+ public void setAttribute(IDataModelAttribute a) {
+ m_attribute = a;
+ }
+
+ public IDataModelAttributeOp getOp() {
+ return m_op;
+ }
+
+ public void setOp(IDataModelAttributeOp op) {
+ m_op = op;
+ }
+
+ /**
+ * @return the operator type
+ * see {@link ComposerConstants#AGGREGATION_*} values
+ */
+ public Integer getAggregationType() {
+ return m_aggregationType;
+ }
+
+ /**
+ * @return the operator type
+ * see {@link ComposerConstants#AGGREGATION_*} values
+ */
+ public void setAggregationType(Integer a) {
+ if (a != null && a == DataModelConstants.AGGREGATION_NONE) {
+ a = null;
+ }
+ m_aggregationType = a;
+ }
+
+ @Order(1)
+ public class EditAttributeMenu extends AbstractMenu {
+
+ @Override
+ protected String getConfiguredText() {
+ return ScoutTexts.get("ExtendedSearchEditAttributeMenu");
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ ComposerAttributeForm form = new ComposerAttributeForm();
+ ITreeNode parentEntity = findParentNode(EntityNode.class);
+ if (parentEntity != null) {
+ form.setAvailableAttributes(((EntityNode) parentEntity).getEntity().getAttributes());
+ }
+ else {
+ form.setAvailableAttributes(getComposerField().getAttributes());
+ }
+ form.setSelectedAttribute(getAttribute());
+ form.setSelectedOp(getOp());
+ form.setSelectedValues(getValues());
+ form.setSelectedDisplayValues(getTexts());
+ form.startModify();
+ form.waitFor();
+ if (form.isFormStored()) {
+ setAttribute(form.getSelectedAttribute());
+ setOp(form.getSelectedOp());
+ setValues(form.getSelectedValues());
+ setTexts(form.getSelectedDisplayValues());
+ if (!isStatusInserted()) {
+ setStatusInternal(ITreeNode.STATUS_UPDATED);
+ }
+ update();
+ }
+ }
+ }
+
+ @Order(3)
+ public class DeleteAttributeMenu extends AbstractMenu {
+
+ @Override
+ protected String getConfiguredText() {
+ return ScoutTexts.get("ExtendedSearchRemoveAttributeMenu");
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ getTree().selectPreviousParentNode();
+ getTree().removeNode(AttributeNode.this);
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/node/EitherOrNode.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/node/EitherOrNode.java
index fd789ecc63..6448bf9dcd 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/node/EitherOrNode.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/node/EitherOrNode.java
@@ -1,183 +1,183 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.composer.node;
-
-import java.util.ArrayList;
-
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.action.menu.MenuSeparator;
-import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
-import org.eclipse.scout.rt.client.ui.form.fields.composer.IComposerField;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-
-public class EitherOrNode extends AbstractComposerNode {
- private boolean m_beginEitherOr;
- private boolean m_negated = false;
-
- public EitherOrNode(IComposerField composerField, boolean beginEitherOr) {
- super(composerField, false);
- m_beginEitherOr = beginEitherOr;
- callInitializer();
- }
-
- public boolean isBeginOfEitherOr() {
- return m_beginEitherOr;
- }
-
- public void setBeginOfEitherOr(boolean b) {
- m_beginEitherOr = b;
- }
-
- public boolean isEndOfEitherOr() {
- ITreeNode next = getSiblingAfter();
- if (next instanceof EitherOrNode && !((EitherOrNode) next).isBeginOfEitherOr()) {
- return false;
- }
- else {
- return true;
- }
- }
-
- public boolean isNegative() {
- return m_negated;
- }
-
- public void setNegative(boolean b) {
- m_negated = b;
- }
-
- @Override
- protected void execInitTreeNode() {
- ArrayList<IMenu> menus = new ArrayList<IMenu>();
- for (IMenu m : getMenus()) {
- if (m.getClass() == AddEntityOnEitherOrPlaceholderMenu.class) {
- attachAddEntityMenus(menus);
- }
- else {
- menus.add(m);
- }
- }
- setMenus(menus.toArray(new IMenu[menus.size()]));
- }
-
- @Override
- protected void execDecorateCell(Cell cell) {
- String text = "";
- ITreeNode siblingBefore = getSiblingBefore();
- if (isBeginOfEitherOr() && siblingBefore != null) {
- text += ScoutTexts.get("ExtendedSearchAnd") + " ";
- }
- if (isBeginOfEitherOr()) {
- text += ScoutTexts.get("ExtendedSearchEither");
- }
- else {
- text += ScoutTexts.get("ExtendedSearchOr");
- }
- if (isNegative()) {
- text += " " + ScoutTexts.get("ExtendedSearchNot");
- }
- cell.setText(text);
- }
-
- @Order(1)
- public class AddAdditionalOrMenu extends AbstractMenu {
- @Override
- protected String getConfiguredText() {
- return ScoutTexts.get("ExtendedSearchAddAdditionalOrMenu");
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- getComposerField().addAdditionalOrNode(EitherOrNode.this, false);
- }
- }
-
- @Order(5)
- public class AddEitherOrMenu extends AbstractMenu {
- @Override
- protected String getConfiguredText() {
- return ScoutTexts.get("ExtendedSearchAddEitherOrMenu");
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- ITreeNode node = getComposerField().addEitherNode(EitherOrNode.this, false);
- getComposerField().addAdditionalOrNode(node, false);
- }
- }
-
- @Order(10)
- public class Separator1Menu extends MenuSeparator {
- }
-
- @Order(20)
- public class NegateEitherOrMenu extends AbstractMenu {
-
- @Override
- protected String getConfiguredText() {
- return ScoutTexts.get("ExtendedSearchNegateMenu");
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- setNegative(!isNegative());
- if (!isStatusInserted()) {
- setStatusInternal(ITreeNode.STATUS_UPDATED);
- }
- update();
- }
- }
-
- @Order(30)
- public class DeleteEitherOrMenu extends AbstractMenu {
-
- @Override
- protected String getConfiguredText() {
- return ScoutTexts.get("ExtendedSearchRemoveMenu");
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- ITreeNode next = getSiblingAfter();
- if (isBeginOfEitherOr()) {
- if (next instanceof EitherOrNode && !((EitherOrNode) next).isBeginOfEitherOr()) {
- ((EitherOrNode) next).setBeginOfEitherOr(true);
- ((EitherOrNode) next).update();
- }
- }
- getTree().selectPreviousParentNode();
- getTree().removeNode(EitherOrNode.this);
- }
- }
-
- @Order(40)
- public class Separator2Menu extends MenuSeparator {
- }
-
- @Order(50)
- public class AddAttributeOnEitherOrMenu extends AbstractAddAttributeMenu {
- public AddAttributeOnEitherOrMenu() {
- super(getComposerField(), EitherOrNode.this);
- }
- }
-
- @Order(60)
- public class Separator3Menu extends MenuSeparator {
- }
-
- @Order(70)
- public class AddEntityOnEitherOrPlaceholderMenu extends MenuSeparator {
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.composer.node;
+
+import java.util.ArrayList;
+
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.action.menu.MenuSeparator;
+import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
+import org.eclipse.scout.rt.client.ui.form.fields.composer.IComposerField;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+
+public class EitherOrNode extends AbstractComposerNode {
+ private boolean m_beginEitherOr;
+ private boolean m_negated = false;
+
+ public EitherOrNode(IComposerField composerField, boolean beginEitherOr) {
+ super(composerField, false);
+ m_beginEitherOr = beginEitherOr;
+ callInitializer();
+ }
+
+ public boolean isBeginOfEitherOr() {
+ return m_beginEitherOr;
+ }
+
+ public void setBeginOfEitherOr(boolean b) {
+ m_beginEitherOr = b;
+ }
+
+ public boolean isEndOfEitherOr() {
+ ITreeNode next = getSiblingAfter();
+ if (next instanceof EitherOrNode && !((EitherOrNode) next).isBeginOfEitherOr()) {
+ return false;
+ }
+ else {
+ return true;
+ }
+ }
+
+ public boolean isNegative() {
+ return m_negated;
+ }
+
+ public void setNegative(boolean b) {
+ m_negated = b;
+ }
+
+ @Override
+ protected void execInitTreeNode() {
+ ArrayList<IMenu> menus = new ArrayList<IMenu>();
+ for (IMenu m : getMenus()) {
+ if (m.getClass() == AddEntityOnEitherOrPlaceholderMenu.class) {
+ attachAddEntityMenus(menus);
+ }
+ else {
+ menus.add(m);
+ }
+ }
+ setMenus(menus.toArray(new IMenu[menus.size()]));
+ }
+
+ @Override
+ protected void execDecorateCell(Cell cell) {
+ String text = "";
+ ITreeNode siblingBefore = getSiblingBefore();
+ if (isBeginOfEitherOr() && siblingBefore != null) {
+ text += ScoutTexts.get("ExtendedSearchAnd") + " ";
+ }
+ if (isBeginOfEitherOr()) {
+ text += ScoutTexts.get("ExtendedSearchEither");
+ }
+ else {
+ text += ScoutTexts.get("ExtendedSearchOr");
+ }
+ if (isNegative()) {
+ text += " " + ScoutTexts.get("ExtendedSearchNot");
+ }
+ cell.setText(text);
+ }
+
+ @Order(1)
+ public class AddAdditionalOrMenu extends AbstractMenu {
+ @Override
+ protected String getConfiguredText() {
+ return ScoutTexts.get("ExtendedSearchAddAdditionalOrMenu");
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ getComposerField().addAdditionalOrNode(EitherOrNode.this, false);
+ }
+ }
+
+ @Order(5)
+ public class AddEitherOrMenu extends AbstractMenu {
+ @Override
+ protected String getConfiguredText() {
+ return ScoutTexts.get("ExtendedSearchAddEitherOrMenu");
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ ITreeNode node = getComposerField().addEitherNode(EitherOrNode.this, false);
+ getComposerField().addAdditionalOrNode(node, false);
+ }
+ }
+
+ @Order(10)
+ public class Separator1Menu extends MenuSeparator {
+ }
+
+ @Order(20)
+ public class NegateEitherOrMenu extends AbstractMenu {
+
+ @Override
+ protected String getConfiguredText() {
+ return ScoutTexts.get("ExtendedSearchNegateMenu");
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ setNegative(!isNegative());
+ if (!isStatusInserted()) {
+ setStatusInternal(ITreeNode.STATUS_UPDATED);
+ }
+ update();
+ }
+ }
+
+ @Order(30)
+ public class DeleteEitherOrMenu extends AbstractMenu {
+
+ @Override
+ protected String getConfiguredText() {
+ return ScoutTexts.get("ExtendedSearchRemoveMenu");
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ ITreeNode next = getSiblingAfter();
+ if (isBeginOfEitherOr()) {
+ if (next instanceof EitherOrNode && !((EitherOrNode) next).isBeginOfEitherOr()) {
+ ((EitherOrNode) next).setBeginOfEitherOr(true);
+ ((EitherOrNode) next).update();
+ }
+ }
+ getTree().selectPreviousParentNode();
+ getTree().removeNode(EitherOrNode.this);
+ }
+ }
+
+ @Order(40)
+ public class Separator2Menu extends MenuSeparator {
+ }
+
+ @Order(50)
+ public class AddAttributeOnEitherOrMenu extends AbstractAddAttributeMenu {
+ public AddAttributeOnEitherOrMenu() {
+ super(getComposerField(), EitherOrNode.this);
+ }
+ }
+
+ @Order(60)
+ public class Separator3Menu extends MenuSeparator {
+ }
+
+ @Order(70)
+ public class AddEntityOnEitherOrPlaceholderMenu extends MenuSeparator {
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/node/EntityNode.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/node/EntityNode.java
index 181a14a28f..977e752c66 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/node/EntityNode.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/node/EntityNode.java
@@ -1,175 +1,175 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.composer.node;
-
-import java.util.ArrayList;
-
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.action.menu.MenuSeparator;
-import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
-import org.eclipse.scout.rt.client.ui.form.fields.composer.IComposerField;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.data.model.IDataModelAttribute;
-import org.eclipse.scout.rt.shared.data.model.IDataModelEntity;
-
-public class EntityNode extends AbstractComposerNode {
-
- private IDataModelEntity m_entity;
- private boolean m_negated = false;
- private Object[] m_values;
- private String[] m_texts;
-
- public EntityNode(IComposerField composerField, IDataModelEntity entity) {
- super(composerField, false);
- m_entity = entity;
- callInitializer();
- }
-
- @Override
- protected void execInitTreeNode() {
- ArrayList<IMenu> menus = new ArrayList<IMenu>();
- for (IMenu m : getMenus()) {
- if (m.getClass() == AddEntityPlaceholderOnEntityMenu.class) {
- attachAddEntityMenus(menus);
- }
- else {
- menus.add(m);
- }
- }
- // delete separator if it is at the end
- if (menus.size() > 0 && menus.get(menus.size() - 1).getClass() == Separator2Menu.class) {
- menus.remove(menus.size() - 1);
- }
- setMenus(menus.toArray(new IMenu[menus.size()]));
- }
-
- @Override
- protected void execDecorateCell(Cell cell) {
- StringBuffer label = new StringBuffer();
- if (getSiblingBefore() != null) {
- label.append(ScoutTexts.get("ExtendedSearchAnd") + " ");
- }
- if (isNegative()) {
- label.append(ScoutTexts.get("ExtendedSearchNot"));
- }
- label.append(" " + m_entity.getText());
- if (getChildNodeCount() > 0) {
- label.append(" " + ScoutTexts.get("ExtendedSearchEntitySuffix"));
- }
- cell.setText(label.toString());
- }
-
- public IDataModelEntity getEntity() {
- return m_entity;
- }
-
- public void setEntity(IDataModelEntity e) {
- m_entity = e;
- }
-
- public boolean isNegative() {
- return m_negated;
- }
-
- public void setNegative(boolean b) {
- m_negated = b;
- }
-
- public Object[] getValues() {
- return m_values;
- }
-
- public void setValues(Object[] values) {
- m_values = values;
- }
-
- public String[] getTexts() {
- return m_texts;
- }
-
- public void setTexts(String[] a) {
- m_texts = a;
- }
-
- @Order(10)
- public class AddAttributeOnEntityMenu extends AbstractAddAttributeMenu {
- public AddAttributeOnEntityMenu() {
- super(getComposerField(), EntityNode.this);
- }
- }
-
- @Order(20)
- public class AddEitherOrOnEntityMenu extends AbstractMenu {
- @Override
- protected String getConfiguredText() {
- return ScoutTexts.get("ExtendedSearchAddEitherOrMenu");
- }
-
- @Override
- protected void execPrepareAction() throws ProcessingException {
- IDataModelAttribute[] atts = m_entity.getAttributes();
- IDataModelEntity[] ents = m_entity.getEntities();
- setVisible((atts != null && atts.length > 0) || (ents != null && ents.length > 0));
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- ITreeNode node = getComposerField().addEitherNode(EntityNode.this, false);
- getComposerField().addAdditionalOrNode(node, false);
- }
- }
-
- @Order(40)
- public class NegateEntityMenu extends AbstractMenu {
-
- @Override
- protected String getConfiguredText() {
- return ScoutTexts.get("ExtendedSearchNegateMenu");
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- setNegative(!isNegative());
- if (!isStatusInserted()) {
- setStatusInternal(ITreeNode.STATUS_UPDATED);
- }
- update();
- }
- }
-
- @Order(50)
- public class DeleteEntityMenu extends AbstractMenu {
-
- @Override
- protected String getConfiguredText() {
- return ScoutTexts.get("ExtendedSearchRemoveMenu");
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- getTree().selectPreviousParentNode();
- getTree().removeNode(EntityNode.this);
- }
- }
-
- @Order(60)
- public class Separator2Menu extends MenuSeparator {
- }
-
- @Order(70)
- public class AddEntityPlaceholderOnEntityMenu extends MenuSeparator {
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.composer.node;
+
+import java.util.ArrayList;
+
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.action.menu.MenuSeparator;
+import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
+import org.eclipse.scout.rt.client.ui.form.fields.composer.IComposerField;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.data.model.IDataModelAttribute;
+import org.eclipse.scout.rt.shared.data.model.IDataModelEntity;
+
+public class EntityNode extends AbstractComposerNode {
+
+ private IDataModelEntity m_entity;
+ private boolean m_negated = false;
+ private Object[] m_values;
+ private String[] m_texts;
+
+ public EntityNode(IComposerField composerField, IDataModelEntity entity) {
+ super(composerField, false);
+ m_entity = entity;
+ callInitializer();
+ }
+
+ @Override
+ protected void execInitTreeNode() {
+ ArrayList<IMenu> menus = new ArrayList<IMenu>();
+ for (IMenu m : getMenus()) {
+ if (m.getClass() == AddEntityPlaceholderOnEntityMenu.class) {
+ attachAddEntityMenus(menus);
+ }
+ else {
+ menus.add(m);
+ }
+ }
+ // delete separator if it is at the end
+ if (menus.size() > 0 && menus.get(menus.size() - 1).getClass() == Separator2Menu.class) {
+ menus.remove(menus.size() - 1);
+ }
+ setMenus(menus.toArray(new IMenu[menus.size()]));
+ }
+
+ @Override
+ protected void execDecorateCell(Cell cell) {
+ StringBuffer label = new StringBuffer();
+ if (getSiblingBefore() != null) {
+ label.append(ScoutTexts.get("ExtendedSearchAnd") + " ");
+ }
+ if (isNegative()) {
+ label.append(ScoutTexts.get("ExtendedSearchNot"));
+ }
+ label.append(" " + m_entity.getText());
+ if (getChildNodeCount() > 0) {
+ label.append(" " + ScoutTexts.get("ExtendedSearchEntitySuffix"));
+ }
+ cell.setText(label.toString());
+ }
+
+ public IDataModelEntity getEntity() {
+ return m_entity;
+ }
+
+ public void setEntity(IDataModelEntity e) {
+ m_entity = e;
+ }
+
+ public boolean isNegative() {
+ return m_negated;
+ }
+
+ public void setNegative(boolean b) {
+ m_negated = b;
+ }
+
+ public Object[] getValues() {
+ return m_values;
+ }
+
+ public void setValues(Object[] values) {
+ m_values = values;
+ }
+
+ public String[] getTexts() {
+ return m_texts;
+ }
+
+ public void setTexts(String[] a) {
+ m_texts = a;
+ }
+
+ @Order(10)
+ public class AddAttributeOnEntityMenu extends AbstractAddAttributeMenu {
+ public AddAttributeOnEntityMenu() {
+ super(getComposerField(), EntityNode.this);
+ }
+ }
+
+ @Order(20)
+ public class AddEitherOrOnEntityMenu extends AbstractMenu {
+ @Override
+ protected String getConfiguredText() {
+ return ScoutTexts.get("ExtendedSearchAddEitherOrMenu");
+ }
+
+ @Override
+ protected void execPrepareAction() throws ProcessingException {
+ IDataModelAttribute[] atts = m_entity.getAttributes();
+ IDataModelEntity[] ents = m_entity.getEntities();
+ setVisible((atts != null && atts.length > 0) || (ents != null && ents.length > 0));
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ ITreeNode node = getComposerField().addEitherNode(EntityNode.this, false);
+ getComposerField().addAdditionalOrNode(node, false);
+ }
+ }
+
+ @Order(40)
+ public class NegateEntityMenu extends AbstractMenu {
+
+ @Override
+ protected String getConfiguredText() {
+ return ScoutTexts.get("ExtendedSearchNegateMenu");
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ setNegative(!isNegative());
+ if (!isStatusInserted()) {
+ setStatusInternal(ITreeNode.STATUS_UPDATED);
+ }
+ update();
+ }
+ }
+
+ @Order(50)
+ public class DeleteEntityMenu extends AbstractMenu {
+
+ @Override
+ protected String getConfiguredText() {
+ return ScoutTexts.get("ExtendedSearchRemoveMenu");
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ getTree().selectPreviousParentNode();
+ getTree().removeNode(EntityNode.this);
+ }
+ }
+
+ @Order(60)
+ public class Separator2Menu extends MenuSeparator {
+ }
+
+ @Order(70)
+ public class AddEntityPlaceholderOnEntityMenu extends MenuSeparator {
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/node/RootNode.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/node/RootNode.java
index d122ae0857..b46fa365b5 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/node/RootNode.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/composer/node/RootNode.java
@@ -1,85 +1,85 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.composer.node;
-
-import java.util.ArrayList;
-
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.action.menu.MenuSeparator;
-import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
-import org.eclipse.scout.rt.client.ui.form.fields.composer.IComposerField;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.data.basic.FontSpec;
-
-public class RootNode extends AbstractComposerNode {
-
- public RootNode(IComposerField composerField) {
- super(composerField, true);
- }
-
- @Override
- protected void execInitTreeNode() {
- ArrayList<IMenu> menus = new ArrayList<IMenu>();
- for (IMenu m : getMenus()) {
- if (m.getClass() == AddEntityPlaceholderOnRootMenu.class) {
- attachAddEntityMenus(menus);
- }
- else {
- menus.add(m);
- }
- }
- setMenus(menus.toArray(new IMenu[menus.size()]));
- }
-
- @Override
- protected void execDecorateCell(Cell cell) {
- if (getChildNodeCount() == 0) {
- cell.setFont(FontSpec.parse("plain"));
- }
- else {
- cell.setFont(FontSpec.parse("bold"));
- }
- }
-
- @Order(10)
- public class AddAttributeOnRootMenu extends AbstractAddAttributeMenu {
- public AddAttributeOnRootMenu() {
- super(getComposerField(), RootNode.this);
- }
- }
-
- @Order(20)
- public class AddEitherOrOnRootMenu extends AbstractMenu {
- @Override
- protected String getConfiguredText() {
- return ScoutTexts.get("ExtendedSearchAddEitherOrMenu");
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- ITreeNode node = getComposerField().addEitherNode(RootNode.this, false);
- getComposerField().addAdditionalOrNode(node, false);
- }
- }
-
- @Order(30)
- public class Separator1Menu extends MenuSeparator {
- }
-
- @Order(40)
- public class AddEntityPlaceholderOnRootMenu extends MenuSeparator {
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.composer.node;
+
+import java.util.ArrayList;
+
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.action.menu.MenuSeparator;
+import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
+import org.eclipse.scout.rt.client.ui.form.fields.composer.IComposerField;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.data.basic.FontSpec;
+
+public class RootNode extends AbstractComposerNode {
+
+ public RootNode(IComposerField composerField) {
+ super(composerField, true);
+ }
+
+ @Override
+ protected void execInitTreeNode() {
+ ArrayList<IMenu> menus = new ArrayList<IMenu>();
+ for (IMenu m : getMenus()) {
+ if (m.getClass() == AddEntityPlaceholderOnRootMenu.class) {
+ attachAddEntityMenus(menus);
+ }
+ else {
+ menus.add(m);
+ }
+ }
+ setMenus(menus.toArray(new IMenu[menus.size()]));
+ }
+
+ @Override
+ protected void execDecorateCell(Cell cell) {
+ if (getChildNodeCount() == 0) {
+ cell.setFont(FontSpec.parse("plain"));
+ }
+ else {
+ cell.setFont(FontSpec.parse("bold"));
+ }
+ }
+
+ @Order(10)
+ public class AddAttributeOnRootMenu extends AbstractAddAttributeMenu {
+ public AddAttributeOnRootMenu() {
+ super(getComposerField(), RootNode.this);
+ }
+ }
+
+ @Order(20)
+ public class AddEitherOrOnRootMenu extends AbstractMenu {
+ @Override
+ protected String getConfiguredText() {
+ return ScoutTexts.get("ExtendedSearchAddEitherOrMenu");
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ ITreeNode node = getComposerField().addEitherNode(RootNode.this, false);
+ getComposerField().addAdditionalOrNode(node, false);
+ }
+ }
+
+ @Order(30)
+ public class Separator1Menu extends MenuSeparator {
+ }
+
+ @Order(40)
+ public class AddEntityPlaceholderOnRootMenu extends MenuSeparator {
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/customfield/AbstractCustomField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/customfield/AbstractCustomField.java
index ceb99b32c8..1ae59cfbec 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/customfield/AbstractCustomField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/customfield/AbstractCustomField.java
@@ -1,40 +1,40 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.customfield;
-
-import org.eclipse.scout.rt.client.ui.form.fields.AbstractFormField;
-
-/**
- * default Convenience implementation base for a custom field
- */
-public abstract class AbstractCustomField extends AbstractFormField implements ICustomField {
-
- public AbstractCustomField() {
- this(true);
- }
-
- public AbstractCustomField(boolean callInitializer) {
- super(callInitializer);
- }
-
- /*
- * Configuration
- */
-
- @Override
- protected void initConfig() {
- super.initConfig();
- }
-
- /*
- * Runtime
- */
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.customfield;
+
+import org.eclipse.scout.rt.client.ui.form.fields.AbstractFormField;
+
+/**
+ * default Convenience implementation base for a custom field
+ */
+public abstract class AbstractCustomField extends AbstractFormField implements ICustomField {
+
+ public AbstractCustomField() {
+ this(true);
+ }
+
+ public AbstractCustomField(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ /*
+ * Configuration
+ */
+
+ @Override
+ protected void initConfig() {
+ super.initConfig();
+ }
+
+ /*
+ * Runtime
+ */
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/customfield/ICustomField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/customfield/ICustomField.java
index e3cab93331..6750bd2394 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/customfield/ICustomField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/customfield/ICustomField.java
@@ -1,28 +1,28 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.customfield;
-
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-
-/**
- * Optional marker interface for custom fields
- */
-public interface ICustomField extends IFormField {
-
- /*
- * Configuration
- */
-
- /*
- * Runtime
- */
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.customfield;
+
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+
+/**
+ * Optional marker interface for custom fields
+ */
+public interface ICustomField extends IFormField {
+
+ /*
+ * Configuration
+ */
+
+ /*
+ * Runtime
+ */
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/datefield/AbstractDateField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/datefield/AbstractDateField.java
index 5603299ace..67f94a05d2 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/datefield/AbstractDateField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/datefield/AbstractDateField.java
@@ -1,1078 +1,1078 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.datefield;
-
-import java.text.DateFormat;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.scout.commons.DateUtility;
-import org.eclipse.scout.commons.LocaleThreadLocal;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.holders.BooleanHolder;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.form.fields.AbstractValueField;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
-import org.eclipse.scout.service.SERVICES;
-
-/**
- * Default hasDate=true and hasTime=false
- */
-public abstract class AbstractDateField extends AbstractValueField<Date> implements IDateField {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractDateField.class);
-
- private static enum ParseContext {
- Date, Time
- }
-
- private static final ThreadLocal<ParseContext> PARSE_CONTEXT = new ThreadLocal<AbstractDateField.ParseContext>();
-
- private IDateFieldUIFacade m_uiFacade;
- private String m_format;
- private long m_autoTimeMillis;
-
- public AbstractDateField() {
- this(true);
- }
-
- public AbstractDateField(boolean callInitializer) {
- super(callInitializer);
- }
-
- /*
- * Configuration
- */
- @ConfigProperty(ConfigProperty.STRING)
- @Order(230)
- @ConfigPropertyValue("null")
- protected String getConfiguredFormat() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(240)
- @ConfigPropertyValue("true")
- protected boolean getConfiguredHasDate() {
- return true;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(241)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredHasTime() {
- return false;
- }
-
- /**
- * When a date without time is picked, this time value is used as hh/mm/ss.
- */
- @ConfigProperty(ConfigProperty.LONG)
- @Order(270)
- @ConfigPropertyValue("0")
- protected long getConfiguredAutoTimeMillis() {
- return 0;
- }
-
- /**
- * Depending whether subclass overrides this method
- * <p>
- * Default is as follows<br>
- * Level 0: shift day up/down [UP, DOWN]<br>
- * Level 1: shift month up/down [shift-UP,shift-DOWN]<br>
- * Level 2: shift year up/down [ctrl-UP,ctrl-DOWN]
- * <p>
- * see {@link #adjustDate(int, int, int)}
- */
- protected void execShiftDate(int level, int value) throws ProcessingException {
- switch (level) {
- case 0: {
- adjustDate(value, 0, 0);
- break;
- }
- case 1: {
- adjustDate(0, value, 0);
- break;
- }
- case 2: {
- adjustDate(0, 0, value);
- break;
- }
- }
- }
-
- /**
- * Depending whether subclass overrides this method
- * <p>
- * Default is as follows<br>
- * Level 0: shift minute up/down [UP, DOWN]<br>
- * Level 1: shift hour up/down [shift-UP, shift-DOWN]<br>
- * Level 2: nop [ctrl-UP, ctrl-DOWN]<br>
- * <p>
- * see {@link #adjustDate(int, int, int)}
- */
- protected void execShiftTime(int level, int value) throws ProcessingException {
- switch (level) {
- case 0: {
- adjustTime(value, 0, 0);
- break;
- }
- case 1: {
- adjustTime(0, value, 0);
- break;
- }
- case 2: {
- adjustTime(0, 0, value);
- break;
- }
- }
- }
-
- @Override
- protected void initConfig() {
- m_uiFacade = new P_UIFacade();
- super.initConfig();
- setFormat(getConfiguredFormat());
- setHasDate(getConfiguredHasDate());
- setHasTime(getConfiguredHasTime());
- setAutoTimeMillis(getConfiguredAutoTimeMillis());
- }
-
- @Override
- public void setFormat(String s) {
- m_format = s;
- if (isInitialized()) {
- if (isAutoDisplayText()) {
- setDisplayText(execFormatValue(getValue()));
- }
- }
- }
-
- @Override
- public String getFormat() {
- return m_format;
- }
-
- @Override
- public boolean isHasTime() {
- return propertySupport.getPropertyBool(PROP_HAS_TIME);
- }
-
- @Override
- public void setHasTime(boolean b) {
- propertySupport.setPropertyBool(PROP_HAS_TIME, b);
- if (isInitialized()) {
- setValue(getValue());
- }
- }
-
- @Override
- public boolean isHasDate() {
- return propertySupport.getPropertyBool(PROP_HAS_DATE);
- }
-
- @Override
- public void setHasDate(boolean b) {
- propertySupport.setPropertyBool(PROP_HAS_DATE, b);
- if (isInitialized()) {
- setValue(getValue());
- }
- }
-
- @Override
- public void setAutoTimeMillis(long l) {
- m_autoTimeMillis = l;
- }
-
- @Override
- public void setAutoTimeMillis(int hour, int minute, int second) {
- setAutoTimeMillis(((hour * 60L + minute) * 60L + second) * 1000L);
- }
-
- @Override
- public long getAutoTimeMillis() {
- return m_autoTimeMillis;
- }
-
- @Override
- public void adjustDate(int days, int months, int years) {
- Date d = getValue();
- if (d == null) {
- d = new Date();
- d = applyAutoTime(d);
- }
- else {
- Calendar cal = Calendar.getInstance();
- cal.setTime(d);
- cal.add(Calendar.DATE, days);
- cal.add(Calendar.MONTH, months);
- cal.add(Calendar.YEAR, years);
- d = cal.getTime();
- }
- setValue(d);
- }
-
- @Override
- public void adjustTime(int minutes, int hours, int reserved) {
- Date d = getValue();
- if (d == null) {
- d = new Date();
- d = applyAutoTime(d);
- }
- else {
- Calendar cal = Calendar.getInstance();
- cal.setTime(d);
- cal.add(Calendar.MINUTE, minutes);
- cal.add(Calendar.HOUR_OF_DAY, hours);
- d = cal.getTime();
- }
- setValue(d);
- }
-
- @Override
- public IDateFieldUIFacade getUIFacade() {
- return m_uiFacade;
- }
-
- // format value for display
- @Override
- protected String formatValueInternal(Date validValue) {
- if (validValue == null) {
- return "";
- }
- DateFormat df = getDateFormat();
- String displayValue = df.format(validValue);
- return displayValue;
- }
-
- // validate value for ranges, mandatory, ...
- @Override
- protected Date validateValueInternal(Date rawValue) throws ProcessingException {
- //legacy support
- Object legacyValue = rawValue;
- if (legacyValue instanceof Number) {
- rawValue = DateUtility.convertDoubleTimeToDate((Number) legacyValue);
- }
- Date validValue = null;
- rawValue = super.validateValueInternal(rawValue);
- try {
- // apply format
- DateFormat df = getDateFormat();
- rawValue = df.parse(df.format(rawValue));
- }
- catch (Throwable t) {
- // nop, take raw value
- }
- validValue = rawValue;
- return validValue;
- }
-
- /**
- * convert string to a real Date
- */
- @Override
- protected Date parseValueInternal(String text) throws ProcessingException {
- if (text != null && text.trim().length() == 0) {
- text = null;
- }
- if (text == null) {
- return null;
- }
- Date d = null;
- boolean customFormat = (getFormat() != null);
- if (isHasDate() && isHasTime()) {
- ParseContext pctx = PARSE_CONTEXT.get();
- if (pctx == null) {
- d = parseDateTimeInternal(text, customFormat ? getDateFormat() : null);
- }
- else if (pctx == ParseContext.Date) {
- d = parseDateInternal(text, customFormat ? getIsolatedDateFormat() : null);
- Date currentValue = getValue();
- if (currentValue != null) {
- d = DateUtility.createDateTime(d, currentValue);
- }
- }
- else if (pctx == ParseContext.Time) {
- d = parseTimeInternal(text, customFormat ? getIsolatedTimeFormat() : null);
- Date currentValue = getValue();
- if (currentValue == null) {
- currentValue = new Date();
- }
- d = DateUtility.createDateTime(currentValue, d);
- }
- }
- else if (isHasDate() && !isHasTime()) {
- d = parseDateInternal(text, customFormat ? getDateFormat() : null);
- }
- else if (!isHasDate() && isHasTime()) {
- d = parseTimeInternal(text, customFormat ? getDateFormat() : null);
- }
- // truncate value
- DateFormat df = getDateFormat();
- try {
- //preserve the year, since it might have been truncated to previous century, ticket 87172
- Calendar cal = Calendar.getInstance();
- cal.setTime(d);
- int year = cal.get(Calendar.YEAR);
- d = df.parse(df.format(d));
- cal.setTime(d);
- cal.set(Calendar.YEAR, year);
- d = cal.getTime();
- }
- catch (ParseException e) {
- throw new ProcessingException(ScoutTexts.get("InvalidValueMessageX", text), e);
- }
- return d;
- }
-
- @Override
- public Double getTimeValue() {
- return DateUtility.convertDateToDoubleTime(getValue());
- }
-
- @Override
- public void setTimeValue(Double d) {
- setValue(DateUtility.convertDoubleTimeToDate(d));
- }
-
- /**
- * @since Build 200
- * @rn imo, 06.04.2006, only adjust date not date/time
- */
- private Date applyAutoTime(Date d) {
- if (d == null) {
- return d;
- }
- Calendar timeCal = Calendar.getInstance();
- long autoTime = getAutoTimeMillis();
- if (autoTime == 0L && isHasTime()) {
- // use current time
- }
- else {
- timeCal.set(Calendar.MILLISECOND, (int) (autoTime % 1000));
- autoTime = autoTime / 1000;
- timeCal.set(Calendar.SECOND, (int) (autoTime % 60));
- autoTime = autoTime / 60;
- timeCal.set(Calendar.MINUTE, (int) (autoTime % 60));
- autoTime = autoTime / 60;
- timeCal.set(Calendar.HOUR_OF_DAY, (int) (autoTime % 24));
- }
- Calendar c = Calendar.getInstance();
- c.setTime(d);
- c.set(Calendar.MILLISECOND, timeCal.get(Calendar.MILLISECOND));
- c.set(Calendar.SECOND, timeCal.get(Calendar.SECOND));
- c.set(Calendar.MINUTE, timeCal.get(Calendar.MINUTE));
- c.set(Calendar.HOUR_OF_DAY, timeCal.get(Calendar.HOUR_OF_DAY));
- d = c.getTime();
- return d;
- }
-
- @Override
- public DateFormat getDateFormat() {
- DateFormat df = null;
- if (getFormat() != null) {
- df = new SimpleDateFormat(getFormat(), LocaleThreadLocal.get());
- }
- else {
- if (isHasDate() && !isHasTime()) {
- df = DateFormat.getDateInstance(DateFormat.MEDIUM, LocaleThreadLocal.get());
- }
- else if (!isHasDate() && isHasTime()) {
- df = DateFormat.getTimeInstance(DateFormat.SHORT, LocaleThreadLocal.get());
- }
- else {
- df = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, LocaleThreadLocal.get());
- }
- df.setLenient(true);
- }
- return df;
- }
-
- @Override
- public DateFormat getIsolatedDateFormat() {
- DateFormat f = getDateFormat();
- if (f instanceof SimpleDateFormat) {
- String pat = ((SimpleDateFormat) f).toPattern();
- int h = pat.toLowerCase().indexOf('h');
- if (h >= 0) {
- try {
- return new SimpleDateFormat(pat.substring(0, h).trim(), LocaleThreadLocal.get());
- }
- catch (Throwable t) {
- LOG.error("could not isolate date pattern from '" + pat + "'", t);
- }
- }
- }
- return f;
- }
-
- @Override
- public DateFormat getIsolatedTimeFormat() {
- DateFormat f = getDateFormat();
- if (f instanceof SimpleDateFormat) {
- String pat = ((SimpleDateFormat) f).toPattern();
- int h = pat.toLowerCase().indexOf('h');
- if (h >= 0) {
- try {
- return new SimpleDateFormat(pat.substring(h).trim(), LocaleThreadLocal.get());
- }
- catch (Throwable t) {
- LOG.error("could not isolate time pattern from '" + pat + "'", t);
- }
- }
- }
- return null;
- }
-
- /**
- * parse date only
- */
- private Date parseDateInternal(String text, DateFormat defaultFormat) throws ProcessingException {
- Date retVal = null;
- BooleanHolder includesTime = new BooleanHolder(false);
- Matcher verboseDeltaMatcher = Pattern.compile("([+-])([0-9]+)").matcher(text);
- if (verboseDeltaMatcher.matches()) {
- int i = Integer.parseInt(verboseDeltaMatcher.group(2));
- if (verboseDeltaMatcher.group(1).equals("-")) {
- i = -i;
- }
- Calendar cal = Calendar.getInstance();
- cal.setTime(new Date());
- cal.add(Calendar.DATE, i);
- retVal = cal.getTime();
- }
- else {
- retVal = parseDateFormatsInternal(text, defaultFormat, includesTime);
- if (retVal == null) {
- throw new ProcessingException(ScoutTexts.get("InvalidValueMessageX", text));
- }
- }
- // range check -2000 ... +9000
- Calendar cal = Calendar.getInstance();
- cal.setTime(retVal);
- if (cal.get(Calendar.YEAR) < -2000) {
- cal.set(Calendar.YEAR, -2000);
- }
- if (cal.get(Calendar.YEAR) > 9000) {
- cal.set(Calendar.YEAR, 9000);
- }
- retVal = cal.getTime();
- //adapt time
- retVal = applyAutoTime(retVal);
- return retVal;
- }
-
- /**
- * parse date and time
- */
- private Date parseDateTimeInternal(String text, DateFormat defaultFormat) throws ProcessingException {
- Date retVal = null;
- if (text != null && text.trim().length() == 0) {
- text = null;
- }
- if (text == null) {
- return retVal;
- }
- BooleanHolder includesTime = new BooleanHolder(false);
- Matcher verboseDeltaMatcher = Pattern.compile("([+-])([0-9]+)").matcher(text);
- if (verboseDeltaMatcher.matches()) {
- int i = Integer.parseInt(verboseDeltaMatcher.group(2));
- if (verboseDeltaMatcher.group(1).equals("-")) {
- i = -i;
- }
- Calendar cal = Calendar.getInstance();
- cal.setTime(new Date());
- cal.add(Calendar.DATE, i);
- retVal = cal.getTime();
- }
- else {
- retVal = parseDateTimeFormatsInternal(text, defaultFormat, includesTime);
- if (retVal == null) {
- throw new ProcessingException(ScoutTexts.get("InvalidValueMessageX", text));
- }
- }
- // range check -2000 ... +9000
- Calendar cal = Calendar.getInstance();
- cal.setTime(retVal);
- if (cal.get(Calendar.YEAR) < -2000) {
- cal.set(Calendar.YEAR, -2000);
- }
- if (cal.get(Calendar.YEAR) > 9000) {
- cal.set(Calendar.YEAR, 9000);
- }
- retVal = cal.getTime();
- if (!includesTime.getValue()) {
- retVal = applyAutoTime(retVal);
- }
- return retVal;
- }
-
- /**
- * parse time only
- */
- private Date parseTimeInternal(String text, DateFormat defaultFormat) throws ProcessingException {
- Date retVal = null;
- if (text != null && text.trim().length() == 0) {
- text = null;
- }
- if (text == null) {
- return retVal;
- }
- BooleanHolder includesTime = new BooleanHolder(false);
- retVal = parseTimeFormatsInternal(text, defaultFormat, includesTime);
- if (retVal == null) {
- throw new ProcessingException(ScoutTexts.get("InvalidValueMessageX", text));
- }
- // range check -2000 ... +9000
- Calendar cal = Calendar.getInstance();
- cal.setTime(retVal);
- if (cal.get(Calendar.YEAR) < -2000) {
- cal.set(Calendar.YEAR, -2000);
- }
- if (cal.get(Calendar.YEAR) > 9000) {
- cal.set(Calendar.YEAR, 9000);
- }
- retVal = cal.getTime();
- // truncate value
- DateFormat df = getDateFormat();
- try {
- //re-set the year, since it might have been truncated to previous century, ticket 87172
- cal = Calendar.getInstance();
- cal.setTime(retVal);
- int year = cal.get(Calendar.YEAR);
- retVal = df.parse(df.format(retVal));
- cal.setTime(retVal);
- cal.set(Calendar.YEAR, year);
- retVal = cal.getTime();
- }
- catch (ParseException e) {
- throw new ProcessingException(ScoutTexts.get("InvalidValueMessageX", text), e);
- }
- return retVal;
- }
-
- private Date parseDateFormatsInternal(String text, DateFormat defaultFormat, BooleanHolder includesTime) {
- Date d;
- if (defaultFormat != null) {
- d = parseHelper(defaultFormat, text, includesTime);
- if (d != null) {
- return d;
- }
- }
- StringBuffer dateFormat = new StringBuffer();
- if (text.matches("[0-9]{6}")) {
- DateFormat templateFmt = DateFormat.getDateInstance(DateFormat.SHORT, LocaleThreadLocal.get());
- if (templateFmt instanceof SimpleDateFormat) {
- String pattern = ((SimpleDateFormat) templateFmt).toPattern();
- for (char c : pattern.toCharArray()) {
- if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) {
- dateFormat.append(c);
- }
- }
- d = parseHelper(new SimpleDateFormat(dateFormat.toString(), LocaleThreadLocal.get()), text, includesTime);
- //no further checks
- return d;
- }
- }
- else if (text.matches("[0-9]{8}")) {
- DateFormat templateFmt = DateFormat.getDateInstance(DateFormat.MEDIUM, LocaleThreadLocal.get());
- if (templateFmt instanceof SimpleDateFormat) {
- String pattern = ((SimpleDateFormat) templateFmt).toPattern();
- for (char c : pattern.toCharArray()) {
- if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) {
- dateFormat.append(c);
- }
- }
- d = parseHelper(new SimpleDateFormat(dateFormat.toString(), LocaleThreadLocal.get()), text, includesTime);
- //no further checks
- return d;
- }
- }
- d = parseHelper(DateFormat.getDateInstance(DateFormat.SHORT, LocaleThreadLocal.get()), text, includesTime);
- if (d != null) {
- return d;
- }
- d = parseHelper(DateFormat.getDateInstance(DateFormat.MEDIUM, LocaleThreadLocal.get()), text, includesTime);
- if (d != null) {
- return d;
- }
- d = parseHelper(DateFormat.getDateInstance(DateFormat.LONG, LocaleThreadLocal.get()), text, includesTime);
- if (d != null) {
- return d;
- }
- //add convenience patterns for english locales
- if (LocaleThreadLocal.get().getLanguage().equals("en")) {
- d = parseHelper(new SimpleDateFormat("M / d / yy", LocaleThreadLocal.get()), text, includesTime);
- if (d != null) {
- return d;
- }
- d = parseHelper(new SimpleDateFormat("MMM d,yyyy", LocaleThreadLocal.get()), text, includesTime);
- if (d != null) {
- return d;
- }
- d = parseHelper(new SimpleDateFormat("MMMM d,yyyy", LocaleThreadLocal.get()), text, includesTime);
- if (d != null) {
- return d;
- }
- }
- return null;
- }
-
-/*
- d=parseHelper(df, text, includesTime);
- if(d!=null) return d;
-*/
- private Date parseDateTimeFormatsInternal(String text, DateFormat defaultFormat, BooleanHolder includesTime) {
- Date d = null;
- if (defaultFormat != null) {
- d = parseHelper(defaultFormat, text, includesTime);
- if (d != null) {
- return d;
- }
- }
- StringBuffer dateFormat = new StringBuffer();
- if (text.matches("[0-9]{6}")) {
- DateFormat templateFmt = DateFormat.getDateInstance(DateFormat.SHORT, LocaleThreadLocal.get());
- if (templateFmt instanceof SimpleDateFormat) {
- String pattern = ((SimpleDateFormat) templateFmt).toPattern();
- for (char c : pattern.toCharArray()) {
- if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) {
- dateFormat.append(c);
- }
- }
- d = parseHelper(new SimpleDateFormat(dateFormat.toString(), LocaleThreadLocal.get()), text, includesTime);
- //no further checks
- return d;
- }
- }
- else if (text.matches("[0-9]{8}")) {
- DateFormat templateFmt = DateFormat.getDateInstance(DateFormat.MEDIUM, LocaleThreadLocal.get());
- if (templateFmt instanceof SimpleDateFormat) {
- String pattern = ((SimpleDateFormat) templateFmt).toPattern();
- for (char c : pattern.toCharArray()) {
- if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) {
- dateFormat.append(c);
- }
- }
- d = parseHelper(new SimpleDateFormat(dateFormat.toString(), LocaleThreadLocal.get()), text, includesTime);
- //no further checks
- return d;
- }
- }
- //time
- d = parseHelper(DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, LocaleThreadLocal.get()), text, includesTime);
- if (d != null) {
- return d;
- }
- d = parseHelper(DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM, LocaleThreadLocal.get()), text, includesTime);
- if (d != null) {
- return d;
- }
- d = parseHelper(new SimpleDateFormat(((SimpleDateFormat) DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM, LocaleThreadLocal.get())).toPattern() + ":SSS", LocaleThreadLocal.get()), text, includesTime);
- if (d != null) {
- return d;
- }
- d = parseHelper(DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.LONG, LocaleThreadLocal.get()), text, includesTime);
- if (d != null) {
- return d;
- }
- d = parseHelper(DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT, LocaleThreadLocal.get()), text, includesTime);
- if (d != null) {
- return d;
- }
- d = parseHelper(DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM, LocaleThreadLocal.get()), text, includesTime);
- if (d != null) {
- return d;
- }
- d = parseHelper(DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.LONG, LocaleThreadLocal.get()), text, includesTime);
- if (d != null) {
- return d;
- }
- d = parseHelper(DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.SHORT, LocaleThreadLocal.get()), text, includesTime);
- if (d != null) {
- return d;
- }
- d = parseHelper(DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.MEDIUM, LocaleThreadLocal.get()), text, includesTime);
- if (d != null) {
- return d;
- }
- d = parseHelper(DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, LocaleThreadLocal.get()), text, includesTime);
- if (d != null) {
- return d;
- }
- for (DateFormat t : new DateFormat[]{
- DateFormat.getDateInstance(DateFormat.SHORT, LocaleThreadLocal.get()),
- DateFormat.getDateInstance(DateFormat.MEDIUM, LocaleThreadLocal.get()),
- DateFormat.getDateInstance(DateFormat.LONG, LocaleThreadLocal.get())}) {
- if (t instanceof SimpleDateFormat) {
- d = parseHelper(new SimpleDateFormat(((SimpleDateFormat) t).toPattern() + " h:mm a", LocaleThreadLocal.get()), text, includesTime);
- if (d != null) {
- return d;
- }
- d = parseHelper(new SimpleDateFormat(((SimpleDateFormat) t).toPattern() + " hhmm a", LocaleThreadLocal.get()), text, includesTime);
- if (d != null) {
- return d;
- }
- d = parseHelper(new SimpleDateFormat(((SimpleDateFormat) t).toPattern() + " hmm a", LocaleThreadLocal.get()), text, includesTime);
- if (d != null) {
- return d;
- }
- d = parseHelper(new SimpleDateFormat(((SimpleDateFormat) t).toPattern() + " h a", LocaleThreadLocal.get()), text, includesTime);
- if (d != null) {
- return d;
- }
- d = parseHelper(new SimpleDateFormat(((SimpleDateFormat) t).toPattern() + " h:mma", LocaleThreadLocal.get()), text, includesTime);
- if (d != null) {
- return d;
- }
- d = parseHelper(new SimpleDateFormat(((SimpleDateFormat) t).toPattern() + " hhmma", LocaleThreadLocal.get()), text, includesTime);
- if (d != null) {
- return d;
- }
- d = parseHelper(new SimpleDateFormat(((SimpleDateFormat) t).toPattern() + " ha", LocaleThreadLocal.get()), text, includesTime);
- if (d != null) {
- return d;
- }
- d = parseHelper(new SimpleDateFormat(((SimpleDateFormat) t).toPattern() + " H:mm", LocaleThreadLocal.get()), text, includesTime);
- if (d != null) {
- return d;
- }
- d = parseHelper(new SimpleDateFormat(((SimpleDateFormat) t).toPattern() + " HHmm", LocaleThreadLocal.get()), text, includesTime);
- if (d != null) {
- return d;
- }
- d = parseHelper(new SimpleDateFormat(((SimpleDateFormat) t).toPattern() + " HH", LocaleThreadLocal.get()), text, includesTime);
- if (d != null) {
- return d;
- }
- d = parseHelper(new SimpleDateFormat(((SimpleDateFormat) t).toPattern() + " Hmm", LocaleThreadLocal.get()), text, includesTime);
- if (d != null) {
- return d;
- }
- d = parseHelper(new SimpleDateFormat(((SimpleDateFormat) t).toPattern() + " H", LocaleThreadLocal.get()), text, includesTime);
- if (d != null) {
- return d;
- }
- d = parseHelper(t, text, includesTime);
- if (d != null) {
- return d;
- }
- }
- }
- //date
- //add convenience patterns for english locales
- if (LocaleThreadLocal.get().getLanguage().equals("en")) {
- d = parseHelper(new SimpleDateFormat("M / d / yy", LocaleThreadLocal.get()), text, includesTime);
- if (d != null) {
- return d;
- }
- d = parseHelper(new SimpleDateFormat("MMM d,yyyy", LocaleThreadLocal.get()), text, includesTime);
- if (d != null) {
- return d;
- }
- d = parseHelper(new SimpleDateFormat("MMMM d,yyyy", LocaleThreadLocal.get()), text, includesTime);
- if (d != null) {
- return d;
- }
- }
- return null;
- }
-
- private Date parseTimeFormatsInternal(String text, DateFormat defaultFormat, BooleanHolder includesTime) {
- Date d = null;
- if (defaultFormat != null) {
- d = parseHelper(defaultFormat, text, includesTime);
- if (d != null) {
- return d;
- }
- }
- //
- if (text.matches("[0-9]{3}")) {
- text = "0" + text; // "230" -> 02:30
- }
- if (text.matches("[0-9]{2}")) {
- int hours = Integer.parseInt(text);
- if (hours >= 24) {
- text = "00" + text; // "23" -> 23:00 but "30" -> 00:30
- }
- }
- if (defaultFormat != null) {
- d = parseHelper(defaultFormat, text, includesTime);
- if (d != null) {
- return d;
- }
- }
- d = parseHelper(DateFormat.getTimeInstance(DateFormat.SHORT, LocaleThreadLocal.get()), text, includesTime);
- if (d != null) {
- return d;
- }
- d = parseHelper(new SimpleDateFormat("h:mm a", LocaleThreadLocal.get()), text, includesTime);
- if (d != null) {
- return d;
- }
- d = parseHelper(new SimpleDateFormat("hhmm a", LocaleThreadLocal.get()), text, includesTime);
- if (d != null) {
- return d;
- }
- d = parseHelper(new SimpleDateFormat("hmm a", LocaleThreadLocal.get()), text, includesTime);
- if (d != null) {
- return d;
- }
- d = parseHelper(new SimpleDateFormat("h a", LocaleThreadLocal.get()), text, includesTime);
- if (d != null) {
- return d;
- }
- d = parseHelper(new SimpleDateFormat("h:mma", LocaleThreadLocal.get()), text, includesTime);
- if (d != null) {
- return d;
- }
- d = parseHelper(new SimpleDateFormat("hhmma", LocaleThreadLocal.get()), text, includesTime);
- if (d != null) {
- return d;
- }
- d = parseHelper(new SimpleDateFormat("ha", LocaleThreadLocal.get()), text, includesTime);
- if (d != null) {
- return d;
- }
- d = parseHelper(new SimpleDateFormat("H:mm", LocaleThreadLocal.get()), text, includesTime);
- if (d != null) {
- return d;
- }
- d = parseHelper(new SimpleDateFormat("HHmm", LocaleThreadLocal.get()), text, includesTime);
- if (d != null) {
- return d;
- }
- d = parseHelper(new SimpleDateFormat("HH", LocaleThreadLocal.get()), text, includesTime);
- if (d != null) {
- return d;
- }
- d = parseHelper(new SimpleDateFormat("Hmm", LocaleThreadLocal.get()), text, includesTime);
- if (d != null) {
- return d;
- }
- d = parseHelper(new SimpleDateFormat("H", LocaleThreadLocal.get()), text, includesTime);
- if (d != null) {
- return d;
- }
- return null;
- }
-
- private Date parseHelper(DateFormat df, String text, BooleanHolder includesTime) {
- // >>> ticket #105'126
- if (df instanceof SimpleDateFormat) {
- String pattern = ((SimpleDateFormat) df).toPattern();
- df = new SimpleDateFormat(pattern.replaceAll("yyyy", "yy"), LocaleThreadLocal.get()); // Always use century interpretation
- }
- // <<< ticket #105'126
-
- Date d = null;
- if (d == null) {
- try {
- df.setLenient(false);
- d = df.parse(text);
- }
- catch (ParseException e) {
- //nop
- }
- }
- // Allow "," instead of ".", because some keyboard layouts have a comma instead of
- // a dot on the numeric keypad
- if (d == null) {
- try {
- if (df instanceof SimpleDateFormat) {
- String pattern = ((SimpleDateFormat) df).toPattern();
- if (pattern.contains(".")) {
- SimpleDateFormat df2 = new SimpleDateFormat(pattern.replace(".", ","), LocaleThreadLocal.get());
- df2.setLenient(false);
- d = df2.parse(text);
- }
- }
- }
- catch (ParseException e) {
- //nop
- }
- }
- //eval
- if (d != null) {
- if (df instanceof SimpleDateFormat) {
- String pattern = ((SimpleDateFormat) df).toPattern();
- if (pattern.matches(".*[hHM].*")) {
- includesTime.setValue(true);
- }
- }
- else {
- includesTime.setValue(true);
- }
- }
- return d;
- }
-
- private class P_UIFacade implements IDateFieldUIFacade {
-
- @Override
- public boolean setDateTextFromUI(String newDate) {
- if (!isHasDate()) {
- //nop
- return false;
- }
- if (newDate != null && newDate.length() == 0) {
- newDate = null;
- }
- if (!isHasTime()) {
- return parseValue(newDate);
- }
- if (newDate == null) {
- return parseValue(null);
- }
- //date part only
- try {
- PARSE_CONTEXT.set(ParseContext.Date);
- return parseValue(newDate);
- }
- finally {
- PARSE_CONTEXT.set(null);
- }
- }
-
- @Override
- public boolean setTimeTextFromUI(String newTime) {
- if (!isHasTime()) {
- //nop
- return false;
- }
- if (newTime != null && newTime.length() == 0) {
- newTime = null;
- }
- if (!isHasDate()) {
- return parseValue(newTime);
- }
- //time part
- try {
- PARSE_CONTEXT.set(ParseContext.Time);
- return parseValue(newTime);
- }
- finally {
- PARSE_CONTEXT.set(null);
- }
- }
-
- @Override
- public boolean setDateTimeTextFromUI(String newText) {
- if (newText != null && newText.length() == 0) {
- newText = null;
- }
- // parse always, validity might change even if text is same
- return parseValue(newText);
- }
-
- @Override
- public void setDateFromUI(Date d) {
- try {
- if (d != null) {
- // preserve time
- Date oldDate = getValue();
- if (oldDate != null) {
- Calendar calOld = Calendar.getInstance();
- calOld.setTime(oldDate);
- Calendar calNew = Calendar.getInstance();
- calNew.setTime(d);
- calNew.set(Calendar.HOUR, calOld.get(Calendar.HOUR));
- calNew.set(Calendar.HOUR_OF_DAY, calOld.get(Calendar.HOUR_OF_DAY));
- calNew.set(Calendar.MINUTE, calOld.get(Calendar.MINUTE));
- calNew.set(Calendar.SECOND, calOld.get(Calendar.SECOND));
- calNew.set(Calendar.MILLISECOND, calOld.get(Calendar.MILLISECOND));
- d = calNew.getTime();
- }
- else {
- d = applyAutoTime(d);
- }
- }
- setValue(d);
- }
- catch (Throwable t) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Unexpected", t));
- }
- }
-
- @Override
- public void setTimeFromUI(Date d) {
- try {
- Date oldDate = getValue();
- if (d != null) {
- if (oldDate == null) {
- // use today's date
- oldDate = new Date();
- }
- // preserve date
- Calendar calOld = Calendar.getInstance();
- calOld.setTime(oldDate);
- Calendar calNew = Calendar.getInstance();
- calNew.setTime(d);
- calNew.set(Calendar.YEAR, calOld.get(Calendar.YEAR));
- calNew.set(Calendar.MONTH, calOld.get(Calendar.MONTH));
- calNew.set(Calendar.DATE, calOld.get(Calendar.DATE));
- d = calNew.getTime();
- }
- else if (isHasDate() && oldDate != null) {
- d = applyAutoTime(oldDate);
- }
- setValue(d);
- }
- catch (Throwable t) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Unexpected", t));
- }
- }
-
- @Override
- public void setDateTimeFromUI(Date d) {
- try {
- setValue(d);
- }
- catch (Throwable t) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Unexpected", t));
- }
- }
-
- @Override
- public void fireDateShiftActionFromUI(int level, int value) {
- try {
- execShiftDate(level, value);
- }
- catch (ProcessingException e) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- catch (Throwable t) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Unexpected", t));
- }
- }
-
- @Override
- public void fireTimeShiftActionFromUI(int level, int value) {
- try {
- execShiftTime(level, value);
- }
- catch (ProcessingException e) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- catch (Throwable t) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Unexpected", t));
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.datefield;
+
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.scout.commons.DateUtility;
+import org.eclipse.scout.commons.LocaleThreadLocal;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.holders.BooleanHolder;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.form.fields.AbstractValueField;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
+import org.eclipse.scout.service.SERVICES;
+
+/**
+ * Default hasDate=true and hasTime=false
+ */
+public abstract class AbstractDateField extends AbstractValueField<Date> implements IDateField {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractDateField.class);
+
+ private static enum ParseContext {
+ Date, Time
+ }
+
+ private static final ThreadLocal<ParseContext> PARSE_CONTEXT = new ThreadLocal<AbstractDateField.ParseContext>();
+
+ private IDateFieldUIFacade m_uiFacade;
+ private String m_format;
+ private long m_autoTimeMillis;
+
+ public AbstractDateField() {
+ this(true);
+ }
+
+ public AbstractDateField(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ /*
+ * Configuration
+ */
+ @ConfigProperty(ConfigProperty.STRING)
+ @Order(230)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredFormat() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(240)
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredHasDate() {
+ return true;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(241)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredHasTime() {
+ return false;
+ }
+
+ /**
+ * When a date without time is picked, this time value is used as hh/mm/ss.
+ */
+ @ConfigProperty(ConfigProperty.LONG)
+ @Order(270)
+ @ConfigPropertyValue("0")
+ protected long getConfiguredAutoTimeMillis() {
+ return 0;
+ }
+
+ /**
+ * Depending whether subclass overrides this method
+ * <p>
+ * Default is as follows<br>
+ * Level 0: shift day up/down [UP, DOWN]<br>
+ * Level 1: shift month up/down [shift-UP,shift-DOWN]<br>
+ * Level 2: shift year up/down [ctrl-UP,ctrl-DOWN]
+ * <p>
+ * see {@link #adjustDate(int, int, int)}
+ */
+ protected void execShiftDate(int level, int value) throws ProcessingException {
+ switch (level) {
+ case 0: {
+ adjustDate(value, 0, 0);
+ break;
+ }
+ case 1: {
+ adjustDate(0, value, 0);
+ break;
+ }
+ case 2: {
+ adjustDate(0, 0, value);
+ break;
+ }
+ }
+ }
+
+ /**
+ * Depending whether subclass overrides this method
+ * <p>
+ * Default is as follows<br>
+ * Level 0: shift minute up/down [UP, DOWN]<br>
+ * Level 1: shift hour up/down [shift-UP, shift-DOWN]<br>
+ * Level 2: nop [ctrl-UP, ctrl-DOWN]<br>
+ * <p>
+ * see {@link #adjustDate(int, int, int)}
+ */
+ protected void execShiftTime(int level, int value) throws ProcessingException {
+ switch (level) {
+ case 0: {
+ adjustTime(value, 0, 0);
+ break;
+ }
+ case 1: {
+ adjustTime(0, value, 0);
+ break;
+ }
+ case 2: {
+ adjustTime(0, 0, value);
+ break;
+ }
+ }
+ }
+
+ @Override
+ protected void initConfig() {
+ m_uiFacade = new P_UIFacade();
+ super.initConfig();
+ setFormat(getConfiguredFormat());
+ setHasDate(getConfiguredHasDate());
+ setHasTime(getConfiguredHasTime());
+ setAutoTimeMillis(getConfiguredAutoTimeMillis());
+ }
+
+ @Override
+ public void setFormat(String s) {
+ m_format = s;
+ if (isInitialized()) {
+ if (isAutoDisplayText()) {
+ setDisplayText(execFormatValue(getValue()));
+ }
+ }
+ }
+
+ @Override
+ public String getFormat() {
+ return m_format;
+ }
+
+ @Override
+ public boolean isHasTime() {
+ return propertySupport.getPropertyBool(PROP_HAS_TIME);
+ }
+
+ @Override
+ public void setHasTime(boolean b) {
+ propertySupport.setPropertyBool(PROP_HAS_TIME, b);
+ if (isInitialized()) {
+ setValue(getValue());
+ }
+ }
+
+ @Override
+ public boolean isHasDate() {
+ return propertySupport.getPropertyBool(PROP_HAS_DATE);
+ }
+
+ @Override
+ public void setHasDate(boolean b) {
+ propertySupport.setPropertyBool(PROP_HAS_DATE, b);
+ if (isInitialized()) {
+ setValue(getValue());
+ }
+ }
+
+ @Override
+ public void setAutoTimeMillis(long l) {
+ m_autoTimeMillis = l;
+ }
+
+ @Override
+ public void setAutoTimeMillis(int hour, int minute, int second) {
+ setAutoTimeMillis(((hour * 60L + minute) * 60L + second) * 1000L);
+ }
+
+ @Override
+ public long getAutoTimeMillis() {
+ return m_autoTimeMillis;
+ }
+
+ @Override
+ public void adjustDate(int days, int months, int years) {
+ Date d = getValue();
+ if (d == null) {
+ d = new Date();
+ d = applyAutoTime(d);
+ }
+ else {
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(d);
+ cal.add(Calendar.DATE, days);
+ cal.add(Calendar.MONTH, months);
+ cal.add(Calendar.YEAR, years);
+ d = cal.getTime();
+ }
+ setValue(d);
+ }
+
+ @Override
+ public void adjustTime(int minutes, int hours, int reserved) {
+ Date d = getValue();
+ if (d == null) {
+ d = new Date();
+ d = applyAutoTime(d);
+ }
+ else {
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(d);
+ cal.add(Calendar.MINUTE, minutes);
+ cal.add(Calendar.HOUR_OF_DAY, hours);
+ d = cal.getTime();
+ }
+ setValue(d);
+ }
+
+ @Override
+ public IDateFieldUIFacade getUIFacade() {
+ return m_uiFacade;
+ }
+
+ // format value for display
+ @Override
+ protected String formatValueInternal(Date validValue) {
+ if (validValue == null) {
+ return "";
+ }
+ DateFormat df = getDateFormat();
+ String displayValue = df.format(validValue);
+ return displayValue;
+ }
+
+ // validate value for ranges, mandatory, ...
+ @Override
+ protected Date validateValueInternal(Date rawValue) throws ProcessingException {
+ //legacy support
+ Object legacyValue = rawValue;
+ if (legacyValue instanceof Number) {
+ rawValue = DateUtility.convertDoubleTimeToDate((Number) legacyValue);
+ }
+ Date validValue = null;
+ rawValue = super.validateValueInternal(rawValue);
+ try {
+ // apply format
+ DateFormat df = getDateFormat();
+ rawValue = df.parse(df.format(rawValue));
+ }
+ catch (Throwable t) {
+ // nop, take raw value
+ }
+ validValue = rawValue;
+ return validValue;
+ }
+
+ /**
+ * convert string to a real Date
+ */
+ @Override
+ protected Date parseValueInternal(String text) throws ProcessingException {
+ if (text != null && text.trim().length() == 0) {
+ text = null;
+ }
+ if (text == null) {
+ return null;
+ }
+ Date d = null;
+ boolean customFormat = (getFormat() != null);
+ if (isHasDate() && isHasTime()) {
+ ParseContext pctx = PARSE_CONTEXT.get();
+ if (pctx == null) {
+ d = parseDateTimeInternal(text, customFormat ? getDateFormat() : null);
+ }
+ else if (pctx == ParseContext.Date) {
+ d = parseDateInternal(text, customFormat ? getIsolatedDateFormat() : null);
+ Date currentValue = getValue();
+ if (currentValue != null) {
+ d = DateUtility.createDateTime(d, currentValue);
+ }
+ }
+ else if (pctx == ParseContext.Time) {
+ d = parseTimeInternal(text, customFormat ? getIsolatedTimeFormat() : null);
+ Date currentValue = getValue();
+ if (currentValue == null) {
+ currentValue = new Date();
+ }
+ d = DateUtility.createDateTime(currentValue, d);
+ }
+ }
+ else if (isHasDate() && !isHasTime()) {
+ d = parseDateInternal(text, customFormat ? getDateFormat() : null);
+ }
+ else if (!isHasDate() && isHasTime()) {
+ d = parseTimeInternal(text, customFormat ? getDateFormat() : null);
+ }
+ // truncate value
+ DateFormat df = getDateFormat();
+ try {
+ //preserve the year, since it might have been truncated to previous century, ticket 87172
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(d);
+ int year = cal.get(Calendar.YEAR);
+ d = df.parse(df.format(d));
+ cal.setTime(d);
+ cal.set(Calendar.YEAR, year);
+ d = cal.getTime();
+ }
+ catch (ParseException e) {
+ throw new ProcessingException(ScoutTexts.get("InvalidValueMessageX", text), e);
+ }
+ return d;
+ }
+
+ @Override
+ public Double getTimeValue() {
+ return DateUtility.convertDateToDoubleTime(getValue());
+ }
+
+ @Override
+ public void setTimeValue(Double d) {
+ setValue(DateUtility.convertDoubleTimeToDate(d));
+ }
+
+ /**
+ * @since Build 200
+ * @rn imo, 06.04.2006, only adjust date not date/time
+ */
+ private Date applyAutoTime(Date d) {
+ if (d == null) {
+ return d;
+ }
+ Calendar timeCal = Calendar.getInstance();
+ long autoTime = getAutoTimeMillis();
+ if (autoTime == 0L && isHasTime()) {
+ // use current time
+ }
+ else {
+ timeCal.set(Calendar.MILLISECOND, (int) (autoTime % 1000));
+ autoTime = autoTime / 1000;
+ timeCal.set(Calendar.SECOND, (int) (autoTime % 60));
+ autoTime = autoTime / 60;
+ timeCal.set(Calendar.MINUTE, (int) (autoTime % 60));
+ autoTime = autoTime / 60;
+ timeCal.set(Calendar.HOUR_OF_DAY, (int) (autoTime % 24));
+ }
+ Calendar c = Calendar.getInstance();
+ c.setTime(d);
+ c.set(Calendar.MILLISECOND, timeCal.get(Calendar.MILLISECOND));
+ c.set(Calendar.SECOND, timeCal.get(Calendar.SECOND));
+ c.set(Calendar.MINUTE, timeCal.get(Calendar.MINUTE));
+ c.set(Calendar.HOUR_OF_DAY, timeCal.get(Calendar.HOUR_OF_DAY));
+ d = c.getTime();
+ return d;
+ }
+
+ @Override
+ public DateFormat getDateFormat() {
+ DateFormat df = null;
+ if (getFormat() != null) {
+ df = new SimpleDateFormat(getFormat(), LocaleThreadLocal.get());
+ }
+ else {
+ if (isHasDate() && !isHasTime()) {
+ df = DateFormat.getDateInstance(DateFormat.MEDIUM, LocaleThreadLocal.get());
+ }
+ else if (!isHasDate() && isHasTime()) {
+ df = DateFormat.getTimeInstance(DateFormat.SHORT, LocaleThreadLocal.get());
+ }
+ else {
+ df = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, LocaleThreadLocal.get());
+ }
+ df.setLenient(true);
+ }
+ return df;
+ }
+
+ @Override
+ public DateFormat getIsolatedDateFormat() {
+ DateFormat f = getDateFormat();
+ if (f instanceof SimpleDateFormat) {
+ String pat = ((SimpleDateFormat) f).toPattern();
+ int h = pat.toLowerCase().indexOf('h');
+ if (h >= 0) {
+ try {
+ return new SimpleDateFormat(pat.substring(0, h).trim(), LocaleThreadLocal.get());
+ }
+ catch (Throwable t) {
+ LOG.error("could not isolate date pattern from '" + pat + "'", t);
+ }
+ }
+ }
+ return f;
+ }
+
+ @Override
+ public DateFormat getIsolatedTimeFormat() {
+ DateFormat f = getDateFormat();
+ if (f instanceof SimpleDateFormat) {
+ String pat = ((SimpleDateFormat) f).toPattern();
+ int h = pat.toLowerCase().indexOf('h');
+ if (h >= 0) {
+ try {
+ return new SimpleDateFormat(pat.substring(h).trim(), LocaleThreadLocal.get());
+ }
+ catch (Throwable t) {
+ LOG.error("could not isolate time pattern from '" + pat + "'", t);
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * parse date only
+ */
+ private Date parseDateInternal(String text, DateFormat defaultFormat) throws ProcessingException {
+ Date retVal = null;
+ BooleanHolder includesTime = new BooleanHolder(false);
+ Matcher verboseDeltaMatcher = Pattern.compile("([+-])([0-9]+)").matcher(text);
+ if (verboseDeltaMatcher.matches()) {
+ int i = Integer.parseInt(verboseDeltaMatcher.group(2));
+ if (verboseDeltaMatcher.group(1).equals("-")) {
+ i = -i;
+ }
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(new Date());
+ cal.add(Calendar.DATE, i);
+ retVal = cal.getTime();
+ }
+ else {
+ retVal = parseDateFormatsInternal(text, defaultFormat, includesTime);
+ if (retVal == null) {
+ throw new ProcessingException(ScoutTexts.get("InvalidValueMessageX", text));
+ }
+ }
+ // range check -2000 ... +9000
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(retVal);
+ if (cal.get(Calendar.YEAR) < -2000) {
+ cal.set(Calendar.YEAR, -2000);
+ }
+ if (cal.get(Calendar.YEAR) > 9000) {
+ cal.set(Calendar.YEAR, 9000);
+ }
+ retVal = cal.getTime();
+ //adapt time
+ retVal = applyAutoTime(retVal);
+ return retVal;
+ }
+
+ /**
+ * parse date and time
+ */
+ private Date parseDateTimeInternal(String text, DateFormat defaultFormat) throws ProcessingException {
+ Date retVal = null;
+ if (text != null && text.trim().length() == 0) {
+ text = null;
+ }
+ if (text == null) {
+ return retVal;
+ }
+ BooleanHolder includesTime = new BooleanHolder(false);
+ Matcher verboseDeltaMatcher = Pattern.compile("([+-])([0-9]+)").matcher(text);
+ if (verboseDeltaMatcher.matches()) {
+ int i = Integer.parseInt(verboseDeltaMatcher.group(2));
+ if (verboseDeltaMatcher.group(1).equals("-")) {
+ i = -i;
+ }
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(new Date());
+ cal.add(Calendar.DATE, i);
+ retVal = cal.getTime();
+ }
+ else {
+ retVal = parseDateTimeFormatsInternal(text, defaultFormat, includesTime);
+ if (retVal == null) {
+ throw new ProcessingException(ScoutTexts.get("InvalidValueMessageX", text));
+ }
+ }
+ // range check -2000 ... +9000
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(retVal);
+ if (cal.get(Calendar.YEAR) < -2000) {
+ cal.set(Calendar.YEAR, -2000);
+ }
+ if (cal.get(Calendar.YEAR) > 9000) {
+ cal.set(Calendar.YEAR, 9000);
+ }
+ retVal = cal.getTime();
+ if (!includesTime.getValue()) {
+ retVal = applyAutoTime(retVal);
+ }
+ return retVal;
+ }
+
+ /**
+ * parse time only
+ */
+ private Date parseTimeInternal(String text, DateFormat defaultFormat) throws ProcessingException {
+ Date retVal = null;
+ if (text != null && text.trim().length() == 0) {
+ text = null;
+ }
+ if (text == null) {
+ return retVal;
+ }
+ BooleanHolder includesTime = new BooleanHolder(false);
+ retVal = parseTimeFormatsInternal(text, defaultFormat, includesTime);
+ if (retVal == null) {
+ throw new ProcessingException(ScoutTexts.get("InvalidValueMessageX", text));
+ }
+ // range check -2000 ... +9000
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(retVal);
+ if (cal.get(Calendar.YEAR) < -2000) {
+ cal.set(Calendar.YEAR, -2000);
+ }
+ if (cal.get(Calendar.YEAR) > 9000) {
+ cal.set(Calendar.YEAR, 9000);
+ }
+ retVal = cal.getTime();
+ // truncate value
+ DateFormat df = getDateFormat();
+ try {
+ //re-set the year, since it might have been truncated to previous century, ticket 87172
+ cal = Calendar.getInstance();
+ cal.setTime(retVal);
+ int year = cal.get(Calendar.YEAR);
+ retVal = df.parse(df.format(retVal));
+ cal.setTime(retVal);
+ cal.set(Calendar.YEAR, year);
+ retVal = cal.getTime();
+ }
+ catch (ParseException e) {
+ throw new ProcessingException(ScoutTexts.get("InvalidValueMessageX", text), e);
+ }
+ return retVal;
+ }
+
+ private Date parseDateFormatsInternal(String text, DateFormat defaultFormat, BooleanHolder includesTime) {
+ Date d;
+ if (defaultFormat != null) {
+ d = parseHelper(defaultFormat, text, includesTime);
+ if (d != null) {
+ return d;
+ }
+ }
+ StringBuffer dateFormat = new StringBuffer();
+ if (text.matches("[0-9]{6}")) {
+ DateFormat templateFmt = DateFormat.getDateInstance(DateFormat.SHORT, LocaleThreadLocal.get());
+ if (templateFmt instanceof SimpleDateFormat) {
+ String pattern = ((SimpleDateFormat) templateFmt).toPattern();
+ for (char c : pattern.toCharArray()) {
+ if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) {
+ dateFormat.append(c);
+ }
+ }
+ d = parseHelper(new SimpleDateFormat(dateFormat.toString(), LocaleThreadLocal.get()), text, includesTime);
+ //no further checks
+ return d;
+ }
+ }
+ else if (text.matches("[0-9]{8}")) {
+ DateFormat templateFmt = DateFormat.getDateInstance(DateFormat.MEDIUM, LocaleThreadLocal.get());
+ if (templateFmt instanceof SimpleDateFormat) {
+ String pattern = ((SimpleDateFormat) templateFmt).toPattern();
+ for (char c : pattern.toCharArray()) {
+ if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) {
+ dateFormat.append(c);
+ }
+ }
+ d = parseHelper(new SimpleDateFormat(dateFormat.toString(), LocaleThreadLocal.get()), text, includesTime);
+ //no further checks
+ return d;
+ }
+ }
+ d = parseHelper(DateFormat.getDateInstance(DateFormat.SHORT, LocaleThreadLocal.get()), text, includesTime);
+ if (d != null) {
+ return d;
+ }
+ d = parseHelper(DateFormat.getDateInstance(DateFormat.MEDIUM, LocaleThreadLocal.get()), text, includesTime);
+ if (d != null) {
+ return d;
+ }
+ d = parseHelper(DateFormat.getDateInstance(DateFormat.LONG, LocaleThreadLocal.get()), text, includesTime);
+ if (d != null) {
+ return d;
+ }
+ //add convenience patterns for english locales
+ if (LocaleThreadLocal.get().getLanguage().equals("en")) {
+ d = parseHelper(new SimpleDateFormat("M / d / yy", LocaleThreadLocal.get()), text, includesTime);
+ if (d != null) {
+ return d;
+ }
+ d = parseHelper(new SimpleDateFormat("MMM d,yyyy", LocaleThreadLocal.get()), text, includesTime);
+ if (d != null) {
+ return d;
+ }
+ d = parseHelper(new SimpleDateFormat("MMMM d,yyyy", LocaleThreadLocal.get()), text, includesTime);
+ if (d != null) {
+ return d;
+ }
+ }
+ return null;
+ }
+
+/*
+ d=parseHelper(df, text, includesTime);
+ if(d!=null) return d;
+*/
+ private Date parseDateTimeFormatsInternal(String text, DateFormat defaultFormat, BooleanHolder includesTime) {
+ Date d = null;
+ if (defaultFormat != null) {
+ d = parseHelper(defaultFormat, text, includesTime);
+ if (d != null) {
+ return d;
+ }
+ }
+ StringBuffer dateFormat = new StringBuffer();
+ if (text.matches("[0-9]{6}")) {
+ DateFormat templateFmt = DateFormat.getDateInstance(DateFormat.SHORT, LocaleThreadLocal.get());
+ if (templateFmt instanceof SimpleDateFormat) {
+ String pattern = ((SimpleDateFormat) templateFmt).toPattern();
+ for (char c : pattern.toCharArray()) {
+ if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) {
+ dateFormat.append(c);
+ }
+ }
+ d = parseHelper(new SimpleDateFormat(dateFormat.toString(), LocaleThreadLocal.get()), text, includesTime);
+ //no further checks
+ return d;
+ }
+ }
+ else if (text.matches("[0-9]{8}")) {
+ DateFormat templateFmt = DateFormat.getDateInstance(DateFormat.MEDIUM, LocaleThreadLocal.get());
+ if (templateFmt instanceof SimpleDateFormat) {
+ String pattern = ((SimpleDateFormat) templateFmt).toPattern();
+ for (char c : pattern.toCharArray()) {
+ if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) {
+ dateFormat.append(c);
+ }
+ }
+ d = parseHelper(new SimpleDateFormat(dateFormat.toString(), LocaleThreadLocal.get()), text, includesTime);
+ //no further checks
+ return d;
+ }
+ }
+ //time
+ d = parseHelper(DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, LocaleThreadLocal.get()), text, includesTime);
+ if (d != null) {
+ return d;
+ }
+ d = parseHelper(DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM, LocaleThreadLocal.get()), text, includesTime);
+ if (d != null) {
+ return d;
+ }
+ d = parseHelper(new SimpleDateFormat(((SimpleDateFormat) DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM, LocaleThreadLocal.get())).toPattern() + ":SSS", LocaleThreadLocal.get()), text, includesTime);
+ if (d != null) {
+ return d;
+ }
+ d = parseHelper(DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.LONG, LocaleThreadLocal.get()), text, includesTime);
+ if (d != null) {
+ return d;
+ }
+ d = parseHelper(DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT, LocaleThreadLocal.get()), text, includesTime);
+ if (d != null) {
+ return d;
+ }
+ d = parseHelper(DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM, LocaleThreadLocal.get()), text, includesTime);
+ if (d != null) {
+ return d;
+ }
+ d = parseHelper(DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.LONG, LocaleThreadLocal.get()), text, includesTime);
+ if (d != null) {
+ return d;
+ }
+ d = parseHelper(DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.SHORT, LocaleThreadLocal.get()), text, includesTime);
+ if (d != null) {
+ return d;
+ }
+ d = parseHelper(DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.MEDIUM, LocaleThreadLocal.get()), text, includesTime);
+ if (d != null) {
+ return d;
+ }
+ d = parseHelper(DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, LocaleThreadLocal.get()), text, includesTime);
+ if (d != null) {
+ return d;
+ }
+ for (DateFormat t : new DateFormat[]{
+ DateFormat.getDateInstance(DateFormat.SHORT, LocaleThreadLocal.get()),
+ DateFormat.getDateInstance(DateFormat.MEDIUM, LocaleThreadLocal.get()),
+ DateFormat.getDateInstance(DateFormat.LONG, LocaleThreadLocal.get())}) {
+ if (t instanceof SimpleDateFormat) {
+ d = parseHelper(new SimpleDateFormat(((SimpleDateFormat) t).toPattern() + " h:mm a", LocaleThreadLocal.get()), text, includesTime);
+ if (d != null) {
+ return d;
+ }
+ d = parseHelper(new SimpleDateFormat(((SimpleDateFormat) t).toPattern() + " hhmm a", LocaleThreadLocal.get()), text, includesTime);
+ if (d != null) {
+ return d;
+ }
+ d = parseHelper(new SimpleDateFormat(((SimpleDateFormat) t).toPattern() + " hmm a", LocaleThreadLocal.get()), text, includesTime);
+ if (d != null) {
+ return d;
+ }
+ d = parseHelper(new SimpleDateFormat(((SimpleDateFormat) t).toPattern() + " h a", LocaleThreadLocal.get()), text, includesTime);
+ if (d != null) {
+ return d;
+ }
+ d = parseHelper(new SimpleDateFormat(((SimpleDateFormat) t).toPattern() + " h:mma", LocaleThreadLocal.get()), text, includesTime);
+ if (d != null) {
+ return d;
+ }
+ d = parseHelper(new SimpleDateFormat(((SimpleDateFormat) t).toPattern() + " hhmma", LocaleThreadLocal.get()), text, includesTime);
+ if (d != null) {
+ return d;
+ }
+ d = parseHelper(new SimpleDateFormat(((SimpleDateFormat) t).toPattern() + " ha", LocaleThreadLocal.get()), text, includesTime);
+ if (d != null) {
+ return d;
+ }
+ d = parseHelper(new SimpleDateFormat(((SimpleDateFormat) t).toPattern() + " H:mm", LocaleThreadLocal.get()), text, includesTime);
+ if (d != null) {
+ return d;
+ }
+ d = parseHelper(new SimpleDateFormat(((SimpleDateFormat) t).toPattern() + " HHmm", LocaleThreadLocal.get()), text, includesTime);
+ if (d != null) {
+ return d;
+ }
+ d = parseHelper(new SimpleDateFormat(((SimpleDateFormat) t).toPattern() + " HH", LocaleThreadLocal.get()), text, includesTime);
+ if (d != null) {
+ return d;
+ }
+ d = parseHelper(new SimpleDateFormat(((SimpleDateFormat) t).toPattern() + " Hmm", LocaleThreadLocal.get()), text, includesTime);
+ if (d != null) {
+ return d;
+ }
+ d = parseHelper(new SimpleDateFormat(((SimpleDateFormat) t).toPattern() + " H", LocaleThreadLocal.get()), text, includesTime);
+ if (d != null) {
+ return d;
+ }
+ d = parseHelper(t, text, includesTime);
+ if (d != null) {
+ return d;
+ }
+ }
+ }
+ //date
+ //add convenience patterns for english locales
+ if (LocaleThreadLocal.get().getLanguage().equals("en")) {
+ d = parseHelper(new SimpleDateFormat("M / d / yy", LocaleThreadLocal.get()), text, includesTime);
+ if (d != null) {
+ return d;
+ }
+ d = parseHelper(new SimpleDateFormat("MMM d,yyyy", LocaleThreadLocal.get()), text, includesTime);
+ if (d != null) {
+ return d;
+ }
+ d = parseHelper(new SimpleDateFormat("MMMM d,yyyy", LocaleThreadLocal.get()), text, includesTime);
+ if (d != null) {
+ return d;
+ }
+ }
+ return null;
+ }
+
+ private Date parseTimeFormatsInternal(String text, DateFormat defaultFormat, BooleanHolder includesTime) {
+ Date d = null;
+ if (defaultFormat != null) {
+ d = parseHelper(defaultFormat, text, includesTime);
+ if (d != null) {
+ return d;
+ }
+ }
+ //
+ if (text.matches("[0-9]{3}")) {
+ text = "0" + text; // "230" -> 02:30
+ }
+ if (text.matches("[0-9]{2}")) {
+ int hours = Integer.parseInt(text);
+ if (hours >= 24) {
+ text = "00" + text; // "23" -> 23:00 but "30" -> 00:30
+ }
+ }
+ if (defaultFormat != null) {
+ d = parseHelper(defaultFormat, text, includesTime);
+ if (d != null) {
+ return d;
+ }
+ }
+ d = parseHelper(DateFormat.getTimeInstance(DateFormat.SHORT, LocaleThreadLocal.get()), text, includesTime);
+ if (d != null) {
+ return d;
+ }
+ d = parseHelper(new SimpleDateFormat("h:mm a", LocaleThreadLocal.get()), text, includesTime);
+ if (d != null) {
+ return d;
+ }
+ d = parseHelper(new SimpleDateFormat("hhmm a", LocaleThreadLocal.get()), text, includesTime);
+ if (d != null) {
+ return d;
+ }
+ d = parseHelper(new SimpleDateFormat("hmm a", LocaleThreadLocal.get()), text, includesTime);
+ if (d != null) {
+ return d;
+ }
+ d = parseHelper(new SimpleDateFormat("h a", LocaleThreadLocal.get()), text, includesTime);
+ if (d != null) {
+ return d;
+ }
+ d = parseHelper(new SimpleDateFormat("h:mma", LocaleThreadLocal.get()), text, includesTime);
+ if (d != null) {
+ return d;
+ }
+ d = parseHelper(new SimpleDateFormat("hhmma", LocaleThreadLocal.get()), text, includesTime);
+ if (d != null) {
+ return d;
+ }
+ d = parseHelper(new SimpleDateFormat("ha", LocaleThreadLocal.get()), text, includesTime);
+ if (d != null) {
+ return d;
+ }
+ d = parseHelper(new SimpleDateFormat("H:mm", LocaleThreadLocal.get()), text, includesTime);
+ if (d != null) {
+ return d;
+ }
+ d = parseHelper(new SimpleDateFormat("HHmm", LocaleThreadLocal.get()), text, includesTime);
+ if (d != null) {
+ return d;
+ }
+ d = parseHelper(new SimpleDateFormat("HH", LocaleThreadLocal.get()), text, includesTime);
+ if (d != null) {
+ return d;
+ }
+ d = parseHelper(new SimpleDateFormat("Hmm", LocaleThreadLocal.get()), text, includesTime);
+ if (d != null) {
+ return d;
+ }
+ d = parseHelper(new SimpleDateFormat("H", LocaleThreadLocal.get()), text, includesTime);
+ if (d != null) {
+ return d;
+ }
+ return null;
+ }
+
+ private Date parseHelper(DateFormat df, String text, BooleanHolder includesTime) {
+ // >>> ticket #105'126
+ if (df instanceof SimpleDateFormat) {
+ String pattern = ((SimpleDateFormat) df).toPattern();
+ df = new SimpleDateFormat(pattern.replaceAll("yyyy", "yy"), LocaleThreadLocal.get()); // Always use century interpretation
+ }
+ // <<< ticket #105'126
+
+ Date d = null;
+ if (d == null) {
+ try {
+ df.setLenient(false);
+ d = df.parse(text);
+ }
+ catch (ParseException e) {
+ //nop
+ }
+ }
+ // Allow "," instead of ".", because some keyboard layouts have a comma instead of
+ // a dot on the numeric keypad
+ if (d == null) {
+ try {
+ if (df instanceof SimpleDateFormat) {
+ String pattern = ((SimpleDateFormat) df).toPattern();
+ if (pattern.contains(".")) {
+ SimpleDateFormat df2 = new SimpleDateFormat(pattern.replace(".", ","), LocaleThreadLocal.get());
+ df2.setLenient(false);
+ d = df2.parse(text);
+ }
+ }
+ }
+ catch (ParseException e) {
+ //nop
+ }
+ }
+ //eval
+ if (d != null) {
+ if (df instanceof SimpleDateFormat) {
+ String pattern = ((SimpleDateFormat) df).toPattern();
+ if (pattern.matches(".*[hHM].*")) {
+ includesTime.setValue(true);
+ }
+ }
+ else {
+ includesTime.setValue(true);
+ }
+ }
+ return d;
+ }
+
+ private class P_UIFacade implements IDateFieldUIFacade {
+
+ @Override
+ public boolean setDateTextFromUI(String newDate) {
+ if (!isHasDate()) {
+ //nop
+ return false;
+ }
+ if (newDate != null && newDate.length() == 0) {
+ newDate = null;
+ }
+ if (!isHasTime()) {
+ return parseValue(newDate);
+ }
+ if (newDate == null) {
+ return parseValue(null);
+ }
+ //date part only
+ try {
+ PARSE_CONTEXT.set(ParseContext.Date);
+ return parseValue(newDate);
+ }
+ finally {
+ PARSE_CONTEXT.set(null);
+ }
+ }
+
+ @Override
+ public boolean setTimeTextFromUI(String newTime) {
+ if (!isHasTime()) {
+ //nop
+ return false;
+ }
+ if (newTime != null && newTime.length() == 0) {
+ newTime = null;
+ }
+ if (!isHasDate()) {
+ return parseValue(newTime);
+ }
+ //time part
+ try {
+ PARSE_CONTEXT.set(ParseContext.Time);
+ return parseValue(newTime);
+ }
+ finally {
+ PARSE_CONTEXT.set(null);
+ }
+ }
+
+ @Override
+ public boolean setDateTimeTextFromUI(String newText) {
+ if (newText != null && newText.length() == 0) {
+ newText = null;
+ }
+ // parse always, validity might change even if text is same
+ return parseValue(newText);
+ }
+
+ @Override
+ public void setDateFromUI(Date d) {
+ try {
+ if (d != null) {
+ // preserve time
+ Date oldDate = getValue();
+ if (oldDate != null) {
+ Calendar calOld = Calendar.getInstance();
+ calOld.setTime(oldDate);
+ Calendar calNew = Calendar.getInstance();
+ calNew.setTime(d);
+ calNew.set(Calendar.HOUR, calOld.get(Calendar.HOUR));
+ calNew.set(Calendar.HOUR_OF_DAY, calOld.get(Calendar.HOUR_OF_DAY));
+ calNew.set(Calendar.MINUTE, calOld.get(Calendar.MINUTE));
+ calNew.set(Calendar.SECOND, calOld.get(Calendar.SECOND));
+ calNew.set(Calendar.MILLISECOND, calOld.get(Calendar.MILLISECOND));
+ d = calNew.getTime();
+ }
+ else {
+ d = applyAutoTime(d);
+ }
+ }
+ setValue(d);
+ }
+ catch (Throwable t) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Unexpected", t));
+ }
+ }
+
+ @Override
+ public void setTimeFromUI(Date d) {
+ try {
+ Date oldDate = getValue();
+ if (d != null) {
+ if (oldDate == null) {
+ // use today's date
+ oldDate = new Date();
+ }
+ // preserve date
+ Calendar calOld = Calendar.getInstance();
+ calOld.setTime(oldDate);
+ Calendar calNew = Calendar.getInstance();
+ calNew.setTime(d);
+ calNew.set(Calendar.YEAR, calOld.get(Calendar.YEAR));
+ calNew.set(Calendar.MONTH, calOld.get(Calendar.MONTH));
+ calNew.set(Calendar.DATE, calOld.get(Calendar.DATE));
+ d = calNew.getTime();
+ }
+ else if (isHasDate() && oldDate != null) {
+ d = applyAutoTime(oldDate);
+ }
+ setValue(d);
+ }
+ catch (Throwable t) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Unexpected", t));
+ }
+ }
+
+ @Override
+ public void setDateTimeFromUI(Date d) {
+ try {
+ setValue(d);
+ }
+ catch (Throwable t) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Unexpected", t));
+ }
+ }
+
+ @Override
+ public void fireDateShiftActionFromUI(int level, int value) {
+ try {
+ execShiftDate(level, value);
+ }
+ catch (ProcessingException e) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ catch (Throwable t) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Unexpected", t));
+ }
+ }
+
+ @Override
+ public void fireTimeShiftActionFromUI(int level, int value) {
+ try {
+ execShiftTime(level, value);
+ }
+ catch (ProcessingException e) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ catch (Throwable t) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Unexpected", t));
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/datefield/AbstractDateTimeField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/datefield/AbstractDateTimeField.java
index 8b9812a86d..70742c9d28 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/datefield/AbstractDateTimeField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/datefield/AbstractDateTimeField.java
@@ -1,36 +1,36 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.datefield;
-
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-
-/**
- * convenience subclass of {@link AbstractDateField} with hasDate=true and hasTime=true
- */
-public abstract class AbstractDateTimeField extends AbstractDateField {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractDateTimeField.class);
-
- public AbstractDateTimeField() {
- this(true);
- }
-
- public AbstractDateTimeField(boolean callInitializer) {
- super(callInitializer);
- }
-
- @ConfigPropertyValue("true")
- @Override
- protected boolean getConfiguredHasTime() {
- return true;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.datefield;
+
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+
+/**
+ * convenience subclass of {@link AbstractDateField} with hasDate=true and hasTime=true
+ */
+public abstract class AbstractDateTimeField extends AbstractDateField {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractDateTimeField.class);
+
+ public AbstractDateTimeField() {
+ this(true);
+ }
+
+ public AbstractDateTimeField(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ @ConfigPropertyValue("true")
+ @Override
+ protected boolean getConfiguredHasTime() {
+ return true;
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/datefield/AbstractTimeField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/datefield/AbstractTimeField.java
index 531076b3c8..ffae7ef81f 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/datefield/AbstractTimeField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/datefield/AbstractTimeField.java
@@ -1,41 +1,41 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.datefield;
-
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-
-/**
- * convenience subclass of {@link AbstractDateField} with hasDate=false and hasTime=true
- */
-public abstract class AbstractTimeField extends AbstractDateField {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractTimeField.class);
-
- public AbstractTimeField() {
- this(true);
- }
-
- public AbstractTimeField(boolean callInitializer) {
- super(callInitializer);
- }
-
- @ConfigPropertyValue("true")
- @Override
- protected boolean getConfiguredHasTime() {
- return true;
- }
-
- @Override
- protected boolean getConfiguredHasDate() {
- return false;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.datefield;
+
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+
+/**
+ * convenience subclass of {@link AbstractDateField} with hasDate=false and hasTime=true
+ */
+public abstract class AbstractTimeField extends AbstractDateField {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractTimeField.class);
+
+ public AbstractTimeField() {
+ this(true);
+ }
+
+ public AbstractTimeField(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ @ConfigPropertyValue("true")
+ @Override
+ protected boolean getConfiguredHasTime() {
+ return true;
+ }
+
+ @Override
+ protected boolean getConfiguredHasDate() {
+ return false;
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/datefield/AbstractUTCDateField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/datefield/AbstractUTCDateField.java
index d96757abae..92d5efd64d 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/datefield/AbstractUTCDateField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/datefield/AbstractUTCDateField.java
@@ -1,39 +1,39 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.datefield;
-
-import java.util.Date;
-
-import org.eclipse.scout.commons.UTCDate;
-import org.eclipse.scout.commons.annotations.FormData;
-import org.eclipse.scout.commons.annotations.FormData.SdkCommand;
-import org.eclipse.scout.rt.shared.data.form.fields.AbstractUTCFieldData;
-
-/**
- * Date field with override on {@link #getHolderType()} to {@link UTCDate}
- */
-@FormData(value = AbstractUTCFieldData.class, sdkCommand = SdkCommand.USE)
-public abstract class AbstractUTCDateField extends AbstractDateField implements IUTCDateField {
-
- public AbstractUTCDateField() {
- this(true);
- }
-
- public AbstractUTCDateField(boolean callInitializer) {
- super(callInitializer);
- }
-
- @Override
- public Class<Date> getHolderType() {
- return super.getHolderType();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.datefield;
+
+import java.util.Date;
+
+import org.eclipse.scout.commons.UTCDate;
+import org.eclipse.scout.commons.annotations.FormData;
+import org.eclipse.scout.commons.annotations.FormData.SdkCommand;
+import org.eclipse.scout.rt.shared.data.form.fields.AbstractUTCFieldData;
+
+/**
+ * Date field with override on {@link #getHolderType()} to {@link UTCDate}
+ */
+@FormData(value = AbstractUTCFieldData.class, sdkCommand = SdkCommand.USE)
+public abstract class AbstractUTCDateField extends AbstractDateField implements IUTCDateField {
+
+ public AbstractUTCDateField() {
+ this(true);
+ }
+
+ public AbstractUTCDateField(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ @Override
+ public Class<Date> getHolderType() {
+ return super.getHolderType();
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/datefield/IDateField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/datefield/IDateField.java
index e793235cff..48430dd8ef 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/datefield/IDateField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/datefield/IDateField.java
@@ -1,70 +1,70 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.datefield;
-
-import java.text.DateFormat;
-import java.util.Date;
-
-import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
-
-public interface IDateField extends IValueField<Date> {
- String PROP_HAS_DATE = "hasDate";
- String PROP_HAS_TIME = "hasTime";
-
- IDateFieldUIFacade getUIFacade();
-
- void setFormat(String s);
-
- String getFormat();
-
- /**
- * @return the date-time format created using {@link #getFormat()} that contains the date and time part
- */
- DateFormat getDateFormat();
-
- /**
- * @return the date format created using {@link #getFormat()} that only contains the date part
- */
- DateFormat getIsolatedDateFormat();
-
- /**
- * @return the time format created using {@link #getFormat()} that only contains the time part
- */
- DateFormat getIsolatedTimeFormat();
-
- boolean isHasDate();
-
- void setHasDate(boolean b);
-
- boolean isHasTime();
-
- void setHasTime(boolean b);
-
- void setAutoTimeMillis(long l);
-
- void setAutoTimeMillis(int hour, int minute, int second);
-
- long getAutoTimeMillis();
-
- /**
- * @return the time value as a double in the range from [0..1[ for 00:00 - 23:59:59
- */
- Double getTimeValue();
-
- /**
- * set the time value as a double in the range from [0..1[ for 00:00 - 23:59:59
- */
- void setTimeValue(Double d);
-
- void adjustDate(int days, int months, int years);
-
- void adjustTime(int days, int months, int years);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.datefield;
+
+import java.text.DateFormat;
+import java.util.Date;
+
+import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
+
+public interface IDateField extends IValueField<Date> {
+ String PROP_HAS_DATE = "hasDate";
+ String PROP_HAS_TIME = "hasTime";
+
+ IDateFieldUIFacade getUIFacade();
+
+ void setFormat(String s);
+
+ String getFormat();
+
+ /**
+ * @return the date-time format created using {@link #getFormat()} that contains the date and time part
+ */
+ DateFormat getDateFormat();
+
+ /**
+ * @return the date format created using {@link #getFormat()} that only contains the date part
+ */
+ DateFormat getIsolatedDateFormat();
+
+ /**
+ * @return the time format created using {@link #getFormat()} that only contains the time part
+ */
+ DateFormat getIsolatedTimeFormat();
+
+ boolean isHasDate();
+
+ void setHasDate(boolean b);
+
+ boolean isHasTime();
+
+ void setHasTime(boolean b);
+
+ void setAutoTimeMillis(long l);
+
+ void setAutoTimeMillis(int hour, int minute, int second);
+
+ long getAutoTimeMillis();
+
+ /**
+ * @return the time value as a double in the range from [0..1[ for 00:00 - 23:59:59
+ */
+ Double getTimeValue();
+
+ /**
+ * set the time value as a double in the range from [0..1[ for 00:00 - 23:59:59
+ */
+ void setTimeValue(Double d);
+
+ void adjustDate(int days, int months, int years);
+
+ void adjustTime(int days, int months, int years);
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/datefield/IDateFieldUIFacade.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/datefield/IDateFieldUIFacade.java
index 420afaabcf..0508bc9ec5 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/datefield/IDateFieldUIFacade.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/datefield/IDateFieldUIFacade.java
@@ -1,39 +1,39 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.datefield;
-
-import java.util.Date;
-
-public interface IDateFieldUIFacade {
-
- boolean setDateTimeTextFromUI(String newText);
-
- boolean setDateTextFromUI(String newText);
-
- boolean setTimeTextFromUI(String newText);
-
- void setDateTimeFromUI(Date d);
-
- void setDateFromUI(Date d);
-
- void setTimeFromUI(Date d);
-
- /**
- * see {@link AbstractDateField#execShiftDate(int, int)}
- */
- void fireDateShiftActionFromUI(int level, int value);
-
- /**
- * see {@link AbstractDateField#execShiftTime(int, int)}
- */
- void fireTimeShiftActionFromUI(int level, int value);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.datefield;
+
+import java.util.Date;
+
+public interface IDateFieldUIFacade {
+
+ boolean setDateTimeTextFromUI(String newText);
+
+ boolean setDateTextFromUI(String newText);
+
+ boolean setTimeTextFromUI(String newText);
+
+ void setDateTimeFromUI(Date d);
+
+ void setDateFromUI(Date d);
+
+ void setTimeFromUI(Date d);
+
+ /**
+ * see {@link AbstractDateField#execShiftDate(int, int)}
+ */
+ void fireDateShiftActionFromUI(int level, int value);
+
+ /**
+ * see {@link AbstractDateField#execShiftTime(int, int)}
+ */
+ void fireTimeShiftActionFromUI(int level, int value);
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/datefield/IUTCDateField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/datefield/IUTCDateField.java
index f92a3c8b32..954fcaa12e 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/datefield/IUTCDateField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/datefield/IUTCDateField.java
@@ -1,20 +1,20 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.datefield;
-
-import org.eclipse.scout.commons.UTCDate;
-import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
-
-/**
- * Date field with override on {@link IValueField#getHolderType()} to {@link UTCDate}
- */
-public interface IUTCDateField extends IDateField {
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.datefield;
+
+import org.eclipse.scout.commons.UTCDate;
+import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
+
+/**
+ * Date field with override on {@link IValueField#getHolderType()} to {@link UTCDate}
+ */
+public interface IUTCDateField extends IDateField {
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/decimalfield/AbstractDecimalField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/decimalfield/AbstractDecimalField.java
index cc03964f9d..3948d82498 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/decimalfield/AbstractDecimalField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/decimalfield/AbstractDecimalField.java
@@ -1,365 +1,365 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.decimalfield;
-
-import java.text.DecimalFormat;
-import java.text.NumberFormat;
-
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.commons.LocaleThreadLocal;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.exception.VetoException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.form.fields.AbstractValueField;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-
-public abstract class AbstractDecimalField<T extends Number> extends AbstractValueField<T> implements IDecimalField<T> {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractDecimalField.class);
-
- private IDecimalFieldUIFacade m_uiFacade;
- private String m_format;
- private boolean m_groupingUsed;
- private int m_fractionDigits;
- private int m_minFractionDigits;
- private int m_maxFractionDigits;
- private int m_multiplier;
- private boolean m_percent;
- private T m_minValue;
- private T m_maxValue;
-
- public AbstractDecimalField() {
- this(true);
- }
-
- public AbstractDecimalField(boolean callInitializer) {
- super(callInitializer);
- }
-
- /*
- * Configuration
- */
- @ConfigProperty(ConfigProperty.STRING)
- @Order(230)
- @ConfigPropertyValue("null")
- protected String getConfiguredFormat() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.INTEGER)
- @Order(290)
- @ConfigPropertyValue("2")
- protected int getConfiguredFractionDigits() {
- return 2;
- }
-
- @ConfigProperty(ConfigProperty.INTEGER)
- @Order(240)
- @ConfigPropertyValue("2")
- protected int getConfiguredMinFractionDigits() {
- return 2;
- }
-
- @ConfigProperty(ConfigProperty.INTEGER)
- @Order(250)
- @ConfigPropertyValue("2")
- protected int getConfiguredMaxFractionDigits() {
- return 2;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(260)
- @ConfigPropertyValue("true")
- protected boolean getConfiguredGroupingUsed() {
- return true;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(270)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredPercent() {
- return false;
- }
-
- @ConfigProperty(ConfigProperty.INTEGER)
- @Order(280)
- @ConfigPropertyValue("1")
- protected int getConfiguredMultiplier() {
- return 1;
- }
-
- @Override
- @ConfigPropertyValue("1")
- protected int getConfiguredHorizontalAlignment() {
- return 1;
- }
-
- @Override
- protected void initConfig() {
- m_uiFacade = new P_UIFacade();
- super.initConfig();
- setFormat(getConfiguredFormat());
- setMinFractionDigits(getConfiguredMinFractionDigits());
- setMaxFractionDigits(getConfiguredMaxFractionDigits());
- setGroupingUsed(getConfiguredGroupingUsed());
- setPercent(getConfiguredPercent());
- setFractionDigits(getConfiguredFractionDigits());
- setMultiplier(getConfiguredMultiplier());
- }
-
- @Override
- public void setMinFractionDigits(int i) {
- try {
- setFieldChanging(true);
- //
- if (i > getMaxFractionDigits()) {
- m_maxFractionDigits = i;
- }
- m_minFractionDigits = i;
- if (isInitialized()) {
- if (isAutoDisplayText()) {
- setDisplayText(execFormatValue(getValue()));
- }
- }
- }
- finally {
- setFieldChanging(false);
- }
- }
-
- @Override
- public int getMinFractionDigits() {
- return m_minFractionDigits;
- }
-
- @Override
- public void setMaxFractionDigits(int i) {
- try {
- setFieldChanging(true);
- //
- if (i < getMinFractionDigits()) {
- m_minFractionDigits = i;
- }
- m_maxFractionDigits = i;
- if (isInitialized()) {
- if (isAutoDisplayText()) {
- setDisplayText(execFormatValue(getValue()));
- }
- }
- }
- finally {
- setFieldChanging(false);
- }
- }
-
- @Override
- public int getMaxFractionDigits() {
- return m_maxFractionDigits;
- }
-
- @Override
- public void setPercent(boolean b) {
- m_percent = b;
- if (isInitialized()) {
- if (isAutoDisplayText()) {
- setDisplayText(execFormatValue(getValue()));
- }
- }
- }
-
- @Override
- public boolean isPercent() {
- return m_percent;
- }
-
- @Override
- public void setFractionDigits(int i) {
- m_fractionDigits = i;
- if (isInitialized()) {
- setValue(getValue());
- }
- }
-
- @Override
- public int getFractionDigits() {
- return m_fractionDigits;
- }
-
- @Override
- public void setFormat(String s) {
- m_format = s;
- if (isInitialized()) {
- if (isAutoDisplayText()) {
- setDisplayText(execFormatValue(getValue()));
- }
- }
- }
-
- @Override
- public String getFormat() {
- return m_format;
- }
-
- @Override
- public void setGroupingUsed(boolean b) {
- m_groupingUsed = b;
- if (isInitialized()) {
- if (isAutoDisplayText()) {
- setDisplayText(execFormatValue(getValue()));
- }
- }
- }
-
- @Override
- public boolean isGroupingUsed() {
- return m_groupingUsed;
- }
-
- @SuppressWarnings("unchecked")
- private int compareInternal(T a, T b) {
- return CompareUtility.compareTo((Comparable) a, (Comparable) b);
- }
-
- @Override
- public void setMinValue(T n) {
- try {
- setFieldChanging(true);
- //
- T max = getMaxValue();
- if (n != null && max != null && compareInternal(n, max) > 0) {
- m_maxValue = n;
- }
- m_minValue = n;
- if (isInitialized()) {
- setValue(getValue());
- }
- }
- finally {
- setFieldChanging(false);
- }
- }
-
- @Override
- public T getMinValue() {
- return m_minValue;
- }
-
- @Override
- public void setMaxValue(T n) {
- try {
- setFieldChanging(true);
- //
- T min = getMinValue();
- if (n != null && min != null && compareInternal(n, min) < 0) {
- m_minValue = n;
- }
- m_maxValue = n;
- if (isInitialized()) {
- setValue(getValue());
- }
- }
- finally {
- setFieldChanging(false);
- }
- }
-
- @Override
- public T getMaxValue() {
- return m_maxValue;
- }
-
- @Override
- public void setMultiplier(int i) {
- m_multiplier = i;
- if (isInitialized()) {
- setValue(getValue());
- }
- }
-
- @Override
- public int getMultiplier() {
- return m_multiplier;
- }
-
- @Override
- public IDecimalFieldUIFacade getUIFacade() {
- return m_uiFacade;
- }
-
- @Override
- protected String formatValueInternal(T validValue) {
- if (validValue == null) {
- return "";
- }
- String displayValue = createNumberFormat().format(validValue);
- return displayValue;
- }
-
- @Override
- protected T validateValueInternal(T rawValue) throws ProcessingException {
- T validValue = null;
- rawValue = super.validateValueInternal(rawValue);
- if (rawValue == null) {
- validValue = null;
- }
- else {
- if (getMaxValue() != null && compareInternal(rawValue, getMaxValue()) > 0) {
- throw new VetoException(ScoutTexts.get("NumberTooLargeMessageXY", "" + formatValueInternal(getMinValue()), "" + formatValueInternal(getMaxValue())));
- }
- if (getMinValue() != null && compareInternal(rawValue, getMinValue()) < 0) {
- throw new VetoException(ScoutTexts.get("NumberTooSmallMessageXY", "" + formatValueInternal(getMinValue()), "" + formatValueInternal(getMaxValue())));
- }
- validValue = rawValue;
- }
- return validValue;
- }
-
- protected NumberFormat createNumberFormat() {
- NumberFormat fmt;
- if (isPercent()) {
- fmt = NumberFormat.getPercentInstance(LocaleThreadLocal.get());
- }
- else {
- fmt = NumberFormat.getNumberInstance(LocaleThreadLocal.get());
- }
- if (fmt instanceof DecimalFormat) {
- ((DecimalFormat) fmt).setMultiplier(getMultiplier());
- if (getFormat() != null) {
- ((DecimalFormat) fmt).applyPattern(getFormat());
- }
- else {
- fmt.setMinimumFractionDigits(getMinFractionDigits());
- fmt.setMaximumFractionDigits(getMaxFractionDigits());
- fmt.setGroupingUsed(isGroupingUsed());
- }
- }
- else {
- fmt.setMinimumFractionDigits(getMinFractionDigits());
- fmt.setMaximumFractionDigits(getMaxFractionDigits());
- fmt.setGroupingUsed(isGroupingUsed());
- }
- return fmt;
- }
-
- private class P_UIFacade implements IDecimalFieldUIFacade {
- @Override
- public boolean setTextFromUI(String newText) {
- if (newText != null && newText.length() == 0) {
- newText = null;
- }
- // parse always, validity might change even if text is same
- return parseValue(newText);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.decimalfield;
+
+import java.text.DecimalFormat;
+import java.text.NumberFormat;
+
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.commons.LocaleThreadLocal;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.exception.VetoException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.form.fields.AbstractValueField;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+
+public abstract class AbstractDecimalField<T extends Number> extends AbstractValueField<T> implements IDecimalField<T> {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractDecimalField.class);
+
+ private IDecimalFieldUIFacade m_uiFacade;
+ private String m_format;
+ private boolean m_groupingUsed;
+ private int m_fractionDigits;
+ private int m_minFractionDigits;
+ private int m_maxFractionDigits;
+ private int m_multiplier;
+ private boolean m_percent;
+ private T m_minValue;
+ private T m_maxValue;
+
+ public AbstractDecimalField() {
+ this(true);
+ }
+
+ public AbstractDecimalField(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ /*
+ * Configuration
+ */
+ @ConfigProperty(ConfigProperty.STRING)
+ @Order(230)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredFormat() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.INTEGER)
+ @Order(290)
+ @ConfigPropertyValue("2")
+ protected int getConfiguredFractionDigits() {
+ return 2;
+ }
+
+ @ConfigProperty(ConfigProperty.INTEGER)
+ @Order(240)
+ @ConfigPropertyValue("2")
+ protected int getConfiguredMinFractionDigits() {
+ return 2;
+ }
+
+ @ConfigProperty(ConfigProperty.INTEGER)
+ @Order(250)
+ @ConfigPropertyValue("2")
+ protected int getConfiguredMaxFractionDigits() {
+ return 2;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(260)
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredGroupingUsed() {
+ return true;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(270)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredPercent() {
+ return false;
+ }
+
+ @ConfigProperty(ConfigProperty.INTEGER)
+ @Order(280)
+ @ConfigPropertyValue("1")
+ protected int getConfiguredMultiplier() {
+ return 1;
+ }
+
+ @Override
+ @ConfigPropertyValue("1")
+ protected int getConfiguredHorizontalAlignment() {
+ return 1;
+ }
+
+ @Override
+ protected void initConfig() {
+ m_uiFacade = new P_UIFacade();
+ super.initConfig();
+ setFormat(getConfiguredFormat());
+ setMinFractionDigits(getConfiguredMinFractionDigits());
+ setMaxFractionDigits(getConfiguredMaxFractionDigits());
+ setGroupingUsed(getConfiguredGroupingUsed());
+ setPercent(getConfiguredPercent());
+ setFractionDigits(getConfiguredFractionDigits());
+ setMultiplier(getConfiguredMultiplier());
+ }
+
+ @Override
+ public void setMinFractionDigits(int i) {
+ try {
+ setFieldChanging(true);
+ //
+ if (i > getMaxFractionDigits()) {
+ m_maxFractionDigits = i;
+ }
+ m_minFractionDigits = i;
+ if (isInitialized()) {
+ if (isAutoDisplayText()) {
+ setDisplayText(execFormatValue(getValue()));
+ }
+ }
+ }
+ finally {
+ setFieldChanging(false);
+ }
+ }
+
+ @Override
+ public int getMinFractionDigits() {
+ return m_minFractionDigits;
+ }
+
+ @Override
+ public void setMaxFractionDigits(int i) {
+ try {
+ setFieldChanging(true);
+ //
+ if (i < getMinFractionDigits()) {
+ m_minFractionDigits = i;
+ }
+ m_maxFractionDigits = i;
+ if (isInitialized()) {
+ if (isAutoDisplayText()) {
+ setDisplayText(execFormatValue(getValue()));
+ }
+ }
+ }
+ finally {
+ setFieldChanging(false);
+ }
+ }
+
+ @Override
+ public int getMaxFractionDigits() {
+ return m_maxFractionDigits;
+ }
+
+ @Override
+ public void setPercent(boolean b) {
+ m_percent = b;
+ if (isInitialized()) {
+ if (isAutoDisplayText()) {
+ setDisplayText(execFormatValue(getValue()));
+ }
+ }
+ }
+
+ @Override
+ public boolean isPercent() {
+ return m_percent;
+ }
+
+ @Override
+ public void setFractionDigits(int i) {
+ m_fractionDigits = i;
+ if (isInitialized()) {
+ setValue(getValue());
+ }
+ }
+
+ @Override
+ public int getFractionDigits() {
+ return m_fractionDigits;
+ }
+
+ @Override
+ public void setFormat(String s) {
+ m_format = s;
+ if (isInitialized()) {
+ if (isAutoDisplayText()) {
+ setDisplayText(execFormatValue(getValue()));
+ }
+ }
+ }
+
+ @Override
+ public String getFormat() {
+ return m_format;
+ }
+
+ @Override
+ public void setGroupingUsed(boolean b) {
+ m_groupingUsed = b;
+ if (isInitialized()) {
+ if (isAutoDisplayText()) {
+ setDisplayText(execFormatValue(getValue()));
+ }
+ }
+ }
+
+ @Override
+ public boolean isGroupingUsed() {
+ return m_groupingUsed;
+ }
+
+ @SuppressWarnings("unchecked")
+ private int compareInternal(T a, T b) {
+ return CompareUtility.compareTo((Comparable) a, (Comparable) b);
+ }
+
+ @Override
+ public void setMinValue(T n) {
+ try {
+ setFieldChanging(true);
+ //
+ T max = getMaxValue();
+ if (n != null && max != null && compareInternal(n, max) > 0) {
+ m_maxValue = n;
+ }
+ m_minValue = n;
+ if (isInitialized()) {
+ setValue(getValue());
+ }
+ }
+ finally {
+ setFieldChanging(false);
+ }
+ }
+
+ @Override
+ public T getMinValue() {
+ return m_minValue;
+ }
+
+ @Override
+ public void setMaxValue(T n) {
+ try {
+ setFieldChanging(true);
+ //
+ T min = getMinValue();
+ if (n != null && min != null && compareInternal(n, min) < 0) {
+ m_minValue = n;
+ }
+ m_maxValue = n;
+ if (isInitialized()) {
+ setValue(getValue());
+ }
+ }
+ finally {
+ setFieldChanging(false);
+ }
+ }
+
+ @Override
+ public T getMaxValue() {
+ return m_maxValue;
+ }
+
+ @Override
+ public void setMultiplier(int i) {
+ m_multiplier = i;
+ if (isInitialized()) {
+ setValue(getValue());
+ }
+ }
+
+ @Override
+ public int getMultiplier() {
+ return m_multiplier;
+ }
+
+ @Override
+ public IDecimalFieldUIFacade getUIFacade() {
+ return m_uiFacade;
+ }
+
+ @Override
+ protected String formatValueInternal(T validValue) {
+ if (validValue == null) {
+ return "";
+ }
+ String displayValue = createNumberFormat().format(validValue);
+ return displayValue;
+ }
+
+ @Override
+ protected T validateValueInternal(T rawValue) throws ProcessingException {
+ T validValue = null;
+ rawValue = super.validateValueInternal(rawValue);
+ if (rawValue == null) {
+ validValue = null;
+ }
+ else {
+ if (getMaxValue() != null && compareInternal(rawValue, getMaxValue()) > 0) {
+ throw new VetoException(ScoutTexts.get("NumberTooLargeMessageXY", "" + formatValueInternal(getMinValue()), "" + formatValueInternal(getMaxValue())));
+ }
+ if (getMinValue() != null && compareInternal(rawValue, getMinValue()) < 0) {
+ throw new VetoException(ScoutTexts.get("NumberTooSmallMessageXY", "" + formatValueInternal(getMinValue()), "" + formatValueInternal(getMaxValue())));
+ }
+ validValue = rawValue;
+ }
+ return validValue;
+ }
+
+ protected NumberFormat createNumberFormat() {
+ NumberFormat fmt;
+ if (isPercent()) {
+ fmt = NumberFormat.getPercentInstance(LocaleThreadLocal.get());
+ }
+ else {
+ fmt = NumberFormat.getNumberInstance(LocaleThreadLocal.get());
+ }
+ if (fmt instanceof DecimalFormat) {
+ ((DecimalFormat) fmt).setMultiplier(getMultiplier());
+ if (getFormat() != null) {
+ ((DecimalFormat) fmt).applyPattern(getFormat());
+ }
+ else {
+ fmt.setMinimumFractionDigits(getMinFractionDigits());
+ fmt.setMaximumFractionDigits(getMaxFractionDigits());
+ fmt.setGroupingUsed(isGroupingUsed());
+ }
+ }
+ else {
+ fmt.setMinimumFractionDigits(getMinFractionDigits());
+ fmt.setMaximumFractionDigits(getMaxFractionDigits());
+ fmt.setGroupingUsed(isGroupingUsed());
+ }
+ return fmt;
+ }
+
+ private class P_UIFacade implements IDecimalFieldUIFacade {
+ @Override
+ public boolean setTextFromUI(String newText) {
+ if (newText != null && newText.length() == 0) {
+ newText = null;
+ }
+ // parse always, validity might change even if text is same
+ return parseValue(newText);
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/decimalfield/IDecimalField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/decimalfield/IDecimalField.java
index 78b06f1d5f..b7d7347c38 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/decimalfield/IDecimalField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/decimalfield/IDecimalField.java
@@ -1,59 +1,59 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.decimalfield;
-
-import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
-
-/**
- * Field type representing a fractional, decimal number such as Float, Double,
- * BigDecimal
- */
-public interface IDecimalField<T extends Number> extends IValueField<T> {
-
- void setFormat(String s);
-
- String getFormat();
-
- void setMinFractionDigits(int i);
-
- int getMinFractionDigits();
-
- void setMaxFractionDigits(int i);
-
- int getMaxFractionDigits();
-
- void setGroupingUsed(boolean b);
-
- boolean isGroupingUsed();
-
- void setPercent(boolean b);
-
- boolean isPercent();
-
- void setFractionDigits(int i);
-
- int getFractionDigits();
-
- void setMinValue(T d);
-
- T getMinValue();
-
- void setMaxValue(T d);
-
- T getMaxValue();
-
- void setMultiplier(int b);
-
- int getMultiplier();
-
- IDecimalFieldUIFacade getUIFacade();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.decimalfield;
+
+import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
+
+/**
+ * Field type representing a fractional, decimal number such as Float, Double,
+ * BigDecimal
+ */
+public interface IDecimalField<T extends Number> extends IValueField<T> {
+
+ void setFormat(String s);
+
+ String getFormat();
+
+ void setMinFractionDigits(int i);
+
+ int getMinFractionDigits();
+
+ void setMaxFractionDigits(int i);
+
+ int getMaxFractionDigits();
+
+ void setGroupingUsed(boolean b);
+
+ boolean isGroupingUsed();
+
+ void setPercent(boolean b);
+
+ boolean isPercent();
+
+ void setFractionDigits(int i);
+
+ int getFractionDigits();
+
+ void setMinValue(T d);
+
+ T getMinValue();
+
+ void setMaxValue(T d);
+
+ T getMaxValue();
+
+ void setMultiplier(int b);
+
+ int getMultiplier();
+
+ IDecimalFieldUIFacade getUIFacade();
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/decimalfield/IDecimalFieldUIFacade.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/decimalfield/IDecimalFieldUIFacade.java
index bcce90236c..f03e0b8527 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/decimalfield/IDecimalFieldUIFacade.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/decimalfield/IDecimalFieldUIFacade.java
@@ -1,17 +1,17 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.decimalfield;
-
-public interface IDecimalFieldUIFacade {
-
- boolean setTextFromUI(String newText);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.decimalfield;
+
+public interface IDecimalFieldUIFacade {
+
+ boolean setTextFromUI(String newText);
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/documentfield/AbstractDocumentField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/documentfield/AbstractDocumentField.java
index 961fab4aa5..9663d196af 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/documentfield/AbstractDocumentField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/documentfield/AbstractDocumentField.java
@@ -1,209 +1,209 @@
-package org.eclipse.scout.rt.client.ui.form.fields.documentfield;
-
-import org.eclipse.scout.commons.EventListenerList;
-import org.eclipse.scout.commons.TypeCastUtility;
-import org.eclipse.scout.commons.annotations.ConfigOperation;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.form.fields.AbstractValueField;
-import org.eclipse.scout.rt.client.ui.form.fields.documentfield.eventdata.SaveAsData;
-import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
-import org.eclipse.scout.rt.shared.services.common.file.RemoteFile;
-import org.eclipse.scout.service.SERVICES;
-
-/**
- * The document field is an editor field that presents a document for editing.
- * <p>
- * Current known implementations inlcude the Microsoft office word document editor in swing. This will be released soon
- * as a scout swing fragment under epl.
- */
-public abstract class AbstractDocumentField extends AbstractValueField<RemoteFile> implements IDocumentField {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractDocumentField.class);
-
- private final EventListenerList m_listenerList = new EventListenerList();
- private IDocumentFieldUIFacade m_uiFacade;
-
- public AbstractDocumentField() {
- this(true);
- }
-
- public AbstractDocumentField(boolean callInitializer) {
- super(callInitializer);
- }
-
- @Override
- protected double getConfiguredGridWeightX() {
- return 1;
- }
-
- @Override
- protected double getConfiguredGridWeightY() {
- return 1;
- }
-
- @Override
- protected boolean getConfiguredLabelVisible() {
- return false;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredRulersVisible() {
- return false;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredStatusBarVisible() {
- return false;
- }
-
- @Override
- protected void initConfig() {
- m_uiFacade = createUIFacade();
- super.initConfig();
- setRulersVisible(getConfiguredRulersVisible());
- setStatusBarVisible(getConfiguredStatusBarVisible());
- }
-
- @Override
- public IDocumentFieldUIFacade getUIFacade() {
- return m_uiFacade;
- }
-
- @Override
- public void setRulersVisible(boolean b) {
- propertySupport.setPropertyBool(PROP_RULERS_VISIBLE, b);
- }
-
- @Override
- public boolean isRulersVisible() {
- return propertySupport.getPropertyBool(PROP_RULERS_VISIBLE);
- }
-
- @Override
- public void setStatusBarVisible(boolean b) {
- propertySupport.setPropertyBool(PROP_STATUS_BAR_VISIBLE, b);
- }
-
- @Override
- public boolean isStatusBarVisible() {
- return propertySupport.getPropertyBool(PROP_STATUS_BAR_VISIBLE);
- }
-
- @Override
- public void addDocumentFieldListener(DocumentFieldListener listener) {
- m_listenerList.add(DocumentFieldListener.class, listener);
- }
-
- @Override
- public void removeDocumentFieldListener(DocumentFieldListener listener) {
- m_listenerList.remove(DocumentFieldListener.class, listener);
- }
-
- @Override
- public boolean isComReady() {
- return propertySupport.getPropertyBool(PROP_COM_READY);
- }
-
- @ConfigOperation
- protected void execComReadyStatusChanged(boolean ready) throws ProcessingException {
- }
-
- // main handler
- protected Object fireDocumentFieldEventInternal(DocumentFieldEvent e) throws ProcessingException {
- Object returnValue = null;
- ProcessingException exception = null;
- DocumentFieldListener[] listeners = m_listenerList.getListeners(DocumentFieldListener.class);
- if (listeners != null && listeners.length > 0) {
- for (int i = 0; i < listeners.length; i++) {
- try {
- Object tmp = listeners[i].documentFieldChanged(e);
- if (returnValue == null) {
- returnValue = tmp;
- }
- }
- catch (ProcessingException t) {
- exception = t;
- }
- }
- }
-
- if (exception != null) {
- throw exception;
- }
-
- return returnValue;
- }
-
- @Override
- protected boolean execIsSaveNeeded() throws ProcessingException {
- if (!isInitialized() || getForm().isFormLoading()) {
- return false;
- }
- // mark field for saving. There is no event to listen on...
- Object ret = fireDocumentFieldEventInternal(new DocumentFieldEvent(AbstractDocumentField.this, DocumentFieldEvent.TYPE_SAVE_NEEDED));
- return TypeCastUtility.castValue(ret, boolean.class);
- }
-
- @Override
- public RemoteFile save() throws ProcessingException {
- return saveAs(null, null);
- }
-
- @Override
- public RemoteFile saveAs(String name) throws ProcessingException {
- return saveAs(name, null);
- }
-
- @Override
- public RemoteFile saveAs(String name, String format) throws ProcessingException {
- return (RemoteFile) fireDocumentFieldEventInternal(new DocumentFieldEvent(this, DocumentFieldEvent.TYPE_SAVE_AS, new SaveAsData(name, format)));
- }
-
- @Override
- public void autoResizeDocument() {
- try {
- fireDocumentFieldEventInternal(new DocumentFieldEvent(this, DocumentFieldEvent.TYPE_AUTORESIZE_DOCUMENT));
- }
- catch (ProcessingException e) {
- LOG.warn("Could not auto resize document", e);
- }
- }
-
- protected IDocumentFieldUIFacade createUIFacade() {
- return new P_UIFacade();
- }
-
- protected class P_UIFacade implements IDocumentFieldUIFacade {
-
- @Override
- public void setDocumentFromUI(RemoteFile remoteFile) {
- try {
- setFieldChanging(true);
- setValue(remoteFile);
- }
- finally {
- setFieldChanging(false);
- }
- }
-
- @Override
- public void fireComReadyFromUI(boolean comReady) {
- try {
- if (propertySupport.setPropertyBool(PROP_COM_READY, comReady)) {
- execComReadyStatusChanged(comReady);
- }
- }
- catch (ProcessingException e) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- catch (Throwable t) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Unexpected", t));
- }
- }
- }
-}
+package org.eclipse.scout.rt.client.ui.form.fields.documentfield;
+
+import org.eclipse.scout.commons.EventListenerList;
+import org.eclipse.scout.commons.TypeCastUtility;
+import org.eclipse.scout.commons.annotations.ConfigOperation;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.form.fields.AbstractValueField;
+import org.eclipse.scout.rt.client.ui.form.fields.documentfield.eventdata.SaveAsData;
+import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
+import org.eclipse.scout.rt.shared.services.common.file.RemoteFile;
+import org.eclipse.scout.service.SERVICES;
+
+/**
+ * The document field is an editor field that presents a document for editing.
+ * <p>
+ * Current known implementations inlcude the Microsoft office word document editor in swing. This will be released soon
+ * as a scout swing fragment under epl.
+ */
+public abstract class AbstractDocumentField extends AbstractValueField<RemoteFile> implements IDocumentField {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractDocumentField.class);
+
+ private final EventListenerList m_listenerList = new EventListenerList();
+ private IDocumentFieldUIFacade m_uiFacade;
+
+ public AbstractDocumentField() {
+ this(true);
+ }
+
+ public AbstractDocumentField(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ @Override
+ protected double getConfiguredGridWeightX() {
+ return 1;
+ }
+
+ @Override
+ protected double getConfiguredGridWeightY() {
+ return 1;
+ }
+
+ @Override
+ protected boolean getConfiguredLabelVisible() {
+ return false;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredRulersVisible() {
+ return false;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredStatusBarVisible() {
+ return false;
+ }
+
+ @Override
+ protected void initConfig() {
+ m_uiFacade = createUIFacade();
+ super.initConfig();
+ setRulersVisible(getConfiguredRulersVisible());
+ setStatusBarVisible(getConfiguredStatusBarVisible());
+ }
+
+ @Override
+ public IDocumentFieldUIFacade getUIFacade() {
+ return m_uiFacade;
+ }
+
+ @Override
+ public void setRulersVisible(boolean b) {
+ propertySupport.setPropertyBool(PROP_RULERS_VISIBLE, b);
+ }
+
+ @Override
+ public boolean isRulersVisible() {
+ return propertySupport.getPropertyBool(PROP_RULERS_VISIBLE);
+ }
+
+ @Override
+ public void setStatusBarVisible(boolean b) {
+ propertySupport.setPropertyBool(PROP_STATUS_BAR_VISIBLE, b);
+ }
+
+ @Override
+ public boolean isStatusBarVisible() {
+ return propertySupport.getPropertyBool(PROP_STATUS_BAR_VISIBLE);
+ }
+
+ @Override
+ public void addDocumentFieldListener(DocumentFieldListener listener) {
+ m_listenerList.add(DocumentFieldListener.class, listener);
+ }
+
+ @Override
+ public void removeDocumentFieldListener(DocumentFieldListener listener) {
+ m_listenerList.remove(DocumentFieldListener.class, listener);
+ }
+
+ @Override
+ public boolean isComReady() {
+ return propertySupport.getPropertyBool(PROP_COM_READY);
+ }
+
+ @ConfigOperation
+ protected void execComReadyStatusChanged(boolean ready) throws ProcessingException {
+ }
+
+ // main handler
+ protected Object fireDocumentFieldEventInternal(DocumentFieldEvent e) throws ProcessingException {
+ Object returnValue = null;
+ ProcessingException exception = null;
+ DocumentFieldListener[] listeners = m_listenerList.getListeners(DocumentFieldListener.class);
+ if (listeners != null && listeners.length > 0) {
+ for (int i = 0; i < listeners.length; i++) {
+ try {
+ Object tmp = listeners[i].documentFieldChanged(e);
+ if (returnValue == null) {
+ returnValue = tmp;
+ }
+ }
+ catch (ProcessingException t) {
+ exception = t;
+ }
+ }
+ }
+
+ if (exception != null) {
+ throw exception;
+ }
+
+ return returnValue;
+ }
+
+ @Override
+ protected boolean execIsSaveNeeded() throws ProcessingException {
+ if (!isInitialized() || getForm().isFormLoading()) {
+ return false;
+ }
+ // mark field for saving. There is no event to listen on...
+ Object ret = fireDocumentFieldEventInternal(new DocumentFieldEvent(AbstractDocumentField.this, DocumentFieldEvent.TYPE_SAVE_NEEDED));
+ return TypeCastUtility.castValue(ret, boolean.class);
+ }
+
+ @Override
+ public RemoteFile save() throws ProcessingException {
+ return saveAs(null, null);
+ }
+
+ @Override
+ public RemoteFile saveAs(String name) throws ProcessingException {
+ return saveAs(name, null);
+ }
+
+ @Override
+ public RemoteFile saveAs(String name, String format) throws ProcessingException {
+ return (RemoteFile) fireDocumentFieldEventInternal(new DocumentFieldEvent(this, DocumentFieldEvent.TYPE_SAVE_AS, new SaveAsData(name, format)));
+ }
+
+ @Override
+ public void autoResizeDocument() {
+ try {
+ fireDocumentFieldEventInternal(new DocumentFieldEvent(this, DocumentFieldEvent.TYPE_AUTORESIZE_DOCUMENT));
+ }
+ catch (ProcessingException e) {
+ LOG.warn("Could not auto resize document", e);
+ }
+ }
+
+ protected IDocumentFieldUIFacade createUIFacade() {
+ return new P_UIFacade();
+ }
+
+ protected class P_UIFacade implements IDocumentFieldUIFacade {
+
+ @Override
+ public void setDocumentFromUI(RemoteFile remoteFile) {
+ try {
+ setFieldChanging(true);
+ setValue(remoteFile);
+ }
+ finally {
+ setFieldChanging(false);
+ }
+ }
+
+ @Override
+ public void fireComReadyFromUI(boolean comReady) {
+ try {
+ if (propertySupport.setPropertyBool(PROP_COM_READY, comReady)) {
+ execComReadyStatusChanged(comReady);
+ }
+ }
+ catch (ProcessingException e) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ catch (Throwable t) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Unexpected", t));
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/documentfield/DocumentFieldEvent.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/documentfield/DocumentFieldEvent.java
index 742dd1cc02..250e29f605 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/documentfield/DocumentFieldEvent.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/documentfield/DocumentFieldEvent.java
@@ -1,95 +1,95 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.documentfield;
-
-import java.util.EventObject;
-
-import org.eclipse.scout.commons.TypeCastUtility;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-
-public class DocumentFieldEvent extends EventObject {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(DocumentFieldEvent.class);
-
- private static final long serialVersionUID = 1L;
-
- public static final int TYPE_SAVE_AS = 10;
- public static final int TYPE_SAVE_NEEDED = 12;
-
- public static final int TYPE_AUTORESIZE_DOCUMENT = 20;
-
- private final int m_type;
- private final Object m_data;
-
- public DocumentFieldEvent(IDocumentField source, int type) {
- super(source);
- m_type = type;
- m_data = null;
- }
-
- public DocumentFieldEvent(IDocumentField source, int type, Object data) {
- super(source);
- m_type = type;
- m_data = data;
- }
-
- public IDocumentField getDocumentField() {
- return (IDocumentField) getSource();
- }
-
- public int getType() {
- return m_type;
- }
-
- public Object getData() {
- return m_data;
- }
-
- public String getDataString() {
- try {
- return TypeCastUtility.castValue(m_data, String.class);
- }
- catch (ClassCastException e) {
- LOG.error("Could not cast data to String");
- }
- return null;
- }
-
- public boolean getDataBool() {
- try {
- return TypeCastUtility.castValue(m_data, boolean.class);
- }
- catch (ClassCastException e) {
- LOG.error("Could not cast data to Boolean");
- }
- return false;
- }
-
- public Long getDataLong() {
- try {
- return TypeCastUtility.castValue(m_data, Long.class);
- }
- catch (ClassCastException e) {
- LOG.error("Could not cast data to Long");
- }
- return null;
- }
-
- public Integer getDataInt() {
- try {
- return TypeCastUtility.castValue(m_data, Integer.class);
- }
- catch (ClassCastException e) {
- LOG.error("Could not cast data to Integer");
- }
- return null;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.documentfield;
+
+import java.util.EventObject;
+
+import org.eclipse.scout.commons.TypeCastUtility;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+
+public class DocumentFieldEvent extends EventObject {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(DocumentFieldEvent.class);
+
+ private static final long serialVersionUID = 1L;
+
+ public static final int TYPE_SAVE_AS = 10;
+ public static final int TYPE_SAVE_NEEDED = 12;
+
+ public static final int TYPE_AUTORESIZE_DOCUMENT = 20;
+
+ private final int m_type;
+ private final Object m_data;
+
+ public DocumentFieldEvent(IDocumentField source, int type) {
+ super(source);
+ m_type = type;
+ m_data = null;
+ }
+
+ public DocumentFieldEvent(IDocumentField source, int type, Object data) {
+ super(source);
+ m_type = type;
+ m_data = data;
+ }
+
+ public IDocumentField getDocumentField() {
+ return (IDocumentField) getSource();
+ }
+
+ public int getType() {
+ return m_type;
+ }
+
+ public Object getData() {
+ return m_data;
+ }
+
+ public String getDataString() {
+ try {
+ return TypeCastUtility.castValue(m_data, String.class);
+ }
+ catch (ClassCastException e) {
+ LOG.error("Could not cast data to String");
+ }
+ return null;
+ }
+
+ public boolean getDataBool() {
+ try {
+ return TypeCastUtility.castValue(m_data, boolean.class);
+ }
+ catch (ClassCastException e) {
+ LOG.error("Could not cast data to Boolean");
+ }
+ return false;
+ }
+
+ public Long getDataLong() {
+ try {
+ return TypeCastUtility.castValue(m_data, Long.class);
+ }
+ catch (ClassCastException e) {
+ LOG.error("Could not cast data to Long");
+ }
+ return null;
+ }
+
+ public Integer getDataInt() {
+ try {
+ return TypeCastUtility.castValue(m_data, Integer.class);
+ }
+ catch (ClassCastException e) {
+ LOG.error("Could not cast data to Integer");
+ }
+ return null;
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/documentfield/DocumentFieldListener.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/documentfield/DocumentFieldListener.java
index 1bf90ebd6f..c5d49ed5dd 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/documentfield/DocumentFieldListener.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/documentfield/DocumentFieldListener.java
@@ -1,19 +1,19 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.documentfield;
-
-import java.util.EventListener;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-
-public interface DocumentFieldListener extends EventListener {
- Object documentFieldChanged(DocumentFieldEvent e) throws ProcessingException;
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.documentfield;
+
+import java.util.EventListener;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+
+public interface DocumentFieldListener extends EventListener {
+ Object documentFieldChanged(DocumentFieldEvent e) throws ProcessingException;
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/documentfield/IDocumentField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/documentfield/IDocumentField.java
index 57dd6c6f91..e548a935fa 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/documentfield/IDocumentField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/documentfield/IDocumentField.java
@@ -1,62 +1,62 @@
-package org.eclipse.scout.rt.client.ui.form.fields.documentfield;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
-import org.eclipse.scout.rt.shared.services.common.file.RemoteFile;
-
-/**
- * see {@link AbstractDocumentField}
- */
-public interface IDocumentField extends IValueField<RemoteFile> {
-
- String PROP_RULERS_VISIBLE = "rulerVisible";
- String PROP_STATUS_BAR_VISIBLE = "statusBarVisible";
- String PROP_COM_READY = "comReady";
-
- void addDocumentFieldListener(DocumentFieldListener listener);
-
- void removeDocumentFieldListener(DocumentFieldListener listener);
-
- boolean isRulersVisible();
-
- void setRulersVisible(boolean b);
-
- boolean isStatusBarVisible();
-
- void setStatusBarVisible(boolean b);
-
- boolean isComReady();
-
- /**
- * <p>
- * Saves the document without updating the value of this document field.
- * </p>
- * <p>
- * When the save of the document (for example in format type html) produces multiple files, then the created
- * RemoteFile contains compressed data (*.zip).
- * </p>
- * <p>
- * If the format is html, a plain-text representation of the document is created as well. Thereby, the name of this
- * file corresponds to the given name and txt as file extension. This file is located in the root directory of the
- * archive generated.
- * </p>
- *
- * @param format
- * doc, dot, odt, html, pdf, ... or null to use the default format.
- */
- public RemoteFile saveAs(String name, String format) throws ProcessingException;
-
- /**
- * @see IDocumentField#saveAs(String, String).
- * @param name
- * @return
- * @throws ProcessingException
- */
- public RemoteFile saveAs(String name) throws ProcessingException;
-
- public RemoteFile save() throws ProcessingException;
-
- void autoResizeDocument();
-
- IDocumentFieldUIFacade getUIFacade();
-}
+package org.eclipse.scout.rt.client.ui.form.fields.documentfield;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
+import org.eclipse.scout.rt.shared.services.common.file.RemoteFile;
+
+/**
+ * see {@link AbstractDocumentField}
+ */
+public interface IDocumentField extends IValueField<RemoteFile> {
+
+ String PROP_RULERS_VISIBLE = "rulerVisible";
+ String PROP_STATUS_BAR_VISIBLE = "statusBarVisible";
+ String PROP_COM_READY = "comReady";
+
+ void addDocumentFieldListener(DocumentFieldListener listener);
+
+ void removeDocumentFieldListener(DocumentFieldListener listener);
+
+ boolean isRulersVisible();
+
+ void setRulersVisible(boolean b);
+
+ boolean isStatusBarVisible();
+
+ void setStatusBarVisible(boolean b);
+
+ boolean isComReady();
+
+ /**
+ * <p>
+ * Saves the document without updating the value of this document field.
+ * </p>
+ * <p>
+ * When the save of the document (for example in format type html) produces multiple files, then the created
+ * RemoteFile contains compressed data (*.zip).
+ * </p>
+ * <p>
+ * If the format is html, a plain-text representation of the document is created as well. Thereby, the name of this
+ * file corresponds to the given name and txt as file extension. This file is located in the root directory of the
+ * archive generated.
+ * </p>
+ *
+ * @param format
+ * doc, dot, odt, html, pdf, ... or null to use the default format.
+ */
+ public RemoteFile saveAs(String name, String format) throws ProcessingException;
+
+ /**
+ * @see IDocumentField#saveAs(String, String).
+ * @param name
+ * @return
+ * @throws ProcessingException
+ */
+ public RemoteFile saveAs(String name) throws ProcessingException;
+
+ public RemoteFile save() throws ProcessingException;
+
+ void autoResizeDocument();
+
+ IDocumentFieldUIFacade getUIFacade();
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/documentfield/IDocumentFieldUIFacade.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/documentfield/IDocumentFieldUIFacade.java
index 4174ca9ce0..a6bc04cea7 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/documentfield/IDocumentFieldUIFacade.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/documentfield/IDocumentFieldUIFacade.java
@@ -1,20 +1,20 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.documentfield;
-
-import org.eclipse.scout.rt.shared.services.common.file.RemoteFile;
-
-public interface IDocumentFieldUIFacade {
-
- void setDocumentFromUI(RemoteFile remoteFile);
-
- void fireComReadyFromUI(boolean comReady);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.documentfield;
+
+import org.eclipse.scout.rt.shared.services.common.file.RemoteFile;
+
+public interface IDocumentFieldUIFacade {
+
+ void setDocumentFromUI(RemoteFile remoteFile);
+
+ void fireComReadyFromUI(boolean comReady);
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/documentfield/eventdata/SaveAsData.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/documentfield/eventdata/SaveAsData.java
index 53dada936f..a5e6672349 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/documentfield/eventdata/SaveAsData.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/documentfield/eventdata/SaveAsData.java
@@ -1,41 +1,41 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.documentfield.eventdata;
-
-
-public class SaveAsData {
- private String m_name;
- private String m_format;
-
- public SaveAsData() {
- }
-
- public SaveAsData(String name, String format) {
- m_name = name;
- m_format = format;
- }
-
- public String getName() {
- return m_name;
- }
-
- public void setName(String name) {
- m_name = name;
- }
-
- public String getFormat() {
- return m_format;
- }
-
- public void setFormat(String format) {
- m_format = format;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.documentfield.eventdata;
+
+
+public class SaveAsData {
+ private String m_name;
+ private String m_format;
+
+ public SaveAsData() {
+ }
+
+ public SaveAsData(String name, String format) {
+ m_name = name;
+ m_format = format;
+ }
+
+ public String getName() {
+ return m_name;
+ }
+
+ public void setName(String name) {
+ m_name = name;
+ }
+
+ public String getFormat() {
+ return m_format;
+ }
+
+ public void setFormat(String format) {
+ m_format = format;
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/doublefield/AbstractDoubleField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/doublefield/AbstractDoubleField.java
index 8b80270326..584f8cc3da 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/doublefield/AbstractDoubleField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/doublefield/AbstractDoubleField.java
@@ -1,106 +1,106 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.doublefield;
-
-import java.text.DecimalFormat;
-import java.text.NumberFormat;
-import java.text.ParsePosition;
-
-import org.eclipse.scout.commons.LocaleThreadLocal;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.form.fields.decimalfield.AbstractDecimalField;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.data.form.ValidationRule;
-
-public abstract class AbstractDoubleField extends AbstractDecimalField<Double> implements IDoubleField {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractDoubleField.class);
-
- public AbstractDoubleField() {
- this(true);
- }
-
- public AbstractDoubleField(boolean callInitializer) {
- super(callInitializer);
- }
-
- /*
- * Configuration
- */
- @ConfigProperty(ConfigProperty.DOUBLE)
- @Order(300)
- @ConfigPropertyValue("null")
- @ValidationRule(ValidationRule.MIN_VALUE)
- protected Double getConfiguredMinimumValue() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.DOUBLE)
- @Order(310)
- @ConfigPropertyValue("null")
- @ValidationRule(ValidationRule.MAX_VALUE)
- protected Double getConfiguredMaximumValue() {
- return null;
- }
-
- @Override
- protected void initConfig() {
- super.initConfig();
- setMinValue(getConfiguredMinimumValue());
- setMaxValue(getConfiguredMaximumValue());
- }
-
- @Override
- protected Double parseValueInternal(String text) throws ProcessingException {
- Double retVal = null;
- if (text == null) {
- text = "";
- }
- else {
- text = text.trim();
- }
- if (text.length() > 0) {
- NumberFormat numberFormat = createNumberFormat();
- if (isPercent()) {
- if (text.endsWith("%")) {
- text = StringUtility.trim(text.substring(0, text.length() - 1));
- }
- String suffix = "%";
- if (numberFormat instanceof DecimalFormat) {
- suffix = ((DecimalFormat) numberFormat).getPositiveSuffix();
- }
- text = StringUtility.concatenateTokens(text, suffix);
- }
- ParsePosition p = new ParsePosition(0);
- Number n = numberFormat.parse(text, p);
- if (p.getErrorIndex() >= 0 || p.getIndex() != text.length()) {
- throw new ProcessingException(ScoutTexts.get("InvalidNumberMessageX", text));
- }
- NumberFormat fmt = NumberFormat.getNumberInstance(LocaleThreadLocal.get());
- /* add/preserve fraction digits for multiplier */
- int npc = ("" + Math.abs(getMultiplier())).length() - 1;
- fmt.setMaximumFractionDigits(getFractionDigits() + npc);
- p = new ParsePosition(0);
- String fmtText = fmt.format(n.doubleValue());
- retVal = new Double(fmt.parse(fmtText, p).doubleValue());
- if (p.getErrorIndex() >= 0 || p.getIndex() != fmtText.length()) {
- throw new ProcessingException(ScoutTexts.get("InvalidNumberMessageX", fmtText));
- }
- }
- return retVal;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.doublefield;
+
+import java.text.DecimalFormat;
+import java.text.NumberFormat;
+import java.text.ParsePosition;
+
+import org.eclipse.scout.commons.LocaleThreadLocal;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.form.fields.decimalfield.AbstractDecimalField;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.data.form.ValidationRule;
+
+public abstract class AbstractDoubleField extends AbstractDecimalField<Double> implements IDoubleField {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractDoubleField.class);
+
+ public AbstractDoubleField() {
+ this(true);
+ }
+
+ public AbstractDoubleField(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ /*
+ * Configuration
+ */
+ @ConfigProperty(ConfigProperty.DOUBLE)
+ @Order(300)
+ @ConfigPropertyValue("null")
+ @ValidationRule(ValidationRule.MIN_VALUE)
+ protected Double getConfiguredMinimumValue() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.DOUBLE)
+ @Order(310)
+ @ConfigPropertyValue("null")
+ @ValidationRule(ValidationRule.MAX_VALUE)
+ protected Double getConfiguredMaximumValue() {
+ return null;
+ }
+
+ @Override
+ protected void initConfig() {
+ super.initConfig();
+ setMinValue(getConfiguredMinimumValue());
+ setMaxValue(getConfiguredMaximumValue());
+ }
+
+ @Override
+ protected Double parseValueInternal(String text) throws ProcessingException {
+ Double retVal = null;
+ if (text == null) {
+ text = "";
+ }
+ else {
+ text = text.trim();
+ }
+ if (text.length() > 0) {
+ NumberFormat numberFormat = createNumberFormat();
+ if (isPercent()) {
+ if (text.endsWith("%")) {
+ text = StringUtility.trim(text.substring(0, text.length() - 1));
+ }
+ String suffix = "%";
+ if (numberFormat instanceof DecimalFormat) {
+ suffix = ((DecimalFormat) numberFormat).getPositiveSuffix();
+ }
+ text = StringUtility.concatenateTokens(text, suffix);
+ }
+ ParsePosition p = new ParsePosition(0);
+ Number n = numberFormat.parse(text, p);
+ if (p.getErrorIndex() >= 0 || p.getIndex() != text.length()) {
+ throw new ProcessingException(ScoutTexts.get("InvalidNumberMessageX", text));
+ }
+ NumberFormat fmt = NumberFormat.getNumberInstance(LocaleThreadLocal.get());
+ /* add/preserve fraction digits for multiplier */
+ int npc = ("" + Math.abs(getMultiplier())).length() - 1;
+ fmt.setMaximumFractionDigits(getFractionDigits() + npc);
+ p = new ParsePosition(0);
+ String fmtText = fmt.format(n.doubleValue());
+ retVal = new Double(fmt.parse(fmtText, p).doubleValue());
+ if (p.getErrorIndex() >= 0 || p.getIndex() != fmtText.length()) {
+ throw new ProcessingException(ScoutTexts.get("InvalidNumberMessageX", fmtText));
+ }
+ }
+ return retVal;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/doublefield/IDoubleField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/doublefield/IDoubleField.java
index 6fd702503c..990dbd102f 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/doublefield/IDoubleField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/doublefield/IDoubleField.java
@@ -1,17 +1,17 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.doublefield;
-
-import org.eclipse.scout.rt.client.ui.form.fields.decimalfield.IDecimalField;
-
-public interface IDoubleField extends IDecimalField<Double> {
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.doublefield;
+
+import org.eclipse.scout.rt.client.ui.form.fields.decimalfield.IDecimalField;
+
+public interface IDoubleField extends IDecimalField<Double> {
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/filechooserfield/AbstractFileChooserField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/filechooserfield/AbstractFileChooserField.java
index 8369d2eadd..4775a85aa3 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/filechooserfield/AbstractFileChooserField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/filechooserfield/AbstractFileChooserField.java
@@ -1,499 +1,499 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.filechooserfield;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.scout.commons.ConfigurationUtility;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.basic.filechooser.FileChooser;
-import org.eclipse.scout.rt.client.ui.basic.filechooser.IFileChooser;
-import org.eclipse.scout.rt.client.ui.form.fields.AbstractValueField;
-import org.eclipse.scout.rt.shared.AbstractIcons;
-import org.eclipse.scout.rt.shared.data.form.ValidationRule;
-import org.eclipse.scout.rt.shared.ui.UserAgentUtility;
-
-public abstract class AbstractFileChooserField extends AbstractValueField<String> implements IFileChooserField {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractFileChooserField.class);
-
- private File m_directory;
- private String[] m_fileExtensions;
- private boolean m_typeLoad;
- private boolean m_folderMode;
- private boolean m_showDirectory;
- private boolean m_showFileName;
- private boolean m_showFileExtension;
- private IMenu[] m_menus;
- private IFileChooserFieldUIFacade m_uiFacade;
-
- public AbstractFileChooserField() {
- this(true);
- }
-
- public AbstractFileChooserField(boolean callInitializer) {
- super(callInitializer);
- }
-
- /*
- * Configuration
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(240)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredFolderMode() {
- return false;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(250)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredShowDirectory() {
- return false;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(260)
- @ConfigPropertyValue("true")
- protected boolean getConfiguredShowFileName() {
- return true;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(270)
- @ConfigPropertyValue("true")
- protected boolean getConfiguredShowFileExtension() {
- return true;
- }
-
- /**
- * Load or Save
- * <ul>
- * <li><code>true</code> loads the file from the file system into the application.</li>
- * <li><code>false</code> saves the file from the application to the file system. Attention: This does not work in
- * RAP/Web-UI</li>
- * </ul>
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(280)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredTypeLoad() {
- return false;
- }
-
- @ConfigProperty(ConfigProperty.FILE_EXTENSIONS)
- @Order(230)
- @ConfigPropertyValue("null")
- protected String[] getConfiguredFileExtensions() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.STRING)
- @Order(290)
- @ConfigPropertyValue("null")
- protected String getConfiguredDirectory() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.ICON_ID)
- @Order(300)
- @ConfigPropertyValue("AbstractIcons.FileChooserFieldFile")
- protected String getConfiguredFileIconId() {
- return AbstractIcons.FileChooserFieldFile;
- }
-
- @ConfigProperty(ConfigProperty.INTEGER)
- @Order(310)
- @ConfigPropertyValue("4000")
- @ValidationRule(ValidationRule.MAX_LENGTH)
- protected int getConfiguredMaxLength() {
- return 4000;
- }
-
- private Class<? extends IMenu>[] getConfiguredMenus() {
- Class<?>[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
- return ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, IMenu.class);
- }
-
- @Override
- protected void initConfig() {
- m_uiFacade = new P_UIFacade();
- super.initConfig();
- setFolderMode(getConfiguredFolderMode());
- setShowDirectory(getConfiguredShowDirectory());
- setShowFileName(getConfiguredShowFileName());
- setShowFileExtension(getConfiguredShowFileExtension());
- setTypeLoad(getConfiguredTypeLoad());
- setFileExtensions(getConfiguredFileExtensions());
- if (getConfiguredDirectory() != null) {
- setDirectory(new File(getConfiguredDirectory()));
- }
- setFileIconId(getConfiguredFileIconId());
- setMaxLength(getConfiguredMaxLength());
- // menus
- ArrayList<IMenu> menuList = new ArrayList<IMenu>();
- Class<? extends IMenu>[] a = getConfiguredMenus();
- for (int i = 0; i < a.length; i++) {
- try {
- IMenu menu = ConfigurationUtility.newInnerInstance(this, a[i]);
- menuList.add(menu);
- }
- catch (Exception e) {
- LOG.warn(null, e);
- }
- }
- try {
- injectMenusInternal(menuList);
- }
- catch (Exception e) {
- LOG.error("error occured while dynamically contributing menus.", e);
- }
- m_menus = menuList.toArray(new IMenu[0]);
- }
-
- /**
- * Override this internal method only in order to make use of dynamic menus<br>
- * Used to manage menu list and add/remove menus
- *
- * @param menuList
- * live and mutable list of configured menus
- */
- protected void injectMenusInternal(List<IMenu> menuList) {
- }
-
- @Override
- public IFileChooserFieldUIFacade getUIFacade() {
- return m_uiFacade;
- }
-
- @Override
- public void setFolderMode(boolean b) {
- m_folderMode = b;
- if (isInitialized()) {
- if (isAutoDisplayText()) {
- setDisplayText(execFormatValue(getValue()));
- }
- }
- }
-
- @Override
- public boolean isFolderMode() {
- return m_folderMode;
- }
-
- @Override
- public void setShowDirectory(boolean b) {
- m_showDirectory = b;
- if (UserAgentUtility.isWebClient()) {
- m_showDirectory = false;
- }
- if (isInitialized()) {
- if (isAutoDisplayText()) {
- setDisplayText(execFormatValue(getValue()));
- }
- }
- }
-
- @Override
- public boolean isShowDirectory() {
- return m_showDirectory;
- }
-
- @Override
- public void setShowFileName(boolean b) {
- m_showFileName = b;
- if (isInitialized()) {
- if (isAutoDisplayText()) {
- setDisplayText(execFormatValue(getValue()));
- }
- }
- }
-
- @Override
- public boolean isShowFileName() {
- return m_showFileName;
- }
-
- @Override
- public void setShowFileExtension(boolean b) {
- m_showFileExtension = b;
- if (isInitialized()) {
- if (isAutoDisplayText()) {
- setDisplayText(execFormatValue(getValue()));
- }
- }
- }
-
- @Override
- public boolean isShowFileExtension() {
- return m_showFileExtension;
- }
-
- @Override
- public void setTypeLoad(boolean b) {
- m_typeLoad = b;
- }
-
- @Override
- public boolean isTypeLoad() {
- return m_typeLoad;
- }
-
- @Override
- public void setFileExtensions(String[] a) {
- m_fileExtensions = a;
- }
-
- @Override
- public String[] getFileExtensions() {
- return m_fileExtensions;
- }
-
- @Override
- public void setDirectory(File d) {
- m_directory = d;
- }
-
- @Override
- public File getDirectory() {
- return m_directory;
- }
-
- @Override
- public void setFileIconId(String s) {
- propertySupport.setPropertyString(PROP_FILE_ICON_ID, s);
- }
-
- @Override
- public String getFileIconId() {
- return propertySupport.getPropertyString(PROP_FILE_ICON_ID);
- }
-
- @Override
- public void setMaxLength(int len) {
- if (len > 0) {
- propertySupport.setPropertyInt(PROP_MAX_LENGTH, len);
- }
- if (isInitialized()) {
- setValue(getValue());
- }
- }
-
- @Override
- public int getMaxLength() {
- int len = propertySupport.getPropertyInt(PROP_MAX_LENGTH);
- if (len <= 0) {
- len = 200;
- }
- return len;
- }
-
- @Override
- public IMenu[] getMenus() {
- return m_menus;
- }
-
- @Override
- public boolean hasMenus() {
- return m_menus.length > 0;
- }
-
- @Override
- public IFileChooser getFileChooser() {
- FileChooser fc = new FileChooser();
- fc.setTypeLoad(isTypeLoad());
- fc.setFolderMode(isFolderMode());
- fc.setDirectory(getDirectory());
- fc.setFileName(getFileName());
- fc.setFileExtensions(getFileExtensions());
- fc.setMultiSelect(false);
- return fc;
- }
-
- // Convenience file getter
- @Override
- public File getValueAsFile() {
- String value = getValue();
- if (value == null) {
- return null;
- }
- else {
- return new File(value);
- }
- }
-
- @Override
- public String getFileName() {
- File f = getValueAsFile();
- if (f != null) {
- return f.getName();
- }
- else {
- return null;
- }
- }
-
- @Override
- public long getFileSize() {
- File f = getValueAsFile();
- if (f != null) {
- return f.length();
- }
- else {
- return 0;
- }
- }
-
- @Override
- public boolean fileExists() {
- if (getValue() == null) {
- return false;
- }
- return getValueAsFile().exists();
- }
-
- // format value for display
- @Override
- protected String formatValueInternal(String validValue) {
- String s = validValue;
- if (s != null && s.length() > 0) {
- File f = new File(s);
- if (isFolderMode()) {
- if (isShowDirectory()) {
- s = f.getAbsolutePath();
- }
- else {
- s = f.getName();
- }
- }
- else {
- if (isShowDirectory() && isShowFileName() && isShowFileExtension()) {
- s = f.getAbsolutePath();
- }
- else {
- String p = StringUtility.valueOf(f.getParent());
- String n = f.getName();
- String e = "";
- if (n.indexOf('.') >= 0) {
- int i = n.lastIndexOf('.');
- e = n.substring(i);
- n = n.substring(0, i);
- }
- s = "";
- if (isShowDirectory()) {
- s = p;
- }
- if (isShowFileName()) {
- if (s.length() > 0) {
- s = s + File.separator;
- }
- s = s + n;
- }
- if (isShowFileExtension()) {
- s = s + e;
- }
- }
- }
- }
- return s;
- }
-
- @Override
- protected String parseValueInternal(String text) throws ProcessingException {
- String retVal = null;
- if (text != null && text.trim().length() == 0) {
- text = null;
- }
- if (text != null) {
- text = text.trim();
- text = StringUtility.unquoteText(text);
- File f = new File(text);
- String p = "";
- if (f.isAbsolute()) {
- p = f.getParent();
- }
- else {
- // inherit path from existing value
- File existingFile = getValueAsFile();
- if (existingFile != null && existingFile.isAbsolute()) {
- p = existingFile.getParent();
- }
- }
- String n = f.getName();
- String e = "";
- if (n.indexOf('.') >= 0) {
- int i = n.lastIndexOf('.');
- e = n.substring(i);
- n = n.substring(0, i);
- }
- text = n;
- if (p.length() == 0 && getDirectory() != null) {
- p = getDirectory().getAbsolutePath();
- }
- if (e.length() == 0 && m_fileExtensions != null && m_fileExtensions.length > 0) {
- e = "." + m_fileExtensions[0];
- }
- text = p;
- if (p.length() > 0) {
- text += File.separator;
- }
- text += n;
- text += e;
- retVal = text;
- }
- return retVal;
- }
-
- @Override
- protected String validateValueInternal(String text) throws ProcessingException {
- if (text != null && text.length() == 0) {
- text = null;
- }
- if (text != null) {
- if (text.length() > getMaxLength()) {
- text = text.substring(0, getMaxLength());
- }
- }
- return text;
- }
-
- private class P_UIFacade implements IFileChooserFieldUIFacade {
-
- @Override
- public IMenu[] firePopupFromUI() {
- ArrayList<IMenu> menus = new ArrayList<IMenu>();
- for (IMenu menu : getMenus()) {
- menu.prepareAction();
- if (menu.isVisible()) {
- menus.add(menu);
- }
- }
- return menus.toArray(new IMenu[0]);
- }
-
- @Override
- public boolean setTextFromUI(String newText) {
- if (newText != null && newText.length() == 0) {
- newText = null;
- }
- return parseValue(newText);
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.filechooserfield;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.scout.commons.ConfigurationUtility;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.basic.filechooser.FileChooser;
+import org.eclipse.scout.rt.client.ui.basic.filechooser.IFileChooser;
+import org.eclipse.scout.rt.client.ui.form.fields.AbstractValueField;
+import org.eclipse.scout.rt.shared.AbstractIcons;
+import org.eclipse.scout.rt.shared.data.form.ValidationRule;
+import org.eclipse.scout.rt.shared.ui.UserAgentUtility;
+
+public abstract class AbstractFileChooserField extends AbstractValueField<String> implements IFileChooserField {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractFileChooserField.class);
+
+ private File m_directory;
+ private String[] m_fileExtensions;
+ private boolean m_typeLoad;
+ private boolean m_folderMode;
+ private boolean m_showDirectory;
+ private boolean m_showFileName;
+ private boolean m_showFileExtension;
+ private IMenu[] m_menus;
+ private IFileChooserFieldUIFacade m_uiFacade;
+
+ public AbstractFileChooserField() {
+ this(true);
+ }
+
+ public AbstractFileChooserField(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ /*
+ * Configuration
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(240)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredFolderMode() {
+ return false;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(250)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredShowDirectory() {
+ return false;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(260)
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredShowFileName() {
+ return true;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(270)
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredShowFileExtension() {
+ return true;
+ }
+
+ /**
+ * Load or Save
+ * <ul>
+ * <li><code>true</code> loads the file from the file system into the application.</li>
+ * <li><code>false</code> saves the file from the application to the file system. Attention: This does not work in
+ * RAP/Web-UI</li>
+ * </ul>
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(280)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredTypeLoad() {
+ return false;
+ }
+
+ @ConfigProperty(ConfigProperty.FILE_EXTENSIONS)
+ @Order(230)
+ @ConfigPropertyValue("null")
+ protected String[] getConfiguredFileExtensions() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.STRING)
+ @Order(290)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredDirectory() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.ICON_ID)
+ @Order(300)
+ @ConfigPropertyValue("AbstractIcons.FileChooserFieldFile")
+ protected String getConfiguredFileIconId() {
+ return AbstractIcons.FileChooserFieldFile;
+ }
+
+ @ConfigProperty(ConfigProperty.INTEGER)
+ @Order(310)
+ @ConfigPropertyValue("4000")
+ @ValidationRule(ValidationRule.MAX_LENGTH)
+ protected int getConfiguredMaxLength() {
+ return 4000;
+ }
+
+ private Class<? extends IMenu>[] getConfiguredMenus() {
+ Class<?>[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
+ return ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, IMenu.class);
+ }
+
+ @Override
+ protected void initConfig() {
+ m_uiFacade = new P_UIFacade();
+ super.initConfig();
+ setFolderMode(getConfiguredFolderMode());
+ setShowDirectory(getConfiguredShowDirectory());
+ setShowFileName(getConfiguredShowFileName());
+ setShowFileExtension(getConfiguredShowFileExtension());
+ setTypeLoad(getConfiguredTypeLoad());
+ setFileExtensions(getConfiguredFileExtensions());
+ if (getConfiguredDirectory() != null) {
+ setDirectory(new File(getConfiguredDirectory()));
+ }
+ setFileIconId(getConfiguredFileIconId());
+ setMaxLength(getConfiguredMaxLength());
+ // menus
+ ArrayList<IMenu> menuList = new ArrayList<IMenu>();
+ Class<? extends IMenu>[] a = getConfiguredMenus();
+ for (int i = 0; i < a.length; i++) {
+ try {
+ IMenu menu = ConfigurationUtility.newInnerInstance(this, a[i]);
+ menuList.add(menu);
+ }
+ catch (Exception e) {
+ LOG.warn(null, e);
+ }
+ }
+ try {
+ injectMenusInternal(menuList);
+ }
+ catch (Exception e) {
+ LOG.error("error occured while dynamically contributing menus.", e);
+ }
+ m_menus = menuList.toArray(new IMenu[0]);
+ }
+
+ /**
+ * Override this internal method only in order to make use of dynamic menus<br>
+ * Used to manage menu list and add/remove menus
+ *
+ * @param menuList
+ * live and mutable list of configured menus
+ */
+ protected void injectMenusInternal(List<IMenu> menuList) {
+ }
+
+ @Override
+ public IFileChooserFieldUIFacade getUIFacade() {
+ return m_uiFacade;
+ }
+
+ @Override
+ public void setFolderMode(boolean b) {
+ m_folderMode = b;
+ if (isInitialized()) {
+ if (isAutoDisplayText()) {
+ setDisplayText(execFormatValue(getValue()));
+ }
+ }
+ }
+
+ @Override
+ public boolean isFolderMode() {
+ return m_folderMode;
+ }
+
+ @Override
+ public void setShowDirectory(boolean b) {
+ m_showDirectory = b;
+ if (UserAgentUtility.isWebClient()) {
+ m_showDirectory = false;
+ }
+ if (isInitialized()) {
+ if (isAutoDisplayText()) {
+ setDisplayText(execFormatValue(getValue()));
+ }
+ }
+ }
+
+ @Override
+ public boolean isShowDirectory() {
+ return m_showDirectory;
+ }
+
+ @Override
+ public void setShowFileName(boolean b) {
+ m_showFileName = b;
+ if (isInitialized()) {
+ if (isAutoDisplayText()) {
+ setDisplayText(execFormatValue(getValue()));
+ }
+ }
+ }
+
+ @Override
+ public boolean isShowFileName() {
+ return m_showFileName;
+ }
+
+ @Override
+ public void setShowFileExtension(boolean b) {
+ m_showFileExtension = b;
+ if (isInitialized()) {
+ if (isAutoDisplayText()) {
+ setDisplayText(execFormatValue(getValue()));
+ }
+ }
+ }
+
+ @Override
+ public boolean isShowFileExtension() {
+ return m_showFileExtension;
+ }
+
+ @Override
+ public void setTypeLoad(boolean b) {
+ m_typeLoad = b;
+ }
+
+ @Override
+ public boolean isTypeLoad() {
+ return m_typeLoad;
+ }
+
+ @Override
+ public void setFileExtensions(String[] a) {
+ m_fileExtensions = a;
+ }
+
+ @Override
+ public String[] getFileExtensions() {
+ return m_fileExtensions;
+ }
+
+ @Override
+ public void setDirectory(File d) {
+ m_directory = d;
+ }
+
+ @Override
+ public File getDirectory() {
+ return m_directory;
+ }
+
+ @Override
+ public void setFileIconId(String s) {
+ propertySupport.setPropertyString(PROP_FILE_ICON_ID, s);
+ }
+
+ @Override
+ public String getFileIconId() {
+ return propertySupport.getPropertyString(PROP_FILE_ICON_ID);
+ }
+
+ @Override
+ public void setMaxLength(int len) {
+ if (len > 0) {
+ propertySupport.setPropertyInt(PROP_MAX_LENGTH, len);
+ }
+ if (isInitialized()) {
+ setValue(getValue());
+ }
+ }
+
+ @Override
+ public int getMaxLength() {
+ int len = propertySupport.getPropertyInt(PROP_MAX_LENGTH);
+ if (len <= 0) {
+ len = 200;
+ }
+ return len;
+ }
+
+ @Override
+ public IMenu[] getMenus() {
+ return m_menus;
+ }
+
+ @Override
+ public boolean hasMenus() {
+ return m_menus.length > 0;
+ }
+
+ @Override
+ public IFileChooser getFileChooser() {
+ FileChooser fc = new FileChooser();
+ fc.setTypeLoad(isTypeLoad());
+ fc.setFolderMode(isFolderMode());
+ fc.setDirectory(getDirectory());
+ fc.setFileName(getFileName());
+ fc.setFileExtensions(getFileExtensions());
+ fc.setMultiSelect(false);
+ return fc;
+ }
+
+ // Convenience file getter
+ @Override
+ public File getValueAsFile() {
+ String value = getValue();
+ if (value == null) {
+ return null;
+ }
+ else {
+ return new File(value);
+ }
+ }
+
+ @Override
+ public String getFileName() {
+ File f = getValueAsFile();
+ if (f != null) {
+ return f.getName();
+ }
+ else {
+ return null;
+ }
+ }
+
+ @Override
+ public long getFileSize() {
+ File f = getValueAsFile();
+ if (f != null) {
+ return f.length();
+ }
+ else {
+ return 0;
+ }
+ }
+
+ @Override
+ public boolean fileExists() {
+ if (getValue() == null) {
+ return false;
+ }
+ return getValueAsFile().exists();
+ }
+
+ // format value for display
+ @Override
+ protected String formatValueInternal(String validValue) {
+ String s = validValue;
+ if (s != null && s.length() > 0) {
+ File f = new File(s);
+ if (isFolderMode()) {
+ if (isShowDirectory()) {
+ s = f.getAbsolutePath();
+ }
+ else {
+ s = f.getName();
+ }
+ }
+ else {
+ if (isShowDirectory() && isShowFileName() && isShowFileExtension()) {
+ s = f.getAbsolutePath();
+ }
+ else {
+ String p = StringUtility.valueOf(f.getParent());
+ String n = f.getName();
+ String e = "";
+ if (n.indexOf('.') >= 0) {
+ int i = n.lastIndexOf('.');
+ e = n.substring(i);
+ n = n.substring(0, i);
+ }
+ s = "";
+ if (isShowDirectory()) {
+ s = p;
+ }
+ if (isShowFileName()) {
+ if (s.length() > 0) {
+ s = s + File.separator;
+ }
+ s = s + n;
+ }
+ if (isShowFileExtension()) {
+ s = s + e;
+ }
+ }
+ }
+ }
+ return s;
+ }
+
+ @Override
+ protected String parseValueInternal(String text) throws ProcessingException {
+ String retVal = null;
+ if (text != null && text.trim().length() == 0) {
+ text = null;
+ }
+ if (text != null) {
+ text = text.trim();
+ text = StringUtility.unquoteText(text);
+ File f = new File(text);
+ String p = "";
+ if (f.isAbsolute()) {
+ p = f.getParent();
+ }
+ else {
+ // inherit path from existing value
+ File existingFile = getValueAsFile();
+ if (existingFile != null && existingFile.isAbsolute()) {
+ p = existingFile.getParent();
+ }
+ }
+ String n = f.getName();
+ String e = "";
+ if (n.indexOf('.') >= 0) {
+ int i = n.lastIndexOf('.');
+ e = n.substring(i);
+ n = n.substring(0, i);
+ }
+ text = n;
+ if (p.length() == 0 && getDirectory() != null) {
+ p = getDirectory().getAbsolutePath();
+ }
+ if (e.length() == 0 && m_fileExtensions != null && m_fileExtensions.length > 0) {
+ e = "." + m_fileExtensions[0];
+ }
+ text = p;
+ if (p.length() > 0) {
+ text += File.separator;
+ }
+ text += n;
+ text += e;
+ retVal = text;
+ }
+ return retVal;
+ }
+
+ @Override
+ protected String validateValueInternal(String text) throws ProcessingException {
+ if (text != null && text.length() == 0) {
+ text = null;
+ }
+ if (text != null) {
+ if (text.length() > getMaxLength()) {
+ text = text.substring(0, getMaxLength());
+ }
+ }
+ return text;
+ }
+
+ private class P_UIFacade implements IFileChooserFieldUIFacade {
+
+ @Override
+ public IMenu[] firePopupFromUI() {
+ ArrayList<IMenu> menus = new ArrayList<IMenu>();
+ for (IMenu menu : getMenus()) {
+ menu.prepareAction();
+ if (menu.isVisible()) {
+ menus.add(menu);
+ }
+ }
+ return menus.toArray(new IMenu[0]);
+ }
+
+ @Override
+ public boolean setTextFromUI(String newText) {
+ if (newText != null && newText.length() == 0) {
+ newText = null;
+ }
+ return parseValue(newText);
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/filechooserfield/IFileChooserField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/filechooserfield/IFileChooserField.java
index 345da5086c..607584da7c 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/filechooserfield/IFileChooserField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/filechooserfield/IFileChooserField.java
@@ -1,88 +1,88 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.filechooserfield;
-
-import java.io.File;
-
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.basic.filechooser.IFileChooser;
-import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
-
-public interface IFileChooserField extends IValueField<String> {
-
- String PROP_FILE_ICON_ID = "fileIconId";
-
- String PROP_MAX_LENGTH = "maxLength";
-
- void setFolderMode(boolean b);
-
- boolean isFolderMode();
-
- void setShowDirectory(boolean b);
-
- boolean isShowDirectory();
-
- void setShowFileName(boolean b);
-
- boolean isShowFileName();
-
- void setShowFileExtension(boolean b);
-
- boolean isShowFileExtension();
-
- /**
- * Load or Save
- * <ul>
- * <li><code>true</code> loads the file from the file system into the application.</li>
- * <li><code>false</code> saves the file from the application to the file system. Attention: This does not work in
- * RAP/Web-UI</li>
- * </ul>
- */
- void setTypeLoad(boolean b);
-
- /**
- * @see #setTypeLoad(boolean)
- */
- boolean isTypeLoad();
-
- void setFileExtensions(String[] extensions);
-
- String[] getFileExtensions();
-
- void setDirectory(File d);
-
- File getDirectory();
-
- void setFileIconId(String s);
-
- String getFileIconId();
-
- void setMaxLength(int len);
-
- int getMaxLength();
-
- IMenu[] getMenus();
-
- boolean hasMenus();
-
- IFileChooser getFileChooser();
-
- // Convenience file getter
- File getValueAsFile();
-
- String getFileName();
-
- long getFileSize();
-
- boolean fileExists();
-
- IFileChooserFieldUIFacade getUIFacade();
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.filechooserfield;
+
+import java.io.File;
+
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.basic.filechooser.IFileChooser;
+import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
+
+public interface IFileChooserField extends IValueField<String> {
+
+ String PROP_FILE_ICON_ID = "fileIconId";
+
+ String PROP_MAX_LENGTH = "maxLength";
+
+ void setFolderMode(boolean b);
+
+ boolean isFolderMode();
+
+ void setShowDirectory(boolean b);
+
+ boolean isShowDirectory();
+
+ void setShowFileName(boolean b);
+
+ boolean isShowFileName();
+
+ void setShowFileExtension(boolean b);
+
+ boolean isShowFileExtension();
+
+ /**
+ * Load or Save
+ * <ul>
+ * <li><code>true</code> loads the file from the file system into the application.</li>
+ * <li><code>false</code> saves the file from the application to the file system. Attention: This does not work in
+ * RAP/Web-UI</li>
+ * </ul>
+ */
+ void setTypeLoad(boolean b);
+
+ /**
+ * @see #setTypeLoad(boolean)
+ */
+ boolean isTypeLoad();
+
+ void setFileExtensions(String[] extensions);
+
+ String[] getFileExtensions();
+
+ void setDirectory(File d);
+
+ File getDirectory();
+
+ void setFileIconId(String s);
+
+ String getFileIconId();
+
+ void setMaxLength(int len);
+
+ int getMaxLength();
+
+ IMenu[] getMenus();
+
+ boolean hasMenus();
+
+ IFileChooser getFileChooser();
+
+ // Convenience file getter
+ File getValueAsFile();
+
+ String getFileName();
+
+ long getFileSize();
+
+ boolean fileExists();
+
+ IFileChooserFieldUIFacade getUIFacade();
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/filechooserfield/IFileChooserFieldUIFacade.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/filechooserfield/IFileChooserFieldUIFacade.java
index 90f4806809..9834513bad 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/filechooserfield/IFileChooserFieldUIFacade.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/filechooserfield/IFileChooserFieldUIFacade.java
@@ -1,21 +1,21 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.filechooserfield;
-
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-
-public interface IFileChooserFieldUIFacade {
-
- IMenu[] firePopupFromUI();
-
- boolean setTextFromUI(String newText);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.filechooserfield;
+
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+
+public interface IFileChooserFieldUIFacade {
+
+ IMenu[] firePopupFromUI();
+
+ boolean setTextFromUI(String newText);
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/groupbox/AbstractGroupBox.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/groupbox/AbstractGroupBox.java
index 67d146fcf3..a56b966f27 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/groupbox/AbstractGroupBox.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/groupbox/AbstractGroupBox.java
@@ -1,531 +1,531 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.groupbox;
-
-import java.util.ArrayList;
-
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.rt.client.services.common.icon.IIconProviderService;
-import org.eclipse.scout.rt.client.ui.action.keystroke.DefaultFormEnterKeyStroke;
-import org.eclipse.scout.rt.client.ui.action.keystroke.DefaultFormEscapeKeyStroke;
-import org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke;
-import org.eclipse.scout.rt.client.ui.form.fields.AbstractCompositeField;
-import org.eclipse.scout.rt.client.ui.form.fields.AbstractFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.GridData;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.internal.GroupBoxBodyGrid;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.internal.GroupBoxProcessButtonGrid;
-
-public abstract class AbstractGroupBox extends AbstractCompositeField implements IGroupBox {
-
- private IGroupBoxUIFacade m_uiFacade;
- private boolean m_mainBoxFlag = false;
- private int m_gridColumnCountHint;
- private boolean m_scrollable;
- private IFormField[] m_controlFields;
- private IGroupBox[] m_groupBoxes;
- private IButton[] m_customButtons;
- private IButton[] m_systemButtons;
- private GroupBoxBodyGrid m_bodyGrid;
- private GroupBoxProcessButtonGrid m_customProcessButtonGrid;
- private GroupBoxProcessButtonGrid m_systemProcessButtonGrid;
-
- public AbstractGroupBox() {
- this(true);
- }
-
- public AbstractGroupBox(boolean callInitializer) {
- super(callInitializer);
- }
-
- /**
- * {@inheritDoc} Default for group boxes is true.
- */
- @ConfigPropertyValue("true")
- @Override
- protected boolean getConfiguredGridUseUiHeight() {
- return true;
- }
-
- /**
- * Configures the number of columns used in this group box.<br>
- * A typical {@link IFormField} inside a group box spans one column. This behavior can be changed by setting
- * {@link AbstractFormField#getConfiguredGridW()}.
- * <p>
- * Subclasses can override this method. Default is -1 which typically means 2 columns.
- *
- * @return the number of columns used in this group box
- */
- @ConfigProperty(ConfigProperty.INTEGER)
- @Order(200)
- @ConfigPropertyValue("-1")
- protected int getConfiguredGridColumnCount() {
- return -1;
- }
-
- /**
- * Configures the border visibility for this group box. <br>
- * If the property is set to true, a border will be displayed
- * around the group box. The style of the border is configured by {@link #getConfiguredBorderDecoration()}.<br>
- * If the
- * property is set to false, no border will be displayed and the margin reserved for the border will be removed.
- * <p>
- * <b>Hint:</b> Keep in mind that setting the border to invisible also removes the margin which could lead to a
- * misalignment of the fields if several group boxes are used on a form. In order to preserve the correct alignment
- * consider using {@link #getConfiguredBorderDecoration()} with {@link IGroupBox#BORDER_DECORATION_EMPTY} and
- * {@link #getConfiguredBorderVisible()} with {@code true} instead.
- * <p>
- * Subclasses can override this method. Default is {@code true}.
- *
- * @return {@code true} if the border is visible, {@code false} otherwise.
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(230)
- @ConfigPropertyValue("true")
- protected boolean getConfiguredBorderVisible() {
- return true;
- }
-
- /**
- * Configures whether this group box should be expandable or not.<br>
- * This property depends on the border decoration which can be configured by {@link #getConfiguredBorderDecoration()}.
- * It typically only has an effect if the border decoration is set to {@link IGroupBox#BORDER_DECORATION_SECTION} or
- * {@link IGroupBox#BORDER_DECORATION_AUTO}.
- * <p>
- * Subclasses can override this method. Default is {@code false}.
- *
- * @return {@code true} if the group box should be expandable, {@code false} otherwise.
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(231)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredExpandable() {
- return false;
- }
-
- /**
- * Configures whether this group box is initially expanded. <br>
- * This property only has an effect if the group box is expandable which can be configured by
- * {@link #getConfiguredExpandable()}.
- * <p>
- * Subclasses can override this method. Default is {@code true}.
- *
- * @return {@code true} if the group box should be initially expanded, {@code false} otherwise.
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(232)
- @ConfigPropertyValue("true")
- protected boolean getConfiguredExpanded() {
- return true;
- }
-
- /**
- * Configures the border decoration for this group box. See {@code IGroupBox#BORDER_DECORATION_*} constants for valid
- * values.<br>
- * This property only has an effect if the border is visible which can be configured by
- * {@link #getConfiguredBorderVisible()}.
- * <p>
- * Subclasses can override this method. Default is {@link IGroupBox#BORDER_DECORATION_AUTO}.
- *
- * @return the border decoration of the group box
- */
- @ConfigProperty(ConfigProperty.STRING)
- @Order(233)
- @ConfigPropertyValue("BORDER_DECORATION_AUTO")
- protected String getConfiguredBorderDecoration() {
- return BORDER_DECORATION_AUTO;
- }
-
- /**
- * Configures the background image for this group box.
- * <p>
- * Subclasses can override this method. Default is {@code null}.
- *
- * @return the ID (name) of the image
- * @see IIconProviderService
- */
- @ConfigProperty(ConfigProperty.STRING)
- @Order(240)
- @ConfigPropertyValue("null")
- protected String getConfiguredBackgroundImageName() {
- return null;
- }
-
- /**
- * Configures the horizontal alignment of the background image.<br>
- * This property only has an effect if the group box has a background image which can be configured by
- * {@link #getConfiguredBackgroundImageName()}
- * <p>
- * Subclasses can override this method. Default alignment is center.
- *
- * @return -1 for left, 0 for center and 1 for right alignment
- */
- @ConfigProperty(ConfigProperty.HORIZONTAL_ALIGNMENT)
- @Order(250)
- @ConfigPropertyValue("0")
- protected int getConfiguredBackgroundImageHorizontalAlignment() {
- return 0;
- }
-
- /**
- * Configures the vertical alignment of the background image.<br>
- * This property only has an effect if the group box has a background image which can be configured by
- * {@link #getConfiguredBackgroundImageName()}
- * <p>
- * Subclasses can override this method. Default alignment is center.
- *
- * @return -1 for top, 0 for center and 1 for bottom alignment
- */
- @ConfigProperty(ConfigProperty.VERTICAL_ALIGNMENT)
- @Order(260)
- @ConfigPropertyValue("0")
- protected int getConfiguredBackgroundImageVerticalAlignment() {
- return 0;
- }
-
- /**
- * Configures whether this group box should be scrollable.</br>
- * If the property is set to true, a vertical scrollbar will appear if the content is too large to be displayed.
- * <p>
- * Subclasses can override this method. Default is false.
- *
- * @return {@code true} if the group box should be scrollable, {@code false} otherwise.
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(270)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredScrollable() {
- return false;
- }
-
- /**
- * Configures the column span of this group box.<br>
- * The value defined by this property refers to the number of columns defined by the container of this group box. <br>
- * The column count of the container, which actually is the parent group box, can be configured by
- * {@link #getConfiguredGridColumnCount()} (you need to configure that in the parent group box).
- * <p>
- * <b>Example:</b> If the column count of the container is set to 3 and a column span of this group box is set to 2 it
- * means 2/3 of the container width is used for this group box.
- * <p>
- * Subclasses can override this method. Default is {@link IFormField#FULL_WIDTH} which means it spans every column of
- * the container.
- *
- * @return the number of columns to span
- */
- @Override
- @ConfigPropertyValue("FULL_WIDTH")
- protected int getConfiguredGridW() {
- return FULL_WIDTH;
- }
-
- @Override
- protected void initConfig() {
- m_uiFacade = new P_UIFacade();
- m_bodyGrid = new GroupBoxBodyGrid(this);
- m_customProcessButtonGrid = new GroupBoxProcessButtonGrid(this, true, false);
- m_systemProcessButtonGrid = new GroupBoxProcessButtonGrid(this, false, true);
- super.initConfig();
- IFormField[] a = getFields();
- // categorize items
- ArrayList<IFormField> controlList = new ArrayList<IFormField>();
- ArrayList<IGroupBox> groupList = new ArrayList<IGroupBox>();
- ArrayList<IButton> customButtonList = new ArrayList<IButton>();
- ArrayList<IButton> systemButtonList = new ArrayList<IButton>();
- for (int i = 0; i < a.length; i++) {
- IFormField f = a[i];
- if (f instanceof IGroupBox) {
- groupList.add((IGroupBox) f);
- controlList.add(f);
- }
- else if (f instanceof IButton) {
- IButton b = (IButton) f;
- if (b.isProcessButton()) {
- if (b.getSystemType() != IButton.SYSTEM_TYPE_NONE) {
- systemButtonList.add((IButton) f);
- }
- else {
- customButtonList.add((IButton) f);
- }
- }
- else {
- controlList.add(f);
- }
- }
- else {
- controlList.add(f);
- }
- }
- m_controlFields = controlList.toArray(new IFormField[controlList.size()]);
- m_groupBoxes = groupList.toArray(new IGroupBox[groupList.size()]);
- m_customButtons = customButtonList.toArray(new IButton[customButtonList.size()]);
- m_systemButtons = systemButtonList.toArray(new IButton[systemButtonList.size()]);
- //
- setExpandable(getConfiguredExpandable());
- setExpanded(getConfiguredExpanded());
- setBorderVisible(getConfiguredBorderVisible());
- setBorderDecoration(getConfiguredBorderDecoration());
- setGridColumnCountHint(getConfiguredGridColumnCount());
- setBackgroundImageName(getConfiguredBackgroundImageName());
- setBackgroundImageHorizontalAlignment(getConfiguredBackgroundImageHorizontalAlignment());
- setBackgroundImageVerticalAlignment(getConfiguredBackgroundImageVerticalAlignment());
- setScrollable(getConfiguredScrollable());
- }
-
- @Override
- public IKeyStroke[] getContributedKeyStrokes() {
- ArrayList<IKeyStroke> list = new ArrayList<IKeyStroke>(2);
- if (isMainBox() && (getForm() != null && getForm().getOuterForm() == null)) {
- // add default escape and enter key stroke only if no similar key stroke
- // is defined on the mainbox
- boolean hasEnter = false;
- boolean hasEscape = false;
- for (IKeyStroke ks : getLocalKeyStrokes()) {
- if ("enter".equalsIgnoreCase(ks.getKeyStroke())) {
- hasEnter = true;
- }
- if ("escape".equalsIgnoreCase(ks.getKeyStroke())) {
- hasEscape = true;
- }
- }
- if (!hasEnter) {
- list.add(new DefaultFormEnterKeyStroke(getForm()));
- }
- if (!hasEscape) {
- list.add(new DefaultFormEscapeKeyStroke(getForm()));
- }
- }
- return list.toArray(new IKeyStroke[list.size()]);
- }
-
- @Override
- public void rebuildFieldGrid() {
- m_bodyGrid.validate();
- m_customProcessButtonGrid.validate();
- m_systemProcessButtonGrid.validate();
- if (isInitialized()) {
- if (getForm() != null) {
- getForm().structureChanged(this);
- }
- }
- }
-
- @Override
- public boolean isMainBox() {
- return m_mainBoxFlag;
- }
-
- @Override
- public void setMainBox(boolean b) {
- m_mainBoxFlag = b;
- }
-
- @Override
- public int getGroupBoxIndex(IGroupBox groupBox) {
- for (int i = 0; i < m_groupBoxes.length; i++) {
- if (m_groupBoxes[i] == groupBox) {
- return i;
- }
- }
- return -1;
- }
-
- @Override
- public int getCustomProcessButtonCount() {
- return m_customButtons.length;
- }
-
- @Override
- public int getGroupBoxCount() {
- return m_groupBoxes.length;
- }
-
- @Override
- public int getSystemProcessButtonCount() {
- return m_systemButtons.length;
- }
-
- @Override
- public IGroupBox[] getGroupBoxes() {
- IGroupBox[] a = new IGroupBox[m_groupBoxes.length];
- System.arraycopy(m_groupBoxes, 0, a, 0, a.length);
- return a;
- }
-
- @Override
- public IFormField[] getControlFields() {
- IFormField[] a = new IFormField[m_controlFields.length];
- System.arraycopy(m_controlFields, 0, a, 0, a.length);
- return a;
- }
-
- @Override
- public IButton[] getCustomProcessButtons() {
- IButton[] a = new IButton[m_customButtons.length];
- System.arraycopy(m_customButtons, 0, a, 0, a.length);
- return a;
- }
-
- @Override
- public IButton[] getSystemProcessButtons() {
- IButton[] a = new IButton[m_systemButtons.length];
- System.arraycopy(m_systemButtons, 0, a, 0, a.length);
- return a;
- }
-
- @Override
- public final int getGridColumnCount() {
- return m_bodyGrid.getGridColumnCount();
- }
-
- @Override
- public final int getGridRowCount() {
- return m_bodyGrid.getGridRowCount();
- }
-
- @Override
- public void setGridColumnCountHint(int c) {
- m_gridColumnCountHint = c;
- if (isInitialized()) {
- rebuildFieldGrid();
- }
- }
-
- @Override
- public int getGridColumnCountHint() {
- return m_gridColumnCountHint;
- }
-
- @Override
- public boolean isScrollable() {
- return m_scrollable;
- }
-
- @Override
- public void setScrollable(boolean scrollable) {
- if (m_scrollable != scrollable) {
- m_scrollable = scrollable;
- if (m_scrollable) {
- // force weighty to be > 0
- GridData gd = getGridDataHints();
- if (gd.weightY <= 0) {
- gd.weightY = 1;
- setGridDataHints(gd);
- }
- }
- }
- }
-
- // box is only visible when it has at least one visible item
- @Override
- protected void handleFieldVisibilityChanged() {
- super.handleFieldVisibilityChanged();
- if (isInitialized()) {
- rebuildFieldGrid();
- }
- }
-
- @Override
- public boolean isBorderVisible() {
- return propertySupport.getPropertyBool(PROP_BORDER_VISIBLE);
- }
-
- @Override
- public void setBorderVisible(boolean b) {
- propertySupport.setPropertyBool(PROP_BORDER_VISIBLE, b);
- }
-
- @Override
- public String getBorderDecoration() {
- return propertySupport.getPropertyString(PROP_BORDER_DECORATION);
- }
-
- @Override
- public void setBorderDecoration(String s) {
- propertySupport.setPropertyString(PROP_BORDER_DECORATION, s);
- }
-
- @Override
- public boolean isExpandable() {
- return propertySupport.getPropertyBool(PROP_EXPANDABLE);
- }
-
- @Override
- public void setExpandable(boolean b) {
- propertySupport.setPropertyBool(PROP_EXPANDABLE, b);
- }
-
- @Override
- public boolean isExpanded() {
- return propertySupport.getPropertyBool(PROP_EXPANDED);
- }
-
- @Override
- public void setExpanded(boolean b) {
- propertySupport.setPropertyBool(PROP_EXPANDED, b);
- }
-
- @Override
- public IGroupBoxUIFacade getUIFacade() {
- return m_uiFacade;
- }
-
- @Override
- public void setBackgroundImageName(String imageName) {
- propertySupport.setPropertyString(PROP_BACKGROUND_IMAGE_NAME, imageName);
- }
-
- @Override
- public String getBackgroundImageName() {
- return propertySupport.getPropertyString(PROP_BACKGROUND_IMAGE_NAME);
- }
-
- /**
- * @since Build 178
- */
- @Override
- public void setBackgroundImageVerticalAlignment(int a) {
- propertySupport.setPropertyInt(PROP_BACKGROUND_IMAGE_VERTICAL_ALIGNMENT, a);
- }
-
- /**
- * @since Build 178
- */
- @Override
- public int getBackgroundImageVerticalAlignment() {
- return propertySupport.getPropertyInt(PROP_BACKGROUND_IMAGE_VERTICAL_ALIGNMENT);
- }
-
- /**
- * @since Build 178
- */
- @Override
- public void setBackgroundImageHorizontalAlignment(int a) {
- propertySupport.setPropertyInt(PROP_BACKGROUND_IMAGE_HORIZONTAL_ALIGNMENT, a);
- }
-
- /**
- * @since Build 178
- */
- @Override
- public int getBackgroundImageHorizontalAlignment() {
- return propertySupport.getPropertyInt(PROP_BACKGROUND_IMAGE_HORIZONTAL_ALIGNMENT);
- }
-
- private class P_UIFacade implements IGroupBoxUIFacade {
- @Override
- public void setExpandedFromUI(boolean expanded) {
- setExpanded(expanded);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.groupbox;
+
+import java.util.ArrayList;
+
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.rt.client.services.common.icon.IIconProviderService;
+import org.eclipse.scout.rt.client.ui.action.keystroke.DefaultFormEnterKeyStroke;
+import org.eclipse.scout.rt.client.ui.action.keystroke.DefaultFormEscapeKeyStroke;
+import org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke;
+import org.eclipse.scout.rt.client.ui.form.fields.AbstractCompositeField;
+import org.eclipse.scout.rt.client.ui.form.fields.AbstractFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.GridData;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.internal.GroupBoxBodyGrid;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.internal.GroupBoxProcessButtonGrid;
+
+public abstract class AbstractGroupBox extends AbstractCompositeField implements IGroupBox {
+
+ private IGroupBoxUIFacade m_uiFacade;
+ private boolean m_mainBoxFlag = false;
+ private int m_gridColumnCountHint;
+ private boolean m_scrollable;
+ private IFormField[] m_controlFields;
+ private IGroupBox[] m_groupBoxes;
+ private IButton[] m_customButtons;
+ private IButton[] m_systemButtons;
+ private GroupBoxBodyGrid m_bodyGrid;
+ private GroupBoxProcessButtonGrid m_customProcessButtonGrid;
+ private GroupBoxProcessButtonGrid m_systemProcessButtonGrid;
+
+ public AbstractGroupBox() {
+ this(true);
+ }
+
+ public AbstractGroupBox(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ /**
+ * {@inheritDoc} Default for group boxes is true.
+ */
+ @ConfigPropertyValue("true")
+ @Override
+ protected boolean getConfiguredGridUseUiHeight() {
+ return true;
+ }
+
+ /**
+ * Configures the number of columns used in this group box.<br>
+ * A typical {@link IFormField} inside a group box spans one column. This behavior can be changed by setting
+ * {@link AbstractFormField#getConfiguredGridW()}.
+ * <p>
+ * Subclasses can override this method. Default is -1 which typically means 2 columns.
+ *
+ * @return the number of columns used in this group box
+ */
+ @ConfigProperty(ConfigProperty.INTEGER)
+ @Order(200)
+ @ConfigPropertyValue("-1")
+ protected int getConfiguredGridColumnCount() {
+ return -1;
+ }
+
+ /**
+ * Configures the border visibility for this group box. <br>
+ * If the property is set to true, a border will be displayed
+ * around the group box. The style of the border is configured by {@link #getConfiguredBorderDecoration()}.<br>
+ * If the
+ * property is set to false, no border will be displayed and the margin reserved for the border will be removed.
+ * <p>
+ * <b>Hint:</b> Keep in mind that setting the border to invisible also removes the margin which could lead to a
+ * misalignment of the fields if several group boxes are used on a form. In order to preserve the correct alignment
+ * consider using {@link #getConfiguredBorderDecoration()} with {@link IGroupBox#BORDER_DECORATION_EMPTY} and
+ * {@link #getConfiguredBorderVisible()} with {@code true} instead.
+ * <p>
+ * Subclasses can override this method. Default is {@code true}.
+ *
+ * @return {@code true} if the border is visible, {@code false} otherwise.
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(230)
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredBorderVisible() {
+ return true;
+ }
+
+ /**
+ * Configures whether this group box should be expandable or not.<br>
+ * This property depends on the border decoration which can be configured by {@link #getConfiguredBorderDecoration()}.
+ * It typically only has an effect if the border decoration is set to {@link IGroupBox#BORDER_DECORATION_SECTION} or
+ * {@link IGroupBox#BORDER_DECORATION_AUTO}.
+ * <p>
+ * Subclasses can override this method. Default is {@code false}.
+ *
+ * @return {@code true} if the group box should be expandable, {@code false} otherwise.
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(231)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredExpandable() {
+ return false;
+ }
+
+ /**
+ * Configures whether this group box is initially expanded. <br>
+ * This property only has an effect if the group box is expandable which can be configured by
+ * {@link #getConfiguredExpandable()}.
+ * <p>
+ * Subclasses can override this method. Default is {@code true}.
+ *
+ * @return {@code true} if the group box should be initially expanded, {@code false} otherwise.
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(232)
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredExpanded() {
+ return true;
+ }
+
+ /**
+ * Configures the border decoration for this group box. See {@code IGroupBox#BORDER_DECORATION_*} constants for valid
+ * values.<br>
+ * This property only has an effect if the border is visible which can be configured by
+ * {@link #getConfiguredBorderVisible()}.
+ * <p>
+ * Subclasses can override this method. Default is {@link IGroupBox#BORDER_DECORATION_AUTO}.
+ *
+ * @return the border decoration of the group box
+ */
+ @ConfigProperty(ConfigProperty.STRING)
+ @Order(233)
+ @ConfigPropertyValue("BORDER_DECORATION_AUTO")
+ protected String getConfiguredBorderDecoration() {
+ return BORDER_DECORATION_AUTO;
+ }
+
+ /**
+ * Configures the background image for this group box.
+ * <p>
+ * Subclasses can override this method. Default is {@code null}.
+ *
+ * @return the ID (name) of the image
+ * @see IIconProviderService
+ */
+ @ConfigProperty(ConfigProperty.STRING)
+ @Order(240)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredBackgroundImageName() {
+ return null;
+ }
+
+ /**
+ * Configures the horizontal alignment of the background image.<br>
+ * This property only has an effect if the group box has a background image which can be configured by
+ * {@link #getConfiguredBackgroundImageName()}
+ * <p>
+ * Subclasses can override this method. Default alignment is center.
+ *
+ * @return -1 for left, 0 for center and 1 for right alignment
+ */
+ @ConfigProperty(ConfigProperty.HORIZONTAL_ALIGNMENT)
+ @Order(250)
+ @ConfigPropertyValue("0")
+ protected int getConfiguredBackgroundImageHorizontalAlignment() {
+ return 0;
+ }
+
+ /**
+ * Configures the vertical alignment of the background image.<br>
+ * This property only has an effect if the group box has a background image which can be configured by
+ * {@link #getConfiguredBackgroundImageName()}
+ * <p>
+ * Subclasses can override this method. Default alignment is center.
+ *
+ * @return -1 for top, 0 for center and 1 for bottom alignment
+ */
+ @ConfigProperty(ConfigProperty.VERTICAL_ALIGNMENT)
+ @Order(260)
+ @ConfigPropertyValue("0")
+ protected int getConfiguredBackgroundImageVerticalAlignment() {
+ return 0;
+ }
+
+ /**
+ * Configures whether this group box should be scrollable.</br>
+ * If the property is set to true, a vertical scrollbar will appear if the content is too large to be displayed.
+ * <p>
+ * Subclasses can override this method. Default is false.
+ *
+ * @return {@code true} if the group box should be scrollable, {@code false} otherwise.
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(270)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredScrollable() {
+ return false;
+ }
+
+ /**
+ * Configures the column span of this group box.<br>
+ * The value defined by this property refers to the number of columns defined by the container of this group box. <br>
+ * The column count of the container, which actually is the parent group box, can be configured by
+ * {@link #getConfiguredGridColumnCount()} (you need to configure that in the parent group box).
+ * <p>
+ * <b>Example:</b> If the column count of the container is set to 3 and a column span of this group box is set to 2 it
+ * means 2/3 of the container width is used for this group box.
+ * <p>
+ * Subclasses can override this method. Default is {@link IFormField#FULL_WIDTH} which means it spans every column of
+ * the container.
+ *
+ * @return the number of columns to span
+ */
+ @Override
+ @ConfigPropertyValue("FULL_WIDTH")
+ protected int getConfiguredGridW() {
+ return FULL_WIDTH;
+ }
+
+ @Override
+ protected void initConfig() {
+ m_uiFacade = new P_UIFacade();
+ m_bodyGrid = new GroupBoxBodyGrid(this);
+ m_customProcessButtonGrid = new GroupBoxProcessButtonGrid(this, true, false);
+ m_systemProcessButtonGrid = new GroupBoxProcessButtonGrid(this, false, true);
+ super.initConfig();
+ IFormField[] a = getFields();
+ // categorize items
+ ArrayList<IFormField> controlList = new ArrayList<IFormField>();
+ ArrayList<IGroupBox> groupList = new ArrayList<IGroupBox>();
+ ArrayList<IButton> customButtonList = new ArrayList<IButton>();
+ ArrayList<IButton> systemButtonList = new ArrayList<IButton>();
+ for (int i = 0; i < a.length; i++) {
+ IFormField f = a[i];
+ if (f instanceof IGroupBox) {
+ groupList.add((IGroupBox) f);
+ controlList.add(f);
+ }
+ else if (f instanceof IButton) {
+ IButton b = (IButton) f;
+ if (b.isProcessButton()) {
+ if (b.getSystemType() != IButton.SYSTEM_TYPE_NONE) {
+ systemButtonList.add((IButton) f);
+ }
+ else {
+ customButtonList.add((IButton) f);
+ }
+ }
+ else {
+ controlList.add(f);
+ }
+ }
+ else {
+ controlList.add(f);
+ }
+ }
+ m_controlFields = controlList.toArray(new IFormField[controlList.size()]);
+ m_groupBoxes = groupList.toArray(new IGroupBox[groupList.size()]);
+ m_customButtons = customButtonList.toArray(new IButton[customButtonList.size()]);
+ m_systemButtons = systemButtonList.toArray(new IButton[systemButtonList.size()]);
+ //
+ setExpandable(getConfiguredExpandable());
+ setExpanded(getConfiguredExpanded());
+ setBorderVisible(getConfiguredBorderVisible());
+ setBorderDecoration(getConfiguredBorderDecoration());
+ setGridColumnCountHint(getConfiguredGridColumnCount());
+ setBackgroundImageName(getConfiguredBackgroundImageName());
+ setBackgroundImageHorizontalAlignment(getConfiguredBackgroundImageHorizontalAlignment());
+ setBackgroundImageVerticalAlignment(getConfiguredBackgroundImageVerticalAlignment());
+ setScrollable(getConfiguredScrollable());
+ }
+
+ @Override
+ public IKeyStroke[] getContributedKeyStrokes() {
+ ArrayList<IKeyStroke> list = new ArrayList<IKeyStroke>(2);
+ if (isMainBox() && (getForm() != null && getForm().getOuterForm() == null)) {
+ // add default escape and enter key stroke only if no similar key stroke
+ // is defined on the mainbox
+ boolean hasEnter = false;
+ boolean hasEscape = false;
+ for (IKeyStroke ks : getLocalKeyStrokes()) {
+ if ("enter".equalsIgnoreCase(ks.getKeyStroke())) {
+ hasEnter = true;
+ }
+ if ("escape".equalsIgnoreCase(ks.getKeyStroke())) {
+ hasEscape = true;
+ }
+ }
+ if (!hasEnter) {
+ list.add(new DefaultFormEnterKeyStroke(getForm()));
+ }
+ if (!hasEscape) {
+ list.add(new DefaultFormEscapeKeyStroke(getForm()));
+ }
+ }
+ return list.toArray(new IKeyStroke[list.size()]);
+ }
+
+ @Override
+ public void rebuildFieldGrid() {
+ m_bodyGrid.validate();
+ m_customProcessButtonGrid.validate();
+ m_systemProcessButtonGrid.validate();
+ if (isInitialized()) {
+ if (getForm() != null) {
+ getForm().structureChanged(this);
+ }
+ }
+ }
+
+ @Override
+ public boolean isMainBox() {
+ return m_mainBoxFlag;
+ }
+
+ @Override
+ public void setMainBox(boolean b) {
+ m_mainBoxFlag = b;
+ }
+
+ @Override
+ public int getGroupBoxIndex(IGroupBox groupBox) {
+ for (int i = 0; i < m_groupBoxes.length; i++) {
+ if (m_groupBoxes[i] == groupBox) {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+ @Override
+ public int getCustomProcessButtonCount() {
+ return m_customButtons.length;
+ }
+
+ @Override
+ public int getGroupBoxCount() {
+ return m_groupBoxes.length;
+ }
+
+ @Override
+ public int getSystemProcessButtonCount() {
+ return m_systemButtons.length;
+ }
+
+ @Override
+ public IGroupBox[] getGroupBoxes() {
+ IGroupBox[] a = new IGroupBox[m_groupBoxes.length];
+ System.arraycopy(m_groupBoxes, 0, a, 0, a.length);
+ return a;
+ }
+
+ @Override
+ public IFormField[] getControlFields() {
+ IFormField[] a = new IFormField[m_controlFields.length];
+ System.arraycopy(m_controlFields, 0, a, 0, a.length);
+ return a;
+ }
+
+ @Override
+ public IButton[] getCustomProcessButtons() {
+ IButton[] a = new IButton[m_customButtons.length];
+ System.arraycopy(m_customButtons, 0, a, 0, a.length);
+ return a;
+ }
+
+ @Override
+ public IButton[] getSystemProcessButtons() {
+ IButton[] a = new IButton[m_systemButtons.length];
+ System.arraycopy(m_systemButtons, 0, a, 0, a.length);
+ return a;
+ }
+
+ @Override
+ public final int getGridColumnCount() {
+ return m_bodyGrid.getGridColumnCount();
+ }
+
+ @Override
+ public final int getGridRowCount() {
+ return m_bodyGrid.getGridRowCount();
+ }
+
+ @Override
+ public void setGridColumnCountHint(int c) {
+ m_gridColumnCountHint = c;
+ if (isInitialized()) {
+ rebuildFieldGrid();
+ }
+ }
+
+ @Override
+ public int getGridColumnCountHint() {
+ return m_gridColumnCountHint;
+ }
+
+ @Override
+ public boolean isScrollable() {
+ return m_scrollable;
+ }
+
+ @Override
+ public void setScrollable(boolean scrollable) {
+ if (m_scrollable != scrollable) {
+ m_scrollable = scrollable;
+ if (m_scrollable) {
+ // force weighty to be > 0
+ GridData gd = getGridDataHints();
+ if (gd.weightY <= 0) {
+ gd.weightY = 1;
+ setGridDataHints(gd);
+ }
+ }
+ }
+ }
+
+ // box is only visible when it has at least one visible item
+ @Override
+ protected void handleFieldVisibilityChanged() {
+ super.handleFieldVisibilityChanged();
+ if (isInitialized()) {
+ rebuildFieldGrid();
+ }
+ }
+
+ @Override
+ public boolean isBorderVisible() {
+ return propertySupport.getPropertyBool(PROP_BORDER_VISIBLE);
+ }
+
+ @Override
+ public void setBorderVisible(boolean b) {
+ propertySupport.setPropertyBool(PROP_BORDER_VISIBLE, b);
+ }
+
+ @Override
+ public String getBorderDecoration() {
+ return propertySupport.getPropertyString(PROP_BORDER_DECORATION);
+ }
+
+ @Override
+ public void setBorderDecoration(String s) {
+ propertySupport.setPropertyString(PROP_BORDER_DECORATION, s);
+ }
+
+ @Override
+ public boolean isExpandable() {
+ return propertySupport.getPropertyBool(PROP_EXPANDABLE);
+ }
+
+ @Override
+ public void setExpandable(boolean b) {
+ propertySupport.setPropertyBool(PROP_EXPANDABLE, b);
+ }
+
+ @Override
+ public boolean isExpanded() {
+ return propertySupport.getPropertyBool(PROP_EXPANDED);
+ }
+
+ @Override
+ public void setExpanded(boolean b) {
+ propertySupport.setPropertyBool(PROP_EXPANDED, b);
+ }
+
+ @Override
+ public IGroupBoxUIFacade getUIFacade() {
+ return m_uiFacade;
+ }
+
+ @Override
+ public void setBackgroundImageName(String imageName) {
+ propertySupport.setPropertyString(PROP_BACKGROUND_IMAGE_NAME, imageName);
+ }
+
+ @Override
+ public String getBackgroundImageName() {
+ return propertySupport.getPropertyString(PROP_BACKGROUND_IMAGE_NAME);
+ }
+
+ /**
+ * @since Build 178
+ */
+ @Override
+ public void setBackgroundImageVerticalAlignment(int a) {
+ propertySupport.setPropertyInt(PROP_BACKGROUND_IMAGE_VERTICAL_ALIGNMENT, a);
+ }
+
+ /**
+ * @since Build 178
+ */
+ @Override
+ public int getBackgroundImageVerticalAlignment() {
+ return propertySupport.getPropertyInt(PROP_BACKGROUND_IMAGE_VERTICAL_ALIGNMENT);
+ }
+
+ /**
+ * @since Build 178
+ */
+ @Override
+ public void setBackgroundImageHorizontalAlignment(int a) {
+ propertySupport.setPropertyInt(PROP_BACKGROUND_IMAGE_HORIZONTAL_ALIGNMENT, a);
+ }
+
+ /**
+ * @since Build 178
+ */
+ @Override
+ public int getBackgroundImageHorizontalAlignment() {
+ return propertySupport.getPropertyInt(PROP_BACKGROUND_IMAGE_HORIZONTAL_ALIGNMENT);
+ }
+
+ private class P_UIFacade implements IGroupBoxUIFacade {
+ @Override
+ public void setExpandedFromUI(boolean expanded) {
+ setExpanded(expanded);
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/groupbox/IGroupBox.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/groupbox/IGroupBox.java
index 8f1a444cc3..e551c41678 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/groupbox/IGroupBox.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/groupbox/IGroupBox.java
@@ -1,161 +1,161 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.groupbox;
-
-import org.eclipse.scout.rt.client.ui.form.fields.ICompositeField;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
-
-public interface IGroupBox extends ICompositeField {
-
- /**
- * {@link Boolean}
- */
- String PROP_BORDER_VISIBLE = "borderVisible";
- /**
- * {@link Boolean}
- */
- String PROP_EXPANDABLE = "expandable";
- /**
- * {@link Boolean}
- */
- String PROP_EXPANDED = "expanded";
- /**
- * {@link String}
- */
- String PROP_BORDER_DECORATION = "borderDecoration";
- /**
- * {@link String}
- */
- String PROP_BACKGROUND_IMAGE_NAME = "backgroundImageName";
- /**
- * {@link Integer}
- */
- String PROP_BACKGROUND_IMAGE_HORIZONTAL_ALIGNMENT = "backgroundImageHorizontalAlignment";
- /**
- * {@link Integer}
- */
- String PROP_BACKGROUND_IMAGE_VERTICAL_ALIGNMENT = "backgroundImageVerticalAlignment";
-
- String BORDER_DECORATION_EMPTY = "empty";
- String BORDER_DECORATION_LINE = "line";
- String BORDER_DECORATION_SECTION = "section";
- /**
- * automatic border decoration
- * <ul>
- * <li>expandable=true uses section border</li>
- * <li>MainBox (IGroupBox#isMainBox()) has no border</li>
- * <li>groupbog inside tab box (IGroupBox#isMainBox()) has no border</li>
- * <li>all others use line border</li>
- * </ul>
- */
- String BORDER_DECORATION_AUTO = "auto";
-
- /*
- * Runtime
- */
-
- /**
- * The index of the groupbox in the parent box
- */
- int getGroupBoxIndex(IGroupBox groupBox);
-
- int getGroupBoxCount();
-
- int getCustomProcessButtonCount();
-
- int getSystemProcessButtonCount();
-
- /**
- * fields excluding process buttons
- */
- IFormField[] getControlFields();
-
- IGroupBox[] getGroupBoxes();
-
- /**
- * buttons with processButton=true and systemType=none
- */
- IButton[] getCustomProcessButtons();
-
- /**
- * buttons with processButton=true and systemType<>none
- */
- IButton[] getSystemProcessButtons();
-
- boolean isMainBox();
-
- void setMainBox(boolean b);
-
- boolean isBorderVisible();
-
- void setBorderVisible(boolean b);
-
- /**
- * When borderEnabled=true: borderDecoration="line" shows a line decoration around box, borderDecoration="none" or
- * null shows just insets.<br>
- * borderDecoration="section" shows a section header<br>
- * Other custom borderDecorations are possible and must be handled in the appropriate GUI factory.
- * <p>
- * Note that this is just the style of the border. To define a section group with expand/collapse, use
- * {@link #getConfiguredExpandable()}, {@link #isExpandable()} and {@link #isExpanded()}<br>
- */
- String getBorderDecoration();
-
- void setBorderDecoration(String s);
-
- String getBackgroundImageName();
-
- void setBackgroundImageName(String imageName);
-
- int getBackgroundImageVerticalAlignment();
-
- void setBackgroundImageVerticalAlignment(int a);
-
- int getBackgroundImageHorizontalAlignment();
-
- void setBackgroundImageHorizontalAlignment(int a);
-
- /**
- * column count for this composite box<br>
- * see {@value #GRID_COLUMN_COUNT_INHERITED} for inherited column count
- */
- int getGridColumnCountHint();
-
- /**
- * @param c
- * column count for this composite box<br>
- * see {@value #GRID_COLUMN_COUNT_INHERITED} for inherited column
- * count
- */
- void setGridColumnCountHint(int c);
-
- boolean isScrollable();
-
- void setScrollable(boolean scrollable);
-
- /**
- * @return true if the group <i>can</i> be collapsed
- * see {@link #isExpanded()} to see if border is effectively expanded or collapsed
- */
- boolean isExpandable();
-
- void setExpandable(boolean b);
-
- /**
- * @return true if the group is expanded
- */
- boolean isExpanded();
-
- void setExpanded(boolean b);
-
- IGroupBoxUIFacade getUIFacade();
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.groupbox;
+
+import org.eclipse.scout.rt.client.ui.form.fields.ICompositeField;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
+
+public interface IGroupBox extends ICompositeField {
+
+ /**
+ * {@link Boolean}
+ */
+ String PROP_BORDER_VISIBLE = "borderVisible";
+ /**
+ * {@link Boolean}
+ */
+ String PROP_EXPANDABLE = "expandable";
+ /**
+ * {@link Boolean}
+ */
+ String PROP_EXPANDED = "expanded";
+ /**
+ * {@link String}
+ */
+ String PROP_BORDER_DECORATION = "borderDecoration";
+ /**
+ * {@link String}
+ */
+ String PROP_BACKGROUND_IMAGE_NAME = "backgroundImageName";
+ /**
+ * {@link Integer}
+ */
+ String PROP_BACKGROUND_IMAGE_HORIZONTAL_ALIGNMENT = "backgroundImageHorizontalAlignment";
+ /**
+ * {@link Integer}
+ */
+ String PROP_BACKGROUND_IMAGE_VERTICAL_ALIGNMENT = "backgroundImageVerticalAlignment";
+
+ String BORDER_DECORATION_EMPTY = "empty";
+ String BORDER_DECORATION_LINE = "line";
+ String BORDER_DECORATION_SECTION = "section";
+ /**
+ * automatic border decoration
+ * <ul>
+ * <li>expandable=true uses section border</li>
+ * <li>MainBox (IGroupBox#isMainBox()) has no border</li>
+ * <li>groupbog inside tab box (IGroupBox#isMainBox()) has no border</li>
+ * <li>all others use line border</li>
+ * </ul>
+ */
+ String BORDER_DECORATION_AUTO = "auto";
+
+ /*
+ * Runtime
+ */
+
+ /**
+ * The index of the groupbox in the parent box
+ */
+ int getGroupBoxIndex(IGroupBox groupBox);
+
+ int getGroupBoxCount();
+
+ int getCustomProcessButtonCount();
+
+ int getSystemProcessButtonCount();
+
+ /**
+ * fields excluding process buttons
+ */
+ IFormField[] getControlFields();
+
+ IGroupBox[] getGroupBoxes();
+
+ /**
+ * buttons with processButton=true and systemType=none
+ */
+ IButton[] getCustomProcessButtons();
+
+ /**
+ * buttons with processButton=true and systemType<>none
+ */
+ IButton[] getSystemProcessButtons();
+
+ boolean isMainBox();
+
+ void setMainBox(boolean b);
+
+ boolean isBorderVisible();
+
+ void setBorderVisible(boolean b);
+
+ /**
+ * When borderEnabled=true: borderDecoration="line" shows a line decoration around box, borderDecoration="none" or
+ * null shows just insets.<br>
+ * borderDecoration="section" shows a section header<br>
+ * Other custom borderDecorations are possible and must be handled in the appropriate GUI factory.
+ * <p>
+ * Note that this is just the style of the border. To define a section group with expand/collapse, use
+ * {@link #getConfiguredExpandable()}, {@link #isExpandable()} and {@link #isExpanded()}<br>
+ */
+ String getBorderDecoration();
+
+ void setBorderDecoration(String s);
+
+ String getBackgroundImageName();
+
+ void setBackgroundImageName(String imageName);
+
+ int getBackgroundImageVerticalAlignment();
+
+ void setBackgroundImageVerticalAlignment(int a);
+
+ int getBackgroundImageHorizontalAlignment();
+
+ void setBackgroundImageHorizontalAlignment(int a);
+
+ /**
+ * column count for this composite box<br>
+ * see {@value #GRID_COLUMN_COUNT_INHERITED} for inherited column count
+ */
+ int getGridColumnCountHint();
+
+ /**
+ * @param c
+ * column count for this composite box<br>
+ * see {@value #GRID_COLUMN_COUNT_INHERITED} for inherited column
+ * count
+ */
+ void setGridColumnCountHint(int c);
+
+ boolean isScrollable();
+
+ void setScrollable(boolean scrollable);
+
+ /**
+ * @return true if the group <i>can</i> be collapsed
+ * see {@link #isExpanded()} to see if border is effectively expanded or collapsed
+ */
+ boolean isExpandable();
+
+ void setExpandable(boolean b);
+
+ /**
+ * @return true if the group is expanded
+ */
+ boolean isExpanded();
+
+ void setExpanded(boolean b);
+
+ IGroupBoxUIFacade getUIFacade();
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/groupbox/IGroupBoxUIFacade.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/groupbox/IGroupBoxUIFacade.java
index 851a2788e4..fa9389efe6 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/groupbox/IGroupBoxUIFacade.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/groupbox/IGroupBoxUIFacade.java
@@ -1,20 +1,20 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.groupbox;
-
-/**
- *
- */
-public interface IGroupBoxUIFacade {
-
- void setExpandedFromUI(boolean expanded);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.groupbox;
+
+/**
+ *
+ */
+public interface IGroupBoxUIFacade {
+
+ void setExpandedFromUI(boolean expanded);
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/groupbox/internal/GridCell.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/groupbox/internal/GridCell.java
index 041b77277c..8d60ccf90c 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/groupbox/internal/GridCell.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/groupbox/internal/GridCell.java
@@ -1,181 +1,181 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.groupbox.internal;
-
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.form.fields.GridData;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
-import org.eclipse.scout.rt.client.ui.form.fields.internal.GridDataBuilder;
-
-/**
- * Grid Cell as container helper for dynamic layouting in scout
- */
-public class GridCell {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(GridCell.class);
-
- private IFormField m_field;
- private int m_gridColumnCount;
- private GridCell m_up, m_down, m_right;
-
- protected GridData data;
-
- public GridCell(IFormField f, int gridColumnCount) {
- m_field = f;
- m_gridColumnCount = gridColumnCount;
- if (f != null) {
- GridData hints = GridDataBuilder.createFromHints(f, gridColumnCount);
- data = new GridData(hints);
- }
- }
-
- public IFormField getField() {
- return m_field;
- }
-
- // down, then right
- protected void calculateGridLayout(int gridX, int gridY) {
- if (data.w >= m_gridColumnCount || gridX >= m_gridColumnCount) {
- gridX = 0;
- }
- data.x = gridX;
- data.y = gridY;
- //
- if (m_field != null) {
- m_field.setGridDataInternal(new GridData(data));
- }
- //
- if (m_down != null) {
- m_down.calculateGridLayout(gridX, gridY + data.h);
- }
- if (m_right != null) {
- m_right.calculateGridLayout(gridX + data.w, gridY);
- }
- }
-
- protected GridCell getSplitCell(int before, int maxWeight, int colCount) {
- int after = maxWeight - before - data.h * data.w;
- // split-off item with ancestor and descendant
- if ((colCount - 1) * before >= (data.h + after)) {
- return this;
- }
- // split-off item with ancestor and no descendant
- if (before > 0 && after == 0) {
- return this;
- }
- // not the split-off item
- if (m_down != null) {
- GridCell cell = m_down.getSplitCell(before + data.h, maxWeight, colCount);
- if (cell != null) {
- return cell;
- }
- }
- if (m_right != null) {
- GridCell cell = m_right.getSplitCell(before, maxWeight, colCount);
- if (cell != null) {
- return cell;
- }
- }
- return null;
- }
-
- /**
- * used for splitting of items the weight is the maximum y (getMaxY()) but
- * weighted with the column count. so an item of 4 rows and 2 columns adds a
- * weight of 4*2
- */
- protected int getMaxWeight() {
- int wDown = m_down != null ? m_down.getMaxWeight() : 0;
- int wRight = m_right != null ? m_right.getMaxWeight() : 0;
- return Math.max(data.h * Math.max(data.w, 1) + wDown, wRight);
- }
-
- protected int getMaxY() {
- int mdown = m_down != null ? m_down.getMaxY() : 0;
- int mright = m_right != null ? m_right.getMaxY() : 0;
- return Math.max(data.h + mdown, mright);
- }
-
- protected int getMaxCols() {
- int mdown = m_down != null ? m_down.getMaxCols() : 0;
- int mright = m_right != null ? m_right.getMaxCols() : 0;
- return Math.max(mdown, data.w + mright);
- }
-
- protected void addBottomCell(GridCell c) {// down or right
- int mdown = m_down != null ? m_down.getMaxY() : 0;
- int mright = m_right != null ? m_right.getMaxY() : 0;
- if (m_down != null && data.h + mdown >= mright) {
- m_down.addBottomCellImpl(c);
- }
- else if (m_right != null && mright > data.h) {
- m_right.addBottomCellImpl(c);
- }
- else {
- this.m_down = c;
- c.m_up = this;
- }
- }
-
- private void addBottomCellImpl(GridCell c) {// down only
- if (m_down != null) {
- m_down.addBottomCellImpl(c);
- }
- else {
- this.m_down = c;
- c.m_up = this;
- }
- }
-
- protected GridCell getUp() {
- return m_up;
- }
-
- protected void setDown(GridCell down) {
- m_down = down;
- }
-
- protected void setRight(GridCell right) {
- m_right = right;
- }
-
- protected boolean isProcessButton() {
- if (m_field instanceof IButton) {
- return ((IButton) m_field).isProcessButton();
- }
- else {
- return false;
- }
- }
-
- protected boolean isSystemProcessButton() {
- if (isProcessButton()) {
- return ((IButton) m_field).getSystemType() != IButton.SYSTEM_TYPE_NONE;
- }
- else {
- return false;
- }
- }
-
- @Override
- public String toString() {
- StringBuffer buf = new StringBuffer();
- buf.append(getClass().getSimpleName());
- buf.append("[");
- buf.append(data);
- buf.append(" field=" + (m_field != null ? m_field.getFieldId() : null));
- buf.append(" class=" + (m_field != null ? m_field.getClass() : null));
- buf.append("]");
- return buf.toString();
- }
-
-}// end class
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.groupbox.internal;
+
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.form.fields.GridData;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
+import org.eclipse.scout.rt.client.ui.form.fields.internal.GridDataBuilder;
+
+/**
+ * Grid Cell as container helper for dynamic layouting in scout
+ */
+public class GridCell {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(GridCell.class);
+
+ private IFormField m_field;
+ private int m_gridColumnCount;
+ private GridCell m_up, m_down, m_right;
+
+ protected GridData data;
+
+ public GridCell(IFormField f, int gridColumnCount) {
+ m_field = f;
+ m_gridColumnCount = gridColumnCount;
+ if (f != null) {
+ GridData hints = GridDataBuilder.createFromHints(f, gridColumnCount);
+ data = new GridData(hints);
+ }
+ }
+
+ public IFormField getField() {
+ return m_field;
+ }
+
+ // down, then right
+ protected void calculateGridLayout(int gridX, int gridY) {
+ if (data.w >= m_gridColumnCount || gridX >= m_gridColumnCount) {
+ gridX = 0;
+ }
+ data.x = gridX;
+ data.y = gridY;
+ //
+ if (m_field != null) {
+ m_field.setGridDataInternal(new GridData(data));
+ }
+ //
+ if (m_down != null) {
+ m_down.calculateGridLayout(gridX, gridY + data.h);
+ }
+ if (m_right != null) {
+ m_right.calculateGridLayout(gridX + data.w, gridY);
+ }
+ }
+
+ protected GridCell getSplitCell(int before, int maxWeight, int colCount) {
+ int after = maxWeight - before - data.h * data.w;
+ // split-off item with ancestor and descendant
+ if ((colCount - 1) * before >= (data.h + after)) {
+ return this;
+ }
+ // split-off item with ancestor and no descendant
+ if (before > 0 && after == 0) {
+ return this;
+ }
+ // not the split-off item
+ if (m_down != null) {
+ GridCell cell = m_down.getSplitCell(before + data.h, maxWeight, colCount);
+ if (cell != null) {
+ return cell;
+ }
+ }
+ if (m_right != null) {
+ GridCell cell = m_right.getSplitCell(before, maxWeight, colCount);
+ if (cell != null) {
+ return cell;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * used for splitting of items the weight is the maximum y (getMaxY()) but
+ * weighted with the column count. so an item of 4 rows and 2 columns adds a
+ * weight of 4*2
+ */
+ protected int getMaxWeight() {
+ int wDown = m_down != null ? m_down.getMaxWeight() : 0;
+ int wRight = m_right != null ? m_right.getMaxWeight() : 0;
+ return Math.max(data.h * Math.max(data.w, 1) + wDown, wRight);
+ }
+
+ protected int getMaxY() {
+ int mdown = m_down != null ? m_down.getMaxY() : 0;
+ int mright = m_right != null ? m_right.getMaxY() : 0;
+ return Math.max(data.h + mdown, mright);
+ }
+
+ protected int getMaxCols() {
+ int mdown = m_down != null ? m_down.getMaxCols() : 0;
+ int mright = m_right != null ? m_right.getMaxCols() : 0;
+ return Math.max(mdown, data.w + mright);
+ }
+
+ protected void addBottomCell(GridCell c) {// down or right
+ int mdown = m_down != null ? m_down.getMaxY() : 0;
+ int mright = m_right != null ? m_right.getMaxY() : 0;
+ if (m_down != null && data.h + mdown >= mright) {
+ m_down.addBottomCellImpl(c);
+ }
+ else if (m_right != null && mright > data.h) {
+ m_right.addBottomCellImpl(c);
+ }
+ else {
+ this.m_down = c;
+ c.m_up = this;
+ }
+ }
+
+ private void addBottomCellImpl(GridCell c) {// down only
+ if (m_down != null) {
+ m_down.addBottomCellImpl(c);
+ }
+ else {
+ this.m_down = c;
+ c.m_up = this;
+ }
+ }
+
+ protected GridCell getUp() {
+ return m_up;
+ }
+
+ protected void setDown(GridCell down) {
+ m_down = down;
+ }
+
+ protected void setRight(GridCell right) {
+ m_right = right;
+ }
+
+ protected boolean isProcessButton() {
+ if (m_field instanceof IButton) {
+ return ((IButton) m_field).isProcessButton();
+ }
+ else {
+ return false;
+ }
+ }
+
+ protected boolean isSystemProcessButton() {
+ if (isProcessButton()) {
+ return ((IButton) m_field).getSystemType() != IButton.SYSTEM_TYPE_NONE;
+ }
+ else {
+ return false;
+ }
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer buf = new StringBuffer();
+ buf.append(getClass().getSimpleName());
+ buf.append("[");
+ buf.append(data);
+ buf.append(" field=" + (m_field != null ? m_field.getFieldId() : null));
+ buf.append(" class=" + (m_field != null ? m_field.getClass() : null));
+ buf.append("]");
+ return buf.toString();
+ }
+
+}// end class
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/groupbox/internal/GroupBoxBodyGrid.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/groupbox/internal/GroupBoxBodyGrid.java
index 58aa1aa30e..df89503934 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/groupbox/internal/GroupBoxBodyGrid.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/groupbox/internal/GroupBoxBodyGrid.java
@@ -1,225 +1,225 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.groupbox.internal;
-
-import java.util.ArrayList;
-
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.form.fields.GridData;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox;
-import org.eclipse.scout.rt.client.ui.form.fields.internal.GridDataBuilder;
-
-/**
- * Grid (model) layout of items only visible items and non-process-buttons are
- * used
- */
-public class GroupBoxBodyGrid {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(GroupBoxBodyGrid.class);
-
- private final IGroupBox m_groupBox;
- private IFormField[] m_fieldsExceptProcessButtons;
- private int m_gridColumns;
- private int m_gridRows;
-
- public GroupBoxBodyGrid(IGroupBox groupBox) {
- m_groupBox = groupBox;
- }
-
- public void validate() {
- // reset old state
- m_gridRows = 0;
- // STEP 0: column count
- m_gridColumns = -1;
- IGroupBox tmp = m_groupBox;
- while (m_gridColumns < 0 && tmp != null) {
- m_gridColumns = tmp.getGridColumnCountHint();
- tmp = tmp.getParentGroupBox();
- }
- if (m_gridColumns < 0) {
- m_gridColumns = 2;
- }
- int containingGridXYCount = 0;
- int notContainingGridXYCount = 0;
- // build
- ArrayList<IFormField> fieldsExceptProcessButtons = new ArrayList<IFormField>();
- IFormField[] fields = m_groupBox.getFields();
- for (int i = 0; i < fields.length; i++) {
- IFormField f = fields[i];
- if (f.isVisible()) {
- if ((f instanceof IButton) && (((IButton) f).isProcessButton())) {
- // ignore
- }
- else {
- fieldsExceptProcessButtons.add(f);
- GridData hints = f.getGridDataHints();
- if (hints.x >= 0 && hints.y >= 0) {
- containingGridXYCount++;
- }
- else {
- notContainingGridXYCount++;
- }
- }
- }
- else {
- GridData data = GridDataBuilder.createFromHints(f, 1);
- f.setGridDataInternal(data);
- }
- }
- m_fieldsExceptProcessButtons = fieldsExceptProcessButtons.toArray(new IFormField[0]);
- boolean isContainingXAndY = (containingGridXYCount > 0 && notContainingGridXYCount == 0);
- if (isContainingXAndY) {
- layoutAllStatic();
- }
- else {
- layoutAllDynamic();
- }
- }
-
- /**
- * Make layout based on grid-x, grid-y, grid-w and grid-h No auto-layout
- */
- private void layoutAllStatic() {
- int totalGridW = 1;
- int totalGridH = 0;
- for (int i = 0; i < m_fieldsExceptProcessButtons.length; i++) {
- IFormField f = m_fieldsExceptProcessButtons[i];
- GridData hints = GridDataBuilder.createFromHints(f, 1);
- totalGridW = Math.max(totalGridW, hints.x + hints.w);
- totalGridH = Math.max(totalGridH, hints.y + hints.h);
- }
- for (int i = 0; i < m_fieldsExceptProcessButtons.length; i++) {
- IFormField f = m_fieldsExceptProcessButtons[i];
- GridData hints = GridDataBuilder.createFromHints(f, totalGridW);
- f.setGridDataInternal(hints);
- }
- m_gridColumns = totalGridW;
- m_gridRows = totalGridH;
- }
-
- /**
- * Make auto-layout based on grid-w and grid-h only. ignores grid-x and grid-y
- */
- private void layoutAllDynamic() {
- // STEP 1: component tree
- GridCell main = null;
- main = layoutControls(main);
- // STEP 2: logical layout
- if (main != null) {
- // set coordinates
- main.calculateGridLayout(0, 0);
- // store height
- m_gridRows = main.getMaxY();
- m_gridColumns = main.getMaxCols();
- }
- }
-
- private GridCell/* next main */layoutControls(GridCell main) {
- GridCell part = null;
- for (int i = 0; i < m_fieldsExceptProcessButtons.length; i++) {
- IFormField f = m_fieldsExceptProcessButtons[i];
- GridCell c = new GridCell(f, m_gridColumns);
- if (c.data.w >= m_gridColumns) {
- c.data.w = m_gridColumns;
- // layout part of 1-column items and attach to main grid
- if (part != null) {
- if (m_gridColumns > 1) {// split
- int k = m_gridColumns;
- GridCell splitRoot = part;
- while (k >= 2) {
- int maxWeight = splitRoot.getMaxWeight();
- GridCell split = splitRoot.getSplitCell(0, maxWeight, k);
- if (split != null && split != splitRoot) {
- split.getUp().setDown(null);
- int splitOffMaxCols = Math.max(1, splitRoot.getMaxCols());
- //maximum columns in part before split (normally 1)
- splitRoot.setRight(split);
- splitRoot = split;
- // reduce by maximum column count of split-off part
- k = k - splitOffMaxCols;
- }
- else {
- break;
- }
- }// end for k
- }
- if (main == null) {
- main = part;
- }
- else {
- main.addBottomCell(part);
- }
- part = null;
- }// end part!=null
- if (main == null) {
- main = c;
- }
- else {
- main.addBottomCell(c);
- }
- }// end c.w>=m_gridColumns
- else {
- if (part == null) {
- part = c;
- }
- else {
- part.addBottomCell(c);
- }
- }
- }
- // add and split rest
- if (part != null) {
- if (m_gridColumns > 1) {
- int k = m_gridColumns;
- GridCell splitRoot = part;
- while (k >= 2) {
- int maxWeight = splitRoot.getMaxWeight();
- GridCell split = splitRoot.getSplitCell(0, maxWeight, k);
- if (split != null && split != splitRoot) {
- split.getUp().setDown(null);
- int splitOffMaxCols = Math.max(1, splitRoot.getMaxCols());
- // maximum columns in part before split (normally 1)
- splitRoot.setRight(split);
- splitRoot = split;
- // reduce by maximum column count of split-off part
- k = k - splitOffMaxCols;
- }
- else {
- break;
- }
- }// end for k
- }
- if (main == null) {
- main = part;
- }
- else {
- main.addBottomCell(part);
- }
- part = null;
- }
- return main;
- }
-
- public int getGridColumnCount() {
- return m_gridColumns;
- }
-
- public int getGridRowCount() {
- return m_gridRows;
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName() + "[" + getGridRowCount() + " " + getGridColumnCount() + "]";
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.groupbox.internal;
+
+import java.util.ArrayList;
+
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.form.fields.GridData;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox;
+import org.eclipse.scout.rt.client.ui.form.fields.internal.GridDataBuilder;
+
+/**
+ * Grid (model) layout of items only visible items and non-process-buttons are
+ * used
+ */
+public class GroupBoxBodyGrid {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(GroupBoxBodyGrid.class);
+
+ private final IGroupBox m_groupBox;
+ private IFormField[] m_fieldsExceptProcessButtons;
+ private int m_gridColumns;
+ private int m_gridRows;
+
+ public GroupBoxBodyGrid(IGroupBox groupBox) {
+ m_groupBox = groupBox;
+ }
+
+ public void validate() {
+ // reset old state
+ m_gridRows = 0;
+ // STEP 0: column count
+ m_gridColumns = -1;
+ IGroupBox tmp = m_groupBox;
+ while (m_gridColumns < 0 && tmp != null) {
+ m_gridColumns = tmp.getGridColumnCountHint();
+ tmp = tmp.getParentGroupBox();
+ }
+ if (m_gridColumns < 0) {
+ m_gridColumns = 2;
+ }
+ int containingGridXYCount = 0;
+ int notContainingGridXYCount = 0;
+ // build
+ ArrayList<IFormField> fieldsExceptProcessButtons = new ArrayList<IFormField>();
+ IFormField[] fields = m_groupBox.getFields();
+ for (int i = 0; i < fields.length; i++) {
+ IFormField f = fields[i];
+ if (f.isVisible()) {
+ if ((f instanceof IButton) && (((IButton) f).isProcessButton())) {
+ // ignore
+ }
+ else {
+ fieldsExceptProcessButtons.add(f);
+ GridData hints = f.getGridDataHints();
+ if (hints.x >= 0 && hints.y >= 0) {
+ containingGridXYCount++;
+ }
+ else {
+ notContainingGridXYCount++;
+ }
+ }
+ }
+ else {
+ GridData data = GridDataBuilder.createFromHints(f, 1);
+ f.setGridDataInternal(data);
+ }
+ }
+ m_fieldsExceptProcessButtons = fieldsExceptProcessButtons.toArray(new IFormField[0]);
+ boolean isContainingXAndY = (containingGridXYCount > 0 && notContainingGridXYCount == 0);
+ if (isContainingXAndY) {
+ layoutAllStatic();
+ }
+ else {
+ layoutAllDynamic();
+ }
+ }
+
+ /**
+ * Make layout based on grid-x, grid-y, grid-w and grid-h No auto-layout
+ */
+ private void layoutAllStatic() {
+ int totalGridW = 1;
+ int totalGridH = 0;
+ for (int i = 0; i < m_fieldsExceptProcessButtons.length; i++) {
+ IFormField f = m_fieldsExceptProcessButtons[i];
+ GridData hints = GridDataBuilder.createFromHints(f, 1);
+ totalGridW = Math.max(totalGridW, hints.x + hints.w);
+ totalGridH = Math.max(totalGridH, hints.y + hints.h);
+ }
+ for (int i = 0; i < m_fieldsExceptProcessButtons.length; i++) {
+ IFormField f = m_fieldsExceptProcessButtons[i];
+ GridData hints = GridDataBuilder.createFromHints(f, totalGridW);
+ f.setGridDataInternal(hints);
+ }
+ m_gridColumns = totalGridW;
+ m_gridRows = totalGridH;
+ }
+
+ /**
+ * Make auto-layout based on grid-w and grid-h only. ignores grid-x and grid-y
+ */
+ private void layoutAllDynamic() {
+ // STEP 1: component tree
+ GridCell main = null;
+ main = layoutControls(main);
+ // STEP 2: logical layout
+ if (main != null) {
+ // set coordinates
+ main.calculateGridLayout(0, 0);
+ // store height
+ m_gridRows = main.getMaxY();
+ m_gridColumns = main.getMaxCols();
+ }
+ }
+
+ private GridCell/* next main */layoutControls(GridCell main) {
+ GridCell part = null;
+ for (int i = 0; i < m_fieldsExceptProcessButtons.length; i++) {
+ IFormField f = m_fieldsExceptProcessButtons[i];
+ GridCell c = new GridCell(f, m_gridColumns);
+ if (c.data.w >= m_gridColumns) {
+ c.data.w = m_gridColumns;
+ // layout part of 1-column items and attach to main grid
+ if (part != null) {
+ if (m_gridColumns > 1) {// split
+ int k = m_gridColumns;
+ GridCell splitRoot = part;
+ while (k >= 2) {
+ int maxWeight = splitRoot.getMaxWeight();
+ GridCell split = splitRoot.getSplitCell(0, maxWeight, k);
+ if (split != null && split != splitRoot) {
+ split.getUp().setDown(null);
+ int splitOffMaxCols = Math.max(1, splitRoot.getMaxCols());
+ //maximum columns in part before split (normally 1)
+ splitRoot.setRight(split);
+ splitRoot = split;
+ // reduce by maximum column count of split-off part
+ k = k - splitOffMaxCols;
+ }
+ else {
+ break;
+ }
+ }// end for k
+ }
+ if (main == null) {
+ main = part;
+ }
+ else {
+ main.addBottomCell(part);
+ }
+ part = null;
+ }// end part!=null
+ if (main == null) {
+ main = c;
+ }
+ else {
+ main.addBottomCell(c);
+ }
+ }// end c.w>=m_gridColumns
+ else {
+ if (part == null) {
+ part = c;
+ }
+ else {
+ part.addBottomCell(c);
+ }
+ }
+ }
+ // add and split rest
+ if (part != null) {
+ if (m_gridColumns > 1) {
+ int k = m_gridColumns;
+ GridCell splitRoot = part;
+ while (k >= 2) {
+ int maxWeight = splitRoot.getMaxWeight();
+ GridCell split = splitRoot.getSplitCell(0, maxWeight, k);
+ if (split != null && split != splitRoot) {
+ split.getUp().setDown(null);
+ int splitOffMaxCols = Math.max(1, splitRoot.getMaxCols());
+ // maximum columns in part before split (normally 1)
+ splitRoot.setRight(split);
+ splitRoot = split;
+ // reduce by maximum column count of split-off part
+ k = k - splitOffMaxCols;
+ }
+ else {
+ break;
+ }
+ }// end for k
+ }
+ if (main == null) {
+ main = part;
+ }
+ else {
+ main.addBottomCell(part);
+ }
+ part = null;
+ }
+ return main;
+ }
+
+ public int getGridColumnCount() {
+ return m_gridColumns;
+ }
+
+ public int getGridRowCount() {
+ return m_gridRows;
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + "[" + getGridRowCount() + " " + getGridColumnCount() + "]";
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/groupbox/internal/GroupBoxProcessButtonGrid.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/groupbox/internal/GroupBoxProcessButtonGrid.java
index 909d071ee4..85d13ec647 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/groupbox/internal/GroupBoxProcessButtonGrid.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/groupbox/internal/GroupBoxProcessButtonGrid.java
@@ -1,73 +1,73 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.groupbox.internal;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.form.fields.GridData;
-import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox;
-import org.eclipse.scout.rt.client.ui.form.fields.internal.GridDataBuilder;
-
-/**
- * Grid (model) layout of process buttons only visible process-buttons are used
- */
-public class GroupBoxProcessButtonGrid {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(GroupBoxProcessButtonGrid.class);
-
- private IGroupBox m_groupBox = null;
- private boolean m_includeSystemButtons;
- private boolean m_includeCustomButtons;
- private IButton[] m_buttons;
-
- public GroupBoxProcessButtonGrid(IGroupBox groupBox, boolean includeCustomButtons, boolean includeSystemButtons) {
- m_groupBox = groupBox;
- m_includeCustomButtons = includeCustomButtons;
- m_includeSystemButtons = includeSystemButtons;
- }
-
- public void validate() {
- // reset
- ArrayList<IButton> buttonList = new ArrayList<IButton>();
- if (m_includeCustomButtons) {
- buttonList.addAll(Arrays.asList(m_groupBox.getCustomProcessButtons()));
- }
- if (m_includeSystemButtons) {
- buttonList.addAll(Arrays.asList(m_groupBox.getSystemProcessButtons()));
- }
- // filter
- for (Iterator it = buttonList.iterator(); it.hasNext();) {
- IButton b = (IButton) it.next();
- if (b.isVisible()) {
- }
- else {
- GridData data = GridDataBuilder.createFromHints(b, 1);
- b.setGridDataInternal(data);
- it.remove();
- }
- }
- m_buttons = buttonList.toArray(new IButton[0]);
- layoutStatic();
- }
-
- private void layoutStatic() {
- for (int i = 0; i < m_buttons.length; i++) {
- GridData data = GridDataBuilder.createFromHints(m_buttons[i], 1);
- data.x = i;
- data.y = 0;
- m_buttons[i].setGridDataInternal(data);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.groupbox.internal;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.form.fields.GridData;
+import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox;
+import org.eclipse.scout.rt.client.ui.form.fields.internal.GridDataBuilder;
+
+/**
+ * Grid (model) layout of process buttons only visible process-buttons are used
+ */
+public class GroupBoxProcessButtonGrid {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(GroupBoxProcessButtonGrid.class);
+
+ private IGroupBox m_groupBox = null;
+ private boolean m_includeSystemButtons;
+ private boolean m_includeCustomButtons;
+ private IButton[] m_buttons;
+
+ public GroupBoxProcessButtonGrid(IGroupBox groupBox, boolean includeCustomButtons, boolean includeSystemButtons) {
+ m_groupBox = groupBox;
+ m_includeCustomButtons = includeCustomButtons;
+ m_includeSystemButtons = includeSystemButtons;
+ }
+
+ public void validate() {
+ // reset
+ ArrayList<IButton> buttonList = new ArrayList<IButton>();
+ if (m_includeCustomButtons) {
+ buttonList.addAll(Arrays.asList(m_groupBox.getCustomProcessButtons()));
+ }
+ if (m_includeSystemButtons) {
+ buttonList.addAll(Arrays.asList(m_groupBox.getSystemProcessButtons()));
+ }
+ // filter
+ for (Iterator it = buttonList.iterator(); it.hasNext();) {
+ IButton b = (IButton) it.next();
+ if (b.isVisible()) {
+ }
+ else {
+ GridData data = GridDataBuilder.createFromHints(b, 1);
+ b.setGridDataInternal(data);
+ it.remove();
+ }
+ }
+ m_buttons = buttonList.toArray(new IButton[0]);
+ layoutStatic();
+ }
+
+ private void layoutStatic() {
+ for (int i = 0; i < m_buttons.length; i++) {
+ GridData data = GridDataBuilder.createFromHints(m_buttons[i], 1);
+ data.x = i;
+ data.y = 0;
+ m_buttons[i].setGridDataInternal(data);
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/htmlfield/AbstractHtmlField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/htmlfield/AbstractHtmlField.java
index 897d7a463d..4c3e36a2fc 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/htmlfield/AbstractHtmlField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/htmlfield/AbstractHtmlField.java
@@ -1,289 +1,289 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.htmlfield;
-
-import java.io.InputStreamReader;
-import java.net.URL;
-
-import org.eclipse.scout.commons.HTMLUtility;
-import org.eclipse.scout.commons.IOUtility;
-import org.eclipse.scout.commons.annotations.ConfigOperation;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.ISearchForm;
-import org.eclipse.scout.rt.client.ui.form.fields.AbstractValueField;
-import org.eclipse.scout.rt.client.ui.form.fields.browserfield.AbstractBrowserField;
-import org.eclipse.scout.rt.client.ui.form.fields.documentfield.AbstractDocumentField;
-import org.eclipse.scout.rt.shared.data.form.ValidationRule;
-import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
-import org.eclipse.scout.rt.shared.services.common.file.RemoteFile;
-import org.eclipse.scout.service.SERVICES;
-
-/**
- * This model represents a UI specific browser, in swing it is a JEditorPane html viewer/editor, in swt it is the native
- * browser.
- * <p>
- * See also {@link AbstractBrowserField} for html viewing and {@link AbstractDocumentField} for html editing (requires a
- * fragment such as microsoft word editor)
- */
-public abstract class AbstractHtmlField extends AbstractValueField<String> implements IHtmlField {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractHtmlField.class);
-
- private IHtmlFieldUIFacade m_uiFacade;
- private boolean m_htmlEditor;
- private boolean m_scrollBarEnabled;
- private RemoteFile[] m_attachments;
- private Boolean m_monitorSpelling = null; // If null the application-wide
-
- public AbstractHtmlField() {
- this(true);
- }
-
- public AbstractHtmlField(boolean callInitializer) {
- super(callInitializer);
- }
-
- /*
- * Configuration
- */
- @ConfigProperty(ConfigProperty.INTEGER)
- @Order(230)
- @ConfigPropertyValue("Integer.MAX_VALUE")
- @ValidationRule(ValidationRule.MAX_LENGTH)
- protected int getConfiguredMaxLength() {
- return Integer.MAX_VALUE;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(240)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredHtmlEditor() {
- return false;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(250)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredScrollBarEnabled() {
- return false;
- }
-
- /**
- * @param url
- * @param path
- * {@link URL#getPath()}
- * @param local
- * true if the url is not a valid external url but a local model url
- * (http://local/...)
- */
- @ConfigOperation
- @Order(230)
- protected void execHyperlinkAction(URL url, String path, boolean local) throws ProcessingException {
- LOG.info("execHyperlinkAction " + url + " (in " + getClass().getName() + ")");
- }
-
- @Override
- protected void initConfig() {
- m_uiFacade = new P_UIFacade();
- setAttachments(new RemoteFile[0]);
- super.initConfig();
- m_htmlEditor = getConfiguredHtmlEditor();
- m_scrollBarEnabled = getConfiguredScrollBarEnabled();
- setMaxLength(getConfiguredMaxLength());
- }
-
- @Override
- public int getMaxLength() {
- int len = propertySupport.getPropertyInt(PROP_MAX_LENGTH);
- if (len <= 0) {
- len = 200;
- }
- return len;
- }
-
- @Override
- public void setMaxLength(int len) {
- if (len > 0) {
- propertySupport.setPropertyInt(PROP_MAX_LENGTH, len);
- }
- if (isInitialized()) {
- setValue(getValue());
- }
- }
-
- @Override
- public void doHyperlinkAction(URL url) throws ProcessingException {
- execHyperlinkAction(url, url.getPath(), url != null && url.getHost().equals("local"));
- }
-
- public void setValueFromURL(URL url, String encoding) throws ProcessingException {
- if (url != null) {
- try {
- setValue(IOUtility.getContent(new InputStreamReader(url.openStream(), encoding)));
- }
- catch (ProcessingException e) {
- throw e;
- }
- catch (Throwable t) {
- throw new ProcessingException("URL " + url, t);
- }
- }
- else {
- setValue(null);
- }
- }
-
- @Override
- public String getPlainText() {
- String s = getValue();
- if (s != null) {
- return HTMLUtility.getPlainText(HTMLUtility.toHtmlDocument(s));
- }
- return "";
- }
-
- @Override
- public boolean isHtmlEditor() {
- return m_htmlEditor;
- }
-
- @Override
- protected String validateValueInternal(String rawValue) throws ProcessingException {
- String validValue = null;
- rawValue = super.validateValueInternal(rawValue);
- validValue = rawValue;
- if (validValue != null && validValue.length() == 0) {
- validValue = null;
- }
- if (validValue != null) {
- if (validValue.length() > getMaxLength()) {
- validValue = validValue.substring(0, getMaxLength());
- }
- }
- return validValue;
- }
-
- @Override
- public IHtmlFieldUIFacade getUIFacade() {
- return m_uiFacade;
- }
-
- // convert string to a real string
- @Override
- protected String parseValueInternal(String text) throws ProcessingException {
- if (text != null && text.length() == 0) {
- text = null;
- }
- return text;
- }
-
- @Override
- public void insertImage(String imageUrl) {
- if (imageUrl != null) {
- propertySupport.firePropertyChange(PROP_INSERT_IMAGE, null, imageUrl);
- }
- }
-
- /**
- * local images and local resources bound to the html text
- */
- @Override
- public RemoteFile[] getAttachments() {
- return m_attachments;
- }
-
- @Override
- public void setAttachments(RemoteFile[] attachments) {
- m_attachments = attachments;
- }
-
- @Override
- public boolean isScrollBarEnabled() {
- return m_scrollBarEnabled;
- }
-
- private class P_UIFacade implements IHtmlFieldUIFacade {
-
- @Override
- public boolean setTextFromUI(String htmlText) {
- if (isHtmlEditor()) {
- if (htmlText != null && htmlText.length() == 0) {
- htmlText = null;
- }
- // parse always, validity might change even if text is same
- return parseValue(htmlText);
- }
- return true;
- }
-
- @Override
- public void setAttachmentsFromUI(RemoteFile[] attachments) {
- setAttachments(attachments);
- }
-
- @Override
- public void fireHyperlinkActionFromUI(URL url) {
- try {
- doHyperlinkAction(url);
- }
- catch (ProcessingException e) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- }
- }
-
- @Override
- public void setScrollToAnchor(String anchorName) {
- propertySupport.setPropertyString(PROP_SCROLLBAR_SCROLL_TO_ANCHOR, anchorName);
- }
-
- @Override
- public String getScrollToAnchor() {
- return propertySupport.getPropertyString(PROP_SCROLLBAR_SCROLL_TO_ANCHOR);
- }
-
- @Override
- public void scrollToEnd() {
- propertySupport.setPropertyAlwaysFire(PROP_SCROLLBAR_SCROLL_TO_END, null);
- }
-
- /**
- * Returns whether this html component is spell checkable.
- */
- @Override
- public boolean isSpellCheckEnabled() {
- return (this.isEnabled() && this.isEnabledGranted() && (!(this.getForm() instanceof ISearchForm)));
- }
-
- /**
- * Returns whether this html component should be monitored for spelling errors
- * in the background ("check as you type").<br>
- * If it is not defined, null is returned, then the application default is
- * used.
- */
- @Override
- public Boolean isSpellCheckAsYouTypeEnabled() {
- return m_monitorSpelling;
- }
-
- /**
- * Sets whether to monitor this html component for spelling errors in the
- * background ("check as you type").<br>
- * Use null for application default.
- */
- public void setSpellCheckAsYouTypeEnabled(boolean monitorSpelling) {
- m_monitorSpelling = new Boolean(monitorSpelling);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.htmlfield;
+
+import java.io.InputStreamReader;
+import java.net.URL;
+
+import org.eclipse.scout.commons.HTMLUtility;
+import org.eclipse.scout.commons.IOUtility;
+import org.eclipse.scout.commons.annotations.ConfigOperation;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.ISearchForm;
+import org.eclipse.scout.rt.client.ui.form.fields.AbstractValueField;
+import org.eclipse.scout.rt.client.ui.form.fields.browserfield.AbstractBrowserField;
+import org.eclipse.scout.rt.client.ui.form.fields.documentfield.AbstractDocumentField;
+import org.eclipse.scout.rt.shared.data.form.ValidationRule;
+import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
+import org.eclipse.scout.rt.shared.services.common.file.RemoteFile;
+import org.eclipse.scout.service.SERVICES;
+
+/**
+ * This model represents a UI specific browser, in swing it is a JEditorPane html viewer/editor, in swt it is the native
+ * browser.
+ * <p>
+ * See also {@link AbstractBrowserField} for html viewing and {@link AbstractDocumentField} for html editing (requires a
+ * fragment such as microsoft word editor)
+ */
+public abstract class AbstractHtmlField extends AbstractValueField<String> implements IHtmlField {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractHtmlField.class);
+
+ private IHtmlFieldUIFacade m_uiFacade;
+ private boolean m_htmlEditor;
+ private boolean m_scrollBarEnabled;
+ private RemoteFile[] m_attachments;
+ private Boolean m_monitorSpelling = null; // If null the application-wide
+
+ public AbstractHtmlField() {
+ this(true);
+ }
+
+ public AbstractHtmlField(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ /*
+ * Configuration
+ */
+ @ConfigProperty(ConfigProperty.INTEGER)
+ @Order(230)
+ @ConfigPropertyValue("Integer.MAX_VALUE")
+ @ValidationRule(ValidationRule.MAX_LENGTH)
+ protected int getConfiguredMaxLength() {
+ return Integer.MAX_VALUE;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(240)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredHtmlEditor() {
+ return false;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(250)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredScrollBarEnabled() {
+ return false;
+ }
+
+ /**
+ * @param url
+ * @param path
+ * {@link URL#getPath()}
+ * @param local
+ * true if the url is not a valid external url but a local model url
+ * (http://local/...)
+ */
+ @ConfigOperation
+ @Order(230)
+ protected void execHyperlinkAction(URL url, String path, boolean local) throws ProcessingException {
+ LOG.info("execHyperlinkAction " + url + " (in " + getClass().getName() + ")");
+ }
+
+ @Override
+ protected void initConfig() {
+ m_uiFacade = new P_UIFacade();
+ setAttachments(new RemoteFile[0]);
+ super.initConfig();
+ m_htmlEditor = getConfiguredHtmlEditor();
+ m_scrollBarEnabled = getConfiguredScrollBarEnabled();
+ setMaxLength(getConfiguredMaxLength());
+ }
+
+ @Override
+ public int getMaxLength() {
+ int len = propertySupport.getPropertyInt(PROP_MAX_LENGTH);
+ if (len <= 0) {
+ len = 200;
+ }
+ return len;
+ }
+
+ @Override
+ public void setMaxLength(int len) {
+ if (len > 0) {
+ propertySupport.setPropertyInt(PROP_MAX_LENGTH, len);
+ }
+ if (isInitialized()) {
+ setValue(getValue());
+ }
+ }
+
+ @Override
+ public void doHyperlinkAction(URL url) throws ProcessingException {
+ execHyperlinkAction(url, url.getPath(), url != null && url.getHost().equals("local"));
+ }
+
+ public void setValueFromURL(URL url, String encoding) throws ProcessingException {
+ if (url != null) {
+ try {
+ setValue(IOUtility.getContent(new InputStreamReader(url.openStream(), encoding)));
+ }
+ catch (ProcessingException e) {
+ throw e;
+ }
+ catch (Throwable t) {
+ throw new ProcessingException("URL " + url, t);
+ }
+ }
+ else {
+ setValue(null);
+ }
+ }
+
+ @Override
+ public String getPlainText() {
+ String s = getValue();
+ if (s != null) {
+ return HTMLUtility.getPlainText(HTMLUtility.toHtmlDocument(s));
+ }
+ return "";
+ }
+
+ @Override
+ public boolean isHtmlEditor() {
+ return m_htmlEditor;
+ }
+
+ @Override
+ protected String validateValueInternal(String rawValue) throws ProcessingException {
+ String validValue = null;
+ rawValue = super.validateValueInternal(rawValue);
+ validValue = rawValue;
+ if (validValue != null && validValue.length() == 0) {
+ validValue = null;
+ }
+ if (validValue != null) {
+ if (validValue.length() > getMaxLength()) {
+ validValue = validValue.substring(0, getMaxLength());
+ }
+ }
+ return validValue;
+ }
+
+ @Override
+ public IHtmlFieldUIFacade getUIFacade() {
+ return m_uiFacade;
+ }
+
+ // convert string to a real string
+ @Override
+ protected String parseValueInternal(String text) throws ProcessingException {
+ if (text != null && text.length() == 0) {
+ text = null;
+ }
+ return text;
+ }
+
+ @Override
+ public void insertImage(String imageUrl) {
+ if (imageUrl != null) {
+ propertySupport.firePropertyChange(PROP_INSERT_IMAGE, null, imageUrl);
+ }
+ }
+
+ /**
+ * local images and local resources bound to the html text
+ */
+ @Override
+ public RemoteFile[] getAttachments() {
+ return m_attachments;
+ }
+
+ @Override
+ public void setAttachments(RemoteFile[] attachments) {
+ m_attachments = attachments;
+ }
+
+ @Override
+ public boolean isScrollBarEnabled() {
+ return m_scrollBarEnabled;
+ }
+
+ private class P_UIFacade implements IHtmlFieldUIFacade {
+
+ @Override
+ public boolean setTextFromUI(String htmlText) {
+ if (isHtmlEditor()) {
+ if (htmlText != null && htmlText.length() == 0) {
+ htmlText = null;
+ }
+ // parse always, validity might change even if text is same
+ return parseValue(htmlText);
+ }
+ return true;
+ }
+
+ @Override
+ public void setAttachmentsFromUI(RemoteFile[] attachments) {
+ setAttachments(attachments);
+ }
+
+ @Override
+ public void fireHyperlinkActionFromUI(URL url) {
+ try {
+ doHyperlinkAction(url);
+ }
+ catch (ProcessingException e) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ }
+ }
+
+ @Override
+ public void setScrollToAnchor(String anchorName) {
+ propertySupport.setPropertyString(PROP_SCROLLBAR_SCROLL_TO_ANCHOR, anchorName);
+ }
+
+ @Override
+ public String getScrollToAnchor() {
+ return propertySupport.getPropertyString(PROP_SCROLLBAR_SCROLL_TO_ANCHOR);
+ }
+
+ @Override
+ public void scrollToEnd() {
+ propertySupport.setPropertyAlwaysFire(PROP_SCROLLBAR_SCROLL_TO_END, null);
+ }
+
+ /**
+ * Returns whether this html component is spell checkable.
+ */
+ @Override
+ public boolean isSpellCheckEnabled() {
+ return (this.isEnabled() && this.isEnabledGranted() && (!(this.getForm() instanceof ISearchForm)));
+ }
+
+ /**
+ * Returns whether this html component should be monitored for spelling errors
+ * in the background ("check as you type").<br>
+ * If it is not defined, null is returned, then the application default is
+ * used.
+ */
+ @Override
+ public Boolean isSpellCheckAsYouTypeEnabled() {
+ return m_monitorSpelling;
+ }
+
+ /**
+ * Sets whether to monitor this html component for spelling errors in the
+ * background ("check as you type").<br>
+ * Use null for application default.
+ */
+ public void setSpellCheckAsYouTypeEnabled(boolean monitorSpelling) {
+ m_monitorSpelling = new Boolean(monitorSpelling);
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/htmlfield/IHtmlField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/htmlfield/IHtmlField.java
index 09e3042572..6811ed521b 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/htmlfield/IHtmlField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/htmlfield/IHtmlField.java
@@ -1,85 +1,85 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.htmlfield;
-
-import java.net.URL;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
-import org.eclipse.scout.rt.client.ui.form.fields.browserfield.IBrowserField;
-import org.eclipse.scout.rt.client.ui.form.fields.documentfield.IDocumentField;
-import org.eclipse.scout.rt.shared.services.common.file.RemoteFile;
-
-/**
- * This model represents a UI specific browser, in swing it is a JEditorPane html viewer/editor, in swt it is the native
- * browser.
- * <p>
- * You can use local urls that call back to the field itself and can be handled by overriding
- * {@link AbstractHtmlField#execHyperlinkAction(URL, String, boolean)} A local URL is one of the form http://local/...
- * <p>
- * See also the {@link IBrowserField} for html viewing and {@link IDocumentField} for html editing (requires a fragment
- * such as microsoft word editor)
- */
-public interface IHtmlField extends IValueField<String> {
-
- String PROP_MAX_LENGTH = "maxLength";
- String PROP_SCROLLBARS_ENABLED = "scrollBarsEnabled";
- String PROP_INSERT_IMAGE = "insertImage";
- String PROP_SCROLLBAR_SCROLL_TO_END = "scrollToEnd";
- String PROP_SCROLLBAR_SCROLL_TO_ANCHOR = "scrollToPosition";
-
- void setMaxLength(int len);
-
- void setScrollToAnchor(String anchorName);
-
- String getScrollToAnchor();
-
- int getMaxLength();
-
- boolean isHtmlEditor();
-
- boolean isScrollBarEnabled();
-
- void scrollToEnd();
-
- /*
- * Runtime
- */
-
- IHtmlFieldUIFacade getUIFacade();
-
- void doHyperlinkAction(URL url) throws ProcessingException;
-
- /**
- * local images and local resources bound to the html text
- */
- RemoteFile[] getAttachments();
-
- void setAttachments(RemoteFile[] attachments);
-
- String getPlainText();
-
- /** Insert a new image at the caret position. */
- void insertImage(String imageUrl);
-
- /**
- * Returns whether this field is spell checkable.
- */
- boolean isSpellCheckEnabled();
-
- /**
- * Returns whether this field should be monitored for spelling errors in the
- * background ("check as you type"). If it is not defined, null is returned,
- * then the application default is used.
- */
- Boolean isSpellCheckAsYouTypeEnabled();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.htmlfield;
+
+import java.net.URL;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
+import org.eclipse.scout.rt.client.ui.form.fields.browserfield.IBrowserField;
+import org.eclipse.scout.rt.client.ui.form.fields.documentfield.IDocumentField;
+import org.eclipse.scout.rt.shared.services.common.file.RemoteFile;
+
+/**
+ * This model represents a UI specific browser, in swing it is a JEditorPane html viewer/editor, in swt it is the native
+ * browser.
+ * <p>
+ * You can use local urls that call back to the field itself and can be handled by overriding
+ * {@link AbstractHtmlField#execHyperlinkAction(URL, String, boolean)} A local URL is one of the form http://local/...
+ * <p>
+ * See also the {@link IBrowserField} for html viewing and {@link IDocumentField} for html editing (requires a fragment
+ * such as microsoft word editor)
+ */
+public interface IHtmlField extends IValueField<String> {
+
+ String PROP_MAX_LENGTH = "maxLength";
+ String PROP_SCROLLBARS_ENABLED = "scrollBarsEnabled";
+ String PROP_INSERT_IMAGE = "insertImage";
+ String PROP_SCROLLBAR_SCROLL_TO_END = "scrollToEnd";
+ String PROP_SCROLLBAR_SCROLL_TO_ANCHOR = "scrollToPosition";
+
+ void setMaxLength(int len);
+
+ void setScrollToAnchor(String anchorName);
+
+ String getScrollToAnchor();
+
+ int getMaxLength();
+
+ boolean isHtmlEditor();
+
+ boolean isScrollBarEnabled();
+
+ void scrollToEnd();
+
+ /*
+ * Runtime
+ */
+
+ IHtmlFieldUIFacade getUIFacade();
+
+ void doHyperlinkAction(URL url) throws ProcessingException;
+
+ /**
+ * local images and local resources bound to the html text
+ */
+ RemoteFile[] getAttachments();
+
+ void setAttachments(RemoteFile[] attachments);
+
+ String getPlainText();
+
+ /** Insert a new image at the caret position. */
+ void insertImage(String imageUrl);
+
+ /**
+ * Returns whether this field is spell checkable.
+ */
+ boolean isSpellCheckEnabled();
+
+ /**
+ * Returns whether this field should be monitored for spelling errors in the
+ * background ("check as you type"). If it is not defined, null is returned,
+ * then the application default is used.
+ */
+ Boolean isSpellCheckAsYouTypeEnabled();
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/htmlfield/IHtmlFieldUIFacade.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/htmlfield/IHtmlFieldUIFacade.java
index 12edbb32a1..fef9bd1aef 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/htmlfield/IHtmlFieldUIFacade.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/htmlfield/IHtmlFieldUIFacade.java
@@ -1,25 +1,25 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.htmlfield;
-
-import java.net.URL;
-
-import org.eclipse.scout.rt.shared.services.common.file.RemoteFile;
-
-public interface IHtmlFieldUIFacade {
-
- boolean setTextFromUI(String htmlText);
-
- void setAttachmentsFromUI(RemoteFile[] attachments);
-
- void fireHyperlinkActionFromUI(URL url);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.htmlfield;
+
+import java.net.URL;
+
+import org.eclipse.scout.rt.shared.services.common.file.RemoteFile;
+
+public interface IHtmlFieldUIFacade {
+
+ boolean setTextFromUI(String htmlText);
+
+ void setAttachmentsFromUI(RemoteFile[] attachments);
+
+ void fireHyperlinkActionFromUI(URL url);
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/imagebox/AbstractImageField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/imagebox/AbstractImageField.java
index b8d6f1c8c4..7d0cfa70c3 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/imagebox/AbstractImageField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/imagebox/AbstractImageField.java
@@ -1,484 +1,484 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.imagebox;
-
-import java.util.ArrayList;
-import java.util.EventListener;
-import java.util.List;
-
-import org.eclipse.scout.commons.ConfigurationUtility;
-import org.eclipse.scout.commons.EventListenerList;
-import org.eclipse.scout.commons.annotations.ConfigOperation;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.dnd.TransferObject;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.form.fields.AbstractFormField;
-import org.eclipse.scout.rt.shared.data.basic.AffineTransformSpec;
-import org.eclipse.scout.rt.shared.data.basic.BoundsSpec;
-
-public abstract class AbstractImageField extends AbstractFormField implements IImageField {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractImageField.class);
-
- private IImageFieldUIFacade m_uiFacade;
- private final EventListenerList m_listenerList = new EventListenerList();
- private IMenu[] m_menus;
- private double m_zoomDelta;
- private double m_panDelta;
- private double m_rotateDelta;
-
- public AbstractImageField() {
- this(true);
- }
-
- public AbstractImageField(boolean callInitializer) {
- super(callInitializer);
- }
-
- @ConfigPropertyValue("0")
- @Override
- protected int getConfiguredVerticalAlignment() {
- return 0;
- }
-
- @ConfigPropertyValue("0")
- @Override
- protected int getConfiguredHorizontalAlignment() {
- return 0;
- }
-
- @ConfigProperty(ConfigProperty.ICON_ID)
- @Order(300)
- @ConfigPropertyValue("null")
- protected String getConfiguredImageId() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(310)
- @ConfigPropertyValue("true")
- protected boolean getConfiguredFocusVisible() {
- return true;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(320)
- @ConfigPropertyValue("null")
- protected boolean getConfiguredAutoFit() {
- return false;
- }
-
- @ConfigProperty(ConfigProperty.DOUBLE)
- @Order(330)
- @ConfigPropertyValue("1.25")
- protected double getConfiguredZoomDelta() {
- return 1.25;
- }
-
- @ConfigProperty(ConfigProperty.DOUBLE)
- @Order(340)
- @ConfigPropertyValue("10")
- protected double getConfiguredPanDelta() {
- return 10;
- }
-
- /**
- * in degrees 0..360
- */
- @ConfigProperty(ConfigProperty.DOUBLE)
- @Order(350)
- @ConfigPropertyValue("10")
- protected double getConfiguredRotateDelta() {
- return 10;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(360)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredScrollBarEnabled() {
- return false;
- }
-
- @ConfigProperty(ConfigProperty.DRAG_AND_DROP_TYPE)
- @Order(400)
- @ConfigPropertyValue("0")
- protected int getConfiguredDropType() {
- return 0;
- }
-
- @ConfigProperty(ConfigProperty.DRAG_AND_DROP_TYPE)
- @Order(410)
- @ConfigPropertyValue("0")
- protected int getConfiguredDragType() {
- return 0;
- }
-
- @ConfigOperation
- @Order(500)
- protected TransferObject execDragRequest() throws ProcessingException {
- return null;
- }
-
- @ConfigOperation
- @Order(510)
- protected void execDropRequest(TransferObject transferObject) throws ProcessingException {
- }
-
- private Class<? extends IMenu>[] getConfiguredMenus() {
- Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
- return ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, IMenu.class);
- }
-
- @Override
- protected void initConfig() {
- m_uiFacade = new P_UIFacade();
- super.initConfig();
- setImageTransform(new AffineTransformSpec());
- setAutoFit(getConfiguredAutoFit());
- setFocusVisible(getConfiguredFocusVisible());
- setImageId(getConfiguredImageId());
- setPanDelta(getConfiguredPanDelta());
- setRotateDelta(getConfiguredRotateDelta());
- setZoomDelta(getConfiguredZoomDelta());
- setDragType(getConfiguredDragType());
- setDropType(getConfiguredDropType());
- setScrollBarEnabled(getConfiguredScrollBarEnabled());
- // menus
- ArrayList<IMenu> menuList = new ArrayList<IMenu>();
- Class<? extends IMenu>[] a = getConfiguredMenus();
- for (int i = 0; i < a.length; i++) {
- try {
- IMenu menu = ConfigurationUtility.newInnerInstance(this, a[i]);
- menuList.add(menu);
- }
- catch (Exception e) {
- LOG.warn(null, e);
- }
- }
- try {
- injectMenusInternal(menuList);
- }
- catch (Exception e) {
- LOG.error("error occured while dynamically contributing menus.", e);
- }
- m_menus = menuList.toArray(new IMenu[0]);
- }
-
- /**
- * Override this internal method only in order to make use of dynamic menus<br>
- * Used to manage menu list and add/remove menus
- *
- * @param menuList
- * live and mutable list of configured menus
- */
- protected void injectMenusInternal(List<IMenu> menuList) {
- }
-
- /*
- * Runtime
- */
-
- /**
- * model observer
- */
-
- @Override
- public void addImageFieldListener(ImageFieldListener listener) {
- m_listenerList.add(ImageFieldListener.class, listener);
- }
-
- @Override
- public void removeImageFieldListener(ImageFieldListener listener) {
- m_listenerList.remove(ImageFieldListener.class, listener);
- }
-
- private void fireZoomRectangle(BoundsSpec r) {
- fireImageBoxEventInternal(new ImageFieldEvent(this, ImageFieldEvent.TYPE_ZOOM_RECTANGLE, r));
- }
-
- private void fireAutoFit() {
- fireImageBoxEventInternal(new ImageFieldEvent(this, ImageFieldEvent.TYPE_AUTO_FIT));
- }
-
- private IMenu[] firePopup() {
- ImageFieldEvent e = new ImageFieldEvent(this, ImageFieldEvent.TYPE_POPUP);
- // single observer for table-owned menus
- IMenu[] a = getMenus();
- for (int i = 0; i < a.length; i++) {
- IMenu m = a[i];
- m.prepareAction();
- if (m.isVisible()) {
- e.addPopupMenu(m);
- }
- }
- fireImageBoxEventInternal(e);
- return e.getPopupMenus();
- }
-
- private void fireImageBoxEventInternal(ImageFieldEvent e) {
- EventListener[] a = m_listenerList.getListeners(ImageFieldListener.class);
- if (a != null) {
- for (int i = 0; i < a.length; i++) {
- ((ImageFieldListener) a[i]).imageFieldChanged(e);
- }
- }
- }
-
- @Override
- public Object getImage() {
- return propertySupport.getProperty(PROP_IMAGE);
- }
-
- @Override
- public void setImage(Object imgObj) {
- propertySupport.setProperty(PROP_IMAGE, imgObj);
- }
-
- @Override
- public String getImageId() {
- return propertySupport.getPropertyString(PROP_IMAGE_ID);
- }
-
- @Override
- public void setImageId(String imageId) {
- propertySupport.setPropertyString(PROP_IMAGE_ID, imageId);
- }
-
- @Override
- public IMenu[] getMenus() {
- return m_menus;
- }
-
- @Override
- public double getZoomDeltaValue() {
- return m_zoomDelta;
- }
-
- @Override
- public void setZoomDelta(double d) {
- m_zoomDelta = d;
- }
-
- @Override
- public double getPanDelta() {
- return m_panDelta;
- }
-
- @Override
- public void setPanDelta(double d) {
- m_panDelta = d;
- }
-
- @Override
- public double getRotateDelta() {
- return m_rotateDelta;
- }
-
- @Override
- public void setRotateDelta(double deg) {
- m_rotateDelta = deg;
- }
-
- @Override
- public void setRotateDeltaInRadians(double rad) {
- setRotateDelta(Math.toDegrees(rad));
- }
-
- @Override
- public AffineTransformSpec getImageTransform() {
- return new AffineTransformSpec((AffineTransformSpec) propertySupport.getProperty(PROP_IMAGE_TRANSFORM));
- }
-
- @Override
- public void setImageTransform(AffineTransformSpec t) {
- propertySupport.setProperty(PROP_IMAGE_TRANSFORM, new AffineTransformSpec(t));
- }
-
- @Override
- public boolean isFocusVisible() {
- return propertySupport.getPropertyBool(PROP_FOCUS_VISIBLE);
- }
-
- @Override
- public void setFocusVisible(boolean b) {
- propertySupport.setPropertyBool(PROP_FOCUS_VISIBLE, b);
- }
-
- @Override
- public BoundsSpec getAnalysisRectangle() {
- return (BoundsSpec) propertySupport.getProperty(PROP_ANALYSIS_RECTANGLE);
- }
-
- @Override
- public void setAnalysisRectangle(BoundsSpec rect) {
- propertySupport.setProperty(PROP_ANALYSIS_RECTANGLE, rect);
- }
-
- @Override
- public void setAnalysisRectangle(int x, int y, int w, int h) {
- setAnalysisRectangle(new BoundsSpec(x, y, w, h));
- }
-
- @Override
- public boolean isAutoFit() {
- return propertySupport.getPropertyBool(PROP_AUTO_FIT);
- }
-
- @Override
- public void setAutoFit(boolean b) {
- propertySupport.setPropertyBool(PROP_AUTO_FIT, b);
- }
-
- @Override
- public boolean isScrollBarEnabled() {
- return propertySupport.getPropertyBool(PROP_SCROLL_BAR_ENABLED);
- }
-
- @Override
- public void setScrollBarEnabled(boolean b) {
- propertySupport.setPropertyBool(PROP_SCROLL_BAR_ENABLED, b);
- }
-
- @Override
- public void setDragType(int dragType) {
- propertySupport.setPropertyInt(PROP_DRAG_TYPE, dragType);
- }
-
- @Override
- public int getDragType() {
- return propertySupport.getPropertyInt(PROP_DRAG_TYPE);
- }
-
- @Override
- public void setDropType(int dropType) {
- propertySupport.setPropertyInt(PROP_DROP_TYPE, dropType);
- }
-
- @Override
- public int getDropType() {
- return propertySupport.getPropertyInt(PROP_DROP_TYPE);
- }
-
- @Override
- public byte[] getByteArrayValue() {
- Object value = getImage();
- byte[] b = null;
- if (value instanceof byte[]) {
- b = (byte[]) value;
- }
- return b;
- }
-
- @Override
- public void doAutoFit() {
- fireAutoFit();
- }
-
- @Override
- public void doZoomRectangle(int x, int y, int w, int h) {
- fireZoomRectangle(new BoundsSpec(x, y, w, h));
- }
-
- @Override
- public void doPan(double dx, double dy) {
- AffineTransformSpec t = getImageTransform();
- t.dx = dx;
- t.dy = dy;
- setImageTransform(t);
- }
-
- @Override
- public void doRelativePan(double dx, double dy) {
- AffineTransformSpec t = getImageTransform();
- t.dx = t.dx + dx;
- t.dy = t.dy + dy;
- setImageTransform(t);
- }
-
- @Override
- public void doZoom(double fx, double fy) {
- AffineTransformSpec t = getImageTransform();
- t.sx = fx;
- t.sy = fy;
- setImageTransform(t);
- }
-
- @Override
- public void doRelativeZoom(double fx, double fy) {
- AffineTransformSpec t = getImageTransform();
- t.sx = t.sx * fx;
- t.sy = t.sy * fy;
- setImageTransform(t);
- }
-
- @Override
- public void doRotate(double angle) {
- AffineTransformSpec t = getImageTransform();
- t.angle = angle;
- setImageTransform(t);
- }
-
- @Override
- public void doRelativeRotate(double angleInDegrees) {
- AffineTransformSpec t = getImageTransform();
- t.angle = t.angle + Math.toRadians(angleInDegrees);
- setImageTransform(t);
- }
-
- /*
- * UI accessible
- */
- @Override
- public IImageFieldUIFacade getUIFacade() {
- return m_uiFacade;
- }
-
- private class P_UIFacade implements IImageFieldUIFacade {
-
- @Override
- public void setImageTransformFromUI(AffineTransformSpec t) {
- setImageTransform(t);
- }
-
- @Override
- public IMenu[] firePopupFromUI() {
- return firePopup();
- }
-
- @Override
- public TransferObject fireDragRequestFromUI() {
- TransferObject t = null;
- try {
- t = execDragRequest();
- }
- catch (ProcessingException e) {
- LOG.warn(null, e);
- }
- return t;
- }
-
- @Override
- public void fireDropActionFromUi(TransferObject scoutTransferable) {
- try {
- execDropRequest(scoutTransferable);
- }
- catch (ProcessingException e) {
- LOG.warn(null, e);
- }
- }
-
- }// end private class
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.imagebox;
+
+import java.util.ArrayList;
+import java.util.EventListener;
+import java.util.List;
+
+import org.eclipse.scout.commons.ConfigurationUtility;
+import org.eclipse.scout.commons.EventListenerList;
+import org.eclipse.scout.commons.annotations.ConfigOperation;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.dnd.TransferObject;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.form.fields.AbstractFormField;
+import org.eclipse.scout.rt.shared.data.basic.AffineTransformSpec;
+import org.eclipse.scout.rt.shared.data.basic.BoundsSpec;
+
+public abstract class AbstractImageField extends AbstractFormField implements IImageField {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractImageField.class);
+
+ private IImageFieldUIFacade m_uiFacade;
+ private final EventListenerList m_listenerList = new EventListenerList();
+ private IMenu[] m_menus;
+ private double m_zoomDelta;
+ private double m_panDelta;
+ private double m_rotateDelta;
+
+ public AbstractImageField() {
+ this(true);
+ }
+
+ public AbstractImageField(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ @ConfigPropertyValue("0")
+ @Override
+ protected int getConfiguredVerticalAlignment() {
+ return 0;
+ }
+
+ @ConfigPropertyValue("0")
+ @Override
+ protected int getConfiguredHorizontalAlignment() {
+ return 0;
+ }
+
+ @ConfigProperty(ConfigProperty.ICON_ID)
+ @Order(300)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredImageId() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(310)
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredFocusVisible() {
+ return true;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(320)
+ @ConfigPropertyValue("null")
+ protected boolean getConfiguredAutoFit() {
+ return false;
+ }
+
+ @ConfigProperty(ConfigProperty.DOUBLE)
+ @Order(330)
+ @ConfigPropertyValue("1.25")
+ protected double getConfiguredZoomDelta() {
+ return 1.25;
+ }
+
+ @ConfigProperty(ConfigProperty.DOUBLE)
+ @Order(340)
+ @ConfigPropertyValue("10")
+ protected double getConfiguredPanDelta() {
+ return 10;
+ }
+
+ /**
+ * in degrees 0..360
+ */
+ @ConfigProperty(ConfigProperty.DOUBLE)
+ @Order(350)
+ @ConfigPropertyValue("10")
+ protected double getConfiguredRotateDelta() {
+ return 10;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(360)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredScrollBarEnabled() {
+ return false;
+ }
+
+ @ConfigProperty(ConfigProperty.DRAG_AND_DROP_TYPE)
+ @Order(400)
+ @ConfigPropertyValue("0")
+ protected int getConfiguredDropType() {
+ return 0;
+ }
+
+ @ConfigProperty(ConfigProperty.DRAG_AND_DROP_TYPE)
+ @Order(410)
+ @ConfigPropertyValue("0")
+ protected int getConfiguredDragType() {
+ return 0;
+ }
+
+ @ConfigOperation
+ @Order(500)
+ protected TransferObject execDragRequest() throws ProcessingException {
+ return null;
+ }
+
+ @ConfigOperation
+ @Order(510)
+ protected void execDropRequest(TransferObject transferObject) throws ProcessingException {
+ }
+
+ private Class<? extends IMenu>[] getConfiguredMenus() {
+ Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
+ return ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, IMenu.class);
+ }
+
+ @Override
+ protected void initConfig() {
+ m_uiFacade = new P_UIFacade();
+ super.initConfig();
+ setImageTransform(new AffineTransformSpec());
+ setAutoFit(getConfiguredAutoFit());
+ setFocusVisible(getConfiguredFocusVisible());
+ setImageId(getConfiguredImageId());
+ setPanDelta(getConfiguredPanDelta());
+ setRotateDelta(getConfiguredRotateDelta());
+ setZoomDelta(getConfiguredZoomDelta());
+ setDragType(getConfiguredDragType());
+ setDropType(getConfiguredDropType());
+ setScrollBarEnabled(getConfiguredScrollBarEnabled());
+ // menus
+ ArrayList<IMenu> menuList = new ArrayList<IMenu>();
+ Class<? extends IMenu>[] a = getConfiguredMenus();
+ for (int i = 0; i < a.length; i++) {
+ try {
+ IMenu menu = ConfigurationUtility.newInnerInstance(this, a[i]);
+ menuList.add(menu);
+ }
+ catch (Exception e) {
+ LOG.warn(null, e);
+ }
+ }
+ try {
+ injectMenusInternal(menuList);
+ }
+ catch (Exception e) {
+ LOG.error("error occured while dynamically contributing menus.", e);
+ }
+ m_menus = menuList.toArray(new IMenu[0]);
+ }
+
+ /**
+ * Override this internal method only in order to make use of dynamic menus<br>
+ * Used to manage menu list and add/remove menus
+ *
+ * @param menuList
+ * live and mutable list of configured menus
+ */
+ protected void injectMenusInternal(List<IMenu> menuList) {
+ }
+
+ /*
+ * Runtime
+ */
+
+ /**
+ * model observer
+ */
+
+ @Override
+ public void addImageFieldListener(ImageFieldListener listener) {
+ m_listenerList.add(ImageFieldListener.class, listener);
+ }
+
+ @Override
+ public void removeImageFieldListener(ImageFieldListener listener) {
+ m_listenerList.remove(ImageFieldListener.class, listener);
+ }
+
+ private void fireZoomRectangle(BoundsSpec r) {
+ fireImageBoxEventInternal(new ImageFieldEvent(this, ImageFieldEvent.TYPE_ZOOM_RECTANGLE, r));
+ }
+
+ private void fireAutoFit() {
+ fireImageBoxEventInternal(new ImageFieldEvent(this, ImageFieldEvent.TYPE_AUTO_FIT));
+ }
+
+ private IMenu[] firePopup() {
+ ImageFieldEvent e = new ImageFieldEvent(this, ImageFieldEvent.TYPE_POPUP);
+ // single observer for table-owned menus
+ IMenu[] a = getMenus();
+ for (int i = 0; i < a.length; i++) {
+ IMenu m = a[i];
+ m.prepareAction();
+ if (m.isVisible()) {
+ e.addPopupMenu(m);
+ }
+ }
+ fireImageBoxEventInternal(e);
+ return e.getPopupMenus();
+ }
+
+ private void fireImageBoxEventInternal(ImageFieldEvent e) {
+ EventListener[] a = m_listenerList.getListeners(ImageFieldListener.class);
+ if (a != null) {
+ for (int i = 0; i < a.length; i++) {
+ ((ImageFieldListener) a[i]).imageFieldChanged(e);
+ }
+ }
+ }
+
+ @Override
+ public Object getImage() {
+ return propertySupport.getProperty(PROP_IMAGE);
+ }
+
+ @Override
+ public void setImage(Object imgObj) {
+ propertySupport.setProperty(PROP_IMAGE, imgObj);
+ }
+
+ @Override
+ public String getImageId() {
+ return propertySupport.getPropertyString(PROP_IMAGE_ID);
+ }
+
+ @Override
+ public void setImageId(String imageId) {
+ propertySupport.setPropertyString(PROP_IMAGE_ID, imageId);
+ }
+
+ @Override
+ public IMenu[] getMenus() {
+ return m_menus;
+ }
+
+ @Override
+ public double getZoomDeltaValue() {
+ return m_zoomDelta;
+ }
+
+ @Override
+ public void setZoomDelta(double d) {
+ m_zoomDelta = d;
+ }
+
+ @Override
+ public double getPanDelta() {
+ return m_panDelta;
+ }
+
+ @Override
+ public void setPanDelta(double d) {
+ m_panDelta = d;
+ }
+
+ @Override
+ public double getRotateDelta() {
+ return m_rotateDelta;
+ }
+
+ @Override
+ public void setRotateDelta(double deg) {
+ m_rotateDelta = deg;
+ }
+
+ @Override
+ public void setRotateDeltaInRadians(double rad) {
+ setRotateDelta(Math.toDegrees(rad));
+ }
+
+ @Override
+ public AffineTransformSpec getImageTransform() {
+ return new AffineTransformSpec((AffineTransformSpec) propertySupport.getProperty(PROP_IMAGE_TRANSFORM));
+ }
+
+ @Override
+ public void setImageTransform(AffineTransformSpec t) {
+ propertySupport.setProperty(PROP_IMAGE_TRANSFORM, new AffineTransformSpec(t));
+ }
+
+ @Override
+ public boolean isFocusVisible() {
+ return propertySupport.getPropertyBool(PROP_FOCUS_VISIBLE);
+ }
+
+ @Override
+ public void setFocusVisible(boolean b) {
+ propertySupport.setPropertyBool(PROP_FOCUS_VISIBLE, b);
+ }
+
+ @Override
+ public BoundsSpec getAnalysisRectangle() {
+ return (BoundsSpec) propertySupport.getProperty(PROP_ANALYSIS_RECTANGLE);
+ }
+
+ @Override
+ public void setAnalysisRectangle(BoundsSpec rect) {
+ propertySupport.setProperty(PROP_ANALYSIS_RECTANGLE, rect);
+ }
+
+ @Override
+ public void setAnalysisRectangle(int x, int y, int w, int h) {
+ setAnalysisRectangle(new BoundsSpec(x, y, w, h));
+ }
+
+ @Override
+ public boolean isAutoFit() {
+ return propertySupport.getPropertyBool(PROP_AUTO_FIT);
+ }
+
+ @Override
+ public void setAutoFit(boolean b) {
+ propertySupport.setPropertyBool(PROP_AUTO_FIT, b);
+ }
+
+ @Override
+ public boolean isScrollBarEnabled() {
+ return propertySupport.getPropertyBool(PROP_SCROLL_BAR_ENABLED);
+ }
+
+ @Override
+ public void setScrollBarEnabled(boolean b) {
+ propertySupport.setPropertyBool(PROP_SCROLL_BAR_ENABLED, b);
+ }
+
+ @Override
+ public void setDragType(int dragType) {
+ propertySupport.setPropertyInt(PROP_DRAG_TYPE, dragType);
+ }
+
+ @Override
+ public int getDragType() {
+ return propertySupport.getPropertyInt(PROP_DRAG_TYPE);
+ }
+
+ @Override
+ public void setDropType(int dropType) {
+ propertySupport.setPropertyInt(PROP_DROP_TYPE, dropType);
+ }
+
+ @Override
+ public int getDropType() {
+ return propertySupport.getPropertyInt(PROP_DROP_TYPE);
+ }
+
+ @Override
+ public byte[] getByteArrayValue() {
+ Object value = getImage();
+ byte[] b = null;
+ if (value instanceof byte[]) {
+ b = (byte[]) value;
+ }
+ return b;
+ }
+
+ @Override
+ public void doAutoFit() {
+ fireAutoFit();
+ }
+
+ @Override
+ public void doZoomRectangle(int x, int y, int w, int h) {
+ fireZoomRectangle(new BoundsSpec(x, y, w, h));
+ }
+
+ @Override
+ public void doPan(double dx, double dy) {
+ AffineTransformSpec t = getImageTransform();
+ t.dx = dx;
+ t.dy = dy;
+ setImageTransform(t);
+ }
+
+ @Override
+ public void doRelativePan(double dx, double dy) {
+ AffineTransformSpec t = getImageTransform();
+ t.dx = t.dx + dx;
+ t.dy = t.dy + dy;
+ setImageTransform(t);
+ }
+
+ @Override
+ public void doZoom(double fx, double fy) {
+ AffineTransformSpec t = getImageTransform();
+ t.sx = fx;
+ t.sy = fy;
+ setImageTransform(t);
+ }
+
+ @Override
+ public void doRelativeZoom(double fx, double fy) {
+ AffineTransformSpec t = getImageTransform();
+ t.sx = t.sx * fx;
+ t.sy = t.sy * fy;
+ setImageTransform(t);
+ }
+
+ @Override
+ public void doRotate(double angle) {
+ AffineTransformSpec t = getImageTransform();
+ t.angle = angle;
+ setImageTransform(t);
+ }
+
+ @Override
+ public void doRelativeRotate(double angleInDegrees) {
+ AffineTransformSpec t = getImageTransform();
+ t.angle = t.angle + Math.toRadians(angleInDegrees);
+ setImageTransform(t);
+ }
+
+ /*
+ * UI accessible
+ */
+ @Override
+ public IImageFieldUIFacade getUIFacade() {
+ return m_uiFacade;
+ }
+
+ private class P_UIFacade implements IImageFieldUIFacade {
+
+ @Override
+ public void setImageTransformFromUI(AffineTransformSpec t) {
+ setImageTransform(t);
+ }
+
+ @Override
+ public IMenu[] firePopupFromUI() {
+ return firePopup();
+ }
+
+ @Override
+ public TransferObject fireDragRequestFromUI() {
+ TransferObject t = null;
+ try {
+ t = execDragRequest();
+ }
+ catch (ProcessingException e) {
+ LOG.warn(null, e);
+ }
+ return t;
+ }
+
+ @Override
+ public void fireDropActionFromUi(TransferObject scoutTransferable) {
+ try {
+ execDropRequest(scoutTransferable);
+ }
+ catch (ProcessingException e) {
+ LOG.warn(null, e);
+ }
+ }
+
+ }// end private class
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/imagebox/IImageField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/imagebox/IImageField.java
index 85581e9d62..b15ecd855f 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/imagebox/IImageField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/imagebox/IImageField.java
@@ -1,122 +1,122 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.imagebox;
-
-import org.eclipse.scout.rt.client.ui.IDNDSupport;
-import org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.shared.data.basic.AffineTransformSpec;
-import org.eclipse.scout.rt.shared.data.basic.BoundsSpec;
-
-/**
- * You may add IKeyStrokes to the image field<br>
- * A default set of key strokes could look as follows
- * <ul>
- * <li>The AutoFitKeyStroke reacts on 'a' and calls doAutoFit()
- * <li>The PanUpKeyStroke reacts on 'up' and calls doRelativePan(0,-getPanDelta())
- * <li>The PanDownKeyStroke reacts on 'down' and calls doRelativePan(0,getPanDelta())
- * <li>The PanLeftKeyStroke reacts on 'left' and calls doRelativePan(-getPanDelta(),0)
- * <li>The PanRightKeyStroke reacts on 'right' and calls doRelativePan(getPanDelta(),0)
- * <li>The RotateLeftKeyStroke reacts on 'ctrl-left' and calls doRelativeRotate(-getRotateDelta())
- * <li>The RotateRightKeyStroke reacts on 'ctrl-right' and calls doRelativeRotate(getRotateDelta())
- * <li>The ZoomInKeyStroke reacts on '+' and calls doRelativeZoom(getZoomDeltaValue(),getZoomDeltaValue())
- * <li>The ZoomOutKeyStroke reacts on '-' and calls doRelativeZoom(1.0/getZoomDeltaValue(),1.0/getZoomDeltaValue())
- * </ul>
- */
-public interface IImageField extends IFormField, IDNDSupport {
- String PROP_IMAGE_ID = "imageId";
- String PROP_IMAGE = "image";
- String PROP_IMAGE_TRANSFORM = "imageTransform";
- String PROP_ANALYSIS_RECTANGLE = "analysisRectangle";
- String PROP_AUTO_FIT = "autoFit";
- String PROP_FOCUS_VISIBLE = "focusVisible";
- String PROP_SCROLL_BAR_ENABLED = "scrollBarEnabled";
-
- String getImageId();
-
- void setImageId(String imageId);
-
- Object getImage();
-
- void setImage(Object imgObj);
-
- byte[] getByteArrayValue();
-
- IMenu[] getMenus();
-
- @Override
- IKeyStroke[] getKeyStrokes();
-
- boolean isAutoFit();
-
- void setAutoFit(boolean b);
-
- BoundsSpec getAnalysisRectangle();
-
- void setAnalysisRectangle(int x, int y, int width, int heigth);
-
- void setAnalysisRectangle(BoundsSpec rect);
-
- AffineTransformSpec getImageTransform();
-
- void setImageTransform(AffineTransformSpec t);
-
- boolean isFocusVisible();
-
- void setFocusVisible(boolean b);
-
- void addImageFieldListener(ImageFieldListener listener);
-
- void removeImageFieldListener(ImageFieldListener listener);
-
- double getZoomDeltaValue();
-
- void setZoomDelta(double d);
-
- double getPanDelta();
-
- void setPanDelta(double d);
-
- /**
- * degrees
- */
- double getRotateDelta();
-
- /**
- * degrees
- */
- void setRotateDelta(double delta);
-
- void setRotateDeltaInRadians(double rad);
-
- void doAutoFit();
-
- void doPan(double dx, double dy);
-
- void doRelativePan(double dx, double dy);
-
- void doZoom(double fx, double fy);
-
- void doZoomRectangle(int x, int y, int w, int h);
-
- void doRelativeZoom(double fx, double fy);
-
- void doRotate(double angle);
-
- void doRelativeRotate(double angle);
-
- IImageFieldUIFacade getUIFacade();
-
- boolean isScrollBarEnabled();
-
- void setScrollBarEnabled(boolean b);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.imagebox;
+
+import org.eclipse.scout.rt.client.ui.IDNDSupport;
+import org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.shared.data.basic.AffineTransformSpec;
+import org.eclipse.scout.rt.shared.data.basic.BoundsSpec;
+
+/**
+ * You may add IKeyStrokes to the image field<br>
+ * A default set of key strokes could look as follows
+ * <ul>
+ * <li>The AutoFitKeyStroke reacts on 'a' and calls doAutoFit()
+ * <li>The PanUpKeyStroke reacts on 'up' and calls doRelativePan(0,-getPanDelta())
+ * <li>The PanDownKeyStroke reacts on 'down' and calls doRelativePan(0,getPanDelta())
+ * <li>The PanLeftKeyStroke reacts on 'left' and calls doRelativePan(-getPanDelta(),0)
+ * <li>The PanRightKeyStroke reacts on 'right' and calls doRelativePan(getPanDelta(),0)
+ * <li>The RotateLeftKeyStroke reacts on 'ctrl-left' and calls doRelativeRotate(-getRotateDelta())
+ * <li>The RotateRightKeyStroke reacts on 'ctrl-right' and calls doRelativeRotate(getRotateDelta())
+ * <li>The ZoomInKeyStroke reacts on '+' and calls doRelativeZoom(getZoomDeltaValue(),getZoomDeltaValue())
+ * <li>The ZoomOutKeyStroke reacts on '-' and calls doRelativeZoom(1.0/getZoomDeltaValue(),1.0/getZoomDeltaValue())
+ * </ul>
+ */
+public interface IImageField extends IFormField, IDNDSupport {
+ String PROP_IMAGE_ID = "imageId";
+ String PROP_IMAGE = "image";
+ String PROP_IMAGE_TRANSFORM = "imageTransform";
+ String PROP_ANALYSIS_RECTANGLE = "analysisRectangle";
+ String PROP_AUTO_FIT = "autoFit";
+ String PROP_FOCUS_VISIBLE = "focusVisible";
+ String PROP_SCROLL_BAR_ENABLED = "scrollBarEnabled";
+
+ String getImageId();
+
+ void setImageId(String imageId);
+
+ Object getImage();
+
+ void setImage(Object imgObj);
+
+ byte[] getByteArrayValue();
+
+ IMenu[] getMenus();
+
+ @Override
+ IKeyStroke[] getKeyStrokes();
+
+ boolean isAutoFit();
+
+ void setAutoFit(boolean b);
+
+ BoundsSpec getAnalysisRectangle();
+
+ void setAnalysisRectangle(int x, int y, int width, int heigth);
+
+ void setAnalysisRectangle(BoundsSpec rect);
+
+ AffineTransformSpec getImageTransform();
+
+ void setImageTransform(AffineTransformSpec t);
+
+ boolean isFocusVisible();
+
+ void setFocusVisible(boolean b);
+
+ void addImageFieldListener(ImageFieldListener listener);
+
+ void removeImageFieldListener(ImageFieldListener listener);
+
+ double getZoomDeltaValue();
+
+ void setZoomDelta(double d);
+
+ double getPanDelta();
+
+ void setPanDelta(double d);
+
+ /**
+ * degrees
+ */
+ double getRotateDelta();
+
+ /**
+ * degrees
+ */
+ void setRotateDelta(double delta);
+
+ void setRotateDeltaInRadians(double rad);
+
+ void doAutoFit();
+
+ void doPan(double dx, double dy);
+
+ void doRelativePan(double dx, double dy);
+
+ void doZoom(double fx, double fy);
+
+ void doZoomRectangle(int x, int y, int w, int h);
+
+ void doRelativeZoom(double fx, double fy);
+
+ void doRotate(double angle);
+
+ void doRelativeRotate(double angle);
+
+ IImageFieldUIFacade getUIFacade();
+
+ boolean isScrollBarEnabled();
+
+ void setScrollBarEnabled(boolean b);
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/imagebox/IImageFieldUIFacade.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/imagebox/IImageFieldUIFacade.java
index e5f26c3c1f..1095a9b359 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/imagebox/IImageFieldUIFacade.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/imagebox/IImageFieldUIFacade.java
@@ -1,29 +1,29 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.imagebox;
-
-import org.eclipse.scout.commons.dnd.TransferObject;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.shared.data.basic.AffineTransformSpec;
-
-/**
- * , Samuel Moser
- */
-public interface IImageFieldUIFacade {
-
- IMenu[] firePopupFromUI();
-
- void setImageTransformFromUI(AffineTransformSpec t);
-
- TransferObject fireDragRequestFromUI();
-
- void fireDropActionFromUi(TransferObject transferObject);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.imagebox;
+
+import org.eclipse.scout.commons.dnd.TransferObject;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.shared.data.basic.AffineTransformSpec;
+
+/**
+ * , Samuel Moser
+ */
+public interface IImageFieldUIFacade {
+
+ IMenu[] firePopupFromUI();
+
+ void setImageTransformFromUI(AffineTransformSpec t);
+
+ TransferObject fireDragRequestFromUI();
+
+ void fireDropActionFromUi(TransferObject transferObject);
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/imagebox/ImageFieldEvent.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/imagebox/ImageFieldEvent.java
index 45942aa1f5..4cab012c8b 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/imagebox/ImageFieldEvent.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/imagebox/ImageFieldEvent.java
@@ -1,102 +1,102 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.imagebox;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.EventObject;
-
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.shared.data.basic.BoundsSpec;
-
-public class ImageFieldEvent extends EventObject {
- private static final long serialVersionUID = 1L;
-
- private int m_type;
- private ArrayList<IMenu> m_popupMenus;
- private BoundsSpec m_rect;
-
- public static final int TYPE_ZOOM_RECTANGLE = 10;
- public static final int TYPE_AUTO_FIT = 20;
- public static final int TYPE_POPUP = 30;
-
- public ImageFieldEvent(IImageField source, int type) {
- super(source);
- m_type = type;
- }
-
- public ImageFieldEvent(IImageField source, int type, BoundsSpec r) {
- super(source);
- m_type = type;
- m_rect = r;
- }
-
- public int getType() {
- return m_type;
- }
-
- public IImageField getImageField() {
- return (IImageField) getSource();
- }
-
- public void addPopupMenu(IMenu menu) {
- if (menu != null) {
- if (m_popupMenus == null) {
- m_popupMenus = new ArrayList<IMenu>();
- }
- m_popupMenus.add(menu);
- }
- }
-
- /**
- * used by TYPE_POPUP to add actions
- */
- public void addPopupMenus(IMenu[] menus) {
- if (menus != null) {
- if (m_popupMenus == null) {
- m_popupMenus = new ArrayList<IMenu>();
- }
- m_popupMenus.addAll(Arrays.asList(menus));
- }
- }
-
- /**
- * used by TYPE_POPUP to add actions
- */
- public IMenu[] getPopupMenus() {
- if (m_popupMenus != null) {
- return m_popupMenus.toArray(new IMenu[0]);
- }
- else {
- return new IMenu[0];
- }
- }
-
- /**
- * used by TYPE_POPUP to add actions
- */
- public int getPopupMenuCount() {
- if (m_popupMenus != null) {
- return m_popupMenus.size();
- }
- else {
- return 0;
- }
- }
-
- /**
- * used by TYPE_ZOOM_RECTANGLE
- */
- public BoundsSpec getZoomRectangle() {
- return m_rect;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.imagebox;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.EventObject;
+
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.shared.data.basic.BoundsSpec;
+
+public class ImageFieldEvent extends EventObject {
+ private static final long serialVersionUID = 1L;
+
+ private int m_type;
+ private ArrayList<IMenu> m_popupMenus;
+ private BoundsSpec m_rect;
+
+ public static final int TYPE_ZOOM_RECTANGLE = 10;
+ public static final int TYPE_AUTO_FIT = 20;
+ public static final int TYPE_POPUP = 30;
+
+ public ImageFieldEvent(IImageField source, int type) {
+ super(source);
+ m_type = type;
+ }
+
+ public ImageFieldEvent(IImageField source, int type, BoundsSpec r) {
+ super(source);
+ m_type = type;
+ m_rect = r;
+ }
+
+ public int getType() {
+ return m_type;
+ }
+
+ public IImageField getImageField() {
+ return (IImageField) getSource();
+ }
+
+ public void addPopupMenu(IMenu menu) {
+ if (menu != null) {
+ if (m_popupMenus == null) {
+ m_popupMenus = new ArrayList<IMenu>();
+ }
+ m_popupMenus.add(menu);
+ }
+ }
+
+ /**
+ * used by TYPE_POPUP to add actions
+ */
+ public void addPopupMenus(IMenu[] menus) {
+ if (menus != null) {
+ if (m_popupMenus == null) {
+ m_popupMenus = new ArrayList<IMenu>();
+ }
+ m_popupMenus.addAll(Arrays.asList(menus));
+ }
+ }
+
+ /**
+ * used by TYPE_POPUP to add actions
+ */
+ public IMenu[] getPopupMenus() {
+ if (m_popupMenus != null) {
+ return m_popupMenus.toArray(new IMenu[0]);
+ }
+ else {
+ return new IMenu[0];
+ }
+ }
+
+ /**
+ * used by TYPE_POPUP to add actions
+ */
+ public int getPopupMenuCount() {
+ if (m_popupMenus != null) {
+ return m_popupMenus.size();
+ }
+ else {
+ return 0;
+ }
+ }
+
+ /**
+ * used by TYPE_ZOOM_RECTANGLE
+ */
+ public BoundsSpec getZoomRectangle() {
+ return m_rect;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/imagebox/ImageFieldListener.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/imagebox/ImageFieldListener.java
index b2b78247d5..b1438ad13d 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/imagebox/ImageFieldListener.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/imagebox/ImageFieldListener.java
@@ -1,19 +1,19 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.imagebox;
-
-import java.util.EventListener;
-
-public interface ImageFieldListener extends EventListener {
-
- void imageFieldChanged(ImageFieldEvent e);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.imagebox;
+
+import java.util.EventListener;
+
+public interface ImageFieldListener extends EventListener {
+
+ void imageFieldChanged(ImageFieldEvent e);
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/integerfield/AbstractIntegerField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/integerfield/AbstractIntegerField.java
index 2a7599394d..f46b4af998 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/integerfield/AbstractIntegerField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/integerfield/AbstractIntegerField.java
@@ -1,83 +1,83 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.integerfield;
-
-import java.text.ParsePosition;
-
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.form.fields.numberfield.AbstractNumberField;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.data.form.ValidationRule;
-
-public abstract class AbstractIntegerField extends AbstractNumberField<Integer> implements IIntegerField {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractIntegerField.class);
-
- public AbstractIntegerField() {
- this(true);
- }
-
- public AbstractIntegerField(boolean callInitializer) {
- super(callInitializer);
- }
-
- /*
- * Configuration
- */
- @ConfigProperty(ConfigProperty.INTEGER)
- @Order(250)
- @ConfigPropertyValue("null")
- @ValidationRule(ValidationRule.MIN_VALUE)
- protected Integer getConfiguredMinimumValue() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.INTEGER)
- @Order(260)
- @ConfigPropertyValue("null")
- @ValidationRule(ValidationRule.MAX_VALUE)
- protected Integer getConfiguredMaximumValue() {
- return null;
- }
-
- @Override
- protected void initConfig() {
- super.initConfig();
- setMinValue(getConfiguredMinimumValue());
- setMaxValue(getConfiguredMaximumValue());
- }
-
- // convert string to a real int
- @Override
- protected Integer parseValueInternal(String text) throws ProcessingException {
- Integer retVal = null;
- if (text == null) {
- text = "";
- }
- else {
- text = text.trim();
- }
- if (text.length() > 0) {
- ParsePosition p = new ParsePosition(0);
- Number n = createNumberFormat().parse(text, p);
- if (p.getErrorIndex() >= 0 || p.getIndex() != text.length()) {
- throw new ProcessingException(ScoutTexts.get("InvalidNumberMessageX", text));
- }
- retVal = new Integer(n.intValue());
- }
- return retVal;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.integerfield;
+
+import java.text.ParsePosition;
+
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.form.fields.numberfield.AbstractNumberField;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.data.form.ValidationRule;
+
+public abstract class AbstractIntegerField extends AbstractNumberField<Integer> implements IIntegerField {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractIntegerField.class);
+
+ public AbstractIntegerField() {
+ this(true);
+ }
+
+ public AbstractIntegerField(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ /*
+ * Configuration
+ */
+ @ConfigProperty(ConfigProperty.INTEGER)
+ @Order(250)
+ @ConfigPropertyValue("null")
+ @ValidationRule(ValidationRule.MIN_VALUE)
+ protected Integer getConfiguredMinimumValue() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.INTEGER)
+ @Order(260)
+ @ConfigPropertyValue("null")
+ @ValidationRule(ValidationRule.MAX_VALUE)
+ protected Integer getConfiguredMaximumValue() {
+ return null;
+ }
+
+ @Override
+ protected void initConfig() {
+ super.initConfig();
+ setMinValue(getConfiguredMinimumValue());
+ setMaxValue(getConfiguredMaximumValue());
+ }
+
+ // convert string to a real int
+ @Override
+ protected Integer parseValueInternal(String text) throws ProcessingException {
+ Integer retVal = null;
+ if (text == null) {
+ text = "";
+ }
+ else {
+ text = text.trim();
+ }
+ if (text.length() > 0) {
+ ParsePosition p = new ParsePosition(0);
+ Number n = createNumberFormat().parse(text, p);
+ if (p.getErrorIndex() >= 0 || p.getIndex() != text.length()) {
+ throw new ProcessingException(ScoutTexts.get("InvalidNumberMessageX", text));
+ }
+ retVal = new Integer(n.intValue());
+ }
+ return retVal;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/integerfield/IIntegerField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/integerfield/IIntegerField.java
index b9c5aaef28..9e21a60b31 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/integerfield/IIntegerField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/integerfield/IIntegerField.java
@@ -1,17 +1,17 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.integerfield;
-
-import org.eclipse.scout.rt.client.ui.form.fields.numberfield.INumberField;
-
-public interface IIntegerField extends INumberField<Integer> {
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.integerfield;
+
+import org.eclipse.scout.rt.client.ui.form.fields.numberfield.INumberField;
+
+public interface IIntegerField extends INumberField<Integer> {
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/internal/GridDataBuilder.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/internal/GridDataBuilder.java
index 2fd43cdff8..a8b888c41b 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/internal/GridDataBuilder.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/internal/GridDataBuilder.java
@@ -1,27 +1,27 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.internal;
-
-import org.eclipse.scout.rt.client.ui.form.fields.GridData;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-
-public final class GridDataBuilder {
- private GridDataBuilder() {
- }
-
- public static GridData createFromHints(IFormField f, int gridColumnCount) {
- GridData data = f.getGridDataHints();
- if (data.w == IFormField.FULL_WIDTH) {
- data.w = gridColumnCount;
- }
- return data;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.internal;
+
+import org.eclipse.scout.rt.client.ui.form.fields.GridData;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+
+public final class GridDataBuilder {
+ private GridDataBuilder() {
+ }
+
+ public static GridData createFromHints(IFormField f, int gridColumnCount) {
+ GridData data = f.getGridDataHints();
+ if (data.w == IFormField.FULL_WIDTH) {
+ data.w = gridColumnCount;
+ }
+ return data;
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/internal/TestHolder.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/internal/TestHolder.java
index 3bd6c63170..bb4d9b1de8 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/internal/TestHolder.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/internal/TestHolder.java
@@ -1,28 +1,28 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.internal;
-
-public final class TestHolder {
-
- private TestHolder() {
- }
-
- public static void main(String[] args) {
- // Class
- // c=TypeCastUtility.getGenericsParameterClass(SpecificThing.class,IHolder.class);
- // Class
- // c=TypeCastUtility.getGenericsParameterClass(GenericThing.class,IHolder.class);
- // Class
- // c=TypeCastUtility.getGenericsParameterClass(TestColumn.class,IColumn.class);
- // System.out.println("C="+c);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.internal;
+
+public final class TestHolder {
+
+ private TestHolder() {
+ }
+
+ public static void main(String[] args) {
+ // Class
+ // c=TypeCastUtility.getGenericsParameterClass(SpecificThing.class,IHolder.class);
+ // Class
+ // c=TypeCastUtility.getGenericsParameterClass(GenericThing.class,IHolder.class);
+ // Class
+ // c=TypeCastUtility.getGenericsParameterClass(TestColumn.class,IColumn.class);
+ // System.out.println("C="+c);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/labelfield/AbstractLabelField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/labelfield/AbstractLabelField.java
index acdc6266be..86f12de70b 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/labelfield/AbstractLabelField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/labelfield/AbstractLabelField.java
@@ -1,86 +1,86 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.labelfield;
-
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.form.fields.AbstractValueField;
-
-public abstract class AbstractLabelField extends AbstractValueField<String> implements ILabelField {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractLabelField.class);
-
- private ILabelFieldUIFacade m_uiFacade;
-
- public AbstractLabelField() {
- this(true);
- }
-
- public AbstractLabelField(boolean callInitializer) {
- super(callInitializer);
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(250)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredWrapText() {
- return false;
- }
-
- @Override
- protected void initConfig() {
- m_uiFacade = new P_UIFacade();
- super.initConfig();
- setWrapText(getConfiguredWrapText());
- }
-
- @Override
- protected String validateValueInternal(String rawValue) throws ProcessingException {
- String validValue = null;
- rawValue = super.validateValueInternal(rawValue);
- validValue = rawValue;
- if (validValue != null && validValue.length() == 0) {
- validValue = null;
- }
- return validValue;
- }
-
- @Override
- public void setWrapText(boolean b) {
- propertySupport.setPropertyBool(PROP_WRAP_TEXT, b);
- }
-
- @Override
- public boolean isWrapText() {
- return propertySupport.getPropertyBool(PROP_WRAP_TEXT);
- }
-
- @Override
- public ILabelFieldUIFacade getUIFacade() {
- return m_uiFacade;
- }
-
- // convert string to a real string
- @Override
- protected String parseValueInternal(String text) throws ProcessingException {
- if (text != null && text.length() == 0) {
- text = null;
- }
- return text;
- }
-
- private class P_UIFacade implements ILabelFieldUIFacade {
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.labelfield;
+
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.form.fields.AbstractValueField;
+
+public abstract class AbstractLabelField extends AbstractValueField<String> implements ILabelField {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractLabelField.class);
+
+ private ILabelFieldUIFacade m_uiFacade;
+
+ public AbstractLabelField() {
+ this(true);
+ }
+
+ public AbstractLabelField(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(250)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredWrapText() {
+ return false;
+ }
+
+ @Override
+ protected void initConfig() {
+ m_uiFacade = new P_UIFacade();
+ super.initConfig();
+ setWrapText(getConfiguredWrapText());
+ }
+
+ @Override
+ protected String validateValueInternal(String rawValue) throws ProcessingException {
+ String validValue = null;
+ rawValue = super.validateValueInternal(rawValue);
+ validValue = rawValue;
+ if (validValue != null && validValue.length() == 0) {
+ validValue = null;
+ }
+ return validValue;
+ }
+
+ @Override
+ public void setWrapText(boolean b) {
+ propertySupport.setPropertyBool(PROP_WRAP_TEXT, b);
+ }
+
+ @Override
+ public boolean isWrapText() {
+ return propertySupport.getPropertyBool(PROP_WRAP_TEXT);
+ }
+
+ @Override
+ public ILabelFieldUIFacade getUIFacade() {
+ return m_uiFacade;
+ }
+
+ // convert string to a real string
+ @Override
+ protected String parseValueInternal(String text) throws ProcessingException {
+ if (text != null && text.length() == 0) {
+ text = null;
+ }
+ return text;
+ }
+
+ private class P_UIFacade implements ILabelFieldUIFacade {
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/labelfield/ILabelField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/labelfield/ILabelField.java
index 22d4052b8e..9a310b244c 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/labelfield/ILabelField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/labelfield/ILabelField.java
@@ -1,23 +1,23 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.labelfield;
-
-import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
-
-public interface ILabelField extends IValueField<String> {
- String PROP_WRAP_TEXT = "wrapText";
-
- void setWrapText(boolean b);
-
- boolean isWrapText();
-
- ILabelFieldUIFacade getUIFacade();
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.labelfield;
+
+import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
+
+public interface ILabelField extends IValueField<String> {
+ String PROP_WRAP_TEXT = "wrapText";
+
+ void setWrapText(boolean b);
+
+ boolean isWrapText();
+
+ ILabelFieldUIFacade getUIFacade();
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/labelfield/ILabelFieldUIFacade.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/labelfield/ILabelFieldUIFacade.java
index ff8291285f..8299cf389a 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/labelfield/ILabelFieldUIFacade.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/labelfield/ILabelFieldUIFacade.java
@@ -1,15 +1,15 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.labelfield;
-
-public interface ILabelFieldUIFacade {
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.labelfield;
+
+public interface ILabelFieldUIFacade {
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/listbox/AbstractListBox.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/listbox/AbstractListBox.java
index 9912ba5057..76f1585f12 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/listbox/AbstractListBox.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/listbox/AbstractListBox.java
@@ -1,1041 +1,1041 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.listbox;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.lang.reflect.Array;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-
-import org.eclipse.scout.commons.ConfigurationUtility;
-import org.eclipse.scout.commons.TriState;
-import org.eclipse.scout.commons.TypeCastUtility;
-import org.eclipse.scout.commons.annotations.ConfigOperation;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.holders.Holder;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.services.lookup.FormFieldProvisioningContext;
-import org.eclipse.scout.rt.client.services.lookup.ILookupCallProvisioningService;
-import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
-import org.eclipse.scout.rt.client.ui.basic.cell.ICell;
-import org.eclipse.scout.rt.client.ui.basic.table.AbstractTable;
-import org.eclipse.scout.rt.client.ui.basic.table.AbstractTableRowBuilder;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRowFilter;
-import org.eclipse.scout.rt.client.ui.basic.table.TableAdapter;
-import org.eclipse.scout.rt.client.ui.basic.table.TableEvent;
-import org.eclipse.scout.rt.client.ui.basic.table.TableRow;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractBooleanColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractStringColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-import org.eclipse.scout.rt.client.ui.form.IFormFieldVisitor;
-import org.eclipse.scout.rt.client.ui.form.fields.AbstractValueField;
-import org.eclipse.scout.rt.client.ui.form.fields.GridData;
-import org.eclipse.scout.rt.client.ui.form.fields.ICompositeField;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.data.basic.FontSpec;
-import org.eclipse.scout.rt.shared.data.form.ValidationRule;
-import org.eclipse.scout.rt.shared.services.common.code.ICodeType;
-import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
-import org.eclipse.scout.rt.shared.services.lookup.CodeLookupCall;
-import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
-import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
-import org.eclipse.scout.service.SERVICES;
-
-public abstract class AbstractListBox<T> extends AbstractValueField<T[]> implements IListBox<T> {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractListBox.class);
-
- private ITable m_table;
- private IListBoxUIFacade m_uiFacade;
- private LookupCall m_lookupCall;
- private Class<? extends ICodeType> m_codeTypeClass;
- private boolean m_valueTableSyncActive;
- private ITableRowFilter m_checkedRowsFilter;
- private ITableRowFilter m_activeRowsFilter;
- // children
- private IFormField[] m_fields;
-
- public AbstractListBox() {
- this(true);
- }
-
- public AbstractListBox(boolean callInitializer) {
- super(callInitializer);
- }
-
- /*
- * Configuration
- */
- @ConfigProperty(ConfigProperty.LOOKUP_CALL)
- @Order(240)
- @ConfigPropertyValue("null")
- @ValidationRule(ValidationRule.LOOKUP_CALL)
- protected Class<? extends LookupCall> getConfiguredLookupCall() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.CODE_TYPE)
- @Order(250)
- @ConfigPropertyValue("null")
- @ValidationRule(ValidationRule.CODE_TYPE)
- protected Class<? extends ICodeType> getConfiguredCodeType() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.ICON_ID)
- @Order(230)
- @ConfigPropertyValue("null")
- protected String getConfiguredIconId() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(260)
- @ConfigPropertyValue("true")
- protected boolean getConfiguredAutoLoad() {
- return true;
- }
-
- /**
- * @return true: a filter is added to the listbox table that only accepts rows
- * that are active or checked.<br>
- * Default is true<br>
- * Affects {@link ITable#getFilteredRows()}
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(270)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredFilterActiveRows() {
- return false;
- }
-
- /**
- * @return true: a filter is added to the listbox table that only accepts
- * checked rows<br>
- * Default is false<br>
- * Affects {@link ITable#getFilteredRows()}<br>
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(280)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredFilterCheckedRows() {
- return false;
- }
-
- @Override
- @ConfigPropertyValue("1.0")
- protected double getConfiguredGridWeightY() {
- return 1.0;
- }
-
- private Class<? extends IFormField>[] getConfiguredFields() {
- Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
- return ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, IFormField.class);
- }
-
- /**
- * called before any lookup is performed
- */
- @ConfigOperation
- @Order(250)
- protected void execPrepareLookup(LookupCall call) throws ProcessingException {
- }
-
- /**
- * @param call
- * that produced this result
- * @param result
- * live list containing the result rows. Add, remove, set, replace
- * and clear of entries in this list is supported
- */
- @ConfigOperation
- @Order(260)
- protected void execFilterLookupResult(LookupCall call, List<LookupRow> result) throws ProcessingException {
- }
-
- @ConfigOperation
- @Order(230)
- protected LookupRow[] execLoadTableData() throws ProcessingException {
- LookupRow[] data;
- // (1) get data by service
- if (getLookupCall() != null) {
- LookupCall call = SERVICES.getService(ILookupCallProvisioningService.class).newClonedInstance(getLookupCall(), new FormFieldProvisioningContext(AbstractListBox.this));
- prepareLookupCall(call);
- data = call.getDataByAll();
- data = filterLookupResult(call, data);
- }
- // (b) get data direct
- else {
- data = new LookupRow[0];
- data = filterLookupResult(null, data);
- }
- return data;
- }
-
- /**
- * interceptor is called after data was fetched from LookupCall and is adding
- * a table row for every LookupRow using IListBoxTable.createTableRow(row) and
- * ITable.addRows()
- * <p>
- * For most cases the override of just {@link #execLoadTableData()} is sufficient
- *
- * <pre>
- * LookupRow[] data=execLoadTableData();
- * ITableRow[] rows=new ITableRow[data!=null? data.length : 0];
- * if(data!=null){
- * for(int i=0; i{@code<}data.length; i++){
- * rows[i]=createTableRow(data[i]);
- * }
- * }
- * getTable().replaceRows(rows);
- * </pre>
- */
- @ConfigOperation
- @Order(240)
- protected void execPopulateTable() throws ProcessingException {
- LookupRow[] data = null;
- //sle Ticket 92'893: Listbox Master required. only run loadTable when master value is set
- if (!isMasterRequired() || getMasterValue() != null) {
- data = execLoadTableData();
- }
- ITableRow[] rows = new ITableRow[data != null ? data.length : 0];
- if (data != null) {
- for (int i = 0; i < data.length; i++) {
- rows[i] = getTableRowBuilder().createTableRow(data[i]);
- }
- }
- getTable().replaceRows(rows);
- }
-
- private Class<? extends ITable> getConfiguredTable() {
- Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
- Class<? extends ITable>[] f = ConfigurationUtility.filterClasses(dca, ITable.class);
- if (f.length == 1) {
- return f[0];
- }
- else {
- for (Class<? extends ITable> c : f) {
- if (c.getDeclaringClass() != AbstractListBox.class) {
- return c;
- }
- }
- return null;
- }
- }
-
- @Override
- protected void execChangedMasterValue(Object newMasterValue) throws ProcessingException {
- setValue(null);
- loadListBoxData();
- }
-
- @Override
- protected void initConfig() {
- m_uiFacade = createUIFacade();
- m_fields = new IFormField[0];
- super.initConfig();
- setFilterActiveRows(getConfiguredFilterActiveRows());
- setFilterActiveRowsValue(TriState.TRUE);
- setFilterCheckedRows(getConfiguredFilterCheckedRows());
- setFilterCheckedRowsValue(getConfiguredFilterCheckedRows());
- try {
- m_table = ConfigurationUtility.newInnerInstance(this, getConfiguredTable());
- if (m_table instanceof AbstractTable) {
- ((AbstractTable) m_table).setContainerInternal(this);
- }
- updateActiveRowsFilter();
- updateCheckedRowsFilter();
- m_table.addTableListener(new TableAdapter() {
- @Override
- public void tableChanged(TableEvent e) {
- switch (e.getType()) {
- case TableEvent.TYPE_ROWS_SELECTED: {
- if (!getTable().isCheckable()) {
- syncTableToValue();
- }
- break;
- }
- case TableEvent.TYPE_ROWS_UPDATED: {
- if (getTable().isCheckable()) {
- syncTableToValue();
- }
- break;
- }
- }
- }
- });
- // default icon
- if (m_table.getDefaultIconId() == null && this.getConfiguredIconId() != null) {
- m_table.setDefaultIconId(this.getConfiguredIconId());
- }
- m_table.setEnabled(isEnabled());
- }
- catch (Exception e) {
- LOG.warn(null, e);
- }
- // lookup call
- if (getConfiguredLookupCall() != null) {
- try {
- LookupCall call = getConfiguredLookupCall().newInstance();
- setLookupCall(call);
- }
- catch (Exception e) {
- LOG.warn(null, e);
- }
- }
- // code type
- if (getConfiguredCodeType() != null) {
- setCodeTypeClass(getConfiguredCodeType());
- }
- // local property listener
- addPropertyChangeListener(new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent e) {
- if (m_table != null) {
- String name = e.getPropertyName();
- if (PROP_ENABLED.equals(name)) {
- m_table.setEnabled(isEnabled());
- }
- else if (PROP_FILTER_CHECKED_ROWS_VALUE.equals(name)) {
- updateCheckedRowsFilter();
- }
- else if (PROP_FILTER_ACTIVE_ROWS_VALUE.equals(name)) {
- updateActiveRowsFilter();
- }
- }
- }
- });
- // add fields
- ArrayList<IFormField> fieldList = new ArrayList<IFormField>();
- Class<? extends IFormField>[] fieldArray = getConfiguredFields();
- for (int i = 0; i < fieldArray.length; i++) {
- IFormField f;
- try {
- f = ConfigurationUtility.newInnerInstance(this, fieldArray[i]);
- fieldList.add(f);
- }// end try
- catch (Throwable t) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("field: " + fieldArray[i].getName(), t));
- }
- }
- for (IFormField f : fieldList) {
- f.setParentFieldInternal(this);
- }
- m_fields = fieldList.toArray(new IFormField[0]);
- }
-
- public ListBoxFilterBox getListBoxFilterBox() {
- return getFieldByClass(ListBoxFilterBox.class);
- }
-
- @Override
- protected void initFieldInternal() throws ProcessingException {
- getTable().initTable();
- if (getConfiguredAutoLoad()) {
- try {
- setValueChangeTriggerEnabled(false);
- //
- loadListBoxData();
- }
- finally {
- setValueChangeTriggerEnabled(true);
- }
- }
- super.initFieldInternal();
- }
-
- @Override
- protected void disposeFieldInternal() {
- super.disposeFieldInternal();
- getTable().disposeTable();
- }
-
- public AbstractTableRowBuilder getTableRowBuilder() {
- return new P_TableRowBuilder();
- }
-
- protected IListBoxUIFacade createUIFacade() {
- return new P_ListBoxUIFacade();
- }
-
- @Override
- public IListBoxUIFacade getUIFacade() {
- return m_uiFacade;
- }
-
- @Override
- public final ITable getTable() {
- return m_table;
- }
-
- @Override
- public boolean isFilterCheckedRows() {
- return propertySupport.getPropertyBool(PROP_FILTER_CHECKED_ROWS);
- }
-
- @Override
- public void setFilterCheckedRows(boolean b) {
- propertySupport.setPropertyBool(PROP_FILTER_CHECKED_ROWS, b);
- }
-
- @Override
- public boolean getFilterCheckedRowsValue() {
- return propertySupport.getPropertyBool(PROP_FILTER_CHECKED_ROWS_VALUE);
- }
-
- @Override
- public void setFilterCheckedRowsValue(boolean b) {
- propertySupport.setPropertyBool(PROP_FILTER_CHECKED_ROWS_VALUE, b);
- }
-
- @Override
- public boolean isFilterActiveRows() {
- return propertySupport.getPropertyBool(PROP_FILTER_ACTIVE_ROWS);
- }
-
- @Override
- public void setFilterActiveRows(boolean b) {
- propertySupport.setPropertyBool(PROP_FILTER_ACTIVE_ROWS, b);
- }
-
- @Override
- public TriState getFilterActiveRowsValue() {
- return (TriState) propertySupport.getProperty(PROP_FILTER_ACTIVE_ROWS_VALUE);
- }
-
- @Override
- public void setFilterActiveRowsValue(TriState t) {
- if (t == null) {
- t = TriState.TRUE;
- }
- propertySupport.setProperty(PROP_FILTER_ACTIVE_ROWS_VALUE, t);
- }
-
- private void updateActiveRowsFilter() {
- try {
- getTable().setTableChanging(true);
- //
- if (m_activeRowsFilter != null) {
- getTable().removeRowFilter(m_activeRowsFilter);
- m_activeRowsFilter = null;
- }
- m_activeRowsFilter = new ActiveOrCheckedRowsFilter(getActiveColumnInternal(), getFilterActiveRowsValue());
- getTable().addRowFilter(m_activeRowsFilter);
- }
- finally {
- getTable().setTableChanging(false);
- }
- }
-
- private void updateCheckedRowsFilter() {
- try {
- getTable().setTableChanging(true);
- //
- if (m_checkedRowsFilter != null) {
- getTable().removeRowFilter(m_checkedRowsFilter);
- m_checkedRowsFilter = null;
- }
- if (getFilterCheckedRowsValue()) {
- m_checkedRowsFilter = new CheckedRowsFilter();
- getTable().addRowFilter(m_checkedRowsFilter);
- }
- }
- finally {
- getTable().setTableChanging(false);
- }
- }
-
- @Override
- public void loadListBoxData() throws ProcessingException {
- if (getTable() != null) {
- try {
- m_valueTableSyncActive = true;
- getTable().setTableChanging(true);
- //
- execPopulateTable();
- }
- finally {
- getTable().setTableChanging(false);
- m_valueTableSyncActive = false;
- }
- syncValueToTable();
- }
- }
-
- /**
- * do not use this internal method directly
- */
- @Override
- public final void prepareLookupCall(LookupCall call) throws ProcessingException {
- prepareLookupCallInternal(call);
- execPrepareLookup(call);
- }
-
- private LookupRow[] filterLookupResult(LookupCall call, LookupRow[] data) throws ProcessingException {
- ArrayList<LookupRow> result;
- if (data != null) {
- result = new ArrayList<LookupRow>(Arrays.asList(data));
- }
- else {
- result = new ArrayList<LookupRow>();
- }
- execFilterLookupResult(call, result);
- int len = 0;
- for (LookupRow r : result) {
- if (r != null) {
- len++;
- }
- }
- LookupRow[] a = new LookupRow[len];
- int index = 0;
- for (LookupRow r : result) {
- if (r != null) {
- a[index] = r;
- index++;
- }
- }
- return a;
- }
-
- /**
- * do not use this internal method directly
- */
- private void prepareLookupCallInternal(LookupCall call) {
- call.setActive(TriState.UNDEFINED);
- //when there is a master value defined in the original call, don't set it to null when no master value is available
- if (getMasterValue() != null || getLookupCall() == null || getLookupCall().getMaster() == null) {
- call.setMaster(getMasterValue());
- }
- }
-
- @Override
- public final LookupCall getLookupCall() {
- return m_lookupCall;
- }
-
- @Override
- public void setLookupCall(LookupCall call) {
- m_lookupCall = call;
- }
-
- @Override
- public Class<? extends ICodeType> getCodeTypeClass() {
- return m_codeTypeClass;
- }
-
- @Override
- public void setCodeTypeClass(Class<? extends ICodeType> codeTypeClass) {
- m_codeTypeClass = codeTypeClass;
- // create lookup service call
- m_lookupCall = null;
- if (m_codeTypeClass != null) {
- m_lookupCall = CodeLookupCall.newInstanceByService(m_codeTypeClass);
- }
- }
-
- @Override
- protected void valueChangedInternal() {
- super.valueChangedInternal();
- syncValueToTable();
- }
-
- @Override
- protected String formatValueInternal(T[] validValue) {
- if (validValue == null || validValue.length == 0) {
- return "";
- }
- StringBuffer b = new StringBuffer();
- ITableRow[] rows = getKeyColumnInternal().findRows(validValue);
- for (int i = 0; i < rows.length; i++) {
- if (i > 0) {
- b.append(", ");
- }
- b.append(getTextColumnInternal().getValue(rows[i]));
- }
- return b.toString();
- }
-
- @SuppressWarnings("unchecked")
- @Override
- protected T[] validateValueInternal(T[] rawValue) throws ProcessingException {
- T[] validValue = rawValue;
- //
- if (validValue != null && validValue.length == 0) {
- validValue = null;
- }
- ITable table = getTable();
- if (table != null && validValue != null) {
- if ((table.isCheckable() && !table.isMultiCheck()) || (!table.isCheckable() && !table.isMultiSelect())) {
- //only single value
- if (validValue.length > 1) {
- LOG.warn(getClass().getName() + " only accepts a single value. Got " + Arrays.toString(validValue) + ". Using only first value.");
- T[] newArray = (T[]) Array.newInstance(validValue.getClass().getComponentType(), 1);
- newArray[0] = validValue[0];
- validValue = newArray;
- }
- }
- }
- return validValue;
- }
-
- @Override
- public T getSingleValue() {
- T[] a = getValue();
- if (a != null && a.length > 0) {
- return a[0];
- }
- else {
- return null;
- }
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public void setSingleValue(T value) {
- if (value == null) {
- setValue(null);
- }
- else {
- T[] array = (T[]) Array.newInstance(getHolderType().getComponentType(), 1);
- array[0] = value;
- setValue(array);
- }
- }
-
- @Override
- public int getCheckedKeyCount() {
- T[] keys = getValue();
- if (keys != null) {
- return keys.length;
- }
- else {
- return 0;
- }
- }
-
- @Override
- public T getCheckedKey() {
- T[] a = getCheckedKeys();
- if (a != null && a.length > 0) {
- return a[0];
- }
- else {
- return null;
- }
- }
-
- @Override
- public T[] getCheckedKeys() {
- return getValue();
- }
-
- @Override
- public LookupRow getCheckedLookupRow() {
- LookupRow[] a = getCheckedLookupRows();
- if (a != null && a.length > 0) {
- return a[0];
- }
- else {
- return null;
- }
- }
-
- @Override
- public LookupRow[] getCheckedLookupRows() {
- LookupRow[] lookupRows = null;
- ITableRow[] tableRows = getTable().getCheckedRows();
- if (tableRows != null) {
- lookupRows = new LookupRow[tableRows.length];
- for (int i = 0; i < tableRows.length; i++) {
- ICell cell = tableRows[i].getCell(1);
- lookupRows[i] = new LookupRow(tableRows[i].getCellValue(0), cell.getText(), cell.getIconId(), cell.getTooltipText(), cell.getBackgroundColor(), cell.getForegroundColor(), cell.getFont(), cell.isEnabled());
- }
- }
- return lookupRows;
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public void checkKey(T key) {
- if (key == null) {
- checkKeys(null);
- }
- else {
- T[] array = (T[]) Array.newInstance(getHolderType().getComponentType(), 1);
- array[0] = key;
- checkKeys(array);
- }
- }
-
- @Override
- public void checkKeys(T[] keys) {
- setValue(keys);
- }
-
- @Override
- public void uncheckAllKeys() {
- checkKeys(null);
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public T[] getUncheckedKeys() {
- HashSet<T> set = new HashSet<T>();
- T[] a = getInitValue();
- if (a != null) {
- set.addAll(Arrays.asList(a));
- }
- a = getCheckedKeys();
- if (a != null) {
- set.removeAll(Arrays.asList(a));
- }
- T[] array = (T[]) Array.newInstance(getHolderType().getComponentType(), 0);
- a = set.toArray(array);
- if (a != null && a.length == 0) {
- a = null;
- }
- return a;
- }
-
- @Override
- public void checkAllKeys() {
- checkKeys(getKeyColumnInternal().getValues());
- }
-
- @Override
- public void checkAllActiveKeys() {
- checkKeys(getKeyColumnInternal().getValues(getActiveColumnInternal().findRows(true)));
- }
-
- @Override
- public void uncheckAllInactiveKeys() {
- checkKeys(getKeyColumnInternal().getValues(getActiveColumnInternal().findRows(false)));
- }
-
- @SuppressWarnings("unchecked")
- private IColumn<T> getKeyColumnInternal() {
- return getTable().getColumnSet().getColumn(0);
- }
-
- @SuppressWarnings("unchecked")
- private IColumn<String> getTextColumnInternal() {
- return getTable().getColumnSet().getColumn(1);
- }
-
- @SuppressWarnings("unchecked")
- private IColumn<Boolean> getActiveColumnInternal() {
- return getTable().getColumnSet().getColumn(2);
- }
-
- private void syncValueToTable() {
- if (m_valueTableSyncActive) {
- return;
- }
- try {
- m_valueTableSyncActive = true;
- getTable().setTableChanging(true);
- //
- T[] checkedKeys = getCheckedKeys();
- ITableRow[] checkedRows = getKeyColumnInternal().findRows(checkedKeys);
- for (ITableRow row : getTable().getRows()) {
- row.setChecked(false);
- }
- for (ITableRow row : checkedRows) {
- row.setChecked(true);
- }
- if (!getTable().isCheckable()) {
- getTable().selectRows(checkedRows, false);
- }
- }
- finally {
- getTable().setTableChanging(false);
- m_valueTableSyncActive = false;
- }
- }
-
- private void syncTableToValue() {
- if (m_valueTableSyncActive) {
- return;
- }
- try {
- m_valueTableSyncActive = true;
- m_table.setTableChanging(true);
- //
- ITableRow[] checkedRows;
- if (getTable().isCheckable()) {
- checkedRows = getTable().getCheckedRows();
- }
- else {
- checkedRows = getTable().getSelectedRows();
- }
- checkKeys(getKeyColumnInternal().getValues(checkedRows));
- if (!getTable().isCheckable()) {
- //checks follow selection
- for (ITableRow row : m_table.getRows()) {
- row.setChecked(row.isSelected());
- }
- }
- }
- finally {
- getTable().setTableChanging(false);
- m_valueTableSyncActive = false;
- }
- // check if row filter needs to change
- if (!m_table.getUIFacade().isUIProcessing()) {
- updateActiveRowsFilter();
- }
- updateCheckedRowsFilter();
- }
-
- /*
- * Implementation of ICompositeField
- */
-
- @Override
- @SuppressWarnings("unchecked")
- public <F extends IFormField> F getFieldByClass(final Class<F> c) {
- final Holder<IFormField> found = new Holder<IFormField>(IFormField.class);
- IFormFieldVisitor v = new IFormFieldVisitor() {
- @Override
- public boolean visitField(IFormField field, int level, int fieldIndex) {
- if (field.getClass() == c) {
- found.setValue(field);
- }
- return found.getValue() == null;
- }
- };
- visitFields(v, 0);
- return (F) found.getValue();
- }
-
- @Override
- public IFormField getFieldById(final String id) {
- final Holder<IFormField> found = new Holder<IFormField>(IFormField.class);
- IFormFieldVisitor v = new IFormFieldVisitor() {
- @Override
- public boolean visitField(IFormField field, int level, int fieldIndex) {
- if (field.getFieldId().equals(id)) {
- found.setValue(field);
- }
- return found.getValue() == null;
- }
- };
- visitFields(v, 0);
- return found.getValue();
- }
-
- @Override
- public <X extends IFormField> X getFieldById(final String id, final Class<X> type) {
- final Holder<X> found = new Holder<X>(type);
- IFormFieldVisitor v = new IFormFieldVisitor() {
- @Override
- @SuppressWarnings("unchecked")
- public boolean visitField(IFormField field, int level, int fieldIndex) {
- if (type.isAssignableFrom(field.getClass()) && field.getFieldId().equals(id)) {
- found.setValue((X) field);
- }
- return found.getValue() == null;
- }
- };
- visitFields(v, 0);
- return found.getValue();
- }
-
- @Override
- public int getFieldCount() {
- return m_fields.length;
- }
-
- @Override
- public int getFieldIndex(IFormField f) {
- for (int i = 0; i < m_fields.length; i++) {
- if (m_fields[i] == f) {
- return i;
- }
- }
- return -1;
- }
-
- @Override
- public IFormField[] getFields() {
- IFormField[] a = new IFormField[m_fields.length];
- System.arraycopy(m_fields, 0, a, 0, a.length);
- return a;
- }
-
- @Override
- public boolean visitFields(IFormFieldVisitor visitor, int startLevel) {
- // myself
- if (!visitor.visitField(this, startLevel, 0)) {
- return false;
- }
- // children
- int index = 0;
- IFormField[] f = m_fields;
- for (int i = 0; i < f.length; i++) {
- if (f[i] instanceof ICompositeField) {
- if (!((ICompositeField) f[i]).visitFields(visitor, startLevel + 1)) {
- return false;
- }
- }
- else {
- if (!visitor.visitField(f[i], startLevel, index)) {
- return false;
- }
- }
- index++;
- }
- return true;
- }
-
- @Override
- public final int getGridColumnCount() {
- return 1;
- }
-
- @Override
- public final int getGridRowCount() {
- return 1;
- }
-
- @Override
- public void rebuildFieldGrid() {
- GridData gd = getListBoxFilterBox().getGridDataHints();
- gd.x = 0;
- gd.y = 0;
- getListBoxFilterBox().setGridDataInternal(gd);
- }
-
- @Order(1)
- public class ListBoxFilterBox extends AbstractListBoxFilterBox {
- @Override
- protected IListBox getListBox() {
- return AbstractListBox.this;
- }
- }
-
- public class DefaultListBoxTable extends AbstractTable {
- @ConfigPropertyValue("true")
- @Override
- protected boolean getConfiguredAutoResizeColumns() {
- return true;
- }
-
- @ConfigPropertyValue("false")
- @Override
- protected boolean getConfiguredHeaderVisible() {
- return false;
- }
-
- @ConfigPropertyValue("false")
- @Override
- protected boolean getConfiguredMultiSelect() {
- return false;
- }
-
- @ConfigPropertyValue("true")
- @Override
- protected boolean getConfiguredCheckable() {
- return true;
- }
-
- public KeyColumn getKeyColumn() {
- return getColumnSet().getColumnByClass(KeyColumn.class);
- }
-
- public TextColumn getTextColumn() {
- return getColumnSet().getColumnByClass(TextColumn.class);
- }
-
- public ActiveColumn getActiveColumn() {
- return getColumnSet().getColumnByClass(ActiveColumn.class);
- }
-
- @Order(1)
- public class KeyColumn extends AbstractColumn<T> {
- @Override
- protected boolean getConfiguredPrimaryKey() {
- return true;
- }
-
- @Override
- protected boolean getConfiguredDisplayable() {
- return false;
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public Class<T> getDataType() {
- return TypeCastUtility.getGenericsParameterClass(AbstractListBox.this.getClass(), IListBox.class);
- }
- }
-
- @Order(2)
- public class TextColumn extends AbstractStringColumn {
-
- }
-
- @Order(3)
- public class ActiveColumn extends AbstractBooleanColumn {
- @Override
- protected boolean getConfiguredDisplayable() {
- return false;
- }
- }
- }
-
- /*
- * UI Notifications
- */
- protected class P_ListBoxUIFacade implements IListBoxUIFacade {
- }
-
- private class P_TableRowBuilder extends AbstractTableRowBuilder {
-
- @Override
- protected ITableRow createEmptyTableRow() {
- return new TableRow(getTable().getColumnSet());
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public ITableRow createTableRow(LookupRow dataRow) throws ProcessingException {
- TableRow tableRow = (TableRow) super.createTableRow(dataRow);
- // fill values to tableRow
- getKeyColumnInternal().setValue(tableRow, (T) dataRow.getKey());
- getTextColumnInternal().setValue(tableRow, dataRow.getText());
- getActiveColumnInternal().setValue(tableRow, dataRow.isActive());
-
- //enable/disabled row
- Cell cell = tableRow.getCellForUpdate(1);
- cell.setEnabled(dataRow.isEnabled());
-
- // hint for inactive codes
- if (!dataRow.isActive()) {
- if (cell.getFont() == null) {
- cell.setFont(FontSpec.parse("italic"));
- }
- getTextColumnInternal().setValue(tableRow, dataRow.getText() + " (" + ScoutTexts.get("InactiveState") + ")");
- }
- return tableRow;
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.listbox;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+
+import org.eclipse.scout.commons.ConfigurationUtility;
+import org.eclipse.scout.commons.TriState;
+import org.eclipse.scout.commons.TypeCastUtility;
+import org.eclipse.scout.commons.annotations.ConfigOperation;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.holders.Holder;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.services.lookup.FormFieldProvisioningContext;
+import org.eclipse.scout.rt.client.services.lookup.ILookupCallProvisioningService;
+import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
+import org.eclipse.scout.rt.client.ui.basic.cell.ICell;
+import org.eclipse.scout.rt.client.ui.basic.table.AbstractTable;
+import org.eclipse.scout.rt.client.ui.basic.table.AbstractTableRowBuilder;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRowFilter;
+import org.eclipse.scout.rt.client.ui.basic.table.TableAdapter;
+import org.eclipse.scout.rt.client.ui.basic.table.TableEvent;
+import org.eclipse.scout.rt.client.ui.basic.table.TableRow;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractBooleanColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractStringColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+import org.eclipse.scout.rt.client.ui.form.IFormFieldVisitor;
+import org.eclipse.scout.rt.client.ui.form.fields.AbstractValueField;
+import org.eclipse.scout.rt.client.ui.form.fields.GridData;
+import org.eclipse.scout.rt.client.ui.form.fields.ICompositeField;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.data.basic.FontSpec;
+import org.eclipse.scout.rt.shared.data.form.ValidationRule;
+import org.eclipse.scout.rt.shared.services.common.code.ICodeType;
+import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
+import org.eclipse.scout.rt.shared.services.lookup.CodeLookupCall;
+import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
+import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
+import org.eclipse.scout.service.SERVICES;
+
+public abstract class AbstractListBox<T> extends AbstractValueField<T[]> implements IListBox<T> {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractListBox.class);
+
+ private ITable m_table;
+ private IListBoxUIFacade m_uiFacade;
+ private LookupCall m_lookupCall;
+ private Class<? extends ICodeType> m_codeTypeClass;
+ private boolean m_valueTableSyncActive;
+ private ITableRowFilter m_checkedRowsFilter;
+ private ITableRowFilter m_activeRowsFilter;
+ // children
+ private IFormField[] m_fields;
+
+ public AbstractListBox() {
+ this(true);
+ }
+
+ public AbstractListBox(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ /*
+ * Configuration
+ */
+ @ConfigProperty(ConfigProperty.LOOKUP_CALL)
+ @Order(240)
+ @ConfigPropertyValue("null")
+ @ValidationRule(ValidationRule.LOOKUP_CALL)
+ protected Class<? extends LookupCall> getConfiguredLookupCall() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.CODE_TYPE)
+ @Order(250)
+ @ConfigPropertyValue("null")
+ @ValidationRule(ValidationRule.CODE_TYPE)
+ protected Class<? extends ICodeType> getConfiguredCodeType() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.ICON_ID)
+ @Order(230)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredIconId() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(260)
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredAutoLoad() {
+ return true;
+ }
+
+ /**
+ * @return true: a filter is added to the listbox table that only accepts rows
+ * that are active or checked.<br>
+ * Default is true<br>
+ * Affects {@link ITable#getFilteredRows()}
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(270)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredFilterActiveRows() {
+ return false;
+ }
+
+ /**
+ * @return true: a filter is added to the listbox table that only accepts
+ * checked rows<br>
+ * Default is false<br>
+ * Affects {@link ITable#getFilteredRows()}<br>
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(280)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredFilterCheckedRows() {
+ return false;
+ }
+
+ @Override
+ @ConfigPropertyValue("1.0")
+ protected double getConfiguredGridWeightY() {
+ return 1.0;
+ }
+
+ private Class<? extends IFormField>[] getConfiguredFields() {
+ Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
+ return ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, IFormField.class);
+ }
+
+ /**
+ * called before any lookup is performed
+ */
+ @ConfigOperation
+ @Order(250)
+ protected void execPrepareLookup(LookupCall call) throws ProcessingException {
+ }
+
+ /**
+ * @param call
+ * that produced this result
+ * @param result
+ * live list containing the result rows. Add, remove, set, replace
+ * and clear of entries in this list is supported
+ */
+ @ConfigOperation
+ @Order(260)
+ protected void execFilterLookupResult(LookupCall call, List<LookupRow> result) throws ProcessingException {
+ }
+
+ @ConfigOperation
+ @Order(230)
+ protected LookupRow[] execLoadTableData() throws ProcessingException {
+ LookupRow[] data;
+ // (1) get data by service
+ if (getLookupCall() != null) {
+ LookupCall call = SERVICES.getService(ILookupCallProvisioningService.class).newClonedInstance(getLookupCall(), new FormFieldProvisioningContext(AbstractListBox.this));
+ prepareLookupCall(call);
+ data = call.getDataByAll();
+ data = filterLookupResult(call, data);
+ }
+ // (b) get data direct
+ else {
+ data = new LookupRow[0];
+ data = filterLookupResult(null, data);
+ }
+ return data;
+ }
+
+ /**
+ * interceptor is called after data was fetched from LookupCall and is adding
+ * a table row for every LookupRow using IListBoxTable.createTableRow(row) and
+ * ITable.addRows()
+ * <p>
+ * For most cases the override of just {@link #execLoadTableData()} is sufficient
+ *
+ * <pre>
+ * LookupRow[] data=execLoadTableData();
+ * ITableRow[] rows=new ITableRow[data!=null? data.length : 0];
+ * if(data!=null){
+ * for(int i=0; i{@code<}data.length; i++){
+ * rows[i]=createTableRow(data[i]);
+ * }
+ * }
+ * getTable().replaceRows(rows);
+ * </pre>
+ */
+ @ConfigOperation
+ @Order(240)
+ protected void execPopulateTable() throws ProcessingException {
+ LookupRow[] data = null;
+ //sle Ticket 92'893: Listbox Master required. only run loadTable when master value is set
+ if (!isMasterRequired() || getMasterValue() != null) {
+ data = execLoadTableData();
+ }
+ ITableRow[] rows = new ITableRow[data != null ? data.length : 0];
+ if (data != null) {
+ for (int i = 0; i < data.length; i++) {
+ rows[i] = getTableRowBuilder().createTableRow(data[i]);
+ }
+ }
+ getTable().replaceRows(rows);
+ }
+
+ private Class<? extends ITable> getConfiguredTable() {
+ Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
+ Class<? extends ITable>[] f = ConfigurationUtility.filterClasses(dca, ITable.class);
+ if (f.length == 1) {
+ return f[0];
+ }
+ else {
+ for (Class<? extends ITable> c : f) {
+ if (c.getDeclaringClass() != AbstractListBox.class) {
+ return c;
+ }
+ }
+ return null;
+ }
+ }
+
+ @Override
+ protected void execChangedMasterValue(Object newMasterValue) throws ProcessingException {
+ setValue(null);
+ loadListBoxData();
+ }
+
+ @Override
+ protected void initConfig() {
+ m_uiFacade = createUIFacade();
+ m_fields = new IFormField[0];
+ super.initConfig();
+ setFilterActiveRows(getConfiguredFilterActiveRows());
+ setFilterActiveRowsValue(TriState.TRUE);
+ setFilterCheckedRows(getConfiguredFilterCheckedRows());
+ setFilterCheckedRowsValue(getConfiguredFilterCheckedRows());
+ try {
+ m_table = ConfigurationUtility.newInnerInstance(this, getConfiguredTable());
+ if (m_table instanceof AbstractTable) {
+ ((AbstractTable) m_table).setContainerInternal(this);
+ }
+ updateActiveRowsFilter();
+ updateCheckedRowsFilter();
+ m_table.addTableListener(new TableAdapter() {
+ @Override
+ public void tableChanged(TableEvent e) {
+ switch (e.getType()) {
+ case TableEvent.TYPE_ROWS_SELECTED: {
+ if (!getTable().isCheckable()) {
+ syncTableToValue();
+ }
+ break;
+ }
+ case TableEvent.TYPE_ROWS_UPDATED: {
+ if (getTable().isCheckable()) {
+ syncTableToValue();
+ }
+ break;
+ }
+ }
+ }
+ });
+ // default icon
+ if (m_table.getDefaultIconId() == null && this.getConfiguredIconId() != null) {
+ m_table.setDefaultIconId(this.getConfiguredIconId());
+ }
+ m_table.setEnabled(isEnabled());
+ }
+ catch (Exception e) {
+ LOG.warn(null, e);
+ }
+ // lookup call
+ if (getConfiguredLookupCall() != null) {
+ try {
+ LookupCall call = getConfiguredLookupCall().newInstance();
+ setLookupCall(call);
+ }
+ catch (Exception e) {
+ LOG.warn(null, e);
+ }
+ }
+ // code type
+ if (getConfiguredCodeType() != null) {
+ setCodeTypeClass(getConfiguredCodeType());
+ }
+ // local property listener
+ addPropertyChangeListener(new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent e) {
+ if (m_table != null) {
+ String name = e.getPropertyName();
+ if (PROP_ENABLED.equals(name)) {
+ m_table.setEnabled(isEnabled());
+ }
+ else if (PROP_FILTER_CHECKED_ROWS_VALUE.equals(name)) {
+ updateCheckedRowsFilter();
+ }
+ else if (PROP_FILTER_ACTIVE_ROWS_VALUE.equals(name)) {
+ updateActiveRowsFilter();
+ }
+ }
+ }
+ });
+ // add fields
+ ArrayList<IFormField> fieldList = new ArrayList<IFormField>();
+ Class<? extends IFormField>[] fieldArray = getConfiguredFields();
+ for (int i = 0; i < fieldArray.length; i++) {
+ IFormField f;
+ try {
+ f = ConfigurationUtility.newInnerInstance(this, fieldArray[i]);
+ fieldList.add(f);
+ }// end try
+ catch (Throwable t) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("field: " + fieldArray[i].getName(), t));
+ }
+ }
+ for (IFormField f : fieldList) {
+ f.setParentFieldInternal(this);
+ }
+ m_fields = fieldList.toArray(new IFormField[0]);
+ }
+
+ public ListBoxFilterBox getListBoxFilterBox() {
+ return getFieldByClass(ListBoxFilterBox.class);
+ }
+
+ @Override
+ protected void initFieldInternal() throws ProcessingException {
+ getTable().initTable();
+ if (getConfiguredAutoLoad()) {
+ try {
+ setValueChangeTriggerEnabled(false);
+ //
+ loadListBoxData();
+ }
+ finally {
+ setValueChangeTriggerEnabled(true);
+ }
+ }
+ super.initFieldInternal();
+ }
+
+ @Override
+ protected void disposeFieldInternal() {
+ super.disposeFieldInternal();
+ getTable().disposeTable();
+ }
+
+ public AbstractTableRowBuilder getTableRowBuilder() {
+ return new P_TableRowBuilder();
+ }
+
+ protected IListBoxUIFacade createUIFacade() {
+ return new P_ListBoxUIFacade();
+ }
+
+ @Override
+ public IListBoxUIFacade getUIFacade() {
+ return m_uiFacade;
+ }
+
+ @Override
+ public final ITable getTable() {
+ return m_table;
+ }
+
+ @Override
+ public boolean isFilterCheckedRows() {
+ return propertySupport.getPropertyBool(PROP_FILTER_CHECKED_ROWS);
+ }
+
+ @Override
+ public void setFilterCheckedRows(boolean b) {
+ propertySupport.setPropertyBool(PROP_FILTER_CHECKED_ROWS, b);
+ }
+
+ @Override
+ public boolean getFilterCheckedRowsValue() {
+ return propertySupport.getPropertyBool(PROP_FILTER_CHECKED_ROWS_VALUE);
+ }
+
+ @Override
+ public void setFilterCheckedRowsValue(boolean b) {
+ propertySupport.setPropertyBool(PROP_FILTER_CHECKED_ROWS_VALUE, b);
+ }
+
+ @Override
+ public boolean isFilterActiveRows() {
+ return propertySupport.getPropertyBool(PROP_FILTER_ACTIVE_ROWS);
+ }
+
+ @Override
+ public void setFilterActiveRows(boolean b) {
+ propertySupport.setPropertyBool(PROP_FILTER_ACTIVE_ROWS, b);
+ }
+
+ @Override
+ public TriState getFilterActiveRowsValue() {
+ return (TriState) propertySupport.getProperty(PROP_FILTER_ACTIVE_ROWS_VALUE);
+ }
+
+ @Override
+ public void setFilterActiveRowsValue(TriState t) {
+ if (t == null) {
+ t = TriState.TRUE;
+ }
+ propertySupport.setProperty(PROP_FILTER_ACTIVE_ROWS_VALUE, t);
+ }
+
+ private void updateActiveRowsFilter() {
+ try {
+ getTable().setTableChanging(true);
+ //
+ if (m_activeRowsFilter != null) {
+ getTable().removeRowFilter(m_activeRowsFilter);
+ m_activeRowsFilter = null;
+ }
+ m_activeRowsFilter = new ActiveOrCheckedRowsFilter(getActiveColumnInternal(), getFilterActiveRowsValue());
+ getTable().addRowFilter(m_activeRowsFilter);
+ }
+ finally {
+ getTable().setTableChanging(false);
+ }
+ }
+
+ private void updateCheckedRowsFilter() {
+ try {
+ getTable().setTableChanging(true);
+ //
+ if (m_checkedRowsFilter != null) {
+ getTable().removeRowFilter(m_checkedRowsFilter);
+ m_checkedRowsFilter = null;
+ }
+ if (getFilterCheckedRowsValue()) {
+ m_checkedRowsFilter = new CheckedRowsFilter();
+ getTable().addRowFilter(m_checkedRowsFilter);
+ }
+ }
+ finally {
+ getTable().setTableChanging(false);
+ }
+ }
+
+ @Override
+ public void loadListBoxData() throws ProcessingException {
+ if (getTable() != null) {
+ try {
+ m_valueTableSyncActive = true;
+ getTable().setTableChanging(true);
+ //
+ execPopulateTable();
+ }
+ finally {
+ getTable().setTableChanging(false);
+ m_valueTableSyncActive = false;
+ }
+ syncValueToTable();
+ }
+ }
+
+ /**
+ * do not use this internal method directly
+ */
+ @Override
+ public final void prepareLookupCall(LookupCall call) throws ProcessingException {
+ prepareLookupCallInternal(call);
+ execPrepareLookup(call);
+ }
+
+ private LookupRow[] filterLookupResult(LookupCall call, LookupRow[] data) throws ProcessingException {
+ ArrayList<LookupRow> result;
+ if (data != null) {
+ result = new ArrayList<LookupRow>(Arrays.asList(data));
+ }
+ else {
+ result = new ArrayList<LookupRow>();
+ }
+ execFilterLookupResult(call, result);
+ int len = 0;
+ for (LookupRow r : result) {
+ if (r != null) {
+ len++;
+ }
+ }
+ LookupRow[] a = new LookupRow[len];
+ int index = 0;
+ for (LookupRow r : result) {
+ if (r != null) {
+ a[index] = r;
+ index++;
+ }
+ }
+ return a;
+ }
+
+ /**
+ * do not use this internal method directly
+ */
+ private void prepareLookupCallInternal(LookupCall call) {
+ call.setActive(TriState.UNDEFINED);
+ //when there is a master value defined in the original call, don't set it to null when no master value is available
+ if (getMasterValue() != null || getLookupCall() == null || getLookupCall().getMaster() == null) {
+ call.setMaster(getMasterValue());
+ }
+ }
+
+ @Override
+ public final LookupCall getLookupCall() {
+ return m_lookupCall;
+ }
+
+ @Override
+ public void setLookupCall(LookupCall call) {
+ m_lookupCall = call;
+ }
+
+ @Override
+ public Class<? extends ICodeType> getCodeTypeClass() {
+ return m_codeTypeClass;
+ }
+
+ @Override
+ public void setCodeTypeClass(Class<? extends ICodeType> codeTypeClass) {
+ m_codeTypeClass = codeTypeClass;
+ // create lookup service call
+ m_lookupCall = null;
+ if (m_codeTypeClass != null) {
+ m_lookupCall = CodeLookupCall.newInstanceByService(m_codeTypeClass);
+ }
+ }
+
+ @Override
+ protected void valueChangedInternal() {
+ super.valueChangedInternal();
+ syncValueToTable();
+ }
+
+ @Override
+ protected String formatValueInternal(T[] validValue) {
+ if (validValue == null || validValue.length == 0) {
+ return "";
+ }
+ StringBuffer b = new StringBuffer();
+ ITableRow[] rows = getKeyColumnInternal().findRows(validValue);
+ for (int i = 0; i < rows.length; i++) {
+ if (i > 0) {
+ b.append(", ");
+ }
+ b.append(getTextColumnInternal().getValue(rows[i]));
+ }
+ return b.toString();
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ protected T[] validateValueInternal(T[] rawValue) throws ProcessingException {
+ T[] validValue = rawValue;
+ //
+ if (validValue != null && validValue.length == 0) {
+ validValue = null;
+ }
+ ITable table = getTable();
+ if (table != null && validValue != null) {
+ if ((table.isCheckable() && !table.isMultiCheck()) || (!table.isCheckable() && !table.isMultiSelect())) {
+ //only single value
+ if (validValue.length > 1) {
+ LOG.warn(getClass().getName() + " only accepts a single value. Got " + Arrays.toString(validValue) + ". Using only first value.");
+ T[] newArray = (T[]) Array.newInstance(validValue.getClass().getComponentType(), 1);
+ newArray[0] = validValue[0];
+ validValue = newArray;
+ }
+ }
+ }
+ return validValue;
+ }
+
+ @Override
+ public T getSingleValue() {
+ T[] a = getValue();
+ if (a != null && a.length > 0) {
+ return a[0];
+ }
+ else {
+ return null;
+ }
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public void setSingleValue(T value) {
+ if (value == null) {
+ setValue(null);
+ }
+ else {
+ T[] array = (T[]) Array.newInstance(getHolderType().getComponentType(), 1);
+ array[0] = value;
+ setValue(array);
+ }
+ }
+
+ @Override
+ public int getCheckedKeyCount() {
+ T[] keys = getValue();
+ if (keys != null) {
+ return keys.length;
+ }
+ else {
+ return 0;
+ }
+ }
+
+ @Override
+ public T getCheckedKey() {
+ T[] a = getCheckedKeys();
+ if (a != null && a.length > 0) {
+ return a[0];
+ }
+ else {
+ return null;
+ }
+ }
+
+ @Override
+ public T[] getCheckedKeys() {
+ return getValue();
+ }
+
+ @Override
+ public LookupRow getCheckedLookupRow() {
+ LookupRow[] a = getCheckedLookupRows();
+ if (a != null && a.length > 0) {
+ return a[0];
+ }
+ else {
+ return null;
+ }
+ }
+
+ @Override
+ public LookupRow[] getCheckedLookupRows() {
+ LookupRow[] lookupRows = null;
+ ITableRow[] tableRows = getTable().getCheckedRows();
+ if (tableRows != null) {
+ lookupRows = new LookupRow[tableRows.length];
+ for (int i = 0; i < tableRows.length; i++) {
+ ICell cell = tableRows[i].getCell(1);
+ lookupRows[i] = new LookupRow(tableRows[i].getCellValue(0), cell.getText(), cell.getIconId(), cell.getTooltipText(), cell.getBackgroundColor(), cell.getForegroundColor(), cell.getFont(), cell.isEnabled());
+ }
+ }
+ return lookupRows;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public void checkKey(T key) {
+ if (key == null) {
+ checkKeys(null);
+ }
+ else {
+ T[] array = (T[]) Array.newInstance(getHolderType().getComponentType(), 1);
+ array[0] = key;
+ checkKeys(array);
+ }
+ }
+
+ @Override
+ public void checkKeys(T[] keys) {
+ setValue(keys);
+ }
+
+ @Override
+ public void uncheckAllKeys() {
+ checkKeys(null);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public T[] getUncheckedKeys() {
+ HashSet<T> set = new HashSet<T>();
+ T[] a = getInitValue();
+ if (a != null) {
+ set.addAll(Arrays.asList(a));
+ }
+ a = getCheckedKeys();
+ if (a != null) {
+ set.removeAll(Arrays.asList(a));
+ }
+ T[] array = (T[]) Array.newInstance(getHolderType().getComponentType(), 0);
+ a = set.toArray(array);
+ if (a != null && a.length == 0) {
+ a = null;
+ }
+ return a;
+ }
+
+ @Override
+ public void checkAllKeys() {
+ checkKeys(getKeyColumnInternal().getValues());
+ }
+
+ @Override
+ public void checkAllActiveKeys() {
+ checkKeys(getKeyColumnInternal().getValues(getActiveColumnInternal().findRows(true)));
+ }
+
+ @Override
+ public void uncheckAllInactiveKeys() {
+ checkKeys(getKeyColumnInternal().getValues(getActiveColumnInternal().findRows(false)));
+ }
+
+ @SuppressWarnings("unchecked")
+ private IColumn<T> getKeyColumnInternal() {
+ return getTable().getColumnSet().getColumn(0);
+ }
+
+ @SuppressWarnings("unchecked")
+ private IColumn<String> getTextColumnInternal() {
+ return getTable().getColumnSet().getColumn(1);
+ }
+
+ @SuppressWarnings("unchecked")
+ private IColumn<Boolean> getActiveColumnInternal() {
+ return getTable().getColumnSet().getColumn(2);
+ }
+
+ private void syncValueToTable() {
+ if (m_valueTableSyncActive) {
+ return;
+ }
+ try {
+ m_valueTableSyncActive = true;
+ getTable().setTableChanging(true);
+ //
+ T[] checkedKeys = getCheckedKeys();
+ ITableRow[] checkedRows = getKeyColumnInternal().findRows(checkedKeys);
+ for (ITableRow row : getTable().getRows()) {
+ row.setChecked(false);
+ }
+ for (ITableRow row : checkedRows) {
+ row.setChecked(true);
+ }
+ if (!getTable().isCheckable()) {
+ getTable().selectRows(checkedRows, false);
+ }
+ }
+ finally {
+ getTable().setTableChanging(false);
+ m_valueTableSyncActive = false;
+ }
+ }
+
+ private void syncTableToValue() {
+ if (m_valueTableSyncActive) {
+ return;
+ }
+ try {
+ m_valueTableSyncActive = true;
+ m_table.setTableChanging(true);
+ //
+ ITableRow[] checkedRows;
+ if (getTable().isCheckable()) {
+ checkedRows = getTable().getCheckedRows();
+ }
+ else {
+ checkedRows = getTable().getSelectedRows();
+ }
+ checkKeys(getKeyColumnInternal().getValues(checkedRows));
+ if (!getTable().isCheckable()) {
+ //checks follow selection
+ for (ITableRow row : m_table.getRows()) {
+ row.setChecked(row.isSelected());
+ }
+ }
+ }
+ finally {
+ getTable().setTableChanging(false);
+ m_valueTableSyncActive = false;
+ }
+ // check if row filter needs to change
+ if (!m_table.getUIFacade().isUIProcessing()) {
+ updateActiveRowsFilter();
+ }
+ updateCheckedRowsFilter();
+ }
+
+ /*
+ * Implementation of ICompositeField
+ */
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public <F extends IFormField> F getFieldByClass(final Class<F> c) {
+ final Holder<IFormField> found = new Holder<IFormField>(IFormField.class);
+ IFormFieldVisitor v = new IFormFieldVisitor() {
+ @Override
+ public boolean visitField(IFormField field, int level, int fieldIndex) {
+ if (field.getClass() == c) {
+ found.setValue(field);
+ }
+ return found.getValue() == null;
+ }
+ };
+ visitFields(v, 0);
+ return (F) found.getValue();
+ }
+
+ @Override
+ public IFormField getFieldById(final String id) {
+ final Holder<IFormField> found = new Holder<IFormField>(IFormField.class);
+ IFormFieldVisitor v = new IFormFieldVisitor() {
+ @Override
+ public boolean visitField(IFormField field, int level, int fieldIndex) {
+ if (field.getFieldId().equals(id)) {
+ found.setValue(field);
+ }
+ return found.getValue() == null;
+ }
+ };
+ visitFields(v, 0);
+ return found.getValue();
+ }
+
+ @Override
+ public <X extends IFormField> X getFieldById(final String id, final Class<X> type) {
+ final Holder<X> found = new Holder<X>(type);
+ IFormFieldVisitor v = new IFormFieldVisitor() {
+ @Override
+ @SuppressWarnings("unchecked")
+ public boolean visitField(IFormField field, int level, int fieldIndex) {
+ if (type.isAssignableFrom(field.getClass()) && field.getFieldId().equals(id)) {
+ found.setValue((X) field);
+ }
+ return found.getValue() == null;
+ }
+ };
+ visitFields(v, 0);
+ return found.getValue();
+ }
+
+ @Override
+ public int getFieldCount() {
+ return m_fields.length;
+ }
+
+ @Override
+ public int getFieldIndex(IFormField f) {
+ for (int i = 0; i < m_fields.length; i++) {
+ if (m_fields[i] == f) {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+ @Override
+ public IFormField[] getFields() {
+ IFormField[] a = new IFormField[m_fields.length];
+ System.arraycopy(m_fields, 0, a, 0, a.length);
+ return a;
+ }
+
+ @Override
+ public boolean visitFields(IFormFieldVisitor visitor, int startLevel) {
+ // myself
+ if (!visitor.visitField(this, startLevel, 0)) {
+ return false;
+ }
+ // children
+ int index = 0;
+ IFormField[] f = m_fields;
+ for (int i = 0; i < f.length; i++) {
+ if (f[i] instanceof ICompositeField) {
+ if (!((ICompositeField) f[i]).visitFields(visitor, startLevel + 1)) {
+ return false;
+ }
+ }
+ else {
+ if (!visitor.visitField(f[i], startLevel, index)) {
+ return false;
+ }
+ }
+ index++;
+ }
+ return true;
+ }
+
+ @Override
+ public final int getGridColumnCount() {
+ return 1;
+ }
+
+ @Override
+ public final int getGridRowCount() {
+ return 1;
+ }
+
+ @Override
+ public void rebuildFieldGrid() {
+ GridData gd = getListBoxFilterBox().getGridDataHints();
+ gd.x = 0;
+ gd.y = 0;
+ getListBoxFilterBox().setGridDataInternal(gd);
+ }
+
+ @Order(1)
+ public class ListBoxFilterBox extends AbstractListBoxFilterBox {
+ @Override
+ protected IListBox getListBox() {
+ return AbstractListBox.this;
+ }
+ }
+
+ public class DefaultListBoxTable extends AbstractTable {
+ @ConfigPropertyValue("true")
+ @Override
+ protected boolean getConfiguredAutoResizeColumns() {
+ return true;
+ }
+
+ @ConfigPropertyValue("false")
+ @Override
+ protected boolean getConfiguredHeaderVisible() {
+ return false;
+ }
+
+ @ConfigPropertyValue("false")
+ @Override
+ protected boolean getConfiguredMultiSelect() {
+ return false;
+ }
+
+ @ConfigPropertyValue("true")
+ @Override
+ protected boolean getConfiguredCheckable() {
+ return true;
+ }
+
+ public KeyColumn getKeyColumn() {
+ return getColumnSet().getColumnByClass(KeyColumn.class);
+ }
+
+ public TextColumn getTextColumn() {
+ return getColumnSet().getColumnByClass(TextColumn.class);
+ }
+
+ public ActiveColumn getActiveColumn() {
+ return getColumnSet().getColumnByClass(ActiveColumn.class);
+ }
+
+ @Order(1)
+ public class KeyColumn extends AbstractColumn<T> {
+ @Override
+ protected boolean getConfiguredPrimaryKey() {
+ return true;
+ }
+
+ @Override
+ protected boolean getConfiguredDisplayable() {
+ return false;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Class<T> getDataType() {
+ return TypeCastUtility.getGenericsParameterClass(AbstractListBox.this.getClass(), IListBox.class);
+ }
+ }
+
+ @Order(2)
+ public class TextColumn extends AbstractStringColumn {
+
+ }
+
+ @Order(3)
+ public class ActiveColumn extends AbstractBooleanColumn {
+ @Override
+ protected boolean getConfiguredDisplayable() {
+ return false;
+ }
+ }
+ }
+
+ /*
+ * UI Notifications
+ */
+ protected class P_ListBoxUIFacade implements IListBoxUIFacade {
+ }
+
+ private class P_TableRowBuilder extends AbstractTableRowBuilder {
+
+ @Override
+ protected ITableRow createEmptyTableRow() {
+ return new TableRow(getTable().getColumnSet());
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public ITableRow createTableRow(LookupRow dataRow) throws ProcessingException {
+ TableRow tableRow = (TableRow) super.createTableRow(dataRow);
+ // fill values to tableRow
+ getKeyColumnInternal().setValue(tableRow, (T) dataRow.getKey());
+ getTextColumnInternal().setValue(tableRow, dataRow.getText());
+ getActiveColumnInternal().setValue(tableRow, dataRow.isActive());
+
+ //enable/disabled row
+ Cell cell = tableRow.getCellForUpdate(1);
+ cell.setEnabled(dataRow.isEnabled());
+
+ // hint for inactive codes
+ if (!dataRow.isActive()) {
+ if (cell.getFont() == null) {
+ cell.setFont(FontSpec.parse("italic"));
+ }
+ getTextColumnInternal().setValue(tableRow, dataRow.getText() + " (" + ScoutTexts.get("InactiveState") + ")");
+ }
+ return tableRow;
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/listbox/AbstractListBoxFilterBox.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/listbox/AbstractListBoxFilterBox.java
index 5009a0cb40..861f60ec90 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/listbox/AbstractListBoxFilterBox.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/listbox/AbstractListBoxFilterBox.java
@@ -1,348 +1,348 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.listbox;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-
-import org.eclipse.scout.commons.OptimisticLock;
-import org.eclipse.scout.commons.TriState;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractButton;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
-import org.eclipse.scout.rt.client.ui.form.fields.radiobuttongroup.AbstractRadioButtonGroup;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.services.common.jdbc.SearchFilter;
-
-/**
- * Filter panel normally displayed in the ui (swing, swt) below the listbox
- * table. Showing 2 radio button groups, one for checked filter, one for active
- * filter.
- * o show checked o show all
- * o show active o show inactive o show all
- */
-public abstract class AbstractListBoxFilterBox extends AbstractGroupBox {
- private final OptimisticLock m_listBoxSyncLock;
- private PropertyChangeListener m_listBoxPropertyListener;
-
- public AbstractListBoxFilterBox() {
- this(true);
- }
-
- public AbstractListBoxFilterBox(boolean callInitializer) {
- super(callInitializer);
- m_listBoxSyncLock = new OptimisticLock();
- }
-
- protected abstract IListBox getListBox();
-
- @Override
- protected boolean getConfiguredBorderVisible() {
- return false;
- }
-
- @Override
- protected int getConfiguredGridColumnCount() {
- return 1;
- }
-
- @Override
- protected void execInitField() throws ProcessingException {
- if (m_listBoxPropertyListener == null) {
- m_listBoxPropertyListener = new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent e) {
- String name = e.getPropertyName();
- if (IListBox.PROP_FILTER_CHECKED_ROWS.equals(name)) {
- updateVisibilities();
- }
- else if (IListBox.PROP_FILTER_ACTIVE_ROWS.equals(name)) {
- updateVisibilities();
- }
- else if (IListBox.PROP_FILTER_CHECKED_ROWS_VALUE.equals(name)) {
- try {
- if (m_listBoxSyncLock.acquire()) {
- getCheckedStateRadioButtonGroup().setValue(getListBox().getFilterCheckedRowsValue());
- }
- }
- finally {
- m_listBoxSyncLock.release();
- }
- }
- else if (IListBox.PROP_FILTER_ACTIVE_ROWS_VALUE.equals(name)) {
- try {
- if (m_listBoxSyncLock.acquire()) {
- getActiveStateRadioButtonGroup().setValue(getListBox().getFilterActiveRowsValue());
- }
- }
- finally {
- m_listBoxSyncLock.release();
- }
- }
- }
- };
- getListBox().addPropertyChangeListener(m_listBoxPropertyListener);
- }
- try {
- m_listBoxSyncLock.acquire();
- //
- updateVisibilities();
- getCheckedStateRadioButtonGroup().setValue(getListBox().getFilterCheckedRowsValue());
- getActiveStateRadioButtonGroup().setValue(getListBox().getFilterActiveRowsValue());
- }
- finally {
- m_listBoxSyncLock.release();
- }
- }
-
- protected void updateVisibilities() {
- this.setVisible(getListBox().isFilterCheckedRows() || getListBox().isFilterActiveRows());
- getCheckedStateRadioButtonGroup().setVisible(getListBox().isFilterCheckedRows());
- getActiveStateRadioButtonGroup().setVisible(getListBox().isFilterActiveRows());
- }
-
- @Override
- protected void execDisposeField() throws ProcessingException {
- if (m_listBoxPropertyListener != null) {
- getListBox().removePropertyChangeListener(m_listBoxPropertyListener);
- m_listBoxPropertyListener = null;
- }
- }
-
- @Order(10)
- public class CheckedStateRadioButtonGroup extends AbstractRadioButtonGroup<Boolean> {
-
- @Override
- protected boolean getConfiguredLabelVisible() {
- return false;
- }
-
- @Override
- protected boolean execIsEmpty() throws ProcessingException {
- return true;
- }
-
- @Override
- protected boolean execIsSaveNeeded() throws ProcessingException {
- return false;
- }
-
- @Override
- protected void execAddSearchTerms(SearchFilter search) {
- //nop
- }
-
- @Override
- protected void execChangedValue() throws ProcessingException {
- try {
- if (m_listBoxSyncLock.acquire()) {
- Boolean b = getCheckedStateRadioButtonGroup().getValue();
- getListBox().setFilterCheckedRowsValue(b != null && b);
- }
- }
- finally {
- m_listBoxSyncLock.release();
- }
- }
-
- @Order(10)
- public class CheckedButton extends AbstractButton {
-
- @Override
- protected void execAddSearchTerms(SearchFilter search) {
- //nop
- }
-
- @Override
- protected int getConfiguredDisplayStyle() {
- return DISPLAY_STYLE_RADIO;
- }
-
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("SelectedStates");
- }
-
- @Override
- protected Object getConfiguredRadioValue() {
- return true;
- }
-
- @Override
- protected boolean getConfiguredGridUseUiHeight() {
- return true;
- }
- }
-
- @Order(20)
- public class AllButton extends AbstractButton {
-
- @Override
- protected void execAddSearchTerms(SearchFilter search) {
- //nop
- }
-
- @Override
- protected int getConfiguredDisplayStyle() {
- return DISPLAY_STYLE_RADIO;
- }
-
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("AllStates");
- }
-
- @Override
- protected Object getConfiguredRadioValue() {
- return false;
- }
-
- @Override
- protected boolean getConfiguredGridUseUiHeight() {
- return true;
- }
- }
-
- }
-
- @Order(20)
- public class ActiveStateRadioButtonGroup extends AbstractRadioButtonGroup<TriState> {
-
- @Override
- protected boolean getConfiguredLabelVisible() {
- return false;
- }
-
- @Override
- protected boolean execIsEmpty() throws ProcessingException {
- return true;
- }
-
- @Override
- protected boolean execIsSaveNeeded() throws ProcessingException {
- return false;
- }
-
- @Override
- protected void execAddSearchTerms(SearchFilter search) {
- //nop
- }
-
- @Override
- protected void execChangedValue() throws ProcessingException {
- try {
- if (m_listBoxSyncLock.acquire()) {
- getListBox().setFilterActiveRowsValue(getActiveStateRadioButtonGroup().getValue());
- }
- }
- finally {
- m_listBoxSyncLock.release();
- }
- }
-
- @Order(10)
- public class ActiveButton extends AbstractButton {
-
- @Override
- protected void execAddSearchTerms(SearchFilter search) {
- //nop
- }
-
- @Override
- protected int getConfiguredDisplayStyle() {
- return DISPLAY_STYLE_RADIO;
- }
-
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("ActiveStates");
- }
-
- @Override
- protected Object getConfiguredRadioValue() {
- return TriState.TRUE;
- }
-
- @Override
- protected boolean getConfiguredGridUseUiHeight() {
- return true;
- }
- }
-
- @Order(20)
- public class InactiveButton extends AbstractButton {
-
- @Override
- protected void execAddSearchTerms(SearchFilter search) {
- //nop
- }
-
- @Override
- protected int getConfiguredDisplayStyle() {
- return DISPLAY_STYLE_RADIO;
- }
-
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("InactiveStates");
- }
-
- @Override
- protected Object getConfiguredRadioValue() {
- return TriState.FALSE;
- }
-
- @Override
- protected boolean getConfiguredGridUseUiHeight() {
- return true;
- }
- }
-
- @Order(30)
- public class ActiveAndInactiveButton extends AbstractButton {
-
- @Override
- protected void execAddSearchTerms(SearchFilter search) {
- //nop
- }
-
- @Override
- protected int getConfiguredDisplayStyle() {
- return DISPLAY_STYLE_RADIO;
- }
-
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("ActiveAndInactiveStates");
- }
-
- @Override
- protected Object getConfiguredRadioValue() {
- return TriState.UNDEFINED;
- }
-
- @Override
- protected boolean getConfiguredGridUseUiHeight() {
- return true;
- }
- }
- }
-
- public ActiveStateRadioButtonGroup getActiveStateRadioButtonGroup() {
- return getFieldByClass(ActiveStateRadioButtonGroup.class);
- }
-
- public CheckedStateRadioButtonGroup getCheckedStateRadioButtonGroup() {
- return getFieldByClass(CheckedStateRadioButtonGroup.class);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.listbox;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import org.eclipse.scout.commons.OptimisticLock;
+import org.eclipse.scout.commons.TriState;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractButton;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
+import org.eclipse.scout.rt.client.ui.form.fields.radiobuttongroup.AbstractRadioButtonGroup;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.services.common.jdbc.SearchFilter;
+
+/**
+ * Filter panel normally displayed in the ui (swing, swt) below the listbox
+ * table. Showing 2 radio button groups, one for checked filter, one for active
+ * filter.
+ * o show checked o show all
+ * o show active o show inactive o show all
+ */
+public abstract class AbstractListBoxFilterBox extends AbstractGroupBox {
+ private final OptimisticLock m_listBoxSyncLock;
+ private PropertyChangeListener m_listBoxPropertyListener;
+
+ public AbstractListBoxFilterBox() {
+ this(true);
+ }
+
+ public AbstractListBoxFilterBox(boolean callInitializer) {
+ super(callInitializer);
+ m_listBoxSyncLock = new OptimisticLock();
+ }
+
+ protected abstract IListBox getListBox();
+
+ @Override
+ protected boolean getConfiguredBorderVisible() {
+ return false;
+ }
+
+ @Override
+ protected int getConfiguredGridColumnCount() {
+ return 1;
+ }
+
+ @Override
+ protected void execInitField() throws ProcessingException {
+ if (m_listBoxPropertyListener == null) {
+ m_listBoxPropertyListener = new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent e) {
+ String name = e.getPropertyName();
+ if (IListBox.PROP_FILTER_CHECKED_ROWS.equals(name)) {
+ updateVisibilities();
+ }
+ else if (IListBox.PROP_FILTER_ACTIVE_ROWS.equals(name)) {
+ updateVisibilities();
+ }
+ else if (IListBox.PROP_FILTER_CHECKED_ROWS_VALUE.equals(name)) {
+ try {
+ if (m_listBoxSyncLock.acquire()) {
+ getCheckedStateRadioButtonGroup().setValue(getListBox().getFilterCheckedRowsValue());
+ }
+ }
+ finally {
+ m_listBoxSyncLock.release();
+ }
+ }
+ else if (IListBox.PROP_FILTER_ACTIVE_ROWS_VALUE.equals(name)) {
+ try {
+ if (m_listBoxSyncLock.acquire()) {
+ getActiveStateRadioButtonGroup().setValue(getListBox().getFilterActiveRowsValue());
+ }
+ }
+ finally {
+ m_listBoxSyncLock.release();
+ }
+ }
+ }
+ };
+ getListBox().addPropertyChangeListener(m_listBoxPropertyListener);
+ }
+ try {
+ m_listBoxSyncLock.acquire();
+ //
+ updateVisibilities();
+ getCheckedStateRadioButtonGroup().setValue(getListBox().getFilterCheckedRowsValue());
+ getActiveStateRadioButtonGroup().setValue(getListBox().getFilterActiveRowsValue());
+ }
+ finally {
+ m_listBoxSyncLock.release();
+ }
+ }
+
+ protected void updateVisibilities() {
+ this.setVisible(getListBox().isFilterCheckedRows() || getListBox().isFilterActiveRows());
+ getCheckedStateRadioButtonGroup().setVisible(getListBox().isFilterCheckedRows());
+ getActiveStateRadioButtonGroup().setVisible(getListBox().isFilterActiveRows());
+ }
+
+ @Override
+ protected void execDisposeField() throws ProcessingException {
+ if (m_listBoxPropertyListener != null) {
+ getListBox().removePropertyChangeListener(m_listBoxPropertyListener);
+ m_listBoxPropertyListener = null;
+ }
+ }
+
+ @Order(10)
+ public class CheckedStateRadioButtonGroup extends AbstractRadioButtonGroup<Boolean> {
+
+ @Override
+ protected boolean getConfiguredLabelVisible() {
+ return false;
+ }
+
+ @Override
+ protected boolean execIsEmpty() throws ProcessingException {
+ return true;
+ }
+
+ @Override
+ protected boolean execIsSaveNeeded() throws ProcessingException {
+ return false;
+ }
+
+ @Override
+ protected void execAddSearchTerms(SearchFilter search) {
+ //nop
+ }
+
+ @Override
+ protected void execChangedValue() throws ProcessingException {
+ try {
+ if (m_listBoxSyncLock.acquire()) {
+ Boolean b = getCheckedStateRadioButtonGroup().getValue();
+ getListBox().setFilterCheckedRowsValue(b != null && b);
+ }
+ }
+ finally {
+ m_listBoxSyncLock.release();
+ }
+ }
+
+ @Order(10)
+ public class CheckedButton extends AbstractButton {
+
+ @Override
+ protected void execAddSearchTerms(SearchFilter search) {
+ //nop
+ }
+
+ @Override
+ protected int getConfiguredDisplayStyle() {
+ return DISPLAY_STYLE_RADIO;
+ }
+
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("SelectedStates");
+ }
+
+ @Override
+ protected Object getConfiguredRadioValue() {
+ return true;
+ }
+
+ @Override
+ protected boolean getConfiguredGridUseUiHeight() {
+ return true;
+ }
+ }
+
+ @Order(20)
+ public class AllButton extends AbstractButton {
+
+ @Override
+ protected void execAddSearchTerms(SearchFilter search) {
+ //nop
+ }
+
+ @Override
+ protected int getConfiguredDisplayStyle() {
+ return DISPLAY_STYLE_RADIO;
+ }
+
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("AllStates");
+ }
+
+ @Override
+ protected Object getConfiguredRadioValue() {
+ return false;
+ }
+
+ @Override
+ protected boolean getConfiguredGridUseUiHeight() {
+ return true;
+ }
+ }
+
+ }
+
+ @Order(20)
+ public class ActiveStateRadioButtonGroup extends AbstractRadioButtonGroup<TriState> {
+
+ @Override
+ protected boolean getConfiguredLabelVisible() {
+ return false;
+ }
+
+ @Override
+ protected boolean execIsEmpty() throws ProcessingException {
+ return true;
+ }
+
+ @Override
+ protected boolean execIsSaveNeeded() throws ProcessingException {
+ return false;
+ }
+
+ @Override
+ protected void execAddSearchTerms(SearchFilter search) {
+ //nop
+ }
+
+ @Override
+ protected void execChangedValue() throws ProcessingException {
+ try {
+ if (m_listBoxSyncLock.acquire()) {
+ getListBox().setFilterActiveRowsValue(getActiveStateRadioButtonGroup().getValue());
+ }
+ }
+ finally {
+ m_listBoxSyncLock.release();
+ }
+ }
+
+ @Order(10)
+ public class ActiveButton extends AbstractButton {
+
+ @Override
+ protected void execAddSearchTerms(SearchFilter search) {
+ //nop
+ }
+
+ @Override
+ protected int getConfiguredDisplayStyle() {
+ return DISPLAY_STYLE_RADIO;
+ }
+
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("ActiveStates");
+ }
+
+ @Override
+ protected Object getConfiguredRadioValue() {
+ return TriState.TRUE;
+ }
+
+ @Override
+ protected boolean getConfiguredGridUseUiHeight() {
+ return true;
+ }
+ }
+
+ @Order(20)
+ public class InactiveButton extends AbstractButton {
+
+ @Override
+ protected void execAddSearchTerms(SearchFilter search) {
+ //nop
+ }
+
+ @Override
+ protected int getConfiguredDisplayStyle() {
+ return DISPLAY_STYLE_RADIO;
+ }
+
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("InactiveStates");
+ }
+
+ @Override
+ protected Object getConfiguredRadioValue() {
+ return TriState.FALSE;
+ }
+
+ @Override
+ protected boolean getConfiguredGridUseUiHeight() {
+ return true;
+ }
+ }
+
+ @Order(30)
+ public class ActiveAndInactiveButton extends AbstractButton {
+
+ @Override
+ protected void execAddSearchTerms(SearchFilter search) {
+ //nop
+ }
+
+ @Override
+ protected int getConfiguredDisplayStyle() {
+ return DISPLAY_STYLE_RADIO;
+ }
+
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("ActiveAndInactiveStates");
+ }
+
+ @Override
+ protected Object getConfiguredRadioValue() {
+ return TriState.UNDEFINED;
+ }
+
+ @Override
+ protected boolean getConfiguredGridUseUiHeight() {
+ return true;
+ }
+ }
+ }
+
+ public ActiveStateRadioButtonGroup getActiveStateRadioButtonGroup() {
+ return getFieldByClass(ActiveStateRadioButtonGroup.class);
+ }
+
+ public CheckedStateRadioButtonGroup getCheckedStateRadioButtonGroup() {
+ return getFieldByClass(CheckedStateRadioButtonGroup.class);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/listbox/ActiveOrCheckedRowsFilter.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/listbox/ActiveOrCheckedRowsFilter.java
index 9b7be119cb..98bffafa99 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/listbox/ActiveOrCheckedRowsFilter.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/listbox/ActiveOrCheckedRowsFilter.java
@@ -1,43 +1,43 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.listbox;
-
-import org.eclipse.scout.commons.TriState;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-
-/**
- * The filter accepts all active rows and in addition all checked rows
- */
-class ActiveOrCheckedRowsFilter extends CheckedRowsFilter {
- private final IColumn<Boolean> m_activeCol;
- private final TriState m_filterValue;
-
- public ActiveOrCheckedRowsFilter(IColumn<Boolean> activeCol, TriState filterValue) {
- m_activeCol = activeCol;
- m_filterValue = filterValue;
- }
-
- @Override
- public boolean accept(ITableRow row) {
- Boolean active = m_activeCol.getValue(row);
- // active
- if (active != null) {
- Boolean b = m_filterValue.getBooleanValue();
- if (b != null && b != active) {
- // active mismatch, check checked
- return super.accept(row);
- }
- }
- return true;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.listbox;
+
+import org.eclipse.scout.commons.TriState;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+
+/**
+ * The filter accepts all active rows and in addition all checked rows
+ */
+class ActiveOrCheckedRowsFilter extends CheckedRowsFilter {
+ private final IColumn<Boolean> m_activeCol;
+ private final TriState m_filterValue;
+
+ public ActiveOrCheckedRowsFilter(IColumn<Boolean> activeCol, TriState filterValue) {
+ m_activeCol = activeCol;
+ m_filterValue = filterValue;
+ }
+
+ @Override
+ public boolean accept(ITableRow row) {
+ Boolean active = m_activeCol.getValue(row);
+ // active
+ if (active != null) {
+ Boolean b = m_filterValue.getBooleanValue();
+ if (b != null && b != active) {
+ // active mismatch, check checked
+ return super.accept(row);
+ }
+ }
+ return true;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/listbox/CheckedRowsFilter.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/listbox/CheckedRowsFilter.java
index 19d407bdc5..dcc305366f 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/listbox/CheckedRowsFilter.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/listbox/CheckedRowsFilter.java
@@ -1,32 +1,32 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.listbox;
-
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRowFilter;
-
-/**
- * The filter accepts all checked rows
- */
-class CheckedRowsFilter implements ITableRowFilter {
-
- public CheckedRowsFilter() {
- }
-
- @Override
- public boolean accept(ITableRow row) {
- if (row.isChecked()) {
- return true;
- }
- return false;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.listbox;
+
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRowFilter;
+
+/**
+ * The filter accepts all checked rows
+ */
+class CheckedRowsFilter implements ITableRowFilter {
+
+ public CheckedRowsFilter() {
+ }
+
+ @Override
+ public boolean accept(ITableRow row) {
+ if (row.isChecked()) {
+ return true;
+ }
+ return false;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/listbox/IListBox.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/listbox/IListBox.java
index aaf30ee589..bd94415af3 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/listbox/IListBox.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/listbox/IListBox.java
@@ -1,165 +1,165 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.listbox;
-
-import org.eclipse.scout.commons.TriState;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.form.fields.ICompositeField;
-import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
-import org.eclipse.scout.rt.shared.services.common.code.ICodeType;
-import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
-import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
-
-/**
- * A listbox contains at least 3 columns, where index 0 is the key column, index
- * 1 is the text column and index 2 is the active-flag column
- * <p>
- * The listbox value is a Object[] where the Object[] is the set of checked keys of the listbox<br>
- * the inner table shows those rows as checked which have the key value as a part of the listbox value (Object[])
- * <p>
- * Note, that the listbox might not necessarily show all checked rows since the value of the listbox might contain
- * inactive keys that are not reflected in the listbox<br>
- * Therefore an empty listbox table is not the same as a listbox with an empty value (null)
- */
-public interface IListBox<T> extends IValueField<T[]>, ICompositeField {
-
- /**
- * {@link boolean}
- */
- String PROP_FILTER_CHECKED_ROWS = "filterCheckedRows";
- /**
- * {@link boolean}
- */
- String PROP_FILTER_ACTIVE_ROWS = "filterActiveRows";
- /**
- * {@link boolean}
- */
- String PROP_FILTER_CHECKED_ROWS_VALUE = "filterCheckedRowsValue";
- /**
- * {@link TriState}
- */
- String PROP_FILTER_ACTIVE_ROWS_VALUE = "filterActiveRowsValue";
-
- ITable getTable();
-
- IListBoxUIFacade getUIFacade();
-
- /**
- * @return true: a filter is added to the listbox table that only accepts
- * checked rows<br>
- * Affects {@link ITable#getFilteredRows()}<br>
- * see also {@link #getFilterCheckedRowsValue()} and {@link #setFilterCheckedRows(boolean)}
- */
- boolean isFilterCheckedRows();
-
- /**
- * see {@link #isFilterCheckedRows()}
- */
- void setFilterCheckedRows(boolean b);
-
- boolean getFilterCheckedRowsValue();
-
- void setFilterCheckedRowsValue(boolean b);
-
- /**
- * @return true: a filter is added to the listbox table that only accepts rows
- * that are active or checked.<br>
- * Affects {@link ITable#getFilteredRows()}<br>
- * see also {@link #getActiveFilter()} and {@link #setActiveFilter(TriState)}
- */
- boolean isFilterActiveRows();
-
- /**
- * see {@link #isFilterActiveRows()}<br>
- * see also {@link #getFilterActiveRowsValue()} and {@link #setFilterActiveRowsValue(TriState)}
- */
- void setFilterActiveRows(boolean b);
-
- TriState getFilterActiveRowsValue();
-
- void setFilterActiveRowsValue(TriState t);
-
- void prepareLookupCall(LookupCall call) throws ProcessingException;
-
- /**
- * Populate table with data from data service<br>
- * all existing data in the table is discarded
- *
- * @see execFilterTableRow
- */
- void loadListBoxData() throws ProcessingException;
-
- LookupCall getLookupCall();
-
- void setLookupCall(LookupCall call);
-
- Class<? extends ICodeType> getCodeTypeClass();
-
- void setCodeTypeClass(Class<? extends ICodeType> codeTypeClass);
-
- /**
- * Convenience for getting the first value of {@link #getValue()}
- *
- * @return the first selected/checked value if any
- * <p>
- * By default a listbox is checkable, so its value is the array of all checked keys
- * <p>
- * When it is made non-checkable, its value is the array of all selected keys
- */
- T getSingleValue();
-
- /**
- * Convenience for setting a single value with {@link #setValue(Object)}
- */
- void setSingleValue(T value);
-
- int getCheckedKeyCount();
-
- T getCheckedKey();
-
- T[] getCheckedKeys();
-
- LookupRow getCheckedLookupRow();
-
- LookupRow[] getCheckedLookupRows();
-
- void checkKeys(T[] keys);
-
- void checkKey(T key);
-
- /**
- * @return the keys that have been checked with regard to the initial keys of
- * the listbox. Initial keys are those after the last save or init
- */
- T[] getUncheckedKeys();
-
- /**
- * check all available keys, regardless of active/inactive flag
- */
- void checkAllKeys();
-
- /**
- * check all active keys, ignoring inactive keys
- */
- void checkAllActiveKeys();
-
- /**
- * check all inactive keys, ignoring active keys
- */
- void uncheckAllInactiveKeys();
-
- /**
- * decheck all available keys, regardless of active/inactive flag
- */
- void uncheckAllKeys();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.listbox;
+
+import org.eclipse.scout.commons.TriState;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.form.fields.ICompositeField;
+import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
+import org.eclipse.scout.rt.shared.services.common.code.ICodeType;
+import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
+import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
+
+/**
+ * A listbox contains at least 3 columns, where index 0 is the key column, index
+ * 1 is the text column and index 2 is the active-flag column
+ * <p>
+ * The listbox value is a Object[] where the Object[] is the set of checked keys of the listbox<br>
+ * the inner table shows those rows as checked which have the key value as a part of the listbox value (Object[])
+ * <p>
+ * Note, that the listbox might not necessarily show all checked rows since the value of the listbox might contain
+ * inactive keys that are not reflected in the listbox<br>
+ * Therefore an empty listbox table is not the same as a listbox with an empty value (null)
+ */
+public interface IListBox<T> extends IValueField<T[]>, ICompositeField {
+
+ /**
+ * {@link boolean}
+ */
+ String PROP_FILTER_CHECKED_ROWS = "filterCheckedRows";
+ /**
+ * {@link boolean}
+ */
+ String PROP_FILTER_ACTIVE_ROWS = "filterActiveRows";
+ /**
+ * {@link boolean}
+ */
+ String PROP_FILTER_CHECKED_ROWS_VALUE = "filterCheckedRowsValue";
+ /**
+ * {@link TriState}
+ */
+ String PROP_FILTER_ACTIVE_ROWS_VALUE = "filterActiveRowsValue";
+
+ ITable getTable();
+
+ IListBoxUIFacade getUIFacade();
+
+ /**
+ * @return true: a filter is added to the listbox table that only accepts
+ * checked rows<br>
+ * Affects {@link ITable#getFilteredRows()}<br>
+ * see also {@link #getFilterCheckedRowsValue()} and {@link #setFilterCheckedRows(boolean)}
+ */
+ boolean isFilterCheckedRows();
+
+ /**
+ * see {@link #isFilterCheckedRows()}
+ */
+ void setFilterCheckedRows(boolean b);
+
+ boolean getFilterCheckedRowsValue();
+
+ void setFilterCheckedRowsValue(boolean b);
+
+ /**
+ * @return true: a filter is added to the listbox table that only accepts rows
+ * that are active or checked.<br>
+ * Affects {@link ITable#getFilteredRows()}<br>
+ * see also {@link #getActiveFilter()} and {@link #setActiveFilter(TriState)}
+ */
+ boolean isFilterActiveRows();
+
+ /**
+ * see {@link #isFilterActiveRows()}<br>
+ * see also {@link #getFilterActiveRowsValue()} and {@link #setFilterActiveRowsValue(TriState)}
+ */
+ void setFilterActiveRows(boolean b);
+
+ TriState getFilterActiveRowsValue();
+
+ void setFilterActiveRowsValue(TriState t);
+
+ void prepareLookupCall(LookupCall call) throws ProcessingException;
+
+ /**
+ * Populate table with data from data service<br>
+ * all existing data in the table is discarded
+ *
+ * @see execFilterTableRow
+ */
+ void loadListBoxData() throws ProcessingException;
+
+ LookupCall getLookupCall();
+
+ void setLookupCall(LookupCall call);
+
+ Class<? extends ICodeType> getCodeTypeClass();
+
+ void setCodeTypeClass(Class<? extends ICodeType> codeTypeClass);
+
+ /**
+ * Convenience for getting the first value of {@link #getValue()}
+ *
+ * @return the first selected/checked value if any
+ * <p>
+ * By default a listbox is checkable, so its value is the array of all checked keys
+ * <p>
+ * When it is made non-checkable, its value is the array of all selected keys
+ */
+ T getSingleValue();
+
+ /**
+ * Convenience for setting a single value with {@link #setValue(Object)}
+ */
+ void setSingleValue(T value);
+
+ int getCheckedKeyCount();
+
+ T getCheckedKey();
+
+ T[] getCheckedKeys();
+
+ LookupRow getCheckedLookupRow();
+
+ LookupRow[] getCheckedLookupRows();
+
+ void checkKeys(T[] keys);
+
+ void checkKey(T key);
+
+ /**
+ * @return the keys that have been checked with regard to the initial keys of
+ * the listbox. Initial keys are those after the last save or init
+ */
+ T[] getUncheckedKeys();
+
+ /**
+ * check all available keys, regardless of active/inactive flag
+ */
+ void checkAllKeys();
+
+ /**
+ * check all active keys, ignoring inactive keys
+ */
+ void checkAllActiveKeys();
+
+ /**
+ * check all inactive keys, ignoring active keys
+ */
+ void uncheckAllInactiveKeys();
+
+ /**
+ * decheck all available keys, regardless of active/inactive flag
+ */
+ void uncheckAllKeys();
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/listbox/IListBoxUIFacade.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/listbox/IListBoxUIFacade.java
index 1c36a36cfe..2283396bd3 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/listbox/IListBoxUIFacade.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/listbox/IListBoxUIFacade.java
@@ -1,15 +1,15 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.listbox;
-
-public interface IListBoxUIFacade {
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.listbox;
+
+public interface IListBoxUIFacade {
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/longfield/AbstractLongField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/longfield/AbstractLongField.java
index d4387375f9..35e9a29c1e 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/longfield/AbstractLongField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/longfield/AbstractLongField.java
@@ -1,82 +1,82 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.longfield;
-
-import java.text.ParsePosition;
-
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.form.fields.numberfield.AbstractNumberField;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.data.form.ValidationRule;
-
-public abstract class AbstractLongField extends AbstractNumberField<Long> implements ILongField {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractLongField.class);
-
- public AbstractLongField() {
- this(true);
- }
-
- public AbstractLongField(boolean callInitializer) {
- super(callInitializer);
- }
-
- /*
- * Configuration
- */
- @ConfigProperty(ConfigProperty.LONG)
- @Order(250)
- @ConfigPropertyValue("null")
- @ValidationRule(ValidationRule.MIN_VALUE)
- protected Long getConfiguredMinimumValue() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.LONG)
- @Order(260)
- @ConfigPropertyValue("null")
- @ValidationRule(ValidationRule.MAX_VALUE)
- protected Long getConfiguredMaximumValue() {
- return null;
- }
-
- @Override
- protected void initConfig() {
- super.initConfig();
- setMinValue(getConfiguredMinimumValue());
- setMaxValue(getConfiguredMaximumValue());
- }
-
- @Override
- protected Long parseValueInternal(String text) throws ProcessingException {
- Long retVal = null;
- if (text == null) {
- text = "";
- }
- else {
- text = text.trim();
- }
- if (text.length() > 0) {
- ParsePosition p = new ParsePosition(0);
- Number n = createNumberFormat().parse(text, p);
- if (p.getErrorIndex() >= 0 || p.getIndex() != text.length()) {
- throw new ProcessingException(ScoutTexts.get("InvalidNumberMessageX", text));
- }
- retVal = new Long(n.longValue());
- }
- return retVal;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.longfield;
+
+import java.text.ParsePosition;
+
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.form.fields.numberfield.AbstractNumberField;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.data.form.ValidationRule;
+
+public abstract class AbstractLongField extends AbstractNumberField<Long> implements ILongField {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractLongField.class);
+
+ public AbstractLongField() {
+ this(true);
+ }
+
+ public AbstractLongField(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ /*
+ * Configuration
+ */
+ @ConfigProperty(ConfigProperty.LONG)
+ @Order(250)
+ @ConfigPropertyValue("null")
+ @ValidationRule(ValidationRule.MIN_VALUE)
+ protected Long getConfiguredMinimumValue() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.LONG)
+ @Order(260)
+ @ConfigPropertyValue("null")
+ @ValidationRule(ValidationRule.MAX_VALUE)
+ protected Long getConfiguredMaximumValue() {
+ return null;
+ }
+
+ @Override
+ protected void initConfig() {
+ super.initConfig();
+ setMinValue(getConfiguredMinimumValue());
+ setMaxValue(getConfiguredMaximumValue());
+ }
+
+ @Override
+ protected Long parseValueInternal(String text) throws ProcessingException {
+ Long retVal = null;
+ if (text == null) {
+ text = "";
+ }
+ else {
+ text = text.trim();
+ }
+ if (text.length() > 0) {
+ ParsePosition p = new ParsePosition(0);
+ Number n = createNumberFormat().parse(text, p);
+ if (p.getErrorIndex() >= 0 || p.getIndex() != text.length()) {
+ throw new ProcessingException(ScoutTexts.get("InvalidNumberMessageX", text));
+ }
+ retVal = new Long(n.longValue());
+ }
+ return retVal;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/longfield/ILongField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/longfield/ILongField.java
index 48d11f91f2..8cea4b4b3f 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/longfield/ILongField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/longfield/ILongField.java
@@ -1,17 +1,17 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.longfield;
-
-import org.eclipse.scout.rt.client.ui.form.fields.numberfield.INumberField;
-
-public interface ILongField extends INumberField<Long> {
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.longfield;
+
+import org.eclipse.scout.rt.client.ui.form.fields.numberfield.INumberField;
+
+public interface ILongField extends INumberField<Long> {
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/mailfield/AbstractMailField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/mailfield/AbstractMailField.java
index 5463b4249c..ce47e3dc4e 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/mailfield/AbstractMailField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/mailfield/AbstractMailField.java
@@ -1,240 +1,240 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.mailfield;
-
-import java.io.File;
-import java.net.URL;
-
-import javax.mail.internet.MimeMessage;
-
-import org.eclipse.scout.commons.annotations.ConfigOperation;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.form.fields.AbstractValueField;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
-import org.eclipse.scout.service.SERVICES;
-
-/**
- * @version 3.x
- */
-public abstract class AbstractMailField extends AbstractValueField<MimeMessage> implements IMailField {
- private IMailFieldUIFacade m_uiFacade;
- private boolean m_mailEditor;
- private boolean m_scrollBarEnabled;
-
- public AbstractMailField() {
- this(true);
- }
-
- public AbstractMailField(boolean callInitializer) {
- super(callInitializer);
- }
-
- /*
- * Configuration
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(240)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredMailEditor() {
- return false;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(250)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredScrollBarEnabled() {
- return false;
- }
-
- @ConfigProperty(ConfigProperty.TEXT)
- @Order(260)
- @ConfigPropertyValue("\"From\"")
- protected String getConfiguredLabelFrom() {
- return ScoutTexts.get("EmailFrom");
- }
-
- @ConfigProperty(ConfigProperty.TEXT)
- @Order(270)
- @ConfigPropertyValue("\"To\"")
- protected String getConfiguredLabelTo() {
- return ScoutTexts.get("EmailTo");
- }
-
- @ConfigProperty(ConfigProperty.TEXT)
- @Order(280)
- @ConfigPropertyValue("\"CC\"")
- protected String getConfiguredLabelCc() {
- return ScoutTexts.get("EmailCc");
- }
-
- @ConfigProperty(ConfigProperty.TEXT)
- @Order(290)
- @ConfigPropertyValue("\"Subject\"")
- protected String getConfiguredLabelSubject() {
- return ScoutTexts.get("EmailSubject");
- }
-
- @ConfigProperty(ConfigProperty.TEXT)
- @Order(300)
- @ConfigPropertyValue("\"Sent\"")
- protected String getConfiguredLabelSent() {
- return ScoutTexts.get("EmailSent");
- }
-
- /**
- * @param url
- * @param path
- * {@link URL#getPath()}
- * @param local
- * true if the url is not a valid external url but a local model url
- * (http://local/...)
- */
- @ConfigOperation
- @Order(230)
- protected void execAttachementAction(File file) throws ProcessingException {
- }
-
- /**
- * @param url
- * @param path
- * {@link URL#getPath()}
- * @param local
- * true if the url is not a valid external url but a local model url
- * (http://local/...)
- */
- @ConfigOperation
- @Order(240)
- protected void execHyperlinkAction(URL url, String path, boolean local) throws ProcessingException {
- }
-
- @Override
- protected void initConfig() {
- m_uiFacade = new P_UIFacade();
- super.initConfig();
- m_mailEditor = getConfiguredMailEditor();
- m_scrollBarEnabled = getConfiguredScrollBarEnabled();
- setLabelFrom(getConfiguredLabelFrom());
- setLabelTo(getConfiguredLabelTo());
- setLabelCc(getConfiguredLabelCc());
- setLabelSent(getConfiguredLabelSent());
- setLabelSubject(getConfiguredLabelSubject());
- }
-
- @Override
- public void setLabelFrom(String fromLabel) {
- propertySupport.setPropertyString(PROP_LABEL_FROM, fromLabel);
- }
-
- @Override
- public String getLabelFrom() {
- return propertySupport.getPropertyString(PROP_LABEL_FROM);
- }
-
- @Override
- public void setLabelTo(String toLabel) {
- propertySupport.setPropertyString(PROP_LABEL_TO, toLabel);
- }
-
- @Override
- public String getLabelTo() {
- return propertySupport.getPropertyString(PROP_LABEL_TO);
- }
-
- @Override
- public void setLabelCc(String ccLabel) {
- propertySupport.setPropertyString(PROP_LABEL_CC, ccLabel);
- }
-
- @Override
- public String getLabelCc() {
- return propertySupport.getPropertyString(PROP_LABEL_CC);
- }
-
- @Override
- public void setLabelSubject(String subjectLabel) {
- propertySupport.setPropertyString(PROP_LABEL_SUBJECT, subjectLabel);
-
- }
-
- @Override
- public String getLabelSubject() {
- return propertySupport.getPropertyString(PROP_LABEL_SUBJECT);
- }
-
- @Override
- public void setLabelSent(String sentLabel) {
- propertySupport.setProperty(PROP_LABEL_SENT, sentLabel);
- }
-
- @Override
- public String getLabelSent() {
- return propertySupport.getPropertyString(PROP_LABEL_SENT);
- }
-
- @Override
- public IMailFieldUIFacade getUIFacade() {
- return m_uiFacade;
- }
-
- @Override
- public boolean isMailEditor() {
- return m_mailEditor;
- }
-
- @Override
- public boolean isScrollBarEnabled() {
- return m_scrollBarEnabled;
- }
-
- public void doAttachementAction(File file) throws ProcessingException {
- execAttachementAction(file);
- }
-
- public void doHyperlinkAction(URL url) throws ProcessingException {
- execHyperlinkAction(url, url.getPath(), url != null && url.getHost().equals("local"));
- }
-
- private class P_UIFacade implements IMailFieldUIFacade {
- @Override
- public boolean setMailFromUI(MimeMessage message) {
- if (isMailEditor()) {
- setValue(message);
- }
- return true;
- }
-
- @Override
- public void fireAttachementActionFromUI(File file) {
- try {
- doAttachementAction(file);
- }
- catch (ProcessingException e) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- }
-
- @Override
- public void fireHyperlinkActionFromUI(URL url) {
- try {
- doHyperlinkAction(url);
- }
- catch (ProcessingException e) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- }
-
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.mailfield;
+
+import java.io.File;
+import java.net.URL;
+
+import javax.mail.internet.MimeMessage;
+
+import org.eclipse.scout.commons.annotations.ConfigOperation;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.form.fields.AbstractValueField;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
+import org.eclipse.scout.service.SERVICES;
+
+/**
+ * @version 3.x
+ */
+public abstract class AbstractMailField extends AbstractValueField<MimeMessage> implements IMailField {
+ private IMailFieldUIFacade m_uiFacade;
+ private boolean m_mailEditor;
+ private boolean m_scrollBarEnabled;
+
+ public AbstractMailField() {
+ this(true);
+ }
+
+ public AbstractMailField(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ /*
+ * Configuration
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(240)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredMailEditor() {
+ return false;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(250)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredScrollBarEnabled() {
+ return false;
+ }
+
+ @ConfigProperty(ConfigProperty.TEXT)
+ @Order(260)
+ @ConfigPropertyValue("\"From\"")
+ protected String getConfiguredLabelFrom() {
+ return ScoutTexts.get("EmailFrom");
+ }
+
+ @ConfigProperty(ConfigProperty.TEXT)
+ @Order(270)
+ @ConfigPropertyValue("\"To\"")
+ protected String getConfiguredLabelTo() {
+ return ScoutTexts.get("EmailTo");
+ }
+
+ @ConfigProperty(ConfigProperty.TEXT)
+ @Order(280)
+ @ConfigPropertyValue("\"CC\"")
+ protected String getConfiguredLabelCc() {
+ return ScoutTexts.get("EmailCc");
+ }
+
+ @ConfigProperty(ConfigProperty.TEXT)
+ @Order(290)
+ @ConfigPropertyValue("\"Subject\"")
+ protected String getConfiguredLabelSubject() {
+ return ScoutTexts.get("EmailSubject");
+ }
+
+ @ConfigProperty(ConfigProperty.TEXT)
+ @Order(300)
+ @ConfigPropertyValue("\"Sent\"")
+ protected String getConfiguredLabelSent() {
+ return ScoutTexts.get("EmailSent");
+ }
+
+ /**
+ * @param url
+ * @param path
+ * {@link URL#getPath()}
+ * @param local
+ * true if the url is not a valid external url but a local model url
+ * (http://local/...)
+ */
+ @ConfigOperation
+ @Order(230)
+ protected void execAttachementAction(File file) throws ProcessingException {
+ }
+
+ /**
+ * @param url
+ * @param path
+ * {@link URL#getPath()}
+ * @param local
+ * true if the url is not a valid external url but a local model url
+ * (http://local/...)
+ */
+ @ConfigOperation
+ @Order(240)
+ protected void execHyperlinkAction(URL url, String path, boolean local) throws ProcessingException {
+ }
+
+ @Override
+ protected void initConfig() {
+ m_uiFacade = new P_UIFacade();
+ super.initConfig();
+ m_mailEditor = getConfiguredMailEditor();
+ m_scrollBarEnabled = getConfiguredScrollBarEnabled();
+ setLabelFrom(getConfiguredLabelFrom());
+ setLabelTo(getConfiguredLabelTo());
+ setLabelCc(getConfiguredLabelCc());
+ setLabelSent(getConfiguredLabelSent());
+ setLabelSubject(getConfiguredLabelSubject());
+ }
+
+ @Override
+ public void setLabelFrom(String fromLabel) {
+ propertySupport.setPropertyString(PROP_LABEL_FROM, fromLabel);
+ }
+
+ @Override
+ public String getLabelFrom() {
+ return propertySupport.getPropertyString(PROP_LABEL_FROM);
+ }
+
+ @Override
+ public void setLabelTo(String toLabel) {
+ propertySupport.setPropertyString(PROP_LABEL_TO, toLabel);
+ }
+
+ @Override
+ public String getLabelTo() {
+ return propertySupport.getPropertyString(PROP_LABEL_TO);
+ }
+
+ @Override
+ public void setLabelCc(String ccLabel) {
+ propertySupport.setPropertyString(PROP_LABEL_CC, ccLabel);
+ }
+
+ @Override
+ public String getLabelCc() {
+ return propertySupport.getPropertyString(PROP_LABEL_CC);
+ }
+
+ @Override
+ public void setLabelSubject(String subjectLabel) {
+ propertySupport.setPropertyString(PROP_LABEL_SUBJECT, subjectLabel);
+
+ }
+
+ @Override
+ public String getLabelSubject() {
+ return propertySupport.getPropertyString(PROP_LABEL_SUBJECT);
+ }
+
+ @Override
+ public void setLabelSent(String sentLabel) {
+ propertySupport.setProperty(PROP_LABEL_SENT, sentLabel);
+ }
+
+ @Override
+ public String getLabelSent() {
+ return propertySupport.getPropertyString(PROP_LABEL_SENT);
+ }
+
+ @Override
+ public IMailFieldUIFacade getUIFacade() {
+ return m_uiFacade;
+ }
+
+ @Override
+ public boolean isMailEditor() {
+ return m_mailEditor;
+ }
+
+ @Override
+ public boolean isScrollBarEnabled() {
+ return m_scrollBarEnabled;
+ }
+
+ public void doAttachementAction(File file) throws ProcessingException {
+ execAttachementAction(file);
+ }
+
+ public void doHyperlinkAction(URL url) throws ProcessingException {
+ execHyperlinkAction(url, url.getPath(), url != null && url.getHost().equals("local"));
+ }
+
+ private class P_UIFacade implements IMailFieldUIFacade {
+ @Override
+ public boolean setMailFromUI(MimeMessage message) {
+ if (isMailEditor()) {
+ setValue(message);
+ }
+ return true;
+ }
+
+ @Override
+ public void fireAttachementActionFromUI(File file) {
+ try {
+ doAttachementAction(file);
+ }
+ catch (ProcessingException e) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ }
+
+ @Override
+ public void fireHyperlinkActionFromUI(URL url) {
+ try {
+ doHyperlinkAction(url);
+ }
+ catch (ProcessingException e) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ }
+
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/mailfield/IMailField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/mailfield/IMailField.java
index dad6aecf55..0b48d3ed32 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/mailfield/IMailField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/mailfield/IMailField.java
@@ -1,52 +1,52 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.mailfield;
-
-import javax.mail.internet.MimeMessage;
-
-import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
-
-/**
- * @version 3.x
- */
-public interface IMailField extends IValueField<MimeMessage> {
- String PROP_LABEL_FROM = "labelFrom";
- String PROP_LABEL_TO = "labelTo";
- String PROP_LABEL_CC = "labelCC";
- String PROP_LABEL_SUBJECT = "labelSubject";
- String PROP_LABEL_SENT = "labelSent";
-
- boolean isMailEditor();
-
- boolean isScrollBarEnabled();
-
- String getLabelFrom();
-
- void setLabelFrom(String fromLabel);
-
- String getLabelTo();
-
- void setLabelTo(String toLabel);
-
- String getLabelCc();
-
- void setLabelCc(String ccLabel);
-
- String getLabelSubject();
-
- void setLabelSubject(String subjectLabel);
-
- String getLabelSent();
-
- void setLabelSent(String sentLabel);
-
- IMailFieldUIFacade getUIFacade();
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.mailfield;
+
+import javax.mail.internet.MimeMessage;
+
+import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
+
+/**
+ * @version 3.x
+ */
+public interface IMailField extends IValueField<MimeMessage> {
+ String PROP_LABEL_FROM = "labelFrom";
+ String PROP_LABEL_TO = "labelTo";
+ String PROP_LABEL_CC = "labelCC";
+ String PROP_LABEL_SUBJECT = "labelSubject";
+ String PROP_LABEL_SENT = "labelSent";
+
+ boolean isMailEditor();
+
+ boolean isScrollBarEnabled();
+
+ String getLabelFrom();
+
+ void setLabelFrom(String fromLabel);
+
+ String getLabelTo();
+
+ void setLabelTo(String toLabel);
+
+ String getLabelCc();
+
+ void setLabelCc(String ccLabel);
+
+ String getLabelSubject();
+
+ void setLabelSubject(String subjectLabel);
+
+ String getLabelSent();
+
+ void setLabelSent(String sentLabel);
+
+ IMailFieldUIFacade getUIFacade();
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/mailfield/IMailFieldUIFacade.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/mailfield/IMailFieldUIFacade.java
index 4094b97ad3..a5b6201726 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/mailfield/IMailFieldUIFacade.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/mailfield/IMailFieldUIFacade.java
@@ -1,29 +1,29 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.mailfield;
-
-import java.io.File;
-import java.net.URL;
-
-import javax.mail.internet.MimeMessage;
-
-/**
- * @version 3.x
- */
-public interface IMailFieldUIFacade {
-
- boolean setMailFromUI(MimeMessage message);
-
- void fireAttachementActionFromUI(File file);
-
- void fireHyperlinkActionFromUI(URL url);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.mailfield;
+
+import java.io.File;
+import java.net.URL;
+
+import javax.mail.internet.MimeMessage;
+
+/**
+ * @version 3.x
+ */
+public interface IMailFieldUIFacade {
+
+ boolean setMailFromUI(MimeMessage message);
+
+ void fireAttachementActionFromUI(File file);
+
+ void fireHyperlinkActionFromUI(URL url);
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/matrixfield/AbstractMatrixField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/matrixfield/AbstractMatrixField.java
index 21b7a57e88..09e63f8f5a 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/matrixfield/AbstractMatrixField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/matrixfield/AbstractMatrixField.java
@@ -1,35 +1,35 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.matrixfield;
-
-import org.eclipse.scout.rt.client.ui.form.fields.AbstractFormField;
-
-/**
- * @deprecated use {@link org.eclipse.scout.rt.client.ui.form.fields.tablefield.ITableField} instead
- */
-@SuppressWarnings("deprecation")
-@Deprecated
-public abstract class AbstractMatrixField extends AbstractFormField implements IMatrixField {
-
- public AbstractMatrixField() {
- this(true);
- }
-
- public AbstractMatrixField(boolean callInitializer) {
- super(callInitializer);
- }
-
- @Override
- protected void initConfig() {
- super.initConfig();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.matrixfield;
+
+import org.eclipse.scout.rt.client.ui.form.fields.AbstractFormField;
+
+/**
+ * @deprecated use {@link org.eclipse.scout.rt.client.ui.form.fields.tablefield.ITableField} instead
+ */
+@SuppressWarnings("deprecation")
+@Deprecated
+public abstract class AbstractMatrixField extends AbstractFormField implements IMatrixField {
+
+ public AbstractMatrixField() {
+ this(true);
+ }
+
+ public AbstractMatrixField(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ @Override
+ protected void initConfig() {
+ super.initConfig();
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/matrixfield/IMatrixField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/matrixfield/IMatrixField.java
index dfffd75a1a..095d017724 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/matrixfield/IMatrixField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/matrixfield/IMatrixField.java
@@ -1,21 +1,21 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.matrixfield;
-
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-
-/**
- * @deprecated use {@link org.eclipse.scout.rt.client.ui.form.fields.tablefield.AbstractTableField} instead
- */
-@Deprecated
-public interface IMatrixField extends IFormField {
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.matrixfield;
+
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+
+/**
+ * @deprecated use {@link org.eclipse.scout.rt.client.ui.form.fields.tablefield.AbstractTableField} instead
+ */
+@Deprecated
+public interface IMatrixField extends IFormField {
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/numberfield/AbstractNumberField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/numberfield/AbstractNumberField.java
index c9bb30f843..2a8aba5fa9 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/numberfield/AbstractNumberField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/numberfield/AbstractNumberField.java
@@ -1,220 +1,220 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.numberfield;
-
-import java.text.DecimalFormat;
-import java.text.NumberFormat;
-
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.commons.LocaleThreadLocal;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.exception.VetoException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.form.fields.AbstractValueField;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-
-public abstract class AbstractNumberField<T extends Number> extends AbstractValueField<T> implements INumberField<T> {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractNumberField.class);
-
- private INumberFieldUIFacade m_uiFacade;
- private String m_format;
- private boolean m_groupingUsed;
- private T m_minValue;
- private T m_maxValue;
-
- public AbstractNumberField() {
- this(true);
- }
-
- public AbstractNumberField(boolean callInitializer) {
- super(callInitializer);
- }
-
- /*
- * Configuration
- */
- @ConfigProperty(ConfigProperty.STRING)
- @Order(230)
- @ConfigPropertyValue("null")
- protected String getConfiguredFormat() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(240)
- @ConfigPropertyValue("true")
- protected boolean getConfiguredGroupingUsed() {
- return true;
- }
-
- @Override
- @ConfigPropertyValue("1")
- protected int getConfiguredHorizontalAlignment() {
- return 1;
- }
-
- @Override
- protected void initConfig() {
- m_uiFacade = new P_UIFacade();
- super.initConfig();
- setFormat(getConfiguredFormat());
- setGroupingUsed(getConfiguredGroupingUsed());
- }
-
- @Override
- public void setFormat(String s) {
- m_format = s;
- if (isInitialized()) {
- if (isAutoDisplayText()) {
- setDisplayText(execFormatValue(getValue()));
- }
- }
- }
-
- @Override
- public String getFormat() {
- return m_format;
- }
-
- @Override
- public void setGroupingUsed(boolean b) {
- m_groupingUsed = b;
- if (isInitialized()) {
- if (isAutoDisplayText()) {
- setDisplayText(execFormatValue(getValue()));
- }
- }
- }
-
- @Override
- public boolean isGroupingUsed() {
- return m_groupingUsed;
- }
-
- @Override
- public void setMinValue(T n) {
- try {
- setFieldChanging(true);
- //
- T max = getMaxValue();
- if (n != null && max != null && compareInternal(n, max) > 0) {
- m_maxValue = n;
- }
- m_minValue = n;
- if (isInitialized()) {
- setValue(getValue());
- }
- }
- finally {
- setFieldChanging(false);
- }
- }
-
- @Override
- public T getMinValue() {
- return m_minValue;
- }
-
- @Override
- public void setMaxValue(T n) {
- try {
- setFieldChanging(true);
- //
- T min = getMinValue();
- if (n != null && min != null && compareInternal(n, min) < 0) {
- m_minValue = n;
- }
- m_maxValue = n;
- if (isInitialized()) {
- setValue(getValue());
- }
- }
- finally {
- setFieldChanging(false);
- }
- }
-
- @Override
- public T getMaxValue() {
- return m_maxValue;
- }
-
- @SuppressWarnings("unchecked")
- private int compareInternal(T a, T b) {
- return CompareUtility.compareTo((Comparable) a, (Comparable) b);
- }
-
- @Override
- protected T validateValueInternal(T rawValue) throws ProcessingException {
- T validValue = null;
- rawValue = super.validateValueInternal(rawValue);
- if (rawValue == null) {
- validValue = null;
- }
- else {
- if (getMaxValue() != null && compareInternal(rawValue, getMaxValue()) > 0) {
- throw new VetoException(ScoutTexts.get("NumberTooLargeMessageXY", "" + formatValueInternal(getMinValue()), "" + formatValueInternal(getMaxValue())));
- }
- if (getMinValue() != null && compareInternal(rawValue, getMinValue()) < 0) {
- throw new VetoException(ScoutTexts.get("NumberTooSmallMessageXY", "" + formatValueInternal(getMinValue()), "" + formatValueInternal(getMaxValue())));
- }
- validValue = rawValue;
- }
- return validValue;
- }
-
- @Override
- protected String formatValueInternal(T validValue) {
- if (validValue == null) {
- return "";
- }
- String displayValue = createNumberFormat().format(validValue);
- return displayValue;
- }
-
- protected NumberFormat createNumberFormat() {
- NumberFormat fmt = null;
- if (getFormat() != null) {
- DecimalFormat x = (DecimalFormat) DecimalFormat.getNumberInstance(LocaleThreadLocal.get());
- x.applyPattern(getFormat());
- x.setMinimumFractionDigits(0);
- x.setMaximumFractionDigits(0);
- fmt = x;
- }
- else {
- fmt = NumberFormat.getNumberInstance(LocaleThreadLocal.get());
- fmt.setMinimumFractionDigits(0);
- fmt.setMaximumFractionDigits(0);
- fmt.setGroupingUsed(isGroupingUsed());
- }
- return fmt;
- }
-
- @Override
- public INumberFieldUIFacade getUIFacade() {
- return m_uiFacade;
- }
-
- private class P_UIFacade implements INumberFieldUIFacade {
- @Override
- public boolean setTextFromUI(String newText) {
- if (newText != null && newText.length() == 0) {
- newText = null;
- }
- // parse always, validity might change even if text is same
- return parseValue(newText);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.numberfield;
+
+import java.text.DecimalFormat;
+import java.text.NumberFormat;
+
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.commons.LocaleThreadLocal;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.exception.VetoException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.form.fields.AbstractValueField;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+
+public abstract class AbstractNumberField<T extends Number> extends AbstractValueField<T> implements INumberField<T> {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractNumberField.class);
+
+ private INumberFieldUIFacade m_uiFacade;
+ private String m_format;
+ private boolean m_groupingUsed;
+ private T m_minValue;
+ private T m_maxValue;
+
+ public AbstractNumberField() {
+ this(true);
+ }
+
+ public AbstractNumberField(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ /*
+ * Configuration
+ */
+ @ConfigProperty(ConfigProperty.STRING)
+ @Order(230)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredFormat() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(240)
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredGroupingUsed() {
+ return true;
+ }
+
+ @Override
+ @ConfigPropertyValue("1")
+ protected int getConfiguredHorizontalAlignment() {
+ return 1;
+ }
+
+ @Override
+ protected void initConfig() {
+ m_uiFacade = new P_UIFacade();
+ super.initConfig();
+ setFormat(getConfiguredFormat());
+ setGroupingUsed(getConfiguredGroupingUsed());
+ }
+
+ @Override
+ public void setFormat(String s) {
+ m_format = s;
+ if (isInitialized()) {
+ if (isAutoDisplayText()) {
+ setDisplayText(execFormatValue(getValue()));
+ }
+ }
+ }
+
+ @Override
+ public String getFormat() {
+ return m_format;
+ }
+
+ @Override
+ public void setGroupingUsed(boolean b) {
+ m_groupingUsed = b;
+ if (isInitialized()) {
+ if (isAutoDisplayText()) {
+ setDisplayText(execFormatValue(getValue()));
+ }
+ }
+ }
+
+ @Override
+ public boolean isGroupingUsed() {
+ return m_groupingUsed;
+ }
+
+ @Override
+ public void setMinValue(T n) {
+ try {
+ setFieldChanging(true);
+ //
+ T max = getMaxValue();
+ if (n != null && max != null && compareInternal(n, max) > 0) {
+ m_maxValue = n;
+ }
+ m_minValue = n;
+ if (isInitialized()) {
+ setValue(getValue());
+ }
+ }
+ finally {
+ setFieldChanging(false);
+ }
+ }
+
+ @Override
+ public T getMinValue() {
+ return m_minValue;
+ }
+
+ @Override
+ public void setMaxValue(T n) {
+ try {
+ setFieldChanging(true);
+ //
+ T min = getMinValue();
+ if (n != null && min != null && compareInternal(n, min) < 0) {
+ m_minValue = n;
+ }
+ m_maxValue = n;
+ if (isInitialized()) {
+ setValue(getValue());
+ }
+ }
+ finally {
+ setFieldChanging(false);
+ }
+ }
+
+ @Override
+ public T getMaxValue() {
+ return m_maxValue;
+ }
+
+ @SuppressWarnings("unchecked")
+ private int compareInternal(T a, T b) {
+ return CompareUtility.compareTo((Comparable) a, (Comparable) b);
+ }
+
+ @Override
+ protected T validateValueInternal(T rawValue) throws ProcessingException {
+ T validValue = null;
+ rawValue = super.validateValueInternal(rawValue);
+ if (rawValue == null) {
+ validValue = null;
+ }
+ else {
+ if (getMaxValue() != null && compareInternal(rawValue, getMaxValue()) > 0) {
+ throw new VetoException(ScoutTexts.get("NumberTooLargeMessageXY", "" + formatValueInternal(getMinValue()), "" + formatValueInternal(getMaxValue())));
+ }
+ if (getMinValue() != null && compareInternal(rawValue, getMinValue()) < 0) {
+ throw new VetoException(ScoutTexts.get("NumberTooSmallMessageXY", "" + formatValueInternal(getMinValue()), "" + formatValueInternal(getMaxValue())));
+ }
+ validValue = rawValue;
+ }
+ return validValue;
+ }
+
+ @Override
+ protected String formatValueInternal(T validValue) {
+ if (validValue == null) {
+ return "";
+ }
+ String displayValue = createNumberFormat().format(validValue);
+ return displayValue;
+ }
+
+ protected NumberFormat createNumberFormat() {
+ NumberFormat fmt = null;
+ if (getFormat() != null) {
+ DecimalFormat x = (DecimalFormat) DecimalFormat.getNumberInstance(LocaleThreadLocal.get());
+ x.applyPattern(getFormat());
+ x.setMinimumFractionDigits(0);
+ x.setMaximumFractionDigits(0);
+ fmt = x;
+ }
+ else {
+ fmt = NumberFormat.getNumberInstance(LocaleThreadLocal.get());
+ fmt.setMinimumFractionDigits(0);
+ fmt.setMaximumFractionDigits(0);
+ fmt.setGroupingUsed(isGroupingUsed());
+ }
+ return fmt;
+ }
+
+ @Override
+ public INumberFieldUIFacade getUIFacade() {
+ return m_uiFacade;
+ }
+
+ private class P_UIFacade implements INumberFieldUIFacade {
+ @Override
+ public boolean setTextFromUI(String newText) {
+ if (newText != null && newText.length() == 0) {
+ newText = null;
+ }
+ // parse always, validity might change even if text is same
+ return parseValue(newText);
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/numberfield/INumberField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/numberfield/INumberField.java
index 29388a6bf7..c42a973290 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/numberfield/INumberField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/numberfield/INumberField.java
@@ -1,42 +1,42 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.numberfield;
-
-import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
-import org.eclipse.scout.rt.client.ui.form.fields.decimalfield.IDecimalField;
-
-/**
- * Field type representing a non-fractional number such as Integer, Long,
- * BigInteger
- *
- * @see IDecimalField for floating point numbers
- */
-public interface INumberField<T extends Number> extends IValueField<T> {
-
- void setFormat(String s);
-
- String getFormat();
-
- void setGroupingUsed(boolean b);
-
- boolean isGroupingUsed();
-
- void setMinValue(T value);
-
- T getMinValue();
-
- void setMaxValue(T value);
-
- T getMaxValue();
-
- INumberFieldUIFacade getUIFacade();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.numberfield;
+
+import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
+import org.eclipse.scout.rt.client.ui.form.fields.decimalfield.IDecimalField;
+
+/**
+ * Field type representing a non-fractional number such as Integer, Long,
+ * BigInteger
+ *
+ * @see IDecimalField for floating point numbers
+ */
+public interface INumberField<T extends Number> extends IValueField<T> {
+
+ void setFormat(String s);
+
+ String getFormat();
+
+ void setGroupingUsed(boolean b);
+
+ boolean isGroupingUsed();
+
+ void setMinValue(T value);
+
+ T getMinValue();
+
+ void setMaxValue(T value);
+
+ T getMaxValue();
+
+ INumberFieldUIFacade getUIFacade();
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/numberfield/INumberFieldUIFacade.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/numberfield/INumberFieldUIFacade.java
index a5d6e53afc..4b6a2e72d5 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/numberfield/INumberFieldUIFacade.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/numberfield/INumberFieldUIFacade.java
@@ -1,17 +1,17 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.numberfield;
-
-public interface INumberFieldUIFacade {
-
- boolean setTextFromUI(String newText);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.numberfield;
+
+public interface INumberFieldUIFacade {
+
+ boolean setTextFromUI(String newText);
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/pagefield/AbstractPageField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/pagefield/AbstractPageField.java
index 712de194cd..bb2ec19416 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/pagefield/AbstractPageField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/pagefield/AbstractPageField.java
@@ -1,192 +1,192 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.pagefield;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.desktop.outline.AbstractOutline;
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
-import org.eclipse.scout.rt.client.ui.form.fields.tablefield.AbstractTableField;
-import org.eclipse.scout.rt.client.ui.form.fields.tablefield.ITableField;
-import org.eclipse.scout.rt.client.ui.form.fields.wrappedform.AbstractWrappedFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.wrappedform.IWrappedFormField;
-
-/**
- * Representation of a page as a composite of detailForm, table, searchForm for
- * usage inside a {@link IForm}
- */
-public abstract class AbstractPageField<T extends IPage> extends AbstractGroupBox implements IPageField<T> {
- private T m_page;
- private SimpleOutline m_outline;
-
- public AbstractPageField() {
- this(true);
- }
-
- public AbstractPageField(boolean callInitializer) {
- super(callInitializer);
- }
-
- @Override
- @ConfigPropertyValue("false")
- protected boolean getConfiguredBorderVisible() {
- return false;
- }
-
- @Override
- protected void initConfig() {
- m_outline = new SimpleOutline();
- super.initConfig();
- }
-
- @Override
- public final T getPage() {
- return m_page;
- }
-
- @Override
- public void setPage(T newPage) {
- setPageInternal(newPage);
- }
-
- private void setPageInternal(T page) {
- if (m_page == page) {
- return;
- }
- // remove old
- getDetailFormField().setInnerForm(null);
- getTableField().setTable(null, true);
- getSearchFormField().setInnerForm(null);
- if (m_page != null) {
- m_outline.disposeTree();
- m_outline = null;
- m_page = null;
- }
- // add new
- m_page = page;
- if (m_page != null) {
- m_outline = new SimpleOutline();
- m_outline.setRootNode(m_page);
- m_outline.selectNode(m_page);
- m_outline.addPropertyChangeListener(
- new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent e) {
- if (e.getPropertyName().equals(IOutline.PROP_DETAIL_FORM)) {
- getDetailFormField().setInnerForm(((IOutline) e.getSource()).getDetailForm());
- }
- else if (e.getPropertyName().equals(IOutline.PROP_DETAIL_TABLE)) {
- getTableField().setTable(((IOutline) e.getSource()).getDetailTable(), true);
- }
- else if (e.getPropertyName().equals(IOutline.PROP_SEARCH_FORM)) {
- getSearchFormField().setInnerForm(((IOutline) e.getSource()).getSearchForm());
- }
- }
- }
- );
- getDetailFormField().setInnerForm(m_outline.getDetailForm());
- getTableField().setTable(m_outline.getDetailTable(), true);
- getSearchFormField().setInnerForm(m_outline.getSearchForm());
- }
- }
-
- @Override
- public IWrappedFormField<IForm> getDetailFormField() {
- return getFieldByClass(DetailFormField.class);
- }
-
- @Override
- public ITableField<ITable> getTableField() {
- return getFieldByClass(TableField.class);
- }
-
- @Override
- public IWrappedFormField<IForm> getSearchFormField() {
- return getFieldByClass(SearchFormField.class);
- }
-
- @Order(10)
- public class SearchFormField extends AbstractWrappedFormField<IForm> {
- @Override
- protected int getConfiguredGridW() {
- return FULL_WIDTH;
- }
-
- @Override
- protected int getConfiguredGridH() {
- return 2;
- }
-
- @Override
- protected double getConfiguredGridWeightY() {
- return 0.001;
- }
- }
-
- @Order(20)
- public class TableField extends AbstractTableField<ITable> {
- @Override
- protected boolean getConfiguredLabelVisible() {
- return false;
- }
-
- @Override
- protected int getConfiguredGridW() {
- return FULL_WIDTH;
- }
-
- @Override
- protected int getConfiguredGridH() {
- return 7;
- }
-
- @Override
- protected double getConfiguredGridWeightY() {
- return 1;
- }
-
- }
-
- @Order(30)
- public class DetailFormField extends AbstractWrappedFormField<IForm> {
- @Override
- protected boolean getConfiguredVisible() {
- return true;
- }
-
- @Override
- protected int getConfiguredGridW() {
- return FULL_WIDTH;
- }
-
- @Override
- protected boolean execCalculateVisible() {
- return getInnerForm() != null;
- }
- }
-
- public static class SimpleOutline extends AbstractOutline {
-
- @Override
- protected boolean getConfiguredRootNodeVisible() {
- return true;
- }
-
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.pagefield;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.desktop.outline.AbstractOutline;
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
+import org.eclipse.scout.rt.client.ui.form.fields.tablefield.AbstractTableField;
+import org.eclipse.scout.rt.client.ui.form.fields.tablefield.ITableField;
+import org.eclipse.scout.rt.client.ui.form.fields.wrappedform.AbstractWrappedFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.wrappedform.IWrappedFormField;
+
+/**
+ * Representation of a page as a composite of detailForm, table, searchForm for
+ * usage inside a {@link IForm}
+ */
+public abstract class AbstractPageField<T extends IPage> extends AbstractGroupBox implements IPageField<T> {
+ private T m_page;
+ private SimpleOutline m_outline;
+
+ public AbstractPageField() {
+ this(true);
+ }
+
+ public AbstractPageField(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ @Override
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredBorderVisible() {
+ return false;
+ }
+
+ @Override
+ protected void initConfig() {
+ m_outline = new SimpleOutline();
+ super.initConfig();
+ }
+
+ @Override
+ public final T getPage() {
+ return m_page;
+ }
+
+ @Override
+ public void setPage(T newPage) {
+ setPageInternal(newPage);
+ }
+
+ private void setPageInternal(T page) {
+ if (m_page == page) {
+ return;
+ }
+ // remove old
+ getDetailFormField().setInnerForm(null);
+ getTableField().setTable(null, true);
+ getSearchFormField().setInnerForm(null);
+ if (m_page != null) {
+ m_outline.disposeTree();
+ m_outline = null;
+ m_page = null;
+ }
+ // add new
+ m_page = page;
+ if (m_page != null) {
+ m_outline = new SimpleOutline();
+ m_outline.setRootNode(m_page);
+ m_outline.selectNode(m_page);
+ m_outline.addPropertyChangeListener(
+ new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent e) {
+ if (e.getPropertyName().equals(IOutline.PROP_DETAIL_FORM)) {
+ getDetailFormField().setInnerForm(((IOutline) e.getSource()).getDetailForm());
+ }
+ else if (e.getPropertyName().equals(IOutline.PROP_DETAIL_TABLE)) {
+ getTableField().setTable(((IOutline) e.getSource()).getDetailTable(), true);
+ }
+ else if (e.getPropertyName().equals(IOutline.PROP_SEARCH_FORM)) {
+ getSearchFormField().setInnerForm(((IOutline) e.getSource()).getSearchForm());
+ }
+ }
+ }
+ );
+ getDetailFormField().setInnerForm(m_outline.getDetailForm());
+ getTableField().setTable(m_outline.getDetailTable(), true);
+ getSearchFormField().setInnerForm(m_outline.getSearchForm());
+ }
+ }
+
+ @Override
+ public IWrappedFormField<IForm> getDetailFormField() {
+ return getFieldByClass(DetailFormField.class);
+ }
+
+ @Override
+ public ITableField<ITable> getTableField() {
+ return getFieldByClass(TableField.class);
+ }
+
+ @Override
+ public IWrappedFormField<IForm> getSearchFormField() {
+ return getFieldByClass(SearchFormField.class);
+ }
+
+ @Order(10)
+ public class SearchFormField extends AbstractWrappedFormField<IForm> {
+ @Override
+ protected int getConfiguredGridW() {
+ return FULL_WIDTH;
+ }
+
+ @Override
+ protected int getConfiguredGridH() {
+ return 2;
+ }
+
+ @Override
+ protected double getConfiguredGridWeightY() {
+ return 0.001;
+ }
+ }
+
+ @Order(20)
+ public class TableField extends AbstractTableField<ITable> {
+ @Override
+ protected boolean getConfiguredLabelVisible() {
+ return false;
+ }
+
+ @Override
+ protected int getConfiguredGridW() {
+ return FULL_WIDTH;
+ }
+
+ @Override
+ protected int getConfiguredGridH() {
+ return 7;
+ }
+
+ @Override
+ protected double getConfiguredGridWeightY() {
+ return 1;
+ }
+
+ }
+
+ @Order(30)
+ public class DetailFormField extends AbstractWrappedFormField<IForm> {
+ @Override
+ protected boolean getConfiguredVisible() {
+ return true;
+ }
+
+ @Override
+ protected int getConfiguredGridW() {
+ return FULL_WIDTH;
+ }
+
+ @Override
+ protected boolean execCalculateVisible() {
+ return getInnerForm() != null;
+ }
+ }
+
+ public static class SimpleOutline extends AbstractOutline {
+
+ @Override
+ protected boolean getConfiguredRootNodeVisible() {
+ return true;
+ }
+
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/pagefield/IPageField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/pagefield/IPageField.java
index 2237bf871d..2de5e65817 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/pagefield/IPageField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/pagefield/IPageField.java
@@ -1,35 +1,35 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.pagefield;
-
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox;
-import org.eclipse.scout.rt.client.ui.form.fields.tablefield.ITableField;
-import org.eclipse.scout.rt.client.ui.form.fields.wrappedform.IWrappedFormField;
-
-/**
- * Representation of a page as a composite of detailForm, table, searchForm for
- * usage inside a {@link IForm}
- */
-public interface IPageField<T extends IPage> extends IGroupBox {
-
- T getPage();
-
- void setPage(T newPage);
-
- IWrappedFormField<IForm> getDetailFormField();
-
- ITableField<ITable> getTableField();
-
- IWrappedFormField<IForm> getSearchFormField();
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.pagefield;
+
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox;
+import org.eclipse.scout.rt.client.ui.form.fields.tablefield.ITableField;
+import org.eclipse.scout.rt.client.ui.form.fields.wrappedform.IWrappedFormField;
+
+/**
+ * Representation of a page as a composite of detailForm, table, searchForm for
+ * usage inside a {@link IForm}
+ */
+public interface IPageField<T extends IPage> extends IGroupBox {
+
+ T getPage();
+
+ void setPage(T newPage);
+
+ IWrappedFormField<IForm> getDetailFormField();
+
+ ITableField<ITable> getTableField();
+
+ IWrappedFormField<IForm> getSearchFormField();
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/placeholder/AbstractPlaceholderField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/placeholder/AbstractPlaceholderField.java
index c7e3fdb6ab..21a8068405 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/placeholder/AbstractPlaceholderField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/placeholder/AbstractPlaceholderField.java
@@ -1,33 +1,33 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.placeholder;
-
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.form.fields.AbstractFormField;
-
-public abstract class AbstractPlaceholderField extends AbstractFormField implements IPlaceholderField {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractPlaceholderField.class);
-
- public AbstractPlaceholderField() {
- this(true);
- }
-
- public AbstractPlaceholderField(boolean callInitializer) {
- super(callInitializer);
- }
-
- @Override
- protected void initConfig() {
- super.initConfig();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.placeholder;
+
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.form.fields.AbstractFormField;
+
+public abstract class AbstractPlaceholderField extends AbstractFormField implements IPlaceholderField {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractPlaceholderField.class);
+
+ public AbstractPlaceholderField() {
+ this(true);
+ }
+
+ public AbstractPlaceholderField(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ @Override
+ protected void initConfig() {
+ super.initConfig();
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/placeholder/IPlaceholderField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/placeholder/IPlaceholderField.java
index 5a199c409d..f5947eb843 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/placeholder/IPlaceholderField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/placeholder/IPlaceholderField.java
@@ -1,17 +1,17 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.placeholder;
-
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-
-public interface IPlaceholderField extends IFormField {
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.placeholder;
+
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+
+public interface IPlaceholderField extends IFormField {
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/plannerfield/AbstractPlannerField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/plannerfield/AbstractPlannerField.java
index c6b4ff7445..27a0386790 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/plannerfield/AbstractPlannerField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/plannerfield/AbstractPlannerField.java
@@ -1,420 +1,420 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.plannerfield;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.ArrayList;
-import java.util.HashSet;
-
-import org.eclipse.scout.commons.ConfigurationUtility;
-import org.eclipse.scout.commons.annotations.ConfigOperation;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.basic.activitymap.AbstractActivityMap;
-import org.eclipse.scout.rt.client.ui.basic.activitymap.ActivityCell;
-import org.eclipse.scout.rt.client.ui.basic.activitymap.IActivityMap;
-import org.eclipse.scout.rt.client.ui.basic.table.AbstractTable;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.client.ui.basic.table.TableAdapter;
-import org.eclipse.scout.rt.client.ui.basic.table.TableEvent;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-import org.eclipse.scout.rt.client.ui.form.fields.AbstractFormField;
-import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
-import org.eclipse.scout.service.SERVICES;
-
-public abstract class AbstractPlannerField<T extends ITable, P extends IActivityMap> extends AbstractFormField implements IPlannerField<T, P> {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractPlannerField.class);
-
- private IPlannerFieldUIFacade m_uiFacade;
- private T m_resourceTable;
- private IColumn<Long> m_resourceIdColumn;
- private P m_activityMap;
- private boolean m_selectionMediatorRunning;// true when mediation is running
-
- public AbstractPlannerField() {
- this(true);
- }
-
- public AbstractPlannerField(boolean callInitializer) {
- super(callInitializer);
- }
-
- /*
- * Configuration
- */
- private Class<? extends ITable> getConfiguredResourceTable() {
- Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
- return ConfigurationUtility.filterClass(dca, ITable.class);
- }
-
- private Class<? extends IActivityMap> getConfiguredActivityMap() {
- Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
- return ConfigurationUtility.filterClass(dca, IActivityMap.class);
- }
-
- @ConfigProperty(ConfigProperty.INTEGER)
- @Order(10)
- @ConfigPropertyValue("2")
- protected int getConfiguredMiniCalendarCount() {
- return 2;
- }
-
- @ConfigProperty(ConfigProperty.INTEGER)
- @Order(20)
- @ConfigPropertyValue("168")
- protected int getConfiguredSplitterPosition() {
- return 168;
- }
-
- @Override
- protected void execChangedMasterValue(Object newMasterValue) throws ProcessingException {
- loadResourceTableData();
- }
-
- @ConfigOperation
- @Order(10)
- protected Object[][] execLoadResourceTableData() throws ProcessingException {
- return null;
- }
-
- /**
- * interceptor is called after data was fetched from LookupCall and is adding
- * a table row for every LookupRow using IListBoxTable.createTableRow(row) and
- * ITable.addRows()
- * <p>
- * For most cases the override of just {@link #execLoadTableData()} is sufficient
- *
- * <pre>
- * Object[][] data = execLoadResourceTableData();
- * getResourceTable().replaceRowsByMatrix(data);
- * </pre>
- */
- @ConfigOperation
- @Order(20)
- protected void execPopulateResourceTable() throws ProcessingException {
- Object[][] data = execLoadResourceTableData();
- getResourceTable().replaceRowsByMatrix(data);
- }
-
- /**
- * Load data matrix with the maximum of the following columns:
- * <ul>
- * <li>resourceId
- * <li>activityId
- * <li>startTime
- * <li>endTime
- * <li>text
- * <li>tooltipText
- * <li>iconId
- * <li>majorValue
- * <li>minorValue
- * </ul>
- */
- @ConfigOperation
- @Order(10)
- protected Object[][] execLoadActivityMapData(Long[] resourceIds, ITableRow[] resourceRows) throws ProcessingException {
- return null;
- }
-
- /**
- * Load activity data<br>
- * By default loads data using {@link #execLoadActivityMapData(ITableRow[], long[])}, transforms to
- * {@link ActivityCell}, maps to resources using the resourceId, and sets the {@link ActivityCell}s on the
- * coresponding activtyRow.
- */
- @ConfigOperation
- @Order(10)
- protected void execPopulateActivities(Long[] resourceIds, ITableRow[] resourceRows) throws ProcessingException {
- Object[][] data = execLoadActivityMapData(resourceIds, resourceRows);
- ArrayList<ActivityCell> list = new ArrayList<ActivityCell>();
- for (Object[] row : data) {
- ActivityCell cell = new ActivityCell(row);
- list.add(cell);
- }
- getActivityMap().removeActivityCells(resourceIds);
- getActivityMap().addActivityCells(list.toArray(new ActivityCell[list.size()]));
- }
-
- @Override
- @SuppressWarnings("unchecked")
- protected void initConfig() {
- m_uiFacade = new P_PlannerFieldUIFacade();
- super.initConfig();
- setMiniCalendarCount(getConfiguredMiniCalendarCount());
- setSplitterPosition(getConfiguredSplitterPosition());
- if (getConfiguredResourceTable() != null) {
- try {
- m_resourceTable = (T) ConfigurationUtility.newInnerInstance(this, getConfiguredResourceTable());
- if (m_resourceTable instanceof AbstractTable) {
- ((AbstractTable) m_resourceTable).setContainerInternal(this);
- }
- m_resourceTable.setEnabled(isEnabled());
- }
- catch (Exception e) {
- LOG.warn(null, e);
- }
- for (IColumn c : getResourceTable().getColumnSet().getKeyColumns()) {
- if (Long.class.isAssignableFrom(c.getDataType())) {
- m_resourceIdColumn = c;
- break;
- }
- }
- }
- else {
- LOG.warn("there is no inner class of type ITable in " + getClass());
- }
- if (getConfiguredActivityMap() != null) {
- try {
- m_activityMap = (P) ConfigurationUtility.newInnerInstance(this, getConfiguredActivityMap());
- }
- catch (Exception e) {
- LOG.warn(null, e);
- }
- if (m_activityMap instanceof AbstractActivityMap) {
- ((AbstractActivityMap) m_activityMap).setContainerInternal(this);
- }
- }
- else {
- LOG.warn("there is no inner class of type IActivityMap in " + getClass());
- }
- // add mediator between resource table and activitymap table
- m_resourceTable.addTableListener(new P_ResourceTableListener());
- m_activityMap.addPropertyChangeListener(
- new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent e) {
- if (e.getPropertyName().equals(IActivityMap.PROP_SELECTED_RESOURCE_IDS)) {
- syncSelectionFromActivityToResource();
- }
- }
- }
- );
- }
-
- /*
- * Runtime
- */
-
- private IColumn<Long> getResourceIdColumnInternal() {
- return m_resourceIdColumn;
- }
-
- @Override
- protected void initFieldInternal() throws ProcessingException {
- getResourceTable().initTable();
- getActivityMap().initActivityMap();
- super.initFieldInternal();
- }
-
- @Override
- protected void disposeFieldInternal() {
- super.disposeFieldInternal();
- getResourceTable().disposeTable();
- getActivityMap().disposeActivityMap();
- }
-
- @Override
- public int getMiniCalendarCount() {
- return propertySupport.getPropertyInt(PROP_MINI_CALENDAR_COUNT);
- }
-
- @Override
- public void setMiniCalendarCount(int n) {
- if (n < 0 || n > 6) {
- return;// ignore it
- }
- propertySupport.setPropertyInt(PROP_MINI_CALENDAR_COUNT, n);
- }
-
- @Override
- public int getSplitterPosition() {
- return propertySupport.getPropertyInt(PROP_SPLITTER_POSITION);
- }
-
- @Override
- public void setSplitterPosition(int splitterPosition) {
- propertySupport.setPropertyInt(PROP_SPLITTER_POSITION, splitterPosition);
- }
-
- @Override
- public final T getResourceTable() {
- return m_resourceTable;
- }
-
- @Override
- public final P getActivityMap() {
- return m_activityMap;
- }
-
- @Override
- public void loadResourceTableData() throws ProcessingException {
- execPopulateResourceTable();
- }
-
- @Override
- public void loadActivityMapData() throws ProcessingException {
- loadActivityMapDataInternal(getResourceTable().getRows());
- }
-
- @Override
- public void loadActivityMapDataOfSelectedRecources() throws ProcessingException {
- loadActivityMapDataInternal(getResourceTable().getSelectedRows());
- }
-
- private void loadActivityMapDataInternal(ITableRow[] resourceRows) throws ProcessingException {
- Long[] resourceIds = getResourceIdColumnInternal().getValues(resourceRows);
- try {
- getActivityMap().setActivityMapChanging(true);
- //
- execPopulateActivities(resourceIds, resourceRows);
- }
- finally {
- getActivityMap().setActivityMapChanging(false);
- }
- }
-
- @Override
- public ITableRow activityCellToResourceRow(ActivityCell activityCell) {
- if (activityCell != null) {
- return getResourceIdColumnInternal().findRow(activityCell.getResourceId());
- }
- else {
- return null;
- }
- }
-
- @Override
- public ITableRow[] activityCellsToResourceRows(ActivityCell[] activityCells) {
- HashSet<ITableRow> resourceRowSet = new HashSet<ITableRow>();
- for (ActivityCell cell : activityCells) {
- ITableRow resourceRow = getResourceIdColumnInternal().findRow(cell.getResourceId());
- if (resourceRow != null) {
- resourceRowSet.add(resourceRow);
- }
- }
- return resourceRowSet.toArray(new ITableRow[resourceRowSet.size()]);
- }
-
- @Override
- public ActivityCell[] resourceRowToActivityCells(ITableRow resourceRow) {
- return resourceRowsToActivityCells(new ITableRow[]{resourceRow});
- }
-
- @Override
- public ActivityCell[] resourceRowsToActivityCells(ITableRow[] resourceRows) {
- return getActivityMap().getActivityCells(getResourceIdColumnInternal().getValues(resourceRows));
- }
-
- private void syncSelectionFromResourceToActivity() {
- if (m_selectionMediatorRunning) {
- return;
- }
- try {
- m_selectionMediatorRunning = true;
- //
- getActivityMap().setSelectedResourceIds(getResourceIdColumnInternal().getSelectedValues());
- }
- finally {
- m_selectionMediatorRunning = false;
- }
- }
-
- private void syncSelectionFromActivityToResource() {
- if (m_selectionMediatorRunning) {
- return;
- }
- try {
- m_selectionMediatorRunning = true;
- //
- ITableRow[] resourceRows = getResourceIdColumnInternal().findRows(getActivityMap().getSelectedResourceIds());
- getResourceTable().selectRows(resourceRows, false);
- }
- finally {
- m_selectionMediatorRunning = false;
- }
- }
-
- @Override
- public IPlannerFieldUIFacade getUIFacade() {
- return m_uiFacade;
- }
-
- private class P_PlannerFieldUIFacade implements IPlannerFieldUIFacade {
-
- @Override
- public void refreshFromUI() {
- try {
- loadResourceTableData();
- }
- catch (ProcessingException e) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- }
-
- }
-
- private class P_ResourceTableListener extends TableAdapter {
- @Override
- public void tableChanged(TableEvent e) {
- //reset resourceId mappings
- switch (e.getType()) {
- case TableEvent.TYPE_ALL_ROWS_DELETED:
- case TableEvent.TYPE_ROWS_DELETED:
- case TableEvent.TYPE_ROWS_INSERTED:
- case TableEvent.TYPE_ROW_FILTER_CHANGED:
- case TableEvent.TYPE_ROW_ORDER_CHANGED: {
- m_activityMap.setResourceIds(getResourceIdColumnInternal().getValues(getResourceTable().getFilteredRows()));
- break;
- }
- }
- //load additional data
- switch (e.getType()) {
- case TableEvent.TYPE_ROW_FILTER_CHANGED: {
- try {
- loadActivityMapDataInternal(getResourceTable().getFilteredRows());
- }
- catch (ProcessingException ex) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(ex);
- }
- }
- case TableEvent.TYPE_ROWS_INSERTED: {
- try {
- loadActivityMapDataInternal(e.getRows());
- }
- catch (ProcessingException ex) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(ex);
- }
- break;
- }
- case TableEvent.TYPE_ROWS_UPDATED: {
- try {
- loadActivityMapDataInternal(e.getRows());
- }
- catch (ProcessingException ex) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(ex);
- }
- break;
- }
- case TableEvent.TYPE_ROWS_SELECTED: {
- syncSelectionFromResourceToActivity();
- break;
- }
- }
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.plannerfield;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.ArrayList;
+import java.util.HashSet;
+
+import org.eclipse.scout.commons.ConfigurationUtility;
+import org.eclipse.scout.commons.annotations.ConfigOperation;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.basic.activitymap.AbstractActivityMap;
+import org.eclipse.scout.rt.client.ui.basic.activitymap.ActivityCell;
+import org.eclipse.scout.rt.client.ui.basic.activitymap.IActivityMap;
+import org.eclipse.scout.rt.client.ui.basic.table.AbstractTable;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.client.ui.basic.table.TableAdapter;
+import org.eclipse.scout.rt.client.ui.basic.table.TableEvent;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+import org.eclipse.scout.rt.client.ui.form.fields.AbstractFormField;
+import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
+import org.eclipse.scout.service.SERVICES;
+
+public abstract class AbstractPlannerField<T extends ITable, P extends IActivityMap> extends AbstractFormField implements IPlannerField<T, P> {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractPlannerField.class);
+
+ private IPlannerFieldUIFacade m_uiFacade;
+ private T m_resourceTable;
+ private IColumn<Long> m_resourceIdColumn;
+ private P m_activityMap;
+ private boolean m_selectionMediatorRunning;// true when mediation is running
+
+ public AbstractPlannerField() {
+ this(true);
+ }
+
+ public AbstractPlannerField(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ /*
+ * Configuration
+ */
+ private Class<? extends ITable> getConfiguredResourceTable() {
+ Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
+ return ConfigurationUtility.filterClass(dca, ITable.class);
+ }
+
+ private Class<? extends IActivityMap> getConfiguredActivityMap() {
+ Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
+ return ConfigurationUtility.filterClass(dca, IActivityMap.class);
+ }
+
+ @ConfigProperty(ConfigProperty.INTEGER)
+ @Order(10)
+ @ConfigPropertyValue("2")
+ protected int getConfiguredMiniCalendarCount() {
+ return 2;
+ }
+
+ @ConfigProperty(ConfigProperty.INTEGER)
+ @Order(20)
+ @ConfigPropertyValue("168")
+ protected int getConfiguredSplitterPosition() {
+ return 168;
+ }
+
+ @Override
+ protected void execChangedMasterValue(Object newMasterValue) throws ProcessingException {
+ loadResourceTableData();
+ }
+
+ @ConfigOperation
+ @Order(10)
+ protected Object[][] execLoadResourceTableData() throws ProcessingException {
+ return null;
+ }
+
+ /**
+ * interceptor is called after data was fetched from LookupCall and is adding
+ * a table row for every LookupRow using IListBoxTable.createTableRow(row) and
+ * ITable.addRows()
+ * <p>
+ * For most cases the override of just {@link #execLoadTableData()} is sufficient
+ *
+ * <pre>
+ * Object[][] data = execLoadResourceTableData();
+ * getResourceTable().replaceRowsByMatrix(data);
+ * </pre>
+ */
+ @ConfigOperation
+ @Order(20)
+ protected void execPopulateResourceTable() throws ProcessingException {
+ Object[][] data = execLoadResourceTableData();
+ getResourceTable().replaceRowsByMatrix(data);
+ }
+
+ /**
+ * Load data matrix with the maximum of the following columns:
+ * <ul>
+ * <li>resourceId
+ * <li>activityId
+ * <li>startTime
+ * <li>endTime
+ * <li>text
+ * <li>tooltipText
+ * <li>iconId
+ * <li>majorValue
+ * <li>minorValue
+ * </ul>
+ */
+ @ConfigOperation
+ @Order(10)
+ protected Object[][] execLoadActivityMapData(Long[] resourceIds, ITableRow[] resourceRows) throws ProcessingException {
+ return null;
+ }
+
+ /**
+ * Load activity data<br>
+ * By default loads data using {@link #execLoadActivityMapData(ITableRow[], long[])}, transforms to
+ * {@link ActivityCell}, maps to resources using the resourceId, and sets the {@link ActivityCell}s on the
+ * coresponding activtyRow.
+ */
+ @ConfigOperation
+ @Order(10)
+ protected void execPopulateActivities(Long[] resourceIds, ITableRow[] resourceRows) throws ProcessingException {
+ Object[][] data = execLoadActivityMapData(resourceIds, resourceRows);
+ ArrayList<ActivityCell> list = new ArrayList<ActivityCell>();
+ for (Object[] row : data) {
+ ActivityCell cell = new ActivityCell(row);
+ list.add(cell);
+ }
+ getActivityMap().removeActivityCells(resourceIds);
+ getActivityMap().addActivityCells(list.toArray(new ActivityCell[list.size()]));
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ protected void initConfig() {
+ m_uiFacade = new P_PlannerFieldUIFacade();
+ super.initConfig();
+ setMiniCalendarCount(getConfiguredMiniCalendarCount());
+ setSplitterPosition(getConfiguredSplitterPosition());
+ if (getConfiguredResourceTable() != null) {
+ try {
+ m_resourceTable = (T) ConfigurationUtility.newInnerInstance(this, getConfiguredResourceTable());
+ if (m_resourceTable instanceof AbstractTable) {
+ ((AbstractTable) m_resourceTable).setContainerInternal(this);
+ }
+ m_resourceTable.setEnabled(isEnabled());
+ }
+ catch (Exception e) {
+ LOG.warn(null, e);
+ }
+ for (IColumn c : getResourceTable().getColumnSet().getKeyColumns()) {
+ if (Long.class.isAssignableFrom(c.getDataType())) {
+ m_resourceIdColumn = c;
+ break;
+ }
+ }
+ }
+ else {
+ LOG.warn("there is no inner class of type ITable in " + getClass());
+ }
+ if (getConfiguredActivityMap() != null) {
+ try {
+ m_activityMap = (P) ConfigurationUtility.newInnerInstance(this, getConfiguredActivityMap());
+ }
+ catch (Exception e) {
+ LOG.warn(null, e);
+ }
+ if (m_activityMap instanceof AbstractActivityMap) {
+ ((AbstractActivityMap) m_activityMap).setContainerInternal(this);
+ }
+ }
+ else {
+ LOG.warn("there is no inner class of type IActivityMap in " + getClass());
+ }
+ // add mediator between resource table and activitymap table
+ m_resourceTable.addTableListener(new P_ResourceTableListener());
+ m_activityMap.addPropertyChangeListener(
+ new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent e) {
+ if (e.getPropertyName().equals(IActivityMap.PROP_SELECTED_RESOURCE_IDS)) {
+ syncSelectionFromActivityToResource();
+ }
+ }
+ }
+ );
+ }
+
+ /*
+ * Runtime
+ */
+
+ private IColumn<Long> getResourceIdColumnInternal() {
+ return m_resourceIdColumn;
+ }
+
+ @Override
+ protected void initFieldInternal() throws ProcessingException {
+ getResourceTable().initTable();
+ getActivityMap().initActivityMap();
+ super.initFieldInternal();
+ }
+
+ @Override
+ protected void disposeFieldInternal() {
+ super.disposeFieldInternal();
+ getResourceTable().disposeTable();
+ getActivityMap().disposeActivityMap();
+ }
+
+ @Override
+ public int getMiniCalendarCount() {
+ return propertySupport.getPropertyInt(PROP_MINI_CALENDAR_COUNT);
+ }
+
+ @Override
+ public void setMiniCalendarCount(int n) {
+ if (n < 0 || n > 6) {
+ return;// ignore it
+ }
+ propertySupport.setPropertyInt(PROP_MINI_CALENDAR_COUNT, n);
+ }
+
+ @Override
+ public int getSplitterPosition() {
+ return propertySupport.getPropertyInt(PROP_SPLITTER_POSITION);
+ }
+
+ @Override
+ public void setSplitterPosition(int splitterPosition) {
+ propertySupport.setPropertyInt(PROP_SPLITTER_POSITION, splitterPosition);
+ }
+
+ @Override
+ public final T getResourceTable() {
+ return m_resourceTable;
+ }
+
+ @Override
+ public final P getActivityMap() {
+ return m_activityMap;
+ }
+
+ @Override
+ public void loadResourceTableData() throws ProcessingException {
+ execPopulateResourceTable();
+ }
+
+ @Override
+ public void loadActivityMapData() throws ProcessingException {
+ loadActivityMapDataInternal(getResourceTable().getRows());
+ }
+
+ @Override
+ public void loadActivityMapDataOfSelectedRecources() throws ProcessingException {
+ loadActivityMapDataInternal(getResourceTable().getSelectedRows());
+ }
+
+ private void loadActivityMapDataInternal(ITableRow[] resourceRows) throws ProcessingException {
+ Long[] resourceIds = getResourceIdColumnInternal().getValues(resourceRows);
+ try {
+ getActivityMap().setActivityMapChanging(true);
+ //
+ execPopulateActivities(resourceIds, resourceRows);
+ }
+ finally {
+ getActivityMap().setActivityMapChanging(false);
+ }
+ }
+
+ @Override
+ public ITableRow activityCellToResourceRow(ActivityCell activityCell) {
+ if (activityCell != null) {
+ return getResourceIdColumnInternal().findRow(activityCell.getResourceId());
+ }
+ else {
+ return null;
+ }
+ }
+
+ @Override
+ public ITableRow[] activityCellsToResourceRows(ActivityCell[] activityCells) {
+ HashSet<ITableRow> resourceRowSet = new HashSet<ITableRow>();
+ for (ActivityCell cell : activityCells) {
+ ITableRow resourceRow = getResourceIdColumnInternal().findRow(cell.getResourceId());
+ if (resourceRow != null) {
+ resourceRowSet.add(resourceRow);
+ }
+ }
+ return resourceRowSet.toArray(new ITableRow[resourceRowSet.size()]);
+ }
+
+ @Override
+ public ActivityCell[] resourceRowToActivityCells(ITableRow resourceRow) {
+ return resourceRowsToActivityCells(new ITableRow[]{resourceRow});
+ }
+
+ @Override
+ public ActivityCell[] resourceRowsToActivityCells(ITableRow[] resourceRows) {
+ return getActivityMap().getActivityCells(getResourceIdColumnInternal().getValues(resourceRows));
+ }
+
+ private void syncSelectionFromResourceToActivity() {
+ if (m_selectionMediatorRunning) {
+ return;
+ }
+ try {
+ m_selectionMediatorRunning = true;
+ //
+ getActivityMap().setSelectedResourceIds(getResourceIdColumnInternal().getSelectedValues());
+ }
+ finally {
+ m_selectionMediatorRunning = false;
+ }
+ }
+
+ private void syncSelectionFromActivityToResource() {
+ if (m_selectionMediatorRunning) {
+ return;
+ }
+ try {
+ m_selectionMediatorRunning = true;
+ //
+ ITableRow[] resourceRows = getResourceIdColumnInternal().findRows(getActivityMap().getSelectedResourceIds());
+ getResourceTable().selectRows(resourceRows, false);
+ }
+ finally {
+ m_selectionMediatorRunning = false;
+ }
+ }
+
+ @Override
+ public IPlannerFieldUIFacade getUIFacade() {
+ return m_uiFacade;
+ }
+
+ private class P_PlannerFieldUIFacade implements IPlannerFieldUIFacade {
+
+ @Override
+ public void refreshFromUI() {
+ try {
+ loadResourceTableData();
+ }
+ catch (ProcessingException e) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ }
+
+ }
+
+ private class P_ResourceTableListener extends TableAdapter {
+ @Override
+ public void tableChanged(TableEvent e) {
+ //reset resourceId mappings
+ switch (e.getType()) {
+ case TableEvent.TYPE_ALL_ROWS_DELETED:
+ case TableEvent.TYPE_ROWS_DELETED:
+ case TableEvent.TYPE_ROWS_INSERTED:
+ case TableEvent.TYPE_ROW_FILTER_CHANGED:
+ case TableEvent.TYPE_ROW_ORDER_CHANGED: {
+ m_activityMap.setResourceIds(getResourceIdColumnInternal().getValues(getResourceTable().getFilteredRows()));
+ break;
+ }
+ }
+ //load additional data
+ switch (e.getType()) {
+ case TableEvent.TYPE_ROW_FILTER_CHANGED: {
+ try {
+ loadActivityMapDataInternal(getResourceTable().getFilteredRows());
+ }
+ catch (ProcessingException ex) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(ex);
+ }
+ }
+ case TableEvent.TYPE_ROWS_INSERTED: {
+ try {
+ loadActivityMapDataInternal(e.getRows());
+ }
+ catch (ProcessingException ex) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(ex);
+ }
+ break;
+ }
+ case TableEvent.TYPE_ROWS_UPDATED: {
+ try {
+ loadActivityMapDataInternal(e.getRows());
+ }
+ catch (ProcessingException ex) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(ex);
+ }
+ break;
+ }
+ case TableEvent.TYPE_ROWS_SELECTED: {
+ syncSelectionFromResourceToActivity();
+ break;
+ }
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/plannerfield/IPlannerField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/plannerfield/IPlannerField.java
index d411d62aa9..2a5b79f086 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/plannerfield/IPlannerField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/plannerfield/IPlannerField.java
@@ -1,92 +1,92 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.plannerfield;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.basic.activitymap.ActivityCell;
-import org.eclipse.scout.rt.client.ui.basic.activitymap.IActivityMap;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-
-/**
- * The planner contains a list of resources that are associated with 0..n
- * timeline activities.<br>
- * As "meeting planner", the subjects are "persons" and the activities are
- * "busy/free" timespans.
- * <p>
- * This class strintly uses java.util.Date staticly AND dynamicly<br>
- * All Date-Objects and subclasses are run through {@link com.bsiag.DateUtility#toUtilDate(java.util.Date)}()
- * <p>
- * The planner field contains a ITable and a IPlanner<br>
- * The inner table contains at least one primary key column, the first primary key column of type Long is assumed to be
- * the resourceId column.<br>
- * which values are passed to {@link #execLoadActivityMapData(ITableRow[])} and {@link #execLoadActivities(ITableRow[])}
- * <p>
- * Example usage:
- *
- * <pre>
- * public class ExamplePlannerField extends AbstractPlannerField&lt;ExamplePlannerField.ResourceTable, ExamplePlannerField.ActivityMap&gt; {
- * public class ResourceTable extends AbstractTable {
- * public class ResourceIdColumn extends AbstractLongColumn {
- * }
- * }
- *
- * public class ActivityMap extends AbstractActivityMap {
- * }
- * }
- * </pre>
- */
-
-public interface IPlannerField<T extends ITable, P extends IActivityMap> extends IFormField {
-
- String PROP_MINI_CALENDAR_COUNT = "miniCalendarCount";
-
- String PROP_SPLITTER_POSITION = "splitterPosition";
-
- T getResourceTable();
-
- P getActivityMap();
-
- int getMiniCalendarCount();
-
- void setMiniCalendarCount(int n);
-
- int getSplitterPosition();
-
- void setSplitterPosition(int splitterPosition);
-
- /**
- * (re)load table data
- */
- void loadResourceTableData() throws ProcessingException;
-
- /**
- * (re)load activity map data
- */
- void loadActivityMapData() throws ProcessingException;
-
- /**
- * (re)load activity map data of selected resources only
- */
- void loadActivityMapDataOfSelectedRecources() throws ProcessingException;
-
- ITableRow activityCellToResourceRow(ActivityCell activityCell);
-
- ITableRow[] activityCellsToResourceRows(ActivityCell[] activityCells);
-
- ActivityCell[] resourceRowToActivityCells(ITableRow resourceRow);
-
- ActivityCell[] resourceRowsToActivityCells(ITableRow[] resourceRows);
-
- IPlannerFieldUIFacade getUIFacade();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.plannerfield;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.basic.activitymap.ActivityCell;
+import org.eclipse.scout.rt.client.ui.basic.activitymap.IActivityMap;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+
+/**
+ * The planner contains a list of resources that are associated with 0..n
+ * timeline activities.<br>
+ * As "meeting planner", the subjects are "persons" and the activities are
+ * "busy/free" timespans.
+ * <p>
+ * This class strintly uses java.util.Date staticly AND dynamicly<br>
+ * All Date-Objects and subclasses are run through {@link com.bsiag.DateUtility#toUtilDate(java.util.Date)}()
+ * <p>
+ * The planner field contains a ITable and a IPlanner<br>
+ * The inner table contains at least one primary key column, the first primary key column of type Long is assumed to be
+ * the resourceId column.<br>
+ * which values are passed to {@link #execLoadActivityMapData(ITableRow[])} and {@link #execLoadActivities(ITableRow[])}
+ * <p>
+ * Example usage:
+ *
+ * <pre>
+ * public class ExamplePlannerField extends AbstractPlannerField&lt;ExamplePlannerField.ResourceTable, ExamplePlannerField.ActivityMap&gt; {
+ * public class ResourceTable extends AbstractTable {
+ * public class ResourceIdColumn extends AbstractLongColumn {
+ * }
+ * }
+ *
+ * public class ActivityMap extends AbstractActivityMap {
+ * }
+ * }
+ * </pre>
+ */
+
+public interface IPlannerField<T extends ITable, P extends IActivityMap> extends IFormField {
+
+ String PROP_MINI_CALENDAR_COUNT = "miniCalendarCount";
+
+ String PROP_SPLITTER_POSITION = "splitterPosition";
+
+ T getResourceTable();
+
+ P getActivityMap();
+
+ int getMiniCalendarCount();
+
+ void setMiniCalendarCount(int n);
+
+ int getSplitterPosition();
+
+ void setSplitterPosition(int splitterPosition);
+
+ /**
+ * (re)load table data
+ */
+ void loadResourceTableData() throws ProcessingException;
+
+ /**
+ * (re)load activity map data
+ */
+ void loadActivityMapData() throws ProcessingException;
+
+ /**
+ * (re)load activity map data of selected resources only
+ */
+ void loadActivityMapDataOfSelectedRecources() throws ProcessingException;
+
+ ITableRow activityCellToResourceRow(ActivityCell activityCell);
+
+ ITableRow[] activityCellsToResourceRows(ActivityCell[] activityCells);
+
+ ActivityCell[] resourceRowToActivityCells(ITableRow resourceRow);
+
+ ActivityCell[] resourceRowsToActivityCells(ITableRow[] resourceRows);
+
+ IPlannerFieldUIFacade getUIFacade();
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/plannerfield/IPlannerFieldUIFacade.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/plannerfield/IPlannerFieldUIFacade.java
index 9b8ed699bf..2144fbbe02 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/plannerfield/IPlannerFieldUIFacade.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/plannerfield/IPlannerFieldUIFacade.java
@@ -1,17 +1,17 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.plannerfield;
-
-public interface IPlannerFieldUIFacade {
-
- void refreshFromUI();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.plannerfield;
+
+public interface IPlannerFieldUIFacade {
+
+ void refreshFromUI();
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/radiobuttongroup/AbstractRadioButtonGroup.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/radiobuttongroup/AbstractRadioButtonGroup.java
index 78b3a46cb0..61ad625cdb 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/radiobuttongroup/AbstractRadioButtonGroup.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/radiobuttongroup/AbstractRadioButtonGroup.java
@@ -1,644 +1,644 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.radiobuttongroup;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.commons.ConfigurationUtility;
-import org.eclipse.scout.commons.TriState;
-import org.eclipse.scout.commons.TypeCastUtility;
-import org.eclipse.scout.commons.annotations.ConfigOperation;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.holders.Holder;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.services.lookup.FormFieldProvisioningContext;
-import org.eclipse.scout.rt.client.services.lookup.ILookupCallProvisioningService;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.client.ui.form.IFormFieldVisitor;
-import org.eclipse.scout.rt.client.ui.form.fields.AbstractValueField;
-import org.eclipse.scout.rt.client.ui.form.fields.ICompositeField;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractButton;
-import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
-import org.eclipse.scout.rt.client.ui.form.fields.radiobuttongroup.internal.RadioButtonGroupGrid;
-import org.eclipse.scout.rt.shared.data.form.ValidationRule;
-import org.eclipse.scout.rt.shared.services.common.code.CODES;
-import org.eclipse.scout.rt.shared.services.common.code.ICodeType;
-import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
-import org.eclipse.scout.rt.shared.services.lookup.CodeLookupCall;
-import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
-import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
-import org.eclipse.scout.service.SERVICES;
-
-/**
- * The listbox value is a Object[] where the Object[] is the set of selected
- * keys of the listbox<br>
- * the inner table shows those rows as selected which have the key value as a
- * part of the listbox value (Object[])
- * <p>
- * Note, that the listbox might not necessarily show all selected rows since the value of the listbox might contain
- * inactive keys that are not reflected in the listbox<br>
- * Therefore an empty listbox table is not the same as a listbox with an empty value (null)
- */
-public abstract class AbstractRadioButtonGroup<T> extends AbstractValueField<T> implements IRadioButtonGroup<T>, ICompositeField {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractRadioButtonGroup.class);
-
- private boolean m_valueAndSelectionMediatorActive;
- private LookupCall m_lookupCall;
- private Class<? extends ICodeType> m_codeTypeClass;
- private RadioButtonGroupGrid m_grid;
- private IFormField[] m_fields;
- private IButton[] m_radioButtons;
-
- public AbstractRadioButtonGroup() {
- this(true);
- }
-
- public AbstractRadioButtonGroup(boolean callInitializer) {
- super(callInitializer);
- }
-
- /*
- * Configuration
- */
-
- /**
- * Use a {@link LookupCall} which is able to handle {@link LookupCall#getDataByAll()}
- */
- @ConfigProperty(ConfigProperty.LOOKUP_CALL)
- @Order(240)
- @ConfigPropertyValue("null")
- @ValidationRule(ValidationRule.LOOKUP_CALL)
- protected Class<? extends LookupCall> getConfiguredLookupCall() {
- return null;
- }
-
- /**
- * All codes returned by the configured {@link ICodeType} are used as radio
- * buttons.<br>
- * However, the {@link #execFilterLookupResult(LookupCall, List)} can be used
- * to manipulate the codes which shall be used.
- */
- @ConfigProperty(ConfigProperty.CODE_TYPE)
- @Order(250)
- @ConfigPropertyValue("null")
- @ValidationRule(ValidationRule.CODE_TYPE)
- protected Class<? extends ICodeType> getConfiguredCodeType() {
- return null;
- }
-
- /**
- * Called before any lookup is performed
- */
- @ConfigOperation
- @Order(260)
- protected void execPrepareLookup(LookupCall call) {
- }
-
- /**
- * @param call
- * that produced this result
- * @param result
- * live list containing the result rows. Add, remove, set, replace
- * and clear of entries in this list is supported
- */
- @ConfigOperation
- @Order(270)
- protected void execFilterLookupResult(LookupCall call, List<LookupRow> result) throws ProcessingException {
- }
-
- @Override
- protected void initConfig() {
- m_fields = new IFormField[0];
- m_grid = new RadioButtonGroupGrid(this);
- super.initConfig();
- // Configured CodeType
- if (getConfiguredCodeType() != null) {
- setCodeTypeClass(getConfiguredCodeType());
- }
- // Configured LookupCall
- Class<? extends LookupCall> lookupCallClass = getConfiguredLookupCall();
- if (lookupCallClass != null) {
- try {
- LookupCall call = lookupCallClass.newInstance();
- setLookupCall(call);
- }
- catch (Exception e) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException(this.getClass().getSimpleName(), e));
- }
- }
- // add fields
- ArrayList<IFormField> fieldList = new ArrayList<IFormField>();
- Class<? extends IFormField>[] fieldArray = getConfiguredFields();
- for (int i = 0; i < fieldArray.length; i++) {
- IFormField f;
- try {
- f = ConfigurationUtility.newInnerInstance(this, fieldArray[i]);
- fieldList.add(f);
- }// end try
- catch (Throwable t) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("field: " + fieldArray[i].getName(), t));
- }
- }
- injectFieldsInternal(fieldList);
- for (IFormField f : fieldList) {
- f.setParentFieldInternal(this);
- }
- m_fields = fieldList.toArray(new IFormField[0]);
- //attach a proxy controller to each child field in the group for: visible, saveNeeded
- for (IFormField f : m_fields) {
- f.addPropertyChangeListener(new P_FieldPropertyChangeListenerEx());
- }
- //extract buttons from field subtree
- ArrayList<IButton> buttonList = new ArrayList<IButton>();
- for (IFormField f : m_fields) {
- IButton b = findFirstButtonInFieldTree(f);
- if (b != null) {
- buttonList.add(b);
- }
- }
- m_radioButtons = buttonList.toArray(new IButton[buttonList.size()]);
- //decorate radiobuttons
- for (IButton b : m_radioButtons) {
- b.setDisplayStyleInternal(IButton.DISPLAY_STYLE_RADIO);
- b.addPropertyChangeListener(new P_ButtonPropertyChangeListener());
- }
- handleFieldVisibilityChanged();
- }
-
- private IButton findFirstButtonInFieldTree(IFormField f) {
- if (f instanceof IButton) {
- return (IButton) f;
- }
- else if (f instanceof ICompositeField) {
- for (IFormField sub : ((ICompositeField) f).getFields()) {
- IButton b = findFirstButtonInFieldTree(sub);
- if (b != null) {
- return b;
- }
- }
- }
- return null;
- }
-
- /**
- * do not use this internal method<br>
- * Used to manage field list and add/remove fields (see {@link AbstractGroupBox} with wizard buttons)
- *
- * @param fieldList
- * live and mutable list of configured fields, not yet initialized
- * and added to composite field
- */
- protected void injectFieldsInternal(List<IFormField> fieldList) {
- if (getLookupCall() != null) {
- // Use the LookupCall
- try {
- LookupRow[] lookupRows = getLookupRows();
- for (int i = 0; i < lookupRows.length; i++) {
- RadioButton radioButton = new RadioButton();
- radioButton.setEnabled(lookupRows[i].isEnabled());
- radioButton.setLabel(lookupRows[i].getText());
- radioButton.setRadioValue(lookupRows[i].getKey());
- radioButton.setTooltipText(lookupRows[i].getTooltipText());
- radioButton.setBackgroundColor(lookupRows[i].getBackgroundColor());
- radioButton.setForegroundColor(lookupRows[i].getForegroundColor());
- radioButton.setFont(lookupRows[i].getFont());
- fieldList.add(radioButton);
- }
- }
- catch (ProcessingException e) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException(this.getClass().getSimpleName(), e));
- }
- }
- }
-
- public LookupCall getLookupCall() {
- return m_lookupCall;
- }
-
- public void setLookupCall(LookupCall call) {
- m_lookupCall = call;
- }
-
- public Class<? extends ICodeType> getCodeTypeClass() {
- return m_codeTypeClass;
- }
-
- public void setCodeTypeClass(Class<? extends ICodeType> codeTypeClass) {
- m_codeTypeClass = codeTypeClass;
- // create lookup service call
- m_lookupCall = null;
- if (m_codeTypeClass != null) {
- m_lookupCall = CodeLookupCall.newInstanceByService(m_codeTypeClass);
- }
-
- // If no label is configured use the code type's text
- if (getConfiguredLabel() == null) {
- setLabel(CODES.getCodeType(codeTypeClass).getText());
- }
- }
-
- protected Class<? extends IFormField>[] getConfiguredFields() {
- Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
- return ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, IFormField.class);
- }
-
- /*
- * Runtime
- */
- @Override
- protected void initFieldInternal() throws ProcessingException {
- // special case: a button represents null
- IButton b = getButtonFor(null);
- if (b != null) {
- syncValueToButtons();
- }
- super.initFieldInternal();
- }
-
- /**
- * Returns the LookupRows using {@link #getLookupCall()}, {@link #prepareLookupCall(LookupCall)} and
- * {@link #filterLookup(LookupCall, List)}.
- *
- * @return
- * @throws ProcessingException
- */
- private LookupRow[] getLookupRows() throws ProcessingException {
- LookupRow[] data;
- LookupCall call = null;
- // Get the data
- if (getLookupCall() != null) {
- call = SERVICES.getService(ILookupCallProvisioningService.class).newClonedInstance(getLookupCall(), new FormFieldProvisioningContext(AbstractRadioButtonGroup.this));
- prepareLookupCall(call);
- data = call.getDataByAll();
- }
- else {
- data = new LookupRow[0];
- }
-
- // Filter the result
- ArrayList<LookupRow> result;
- if (data != null) {
- result = new ArrayList<LookupRow>(Arrays.asList(data));
- }
- else {
- result = new ArrayList<LookupRow>();
- }
- filterLookup(call, result);
-
- return result.toArray(new LookupRow[result.size()]);
- }
-
- private void prepareLookupCall(LookupCall call) {
- prepareLookupCallInternal(call);
- execPrepareLookup(call);
- }
-
- private void prepareLookupCallInternal(LookupCall call) {
- call.setActive(TriState.UNDEFINED);
- //when there is a master value defined in the original call, don't set it to null when no master value is available
- if (getMasterValue() != null || getLookupCall() == null || getLookupCall().getMaster() == null) {
- call.setMaster(getMasterValue());
- }
- }
-
- private void filterLookup(LookupCall call, List<LookupRow> result) throws ProcessingException {
- execFilterLookupResult(call, result);
- }
-
- @Override
- public void rebuildFieldGrid() {
- if (m_grid != null) {
- m_grid.validate();
- if (isInitialized()) {
- if (getParentField() != null) {
- getParentField().rebuildFieldGrid();
- }
- if (getForm() != null) {
- getForm().structureChanged(this);
- }
- }
- }
- }
-
- protected void handleFieldVisibilityChanged() {
- if (isInitialized()) {
- rebuildFieldGrid();
- }
- }
-
- @Override
- public final int getGridColumnCount() {
- return m_grid != null ? m_grid.getGridColumnCount() : 1;
- }
-
- @Override
- public final int getGridRowCount() {
- return m_grid != null ? m_grid.getGridRowCount() : 1;
- }
-
- @Override
- public void setFormInternal(IForm form) {
- super.setFormInternal(form);
- for (IFormField f : getFields()) {
- f.setFormInternal(form);
- }
- }
-
- @Override
- protected void valueChangedInternal() {
- super.valueChangedInternal();
- syncValueToButtons();
- }
-
- @Override
- protected T validateValueInternal(T rawValue) throws ProcessingException {
- T validValue;
- if (rawValue == null) {
- validValue = null;
- }
- else {
- T t = TypeCastUtility.castValue(rawValue, getHolderType());
- IButton b = getButtonFor(t);
- if (b != null) {
- validValue = t;
- }
- else {
- throw new ProcessingException("Illegal radio value: " + rawValue);
- }
- }
- return validValue;
- }
-
- @Override
- @ConfigPropertyValue("0")
- protected double getConfiguredGridWeightY() {
- return 0;
- }
-
- @Override
- public T getSelectedKey() {
- return getValue();
- }
-
- @Override
- public IButton getButtonFor(T value) {
- for (IButton b : getButtons()) {
- T radioValue = TypeCastUtility.castValue(b.getRadioValue(), getHolderType());
- if (CompareUtility.equals(radioValue, value)) {
- return b;
- }
- }
- return null;
- }
-
- @Override
- public IButton getSelectedButton() {
- return getButtonFor(getSelectedKey());
- }
-
- @Override
- public void selectKey(T key) {
- setValue(key);
- }
-
- @Override
- public void selectButton(IButton button) {
- for (IButton b : getButtons()) {
- if (b == button) {
- button.setSelected(true);
- break;
- }
- }
- }
-
- /*
- * Implementation of ICompositeField
- */
-
- /**
- * broadcast this change to all children
- */
- @Override
- public void setEnabled(boolean b) {
- super.setEnabled(b);
- // recursively down all children
- for (IFormField f : m_fields) {
- f.setEnabled(b);
- }
- }
-
- /**
- * when granting of enabled property changes, broadcast and set this property
- * on all children that have no permission set
- */
- @Override
- public void setEnabledGranted(boolean b) {
- super.setEnabledGranted(b);
- for (IFormField f : getFields()) {
- if (f.getEnabledPermission() == null) {
- f.setEnabledGranted(b);
- }
- }
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public <F extends IFormField> F getFieldByClass(final Class<F> c) {
- final Holder<IFormField> found = new Holder<IFormField>(IFormField.class);
- IFormFieldVisitor v = new IFormFieldVisitor() {
- @Override
- public boolean visitField(IFormField field, int level, int fieldIndex) {
- if (field.getClass() == c) {
- found.setValue(field);
- }
- return found.getValue() == null;
- }
- };
- visitFields(v, 0);
- return (F) found.getValue();
- }
-
- @Override
- public IFormField getFieldById(final String id) {
- final Holder<IFormField> found = new Holder<IFormField>(IFormField.class);
- IFormFieldVisitor v = new IFormFieldVisitor() {
- @Override
- public boolean visitField(IFormField field, int level, int fieldIndex) {
- if (field.getFieldId().equals(id)) {
- found.setValue(field);
- }
- return found.getValue() == null;
- }
- };
- visitFields(v, 0);
- return found.getValue();
- }
-
- @Override
- public <X extends IFormField> X getFieldById(final String id, final Class<X> type) {
- final Holder<X> found = new Holder<X>(type);
- IFormFieldVisitor v = new IFormFieldVisitor() {
- @Override
- @SuppressWarnings("unchecked")
- public boolean visitField(IFormField field, int level, int fieldIndex) {
- if (type.isAssignableFrom(field.getClass()) && field.getFieldId().equals(id)) {
- found.setValue((X) field);
- }
- return found.getValue() == null;
- }
- };
- visitFields(v, 0);
- return found.getValue();
- }
-
- @Override
- public int getFieldCount() {
- return m_fields.length;
- }
-
- @Override
- public int getFieldIndex(IFormField f) {
- for (int i = 0; i < m_fields.length; i++) {
- if (m_fields[i] == f) {
- return i;
- }
- }
- return -1;
- }
-
- @Override
- public IFormField[] getFields() {
- IFormField[] a = new IFormField[m_fields.length];
- System.arraycopy(m_fields, 0, a, 0, a.length);
- return a;
- }
-
- @Override
- public IButton[] getButtons() {
- return m_radioButtons;
- }
-
- @Override
- public boolean visitFields(IFormFieldVisitor visitor, int startLevel) {
- // myself
- if (!visitor.visitField(this, startLevel, 0)) {
- return false;
- }
- // children
- int index = 0;
- IFormField[] f = m_fields;
- for (int i = 0; i < f.length; i++) {
- if (f[i] instanceof ICompositeField) {
- if (!((ICompositeField) f[i]).visitFields(visitor, startLevel + 1)) {
- return false;
- }
- }
- else {
- if (!visitor.visitField(f[i], startLevel, index)) {
- return false;
- }
- }
- index++;
- }
- return true;
- }
-
- private void syncValueToButtons() {
- if (m_valueAndSelectionMediatorActive) {
- return;
- }
- try {
- m_valueAndSelectionMediatorActive = true;
- //
- T selectedKey = getSelectedKey();
- IButton selectedButton = getButtonFor(selectedKey);
- for (IButton b : getButtons()) {
- b.setSelected(b == selectedButton);
- }
- }
- finally {
- m_valueAndSelectionMediatorActive = false;
- }
- }
-
- private void syncButtonsToValue(IButton selectedButton) {
- if (m_valueAndSelectionMediatorActive) {
- return;
- }
- try {
- m_valueAndSelectionMediatorActive = true;
- //
- for (IButton b : getButtons()) {
- b.setSelected(b == selectedButton);
- }
- T radioValue = TypeCastUtility.castValue(selectedButton.getRadioValue(), getHolderType());
- selectKey(radioValue);
- }
- finally {
- m_valueAndSelectionMediatorActive = false;
- }
- }
-
- /**
- * Implementation of PropertyChangeListener Proxy on all attached fields (not groups)
- */
- private class P_FieldPropertyChangeListenerEx implements PropertyChangeListener {
- @Override
- public void propertyChange(PropertyChangeEvent e) {
- if (e.getPropertyName().equals(IFormField.PROP_VISIBLE)) {
- // fire group box visibility
- handleFieldVisibilityChanged();
- }
- else if (e.getPropertyName().equals(IFormField.PROP_SAVE_NEEDED)) {
- checkSaveNeeded();
- }
- else if (e.getPropertyName().equals(IFormField.PROP_EMPTY)) {
- checkEmpty();
- }
- }
- }// end private class
-
- /**
- * Implementation of PropertyChangeListener Proxy on all attached fields (not groups)
- */
- private class P_ButtonPropertyChangeListener implements PropertyChangeListener {
- @Override
- public void propertyChange(PropertyChangeEvent e) {
- if (e.getPropertyName().equals(IButton.PROP_SELECTED)) {
- if (((IButton) e.getSource()).isSelected()) {
- syncButtonsToValue((IButton) e.getSource());
- }
- }
- }
- }// end private class
-
- /**
- * A dynamic unconfigured radio button
- */
- private final class RadioButton extends AbstractButton {
- @Override
- protected void initConfig() {
- super.initConfig();
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.radiobuttongroup;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.commons.ConfigurationUtility;
+import org.eclipse.scout.commons.TriState;
+import org.eclipse.scout.commons.TypeCastUtility;
+import org.eclipse.scout.commons.annotations.ConfigOperation;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.holders.Holder;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.services.lookup.FormFieldProvisioningContext;
+import org.eclipse.scout.rt.client.services.lookup.ILookupCallProvisioningService;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.client.ui.form.IFormFieldVisitor;
+import org.eclipse.scout.rt.client.ui.form.fields.AbstractValueField;
+import org.eclipse.scout.rt.client.ui.form.fields.ICompositeField;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractButton;
+import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
+import org.eclipse.scout.rt.client.ui.form.fields.radiobuttongroup.internal.RadioButtonGroupGrid;
+import org.eclipse.scout.rt.shared.data.form.ValidationRule;
+import org.eclipse.scout.rt.shared.services.common.code.CODES;
+import org.eclipse.scout.rt.shared.services.common.code.ICodeType;
+import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
+import org.eclipse.scout.rt.shared.services.lookup.CodeLookupCall;
+import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
+import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
+import org.eclipse.scout.service.SERVICES;
+
+/**
+ * The listbox value is a Object[] where the Object[] is the set of selected
+ * keys of the listbox<br>
+ * the inner table shows those rows as selected which have the key value as a
+ * part of the listbox value (Object[])
+ * <p>
+ * Note, that the listbox might not necessarily show all selected rows since the value of the listbox might contain
+ * inactive keys that are not reflected in the listbox<br>
+ * Therefore an empty listbox table is not the same as a listbox with an empty value (null)
+ */
+public abstract class AbstractRadioButtonGroup<T> extends AbstractValueField<T> implements IRadioButtonGroup<T>, ICompositeField {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractRadioButtonGroup.class);
+
+ private boolean m_valueAndSelectionMediatorActive;
+ private LookupCall m_lookupCall;
+ private Class<? extends ICodeType> m_codeTypeClass;
+ private RadioButtonGroupGrid m_grid;
+ private IFormField[] m_fields;
+ private IButton[] m_radioButtons;
+
+ public AbstractRadioButtonGroup() {
+ this(true);
+ }
+
+ public AbstractRadioButtonGroup(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ /*
+ * Configuration
+ */
+
+ /**
+ * Use a {@link LookupCall} which is able to handle {@link LookupCall#getDataByAll()}
+ */
+ @ConfigProperty(ConfigProperty.LOOKUP_CALL)
+ @Order(240)
+ @ConfigPropertyValue("null")
+ @ValidationRule(ValidationRule.LOOKUP_CALL)
+ protected Class<? extends LookupCall> getConfiguredLookupCall() {
+ return null;
+ }
+
+ /**
+ * All codes returned by the configured {@link ICodeType} are used as radio
+ * buttons.<br>
+ * However, the {@link #execFilterLookupResult(LookupCall, List)} can be used
+ * to manipulate the codes which shall be used.
+ */
+ @ConfigProperty(ConfigProperty.CODE_TYPE)
+ @Order(250)
+ @ConfigPropertyValue("null")
+ @ValidationRule(ValidationRule.CODE_TYPE)
+ protected Class<? extends ICodeType> getConfiguredCodeType() {
+ return null;
+ }
+
+ /**
+ * Called before any lookup is performed
+ */
+ @ConfigOperation
+ @Order(260)
+ protected void execPrepareLookup(LookupCall call) {
+ }
+
+ /**
+ * @param call
+ * that produced this result
+ * @param result
+ * live list containing the result rows. Add, remove, set, replace
+ * and clear of entries in this list is supported
+ */
+ @ConfigOperation
+ @Order(270)
+ protected void execFilterLookupResult(LookupCall call, List<LookupRow> result) throws ProcessingException {
+ }
+
+ @Override
+ protected void initConfig() {
+ m_fields = new IFormField[0];
+ m_grid = new RadioButtonGroupGrid(this);
+ super.initConfig();
+ // Configured CodeType
+ if (getConfiguredCodeType() != null) {
+ setCodeTypeClass(getConfiguredCodeType());
+ }
+ // Configured LookupCall
+ Class<? extends LookupCall> lookupCallClass = getConfiguredLookupCall();
+ if (lookupCallClass != null) {
+ try {
+ LookupCall call = lookupCallClass.newInstance();
+ setLookupCall(call);
+ }
+ catch (Exception e) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException(this.getClass().getSimpleName(), e));
+ }
+ }
+ // add fields
+ ArrayList<IFormField> fieldList = new ArrayList<IFormField>();
+ Class<? extends IFormField>[] fieldArray = getConfiguredFields();
+ for (int i = 0; i < fieldArray.length; i++) {
+ IFormField f;
+ try {
+ f = ConfigurationUtility.newInnerInstance(this, fieldArray[i]);
+ fieldList.add(f);
+ }// end try
+ catch (Throwable t) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("field: " + fieldArray[i].getName(), t));
+ }
+ }
+ injectFieldsInternal(fieldList);
+ for (IFormField f : fieldList) {
+ f.setParentFieldInternal(this);
+ }
+ m_fields = fieldList.toArray(new IFormField[0]);
+ //attach a proxy controller to each child field in the group for: visible, saveNeeded
+ for (IFormField f : m_fields) {
+ f.addPropertyChangeListener(new P_FieldPropertyChangeListenerEx());
+ }
+ //extract buttons from field subtree
+ ArrayList<IButton> buttonList = new ArrayList<IButton>();
+ for (IFormField f : m_fields) {
+ IButton b = findFirstButtonInFieldTree(f);
+ if (b != null) {
+ buttonList.add(b);
+ }
+ }
+ m_radioButtons = buttonList.toArray(new IButton[buttonList.size()]);
+ //decorate radiobuttons
+ for (IButton b : m_radioButtons) {
+ b.setDisplayStyleInternal(IButton.DISPLAY_STYLE_RADIO);
+ b.addPropertyChangeListener(new P_ButtonPropertyChangeListener());
+ }
+ handleFieldVisibilityChanged();
+ }
+
+ private IButton findFirstButtonInFieldTree(IFormField f) {
+ if (f instanceof IButton) {
+ return (IButton) f;
+ }
+ else if (f instanceof ICompositeField) {
+ for (IFormField sub : ((ICompositeField) f).getFields()) {
+ IButton b = findFirstButtonInFieldTree(sub);
+ if (b != null) {
+ return b;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * do not use this internal method<br>
+ * Used to manage field list and add/remove fields (see {@link AbstractGroupBox} with wizard buttons)
+ *
+ * @param fieldList
+ * live and mutable list of configured fields, not yet initialized
+ * and added to composite field
+ */
+ protected void injectFieldsInternal(List<IFormField> fieldList) {
+ if (getLookupCall() != null) {
+ // Use the LookupCall
+ try {
+ LookupRow[] lookupRows = getLookupRows();
+ for (int i = 0; i < lookupRows.length; i++) {
+ RadioButton radioButton = new RadioButton();
+ radioButton.setEnabled(lookupRows[i].isEnabled());
+ radioButton.setLabel(lookupRows[i].getText());
+ radioButton.setRadioValue(lookupRows[i].getKey());
+ radioButton.setTooltipText(lookupRows[i].getTooltipText());
+ radioButton.setBackgroundColor(lookupRows[i].getBackgroundColor());
+ radioButton.setForegroundColor(lookupRows[i].getForegroundColor());
+ radioButton.setFont(lookupRows[i].getFont());
+ fieldList.add(radioButton);
+ }
+ }
+ catch (ProcessingException e) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException(this.getClass().getSimpleName(), e));
+ }
+ }
+ }
+
+ public LookupCall getLookupCall() {
+ return m_lookupCall;
+ }
+
+ public void setLookupCall(LookupCall call) {
+ m_lookupCall = call;
+ }
+
+ public Class<? extends ICodeType> getCodeTypeClass() {
+ return m_codeTypeClass;
+ }
+
+ public void setCodeTypeClass(Class<? extends ICodeType> codeTypeClass) {
+ m_codeTypeClass = codeTypeClass;
+ // create lookup service call
+ m_lookupCall = null;
+ if (m_codeTypeClass != null) {
+ m_lookupCall = CodeLookupCall.newInstanceByService(m_codeTypeClass);
+ }
+
+ // If no label is configured use the code type's text
+ if (getConfiguredLabel() == null) {
+ setLabel(CODES.getCodeType(codeTypeClass).getText());
+ }
+ }
+
+ protected Class<? extends IFormField>[] getConfiguredFields() {
+ Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
+ return ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, IFormField.class);
+ }
+
+ /*
+ * Runtime
+ */
+ @Override
+ protected void initFieldInternal() throws ProcessingException {
+ // special case: a button represents null
+ IButton b = getButtonFor(null);
+ if (b != null) {
+ syncValueToButtons();
+ }
+ super.initFieldInternal();
+ }
+
+ /**
+ * Returns the LookupRows using {@link #getLookupCall()}, {@link #prepareLookupCall(LookupCall)} and
+ * {@link #filterLookup(LookupCall, List)}.
+ *
+ * @return
+ * @throws ProcessingException
+ */
+ private LookupRow[] getLookupRows() throws ProcessingException {
+ LookupRow[] data;
+ LookupCall call = null;
+ // Get the data
+ if (getLookupCall() != null) {
+ call = SERVICES.getService(ILookupCallProvisioningService.class).newClonedInstance(getLookupCall(), new FormFieldProvisioningContext(AbstractRadioButtonGroup.this));
+ prepareLookupCall(call);
+ data = call.getDataByAll();
+ }
+ else {
+ data = new LookupRow[0];
+ }
+
+ // Filter the result
+ ArrayList<LookupRow> result;
+ if (data != null) {
+ result = new ArrayList<LookupRow>(Arrays.asList(data));
+ }
+ else {
+ result = new ArrayList<LookupRow>();
+ }
+ filterLookup(call, result);
+
+ return result.toArray(new LookupRow[result.size()]);
+ }
+
+ private void prepareLookupCall(LookupCall call) {
+ prepareLookupCallInternal(call);
+ execPrepareLookup(call);
+ }
+
+ private void prepareLookupCallInternal(LookupCall call) {
+ call.setActive(TriState.UNDEFINED);
+ //when there is a master value defined in the original call, don't set it to null when no master value is available
+ if (getMasterValue() != null || getLookupCall() == null || getLookupCall().getMaster() == null) {
+ call.setMaster(getMasterValue());
+ }
+ }
+
+ private void filterLookup(LookupCall call, List<LookupRow> result) throws ProcessingException {
+ execFilterLookupResult(call, result);
+ }
+
+ @Override
+ public void rebuildFieldGrid() {
+ if (m_grid != null) {
+ m_grid.validate();
+ if (isInitialized()) {
+ if (getParentField() != null) {
+ getParentField().rebuildFieldGrid();
+ }
+ if (getForm() != null) {
+ getForm().structureChanged(this);
+ }
+ }
+ }
+ }
+
+ protected void handleFieldVisibilityChanged() {
+ if (isInitialized()) {
+ rebuildFieldGrid();
+ }
+ }
+
+ @Override
+ public final int getGridColumnCount() {
+ return m_grid != null ? m_grid.getGridColumnCount() : 1;
+ }
+
+ @Override
+ public final int getGridRowCount() {
+ return m_grid != null ? m_grid.getGridRowCount() : 1;
+ }
+
+ @Override
+ public void setFormInternal(IForm form) {
+ super.setFormInternal(form);
+ for (IFormField f : getFields()) {
+ f.setFormInternal(form);
+ }
+ }
+
+ @Override
+ protected void valueChangedInternal() {
+ super.valueChangedInternal();
+ syncValueToButtons();
+ }
+
+ @Override
+ protected T validateValueInternal(T rawValue) throws ProcessingException {
+ T validValue;
+ if (rawValue == null) {
+ validValue = null;
+ }
+ else {
+ T t = TypeCastUtility.castValue(rawValue, getHolderType());
+ IButton b = getButtonFor(t);
+ if (b != null) {
+ validValue = t;
+ }
+ else {
+ throw new ProcessingException("Illegal radio value: " + rawValue);
+ }
+ }
+ return validValue;
+ }
+
+ @Override
+ @ConfigPropertyValue("0")
+ protected double getConfiguredGridWeightY() {
+ return 0;
+ }
+
+ @Override
+ public T getSelectedKey() {
+ return getValue();
+ }
+
+ @Override
+ public IButton getButtonFor(T value) {
+ for (IButton b : getButtons()) {
+ T radioValue = TypeCastUtility.castValue(b.getRadioValue(), getHolderType());
+ if (CompareUtility.equals(radioValue, value)) {
+ return b;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public IButton getSelectedButton() {
+ return getButtonFor(getSelectedKey());
+ }
+
+ @Override
+ public void selectKey(T key) {
+ setValue(key);
+ }
+
+ @Override
+ public void selectButton(IButton button) {
+ for (IButton b : getButtons()) {
+ if (b == button) {
+ button.setSelected(true);
+ break;
+ }
+ }
+ }
+
+ /*
+ * Implementation of ICompositeField
+ */
+
+ /**
+ * broadcast this change to all children
+ */
+ @Override
+ public void setEnabled(boolean b) {
+ super.setEnabled(b);
+ // recursively down all children
+ for (IFormField f : m_fields) {
+ f.setEnabled(b);
+ }
+ }
+
+ /**
+ * when granting of enabled property changes, broadcast and set this property
+ * on all children that have no permission set
+ */
+ @Override
+ public void setEnabledGranted(boolean b) {
+ super.setEnabledGranted(b);
+ for (IFormField f : getFields()) {
+ if (f.getEnabledPermission() == null) {
+ f.setEnabledGranted(b);
+ }
+ }
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public <F extends IFormField> F getFieldByClass(final Class<F> c) {
+ final Holder<IFormField> found = new Holder<IFormField>(IFormField.class);
+ IFormFieldVisitor v = new IFormFieldVisitor() {
+ @Override
+ public boolean visitField(IFormField field, int level, int fieldIndex) {
+ if (field.getClass() == c) {
+ found.setValue(field);
+ }
+ return found.getValue() == null;
+ }
+ };
+ visitFields(v, 0);
+ return (F) found.getValue();
+ }
+
+ @Override
+ public IFormField getFieldById(final String id) {
+ final Holder<IFormField> found = new Holder<IFormField>(IFormField.class);
+ IFormFieldVisitor v = new IFormFieldVisitor() {
+ @Override
+ public boolean visitField(IFormField field, int level, int fieldIndex) {
+ if (field.getFieldId().equals(id)) {
+ found.setValue(field);
+ }
+ return found.getValue() == null;
+ }
+ };
+ visitFields(v, 0);
+ return found.getValue();
+ }
+
+ @Override
+ public <X extends IFormField> X getFieldById(final String id, final Class<X> type) {
+ final Holder<X> found = new Holder<X>(type);
+ IFormFieldVisitor v = new IFormFieldVisitor() {
+ @Override
+ @SuppressWarnings("unchecked")
+ public boolean visitField(IFormField field, int level, int fieldIndex) {
+ if (type.isAssignableFrom(field.getClass()) && field.getFieldId().equals(id)) {
+ found.setValue((X) field);
+ }
+ return found.getValue() == null;
+ }
+ };
+ visitFields(v, 0);
+ return found.getValue();
+ }
+
+ @Override
+ public int getFieldCount() {
+ return m_fields.length;
+ }
+
+ @Override
+ public int getFieldIndex(IFormField f) {
+ for (int i = 0; i < m_fields.length; i++) {
+ if (m_fields[i] == f) {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+ @Override
+ public IFormField[] getFields() {
+ IFormField[] a = new IFormField[m_fields.length];
+ System.arraycopy(m_fields, 0, a, 0, a.length);
+ return a;
+ }
+
+ @Override
+ public IButton[] getButtons() {
+ return m_radioButtons;
+ }
+
+ @Override
+ public boolean visitFields(IFormFieldVisitor visitor, int startLevel) {
+ // myself
+ if (!visitor.visitField(this, startLevel, 0)) {
+ return false;
+ }
+ // children
+ int index = 0;
+ IFormField[] f = m_fields;
+ for (int i = 0; i < f.length; i++) {
+ if (f[i] instanceof ICompositeField) {
+ if (!((ICompositeField) f[i]).visitFields(visitor, startLevel + 1)) {
+ return false;
+ }
+ }
+ else {
+ if (!visitor.visitField(f[i], startLevel, index)) {
+ return false;
+ }
+ }
+ index++;
+ }
+ return true;
+ }
+
+ private void syncValueToButtons() {
+ if (m_valueAndSelectionMediatorActive) {
+ return;
+ }
+ try {
+ m_valueAndSelectionMediatorActive = true;
+ //
+ T selectedKey = getSelectedKey();
+ IButton selectedButton = getButtonFor(selectedKey);
+ for (IButton b : getButtons()) {
+ b.setSelected(b == selectedButton);
+ }
+ }
+ finally {
+ m_valueAndSelectionMediatorActive = false;
+ }
+ }
+
+ private void syncButtonsToValue(IButton selectedButton) {
+ if (m_valueAndSelectionMediatorActive) {
+ return;
+ }
+ try {
+ m_valueAndSelectionMediatorActive = true;
+ //
+ for (IButton b : getButtons()) {
+ b.setSelected(b == selectedButton);
+ }
+ T radioValue = TypeCastUtility.castValue(selectedButton.getRadioValue(), getHolderType());
+ selectKey(radioValue);
+ }
+ finally {
+ m_valueAndSelectionMediatorActive = false;
+ }
+ }
+
+ /**
+ * Implementation of PropertyChangeListener Proxy on all attached fields (not groups)
+ */
+ private class P_FieldPropertyChangeListenerEx implements PropertyChangeListener {
+ @Override
+ public void propertyChange(PropertyChangeEvent e) {
+ if (e.getPropertyName().equals(IFormField.PROP_VISIBLE)) {
+ // fire group box visibility
+ handleFieldVisibilityChanged();
+ }
+ else if (e.getPropertyName().equals(IFormField.PROP_SAVE_NEEDED)) {
+ checkSaveNeeded();
+ }
+ else if (e.getPropertyName().equals(IFormField.PROP_EMPTY)) {
+ checkEmpty();
+ }
+ }
+ }// end private class
+
+ /**
+ * Implementation of PropertyChangeListener Proxy on all attached fields (not groups)
+ */
+ private class P_ButtonPropertyChangeListener implements PropertyChangeListener {
+ @Override
+ public void propertyChange(PropertyChangeEvent e) {
+ if (e.getPropertyName().equals(IButton.PROP_SELECTED)) {
+ if (((IButton) e.getSource()).isSelected()) {
+ syncButtonsToValue((IButton) e.getSource());
+ }
+ }
+ }
+ }// end private class
+
+ /**
+ * A dynamic unconfigured radio button
+ */
+ private final class RadioButton extends AbstractButton {
+ @Override
+ protected void initConfig() {
+ super.initConfig();
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/radiobuttongroup/IRadioButtonGroup.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/radiobuttongroup/IRadioButtonGroup.java
index 43237734e4..3b3387bfcd 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/radiobuttongroup/IRadioButtonGroup.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/radiobuttongroup/IRadioButtonGroup.java
@@ -1,49 +1,49 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.radiobuttongroup;
-
-import org.eclipse.scout.rt.client.ui.form.fields.ICompositeField;
-import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
-import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
-
-public interface IRadioButtonGroup<T> extends IValueField<T>, ICompositeField {
-
- /**
- * @return the buttons controlled by this radio button group
- */
- IButton[] getButtons();
-
- /**
- * @return the button representing this value
- */
- IButton getButtonFor(T radioValue);
-
- /**
- * @return the selected radio button controlled by this radio button group
- */
- IButton getSelectedButton();
-
- /**
- * select a button controlled by this radio button group
- */
- void selectButton(IButton button);
-
- /**
- * @return the radio value of the selected button controlled by this radio button group
- */
- T getSelectedKey();
-
- /**
- * select the buttons controlled by this radio button group with this radio value
- */
- void selectKey(T key);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.radiobuttongroup;
+
+import org.eclipse.scout.rt.client.ui.form.fields.ICompositeField;
+import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
+import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
+
+public interface IRadioButtonGroup<T> extends IValueField<T>, ICompositeField {
+
+ /**
+ * @return the buttons controlled by this radio button group
+ */
+ IButton[] getButtons();
+
+ /**
+ * @return the button representing this value
+ */
+ IButton getButtonFor(T radioValue);
+
+ /**
+ * @return the selected radio button controlled by this radio button group
+ */
+ IButton getSelectedButton();
+
+ /**
+ * select a button controlled by this radio button group
+ */
+ void selectButton(IButton button);
+
+ /**
+ * @return the radio value of the selected button controlled by this radio button group
+ */
+ T getSelectedKey();
+
+ /**
+ * select the buttons controlled by this radio button group with this radio value
+ */
+ void selectKey(T key);
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/radiobuttongroup/internal/RadioButtonGroupGrid.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/radiobuttongroup/internal/RadioButtonGroupGrid.java
index 30852e5180..f64db602b7 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/radiobuttongroup/internal/RadioButtonGroupGrid.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/radiobuttongroup/internal/RadioButtonGroupGrid.java
@@ -1,95 +1,95 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.radiobuttongroup.internal;
-
-import java.util.ArrayList;
-
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.form.fields.GridData;
-import org.eclipse.scout.rt.client.ui.form.fields.ICompositeField;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.internal.GridDataBuilder;
-
-/**
- * Grid (model) layout of radio button group only visible process-buttons are
- * used
- */
-public class RadioButtonGroupGrid {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(RadioButtonGroupGrid.class);
-
- private ICompositeField m_group = null;
- private IFormField[] m_fields;
- private int m_gridColumns;
- private int m_gridRows;
-
- public RadioButtonGroupGrid(ICompositeField group) {
- m_group = group;
- }
-
- public void validate() {
- // reset
- m_gridColumns = 0;
- m_gridRows = 0;
- ArrayList<IFormField> list = new ArrayList<IFormField>();
- // filter
- for (IFormField f : m_group.getFields()) {
- if (f.isVisible()) {
- list.add(f);
- }
- else {
- GridData data = GridDataBuilder.createFromHints(f, 1);
- f.setGridDataInternal(data);
- }
- }
- m_fields = list.toArray(new IFormField[list.size()]);
- layoutStatic();
- }
-
- private void layoutStatic() {
- GridData parentData = m_group.getGridData();
- if (parentData.h <= 0) {
- LOG.error(m_group.getClass().getName() + " has gridData.h=" + parentData.h + "; expected value>0");
- m_gridRows = 1;
- }
- else if (m_fields.length <= 0) {
- LOG.error(m_group.getClass().getName() + " has fieldCount=" + parentData.h + "; expected value>0");
- m_gridRows = 1;
- }
- else {
- m_gridRows = Math.min(parentData.h, m_fields.length);
- }
- m_gridColumns = (m_fields.length + m_gridRows - 1) / m_gridRows;
- int i = 0;
- for (int r = 0; r < m_gridRows; r++) {
- for (int c = 0; c < m_gridColumns; c++) {
- if (i < m_fields.length) {
- GridData data = GridDataBuilder.createFromHints(m_fields[i], 1);
- data.x = c;
- data.y = r;
- m_fields[i].setGridDataInternal(data);
- i++;
- }
- else {
- break;
- }
- }
- }
- }
-
- public int getGridColumnCount() {
- return m_gridColumns;
- }
-
- public int getGridRowCount() {
- return m_gridRows;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.radiobuttongroup.internal;
+
+import java.util.ArrayList;
+
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.form.fields.GridData;
+import org.eclipse.scout.rt.client.ui.form.fields.ICompositeField;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.internal.GridDataBuilder;
+
+/**
+ * Grid (model) layout of radio button group only visible process-buttons are
+ * used
+ */
+public class RadioButtonGroupGrid {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(RadioButtonGroupGrid.class);
+
+ private ICompositeField m_group = null;
+ private IFormField[] m_fields;
+ private int m_gridColumns;
+ private int m_gridRows;
+
+ public RadioButtonGroupGrid(ICompositeField group) {
+ m_group = group;
+ }
+
+ public void validate() {
+ // reset
+ m_gridColumns = 0;
+ m_gridRows = 0;
+ ArrayList<IFormField> list = new ArrayList<IFormField>();
+ // filter
+ for (IFormField f : m_group.getFields()) {
+ if (f.isVisible()) {
+ list.add(f);
+ }
+ else {
+ GridData data = GridDataBuilder.createFromHints(f, 1);
+ f.setGridDataInternal(data);
+ }
+ }
+ m_fields = list.toArray(new IFormField[list.size()]);
+ layoutStatic();
+ }
+
+ private void layoutStatic() {
+ GridData parentData = m_group.getGridData();
+ if (parentData.h <= 0) {
+ LOG.error(m_group.getClass().getName() + " has gridData.h=" + parentData.h + "; expected value>0");
+ m_gridRows = 1;
+ }
+ else if (m_fields.length <= 0) {
+ LOG.error(m_group.getClass().getName() + " has fieldCount=" + parentData.h + "; expected value>0");
+ m_gridRows = 1;
+ }
+ else {
+ m_gridRows = Math.min(parentData.h, m_fields.length);
+ }
+ m_gridColumns = (m_fields.length + m_gridRows - 1) / m_gridRows;
+ int i = 0;
+ for (int r = 0; r < m_gridRows; r++) {
+ for (int c = 0; c < m_gridColumns; c++) {
+ if (i < m_fields.length) {
+ GridData data = GridDataBuilder.createFromHints(m_fields[i], 1);
+ data.x = c;
+ data.y = r;
+ m_fields[i].setGridDataInternal(data);
+ i++;
+ }
+ else {
+ break;
+ }
+ }
+ }
+ }
+
+ public int getGridColumnCount() {
+ return m_gridColumns;
+ }
+
+ public int getGridRowCount() {
+ return m_gridRows;
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/sequencebox/AbstractSequenceBox.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/sequencebox/AbstractSequenceBox.java
index 88313645f3..90a4aef48a 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/sequencebox/AbstractSequenceBox.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/sequencebox/AbstractSequenceBox.java
@@ -1,414 +1,414 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.sequencebox;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.ArrayList;
-import java.util.HashSet;
-
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.commons.OptimisticLock;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.annotations.ConfigOperation;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.exception.VetoException;
-import org.eclipse.scout.commons.holders.IHolder;
-import org.eclipse.scout.rt.client.ui.form.fields.AbstractCompositeField;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
-import org.eclipse.scout.rt.client.ui.form.fields.booleanfield.IBooleanField;
-import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
-import org.eclipse.scout.rt.client.ui.form.fields.sequencebox.internal.SequenceBoxGrid;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-
-public abstract class AbstractSequenceBox extends AbstractCompositeField implements ISequenceBox {
-
- private boolean m_autoCheckFromTo;
- private OptimisticLock m_labelCompositionLock;
- private SequenceBoxGrid m_grid;
- private String m_labelBase;
- private String m_labelSuffix;
- private boolean m_equalColumnWidths;
-
- public AbstractSequenceBox() {
- this(true);
- }
-
- public AbstractSequenceBox(boolean callInitializer) {
- super(callInitializer);
- }
-
- /*
- * Configuration
- */
-
- /**
- * @return true: A value change trigger ensures that all fields in the range
- * box have consistent (ascending values) by calling {@link #execCheckFromTo(IValueField)}
- * <p>
- * Examples:
- *
- * <pre>
- * fromField.value &lt;= toField.value
- * minField.value &lt;= preferredField.value &lt;= maxField.value
- * </pre>
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(200)
- @ConfigPropertyValue("true")
- protected boolean getConfiguredAutoCheckFromTo() {
- return true;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(210)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredEqualColumnWidths() {
- return false;
- }
-
- @Override
- @ConfigPropertyValue("true")
- protected boolean getConfiguredGridUseUiHeight() {
- return true;
- }
-
- /**
- * Default implementation ensures that all fields in the range box have
- * ascending values.<br>
- * Only active when {@link #isAutoCheckFromTo()} resp. {@link #getConfiguredAutoCheckFromTo()} is set to true
- *
- * @param valueFields
- * all value fields in the range box that have the same {@link IHolder#getHolderType()} and are comparable
- * @param changedIndex
- * the field that triggered the change
- */
- @ConfigOperation
- @Order(200)
- protected <T extends Comparable<T>> void execCheckFromTo(IValueField<T>[] valueFields, int changedIndex) throws ProcessingException {
- ArrayList<IValueField<T>> nonEmptyFields = new ArrayList<IValueField<T>>();
- HashSet<Class> beanTypes = new HashSet<Class>();
- int nonEmptyIndex = -1;
- for (int i = 0; i < valueFields.length; i++) {
- if (valueFields[i].getValue() != null) {
- beanTypes.add(valueFields[i].getValue().getClass());
- nonEmptyFields.add(valueFields[i]);
- if (i == changedIndex) {
- nonEmptyIndex = nonEmptyFields.size() - 1;
- }
- }
- }
- //check if there are exactly two field and all of them are comparable with same type
- if (nonEmptyFields.size() != 2 || beanTypes.size() != 1) {
- clearInvalidSequenceStatus(valueFields);
- return;
- }
- // check changed field against its non-empty neighbours
- if (nonEmptyIndex >= 0) {
- IValueField<T> v = nonEmptyFields.get(nonEmptyIndex);
- if (nonEmptyIndex - 1 >= 0) {
- IValueField<T> left = nonEmptyFields.get(nonEmptyIndex - 1);
- if (CompareUtility.compareTo(left.getValue(), v.getValue()) > 0) {
- InvalidSequenceStatus errorStatus = new InvalidSequenceStatus(ScoutTexts.get("XMustBeGreaterThanOrEqualY", v.getLabel(), left.getLabel()));
- if (!v.isLabelSuppressed()) {
- v.setErrorStatus(errorStatus);
- }
- else {
- //first field's label is suppressed and error status updated on own label
- setErrorStatus(errorStatus);
- }
- return;
- }
- }
- if (nonEmptyIndex + 1 < nonEmptyFields.size()) {
- IValueField<T> right = nonEmptyFields.get(nonEmptyIndex + 1);
- if (CompareUtility.compareTo(v.getValue(), right.getValue()) > 0) {
- InvalidSequenceStatus errorStatus = new InvalidSequenceStatus(ScoutTexts.get("XMustBeLessThanOrEqualY", v.getLabel(), right.getLabel()));
- if (!v.isLabelSuppressed()) {
- v.setErrorStatus(errorStatus);
- }
- else {
- //first field's label is suppressed and error status updated on own label
- setErrorStatus(errorStatus);
- }
- return;
- }
- }
- }
- clearInvalidSequenceStatus(valueFields);
- }
-
- /**
- * Validate all fields including own and remove error status when it is an
- * InvalidSequenceStatus
- *
- * @param valueFields
- */
- private void clearInvalidSequenceStatus(IValueField[] valueFields) {
- for (IValueField v : valueFields) {
- if (v.getErrorStatus() instanceof InvalidSequenceStatus) {
- v.clearErrorStatus();
- }
- }
- //remove error status on own
- if (getErrorStatus() instanceof InvalidSequenceStatus) {
- clearErrorStatus();
- }
- }
-
- @Override
- protected void initConfig() {
- m_labelCompositionLock = new OptimisticLock();
- m_grid = new SequenceBoxGrid(this);
- super.initConfig();
- setAutoCheckFromTo(getConfiguredAutoCheckFromTo());
- setEqualColumnWidths(getConfiguredEqualColumnWidths());
- // when range box has visible label, suppress first field's label and append
- // to own label
- propertySupport.addPropertyChangeListener(
- new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent e) {
- if (e.getPropertyName().equals(IFormField.PROP_LABEL_VISIBLE) || e.getPropertyName().equals(IFormField.PROP_LABEL) || e.getPropertyName().equals(IFormField.PROP_VISIBLE)) {
- updateLabelComposition();
- }
- }
- }
- );
- // <bsh 2010-10-01>
- // If inner fields change their visibility dynamically, the label of the SequenceBox might change.
- for (IFormField field : getFields()) {
- field.addPropertyChangeListener(
- new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent e) {
- if (e.getPropertyName().equals(IFormField.PROP_LABEL_VISIBLE) || e.getPropertyName().equals(IFormField.PROP_LABEL) || e.getPropertyName().equals(IFormField.PROP_VISIBLE)) {
- updateLabelComposition();
- }
- }
- }
- );
- }
- updateLabelComposition();
- // attach change triggers
- Class<?> sharedType = null;
- ArrayList<IValueField> valueFieldList = new ArrayList<IValueField>();
- for (IFormField f : getFields()) {
- if (f instanceof IValueField) {
- IValueField v = (IValueField) f;
- Class<?> valueType = v.getHolderType();
- if (Comparable.class.isAssignableFrom(valueType)) {
- if (sharedType == null || valueType == sharedType) {
- sharedType = valueType;
- valueFieldList.add(v);
- }
- }
- }
- }
- if (valueFieldList.size() >= 2) {
- final IValueField[] valueFields = valueFieldList.toArray(new IValueField[valueFieldList.size()]);
- for (int i = 0; i < valueFields.length; i++) {
- final int index = i;
- valueFields[index].addPropertyChangeListener(
- IValueField.PROP_VALUE,
- new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent e) {
- if (getForm() != null && isAutoCheckFromTo()) {
- checkFromTo(valueFields, index);
- }
- }
- }
- );
- }
- }
- }
-
- /*
- * Runtime
- */
-
- @Override
- public boolean isEqualColumnWidths() {
- return m_equalColumnWidths;
- }
-
- @Override
- public void setEqualColumnWidths(boolean b) {
- m_equalColumnWidths = b;
- }
-
- @Override
- public void rebuildFieldGrid() {
- m_grid.validate();
- if (isInitialized()) {
- if (getForm() != null) {
- getForm().structureChanged(this);
- }
- }
- }
-
- // box is only visible when it has at least one visible item
- @Override
- protected void handleFieldVisibilityChanged() {
- super.handleFieldVisibilityChanged();
- if (isInitialized()) {
- rebuildFieldGrid();
- }
- }
-
- @Override
- public final int getGridColumnCount() {
- return m_grid.getGridColumnCount();
- }
-
- @Override
- public final int getGridRowCount() {
- return m_grid.getGridRowCount();
- }
-
- @Override
- public boolean isAutoCheckFromTo() {
- return m_autoCheckFromTo;
- }
-
- @Override
- public void setAutoCheckFromTo(boolean b) {
- m_autoCheckFromTo = b;
- }
-
- @SuppressWarnings("unchecked")
- private void checkFromTo(IValueField[] valueFields, int changedIndex) {
- try {
- execCheckFromTo(valueFields, changedIndex);
- }
- catch (VetoException e) {
- valueFields[changedIndex].setErrorStatus(e.getStatus());
- }
- catch (ProcessingException e) {
- valueFields[changedIndex].setErrorStatus(e.getStatus());
- }
- }
-
- private void updateLabelComposition() {
- if (!isLabelVisible()) {
- return;
- }
-
- try {
- if (m_labelCompositionLock.acquire()) {
- m_labelSuffix = execCreateLabelSuffix();
-
- computeCompoundLabel();
- }
- }
- finally {
- m_labelCompositionLock.release();
- }
- }
-
- /**
- * <p>
- * Returns a string which will be appended to the actual label of the sequence box.
- * </p>
- * <p>
- * As default it returns the label of the first field for which the function
- * {@link #execIsLabelSuffixCandidate(IFormField)} returns true.
- * </p>
- */
- @ConfigOperation
- @Order(210)
- protected String execCreateLabelSuffix() {
- for (IFormField f : getFields()) {
- f.setLabelSuppressed(false);
- }
-
- for (IFormField formField : getFields()) {
- if (execIsLabelSuffixCandidate(formField)) {
- formField.setLabelSuppressed(true);
- return formField.getLabel();
- }
- }
-
- return null;
- }
-
- /**
- * <p>
- * Computes whether the given formField should be considered when creating the compound label in
- * {@link #execCreateLabelSuffix()}.
- * </p>
- */
- @ConfigOperation
- @Order(211)
- protected boolean execIsLabelSuffixCandidate(IFormField formField) {
- if (!formField.isVisible()) {
- return false;
- }
- if (!formField.isLabelVisible()) {
- return false;
- }
- if (formField.getLabelPosition() == IFormField.LABEL_POSITION_ON_FIELD) {
- return false;
- }
- if (formField.getLabelPosition() == IFormField.LABEL_POSITION_TOP) {
- return false;
- }
- if (formField instanceof IBooleanField) {
- // Checkbox fields have their label on the right side of the checkbox so it is not necessary to use it for the compound label
- return false;
- }
- if (formField instanceof IButton) {
- // Inline buttons may be contained in the sequence box. The label is usually placed directly on the button itself.
- return false;
- }
- return true;
- }
-
- @Override
- public void setLabel(String name) {
- m_labelBase = name;
- computeCompoundLabel();
- }
-
- private void computeCompoundLabel() {
- if (StringUtility.hasText(m_labelBase) && StringUtility.hasText(m_labelSuffix)) {
- super.setLabel(m_labelBase + " " + m_labelSuffix);
- }
- else {
- super.setLabel(StringUtility.emptyIfNull(m_labelBase) + StringUtility.emptyIfNull(m_labelSuffix));
- }
- }
-
- @Override
- public String getFullyQualifiedLabel(String separator) {
- StringBuffer b = new StringBuffer();
- IFormField p = getParentField();
- if (p != null) {
- String s = p.getFullyQualifiedLabel(separator);
- if (s != null) {
- b.append(s);
- }
- }
- String s = m_labelBase;
- if (s != null) {
- if (b.length() > 0) {
- b.append(separator);
- }
- b.append(s);
- }
- return b.toString();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.sequencebox;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.ArrayList;
+import java.util.HashSet;
+
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.commons.OptimisticLock;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.annotations.ConfigOperation;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.exception.VetoException;
+import org.eclipse.scout.commons.holders.IHolder;
+import org.eclipse.scout.rt.client.ui.form.fields.AbstractCompositeField;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
+import org.eclipse.scout.rt.client.ui.form.fields.booleanfield.IBooleanField;
+import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
+import org.eclipse.scout.rt.client.ui.form.fields.sequencebox.internal.SequenceBoxGrid;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+
+public abstract class AbstractSequenceBox extends AbstractCompositeField implements ISequenceBox {
+
+ private boolean m_autoCheckFromTo;
+ private OptimisticLock m_labelCompositionLock;
+ private SequenceBoxGrid m_grid;
+ private String m_labelBase;
+ private String m_labelSuffix;
+ private boolean m_equalColumnWidths;
+
+ public AbstractSequenceBox() {
+ this(true);
+ }
+
+ public AbstractSequenceBox(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ /*
+ * Configuration
+ */
+
+ /**
+ * @return true: A value change trigger ensures that all fields in the range
+ * box have consistent (ascending values) by calling {@link #execCheckFromTo(IValueField)}
+ * <p>
+ * Examples:
+ *
+ * <pre>
+ * fromField.value &lt;= toField.value
+ * minField.value &lt;= preferredField.value &lt;= maxField.value
+ * </pre>
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(200)
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredAutoCheckFromTo() {
+ return true;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(210)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredEqualColumnWidths() {
+ return false;
+ }
+
+ @Override
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredGridUseUiHeight() {
+ return true;
+ }
+
+ /**
+ * Default implementation ensures that all fields in the range box have
+ * ascending values.<br>
+ * Only active when {@link #isAutoCheckFromTo()} resp. {@link #getConfiguredAutoCheckFromTo()} is set to true
+ *
+ * @param valueFields
+ * all value fields in the range box that have the same {@link IHolder#getHolderType()} and are comparable
+ * @param changedIndex
+ * the field that triggered the change
+ */
+ @ConfigOperation
+ @Order(200)
+ protected <T extends Comparable<T>> void execCheckFromTo(IValueField<T>[] valueFields, int changedIndex) throws ProcessingException {
+ ArrayList<IValueField<T>> nonEmptyFields = new ArrayList<IValueField<T>>();
+ HashSet<Class> beanTypes = new HashSet<Class>();
+ int nonEmptyIndex = -1;
+ for (int i = 0; i < valueFields.length; i++) {
+ if (valueFields[i].getValue() != null) {
+ beanTypes.add(valueFields[i].getValue().getClass());
+ nonEmptyFields.add(valueFields[i]);
+ if (i == changedIndex) {
+ nonEmptyIndex = nonEmptyFields.size() - 1;
+ }
+ }
+ }
+ //check if there are exactly two field and all of them are comparable with same type
+ if (nonEmptyFields.size() != 2 || beanTypes.size() != 1) {
+ clearInvalidSequenceStatus(valueFields);
+ return;
+ }
+ // check changed field against its non-empty neighbours
+ if (nonEmptyIndex >= 0) {
+ IValueField<T> v = nonEmptyFields.get(nonEmptyIndex);
+ if (nonEmptyIndex - 1 >= 0) {
+ IValueField<T> left = nonEmptyFields.get(nonEmptyIndex - 1);
+ if (CompareUtility.compareTo(left.getValue(), v.getValue()) > 0) {
+ InvalidSequenceStatus errorStatus = new InvalidSequenceStatus(ScoutTexts.get("XMustBeGreaterThanOrEqualY", v.getLabel(), left.getLabel()));
+ if (!v.isLabelSuppressed()) {
+ v.setErrorStatus(errorStatus);
+ }
+ else {
+ //first field's label is suppressed and error status updated on own label
+ setErrorStatus(errorStatus);
+ }
+ return;
+ }
+ }
+ if (nonEmptyIndex + 1 < nonEmptyFields.size()) {
+ IValueField<T> right = nonEmptyFields.get(nonEmptyIndex + 1);
+ if (CompareUtility.compareTo(v.getValue(), right.getValue()) > 0) {
+ InvalidSequenceStatus errorStatus = new InvalidSequenceStatus(ScoutTexts.get("XMustBeLessThanOrEqualY", v.getLabel(), right.getLabel()));
+ if (!v.isLabelSuppressed()) {
+ v.setErrorStatus(errorStatus);
+ }
+ else {
+ //first field's label is suppressed and error status updated on own label
+ setErrorStatus(errorStatus);
+ }
+ return;
+ }
+ }
+ }
+ clearInvalidSequenceStatus(valueFields);
+ }
+
+ /**
+ * Validate all fields including own and remove error status when it is an
+ * InvalidSequenceStatus
+ *
+ * @param valueFields
+ */
+ private void clearInvalidSequenceStatus(IValueField[] valueFields) {
+ for (IValueField v : valueFields) {
+ if (v.getErrorStatus() instanceof InvalidSequenceStatus) {
+ v.clearErrorStatus();
+ }
+ }
+ //remove error status on own
+ if (getErrorStatus() instanceof InvalidSequenceStatus) {
+ clearErrorStatus();
+ }
+ }
+
+ @Override
+ protected void initConfig() {
+ m_labelCompositionLock = new OptimisticLock();
+ m_grid = new SequenceBoxGrid(this);
+ super.initConfig();
+ setAutoCheckFromTo(getConfiguredAutoCheckFromTo());
+ setEqualColumnWidths(getConfiguredEqualColumnWidths());
+ // when range box has visible label, suppress first field's label and append
+ // to own label
+ propertySupport.addPropertyChangeListener(
+ new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent e) {
+ if (e.getPropertyName().equals(IFormField.PROP_LABEL_VISIBLE) || e.getPropertyName().equals(IFormField.PROP_LABEL) || e.getPropertyName().equals(IFormField.PROP_VISIBLE)) {
+ updateLabelComposition();
+ }
+ }
+ }
+ );
+ // <bsh 2010-10-01>
+ // If inner fields change their visibility dynamically, the label of the SequenceBox might change.
+ for (IFormField field : getFields()) {
+ field.addPropertyChangeListener(
+ new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent e) {
+ if (e.getPropertyName().equals(IFormField.PROP_LABEL_VISIBLE) || e.getPropertyName().equals(IFormField.PROP_LABEL) || e.getPropertyName().equals(IFormField.PROP_VISIBLE)) {
+ updateLabelComposition();
+ }
+ }
+ }
+ );
+ }
+ updateLabelComposition();
+ // attach change triggers
+ Class<?> sharedType = null;
+ ArrayList<IValueField> valueFieldList = new ArrayList<IValueField>();
+ for (IFormField f : getFields()) {
+ if (f instanceof IValueField) {
+ IValueField v = (IValueField) f;
+ Class<?> valueType = v.getHolderType();
+ if (Comparable.class.isAssignableFrom(valueType)) {
+ if (sharedType == null || valueType == sharedType) {
+ sharedType = valueType;
+ valueFieldList.add(v);
+ }
+ }
+ }
+ }
+ if (valueFieldList.size() >= 2) {
+ final IValueField[] valueFields = valueFieldList.toArray(new IValueField[valueFieldList.size()]);
+ for (int i = 0; i < valueFields.length; i++) {
+ final int index = i;
+ valueFields[index].addPropertyChangeListener(
+ IValueField.PROP_VALUE,
+ new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent e) {
+ if (getForm() != null && isAutoCheckFromTo()) {
+ checkFromTo(valueFields, index);
+ }
+ }
+ }
+ );
+ }
+ }
+ }
+
+ /*
+ * Runtime
+ */
+
+ @Override
+ public boolean isEqualColumnWidths() {
+ return m_equalColumnWidths;
+ }
+
+ @Override
+ public void setEqualColumnWidths(boolean b) {
+ m_equalColumnWidths = b;
+ }
+
+ @Override
+ public void rebuildFieldGrid() {
+ m_grid.validate();
+ if (isInitialized()) {
+ if (getForm() != null) {
+ getForm().structureChanged(this);
+ }
+ }
+ }
+
+ // box is only visible when it has at least one visible item
+ @Override
+ protected void handleFieldVisibilityChanged() {
+ super.handleFieldVisibilityChanged();
+ if (isInitialized()) {
+ rebuildFieldGrid();
+ }
+ }
+
+ @Override
+ public final int getGridColumnCount() {
+ return m_grid.getGridColumnCount();
+ }
+
+ @Override
+ public final int getGridRowCount() {
+ return m_grid.getGridRowCount();
+ }
+
+ @Override
+ public boolean isAutoCheckFromTo() {
+ return m_autoCheckFromTo;
+ }
+
+ @Override
+ public void setAutoCheckFromTo(boolean b) {
+ m_autoCheckFromTo = b;
+ }
+
+ @SuppressWarnings("unchecked")
+ private void checkFromTo(IValueField[] valueFields, int changedIndex) {
+ try {
+ execCheckFromTo(valueFields, changedIndex);
+ }
+ catch (VetoException e) {
+ valueFields[changedIndex].setErrorStatus(e.getStatus());
+ }
+ catch (ProcessingException e) {
+ valueFields[changedIndex].setErrorStatus(e.getStatus());
+ }
+ }
+
+ private void updateLabelComposition() {
+ if (!isLabelVisible()) {
+ return;
+ }
+
+ try {
+ if (m_labelCompositionLock.acquire()) {
+ m_labelSuffix = execCreateLabelSuffix();
+
+ computeCompoundLabel();
+ }
+ }
+ finally {
+ m_labelCompositionLock.release();
+ }
+ }
+
+ /**
+ * <p>
+ * Returns a string which will be appended to the actual label of the sequence box.
+ * </p>
+ * <p>
+ * As default it returns the label of the first field for which the function
+ * {@link #execIsLabelSuffixCandidate(IFormField)} returns true.
+ * </p>
+ */
+ @ConfigOperation
+ @Order(210)
+ protected String execCreateLabelSuffix() {
+ for (IFormField f : getFields()) {
+ f.setLabelSuppressed(false);
+ }
+
+ for (IFormField formField : getFields()) {
+ if (execIsLabelSuffixCandidate(formField)) {
+ formField.setLabelSuppressed(true);
+ return formField.getLabel();
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * <p>
+ * Computes whether the given formField should be considered when creating the compound label in
+ * {@link #execCreateLabelSuffix()}.
+ * </p>
+ */
+ @ConfigOperation
+ @Order(211)
+ protected boolean execIsLabelSuffixCandidate(IFormField formField) {
+ if (!formField.isVisible()) {
+ return false;
+ }
+ if (!formField.isLabelVisible()) {
+ return false;
+ }
+ if (formField.getLabelPosition() == IFormField.LABEL_POSITION_ON_FIELD) {
+ return false;
+ }
+ if (formField.getLabelPosition() == IFormField.LABEL_POSITION_TOP) {
+ return false;
+ }
+ if (formField instanceof IBooleanField) {
+ // Checkbox fields have their label on the right side of the checkbox so it is not necessary to use it for the compound label
+ return false;
+ }
+ if (formField instanceof IButton) {
+ // Inline buttons may be contained in the sequence box. The label is usually placed directly on the button itself.
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public void setLabel(String name) {
+ m_labelBase = name;
+ computeCompoundLabel();
+ }
+
+ private void computeCompoundLabel() {
+ if (StringUtility.hasText(m_labelBase) && StringUtility.hasText(m_labelSuffix)) {
+ super.setLabel(m_labelBase + " " + m_labelSuffix);
+ }
+ else {
+ super.setLabel(StringUtility.emptyIfNull(m_labelBase) + StringUtility.emptyIfNull(m_labelSuffix));
+ }
+ }
+
+ @Override
+ public String getFullyQualifiedLabel(String separator) {
+ StringBuffer b = new StringBuffer();
+ IFormField p = getParentField();
+ if (p != null) {
+ String s = p.getFullyQualifiedLabel(separator);
+ if (s != null) {
+ b.append(s);
+ }
+ }
+ String s = m_labelBase;
+ if (s != null) {
+ if (b.length() > 0) {
+ b.append(separator);
+ }
+ b.append(s);
+ }
+ return b.toString();
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/sequencebox/ISequenceBox.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/sequencebox/ISequenceBox.java
index 5e7940503f..3965208056 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/sequencebox/ISequenceBox.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/sequencebox/ISequenceBox.java
@@ -1,25 +1,25 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.sequencebox;
-
-import org.eclipse.scout.rt.client.ui.form.fields.ICompositeField;
-
-public interface ISequenceBox extends ICompositeField {
-
- boolean isAutoCheckFromTo();
-
- void setAutoCheckFromTo(boolean b);
-
- boolean isEqualColumnWidths();
-
- void setEqualColumnWidths(boolean b);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.sequencebox;
+
+import org.eclipse.scout.rt.client.ui.form.fields.ICompositeField;
+
+public interface ISequenceBox extends ICompositeField {
+
+ boolean isAutoCheckFromTo();
+
+ void setAutoCheckFromTo(boolean b);
+
+ boolean isEqualColumnWidths();
+
+ void setEqualColumnWidths(boolean b);
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/sequencebox/InvalidSequenceStatus.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/sequencebox/InvalidSequenceStatus.java
index 2242347b28..711346173c 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/sequencebox/InvalidSequenceStatus.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/sequencebox/InvalidSequenceStatus.java
@@ -1,33 +1,33 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.sequencebox;
-
-import org.eclipse.scout.commons.exception.IProcessingStatus;
-import org.eclipse.scout.rt.client.ui.form.fields.ScoutFieldStatus;
-
-/**
- * Marker subclass so we know inside
- * {@link AbstractSequenceBox#execCheckFromTo(org.eclipse.scout.rt.client.ui.form.fields.IValueField[], int)} that a
- * previous failure was due to invalid sequence values and can safely be
- * cleared once the sequence is valid again.
- */
-public class InvalidSequenceStatus extends ScoutFieldStatus {
- private static final long serialVersionUID = 1L;
-
- public InvalidSequenceStatus(String message) {
- super(message, ERROR);
- }
-
- public InvalidSequenceStatus(IProcessingStatus s) {
- super(s, ERROR);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.sequencebox;
+
+import org.eclipse.scout.commons.exception.IProcessingStatus;
+import org.eclipse.scout.rt.client.ui.form.fields.ScoutFieldStatus;
+
+/**
+ * Marker subclass so we know inside
+ * {@link AbstractSequenceBox#execCheckFromTo(org.eclipse.scout.rt.client.ui.form.fields.IValueField[], int)} that a
+ * previous failure was due to invalid sequence values and can safely be
+ * cleared once the sequence is valid again.
+ */
+public class InvalidSequenceStatus extends ScoutFieldStatus {
+ private static final long serialVersionUID = 1L;
+
+ public InvalidSequenceStatus(String message) {
+ super(message, ERROR);
+ }
+
+ public InvalidSequenceStatus(IProcessingStatus s) {
+ super(s, ERROR);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/sequencebox/internal/SequenceBoxGrid.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/sequencebox/internal/SequenceBoxGrid.java
index 19c623d1c8..586ae4b1cf 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/sequencebox/internal/SequenceBoxGrid.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/sequencebox/internal/SequenceBoxGrid.java
@@ -1,85 +1,85 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.sequencebox.internal;
-
-import java.util.ArrayList;
-
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.form.fields.GridData;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
-import org.eclipse.scout.rt.client.ui.form.fields.internal.GridDataBuilder;
-import org.eclipse.scout.rt.client.ui.form.fields.sequencebox.ISequenceBox;
-
-/**
- * Grid (model) layout of sequence box only visible process-buttons are used
- */
-public class SequenceBoxGrid {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(SequenceBoxGrid.class);
-
- private ISequenceBox m_rangeBox = null;
- private IFormField[] m_fields;
- private int m_gridColumns;
- private int m_gridRows;
-
- public SequenceBoxGrid(ISequenceBox rangeBox) {
- m_rangeBox = rangeBox;
- }
-
- public void validate() {
- // reset
- m_gridColumns = 0;
- m_gridRows = 0;
- ArrayList<IFormField> list = new ArrayList<IFormField>();
- // filter
- for (IFormField f : m_rangeBox.getFields()) {
- if (f.isVisible()) {
- list.add(f);
- }
- else {
- GridData data = GridDataBuilder.createFromHints(f, 1);
- f.setGridDataInternal(data);
- }
- }
- m_fields = list.toArray(new IFormField[list.size()]);
- layoutStatic();
- }
-
- private void layoutStatic() {
- int x = 0;
- for (int i = 0; i < m_fields.length; i++) {
- GridData data = GridDataBuilder.createFromHints(m_fields[i], 1);
- data.x = x;
- data.y = 0;
- if (data.weightX < 0) {
- if (m_fields[i] instanceof IButton) {
- data.weightX = 0;
- }
- else {
- data.weightX = data.w;
- }
- }
- m_fields[i].setGridDataInternal(data);
- x = x + data.w;
- m_gridRows = Math.max(m_gridRows, data.h);
- }
- m_gridColumns = x;
- }
-
- public int getGridColumnCount() {
- return m_gridColumns;
- }
-
- public int getGridRowCount() {
- return m_gridRows;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.sequencebox.internal;
+
+import java.util.ArrayList;
+
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.form.fields.GridData;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
+import org.eclipse.scout.rt.client.ui.form.fields.internal.GridDataBuilder;
+import org.eclipse.scout.rt.client.ui.form.fields.sequencebox.ISequenceBox;
+
+/**
+ * Grid (model) layout of sequence box only visible process-buttons are used
+ */
+public class SequenceBoxGrid {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(SequenceBoxGrid.class);
+
+ private ISequenceBox m_rangeBox = null;
+ private IFormField[] m_fields;
+ private int m_gridColumns;
+ private int m_gridRows;
+
+ public SequenceBoxGrid(ISequenceBox rangeBox) {
+ m_rangeBox = rangeBox;
+ }
+
+ public void validate() {
+ // reset
+ m_gridColumns = 0;
+ m_gridRows = 0;
+ ArrayList<IFormField> list = new ArrayList<IFormField>();
+ // filter
+ for (IFormField f : m_rangeBox.getFields()) {
+ if (f.isVisible()) {
+ list.add(f);
+ }
+ else {
+ GridData data = GridDataBuilder.createFromHints(f, 1);
+ f.setGridDataInternal(data);
+ }
+ }
+ m_fields = list.toArray(new IFormField[list.size()]);
+ layoutStatic();
+ }
+
+ private void layoutStatic() {
+ int x = 0;
+ for (int i = 0; i < m_fields.length; i++) {
+ GridData data = GridDataBuilder.createFromHints(m_fields[i], 1);
+ data.x = x;
+ data.y = 0;
+ if (data.weightX < 0) {
+ if (m_fields[i] instanceof IButton) {
+ data.weightX = 0;
+ }
+ else {
+ data.weightX = data.w;
+ }
+ }
+ m_fields[i].setGridDataInternal(data);
+ x = x + data.w;
+ m_gridRows = Math.max(m_gridRows, data.h);
+ }
+ m_gridColumns = x;
+ }
+
+ public int getGridColumnCount() {
+ return m_gridColumns;
+ }
+
+ public int getGridRowCount() {
+ return m_gridRows;
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/smartfield/AbstractSmartFieldProposalForm.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/smartfield/AbstractSmartFieldProposalForm.java
index 10a821c040..ccb6d07aad 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/smartfield/AbstractSmartFieldProposalForm.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/smartfield/AbstractSmartFieldProposalForm.java
@@ -1,58 +1,58 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.smartfield;
-
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.form.AbstractForm;
-
-public abstract class AbstractSmartFieldProposalForm extends AbstractForm implements ISmartFieldProposalForm {
-
- private final ISmartField<?> m_smartField;
-
- public AbstractSmartFieldProposalForm(ISmartField<?> smartField) throws ProcessingException {
- super(false);
- m_smartField = smartField;
- callInitializer();
- }
-
- @ConfigPropertyValue("false")
- @Override
- protected boolean getConfiguredAskIfNeedSave() {
- return false;
- }
-
- @Override
- protected boolean getConfiguredModal() {
- return false;
- }
-
- @Override
- protected int getConfiguredDisplayHint() {
- return DISPLAY_HINT_VIEW;
- }
-
- @Override
- public ISmartField<? extends Object> getSmartField() {
- return m_smartField;
- }
-
- @Override
- public String getSearchText() {
- return propertySupport.getPropertyString(PROP_SEARCH_TEXT);
- }
-
- @Override
- public void setSearchText(String text) {
- propertySupport.setPropertyString(PROP_SEARCH_TEXT, text);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.smartfield;
+
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.form.AbstractForm;
+
+public abstract class AbstractSmartFieldProposalForm extends AbstractForm implements ISmartFieldProposalForm {
+
+ private final ISmartField<?> m_smartField;
+
+ public AbstractSmartFieldProposalForm(ISmartField<?> smartField) throws ProcessingException {
+ super(false);
+ m_smartField = smartField;
+ callInitializer();
+ }
+
+ @ConfigPropertyValue("false")
+ @Override
+ protected boolean getConfiguredAskIfNeedSave() {
+ return false;
+ }
+
+ @Override
+ protected boolean getConfiguredModal() {
+ return false;
+ }
+
+ @Override
+ protected int getConfiguredDisplayHint() {
+ return DISPLAY_HINT_VIEW;
+ }
+
+ @Override
+ public ISmartField<? extends Object> getSmartField() {
+ return m_smartField;
+ }
+
+ @Override
+ public String getSearchText() {
+ return propertySupport.getPropertyString(PROP_SEARCH_TEXT);
+ }
+
+ @Override
+ public void setSearchText(String text) {
+ propertySupport.setPropertyString(PROP_SEARCH_TEXT, text);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/smartfield/DefaultSmartFieldProposalFormProvider.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/smartfield/DefaultSmartFieldProposalFormProvider.java
index 6d6f760d98..4c9cbb6698 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/smartfield/DefaultSmartFieldProposalFormProvider.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/smartfield/DefaultSmartFieldProposalFormProvider.java
@@ -1,34 +1,34 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.smartfield;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-
-/**
- * @since 3.8.0
- */
-public class DefaultSmartFieldProposalFormProvider implements ISmartFieldProposalFormProvider {
-
- @Override
- public ISmartFieldProposalForm createProposalForm(ISmartField smartField) throws ProcessingException {
- ISmartFieldProposalForm form;
- if (smartField.isBrowseHierarchy()) {
- form = new SmartTreeForm(smartField);
- }
- else {
- form = new SmartTableForm(smartField);
- }
- form.setAutoAddRemoveOnDesktop(false);
-
- return form;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.smartfield;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+
+/**
+ * @since 3.8.0
+ */
+public class DefaultSmartFieldProposalFormProvider implements ISmartFieldProposalFormProvider {
+
+ @Override
+ public ISmartFieldProposalForm createProposalForm(ISmartField smartField) throws ProcessingException {
+ ISmartFieldProposalForm form;
+ if (smartField.isBrowseHierarchy()) {
+ form = new SmartTreeForm(smartField);
+ }
+ else {
+ form = new SmartTableForm(smartField);
+ }
+ form.setAutoAddRemoveOnDesktop(false);
+
+ return form;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/smartfield/ISmartField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/smartfield/ISmartField.java
index faf8931057..fabff047d6 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/smartfield/ISmartField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/smartfield/ISmartField.java
@@ -1,252 +1,252 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.smartfield;
-
-import org.eclipse.scout.commons.TriState;
-import org.eclipse.scout.commons.annotations.ConfigOperation;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.job.JobEx;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.basic.tree.AbstractTree;
-import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
-import org.eclipse.scout.rt.shared.services.common.code.ICodeType;
-import org.eclipse.scout.rt.shared.services.lookup.ILookupCallFetcher;
-import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
-import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
-
-public interface ISmartField<T> extends IValueField<T> {
-
- static final LookupRow EMPTY_LOOKUP_ROW = new LookupRow(null, "", null, null, null, null, null, true);
-
- /**
- * {@link ISmartFieldProposalForm}
- */
- String PROP_PROPOSAL_FORM = "proposalForm";
- /**
- * {@link String}
- */
- String PROP_BROWSE_ICON_ID = "browseIconId";
- /**
- * {@link String}
- */
- String PROP_ICON_ID = "iconId";
-
- String BROWSE_ALL_TEXT = "*";
-
- void addSmartFieldListener(SmartFieldListener listener);
-
- void removeSmartFieldListener(SmartFieldListener listener);
-
- ISmartFieldProposalForm getProposalForm();
-
- ISmartFieldProposalFormProvider getProposalFormProvider();
-
- void setProposalFormProvider(ISmartFieldProposalFormProvider provider);
-
- /**
- * Code-Assistant Don't just allow smart field values, but also custom text as
- * valid values; smartfield is simply used as code assistent
- */
- boolean isAllowCustomText();
-
- /**
- * Code-Assistant Don't just allow smart field values, but also custom text as
- * valid values; smartfield is simply used as code assistent
- */
- void setAllowCustomText(boolean b);
-
- /**
- * true: inactive rows are display and can be also be parsed using the UI
- * facade according to {@link #getActiveFilter()} false: inactive rows are
- * only display when the smart field valud is set by the model. The UI facade
- * cannot choose such a value.
- */
- boolean isActiveFilterEnabled();
-
- /**
- * see {@link #isActiveFilterEnabled()}
- */
- void setActiveFilterEnabled(boolean b);
-
- /**
- * This has only an effect if {@link #isActiveFilterEnabled()} is set to true.
- * true: include only active values false: include only inactive values
- * undefined: include active and inactive values
- */
- TriState getActiveFilter();
-
- /**
- * see {@link #getActiveFilter()}
- */
- void setActiveFilter(TriState t);
-
- String getBrowseIconId();
-
- void setBrowseIconId(String s);
-
- int getBrowseMaxRowCount();
-
- void setBrowseMaxRowCount(int n);
-
- String getIconId();
-
- void setIconId(String s);
-
- /**
- * For performance optimization, style loading is done lazily.
- * However, sometimes it is useful to apply these changes immediately.
- * <p>
- * This method is called automatically by {@link #getDisplayText()}, {@link #getTooltipText()},
- * {@link #getBackgroundColor()}, {@link #getForegroundColor()} and {@link #getFont()}
- */
- void applyLazyStyles();
-
- boolean isBrowseAutoExpandAll();
-
- void setBrowseAutoExpandAll(boolean b);
-
- boolean isBrowseHierarchy();
-
- void setBrowseHierarchy(boolean b);
-
- boolean isBrowseLoadIncremental();
-
- void setBrowseLoadIncremental(boolean b);
-
- /**
- * see {@link AbstractSmartField#execBrowseNew(String)}
- */
- String getBrowseNewText();
-
- /**
- * see {@link AbstractSmartField#execBrowseNew(String)}
- */
- void setBrowseNewText(String s);
-
- /**
- * see {@link AbstractSmartField#execBrowseNew(String)}
- */
- void doBrowseNew(String newText);
-
- /**
- * Filter selection of hierarchy browse tree. The level reported here is
- * different than the one used in
- * {@link AbstractTree#execAcceptSelection(org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode, int)} such as this
- * level is one smaller. This is because a tree smart field
- * assumes its tree to have multiple roots, but the ITree model is built as
- * single-root tree with invisible root node. level=-1 is the invisible
- * (anonymous) root level=0 are the multiple roots of the smart tree ...
- */
- @ConfigOperation
- @Order(330)
- boolean acceptBrowseHierarchySelection(T value, int level, boolean leaf);
-
- /**
- * variant A
- */
- Class<? extends ICodeType> getCodeTypeClass();
-
- void setCodeTypeClass(Class<? extends ICodeType> codeType);
-
- /**
- * variant B
- */
- LookupCall getLookupCall();
-
- void setLookupCall(LookupCall call);
-
- void prepareKeyLookup(LookupCall call, T key) throws ProcessingException;
-
- void prepareTextLookup(LookupCall call, String text) throws ProcessingException;
-
- void prepareBrowseLookup(LookupCall call, String browseHint, TriState activeState) throws ProcessingException;
-
- void prepareRecLookup(LookupCall call, T parentKey, TriState activeState) throws ProcessingException;
-
- /**
- * If the browse lookup call yields exactly one value, assign it to the
- * smartfield, otherwise do nothing.
- *
- * @param background
- * true (default) if assignment should be done later which allows for
- * one batch call for all smartfields. Using background=false assigns
- * the value immediately, which results in an immediate call to the
- * data provider. Whenever possible, background=true should be used
- * to allow for batch calls to the backend.
- * @since 22.05.2009
- */
- void setUniquelyDefinedValue(boolean background) throws ProcessingException;
-
- IMenu[] getMenus();
-
- boolean hasMenus();
-
- /**
- * Revert the value and the text to the value that the smartfield had before a
- * new text (part)was entered. Do not use this method directly This method is
- * only called from one of the choosers outside the smartfield when the
- * chooser was terminated
- */
- void revertValue();
-
- /**
- * This method is normally used by a {@link ISmartFieldProposalForm#acceptProposal()}
- */
- void acceptProposal(LookupRow row);
-
- LookupRow[] callKeyLookup(T key) throws ProcessingException;
-
- LookupRow[] callTextLookup(String text, int maxRowCount) throws ProcessingException;
-
- /**
- * Note: {@link ILookupCallFetcher#dataFetched(LookupRow[], ProcessingException)} is
- * called back in the model thread. The smartfield is automatically starting
- * an internal background thread and syncs the result back into the model
- * thread.
- *
- * @return the created async job if applicable or null, see
- * {@link LookupCall#getDataByTextInBackground(ILookupCallFetcher)}
- */
- JobEx callTextLookupInBackground(String text, int maxRowCount, ILookupCallFetcher fetcher);
-
- LookupRow[] callBrowseLookup(String browseHint, int maxRowCount) throws ProcessingException;
-
- LookupRow[] callBrowseLookup(String browseHint, int maxRowCount, TriState activeState) throws ProcessingException;
-
- /**
- * Note: {@link ILookupCallFetcher#dataFetched(LookupRow[], ProcessingException)} is
- * called back in the model thread. The smartfield is automatically starting
- * an internal background thread and syncs the result back into the model
- * thread.
- *
- * @return the created async job if applicable or null, see
- * {@link LookupCall#getDataByAllInBackground(ILookupCallFetcher)}
- */
- JobEx callBrowseLookupInBackground(String browseHint, int maxRowCount, ILookupCallFetcher fetcher);
-
- /**
- * Note: {@link ILookupCallFetcher#dataFetched(LookupRow[], ProcessingException)} is
- * called back in the model thread. The smartfield is automatically starting
- * an internal background thread and syncs the result back into the model
- * thread.
- *
- * @return the created async job if applicable or null, see
- * {@link LookupCall#getDataByAllInBackground(ILookupCallFetcher)}
- */
- JobEx callBrowseLookupInBackground(String browseHint, int maxRowCount, TriState activeState, ILookupCallFetcher fetcher);
-
- LookupRow[] callSubTreeLookup(T parentKey) throws ProcessingException;
-
- LookupRow[] callSubTreeLookup(T parentKey, TriState activeState) throws ProcessingException;
-
- ISmartFieldUIFacade getUIFacade();
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.smartfield;
+
+import org.eclipse.scout.commons.TriState;
+import org.eclipse.scout.commons.annotations.ConfigOperation;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.job.JobEx;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.basic.tree.AbstractTree;
+import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
+import org.eclipse.scout.rt.shared.services.common.code.ICodeType;
+import org.eclipse.scout.rt.shared.services.lookup.ILookupCallFetcher;
+import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
+import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
+
+public interface ISmartField<T> extends IValueField<T> {
+
+ static final LookupRow EMPTY_LOOKUP_ROW = new LookupRow(null, "", null, null, null, null, null, true);
+
+ /**
+ * {@link ISmartFieldProposalForm}
+ */
+ String PROP_PROPOSAL_FORM = "proposalForm";
+ /**
+ * {@link String}
+ */
+ String PROP_BROWSE_ICON_ID = "browseIconId";
+ /**
+ * {@link String}
+ */
+ String PROP_ICON_ID = "iconId";
+
+ String BROWSE_ALL_TEXT = "*";
+
+ void addSmartFieldListener(SmartFieldListener listener);
+
+ void removeSmartFieldListener(SmartFieldListener listener);
+
+ ISmartFieldProposalForm getProposalForm();
+
+ ISmartFieldProposalFormProvider getProposalFormProvider();
+
+ void setProposalFormProvider(ISmartFieldProposalFormProvider provider);
+
+ /**
+ * Code-Assistant Don't just allow smart field values, but also custom text as
+ * valid values; smartfield is simply used as code assistent
+ */
+ boolean isAllowCustomText();
+
+ /**
+ * Code-Assistant Don't just allow smart field values, but also custom text as
+ * valid values; smartfield is simply used as code assistent
+ */
+ void setAllowCustomText(boolean b);
+
+ /**
+ * true: inactive rows are display and can be also be parsed using the UI
+ * facade according to {@link #getActiveFilter()} false: inactive rows are
+ * only display when the smart field valud is set by the model. The UI facade
+ * cannot choose such a value.
+ */
+ boolean isActiveFilterEnabled();
+
+ /**
+ * see {@link #isActiveFilterEnabled()}
+ */
+ void setActiveFilterEnabled(boolean b);
+
+ /**
+ * This has only an effect if {@link #isActiveFilterEnabled()} is set to true.
+ * true: include only active values false: include only inactive values
+ * undefined: include active and inactive values
+ */
+ TriState getActiveFilter();
+
+ /**
+ * see {@link #getActiveFilter()}
+ */
+ void setActiveFilter(TriState t);
+
+ String getBrowseIconId();
+
+ void setBrowseIconId(String s);
+
+ int getBrowseMaxRowCount();
+
+ void setBrowseMaxRowCount(int n);
+
+ String getIconId();
+
+ void setIconId(String s);
+
+ /**
+ * For performance optimization, style loading is done lazily.
+ * However, sometimes it is useful to apply these changes immediately.
+ * <p>
+ * This method is called automatically by {@link #getDisplayText()}, {@link #getTooltipText()},
+ * {@link #getBackgroundColor()}, {@link #getForegroundColor()} and {@link #getFont()}
+ */
+ void applyLazyStyles();
+
+ boolean isBrowseAutoExpandAll();
+
+ void setBrowseAutoExpandAll(boolean b);
+
+ boolean isBrowseHierarchy();
+
+ void setBrowseHierarchy(boolean b);
+
+ boolean isBrowseLoadIncremental();
+
+ void setBrowseLoadIncremental(boolean b);
+
+ /**
+ * see {@link AbstractSmartField#execBrowseNew(String)}
+ */
+ String getBrowseNewText();
+
+ /**
+ * see {@link AbstractSmartField#execBrowseNew(String)}
+ */
+ void setBrowseNewText(String s);
+
+ /**
+ * see {@link AbstractSmartField#execBrowseNew(String)}
+ */
+ void doBrowseNew(String newText);
+
+ /**
+ * Filter selection of hierarchy browse tree. The level reported here is
+ * different than the one used in
+ * {@link AbstractTree#execAcceptSelection(org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode, int)} such as this
+ * level is one smaller. This is because a tree smart field
+ * assumes its tree to have multiple roots, but the ITree model is built as
+ * single-root tree with invisible root node. level=-1 is the invisible
+ * (anonymous) root level=0 are the multiple roots of the smart tree ...
+ */
+ @ConfigOperation
+ @Order(330)
+ boolean acceptBrowseHierarchySelection(T value, int level, boolean leaf);
+
+ /**
+ * variant A
+ */
+ Class<? extends ICodeType> getCodeTypeClass();
+
+ void setCodeTypeClass(Class<? extends ICodeType> codeType);
+
+ /**
+ * variant B
+ */
+ LookupCall getLookupCall();
+
+ void setLookupCall(LookupCall call);
+
+ void prepareKeyLookup(LookupCall call, T key) throws ProcessingException;
+
+ void prepareTextLookup(LookupCall call, String text) throws ProcessingException;
+
+ void prepareBrowseLookup(LookupCall call, String browseHint, TriState activeState) throws ProcessingException;
+
+ void prepareRecLookup(LookupCall call, T parentKey, TriState activeState) throws ProcessingException;
+
+ /**
+ * If the browse lookup call yields exactly one value, assign it to the
+ * smartfield, otherwise do nothing.
+ *
+ * @param background
+ * true (default) if assignment should be done later which allows for
+ * one batch call for all smartfields. Using background=false assigns
+ * the value immediately, which results in an immediate call to the
+ * data provider. Whenever possible, background=true should be used
+ * to allow for batch calls to the backend.
+ * @since 22.05.2009
+ */
+ void setUniquelyDefinedValue(boolean background) throws ProcessingException;
+
+ IMenu[] getMenus();
+
+ boolean hasMenus();
+
+ /**
+ * Revert the value and the text to the value that the smartfield had before a
+ * new text (part)was entered. Do not use this method directly This method is
+ * only called from one of the choosers outside the smartfield when the
+ * chooser was terminated
+ */
+ void revertValue();
+
+ /**
+ * This method is normally used by a {@link ISmartFieldProposalForm#acceptProposal()}
+ */
+ void acceptProposal(LookupRow row);
+
+ LookupRow[] callKeyLookup(T key) throws ProcessingException;
+
+ LookupRow[] callTextLookup(String text, int maxRowCount) throws ProcessingException;
+
+ /**
+ * Note: {@link ILookupCallFetcher#dataFetched(LookupRow[], ProcessingException)} is
+ * called back in the model thread. The smartfield is automatically starting
+ * an internal background thread and syncs the result back into the model
+ * thread.
+ *
+ * @return the created async job if applicable or null, see
+ * {@link LookupCall#getDataByTextInBackground(ILookupCallFetcher)}
+ */
+ JobEx callTextLookupInBackground(String text, int maxRowCount, ILookupCallFetcher fetcher);
+
+ LookupRow[] callBrowseLookup(String browseHint, int maxRowCount) throws ProcessingException;
+
+ LookupRow[] callBrowseLookup(String browseHint, int maxRowCount, TriState activeState) throws ProcessingException;
+
+ /**
+ * Note: {@link ILookupCallFetcher#dataFetched(LookupRow[], ProcessingException)} is
+ * called back in the model thread. The smartfield is automatically starting
+ * an internal background thread and syncs the result back into the model
+ * thread.
+ *
+ * @return the created async job if applicable or null, see
+ * {@link LookupCall#getDataByAllInBackground(ILookupCallFetcher)}
+ */
+ JobEx callBrowseLookupInBackground(String browseHint, int maxRowCount, ILookupCallFetcher fetcher);
+
+ /**
+ * Note: {@link ILookupCallFetcher#dataFetched(LookupRow[], ProcessingException)} is
+ * called back in the model thread. The smartfield is automatically starting
+ * an internal background thread and syncs the result back into the model
+ * thread.
+ *
+ * @return the created async job if applicable or null, see
+ * {@link LookupCall#getDataByAllInBackground(ILookupCallFetcher)}
+ */
+ JobEx callBrowseLookupInBackground(String browseHint, int maxRowCount, TriState activeState, ILookupCallFetcher fetcher);
+
+ LookupRow[] callSubTreeLookup(T parentKey) throws ProcessingException;
+
+ LookupRow[] callSubTreeLookup(T parentKey, TriState activeState) throws ProcessingException;
+
+ ISmartFieldUIFacade getUIFacade();
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/smartfield/ISmartFieldProposalForm.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/smartfield/ISmartFieldProposalForm.java
index e15098a95d..c141ac8d55 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/smartfield/ISmartFieldProposalForm.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/smartfield/ISmartFieldProposalForm.java
@@ -1,55 +1,55 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.smartfield;
-
-import org.eclipse.scout.commons.annotations.FormData;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
-
-public interface ISmartFieldProposalForm extends IForm {
- String PROP_SEARCH_TEXT = "searchText";
-
- ISmartField<?> getSmartField();
-
- @FormData
- String getSearchText();
-
- @FormData
- void setSearchText(String text);
-
- void startForm() throws ProcessingException;
-
- /**
- * @param selectCurrentValue
- * select the current smartfield value in the proposal table/tree/custom
- * If necessary in a tree, load the tree children until the key is found
- * @param synchronous
- * true to execute the lookup call synchronous
- */
- void update(boolean selectCurrentValue, boolean synchronous) throws ProcessingException;
-
- /**
- * Force a proposal to be selected if possible, this means that for example if there is just one proposal, then select
- * it,
- * or if multiple values are there, select the first one.
- */
- void forceProposalSelection() throws ProcessingException;
-
- /**
- * This method may call {@link ISmartField#acceptProposal(LookupRow)}
- *
- * @return true if a propsal was accepted (might be a single match or the
- * selcted one that is enabled)
- */
- LookupRow getAcceptedProposal() throws ProcessingException;
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.smartfield;
+
+import org.eclipse.scout.commons.annotations.FormData;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
+
+public interface ISmartFieldProposalForm extends IForm {
+ String PROP_SEARCH_TEXT = "searchText";
+
+ ISmartField<?> getSmartField();
+
+ @FormData
+ String getSearchText();
+
+ @FormData
+ void setSearchText(String text);
+
+ void startForm() throws ProcessingException;
+
+ /**
+ * @param selectCurrentValue
+ * select the current smartfield value in the proposal table/tree/custom
+ * If necessary in a tree, load the tree children until the key is found
+ * @param synchronous
+ * true to execute the lookup call synchronous
+ */
+ void update(boolean selectCurrentValue, boolean synchronous) throws ProcessingException;
+
+ /**
+ * Force a proposal to be selected if possible, this means that for example if there is just one proposal, then select
+ * it,
+ * or if multiple values are there, select the first one.
+ */
+ void forceProposalSelection() throws ProcessingException;
+
+ /**
+ * This method may call {@link ISmartField#acceptProposal(LookupRow)}
+ *
+ * @return true if a propsal was accepted (might be a single match or the
+ * selcted one that is enabled)
+ */
+ LookupRow getAcceptedProposal() throws ProcessingException;
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/smartfield/ISmartFieldProposalFormProvider.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/smartfield/ISmartFieldProposalFormProvider.java
index 9000b44710..d8a2d8a0f3 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/smartfield/ISmartFieldProposalFormProvider.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/smartfield/ISmartFieldProposalFormProvider.java
@@ -1,22 +1,22 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.smartfield;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-
-/**
- * Responsible for creating {@link ISmartFieldProposalForm}.
- *
- * @since 3.8.0
- */
-public interface ISmartFieldProposalFormProvider {
- ISmartFieldProposalForm createProposalForm(ISmartField smartField) throws ProcessingException;
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.smartfield;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+
+/**
+ * Responsible for creating {@link ISmartFieldProposalForm}.
+ *
+ * @since 3.8.0
+ */
+public interface ISmartFieldProposalFormProvider {
+ ISmartFieldProposalForm createProposalForm(ISmartField smartField) throws ProcessingException;
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/smartfield/ISmartFieldUIFacade.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/smartfield/ISmartFieldUIFacade.java
index 9cb6042bf4..e9f538a1c1 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/smartfield/ISmartFieldUIFacade.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/smartfield/ISmartFieldUIFacade.java
@@ -1,30 +1,30 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.smartfield;
-
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-
-public interface ISmartFieldUIFacade {
-
- IMenu[] firePopupFromUI();
-
- /**
- * This may result in a property change {@link ISmartField#PROP_PROPOSAL_FORM} see
- * {@link ISmartField#getProposalForm()}
- */
- void openProposalFromUI(String newText, boolean selectCurrentValue);
-
- boolean acceptProposalFromUI();
-
- boolean setTextFromUI(String text);
-
- void unregisterProposalFormFromUI(ISmartFieldProposalForm form);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.smartfield;
+
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+
+public interface ISmartFieldUIFacade {
+
+ IMenu[] firePopupFromUI();
+
+ /**
+ * This may result in a property change {@link ISmartField#PROP_PROPOSAL_FORM} see
+ * {@link ISmartField#getProposalForm()}
+ */
+ void openProposalFromUI(String newText, boolean selectCurrentValue);
+
+ boolean acceptProposalFromUI();
+
+ boolean setTextFromUI(String text);
+
+ void unregisterProposalFormFromUI(ISmartFieldProposalForm form);
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/smartfield/SmartFieldEvent.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/smartfield/SmartFieldEvent.java
index 8ba7b6585c..2b86bf97cd 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/smartfield/SmartFieldEvent.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/smartfield/SmartFieldEvent.java
@@ -1,31 +1,31 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.smartfield;
-
-public class SmartFieldEvent extends java.util.EventObject {
- private static final long serialVersionUID = 1L;
-
- private int m_type;
-
- public SmartFieldEvent(ISmartField source, int type) {
- super(source);
- m_type = type;
- }
-
- public ISmartField getSmartField() {
- return (ISmartField) getSource();
- }
-
- public int getType() {
- return m_type;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.smartfield;
+
+public class SmartFieldEvent extends java.util.EventObject {
+ private static final long serialVersionUID = 1L;
+
+ private int m_type;
+
+ public SmartFieldEvent(ISmartField source, int type) {
+ super(source);
+ m_type = type;
+ }
+
+ public ISmartField getSmartField() {
+ return (ISmartField) getSource();
+ }
+
+ public int getType() {
+ return m_type;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/smartfield/SmartFieldListener.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/smartfield/SmartFieldListener.java
index fe46fb3c78..5c45daf275 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/smartfield/SmartFieldListener.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/smartfield/SmartFieldListener.java
@@ -1,17 +1,17 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.smartfield;
-
-import java.util.EventListener;
-
-public interface SmartFieldListener extends EventListener {
- void smartFieldChanged(SmartFieldEvent e);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.smartfield;
+
+import java.util.EventListener;
+
+public interface SmartFieldListener extends EventListener {
+ void smartFieldChanged(SmartFieldEvent e);
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/smartfield/SmartTableForm.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/smartfield/SmartTableForm.java
index cb31fa49cc..e62d01f91a 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/smartfield/SmartTableForm.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/smartfield/SmartTableForm.java
@@ -1,572 +1,572 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.smartfield;
-
-import java.util.List;
-
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.commons.TriState;
-import org.eclipse.scout.commons.annotations.ConfigOperation;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.exception.ProcessingStatus;
-import org.eclipse.scout.commons.job.JobEx;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
-import org.eclipse.scout.rt.client.ui.basic.table.AbstractTable;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractStringColumn;
-import org.eclipse.scout.rt.client.ui.form.AbstractFormHandler;
-import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractButton;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
-import org.eclipse.scout.rt.client.ui.form.fields.radiobuttongroup.AbstractRadioButtonGroup;
-import org.eclipse.scout.rt.client.ui.form.fields.smartfield.SmartTableForm.MainBox.ActiveStateRadioButtonGroup;
-import org.eclipse.scout.rt.client.ui.form.fields.smartfield.SmartTableForm.MainBox.NewButton;
-import org.eclipse.scout.rt.client.ui.form.fields.smartfield.SmartTableForm.MainBox.ResultTableField;
-import org.eclipse.scout.rt.client.ui.form.fields.smartfield.SmartTableForm.MainBox.ResultTableField.Table;
-import org.eclipse.scout.rt.client.ui.form.fields.tablefield.AbstractTableField;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.services.lookup.ILookupCallFetcher;
-import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
-
-public class SmartTableForm extends AbstractSmartFieldProposalForm {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(SmartTableForm.class);
-
- private JobEx m_dataLoadJob;
- private Object m_lastSelectedKey;
-
- public SmartTableForm(ISmartField<?> smartField) throws ProcessingException {
- super(smartField);
- }
-
- @Override
- public void forceProposalSelection() throws ProcessingException {
- ResultTableField.Table table = getResultTableField().getTable();
- table.selectNextRow();
- }
-
- @Override
- public void update(final boolean selectCurrentValue, boolean synchronous) throws ProcessingException {
- String text = getSearchText();
- if (text == null) {
- text = "";
- }
- final String textNonNull = text;
- final int maxCount = getSmartField().getBrowseMaxRowCount();
- getResultTableField().setTablePopulateStatus(new ProcessingStatus(ScoutTexts.get("searchingProposals"), ProcessingStatus.WARNING));
- if (m_dataLoadJob != null) {
- m_dataLoadJob.cancel();
- }
- ILookupCallFetcher fetcher = new ILookupCallFetcher() {
- @Override
- public void dataFetched(LookupRow[] rows, ProcessingException failed) {
- dataFetchedDelegate(rows, failed, maxCount, selectCurrentValue);
- }
- };
- // go async/sync
- if (synchronous) {
- try {
- LookupRow[] rows;
- if (ISmartField.BROWSE_ALL_TEXT.equals(text)) {
- rows = getSmartField().callBrowseLookup(text, maxCount > 0 ? maxCount + 1 : 0);
- }
- else if (text.length() == 0) {
- rows = getSmartField().callBrowseLookup(text, maxCount > 0 ? maxCount + 1 : 0);
- }
- else {
- rows = getSmartField().callTextLookup(text, maxCount > 0 ? maxCount + 1 : 0);
- }
- fetcher.dataFetched(rows, null);
- }
- catch (ProcessingException e) {
- fetcher.dataFetched(null, e);
- }
- }
- else {
- if (ISmartField.BROWSE_ALL_TEXT.equals(textNonNull)) {
- m_dataLoadJob = getSmartField().callBrowseLookupInBackground(textNonNull, maxCount > 0 ? maxCount + 1 : 0, fetcher);
- }
- else if (textNonNull.length() == 0) {
- m_dataLoadJob = getSmartField().callBrowseLookupInBackground(textNonNull, maxCount > 0 ? maxCount + 1 : 0, fetcher);
- }
- else {
- m_dataLoadJob = getSmartField().callTextLookupInBackground(textNonNull, maxCount > 0 ? maxCount + 1 : 0, fetcher);
- }
- }
- }
-
- private void dataFetchedDelegate(LookupRow[] rows, ProcessingException failed, int maxCount, boolean selectCurrentValue) {
- try {
- // populate table
- ResultTableField.Table table = getResultTableField().getTable();
- if (rows == null) {
- rows = LookupRow.EMPTY_ARRAY;
- }
- int n = rows.length;
- if (maxCount > 0) {
- n = Math.min(n, maxCount);
- }
- ITableRow[] tableRows = new ITableRow[n];
- for (int i = 0; i < n; i++) {
- tableRows[i] = table.createRow(new Object[]{rows[i], null});
- tableRows[i].setEnabled(rows[i].isEnabled());
- }
- try {
- table.setTableChanging(true);
- table.discardAllRows();
- table.addRows(tableRows);
- //restore selection
- Object keyToSelect = null;
- if (selectCurrentValue) {
- m_lastSelectedKey = getSmartField().getValue();
- keyToSelect = m_lastSelectedKey;
- }
- else if (table.getRowCount() == 1 && !getSmartField().isAllowCustomText()) {
- // select first
- keyToSelect = table.getKeyColumn().getValue(0).getKey();
- }
- if (keyToSelect != null) {
- for (ITableRow row : table.getRows()) {
- if (CompareUtility.equals(keyToSelect, table.getKeyColumn().getValue(row).getKey())) {
- table.selectRow(row);
- if (table.isCheckable()) {
- table.checkRow(row, true);
- }
- break;
- }
- }
- }
- }
- finally {
- table.setTableChanging(false);
- }
- String statusText = null;
- int severity = ProcessingStatus.INFO;
- if (failed != null) {
- statusText = failed.getStatus().getMessage();
- severity = ProcessingStatus.ERROR;
- }
- else if (rows.length <= 0) {
- statusText = ScoutTexts.get("SmartFieldCannotComplete", getSearchText());
- severity = ProcessingStatus.WARNING;
- }
- else if (rows.length > getSmartField().getBrowseMaxRowCount()) {
- statusText = ScoutTexts.get("SmartFieldMoreThanXRows", "" + getSmartField().getBrowseMaxRowCount());
- severity = ProcessingStatus.INFO;
- }
- if (statusText != null) {
- getResultTableField().setTablePopulateStatus(new ProcessingStatus(statusText, severity));
- }
- else {
- getResultTableField().setTablePopulateStatus(null);
- }
- if (getNewButton().isEnabled()) {
- getNewButton().setVisible(table.getRowCount() <= 0);
- }
- structureChanged(getResultTableField());
- }
- catch (ProcessingException e) {
- LOG.warn("update proposal list", e);
- }
- }
-
- /**
- * Override this method to change that behaviour of what is a single match.
- * <p>
- * By default a single match is when there is only one enabled row in the drop down table
- * </p>
- */
- @ConfigOperation
- @Order(120)
- protected LookupRow execGetSingleMatch() {
- int matchCount = 0;
- LookupRow foundRow = null;
- for (LookupRow row : getResultTableField().getTable().getKeyColumn().getValues()) {
- if (row.isEnabled()) {
- foundRow = row;
- matchCount++;
- }
- }
- if (matchCount == 1) {
- return foundRow;
- }
- else {
- return null;
- }
- }
-
- /**
- * Override this method to change the behaviour when a row is clicked in the result {@link Table}.
- * <p>
- * By default the form is closed with {@link #doOk()}.
- * </p>
- *
- * @param row
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(130)
- protected void execResultTableRowClicked(ITableRow row) throws ProcessingException {
- LookupRow lrow = getResultTableField().getTable().getKeyColumn().getSelectedValue();
- if (lrow != null && lrow.isEnabled()) {
- doOk();
- }
- }
-
- /**
- * Override this method to adapt the menu list of the result {@link Table}
- */
- protected void injectResultTableMenus(List<IMenu> menuList) {
- }
-
- @Override
- public LookupRow getAcceptedProposal() throws ProcessingException {
- LookupRow row = getSelectedLookupRow();
- if (row != null && row.isEnabled()) {
- return row;
- }
- else if (getSmartField().isAllowCustomText()) {
- return null;
- }
- else {
- return execGetSingleMatch();
- }
- }
-
- public LookupRow getSelectedLookupRow() {
- Table table = getResultTableField().getTable();
- LookupRow row = null;
- if (table.isCheckable()) {
- ITableRow[] checkedRows = table.getCheckedRows();
- if (checkedRows != null && checkedRows.length > 0) {
- row = table.getKeyColumn().getValue(checkedRows[0]);
- }
- }
- else {
- row = table.getKeyColumn().getSelectedValue();
- }
-
- return row;
- }
-
- /*
- * Dialog start
- */
- @Override
- public void startForm() throws ProcessingException {
- startInternal(new FormHandler());
- }
-
- public MainBox getMainBox() {
- return (MainBox) getRootGroupBox();
- }
-
- public ResultTableField getResultTableField() {
- return getFieldByClass(ResultTableField.class);
- }
-
- public ActiveStateRadioButtonGroup getActiveStateRadioButtonGroup() {
- return getFieldByClass(ActiveStateRadioButtonGroup.class);
- }
-
- /*
- * Fields
- */
- public NewButton getNewButton() {
- return getFieldByClass(NewButton.class);
- }
-
- public class MainBox extends AbstractGroupBox {
-
- @Override
- protected boolean getConfiguredBorderVisible() {
- return false;
- }
-
- @Override
- protected int getConfiguredGridColumnCount() {
- return 1;
- }
-
- @Override
- protected boolean getConfiguredGridUseUiWidth() {
- return true;
- }
-
- @Override
- protected boolean getConfiguredGridUseUiHeight() {
- return true;
- }
-
- @Order(10)
- public class ResultTableField extends AbstractTableField<ResultTableField.Table> {
-
- public ResultTableField() {
- super();
- }
-
- @Override
- protected boolean getConfiguredLabelVisible() {
- return false;
- }
-
- @Override
- protected double getConfiguredGridWeightY() {
- return 1;
- }
-
- @Override
- protected boolean getConfiguredGridUseUiWidth() {
- return true;
- }
-
- @Override
- protected boolean getConfiguredGridUseUiHeight() {
- return true;
- }
-
- @Override
- protected boolean getConfiguredTableStatusVisible() {
- return true;
- }
-
- @Override
- protected void execUpdateTableStatus() {
- //nop
- }
-
- /*
- * inner table
- */
- @Order(4)
- public class Table extends AbstractTable {
-
- @Override
- protected void injectMenusInternal(List<IMenu> menuList) {
- injectResultTableMenus(menuList);
- }
-
- @Override
- protected boolean getConfiguredAutoResizeColumns() {
- return true;
- }
-
- @Override
- protected boolean getConfiguredHeaderVisible() {
- return false;
- }
-
- @Override
- protected boolean getConfiguredMultiSelect() {
- return false;
- }
-
- @Override
- protected boolean getConfiguredMultiCheck() {
- return false;
- }
-
- @Override
- protected boolean getConfiguredScrollToSelection() {
- return true;
- }
-
- @Override
- protected void execRowClick(ITableRow row) throws ProcessingException {
- execResultTableRowClicked(row);
- }
-
- public KeyColumn getKeyColumn() {
- return getColumnSet().getColumnByClass(KeyColumn.class);
- }
-
- public TextColumn getTextColumn() {
- return getColumnSet().getColumnByClass(TextColumn.class);
- }
-
- @Order(1)
- public class KeyColumn extends AbstractColumn<LookupRow> {
- @Override
- protected boolean getConfiguredPrimaryKey() {
- return true;
- }
-
- @Override
- protected boolean getConfiguredDisplayable() {
- return false;
- }
- }
-
- @Order(2)
- public class TextColumn extends AbstractStringColumn {
- @Override
- protected void execDecorateCell(Cell cell, ITableRow row) {
- LookupRow lookupRow = getKeyColumn().getValue(row);
- cell.setText(lookupRow.getText());
- cell.setTooltipText(lookupRow.getTooltipText());
- cell.setBackgroundColor(lookupRow.getBackgroundColor());
- cell.setForegroundColor(lookupRow.getForegroundColor());
- cell.setFont(lookupRow.getFont());
- if (getResultTableField().getTable().getDefaultIconId() == null) {
- if (lookupRow.getIconId() != null) {
- cell.setIconId(lookupRow.getIconId());
- }
- }
- }
- }
- }
- }
-
- @Order(30)
- public class ActiveStateRadioButtonGroup extends AbstractRadioButtonGroup<TriState> {
-
- @Override
- protected boolean getConfiguredLabelVisible() {
- return false;
- }
-
- @Override
- protected void execChangedValue() throws ProcessingException {
- if (isVisible() && !isFormLoading()) {
- getSmartField().setActiveFilter(getValue());
- update(false, false);
- }
- }
-
- @Order(10)
- public class ActiveButton extends AbstractButton {
-
- @Override
- protected int getConfiguredDisplayStyle() {
- return DISPLAY_STYLE_RADIO;
- }
-
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("ActiveStates");
- }
-
- @Override
- protected Object getConfiguredRadioValue() {
- return TriState.TRUE;
- }
- }
-
- @Order(20)
- public class InactiveButton extends AbstractButton {
-
- @Override
- protected int getConfiguredDisplayStyle() {
- return DISPLAY_STYLE_RADIO;
- }
-
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("InactiveStates");
- }
-
- @Override
- protected Object getConfiguredRadioValue() {
- return TriState.FALSE;
- }
- }
-
- @Order(30)
- public class ActiveAndInactiveButton extends AbstractButton {
-
- @Override
- protected int getConfiguredDisplayStyle() {
- return DISPLAY_STYLE_RADIO;
- }
-
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("ActiveAndInactiveStates");
- }
-
- @Override
- protected Object getConfiguredRadioValue() {
- return TriState.UNDEFINED;
- }
- }
- }
-
- @Order(40)
- public class NewButton extends AbstractButton {
- @Override
- protected boolean getConfiguredLabelVisible() {
- return false;
- }
-
- @Override
- protected boolean getConfiguredVisible() {
- return false;
- }
-
- @Override
- protected boolean getConfiguredEnabled() {
- return false;
- }
-
- @Override
- protected boolean getConfiguredFillHorizontal() {
- return false;
- }
-
- @Override
- protected int getConfiguredDisplayStyle() {
- return DISPLAY_STYLE_LINK;
- }
-
- @Override
- protected boolean getConfiguredProcessButton() {
- return false;
- }
-
- @Override
- protected void execClickAction() throws ProcessingException {
- getSmartField().doBrowseNew(getSearchText());
- }
- }// end field
-
- }// end main box
-
- /*
- * handlers
- */
- private class FormHandler extends AbstractFormHandler {
-
- @Override
- protected void execLoad() throws ProcessingException {
- getResultTableField().getTable().setDefaultIconId(getSmartField().getBrowseIconId());
- getActiveStateRadioButtonGroup().setVisible(getSmartField().isActiveFilterEnabled());
- getActiveStateRadioButtonGroup().setValue(getSmartField().getActiveFilter());
- getNewButton().setEnabled(getSmartField().getBrowseNewText() != null);
- getNewButton().setLabel(getSmartField().getBrowseNewText());
- }
-
- @Override
- protected boolean execValidate() throws ProcessingException {
- return getAcceptedProposal() != null || getSmartField().isAllowCustomText();
- }
-
- @Override
- protected void execFinally() throws ProcessingException {
- if (m_dataLoadJob != null) {
- m_dataLoadJob.cancel();
- }
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.smartfield;
+
+import java.util.List;
+
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.commons.TriState;
+import org.eclipse.scout.commons.annotations.ConfigOperation;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.exception.ProcessingStatus;
+import org.eclipse.scout.commons.job.JobEx;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
+import org.eclipse.scout.rt.client.ui.basic.table.AbstractTable;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractStringColumn;
+import org.eclipse.scout.rt.client.ui.form.AbstractFormHandler;
+import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractButton;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
+import org.eclipse.scout.rt.client.ui.form.fields.radiobuttongroup.AbstractRadioButtonGroup;
+import org.eclipse.scout.rt.client.ui.form.fields.smartfield.SmartTableForm.MainBox.ActiveStateRadioButtonGroup;
+import org.eclipse.scout.rt.client.ui.form.fields.smartfield.SmartTableForm.MainBox.NewButton;
+import org.eclipse.scout.rt.client.ui.form.fields.smartfield.SmartTableForm.MainBox.ResultTableField;
+import org.eclipse.scout.rt.client.ui.form.fields.smartfield.SmartTableForm.MainBox.ResultTableField.Table;
+import org.eclipse.scout.rt.client.ui.form.fields.tablefield.AbstractTableField;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.services.lookup.ILookupCallFetcher;
+import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
+
+public class SmartTableForm extends AbstractSmartFieldProposalForm {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(SmartTableForm.class);
+
+ private JobEx m_dataLoadJob;
+ private Object m_lastSelectedKey;
+
+ public SmartTableForm(ISmartField<?> smartField) throws ProcessingException {
+ super(smartField);
+ }
+
+ @Override
+ public void forceProposalSelection() throws ProcessingException {
+ ResultTableField.Table table = getResultTableField().getTable();
+ table.selectNextRow();
+ }
+
+ @Override
+ public void update(final boolean selectCurrentValue, boolean synchronous) throws ProcessingException {
+ String text = getSearchText();
+ if (text == null) {
+ text = "";
+ }
+ final String textNonNull = text;
+ final int maxCount = getSmartField().getBrowseMaxRowCount();
+ getResultTableField().setTablePopulateStatus(new ProcessingStatus(ScoutTexts.get("searchingProposals"), ProcessingStatus.WARNING));
+ if (m_dataLoadJob != null) {
+ m_dataLoadJob.cancel();
+ }
+ ILookupCallFetcher fetcher = new ILookupCallFetcher() {
+ @Override
+ public void dataFetched(LookupRow[] rows, ProcessingException failed) {
+ dataFetchedDelegate(rows, failed, maxCount, selectCurrentValue);
+ }
+ };
+ // go async/sync
+ if (synchronous) {
+ try {
+ LookupRow[] rows;
+ if (ISmartField.BROWSE_ALL_TEXT.equals(text)) {
+ rows = getSmartField().callBrowseLookup(text, maxCount > 0 ? maxCount + 1 : 0);
+ }
+ else if (text.length() == 0) {
+ rows = getSmartField().callBrowseLookup(text, maxCount > 0 ? maxCount + 1 : 0);
+ }
+ else {
+ rows = getSmartField().callTextLookup(text, maxCount > 0 ? maxCount + 1 : 0);
+ }
+ fetcher.dataFetched(rows, null);
+ }
+ catch (ProcessingException e) {
+ fetcher.dataFetched(null, e);
+ }
+ }
+ else {
+ if (ISmartField.BROWSE_ALL_TEXT.equals(textNonNull)) {
+ m_dataLoadJob = getSmartField().callBrowseLookupInBackground(textNonNull, maxCount > 0 ? maxCount + 1 : 0, fetcher);
+ }
+ else if (textNonNull.length() == 0) {
+ m_dataLoadJob = getSmartField().callBrowseLookupInBackground(textNonNull, maxCount > 0 ? maxCount + 1 : 0, fetcher);
+ }
+ else {
+ m_dataLoadJob = getSmartField().callTextLookupInBackground(textNonNull, maxCount > 0 ? maxCount + 1 : 0, fetcher);
+ }
+ }
+ }
+
+ private void dataFetchedDelegate(LookupRow[] rows, ProcessingException failed, int maxCount, boolean selectCurrentValue) {
+ try {
+ // populate table
+ ResultTableField.Table table = getResultTableField().getTable();
+ if (rows == null) {
+ rows = LookupRow.EMPTY_ARRAY;
+ }
+ int n = rows.length;
+ if (maxCount > 0) {
+ n = Math.min(n, maxCount);
+ }
+ ITableRow[] tableRows = new ITableRow[n];
+ for (int i = 0; i < n; i++) {
+ tableRows[i] = table.createRow(new Object[]{rows[i], null});
+ tableRows[i].setEnabled(rows[i].isEnabled());
+ }
+ try {
+ table.setTableChanging(true);
+ table.discardAllRows();
+ table.addRows(tableRows);
+ //restore selection
+ Object keyToSelect = null;
+ if (selectCurrentValue) {
+ m_lastSelectedKey = getSmartField().getValue();
+ keyToSelect = m_lastSelectedKey;
+ }
+ else if (table.getRowCount() == 1 && !getSmartField().isAllowCustomText()) {
+ // select first
+ keyToSelect = table.getKeyColumn().getValue(0).getKey();
+ }
+ if (keyToSelect != null) {
+ for (ITableRow row : table.getRows()) {
+ if (CompareUtility.equals(keyToSelect, table.getKeyColumn().getValue(row).getKey())) {
+ table.selectRow(row);
+ if (table.isCheckable()) {
+ table.checkRow(row, true);
+ }
+ break;
+ }
+ }
+ }
+ }
+ finally {
+ table.setTableChanging(false);
+ }
+ String statusText = null;
+ int severity = ProcessingStatus.INFO;
+ if (failed != null) {
+ statusText = failed.getStatus().getMessage();
+ severity = ProcessingStatus.ERROR;
+ }
+ else if (rows.length <= 0) {
+ statusText = ScoutTexts.get("SmartFieldCannotComplete", getSearchText());
+ severity = ProcessingStatus.WARNING;
+ }
+ else if (rows.length > getSmartField().getBrowseMaxRowCount()) {
+ statusText = ScoutTexts.get("SmartFieldMoreThanXRows", "" + getSmartField().getBrowseMaxRowCount());
+ severity = ProcessingStatus.INFO;
+ }
+ if (statusText != null) {
+ getResultTableField().setTablePopulateStatus(new ProcessingStatus(statusText, severity));
+ }
+ else {
+ getResultTableField().setTablePopulateStatus(null);
+ }
+ if (getNewButton().isEnabled()) {
+ getNewButton().setVisible(table.getRowCount() <= 0);
+ }
+ structureChanged(getResultTableField());
+ }
+ catch (ProcessingException e) {
+ LOG.warn("update proposal list", e);
+ }
+ }
+
+ /**
+ * Override this method to change that behaviour of what is a single match.
+ * <p>
+ * By default a single match is when there is only one enabled row in the drop down table
+ * </p>
+ */
+ @ConfigOperation
+ @Order(120)
+ protected LookupRow execGetSingleMatch() {
+ int matchCount = 0;
+ LookupRow foundRow = null;
+ for (LookupRow row : getResultTableField().getTable().getKeyColumn().getValues()) {
+ if (row.isEnabled()) {
+ foundRow = row;
+ matchCount++;
+ }
+ }
+ if (matchCount == 1) {
+ return foundRow;
+ }
+ else {
+ return null;
+ }
+ }
+
+ /**
+ * Override this method to change the behaviour when a row is clicked in the result {@link Table}.
+ * <p>
+ * By default the form is closed with {@link #doOk()}.
+ * </p>
+ *
+ * @param row
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(130)
+ protected void execResultTableRowClicked(ITableRow row) throws ProcessingException {
+ LookupRow lrow = getResultTableField().getTable().getKeyColumn().getSelectedValue();
+ if (lrow != null && lrow.isEnabled()) {
+ doOk();
+ }
+ }
+
+ /**
+ * Override this method to adapt the menu list of the result {@link Table}
+ */
+ protected void injectResultTableMenus(List<IMenu> menuList) {
+ }
+
+ @Override
+ public LookupRow getAcceptedProposal() throws ProcessingException {
+ LookupRow row = getSelectedLookupRow();
+ if (row != null && row.isEnabled()) {
+ return row;
+ }
+ else if (getSmartField().isAllowCustomText()) {
+ return null;
+ }
+ else {
+ return execGetSingleMatch();
+ }
+ }
+
+ public LookupRow getSelectedLookupRow() {
+ Table table = getResultTableField().getTable();
+ LookupRow row = null;
+ if (table.isCheckable()) {
+ ITableRow[] checkedRows = table.getCheckedRows();
+ if (checkedRows != null && checkedRows.length > 0) {
+ row = table.getKeyColumn().getValue(checkedRows[0]);
+ }
+ }
+ else {
+ row = table.getKeyColumn().getSelectedValue();
+ }
+
+ return row;
+ }
+
+ /*
+ * Dialog start
+ */
+ @Override
+ public void startForm() throws ProcessingException {
+ startInternal(new FormHandler());
+ }
+
+ public MainBox getMainBox() {
+ return (MainBox) getRootGroupBox();
+ }
+
+ public ResultTableField getResultTableField() {
+ return getFieldByClass(ResultTableField.class);
+ }
+
+ public ActiveStateRadioButtonGroup getActiveStateRadioButtonGroup() {
+ return getFieldByClass(ActiveStateRadioButtonGroup.class);
+ }
+
+ /*
+ * Fields
+ */
+ public NewButton getNewButton() {
+ return getFieldByClass(NewButton.class);
+ }
+
+ public class MainBox extends AbstractGroupBox {
+
+ @Override
+ protected boolean getConfiguredBorderVisible() {
+ return false;
+ }
+
+ @Override
+ protected int getConfiguredGridColumnCount() {
+ return 1;
+ }
+
+ @Override
+ protected boolean getConfiguredGridUseUiWidth() {
+ return true;
+ }
+
+ @Override
+ protected boolean getConfiguredGridUseUiHeight() {
+ return true;
+ }
+
+ @Order(10)
+ public class ResultTableField extends AbstractTableField<ResultTableField.Table> {
+
+ public ResultTableField() {
+ super();
+ }
+
+ @Override
+ protected boolean getConfiguredLabelVisible() {
+ return false;
+ }
+
+ @Override
+ protected double getConfiguredGridWeightY() {
+ return 1;
+ }
+
+ @Override
+ protected boolean getConfiguredGridUseUiWidth() {
+ return true;
+ }
+
+ @Override
+ protected boolean getConfiguredGridUseUiHeight() {
+ return true;
+ }
+
+ @Override
+ protected boolean getConfiguredTableStatusVisible() {
+ return true;
+ }
+
+ @Override
+ protected void execUpdateTableStatus() {
+ //nop
+ }
+
+ /*
+ * inner table
+ */
+ @Order(4)
+ public class Table extends AbstractTable {
+
+ @Override
+ protected void injectMenusInternal(List<IMenu> menuList) {
+ injectResultTableMenus(menuList);
+ }
+
+ @Override
+ protected boolean getConfiguredAutoResizeColumns() {
+ return true;
+ }
+
+ @Override
+ protected boolean getConfiguredHeaderVisible() {
+ return false;
+ }
+
+ @Override
+ protected boolean getConfiguredMultiSelect() {
+ return false;
+ }
+
+ @Override
+ protected boolean getConfiguredMultiCheck() {
+ return false;
+ }
+
+ @Override
+ protected boolean getConfiguredScrollToSelection() {
+ return true;
+ }
+
+ @Override
+ protected void execRowClick(ITableRow row) throws ProcessingException {
+ execResultTableRowClicked(row);
+ }
+
+ public KeyColumn getKeyColumn() {
+ return getColumnSet().getColumnByClass(KeyColumn.class);
+ }
+
+ public TextColumn getTextColumn() {
+ return getColumnSet().getColumnByClass(TextColumn.class);
+ }
+
+ @Order(1)
+ public class KeyColumn extends AbstractColumn<LookupRow> {
+ @Override
+ protected boolean getConfiguredPrimaryKey() {
+ return true;
+ }
+
+ @Override
+ protected boolean getConfiguredDisplayable() {
+ return false;
+ }
+ }
+
+ @Order(2)
+ public class TextColumn extends AbstractStringColumn {
+ @Override
+ protected void execDecorateCell(Cell cell, ITableRow row) {
+ LookupRow lookupRow = getKeyColumn().getValue(row);
+ cell.setText(lookupRow.getText());
+ cell.setTooltipText(lookupRow.getTooltipText());
+ cell.setBackgroundColor(lookupRow.getBackgroundColor());
+ cell.setForegroundColor(lookupRow.getForegroundColor());
+ cell.setFont(lookupRow.getFont());
+ if (getResultTableField().getTable().getDefaultIconId() == null) {
+ if (lookupRow.getIconId() != null) {
+ cell.setIconId(lookupRow.getIconId());
+ }
+ }
+ }
+ }
+ }
+ }
+
+ @Order(30)
+ public class ActiveStateRadioButtonGroup extends AbstractRadioButtonGroup<TriState> {
+
+ @Override
+ protected boolean getConfiguredLabelVisible() {
+ return false;
+ }
+
+ @Override
+ protected void execChangedValue() throws ProcessingException {
+ if (isVisible() && !isFormLoading()) {
+ getSmartField().setActiveFilter(getValue());
+ update(false, false);
+ }
+ }
+
+ @Order(10)
+ public class ActiveButton extends AbstractButton {
+
+ @Override
+ protected int getConfiguredDisplayStyle() {
+ return DISPLAY_STYLE_RADIO;
+ }
+
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("ActiveStates");
+ }
+
+ @Override
+ protected Object getConfiguredRadioValue() {
+ return TriState.TRUE;
+ }
+ }
+
+ @Order(20)
+ public class InactiveButton extends AbstractButton {
+
+ @Override
+ protected int getConfiguredDisplayStyle() {
+ return DISPLAY_STYLE_RADIO;
+ }
+
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("InactiveStates");
+ }
+
+ @Override
+ protected Object getConfiguredRadioValue() {
+ return TriState.FALSE;
+ }
+ }
+
+ @Order(30)
+ public class ActiveAndInactiveButton extends AbstractButton {
+
+ @Override
+ protected int getConfiguredDisplayStyle() {
+ return DISPLAY_STYLE_RADIO;
+ }
+
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("ActiveAndInactiveStates");
+ }
+
+ @Override
+ protected Object getConfiguredRadioValue() {
+ return TriState.UNDEFINED;
+ }
+ }
+ }
+
+ @Order(40)
+ public class NewButton extends AbstractButton {
+ @Override
+ protected boolean getConfiguredLabelVisible() {
+ return false;
+ }
+
+ @Override
+ protected boolean getConfiguredVisible() {
+ return false;
+ }
+
+ @Override
+ protected boolean getConfiguredEnabled() {
+ return false;
+ }
+
+ @Override
+ protected boolean getConfiguredFillHorizontal() {
+ return false;
+ }
+
+ @Override
+ protected int getConfiguredDisplayStyle() {
+ return DISPLAY_STYLE_LINK;
+ }
+
+ @Override
+ protected boolean getConfiguredProcessButton() {
+ return false;
+ }
+
+ @Override
+ protected void execClickAction() throws ProcessingException {
+ getSmartField().doBrowseNew(getSearchText());
+ }
+ }// end field
+
+ }// end main box
+
+ /*
+ * handlers
+ */
+ private class FormHandler extends AbstractFormHandler {
+
+ @Override
+ protected void execLoad() throws ProcessingException {
+ getResultTableField().getTable().setDefaultIconId(getSmartField().getBrowseIconId());
+ getActiveStateRadioButtonGroup().setVisible(getSmartField().isActiveFilterEnabled());
+ getActiveStateRadioButtonGroup().setValue(getSmartField().getActiveFilter());
+ getNewButton().setEnabled(getSmartField().getBrowseNewText() != null);
+ getNewButton().setLabel(getSmartField().getBrowseNewText());
+ }
+
+ @Override
+ protected boolean execValidate() throws ProcessingException {
+ return getAcceptedProposal() != null || getSmartField().isAllowCustomText();
+ }
+
+ @Override
+ protected void execFinally() throws ProcessingException {
+ if (m_dataLoadJob != null) {
+ m_dataLoadJob.cancel();
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/smartfield/SmartTreeForm.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/smartfield/SmartTreeForm.java
index 2033a42fc6..8d275ce730 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/smartfield/SmartTreeForm.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/smartfield/SmartTreeForm.java
@@ -1,852 +1,852 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.smartfield;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.regex.Pattern;
-
-import org.eclipse.core.runtime.QualifiedName;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.TriState;
-import org.eclipse.scout.commons.annotations.ConfigOperation;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.job.JobEx;
-import org.eclipse.scout.rt.client.ClientAsyncJob;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
-import org.eclipse.scout.rt.client.ui.basic.tree.AbstractTree;
-import org.eclipse.scout.rt.client.ui.basic.tree.AbstractTreeNodeBuilder;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITree;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNodeFilter;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeVisitor;
-import org.eclipse.scout.rt.client.ui.basic.tree.TreeAdapter;
-import org.eclipse.scout.rt.client.ui.basic.tree.TreeEvent;
-import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
-import org.eclipse.scout.rt.client.ui.form.AbstractFormHandler;
-import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractButton;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
-import org.eclipse.scout.rt.client.ui.form.fields.labelfield.AbstractLabelField;
-import org.eclipse.scout.rt.client.ui.form.fields.radiobuttongroup.AbstractRadioButtonGroup;
-import org.eclipse.scout.rt.client.ui.form.fields.smartfield.SmartTreeForm.MainBox.ActiveStateRadioButtonGroup;
-import org.eclipse.scout.rt.client.ui.form.fields.smartfield.SmartTreeForm.MainBox.NewButton;
-import org.eclipse.scout.rt.client.ui.form.fields.smartfield.SmartTreeForm.MainBox.ResultTreeField;
-import org.eclipse.scout.rt.client.ui.form.fields.smartfield.SmartTreeForm.MainBox.ResultTreeField.Tree;
-import org.eclipse.scout.rt.client.ui.form.fields.smartfield.SmartTreeForm.MainBox.StatusField;
-import org.eclipse.scout.rt.client.ui.form.fields.treefield.AbstractTreeField;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.TEXTS;
-import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
-import org.eclipse.scout.rt.shared.services.lookup.ILookupCallFetcher;
-import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
-import org.eclipse.scout.service.SERVICES;
-
-public class SmartTreeForm extends AbstractSmartFieldProposalForm {
- /**
- * Boolean marker on {@link Job#getProperty(QualifiedName)} that can be used to detect that the tree is loading some
- * nodes.
- * <p>
- * This can be used for example to avoid busy handling when a tree smart popup is loading its incremental tree data
- * (only relevant when {@link ISmartField#isBrowseLoadIncremental()}=true.
- */
- public static final QualifiedName JOB_PROPERTY_LOAD_TREE = new QualifiedName(SmartTreeForm.class.getName(), "loadTree");
-
- private P_ActiveNodesFilter m_activeNodesFilter;
- private P_MatchingNodesFilter m_matchingNodesFilter;
- private boolean m_selectCurrentValueRequested;
- private boolean m_populateInitialTreeDone;
- private JobEx m_populateInitialTreeJob;
-
- public SmartTreeForm(ISmartField<?> smartField) throws ProcessingException {
- super(smartField);
- }
-
- /*
- * Operations
- */
-
- /**
- * Populate initial tree using a {@link ClientAsyncJob}. Amount of tree loaded is depending on
- * {@link ISmartField#isBrowseLoadIncremental()}.
- * <p>
- * loadIncremnental only loads the roots, whereas !loadIncremental loads the complete tree. Normally the latter is
- * configured together with {@link ISmartField#isBrowseAutoExpandAll()}
- *
- * @throws ProcessingException
- */
- private void startPopulateInitialTree() throws ProcessingException {
- if (getSmartField().isBrowseLoadIncremental()) {
- //do sync
- getResultTreeField().loadRootNode();
- commitPopulateInitialTree(getResultTreeField().getTree());
- structureChanged(getResultTreeField());
- }
- else {
- //show comment that smartfield is loading
- getStatusField().setValue(ScoutTexts.get("searchingProposals"));
- getStatusField().setVisible(true);
- //go async to fetch data
- m_populateInitialTreeJob = getSmartField().callBrowseLookupInBackground(ISmartField.BROWSE_ALL_TEXT, 100000, TriState.UNDEFINED, new ILookupCallFetcher() {
- @Override
- public void dataFetched(LookupRow[] rows, ProcessingException failed) {
- if (failed == null) {
- try {
- getStatusField().setVisible(false);
- ITreeNode[] subTree = new P_TreeNodeBuilder().createTreeNodes(rows, ITreeNode.STATUS_NON_CHANGED, true);
- ITree tree = getResultTreeField().getTree();
- try {
- tree.setTreeChanging(true);
- //
- updateSubTree(tree, tree.getRootNode(), subTree);
- if (getSmartField().isBrowseAutoExpandAll()) {
- tree.expandAll(getResultTreeField().getTree().getRootNode());
- }
- commitPopulateInitialTree(tree);
- }
- finally {
- tree.setTreeChanging(false);
- }
- structureChanged(getResultTreeField());
- }
- catch (ProcessingException pe) {
- failed = pe;
- }
- }
- if (failed != null) {
- getStatusField().setValue(TEXTS.get("RequestProblem"));
- getStatusField().setVisible(true);
- return;
- }
- }
- });
- }
- }
-
- /**
- * Called when the initial tree has been loaded and the form is therefore ready to accept
- * {@link #update(boolean, boolean)} requests.
- *
- * @throws ProcessingException
- */
- private void commitPopulateInitialTree(ITree tree) throws ProcessingException {
- updateActiveFilter();
- if (m_selectCurrentValueRequested) {
- if (tree.getSelectedNodeCount() == 0) {
- selectCurrentValueInternal();
- }
- }
- m_populateInitialTreeDone = true;
- update(m_selectCurrentValueRequested, true);
- }
-
- @Override
- public void forceProposalSelection() throws ProcessingException {
- ITree tree = getResultTreeField().getTree();
- tree.selectNextNode();
- }
-
- @Override
- protected void execInitForm() throws ProcessingException {
- m_activeNodesFilter = new P_ActiveNodesFilter();
- m_matchingNodesFilter = new P_MatchingNodesFilter();
- getResultTreeField().getTree().setIconId(getSmartField().getBrowseIconId());
- getResultTreeField().getTree().addTreeListener(new TreeAdapter() {
- @Override
- public void treeChanged(TreeEvent e) {
- switch (e.getType()) {
- case TreeEvent.TYPE_NODE_EXPANDED:
- case TreeEvent.TYPE_NODE_COLLAPSED: {
- structureChanged(getResultTreeField());
- break;
- }
- }
- }
- });
- }
-
- /**
- * @return the pattern used to filter tree nodes based on the text typed into the smartfield
- */
- @ConfigOperation
- @Order(100)
- protected Pattern execCreatePatternForTreeFilter(String filterText) {
- // check pattern
- String s = filterText;
- if (s == null) {
- s = "";
- }
- s = s.toLowerCase();
- IDesktop desktop = ClientSyncJob.getCurrentSession().getDesktop();
- if (desktop != null && desktop.isAutoPrefixWildcardForTextSearch()) {
- s = "*" + s;
- }
- if (!s.endsWith("*")) {
- s = s + "*";
- }
- s = StringUtility.toRegExPattern(s);
- return Pattern.compile(s, Pattern.DOTALL);
- }
-
- /**
- * @return true if the node is accepted by the tree filter pattern defined in
- * {@link #execCreatePatternForTreeFilter(String)}
- */
- @ConfigOperation
- @Order(110)
- protected boolean execAcceptNodeByTreeFilter(Pattern filterPattern, ITreeNode node, int level) {
- @SuppressWarnings("unchecked")
- ISmartField<Object> sf = (ISmartField<Object>) getSmartField();
- LookupRow row = (LookupRow) node.getCell().getValue();
- if (node.isChildrenLoaded()) {
- if (row != null) {
- String q1 = node.getTree().getPathText(node, "\n");
- String q2 = node.getTree().getPathText(node, " ");
- if (q1 != null && q2 != null) {
- String[] path = (q1 + "\n" + q2).split("\n");
- for (String pathText : path) {
- if (pathText != null && filterPattern.matcher(pathText.toLowerCase()).matches()) {
- // use "level-1" because a tree smart field assumes its tree to
- // have multiple roots, but the ITree model is built as
- // single-root tree with invisible root node
- if (sf.acceptBrowseHierarchySelection(row.getKey(), level - 1, node.isLeaf())) {
- return true;
- }
- }
- }
- }
- return false;
- }
- }
- return true;
- }
-
- /**
- * Override this method to change that behaviour of what is a single match.
- * <p>
- * By default a single match is when there is a single enabled LEAF node in the tree
- * <p>
- */
- @ConfigOperation
- @Order(120)
- protected LookupRow execGetSingleMatch() {
- // when load incremental is set, dont visit the tree but use text-to-key
- // lookup method on smartfield.
- if (getSmartField().isBrowseLoadIncremental()) {
- try {
- LookupRow[] rows = getSmartField().callTextLookup(getSearchText(), 2);
- if (rows.length == 1) {
- return rows[0];
- }
- else {
- return null;
- }
- }
- catch (ProcessingException e) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- return null;
- }
- }
- else {
- final ArrayList<LookupRow> foundLeafs = new ArrayList<LookupRow>();
- ITreeVisitor v = new ITreeVisitor() {
- @Override
- public boolean visit(ITreeNode node) {
- if (node.isEnabled() && node.isLeaf()) {
- LookupRow row = (LookupRow) node.getCell().getValue();
- if (row != null && row.isEnabled()) {
- foundLeafs.add(row);
- }
- }
- return foundLeafs.size() <= 2;
- }
- };
- getResultTreeField().getTree().visitVisibleTree(v);
- if (foundLeafs.size() == 1) {
- return foundLeafs.get(0);
- }
- else {
- return null;
- }
- }
- }
-
- protected void execResultTreeNodeClick(ITreeNode node) throws ProcessingException {
- doOk();
- }
-
- /**
- * Override this method to adapt the menu list of the result {@link Tree}
- */
- protected void injectResultTreeMenus(List<IMenu> menuList) {
- }
-
- /*
- * Operations
- */
-
- @Override
- public void update(boolean selectCurrentValue, boolean synchonous) throws ProcessingException {
- if (!m_populateInitialTreeDone) {
- m_selectCurrentValueRequested = selectCurrentValue;
- return;
- }
- ITree tree = getResultTreeField().getTree();
- try {
- tree.setTreeChanging(true);
- //
- m_matchingNodesFilter.update(getSearchText());
- tree.addNodeFilter(m_matchingNodesFilter);
- }
- finally {
- tree.setTreeChanging(false);
- }
- String statusText = null;
- getStatusField().setValue(statusText);
- getStatusField().setVisible(statusText != null);
- if (getNewButton().isEnabled()) {
- getNewButton().setVisible(execGetSingleMatch() == null);
- }
- structureChanged(getResultTreeField());
- }
-
- private void updateActiveFilter() {
- ITree tree = getResultTreeField().getTree();
- try {
- tree.setTreeChanging(true);
- //
- if (getSmartField().isActiveFilterEnabled()) {
- m_activeNodesFilter.update(getSmartField().getActiveFilter());
- }
- else {
- m_activeNodesFilter.update(TriState.TRUE);
- }
- tree.addNodeFilter(m_activeNodesFilter);
- }
- finally {
- tree.setTreeChanging(false);
- }
- structureChanged(getResultTreeField());
- }
-
- private void updateSubTree(ITree tree, final ITreeNode parentNode, ITreeNode[] subTree) throws ProcessingException {
- if (tree == null || parentNode == null || subTree == null) {
- return;
- }
- tree.removeAllChildNodes(parentNode);
- tree.addChildNodes(parentNode, subTree);
- }
-
- @Override
- public LookupRow getAcceptedProposal() throws ProcessingException {
- LookupRow row = getSelectedLookupRow();
- if (row != null && row.isEnabled()) {
- return row;
- }
- else if (getSmartField().isAllowCustomText()) {
- return null;
- }
- else {
- return execGetSingleMatch();
- }
- }
-
- public LookupRow getSelectedLookupRow() {
- LookupRow row = null;
- ITree tree = getResultTreeField().getTree();
- ITreeNode node = null;
- if (tree.isCheckable()) {
- ITreeNode[] checkedNodes = tree.getCheckedNodes();
- if (checkedNodes != null && checkedNodes.length > 0) {
- node = checkedNodes[0];
- }
- }
- else {
- node = tree.getSelectedNode();
- }
- if (node != null && node.isFilterAccepted() && node.isEnabled()) {
- row = (LookupRow) node.getCell().getValue();
- }
-
- return row;
- }
-
- /*
- * Dialog start
- */
- @Override
- public void startForm() throws ProcessingException {
- startInternal(new FormHandler());
- }
-
- public MainBox getMainBox() {
- return (MainBox) getRootGroupBox();
- }
-
- public ResultTreeField getResultTreeField() {
- return getFieldByClass(ResultTreeField.class);
- }
-
- public ActiveStateRadioButtonGroup getActiveStateRadioButtonGroup() {
- return getFieldByClass(ActiveStateRadioButtonGroup.class);
- }
-
- /*
- * Fields
- */
- public StatusField getStatusField() {
- return getFieldByClass(StatusField.class);
- }
-
- public NewButton getNewButton() {
- return getFieldByClass(NewButton.class);
- }
-
- private boolean selectCurrentValueInternal() throws ProcessingException {
- final Object selectedKey = getSmartField().getValue();
- if (selectedKey != null) {
- //check existing tree
- ITree tree = getResultTreeField().getTree();
- final ArrayList<ITreeNode> matchingNodes = new ArrayList<ITreeNode>();
- tree.visitTree(new ITreeVisitor() {
- @Override
- public boolean visit(ITreeNode node) {
- Object val = node.getCell().getValue();
- if (val instanceof LookupRow && CompareUtility.equals(selectedKey, ((LookupRow) val).getKey())) {
- matchingNodes.add(node);
- }
- return true;
- }
- });
- if (matchingNodes.size() > 0) {
- selectValue(tree, matchingNodes.get(0));
-
- //ticket 87030
- for (int i = 1; i < matchingNodes.size(); i++) {
- ITreeNode node = matchingNodes.get(i);
- tree.setNodeExpanded(node, true);
- tree.ensureVisible(matchingNodes.get(i));
- }
- return true;
- }
- else {
- //load tree
- ITreeNode node = loadNodeWithKey(selectedKey);
- if (node != null) {
- selectValue(tree, node);
- return true;
- }
- }
- }
- return false;
- }
-
- private void selectValue(ITree tree, ITreeNode node) {
- if (tree == null || node == null) {
- return;
- }
-
- tree.selectNode(node);
-
- if (tree.isCheckable()) {
- tree.setNodeChecked(node, true);
- }
- }
-
- private ITreeNode loadNodeWithKey(Object key) throws ProcessingException {
- ArrayList<LookupRow> path = new ArrayList<LookupRow>();
- Object t = key;
- while (t != null) {
- LookupRow row = getLookupRowFor(t);
- if (row != null) {
- path.add(0, row);
- t = row.getParentKey();
- }
- else {
- t = null;
- }
- }
- ITree tree = getResultTreeField().getTree();
- ITreeNode parentNode = tree.getRootNode();
- for (int i = 0; i < path.size() && parentNode != null; i++) {
- parentNode.ensureChildrenLoaded();
- parentNode.setExpanded(true);
- Object childKey = path.get(i).getKey();
- ITreeNode nextNode = null;
- for (ITreeNode n : parentNode.getChildNodes()) {
- if (n.getCell().getValue() instanceof LookupRow) {
- if (CompareUtility.equals(((LookupRow) n.getCell().getValue()).getKey(), childKey)) {
- nextNode = n;
- break;
- }
- }
- }
- parentNode = nextNode;
- }
- //
- return parentNode;
- }
-
- @SuppressWarnings("unchecked")
- private LookupRow getLookupRowFor(Object key) throws ProcessingException {
- if (key instanceof Number && ((Number) key).longValue() == 0) {
- key = null;
- }
- if (key != null) {
- ISmartField<Object> sf = (ISmartField<Object>) getSmartField();
- for (LookupRow row : sf.callKeyLookup(key)) {
- return row;
- }
- }
- return null;
- }
-
- public class MainBox extends AbstractGroupBox {
-
- @Override
- protected int getConfiguredGridColumnCount() {
- return 1;
- }
-
- @Override
- protected boolean getConfiguredGridUseUiWidth() {
- return true;
- }
-
- @Override
- protected boolean getConfiguredGridUseUiHeight() {
- return true;
- }
-
- @Order(10)
- public class ResultTreeField extends AbstractTreeField {
-
- public ResultTreeField() {
- super();
- }
-
- @Override
- protected boolean getConfiguredAutoLoad() {
- return false;
- }
-
- @Override
- protected double getConfiguredGridWeightY() {
- return 1;
- }
-
- @Override
- protected boolean getConfiguredGridUseUiWidth() {
- return true;
- }
-
- @Override
- protected boolean getConfiguredGridUseUiHeight() {
- return true;
- }
-
- @Override
- protected boolean getConfiguredLabelVisible() {
- return false;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- protected void execLoadChildNodes(ITreeNode parentNode) throws ProcessingException {
- ISmartField<Object> sf = (ISmartField<Object>) getSmartField();
- if (sf.isBrowseLoadIncremental()) {
- Job currentJob = Job.getJobManager().currentJob();
- //show loading status
- boolean statusWasVisible = getStatusField().isVisible();
- getStatusField().setValue(ScoutTexts.get("searchingProposals"));
- getStatusField().setVisible(true);
- try {
- currentJob.setProperty(JOB_PROPERTY_LOAD_TREE, Boolean.TRUE);
- //load node
- LookupRow b = (LookupRow) (parentNode != null ? parentNode.getCell().getValue() : null);
- LookupRow[] data = sf.callSubTreeLookup(b != null ? b.getKey() : null, TriState.UNDEFINED);
- ITreeNode[] subTree = new P_TreeNodeBuilder().createTreeNodes(data, ITreeNode.STATUS_NON_CHANGED, false);
- updateSubTree(getTree(), parentNode, subTree);
- }
- finally {
- currentJob.setProperty(JOB_PROPERTY_LOAD_TREE, null);
- }
- //hide loading status
- getStatusField().setVisible(statusWasVisible);
- }
- /*
- else {
- //nop, since complete tree is already loaded (via async job)
- }
- */
- }
-
- /*
- * inner table
- */
- @Order(4)
- public class Tree extends AbstractTree {
-
- @Override
- protected void injectMenusInternal(List<IMenu> menuList) {
- injectResultTreeMenus(menuList);
- }
-
- @Override
- protected boolean getConfiguredMultiSelect() {
- return false;
- }
-
- @Override
- protected boolean getConfiguredMultiCheck() {
- return false;
- }
-
- @Override
- protected boolean getConfiguredRootNodeVisible() {
- return false;
- }
-
- @Override
- protected boolean getConfiguredScrollToSelection() {
- return true;
- }
-
- @Override
- protected void execNodeClick(ITreeNode node) throws ProcessingException {
- execResultTreeNodeClick(node);
- }
-
- }
- }
-
- @Override
- protected boolean getConfiguredBorderVisible() {
- return false;
- }
-
- @Order(20)
- public class ActiveStateRadioButtonGroup extends AbstractRadioButtonGroup<TriState> {
-
- @Override
- protected boolean getConfiguredLabelVisible() {
- return false;
- }
-
- @Override
- protected void execChangedValue() throws ProcessingException {
- if (isVisible() && !isFormLoading()) {
- getSmartField().setActiveFilter(getValue());
- updateActiveFilter();
- }
- }
-
- @Order(1)
- public class ActiveButton extends AbstractButton {
-
- @Override
- protected int getConfiguredDisplayStyle() {
- return DISPLAY_STYLE_RADIO;
- }
-
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("ActiveStates");
- }
-
- @Override
- protected Object getConfiguredRadioValue() {
- return TriState.TRUE;
- }
- }
-
- @Order(2)
- public class InactiveButton extends AbstractButton {
-
- @Override
- protected int getConfiguredDisplayStyle() {
- return DISPLAY_STYLE_RADIO;
- }
-
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("InactiveStates");
- }
-
- @Override
- protected Object getConfiguredRadioValue() {
- return TriState.FALSE;
- }
- }
-
- @Order(3)
- public class ActiveAndInactiveButton extends AbstractButton {
-
- @Override
- protected int getConfiguredDisplayStyle() {
- return DISPLAY_STYLE_RADIO;
- }
-
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("ActiveAndInactiveStates");
- }
-
- @Override
- protected Object getConfiguredRadioValue() {
- return TriState.UNDEFINED;
- }
- }
- }
-
- @Order(25)
- public class NewButton extends AbstractButton {
-
- @Override
- protected boolean getConfiguredVisible() {
- return false;
- }
-
- @Override
- protected boolean getConfiguredEnabled() {
- return false;
- }
-
- @Override
- protected boolean getConfiguredLabelVisible() {
- return false;
- }
-
- @Override
- protected boolean getConfiguredFillHorizontal() {
- return false;
- }
-
- @Override
- protected int getConfiguredDisplayStyle() {
- return DISPLAY_STYLE_LINK;
- }
-
- @Override
- protected boolean getConfiguredProcessButton() {
- return false;
- }
-
- @Override
- protected void execClickAction() throws ProcessingException {
- getSmartField().doBrowseNew(getSearchText());
- }
- }// end field
-
- @Order(30)
- public class StatusField extends AbstractLabelField {
- @Override
- protected boolean getConfiguredLabelVisible() {
- return false;
- }
-
- @Override
- protected double getConfiguredGridWeightY() {
- return 1;
- }
-
- }// end field
-
- }// end main box
-
- private class P_ActiveNodesFilter implements ITreeNodeFilter {
- private TriState m_ts;
-
- public P_ActiveNodesFilter() {
- }
-
- public void update(TriState ts) {
- m_ts = ts;
- }
-
- @Override
- public boolean accept(ITreeNode node, int level) {
- if (m_ts.isUndefined()) {
- return true;
- }
- else {
- LookupRow row = (LookupRow) node.getCell().getValue();
- if (row != null) {
- return row.isActive() == m_ts.equals(TriState.TRUE);
- }
- else {
- return true;
- }
- }
- }
- }
-
- private class P_MatchingNodesFilter implements ITreeNodeFilter {
- private Pattern m_searchPattern;
-
- public P_MatchingNodesFilter() {
- }
-
- public void update(String text) {
- m_searchPattern = execCreatePatternForTreeFilter(text);
- }
-
- @Override
- public boolean accept(ITreeNode node, int level) {
- return execAcceptNodeByTreeFilter(m_searchPattern, node, level);
- }
- }
-
- private class P_TreeNodeBuilder extends AbstractTreeNodeBuilder {
- @Override
- protected ITreeNode createEmptyTreeNode() throws ProcessingException {
- ITree tree = getResultTreeField().getTree();
- ITreeNode node = getResultTreeField().createTreeNode();
- if (tree.getIconId() != null) {
- Cell cell = node.getCellForUpdate();
- cell.setIconId(tree.getIconId());
- }
- return node;
- }
- }
-
- /*
- * handlers
- */
- private class FormHandler extends AbstractFormHandler {
-
- @Override
- protected void execLoad() throws ProcessingException {
- getActiveStateRadioButtonGroup().setVisible(getSmartField().isActiveFilterEnabled());
- getActiveStateRadioButtonGroup().setValue(getSmartField().getActiveFilter());
- getNewButton().setEnabled(getSmartField().getBrowseNewText() != null);
- getNewButton().setLabel(getSmartField().getBrowseNewText());
- startPopulateInitialTree();
- }
-
- @Override
- protected boolean execValidate() throws ProcessingException {
- return getAcceptedProposal() != null;
- }
-
- @Override
- protected void execFinally() throws ProcessingException {
- if (m_populateInitialTreeJob != null) {
- m_populateInitialTreeJob.cancel();
- }
- }
-
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.smartfield;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Pattern;
+
+import org.eclipse.core.runtime.QualifiedName;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.TriState;
+import org.eclipse.scout.commons.annotations.ConfigOperation;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.job.JobEx;
+import org.eclipse.scout.rt.client.ClientAsyncJob;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.basic.cell.Cell;
+import org.eclipse.scout.rt.client.ui.basic.tree.AbstractTree;
+import org.eclipse.scout.rt.client.ui.basic.tree.AbstractTreeNodeBuilder;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITree;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNodeFilter;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeVisitor;
+import org.eclipse.scout.rt.client.ui.basic.tree.TreeAdapter;
+import org.eclipse.scout.rt.client.ui.basic.tree.TreeEvent;
+import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
+import org.eclipse.scout.rt.client.ui.form.AbstractFormHandler;
+import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractButton;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
+import org.eclipse.scout.rt.client.ui.form.fields.labelfield.AbstractLabelField;
+import org.eclipse.scout.rt.client.ui.form.fields.radiobuttongroup.AbstractRadioButtonGroup;
+import org.eclipse.scout.rt.client.ui.form.fields.smartfield.SmartTreeForm.MainBox.ActiveStateRadioButtonGroup;
+import org.eclipse.scout.rt.client.ui.form.fields.smartfield.SmartTreeForm.MainBox.NewButton;
+import org.eclipse.scout.rt.client.ui.form.fields.smartfield.SmartTreeForm.MainBox.ResultTreeField;
+import org.eclipse.scout.rt.client.ui.form.fields.smartfield.SmartTreeForm.MainBox.ResultTreeField.Tree;
+import org.eclipse.scout.rt.client.ui.form.fields.smartfield.SmartTreeForm.MainBox.StatusField;
+import org.eclipse.scout.rt.client.ui.form.fields.treefield.AbstractTreeField;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.TEXTS;
+import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
+import org.eclipse.scout.rt.shared.services.lookup.ILookupCallFetcher;
+import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
+import org.eclipse.scout.service.SERVICES;
+
+public class SmartTreeForm extends AbstractSmartFieldProposalForm {
+ /**
+ * Boolean marker on {@link Job#getProperty(QualifiedName)} that can be used to detect that the tree is loading some
+ * nodes.
+ * <p>
+ * This can be used for example to avoid busy handling when a tree smart popup is loading its incremental tree data
+ * (only relevant when {@link ISmartField#isBrowseLoadIncremental()}=true.
+ */
+ public static final QualifiedName JOB_PROPERTY_LOAD_TREE = new QualifiedName(SmartTreeForm.class.getName(), "loadTree");
+
+ private P_ActiveNodesFilter m_activeNodesFilter;
+ private P_MatchingNodesFilter m_matchingNodesFilter;
+ private boolean m_selectCurrentValueRequested;
+ private boolean m_populateInitialTreeDone;
+ private JobEx m_populateInitialTreeJob;
+
+ public SmartTreeForm(ISmartField<?> smartField) throws ProcessingException {
+ super(smartField);
+ }
+
+ /*
+ * Operations
+ */
+
+ /**
+ * Populate initial tree using a {@link ClientAsyncJob}. Amount of tree loaded is depending on
+ * {@link ISmartField#isBrowseLoadIncremental()}.
+ * <p>
+ * loadIncremnental only loads the roots, whereas !loadIncremental loads the complete tree. Normally the latter is
+ * configured together with {@link ISmartField#isBrowseAutoExpandAll()}
+ *
+ * @throws ProcessingException
+ */
+ private void startPopulateInitialTree() throws ProcessingException {
+ if (getSmartField().isBrowseLoadIncremental()) {
+ //do sync
+ getResultTreeField().loadRootNode();
+ commitPopulateInitialTree(getResultTreeField().getTree());
+ structureChanged(getResultTreeField());
+ }
+ else {
+ //show comment that smartfield is loading
+ getStatusField().setValue(ScoutTexts.get("searchingProposals"));
+ getStatusField().setVisible(true);
+ //go async to fetch data
+ m_populateInitialTreeJob = getSmartField().callBrowseLookupInBackground(ISmartField.BROWSE_ALL_TEXT, 100000, TriState.UNDEFINED, new ILookupCallFetcher() {
+ @Override
+ public void dataFetched(LookupRow[] rows, ProcessingException failed) {
+ if (failed == null) {
+ try {
+ getStatusField().setVisible(false);
+ ITreeNode[] subTree = new P_TreeNodeBuilder().createTreeNodes(rows, ITreeNode.STATUS_NON_CHANGED, true);
+ ITree tree = getResultTreeField().getTree();
+ try {
+ tree.setTreeChanging(true);
+ //
+ updateSubTree(tree, tree.getRootNode(), subTree);
+ if (getSmartField().isBrowseAutoExpandAll()) {
+ tree.expandAll(getResultTreeField().getTree().getRootNode());
+ }
+ commitPopulateInitialTree(tree);
+ }
+ finally {
+ tree.setTreeChanging(false);
+ }
+ structureChanged(getResultTreeField());
+ }
+ catch (ProcessingException pe) {
+ failed = pe;
+ }
+ }
+ if (failed != null) {
+ getStatusField().setValue(TEXTS.get("RequestProblem"));
+ getStatusField().setVisible(true);
+ return;
+ }
+ }
+ });
+ }
+ }
+
+ /**
+ * Called when the initial tree has been loaded and the form is therefore ready to accept
+ * {@link #update(boolean, boolean)} requests.
+ *
+ * @throws ProcessingException
+ */
+ private void commitPopulateInitialTree(ITree tree) throws ProcessingException {
+ updateActiveFilter();
+ if (m_selectCurrentValueRequested) {
+ if (tree.getSelectedNodeCount() == 0) {
+ selectCurrentValueInternal();
+ }
+ }
+ m_populateInitialTreeDone = true;
+ update(m_selectCurrentValueRequested, true);
+ }
+
+ @Override
+ public void forceProposalSelection() throws ProcessingException {
+ ITree tree = getResultTreeField().getTree();
+ tree.selectNextNode();
+ }
+
+ @Override
+ protected void execInitForm() throws ProcessingException {
+ m_activeNodesFilter = new P_ActiveNodesFilter();
+ m_matchingNodesFilter = new P_MatchingNodesFilter();
+ getResultTreeField().getTree().setIconId(getSmartField().getBrowseIconId());
+ getResultTreeField().getTree().addTreeListener(new TreeAdapter() {
+ @Override
+ public void treeChanged(TreeEvent e) {
+ switch (e.getType()) {
+ case TreeEvent.TYPE_NODE_EXPANDED:
+ case TreeEvent.TYPE_NODE_COLLAPSED: {
+ structureChanged(getResultTreeField());
+ break;
+ }
+ }
+ }
+ });
+ }
+
+ /**
+ * @return the pattern used to filter tree nodes based on the text typed into the smartfield
+ */
+ @ConfigOperation
+ @Order(100)
+ protected Pattern execCreatePatternForTreeFilter(String filterText) {
+ // check pattern
+ String s = filterText;
+ if (s == null) {
+ s = "";
+ }
+ s = s.toLowerCase();
+ IDesktop desktop = ClientSyncJob.getCurrentSession().getDesktop();
+ if (desktop != null && desktop.isAutoPrefixWildcardForTextSearch()) {
+ s = "*" + s;
+ }
+ if (!s.endsWith("*")) {
+ s = s + "*";
+ }
+ s = StringUtility.toRegExPattern(s);
+ return Pattern.compile(s, Pattern.DOTALL);
+ }
+
+ /**
+ * @return true if the node is accepted by the tree filter pattern defined in
+ * {@link #execCreatePatternForTreeFilter(String)}
+ */
+ @ConfigOperation
+ @Order(110)
+ protected boolean execAcceptNodeByTreeFilter(Pattern filterPattern, ITreeNode node, int level) {
+ @SuppressWarnings("unchecked")
+ ISmartField<Object> sf = (ISmartField<Object>) getSmartField();
+ LookupRow row = (LookupRow) node.getCell().getValue();
+ if (node.isChildrenLoaded()) {
+ if (row != null) {
+ String q1 = node.getTree().getPathText(node, "\n");
+ String q2 = node.getTree().getPathText(node, " ");
+ if (q1 != null && q2 != null) {
+ String[] path = (q1 + "\n" + q2).split("\n");
+ for (String pathText : path) {
+ if (pathText != null && filterPattern.matcher(pathText.toLowerCase()).matches()) {
+ // use "level-1" because a tree smart field assumes its tree to
+ // have multiple roots, but the ITree model is built as
+ // single-root tree with invisible root node
+ if (sf.acceptBrowseHierarchySelection(row.getKey(), level - 1, node.isLeaf())) {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Override this method to change that behaviour of what is a single match.
+ * <p>
+ * By default a single match is when there is a single enabled LEAF node in the tree
+ * <p>
+ */
+ @ConfigOperation
+ @Order(120)
+ protected LookupRow execGetSingleMatch() {
+ // when load incremental is set, dont visit the tree but use text-to-key
+ // lookup method on smartfield.
+ if (getSmartField().isBrowseLoadIncremental()) {
+ try {
+ LookupRow[] rows = getSmartField().callTextLookup(getSearchText(), 2);
+ if (rows.length == 1) {
+ return rows[0];
+ }
+ else {
+ return null;
+ }
+ }
+ catch (ProcessingException e) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ return null;
+ }
+ }
+ else {
+ final ArrayList<LookupRow> foundLeafs = new ArrayList<LookupRow>();
+ ITreeVisitor v = new ITreeVisitor() {
+ @Override
+ public boolean visit(ITreeNode node) {
+ if (node.isEnabled() && node.isLeaf()) {
+ LookupRow row = (LookupRow) node.getCell().getValue();
+ if (row != null && row.isEnabled()) {
+ foundLeafs.add(row);
+ }
+ }
+ return foundLeafs.size() <= 2;
+ }
+ };
+ getResultTreeField().getTree().visitVisibleTree(v);
+ if (foundLeafs.size() == 1) {
+ return foundLeafs.get(0);
+ }
+ else {
+ return null;
+ }
+ }
+ }
+
+ protected void execResultTreeNodeClick(ITreeNode node) throws ProcessingException {
+ doOk();
+ }
+
+ /**
+ * Override this method to adapt the menu list of the result {@link Tree}
+ */
+ protected void injectResultTreeMenus(List<IMenu> menuList) {
+ }
+
+ /*
+ * Operations
+ */
+
+ @Override
+ public void update(boolean selectCurrentValue, boolean synchonous) throws ProcessingException {
+ if (!m_populateInitialTreeDone) {
+ m_selectCurrentValueRequested = selectCurrentValue;
+ return;
+ }
+ ITree tree = getResultTreeField().getTree();
+ try {
+ tree.setTreeChanging(true);
+ //
+ m_matchingNodesFilter.update(getSearchText());
+ tree.addNodeFilter(m_matchingNodesFilter);
+ }
+ finally {
+ tree.setTreeChanging(false);
+ }
+ String statusText = null;
+ getStatusField().setValue(statusText);
+ getStatusField().setVisible(statusText != null);
+ if (getNewButton().isEnabled()) {
+ getNewButton().setVisible(execGetSingleMatch() == null);
+ }
+ structureChanged(getResultTreeField());
+ }
+
+ private void updateActiveFilter() {
+ ITree tree = getResultTreeField().getTree();
+ try {
+ tree.setTreeChanging(true);
+ //
+ if (getSmartField().isActiveFilterEnabled()) {
+ m_activeNodesFilter.update(getSmartField().getActiveFilter());
+ }
+ else {
+ m_activeNodesFilter.update(TriState.TRUE);
+ }
+ tree.addNodeFilter(m_activeNodesFilter);
+ }
+ finally {
+ tree.setTreeChanging(false);
+ }
+ structureChanged(getResultTreeField());
+ }
+
+ private void updateSubTree(ITree tree, final ITreeNode parentNode, ITreeNode[] subTree) throws ProcessingException {
+ if (tree == null || parentNode == null || subTree == null) {
+ return;
+ }
+ tree.removeAllChildNodes(parentNode);
+ tree.addChildNodes(parentNode, subTree);
+ }
+
+ @Override
+ public LookupRow getAcceptedProposal() throws ProcessingException {
+ LookupRow row = getSelectedLookupRow();
+ if (row != null && row.isEnabled()) {
+ return row;
+ }
+ else if (getSmartField().isAllowCustomText()) {
+ return null;
+ }
+ else {
+ return execGetSingleMatch();
+ }
+ }
+
+ public LookupRow getSelectedLookupRow() {
+ LookupRow row = null;
+ ITree tree = getResultTreeField().getTree();
+ ITreeNode node = null;
+ if (tree.isCheckable()) {
+ ITreeNode[] checkedNodes = tree.getCheckedNodes();
+ if (checkedNodes != null && checkedNodes.length > 0) {
+ node = checkedNodes[0];
+ }
+ }
+ else {
+ node = tree.getSelectedNode();
+ }
+ if (node != null && node.isFilterAccepted() && node.isEnabled()) {
+ row = (LookupRow) node.getCell().getValue();
+ }
+
+ return row;
+ }
+
+ /*
+ * Dialog start
+ */
+ @Override
+ public void startForm() throws ProcessingException {
+ startInternal(new FormHandler());
+ }
+
+ public MainBox getMainBox() {
+ return (MainBox) getRootGroupBox();
+ }
+
+ public ResultTreeField getResultTreeField() {
+ return getFieldByClass(ResultTreeField.class);
+ }
+
+ public ActiveStateRadioButtonGroup getActiveStateRadioButtonGroup() {
+ return getFieldByClass(ActiveStateRadioButtonGroup.class);
+ }
+
+ /*
+ * Fields
+ */
+ public StatusField getStatusField() {
+ return getFieldByClass(StatusField.class);
+ }
+
+ public NewButton getNewButton() {
+ return getFieldByClass(NewButton.class);
+ }
+
+ private boolean selectCurrentValueInternal() throws ProcessingException {
+ final Object selectedKey = getSmartField().getValue();
+ if (selectedKey != null) {
+ //check existing tree
+ ITree tree = getResultTreeField().getTree();
+ final ArrayList<ITreeNode> matchingNodes = new ArrayList<ITreeNode>();
+ tree.visitTree(new ITreeVisitor() {
+ @Override
+ public boolean visit(ITreeNode node) {
+ Object val = node.getCell().getValue();
+ if (val instanceof LookupRow && CompareUtility.equals(selectedKey, ((LookupRow) val).getKey())) {
+ matchingNodes.add(node);
+ }
+ return true;
+ }
+ });
+ if (matchingNodes.size() > 0) {
+ selectValue(tree, matchingNodes.get(0));
+
+ //ticket 87030
+ for (int i = 1; i < matchingNodes.size(); i++) {
+ ITreeNode node = matchingNodes.get(i);
+ tree.setNodeExpanded(node, true);
+ tree.ensureVisible(matchingNodes.get(i));
+ }
+ return true;
+ }
+ else {
+ //load tree
+ ITreeNode node = loadNodeWithKey(selectedKey);
+ if (node != null) {
+ selectValue(tree, node);
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ private void selectValue(ITree tree, ITreeNode node) {
+ if (tree == null || node == null) {
+ return;
+ }
+
+ tree.selectNode(node);
+
+ if (tree.isCheckable()) {
+ tree.setNodeChecked(node, true);
+ }
+ }
+
+ private ITreeNode loadNodeWithKey(Object key) throws ProcessingException {
+ ArrayList<LookupRow> path = new ArrayList<LookupRow>();
+ Object t = key;
+ while (t != null) {
+ LookupRow row = getLookupRowFor(t);
+ if (row != null) {
+ path.add(0, row);
+ t = row.getParentKey();
+ }
+ else {
+ t = null;
+ }
+ }
+ ITree tree = getResultTreeField().getTree();
+ ITreeNode parentNode = tree.getRootNode();
+ for (int i = 0; i < path.size() && parentNode != null; i++) {
+ parentNode.ensureChildrenLoaded();
+ parentNode.setExpanded(true);
+ Object childKey = path.get(i).getKey();
+ ITreeNode nextNode = null;
+ for (ITreeNode n : parentNode.getChildNodes()) {
+ if (n.getCell().getValue() instanceof LookupRow) {
+ if (CompareUtility.equals(((LookupRow) n.getCell().getValue()).getKey(), childKey)) {
+ nextNode = n;
+ break;
+ }
+ }
+ }
+ parentNode = nextNode;
+ }
+ //
+ return parentNode;
+ }
+
+ @SuppressWarnings("unchecked")
+ private LookupRow getLookupRowFor(Object key) throws ProcessingException {
+ if (key instanceof Number && ((Number) key).longValue() == 0) {
+ key = null;
+ }
+ if (key != null) {
+ ISmartField<Object> sf = (ISmartField<Object>) getSmartField();
+ for (LookupRow row : sf.callKeyLookup(key)) {
+ return row;
+ }
+ }
+ return null;
+ }
+
+ public class MainBox extends AbstractGroupBox {
+
+ @Override
+ protected int getConfiguredGridColumnCount() {
+ return 1;
+ }
+
+ @Override
+ protected boolean getConfiguredGridUseUiWidth() {
+ return true;
+ }
+
+ @Override
+ protected boolean getConfiguredGridUseUiHeight() {
+ return true;
+ }
+
+ @Order(10)
+ public class ResultTreeField extends AbstractTreeField {
+
+ public ResultTreeField() {
+ super();
+ }
+
+ @Override
+ protected boolean getConfiguredAutoLoad() {
+ return false;
+ }
+
+ @Override
+ protected double getConfiguredGridWeightY() {
+ return 1;
+ }
+
+ @Override
+ protected boolean getConfiguredGridUseUiWidth() {
+ return true;
+ }
+
+ @Override
+ protected boolean getConfiguredGridUseUiHeight() {
+ return true;
+ }
+
+ @Override
+ protected boolean getConfiguredLabelVisible() {
+ return false;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ protected void execLoadChildNodes(ITreeNode parentNode) throws ProcessingException {
+ ISmartField<Object> sf = (ISmartField<Object>) getSmartField();
+ if (sf.isBrowseLoadIncremental()) {
+ Job currentJob = Job.getJobManager().currentJob();
+ //show loading status
+ boolean statusWasVisible = getStatusField().isVisible();
+ getStatusField().setValue(ScoutTexts.get("searchingProposals"));
+ getStatusField().setVisible(true);
+ try {
+ currentJob.setProperty(JOB_PROPERTY_LOAD_TREE, Boolean.TRUE);
+ //load node
+ LookupRow b = (LookupRow) (parentNode != null ? parentNode.getCell().getValue() : null);
+ LookupRow[] data = sf.callSubTreeLookup(b != null ? b.getKey() : null, TriState.UNDEFINED);
+ ITreeNode[] subTree = new P_TreeNodeBuilder().createTreeNodes(data, ITreeNode.STATUS_NON_CHANGED, false);
+ updateSubTree(getTree(), parentNode, subTree);
+ }
+ finally {
+ currentJob.setProperty(JOB_PROPERTY_LOAD_TREE, null);
+ }
+ //hide loading status
+ getStatusField().setVisible(statusWasVisible);
+ }
+ /*
+ else {
+ //nop, since complete tree is already loaded (via async job)
+ }
+ */
+ }
+
+ /*
+ * inner table
+ */
+ @Order(4)
+ public class Tree extends AbstractTree {
+
+ @Override
+ protected void injectMenusInternal(List<IMenu> menuList) {
+ injectResultTreeMenus(menuList);
+ }
+
+ @Override
+ protected boolean getConfiguredMultiSelect() {
+ return false;
+ }
+
+ @Override
+ protected boolean getConfiguredMultiCheck() {
+ return false;
+ }
+
+ @Override
+ protected boolean getConfiguredRootNodeVisible() {
+ return false;
+ }
+
+ @Override
+ protected boolean getConfiguredScrollToSelection() {
+ return true;
+ }
+
+ @Override
+ protected void execNodeClick(ITreeNode node) throws ProcessingException {
+ execResultTreeNodeClick(node);
+ }
+
+ }
+ }
+
+ @Override
+ protected boolean getConfiguredBorderVisible() {
+ return false;
+ }
+
+ @Order(20)
+ public class ActiveStateRadioButtonGroup extends AbstractRadioButtonGroup<TriState> {
+
+ @Override
+ protected boolean getConfiguredLabelVisible() {
+ return false;
+ }
+
+ @Override
+ protected void execChangedValue() throws ProcessingException {
+ if (isVisible() && !isFormLoading()) {
+ getSmartField().setActiveFilter(getValue());
+ updateActiveFilter();
+ }
+ }
+
+ @Order(1)
+ public class ActiveButton extends AbstractButton {
+
+ @Override
+ protected int getConfiguredDisplayStyle() {
+ return DISPLAY_STYLE_RADIO;
+ }
+
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("ActiveStates");
+ }
+
+ @Override
+ protected Object getConfiguredRadioValue() {
+ return TriState.TRUE;
+ }
+ }
+
+ @Order(2)
+ public class InactiveButton extends AbstractButton {
+
+ @Override
+ protected int getConfiguredDisplayStyle() {
+ return DISPLAY_STYLE_RADIO;
+ }
+
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("InactiveStates");
+ }
+
+ @Override
+ protected Object getConfiguredRadioValue() {
+ return TriState.FALSE;
+ }
+ }
+
+ @Order(3)
+ public class ActiveAndInactiveButton extends AbstractButton {
+
+ @Override
+ protected int getConfiguredDisplayStyle() {
+ return DISPLAY_STYLE_RADIO;
+ }
+
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("ActiveAndInactiveStates");
+ }
+
+ @Override
+ protected Object getConfiguredRadioValue() {
+ return TriState.UNDEFINED;
+ }
+ }
+ }
+
+ @Order(25)
+ public class NewButton extends AbstractButton {
+
+ @Override
+ protected boolean getConfiguredVisible() {
+ return false;
+ }
+
+ @Override
+ protected boolean getConfiguredEnabled() {
+ return false;
+ }
+
+ @Override
+ protected boolean getConfiguredLabelVisible() {
+ return false;
+ }
+
+ @Override
+ protected boolean getConfiguredFillHorizontal() {
+ return false;
+ }
+
+ @Override
+ protected int getConfiguredDisplayStyle() {
+ return DISPLAY_STYLE_LINK;
+ }
+
+ @Override
+ protected boolean getConfiguredProcessButton() {
+ return false;
+ }
+
+ @Override
+ protected void execClickAction() throws ProcessingException {
+ getSmartField().doBrowseNew(getSearchText());
+ }
+ }// end field
+
+ @Order(30)
+ public class StatusField extends AbstractLabelField {
+ @Override
+ protected boolean getConfiguredLabelVisible() {
+ return false;
+ }
+
+ @Override
+ protected double getConfiguredGridWeightY() {
+ return 1;
+ }
+
+ }// end field
+
+ }// end main box
+
+ private class P_ActiveNodesFilter implements ITreeNodeFilter {
+ private TriState m_ts;
+
+ public P_ActiveNodesFilter() {
+ }
+
+ public void update(TriState ts) {
+ m_ts = ts;
+ }
+
+ @Override
+ public boolean accept(ITreeNode node, int level) {
+ if (m_ts.isUndefined()) {
+ return true;
+ }
+ else {
+ LookupRow row = (LookupRow) node.getCell().getValue();
+ if (row != null) {
+ return row.isActive() == m_ts.equals(TriState.TRUE);
+ }
+ else {
+ return true;
+ }
+ }
+ }
+ }
+
+ private class P_MatchingNodesFilter implements ITreeNodeFilter {
+ private Pattern m_searchPattern;
+
+ public P_MatchingNodesFilter() {
+ }
+
+ public void update(String text) {
+ m_searchPattern = execCreatePatternForTreeFilter(text);
+ }
+
+ @Override
+ public boolean accept(ITreeNode node, int level) {
+ return execAcceptNodeByTreeFilter(m_searchPattern, node, level);
+ }
+ }
+
+ private class P_TreeNodeBuilder extends AbstractTreeNodeBuilder {
+ @Override
+ protected ITreeNode createEmptyTreeNode() throws ProcessingException {
+ ITree tree = getResultTreeField().getTree();
+ ITreeNode node = getResultTreeField().createTreeNode();
+ if (tree.getIconId() != null) {
+ Cell cell = node.getCellForUpdate();
+ cell.setIconId(tree.getIconId());
+ }
+ return node;
+ }
+ }
+
+ /*
+ * handlers
+ */
+ private class FormHandler extends AbstractFormHandler {
+
+ @Override
+ protected void execLoad() throws ProcessingException {
+ getActiveStateRadioButtonGroup().setVisible(getSmartField().isActiveFilterEnabled());
+ getActiveStateRadioButtonGroup().setValue(getSmartField().getActiveFilter());
+ getNewButton().setEnabled(getSmartField().getBrowseNewText() != null);
+ getNewButton().setLabel(getSmartField().getBrowseNewText());
+ startPopulateInitialTree();
+ }
+
+ @Override
+ protected boolean execValidate() throws ProcessingException {
+ return getAcceptedProposal() != null;
+ }
+
+ @Override
+ protected void execFinally() throws ProcessingException {
+ if (m_populateInitialTreeJob != null) {
+ m_populateInitialTreeJob.cancel();
+ }
+ }
+
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/snapbox/AbstractSnapBox.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/snapbox/AbstractSnapBox.java
index e2cc711c90..f891f0c393 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/snapbox/AbstractSnapBox.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/snapbox/AbstractSnapBox.java
@@ -1,63 +1,63 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.snapbox;
-
-import org.eclipse.scout.rt.client.ui.form.fields.AbstractCompositeField;
-import org.eclipse.scout.rt.client.ui.form.fields.snapbox.internal.SnapBoxGrid;
-
-public abstract class AbstractSnapBox extends AbstractCompositeField implements ISnapBox {
-
- private SnapBoxGrid m_grid;
-
- public AbstractSnapBox() {
- this(true);
- }
-
- public AbstractSnapBox(boolean callInitializer) {
- super(callInitializer);
- }
-
- @Override
- protected void initConfig() {
- m_grid = new SnapBoxGrid(this);
- super.initConfig();
- }
-
- @Override
- public void rebuildFieldGrid() {
- m_grid.validate();
- if (isInitialized()) {
- if (getForm() != null) {
- getForm().structureChanged(this);
- }
- }
- }
-
- // box is only visible when it has at least one visible item
- @Override
- protected void handleFieldVisibilityChanged() {
- super.handleFieldVisibilityChanged();
- if (isInitialized()) {
- rebuildFieldGrid();
- }
- }
-
- @Override
- public final int getGridColumnCount() {
- return m_grid.getGridColumnCount();
- }
-
- @Override
- public final int getGridRowCount() {
- return m_grid.getGridRowCount();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.snapbox;
+
+import org.eclipse.scout.rt.client.ui.form.fields.AbstractCompositeField;
+import org.eclipse.scout.rt.client.ui.form.fields.snapbox.internal.SnapBoxGrid;
+
+public abstract class AbstractSnapBox extends AbstractCompositeField implements ISnapBox {
+
+ private SnapBoxGrid m_grid;
+
+ public AbstractSnapBox() {
+ this(true);
+ }
+
+ public AbstractSnapBox(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ @Override
+ protected void initConfig() {
+ m_grid = new SnapBoxGrid(this);
+ super.initConfig();
+ }
+
+ @Override
+ public void rebuildFieldGrid() {
+ m_grid.validate();
+ if (isInitialized()) {
+ if (getForm() != null) {
+ getForm().structureChanged(this);
+ }
+ }
+ }
+
+ // box is only visible when it has at least one visible item
+ @Override
+ protected void handleFieldVisibilityChanged() {
+ super.handleFieldVisibilityChanged();
+ if (isInitialized()) {
+ rebuildFieldGrid();
+ }
+ }
+
+ @Override
+ public final int getGridColumnCount() {
+ return m_grid.getGridColumnCount();
+ }
+
+ @Override
+ public final int getGridRowCount() {
+ return m_grid.getGridRowCount();
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/snapbox/ISnapBox.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/snapbox/ISnapBox.java
index 291238c3e0..71ecaa9a48 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/snapbox/ISnapBox.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/snapbox/ISnapBox.java
@@ -1,17 +1,17 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.snapbox;
-
-import org.eclipse.scout.rt.client.ui.form.fields.ICompositeField;
-
-public interface ISnapBox extends ICompositeField {
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.snapbox;
+
+import org.eclipse.scout.rt.client.ui.form.fields.ICompositeField;
+
+public interface ISnapBox extends ICompositeField {
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/snapbox/internal/SnapBoxGrid.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/snapbox/internal/SnapBoxGrid.java
index 737588475d..3cfd6c2a4a 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/snapbox/internal/SnapBoxGrid.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/snapbox/internal/SnapBoxGrid.java
@@ -1,76 +1,76 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.snapbox.internal;
-
-import java.util.ArrayList;
-
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.form.fields.GridData;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.internal.GridDataBuilder;
-import org.eclipse.scout.rt.client.ui.form.fields.snapbox.ISnapBox;
-
-/**
- * Grid (model) layout of snap box only visible process-buttons are used
- */
-public class SnapBoxGrid {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(SnapBoxGrid.class);
-
- private ISnapBox m_snapBox = null;
- private IFormField[] m_fields;
- private int m_gridColumns;
- private int m_gridRows;
-
- public SnapBoxGrid(ISnapBox snapBox) {
- m_snapBox = snapBox;
- }
-
- public void validate() {
- // reset
- m_gridColumns = 0;
- m_gridRows = 0;
- ArrayList<IFormField> list = new ArrayList<IFormField>();
- // filter
- for (IFormField f : m_snapBox.getFields()) {
- if (f.isVisible()) {
- list.add(f);
- }
- else {
- GridData data = GridDataBuilder.createFromHints(f, 1);
- f.setGridDataInternal(data);
- }
- }
- m_fields = list.toArray(new IFormField[list.size()]);
- layoutStatic();
- }
-
- private void layoutStatic() {
- int y = 0;
- for (int i = 0; i < m_fields.length; i++) {
- GridData data = GridDataBuilder.createFromHints(m_fields[i], 1);
- data.x = 0;
- data.y = y;
- m_fields[i].setGridDataInternal(data);
- y = y + data.h;
- m_gridColumns = Math.max(m_gridColumns, data.w);
- }
- m_gridRows = y;
- }
-
- public int getGridColumnCount() {
- return m_gridColumns;
- }
-
- public int getGridRowCount() {
- return m_gridRows;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.snapbox.internal;
+
+import java.util.ArrayList;
+
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.form.fields.GridData;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.internal.GridDataBuilder;
+import org.eclipse.scout.rt.client.ui.form.fields.snapbox.ISnapBox;
+
+/**
+ * Grid (model) layout of snap box only visible process-buttons are used
+ */
+public class SnapBoxGrid {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(SnapBoxGrid.class);
+
+ private ISnapBox m_snapBox = null;
+ private IFormField[] m_fields;
+ private int m_gridColumns;
+ private int m_gridRows;
+
+ public SnapBoxGrid(ISnapBox snapBox) {
+ m_snapBox = snapBox;
+ }
+
+ public void validate() {
+ // reset
+ m_gridColumns = 0;
+ m_gridRows = 0;
+ ArrayList<IFormField> list = new ArrayList<IFormField>();
+ // filter
+ for (IFormField f : m_snapBox.getFields()) {
+ if (f.isVisible()) {
+ list.add(f);
+ }
+ else {
+ GridData data = GridDataBuilder.createFromHints(f, 1);
+ f.setGridDataInternal(data);
+ }
+ }
+ m_fields = list.toArray(new IFormField[list.size()]);
+ layoutStatic();
+ }
+
+ private void layoutStatic() {
+ int y = 0;
+ for (int i = 0; i < m_fields.length; i++) {
+ GridData data = GridDataBuilder.createFromHints(m_fields[i], 1);
+ data.x = 0;
+ data.y = y;
+ m_fields[i].setGridDataInternal(data);
+ y = y + data.h;
+ m_gridColumns = Math.max(m_gridColumns, data.w);
+ }
+ m_gridRows = y;
+ }
+
+ public int getGridColumnCount() {
+ return m_gridColumns;
+ }
+
+ public int getGridRowCount() {
+ return m_gridRows;
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/splitbox/AbstractSplitBox.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/splitbox/AbstractSplitBox.java
index 0fa08db8b7..ad39bff8ac 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/splitbox/AbstractSplitBox.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/splitbox/AbstractSplitBox.java
@@ -1,180 +1,180 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.splitbox;
-
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.rt.client.ui.form.fields.AbstractCompositeField;
-import org.eclipse.scout.rt.client.ui.form.fields.splitbox.internal.SplitBoxGrid;
-
-/**
- * <h3>AbstractSplitBox</h3> ...
- *
- * @since 3.1.12 16.07.2008
- */
-public abstract class AbstractSplitBox extends AbstractCompositeField implements ISplitBox {
-
- private SplitBoxGrid m_grid;
- private ISplitboxUIFacade m_uiFacade;
- private boolean m_cacheSplitterPosition;
- private String m_cacheSplitterPositionPropertyName;
-
- public AbstractSplitBox() {
- this(true);
- }
-
- public AbstractSplitBox(boolean callInitializer) {
- super(callInitializer);
- }
-
- // configuration
-
- @ConfigPropertyValue("true")
- @Override
- protected boolean getConfiguredGridUseUiHeight() {
- return true;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(250)
- @ConfigPropertyValue("true")
- protected boolean getConfiguredSplitHorizontal() {
- return true;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(300)
- @ConfigPropertyValue("true")
- protected boolean getConfiguredSplitterEnabled() {
- return true;
- }
-
- @ConfigProperty(ConfigProperty.DOUBLE)
- @Order(340)
- @ConfigPropertyValue("0.5")
- protected double getConfiguredSplitterPosition() {
- return 0.5;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(355)
- @ConfigPropertyValue("true")
- protected boolean getConfiguredCacheSplitterPosition() {
- return true;
- }
-
- @ConfigProperty(ConfigProperty.STRING)
- @Order(360)
- @ConfigPropertyValue("getClass().getName")
- protected String getConfiguredCacheSplitterPositionPropertyName() {
- return getClass().getName();
- }
-
- @Override
- protected void initConfig() {
- m_uiFacade = new P_UIFacade();
- m_grid = new SplitBoxGrid(this);
- super.initConfig();
- setSplitHorizontal(getConfiguredSplitHorizontal());
- setSpliterEnabled(getConfiguredSplitterEnabled());
- setSplitterPosition(getConfiguredSplitterPosition());
- setCacheSplitterPosition(getConfiguredCacheSplitterPosition());
- setCacheSplitterPositionPropertyName(getConfiguredCacheSplitterPositionPropertyName());
- }
-
- @Override
- public void rebuildFieldGrid() {
- m_grid.validate();
- if (isInitialized()) {
- if (getForm() != null) {
- getForm().structureChanged(this);
- }
- }
- }
-
- @Override
- protected void handleFieldVisibilityChanged() {
- super.handleFieldVisibilityChanged();
- if (isInitialized()) {
- rebuildFieldGrid();
- }
- }
-
- @Override
- public final int getGridColumnCount() {
- return m_grid.getGridColumnCount();
- }
-
- @Override
- public final int getGridRowCount() {
- return m_grid.getGridRowCount();
- }
-
- @Override
- public boolean isSplitHorizontal() {
- return propertySupport.getPropertyBool(PROP_SPLIT_HORIZONTAL);
- }
-
- @Override
- public void setSplitHorizontal(boolean horizontal) {
- propertySupport.setPropertyBool(PROP_SPLIT_HORIZONTAL, horizontal);
- }
-
- @Override
- public boolean isSplitterEnabled() {
- return propertySupport.getPropertyBool(PROP_SPLITTER_ENABLED);
- }
-
- @Override
- public void setSpliterEnabled(boolean enabled) {
- propertySupport.setPropertyBool(PROP_SPLITTER_ENABLED, enabled);
- }
-
- @Override
- public double getSplitterPosition() {
- return propertySupport.getPropertyDouble(PROP_SPLITTER_POSITION);
- }
-
- @Override
- public void setSplitterPosition(double position) {
- propertySupport.setPropertyAlwaysFire(PROP_SPLITTER_POSITION, position);
- }
-
- @Override
- public boolean isCacheSplitterPosition() {
- return m_cacheSplitterPosition;
- }
-
- @Override
- public void setCacheSplitterPosition(boolean b) {
- m_cacheSplitterPosition = b;
- }
-
- @Override
- public String getCacheSplitterPositionPropertyName() {
- return m_cacheSplitterPositionPropertyName;
- }
-
- @Override
- public void setCacheSplitterPositionPropertyName(String propName) {
- m_cacheSplitterPositionPropertyName = propName;
- }
-
- @Override
- public ISplitboxUIFacade getUIFacade() {
- return m_uiFacade;
- }
-
- private class P_UIFacade implements ISplitboxUIFacade {
- } // end UIFacade
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.splitbox;
+
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.rt.client.ui.form.fields.AbstractCompositeField;
+import org.eclipse.scout.rt.client.ui.form.fields.splitbox.internal.SplitBoxGrid;
+
+/**
+ * <h3>AbstractSplitBox</h3> ...
+ *
+ * @since 3.1.12 16.07.2008
+ */
+public abstract class AbstractSplitBox extends AbstractCompositeField implements ISplitBox {
+
+ private SplitBoxGrid m_grid;
+ private ISplitboxUIFacade m_uiFacade;
+ private boolean m_cacheSplitterPosition;
+ private String m_cacheSplitterPositionPropertyName;
+
+ public AbstractSplitBox() {
+ this(true);
+ }
+
+ public AbstractSplitBox(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ // configuration
+
+ @ConfigPropertyValue("true")
+ @Override
+ protected boolean getConfiguredGridUseUiHeight() {
+ return true;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(250)
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredSplitHorizontal() {
+ return true;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(300)
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredSplitterEnabled() {
+ return true;
+ }
+
+ @ConfigProperty(ConfigProperty.DOUBLE)
+ @Order(340)
+ @ConfigPropertyValue("0.5")
+ protected double getConfiguredSplitterPosition() {
+ return 0.5;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(355)
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredCacheSplitterPosition() {
+ return true;
+ }
+
+ @ConfigProperty(ConfigProperty.STRING)
+ @Order(360)
+ @ConfigPropertyValue("getClass().getName")
+ protected String getConfiguredCacheSplitterPositionPropertyName() {
+ return getClass().getName();
+ }
+
+ @Override
+ protected void initConfig() {
+ m_uiFacade = new P_UIFacade();
+ m_grid = new SplitBoxGrid(this);
+ super.initConfig();
+ setSplitHorizontal(getConfiguredSplitHorizontal());
+ setSpliterEnabled(getConfiguredSplitterEnabled());
+ setSplitterPosition(getConfiguredSplitterPosition());
+ setCacheSplitterPosition(getConfiguredCacheSplitterPosition());
+ setCacheSplitterPositionPropertyName(getConfiguredCacheSplitterPositionPropertyName());
+ }
+
+ @Override
+ public void rebuildFieldGrid() {
+ m_grid.validate();
+ if (isInitialized()) {
+ if (getForm() != null) {
+ getForm().structureChanged(this);
+ }
+ }
+ }
+
+ @Override
+ protected void handleFieldVisibilityChanged() {
+ super.handleFieldVisibilityChanged();
+ if (isInitialized()) {
+ rebuildFieldGrid();
+ }
+ }
+
+ @Override
+ public final int getGridColumnCount() {
+ return m_grid.getGridColumnCount();
+ }
+
+ @Override
+ public final int getGridRowCount() {
+ return m_grid.getGridRowCount();
+ }
+
+ @Override
+ public boolean isSplitHorizontal() {
+ return propertySupport.getPropertyBool(PROP_SPLIT_HORIZONTAL);
+ }
+
+ @Override
+ public void setSplitHorizontal(boolean horizontal) {
+ propertySupport.setPropertyBool(PROP_SPLIT_HORIZONTAL, horizontal);
+ }
+
+ @Override
+ public boolean isSplitterEnabled() {
+ return propertySupport.getPropertyBool(PROP_SPLITTER_ENABLED);
+ }
+
+ @Override
+ public void setSpliterEnabled(boolean enabled) {
+ propertySupport.setPropertyBool(PROP_SPLITTER_ENABLED, enabled);
+ }
+
+ @Override
+ public double getSplitterPosition() {
+ return propertySupport.getPropertyDouble(PROP_SPLITTER_POSITION);
+ }
+
+ @Override
+ public void setSplitterPosition(double position) {
+ propertySupport.setPropertyAlwaysFire(PROP_SPLITTER_POSITION, position);
+ }
+
+ @Override
+ public boolean isCacheSplitterPosition() {
+ return m_cacheSplitterPosition;
+ }
+
+ @Override
+ public void setCacheSplitterPosition(boolean b) {
+ m_cacheSplitterPosition = b;
+ }
+
+ @Override
+ public String getCacheSplitterPositionPropertyName() {
+ return m_cacheSplitterPositionPropertyName;
+ }
+
+ @Override
+ public void setCacheSplitterPositionPropertyName(String propName) {
+ m_cacheSplitterPositionPropertyName = propName;
+ }
+
+ @Override
+ public ISplitboxUIFacade getUIFacade() {
+ return m_uiFacade;
+ }
+
+ private class P_UIFacade implements ISplitboxUIFacade {
+ } // end UIFacade
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/splitbox/ISplitBox.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/splitbox/ISplitBox.java
index 72300c3892..d2e20812c8 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/splitbox/ISplitBox.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/splitbox/ISplitBox.java
@@ -1,63 +1,63 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.splitbox;
-
-import org.eclipse.scout.rt.client.ui.form.fields.ICompositeField;
-
-/**
- * <h3>ISplitBox</h3> ...
- *
- * @since 1.0.9 16.07.2008
- */
-public interface ISplitBox extends ICompositeField {
- String PROP_SPLITTER_ENABLED = "splitterEnabled";
- String PROP_SPLIT_HORIZONTAL = "splitHorizontal";
- String PROP_SPLITTER_POSITION = "splitterPosition";
-
- boolean isSplitHorizontal();
-
- void setSplitHorizontal(boolean horizontal);
-
- boolean isSplitterEnabled();
-
- void setSpliterEnabled(boolean enabled);
-
- /**
- * Relative position of the splitter in the range 0..1
- */
- double getSplitterPosition();
-
- /**
- * Relative position of the splitter in the range 0..1
- */
- void setSplitterPosition(double position);
-
- /**
- * @return true if the splitter position is to be cached by the ui
- */
- boolean isCacheSplitterPosition();
-
- void setCacheSplitterPosition(boolean b);
-
- /**
- * set the storeSplitterPositionPropertyName to store the splitter position ui
- * side. all splitboxes with the same positionPropertyName have the same
- * position of the splitter.
- *
- * @return null to avoid storing the location a String to store the location
- * under the given name.
- */
- String getCacheSplitterPositionPropertyName();
-
- void setCacheSplitterPositionPropertyName(String propName);
-
- ISplitboxUIFacade getUIFacade();
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.splitbox;
+
+import org.eclipse.scout.rt.client.ui.form.fields.ICompositeField;
+
+/**
+ * <h3>ISplitBox</h3> ...
+ *
+ * @since 1.0.9 16.07.2008
+ */
+public interface ISplitBox extends ICompositeField {
+ String PROP_SPLITTER_ENABLED = "splitterEnabled";
+ String PROP_SPLIT_HORIZONTAL = "splitHorizontal";
+ String PROP_SPLITTER_POSITION = "splitterPosition";
+
+ boolean isSplitHorizontal();
+
+ void setSplitHorizontal(boolean horizontal);
+
+ boolean isSplitterEnabled();
+
+ void setSpliterEnabled(boolean enabled);
+
+ /**
+ * Relative position of the splitter in the range 0..1
+ */
+ double getSplitterPosition();
+
+ /**
+ * Relative position of the splitter in the range 0..1
+ */
+ void setSplitterPosition(double position);
+
+ /**
+ * @return true if the splitter position is to be cached by the ui
+ */
+ boolean isCacheSplitterPosition();
+
+ void setCacheSplitterPosition(boolean b);
+
+ /**
+ * set the storeSplitterPositionPropertyName to store the splitter position ui
+ * side. all splitboxes with the same positionPropertyName have the same
+ * position of the splitter.
+ *
+ * @return null to avoid storing the location a String to store the location
+ * under the given name.
+ */
+ String getCacheSplitterPositionPropertyName();
+
+ void setCacheSplitterPositionPropertyName(String propName);
+
+ ISplitboxUIFacade getUIFacade();
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/splitbox/ISplitboxUIFacade.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/splitbox/ISplitboxUIFacade.java
index 2c539cad4f..7760a76e5b 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/splitbox/ISplitboxUIFacade.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/splitbox/ISplitboxUIFacade.java
@@ -1,15 +1,15 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.splitbox;
-
-public interface ISplitboxUIFacade {
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.splitbox;
+
+public interface ISplitboxUIFacade {
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/splitbox/internal/SplitBoxGrid.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/splitbox/internal/SplitBoxGrid.java
index 65d3f6b864..c45f052ea9 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/splitbox/internal/SplitBoxGrid.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/splitbox/internal/SplitBoxGrid.java
@@ -1,79 +1,79 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.splitbox.internal;
-
-import java.util.ArrayList;
-
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.form.fields.GridData;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.internal.GridDataBuilder;
-import org.eclipse.scout.rt.client.ui.form.fields.splitbox.ISplitBox;
-
-/**
- * Grid (model) layout of split box only visible parts are used
- */
-public class SplitBoxGrid {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(SplitBoxGrid.class);
-
- private ISplitBox m_splitBox = null;
- private IFormField[] m_fields;
- private int m_gridColumns;
- private int m_gridRows;
-
- public SplitBoxGrid(ISplitBox splitBox) {
- m_splitBox = splitBox;
- }
-
- public void validate() {
- // reset
- m_gridColumns = 2;
- m_gridRows = 1;
- ArrayList<IFormField> list = new ArrayList<IFormField>();
- // filter
- for (IFormField f : m_splitBox.getFields()) {
- if (f.isVisible()) {
- list.add(f);
- }
- else {
- GridData data = GridDataBuilder.createFromHints(f, 1);
- f.setGridDataInternal(data);
- }
- }
- m_fields = list.toArray(new IFormField[list.size()]);
- layoutStatic();
- }
-
- private void layoutStatic() {
- int x = 0;
- for (int i = 0; i < m_fields.length; i++) {
- GridData data = GridDataBuilder.createFromHints(m_fields[i], 1);
- data.x = x;
- data.y = 0;
- if (data.weightX < 0) {
- data.weightX = data.w;
- }
- m_fields[i].setGridDataInternal(data);
- x = x + data.w;
- m_gridRows = Math.max(m_gridRows, data.h);
- }
- m_gridColumns = x;
- }
-
- public int getGridColumnCount() {
- return m_gridColumns;
- }
-
- public int getGridRowCount() {
- return m_gridRows;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.splitbox.internal;
+
+import java.util.ArrayList;
+
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.form.fields.GridData;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.internal.GridDataBuilder;
+import org.eclipse.scout.rt.client.ui.form.fields.splitbox.ISplitBox;
+
+/**
+ * Grid (model) layout of split box only visible parts are used
+ */
+public class SplitBoxGrid {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(SplitBoxGrid.class);
+
+ private ISplitBox m_splitBox = null;
+ private IFormField[] m_fields;
+ private int m_gridColumns;
+ private int m_gridRows;
+
+ public SplitBoxGrid(ISplitBox splitBox) {
+ m_splitBox = splitBox;
+ }
+
+ public void validate() {
+ // reset
+ m_gridColumns = 2;
+ m_gridRows = 1;
+ ArrayList<IFormField> list = new ArrayList<IFormField>();
+ // filter
+ for (IFormField f : m_splitBox.getFields()) {
+ if (f.isVisible()) {
+ list.add(f);
+ }
+ else {
+ GridData data = GridDataBuilder.createFromHints(f, 1);
+ f.setGridDataInternal(data);
+ }
+ }
+ m_fields = list.toArray(new IFormField[list.size()]);
+ layoutStatic();
+ }
+
+ private void layoutStatic() {
+ int x = 0;
+ for (int i = 0; i < m_fields.length; i++) {
+ GridData data = GridDataBuilder.createFromHints(m_fields[i], 1);
+ data.x = x;
+ data.y = 0;
+ if (data.weightX < 0) {
+ data.weightX = data.w;
+ }
+ m_fields[i].setGridDataInternal(data);
+ x = x + data.w;
+ m_gridRows = Math.max(m_gridRows, data.h);
+ }
+ m_gridColumns = x;
+ }
+
+ public int getGridColumnCount() {
+ return m_gridColumns;
+ }
+
+ public int getGridRowCount() {
+ return m_gridRows;
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/stringfield/AbstractStringField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/stringfield/AbstractStringField.java
index 1704b96521..ff02b1ff68 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/stringfield/AbstractStringField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/stringfield/AbstractStringField.java
@@ -1,511 +1,511 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.stringfield;
-
-import java.net.URL;
-
-import org.eclipse.scout.commons.IOUtility;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.annotations.ConfigOperation;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.dnd.TransferObject;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.IDNDSupport;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.ISearchForm;
-import org.eclipse.scout.rt.client.ui.form.fields.AbstractValueField;
-import org.eclipse.scout.rt.shared.data.form.ValidationRule;
-
-public abstract class AbstractStringField extends AbstractValueField<String> implements IStringField {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractStringField.class);
-
- private IStringFieldUIFacade m_uiFacade;
- private Boolean m_monitorSpelling = null; // If null the application-wide
-
- // default is used
-
- public AbstractStringField() {
- this(true);
- }
-
- public AbstractStringField(boolean callInitializer) {
- super(callInitializer);
- }
-
- /*
- * Configuration
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(260)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredDecorationLink() {
- return false;
- }
-
- @ConfigProperty(ConfigProperty.STRING)
- @Order(240)
- @ConfigPropertyValue("null")
- protected String getConfiguredFormat() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(250)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredInputMasked() {
- return false;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(280)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredFormatLower() {
- return false;
- }
-
- @ConfigProperty(ConfigProperty.INTEGER)
- @Order(290)
- @ConfigPropertyValue("4000")
- @ValidationRule(ValidationRule.MAX_LENGTH)
- protected int getConfiguredMaxLength() {
- return 4000;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(230)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredMultilineText() {
- return false;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(300)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredFormatUpper() {
- return false;
- }
-
- /**
- * Causes the ui to send a validate event every time the text field content is changed.
- * <p>
- * Be careful when using this property since this can influence performance and the charateristics of text input.
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(310)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredValidateOnAnyKey() {
- return false;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(320)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredWrapText() {
- return false;
- }
-
- @ConfigProperty(ConfigProperty.STRING)
- @Order(330)
- @ConfigPropertyValue("null")
- protected String getConfiguredValueFormat() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(340)
- @ConfigPropertyValue("true")
- protected boolean getConfiguredSelectAllOnFocus() {
- return true;
- }
-
- @ConfigProperty(ConfigProperty.DRAG_AND_DROP_TYPE)
- @Order(400)
- @ConfigPropertyValue("0")
- protected int getConfiguredDropType() {
- return 0;
- }
-
- @ConfigProperty(ConfigProperty.DRAG_AND_DROP_TYPE)
- @Order(410)
- @ConfigPropertyValue("0")
- protected int getConfiguredDragType() {
- return 0;
- }
-
- @ConfigOperation
- @Order(500)
- protected TransferObject execDragRequest() {
- return null;
- }
-
- @ConfigOperation
- @Order(510)
- protected void execDropRequest(TransferObject transferObject) {
- }
-
- /**
- * When a link is marked as link this method will be called. Implement it to
- * add a link action behaviour.
- */
- @ConfigOperation
- @Order(240)
- protected void execLinkAction(URL url) throws ProcessingException {
- }
-
- @Override
- protected void initConfig() {
- m_uiFacade = new P_UIFacade();
- super.initConfig();
- setMaxLength(getConfiguredMaxLength());
- setInputMasked(getConfiguredInputMasked());
- if (getConfiguredFormatLower()) {
- setFormatLower();
- }
- else if (getConfiguredFormatUpper()) {
- setFormatUpper();
- }
- else {
- setFormat(getConfiguredFormat());
- }
- setDecorationLink(getConfiguredDecorationLink());
- setWrapText(getConfiguredWrapText());
- setMultilineText(getConfiguredMultilineText());
- setSelectAllOnFocus(getConfiguredSelectAllOnFocus() && !getConfiguredMultilineText());
- setValidateOnAnyKey(getConfiguredValidateOnAnyKey());
- int configuredDragType = getConfiguredDragType();
- if (IDNDSupport.TYPE_TEXT_TRANSFER == configuredDragType) {
- LOG.warn("Drag and drop TextTransfer is default behaviour (Configuration will not be considered).");
- configuredDragType = 0;
- }
- setDragType(configuredDragType);
- int configuredDropType = getConfiguredDropType();
- if (IDNDSupport.TYPE_TEXT_TRANSFER == configuredDropType) {
- LOG.warn("Drag and drop TextTransfer is default behaviour (Configuration will not be considered).");
- configuredDropType = 0;
- }
- setDropType(configuredDropType);
- }
-
- @Override
- public void setMaxLength(int len) {
- if (len > 0) {
- propertySupport.setPropertyInt(PROP_MAX_LENGTH, len);
- }
- if (isInitialized()) {
- setValue(getValue());
- }
- }
-
- @Override
- public int getMaxLength() {
- int len = propertySupport.getPropertyInt(PROP_MAX_LENGTH);
- if (len <= 0) {
- len = 200;
- }
- return len;
- }
-
- @Override
- protected String validateValueInternal(String rawValue) throws ProcessingException {
- String validValue = null;
- rawValue = super.validateValueInternal(rawValue);
- validValue = rawValue;
- if (validValue != null && validValue.length() == 0) {
- validValue = null;
- }
- if (validValue != null) {
- if (validValue.length() > getMaxLength()) {
- validValue = validValue.substring(0, getMaxLength());
- }
- if (isFormatUpper()) {
- validValue = validValue.toUpperCase();
- }
- else if (isFormatLower()) {
- validValue = validValue.toLowerCase();
- }
- }
- /*
- * bsi ticket 95042
- */
- if (validValue != null && !isMultilineText()) {
- // omit leading and trailing newlines
- validValue = StringUtility.trimNewLines(validValue);
- // replace newlines by spaces
- validValue = validValue.replaceAll("\r\n", " ").replaceAll("[\r\n]", " ");
- }
- return validValue;
- }
-
- @Override
- public void setInputMasked(boolean b) {
- propertySupport.setPropertyBool(PROP_INPUT_MASKED, b);
- }
-
- @Override
- public boolean isInputMasked() {
- return propertySupport.getPropertyBool(PROP_INPUT_MASKED);
- }
-
- @Override
- public void setFormatUpper() {
- setFormat(FORMAT_UPPER);
- }
-
- @Override
- public boolean isFormatUpper() {
- return FORMAT_UPPER.equals(getFormat());
- }
-
- @Override
- public void setFormatLower() {
- setFormat(FORMAT_LOWER);
- }
-
- @Override
- public boolean isFormatLower() {
- return FORMAT_LOWER.equals(getFormat());
- }
-
- @Override
- public void setDecorationLink(boolean b) {
- propertySupport.setPropertyBool(PROP_DECORATION_LINK, b);
- }
-
- @Override
- public boolean isDecorationLink() {
- return propertySupport.getPropertyBool(PROP_DECORATION_LINK);
- }
-
- @Override
- public void setWrapText(boolean b) {
- propertySupport.setPropertyBool(PROP_WRAP_TEXT, b);
- }
-
- @Override
- public boolean isWrapText() {
- return propertySupport.getPropertyBool(PROP_WRAP_TEXT);
- }
-
- @Override
- public void setMultilineText(boolean b) {
- propertySupport.setPropertyBool(PROP_MULTILINE_TEXT, b);
- }
-
- @Override
- public boolean isMultilineText() {
- return propertySupport.getPropertyBool(PROP_MULTILINE_TEXT);
- }
-
- @Override
- public void insertText(String s) {
- propertySupport.setPropertyAlwaysFire(PROP_INSERT_TEXT, s);
- }
-
- @Override
- public boolean isSelectAllOnFocus() {
- return propertySupport.getPropertyBool(PROP_SELECT_ALL_ON_FOCUS);
- }
-
- @Override
- public void setSelectAllOnFocus(boolean b) {
- propertySupport.setPropertyBool(PROP_SELECT_ALL_ON_FOCUS, b);
- }
-
- @Override
- public void setValidateOnAnyKey(boolean b) {
- propertySupport.setPropertyBool(PROP_VALIDATE_ON_ANY_KEY, b);
- }
-
- @Override
- public boolean isValidateOnAnyKey() {
- return propertySupport.getPropertyBool(PROP_VALIDATE_ON_ANY_KEY);
- }
-
- @Override
- public void select(int startIndex, int endIndex) {
- try {
- propertySupport.setPropertiesChanging(true);
- //
- propertySupport.setPropertyInt(PROP_SELECTION_START, startIndex);
- propertySupport.setPropertyInt(PROP_SELECTION_END, endIndex);
- }
- finally {
- propertySupport.setPropertiesChanging(false);
- }
- }
-
- @Override
- public int getSelectionStart() {
- return propertySupport.getPropertyInt(PROP_SELECTION_START);
- }
-
- @Override
- public int getSelectionEnd() {
- return propertySupport.getPropertyInt(PROP_SELECTION_END);
- }
-
- @Override
- public IStringFieldUIFacade getUIFacade() {
- return m_uiFacade;
- }
-
- @Override
- public void setFormat(String s) {
- propertySupport.setPropertyString(PROP_FORMAT, s);
- if (isInitialized()) {
- if (isAutoDisplayText()) {
- String t = execFormatValue(getValue());
- setDisplayText(t);
- }
- }
- }
-
- @Override
- public String getFormat() {
- return propertySupport.getPropertyString(PROP_FORMAT);
- }
-
- // convert string to a real string
- @Override
- protected String parseValueInternal(String text) throws ProcessingException {
- if (text != null && text.length() == 0) {
- text = null;
- }
- String fmt = getFormat();
- if (fmt != null && text != null) {
- if (IStringField.FORMAT_LOWER.equals(fmt)) {
- text = text.toLowerCase();
- }
- else if (IStringField.FORMAT_UPPER.equals(fmt)) {
- text = text.toUpperCase();
- }
- }
- return text;
- }
-
- // DND
- @Override
- public void setDragType(int dragType) {
- propertySupport.setPropertyInt(PROP_DRAG_TYPE, dragType);
- }
-
- @Override
- public int getDragType() {
- return propertySupport.getPropertyInt(PROP_DRAG_TYPE);
- }
-
- @Override
- public void setDropType(int dropType) {
- propertySupport.setPropertyInt(PROP_DROP_TYPE, dropType);
- }
-
- @Override
- public int getDropType() {
- return propertySupport.getPropertyInt(PROP_DROP_TYPE);
- }
-
- private class P_UIFacade implements IStringFieldUIFacade {
-
- @Override
- public boolean setTextFromUI(String newText) {
- if (newText != null && newText.length() == 0) {
- newText = null;
- }
- // parse always, validity might change even if text is same
- return parseValue(newText);
- }
-
- /*
- * (non-Javadoc)
- * @see
- * org.eclipse.scout.rt.client.ui.form.fields.stringfield.IStringFieldUIFacade
- * #fireLinkActionFromUI(java.lang.String)
- */
- @Override
- public void fireLinkActionFromUI(String text) {
- URL url = IOUtility.urlTextToUrl(text);
- try {
- execLinkAction(url);
- }
- catch (ProcessingException e) {
- LOG.warn("execLinkAction failed", e);
- }
- }
-
- @Override
- public void fireKeyTypedFromUI(String newText) {
- String oldText = getDisplayText();
- if (oldText != null && oldText.length() == 0) {
- oldText = null;
- }
- if (newText != null && newText.length() == 0) {
- newText = null;
- }
- if (oldText == newText || (oldText != null && oldText.equals(newText))) {
- // no change
- return;
- }
- parseValue(newText);
- }
-
- @Override
- public void setSelectionFromUI(int startOfSelection, int endOfSelection) {
- select(startOfSelection, endOfSelection);
- }
-
- @Override
- public TransferObject fireDragRequestFromUI() {
- return execDragRequest();
- }
-
- @Override
- public void fireDropActionFromUi(TransferObject scoutTransferable) {
- execDropRequest(scoutTransferable);
- }
- }
-
- /**
- * Returns whether this text component is spell checkable.
- */
- @Override
- public boolean isSpellCheckEnabled() {
- return (!this.isDecorationLink() &&
- !this.isFormatUpper() &&
- !this.isFormatLower() &&
- this.isEnabled() &&
- this.isEnabledGranted() && (!(this.getForm() instanceof ISearchForm)));
- }
-
- /**
- * Returns whether this text component should be monitored for spelling errors
- * in the background ("check as you type").<br>
- * If it is not defined, null is returned, then the application default is
- * used.
- */
- @Override
- public Boolean isSpellCheckAsYouTypeEnabled() {
- return m_monitorSpelling;
- }
-
- /**
- * Sets whether to monitor this text component for spelling errors in the
- * background ("check as you type").<br>
- * Use null for application default.
- */
- @Override
- public void setSpellCheckAsYouTypeEnabled(boolean monitorSpelling) {
- m_monitorSpelling = new Boolean(monitorSpelling);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.stringfield;
+
+import java.net.URL;
+
+import org.eclipse.scout.commons.IOUtility;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.annotations.ConfigOperation;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.dnd.TransferObject;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.IDNDSupport;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.ISearchForm;
+import org.eclipse.scout.rt.client.ui.form.fields.AbstractValueField;
+import org.eclipse.scout.rt.shared.data.form.ValidationRule;
+
+public abstract class AbstractStringField extends AbstractValueField<String> implements IStringField {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractStringField.class);
+
+ private IStringFieldUIFacade m_uiFacade;
+ private Boolean m_monitorSpelling = null; // If null the application-wide
+
+ // default is used
+
+ public AbstractStringField() {
+ this(true);
+ }
+
+ public AbstractStringField(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ /*
+ * Configuration
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(260)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredDecorationLink() {
+ return false;
+ }
+
+ @ConfigProperty(ConfigProperty.STRING)
+ @Order(240)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredFormat() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(250)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredInputMasked() {
+ return false;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(280)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredFormatLower() {
+ return false;
+ }
+
+ @ConfigProperty(ConfigProperty.INTEGER)
+ @Order(290)
+ @ConfigPropertyValue("4000")
+ @ValidationRule(ValidationRule.MAX_LENGTH)
+ protected int getConfiguredMaxLength() {
+ return 4000;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(230)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredMultilineText() {
+ return false;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(300)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredFormatUpper() {
+ return false;
+ }
+
+ /**
+ * Causes the ui to send a validate event every time the text field content is changed.
+ * <p>
+ * Be careful when using this property since this can influence performance and the charateristics of text input.
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(310)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredValidateOnAnyKey() {
+ return false;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(320)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredWrapText() {
+ return false;
+ }
+
+ @ConfigProperty(ConfigProperty.STRING)
+ @Order(330)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredValueFormat() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(340)
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredSelectAllOnFocus() {
+ return true;
+ }
+
+ @ConfigProperty(ConfigProperty.DRAG_AND_DROP_TYPE)
+ @Order(400)
+ @ConfigPropertyValue("0")
+ protected int getConfiguredDropType() {
+ return 0;
+ }
+
+ @ConfigProperty(ConfigProperty.DRAG_AND_DROP_TYPE)
+ @Order(410)
+ @ConfigPropertyValue("0")
+ protected int getConfiguredDragType() {
+ return 0;
+ }
+
+ @ConfigOperation
+ @Order(500)
+ protected TransferObject execDragRequest() {
+ return null;
+ }
+
+ @ConfigOperation
+ @Order(510)
+ protected void execDropRequest(TransferObject transferObject) {
+ }
+
+ /**
+ * When a link is marked as link this method will be called. Implement it to
+ * add a link action behaviour.
+ */
+ @ConfigOperation
+ @Order(240)
+ protected void execLinkAction(URL url) throws ProcessingException {
+ }
+
+ @Override
+ protected void initConfig() {
+ m_uiFacade = new P_UIFacade();
+ super.initConfig();
+ setMaxLength(getConfiguredMaxLength());
+ setInputMasked(getConfiguredInputMasked());
+ if (getConfiguredFormatLower()) {
+ setFormatLower();
+ }
+ else if (getConfiguredFormatUpper()) {
+ setFormatUpper();
+ }
+ else {
+ setFormat(getConfiguredFormat());
+ }
+ setDecorationLink(getConfiguredDecorationLink());
+ setWrapText(getConfiguredWrapText());
+ setMultilineText(getConfiguredMultilineText());
+ setSelectAllOnFocus(getConfiguredSelectAllOnFocus() && !getConfiguredMultilineText());
+ setValidateOnAnyKey(getConfiguredValidateOnAnyKey());
+ int configuredDragType = getConfiguredDragType();
+ if (IDNDSupport.TYPE_TEXT_TRANSFER == configuredDragType) {
+ LOG.warn("Drag and drop TextTransfer is default behaviour (Configuration will not be considered).");
+ configuredDragType = 0;
+ }
+ setDragType(configuredDragType);
+ int configuredDropType = getConfiguredDropType();
+ if (IDNDSupport.TYPE_TEXT_TRANSFER == configuredDropType) {
+ LOG.warn("Drag and drop TextTransfer is default behaviour (Configuration will not be considered).");
+ configuredDropType = 0;
+ }
+ setDropType(configuredDropType);
+ }
+
+ @Override
+ public void setMaxLength(int len) {
+ if (len > 0) {
+ propertySupport.setPropertyInt(PROP_MAX_LENGTH, len);
+ }
+ if (isInitialized()) {
+ setValue(getValue());
+ }
+ }
+
+ @Override
+ public int getMaxLength() {
+ int len = propertySupport.getPropertyInt(PROP_MAX_LENGTH);
+ if (len <= 0) {
+ len = 200;
+ }
+ return len;
+ }
+
+ @Override
+ protected String validateValueInternal(String rawValue) throws ProcessingException {
+ String validValue = null;
+ rawValue = super.validateValueInternal(rawValue);
+ validValue = rawValue;
+ if (validValue != null && validValue.length() == 0) {
+ validValue = null;
+ }
+ if (validValue != null) {
+ if (validValue.length() > getMaxLength()) {
+ validValue = validValue.substring(0, getMaxLength());
+ }
+ if (isFormatUpper()) {
+ validValue = validValue.toUpperCase();
+ }
+ else if (isFormatLower()) {
+ validValue = validValue.toLowerCase();
+ }
+ }
+ /*
+ * bsi ticket 95042
+ */
+ if (validValue != null && !isMultilineText()) {
+ // omit leading and trailing newlines
+ validValue = StringUtility.trimNewLines(validValue);
+ // replace newlines by spaces
+ validValue = validValue.replaceAll("\r\n", " ").replaceAll("[\r\n]", " ");
+ }
+ return validValue;
+ }
+
+ @Override
+ public void setInputMasked(boolean b) {
+ propertySupport.setPropertyBool(PROP_INPUT_MASKED, b);
+ }
+
+ @Override
+ public boolean isInputMasked() {
+ return propertySupport.getPropertyBool(PROP_INPUT_MASKED);
+ }
+
+ @Override
+ public void setFormatUpper() {
+ setFormat(FORMAT_UPPER);
+ }
+
+ @Override
+ public boolean isFormatUpper() {
+ return FORMAT_UPPER.equals(getFormat());
+ }
+
+ @Override
+ public void setFormatLower() {
+ setFormat(FORMAT_LOWER);
+ }
+
+ @Override
+ public boolean isFormatLower() {
+ return FORMAT_LOWER.equals(getFormat());
+ }
+
+ @Override
+ public void setDecorationLink(boolean b) {
+ propertySupport.setPropertyBool(PROP_DECORATION_LINK, b);
+ }
+
+ @Override
+ public boolean isDecorationLink() {
+ return propertySupport.getPropertyBool(PROP_DECORATION_LINK);
+ }
+
+ @Override
+ public void setWrapText(boolean b) {
+ propertySupport.setPropertyBool(PROP_WRAP_TEXT, b);
+ }
+
+ @Override
+ public boolean isWrapText() {
+ return propertySupport.getPropertyBool(PROP_WRAP_TEXT);
+ }
+
+ @Override
+ public void setMultilineText(boolean b) {
+ propertySupport.setPropertyBool(PROP_MULTILINE_TEXT, b);
+ }
+
+ @Override
+ public boolean isMultilineText() {
+ return propertySupport.getPropertyBool(PROP_MULTILINE_TEXT);
+ }
+
+ @Override
+ public void insertText(String s) {
+ propertySupport.setPropertyAlwaysFire(PROP_INSERT_TEXT, s);
+ }
+
+ @Override
+ public boolean isSelectAllOnFocus() {
+ return propertySupport.getPropertyBool(PROP_SELECT_ALL_ON_FOCUS);
+ }
+
+ @Override
+ public void setSelectAllOnFocus(boolean b) {
+ propertySupport.setPropertyBool(PROP_SELECT_ALL_ON_FOCUS, b);
+ }
+
+ @Override
+ public void setValidateOnAnyKey(boolean b) {
+ propertySupport.setPropertyBool(PROP_VALIDATE_ON_ANY_KEY, b);
+ }
+
+ @Override
+ public boolean isValidateOnAnyKey() {
+ return propertySupport.getPropertyBool(PROP_VALIDATE_ON_ANY_KEY);
+ }
+
+ @Override
+ public void select(int startIndex, int endIndex) {
+ try {
+ propertySupport.setPropertiesChanging(true);
+ //
+ propertySupport.setPropertyInt(PROP_SELECTION_START, startIndex);
+ propertySupport.setPropertyInt(PROP_SELECTION_END, endIndex);
+ }
+ finally {
+ propertySupport.setPropertiesChanging(false);
+ }
+ }
+
+ @Override
+ public int getSelectionStart() {
+ return propertySupport.getPropertyInt(PROP_SELECTION_START);
+ }
+
+ @Override
+ public int getSelectionEnd() {
+ return propertySupport.getPropertyInt(PROP_SELECTION_END);
+ }
+
+ @Override
+ public IStringFieldUIFacade getUIFacade() {
+ return m_uiFacade;
+ }
+
+ @Override
+ public void setFormat(String s) {
+ propertySupport.setPropertyString(PROP_FORMAT, s);
+ if (isInitialized()) {
+ if (isAutoDisplayText()) {
+ String t = execFormatValue(getValue());
+ setDisplayText(t);
+ }
+ }
+ }
+
+ @Override
+ public String getFormat() {
+ return propertySupport.getPropertyString(PROP_FORMAT);
+ }
+
+ // convert string to a real string
+ @Override
+ protected String parseValueInternal(String text) throws ProcessingException {
+ if (text != null && text.length() == 0) {
+ text = null;
+ }
+ String fmt = getFormat();
+ if (fmt != null && text != null) {
+ if (IStringField.FORMAT_LOWER.equals(fmt)) {
+ text = text.toLowerCase();
+ }
+ else if (IStringField.FORMAT_UPPER.equals(fmt)) {
+ text = text.toUpperCase();
+ }
+ }
+ return text;
+ }
+
+ // DND
+ @Override
+ public void setDragType(int dragType) {
+ propertySupport.setPropertyInt(PROP_DRAG_TYPE, dragType);
+ }
+
+ @Override
+ public int getDragType() {
+ return propertySupport.getPropertyInt(PROP_DRAG_TYPE);
+ }
+
+ @Override
+ public void setDropType(int dropType) {
+ propertySupport.setPropertyInt(PROP_DROP_TYPE, dropType);
+ }
+
+ @Override
+ public int getDropType() {
+ return propertySupport.getPropertyInt(PROP_DROP_TYPE);
+ }
+
+ private class P_UIFacade implements IStringFieldUIFacade {
+
+ @Override
+ public boolean setTextFromUI(String newText) {
+ if (newText != null && newText.length() == 0) {
+ newText = null;
+ }
+ // parse always, validity might change even if text is same
+ return parseValue(newText);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
+ * org.eclipse.scout.rt.client.ui.form.fields.stringfield.IStringFieldUIFacade
+ * #fireLinkActionFromUI(java.lang.String)
+ */
+ @Override
+ public void fireLinkActionFromUI(String text) {
+ URL url = IOUtility.urlTextToUrl(text);
+ try {
+ execLinkAction(url);
+ }
+ catch (ProcessingException e) {
+ LOG.warn("execLinkAction failed", e);
+ }
+ }
+
+ @Override
+ public void fireKeyTypedFromUI(String newText) {
+ String oldText = getDisplayText();
+ if (oldText != null && oldText.length() == 0) {
+ oldText = null;
+ }
+ if (newText != null && newText.length() == 0) {
+ newText = null;
+ }
+ if (oldText == newText || (oldText != null && oldText.equals(newText))) {
+ // no change
+ return;
+ }
+ parseValue(newText);
+ }
+
+ @Override
+ public void setSelectionFromUI(int startOfSelection, int endOfSelection) {
+ select(startOfSelection, endOfSelection);
+ }
+
+ @Override
+ public TransferObject fireDragRequestFromUI() {
+ return execDragRequest();
+ }
+
+ @Override
+ public void fireDropActionFromUi(TransferObject scoutTransferable) {
+ execDropRequest(scoutTransferable);
+ }
+ }
+
+ /**
+ * Returns whether this text component is spell checkable.
+ */
+ @Override
+ public boolean isSpellCheckEnabled() {
+ return (!this.isDecorationLink() &&
+ !this.isFormatUpper() &&
+ !this.isFormatLower() &&
+ this.isEnabled() &&
+ this.isEnabledGranted() && (!(this.getForm() instanceof ISearchForm)));
+ }
+
+ /**
+ * Returns whether this text component should be monitored for spelling errors
+ * in the background ("check as you type").<br>
+ * If it is not defined, null is returned, then the application default is
+ * used.
+ */
+ @Override
+ public Boolean isSpellCheckAsYouTypeEnabled() {
+ return m_monitorSpelling;
+ }
+
+ /**
+ * Sets whether to monitor this text component for spelling errors in the
+ * background ("check as you type").<br>
+ * Use null for application default.
+ */
+ @Override
+ public void setSpellCheckAsYouTypeEnabled(boolean monitorSpelling) {
+ m_monitorSpelling = new Boolean(monitorSpelling);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/stringfield/IStringField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/stringfield/IStringField.java
index d999e8ac7d..11a9501c44 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/stringfield/IStringField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/stringfield/IStringField.java
@@ -1,113 +1,113 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.stringfield;
-
-import org.eclipse.scout.rt.client.ui.IDNDSupport;
-import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
-
-public interface IStringField extends IValueField<String>, IDNDSupport {
-
- /**
- * @see IDNDSupport
- */
- String PROP_DECORATION_LINK = "decorationLink";
- String PROP_INPUT_MASKED = "inputMasked";
- String PROP_WRAP_TEXT = "wrapText";
- String PROP_MULTILINE_TEXT = "multilineText";
- String PROP_SELECT_ALL_ON_FOCUS = "selectAllOnFocus";
- String PROP_FORMAT = "format";
- String PROP_MAX_LENGTH = "maxLength";
- String PROP_INSERT_TEXT = "insertText";
- String PROP_VALIDATE_ON_ANY_KEY = "validateOnAnyKey";
- String PROP_SELECTION_START = "selectionStart";
- String PROP_SELECTION_END = "selectionEnd";
-
- /* enum for formats */
- String FORMAT_UPPER = "A";
- String FORMAT_LOWER = "a";
-
- void setMaxLength(int len);
-
- int getMaxLength();
-
- void setInputMasked(boolean b);
-
- boolean isInputMasked();
-
- void setFormat(String s);
-
- String getFormat();
-
- void setFormatUpper();
-
- boolean isFormatUpper();
-
- void setFormatLower();
-
- boolean isFormatLower();
-
- void setDecorationLink(boolean b);
-
- boolean isDecorationLink();
-
- void setWrapText(boolean b);
-
- boolean isWrapText();
-
- void setMultilineText(boolean b);
-
- boolean isMultilineText();
-
- void insertText(String s);
-
- /**
- * Causes the ui to send a validate event every time the text field content is changed.
- * <p>
- * Be careful when using this property since this can influence performance and the charateristics of text input.
- */
- void setValidateOnAnyKey(boolean b);
-
- /**
- * @return whether the ui to sends a validate event every time the text field content is changed
- */
- boolean isValidateOnAnyKey();
-
- int getSelectionStart();
-
- int getSelectionEnd();
-
- void select(int startIndex, int endIndex);
-
- boolean isSelectAllOnFocus();
-
- void setSelectAllOnFocus(boolean b);
-
- IStringFieldUIFacade getUIFacade();
-
- /**
- * Returns whether this field is spell checkable.
- */
- boolean isSpellCheckEnabled();
-
- /**
- * Returns whether this field should be monitored for spelling errors in the
- * background ("check as you type"). If it is not defined, null is returned,
- * then the application default is used.
- */
- Boolean isSpellCheckAsYouTypeEnabled();
-
- /**
- * Sets whether to monitor this field for spelling errors in the background
- * ("check as you type"). Use null for application default.
- */
- void setSpellCheckAsYouTypeEnabled(boolean monitorSpelling);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.stringfield;
+
+import org.eclipse.scout.rt.client.ui.IDNDSupport;
+import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
+
+public interface IStringField extends IValueField<String>, IDNDSupport {
+
+ /**
+ * @see IDNDSupport
+ */
+ String PROP_DECORATION_LINK = "decorationLink";
+ String PROP_INPUT_MASKED = "inputMasked";
+ String PROP_WRAP_TEXT = "wrapText";
+ String PROP_MULTILINE_TEXT = "multilineText";
+ String PROP_SELECT_ALL_ON_FOCUS = "selectAllOnFocus";
+ String PROP_FORMAT = "format";
+ String PROP_MAX_LENGTH = "maxLength";
+ String PROP_INSERT_TEXT = "insertText";
+ String PROP_VALIDATE_ON_ANY_KEY = "validateOnAnyKey";
+ String PROP_SELECTION_START = "selectionStart";
+ String PROP_SELECTION_END = "selectionEnd";
+
+ /* enum for formats */
+ String FORMAT_UPPER = "A";
+ String FORMAT_LOWER = "a";
+
+ void setMaxLength(int len);
+
+ int getMaxLength();
+
+ void setInputMasked(boolean b);
+
+ boolean isInputMasked();
+
+ void setFormat(String s);
+
+ String getFormat();
+
+ void setFormatUpper();
+
+ boolean isFormatUpper();
+
+ void setFormatLower();
+
+ boolean isFormatLower();
+
+ void setDecorationLink(boolean b);
+
+ boolean isDecorationLink();
+
+ void setWrapText(boolean b);
+
+ boolean isWrapText();
+
+ void setMultilineText(boolean b);
+
+ boolean isMultilineText();
+
+ void insertText(String s);
+
+ /**
+ * Causes the ui to send a validate event every time the text field content is changed.
+ * <p>
+ * Be careful when using this property since this can influence performance and the charateristics of text input.
+ */
+ void setValidateOnAnyKey(boolean b);
+
+ /**
+ * @return whether the ui to sends a validate event every time the text field content is changed
+ */
+ boolean isValidateOnAnyKey();
+
+ int getSelectionStart();
+
+ int getSelectionEnd();
+
+ void select(int startIndex, int endIndex);
+
+ boolean isSelectAllOnFocus();
+
+ void setSelectAllOnFocus(boolean b);
+
+ IStringFieldUIFacade getUIFacade();
+
+ /**
+ * Returns whether this field is spell checkable.
+ */
+ boolean isSpellCheckEnabled();
+
+ /**
+ * Returns whether this field should be monitored for spelling errors in the
+ * background ("check as you type"). If it is not defined, null is returned,
+ * then the application default is used.
+ */
+ Boolean isSpellCheckAsYouTypeEnabled();
+
+ /**
+ * Sets whether to monitor this field for spelling errors in the background
+ * ("check as you type"). Use null for application default.
+ */
+ void setSpellCheckAsYouTypeEnabled(boolean monitorSpelling);
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/stringfield/IStringFieldUIFacade.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/stringfield/IStringFieldUIFacade.java
index dfe13e1834..d2157f85f5 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/stringfield/IStringFieldUIFacade.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/stringfield/IStringFieldUIFacade.java
@@ -1,39 +1,39 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.stringfield;
-
-import java.net.URL;
-
-import org.eclipse.scout.commons.dnd.TransferObject;
-
-public interface IStringFieldUIFacade {
-
- boolean setTextFromUI(String newText);
-
- /**
- * The text passed to this method is tried to wellform as an URL and {@link IStringField#execLinkAction(URL)} will be
- * called. The link action
- * handling has to be done by overriding the execLinkAction on the string
- * field. If the text can not be transformed into an URL the execLinkAction
- * method is called with null.
- *
- * @param text
- */
- void fireLinkActionFromUI(String text);
-
- void fireKeyTypedFromUI(String newText);
-
- void setSelectionFromUI(int startOfSelection, int endOfSelection);
-
- TransferObject fireDragRequestFromUI();
-
- void fireDropActionFromUi(TransferObject scoutTransferable);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.stringfield;
+
+import java.net.URL;
+
+import org.eclipse.scout.commons.dnd.TransferObject;
+
+public interface IStringFieldUIFacade {
+
+ boolean setTextFromUI(String newText);
+
+ /**
+ * The text passed to this method is tried to wellform as an URL and {@link IStringField#execLinkAction(URL)} will be
+ * called. The link action
+ * handling has to be done by overriding the execLinkAction on the string
+ * field. If the text can not be transformed into an URL the execLinkAction
+ * method is called with null.
+ *
+ * @param text
+ */
+ void fireLinkActionFromUI(String text);
+
+ void fireKeyTypedFromUI(String newText);
+
+ void setSelectionFromUI(int startOfSelection, int endOfSelection);
+
+ TransferObject fireDragRequestFromUI();
+
+ void fireDropActionFromUi(TransferObject scoutTransferable);
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/tabbox/AbstractTabBox.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/tabbox/AbstractTabBox.java
index 734e6a1746..8a9b91601c 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/tabbox/AbstractTabBox.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/tabbox/AbstractTabBox.java
@@ -1,176 +1,176 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.tabbox;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-
-import org.eclipse.scout.commons.annotations.ConfigOperation;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.form.fields.AbstractCompositeField;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox;
-import org.eclipse.scout.rt.client.ui.form.fields.tabbox.internal.TabBoxGrid;
-import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
-import org.eclipse.scout.service.SERVICES;
-
-public abstract class AbstractTabBox extends AbstractCompositeField implements ITabBox {
-
- private ITabBoxUIFacade m_uiFacade;
- private TabBoxGrid m_grid;
-
- public AbstractTabBox() {
- this(true);
- }
-
- public AbstractTabBox(boolean callInitializer) {
- super(callInitializer);
- }
-
- /*
- * Configuration
- */
-
- @ConfigPropertyValue("true")
- @Override
- protected boolean getConfiguredGridUseUiHeight() {
- return true;
- }
-
- @Override
- @ConfigPropertyValue("FULL_WIDTH")
- protected int getConfiguredGridW() {
- return FULL_WIDTH;
- }
-
- @ConfigOperation
- @Order(70)
- protected void execTabSelected(IGroupBox selectedBox) throws ProcessingException {
- }
-
- @Override
- protected void initConfig() {
- m_uiFacade = new P_UIFacade();
- m_grid = new TabBoxGrid(this);
- super.initConfig();
- addPropertyChangeListener(PROP_SELECTED_TAB, new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent e) {
- // single observer exec
- try {
- execTabSelected(getSelectedTab());
- }
- catch (ProcessingException ex) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(ex);
- }
- catch (Throwable t) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Unexpected", t));
- }
- }
- });
- }
-
- /*
- * Runtime
- */
-
- @Override
- public void rebuildFieldGrid() {
- m_grid.validate();
- if (isInitialized()) {
- if (getForm() != null) {
- getForm().structureChanged(this);
- }
- }
- }
-
- // box is only visible when it has at least one visible item
- @Override
- protected void handleFieldVisibilityChanged() {
- super.handleFieldVisibilityChanged();
- if (isInitialized()) {
- rebuildFieldGrid();
- }
- IGroupBox selectedBox = getSelectedTab();
- if (selectedBox == null) {
- for (IGroupBox box : getGroupBoxes()) {
- if (box.isVisible()) {
- setSelectedTab(box);
- break;
- }
- }
- }
- else if (!selectedBox.isVisible()) {
- int index = getFieldIndex(selectedBox);
- IGroupBox[] boxes = getGroupBoxes();
- // next to right side
- for (int i = index + 1; i < getFieldCount(); i++) {
- if (boxes[i].isVisible()) {
- setSelectedTab(boxes[i]);
- break;
- }
- }
- if (getSelectedTab() == selectedBox) {
- // next to left side
- for (int i = index - 1; i >= 0; i--) {
- if (boxes[i].isVisible()) {
- setSelectedTab(boxes[i]);
- break;
- }
- }
- }
- }
- }
-
- @Override
- public final int getGridColumnCount() {
- return m_grid.getGridColumnCount();
- }
-
- @Override
- public final int getGridRowCount() {
- return m_grid.getGridRowCount();
- }
-
- @Override
- public IGroupBox[] getGroupBoxes() {
- IGroupBox[] a = new IGroupBox[getFieldCount()];
- if (a.length > 0) {
- System.arraycopy(getFields(), 0, a, 0, a.length);
- }
- return a;
- }
-
- @Override
- public void setSelectedTab(IGroupBox box) {
- if (box.getParentField() == this) {
- propertySupport.setProperty(PROP_SELECTED_TAB, box);
- }
- }
-
- @Override
- public IGroupBox getSelectedTab() {
- return (IGroupBox) propertySupport.getProperty(PROP_SELECTED_TAB);
- }
-
- @Override
- public ITabBoxUIFacade getUIFacade() {
- return m_uiFacade;
- }
-
- private class P_UIFacade implements ITabBoxUIFacade {
- @Override
- public void setSelectedTabFromUI(IGroupBox box) {
- setSelectedTab(box);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.tabbox;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import org.eclipse.scout.commons.annotations.ConfigOperation;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.form.fields.AbstractCompositeField;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox;
+import org.eclipse.scout.rt.client.ui.form.fields.tabbox.internal.TabBoxGrid;
+import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
+import org.eclipse.scout.service.SERVICES;
+
+public abstract class AbstractTabBox extends AbstractCompositeField implements ITabBox {
+
+ private ITabBoxUIFacade m_uiFacade;
+ private TabBoxGrid m_grid;
+
+ public AbstractTabBox() {
+ this(true);
+ }
+
+ public AbstractTabBox(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ /*
+ * Configuration
+ */
+
+ @ConfigPropertyValue("true")
+ @Override
+ protected boolean getConfiguredGridUseUiHeight() {
+ return true;
+ }
+
+ @Override
+ @ConfigPropertyValue("FULL_WIDTH")
+ protected int getConfiguredGridW() {
+ return FULL_WIDTH;
+ }
+
+ @ConfigOperation
+ @Order(70)
+ protected void execTabSelected(IGroupBox selectedBox) throws ProcessingException {
+ }
+
+ @Override
+ protected void initConfig() {
+ m_uiFacade = new P_UIFacade();
+ m_grid = new TabBoxGrid(this);
+ super.initConfig();
+ addPropertyChangeListener(PROP_SELECTED_TAB, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent e) {
+ // single observer exec
+ try {
+ execTabSelected(getSelectedTab());
+ }
+ catch (ProcessingException ex) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(ex);
+ }
+ catch (Throwable t) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Unexpected", t));
+ }
+ }
+ });
+ }
+
+ /*
+ * Runtime
+ */
+
+ @Override
+ public void rebuildFieldGrid() {
+ m_grid.validate();
+ if (isInitialized()) {
+ if (getForm() != null) {
+ getForm().structureChanged(this);
+ }
+ }
+ }
+
+ // box is only visible when it has at least one visible item
+ @Override
+ protected void handleFieldVisibilityChanged() {
+ super.handleFieldVisibilityChanged();
+ if (isInitialized()) {
+ rebuildFieldGrid();
+ }
+ IGroupBox selectedBox = getSelectedTab();
+ if (selectedBox == null) {
+ for (IGroupBox box : getGroupBoxes()) {
+ if (box.isVisible()) {
+ setSelectedTab(box);
+ break;
+ }
+ }
+ }
+ else if (!selectedBox.isVisible()) {
+ int index = getFieldIndex(selectedBox);
+ IGroupBox[] boxes = getGroupBoxes();
+ // next to right side
+ for (int i = index + 1; i < getFieldCount(); i++) {
+ if (boxes[i].isVisible()) {
+ setSelectedTab(boxes[i]);
+ break;
+ }
+ }
+ if (getSelectedTab() == selectedBox) {
+ // next to left side
+ for (int i = index - 1; i >= 0; i--) {
+ if (boxes[i].isVisible()) {
+ setSelectedTab(boxes[i]);
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ public final int getGridColumnCount() {
+ return m_grid.getGridColumnCount();
+ }
+
+ @Override
+ public final int getGridRowCount() {
+ return m_grid.getGridRowCount();
+ }
+
+ @Override
+ public IGroupBox[] getGroupBoxes() {
+ IGroupBox[] a = new IGroupBox[getFieldCount()];
+ if (a.length > 0) {
+ System.arraycopy(getFields(), 0, a, 0, a.length);
+ }
+ return a;
+ }
+
+ @Override
+ public void setSelectedTab(IGroupBox box) {
+ if (box.getParentField() == this) {
+ propertySupport.setProperty(PROP_SELECTED_TAB, box);
+ }
+ }
+
+ @Override
+ public IGroupBox getSelectedTab() {
+ return (IGroupBox) propertySupport.getProperty(PROP_SELECTED_TAB);
+ }
+
+ @Override
+ public ITabBoxUIFacade getUIFacade() {
+ return m_uiFacade;
+ }
+
+ private class P_UIFacade implements ITabBoxUIFacade {
+ @Override
+ public void setSelectedTabFromUI(IGroupBox box) {
+ setSelectedTab(box);
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/tabbox/ITabBox.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/tabbox/ITabBox.java
index ee3f0b2623..4ae00b3307 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/tabbox/ITabBox.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/tabbox/ITabBox.java
@@ -1,34 +1,34 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.tabbox;
-
-import org.eclipse.scout.rt.client.ui.form.fields.ICompositeField;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox;
-
-public interface ITabBox extends ICompositeField {
-
- /**
- * {@link IGroupBox}
- */
- String PROP_SELECTED_TAB = "selectedTab";
-
- /*
- * Runtime
- */
- IGroupBox[] getGroupBoxes();
-
- IGroupBox getSelectedTab();
-
- void setSelectedTab(IGroupBox box);
-
- ITabBoxUIFacade getUIFacade();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.tabbox;
+
+import org.eclipse.scout.rt.client.ui.form.fields.ICompositeField;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox;
+
+public interface ITabBox extends ICompositeField {
+
+ /**
+ * {@link IGroupBox}
+ */
+ String PROP_SELECTED_TAB = "selectedTab";
+
+ /*
+ * Runtime
+ */
+ IGroupBox[] getGroupBoxes();
+
+ IGroupBox getSelectedTab();
+
+ void setSelectedTab(IGroupBox box);
+
+ ITabBoxUIFacade getUIFacade();
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/tabbox/ITabBoxUIFacade.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/tabbox/ITabBoxUIFacade.java
index 8d12bc73f9..70f80153b6 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/tabbox/ITabBoxUIFacade.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/tabbox/ITabBoxUIFacade.java
@@ -1,17 +1,17 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.tabbox;
-
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox;
-
-public interface ITabBoxUIFacade {
- void setSelectedTabFromUI(IGroupBox box);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.tabbox;
+
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox;
+
+public interface ITabBoxUIFacade {
+ void setSelectedTabFromUI(IGroupBox box);
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/tabbox/internal/TabBoxGrid.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/tabbox/internal/TabBoxGrid.java
index 719331e29e..73c652c8b6 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/tabbox/internal/TabBoxGrid.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/tabbox/internal/TabBoxGrid.java
@@ -1,77 +1,77 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.tabbox.internal;
-
-import java.util.ArrayList;
-
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.form.fields.GridData;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.internal.GridDataBuilder;
-import org.eclipse.scout.rt.client.ui.form.fields.tabbox.ITabBox;
-
-/**
- * Grid (model) layout of tab box only visible process-buttons are used
- */
-public class TabBoxGrid {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(TabBoxGrid.class);
-
- private ITabBox m_tabBox = null;
- private IFormField[] m_fields;
- private int m_gridColumns;
- private int m_gridRows;
-
- public TabBoxGrid(ITabBox tabBox) {
- m_tabBox = tabBox;
- }
-
- public void validate() {
- // reset
- m_gridColumns = 0;
- m_gridRows = 0;
- ArrayList<IFormField> list = new ArrayList<IFormField>();
- // filter
- for (IFormField f : m_tabBox.getGroupBoxes()) {
- if (f.isVisible()) {
- list.add(f);
- }
- else {
- GridData data = GridDataBuilder.createFromHints(f, 1);
- f.setGridDataInternal(data);
- }
- }
- m_fields = list.toArray(new IFormField[list.size()]);
- layoutStatic();
- }
-
- private void layoutStatic() {
- for (int i = 0; i < m_fields.length; i++) {
- GridData data = GridDataBuilder.createFromHints(m_fields[i], 1);
- m_gridRows = Math.max(m_gridRows, data.h);
- m_gridColumns = Math.max(m_gridColumns, data.w);
- }
- for (int i = 0; i < m_fields.length; i++) {
- GridData data = GridDataBuilder.createFromHints(m_fields[i], m_gridColumns);
- data.x = 0;
- data.y = 0;
- m_fields[i].setGridDataInternal(data);
- }
- }
-
- public int getGridColumnCount() {
- return m_gridColumns;
- }
-
- public int getGridRowCount() {
- return m_gridRows;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.tabbox.internal;
+
+import java.util.ArrayList;
+
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.form.fields.GridData;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.internal.GridDataBuilder;
+import org.eclipse.scout.rt.client.ui.form.fields.tabbox.ITabBox;
+
+/**
+ * Grid (model) layout of tab box only visible process-buttons are used
+ */
+public class TabBoxGrid {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(TabBoxGrid.class);
+
+ private ITabBox m_tabBox = null;
+ private IFormField[] m_fields;
+ private int m_gridColumns;
+ private int m_gridRows;
+
+ public TabBoxGrid(ITabBox tabBox) {
+ m_tabBox = tabBox;
+ }
+
+ public void validate() {
+ // reset
+ m_gridColumns = 0;
+ m_gridRows = 0;
+ ArrayList<IFormField> list = new ArrayList<IFormField>();
+ // filter
+ for (IFormField f : m_tabBox.getGroupBoxes()) {
+ if (f.isVisible()) {
+ list.add(f);
+ }
+ else {
+ GridData data = GridDataBuilder.createFromHints(f, 1);
+ f.setGridDataInternal(data);
+ }
+ }
+ m_fields = list.toArray(new IFormField[list.size()]);
+ layoutStatic();
+ }
+
+ private void layoutStatic() {
+ for (int i = 0; i < m_fields.length; i++) {
+ GridData data = GridDataBuilder.createFromHints(m_fields[i], 1);
+ m_gridRows = Math.max(m_gridRows, data.h);
+ m_gridColumns = Math.max(m_gridColumns, data.w);
+ }
+ for (int i = 0; i < m_fields.length; i++) {
+ GridData data = GridDataBuilder.createFromHints(m_fields[i], m_gridColumns);
+ data.x = 0;
+ data.y = 0;
+ m_fields[i].setGridDataInternal(data);
+ }
+ }
+
+ public int getGridColumnCount() {
+ return m_gridColumns;
+ }
+
+ public int getGridRowCount() {
+ return m_gridRows;
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/tablefield/AbstractTableField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/tablefield/AbstractTableField.java
index 4eab055724..a8a1cf3d20 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/tablefield/AbstractTableField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/tablefield/AbstractTableField.java
@@ -1,737 +1,737 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.tablefield;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.io.Serializable;
-import java.text.NumberFormat;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.TreeSet;
-
-import org.eclipse.scout.commons.BooleanUtility;
-import org.eclipse.scout.commons.ConfigurationUtility;
-import org.eclipse.scout.commons.ListUtility;
-import org.eclipse.scout.commons.NumberUtility;
-import org.eclipse.scout.commons.TypeCastUtility;
-import org.eclipse.scout.commons.annotations.ConfigOperation;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.FormData;
-import org.eclipse.scout.commons.annotations.FormData.DefaultSubtypeSdkCommand;
-import org.eclipse.scout.commons.annotations.FormData.SdkCommand;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.IProcessingStatus;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.exception.ProcessingStatus;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.commons.xmlparser.SimpleXmlElement;
-import org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke;
-import org.eclipse.scout.rt.client.ui.action.keystroke.KeyStroke;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.basic.table.AbstractTable;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.client.ui.basic.table.TableAdapter;
-import org.eclipse.scout.rt.client.ui.basic.table.TableEvent;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IBigDecimalColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IDoubleColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IIntegerColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.ILongColumn;
-import org.eclipse.scout.rt.client.ui.form.fields.AbstractFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.IValidateContentDescriptor;
-import org.eclipse.scout.rt.client.ui.form.fields.ValidateFormFieldDescriptor;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.data.form.fields.AbstractFormFieldData;
-import org.eclipse.scout.rt.shared.data.form.fields.tablefield.AbstractTableFieldData;
-
-@FormData(value = AbstractTableFieldData.class, sdkCommand = SdkCommand.USE, defaultSubtypeSdkCommand = DefaultSubtypeSdkCommand.CREATE)
-public abstract class AbstractTableField<T extends ITable> extends AbstractFormField implements ITableField<T> {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractTableField.class);
-
- private T m_table;
- private boolean m_tableExternallyManaged;
- private P_ManagedTableListener m_managedTableListener;
- private P_TableStatusListener m_tableStatusListener;
-
- public AbstractTableField() {
- this(true);
- }
-
- public AbstractTableField(boolean callInitializer) {
- super(callInitializer);
- }
-
- /*
- * Configuration
- */
-
- /**
- * Called when the table data is reloaded, i.e. when {@link #reloadTableData()} is called.
- * <p>
- * Subclasses can override this method. The default does nothing.
- *
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(190)
- protected void execReloadTableData() throws ProcessingException {
- }
-
- /**
- * @return the visible row count, filtered row count, selected row count and the sum of all numeric columns
- * <p>
- * returns null if no table is contained within this table field
- */
- @Override
- public String createDefaultTableStatus() {
- StringBuilder statusText = new StringBuilder();
- ITable table = getTable();
- if (table != null) {
- int nTotal = table.getFilteredRowCount();
- if (nTotal == 1) {
- statusText.append(ScoutTexts.get("OneRow"));
- }
- else {
- statusText.append(ScoutTexts.get("XRows", NumberUtility.format(nTotal)));
- }
-
- int fTotal = table.getRowCount() - nTotal;
- if (fTotal == 1) {
- statusText.append(", " + ScoutTexts.get("OneFiltered"));
- }
- else if (fTotal > 1) {
- statusText.append(", " + ScoutTexts.get("XFiltered", NumberUtility.format(fTotal)));
- }
- int nSel = table.getSelectedRowCount();
- if (nSel == 1) {
- statusText.append(", " + ScoutTexts.get("OneSelected"));
- }
- else if (nSel > 1) {
- statusText.append(", " + ScoutTexts.get("XSelected", NumberUtility.format(nSel)));
- // show sums of numeric columns
- for (IColumn<?> c : table.getColumnSet().getVisibleColumns()) {
- NumberFormat fmt = null;
- Object sum = null;
- if (c instanceof IBigDecimalColumn) {
- fmt = ((IBigDecimalColumn) c).getNumberFormat();
- double d = NumberUtility.sum(TypeCastUtility.castValue(c.getSelectedValues(), double[].class));
- if (d != 0.0) {
- sum = d;
- }
- }
- else if (c instanceof IDoubleColumn) {
- fmt = ((IDoubleColumn) c).getNumberFormat();
- double d = NumberUtility.sum(TypeCastUtility.castValue(c.getSelectedValues(), double[].class));
- if (d != 0.0) {
- sum = d;
- }
- }
- else if (c instanceof ILongColumn) {
- fmt = ((ILongColumn) c).getNumberFormat();
- long d = NumberUtility.sum(TypeCastUtility.castValue(c.getSelectedValues(), long[].class));
- if (d != 0) {
- sum = d;
- }
- }
- else if (c instanceof IIntegerColumn) {
- fmt = ((IIntegerColumn) c).getNumberFormat();
- long d = NumberUtility.sum(TypeCastUtility.castValue(c.getSelectedValues(), long[].class));
- if (d != 0) {
- sum = d;
- }
- }
- //
- if (fmt != null && sum != null) {
- statusText.append(", " + c.getHeaderCell().getText() + ": " + fmt.format(sum));
- }
- }
- }
- }
- if (statusText.length() == 0) {
- return null;
- }
- return statusText.toString();
- }
-
- /**
- * Called when the table status is updated, i.e. when {@link #updateTableStatus()} is called due to a change in the
- * table (rows inserted, deleted, selected, ...).
- * <p>
- * Subclasses can override this method. The default calls {@link #createDefaultTableStatus()} and
- * {@link #setTableStatus(String)} if the table status is visible.
- *
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(195)
- protected void execUpdateTableStatus() {
- if (!isTableStatusVisible()) {
- return;
- }
- setTableStatus(createDefaultTableStatus());
- }
-
- /**
- * Called for batch processing when the table is saved. See {@link #doSave()} for the call order.
- * <p>
- * Subclasses can override this method. The default does nothing.
- *
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(200)
- protected void execSave(ITableRow[] insertedRows, ITableRow[] updatedRows, ITableRow[] deletedRows) {
- }
-
- /**
- * Called to handle deleted rows when the table is saved. See {@link #doSave()} for the call order.
- * <p>
- * Subclasses can override this method. The default does nothing.
- *
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(210)
- protected void execSaveDeletedRow(ITableRow row) throws ProcessingException {
- }
-
- /**
- * Called to handle inserted rows when the table is saved. See {@link #doSave()} for the call order.
- * <p>
- * Subclasses can override this method. The default does nothing.
- *
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(220)
- protected void execSaveInsertedRow(ITableRow row) throws ProcessingException {
- }
-
- /**
- * Called to handle updated rows when the table is saved. See {@link #doSave()} for the call order.
- * <p>
- * Subclasses can override this method. The default does nothing.
- *
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(230)
- protected void execSaveUpdatedRow(ITableRow row) throws ProcessingException {
- }
-
- @Override
- protected void execChangedMasterValue(Object newMasterValue) throws ProcessingException {
- reloadTableData();
- }
-
- /**
- * Configures the visibility of the table status.
- * <p>
- * Subclasses can override this method. Default is {@code false}.
- *
- * @return {@code true} if the table status is visible, {@code false} otherwise.
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(200)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredTableStatusVisible() {
- return false;
- }
-
- private Class<? extends ITable> getConfiguredTable() {
- Class<?>[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
- Class<? extends ITable>[] f = ConfigurationUtility.filterClasses(dca, ITable.class);
- if (f.length == 1) {
- return f[0];
- }
- else {
- for (Class<? extends ITable> c : f) {
- if (c.getDeclaringClass() != AbstractTableField.class) {
- return c;
- }
- }
- return null;
- }
- }
-
- @ConfigPropertyValue("1")
- @Override
- protected double getConfiguredGridWeightY() {
- return 1;
- }
-
- @Override
- @SuppressWarnings("unchecked")
- protected void initConfig() {
- super.initConfig();
- setTableStatusVisible(getConfiguredTableStatusVisible());
- if (getConfiguredTable() != null) {
- try {
- setTableInternal((T) ConfigurationUtility.newInnerInstance(this, getConfiguredTable()));
- }
- catch (Exception e) {
- LOG.warn(null, e);
- }
- }
- // local enabled listener
- addPropertyChangeListener(PROP_ENABLED, new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent e) {
- if (m_table != null) {
- m_table.setEnabled(isEnabled());
- }
- }
- });
- }
-
- /*
- * Runtime
- */
-
- @Override
- protected void initFieldInternal() throws ProcessingException {
- if (m_table != null && !m_tableExternallyManaged) {
- m_table.initTable();
- }
- super.initFieldInternal();
- }
-
- @Override
- protected void disposeFieldInternal() {
- super.disposeFieldInternal();
- if (m_table != null && !m_tableExternallyManaged) {
- m_table.disposeTable();
- }
- }
-
- @Override
- public final T getTable() {
- return m_table;
- }
-
- @Override
- public void setTable(T newTable, boolean externallyManaged) {
- m_tableExternallyManaged = externallyManaged;
- setTableInternal(newTable);
- }
-
- private void setTableInternal(T table) {
- if (m_table == table) {
- return;
- }
- if (m_table instanceof AbstractTable) {
- ((AbstractTable) m_table).setContainerInternal(null);
- }
- if (m_table != null) {
- if (!m_tableExternallyManaged) {
- if (m_managedTableListener != null) {
- m_table.removeTableListener(m_managedTableListener);
- m_managedTableListener = null;
- }
- }
- if (m_tableStatusListener != null) {
- m_table.removeTableListener(m_tableStatusListener);
- m_tableStatusListener = null;
- }
- }
- m_table = table;
- if (m_table instanceof AbstractTable) {
- ((AbstractTable) m_table).setContainerInternal(this);
- }
- if (m_table != null) {
- if (!m_tableExternallyManaged) {
- // ticket 84893
- // m_table.setAutoDiscardOnDelete(false);
- m_managedTableListener = new P_ManagedTableListener();
- m_table.addTableListener(m_managedTableListener);
- }
- m_tableStatusListener = new P_TableStatusListener();
- m_table.addTableListener(m_tableStatusListener);
- updateTableStatus();
- m_table.setEnabled(isEnabled());
- }
- boolean changed = propertySupport.setProperty(PROP_TABLE, m_table);
- if (changed) {
- if (getForm() != null) {
- getForm().structureChanged(this);
- }
- updateKeyStrokes();
- }
- }
-
- @Override
- public void exportFormFieldData(AbstractFormFieldData target) throws ProcessingException {
- AbstractTableFieldData tableFieldData = (AbstractTableFieldData) target;
- if (m_table != null) {
- m_table.extractTableData(tableFieldData);
- }
- }
-
- @Override
- public void importFormFieldData(AbstractFormFieldData source, boolean valueChangeTriggersEnabled) throws ProcessingException {
- AbstractTableFieldData tableFieldData = (AbstractTableFieldData) source;
- if (tableFieldData.isValueSet()) {
- if (m_table != null) {
- try {
- if (!valueChangeTriggersEnabled) {
- setValueChangeTriggerEnabled(false);
- }
- //
- m_table.updateTable(tableFieldData);
- if (m_table.isCheckable()
- && m_table.getCheckableColumn() != null) {
- for (ITableRow row : m_table.getRows()) {
- row.setChecked(BooleanUtility.nvl(m_table.getCheckableColumn().getValue(row)));
- }
- }
- }
- finally {
- if (!valueChangeTriggersEnabled) {
- setValueChangeTriggerEnabled(true);
- }
- }
- }
- }
- }
-
- @Override
- public void loadXML(SimpleXmlElement x) throws ProcessingException {
- super.loadXML(x);
- if (m_table != null) {
- int[] selectedRowIndices = null;
- try {
- selectedRowIndices = (int[]) x.getObjectAttribute("selectedRowIndices", null, getClass().getClassLoader());
- }
- catch (Exception e) {
- LOG.warn("reading attribute 'selectedRowIndices'", e);
- }
- Object[][] dataMatrix = null;
- try {
- dataMatrix = (Object[][]) x.getObjectAttribute("rows", null, getClass().getClassLoader());
- }
- catch (Exception e) {
- LOG.warn("reading attribute 'rows'", e);
- }
- m_table.discardAllRows();
- if (dataMatrix != null && dataMatrix.length > 0) {
- m_table.addRowsByMatrix(dataMatrix);
- }
- if (selectedRowIndices != null && selectedRowIndices.length > 0) {
- m_table.selectRows(m_table.getRows(selectedRowIndices));
- }
- }
- }
-
- @Override
- public void storeXML(SimpleXmlElement x) throws ProcessingException {
- super.storeXML(x);
- if (m_table != null) {
- ITableRow[] selectedRows = m_table.getSelectedRows();
- int[] selectedRowIndices = new int[selectedRows.length];
- for (int i = 0; i < selectedRowIndices.length; i++) {
- selectedRowIndices[i] = selectedRows[i].getRowIndex();
- }
- try {
- x.setObjectAttribute("selectedRowIndices", selectedRowIndices);
- }
- catch (Exception e) {
- LOG.warn("writing attribute 'selectedRowIndices'", e);
- }
- Object[][] dataMatrix = m_table.getTableData();
- for (int r = 0; r < dataMatrix.length; r++) {
- for (int c = 0; c < dataMatrix[r].length; c++) {
- Object o = dataMatrix[r][c];
- if (o != null && !(o instanceof Serializable)) {
- LOG.warn("ignoring not serializable value at row=" + r + ", col=" + c + ": " + o + "[" + o.getClass() + "]");
- dataMatrix[r][c] = null;
- }
- }
- }
- try {
- x.setObjectAttribute("rows", dataMatrix);
- }
- catch (Exception e) {
- LOG.warn("writing attribute 'rows'", e);
- }
- }
- }
-
- @Override
- protected boolean execIsSaveNeeded() throws ProcessingException {
- boolean b = false;
- if (m_table != null && !m_tableExternallyManaged) {
- if (b == false && m_table.getDeletedRowCount() > 0) {
- b = true;
- }
- if (b == false && m_table.getInsertedRowCount() > 0) {
- b = true;
- }
- if (b == false && m_table.getUpdatedRowCount() > 0) {
- b = true;
- }
- }
- return b;
- }
-
- @Override
- protected void execMarkSaved() throws ProcessingException {
- super.execMarkSaved();
- if (m_table != null && !m_tableExternallyManaged) {
- try {
- m_table.setTableChanging(true);
- //
- for (int i = 0; i < m_table.getRowCount(); i++) {
- ITableRow row = m_table.getRow(i);
- if (!row.isStatusNonchanged()) {
- row.setStatusNonchanged();
- }
- }
- m_table.discardAllDeletedRows();
- }
- finally {
- m_table.setTableChanging(false);
- }
- }
- }
-
- @Override
- protected boolean execIsEmpty() throws ProcessingException {
- if (m_table != null) {
- return m_table.getRowCount() == 0;
- }
- else {
- return true;
- }
- }
-
- @Override
- public IValidateContentDescriptor validateContent() {
- IValidateContentDescriptor desc = super.validateContent();
- //super check
- if (desc != null) {
- return desc;
- }
- //check mandatory
- ITable table = getTable();
- if (isMandatory()) {
- if (table == null || table.getRowCount() < 1) {
- return new ValidateFormFieldDescriptor(this);
- }
- }
- //make editable columns visible if check fails
- HashSet<IColumn<?>> invisbleColumnsWithErrors = new HashSet<IColumn<?>>();
- //check editable cells
- ValidateTableFieldDescriptor tableDesc = null;
- TreeSet<String> columnNames = new TreeSet<String>();
- if (table != null) {
- for (ITableRow row : table.getRows()) {
- for (IColumn col : table.getColumns()) {
- if (col.isCellEditable(row)) {
- try {
- IFormField editor = col.prepareEdit(row);
- if (editor != null) {
- boolean editorValid = editor.isContentValid();
- if (!editorValid) {
- if (col.isDisplayable() && !col.isVisible()) {
- //column should become visible
- invisbleColumnsWithErrors.add(col);
- }
- if (tableDesc == null) {
- tableDesc = new ValidateTableFieldDescriptor(this, row, col);
- }
- columnNames.add(col.getHeaderCell().getText());
- }
- }
- }
- catch (Throwable t) {
- LOG.error("validating " + getClass().getSimpleName() + " for row " + row.getRowIndex() + " for column " + col.getClass().getSimpleName(), t);
- }
- }
- }
- }
- }
- //make invalid invisible columns visible again
- for (IColumn col : invisbleColumnsWithErrors) {
- col.setVisible(true);
- }
- if (tableDesc == null) {
- return null;
- }
- tableDesc.setDisplayText(ScoutTexts.get("TableName") + " " + getLabel() + ": " + ListUtility.format(columnNames));
- return tableDesc;
- }
-
- @Override
- public String getTableStatus() {
- IProcessingStatus status = getTableSelectionStatus();
- return status != null ? status.getMessage() : null;
- }
-
- @Override
- public void setTableStatus(String status) {
- setTableSelectionStatus(status != null ? new ProcessingStatus(status, ProcessingStatus.INFO) : null);
- }
-
- @Override
- public IProcessingStatus getTableSelectionStatus() {
- return (IProcessingStatus) propertySupport.getProperty(PROP_TABLE_SELECTION_STATUS);
- }
-
- @Override
- public void setTableSelectionStatus(IProcessingStatus status) {
- propertySupport.setProperty(PROP_TABLE_SELECTION_STATUS, status);
- }
-
- @Override
- public IProcessingStatus getTablePopulateStatus() {
- return (IProcessingStatus) propertySupport.getProperty(PROP_TABLE_POPULATE_STATUS);
- }
-
- @Override
- public void setTablePopulateStatus(IProcessingStatus status) {
- propertySupport.setProperty(PROP_TABLE_POPULATE_STATUS, status);
- }
-
- @Override
- public boolean isTableStatusVisible() {
- return propertySupport.getPropertyBool(PROP_TABLE_STATUS_VISIBLE);
- }
-
- @Override
- public void setTableStatusVisible(boolean b) {
- propertySupport.setPropertyBool(PROP_TABLE_STATUS_VISIBLE, b);
- if (b) {
- updateTableStatus();
- }
- }
-
- @Override
- public void updateTableStatus() {
- try {
- execUpdateTableStatus();
- }
- catch (Throwable t) {
- LOG.warn("Updating status of " + AbstractTableField.this.getClass().getName(), t);
- }
- }
-
- /**
- * Saves the table. The call order is as follows:
- * <ol>
- * <li>{@link #execSave(ITableRow[], ITableRow[], ITableRow[])}</li>
- * <li>{@link #execSaveDeletedRow(ITableRow)}</li>
- * <li>{@link #execSaveInsertedRow(ITableRow)}</li>
- * <li>{@link #execSaveUpdatedRow(ITableRow)}</li>
- * </ol>
- */
- @Override
- public void doSave() throws ProcessingException {
- if (m_table != null && !m_tableExternallyManaged) {
- try {
- m_table.setTableChanging(true);
- //
- // 1. batch
- execSave(m_table.getInsertedRows(), m_table.getUpdatedRows(), m_table.getDeletedRows());
- // 2. per row
- ITableRow[] insertedRows = m_table.getInsertedRows();
- ITableRow[] updatedRows = m_table.getUpdatedRows();
- ITableRow[] deletedRows = m_table.getDeletedRows();
- // deleted rows
- for (int i = 0; i < deletedRows.length; i++) {
- execSaveDeletedRow(deletedRows[i]);
- }
- // inserted rows
- for (int i = 0; i < insertedRows.length; i++) {
- ITableRow mr = insertedRows[i];
- execSaveInsertedRow(mr);
- mr.setStatusNonchanged();
- m_table.updateRow(mr);
- }
- // updated rows
- for (int i = 0; i < updatedRows.length; i++) {
- ITableRow mr = updatedRows[i];
- execSaveUpdatedRow(mr);
- mr.setStatusNonchanged();
- m_table.updateRow(mr);
- }
- }
- finally {
- m_table.setTableChanging(false);
- }
- }
- markSaved();
- }
-
- /**
- * Reloads the table data.
- * <p>
- * The default implementation calls {@link #execReloadTableData()}.
- */
- @Override
- public void reloadTableData() throws ProcessingException {
- execReloadTableData();
- }
-
- @Override
- public IKeyStroke[] getContributedKeyStrokes() {
- HashMap<String, IKeyStroke> ksMap = new HashMap<String, IKeyStroke>();
- if (getTable() != null) {
- for (IMenu m : getTable().getMenus()) {
- String s = m.getKeyStroke();
- if (s != null && s.trim().length() > 0) {
- KeyStroke ks = new KeyStroke(s, m);
- ksMap.put(ks.getKeyStroke().toUpperCase(), ks);
- }
- }
- }
- return ksMap.values().toArray(new IKeyStroke[ksMap.size()]);
- }
-
- private class P_ManagedTableListener extends TableAdapter {
- @Override
- public void tableChanged(TableEvent e) {
- switch (e.getType()) {
- case TableEvent.TYPE_ALL_ROWS_DELETED:
- case TableEvent.TYPE_ROWS_DELETED:
- case TableEvent.TYPE_ROWS_INSERTED:
- case TableEvent.TYPE_ROWS_UPDATED:
- case TableEvent.TYPE_COLUMN_STRUCTURE_CHANGED: {
- checkSaveNeeded();
- checkEmpty();
- break;
- }
- }
- }
- }
-
- private class P_TableStatusListener extends TableAdapter {
- @Override
- public void tableChanged(TableEvent e) {
- switch (e.getType()) {
- case TableEvent.TYPE_ROWS_INSERTED:
- case TableEvent.TYPE_ROWS_UPDATED:
- case TableEvent.TYPE_ROWS_DELETED:
- case TableEvent.TYPE_ROWS_SELECTED:
- case TableEvent.TYPE_ALL_ROWS_DELETED:
- case TableEvent.TYPE_ROW_FILTER_CHANGED:
- case TableEvent.TYPE_TABLE_POPULATED: {
- updateTableStatus();
- break;
- }
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.tablefield;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.io.Serializable;
+import java.text.NumberFormat;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.TreeSet;
+
+import org.eclipse.scout.commons.BooleanUtility;
+import org.eclipse.scout.commons.ConfigurationUtility;
+import org.eclipse.scout.commons.ListUtility;
+import org.eclipse.scout.commons.NumberUtility;
+import org.eclipse.scout.commons.TypeCastUtility;
+import org.eclipse.scout.commons.annotations.ConfigOperation;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.FormData;
+import org.eclipse.scout.commons.annotations.FormData.DefaultSubtypeSdkCommand;
+import org.eclipse.scout.commons.annotations.FormData.SdkCommand;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.IProcessingStatus;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.exception.ProcessingStatus;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.commons.xmlparser.SimpleXmlElement;
+import org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke;
+import org.eclipse.scout.rt.client.ui.action.keystroke.KeyStroke;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.basic.table.AbstractTable;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.client.ui.basic.table.TableAdapter;
+import org.eclipse.scout.rt.client.ui.basic.table.TableEvent;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IBigDecimalColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IDoubleColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IIntegerColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.ILongColumn;
+import org.eclipse.scout.rt.client.ui.form.fields.AbstractFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.IValidateContentDescriptor;
+import org.eclipse.scout.rt.client.ui.form.fields.ValidateFormFieldDescriptor;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.data.form.fields.AbstractFormFieldData;
+import org.eclipse.scout.rt.shared.data.form.fields.tablefield.AbstractTableFieldData;
+
+@FormData(value = AbstractTableFieldData.class, sdkCommand = SdkCommand.USE, defaultSubtypeSdkCommand = DefaultSubtypeSdkCommand.CREATE)
+public abstract class AbstractTableField<T extends ITable> extends AbstractFormField implements ITableField<T> {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractTableField.class);
+
+ private T m_table;
+ private boolean m_tableExternallyManaged;
+ private P_ManagedTableListener m_managedTableListener;
+ private P_TableStatusListener m_tableStatusListener;
+
+ public AbstractTableField() {
+ this(true);
+ }
+
+ public AbstractTableField(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ /*
+ * Configuration
+ */
+
+ /**
+ * Called when the table data is reloaded, i.e. when {@link #reloadTableData()} is called.
+ * <p>
+ * Subclasses can override this method. The default does nothing.
+ *
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(190)
+ protected void execReloadTableData() throws ProcessingException {
+ }
+
+ /**
+ * @return the visible row count, filtered row count, selected row count and the sum of all numeric columns
+ * <p>
+ * returns null if no table is contained within this table field
+ */
+ @Override
+ public String createDefaultTableStatus() {
+ StringBuilder statusText = new StringBuilder();
+ ITable table = getTable();
+ if (table != null) {
+ int nTotal = table.getFilteredRowCount();
+ if (nTotal == 1) {
+ statusText.append(ScoutTexts.get("OneRow"));
+ }
+ else {
+ statusText.append(ScoutTexts.get("XRows", NumberUtility.format(nTotal)));
+ }
+
+ int fTotal = table.getRowCount() - nTotal;
+ if (fTotal == 1) {
+ statusText.append(", " + ScoutTexts.get("OneFiltered"));
+ }
+ else if (fTotal > 1) {
+ statusText.append(", " + ScoutTexts.get("XFiltered", NumberUtility.format(fTotal)));
+ }
+ int nSel = table.getSelectedRowCount();
+ if (nSel == 1) {
+ statusText.append(", " + ScoutTexts.get("OneSelected"));
+ }
+ else if (nSel > 1) {
+ statusText.append(", " + ScoutTexts.get("XSelected", NumberUtility.format(nSel)));
+ // show sums of numeric columns
+ for (IColumn<?> c : table.getColumnSet().getVisibleColumns()) {
+ NumberFormat fmt = null;
+ Object sum = null;
+ if (c instanceof IBigDecimalColumn) {
+ fmt = ((IBigDecimalColumn) c).getNumberFormat();
+ double d = NumberUtility.sum(TypeCastUtility.castValue(c.getSelectedValues(), double[].class));
+ if (d != 0.0) {
+ sum = d;
+ }
+ }
+ else if (c instanceof IDoubleColumn) {
+ fmt = ((IDoubleColumn) c).getNumberFormat();
+ double d = NumberUtility.sum(TypeCastUtility.castValue(c.getSelectedValues(), double[].class));
+ if (d != 0.0) {
+ sum = d;
+ }
+ }
+ else if (c instanceof ILongColumn) {
+ fmt = ((ILongColumn) c).getNumberFormat();
+ long d = NumberUtility.sum(TypeCastUtility.castValue(c.getSelectedValues(), long[].class));
+ if (d != 0) {
+ sum = d;
+ }
+ }
+ else if (c instanceof IIntegerColumn) {
+ fmt = ((IIntegerColumn) c).getNumberFormat();
+ long d = NumberUtility.sum(TypeCastUtility.castValue(c.getSelectedValues(), long[].class));
+ if (d != 0) {
+ sum = d;
+ }
+ }
+ //
+ if (fmt != null && sum != null) {
+ statusText.append(", " + c.getHeaderCell().getText() + ": " + fmt.format(sum));
+ }
+ }
+ }
+ }
+ if (statusText.length() == 0) {
+ return null;
+ }
+ return statusText.toString();
+ }
+
+ /**
+ * Called when the table status is updated, i.e. when {@link #updateTableStatus()} is called due to a change in the
+ * table (rows inserted, deleted, selected, ...).
+ * <p>
+ * Subclasses can override this method. The default calls {@link #createDefaultTableStatus()} and
+ * {@link #setTableStatus(String)} if the table status is visible.
+ *
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(195)
+ protected void execUpdateTableStatus() {
+ if (!isTableStatusVisible()) {
+ return;
+ }
+ setTableStatus(createDefaultTableStatus());
+ }
+
+ /**
+ * Called for batch processing when the table is saved. See {@link #doSave()} for the call order.
+ * <p>
+ * Subclasses can override this method. The default does nothing.
+ *
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(200)
+ protected void execSave(ITableRow[] insertedRows, ITableRow[] updatedRows, ITableRow[] deletedRows) {
+ }
+
+ /**
+ * Called to handle deleted rows when the table is saved. See {@link #doSave()} for the call order.
+ * <p>
+ * Subclasses can override this method. The default does nothing.
+ *
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(210)
+ protected void execSaveDeletedRow(ITableRow row) throws ProcessingException {
+ }
+
+ /**
+ * Called to handle inserted rows when the table is saved. See {@link #doSave()} for the call order.
+ * <p>
+ * Subclasses can override this method. The default does nothing.
+ *
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(220)
+ protected void execSaveInsertedRow(ITableRow row) throws ProcessingException {
+ }
+
+ /**
+ * Called to handle updated rows when the table is saved. See {@link #doSave()} for the call order.
+ * <p>
+ * Subclasses can override this method. The default does nothing.
+ *
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(230)
+ protected void execSaveUpdatedRow(ITableRow row) throws ProcessingException {
+ }
+
+ @Override
+ protected void execChangedMasterValue(Object newMasterValue) throws ProcessingException {
+ reloadTableData();
+ }
+
+ /**
+ * Configures the visibility of the table status.
+ * <p>
+ * Subclasses can override this method. Default is {@code false}.
+ *
+ * @return {@code true} if the table status is visible, {@code false} otherwise.
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(200)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredTableStatusVisible() {
+ return false;
+ }
+
+ private Class<? extends ITable> getConfiguredTable() {
+ Class<?>[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
+ Class<? extends ITable>[] f = ConfigurationUtility.filterClasses(dca, ITable.class);
+ if (f.length == 1) {
+ return f[0];
+ }
+ else {
+ for (Class<? extends ITable> c : f) {
+ if (c.getDeclaringClass() != AbstractTableField.class) {
+ return c;
+ }
+ }
+ return null;
+ }
+ }
+
+ @ConfigPropertyValue("1")
+ @Override
+ protected double getConfiguredGridWeightY() {
+ return 1;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ protected void initConfig() {
+ super.initConfig();
+ setTableStatusVisible(getConfiguredTableStatusVisible());
+ if (getConfiguredTable() != null) {
+ try {
+ setTableInternal((T) ConfigurationUtility.newInnerInstance(this, getConfiguredTable()));
+ }
+ catch (Exception e) {
+ LOG.warn(null, e);
+ }
+ }
+ // local enabled listener
+ addPropertyChangeListener(PROP_ENABLED, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent e) {
+ if (m_table != null) {
+ m_table.setEnabled(isEnabled());
+ }
+ }
+ });
+ }
+
+ /*
+ * Runtime
+ */
+
+ @Override
+ protected void initFieldInternal() throws ProcessingException {
+ if (m_table != null && !m_tableExternallyManaged) {
+ m_table.initTable();
+ }
+ super.initFieldInternal();
+ }
+
+ @Override
+ protected void disposeFieldInternal() {
+ super.disposeFieldInternal();
+ if (m_table != null && !m_tableExternallyManaged) {
+ m_table.disposeTable();
+ }
+ }
+
+ @Override
+ public final T getTable() {
+ return m_table;
+ }
+
+ @Override
+ public void setTable(T newTable, boolean externallyManaged) {
+ m_tableExternallyManaged = externallyManaged;
+ setTableInternal(newTable);
+ }
+
+ private void setTableInternal(T table) {
+ if (m_table == table) {
+ return;
+ }
+ if (m_table instanceof AbstractTable) {
+ ((AbstractTable) m_table).setContainerInternal(null);
+ }
+ if (m_table != null) {
+ if (!m_tableExternallyManaged) {
+ if (m_managedTableListener != null) {
+ m_table.removeTableListener(m_managedTableListener);
+ m_managedTableListener = null;
+ }
+ }
+ if (m_tableStatusListener != null) {
+ m_table.removeTableListener(m_tableStatusListener);
+ m_tableStatusListener = null;
+ }
+ }
+ m_table = table;
+ if (m_table instanceof AbstractTable) {
+ ((AbstractTable) m_table).setContainerInternal(this);
+ }
+ if (m_table != null) {
+ if (!m_tableExternallyManaged) {
+ // ticket 84893
+ // m_table.setAutoDiscardOnDelete(false);
+ m_managedTableListener = new P_ManagedTableListener();
+ m_table.addTableListener(m_managedTableListener);
+ }
+ m_tableStatusListener = new P_TableStatusListener();
+ m_table.addTableListener(m_tableStatusListener);
+ updateTableStatus();
+ m_table.setEnabled(isEnabled());
+ }
+ boolean changed = propertySupport.setProperty(PROP_TABLE, m_table);
+ if (changed) {
+ if (getForm() != null) {
+ getForm().structureChanged(this);
+ }
+ updateKeyStrokes();
+ }
+ }
+
+ @Override
+ public void exportFormFieldData(AbstractFormFieldData target) throws ProcessingException {
+ AbstractTableFieldData tableFieldData = (AbstractTableFieldData) target;
+ if (m_table != null) {
+ m_table.extractTableData(tableFieldData);
+ }
+ }
+
+ @Override
+ public void importFormFieldData(AbstractFormFieldData source, boolean valueChangeTriggersEnabled) throws ProcessingException {
+ AbstractTableFieldData tableFieldData = (AbstractTableFieldData) source;
+ if (tableFieldData.isValueSet()) {
+ if (m_table != null) {
+ try {
+ if (!valueChangeTriggersEnabled) {
+ setValueChangeTriggerEnabled(false);
+ }
+ //
+ m_table.updateTable(tableFieldData);
+ if (m_table.isCheckable()
+ && m_table.getCheckableColumn() != null) {
+ for (ITableRow row : m_table.getRows()) {
+ row.setChecked(BooleanUtility.nvl(m_table.getCheckableColumn().getValue(row)));
+ }
+ }
+ }
+ finally {
+ if (!valueChangeTriggersEnabled) {
+ setValueChangeTriggerEnabled(true);
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ public void loadXML(SimpleXmlElement x) throws ProcessingException {
+ super.loadXML(x);
+ if (m_table != null) {
+ int[] selectedRowIndices = null;
+ try {
+ selectedRowIndices = (int[]) x.getObjectAttribute("selectedRowIndices", null, getClass().getClassLoader());
+ }
+ catch (Exception e) {
+ LOG.warn("reading attribute 'selectedRowIndices'", e);
+ }
+ Object[][] dataMatrix = null;
+ try {
+ dataMatrix = (Object[][]) x.getObjectAttribute("rows", null, getClass().getClassLoader());
+ }
+ catch (Exception e) {
+ LOG.warn("reading attribute 'rows'", e);
+ }
+ m_table.discardAllRows();
+ if (dataMatrix != null && dataMatrix.length > 0) {
+ m_table.addRowsByMatrix(dataMatrix);
+ }
+ if (selectedRowIndices != null && selectedRowIndices.length > 0) {
+ m_table.selectRows(m_table.getRows(selectedRowIndices));
+ }
+ }
+ }
+
+ @Override
+ public void storeXML(SimpleXmlElement x) throws ProcessingException {
+ super.storeXML(x);
+ if (m_table != null) {
+ ITableRow[] selectedRows = m_table.getSelectedRows();
+ int[] selectedRowIndices = new int[selectedRows.length];
+ for (int i = 0; i < selectedRowIndices.length; i++) {
+ selectedRowIndices[i] = selectedRows[i].getRowIndex();
+ }
+ try {
+ x.setObjectAttribute("selectedRowIndices", selectedRowIndices);
+ }
+ catch (Exception e) {
+ LOG.warn("writing attribute 'selectedRowIndices'", e);
+ }
+ Object[][] dataMatrix = m_table.getTableData();
+ for (int r = 0; r < dataMatrix.length; r++) {
+ for (int c = 0; c < dataMatrix[r].length; c++) {
+ Object o = dataMatrix[r][c];
+ if (o != null && !(o instanceof Serializable)) {
+ LOG.warn("ignoring not serializable value at row=" + r + ", col=" + c + ": " + o + "[" + o.getClass() + "]");
+ dataMatrix[r][c] = null;
+ }
+ }
+ }
+ try {
+ x.setObjectAttribute("rows", dataMatrix);
+ }
+ catch (Exception e) {
+ LOG.warn("writing attribute 'rows'", e);
+ }
+ }
+ }
+
+ @Override
+ protected boolean execIsSaveNeeded() throws ProcessingException {
+ boolean b = false;
+ if (m_table != null && !m_tableExternallyManaged) {
+ if (b == false && m_table.getDeletedRowCount() > 0) {
+ b = true;
+ }
+ if (b == false && m_table.getInsertedRowCount() > 0) {
+ b = true;
+ }
+ if (b == false && m_table.getUpdatedRowCount() > 0) {
+ b = true;
+ }
+ }
+ return b;
+ }
+
+ @Override
+ protected void execMarkSaved() throws ProcessingException {
+ super.execMarkSaved();
+ if (m_table != null && !m_tableExternallyManaged) {
+ try {
+ m_table.setTableChanging(true);
+ //
+ for (int i = 0; i < m_table.getRowCount(); i++) {
+ ITableRow row = m_table.getRow(i);
+ if (!row.isStatusNonchanged()) {
+ row.setStatusNonchanged();
+ }
+ }
+ m_table.discardAllDeletedRows();
+ }
+ finally {
+ m_table.setTableChanging(false);
+ }
+ }
+ }
+
+ @Override
+ protected boolean execIsEmpty() throws ProcessingException {
+ if (m_table != null) {
+ return m_table.getRowCount() == 0;
+ }
+ else {
+ return true;
+ }
+ }
+
+ @Override
+ public IValidateContentDescriptor validateContent() {
+ IValidateContentDescriptor desc = super.validateContent();
+ //super check
+ if (desc != null) {
+ return desc;
+ }
+ //check mandatory
+ ITable table = getTable();
+ if (isMandatory()) {
+ if (table == null || table.getRowCount() < 1) {
+ return new ValidateFormFieldDescriptor(this);
+ }
+ }
+ //make editable columns visible if check fails
+ HashSet<IColumn<?>> invisbleColumnsWithErrors = new HashSet<IColumn<?>>();
+ //check editable cells
+ ValidateTableFieldDescriptor tableDesc = null;
+ TreeSet<String> columnNames = new TreeSet<String>();
+ if (table != null) {
+ for (ITableRow row : table.getRows()) {
+ for (IColumn col : table.getColumns()) {
+ if (col.isCellEditable(row)) {
+ try {
+ IFormField editor = col.prepareEdit(row);
+ if (editor != null) {
+ boolean editorValid = editor.isContentValid();
+ if (!editorValid) {
+ if (col.isDisplayable() && !col.isVisible()) {
+ //column should become visible
+ invisbleColumnsWithErrors.add(col);
+ }
+ if (tableDesc == null) {
+ tableDesc = new ValidateTableFieldDescriptor(this, row, col);
+ }
+ columnNames.add(col.getHeaderCell().getText());
+ }
+ }
+ }
+ catch (Throwable t) {
+ LOG.error("validating " + getClass().getSimpleName() + " for row " + row.getRowIndex() + " for column " + col.getClass().getSimpleName(), t);
+ }
+ }
+ }
+ }
+ }
+ //make invalid invisible columns visible again
+ for (IColumn col : invisbleColumnsWithErrors) {
+ col.setVisible(true);
+ }
+ if (tableDesc == null) {
+ return null;
+ }
+ tableDesc.setDisplayText(ScoutTexts.get("TableName") + " " + getLabel() + ": " + ListUtility.format(columnNames));
+ return tableDesc;
+ }
+
+ @Override
+ public String getTableStatus() {
+ IProcessingStatus status = getTableSelectionStatus();
+ return status != null ? status.getMessage() : null;
+ }
+
+ @Override
+ public void setTableStatus(String status) {
+ setTableSelectionStatus(status != null ? new ProcessingStatus(status, ProcessingStatus.INFO) : null);
+ }
+
+ @Override
+ public IProcessingStatus getTableSelectionStatus() {
+ return (IProcessingStatus) propertySupport.getProperty(PROP_TABLE_SELECTION_STATUS);
+ }
+
+ @Override
+ public void setTableSelectionStatus(IProcessingStatus status) {
+ propertySupport.setProperty(PROP_TABLE_SELECTION_STATUS, status);
+ }
+
+ @Override
+ public IProcessingStatus getTablePopulateStatus() {
+ return (IProcessingStatus) propertySupport.getProperty(PROP_TABLE_POPULATE_STATUS);
+ }
+
+ @Override
+ public void setTablePopulateStatus(IProcessingStatus status) {
+ propertySupport.setProperty(PROP_TABLE_POPULATE_STATUS, status);
+ }
+
+ @Override
+ public boolean isTableStatusVisible() {
+ return propertySupport.getPropertyBool(PROP_TABLE_STATUS_VISIBLE);
+ }
+
+ @Override
+ public void setTableStatusVisible(boolean b) {
+ propertySupport.setPropertyBool(PROP_TABLE_STATUS_VISIBLE, b);
+ if (b) {
+ updateTableStatus();
+ }
+ }
+
+ @Override
+ public void updateTableStatus() {
+ try {
+ execUpdateTableStatus();
+ }
+ catch (Throwable t) {
+ LOG.warn("Updating status of " + AbstractTableField.this.getClass().getName(), t);
+ }
+ }
+
+ /**
+ * Saves the table. The call order is as follows:
+ * <ol>
+ * <li>{@link #execSave(ITableRow[], ITableRow[], ITableRow[])}</li>
+ * <li>{@link #execSaveDeletedRow(ITableRow)}</li>
+ * <li>{@link #execSaveInsertedRow(ITableRow)}</li>
+ * <li>{@link #execSaveUpdatedRow(ITableRow)}</li>
+ * </ol>
+ */
+ @Override
+ public void doSave() throws ProcessingException {
+ if (m_table != null && !m_tableExternallyManaged) {
+ try {
+ m_table.setTableChanging(true);
+ //
+ // 1. batch
+ execSave(m_table.getInsertedRows(), m_table.getUpdatedRows(), m_table.getDeletedRows());
+ // 2. per row
+ ITableRow[] insertedRows = m_table.getInsertedRows();
+ ITableRow[] updatedRows = m_table.getUpdatedRows();
+ ITableRow[] deletedRows = m_table.getDeletedRows();
+ // deleted rows
+ for (int i = 0; i < deletedRows.length; i++) {
+ execSaveDeletedRow(deletedRows[i]);
+ }
+ // inserted rows
+ for (int i = 0; i < insertedRows.length; i++) {
+ ITableRow mr = insertedRows[i];
+ execSaveInsertedRow(mr);
+ mr.setStatusNonchanged();
+ m_table.updateRow(mr);
+ }
+ // updated rows
+ for (int i = 0; i < updatedRows.length; i++) {
+ ITableRow mr = updatedRows[i];
+ execSaveUpdatedRow(mr);
+ mr.setStatusNonchanged();
+ m_table.updateRow(mr);
+ }
+ }
+ finally {
+ m_table.setTableChanging(false);
+ }
+ }
+ markSaved();
+ }
+
+ /**
+ * Reloads the table data.
+ * <p>
+ * The default implementation calls {@link #execReloadTableData()}.
+ */
+ @Override
+ public void reloadTableData() throws ProcessingException {
+ execReloadTableData();
+ }
+
+ @Override
+ public IKeyStroke[] getContributedKeyStrokes() {
+ HashMap<String, IKeyStroke> ksMap = new HashMap<String, IKeyStroke>();
+ if (getTable() != null) {
+ for (IMenu m : getTable().getMenus()) {
+ String s = m.getKeyStroke();
+ if (s != null && s.trim().length() > 0) {
+ KeyStroke ks = new KeyStroke(s, m);
+ ksMap.put(ks.getKeyStroke().toUpperCase(), ks);
+ }
+ }
+ }
+ return ksMap.values().toArray(new IKeyStroke[ksMap.size()]);
+ }
+
+ private class P_ManagedTableListener extends TableAdapter {
+ @Override
+ public void tableChanged(TableEvent e) {
+ switch (e.getType()) {
+ case TableEvent.TYPE_ALL_ROWS_DELETED:
+ case TableEvent.TYPE_ROWS_DELETED:
+ case TableEvent.TYPE_ROWS_INSERTED:
+ case TableEvent.TYPE_ROWS_UPDATED:
+ case TableEvent.TYPE_COLUMN_STRUCTURE_CHANGED: {
+ checkSaveNeeded();
+ checkEmpty();
+ break;
+ }
+ }
+ }
+ }
+
+ private class P_TableStatusListener extends TableAdapter {
+ @Override
+ public void tableChanged(TableEvent e) {
+ switch (e.getType()) {
+ case TableEvent.TYPE_ROWS_INSERTED:
+ case TableEvent.TYPE_ROWS_UPDATED:
+ case TableEvent.TYPE_ROWS_DELETED:
+ case TableEvent.TYPE_ROWS_SELECTED:
+ case TableEvent.TYPE_ALL_ROWS_DELETED:
+ case TableEvent.TYPE_ROW_FILTER_CHANGED:
+ case TableEvent.TYPE_TABLE_POPULATED: {
+ updateTableStatus();
+ break;
+ }
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/tablefield/ITableField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/tablefield/ITableField.java
index bc35cd8029..d61bec6c48 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/tablefield/ITableField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/tablefield/ITableField.java
@@ -1,131 +1,131 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.tablefield;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.scout.commons.exception.IProcessingStatus;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-
-public interface ITableField<T extends ITable> extends IFormField {
-
- /**
- * {@link ITable}
- */
- String PROP_TABLE = "table";
- /**
- * {@link String}
- *
- * @deprecated use {@value #PROP_TABLE_SELECTION_STATUS}
- */
- @Deprecated
- String PROP_TABLE_STATUS = "tableStatus";
- /**
- * {@link IProcessingStatus}
- */
- String PROP_TABLE_SELECTION_STATUS = "tableSelectionStatus";
- /**
- * {@link IProcessingStatus}
- */
- String PROP_TABLE_POPULATE_STATUS = "tablePopulateStatus";
- /**
- * {@link Boolean}
- */
- String PROP_TABLE_STATUS_VISIBLE = "tableStatusVisible";
-
- T getTable();
-
- /**
- * Install a (new) table into the table field.
- *
- * @param externallyManaged
- * true means init, dispose, load and store are not handled by the
- * table field
- */
- void setTable(T newTable, boolean externallyManaged);
-
- /**
- * @return the selected row count, total row count and the sum of all numeric columns
- */
- String createDefaultTableStatus();
-
- /**
- * Convenience for {@link #getTableSelectionStatus()} and only reading the message text
- */
- String getTableStatus();
-
- /**
- * Convenience for {@link #setTableSelectionStatus(IProcessingStatus)} with a string. Creates a status with
- * {@link IStatus#INFO}
- */
- void setTableStatus(String s);
-
- /**
- * @return the status of the table data row count and selection
- */
- IProcessingStatus getTableSelectionStatus();
-
- /**
- * set the selection status on the table
- * <p>
- * this is normally displayed in a status bar on the bottom of the table gui
- * <p>
- * Use {@link AbstractTableField#execUpdateTableStatus()} to set the (new) status. This is called by
- * {@link #updateTableStatus()} whenever relevant changes happened.
- * <p>
- * see also {@link #createDefaultTableStatus()}
- * <p>
- * see {@link #setTableSelectionStatus(IProcessingStatus)}
- */
- void setTableSelectionStatus(IProcessingStatus status);
-
- /**
- * @return the data fetching>/loading status, warnings and other general messages related with data currently loaded
- * into this table
- */
- IProcessingStatus getTablePopulateStatus();
-
- /**
- * set the data loading status on the table
- * <p>
- * this is normally displayed in a status bar on the bottom of the table gui
- * <p>
- * Use {@link AbstractTableField#execUpdateTableStatus()} to set the (new) status. This is called by
- * {@link #updateTableStatus()} whenever relevant changes happened.
- * <p>
- * see also {@link #createDefaultTableStatus()}
- * <p>
- * see {@link #setTableSelectionStatus(IProcessingStatus)}
- * <p>
- * see {@link #setTablePopulateStatus(IProcessingStatus)}
- */
- void setTablePopulateStatus(IProcessingStatus status);
-
- /**
- * @return true if the table status is visible, false of not
- */
- boolean isTableStatusVisible();
-
- void setTableStatusVisible(boolean b);
-
- /**
- * Calls {@link #execUpdateStatus()} that by default builds a status text and calls {@link #setTableStatus(String)}.<br>
- */
- void updateTableStatus();
-
- void doSave() throws ProcessingException;
-
- /**
- * Reload data due to - master value change - sort by data source
- */
- void reloadTableData() throws ProcessingException;
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.tablefield;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.scout.commons.exception.IProcessingStatus;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+
+public interface ITableField<T extends ITable> extends IFormField {
+
+ /**
+ * {@link ITable}
+ */
+ String PROP_TABLE = "table";
+ /**
+ * {@link String}
+ *
+ * @deprecated use {@value #PROP_TABLE_SELECTION_STATUS}
+ */
+ @Deprecated
+ String PROP_TABLE_STATUS = "tableStatus";
+ /**
+ * {@link IProcessingStatus}
+ */
+ String PROP_TABLE_SELECTION_STATUS = "tableSelectionStatus";
+ /**
+ * {@link IProcessingStatus}
+ */
+ String PROP_TABLE_POPULATE_STATUS = "tablePopulateStatus";
+ /**
+ * {@link Boolean}
+ */
+ String PROP_TABLE_STATUS_VISIBLE = "tableStatusVisible";
+
+ T getTable();
+
+ /**
+ * Install a (new) table into the table field.
+ *
+ * @param externallyManaged
+ * true means init, dispose, load and store are not handled by the
+ * table field
+ */
+ void setTable(T newTable, boolean externallyManaged);
+
+ /**
+ * @return the selected row count, total row count and the sum of all numeric columns
+ */
+ String createDefaultTableStatus();
+
+ /**
+ * Convenience for {@link #getTableSelectionStatus()} and only reading the message text
+ */
+ String getTableStatus();
+
+ /**
+ * Convenience for {@link #setTableSelectionStatus(IProcessingStatus)} with a string. Creates a status with
+ * {@link IStatus#INFO}
+ */
+ void setTableStatus(String s);
+
+ /**
+ * @return the status of the table data row count and selection
+ */
+ IProcessingStatus getTableSelectionStatus();
+
+ /**
+ * set the selection status on the table
+ * <p>
+ * this is normally displayed in a status bar on the bottom of the table gui
+ * <p>
+ * Use {@link AbstractTableField#execUpdateTableStatus()} to set the (new) status. This is called by
+ * {@link #updateTableStatus()} whenever relevant changes happened.
+ * <p>
+ * see also {@link #createDefaultTableStatus()}
+ * <p>
+ * see {@link #setTableSelectionStatus(IProcessingStatus)}
+ */
+ void setTableSelectionStatus(IProcessingStatus status);
+
+ /**
+ * @return the data fetching>/loading status, warnings and other general messages related with data currently loaded
+ * into this table
+ */
+ IProcessingStatus getTablePopulateStatus();
+
+ /**
+ * set the data loading status on the table
+ * <p>
+ * this is normally displayed in a status bar on the bottom of the table gui
+ * <p>
+ * Use {@link AbstractTableField#execUpdateTableStatus()} to set the (new) status. This is called by
+ * {@link #updateTableStatus()} whenever relevant changes happened.
+ * <p>
+ * see also {@link #createDefaultTableStatus()}
+ * <p>
+ * see {@link #setTableSelectionStatus(IProcessingStatus)}
+ * <p>
+ * see {@link #setTablePopulateStatus(IProcessingStatus)}
+ */
+ void setTablePopulateStatus(IProcessingStatus status);
+
+ /**
+ * @return true if the table status is visible, false of not
+ */
+ boolean isTableStatusVisible();
+
+ void setTableStatusVisible(boolean b);
+
+ /**
+ * Calls {@link #execUpdateStatus()} that by default builds a status text and calls {@link #setTableStatus(String)}.<br>
+ */
+ void updateTableStatus();
+
+ void doSave() throws ProcessingException;
+
+ /**
+ * Reload data due to - master value change - sort by data source
+ */
+ void reloadTableData() throws ProcessingException;
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/tablefield/ValidateTableFieldDescriptor.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/tablefield/ValidateTableFieldDescriptor.java
index 31aeaf1c62..f105751a3e 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/tablefield/ValidateTableFieldDescriptor.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/tablefield/ValidateTableFieldDescriptor.java
@@ -1,70 +1,70 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.tablefield;
-
-import org.eclipse.scout.commons.exception.IProcessingStatus;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-import org.eclipse.scout.rt.client.ui.form.fields.IValidateContentDescriptor;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox;
-import org.eclipse.scout.rt.client.ui.form.fields.tabbox.ITabBox;
-
-/**
- * This interface is used to check fields for valid content and - in case invalid - activate / select / focus the
- * appropriate location
- * <p>
- * see {@link IFormField#validateContent()}
- */
-public class ValidateTableFieldDescriptor implements IValidateContentDescriptor {
- private final ITableField<?> m_tableField;
- private final ITableRow m_row;
- private final IColumn<?> m_col;
- private String m_displayText;
-
- public ValidateTableFieldDescriptor(ITableField<?> tableField, ITableRow row, IColumn<?> col) {
- m_tableField = tableField;
- m_row = row;
- m_col = col;
- }
-
- @Override
- public String getDisplayText() {
- return m_displayText;
- }
-
- public void setDisplayText(String displayText) {
- m_displayText = displayText;
- }
-
- @Override
- public IProcessingStatus getErrorStatus() {
- return null;
- }
-
- @Override
- public void activateProblemLocation() {
- //make sure the table is showing (activate parent tabs)
- IGroupBox g = m_tableField.getParentGroupBox();
- while (g != null) {
- if (g.getParentField() instanceof ITabBox) {
- ITabBox t = (ITabBox) g.getParentField();
- if (t.getSelectedTab() != g) {
- t.setSelectedTab(g);
- }
- }
- g = g.getParentGroupBox();
- }
- if (m_row != null && m_col != null) {
- m_tableField.getTable().requestFocusInCell(m_col, m_row);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.tablefield;
+
+import org.eclipse.scout.commons.exception.IProcessingStatus;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+import org.eclipse.scout.rt.client.ui.form.fields.IValidateContentDescriptor;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox;
+import org.eclipse.scout.rt.client.ui.form.fields.tabbox.ITabBox;
+
+/**
+ * This interface is used to check fields for valid content and - in case invalid - activate / select / focus the
+ * appropriate location
+ * <p>
+ * see {@link IFormField#validateContent()}
+ */
+public class ValidateTableFieldDescriptor implements IValidateContentDescriptor {
+ private final ITableField<?> m_tableField;
+ private final ITableRow m_row;
+ private final IColumn<?> m_col;
+ private String m_displayText;
+
+ public ValidateTableFieldDescriptor(ITableField<?> tableField, ITableRow row, IColumn<?> col) {
+ m_tableField = tableField;
+ m_row = row;
+ m_col = col;
+ }
+
+ @Override
+ public String getDisplayText() {
+ return m_displayText;
+ }
+
+ public void setDisplayText(String displayText) {
+ m_displayText = displayText;
+ }
+
+ @Override
+ public IProcessingStatus getErrorStatus() {
+ return null;
+ }
+
+ @Override
+ public void activateProblemLocation() {
+ //make sure the table is showing (activate parent tabs)
+ IGroupBox g = m_tableField.getParentGroupBox();
+ while (g != null) {
+ if (g.getParentField() instanceof ITabBox) {
+ ITabBox t = (ITabBox) g.getParentField();
+ if (t.getSelectedTab() != g) {
+ t.setSelectedTab(g);
+ }
+ }
+ g = g.getParentGroupBox();
+ }
+ if (m_row != null && m_col != null) {
+ m_tableField.getTable().requestFocusInCell(m_col, m_row);
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/textfield/AbstractTextField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/textfield/AbstractTextField.java
index f350fe9cec..d083b6a1de 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/textfield/AbstractTextField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/textfield/AbstractTextField.java
@@ -1,29 +1,29 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.textfield;
-
-import org.eclipse.scout.rt.client.ui.form.fields.stringfield.AbstractStringField;
-
-/**
- * Convenience subclass for {@link AbstractStringField} due to popular usage of
- * the word "textField" instead of "stringField"<br>
- * do not add further code or methods to this class
- */
-public abstract class AbstractTextField extends AbstractStringField implements ITextField {
-
- public AbstractTextField() {
- this(true);
- }
-
- public AbstractTextField(boolean callInitializer) {
- super(callInitializer);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.textfield;
+
+import org.eclipse.scout.rt.client.ui.form.fields.stringfield.AbstractStringField;
+
+/**
+ * Convenience subclass for {@link AbstractStringField} due to popular usage of
+ * the word "textField" instead of "stringField"<br>
+ * do not add further code or methods to this class
+ */
+public abstract class AbstractTextField extends AbstractStringField implements ITextField {
+
+ public AbstractTextField() {
+ this(true);
+ }
+
+ public AbstractTextField(boolean callInitializer) {
+ super(callInitializer);
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/textfield/ITextField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/textfield/ITextField.java
index b981da2d5c..8bd438dde3 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/textfield/ITextField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/textfield/ITextField.java
@@ -1,21 +1,21 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.textfield;
-
-import org.eclipse.scout.rt.client.ui.form.fields.stringfield.IStringField;
-
-/**
- * Convenience subclass for {@link IStringField} due to popular usage of the
- * word "textField" instead of "stringField" do not add further code or methods
- * to this class
- */
-public interface ITextField extends IStringField {
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.textfield;
+
+import org.eclipse.scout.rt.client.ui.form.fields.stringfield.IStringField;
+
+/**
+ * Convenience subclass for {@link IStringField} due to popular usage of the
+ * word "textField" instead of "stringField" do not add further code or methods
+ * to this class
+ */
+public interface ITextField extends IStringField {
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/treebox/AbstractTreeBox.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/treebox/AbstractTreeBox.java
index 10cbccfa64..d30012c78d 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/treebox/AbstractTreeBox.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/treebox/AbstractTreeBox.java
@@ -1,1124 +1,1124 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.treebox;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.lang.reflect.Array;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-
-import org.eclipse.scout.commons.ConfigurationUtility;
-import org.eclipse.scout.commons.TriState;
-import org.eclipse.scout.commons.annotations.ConfigOperation;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.holders.Holder;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.services.lookup.FormFieldProvisioningContext;
-import org.eclipse.scout.rt.client.services.lookup.ILookupCallProvisioningService;
-import org.eclipse.scout.rt.client.ui.basic.cell.ICell;
-import org.eclipse.scout.rt.client.ui.basic.tree.AbstractTree;
-import org.eclipse.scout.rt.client.ui.basic.tree.AbstractTreeNode;
-import org.eclipse.scout.rt.client.ui.basic.tree.AbstractTreeNodeBuilder;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITree;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNodeFilter;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeVisitor;
-import org.eclipse.scout.rt.client.ui.basic.tree.TreeAdapter;
-import org.eclipse.scout.rt.client.ui.basic.tree.TreeEvent;
-import org.eclipse.scout.rt.client.ui.form.IFormFieldVisitor;
-import org.eclipse.scout.rt.client.ui.form.fields.AbstractValueField;
-import org.eclipse.scout.rt.client.ui.form.fields.ICompositeField;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.shared.data.form.ValidationRule;
-import org.eclipse.scout.rt.shared.services.common.code.ICodeType;
-import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
-import org.eclipse.scout.rt.shared.services.lookup.CodeLookupCall;
-import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
-import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
-import org.eclipse.scout.service.SERVICES;
-
-public abstract class AbstractTreeBox<T> extends AbstractValueField<T[]> implements ITreeBox<T> {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractTreeBox.class);
-
- private ITree m_tree;
- private LookupCall m_lookupCall;
- private Class<? extends ICodeType> m_codeTypeClass;
- private boolean m_valueTreeSyncActive;
- private boolean m_autoExpandAll;
- private boolean m_loadIncremental;
- private ITreeBoxUIFacade m_uiFacade;
- private ITreeNodeFilter m_activeNodesFilter;
- private ITreeNodeFilter m_checkedNodesFilter;
- // children
- private IFormField[] m_fields;
-
- public AbstractTreeBox() {
- this(true);
- }
-
- public AbstractTreeBox(boolean callInitializer) {
- super(callInitializer);
- }
-
- /*
- * Configuration
- */
- /**
- * Called to (re)load children of a node.
- * <p>
- * When loadIncremental=false then this method is only called once on the invisible root node.<br>
- * When loadIncremental=true then this method is called on every node.
- * <p>
- * The default implementation is:
- *
- * <pre>
- * ITreeNode[] children;
- * if (isLoadIncremental()) {
- * children = callChildLookup(parentNode);
- * }
- * else {
- * children = callCompleteTreeLookup();
- * }
- * getTree().removeAllChildNodes(parentNode);
- * getTree().addChildNodes(parentNode, children);
- * parentNode.setChildrenLoaded(true);
- * </pre>
- */
- @ConfigOperation
- @Order(240)
- protected void execLoadChildNodes(ITreeNode parentNode) throws ProcessingException {
- ITreeNode[] children;
- if (isLoadIncremental()) {
- children = callChildLookup(parentNode);
- }
- else {
- children = callCompleteTreeLookup();
- }
- m_tree.removeAllChildNodes(parentNode);
- m_tree.addChildNodes(parentNode, children);
- parentNode.setChildrenLoaded(true);
- }
-
- @ConfigProperty(ConfigProperty.LOOKUP_CALL)
- @Order(240)
- @ConfigPropertyValue("null")
- @ValidationRule(ValidationRule.LOOKUP_CALL)
- protected Class<? extends LookupCall> getConfiguredLookupCall() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.CODE_TYPE)
- @Order(250)
- @ConfigPropertyValue("null")
- @ValidationRule(ValidationRule.CODE_TYPE)
- protected Class<? extends ICodeType> getConfiguredCodeType() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.ICON_ID)
- @Order(230)
- @ConfigPropertyValue("null")
- protected String getConfiguredIconId() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(260)
- @ConfigPropertyValue("true")
- protected boolean getConfiguredAutoLoad() {
- return true;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(270)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredLoadIncremental() {
- return false;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(280)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredAutoExpandAll() {
- return false;
- }
-
- /**
- * @return true: a filter is added to the treebox tree that only accepts nodes
- * that are active or checked.<br>
- * Affects {@link ITreeNode#getFilteredChildNodes()}
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(290)
- @ConfigPropertyValue("true")
- protected boolean getConfiguredFilterActiveNodes() {
- return false;
- }
-
- /**
- * @return true: a filter is added to the treebox tree that only accepts
- * checked nodes<br>
- * Affects {@link ITreeNode#getFilteredChildNodes()}
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(300)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredFilterCheckedNodes() {
- return false;
- }
-
- @Override
- @ConfigPropertyValue("1.0")
- protected double getConfiguredGridWeightY() {
- return 1.0;
- }
-
- private Class<? extends IFormField>[] getConfiguredFields() {
- Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
- return ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, IFormField.class);
- }
-
- /**
- * called before any lookup is performed
- */
- @ConfigOperation
- @Order(230)
- protected void execPrepareLookup(LookupCall call, ITreeNode parent) throws ProcessingException {
- }
-
- /**
- * @param call
- * that produced this result
- * @param result
- * live list containing the result rows. Add, remove, set, replace
- * and clear of entries in this list is supported
- */
- @ConfigOperation
- @Order(240)
- protected void execFilterLookupResult(LookupCall call, List<LookupRow> result) throws ProcessingException {
- }
-
- /**
- * @param newNode
- * a new node that was created for the tree, but not yet attached to the tree
- * @param treeLevel
- * Since {@link ITreeNode#getTreeLevel()} is not yet valid, treeLevel is the level where the node will be
- * attached at
- * <p>
- * Can be useful for example to disable nodes on some levels so they cannot be checked.
- */
- @ConfigOperation
- @Order(250)
- protected void execFilterNewNode(ITreeNode newNode, int treeLevel) throws ProcessingException {
- }
-
- private Class<? extends ITree> getConfiguredTree() {
- Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
- Class<? extends ITree>[] f = ConfigurationUtility.filterClasses(dca, ITree.class);
- if (f.length == 1) {
- return f[0];
- }
- else {
- for (Class<? extends ITree> c : f) {
- if (c.getDeclaringClass() != AbstractTreeBox.class) {
- return c;
- }
- }
- return null;
- }
- }
-
- @Override
- protected void execChangedMasterValue(Object newMasterValue) throws ProcessingException {
- setValue(null);
- loadRootNode();
- }
-
- @Override
- protected void initConfig() {
- m_uiFacade = createUIFacade();
- m_fields = new IFormField[0];
- super.initConfig();
- setFilterActiveNodes(getConfiguredFilterActiveNodes());
- setFilterActiveNodesValue(TriState.TRUE);
- setFilterCheckedNodes(getConfiguredFilterCheckedNodes());
- setFilterCheckedNodesValue(getConfiguredFilterCheckedNodes());
- setAutoExpandAll(getConfiguredAutoExpandAll());
- setLoadIncremental(getConfiguredLoadIncremental());
- try {
- m_tree = ConfigurationUtility.newInnerInstance(this, getConfiguredTree());
- if (m_tree instanceof AbstractTree) {
- ((AbstractTree) m_tree).setContainerInternal(this);
- }
- m_tree.setRootNode(getTreeNodeBuilder().createTreeNode(new LookupRow(null, "Root"), ITreeNode.STATUS_NON_CHANGED, false));
- m_tree.setAutoDiscardOnDelete(false);
- updateActiveNodesFilter();
- updateCheckedNodesFilter();
- m_tree.addTreeListener(
- new TreeAdapter() {
- @Override
- public void treeChanged(TreeEvent e) {
- switch (e.getType()) {
- case TreeEvent.TYPE_NODES_SELECTED: {
- if (!getTree().isCheckable()) {
- syncTreeToValue();
- }
- break;
- }
- case TreeEvent.TYPE_NODES_UPDATED: {
- if (getTree().isCheckable()) {
- syncTreeToValue();
- }
- break;
- }
- }
- }
- }
- );
- m_tree.setEnabled(isEnabled());
- // default icon
- if (this.getConfiguredIconId() != null) {
- m_tree.setIconId(this.getConfiguredIconId());
- }
- }
- catch (Exception e) {
- LOG.warn(null, e);
- }
- if (getConfiguredLookupCall() != null) {
- try {
- LookupCall call = getConfiguredLookupCall().newInstance();
- setLookupCall(call);
- }
- catch (Exception e) {
- LOG.warn(null, e);
- }
- }
- // code type
- if (getConfiguredCodeType() != null) {
- setCodeTypeClass(getConfiguredCodeType());
- }
- // local property listener
- addPropertyChangeListener(new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent e) {
- if (m_tree != null) {
- String name = e.getPropertyName();
- if (PROP_ENABLED.equals(name)) {
- m_tree.setEnabled(isEnabled());
- }
- else if (PROP_FILTER_CHECKED_NODES_VALUE.equals(name)) {
- updateCheckedNodesFilter();
- }
- else if (PROP_FILTER_ACTIVE_NODES_VALUE.equals(name)) {
- updateActiveNodesFilter();
- }
- }
- }
- });
- // add fields
- ArrayList<IFormField> fieldList = new ArrayList<IFormField>();
- Class<? extends IFormField>[] fieldArray = getConfiguredFields();
- for (int i = 0; i < fieldArray.length; i++) {
- IFormField f;
- try {
- f = ConfigurationUtility.newInnerInstance(this, fieldArray[i]);
- fieldList.add(f);
- }// end try
- catch (Throwable t) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("field: " + fieldArray[i].getName(), t));
- }
- }
- for (IFormField f : fieldList) {
- f.setParentFieldInternal(this);
- }
- m_fields = fieldList.toArray(new IFormField[0]);
- }
-
- @Override
- protected void initFieldInternal() throws ProcessingException {
- getTree().initTree();
- if (getConfiguredAutoLoad()) {
- try {
- setValueChangeTriggerEnabled(false);
- //
- loadRootNode();
- }
- finally {
- setValueChangeTriggerEnabled(true);
- }
- }
- super.initFieldInternal();
- }
-
- @Override
- protected void disposeFieldInternal() {
- super.disposeFieldInternal();
- getTree().disposeTree();
- }
-
- public TreeBoxFilterBox getTreeBoxFilterBox() {
- return getFieldByClass(TreeBoxFilterBox.class);
- }
-
- /*
- * Runtime
- */
- @Override
- public final ITree getTree() {
- return m_tree;
- }
-
- protected ITreeBoxUIFacade createUIFacade() {
- return new P_TreeBoxUIFacade();
- }
-
- @Override
- public ITreeBoxUIFacade getUIFacade() {
- return m_uiFacade;
- }
-
- @Override
- public void loadRootNode() throws ProcessingException {
- loadChildNodes(m_tree.getRootNode());
- }
-
- @Override
- public final void loadChildNodes(ITreeNode parentNode) throws ProcessingException {
- if (m_tree != null) {
- try {
- m_valueTreeSyncActive = true;
- m_tree.setTreeChanging(true);
- //
- execLoadChildNodes(parentNode);
- // when tree is non-incremental, mark all leaf cadidates as leafs
- if (!isLoadIncremental()) {
- ITreeVisitor v = new ITreeVisitor() {
- @Override
- public boolean visit(ITreeNode node) {
- if (node.getChildNodeCount() == 0) {
- node.setLeafInternal(true);
- }
- else {
- node.setLeafInternal(false);
- }
- return true;
- }
- };
- getTree().visitNode(getTree().getRootNode(), v);
- }
- // auto-expand all
- if (isAutoExpandAll()) {
- m_tree.expandAll(parentNode);
- }
- }
- finally {
- m_tree.setTreeChanging(false);
- m_valueTreeSyncActive = false;
- }
- syncValueToTree();
- }
- }
-
- public AbstractTreeNodeBuilder getTreeNodeBuilder() {
- return new P_TreeNodeBuilder();
- }
-
- private void prepareLookupCall(LookupCall call, ITreeNode parent) throws ProcessingException {
- prepareLookupCallInternal(call, parent);
- execPrepareLookup(call, parent);
- }
-
- /**
- * do not use this internal method directly
- */
- private void prepareLookupCallInternal(LookupCall call, ITreeNode parent) {
- // set parent key
- if (parent != null) {
- call.setRec(parent.getPrimaryKey());
- }
- else {
- call.setRec(null);
- }
- //when there is a master value defined in the original call, don't set it to null when no master value is available
- if (getMasterValue() != null || getLookupCall() == null || getLookupCall().getMaster() == null) {
- call.setMaster(getMasterValue());
- }
- }
-
- @Override
- public final LookupCall getLookupCall() {
- return m_lookupCall;
- }
-
- @Override
- public void setLookupCall(LookupCall call) {
- m_lookupCall = call;
- }
-
- @Override
- public Class<? extends ICodeType> getCodeTypeClass() {
- return m_codeTypeClass;
- }
-
- @Override
- public void setCodeTypeClass(Class<? extends ICodeType> codeTypeClass) {
- m_codeTypeClass = codeTypeClass;
- // create lookup service call
- m_lookupCall = null;
- if (m_codeTypeClass != null) {
- m_lookupCall = CodeLookupCall.newInstanceByService(m_codeTypeClass);
- }
- }
-
- @Override
- public ITreeNode[] callChildLookup(ITreeNode parentNode) throws ProcessingException {
- LookupRow[] data = null;
- LookupCall call = getLookupCall();
- if (call != null) {
- call = SERVICES.getService(ILookupCallProvisioningService.class).newClonedInstance(call, new FormFieldProvisioningContext(AbstractTreeBox.this));
- prepareLookupCall(call, parentNode);
- data = call.getDataByRec();
- data = filterLookupResult(call, data);
- ITreeNode[] subTree = getTreeNodeBuilder().createTreeNodes(data, ITreeNode.STATUS_NON_CHANGED, false);
- filterNewNodesRec(subTree, parentNode != null ? parentNode.getTreeLevel() + 1 : 0);
- return subTree;
- }
- else {
- return new ITreeNode[0];
- }
- }
-
- @Override
- public ITreeNode[] callCompleteTreeLookup() throws ProcessingException {
- LookupRow[] data = null;
- LookupCall call = getLookupCall();
- if (call != null) {
- call = SERVICES.getService(ILookupCallProvisioningService.class).newClonedInstance(call, new FormFieldProvisioningContext(AbstractTreeBox.this));
- prepareLookupCall(call, null);
- data = call.getDataByAll();
- data = filterLookupResult(call, data);
- if (data != null && data.length > 1000) {
- LOG.warn("TreeBox " + getClass().getSimpleName() + " has loadIncremental=false but produced more than 1000 rows; check if this is intended.");
- }
- ITreeNode[] subTree = getTreeNodeBuilder().createTreeNodes(data, ITreeNode.STATUS_NON_CHANGED, true);
- filterNewNodesRec(subTree, 0);
- return subTree;
- }
- else {
- return new ITreeNode[0];
- }
- }
-
- private LookupRow[] filterLookupResult(LookupCall call, LookupRow[] data) throws ProcessingException {
- ArrayList<LookupRow> result;
- if (data != null) {
- result = new ArrayList<LookupRow>(Arrays.asList(data));
- }
- else {
- result = new ArrayList<LookupRow>();
- }
- execFilterLookupResult(call, result);
- int len = 0;
- for (LookupRow r : result) {
- if (r != null) {
- len++;
- }
- }
- LookupRow[] a = new LookupRow[len];
- int index = 0;
- for (LookupRow r : result) {
- if (r != null) {
- a[index] = r;
- index++;
- }
- }
- return a;
- }
-
- private void filterNewNodesRec(ITreeNode[] nodes, int level) throws ProcessingException {
- if (nodes != null) {
- for (ITreeNode node : nodes) {
- if (node != null) {
- execFilterNewNode(node, level);
- filterNewNodesRec(node.getChildNodes(), level + 1);
- }
- }
- }
- }
-
- @Override
- protected void valueChangedInternal() {
- super.valueChangedInternal();
- syncValueToTree();
- }
-
- @Override
- protected String formatValueInternal(T[] validValue) {
- if (validValue == null || validValue.length == 0) {
- return "";
- }
- StringBuffer b = new StringBuffer();
- ITreeNode[] nodes = getTree().findNodes(validValue);
- for (int i = 0; i < nodes.length; i++) {
- if (i > 0) {
- b.append(", ");
- }
- b.append(nodes[i].getCell().getText());
- }
- return b.toString();
- }
-
- @Override
- protected T[] validateValueInternal(T[] rawValue) {
- T[] validValue = rawValue;
- //
- if (validValue != null && validValue.length == 0) {
- validValue = null;
- }
- ITree tree = getTree();
- if (tree != null && validValue != null) {
- if ((tree.isCheckable() && !tree.isMultiCheck()) || (!tree.isCheckable() && !tree.isMultiSelect())) {
- //only single value
- if (validValue.length > 1) {
- LOG.warn(getClass().getName() + " only accepts a single value. Got " + Arrays.toString(validValue) + ". Using only first value.");
- @SuppressWarnings("unchecked")
- T[] newArray = (T[]) Array.newInstance(validValue.getClass().getComponentType(), 1);
- newArray[0] = validValue[0];
- validValue = newArray;
- }
- }
- }
- return validValue;
- }
-
- @Override
- public T getSingleValue() {
- T[] a = getValue();
- if (a != null && a.length > 0) {
- return a[0];
- }
- else {
- return null;
- }
- }
-
- @Override
- public void setSingleValue(T value) {
- if (value == null) {
- setValue(null);
- }
- else {
- @SuppressWarnings("unchecked")
- T[] array = (T[]) Array.newInstance(getHolderType().getComponentType(), 1);
- array[0] = value;
- setValue(array);
- }
- }
-
- @Override
- public int getCheckedKeyCount() {
- T[] keys = getValue();
- if (keys != null) {
- return keys.length;
- }
- else {
- return 0;
- }
- }
-
- @Override
- public T getCheckedKey() {
- T[] a = getCheckedKeys();
- if (a != null && a.length > 0) {
- return a[0];
- }
- else {
- return null;
- }
- }
-
- @Override
- public T[] getCheckedKeys() {
- return getValue();
- }
-
- @Override
- public LookupRow getCheckedLookupRow() {
- LookupRow[] a = getCheckedLookupRows();
- if (a != null && a.length > 0) {
- return a[0];
- }
- else {
- return null;
- }
- }
-
- @Override
- public LookupRow[] getCheckedLookupRows() {
- LookupRow[] lookupRows = null;
- ITreeNode[] treeNodes = getTree().getCheckedNodes();
- if (treeNodes != null) {
- lookupRows = new LookupRow[treeNodes.length];
- for (int i = 0; i < treeNodes.length; i++) {
- ITreeNode node = treeNodes[i];
- ICell cell = node.getCell();
- ITreeNode parentNode = node.getParentNode();
- lookupRows[i] = new LookupRow(node.getPrimaryKey(), cell.getText(), cell.getIconId(), cell.getTooltipText(), cell.getBackgroundColor(), cell.getForegroundColor(), cell.getFont(), cell.isEnabled(), parentNode != null ? parentNode.getPrimaryKey() : null, isNodeActive(node));
- }
- }
- return lookupRows;
- }
-
- @Override
- public void checkKey(T key) {
- if (key == null) {
- checkKeys(null);
- }
- else {
- @SuppressWarnings("unchecked")
- T[] array = (T[]) Array.newInstance(getHolderType().getComponentType(), 1);
- array[0] = key;
- checkKeys(array);
- }
- }
-
- @Override
- public void checkKeys(T[] keys) {
- setValue(keys);
- }
-
- @Override
- public void uncheckAllKeys() {
- checkKeys(null);
- }
-
- @Override
- public T[] getUncheckedKeys() {
- HashSet<T> set = new HashSet<T>();
- T[] a = getInitValue();
- if (a != null) {
- set.addAll(Arrays.asList(a));
- }
- a = getCheckedKeys();
- if (a != null) {
- set.removeAll(Arrays.asList(a));
- }
- @SuppressWarnings("unchecked")
- T[] array = (T[]) Array.newInstance(getHolderType().getComponentType(), 0);
- a = set.toArray(array);
- if (a.length == 0) {
- a = null;
- }
- return a;
- }
-
- @Override
- public void checkAllKeys() {
- final HashSet<T> keySet = new HashSet<T>();
- ITreeVisitor v = new ITreeVisitor() {
- @SuppressWarnings("unchecked")
- @Override
- public boolean visit(ITreeNode node) {
- if (node.getPrimaryKey() != null) {
- keySet.add((T) node.getPrimaryKey());
- }
- return true;
- }
- };
- m_tree.visitNode(m_tree.getRootNode(), v);
- @SuppressWarnings("unchecked")
- T[] array = (T[]) Array.newInstance(getHolderType().getComponentType(), 0);
- checkKeys(keySet.toArray(array));
- }
-
- @Override
- public boolean isLoadIncremental() {
- return m_loadIncremental;
- }
-
- @Override
- public void setLoadIncremental(boolean b) {
- m_loadIncremental = b;
- }
-
- @Override
- public boolean isAutoExpandAll() {
- return m_autoExpandAll;
- }
-
- @Override
- public void setAutoExpandAll(boolean b) {
- m_autoExpandAll = b;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public boolean isNodeActive(ITreeNode node) {
- if (node instanceof AbstractTreeBox.P_InternalTreeNode) {
- return ((P_InternalTreeNode) node).isActive();
- }
- else {
- return false;
- }
- }
-
- @Override
- public boolean isFilterActiveNodes() {
- return propertySupport.getPropertyBool(PROP_FILTER_ACTIVE_NODES);
- }
-
- @Override
- public void setFilterActiveNodes(boolean b) {
- propertySupport.setPropertyBool(PROP_FILTER_ACTIVE_NODES, b);
- }
-
- @Override
- public boolean getFilterCheckedNodesValue() {
- return propertySupport.getPropertyBool(PROP_FILTER_CHECKED_NODES_VALUE);
- }
-
- @Override
- public void setFilterCheckedNodesValue(boolean b) {
- propertySupport.setPropertyBool(PROP_FILTER_CHECKED_NODES_VALUE, b);
- }
-
- @Override
- public boolean isFilterCheckedNodes() {
- return propertySupport.getPropertyBool(PROP_FILTER_CHECKED_NODES);
- }
-
- @Override
- public void setFilterCheckedNodes(boolean b) {
- propertySupport.setPropertyBool(PROP_FILTER_CHECKED_NODES, b);
- }
-
- @Override
- public TriState getFilterActiveNodesValue() {
- return (TriState) propertySupport.getProperty(PROP_FILTER_ACTIVE_NODES_VALUE);
- }
-
- @Override
- public void setFilterActiveNodesValue(TriState t) {
- if (t == null) {
- t = TriState.TRUE;
- }
- propertySupport.setProperty(PROP_FILTER_ACTIVE_NODES_VALUE, t);
- }
-
- private void updateActiveNodesFilter() {
- try {
- m_tree.setTreeChanging(true);
- //
- if (m_activeNodesFilter != null) {
- m_tree.removeNodeFilter(m_activeNodesFilter);
- m_activeNodesFilter = null;
- }
- m_activeNodesFilter = new ActiveOrCheckedNodesFilter(this, getFilterActiveNodesValue());
- m_tree.addNodeFilter(m_activeNodesFilter);
- }
- finally {
- m_tree.setTreeChanging(false);
- }
- }
-
- private void updateCheckedNodesFilter() {
- try {
- m_tree.setTreeChanging(true);
- //
- if (m_checkedNodesFilter != null) {
- m_tree.removeNodeFilter(m_checkedNodesFilter);
- m_checkedNodesFilter = null;
- }
- if (getFilterCheckedNodesValue()) {
- m_checkedNodesFilter = new CheckedNodesFilter();
- m_tree.addNodeFilter(m_checkedNodesFilter);
- }
- }
- finally {
- m_tree.setTreeChanging(false);
- }
- }
-
- private void syncValueToTree() {
- if (m_valueTreeSyncActive) {
- return;
- }
- try {
- m_valueTreeSyncActive = true;
- getTree().setTreeChanging(true);
- //
- T[] checkedKeys = getCheckedKeys();
- ITreeNode[] checkedNodes = m_tree.findNodes(checkedKeys);
- getTree().visitTree(new ITreeVisitor() {
- @Override
- public boolean visit(ITreeNode node) {
- node.setChecked(false);
- return true;
- }
- });
- for (ITreeNode node : checkedNodes) {
- node.setChecked(true);
- }
- if (!getTree().isCheckable()) {
- getTree().selectNodes(checkedNodes, false);
- }
- }
- finally {
- getTree().setTreeChanging(false);
- m_valueTreeSyncActive = false;
- }
- }
-
- @SuppressWarnings("unchecked")
- private void syncTreeToValue() {
- if (m_valueTreeSyncActive) {
- return;
- }
- try {
- m_valueTreeSyncActive = true;
- getTree().setTreeChanging(true);
- //
- T[] checkedKeys = null;
- ITreeNode[] checkedNodes;
- if (getTree().isCheckable()) {
- checkedNodes = m_tree.getCheckedNodes();
- }
- else {
- checkedNodes = m_tree.getSelectedNodes();
- }
- checkedKeys = (T[]) Array.newInstance(getHolderType().getComponentType(), checkedNodes.length);
- for (int i = 0; i < checkedNodes.length; i++) {
- checkedKeys[i] = (T) checkedNodes[i].getPrimaryKey();
- }
- checkKeys(checkedKeys);
- if (!getTree().isCheckable()) {
- //checks follow selection
- getTree().visitTree(new ITreeVisitor() {
- @Override
- public boolean visit(ITreeNode node) {
- node.setChecked(node.isSelectedNode());
- return true;
- }
- });
- }
- }
- finally {
- getTree().setTreeChanging(false);
- m_valueTreeSyncActive = false;
- }
- // check if row filter needs to change
- if (!m_tree.getUIFacade().isUIProcessing()) {
- updateActiveNodesFilter();
- }
- updateCheckedNodesFilter();
- }
-
- /*
- * Implementation of ICompositeField
- */
-
- @SuppressWarnings("unchecked")
- @Override
- public <F extends IFormField> F getFieldByClass(final Class<F> c) {
- final Holder<IFormField> found = new Holder<IFormField>(IFormField.class);
- IFormFieldVisitor v = new IFormFieldVisitor() {
- @Override
- public boolean visitField(IFormField field, int level, int fieldIndex) {
- if (field.getClass() == c) {
- found.setValue(field);
- }
- return found.getValue() == null;
- }
- };
- visitFields(v, 0);
- return (F) found.getValue();
- }
-
- @Override
- public IFormField getFieldById(final String id) {
- final Holder<IFormField> found = new Holder<IFormField>(IFormField.class);
- IFormFieldVisitor v = new IFormFieldVisitor() {
- @Override
- public boolean visitField(IFormField field, int level, int fieldIndex) {
- if (field.getFieldId().equals(id)) {
- found.setValue(field);
- }
- return found.getValue() == null;
- }
- };
- visitFields(v, 0);
- return found.getValue();
- }
-
- @Override
- public <X extends IFormField> X getFieldById(final String id, final Class<X> type) {
- final Holder<X> found = new Holder<X>(type);
- IFormFieldVisitor v = new IFormFieldVisitor() {
- @Override
- @SuppressWarnings("unchecked")
- public boolean visitField(IFormField field, int level, int fieldIndex) {
- if (type.isAssignableFrom(field.getClass()) && field.getFieldId().equals(id)) {
- found.setValue((X) field);
- }
- return found.getValue() == null;
- }
- };
- visitFields(v, 0);
- return found.getValue();
- }
-
- @Override
- public int getFieldCount() {
- return m_fields.length;
- }
-
- @Override
- public int getFieldIndex(IFormField f) {
- for (int i = 0; i < m_fields.length; i++) {
- if (m_fields[i] == f) {
- return i;
- }
- }
- return -1;
- }
-
- @Override
- public IFormField[] getFields() {
- IFormField[] a = new IFormField[m_fields.length];
- System.arraycopy(m_fields, 0, a, 0, a.length);
- return a;
- }
-
- @Override
- public boolean visitFields(IFormFieldVisitor visitor, int startLevel) {
- // myself
- if (!visitor.visitField(this, startLevel, 0)) {
- return false;
- }
- // children
- int index = 0;
- IFormField[] f = m_fields;
- for (int i = 0; i < f.length; i++) {
- if (f[i] instanceof ICompositeField) {
- if (!((ICompositeField) f[i]).visitFields(visitor, startLevel + 1)) {
- return false;
- }
- }
- else {
- if (!visitor.visitField(f[i], startLevel, index)) {
- return false;
- }
- }
- index++;
- }
- return true;
- }
-
- @Override
- public final int getGridColumnCount() {
- return 1;
- }
-
- @Override
- public final int getGridRowCount() {
- return 1;
- }
-
- @Override
- public void rebuildFieldGrid() {
- }
-
- @Order(1)
- public class TreeBoxFilterBox extends AbstractTreeBoxFilterBox {
- @Override
- protected ITreeBox getTreeBox() {
- return AbstractTreeBox.this;
- }
- }
-
- /**
- * TreeNode implementation with delegation of loadChildren to
- * this.loadChildNodes()
- */
- private class P_InternalTreeNode extends AbstractTreeNode {
- private boolean m_active;
-
- public boolean isActive() {
- return m_active;
- }
-
- public void setActive(boolean b) {
- m_active = b;
- }
-
- @Override
- public void loadChildren() throws ProcessingException {
- if (isLoadIncremental()) {
- AbstractTreeBox.this.loadChildNodes(this);
- }
- else {
- setChildrenLoaded(true);
- }
- }
- }
-
- private class P_TreeNodeBuilder extends AbstractTreeNodeBuilder {
-
- @Override
- protected ITreeNode createEmptyTreeNode() throws ProcessingException {
- return new P_InternalTreeNode();
- }
-
- @Override
- public ITreeNode createTreeNode(LookupRow lookupRow, int nodeStatus, boolean markChildrenLoaded) throws ProcessingException {
- @SuppressWarnings("unchecked")
- P_InternalTreeNode treeNode = (P_InternalTreeNode) super.createTreeNode(lookupRow, nodeStatus, markChildrenLoaded);
- treeNode.setActive(lookupRow.isActive());
- return treeNode;
- }
-
- }
-
- @Order(10000)
- public class DefaultTreeBoxTree extends AbstractTree {
-
- @ConfigPropertyValue("false")
- @Override
- protected boolean getConfiguredMultiSelect() {
- return false;
- }
-
- @ConfigPropertyValue("true")
- @Override
- protected boolean getConfiguredCheckable() {
- return true;
- }
-
- @ConfigPropertyValue("false")
- @Override
- protected boolean getConfiguredRootNodeVisible() {
- return false;
- }
- }
-
- /*
- * UI Notifications
- */
- protected class P_TreeBoxUIFacade implements ITreeBoxUIFacade {
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.treebox;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+
+import org.eclipse.scout.commons.ConfigurationUtility;
+import org.eclipse.scout.commons.TriState;
+import org.eclipse.scout.commons.annotations.ConfigOperation;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.holders.Holder;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.services.lookup.FormFieldProvisioningContext;
+import org.eclipse.scout.rt.client.services.lookup.ILookupCallProvisioningService;
+import org.eclipse.scout.rt.client.ui.basic.cell.ICell;
+import org.eclipse.scout.rt.client.ui.basic.tree.AbstractTree;
+import org.eclipse.scout.rt.client.ui.basic.tree.AbstractTreeNode;
+import org.eclipse.scout.rt.client.ui.basic.tree.AbstractTreeNodeBuilder;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITree;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNodeFilter;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeVisitor;
+import org.eclipse.scout.rt.client.ui.basic.tree.TreeAdapter;
+import org.eclipse.scout.rt.client.ui.basic.tree.TreeEvent;
+import org.eclipse.scout.rt.client.ui.form.IFormFieldVisitor;
+import org.eclipse.scout.rt.client.ui.form.fields.AbstractValueField;
+import org.eclipse.scout.rt.client.ui.form.fields.ICompositeField;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.shared.data.form.ValidationRule;
+import org.eclipse.scout.rt.shared.services.common.code.ICodeType;
+import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
+import org.eclipse.scout.rt.shared.services.lookup.CodeLookupCall;
+import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
+import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
+import org.eclipse.scout.service.SERVICES;
+
+public abstract class AbstractTreeBox<T> extends AbstractValueField<T[]> implements ITreeBox<T> {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractTreeBox.class);
+
+ private ITree m_tree;
+ private LookupCall m_lookupCall;
+ private Class<? extends ICodeType> m_codeTypeClass;
+ private boolean m_valueTreeSyncActive;
+ private boolean m_autoExpandAll;
+ private boolean m_loadIncremental;
+ private ITreeBoxUIFacade m_uiFacade;
+ private ITreeNodeFilter m_activeNodesFilter;
+ private ITreeNodeFilter m_checkedNodesFilter;
+ // children
+ private IFormField[] m_fields;
+
+ public AbstractTreeBox() {
+ this(true);
+ }
+
+ public AbstractTreeBox(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ /*
+ * Configuration
+ */
+ /**
+ * Called to (re)load children of a node.
+ * <p>
+ * When loadIncremental=false then this method is only called once on the invisible root node.<br>
+ * When loadIncremental=true then this method is called on every node.
+ * <p>
+ * The default implementation is:
+ *
+ * <pre>
+ * ITreeNode[] children;
+ * if (isLoadIncremental()) {
+ * children = callChildLookup(parentNode);
+ * }
+ * else {
+ * children = callCompleteTreeLookup();
+ * }
+ * getTree().removeAllChildNodes(parentNode);
+ * getTree().addChildNodes(parentNode, children);
+ * parentNode.setChildrenLoaded(true);
+ * </pre>
+ */
+ @ConfigOperation
+ @Order(240)
+ protected void execLoadChildNodes(ITreeNode parentNode) throws ProcessingException {
+ ITreeNode[] children;
+ if (isLoadIncremental()) {
+ children = callChildLookup(parentNode);
+ }
+ else {
+ children = callCompleteTreeLookup();
+ }
+ m_tree.removeAllChildNodes(parentNode);
+ m_tree.addChildNodes(parentNode, children);
+ parentNode.setChildrenLoaded(true);
+ }
+
+ @ConfigProperty(ConfigProperty.LOOKUP_CALL)
+ @Order(240)
+ @ConfigPropertyValue("null")
+ @ValidationRule(ValidationRule.LOOKUP_CALL)
+ protected Class<? extends LookupCall> getConfiguredLookupCall() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.CODE_TYPE)
+ @Order(250)
+ @ConfigPropertyValue("null")
+ @ValidationRule(ValidationRule.CODE_TYPE)
+ protected Class<? extends ICodeType> getConfiguredCodeType() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.ICON_ID)
+ @Order(230)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredIconId() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(260)
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredAutoLoad() {
+ return true;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(270)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredLoadIncremental() {
+ return false;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(280)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredAutoExpandAll() {
+ return false;
+ }
+
+ /**
+ * @return true: a filter is added to the treebox tree that only accepts nodes
+ * that are active or checked.<br>
+ * Affects {@link ITreeNode#getFilteredChildNodes()}
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(290)
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredFilterActiveNodes() {
+ return false;
+ }
+
+ /**
+ * @return true: a filter is added to the treebox tree that only accepts
+ * checked nodes<br>
+ * Affects {@link ITreeNode#getFilteredChildNodes()}
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(300)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredFilterCheckedNodes() {
+ return false;
+ }
+
+ @Override
+ @ConfigPropertyValue("1.0")
+ protected double getConfiguredGridWeightY() {
+ return 1.0;
+ }
+
+ private Class<? extends IFormField>[] getConfiguredFields() {
+ Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
+ return ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, IFormField.class);
+ }
+
+ /**
+ * called before any lookup is performed
+ */
+ @ConfigOperation
+ @Order(230)
+ protected void execPrepareLookup(LookupCall call, ITreeNode parent) throws ProcessingException {
+ }
+
+ /**
+ * @param call
+ * that produced this result
+ * @param result
+ * live list containing the result rows. Add, remove, set, replace
+ * and clear of entries in this list is supported
+ */
+ @ConfigOperation
+ @Order(240)
+ protected void execFilterLookupResult(LookupCall call, List<LookupRow> result) throws ProcessingException {
+ }
+
+ /**
+ * @param newNode
+ * a new node that was created for the tree, but not yet attached to the tree
+ * @param treeLevel
+ * Since {@link ITreeNode#getTreeLevel()} is not yet valid, treeLevel is the level where the node will be
+ * attached at
+ * <p>
+ * Can be useful for example to disable nodes on some levels so they cannot be checked.
+ */
+ @ConfigOperation
+ @Order(250)
+ protected void execFilterNewNode(ITreeNode newNode, int treeLevel) throws ProcessingException {
+ }
+
+ private Class<? extends ITree> getConfiguredTree() {
+ Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
+ Class<? extends ITree>[] f = ConfigurationUtility.filterClasses(dca, ITree.class);
+ if (f.length == 1) {
+ return f[0];
+ }
+ else {
+ for (Class<? extends ITree> c : f) {
+ if (c.getDeclaringClass() != AbstractTreeBox.class) {
+ return c;
+ }
+ }
+ return null;
+ }
+ }
+
+ @Override
+ protected void execChangedMasterValue(Object newMasterValue) throws ProcessingException {
+ setValue(null);
+ loadRootNode();
+ }
+
+ @Override
+ protected void initConfig() {
+ m_uiFacade = createUIFacade();
+ m_fields = new IFormField[0];
+ super.initConfig();
+ setFilterActiveNodes(getConfiguredFilterActiveNodes());
+ setFilterActiveNodesValue(TriState.TRUE);
+ setFilterCheckedNodes(getConfiguredFilterCheckedNodes());
+ setFilterCheckedNodesValue(getConfiguredFilterCheckedNodes());
+ setAutoExpandAll(getConfiguredAutoExpandAll());
+ setLoadIncremental(getConfiguredLoadIncremental());
+ try {
+ m_tree = ConfigurationUtility.newInnerInstance(this, getConfiguredTree());
+ if (m_tree instanceof AbstractTree) {
+ ((AbstractTree) m_tree).setContainerInternal(this);
+ }
+ m_tree.setRootNode(getTreeNodeBuilder().createTreeNode(new LookupRow(null, "Root"), ITreeNode.STATUS_NON_CHANGED, false));
+ m_tree.setAutoDiscardOnDelete(false);
+ updateActiveNodesFilter();
+ updateCheckedNodesFilter();
+ m_tree.addTreeListener(
+ new TreeAdapter() {
+ @Override
+ public void treeChanged(TreeEvent e) {
+ switch (e.getType()) {
+ case TreeEvent.TYPE_NODES_SELECTED: {
+ if (!getTree().isCheckable()) {
+ syncTreeToValue();
+ }
+ break;
+ }
+ case TreeEvent.TYPE_NODES_UPDATED: {
+ if (getTree().isCheckable()) {
+ syncTreeToValue();
+ }
+ break;
+ }
+ }
+ }
+ }
+ );
+ m_tree.setEnabled(isEnabled());
+ // default icon
+ if (this.getConfiguredIconId() != null) {
+ m_tree.setIconId(this.getConfiguredIconId());
+ }
+ }
+ catch (Exception e) {
+ LOG.warn(null, e);
+ }
+ if (getConfiguredLookupCall() != null) {
+ try {
+ LookupCall call = getConfiguredLookupCall().newInstance();
+ setLookupCall(call);
+ }
+ catch (Exception e) {
+ LOG.warn(null, e);
+ }
+ }
+ // code type
+ if (getConfiguredCodeType() != null) {
+ setCodeTypeClass(getConfiguredCodeType());
+ }
+ // local property listener
+ addPropertyChangeListener(new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent e) {
+ if (m_tree != null) {
+ String name = e.getPropertyName();
+ if (PROP_ENABLED.equals(name)) {
+ m_tree.setEnabled(isEnabled());
+ }
+ else if (PROP_FILTER_CHECKED_NODES_VALUE.equals(name)) {
+ updateCheckedNodesFilter();
+ }
+ else if (PROP_FILTER_ACTIVE_NODES_VALUE.equals(name)) {
+ updateActiveNodesFilter();
+ }
+ }
+ }
+ });
+ // add fields
+ ArrayList<IFormField> fieldList = new ArrayList<IFormField>();
+ Class<? extends IFormField>[] fieldArray = getConfiguredFields();
+ for (int i = 0; i < fieldArray.length; i++) {
+ IFormField f;
+ try {
+ f = ConfigurationUtility.newInnerInstance(this, fieldArray[i]);
+ fieldList.add(f);
+ }// end try
+ catch (Throwable t) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("field: " + fieldArray[i].getName(), t));
+ }
+ }
+ for (IFormField f : fieldList) {
+ f.setParentFieldInternal(this);
+ }
+ m_fields = fieldList.toArray(new IFormField[0]);
+ }
+
+ @Override
+ protected void initFieldInternal() throws ProcessingException {
+ getTree().initTree();
+ if (getConfiguredAutoLoad()) {
+ try {
+ setValueChangeTriggerEnabled(false);
+ //
+ loadRootNode();
+ }
+ finally {
+ setValueChangeTriggerEnabled(true);
+ }
+ }
+ super.initFieldInternal();
+ }
+
+ @Override
+ protected void disposeFieldInternal() {
+ super.disposeFieldInternal();
+ getTree().disposeTree();
+ }
+
+ public TreeBoxFilterBox getTreeBoxFilterBox() {
+ return getFieldByClass(TreeBoxFilterBox.class);
+ }
+
+ /*
+ * Runtime
+ */
+ @Override
+ public final ITree getTree() {
+ return m_tree;
+ }
+
+ protected ITreeBoxUIFacade createUIFacade() {
+ return new P_TreeBoxUIFacade();
+ }
+
+ @Override
+ public ITreeBoxUIFacade getUIFacade() {
+ return m_uiFacade;
+ }
+
+ @Override
+ public void loadRootNode() throws ProcessingException {
+ loadChildNodes(m_tree.getRootNode());
+ }
+
+ @Override
+ public final void loadChildNodes(ITreeNode parentNode) throws ProcessingException {
+ if (m_tree != null) {
+ try {
+ m_valueTreeSyncActive = true;
+ m_tree.setTreeChanging(true);
+ //
+ execLoadChildNodes(parentNode);
+ // when tree is non-incremental, mark all leaf cadidates as leafs
+ if (!isLoadIncremental()) {
+ ITreeVisitor v = new ITreeVisitor() {
+ @Override
+ public boolean visit(ITreeNode node) {
+ if (node.getChildNodeCount() == 0) {
+ node.setLeafInternal(true);
+ }
+ else {
+ node.setLeafInternal(false);
+ }
+ return true;
+ }
+ };
+ getTree().visitNode(getTree().getRootNode(), v);
+ }
+ // auto-expand all
+ if (isAutoExpandAll()) {
+ m_tree.expandAll(parentNode);
+ }
+ }
+ finally {
+ m_tree.setTreeChanging(false);
+ m_valueTreeSyncActive = false;
+ }
+ syncValueToTree();
+ }
+ }
+
+ public AbstractTreeNodeBuilder getTreeNodeBuilder() {
+ return new P_TreeNodeBuilder();
+ }
+
+ private void prepareLookupCall(LookupCall call, ITreeNode parent) throws ProcessingException {
+ prepareLookupCallInternal(call, parent);
+ execPrepareLookup(call, parent);
+ }
+
+ /**
+ * do not use this internal method directly
+ */
+ private void prepareLookupCallInternal(LookupCall call, ITreeNode parent) {
+ // set parent key
+ if (parent != null) {
+ call.setRec(parent.getPrimaryKey());
+ }
+ else {
+ call.setRec(null);
+ }
+ //when there is a master value defined in the original call, don't set it to null when no master value is available
+ if (getMasterValue() != null || getLookupCall() == null || getLookupCall().getMaster() == null) {
+ call.setMaster(getMasterValue());
+ }
+ }
+
+ @Override
+ public final LookupCall getLookupCall() {
+ return m_lookupCall;
+ }
+
+ @Override
+ public void setLookupCall(LookupCall call) {
+ m_lookupCall = call;
+ }
+
+ @Override
+ public Class<? extends ICodeType> getCodeTypeClass() {
+ return m_codeTypeClass;
+ }
+
+ @Override
+ public void setCodeTypeClass(Class<? extends ICodeType> codeTypeClass) {
+ m_codeTypeClass = codeTypeClass;
+ // create lookup service call
+ m_lookupCall = null;
+ if (m_codeTypeClass != null) {
+ m_lookupCall = CodeLookupCall.newInstanceByService(m_codeTypeClass);
+ }
+ }
+
+ @Override
+ public ITreeNode[] callChildLookup(ITreeNode parentNode) throws ProcessingException {
+ LookupRow[] data = null;
+ LookupCall call = getLookupCall();
+ if (call != null) {
+ call = SERVICES.getService(ILookupCallProvisioningService.class).newClonedInstance(call, new FormFieldProvisioningContext(AbstractTreeBox.this));
+ prepareLookupCall(call, parentNode);
+ data = call.getDataByRec();
+ data = filterLookupResult(call, data);
+ ITreeNode[] subTree = getTreeNodeBuilder().createTreeNodes(data, ITreeNode.STATUS_NON_CHANGED, false);
+ filterNewNodesRec(subTree, parentNode != null ? parentNode.getTreeLevel() + 1 : 0);
+ return subTree;
+ }
+ else {
+ return new ITreeNode[0];
+ }
+ }
+
+ @Override
+ public ITreeNode[] callCompleteTreeLookup() throws ProcessingException {
+ LookupRow[] data = null;
+ LookupCall call = getLookupCall();
+ if (call != null) {
+ call = SERVICES.getService(ILookupCallProvisioningService.class).newClonedInstance(call, new FormFieldProvisioningContext(AbstractTreeBox.this));
+ prepareLookupCall(call, null);
+ data = call.getDataByAll();
+ data = filterLookupResult(call, data);
+ if (data != null && data.length > 1000) {
+ LOG.warn("TreeBox " + getClass().getSimpleName() + " has loadIncremental=false but produced more than 1000 rows; check if this is intended.");
+ }
+ ITreeNode[] subTree = getTreeNodeBuilder().createTreeNodes(data, ITreeNode.STATUS_NON_CHANGED, true);
+ filterNewNodesRec(subTree, 0);
+ return subTree;
+ }
+ else {
+ return new ITreeNode[0];
+ }
+ }
+
+ private LookupRow[] filterLookupResult(LookupCall call, LookupRow[] data) throws ProcessingException {
+ ArrayList<LookupRow> result;
+ if (data != null) {
+ result = new ArrayList<LookupRow>(Arrays.asList(data));
+ }
+ else {
+ result = new ArrayList<LookupRow>();
+ }
+ execFilterLookupResult(call, result);
+ int len = 0;
+ for (LookupRow r : result) {
+ if (r != null) {
+ len++;
+ }
+ }
+ LookupRow[] a = new LookupRow[len];
+ int index = 0;
+ for (LookupRow r : result) {
+ if (r != null) {
+ a[index] = r;
+ index++;
+ }
+ }
+ return a;
+ }
+
+ private void filterNewNodesRec(ITreeNode[] nodes, int level) throws ProcessingException {
+ if (nodes != null) {
+ for (ITreeNode node : nodes) {
+ if (node != null) {
+ execFilterNewNode(node, level);
+ filterNewNodesRec(node.getChildNodes(), level + 1);
+ }
+ }
+ }
+ }
+
+ @Override
+ protected void valueChangedInternal() {
+ super.valueChangedInternal();
+ syncValueToTree();
+ }
+
+ @Override
+ protected String formatValueInternal(T[] validValue) {
+ if (validValue == null || validValue.length == 0) {
+ return "";
+ }
+ StringBuffer b = new StringBuffer();
+ ITreeNode[] nodes = getTree().findNodes(validValue);
+ for (int i = 0; i < nodes.length; i++) {
+ if (i > 0) {
+ b.append(", ");
+ }
+ b.append(nodes[i].getCell().getText());
+ }
+ return b.toString();
+ }
+
+ @Override
+ protected T[] validateValueInternal(T[] rawValue) {
+ T[] validValue = rawValue;
+ //
+ if (validValue != null && validValue.length == 0) {
+ validValue = null;
+ }
+ ITree tree = getTree();
+ if (tree != null && validValue != null) {
+ if ((tree.isCheckable() && !tree.isMultiCheck()) || (!tree.isCheckable() && !tree.isMultiSelect())) {
+ //only single value
+ if (validValue.length > 1) {
+ LOG.warn(getClass().getName() + " only accepts a single value. Got " + Arrays.toString(validValue) + ". Using only first value.");
+ @SuppressWarnings("unchecked")
+ T[] newArray = (T[]) Array.newInstance(validValue.getClass().getComponentType(), 1);
+ newArray[0] = validValue[0];
+ validValue = newArray;
+ }
+ }
+ }
+ return validValue;
+ }
+
+ @Override
+ public T getSingleValue() {
+ T[] a = getValue();
+ if (a != null && a.length > 0) {
+ return a[0];
+ }
+ else {
+ return null;
+ }
+ }
+
+ @Override
+ public void setSingleValue(T value) {
+ if (value == null) {
+ setValue(null);
+ }
+ else {
+ @SuppressWarnings("unchecked")
+ T[] array = (T[]) Array.newInstance(getHolderType().getComponentType(), 1);
+ array[0] = value;
+ setValue(array);
+ }
+ }
+
+ @Override
+ public int getCheckedKeyCount() {
+ T[] keys = getValue();
+ if (keys != null) {
+ return keys.length;
+ }
+ else {
+ return 0;
+ }
+ }
+
+ @Override
+ public T getCheckedKey() {
+ T[] a = getCheckedKeys();
+ if (a != null && a.length > 0) {
+ return a[0];
+ }
+ else {
+ return null;
+ }
+ }
+
+ @Override
+ public T[] getCheckedKeys() {
+ return getValue();
+ }
+
+ @Override
+ public LookupRow getCheckedLookupRow() {
+ LookupRow[] a = getCheckedLookupRows();
+ if (a != null && a.length > 0) {
+ return a[0];
+ }
+ else {
+ return null;
+ }
+ }
+
+ @Override
+ public LookupRow[] getCheckedLookupRows() {
+ LookupRow[] lookupRows = null;
+ ITreeNode[] treeNodes = getTree().getCheckedNodes();
+ if (treeNodes != null) {
+ lookupRows = new LookupRow[treeNodes.length];
+ for (int i = 0; i < treeNodes.length; i++) {
+ ITreeNode node = treeNodes[i];
+ ICell cell = node.getCell();
+ ITreeNode parentNode = node.getParentNode();
+ lookupRows[i] = new LookupRow(node.getPrimaryKey(), cell.getText(), cell.getIconId(), cell.getTooltipText(), cell.getBackgroundColor(), cell.getForegroundColor(), cell.getFont(), cell.isEnabled(), parentNode != null ? parentNode.getPrimaryKey() : null, isNodeActive(node));
+ }
+ }
+ return lookupRows;
+ }
+
+ @Override
+ public void checkKey(T key) {
+ if (key == null) {
+ checkKeys(null);
+ }
+ else {
+ @SuppressWarnings("unchecked")
+ T[] array = (T[]) Array.newInstance(getHolderType().getComponentType(), 1);
+ array[0] = key;
+ checkKeys(array);
+ }
+ }
+
+ @Override
+ public void checkKeys(T[] keys) {
+ setValue(keys);
+ }
+
+ @Override
+ public void uncheckAllKeys() {
+ checkKeys(null);
+ }
+
+ @Override
+ public T[] getUncheckedKeys() {
+ HashSet<T> set = new HashSet<T>();
+ T[] a = getInitValue();
+ if (a != null) {
+ set.addAll(Arrays.asList(a));
+ }
+ a = getCheckedKeys();
+ if (a != null) {
+ set.removeAll(Arrays.asList(a));
+ }
+ @SuppressWarnings("unchecked")
+ T[] array = (T[]) Array.newInstance(getHolderType().getComponentType(), 0);
+ a = set.toArray(array);
+ if (a.length == 0) {
+ a = null;
+ }
+ return a;
+ }
+
+ @Override
+ public void checkAllKeys() {
+ final HashSet<T> keySet = new HashSet<T>();
+ ITreeVisitor v = new ITreeVisitor() {
+ @SuppressWarnings("unchecked")
+ @Override
+ public boolean visit(ITreeNode node) {
+ if (node.getPrimaryKey() != null) {
+ keySet.add((T) node.getPrimaryKey());
+ }
+ return true;
+ }
+ };
+ m_tree.visitNode(m_tree.getRootNode(), v);
+ @SuppressWarnings("unchecked")
+ T[] array = (T[]) Array.newInstance(getHolderType().getComponentType(), 0);
+ checkKeys(keySet.toArray(array));
+ }
+
+ @Override
+ public boolean isLoadIncremental() {
+ return m_loadIncremental;
+ }
+
+ @Override
+ public void setLoadIncremental(boolean b) {
+ m_loadIncremental = b;
+ }
+
+ @Override
+ public boolean isAutoExpandAll() {
+ return m_autoExpandAll;
+ }
+
+ @Override
+ public void setAutoExpandAll(boolean b) {
+ m_autoExpandAll = b;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public boolean isNodeActive(ITreeNode node) {
+ if (node instanceof AbstractTreeBox.P_InternalTreeNode) {
+ return ((P_InternalTreeNode) node).isActive();
+ }
+ else {
+ return false;
+ }
+ }
+
+ @Override
+ public boolean isFilterActiveNodes() {
+ return propertySupport.getPropertyBool(PROP_FILTER_ACTIVE_NODES);
+ }
+
+ @Override
+ public void setFilterActiveNodes(boolean b) {
+ propertySupport.setPropertyBool(PROP_FILTER_ACTIVE_NODES, b);
+ }
+
+ @Override
+ public boolean getFilterCheckedNodesValue() {
+ return propertySupport.getPropertyBool(PROP_FILTER_CHECKED_NODES_VALUE);
+ }
+
+ @Override
+ public void setFilterCheckedNodesValue(boolean b) {
+ propertySupport.setPropertyBool(PROP_FILTER_CHECKED_NODES_VALUE, b);
+ }
+
+ @Override
+ public boolean isFilterCheckedNodes() {
+ return propertySupport.getPropertyBool(PROP_FILTER_CHECKED_NODES);
+ }
+
+ @Override
+ public void setFilterCheckedNodes(boolean b) {
+ propertySupport.setPropertyBool(PROP_FILTER_CHECKED_NODES, b);
+ }
+
+ @Override
+ public TriState getFilterActiveNodesValue() {
+ return (TriState) propertySupport.getProperty(PROP_FILTER_ACTIVE_NODES_VALUE);
+ }
+
+ @Override
+ public void setFilterActiveNodesValue(TriState t) {
+ if (t == null) {
+ t = TriState.TRUE;
+ }
+ propertySupport.setProperty(PROP_FILTER_ACTIVE_NODES_VALUE, t);
+ }
+
+ private void updateActiveNodesFilter() {
+ try {
+ m_tree.setTreeChanging(true);
+ //
+ if (m_activeNodesFilter != null) {
+ m_tree.removeNodeFilter(m_activeNodesFilter);
+ m_activeNodesFilter = null;
+ }
+ m_activeNodesFilter = new ActiveOrCheckedNodesFilter(this, getFilterActiveNodesValue());
+ m_tree.addNodeFilter(m_activeNodesFilter);
+ }
+ finally {
+ m_tree.setTreeChanging(false);
+ }
+ }
+
+ private void updateCheckedNodesFilter() {
+ try {
+ m_tree.setTreeChanging(true);
+ //
+ if (m_checkedNodesFilter != null) {
+ m_tree.removeNodeFilter(m_checkedNodesFilter);
+ m_checkedNodesFilter = null;
+ }
+ if (getFilterCheckedNodesValue()) {
+ m_checkedNodesFilter = new CheckedNodesFilter();
+ m_tree.addNodeFilter(m_checkedNodesFilter);
+ }
+ }
+ finally {
+ m_tree.setTreeChanging(false);
+ }
+ }
+
+ private void syncValueToTree() {
+ if (m_valueTreeSyncActive) {
+ return;
+ }
+ try {
+ m_valueTreeSyncActive = true;
+ getTree().setTreeChanging(true);
+ //
+ T[] checkedKeys = getCheckedKeys();
+ ITreeNode[] checkedNodes = m_tree.findNodes(checkedKeys);
+ getTree().visitTree(new ITreeVisitor() {
+ @Override
+ public boolean visit(ITreeNode node) {
+ node.setChecked(false);
+ return true;
+ }
+ });
+ for (ITreeNode node : checkedNodes) {
+ node.setChecked(true);
+ }
+ if (!getTree().isCheckable()) {
+ getTree().selectNodes(checkedNodes, false);
+ }
+ }
+ finally {
+ getTree().setTreeChanging(false);
+ m_valueTreeSyncActive = false;
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private void syncTreeToValue() {
+ if (m_valueTreeSyncActive) {
+ return;
+ }
+ try {
+ m_valueTreeSyncActive = true;
+ getTree().setTreeChanging(true);
+ //
+ T[] checkedKeys = null;
+ ITreeNode[] checkedNodes;
+ if (getTree().isCheckable()) {
+ checkedNodes = m_tree.getCheckedNodes();
+ }
+ else {
+ checkedNodes = m_tree.getSelectedNodes();
+ }
+ checkedKeys = (T[]) Array.newInstance(getHolderType().getComponentType(), checkedNodes.length);
+ for (int i = 0; i < checkedNodes.length; i++) {
+ checkedKeys[i] = (T) checkedNodes[i].getPrimaryKey();
+ }
+ checkKeys(checkedKeys);
+ if (!getTree().isCheckable()) {
+ //checks follow selection
+ getTree().visitTree(new ITreeVisitor() {
+ @Override
+ public boolean visit(ITreeNode node) {
+ node.setChecked(node.isSelectedNode());
+ return true;
+ }
+ });
+ }
+ }
+ finally {
+ getTree().setTreeChanging(false);
+ m_valueTreeSyncActive = false;
+ }
+ // check if row filter needs to change
+ if (!m_tree.getUIFacade().isUIProcessing()) {
+ updateActiveNodesFilter();
+ }
+ updateCheckedNodesFilter();
+ }
+
+ /*
+ * Implementation of ICompositeField
+ */
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public <F extends IFormField> F getFieldByClass(final Class<F> c) {
+ final Holder<IFormField> found = new Holder<IFormField>(IFormField.class);
+ IFormFieldVisitor v = new IFormFieldVisitor() {
+ @Override
+ public boolean visitField(IFormField field, int level, int fieldIndex) {
+ if (field.getClass() == c) {
+ found.setValue(field);
+ }
+ return found.getValue() == null;
+ }
+ };
+ visitFields(v, 0);
+ return (F) found.getValue();
+ }
+
+ @Override
+ public IFormField getFieldById(final String id) {
+ final Holder<IFormField> found = new Holder<IFormField>(IFormField.class);
+ IFormFieldVisitor v = new IFormFieldVisitor() {
+ @Override
+ public boolean visitField(IFormField field, int level, int fieldIndex) {
+ if (field.getFieldId().equals(id)) {
+ found.setValue(field);
+ }
+ return found.getValue() == null;
+ }
+ };
+ visitFields(v, 0);
+ return found.getValue();
+ }
+
+ @Override
+ public <X extends IFormField> X getFieldById(final String id, final Class<X> type) {
+ final Holder<X> found = new Holder<X>(type);
+ IFormFieldVisitor v = new IFormFieldVisitor() {
+ @Override
+ @SuppressWarnings("unchecked")
+ public boolean visitField(IFormField field, int level, int fieldIndex) {
+ if (type.isAssignableFrom(field.getClass()) && field.getFieldId().equals(id)) {
+ found.setValue((X) field);
+ }
+ return found.getValue() == null;
+ }
+ };
+ visitFields(v, 0);
+ return found.getValue();
+ }
+
+ @Override
+ public int getFieldCount() {
+ return m_fields.length;
+ }
+
+ @Override
+ public int getFieldIndex(IFormField f) {
+ for (int i = 0; i < m_fields.length; i++) {
+ if (m_fields[i] == f) {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+ @Override
+ public IFormField[] getFields() {
+ IFormField[] a = new IFormField[m_fields.length];
+ System.arraycopy(m_fields, 0, a, 0, a.length);
+ return a;
+ }
+
+ @Override
+ public boolean visitFields(IFormFieldVisitor visitor, int startLevel) {
+ // myself
+ if (!visitor.visitField(this, startLevel, 0)) {
+ return false;
+ }
+ // children
+ int index = 0;
+ IFormField[] f = m_fields;
+ for (int i = 0; i < f.length; i++) {
+ if (f[i] instanceof ICompositeField) {
+ if (!((ICompositeField) f[i]).visitFields(visitor, startLevel + 1)) {
+ return false;
+ }
+ }
+ else {
+ if (!visitor.visitField(f[i], startLevel, index)) {
+ return false;
+ }
+ }
+ index++;
+ }
+ return true;
+ }
+
+ @Override
+ public final int getGridColumnCount() {
+ return 1;
+ }
+
+ @Override
+ public final int getGridRowCount() {
+ return 1;
+ }
+
+ @Override
+ public void rebuildFieldGrid() {
+ }
+
+ @Order(1)
+ public class TreeBoxFilterBox extends AbstractTreeBoxFilterBox {
+ @Override
+ protected ITreeBox getTreeBox() {
+ return AbstractTreeBox.this;
+ }
+ }
+
+ /**
+ * TreeNode implementation with delegation of loadChildren to
+ * this.loadChildNodes()
+ */
+ private class P_InternalTreeNode extends AbstractTreeNode {
+ private boolean m_active;
+
+ public boolean isActive() {
+ return m_active;
+ }
+
+ public void setActive(boolean b) {
+ m_active = b;
+ }
+
+ @Override
+ public void loadChildren() throws ProcessingException {
+ if (isLoadIncremental()) {
+ AbstractTreeBox.this.loadChildNodes(this);
+ }
+ else {
+ setChildrenLoaded(true);
+ }
+ }
+ }
+
+ private class P_TreeNodeBuilder extends AbstractTreeNodeBuilder {
+
+ @Override
+ protected ITreeNode createEmptyTreeNode() throws ProcessingException {
+ return new P_InternalTreeNode();
+ }
+
+ @Override
+ public ITreeNode createTreeNode(LookupRow lookupRow, int nodeStatus, boolean markChildrenLoaded) throws ProcessingException {
+ @SuppressWarnings("unchecked")
+ P_InternalTreeNode treeNode = (P_InternalTreeNode) super.createTreeNode(lookupRow, nodeStatus, markChildrenLoaded);
+ treeNode.setActive(lookupRow.isActive());
+ return treeNode;
+ }
+
+ }
+
+ @Order(10000)
+ public class DefaultTreeBoxTree extends AbstractTree {
+
+ @ConfigPropertyValue("false")
+ @Override
+ protected boolean getConfiguredMultiSelect() {
+ return false;
+ }
+
+ @ConfigPropertyValue("true")
+ @Override
+ protected boolean getConfiguredCheckable() {
+ return true;
+ }
+
+ @ConfigPropertyValue("false")
+ @Override
+ protected boolean getConfiguredRootNodeVisible() {
+ return false;
+ }
+ }
+
+ /*
+ * UI Notifications
+ */
+ protected class P_TreeBoxUIFacade implements ITreeBoxUIFacade {
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/treebox/AbstractTreeBoxFilterBox.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/treebox/AbstractTreeBoxFilterBox.java
index edafad4932..609bf56be3 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/treebox/AbstractTreeBoxFilterBox.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/treebox/AbstractTreeBoxFilterBox.java
@@ -1,386 +1,386 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.treebox;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-
-import org.eclipse.scout.commons.OptimisticLock;
-import org.eclipse.scout.commons.TriState;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractButton;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
-import org.eclipse.scout.rt.client.ui.form.fields.radiobuttongroup.AbstractRadioButtonGroup;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.services.common.jdbc.SearchFilter;
-
-/**
- * Filter panel normally displayed in the ui (swing, swt) below the treebox
- * table. Showing 2 radio button groups, one for checked filter, one for active
- * filter. o show checked o show all o show active o show inactive o show all
- */
-public abstract class AbstractTreeBoxFilterBox extends AbstractGroupBox {
- private final OptimisticLock m_treeBoxSyncLock;
- private PropertyChangeListener m_treeBoxPropertyListener;
-
- public AbstractTreeBoxFilterBox() {
- this(true);
- }
-
- public AbstractTreeBoxFilterBox(boolean callInitializer) {
- super(callInitializer);
- m_treeBoxSyncLock = new OptimisticLock();
- }
-
- protected abstract ITreeBox getTreeBox();
-
- @Override
- protected boolean getConfiguredBorderVisible() {
- return false;
- }
-
- @Override
- protected int getConfiguredGridW() {
- return 1;
- }
-
- @Override
- protected boolean getConfiguredGridUseUiHeight() {
- return true;
- }
-
- @Override
- protected int getConfiguredGridColumnCount() {
- return 1;
- }
-
- @Override
- protected void execInitField() throws ProcessingException {
- if (m_treeBoxPropertyListener == null) {
- m_treeBoxPropertyListener = new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent e) {
- String name = e.getPropertyName();
- if (ITreeBox.PROP_FILTER_CHECKED_NODES.equals(name)) {
- updateVisibilities();
- }
- else if (ITreeBox.PROP_FILTER_ACTIVE_NODES.equals(name)) {
- updateVisibilities();
- }
- else if (ITreeBox.PROP_FILTER_CHECKED_NODES_VALUE.equals(name)) {
- try {
- if (m_treeBoxSyncLock.acquire()) {
- getCheckedStateRadioButtonGroup().setValue(getTreeBox().getFilterCheckedNodesValue());
- }
- }
- finally {
- m_treeBoxSyncLock.release();
- }
- }
- else if (ITreeBox.PROP_FILTER_ACTIVE_NODES_VALUE.equals(name)) {
- try {
- if (m_treeBoxSyncLock.acquire()) {
- getActiveStateRadioButtonGroup().setValue(getTreeBox().getFilterActiveNodesValue());
- }
- }
- finally {
- m_treeBoxSyncLock.release();
- }
- }
- }
- };
- getTreeBox().addPropertyChangeListener(m_treeBoxPropertyListener);
- }
- try {
- m_treeBoxSyncLock.acquire();
- //
- updateVisibilities();
- getCheckedStateRadioButtonGroup().setValue(getTreeBox().getFilterCheckedNodesValue());
- getActiveStateRadioButtonGroup().setValue(getTreeBox().getFilterActiveNodesValue());
- }
- finally {
- m_treeBoxSyncLock.release();
- }
- }
-
- protected void updateVisibilities() {
- this.setVisible(getTreeBox().isFilterCheckedNodes() || getTreeBox().isFilterActiveNodes());
- getCheckedStateRadioButtonGroup().setVisible(getTreeBox().isFilterCheckedNodes());
- getActiveStateRadioButtonGroup().setVisible(getTreeBox().isFilterActiveNodes());
- }
-
- @Override
- protected void execDisposeField() throws ProcessingException {
- if (m_treeBoxPropertyListener != null) {
- getTreeBox().removePropertyChangeListener(m_treeBoxPropertyListener);
- m_treeBoxPropertyListener = null;
- }
- }
-
- @Order(10)
- public class CheckedStateRadioButtonGroup extends AbstractRadioButtonGroup<Boolean> {
-
- @Override
- protected void execAddSearchTerms(SearchFilter search) {
- //nop
- }
-
- @Override
- protected boolean getConfiguredGridUseUiHeight() {
- return true;
- }
-
- @Override
- protected boolean getConfiguredGridUseUiWidth() {
- return true;
- }
-
- @Override
- protected double getConfiguredGridWeightX() {
- return 1;
- }
-
- @Override
- protected boolean getConfiguredLabelVisible() {
- return false;
- }
-
- @Override
- protected boolean execIsEmpty() throws ProcessingException {
- return true;
- }
-
- @Override
- protected boolean execIsSaveNeeded() throws ProcessingException {
- return false;
- }
-
- @Override
- protected void execChangedValue() throws ProcessingException {
- try {
- if (m_treeBoxSyncLock.acquire()) {
- Boolean b = getCheckedStateRadioButtonGroup().getValue();
- getTreeBox().setFilterCheckedNodesValue(b != null && b);
- }
- }
- finally {
- m_treeBoxSyncLock.release();
- }
- }
-
- @Order(10)
- public class CheckedButton extends AbstractButton {
-
- @Override
- protected void execAddSearchTerms(SearchFilter search) {
- //nop
- }
-
- @Override
- protected int getConfiguredDisplayStyle() {
- return DISPLAY_STYLE_RADIO;
- }
-
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("SelectedStates");
- }
-
- @Override
- protected Object getConfiguredRadioValue() {
- return true;
- }
-
- @Override
- protected boolean getConfiguredGridUseUiHeight() {
- return true;
- }
- }
-
- @Order(20)
- public class AllButton extends AbstractButton {
-
- @Override
- protected void execAddSearchTerms(SearchFilter search) {
- //nop
- }
-
- @Override
- protected int getConfiguredDisplayStyle() {
- return DISPLAY_STYLE_RADIO;
- }
-
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("AllStates");
- }
-
- @Override
- protected Object getConfiguredRadioValue() {
- return false;
- }
-
- @Override
- protected boolean getConfiguredGridUseUiHeight() {
- return true;
- }
- }
-
- }
-
- @Order(20)
- public class ActiveStateRadioButtonGroup extends AbstractRadioButtonGroup<TriState> {
-
- @Override
- protected void execAddSearchTerms(SearchFilter search) {
- //nop
- }
-
- @Override
- protected boolean getConfiguredGridUseUiHeight() {
- return true;
- }
-
- @Override
- protected boolean getConfiguredGridUseUiWidth() {
- return true;
- }
-
- @Override
- protected double getConfiguredGridWeightX() {
- return 1;
- }
-
- @Override
- protected boolean getConfiguredLabelVisible() {
- return false;
- }
-
- @Override
- protected boolean execIsEmpty() throws ProcessingException {
- return true;
- }
-
- @Override
- protected boolean execIsSaveNeeded() throws ProcessingException {
- return false;
- }
-
- @Override
- protected void execChangedValue() throws ProcessingException {
- try {
- if (m_treeBoxSyncLock.acquire()) {
- getTreeBox().setFilterActiveNodesValue(getActiveStateRadioButtonGroup().getValue());
- }
- }
- finally {
- m_treeBoxSyncLock.release();
- }
- }
-
- @Order(10)
- public class ActiveButton extends AbstractButton {
-
- @Override
- protected void execAddSearchTerms(SearchFilter search) {
- //nop
- }
-
- @Override
- protected int getConfiguredDisplayStyle() {
- return DISPLAY_STYLE_RADIO;
- }
-
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("ActiveStates");
- }
-
- @Override
- protected Object getConfiguredRadioValue() {
- return TriState.TRUE;
- }
-
- @Override
- protected boolean getConfiguredGridUseUiHeight() {
- return true;
- }
- }
-
- @Order(20)
- public class InactiveButton extends AbstractButton {
-
- @Override
- protected void execAddSearchTerms(SearchFilter search) {
- //nop
- }
-
- @Override
- protected int getConfiguredDisplayStyle() {
- return DISPLAY_STYLE_RADIO;
- }
-
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("InactiveStates");
- }
-
- @Override
- protected Object getConfiguredRadioValue() {
- return TriState.FALSE;
- }
-
- @Override
- protected boolean getConfiguredGridUseUiHeight() {
- return true;
- }
- }
-
- @Order(30)
- public class ActiveAndInactiveButton extends AbstractButton {
-
- @Override
- protected void execAddSearchTerms(SearchFilter search) {
- //nop
- }
-
- @Override
- protected int getConfiguredDisplayStyle() {
- return DISPLAY_STYLE_RADIO;
- }
-
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("ActiveAndInactiveStates");
- }
-
- @Override
- protected Object getConfiguredRadioValue() {
- return TriState.UNDEFINED;
- }
-
- @Override
- protected boolean getConfiguredGridUseUiHeight() {
- return true;
- }
- }
- }
-
- public ActiveStateRadioButtonGroup getActiveStateRadioButtonGroup() {
- return getFieldByClass(ActiveStateRadioButtonGroup.class);
- }
-
- public CheckedStateRadioButtonGroup getCheckedStateRadioButtonGroup() {
- return getFieldByClass(CheckedStateRadioButtonGroup.class);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.treebox;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import org.eclipse.scout.commons.OptimisticLock;
+import org.eclipse.scout.commons.TriState;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractButton;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
+import org.eclipse.scout.rt.client.ui.form.fields.radiobuttongroup.AbstractRadioButtonGroup;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.services.common.jdbc.SearchFilter;
+
+/**
+ * Filter panel normally displayed in the ui (swing, swt) below the treebox
+ * table. Showing 2 radio button groups, one for checked filter, one for active
+ * filter. o show checked o show all o show active o show inactive o show all
+ */
+public abstract class AbstractTreeBoxFilterBox extends AbstractGroupBox {
+ private final OptimisticLock m_treeBoxSyncLock;
+ private PropertyChangeListener m_treeBoxPropertyListener;
+
+ public AbstractTreeBoxFilterBox() {
+ this(true);
+ }
+
+ public AbstractTreeBoxFilterBox(boolean callInitializer) {
+ super(callInitializer);
+ m_treeBoxSyncLock = new OptimisticLock();
+ }
+
+ protected abstract ITreeBox getTreeBox();
+
+ @Override
+ protected boolean getConfiguredBorderVisible() {
+ return false;
+ }
+
+ @Override
+ protected int getConfiguredGridW() {
+ return 1;
+ }
+
+ @Override
+ protected boolean getConfiguredGridUseUiHeight() {
+ return true;
+ }
+
+ @Override
+ protected int getConfiguredGridColumnCount() {
+ return 1;
+ }
+
+ @Override
+ protected void execInitField() throws ProcessingException {
+ if (m_treeBoxPropertyListener == null) {
+ m_treeBoxPropertyListener = new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent e) {
+ String name = e.getPropertyName();
+ if (ITreeBox.PROP_FILTER_CHECKED_NODES.equals(name)) {
+ updateVisibilities();
+ }
+ else if (ITreeBox.PROP_FILTER_ACTIVE_NODES.equals(name)) {
+ updateVisibilities();
+ }
+ else if (ITreeBox.PROP_FILTER_CHECKED_NODES_VALUE.equals(name)) {
+ try {
+ if (m_treeBoxSyncLock.acquire()) {
+ getCheckedStateRadioButtonGroup().setValue(getTreeBox().getFilterCheckedNodesValue());
+ }
+ }
+ finally {
+ m_treeBoxSyncLock.release();
+ }
+ }
+ else if (ITreeBox.PROP_FILTER_ACTIVE_NODES_VALUE.equals(name)) {
+ try {
+ if (m_treeBoxSyncLock.acquire()) {
+ getActiveStateRadioButtonGroup().setValue(getTreeBox().getFilterActiveNodesValue());
+ }
+ }
+ finally {
+ m_treeBoxSyncLock.release();
+ }
+ }
+ }
+ };
+ getTreeBox().addPropertyChangeListener(m_treeBoxPropertyListener);
+ }
+ try {
+ m_treeBoxSyncLock.acquire();
+ //
+ updateVisibilities();
+ getCheckedStateRadioButtonGroup().setValue(getTreeBox().getFilterCheckedNodesValue());
+ getActiveStateRadioButtonGroup().setValue(getTreeBox().getFilterActiveNodesValue());
+ }
+ finally {
+ m_treeBoxSyncLock.release();
+ }
+ }
+
+ protected void updateVisibilities() {
+ this.setVisible(getTreeBox().isFilterCheckedNodes() || getTreeBox().isFilterActiveNodes());
+ getCheckedStateRadioButtonGroup().setVisible(getTreeBox().isFilterCheckedNodes());
+ getActiveStateRadioButtonGroup().setVisible(getTreeBox().isFilterActiveNodes());
+ }
+
+ @Override
+ protected void execDisposeField() throws ProcessingException {
+ if (m_treeBoxPropertyListener != null) {
+ getTreeBox().removePropertyChangeListener(m_treeBoxPropertyListener);
+ m_treeBoxPropertyListener = null;
+ }
+ }
+
+ @Order(10)
+ public class CheckedStateRadioButtonGroup extends AbstractRadioButtonGroup<Boolean> {
+
+ @Override
+ protected void execAddSearchTerms(SearchFilter search) {
+ //nop
+ }
+
+ @Override
+ protected boolean getConfiguredGridUseUiHeight() {
+ return true;
+ }
+
+ @Override
+ protected boolean getConfiguredGridUseUiWidth() {
+ return true;
+ }
+
+ @Override
+ protected double getConfiguredGridWeightX() {
+ return 1;
+ }
+
+ @Override
+ protected boolean getConfiguredLabelVisible() {
+ return false;
+ }
+
+ @Override
+ protected boolean execIsEmpty() throws ProcessingException {
+ return true;
+ }
+
+ @Override
+ protected boolean execIsSaveNeeded() throws ProcessingException {
+ return false;
+ }
+
+ @Override
+ protected void execChangedValue() throws ProcessingException {
+ try {
+ if (m_treeBoxSyncLock.acquire()) {
+ Boolean b = getCheckedStateRadioButtonGroup().getValue();
+ getTreeBox().setFilterCheckedNodesValue(b != null && b);
+ }
+ }
+ finally {
+ m_treeBoxSyncLock.release();
+ }
+ }
+
+ @Order(10)
+ public class CheckedButton extends AbstractButton {
+
+ @Override
+ protected void execAddSearchTerms(SearchFilter search) {
+ //nop
+ }
+
+ @Override
+ protected int getConfiguredDisplayStyle() {
+ return DISPLAY_STYLE_RADIO;
+ }
+
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("SelectedStates");
+ }
+
+ @Override
+ protected Object getConfiguredRadioValue() {
+ return true;
+ }
+
+ @Override
+ protected boolean getConfiguredGridUseUiHeight() {
+ return true;
+ }
+ }
+
+ @Order(20)
+ public class AllButton extends AbstractButton {
+
+ @Override
+ protected void execAddSearchTerms(SearchFilter search) {
+ //nop
+ }
+
+ @Override
+ protected int getConfiguredDisplayStyle() {
+ return DISPLAY_STYLE_RADIO;
+ }
+
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("AllStates");
+ }
+
+ @Override
+ protected Object getConfiguredRadioValue() {
+ return false;
+ }
+
+ @Override
+ protected boolean getConfiguredGridUseUiHeight() {
+ return true;
+ }
+ }
+
+ }
+
+ @Order(20)
+ public class ActiveStateRadioButtonGroup extends AbstractRadioButtonGroup<TriState> {
+
+ @Override
+ protected void execAddSearchTerms(SearchFilter search) {
+ //nop
+ }
+
+ @Override
+ protected boolean getConfiguredGridUseUiHeight() {
+ return true;
+ }
+
+ @Override
+ protected boolean getConfiguredGridUseUiWidth() {
+ return true;
+ }
+
+ @Override
+ protected double getConfiguredGridWeightX() {
+ return 1;
+ }
+
+ @Override
+ protected boolean getConfiguredLabelVisible() {
+ return false;
+ }
+
+ @Override
+ protected boolean execIsEmpty() throws ProcessingException {
+ return true;
+ }
+
+ @Override
+ protected boolean execIsSaveNeeded() throws ProcessingException {
+ return false;
+ }
+
+ @Override
+ protected void execChangedValue() throws ProcessingException {
+ try {
+ if (m_treeBoxSyncLock.acquire()) {
+ getTreeBox().setFilterActiveNodesValue(getActiveStateRadioButtonGroup().getValue());
+ }
+ }
+ finally {
+ m_treeBoxSyncLock.release();
+ }
+ }
+
+ @Order(10)
+ public class ActiveButton extends AbstractButton {
+
+ @Override
+ protected void execAddSearchTerms(SearchFilter search) {
+ //nop
+ }
+
+ @Override
+ protected int getConfiguredDisplayStyle() {
+ return DISPLAY_STYLE_RADIO;
+ }
+
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("ActiveStates");
+ }
+
+ @Override
+ protected Object getConfiguredRadioValue() {
+ return TriState.TRUE;
+ }
+
+ @Override
+ protected boolean getConfiguredGridUseUiHeight() {
+ return true;
+ }
+ }
+
+ @Order(20)
+ public class InactiveButton extends AbstractButton {
+
+ @Override
+ protected void execAddSearchTerms(SearchFilter search) {
+ //nop
+ }
+
+ @Override
+ protected int getConfiguredDisplayStyle() {
+ return DISPLAY_STYLE_RADIO;
+ }
+
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("InactiveStates");
+ }
+
+ @Override
+ protected Object getConfiguredRadioValue() {
+ return TriState.FALSE;
+ }
+
+ @Override
+ protected boolean getConfiguredGridUseUiHeight() {
+ return true;
+ }
+ }
+
+ @Order(30)
+ public class ActiveAndInactiveButton extends AbstractButton {
+
+ @Override
+ protected void execAddSearchTerms(SearchFilter search) {
+ //nop
+ }
+
+ @Override
+ protected int getConfiguredDisplayStyle() {
+ return DISPLAY_STYLE_RADIO;
+ }
+
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("ActiveAndInactiveStates");
+ }
+
+ @Override
+ protected Object getConfiguredRadioValue() {
+ return TriState.UNDEFINED;
+ }
+
+ @Override
+ protected boolean getConfiguredGridUseUiHeight() {
+ return true;
+ }
+ }
+ }
+
+ public ActiveStateRadioButtonGroup getActiveStateRadioButtonGroup() {
+ return getFieldByClass(ActiveStateRadioButtonGroup.class);
+ }
+
+ public CheckedStateRadioButtonGroup getCheckedStateRadioButtonGroup() {
+ return getFieldByClass(CheckedStateRadioButtonGroup.class);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/treebox/ActiveOrCheckedNodesFilter.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/treebox/ActiveOrCheckedNodesFilter.java
index f9fc22b949..2da04d1abf 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/treebox/ActiveOrCheckedNodesFilter.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/treebox/ActiveOrCheckedNodesFilter.java
@@ -1,41 +1,41 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.treebox;
-
-import org.eclipse.scout.commons.TriState;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
-
-/**
- * The filter accepts all active rows and in addition all checked rows
- */
-class ActiveOrCheckedNodesFilter extends CheckedNodesFilter {
- private final ITreeBox m_box;
- private final TriState m_filterValue;
-
- public ActiveOrCheckedNodesFilter(ITreeBox box, TriState filterValue) {
- m_box = box;
- m_filterValue = filterValue;
- }
-
- @Override
- public boolean accept(ITreeNode node, int level) {
- Boolean nodeValue = m_box.isNodeActive(node);
- Boolean filterValue = m_filterValue.getBooleanValue();
- if (nodeValue == null || filterValue == null || nodeValue == filterValue) {
- return true;
- }
- else {
- // active mismatch, test checked
- return super.accept(node, level);
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.treebox;
+
+import org.eclipse.scout.commons.TriState;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
+
+/**
+ * The filter accepts all active rows and in addition all checked rows
+ */
+class ActiveOrCheckedNodesFilter extends CheckedNodesFilter {
+ private final ITreeBox m_box;
+ private final TriState m_filterValue;
+
+ public ActiveOrCheckedNodesFilter(ITreeBox box, TriState filterValue) {
+ m_box = box;
+ m_filterValue = filterValue;
+ }
+
+ @Override
+ public boolean accept(ITreeNode node, int level) {
+ Boolean nodeValue = m_box.isNodeActive(node);
+ Boolean filterValue = m_filterValue.getBooleanValue();
+ if (nodeValue == null || filterValue == null || nodeValue == filterValue) {
+ return true;
+ }
+ else {
+ // active mismatch, test checked
+ return super.accept(node, level);
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/treebox/CheckedNodesFilter.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/treebox/CheckedNodesFilter.java
index fab47b3ed8..86ad798aef 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/treebox/CheckedNodesFilter.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/treebox/CheckedNodesFilter.java
@@ -1,32 +1,32 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.treebox;
-
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNodeFilter;
-
-/**
- * The filter accepts all checked rows
- */
-class CheckedNodesFilter implements ITreeNodeFilter {
-
- public CheckedNodesFilter() {
- }
-
- @Override
- public boolean accept(ITreeNode node, int level) {
- if (node.isChecked()) {
- return true;
- }
- return false;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.treebox;
+
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNodeFilter;
+
+/**
+ * The filter accepts all checked rows
+ */
+class CheckedNodesFilter implements ITreeNodeFilter {
+
+ public CheckedNodesFilter() {
+ }
+
+ @Override
+ public boolean accept(ITreeNode node, int level) {
+ if (node.isChecked()) {
+ return true;
+ }
+ return false;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/treebox/ITreeBox.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/treebox/ITreeBox.java
index ef65815f55..c29f49fef9 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/treebox/ITreeBox.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/treebox/ITreeBox.java
@@ -1,157 +1,157 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.treebox;
-
-import org.eclipse.scout.commons.TriState;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITree;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
-import org.eclipse.scout.rt.client.ui.form.fields.ICompositeField;
-import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
-import org.eclipse.scout.rt.shared.services.common.code.ICodeType;
-import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
-import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
-
-/**
- * A treebox represents an array of values which correspond to checked keys in
- * the tree. When setting loadIncremental=false just one LookupCall by
- * <b>all</b> is sent to load all tree nodes. It is expected that the returned {@link LookupRow}s containt their
- * corresponding parentKey or null for root
- * nodes When setting loadIncremental=true a LookupCall by <b>rec</b> is sent
- * whenever a node's children are loaded and contains the parentKey.
- * <p>
- * The listbox value is a ObjectX[] where the ObjectX[] is the set of checked keys of the listbox<br>
- * the inner table shows those rows as checked which have the key value as a part of the listbox value (ObjectX[])
- * <p>
- * Note, that the listbox might not necessarily show all checked rows since the value of the listbox might contain
- * inactive keys that are not reflected in the listbox<br>
- * Therefore an empty listbox table is not the same as a listbox with an empty value (null)
- */
-public interface ITreeBox<T> extends IValueField<T[]>, ICompositeField {
-
- /**
- * {@link boolean}
- */
- String PROP_FILTER_ACTIVE_NODES = "filterActiveNodes";
- /**
- * {@link boolean}
- */
- String PROP_FILTER_CHECKED_NODES = "filterCheckedNodes";
- /**
- * {@link boolean}
- */
- String PROP_FILTER_CHECKED_NODES_VALUE = "filterCheckedNodesValue";
- /**
- * {@link TriState}
- */
- String PROP_FILTER_ACTIVE_NODES_VALUE = "filterActiveNodesValue";
-
- ITree getTree();
-
- ITreeBoxUIFacade getUIFacade();
-
- /**
- * true: a filter is added to the treebox tree that only accepts nodes that
- * are active or checked. Affects {@link ITreeNode#getFilteredChildNodes()}
- */
- boolean isFilterActiveNodes();
-
- /**
- * see {@link #isFilterActiveNodes()}
- */
- void setFilterActiveNodes(boolean b);
-
- TriState getFilterActiveNodesValue();
-
- void setFilterActiveNodesValue(TriState t);
-
- /**
- * true: a filter is added to the treebox tree that only accepts checked
- * nodes Affects {@link ITreeNode#getFilteredChildNodes()}
- */
- boolean isFilterCheckedNodes();
-
- /**
- * see {@link #isFilterCheckedRows()}
- */
- void setFilterCheckedNodes(boolean b);
-
- boolean getFilterCheckedNodesValue();
-
- void setFilterCheckedNodesValue(boolean b);
-
- /**
- * Populate tree with data from service all existing data in the tree is
- * discarded
- *
- * @see execFilterTreeNode
- */
- void loadRootNode() throws ProcessingException;
-
- void loadChildNodes(ITreeNode parentNode) throws ProcessingException;
-
- ITreeNode[] callChildLookup(ITreeNode parentNode) throws ProcessingException;
-
- ITreeNode[] callCompleteTreeLookup() throws ProcessingException;
-
- LookupCall getLookupCall();
-
- void setLookupCall(LookupCall call);
-
- Class<? extends ICodeType> getCodeTypeClass();
-
- void setCodeTypeClass(Class<? extends ICodeType> codeTypeClass);
-
- boolean isAutoExpandAll();
-
- void setAutoExpandAll(boolean b);
-
- boolean isLoadIncremental();
-
- void setLoadIncremental(boolean b);
-
- boolean isNodeActive(ITreeNode node);
-
- /**
- * @return the first selected/checked value if any
- * <p>
- * By default a treebox is checkable, so its value is the array of all checked keys
- * <p>
- * When it is made non-checkable, its value is the array of all selected keys
- */
- T getSingleValue();
-
- /**
- * Convenience for setting a single value with {@link #setValue(Object)}
- */
- void setSingleValue(T value);
-
- int getCheckedKeyCount();
-
- T getCheckedKey();
-
- T[] getCheckedKeys();
-
- LookupRow getCheckedLookupRow();
-
- LookupRow[] getCheckedLookupRows();
-
- void checkKey(T key);
-
- void checkKeys(T[] keys);
-
- void uncheckAllKeys();
-
- T[] getUncheckedKeys();
-
- void checkAllKeys();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.treebox;
+
+import org.eclipse.scout.commons.TriState;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITree;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
+import org.eclipse.scout.rt.client.ui.form.fields.ICompositeField;
+import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
+import org.eclipse.scout.rt.shared.services.common.code.ICodeType;
+import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
+import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
+
+/**
+ * A treebox represents an array of values which correspond to checked keys in
+ * the tree. When setting loadIncremental=false just one LookupCall by
+ * <b>all</b> is sent to load all tree nodes. It is expected that the returned {@link LookupRow}s containt their
+ * corresponding parentKey or null for root
+ * nodes When setting loadIncremental=true a LookupCall by <b>rec</b> is sent
+ * whenever a node's children are loaded and contains the parentKey.
+ * <p>
+ * The listbox value is a ObjectX[] where the ObjectX[] is the set of checked keys of the listbox<br>
+ * the inner table shows those rows as checked which have the key value as a part of the listbox value (ObjectX[])
+ * <p>
+ * Note, that the listbox might not necessarily show all checked rows since the value of the listbox might contain
+ * inactive keys that are not reflected in the listbox<br>
+ * Therefore an empty listbox table is not the same as a listbox with an empty value (null)
+ */
+public interface ITreeBox<T> extends IValueField<T[]>, ICompositeField {
+
+ /**
+ * {@link boolean}
+ */
+ String PROP_FILTER_ACTIVE_NODES = "filterActiveNodes";
+ /**
+ * {@link boolean}
+ */
+ String PROP_FILTER_CHECKED_NODES = "filterCheckedNodes";
+ /**
+ * {@link boolean}
+ */
+ String PROP_FILTER_CHECKED_NODES_VALUE = "filterCheckedNodesValue";
+ /**
+ * {@link TriState}
+ */
+ String PROP_FILTER_ACTIVE_NODES_VALUE = "filterActiveNodesValue";
+
+ ITree getTree();
+
+ ITreeBoxUIFacade getUIFacade();
+
+ /**
+ * true: a filter is added to the treebox tree that only accepts nodes that
+ * are active or checked. Affects {@link ITreeNode#getFilteredChildNodes()}
+ */
+ boolean isFilterActiveNodes();
+
+ /**
+ * see {@link #isFilterActiveNodes()}
+ */
+ void setFilterActiveNodes(boolean b);
+
+ TriState getFilterActiveNodesValue();
+
+ void setFilterActiveNodesValue(TriState t);
+
+ /**
+ * true: a filter is added to the treebox tree that only accepts checked
+ * nodes Affects {@link ITreeNode#getFilteredChildNodes()}
+ */
+ boolean isFilterCheckedNodes();
+
+ /**
+ * see {@link #isFilterCheckedRows()}
+ */
+ void setFilterCheckedNodes(boolean b);
+
+ boolean getFilterCheckedNodesValue();
+
+ void setFilterCheckedNodesValue(boolean b);
+
+ /**
+ * Populate tree with data from service all existing data in the tree is
+ * discarded
+ *
+ * @see execFilterTreeNode
+ */
+ void loadRootNode() throws ProcessingException;
+
+ void loadChildNodes(ITreeNode parentNode) throws ProcessingException;
+
+ ITreeNode[] callChildLookup(ITreeNode parentNode) throws ProcessingException;
+
+ ITreeNode[] callCompleteTreeLookup() throws ProcessingException;
+
+ LookupCall getLookupCall();
+
+ void setLookupCall(LookupCall call);
+
+ Class<? extends ICodeType> getCodeTypeClass();
+
+ void setCodeTypeClass(Class<? extends ICodeType> codeTypeClass);
+
+ boolean isAutoExpandAll();
+
+ void setAutoExpandAll(boolean b);
+
+ boolean isLoadIncremental();
+
+ void setLoadIncremental(boolean b);
+
+ boolean isNodeActive(ITreeNode node);
+
+ /**
+ * @return the first selected/checked value if any
+ * <p>
+ * By default a treebox is checkable, so its value is the array of all checked keys
+ * <p>
+ * When it is made non-checkable, its value is the array of all selected keys
+ */
+ T getSingleValue();
+
+ /**
+ * Convenience for setting a single value with {@link #setValue(Object)}
+ */
+ void setSingleValue(T value);
+
+ int getCheckedKeyCount();
+
+ T getCheckedKey();
+
+ T[] getCheckedKeys();
+
+ LookupRow getCheckedLookupRow();
+
+ LookupRow[] getCheckedLookupRows();
+
+ void checkKey(T key);
+
+ void checkKeys(T[] keys);
+
+ void uncheckAllKeys();
+
+ T[] getUncheckedKeys();
+
+ void checkAllKeys();
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/treebox/ITreeBoxUIFacade.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/treebox/ITreeBoxUIFacade.java
index cb925a3770..2c5837c0ff 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/treebox/ITreeBoxUIFacade.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/treebox/ITreeBoxUIFacade.java
@@ -1,15 +1,15 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.treebox;
-
-public interface ITreeBoxUIFacade {
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.treebox;
+
+public interface ITreeBoxUIFacade {
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/treefield/AbstractTreeField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/treefield/AbstractTreeField.java
index ba02788f9e..3f902ad2cd 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/treefield/AbstractTreeField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/treefield/AbstractTreeField.java
@@ -1,431 +1,431 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.treefield;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-
-import org.eclipse.scout.commons.ConfigurationUtility;
-import org.eclipse.scout.commons.annotations.ConfigOperation;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.basic.tree.AbstractTree;
-import org.eclipse.scout.rt.client.ui.basic.tree.AbstractTreeNode;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITree;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeVisitor;
-import org.eclipse.scout.rt.client.ui.basic.tree.TreeAdapter;
-import org.eclipse.scout.rt.client.ui.basic.tree.TreeEvent;
-import org.eclipse.scout.rt.client.ui.form.fields.AbstractFormField;
-import org.eclipse.scout.rt.shared.data.form.fields.AbstractFormFieldData;
-import org.eclipse.scout.rt.shared.data.form.fields.treefield.AbstractTreeFieldData;
-import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
-import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
-import org.eclipse.scout.service.SERVICES;
-
-public abstract class AbstractTreeField extends AbstractFormField implements ITreeField {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractTreeField.class);
-
- private LookupCall m_lookupCall;
- private ITree m_tree;
- private boolean m_treeExternallyManaged;
- private boolean m_autoExpandAll;
- private P_TreeListener m_treeListener;
-
- public AbstractTreeField() {
- this(true);
- }
-
- public AbstractTreeField(boolean callInitializer) {
- super(callInitializer);
- }
-
- /*
- * Configuration
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(190)
- @ConfigPropertyValue("true")
- protected boolean getConfiguredAutoLoad() {
- return true;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(200)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredAutoExpandAll() {
- return false;
- }
-
- /**
- * called before any lookup is performed
- */
- @ConfigOperation
- @Order(190)
- protected void execSave(ITreeNode[] insertedNodes, ITreeNode[] updatedNodes, ITreeNode[] deletedNodes) {
- }
-
- /**
- * This callback is responsible to add new nodes to the parent.
- * <p>
- * It is recommended to use code similar to the following <code>
- * <pre>
- * getTree().removeAllChildNodes(parentNode);
- * getTree().addChildNode(parentNode, ...);
- * getTree().addChildNodes(parentNode, ...);
- * // auto-expand all
- * if (isAutoExpandAll()) {
- * getTree().expandAll(parentNode);
- * }
- * </pre>
- * </code>
- * <p>
- *
- * @see the createTreeNode methods for creating new nodes
- */
- @ConfigOperation
- @Order(200)
- protected void execLoadChildNodes(ITreeNode parentNode) throws ProcessingException {
- }
-
- @ConfigOperation
- @Order(210)
- protected void execSaveDeletedNode(ITreeNode row) throws ProcessingException {
- }
-
- @ConfigOperation
- @Order(220)
- protected void execSaveInsertedNode(ITreeNode row) throws ProcessingException {
- }
-
- @ConfigOperation
- @Order(230)
- protected void execSaveUpdatedNode(ITreeNode row) throws ProcessingException {
- }
-
- private Class<? extends ITree> getConfiguredTree() {
- Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
- Class<? extends ITree>[] f = ConfigurationUtility.filterClasses(dca, ITree.class);
- if (f.length == 1) {
- return f[0];
- }
- else {
- for (Class<? extends ITree> c : f) {
- if (c.getDeclaringClass() != AbstractTreeField.class) {
- return c;
- }
- }
- return null;
- }
- }
-
- @Override
- protected void execChangedMasterValue(Object newMasterValue) {
- try {
- loadRootNode();
- }
- catch (ProcessingException e) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- }
-
- @Override
- protected void initConfig() {
- super.initConfig();
- setAutoExpandAll(getConfiguredAutoExpandAll());
- if (getConfiguredTree() != null) {
- try {
- setTreeInternal(ConfigurationUtility.newInnerInstance(this, getConfiguredTree()));
- }
- catch (Exception e) {
- LOG.warn(null, e);
- }
- }
- // local enabled listener
- addPropertyChangeListener(PROP_ENABLED, new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent e) {
- if (m_tree != null) {
- m_tree.setEnabled(isEnabled());
- }
- }
- });
- }
-
- @Override
- protected void initFieldInternal() throws ProcessingException {
- if (m_tree != null && !m_treeExternallyManaged) {
- m_tree.initTree();
- }
- if (getConfiguredAutoLoad()) {
- loadRootNode();
- }
- super.initFieldInternal();
- }
-
- @Override
- protected void disposeFieldInternal() {
- super.disposeFieldInternal();
- if (m_tree != null && !m_treeExternallyManaged) {
- m_tree.disposeTree();
- }
- }
-
- @Override
- public void exportFormFieldData(AbstractFormFieldData target) throws ProcessingException {
- AbstractTreeFieldData treeFieldData = (AbstractTreeFieldData) target;
- if (m_tree != null) {
- m_tree.exportTreeData(treeFieldData);
- }
- }
-
- @Override
- public void importFormFieldData(AbstractFormFieldData source, boolean valueChangeTriggersEnabled) throws ProcessingException {
- AbstractTreeFieldData treeFieldData = (AbstractTreeFieldData) source;
- if (treeFieldData.isValueSet()) {
- if (m_tree != null) {
- try {
- if (!valueChangeTriggersEnabled) {
- setValueChangeTriggerEnabled(false);
- }
- //
- m_tree.importTreeData(treeFieldData);
- }
- finally {
- if (!valueChangeTriggersEnabled) {
- setValueChangeTriggerEnabled(true);
- }
- }
- }
- }
- }
-
- @Override
- public final ITree getTree() {
- return m_tree;
- }
-
- @Override
- public final void setTree(ITree tree, boolean externallyManaged) {
- m_treeExternallyManaged = externallyManaged;
- setTreeInternal(tree);
- }
-
- private void setTreeInternal(ITree tree) {
- if (m_tree == tree) {
- return;
- }
- if (m_tree instanceof AbstractTree) {
- ((AbstractTree) m_tree).setContainerInternal(null);
- }
- if (m_tree != null && !m_treeExternallyManaged) {
- if (m_treeListener != null) {
- m_tree.removeTreeListener(m_treeListener);
- m_treeListener = null;
- }
- }
- m_tree = tree;
- if (m_tree instanceof AbstractTree) {
- ((AbstractTree) m_tree).setContainerInternal(this);
- }
- if (m_tree != null && !m_treeExternallyManaged) {
- m_tree.setAutoDiscardOnDelete(false);
- m_treeListener = new P_TreeListener();
- m_tree.addTreeListener(m_treeListener);
- }
- if (m_tree != null) {
- m_tree.setEnabled(isEnabled());
- }
- boolean changed = propertySupport.setProperty(PROP_TREE, m_tree);
- if (changed) {
- if (getForm() != null) {
- getForm().structureChanged(this);
- }
- }
- }
-
- public boolean isAutoExpandAll() {
- return m_autoExpandAll;
- }
-
- public void setAutoExpandAll(boolean b) {
- m_autoExpandAll = b;
- }
-
- @Override
- public boolean isContentValid() {
- boolean b = super.isContentValid();
- if (b) {
- if (isMandatory()) {
- if (getTree() == null || getTree().getRootNode() == null) {
- return false;
- }
- }
- }
- return b;
- }
-
- @Override
- public void loadRootNode() throws ProcessingException {
- if (m_tree != null && !m_treeExternallyManaged) {
- loadChildNodes(m_tree.getRootNode());
- }
- }
-
- @Override
- public void loadChildNodes(ITreeNode parentNode) throws ProcessingException {
- if (m_tree != null && !m_treeExternallyManaged) {
- try {
- m_tree.setTreeChanging(true);
- //
- execLoadChildNodes(parentNode);
- }
- finally {
- m_tree.setTreeChanging(false);
- }
- }
- }
-
- public ITreeNode createTreeNode() throws ProcessingException {
- ITreeNode node = new P_InternalTreeNode();
- return node;
- }
-
- @Override
- protected boolean execIsSaveNeeded() throws ProcessingException {
- boolean b = false;
- if (m_tree != null) {
- if (b == false && m_tree.getDeletedNodeCount() > 0) {
- b = true;
- }
- if (b == false && m_tree.getInsertedNodeCount() > 0) {
- b = true;
- }
- if (b == false && m_tree.getUpdatedNodeCount() > 0) {
- b = true;
- }
- }
- return b;
- }
-
- @Override
- protected void execMarkSaved() throws ProcessingException {
- if (m_tree != null && !m_treeExternallyManaged) {
- try {
- m_tree.setTreeChanging(true);
- //
- ITreeVisitor v = new ITreeVisitor() {
- @Override
- public boolean visit(ITreeNode node) {
- if (!node.isStatusNonchanged()) {
- node.setStatusInternal(ITreeNode.STATUS_NON_CHANGED);
- m_tree.updateNode(node);
- }
- return true;
- }
- };
- m_tree.visitNode(m_tree.getRootNode(), v);
- m_tree.clearDeletedNodes();
- }
- finally {
- m_tree.setTreeChanging(false);
- }
- }
- }
-
- @Override
- protected boolean execIsEmpty() throws ProcessingException {
- if (m_tree != null) {
- if (m_tree.isRootNodeVisible()) {
- if (m_tree.getRootNode() != null) {
- return false;
- }
- }
- else {
- if (m_tree.getRootNode() != null && m_tree.getRootNode().getChildNodeCount() > 0) {
- return false;
- }
- }
- }
- return true;
- }
-
- @Override
- public void doSave() throws ProcessingException {
- if (m_tree != null && !m_treeExternallyManaged) {
- try {
- m_tree.setTreeChanging(true);
- //
- // 1. batch
- execSave(m_tree.getInsertedNodes(), m_tree.getUpdatedNodes(), m_tree.getDeletedNodes());
- // 2. per node
- ITreeNode[] insertedNodes = m_tree.getInsertedNodes();
- ITreeNode[] updatedNodes = m_tree.getUpdatedNodes();
- ITreeNode[] deletedNodes = m_tree.getDeletedNodes();
- // deleted nodes
- for (int i = 0; i < deletedNodes.length; i++) {
- execSaveDeletedNode(deletedNodes[i]);
- }
- m_tree.clearDeletedNodes();
- // inserted nodes
- for (int i = 0; i < insertedNodes.length; i++) {
- ITreeNode node = insertedNodes[i];
- execSaveInsertedNode(node);
- node.setStatusInternal(ITreeNode.STATUS_NON_CHANGED);
- m_tree.updateNode(node);
- }
- // updated rows
- for (int i = 0; i < updatedNodes.length; i++) {
- ITreeNode node = insertedNodes[i];
- execSaveUpdatedNode(node);
- node.setStatusInternal(ITreeNode.STATUS_NON_CHANGED);
- m_tree.updateNode(node);
- }
- }
- finally {
- m_tree.setTreeChanging(false);
- }
- }
- markSaved();
- }
-
- /**
- * TreeNode implementation with delegation of loadChildren to
- * this.loadChildNodes()
- */
- private class P_InternalTreeNode extends AbstractTreeNode {
-
- @Override
- public void loadChildren() throws ProcessingException {
- AbstractTreeField.this.loadChildNodes(this);
- }
- }
-
- private class P_TreeListener extends TreeAdapter {
- @Override
- public void treeChanged(TreeEvent e) {
- switch (e.getType()) {
- case TreeEvent.TYPE_NODES_DELETED:
- case TreeEvent.TYPE_NODES_INSERTED:
- case TreeEvent.TYPE_NODES_UPDATED: {
- checkSaveNeeded();
- checkEmpty();
- break;
- }
- }
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.treefield;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import org.eclipse.scout.commons.ConfigurationUtility;
+import org.eclipse.scout.commons.annotations.ConfigOperation;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.basic.tree.AbstractTree;
+import org.eclipse.scout.rt.client.ui.basic.tree.AbstractTreeNode;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITree;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeVisitor;
+import org.eclipse.scout.rt.client.ui.basic.tree.TreeAdapter;
+import org.eclipse.scout.rt.client.ui.basic.tree.TreeEvent;
+import org.eclipse.scout.rt.client.ui.form.fields.AbstractFormField;
+import org.eclipse.scout.rt.shared.data.form.fields.AbstractFormFieldData;
+import org.eclipse.scout.rt.shared.data.form.fields.treefield.AbstractTreeFieldData;
+import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
+import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
+import org.eclipse.scout.service.SERVICES;
+
+public abstract class AbstractTreeField extends AbstractFormField implements ITreeField {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractTreeField.class);
+
+ private LookupCall m_lookupCall;
+ private ITree m_tree;
+ private boolean m_treeExternallyManaged;
+ private boolean m_autoExpandAll;
+ private P_TreeListener m_treeListener;
+
+ public AbstractTreeField() {
+ this(true);
+ }
+
+ public AbstractTreeField(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ /*
+ * Configuration
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(190)
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredAutoLoad() {
+ return true;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(200)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredAutoExpandAll() {
+ return false;
+ }
+
+ /**
+ * called before any lookup is performed
+ */
+ @ConfigOperation
+ @Order(190)
+ protected void execSave(ITreeNode[] insertedNodes, ITreeNode[] updatedNodes, ITreeNode[] deletedNodes) {
+ }
+
+ /**
+ * This callback is responsible to add new nodes to the parent.
+ * <p>
+ * It is recommended to use code similar to the following <code>
+ * <pre>
+ * getTree().removeAllChildNodes(parentNode);
+ * getTree().addChildNode(parentNode, ...);
+ * getTree().addChildNodes(parentNode, ...);
+ * // auto-expand all
+ * if (isAutoExpandAll()) {
+ * getTree().expandAll(parentNode);
+ * }
+ * </pre>
+ * </code>
+ * <p>
+ *
+ * @see the createTreeNode methods for creating new nodes
+ */
+ @ConfigOperation
+ @Order(200)
+ protected void execLoadChildNodes(ITreeNode parentNode) throws ProcessingException {
+ }
+
+ @ConfigOperation
+ @Order(210)
+ protected void execSaveDeletedNode(ITreeNode row) throws ProcessingException {
+ }
+
+ @ConfigOperation
+ @Order(220)
+ protected void execSaveInsertedNode(ITreeNode row) throws ProcessingException {
+ }
+
+ @ConfigOperation
+ @Order(230)
+ protected void execSaveUpdatedNode(ITreeNode row) throws ProcessingException {
+ }
+
+ private Class<? extends ITree> getConfiguredTree() {
+ Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
+ Class<? extends ITree>[] f = ConfigurationUtility.filterClasses(dca, ITree.class);
+ if (f.length == 1) {
+ return f[0];
+ }
+ else {
+ for (Class<? extends ITree> c : f) {
+ if (c.getDeclaringClass() != AbstractTreeField.class) {
+ return c;
+ }
+ }
+ return null;
+ }
+ }
+
+ @Override
+ protected void execChangedMasterValue(Object newMasterValue) {
+ try {
+ loadRootNode();
+ }
+ catch (ProcessingException e) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ }
+
+ @Override
+ protected void initConfig() {
+ super.initConfig();
+ setAutoExpandAll(getConfiguredAutoExpandAll());
+ if (getConfiguredTree() != null) {
+ try {
+ setTreeInternal(ConfigurationUtility.newInnerInstance(this, getConfiguredTree()));
+ }
+ catch (Exception e) {
+ LOG.warn(null, e);
+ }
+ }
+ // local enabled listener
+ addPropertyChangeListener(PROP_ENABLED, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent e) {
+ if (m_tree != null) {
+ m_tree.setEnabled(isEnabled());
+ }
+ }
+ });
+ }
+
+ @Override
+ protected void initFieldInternal() throws ProcessingException {
+ if (m_tree != null && !m_treeExternallyManaged) {
+ m_tree.initTree();
+ }
+ if (getConfiguredAutoLoad()) {
+ loadRootNode();
+ }
+ super.initFieldInternal();
+ }
+
+ @Override
+ protected void disposeFieldInternal() {
+ super.disposeFieldInternal();
+ if (m_tree != null && !m_treeExternallyManaged) {
+ m_tree.disposeTree();
+ }
+ }
+
+ @Override
+ public void exportFormFieldData(AbstractFormFieldData target) throws ProcessingException {
+ AbstractTreeFieldData treeFieldData = (AbstractTreeFieldData) target;
+ if (m_tree != null) {
+ m_tree.exportTreeData(treeFieldData);
+ }
+ }
+
+ @Override
+ public void importFormFieldData(AbstractFormFieldData source, boolean valueChangeTriggersEnabled) throws ProcessingException {
+ AbstractTreeFieldData treeFieldData = (AbstractTreeFieldData) source;
+ if (treeFieldData.isValueSet()) {
+ if (m_tree != null) {
+ try {
+ if (!valueChangeTriggersEnabled) {
+ setValueChangeTriggerEnabled(false);
+ }
+ //
+ m_tree.importTreeData(treeFieldData);
+ }
+ finally {
+ if (!valueChangeTriggersEnabled) {
+ setValueChangeTriggerEnabled(true);
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ public final ITree getTree() {
+ return m_tree;
+ }
+
+ @Override
+ public final void setTree(ITree tree, boolean externallyManaged) {
+ m_treeExternallyManaged = externallyManaged;
+ setTreeInternal(tree);
+ }
+
+ private void setTreeInternal(ITree tree) {
+ if (m_tree == tree) {
+ return;
+ }
+ if (m_tree instanceof AbstractTree) {
+ ((AbstractTree) m_tree).setContainerInternal(null);
+ }
+ if (m_tree != null && !m_treeExternallyManaged) {
+ if (m_treeListener != null) {
+ m_tree.removeTreeListener(m_treeListener);
+ m_treeListener = null;
+ }
+ }
+ m_tree = tree;
+ if (m_tree instanceof AbstractTree) {
+ ((AbstractTree) m_tree).setContainerInternal(this);
+ }
+ if (m_tree != null && !m_treeExternallyManaged) {
+ m_tree.setAutoDiscardOnDelete(false);
+ m_treeListener = new P_TreeListener();
+ m_tree.addTreeListener(m_treeListener);
+ }
+ if (m_tree != null) {
+ m_tree.setEnabled(isEnabled());
+ }
+ boolean changed = propertySupport.setProperty(PROP_TREE, m_tree);
+ if (changed) {
+ if (getForm() != null) {
+ getForm().structureChanged(this);
+ }
+ }
+ }
+
+ public boolean isAutoExpandAll() {
+ return m_autoExpandAll;
+ }
+
+ public void setAutoExpandAll(boolean b) {
+ m_autoExpandAll = b;
+ }
+
+ @Override
+ public boolean isContentValid() {
+ boolean b = super.isContentValid();
+ if (b) {
+ if (isMandatory()) {
+ if (getTree() == null || getTree().getRootNode() == null) {
+ return false;
+ }
+ }
+ }
+ return b;
+ }
+
+ @Override
+ public void loadRootNode() throws ProcessingException {
+ if (m_tree != null && !m_treeExternallyManaged) {
+ loadChildNodes(m_tree.getRootNode());
+ }
+ }
+
+ @Override
+ public void loadChildNodes(ITreeNode parentNode) throws ProcessingException {
+ if (m_tree != null && !m_treeExternallyManaged) {
+ try {
+ m_tree.setTreeChanging(true);
+ //
+ execLoadChildNodes(parentNode);
+ }
+ finally {
+ m_tree.setTreeChanging(false);
+ }
+ }
+ }
+
+ public ITreeNode createTreeNode() throws ProcessingException {
+ ITreeNode node = new P_InternalTreeNode();
+ return node;
+ }
+
+ @Override
+ protected boolean execIsSaveNeeded() throws ProcessingException {
+ boolean b = false;
+ if (m_tree != null) {
+ if (b == false && m_tree.getDeletedNodeCount() > 0) {
+ b = true;
+ }
+ if (b == false && m_tree.getInsertedNodeCount() > 0) {
+ b = true;
+ }
+ if (b == false && m_tree.getUpdatedNodeCount() > 0) {
+ b = true;
+ }
+ }
+ return b;
+ }
+
+ @Override
+ protected void execMarkSaved() throws ProcessingException {
+ if (m_tree != null && !m_treeExternallyManaged) {
+ try {
+ m_tree.setTreeChanging(true);
+ //
+ ITreeVisitor v = new ITreeVisitor() {
+ @Override
+ public boolean visit(ITreeNode node) {
+ if (!node.isStatusNonchanged()) {
+ node.setStatusInternal(ITreeNode.STATUS_NON_CHANGED);
+ m_tree.updateNode(node);
+ }
+ return true;
+ }
+ };
+ m_tree.visitNode(m_tree.getRootNode(), v);
+ m_tree.clearDeletedNodes();
+ }
+ finally {
+ m_tree.setTreeChanging(false);
+ }
+ }
+ }
+
+ @Override
+ protected boolean execIsEmpty() throws ProcessingException {
+ if (m_tree != null) {
+ if (m_tree.isRootNodeVisible()) {
+ if (m_tree.getRootNode() != null) {
+ return false;
+ }
+ }
+ else {
+ if (m_tree.getRootNode() != null && m_tree.getRootNode().getChildNodeCount() > 0) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ @Override
+ public void doSave() throws ProcessingException {
+ if (m_tree != null && !m_treeExternallyManaged) {
+ try {
+ m_tree.setTreeChanging(true);
+ //
+ // 1. batch
+ execSave(m_tree.getInsertedNodes(), m_tree.getUpdatedNodes(), m_tree.getDeletedNodes());
+ // 2. per node
+ ITreeNode[] insertedNodes = m_tree.getInsertedNodes();
+ ITreeNode[] updatedNodes = m_tree.getUpdatedNodes();
+ ITreeNode[] deletedNodes = m_tree.getDeletedNodes();
+ // deleted nodes
+ for (int i = 0; i < deletedNodes.length; i++) {
+ execSaveDeletedNode(deletedNodes[i]);
+ }
+ m_tree.clearDeletedNodes();
+ // inserted nodes
+ for (int i = 0; i < insertedNodes.length; i++) {
+ ITreeNode node = insertedNodes[i];
+ execSaveInsertedNode(node);
+ node.setStatusInternal(ITreeNode.STATUS_NON_CHANGED);
+ m_tree.updateNode(node);
+ }
+ // updated rows
+ for (int i = 0; i < updatedNodes.length; i++) {
+ ITreeNode node = insertedNodes[i];
+ execSaveUpdatedNode(node);
+ node.setStatusInternal(ITreeNode.STATUS_NON_CHANGED);
+ m_tree.updateNode(node);
+ }
+ }
+ finally {
+ m_tree.setTreeChanging(false);
+ }
+ }
+ markSaved();
+ }
+
+ /**
+ * TreeNode implementation with delegation of loadChildren to
+ * this.loadChildNodes()
+ */
+ private class P_InternalTreeNode extends AbstractTreeNode {
+
+ @Override
+ public void loadChildren() throws ProcessingException {
+ AbstractTreeField.this.loadChildNodes(this);
+ }
+ }
+
+ private class P_TreeListener extends TreeAdapter {
+ @Override
+ public void treeChanged(TreeEvent e) {
+ switch (e.getType()) {
+ case TreeEvent.TYPE_NODES_DELETED:
+ case TreeEvent.TYPE_NODES_INSERTED:
+ case TreeEvent.TYPE_NODES_UPDATED: {
+ checkSaveNeeded();
+ checkEmpty();
+ break;
+ }
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/treefield/ITreeField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/treefield/ITreeField.java
index 4d8360ab0b..d4dfe1c6f0 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/treefield/ITreeField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/treefield/ITreeField.java
@@ -1,52 +1,52 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.treefield;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITree;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-
-public interface ITreeField extends IFormField {
-
- /**
- * {@link ITree}
- */
- String PROP_TREE = "tree";
-
- /**
- * Tree contained in tree field. If the tree is an inner type, then init,
- * dispose, load and store is handled by the tree field.
- */
- ITree getTree();
-
- /**
- * Install a (new) tree into the tree field.
- *
- * @param externallyManaged
- * true means init, dispose, load and store are not handled by the
- * tree field
- */
- void setTree(ITree newTree, boolean externallyManaged);
-
- /**
- * Populate tree with data from service all existing data in the tree is
- * discarded
- *
- * @see execFilterTreeNode
- */
- void loadRootNode() throws ProcessingException;
-
- void loadChildNodes(ITreeNode parentNode) throws ProcessingException;
-
- void doSave() throws ProcessingException;
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.treefield;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITree;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+
+public interface ITreeField extends IFormField {
+
+ /**
+ * {@link ITree}
+ */
+ String PROP_TREE = "tree";
+
+ /**
+ * Tree contained in tree field. If the tree is an inner type, then init,
+ * dispose, load and store is handled by the tree field.
+ */
+ ITree getTree();
+
+ /**
+ * Install a (new) tree into the tree field.
+ *
+ * @param externallyManaged
+ * true means init, dispose, load and store are not handled by the
+ * tree field
+ */
+ void setTree(ITree newTree, boolean externallyManaged);
+
+ /**
+ * Populate tree with data from service all existing data in the tree is
+ * discarded
+ *
+ * @see execFilterTreeNode
+ */
+ void loadRootNode() throws ProcessingException;
+
+ void loadChildNodes(ITreeNode parentNode) throws ProcessingException;
+
+ void doSave() throws ProcessingException;
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/wrappedform/AbstractWrappedFormField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/wrappedform/AbstractWrappedFormField.java
index b18ee925da..8cf3f51fdf 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/wrappedform/AbstractWrappedFormField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/wrappedform/AbstractWrappedFormField.java
@@ -1,225 +1,225 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.wrappedform;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.commons.xmlparser.SimpleXmlElement;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.ISearchForm;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.client.ui.form.IFormFieldVisitor;
-import org.eclipse.scout.rt.client.ui.form.fields.AbstractFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-
-public abstract class AbstractWrappedFormField<T extends IForm> extends AbstractFormField implements IWrappedFormField<T> {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractWrappedFormField.class);
-
- private T m_innerForm;
- private P_InnerFormPropertyChangeListener m_innerFormPropertyListener;
- private P_InnerFormSubtreePropertyChangeListener m_innerFormSubtreePropertyListener;
-
- public AbstractWrappedFormField() {
- this(true);
- }
-
- public AbstractWrappedFormField(boolean callInitializer) {
- super(callInitializer);
- }
-
- @ConfigPropertyValue("false")
- @Override
- protected boolean getConfiguredLabelVisible() {
- return false;
- }
-
- @ConfigProperty(ConfigProperty.FORM)
- @Order(200)
- @ConfigPropertyValue("null")
- protected Class<? extends IForm> getConfiguredInnerForm() {
- return null;
- }
-
- @ConfigPropertyValue("1")
- @Override
- protected double getConfiguredGridWeightY() {
- return 1;
- }
-
- @Override
- @ConfigPropertyValue("true")
- protected boolean getConfiguredGridUseUiHeight() {
- return true;
- }
-
- @Override
- protected void execInitField() throws ProcessingException {
- IForm f = getInnerForm();
- if (f != null && !f.isFormOpen()) {
- if (f instanceof ISearchForm) {
- ((ISearchForm) f).startSearch();
- }
- }
- }
-
- @Override
- protected boolean execIsSaveNeeded() throws ProcessingException {
- return getInnerForm() != null && getInnerForm().isSaveNeeded();
- }
-
- @SuppressWarnings("unchecked")
- @Override
- protected void initConfig() {
- super.initConfig();
- m_innerFormPropertyListener = new P_InnerFormPropertyChangeListener();
- m_innerFormSubtreePropertyListener = new P_InnerFormSubtreePropertyChangeListener();
- if (getConfiguredInnerForm() != null) {
- try {
- setInnerForm((T) getConfiguredInnerForm().newInstance());
- }
- catch (Exception e) {
- LOG.warn(null, e);
- }
- }
- }
-
- @Override
- public void setEnabledGranted(boolean b) {
- super.setEnabledGranted(b);
- if (getInnerForm() != null) {
- getInnerForm().setEnabledGranted(b);
- }
- }
-
- @Override
- public void setEnabled(boolean b) {
- super.setEnabled(b);
- if (getInnerForm() != null) {
- getInnerForm().setAllEnabled(b);
- }
- }
-
- @Override
- public final T getInnerForm() {
- return m_innerForm;
- }
-
- @Override
- public void setInnerForm(T form) {
- if (m_innerForm == form) {
- return;
- }
- if (m_innerForm != null) {
- fireSubtreePropertyChange(new PropertyChangeEvent(m_innerForm.getRootGroupBox(), IFormField.PROP_PARENT_FIELD, null, null));
- m_innerForm.removePropertyChangeListener(m_innerFormPropertyListener);
- m_innerForm.getRootGroupBox().removeSubtreePropertyChangeListener(m_innerFormSubtreePropertyListener);
- m_innerForm.setWrapperFieldInternal(null);
- m_innerForm = null;
- }
- m_innerForm = form;
- if (m_innerForm != null) {
- if (!m_innerForm.isFormOpen()) {
- m_innerForm.setModal(false);
- m_innerForm.setAutoAddRemoveOnDesktop(false);
- }
- m_innerForm.setWrapperFieldInternal(this);
- m_innerForm.getRootGroupBox().setBorderVisible(false);
- m_innerForm.getRootGroupBox().updateKeyStrokes();
- m_innerForm.addPropertyChangeListener(m_innerFormPropertyListener);
- m_innerForm.getRootGroupBox().addSubtreePropertyChangeListener(m_innerFormSubtreePropertyListener);
- }
- boolean changed = propertySupport.setProperty(PROP_INNER_FORM, m_innerForm);
- calculateVisibleInternal();
- if (m_innerForm != null) {
- fireSubtreePropertyChange(new PropertyChangeEvent(m_innerForm.getRootGroupBox(), IFormField.PROP_PARENT_FIELD, null, null));
- }
- if (changed) {
- if (getForm() != null) {
- getForm().structureChanged(this);
- }
- }
- }
-
- @Override
- public boolean visitFields(IFormFieldVisitor visitor, int startLevel) {
- // myself
- if (!visitor.visitField(this, startLevel, 0)) {
- return false;
- }
- if (getInnerForm() != null) {
- return getInnerForm().getRootGroupBox().visitFields(visitor, startLevel);
- }
- return true;
- }
-
- @Override
- public void loadXML(SimpleXmlElement x) throws ProcessingException {
- super.loadXML(x);
- if (getInnerForm() != null) {
- getInnerForm().loadXML(x);
- }
- }
-
- @Override
- public void storeXML(SimpleXmlElement x) throws ProcessingException {
- super.storeXML(x);
- if (getInnerForm() != null) {
- getInnerForm().storeXML(x);
- }
- }
-
- /*
- * Do not make wrapped form field auto-invisible when no form is hosted. For
- * example in wizard forms this leads to (correct) but unexpected layout flow.
- * The following line might be added by developers in their own subclass to
- * have auto-invisible behaviour.
- */
- /*
- * @Override protected boolean execCalculateVisible() { return getInnerForm()
- * != null; }
- */
-
- // group box is only visible when it has at least one visible item
- protected void handleFieldVisibilityChanged() {
- calculateVisibleInternal();
- }
-
- /**
- * Implementation of PropertyChangeListener Proxy on all attached fields (not
- * groups)
- */
- private class P_InnerFormPropertyChangeListener implements PropertyChangeListener {
- @Override
- public void propertyChange(PropertyChangeEvent e) {
- if (e.getPropertyName().equals(IFormField.PROP_VISIBLE)) {
- // fire group box visibility
- handleFieldVisibilityChanged();
- }
- else if (e.getPropertyName().equals(IFormField.PROP_SAVE_NEEDED)) {
- checkSaveNeeded();
- }
- }
- }// end private class
-
- private class P_InnerFormSubtreePropertyChangeListener implements PropertyChangeListener {
- @Override
- public void propertyChange(PropertyChangeEvent e) {
- fireSubtreePropertyChange(e);
- }
- }// end private class
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.wrappedform;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.commons.xmlparser.SimpleXmlElement;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.ISearchForm;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.client.ui.form.IFormFieldVisitor;
+import org.eclipse.scout.rt.client.ui.form.fields.AbstractFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+
+public abstract class AbstractWrappedFormField<T extends IForm> extends AbstractFormField implements IWrappedFormField<T> {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractWrappedFormField.class);
+
+ private T m_innerForm;
+ private P_InnerFormPropertyChangeListener m_innerFormPropertyListener;
+ private P_InnerFormSubtreePropertyChangeListener m_innerFormSubtreePropertyListener;
+
+ public AbstractWrappedFormField() {
+ this(true);
+ }
+
+ public AbstractWrappedFormField(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ @ConfigPropertyValue("false")
+ @Override
+ protected boolean getConfiguredLabelVisible() {
+ return false;
+ }
+
+ @ConfigProperty(ConfigProperty.FORM)
+ @Order(200)
+ @ConfigPropertyValue("null")
+ protected Class<? extends IForm> getConfiguredInnerForm() {
+ return null;
+ }
+
+ @ConfigPropertyValue("1")
+ @Override
+ protected double getConfiguredGridWeightY() {
+ return 1;
+ }
+
+ @Override
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredGridUseUiHeight() {
+ return true;
+ }
+
+ @Override
+ protected void execInitField() throws ProcessingException {
+ IForm f = getInnerForm();
+ if (f != null && !f.isFormOpen()) {
+ if (f instanceof ISearchForm) {
+ ((ISearchForm) f).startSearch();
+ }
+ }
+ }
+
+ @Override
+ protected boolean execIsSaveNeeded() throws ProcessingException {
+ return getInnerForm() != null && getInnerForm().isSaveNeeded();
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ protected void initConfig() {
+ super.initConfig();
+ m_innerFormPropertyListener = new P_InnerFormPropertyChangeListener();
+ m_innerFormSubtreePropertyListener = new P_InnerFormSubtreePropertyChangeListener();
+ if (getConfiguredInnerForm() != null) {
+ try {
+ setInnerForm((T) getConfiguredInnerForm().newInstance());
+ }
+ catch (Exception e) {
+ LOG.warn(null, e);
+ }
+ }
+ }
+
+ @Override
+ public void setEnabledGranted(boolean b) {
+ super.setEnabledGranted(b);
+ if (getInnerForm() != null) {
+ getInnerForm().setEnabledGranted(b);
+ }
+ }
+
+ @Override
+ public void setEnabled(boolean b) {
+ super.setEnabled(b);
+ if (getInnerForm() != null) {
+ getInnerForm().setAllEnabled(b);
+ }
+ }
+
+ @Override
+ public final T getInnerForm() {
+ return m_innerForm;
+ }
+
+ @Override
+ public void setInnerForm(T form) {
+ if (m_innerForm == form) {
+ return;
+ }
+ if (m_innerForm != null) {
+ fireSubtreePropertyChange(new PropertyChangeEvent(m_innerForm.getRootGroupBox(), IFormField.PROP_PARENT_FIELD, null, null));
+ m_innerForm.removePropertyChangeListener(m_innerFormPropertyListener);
+ m_innerForm.getRootGroupBox().removeSubtreePropertyChangeListener(m_innerFormSubtreePropertyListener);
+ m_innerForm.setWrapperFieldInternal(null);
+ m_innerForm = null;
+ }
+ m_innerForm = form;
+ if (m_innerForm != null) {
+ if (!m_innerForm.isFormOpen()) {
+ m_innerForm.setModal(false);
+ m_innerForm.setAutoAddRemoveOnDesktop(false);
+ }
+ m_innerForm.setWrapperFieldInternal(this);
+ m_innerForm.getRootGroupBox().setBorderVisible(false);
+ m_innerForm.getRootGroupBox().updateKeyStrokes();
+ m_innerForm.addPropertyChangeListener(m_innerFormPropertyListener);
+ m_innerForm.getRootGroupBox().addSubtreePropertyChangeListener(m_innerFormSubtreePropertyListener);
+ }
+ boolean changed = propertySupport.setProperty(PROP_INNER_FORM, m_innerForm);
+ calculateVisibleInternal();
+ if (m_innerForm != null) {
+ fireSubtreePropertyChange(new PropertyChangeEvent(m_innerForm.getRootGroupBox(), IFormField.PROP_PARENT_FIELD, null, null));
+ }
+ if (changed) {
+ if (getForm() != null) {
+ getForm().structureChanged(this);
+ }
+ }
+ }
+
+ @Override
+ public boolean visitFields(IFormFieldVisitor visitor, int startLevel) {
+ // myself
+ if (!visitor.visitField(this, startLevel, 0)) {
+ return false;
+ }
+ if (getInnerForm() != null) {
+ return getInnerForm().getRootGroupBox().visitFields(visitor, startLevel);
+ }
+ return true;
+ }
+
+ @Override
+ public void loadXML(SimpleXmlElement x) throws ProcessingException {
+ super.loadXML(x);
+ if (getInnerForm() != null) {
+ getInnerForm().loadXML(x);
+ }
+ }
+
+ @Override
+ public void storeXML(SimpleXmlElement x) throws ProcessingException {
+ super.storeXML(x);
+ if (getInnerForm() != null) {
+ getInnerForm().storeXML(x);
+ }
+ }
+
+ /*
+ * Do not make wrapped form field auto-invisible when no form is hosted. For
+ * example in wizard forms this leads to (correct) but unexpected layout flow.
+ * The following line might be added by developers in their own subclass to
+ * have auto-invisible behaviour.
+ */
+ /*
+ * @Override protected boolean execCalculateVisible() { return getInnerForm()
+ * != null; }
+ */
+
+ // group box is only visible when it has at least one visible item
+ protected void handleFieldVisibilityChanged() {
+ calculateVisibleInternal();
+ }
+
+ /**
+ * Implementation of PropertyChangeListener Proxy on all attached fields (not
+ * groups)
+ */
+ private class P_InnerFormPropertyChangeListener implements PropertyChangeListener {
+ @Override
+ public void propertyChange(PropertyChangeEvent e) {
+ if (e.getPropertyName().equals(IFormField.PROP_VISIBLE)) {
+ // fire group box visibility
+ handleFieldVisibilityChanged();
+ }
+ else if (e.getPropertyName().equals(IFormField.PROP_SAVE_NEEDED)) {
+ checkSaveNeeded();
+ }
+ }
+ }// end private class
+
+ private class P_InnerFormSubtreePropertyChangeListener implements PropertyChangeListener {
+ @Override
+ public void propertyChange(PropertyChangeEvent e) {
+ fireSubtreePropertyChange(e);
+ }
+ }// end private class
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/wrappedform/IWrappedFormField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/wrappedform/IWrappedFormField.java
index 901c232998..d5a28b5dfd 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/wrappedform/IWrappedFormField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/fields/wrappedform/IWrappedFormField.java
@@ -1,36 +1,36 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.fields.wrappedform;
-
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.client.ui.form.IFormFieldVisitor;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-
-/**
- * Representation of a {@link IForm} inside another form as inline field
- * (wrapped)
- */
-public interface IWrappedFormField<T extends IForm> extends IFormField {
-
- /**
- * {@link IForm}
- */
- String PROP_INNER_FORM = "innerForm";
-
- T getInnerForm();
-
- /**
- * Install a (new) inner form into the wrapped form field.
- */
- void setInnerForm(T newInnerForm);
-
- boolean visitFields(IFormFieldVisitor visitor, int startLevel);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.fields.wrappedform;
+
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.client.ui.form.IFormFieldVisitor;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+
+/**
+ * Representation of a {@link IForm} inside another form as inline field
+ * (wrapped)
+ */
+public interface IWrappedFormField<T extends IForm> extends IFormField {
+
+ /**
+ * {@link IForm}
+ */
+ String PROP_INNER_FORM = "innerForm";
+
+ T getInnerForm();
+
+ /**
+ * Install a (new) inner form into the wrapped form field.
+ */
+ void setInnerForm(T newInnerForm);
+
+ boolean visitFields(IFormFieldVisitor visitor, int startLevel);
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/internal/FindFieldByFormDataIdVisitor.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/internal/FindFieldByFormDataIdVisitor.java
index 37bad79f7c..96762ae3c0 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/internal/FindFieldByFormDataIdVisitor.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/internal/FindFieldByFormDataIdVisitor.java
@@ -1,107 +1,107 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.internal;
-
-import java.util.TreeMap;
-
-import org.eclipse.scout.commons.CompositeObject;
-import org.eclipse.scout.commons.ConfigurationUtility;
-import org.eclipse.scout.rt.client.ui.form.IFormFieldVisitor;
-import org.eclipse.scout.rt.client.ui.form.fields.ICompositeField;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
-import org.eclipse.scout.rt.shared.data.form.FormDataUtility;
-
-public class FindFieldByFormDataIdVisitor implements IFormFieldVisitor {
-
- private static final CompositeObject PERFECT_VALUE_FIELD_MATCH_KEY = new CompositeObject(0, 0);
-
- private String[] m_fieldIdParts;
- private TreeMap<CompositeObject, IFormField> m_prioMap;
-
- public FindFieldByFormDataIdVisitor(String fieldId) {
- m_fieldIdParts = fieldId.split("[/]");
- m_prioMap = new TreeMap<CompositeObject, IFormField>();
- }
-
- @Override
- public boolean visitField(IFormField field, int level, int fieldIndex) {
- if (matchesAllParts(field)) {
- int fieldTypeRank;
- if (field instanceof IValueField) {
- fieldTypeRank = 0;
- }
- else if (!(field instanceof ICompositeField)) {
- fieldTypeRank = 1;
- }
- else {
- fieldTypeRank = 2;
- }
- // Compute the enclosing field path rank that is used as additional hint for determining the
- // best matching form field for the requested formId. Note: for compatibility reasons, the enclosing
- // field path is not enforced.
- int enclosingFieldPathRank = getEnclosingFieldPathRank(field);
- m_prioMap.put(new CompositeObject(fieldTypeRank, enclosingFieldPathRank), field);
- }
- return !m_prioMap.containsKey(PERFECT_VALUE_FIELD_MATCH_KEY);
- }
-
- /**
- * field must match last part and (in correct sequence) all prior parts
- */
- private boolean matchesAllParts(IFormField f) {
- int i = m_fieldIdParts.length - 1;
- if (m_fieldIdParts[i].equals(FormDataUtility.getFieldDataId(f.getFieldId()))) {
- i--;
- f = f.getParentField();
- }
- else {
- return false;
- }
- while (i >= 0 && f != null) {
- if (m_fieldIdParts[i].equals(FormDataUtility.getFieldDataId(f.getFieldId()))) {
- i--;
- }
- f = f.getParentField();
- }
- return i < 0;
- }
-
- /**
- * @return Returns the rank of the given field's enclosing field path and the one the is requested by this visitor. A
- * perfect match yields 0. Every mismatch increases the rank by 1. Hence the greatest number has the worst
- * match.
- */
- private int getEnclosingFieldPathRank(IFormField f) {
- int rank = 0;
- int i = m_fieldIdParts.length - 2; // the last segment is the field id, i.e. not part of the enclosing field path
- Class<?> currentEnclosingContainerType = ConfigurationUtility.getEnclosingContainerType(f);
- ICompositeField p = f.getParentField();
- while (p != null) {
- Class<?> enclosingContainerType = ConfigurationUtility.getEnclosingContainerType(p);
- if (enclosingContainerType != currentEnclosingContainerType) {
- if (i >= 0 && m_fieldIdParts[i].equals(FormDataUtility.getFieldDataId(p.getFieldId()))) {
- i--;
- }
- else {
- rank++;
- }
- currentEnclosingContainerType = enclosingContainerType;
- }
- p = p.getParentField();
- }
- return rank;
- }
-
- public IFormField getField() {
- return m_prioMap.size() > 0 ? m_prioMap.get(m_prioMap.firstKey()) : null;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.internal;
+
+import java.util.TreeMap;
+
+import org.eclipse.scout.commons.CompositeObject;
+import org.eclipse.scout.commons.ConfigurationUtility;
+import org.eclipse.scout.rt.client.ui.form.IFormFieldVisitor;
+import org.eclipse.scout.rt.client.ui.form.fields.ICompositeField;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
+import org.eclipse.scout.rt.shared.data.form.FormDataUtility;
+
+public class FindFieldByFormDataIdVisitor implements IFormFieldVisitor {
+
+ private static final CompositeObject PERFECT_VALUE_FIELD_MATCH_KEY = new CompositeObject(0, 0);
+
+ private String[] m_fieldIdParts;
+ private TreeMap<CompositeObject, IFormField> m_prioMap;
+
+ public FindFieldByFormDataIdVisitor(String fieldId) {
+ m_fieldIdParts = fieldId.split("[/]");
+ m_prioMap = new TreeMap<CompositeObject, IFormField>();
+ }
+
+ @Override
+ public boolean visitField(IFormField field, int level, int fieldIndex) {
+ if (matchesAllParts(field)) {
+ int fieldTypeRank;
+ if (field instanceof IValueField) {
+ fieldTypeRank = 0;
+ }
+ else if (!(field instanceof ICompositeField)) {
+ fieldTypeRank = 1;
+ }
+ else {
+ fieldTypeRank = 2;
+ }
+ // Compute the enclosing field path rank that is used as additional hint for determining the
+ // best matching form field for the requested formId. Note: for compatibility reasons, the enclosing
+ // field path is not enforced.
+ int enclosingFieldPathRank = getEnclosingFieldPathRank(field);
+ m_prioMap.put(new CompositeObject(fieldTypeRank, enclosingFieldPathRank), field);
+ }
+ return !m_prioMap.containsKey(PERFECT_VALUE_FIELD_MATCH_KEY);
+ }
+
+ /**
+ * field must match last part and (in correct sequence) all prior parts
+ */
+ private boolean matchesAllParts(IFormField f) {
+ int i = m_fieldIdParts.length - 1;
+ if (m_fieldIdParts[i].equals(FormDataUtility.getFieldDataId(f.getFieldId()))) {
+ i--;
+ f = f.getParentField();
+ }
+ else {
+ return false;
+ }
+ while (i >= 0 && f != null) {
+ if (m_fieldIdParts[i].equals(FormDataUtility.getFieldDataId(f.getFieldId()))) {
+ i--;
+ }
+ f = f.getParentField();
+ }
+ return i < 0;
+ }
+
+ /**
+ * @return Returns the rank of the given field's enclosing field path and the one the is requested by this visitor. A
+ * perfect match yields 0. Every mismatch increases the rank by 1. Hence the greatest number has the worst
+ * match.
+ */
+ private int getEnclosingFieldPathRank(IFormField f) {
+ int rank = 0;
+ int i = m_fieldIdParts.length - 2; // the last segment is the field id, i.e. not part of the enclosing field path
+ Class<?> currentEnclosingContainerType = ConfigurationUtility.getEnclosingContainerType(f);
+ ICompositeField p = f.getParentField();
+ while (p != null) {
+ Class<?> enclosingContainerType = ConfigurationUtility.getEnclosingContainerType(p);
+ if (enclosingContainerType != currentEnclosingContainerType) {
+ if (i >= 0 && m_fieldIdParts[i].equals(FormDataUtility.getFieldDataId(p.getFieldId()))) {
+ i--;
+ }
+ else {
+ rank++;
+ }
+ currentEnclosingContainerType = enclosingContainerType;
+ }
+ p = p.getParentField();
+ }
+ return rank;
+ }
+
+ public IFormField getField() {
+ return m_prioMap.size() > 0 ? m_prioMap.get(m_prioMap.firstKey()) : null;
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/internal/FindFieldBySimpleClassNameVisitor.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/internal/FindFieldBySimpleClassNameVisitor.java
index 028eb95497..8c3fa8700f 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/internal/FindFieldBySimpleClassNameVisitor.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/internal/FindFieldBySimpleClassNameVisitor.java
@@ -1,36 +1,36 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.internal;
-
-import org.eclipse.scout.rt.client.ui.form.IFormFieldVisitor;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-
-public class FindFieldBySimpleClassNameVisitor implements IFormFieldVisitor {
- private String m_simpleName;
- private IFormField m_found;
-
- public FindFieldBySimpleClassNameVisitor(String simpleName) {
- m_simpleName = simpleName;
- }
-
- @Override
- public boolean visitField(IFormField field, int level, int fieldIndex) {
- if (field.getClass().getSimpleName().equalsIgnoreCase(m_simpleName)) {
- m_found = field;
- }
- return m_found == null;
- }
-
- public IFormField getField() {
- return m_found;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.internal;
+
+import org.eclipse.scout.rt.client.ui.form.IFormFieldVisitor;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+
+public class FindFieldBySimpleClassNameVisitor implements IFormFieldVisitor {
+ private String m_simpleName;
+ private IFormField m_found;
+
+ public FindFieldBySimpleClassNameVisitor(String simpleName) {
+ m_simpleName = simpleName;
+ }
+
+ @Override
+ public boolean visitField(IFormField field, int level, int fieldIndex) {
+ if (field.getClass().getSimpleName().equalsIgnoreCase(m_simpleName)) {
+ m_found = field;
+ }
+ return m_found == null;
+ }
+
+ public IFormField getField() {
+ return m_found;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/internal/FindFieldByXmlIdsVisitor.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/internal/FindFieldByXmlIdsVisitor.java
index 8248ce4f9b..b139161529 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/internal/FindFieldByXmlIdsVisitor.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/internal/FindFieldByXmlIdsVisitor.java
@@ -1,143 +1,143 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.internal;
-
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.TreeMap;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.scout.commons.CompositeObject;
-import org.eclipse.scout.commons.ConfigurationUtility;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.form.IFormFieldVisitor;
-import org.eclipse.scout.rt.client.ui.form.fields.ICompositeField;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
-
-/**
- * @since 3.8.0
- */
-public class FindFieldByXmlIdsVisitor implements IFormFieldVisitor {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(FindFieldByXmlIdsVisitor.class);
-
- private final String[] m_xmlFieldIds;
-
- /**
- * Tree map with candidates. The entry with the largest key is the best matching field.
- */
- private final TreeMap<CompositeObject, IFormField> m_prioMap;
-
- /**
- * Set with ambiguous field keys.
- */
- private final Set<CompositeObject> m_ambiguousFieldKeys;
-
- public FindFieldByXmlIdsVisitor(String... xmlFieldIds) {
- m_xmlFieldIds = xmlFieldIds;
- m_prioMap = new TreeMap<CompositeObject, IFormField>();
- m_ambiguousFieldKeys = new HashSet<CompositeObject>();
- }
-
- @Override
- public boolean visitField(IFormField field, int level, int fieldIndex) {
- int fieldIdRank = getFieldIdRank(field);
- if (fieldIdRank > 0) {
- int enclosingFieldPathRank = getEnclosingFieldPathRank(field);
- CompositeObject key;
- if (field instanceof IValueField) {
- key = new CompositeObject(fieldIdRank, enclosingFieldPathRank, 2);
- }
- else if (!(field instanceof ICompositeField)) {
- key = new CompositeObject(fieldIdRank, enclosingFieldPathRank, 1);
- }
- else {
- key = new CompositeObject(fieldIdRank, enclosingFieldPathRank, 0);
- }
- if (m_prioMap.containsKey(key)) {
- m_ambiguousFieldKeys.add(key);
- }
- else {
- m_prioMap.put(key, field);
- }
- }
- return true;
- }
-
- /**
- * @return Returns the rank of the given field's fieldId path and the one requested by this visitor. A perfect match
- * yields the largest number. 0 is returned if there is no match at all.
- */
- private int getFieldIdRank(IFormField f) {
- // Class primary type
- int i = m_xmlFieldIds.length - 1;
- if (m_xmlFieldIds[i].equals(f.getFieldId())) {
- i--;
- f = f.getParentField();
- }
- else {
- // field does not match
- return 0;
- }
- while (i >= 0 && f != null) {
- if (m_xmlFieldIds[i].equals(f.getFieldId())) {
- i--;
- }
- f = f.getParentField();
- }
- return m_xmlFieldIds.length - 1 - i;
- }
-
- /**
- * @return Returns the rank of the given field's enclosing field path and the one the is requested by this visitor. A
- * perfect match yields 0. Every mismatch reduces the match by 1. Hence the smallest (negative) number has the
- * worst match.
- */
- private int getEnclosingFieldPathRank(IFormField f) {
- int rank = 0;
- int i = m_xmlFieldIds.length - 2; // the last segment is the field id, i.e. not part of the enclosing field path
- Class<?> currentEnclosingContainerType = ConfigurationUtility.getEnclosingContainerType(f);
- ICompositeField p = f.getParentField();
- while (p != null) {
- Class<?> enclosingContainerType = ConfigurationUtility.getEnclosingContainerType(p);
- if (enclosingContainerType != currentEnclosingContainerType) {
- if (i >= 0 && p.getFieldId().equals(m_xmlFieldIds[i])) {
- i--;
- }
- else {
- rank--;
- }
- currentEnclosingContainerType = enclosingContainerType;
- }
- p = p.getParentField();
- }
- return rank;
- }
-
- /**
- * @return Returns the best matching form field or <code>null</code>.
- */
- public IFormField getField() {
- if (m_prioMap.isEmpty()) {
- return null;
- }
- Entry<CompositeObject, IFormField> candidate = m_prioMap.lastEntry();
- if (m_ambiguousFieldKeys.contains(candidate.getKey())) {
- if (Platform.inDevelopmentMode() && LOG.isWarnEnabled()) {
- LOG.warn("ambiguous fieldId: " + Arrays.toString(m_xmlFieldIds) + " returning first candidate [" + candidate.getValue() + "]");
- }
- }
- return candidate.getValue();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.internal;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.TreeMap;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.scout.commons.CompositeObject;
+import org.eclipse.scout.commons.ConfigurationUtility;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.form.IFormFieldVisitor;
+import org.eclipse.scout.rt.client.ui.form.fields.ICompositeField;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
+
+/**
+ * @since 3.8.0
+ */
+public class FindFieldByXmlIdsVisitor implements IFormFieldVisitor {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(FindFieldByXmlIdsVisitor.class);
+
+ private final String[] m_xmlFieldIds;
+
+ /**
+ * Tree map with candidates. The entry with the largest key is the best matching field.
+ */
+ private final TreeMap<CompositeObject, IFormField> m_prioMap;
+
+ /**
+ * Set with ambiguous field keys.
+ */
+ private final Set<CompositeObject> m_ambiguousFieldKeys;
+
+ public FindFieldByXmlIdsVisitor(String... xmlFieldIds) {
+ m_xmlFieldIds = xmlFieldIds;
+ m_prioMap = new TreeMap<CompositeObject, IFormField>();
+ m_ambiguousFieldKeys = new HashSet<CompositeObject>();
+ }
+
+ @Override
+ public boolean visitField(IFormField field, int level, int fieldIndex) {
+ int fieldIdRank = getFieldIdRank(field);
+ if (fieldIdRank > 0) {
+ int enclosingFieldPathRank = getEnclosingFieldPathRank(field);
+ CompositeObject key;
+ if (field instanceof IValueField) {
+ key = new CompositeObject(fieldIdRank, enclosingFieldPathRank, 2);
+ }
+ else if (!(field instanceof ICompositeField)) {
+ key = new CompositeObject(fieldIdRank, enclosingFieldPathRank, 1);
+ }
+ else {
+ key = new CompositeObject(fieldIdRank, enclosingFieldPathRank, 0);
+ }
+ if (m_prioMap.containsKey(key)) {
+ m_ambiguousFieldKeys.add(key);
+ }
+ else {
+ m_prioMap.put(key, field);
+ }
+ }
+ return true;
+ }
+
+ /**
+ * @return Returns the rank of the given field's fieldId path and the one requested by this visitor. A perfect match
+ * yields the largest number. 0 is returned if there is no match at all.
+ */
+ private int getFieldIdRank(IFormField f) {
+ // Class primary type
+ int i = m_xmlFieldIds.length - 1;
+ if (m_xmlFieldIds[i].equals(f.getFieldId())) {
+ i--;
+ f = f.getParentField();
+ }
+ else {
+ // field does not match
+ return 0;
+ }
+ while (i >= 0 && f != null) {
+ if (m_xmlFieldIds[i].equals(f.getFieldId())) {
+ i--;
+ }
+ f = f.getParentField();
+ }
+ return m_xmlFieldIds.length - 1 - i;
+ }
+
+ /**
+ * @return Returns the rank of the given field's enclosing field path and the one the is requested by this visitor. A
+ * perfect match yields 0. Every mismatch reduces the match by 1. Hence the smallest (negative) number has the
+ * worst match.
+ */
+ private int getEnclosingFieldPathRank(IFormField f) {
+ int rank = 0;
+ int i = m_xmlFieldIds.length - 2; // the last segment is the field id, i.e. not part of the enclosing field path
+ Class<?> currentEnclosingContainerType = ConfigurationUtility.getEnclosingContainerType(f);
+ ICompositeField p = f.getParentField();
+ while (p != null) {
+ Class<?> enclosingContainerType = ConfigurationUtility.getEnclosingContainerType(p);
+ if (enclosingContainerType != currentEnclosingContainerType) {
+ if (i >= 0 && p.getFieldId().equals(m_xmlFieldIds[i])) {
+ i--;
+ }
+ else {
+ rank--;
+ }
+ currentEnclosingContainerType = enclosingContainerType;
+ }
+ p = p.getParentField();
+ }
+ return rank;
+ }
+
+ /**
+ * @return Returns the best matching form field or <code>null</code>.
+ */
+ public IFormField getField() {
+ if (m_prioMap.isEmpty()) {
+ return null;
+ }
+ Entry<CompositeObject, IFormField> candidate = m_prioMap.lastEntry();
+ if (m_ambiguousFieldKeys.contains(candidate.getKey())) {
+ if (Platform.inDevelopmentMode() && LOG.isWarnEnabled()) {
+ LOG.warn("ambiguous fieldId: " + Arrays.toString(m_xmlFieldIds) + " returning first candidate [" + candidate.getValue() + "]");
+ }
+ }
+ return candidate.getValue();
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/internal/FormDataPropertyFilter.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/internal/FormDataPropertyFilter.java
index 1c0a06e3af..257566e408 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/internal/FormDataPropertyFilter.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/internal/FormDataPropertyFilter.java
@@ -1,52 +1,52 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.internal;
-
-import java.io.Serializable;
-
-import org.eclipse.scout.commons.beans.FastPropertyDescriptor;
-import org.eclipse.scout.commons.beans.IPropertyFilter;
-import org.eclipse.scout.rt.shared.data.form.fields.AbstractFormFieldData;
-import org.eclipse.scout.rt.shared.data.form.properties.AbstractPropertyData;
-
-public class FormDataPropertyFilter implements IPropertyFilter {
-
- public FormDataPropertyFilter() {
- }
-
- @Override
- public boolean accept(FastPropertyDescriptor descriptor) {
- Class<?> propertyType = descriptor.getPropertyType();
- if (propertyType == null) {
- return false;
- }
- if (descriptor.getReadMethod() == null) {
- return false;
- }
- if (descriptor.getWriteMethod() == null) {
- return false;
- }
- //do NOT filter out AbstractFormData values
- if (AbstractFormFieldData.class.isAssignableFrom(propertyType)) {
- return false;
- }
- if (AbstractPropertyData.class.isAssignableFrom(propertyType)) {
- return false;
- }
- if (descriptor.getName().startsWith("configured")) {
- return false;
- }
- if ((!propertyType.isPrimitive()) && (!propertyType.isInterface()) && !Serializable.class.isAssignableFrom(propertyType)) {
- return false;
- }
- return true;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.internal;
+
+import java.io.Serializable;
+
+import org.eclipse.scout.commons.beans.FastPropertyDescriptor;
+import org.eclipse.scout.commons.beans.IPropertyFilter;
+import org.eclipse.scout.rt.shared.data.form.fields.AbstractFormFieldData;
+import org.eclipse.scout.rt.shared.data.form.properties.AbstractPropertyData;
+
+public class FormDataPropertyFilter implements IPropertyFilter {
+
+ public FormDataPropertyFilter() {
+ }
+
+ @Override
+ public boolean accept(FastPropertyDescriptor descriptor) {
+ Class<?> propertyType = descriptor.getPropertyType();
+ if (propertyType == null) {
+ return false;
+ }
+ if (descriptor.getReadMethod() == null) {
+ return false;
+ }
+ if (descriptor.getWriteMethod() == null) {
+ return false;
+ }
+ //do NOT filter out AbstractFormData values
+ if (AbstractFormFieldData.class.isAssignableFrom(propertyType)) {
+ return false;
+ }
+ if (AbstractPropertyData.class.isAssignableFrom(propertyType)) {
+ return false;
+ }
+ if (descriptor.getName().startsWith("configured")) {
+ return false;
+ }
+ if ((!propertyType.isPrimitive()) && (!propertyType.isInterface()) && !Serializable.class.isAssignableFrom(propertyType)) {
+ return false;
+ }
+ return true;
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/outline/DefaultOutlineTableForm.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/outline/DefaultOutlineTableForm.java
index 0a91bd1763..4711149ffc 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/outline/DefaultOutlineTableForm.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/outline/DefaultOutlineTableForm.java
@@ -1,170 +1,170 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.outline;
-
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.IProcessingStatus;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.exception.ProcessingStatus;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
-import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
-import org.eclipse.scout.rt.client.ui.desktop.outline.AbstractOutlineTableField;
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutlineTableForm;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
-import org.eclipse.scout.rt.client.ui.form.AbstractForm;
-import org.eclipse.scout.rt.client.ui.form.AbstractFormHandler;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
-import org.eclipse.scout.rt.client.ui.form.outline.DefaultOutlineTableForm.MainBox.OutlineTableField;
-
-/**
- * Default form displaying the current page's table
- */
-public class DefaultOutlineTableForm extends AbstractForm implements IOutlineTableForm {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(DefaultOutlineTableForm.class);
-
- public DefaultOutlineTableForm() throws ProcessingException {
- super();
- }
-
- @Override
- protected boolean getConfiguredAskIfNeedSave() {
- return false;
- }
-
- @Override
- protected int getConfiguredDisplayHint() {
- return DISPLAY_HINT_VIEW;
- }
-
- @Override
- protected String getConfiguredDisplayViewId() {
- return VIEW_ID_PAGE_TABLE;
- }
-
- @Override
- public ITable getCurrentTable() {
- return getOutlineTableField().getTable();
- }
-
- @Override
- public void setCurrentTable(ITable table) {
- getOutlineTableField().installTable(table);
- }
-
- public MainBox getMainBox() {
- return (MainBox) getRootGroupBox();
- }
-
- public OutlineTableField getOutlineTableField() {
- return getFieldByClass(OutlineTableField.class);
- }
-
- public void startView() throws ProcessingException {
- setAutoAddRemoveOnDesktop(false);
- startInternal(new ViewHandler());
- ClientSyncJob.getCurrentSession().getDesktop().setOutlineTableForm(this);
- }
-
- @Order(10.0f)
- public class MainBox extends AbstractGroupBox {
-
- @Override
- protected boolean getConfiguredBorderVisible() {
- return false;
- }
-
- @Override
- protected int getConfiguredGridColumnCount() {
- return 2;
- }
-
- @Order(10.0f)
- public class OutlineTableField extends AbstractOutlineTableField {
-
- @Override
- protected int getConfiguredGridW() {
- return 2;
- }
-
- @Override
- protected int getConfiguredGridH() {
- return 2;
- }
-
- @Override
- protected boolean getConfiguredTableStatusVisible() {
- return true;
- }
-
- @Override
- protected void execUpdateTableStatus() {
- if (!isTableStatusVisible()) {
- return;
- }
- IOutline outline = getDesktop().getOutline();
- // populate status
- IProcessingStatus populateStatus = null;
- if (outline != null && outline.getActivePage() != null) {
- IPage activePage = outline.getActivePage();
- populateStatus = activePage.getPagePopulateStatus();
- }
- setTablePopulateStatus(populateStatus);
-
- // selection status for table pages only
- IProcessingStatus selectionStatus = null;
- if (outline != null && outline.getActivePage() instanceof IPageWithTable<?>) {
- IPageWithTable<?> tablePage = (IPageWithTable<?>) outline.getActivePage();
- //selection status
- if (tablePage.isSearchActive() && tablePage.getSearchFilter() != null && (!tablePage.getSearchFilter().isCompleted()) && tablePage.isSearchRequired()) {
- // clear status
- }
- else if (populateStatus != null && populateStatus.getSeverity() == IProcessingStatus.WARNING) {
- // clear status
- }
- else {
- selectionStatus = new ProcessingStatus(createDefaultTableStatus(), IProcessingStatus.INFO);
- }
- }
- setTableSelectionStatus(selectionStatus);
- }
-
- @Override
- protected void execTableTitleChanged() {
- IDesktop desktop = ClientSyncJob.getCurrentSession().getDesktop();
- ITreeNode node = null;
- if (getTable() != null) {
- if (desktop.getOutline() != null) {
- node = desktop.getOutline().getSelectedNode();
- }
- }
- // set form title and form icon
- if (node != null) {
- setTitle(desktop.getOutline().getPathText(node));
- setIconId(node.getCell().getIconId());
- }
- else {
- setTitle(null);
- setIconId(null);
- }
- }
- }
- }
-
- @Order(10.0f)
- public class ViewHandler extends AbstractFormHandler {
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.outline;
+
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.IProcessingStatus;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.exception.ProcessingStatus;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
+import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
+import org.eclipse.scout.rt.client.ui.desktop.outline.AbstractOutlineTableField;
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutlineTableForm;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
+import org.eclipse.scout.rt.client.ui.form.AbstractForm;
+import org.eclipse.scout.rt.client.ui.form.AbstractFormHandler;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
+import org.eclipse.scout.rt.client.ui.form.outline.DefaultOutlineTableForm.MainBox.OutlineTableField;
+
+/**
+ * Default form displaying the current page's table
+ */
+public class DefaultOutlineTableForm extends AbstractForm implements IOutlineTableForm {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(DefaultOutlineTableForm.class);
+
+ public DefaultOutlineTableForm() throws ProcessingException {
+ super();
+ }
+
+ @Override
+ protected boolean getConfiguredAskIfNeedSave() {
+ return false;
+ }
+
+ @Override
+ protected int getConfiguredDisplayHint() {
+ return DISPLAY_HINT_VIEW;
+ }
+
+ @Override
+ protected String getConfiguredDisplayViewId() {
+ return VIEW_ID_PAGE_TABLE;
+ }
+
+ @Override
+ public ITable getCurrentTable() {
+ return getOutlineTableField().getTable();
+ }
+
+ @Override
+ public void setCurrentTable(ITable table) {
+ getOutlineTableField().installTable(table);
+ }
+
+ public MainBox getMainBox() {
+ return (MainBox) getRootGroupBox();
+ }
+
+ public OutlineTableField getOutlineTableField() {
+ return getFieldByClass(OutlineTableField.class);
+ }
+
+ public void startView() throws ProcessingException {
+ setAutoAddRemoveOnDesktop(false);
+ startInternal(new ViewHandler());
+ ClientSyncJob.getCurrentSession().getDesktop().setOutlineTableForm(this);
+ }
+
+ @Order(10.0f)
+ public class MainBox extends AbstractGroupBox {
+
+ @Override
+ protected boolean getConfiguredBorderVisible() {
+ return false;
+ }
+
+ @Override
+ protected int getConfiguredGridColumnCount() {
+ return 2;
+ }
+
+ @Order(10.0f)
+ public class OutlineTableField extends AbstractOutlineTableField {
+
+ @Override
+ protected int getConfiguredGridW() {
+ return 2;
+ }
+
+ @Override
+ protected int getConfiguredGridH() {
+ return 2;
+ }
+
+ @Override
+ protected boolean getConfiguredTableStatusVisible() {
+ return true;
+ }
+
+ @Override
+ protected void execUpdateTableStatus() {
+ if (!isTableStatusVisible()) {
+ return;
+ }
+ IOutline outline = getDesktop().getOutline();
+ // populate status
+ IProcessingStatus populateStatus = null;
+ if (outline != null && outline.getActivePage() != null) {
+ IPage activePage = outline.getActivePage();
+ populateStatus = activePage.getPagePopulateStatus();
+ }
+ setTablePopulateStatus(populateStatus);
+
+ // selection status for table pages only
+ IProcessingStatus selectionStatus = null;
+ if (outline != null && outline.getActivePage() instanceof IPageWithTable<?>) {
+ IPageWithTable<?> tablePage = (IPageWithTable<?>) outline.getActivePage();
+ //selection status
+ if (tablePage.isSearchActive() && tablePage.getSearchFilter() != null && (!tablePage.getSearchFilter().isCompleted()) && tablePage.isSearchRequired()) {
+ // clear status
+ }
+ else if (populateStatus != null && populateStatus.getSeverity() == IProcessingStatus.WARNING) {
+ // clear status
+ }
+ else {
+ selectionStatus = new ProcessingStatus(createDefaultTableStatus(), IProcessingStatus.INFO);
+ }
+ }
+ setTableSelectionStatus(selectionStatus);
+ }
+
+ @Override
+ protected void execTableTitleChanged() {
+ IDesktop desktop = ClientSyncJob.getCurrentSession().getDesktop();
+ ITreeNode node = null;
+ if (getTable() != null) {
+ if (desktop.getOutline() != null) {
+ node = desktop.getOutline().getSelectedNode();
+ }
+ }
+ // set form title and form icon
+ if (node != null) {
+ setTitle(desktop.getOutline().getPathText(node));
+ setIconId(node.getCell().getIconId());
+ }
+ else {
+ setTitle(null);
+ setIconId(null);
+ }
+ }
+ }
+ }
+
+ @Order(10.0f)
+ public class ViewHandler extends AbstractFormHandler {
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/outline/DefaultOutlineTreeForm.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/outline/DefaultOutlineTreeForm.java
index b4437a27fd..e3664722c2 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/outline/DefaultOutlineTreeForm.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/outline/DefaultOutlineTreeForm.java
@@ -1,145 +1,145 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.outline;
-
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITree;
-import org.eclipse.scout.rt.client.ui.desktop.DesktopEvent;
-import org.eclipse.scout.rt.client.ui.desktop.DesktopListener;
-import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutlineTreeForm;
-import org.eclipse.scout.rt.client.ui.form.AbstractForm;
-import org.eclipse.scout.rt.client.ui.form.AbstractFormHandler;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
-import org.eclipse.scout.rt.client.ui.form.fields.treefield.AbstractTreeField;
-import org.eclipse.scout.rt.client.ui.form.outline.DefaultOutlineTreeForm.MainBox.OutlineTreeField;
-
-public class DefaultOutlineTreeForm extends AbstractForm implements IOutlineTreeForm {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(DefaultOutlineTreeForm.class);
- private DesktopListener m_desktopListener;
-
- public DefaultOutlineTreeForm() throws ProcessingException {
- super();
- }
-
- @Override
- protected boolean getConfiguredAskIfNeedSave() {
- return false;
- }
-
- @Override
- protected boolean getConfiguredCacheBounds() {
- return true;
- }
-
- @Override
- protected int getConfiguredDisplayHint() {
- return DISPLAY_HINT_VIEW;
- }
-
- @Override
- protected String getConfiguredDisplayViewId() {
- return VIEW_ID_OUTLINE;
- }
-
- @Override
- protected void execInitForm() throws ProcessingException {
- m_desktopListener = new DesktopListener() {
- @Override
- public void desktopChanged(DesktopEvent e) {
- switch (e.getType()) {
- case DesktopEvent.TYPE_OUTLINE_CHANGED: {
- installTree(e.getOutline());
- break;
- }
- }
- }
-
- };
- IDesktop desktop = ClientSyncJob.getCurrentSession().getDesktop();
- desktop.addDesktopListener(m_desktopListener);
- installTree(desktop.getOutline());
-
- }
-
- @Override
- protected void execDisposeForm() throws ProcessingException {
- super.execDisposeForm();
- ClientSyncJob.getCurrentSession().getDesktop().removeDesktopListener(m_desktopListener);
- m_desktopListener = null;
- }
-
- private void installTree(ITree tree) {
- getOutlineTreeField().setTree(tree, true);
- // IDesktop desktop=ClientJob.getCurrentSession().getDesktop();
- if (tree != null) {
- setTitle(tree.getTitle());
- setIconId(tree.getIconId());
- }
- }
-
- public MainBox getMainBox() {
- return (MainBox) getRootGroupBox();
- }
-
- public OutlineTreeField getOutlineTreeField() {
- return getFieldByClass(OutlineTreeField.class);
- }
-
- public void startView() throws ProcessingException {
- startInternal(new ViewHandler());
- }
-
- @Order(10.0f)
- public class MainBox extends AbstractGroupBox {
-
- @Override
- protected boolean getConfiguredBorderVisible() {
- return false;
- }
-
- @Override
- protected String getConfiguredBorderDecoration() {
- return BORDER_DECORATION_EMPTY;
- }
-
- @Override
- protected int getConfiguredGridColumnCount() {
- return 1;
- }
-
- @Order(10.0f)
- public class OutlineTreeField extends AbstractTreeField {
- @Override
- protected boolean getConfiguredLabelVisible() {
- return false;
- }
-
- @Override
- protected int getConfiguredGridW() {
- return 1;
- }
-
- @Override
- protected int getConfiguredGridH() {
- return 20;
- }
- }
- }
-
- @Order(10.0f)
- public class ViewHandler extends AbstractFormHandler {
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.outline;
+
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITree;
+import org.eclipse.scout.rt.client.ui.desktop.DesktopEvent;
+import org.eclipse.scout.rt.client.ui.desktop.DesktopListener;
+import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutlineTreeForm;
+import org.eclipse.scout.rt.client.ui.form.AbstractForm;
+import org.eclipse.scout.rt.client.ui.form.AbstractFormHandler;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
+import org.eclipse.scout.rt.client.ui.form.fields.treefield.AbstractTreeField;
+import org.eclipse.scout.rt.client.ui.form.outline.DefaultOutlineTreeForm.MainBox.OutlineTreeField;
+
+public class DefaultOutlineTreeForm extends AbstractForm implements IOutlineTreeForm {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(DefaultOutlineTreeForm.class);
+ private DesktopListener m_desktopListener;
+
+ public DefaultOutlineTreeForm() throws ProcessingException {
+ super();
+ }
+
+ @Override
+ protected boolean getConfiguredAskIfNeedSave() {
+ return false;
+ }
+
+ @Override
+ protected boolean getConfiguredCacheBounds() {
+ return true;
+ }
+
+ @Override
+ protected int getConfiguredDisplayHint() {
+ return DISPLAY_HINT_VIEW;
+ }
+
+ @Override
+ protected String getConfiguredDisplayViewId() {
+ return VIEW_ID_OUTLINE;
+ }
+
+ @Override
+ protected void execInitForm() throws ProcessingException {
+ m_desktopListener = new DesktopListener() {
+ @Override
+ public void desktopChanged(DesktopEvent e) {
+ switch (e.getType()) {
+ case DesktopEvent.TYPE_OUTLINE_CHANGED: {
+ installTree(e.getOutline());
+ break;
+ }
+ }
+ }
+
+ };
+ IDesktop desktop = ClientSyncJob.getCurrentSession().getDesktop();
+ desktop.addDesktopListener(m_desktopListener);
+ installTree(desktop.getOutline());
+
+ }
+
+ @Override
+ protected void execDisposeForm() throws ProcessingException {
+ super.execDisposeForm();
+ ClientSyncJob.getCurrentSession().getDesktop().removeDesktopListener(m_desktopListener);
+ m_desktopListener = null;
+ }
+
+ private void installTree(ITree tree) {
+ getOutlineTreeField().setTree(tree, true);
+ // IDesktop desktop=ClientJob.getCurrentSession().getDesktop();
+ if (tree != null) {
+ setTitle(tree.getTitle());
+ setIconId(tree.getIconId());
+ }
+ }
+
+ public MainBox getMainBox() {
+ return (MainBox) getRootGroupBox();
+ }
+
+ public OutlineTreeField getOutlineTreeField() {
+ return getFieldByClass(OutlineTreeField.class);
+ }
+
+ public void startView() throws ProcessingException {
+ startInternal(new ViewHandler());
+ }
+
+ @Order(10.0f)
+ public class MainBox extends AbstractGroupBox {
+
+ @Override
+ protected boolean getConfiguredBorderVisible() {
+ return false;
+ }
+
+ @Override
+ protected String getConfiguredBorderDecoration() {
+ return BORDER_DECORATION_EMPTY;
+ }
+
+ @Override
+ protected int getConfiguredGridColumnCount() {
+ return 1;
+ }
+
+ @Order(10.0f)
+ public class OutlineTreeField extends AbstractTreeField {
+ @Override
+ protected boolean getConfiguredLabelVisible() {
+ return false;
+ }
+
+ @Override
+ protected int getConfiguredGridW() {
+ return 1;
+ }
+
+ @Override
+ protected int getConfiguredGridH() {
+ return 20;
+ }
+ }
+ }
+
+ @Order(10.0f)
+ public class ViewHandler extends AbstractFormHandler {
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/useradmin/DefaultPasswordForm.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/useradmin/DefaultPasswordForm.java
index a443e31f1f..a29d05bae0 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/useradmin/DefaultPasswordForm.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/form/useradmin/DefaultPasswordForm.java
@@ -1,200 +1,200 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.form.useradmin;
-
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.exception.VetoException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.form.AbstractForm;
-import org.eclipse.scout.rt.client.ui.form.AbstractFormHandler;
-import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractCancelButton;
-import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractOkButton;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
-import org.eclipse.scout.rt.client.ui.form.fields.stringfield.AbstractStringField;
-import org.eclipse.scout.rt.client.ui.form.useradmin.DefaultPasswordForm.MainBox.CancelButton;
-import org.eclipse.scout.rt.client.ui.form.useradmin.DefaultPasswordForm.MainBox.OkButton;
-import org.eclipse.scout.rt.client.ui.form.useradmin.DefaultPasswordForm.MainBox.GroupBox.NewPasswordField;
-import org.eclipse.scout.rt.client.ui.form.useradmin.DefaultPasswordForm.MainBox.GroupBox.OldPasswordField;
-import org.eclipse.scout.rt.client.ui.form.useradmin.DefaultPasswordForm.MainBox.GroupBox.RepeatPasswordField;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.services.common.pwd.IPasswordManagementService;
-import org.eclipse.scout.service.SERVICES;
-
-public class DefaultPasswordForm extends AbstractForm {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(DefaultPasswordForm.class);
-
- private String m_userId;
-
- public DefaultPasswordForm() throws ProcessingException {
- super();
- }
-
- public String getUserId() {
- return m_userId;
- }
-
- public void setUserId(String userId) {
- m_userId = userId;
- }
-
- @Override
- protected String getConfiguredTitle() {
- return ScoutTexts.get("ChangePassword");
- }
-
- public MainBox getMainBox() {
- return (MainBox) getRootGroupBox();
- }
-
- public OldPasswordField getOldPasswordField() {
- return getFieldByClass(OldPasswordField.class);
- }
-
- public NewPasswordField getNewPasswordField() {
- return getFieldByClass(NewPasswordField.class);
- }
-
- public RepeatPasswordField getRepeatPasswordField() {
- return getFieldByClass(RepeatPasswordField.class);
- }
-
- public OkButton getOkButton() {
- return getFieldByClass(OkButton.class);
- }
-
- public CancelButton getCancelButton() {
- return getFieldByClass(CancelButton.class);
- }
-
- public void startChange() throws ProcessingException {
- startInternal(new ChangeHandler());
- }
-
- public void startReset() throws ProcessingException {
- startInternal(new ResetHandler());
- }
-
- @Order(20.0)
- public class MainBox extends AbstractGroupBox {
-
- @Order(10.0)
- public class GroupBox extends AbstractGroupBox {
-
- @Order(10.0)
- public class OldPasswordField extends AbstractStringField {
-
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("OldPassword");
- }
-
- @Override
- protected boolean getConfiguredMandatory() {
- return true;
- }
-
- @Override
- protected boolean getConfiguredInputMasked() {
- return true;
- }
- }
-
- @Order(20.0)
- public class NewPasswordField extends AbstractStringField {
-
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("NewPassword");
- }
-
- @Override
- protected boolean getConfiguredMandatory() {
- return true;
- }
-
- @Override
- protected boolean getConfiguredInputMasked() {
- return true;
- }
- }
-
- @Order(30.0)
- public class RepeatPasswordField extends AbstractStringField {
-
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("RepeatPassword");
- }
-
- @Override
- protected boolean getConfiguredMandatory() {
- return true;
- }
-
- @Override
- protected boolean getConfiguredInputMasked() {
- return true;
- }
- }
- }
-
- @Order(40.0)
- public class OkButton extends AbstractOkButton {
- }
-
- @Order(50.0)
- public class CancelButton extends AbstractCancelButton {
- }
-
- @Override
- protected int getConfiguredGridColumnCount() {
- return 1;
- }
- }
-
- @Order(10.0)
- public class ResetHandler extends AbstractFormHandler {
-
- @Override
- protected void execLoad() throws ProcessingException {
- getOldPasswordField().setMandatory(false);
- getOldPasswordField().setVisible(false);
- }
-
- @Override
- protected void execStore() throws ProcessingException {
- if (getNewPasswordField().getValue() != null && !getNewPasswordField().getValue().equals(getRepeatPasswordField().getValue())) {
- throw new VetoException(ScoutTexts.get("PasswordsDoNotMatch"));
- }
- IPasswordManagementService svc = SERVICES.getService(IPasswordManagementService.class);
- svc.resetPassword(getUserId(), getNewPasswordField().getValue());
- }
- }
-
- @Order(20.0)
- public class ChangeHandler extends AbstractFormHandler {
-
- @Override
- protected void execLoad() throws ProcessingException {
- }
-
- @Override
- protected void execStore() throws ProcessingException {
- if (getNewPasswordField().getValue() != null && !getNewPasswordField().getValue().equals(getRepeatPasswordField().getValue())) {
- throw new VetoException(ScoutTexts.get("PasswordsDoNotMatch"));
- }
- IPasswordManagementService svc = SERVICES.getService(IPasswordManagementService.class);
- svc.changePassword(getUserId(), getOldPasswordField().getValue(), getNewPasswordField().getValue());
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.form.useradmin;
+
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.exception.VetoException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.form.AbstractForm;
+import org.eclipse.scout.rt.client.ui.form.AbstractFormHandler;
+import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractCancelButton;
+import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractOkButton;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
+import org.eclipse.scout.rt.client.ui.form.fields.stringfield.AbstractStringField;
+import org.eclipse.scout.rt.client.ui.form.useradmin.DefaultPasswordForm.MainBox.CancelButton;
+import org.eclipse.scout.rt.client.ui.form.useradmin.DefaultPasswordForm.MainBox.OkButton;
+import org.eclipse.scout.rt.client.ui.form.useradmin.DefaultPasswordForm.MainBox.GroupBox.NewPasswordField;
+import org.eclipse.scout.rt.client.ui.form.useradmin.DefaultPasswordForm.MainBox.GroupBox.OldPasswordField;
+import org.eclipse.scout.rt.client.ui.form.useradmin.DefaultPasswordForm.MainBox.GroupBox.RepeatPasswordField;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.services.common.pwd.IPasswordManagementService;
+import org.eclipse.scout.service.SERVICES;
+
+public class DefaultPasswordForm extends AbstractForm {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(DefaultPasswordForm.class);
+
+ private String m_userId;
+
+ public DefaultPasswordForm() throws ProcessingException {
+ super();
+ }
+
+ public String getUserId() {
+ return m_userId;
+ }
+
+ public void setUserId(String userId) {
+ m_userId = userId;
+ }
+
+ @Override
+ protected String getConfiguredTitle() {
+ return ScoutTexts.get("ChangePassword");
+ }
+
+ public MainBox getMainBox() {
+ return (MainBox) getRootGroupBox();
+ }
+
+ public OldPasswordField getOldPasswordField() {
+ return getFieldByClass(OldPasswordField.class);
+ }
+
+ public NewPasswordField getNewPasswordField() {
+ return getFieldByClass(NewPasswordField.class);
+ }
+
+ public RepeatPasswordField getRepeatPasswordField() {
+ return getFieldByClass(RepeatPasswordField.class);
+ }
+
+ public OkButton getOkButton() {
+ return getFieldByClass(OkButton.class);
+ }
+
+ public CancelButton getCancelButton() {
+ return getFieldByClass(CancelButton.class);
+ }
+
+ public void startChange() throws ProcessingException {
+ startInternal(new ChangeHandler());
+ }
+
+ public void startReset() throws ProcessingException {
+ startInternal(new ResetHandler());
+ }
+
+ @Order(20.0)
+ public class MainBox extends AbstractGroupBox {
+
+ @Order(10.0)
+ public class GroupBox extends AbstractGroupBox {
+
+ @Order(10.0)
+ public class OldPasswordField extends AbstractStringField {
+
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("OldPassword");
+ }
+
+ @Override
+ protected boolean getConfiguredMandatory() {
+ return true;
+ }
+
+ @Override
+ protected boolean getConfiguredInputMasked() {
+ return true;
+ }
+ }
+
+ @Order(20.0)
+ public class NewPasswordField extends AbstractStringField {
+
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("NewPassword");
+ }
+
+ @Override
+ protected boolean getConfiguredMandatory() {
+ return true;
+ }
+
+ @Override
+ protected boolean getConfiguredInputMasked() {
+ return true;
+ }
+ }
+
+ @Order(30.0)
+ public class RepeatPasswordField extends AbstractStringField {
+
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("RepeatPassword");
+ }
+
+ @Override
+ protected boolean getConfiguredMandatory() {
+ return true;
+ }
+
+ @Override
+ protected boolean getConfiguredInputMasked() {
+ return true;
+ }
+ }
+ }
+
+ @Order(40.0)
+ public class OkButton extends AbstractOkButton {
+ }
+
+ @Order(50.0)
+ public class CancelButton extends AbstractCancelButton {
+ }
+
+ @Override
+ protected int getConfiguredGridColumnCount() {
+ return 1;
+ }
+ }
+
+ @Order(10.0)
+ public class ResetHandler extends AbstractFormHandler {
+
+ @Override
+ protected void execLoad() throws ProcessingException {
+ getOldPasswordField().setMandatory(false);
+ getOldPasswordField().setVisible(false);
+ }
+
+ @Override
+ protected void execStore() throws ProcessingException {
+ if (getNewPasswordField().getValue() != null && !getNewPasswordField().getValue().equals(getRepeatPasswordField().getValue())) {
+ throw new VetoException(ScoutTexts.get("PasswordsDoNotMatch"));
+ }
+ IPasswordManagementService svc = SERVICES.getService(IPasswordManagementService.class);
+ svc.resetPassword(getUserId(), getNewPasswordField().getValue());
+ }
+ }
+
+ @Order(20.0)
+ public class ChangeHandler extends AbstractFormHandler {
+
+ @Override
+ protected void execLoad() throws ProcessingException {
+ }
+
+ @Override
+ protected void execStore() throws ProcessingException {
+ if (getNewPasswordField().getValue() != null && !getNewPasswordField().getValue().equals(getRepeatPasswordField().getValue())) {
+ throw new VetoException(ScoutTexts.get("PasswordsDoNotMatch"));
+ }
+ IPasswordManagementService svc = SERVICES.getService(IPasswordManagementService.class);
+ svc.changePassword(getUserId(), getOldPasswordField().getValue(), getNewPasswordField().getValue());
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/messagebox/IMessageBox.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/messagebox/IMessageBox.java
index a56e24cfbc..f3f1fa5c4c 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/messagebox/IMessageBox.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/messagebox/IMessageBox.java
@@ -1,95 +1,95 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.messagebox;
-
-import org.eclipse.scout.commons.beans.IPropertyObserver;
-
-public interface IMessageBox extends IPropertyObserver {
-
- /**
- * Result status YES
- */
- int YES_OPTION = 0;
- /**
- * Result status NO
- */
- int NO_OPTION = 1;
- /**
- * Result status CANCEL
- */
- int CANCEL_OPTION = 2;
-
- /*
- * Model observer
- */
- void addMessageBoxListener(MessageBoxListener listener);
-
- void removeMessageBoxListener(MessageBoxListener listener);
-
- /*
- * ui messaging
- */
- IMessageBoxUIFacade getUIFacade();
-
- String getTitle();
-
- void setTitle(String s);
-
- String getIconId();
-
- void setIconId(String iconId);
-
- int getSeverity();
-
- void setSeverity(int severity);
-
- String getIntroText();
-
- void setIntroText(String s);
-
- String getActionText();
-
- void setActionText(String s);
-
- String getHiddenText();
-
- void setHiddenText(String s);
-
- String getYesButtonText();
-
- void setYesButtonText(String s);
-
- String getNoButtonText();
-
- void setNoButtonText(String s);
-
- String getCancelButtonText();
-
- void setCancelButtonText(String s);
-
- long getAutoCloseMillis();
-
- void setAutoCloseMillis(long millis);
-
- String getCopyPasteText();
-
- void setCopyPasteText(String s);
-
- boolean isOpen();
-
- /**
- * start a blocking message box and wait until it returns the result
- * (YES,NO,CANCEL)
- */
- int startMessageBox();
-
- int startMessageBox(int defaultResult);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.messagebox;
+
+import org.eclipse.scout.commons.beans.IPropertyObserver;
+
+public interface IMessageBox extends IPropertyObserver {
+
+ /**
+ * Result status YES
+ */
+ int YES_OPTION = 0;
+ /**
+ * Result status NO
+ */
+ int NO_OPTION = 1;
+ /**
+ * Result status CANCEL
+ */
+ int CANCEL_OPTION = 2;
+
+ /*
+ * Model observer
+ */
+ void addMessageBoxListener(MessageBoxListener listener);
+
+ void removeMessageBoxListener(MessageBoxListener listener);
+
+ /*
+ * ui messaging
+ */
+ IMessageBoxUIFacade getUIFacade();
+
+ String getTitle();
+
+ void setTitle(String s);
+
+ String getIconId();
+
+ void setIconId(String iconId);
+
+ int getSeverity();
+
+ void setSeverity(int severity);
+
+ String getIntroText();
+
+ void setIntroText(String s);
+
+ String getActionText();
+
+ void setActionText(String s);
+
+ String getHiddenText();
+
+ void setHiddenText(String s);
+
+ String getYesButtonText();
+
+ void setYesButtonText(String s);
+
+ String getNoButtonText();
+
+ void setNoButtonText(String s);
+
+ String getCancelButtonText();
+
+ void setCancelButtonText(String s);
+
+ long getAutoCloseMillis();
+
+ void setAutoCloseMillis(long millis);
+
+ String getCopyPasteText();
+
+ void setCopyPasteText(String s);
+
+ boolean isOpen();
+
+ /**
+ * start a blocking message box and wait until it returns the result
+ * (YES,NO,CANCEL)
+ */
+ int startMessageBox();
+
+ int startMessageBox(int defaultResult);
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/messagebox/IMessageBoxUIFacade.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/messagebox/IMessageBoxUIFacade.java
index 7a0e239474..ad2a647132 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/messagebox/IMessageBoxUIFacade.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/messagebox/IMessageBoxUIFacade.java
@@ -1,17 +1,17 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.messagebox;
-
-public interface IMessageBoxUIFacade {
-
- void setResultFromUI(int option);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.messagebox;
+
+public interface IMessageBoxUIFacade {
+
+ void setResultFromUI(int option);
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/messagebox/MessageBox.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/messagebox/MessageBox.java
index cd616457dc..894bfb1061 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/messagebox/MessageBox.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/messagebox/MessageBox.java
@@ -1,492 +1,492 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.messagebox;
-
-import java.beans.PropertyChangeListener;
-import java.lang.reflect.Array;
-import java.util.EventListener;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.scout.commons.EventListenerList;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.beans.AbstractPropertyObserver;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.BlockingCondition;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
-import org.eclipse.scout.rt.shared.OfficialVersion;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-
-public class MessageBox extends AbstractPropertyObserver implements IMessageBox {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(MessageBox.class);
-
- /**
- * Convenience function for simple info message box
- */
- public static int showOkMessage(String title, String header, String info) {
- MessageBox mbox = new MessageBox(
- title,
- header,
- info,
- ScoutTexts.get("OkButton"),
- null,
- null
- );
- return mbox.startMessageBox();
- }
-
- /**
- * Convenience function for simple yes/no message box
- */
- public static int showYesNoMessage(String title, String header, String info) {
- MessageBox mbox = new MessageBox(
- title,
- header,
- info,
- ScoutTexts.get("YesButton"),
- ScoutTexts.get("NoButton"),
- null
- );
- return mbox.startMessageBox();
- }
-
- /**
- * Convenience function for simple yes/no/cancel message box
- */
- public static int showYesNoCancelMessage(String title, String header, String info) {
- MessageBox mbox = new MessageBox(
- title,
- header,
- info,
- ScoutTexts.get("YesButton"),
- ScoutTexts.get("NoButton"),
- ScoutTexts.get("CancelButton")
- );
- return mbox.startMessageBox();
- }
-
- /**
- * Convenience function for simple delete confirmation message box
- *
- * @param items
- * one item or array of multiple items
- */
- public static boolean showDeleteConfirmationMessage(Object items) {
- return showDeleteConfirmationMessage(null, items);
- }
-
- /**
- * Convenience function for simple delete confirmation message box
- *
- * @param itemType
- * display text in plural such as "Persons", "Relations", "Tickets",
- * ...
- * @param items
- * one item or array of multiple items
- */
- public static boolean showDeleteConfirmationMessage(String itemType, Object items) {
- Object array;
- if (items == null) {
- array = new Object[0];
- }
- else if (items.getClass().isArray()) {
- array = items;
- }
- else {
- array = new Object[]{items};
- }
- StringBuilder t = new StringBuilder();
- int n = Array.getLength(array);
- for (int i = 0; i < n; i++) {
- if (i < 10 || i == n - 1) {
- t.append("- ");
- t.append(StringUtility.emptyIfNull(Array.get(array, i)));
- t.append("\n");
- }
- else if (i == 10) {
- t.append(" ...\n");
- }
- else {
- }
- }
- //
- String intro = null;
- String action = null;
- if (itemType != null) {
- intro = (n > 0 ? ScoutTexts.get("DeleteConfirmationTextX", itemType) : ScoutTexts.get("DeleteConfirmationTextNoItemListX", itemType));
- action = (n > 0 ? t.toString() : null);
- }
- else {
- intro = (n > 0 ? ScoutTexts.get("DeleteConfirmationText") : ScoutTexts.get("DeleteConfirmationTextNoItemList"));
- action = (n > 0 ? t.toString() : null);
- }
- MessageBox mbox = new MessageBox(
- ScoutTexts.get("DeleteConfirmationTitle"),
- intro,
- action,
- ScoutTexts.get("YesButton"),
- ScoutTexts.get("NoButton"),
- null
- );
- return mbox.startMessageBox() == IMessageBox.YES_OPTION;
- }
-
- /**
- * Instance
- */
- private final EventListenerList m_listenerList = new EventListenerList();
- private final IMessageBoxUIFacade m_uiFacade;
- private long m_autoCloseMillis;
- private String m_title;
- private String m_iconId;
- private String m_introText;
- private String m_actionText;
- private String m_yesButtonText;
- private String m_noButtonText;
- private String m_cancelButtonText;
- private String m_hiddenText;
- private String m_copyPasteText;
- // cached
- private String m_copyPasteTextInternal;
- // modality
- private final BlockingCondition m_blockingCondition = new BlockingCondition(false);
- private Job m_autoCloseJob;
- // result
- private int m_answer;
- private boolean m_answerSet;
- private int m_severity;
-
- public MessageBox(String title, String introText, String okButtonText) {
- this(title, introText, null, okButtonText, null, null);
- }
-
- public MessageBox(String title, String introText, String actionText, String yesButtonText, String noButtonText, String cancelButtonText) {
- this(title, introText, actionText, yesButtonText, noButtonText, cancelButtonText, null, null);
- }
-
- public MessageBox(String title, String introText, String actionText, String yesButtonText, String noButtonText, String cancelButtonText, String hiddenText, String iconId) {
- m_uiFacade = new P_UIFacade();
- m_title = title;
- m_introText = introText;
- m_actionText = actionText;
- m_hiddenText = hiddenText;
- m_yesButtonText = yesButtonText;
- m_noButtonText = noButtonText;
- m_cancelButtonText = cancelButtonText;
- m_iconId = iconId;
- m_autoCloseMillis = -1;
- //
- if (m_title == null) {
- IDesktop desktop = ClientSyncJob.getCurrentSession().getDesktop();
- if (desktop != null) {
- m_title = desktop.getTitle();
- }
- }
- }
-
- @Override
- public void addPropertyChangeListener(PropertyChangeListener listener) {
- propertySupport.addPropertyChangeListener(listener);
- }
-
- @Override
- public void removePropertyChangeListener(PropertyChangeListener listener) {
- propertySupport.removePropertyChangeListener(listener);
- }
-
- @Override
- public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
- propertySupport.addPropertyChangeListener(propertyName, listener);
- }
-
- @Override
- public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) {
- propertySupport.removePropertyChangeListener(propertyName, listener);
- }
-
- @Override
- public String getTitle() {
- return m_title;
- }
-
- @Override
- public void setTitle(String s) {
- m_title = s;
- m_copyPasteTextInternal = null;
- }
-
- @Override
- public String getIntroText() {
- return m_introText;
- }
-
- @Override
- public void setIntroText(String s) {
- m_introText = s;
- m_copyPasteTextInternal = null;
- }
-
- @Override
- public String getActionText() {
- return m_actionText;
- }
-
- @Override
- public void setActionText(String s) {
- m_actionText = s;
- m_copyPasteTextInternal = null;
- }
-
- @Override
- public String getHiddenText() {
- return m_hiddenText;
- }
-
- @Override
- public void setHiddenText(String s) {
- m_hiddenText = s;
- m_copyPasteTextInternal = null;
- }
-
- @Override
- public String getYesButtonText() {
- return m_yesButtonText;
- }
-
- @Override
- public void setYesButtonText(String s) {
- m_yesButtonText = s;
- }
-
- @Override
- public String getNoButtonText() {
- return m_noButtonText;
- }
-
- @Override
- public void setNoButtonText(String s) {
- m_noButtonText = s;
- }
-
- @Override
- public String getCancelButtonText() {
- return m_cancelButtonText;
- }
-
- @Override
- public void setCancelButtonText(String s) {
- m_cancelButtonText = s;
- }
-
- @Override
- public String getIconId() {
- return m_iconId;
- }
-
- @Override
- public void setIconId(String iconId) {
- m_iconId = iconId;
- }
-
- @Override
- public int getSeverity() {
- return m_severity;
- }
-
- @Override
- public void setSeverity(int severity) {
- m_severity = severity;
- }
-
- @Override
- public long getAutoCloseMillis() {
- return m_autoCloseMillis;
- }
-
- @Override
- public void setAutoCloseMillis(long millis) {
- m_autoCloseMillis = millis;
- }
-
- @Override
- public String getCopyPasteText() {
- if (m_copyPasteText == null) {
- updateCopyPasteTextInternal();
- return m_copyPasteTextInternal;
- }
- else {
- return m_copyPasteText;
- }
- }
-
- @Override
- public void setCopyPasteText(String s) {
- m_copyPasteText = s;
- }
-
- private void updateCopyPasteTextInternal() {
- if (m_copyPasteTextInternal == null) {
- StringBuffer buf = new StringBuffer();
- if (OfficialVersion.customCopyrightText != null) {
- buf.append(OfficialVersion.customCopyrightText + "\n");
- }
- else {
- buf.append(OfficialVersion.COPYRIGHT + "\n");
- }
- buf.append("java.vm.version: " + System.getProperty("java.vm.version") + "\n");
- buf.append("os.name_version: " + System.getProperty("os.name") + " " + System.getProperty("os.version") + "\n");
- buf.append("user.name: " + System.getProperty("user.name") + "\n");
- buf.append("\n");
- if (m_title != null) {
- buf.append(m_title + "\n\n");
- }
- if (m_introText != null) {
- buf.append(m_introText + "\n\n");
- }
- if (m_actionText != null) {
- buf.append(m_actionText + "\n\n");
- }
- if (m_hiddenText != null) {
- buf.append(m_hiddenText + "\n\n");
- }
- m_copyPasteTextInternal = buf.toString();
- }
- }
-
- /*
- * Model observer
- */
- @Override
- public void addMessageBoxListener(MessageBoxListener listener) {
- m_listenerList.add(MessageBoxListener.class, listener);
- }
-
- @Override
- public void removeMessageBoxListener(MessageBoxListener listener) {
- m_listenerList.remove(MessageBoxListener.class, listener);
- }
-
- private void fireClosed() {
- fireMessageBoxEvent(new MessageBoxEvent(this, MessageBoxEvent.TYPE_CLOSED));
- }
-
- private void fireMessageBoxEvent(MessageBoxEvent e) {
- EventListener[] listeners = m_listenerList.getListeners(MessageBoxListener.class);
- if (listeners != null && listeners.length > 0) {
- for (int i = 0; i < listeners.length; i++) {
- ((MessageBoxListener) listeners[i]).messageBoxChanged(e);
- }
- }
- }
-
- @Override
- public IMessageBoxUIFacade getUIFacade() {
- return m_uiFacade;
- }
-
- @Override
- public boolean isOpen() {
- return m_blockingCondition.isBlocking();
- }
-
- @Override
- public int startMessageBox() {
- return startMessageBox(CANCEL_OPTION);
- }
-
- @Override
- public int startMessageBox(int defaultResult) {
- m_answerSet = false;
- m_answer = defaultResult;
- if (ClientSyncJob.getCurrentSession() != null) {
- m_blockingCondition.setBlocking(true);
- try {
- // check if the desktop is observing this process
- IDesktop desktop = ClientSyncJob.getCurrentSession().getDesktop();
- if (desktop == null || !desktop.isOpened()) {
- LOG.warn("there is no desktop or the desktop has not yet been opened in the ui, default answer is CANCEL");
- m_answerSet = true;
- m_answer = CANCEL_OPTION;
- }
- else {
- // request a gui
- desktop.addMessageBox(this);
- // attach auto-cancel timer
- if (getAutoCloseMillis() > 0) {
- final long dt = getAutoCloseMillis();
- m_autoCloseJob = new Job("Auto-close " + getTitle()) {
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- if (this == m_autoCloseJob) {
- closeMessageBox();
- }
- return Status.OK_STATUS;
- }
- };
- m_autoCloseJob.schedule(dt);
- }
- // start sub event dispatch thread
- waitFor();
- if (m_autoCloseJob != null) {
- m_autoCloseJob.cancel();
- m_autoCloseJob = null;
- }
- }
- }
- finally {// end request gui
- fireClosed();
- }
- }
- else {
- LOG.warn("outside ScoutSessionThread, default answer is CANCEL");
- m_answerSet = true;
- m_answer = CANCEL_OPTION;
- }
- return m_answer;
- }
-
- private void waitFor() {
- try {
- m_blockingCondition.waitFor();
- }
- catch (InterruptedException e) {
- LOG.info(ScoutTexts.get("UserInterrupted"));
- }
- }
-
- private void closeMessageBox() {
- m_autoCloseJob = null;
- m_blockingCondition.setBlocking(false);
- }
-
- private class P_UIFacade implements IMessageBoxUIFacade {
-
- @Override
- public void setResultFromUI(int option) {
- switch (option) {
- case YES_OPTION:
- case NO_OPTION:
- case CANCEL_OPTION: {
- if (!m_answerSet) {
- m_answerSet = true;
- m_answer = option;
- }
- closeMessageBox();
- break;
- }
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.messagebox;
+
+import java.beans.PropertyChangeListener;
+import java.lang.reflect.Array;
+import java.util.EventListener;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.scout.commons.EventListenerList;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.beans.AbstractPropertyObserver;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.BlockingCondition;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
+import org.eclipse.scout.rt.shared.OfficialVersion;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+
+public class MessageBox extends AbstractPropertyObserver implements IMessageBox {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(MessageBox.class);
+
+ /**
+ * Convenience function for simple info message box
+ */
+ public static int showOkMessage(String title, String header, String info) {
+ MessageBox mbox = new MessageBox(
+ title,
+ header,
+ info,
+ ScoutTexts.get("OkButton"),
+ null,
+ null
+ );
+ return mbox.startMessageBox();
+ }
+
+ /**
+ * Convenience function for simple yes/no message box
+ */
+ public static int showYesNoMessage(String title, String header, String info) {
+ MessageBox mbox = new MessageBox(
+ title,
+ header,
+ info,
+ ScoutTexts.get("YesButton"),
+ ScoutTexts.get("NoButton"),
+ null
+ );
+ return mbox.startMessageBox();
+ }
+
+ /**
+ * Convenience function for simple yes/no/cancel message box
+ */
+ public static int showYesNoCancelMessage(String title, String header, String info) {
+ MessageBox mbox = new MessageBox(
+ title,
+ header,
+ info,
+ ScoutTexts.get("YesButton"),
+ ScoutTexts.get("NoButton"),
+ ScoutTexts.get("CancelButton")
+ );
+ return mbox.startMessageBox();
+ }
+
+ /**
+ * Convenience function for simple delete confirmation message box
+ *
+ * @param items
+ * one item or array of multiple items
+ */
+ public static boolean showDeleteConfirmationMessage(Object items) {
+ return showDeleteConfirmationMessage(null, items);
+ }
+
+ /**
+ * Convenience function for simple delete confirmation message box
+ *
+ * @param itemType
+ * display text in plural such as "Persons", "Relations", "Tickets",
+ * ...
+ * @param items
+ * one item or array of multiple items
+ */
+ public static boolean showDeleteConfirmationMessage(String itemType, Object items) {
+ Object array;
+ if (items == null) {
+ array = new Object[0];
+ }
+ else if (items.getClass().isArray()) {
+ array = items;
+ }
+ else {
+ array = new Object[]{items};
+ }
+ StringBuilder t = new StringBuilder();
+ int n = Array.getLength(array);
+ for (int i = 0; i < n; i++) {
+ if (i < 10 || i == n - 1) {
+ t.append("- ");
+ t.append(StringUtility.emptyIfNull(Array.get(array, i)));
+ t.append("\n");
+ }
+ else if (i == 10) {
+ t.append(" ...\n");
+ }
+ else {
+ }
+ }
+ //
+ String intro = null;
+ String action = null;
+ if (itemType != null) {
+ intro = (n > 0 ? ScoutTexts.get("DeleteConfirmationTextX", itemType) : ScoutTexts.get("DeleteConfirmationTextNoItemListX", itemType));
+ action = (n > 0 ? t.toString() : null);
+ }
+ else {
+ intro = (n > 0 ? ScoutTexts.get("DeleteConfirmationText") : ScoutTexts.get("DeleteConfirmationTextNoItemList"));
+ action = (n > 0 ? t.toString() : null);
+ }
+ MessageBox mbox = new MessageBox(
+ ScoutTexts.get("DeleteConfirmationTitle"),
+ intro,
+ action,
+ ScoutTexts.get("YesButton"),
+ ScoutTexts.get("NoButton"),
+ null
+ );
+ return mbox.startMessageBox() == IMessageBox.YES_OPTION;
+ }
+
+ /**
+ * Instance
+ */
+ private final EventListenerList m_listenerList = new EventListenerList();
+ private final IMessageBoxUIFacade m_uiFacade;
+ private long m_autoCloseMillis;
+ private String m_title;
+ private String m_iconId;
+ private String m_introText;
+ private String m_actionText;
+ private String m_yesButtonText;
+ private String m_noButtonText;
+ private String m_cancelButtonText;
+ private String m_hiddenText;
+ private String m_copyPasteText;
+ // cached
+ private String m_copyPasteTextInternal;
+ // modality
+ private final BlockingCondition m_blockingCondition = new BlockingCondition(false);
+ private Job m_autoCloseJob;
+ // result
+ private int m_answer;
+ private boolean m_answerSet;
+ private int m_severity;
+
+ public MessageBox(String title, String introText, String okButtonText) {
+ this(title, introText, null, okButtonText, null, null);
+ }
+
+ public MessageBox(String title, String introText, String actionText, String yesButtonText, String noButtonText, String cancelButtonText) {
+ this(title, introText, actionText, yesButtonText, noButtonText, cancelButtonText, null, null);
+ }
+
+ public MessageBox(String title, String introText, String actionText, String yesButtonText, String noButtonText, String cancelButtonText, String hiddenText, String iconId) {
+ m_uiFacade = new P_UIFacade();
+ m_title = title;
+ m_introText = introText;
+ m_actionText = actionText;
+ m_hiddenText = hiddenText;
+ m_yesButtonText = yesButtonText;
+ m_noButtonText = noButtonText;
+ m_cancelButtonText = cancelButtonText;
+ m_iconId = iconId;
+ m_autoCloseMillis = -1;
+ //
+ if (m_title == null) {
+ IDesktop desktop = ClientSyncJob.getCurrentSession().getDesktop();
+ if (desktop != null) {
+ m_title = desktop.getTitle();
+ }
+ }
+ }
+
+ @Override
+ public void addPropertyChangeListener(PropertyChangeListener listener) {
+ propertySupport.addPropertyChangeListener(listener);
+ }
+
+ @Override
+ public void removePropertyChangeListener(PropertyChangeListener listener) {
+ propertySupport.removePropertyChangeListener(listener);
+ }
+
+ @Override
+ public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
+ propertySupport.addPropertyChangeListener(propertyName, listener);
+ }
+
+ @Override
+ public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) {
+ propertySupport.removePropertyChangeListener(propertyName, listener);
+ }
+
+ @Override
+ public String getTitle() {
+ return m_title;
+ }
+
+ @Override
+ public void setTitle(String s) {
+ m_title = s;
+ m_copyPasteTextInternal = null;
+ }
+
+ @Override
+ public String getIntroText() {
+ return m_introText;
+ }
+
+ @Override
+ public void setIntroText(String s) {
+ m_introText = s;
+ m_copyPasteTextInternal = null;
+ }
+
+ @Override
+ public String getActionText() {
+ return m_actionText;
+ }
+
+ @Override
+ public void setActionText(String s) {
+ m_actionText = s;
+ m_copyPasteTextInternal = null;
+ }
+
+ @Override
+ public String getHiddenText() {
+ return m_hiddenText;
+ }
+
+ @Override
+ public void setHiddenText(String s) {
+ m_hiddenText = s;
+ m_copyPasteTextInternal = null;
+ }
+
+ @Override
+ public String getYesButtonText() {
+ return m_yesButtonText;
+ }
+
+ @Override
+ public void setYesButtonText(String s) {
+ m_yesButtonText = s;
+ }
+
+ @Override
+ public String getNoButtonText() {
+ return m_noButtonText;
+ }
+
+ @Override
+ public void setNoButtonText(String s) {
+ m_noButtonText = s;
+ }
+
+ @Override
+ public String getCancelButtonText() {
+ return m_cancelButtonText;
+ }
+
+ @Override
+ public void setCancelButtonText(String s) {
+ m_cancelButtonText = s;
+ }
+
+ @Override
+ public String getIconId() {
+ return m_iconId;
+ }
+
+ @Override
+ public void setIconId(String iconId) {
+ m_iconId = iconId;
+ }
+
+ @Override
+ public int getSeverity() {
+ return m_severity;
+ }
+
+ @Override
+ public void setSeverity(int severity) {
+ m_severity = severity;
+ }
+
+ @Override
+ public long getAutoCloseMillis() {
+ return m_autoCloseMillis;
+ }
+
+ @Override
+ public void setAutoCloseMillis(long millis) {
+ m_autoCloseMillis = millis;
+ }
+
+ @Override
+ public String getCopyPasteText() {
+ if (m_copyPasteText == null) {
+ updateCopyPasteTextInternal();
+ return m_copyPasteTextInternal;
+ }
+ else {
+ return m_copyPasteText;
+ }
+ }
+
+ @Override
+ public void setCopyPasteText(String s) {
+ m_copyPasteText = s;
+ }
+
+ private void updateCopyPasteTextInternal() {
+ if (m_copyPasteTextInternal == null) {
+ StringBuffer buf = new StringBuffer();
+ if (OfficialVersion.customCopyrightText != null) {
+ buf.append(OfficialVersion.customCopyrightText + "\n");
+ }
+ else {
+ buf.append(OfficialVersion.COPYRIGHT + "\n");
+ }
+ buf.append("java.vm.version: " + System.getProperty("java.vm.version") + "\n");
+ buf.append("os.name_version: " + System.getProperty("os.name") + " " + System.getProperty("os.version") + "\n");
+ buf.append("user.name: " + System.getProperty("user.name") + "\n");
+ buf.append("\n");
+ if (m_title != null) {
+ buf.append(m_title + "\n\n");
+ }
+ if (m_introText != null) {
+ buf.append(m_introText + "\n\n");
+ }
+ if (m_actionText != null) {
+ buf.append(m_actionText + "\n\n");
+ }
+ if (m_hiddenText != null) {
+ buf.append(m_hiddenText + "\n\n");
+ }
+ m_copyPasteTextInternal = buf.toString();
+ }
+ }
+
+ /*
+ * Model observer
+ */
+ @Override
+ public void addMessageBoxListener(MessageBoxListener listener) {
+ m_listenerList.add(MessageBoxListener.class, listener);
+ }
+
+ @Override
+ public void removeMessageBoxListener(MessageBoxListener listener) {
+ m_listenerList.remove(MessageBoxListener.class, listener);
+ }
+
+ private void fireClosed() {
+ fireMessageBoxEvent(new MessageBoxEvent(this, MessageBoxEvent.TYPE_CLOSED));
+ }
+
+ private void fireMessageBoxEvent(MessageBoxEvent e) {
+ EventListener[] listeners = m_listenerList.getListeners(MessageBoxListener.class);
+ if (listeners != null && listeners.length > 0) {
+ for (int i = 0; i < listeners.length; i++) {
+ ((MessageBoxListener) listeners[i]).messageBoxChanged(e);
+ }
+ }
+ }
+
+ @Override
+ public IMessageBoxUIFacade getUIFacade() {
+ return m_uiFacade;
+ }
+
+ @Override
+ public boolean isOpen() {
+ return m_blockingCondition.isBlocking();
+ }
+
+ @Override
+ public int startMessageBox() {
+ return startMessageBox(CANCEL_OPTION);
+ }
+
+ @Override
+ public int startMessageBox(int defaultResult) {
+ m_answerSet = false;
+ m_answer = defaultResult;
+ if (ClientSyncJob.getCurrentSession() != null) {
+ m_blockingCondition.setBlocking(true);
+ try {
+ // check if the desktop is observing this process
+ IDesktop desktop = ClientSyncJob.getCurrentSession().getDesktop();
+ if (desktop == null || !desktop.isOpened()) {
+ LOG.warn("there is no desktop or the desktop has not yet been opened in the ui, default answer is CANCEL");
+ m_answerSet = true;
+ m_answer = CANCEL_OPTION;
+ }
+ else {
+ // request a gui
+ desktop.addMessageBox(this);
+ // attach auto-cancel timer
+ if (getAutoCloseMillis() > 0) {
+ final long dt = getAutoCloseMillis();
+ m_autoCloseJob = new Job("Auto-close " + getTitle()) {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ if (this == m_autoCloseJob) {
+ closeMessageBox();
+ }
+ return Status.OK_STATUS;
+ }
+ };
+ m_autoCloseJob.schedule(dt);
+ }
+ // start sub event dispatch thread
+ waitFor();
+ if (m_autoCloseJob != null) {
+ m_autoCloseJob.cancel();
+ m_autoCloseJob = null;
+ }
+ }
+ }
+ finally {// end request gui
+ fireClosed();
+ }
+ }
+ else {
+ LOG.warn("outside ScoutSessionThread, default answer is CANCEL");
+ m_answerSet = true;
+ m_answer = CANCEL_OPTION;
+ }
+ return m_answer;
+ }
+
+ private void waitFor() {
+ try {
+ m_blockingCondition.waitFor();
+ }
+ catch (InterruptedException e) {
+ LOG.info(ScoutTexts.get("UserInterrupted"));
+ }
+ }
+
+ private void closeMessageBox() {
+ m_autoCloseJob = null;
+ m_blockingCondition.setBlocking(false);
+ }
+
+ private class P_UIFacade implements IMessageBoxUIFacade {
+
+ @Override
+ public void setResultFromUI(int option) {
+ switch (option) {
+ case YES_OPTION:
+ case NO_OPTION:
+ case CANCEL_OPTION: {
+ if (!m_answerSet) {
+ m_answerSet = true;
+ m_answer = option;
+ }
+ closeMessageBox();
+ break;
+ }
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/messagebox/MessageBoxEvent.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/messagebox/MessageBoxEvent.java
index d96ded6f3d..d41ffac2e9 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/messagebox/MessageBoxEvent.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/messagebox/MessageBoxEvent.java
@@ -1,64 +1,64 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.messagebox;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-import java.util.EventObject;
-
-public class MessageBoxEvent extends EventObject {
- private static final long serialVersionUID = 1L;
- // state
- public static final int TYPE_CLOSED = 900;
-
- private int m_type;
-
- public MessageBoxEvent(IMessageBox mb, int type) {
- super(mb);
- m_type = type;
- }
-
- public IMessageBox getMessageBox() {
- return (IMessageBox) getSource();
- }
-
- public int getType() {
- return m_type;
- }
-
- @Override
- public String toString() {
- StringBuffer buf = new StringBuffer();
- buf.append("MessageBoxEvent[");
- // decode type
- try {
- Field[] f = getClass().getDeclaredFields();
- for (int i = 0; i < f.length; i++) {
- if (Modifier.isPublic(f[i].getModifiers()) && Modifier.isStatic(f[i].getModifiers()) && f[i].getName().startsWith("TYPE_")) {
- if (((Number) f[i].get(null)).intValue() == m_type) {
- buf.append(f[i].getName());
- break;
- }
- }
- }
- }
- catch (Throwable t) {
- buf.append("#" + m_type);
- }
- // messageBox
- if (getMessageBox() != null) {
- buf.append(" " + getMessageBox().getTitle());
- }
- buf.append("]");
- return buf.toString();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.messagebox;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.util.EventObject;
+
+public class MessageBoxEvent extends EventObject {
+ private static final long serialVersionUID = 1L;
+ // state
+ public static final int TYPE_CLOSED = 900;
+
+ private int m_type;
+
+ public MessageBoxEvent(IMessageBox mb, int type) {
+ super(mb);
+ m_type = type;
+ }
+
+ public IMessageBox getMessageBox() {
+ return (IMessageBox) getSource();
+ }
+
+ public int getType() {
+ return m_type;
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer buf = new StringBuffer();
+ buf.append("MessageBoxEvent[");
+ // decode type
+ try {
+ Field[] f = getClass().getDeclaredFields();
+ for (int i = 0; i < f.length; i++) {
+ if (Modifier.isPublic(f[i].getModifiers()) && Modifier.isStatic(f[i].getModifiers()) && f[i].getName().startsWith("TYPE_")) {
+ if (((Number) f[i].get(null)).intValue() == m_type) {
+ buf.append(f[i].getName());
+ break;
+ }
+ }
+ }
+ }
+ catch (Throwable t) {
+ buf.append("#" + m_type);
+ }
+ // messageBox
+ if (getMessageBox() != null) {
+ buf.append(" " + getMessageBox().getTitle());
+ }
+ buf.append("]");
+ return buf.toString();
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/messagebox/MessageBoxListener.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/messagebox/MessageBoxListener.java
index bd9c3f4451..e4e487394c 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/messagebox/MessageBoxListener.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/messagebox/MessageBoxListener.java
@@ -1,17 +1,17 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.messagebox;
-
-import java.util.EventListener;
-
-public interface MessageBoxListener extends EventListener {
- void messageBoxChanged(MessageBoxEvent e);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.messagebox;
+
+import java.util.EventListener;
+
+public interface MessageBoxListener extends EventListener {
+ void messageBoxChanged(MessageBoxEvent e);
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/profiler/DesktopProfiler.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/profiler/DesktopProfiler.java
index 561cb86eb3..26259612c7 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/profiler/DesktopProfiler.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/profiler/DesktopProfiler.java
@@ -1,245 +1,245 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.profiler;
-
-import java.io.OutputStream;
-import java.io.PrintWriter;
-import java.lang.ref.WeakReference;
-import java.text.NumberFormat;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.TreeMap;
-
-import org.eclipse.scout.commons.LocaleThreadLocal;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITree;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-
-/**
- * This class is Thread safe
- */
-public final class DesktopProfiler {
- private static DesktopProfiler instance = new DesktopProfiler();
-
- public static DesktopProfiler getInstance() {
- return instance;
- }
-
- private boolean m_enabled = false;
- private Object m_listLock = new Object();
- private final List<WeakReference<ITree>> m_trees;
- private final List<WeakReference<ITable>> m_tables;
- private final List<WeakReference<ITreeNode>> m_treeNodes;
- private final List<WeakReference<ITableRow>> m_tableRows;
- private final List<WeakReference<IForm>> m_forms;
- private final List<WeakReference<IFormField>> m_formFields;
- private final List<WeakReference<Object>> m_objects;
-
- private DesktopProfiler() {
- m_listLock = new Object();
- m_trees = new ArrayList<WeakReference<ITree>>();
- m_treeNodes = new ArrayList<WeakReference<ITreeNode>>();
- m_tables = new ArrayList<WeakReference<ITable>>();
- m_tableRows = new ArrayList<WeakReference<ITableRow>>();
- m_forms = new ArrayList<WeakReference<IForm>>();
- m_formFields = new ArrayList<WeakReference<IFormField>>();
- m_objects = new ArrayList<WeakReference<Object>>();
- }
-
- public boolean isEnabled() {
- return m_enabled;
- }
-
- public void setEnabled(boolean enabled) {
- m_enabled = enabled;
- }
-
- /**
- * Add a weak reference to a tree NOTE: the passed argument MUST be referenced
- * by the source type, otherwise it is garbage collected immediately after
- * adding
- */
- public void registerTree(ITree tree) {
- if (!m_enabled) {
- return;
- }
- synchronized (m_listLock) {
- m_trees.add(new WeakReference<ITree>(tree));
- }
- }
-
- /**
- * Add a weak reference to a tree node NOTE: the passed argument MUST be
- * referenced by the source type, otherwise it is garbage collected
- * immediately after adding
- */
- public void registerTreeNode(ITreeNode node) {
- if (!m_enabled) {
- return;
- }
- synchronized (m_listLock) {
- m_treeNodes.add(new WeakReference<ITreeNode>(node));
- }
- }
-
- /**
- * Add a weak reference to a table NOTE: the passed argument MUST be
- * referenced by the source type, otherwise it is garbage collected
- * immediately after adding
- */
- public void registerTable(ITable table) {
- if (!m_enabled) {
- return;
- }
- synchronized (m_listLock) {
- m_tables.add(new WeakReference<ITable>(table));
- }
- }
-
- /**
- * Add a weak reference to a table row NOTE: the passed argument MUST be
- * referenced by the source type, otherwise it is garbage collected
- * immediately after adding
- */
- public void registerTableRow(ITableRow row) {
- if (!m_enabled) {
- return;
- }
- synchronized (m_listLock) {
- m_tableRows.add(new WeakReference<ITableRow>(row));
- }
- }
-
- /**
- * Add a weak reference to a form NOTE: the passed argument MUST be referenced
- * by the source type, otherwise it is garbage collected immediately after
- * adding
- */
- public void registerForm(IForm form) {
- if (!m_enabled) {
- return;
- }
- synchronized (m_listLock) {
- m_forms.add(new WeakReference<IForm>(form));
- }
- }
-
- /**
- * Add a weak reference to a form field NOTE: the passed argument MUST be
- * referenced by the source type, otherwise it is garbage collected
- * immediately after adding
- */
- public void registerFormField(IFormField formField) {
- if (!m_enabled) {
- return;
- }
- synchronized (m_listLock) {
- m_formFields.add(new WeakReference<IFormField>(formField));
- }
- }
-
- /**
- * Add a weak reference to an arbitrary object NOTE: the passed argument MUST
- * be referenced by the source type, otherwise it is garbage collected
- * immediately after adding
- */
- public void registerObject(Object o) {
- if (!m_enabled) {
- return;
- }
- synchronized (m_listLock) {
- m_objects.add(new WeakReference<Object>(o));
- }
- }
-
- public void dump() {
- dump(System.out);
- }
-
- public void dump(OutputStream o) {
- /**
- * this call to gc is intended
- */
- System.gc();
- if (!m_enabled) {
- return;
- }
- PrintWriter out = new PrintWriter(o, true);
- try {
- synchronized (m_listLock) {
- manageListsWithoutLocking();
- //
- NumberFormat fmt = NumberFormat.getIntegerInstance(LocaleThreadLocal.get());
- out.println("Max memory: " + fmt.format(Runtime.getRuntime().maxMemory()));
- out.println("Total memory: " + fmt.format(Runtime.getRuntime().totalMemory()));
- out.println("Free memory: " + fmt.format(Runtime.getRuntime().freeMemory()));
- out.println("(Used memory):" + fmt.format(Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()));
- out.println();
- dumpWeakList(out, "TREE", m_trees);
- dumpWeakList(out, "TREE NODE", m_trees);
- dumpWeakList(out, "TABLE", m_tables);
- dumpWeakList(out, "TABLE ROW", m_tableRows);
- dumpWeakList(out, "FORM", m_forms);
- dumpWeakList(out, "FORM FIELD", m_formFields);
- dumpWeakList(out, "VARIOUS", m_objects);
- }
- }
- catch (Throwable t) {
- t.printStackTrace();
- }
- finally {
- if (o != System.out) {
- out.close();
- }
- }
- }
-
- private <T> void dumpWeakList(PrintWriter out, String title, List<WeakReference<T>> weakList) {
- HashMap<Class, Integer> typesMap = new HashMap<Class, Integer>();
- for (WeakReference<T> ref : weakList) {
- T o = ref.get();
- if (o != null) {
- Integer n = typesMap.get(o.getClass());
- typesMap.put(o.getClass(), n != null ? n + 1 : 1);
- }
- }
- TreeMap<String, Integer> sortMap = new TreeMap<String, Integer>();
- for (Map.Entry<Class, Integer> entry : typesMap.entrySet()) {
- sortMap.put(entry.getKey().getName(), entry.getValue());
- }
- out.println(title);
- for (Map.Entry<String, Integer> entry : sortMap.entrySet()) {
- out.println(" " + entry.getKey() + " " + entry.getValue());
- }
- }
-
- private void manageListsWithoutLocking() {
- for (Iterator<WeakReference<ITreeNode>> it = m_treeNodes.iterator(); it.hasNext();) {
- WeakReference<ITreeNode> ref = it.next();
- if (ref.get() == null) {
- it.remove();
- }
- }
- for (Iterator<WeakReference<ITableRow>> it = m_tableRows.iterator(); it.hasNext();) {
- WeakReference<ITableRow> ref = it.next();
- if (ref.get() == null) {
- it.remove();
- }
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.profiler;
+
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.lang.ref.WeakReference;
+import java.text.NumberFormat;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.eclipse.scout.commons.LocaleThreadLocal;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITree;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+
+/**
+ * This class is Thread safe
+ */
+public final class DesktopProfiler {
+ private static DesktopProfiler instance = new DesktopProfiler();
+
+ public static DesktopProfiler getInstance() {
+ return instance;
+ }
+
+ private boolean m_enabled = false;
+ private Object m_listLock = new Object();
+ private final List<WeakReference<ITree>> m_trees;
+ private final List<WeakReference<ITable>> m_tables;
+ private final List<WeakReference<ITreeNode>> m_treeNodes;
+ private final List<WeakReference<ITableRow>> m_tableRows;
+ private final List<WeakReference<IForm>> m_forms;
+ private final List<WeakReference<IFormField>> m_formFields;
+ private final List<WeakReference<Object>> m_objects;
+
+ private DesktopProfiler() {
+ m_listLock = new Object();
+ m_trees = new ArrayList<WeakReference<ITree>>();
+ m_treeNodes = new ArrayList<WeakReference<ITreeNode>>();
+ m_tables = new ArrayList<WeakReference<ITable>>();
+ m_tableRows = new ArrayList<WeakReference<ITableRow>>();
+ m_forms = new ArrayList<WeakReference<IForm>>();
+ m_formFields = new ArrayList<WeakReference<IFormField>>();
+ m_objects = new ArrayList<WeakReference<Object>>();
+ }
+
+ public boolean isEnabled() {
+ return m_enabled;
+ }
+
+ public void setEnabled(boolean enabled) {
+ m_enabled = enabled;
+ }
+
+ /**
+ * Add a weak reference to a tree NOTE: the passed argument MUST be referenced
+ * by the source type, otherwise it is garbage collected immediately after
+ * adding
+ */
+ public void registerTree(ITree tree) {
+ if (!m_enabled) {
+ return;
+ }
+ synchronized (m_listLock) {
+ m_trees.add(new WeakReference<ITree>(tree));
+ }
+ }
+
+ /**
+ * Add a weak reference to a tree node NOTE: the passed argument MUST be
+ * referenced by the source type, otherwise it is garbage collected
+ * immediately after adding
+ */
+ public void registerTreeNode(ITreeNode node) {
+ if (!m_enabled) {
+ return;
+ }
+ synchronized (m_listLock) {
+ m_treeNodes.add(new WeakReference<ITreeNode>(node));
+ }
+ }
+
+ /**
+ * Add a weak reference to a table NOTE: the passed argument MUST be
+ * referenced by the source type, otherwise it is garbage collected
+ * immediately after adding
+ */
+ public void registerTable(ITable table) {
+ if (!m_enabled) {
+ return;
+ }
+ synchronized (m_listLock) {
+ m_tables.add(new WeakReference<ITable>(table));
+ }
+ }
+
+ /**
+ * Add a weak reference to a table row NOTE: the passed argument MUST be
+ * referenced by the source type, otherwise it is garbage collected
+ * immediately after adding
+ */
+ public void registerTableRow(ITableRow row) {
+ if (!m_enabled) {
+ return;
+ }
+ synchronized (m_listLock) {
+ m_tableRows.add(new WeakReference<ITableRow>(row));
+ }
+ }
+
+ /**
+ * Add a weak reference to a form NOTE: the passed argument MUST be referenced
+ * by the source type, otherwise it is garbage collected immediately after
+ * adding
+ */
+ public void registerForm(IForm form) {
+ if (!m_enabled) {
+ return;
+ }
+ synchronized (m_listLock) {
+ m_forms.add(new WeakReference<IForm>(form));
+ }
+ }
+
+ /**
+ * Add a weak reference to a form field NOTE: the passed argument MUST be
+ * referenced by the source type, otherwise it is garbage collected
+ * immediately after adding
+ */
+ public void registerFormField(IFormField formField) {
+ if (!m_enabled) {
+ return;
+ }
+ synchronized (m_listLock) {
+ m_formFields.add(new WeakReference<IFormField>(formField));
+ }
+ }
+
+ /**
+ * Add a weak reference to an arbitrary object NOTE: the passed argument MUST
+ * be referenced by the source type, otherwise it is garbage collected
+ * immediately after adding
+ */
+ public void registerObject(Object o) {
+ if (!m_enabled) {
+ return;
+ }
+ synchronized (m_listLock) {
+ m_objects.add(new WeakReference<Object>(o));
+ }
+ }
+
+ public void dump() {
+ dump(System.out);
+ }
+
+ public void dump(OutputStream o) {
+ /**
+ * this call to gc is intended
+ */
+ System.gc();
+ if (!m_enabled) {
+ return;
+ }
+ PrintWriter out = new PrintWriter(o, true);
+ try {
+ synchronized (m_listLock) {
+ manageListsWithoutLocking();
+ //
+ NumberFormat fmt = NumberFormat.getIntegerInstance(LocaleThreadLocal.get());
+ out.println("Max memory: " + fmt.format(Runtime.getRuntime().maxMemory()));
+ out.println("Total memory: " + fmt.format(Runtime.getRuntime().totalMemory()));
+ out.println("Free memory: " + fmt.format(Runtime.getRuntime().freeMemory()));
+ out.println("(Used memory):" + fmt.format(Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()));
+ out.println();
+ dumpWeakList(out, "TREE", m_trees);
+ dumpWeakList(out, "TREE NODE", m_trees);
+ dumpWeakList(out, "TABLE", m_tables);
+ dumpWeakList(out, "TABLE ROW", m_tableRows);
+ dumpWeakList(out, "FORM", m_forms);
+ dumpWeakList(out, "FORM FIELD", m_formFields);
+ dumpWeakList(out, "VARIOUS", m_objects);
+ }
+ }
+ catch (Throwable t) {
+ t.printStackTrace();
+ }
+ finally {
+ if (o != System.out) {
+ out.close();
+ }
+ }
+ }
+
+ private <T> void dumpWeakList(PrintWriter out, String title, List<WeakReference<T>> weakList) {
+ HashMap<Class, Integer> typesMap = new HashMap<Class, Integer>();
+ for (WeakReference<T> ref : weakList) {
+ T o = ref.get();
+ if (o != null) {
+ Integer n = typesMap.get(o.getClass());
+ typesMap.put(o.getClass(), n != null ? n + 1 : 1);
+ }
+ }
+ TreeMap<String, Integer> sortMap = new TreeMap<String, Integer>();
+ for (Map.Entry<Class, Integer> entry : typesMap.entrySet()) {
+ sortMap.put(entry.getKey().getName(), entry.getValue());
+ }
+ out.println(title);
+ for (Map.Entry<String, Integer> entry : sortMap.entrySet()) {
+ out.println(" " + entry.getKey() + " " + entry.getValue());
+ }
+ }
+
+ private void manageListsWithoutLocking() {
+ for (Iterator<WeakReference<ITreeNode>> it = m_treeNodes.iterator(); it.hasNext();) {
+ WeakReference<ITreeNode> ref = it.next();
+ if (ref.get() == null) {
+ it.remove();
+ }
+ }
+ for (Iterator<WeakReference<ITableRow>> it = m_tableRows.iterator(); it.hasNext();) {
+ WeakReference<ITableRow> ref = it.next();
+ if (ref.get() == null) {
+ it.remove();
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/AbstractWizard.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/AbstractWizard.java
index af8ef1b5f8..dea6067ad2 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/AbstractWizard.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/AbstractWizard.java
@@ -1,1205 +1,1205 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.wizard;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.scout.commons.ConfigurationUtility;
-import org.eclipse.scout.commons.EventListenerList;
-import org.eclipse.scout.commons.OptimisticLock;
-import org.eclipse.scout.commons.annotations.ConfigOperation;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.beans.AbstractPropertyObserver;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.BlockingCondition;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
-import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
-import org.eclipse.scout.service.SERVICES;
-
-public abstract class AbstractWizard extends AbstractPropertyObserver implements IWizard {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractWizard.class);
-
- private boolean m_initialized;
- private final EventListenerList m_listenerList;
- private ArrayList<IWizardStep<? extends IForm>> m_availableStepList;
- private ArrayList<IWizardStep<? extends IForm>> m_stepList;
- private IWizardStep<? extends IForm> m_activeStep;
- // event accumulation (coalescation)
- private final OptimisticLock m_changingLock;
- private ArrayList<WizardEvent> m_accumulatedEvents;
- //
- private boolean m_displayHintLocked;
- private boolean m_modal;
- private String m_displayViewId;
- private int m_displayHint;
- private final BlockingCondition m_blockingCondition;
-
- private IWizardContainerForm m_containerForm;
- private PropertyChangeListener m_anyFieldChangeListener;
-
- public AbstractWizard() {
- this(true);
- }
-
- public AbstractWizard(boolean callInitializer) {
- m_listenerList = new EventListenerList();
- m_changingLock = new OptimisticLock();
- m_accumulatedEvents = new ArrayList<WizardEvent>(3);
- m_availableStepList = new ArrayList<IWizardStep<? extends IForm>>(0);
- m_stepList = new ArrayList<IWizardStep<? extends IForm>>(0);
- m_blockingCondition = new BlockingCondition(false);
- if (callInitializer) {
- callInitializer();
- }
- }
-
- protected void callInitializer() {
- if (!m_initialized) {
- initConfig();
- m_initialized = true;
- }
- }
-
- /*
- * Configuration
- */
-
- @ConfigProperty(ConfigProperty.FORM_DISPLAY_HINT)
- @Order(100)
- @ConfigPropertyValue("DISPLAY_HINT_DIALOG")
- protected int getConfiguredDisplayHint() {
- return DISPLAY_HINT_DIALOG;
- }
-
- @ConfigProperty(ConfigProperty.FORM_VIEW_ID)
- @Order(105)
- @ConfigPropertyValue("null")
- protected String getConfiguredDisplayViewId() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(106)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredModal() {
- return false;
- }
-
- @ConfigProperty(ConfigProperty.TEXT)
- @Order(10)
- @ConfigPropertyValue("null")
- protected String getConfiguredTitle() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.TEXT)
- @Order(20)
- @ConfigPropertyValue("null")
- protected String getConfiguredTitleHtml() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.TEXT)
- @Order(30)
- @ConfigPropertyValue("null")
- protected String getConfiguredTooltipText() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.DOC)
- @Order(40)
- @ConfigPropertyValue("null")
- protected String getConfiguredDoc() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.ICON_ID)
- @Order(20)
- @ConfigPropertyValue("null")
- protected String getConfiguredIconId() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.STRING)
- @Order(50)
- @ConfigPropertyValue("null")
- protected String getConfiguredWizardNo() {
- return null;
- }
-
- @SuppressWarnings("unchecked")
- private Class<? extends IWizardStep<? extends IForm>>[] getConfiguredAvailableSteps() {
- Class<?>[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
- return (Class<? extends IWizardStep<? extends IForm>>[]) ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, IWizardStep.class);
- }
-
- /**
- * create and eventually open a form containing the wizard.<br>
- * this method may be overwritten to provide an own wizard representation
- * form.
- *
- * @return
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(5)
- protected IWizardContainerForm execCreateContainerForm() throws ProcessingException {
- DefaultWizardContainerForm containerForm = new DefaultWizardContainerForm(this);
- containerForm.setDisplayHint(getDisplayHint());
- containerForm.setDisplayViewId(getDisplayViewId());
- containerForm.setModal(isModal());
- return containerForm;
- }
-
- /**
- * Whenever the active step changes (due to {@link #activateStep(IWizardStep)} then this method is called. It can be
- * used for example to decorate the step
- * labels and description depending on the current state or to decorate the
- * current wizard form in {@link #getWizardForm()}
- *
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(6)
- protected void execActiveStepChanged() throws ProcessingException {
- }
-
- /**
- * startup wizard The container form is available at {@link #getContainerForm()}. After this operation the container
- * form is
- * started if not already started in this method. Normally custom code in this
- * method activates a step using {@link IWizardStep#activate(int)} The default
- * implementation simply copies the available step list to the step list and
- * activates the first step
- */
- @Order(10)
- @ConfigOperation
- protected void execStart() throws ProcessingException {
- List<IWizardStep<? extends IForm>> steps = getAvailableSteps();
- setSteps(steps);
- if (steps.size() > 0) {
- activateStep(steps.get(0));
- }
- }
-
- /**
- * next The default implementation activates the step after the current one
- */
- @Order(20)
- @ConfigOperation
- protected void execNextStep() throws ProcessingException {
- IWizardStep<? extends IForm> step = getNextStep();
- activateStep(step);
- }
-
- /**
- * previous The default implementation activates the step before the current
- * one
- */
- @Order(30)
- @ConfigOperation
- protected void execPreviousStep() throws ProcessingException {
- IWizardStep<? extends IForm> step = getPreviousStep();
- activateStep(step);
- }
-
- /**
- * finish button clicked The default implementation just activates a null step
- * and closes the wizard
- */
- @Order(40)
- @ConfigOperation
- protected void execFinish() throws ProcessingException {
- activateStep(null);
- close();
- }
-
- /**
- * cancel button clicked The default implementation just closes the wizard
- */
- @Order(50)
- @ConfigOperation
- protected void execCancel() throws ProcessingException {
- close();
- }
-
- /**
- * suspend button clicked The default implementation just closes the wizard
- */
- @Order(60)
- @ConfigOperation
- protected void execSuspend() throws ProcessingException {
- close();
- }
-
- /**
- * reset button clicked The default implementation does nothing
- */
- @Order(65)
- @ConfigOperation
- protected void execReset() throws ProcessingException {
- }
-
- /**
- * This method is called whenever a field value has changed. It can be used to
- * refresh the button policy by calling {@link #refreshButtonPolicy()} The
- * default implementation does nothing
- */
- @ConfigOperation
- @Order(70)
- protected void execAnyFieldChanged(IFormField source) throws ProcessingException {
- }
-
- /**
- * This method is used to make then wizard buttons
- * visible/invisible/enabled/disabled based on the current form and wizard
- * state. The default implementation just sets the previous, next and finish
- * buttons correctly based on the {@link #getSteps()}.
- */
- @ConfigOperation
- @Order(80)
- protected void execRefreshButtonPolicy() throws ProcessingException {
- IWizardStep<? extends IForm> prev = getPreviousStep();
- IWizardStep<? extends IForm> next = getNextStep();
- //
- IButton b;
- b = getContainerForm().getWizardPreviousStepButton();
- if (b != null) {
- b.setView(true, prev != null, false);
- }
- b = getContainerForm().getWizardNextStepButton();
- if (b != null) {
- b.setView(next != null, true, false);
- }
- b = getContainerForm().getWizardFinishButton();
- if (b != null) {
- b.setView(next == null, true, false);
- }
- }
-
- /**
- * This is a delegate methode that is normally called by the wizard status
- * field (html field) in the {@link IWizardContainerForm} whenever a link is
- * clicked.
- *
- * @param url
- * @param path
- * {@link URL#getPath()}
- * @param local
- * true if the url is not a valid external url but a local model url
- * (http://local/...)
- */
- @ConfigOperation
- @Order(230)
- protected void execHyperlinkAction(URL url, String path, boolean local) throws ProcessingException {
- LOG.info("execHyperlinkAction " + url + " (in " + getClass().getName() + ")");
- }
-
- @SuppressWarnings("boxing")
- protected void initConfig() {
- setDisplayHint(getConfiguredDisplayHint());
- setDisplayViewId(getConfiguredDisplayViewId());
- setModal(getConfiguredModal());
- setTitle(getConfiguredTitle());
- setTitleHtml(getConfiguredTitleHtml());
- setTooltipText(getConfiguredTooltipText());
- setIconId(getConfiguredIconId());
- setWizardNo(getConfiguredWizardNo());
- // initially the wizard is in state "closed"
- propertySupport.setPropertyBool(PROP_CLOSED, true);
- setCloseTypeInternal(CloseType.Unknown);
- // steps
- ArrayList<IWizardStep<? extends IForm>> list = new ArrayList<IWizardStep<? extends IForm>>();
- Class<? extends IWizardStep<? extends IForm>>[] a = getConfiguredAvailableSteps();
- for (Class<? extends IWizardStep<? extends IForm>> element : a) {
- try {
- IWizardStep<? extends IForm> step = ConfigurationUtility.newInnerInstance(this, element);
- list.add(step);
- }
- catch (Exception e) {
- LOG.error("failed creating " + element, e);
- }
- }
- injectStepsInternal(list);
-
- setAvailableSteps(list);
- // add listener to listen on any field in active form
- m_anyFieldChangeListener = new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent e) {
- try {
- execAnyFieldChanged((IFormField) e.getSource());
- }
- catch (Throwable t) {
- LOG.error("" + e.getSource() + " " + e.getPropertyName() + "=" + e.getNewValue(), t);
- }
- }
- };
- propertySupport.addPropertyChangeListener(PROP_WIZARD_FORM, new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent e) {
- IForm oldForm = (IForm) e.getOldValue();
- IForm newForm = (IForm) e.getNewValue();
- if (oldForm != null) {
- oldForm.getRootGroupBox().removeSubtreePropertyChangeListener(IValueField.PROP_VALUE, m_anyFieldChangeListener);
- }
- if (newForm != null) {
- newForm.getRootGroupBox().addSubtreePropertyChangeListener(IValueField.PROP_VALUE, m_anyFieldChangeListener);
- }
- }
- });
- }
-
- /**
- * Used to manage wizard steps i.e. to add/remove wizard steps
- *
- * @param steps
- * live and mutable list of configured steps, not yet initialized
- * and added to the step list
- */
- protected void injectStepsInternal(List<IWizardStep<? extends IForm>> steps) {
- }
-
- /*
- * Runtime
- */
-
- @Override
- public void addWizardListener(WizardListener listener) {
- m_listenerList.add(WizardListener.class, listener);
- }
-
- @Override
- public void removeWizardListener(WizardListener listener) {
- m_listenerList.remove(WizardListener.class, listener);
- }
-
- private void fireStateChanged() {
- fireWizardEvent(new WizardEvent(this, WizardEvent.TYPE_STATE_CHANGED));
- }
-
- private void fireClosed() {
- fireWizardEvent(new WizardEvent(this, WizardEvent.TYPE_CLOSED));
- }
-
- private void fireWizardEvent(WizardEvent e) {
- if (m_changingLock.isAcquired()) {
- // coalesce event with existing event list
- for (Iterator<WizardEvent> it = m_accumulatedEvents.iterator(); it.hasNext();) {
- WizardEvent existingEvent = it.next();
- if (existingEvent.getType() == e.getType()) {
- it.remove();
- }
- }
- m_accumulatedEvents.add(e);
- }
- else {
- WizardListener[] a = m_listenerList.getListeners(WizardListener.class);
- if (a != null && a.length > 0) {
- for (WizardListener element : a) {
- element.wizardChanged(e);
- }
- }
- }
- }
-
- @Override
- public void setChanging(boolean b) {
- if (b) {
- m_changingLock.acquire();
- }
- else {
- m_changingLock.release();
- if (m_changingLock.isReleased()) {
- // now send all accumulated events
- ArrayList<WizardEvent> list = m_accumulatedEvents;
- m_accumulatedEvents = new ArrayList<WizardEvent>(3);
- for (WizardEvent e : list) {
- fireWizardEvent(e);
- }
- }
- }
- }
-
- @Override
- public boolean isChanging() {
- return m_changingLock.isAcquired();
- }
-
- @Override
- public int getDisplayHint() {
- return m_displayHint;
- }
-
- @Override
- public void setDisplayHint(int i) {
- if (m_displayHintLocked) {
- throw new IllegalArgumentException("displayHint cannot be changed once the form handling has started");
- }
- switch (i) {
- case DISPLAY_HINT_DIALOG: {
- m_displayHint = i;
- break;
- }
- case DISPLAY_HINT_VIEW: {
- m_displayHint = i;
- break;
- }
- default: {
- throw new IllegalArgumentException("invalid displayHint " + i);
- }
- }
- }
-
- @Override
- public String getDisplayViewId() {
- return m_displayViewId;
- }
-
- @Override
- public void setDisplayViewId(String viewId) {
- m_displayViewId = viewId;
- }
-
- @Override
- public boolean isModal() {
- return m_modal;
- }
-
- @Override
- public void setModal(boolean b) {
- m_modal = b;
- }
-
- @Override
- public String getTitle() {
- return propertySupport.getPropertyString(PROP_TITLE);
- }
-
- @Override
- public void setTitle(String s) {
- propertySupport.setPropertyString(PROP_TITLE, s);
- }
-
- @Override
- public String getTitleHtml() {
- return propertySupport.getPropertyString(PROP_TITLE_HTML);
- }
-
- @Override
- public void setTitleHtml(String s) {
- propertySupport.setPropertyString(PROP_TITLE_HTML, s);
- }
-
- @Override
- public String getTooltipText() {
- return propertySupport.getPropertyString(PROP_TOOLTIP_TEXT);
- }
-
- @Override
- public void setTooltipText(String s) {
- propertySupport.setPropertyString(PROP_TOOLTIP_TEXT, s);
- }
-
- @Override
- public String getIconId() {
- return propertySupport.getPropertyString(PROP_ICON_ID);
- }
-
- @Override
- public void setIconId(String s) {
- propertySupport.setPropertyString(PROP_ICON_ID, s);
- }
-
- @Override
- public String getSubTitle() {
- return propertySupport.getPropertyString(PROP_SUB_TITLE);
- }
-
- @Override
- public void setSubTitle(String s) {
- propertySupport.setPropertyString(PROP_SUB_TITLE, s);
- }
-
- @Override
- public String getWizardNo() {
- return propertySupport.getPropertyString(PROP_SUB_TITLE);
- }
-
- @Override
- public void setWizardNo(String s) {
- propertySupport.setPropertyString(PROP_SUB_TITLE, s);
- }
-
- public IDesktop getDesktop() {
- return ClientSyncJob.getCurrentSession().getDesktop();
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public <T extends IWizardStep<? extends IForm>> T getAvailableStep(Class<T> type) {
- for (IWizardStep<? extends IForm> step : m_availableStepList) {
- if (type.isInstance(step)) {
- return (T) step;
- }
- }
- return null;
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public <T extends IWizardStep<? extends IForm>> T getStep(Class<T> type) {
- for (IWizardStep<? extends IForm> step : m_stepList) {
- if (type.isInstance(step)) {
- return (T) step;
- }
- }
- return null;
- }
-
- @Override
- public IWizardStep<? extends IForm> getStep(int index) {
- if (index >= 0 && index < m_stepList.size()) {
- return m_stepList.get(index);
- }
- else {
- return null;
- }
- }
-
- @Override
- public IWizardStep<? extends IForm> getStepBySimpleClassName(String simpleClassName) {
- for (IWizardStep<? extends IForm> step : m_stepList) {
- if (step.getClass().getSimpleName().equals(simpleClassName)) {
- return step;
- }
- }
- return null;
- }
-
- @Override
- public IWizardStep<? extends IForm> getStepByClassName(String className) {
- for (IWizardStep<? extends IForm> step : m_stepList) {
- if (step.getClass().getName().equals(className)) {
- return step;
- }
- }
- return null;
- }
-
- @Override
- public int getStepIndex(IWizardStep<? extends IForm> step) {
- if (step == null) {
- return -1;
- }
- for (int i = 0; i < m_stepList.size(); i++) {
- if (m_stepList.get(i) == step) {
- return i;
- }
- }
- return -1;
- }
-
- @Override
- public List<IWizardStep<? extends IForm>> getAvailableSteps() {
- if (m_availableStepList != null) {
- return new ArrayList<IWizardStep<? extends IForm>>(m_availableStepList);
- }
- else {
- return Collections.emptyList();
- }
- }
-
- @Override
- public void setAvailableSteps(List<IWizardStep<? extends IForm>> steps) {
- m_availableStepList = new ArrayList<IWizardStep<? extends IForm>>();
- if (steps != null) {
- for (IWizardStep<? extends IForm> step : steps) {
- if (step != null) {
- m_availableStepList.add(step);
- }
- }
- }
- }
-
- @Override
- public List<IWizardStep<? extends IForm>> getSteps() {
- if (m_stepList != null) {
- return new ArrayList<IWizardStep<? extends IForm>>(m_stepList);
- }
- else {
- return Collections.emptyList();
- }
- }
-
- @Override
- public void setSteps(IWizardStep<? extends IForm>... steps) {
- if (steps == null) {
- steps = new IWizardStep<?>[0];
- }
- setSteps(Arrays.asList(steps));
- }
-
- @Override
- public void setSteps(List<IWizardStep<? extends IForm>> steps) {
- try {
- setChanging(true);
- //
- // remove old
- if (m_stepList != null) {
- for (IWizardStep<? extends IForm> step : m_stepList) {
- step.setWizardInternal(null);
- }
- }
- // add new
- m_stepList = new ArrayList<IWizardStep<? extends IForm>>();
- if (steps != null) {
- for (IWizardStep<? extends IForm> step : steps) {
- if (step != null) {
- m_stepList.add(step);
- step.setWizardInternal(this);
- }
- }
- }
- fireStateChanged();
- }
- finally {
- setChanging(false);
- }
- }
-
- @Override
- public IWizardStep<? extends IForm> getActiveStep() {
- return m_activeStep;
- }
-
- protected void setActiveStepInternal(IWizardStep<? extends IForm> activeStep) {
- m_activeStep = activeStep;
- }
-
- @Override
- public void activateStep(IWizardStep<? extends IForm> step) throws ProcessingException {
- activateStep(step, false, false);
- }
-
- @Override
- public void activateStep(IWizardStep<? extends IForm> step, boolean jumpForward, boolean jumpBackward) throws ProcessingException {
- if (m_activeStep != step) {
- try {
- int kind = getStepKind(m_activeStep, step);
- // old target
- if (m_activeStep != null) {
- // this call may veto
- m_activeStep.deactivate(kind);
- }
- // in-between targets
- List<IWizardStep<? extends IForm>> intermediateSteps = getStepSpan(m_activeStep, false, step, false);
- if (intermediateSteps.size() > 0) {
- if ((kind == IWizardStep.STEP_NEXT && !jumpForward) || (kind == IWizardStep.STEP_PREVIOUS && !jumpBackward)) {
- for (IWizardStep<? extends IForm> intermediateStep : intermediateSteps) {
- // these calls may veto
- intermediateStep.activate(kind);
- intermediateStep.deactivate(kind);
- }
- }
- }
- // new target
- m_activeStep = step;
- if (m_activeStep != null) {
- // this call may veto
- m_activeStep.activate(kind);
- }
- // notify callback
- try {
- execActiveStepChanged();
- }
- catch (ProcessingException e) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- catch (Throwable t) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Unexpected", t));
- }
- }
- finally {
- refreshButtonPolicy();
- fireStateChanged();
- }
- }
- }
-
- @Override
- public void refreshButtonPolicy() {
- try {
- execRefreshButtonPolicy();
- }
- catch (ProcessingException e) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- catch (Throwable t) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Unexpected", t));
- }
- }
-
- @Override
- public int getStepKind(IWizardStep<? extends IForm> from, IWizardStep<? extends IForm> to) {
- if (from == null && to == null) {
- return IWizardStep.STEP_NEXT;
- }
- if (from == null) {
- return IWizardStep.STEP_NEXT;
- }
- if (to == null) {
- return IWizardStep.STEP_NEXT;
- }
- int fromIndex = getStepIndex(from);
- int toIndex = getStepIndex(to);
- if (fromIndex == toIndex) {
- return IWizardStep.STEP_NEXT;
- }
- if (fromIndex < toIndex) {
- return IWizardStep.STEP_NEXT;
- }
- if (fromIndex > toIndex) {
- return IWizardStep.STEP_PREVIOUS;
- }
- return IWizardStep.STEP_NEXT;
- }
-
- @Override
- public List<IWizardStep<? extends IForm>> getStepSpan(IWizardStep<? extends IForm> from, boolean includeFrom, IWizardStep<? extends IForm> to, boolean includeTo) {
- ArrayList<IWizardStep<? extends IForm>> list = new ArrayList<IWizardStep<? extends IForm>>();
- //
- if (from == null && to == null) {
- return list;
- }
- if (from == null) {
- if (to != null && includeTo) {
- list.add(to);
- }
- return list;
- }
- if (to == null) {
- if (from != null && includeFrom) {
- list.add(from);
- }
- return list;
- }
- int fromIndex = getStepIndex(from);
- int toIndex = getStepIndex(to);
- if (fromIndex == toIndex) {
- if (includeFrom) {
- list.add(from);
- }
- else if (includeTo) {
- list.add(to);
- }
- return list;
- }
- if (fromIndex == toIndex - 1) {
- if (includeFrom) {
- list.add(from);
- }
- if (includeTo) {
- list.add(to);
- }
- return list;
- }
- if (fromIndex < toIndex - 1) {
- if (includeFrom) {
- list.add(from);
- }
- int n = toIndex - fromIndex - 1;
- for (int i = 0; i < n; i++) {
- list.add(m_stepList.get(fromIndex + 1 + i));
- }
- if (includeTo) {
- list.add(to);
- }
- return list;
- }
- if (fromIndex == toIndex + 1) {
- if (includeFrom) {
- list.add(from);
- }
- if (includeTo) {
- list.add(to);
- }
- return list;
- }
- if (fromIndex > toIndex + 1) {
- if (includeFrom) {
- list.add(from);
- }
- int n = fromIndex - toIndex - 1;
- for (int i = 0; i < n; i++) {
- list.add(m_stepList.get(fromIndex - 1 - i));
- }
- if (includeTo) {
- list.add(to);
- }
- return list;
- }
- // default
- if (includeFrom) {
- list.add(from);
- }
- if (includeTo) {
- list.add(to);
- }
- return list;
- }
-
- @Override
- public IWizardStep<? extends IForm> getPreviousStep() {
- int index = getStepIndex(getActiveStep()) - 1;
- if (index >= 0 && index < m_stepList.size()) {
- return m_stepList.get(index);
- }
- else {
- return null;
- }
- }
-
- @Override
- public IWizardStep<? extends IForm> getNextStep() {
- int index = getStepIndex(getActiveStep()) + 1;
- if (index >= 0 && index < m_stepList.size()) {
- return m_stepList.get(index);
- }
- else {
- return null;
- }
- }
-
- @Override
- public IWizardStep<? extends IForm> getPreviousEnabledStep() {
- int index = getStepIndex(getActiveStep()) - 1;
- while (index >= 0 && index < m_stepList.size() && !m_stepList.get(index).isEnabled()) {
- index--;
- }
- if (index >= 0 && index < m_stepList.size()) {
- return m_stepList.get(index);
- }
- else {
- return null;
- }
- }
-
- @Override
- public IWizardStep<? extends IForm> getNextEnabledStep() {
- int index = getStepIndex(getActiveStep()) + 1;
- while (index >= 0 && index < m_stepList.size() && !m_stepList.get(index).isEnabled()) {
- index++;
- }
- if (index >= 0 && index < m_stepList.size()) {
- return m_stepList.get(index);
- }
- else {
- return null;
- }
- }
-
- public IWizardStep<? extends IForm>[] getHistory() {
- int index = getStepIndex(getActiveStep());
- if (m_stepList.size() > 0 && index >= 0) {
- return m_stepList.subList(0, Math.min(index, m_stepList.size())).toArray(new IWizardStep<?>[0]);
- }
- else {
- return new IWizardStep<?>[0];
- }
- }
-
- public IWizardStep<? extends IForm>[] getExpectedFuture() {
- int index = getStepIndex(getActiveStep());
- if (m_stepList.size() > 0 && index < m_stepList.size()) {
- return m_stepList.subList(Math.max(index + 1, 0), m_stepList.size()).toArray(new IWizardStep<?>[0]);
- }
- else {
- return new IWizardStep<?>[0];
- }
- }
-
- @Override
- public void start() throws ProcessingException {
- assertClosed();
- if (m_blockingCondition.isBlocking()) {
- throw new ProcessingException("The wizard " + getClass().getSimpleName() + " has already been started");
- }
- m_blockingCondition.setBlocking(true);
- propertySupport.setPropertyBool(PROP_CLOSED, false);
- setCloseTypeInternal(CloseType.Unknown);
- createContainerForm();
- execStart();
- if (m_containerForm != null && !m_containerForm.isFormOpen()) {
- m_containerForm.startWizard();
- }
- }
-
- @Override
- public void close() throws ProcessingException {
- if (!isClosed()) {
- // close container form
- try {
- if (m_containerForm != null) {
- m_containerForm.doClose();
- m_containerForm = null;
- }
- }
- catch (Throwable t) {
- LOG.error("closing " + getTitle(), t);
- }
- // dispose all steps
- HashSet<IWizardStep<? extends IForm>> set = new HashSet<IWizardStep<? extends IForm>>();
- set.addAll(getAvailableSteps());
- set.addAll(getSteps());
- for (IWizardStep<? extends IForm> step : set) {
- try {
- step.dispose();
- }
- catch (Throwable t) {
- LOG.error("closing " + getTitle(), t);
- }
- }
- if (getCloseType() == CloseType.Unknown) {
- setCloseTypeInternal(CloseType.Closed);
- }
- propertySupport.setPropertyBool(PROP_CLOSED, true);
- fireClosed();
- // unlock
- m_blockingCondition.release();
- }
- }
-
- @Override
- public void waitFor() throws ProcessingException {
- // check if the desktop is observing this process
- IDesktop desktop = ClientSyncJob.getCurrentSession().getDesktop();
- if (desktop == null || !desktop.isOpened()) {
- throw new ProcessingException("Cannot wait for " + getClass().getName() + ". There is no desktop or the desktop has not yet been opened in the ui", null, WAIT_FOR_ERROR_CODE);
- }
- try {
- m_blockingCondition.waitFor();
- }
- catch (InterruptedException e) {
- throw new ProcessingException(ScoutTexts.get("UserInterrupted"), e);
- }
- }
-
- @Override
- public boolean isOpen() {
- return !isClosed();
- }
-
- @Override
- public boolean isClosed() {
- return propertySupport.getPropertyBool(PROP_CLOSED);
- }
-
- @Override
- public CloseType getCloseType() {
- return (CloseType) propertySupport.getProperty(PROP_CLOSE_TYPE);
- }
-
- private void setCloseTypeInternal(CloseType t) {
- propertySupport.setProperty(PROP_CLOSE_TYPE, t);
- }
-
- /**
- * next step The default implementation calls {@link #execNextStep()}
- */
- @Override
- public void doNextStep() throws ProcessingException {
- if (isOpen()) {
- try {
- execNextStep();
- }
- catch (ProcessingException pe) {
- throw pe;
- }
- catch (Throwable t) {
- throw new ProcessingException("Unexpected", t);
- }
- }
- }
-
- /**
- * previous step The default implementation calls {@link #execPreviousStep()}
- */
- @Override
- public void doPreviousStep() throws ProcessingException {
- if (isOpen()) {
- try {
- execPreviousStep();
- }
- catch (ProcessingException pe) {
- throw pe;
- }
- catch (Throwable t) {
- throw new ProcessingException("Unexpected", t);
- }
- }
- }
-
- /**
- * finish The default implementation calls {@link #execFinish()}
- */
- @Override
- public void doFinish() throws ProcessingException {
- if (isOpen()) {
- CloseType oldType = getCloseType();
- try {
- setCloseTypeInternal(CloseType.Finished);
- execFinish();
- }
- catch (ProcessingException pe) {
- setCloseTypeInternal(oldType);
- throw pe;
- }
- catch (Throwable t) {
- setCloseTypeInternal(oldType);
- throw new ProcessingException("Unexpected", t);
- }
- }
- }
-
- /**
- * cancel The default implementation calls {@link #execCancel()}
- */
- @Override
- public void doCancel() throws ProcessingException {
- if (isOpen()) {
- CloseType oldType = getCloseType();
- try {
- setCloseTypeInternal(CloseType.Cancelled);
- execCancel();
- }
- catch (ProcessingException pe) {
- setCloseTypeInternal(oldType);
- throw pe;
- }
- catch (Throwable t) {
- setCloseTypeInternal(oldType);
- throw new ProcessingException("Unexpected", t);
- }
- }
- }
-
- /**
- * suspend The default implementation calls {@link #execSuspend()}
- */
- @Override
- public void doSuspend() throws ProcessingException {
- if (isOpen()) {
- CloseType oldType = getCloseType();
- try {
- setCloseTypeInternal(CloseType.Suspended);
- execSuspend();
- }
- catch (ProcessingException pe) {
- setCloseTypeInternal(oldType);
- throw pe;
- }
- catch (Throwable t) {
- setCloseTypeInternal(oldType);
- throw new ProcessingException("Unexpected", t);
- }
- }
- }
-
- /**
- * reset The default implementation calls {@link #execReset()}
- */
- @Override
- public void doReset() throws ProcessingException {
- try {
- execReset();
- }
- catch (ProcessingException pe) {
- throw pe;
- }
- catch (Throwable t) {
- throw new ProcessingException("Unexpected", t);
- }
- }
-
- /**
- * This is a delegate methode that is normally called by the wizard status
- * field (html field) in the {@link IWizardContainerForm} whenever a link is
- * clicked.
- *
- * @param url
- * @param path
- * {@link URL#getPath()}
- * @param local
- * true if the url is not a valid external url but a local model url
- * (http://local/...) The default implementation calls {@link #execHyperlinkAction(URL, String, boolean)}
- */
- @Override
- public void doHyperlinkAction(URL url, String path, boolean local) throws ProcessingException {
- if (isOpen()) {
- execHyperlinkAction(url, path, local);
- }
- }
-
- private void assertOpen() throws ProcessingException {
- if (isClosed()) {
- throw new ProcessingException("wizard is closed");
- }
- }
-
- private void assertClosed() throws ProcessingException {
- if (!isClosed()) {
- throw new ProcessingException("wizard is already started");
- }
- }
-
- @Override
- public IForm getWizardForm() {
- return (IForm) propertySupport.getProperty(PROP_WIZARD_FORM);
- }
-
- @Override
- public void setWizardForm(IForm form) {
- propertySupport.setProperty(PROP_WIZARD_FORM, form);
- }
-
- @Override
- public IWizardContainerForm createContainerForm() throws ProcessingException {
- if (m_containerForm == null) {
- m_containerForm = execCreateContainerForm();
- }
- return m_containerForm;
- }
-
- @Override
- public IWizardContainerForm getContainerForm() {
- return m_containerForm;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.wizard;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.scout.commons.ConfigurationUtility;
+import org.eclipse.scout.commons.EventListenerList;
+import org.eclipse.scout.commons.OptimisticLock;
+import org.eclipse.scout.commons.annotations.ConfigOperation;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.beans.AbstractPropertyObserver;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.BlockingCondition;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
+import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
+import org.eclipse.scout.service.SERVICES;
+
+public abstract class AbstractWizard extends AbstractPropertyObserver implements IWizard {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractWizard.class);
+
+ private boolean m_initialized;
+ private final EventListenerList m_listenerList;
+ private ArrayList<IWizardStep<? extends IForm>> m_availableStepList;
+ private ArrayList<IWizardStep<? extends IForm>> m_stepList;
+ private IWizardStep<? extends IForm> m_activeStep;
+ // event accumulation (coalescation)
+ private final OptimisticLock m_changingLock;
+ private ArrayList<WizardEvent> m_accumulatedEvents;
+ //
+ private boolean m_displayHintLocked;
+ private boolean m_modal;
+ private String m_displayViewId;
+ private int m_displayHint;
+ private final BlockingCondition m_blockingCondition;
+
+ private IWizardContainerForm m_containerForm;
+ private PropertyChangeListener m_anyFieldChangeListener;
+
+ public AbstractWizard() {
+ this(true);
+ }
+
+ public AbstractWizard(boolean callInitializer) {
+ m_listenerList = new EventListenerList();
+ m_changingLock = new OptimisticLock();
+ m_accumulatedEvents = new ArrayList<WizardEvent>(3);
+ m_availableStepList = new ArrayList<IWizardStep<? extends IForm>>(0);
+ m_stepList = new ArrayList<IWizardStep<? extends IForm>>(0);
+ m_blockingCondition = new BlockingCondition(false);
+ if (callInitializer) {
+ callInitializer();
+ }
+ }
+
+ protected void callInitializer() {
+ if (!m_initialized) {
+ initConfig();
+ m_initialized = true;
+ }
+ }
+
+ /*
+ * Configuration
+ */
+
+ @ConfigProperty(ConfigProperty.FORM_DISPLAY_HINT)
+ @Order(100)
+ @ConfigPropertyValue("DISPLAY_HINT_DIALOG")
+ protected int getConfiguredDisplayHint() {
+ return DISPLAY_HINT_DIALOG;
+ }
+
+ @ConfigProperty(ConfigProperty.FORM_VIEW_ID)
+ @Order(105)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredDisplayViewId() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(106)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredModal() {
+ return false;
+ }
+
+ @ConfigProperty(ConfigProperty.TEXT)
+ @Order(10)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredTitle() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.TEXT)
+ @Order(20)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredTitleHtml() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.TEXT)
+ @Order(30)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredTooltipText() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.DOC)
+ @Order(40)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredDoc() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.ICON_ID)
+ @Order(20)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredIconId() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.STRING)
+ @Order(50)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredWizardNo() {
+ return null;
+ }
+
+ @SuppressWarnings("unchecked")
+ private Class<? extends IWizardStep<? extends IForm>>[] getConfiguredAvailableSteps() {
+ Class<?>[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
+ return (Class<? extends IWizardStep<? extends IForm>>[]) ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, IWizardStep.class);
+ }
+
+ /**
+ * create and eventually open a form containing the wizard.<br>
+ * this method may be overwritten to provide an own wizard representation
+ * form.
+ *
+ * @return
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(5)
+ protected IWizardContainerForm execCreateContainerForm() throws ProcessingException {
+ DefaultWizardContainerForm containerForm = new DefaultWizardContainerForm(this);
+ containerForm.setDisplayHint(getDisplayHint());
+ containerForm.setDisplayViewId(getDisplayViewId());
+ containerForm.setModal(isModal());
+ return containerForm;
+ }
+
+ /**
+ * Whenever the active step changes (due to {@link #activateStep(IWizardStep)} then this method is called. It can be
+ * used for example to decorate the step
+ * labels and description depending on the current state or to decorate the
+ * current wizard form in {@link #getWizardForm()}
+ *
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(6)
+ protected void execActiveStepChanged() throws ProcessingException {
+ }
+
+ /**
+ * startup wizard The container form is available at {@link #getContainerForm()}. After this operation the container
+ * form is
+ * started if not already started in this method. Normally custom code in this
+ * method activates a step using {@link IWizardStep#activate(int)} The default
+ * implementation simply copies the available step list to the step list and
+ * activates the first step
+ */
+ @Order(10)
+ @ConfigOperation
+ protected void execStart() throws ProcessingException {
+ List<IWizardStep<? extends IForm>> steps = getAvailableSteps();
+ setSteps(steps);
+ if (steps.size() > 0) {
+ activateStep(steps.get(0));
+ }
+ }
+
+ /**
+ * next The default implementation activates the step after the current one
+ */
+ @Order(20)
+ @ConfigOperation
+ protected void execNextStep() throws ProcessingException {
+ IWizardStep<? extends IForm> step = getNextStep();
+ activateStep(step);
+ }
+
+ /**
+ * previous The default implementation activates the step before the current
+ * one
+ */
+ @Order(30)
+ @ConfigOperation
+ protected void execPreviousStep() throws ProcessingException {
+ IWizardStep<? extends IForm> step = getPreviousStep();
+ activateStep(step);
+ }
+
+ /**
+ * finish button clicked The default implementation just activates a null step
+ * and closes the wizard
+ */
+ @Order(40)
+ @ConfigOperation
+ protected void execFinish() throws ProcessingException {
+ activateStep(null);
+ close();
+ }
+
+ /**
+ * cancel button clicked The default implementation just closes the wizard
+ */
+ @Order(50)
+ @ConfigOperation
+ protected void execCancel() throws ProcessingException {
+ close();
+ }
+
+ /**
+ * suspend button clicked The default implementation just closes the wizard
+ */
+ @Order(60)
+ @ConfigOperation
+ protected void execSuspend() throws ProcessingException {
+ close();
+ }
+
+ /**
+ * reset button clicked The default implementation does nothing
+ */
+ @Order(65)
+ @ConfigOperation
+ protected void execReset() throws ProcessingException {
+ }
+
+ /**
+ * This method is called whenever a field value has changed. It can be used to
+ * refresh the button policy by calling {@link #refreshButtonPolicy()} The
+ * default implementation does nothing
+ */
+ @ConfigOperation
+ @Order(70)
+ protected void execAnyFieldChanged(IFormField source) throws ProcessingException {
+ }
+
+ /**
+ * This method is used to make then wizard buttons
+ * visible/invisible/enabled/disabled based on the current form and wizard
+ * state. The default implementation just sets the previous, next and finish
+ * buttons correctly based on the {@link #getSteps()}.
+ */
+ @ConfigOperation
+ @Order(80)
+ protected void execRefreshButtonPolicy() throws ProcessingException {
+ IWizardStep<? extends IForm> prev = getPreviousStep();
+ IWizardStep<? extends IForm> next = getNextStep();
+ //
+ IButton b;
+ b = getContainerForm().getWizardPreviousStepButton();
+ if (b != null) {
+ b.setView(true, prev != null, false);
+ }
+ b = getContainerForm().getWizardNextStepButton();
+ if (b != null) {
+ b.setView(next != null, true, false);
+ }
+ b = getContainerForm().getWizardFinishButton();
+ if (b != null) {
+ b.setView(next == null, true, false);
+ }
+ }
+
+ /**
+ * This is a delegate methode that is normally called by the wizard status
+ * field (html field) in the {@link IWizardContainerForm} whenever a link is
+ * clicked.
+ *
+ * @param url
+ * @param path
+ * {@link URL#getPath()}
+ * @param local
+ * true if the url is not a valid external url but a local model url
+ * (http://local/...)
+ */
+ @ConfigOperation
+ @Order(230)
+ protected void execHyperlinkAction(URL url, String path, boolean local) throws ProcessingException {
+ LOG.info("execHyperlinkAction " + url + " (in " + getClass().getName() + ")");
+ }
+
+ @SuppressWarnings("boxing")
+ protected void initConfig() {
+ setDisplayHint(getConfiguredDisplayHint());
+ setDisplayViewId(getConfiguredDisplayViewId());
+ setModal(getConfiguredModal());
+ setTitle(getConfiguredTitle());
+ setTitleHtml(getConfiguredTitleHtml());
+ setTooltipText(getConfiguredTooltipText());
+ setIconId(getConfiguredIconId());
+ setWizardNo(getConfiguredWizardNo());
+ // initially the wizard is in state "closed"
+ propertySupport.setPropertyBool(PROP_CLOSED, true);
+ setCloseTypeInternal(CloseType.Unknown);
+ // steps
+ ArrayList<IWizardStep<? extends IForm>> list = new ArrayList<IWizardStep<? extends IForm>>();
+ Class<? extends IWizardStep<? extends IForm>>[] a = getConfiguredAvailableSteps();
+ for (Class<? extends IWizardStep<? extends IForm>> element : a) {
+ try {
+ IWizardStep<? extends IForm> step = ConfigurationUtility.newInnerInstance(this, element);
+ list.add(step);
+ }
+ catch (Exception e) {
+ LOG.error("failed creating " + element, e);
+ }
+ }
+ injectStepsInternal(list);
+
+ setAvailableSteps(list);
+ // add listener to listen on any field in active form
+ m_anyFieldChangeListener = new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent e) {
+ try {
+ execAnyFieldChanged((IFormField) e.getSource());
+ }
+ catch (Throwable t) {
+ LOG.error("" + e.getSource() + " " + e.getPropertyName() + "=" + e.getNewValue(), t);
+ }
+ }
+ };
+ propertySupport.addPropertyChangeListener(PROP_WIZARD_FORM, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent e) {
+ IForm oldForm = (IForm) e.getOldValue();
+ IForm newForm = (IForm) e.getNewValue();
+ if (oldForm != null) {
+ oldForm.getRootGroupBox().removeSubtreePropertyChangeListener(IValueField.PROP_VALUE, m_anyFieldChangeListener);
+ }
+ if (newForm != null) {
+ newForm.getRootGroupBox().addSubtreePropertyChangeListener(IValueField.PROP_VALUE, m_anyFieldChangeListener);
+ }
+ }
+ });
+ }
+
+ /**
+ * Used to manage wizard steps i.e. to add/remove wizard steps
+ *
+ * @param steps
+ * live and mutable list of configured steps, not yet initialized
+ * and added to the step list
+ */
+ protected void injectStepsInternal(List<IWizardStep<? extends IForm>> steps) {
+ }
+
+ /*
+ * Runtime
+ */
+
+ @Override
+ public void addWizardListener(WizardListener listener) {
+ m_listenerList.add(WizardListener.class, listener);
+ }
+
+ @Override
+ public void removeWizardListener(WizardListener listener) {
+ m_listenerList.remove(WizardListener.class, listener);
+ }
+
+ private void fireStateChanged() {
+ fireWizardEvent(new WizardEvent(this, WizardEvent.TYPE_STATE_CHANGED));
+ }
+
+ private void fireClosed() {
+ fireWizardEvent(new WizardEvent(this, WizardEvent.TYPE_CLOSED));
+ }
+
+ private void fireWizardEvent(WizardEvent e) {
+ if (m_changingLock.isAcquired()) {
+ // coalesce event with existing event list
+ for (Iterator<WizardEvent> it = m_accumulatedEvents.iterator(); it.hasNext();) {
+ WizardEvent existingEvent = it.next();
+ if (existingEvent.getType() == e.getType()) {
+ it.remove();
+ }
+ }
+ m_accumulatedEvents.add(e);
+ }
+ else {
+ WizardListener[] a = m_listenerList.getListeners(WizardListener.class);
+ if (a != null && a.length > 0) {
+ for (WizardListener element : a) {
+ element.wizardChanged(e);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void setChanging(boolean b) {
+ if (b) {
+ m_changingLock.acquire();
+ }
+ else {
+ m_changingLock.release();
+ if (m_changingLock.isReleased()) {
+ // now send all accumulated events
+ ArrayList<WizardEvent> list = m_accumulatedEvents;
+ m_accumulatedEvents = new ArrayList<WizardEvent>(3);
+ for (WizardEvent e : list) {
+ fireWizardEvent(e);
+ }
+ }
+ }
+ }
+
+ @Override
+ public boolean isChanging() {
+ return m_changingLock.isAcquired();
+ }
+
+ @Override
+ public int getDisplayHint() {
+ return m_displayHint;
+ }
+
+ @Override
+ public void setDisplayHint(int i) {
+ if (m_displayHintLocked) {
+ throw new IllegalArgumentException("displayHint cannot be changed once the form handling has started");
+ }
+ switch (i) {
+ case DISPLAY_HINT_DIALOG: {
+ m_displayHint = i;
+ break;
+ }
+ case DISPLAY_HINT_VIEW: {
+ m_displayHint = i;
+ break;
+ }
+ default: {
+ throw new IllegalArgumentException("invalid displayHint " + i);
+ }
+ }
+ }
+
+ @Override
+ public String getDisplayViewId() {
+ return m_displayViewId;
+ }
+
+ @Override
+ public void setDisplayViewId(String viewId) {
+ m_displayViewId = viewId;
+ }
+
+ @Override
+ public boolean isModal() {
+ return m_modal;
+ }
+
+ @Override
+ public void setModal(boolean b) {
+ m_modal = b;
+ }
+
+ @Override
+ public String getTitle() {
+ return propertySupport.getPropertyString(PROP_TITLE);
+ }
+
+ @Override
+ public void setTitle(String s) {
+ propertySupport.setPropertyString(PROP_TITLE, s);
+ }
+
+ @Override
+ public String getTitleHtml() {
+ return propertySupport.getPropertyString(PROP_TITLE_HTML);
+ }
+
+ @Override
+ public void setTitleHtml(String s) {
+ propertySupport.setPropertyString(PROP_TITLE_HTML, s);
+ }
+
+ @Override
+ public String getTooltipText() {
+ return propertySupport.getPropertyString(PROP_TOOLTIP_TEXT);
+ }
+
+ @Override
+ public void setTooltipText(String s) {
+ propertySupport.setPropertyString(PROP_TOOLTIP_TEXT, s);
+ }
+
+ @Override
+ public String getIconId() {
+ return propertySupport.getPropertyString(PROP_ICON_ID);
+ }
+
+ @Override
+ public void setIconId(String s) {
+ propertySupport.setPropertyString(PROP_ICON_ID, s);
+ }
+
+ @Override
+ public String getSubTitle() {
+ return propertySupport.getPropertyString(PROP_SUB_TITLE);
+ }
+
+ @Override
+ public void setSubTitle(String s) {
+ propertySupport.setPropertyString(PROP_SUB_TITLE, s);
+ }
+
+ @Override
+ public String getWizardNo() {
+ return propertySupport.getPropertyString(PROP_SUB_TITLE);
+ }
+
+ @Override
+ public void setWizardNo(String s) {
+ propertySupport.setPropertyString(PROP_SUB_TITLE, s);
+ }
+
+ public IDesktop getDesktop() {
+ return ClientSyncJob.getCurrentSession().getDesktop();
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public <T extends IWizardStep<? extends IForm>> T getAvailableStep(Class<T> type) {
+ for (IWizardStep<? extends IForm> step : m_availableStepList) {
+ if (type.isInstance(step)) {
+ return (T) step;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public <T extends IWizardStep<? extends IForm>> T getStep(Class<T> type) {
+ for (IWizardStep<? extends IForm> step : m_stepList) {
+ if (type.isInstance(step)) {
+ return (T) step;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public IWizardStep<? extends IForm> getStep(int index) {
+ if (index >= 0 && index < m_stepList.size()) {
+ return m_stepList.get(index);
+ }
+ else {
+ return null;
+ }
+ }
+
+ @Override
+ public IWizardStep<? extends IForm> getStepBySimpleClassName(String simpleClassName) {
+ for (IWizardStep<? extends IForm> step : m_stepList) {
+ if (step.getClass().getSimpleName().equals(simpleClassName)) {
+ return step;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public IWizardStep<? extends IForm> getStepByClassName(String className) {
+ for (IWizardStep<? extends IForm> step : m_stepList) {
+ if (step.getClass().getName().equals(className)) {
+ return step;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public int getStepIndex(IWizardStep<? extends IForm> step) {
+ if (step == null) {
+ return -1;
+ }
+ for (int i = 0; i < m_stepList.size(); i++) {
+ if (m_stepList.get(i) == step) {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+ @Override
+ public List<IWizardStep<? extends IForm>> getAvailableSteps() {
+ if (m_availableStepList != null) {
+ return new ArrayList<IWizardStep<? extends IForm>>(m_availableStepList);
+ }
+ else {
+ return Collections.emptyList();
+ }
+ }
+
+ @Override
+ public void setAvailableSteps(List<IWizardStep<? extends IForm>> steps) {
+ m_availableStepList = new ArrayList<IWizardStep<? extends IForm>>();
+ if (steps != null) {
+ for (IWizardStep<? extends IForm> step : steps) {
+ if (step != null) {
+ m_availableStepList.add(step);
+ }
+ }
+ }
+ }
+
+ @Override
+ public List<IWizardStep<? extends IForm>> getSteps() {
+ if (m_stepList != null) {
+ return new ArrayList<IWizardStep<? extends IForm>>(m_stepList);
+ }
+ else {
+ return Collections.emptyList();
+ }
+ }
+
+ @Override
+ public void setSteps(IWizardStep<? extends IForm>... steps) {
+ if (steps == null) {
+ steps = new IWizardStep<?>[0];
+ }
+ setSteps(Arrays.asList(steps));
+ }
+
+ @Override
+ public void setSteps(List<IWizardStep<? extends IForm>> steps) {
+ try {
+ setChanging(true);
+ //
+ // remove old
+ if (m_stepList != null) {
+ for (IWizardStep<? extends IForm> step : m_stepList) {
+ step.setWizardInternal(null);
+ }
+ }
+ // add new
+ m_stepList = new ArrayList<IWizardStep<? extends IForm>>();
+ if (steps != null) {
+ for (IWizardStep<? extends IForm> step : steps) {
+ if (step != null) {
+ m_stepList.add(step);
+ step.setWizardInternal(this);
+ }
+ }
+ }
+ fireStateChanged();
+ }
+ finally {
+ setChanging(false);
+ }
+ }
+
+ @Override
+ public IWizardStep<? extends IForm> getActiveStep() {
+ return m_activeStep;
+ }
+
+ protected void setActiveStepInternal(IWizardStep<? extends IForm> activeStep) {
+ m_activeStep = activeStep;
+ }
+
+ @Override
+ public void activateStep(IWizardStep<? extends IForm> step) throws ProcessingException {
+ activateStep(step, false, false);
+ }
+
+ @Override
+ public void activateStep(IWizardStep<? extends IForm> step, boolean jumpForward, boolean jumpBackward) throws ProcessingException {
+ if (m_activeStep != step) {
+ try {
+ int kind = getStepKind(m_activeStep, step);
+ // old target
+ if (m_activeStep != null) {
+ // this call may veto
+ m_activeStep.deactivate(kind);
+ }
+ // in-between targets
+ List<IWizardStep<? extends IForm>> intermediateSteps = getStepSpan(m_activeStep, false, step, false);
+ if (intermediateSteps.size() > 0) {
+ if ((kind == IWizardStep.STEP_NEXT && !jumpForward) || (kind == IWizardStep.STEP_PREVIOUS && !jumpBackward)) {
+ for (IWizardStep<? extends IForm> intermediateStep : intermediateSteps) {
+ // these calls may veto
+ intermediateStep.activate(kind);
+ intermediateStep.deactivate(kind);
+ }
+ }
+ }
+ // new target
+ m_activeStep = step;
+ if (m_activeStep != null) {
+ // this call may veto
+ m_activeStep.activate(kind);
+ }
+ // notify callback
+ try {
+ execActiveStepChanged();
+ }
+ catch (ProcessingException e) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ catch (Throwable t) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Unexpected", t));
+ }
+ }
+ finally {
+ refreshButtonPolicy();
+ fireStateChanged();
+ }
+ }
+ }
+
+ @Override
+ public void refreshButtonPolicy() {
+ try {
+ execRefreshButtonPolicy();
+ }
+ catch (ProcessingException e) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ catch (Throwable t) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Unexpected", t));
+ }
+ }
+
+ @Override
+ public int getStepKind(IWizardStep<? extends IForm> from, IWizardStep<? extends IForm> to) {
+ if (from == null && to == null) {
+ return IWizardStep.STEP_NEXT;
+ }
+ if (from == null) {
+ return IWizardStep.STEP_NEXT;
+ }
+ if (to == null) {
+ return IWizardStep.STEP_NEXT;
+ }
+ int fromIndex = getStepIndex(from);
+ int toIndex = getStepIndex(to);
+ if (fromIndex == toIndex) {
+ return IWizardStep.STEP_NEXT;
+ }
+ if (fromIndex < toIndex) {
+ return IWizardStep.STEP_NEXT;
+ }
+ if (fromIndex > toIndex) {
+ return IWizardStep.STEP_PREVIOUS;
+ }
+ return IWizardStep.STEP_NEXT;
+ }
+
+ @Override
+ public List<IWizardStep<? extends IForm>> getStepSpan(IWizardStep<? extends IForm> from, boolean includeFrom, IWizardStep<? extends IForm> to, boolean includeTo) {
+ ArrayList<IWizardStep<? extends IForm>> list = new ArrayList<IWizardStep<? extends IForm>>();
+ //
+ if (from == null && to == null) {
+ return list;
+ }
+ if (from == null) {
+ if (to != null && includeTo) {
+ list.add(to);
+ }
+ return list;
+ }
+ if (to == null) {
+ if (from != null && includeFrom) {
+ list.add(from);
+ }
+ return list;
+ }
+ int fromIndex = getStepIndex(from);
+ int toIndex = getStepIndex(to);
+ if (fromIndex == toIndex) {
+ if (includeFrom) {
+ list.add(from);
+ }
+ else if (includeTo) {
+ list.add(to);
+ }
+ return list;
+ }
+ if (fromIndex == toIndex - 1) {
+ if (includeFrom) {
+ list.add(from);
+ }
+ if (includeTo) {
+ list.add(to);
+ }
+ return list;
+ }
+ if (fromIndex < toIndex - 1) {
+ if (includeFrom) {
+ list.add(from);
+ }
+ int n = toIndex - fromIndex - 1;
+ for (int i = 0; i < n; i++) {
+ list.add(m_stepList.get(fromIndex + 1 + i));
+ }
+ if (includeTo) {
+ list.add(to);
+ }
+ return list;
+ }
+ if (fromIndex == toIndex + 1) {
+ if (includeFrom) {
+ list.add(from);
+ }
+ if (includeTo) {
+ list.add(to);
+ }
+ return list;
+ }
+ if (fromIndex > toIndex + 1) {
+ if (includeFrom) {
+ list.add(from);
+ }
+ int n = fromIndex - toIndex - 1;
+ for (int i = 0; i < n; i++) {
+ list.add(m_stepList.get(fromIndex - 1 - i));
+ }
+ if (includeTo) {
+ list.add(to);
+ }
+ return list;
+ }
+ // default
+ if (includeFrom) {
+ list.add(from);
+ }
+ if (includeTo) {
+ list.add(to);
+ }
+ return list;
+ }
+
+ @Override
+ public IWizardStep<? extends IForm> getPreviousStep() {
+ int index = getStepIndex(getActiveStep()) - 1;
+ if (index >= 0 && index < m_stepList.size()) {
+ return m_stepList.get(index);
+ }
+ else {
+ return null;
+ }
+ }
+
+ @Override
+ public IWizardStep<? extends IForm> getNextStep() {
+ int index = getStepIndex(getActiveStep()) + 1;
+ if (index >= 0 && index < m_stepList.size()) {
+ return m_stepList.get(index);
+ }
+ else {
+ return null;
+ }
+ }
+
+ @Override
+ public IWizardStep<? extends IForm> getPreviousEnabledStep() {
+ int index = getStepIndex(getActiveStep()) - 1;
+ while (index >= 0 && index < m_stepList.size() && !m_stepList.get(index).isEnabled()) {
+ index--;
+ }
+ if (index >= 0 && index < m_stepList.size()) {
+ return m_stepList.get(index);
+ }
+ else {
+ return null;
+ }
+ }
+
+ @Override
+ public IWizardStep<? extends IForm> getNextEnabledStep() {
+ int index = getStepIndex(getActiveStep()) + 1;
+ while (index >= 0 && index < m_stepList.size() && !m_stepList.get(index).isEnabled()) {
+ index++;
+ }
+ if (index >= 0 && index < m_stepList.size()) {
+ return m_stepList.get(index);
+ }
+ else {
+ return null;
+ }
+ }
+
+ public IWizardStep<? extends IForm>[] getHistory() {
+ int index = getStepIndex(getActiveStep());
+ if (m_stepList.size() > 0 && index >= 0) {
+ return m_stepList.subList(0, Math.min(index, m_stepList.size())).toArray(new IWizardStep<?>[0]);
+ }
+ else {
+ return new IWizardStep<?>[0];
+ }
+ }
+
+ public IWizardStep<? extends IForm>[] getExpectedFuture() {
+ int index = getStepIndex(getActiveStep());
+ if (m_stepList.size() > 0 && index < m_stepList.size()) {
+ return m_stepList.subList(Math.max(index + 1, 0), m_stepList.size()).toArray(new IWizardStep<?>[0]);
+ }
+ else {
+ return new IWizardStep<?>[0];
+ }
+ }
+
+ @Override
+ public void start() throws ProcessingException {
+ assertClosed();
+ if (m_blockingCondition.isBlocking()) {
+ throw new ProcessingException("The wizard " + getClass().getSimpleName() + " has already been started");
+ }
+ m_blockingCondition.setBlocking(true);
+ propertySupport.setPropertyBool(PROP_CLOSED, false);
+ setCloseTypeInternal(CloseType.Unknown);
+ createContainerForm();
+ execStart();
+ if (m_containerForm != null && !m_containerForm.isFormOpen()) {
+ m_containerForm.startWizard();
+ }
+ }
+
+ @Override
+ public void close() throws ProcessingException {
+ if (!isClosed()) {
+ // close container form
+ try {
+ if (m_containerForm != null) {
+ m_containerForm.doClose();
+ m_containerForm = null;
+ }
+ }
+ catch (Throwable t) {
+ LOG.error("closing " + getTitle(), t);
+ }
+ // dispose all steps
+ HashSet<IWizardStep<? extends IForm>> set = new HashSet<IWizardStep<? extends IForm>>();
+ set.addAll(getAvailableSteps());
+ set.addAll(getSteps());
+ for (IWizardStep<? extends IForm> step : set) {
+ try {
+ step.dispose();
+ }
+ catch (Throwable t) {
+ LOG.error("closing " + getTitle(), t);
+ }
+ }
+ if (getCloseType() == CloseType.Unknown) {
+ setCloseTypeInternal(CloseType.Closed);
+ }
+ propertySupport.setPropertyBool(PROP_CLOSED, true);
+ fireClosed();
+ // unlock
+ m_blockingCondition.release();
+ }
+ }
+
+ @Override
+ public void waitFor() throws ProcessingException {
+ // check if the desktop is observing this process
+ IDesktop desktop = ClientSyncJob.getCurrentSession().getDesktop();
+ if (desktop == null || !desktop.isOpened()) {
+ throw new ProcessingException("Cannot wait for " + getClass().getName() + ". There is no desktop or the desktop has not yet been opened in the ui", null, WAIT_FOR_ERROR_CODE);
+ }
+ try {
+ m_blockingCondition.waitFor();
+ }
+ catch (InterruptedException e) {
+ throw new ProcessingException(ScoutTexts.get("UserInterrupted"), e);
+ }
+ }
+
+ @Override
+ public boolean isOpen() {
+ return !isClosed();
+ }
+
+ @Override
+ public boolean isClosed() {
+ return propertySupport.getPropertyBool(PROP_CLOSED);
+ }
+
+ @Override
+ public CloseType getCloseType() {
+ return (CloseType) propertySupport.getProperty(PROP_CLOSE_TYPE);
+ }
+
+ private void setCloseTypeInternal(CloseType t) {
+ propertySupport.setProperty(PROP_CLOSE_TYPE, t);
+ }
+
+ /**
+ * next step The default implementation calls {@link #execNextStep()}
+ */
+ @Override
+ public void doNextStep() throws ProcessingException {
+ if (isOpen()) {
+ try {
+ execNextStep();
+ }
+ catch (ProcessingException pe) {
+ throw pe;
+ }
+ catch (Throwable t) {
+ throw new ProcessingException("Unexpected", t);
+ }
+ }
+ }
+
+ /**
+ * previous step The default implementation calls {@link #execPreviousStep()}
+ */
+ @Override
+ public void doPreviousStep() throws ProcessingException {
+ if (isOpen()) {
+ try {
+ execPreviousStep();
+ }
+ catch (ProcessingException pe) {
+ throw pe;
+ }
+ catch (Throwable t) {
+ throw new ProcessingException("Unexpected", t);
+ }
+ }
+ }
+
+ /**
+ * finish The default implementation calls {@link #execFinish()}
+ */
+ @Override
+ public void doFinish() throws ProcessingException {
+ if (isOpen()) {
+ CloseType oldType = getCloseType();
+ try {
+ setCloseTypeInternal(CloseType.Finished);
+ execFinish();
+ }
+ catch (ProcessingException pe) {
+ setCloseTypeInternal(oldType);
+ throw pe;
+ }
+ catch (Throwable t) {
+ setCloseTypeInternal(oldType);
+ throw new ProcessingException("Unexpected", t);
+ }
+ }
+ }
+
+ /**
+ * cancel The default implementation calls {@link #execCancel()}
+ */
+ @Override
+ public void doCancel() throws ProcessingException {
+ if (isOpen()) {
+ CloseType oldType = getCloseType();
+ try {
+ setCloseTypeInternal(CloseType.Cancelled);
+ execCancel();
+ }
+ catch (ProcessingException pe) {
+ setCloseTypeInternal(oldType);
+ throw pe;
+ }
+ catch (Throwable t) {
+ setCloseTypeInternal(oldType);
+ throw new ProcessingException("Unexpected", t);
+ }
+ }
+ }
+
+ /**
+ * suspend The default implementation calls {@link #execSuspend()}
+ */
+ @Override
+ public void doSuspend() throws ProcessingException {
+ if (isOpen()) {
+ CloseType oldType = getCloseType();
+ try {
+ setCloseTypeInternal(CloseType.Suspended);
+ execSuspend();
+ }
+ catch (ProcessingException pe) {
+ setCloseTypeInternal(oldType);
+ throw pe;
+ }
+ catch (Throwable t) {
+ setCloseTypeInternal(oldType);
+ throw new ProcessingException("Unexpected", t);
+ }
+ }
+ }
+
+ /**
+ * reset The default implementation calls {@link #execReset()}
+ */
+ @Override
+ public void doReset() throws ProcessingException {
+ try {
+ execReset();
+ }
+ catch (ProcessingException pe) {
+ throw pe;
+ }
+ catch (Throwable t) {
+ throw new ProcessingException("Unexpected", t);
+ }
+ }
+
+ /**
+ * This is a delegate methode that is normally called by the wizard status
+ * field (html field) in the {@link IWizardContainerForm} whenever a link is
+ * clicked.
+ *
+ * @param url
+ * @param path
+ * {@link URL#getPath()}
+ * @param local
+ * true if the url is not a valid external url but a local model url
+ * (http://local/...) The default implementation calls {@link #execHyperlinkAction(URL, String, boolean)}
+ */
+ @Override
+ public void doHyperlinkAction(URL url, String path, boolean local) throws ProcessingException {
+ if (isOpen()) {
+ execHyperlinkAction(url, path, local);
+ }
+ }
+
+ private void assertOpen() throws ProcessingException {
+ if (isClosed()) {
+ throw new ProcessingException("wizard is closed");
+ }
+ }
+
+ private void assertClosed() throws ProcessingException {
+ if (!isClosed()) {
+ throw new ProcessingException("wizard is already started");
+ }
+ }
+
+ @Override
+ public IForm getWizardForm() {
+ return (IForm) propertySupport.getProperty(PROP_WIZARD_FORM);
+ }
+
+ @Override
+ public void setWizardForm(IForm form) {
+ propertySupport.setProperty(PROP_WIZARD_FORM, form);
+ }
+
+ @Override
+ public IWizardContainerForm createContainerForm() throws ProcessingException {
+ if (m_containerForm == null) {
+ m_containerForm = execCreateContainerForm();
+ }
+ return m_containerForm;
+ }
+
+ @Override
+ public IWizardContainerForm getContainerForm() {
+ return m_containerForm;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/AbstractWizardContainerForm.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/AbstractWizardContainerForm.java
index 8c0e33b54d..d5fdf1abd4 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/AbstractWizardContainerForm.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/AbstractWizardContainerForm.java
@@ -1,151 +1,151 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.wizard;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.HashSet;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.form.AbstractForm;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-
-/**
- * <h3>AbstractWizardContainerForm</h3> The form to extends to provide a
- * customized wizard container form.
- *
- * @since 24.11.2009
- */
-public abstract class AbstractWizardContainerForm extends AbstractForm implements IWizardContainerForm {
- private IWizard m_wizard;
- private P_WizardPropertyListener m_propertyChangeListener;
-
- public AbstractWizardContainerForm(IWizard w) throws ProcessingException {
- super(false);
- m_wizard = w;
- callInitializer();
- }
-
- @Override
- public IWizard getWizard() {
- return m_wizard;
- }
-
- @Override
- protected boolean getConfiguredMaximizeEnabled() {
- return true;
- }
-
- @Override
- protected void execInitForm() throws ProcessingException {
- // attach to wizard
- if (m_wizard != null) {
- if (m_propertyChangeListener == null) {
- m_propertyChangeListener = new P_WizardPropertyListener();
- }
- m_wizard.addPropertyChangeListener(m_propertyChangeListener);
- }
- updateTitleFromWizard();
- }
-
- @Override
- protected void execDisposeForm() throws ProcessingException {
- // detach from wizard
- if (m_wizard != null) {
- if (m_propertyChangeListener != null) {
- m_wizard.removePropertyChangeListener(m_propertyChangeListener);
- m_propertyChangeListener = null;
- }
- }
- super.doFinally();
- }
-
- @Override
- protected void execOnCloseRequest(boolean kill, HashSet<Integer> enabledButtonSystemTypes) throws ProcessingException {
- handleEscapeKey(kill);
- }
-
- protected void handleEscapeKey(boolean kill) throws ProcessingException {
- if (kill) {
- if (getWizardSuspendButton() != null && getWizardSuspendButton().isVisible() && getWizardSuspendButton().isEnabled()) {
- getWizard().doSuspend();
- }
- else if (getWizardCancelButton() != null && getWizardCancelButton().isVisible() && getWizardCancelButton().isEnabled()) {
- getWizard().doCancel();
- }
- else {
- getWizard().doCancel();
- }
- }
- else {
- if (getWizardCancelButton() != null && getWizardCancelButton().isVisible() && getWizardCancelButton().isEnabled()) {
- getWizard().doCancel();
- }
- else if (getWizardSuspendButton() != null && getWizardSuspendButton().isVisible() && getWizardSuspendButton().isEnabled()) {
- getWizard().doSuspend();
- }
- else {
- getWizard().doCancel();
- }
- }
- }
-
- protected void handleEnterKey() throws ProcessingException {
- if (getWizardNextStepButton() != null && getWizardNextStepButton().isVisible() && getWizardNextStepButton().isEnabled()) {
- getWizard().doNextStep();
- }
- else if (getWizardFinishButton() != null && getWizardFinishButton().isVisible() && getWizardFinishButton().isEnabled()) {
- getWizard().doFinish();
- }
- }
-
- protected void updateTitleFromWizard() {
- if (getWizard() != null) {
- String title = getWizard().getTitle();
- String subTitle = getWizard().getSubTitle();
- String s = "";
- if (title != null) {
- s += title;
- }
- if (subTitle != null) {
- s += " - " + subTitle;
- }
- setTitle(s);
- }
- }
-
- protected abstract IForm getInnerWizardForm();
-
- protected abstract void setInnerWizardForm(IForm form);
-
- /**
- * may be overridden to handle property changes.
- */
- protected void handleWizardPropertyChanged(String propertyName, Object oldValue, Object newValue) {
- if (IWizard.PROP_WIZARD_FORM.equals(propertyName)) {
- setInnerWizardForm(getWizard().getWizardForm());
- }
- else if (IWizard.PROP_TITLE.equals(propertyName)) {
- updateTitleFromWizard();
- }
- else if (IWizard.PROP_SUB_TITLE.equals(propertyName)) {
- updateTitleFromWizard();
- }
- }
-
- private class P_WizardPropertyListener implements PropertyChangeListener {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- handleWizardPropertyChanged(evt.getPropertyName(), evt.getOldValue(), evt.getNewValue());
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.wizard;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.HashSet;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.form.AbstractForm;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+
+/**
+ * <h3>AbstractWizardContainerForm</h3> The form to extends to provide a
+ * customized wizard container form.
+ *
+ * @since 24.11.2009
+ */
+public abstract class AbstractWizardContainerForm extends AbstractForm implements IWizardContainerForm {
+ private IWizard m_wizard;
+ private P_WizardPropertyListener m_propertyChangeListener;
+
+ public AbstractWizardContainerForm(IWizard w) throws ProcessingException {
+ super(false);
+ m_wizard = w;
+ callInitializer();
+ }
+
+ @Override
+ public IWizard getWizard() {
+ return m_wizard;
+ }
+
+ @Override
+ protected boolean getConfiguredMaximizeEnabled() {
+ return true;
+ }
+
+ @Override
+ protected void execInitForm() throws ProcessingException {
+ // attach to wizard
+ if (m_wizard != null) {
+ if (m_propertyChangeListener == null) {
+ m_propertyChangeListener = new P_WizardPropertyListener();
+ }
+ m_wizard.addPropertyChangeListener(m_propertyChangeListener);
+ }
+ updateTitleFromWizard();
+ }
+
+ @Override
+ protected void execDisposeForm() throws ProcessingException {
+ // detach from wizard
+ if (m_wizard != null) {
+ if (m_propertyChangeListener != null) {
+ m_wizard.removePropertyChangeListener(m_propertyChangeListener);
+ m_propertyChangeListener = null;
+ }
+ }
+ super.doFinally();
+ }
+
+ @Override
+ protected void execOnCloseRequest(boolean kill, HashSet<Integer> enabledButtonSystemTypes) throws ProcessingException {
+ handleEscapeKey(kill);
+ }
+
+ protected void handleEscapeKey(boolean kill) throws ProcessingException {
+ if (kill) {
+ if (getWizardSuspendButton() != null && getWizardSuspendButton().isVisible() && getWizardSuspendButton().isEnabled()) {
+ getWizard().doSuspend();
+ }
+ else if (getWizardCancelButton() != null && getWizardCancelButton().isVisible() && getWizardCancelButton().isEnabled()) {
+ getWizard().doCancel();
+ }
+ else {
+ getWizard().doCancel();
+ }
+ }
+ else {
+ if (getWizardCancelButton() != null && getWizardCancelButton().isVisible() && getWizardCancelButton().isEnabled()) {
+ getWizard().doCancel();
+ }
+ else if (getWizardSuspendButton() != null && getWizardSuspendButton().isVisible() && getWizardSuspendButton().isEnabled()) {
+ getWizard().doSuspend();
+ }
+ else {
+ getWizard().doCancel();
+ }
+ }
+ }
+
+ protected void handleEnterKey() throws ProcessingException {
+ if (getWizardNextStepButton() != null && getWizardNextStepButton().isVisible() && getWizardNextStepButton().isEnabled()) {
+ getWizard().doNextStep();
+ }
+ else if (getWizardFinishButton() != null && getWizardFinishButton().isVisible() && getWizardFinishButton().isEnabled()) {
+ getWizard().doFinish();
+ }
+ }
+
+ protected void updateTitleFromWizard() {
+ if (getWizard() != null) {
+ String title = getWizard().getTitle();
+ String subTitle = getWizard().getSubTitle();
+ String s = "";
+ if (title != null) {
+ s += title;
+ }
+ if (subTitle != null) {
+ s += " - " + subTitle;
+ }
+ setTitle(s);
+ }
+ }
+
+ protected abstract IForm getInnerWizardForm();
+
+ protected abstract void setInnerWizardForm(IForm form);
+
+ /**
+ * may be overridden to handle property changes.
+ */
+ protected void handleWizardPropertyChanged(String propertyName, Object oldValue, Object newValue) {
+ if (IWizard.PROP_WIZARD_FORM.equals(propertyName)) {
+ setInnerWizardForm(getWizard().getWizardForm());
+ }
+ else if (IWizard.PROP_TITLE.equals(propertyName)) {
+ updateTitleFromWizard();
+ }
+ else if (IWizard.PROP_SUB_TITLE.equals(propertyName)) {
+ updateTitleFromWizard();
+ }
+ }
+
+ private class P_WizardPropertyListener implements PropertyChangeListener {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ handleWizardPropertyChanged(evt.getPropertyName(), evt.getOldValue(), evt.getNewValue());
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/AbstractWizardStatusField.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/AbstractWizardStatusField.java
index 5b07f8b405..57671bccde 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/AbstractWizardStatusField.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/AbstractWizardStatusField.java
@@ -1,194 +1,194 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.wizard;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.scout.commons.WeakEventListener;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.client.ui.form.fields.htmlfield.AbstractHtmlField;
-
-public abstract class AbstractWizardStatusField extends AbstractHtmlField {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractWizardStatusField.class);
- private IWizard m_wizard;
- private IWizardStatusHtmlProvider m_htmlProvider;
- private P_WizardListener m_scoutWizardListener;
- private P_WizardStepListener m_scoutWizardStepListener;
- private boolean m_dirty;
- public static final String STEP_ANCHOR_IDENTIFIER = "STEP_";
-
- public AbstractWizardStatusField() {
- this(true);
- }
-
- public AbstractWizardStatusField(boolean callInitializer) {
- super(callInitializer);
- }
-
- public IWizardStatusHtmlProvider getHtmlProvider() {
- return m_htmlProvider;
- }
-
- public void setHtmlProvider(IWizardStatusHtmlProvider htmlProvider) {
- m_htmlProvider = htmlProvider;
- }
-
- @Override
- protected int getConfiguredMaxLength() {
- return 1000000;
- }
-
- @Override
- protected boolean getConfiguredHtmlEditor() {
- return false;
- }
-
- @Override
- protected boolean getConfiguredScrollBarEnabled() {
- return false;
- }
-
- @Override
- protected boolean getConfiguredLabelVisible() {
- return false;
- }
-
- @Override
- protected void execInitField() throws ProcessingException {
- //automatically set wizard if the field is placed inside a wizard container form
- IForm f = getForm();
- while (f != null) {
- if (f instanceof IWizardContainerForm) {
- setWizard(((IWizardContainerForm) f).getWizard());
- }
- f = f.getOuterForm();
- }
- }
-
- public void setWizard(IWizard wizard) throws ProcessingException {
- if (m_wizard != null) {
- m_wizard.removeWizardListener(m_scoutWizardListener);
- m_wizard.removePropertyChangeListener(m_scoutWizardStepListener);
- m_scoutWizardListener = null;
- m_scoutWizardStepListener = null;
- m_wizard = null;
- }
-
- if (wizard != null) {
- m_wizard = wizard;
- m_scoutWizardListener = new P_WizardListener();
- m_wizard.addWizardListener(m_scoutWizardListener);
- m_wizard.addPropertyChangeListener(m_scoutWizardListener);
- // add step listeners
- m_scoutWizardStepListener = new P_WizardStepListener();
- for (IWizardStep step : m_wizard.getSteps()) {
- step.removePropertyChangeListener(m_scoutWizardStepListener);
- step.addPropertyChangeListener(m_scoutWizardStepListener);
- }
- }
- markDirty();
- }
-
- public IWizard getWizard() {
- return m_wizard;
- }
-
- @Override
- protected void execDisposeField() throws ProcessingException {
- m_dirty = false;
- }
-
- private void markDirty() {
- m_dirty = true;
- new ClientSyncJob("Wizard status - mark dirty", ClientSyncJob.getCurrentSession()) {
- @Override
- protected void runVoid(IProgressMonitor monitor) throws Throwable {
- if (m_dirty) {
- try {
- refreshStatus();
- }
- catch (ProcessingException e) {
- LOG.warn(null, e);
- }
- }
- }
- }.schedule();
- }
-
- public void refreshStatus() throws ProcessingException {
- m_dirty = false;
- try {
- if (m_htmlProvider == null) {
- m_htmlProvider = new DefaultWizardStatusHtmlProvider();
- m_htmlProvider.initialize(this);
- }
- setValue(m_htmlProvider.createHtml(m_wizard));
- // now scroll to the active step
- int index = 1;
- for (IWizardStep<?> step : m_wizard.getSteps()) {
- if (step == m_wizard.getActiveStep()) {
- setScrollToAnchor(STEP_ANCHOR_IDENTIFIER + index);
- break;
- }
- index++;
- }
- }
- catch (Exception e) {
- LOG.warn(null, e);
- }
- }
-
- private class P_WizardListener implements WizardListener, PropertyChangeListener, WeakEventListener {
- @Override
- public void wizardChanged(WizardEvent e) {
- switch (e.getType()) {
- case WizardEvent.TYPE_STATE_CHANGED: {
- // re-attach step listeners
- for (IWizardStep step : m_wizard.getSteps()) {
- step.removePropertyChangeListener(m_scoutWizardStepListener);
- step.addPropertyChangeListener(m_scoutWizardStepListener);
- }
- markDirty();
- break;
- }
- }
- }
-
- @Override
- public void propertyChange(final PropertyChangeEvent e) {
- if (IWizard.PROP_TITLE.equals(e.getPropertyName()) ||
- IWizard.PROP_TITLE_HTML.equals(e.getPropertyName()) ||
- IWizard.PROP_TOOLTIP_TEXT.equals(e.getPropertyName())) {
- markDirty();
- }
- }
- }// end class P_ScoutWizardListener
-
- private class P_WizardStepListener implements PropertyChangeListener, WeakEventListener {
- @Override
- public void propertyChange(final PropertyChangeEvent e) {
- if (IWizardStep.PROP_DESCRIPTION_HTML.equals(e.getPropertyName()) ||
- IWizardStep.PROP_TITLE.equals(e.getPropertyName()) ||
- IWizardStep.PROP_TITLE_HTML.equals(e.getPropertyName()) ||
- IWizardStep.PROP_TOOLTIP_TEXT.equals(e.getPropertyName()) ||
- IWizardStep.PROP_ENABLED.equals(e.getPropertyName())) {
- markDirty();
- }
- }
- }// end class P_ScoutWizardStepListener
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.wizard;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.scout.commons.WeakEventListener;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.client.ui.form.fields.htmlfield.AbstractHtmlField;
+
+public abstract class AbstractWizardStatusField extends AbstractHtmlField {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractWizardStatusField.class);
+ private IWizard m_wizard;
+ private IWizardStatusHtmlProvider m_htmlProvider;
+ private P_WizardListener m_scoutWizardListener;
+ private P_WizardStepListener m_scoutWizardStepListener;
+ private boolean m_dirty;
+ public static final String STEP_ANCHOR_IDENTIFIER = "STEP_";
+
+ public AbstractWizardStatusField() {
+ this(true);
+ }
+
+ public AbstractWizardStatusField(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ public IWizardStatusHtmlProvider getHtmlProvider() {
+ return m_htmlProvider;
+ }
+
+ public void setHtmlProvider(IWizardStatusHtmlProvider htmlProvider) {
+ m_htmlProvider = htmlProvider;
+ }
+
+ @Override
+ protected int getConfiguredMaxLength() {
+ return 1000000;
+ }
+
+ @Override
+ protected boolean getConfiguredHtmlEditor() {
+ return false;
+ }
+
+ @Override
+ protected boolean getConfiguredScrollBarEnabled() {
+ return false;
+ }
+
+ @Override
+ protected boolean getConfiguredLabelVisible() {
+ return false;
+ }
+
+ @Override
+ protected void execInitField() throws ProcessingException {
+ //automatically set wizard if the field is placed inside a wizard container form
+ IForm f = getForm();
+ while (f != null) {
+ if (f instanceof IWizardContainerForm) {
+ setWizard(((IWizardContainerForm) f).getWizard());
+ }
+ f = f.getOuterForm();
+ }
+ }
+
+ public void setWizard(IWizard wizard) throws ProcessingException {
+ if (m_wizard != null) {
+ m_wizard.removeWizardListener(m_scoutWizardListener);
+ m_wizard.removePropertyChangeListener(m_scoutWizardStepListener);
+ m_scoutWizardListener = null;
+ m_scoutWizardStepListener = null;
+ m_wizard = null;
+ }
+
+ if (wizard != null) {
+ m_wizard = wizard;
+ m_scoutWizardListener = new P_WizardListener();
+ m_wizard.addWizardListener(m_scoutWizardListener);
+ m_wizard.addPropertyChangeListener(m_scoutWizardListener);
+ // add step listeners
+ m_scoutWizardStepListener = new P_WizardStepListener();
+ for (IWizardStep step : m_wizard.getSteps()) {
+ step.removePropertyChangeListener(m_scoutWizardStepListener);
+ step.addPropertyChangeListener(m_scoutWizardStepListener);
+ }
+ }
+ markDirty();
+ }
+
+ public IWizard getWizard() {
+ return m_wizard;
+ }
+
+ @Override
+ protected void execDisposeField() throws ProcessingException {
+ m_dirty = false;
+ }
+
+ private void markDirty() {
+ m_dirty = true;
+ new ClientSyncJob("Wizard status - mark dirty", ClientSyncJob.getCurrentSession()) {
+ @Override
+ protected void runVoid(IProgressMonitor monitor) throws Throwable {
+ if (m_dirty) {
+ try {
+ refreshStatus();
+ }
+ catch (ProcessingException e) {
+ LOG.warn(null, e);
+ }
+ }
+ }
+ }.schedule();
+ }
+
+ public void refreshStatus() throws ProcessingException {
+ m_dirty = false;
+ try {
+ if (m_htmlProvider == null) {
+ m_htmlProvider = new DefaultWizardStatusHtmlProvider();
+ m_htmlProvider.initialize(this);
+ }
+ setValue(m_htmlProvider.createHtml(m_wizard));
+ // now scroll to the active step
+ int index = 1;
+ for (IWizardStep<?> step : m_wizard.getSteps()) {
+ if (step == m_wizard.getActiveStep()) {
+ setScrollToAnchor(STEP_ANCHOR_IDENTIFIER + index);
+ break;
+ }
+ index++;
+ }
+ }
+ catch (Exception e) {
+ LOG.warn(null, e);
+ }
+ }
+
+ private class P_WizardListener implements WizardListener, PropertyChangeListener, WeakEventListener {
+ @Override
+ public void wizardChanged(WizardEvent e) {
+ switch (e.getType()) {
+ case WizardEvent.TYPE_STATE_CHANGED: {
+ // re-attach step listeners
+ for (IWizardStep step : m_wizard.getSteps()) {
+ step.removePropertyChangeListener(m_scoutWizardStepListener);
+ step.addPropertyChangeListener(m_scoutWizardStepListener);
+ }
+ markDirty();
+ break;
+ }
+ }
+ }
+
+ @Override
+ public void propertyChange(final PropertyChangeEvent e) {
+ if (IWizard.PROP_TITLE.equals(e.getPropertyName()) ||
+ IWizard.PROP_TITLE_HTML.equals(e.getPropertyName()) ||
+ IWizard.PROP_TOOLTIP_TEXT.equals(e.getPropertyName())) {
+ markDirty();
+ }
+ }
+ }// end class P_ScoutWizardListener
+
+ private class P_WizardStepListener implements PropertyChangeListener, WeakEventListener {
+ @Override
+ public void propertyChange(final PropertyChangeEvent e) {
+ if (IWizardStep.PROP_DESCRIPTION_HTML.equals(e.getPropertyName()) ||
+ IWizardStep.PROP_TITLE.equals(e.getPropertyName()) ||
+ IWizardStep.PROP_TITLE_HTML.equals(e.getPropertyName()) ||
+ IWizardStep.PROP_TOOLTIP_TEXT.equals(e.getPropertyName()) ||
+ IWizardStep.PROP_ENABLED.equals(e.getPropertyName())) {
+ markDirty();
+ }
+ }
+ }// end class P_ScoutWizardStepListener
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/AbstractWizardStep.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/AbstractWizardStep.java
index 90cc18de67..571f72ed87 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/AbstractWizardStep.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/AbstractWizardStep.java
@@ -1,384 +1,384 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.wizard;
-
-import java.beans.PropertyChangeListener;
-
-import org.eclipse.scout.commons.annotations.ConfigOperation;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.beans.AbstractPropertyObserver;
-import org.eclipse.scout.commons.beans.IPropertyObserver;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.form.FormEvent;
-import org.eclipse.scout.rt.client.ui.form.FormListener;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
-import org.eclipse.scout.service.SERVICES;
-
-public abstract class AbstractWizardStep<T extends IForm> extends AbstractPropertyObserver implements IWizardStep<T>, IPropertyObserver {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractWizardStep.class);
-
- private IWizard m_wizard;
- private T m_form;
- private FormListener m_formListener;
- private int m_activationCounter;
- private boolean m_initialized;
-
- public AbstractWizardStep() {
- this(true);
- }
-
- public AbstractWizardStep(boolean callInitializer) {
- if (callInitializer) {
- callInitializer();
- }
- }
-
- protected void callInitializer() {
- if (!m_initialized) {
- initConfig();
- m_initialized = true;
- }
- }
-
- /*
- * Configuration
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(10)
- @ConfigPropertyValue("true")
- protected boolean getConfiguredEnabled() {
- return true;
- }
-
- @ConfigProperty(ConfigProperty.TEXT)
- @Order(20)
- @ConfigPropertyValue("null")
- protected String getConfiguredTitle() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.TEXT)
- @Order(30)
- @ConfigPropertyValue("null")
- protected String getConfiguredTooltipText() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.TEXT)
- @Order(35)
- @ConfigPropertyValue("null")
- protected String getConfiguredTitleHtml() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.TEXT)
- @Order(38)
- @ConfigPropertyValue("null")
- protected String getConfiguredDescriptionHtml() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.ICON_ID)
- @Order(40)
- @ConfigPropertyValue("null")
- protected String getConfiguredIconId() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.DOC)
- @Order(50)
- @ConfigPropertyValue("null")
- protected String getConfiguredDoc() {
- return null;
- }
-
- /**
- * @param stepKind
- * any of the STEP_* constants activate this step normally creates a
- * form, calls {@link IForm#startWizardStep(IWizardStep, Class)} on
- * the form and places the form inside the wizard
- * {@link IWizard#setWizardForm(org.eclipse.scout.rt.client.ui.form.IForm)}
- */
- @Order(10)
- @ConfigOperation
- protected void execActivate(int stepKind) throws ProcessingException {
- }
-
- /**
- * @param stepKind
- * any of the STEP_* constants deactivate this step
- */
- @Order(20)
- @ConfigOperation
- protected void execDeactivate(int stepKind) throws ProcessingException {
- }
-
- /**
- * dispose this step The default implementation closes the form at {@link #getForm()}
- */
- @Order(30)
- @ConfigOperation
- protected void execDispose() throws ProcessingException {
- T f = getForm();
- if (f != null) {
- f.doClose();
- }
- }
-
- /**
- * When the cached form is stored (it may still be open) this method is
- * called.
- *
- * @param activation
- * true if this method is called by the wizard itself by {@link IWizardStep#activate(int)},
- * {@link IWizardStep#deactivate(int)} or {@link IWizardStep#dispose()} The default implementation does
- * nothing.
- */
- @Order(40)
- @ConfigOperation
- protected void execFormStored(boolean activation) throws ProcessingException {
- }
-
- /**
- * When the cached form is discarded (save was either not requested or it was
- * forcedly closed) this method is called.
- *
- * @param activation
- * true if this method is called by the wizard itself by {@link IWizardStep#activate(int)},
- * {@link IWizardStep#deactivate(int)} or {@link IWizardStep#dispose()} The default implementation does
- * nothing.
- */
- @Order(50)
- @ConfigOperation
- protected void execFormDiscarded(boolean activation) throws ProcessingException {
- }
-
- /**
- * When the cached form is closed (after some store and/or a discard
- * operation) this method is called.
- *
- * @param activation
- * true if this method is called by the wizard itself by {@link IWizardStep#activate(int)},
- * {@link IWizardStep#deactivate(int)} or {@link IWizardStep#dispose()} The default implementation calls
- * {@link IWizard#doNextStep()} iff activation=false and form was
- * saved (formDataChanged=true)
- */
- @Order(60)
- @ConfigOperation
- protected void execFormClosed(boolean activation) throws ProcessingException {
- if (!activation) {
- if (getForm().isFormStored()) {
- getWizard().doNextStep();
- }
- }
- }
-
- protected void initConfig() {
- setTitle(getConfiguredTitle());
- setTooltipText(getConfiguredTooltipText());
- setTitleHtml(getConfiguredTitleHtml());
- setDescriptionHtml(getConfiguredDescriptionHtml());
- setIconId(getConfiguredIconId());
- setEnabled(getConfiguredEnabled());
- }
-
- /*
- * Runtime
- */
- @Override
- public void addPropertyChangeListener(PropertyChangeListener listener) {
- propertySupport.addPropertyChangeListener(listener);
- }
-
- @Override
- public void addPropertyChangeListener(String propName, PropertyChangeListener listener) {
- propertySupport.addPropertyChangeListener(propName, listener);
- }
-
- @Override
- public void removePropertyChangeListener(PropertyChangeListener listener) {
- propertySupport.removePropertyChangeListener(listener);
- }
-
- @Override
- public void removePropertyChangeListener(String propName, PropertyChangeListener listener) {
- propertySupport.removePropertyChangeListener(propName, listener);
- }
-
- @Override
- public T getForm() {
- return m_form;
- }
-
- @Override
- public void setForm(T f) {
- // remove old
- if (m_form != null) {
- if (m_formListener != null) {
- m_form.removeFormListener(m_formListener);
- }
- }
- m_form = f;
- // add old
- if (m_form != null) {
- if (m_formListener == null) {
- m_formListener = new FormListener() {
- @Override
- public void formChanged(FormEvent e) throws ProcessingException {
- try {
- switch (e.getType()) {
- case FormEvent.TYPE_STORE_AFTER: {
- execFormStored(m_activationCounter > 0);
- break;
- }
- case FormEvent.TYPE_DISCARDED: {
- execFormDiscarded(m_activationCounter > 0);
- break;
- }
- case FormEvent.TYPE_CLOSED: {
- execFormClosed(m_activationCounter > 0);
- break;
- }
- }
- }
- catch (ProcessingException pe) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(pe);
- }
- catch (Throwable t) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Unexpected", t));
- }
- switch (e.getType()) {
- case FormEvent.TYPE_CLOSED: {
- setForm(null);
- break;
- }
- }
- }
- };
- }
- m_form.addFormListener(m_formListener);
- }
- }
-
- @Override
- public IWizard getWizard() {
- return m_wizard;
- }
-
- @Override
- public void setWizardInternal(IWizard w) {
- m_wizard = w;
- }
-
- @Override
- public String getIconId() {
- return propertySupport.getPropertyString(PROP_ICON_ID);
- }
-
- @Override
- public void setIconId(String s) {
- propertySupport.setPropertyString(PROP_ICON_ID, s);
- }
-
- @Override
- public String getTitle() {
- return propertySupport.getPropertyString(PROP_TITLE);
- }
-
- @Override
- public void setTitle(String s) {
- propertySupport.setPropertyString(PROP_TITLE, s);
- }
-
- @Override
- public String getTooltipText() {
- return propertySupport.getPropertyString(PROP_TOOLTIP_TEXT);
- }
-
- @Override
- public void setTooltipText(String s) {
- propertySupport.setPropertyString(PROP_TOOLTIP_TEXT, s);
- }
-
- @Override
- public String getTitleHtml() {
- return propertySupport.getPropertyString(PROP_TITLE_HTML);
- }
-
- @Override
- public void setTitleHtml(String s) {
- propertySupport.setPropertyString(PROP_TITLE_HTML, s);
- }
-
- @Override
- public String getDescriptionHtml() {
- return propertySupport.getPropertyString(PROP_DESCRIPTION_HTML);
- }
-
- @Override
- public void setDescriptionHtml(String s) {
- propertySupport.setPropertyString(PROP_DESCRIPTION_HTML, s);
- }
-
- @Override
- public boolean isEnabled() {
- return propertySupport.getPropertyBool(PROP_ENABLED);
- }
-
- @Override
- public void setEnabled(boolean b) {
- propertySupport.setPropertyBool(PROP_ENABLED, b);
- }
-
- @Override
- public void activate(int stepKind) throws ProcessingException {
- try {
- m_activationCounter++;
- execActivate(stepKind);
- }
- finally {
- m_activationCounter--;
- }
- }
-
- @Override
- public void deactivate(int stepKind) throws ProcessingException {
- try {
- m_activationCounter++;
- execDeactivate(stepKind);
- }
- finally {
- m_activationCounter--;
- }
- }
-
- @Override
- public void dispose() throws ProcessingException {
- try {
- m_activationCounter++;
- execDispose();
- }
- finally {
- m_activationCounter--;
- }
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName() + "[" + getTitle() + "]";
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.wizard;
+
+import java.beans.PropertyChangeListener;
+
+import org.eclipse.scout.commons.annotations.ConfigOperation;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.beans.AbstractPropertyObserver;
+import org.eclipse.scout.commons.beans.IPropertyObserver;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.form.FormEvent;
+import org.eclipse.scout.rt.client.ui.form.FormListener;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
+import org.eclipse.scout.service.SERVICES;
+
+public abstract class AbstractWizardStep<T extends IForm> extends AbstractPropertyObserver implements IWizardStep<T>, IPropertyObserver {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractWizardStep.class);
+
+ private IWizard m_wizard;
+ private T m_form;
+ private FormListener m_formListener;
+ private int m_activationCounter;
+ private boolean m_initialized;
+
+ public AbstractWizardStep() {
+ this(true);
+ }
+
+ public AbstractWizardStep(boolean callInitializer) {
+ if (callInitializer) {
+ callInitializer();
+ }
+ }
+
+ protected void callInitializer() {
+ if (!m_initialized) {
+ initConfig();
+ m_initialized = true;
+ }
+ }
+
+ /*
+ * Configuration
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(10)
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredEnabled() {
+ return true;
+ }
+
+ @ConfigProperty(ConfigProperty.TEXT)
+ @Order(20)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredTitle() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.TEXT)
+ @Order(30)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredTooltipText() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.TEXT)
+ @Order(35)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredTitleHtml() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.TEXT)
+ @Order(38)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredDescriptionHtml() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.ICON_ID)
+ @Order(40)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredIconId() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.DOC)
+ @Order(50)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredDoc() {
+ return null;
+ }
+
+ /**
+ * @param stepKind
+ * any of the STEP_* constants activate this step normally creates a
+ * form, calls {@link IForm#startWizardStep(IWizardStep, Class)} on
+ * the form and places the form inside the wizard
+ * {@link IWizard#setWizardForm(org.eclipse.scout.rt.client.ui.form.IForm)}
+ */
+ @Order(10)
+ @ConfigOperation
+ protected void execActivate(int stepKind) throws ProcessingException {
+ }
+
+ /**
+ * @param stepKind
+ * any of the STEP_* constants deactivate this step
+ */
+ @Order(20)
+ @ConfigOperation
+ protected void execDeactivate(int stepKind) throws ProcessingException {
+ }
+
+ /**
+ * dispose this step The default implementation closes the form at {@link #getForm()}
+ */
+ @Order(30)
+ @ConfigOperation
+ protected void execDispose() throws ProcessingException {
+ T f = getForm();
+ if (f != null) {
+ f.doClose();
+ }
+ }
+
+ /**
+ * When the cached form is stored (it may still be open) this method is
+ * called.
+ *
+ * @param activation
+ * true if this method is called by the wizard itself by {@link IWizardStep#activate(int)},
+ * {@link IWizardStep#deactivate(int)} or {@link IWizardStep#dispose()} The default implementation does
+ * nothing.
+ */
+ @Order(40)
+ @ConfigOperation
+ protected void execFormStored(boolean activation) throws ProcessingException {
+ }
+
+ /**
+ * When the cached form is discarded (save was either not requested or it was
+ * forcedly closed) this method is called.
+ *
+ * @param activation
+ * true if this method is called by the wizard itself by {@link IWizardStep#activate(int)},
+ * {@link IWizardStep#deactivate(int)} or {@link IWizardStep#dispose()} The default implementation does
+ * nothing.
+ */
+ @Order(50)
+ @ConfigOperation
+ protected void execFormDiscarded(boolean activation) throws ProcessingException {
+ }
+
+ /**
+ * When the cached form is closed (after some store and/or a discard
+ * operation) this method is called.
+ *
+ * @param activation
+ * true if this method is called by the wizard itself by {@link IWizardStep#activate(int)},
+ * {@link IWizardStep#deactivate(int)} or {@link IWizardStep#dispose()} The default implementation calls
+ * {@link IWizard#doNextStep()} iff activation=false and form was
+ * saved (formDataChanged=true)
+ */
+ @Order(60)
+ @ConfigOperation
+ protected void execFormClosed(boolean activation) throws ProcessingException {
+ if (!activation) {
+ if (getForm().isFormStored()) {
+ getWizard().doNextStep();
+ }
+ }
+ }
+
+ protected void initConfig() {
+ setTitle(getConfiguredTitle());
+ setTooltipText(getConfiguredTooltipText());
+ setTitleHtml(getConfiguredTitleHtml());
+ setDescriptionHtml(getConfiguredDescriptionHtml());
+ setIconId(getConfiguredIconId());
+ setEnabled(getConfiguredEnabled());
+ }
+
+ /*
+ * Runtime
+ */
+ @Override
+ public void addPropertyChangeListener(PropertyChangeListener listener) {
+ propertySupport.addPropertyChangeListener(listener);
+ }
+
+ @Override
+ public void addPropertyChangeListener(String propName, PropertyChangeListener listener) {
+ propertySupport.addPropertyChangeListener(propName, listener);
+ }
+
+ @Override
+ public void removePropertyChangeListener(PropertyChangeListener listener) {
+ propertySupport.removePropertyChangeListener(listener);
+ }
+
+ @Override
+ public void removePropertyChangeListener(String propName, PropertyChangeListener listener) {
+ propertySupport.removePropertyChangeListener(propName, listener);
+ }
+
+ @Override
+ public T getForm() {
+ return m_form;
+ }
+
+ @Override
+ public void setForm(T f) {
+ // remove old
+ if (m_form != null) {
+ if (m_formListener != null) {
+ m_form.removeFormListener(m_formListener);
+ }
+ }
+ m_form = f;
+ // add old
+ if (m_form != null) {
+ if (m_formListener == null) {
+ m_formListener = new FormListener() {
+ @Override
+ public void formChanged(FormEvent e) throws ProcessingException {
+ try {
+ switch (e.getType()) {
+ case FormEvent.TYPE_STORE_AFTER: {
+ execFormStored(m_activationCounter > 0);
+ break;
+ }
+ case FormEvent.TYPE_DISCARDED: {
+ execFormDiscarded(m_activationCounter > 0);
+ break;
+ }
+ case FormEvent.TYPE_CLOSED: {
+ execFormClosed(m_activationCounter > 0);
+ break;
+ }
+ }
+ }
+ catch (ProcessingException pe) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(pe);
+ }
+ catch (Throwable t) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("Unexpected", t));
+ }
+ switch (e.getType()) {
+ case FormEvent.TYPE_CLOSED: {
+ setForm(null);
+ break;
+ }
+ }
+ }
+ };
+ }
+ m_form.addFormListener(m_formListener);
+ }
+ }
+
+ @Override
+ public IWizard getWizard() {
+ return m_wizard;
+ }
+
+ @Override
+ public void setWizardInternal(IWizard w) {
+ m_wizard = w;
+ }
+
+ @Override
+ public String getIconId() {
+ return propertySupport.getPropertyString(PROP_ICON_ID);
+ }
+
+ @Override
+ public void setIconId(String s) {
+ propertySupport.setPropertyString(PROP_ICON_ID, s);
+ }
+
+ @Override
+ public String getTitle() {
+ return propertySupport.getPropertyString(PROP_TITLE);
+ }
+
+ @Override
+ public void setTitle(String s) {
+ propertySupport.setPropertyString(PROP_TITLE, s);
+ }
+
+ @Override
+ public String getTooltipText() {
+ return propertySupport.getPropertyString(PROP_TOOLTIP_TEXT);
+ }
+
+ @Override
+ public void setTooltipText(String s) {
+ propertySupport.setPropertyString(PROP_TOOLTIP_TEXT, s);
+ }
+
+ @Override
+ public String getTitleHtml() {
+ return propertySupport.getPropertyString(PROP_TITLE_HTML);
+ }
+
+ @Override
+ public void setTitleHtml(String s) {
+ propertySupport.setPropertyString(PROP_TITLE_HTML, s);
+ }
+
+ @Override
+ public String getDescriptionHtml() {
+ return propertySupport.getPropertyString(PROP_DESCRIPTION_HTML);
+ }
+
+ @Override
+ public void setDescriptionHtml(String s) {
+ propertySupport.setPropertyString(PROP_DESCRIPTION_HTML, s);
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return propertySupport.getPropertyBool(PROP_ENABLED);
+ }
+
+ @Override
+ public void setEnabled(boolean b) {
+ propertySupport.setPropertyBool(PROP_ENABLED, b);
+ }
+
+ @Override
+ public void activate(int stepKind) throws ProcessingException {
+ try {
+ m_activationCounter++;
+ execActivate(stepKind);
+ }
+ finally {
+ m_activationCounter--;
+ }
+ }
+
+ @Override
+ public void deactivate(int stepKind) throws ProcessingException {
+ try {
+ m_activationCounter++;
+ execDeactivate(stepKind);
+ }
+ finally {
+ m_activationCounter--;
+ }
+ }
+
+ @Override
+ public void dispose() throws ProcessingException {
+ try {
+ m_activationCounter++;
+ execDispose();
+ }
+ finally {
+ m_activationCounter--;
+ }
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + "[" + getTitle() + "]";
+ }
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/DefaultWizardContainerForm.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/DefaultWizardContainerForm.java
index 2d2f48114e..c9ffbc5bb9 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/DefaultWizardContainerForm.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/DefaultWizardContainerForm.java
@@ -1,416 +1,416 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.wizard;
-
-import java.net.URL;
-
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.action.keystroke.AbstractKeyStroke;
-import org.eclipse.scout.rt.client.ui.form.AbstractFormHandler;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractButton;
-import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
-import org.eclipse.scout.rt.client.ui.form.fields.splitbox.AbstractSplitBox;
-import org.eclipse.scout.rt.client.ui.form.fields.wrappedform.AbstractWrappedFormField;
-import org.eclipse.scout.rt.client.ui.wizard.DefaultWizardContainerForm.MainBox.SplitBox;
-import org.eclipse.scout.rt.client.ui.wizard.DefaultWizardContainerForm.MainBox.SplitBox.ContentBox;
-import org.eclipse.scout.rt.client.ui.wizard.DefaultWizardContainerForm.MainBox.SplitBox.ContentBox.WrappedWizardForm;
-import org.eclipse.scout.rt.client.ui.wizard.DefaultWizardContainerForm.MainBox.SplitBox.StatusField;
-import org.eclipse.scout.rt.client.ui.wizard.DefaultWizardContainerForm.MainBox.WizardCancelButton;
-import org.eclipse.scout.rt.client.ui.wizard.DefaultWizardContainerForm.MainBox.WizardFinishButton;
-import org.eclipse.scout.rt.client.ui.wizard.DefaultWizardContainerForm.MainBox.WizardNextStepButton;
-import org.eclipse.scout.rt.client.ui.wizard.DefaultWizardContainerForm.MainBox.WizardPreviousStepButton;
-import org.eclipse.scout.rt.client.ui.wizard.DefaultWizardContainerForm.MainBox.WizardResetButton;
-import org.eclipse.scout.rt.client.ui.wizard.DefaultWizardContainerForm.MainBox.WizardSuspendButton;
-import org.eclipse.scout.rt.shared.AbstractIcons;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-
-/**
- * <h3>DefaultWizardContainerForm</h3> A container form containing a wizard form
- * area (current step) a status area. see {@link AbstractWizard#execCreateContainerForm()}
- *
- * @since 24.11.2009
- */
-public class DefaultWizardContainerForm extends AbstractWizardContainerForm implements IWizardContainerForm {
-
- public DefaultWizardContainerForm(IWizard w) throws ProcessingException {
- super(w);
- }
-
- public MainBox getMainBox() {
- return getFieldByClass(MainBox.class);
- }
-
- public SplitBox getSplitBox() {
- return getFieldByClass(SplitBox.class);
- }
-
- public ContentBox getContentBox() {
- return getFieldByClass(ContentBox.class);
- }
-
- public WrappedWizardForm getWrappedWizardForm() {
- return getFieldByClass(WrappedWizardForm.class);
- }
-
- public StatusField getStatusField() {
- return getFieldByClass(StatusField.class);
- }
-
- @Override
- public IButton getWizardCancelButton() {
- return getFieldByClass(WizardCancelButton.class);
- }
-
- @Override
- public IButton getWizardSuspendButton() {
- return getFieldByClass(WizardSuspendButton.class);
- }
-
- @Override
- public IButton getWizardResetButton() {
- return getFieldByClass(WizardResetButton.class);
- }
-
- @Override
- public IButton getWizardPreviousStepButton() {
- return getFieldByClass(WizardPreviousStepButton.class);
- }
-
- @Override
- public IButton getWizardNextStepButton() {
- return getFieldByClass(WizardNextStepButton.class);
- }
-
- @Override
- public IButton getWizardFinishButton() {
- return getFieldByClass(WizardFinishButton.class);
- }
-
- @Override
- protected final IForm getInnerWizardForm() {
- return getWrappedWizardForm().getInnerForm();
- }
-
- @Override
- protected final void setInnerWizardForm(IForm form) {
- getWrappedWizardForm().setInnerForm(form);
- }
-
- @Order(10.0f)
- public class MainBox extends AbstractGroupBox {
- @Override
- protected int getConfiguredGridW() {
- return 3;
- }
-
- @Override
- protected int getConfiguredGridH() {
- return 32;
- }
-
- @Override
- protected boolean getConfiguredGridUseUiHeight() {
- return false;
- }
-
- @Override
- protected int getConfiguredGridColumnCount() {
- return 2;
- }
-
- @Order(10.0f)
- public class SplitBox extends AbstractSplitBox {
-
- @Override
- protected int getConfiguredGridH() {
- return 2;
- }
-
- @Override
- protected double getConfiguredSplitterPosition() {
- return 0.75;
- }
-
- @Override
- protected boolean getConfiguredLabelVisible() {
- return false;
- }
-
- @Order(10.0f)
- public class ContentBox extends AbstractGroupBox {
- @Override
- protected int getConfiguredGridW() {
- return 2;
- }
-
- @Override
- protected int getConfiguredGridH() {
- return 6;
- }
-
- @Override
- protected String getConfiguredBorderDecoration() {
- return BORDER_DECORATION_EMPTY;
- }
-
- @Order(10.0f)
- public class WrappedWizardForm extends AbstractWrappedFormField<IForm> {
- @Override
- protected int getConfiguredGridW() {
- return 2;
- }
-
- @Override
- protected int getConfiguredGridH() {
- return 8;
- }
- }
-
- }
-
- @Order(20)
- public class StatusField extends AbstractWizardStatusField {
- @Override
- protected int getConfiguredGridW() {
- return 2;
- }
-
- @Override
- protected int getConfiguredGridH() {
- return 2;
- }
-
- @Override
- protected void execHyperlinkAction(URL url, String path, boolean local) throws ProcessingException {
- if (DefaultWizardContainerForm.this.getWizard() != null) {
- DefaultWizardContainerForm.this.getWizard().doHyperlinkAction(url, path, local);
- }
- else {
- super.execHyperlinkAction(url, path, local);
- }
- }
- }
- }
-
- @Order(10)
- public class WizardCancelButton extends AbstractButton implements IButton {
-
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("WizardCancelButton");
- }
-
- @Override
- protected String getConfiguredTooltipText() {
- return ScoutTexts.get("WizardCancelButtonTooltip");
- }
-
- @Override
- protected boolean getConfiguredVisible() {
- return false;
- }
-
- @Override
- protected int getConfiguredHorizontalAlignment() {
- return -1;
- }
-
- @Override
- protected void execClickAction() throws ProcessingException {
- getWizard().doCancel();
- }
- }
-
- @Order(20)
- public class WizardSuspendButton extends AbstractButton {
-
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("WizardSuspendButton");
- }
-
- @Override
- protected String getConfiguredTooltipText() {
- return ScoutTexts.get("WizardSuspendButtonTooltip");
- }
-
- @Override
- protected boolean getConfiguredVisible() {
- return false;
- }
-
- @Override
- protected int getConfiguredHorizontalAlignment() {
- return -1;
- }
-
- @Override
- protected void execClickAction() throws ProcessingException {
- getWizard().doSuspend();
- }
- }
-
- @Order(25)
- public class WizardResetButton extends AbstractButton implements IButton {
-
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("ResetButton");
- }
-
- @Override
- protected String getConfiguredTooltipText() {
- return ScoutTexts.get("ResetButtonTooltip");
- }
-
- @Override
- protected boolean getConfiguredVisible() {
- return false;
- }
-
- @Override
- protected int getConfiguredHorizontalAlignment() {
- return -1;
- }
-
- @Override
- protected void execClickAction() throws ProcessingException {
- getWizard().doReset();
- }
- }
-
- @Order(30)
- public class WizardPreviousStepButton extends AbstractButton {
-
- @Override
- protected String getConfiguredIconId() {
- return AbstractIcons.WizardBackButton;
- }
-
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("WizardBackButton");
- }
-
- @Override
- protected String getConfiguredTooltipText() {
- return ScoutTexts.get("WizardBackButtonTooltip");
- }
-
- @Override
- protected int getConfiguredHorizontalAlignment() {
- return 1;
- }
-
- @Override
- protected void execClickAction() throws ProcessingException {
- getWizard().doPreviousStep();
- }
- }
-
- @Order(40)
- public class WizardNextStepButton extends AbstractButton {
-
- @Override
- protected String getConfiguredIconId() {
- return AbstractIcons.WizardNextButton;
- }
-
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("WizardNextButton");
- }
-
- @Override
- protected String getConfiguredTooltipText() {
- return ScoutTexts.get("WizardNextButtonTooltip");
- }
-
- @Override
- protected int getConfiguredHorizontalAlignment() {
- return 1;
- }
-
- @Override
- protected void execClickAction() throws ProcessingException {
- getWizard().doNextStep();
- }
- }
-
- @Order(50)
- public class WizardFinishButton extends AbstractButton {
-
- @Override
- protected String getConfiguredLabel() {
- return ScoutTexts.get("WizardFinishButton");
- }
-
- @Override
- protected String getConfiguredTooltipText() {
- return ScoutTexts.get("WizardFinishButtonTooltip");
- }
-
- @Override
- protected int getConfiguredHorizontalAlignment() {
- return 1;
- }
-
- @Override
- protected void execClickAction() throws ProcessingException {
- getWizard().doFinish();
- }
- }
-
- public class EscapeKeyStroke extends AbstractKeyStroke {
- @Override
- protected String getConfiguredKeyStroke() {
- return "escape";
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- handleEscapeKey(false);
- }
- }
-
- public class EnterKeyStroke extends AbstractKeyStroke {
- @Override
- protected String getConfiguredKeyStroke() {
- return "enter";
- }
-
- @Override
- protected void execAction() throws ProcessingException {
- handleEnterKey();
- }
- }
- }
-
- @Override
- public void startWizard() throws ProcessingException {
- startInternal(new WizardHandler());
- }
-
- public class WizardHandler extends AbstractFormHandler {
- @Override
- protected void execLoad() throws ProcessingException {
- if (getWizard() != null) {
- setInnerWizardForm(getWizard().getWizardForm());
- }
- else {
- setInnerWizardForm(null);
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.wizard;
+
+import java.net.URL;
+
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.action.keystroke.AbstractKeyStroke;
+import org.eclipse.scout.rt.client.ui.form.AbstractFormHandler;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractButton;
+import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
+import org.eclipse.scout.rt.client.ui.form.fields.splitbox.AbstractSplitBox;
+import org.eclipse.scout.rt.client.ui.form.fields.wrappedform.AbstractWrappedFormField;
+import org.eclipse.scout.rt.client.ui.wizard.DefaultWizardContainerForm.MainBox.SplitBox;
+import org.eclipse.scout.rt.client.ui.wizard.DefaultWizardContainerForm.MainBox.SplitBox.ContentBox;
+import org.eclipse.scout.rt.client.ui.wizard.DefaultWizardContainerForm.MainBox.SplitBox.ContentBox.WrappedWizardForm;
+import org.eclipse.scout.rt.client.ui.wizard.DefaultWizardContainerForm.MainBox.SplitBox.StatusField;
+import org.eclipse.scout.rt.client.ui.wizard.DefaultWizardContainerForm.MainBox.WizardCancelButton;
+import org.eclipse.scout.rt.client.ui.wizard.DefaultWizardContainerForm.MainBox.WizardFinishButton;
+import org.eclipse.scout.rt.client.ui.wizard.DefaultWizardContainerForm.MainBox.WizardNextStepButton;
+import org.eclipse.scout.rt.client.ui.wizard.DefaultWizardContainerForm.MainBox.WizardPreviousStepButton;
+import org.eclipse.scout.rt.client.ui.wizard.DefaultWizardContainerForm.MainBox.WizardResetButton;
+import org.eclipse.scout.rt.client.ui.wizard.DefaultWizardContainerForm.MainBox.WizardSuspendButton;
+import org.eclipse.scout.rt.shared.AbstractIcons;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+
+/**
+ * <h3>DefaultWizardContainerForm</h3> A container form containing a wizard form
+ * area (current step) a status area. see {@link AbstractWizard#execCreateContainerForm()}
+ *
+ * @since 24.11.2009
+ */
+public class DefaultWizardContainerForm extends AbstractWizardContainerForm implements IWizardContainerForm {
+
+ public DefaultWizardContainerForm(IWizard w) throws ProcessingException {
+ super(w);
+ }
+
+ public MainBox getMainBox() {
+ return getFieldByClass(MainBox.class);
+ }
+
+ public SplitBox getSplitBox() {
+ return getFieldByClass(SplitBox.class);
+ }
+
+ public ContentBox getContentBox() {
+ return getFieldByClass(ContentBox.class);
+ }
+
+ public WrappedWizardForm getWrappedWizardForm() {
+ return getFieldByClass(WrappedWizardForm.class);
+ }
+
+ public StatusField getStatusField() {
+ return getFieldByClass(StatusField.class);
+ }
+
+ @Override
+ public IButton getWizardCancelButton() {
+ return getFieldByClass(WizardCancelButton.class);
+ }
+
+ @Override
+ public IButton getWizardSuspendButton() {
+ return getFieldByClass(WizardSuspendButton.class);
+ }
+
+ @Override
+ public IButton getWizardResetButton() {
+ return getFieldByClass(WizardResetButton.class);
+ }
+
+ @Override
+ public IButton getWizardPreviousStepButton() {
+ return getFieldByClass(WizardPreviousStepButton.class);
+ }
+
+ @Override
+ public IButton getWizardNextStepButton() {
+ return getFieldByClass(WizardNextStepButton.class);
+ }
+
+ @Override
+ public IButton getWizardFinishButton() {
+ return getFieldByClass(WizardFinishButton.class);
+ }
+
+ @Override
+ protected final IForm getInnerWizardForm() {
+ return getWrappedWizardForm().getInnerForm();
+ }
+
+ @Override
+ protected final void setInnerWizardForm(IForm form) {
+ getWrappedWizardForm().setInnerForm(form);
+ }
+
+ @Order(10.0f)
+ public class MainBox extends AbstractGroupBox {
+ @Override
+ protected int getConfiguredGridW() {
+ return 3;
+ }
+
+ @Override
+ protected int getConfiguredGridH() {
+ return 32;
+ }
+
+ @Override
+ protected boolean getConfiguredGridUseUiHeight() {
+ return false;
+ }
+
+ @Override
+ protected int getConfiguredGridColumnCount() {
+ return 2;
+ }
+
+ @Order(10.0f)
+ public class SplitBox extends AbstractSplitBox {
+
+ @Override
+ protected int getConfiguredGridH() {
+ return 2;
+ }
+
+ @Override
+ protected double getConfiguredSplitterPosition() {
+ return 0.75;
+ }
+
+ @Override
+ protected boolean getConfiguredLabelVisible() {
+ return false;
+ }
+
+ @Order(10.0f)
+ public class ContentBox extends AbstractGroupBox {
+ @Override
+ protected int getConfiguredGridW() {
+ return 2;
+ }
+
+ @Override
+ protected int getConfiguredGridH() {
+ return 6;
+ }
+
+ @Override
+ protected String getConfiguredBorderDecoration() {
+ return BORDER_DECORATION_EMPTY;
+ }
+
+ @Order(10.0f)
+ public class WrappedWizardForm extends AbstractWrappedFormField<IForm> {
+ @Override
+ protected int getConfiguredGridW() {
+ return 2;
+ }
+
+ @Override
+ protected int getConfiguredGridH() {
+ return 8;
+ }
+ }
+
+ }
+
+ @Order(20)
+ public class StatusField extends AbstractWizardStatusField {
+ @Override
+ protected int getConfiguredGridW() {
+ return 2;
+ }
+
+ @Override
+ protected int getConfiguredGridH() {
+ return 2;
+ }
+
+ @Override
+ protected void execHyperlinkAction(URL url, String path, boolean local) throws ProcessingException {
+ if (DefaultWizardContainerForm.this.getWizard() != null) {
+ DefaultWizardContainerForm.this.getWizard().doHyperlinkAction(url, path, local);
+ }
+ else {
+ super.execHyperlinkAction(url, path, local);
+ }
+ }
+ }
+ }
+
+ @Order(10)
+ public class WizardCancelButton extends AbstractButton implements IButton {
+
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("WizardCancelButton");
+ }
+
+ @Override
+ protected String getConfiguredTooltipText() {
+ return ScoutTexts.get("WizardCancelButtonTooltip");
+ }
+
+ @Override
+ protected boolean getConfiguredVisible() {
+ return false;
+ }
+
+ @Override
+ protected int getConfiguredHorizontalAlignment() {
+ return -1;
+ }
+
+ @Override
+ protected void execClickAction() throws ProcessingException {
+ getWizard().doCancel();
+ }
+ }
+
+ @Order(20)
+ public class WizardSuspendButton extends AbstractButton {
+
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("WizardSuspendButton");
+ }
+
+ @Override
+ protected String getConfiguredTooltipText() {
+ return ScoutTexts.get("WizardSuspendButtonTooltip");
+ }
+
+ @Override
+ protected boolean getConfiguredVisible() {
+ return false;
+ }
+
+ @Override
+ protected int getConfiguredHorizontalAlignment() {
+ return -1;
+ }
+
+ @Override
+ protected void execClickAction() throws ProcessingException {
+ getWizard().doSuspend();
+ }
+ }
+
+ @Order(25)
+ public class WizardResetButton extends AbstractButton implements IButton {
+
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("ResetButton");
+ }
+
+ @Override
+ protected String getConfiguredTooltipText() {
+ return ScoutTexts.get("ResetButtonTooltip");
+ }
+
+ @Override
+ protected boolean getConfiguredVisible() {
+ return false;
+ }
+
+ @Override
+ protected int getConfiguredHorizontalAlignment() {
+ return -1;
+ }
+
+ @Override
+ protected void execClickAction() throws ProcessingException {
+ getWizard().doReset();
+ }
+ }
+
+ @Order(30)
+ public class WizardPreviousStepButton extends AbstractButton {
+
+ @Override
+ protected String getConfiguredIconId() {
+ return AbstractIcons.WizardBackButton;
+ }
+
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("WizardBackButton");
+ }
+
+ @Override
+ protected String getConfiguredTooltipText() {
+ return ScoutTexts.get("WizardBackButtonTooltip");
+ }
+
+ @Override
+ protected int getConfiguredHorizontalAlignment() {
+ return 1;
+ }
+
+ @Override
+ protected void execClickAction() throws ProcessingException {
+ getWizard().doPreviousStep();
+ }
+ }
+
+ @Order(40)
+ public class WizardNextStepButton extends AbstractButton {
+
+ @Override
+ protected String getConfiguredIconId() {
+ return AbstractIcons.WizardNextButton;
+ }
+
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("WizardNextButton");
+ }
+
+ @Override
+ protected String getConfiguredTooltipText() {
+ return ScoutTexts.get("WizardNextButtonTooltip");
+ }
+
+ @Override
+ protected int getConfiguredHorizontalAlignment() {
+ return 1;
+ }
+
+ @Override
+ protected void execClickAction() throws ProcessingException {
+ getWizard().doNextStep();
+ }
+ }
+
+ @Order(50)
+ public class WizardFinishButton extends AbstractButton {
+
+ @Override
+ protected String getConfiguredLabel() {
+ return ScoutTexts.get("WizardFinishButton");
+ }
+
+ @Override
+ protected String getConfiguredTooltipText() {
+ return ScoutTexts.get("WizardFinishButtonTooltip");
+ }
+
+ @Override
+ protected int getConfiguredHorizontalAlignment() {
+ return 1;
+ }
+
+ @Override
+ protected void execClickAction() throws ProcessingException {
+ getWizard().doFinish();
+ }
+ }
+
+ public class EscapeKeyStroke extends AbstractKeyStroke {
+ @Override
+ protected String getConfiguredKeyStroke() {
+ return "escape";
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ handleEscapeKey(false);
+ }
+ }
+
+ public class EnterKeyStroke extends AbstractKeyStroke {
+ @Override
+ protected String getConfiguredKeyStroke() {
+ return "enter";
+ }
+
+ @Override
+ protected void execAction() throws ProcessingException {
+ handleEnterKey();
+ }
+ }
+ }
+
+ @Override
+ public void startWizard() throws ProcessingException {
+ startInternal(new WizardHandler());
+ }
+
+ public class WizardHandler extends AbstractFormHandler {
+ @Override
+ protected void execLoad() throws ProcessingException {
+ if (getWizard() != null) {
+ setInnerWizardForm(getWizard().getWizardForm());
+ }
+ else {
+ setInnerWizardForm(null);
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/DefaultWizardStatusHtmlProvider.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/DefaultWizardStatusHtmlProvider.java
index c2fa25447b..a375d4f341 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/DefaultWizardStatusHtmlProvider.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/DefaultWizardStatusHtmlProvider.java
@@ -1,190 +1,190 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.wizard;
-
-import java.io.ByteArrayInputStream;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.scout.commons.IOUtility;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.client.services.common.icon.IconSpec;
-import org.eclipse.scout.rt.shared.AbstractIcons;
-import org.eclipse.scout.rt.shared.services.common.file.RemoteFile;
-import org.eclipse.scout.rt.shared.ui.UserAgentUtility;
-
-/**
- *
- */
-public class DefaultWizardStatusHtmlProvider implements IWizardStatusHtmlProvider {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(DefaultWizardStatusHtmlProvider.class);
-
- private String m_htmlTemplate;
-
- /**
- * initialize, load html template and inline images
- */
- @Override
- public void initialize(AbstractWizardStatusField htmlField) throws ProcessingException {
- m_htmlTemplate = initHtmlTemplate();
-
- // collect attachments for HTML field
- List<RemoteFile> attachments = collectAttachments();
- if (attachments != null && attachments.size() > 0) {
- htmlField.setAttachments(attachments.toArray(new RemoteFile[attachments.size()]));
- }
- }
-
- @Override
- public String initHtmlTemplate() throws ProcessingException {
- try {
- return new String(IOUtility.getContent(org.eclipse.scout.rt.client.Activator.getDefault().getBundle().getResource("resources/html/defaultWizardStatus.html").openStream()), "iso-8859-1");
- }
- catch (Throwable t) {
- throw new ProcessingException("Unexpected", t);
- }
- }
-
- @Override
- public String createHtml(IWizard w) throws ProcessingException {
- String html = m_htmlTemplate;
- String topPart = "";
- String bottomPart = "";
- StringBuilder listPart = new StringBuilder();
- if (w != null) {
- if (w.getTooltipText() != null) {
- topPart = "<div class=\"infoBox\">" + StringUtility.nvl(w.getTitleHtml(), w.getTooltipText()) + "</div>";
- }
- if (w.getActiveStep() != null) {
- if (w.getActiveStep().getTooltipText() != null || w.getActiveStep().getDescriptionHtml() != null) {
- bottomPart = "<div class=\"infoBox\">" + StringUtility.nvl(w.getActiveStep().getDescriptionHtml(), w.getActiveStep().getTooltipText()) + "</div>";
- }
- }
- int index = 1;
- for (IWizardStep<?> step : w.getSteps()) {
- String s = createHtmlForStep(step, index, (step == w.getActiveStep()));
- listPart.append(s);
- index++;
- }
- }
- html = html.replace("#FONT_SIZE_UNIT#", UserAgentUtility.getFontSizeUnit());
- html = html.replace("#TOP#", topPart);
- html = html.replace("#LIST#", listPart.toString());
- html = html.replace("#BOTTOM#", bottomPart);
- return html;
- }
-
- /**
- * Adds a step to the HTML document. Uses old school HTML 3.2 with transparent graphics to enforce heights and widths
- * background colors since HTMLEditorToolkit of swing does not support CSS level 2.
- *
- * @param buf
- * @param cssClass
- * @param index
- * @param step
- */
- protected String createHtmlForStep(IWizardStep<?> step, int index, boolean selected) {
- String cssClass;
- if (selected) {
- cssClass = "selected";
- }
- else if (step.isEnabled()) {
- cssClass = "default";
- }
- else {
- cssClass = "disabled";
- }
- StringBuilder buf = new StringBuilder();
- String spacerCssClass = "selected".equals(cssClass) ? "spacerselected" : "spacer";
- appendHtmlForSpacerLine(buf, spacerCssClass, 7, AbstractWizardStatusField.STEP_ANCHOR_IDENTIFIER + index);
- buf.append("<tr class=\"" + cssClass + "\">\n");
- buf.append(" <td width=\"15\"><img src=\"empty.png\" width=\"1\" height=\"30\"></td>\n");
- buf.append(" <td width=\"24\" valign=\"top\" class=\"bullet\" style=\"padding:0px;padding-top:" + (UserAgentUtility.isRichClient() ? "4" : "5") + "px;\">" + index + "</td>\n");
- buf.append(" <td width=\"17\"></td>\n");
- buf.append(" <td style=\"padding-top:2px;\">" + StringUtility.nvl(step.getTitleHtml(), step.getTitle()) + "</td>\n");
- buf.append(" <td width=\"15\"></td>\n");
- buf.append("</tr>\n");
- appendHtmlForSpacerLine(buf, spacerCssClass, 11, null);
- appendHtmlForSpacerLine(buf, "line", 1, null);
- return buf.toString();
- }
-
- protected void appendHtmlForSpacerLine(StringBuilder buf, String cssClass, int height, String anchor) {
- buf.append("<tr class=\"" + cssClass + "\"><td colspan=\"5\">");
- if (!StringUtility.isNullOrEmpty(anchor)) {
- buf.append("<a name=\"" + anchor + "\"/>");
- }
- buf.append("<img src=\"empty.png\" width=\"1\" height=\"" + height + "\"></td></tr>\n");
- }
-
- /**
- * To be overwritten in order to provide custom attachments. <br/>
- * The default implementation provides default icons for
- * wizard steps.
- *
- * @return
- */
- protected List<RemoteFile> collectAttachments() {
- List<RemoteFile> attachments = new LinkedList<RemoteFile>();
-
- loadIcon(attachments, AbstractIcons.Empty + ".png");
- loadIcon(attachments, AbstractIcons.WizardBullet + ".png");
- loadIcon(attachments, AbstractIcons.WizardBullet + "_disabled.png");
- loadIcon(attachments, AbstractIcons.WizardBullet + "_selected.png");
-
- return attachments;
- }
-
- /**
- * To load an icon into the given attachments live list
- *
- * @param attachments
- * @param iconName
- */
- protected void loadIcon(List<RemoteFile> attachments, String iconName) {
- try {
- // determine file format
- int index = iconName.lastIndexOf(".");
- String format = iconName.substring(iconName.lastIndexOf("."));
- // determine icon name
- iconName = iconName.substring(0, iconName.lastIndexOf("."));
- // determine icon base name
- String baseIconName = iconName;
- index = iconName.lastIndexOf("_");
- if (index > 0) {
- baseIconName = iconName.substring(0, index);
- }
-
- // load icon
- IClientSession clientSession = ClientSyncJob.getCurrentSession();
- IconSpec iconSpec = clientSession.getIconLocator().getIconSpec(iconName);
- if (iconSpec == null && !iconName.equals(baseIconName)) {
- iconSpec = clientSession.getIconLocator().getIconSpec(baseIconName);
- }
-
- if (iconSpec != null) {
- RemoteFile iconFile = new RemoteFile(iconName + format, 0);
- ByteArrayInputStream is = new ByteArrayInputStream(iconSpec.getContent());
- iconFile.readData(is);
- is.close();
- attachments.add(iconFile);
- }
- }
- catch (Exception e) {
- LOG.warn("failed to load image for " + AbstractIcons.WizardBullet, e);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.wizard;
+
+import java.io.ByteArrayInputStream;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.scout.commons.IOUtility;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.client.services.common.icon.IconSpec;
+import org.eclipse.scout.rt.shared.AbstractIcons;
+import org.eclipse.scout.rt.shared.services.common.file.RemoteFile;
+import org.eclipse.scout.rt.shared.ui.UserAgentUtility;
+
+/**
+ *
+ */
+public class DefaultWizardStatusHtmlProvider implements IWizardStatusHtmlProvider {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(DefaultWizardStatusHtmlProvider.class);
+
+ private String m_htmlTemplate;
+
+ /**
+ * initialize, load html template and inline images
+ */
+ @Override
+ public void initialize(AbstractWizardStatusField htmlField) throws ProcessingException {
+ m_htmlTemplate = initHtmlTemplate();
+
+ // collect attachments for HTML field
+ List<RemoteFile> attachments = collectAttachments();
+ if (attachments != null && attachments.size() > 0) {
+ htmlField.setAttachments(attachments.toArray(new RemoteFile[attachments.size()]));
+ }
+ }
+
+ @Override
+ public String initHtmlTemplate() throws ProcessingException {
+ try {
+ return new String(IOUtility.getContent(org.eclipse.scout.rt.client.Activator.getDefault().getBundle().getResource("resources/html/defaultWizardStatus.html").openStream()), "iso-8859-1");
+ }
+ catch (Throwable t) {
+ throw new ProcessingException("Unexpected", t);
+ }
+ }
+
+ @Override
+ public String createHtml(IWizard w) throws ProcessingException {
+ String html = m_htmlTemplate;
+ String topPart = "";
+ String bottomPart = "";
+ StringBuilder listPart = new StringBuilder();
+ if (w != null) {
+ if (w.getTooltipText() != null) {
+ topPart = "<div class=\"infoBox\">" + StringUtility.nvl(w.getTitleHtml(), w.getTooltipText()) + "</div>";
+ }
+ if (w.getActiveStep() != null) {
+ if (w.getActiveStep().getTooltipText() != null || w.getActiveStep().getDescriptionHtml() != null) {
+ bottomPart = "<div class=\"infoBox\">" + StringUtility.nvl(w.getActiveStep().getDescriptionHtml(), w.getActiveStep().getTooltipText()) + "</div>";
+ }
+ }
+ int index = 1;
+ for (IWizardStep<?> step : w.getSteps()) {
+ String s = createHtmlForStep(step, index, (step == w.getActiveStep()));
+ listPart.append(s);
+ index++;
+ }
+ }
+ html = html.replace("#FONT_SIZE_UNIT#", UserAgentUtility.getFontSizeUnit());
+ html = html.replace("#TOP#", topPart);
+ html = html.replace("#LIST#", listPart.toString());
+ html = html.replace("#BOTTOM#", bottomPart);
+ return html;
+ }
+
+ /**
+ * Adds a step to the HTML document. Uses old school HTML 3.2 with transparent graphics to enforce heights and widths
+ * background colors since HTMLEditorToolkit of swing does not support CSS level 2.
+ *
+ * @param buf
+ * @param cssClass
+ * @param index
+ * @param step
+ */
+ protected String createHtmlForStep(IWizardStep<?> step, int index, boolean selected) {
+ String cssClass;
+ if (selected) {
+ cssClass = "selected";
+ }
+ else if (step.isEnabled()) {
+ cssClass = "default";
+ }
+ else {
+ cssClass = "disabled";
+ }
+ StringBuilder buf = new StringBuilder();
+ String spacerCssClass = "selected".equals(cssClass) ? "spacerselected" : "spacer";
+ appendHtmlForSpacerLine(buf, spacerCssClass, 7, AbstractWizardStatusField.STEP_ANCHOR_IDENTIFIER + index);
+ buf.append("<tr class=\"" + cssClass + "\">\n");
+ buf.append(" <td width=\"15\"><img src=\"empty.png\" width=\"1\" height=\"30\"></td>\n");
+ buf.append(" <td width=\"24\" valign=\"top\" class=\"bullet\" style=\"padding:0px;padding-top:" + (UserAgentUtility.isRichClient() ? "4" : "5") + "px;\">" + index + "</td>\n");
+ buf.append(" <td width=\"17\"></td>\n");
+ buf.append(" <td style=\"padding-top:2px;\">" + StringUtility.nvl(step.getTitleHtml(), step.getTitle()) + "</td>\n");
+ buf.append(" <td width=\"15\"></td>\n");
+ buf.append("</tr>\n");
+ appendHtmlForSpacerLine(buf, spacerCssClass, 11, null);
+ appendHtmlForSpacerLine(buf, "line", 1, null);
+ return buf.toString();
+ }
+
+ protected void appendHtmlForSpacerLine(StringBuilder buf, String cssClass, int height, String anchor) {
+ buf.append("<tr class=\"" + cssClass + "\"><td colspan=\"5\">");
+ if (!StringUtility.isNullOrEmpty(anchor)) {
+ buf.append("<a name=\"" + anchor + "\"/>");
+ }
+ buf.append("<img src=\"empty.png\" width=\"1\" height=\"" + height + "\"></td></tr>\n");
+ }
+
+ /**
+ * To be overwritten in order to provide custom attachments. <br/>
+ * The default implementation provides default icons for
+ * wizard steps.
+ *
+ * @return
+ */
+ protected List<RemoteFile> collectAttachments() {
+ List<RemoteFile> attachments = new LinkedList<RemoteFile>();
+
+ loadIcon(attachments, AbstractIcons.Empty + ".png");
+ loadIcon(attachments, AbstractIcons.WizardBullet + ".png");
+ loadIcon(attachments, AbstractIcons.WizardBullet + "_disabled.png");
+ loadIcon(attachments, AbstractIcons.WizardBullet + "_selected.png");
+
+ return attachments;
+ }
+
+ /**
+ * To load an icon into the given attachments live list
+ *
+ * @param attachments
+ * @param iconName
+ */
+ protected void loadIcon(List<RemoteFile> attachments, String iconName) {
+ try {
+ // determine file format
+ int index = iconName.lastIndexOf(".");
+ String format = iconName.substring(iconName.lastIndexOf("."));
+ // determine icon name
+ iconName = iconName.substring(0, iconName.lastIndexOf("."));
+ // determine icon base name
+ String baseIconName = iconName;
+ index = iconName.lastIndexOf("_");
+ if (index > 0) {
+ baseIconName = iconName.substring(0, index);
+ }
+
+ // load icon
+ IClientSession clientSession = ClientSyncJob.getCurrentSession();
+ IconSpec iconSpec = clientSession.getIconLocator().getIconSpec(iconName);
+ if (iconSpec == null && !iconName.equals(baseIconName)) {
+ iconSpec = clientSession.getIconLocator().getIconSpec(baseIconName);
+ }
+
+ if (iconSpec != null) {
+ RemoteFile iconFile = new RemoteFile(iconName + format, 0);
+ ByteArrayInputStream is = new ByteArrayInputStream(iconSpec.getContent());
+ iconFile.readData(is);
+ is.close();
+ attachments.add(iconFile);
+ }
+ }
+ catch (Exception e) {
+ LOG.warn("failed to load image for " + AbstractIcons.WizardBullet, e);
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/IWizard.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/IWizard.java
index 6f9403a373..3cfab6fa04 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/IWizard.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/IWizard.java
@@ -1,366 +1,366 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.wizard;
-
-import java.net.URL;
-import java.util.List;
-
-import org.eclipse.scout.commons.beans.IPropertyObserver;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.exception.VetoException;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-
-public interface IWizard extends IPropertyObserver {
-
- static enum CloseType {
- /**
- * wizard is not yet closed so the close state is unknown, see also {@link IWizard#close()},
- * {@link IWizard#isClosed()}, {@link IWizard#getCloseType()}
- */
- Unknown,
- /**
- * wizard was just closed, see also {@link IWizard#close()}, {@link IWizard#isClosed()},
- * {@link IWizard#getCloseType()}
- */
- Closed,
- /**
- * wizard was finished, see also {@link IWizard#doFinish()}, {@link IWizard#isClosed()},
- * {@link IWizard#getCloseType()}
- */
- Finished,
- /**
- * wizard was cancelled, see also {@link IWizard#doCancel()}, {@link IWizard#isClosed()},
- * {@link IWizard#getCloseType()}
- */
- Cancelled,
-
- /**
- * wizard was suspended, see also {@link IWizard#doSuspend()}, {@link IWizard#isClosed()},
- * {@link IWizard#getCloseType()}
- */
- Suspended,
- }
-
- String PROP_TITLE = "title";
- String PROP_TITLE_HTML = "titleHtml";
- String PROP_SUB_TITLE = "subTitle";
- String PROP_TOOLTIP_TEXT = "tooltipText";
- String PROP_ICON_ID = "iconId";
- String PROP_WIZARD_NO = "wizardNo";
- /**
- * {@link IForm}
- */
- String PROP_WIZARD_FORM = "wizardForm";
- /**
- * boolean
- */
- String PROP_CLOSED = "closed";
- /**
- * {@link CloseType}
- */
- String PROP_CLOSE_TYPE = "closeType";
-
- /**
- * Standalone window Swing: modal -> JDialog, nonmodal -> JFrame SWT: modal ->
- * Dialog, nonmodal -> Dialog, Wizard Dialog
- */
- int DISPLAY_HINT_DIALOG = 0;
- /**
- * Inline view Swing: JInternalFrame SWT: View, Editor, , Wizard Editor
- */
- int DISPLAY_HINT_VIEW = 20;
-
- String VIEW_ID_N = "N";
- String VIEW_ID_NE = "NE";
- String VIEW_ID_E = "E";
- String VIEW_ID_SE = "SE";
- String VIEW_ID_S = "S";
- String VIEW_ID_SW = "SW";
- String VIEW_ID_W = "W";
- String VIEW_ID_NW = "NW";
- String VIEW_ID_CENTER = "C";
- String VIEW_ID_OUTLINE = "OUTLINE";
- String VIEW_ID_OUTLINE_SELECTOR = "OUTLINE_SELECTOR";
- String VIEW_ID_PAGE_DETAIL = "PAGE_DETAIL";
- String VIEW_ID_PAGE_SEARCH = "PAGE_SEARCH";
- String VIEW_ID_PAGE_TABLE = "PAGE_TABLE";
-
- String EDITOR_ID = "EDITOR";
-
- void addWizardListener(WizardListener listener);
-
- void removeWizardListener(WizardListener listener);
-
- /**
- * when the wizard is changed (for example the state) all these changes are
- * accumulated and then fired in single events Therefore the whole block is
- * normally inside a try...finally
- *
- * @see IWizard#doNextStep()
- */
- void setChanging(boolean b);
-
- boolean isChanging();
-
- /**
- * use one of the VIEW_ID_ constants or a custom text
- */
- int getDisplayHint();
-
- void setDisplayHint(int i);
-
- String getDisplayViewId();
-
- void setDisplayViewId(String viewId);
-
- boolean isModal();
-
- void setModal(boolean b);
-
- String getTitle();
-
- void setTitle(String s);
-
- String getSubTitle();
-
- void setSubTitle(String s);
-
- String getTitleHtml();
-
- void setTitleHtml(String s);
-
- String getTooltipText();
-
- void setTooltipText(String s);
-
- String getIconId();
-
- void setIconId(String s);
-
- String getWizardNo();
-
- void setWizardNo(String s);
-
- /**
- * No more operations are possible on a closed wizard.
- */
- boolean isClosed();
-
- /**
- * @return the type in which the wizard was closed
- */
- CloseType getCloseType();
-
- /**
- * start the wizard
- */
- void start() throws ProcessingException;
-
- /**
- * @return current wizard form or <code>null</code> if there is no current
- * wizard form.
- */
- IForm getWizardForm();
-
- /**
- * Set current wizard form or <code>null</code> if there is no current wizard
- * form. Use handle
- */
- void setWizardForm(IForm form);
-
- /**
- * Wait until form is closed<br>
- * If the form is modal this method returns just after the modal handler has
- * terminated<br>
- * If the form is non-modal this starts a sub event dispatcher that loops (and
- * blocks) until form handling is false (i.e. form has been closed)
- */
- void waitFor() throws ProcessingException;
-
- int WAIT_FOR_ERROR_CODE = 69218;
-
- /**
- * This method by default calls {@link #execRefreshButtonPolicy()} which is
- * used to make then wizard buttons visible/invisible/enabled/disabled based
- * on the current form and wizard state.
- */
- void refreshButtonPolicy();
-
- /**
- * close wizard (forced suspend)
- */
- void close() throws ProcessingException;
-
- /**
- * @return all available steps, see also {@link #getSteps()}
- */
- List<IWizardStep<? extends IForm>> getAvailableSteps();
-
- /**
- * set all available steps, see also {@link #setSteps(List)}
- */
- void setAvailableSteps(List<IWizardStep<? extends IForm>> steps);
-
- /**
- * @return all steps including history, current, future
- */
- List<IWizardStep<? extends IForm>> getSteps();
-
- /**
- * set the list of active steps
- */
- void setSteps(IWizardStep<? extends IForm>... steps);
-
- /**
- * set the list of active steps
- */
- void setSteps(List<IWizardStep<? extends IForm>> steps);
-
- <T extends IWizardStep<? extends IForm>> T getAvailableStep(Class<T> type);
-
- <T extends IWizardStep<? extends IForm>> T getStep(Class<T> type);
-
- IWizardStep<? extends IForm> getStep(int index);
-
- IWizardStep<? extends IForm> getStepBySimpleClassName(String simpleClassName);
-
- IWizardStep<? extends IForm> getStepByClassName(String className);
-
- int getStepIndex(IWizardStep<? extends IForm> step);
-
- /**
- * Convenience method
- *
- * @return {@link IWizardStep#STEP_NEXT} or {@link IWizardStep#STEP_PREVIOUS} Note: If from or to is null then
- * STEP_NEXT is returned.
- */
- int getStepKind(IWizardStep<? extends IForm> from, IWizardStep<? extends IForm> to);
-
- /**
- * Convenience method
- *
- * @return an array of all steps between from and to
- */
- List<IWizardStep<? extends IForm>> getStepSpan(IWizardStep<? extends IForm> from, boolean includeFrom, IWizardStep<? extends IForm> to, boolean includeTo);
-
- /**
- * Convenience method
- *
- * @return step before active step
- */
- IWizardStep<? extends IForm> getPreviousStep();
-
- /**
- * Convenience method
- *
- * @return step after active step
- */
- IWizardStep<? extends IForm> getNextStep();
-
- /**
- * Convenience method
- *
- * @return first step before active step that is enabled
- */
- IWizardStep<? extends IForm> getPreviousEnabledStep();
-
- /**
- * Convenience method
- *
- * @return first step after active step that is enabled
- */
- IWizardStep<? extends IForm> getNextEnabledStep();
-
- /**
- * Set and activate a new wizard state, throws a {@link VetoException} if the
- * new step could not be activated, for example if the currently active step
- * vetoed in its deactivate() method Detailed: 1. calculate direction of
- * change, either {@link IWizardStep#STEP_NEXT} or {@link IWizardStep#STEP_PREVIOUS} 2. call
- * {@link IWizardStep#deactivate(int)} on the old step if that step exists 3.
- * call {@link IWizardStep#activate(int)} on the new step if that step exists
- * When calling {@link #activateStep(null)} with a null argument it simply
- * calls deactivate on the existing step.
- */
- void activateStep(IWizardStep<? extends IForm> step) throws ProcessingException;
-
- /**
- * set the current wizard state
- *
- * @param jumpForward
- * true simply jumps to the new step, false activates/deactivates
- * every step inbetween the old and the new step
- * @param jumpBackward
- * true simply jumps to the new step, false activates/deactivates
- * every step inbetween the old and the new step The jump parameters
- * are only relevant if the new step is not the direct previous or
- * next step of the old step.
- */
- void activateStep(IWizardStep<? extends IForm> step, boolean jumpForward, boolean jumpBackward) throws ProcessingException;
-
- IWizardStep<? extends IForm> getActiveStep();
-
- /**
- * next step
- */
- void doNextStep() throws ProcessingException;
-
- /**
- * previous step
- */
- void doPreviousStep() throws ProcessingException;
-
- /**
- * finish
- */
- void doFinish() throws ProcessingException;
-
- /**
- * cancel
- */
- void doCancel() throws ProcessingException;
-
- /**
- * suspend
- */
- void doSuspend() throws ProcessingException;
-
- /**
- * reset
- */
- void doReset() throws ProcessingException;
-
- /**
- * This is a delegate methode that is normally called by the wizard status
- * field (html field) in the {@link IWizardContainerForm} whenever a link is
- * clicked.
- *
- * @param url
- * @param path
- * {@link URL#getPath()}
- * @param local
- * true if the url is not a valid external url but a local model url
- * (http://local/...)
- */
- void doHyperlinkAction(URL url, String path, boolean local) throws ProcessingException;
-
- /**
- * The container form is created when it does not exist already. By default
- * the container form is created upon start of the wizard.
- */
- IWizardContainerForm createContainerForm() throws ProcessingException;
-
- IWizardContainerForm getContainerForm();
-
- /**
- * The wizard was started and is active and open
- */
- boolean isOpen();
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.wizard;
+
+import java.net.URL;
+import java.util.List;
+
+import org.eclipse.scout.commons.beans.IPropertyObserver;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.exception.VetoException;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+
+public interface IWizard extends IPropertyObserver {
+
+ static enum CloseType {
+ /**
+ * wizard is not yet closed so the close state is unknown, see also {@link IWizard#close()},
+ * {@link IWizard#isClosed()}, {@link IWizard#getCloseType()}
+ */
+ Unknown,
+ /**
+ * wizard was just closed, see also {@link IWizard#close()}, {@link IWizard#isClosed()},
+ * {@link IWizard#getCloseType()}
+ */
+ Closed,
+ /**
+ * wizard was finished, see also {@link IWizard#doFinish()}, {@link IWizard#isClosed()},
+ * {@link IWizard#getCloseType()}
+ */
+ Finished,
+ /**
+ * wizard was cancelled, see also {@link IWizard#doCancel()}, {@link IWizard#isClosed()},
+ * {@link IWizard#getCloseType()}
+ */
+ Cancelled,
+
+ /**
+ * wizard was suspended, see also {@link IWizard#doSuspend()}, {@link IWizard#isClosed()},
+ * {@link IWizard#getCloseType()}
+ */
+ Suspended,
+ }
+
+ String PROP_TITLE = "title";
+ String PROP_TITLE_HTML = "titleHtml";
+ String PROP_SUB_TITLE = "subTitle";
+ String PROP_TOOLTIP_TEXT = "tooltipText";
+ String PROP_ICON_ID = "iconId";
+ String PROP_WIZARD_NO = "wizardNo";
+ /**
+ * {@link IForm}
+ */
+ String PROP_WIZARD_FORM = "wizardForm";
+ /**
+ * boolean
+ */
+ String PROP_CLOSED = "closed";
+ /**
+ * {@link CloseType}
+ */
+ String PROP_CLOSE_TYPE = "closeType";
+
+ /**
+ * Standalone window Swing: modal -> JDialog, nonmodal -> JFrame SWT: modal ->
+ * Dialog, nonmodal -> Dialog, Wizard Dialog
+ */
+ int DISPLAY_HINT_DIALOG = 0;
+ /**
+ * Inline view Swing: JInternalFrame SWT: View, Editor, , Wizard Editor
+ */
+ int DISPLAY_HINT_VIEW = 20;
+
+ String VIEW_ID_N = "N";
+ String VIEW_ID_NE = "NE";
+ String VIEW_ID_E = "E";
+ String VIEW_ID_SE = "SE";
+ String VIEW_ID_S = "S";
+ String VIEW_ID_SW = "SW";
+ String VIEW_ID_W = "W";
+ String VIEW_ID_NW = "NW";
+ String VIEW_ID_CENTER = "C";
+ String VIEW_ID_OUTLINE = "OUTLINE";
+ String VIEW_ID_OUTLINE_SELECTOR = "OUTLINE_SELECTOR";
+ String VIEW_ID_PAGE_DETAIL = "PAGE_DETAIL";
+ String VIEW_ID_PAGE_SEARCH = "PAGE_SEARCH";
+ String VIEW_ID_PAGE_TABLE = "PAGE_TABLE";
+
+ String EDITOR_ID = "EDITOR";
+
+ void addWizardListener(WizardListener listener);
+
+ void removeWizardListener(WizardListener listener);
+
+ /**
+ * when the wizard is changed (for example the state) all these changes are
+ * accumulated and then fired in single events Therefore the whole block is
+ * normally inside a try...finally
+ *
+ * @see IWizard#doNextStep()
+ */
+ void setChanging(boolean b);
+
+ boolean isChanging();
+
+ /**
+ * use one of the VIEW_ID_ constants or a custom text
+ */
+ int getDisplayHint();
+
+ void setDisplayHint(int i);
+
+ String getDisplayViewId();
+
+ void setDisplayViewId(String viewId);
+
+ boolean isModal();
+
+ void setModal(boolean b);
+
+ String getTitle();
+
+ void setTitle(String s);
+
+ String getSubTitle();
+
+ void setSubTitle(String s);
+
+ String getTitleHtml();
+
+ void setTitleHtml(String s);
+
+ String getTooltipText();
+
+ void setTooltipText(String s);
+
+ String getIconId();
+
+ void setIconId(String s);
+
+ String getWizardNo();
+
+ void setWizardNo(String s);
+
+ /**
+ * No more operations are possible on a closed wizard.
+ */
+ boolean isClosed();
+
+ /**
+ * @return the type in which the wizard was closed
+ */
+ CloseType getCloseType();
+
+ /**
+ * start the wizard
+ */
+ void start() throws ProcessingException;
+
+ /**
+ * @return current wizard form or <code>null</code> if there is no current
+ * wizard form.
+ */
+ IForm getWizardForm();
+
+ /**
+ * Set current wizard form or <code>null</code> if there is no current wizard
+ * form. Use handle
+ */
+ void setWizardForm(IForm form);
+
+ /**
+ * Wait until form is closed<br>
+ * If the form is modal this method returns just after the modal handler has
+ * terminated<br>
+ * If the form is non-modal this starts a sub event dispatcher that loops (and
+ * blocks) until form handling is false (i.e. form has been closed)
+ */
+ void waitFor() throws ProcessingException;
+
+ int WAIT_FOR_ERROR_CODE = 69218;
+
+ /**
+ * This method by default calls {@link #execRefreshButtonPolicy()} which is
+ * used to make then wizard buttons visible/invisible/enabled/disabled based
+ * on the current form and wizard state.
+ */
+ void refreshButtonPolicy();
+
+ /**
+ * close wizard (forced suspend)
+ */
+ void close() throws ProcessingException;
+
+ /**
+ * @return all available steps, see also {@link #getSteps()}
+ */
+ List<IWizardStep<? extends IForm>> getAvailableSteps();
+
+ /**
+ * set all available steps, see also {@link #setSteps(List)}
+ */
+ void setAvailableSteps(List<IWizardStep<? extends IForm>> steps);
+
+ /**
+ * @return all steps including history, current, future
+ */
+ List<IWizardStep<? extends IForm>> getSteps();
+
+ /**
+ * set the list of active steps
+ */
+ void setSteps(IWizardStep<? extends IForm>... steps);
+
+ /**
+ * set the list of active steps
+ */
+ void setSteps(List<IWizardStep<? extends IForm>> steps);
+
+ <T extends IWizardStep<? extends IForm>> T getAvailableStep(Class<T> type);
+
+ <T extends IWizardStep<? extends IForm>> T getStep(Class<T> type);
+
+ IWizardStep<? extends IForm> getStep(int index);
+
+ IWizardStep<? extends IForm> getStepBySimpleClassName(String simpleClassName);
+
+ IWizardStep<? extends IForm> getStepByClassName(String className);
+
+ int getStepIndex(IWizardStep<? extends IForm> step);
+
+ /**
+ * Convenience method
+ *
+ * @return {@link IWizardStep#STEP_NEXT} or {@link IWizardStep#STEP_PREVIOUS} Note: If from or to is null then
+ * STEP_NEXT is returned.
+ */
+ int getStepKind(IWizardStep<? extends IForm> from, IWizardStep<? extends IForm> to);
+
+ /**
+ * Convenience method
+ *
+ * @return an array of all steps between from and to
+ */
+ List<IWizardStep<? extends IForm>> getStepSpan(IWizardStep<? extends IForm> from, boolean includeFrom, IWizardStep<? extends IForm> to, boolean includeTo);
+
+ /**
+ * Convenience method
+ *
+ * @return step before active step
+ */
+ IWizardStep<? extends IForm> getPreviousStep();
+
+ /**
+ * Convenience method
+ *
+ * @return step after active step
+ */
+ IWizardStep<? extends IForm> getNextStep();
+
+ /**
+ * Convenience method
+ *
+ * @return first step before active step that is enabled
+ */
+ IWizardStep<? extends IForm> getPreviousEnabledStep();
+
+ /**
+ * Convenience method
+ *
+ * @return first step after active step that is enabled
+ */
+ IWizardStep<? extends IForm> getNextEnabledStep();
+
+ /**
+ * Set and activate a new wizard state, throws a {@link VetoException} if the
+ * new step could not be activated, for example if the currently active step
+ * vetoed in its deactivate() method Detailed: 1. calculate direction of
+ * change, either {@link IWizardStep#STEP_NEXT} or {@link IWizardStep#STEP_PREVIOUS} 2. call
+ * {@link IWizardStep#deactivate(int)} on the old step if that step exists 3.
+ * call {@link IWizardStep#activate(int)} on the new step if that step exists
+ * When calling {@link #activateStep(null)} with a null argument it simply
+ * calls deactivate on the existing step.
+ */
+ void activateStep(IWizardStep<? extends IForm> step) throws ProcessingException;
+
+ /**
+ * set the current wizard state
+ *
+ * @param jumpForward
+ * true simply jumps to the new step, false activates/deactivates
+ * every step inbetween the old and the new step
+ * @param jumpBackward
+ * true simply jumps to the new step, false activates/deactivates
+ * every step inbetween the old and the new step The jump parameters
+ * are only relevant if the new step is not the direct previous or
+ * next step of the old step.
+ */
+ void activateStep(IWizardStep<? extends IForm> step, boolean jumpForward, boolean jumpBackward) throws ProcessingException;
+
+ IWizardStep<? extends IForm> getActiveStep();
+
+ /**
+ * next step
+ */
+ void doNextStep() throws ProcessingException;
+
+ /**
+ * previous step
+ */
+ void doPreviousStep() throws ProcessingException;
+
+ /**
+ * finish
+ */
+ void doFinish() throws ProcessingException;
+
+ /**
+ * cancel
+ */
+ void doCancel() throws ProcessingException;
+
+ /**
+ * suspend
+ */
+ void doSuspend() throws ProcessingException;
+
+ /**
+ * reset
+ */
+ void doReset() throws ProcessingException;
+
+ /**
+ * This is a delegate methode that is normally called by the wizard status
+ * field (html field) in the {@link IWizardContainerForm} whenever a link is
+ * clicked.
+ *
+ * @param url
+ * @param path
+ * {@link URL#getPath()}
+ * @param local
+ * true if the url is not a valid external url but a local model url
+ * (http://local/...)
+ */
+ void doHyperlinkAction(URL url, String path, boolean local) throws ProcessingException;
+
+ /**
+ * The container form is created when it does not exist already. By default
+ * the container form is created upon start of the wizard.
+ */
+ IWizardContainerForm createContainerForm() throws ProcessingException;
+
+ IWizardContainerForm getContainerForm();
+
+ /**
+ * The wizard was started and is active and open
+ */
+ boolean isOpen();
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/IWizardContainerForm.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/IWizardContainerForm.java
index 25776139ad..6ff60f2d28 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/IWizardContainerForm.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/IWizardContainerForm.java
@@ -1,37 +1,37 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.wizard;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.client.ui.form.IFormHandler;
-import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
-
-public interface IWizardContainerForm extends IForm {
- /**
- * Normally starts the {@link IFormHandler} with the name WizardHandler.
- *
- * @throws ProcessingException
- */
- void startWizard() throws ProcessingException;
-
- IButton getWizardCancelButton();
-
- IButton getWizardSuspendButton();
-
- IButton getWizardPreviousStepButton();
-
- IButton getWizardNextStepButton();
-
- IButton getWizardFinishButton();
-
- IButton getWizardResetButton();
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.wizard;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.client.ui.form.IFormHandler;
+import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
+
+public interface IWizardContainerForm extends IForm {
+ /**
+ * Normally starts the {@link IFormHandler} with the name WizardHandler.
+ *
+ * @throws ProcessingException
+ */
+ void startWizard() throws ProcessingException;
+
+ IButton getWizardCancelButton();
+
+ IButton getWizardSuspendButton();
+
+ IButton getWizardPreviousStepButton();
+
+ IButton getWizardNextStepButton();
+
+ IButton getWizardFinishButton();
+
+ IButton getWizardResetButton();
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/IWizardStatusHtmlProvider.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/IWizardStatusHtmlProvider.java
index f410ab9034..bddd0a8129 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/IWizardStatusHtmlProvider.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/IWizardStatusHtmlProvider.java
@@ -1,44 +1,44 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.wizard;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-
-/**
- * Used by {@link AbstractWizardStatusField} and {@link DefaultWizardContainerForm} to customize html presentation of
- * wizard status content
- */
-public interface IWizardStatusHtmlProvider {
-
- /**
- * initialize, load html template and inline images
- */
- void initialize(AbstractWizardStatusField htmlField) throws ProcessingException;
-
- /**
- * Initialize the HTML template. <br>
- * Template should contain the following placeholders:<br>
- * <ul>
- * <li><b>#TOP#</b>: Wizard titleHtml ({@link IWizard#getTitleHtml()}) or tooltipText (
- * {@link IWizard#getTooltipText()}) will be placed here.</li>
- * <li><b>#FONT_SIZE_UNIT#</b>: Unit for font size calculation will be placed here.</li>
- * <li><b>#LIST#</b>: Step list will be placed here.</li>
- * <li><b>#BOTTOM#</b>: WizardStep descriptionHtml ({@link IWizardStep#getDescriptionHtml()}) or tooltipText (
- * {@link IWizardStep#getTooltipText()}) will be placed here.</li>
- * </ul>
- *
- * @return template HTML file
- */
- String initHtmlTemplate() throws ProcessingException;
-
- String createHtml(IWizard w) throws ProcessingException;
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.wizard;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+
+/**
+ * Used by {@link AbstractWizardStatusField} and {@link DefaultWizardContainerForm} to customize html presentation of
+ * wizard status content
+ */
+public interface IWizardStatusHtmlProvider {
+
+ /**
+ * initialize, load html template and inline images
+ */
+ void initialize(AbstractWizardStatusField htmlField) throws ProcessingException;
+
+ /**
+ * Initialize the HTML template. <br>
+ * Template should contain the following placeholders:<br>
+ * <ul>
+ * <li><b>#TOP#</b>: Wizard titleHtml ({@link IWizard#getTitleHtml()}) or tooltipText (
+ * {@link IWizard#getTooltipText()}) will be placed here.</li>
+ * <li><b>#FONT_SIZE_UNIT#</b>: Unit for font size calculation will be placed here.</li>
+ * <li><b>#LIST#</b>: Step list will be placed here.</li>
+ * <li><b>#BOTTOM#</b>: WizardStep descriptionHtml ({@link IWizardStep#getDescriptionHtml()}) or tooltipText (
+ * {@link IWizardStep#getTooltipText()}) will be placed here.</li>
+ * </ul>
+ *
+ * @return template HTML file
+ */
+ String initHtmlTemplate() throws ProcessingException;
+
+ String createHtml(IWizard w) throws ProcessingException;
+
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/IWizardStep.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/IWizardStep.java
index 14f5539f19..c3085bbd59 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/IWizardStep.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/IWizardStep.java
@@ -1,94 +1,94 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.wizard;
-
-import org.eclipse.scout.commons.beans.IPropertyObserver;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-
-public interface IWizardStep<T extends IForm> extends IPropertyObserver {
-
- String PROP_ENABLED = "enabled";
- String PROP_TITLE = "title";
- String PROP_TOOLTIP_TEXT = "tooltipText";
- String PROP_TITLE_HTML = "titleHtml";
- String PROP_DESCRIPTION_HTML = "descriptionHtml";
- String PROP_ICON_ID = "iconId";
- /**
- * The step was activated by a "next" operation
- */
- int STEP_NEXT = 1;
- /**
- * The step was activated by a "back" operation
- */
- int STEP_PREVIOUS = 2;
-
- IWizard getWizard();
-
- /**
- * Do not call this internal method.
- */
- void setWizardInternal(IWizard w);
-
- String getTitle();
-
- void setTitle(String s);
-
- String getIconId();
-
- void setIconId(String s);
-
- String getTooltipText();
-
- void setTooltipText(String s);
-
- boolean isEnabled();
-
- void setEnabled(boolean b);
-
- String getTitleHtml();
-
- void setTitleHtml(String s);
-
- String getDescriptionHtml();
-
- void setDescriptionHtml(String s);
-
- /**
- * @return the cached for this step or null
- */
- T getForm();
-
- /**
- * cache the form for this step for later usage
- */
- void setForm(T form);
-
- /**
- * @param stepKind
- * any of the STEP_* constants activate this step normally creates a
- * form, calls {@link IForm#startWizardStep(IWizardStep2, Class)} on
- * the form and places the form inside the wizard
- * {@link IWizard#setWizardForm(org.eclipse.scout.rt.client.ui.form.IForm)}
- */
- void activate(int stepKind) throws ProcessingException;
-
- /**
- * @param stepKind
- * any of the STEP_* constants deactivate this step
- */
- void deactivate(int stepKind) throws ProcessingException;
-
- /**
- * dispose this step The default implementation closes the form at {@link #getForm()}
- */
- void dispose() throws ProcessingException;
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.wizard;
+
+import org.eclipse.scout.commons.beans.IPropertyObserver;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+
+public interface IWizardStep<T extends IForm> extends IPropertyObserver {
+
+ String PROP_ENABLED = "enabled";
+ String PROP_TITLE = "title";
+ String PROP_TOOLTIP_TEXT = "tooltipText";
+ String PROP_TITLE_HTML = "titleHtml";
+ String PROP_DESCRIPTION_HTML = "descriptionHtml";
+ String PROP_ICON_ID = "iconId";
+ /**
+ * The step was activated by a "next" operation
+ */
+ int STEP_NEXT = 1;
+ /**
+ * The step was activated by a "back" operation
+ */
+ int STEP_PREVIOUS = 2;
+
+ IWizard getWizard();
+
+ /**
+ * Do not call this internal method.
+ */
+ void setWizardInternal(IWizard w);
+
+ String getTitle();
+
+ void setTitle(String s);
+
+ String getIconId();
+
+ void setIconId(String s);
+
+ String getTooltipText();
+
+ void setTooltipText(String s);
+
+ boolean isEnabled();
+
+ void setEnabled(boolean b);
+
+ String getTitleHtml();
+
+ void setTitleHtml(String s);
+
+ String getDescriptionHtml();
+
+ void setDescriptionHtml(String s);
+
+ /**
+ * @return the cached for this step or null
+ */
+ T getForm();
+
+ /**
+ * cache the form for this step for later usage
+ */
+ void setForm(T form);
+
+ /**
+ * @param stepKind
+ * any of the STEP_* constants activate this step normally creates a
+ * form, calls {@link IForm#startWizardStep(IWizardStep2, Class)} on
+ * the form and places the form inside the wizard
+ * {@link IWizard#setWizardForm(org.eclipse.scout.rt.client.ui.form.IForm)}
+ */
+ void activate(int stepKind) throws ProcessingException;
+
+ /**
+ * @param stepKind
+ * any of the STEP_* constants deactivate this step
+ */
+ void deactivate(int stepKind) throws ProcessingException;
+
+ /**
+ * dispose this step The default implementation closes the form at {@link #getForm()}
+ */
+ void dispose() throws ProcessingException;
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/WizardEvent.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/WizardEvent.java
index 5221af1757..1a029c4136 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/WizardEvent.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/WizardEvent.java
@@ -1,46 +1,46 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.wizard;
-
-import java.util.EventObject;
-
-public class WizardEvent extends EventObject {
- private static final long serialVersionUID = 1L;
-
- /**
- * One or more of the following changes occured (state machine) State
- * transition has occured, next step was activated (but not run) History has
- * changed Expected future has changed
- */
- public static final int TYPE_STATE_CHANGED = 10;
-
- /**
- * Wizard was closed after either finish, cancel, suspend or just by calling {@link IWizard#close()}.
- * <p>
- * Check the {@link IWizard#getCloseType()} for details.
- */
- public static final int TYPE_CLOSED = 50;
-
- private final int m_type;
-
- public WizardEvent(IWizard wizard, int type) {
- super(wizard);
- m_type = type;
- }
-
- public IWizard getWizard() {
- return (IWizard) getSource();
- }
-
- public int getType() {
- return m_type;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.wizard;
+
+import java.util.EventObject;
+
+public class WizardEvent extends EventObject {
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * One or more of the following changes occured (state machine) State
+ * transition has occured, next step was activated (but not run) History has
+ * changed Expected future has changed
+ */
+ public static final int TYPE_STATE_CHANGED = 10;
+
+ /**
+ * Wizard was closed after either finish, cancel, suspend or just by calling {@link IWizard#close()}.
+ * <p>
+ * Check the {@link IWizard#getCloseType()} for details.
+ */
+ public static final int TYPE_CLOSED = 50;
+
+ private final int m_type;
+
+ public WizardEvent(IWizard wizard, int type) {
+ super(wizard);
+ m_type = type;
+ }
+
+ public IWizard getWizard() {
+ return (IWizard) getSource();
+ }
+
+ public int getType() {
+ return m_type;
+ }
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/WizardListener.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/WizardListener.java
index 8002d4d5ad..6a4f9ef7df 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/WizardListener.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/WizardListener.java
@@ -1,18 +1,18 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.wizard;
-
-import java.util.EventListener;
-
-public interface WizardListener extends EventListener {
-
- void wizardChanged(WizardEvent e);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.wizard;
+
+import java.util.EventListener;
+
+public interface WizardListener extends EventListener {
+
+ void wizardChanged(WizardEvent e);
+}
diff --git a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/WrappedWizardWizardStep.java b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/WrappedWizardWizardStep.java
index d478b2fe7d..a32aa72781 100644
--- a/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/WrappedWizardWizardStep.java
+++ b/org.eclipse.scout.rt.client/src/org/eclipse/scout/rt/client/ui/wizard/WrappedWizardWizardStep.java
@@ -1,64 +1,64 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.client.ui.wizard;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
-import org.eclipse.scout.service.SERVICES;
-
-/**
- * Wizard step containing another wizard. This step invokes the parent's <code>doNextStep()</code> method when
- * terminated (i.e. either finished or
- * canceled).
- * vastly reduced amount of automation and allows for much more custom
- * flexibility in handling wizard processes.
- */
-public class WrappedWizardWizardStep extends AbstractWizardStep {
-
- private final IWizard m_parentWizard;
- private final IWizard m_childWizard;
-
- public WrappedWizardWizardStep(IWizard parentWizard, IWizard childWizard) throws ProcessingException {
- super();
- this.m_parentWizard = parentWizard;
- this.m_childWizard = childWizard;
- setTitle(childWizard.getTitle());
- }
-
- @Override
- protected void execActivate(int stepKind) throws ProcessingException {
- m_childWizard.addWizardListener(new WizardListener() {
- @Override
- public void wizardChanged(WizardEvent e) {
- switch (e.getType()) {
- case WizardEvent.TYPE_CLOSED: {
- try {
- m_parentWizard.doNextStep();
- }
- catch (ProcessingException t) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(t);
- }
- break;
- }
- }
- }
- });
- m_childWizard.start();
- }
-
- public IWizard getParentWizard() {
- return m_parentWizard;
- }
-
- public IWizard getChildWizard() {
- return m_childWizard;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.client.ui.wizard;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
+import org.eclipse.scout.service.SERVICES;
+
+/**
+ * Wizard step containing another wizard. This step invokes the parent's <code>doNextStep()</code> method when
+ * terminated (i.e. either finished or
+ * canceled).
+ * vastly reduced amount of automation and allows for much more custom
+ * flexibility in handling wizard processes.
+ */
+public class WrappedWizardWizardStep extends AbstractWizardStep {
+
+ private final IWizard m_parentWizard;
+ private final IWizard m_childWizard;
+
+ public WrappedWizardWizardStep(IWizard parentWizard, IWizard childWizard) throws ProcessingException {
+ super();
+ this.m_parentWizard = parentWizard;
+ this.m_childWizard = childWizard;
+ setTitle(childWizard.getTitle());
+ }
+
+ @Override
+ protected void execActivate(int stepKind) throws ProcessingException {
+ m_childWizard.addWizardListener(new WizardListener() {
+ @Override
+ public void wizardChanged(WizardEvent e) {
+ switch (e.getType()) {
+ case WizardEvent.TYPE_CLOSED: {
+ try {
+ m_parentWizard.doNextStep();
+ }
+ catch (ProcessingException t) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(t);
+ }
+ break;
+ }
+ }
+ }
+ });
+ m_childWizard.start();
+ }
+
+ public IWizard getParentWizard() {
+ return m_parentWizard;
+ }
+
+ public IWizard getChildWizard() {
+ return m_childWizard;
+ }
+}
diff --git a/org.eclipse.scout.rt.extension.client.test.fragment/.settings/org.eclipse.pde.core.prefs b/org.eclipse.scout.rt.extension.client.test.fragment/.settings/org.eclipse.pde.core.prefs
index baef13dd8c..a3a50fc8da 100644
--- a/org.eclipse.scout.rt.extension.client.test.fragment/.settings/org.eclipse.pde.core.prefs
+++ b/org.eclipse.scout.rt.extension.client.test.fragment/.settings/org.eclipse.pde.core.prefs
@@ -1,3 +1,3 @@
-#Mon Jul 11 16:16:00 CEST 2011
-eclipse.preferences.version=1
-pluginProject.extensions=true
+#Mon Jul 11 16:16:00 CEST 2011
+eclipse.preferences.version=1
+pluginProject.extensions=true
diff --git a/org.eclipse.scout.rt.extension.client.test.fragment/fragment.xml b/org.eclipse.scout.rt.extension.client.test.fragment/fragment.xml
index 56c78da39e..4a0d2a4cea 100644
--- a/org.eclipse.scout.rt.extension.client.test.fragment/fragment.xml
+++ b/org.eclipse.scout.rt.extension.client.test.fragment/fragment.xml
@@ -1,156 +1,156 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<fragment>
- <extension
- name="Removals"
- point="org.eclipse.scout.rt.extension.client.pages">
- <pageRemoval
- active="true"
- class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.remove.ARemovePageWithNodes">
- </pageRemoval>
- <pageRemoval
- active="false"
- class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.remove.BRemovePageWithNodes">
- </pageRemoval>
- <pageRemoval
- active="true"
- class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.remove.AbstractCRemovePageWithNodes">
- <filter
- class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.APageFilter">
- </filter>
- <filter
- class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.BPageFilter">
- </filter>
- </pageRemoval>
- <pageRemoval
- active="true"
- class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.remove.C2RemovePageWithNodes">
- <parentPage
- class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.remove.BRemovePageWithNodes">
- </parentPage>
- <filter
- class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.APageFilter">
- </filter>
- <filter
- class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.BPageFilter">
- </filter>
- </pageRemoval>
- <pageRemoval
- active="true"
- class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.remove.BRemovePageWithNodes">
- <outline
- class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.remove.PageRemoveOutline">
- </outline>
- </pageRemoval>
- </extension>
- <extension
- name="Contributions"
- point="org.eclipse.scout.rt.extension.client.pages">
- <pageContribution
- active="true"
- class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.contribution.AContributionPageWithNodes"
- order="5">
- <parentPage
- class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.contribution.PageContributionNodePage">
- </parentPage>
- </pageContribution>
- <pageContribution
- active="true"
- class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.contribution.BContributionPageWithNodes"
- order="15">
- <parentPage
- class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.contribution.PageContributionNodePage">
- </parentPage>
- </pageContribution>
- <pageContribution
- active="false"
- class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.contribution.CContributionPageWithNodes"
- order="20">
- </pageContribution>
- <pageContribution
- active="true"
- class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.contribution.DContributionPageWithNodes"
- order="15">
- <filter
- class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.APageFilter">
- </filter>
- <filter
- class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.BPageFilter">
- </filter>
- <parentPage
- class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.contribution.CContributionPageWithNodes">
- </parentPage>
- </pageContribution>
- <pageContribution
- active="true"
- class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.contribution.AContributionPageWithNodes"
- order="100">
- <outline
- class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.contribution.PageContributionOutline">
- </outline>
- </pageContribution>
- </extension>
- <extension
- name="Modifications"
- point="org.eclipse.scout.rt.extension.client.pages">
- <pageModification
- active="true"
- class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification.MarkingPageModification"
- page="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification.AModificationPageWithNodes">
- <parentPage
- class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification.PageModificationNodePage">
- </parentPage>
- </pageModification>
- <pageModification
- active="false"
- class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification.MarkingPageModification"
- page="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification.BModificationPageWithNodes">
- </pageModification>
- <pageModification
- active="true"
- class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification.MarkingPageModification"
- page="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification.AbstractCModificationPageWithNodes">
- <parentPage
- class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification.PageModificationNodePage">
- </parentPage>
- </pageModification>
- <pageModification
- active="true"
- class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification.MarkingPageModification"
- page="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification.C1ModificationPageWithNodes">
- <parentPage
- class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification.PageModificationNodePage">
- </parentPage>
- <filter
- class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.APageFilter">
- </filter>
- <filter
- class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.BPageFilter">
- </filter>
- </pageModification>
- <pageModification
- active="true"
- class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification.MarkingPageModification"
- page="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification.BModificationPageWithNodes">
- <parentPage
- class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification.PageModificationTablePage">
- </parentPage>
- </pageModification>
- <pageModification
- active="true"
- class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification.MarkingPageModification"
- page="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification.AModificationPageWithNodes">
- <outline
- class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification.PageModificationOutline">
- </outline>
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<fragment>
+ <extension
+ name="Removals"
+ point="org.eclipse.scout.rt.extension.client.pages">
+ <pageRemoval
+ active="true"
+ class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.remove.ARemovePageWithNodes">
+ </pageRemoval>
+ <pageRemoval
+ active="false"
+ class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.remove.BRemovePageWithNodes">
+ </pageRemoval>
+ <pageRemoval
+ active="true"
+ class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.remove.AbstractCRemovePageWithNodes">
+ <filter
+ class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.APageFilter">
+ </filter>
+ <filter
+ class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.BPageFilter">
+ </filter>
+ </pageRemoval>
+ <pageRemoval
+ active="true"
+ class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.remove.C2RemovePageWithNodes">
+ <parentPage
+ class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.remove.BRemovePageWithNodes">
+ </parentPage>
+ <filter
+ class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.APageFilter">
+ </filter>
+ <filter
+ class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.BPageFilter">
+ </filter>
+ </pageRemoval>
+ <pageRemoval
+ active="true"
+ class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.remove.BRemovePageWithNodes">
+ <outline
+ class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.remove.PageRemoveOutline">
+ </outline>
+ </pageRemoval>
+ </extension>
+ <extension
+ name="Contributions"
+ point="org.eclipse.scout.rt.extension.client.pages">
+ <pageContribution
+ active="true"
+ class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.contribution.AContributionPageWithNodes"
+ order="5">
+ <parentPage
+ class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.contribution.PageContributionNodePage">
+ </parentPage>
+ </pageContribution>
+ <pageContribution
+ active="true"
+ class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.contribution.BContributionPageWithNodes"
+ order="15">
+ <parentPage
+ class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.contribution.PageContributionNodePage">
+ </parentPage>
+ </pageContribution>
+ <pageContribution
+ active="false"
+ class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.contribution.CContributionPageWithNodes"
+ order="20">
+ </pageContribution>
+ <pageContribution
+ active="true"
+ class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.contribution.DContributionPageWithNodes"
+ order="15">
+ <filter
+ class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.APageFilter">
+ </filter>
+ <filter
+ class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.BPageFilter">
+ </filter>
+ <parentPage
+ class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.contribution.CContributionPageWithNodes">
+ </parentPage>
+ </pageContribution>
+ <pageContribution
+ active="true"
+ class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.contribution.AContributionPageWithNodes"
+ order="100">
+ <outline
+ class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.contribution.PageContributionOutline">
+ </outline>
+ </pageContribution>
+ </extension>
+ <extension
+ name="Modifications"
+ point="org.eclipse.scout.rt.extension.client.pages">
+ <pageModification
+ active="true"
+ class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification.MarkingPageModification"
+ page="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification.AModificationPageWithNodes">
+ <parentPage
+ class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification.PageModificationNodePage">
+ </parentPage>
+ </pageModification>
+ <pageModification
+ active="false"
+ class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification.MarkingPageModification"
+ page="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification.BModificationPageWithNodes">
+ </pageModification>
+ <pageModification
+ active="true"
+ class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification.MarkingPageModification"
+ page="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification.AbstractCModificationPageWithNodes">
+ <parentPage
+ class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification.PageModificationNodePage">
+ </parentPage>
+ </pageModification>
+ <pageModification
+ active="true"
+ class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification.MarkingPageModification"
+ page="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification.C1ModificationPageWithNodes">
+ <parentPage
+ class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification.PageModificationNodePage">
+ </parentPage>
+ <filter
+ class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.APageFilter">
+ </filter>
+ <filter
+ class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.BPageFilter">
+ </filter>
</pageModification>
- <pageModification
- active="true"
- class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification.MarkingPageModification"
- page="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification.AbstractCModificationPageWithNodes">
- <outline
- class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification.PageModificationOutline">
- </outline>
+ <pageModification
+ active="true"
+ class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification.MarkingPageModification"
+ page="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification.BModificationPageWithNodes">
+ <parentPage
+ class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification.PageModificationTablePage">
+ </parentPage>
+ </pageModification>
+ <pageModification
+ active="true"
+ class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification.MarkingPageModification"
+ page="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification.AModificationPageWithNodes">
+ <outline
+ class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification.PageModificationOutline">
+ </outline>
+ </pageModification>
+ <pageModification
+ active="true"
+ class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification.MarkingPageModification"
+ page="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification.AbstractCModificationPageWithNodes">
+ <outline
+ class="org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification.PageModificationOutline">
+ </outline>
</pageModification>
</extension>
-</fragment>
+</fragment>
diff --git a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/EnclosingObjectFixture.java b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/EnclosingObjectFixture.java
index 8ce7a564c3..5652d7f27c 100644
--- a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/EnclosingObjectFixture.java
+++ b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/EnclosingObjectFixture.java
@@ -1,86 +1,86 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client;
-
-/**
- * Class providing some test scenarios for {@link ExtensionUtility#getEnclosingObject(Object)}.
- *
- * @since 3.9.0
- */
-public class EnclosingObjectFixture {
-
- public static class StaticInnerClass {
-
- public InnerStaticInnerClass createInner() {
- return new InnerStaticInnerClass();
- }
-
- public class InnerStaticInnerClass {
-
- public InnerInnerStaticInnerClass createInner() {
- return new InnerInnerStaticInnerClass();
- }
-
- public class InnerInnerStaticInnerClass {
-
- public InnerInnerInnerStaticInnerClass createInner() {
- return new InnerInnerInnerStaticInnerClass();
- }
-
- public class InnerInnerInnerStaticInnerClass {
- }
- }
- }
- }
-
- public InnerClass createInner() {
- return new InnerClass();
- }
-
- public class InnerClass {
- public InnerInnerClass createInner() {
- return new InnerInnerClass();
- }
-
- public class InnerInnerClass {
-
- public InnerInnerInnerClass createInner() {
- return new InnerInnerInnerClass();
- }
-
- public class InnerInnerInnerClass {
-
- public InnerInnerInnerInnerClass createInner() {
- return new InnerInnerInnerInnerClass();
- }
-
- public class InnerInnerInnerInnerClass {
- }
- }
- }
- }
-
- public static class StaticPathInnerClass {
-
- public static class InnerStaticPathInnerClass {
-
- public static class InnerInnerStaticPathInnerClass {
-
- public InnerInnerInnerStaticPathInnerClass createInner() {
- return new InnerInnerInnerStaticPathInnerClass();
- }
-
- public class InnerInnerInnerStaticPathInnerClass {
- }
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client;
+
+/**
+ * Class providing some test scenarios for {@link ExtensionUtility#getEnclosingObject(Object)}.
+ *
+ * @since 3.9.0
+ */
+public class EnclosingObjectFixture {
+
+ public static class StaticInnerClass {
+
+ public InnerStaticInnerClass createInner() {
+ return new InnerStaticInnerClass();
+ }
+
+ public class InnerStaticInnerClass {
+
+ public InnerInnerStaticInnerClass createInner() {
+ return new InnerInnerStaticInnerClass();
+ }
+
+ public class InnerInnerStaticInnerClass {
+
+ public InnerInnerInnerStaticInnerClass createInner() {
+ return new InnerInnerInnerStaticInnerClass();
+ }
+
+ public class InnerInnerInnerStaticInnerClass {
+ }
+ }
+ }
+ }
+
+ public InnerClass createInner() {
+ return new InnerClass();
+ }
+
+ public class InnerClass {
+ public InnerInnerClass createInner() {
+ return new InnerInnerClass();
+ }
+
+ public class InnerInnerClass {
+
+ public InnerInnerInnerClass createInner() {
+ return new InnerInnerInnerClass();
+ }
+
+ public class InnerInnerInnerClass {
+
+ public InnerInnerInnerInnerClass createInner() {
+ return new InnerInnerInnerInnerClass();
+ }
+
+ public class InnerInnerInnerInnerClass {
+ }
+ }
+ }
+ }
+
+ public static class StaticPathInnerClass {
+
+ public static class InnerStaticPathInnerClass {
+
+ public static class InnerInnerStaticPathInnerClass {
+
+ public InnerInnerInnerStaticPathInnerClass createInner() {
+ return new InnerInnerInnerStaticPathInnerClass();
+ }
+
+ public class InnerInnerInnerStaticPathInnerClass {
+ }
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/internal/CompositeExtensionFilterTest.java b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/internal/CompositeExtensionFilterTest.java
index 17cb04dafb..47bbb29243 100644
--- a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/internal/CompositeExtensionFilterTest.java
+++ b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/internal/CompositeExtensionFilterTest.java
@@ -1,58 +1,58 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.internal;
-
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Test;
-
-/**
- * @since 3.9.0
- */
-public class CompositeExtensionFilterTest {
-
- @Test
- public void testEmpty() {
- P_StringCompositeExtensionFilter filter = new P_StringCompositeExtensionFilter();
- assertTrue(filter.isEmpty());
- assertEquals(0, filter.size());
- assertArrayEquals(new String[0], filter.getFilters());
- }
-
- @Test
- public void testModifications() {
- P_StringCompositeExtensionFilter filter = new P_StringCompositeExtensionFilter();
- assertTrue(filter.addFilter("test"));
- assertFalse(filter.isEmpty());
- assertEquals(1, filter.size());
- //
- assertFalse(filter.addFilter(null));
- assertFalse(filter.isEmpty());
- assertEquals(1, filter.size());
- assertArrayEquals(new String[]{"test"}, filter.getFilters());
- //
- assertTrue(filter.addFilterAtBegin("other"));
- assertFalse(filter.isEmpty());
- assertEquals(2, filter.size());
- assertArrayEquals(new String[]{"other", "test"}, filter.getFilters());
- //
- assertTrue(filter.removeFilter("test"));
- assertFalse(filter.isEmpty());
- assertEquals(1, filter.size());
- assertArrayEquals(new String[]{"other"}, filter.getFilters());
- }
-
- private static class P_StringCompositeExtensionFilter extends AbstractCompositeExtensionFilter<String> {
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.internal;
+
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+/**
+ * @since 3.9.0
+ */
+public class CompositeExtensionFilterTest {
+
+ @Test
+ public void testEmpty() {
+ P_StringCompositeExtensionFilter filter = new P_StringCompositeExtensionFilter();
+ assertTrue(filter.isEmpty());
+ assertEquals(0, filter.size());
+ assertArrayEquals(new String[0], filter.getFilters());
+ }
+
+ @Test
+ public void testModifications() {
+ P_StringCompositeExtensionFilter filter = new P_StringCompositeExtensionFilter();
+ assertTrue(filter.addFilter("test"));
+ assertFalse(filter.isEmpty());
+ assertEquals(1, filter.size());
+ //
+ assertFalse(filter.addFilter(null));
+ assertFalse(filter.isEmpty());
+ assertEquals(1, filter.size());
+ assertArrayEquals(new String[]{"test"}, filter.getFilters());
+ //
+ assertTrue(filter.addFilterAtBegin("other"));
+ assertFalse(filter.isEmpty());
+ assertEquals(2, filter.size());
+ assertArrayEquals(new String[]{"other", "test"}, filter.getFilters());
+ //
+ assertTrue(filter.removeFilter("test"));
+ assertFalse(filter.isEmpty());
+ assertEquals(1, filter.size());
+ assertArrayEquals(new String[]{"other"}, filter.getFilters());
+ }
+
+ private static class P_StringCompositeExtensionFilter extends AbstractCompositeExtensionFilter<String> {
+ }
+}
diff --git a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/action/menu/CompositeMenuFilterTest.java b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/action/menu/CompositeMenuFilterTest.java
index a6ddb624fb..75ef1119da 100644
--- a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/action/menu/CompositeMenuFilterTest.java
+++ b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/action/menu/CompositeMenuFilterTest.java
@@ -1,95 +1,95 @@
-package org.eclipse.scout.rt.extension.client.ui.action.menu;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.junit.Test;
-
-/**
- * @since 3.9.0
- */
-public class CompositeMenuFilterTest {
-
- @Test
- public void testAcceptNullAndEmpty() {
- assertAccept(new CompositeMenuFilter());
- assertAccept(new CompositeMenuFilter((IMenuExtensionFilter[]) null));
- assertAccept(new CompositeMenuFilter((IMenuExtensionFilter) null));
- assertAccept(new CompositeMenuFilter(null, null));
- }
-
- @Test
- public void testAllAccepting() {
- assertAccept(new CompositeMenuFilter(new P_AcceptingFilter()));
- assertAccept(new CompositeMenuFilter(new P_AcceptingFilter(), new P_AcceptingFilter()));
- assertAccept(new CompositeMenuFilter(new P_AcceptingFilter(), null));
- assertAccept(new CompositeMenuFilter(new P_AcceptingFilter(), null, new P_AcceptingFilter()));
- }
-
- @Test
- public void testReject() {
- assertReject(new CompositeMenuFilter(new P_RejectingFilter()));
- assertReject(new CompositeMenuFilter(new P_AcceptingFilter(), new P_RejectingFilter()));
- assertReject(new CompositeMenuFilter(new P_AcceptingFilter(), null, new P_RejectingFilter()));
- assertReject(new CompositeMenuFilter(new P_RejectingFilter(), new P_RejectingFilter()));
- }
-
- @Test
- public void testAddRemoveFilter() {
- CompositeMenuFilter filter = new CompositeMenuFilter();
- assertAccept(filter);
- assertTrue(filter.isEmpty());
- //
- P_AcceptingFilter acceptFilter = new P_AcceptingFilter();
- filter.addFilter(acceptFilter);
- assertAccept(filter);
- assertFalse(filter.isEmpty());
- //
- P_RejectingFilter rejectFilter = new P_RejectingFilter();
- filter.addFilter(rejectFilter);
- assertReject(filter);
- assertFalse(filter.isEmpty());
- //
- filter.removeFilter(rejectFilter);
- assertAccept(filter);
- assertFalse(filter.isEmpty());
- //
- filter.addFilterAtBegin(rejectFilter);
- assertReject(filter);
- assertFalse(filter.isEmpty());
- //
- filter.removeFilter(rejectFilter);
- assertAccept(filter);
- assertFalse(filter.isEmpty());
- //
- filter.removeFilter(acceptFilter);
- assertAccept(filter);
- assertTrue(filter.isEmpty());
- }
-
- /*
- * test support
- */
- private void assertAccept(CompositeMenuFilter filter) {
- assertTrue(filter.accept(null, null, null));
- }
-
- private void assertReject(CompositeMenuFilter filter) {
- assertFalse(filter.accept(null, null, null));
- }
-
- public static class P_AcceptingFilter implements IMenuExtensionFilter {
- @Override
- public boolean accept(Object anchor, Object container, IMenu menu) {
- return true;
- }
- }
-
- public static class P_RejectingFilter implements IMenuExtensionFilter {
- @Override
- public boolean accept(Object anchor, Object container, IMenu menu) {
- return false;
- }
- }
-}
+package org.eclipse.scout.rt.extension.client.ui.action.menu;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.junit.Test;
+
+/**
+ * @since 3.9.0
+ */
+public class CompositeMenuFilterTest {
+
+ @Test
+ public void testAcceptNullAndEmpty() {
+ assertAccept(new CompositeMenuFilter());
+ assertAccept(new CompositeMenuFilter((IMenuExtensionFilter[]) null));
+ assertAccept(new CompositeMenuFilter((IMenuExtensionFilter) null));
+ assertAccept(new CompositeMenuFilter(null, null));
+ }
+
+ @Test
+ public void testAllAccepting() {
+ assertAccept(new CompositeMenuFilter(new P_AcceptingFilter()));
+ assertAccept(new CompositeMenuFilter(new P_AcceptingFilter(), new P_AcceptingFilter()));
+ assertAccept(new CompositeMenuFilter(new P_AcceptingFilter(), null));
+ assertAccept(new CompositeMenuFilter(new P_AcceptingFilter(), null, new P_AcceptingFilter()));
+ }
+
+ @Test
+ public void testReject() {
+ assertReject(new CompositeMenuFilter(new P_RejectingFilter()));
+ assertReject(new CompositeMenuFilter(new P_AcceptingFilter(), new P_RejectingFilter()));
+ assertReject(new CompositeMenuFilter(new P_AcceptingFilter(), null, new P_RejectingFilter()));
+ assertReject(new CompositeMenuFilter(new P_RejectingFilter(), new P_RejectingFilter()));
+ }
+
+ @Test
+ public void testAddRemoveFilter() {
+ CompositeMenuFilter filter = new CompositeMenuFilter();
+ assertAccept(filter);
+ assertTrue(filter.isEmpty());
+ //
+ P_AcceptingFilter acceptFilter = new P_AcceptingFilter();
+ filter.addFilter(acceptFilter);
+ assertAccept(filter);
+ assertFalse(filter.isEmpty());
+ //
+ P_RejectingFilter rejectFilter = new P_RejectingFilter();
+ filter.addFilter(rejectFilter);
+ assertReject(filter);
+ assertFalse(filter.isEmpty());
+ //
+ filter.removeFilter(rejectFilter);
+ assertAccept(filter);
+ assertFalse(filter.isEmpty());
+ //
+ filter.addFilterAtBegin(rejectFilter);
+ assertReject(filter);
+ assertFalse(filter.isEmpty());
+ //
+ filter.removeFilter(rejectFilter);
+ assertAccept(filter);
+ assertFalse(filter.isEmpty());
+ //
+ filter.removeFilter(acceptFilter);
+ assertAccept(filter);
+ assertTrue(filter.isEmpty());
+ }
+
+ /*
+ * test support
+ */
+ private void assertAccept(CompositeMenuFilter filter) {
+ assertTrue(filter.accept(null, null, null));
+ }
+
+ private void assertReject(CompositeMenuFilter filter) {
+ assertFalse(filter.accept(null, null, null));
+ }
+
+ public static class P_AcceptingFilter implements IMenuExtensionFilter {
+ @Override
+ public boolean accept(Object anchor, Object container, IMenu menu) {
+ return true;
+ }
+ }
+
+ public static class P_RejectingFilter implements IMenuExtensionFilter {
+ @Override
+ public boolean accept(Object anchor, Object container, IMenu menu) {
+ return false;
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/action/menu/internal/MenuAnchorFilterTest.java b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/action/menu/internal/MenuAnchorFilterTest.java
index 75d7f9facf..4a6b6b552b 100644
--- a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/action/menu/internal/MenuAnchorFilterTest.java
+++ b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/action/menu/internal/MenuAnchorFilterTest.java
@@ -1,94 +1,94 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.action.menu.internal;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.AbstractPageWithNodes;
-import org.junit.Test;
-
-/**
- * @since 3.9.0
- */
-public class MenuAnchorFilterTest {
-
- @Test
- public void testAcceptNullAnchorClass() {
- MenuAnchorFilter filter = new MenuAnchorFilter(null);
- assertFalse(filter.accept(null, null, null));
- assertFalse(filter.accept(new Object(), null, null));
- assertFalse(filter.accept(null, new Object(), null));
- assertTrue(filter.accept(new Object(), new Object(), null));
- }
-
- @Test
- public void testAcceptAnchorMenu() {
- MenuAnchorFilter filter = new MenuAnchorFilter(P_AnchorMenu.class);
- assertFalse(filter.accept(new Object(), new Object(), null));
- //
- Object anchorAndContainerMenu = new P_AnchorMenu();
- assertTrue(filter.accept(anchorAndContainerMenu, anchorAndContainerMenu, null));
- assertTrue(filter.accept(anchorAndContainerMenu, anchorAndContainerMenu, null));
- //
- Object wrongAnchorMenu = new P_OtherAnchorMenu();
- assertFalse(filter.accept(wrongAnchorMenu, wrongAnchorMenu, null));
- assertTrue(filter.accept(anchorAndContainerMenu, wrongAnchorMenu, null));
- }
-
- @Test
- public void testAcceptAnchorNodePage() {
- MenuAnchorFilter filter = new MenuAnchorFilter(P_AnchorPage.class);
- assertFalse(filter.accept(new Object(), new Object(), null));
- //
- Object anchorAndContainerNodePage = new P_AnchorPage();
- assertTrue(filter.accept(anchorAndContainerNodePage, anchorAndContainerNodePage, null));
- assertTrue(filter.accept(anchorAndContainerNodePage, anchorAndContainerNodePage, null));
- //
- Object wrongAnchorNodePage = new P_OtherAnchorPage();
- assertFalse(filter.accept(wrongAnchorNodePage, wrongAnchorNodePage, null));
- assertTrue(filter.accept(anchorAndContainerNodePage, wrongAnchorNodePage, null));
- }
-
- @Test
- public void testAcceptPolymorphAnchor() {
- MenuAnchorFilter filter = new MenuAnchorFilter(P_AbstractPolymorphAnchorPage.class);
- Object p1 = new P_PolymorphAnchorPage1();
- assertTrue(filter.accept(p1, p1, null));
- assertTrue(filter.accept(p1, p1, null));
- //
- Object p2 = new P_PolymorphAnchorPage2();
- assertTrue(filter.accept(p2, p2, null));
- assertTrue(filter.accept(p1, p2, null));
- }
-
- private static class P_AnchorMenu extends AbstractMenu {
- }
-
- private static class P_OtherAnchorMenu extends AbstractMenu {
- }
-
- private static class P_AnchorPage extends AbstractPageWithNodes {
- }
-
- private static class P_OtherAnchorPage extends AbstractPageWithNodes {
- }
-
- private abstract static class P_AbstractPolymorphAnchorPage extends AbstractPageWithNodes {
- }
-
- private static class P_PolymorphAnchorPage1 extends P_AbstractPolymorphAnchorPage {
- }
-
- private static class P_PolymorphAnchorPage2 extends P_AbstractPolymorphAnchorPage {
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.action.menu.internal;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.AbstractPageWithNodes;
+import org.junit.Test;
+
+/**
+ * @since 3.9.0
+ */
+public class MenuAnchorFilterTest {
+
+ @Test
+ public void testAcceptNullAnchorClass() {
+ MenuAnchorFilter filter = new MenuAnchorFilter(null);
+ assertFalse(filter.accept(null, null, null));
+ assertFalse(filter.accept(new Object(), null, null));
+ assertFalse(filter.accept(null, new Object(), null));
+ assertTrue(filter.accept(new Object(), new Object(), null));
+ }
+
+ @Test
+ public void testAcceptAnchorMenu() {
+ MenuAnchorFilter filter = new MenuAnchorFilter(P_AnchorMenu.class);
+ assertFalse(filter.accept(new Object(), new Object(), null));
+ //
+ Object anchorAndContainerMenu = new P_AnchorMenu();
+ assertTrue(filter.accept(anchorAndContainerMenu, anchorAndContainerMenu, null));
+ assertTrue(filter.accept(anchorAndContainerMenu, anchorAndContainerMenu, null));
+ //
+ Object wrongAnchorMenu = new P_OtherAnchorMenu();
+ assertFalse(filter.accept(wrongAnchorMenu, wrongAnchorMenu, null));
+ assertTrue(filter.accept(anchorAndContainerMenu, wrongAnchorMenu, null));
+ }
+
+ @Test
+ public void testAcceptAnchorNodePage() {
+ MenuAnchorFilter filter = new MenuAnchorFilter(P_AnchorPage.class);
+ assertFalse(filter.accept(new Object(), new Object(), null));
+ //
+ Object anchorAndContainerNodePage = new P_AnchorPage();
+ assertTrue(filter.accept(anchorAndContainerNodePage, anchorAndContainerNodePage, null));
+ assertTrue(filter.accept(anchorAndContainerNodePage, anchorAndContainerNodePage, null));
+ //
+ Object wrongAnchorNodePage = new P_OtherAnchorPage();
+ assertFalse(filter.accept(wrongAnchorNodePage, wrongAnchorNodePage, null));
+ assertTrue(filter.accept(anchorAndContainerNodePage, wrongAnchorNodePage, null));
+ }
+
+ @Test
+ public void testAcceptPolymorphAnchor() {
+ MenuAnchorFilter filter = new MenuAnchorFilter(P_AbstractPolymorphAnchorPage.class);
+ Object p1 = new P_PolymorphAnchorPage1();
+ assertTrue(filter.accept(p1, p1, null));
+ assertTrue(filter.accept(p1, p1, null));
+ //
+ Object p2 = new P_PolymorphAnchorPage2();
+ assertTrue(filter.accept(p2, p2, null));
+ assertTrue(filter.accept(p1, p2, null));
+ }
+
+ private static class P_AnchorMenu extends AbstractMenu {
+ }
+
+ private static class P_OtherAnchorMenu extends AbstractMenu {
+ }
+
+ private static class P_AnchorPage extends AbstractPageWithNodes {
+ }
+
+ private static class P_OtherAnchorPage extends AbstractPageWithNodes {
+ }
+
+ private abstract static class P_AbstractPolymorphAnchorPage extends AbstractPageWithNodes {
+ }
+
+ private static class P_PolymorphAnchorPage1 extends P_AbstractPolymorphAnchorPage {
+ }
+
+ private static class P_PolymorphAnchorPage2 extends P_AbstractPolymorphAnchorPage {
+ }
+}
diff --git a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/action/menu/internal/MenuContributionExtensionTest.java b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/action/menu/internal/MenuContributionExtensionTest.java
index 39535ba97c..4a4d5cbc68 100644
--- a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/action/menu/internal/MenuContributionExtensionTest.java
+++ b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/action/menu/internal/MenuContributionExtensionTest.java
@@ -1,194 +1,194 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.action.menu.internal;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.lang.reflect.Field;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.basic.calendar.AbstractCalendar;
-import org.eclipse.scout.rt.client.ui.basic.calendar.provider.AbstractCalendarItemProvider;
-import org.eclipse.scout.rt.client.ui.basic.calendar.provider.ICalendarItemProvider;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.AbstractPageWithNodes;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.client.ui.form.fields.calendarfield.AbstractCalendarField;
-import org.eclipse.scout.rt.extension.client.ui.action.menu.internal.MenuContributionExtensionTest.P_CalendarField.Calendar;
-import org.eclipse.scout.rt.extension.client.ui.action.menu.internal.MenuContributionExtensionTest.P_TestMenu.Constructor;
-import org.eclipse.scout.testing.client.runner.ScoutClientTestRunner;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-/**
- * @since 3.9.0
- */
-@RunWith(ScoutClientTestRunner.class)
-public class MenuContributionExtensionTest {
-
- @Test
- public void testOrder() {
- MenuContributionExtension extension = new MenuContributionExtension(P_TestMenu.class, null, 100d);
- assertEquals(100, extension.getOrder(), 0);
- //
- extension = new MenuContributionExtension(P_TestMenu.class, null, null);
- assertEquals(Double.MAX_VALUE, extension.getOrder(), 0);
- }
-
- @Test
- public void testCreateContributionNull() throws Exception {
- MenuContributionExtension extension = new MenuContributionExtension(P_TestMenu.class, null, 100d);
- try {
- extension.createContribution(null, null);
- fail("null anchor and container should not be supported");
- }
- catch (Exception e) {
- }
- try {
- extension.createContribution(new P_AnchorNodePage(), null);
- fail("null container should not be supported");
- }
- catch (Exception e) {
- }
- try {
- extension.createContribution(null, new P_AnchorNodePage());
- fail("null container should not be supported");
- }
- catch (Exception e) {
- }
- }
-
- @Test
- public void testCreateContributionAnchorAndContainerSame() throws Exception {
- MenuContributionExtension extension = new MenuContributionExtension(P_TestMenu.class, null, 100d);
- assertCreateContribution(Constructor.AnchorNodePage, extension, new P_AnchorNodePage());
- assertCreateContribution(Constructor.Page, extension, new P_OtherPage());
- assertCreateContribution(Constructor.Object, extension, "Test");
- assertCreateContribution(Constructor.Field, extension, new P_CalendarField());
- //
- extension = new MenuContributionExtension(P_OtherTestMenu.class, null, 100d);
- P_AnchorNodePage page = new P_AnchorNodePage();
- IMenu menu = extension.createContribution(page, page);
- assertNotNull(menu);
- }
-
- @Test
- public void testCreateContributionAnchorAndContainerDifferent() throws Exception {
- MenuContributionExtension extension = new MenuContributionExtension(P_TestMenu.class, null, 100d);
- P_CalendarField calendarField = new P_CalendarField();
- Calendar calendar = calendarField.getCalendar();
- assertCreateContribution(Constructor.CalendarFieldCalendar, extension, calendarField, calendar);
- //
- Field field = AbstractCalendar.class.getDeclaredField("m_providers");
- assertNotNull(field);
- field.setAccessible(true);
- ICalendarItemProvider[] providers = (ICalendarItemProvider[]) field.get(calendar);
- assertNotNull(providers);
- assertTrue(providers.length == 1);
- assertCreateContribution(Constructor.CalendarFieldCalendarItemProvider, extension, calendarField, providers[0]);
- }
-
- private void assertCreateContribution(Constructor expectedConstructor, MenuContributionExtension extension, Object anchor) throws ProcessingException {
- assertCreateContribution(expectedConstructor, extension, anchor, anchor);
- }
-
- private void assertCreateContribution(Constructor expectedConstructor, MenuContributionExtension extension, Object anchor, Object container) throws ProcessingException {
- IMenu menu = extension.createContribution(anchor, container);
- assertTrue(menu instanceof P_TestMenu);
- assertEquals(expectedConstructor, ((P_TestMenu) menu).m_constructor);
- }
-
- public static class P_TestMenu extends AbstractMenu {
-
- public enum Constructor {
- Default,
- Field,
- CalendarFieldCalendar,
- CalendarFieldCalendarItemProvider,
- AnchorNodePage,
- Page,
- Object,
- Invalid
- }
-
- private final Constructor m_constructor;
-
- public Constructor getConstructor() {
- return m_constructor;
- }
-
- public P_TestMenu() {
- m_constructor = Constructor.Default;
- }
-
- public P_TestMenu(P_CalendarField field) {
- m_constructor = Constructor.Field;
- }
-
- public P_TestMenu(P_CalendarField field, P_CalendarField.Calendar calendar) {
- m_constructor = Constructor.CalendarFieldCalendar;
- }
-
- public P_TestMenu(P_CalendarField field, P_CalendarField.Calendar.CalendarItemProvider itemProvider) {
- m_constructor = Constructor.CalendarFieldCalendarItemProvider;
- }
-
- public P_TestMenu(P_AnchorNodePage page) {
- m_constructor = Constructor.AnchorNodePage;
- }
-
- public P_TestMenu(P_AnchorNodePage page, Object o) {
- m_constructor = Constructor.Invalid;
- }
-
- public P_TestMenu(IPage page) {
- m_constructor = Constructor.Page;
- }
-
- public P_TestMenu(IPage page, Object o) {
- m_constructor = Constructor.Invalid;
- }
-
- public P_TestMenu(Object obj) {
- m_constructor = Constructor.Object;
- }
-
- public P_TestMenu(Object o1, Object o2) {
- m_constructor = Constructor.Invalid;
- }
- }
-
- public static class P_OtherTestMenu extends AbstractMenu {
-
- public P_OtherTestMenu(P_AnchorNodePage page, Object container) {
- }
- }
-
- public static class P_AnchorNodePage extends AbstractPageWithNodes {
- }
-
- public static class P_OtherPage extends AbstractPageWithNodes {
- }
-
- public static class P_CalendarField extends AbstractCalendarField<P_CalendarField.Calendar> {
-
- public class Calendar extends AbstractCalendar {
-
- public class CalendarItemProvider extends AbstractCalendarItemProvider {
-
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.action.menu.internal;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.lang.reflect.Field;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.basic.calendar.AbstractCalendar;
+import org.eclipse.scout.rt.client.ui.basic.calendar.provider.AbstractCalendarItemProvider;
+import org.eclipse.scout.rt.client.ui.basic.calendar.provider.ICalendarItemProvider;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.AbstractPageWithNodes;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.client.ui.form.fields.calendarfield.AbstractCalendarField;
+import org.eclipse.scout.rt.extension.client.ui.action.menu.internal.MenuContributionExtensionTest.P_CalendarField.Calendar;
+import org.eclipse.scout.rt.extension.client.ui.action.menu.internal.MenuContributionExtensionTest.P_TestMenu.Constructor;
+import org.eclipse.scout.testing.client.runner.ScoutClientTestRunner;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * @since 3.9.0
+ */
+@RunWith(ScoutClientTestRunner.class)
+public class MenuContributionExtensionTest {
+
+ @Test
+ public void testOrder() {
+ MenuContributionExtension extension = new MenuContributionExtension(P_TestMenu.class, null, 100d);
+ assertEquals(100, extension.getOrder(), 0);
+ //
+ extension = new MenuContributionExtension(P_TestMenu.class, null, null);
+ assertEquals(Double.MAX_VALUE, extension.getOrder(), 0);
+ }
+
+ @Test
+ public void testCreateContributionNull() throws Exception {
+ MenuContributionExtension extension = new MenuContributionExtension(P_TestMenu.class, null, 100d);
+ try {
+ extension.createContribution(null, null);
+ fail("null anchor and container should not be supported");
+ }
+ catch (Exception e) {
+ }
+ try {
+ extension.createContribution(new P_AnchorNodePage(), null);
+ fail("null container should not be supported");
+ }
+ catch (Exception e) {
+ }
+ try {
+ extension.createContribution(null, new P_AnchorNodePage());
+ fail("null container should not be supported");
+ }
+ catch (Exception e) {
+ }
+ }
+
+ @Test
+ public void testCreateContributionAnchorAndContainerSame() throws Exception {
+ MenuContributionExtension extension = new MenuContributionExtension(P_TestMenu.class, null, 100d);
+ assertCreateContribution(Constructor.AnchorNodePage, extension, new P_AnchorNodePage());
+ assertCreateContribution(Constructor.Page, extension, new P_OtherPage());
+ assertCreateContribution(Constructor.Object, extension, "Test");
+ assertCreateContribution(Constructor.Field, extension, new P_CalendarField());
+ //
+ extension = new MenuContributionExtension(P_OtherTestMenu.class, null, 100d);
+ P_AnchorNodePage page = new P_AnchorNodePage();
+ IMenu menu = extension.createContribution(page, page);
+ assertNotNull(menu);
+ }
+
+ @Test
+ public void testCreateContributionAnchorAndContainerDifferent() throws Exception {
+ MenuContributionExtension extension = new MenuContributionExtension(P_TestMenu.class, null, 100d);
+ P_CalendarField calendarField = new P_CalendarField();
+ Calendar calendar = calendarField.getCalendar();
+ assertCreateContribution(Constructor.CalendarFieldCalendar, extension, calendarField, calendar);
+ //
+ Field field = AbstractCalendar.class.getDeclaredField("m_providers");
+ assertNotNull(field);
+ field.setAccessible(true);
+ ICalendarItemProvider[] providers = (ICalendarItemProvider[]) field.get(calendar);
+ assertNotNull(providers);
+ assertTrue(providers.length == 1);
+ assertCreateContribution(Constructor.CalendarFieldCalendarItemProvider, extension, calendarField, providers[0]);
+ }
+
+ private void assertCreateContribution(Constructor expectedConstructor, MenuContributionExtension extension, Object anchor) throws ProcessingException {
+ assertCreateContribution(expectedConstructor, extension, anchor, anchor);
+ }
+
+ private void assertCreateContribution(Constructor expectedConstructor, MenuContributionExtension extension, Object anchor, Object container) throws ProcessingException {
+ IMenu menu = extension.createContribution(anchor, container);
+ assertTrue(menu instanceof P_TestMenu);
+ assertEquals(expectedConstructor, ((P_TestMenu) menu).m_constructor);
+ }
+
+ public static class P_TestMenu extends AbstractMenu {
+
+ public enum Constructor {
+ Default,
+ Field,
+ CalendarFieldCalendar,
+ CalendarFieldCalendarItemProvider,
+ AnchorNodePage,
+ Page,
+ Object,
+ Invalid
+ }
+
+ private final Constructor m_constructor;
+
+ public Constructor getConstructor() {
+ return m_constructor;
+ }
+
+ public P_TestMenu() {
+ m_constructor = Constructor.Default;
+ }
+
+ public P_TestMenu(P_CalendarField field) {
+ m_constructor = Constructor.Field;
+ }
+
+ public P_TestMenu(P_CalendarField field, P_CalendarField.Calendar calendar) {
+ m_constructor = Constructor.CalendarFieldCalendar;
+ }
+
+ public P_TestMenu(P_CalendarField field, P_CalendarField.Calendar.CalendarItemProvider itemProvider) {
+ m_constructor = Constructor.CalendarFieldCalendarItemProvider;
+ }
+
+ public P_TestMenu(P_AnchorNodePage page) {
+ m_constructor = Constructor.AnchorNodePage;
+ }
+
+ public P_TestMenu(P_AnchorNodePage page, Object o) {
+ m_constructor = Constructor.Invalid;
+ }
+
+ public P_TestMenu(IPage page) {
+ m_constructor = Constructor.Page;
+ }
+
+ public P_TestMenu(IPage page, Object o) {
+ m_constructor = Constructor.Invalid;
+ }
+
+ public P_TestMenu(Object obj) {
+ m_constructor = Constructor.Object;
+ }
+
+ public P_TestMenu(Object o1, Object o2) {
+ m_constructor = Constructor.Invalid;
+ }
+ }
+
+ public static class P_OtherTestMenu extends AbstractMenu {
+
+ public P_OtherTestMenu(P_AnchorNodePage page, Object container) {
+ }
+ }
+
+ public static class P_AnchorNodePage extends AbstractPageWithNodes {
+ }
+
+ public static class P_OtherPage extends AbstractPageWithNodes {
+ }
+
+ public static class P_CalendarField extends AbstractCalendarField<P_CalendarField.Calendar> {
+
+ public class Calendar extends AbstractCalendar {
+
+ public class CalendarItemProvider extends AbstractCalendarItemProvider {
+
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/action/menu/internal/MenuExtensionTest.java b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/action/menu/internal/MenuExtensionTest.java
index 07c0d2dda3..9fdb86157f 100644
--- a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/action/menu/internal/MenuExtensionTest.java
+++ b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/action/menu/internal/MenuExtensionTest.java
@@ -1,74 +1,74 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.action.menu.internal;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.extension.client.ui.action.menu.IMenuExtensionFilter;
-import org.junit.Test;
-
-/**
- * Test cases for {@link AbstractMenuExtension}.
- * <p/>
- * <b>Note</b>: This class must not be called <em>Abstract</em>MenuExtensionTest because the JUnit test case browser
- * ignores classes starting with <em>Abstract</em>.
- *
- * @since 3.9.0
- */
-public class MenuExtensionTest {
-
- @Test
- public void testAcceptWithoutFilter() {
- P_MenuExtension menuExtension = new P_MenuExtension(P_Menu.class, null);
- assertFalse(menuExtension.accept(null, null, null));
- assertFalse(menuExtension.accept(new Object(), null, null));
- assertFalse(menuExtension.accept(null, new Object(), null));
- assertTrue(menuExtension.accept(new Object(), new Object(), null));
- }
-
- @Test
- public void testAcceptWithAcceptFilter() {
- P_MenuExtension menuExtension = new P_MenuExtension(P_Menu.class, new P_AcceptingMenuExtensionFilter());
- assertTrue(menuExtension.accept(new Object(), new Object(), null));
- }
-
- @Test
- public void testAcceptWithRejectFilter() {
- P_MenuExtension menuExtension = new P_MenuExtension(P_Menu.class, new P_RejectingMenuExtensionFilter());
- assertFalse(menuExtension.accept(new Object(), new Object(), null));
- }
-
- private static class P_MenuExtension extends AbstractMenuExtension {
- public P_MenuExtension(Class<? extends IMenu> menuClass, IMenuExtensionFilter filter) {
- super(menuClass, filter);
- }
- }
-
- private static class P_AcceptingMenuExtensionFilter implements IMenuExtensionFilter {
- @Override
- public boolean accept(Object anchor, Object container, IMenu menu) {
- return true;
- }
- }
-
- private static class P_RejectingMenuExtensionFilter implements IMenuExtensionFilter {
- @Override
- public boolean accept(Object anchor, Object container, IMenu menu) {
- return false;
- }
- }
-
- private static class P_Menu extends AbstractMenu {
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.action.menu.internal;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.extension.client.ui.action.menu.IMenuExtensionFilter;
+import org.junit.Test;
+
+/**
+ * Test cases for {@link AbstractMenuExtension}.
+ * <p/>
+ * <b>Note</b>: This class must not be called <em>Abstract</em>MenuExtensionTest because the JUnit test case browser
+ * ignores classes starting with <em>Abstract</em>.
+ *
+ * @since 3.9.0
+ */
+public class MenuExtensionTest {
+
+ @Test
+ public void testAcceptWithoutFilter() {
+ P_MenuExtension menuExtension = new P_MenuExtension(P_Menu.class, null);
+ assertFalse(menuExtension.accept(null, null, null));
+ assertFalse(menuExtension.accept(new Object(), null, null));
+ assertFalse(menuExtension.accept(null, new Object(), null));
+ assertTrue(menuExtension.accept(new Object(), new Object(), null));
+ }
+
+ @Test
+ public void testAcceptWithAcceptFilter() {
+ P_MenuExtension menuExtension = new P_MenuExtension(P_Menu.class, new P_AcceptingMenuExtensionFilter());
+ assertTrue(menuExtension.accept(new Object(), new Object(), null));
+ }
+
+ @Test
+ public void testAcceptWithRejectFilter() {
+ P_MenuExtension menuExtension = new P_MenuExtension(P_Menu.class, new P_RejectingMenuExtensionFilter());
+ assertFalse(menuExtension.accept(new Object(), new Object(), null));
+ }
+
+ private static class P_MenuExtension extends AbstractMenuExtension {
+ public P_MenuExtension(Class<? extends IMenu> menuClass, IMenuExtensionFilter filter) {
+ super(menuClass, filter);
+ }
+ }
+
+ private static class P_AcceptingMenuExtensionFilter implements IMenuExtensionFilter {
+ @Override
+ public boolean accept(Object anchor, Object container, IMenu menu) {
+ return true;
+ }
+ }
+
+ private static class P_RejectingMenuExtensionFilter implements IMenuExtensionFilter {
+ @Override
+ public boolean accept(Object anchor, Object container, IMenu menu) {
+ return false;
+ }
+ }
+
+ private static class P_Menu extends AbstractMenu {
+ }
+}
diff --git a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/basic/table/ExtensibleTableTest.java b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/basic/table/ExtensibleTableTest.java
index 900538cffd..7b5d39328e 100644
--- a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/basic/table/ExtensibleTableTest.java
+++ b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/basic/table/ExtensibleTableTest.java
@@ -1,77 +1,77 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.basic.table;
-
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
-
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.extension.client.Replace;
-import org.junit.Test;
-
-/**
- * @since 3.9.0
- */
-public class ExtensibleTableTest {
-
- @Test
- public void testGetDefaultMenu() {
- P_ExtensibleTableWithDefaultMenu table = new P_ExtensibleTableWithDefaultMenu();
- assertSame(P_ExtensibleTableWithDefaultMenu.DefaultMenu.class, table.getDefaultMenuInternal());
- }
-
- @Test
- public void testGetReplacedDefaultMenu() {
- P_ExtensibleTableWithReplacedDefaultMenu table = new P_ExtensibleTableWithReplacedDefaultMenu();
- assertSame(P_ExtensibleTableWithDefaultMenu.DefaultMenu.class, table.getConfiguredDefaultMenu());
- assertSame(P_ExtensibleTableWithReplacedDefaultMenu.ExtendedMenu.class, table.getDefaultMenuInternal());
- }
-
- @Test
- public void testGetReplacedDefaultMenuNotExtendingConfiguredDefaultMenu() {
- P_ExtensibleTableWithReplacedDefaultMenuNotExtending table = new P_ExtensibleTableWithReplacedDefaultMenuNotExtending();
- assertSame(P_ExtensibleTableWithDefaultMenu.DefaultMenu.class, table.getConfiguredDefaultMenu());
- assertNull(table.getDefaultMenuInternal());
- }
-
- private static class P_ExtensibleTableWithDefaultMenu extends AbstractExtensibleTable {
-
- @Override
- protected Class<? extends IMenu> getConfiguredDefaultMenu() {
- return DefaultMenu.class;
- }
-
- @Order(10)
- public class DefaultMenu extends AbstractMenu {
-
- }
- }
-
- private static class P_ExtensibleTableWithReplacedDefaultMenu extends P_ExtensibleTableWithDefaultMenu {
-
- @Order(10)
- @Replace
- public class ExtendedMenu extends DefaultMenu {
-
- }
- }
-
- private static class P_ExtensibleTableWithReplacedDefaultMenuNotExtending extends P_ExtensibleTableWithDefaultMenu {
-
- @Order(10)
- @Replace(P_ExtensibleTableWithDefaultMenu.DefaultMenu.class)
- public class ExtendedMenu extends AbstractMenu {
-
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.basic.table;
+
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.extension.client.Replace;
+import org.junit.Test;
+
+/**
+ * @since 3.9.0
+ */
+public class ExtensibleTableTest {
+
+ @Test
+ public void testGetDefaultMenu() {
+ P_ExtensibleTableWithDefaultMenu table = new P_ExtensibleTableWithDefaultMenu();
+ assertSame(P_ExtensibleTableWithDefaultMenu.DefaultMenu.class, table.getDefaultMenuInternal());
+ }
+
+ @Test
+ public void testGetReplacedDefaultMenu() {
+ P_ExtensibleTableWithReplacedDefaultMenu table = new P_ExtensibleTableWithReplacedDefaultMenu();
+ assertSame(P_ExtensibleTableWithDefaultMenu.DefaultMenu.class, table.getConfiguredDefaultMenu());
+ assertSame(P_ExtensibleTableWithReplacedDefaultMenu.ExtendedMenu.class, table.getDefaultMenuInternal());
+ }
+
+ @Test
+ public void testGetReplacedDefaultMenuNotExtendingConfiguredDefaultMenu() {
+ P_ExtensibleTableWithReplacedDefaultMenuNotExtending table = new P_ExtensibleTableWithReplacedDefaultMenuNotExtending();
+ assertSame(P_ExtensibleTableWithDefaultMenu.DefaultMenu.class, table.getConfiguredDefaultMenu());
+ assertNull(table.getDefaultMenuInternal());
+ }
+
+ private static class P_ExtensibleTableWithDefaultMenu extends AbstractExtensibleTable {
+
+ @Override
+ protected Class<? extends IMenu> getConfiguredDefaultMenu() {
+ return DefaultMenu.class;
+ }
+
+ @Order(10)
+ public class DefaultMenu extends AbstractMenu {
+
+ }
+ }
+
+ private static class P_ExtensibleTableWithReplacedDefaultMenu extends P_ExtensibleTableWithDefaultMenu {
+
+ @Order(10)
+ @Replace
+ public class ExtendedMenu extends DefaultMenu {
+
+ }
+ }
+
+ private static class P_ExtensibleTableWithReplacedDefaultMenuNotExtending extends P_ExtensibleTableWithDefaultMenu {
+
+ @Order(10)
+ @Replace(P_ExtensibleTableWithDefaultMenu.DefaultMenu.class)
+ public class ExtendedMenu extends AbstractMenu {
+
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/CompositePageFilterTest.java b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/CompositePageFilterTest.java
index ea7520d911..23d794309b 100644
--- a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/CompositePageFilterTest.java
+++ b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/CompositePageFilterTest.java
@@ -1,106 +1,106 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.junit.Test;
-
-/**
- * @since 3.9.0
- */
-public class CompositePageFilterTest {
-
- @Test
- public void testNullAndEmpty() {
- assertAccept(new CompositePageFilter());
- assertAccept(new CompositePageFilter((IPageExtensionFilter[]) null));
- assertAccept(new CompositePageFilter((IPageExtensionFilter) null));
- assertAccept(new CompositePageFilter(null, null));
- }
-
- @Test
- public void testAllAccepting() {
- assertAccept(new CompositePageFilter(new P_AcceptingFilter()));
- assertAccept(new CompositePageFilter(new P_AcceptingFilter(), new P_AcceptingFilter()));
- assertAccept(new CompositePageFilter(new P_AcceptingFilter(), null));
- assertAccept(new CompositePageFilter(new P_AcceptingFilter(), null, new P_AcceptingFilter()));
- }
-
- @Test
- public void testReject() {
- assertReject(new CompositePageFilter(new P_RejectingFilter()));
- assertReject(new CompositePageFilter(new P_AcceptingFilter(), new P_RejectingFilter()));
- assertReject(new CompositePageFilter(new P_AcceptingFilter(), null, new P_RejectingFilter()));
- assertReject(new CompositePageFilter(new P_RejectingFilter(), new P_RejectingFilter()));
- }
-
- @Test
- public void testAddRemoveFilter() {
- CompositePageFilter filter = new CompositePageFilter();
- assertAccept(filter);
- assertTrue(filter.isEmpty());
- //
- P_AcceptingFilter acceptFilter = new P_AcceptingFilter();
- filter.addFilter(acceptFilter);
- assertAccept(filter);
- assertFalse(filter.isEmpty());
- //
- P_RejectingFilter rejectFilter = new P_RejectingFilter();
- filter.addFilter(rejectFilter);
- assertReject(filter);
- assertFalse(filter.isEmpty());
- //
- filter.removeFilter(rejectFilter);
- assertAccept(filter);
- assertFalse(filter.isEmpty());
- //
- filter.addFilterAtBegin(rejectFilter);
- assertReject(filter);
- assertFalse(filter.isEmpty());
- //
- filter.removeFilter(rejectFilter);
- assertAccept(filter);
- assertFalse(filter.isEmpty());
- //
- filter.removeFilter(acceptFilter);
- assertAccept(filter);
- assertTrue(filter.isEmpty());
- }
-
- /*
- * test support
- */
- private void assertAccept(CompositePageFilter filter) {
- assertTrue(filter.accept(null, null, null));
- }
-
- private void assertReject(CompositePageFilter filter) {
- assertFalse(filter.accept(null, null, null));
- }
-
- public static class P_AcceptingFilter implements IPageExtensionFilter {
- @Override
- public boolean accept(IOutline outline, IPage parentPage, IPage affectedPage) {
- return true;
- }
- }
-
- public static class P_RejectingFilter implements IPageExtensionFilter {
- @Override
- public boolean accept(IOutline outline, IPage parentPage, IPage affectedPage) {
- return false;
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.junit.Test;
+
+/**
+ * @since 3.9.0
+ */
+public class CompositePageFilterTest {
+
+ @Test
+ public void testNullAndEmpty() {
+ assertAccept(new CompositePageFilter());
+ assertAccept(new CompositePageFilter((IPageExtensionFilter[]) null));
+ assertAccept(new CompositePageFilter((IPageExtensionFilter) null));
+ assertAccept(new CompositePageFilter(null, null));
+ }
+
+ @Test
+ public void testAllAccepting() {
+ assertAccept(new CompositePageFilter(new P_AcceptingFilter()));
+ assertAccept(new CompositePageFilter(new P_AcceptingFilter(), new P_AcceptingFilter()));
+ assertAccept(new CompositePageFilter(new P_AcceptingFilter(), null));
+ assertAccept(new CompositePageFilter(new P_AcceptingFilter(), null, new P_AcceptingFilter()));
+ }
+
+ @Test
+ public void testReject() {
+ assertReject(new CompositePageFilter(new P_RejectingFilter()));
+ assertReject(new CompositePageFilter(new P_AcceptingFilter(), new P_RejectingFilter()));
+ assertReject(new CompositePageFilter(new P_AcceptingFilter(), null, new P_RejectingFilter()));
+ assertReject(new CompositePageFilter(new P_RejectingFilter(), new P_RejectingFilter()));
+ }
+
+ @Test
+ public void testAddRemoveFilter() {
+ CompositePageFilter filter = new CompositePageFilter();
+ assertAccept(filter);
+ assertTrue(filter.isEmpty());
+ //
+ P_AcceptingFilter acceptFilter = new P_AcceptingFilter();
+ filter.addFilter(acceptFilter);
+ assertAccept(filter);
+ assertFalse(filter.isEmpty());
+ //
+ P_RejectingFilter rejectFilter = new P_RejectingFilter();
+ filter.addFilter(rejectFilter);
+ assertReject(filter);
+ assertFalse(filter.isEmpty());
+ //
+ filter.removeFilter(rejectFilter);
+ assertAccept(filter);
+ assertFalse(filter.isEmpty());
+ //
+ filter.addFilterAtBegin(rejectFilter);
+ assertReject(filter);
+ assertFalse(filter.isEmpty());
+ //
+ filter.removeFilter(rejectFilter);
+ assertAccept(filter);
+ assertFalse(filter.isEmpty());
+ //
+ filter.removeFilter(acceptFilter);
+ assertAccept(filter);
+ assertTrue(filter.isEmpty());
+ }
+
+ /*
+ * test support
+ */
+ private void assertAccept(CompositePageFilter filter) {
+ assertTrue(filter.accept(null, null, null));
+ }
+
+ private void assertReject(CompositePageFilter filter) {
+ assertFalse(filter.accept(null, null, null));
+ }
+
+ public static class P_AcceptingFilter implements IPageExtensionFilter {
+ @Override
+ public boolean accept(IOutline outline, IPage parentPage, IPage affectedPage) {
+ return true;
+ }
+ }
+
+ public static class P_RejectingFilter implements IPageExtensionFilter {
+ @Override
+ public boolean accept(IOutline outline, IPage parentPage, IPage affectedPage) {
+ return false;
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/PageContributionIntegrationTest.java b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/PageContributionIntegrationTest.java
index 6660ddbe02..b11c26b242 100644
--- a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/PageContributionIntegrationTest.java
+++ b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/PageContributionIntegrationTest.java
@@ -1,117 +1,117 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages;
-
-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.List;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.AbstractPageWithNodes;
-import org.eclipse.scout.rt.extension.client.Activator;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.APageFilter;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.BPageFilter;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.DynamicOutline;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.contribution.AContributionPageWithNodes;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.contribution.BContributionPageWithNodes;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.contribution.CContributionPageWithNodes;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.contribution.DContributionPageWithNodes;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.contribution.PageContributionNodePage;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.contribution.PageContributionOutline;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.internal.PageAnchorFilter;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.internal.PageContributionExtension;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.internal.PageExtensionManager;
-import org.eclipse.scout.testing.client.runner.ScoutClientTestRunner;
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-/**
- * @since 3.9.0
- */
-@RunWith(ScoutClientTestRunner.class)
-public class PageContributionIntegrationTest {
-
- @Test
- public void testDisabledExtensions() throws ProcessingException {
- PageExtensionManager manager = Activator.getDefault().getPagesExtensionManager();
- List<PageContributionExtension> extensions = manager.getPageContributionExtensions();
- assertNotNull(extensions);
- for (PageContributionExtension ext : extensions) {
- if (ext.getPageClass() == CContributionPageWithNodes.class) {
- Assert.fail("Disabled pageContribution is available for page " + CContributionPageWithNodes.class.getSimpleName());
- }
- }
- }
-
- @Test
- public void testFilters() throws ProcessingException {
- PageExtensionManager manager = Activator.getDefault().getPagesExtensionManager();
- List<PageContributionExtension> extensions = manager.getPageContributionExtensions();
- assertNotNull(extensions);
- for (PageContributionExtension ext : extensions) {
- if (ext.getPageClass() == DContributionPageWithNodes.class) {
- // desktop anchor and filters
- assertTrue(ext.getPageFilter() != null);
- assertSame(CompositePageFilter.class, ext.getPageFilter().getClass());
- //
- CompositePageFilter filter = (CompositePageFilter) ext.getPageFilter();
- assertEquals(3, filter.size());
- assertSame(PageAnchorFilter.class, filter.getFilters()[0].getClass());
- assertSame(APageFilter.class, filter.getFilters()[1].getClass());
- assertSame(BPageFilter.class, filter.getFilters()[2].getClass());
- //
- PageAnchorFilter anchor = (PageAnchorFilter) filter.getFilters()[0];
- assertNull(anchor.getOutlineFilterClass());
- assertSame(CContributionPageWithNodes.class, anchor.getParentPageFilterClass());
- //
- assertFalse(filter.accept(null, null, new P_Page()));
- assertTrue(filter.accept(null, new CContributionPageWithNodes(), new P_Page()));
- }
- }
- }
-
- @Test
- public void testExtensionsOnNodePage() throws ProcessingException {
- // affected by fragment.xml entries
- Activator.getDefault().getPagesExtensionManager();
- PageContributionNodePage extensionPage = new PageContributionNodePage();
- DynamicOutline outline = new DynamicOutline(extensionPage);
- assertSame(extensionPage, outline.getActivePage());
- assertEquals(4, extensionPage.getChildNodeCount());
- assertSame(AContributionPageWithNodes.class, extensionPage.getChildNode(0).getClass());
- assertSame(PageContributionNodePage.P_NodePage.class, extensionPage.getChildNode(1).getClass());
- assertSame(BContributionPageWithNodes.class, extensionPage.getChildNode(2).getClass());
- assertSame(PageContributionNodePage.P_NodePage.class, extensionPage.getChildNode(3).getClass());
- }
-
- @Test
- public void testExtensionsOnOutline() throws ProcessingException {
- // affected by fragment.xml entries
- Activator.getDefault().getPagesExtensionManager();
- PageContributionOutline outline = new PageContributionOutline();
- ITreeNode rootNode = outline.getRootNode();
- assertNotNull(rootNode);
- assertEquals(3, rootNode.getChildNodeCount());
- assertSame(PageContributionOutline.P_NodePage.class, rootNode.getChildNode(0).getClass());
- assertSame(PageContributionOutline.P_NodePage.class, rootNode.getChildNode(1).getClass());
- assertSame(AContributionPageWithNodes.class, rootNode.getChildNode(2).getClass());
- }
-
- private static class P_Page extends AbstractPageWithNodes {
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages;
+
+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.List;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.AbstractPageWithNodes;
+import org.eclipse.scout.rt.extension.client.Activator;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.APageFilter;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.BPageFilter;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.DynamicOutline;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.contribution.AContributionPageWithNodes;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.contribution.BContributionPageWithNodes;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.contribution.CContributionPageWithNodes;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.contribution.DContributionPageWithNodes;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.contribution.PageContributionNodePage;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.contribution.PageContributionOutline;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.internal.PageAnchorFilter;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.internal.PageContributionExtension;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.internal.PageExtensionManager;
+import org.eclipse.scout.testing.client.runner.ScoutClientTestRunner;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * @since 3.9.0
+ */
+@RunWith(ScoutClientTestRunner.class)
+public class PageContributionIntegrationTest {
+
+ @Test
+ public void testDisabledExtensions() throws ProcessingException {
+ PageExtensionManager manager = Activator.getDefault().getPagesExtensionManager();
+ List<PageContributionExtension> extensions = manager.getPageContributionExtensions();
+ assertNotNull(extensions);
+ for (PageContributionExtension ext : extensions) {
+ if (ext.getPageClass() == CContributionPageWithNodes.class) {
+ Assert.fail("Disabled pageContribution is available for page " + CContributionPageWithNodes.class.getSimpleName());
+ }
+ }
+ }
+
+ @Test
+ public void testFilters() throws ProcessingException {
+ PageExtensionManager manager = Activator.getDefault().getPagesExtensionManager();
+ List<PageContributionExtension> extensions = manager.getPageContributionExtensions();
+ assertNotNull(extensions);
+ for (PageContributionExtension ext : extensions) {
+ if (ext.getPageClass() == DContributionPageWithNodes.class) {
+ // desktop anchor and filters
+ assertTrue(ext.getPageFilter() != null);
+ assertSame(CompositePageFilter.class, ext.getPageFilter().getClass());
+ //
+ CompositePageFilter filter = (CompositePageFilter) ext.getPageFilter();
+ assertEquals(3, filter.size());
+ assertSame(PageAnchorFilter.class, filter.getFilters()[0].getClass());
+ assertSame(APageFilter.class, filter.getFilters()[1].getClass());
+ assertSame(BPageFilter.class, filter.getFilters()[2].getClass());
+ //
+ PageAnchorFilter anchor = (PageAnchorFilter) filter.getFilters()[0];
+ assertNull(anchor.getOutlineFilterClass());
+ assertSame(CContributionPageWithNodes.class, anchor.getParentPageFilterClass());
+ //
+ assertFalse(filter.accept(null, null, new P_Page()));
+ assertTrue(filter.accept(null, new CContributionPageWithNodes(), new P_Page()));
+ }
+ }
+ }
+
+ @Test
+ public void testExtensionsOnNodePage() throws ProcessingException {
+ // affected by fragment.xml entries
+ Activator.getDefault().getPagesExtensionManager();
+ PageContributionNodePage extensionPage = new PageContributionNodePage();
+ DynamicOutline outline = new DynamicOutline(extensionPage);
+ assertSame(extensionPage, outline.getActivePage());
+ assertEquals(4, extensionPage.getChildNodeCount());
+ assertSame(AContributionPageWithNodes.class, extensionPage.getChildNode(0).getClass());
+ assertSame(PageContributionNodePage.P_NodePage.class, extensionPage.getChildNode(1).getClass());
+ assertSame(BContributionPageWithNodes.class, extensionPage.getChildNode(2).getClass());
+ assertSame(PageContributionNodePage.P_NodePage.class, extensionPage.getChildNode(3).getClass());
+ }
+
+ @Test
+ public void testExtensionsOnOutline() throws ProcessingException {
+ // affected by fragment.xml entries
+ Activator.getDefault().getPagesExtensionManager();
+ PageContributionOutline outline = new PageContributionOutline();
+ ITreeNode rootNode = outline.getRootNode();
+ assertNotNull(rootNode);
+ assertEquals(3, rootNode.getChildNodeCount());
+ assertSame(PageContributionOutline.P_NodePage.class, rootNode.getChildNode(0).getClass());
+ assertSame(PageContributionOutline.P_NodePage.class, rootNode.getChildNode(1).getClass());
+ assertSame(AContributionPageWithNodes.class, rootNode.getChildNode(2).getClass());
+ }
+
+ private static class P_Page extends AbstractPageWithNodes {
+ }
+}
diff --git a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/PageExtensionUtilityTest.java b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/PageExtensionUtilityTest.java
index 1f3f669c79..4a5a11845d 100644
--- a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/PageExtensionUtilityTest.java
+++ b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/PageExtensionUtilityTest.java
@@ -1,335 +1,335 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages;
-
-import static org.junit.Assert.assertEquals;
-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.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.desktop.outline.AbstractOutline;
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.AbstractPageWithNodes;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithNodes;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.internal.PageContributionExtension;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.internal.PageModificationExtension;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.internal.PageRemoveExtension;
-import org.eclipse.scout.testing.client.runner.ScoutClientTestRunner;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-/**
- * @since 3.9.0
- */
-@RunWith(ScoutClientTestRunner.class)
-public class PageExtensionUtilityTest {
-
- private List<IPage> m_pageList;
- private P_ConfiguredPageA m_configuredPageA;
- private P_ConfiguredPageB m_configuredPageB;
- private P_ConfiguredPageC m_configuredPageC;
- private P_Outline m_outline;
-
- @Before
- public void before() {
- P_ConfiguredPageAModifier.s_counter = 0;
- P_ConfiguredPageCModifier.s_counter = 0;
-
- m_pageList = new ArrayList<IPage>();
- m_configuredPageA = new P_ConfiguredPageA();
- m_configuredPageB = new P_ConfiguredPageB();
- m_configuredPageC = new P_ConfiguredPageC();
- m_outline = new P_Outline();
- }
-
- /////////////////////////////////////////////////////////
- // contribute //
- /////////////////////////////////////////////////////////
-
- @Test
- public void testContributePagesNullAndEmpty() throws Exception {
- PageExtensionUtility.contributePages(null, null, null, m_pageList);
- assertTrue(m_pageList.isEmpty());
- PageExtensionUtility.contributePages(null, null, Collections.<PageContributionExtension> emptyList(), m_pageList);
- assertTrue(m_pageList.isEmpty());
- }
-
- @Test
- public void testContributePagesWithoutFilter() throws Exception {
- m_pageList.add(m_configuredPageA);
- m_pageList.add(m_configuredPageB);
- m_pageList.add(m_configuredPageC);
-
- List<PageContributionExtension> extensions = Arrays.asList(
- new PageContributionExtension(P_ContribPageA.class, 10d),
- new PageContributionExtension(P_ContribPageB.class, 0d),
- new PageContributionExtension(P_ContribPageC.class, 10d));
-
- PageExtensionUtility.contributePages(m_outline, null, extensions, m_pageList);
-
- assertEquals(6, m_pageList.size());
- assertSame(P_ContribPageB.class, m_pageList.get(0).getClass());
- assertSame(m_configuredPageA, m_pageList.get(1));
- assertSame(P_ContribPageA.class, m_pageList.get(2).getClass());
- assertSame(P_ContribPageC.class, m_pageList.get(3).getClass());
- assertSame(m_configuredPageB, m_pageList.get(4));
- assertSame(m_configuredPageC, m_pageList.get(5));
- }
-
- @Test
- public void testContributePagesWithFilter() throws Exception {
- m_pageList.add(m_configuredPageA);
- m_pageList.add(m_configuredPageB);
- m_pageList.add(m_configuredPageC);
-
- IPageExtensionFilter pageFilter = new IPageExtensionFilter() {
- @Override
- public boolean accept(IOutline outline, IPage parentPage, IPage affectedPage) {
- return false;
- }
- };
-
- List<PageContributionExtension> extensions = Arrays.asList(
- new PageContributionExtension(pageFilter, P_ContribPageA.class, 10d),
- new PageContributionExtension(P_ContribPageB.class, 0d),
- new PageContributionExtension(P_ContribPageC.class, 10d));
-
- PageExtensionUtility.contributePages(m_outline, null, extensions, m_pageList);
-
- assertEquals(5, m_pageList.size());
- assertSame(P_ContribPageB.class, m_pageList.get(0).getClass());
- assertSame(m_configuredPageA, m_pageList.get(1));
- assertSame(P_ContribPageC.class, m_pageList.get(2).getClass());
- assertSame(m_configuredPageB, m_pageList.get(3));
- assertSame(m_configuredPageC, m_pageList.get(4));
- }
-
- @Test
- public void testContributePagesThrowingException() throws Exception {
- m_pageList.add(m_configuredPageA);
- m_pageList.add(m_configuredPageB);
- m_pageList.add(m_configuredPageC);
-
- List<PageContributionExtension> extensions = Arrays.asList(
- new PageContributionExtension(P_ContribPageA.class, 10d),
- new PageContributionExtension(P_ContribPageB.class, 0d) {
- @Override
- public IPage createContribution(IOutline outline, IPageWithNodes parentPage) throws ProcessingException {
- throw new UnsupportedOperationException("for testing purposes only");
- }
- },
- new PageContributionExtension(P_ContribPageC.class, 10d));
-
- PageExtensionUtility.contributePages(m_outline, null, extensions, m_pageList);
-
- assertEquals(5, m_pageList.size());
- assertSame(m_configuredPageA, m_pageList.get(0));
- assertSame(P_ContribPageA.class, m_pageList.get(1).getClass());
- assertSame(P_ContribPageC.class, m_pageList.get(2).getClass());
- assertSame(m_configuredPageB, m_pageList.get(3));
- assertSame(m_configuredPageC, m_pageList.get(4));
- }
-
- /////////////////////////////////////////////////////////
- // remove //
- /////////////////////////////////////////////////////////
-
- @Test
- public void testRemovePagesNullAndEmpty() throws Exception {
- PageExtensionUtility.removePages(null, null, null, m_pageList);
- assertTrue(m_pageList.isEmpty());
- PageExtensionUtility.removePages(null, null, Collections.<PageRemoveExtension> emptyList(), m_pageList);
- assertTrue(m_pageList.isEmpty());
- }
-
- @Test
- public void testRemovePagesWithoutFilter() throws Exception {
- m_pageList.add(m_configuredPageA);
- m_pageList.add(m_configuredPageB);
- m_pageList.add(m_configuredPageC);
-
- List<PageRemoveExtension> extensions = Arrays.asList(
- new PageRemoveExtension(P_ContribPageA.class),
- new PageRemoveExtension(P_ConfiguredPageB.class));
-
- PageExtensionUtility.removePages(null, null, extensions, m_pageList);
-
- assertEquals(2, m_pageList.size());
- assertSame(m_configuredPageA, m_pageList.get(0));
- assertSame(m_configuredPageC, m_pageList.get(1));
- }
-
- @Test
- public void testRemoveTwoPagesWithoutFilter() throws Exception {
- m_pageList.add(m_configuredPageA);
- m_pageList.add(m_configuredPageB);
- m_pageList.add(m_configuredPageC);
-
- List<PageRemoveExtension> extensions = Arrays.asList(
- new PageRemoveExtension(P_ConfiguredPageA.class),
- new PageRemoveExtension(P_ConfiguredPageB.class));
-
- PageExtensionUtility.removePages(null, null, extensions, m_pageList);
-
- assertEquals(1, m_pageList.size());
- assertSame(m_configuredPageC, m_pageList.get(0));
- }
-
- @Test
- public void testRemovePagesWithFilter() throws Exception {
- m_pageList.add(m_configuredPageA);
- m_pageList.add(m_configuredPageB);
- m_pageList.add(m_configuredPageC);
-
- IPageExtensionFilter pageFilter = new IPageExtensionFilter() {
- @Override
- public boolean accept(IOutline outline, IPage parentPage, IPage affectedPage) {
- assertNull(outline);
- assertNull(parentPage);
- assertSame(m_configuredPageC, affectedPage);
- return false;
- }
- };
-
- List<PageRemoveExtension> extensions = Arrays.asList(
- new PageRemoveExtension(P_ContribPageA.class),
- new PageRemoveExtension(P_ConfiguredPageB.class),
- new PageRemoveExtension(pageFilter, P_ConfiguredPageC.class));
-
- PageExtensionUtility.removePages(null, null, extensions, m_pageList);
-
- assertEquals(2, m_pageList.size());
- assertSame(m_configuredPageA, m_pageList.get(0));
- assertSame(m_configuredPageC, m_pageList.get(1));
- }
-
- /////////////////////////////////////////////////////////
- // modify //
- /////////////////////////////////////////////////////////
- public void testModifyPagesNullAndEmpty() throws Exception {
- PageExtensionUtility.modifyPages(null, null, null, m_pageList);
- assertTrue(m_pageList.isEmpty());
- PageExtensionUtility.modifyPages(null, null, Collections.<PageModificationExtension> emptyList(), m_pageList);
- assertTrue(m_pageList.isEmpty());
- }
-
- @Test
- public void testModifyPagesWithoutFilter() throws Exception {
- m_pageList.add(m_configuredPageA);
- m_pageList.add(m_configuredPageB);
- m_pageList.add(m_configuredPageC);
-
- List<PageModificationExtension> extensions = Arrays.asList(
- new PageModificationExtension(P_ConfiguredPageA.class, P_ConfiguredPageAModifier.class),
- new PageModificationExtension(P_ConfiguredPageC.class, P_ConfiguredPageCModifier.class));
-
- PageExtensionUtility.modifyPages(null, null, extensions, m_pageList);
-
- assertEquals(3, m_pageList.size());
- assertSame(m_configuredPageA, m_pageList.get(0));
- assertSame(m_configuredPageB, m_pageList.get(1));
- assertSame(m_configuredPageC, m_pageList.get(2));
-
- assertEquals(1, P_ConfiguredPageAModifier.s_counter);
- assertEquals(1, P_ConfiguredPageCModifier.s_counter);
- }
-
- @Test
- public void testModifyPagesWithFilter() throws Exception {
- m_pageList.add(m_configuredPageA);
- m_pageList.add(m_configuredPageB);
- m_pageList.add(m_configuredPageC);
-
- IPageExtensionFilter pageFilter = new IPageExtensionFilter() {
- @Override
- public boolean accept(IOutline outline, IPage parentPage, IPage affectedPage) {
- assertNull(outline);
- assertNull(parentPage);
- assertSame(m_configuredPageC, affectedPage);
- return false;
- }
- };
-
- List<PageModificationExtension> extensions = Arrays.asList(
- new PageModificationExtension(P_ConfiguredPageA.class, P_ConfiguredPageAModifier.class),
- new PageModificationExtension(pageFilter, P_ConfiguredPageC.class, P_ConfiguredPageCModifier.class));
-
- PageExtensionUtility.modifyPages(null, null, extensions, m_pageList);
-
- assertEquals(3, m_pageList.size());
- assertSame(m_configuredPageA, m_pageList.get(0));
- assertSame(m_configuredPageB, m_pageList.get(1));
- assertSame(m_configuredPageC, m_pageList.get(2));
-
- assertEquals(1, P_ConfiguredPageAModifier.s_counter);
- assertEquals(0, P_ConfiguredPageCModifier.s_counter);
- }
-
- /////////////////////////////////////////////////////////
- // test resources //
- /////////////////////////////////////////////////////////
-
- public static class P_Outline extends AbstractOutline {
- }
-
- public static class P_ConfiguredPageA extends AbstractPageWithNodes {
- }
-
- public static class P_ConfiguredPageB extends AbstractPageWithNodes {
- }
-
- public static class P_ConfiguredPageC extends AbstractPageWithNodes {
- }
-
- public static class P_ContribPageA extends AbstractPageWithNodes {
- }
-
- public static class P_ContribPageB extends AbstractPageWithNodes {
- }
-
- public static class P_ContribPageC extends AbstractPageWithNodes {
- }
-
- public static class P_ConfiguredPageAModifier implements IPageModifier<IPage> {
- static int s_counter = 0;
-
- @Override
- public void modify(IOutline outline, IPage parentPage, IPage page) throws ProcessingException {
- s_counter++;
- assertNull(outline);
- assertNull(parentPage);
- assertNotNull(page);
- assertSame(P_ConfiguredPageA.class, page.getClass());
- }
- }
-
- public static class P_ConfiguredPageCModifier implements IPageModifier<IPage> {
- static int s_counter = 0;
-
- @Override
- public void modify(IOutline outline, IPage parentPage, IPage page) throws ProcessingException {
- s_counter++;
- assertNull(outline);
- assertNull(parentPage);
- assertNotNull(page);
- assertSame(P_ConfiguredPageC.class, page.getClass());
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages;
+
+import static org.junit.Assert.assertEquals;
+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.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.desktop.outline.AbstractOutline;
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.AbstractPageWithNodes;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithNodes;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.internal.PageContributionExtension;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.internal.PageModificationExtension;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.internal.PageRemoveExtension;
+import org.eclipse.scout.testing.client.runner.ScoutClientTestRunner;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * @since 3.9.0
+ */
+@RunWith(ScoutClientTestRunner.class)
+public class PageExtensionUtilityTest {
+
+ private List<IPage> m_pageList;
+ private P_ConfiguredPageA m_configuredPageA;
+ private P_ConfiguredPageB m_configuredPageB;
+ private P_ConfiguredPageC m_configuredPageC;
+ private P_Outline m_outline;
+
+ @Before
+ public void before() {
+ P_ConfiguredPageAModifier.s_counter = 0;
+ P_ConfiguredPageCModifier.s_counter = 0;
+
+ m_pageList = new ArrayList<IPage>();
+ m_configuredPageA = new P_ConfiguredPageA();
+ m_configuredPageB = new P_ConfiguredPageB();
+ m_configuredPageC = new P_ConfiguredPageC();
+ m_outline = new P_Outline();
+ }
+
+ /////////////////////////////////////////////////////////
+ // contribute //
+ /////////////////////////////////////////////////////////
+
+ @Test
+ public void testContributePagesNullAndEmpty() throws Exception {
+ PageExtensionUtility.contributePages(null, null, null, m_pageList);
+ assertTrue(m_pageList.isEmpty());
+ PageExtensionUtility.contributePages(null, null, Collections.<PageContributionExtension> emptyList(), m_pageList);
+ assertTrue(m_pageList.isEmpty());
+ }
+
+ @Test
+ public void testContributePagesWithoutFilter() throws Exception {
+ m_pageList.add(m_configuredPageA);
+ m_pageList.add(m_configuredPageB);
+ m_pageList.add(m_configuredPageC);
+
+ List<PageContributionExtension> extensions = Arrays.asList(
+ new PageContributionExtension(P_ContribPageA.class, 10d),
+ new PageContributionExtension(P_ContribPageB.class, 0d),
+ new PageContributionExtension(P_ContribPageC.class, 10d));
+
+ PageExtensionUtility.contributePages(m_outline, null, extensions, m_pageList);
+
+ assertEquals(6, m_pageList.size());
+ assertSame(P_ContribPageB.class, m_pageList.get(0).getClass());
+ assertSame(m_configuredPageA, m_pageList.get(1));
+ assertSame(P_ContribPageA.class, m_pageList.get(2).getClass());
+ assertSame(P_ContribPageC.class, m_pageList.get(3).getClass());
+ assertSame(m_configuredPageB, m_pageList.get(4));
+ assertSame(m_configuredPageC, m_pageList.get(5));
+ }
+
+ @Test
+ public void testContributePagesWithFilter() throws Exception {
+ m_pageList.add(m_configuredPageA);
+ m_pageList.add(m_configuredPageB);
+ m_pageList.add(m_configuredPageC);
+
+ IPageExtensionFilter pageFilter = new IPageExtensionFilter() {
+ @Override
+ public boolean accept(IOutline outline, IPage parentPage, IPage affectedPage) {
+ return false;
+ }
+ };
+
+ List<PageContributionExtension> extensions = Arrays.asList(
+ new PageContributionExtension(pageFilter, P_ContribPageA.class, 10d),
+ new PageContributionExtension(P_ContribPageB.class, 0d),
+ new PageContributionExtension(P_ContribPageC.class, 10d));
+
+ PageExtensionUtility.contributePages(m_outline, null, extensions, m_pageList);
+
+ assertEquals(5, m_pageList.size());
+ assertSame(P_ContribPageB.class, m_pageList.get(0).getClass());
+ assertSame(m_configuredPageA, m_pageList.get(1));
+ assertSame(P_ContribPageC.class, m_pageList.get(2).getClass());
+ assertSame(m_configuredPageB, m_pageList.get(3));
+ assertSame(m_configuredPageC, m_pageList.get(4));
+ }
+
+ @Test
+ public void testContributePagesThrowingException() throws Exception {
+ m_pageList.add(m_configuredPageA);
+ m_pageList.add(m_configuredPageB);
+ m_pageList.add(m_configuredPageC);
+
+ List<PageContributionExtension> extensions = Arrays.asList(
+ new PageContributionExtension(P_ContribPageA.class, 10d),
+ new PageContributionExtension(P_ContribPageB.class, 0d) {
+ @Override
+ public IPage createContribution(IOutline outline, IPageWithNodes parentPage) throws ProcessingException {
+ throw new UnsupportedOperationException("for testing purposes only");
+ }
+ },
+ new PageContributionExtension(P_ContribPageC.class, 10d));
+
+ PageExtensionUtility.contributePages(m_outline, null, extensions, m_pageList);
+
+ assertEquals(5, m_pageList.size());
+ assertSame(m_configuredPageA, m_pageList.get(0));
+ assertSame(P_ContribPageA.class, m_pageList.get(1).getClass());
+ assertSame(P_ContribPageC.class, m_pageList.get(2).getClass());
+ assertSame(m_configuredPageB, m_pageList.get(3));
+ assertSame(m_configuredPageC, m_pageList.get(4));
+ }
+
+ /////////////////////////////////////////////////////////
+ // remove //
+ /////////////////////////////////////////////////////////
+
+ @Test
+ public void testRemovePagesNullAndEmpty() throws Exception {
+ PageExtensionUtility.removePages(null, null, null, m_pageList);
+ assertTrue(m_pageList.isEmpty());
+ PageExtensionUtility.removePages(null, null, Collections.<PageRemoveExtension> emptyList(), m_pageList);
+ assertTrue(m_pageList.isEmpty());
+ }
+
+ @Test
+ public void testRemovePagesWithoutFilter() throws Exception {
+ m_pageList.add(m_configuredPageA);
+ m_pageList.add(m_configuredPageB);
+ m_pageList.add(m_configuredPageC);
+
+ List<PageRemoveExtension> extensions = Arrays.asList(
+ new PageRemoveExtension(P_ContribPageA.class),
+ new PageRemoveExtension(P_ConfiguredPageB.class));
+
+ PageExtensionUtility.removePages(null, null, extensions, m_pageList);
+
+ assertEquals(2, m_pageList.size());
+ assertSame(m_configuredPageA, m_pageList.get(0));
+ assertSame(m_configuredPageC, m_pageList.get(1));
+ }
+
+ @Test
+ public void testRemoveTwoPagesWithoutFilter() throws Exception {
+ m_pageList.add(m_configuredPageA);
+ m_pageList.add(m_configuredPageB);
+ m_pageList.add(m_configuredPageC);
+
+ List<PageRemoveExtension> extensions = Arrays.asList(
+ new PageRemoveExtension(P_ConfiguredPageA.class),
+ new PageRemoveExtension(P_ConfiguredPageB.class));
+
+ PageExtensionUtility.removePages(null, null, extensions, m_pageList);
+
+ assertEquals(1, m_pageList.size());
+ assertSame(m_configuredPageC, m_pageList.get(0));
+ }
+
+ @Test
+ public void testRemovePagesWithFilter() throws Exception {
+ m_pageList.add(m_configuredPageA);
+ m_pageList.add(m_configuredPageB);
+ m_pageList.add(m_configuredPageC);
+
+ IPageExtensionFilter pageFilter = new IPageExtensionFilter() {
+ @Override
+ public boolean accept(IOutline outline, IPage parentPage, IPage affectedPage) {
+ assertNull(outline);
+ assertNull(parentPage);
+ assertSame(m_configuredPageC, affectedPage);
+ return false;
+ }
+ };
+
+ List<PageRemoveExtension> extensions = Arrays.asList(
+ new PageRemoveExtension(P_ContribPageA.class),
+ new PageRemoveExtension(P_ConfiguredPageB.class),
+ new PageRemoveExtension(pageFilter, P_ConfiguredPageC.class));
+
+ PageExtensionUtility.removePages(null, null, extensions, m_pageList);
+
+ assertEquals(2, m_pageList.size());
+ assertSame(m_configuredPageA, m_pageList.get(0));
+ assertSame(m_configuredPageC, m_pageList.get(1));
+ }
+
+ /////////////////////////////////////////////////////////
+ // modify //
+ /////////////////////////////////////////////////////////
+ public void testModifyPagesNullAndEmpty() throws Exception {
+ PageExtensionUtility.modifyPages(null, null, null, m_pageList);
+ assertTrue(m_pageList.isEmpty());
+ PageExtensionUtility.modifyPages(null, null, Collections.<PageModificationExtension> emptyList(), m_pageList);
+ assertTrue(m_pageList.isEmpty());
+ }
+
+ @Test
+ public void testModifyPagesWithoutFilter() throws Exception {
+ m_pageList.add(m_configuredPageA);
+ m_pageList.add(m_configuredPageB);
+ m_pageList.add(m_configuredPageC);
+
+ List<PageModificationExtension> extensions = Arrays.asList(
+ new PageModificationExtension(P_ConfiguredPageA.class, P_ConfiguredPageAModifier.class),
+ new PageModificationExtension(P_ConfiguredPageC.class, P_ConfiguredPageCModifier.class));
+
+ PageExtensionUtility.modifyPages(null, null, extensions, m_pageList);
+
+ assertEquals(3, m_pageList.size());
+ assertSame(m_configuredPageA, m_pageList.get(0));
+ assertSame(m_configuredPageB, m_pageList.get(1));
+ assertSame(m_configuredPageC, m_pageList.get(2));
+
+ assertEquals(1, P_ConfiguredPageAModifier.s_counter);
+ assertEquals(1, P_ConfiguredPageCModifier.s_counter);
+ }
+
+ @Test
+ public void testModifyPagesWithFilter() throws Exception {
+ m_pageList.add(m_configuredPageA);
+ m_pageList.add(m_configuredPageB);
+ m_pageList.add(m_configuredPageC);
+
+ IPageExtensionFilter pageFilter = new IPageExtensionFilter() {
+ @Override
+ public boolean accept(IOutline outline, IPage parentPage, IPage affectedPage) {
+ assertNull(outline);
+ assertNull(parentPage);
+ assertSame(m_configuredPageC, affectedPage);
+ return false;
+ }
+ };
+
+ List<PageModificationExtension> extensions = Arrays.asList(
+ new PageModificationExtension(P_ConfiguredPageA.class, P_ConfiguredPageAModifier.class),
+ new PageModificationExtension(pageFilter, P_ConfiguredPageC.class, P_ConfiguredPageCModifier.class));
+
+ PageExtensionUtility.modifyPages(null, null, extensions, m_pageList);
+
+ assertEquals(3, m_pageList.size());
+ assertSame(m_configuredPageA, m_pageList.get(0));
+ assertSame(m_configuredPageB, m_pageList.get(1));
+ assertSame(m_configuredPageC, m_pageList.get(2));
+
+ assertEquals(1, P_ConfiguredPageAModifier.s_counter);
+ assertEquals(0, P_ConfiguredPageCModifier.s_counter);
+ }
+
+ /////////////////////////////////////////////////////////
+ // test resources //
+ /////////////////////////////////////////////////////////
+
+ public static class P_Outline extends AbstractOutline {
+ }
+
+ public static class P_ConfiguredPageA extends AbstractPageWithNodes {
+ }
+
+ public static class P_ConfiguredPageB extends AbstractPageWithNodes {
+ }
+
+ public static class P_ConfiguredPageC extends AbstractPageWithNodes {
+ }
+
+ public static class P_ContribPageA extends AbstractPageWithNodes {
+ }
+
+ public static class P_ContribPageB extends AbstractPageWithNodes {
+ }
+
+ public static class P_ContribPageC extends AbstractPageWithNodes {
+ }
+
+ public static class P_ConfiguredPageAModifier implements IPageModifier<IPage> {
+ static int s_counter = 0;
+
+ @Override
+ public void modify(IOutline outline, IPage parentPage, IPage page) throws ProcessingException {
+ s_counter++;
+ assertNull(outline);
+ assertNull(parentPage);
+ assertNotNull(page);
+ assertSame(P_ConfiguredPageA.class, page.getClass());
+ }
+ }
+
+ public static class P_ConfiguredPageCModifier implements IPageModifier<IPage> {
+ static int s_counter = 0;
+
+ @Override
+ public void modify(IOutline outline, IPage parentPage, IPage page) throws ProcessingException {
+ s_counter++;
+ assertNull(outline);
+ assertNull(parentPage);
+ assertNotNull(page);
+ assertSame(P_ConfiguredPageC.class, page.getClass());
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/PageModificationIntegrationTest.java b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/PageModificationIntegrationTest.java
index f486f8e120..d5183dbccd 100644
--- a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/PageModificationIntegrationTest.java
+++ b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/PageModificationIntegrationTest.java
@@ -1,142 +1,142 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages;
-
-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.List;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.AbstractPageWithNodes;
-import org.eclipse.scout.rt.extension.client.Activator;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.APageFilter;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.BPageFilter;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.DynamicOutline;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification.AModificationPageWithNodes;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification.BModificationPageWithNodes;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification.C1ModificationPageWithNodes;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification.C2ModificationPageWithNodes;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification.IModifiablePage;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification.PageModificationNodePage;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification.PageModificationOutline;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification.PageModificationTablePage;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.internal.PageAnchorFilter;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.internal.PageExtensionManager;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.internal.PageModificationExtension;
-import org.eclipse.scout.testing.client.runner.ScoutClientTestRunner;
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-/**
- * @since 3.9.0
- */
-@RunWith(ScoutClientTestRunner.class)
-public class PageModificationIntegrationTest {
-
- @Test
- public void testDisabledExtensions() throws ProcessingException {
- PageExtensionManager manager = Activator.getDefault().getPagesExtensionManager();
- List<PageModificationExtension> extensions = manager.getPageModificationExtensions();
- assertNotNull(extensions);
- for (PageModificationExtension ext : extensions) {
- if (ext.getPageClass() == BModificationPageWithNodes.class && ext.getPageFilter() == null) {
- Assert.fail("Disabled pageModification is available for page " + BModificationPageWithNodes.class.getSimpleName());
- }
- }
- }
-
- @Test
- public void testFilters() throws ProcessingException {
- PageExtensionManager manager = Activator.getDefault().getPagesExtensionManager();
- List<PageModificationExtension> extensions = manager.getPageModificationExtensions();
- assertNotNull(extensions);
- for (PageModificationExtension ext : extensions) {
- if (ext.getPageClass() == C1ModificationPageWithNodes.class) {
- // desktop anchor and filters
- assertTrue(ext.getPageFilter() != null);
- assertSame(CompositePageFilter.class, ext.getPageFilter().getClass());
- //
- CompositePageFilter filter = (CompositePageFilter) ext.getPageFilter();
- assertEquals(3, filter.size());
- assertSame(PageAnchorFilter.class, filter.getFilters()[0].getClass());
- assertSame(APageFilter.class, filter.getFilters()[1].getClass());
- assertSame(BPageFilter.class, filter.getFilters()[2].getClass());
- //
- PageAnchorFilter anchor = (PageAnchorFilter) filter.getFilters()[0];
- assertNull(anchor.getOutlineFilterClass());
- assertSame(PageModificationNodePage.class, anchor.getParentPageFilterClass());
- //
- assertFalse(filter.accept(null, null, new P_Page()));
- assertTrue(filter.accept(null, new PageModificationNodePage(), new P_Page()));
- }
- }
- }
-
- @Test
- public void testExtensionsOnNodePage() throws ProcessingException {
- // affected by fragment.xml entries
- Activator.getDefault().getPagesExtensionManager();
- PageModificationNodePage extensionPage = new PageModificationNodePage();
- DynamicOutline outline = new DynamicOutline(extensionPage);
- assertSame(extensionPage, outline.getActivePage());
- //
- assertEquals(4, extensionPage.getChildNodeCount());
- assertModified(true, AModificationPageWithNodes.class, extensionPage.getChildPage(0));
- assertModified(false, BModificationPageWithNodes.class, extensionPage.getChildPage(1));
- assertModified(true, C1ModificationPageWithNodes.class, extensionPage.getChildPage(2));
- assertModified(true, C2ModificationPageWithNodes.class, extensionPage.getChildPage(3));
- }
-
- @Test
- public void testExtensionsOnTablePage() throws ProcessingException {
- // affected by fragment.xml entries
- Activator.getDefault().getPagesExtensionManager();
- PageModificationTablePage extensionPage = new PageModificationTablePage();
- DynamicOutline outline = new DynamicOutline(extensionPage);
- assertSame(extensionPage, outline.getActivePage());
- extensionPage.ensureChildrenLoaded();
- outline.selectNode(extensionPage.getChildNode(0));
- //
- assertEquals(1, extensionPage.getChildNodeCount());
- assertModified(true, BModificationPageWithNodes.class, extensionPage.getChildPage(0));
- }
-
- @Test
- public void testExtensionsOnOutline() throws ProcessingException {
- // affected by fragment.xml entries
- Activator.getDefault().getPagesExtensionManager();
- PageModificationOutline outline = new PageModificationOutline();
- ITreeNode rootNode = outline.getRootNode();
- assertNotNull(rootNode);
- //
- assertEquals(4, rootNode.getChildNodeCount());
- assertModified(true, AModificationPageWithNodes.class, rootNode.getChildNode(0));
- assertModified(false, BModificationPageWithNodes.class, rootNode.getChildNode(1));
- assertModified(true, C1ModificationPageWithNodes.class, rootNode.getChildNode(2));
- assertModified(true, C2ModificationPageWithNodes.class, rootNode.getChildNode(3));
- }
-
- private void assertModified(boolean expected, Class<?> expectedType, ITreeNode page) {
- assertTrue(page instanceof IModifiablePage);
- assertTrue(expectedType.isInstance(page));
- assertEquals(expected, ((IModifiablePage) page).isModified());
- }
-
- private static class P_Page extends AbstractPageWithNodes {
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages;
+
+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.List;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.AbstractPageWithNodes;
+import org.eclipse.scout.rt.extension.client.Activator;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.APageFilter;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.BPageFilter;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.DynamicOutline;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification.AModificationPageWithNodes;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification.BModificationPageWithNodes;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification.C1ModificationPageWithNodes;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification.C2ModificationPageWithNodes;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification.IModifiablePage;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification.PageModificationNodePage;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification.PageModificationOutline;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification.PageModificationTablePage;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.internal.PageAnchorFilter;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.internal.PageExtensionManager;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.internal.PageModificationExtension;
+import org.eclipse.scout.testing.client.runner.ScoutClientTestRunner;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * @since 3.9.0
+ */
+@RunWith(ScoutClientTestRunner.class)
+public class PageModificationIntegrationTest {
+
+ @Test
+ public void testDisabledExtensions() throws ProcessingException {
+ PageExtensionManager manager = Activator.getDefault().getPagesExtensionManager();
+ List<PageModificationExtension> extensions = manager.getPageModificationExtensions();
+ assertNotNull(extensions);
+ for (PageModificationExtension ext : extensions) {
+ if (ext.getPageClass() == BModificationPageWithNodes.class && ext.getPageFilter() == null) {
+ Assert.fail("Disabled pageModification is available for page " + BModificationPageWithNodes.class.getSimpleName());
+ }
+ }
+ }
+
+ @Test
+ public void testFilters() throws ProcessingException {
+ PageExtensionManager manager = Activator.getDefault().getPagesExtensionManager();
+ List<PageModificationExtension> extensions = manager.getPageModificationExtensions();
+ assertNotNull(extensions);
+ for (PageModificationExtension ext : extensions) {
+ if (ext.getPageClass() == C1ModificationPageWithNodes.class) {
+ // desktop anchor and filters
+ assertTrue(ext.getPageFilter() != null);
+ assertSame(CompositePageFilter.class, ext.getPageFilter().getClass());
+ //
+ CompositePageFilter filter = (CompositePageFilter) ext.getPageFilter();
+ assertEquals(3, filter.size());
+ assertSame(PageAnchorFilter.class, filter.getFilters()[0].getClass());
+ assertSame(APageFilter.class, filter.getFilters()[1].getClass());
+ assertSame(BPageFilter.class, filter.getFilters()[2].getClass());
+ //
+ PageAnchorFilter anchor = (PageAnchorFilter) filter.getFilters()[0];
+ assertNull(anchor.getOutlineFilterClass());
+ assertSame(PageModificationNodePage.class, anchor.getParentPageFilterClass());
+ //
+ assertFalse(filter.accept(null, null, new P_Page()));
+ assertTrue(filter.accept(null, new PageModificationNodePage(), new P_Page()));
+ }
+ }
+ }
+
+ @Test
+ public void testExtensionsOnNodePage() throws ProcessingException {
+ // affected by fragment.xml entries
+ Activator.getDefault().getPagesExtensionManager();
+ PageModificationNodePage extensionPage = new PageModificationNodePage();
+ DynamicOutline outline = new DynamicOutline(extensionPage);
+ assertSame(extensionPage, outline.getActivePage());
+ //
+ assertEquals(4, extensionPage.getChildNodeCount());
+ assertModified(true, AModificationPageWithNodes.class, extensionPage.getChildPage(0));
+ assertModified(false, BModificationPageWithNodes.class, extensionPage.getChildPage(1));
+ assertModified(true, C1ModificationPageWithNodes.class, extensionPage.getChildPage(2));
+ assertModified(true, C2ModificationPageWithNodes.class, extensionPage.getChildPage(3));
+ }
+
+ @Test
+ public void testExtensionsOnTablePage() throws ProcessingException {
+ // affected by fragment.xml entries
+ Activator.getDefault().getPagesExtensionManager();
+ PageModificationTablePage extensionPage = new PageModificationTablePage();
+ DynamicOutline outline = new DynamicOutline(extensionPage);
+ assertSame(extensionPage, outline.getActivePage());
+ extensionPage.ensureChildrenLoaded();
+ outline.selectNode(extensionPage.getChildNode(0));
+ //
+ assertEquals(1, extensionPage.getChildNodeCount());
+ assertModified(true, BModificationPageWithNodes.class, extensionPage.getChildPage(0));
+ }
+
+ @Test
+ public void testExtensionsOnOutline() throws ProcessingException {
+ // affected by fragment.xml entries
+ Activator.getDefault().getPagesExtensionManager();
+ PageModificationOutline outline = new PageModificationOutline();
+ ITreeNode rootNode = outline.getRootNode();
+ assertNotNull(rootNode);
+ //
+ assertEquals(4, rootNode.getChildNodeCount());
+ assertModified(true, AModificationPageWithNodes.class, rootNode.getChildNode(0));
+ assertModified(false, BModificationPageWithNodes.class, rootNode.getChildNode(1));
+ assertModified(true, C1ModificationPageWithNodes.class, rootNode.getChildNode(2));
+ assertModified(true, C2ModificationPageWithNodes.class, rootNode.getChildNode(3));
+ }
+
+ private void assertModified(boolean expected, Class<?> expectedType, ITreeNode page) {
+ assertTrue(page instanceof IModifiablePage);
+ assertTrue(expectedType.isInstance(page));
+ assertEquals(expected, ((IModifiablePage) page).isModified());
+ }
+
+ private static class P_Page extends AbstractPageWithNodes {
+ }
+}
diff --git a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/PageRemovalIntegrationTest.java b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/PageRemovalIntegrationTest.java
index ba770a2cf6..7e560ad6d1 100644
--- a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/PageRemovalIntegrationTest.java
+++ b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/PageRemovalIntegrationTest.java
@@ -1,120 +1,120 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages;
-
-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.List;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.AbstractPageWithNodes;
-import org.eclipse.scout.rt.extension.client.Activator;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.APageFilter;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.BPageFilter;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.DynamicOutline;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.remove.AbstractCRemovePageWithNodes;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.remove.BRemovePageWithNodes;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.remove.C2RemovePageWithNodes;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.remove.PageRemoveNodePage;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.remove.PageRemoveOutline;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.internal.PageAnchorFilter;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.internal.PageExtensionManager;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.internal.PageRemoveExtension;
-import org.eclipse.scout.testing.client.runner.ScoutClientTestRunner;
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-/**
- * @since 3.9.0
- */
-@RunWith(ScoutClientTestRunner.class)
-public class PageRemovalIntegrationTest {
-
- @Test
- public void testDisabledExtensions() throws ProcessingException {
- PageExtensionManager manager = Activator.getDefault().getPagesExtensionManager();
- List<PageRemoveExtension> extensions = manager.getPageRemovalExtensions();
- assertNotNull(extensions);
- for (PageRemoveExtension ext : extensions) {
- if (ext.getPageClass() == BRemovePageWithNodes.class && ext.getPageFilter() == null) {
- Assert.fail("Disabled pageRemoval is available for page " + BRemovePageWithNodes.class.getSimpleName());
- }
- }
- }
-
- @Test
- public void testFilters() throws ProcessingException {
- PageExtensionManager manager = Activator.getDefault().getPagesExtensionManager();
- List<PageRemoveExtension> extensions = manager.getPageRemovalExtensions();
- assertNotNull(extensions);
- for (PageRemoveExtension ext : extensions) {
- if (ext.getPageClass() == AbstractCRemovePageWithNodes.class) {
- // filters only
- assertTrue(ext.getPageFilter() != null);
- assertSame(CompositePageFilter.class, ext.getPageFilter().getClass());
- //
- CompositePageFilter filter = (CompositePageFilter) ext.getPageFilter();
- assertEquals(2, filter.size());
- assertSame(APageFilter.class, filter.getFilters()[0].getClass());
- assertSame(BPageFilter.class, filter.getFilters()[1].getClass());
- //
- assertTrue(filter.accept(null, null, new P_Page()));
- }
- else if (ext.getPageClass() == C2RemovePageWithNodes.class) {
- // desktop anchor and filters
- assertTrue(ext.getPageFilter() != null);
- assertSame(CompositePageFilter.class, ext.getPageFilter().getClass());
- //
- CompositePageFilter filter = (CompositePageFilter) ext.getPageFilter();
- assertEquals(3, filter.size());
- assertSame(PageAnchorFilter.class, filter.getFilters()[0].getClass());
- assertSame(APageFilter.class, filter.getFilters()[1].getClass());
- assertSame(BPageFilter.class, filter.getFilters()[2].getClass());
- //
- PageAnchorFilter anchor = (PageAnchorFilter) filter.getFilters()[0];
- assertNull(anchor.getOutlineFilterClass());
- assertSame(BRemovePageWithNodes.class, anchor.getParentPageFilterClass());
- //
- assertFalse(filter.accept(null, null, new P_Page()));
- assertTrue(filter.accept(null, new BRemovePageWithNodes(), new P_Page()));
- }
- }
- }
-
- @Test
- public void testExtensionsOnNodePage() throws ProcessingException {
- // affected by fragment.xml entries
- PageRemoveNodePage extensionPage = new PageRemoveNodePage();
- DynamicOutline outline = new DynamicOutline(extensionPage);
- assertSame(extensionPage, outline.getActivePage());
- assertEquals(1, extensionPage.getChildNodeCount());
- assertSame(BRemovePageWithNodes.class, extensionPage.getChildNode(0).getClass());
- }
-
- @Test
- public void testExtensionsOnOutline() throws ProcessingException {
- // affected by fragment.xml entries
- PageRemoveOutline outline = new PageRemoveOutline();
- ITreeNode rootNode = outline.getRootNode();
- assertNotNull(rootNode);
- assertEquals(0, rootNode.getChildNodeCount());
- }
-
- private static class P_Page extends AbstractPageWithNodes {
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages;
+
+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.List;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.AbstractPageWithNodes;
+import org.eclipse.scout.rt.extension.client.Activator;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.APageFilter;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.BPageFilter;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.DynamicOutline;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.remove.AbstractCRemovePageWithNodes;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.remove.BRemovePageWithNodes;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.remove.C2RemovePageWithNodes;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.remove.PageRemoveNodePage;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.remove.PageRemoveOutline;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.internal.PageAnchorFilter;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.internal.PageExtensionManager;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.internal.PageRemoveExtension;
+import org.eclipse.scout.testing.client.runner.ScoutClientTestRunner;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * @since 3.9.0
+ */
+@RunWith(ScoutClientTestRunner.class)
+public class PageRemovalIntegrationTest {
+
+ @Test
+ public void testDisabledExtensions() throws ProcessingException {
+ PageExtensionManager manager = Activator.getDefault().getPagesExtensionManager();
+ List<PageRemoveExtension> extensions = manager.getPageRemovalExtensions();
+ assertNotNull(extensions);
+ for (PageRemoveExtension ext : extensions) {
+ if (ext.getPageClass() == BRemovePageWithNodes.class && ext.getPageFilter() == null) {
+ Assert.fail("Disabled pageRemoval is available for page " + BRemovePageWithNodes.class.getSimpleName());
+ }
+ }
+ }
+
+ @Test
+ public void testFilters() throws ProcessingException {
+ PageExtensionManager manager = Activator.getDefault().getPagesExtensionManager();
+ List<PageRemoveExtension> extensions = manager.getPageRemovalExtensions();
+ assertNotNull(extensions);
+ for (PageRemoveExtension ext : extensions) {
+ if (ext.getPageClass() == AbstractCRemovePageWithNodes.class) {
+ // filters only
+ assertTrue(ext.getPageFilter() != null);
+ assertSame(CompositePageFilter.class, ext.getPageFilter().getClass());
+ //
+ CompositePageFilter filter = (CompositePageFilter) ext.getPageFilter();
+ assertEquals(2, filter.size());
+ assertSame(APageFilter.class, filter.getFilters()[0].getClass());
+ assertSame(BPageFilter.class, filter.getFilters()[1].getClass());
+ //
+ assertTrue(filter.accept(null, null, new P_Page()));
+ }
+ else if (ext.getPageClass() == C2RemovePageWithNodes.class) {
+ // desktop anchor and filters
+ assertTrue(ext.getPageFilter() != null);
+ assertSame(CompositePageFilter.class, ext.getPageFilter().getClass());
+ //
+ CompositePageFilter filter = (CompositePageFilter) ext.getPageFilter();
+ assertEquals(3, filter.size());
+ assertSame(PageAnchorFilter.class, filter.getFilters()[0].getClass());
+ assertSame(APageFilter.class, filter.getFilters()[1].getClass());
+ assertSame(BPageFilter.class, filter.getFilters()[2].getClass());
+ //
+ PageAnchorFilter anchor = (PageAnchorFilter) filter.getFilters()[0];
+ assertNull(anchor.getOutlineFilterClass());
+ assertSame(BRemovePageWithNodes.class, anchor.getParentPageFilterClass());
+ //
+ assertFalse(filter.accept(null, null, new P_Page()));
+ assertTrue(filter.accept(null, new BRemovePageWithNodes(), new P_Page()));
+ }
+ }
+ }
+
+ @Test
+ public void testExtensionsOnNodePage() throws ProcessingException {
+ // affected by fragment.xml entries
+ PageRemoveNodePage extensionPage = new PageRemoveNodePage();
+ DynamicOutline outline = new DynamicOutline(extensionPage);
+ assertSame(extensionPage, outline.getActivePage());
+ assertEquals(1, extensionPage.getChildNodeCount());
+ assertSame(BRemovePageWithNodes.class, extensionPage.getChildNode(0).getClass());
+ }
+
+ @Test
+ public void testExtensionsOnOutline() throws ProcessingException {
+ // affected by fragment.xml entries
+ PageRemoveOutline outline = new PageRemoveOutline();
+ ITreeNode rootNode = outline.getRootNode();
+ assertNotNull(rootNode);
+ assertEquals(0, rootNode.getChildNodeCount());
+ }
+
+ private static class P_Page extends AbstractPageWithNodes {
+ }
+}
diff --git a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/APageFilter.java b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/APageFilter.java
index 59a28ad4fd..15e9b5be1b 100644
--- a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/APageFilter.java
+++ b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/APageFilter.java
@@ -1,26 +1,26 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture;
-
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.IPageExtensionFilter;
-
-/**
- * @since 3.9.0
- */
-public class APageFilter implements IPageExtensionFilter {
-
- @Override
- public boolean accept(IOutline outline, IPage parentPage, IPage affectedPage) {
- return true;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture;
+
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.IPageExtensionFilter;
+
+/**
+ * @since 3.9.0
+ */
+public class APageFilter implements IPageExtensionFilter {
+
+ @Override
+ public boolean accept(IOutline outline, IPage parentPage, IPage affectedPage) {
+ return true;
+ }
+}
diff --git a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/BPageFilter.java b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/BPageFilter.java
index 1a9f399638..043b998ba5 100644
--- a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/BPageFilter.java
+++ b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/BPageFilter.java
@@ -1,26 +1,26 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture;
-
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.IPageExtensionFilter;
-
-/**
- * @since 3.9.0
- */
-public class BPageFilter implements IPageExtensionFilter {
-
- @Override
- public boolean accept(IOutline outline, IPage parentPage, IPage affectedPage) {
- return true;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture;
+
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.IPageExtensionFilter;
+
+/**
+ * @since 3.9.0
+ */
+public class BPageFilter implements IPageExtensionFilter {
+
+ @Override
+ public boolean accept(IOutline outline, IPage parentPage, IPage affectedPage) {
+ return true;
+ }
+}
diff --git a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/DynamicOutline.java b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/DynamicOutline.java
index 3f77bb06e1..823ed75f9b 100644
--- a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/DynamicOutline.java
+++ b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/DynamicOutline.java
@@ -1,36 +1,36 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
-import org.eclipse.scout.rt.client.ui.desktop.outline.AbstractOutline;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-
-/**
- * @since 3.9.0
- */
-public class DynamicOutline extends AbstractOutline {
- private final IPage[] m_pages;
-
- public DynamicOutline(IPage... pages) throws ProcessingException {
- m_pages = pages;
- if (pages == null || pages.length == 0) {
- return;
- }
- ITreeNode rootNode = getRootNode();
- for (IPage p : pages) {
- addChildNode(rootNode, p);
- }
- rootNode.ensureChildrenLoaded();
- selectNode(pages[0]);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
+import org.eclipse.scout.rt.client.ui.desktop.outline.AbstractOutline;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+
+/**
+ * @since 3.9.0
+ */
+public class DynamicOutline extends AbstractOutline {
+ private final IPage[] m_pages;
+
+ public DynamicOutline(IPage... pages) throws ProcessingException {
+ m_pages = pages;
+ if (pages == null || pages.length == 0) {
+ return;
+ }
+ ITreeNode rootNode = getRootNode();
+ for (IPage p : pages) {
+ addChildNode(rootNode, p);
+ }
+ rootNode.ensureChildrenLoaded();
+ selectNode(pages[0]);
+ }
+}
diff --git a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/contribution/AContributionPageWithNodes.java b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/contribution/AContributionPageWithNodes.java
index ac76e728cf..8114fc2b55 100644
--- a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/contribution/AContributionPageWithNodes.java
+++ b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/contribution/AContributionPageWithNodes.java
@@ -1,20 +1,20 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.contribution;
-
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.AbstractExtensiblePageWithNodes;
-
-/**
- * @since 3.9.0
- */
-public class AContributionPageWithNodes extends AbstractExtensiblePageWithNodes {
-
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.contribution;
+
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.AbstractExtensiblePageWithNodes;
+
+/**
+ * @since 3.9.0
+ */
+public class AContributionPageWithNodes extends AbstractExtensiblePageWithNodes {
+
+}
diff --git a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/contribution/BContributionPageWithNodes.java b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/contribution/BContributionPageWithNodes.java
index 9137d7654d..00368e541b 100644
--- a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/contribution/BContributionPageWithNodes.java
+++ b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/contribution/BContributionPageWithNodes.java
@@ -1,20 +1,20 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.contribution;
-
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.AbstractExtensiblePageWithNodes;
-
-/**
- * @since 3.9.0
- */
-public class BContributionPageWithNodes extends AbstractExtensiblePageWithNodes {
-
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.contribution;
+
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.AbstractExtensiblePageWithNodes;
+
+/**
+ * @since 3.9.0
+ */
+public class BContributionPageWithNodes extends AbstractExtensiblePageWithNodes {
+
+}
diff --git a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/contribution/CContributionPageWithNodes.java b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/contribution/CContributionPageWithNodes.java
index 5e9f506705..0b302bf882 100644
--- a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/contribution/CContributionPageWithNodes.java
+++ b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/contribution/CContributionPageWithNodes.java
@@ -1,20 +1,20 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.contribution;
-
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.AbstractExtensiblePageWithNodes;
-
-/**
- * @since 3.9.0
- */
-public class CContributionPageWithNodes extends AbstractExtensiblePageWithNodes {
-
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.contribution;
+
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.AbstractExtensiblePageWithNodes;
+
+/**
+ * @since 3.9.0
+ */
+public class CContributionPageWithNodes extends AbstractExtensiblePageWithNodes {
+
+}
diff --git a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/contribution/DContributionPageWithNodes.java b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/contribution/DContributionPageWithNodes.java
index 43c84c9bfe..f467e410db 100644
--- a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/contribution/DContributionPageWithNodes.java
+++ b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/contribution/DContributionPageWithNodes.java
@@ -1,20 +1,20 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.contribution;
-
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.AbstractExtensiblePageWithNodes;
-
-/**
- * @since 3.9.0
- */
-public class DContributionPageWithNodes extends AbstractExtensiblePageWithNodes {
-
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.contribution;
+
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.AbstractExtensiblePageWithNodes;
+
+/**
+ * @since 3.9.0
+ */
+public class DContributionPageWithNodes extends AbstractExtensiblePageWithNodes {
+
+}
diff --git a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/contribution/PageContributionNodePage.java b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/contribution/PageContributionNodePage.java
index fc380307bd..a30599957e 100644
--- a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/contribution/PageContributionNodePage.java
+++ b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/contribution/PageContributionNodePage.java
@@ -1,33 +1,33 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.contribution;
-
-import java.util.Collection;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.AbstractPageWithNodes;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.AbstractExtensiblePageWithNodes;
-
-/**
- * @since 3.9.0
- */
-public class PageContributionNodePage extends AbstractExtensiblePageWithNodes {
-
- @Override
- protected void execCreateChildPages(Collection<IPage> pageList) throws ProcessingException {
- pageList.add(new P_NodePage());
- pageList.add(new P_NodePage());
- }
-
- public static class P_NodePage extends AbstractPageWithNodes {
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.contribution;
+
+import java.util.Collection;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.AbstractPageWithNodes;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.AbstractExtensiblePageWithNodes;
+
+/**
+ * @since 3.9.0
+ */
+public class PageContributionNodePage extends AbstractExtensiblePageWithNodes {
+
+ @Override
+ protected void execCreateChildPages(Collection<IPage> pageList) throws ProcessingException {
+ pageList.add(new P_NodePage());
+ pageList.add(new P_NodePage());
+ }
+
+ public static class P_NodePage extends AbstractPageWithNodes {
+ }
+}
diff --git a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/contribution/PageContributionOutline.java b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/contribution/PageContributionOutline.java
index 6b8c356dd5..5fb1fb892d 100644
--- a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/contribution/PageContributionOutline.java
+++ b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/contribution/PageContributionOutline.java
@@ -1,33 +1,33 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.contribution;
-
-import java.util.Collection;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.AbstractPageWithNodes;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.AbstractExtensibleOutline;
-
-/**
- * @since 3.9.0
- */
-public class PageContributionOutline extends AbstractExtensibleOutline {
-
- @Override
- protected void execCreateChildPages(Collection<IPage> pageList) throws ProcessingException {
- pageList.add(new P_NodePage());
- pageList.add(new P_NodePage());
- }
-
- public static class P_NodePage extends AbstractPageWithNodes {
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.contribution;
+
+import java.util.Collection;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.AbstractPageWithNodes;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.AbstractExtensibleOutline;
+
+/**
+ * @since 3.9.0
+ */
+public class PageContributionOutline extends AbstractExtensibleOutline {
+
+ @Override
+ protected void execCreateChildPages(Collection<IPage> pageList) throws ProcessingException {
+ pageList.add(new P_NodePage());
+ pageList.add(new P_NodePage());
+ }
+
+ public static class P_NodePage extends AbstractPageWithNodes {
+ }
+}
diff --git a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/modification/AModificationPageWithNodes.java b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/modification/AModificationPageWithNodes.java
index 670346d69b..10b43d729e 100644
--- a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/modification/AModificationPageWithNodes.java
+++ b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/modification/AModificationPageWithNodes.java
@@ -1,31 +1,31 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification;
-
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.AbstractExtensiblePageWithNodes;
-
-/**
- * @since 3.9.0
- */
-public class AModificationPageWithNodes extends AbstractExtensiblePageWithNodes implements IModifiablePage {
-
- private boolean m_modified;
-
- @Override
- public void markModified() {
- m_modified = true;
- }
-
- @Override
- public boolean isModified() {
- return m_modified;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification;
+
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.AbstractExtensiblePageWithNodes;
+
+/**
+ * @since 3.9.0
+ */
+public class AModificationPageWithNodes extends AbstractExtensiblePageWithNodes implements IModifiablePage {
+
+ private boolean m_modified;
+
+ @Override
+ public void markModified() {
+ m_modified = true;
+ }
+
+ @Override
+ public boolean isModified() {
+ return m_modified;
+ }
+}
diff --git a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/modification/AbstractCModificationPageWithNodes.java b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/modification/AbstractCModificationPageWithNodes.java
index 4726270523..a6d03b4952 100644
--- a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/modification/AbstractCModificationPageWithNodes.java
+++ b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/modification/AbstractCModificationPageWithNodes.java
@@ -1,31 +1,31 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification;
-
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.AbstractExtensiblePageWithNodes;
-
-/**
- * @since 3.9.0
- */
-public abstract class AbstractCModificationPageWithNodes extends AbstractExtensiblePageWithNodes implements IModifiablePage {
-
- private boolean m_modified;
-
- @Override
- public void markModified() {
- m_modified = true;
- }
-
- @Override
- public boolean isModified() {
- return m_modified;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification;
+
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.AbstractExtensiblePageWithNodes;
+
+/**
+ * @since 3.9.0
+ */
+public abstract class AbstractCModificationPageWithNodes extends AbstractExtensiblePageWithNodes implements IModifiablePage {
+
+ private boolean m_modified;
+
+ @Override
+ public void markModified() {
+ m_modified = true;
+ }
+
+ @Override
+ public boolean isModified() {
+ return m_modified;
+ }
+}
diff --git a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/modification/BModificationPageWithNodes.java b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/modification/BModificationPageWithNodes.java
index 0b06c5ebe9..70d4b5138b 100644
--- a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/modification/BModificationPageWithNodes.java
+++ b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/modification/BModificationPageWithNodes.java
@@ -1,31 +1,31 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification;
-
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.AbstractExtensiblePageWithNodes;
-
-/**
- * @since 3.9.0
- */
-public class BModificationPageWithNodes extends AbstractExtensiblePageWithNodes implements IModifiablePage {
-
- private boolean m_modified;
-
- @Override
- public void markModified() {
- m_modified = true;
- }
-
- @Override
- public boolean isModified() {
- return m_modified;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification;
+
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.AbstractExtensiblePageWithNodes;
+
+/**
+ * @since 3.9.0
+ */
+public class BModificationPageWithNodes extends AbstractExtensiblePageWithNodes implements IModifiablePage {
+
+ private boolean m_modified;
+
+ @Override
+ public void markModified() {
+ m_modified = true;
+ }
+
+ @Override
+ public boolean isModified() {
+ return m_modified;
+ }
+}
diff --git a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/modification/C1ModificationPageWithNodes.java b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/modification/C1ModificationPageWithNodes.java
index e6fffcf458..661eac7f95 100644
--- a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/modification/C1ModificationPageWithNodes.java
+++ b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/modification/C1ModificationPageWithNodes.java
@@ -1,29 +1,29 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification;
-
-/**
- * @since 3.9.0
- */
-public class C1ModificationPageWithNodes extends AbstractCModificationPageWithNodes implements IModifiablePage {
-
- private boolean m_modified;
-
- @Override
- public void markModified() {
- m_modified = true;
- }
-
- @Override
- public boolean isModified() {
- return m_modified;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification;
+
+/**
+ * @since 3.9.0
+ */
+public class C1ModificationPageWithNodes extends AbstractCModificationPageWithNodes implements IModifiablePage {
+
+ private boolean m_modified;
+
+ @Override
+ public void markModified() {
+ m_modified = true;
+ }
+
+ @Override
+ public boolean isModified() {
+ return m_modified;
+ }
+}
diff --git a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/modification/C2ModificationPageWithNodes.java b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/modification/C2ModificationPageWithNodes.java
index 1f6d82631d..f57461466b 100644
--- a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/modification/C2ModificationPageWithNodes.java
+++ b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/modification/C2ModificationPageWithNodes.java
@@ -1,29 +1,29 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification;
-
-/**
- * @since 3.9.0
- */
-public class C2ModificationPageWithNodes extends AbstractCModificationPageWithNodes implements IModifiablePage {
-
- private boolean m_modified;
-
- @Override
- public void markModified() {
- m_modified = true;
- }
-
- @Override
- public boolean isModified() {
- return m_modified;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification;
+
+/**
+ * @since 3.9.0
+ */
+public class C2ModificationPageWithNodes extends AbstractCModificationPageWithNodes implements IModifiablePage {
+
+ private boolean m_modified;
+
+ @Override
+ public void markModified() {
+ m_modified = true;
+ }
+
+ @Override
+ public boolean isModified() {
+ return m_modified;
+ }
+}
diff --git a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/modification/IModifiablePage.java b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/modification/IModifiablePage.java
index 5357cd064c..38b6c49b41 100644
--- a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/modification/IModifiablePage.java
+++ b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/modification/IModifiablePage.java
@@ -1,23 +1,23 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification;
-
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-
-/**
- * @since 3.9.0
- */
-public interface IModifiablePage extends IPage {
-
- void markModified();
-
- boolean isModified();
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification;
+
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+
+/**
+ * @since 3.9.0
+ */
+public interface IModifiablePage extends IPage {
+
+ void markModified();
+
+ boolean isModified();
+}
diff --git a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/modification/MarkingPageModification.java b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/modification/MarkingPageModification.java
index 8c16c817df..cfa2311b5c 100644
--- a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/modification/MarkingPageModification.java
+++ b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/modification/MarkingPageModification.java
@@ -1,27 +1,27 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.IPageModifier;
-
-/**
- * @since 3.9.0
- */
-public class MarkingPageModification implements IPageModifier<IModifiablePage> {
-
- @Override
- public void modify(IOutline outline, IPage parentPage, IModifiablePage page) throws ProcessingException {
- page.markModified();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.IPageModifier;
+
+/**
+ * @since 3.9.0
+ */
+public class MarkingPageModification implements IPageModifier<IModifiablePage> {
+
+ @Override
+ public void modify(IOutline outline, IPage parentPage, IModifiablePage page) throws ProcessingException {
+ page.markModified();
+ }
+}
diff --git a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/modification/PageModificationNodePage.java b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/modification/PageModificationNodePage.java
index 4a4b10a00c..6142471878 100644
--- a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/modification/PageModificationNodePage.java
+++ b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/modification/PageModificationNodePage.java
@@ -1,31 +1,31 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification;
-
-import java.util.Collection;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.AbstractExtensiblePageWithNodes;
-
-/**
- * @since 3.9.0
- */
-public class PageModificationNodePage extends AbstractExtensiblePageWithNodes {
-
- @Override
- protected void execCreateChildPages(Collection<IPage> pageList) throws ProcessingException {
- pageList.add(new AModificationPageWithNodes());
- pageList.add(new BModificationPageWithNodes());
- pageList.add(new C1ModificationPageWithNodes());
- pageList.add(new C2ModificationPageWithNodes());
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification;
+
+import java.util.Collection;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.AbstractExtensiblePageWithNodes;
+
+/**
+ * @since 3.9.0
+ */
+public class PageModificationNodePage extends AbstractExtensiblePageWithNodes {
+
+ @Override
+ protected void execCreateChildPages(Collection<IPage> pageList) throws ProcessingException {
+ pageList.add(new AModificationPageWithNodes());
+ pageList.add(new BModificationPageWithNodes());
+ pageList.add(new C1ModificationPageWithNodes());
+ pageList.add(new C2ModificationPageWithNodes());
+ }
+}
diff --git a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/modification/PageModificationOutline.java b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/modification/PageModificationOutline.java
index c7d82dee6b..984483d5b0 100644
--- a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/modification/PageModificationOutline.java
+++ b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/modification/PageModificationOutline.java
@@ -1,31 +1,31 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification;
-
-import java.util.Collection;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.AbstractExtensibleOutline;
-
-/**
- * @since 3.9.0
- */
-public class PageModificationOutline extends AbstractExtensibleOutline {
-
- @Override
- protected void execCreateChildPages(Collection<IPage> pageList) throws ProcessingException {
- pageList.add(new AModificationPageWithNodes());
- pageList.add(new BModificationPageWithNodes());
- pageList.add(new C1ModificationPageWithNodes());
- pageList.add(new C2ModificationPageWithNodes());
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification;
+
+import java.util.Collection;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.AbstractExtensibleOutline;
+
+/**
+ * @since 3.9.0
+ */
+public class PageModificationOutline extends AbstractExtensibleOutline {
+
+ @Override
+ protected void execCreateChildPages(Collection<IPage> pageList) throws ProcessingException {
+ pageList.add(new AModificationPageWithNodes());
+ pageList.add(new BModificationPageWithNodes());
+ pageList.add(new C1ModificationPageWithNodes());
+ pageList.add(new C2ModificationPageWithNodes());
+ }
+}
diff --git a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/modification/PageModificationTablePage.java b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/modification/PageModificationTablePage.java
index 3fbd047c6a..fad8b75a32 100644
--- a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/modification/PageModificationTablePage.java
+++ b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/modification/PageModificationTablePage.java
@@ -1,51 +1,51 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification;
-
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractStringColumn;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.extension.client.ui.basic.table.AbstractExtensibleTable;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.AbstractExtensiblePageWithTable;
-import org.eclipse.scout.rt.shared.services.common.jdbc.SearchFilter;
-
-/**
- * @since 3.9.0
- */
-public class PageModificationTablePage extends AbstractExtensiblePageWithTable<PageModificationTablePage.Table> {
-
- @Override
- protected IPage execCreateChildPage(ITableRow row) throws ProcessingException {
- return new BModificationPageWithNodes();
- }
-
- @Override
- protected Object[][] execLoadTableData(SearchFilter filter) throws ProcessingException {
- return new Object[][]{{"001"}};
- }
-
- public class Table extends AbstractExtensibleTable {
-
- public IdColumn getIdColumn() {
- return getColumnSet().getColumnByClass(IdColumn.class);
- }
-
- @Order(10)
- public class IdColumn extends AbstractStringColumn {
- @Override
- protected String getConfiguredHeaderText() {
- return "ID";
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.modification;
+
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractStringColumn;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.extension.client.ui.basic.table.AbstractExtensibleTable;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.AbstractExtensiblePageWithTable;
+import org.eclipse.scout.rt.shared.services.common.jdbc.SearchFilter;
+
+/**
+ * @since 3.9.0
+ */
+public class PageModificationTablePage extends AbstractExtensiblePageWithTable<PageModificationTablePage.Table> {
+
+ @Override
+ protected IPage execCreateChildPage(ITableRow row) throws ProcessingException {
+ return new BModificationPageWithNodes();
+ }
+
+ @Override
+ protected Object[][] execLoadTableData(SearchFilter filter) throws ProcessingException {
+ return new Object[][]{{"001"}};
+ }
+
+ public class Table extends AbstractExtensibleTable {
+
+ public IdColumn getIdColumn() {
+ return getColumnSet().getColumnByClass(IdColumn.class);
+ }
+
+ @Order(10)
+ public class IdColumn extends AbstractStringColumn {
+ @Override
+ protected String getConfiguredHeaderText() {
+ return "ID";
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/remove/ARemovePageWithNodes.java b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/remove/ARemovePageWithNodes.java
index cafae0dcd7..0188ae8e00 100644
--- a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/remove/ARemovePageWithNodes.java
+++ b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/remove/ARemovePageWithNodes.java
@@ -1,20 +1,20 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.remove;
-
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.AbstractExtensiblePageWithNodes;
-
-/**
- * @since 3.9.0
- */
-public class ARemovePageWithNodes extends AbstractExtensiblePageWithNodes {
-
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.remove;
+
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.AbstractExtensiblePageWithNodes;
+
+/**
+ * @since 3.9.0
+ */
+public class ARemovePageWithNodes extends AbstractExtensiblePageWithNodes {
+
+}
diff --git a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/remove/AbstractCRemovePageWithNodes.java b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/remove/AbstractCRemovePageWithNodes.java
index 2f553573b8..81c5683a4f 100644
--- a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/remove/AbstractCRemovePageWithNodes.java
+++ b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/remove/AbstractCRemovePageWithNodes.java
@@ -1,20 +1,20 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.remove;
-
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.AbstractExtensiblePageWithNodes;
-
-/**
- * @since 3.9.0
- */
-public abstract class AbstractCRemovePageWithNodes extends AbstractExtensiblePageWithNodes {
-
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.remove;
+
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.AbstractExtensiblePageWithNodes;
+
+/**
+ * @since 3.9.0
+ */
+public abstract class AbstractCRemovePageWithNodes extends AbstractExtensiblePageWithNodes {
+
+}
diff --git a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/remove/BRemovePageWithNodes.java b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/remove/BRemovePageWithNodes.java
index 50c97d6e97..c710772718 100644
--- a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/remove/BRemovePageWithNodes.java
+++ b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/remove/BRemovePageWithNodes.java
@@ -1,20 +1,20 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.remove;
-
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.AbstractExtensiblePageWithNodes;
-
-/**
- * @since 3.9.0
- */
-public class BRemovePageWithNodes extends AbstractExtensiblePageWithNodes {
-
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.remove;
+
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.AbstractExtensiblePageWithNodes;
+
+/**
+ * @since 3.9.0
+ */
+public class BRemovePageWithNodes extends AbstractExtensiblePageWithNodes {
+
+}
diff --git a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/remove/C1RemovePageWithNodes.java b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/remove/C1RemovePageWithNodes.java
index bdff358640..52ebbf3b69 100644
--- a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/remove/C1RemovePageWithNodes.java
+++ b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/remove/C1RemovePageWithNodes.java
@@ -1,20 +1,20 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.remove;
-
-
-
-/**
- * @since 3.9.0
- */
-public class C1RemovePageWithNodes extends AbstractCRemovePageWithNodes {
-
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.remove;
+
+
+
+/**
+ * @since 3.9.0
+ */
+public class C1RemovePageWithNodes extends AbstractCRemovePageWithNodes {
+
+}
diff --git a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/remove/C2RemovePageWithNodes.java b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/remove/C2RemovePageWithNodes.java
index b1aeeba5fe..6b7422a3ca 100644
--- a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/remove/C2RemovePageWithNodes.java
+++ b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/remove/C2RemovePageWithNodes.java
@@ -1,19 +1,19 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.remove;
-
-
-/**
- * @since 3.9.0
- */
-public class C2RemovePageWithNodes extends AbstractCRemovePageWithNodes {
-
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.remove;
+
+
+/**
+ * @since 3.9.0
+ */
+public class C2RemovePageWithNodes extends AbstractCRemovePageWithNodes {
+
+}
diff --git a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/remove/PageRemoveNodePage.java b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/remove/PageRemoveNodePage.java
index 32ed754a92..702ea4f5f9 100644
--- a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/remove/PageRemoveNodePage.java
+++ b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/remove/PageRemoveNodePage.java
@@ -1,31 +1,31 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.remove;
-
-import java.util.Collection;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.AbstractExtensiblePageWithNodes;
-
-/**
- * @since 3.9.0
- */
-public class PageRemoveNodePage extends AbstractExtensiblePageWithNodes {
-
- @Override
- protected void execCreateChildPages(Collection<IPage> pageList) throws ProcessingException {
- pageList.add(new ARemovePageWithNodes());
- pageList.add(new BRemovePageWithNodes());
- pageList.add(new C1RemovePageWithNodes());
- pageList.add(new C2RemovePageWithNodes());
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.remove;
+
+import java.util.Collection;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.AbstractExtensiblePageWithNodes;
+
+/**
+ * @since 3.9.0
+ */
+public class PageRemoveNodePage extends AbstractExtensiblePageWithNodes {
+
+ @Override
+ protected void execCreateChildPages(Collection<IPage> pageList) throws ProcessingException {
+ pageList.add(new ARemovePageWithNodes());
+ pageList.add(new BRemovePageWithNodes());
+ pageList.add(new C1RemovePageWithNodes());
+ pageList.add(new C2RemovePageWithNodes());
+ }
+}
diff --git a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/remove/PageRemoveOutline.java b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/remove/PageRemoveOutline.java
index 4de6fe4dbc..ae72a0fb80 100644
--- a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/remove/PageRemoveOutline.java
+++ b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/fixture/remove/PageRemoveOutline.java
@@ -1,31 +1,31 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.remove;
-
-import java.util.Collection;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.AbstractExtensibleOutline;
-
-/**
- * @since 3.9.0
- */
-public class PageRemoveOutline extends AbstractExtensibleOutline {
-
- @Override
- protected void execCreateChildPages(Collection<IPage> pageList) throws ProcessingException {
- pageList.add(new ARemovePageWithNodes());
- pageList.add(new BRemovePageWithNodes());
- pageList.add(new C1RemovePageWithNodes());
- pageList.add(new C2RemovePageWithNodes());
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.fixture.remove;
+
+import java.util.Collection;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.AbstractExtensibleOutline;
+
+/**
+ * @since 3.9.0
+ */
+public class PageRemoveOutline extends AbstractExtensibleOutline {
+
+ @Override
+ protected void execCreateChildPages(Collection<IPage> pageList) throws ProcessingException {
+ pageList.add(new ARemovePageWithNodes());
+ pageList.add(new BRemovePageWithNodes());
+ pageList.add(new C1RemovePageWithNodes());
+ pageList.add(new C2RemovePageWithNodes());
+ }
+}
diff --git a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/internal/PageAnchorFilterTest.java b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/internal/PageAnchorFilterTest.java
index 2b31301738..fbed1df565 100644
--- a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/internal/PageAnchorFilterTest.java
+++ b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/internal/PageAnchorFilterTest.java
@@ -1,82 +1,82 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.internal;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import org.eclipse.scout.rt.client.ui.desktop.outline.AbstractOutline;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.AbstractPageWithNodes;
-import org.eclipse.scout.testing.client.runner.ScoutClientTestRunner;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-/**
- * @since 3.9.0
- */
-@RunWith(ScoutClientTestRunner.class)
-public class PageAnchorFilterTest {
-
- private P_Outline m_outline;
- private P_OtherOutline m_otherOutline;
- private P_Page m_page;
- private P_OtherPage m_otherPage;
-
- @Before
- public void setup() throws Exception {
- m_outline = new P_Outline();
- m_otherOutline = new P_OtherOutline();
- m_page = new P_Page();
- m_otherPage = new P_OtherPage();
- }
-
- @Test
- public void testAcceptEmpty() {
- PageAnchorFilter filter = new PageAnchorFilter(null, null);
- assertTrue(filter.accept(null, null, null));
- assertTrue(filter.accept(m_outline, null, null));
- assertTrue(filter.accept(null, m_page, null));
- assertTrue(filter.accept(m_outline, m_page, null));
- }
-
- @Test
- public void testAcceptOutlineFilterClass() {
- PageAnchorFilter filter = new PageAnchorFilter(P_Outline.class, null);
- assertFalse(filter.accept(null, null, null));
- assertTrue(filter.accept(m_outline, null, null));
- assertFalse(filter.accept(m_otherOutline, null, null));
- assertFalse(filter.accept(null, m_page, null));
- assertFalse(filter.accept(m_outline, m_page, null));
- }
-
- @Test
- public void testAcceptPageFilterClass() {
- PageAnchorFilter filter = new PageAnchorFilter(null, P_Page.class);
- assertFalse(filter.accept(null, null, null));
- assertFalse(filter.accept(m_outline, null, null));
- assertTrue(filter.accept(null, m_page, null));
- assertFalse(filter.accept(null, m_otherPage, null));
- assertTrue(filter.accept(m_outline, m_page, null));
- }
-
- private static class P_Outline extends AbstractOutline {
- }
-
- private static class P_OtherOutline extends AbstractOutline {
- }
-
- private static class P_Page extends AbstractPageWithNodes {
- }
-
- private static class P_OtherPage extends AbstractPageWithNodes {
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.internal;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.eclipse.scout.rt.client.ui.desktop.outline.AbstractOutline;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.AbstractPageWithNodes;
+import org.eclipse.scout.testing.client.runner.ScoutClientTestRunner;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * @since 3.9.0
+ */
+@RunWith(ScoutClientTestRunner.class)
+public class PageAnchorFilterTest {
+
+ private P_Outline m_outline;
+ private P_OtherOutline m_otherOutline;
+ private P_Page m_page;
+ private P_OtherPage m_otherPage;
+
+ @Before
+ public void setup() throws Exception {
+ m_outline = new P_Outline();
+ m_otherOutline = new P_OtherOutline();
+ m_page = new P_Page();
+ m_otherPage = new P_OtherPage();
+ }
+
+ @Test
+ public void testAcceptEmpty() {
+ PageAnchorFilter filter = new PageAnchorFilter(null, null);
+ assertTrue(filter.accept(null, null, null));
+ assertTrue(filter.accept(m_outline, null, null));
+ assertTrue(filter.accept(null, m_page, null));
+ assertTrue(filter.accept(m_outline, m_page, null));
+ }
+
+ @Test
+ public void testAcceptOutlineFilterClass() {
+ PageAnchorFilter filter = new PageAnchorFilter(P_Outline.class, null);
+ assertFalse(filter.accept(null, null, null));
+ assertTrue(filter.accept(m_outline, null, null));
+ assertFalse(filter.accept(m_otherOutline, null, null));
+ assertFalse(filter.accept(null, m_page, null));
+ assertFalse(filter.accept(m_outline, m_page, null));
+ }
+
+ @Test
+ public void testAcceptPageFilterClass() {
+ PageAnchorFilter filter = new PageAnchorFilter(null, P_Page.class);
+ assertFalse(filter.accept(null, null, null));
+ assertFalse(filter.accept(m_outline, null, null));
+ assertTrue(filter.accept(null, m_page, null));
+ assertFalse(filter.accept(null, m_otherPage, null));
+ assertTrue(filter.accept(m_outline, m_page, null));
+ }
+
+ private static class P_Outline extends AbstractOutline {
+ }
+
+ private static class P_OtherOutline extends AbstractOutline {
+ }
+
+ private static class P_Page extends AbstractPageWithNodes {
+ }
+
+ private static class P_OtherPage extends AbstractPageWithNodes {
+ }
+}
diff --git a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/internal/PageContributionExtensionTest.java b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/internal/PageContributionExtensionTest.java
index 2bb8b9af67..283f7d7cf8 100644
--- a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/internal/PageContributionExtensionTest.java
+++ b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/internal/PageContributionExtensionTest.java
@@ -1,266 +1,266 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.internal;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.desktop.outline.AbstractOutline;
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.AbstractPageWithNodes;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithNodes;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * @since 3.9.0
- */
-public class PageContributionExtensionTest {
-
- private P_Outline m_outline;
- private P_OtherOutline m_otherOutline;
- private P_ParentPage m_parentPage;
- private P_OtherParentPage m_otherParentPage;
-
- @Before
- public void before() {
- m_outline = new P_Outline();
- m_otherOutline = new P_OtherOutline();
- m_parentPage = new P_ParentPage();
- m_otherParentPage = new P_OtherParentPage();
- }
-
- /////////////////////////////////////////////////////////
- // test default constructor //
- /////////////////////////////////////////////////////////
-
- @Test
- public void testCreateContributionDefaultConstructor() throws Exception {
- assertCreateContribution(Constructor.Default, DefaultConstructorTestPage.class, m_outline, null);
- assertCreateContribution(Constructor.Default, DefaultConstructorTestPage.class, m_outline, m_parentPage);
- assertCreateContribution(Constructor.Default, DefaultConstructorTestPage.class, m_otherOutline, m_otherParentPage);
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testCreateContributionMissingParameterOutline() throws Exception {
- assertCreateContribution(null, DefaultConstructorTestPage.class, null, null);
- }
-
- /////////////////////////////////////////////////////////
- // test constructor with parent page //
- /////////////////////////////////////////////////////////
-
- @Test
- public void testCreateContributionParentPageConstructor() throws Exception {
- assertCreateContribution(Constructor.Default, PageConstructorTestPage.class, m_outline, null);
- assertCreateContribution(Constructor.ParentPage, PageConstructorTestPage.class, m_outline, m_parentPage);
- assertCreateContribution(Constructor.Default, PageConstructorTestPage.class, m_otherOutline, m_otherParentPage);
- }
-
- @Test(expected = ProcessingException.class)
- public void testCreateContributionParentPageMissingConstructor() throws Exception {
- assertCreateContribution(null, OtherPageConstructorTestPage.class, m_outline, m_parentPage);
- }
-
- @Test
- public void testCreateContributionOtherParentPageConstructor() throws Exception {
- assertCreateContribution(Constructor.OtherParentPage, OtherPageConstructorTestPage.class, m_outline, m_otherParentPage);
- assertCreateContribution(Constructor.OtherParentPage, OtherPageConstructorTestPage.class, m_outline, null);
- }
-
- @Test
- public void testCreateContributionOthrParentPageConstructorMissingConstructor() throws Exception {
- // here the outline constructor is used because the page's type cannot be determined
- assertCreateContribution(Constructor.OtherOutline, OtherOutlineConstructorTestPage.class, m_outline, null);
- }
-
- @Test
- public void testCreateContributionParentPageAndOtherParentPageConstructor() throws Exception {
- assertCreateContribution(Constructor.ParentPage, PageAndOtherPageConstructorTestPage.class, m_outline, m_parentPage);
- assertCreateContribution(Constructor.OtherParentPage, PageAndOtherPageConstructorTestPage.class, m_outline, m_otherParentPage);
- }
-
- /////////////////////////////////////////////////////////
- // test constructor with outline //
- /////////////////////////////////////////////////////////
-
- @Test
- public void testCreateContributionOutlineConstructor() throws Exception {
- assertCreateContribution(Constructor.Outline, OutlineConstructorTestPage.class, m_outline, null);
- assertCreateContribution(Constructor.Outline, OutlineConstructorTestPage.class, m_outline, m_parentPage);
- assertCreateContribution(Constructor.Default, OutlineConstructorTestPage.class, m_otherOutline, m_otherParentPage);
- }
-
- @Test(expected = ProcessingException.class)
- public void testCreateContributionOutlineMissingConstructor() throws Exception {
- assertCreateContribution(null, OtherOutlineConstructorTestPage.class, m_outline, m_parentPage);
- }
-
- @Test
- public void testCreateContributionOtherOutlineConstructor() throws Exception {
- assertCreateContribution(Constructor.OtherOutline, OtherOutlineConstructorTestPage.class, m_otherOutline, m_otherParentPage);
- }
-
- /////////////////////////////////////////////////////////
- // test constructor with parent page and outline //
- /////////////////////////////////////////////////////////
-
- @Test
- public void testCreateContributionParentPageAndOutlineConstructor() throws Exception {
- assertCreateContribution(Constructor.ParentPage, ParentPageAndOutlineConstructorTestPage.class, m_outline, m_parentPage);
- assertCreateContribution(Constructor.ParentPageOutline, ParentPageAndOutlineConstructorTestPage.class, m_outline, null);
- assertCreateContribution(Constructor.ParentPage, ParentPageAndOutlineConstructorTestPage.class, m_otherOutline, m_parentPage);
- assertCreateContribution(Constructor.Default, ParentPageAndOutlineConstructorTestPage.class, m_otherOutline, null);
- assertCreateContribution(Constructor.Default, ParentPageAndOutlineConstructorTestPage.class, m_otherOutline, m_otherParentPage);
- }
-
- @Test
- public void testCreateContributionParentPageAndOtherOutlineConstructor() throws Exception {
- assertCreateContribution(Constructor.ParentPage, ParentPageAndOtherOutlineConstructorTestPage.class, m_otherOutline, m_parentPage);
- assertCreateContribution(Constructor.OtherOutlineParentPage, ParentPageAndOtherOutlineConstructorTestPage.class, m_otherOutline, null);
- assertCreateContribution(Constructor.ParentPage, ParentPageAndOtherOutlineConstructorTestPage.class, m_outline, m_parentPage);
- }
-
- @Test(expected = ProcessingException.class)
- public void testCreateContributionParentPageAndOtherOutlineMissingConstructor() throws Exception {
- assertCreateContribution(null, ParentPageAndOtherOutlineConstructorTestPage.class, m_otherOutline, m_otherParentPage);
- }
-
- private static void assertCreateContribution(Constructor expectedConstructor, Class<? extends AbstractConstructorTestPage> pageClass, IOutline outline, IPageWithNodes parentPage) throws ProcessingException {
- PageContributionExtension ext = new PageContributionExtension(pageClass, 10);
- IPage page = ext.createContribution(outline, parentPage);
- assertNotNull(page);
- assertEquals(ext.getPageClass(), page.getClass());
- assertEquals(expectedConstructor, ((AbstractConstructorTestPage) page).m_constructedBy);
- }
-
- public static class P_Outline extends AbstractOutline {
- }
-
- public static class P_OtherOutline extends AbstractOutline {
- }
-
- public static class P_ParentPage extends AbstractPageWithNodes {
- }
-
- public static class P_OtherParentPage extends AbstractPageWithNodes {
- }
-
- public enum Constructor {
- Default,
- Outline,
- OtherOutline,
- ParentPage,
- OtherParentPage,
- OutlineParentPage,
- ParentPageOutline,
- OtherOutlineParentPage
- }
-
- public abstract static class AbstractConstructorTestPage extends AbstractPageWithNodes {
- public Constructor m_constructedBy;
- }
-
- public static class DefaultConstructorTestPage extends AbstractConstructorTestPage {
-
- public DefaultConstructorTestPage() {
- m_constructedBy = Constructor.Default;
- }
- }
-
- /////////////////////////////////////////////////////////
- // parent constructor page test classes //
- /////////////////////////////////////////////////////////
-
- public static class PageConstructorTestPage extends AbstractConstructorTestPage {
-
- public PageConstructorTestPage() {
- m_constructedBy = Constructor.Default;
- }
-
- public PageConstructorTestPage(P_ParentPage parentPage) {
- m_constructedBy = Constructor.ParentPage;
- }
- }
-
- public static class OtherPageConstructorTestPage extends AbstractConstructorTestPage {
-
- public OtherPageConstructorTestPage(P_OtherParentPage parentPage) {
- m_constructedBy = Constructor.OtherParentPage;
- }
- }
-
- public static class PageAndOtherPageConstructorTestPage extends AbstractConstructorTestPage {
-
- public PageAndOtherPageConstructorTestPage(P_ParentPage parentPage) {
- m_constructedBy = Constructor.ParentPage;
- }
-
- public PageAndOtherPageConstructorTestPage(P_OtherParentPage parentPage) {
- m_constructedBy = Constructor.OtherParentPage;
- }
- }
-
- /////////////////////////////////////////////////////////
- // outline constructor test classes //
- /////////////////////////////////////////////////////////
-
- public static class OutlineConstructorTestPage extends AbstractConstructorTestPage {
-
- public OutlineConstructorTestPage() {
- m_constructedBy = Constructor.Default;
- }
-
- public OutlineConstructorTestPage(P_Outline outline) {
- m_constructedBy = Constructor.Outline;
- }
- }
-
- public static class OtherOutlineConstructorTestPage extends AbstractConstructorTestPage {
-
- public OtherOutlineConstructorTestPage(P_OtherOutline outline) {
- m_constructedBy = Constructor.OtherOutline;
- }
- }
-
- /////////////////////////////////////////////////////////
- // page and outline constructor test classes //
- /////////////////////////////////////////////////////////
-
- public static class ParentPageAndOutlineConstructorTestPage extends AbstractConstructorTestPage {
-
- public ParentPageAndOutlineConstructorTestPage() {
- m_constructedBy = Constructor.Default;
- }
-
- public ParentPageAndOutlineConstructorTestPage(P_ParentPage parentPage) {
- m_constructedBy = Constructor.ParentPage;
- }
-
- public ParentPageAndOutlineConstructorTestPage(P_ParentPage parentPage, P_Outline outline) {
- m_constructedBy = Constructor.ParentPageOutline;
- }
- }
-
- public static class ParentPageAndOtherOutlineConstructorTestPage extends AbstractConstructorTestPage {
-
- public ParentPageAndOtherOutlineConstructorTestPage(P_ParentPage parentPage) {
- m_constructedBy = Constructor.ParentPage;
- }
-
- public ParentPageAndOtherOutlineConstructorTestPage(P_OtherOutline outline, P_ParentPage parentPage) {
- m_constructedBy = Constructor.OtherOutlineParentPage;
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.internal;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.desktop.outline.AbstractOutline;
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.AbstractPageWithNodes;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithNodes;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * @since 3.9.0
+ */
+public class PageContributionExtensionTest {
+
+ private P_Outline m_outline;
+ private P_OtherOutline m_otherOutline;
+ private P_ParentPage m_parentPage;
+ private P_OtherParentPage m_otherParentPage;
+
+ @Before
+ public void before() {
+ m_outline = new P_Outline();
+ m_otherOutline = new P_OtherOutline();
+ m_parentPage = new P_ParentPage();
+ m_otherParentPage = new P_OtherParentPage();
+ }
+
+ /////////////////////////////////////////////////////////
+ // test default constructor //
+ /////////////////////////////////////////////////////////
+
+ @Test
+ public void testCreateContributionDefaultConstructor() throws Exception {
+ assertCreateContribution(Constructor.Default, DefaultConstructorTestPage.class, m_outline, null);
+ assertCreateContribution(Constructor.Default, DefaultConstructorTestPage.class, m_outline, m_parentPage);
+ assertCreateContribution(Constructor.Default, DefaultConstructorTestPage.class, m_otherOutline, m_otherParentPage);
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testCreateContributionMissingParameterOutline() throws Exception {
+ assertCreateContribution(null, DefaultConstructorTestPage.class, null, null);
+ }
+
+ /////////////////////////////////////////////////////////
+ // test constructor with parent page //
+ /////////////////////////////////////////////////////////
+
+ @Test
+ public void testCreateContributionParentPageConstructor() throws Exception {
+ assertCreateContribution(Constructor.Default, PageConstructorTestPage.class, m_outline, null);
+ assertCreateContribution(Constructor.ParentPage, PageConstructorTestPage.class, m_outline, m_parentPage);
+ assertCreateContribution(Constructor.Default, PageConstructorTestPage.class, m_otherOutline, m_otherParentPage);
+ }
+
+ @Test(expected = ProcessingException.class)
+ public void testCreateContributionParentPageMissingConstructor() throws Exception {
+ assertCreateContribution(null, OtherPageConstructorTestPage.class, m_outline, m_parentPage);
+ }
+
+ @Test
+ public void testCreateContributionOtherParentPageConstructor() throws Exception {
+ assertCreateContribution(Constructor.OtherParentPage, OtherPageConstructorTestPage.class, m_outline, m_otherParentPage);
+ assertCreateContribution(Constructor.OtherParentPage, OtherPageConstructorTestPage.class, m_outline, null);
+ }
+
+ @Test
+ public void testCreateContributionOthrParentPageConstructorMissingConstructor() throws Exception {
+ // here the outline constructor is used because the page's type cannot be determined
+ assertCreateContribution(Constructor.OtherOutline, OtherOutlineConstructorTestPage.class, m_outline, null);
+ }
+
+ @Test
+ public void testCreateContributionParentPageAndOtherParentPageConstructor() throws Exception {
+ assertCreateContribution(Constructor.ParentPage, PageAndOtherPageConstructorTestPage.class, m_outline, m_parentPage);
+ assertCreateContribution(Constructor.OtherParentPage, PageAndOtherPageConstructorTestPage.class, m_outline, m_otherParentPage);
+ }
+
+ /////////////////////////////////////////////////////////
+ // test constructor with outline //
+ /////////////////////////////////////////////////////////
+
+ @Test
+ public void testCreateContributionOutlineConstructor() throws Exception {
+ assertCreateContribution(Constructor.Outline, OutlineConstructorTestPage.class, m_outline, null);
+ assertCreateContribution(Constructor.Outline, OutlineConstructorTestPage.class, m_outline, m_parentPage);
+ assertCreateContribution(Constructor.Default, OutlineConstructorTestPage.class, m_otherOutline, m_otherParentPage);
+ }
+
+ @Test(expected = ProcessingException.class)
+ public void testCreateContributionOutlineMissingConstructor() throws Exception {
+ assertCreateContribution(null, OtherOutlineConstructorTestPage.class, m_outline, m_parentPage);
+ }
+
+ @Test
+ public void testCreateContributionOtherOutlineConstructor() throws Exception {
+ assertCreateContribution(Constructor.OtherOutline, OtherOutlineConstructorTestPage.class, m_otherOutline, m_otherParentPage);
+ }
+
+ /////////////////////////////////////////////////////////
+ // test constructor with parent page and outline //
+ /////////////////////////////////////////////////////////
+
+ @Test
+ public void testCreateContributionParentPageAndOutlineConstructor() throws Exception {
+ assertCreateContribution(Constructor.ParentPage, ParentPageAndOutlineConstructorTestPage.class, m_outline, m_parentPage);
+ assertCreateContribution(Constructor.ParentPageOutline, ParentPageAndOutlineConstructorTestPage.class, m_outline, null);
+ assertCreateContribution(Constructor.ParentPage, ParentPageAndOutlineConstructorTestPage.class, m_otherOutline, m_parentPage);
+ assertCreateContribution(Constructor.Default, ParentPageAndOutlineConstructorTestPage.class, m_otherOutline, null);
+ assertCreateContribution(Constructor.Default, ParentPageAndOutlineConstructorTestPage.class, m_otherOutline, m_otherParentPage);
+ }
+
+ @Test
+ public void testCreateContributionParentPageAndOtherOutlineConstructor() throws Exception {
+ assertCreateContribution(Constructor.ParentPage, ParentPageAndOtherOutlineConstructorTestPage.class, m_otherOutline, m_parentPage);
+ assertCreateContribution(Constructor.OtherOutlineParentPage, ParentPageAndOtherOutlineConstructorTestPage.class, m_otherOutline, null);
+ assertCreateContribution(Constructor.ParentPage, ParentPageAndOtherOutlineConstructorTestPage.class, m_outline, m_parentPage);
+ }
+
+ @Test(expected = ProcessingException.class)
+ public void testCreateContributionParentPageAndOtherOutlineMissingConstructor() throws Exception {
+ assertCreateContribution(null, ParentPageAndOtherOutlineConstructorTestPage.class, m_otherOutline, m_otherParentPage);
+ }
+
+ private static void assertCreateContribution(Constructor expectedConstructor, Class<? extends AbstractConstructorTestPage> pageClass, IOutline outline, IPageWithNodes parentPage) throws ProcessingException {
+ PageContributionExtension ext = new PageContributionExtension(pageClass, 10);
+ IPage page = ext.createContribution(outline, parentPage);
+ assertNotNull(page);
+ assertEquals(ext.getPageClass(), page.getClass());
+ assertEquals(expectedConstructor, ((AbstractConstructorTestPage) page).m_constructedBy);
+ }
+
+ public static class P_Outline extends AbstractOutline {
+ }
+
+ public static class P_OtherOutline extends AbstractOutline {
+ }
+
+ public static class P_ParentPage extends AbstractPageWithNodes {
+ }
+
+ public static class P_OtherParentPage extends AbstractPageWithNodes {
+ }
+
+ public enum Constructor {
+ Default,
+ Outline,
+ OtherOutline,
+ ParentPage,
+ OtherParentPage,
+ OutlineParentPage,
+ ParentPageOutline,
+ OtherOutlineParentPage
+ }
+
+ public abstract static class AbstractConstructorTestPage extends AbstractPageWithNodes {
+ public Constructor m_constructedBy;
+ }
+
+ public static class DefaultConstructorTestPage extends AbstractConstructorTestPage {
+
+ public DefaultConstructorTestPage() {
+ m_constructedBy = Constructor.Default;
+ }
+ }
+
+ /////////////////////////////////////////////////////////
+ // parent constructor page test classes //
+ /////////////////////////////////////////////////////////
+
+ public static class PageConstructorTestPage extends AbstractConstructorTestPage {
+
+ public PageConstructorTestPage() {
+ m_constructedBy = Constructor.Default;
+ }
+
+ public PageConstructorTestPage(P_ParentPage parentPage) {
+ m_constructedBy = Constructor.ParentPage;
+ }
+ }
+
+ public static class OtherPageConstructorTestPage extends AbstractConstructorTestPage {
+
+ public OtherPageConstructorTestPage(P_OtherParentPage parentPage) {
+ m_constructedBy = Constructor.OtherParentPage;
+ }
+ }
+
+ public static class PageAndOtherPageConstructorTestPage extends AbstractConstructorTestPage {
+
+ public PageAndOtherPageConstructorTestPage(P_ParentPage parentPage) {
+ m_constructedBy = Constructor.ParentPage;
+ }
+
+ public PageAndOtherPageConstructorTestPage(P_OtherParentPage parentPage) {
+ m_constructedBy = Constructor.OtherParentPage;
+ }
+ }
+
+ /////////////////////////////////////////////////////////
+ // outline constructor test classes //
+ /////////////////////////////////////////////////////////
+
+ public static class OutlineConstructorTestPage extends AbstractConstructorTestPage {
+
+ public OutlineConstructorTestPage() {
+ m_constructedBy = Constructor.Default;
+ }
+
+ public OutlineConstructorTestPage(P_Outline outline) {
+ m_constructedBy = Constructor.Outline;
+ }
+ }
+
+ public static class OtherOutlineConstructorTestPage extends AbstractConstructorTestPage {
+
+ public OtherOutlineConstructorTestPage(P_OtherOutline outline) {
+ m_constructedBy = Constructor.OtherOutline;
+ }
+ }
+
+ /////////////////////////////////////////////////////////
+ // page and outline constructor test classes //
+ /////////////////////////////////////////////////////////
+
+ public static class ParentPageAndOutlineConstructorTestPage extends AbstractConstructorTestPage {
+
+ public ParentPageAndOutlineConstructorTestPage() {
+ m_constructedBy = Constructor.Default;
+ }
+
+ public ParentPageAndOutlineConstructorTestPage(P_ParentPage parentPage) {
+ m_constructedBy = Constructor.ParentPage;
+ }
+
+ public ParentPageAndOutlineConstructorTestPage(P_ParentPage parentPage, P_Outline outline) {
+ m_constructedBy = Constructor.ParentPageOutline;
+ }
+ }
+
+ public static class ParentPageAndOtherOutlineConstructorTestPage extends AbstractConstructorTestPage {
+
+ public ParentPageAndOtherOutlineConstructorTestPage(P_ParentPage parentPage) {
+ m_constructedBy = Constructor.ParentPage;
+ }
+
+ public ParentPageAndOtherOutlineConstructorTestPage(P_OtherOutline outline, P_ParentPage parentPage) {
+ m_constructedBy = Constructor.OtherOutlineParentPage;
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/internal/PageExtensionTest.java b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/internal/PageExtensionTest.java
index 8a805d093a..4488801a99 100644
--- a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/internal/PageExtensionTest.java
+++ b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/internal/PageExtensionTest.java
@@ -1,103 +1,103 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.internal;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import org.easymock.EasyMock;
-import org.eclipse.scout.rt.client.ui.desktop.outline.AbstractOutline;
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.AbstractPageWithNodes;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.IPageExtensionFilter;
-import org.eclipse.scout.testing.client.runner.ScoutClientTestRunner;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-/**
- * Test cases for {@link AbstractPageExtension}.
- * <p/>
- * <b>Note</b>: This class must not be called <em>Abstract</em>PageExtensionTest because the JUnit test case browser
- * ignores classes starting with <em>Abstract</em>.
- *
- * @since 3.9.0
- */
-@RunWith(ScoutClientTestRunner.class)
-public class PageExtensionTest {
-
- private P_Outline m_outline;
- private P_OtherOutline m_otherOutline;
- private P_Page m_page;
- private P_OtherPage m_otherPage;
-
- @Before
- public void setup() throws Exception {
- m_outline = new P_Outline();
- m_otherOutline = new P_OtherOutline();
- m_page = new P_Page();
- m_otherPage = new P_OtherPage();
- }
-
- @Test
- public void testAcceptContextNoContextFilter() throws Exception {
- P_PageExtension pageExtension = new P_PageExtension(null);
- assertTrue(pageExtension.accept(null, null, null));
- assertTrue(pageExtension.accept(m_outline, null, null));
- assertTrue(pageExtension.accept(m_outline, m_page, null));
- assertTrue(pageExtension.accept(m_outline, m_otherPage, null));
- assertTrue(pageExtension.accept(m_otherOutline, m_page, null));
- assertTrue(pageExtension.accept(m_otherOutline, m_otherPage, null));
- }
-
- @Test
- public void testAcceptWithFilter() {
- IPageExtensionFilter filter = EasyMock.createMock(IPageExtensionFilter.class);
- EasyMock.expect(filter.accept(EasyMock.<IOutline> anyObject(), EasyMock.<IPage> anyObject(), EasyMock.<IPage> anyObject())).andStubReturn(true);
- P_PageExtension contrib = new P_PageExtension(filter);
- EasyMock.replay(filter);
-
- assertTrue(contrib.accept(null, null, null));
- assertTrue(contrib.accept(m_outline, null, null));
- assertTrue(contrib.accept(null, m_page, null));
- }
-
- @Test
- public void testRejectWithFilter() {
- IPageExtensionFilter filter = EasyMock.createMock(IPageExtensionFilter.class);
- EasyMock.expect(filter.accept(EasyMock.<IOutline> anyObject(), EasyMock.<IPage> anyObject(), EasyMock.<IPage> anyObject())).andStubReturn(false);
- P_PageExtension contrib = new P_PageExtension(filter);
- EasyMock.replay(filter);
-
- assertFalse(contrib.accept(null, null, null));
- assertFalse(contrib.accept(m_outline, null, null));
- assertFalse(contrib.accept(null, m_page, null));
- }
-
- private static class P_PageExtension extends AbstractPageExtension {
- public P_PageExtension(IPageExtensionFilter pageFilter) {
- super(pageFilter);
- }
- }
-
- private static class P_Outline extends AbstractOutline {
- }
-
- private static class P_OtherOutline extends AbstractOutline {
- }
-
- private static class P_Page extends AbstractPageWithNodes {
- }
-
- private static class P_OtherPage extends AbstractPageWithNodes {
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.internal;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.easymock.EasyMock;
+import org.eclipse.scout.rt.client.ui.desktop.outline.AbstractOutline;
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.AbstractPageWithNodes;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.IPageExtensionFilter;
+import org.eclipse.scout.testing.client.runner.ScoutClientTestRunner;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * Test cases for {@link AbstractPageExtension}.
+ * <p/>
+ * <b>Note</b>: This class must not be called <em>Abstract</em>PageExtensionTest because the JUnit test case browser
+ * ignores classes starting with <em>Abstract</em>.
+ *
+ * @since 3.9.0
+ */
+@RunWith(ScoutClientTestRunner.class)
+public class PageExtensionTest {
+
+ private P_Outline m_outline;
+ private P_OtherOutline m_otherOutline;
+ private P_Page m_page;
+ private P_OtherPage m_otherPage;
+
+ @Before
+ public void setup() throws Exception {
+ m_outline = new P_Outline();
+ m_otherOutline = new P_OtherOutline();
+ m_page = new P_Page();
+ m_otherPage = new P_OtherPage();
+ }
+
+ @Test
+ public void testAcceptContextNoContextFilter() throws Exception {
+ P_PageExtension pageExtension = new P_PageExtension(null);
+ assertTrue(pageExtension.accept(null, null, null));
+ assertTrue(pageExtension.accept(m_outline, null, null));
+ assertTrue(pageExtension.accept(m_outline, m_page, null));
+ assertTrue(pageExtension.accept(m_outline, m_otherPage, null));
+ assertTrue(pageExtension.accept(m_otherOutline, m_page, null));
+ assertTrue(pageExtension.accept(m_otherOutline, m_otherPage, null));
+ }
+
+ @Test
+ public void testAcceptWithFilter() {
+ IPageExtensionFilter filter = EasyMock.createMock(IPageExtensionFilter.class);
+ EasyMock.expect(filter.accept(EasyMock.<IOutline> anyObject(), EasyMock.<IPage> anyObject(), EasyMock.<IPage> anyObject())).andStubReturn(true);
+ P_PageExtension contrib = new P_PageExtension(filter);
+ EasyMock.replay(filter);
+
+ assertTrue(contrib.accept(null, null, null));
+ assertTrue(contrib.accept(m_outline, null, null));
+ assertTrue(contrib.accept(null, m_page, null));
+ }
+
+ @Test
+ public void testRejectWithFilter() {
+ IPageExtensionFilter filter = EasyMock.createMock(IPageExtensionFilter.class);
+ EasyMock.expect(filter.accept(EasyMock.<IOutline> anyObject(), EasyMock.<IPage> anyObject(), EasyMock.<IPage> anyObject())).andStubReturn(false);
+ P_PageExtension contrib = new P_PageExtension(filter);
+ EasyMock.replay(filter);
+
+ assertFalse(contrib.accept(null, null, null));
+ assertFalse(contrib.accept(m_outline, null, null));
+ assertFalse(contrib.accept(null, m_page, null));
+ }
+
+ private static class P_PageExtension extends AbstractPageExtension {
+ public P_PageExtension(IPageExtensionFilter pageFilter) {
+ super(pageFilter);
+ }
+ }
+
+ private static class P_Outline extends AbstractOutline {
+ }
+
+ private static class P_OtherOutline extends AbstractOutline {
+ }
+
+ private static class P_Page extends AbstractPageWithNodes {
+ }
+
+ private static class P_OtherPage extends AbstractPageWithNodes {
+ }
+}
diff --git a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/internal/PageModificationExtensionTest.java b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/internal/PageModificationExtensionTest.java
index 4365bf2bc5..b944459121 100644
--- a/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/internal/PageModificationExtensionTest.java
+++ b/org.eclipse.scout.rt.extension.client.test.fragment/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/internal/PageModificationExtensionTest.java
@@ -1,140 +1,140 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.internal;
-
-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 org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.desktop.outline.AbstractOutline;
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.AbstractPageWithNodes;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.IPageModifier;
-import org.eclipse.scout.testing.client.runner.ScoutClientTestRunner;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-/**
- * @since 3.9.0
- */
-@RunWith(ScoutClientTestRunner.class)
-public class PageModificationExtensionTest {
-
- private P_Outline m_outline;
- private P_OtherOutline m_otherOutline;
- private P_Page m_page;
- private P_OtherPage m_otherPage;
-
- @Before
- public void setup() throws Exception {
- m_outline = new P_Outline();
- m_otherOutline = new P_OtherOutline();
- m_page = new P_Page();
- m_otherPage = new P_OtherPage();
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testConstructorNullPageClass() {
- new PageModificationExtension(null, P_PageModifier.class);
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testConstructorNullPageModifier() {
- new PageModificationExtension(P_Page.class, null);
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testConstructorUnassinablePageClassAndGenericPageOnPageModification() {
- new PageModificationExtension(P_OtherPage.class, P_PageModifier.class);
- }
-
- @Test
- public void testCreatePageModifier() throws Exception {
- PageModificationExtension pageModification = new PageModificationExtension(P_Page.class, P_PageModifier.class);
- IPageModifier<? extends IPage> pageModifier = pageModification.createPageModifier();
- assertNotNull(pageModifier);
- assertEquals(P_PageModifier.class, pageModifier.getClass());
- }
-
- @Test
- public void testCreatePageModifierConstructorThrowingException() throws Exception {
- PageModificationExtension pageModification = new PageModificationExtension(P_Page.class, P_PageModifierConstructorThrowingException.class);
- pageModification.createPageModifier();
- }
-
- @Test(expected = ProcessingException.class)
- public void testCreatePageModifierConstructorWithParameter() throws Exception {
- PageModificationExtension pageModification = new PageModificationExtension(P_Page.class, P_PageModifierConstructorWithParameter.class);
- pageModification.createPageModifier();
- }
-
- @Test
- public void testAcceptWithoutContext() {
- PageModificationExtension pageModification = new PageModificationExtension(P_Page.class, P_PageModifier.class);
-
- assertFalse(pageModification.accept(null, null, null));
- assertTrue(pageModification.accept(null, null, m_page));
- assertTrue(pageModification.accept(m_outline, null, m_page));
- assertTrue(pageModification.accept(m_outline, m_otherPage, m_page));
-
- assertFalse(pageModification.accept(null, null, m_otherPage));
- }
-
- public static class P_PageModifier implements IPageModifier<P_Page> {
-
- private IOutline m_outline;
- private IPage m_parentPage;
- private IPage m_page;
-
- @Override
- public void modify(IOutline outline, IPage parentPage, P_Page page) throws ProcessingException {
- m_outline = outline;
- m_parentPage = parentPage;
- m_page = page;
- }
- }
-
- public static class P_PageModifierConstructorThrowingException implements IPageModifier<IPage> {
-
- public P_PageModifierConstructorThrowingException() throws Exception {
- }
-
- @Override
- public void modify(IOutline outline, IPage parentPage, IPage page) throws ProcessingException {
- }
- }
-
- public static class P_PageModifierConstructorWithParameter implements IPageModifier<IPage> {
-
- public P_PageModifierConstructorWithParameter(String s) throws Exception {
- }
-
- @Override
- public void modify(IOutline outline, IPage parentPage, IPage page) throws ProcessingException {
- }
- }
-
- private static class P_Outline extends AbstractOutline {
- }
-
- private static class P_OtherOutline extends AbstractOutline {
- }
-
- private static class P_Page extends AbstractPageWithNodes {
- }
-
- private static class P_OtherPage extends AbstractPageWithNodes {
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.internal;
+
+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 org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.desktop.outline.AbstractOutline;
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.AbstractPageWithNodes;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.IPageModifier;
+import org.eclipse.scout.testing.client.runner.ScoutClientTestRunner;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * @since 3.9.0
+ */
+@RunWith(ScoutClientTestRunner.class)
+public class PageModificationExtensionTest {
+
+ private P_Outline m_outline;
+ private P_OtherOutline m_otherOutline;
+ private P_Page m_page;
+ private P_OtherPage m_otherPage;
+
+ @Before
+ public void setup() throws Exception {
+ m_outline = new P_Outline();
+ m_otherOutline = new P_OtherOutline();
+ m_page = new P_Page();
+ m_otherPage = new P_OtherPage();
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testConstructorNullPageClass() {
+ new PageModificationExtension(null, P_PageModifier.class);
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testConstructorNullPageModifier() {
+ new PageModificationExtension(P_Page.class, null);
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testConstructorUnassinablePageClassAndGenericPageOnPageModification() {
+ new PageModificationExtension(P_OtherPage.class, P_PageModifier.class);
+ }
+
+ @Test
+ public void testCreatePageModifier() throws Exception {
+ PageModificationExtension pageModification = new PageModificationExtension(P_Page.class, P_PageModifier.class);
+ IPageModifier<? extends IPage> pageModifier = pageModification.createPageModifier();
+ assertNotNull(pageModifier);
+ assertEquals(P_PageModifier.class, pageModifier.getClass());
+ }
+
+ @Test
+ public void testCreatePageModifierConstructorThrowingException() throws Exception {
+ PageModificationExtension pageModification = new PageModificationExtension(P_Page.class, P_PageModifierConstructorThrowingException.class);
+ pageModification.createPageModifier();
+ }
+
+ @Test(expected = ProcessingException.class)
+ public void testCreatePageModifierConstructorWithParameter() throws Exception {
+ PageModificationExtension pageModification = new PageModificationExtension(P_Page.class, P_PageModifierConstructorWithParameter.class);
+ pageModification.createPageModifier();
+ }
+
+ @Test
+ public void testAcceptWithoutContext() {
+ PageModificationExtension pageModification = new PageModificationExtension(P_Page.class, P_PageModifier.class);
+
+ assertFalse(pageModification.accept(null, null, null));
+ assertTrue(pageModification.accept(null, null, m_page));
+ assertTrue(pageModification.accept(m_outline, null, m_page));
+ assertTrue(pageModification.accept(m_outline, m_otherPage, m_page));
+
+ assertFalse(pageModification.accept(null, null, m_otherPage));
+ }
+
+ public static class P_PageModifier implements IPageModifier<P_Page> {
+
+ private IOutline m_outline;
+ private IPage m_parentPage;
+ private IPage m_page;
+
+ @Override
+ public void modify(IOutline outline, IPage parentPage, P_Page page) throws ProcessingException {
+ m_outline = outline;
+ m_parentPage = parentPage;
+ m_page = page;
+ }
+ }
+
+ public static class P_PageModifierConstructorThrowingException implements IPageModifier<IPage> {
+
+ public P_PageModifierConstructorThrowingException() throws Exception {
+ }
+
+ @Override
+ public void modify(IOutline outline, IPage parentPage, IPage page) throws ProcessingException {
+ }
+ }
+
+ public static class P_PageModifierConstructorWithParameter implements IPageModifier<IPage> {
+
+ public P_PageModifierConstructorWithParameter(String s) throws Exception {
+ }
+
+ @Override
+ public void modify(IOutline outline, IPage parentPage, IPage page) throws ProcessingException {
+ }
+ }
+
+ private static class P_Outline extends AbstractOutline {
+ }
+
+ private static class P_OtherOutline extends AbstractOutline {
+ }
+
+ private static class P_Page extends AbstractPageWithNodes {
+ }
+
+ private static class P_OtherPage extends AbstractPageWithNodes {
+ }
+}
diff --git a/org.eclipse.scout.rt.extension.client/.settings/org.eclipse.pde.core.prefs b/org.eclipse.scout.rt.extension.client/.settings/org.eclipse.pde.core.prefs
index baef13dd8c..a3a50fc8da 100644
--- a/org.eclipse.scout.rt.extension.client/.settings/org.eclipse.pde.core.prefs
+++ b/org.eclipse.scout.rt.extension.client/.settings/org.eclipse.pde.core.prefs
@@ -1,3 +1,3 @@
-#Mon Jul 11 16:16:00 CEST 2011
-eclipse.preferences.version=1
-pluginProject.extensions=true
+#Mon Jul 11 16:16:00 CEST 2011
+eclipse.preferences.version=1
+pluginProject.extensions=true
diff --git a/org.eclipse.scout.rt.extension.client/schema/desktopExtensions.exsd b/org.eclipse.scout.rt.extension.client/schema/desktopExtensions.exsd
index b21bc4c234..28e1100bd9 100644
--- a/org.eclipse.scout.rt.extension.client/schema/desktopExtensions.exsd
+++ b/org.eclipse.scout.rt.extension.client/schema/desktopExtensions.exsd
@@ -1,114 +1,114 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.scout.rt.extension.client" xmlns="http://www.w3.org/2001/XMLSchema">
-<annotation>
- <appinfo>
- <meta.schema plugin="org.eclipse.scout.rt.extension.client" id="desktopExtensions" name="Desktop Extensions"/>
- </appinfo>
- <documentation>
- This extension point allows to modify the programmed desktop by contributing IDesktopExtensions.
- </documentation>
- </annotation>
-
- <element name="extension">
- <annotation>
- <appinfo>
- <meta.element />
- </appinfo>
- </annotation>
- <complexType>
- <choice>
- <element ref="desktopExtension" minOccurs="1" maxOccurs="unbounded"/>
- </choice>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- <appinfo>
- <meta.attribute translatable="true"/>
- </appinfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="desktopExtension">
- <annotation>
- <appinfo>
- <meta.element labelAttribute="class"/>
- </appinfo>
- </annotation>
- <complexType>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- <appinfo>
- <meta.attribute kind="java" basedOn=":org.eclipse.scout.rt.client.ui.desktop.IDesktopExtension"/>
- </appinfo>
- </annotation>
- </attribute>
- <attribute name="active" type="boolean" use="default" value="true">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appinfo>
- <meta.section type="since"/>
- </appinfo>
- <documentation>
- 3.9.0
- </documentation>
- </annotation>
-
- <annotation>
- <appinfo>
- <meta.section type="examples"/>
- </appinfo>
- <documentation>
- [Enter extension point usage example here.]
- </documentation>
- </annotation>
-
- <annotation>
- <appinfo>
- <meta.section type="apiinfo"/>
- </appinfo>
- <documentation>
- This API is experimental and still under development.
- </documentation>
- </annotation>
-
- <annotation>
- <appinfo>
- <meta.section type="implementation"/>
- </appinfo>
- <documentation>
- [Enter information about supplied implementation of this extension point.]
- </documentation>
- </annotation>
-
-
-</schema>
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.scout.rt.extension.client" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.scout.rt.extension.client" id="desktopExtensions" name="Desktop Extensions"/>
+ </appinfo>
+ <documentation>
+ This extension point allows to modify the programmed desktop by contributing IDesktopExtensions.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <choice>
+ <element ref="desktopExtension" minOccurs="1" maxOccurs="unbounded"/>
+ </choice>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="desktopExtension">
+ <annotation>
+ <appinfo>
+ <meta.element labelAttribute="class"/>
+ </appinfo>
+ </annotation>
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.scout.rt.client.ui.desktop.IDesktopExtension"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="active" type="boolean" use="default" value="true">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ 3.9.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ This API is experimental and still under development.
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/org.eclipse.scout.rt.extension.client/schema/pages.exsd b/org.eclipse.scout.rt.extension.client/schema/pages.exsd
index f212381df6..199735e1e0 100644
--- a/org.eclipse.scout.rt.extension.client/schema/pages.exsd
+++ b/org.eclipse.scout.rt.extension.client/schema/pages.exsd
@@ -1,262 +1,262 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.scout.rt.extension.client" xmlns="http://www.w3.org/2001/XMLSchema">
-<annotation>
- <appinfo>
- <meta.schema plugin="org.eclipse.scout.rt.extension.client" id="pages" name="Pages"/>
- </appinfo>
- <documentation>
- This extension point allows to modify programmed outlines by contributing new pages and by removing or modifying existing pages.
-
-The extensions are processed in the following order:
-&lt;ol&gt;
-&lt;li&gt;contribute&lt;/li&gt;
-&lt;li&gt;remove&lt;/li&gt;
-&lt;li&gt;modify&lt;/li&gt;
-&lt;/ol&gt;
- </documentation>
- </annotation>
-
- <element name="extension">
- <annotation>
- <appinfo>
- <meta.element />
- </appinfo>
- </annotation>
- <complexType>
- <choice>
- <element ref="pageContribution" minOccurs="0" maxOccurs="unbounded"/>
- <element ref="pageRemoval" minOccurs="0" maxOccurs="unbounded"/>
- <element ref="pageModification" minOccurs="0" maxOccurs="unbounded"/>
- </choice>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- <appinfo>
- <meta.attribute translatable="true"/>
- </appinfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="pageContribution">
- <annotation>
- <appinfo>
- <meta.element labelAttribute="class"/>
- </appinfo>
- </annotation>
- <complexType>
- <sequence>
- <choice minOccurs="0" maxOccurs="1">
- <element ref="outline"/>
- <element ref="parentPage"/>
- </choice>
- <element ref="filter" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- <appinfo>
- <meta.attribute kind="java" basedOn=":org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage"/>
- </appinfo>
- </annotation>
- </attribute>
- <attribute name="order" type="string" use="required">
- <annotation>
- <documentation>
- The order defines the insertion point in the list of existing pages at which the contribution will be added. The order values of existing pages are assigned synthetically. The first child page&apos;s order is 10.0 and the order of every subsequent page is incremented by 10.0. Hence A page contribution having order 15.0 is inserted between the first and second statically configured page.
-
-The following approach is implemented for resolving ambiguous oders: An order value consists of a pair of order number. The main order assigned synthetically to pages proveide by &lt;code&gt;execCreateChildPages&lt;/code&gt; and the order value provided by this attribute for contributed pages. The second number is a counter that is incremented for every page, starting with already available pages. Hence the first static child page has order &amp;lt;10.0, 0&amp;gt, the second &amp;lt;20.0, 1&amp;gt and the n-th &amp;lt;&lt;em&gt;n*10.0&lt;/em&gt;, &lt;em&gt;n-1&lt;/em&gt;&amp;gt. The first contributed page&apos;s main order is provided by this attribute and the counter has vlaue &lt;em&gt;n&lt;/em&gt;, resulting in the order pair &amp;lt;&lt;em&gt;order&lt;/em&gt;, &lt;em&gt;n&lt;/em&gt;&amp;gt.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="active" type="boolean" use="default" value="true">
- <annotation>
- <documentation>
- Whether the contribution should be used.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="pageRemoval">
- <annotation>
- <appinfo>
- <meta.element labelAttribute="class"/>
- </appinfo>
- </annotation>
- <complexType>
- <sequence>
- <choice minOccurs="0" maxOccurs="1">
- <element ref="outline"/>
- <element ref="parentPage"/>
- </choice>
- <element ref="filter" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- <appinfo>
- <meta.attribute kind="java" basedOn=":org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage"/>
- </appinfo>
- </annotation>
- </attribute>
- <attribute name="active" type="boolean" use="default" value="true">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="pageModification">
- <annotation>
- <appinfo>
- <meta.element labelAttribute="page"/>
- </appinfo>
- </annotation>
- <complexType>
- <sequence>
- <choice minOccurs="0" maxOccurs="1">
- <element ref="outline"/>
- <element ref="parentPage"/>
- </choice>
- <element ref="filter" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="page" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- <appinfo>
- <meta.attribute kind="java" basedOn=":org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage"/>
- </appinfo>
- </annotation>
- </attribute>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- <appinfo>
- <meta.attribute kind="java" basedOn=":org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.IPageModifier"/>
- </appinfo>
- </annotation>
- </attribute>
- <attribute name="active" type="boolean" use="default" value="true">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="parentPage">
- <complexType>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- <appinfo>
- <meta.attribute kind="java" basedOn=":org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage"/>
- </appinfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="outline">
- <complexType>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- <appinfo>
- <meta.attribute kind="java" basedOn=":org.eclipse.scout.rt.client.ui.desktop.outline.IOutline"/>
- </appinfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="filter">
- <complexType>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- <appinfo>
- <meta.attribute kind="java" basedOn=":org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.IPageExtensionFilter"/>
- </appinfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appinfo>
- <meta.section type="since"/>
- </appinfo>
- <documentation>
- 3.9.0
- </documentation>
- </annotation>
-
- <annotation>
- <appinfo>
- <meta.section type="examples"/>
- </appinfo>
- <documentation>
- [Enter extension point usage example here.]
- </documentation>
- </annotation>
-
- <annotation>
- <appinfo>
- <meta.section type="apiinfo"/>
- </appinfo>
- <documentation>
- This API is experimental and still under development.
- </documentation>
- </annotation>
-
- <annotation>
- <appinfo>
- <meta.section type="implementation"/>
- </appinfo>
- <documentation>
- [Enter information about supplied implementation of this extension point.]
- </documentation>
- </annotation>
-
-
-</schema>
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.scout.rt.extension.client" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.scout.rt.extension.client" id="pages" name="Pages"/>
+ </appinfo>
+ <documentation>
+ This extension point allows to modify programmed outlines by contributing new pages and by removing or modifying existing pages.
+
+The extensions are processed in the following order:
+&lt;ol&gt;
+&lt;li&gt;contribute&lt;/li&gt;
+&lt;li&gt;remove&lt;/li&gt;
+&lt;li&gt;modify&lt;/li&gt;
+&lt;/ol&gt;
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <choice>
+ <element ref="pageContribution" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="pageRemoval" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="pageModification" minOccurs="0" maxOccurs="unbounded"/>
+ </choice>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="pageContribution">
+ <annotation>
+ <appinfo>
+ <meta.element labelAttribute="class"/>
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <choice minOccurs="0" maxOccurs="1">
+ <element ref="outline"/>
+ <element ref="parentPage"/>
+ </choice>
+ <element ref="filter" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="order" type="string" use="required">
+ <annotation>
+ <documentation>
+ The order defines the insertion point in the list of existing pages at which the contribution will be added. The order values of existing pages are assigned synthetically. The first child page&apos;s order is 10.0 and the order of every subsequent page is incremented by 10.0. Hence A page contribution having order 15.0 is inserted between the first and second statically configured page.
+
+The following approach is implemented for resolving ambiguous oders: An order value consists of a pair of order number. The main order assigned synthetically to pages proveide by &lt;code&gt;execCreateChildPages&lt;/code&gt; and the order value provided by this attribute for contributed pages. The second number is a counter that is incremented for every page, starting with already available pages. Hence the first static child page has order &amp;lt;10.0, 0&amp;gt, the second &amp;lt;20.0, 1&amp;gt and the n-th &amp;lt;&lt;em&gt;n*10.0&lt;/em&gt;, &lt;em&gt;n-1&lt;/em&gt;&amp;gt. The first contributed page&apos;s main order is provided by this attribute and the counter has vlaue &lt;em&gt;n&lt;/em&gt;, resulting in the order pair &amp;lt;&lt;em&gt;order&lt;/em&gt;, &lt;em&gt;n&lt;/em&gt;&amp;gt.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="active" type="boolean" use="default" value="true">
+ <annotation>
+ <documentation>
+ Whether the contribution should be used.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="pageRemoval">
+ <annotation>
+ <appinfo>
+ <meta.element labelAttribute="class"/>
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <choice minOccurs="0" maxOccurs="1">
+ <element ref="outline"/>
+ <element ref="parentPage"/>
+ </choice>
+ <element ref="filter" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="active" type="boolean" use="default" value="true">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="pageModification">
+ <annotation>
+ <appinfo>
+ <meta.element labelAttribute="page"/>
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <choice minOccurs="0" maxOccurs="1">
+ <element ref="outline"/>
+ <element ref="parentPage"/>
+ </choice>
+ <element ref="filter" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="page" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.IPageModifier"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="active" type="boolean" use="default" value="true">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="parentPage">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="outline">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.scout.rt.client.ui.desktop.outline.IOutline"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="filter">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.IPageExtensionFilter"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ 3.9.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ This API is experimental and still under development.
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/IExtensibleScoutObject.java b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/IExtensibleScoutObject.java
index 2a29189479..b0dd834046 100644
--- a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/IExtensibleScoutObject.java
+++ b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/IExtensibleScoutObject.java
@@ -1,20 +1,20 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client;
-
-/**
- * Marker interface for Scout objects that can be modified using Eclipse extension mechanisms.
- *
- * @since 3.9.0
- */
-public interface IExtensibleScoutObject {
-
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client;
+
+/**
+ * Marker interface for Scout objects that can be modified using Eclipse extension mechanisms.
+ *
+ * @since 3.9.0
+ */
+public interface IExtensibleScoutObject {
+
+}
diff --git a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/IWrappedObject.java b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/IWrappedObject.java
index 5e83763ba8..db5d9cfc7d 100644
--- a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/IWrappedObject.java
+++ b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/IWrappedObject.java
@@ -1,26 +1,26 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client;
-
-/**
- * Classes implementing this interface are wrapping another object which can be retrieved by invoking
- * {@link #getWrappedObject()}.
- *
- * @since 3.9.0
- */
-public interface IWrappedObject<T> {
-
- /**
- * @return Returns the object wrapped by this object. Implementors must ensure that this method never returns
- * <code>null</code>.
- */
- T getWrappedObject();
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client;
+
+/**
+ * Classes implementing this interface are wrapping another object which can be retrieved by invoking
+ * {@link #getWrappedObject()}.
+ *
+ * @since 3.9.0
+ */
+public interface IWrappedObject<T> {
+
+ /**
+ * @return Returns the object wrapped by this object. Implementors must ensure that this method never returns
+ * <code>null</code>.
+ */
+ T getWrappedObject();
+}
diff --git a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/Replace.java b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/Replace.java
index 26ff5598ff..31d9c8d5c2 100644
--- a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/Replace.java
+++ b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/Replace.java
@@ -1,32 +1,32 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Annotation on scout configuration object used to replace other configured objects by the annotated one. By default
- * the first object is removed which type is the annotated class's super class.
- *
- * @since 3.9.0
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.TYPE)
-public @interface Replace {
-
- /**
- * @return Returns the type of the object to be replaced by an instance of the annotated class.
- */
- Class value() default Object.class;
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation on scout configuration object used to replace other configured objects by the annotated one. By default
+ * the first object is removed which type is the annotated class's super class.
+ *
+ * @since 3.9.0
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+public @interface Replace {
+
+ /**
+ * @return Returns the type of the object to be replaced by an instance of the annotated class.
+ */
+ Class value() default Object.class;
+}
diff --git a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/internal/AbstractCompositeExtensionFilter.java b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/internal/AbstractCompositeExtensionFilter.java
index 1d94747f4f..f6c5584d39 100644
--- a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/internal/AbstractCompositeExtensionFilter.java
+++ b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/internal/AbstractCompositeExtensionFilter.java
@@ -1,71 +1,71 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.internal;
-
-import java.lang.reflect.Array;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.scout.commons.TypeCastUtility;
-
-/**
- * @since 3.9.0
- */
-public class AbstractCompositeExtensionFilter<T> {
-
- private final List<T> m_filters;
-
- public AbstractCompositeExtensionFilter(T... filters) {
- m_filters = new LinkedList<T>();
- if (filters != null) {
- for (T f : filters) {
- addFilter(f);
- }
- }
- }
-
- public boolean addFilter(T filter) {
- if (filter == null) {
- return false;
- }
- return m_filters.add(filter);
- }
-
- public boolean addFilterAtBegin(T filter) {
- if (filter == null) {
- return false;
- }
- m_filters.add(0, filter);
- return true;
- }
-
- public boolean removeFilter(T filter) {
- return m_filters.remove(filter);
- }
-
- public boolean isEmpty() {
- return m_filters.isEmpty();
- }
-
- public int size() {
- return m_filters.size();
- }
-
- public T[] getFilters() {
- Class typeParameter = TypeCastUtility.getGenericsParameterClass(this.getClass(), AbstractCompositeExtensionFilter.class);
- @SuppressWarnings("unchecked")
- T[] result = (T[]) Array.newInstance(typeParameter, m_filters.size());
- if (result.length == 0) {
- return result;
- }
- return m_filters.toArray(result);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.internal;
+
+import java.lang.reflect.Array;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.scout.commons.TypeCastUtility;
+
+/**
+ * @since 3.9.0
+ */
+public class AbstractCompositeExtensionFilter<T> {
+
+ private final List<T> m_filters;
+
+ public AbstractCompositeExtensionFilter(T... filters) {
+ m_filters = new LinkedList<T>();
+ if (filters != null) {
+ for (T f : filters) {
+ addFilter(f);
+ }
+ }
+ }
+
+ public boolean addFilter(T filter) {
+ if (filter == null) {
+ return false;
+ }
+ return m_filters.add(filter);
+ }
+
+ public boolean addFilterAtBegin(T filter) {
+ if (filter == null) {
+ return false;
+ }
+ m_filters.add(0, filter);
+ return true;
+ }
+
+ public boolean removeFilter(T filter) {
+ return m_filters.remove(filter);
+ }
+
+ public boolean isEmpty() {
+ return m_filters.isEmpty();
+ }
+
+ public int size() {
+ return m_filters.size();
+ }
+
+ public T[] getFilters() {
+ Class typeParameter = TypeCastUtility.getGenericsParameterClass(this.getClass(), AbstractCompositeExtensionFilter.class);
+ @SuppressWarnings("unchecked")
+ T[] result = (T[]) Array.newInstance(typeParameter, m_filters.size());
+ if (result.length == 0) {
+ return result;
+ }
+ return m_filters.toArray(result);
+ }
+}
diff --git a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/internal/IExtensionProcessor.java b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/internal/IExtensionProcessor.java
index 50854f10cf..eb282f9c21 100644
--- a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/internal/IExtensionProcessor.java
+++ b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/internal/IExtensionProcessor.java
@@ -1,37 +1,37 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.internal;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.osgi.framework.Bundle;
-
-/**
- * Processor for scout extensions. This class is used by {@link AbstractExtensionManager} for parsing configuration
- * elements.
- *
- * @see AbstractExtensionManager#addExtensionProcessor(String, IExtensionProcessor)
- * @since 3.9.0
- */
-public interface IExtensionProcessor<T> {
-
- /**
- * Parses the given configuration element and returns its object representation that can be used for caching. The
- * configuration element is neglected if this method throws an Exception.
- *
- * @param contributor
- * the contributing bundle
- * @param element
- * the configuration element to parse
- * @return an object representation of the given configuration element.
- * @throws Exception
- */
- T processConfigurationElement(Bundle contributor, IConfigurationElement element) throws Exception;
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.internal;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.osgi.framework.Bundle;
+
+/**
+ * Processor for scout extensions. This class is used by {@link AbstractExtensionManager} for parsing configuration
+ * elements.
+ *
+ * @see AbstractExtensionManager#addExtensionProcessor(String, IExtensionProcessor)
+ * @since 3.9.0
+ */
+public interface IExtensionProcessor<T> {
+
+ /**
+ * Parses the given configuration element and returns its object representation that can be used for caching. The
+ * configuration element is neglected if this method throws an Exception.
+ *
+ * @param contributor
+ * the contributing bundle
+ * @param element
+ * the configuration element to parse
+ * @return an object representation of the given configuration element.
+ * @throws Exception
+ */
+ T processConfigurationElement(Bundle contributor, IConfigurationElement element) throws Exception;
+}
diff --git a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/action/menu/CompositeMenuFilter.java b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/action/menu/CompositeMenuFilter.java
index 32c2887fce..06c443a146 100644
--- a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/action/menu/CompositeMenuFilter.java
+++ b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/action/menu/CompositeMenuFilter.java
@@ -1,42 +1,42 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.action.menu;
-
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.extension.client.internal.AbstractCompositeExtensionFilter;
-
-/**
- * Composite menu filter class containing other menu filters. Invoking {@link #accept(Object, Object, IMenu)} returns
- * <code>true</code>, iff all contained filters return <code>true</code>. Otherwise <code>false</code>.
- *
- * @since 3.9.0
- */
-public class CompositeMenuFilter extends AbstractCompositeExtensionFilter<IMenuExtensionFilter> implements IMenuExtensionFilter {
-
- public CompositeMenuFilter(IMenuExtensionFilter... filters) {
- super(filters);
- }
-
- /**
- * Returns <code>true</code> if all contained menu filters return <code>true</code>. Otherwise <code>false</code>.
- *
- * @see IMenuExtensionFilter#accept(Object, Object, IMenu)
- */
- @Override
- public boolean accept(Object anchor, Object container, IMenu menu) {
- for (IMenuExtensionFilter filter : getFilters()) {
- if (!filter.accept(anchor, container, menu)) {
- return false;
- }
- }
- return true;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.action.menu;
+
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.extension.client.internal.AbstractCompositeExtensionFilter;
+
+/**
+ * Composite menu filter class containing other menu filters. Invoking {@link #accept(Object, Object, IMenu)} returns
+ * <code>true</code>, iff all contained filters return <code>true</code>. Otherwise <code>false</code>.
+ *
+ * @since 3.9.0
+ */
+public class CompositeMenuFilter extends AbstractCompositeExtensionFilter<IMenuExtensionFilter> implements IMenuExtensionFilter {
+
+ public CompositeMenuFilter(IMenuExtensionFilter... filters) {
+ super(filters);
+ }
+
+ /**
+ * Returns <code>true</code> if all contained menu filters return <code>true</code>. Otherwise <code>false</code>.
+ *
+ * @see IMenuExtensionFilter#accept(Object, Object, IMenu)
+ */
+ @Override
+ public boolean accept(Object anchor, Object container, IMenu menu) {
+ for (IMenuExtensionFilter filter : getFilters()) {
+ if (!filter.accept(anchor, container, menu)) {
+ return false;
+ }
+ }
+ return true;
+ }
+}
diff --git a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/action/menu/IMenuExtensionFilter.java b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/action/menu/IMenuExtensionFilter.java
index 7fbf3a22c4..cbfe3470c5 100644
--- a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/action/menu/IMenuExtensionFilter.java
+++ b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/action/menu/IMenuExtensionFilter.java
@@ -1,54 +1,54 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.action.menu;
-
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.basic.activitymap.IActivityMap;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.plannerfield.IPlannerField;
-
-/**
- * @since 3.9.0
- */
-public interface IMenuExtensionFilter {
-
- /**
- * This method is called to decide whether an extension is used in the given context. The anchor represents the
- * reference object a menu extension is attached to. It is an instance of the following types:
- * <ul>
- * <li>{@link IPage}</li>
- * <li>{@link IFormField}</li>
- * <li>{@link IMenu}</li>
- * </ul>
- * <p/>
- * The container is the direct parent the menu is attached to. Some examples are:
- * <ul>
- * <li>{@link ITable} of an {@link IPageWithTable}</li>
- * <li>{@link IActivityMap} of an {@link IPlannerField}</li>
- * <li>etc.</li>
- * </ul>
- *
- * @param anchor
- * the reference object the menu extension is attached to. e.g. an {@link IPage}, an {@link IFormField} or an
- * {@link IMenu}.
- * @param container
- * the direct parent the menu is attached to. Sometimes the same object as <code>anchor</code>.
- * @param menu
- * <code>null</code> in case of a menu contribution or the existing menu in case of menu modifications and
- * removals.
- * @return Returns <code>true</code> if the extension has to be applied in the given context. Otherwise
- * <code>false</code>.
- */
- boolean accept(Object anchor, Object container, IMenu menu);
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.action.menu;
+
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.basic.activitymap.IActivityMap;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.plannerfield.IPlannerField;
+
+/**
+ * @since 3.9.0
+ */
+public interface IMenuExtensionFilter {
+
+ /**
+ * This method is called to decide whether an extension is used in the given context. The anchor represents the
+ * reference object a menu extension is attached to. It is an instance of the following types:
+ * <ul>
+ * <li>{@link IPage}</li>
+ * <li>{@link IFormField}</li>
+ * <li>{@link IMenu}</li>
+ * </ul>
+ * <p/>
+ * The container is the direct parent the menu is attached to. Some examples are:
+ * <ul>
+ * <li>{@link ITable} of an {@link IPageWithTable}</li>
+ * <li>{@link IActivityMap} of an {@link IPlannerField}</li>
+ * <li>etc.</li>
+ * </ul>
+ *
+ * @param anchor
+ * the reference object the menu extension is attached to. e.g. an {@link IPage}, an {@link IFormField} or an
+ * {@link IMenu}.
+ * @param container
+ * the direct parent the menu is attached to. Sometimes the same object as <code>anchor</code>.
+ * @param menu
+ * <code>null</code> in case of a menu contribution or the existing menu in case of menu modifications and
+ * removals.
+ * @return Returns <code>true</code> if the extension has to be applied in the given context. Otherwise
+ * <code>false</code>.
+ */
+ boolean accept(Object anchor, Object container, IMenu menu);
+}
diff --git a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/action/menu/IMenuModifier.java b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/action/menu/IMenuModifier.java
index ab9efc88d6..0d726acee1 100644
--- a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/action/menu/IMenuModifier.java
+++ b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/action/menu/IMenuModifier.java
@@ -1,45 +1,45 @@
-package org.eclipse.scout.rt.extension.client.ui.action.menu;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.basic.activitymap.IActivityMap;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.plannerfield.IPlannerField;
-
-/**
- * This interface is used for modifying {@link IMenu}s. Classes implementing this interface must provide a default
- * constructor.
- *
- * @since 3.9.0
- */
-public interface IMenuModifier<T extends IMenu> {
-
- /**
- * This method allows modifying configured menus. The anchor represents the reference object a menu extension is
- * attached to. It is an instance of the following types:
- * <ul>
- * <li>{@link IPage}</li>
- * <li>{@link IFormField}</li>
- * <li>{@link IMenu}</li>
- * </ul>
- * <p/>
- * The container is the direct parent the menu is attached to. Some examples are:
- * <ul>
- * <li>{@link ITable} of an {@link IPageWithTable}</li>
- * <li>{@link IActivityMap} of an {@link IPlannerField}</li>
- * <li>etc.</li>
- * </ul>
- *
- * @param anchor
- * the reference object the menu extension is attached to. e.g. an {@link IPage}, an {@link IFormField} or an
- * {@link IMenu}.
- * @param container
- * the direct parent the menu is attached to. Sometimes the same object as <code>anchor</code>.
- * @param menu
- * the menu to be modified.
- */
- void modify(Object anchor, Object container, T menu) throws ProcessingException;
-}
+package org.eclipse.scout.rt.extension.client.ui.action.menu;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.basic.activitymap.IActivityMap;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.plannerfield.IPlannerField;
+
+/**
+ * This interface is used for modifying {@link IMenu}s. Classes implementing this interface must provide a default
+ * constructor.
+ *
+ * @since 3.9.0
+ */
+public interface IMenuModifier<T extends IMenu> {
+
+ /**
+ * This method allows modifying configured menus. The anchor represents the reference object a menu extension is
+ * attached to. It is an instance of the following types:
+ * <ul>
+ * <li>{@link IPage}</li>
+ * <li>{@link IFormField}</li>
+ * <li>{@link IMenu}</li>
+ * </ul>
+ * <p/>
+ * The container is the direct parent the menu is attached to. Some examples are:
+ * <ul>
+ * <li>{@link ITable} of an {@link IPageWithTable}</li>
+ * <li>{@link IActivityMap} of an {@link IPlannerField}</li>
+ * <li>etc.</li>
+ * </ul>
+ *
+ * @param anchor
+ * the reference object the menu extension is attached to. e.g. an {@link IPage}, an {@link IFormField} or an
+ * {@link IMenu}.
+ * @param container
+ * the direct parent the menu is attached to. Sometimes the same object as <code>anchor</code>.
+ * @param menu
+ * the menu to be modified.
+ */
+ void modify(Object anchor, Object container, T menu) throws ProcessingException;
+}
diff --git a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/action/menu/internal/AbstractMenuExtension.java b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/action/menu/internal/AbstractMenuExtension.java
index bc6a0ed70e..d353d3bae4 100644
--- a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/action/menu/internal/AbstractMenuExtension.java
+++ b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/action/menu/internal/AbstractMenuExtension.java
@@ -1,49 +1,49 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.action.menu.internal;
-
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.extension.client.ui.action.menu.IMenuExtensionFilter;
-
-/**
- * @since 3.9.0
- */
-public class AbstractMenuExtension {
-
- private final IMenuExtensionFilter m_filter;
- private final Class<? extends IMenu> m_menuClass;
-
- public AbstractMenuExtension(Class<? extends IMenu> menuClass, IMenuExtensionFilter filter) {
- if (menuClass == null) {
- throw new IllegalArgumentException("menuClass must not be null");
- }
- m_menuClass = menuClass;
- m_filter = filter;
- }
-
- public Class<? extends IMenu> getMenuClass() {
- return m_menuClass;
- }
-
- public IMenuExtensionFilter getFilter() {
- return m_filter;
- }
-
- public boolean accept(Object anchor, Object container, IMenu menu) {
- if (anchor == null || container == null) {
- return false;
- }
- if (getFilter() != null) {
- return getFilter().accept(anchor, container, menu);
- }
- return true;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.action.menu.internal;
+
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.extension.client.ui.action.menu.IMenuExtensionFilter;
+
+/**
+ * @since 3.9.0
+ */
+public class AbstractMenuExtension {
+
+ private final IMenuExtensionFilter m_filter;
+ private final Class<? extends IMenu> m_menuClass;
+
+ public AbstractMenuExtension(Class<? extends IMenu> menuClass, IMenuExtensionFilter filter) {
+ if (menuClass == null) {
+ throw new IllegalArgumentException("menuClass must not be null");
+ }
+ m_menuClass = menuClass;
+ m_filter = filter;
+ }
+
+ public Class<? extends IMenu> getMenuClass() {
+ return m_menuClass;
+ }
+
+ public IMenuExtensionFilter getFilter() {
+ return m_filter;
+ }
+
+ public boolean accept(Object anchor, Object container, IMenu menu) {
+ if (anchor == null || container == null) {
+ return false;
+ }
+ if (getFilter() != null) {
+ return getFilter().accept(anchor, container, menu);
+ }
+ return true;
+ }
+}
diff --git a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/action/menu/internal/MenuAnchorFilter.java b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/action/menu/internal/MenuAnchorFilter.java
index afa549dcf5..504e4938f3 100644
--- a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/action/menu/internal/MenuAnchorFilter.java
+++ b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/action/menu/internal/MenuAnchorFilter.java
@@ -1,41 +1,41 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.action.menu.internal;
-
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.extension.client.ui.action.menu.IMenuExtensionFilter;
-
-/**
- * @since 3.9.0
- */
-public class MenuAnchorFilter implements IMenuExtensionFilter {
-
- private final Class<?> m_anchorClass;
-
- public MenuAnchorFilter(Class<?> anchorClass) {
- m_anchorClass = anchorClass;
- }
-
- public Class<?> getAnchorClass() {
- return m_anchorClass;
- }
-
- @Override
- public boolean accept(Object anchor, Object container, IMenu menu) {
- if (anchor == null || container == null) {
- return false;
- }
- if (getAnchorClass() == null) {
- return true;
- }
- return getAnchorClass().isInstance(anchor);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.action.menu.internal;
+
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.extension.client.ui.action.menu.IMenuExtensionFilter;
+
+/**
+ * @since 3.9.0
+ */
+public class MenuAnchorFilter implements IMenuExtensionFilter {
+
+ private final Class<?> m_anchorClass;
+
+ public MenuAnchorFilter(Class<?> anchorClass) {
+ m_anchorClass = anchorClass;
+ }
+
+ public Class<?> getAnchorClass() {
+ return m_anchorClass;
+ }
+
+ @Override
+ public boolean accept(Object anchor, Object container, IMenu menu) {
+ if (anchor == null || container == null) {
+ return false;
+ }
+ if (getAnchorClass() == null) {
+ return true;
+ }
+ return getAnchorClass().isInstance(anchor);
+ }
+}
diff --git a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/action/menu/internal/MenuContributionExtension.java b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/action/menu/internal/MenuContributionExtension.java
index 863a4ca18a..e4eab101dc 100644
--- a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/action/menu/internal/MenuContributionExtension.java
+++ b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/action/menu/internal/MenuContributionExtension.java
@@ -1,76 +1,76 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.action.menu.internal;
-
-import org.eclipse.scout.commons.BeanUtility;
-import org.eclipse.scout.commons.NumberUtility;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.extension.client.ui.action.menu.IMenuExtensionFilter;
-
-/**
- * @since 3.9.0
- */
-public class MenuContributionExtension extends AbstractMenuExtension {
-
- private final double m_order;
-
- public MenuContributionExtension(Class<? extends IMenu> menuClass, IMenuExtensionFilter filter, Double order) {
- super(menuClass, filter);
- m_order = NumberUtility.nvl(order, Double.MAX_VALUE);
- }
-
- public double getOrder() {
- return m_order;
- }
-
- public IMenu createContribution(Object anchor, Object container) throws ProcessingException {
- if (anchor == null || container == null) {
- throw new IllegalArgumentException("anchor or container must not be null");
- }
- if (anchor != container) {
- // 1. anchor and container are not the same
- // 1.a try with anchor and container parameter
- IMenu menu = BeanUtility.createInstance(getMenuClass(), anchor, container);
- if (menu != null) {
- return menu;
- }
- // 1.b try with container and anchor parameter
- menu = BeanUtility.createInstance(getMenuClass(), container, anchor);
- if (menu != null) {
- return menu;
- }
- // 1.c try with container parameter
- menu = BeanUtility.createInstance(getMenuClass(), container);
- if (menu != null) {
- return menu;
- }
- }
- // 2. try with anchor parameter
- IMenu menu = BeanUtility.createInstance(getMenuClass(), anchor);
- if (menu != null) {
- return menu;
- }
- if (anchor == container) {
- // 3. anchor and container are the same, also try <anchor, anchor> constructor
- menu = BeanUtility.createInstance(getMenuClass(), anchor, anchor);
- if (menu != null) {
- return menu;
- }
- }
- // 4. try default constructor
- menu = BeanUtility.createInstance(getMenuClass());
- if (menu != null) {
- return menu;
- }
- throw new ProcessingException("Cannot create new instance of class [" + getMenuClass() + "] with argument anchor=[" + anchor + "], container=[" + container + "]");
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.action.menu.internal;
+
+import org.eclipse.scout.commons.BeanUtility;
+import org.eclipse.scout.commons.NumberUtility;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.extension.client.ui.action.menu.IMenuExtensionFilter;
+
+/**
+ * @since 3.9.0
+ */
+public class MenuContributionExtension extends AbstractMenuExtension {
+
+ private final double m_order;
+
+ public MenuContributionExtension(Class<? extends IMenu> menuClass, IMenuExtensionFilter filter, Double order) {
+ super(menuClass, filter);
+ m_order = NumberUtility.nvl(order, Double.MAX_VALUE);
+ }
+
+ public double getOrder() {
+ return m_order;
+ }
+
+ public IMenu createContribution(Object anchor, Object container) throws ProcessingException {
+ if (anchor == null || container == null) {
+ throw new IllegalArgumentException("anchor or container must not be null");
+ }
+ if (anchor != container) {
+ // 1. anchor and container are not the same
+ // 1.a try with anchor and container parameter
+ IMenu menu = BeanUtility.createInstance(getMenuClass(), anchor, container);
+ if (menu != null) {
+ return menu;
+ }
+ // 1.b try with container and anchor parameter
+ menu = BeanUtility.createInstance(getMenuClass(), container, anchor);
+ if (menu != null) {
+ return menu;
+ }
+ // 1.c try with container parameter
+ menu = BeanUtility.createInstance(getMenuClass(), container);
+ if (menu != null) {
+ return menu;
+ }
+ }
+ // 2. try with anchor parameter
+ IMenu menu = BeanUtility.createInstance(getMenuClass(), anchor);
+ if (menu != null) {
+ return menu;
+ }
+ if (anchor == container) {
+ // 3. anchor and container are the same, also try <anchor, anchor> constructor
+ menu = BeanUtility.createInstance(getMenuClass(), anchor, anchor);
+ if (menu != null) {
+ return menu;
+ }
+ }
+ // 4. try default constructor
+ menu = BeanUtility.createInstance(getMenuClass());
+ if (menu != null) {
+ return menu;
+ }
+ throw new ProcessingException("Cannot create new instance of class [" + getMenuClass() + "] with argument anchor=[" + anchor + "], container=[" + container + "]");
+ }
+}
diff --git a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/action/menu/internal/MenuModificationExtension.java b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/action/menu/internal/MenuModificationExtension.java
index c90bb178b2..4ebc71785f 100644
--- a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/action/menu/internal/MenuModificationExtension.java
+++ b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/action/menu/internal/MenuModificationExtension.java
@@ -1,68 +1,68 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.action.menu.internal;
-
-import org.eclipse.scout.commons.TypeCastUtility;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.extension.client.ui.action.menu.IMenuExtensionFilter;
-import org.eclipse.scout.rt.extension.client.ui.action.menu.IMenuModifier;
-
-/**
- * @since 3.9.0
- */
-public class MenuModificationExtension extends AbstractMenuExtension {
-
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(MenuModificationExtension.class);
-
- private final Class<? extends IMenuModifier<? extends IMenu>> m_menuModifier;
-
- public MenuModificationExtension(Class<? extends IMenu> menuClass, IMenuExtensionFilter filter, Class<? extends IMenuModifier<? extends IMenu>> menuModifier) {
- super(menuClass, filter);
- if (menuModifier == null) {
- throw new IllegalArgumentException("menuModifier must not be null");
- }
- // check assignability of given menu class along with the type parameter defined on the menu modifier
- Class<?> menuModifierMenuType = TypeCastUtility.getGenericsParameterClass(menuModifier, IMenuModifier.class);
- if (menuModifierMenuType == null) {
- LOG.warn("could not determine generic type parameter of menu modifier '" + menuModifier.getName() + ";");
- }
- else if (!menuModifierMenuType.isAssignableFrom(menuClass)) {
- throw new IllegalArgumentException("menuClass must be assignalbe to the generic type of given menuModifier. [menuClass: '"
- + menuClass.getName() + "', generic type on menuModifier: '" + menuModifierMenuType.getName() + "'");
- }
- m_menuModifier = menuModifier;
- }
-
- public Class<? extends IMenuModifier<? extends IMenu>> getMenuModifier() {
- return m_menuModifier;
- }
-
- @Override
- public boolean accept(Object anchor, Object container, IMenu menu) {
- if (!getMenuClass().isInstance(menu)) {
- return false;
- }
- return super.accept(anchor, container, menu);
- }
-
- @SuppressWarnings("unchecked")
- public <T extends IMenu> IMenuModifier<T> createMenuModifier() throws ProcessingException {
- try {
- return (IMenuModifier<T>) m_menuModifier.newInstance();
- }
- catch (Exception e) {
- throw new ProcessingException("Error while instantiating menu modifier", e);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.action.menu.internal;
+
+import org.eclipse.scout.commons.TypeCastUtility;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.extension.client.ui.action.menu.IMenuExtensionFilter;
+import org.eclipse.scout.rt.extension.client.ui.action.menu.IMenuModifier;
+
+/**
+ * @since 3.9.0
+ */
+public class MenuModificationExtension extends AbstractMenuExtension {
+
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(MenuModificationExtension.class);
+
+ private final Class<? extends IMenuModifier<? extends IMenu>> m_menuModifier;
+
+ public MenuModificationExtension(Class<? extends IMenu> menuClass, IMenuExtensionFilter filter, Class<? extends IMenuModifier<? extends IMenu>> menuModifier) {
+ super(menuClass, filter);
+ if (menuModifier == null) {
+ throw new IllegalArgumentException("menuModifier must not be null");
+ }
+ // check assignability of given menu class along with the type parameter defined on the menu modifier
+ Class<?> menuModifierMenuType = TypeCastUtility.getGenericsParameterClass(menuModifier, IMenuModifier.class);
+ if (menuModifierMenuType == null) {
+ LOG.warn("could not determine generic type parameter of menu modifier '" + menuModifier.getName() + ";");
+ }
+ else if (!menuModifierMenuType.isAssignableFrom(menuClass)) {
+ throw new IllegalArgumentException("menuClass must be assignalbe to the generic type of given menuModifier. [menuClass: '"
+ + menuClass.getName() + "', generic type on menuModifier: '" + menuModifierMenuType.getName() + "'");
+ }
+ m_menuModifier = menuModifier;
+ }
+
+ public Class<? extends IMenuModifier<? extends IMenu>> getMenuModifier() {
+ return m_menuModifier;
+ }
+
+ @Override
+ public boolean accept(Object anchor, Object container, IMenu menu) {
+ if (!getMenuClass().isInstance(menu)) {
+ return false;
+ }
+ return super.accept(anchor, container, menu);
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T extends IMenu> IMenuModifier<T> createMenuModifier() throws ProcessingException {
+ try {
+ return (IMenuModifier<T>) m_menuModifier.newInstance();
+ }
+ catch (Exception e) {
+ throw new ProcessingException("Error while instantiating menu modifier", e);
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/action/menu/internal/MenuRemoveExtension.java b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/action/menu/internal/MenuRemoveExtension.java
index 1987925a55..39ba2e3a4f 100644
--- a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/action/menu/internal/MenuRemoveExtension.java
+++ b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/action/menu/internal/MenuRemoveExtension.java
@@ -1,36 +1,36 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.action.menu.internal;
-
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.extension.client.ui.action.menu.IMenuExtensionFilter;
-
-/**
- * @since 3.9.0
- */
-public class MenuRemoveExtension extends AbstractMenuExtension {
-
- public MenuRemoveExtension(Class<? extends IMenu> menuClass, IMenuExtensionFilter filter) {
- super(menuClass, filter);
-
- }
-
- @Override
- public boolean accept(Object anchor, Object container, IMenu menu) {
- if (menu == null) {
- throw new IllegalArgumentException("menu must not be null");
- }
- if (!getMenuClass().isInstance(menu)) {
- return false;
- }
- return super.accept(anchor, container, menu);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.action.menu.internal;
+
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.extension.client.ui.action.menu.IMenuExtensionFilter;
+
+/**
+ * @since 3.9.0
+ */
+public class MenuRemoveExtension extends AbstractMenuExtension {
+
+ public MenuRemoveExtension(Class<? extends IMenu> menuClass, IMenuExtensionFilter filter) {
+ super(menuClass, filter);
+
+ }
+
+ @Override
+ public boolean accept(Object anchor, Object container, IMenu menu) {
+ if (menu == null) {
+ throw new IllegalArgumentException("menu must not be null");
+ }
+ if (!getMenuClass().isInstance(menu)) {
+ return false;
+ }
+ return super.accept(anchor, container, menu);
+ }
+}
diff --git a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/AbstractExtensibleDesktop.java b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/AbstractExtensibleDesktop.java
index 3c0459a31b..652a632b74 100644
--- a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/AbstractExtensibleDesktop.java
+++ b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/AbstractExtensibleDesktop.java
@@ -1,39 +1,39 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.desktop;
-
-import java.util.List;
-
-import org.eclipse.scout.rt.client.ui.desktop.AbstractDesktop;
-import org.eclipse.scout.rt.client.ui.desktop.IDesktopExtension;
-import org.eclipse.scout.rt.extension.client.Activator;
-import org.eclipse.scout.rt.extension.client.IExtensibleScoutObject;
-
-/**
- * Desktop supporting the following Scout extension features:
- * <ul>
- * <li>adding desktop extensions {@link IDesktopExtension}</li>
- * </ul>
- *
- * @since 3.9.0
- */
-public abstract class AbstractExtensibleDesktop extends AbstractDesktop implements IExtensibleScoutObject {
-
- @Override
- protected void injectDesktopExtensions(List<IDesktopExtension> desktopExtensions) {
- super.injectDesktopExtensions(desktopExtensions);
- List<IDesktopExtension> extensions = Activator.getDefault().getDesktopExtensionManager().getDesktopExtensions();
- for (IDesktopExtension e : extensions) {
- e.setCoreDesktop(this);
- }
- desktopExtensions.addAll(extensions);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.desktop;
+
+import java.util.List;
+
+import org.eclipse.scout.rt.client.ui.desktop.AbstractDesktop;
+import org.eclipse.scout.rt.client.ui.desktop.IDesktopExtension;
+import org.eclipse.scout.rt.extension.client.Activator;
+import org.eclipse.scout.rt.extension.client.IExtensibleScoutObject;
+
+/**
+ * Desktop supporting the following Scout extension features:
+ * <ul>
+ * <li>adding desktop extensions {@link IDesktopExtension}</li>
+ * </ul>
+ *
+ * @since 3.9.0
+ */
+public abstract class AbstractExtensibleDesktop extends AbstractDesktop implements IExtensibleScoutObject {
+
+ @Override
+ protected void injectDesktopExtensions(List<IDesktopExtension> desktopExtensions) {
+ super.injectDesktopExtensions(desktopExtensions);
+ List<IDesktopExtension> extensions = Activator.getDefault().getDesktopExtensionManager().getDesktopExtensions();
+ for (IDesktopExtension e : extensions) {
+ e.setCoreDesktop(this);
+ }
+ desktopExtensions.addAll(extensions);
+ }
+}
diff --git a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/internal/DesktopExtensionManager.java b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/internal/DesktopExtensionManager.java
index 4c125d9225..227e98a64b 100644
--- a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/internal/DesktopExtensionManager.java
+++ b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/internal/DesktopExtensionManager.java
@@ -1,78 +1,78 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.desktop.internal;
-
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.desktop.IDesktopExtension;
-import org.eclipse.scout.rt.extension.client.internal.AbstractExtensionManager;
-import org.eclipse.scout.rt.extension.client.internal.IExtensionProcessor;
-import org.osgi.framework.Bundle;
-
-/**
- * @since 3.9.0
- */
-public class DesktopExtensionManager extends AbstractExtensionManager {
-
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(DesktopExtensionManager.class);
-
- public static final String EXTENSION_POINT_ID = org.eclipse.scout.rt.extension.client.Activator.PLUGIN_ID + ".desktopExtensions";
- public static final String DESKTOP_EXTENSION_ELEMENT = "desktopExtension";
-
- private final List<Class<? extends IDesktopExtension>> m_desktopExtensionTypes;
-
- public DesktopExtensionManager(IExtensionRegistry extensionRegistry) {
- super(extensionRegistry, EXTENSION_POINT_ID);
- m_desktopExtensionTypes = new LinkedList<Class<? extends IDesktopExtension>>();
- initExtensionProcessors();
- }
-
- public List<IDesktopExtension> getDesktopExtensions() {
- synchronized (getLock()) {
- ensureStarted();
- List<IDesktopExtension> desktopExtensions = new ArrayList<IDesktopExtension>(m_desktopExtensionTypes.size());
- for (Class<? extends IDesktopExtension> type : m_desktopExtensionTypes) {
- try {
- IDesktopExtension desktopExtension = type.newInstance();
- desktopExtensions.add(desktopExtension);
- }
- catch (Exception e) {
- LOG.warn("Exception while instantiating new object of type [" + type.getName() + "]", e);
- }
- }
- return desktopExtensions;
- }
- }
-
- private void initExtensionProcessors() {
- addExtensionProcessor(DESKTOP_EXTENSION_ELEMENT,
- new IExtensionProcessor<Class<? extends IDesktopExtension>>() {
- @Override
- public Class<? extends IDesktopExtension> processConfigurationElement(Bundle contributor, IConfigurationElement element) throws Exception {
- Class<? extends IDesktopExtension> desktopExtension = loadClass(contributor, IDesktopExtension.class, element.getAttribute("class"));
- m_desktopExtensionTypes.add(desktopExtension);
- return desktopExtension;
- }
- });
- }
-
- @Override
- protected void removeContributions(Set<Object> contributions) {
- m_desktopExtensionTypes.removeAll(contributions);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.desktop.internal;
+
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.desktop.IDesktopExtension;
+import org.eclipse.scout.rt.extension.client.internal.AbstractExtensionManager;
+import org.eclipse.scout.rt.extension.client.internal.IExtensionProcessor;
+import org.osgi.framework.Bundle;
+
+/**
+ * @since 3.9.0
+ */
+public class DesktopExtensionManager extends AbstractExtensionManager {
+
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(DesktopExtensionManager.class);
+
+ public static final String EXTENSION_POINT_ID = org.eclipse.scout.rt.extension.client.Activator.PLUGIN_ID + ".desktopExtensions";
+ public static final String DESKTOP_EXTENSION_ELEMENT = "desktopExtension";
+
+ private final List<Class<? extends IDesktopExtension>> m_desktopExtensionTypes;
+
+ public DesktopExtensionManager(IExtensionRegistry extensionRegistry) {
+ super(extensionRegistry, EXTENSION_POINT_ID);
+ m_desktopExtensionTypes = new LinkedList<Class<? extends IDesktopExtension>>();
+ initExtensionProcessors();
+ }
+
+ public List<IDesktopExtension> getDesktopExtensions() {
+ synchronized (getLock()) {
+ ensureStarted();
+ List<IDesktopExtension> desktopExtensions = new ArrayList<IDesktopExtension>(m_desktopExtensionTypes.size());
+ for (Class<? extends IDesktopExtension> type : m_desktopExtensionTypes) {
+ try {
+ IDesktopExtension desktopExtension = type.newInstance();
+ desktopExtensions.add(desktopExtension);
+ }
+ catch (Exception e) {
+ LOG.warn("Exception while instantiating new object of type [" + type.getName() + "]", e);
+ }
+ }
+ return desktopExtensions;
+ }
+ }
+
+ private void initExtensionProcessors() {
+ addExtensionProcessor(DESKTOP_EXTENSION_ELEMENT,
+ new IExtensionProcessor<Class<? extends IDesktopExtension>>() {
+ @Override
+ public Class<? extends IDesktopExtension> processConfigurationElement(Bundle contributor, IConfigurationElement element) throws Exception {
+ Class<? extends IDesktopExtension> desktopExtension = loadClass(contributor, IDesktopExtension.class, element.getAttribute("class"));
+ m_desktopExtensionTypes.add(desktopExtension);
+ return desktopExtension;
+ }
+ });
+ }
+
+ @Override
+ protected void removeContributions(Set<Object> contributions) {
+ m_desktopExtensionTypes.removeAll(contributions);
+ }
+}
diff --git a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/internal/DesktopMenuInjectingDesktopExtension.java b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/internal/DesktopMenuInjectingDesktopExtension.java
index 8b54499872..3304d56a45 100644
--- a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/internal/DesktopMenuInjectingDesktopExtension.java
+++ b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/internal/DesktopMenuInjectingDesktopExtension.java
@@ -1,128 +1,128 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.desktop.internal;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.holders.IHolder;
-import org.eclipse.scout.rt.client.ui.action.ActionFinder;
-import org.eclipse.scout.rt.client.ui.action.IAction;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.desktop.ContributionCommand;
-import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
-import org.eclipse.scout.rt.client.ui.desktop.IDesktopExtension;
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.extension.client.ui.action.menu.MenuExtensionUtility;
-
-/**
- * {@link IDesktopExtension} contributing, modifying and removing root-level desktop menus which are provided by the
- * <code>menus</code> extension point.
- * <p/>
- * <b>Note</b>: Menus provided by this extension are wrapped by an {@link OrderedMenuWrapper}. Hence any instance and
- * class comparisons must be performed on the unwrapped menu, that is retrieved by
- * {@link OrderedMenuWrapper#getWrappedObject()}.
- *
- * @since 3.9.0
- */
-public class DesktopMenuInjectingDesktopExtension implements IDesktopExtension {
-
- private IDesktop m_coreDesktop;
-
- @Override
- public IDesktop getCoreDesktop() {
- return m_coreDesktop;
- }
-
- @Override
- public void setCoreDesktop(IDesktop desktop) {
- m_coreDesktop = desktop;
- }
-
- @Override
- public void contributeActions(Collection<IAction> actions) {
- // get root menus and remove them from the action collection
- List<IMenu> menuList = new ActionFinder().findActions(new ArrayList<IAction>(actions), IMenu.class, false);
- actions.removeAll(menuList);
- // contribute menus to menuList and add them to the original actions collection
- MenuExtensionUtility.adaptMenus(getCoreDesktop(), getCoreDesktop(), menuList, true);
- actions.addAll(menuList);
- }
-
- @Override
- public ContributionCommand initDelegate() throws ProcessingException {
- return ContributionCommand.Continue;
- }
-
- @Override
- public ContributionCommand desktopOpenedDelegate() throws ProcessingException {
- return ContributionCommand.Continue;
- }
-
- @Override
- public ContributionCommand desktopClosingDelegate() throws ProcessingException {
- return ContributionCommand.Continue;
- }
-
- @Override
- public ContributionCommand guiAttachedDelegate() throws ProcessingException {
- return ContributionCommand.Continue;
- }
-
- @Override
- public ContributionCommand guiDetachedDelegate() throws ProcessingException {
- return ContributionCommand.Continue;
- }
-
- @Override
- public ContributionCommand outlineChangedDelegate(IOutline oldOutline, IOutline newOutline) throws ProcessingException {
- return ContributionCommand.Continue;
- }
-
- @Override
- public ContributionCommand customFormModificationDelegate(IHolder<IForm> formHolder) throws ProcessingException {
- return ContributionCommand.Continue;
- }
-
- @Override
- public ContributionCommand pageSearchFormChangedDelegate(IForm oldForm, IForm newForm) throws ProcessingException {
- return ContributionCommand.Continue;
- }
-
- @Override
- public ContributionCommand pageDetailFormChangedDelegate(IForm oldForm, IForm newForm) throws ProcessingException {
- return ContributionCommand.Continue;
- }
-
- @Override
- public ContributionCommand pageDetailTableChangedDelegate(ITable oldTable, ITable newTable) throws ProcessingException {
- return ContributionCommand.Continue;
- }
-
- @Override
- public ContributionCommand tablePageLoadedDelegate(IPageWithTable<?> tablePage) throws ProcessingException {
- return ContributionCommand.Continue;
- }
-
- @Override
- public ContributionCommand addTrayMenusDelegate(List<IMenu> menus) throws ProcessingException {
- return ContributionCommand.Continue;
- }
-
- @Override
- public void contributeOutlines(Collection<IOutline> outlines) {
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.desktop.internal;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.holders.IHolder;
+import org.eclipse.scout.rt.client.ui.action.ActionFinder;
+import org.eclipse.scout.rt.client.ui.action.IAction;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.desktop.ContributionCommand;
+import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
+import org.eclipse.scout.rt.client.ui.desktop.IDesktopExtension;
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.extension.client.ui.action.menu.MenuExtensionUtility;
+
+/**
+ * {@link IDesktopExtension} contributing, modifying and removing root-level desktop menus which are provided by the
+ * <code>menus</code> extension point.
+ * <p/>
+ * <b>Note</b>: Menus provided by this extension are wrapped by an {@link OrderedMenuWrapper}. Hence any instance and
+ * class comparisons must be performed on the unwrapped menu, that is retrieved by
+ * {@link OrderedMenuWrapper#getWrappedObject()}.
+ *
+ * @since 3.9.0
+ */
+public class DesktopMenuInjectingDesktopExtension implements IDesktopExtension {
+
+ private IDesktop m_coreDesktop;
+
+ @Override
+ public IDesktop getCoreDesktop() {
+ return m_coreDesktop;
+ }
+
+ @Override
+ public void setCoreDesktop(IDesktop desktop) {
+ m_coreDesktop = desktop;
+ }
+
+ @Override
+ public void contributeActions(Collection<IAction> actions) {
+ // get root menus and remove them from the action collection
+ List<IMenu> menuList = new ActionFinder().findActions(new ArrayList<IAction>(actions), IMenu.class, false);
+ actions.removeAll(menuList);
+ // contribute menus to menuList and add them to the original actions collection
+ MenuExtensionUtility.adaptMenus(getCoreDesktop(), getCoreDesktop(), menuList, true);
+ actions.addAll(menuList);
+ }
+
+ @Override
+ public ContributionCommand initDelegate() throws ProcessingException {
+ return ContributionCommand.Continue;
+ }
+
+ @Override
+ public ContributionCommand desktopOpenedDelegate() throws ProcessingException {
+ return ContributionCommand.Continue;
+ }
+
+ @Override
+ public ContributionCommand desktopClosingDelegate() throws ProcessingException {
+ return ContributionCommand.Continue;
+ }
+
+ @Override
+ public ContributionCommand guiAttachedDelegate() throws ProcessingException {
+ return ContributionCommand.Continue;
+ }
+
+ @Override
+ public ContributionCommand guiDetachedDelegate() throws ProcessingException {
+ return ContributionCommand.Continue;
+ }
+
+ @Override
+ public ContributionCommand outlineChangedDelegate(IOutline oldOutline, IOutline newOutline) throws ProcessingException {
+ return ContributionCommand.Continue;
+ }
+
+ @Override
+ public ContributionCommand customFormModificationDelegate(IHolder<IForm> formHolder) throws ProcessingException {
+ return ContributionCommand.Continue;
+ }
+
+ @Override
+ public ContributionCommand pageSearchFormChangedDelegate(IForm oldForm, IForm newForm) throws ProcessingException {
+ return ContributionCommand.Continue;
+ }
+
+ @Override
+ public ContributionCommand pageDetailFormChangedDelegate(IForm oldForm, IForm newForm) throws ProcessingException {
+ return ContributionCommand.Continue;
+ }
+
+ @Override
+ public ContributionCommand pageDetailTableChangedDelegate(ITable oldTable, ITable newTable) throws ProcessingException {
+ return ContributionCommand.Continue;
+ }
+
+ @Override
+ public ContributionCommand tablePageLoadedDelegate(IPageWithTable<?> tablePage) throws ProcessingException {
+ return ContributionCommand.Continue;
+ }
+
+ @Override
+ public ContributionCommand addTrayMenusDelegate(List<IMenu> menus) throws ProcessingException {
+ return ContributionCommand.Continue;
+ }
+
+ @Override
+ public void contributeOutlines(Collection<IOutline> outlines) {
+ }
+}
diff --git a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/internal/OrderedMenuWrapper.java b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/internal/OrderedMenuWrapper.java
index 2d98a925f8..aebf12bdf6 100644
--- a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/internal/OrderedMenuWrapper.java
+++ b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/internal/OrderedMenuWrapper.java
@@ -1,323 +1,323 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.desktop.internal;
-
-import java.beans.PropertyChangeListener;
-import java.security.Permission;
-import java.util.List;
-
-import org.eclipse.scout.commons.annotations.IOrdered;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.action.IActionUIFacade;
-import org.eclipse.scout.rt.client.ui.action.IActionVisitor;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.extension.client.IWrappedObject;
-
-/**
- * Wrapper for {@link IMenu}s providing the wrapped menu's order.
- *
- * @since 3.9.0
- */
-public class OrderedMenuWrapper implements IMenu, IOrdered, IWrappedObject<IMenu> {
-
- private final IMenu m_menu;
- private final double m_order;
-
- public OrderedMenuWrapper(IMenu menu, double order) {
- m_menu = menu;
- m_order = order;
- }
-
- @Override
- public double getOrder() {
- return m_order;
- }
-
- @Override
- public IMenu getWrappedObject() {
- return m_menu;
- }
-
- @Override
- public void addPropertyChangeListener(PropertyChangeListener listener) {
- m_menu.addPropertyChangeListener(listener);
- }
-
- @Override
- public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
- m_menu.addPropertyChangeListener(propertyName, listener);
- }
-
- @Override
- public void removePropertyChangeListener(PropertyChangeListener listener) {
- m_menu.removePropertyChangeListener(listener);
- }
-
- @Override
- public IMenu getParent() {
- return m_menu.getParent();
- }
-
- @Override
- public Object getProperty(String name) {
- return m_menu.getProperty(name);
- }
-
- @Override
- public void setProperty(String name, Object value) {
- m_menu.setProperty(name, value);
- }
-
- @Override
- public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) {
- m_menu.removePropertyChangeListener(propertyName, listener);
- }
-
- @Override
- public void setParent(IMenu parent) {
- m_menu.setParent(parent);
- }
-
- @Override
- public boolean hasChildActions() {
- return m_menu.hasChildActions();
- }
-
- @Override
- public int getChildActionCount() {
- return m_menu.getChildActionCount();
- }
-
- @Override
- public List<IMenu> getChildActions() {
- return m_menu.getChildActions();
- }
-
- @Override
- public void setChildActions(List<IMenu> newList) {
- m_menu.setChildActions(newList);
- }
-
- @Override
- public void doAction() throws ProcessingException {
- m_menu.doAction();
- }
-
- @Override
- public boolean hasProperty(String name) {
- return m_menu.hasProperty(name);
- }
-
- @Override
- public String getActionId() {
- return m_menu.getActionId();
- }
-
- @Override
- public String getIconId() {
- return m_menu.getIconId();
- }
-
- @Override
- public void setIconId(String iconId) {
- m_menu.setIconId(iconId);
- }
-
- @Override
- public boolean isSeparator() {
- return m_menu.isSeparator();
- }
-
- @Override
- public void setSeparator(boolean b) {
- m_menu.setSeparator(b);
- }
-
- @Override
- public String getText() {
- return m_menu.getText();
- }
-
- @Override
- public void setText(String text) {
- m_menu.setText(text);
- }
-
- @Override
- public String getKeyStroke() {
- return m_menu.getKeyStroke();
- }
-
- @Override
- public void setKeyStroke(String text) {
- m_menu.setKeyStroke(text);
- }
-
- @Override
- public String getTooltipText() {
- return m_menu.getTooltipText();
- }
-
- @Override
- public void setTooltipText(String text) {
- m_menu.setTooltipText(text);
- }
-
- @Override
- public boolean isSelected() {
- return m_menu.isSelected();
- }
-
- @Override
- public void setSelected(boolean b) {
- m_menu.setSelected(b);
- }
-
- @Override
- public boolean isEnabled() {
- return m_menu.isEnabled();
- }
-
- @Override
- public void setEnabled(boolean b) {
- m_menu.setEnabled(b);
- }
-
- @Override
- public boolean isVisible() {
- return m_menu.isVisible();
- }
-
- @Override
- public void setVisible(boolean b) {
- m_menu.setVisible(b);
- }
-
- @Override
- public boolean isInheritAccessibility() {
- return m_menu.isInheritAccessibility();
- }
-
- @Override
- public void setInheritAccessibility(boolean b) {
- m_menu.setInheritAccessibility(b);
- }
-
- @Override
- public void setEnabledPermission(Permission p) {
- m_menu.setEnabledPermission(p);
- }
-
- @Override
- public boolean isEnabledGranted() {
- return m_menu.isEnabledGranted();
- }
-
- @Override
- public void setEnabledGranted(boolean b) {
- m_menu.setEnabledGranted(b);
- }
-
- @Override
- public boolean isEnabledProcessingAction() {
- return m_menu.isEnabledProcessingAction();
- }
-
- @Override
- public void setEnabledProcessingAction(boolean b) {
- m_menu.setEnabledProcessingAction(b);
- }
-
- @Override
- public void setVisiblePermission(Permission p) {
- m_menu.setVisiblePermission(p);
- }
-
- @Override
- public boolean isVisibleGranted() {
- return m_menu.isVisibleGranted();
- }
-
- @Override
- public void setVisibleGranted(boolean b) {
- m_menu.setVisibleGranted(b);
- }
-
- @Override
- public boolean isSingleSelectionAction() {
- return m_menu.isSingleSelectionAction();
- }
-
- @Override
- public void setSingleSelectionAction(boolean b) {
- m_menu.setSingleSelectionAction(b);
- }
-
- @Override
- public boolean isMultiSelectionAction() {
- return m_menu.isMultiSelectionAction();
- }
-
- @Override
- public void setMultiSelectionAction(boolean b) {
- m_menu.setMultiSelectionAction(b);
- }
-
- @Override
- public boolean isEmptySpaceAction() {
- return m_menu.isEmptySpaceAction();
- }
-
- @Override
- public void setEmptySpaceAction(boolean b) {
- m_menu.setEmptySpaceAction(b);
- }
-
- @Override
- public boolean isToggleAction() {
- return m_menu.isToggleAction();
- }
-
- @Override
- public void setToggleAction(boolean b) {
- m_menu.setToggleAction(b);
- }
-
- @Override
- public char getMnemonic() {
- return m_menu.getMnemonic();
- }
-
- @Override
- public void prepareAction() {
- m_menu.prepareAction();
- }
-
- @Override
- public IActionUIFacade getUIFacade() {
- return m_menu.getUIFacade();
- }
-
- @Override
- public int acceptVisitor(IActionVisitor visitor) {
- return m_menu.acceptVisitor(visitor);
- }
-
- @Override
- public boolean isThisAndParentsEnabled() {
- return m_menu.isThisAndParentsEnabled();
- }
-
- @Override
- public boolean isThisAndParentsVisible() {
- return m_menu.isThisAndParentsVisible();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.desktop.internal;
+
+import java.beans.PropertyChangeListener;
+import java.security.Permission;
+import java.util.List;
+
+import org.eclipse.scout.commons.annotations.IOrdered;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.action.IActionUIFacade;
+import org.eclipse.scout.rt.client.ui.action.IActionVisitor;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.extension.client.IWrappedObject;
+
+/**
+ * Wrapper for {@link IMenu}s providing the wrapped menu's order.
+ *
+ * @since 3.9.0
+ */
+public class OrderedMenuWrapper implements IMenu, IOrdered, IWrappedObject<IMenu> {
+
+ private final IMenu m_menu;
+ private final double m_order;
+
+ public OrderedMenuWrapper(IMenu menu, double order) {
+ m_menu = menu;
+ m_order = order;
+ }
+
+ @Override
+ public double getOrder() {
+ return m_order;
+ }
+
+ @Override
+ public IMenu getWrappedObject() {
+ return m_menu;
+ }
+
+ @Override
+ public void addPropertyChangeListener(PropertyChangeListener listener) {
+ m_menu.addPropertyChangeListener(listener);
+ }
+
+ @Override
+ public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
+ m_menu.addPropertyChangeListener(propertyName, listener);
+ }
+
+ @Override
+ public void removePropertyChangeListener(PropertyChangeListener listener) {
+ m_menu.removePropertyChangeListener(listener);
+ }
+
+ @Override
+ public IMenu getParent() {
+ return m_menu.getParent();
+ }
+
+ @Override
+ public Object getProperty(String name) {
+ return m_menu.getProperty(name);
+ }
+
+ @Override
+ public void setProperty(String name, Object value) {
+ m_menu.setProperty(name, value);
+ }
+
+ @Override
+ public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) {
+ m_menu.removePropertyChangeListener(propertyName, listener);
+ }
+
+ @Override
+ public void setParent(IMenu parent) {
+ m_menu.setParent(parent);
+ }
+
+ @Override
+ public boolean hasChildActions() {
+ return m_menu.hasChildActions();
+ }
+
+ @Override
+ public int getChildActionCount() {
+ return m_menu.getChildActionCount();
+ }
+
+ @Override
+ public List<IMenu> getChildActions() {
+ return m_menu.getChildActions();
+ }
+
+ @Override
+ public void setChildActions(List<IMenu> newList) {
+ m_menu.setChildActions(newList);
+ }
+
+ @Override
+ public void doAction() throws ProcessingException {
+ m_menu.doAction();
+ }
+
+ @Override
+ public boolean hasProperty(String name) {
+ return m_menu.hasProperty(name);
+ }
+
+ @Override
+ public String getActionId() {
+ return m_menu.getActionId();
+ }
+
+ @Override
+ public String getIconId() {
+ return m_menu.getIconId();
+ }
+
+ @Override
+ public void setIconId(String iconId) {
+ m_menu.setIconId(iconId);
+ }
+
+ @Override
+ public boolean isSeparator() {
+ return m_menu.isSeparator();
+ }
+
+ @Override
+ public void setSeparator(boolean b) {
+ m_menu.setSeparator(b);
+ }
+
+ @Override
+ public String getText() {
+ return m_menu.getText();
+ }
+
+ @Override
+ public void setText(String text) {
+ m_menu.setText(text);
+ }
+
+ @Override
+ public String getKeyStroke() {
+ return m_menu.getKeyStroke();
+ }
+
+ @Override
+ public void setKeyStroke(String text) {
+ m_menu.setKeyStroke(text);
+ }
+
+ @Override
+ public String getTooltipText() {
+ return m_menu.getTooltipText();
+ }
+
+ @Override
+ public void setTooltipText(String text) {
+ m_menu.setTooltipText(text);
+ }
+
+ @Override
+ public boolean isSelected() {
+ return m_menu.isSelected();
+ }
+
+ @Override
+ public void setSelected(boolean b) {
+ m_menu.setSelected(b);
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return m_menu.isEnabled();
+ }
+
+ @Override
+ public void setEnabled(boolean b) {
+ m_menu.setEnabled(b);
+ }
+
+ @Override
+ public boolean isVisible() {
+ return m_menu.isVisible();
+ }
+
+ @Override
+ public void setVisible(boolean b) {
+ m_menu.setVisible(b);
+ }
+
+ @Override
+ public boolean isInheritAccessibility() {
+ return m_menu.isInheritAccessibility();
+ }
+
+ @Override
+ public void setInheritAccessibility(boolean b) {
+ m_menu.setInheritAccessibility(b);
+ }
+
+ @Override
+ public void setEnabledPermission(Permission p) {
+ m_menu.setEnabledPermission(p);
+ }
+
+ @Override
+ public boolean isEnabledGranted() {
+ return m_menu.isEnabledGranted();
+ }
+
+ @Override
+ public void setEnabledGranted(boolean b) {
+ m_menu.setEnabledGranted(b);
+ }
+
+ @Override
+ public boolean isEnabledProcessingAction() {
+ return m_menu.isEnabledProcessingAction();
+ }
+
+ @Override
+ public void setEnabledProcessingAction(boolean b) {
+ m_menu.setEnabledProcessingAction(b);
+ }
+
+ @Override
+ public void setVisiblePermission(Permission p) {
+ m_menu.setVisiblePermission(p);
+ }
+
+ @Override
+ public boolean isVisibleGranted() {
+ return m_menu.isVisibleGranted();
+ }
+
+ @Override
+ public void setVisibleGranted(boolean b) {
+ m_menu.setVisibleGranted(b);
+ }
+
+ @Override
+ public boolean isSingleSelectionAction() {
+ return m_menu.isSingleSelectionAction();
+ }
+
+ @Override
+ public void setSingleSelectionAction(boolean b) {
+ m_menu.setSingleSelectionAction(b);
+ }
+
+ @Override
+ public boolean isMultiSelectionAction() {
+ return m_menu.isMultiSelectionAction();
+ }
+
+ @Override
+ public void setMultiSelectionAction(boolean b) {
+ m_menu.setMultiSelectionAction(b);
+ }
+
+ @Override
+ public boolean isEmptySpaceAction() {
+ return m_menu.isEmptySpaceAction();
+ }
+
+ @Override
+ public void setEmptySpaceAction(boolean b) {
+ m_menu.setEmptySpaceAction(b);
+ }
+
+ @Override
+ public boolean isToggleAction() {
+ return m_menu.isToggleAction();
+ }
+
+ @Override
+ public void setToggleAction(boolean b) {
+ m_menu.setToggleAction(b);
+ }
+
+ @Override
+ public char getMnemonic() {
+ return m_menu.getMnemonic();
+ }
+
+ @Override
+ public void prepareAction() {
+ m_menu.prepareAction();
+ }
+
+ @Override
+ public IActionUIFacade getUIFacade() {
+ return m_menu.getUIFacade();
+ }
+
+ @Override
+ public int acceptVisitor(IActionVisitor visitor) {
+ return m_menu.acceptVisitor(visitor);
+ }
+
+ @Override
+ public boolean isThisAndParentsEnabled() {
+ return m_menu.isThisAndParentsEnabled();
+ }
+
+ @Override
+ public boolean isThisAndParentsVisible() {
+ return m_menu.isThisAndParentsVisible();
+ }
+}
diff --git a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/AbstractExtensibleOutline.java b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/AbstractExtensibleOutline.java
index 33d3a0eabd..d73c3b8477 100644
--- a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/AbstractExtensibleOutline.java
+++ b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/AbstractExtensibleOutline.java
@@ -1,36 +1,36 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.desktop.outline;
-
-import java.util.Collection;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.desktop.outline.AbstractOutline;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.extension.client.IExtensibleScoutObject;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.PageExtensionUtility;
-
-/**
- * Outline supporting the following Scout extension features:
- * <ul>
- * <li>adding, removing and modifying statically configured pages</li>
- * </ul>
- *
- * @since 3.9.0
- */
-public abstract class AbstractExtensibleOutline extends AbstractOutline implements IExtensibleScoutObject {
-
- @Override
- protected void createChildPagesInternal(Collection<IPage> pageList) throws ProcessingException {
- super.createChildPagesInternal(pageList);
- PageExtensionUtility.adaptOutline(this, pageList);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.desktop.outline;
+
+import java.util.Collection;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.desktop.outline.AbstractOutline;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.extension.client.IExtensibleScoutObject;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.PageExtensionUtility;
+
+/**
+ * Outline supporting the following Scout extension features:
+ * <ul>
+ * <li>adding, removing and modifying statically configured pages</li>
+ * </ul>
+ *
+ * @since 3.9.0
+ */
+public abstract class AbstractExtensibleOutline extends AbstractOutline implements IExtensibleScoutObject {
+
+ @Override
+ protected void createChildPagesInternal(Collection<IPage> pageList) throws ProcessingException {
+ super.createChildPagesInternal(pageList);
+ PageExtensionUtility.adaptOutline(this, pageList);
+ }
+}
diff --git a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/AbstractExtensiblePageWithNodes.java b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/AbstractExtensiblePageWithNodes.java
index 630341a594..aa3f0fa9f4 100644
--- a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/AbstractExtensiblePageWithNodes.java
+++ b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/AbstractExtensiblePageWithNodes.java
@@ -1,72 +1,72 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages;
-
-import java.util.Collection;
-import java.util.List;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.AbstractPageWithNodes;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.extension.client.ExtensionUtility;
-import org.eclipse.scout.rt.extension.client.IExtensibleScoutObject;
-import org.eclipse.scout.rt.extension.client.ui.action.menu.MenuExtensionUtility;
-import org.eclipse.scout.rt.shared.ContextMap;
-
-/**
- * Page with nodes supporting the following Scout extension features:
- * <ul>
- * <li>adding, removing and modifying statically configured pages</li>
- * <li>adding, removing and modifying statically configured menus</li>
- * </ul>
- *
- * @since 3.9.0
- */
-public abstract class AbstractExtensiblePageWithNodes extends AbstractPageWithNodes implements IExtensibleScoutObject {
-
- public AbstractExtensiblePageWithNodes() {
- super();
- }
-
- public AbstractExtensiblePageWithNodes(boolean callInitializer) {
- super(callInitializer);
- }
-
- public AbstractExtensiblePageWithNodes(ContextMap contextMap) {
- super(contextMap);
- }
-
- public AbstractExtensiblePageWithNodes(String userPreferenceContext) {
- super(userPreferenceContext);
- }
-
- public AbstractExtensiblePageWithNodes(boolean callInitializer, String userPreferenceContext) {
- super(callInitializer, userPreferenceContext);
- }
-
- public AbstractExtensiblePageWithNodes(boolean callInitializer, ContextMap contextMap, String userPreferenceContext) {
- super(callInitializer, contextMap, userPreferenceContext);
- }
-
- @Override
- protected void createChildPagesInternal(Collection<IPage> pageList) throws ProcessingException {
- super.createChildPagesInternal(pageList);
- PageExtensionUtility.adaptPageWithNodes(this, pageList);
- }
-
- @Override
- protected void injectMenusInternal(List<IMenu> menuList) {
- super.injectMenusInternal(menuList);
- MenuExtensionUtility.adaptMenus(this, this, menuList);
- ExtensionUtility.processReplaceAnnotations(menuList);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.AbstractPageWithNodes;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.extension.client.ExtensionUtility;
+import org.eclipse.scout.rt.extension.client.IExtensibleScoutObject;
+import org.eclipse.scout.rt.extension.client.ui.action.menu.MenuExtensionUtility;
+import org.eclipse.scout.rt.shared.ContextMap;
+
+/**
+ * Page with nodes supporting the following Scout extension features:
+ * <ul>
+ * <li>adding, removing and modifying statically configured pages</li>
+ * <li>adding, removing and modifying statically configured menus</li>
+ * </ul>
+ *
+ * @since 3.9.0
+ */
+public abstract class AbstractExtensiblePageWithNodes extends AbstractPageWithNodes implements IExtensibleScoutObject {
+
+ public AbstractExtensiblePageWithNodes() {
+ super();
+ }
+
+ public AbstractExtensiblePageWithNodes(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ public AbstractExtensiblePageWithNodes(ContextMap contextMap) {
+ super(contextMap);
+ }
+
+ public AbstractExtensiblePageWithNodes(String userPreferenceContext) {
+ super(userPreferenceContext);
+ }
+
+ public AbstractExtensiblePageWithNodes(boolean callInitializer, String userPreferenceContext) {
+ super(callInitializer, userPreferenceContext);
+ }
+
+ public AbstractExtensiblePageWithNodes(boolean callInitializer, ContextMap contextMap, String userPreferenceContext) {
+ super(callInitializer, contextMap, userPreferenceContext);
+ }
+
+ @Override
+ protected void createChildPagesInternal(Collection<IPage> pageList) throws ProcessingException {
+ super.createChildPagesInternal(pageList);
+ PageExtensionUtility.adaptPageWithNodes(this, pageList);
+ }
+
+ @Override
+ protected void injectMenusInternal(List<IMenu> menuList) {
+ super.injectMenusInternal(menuList);
+ MenuExtensionUtility.adaptMenus(this, this, menuList);
+ ExtensionUtility.processReplaceAnnotations(menuList);
+ }
+}
diff --git a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/AbstractExtensiblePageWithTable.java b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/AbstractExtensiblePageWithTable.java
index 2a5685e692..09611884ff 100644
--- a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/AbstractExtensiblePageWithTable.java
+++ b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/AbstractExtensiblePageWithTable.java
@@ -1,65 +1,65 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.AbstractPageWithTable;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.extension.client.IExtensibleScoutObject;
-import org.eclipse.scout.rt.shared.ContextMap;
-
-/**
- * Page with table implementation supporting the following Scout extension features:
- * <ul>
- * <li>adding, removing and modifying statically configured pages</li>
- * </ul>
- *
- * @since 3.9.0
- */
-public abstract class AbstractExtensiblePageWithTable<T extends ITable> extends AbstractPageWithTable<T> implements IExtensibleScoutObject {
-
- public AbstractExtensiblePageWithTable() {
- super();
- }
-
- public AbstractExtensiblePageWithTable(boolean callInitializer) {
- super(callInitializer);
- }
-
- public AbstractExtensiblePageWithTable(ContextMap contextMap) {
- super(contextMap);
- }
-
- public AbstractExtensiblePageWithTable(String userPreferenceContext) {
- super(userPreferenceContext);
- }
-
- public AbstractExtensiblePageWithTable(boolean callInitializer, ContextMap contextMap) {
- super(callInitializer, contextMap);
- }
-
- public AbstractExtensiblePageWithTable(boolean callInitializer, String userPreferenceContext) {
- super(callInitializer, userPreferenceContext);
- }
-
- public AbstractExtensiblePageWithTable(boolean callInitializer, ContextMap contextMap, String userPreferenceContext) {
- super(callInitializer, contextMap, userPreferenceContext);
- }
-
- @Override
- protected IPage createChildPageInternal(ITableRow row) throws ProcessingException {
- IPage childPage = super.createChildPageInternal(row);
- PageExtensionUtility.adaptPage(getOutline(), this, childPage);
- return childPage;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.AbstractPageWithTable;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.extension.client.IExtensibleScoutObject;
+import org.eclipse.scout.rt.shared.ContextMap;
+
+/**
+ * Page with table implementation supporting the following Scout extension features:
+ * <ul>
+ * <li>adding, removing and modifying statically configured pages</li>
+ * </ul>
+ *
+ * @since 3.9.0
+ */
+public abstract class AbstractExtensiblePageWithTable<T extends ITable> extends AbstractPageWithTable<T> implements IExtensibleScoutObject {
+
+ public AbstractExtensiblePageWithTable() {
+ super();
+ }
+
+ public AbstractExtensiblePageWithTable(boolean callInitializer) {
+ super(callInitializer);
+ }
+
+ public AbstractExtensiblePageWithTable(ContextMap contextMap) {
+ super(contextMap);
+ }
+
+ public AbstractExtensiblePageWithTable(String userPreferenceContext) {
+ super(userPreferenceContext);
+ }
+
+ public AbstractExtensiblePageWithTable(boolean callInitializer, ContextMap contextMap) {
+ super(callInitializer, contextMap);
+ }
+
+ public AbstractExtensiblePageWithTable(boolean callInitializer, String userPreferenceContext) {
+ super(callInitializer, userPreferenceContext);
+ }
+
+ public AbstractExtensiblePageWithTable(boolean callInitializer, ContextMap contextMap, String userPreferenceContext) {
+ super(callInitializer, contextMap, userPreferenceContext);
+ }
+
+ @Override
+ protected IPage createChildPageInternal(ITableRow row) throws ProcessingException {
+ IPage childPage = super.createChildPageInternal(row);
+ PageExtensionUtility.adaptPage(getOutline(), this, childPage);
+ return childPage;
+ }
+}
diff --git a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/CompositePageFilter.java b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/CompositePageFilter.java
index 610e18b311..8be004c067 100644
--- a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/CompositePageFilter.java
+++ b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/CompositePageFilter.java
@@ -1,43 +1,43 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages;
-
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.extension.client.internal.AbstractCompositeExtensionFilter;
-
-/**
- * Composite page filter class containing other page filters. Invoking {@link #accept(IOutline, IPage, IPage)} returns
- * <code>true</code>, iff all contained filters return <code>true</code>. Otherwise <code>false</code>.
- *
- * @since 3.9.0
- */
-public class CompositePageFilter extends AbstractCompositeExtensionFilter<IPageExtensionFilter> implements IPageExtensionFilter {
-
- public CompositePageFilter(IPageExtensionFilter... filters) {
- super(filters);
- }
-
- /**
- * Returns <code>true</code> if all contained page filters return <code>true</code>. Otherwise <code>false</code>.
- *
- * @see IPageExtensionFilter#accept(IOutline, IPage, IPage)
- */
- @Override
- public boolean accept(IOutline outline, IPage parentPage, IPage affectedPage) {
- for (IPageExtensionFilter filter : getFilters()) {
- if (!filter.accept(outline, parentPage, affectedPage)) {
- return false;
- }
- }
- return true;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages;
+
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.extension.client.internal.AbstractCompositeExtensionFilter;
+
+/**
+ * Composite page filter class containing other page filters. Invoking {@link #accept(IOutline, IPage, IPage)} returns
+ * <code>true</code>, iff all contained filters return <code>true</code>. Otherwise <code>false</code>.
+ *
+ * @since 3.9.0
+ */
+public class CompositePageFilter extends AbstractCompositeExtensionFilter<IPageExtensionFilter> implements IPageExtensionFilter {
+
+ public CompositePageFilter(IPageExtensionFilter... filters) {
+ super(filters);
+ }
+
+ /**
+ * Returns <code>true</code> if all contained page filters return <code>true</code>. Otherwise <code>false</code>.
+ *
+ * @see IPageExtensionFilter#accept(IOutline, IPage, IPage)
+ */
+ @Override
+ public boolean accept(IOutline outline, IPage parentPage, IPage affectedPage) {
+ for (IPageExtensionFilter filter : getFilters()) {
+ if (!filter.accept(outline, parentPage, affectedPage)) {
+ return false;
+ }
+ }
+ return true;
+ }
+}
diff --git a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/IPageExtensionFilter.java b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/IPageExtensionFilter.java
index 6dec015aaa..8edb80a96f 100644
--- a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/IPageExtensionFilter.java
+++ b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/IPageExtensionFilter.java
@@ -1,40 +1,40 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages;
-
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-
-/**
- * A page extension filter is used to control whether a page extension is applied in a particular environment.
- *
- * @since 3.9.0
- */
-public interface IPageExtensionFilter {
-
- /**
- * This method is called to decide whether an extension is used in the given context. The parameter
- * <code>outline</code> is never <code>null</code>. The parameter <code>parentPage</code> however is <code>null</code>
- * if the filter is invoked in the context of an outline (i.e. whenever an extension is checked to be applied on an
- * outline's root level).
- *
- * @param outline
- * the current context's outline instance. Never <code>null</code>.
- * @param parentPage
- * the current context's parent page instance or <code>null</code>, if there is no parent page.
- * @param affectedPage
- * the page to be modified or removed or <code>null</code>, if the filter is applied on a page contribution
- * extension.
- * @return Returns <code>true</code> if the extension has to be applied in the given context. Otherwise
- * <code>false</code>.
- */
- boolean accept(IOutline outline, IPage parentPage, IPage affectedPage);
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages;
+
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+
+/**
+ * A page extension filter is used to control whether a page extension is applied in a particular environment.
+ *
+ * @since 3.9.0
+ */
+public interface IPageExtensionFilter {
+
+ /**
+ * This method is called to decide whether an extension is used in the given context. The parameter
+ * <code>outline</code> is never <code>null</code>. The parameter <code>parentPage</code> however is <code>null</code>
+ * if the filter is invoked in the context of an outline (i.e. whenever an extension is checked to be applied on an
+ * outline's root level).
+ *
+ * @param outline
+ * the current context's outline instance. Never <code>null</code>.
+ * @param parentPage
+ * the current context's parent page instance or <code>null</code>, if there is no parent page.
+ * @param affectedPage
+ * the page to be modified or removed or <code>null</code>, if the filter is applied on a page contribution
+ * extension.
+ * @return Returns <code>true</code> if the extension has to be applied in the given context. Otherwise
+ * <code>false</code>.
+ */
+ boolean accept(IOutline outline, IPage parentPage, IPage affectedPage);
+}
diff --git a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/IPageModifier.java b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/IPageModifier.java
index 9537a21b1f..c58cf526f7 100644
--- a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/IPageModifier.java
+++ b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/IPageModifier.java
@@ -1,38 +1,38 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-
-/**
- * This interface is used for modifying {@link IPage}s. Classes implementing this interface must provide a default
- * constructor.
- *
- * @since 3.9.0
- */
-public interface IPageModifier<T extends IPage> {
-
- /**
- * This method allows modifying configured pages. The parameter <code>outline</code> is never <code>null</code>. The
- * parameter <code>parentPage</code> however is <code>null</code> if this method is invoked in the context of an
- * outline.
- *
- * @param outline
- * the current context's outline instance. Never <code>null</code>.
- * @param parentPage
- * the current context's parent page instance or <code>null</code>, if there is no parent page.
- * @param page
- * the page to be modified.
- */
- void modify(IOutline outline, IPage parentPage, T page) throws ProcessingException;
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+
+/**
+ * This interface is used for modifying {@link IPage}s. Classes implementing this interface must provide a default
+ * constructor.
+ *
+ * @since 3.9.0
+ */
+public interface IPageModifier<T extends IPage> {
+
+ /**
+ * This method allows modifying configured pages. The parameter <code>outline</code> is never <code>null</code>. The
+ * parameter <code>parentPage</code> however is <code>null</code> if this method is invoked in the context of an
+ * outline.
+ *
+ * @param outline
+ * the current context's outline instance. Never <code>null</code>.
+ * @param parentPage
+ * the current context's parent page instance or <code>null</code>, if there is no parent page.
+ * @param page
+ * the page to be modified.
+ */
+ void modify(IOutline outline, IPage parentPage, T page) throws ProcessingException;
+}
diff --git a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/PageExtensionUtility.java b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/PageExtensionUtility.java
index a5d721151c..36712e4f77 100644
--- a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/PageExtensionUtility.java
+++ b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/PageExtensionUtility.java
@@ -1,195 +1,195 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.TreeMap;
-
-import org.eclipse.scout.commons.CompositeObject;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithNodes;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
-import org.eclipse.scout.rt.extension.client.Activator;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.AbstractExtensibleOutline;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.internal.PageContributionExtension;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.internal.PageExtensionManager;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.internal.PageModificationExtension;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.internal.PageRemoveExtension;
-
-/**
- * Utility for applying page extensions. The three abstract classes {@link AbstractExtensibleOutline},
- * {@link AbstractExtensiblePageWithNodes} and {@link AbstractExtensiblePageWithTable} should be used in general for
- * providing extensible outlines. This utility class is intended to be used in cases in which it is not possible to
- * modify the given class hierarchy.
- *
- * @since 3.9.0
- */
-public final class PageExtensionUtility {
- private final static IScoutLogger LOG = ScoutLogManager.getLogger(PageExtensionUtility.class);
-
- private PageExtensionUtility() {
- // utility class
- }
-
- /**
- * Adapts the given {@link IPageWithNodes} by adding new pages to the given page list and by removing or modifying
- * existing pages.
- *
- * @param nodePage
- * @param pageList
- * @throws ProcessingException
- * @see {@link AbstractExtensiblePageWithNodes}
- */
- public static void adaptPageWithNodes(IPageWithNodes nodePage, Collection<IPage> pageList) throws ProcessingException {
- if (nodePage == null) {
- throw new ProcessingException("nodePage must not be null");
- }
- if (pageList == null) {
- throw new ProcessingException("pageList must not be null");
- }
- IOutline outline = nodePage.getOutline();
- PageExtensionManager extensionManager = Activator.getDefault().getPagesExtensionManager();
- contributePages(outline, nodePage, extensionManager.getPageContributionExtensions(), pageList);
- removePages(outline, nodePage, extensionManager.getPageRemovalExtensions(), pageList);
- modifyPages(outline, nodePage, extensionManager.getPageModificationExtensions(), pageList);
- }
-
- /**
- * Adapts the given {@link IOutline} by adding new pages to the given page list and by removing or modifying
- * existing pages.
- *
- * @param outline
- * @param pageList
- * @throws ProcessingException
- * @see {@link AbstractExtensibleOutline}
- */
- public static void adaptOutline(IOutline outline, Collection<IPage> pageList) throws ProcessingException {
- if (outline == null) {
- throw new ProcessingException("outline must not be null");
- }
- if (pageList == null) {
- throw new ProcessingException("pageList must not be null");
- }
- PageExtensionManager extensionManager = Activator.getDefault().getPagesExtensionManager();
- contributePages(outline, null, extensionManager.getPageContributionExtensions(), pageList);
- removePages(outline, null, extensionManager.getPageRemovalExtensions(), pageList);
- modifyPages(outline, null, extensionManager.getPageModificationExtensions(), pageList);
- }
-
- /**
- * Adapts the given page by applying page modifications contributed by extensions.
- *
- * @param outline
- * @param parentPage
- * @param page
- * @throws ProcessingException
- * @see {@link AbstractExtensiblePageWithTable}
- */
- public static void adaptPage(IOutline outline, IPageWithTable<? extends ITable> parentPage, IPage page) throws ProcessingException {
- if (outline == null) {
- throw new ProcessingException("outline must not be null");
- }
- if (parentPage == null) {
- throw new ProcessingException("parentPage must not be null");
- }
- if (page == null) {
- throw new ProcessingException("page must not be null");
- }
- PageExtensionManager extensionManager = Activator.getDefault().getPagesExtensionManager();
- modifyPages(outline, parentPage, extensionManager.getPageModificationExtensions(), Collections.singletonList(page));
- }
-
- static void contributePages(IOutline outline, IPageWithNodes parentPage, List<PageContributionExtension> extensions, Collection<IPage> pageList) throws ProcessingException {
- if (extensions == null || extensions.isEmpty()) {
- return;
- }
-
- // filter matching extensions
- List<PageContributionExtension> matchingExtensions = new LinkedList<PageContributionExtension>();
- for (PageContributionExtension e : extensions) {
- if (e.accept(outline, parentPage, null)) {
- matchingExtensions.add(e);
- }
- }
-
- if (matchingExtensions.isEmpty()) {
- return;
- }
-
- TreeMap<CompositeObject, IPage> orderedPages = new TreeMap<CompositeObject, IPage>();
- // assign synthetic order to existing pages
- int counter = 0;
- for (IPage p : pageList) {
- orderedPages.put(new CompositeObject(Double.valueOf((counter + 1) * 10), counter), p);
- counter++;
- }
- // create new pages
- for (PageContributionExtension e : matchingExtensions) {
- try {
- IPage p = e.createContribution(outline, parentPage);
- orderedPages.put(new CompositeObject(e.getOrder(), counter), p);
- counter++;
- }
- catch (Throwable t) {
- LOG.error("Exception while creating an instance of a contributed page", t);
- }
- }
-
- // reorder existing and add new pages
- pageList.clear();
- pageList.addAll(orderedPages.values());
- }
-
- static void removePages(IOutline outline, IPage parentPage, List<PageRemoveExtension> extensions, Collection<IPage> pageList) {
- if (extensions == null || extensions.isEmpty()) {
- return;
- }
-
- for (Iterator<IPage> it = pageList.iterator(); it.hasNext();) {
- IPage page = it.next();
- for (PageRemoveExtension removeExtension : extensions) {
- if (removeExtension.accept(outline, parentPage, page)) {
- it.remove();
- break;
- }
- }
- }
- }
-
- static void modifyPages(IOutline outline, IPage parentPage, List<PageModificationExtension> extensions, Collection<IPage> pageList) {
- if (extensions == null || extensions.isEmpty()) {
- return;
- }
-
- for (PageModificationExtension ext : extensions) {
- for (IPage page : pageList) {
- try {
- if (ext.accept(outline, parentPage, page)) {
- IPageModifier<IPage> pageModifier = ext.createPageModifier();
- pageModifier.modify(outline, parentPage, page);
- }
- }
- catch (ProcessingException e) {
- LOG.error("Exception while modifying page", e);
- }
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.TreeMap;
+
+import org.eclipse.scout.commons.CompositeObject;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithNodes;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable;
+import org.eclipse.scout.rt.extension.client.Activator;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.AbstractExtensibleOutline;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.internal.PageContributionExtension;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.internal.PageExtensionManager;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.internal.PageModificationExtension;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.internal.PageRemoveExtension;
+
+/**
+ * Utility for applying page extensions. The three abstract classes {@link AbstractExtensibleOutline},
+ * {@link AbstractExtensiblePageWithNodes} and {@link AbstractExtensiblePageWithTable} should be used in general for
+ * providing extensible outlines. This utility class is intended to be used in cases in which it is not possible to
+ * modify the given class hierarchy.
+ *
+ * @since 3.9.0
+ */
+public final class PageExtensionUtility {
+ private final static IScoutLogger LOG = ScoutLogManager.getLogger(PageExtensionUtility.class);
+
+ private PageExtensionUtility() {
+ // utility class
+ }
+
+ /**
+ * Adapts the given {@link IPageWithNodes} by adding new pages to the given page list and by removing or modifying
+ * existing pages.
+ *
+ * @param nodePage
+ * @param pageList
+ * @throws ProcessingException
+ * @see {@link AbstractExtensiblePageWithNodes}
+ */
+ public static void adaptPageWithNodes(IPageWithNodes nodePage, Collection<IPage> pageList) throws ProcessingException {
+ if (nodePage == null) {
+ throw new ProcessingException("nodePage must not be null");
+ }
+ if (pageList == null) {
+ throw new ProcessingException("pageList must not be null");
+ }
+ IOutline outline = nodePage.getOutline();
+ PageExtensionManager extensionManager = Activator.getDefault().getPagesExtensionManager();
+ contributePages(outline, nodePage, extensionManager.getPageContributionExtensions(), pageList);
+ removePages(outline, nodePage, extensionManager.getPageRemovalExtensions(), pageList);
+ modifyPages(outline, nodePage, extensionManager.getPageModificationExtensions(), pageList);
+ }
+
+ /**
+ * Adapts the given {@link IOutline} by adding new pages to the given page list and by removing or modifying
+ * existing pages.
+ *
+ * @param outline
+ * @param pageList
+ * @throws ProcessingException
+ * @see {@link AbstractExtensibleOutline}
+ */
+ public static void adaptOutline(IOutline outline, Collection<IPage> pageList) throws ProcessingException {
+ if (outline == null) {
+ throw new ProcessingException("outline must not be null");
+ }
+ if (pageList == null) {
+ throw new ProcessingException("pageList must not be null");
+ }
+ PageExtensionManager extensionManager = Activator.getDefault().getPagesExtensionManager();
+ contributePages(outline, null, extensionManager.getPageContributionExtensions(), pageList);
+ removePages(outline, null, extensionManager.getPageRemovalExtensions(), pageList);
+ modifyPages(outline, null, extensionManager.getPageModificationExtensions(), pageList);
+ }
+
+ /**
+ * Adapts the given page by applying page modifications contributed by extensions.
+ *
+ * @param outline
+ * @param parentPage
+ * @param page
+ * @throws ProcessingException
+ * @see {@link AbstractExtensiblePageWithTable}
+ */
+ public static void adaptPage(IOutline outline, IPageWithTable<? extends ITable> parentPage, IPage page) throws ProcessingException {
+ if (outline == null) {
+ throw new ProcessingException("outline must not be null");
+ }
+ if (parentPage == null) {
+ throw new ProcessingException("parentPage must not be null");
+ }
+ if (page == null) {
+ throw new ProcessingException("page must not be null");
+ }
+ PageExtensionManager extensionManager = Activator.getDefault().getPagesExtensionManager();
+ modifyPages(outline, parentPage, extensionManager.getPageModificationExtensions(), Collections.singletonList(page));
+ }
+
+ static void contributePages(IOutline outline, IPageWithNodes parentPage, List<PageContributionExtension> extensions, Collection<IPage> pageList) throws ProcessingException {
+ if (extensions == null || extensions.isEmpty()) {
+ return;
+ }
+
+ // filter matching extensions
+ List<PageContributionExtension> matchingExtensions = new LinkedList<PageContributionExtension>();
+ for (PageContributionExtension e : extensions) {
+ if (e.accept(outline, parentPage, null)) {
+ matchingExtensions.add(e);
+ }
+ }
+
+ if (matchingExtensions.isEmpty()) {
+ return;
+ }
+
+ TreeMap<CompositeObject, IPage> orderedPages = new TreeMap<CompositeObject, IPage>();
+ // assign synthetic order to existing pages
+ int counter = 0;
+ for (IPage p : pageList) {
+ orderedPages.put(new CompositeObject(Double.valueOf((counter + 1) * 10), counter), p);
+ counter++;
+ }
+ // create new pages
+ for (PageContributionExtension e : matchingExtensions) {
+ try {
+ IPage p = e.createContribution(outline, parentPage);
+ orderedPages.put(new CompositeObject(e.getOrder(), counter), p);
+ counter++;
+ }
+ catch (Throwable t) {
+ LOG.error("Exception while creating an instance of a contributed page", t);
+ }
+ }
+
+ // reorder existing and add new pages
+ pageList.clear();
+ pageList.addAll(orderedPages.values());
+ }
+
+ static void removePages(IOutline outline, IPage parentPage, List<PageRemoveExtension> extensions, Collection<IPage> pageList) {
+ if (extensions == null || extensions.isEmpty()) {
+ return;
+ }
+
+ for (Iterator<IPage> it = pageList.iterator(); it.hasNext();) {
+ IPage page = it.next();
+ for (PageRemoveExtension removeExtension : extensions) {
+ if (removeExtension.accept(outline, parentPage, page)) {
+ it.remove();
+ break;
+ }
+ }
+ }
+ }
+
+ static void modifyPages(IOutline outline, IPage parentPage, List<PageModificationExtension> extensions, Collection<IPage> pageList) {
+ if (extensions == null || extensions.isEmpty()) {
+ return;
+ }
+
+ for (PageModificationExtension ext : extensions) {
+ for (IPage page : pageList) {
+ try {
+ if (ext.accept(outline, parentPage, page)) {
+ IPageModifier<IPage> pageModifier = ext.createPageModifier();
+ pageModifier.modify(outline, parentPage, page);
+ }
+ }
+ catch (ProcessingException e) {
+ LOG.error("Exception while modifying page", e);
+ }
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/internal/AbstractPageExtension.java b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/internal/AbstractPageExtension.java
index 3051d4c739..3ee156a1fe 100644
--- a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/internal/AbstractPageExtension.java
+++ b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/internal/AbstractPageExtension.java
@@ -1,61 +1,61 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.internal;
-
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.IPageExtensionFilter;
-
-/**
- * Base class for page extensions providing support for filtering the context a page extension may be applied to.
- *
- * @since 3.9.0
- */
-public abstract class AbstractPageExtension {
-
- private final IPageExtensionFilter m_pageFilter;
-
- public AbstractPageExtension() {
- this(null);
- }
-
- public AbstractPageExtension(IPageExtensionFilter pageFilter) {
- m_pageFilter = pageFilter;
- }
-
- public IPageExtensionFilter getPageFilter() {
- return m_pageFilter;
- }
-
- /**
- * Decides whether the given context is accepted by the filter outline and page class that are probably set on this
- * page extension. The given outline and page are checked with the outline filter and page filter classes,
- * respectively.
- * <p/>
- * If the page filter class is set ({@link #setParentPageFilterClass(Class)}) then the outline filter (
- * {@link #setOutlineFilterClass(Class)}) is ignored. Additionally, the outline filter is accepted only if the given
- * parent page class is null.
- *
- * @param outline
- * the current context's outline.
- * @param parentPage
- * the current context's parent page.
- * @return Returns <code>true</code> if the current context described by outline and parent page are accepted by this
- * page extension.
- */
- public boolean accept(IOutline outline, IPage parentPage, IPage affectedPage) {
- IPageExtensionFilter filter = getPageFilter();
- if (filter != null) {
- return filter.accept(outline, parentPage, affectedPage);
- }
- return true;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.internal;
+
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.IPageExtensionFilter;
+
+/**
+ * Base class for page extensions providing support for filtering the context a page extension may be applied to.
+ *
+ * @since 3.9.0
+ */
+public abstract class AbstractPageExtension {
+
+ private final IPageExtensionFilter m_pageFilter;
+
+ public AbstractPageExtension() {
+ this(null);
+ }
+
+ public AbstractPageExtension(IPageExtensionFilter pageFilter) {
+ m_pageFilter = pageFilter;
+ }
+
+ public IPageExtensionFilter getPageFilter() {
+ return m_pageFilter;
+ }
+
+ /**
+ * Decides whether the given context is accepted by the filter outline and page class that are probably set on this
+ * page extension. The given outline and page are checked with the outline filter and page filter classes,
+ * respectively.
+ * <p/>
+ * If the page filter class is set ({@link #setParentPageFilterClass(Class)}) then the outline filter (
+ * {@link #setOutlineFilterClass(Class)}) is ignored. Additionally, the outline filter is accepted only if the given
+ * parent page class is null.
+ *
+ * @param outline
+ * the current context's outline.
+ * @param parentPage
+ * the current context's parent page.
+ * @return Returns <code>true</code> if the current context described by outline and parent page are accepted by this
+ * page extension.
+ */
+ public boolean accept(IOutline outline, IPage parentPage, IPage affectedPage) {
+ IPageExtensionFilter filter = getPageFilter();
+ if (filter != null) {
+ return filter.accept(outline, parentPage, affectedPage);
+ }
+ return true;
+ }
+}
diff --git a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/internal/PageAnchorFilter.java b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/internal/PageAnchorFilter.java
index ce15603113..91ad3dbbf8 100644
--- a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/internal/PageAnchorFilter.java
+++ b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/internal/PageAnchorFilter.java
@@ -1,48 +1,48 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.internal;
-
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.IPageExtensionFilter;
-
-/**
- * @since 3.9.0
- */
-public class PageAnchorFilter implements IPageExtensionFilter {
-
- private final Class<? extends IOutline> m_outlineFilterClass;
- private final Class<? extends IPage> m_parentPageFilterClass;
-
- public PageAnchorFilter(Class<? extends IOutline> outlineFilterClass, Class<? extends IPage> parentPageFilterClass) {
- m_outlineFilterClass = outlineFilterClass;
- m_parentPageFilterClass = parentPageFilterClass;
- }
-
- public Class<? extends IOutline> getOutlineFilterClass() {
- return m_outlineFilterClass;
- }
-
- public Class<? extends IPage> getParentPageFilterClass() {
- return m_parentPageFilterClass;
- }
-
- @Override
- public boolean accept(IOutline outline, IPage parentPage, IPage affectedPage) {
- if (getParentPageFilterClass() != null) {
- return parentPage != null && getParentPageFilterClass().isInstance(parentPage);
- }
- if (getOutlineFilterClass() != null) {
- return outline != null && parentPage == null && getOutlineFilterClass().isInstance(outline);
- }
- return true;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.internal;
+
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.IPageExtensionFilter;
+
+/**
+ * @since 3.9.0
+ */
+public class PageAnchorFilter implements IPageExtensionFilter {
+
+ private final Class<? extends IOutline> m_outlineFilterClass;
+ private final Class<? extends IPage> m_parentPageFilterClass;
+
+ public PageAnchorFilter(Class<? extends IOutline> outlineFilterClass, Class<? extends IPage> parentPageFilterClass) {
+ m_outlineFilterClass = outlineFilterClass;
+ m_parentPageFilterClass = parentPageFilterClass;
+ }
+
+ public Class<? extends IOutline> getOutlineFilterClass() {
+ return m_outlineFilterClass;
+ }
+
+ public Class<? extends IPage> getParentPageFilterClass() {
+ return m_parentPageFilterClass;
+ }
+
+ @Override
+ public boolean accept(IOutline outline, IPage parentPage, IPage affectedPage) {
+ if (getParentPageFilterClass() != null) {
+ return parentPage != null && getParentPageFilterClass().isInstance(parentPage);
+ }
+ if (getOutlineFilterClass() != null) {
+ return outline != null && parentPage == null && getOutlineFilterClass().isInstance(outline);
+ }
+ return true;
+ }
+}
diff --git a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/internal/PageContributionExtension.java b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/internal/PageContributionExtension.java
index a1a1e20999..9898a9a17a 100644
--- a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/internal/PageContributionExtension.java
+++ b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/internal/PageContributionExtension.java
@@ -1,113 +1,113 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.internal;
-
-import org.eclipse.scout.commons.BeanUtility;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithNodes;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.IPageExtensionFilter;
-
-/**
- * This class references a page and describes the places in the existing outline structure, where the referenced page is
- * added.
- *
- * @since 3.9.0
- */
-public class PageContributionExtension extends AbstractPageExtension {
-
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(PageContributionExtension.class);
-
- private final Class<? extends IPage> m_pageClass;
- private final double m_order;
-
- public PageContributionExtension(Class<? extends IPage> pageClass, double order) {
- this(null, pageClass, order);
- }
-
- public PageContributionExtension(IPageExtensionFilter pageFilter, Class<? extends IPage> pageClass, double order) {
- super(pageFilter);
- m_pageClass = pageClass;
- m_order = order;
- }
-
- public Class<? extends IPage> getPageClass() {
- return m_pageClass;
- }
-
- public double getOrder() {
- return m_order;
- }
-
- /**
- * Creates and returns a new page instance described by this page contribution. The contributed page must either
- * implement a constructor with the parent page or outline
- *
- * @param outline
- * @param parentPage
- * @return
- * @throws ProcessingException
- */
- public IPage createContribution(IOutline outline, IPageWithNodes parentPage) throws ProcessingException {
- if (outline == null) {
- throw new IllegalArgumentException("outline must not be null");
- }
- IPage page;
- if (parentPage != null) {
- // 1. try with single parameter parent page
- page = BeanUtility.createInstance(getPageClass(), parentPage);
- if (page != null) {
- return page;
- }
- // 2.a try with outline and parent page
- page = BeanUtility.createInstance(getPageClass(), outline, parentPage);
- if (page != null) {
- return page;
- }
- // 2.b try with outline and parent page (reverse order)
- page = BeanUtility.createInstance(getPageClass(), parentPage, outline);
- if (page != null) {
- return page;
- }
- }
- // 3. try with single parameter outline
- page = BeanUtility.createInstance(getPageClass(), outline);
- if (page != null) {
- return page;
- }
- // 4.a try with outline and parent page
- page = BeanUtility.createInstance(getPageClass(), outline, parentPage);
- if (page != null) {
- return page;
- }
- // 4.b try with outline and parent page (reverse order)
- page = BeanUtility.createInstance(getPageClass(), parentPage, outline);
- if (page != null) {
- return page;
- }
- // 5. try default constructor
- page = BeanUtility.createInstance(getPageClass());
- if (page != null) {
- return page;
- }
- if (parentPage == null) {
- // 6. try with single parameter constructor and null parameter
- page = BeanUtility.createInstance(getPageClass(), new Object[]{null});
- if (page != null) {
- return page;
- }
- }
- throw new ProcessingException("Cannot create new instance of class [" + getPageClass() + "] with arguments outline=[" + outline + "], parentPage=[" + parentPage + "]");
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.internal;
+
+import org.eclipse.scout.commons.BeanUtility;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithNodes;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.IPageExtensionFilter;
+
+/**
+ * This class references a page and describes the places in the existing outline structure, where the referenced page is
+ * added.
+ *
+ * @since 3.9.0
+ */
+public class PageContributionExtension extends AbstractPageExtension {
+
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(PageContributionExtension.class);
+
+ private final Class<? extends IPage> m_pageClass;
+ private final double m_order;
+
+ public PageContributionExtension(Class<? extends IPage> pageClass, double order) {
+ this(null, pageClass, order);
+ }
+
+ public PageContributionExtension(IPageExtensionFilter pageFilter, Class<? extends IPage> pageClass, double order) {
+ super(pageFilter);
+ m_pageClass = pageClass;
+ m_order = order;
+ }
+
+ public Class<? extends IPage> getPageClass() {
+ return m_pageClass;
+ }
+
+ public double getOrder() {
+ return m_order;
+ }
+
+ /**
+ * Creates and returns a new page instance described by this page contribution. The contributed page must either
+ * implement a constructor with the parent page or outline
+ *
+ * @param outline
+ * @param parentPage
+ * @return
+ * @throws ProcessingException
+ */
+ public IPage createContribution(IOutline outline, IPageWithNodes parentPage) throws ProcessingException {
+ if (outline == null) {
+ throw new IllegalArgumentException("outline must not be null");
+ }
+ IPage page;
+ if (parentPage != null) {
+ // 1. try with single parameter parent page
+ page = BeanUtility.createInstance(getPageClass(), parentPage);
+ if (page != null) {
+ return page;
+ }
+ // 2.a try with outline and parent page
+ page = BeanUtility.createInstance(getPageClass(), outline, parentPage);
+ if (page != null) {
+ return page;
+ }
+ // 2.b try with outline and parent page (reverse order)
+ page = BeanUtility.createInstance(getPageClass(), parentPage, outline);
+ if (page != null) {
+ return page;
+ }
+ }
+ // 3. try with single parameter outline
+ page = BeanUtility.createInstance(getPageClass(), outline);
+ if (page != null) {
+ return page;
+ }
+ // 4.a try with outline and parent page
+ page = BeanUtility.createInstance(getPageClass(), outline, parentPage);
+ if (page != null) {
+ return page;
+ }
+ // 4.b try with outline and parent page (reverse order)
+ page = BeanUtility.createInstance(getPageClass(), parentPage, outline);
+ if (page != null) {
+ return page;
+ }
+ // 5. try default constructor
+ page = BeanUtility.createInstance(getPageClass());
+ if (page != null) {
+ return page;
+ }
+ if (parentPage == null) {
+ // 6. try with single parameter constructor and null parameter
+ page = BeanUtility.createInstance(getPageClass(), new Object[]{null});
+ if (page != null) {
+ return page;
+ }
+ }
+ throw new ProcessingException("Cannot create new instance of class [" + getPageClass() + "] with arguments outline=[" + outline + "], parentPage=[" + parentPage + "]");
+ }
+}
diff --git a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/internal/PageModificationExtension.java b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/internal/PageModificationExtension.java
index 647f0b5570..046cd3c7e7 100644
--- a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/internal/PageModificationExtension.java
+++ b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/internal/PageModificationExtension.java
@@ -1,80 +1,80 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.internal;
-
-import org.eclipse.scout.commons.TypeCastUtility;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.IPageExtensionFilter;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.IPageModifier;
-
-/**
- * This class references a page modification and describes a set of pages, the given modification is applied to.
- *
- * @since 3.9.0
- */
-public class PageModificationExtension extends AbstractPageExtension {
-
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(PageModificationExtension.class);
-
- private final Class<? extends IPage> m_pageClass;
- private final Class<? extends IPageModifier<? extends IPage>> m_pageModifier;
-
- public PageModificationExtension(Class<? extends IPage> pageClass, Class<? extends IPageModifier<? extends IPage>> pageModifier) {
- this(null, pageClass, pageModifier);
- }
-
- public PageModificationExtension(IPageExtensionFilter pageFilter, Class<? extends IPage> pageClass, Class<? extends IPageModifier<? extends IPage>> pageModifier) {
- super(pageFilter);
- if (pageClass == null) {
- throw new IllegalArgumentException("pageClass must not be null");
- }
- if (pageModifier == null) {
- throw new IllegalArgumentException("pageModifier must not be null");
- }
- // check assignability of given page class along with the type parameter defined on the page modifier
- Class<?> pageModifierPageType = TypeCastUtility.getGenericsParameterClass(pageModifier, IPageModifier.class);
- if (pageModifierPageType == null) {
- LOG.warn("could not determine generic type parameter of page modifier '" + pageModifier.getName() + ";");
- }
- else if (!pageModifierPageType.isAssignableFrom(pageClass)) {
- throw new IllegalArgumentException("pageClass must be assignalbe to the generic type of given pageModifier. [pageClass: '"
- + pageClass.getName() + "', generic type on pageModifier: '" + pageModifierPageType.getName() + "'");
- }
- m_pageClass = pageClass;
- m_pageModifier = pageModifier;
- }
-
- public Class<? extends IPage> getPageClass() {
- return m_pageClass;
- }
-
- @Override
- public boolean accept(IOutline outline, IPage parentPage, IPage page) {
- if (!getPageClass().isInstance(page)) {
- return false;
- }
- return super.accept(outline, parentPage, page);
- }
-
- @SuppressWarnings("unchecked")
- public <T extends IPage> IPageModifier<T> createPageModifier() throws ProcessingException {
- try {
- return (IPageModifier<T>) m_pageModifier.newInstance();
- }
- catch (Exception e) {
- throw new ProcessingException("Error while instantiating page modifier", e);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.internal;
+
+import org.eclipse.scout.commons.TypeCastUtility;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.IPageExtensionFilter;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.IPageModifier;
+
+/**
+ * This class references a page modification and describes a set of pages, the given modification is applied to.
+ *
+ * @since 3.9.0
+ */
+public class PageModificationExtension extends AbstractPageExtension {
+
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(PageModificationExtension.class);
+
+ private final Class<? extends IPage> m_pageClass;
+ private final Class<? extends IPageModifier<? extends IPage>> m_pageModifier;
+
+ public PageModificationExtension(Class<? extends IPage> pageClass, Class<? extends IPageModifier<? extends IPage>> pageModifier) {
+ this(null, pageClass, pageModifier);
+ }
+
+ public PageModificationExtension(IPageExtensionFilter pageFilter, Class<? extends IPage> pageClass, Class<? extends IPageModifier<? extends IPage>> pageModifier) {
+ super(pageFilter);
+ if (pageClass == null) {
+ throw new IllegalArgumentException("pageClass must not be null");
+ }
+ if (pageModifier == null) {
+ throw new IllegalArgumentException("pageModifier must not be null");
+ }
+ // check assignability of given page class along with the type parameter defined on the page modifier
+ Class<?> pageModifierPageType = TypeCastUtility.getGenericsParameterClass(pageModifier, IPageModifier.class);
+ if (pageModifierPageType == null) {
+ LOG.warn("could not determine generic type parameter of page modifier '" + pageModifier.getName() + ";");
+ }
+ else if (!pageModifierPageType.isAssignableFrom(pageClass)) {
+ throw new IllegalArgumentException("pageClass must be assignalbe to the generic type of given pageModifier. [pageClass: '"
+ + pageClass.getName() + "', generic type on pageModifier: '" + pageModifierPageType.getName() + "'");
+ }
+ m_pageClass = pageClass;
+ m_pageModifier = pageModifier;
+ }
+
+ public Class<? extends IPage> getPageClass() {
+ return m_pageClass;
+ }
+
+ @Override
+ public boolean accept(IOutline outline, IPage parentPage, IPage page) {
+ if (!getPageClass().isInstance(page)) {
+ return false;
+ }
+ return super.accept(outline, parentPage, page);
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T extends IPage> IPageModifier<T> createPageModifier() throws ProcessingException {
+ try {
+ return (IPageModifier<T>) m_pageModifier.newInstance();
+ }
+ catch (Exception e) {
+ throw new ProcessingException("Error while instantiating page modifier", e);
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/internal/PageRemoveExtension.java b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/internal/PageRemoveExtension.java
index c0b6f18b8f..e6b0bad49a 100644
--- a/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/internal/PageRemoveExtension.java
+++ b/org.eclipse.scout.rt.extension.client/src/org/eclipse/scout/rt/extension/client/ui/desktop/outline/pages/internal/PageRemoveExtension.java
@@ -1,50 +1,50 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.internal;
-
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
-import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
-import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.IPageExtensionFilter;
-
-/**
- * This class references a particular type of pages and describes the places in the existing outline structure, where
- * they are removed.
- *
- * @since 3.9.0
- */
-public class PageRemoveExtension extends AbstractPageExtension {
-
- private final Class<? extends IPage> m_pageClass;
-
- public PageRemoveExtension(Class<? extends IPage> pageClass) {
- this(null, pageClass);
- }
-
- public PageRemoveExtension(IPageExtensionFilter pageFilter, Class<? extends IPage> pageClass) {
- super(pageFilter);
- m_pageClass = pageClass;
- }
-
- public Class<? extends IPage> getPageClass() {
- return m_pageClass;
- }
-
- @Override
- public boolean accept(IOutline outline, IPage parentPage, IPage page) {
- if (page == null) {
- return false;
- }
- if (!getPageClass().isInstance(page)) {
- return false;
- }
- return super.accept(outline, parentPage, page);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.internal;
+
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
+import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
+import org.eclipse.scout.rt.extension.client.ui.desktop.outline.pages.IPageExtensionFilter;
+
+/**
+ * This class references a particular type of pages and describes the places in the existing outline structure, where
+ * they are removed.
+ *
+ * @since 3.9.0
+ */
+public class PageRemoveExtension extends AbstractPageExtension {
+
+ private final Class<? extends IPage> m_pageClass;
+
+ public PageRemoveExtension(Class<? extends IPage> pageClass) {
+ this(null, pageClass);
+ }
+
+ public PageRemoveExtension(IPageExtensionFilter pageFilter, Class<? extends IPage> pageClass) {
+ super(pageFilter);
+ m_pageClass = pageClass;
+ }
+
+ public Class<? extends IPage> getPageClass() {
+ return m_pageClass;
+ }
+
+ @Override
+ public boolean accept(IOutline outline, IPage parentPage, IPage page) {
+ if (page == null) {
+ return false;
+ }
+ if (!getPageClass().isInstance(page)) {
+ return false;
+ }
+ return super.accept(outline, parentPage, page);
+ }
+}
diff --git a/org.eclipse.scout.rt.feature.about/about.ini b/org.eclipse.scout.rt.feature.about/about.ini
index 0969771ced..4314863065 100644
--- a/org.eclipse.scout.rt.feature.about/about.ini
+++ b/org.eclipse.scout.rt.feature.about/about.ini
@@ -1,28 +1,28 @@
-# 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=Eclipse Scout Project\n\
-\n\
-Copyright (c) 2011, 2012 Scout project committers and others. All rights reserved.\n\
-Visit: http://eclipse.org/scout
-
-# Property "featureImage" contains path to feature image (32x32)
-featureImage=scout.jpg
-
-# Property "aboutImage" contains path to product image (500x330 or 115x164)
-# needed for primary features only
-
-# Property "appName" contains name of the application (not translated)
-# needed for primary features only
-
-
-# Property "welcomePerspective" contains the id of the perspective in which the
-# welcome page is to be opened.
-# optional
-
-# Property "tipsAndTricksHref" contains the Help topic href to a tips and tricks page
-# optional
+# 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=Eclipse Scout Project\n\
+\n\
+Copyright (c) 2011, 2012 Scout project committers and others. All rights reserved.\n\
+Visit: http://eclipse.org/scout
+
+# Property "featureImage" contains path to feature image (32x32)
+featureImage=scout.jpg
+
+# Property "aboutImage" contains path to product image (500x330 or 115x164)
+# needed for primary features only
+
+# Property "appName" contains name of the application (not translated)
+# needed for primary features only
+
+
+# Property "welcomePerspective" contains the id of the perspective in which the
+# welcome page is to be opened.
+# optional
+
+# Property "tipsAndTricksHref" contains the Help topic href to a tips and tricks page
+# optional
diff --git a/org.eclipse.scout.rt.jdbc.derby/.settings/org.eclipse.pde.core.prefs b/org.eclipse.scout.rt.jdbc.derby/.settings/org.eclipse.pde.core.prefs
index baef13dd8c..a3a50fc8da 100644
--- a/org.eclipse.scout.rt.jdbc.derby/.settings/org.eclipse.pde.core.prefs
+++ b/org.eclipse.scout.rt.jdbc.derby/.settings/org.eclipse.pde.core.prefs
@@ -1,3 +1,3 @@
-#Mon Jul 11 16:16:00 CEST 2011
-eclipse.preferences.version=1
-pluginProject.extensions=true
+#Mon Jul 11 16:16:00 CEST 2011
+eclipse.preferences.version=1
+pluginProject.extensions=true
diff --git a/org.eclipse.scout.rt.jdbc.derby/src/org/eclipse/scout/rt/services/common/jdbc/AbstractDerbySqlService.java b/org.eclipse.scout.rt.jdbc.derby/src/org/eclipse/scout/rt/services/common/jdbc/AbstractDerbySqlService.java
index e575fb00a6..a0de5bb436 100644
--- a/org.eclipse.scout.rt.jdbc.derby/src/org/eclipse/scout/rt/services/common/jdbc/AbstractDerbySqlService.java
+++ b/org.eclipse.scout.rt.jdbc.derby/src/org/eclipse/scout/rt/services/common/jdbc/AbstractDerbySqlService.java
@@ -1,67 +1,67 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.services.common.jdbc;
-
-import org.eclipse.scout.commons.NumberUtility;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.server.services.common.jdbc.AbstractSqlService;
-import org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle;
-import org.eclipse.scout.rt.services.common.jdbc.style.DerbySqlStyle;
-
-/**
- * Cause Derby supports no sequences, we model this behavior with a table
- * with only one column AND entry of type BIGINT (or other numeric type).
- * This table needs to have at the beginning this one entry. The default
- * column name is "LAST_VAL". With the method
- * {@link AbstractDerbySqlService#getConfiguredSequenceColumnName()} one can
- * customize the name of this column.
- *
- * NOTE: With "CREATE SYNONYM DUAL FOR SYSIBM.SYSDUMMY1" one can better reuse
- * Oracle styled SQL
- */
-public abstract class AbstractDerbySqlService extends AbstractSqlService{
-
- public String getConfiguredSequenceColumnName() throws ProcessingException {
- return "LAST_VAL";
- }
-
- @Override
- protected String getConfiguredJdbcDriverName(){
- return "org.apache.derby.jdbc.EmbeddedDriver";
- }
-
- @Override
- public Long getSequenceNextval(String sequenceName) throws ProcessingException{
- //increase
- String update = "UPDATE " + sequenceName + " SET " + getConfiguredSequenceColumnName() + " = " + getConfiguredSequenceColumnName() + " + 1";
- createStatementProcessor(update,null,0).processModification(getTransaction(),getStatementCache(),null);
-
- //read
- String s = "SELECT " + getConfiguredSequenceColumnName() + " FROM " + sequenceName;
- Object[][] ret = createStatementProcessor(s,null,0).processSelect(getTransaction(),getStatementCache(),null);
- if(ret.length == 1){
- return NumberUtility.toLong(NumberUtility.nvl((Number)ret[0][0], 0));
- }
- return 0L;
- }
-
-
- @Override
- protected String getConfiguredJdbcMappingName(){
- return "jdbc:derby:<path to db>";
- }
-
- @Override
- protected Class<? extends ISqlStyle> getConfiguredSqlStyle(){
- return DerbySqlStyle.class;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.services.common.jdbc;
+
+import org.eclipse.scout.commons.NumberUtility;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.server.services.common.jdbc.AbstractSqlService;
+import org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle;
+import org.eclipse.scout.rt.services.common.jdbc.style.DerbySqlStyle;
+
+/**
+ * Cause Derby supports no sequences, we model this behavior with a table
+ * with only one column AND entry of type BIGINT (or other numeric type).
+ * This table needs to have at the beginning this one entry. The default
+ * column name is "LAST_VAL". With the method
+ * {@link AbstractDerbySqlService#getConfiguredSequenceColumnName()} one can
+ * customize the name of this column.
+ *
+ * NOTE: With "CREATE SYNONYM DUAL FOR SYSIBM.SYSDUMMY1" one can better reuse
+ * Oracle styled SQL
+ */
+public abstract class AbstractDerbySqlService extends AbstractSqlService{
+
+ public String getConfiguredSequenceColumnName() throws ProcessingException {
+ return "LAST_VAL";
+ }
+
+ @Override
+ protected String getConfiguredJdbcDriverName(){
+ return "org.apache.derby.jdbc.EmbeddedDriver";
+ }
+
+ @Override
+ public Long getSequenceNextval(String sequenceName) throws ProcessingException{
+ //increase
+ String update = "UPDATE " + sequenceName + " SET " + getConfiguredSequenceColumnName() + " = " + getConfiguredSequenceColumnName() + " + 1";
+ createStatementProcessor(update,null,0).processModification(getTransaction(),getStatementCache(),null);
+
+ //read
+ String s = "SELECT " + getConfiguredSequenceColumnName() + " FROM " + sequenceName;
+ Object[][] ret = createStatementProcessor(s,null,0).processSelect(getTransaction(),getStatementCache(),null);
+ if(ret.length == 1){
+ return NumberUtility.toLong(NumberUtility.nvl((Number)ret[0][0], 0));
+ }
+ return 0L;
+ }
+
+
+ @Override
+ protected String getConfiguredJdbcMappingName(){
+ return "jdbc:derby:<path to db>";
+ }
+
+ @Override
+ protected Class<? extends ISqlStyle> getConfiguredSqlStyle(){
+ return DerbySqlStyle.class;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.jdbc.derby/src/org/eclipse/scout/rt/services/common/jdbc/style/DerbySqlStyle.java b/org.eclipse.scout.rt.jdbc.derby/src/org/eclipse/scout/rt/services/common/jdbc/style/DerbySqlStyle.java
index 184c991c81..241c883465 100644
--- a/org.eclipse.scout.rt.jdbc.derby/src/org/eclipse/scout/rt/services/common/jdbc/style/DerbySqlStyle.java
+++ b/org.eclipse.scout.rt.jdbc.derby/src/org/eclipse/scout/rt/services/common/jdbc/style/DerbySqlStyle.java
@@ -1,257 +1,257 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.services.common.jdbc.style;
-
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.sql.Statement;
-
-import org.eclipse.scout.rt.server.services.common.jdbc.style.AbstractSqlStyle;
-
-/**
- * Note: This class is mostly untested.
- */
-public class DerbySqlStyle extends AbstractSqlStyle {
- private static final long serialVersionUID = 1L;
-
- @Override
- protected int getMaxListSize() {
- return 1000;
- }
-
- @Override
- public boolean isLargeString(String s) {
- return (s.length() > 4000);
- }
-
- @Override
- public boolean isBlobEnabled() {
- return true;
- }
-
- @Override
- public boolean isClobEnabled() {
- return true;
- }
-
- @Override
- public void testConnection(Connection conn) throws SQLException {
- Statement testStatement = null;
- try {
- testStatement = conn.createStatement();
- testStatement.execute("SELECT 1 FROM SYSIBM.SYSDUMMY1"); //same as VALUES(1)
- }
- finally {
- if (testStatement != null) {
- try {
- testStatement.close();
- }
- catch (Throwable t) {
- //NOP
- }
- }
- }
- }
-
- //note: fn timestampadd:
- //You should not put a datetime column inside of a timestamp arithmetic function in WHERE clauses because the optimizer will not use any index on the column.
- @Override
- public String createDateIsToday(String attribute) {
- return "CAST(" + attribute + " AS DATE) >= CURRENT_DATE AND CAST(" + attribute + " AS DATE) < CAST({FN TIMESTAMPADD(SQL_TSI_DAY, 1, CURRENT_TIMESTAMP)} AS DATE)";
- }
-
- @Override
- public String createDateIsInLastDays(String attribute, String bindName) {
- return "CAST(" + attribute + " AS DATE) >= CAST({FN TIMESTAMPADD(SQL_TSI_DAY, :" + bindName + ", CURRENT_TIMESTAMP)} AS DATE) AND CAST(" + attribute + " AS DATE) < CAST({FN TIMESTAMPADD(SQL_TSI_DAY, 1, CURRENT_TIMESTAMP)} AS DATE)";
- }
-
- @Override
- public String createDateIsInNextDays(String attribute, String bindName) {
- return "CAST(" + attribute + " AS DATE) >= CURRENT_DATE AND CAST(" + attribute + " AS DATE) < CAST({FN TIMESTAMPADD(SQL_TSI_DAY, :" + bindName + " + 1, CURRENT_TIMESTAMP)} AS DATE)";
- }
-
- @Override
- public String createDateIsInDays(String attribute, String bindName) {
- return "CAST(" + attribute + " AS DATE) >= CAST({FN TIMESTAMPADD(SQL_TSI_DAY, :" + bindName + ", CURRENT_TIMESTAMP)} AS DATE) AND CAST(" + attribute + " AS DATE) < CAST({FN TIMESTAMPADD(SQL_TSI_DAY, :" + bindName + " + 1, CURRENT_TIMESTAMP)} AS DATE)";
- }
-
- @Override
- public String createDateIsInWeeks(String attribute, String bindName) {
- return "CAST(" + attribute + " AS DATE) >= CAST({FN TIMESTAMPADD(SQL_TSI_WEEK, :" + bindName + ", CURRENT_TIMESTAMP)} AS DATE) AND CAST(" + attribute + " AS DATE) < CAST({FN TIMESTAMPADD(SQL_TSI_DAY, 1, {FN TIMESTAMPADD(SQL_TSI_WEEK, :" + bindName + ", CURRENT_TIMESTAMP)})} AS DATE)";
- }
-
- @Override
- public String createDateIsInLastMonths(String attribute, String bindName) {
- return "CAST(" + attribute + " AS DATE) >= CAST({FN TIMESTAMPADD(SQL_TSI_MONTH,(-1)*:" + bindName + ", CURRENT_TIMESTAMP)} AS DATE) AND CAST(" + attribute + " AS DATE) < CAST({FN TIMESTAMPADD(SQL_TSI_DAY, 1, CURRENT_TIMESTAMP)} AS DATE)";
- }
-
- @Override
- public String createDateIsInNextMonths(String attribute, String bindName) {
- return "CAST(" + attribute + " AS DATE) >= CURRENT_DATE AND CAST(" + attribute + " AS DATE) < CAST({FN TIMESTAMPADD(SQL_TSI_DAY, 1, {FN TIMESTAMPADD(SQL_TSI_MONTH, :" + bindName + ", CURRENT_TIMESTAMP)})} AS DATE)";
- }
-
- @Override
- public String createDateIsInMonths(String attribute, String bindName) {
- return "CAST(" + attribute + " AS DATE) >= CAST({FN TIMESTAMPADD(SQL_TSI_MONTH,:" + bindName + ", CURRENT_TIMESTAMP)} AS DATE) AND CAST(" + attribute + " AS DATE) < CAST({FN TIMESTAMPADD(SQL_TSI_DAY, 1, {FN TIMESTAMPADD(SQL_TSI_MONTH, :" + bindName + ", CURRENT_TIMESTAMP)})} AS DATE)";
- }
-
- @Override
- public String createDateIsInLEDays(String attribute, String bindName) {
- return "CAST(" + attribute + " AS DATE) < CAST({FN TIMESTAMPADD(SQL_TSI_DAY,:" + bindName + " + 1, CURRENT_TIMESTAMP)} AS DATE)";
- }
-
- @Override
- public String createDateIsInLEWeeks(String attribute, String bindName) {
- return "CAST(" + attribute + " AS DATE) < CAST({FN TIMESTAMPADD(SQL_TSI_DAY, 1, {FN TIMESTAMPADD(SQL_TSI_WEEK, :" + bindName + ", CURRENT_TIMESTAMP)})} AS DATE)";
- }
-
- @Override
- public String createDateIsInLEMonths(String attribute, String bindName) {
- return "CAST(" + attribute + " AS DATE) < CAST({FN TIMESTAMPADD(SQL_TSI_DAY, 1, {FN TIMESTAMPADD(SQL_TSI_MONTH, :" + bindName + ", CURRENT_TIMESTAMP)})} AS DATE)";
- }
-
- @Override
- public String createDateIsInGEDays(String attribute, String bindName) {
- return "CAST(" + attribute + " AS DATE) >= CAST({FN TIMESTAMPADD(SQL_TSI_DAY,:" + bindName + ", CURRENT_TIMESTAMP)} AS DATE)";
- }
-
- @Override
- public String createDateIsInGEWeeks(String attribute, String bindName) {
- return "CAST(" + attribute + " AS DATE) >= CAST({FN TIMESTAMPADD(SQL_TSI_WEEK, :" + bindName + ", CURRENT_TIMESTAMP)} AS DATE)";
- }
-
- @Override
- public String createDateIsInGEMonths(String attribute, String bindName) {
- return "CAST(" + attribute + " AS DATE) >= CAST({FN TIMESTAMPADD(SQL_TSI_MONTH, :" + bindName + ", CURRENT_TIMESTAMP)} AS DATE)";
- }
-
- @Override
- public String createDateIsNotToday(String attribute) {
- return "(CAST(" + attribute + " AS DATE) < CURRENT_DATE OR " + attribute + ">= CAST({FN TIMESTAMPADD(SQL_TSI_DAY, 1, CURRENT_TIMESTAMP)} AS DATE))";
- }
-
- //attribute has to be of type timestamp. a cast from date/time to timestamp is not supported by derby, but planned to be implemented(?). (These casts are valid according to SQL standard (1999))
- @Override
- public String createDateTimeIsNow(String attribute) {
- return attribute + " >= {FN TIMESTAMPADD(SQL_TSI_MINUTE, -1, CURRENT_TIMESTAMP)} AND " + attribute + " < {FN TIMESTAMPADD(SQL_TSI_MINUTE, 1, CURRENT_TIMESTAMP)}";
- }
-
- @Override
- public String createDateTimeIsInLEMinutes(String attribute, String bindName) {
- return attribute + " < {FN TIMESTAMPADD(SQL_TSI_MINUTE, :" + bindName + "+1, CURRENT_TIMESTAMP)}";
- }
-
- @Override
- public String createDateTimeIsInLEHours(String attribute, String bindName) {
- return attribute + " < {FN TIMESTAMPADD(SQL_TSI_HOUR, :" + bindName + "+1, CURRENT_TIMESTAMP)}";
- }
-
- @Override
- public String createDateTimeIsInGEMinutes(String attribute, String bindName) {
- return attribute + " >= {FN TIMESTAMPADD(SQL_TSI_MINUTE, :" + bindName + ", CURRENT_TIMESTAMP)}";
- }
-
- @Override
- public String createDateTimeIsInGEHours(String attribute, String bindName) {
- return attribute + " >= {FN TIMESTAMPADD(SQL_TSI_HOUR, :" + bindName + ", CURRENT_TIMESTAMP)}";
- }
-
- @Override
- public String createDateTimeIsNotNow(String attribute) {
- return "(" + attribute + " < CURRENT_TIMESTAMP OR " + attribute + " >= {FN TIMESTAMPADD(SQL_TSI_MINUTE, 1, CURRENT_TIMESTAMP)})";
- }
-
- //the time methods below are for derby only
- @Override
- public String createTimeIsNow(String attribute) {
- return attribute + ">=(HOUR(CURRENT_TIMESTAMP)*60 + MINUTE(CURRENT_TIMESTAMP))/24.0/60 AND " + attribute + "<(HOUR(CURRENT_TIMESTAMP)*60 + MINUTE(CURRENT_TIMESTAMP)+(1/24.0/60))/24.0/60";
- }
-
- @Override
- public String createTimeIsNotNow(String attribute) {
- return attribute + "<(HOUR(CURRENT_TIMESTAMP)*60 + MINUTE(CURRENT_TIMESTAMP))/24.0/60 OR " + attribute + ">((HOUR(CURRENT_TIMESTAMP)*60)+MINUTE(CURRENT_TIMESTAMP)+(1/24.0/60))/24.0/60";
- }
-
- @Override
- public String createTimeIsInMinutes(String attribute, String bindName) {
- return attribute + ">=(HOUR(CURRENT_TIMESTAMP)*60 + MINUTE(CURRENT_TIMESTAMP)+(:" + bindName + "/24.0/60))/24/60 AND " + attribute + "<((HOUR(CURRENT_TIMESTAMP)*60)+MINUTE(CURRENT_TIMESTAMP)+((:" + bindName + "+1)/24.0/60))/24.0/60";
- }
-
- @Override
- public String createTimeIsInHours(String attribute, String bindName) {
- return attribute + ">=(HOUR(CURRENT_TIMESTAMP)*60 + MINUTE(CURRENT_TIMESTAMP)+(:" + bindName + "/24.0))/24/60 AND " + attribute + "<((HOUR(CURRENT_TIMESTAMP)*60)+MINUTE(CURRENT_TIMESTAMP)+(:" + bindName + "/24.0)+(1/24.0/60))/24.0/60";
- }
-
- @Override
- public String createTimeIsInLEMinutes(String attribute, String bindName) {
- return attribute + "<(HOUR(CURRENT_TIMESTAMP)*60 + MINUTE(CURRENT_TIMESTAMP)+((:" + bindName + "+1)/24.0/60))/24/60";
- }
-
- @Override
- public String createTimeIsInLEHours(String attribute, String bindName) {
- return attribute + "<(HOUR(CURRENT_TIMESTAMP)*60 + MINUTE(CURRENT_TIMESTAMP)+(:" + bindName + "/24.0)+(1/24.0/60))/24/60";
- }
-
- @Override
- public String createTimeIsInGEMinutes(String attribute, String bindName) {
- return attribute + ">=(HOUR(CURRENT_TIMESTAMP)*60 + MINUTE(CURRENT_TIMESTAMP)+(:" + bindName + "/24.0/60))/24.0/60";
- }
-
- @Override
- public String createTimeIsInGEHours(String attribute, String bindName) {
- return attribute + ">=(HOUR(CURRENT_TIMESTAMP)*60 + MINUTE(CURRENT_TIMESTAMP)+(:" + bindName + "/24.0))/24.0/60";
- }
-
- /*
- * Time is currently modeled as a double value. The methods below can be used, if time is modeled as SQL Standard (1999) TIME datatype.
- * The code below is fine for SQL Standard (1999) and JDBC (not just for derby)
- *
- @Override
- public String createTimeIsNow(String attribute){
- return attribute + ">= CURRENT_TIME AND " + attribute + " < CAST({FN TIMESTAMPADD(SQL_TSI_MINUTE, 1, CURRENT_TIMESTAMP)} AS TIME)";
- }
-
- @Override
- public String createTimeIsNotNow(String attribute){
- return "(" + attribute + " < CURRENT_TIME OR " + attribute + " > CAST({FN TIMESTAMPADD(SQL_TSI_MINUTE, 1, CURRENT_TIMESTAMP)} AS TIME))";
- }
-
- @Override
- public String createTimeIsInMinutes(String attribute, String bindName){
- return attribute + ">= CAST({FN TIMESTAMPADD(SQL_TSI_MINUTE, :"+bindName+", CURRENT_TIMESTAMP)} AS TIME) AND " + attribute + " < CAST({FN TIMESTAMPADD(SQL_TSI_MINUTE, :"+bindName+"+1, CURRENT_TIMESTAMP)} AS TIME)";
- }
-
- @Override
- public String createTimeIsInHours(String attribute, String bindName){
- return attribute + ">= CAST({FN TIMESTAMPADD(SQL_TSI_HOUR, :"+bindName+", CURRENT_TIMESTAMP)} AS TIME) AND " + attribute + " < CAST({FN TIMESTAMPADD(SQL_TSI_HOUR, :"+bindName+"+1, CURRENT_TIMESTAMP)} AS TIME)";
- }
-
- @Override
- public String createTimeIsInLEMinutes(String attribute, String bindName){
- return attribute + "< CAST({FN TIMESTAMPADD(SQL_TSI_MINUTE, :"+bindName+"+1, CURRENT_TIMESTAMP)} AS TIME)";
- }
-
- @Override
- public String createTimeIsInLEHours(String attribute, String bindName){
- return attribute + "< CAST({FN TIMESTAMPADD(SQL_TSI_HOUR, :"+bindName+"+1, CURRENT_TIMESTAMP)} AS TIME)";
- }
-
- @Override
- public String createTimeIsInGEMinutes(String attribute, String bindName){
- return attribute + ">= CAST({FN TIMESTAMPADD(SQL_TSI_MINUTE, :"+bindName+", CURRENT_TIMESTAMP)} AS TIME)";
- }
-
- @Override
- public String createTimeIsInGEHours(String attribute, String bindName){
- return attribute + ">= CAST({FN TIMESTAMPADD(SQL_TSI_HOUR, :"+bindName+", CURRENT_TIMESTAMP)} AS TIME)";
- }
- */
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.services.common.jdbc.style;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+import org.eclipse.scout.rt.server.services.common.jdbc.style.AbstractSqlStyle;
+
+/**
+ * Note: This class is mostly untested.
+ */
+public class DerbySqlStyle extends AbstractSqlStyle {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ protected int getMaxListSize() {
+ return 1000;
+ }
+
+ @Override
+ public boolean isLargeString(String s) {
+ return (s.length() > 4000);
+ }
+
+ @Override
+ public boolean isBlobEnabled() {
+ return true;
+ }
+
+ @Override
+ public boolean isClobEnabled() {
+ return true;
+ }
+
+ @Override
+ public void testConnection(Connection conn) throws SQLException {
+ Statement testStatement = null;
+ try {
+ testStatement = conn.createStatement();
+ testStatement.execute("SELECT 1 FROM SYSIBM.SYSDUMMY1"); //same as VALUES(1)
+ }
+ finally {
+ if (testStatement != null) {
+ try {
+ testStatement.close();
+ }
+ catch (Throwable t) {
+ //NOP
+ }
+ }
+ }
+ }
+
+ //note: fn timestampadd:
+ //You should not put a datetime column inside of a timestamp arithmetic function in WHERE clauses because the optimizer will not use any index on the column.
+ @Override
+ public String createDateIsToday(String attribute) {
+ return "CAST(" + attribute + " AS DATE) >= CURRENT_DATE AND CAST(" + attribute + " AS DATE) < CAST({FN TIMESTAMPADD(SQL_TSI_DAY, 1, CURRENT_TIMESTAMP)} AS DATE)";
+ }
+
+ @Override
+ public String createDateIsInLastDays(String attribute, String bindName) {
+ return "CAST(" + attribute + " AS DATE) >= CAST({FN TIMESTAMPADD(SQL_TSI_DAY, :" + bindName + ", CURRENT_TIMESTAMP)} AS DATE) AND CAST(" + attribute + " AS DATE) < CAST({FN TIMESTAMPADD(SQL_TSI_DAY, 1, CURRENT_TIMESTAMP)} AS DATE)";
+ }
+
+ @Override
+ public String createDateIsInNextDays(String attribute, String bindName) {
+ return "CAST(" + attribute + " AS DATE) >= CURRENT_DATE AND CAST(" + attribute + " AS DATE) < CAST({FN TIMESTAMPADD(SQL_TSI_DAY, :" + bindName + " + 1, CURRENT_TIMESTAMP)} AS DATE)";
+ }
+
+ @Override
+ public String createDateIsInDays(String attribute, String bindName) {
+ return "CAST(" + attribute + " AS DATE) >= CAST({FN TIMESTAMPADD(SQL_TSI_DAY, :" + bindName + ", CURRENT_TIMESTAMP)} AS DATE) AND CAST(" + attribute + " AS DATE) < CAST({FN TIMESTAMPADD(SQL_TSI_DAY, :" + bindName + " + 1, CURRENT_TIMESTAMP)} AS DATE)";
+ }
+
+ @Override
+ public String createDateIsInWeeks(String attribute, String bindName) {
+ return "CAST(" + attribute + " AS DATE) >= CAST({FN TIMESTAMPADD(SQL_TSI_WEEK, :" + bindName + ", CURRENT_TIMESTAMP)} AS DATE) AND CAST(" + attribute + " AS DATE) < CAST({FN TIMESTAMPADD(SQL_TSI_DAY, 1, {FN TIMESTAMPADD(SQL_TSI_WEEK, :" + bindName + ", CURRENT_TIMESTAMP)})} AS DATE)";
+ }
+
+ @Override
+ public String createDateIsInLastMonths(String attribute, String bindName) {
+ return "CAST(" + attribute + " AS DATE) >= CAST({FN TIMESTAMPADD(SQL_TSI_MONTH,(-1)*:" + bindName + ", CURRENT_TIMESTAMP)} AS DATE) AND CAST(" + attribute + " AS DATE) < CAST({FN TIMESTAMPADD(SQL_TSI_DAY, 1, CURRENT_TIMESTAMP)} AS DATE)";
+ }
+
+ @Override
+ public String createDateIsInNextMonths(String attribute, String bindName) {
+ return "CAST(" + attribute + " AS DATE) >= CURRENT_DATE AND CAST(" + attribute + " AS DATE) < CAST({FN TIMESTAMPADD(SQL_TSI_DAY, 1, {FN TIMESTAMPADD(SQL_TSI_MONTH, :" + bindName + ", CURRENT_TIMESTAMP)})} AS DATE)";
+ }
+
+ @Override
+ public String createDateIsInMonths(String attribute, String bindName) {
+ return "CAST(" + attribute + " AS DATE) >= CAST({FN TIMESTAMPADD(SQL_TSI_MONTH,:" + bindName + ", CURRENT_TIMESTAMP)} AS DATE) AND CAST(" + attribute + " AS DATE) < CAST({FN TIMESTAMPADD(SQL_TSI_DAY, 1, {FN TIMESTAMPADD(SQL_TSI_MONTH, :" + bindName + ", CURRENT_TIMESTAMP)})} AS DATE)";
+ }
+
+ @Override
+ public String createDateIsInLEDays(String attribute, String bindName) {
+ return "CAST(" + attribute + " AS DATE) < CAST({FN TIMESTAMPADD(SQL_TSI_DAY,:" + bindName + " + 1, CURRENT_TIMESTAMP)} AS DATE)";
+ }
+
+ @Override
+ public String createDateIsInLEWeeks(String attribute, String bindName) {
+ return "CAST(" + attribute + " AS DATE) < CAST({FN TIMESTAMPADD(SQL_TSI_DAY, 1, {FN TIMESTAMPADD(SQL_TSI_WEEK, :" + bindName + ", CURRENT_TIMESTAMP)})} AS DATE)";
+ }
+
+ @Override
+ public String createDateIsInLEMonths(String attribute, String bindName) {
+ return "CAST(" + attribute + " AS DATE) < CAST({FN TIMESTAMPADD(SQL_TSI_DAY, 1, {FN TIMESTAMPADD(SQL_TSI_MONTH, :" + bindName + ", CURRENT_TIMESTAMP)})} AS DATE)";
+ }
+
+ @Override
+ public String createDateIsInGEDays(String attribute, String bindName) {
+ return "CAST(" + attribute + " AS DATE) >= CAST({FN TIMESTAMPADD(SQL_TSI_DAY,:" + bindName + ", CURRENT_TIMESTAMP)} AS DATE)";
+ }
+
+ @Override
+ public String createDateIsInGEWeeks(String attribute, String bindName) {
+ return "CAST(" + attribute + " AS DATE) >= CAST({FN TIMESTAMPADD(SQL_TSI_WEEK, :" + bindName + ", CURRENT_TIMESTAMP)} AS DATE)";
+ }
+
+ @Override
+ public String createDateIsInGEMonths(String attribute, String bindName) {
+ return "CAST(" + attribute + " AS DATE) >= CAST({FN TIMESTAMPADD(SQL_TSI_MONTH, :" + bindName + ", CURRENT_TIMESTAMP)} AS DATE)";
+ }
+
+ @Override
+ public String createDateIsNotToday(String attribute) {
+ return "(CAST(" + attribute + " AS DATE) < CURRENT_DATE OR " + attribute + ">= CAST({FN TIMESTAMPADD(SQL_TSI_DAY, 1, CURRENT_TIMESTAMP)} AS DATE))";
+ }
+
+ //attribute has to be of type timestamp. a cast from date/time to timestamp is not supported by derby, but planned to be implemented(?). (These casts are valid according to SQL standard (1999))
+ @Override
+ public String createDateTimeIsNow(String attribute) {
+ return attribute + " >= {FN TIMESTAMPADD(SQL_TSI_MINUTE, -1, CURRENT_TIMESTAMP)} AND " + attribute + " < {FN TIMESTAMPADD(SQL_TSI_MINUTE, 1, CURRENT_TIMESTAMP)}";
+ }
+
+ @Override
+ public String createDateTimeIsInLEMinutes(String attribute, String bindName) {
+ return attribute + " < {FN TIMESTAMPADD(SQL_TSI_MINUTE, :" + bindName + "+1, CURRENT_TIMESTAMP)}";
+ }
+
+ @Override
+ public String createDateTimeIsInLEHours(String attribute, String bindName) {
+ return attribute + " < {FN TIMESTAMPADD(SQL_TSI_HOUR, :" + bindName + "+1, CURRENT_TIMESTAMP)}";
+ }
+
+ @Override
+ public String createDateTimeIsInGEMinutes(String attribute, String bindName) {
+ return attribute + " >= {FN TIMESTAMPADD(SQL_TSI_MINUTE, :" + bindName + ", CURRENT_TIMESTAMP)}";
+ }
+
+ @Override
+ public String createDateTimeIsInGEHours(String attribute, String bindName) {
+ return attribute + " >= {FN TIMESTAMPADD(SQL_TSI_HOUR, :" + bindName + ", CURRENT_TIMESTAMP)}";
+ }
+
+ @Override
+ public String createDateTimeIsNotNow(String attribute) {
+ return "(" + attribute + " < CURRENT_TIMESTAMP OR " + attribute + " >= {FN TIMESTAMPADD(SQL_TSI_MINUTE, 1, CURRENT_TIMESTAMP)})";
+ }
+
+ //the time methods below are for derby only
+ @Override
+ public String createTimeIsNow(String attribute) {
+ return attribute + ">=(HOUR(CURRENT_TIMESTAMP)*60 + MINUTE(CURRENT_TIMESTAMP))/24.0/60 AND " + attribute + "<(HOUR(CURRENT_TIMESTAMP)*60 + MINUTE(CURRENT_TIMESTAMP)+(1/24.0/60))/24.0/60";
+ }
+
+ @Override
+ public String createTimeIsNotNow(String attribute) {
+ return attribute + "<(HOUR(CURRENT_TIMESTAMP)*60 + MINUTE(CURRENT_TIMESTAMP))/24.0/60 OR " + attribute + ">((HOUR(CURRENT_TIMESTAMP)*60)+MINUTE(CURRENT_TIMESTAMP)+(1/24.0/60))/24.0/60";
+ }
+
+ @Override
+ public String createTimeIsInMinutes(String attribute, String bindName) {
+ return attribute + ">=(HOUR(CURRENT_TIMESTAMP)*60 + MINUTE(CURRENT_TIMESTAMP)+(:" + bindName + "/24.0/60))/24/60 AND " + attribute + "<((HOUR(CURRENT_TIMESTAMP)*60)+MINUTE(CURRENT_TIMESTAMP)+((:" + bindName + "+1)/24.0/60))/24.0/60";
+ }
+
+ @Override
+ public String createTimeIsInHours(String attribute, String bindName) {
+ return attribute + ">=(HOUR(CURRENT_TIMESTAMP)*60 + MINUTE(CURRENT_TIMESTAMP)+(:" + bindName + "/24.0))/24/60 AND " + attribute + "<((HOUR(CURRENT_TIMESTAMP)*60)+MINUTE(CURRENT_TIMESTAMP)+(:" + bindName + "/24.0)+(1/24.0/60))/24.0/60";
+ }
+
+ @Override
+ public String createTimeIsInLEMinutes(String attribute, String bindName) {
+ return attribute + "<(HOUR(CURRENT_TIMESTAMP)*60 + MINUTE(CURRENT_TIMESTAMP)+((:" + bindName + "+1)/24.0/60))/24/60";
+ }
+
+ @Override
+ public String createTimeIsInLEHours(String attribute, String bindName) {
+ return attribute + "<(HOUR(CURRENT_TIMESTAMP)*60 + MINUTE(CURRENT_TIMESTAMP)+(:" + bindName + "/24.0)+(1/24.0/60))/24/60";
+ }
+
+ @Override
+ public String createTimeIsInGEMinutes(String attribute, String bindName) {
+ return attribute + ">=(HOUR(CURRENT_TIMESTAMP)*60 + MINUTE(CURRENT_TIMESTAMP)+(:" + bindName + "/24.0/60))/24.0/60";
+ }
+
+ @Override
+ public String createTimeIsInGEHours(String attribute, String bindName) {
+ return attribute + ">=(HOUR(CURRENT_TIMESTAMP)*60 + MINUTE(CURRENT_TIMESTAMP)+(:" + bindName + "/24.0))/24.0/60";
+ }
+
+ /*
+ * Time is currently modeled as a double value. The methods below can be used, if time is modeled as SQL Standard (1999) TIME datatype.
+ * The code below is fine for SQL Standard (1999) and JDBC (not just for derby)
+ *
+ @Override
+ public String createTimeIsNow(String attribute){
+ return attribute + ">= CURRENT_TIME AND " + attribute + " < CAST({FN TIMESTAMPADD(SQL_TSI_MINUTE, 1, CURRENT_TIMESTAMP)} AS TIME)";
+ }
+
+ @Override
+ public String createTimeIsNotNow(String attribute){
+ return "(" + attribute + " < CURRENT_TIME OR " + attribute + " > CAST({FN TIMESTAMPADD(SQL_TSI_MINUTE, 1, CURRENT_TIMESTAMP)} AS TIME))";
+ }
+
+ @Override
+ public String createTimeIsInMinutes(String attribute, String bindName){
+ return attribute + ">= CAST({FN TIMESTAMPADD(SQL_TSI_MINUTE, :"+bindName+", CURRENT_TIMESTAMP)} AS TIME) AND " + attribute + " < CAST({FN TIMESTAMPADD(SQL_TSI_MINUTE, :"+bindName+"+1, CURRENT_TIMESTAMP)} AS TIME)";
+ }
+
+ @Override
+ public String createTimeIsInHours(String attribute, String bindName){
+ return attribute + ">= CAST({FN TIMESTAMPADD(SQL_TSI_HOUR, :"+bindName+", CURRENT_TIMESTAMP)} AS TIME) AND " + attribute + " < CAST({FN TIMESTAMPADD(SQL_TSI_HOUR, :"+bindName+"+1, CURRENT_TIMESTAMP)} AS TIME)";
+ }
+
+ @Override
+ public String createTimeIsInLEMinutes(String attribute, String bindName){
+ return attribute + "< CAST({FN TIMESTAMPADD(SQL_TSI_MINUTE, :"+bindName+"+1, CURRENT_TIMESTAMP)} AS TIME)";
+ }
+
+ @Override
+ public String createTimeIsInLEHours(String attribute, String bindName){
+ return attribute + "< CAST({FN TIMESTAMPADD(SQL_TSI_HOUR, :"+bindName+"+1, CURRENT_TIMESTAMP)} AS TIME)";
+ }
+
+ @Override
+ public String createTimeIsInGEMinutes(String attribute, String bindName){
+ return attribute + ">= CAST({FN TIMESTAMPADD(SQL_TSI_MINUTE, :"+bindName+", CURRENT_TIMESTAMP)} AS TIME)";
+ }
+
+ @Override
+ public String createTimeIsInGEHours(String attribute, String bindName){
+ return attribute + ">= CAST({FN TIMESTAMPADD(SQL_TSI_HOUR, :"+bindName+", CURRENT_TIMESTAMP)} AS TIME)";
+ }
+ */
+}
diff --git a/org.eclipse.scout.rt.server/.settings/org.eclipse.pde.core.prefs b/org.eclipse.scout.rt.server/.settings/org.eclipse.pde.core.prefs
index baef13dd8c..a3a50fc8da 100644
--- a/org.eclipse.scout.rt.server/.settings/org.eclipse.pde.core.prefs
+++ b/org.eclipse.scout.rt.server/.settings/org.eclipse.pde.core.prefs
@@ -1,3 +1,3 @@
-#Mon Jul 11 16:16:00 CEST 2011
-eclipse.preferences.version=1
-pluginProject.extensions=true
+#Mon Jul 11 16:16:00 CEST 2011
+eclipse.preferences.version=1
+pluginProject.extensions=true
diff --git a/org.eclipse.scout.rt.server/Release Notes.txt b/org.eclipse.scout.rt.server/Release Notes.txt
index 6d9703cb3f..0a56859557 100644
--- a/org.eclipse.scout.rt.server/Release Notes.txt
+++ b/org.eclipse.scout.rt.server/Release Notes.txt
@@ -1,404 +1,404 @@
-19.07.2010 imo (contributed by Sandro Schifferle, ticket 91038)
-Improved security and added possibility to easily reset access control store
-Moved the permission loading away from server session to the (new) project-specific AccessControlService.
-Migration:
-CHANGED ServerSession.java
-OLD
- void execLoadSession()
- ...
- SQL.select(...);
- SERVICES.getService(IAccessControlService.class).setPermissions(...);
-
-NEW
- void execLoadSession()
- ...
- //no such code any more
-
-ADDED com.bsiag.crm.server.core.services.custom.security.AccessControlService
-package com.bsiag.crm.server.core.services.custom.security;
-import java.security.Permissions;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.server.services.common.jdbc.SQL;
-import org.eclipse.scout.rt.server.services.common.security.AbstractAccessControlService;
-import org.eclipse.scout.rt.shared.services.common.security.AccessControlUtility;
-import org.eclipse.scout.rt.shared.services.common.security.IAccessControlService;
-
-public class AccessControlService extends AbstractAccessControlService implements IAccessControlService {
-
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AccessControlService.class);
-
- @Override
- protected Permissions execLoadPermissions() {
- //moved select statement to here
- try {
- Object[][] permissionData = SQL.select(
- "SELECT P.PERMISSION_NAME, " +
- " MAX(P.PERMISSION_LEVEL) " +
- "FROM ORS_USER_ROLE R, ORS_ROLE_PERMISSION P " +
- "WHERE R.ROLE_UID=P.ROLE_UID " +
- "AND P.PERMISSION_LEVEL>0 " +
- "AND R.USER_NR IN( " +
- " SELECT S.USER_NR " +
- " FROM ORS_USER_SUBSTITUTE S " +
- " WHERE S.SUBSTITUTE_NR=:userNr " +
- " UNION ALL " +
- " SELECT TO_NUMBER(:userNr) FROM DUAL) " +
- "GROUP BY P.PERMISSION_NAME"
- );
-
- return AccessControlUtility.createPermissions(permissionData);
- }
- catch (Throwable t) {
- LOG.error("update due to client notification", t);
- return null;
- // nop
- }
- }
-}
-
-ADDED service registration to server plugin.xml
- <service class="com.bsiag.crm.server.core.services.custom.security.AccessControlService" session="com.bsiag.crm.server.core.ServerSession" factory="org.eclipse.scout.rt.server.services.ServerServiceFactory"/>
-
-16.08.2010 abr (contributed by Daniel Buehler, ticket 91072)
-ADDED two new properties to the org.eclipse.scout.rt.server.services.common.smtp.ISMTPService:
- useSmtps: controls whether the connection to the SMPT host is encrypted
- sslProtocols: comma-separated list of SSL protocols used for establishing the connection to the SMTP host
-
-23.08.2010 sle
-Ticket 86'471: SQL Logging
-ADDED AbstractSqlService prints on LogLevel INFO the PlainText-SqlStatement.
-Migration:
-CHANGED SqlService.java
-REMOVED FUNCTIONS:
- private void createPlainTextLog(String s, Object... bindBases) throws ProcessingException {}
- public Object[][] select(String s, Object... bindBases) throws ProcessingException {}
- public void selectInto(String s, Object... bindBases) throws ProcessingException {}
- public Object[][] selectLimited(String s, int maxRowCount, Object... bindBases) throws ProcessingException {}
- public int delete(String s, Object... bindBases) throws ProcessingException {}
- public int update(String s, Object... bindBases) throws ProcessingException {}
- public int insert(String s, Object... bindBases) throws ProcessingException {}
-
-07.09.2010 imo
-Ticket 89'314
-In ISqlService added support for database specific keyword replacement using ant notation ${name} for:
-${sysdate}
-${upper}
-${lower}
-${trim}
-${nvl}
-
-09.09.2010 imo
-Eliminated direct dependencies to Plug-In javax.servlet and replaced by import-dependencies to package javax.servlet
-Affected Plug-Ins:
-org.eclipse.scout.http.servletfilter
-org.eclipse.scout.rt.server
-Migration:
-com.bsiag.<crm>.server.core, com.bsiag.<crm>.server.online must add an import dependency in their MANIFEST.MF to package javax.servlet.
-In DEVELOPMENT products add the javax.servlet Plug-In.
-In PRODUCTION products eliminate the javax.servlet Plug-In.
-
-13.09.2010 abr
-Merged Tickets 92'255 and 93'777 from branch 20091231.
-Oracle Lite and DB2 require date comparisons making use of to_number(...)
-Migration: None
-
-16.09.2010 abr
-Ticket 94'031
-FormDataStatementBuilder does not take externally defined form data classes into account.
-Migration:
-CHANGED method signature in org.eclipse.scout.rt.server.services.common.jdbc.builder.ValuePartDefinition
-FROM accept(AbstractFormData) TO accept(AbstractFormData, Map<Integer, Map<String, AbstractFormFieldData>>, Map<Integer, Map<String, AbstractPropertyData<?>>>)
-
-03.11.2010 abr
-Ticket 95'772
-FormDataStatementBuilder cannot distinguish between entries of template classes if the template is used multiple times within the same form.
-Now, a ProcessingException is thrown if the statement builder is used with ambiguous ValuePartDefinitions.
-Added org.eclipse.scout.commons.ClassIdentifier for identifying inner template field classes.
-Migration: Added and changed signatures from Class to ClassIdentifier in the following classes:
- org.eclipse.scout.rt.server.services.common.jdbc.builder.FormDataStatementBuilder
- org.eclipse.scout.rt.server.services.common.jdbc.builder.ValuePartDefinition
- org.eclipse.scout.rt.shared.data.form.AbstractFormData
-
-Example (simplified, without getters):
- // template field data definition
- public static class AbstractTemplateFieldData extends AbstractFormFieldData {
- private static final long serialVersionUID = 1L;
-
- public class TemplateText extends AbstractValueFieldData<String> {
- private static final long serialVersionUID = 1L;
- }
- }
-
- public static class FormData extends AbstractFormData {
- private static final long serialVersionUID = 1L;
-
- // usual field data
- public class Text extends AbstractValueFieldData<String> {
- private static final long serialVersionUID = 1L;
- }
-
- // first usage of template field
- public class Template1GroupBox extends AbstractTemplateFieldData {
- private static final long serialVersionUID = 1L;
- }
-
- // second usage of template field
- public class Template2GroupBox extends AbstractTemplateFieldData {
- private static final long serialVersionUID = 1L;
- }
- }
-
-Defining a FormDataStatementBuilder for template types works as follows:
- FormDataStatementBuilder builder = new FormDataStatementBuilder(new OracleSqlStyle());
- // usual field data
- builder.setValueDefinition( FormData.Text.class , "SQL_ATTRIBUTE", ComposerConstants.OPERATOR_EQ);
- ^^^^^^^^^^^^^^^^^^^
- // inner field of the template requires a ClassIdentifier that provides the 'path to the class'. This one references the TemplateText that is within the Template1Group.
- builder.setValueDefinition( new ClassIdentifier(FormData.Template1GroupBox.class, FormData.Template1GroupBox.TemplateText.class) , "SQL_ATTRIBUTE", ComposerConstants.OPERATOR_EQ);
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- // Like above but it uses the AbstractTemplateFieldData as starting point to get the reference on the TemplateText. This one references the TemplateText that is within the Template2Group.
- builder.setValueDefinition( new ClassIdentifier(FormData.Template2GroupBox.class, AbstractTemplateFieldData.TemplateText.class) , "SQL_ATTRIBUTE", ComposerConstants.OPERATOR_EQ);
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-Migration: actually no migration but fix occurrences in your projects, if already used at all.
-
-20.12.2010 jgu
-Merged BSI Ticket 95648:
-Passwords are not displayed in service property page anymore, but can still be edited.
-Migration: None
-
-21.12.2010 imo
-Extracted DataModel with entities and attributes out of AbstractComposerField and moved to org.eclipse.scout.rt.shared.data.model
-Migration: see client release notes for details.
-Legacy: There is legacy support with deprecated AbstractComposerAttribute and AbstractComposerEntity. Also inner attributes and entities of a composer field are still valid
-and wrapped in a ComposerFieldDataModel. Also use LegacyFormDataStatementBuilder instead of FormDataStatementBuilder
-
-18.03.2011 imo
-Migration of legacy: moving remaining legacy logic from client to server
-Added TokenBasedSearchFilter, TokenBasedSearchFilterService to support token-based query building on logical level.
-Added LegacySearchFilterService to support global client side legacy handling of search behaviour.
-Migration: None
-
-09.05.2011 bko
-Migration:
-Ensure the following two points regarding the ServerApplication:
-- the plugin „org.eclipse.scout.rt.server“ has to be listed as osgi.bundles in the config.ini of the server, otherwise the ServerApplication won’t be started on server startup
-- when using jetty the plugins „org.eclipse.equinox.http.servletbridge“ and „org.eclipse.equinox.servletbridge“ should not be listed in the product configuration, otherwise the ServerApplication will be started twice
-
-10.05.2011 jgu
-Database fragments removed from public eclipse scout:
-
-org.eclipse.scout.rt.server.jdbc.oracle11g.fragment
-org.eclipse.scout.rt.server.jdbc.mysql517.fragment
-org.eclipse.scout.rt.server.jdbc.db2_97.fragment
-org.eclipse.scout.rt.server.jdbc.oracle9i.fragment
-org.eclipse.scout.rt.server.jdbc.oracle10g.fragment
-org.eclipse.scout.rt.server.jdbc.mssql2005.fragment
-
-Migration: None
-
-01.06.2011 imo
-Internal security audit
-- server stack traces must not be sent to client
-- server log must contain all exceptions (except intended business logic exceptions)
-- enhanced access control on gui remote service calls: see IAccessControlService#checkServiceTunnelAccess
-- enhanced security checks on RemoteFileService
-- ServiceTunnelServlet: renamed delegate for transaction dispatching from handleSoapServiceCall to runServerJobTransaction
-Migration: None
-
-13.06.2011 imo
-Internal security audit
-added RemoteServiceAccessPermission
-remote service calls are denied if any of the following
-- the service is not an interface
-- the service is not a IService subtype
-- the method is not defined on the service interface itself
-- the method is on IService (IService2)
-- there is no RemoteServiceAccessPermission for that "service.method" (*)
-- there is an explicit RemoteServiceAccessDenied annotation on the service type or method (general overrule of any existing permission)
-Service policy is centrally applied in BusinessOperationDispatcher
-Migration:
-To support legacy, (*) shows a warning if none RemoteServiceAccessPermission is granted and automatically adds a default *.shared.* permission.
-For 'intranet use' add in your AccessControlService.execLoadPermissions:
- ...
- Permissions p = AccessControlUtility.createPermissions(permissionData);
- p.add(new RemoteServiceAccessPermission("*.shared.*", "*"));
- return p;
-
-For 'internet/extranet use' add in your AccessControlService.execLoadPermissions a more restrictive list:
- ...
- Permissions p = AccessControlUtility.createPermissions(permissionData);
- p.add(new RemoteServiceAccessPermission("com.mycompany.myproduct.shared.services.*", "*"));
- ...
- return p;
-
-28.06.2011 dwi
-bsi ticket #99'948 / #100'755
-Problem:
-If user cancels current running jobs, associated running SQL statements should also be killed.
-Solution:
-Added support to kill associated running JDBC statements if client job gets canceled.
-In StatementProcessor, statements to be executed are registered in RunningStatementStore on behalf of the current session.
-If a ClientJob gets canceled, a subsequent fire-and-forget cancel request is triggered to cancel registered statements.
-Resources changed:
-org.eclipse.scout.rt.client
-- InternalHttpServiceTunnel changed (cancel support for online servermode)
-- plugin.xml changed (registration of cancel processing service)
-com.bsiag.scout.shared
-- IServerProcessingCancelService added (service interface of cancel processing service)
-org.eclipse.scout.rt.server
-- ServerProcessingCancelService added (service implementation of cancel processing service)
-- RunningStatementStore added (store to hold currently running statements)
-- StatementProcessor changed to register / unregister currently running statements
-Migration: None
-
-16.08.2011 abr
-Bugzilla bug #354849
-bsi ticket #105170
-Added method org.eclipse.scout.rt.server.services.common.security.PermissionService.isCandidate(String) for deciding whether a
-class is a potential permission. The method checks the fully-qualified class name. Subclasses may override the default heuristic
-(i.e. '<hosting plug-in's symbolic name>.*.security.*Permission*').
-Migration: None
-
-18.08.2011 abr
-fixed concurrent modifications on RunningStatementStore
-Migration: None
-
-02.10.2011 hmu
-Use same method to extract the username of an logged in Subject in AbstractClientSession and AccessControlStore
-Migration: None
-
-
-18.10.2011 aho
-bugzilla ticket: 361256
-To make reuse of the ServletFilters in RAP projects. The following classes
-should be moved to the 'org.eclipse.scout.http.servletfilter' bundle:
-- org.eclipse.scout.rt.server.servlet.filter.AbstractChainableSecurityFilter
-- org.eclipse.scout.rt.server.servlet.filter.AnonymousSecurityFilter
-- org.eclipse.scout.rt.server.servlet.filter.BasicSecurityFilter
-- org.eclipse.scout.rt.server.servlet.filter.DataSourceSecurityFilter
-- org.eclipse.scout.rt.server.servlet.filter.LDAPSecurityFilter
-- org.eclipse.scout.rt.server.servlet.filter.TomcatSecurityFilter
-
-All servlet filters in the 'org.eclipse.scout.rt.server' bundle were kept as @deprecated subclasses of the moved ones.
-
-Furthermore the
-'org.eclipse.scout.rt.shared.services.common.security.SimplePrincipal' should
-be moved to the 'org.eclipse.scout.commons' bundle.
-
-Migration: change all 'org.eclipse.scout.rt.shared.services.common.security.SimplePrincipal' imports to 'org.eclipse.scout.commons.security.SimplePrincipal'.
-
-24.10.2011 mvi
-Bugzilla ticket 361816
-Replace current NLS support with Text Provider Services
-- added ITextProviderService, IDocumentationTextProviderService, AbstractDynamicNlsTextProviderService
-- Migrated existing text providers to scout text provider services
-- TEXTS class added for consistent translation retrieval
-- Splitted org.eclipse.scout.rt.shared texts into two plugins:
- - org.eclipse.scout.rt.shared contains text provider service with all texts that are used by the runtime
- - org.eclipse.scout.rt.shared.legacy.texts.fragment contains all texts that are no longer used by the runtime
-- getConfiguredDoc properties moved to different ConfigProperty type for Scout SDK (support for Docs Text Providers)
-Migration:
-- Add "org.eclipse.scout.rt.shared.legacy.texts.fragment" to all products.
-- For each existing NLS Class (directly or indirectly extending "org.eclipse.scout.rt.shared.ScoutTexts" or "org.eclipse.scout.commons.nls.DynamicNls"):
- - create a new "<YourSharedPlugin>.services.common.text.<Name>TextProviderService" extending "org.eclipse.scout.rt.shared.services.common.text.AbstractDynamicNlsTextProviderService" in the corresponding shared plugin.
-- For each created TextProvider Service:
- - Overwrite the method "getDynamicNlsBaseName" and return the same value as in the "RESOURCE_BUNDLE_NAME" constant (stored in the corresponding Texts class) as string literal.
- - Register the service in the corresponding plugin as scout service using the "org.eclipse.scout.service.DefaultServiceFactory", no session class and give a ranking > 0. E.g.: <service class="com.bsiag.crm.shared.core.services.common.text.CoreTextProviderService" factory="org.eclipse.scout.service.DefaultServiceFactory" ranking="100" />
-- Delete all Texts classes and replace all uses of the old Texts classes with the class "org.eclipse.scout.rt.shared.TEXTS".
-- Remove the "getNlsTexts" methods from the Session classes if existent (unless you use session-dependent translations).
-- Correct return type of "getConfiguredNlsProvider" of all SqlServices (if existent) to return the new type defined by AbstractSqlService and return "ScoutTexts.class" inside the method.
-- If somewhere the "SwingUtility.setNlsTexts" method or "SwtUtility.setNlsTextsOnDisplay" method is used, set it to "ScoutTexts.getInstance()".
-- Delete all .nls files (NLS Editor can now be accessed using the TextProviderService Node in the Scout Explorer of the Scout perspective).
- If you want to keep the .nls files (e.g. to support key shortcuts like ctrl+shift+r) do the following:
- - Open the .nls file in the text editor (right click -> open with).
- - Remove the following properties: "Nls-Type", "Nls-File-Prefix", "Nls-Translation-Folder".
- - Change the property "Nls-Class" to the fully qualified name of the Text Provider Service you would like to edit with this .nls file.
- - Save the changes and open the .nls file again in the Multilanguage Editor (right click -> open with).
-
-26.10.2011 dwi
-Bugzilla ticket 361795
-Problem:
-Decorating a Date or a Number has to use NlsLocale-Settings.
-Currently, Locale.getLocal() is used which may contradict with user-settings.
-Solution:
-In Java 6 it is possible to contribute custom Locales (e.g. en_CH) to the JRE. That is why Scout NlsLocale is not used anymore and therefore marked as deprecated.
-The user's locale is accessed as follows:
-- On client side, the user's locale is accessed by Locale.getDefault()
-- On server side the request's locale is accessed by LocaleThreadLocal.get() (convenience accessor: ServerSession.get().getLocale())
-Eventhough the class NlsLocale is marked as deprecated for legacy support, its constructor 'NlsLocale(Locale)' was removed because NlsLocale was changed to only act as delegate to the thread's locale (if applicable) or default locale otherwise.
-Please note: A locale consists of its language and country. The country is mainly responsible for format settings as for instance the grouping separator of numbers. A very few locales already exist in the JRE. But if you like to have the application in the English language with Switzerland as its region, you have to contribute your own locale-implementation 'en_CH'. Please see Migration section for detailed instructions to extend JRE with a custom locale.
-Plug-Ins changed:
-- org.eclipse.scout.commons
-- org.eclipse.scout.rt.client
-- org.eclipse.scout.rt.server
-- org.eclipse.scout.rt.shared
-- org.eclipse.scout.rt.ui.swing
-- org.eclipse.scout.rt.oraclelite10g.core
-- org.eclipse.scout.rt.xstream.shared
-Migration:
-- removed NlsLocale(Locale) (constructor): use Locale instead of NlsLocale
-- removed IServerSession#getNlsLocale(): use IServerSession#getLocale() instead (e.g. replace all ServerSession.get().getNlsLocale().getLocale() by ServerSession.get().getLocale())
-- In client Plug-Ins: replace NlsLocale.getDefault().getLocale() by Locale.getDefault()
-- In server Plug-Ins: replace NlsLocale.getThreadDefault().getLocale() by LocaleThreadLocal.get()
-- In shared Plug-Ins: replace NlsLocale.getDefault().getLocale() by NlsUtility.getDefaultLocale()
-Contribution of custom locales to the JRE:
-1. Create a plain Java project, e.g. x.y.localeprovider.en.ch
-2. Create two classes that inherit from {@link DateFormatProvider} and {@link NumberFormatProvider} and implement the method stubs specific to your locale
-3. Create the folder META-INF/services with two files java.text.spi.DateFormatProvider and java.text.spi.NumberFormatProvider
-4. In those files, simply put the the fully qualified name to your date/number provider
-5. Export project as JAR file and put it into \lib\ext of your JRE
-
-09.11.2011 imo
-Legacy Cleanup of ThreadContext
-Problem: The generic ThreadContext.get and put methods consume lots of cpu and since the ThreadLocals of jre 1.5 are available,
-there is no more need for the class.
-Solution:
-ThreadContext only contains the 4 scout server state ThreadLocals.
-ThreadContextLegacy contains the old code (including ThreadContext state)
-Migration (optional):
-Code locations referring to old methods of ThreadContext.Xyz should be renamed to ThreadContextLegacy.Xyz
-
-10.11.2011 imo
-Enhancement of transaction cancel process
-Solution:
-see javadoc on IServerProcessingCancelService and ITransaction
-Migration:
-When using custom ITransactionMember objects, use the super class AbstractTransactionMember to support for api extensions.
-
-11.11.2011 imo
-Enhancement of JAAS authentication
-Solution:
-default servlet filters in org.eclipse.scout.rt.server
-/process by DevelopmentAuthFilter with order 1000000
-/process by HttpAuthJaasFilter with order 1000010
-/ajax by SoapWsseJaasFilter with order 1000010
-see javadoc on HttpAuthJaasFilter, SoapWsseJaasFilter and DevelopmentAuthFilter
-Migration:
-None
-
-30.01.2012 abr
-Bugzilla 370118
-findCodeTypeById on CodeService and CodeServiceClientProxy works for cached code types only
-Solution:
-If findCodeTypeById returns null for a non-null key, populate cache and retry.
-Migration:
-None
-
-23.05.2012 lhu/jgu
-Bugzilla 379721: OfflineDispatcherService: dispatcher thread should be 'offline in current thread'
-1) Server services are not found in offline mode in the following case:
- - OfflineState: online by default, but the current thread is offline
- - The service is created by the ServerServiceFactory
- This is because the dispacher thread in OfflineDispatcherService is running in online mode (if online is default)
- and a service registered with the ServerServiceFactory is only found on the FrontEnd in offline mode.
- Solution:
- The OfflineDispatcherService creates a dispacherThread which is always running offline.
-2) Updates on the SharedVariableMap are propagated to the client with ClientNotifications.
- If some threads are running in online mode and some in offline mode and the state of the online and offline server is different, this leads to problems.
- The notifications should only come from the server to which the application is connected by default.
- Solution: Only send client notifications, if the offline state of the current thread is equal to the default.
-Migration:
-None
-
+19.07.2010 imo (contributed by Sandro Schifferle, ticket 91038)
+Improved security and added possibility to easily reset access control store
+Moved the permission loading away from server session to the (new) project-specific AccessControlService.
+Migration:
+CHANGED ServerSession.java
+OLD
+ void execLoadSession()
+ ...
+ SQL.select(...);
+ SERVICES.getService(IAccessControlService.class).setPermissions(...);
+
+NEW
+ void execLoadSession()
+ ...
+ //no such code any more
+
+ADDED com.bsiag.crm.server.core.services.custom.security.AccessControlService
+package com.bsiag.crm.server.core.services.custom.security;
+import java.security.Permissions;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.server.services.common.jdbc.SQL;
+import org.eclipse.scout.rt.server.services.common.security.AbstractAccessControlService;
+import org.eclipse.scout.rt.shared.services.common.security.AccessControlUtility;
+import org.eclipse.scout.rt.shared.services.common.security.IAccessControlService;
+
+public class AccessControlService extends AbstractAccessControlService implements IAccessControlService {
+
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AccessControlService.class);
+
+ @Override
+ protected Permissions execLoadPermissions() {
+ //moved select statement to here
+ try {
+ Object[][] permissionData = SQL.select(
+ "SELECT P.PERMISSION_NAME, " +
+ " MAX(P.PERMISSION_LEVEL) " +
+ "FROM ORS_USER_ROLE R, ORS_ROLE_PERMISSION P " +
+ "WHERE R.ROLE_UID=P.ROLE_UID " +
+ "AND P.PERMISSION_LEVEL>0 " +
+ "AND R.USER_NR IN( " +
+ " SELECT S.USER_NR " +
+ " FROM ORS_USER_SUBSTITUTE S " +
+ " WHERE S.SUBSTITUTE_NR=:userNr " +
+ " UNION ALL " +
+ " SELECT TO_NUMBER(:userNr) FROM DUAL) " +
+ "GROUP BY P.PERMISSION_NAME"
+ );
+
+ return AccessControlUtility.createPermissions(permissionData);
+ }
+ catch (Throwable t) {
+ LOG.error("update due to client notification", t);
+ return null;
+ // nop
+ }
+ }
+}
+
+ADDED service registration to server plugin.xml
+ <service class="com.bsiag.crm.server.core.services.custom.security.AccessControlService" session="com.bsiag.crm.server.core.ServerSession" factory="org.eclipse.scout.rt.server.services.ServerServiceFactory"/>
+
+16.08.2010 abr (contributed by Daniel Buehler, ticket 91072)
+ADDED two new properties to the org.eclipse.scout.rt.server.services.common.smtp.ISMTPService:
+ useSmtps: controls whether the connection to the SMPT host is encrypted
+ sslProtocols: comma-separated list of SSL protocols used for establishing the connection to the SMTP host
+
+23.08.2010 sle
+Ticket 86'471: SQL Logging
+ADDED AbstractSqlService prints on LogLevel INFO the PlainText-SqlStatement.
+Migration:
+CHANGED SqlService.java
+REMOVED FUNCTIONS:
+ private void createPlainTextLog(String s, Object... bindBases) throws ProcessingException {}
+ public Object[][] select(String s, Object... bindBases) throws ProcessingException {}
+ public void selectInto(String s, Object... bindBases) throws ProcessingException {}
+ public Object[][] selectLimited(String s, int maxRowCount, Object... bindBases) throws ProcessingException {}
+ public int delete(String s, Object... bindBases) throws ProcessingException {}
+ public int update(String s, Object... bindBases) throws ProcessingException {}
+ public int insert(String s, Object... bindBases) throws ProcessingException {}
+
+07.09.2010 imo
+Ticket 89'314
+In ISqlService added support for database specific keyword replacement using ant notation ${name} for:
+${sysdate}
+${upper}
+${lower}
+${trim}
+${nvl}
+
+09.09.2010 imo
+Eliminated direct dependencies to Plug-In javax.servlet and replaced by import-dependencies to package javax.servlet
+Affected Plug-Ins:
+org.eclipse.scout.http.servletfilter
+org.eclipse.scout.rt.server
+Migration:
+com.bsiag.<crm>.server.core, com.bsiag.<crm>.server.online must add an import dependency in their MANIFEST.MF to package javax.servlet.
+In DEVELOPMENT products add the javax.servlet Plug-In.
+In PRODUCTION products eliminate the javax.servlet Plug-In.
+
+13.09.2010 abr
+Merged Tickets 92'255 and 93'777 from branch 20091231.
+Oracle Lite and DB2 require date comparisons making use of to_number(...)
+Migration: None
+
+16.09.2010 abr
+Ticket 94'031
+FormDataStatementBuilder does not take externally defined form data classes into account.
+Migration:
+CHANGED method signature in org.eclipse.scout.rt.server.services.common.jdbc.builder.ValuePartDefinition
+FROM accept(AbstractFormData) TO accept(AbstractFormData, Map<Integer, Map<String, AbstractFormFieldData>>, Map<Integer, Map<String, AbstractPropertyData<?>>>)
+
+03.11.2010 abr
+Ticket 95'772
+FormDataStatementBuilder cannot distinguish between entries of template classes if the template is used multiple times within the same form.
+Now, a ProcessingException is thrown if the statement builder is used with ambiguous ValuePartDefinitions.
+Added org.eclipse.scout.commons.ClassIdentifier for identifying inner template field classes.
+Migration: Added and changed signatures from Class to ClassIdentifier in the following classes:
+ org.eclipse.scout.rt.server.services.common.jdbc.builder.FormDataStatementBuilder
+ org.eclipse.scout.rt.server.services.common.jdbc.builder.ValuePartDefinition
+ org.eclipse.scout.rt.shared.data.form.AbstractFormData
+
+Example (simplified, without getters):
+ // template field data definition
+ public static class AbstractTemplateFieldData extends AbstractFormFieldData {
+ private static final long serialVersionUID = 1L;
+
+ public class TemplateText extends AbstractValueFieldData<String> {
+ private static final long serialVersionUID = 1L;
+ }
+ }
+
+ public static class FormData extends AbstractFormData {
+ private static final long serialVersionUID = 1L;
+
+ // usual field data
+ public class Text extends AbstractValueFieldData<String> {
+ private static final long serialVersionUID = 1L;
+ }
+
+ // first usage of template field
+ public class Template1GroupBox extends AbstractTemplateFieldData {
+ private static final long serialVersionUID = 1L;
+ }
+
+ // second usage of template field
+ public class Template2GroupBox extends AbstractTemplateFieldData {
+ private static final long serialVersionUID = 1L;
+ }
+ }
+
+Defining a FormDataStatementBuilder for template types works as follows:
+ FormDataStatementBuilder builder = new FormDataStatementBuilder(new OracleSqlStyle());
+ // usual field data
+ builder.setValueDefinition( FormData.Text.class , "SQL_ATTRIBUTE", ComposerConstants.OPERATOR_EQ);
+ ^^^^^^^^^^^^^^^^^^^
+ // inner field of the template requires a ClassIdentifier that provides the 'path to the class'. This one references the TemplateText that is within the Template1Group.
+ builder.setValueDefinition( new ClassIdentifier(FormData.Template1GroupBox.class, FormData.Template1GroupBox.TemplateText.class) , "SQL_ATTRIBUTE", ComposerConstants.OPERATOR_EQ);
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ // Like above but it uses the AbstractTemplateFieldData as starting point to get the reference on the TemplateText. This one references the TemplateText that is within the Template2Group.
+ builder.setValueDefinition( new ClassIdentifier(FormData.Template2GroupBox.class, AbstractTemplateFieldData.TemplateText.class) , "SQL_ATTRIBUTE", ComposerConstants.OPERATOR_EQ);
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Migration: actually no migration but fix occurrences in your projects, if already used at all.
+
+20.12.2010 jgu
+Merged BSI Ticket 95648:
+Passwords are not displayed in service property page anymore, but can still be edited.
+Migration: None
+
+21.12.2010 imo
+Extracted DataModel with entities and attributes out of AbstractComposerField and moved to org.eclipse.scout.rt.shared.data.model
+Migration: see client release notes for details.
+Legacy: There is legacy support with deprecated AbstractComposerAttribute and AbstractComposerEntity. Also inner attributes and entities of a composer field are still valid
+and wrapped in a ComposerFieldDataModel. Also use LegacyFormDataStatementBuilder instead of FormDataStatementBuilder
+
+18.03.2011 imo
+Migration of legacy: moving remaining legacy logic from client to server
+Added TokenBasedSearchFilter, TokenBasedSearchFilterService to support token-based query building on logical level.
+Added LegacySearchFilterService to support global client side legacy handling of search behaviour.
+Migration: None
+
+09.05.2011 bko
+Migration:
+Ensure the following two points regarding the ServerApplication:
+- the plugin „org.eclipse.scout.rt.server“ has to be listed as osgi.bundles in the config.ini of the server, otherwise the ServerApplication won’t be started on server startup
+- when using jetty the plugins „org.eclipse.equinox.http.servletbridge“ and „org.eclipse.equinox.servletbridge“ should not be listed in the product configuration, otherwise the ServerApplication will be started twice
+
+10.05.2011 jgu
+Database fragments removed from public eclipse scout:
+
+org.eclipse.scout.rt.server.jdbc.oracle11g.fragment
+org.eclipse.scout.rt.server.jdbc.mysql517.fragment
+org.eclipse.scout.rt.server.jdbc.db2_97.fragment
+org.eclipse.scout.rt.server.jdbc.oracle9i.fragment
+org.eclipse.scout.rt.server.jdbc.oracle10g.fragment
+org.eclipse.scout.rt.server.jdbc.mssql2005.fragment
+
+Migration: None
+
+01.06.2011 imo
+Internal security audit
+- server stack traces must not be sent to client
+- server log must contain all exceptions (except intended business logic exceptions)
+- enhanced access control on gui remote service calls: see IAccessControlService#checkServiceTunnelAccess
+- enhanced security checks on RemoteFileService
+- ServiceTunnelServlet: renamed delegate for transaction dispatching from handleSoapServiceCall to runServerJobTransaction
+Migration: None
+
+13.06.2011 imo
+Internal security audit
+added RemoteServiceAccessPermission
+remote service calls are denied if any of the following
+- the service is not an interface
+- the service is not a IService subtype
+- the method is not defined on the service interface itself
+- the method is on IService (IService2)
+- there is no RemoteServiceAccessPermission for that "service.method" (*)
+- there is an explicit RemoteServiceAccessDenied annotation on the service type or method (general overrule of any existing permission)
+Service policy is centrally applied in BusinessOperationDispatcher
+Migration:
+To support legacy, (*) shows a warning if none RemoteServiceAccessPermission is granted and automatically adds a default *.shared.* permission.
+For 'intranet use' add in your AccessControlService.execLoadPermissions:
+ ...
+ Permissions p = AccessControlUtility.createPermissions(permissionData);
+ p.add(new RemoteServiceAccessPermission("*.shared.*", "*"));
+ return p;
+
+For 'internet/extranet use' add in your AccessControlService.execLoadPermissions a more restrictive list:
+ ...
+ Permissions p = AccessControlUtility.createPermissions(permissionData);
+ p.add(new RemoteServiceAccessPermission("com.mycompany.myproduct.shared.services.*", "*"));
+ ...
+ return p;
+
+28.06.2011 dwi
+bsi ticket #99'948 / #100'755
+Problem:
+If user cancels current running jobs, associated running SQL statements should also be killed.
+Solution:
+Added support to kill associated running JDBC statements if client job gets canceled.
+In StatementProcessor, statements to be executed are registered in RunningStatementStore on behalf of the current session.
+If a ClientJob gets canceled, a subsequent fire-and-forget cancel request is triggered to cancel registered statements.
+Resources changed:
+org.eclipse.scout.rt.client
+- InternalHttpServiceTunnel changed (cancel support for online servermode)
+- plugin.xml changed (registration of cancel processing service)
+com.bsiag.scout.shared
+- IServerProcessingCancelService added (service interface of cancel processing service)
+org.eclipse.scout.rt.server
+- ServerProcessingCancelService added (service implementation of cancel processing service)
+- RunningStatementStore added (store to hold currently running statements)
+- StatementProcessor changed to register / unregister currently running statements
+Migration: None
+
+16.08.2011 abr
+Bugzilla bug #354849
+bsi ticket #105170
+Added method org.eclipse.scout.rt.server.services.common.security.PermissionService.isCandidate(String) for deciding whether a
+class is a potential permission. The method checks the fully-qualified class name. Subclasses may override the default heuristic
+(i.e. '<hosting plug-in's symbolic name>.*.security.*Permission*').
+Migration: None
+
+18.08.2011 abr
+fixed concurrent modifications on RunningStatementStore
+Migration: None
+
+02.10.2011 hmu
+Use same method to extract the username of an logged in Subject in AbstractClientSession and AccessControlStore
+Migration: None
+
+
+18.10.2011 aho
+bugzilla ticket: 361256
+To make reuse of the ServletFilters in RAP projects. The following classes
+should be moved to the 'org.eclipse.scout.http.servletfilter' bundle:
+- org.eclipse.scout.rt.server.servlet.filter.AbstractChainableSecurityFilter
+- org.eclipse.scout.rt.server.servlet.filter.AnonymousSecurityFilter
+- org.eclipse.scout.rt.server.servlet.filter.BasicSecurityFilter
+- org.eclipse.scout.rt.server.servlet.filter.DataSourceSecurityFilter
+- org.eclipse.scout.rt.server.servlet.filter.LDAPSecurityFilter
+- org.eclipse.scout.rt.server.servlet.filter.TomcatSecurityFilter
+
+All servlet filters in the 'org.eclipse.scout.rt.server' bundle were kept as @deprecated subclasses of the moved ones.
+
+Furthermore the
+'org.eclipse.scout.rt.shared.services.common.security.SimplePrincipal' should
+be moved to the 'org.eclipse.scout.commons' bundle.
+
+Migration: change all 'org.eclipse.scout.rt.shared.services.common.security.SimplePrincipal' imports to 'org.eclipse.scout.commons.security.SimplePrincipal'.
+
+24.10.2011 mvi
+Bugzilla ticket 361816
+Replace current NLS support with Text Provider Services
+- added ITextProviderService, IDocumentationTextProviderService, AbstractDynamicNlsTextProviderService
+- Migrated existing text providers to scout text provider services
+- TEXTS class added for consistent translation retrieval
+- Splitted org.eclipse.scout.rt.shared texts into two plugins:
+ - org.eclipse.scout.rt.shared contains text provider service with all texts that are used by the runtime
+ - org.eclipse.scout.rt.shared.legacy.texts.fragment contains all texts that are no longer used by the runtime
+- getConfiguredDoc properties moved to different ConfigProperty type for Scout SDK (support for Docs Text Providers)
+Migration:
+- Add "org.eclipse.scout.rt.shared.legacy.texts.fragment" to all products.
+- For each existing NLS Class (directly or indirectly extending "org.eclipse.scout.rt.shared.ScoutTexts" or "org.eclipse.scout.commons.nls.DynamicNls"):
+ - create a new "<YourSharedPlugin>.services.common.text.<Name>TextProviderService" extending "org.eclipse.scout.rt.shared.services.common.text.AbstractDynamicNlsTextProviderService" in the corresponding shared plugin.
+- For each created TextProvider Service:
+ - Overwrite the method "getDynamicNlsBaseName" and return the same value as in the "RESOURCE_BUNDLE_NAME" constant (stored in the corresponding Texts class) as string literal.
+ - Register the service in the corresponding plugin as scout service using the "org.eclipse.scout.service.DefaultServiceFactory", no session class and give a ranking > 0. E.g.: <service class="com.bsiag.crm.shared.core.services.common.text.CoreTextProviderService" factory="org.eclipse.scout.service.DefaultServiceFactory" ranking="100" />
+- Delete all Texts classes and replace all uses of the old Texts classes with the class "org.eclipse.scout.rt.shared.TEXTS".
+- Remove the "getNlsTexts" methods from the Session classes if existent (unless you use session-dependent translations).
+- Correct return type of "getConfiguredNlsProvider" of all SqlServices (if existent) to return the new type defined by AbstractSqlService and return "ScoutTexts.class" inside the method.
+- If somewhere the "SwingUtility.setNlsTexts" method or "SwtUtility.setNlsTextsOnDisplay" method is used, set it to "ScoutTexts.getInstance()".
+- Delete all .nls files (NLS Editor can now be accessed using the TextProviderService Node in the Scout Explorer of the Scout perspective).
+ If you want to keep the .nls files (e.g. to support key shortcuts like ctrl+shift+r) do the following:
+ - Open the .nls file in the text editor (right click -> open with).
+ - Remove the following properties: "Nls-Type", "Nls-File-Prefix", "Nls-Translation-Folder".
+ - Change the property "Nls-Class" to the fully qualified name of the Text Provider Service you would like to edit with this .nls file.
+ - Save the changes and open the .nls file again in the Multilanguage Editor (right click -> open with).
+
+26.10.2011 dwi
+Bugzilla ticket 361795
+Problem:
+Decorating a Date or a Number has to use NlsLocale-Settings.
+Currently, Locale.getLocal() is used which may contradict with user-settings.
+Solution:
+In Java 6 it is possible to contribute custom Locales (e.g. en_CH) to the JRE. That is why Scout NlsLocale is not used anymore and therefore marked as deprecated.
+The user's locale is accessed as follows:
+- On client side, the user's locale is accessed by Locale.getDefault()
+- On server side the request's locale is accessed by LocaleThreadLocal.get() (convenience accessor: ServerSession.get().getLocale())
+Eventhough the class NlsLocale is marked as deprecated for legacy support, its constructor 'NlsLocale(Locale)' was removed because NlsLocale was changed to only act as delegate to the thread's locale (if applicable) or default locale otherwise.
+Please note: A locale consists of its language and country. The country is mainly responsible for format settings as for instance the grouping separator of numbers. A very few locales already exist in the JRE. But if you like to have the application in the English language with Switzerland as its region, you have to contribute your own locale-implementation 'en_CH'. Please see Migration section for detailed instructions to extend JRE with a custom locale.
+Plug-Ins changed:
+- org.eclipse.scout.commons
+- org.eclipse.scout.rt.client
+- org.eclipse.scout.rt.server
+- org.eclipse.scout.rt.shared
+- org.eclipse.scout.rt.ui.swing
+- org.eclipse.scout.rt.oraclelite10g.core
+- org.eclipse.scout.rt.xstream.shared
+Migration:
+- removed NlsLocale(Locale) (constructor): use Locale instead of NlsLocale
+- removed IServerSession#getNlsLocale(): use IServerSession#getLocale() instead (e.g. replace all ServerSession.get().getNlsLocale().getLocale() by ServerSession.get().getLocale())
+- In client Plug-Ins: replace NlsLocale.getDefault().getLocale() by Locale.getDefault()
+- In server Plug-Ins: replace NlsLocale.getThreadDefault().getLocale() by LocaleThreadLocal.get()
+- In shared Plug-Ins: replace NlsLocale.getDefault().getLocale() by NlsUtility.getDefaultLocale()
+Contribution of custom locales to the JRE:
+1. Create a plain Java project, e.g. x.y.localeprovider.en.ch
+2. Create two classes that inherit from {@link DateFormatProvider} and {@link NumberFormatProvider} and implement the method stubs specific to your locale
+3. Create the folder META-INF/services with two files java.text.spi.DateFormatProvider and java.text.spi.NumberFormatProvider
+4. In those files, simply put the the fully qualified name to your date/number provider
+5. Export project as JAR file and put it into \lib\ext of your JRE
+
+09.11.2011 imo
+Legacy Cleanup of ThreadContext
+Problem: The generic ThreadContext.get and put methods consume lots of cpu and since the ThreadLocals of jre 1.5 are available,
+there is no more need for the class.
+Solution:
+ThreadContext only contains the 4 scout server state ThreadLocals.
+ThreadContextLegacy contains the old code (including ThreadContext state)
+Migration (optional):
+Code locations referring to old methods of ThreadContext.Xyz should be renamed to ThreadContextLegacy.Xyz
+
+10.11.2011 imo
+Enhancement of transaction cancel process
+Solution:
+see javadoc on IServerProcessingCancelService and ITransaction
+Migration:
+When using custom ITransactionMember objects, use the super class AbstractTransactionMember to support for api extensions.
+
+11.11.2011 imo
+Enhancement of JAAS authentication
+Solution:
+default servlet filters in org.eclipse.scout.rt.server
+/process by DevelopmentAuthFilter with order 1000000
+/process by HttpAuthJaasFilter with order 1000010
+/ajax by SoapWsseJaasFilter with order 1000010
+see javadoc on HttpAuthJaasFilter, SoapWsseJaasFilter and DevelopmentAuthFilter
+Migration:
+None
+
+30.01.2012 abr
+Bugzilla 370118
+findCodeTypeById on CodeService and CodeServiceClientProxy works for cached code types only
+Solution:
+If findCodeTypeById returns null for a non-null key, populate cache and retry.
+Migration:
+None
+
+23.05.2012 lhu/jgu
+Bugzilla 379721: OfflineDispatcherService: dispatcher thread should be 'offline in current thread'
+1) Server services are not found in offline mode in the following case:
+ - OfflineState: online by default, but the current thread is offline
+ - The service is created by the ServerServiceFactory
+ This is because the dispacher thread in OfflineDispatcherService is running in online mode (if online is default)
+ and a service registered with the ServerServiceFactory is only found on the FrontEnd in offline mode.
+ Solution:
+ The OfflineDispatcherService creates a dispacherThread which is always running offline.
+2) Updates on the SharedVariableMap are propagated to the client with ClientNotifications.
+ If some threads are running in online mode and some in offline mode and the state of the online and offline server is different, this leads to problems.
+ The notifications should only come from the server to which the application is connected by default.
+ Solution: Only send client notifications, if the offline state of the current thread is equal to the default.
+Migration:
+None
+
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/AbstractServerSession.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/AbstractServerSession.java
index 0e49df2ad0..569ffb68bc 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/AbstractServerSession.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/AbstractServerSession.java
@@ -1,256 +1,256 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-
-import org.eclipse.scout.commons.LocaleThreadLocal;
-import org.eclipse.scout.commons.TypeCastUtility;
-import org.eclipse.scout.commons.annotations.ConfigOperation;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.server.services.common.clientnotification.IClientNotificationService;
-import org.eclipse.scout.rt.server.services.common.clientnotification.SessionFilter;
-import org.eclipse.scout.rt.shared.OfflineState;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.TextsThreadLocal;
-import org.eclipse.scout.rt.shared.services.common.context.SharedContextChangedNotification;
-import org.eclipse.scout.rt.shared.services.common.context.SharedVariableMap;
-import org.eclipse.scout.rt.shared.services.common.security.IAccessControlService;
-import org.eclipse.scout.rt.shared.ui.UserAgent;
-import org.eclipse.scout.service.SERVICES;
-import org.osgi.framework.Bundle;
-
-public abstract class AbstractServerSession implements IServerSession {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractServerSession.class);
-
- private Bundle m_bundle;
- private boolean m_initialized;
- private boolean m_active;
- private Locale m_locale;
- private final HashMap<String, Object> m_attributes;
- private final Object m_attributesLock;
- private final SharedVariableMap m_sharedVariableMap;
- private boolean m_singleThreadSession;
- private ScoutTexts m_scoutTexts;
- private UserAgent m_userAgent;
-
- public AbstractServerSession(boolean autoInitConfig) {
- m_locale = LocaleThreadLocal.get();
- m_attributesLock = new Object();
- m_attributes = new HashMap<String, Object>();
- m_sharedVariableMap = new SharedVariableMap();
- if (autoInitConfig) {
- initConfig();
- }
- }
-
- /**
- * @deprecated use {@link #getConfiguredSingleThreadSession()} instead
- */
- @Deprecated
- protected boolean getConfiguredWebSession() {
- return getConfiguredSingleThreadSession();
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(100)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredSingleThreadSession() {
- return false;
- }
-
- @Override
- public Map<String, Object> getSharedVariableMap() {
- return Collections.unmodifiableMap(m_sharedVariableMap);
- }
-
- /**
- * do not use this internal method directly
- */
- protected <T> T getSharedContextVariable(String name, Class<T> type) {
- Object o = m_sharedVariableMap.get(name);
- return TypeCastUtility.castValue(o, type);
- }
-
- /**
- * do not use this internal method directly
- */
- protected <T> void setSharedContextVariable(String name, Class<T> type, T value) {
- T typedValue = TypeCastUtility.castValue(value, type);
- m_sharedVariableMap.put(name, typedValue);
- }
-
- private void assignUserId() {
- String userId = SERVICES.getService(IAccessControlService.class).getUserIdOfCurrentSubject();
- setUserIdInternal(userId);
- }
-
- /**
- * The session is running in its event loop
- */
- @Override
- public boolean isActive() {
- return m_active;
- }
-
- @Override
- public final String getUserId() {
- return getSharedContextVariable("userId", String.class);
- }
-
- private void setUserIdInternal(String newValue) {
- setSharedContextVariable("userId", String.class, newValue);
- }
-
- @Override
- public Locale getLocale() {
- return m_locale;
- }
-
- @Override
- public void setLocale(Locale l) {
- if (l != null) {
- m_locale = l;
- }
- }
-
- /**
- * <p>
- * Returns the {@link ScoutTexts} instance assigned to the type (class) of the current ServerSession.
- * </p>
- * <p>
- * Override this method to set the application specific texts implementation
- * </p>
- */
- @Override
- public ScoutTexts getTexts() {
- return m_scoutTexts;
- }
-
- @SuppressWarnings("deprecation")
- @Override
- public Object getAttribute(String key) {
- return getData(key);
- }
-
- @SuppressWarnings("deprecation")
- @Override
- public void setAttribute(String key, Object value) {
- setData(key, value);
- }
-
- @Override
- public Object getData(String key) {
- synchronized (m_attributesLock) {
- return m_attributes.get(key);
- }
- }
-
- @Override
- public void setData(String key, Object value) {
- synchronized (m_attributesLock) {
- m_attributes.put(key, value);
- }
- }
-
- protected void initConfig() {
- m_singleThreadSession = getConfiguredSingleThreadSession();
- if (!isWebSession()) {
- m_sharedVariableMap.addPropertyChangeListener(new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent e) {
- if (OfflineState.isOfflineDefault() == OfflineState.isOfflineInCurrentThread()) {
- // notify this session
- SERVICES.getService(IClientNotificationService.class).putNotification(new SharedContextChangedNotification(new SharedVariableMap(m_sharedVariableMap)), new SessionFilter(AbstractServerSession.this, 60000L));
- }
- }
- });
- }
- if (m_initialized) {
- return;
- }
- m_initialized = true;
- }
-
- @Override
- public Bundle getBundle() {
- return m_bundle;
- }
-
- @Override
- public final void loadSession(Bundle bundle) throws ProcessingException {
- if (isActive()) {
- throw new IllegalStateException("session is active");
- }
- if (bundle == null) {
- throw new IllegalArgumentException("bundle must not be null");
- }
- m_bundle = bundle;
- m_active = true;
- m_scoutTexts = new ScoutTexts();
- // explicitly set the just created instance to the ThreadLocal because it was not available yet, when the job was started.
- TextsThreadLocal.set(m_scoutTexts);
- assignUserId();
- execLoadSession();
- }
-
- /**
- * 1. Identify (authenticate) user by its credentials
- * <ul>
- * <li>success: nop
- * <li>failure: throws wrapped ProcessingException(SecurityException)
- * </ul>
- * 2. Load session data such as properties, permissions
- */
- @ConfigOperation
- @Order(10)
- protected void execLoadSession() throws ProcessingException {
- }
-
- /**
- * @deprecated never called by the framework
- */
- @Deprecated
- protected void execLocaleChanged() throws ProcessingException {
- }
-
- @Override
- @SuppressWarnings("deprecation")
- public boolean isWebSession() {
- return isSingleThreadSession();
- }
-
- @Override
- public boolean isSingleThreadSession() {
- return m_singleThreadSession;
- }
-
- @Override
- public UserAgent getUserAgent() {
- return m_userAgent;
- }
-
- @Override
- public void setUserAgent(UserAgent userAgent) {
- m_userAgent = userAgent;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+
+import org.eclipse.scout.commons.LocaleThreadLocal;
+import org.eclipse.scout.commons.TypeCastUtility;
+import org.eclipse.scout.commons.annotations.ConfigOperation;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.server.services.common.clientnotification.IClientNotificationService;
+import org.eclipse.scout.rt.server.services.common.clientnotification.SessionFilter;
+import org.eclipse.scout.rt.shared.OfflineState;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.TextsThreadLocal;
+import org.eclipse.scout.rt.shared.services.common.context.SharedContextChangedNotification;
+import org.eclipse.scout.rt.shared.services.common.context.SharedVariableMap;
+import org.eclipse.scout.rt.shared.services.common.security.IAccessControlService;
+import org.eclipse.scout.rt.shared.ui.UserAgent;
+import org.eclipse.scout.service.SERVICES;
+import org.osgi.framework.Bundle;
+
+public abstract class AbstractServerSession implements IServerSession {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractServerSession.class);
+
+ private Bundle m_bundle;
+ private boolean m_initialized;
+ private boolean m_active;
+ private Locale m_locale;
+ private final HashMap<String, Object> m_attributes;
+ private final Object m_attributesLock;
+ private final SharedVariableMap m_sharedVariableMap;
+ private boolean m_singleThreadSession;
+ private ScoutTexts m_scoutTexts;
+ private UserAgent m_userAgent;
+
+ public AbstractServerSession(boolean autoInitConfig) {
+ m_locale = LocaleThreadLocal.get();
+ m_attributesLock = new Object();
+ m_attributes = new HashMap<String, Object>();
+ m_sharedVariableMap = new SharedVariableMap();
+ if (autoInitConfig) {
+ initConfig();
+ }
+ }
+
+ /**
+ * @deprecated use {@link #getConfiguredSingleThreadSession()} instead
+ */
+ @Deprecated
+ protected boolean getConfiguredWebSession() {
+ return getConfiguredSingleThreadSession();
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(100)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredSingleThreadSession() {
+ return false;
+ }
+
+ @Override
+ public Map<String, Object> getSharedVariableMap() {
+ return Collections.unmodifiableMap(m_sharedVariableMap);
+ }
+
+ /**
+ * do not use this internal method directly
+ */
+ protected <T> T getSharedContextVariable(String name, Class<T> type) {
+ Object o = m_sharedVariableMap.get(name);
+ return TypeCastUtility.castValue(o, type);
+ }
+
+ /**
+ * do not use this internal method directly
+ */
+ protected <T> void setSharedContextVariable(String name, Class<T> type, T value) {
+ T typedValue = TypeCastUtility.castValue(value, type);
+ m_sharedVariableMap.put(name, typedValue);
+ }
+
+ private void assignUserId() {
+ String userId = SERVICES.getService(IAccessControlService.class).getUserIdOfCurrentSubject();
+ setUserIdInternal(userId);
+ }
+
+ /**
+ * The session is running in its event loop
+ */
+ @Override
+ public boolean isActive() {
+ return m_active;
+ }
+
+ @Override
+ public final String getUserId() {
+ return getSharedContextVariable("userId", String.class);
+ }
+
+ private void setUserIdInternal(String newValue) {
+ setSharedContextVariable("userId", String.class, newValue);
+ }
+
+ @Override
+ public Locale getLocale() {
+ return m_locale;
+ }
+
+ @Override
+ public void setLocale(Locale l) {
+ if (l != null) {
+ m_locale = l;
+ }
+ }
+
+ /**
+ * <p>
+ * Returns the {@link ScoutTexts} instance assigned to the type (class) of the current ServerSession.
+ * </p>
+ * <p>
+ * Override this method to set the application specific texts implementation
+ * </p>
+ */
+ @Override
+ public ScoutTexts getTexts() {
+ return m_scoutTexts;
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public Object getAttribute(String key) {
+ return getData(key);
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public void setAttribute(String key, Object value) {
+ setData(key, value);
+ }
+
+ @Override
+ public Object getData(String key) {
+ synchronized (m_attributesLock) {
+ return m_attributes.get(key);
+ }
+ }
+
+ @Override
+ public void setData(String key, Object value) {
+ synchronized (m_attributesLock) {
+ m_attributes.put(key, value);
+ }
+ }
+
+ protected void initConfig() {
+ m_singleThreadSession = getConfiguredSingleThreadSession();
+ if (!isWebSession()) {
+ m_sharedVariableMap.addPropertyChangeListener(new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent e) {
+ if (OfflineState.isOfflineDefault() == OfflineState.isOfflineInCurrentThread()) {
+ // notify this session
+ SERVICES.getService(IClientNotificationService.class).putNotification(new SharedContextChangedNotification(new SharedVariableMap(m_sharedVariableMap)), new SessionFilter(AbstractServerSession.this, 60000L));
+ }
+ }
+ });
+ }
+ if (m_initialized) {
+ return;
+ }
+ m_initialized = true;
+ }
+
+ @Override
+ public Bundle getBundle() {
+ return m_bundle;
+ }
+
+ @Override
+ public final void loadSession(Bundle bundle) throws ProcessingException {
+ if (isActive()) {
+ throw new IllegalStateException("session is active");
+ }
+ if (bundle == null) {
+ throw new IllegalArgumentException("bundle must not be null");
+ }
+ m_bundle = bundle;
+ m_active = true;
+ m_scoutTexts = new ScoutTexts();
+ // explicitly set the just created instance to the ThreadLocal because it was not available yet, when the job was started.
+ TextsThreadLocal.set(m_scoutTexts);
+ assignUserId();
+ execLoadSession();
+ }
+
+ /**
+ * 1. Identify (authenticate) user by its credentials
+ * <ul>
+ * <li>success: nop
+ * <li>failure: throws wrapped ProcessingException(SecurityException)
+ * </ul>
+ * 2. Load session data such as properties, permissions
+ */
+ @ConfigOperation
+ @Order(10)
+ protected void execLoadSession() throws ProcessingException {
+ }
+
+ /**
+ * @deprecated never called by the framework
+ */
+ @Deprecated
+ protected void execLocaleChanged() throws ProcessingException {
+ }
+
+ @Override
+ @SuppressWarnings("deprecation")
+ public boolean isWebSession() {
+ return isSingleThreadSession();
+ }
+
+ @Override
+ public boolean isSingleThreadSession() {
+ return m_singleThreadSession;
+ }
+
+ @Override
+ public UserAgent getUserAgent() {
+ return m_userAgent;
+ }
+
+ @Override
+ public void setUserAgent(UserAgent userAgent) {
+ m_userAgent = userAgent;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/BusinessOperationDispatcher.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/BusinessOperationDispatcher.java
index 9cd588419c..3c25bcf5af 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/BusinessOperationDispatcher.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/BusinessOperationDispatcher.java
@@ -1,28 +1,28 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server;
-
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.Version;
-
-/**
- * @deprecated use {@link DefaultTransactionDelegate}
- */
-@Deprecated
-public class BusinessOperationDispatcher extends DefaultTransactionDelegate {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(BusinessOperationDispatcher.class);
-
- public BusinessOperationDispatcher(Bundle[] loaderBundles, Version requestMinVersion, boolean debug) {
- super(loaderBundles, requestMinVersion, debug);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server;
+
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.Version;
+
+/**
+ * @deprecated use {@link DefaultTransactionDelegate}
+ */
+@Deprecated
+public class BusinessOperationDispatcher extends DefaultTransactionDelegate {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(BusinessOperationDispatcher.class);
+
+ public BusinessOperationDispatcher(Bundle[] loaderBundles, Version requestMinVersion, boolean debug) {
+ super(loaderBundles, requestMinVersion, debug);
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/DefaultTransactionDelegate.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/DefaultTransactionDelegate.java
index c53d400c5f..18205e3382 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/DefaultTransactionDelegate.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/DefaultTransactionDelegate.java
@@ -1,521 +1,521 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
-import java.util.Date;
-import java.util.regex.Pattern;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.exception.VetoException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.server.admin.inspector.CallInspector;
-import org.eclipse.scout.rt.server.admin.inspector.ProcessInspector;
-import org.eclipse.scout.rt.server.admin.inspector.SessionInspector;
-import org.eclipse.scout.rt.server.internal.Activator;
-import org.eclipse.scout.rt.server.services.common.clientnotification.IClientNotificationService;
-import org.eclipse.scout.rt.server.transaction.ITransaction;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.WebClientState;
-import org.eclipse.scout.rt.shared.security.RemoteServiceAccessPermission;
-import org.eclipse.scout.rt.shared.services.common.clientnotification.IClientNotification;
-import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
-import org.eclipse.scout.rt.shared.services.common.security.ACCESS;
-import org.eclipse.scout.rt.shared.servicetunnel.RemoteServiceAccessDenied;
-import org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelAccessDenied;
-import org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelRequest;
-import org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelResponse;
-import org.eclipse.scout.rt.shared.servicetunnel.VersionMismatchException;
-import org.eclipse.scout.rt.shared.validate.DefaultValidator;
-import org.eclipse.scout.rt.shared.validate.IValidationStrategy;
-import org.eclipse.scout.rt.shared.validate.InputValidation;
-import org.eclipse.scout.rt.shared.validate.OutputValidation;
-import org.eclipse.scout.service.IService;
-import org.eclipse.scout.service.IService2;
-import org.eclipse.scout.service.SERVICES;
-import org.eclipse.scout.service.ServiceUtility;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.Version;
-
-/**
- * Delegate for scout dynamic business op invocation
- * <p>
- * Subclass this type to change/add validation checks or call {@link #setValidateInput(true)} to activate them.
- * <p>
- * Override {@link #validateInput(IValidationStrategy, Object, Method, Object[])} and/or
- * {@link #validateOutput(IValidationStrategy, Object, Method, Object, Object[])} to modifiy the default central
- * validation. You may use {@link #defaultValidateInput(IValidationStrategy, Object, Method, Object[])} and
- * {@link #defaultValidateOutput(IValidationStrategy, Object, Method, Object, Object[])}
- * <p>
- * Set the config.ini properties to activate default validation:
- *
- * <pre>
- * org.eclipse.scout.rt.server.validateInput=true
- * org.eclipse.scout.rt.server.validateOutput=false
- * </pre>
- */
-@SuppressWarnings("deprecation")
-public class DefaultTransactionDelegate {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(DefaultTransactionDelegate.class);
- private static final Boolean VALIDATE_INPUT = "true".equals(Activator.getDefault().getBundle().getBundleContext().getProperty("org.eclipse.scout.rt.server.validateInput"));
- private static final Boolean VALIDATE_OUTPUT = "true".equals(Activator.getDefault().getBundle().getBundleContext().getProperty("org.eclipse.scout.rt.server.validateOutput"));
-
- public static final Pattern DEFAULT_QUERY_NAMES_PATTERN = Pattern.compile("(get|is|has|load|read|find|select)([A-Z].*)?");
- public static final Pattern DEFAULT_PROCESS_NAMES_PATTERN = Pattern.compile("(set|put|add|remove|store|write|create|insert|update|delete)([A-Z].*)?");
-
- private final Version m_requestMinVersion;
- private final boolean m_debug;
- private final Bundle[] m_loaderBundles;
- private long m_requestStart;
- private long m_requestEnd;
-
- public DefaultTransactionDelegate(Bundle[] loaderBundles, Version requestMinVersion, boolean debug) {
- m_loaderBundles = loaderBundles;
- m_requestMinVersion = requestMinVersion;
- m_debug = debug;
- }
-
- public ServiceTunnelResponse invoke(ServiceTunnelRequest serviceReq) throws Exception {
- ServiceTunnelResponse response;
- m_requestStart = System.nanoTime();
- try {
- response = invokeImpl(serviceReq);
- }
- catch (Throwable t) {
- ITransaction transaction = ThreadContext.getTransaction();
- try {
- // cancel tx
- if (transaction != null) {
- transaction.addFailure(t);
- }
- }
- catch (Throwable ignore) {
- // nop
- }
- //log it
- if (transaction == null || !transaction.isCancelled()) {
- if (t instanceof ProcessingException) {
- ((ProcessingException) t).addContextMessage("invoking " + serviceReq.getServiceInterfaceClassName() + ":" + serviceReq.getOperation());
- SERVICES.getService(IExceptionHandlerService.class).handleException((ProcessingException) t);
- }
- else {
- LOG.error("invoking " + serviceReq.getServiceInterfaceClassName() + ":" + serviceReq.getOperation(), t);
- }
- }
- Throwable p = replaceOutboundException(t);
- response = new ServiceTunnelResponse(null, null, p);
- }
- finally {
- if (m_debug) {
- LOG.debug("TIME " + serviceReq.getServiceInterfaceClassName() + "." + serviceReq.getOperation() + " " + (m_requestEnd - m_requestStart) / 1000000L + "ms");
- }
- }
- m_requestEnd = System.nanoTime();
- response.setProcessingDuration((m_requestEnd - m_requestStart) / 1000000L);
- return response;
- }
-
- /**
- * security: do not send back original error and stack trace with details
- * <p>
- * default returns an empty exception or in case of a {@link VetoException} only its title, message, error code and
- * severity
- */
- protected Throwable replaceOutboundException(Throwable t) {
- Throwable p;
- if (t instanceof VetoException) {
- VetoException ve = (VetoException) t;
- p = new VetoException(ve.getStatus().getTitle(), ve.getMessage(), ve.getStatus().getCode(), ve.getStatus().getSeverity());
- }
- else {
- p = new ProcessingException(ScoutTexts.get("RequestProblem"));
- }
- p.setStackTrace(new StackTraceElement[0]);
- return p;
- }
-
- /**
- * This method is executed within a {@link IServerSession} context using a {@link ServerJob}
- */
- protected ServiceTunnelResponse invokeImpl(ServiceTunnelRequest serviceReq) throws Throwable {
- String soapOperation = ServiceTunnelRequest.toSoapOperation(serviceReq.getServiceInterfaceClassName(), serviceReq.getOperation());
- IServerSession serverSession = ThreadContext.getServerSession();
- String authenticatedUser = serverSession.getUserId();
- if (LOG.isDebugEnabled()) {
- LOG.debug("started " + serviceReq.getServiceInterfaceClassName() + "." + serviceReq.getOperation() + " by " + authenticatedUser + " at " + new Date());
- }
- // version check of request
- if (m_requestMinVersion != null) {
- String v = serviceReq.getVersion();
- if (v == null) {
- v = "0.0.0";
- }
- Version requestVersion = Version.parseVersion(v);
- if (requestVersion.compareTo(m_requestMinVersion) < 0) {
- ServiceTunnelResponse serviceRes = new ServiceTunnelResponse(null, null, new VersionMismatchException(requestVersion.toString(), m_requestMinVersion.toString()));
- return serviceRes;
- }
- }
- CallInspector callInspector = null;
- SessionInspector sessionInspector = ProcessInspector.getDefault().getSessionInspector(serverSession, true);
- if (sessionInspector != null) {
- callInspector = sessionInspector.requestCallInspector(serviceReq);
- }
- ServiceTunnelResponse serviceRes = null;
- boolean backupIsWebClientCurrentThread = WebClientState.isWebClientInCurrentThread();
- try {
- String virtualSessionId = serviceReq.getVirtualSessionId();
- WebClientState.setWebClientInCurrentThread(virtualSessionId != null);
- //do checks
- Class<?> serviceInterfaceClass = null;
- for (Bundle b : m_loaderBundles) {
- try {
- serviceInterfaceClass = b.loadClass(serviceReq.getServiceInterfaceClassName());
- break;
- }
- catch (ClassNotFoundException e) {
- // nop
- }
- }
- //check access: existence
- if (serviceInterfaceClass == null) {
- throw new ClassNotFoundException(serviceReq.getServiceInterfaceClassName());
- }
- //check access: service proxy allowed
- Method serviceOp = ServiceUtility.getServiceOperation(serviceInterfaceClass, serviceReq.getOperation(), serviceReq.getParameterTypes());
- checkRemoteServiceAccessByInterface(serviceInterfaceClass, serviceOp, serviceReq.getArgs());
- //check access: service impl exists
- Object service = SERVICES.getService(serviceInterfaceClass);
- if (service == null) {
- throw new SecurityException("service registry does not contain a service of type " + serviceReq.getServiceInterfaceClassName());
- }
- checkRemoteServiceAccessByAnnotations(serviceInterfaceClass, service.getClass(), serviceOp, serviceReq.getArgs());
- checkRemoteServiceAccessByPermission(serviceInterfaceClass, service.getClass(), serviceOp, serviceReq.getArgs());
- //all checks done
- //
- //filter input
- if (serviceReq.getArgs() != null && serviceReq.getArgs().length > 0) {
- Class<? extends IValidationStrategy> inputValidationStrategyClass = findInputValidationStrategyByAnnotation(service, serviceOp);
- if (inputValidationStrategyClass == null) {
- inputValidationStrategyClass = findInputValidationStrategyByPolicy(service, serviceOp);
- }
- if (inputValidationStrategyClass == null) {
- throw new SecurityException("input validation failed (no strategy defined)");
- }
- validateInput(inputValidationStrategyClass.newInstance(), service, serviceOp, serviceReq.getArgs());
- }
- //
- Object data = ServiceUtility.invoke(serviceOp, service, serviceReq.getArgs());
- Object[] outParameters = ServiceUtility.extractHolderArguments(serviceReq.getArgs());
- //
- //filter output
- if (data != null || (outParameters != null && outParameters.length > 0)) {
- Class<? extends IValidationStrategy> outputValidationStrategyClass = findOutputValidationStrategyByAnnotation(service, serviceOp);
- if (outputValidationStrategyClass == null) {
- outputValidationStrategyClass = findOutputValidationStrategyByPolicy(service, serviceOp);
- }
- if (outputValidationStrategyClass == null) {
- throw new SecurityException("output validation failed");
- }
- validateOutput(outputValidationStrategyClass.newInstance(), service, serviceOp, data, outParameters);
- }
- //
- serviceRes = new ServiceTunnelResponse(data, outParameters, null);
- serviceRes.setSoapOperation(soapOperation);
- // add accumulated client notifications as side-payload
- IClientNotification[] na = SERVICES.getService(IClientNotificationService.class).getNextNotifications(0);
- serviceRes.setClientNotifications(na);
- return serviceRes;
- }
- finally {
- if (callInspector != null) {
- try {
- callInspector.update();
- }
- catch (Throwable t) {
- LOG.warn(null, t);
- }
- try {
- callInspector.close(serviceRes);
- }
- catch (Throwable t) {
- LOG.warn(null, t);
- }
- try {
- callInspector.getSessionInspector().update();
- }
- catch (Throwable t) {
- LOG.warn(null, t);
- }
- }
- WebClientState.setWebClientInCurrentThread(backupIsWebClientCurrentThread);
- }
- }
-
- /**
- * Check pass 1 on type
- */
- protected void checkRemoteServiceAccessByInterface(Class<?> interfaceClass, Method interfaceMethod, Object[] args) {
- //check: must be an interface
- if (!interfaceClass.isInterface()) {
- throw new SecurityException("access denied (code 1a).");
- }
- //check: must be a subclass of IService
- if (!IService.class.isAssignableFrom(interfaceClass)) {
- throw new SecurityException("access denied (code 1b).");
- }
- //check: method is defined on service interface itself
- Method verifyMethod;
- try {
- verifyMethod = interfaceClass.getMethod(interfaceMethod.getName(), interfaceMethod.getParameterTypes());
- }
- catch (Throwable t) {
- throw new SecurityException("access denied (code 1c).");
- }
- //exists
- if (verifyMethod.getDeclaringClass() == IService.class || verifyMethod.getDeclaringClass() == IService2.class) {
- throw new SecurityException("access denied (code 1d).");
- }
- //continue
- }
-
- /**
- * Check pass 2 on instance
- */
- protected void checkRemoteServiceAccessByAnnotations(Class<?> interfaceClass, Class<?> implClass, Method interfaceMethod, Object[] args) {
- //check: grant/deny annotation (type level is base, method level is finegrained)
- Class<?> c = implClass;
- while (c != null) {
- //method level
- Method m = null;
- try {
- m = c.getMethod(interfaceMethod.getName(), interfaceMethod.getParameterTypes());
- }
- catch (Throwable t) {
- //nop
- }
- if (m != null) {
- for (Annotation ann : m.getAnnotations()) {
- //legacy
- if (ann.annotationType() == ServiceTunnelAccessDenied.class) {
- throw new SecurityException("access denied (code 2a).");
- }
- if (ann.annotationType() == RemoteServiceAccessDenied.class) {
- throw new SecurityException("access denied (code 2b).");
- }
- }
- }
- //type level
- for (Annotation ann : c.getAnnotations()) {
- if (ann.annotationType() == RemoteServiceAccessDenied.class) {
- throw new SecurityException("access denied (code 2c).");
- }
- }
- //next
- if (c == interfaceClass) {
- break;
- }
- c = c.getSuperclass();
- if (c == Object.class) {
- //use interface at last
- c = interfaceClass;
- }
- }
- //continue
- }
-
- /**
- * Check pass 3 {@link RemoteServiceAccessPermission} if a client (gui) is allowed to call this service from remote
- * using a
- * remote service proxy.
- * <p>
- * Deny access by default.
- * <p>
- * Accepts when a {@link RemoteServiceAccessPermission} was implied.
- */
- protected void checkRemoteServiceAccessByPermission(Class<?> interfaceClass, Class<?> implClass, Method interfaceMethod, Object[] args) {
- if (ACCESS.check(new RemoteServiceAccessPermission(interfaceClass.getName(), interfaceMethod.getName()))) {
- return;
- }
- throw new SecurityException("access denied (code 3a).");
- }
-
- /**
- * Validate inbound data.Called by {@link #invokeImpl(ServiceTunnelRequest)}.
- * <p>
- * For default handling use
- *
- * <pre>
- * new {@link DefaultValidator#DefaultValidator(IValidationStrategy)}.validate()
- * </pre>
- * <p>
- * Override this method to do central input validation inside the transaction context.
- * <p>
- * This method is part of the protected api and can be overridden.
- *
- * @param validationStrategy
- * may be null, add corresponding null handling.
- */
- protected void validateInput(IValidationStrategy validationStrategy, Object service, Method op, Object[] args) throws Exception {
- //defaultValidateInput(validationStrategy, service, op, args);
- }
-
- protected void defaultValidateInput(IValidationStrategy validationStrategy, Object service, Method op, Object[] args) throws Exception {
- new DefaultValidator(validationStrategy).validateMethodCall(op, args);
- }
-
- /**
- * Validate outbound data. Default does nothing. Called by {@link #invokeImpl(ServiceTunnelRequest)}.
- * Override this method to do central output validation inside the transaction context.
- * <p>
- * This method is part of the protected api and can be overridden.
- */
- protected void validateOutput(IValidationStrategy validationStrategy, Object service, Method op, Object returnValue, Object[] outArgs) throws Exception {
- //defaultValidateOutput(validationStrategy, service, op, returnValue, outArgs);
- }
-
- protected void defaultValidateOutput(IValidationStrategy validationStrategy, Object service, Method op, Object returnValue, Object[] outArgs) throws Exception {
- if ((outArgs != null && outArgs.length > 0) || returnValue != null) {
- DefaultValidator v = new DefaultValidator(validationStrategy);
- if (outArgs != null && outArgs.length > 0) {
- for (Object arg : outArgs) {
- v.validateParameter(arg, null);
- }
- }
- if (returnValue != null) {
- v.validateParameter(returnValue, null);
- }
- }
- }
-
- /**
- * Pass 1 tries to find a {@link InputValidation} annotation
- */
- protected Class<? extends IValidationStrategy> findInputValidationStrategyByAnnotation(Object serviceImpl, Method op) {
- Class<?> c = serviceImpl.getClass();
- while (c != null) {
- //method level
- Method m = null;
- try {
- m = c.getMethod(op.getName(), op.getParameterTypes());
- }
- catch (Throwable t) {
- //nop
- }
- if (m != null) {
- InputValidation ann = m.getAnnotation(InputValidation.class);
- if (ann != null) {
- return ann.value();
- }
- }
- //type level
- InputValidation ann = c.getAnnotation(InputValidation.class);
- if (ann != null) {
- return ann.value();
- }
- //next
- if (c == op.getDeclaringClass()) {
- break;
- }
- c = c.getSuperclass();
- if (c == Object.class) {
- //use interface at last
- c = op.getDeclaringClass();
- }
- }
- //continue
- return null;
- }
-
- /**
- * Pass 2 decides the strategy by java bean, collections framework and business process naming
- *
- * <pre>
- * <i>Java bean naming</i>
- * {@link IValidationStrategy.QUERY}: get*, is*
- * {@link IValidationStrategy.PROCESS}: set*
- * <p/>
- * <i>Collections framework naming</i>
- * {@link IValidationStrategy.QUERY}: get*
- * {@link IValidationStrategy.PROCESS}: put*, add*, remove*
- * <p/>
- * <i>Business process naming</i>
- * {@link IValidationStrategy.QUERY}: load*, read*, find*, has*, select*
- * {@link IValidationStrategy.PROCESS}: store*, write*, create*, insert*, update*, delete*
- * </pre>
- */
- protected Class<? extends IValidationStrategy> findInputValidationStrategyByPolicy(Object serviceImpl, Method op) {
- if (DEFAULT_QUERY_NAMES_PATTERN.matcher(op.getName()).matches()) {
- return IValidationStrategy.QUERY.class;
- }
- if (DEFAULT_PROCESS_NAMES_PATTERN.matcher(op.getName()).matches()) {
- return IValidationStrategy.PROCESS.class;
- }
- //
- warnMissingInputValidation(serviceImpl, op);
- return IValidationStrategy.QUERY.class;
- }
-
- protected void warnMissingInputValidation(Object serviceImpl, Method op) {
- LOG.warn("Legacy security hint for: " + op.getDeclaringClass().getName() + "#" + op.getName() + ": missing either annotation " + InputValidation.class.getSimpleName() + " or override of server-side" + getClass().getSimpleName() + "#findInputValidationStrategyByPolicy. To support legacy the QUERY strategy is used.");
- }
-
- /**
- * Pass 1 tries to find a {@link OutputValidation} annotation
- */
- protected Class<? extends IValidationStrategy> findOutputValidationStrategyByAnnotation(Object serviceImpl, Method op) {
- Class<?> c = serviceImpl.getClass();
- while (c != null) {
- //method level
- Method m = null;
- try {
- m = c.getMethod(op.getName(), op.getParameterTypes());
- }
- catch (Throwable t) {
- //nop
- }
- if (m != null) {
- OutputValidation ann = m.getAnnotation(OutputValidation.class);
- if (ann != null) {
- return ann.value();
- }
- }
- //type level
- OutputValidation ann = c.getAnnotation(OutputValidation.class);
- if (ann != null) {
- return ann.value();
- }
- //next
- if (c == op.getDeclaringClass()) {
- break;
- }
- c = c.getSuperclass();
- if (c == Object.class) {
- //use interface at last
- c = op.getDeclaringClass();
- }
- }
- //continue
- return null;
- }
-
- /**
- * Pass 2 decides the strategy by policy (custom override recommended)
- * <p>
- * Default does no checks
- */
- protected Class<? extends IValidationStrategy> findOutputValidationStrategyByPolicy(Object serviceImpl, Method op) {
- return IValidationStrategy.NO_CHECK.class;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.util.Date;
+import java.util.regex.Pattern;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.exception.VetoException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.server.admin.inspector.CallInspector;
+import org.eclipse.scout.rt.server.admin.inspector.ProcessInspector;
+import org.eclipse.scout.rt.server.admin.inspector.SessionInspector;
+import org.eclipse.scout.rt.server.internal.Activator;
+import org.eclipse.scout.rt.server.services.common.clientnotification.IClientNotificationService;
+import org.eclipse.scout.rt.server.transaction.ITransaction;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.WebClientState;
+import org.eclipse.scout.rt.shared.security.RemoteServiceAccessPermission;
+import org.eclipse.scout.rt.shared.services.common.clientnotification.IClientNotification;
+import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
+import org.eclipse.scout.rt.shared.services.common.security.ACCESS;
+import org.eclipse.scout.rt.shared.servicetunnel.RemoteServiceAccessDenied;
+import org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelAccessDenied;
+import org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelRequest;
+import org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelResponse;
+import org.eclipse.scout.rt.shared.servicetunnel.VersionMismatchException;
+import org.eclipse.scout.rt.shared.validate.DefaultValidator;
+import org.eclipse.scout.rt.shared.validate.IValidationStrategy;
+import org.eclipse.scout.rt.shared.validate.InputValidation;
+import org.eclipse.scout.rt.shared.validate.OutputValidation;
+import org.eclipse.scout.service.IService;
+import org.eclipse.scout.service.IService2;
+import org.eclipse.scout.service.SERVICES;
+import org.eclipse.scout.service.ServiceUtility;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.Version;
+
+/**
+ * Delegate for scout dynamic business op invocation
+ * <p>
+ * Subclass this type to change/add validation checks or call {@link #setValidateInput(true)} to activate them.
+ * <p>
+ * Override {@link #validateInput(IValidationStrategy, Object, Method, Object[])} and/or
+ * {@link #validateOutput(IValidationStrategy, Object, Method, Object, Object[])} to modifiy the default central
+ * validation. You may use {@link #defaultValidateInput(IValidationStrategy, Object, Method, Object[])} and
+ * {@link #defaultValidateOutput(IValidationStrategy, Object, Method, Object, Object[])}
+ * <p>
+ * Set the config.ini properties to activate default validation:
+ *
+ * <pre>
+ * org.eclipse.scout.rt.server.validateInput=true
+ * org.eclipse.scout.rt.server.validateOutput=false
+ * </pre>
+ */
+@SuppressWarnings("deprecation")
+public class DefaultTransactionDelegate {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(DefaultTransactionDelegate.class);
+ private static final Boolean VALIDATE_INPUT = "true".equals(Activator.getDefault().getBundle().getBundleContext().getProperty("org.eclipse.scout.rt.server.validateInput"));
+ private static final Boolean VALIDATE_OUTPUT = "true".equals(Activator.getDefault().getBundle().getBundleContext().getProperty("org.eclipse.scout.rt.server.validateOutput"));
+
+ public static final Pattern DEFAULT_QUERY_NAMES_PATTERN = Pattern.compile("(get|is|has|load|read|find|select)([A-Z].*)?");
+ public static final Pattern DEFAULT_PROCESS_NAMES_PATTERN = Pattern.compile("(set|put|add|remove|store|write|create|insert|update|delete)([A-Z].*)?");
+
+ private final Version m_requestMinVersion;
+ private final boolean m_debug;
+ private final Bundle[] m_loaderBundles;
+ private long m_requestStart;
+ private long m_requestEnd;
+
+ public DefaultTransactionDelegate(Bundle[] loaderBundles, Version requestMinVersion, boolean debug) {
+ m_loaderBundles = loaderBundles;
+ m_requestMinVersion = requestMinVersion;
+ m_debug = debug;
+ }
+
+ public ServiceTunnelResponse invoke(ServiceTunnelRequest serviceReq) throws Exception {
+ ServiceTunnelResponse response;
+ m_requestStart = System.nanoTime();
+ try {
+ response = invokeImpl(serviceReq);
+ }
+ catch (Throwable t) {
+ ITransaction transaction = ThreadContext.getTransaction();
+ try {
+ // cancel tx
+ if (transaction != null) {
+ transaction.addFailure(t);
+ }
+ }
+ catch (Throwable ignore) {
+ // nop
+ }
+ //log it
+ if (transaction == null || !transaction.isCancelled()) {
+ if (t instanceof ProcessingException) {
+ ((ProcessingException) t).addContextMessage("invoking " + serviceReq.getServiceInterfaceClassName() + ":" + serviceReq.getOperation());
+ SERVICES.getService(IExceptionHandlerService.class).handleException((ProcessingException) t);
+ }
+ else {
+ LOG.error("invoking " + serviceReq.getServiceInterfaceClassName() + ":" + serviceReq.getOperation(), t);
+ }
+ }
+ Throwable p = replaceOutboundException(t);
+ response = new ServiceTunnelResponse(null, null, p);
+ }
+ finally {
+ if (m_debug) {
+ LOG.debug("TIME " + serviceReq.getServiceInterfaceClassName() + "." + serviceReq.getOperation() + " " + (m_requestEnd - m_requestStart) / 1000000L + "ms");
+ }
+ }
+ m_requestEnd = System.nanoTime();
+ response.setProcessingDuration((m_requestEnd - m_requestStart) / 1000000L);
+ return response;
+ }
+
+ /**
+ * security: do not send back original error and stack trace with details
+ * <p>
+ * default returns an empty exception or in case of a {@link VetoException} only its title, message, error code and
+ * severity
+ */
+ protected Throwable replaceOutboundException(Throwable t) {
+ Throwable p;
+ if (t instanceof VetoException) {
+ VetoException ve = (VetoException) t;
+ p = new VetoException(ve.getStatus().getTitle(), ve.getMessage(), ve.getStatus().getCode(), ve.getStatus().getSeverity());
+ }
+ else {
+ p = new ProcessingException(ScoutTexts.get("RequestProblem"));
+ }
+ p.setStackTrace(new StackTraceElement[0]);
+ return p;
+ }
+
+ /**
+ * This method is executed within a {@link IServerSession} context using a {@link ServerJob}
+ */
+ protected ServiceTunnelResponse invokeImpl(ServiceTunnelRequest serviceReq) throws Throwable {
+ String soapOperation = ServiceTunnelRequest.toSoapOperation(serviceReq.getServiceInterfaceClassName(), serviceReq.getOperation());
+ IServerSession serverSession = ThreadContext.getServerSession();
+ String authenticatedUser = serverSession.getUserId();
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("started " + serviceReq.getServiceInterfaceClassName() + "." + serviceReq.getOperation() + " by " + authenticatedUser + " at " + new Date());
+ }
+ // version check of request
+ if (m_requestMinVersion != null) {
+ String v = serviceReq.getVersion();
+ if (v == null) {
+ v = "0.0.0";
+ }
+ Version requestVersion = Version.parseVersion(v);
+ if (requestVersion.compareTo(m_requestMinVersion) < 0) {
+ ServiceTunnelResponse serviceRes = new ServiceTunnelResponse(null, null, new VersionMismatchException(requestVersion.toString(), m_requestMinVersion.toString()));
+ return serviceRes;
+ }
+ }
+ CallInspector callInspector = null;
+ SessionInspector sessionInspector = ProcessInspector.getDefault().getSessionInspector(serverSession, true);
+ if (sessionInspector != null) {
+ callInspector = sessionInspector.requestCallInspector(serviceReq);
+ }
+ ServiceTunnelResponse serviceRes = null;
+ boolean backupIsWebClientCurrentThread = WebClientState.isWebClientInCurrentThread();
+ try {
+ String virtualSessionId = serviceReq.getVirtualSessionId();
+ WebClientState.setWebClientInCurrentThread(virtualSessionId != null);
+ //do checks
+ Class<?> serviceInterfaceClass = null;
+ for (Bundle b : m_loaderBundles) {
+ try {
+ serviceInterfaceClass = b.loadClass(serviceReq.getServiceInterfaceClassName());
+ break;
+ }
+ catch (ClassNotFoundException e) {
+ // nop
+ }
+ }
+ //check access: existence
+ if (serviceInterfaceClass == null) {
+ throw new ClassNotFoundException(serviceReq.getServiceInterfaceClassName());
+ }
+ //check access: service proxy allowed
+ Method serviceOp = ServiceUtility.getServiceOperation(serviceInterfaceClass, serviceReq.getOperation(), serviceReq.getParameterTypes());
+ checkRemoteServiceAccessByInterface(serviceInterfaceClass, serviceOp, serviceReq.getArgs());
+ //check access: service impl exists
+ Object service = SERVICES.getService(serviceInterfaceClass);
+ if (service == null) {
+ throw new SecurityException("service registry does not contain a service of type " + serviceReq.getServiceInterfaceClassName());
+ }
+ checkRemoteServiceAccessByAnnotations(serviceInterfaceClass, service.getClass(), serviceOp, serviceReq.getArgs());
+ checkRemoteServiceAccessByPermission(serviceInterfaceClass, service.getClass(), serviceOp, serviceReq.getArgs());
+ //all checks done
+ //
+ //filter input
+ if (serviceReq.getArgs() != null && serviceReq.getArgs().length > 0) {
+ Class<? extends IValidationStrategy> inputValidationStrategyClass = findInputValidationStrategyByAnnotation(service, serviceOp);
+ if (inputValidationStrategyClass == null) {
+ inputValidationStrategyClass = findInputValidationStrategyByPolicy(service, serviceOp);
+ }
+ if (inputValidationStrategyClass == null) {
+ throw new SecurityException("input validation failed (no strategy defined)");
+ }
+ validateInput(inputValidationStrategyClass.newInstance(), service, serviceOp, serviceReq.getArgs());
+ }
+ //
+ Object data = ServiceUtility.invoke(serviceOp, service, serviceReq.getArgs());
+ Object[] outParameters = ServiceUtility.extractHolderArguments(serviceReq.getArgs());
+ //
+ //filter output
+ if (data != null || (outParameters != null && outParameters.length > 0)) {
+ Class<? extends IValidationStrategy> outputValidationStrategyClass = findOutputValidationStrategyByAnnotation(service, serviceOp);
+ if (outputValidationStrategyClass == null) {
+ outputValidationStrategyClass = findOutputValidationStrategyByPolicy(service, serviceOp);
+ }
+ if (outputValidationStrategyClass == null) {
+ throw new SecurityException("output validation failed");
+ }
+ validateOutput(outputValidationStrategyClass.newInstance(), service, serviceOp, data, outParameters);
+ }
+ //
+ serviceRes = new ServiceTunnelResponse(data, outParameters, null);
+ serviceRes.setSoapOperation(soapOperation);
+ // add accumulated client notifications as side-payload
+ IClientNotification[] na = SERVICES.getService(IClientNotificationService.class).getNextNotifications(0);
+ serviceRes.setClientNotifications(na);
+ return serviceRes;
+ }
+ finally {
+ if (callInspector != null) {
+ try {
+ callInspector.update();
+ }
+ catch (Throwable t) {
+ LOG.warn(null, t);
+ }
+ try {
+ callInspector.close(serviceRes);
+ }
+ catch (Throwable t) {
+ LOG.warn(null, t);
+ }
+ try {
+ callInspector.getSessionInspector().update();
+ }
+ catch (Throwable t) {
+ LOG.warn(null, t);
+ }
+ }
+ WebClientState.setWebClientInCurrentThread(backupIsWebClientCurrentThread);
+ }
+ }
+
+ /**
+ * Check pass 1 on type
+ */
+ protected void checkRemoteServiceAccessByInterface(Class<?> interfaceClass, Method interfaceMethod, Object[] args) {
+ //check: must be an interface
+ if (!interfaceClass.isInterface()) {
+ throw new SecurityException("access denied (code 1a).");
+ }
+ //check: must be a subclass of IService
+ if (!IService.class.isAssignableFrom(interfaceClass)) {
+ throw new SecurityException("access denied (code 1b).");
+ }
+ //check: method is defined on service interface itself
+ Method verifyMethod;
+ try {
+ verifyMethod = interfaceClass.getMethod(interfaceMethod.getName(), interfaceMethod.getParameterTypes());
+ }
+ catch (Throwable t) {
+ throw new SecurityException("access denied (code 1c).");
+ }
+ //exists
+ if (verifyMethod.getDeclaringClass() == IService.class || verifyMethod.getDeclaringClass() == IService2.class) {
+ throw new SecurityException("access denied (code 1d).");
+ }
+ //continue
+ }
+
+ /**
+ * Check pass 2 on instance
+ */
+ protected void checkRemoteServiceAccessByAnnotations(Class<?> interfaceClass, Class<?> implClass, Method interfaceMethod, Object[] args) {
+ //check: grant/deny annotation (type level is base, method level is finegrained)
+ Class<?> c = implClass;
+ while (c != null) {
+ //method level
+ Method m = null;
+ try {
+ m = c.getMethod(interfaceMethod.getName(), interfaceMethod.getParameterTypes());
+ }
+ catch (Throwable t) {
+ //nop
+ }
+ if (m != null) {
+ for (Annotation ann : m.getAnnotations()) {
+ //legacy
+ if (ann.annotationType() == ServiceTunnelAccessDenied.class) {
+ throw new SecurityException("access denied (code 2a).");
+ }
+ if (ann.annotationType() == RemoteServiceAccessDenied.class) {
+ throw new SecurityException("access denied (code 2b).");
+ }
+ }
+ }
+ //type level
+ for (Annotation ann : c.getAnnotations()) {
+ if (ann.annotationType() == RemoteServiceAccessDenied.class) {
+ throw new SecurityException("access denied (code 2c).");
+ }
+ }
+ //next
+ if (c == interfaceClass) {
+ break;
+ }
+ c = c.getSuperclass();
+ if (c == Object.class) {
+ //use interface at last
+ c = interfaceClass;
+ }
+ }
+ //continue
+ }
+
+ /**
+ * Check pass 3 {@link RemoteServiceAccessPermission} if a client (gui) is allowed to call this service from remote
+ * using a
+ * remote service proxy.
+ * <p>
+ * Deny access by default.
+ * <p>
+ * Accepts when a {@link RemoteServiceAccessPermission} was implied.
+ */
+ protected void checkRemoteServiceAccessByPermission(Class<?> interfaceClass, Class<?> implClass, Method interfaceMethod, Object[] args) {
+ if (ACCESS.check(new RemoteServiceAccessPermission(interfaceClass.getName(), interfaceMethod.getName()))) {
+ return;
+ }
+ throw new SecurityException("access denied (code 3a).");
+ }
+
+ /**
+ * Validate inbound data.Called by {@link #invokeImpl(ServiceTunnelRequest)}.
+ * <p>
+ * For default handling use
+ *
+ * <pre>
+ * new {@link DefaultValidator#DefaultValidator(IValidationStrategy)}.validate()
+ * </pre>
+ * <p>
+ * Override this method to do central input validation inside the transaction context.
+ * <p>
+ * This method is part of the protected api and can be overridden.
+ *
+ * @param validationStrategy
+ * may be null, add corresponding null handling.
+ */
+ protected void validateInput(IValidationStrategy validationStrategy, Object service, Method op, Object[] args) throws Exception {
+ //defaultValidateInput(validationStrategy, service, op, args);
+ }
+
+ protected void defaultValidateInput(IValidationStrategy validationStrategy, Object service, Method op, Object[] args) throws Exception {
+ new DefaultValidator(validationStrategy).validateMethodCall(op, args);
+ }
+
+ /**
+ * Validate outbound data. Default does nothing. Called by {@link #invokeImpl(ServiceTunnelRequest)}.
+ * Override this method to do central output validation inside the transaction context.
+ * <p>
+ * This method is part of the protected api and can be overridden.
+ */
+ protected void validateOutput(IValidationStrategy validationStrategy, Object service, Method op, Object returnValue, Object[] outArgs) throws Exception {
+ //defaultValidateOutput(validationStrategy, service, op, returnValue, outArgs);
+ }
+
+ protected void defaultValidateOutput(IValidationStrategy validationStrategy, Object service, Method op, Object returnValue, Object[] outArgs) throws Exception {
+ if ((outArgs != null && outArgs.length > 0) || returnValue != null) {
+ DefaultValidator v = new DefaultValidator(validationStrategy);
+ if (outArgs != null && outArgs.length > 0) {
+ for (Object arg : outArgs) {
+ v.validateParameter(arg, null);
+ }
+ }
+ if (returnValue != null) {
+ v.validateParameter(returnValue, null);
+ }
+ }
+ }
+
+ /**
+ * Pass 1 tries to find a {@link InputValidation} annotation
+ */
+ protected Class<? extends IValidationStrategy> findInputValidationStrategyByAnnotation(Object serviceImpl, Method op) {
+ Class<?> c = serviceImpl.getClass();
+ while (c != null) {
+ //method level
+ Method m = null;
+ try {
+ m = c.getMethod(op.getName(), op.getParameterTypes());
+ }
+ catch (Throwable t) {
+ //nop
+ }
+ if (m != null) {
+ InputValidation ann = m.getAnnotation(InputValidation.class);
+ if (ann != null) {
+ return ann.value();
+ }
+ }
+ //type level
+ InputValidation ann = c.getAnnotation(InputValidation.class);
+ if (ann != null) {
+ return ann.value();
+ }
+ //next
+ if (c == op.getDeclaringClass()) {
+ break;
+ }
+ c = c.getSuperclass();
+ if (c == Object.class) {
+ //use interface at last
+ c = op.getDeclaringClass();
+ }
+ }
+ //continue
+ return null;
+ }
+
+ /**
+ * Pass 2 decides the strategy by java bean, collections framework and business process naming
+ *
+ * <pre>
+ * <i>Java bean naming</i>
+ * {@link IValidationStrategy.QUERY}: get*, is*
+ * {@link IValidationStrategy.PROCESS}: set*
+ * <p/>
+ * <i>Collections framework naming</i>
+ * {@link IValidationStrategy.QUERY}: get*
+ * {@link IValidationStrategy.PROCESS}: put*, add*, remove*
+ * <p/>
+ * <i>Business process naming</i>
+ * {@link IValidationStrategy.QUERY}: load*, read*, find*, has*, select*
+ * {@link IValidationStrategy.PROCESS}: store*, write*, create*, insert*, update*, delete*
+ * </pre>
+ */
+ protected Class<? extends IValidationStrategy> findInputValidationStrategyByPolicy(Object serviceImpl, Method op) {
+ if (DEFAULT_QUERY_NAMES_PATTERN.matcher(op.getName()).matches()) {
+ return IValidationStrategy.QUERY.class;
+ }
+ if (DEFAULT_PROCESS_NAMES_PATTERN.matcher(op.getName()).matches()) {
+ return IValidationStrategy.PROCESS.class;
+ }
+ //
+ warnMissingInputValidation(serviceImpl, op);
+ return IValidationStrategy.QUERY.class;
+ }
+
+ protected void warnMissingInputValidation(Object serviceImpl, Method op) {
+ LOG.warn("Legacy security hint for: " + op.getDeclaringClass().getName() + "#" + op.getName() + ": missing either annotation " + InputValidation.class.getSimpleName() + " or override of server-side" + getClass().getSimpleName() + "#findInputValidationStrategyByPolicy. To support legacy the QUERY strategy is used.");
+ }
+
+ /**
+ * Pass 1 tries to find a {@link OutputValidation} annotation
+ */
+ protected Class<? extends IValidationStrategy> findOutputValidationStrategyByAnnotation(Object serviceImpl, Method op) {
+ Class<?> c = serviceImpl.getClass();
+ while (c != null) {
+ //method level
+ Method m = null;
+ try {
+ m = c.getMethod(op.getName(), op.getParameterTypes());
+ }
+ catch (Throwable t) {
+ //nop
+ }
+ if (m != null) {
+ OutputValidation ann = m.getAnnotation(OutputValidation.class);
+ if (ann != null) {
+ return ann.value();
+ }
+ }
+ //type level
+ OutputValidation ann = c.getAnnotation(OutputValidation.class);
+ if (ann != null) {
+ return ann.value();
+ }
+ //next
+ if (c == op.getDeclaringClass()) {
+ break;
+ }
+ c = c.getSuperclass();
+ if (c == Object.class) {
+ //use interface at last
+ c = op.getDeclaringClass();
+ }
+ }
+ //continue
+ return null;
+ }
+
+ /**
+ * Pass 2 decides the strategy by policy (custom override recommended)
+ * <p>
+ * Default does no checks
+ */
+ protected Class<? extends IValidationStrategy> findOutputValidationStrategyByPolicy(Object serviceImpl, Method op) {
+ return IValidationStrategy.NO_CHECK.class;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/IServerSession.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/IServerSession.java
index 3f706bfd70..e190e803df 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/IServerSession.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/IServerSession.java
@@ -1,45 +1,45 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.shared.ISession;
-import org.osgi.framework.Bundle;
-
-/**
- * The base implementation {@link org.eclipse.scout.rt.server.servlet.DeploymentServiceConfig} uses the
- * scout.xml file for setting deployment specific service properties
- */
-public interface IServerSession extends ISession {
-
- void loadSession(Bundle bundle) throws ProcessingException;
-
- /**
- * @deprecated Use {@link #getData(String)} instead.<br/>
- * Will be removed in 3.9.0
- */
- @Deprecated
- Object getAttribute(String key);
-
- /**
- * @deprecated Use {@link #setData(String, Object)} isntead.<br/>
- * Will be removed in 3.9.0
- */
- @Deprecated
- void setAttribute(String key, Object value);
-
- /**
- * @deprecated Use {@link #isSingleThreadSession()} instead.<br/>
- * Will be removed in 3.9.0
- */
- @Deprecated
- boolean isWebSession();
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.shared.ISession;
+import org.osgi.framework.Bundle;
+
+/**
+ * The base implementation {@link org.eclipse.scout.rt.server.servlet.DeploymentServiceConfig} uses the
+ * scout.xml file for setting deployment specific service properties
+ */
+public interface IServerSession extends ISession {
+
+ void loadSession(Bundle bundle) throws ProcessingException;
+
+ /**
+ * @deprecated Use {@link #getData(String)} instead.<br/>
+ * Will be removed in 3.9.0
+ */
+ @Deprecated
+ Object getAttribute(String key);
+
+ /**
+ * @deprecated Use {@link #setData(String, Object)} isntead.<br/>
+ * Will be removed in 3.9.0
+ */
+ @Deprecated
+ void setAttribute(String key, Object value);
+
+ /**
+ * @deprecated Use {@link #isSingleThreadSession()} instead.<br/>
+ * Will be removed in 3.9.0
+ */
+ @Deprecated
+ boolean isWebSession();
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/IServerSessionProvider.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/IServerSessionProvider.java
index 5dd2250052..5a520405bd 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/IServerSessionProvider.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/IServerSessionProvider.java
@@ -1,17 +1,17 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server;
-
-public interface IServerSessionProvider {
-
- IServerSession getServerSession();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server;
+
+public interface IServerSessionProvider {
+
+ IServerSession getServerSession();
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/RemoteFileServlet.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/RemoteFileServlet.java
index 34c5f2a599..8b57904f96 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/RemoteFileServlet.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/RemoteFileServlet.java
@@ -1,191 +1,191 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server;
-
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.http.servletfilter.HttpServletEx;
-import org.eclipse.scout.rt.shared.services.common.file.IRemoteFileService;
-import org.eclipse.scout.rt.shared.services.common.file.RemoteFile;
-import org.eclipse.scout.service.SERVICES;
-
-/**
- * Servlet facade to provide remote files in web context<br>
- * <p>
- * Init parameters:<br>
- * folder: folder inside external file location
- */
-public class RemoteFileServlet extends HttpServletEx {
- private static final long serialVersionUID = 1L;
-
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(RemoteFileServlet.class);
- private static final String LAST_MODIFIED = "Last-Modified"; //$NON-NLS-1$
- private static final String IF_MODIFIED_SINCE = "If-Modified-Since"; //$NON-NLS-1$
- private static final String IF_NONE_MATCH = "If-None-Match"; //$NON-NLS-1$
- private static final String ETAG = "ETag"; //$NON-NLS-1$
-
- private String m_folder = ""; //$NON-NLS-1$
-
- public RemoteFileServlet() {
- }
-
- @Override
- public void init(ServletConfig config) throws ServletException {
- super.init(config);
- String f = config.getInitParameter("folder"); //$NON-NLS-1$
- if (f != null) {
- f = f.replaceAll("\\\\", "/"); //$NON-NLS-1$
- while (f.startsWith("/"))
- {
- f = f.substring(1); //$NON-NLS-1$
- }
- while (f.endsWith("/"))
- {
- f = f.substring(0, f.lastIndexOf('/')); //$NON-NLS-1$
- }
- m_folder = '/' + f;
- }
- }
-
- @Override
- protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
- handleHttpRequest(req, res);
- }
-
- @Override
- protected void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
- handleHttpRequest(req, res);
- }
-
- protected void handleHttpRequest(final HttpServletRequest req, final HttpServletResponse res) throws ServletException, IOException {
- String pathInfo = req.getPathInfo();
-
- // will try to get all files in fileList.
- List<String> fileList = Arrays.asList(pathInfo);
-
- // @rn aho, 15.7.2008: iff a directory is requested (e.g. root directory
- // "/") then try index.*-files.
- if (StringUtility.isNullOrEmpty(pathInfo) || pathInfo.replaceAll("\\\\", "/").endsWith("/")) { //$NON-NLS-1$ //$NON-NLS-2$
- String prefix = "/"; //$NON-NLS-1$
- if (pathInfo != null && pathInfo.replaceAll("\\\\", "/").endsWith("/"))
- {
- prefix = pathInfo.replaceAll("\\\\", "/"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- }
- fileList = Arrays.asList(
- prefix + "index.html", //$NON-NLS-1$
- prefix + "index.htm", //$NON-NLS-1$
- prefix + "default.html", //$NON-NLS-1$
- prefix + "default.htm", //$NON-NLS-1$
- prefix + "index.jsp", //$NON-NLS-1$
- prefix + "index.php" //$NON-NLS-1$
- );
- }
- //
- try {
- final List<String> fileListParam = fileList;
- Iterator<String> pathIter = fileListParam.iterator();
- boolean success = false;
- while (!success && pathIter.hasNext()) {
- success = writeResource(req, res, pathIter.next());
- }
- if (!success) {
- res.sendError(HttpServletResponse.SC_NOT_FOUND, pathInfo);
- }
- }
- catch (Exception ex) {
- if (("" + ex.toString()).indexOf("Connection reset by peer: socket write error") >= 0) {
- // ignore it
- }
- else {
- LOG.warn("Failed to get remotefile " + pathInfo + ".", ex);
- // cannot sendError(..) here, since OutputStream maybe is already
- // committed.
- res.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
- }
- }
- }
-
- private boolean writeResource(final HttpServletRequest req, final HttpServletResponse resp, final String resourcePath) throws ProcessingException, IOException {
- IRemoteFileService rfs = SERVICES.getService(IRemoteFileService.class);
- RemoteFile spec = new RemoteFile((resourcePath == null) ? null : m_folder + resourcePath, -1);
- RemoteFile remoteFile = rfs.getRemoteFileHeader(spec);
- if (!remoteFile.exists()) {
- return false;
- }
-
- long lastModified = remoteFile.getLastModified();
- int contentLength = remoteFile.getContentLength();
- if (setResponseParameters(req, resp, resourcePath, remoteFile.getContentType(), lastModified, contentLength) == HttpServletResponse.SC_NOT_MODIFIED) {
- return true;
- }
- rfs.streamRemoteFile(remoteFile, resp.getOutputStream());
- return true;
- }
-
- protected int setResponseParameters(final HttpServletRequest req, final HttpServletResponse resp, final String resourcePath, String contentType, long lastModified, int contentLength) {
- String etag = null;
- if (lastModified != -1 && contentLength != -1)
- {
- etag = "W/\"" + contentLength + "-" + lastModified + "\""; //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
- }
-
- // Check for cache revalidation.
- // We should prefer ETag validation as the guarantees are stronger and all
- // HTTP 1.1 clients should be using it
- String ifNoneMatch = req.getHeader(IF_NONE_MATCH);
- if (ifNoneMatch != null && etag != null && ifNoneMatch.indexOf(etag) != -1) {
- resp.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
- return HttpServletResponse.SC_NOT_MODIFIED;
- }
- else {
- long ifModifiedSince = req.getDateHeader(IF_MODIFIED_SINCE);
- // for purposes of comparison we add 999 to ifModifiedSince since the
- // fidelity
- // of the IMS header generally doesn't include milli-seconds
- if (ifModifiedSince > -1 && lastModified > 0 && lastModified <= (ifModifiedSince + 999)) {
- resp.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
- return HttpServletResponse.SC_NOT_MODIFIED;
- }
- }
-
- // return the full contents regularly
- if (contentLength != -1) {
- resp.setContentLength(contentLength);
- }
-
- if (contentType != null) {
- resp.setContentType(contentType);
- }
-
- if (lastModified > 0) {
- resp.setDateHeader(LAST_MODIFIED, lastModified);
- }
-
- if (etag != null) {
- resp.setHeader(ETAG, etag);
- }
-
- return HttpServletResponse.SC_ACCEPTED;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.http.servletfilter.HttpServletEx;
+import org.eclipse.scout.rt.shared.services.common.file.IRemoteFileService;
+import org.eclipse.scout.rt.shared.services.common.file.RemoteFile;
+import org.eclipse.scout.service.SERVICES;
+
+/**
+ * Servlet facade to provide remote files in web context<br>
+ * <p>
+ * Init parameters:<br>
+ * folder: folder inside external file location
+ */
+public class RemoteFileServlet extends HttpServletEx {
+ private static final long serialVersionUID = 1L;
+
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(RemoteFileServlet.class);
+ private static final String LAST_MODIFIED = "Last-Modified"; //$NON-NLS-1$
+ private static final String IF_MODIFIED_SINCE = "If-Modified-Since"; //$NON-NLS-1$
+ private static final String IF_NONE_MATCH = "If-None-Match"; //$NON-NLS-1$
+ private static final String ETAG = "ETag"; //$NON-NLS-1$
+
+ private String m_folder = ""; //$NON-NLS-1$
+
+ public RemoteFileServlet() {
+ }
+
+ @Override
+ public void init(ServletConfig config) throws ServletException {
+ super.init(config);
+ String f = config.getInitParameter("folder"); //$NON-NLS-1$
+ if (f != null) {
+ f = f.replaceAll("\\\\", "/"); //$NON-NLS-1$
+ while (f.startsWith("/"))
+ {
+ f = f.substring(1); //$NON-NLS-1$
+ }
+ while (f.endsWith("/"))
+ {
+ f = f.substring(0, f.lastIndexOf('/')); //$NON-NLS-1$
+ }
+ m_folder = '/' + f;
+ }
+ }
+
+ @Override
+ protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
+ handleHttpRequest(req, res);
+ }
+
+ @Override
+ protected void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
+ handleHttpRequest(req, res);
+ }
+
+ protected void handleHttpRequest(final HttpServletRequest req, final HttpServletResponse res) throws ServletException, IOException {
+ String pathInfo = req.getPathInfo();
+
+ // will try to get all files in fileList.
+ List<String> fileList = Arrays.asList(pathInfo);
+
+ // @rn aho, 15.7.2008: iff a directory is requested (e.g. root directory
+ // "/") then try index.*-files.
+ if (StringUtility.isNullOrEmpty(pathInfo) || pathInfo.replaceAll("\\\\", "/").endsWith("/")) { //$NON-NLS-1$ //$NON-NLS-2$
+ String prefix = "/"; //$NON-NLS-1$
+ if (pathInfo != null && pathInfo.replaceAll("\\\\", "/").endsWith("/"))
+ {
+ prefix = pathInfo.replaceAll("\\\\", "/"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ }
+ fileList = Arrays.asList(
+ prefix + "index.html", //$NON-NLS-1$
+ prefix + "index.htm", //$NON-NLS-1$
+ prefix + "default.html", //$NON-NLS-1$
+ prefix + "default.htm", //$NON-NLS-1$
+ prefix + "index.jsp", //$NON-NLS-1$
+ prefix + "index.php" //$NON-NLS-1$
+ );
+ }
+ //
+ try {
+ final List<String> fileListParam = fileList;
+ Iterator<String> pathIter = fileListParam.iterator();
+ boolean success = false;
+ while (!success && pathIter.hasNext()) {
+ success = writeResource(req, res, pathIter.next());
+ }
+ if (!success) {
+ res.sendError(HttpServletResponse.SC_NOT_FOUND, pathInfo);
+ }
+ }
+ catch (Exception ex) {
+ if (("" + ex.toString()).indexOf("Connection reset by peer: socket write error") >= 0) {
+ // ignore it
+ }
+ else {
+ LOG.warn("Failed to get remotefile " + pathInfo + ".", ex);
+ // cannot sendError(..) here, since OutputStream maybe is already
+ // committed.
+ res.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ }
+ }
+ }
+
+ private boolean writeResource(final HttpServletRequest req, final HttpServletResponse resp, final String resourcePath) throws ProcessingException, IOException {
+ IRemoteFileService rfs = SERVICES.getService(IRemoteFileService.class);
+ RemoteFile spec = new RemoteFile((resourcePath == null) ? null : m_folder + resourcePath, -1);
+ RemoteFile remoteFile = rfs.getRemoteFileHeader(spec);
+ if (!remoteFile.exists()) {
+ return false;
+ }
+
+ long lastModified = remoteFile.getLastModified();
+ int contentLength = remoteFile.getContentLength();
+ if (setResponseParameters(req, resp, resourcePath, remoteFile.getContentType(), lastModified, contentLength) == HttpServletResponse.SC_NOT_MODIFIED) {
+ return true;
+ }
+ rfs.streamRemoteFile(remoteFile, resp.getOutputStream());
+ return true;
+ }
+
+ protected int setResponseParameters(final HttpServletRequest req, final HttpServletResponse resp, final String resourcePath, String contentType, long lastModified, int contentLength) {
+ String etag = null;
+ if (lastModified != -1 && contentLength != -1)
+ {
+ etag = "W/\"" + contentLength + "-" + lastModified + "\""; //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
+ }
+
+ // Check for cache revalidation.
+ // We should prefer ETag validation as the guarantees are stronger and all
+ // HTTP 1.1 clients should be using it
+ String ifNoneMatch = req.getHeader(IF_NONE_MATCH);
+ if (ifNoneMatch != null && etag != null && ifNoneMatch.indexOf(etag) != -1) {
+ resp.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
+ return HttpServletResponse.SC_NOT_MODIFIED;
+ }
+ else {
+ long ifModifiedSince = req.getDateHeader(IF_MODIFIED_SINCE);
+ // for purposes of comparison we add 999 to ifModifiedSince since the
+ // fidelity
+ // of the IMS header generally doesn't include milli-seconds
+ if (ifModifiedSince > -1 && lastModified > 0 && lastModified <= (ifModifiedSince + 999)) {
+ resp.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
+ return HttpServletResponse.SC_NOT_MODIFIED;
+ }
+ }
+
+ // return the full contents regularly
+ if (contentLength != -1) {
+ resp.setContentLength(contentLength);
+ }
+
+ if (contentType != null) {
+ resp.setContentType(contentType);
+ }
+
+ if (lastModified > 0) {
+ resp.setDateHeader(LAST_MODIFIED, lastModified);
+ }
+
+ if (etag != null) {
+ resp.setHeader(ETAG, etag);
+ }
+
+ return HttpServletResponse.SC_ACCEPTED;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/ResourceServlet.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/ResourceServlet.java
index b4fed39d06..ee8d2e1b97 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/ResourceServlet.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/ResourceServlet.java
@@ -1,228 +1,228 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.URL;
-import java.net.URLConnection;
-
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.scout.commons.FileUtility;
-import org.eclipse.scout.http.servletfilter.HttpServletEx;
-import org.osgi.framework.Bundle;
-
-/**
- * Init parameters for WAR resources<br>
- * war-path: Path to resource within war file. Normally starting with /WEB-INF
- * <p>
- * Init parameters for osgi bundle resources<br>
- * bundle-name: symbolic name of bundle with resources<br>
- * bundle-path: Path to resource within bundle. Normally starting with /resources
- * <p>
- * Legacy parameters<br>
- * base-name: same as war-path
- */
-public class ResourceServlet extends HttpServletEx {
-
- private static final long serialVersionUID = 1L;
- private static final String LAST_MODIFIED = "Last-Modified"; //$NON-NLS-1$
- private static final String IF_MODIFIED_SINCE = "If-Modified-Since"; //$NON-NLS-1$
- private static final String IF_NONE_MATCH = "If-None-Match"; //$NON-NLS-1$
- private static final String ETAG = "ETag"; //$NON-NLS-1$
-
- private String m_warPath;
- private String m_bundleName;
- private String m_bundlePath;
-
- public ResourceServlet() {
- }
-
- public ResourceServlet(String internalName) {
- }
-
- @Override
- public void init(ServletConfig config) throws ServletException {
- super.init(config);
- m_warPath = config.getInitParameter("base-name"); //$NON-NLS-1$, legacy
- if (m_warPath == null) {
- m_warPath = config.getInitParameter("war-path"); //$NON-NLS-1$
- }
- if (m_warPath == null || m_warPath.trim().length() == 0) {
- m_warPath = null;
- }
- if (m_warPath != null && m_warPath.endsWith("/")) {
- m_warPath = m_warPath.substring(0, m_warPath.length() - 1);
- }
- //
- m_bundleName = config.getInitParameter("bundle-name"); //$NON-NLS-1$
- if (m_bundleName == null || m_bundleName.trim().length() == 0) {
- m_bundleName = null;
- }
- //
- m_bundlePath = config.getInitParameter("bundle-path"); //$NON-NLS-1$
- if (m_bundlePath == null || m_bundlePath.trim().length() == 0) {
- m_bundlePath = null;
- }
- if (m_bundlePath != null && m_bundlePath.endsWith("/")) {
- m_bundlePath = m_bundlePath.substring(0, m_bundlePath.length() - 1);
- }
- //
- // check config
- if (m_warPath != null) {
- // ok
- }
- else if (m_bundleName != null && m_bundlePath != null) {
- // ok
- }
- else {
- throw new ServletException("Missing init parameters. Set either 'war-path' or 'bundle-name','bundle-path'");
- }
- }
-
- @Override
- protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
- Path p = new Path(req.getRequestURI());
- String lastSegment = p.lastSegment();
- if ((lastSegment != null && lastSegment.contains(".")) || req.getRequestURI().endsWith("/")) {
- if (!writeStaticResource(req, res)) {
- res.setStatus(HttpServletResponse.SC_NOT_FOUND);
- }
- }
- else {
- res.sendRedirect(req.getRequestURI() + "/");
- }
- }
-
- @Override
- protected void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
- if (!writeStaticResource(req, res)) {
- res.setStatus(HttpServletResponse.SC_NOT_FOUND);
- }
- }
-
- private boolean writeStaticResource(final HttpServletRequest req, final HttpServletResponse resp) throws IOException {
- String pathInfo = req.getPathInfo();
- if (pathInfo == null || pathInfo.endsWith("/") || pathInfo.equals("")) {
- pathInfo = "/index.html";
- }
- URL url = null;
- String contentType = null;
- if (m_warPath != null) {
- ServletContext servletContext = getServletContext();
- String resourcePath = m_warPath + pathInfo;
- url = servletContext.getResource(resourcePath);
- contentType = servletContext.getMimeType(resourcePath);
- }
- else if (m_bundleName != null && m_bundlePath != null) {
- String resourcePath = m_bundlePath + pathInfo;
- Bundle bundle = Platform.getBundle(m_bundleName);
- if (bundle != null) {
- url = bundle.getResource(resourcePath);
- }
- }
- //
- if (url == null) {
- return false;
- }
- //
- long lastModified;
- int contentLength;
- URLConnection connection = url.openConnection();
- lastModified = connection.getLastModified();
- contentLength = connection.getContentLength();
- if (contentType == null) {
- String[] a = pathInfo.split("[.]");
- contentType = FileUtility.getContentTypeForExtension(a[a.length - 1]);
- }
- InputStream is = null;
- try {
- if (setResponseParameters(req, resp, contentType, lastModified, contentLength) == HttpServletResponse.SC_NOT_MODIFIED) {
- return true;
- }
- is = connection.getInputStream();
- OutputStream os = resp.getOutputStream();
- byte[] buffer = new byte[8192];
- int bytesRead = is.read(buffer);
- int writtenContentLength = 0;
- while (bytesRead != -1) {
- os.write(buffer, 0, bytesRead);
- writtenContentLength += bytesRead;
- bytesRead = is.read(buffer);
- }
- if (contentLength == -1 || contentLength != writtenContentLength) {
- resp.setContentLength(writtenContentLength);
- }
-
- return true;
- }
- finally {
- if (is != null) {
- is.close();
- }
- }
- }
-
- protected int setResponseParameters(final HttpServletRequest req, final HttpServletResponse resp, String contentType, long lastModified, int contentLength) {
- String etag = null;
- if (lastModified != -1 && contentLength != -1)
- {
- etag = "W/\"" + contentLength + "-" + lastModified + "\""; //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
- }
-
- // Check for cache revalidation.
- // We should prefer ETag validation as the guarantees are stronger and all
- // HTTP 1.1 clients should be using it
- String ifNoneMatch = req.getHeader(IF_NONE_MATCH);
- if (ifNoneMatch != null && etag != null && ifNoneMatch.indexOf(etag) != -1) {
- resp.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
- return HttpServletResponse.SC_NOT_MODIFIED;
- }
- else {
- long ifModifiedSince = req.getDateHeader(IF_MODIFIED_SINCE);
- // for purposes of comparison we add 999 to ifModifiedSince since the
- // fidelity
- // of the IMS header generally doesn't include milli-seconds
- if (ifModifiedSince > -1 && lastModified > 0 && lastModified <= (ifModifiedSince + 999)) {
- resp.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
- return HttpServletResponse.SC_NOT_MODIFIED;
- }
- }
-
- // return the full contents regularly
- if (contentLength != -1) {
- resp.setContentLength(contentLength);
- }
-
- if (contentType != null) {
- resp.setContentType(contentType);
- }
-
- if (lastModified > 0) {
- resp.setDateHeader(LAST_MODIFIED, lastModified);
- }
-
- if (etag != null) {
- resp.setHeader(ETAG, etag);
- }
-
- return HttpServletResponse.SC_ACCEPTED;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URL;
+import java.net.URLConnection;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.scout.commons.FileUtility;
+import org.eclipse.scout.http.servletfilter.HttpServletEx;
+import org.osgi.framework.Bundle;
+
+/**
+ * Init parameters for WAR resources<br>
+ * war-path: Path to resource within war file. Normally starting with /WEB-INF
+ * <p>
+ * Init parameters for osgi bundle resources<br>
+ * bundle-name: symbolic name of bundle with resources<br>
+ * bundle-path: Path to resource within bundle. Normally starting with /resources
+ * <p>
+ * Legacy parameters<br>
+ * base-name: same as war-path
+ */
+public class ResourceServlet extends HttpServletEx {
+
+ private static final long serialVersionUID = 1L;
+ private static final String LAST_MODIFIED = "Last-Modified"; //$NON-NLS-1$
+ private static final String IF_MODIFIED_SINCE = "If-Modified-Since"; //$NON-NLS-1$
+ private static final String IF_NONE_MATCH = "If-None-Match"; //$NON-NLS-1$
+ private static final String ETAG = "ETag"; //$NON-NLS-1$
+
+ private String m_warPath;
+ private String m_bundleName;
+ private String m_bundlePath;
+
+ public ResourceServlet() {
+ }
+
+ public ResourceServlet(String internalName) {
+ }
+
+ @Override
+ public void init(ServletConfig config) throws ServletException {
+ super.init(config);
+ m_warPath = config.getInitParameter("base-name"); //$NON-NLS-1$, legacy
+ if (m_warPath == null) {
+ m_warPath = config.getInitParameter("war-path"); //$NON-NLS-1$
+ }
+ if (m_warPath == null || m_warPath.trim().length() == 0) {
+ m_warPath = null;
+ }
+ if (m_warPath != null && m_warPath.endsWith("/")) {
+ m_warPath = m_warPath.substring(0, m_warPath.length() - 1);
+ }
+ //
+ m_bundleName = config.getInitParameter("bundle-name"); //$NON-NLS-1$
+ if (m_bundleName == null || m_bundleName.trim().length() == 0) {
+ m_bundleName = null;
+ }
+ //
+ m_bundlePath = config.getInitParameter("bundle-path"); //$NON-NLS-1$
+ if (m_bundlePath == null || m_bundlePath.trim().length() == 0) {
+ m_bundlePath = null;
+ }
+ if (m_bundlePath != null && m_bundlePath.endsWith("/")) {
+ m_bundlePath = m_bundlePath.substring(0, m_bundlePath.length() - 1);
+ }
+ //
+ // check config
+ if (m_warPath != null) {
+ // ok
+ }
+ else if (m_bundleName != null && m_bundlePath != null) {
+ // ok
+ }
+ else {
+ throw new ServletException("Missing init parameters. Set either 'war-path' or 'bundle-name','bundle-path'");
+ }
+ }
+
+ @Override
+ protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
+ Path p = new Path(req.getRequestURI());
+ String lastSegment = p.lastSegment();
+ if ((lastSegment != null && lastSegment.contains(".")) || req.getRequestURI().endsWith("/")) {
+ if (!writeStaticResource(req, res)) {
+ res.setStatus(HttpServletResponse.SC_NOT_FOUND);
+ }
+ }
+ else {
+ res.sendRedirect(req.getRequestURI() + "/");
+ }
+ }
+
+ @Override
+ protected void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
+ if (!writeStaticResource(req, res)) {
+ res.setStatus(HttpServletResponse.SC_NOT_FOUND);
+ }
+ }
+
+ private boolean writeStaticResource(final HttpServletRequest req, final HttpServletResponse resp) throws IOException {
+ String pathInfo = req.getPathInfo();
+ if (pathInfo == null || pathInfo.endsWith("/") || pathInfo.equals("")) {
+ pathInfo = "/index.html";
+ }
+ URL url = null;
+ String contentType = null;
+ if (m_warPath != null) {
+ ServletContext servletContext = getServletContext();
+ String resourcePath = m_warPath + pathInfo;
+ url = servletContext.getResource(resourcePath);
+ contentType = servletContext.getMimeType(resourcePath);
+ }
+ else if (m_bundleName != null && m_bundlePath != null) {
+ String resourcePath = m_bundlePath + pathInfo;
+ Bundle bundle = Platform.getBundle(m_bundleName);
+ if (bundle != null) {
+ url = bundle.getResource(resourcePath);
+ }
+ }
+ //
+ if (url == null) {
+ return false;
+ }
+ //
+ long lastModified;
+ int contentLength;
+ URLConnection connection = url.openConnection();
+ lastModified = connection.getLastModified();
+ contentLength = connection.getContentLength();
+ if (contentType == null) {
+ String[] a = pathInfo.split("[.]");
+ contentType = FileUtility.getContentTypeForExtension(a[a.length - 1]);
+ }
+ InputStream is = null;
+ try {
+ if (setResponseParameters(req, resp, contentType, lastModified, contentLength) == HttpServletResponse.SC_NOT_MODIFIED) {
+ return true;
+ }
+ is = connection.getInputStream();
+ OutputStream os = resp.getOutputStream();
+ byte[] buffer = new byte[8192];
+ int bytesRead = is.read(buffer);
+ int writtenContentLength = 0;
+ while (bytesRead != -1) {
+ os.write(buffer, 0, bytesRead);
+ writtenContentLength += bytesRead;
+ bytesRead = is.read(buffer);
+ }
+ if (contentLength == -1 || contentLength != writtenContentLength) {
+ resp.setContentLength(writtenContentLength);
+ }
+
+ return true;
+ }
+ finally {
+ if (is != null) {
+ is.close();
+ }
+ }
+ }
+
+ protected int setResponseParameters(final HttpServletRequest req, final HttpServletResponse resp, String contentType, long lastModified, int contentLength) {
+ String etag = null;
+ if (lastModified != -1 && contentLength != -1)
+ {
+ etag = "W/\"" + contentLength + "-" + lastModified + "\""; //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
+ }
+
+ // Check for cache revalidation.
+ // We should prefer ETag validation as the guarantees are stronger and all
+ // HTTP 1.1 clients should be using it
+ String ifNoneMatch = req.getHeader(IF_NONE_MATCH);
+ if (ifNoneMatch != null && etag != null && ifNoneMatch.indexOf(etag) != -1) {
+ resp.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
+ return HttpServletResponse.SC_NOT_MODIFIED;
+ }
+ else {
+ long ifModifiedSince = req.getDateHeader(IF_MODIFIED_SINCE);
+ // for purposes of comparison we add 999 to ifModifiedSince since the
+ // fidelity
+ // of the IMS header generally doesn't include milli-seconds
+ if (ifModifiedSince > -1 && lastModified > 0 && lastModified <= (ifModifiedSince + 999)) {
+ resp.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
+ return HttpServletResponse.SC_NOT_MODIFIED;
+ }
+ }
+
+ // return the full contents regularly
+ if (contentLength != -1) {
+ resp.setContentLength(contentLength);
+ }
+
+ if (contentType != null) {
+ resp.setContentType(contentType);
+ }
+
+ if (lastModified > 0) {
+ resp.setDateHeader(LAST_MODIFIED, lastModified);
+ }
+
+ if (etag != null) {
+ resp.setHeader(ETAG, etag);
+ }
+
+ return HttpServletResponse.SC_ACCEPTED;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/ServerApplication.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/ServerApplication.java
index eced77885e..6340e6c4e7 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/ServerApplication.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/ServerApplication.java
@@ -1,46 +1,46 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server;
-
-import org.eclipse.equinox.app.IApplication;
-import org.eclipse.equinox.app.IApplicationContext;
-
-/**
- * Dummy application in order to manage server side product configurations in
- * *.product files.
- * <p>
- * A typical config.ini for such a product has (among others) the following properties:
- *
- * <pre>
- * osgi.clean=true
- * osgi.console=
- * eclipse.consoleLog=true
- * org.eclipse.equinox.http.jetty.http.port=8080
- * org.eclipse.equinox.http.jetty.context.path=/bsicrm
- * osgi.bundles=org.eclipse.equinox.common@2:start, org.eclipse.update.configurator@start, org.eclipse.equinox.http.jetty@start, org.eclipse.equinox.http.registry@start, org.eclipse.core.runtime@start
- * osgi.bundles.defaultStartLevel=4
- * osgi.noShutdown=true
- * eclipse.ignoreApp=false
- * eclipse.product=com.bsiag.myapp.server.app.product
- * </pre>
- */
-public class ServerApplication implements IApplication {
-
- @Override
- public Object start(IApplicationContext context) throws Exception {
- return EXIT_OK;
- }
-
- @Override
- public void stop() {
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server;
+
+import org.eclipse.equinox.app.IApplication;
+import org.eclipse.equinox.app.IApplicationContext;
+
+/**
+ * Dummy application in order to manage server side product configurations in
+ * *.product files.
+ * <p>
+ * A typical config.ini for such a product has (among others) the following properties:
+ *
+ * <pre>
+ * osgi.clean=true
+ * osgi.console=
+ * eclipse.consoleLog=true
+ * org.eclipse.equinox.http.jetty.http.port=8080
+ * org.eclipse.equinox.http.jetty.context.path=/bsicrm
+ * osgi.bundles=org.eclipse.equinox.common@2:start, org.eclipse.update.configurator@start, org.eclipse.equinox.http.jetty@start, org.eclipse.equinox.http.registry@start, org.eclipse.core.runtime@start
+ * osgi.bundles.defaultStartLevel=4
+ * osgi.noShutdown=true
+ * eclipse.ignoreApp=false
+ * eclipse.product=com.bsiag.myapp.server.app.product
+ * </pre>
+ */
+public class ServerApplication implements IApplication {
+
+ @Override
+ public Object start(IApplicationContext context) throws Exception {
+ return EXIT_OK;
+ }
+
+ @Override
+ public void stop() {
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/ServerJob.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/ServerJob.java
index 7da5a1df83..dee8b27a51 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/ServerJob.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/ServerJob.java
@@ -1,323 +1,323 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server;
-
-import java.lang.reflect.UndeclaredThrowableException;
-import java.security.AccessController;
-import java.security.Principal;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-import java.util.Locale;
-import java.util.Map;
-
-import javax.security.auth.Subject;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.scout.commons.LocaleThreadLocal;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.exception.ProcessingStatus;
-import org.eclipse.scout.commons.job.JobEx;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.server.transaction.BasicTransaction;
-import org.eclipse.scout.rt.server.transaction.ITransaction;
-import org.eclipse.scout.rt.server.transaction.internal.ActiveTransactionRegistry;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.TextsThreadLocal;
-
-/**
- * Perform a transaction on a {@link IServerSession}<br>
- */
-public abstract class ServerJob extends JobEx implements IServerSessionProvider {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(ServerJob.class);
-
- private IServerSession m_serverSession;
- private Subject m_subject;
- private long m_transactionSequence;
-
- /**
- * Perform a transaction on a {@link IServerSession} within a security {@link Subject} (optional)<br>
- *
- * @param serverSession
- * must not be null
- */
- public ServerJob(String name, IServerSession serverSession) {
- this(name, serverSession, null);
- }
-
- /**
- * Perform a transaction on a {@link IServerSession} within a security {@link Subject} (optional)<br>
- *
- * @param serverSession
- * must not be null
- * @param subject
- * (optional) the job is run inside a {@link Subject#doAs(Subject, java.security.PrivilegedAction)} section
- */
- public ServerJob(String name, IServerSession serverSession, Subject subject) {
- super(name);
- if (serverSession == null) {
- throw new IllegalArgumentException("serverSession is null");
- }
- m_serverSession = serverSession;
- m_subject = subject;
- }
-
- /**
- * {@link ServerJob}s belong to the family of type {@link ServerJob}.class
- */
- @Override
- public boolean belongsTo(Object family) {
- if (family == ServerJob.class) {
- return true;
- }
- return false;
- }
-
- @Override
- public IServerSession getServerSession() {
- return m_serverSession;
- }
-
- public Subject getSubject() {
- return m_subject;
- }
-
- /**
- * The subject can only be modified as long as the job is not scheduled
- */
- public void setSubject(Subject subject) {
- if (getState() != NONE) {
- throw new IllegalStateException("This job is already scheduled/running");
- }
- m_subject = subject;
- }
-
- /**
- * see {@link ITransaction#getTransactionSequence()}
- */
- public long getTransactionSequence() {
- return m_transactionSequence;
- }
-
- /**
- * see {@link ITransaction#getTransactionSequence()}
- */
- public void setTransactionSequence(long seq) {
- if (getState() != NONE) {
- throw new IllegalStateException("This job is already scheduled/running");
- }
- m_transactionSequence = seq;
- }
-
- @Override
- public boolean shouldSchedule() {
- if (getServerSession() != null && getServerSession().isSingleThreadSession()) {
- runNow(new NullProgressMonitor());
- return false;
- }
- else {
- return super.shouldSchedule();
- }
- }
-
- /**
- * <p>
- * All subsequent calls within {@link ServerJob#runTransaction(IProgressMonitor))} have the {@link IServerSession} set
- * in their thread context. After execution completes, {@link IServerSession} is cleared from the thread context.
- * </p>
- * <p>
- * By calling this method, a new transaction on {@link IServerSession} is created and automatically comitted after
- * successful completion.
- * </p>
- *
- * @param monitor
- */
- @Override
- public final IStatus runNow(IProgressMonitor monitor) {
- return super.runNow(monitor);
- }
-
- @Override
- protected final IStatus run(final IProgressMonitor monitor) {
- try {
- if (m_subject != null) {
- try {
- return Subject.doAs(
- m_subject,
- new PrivilegedExceptionAction<IStatus>() {
- @Override
- public IStatus run() throws Exception {
- return runTransactionWrapper(monitor);
- }
- }
- );
- }
- catch (PrivilegedActionException e) {
- Throwable t = e.getCause();
- if (t instanceof ProcessingException) {
- return ((ProcessingException) t).getStatus();
- }
- else {
- return new ProcessingStatus(t.getMessage(), t, 0, ProcessingStatus.ERROR);
- }
- }
- }
- else {
- return runTransactionWrapper(monitor);
- }
- }
- catch (Throwable t) {
- if (t instanceof ProcessingException) {
- return ((ProcessingException) t).getStatus();
- }
- else {
- return new ProcessingStatus(t.getMessage(), t, 0, ProcessingStatus.ERROR);
- }
- }
- }
-
- private IStatus runTransactionWrapper(IProgressMonitor monitor) throws Exception {
- ITransaction transaction = createNewTransaction();
- Map<Class, Object> backup = ThreadContext.backup();
- Locale oldLocale = LocaleThreadLocal.get();
- ScoutTexts oldTexts = TextsThreadLocal.get();
- try {
- ThreadContext.putServerSession(m_serverSession);
- ThreadContext.putTransaction(transaction);
- LocaleThreadLocal.set(m_serverSession.getLocale());
- TextsThreadLocal.set(m_serverSession.getTexts());
- ActiveTransactionRegistry.register(transaction);
- //
- IStatus status = runTransaction(monitor);
- if (status == null) {
- status = Status.OK_STATUS;
- }
- return status;
- }
- catch (Throwable t) {
- if (t instanceof UndeclaredThrowableException) {
- Throwable test = ((UndeclaredThrowableException) t).getUndeclaredThrowable();
- if (test != null) {
- t = test;
- }
- }
- if (t.getCause() instanceof ProcessingException) {
- t = t.getCause();
- }
- transaction.addFailure(t);
- String contextMsg = "Identity=" + ServerJob.getIdentity() + ", Job=" + getName();
- ProcessingException pe;
- if (t instanceof ProcessingException) {
- pe = (ProcessingException) t;
- pe.addContextMessage(contextMsg);
- }
- else {
- pe = new ProcessingException(contextMsg, t);
- }
- throw pe;
- }
- finally {
- ActiveTransactionRegistry.unregister(transaction);
- if (transaction.hasFailures()) {
- // xa rollback
- try {
- transaction.rollback();
- }
- catch (Throwable t) {
- LOG.error("Transaction rollback failed with exception.", t);
- }
- }
- else {
- // xa commit
- boolean needRollback = false;
- try {
- if (transaction.commitPhase1()) {
- transaction.commitPhase2();
- }
- else {
- needRollback = true;
- }
- }
- catch (Throwable t) {
- needRollback = true;
- LOG.error("Transaction commit exception.", t);
- }
- if (needRollback) {
- // rollback
- try {
- transaction.rollback();
- }
- catch (Throwable t) {
- LOG.error("Transaction rollback failed with exception.", t);
- }
- }
- }
- // xa release
- try {
- transaction.release();
- }
- catch (Throwable t) {
- LOG.warn(null, t);
- }
- // restore thread context
- try {
- ThreadContext.restore(backup);
- }
- catch (Throwable t) {
- LOG.warn(null, t);
- }
- LocaleThreadLocal.set(oldLocale);
- TextsThreadLocal.set(oldTexts);
- }
- }
-
- protected abstract IStatus runTransaction(IProgressMonitor monitor) throws Exception;
-
- /**
- * @return {@link ThreadContext#getServerSession()}
- */
- public static final IServerSession getCurrentSession() {
- return getCurrentSession(IServerSession.class);
- }
-
- /**
- * @return {@link ThreadContext#getServerSession()} and check if it matches the required type
- */
- @SuppressWarnings("unchecked")
- public static final <T extends IServerSession> T getCurrentSession(Class<T> type) {
- IServerSession s = ThreadContext.getServerSession();
- if (s != null && type.isAssignableFrom(s.getClass())) {
- return (T) s;
- }
- return null;
- }
-
- /**
- * Convenience to obtain name of current subjects first principal
- */
- public static String getIdentity() {
- Subject subject = Subject.getSubject(AccessController.getContext());
- if (subject != null) {
- for (Principal p : subject.getPrincipals()) {
- return p.getName();
- }
- }
- return "anonymous";
- }
-
- protected ITransaction createNewTransaction() {
- return new BasicTransaction(getTransactionSequence());
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server;
+
+import java.lang.reflect.UndeclaredThrowableException;
+import java.security.AccessController;
+import java.security.Principal;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+import java.util.Locale;
+import java.util.Map;
+
+import javax.security.auth.Subject;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.scout.commons.LocaleThreadLocal;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.exception.ProcessingStatus;
+import org.eclipse.scout.commons.job.JobEx;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.server.transaction.BasicTransaction;
+import org.eclipse.scout.rt.server.transaction.ITransaction;
+import org.eclipse.scout.rt.server.transaction.internal.ActiveTransactionRegistry;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.TextsThreadLocal;
+
+/**
+ * Perform a transaction on a {@link IServerSession}<br>
+ */
+public abstract class ServerJob extends JobEx implements IServerSessionProvider {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(ServerJob.class);
+
+ private IServerSession m_serverSession;
+ private Subject m_subject;
+ private long m_transactionSequence;
+
+ /**
+ * Perform a transaction on a {@link IServerSession} within a security {@link Subject} (optional)<br>
+ *
+ * @param serverSession
+ * must not be null
+ */
+ public ServerJob(String name, IServerSession serverSession) {
+ this(name, serverSession, null);
+ }
+
+ /**
+ * Perform a transaction on a {@link IServerSession} within a security {@link Subject} (optional)<br>
+ *
+ * @param serverSession
+ * must not be null
+ * @param subject
+ * (optional) the job is run inside a {@link Subject#doAs(Subject, java.security.PrivilegedAction)} section
+ */
+ public ServerJob(String name, IServerSession serverSession, Subject subject) {
+ super(name);
+ if (serverSession == null) {
+ throw new IllegalArgumentException("serverSession is null");
+ }
+ m_serverSession = serverSession;
+ m_subject = subject;
+ }
+
+ /**
+ * {@link ServerJob}s belong to the family of type {@link ServerJob}.class
+ */
+ @Override
+ public boolean belongsTo(Object family) {
+ if (family == ServerJob.class) {
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public IServerSession getServerSession() {
+ return m_serverSession;
+ }
+
+ public Subject getSubject() {
+ return m_subject;
+ }
+
+ /**
+ * The subject can only be modified as long as the job is not scheduled
+ */
+ public void setSubject(Subject subject) {
+ if (getState() != NONE) {
+ throw new IllegalStateException("This job is already scheduled/running");
+ }
+ m_subject = subject;
+ }
+
+ /**
+ * see {@link ITransaction#getTransactionSequence()}
+ */
+ public long getTransactionSequence() {
+ return m_transactionSequence;
+ }
+
+ /**
+ * see {@link ITransaction#getTransactionSequence()}
+ */
+ public void setTransactionSequence(long seq) {
+ if (getState() != NONE) {
+ throw new IllegalStateException("This job is already scheduled/running");
+ }
+ m_transactionSequence = seq;
+ }
+
+ @Override
+ public boolean shouldSchedule() {
+ if (getServerSession() != null && getServerSession().isSingleThreadSession()) {
+ runNow(new NullProgressMonitor());
+ return false;
+ }
+ else {
+ return super.shouldSchedule();
+ }
+ }
+
+ /**
+ * <p>
+ * All subsequent calls within {@link ServerJob#runTransaction(IProgressMonitor))} have the {@link IServerSession} set
+ * in their thread context. After execution completes, {@link IServerSession} is cleared from the thread context.
+ * </p>
+ * <p>
+ * By calling this method, a new transaction on {@link IServerSession} is created and automatically comitted after
+ * successful completion.
+ * </p>
+ *
+ * @param monitor
+ */
+ @Override
+ public final IStatus runNow(IProgressMonitor monitor) {
+ return super.runNow(monitor);
+ }
+
+ @Override
+ protected final IStatus run(final IProgressMonitor monitor) {
+ try {
+ if (m_subject != null) {
+ try {
+ return Subject.doAs(
+ m_subject,
+ new PrivilegedExceptionAction<IStatus>() {
+ @Override
+ public IStatus run() throws Exception {
+ return runTransactionWrapper(monitor);
+ }
+ }
+ );
+ }
+ catch (PrivilegedActionException e) {
+ Throwable t = e.getCause();
+ if (t instanceof ProcessingException) {
+ return ((ProcessingException) t).getStatus();
+ }
+ else {
+ return new ProcessingStatus(t.getMessage(), t, 0, ProcessingStatus.ERROR);
+ }
+ }
+ }
+ else {
+ return runTransactionWrapper(monitor);
+ }
+ }
+ catch (Throwable t) {
+ if (t instanceof ProcessingException) {
+ return ((ProcessingException) t).getStatus();
+ }
+ else {
+ return new ProcessingStatus(t.getMessage(), t, 0, ProcessingStatus.ERROR);
+ }
+ }
+ }
+
+ private IStatus runTransactionWrapper(IProgressMonitor monitor) throws Exception {
+ ITransaction transaction = createNewTransaction();
+ Map<Class, Object> backup = ThreadContext.backup();
+ Locale oldLocale = LocaleThreadLocal.get();
+ ScoutTexts oldTexts = TextsThreadLocal.get();
+ try {
+ ThreadContext.putServerSession(m_serverSession);
+ ThreadContext.putTransaction(transaction);
+ LocaleThreadLocal.set(m_serverSession.getLocale());
+ TextsThreadLocal.set(m_serverSession.getTexts());
+ ActiveTransactionRegistry.register(transaction);
+ //
+ IStatus status = runTransaction(monitor);
+ if (status == null) {
+ status = Status.OK_STATUS;
+ }
+ return status;
+ }
+ catch (Throwable t) {
+ if (t instanceof UndeclaredThrowableException) {
+ Throwable test = ((UndeclaredThrowableException) t).getUndeclaredThrowable();
+ if (test != null) {
+ t = test;
+ }
+ }
+ if (t.getCause() instanceof ProcessingException) {
+ t = t.getCause();
+ }
+ transaction.addFailure(t);
+ String contextMsg = "Identity=" + ServerJob.getIdentity() + ", Job=" + getName();
+ ProcessingException pe;
+ if (t instanceof ProcessingException) {
+ pe = (ProcessingException) t;
+ pe.addContextMessage(contextMsg);
+ }
+ else {
+ pe = new ProcessingException(contextMsg, t);
+ }
+ throw pe;
+ }
+ finally {
+ ActiveTransactionRegistry.unregister(transaction);
+ if (transaction.hasFailures()) {
+ // xa rollback
+ try {
+ transaction.rollback();
+ }
+ catch (Throwable t) {
+ LOG.error("Transaction rollback failed with exception.", t);
+ }
+ }
+ else {
+ // xa commit
+ boolean needRollback = false;
+ try {
+ if (transaction.commitPhase1()) {
+ transaction.commitPhase2();
+ }
+ else {
+ needRollback = true;
+ }
+ }
+ catch (Throwable t) {
+ needRollback = true;
+ LOG.error("Transaction commit exception.", t);
+ }
+ if (needRollback) {
+ // rollback
+ try {
+ transaction.rollback();
+ }
+ catch (Throwable t) {
+ LOG.error("Transaction rollback failed with exception.", t);
+ }
+ }
+ }
+ // xa release
+ try {
+ transaction.release();
+ }
+ catch (Throwable t) {
+ LOG.warn(null, t);
+ }
+ // restore thread context
+ try {
+ ThreadContext.restore(backup);
+ }
+ catch (Throwable t) {
+ LOG.warn(null, t);
+ }
+ LocaleThreadLocal.set(oldLocale);
+ TextsThreadLocal.set(oldTexts);
+ }
+ }
+
+ protected abstract IStatus runTransaction(IProgressMonitor monitor) throws Exception;
+
+ /**
+ * @return {@link ThreadContext#getServerSession()}
+ */
+ public static final IServerSession getCurrentSession() {
+ return getCurrentSession(IServerSession.class);
+ }
+
+ /**
+ * @return {@link ThreadContext#getServerSession()} and check if it matches the required type
+ */
+ @SuppressWarnings("unchecked")
+ public static final <T extends IServerSession> T getCurrentSession(Class<T> type) {
+ IServerSession s = ThreadContext.getServerSession();
+ if (s != null && type.isAssignableFrom(s.getClass())) {
+ return (T) s;
+ }
+ return null;
+ }
+
+ /**
+ * Convenience to obtain name of current subjects first principal
+ */
+ public static String getIdentity() {
+ Subject subject = Subject.getSubject(AccessController.getContext());
+ if (subject != null) {
+ for (Principal p : subject.getPrincipals()) {
+ return p.getName();
+ }
+ }
+ return "anonymous";
+ }
+
+ protected ITransaction createNewTransaction() {
+ return new BasicTransaction(getTransactionSequence());
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/ServerJobServletFilter.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/ServerJobServletFilter.java
index bde33f3424..f67882519c 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/ServerJobServletFilter.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/ServerJobServletFilter.java
@@ -1,150 +1,150 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server;
-
-import java.io.IOException;
-import java.util.Map;
-
-import javax.servlet.Filter;
-import javax.servlet.FilterChain;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.http.servletfilter.FilterConfigInjection;
-import org.eclipse.scout.rt.server.services.common.session.IServerSessionRegistryService;
-import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
-import org.eclipse.scout.service.SERVICES;
-
-/**
- * Expected init-param example: session=com.bsiag.myapp.server.ServerSession
- */
-public class ServerJobServletFilter implements Filter {
- private static final long serialVersionUID = 1L;
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(ServerJobServletFilter.class);
-
- private FilterConfigInjection m_injection;
-
- @Override
- public void init(FilterConfig config0) throws ServletException {
- m_injection = new FilterConfigInjection(config0, getClass());
- }
-
- @Override
- public void destroy() {
- m_injection = null;
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public void doFilter(ServletRequest sreq, ServletResponse sres, FilterChain chain) throws IOException, ServletException {
- FilterConfigInjection.FilterConfig config = m_injection.getConfig(sreq);
- if (!config.isActive()) {
- chain.doFilter(sreq, sres);
- return;
- }
- //
- HttpServletRequest req = (HttpServletRequest) sreq;
- HttpServletResponse res = (HttpServletResponse) sres;
- if ("/process".equals(req.getServletPath())) {
- chain.doFilter(sreq, sres);
- return;
- }
- // get cached session
- IServerSession serverSession = (IServerSession) req.getSession().getAttribute(IServerSession.class.getName());
- // create new session
- synchronized (req.getSession()) {
- serverSession = (IServerSession) req.getSession().getAttribute(IServerSession.class.getName());
- if (serverSession == null) {
- String qname = config.getInitParameter("session");
- Class<? extends IServerSession> serverSessionClass;
- if (qname == null) {
- throw new ServletException("Expected init-param \"session\"");
- }
- int i = qname.lastIndexOf('.');
- try {
- serverSessionClass = (Class<? extends IServerSession>) Platform.getBundle(qname.substring(0, i)).loadClass(qname);
- }
- catch (ClassNotFoundException e) {
- throw new ServletException("Loading class " + qname, e);
- }
- try {
- serverSession = SERVICES.getService(IServerSessionRegistryService.class).newServerSession(serverSessionClass, null);
- // store new session
- req.getSession().setAttribute(IServerSession.class.getName(), serverSession);
- }
- catch (Throwable t) {
- LOG.error("create session " + serverSessionClass, t);
- res.sendError(HttpServletResponse.SC_FORBIDDEN);
- return;
- }
- }
- }
- // process service request
- Map<Class, Object> backup = ThreadContext.backup();
- try {
- ThreadContext.putHttpServletRequest(req);
- ThreadContext.putHttpServletResponse(res);
-
- ServerJob job = createServiceTunnelServerJob(serverSession, chain, sreq, sres);
- IStatus status = job.runNow(new NullProgressMonitor());
- if (!status.isOK()) {
- try {
- ProcessingException p = new ProcessingException(status);
- p.addContextMessage("Client=" + req.getRemoteUser() + "@" + req.getRemoteAddr() + "/" + req.getRemoteHost());
- SERVICES.getService(IExceptionHandlerService.class).handleException(p);
- }
- catch (Throwable fatal) {
- // nop
- }
- }
- }
- finally {
- ThreadContext.restore(backup);
- }
- }
-
- protected ServerJob createServiceTunnelServerJob(IServerSession serverSession, FilterChain chain, ServletRequest request, ServletResponse response) {
- return new ServiceTunnelServiceJob(serverSession, chain, request, response);
- }
-
- protected class ServiceTunnelServiceJob extends ServerJob {
-
- protected FilterChain m_chain;
- protected ServletRequest m_request;
- protected ServletResponse m_response;
-
- public ServiceTunnelServiceJob(IServerSession serverSession, FilterChain chain, ServletRequest request, ServletResponse response) {
- super("ServiceTunnel", serverSession);
- m_chain = chain;
- m_request = request;
- m_response = response;
- }
-
- @Override
- protected IStatus runTransaction(IProgressMonitor monitor) throws Exception {
- // delegate to filter chain
- m_chain.doFilter(m_request, m_response);
- return Status.OK_STATUS;
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server;
+
+import java.io.IOException;
+import java.util.Map;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.http.servletfilter.FilterConfigInjection;
+import org.eclipse.scout.rt.server.services.common.session.IServerSessionRegistryService;
+import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
+import org.eclipse.scout.service.SERVICES;
+
+/**
+ * Expected init-param example: session=com.bsiag.myapp.server.ServerSession
+ */
+public class ServerJobServletFilter implements Filter {
+ private static final long serialVersionUID = 1L;
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(ServerJobServletFilter.class);
+
+ private FilterConfigInjection m_injection;
+
+ @Override
+ public void init(FilterConfig config0) throws ServletException {
+ m_injection = new FilterConfigInjection(config0, getClass());
+ }
+
+ @Override
+ public void destroy() {
+ m_injection = null;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public void doFilter(ServletRequest sreq, ServletResponse sres, FilterChain chain) throws IOException, ServletException {
+ FilterConfigInjection.FilterConfig config = m_injection.getConfig(sreq);
+ if (!config.isActive()) {
+ chain.doFilter(sreq, sres);
+ return;
+ }
+ //
+ HttpServletRequest req = (HttpServletRequest) sreq;
+ HttpServletResponse res = (HttpServletResponse) sres;
+ if ("/process".equals(req.getServletPath())) {
+ chain.doFilter(sreq, sres);
+ return;
+ }
+ // get cached session
+ IServerSession serverSession = (IServerSession) req.getSession().getAttribute(IServerSession.class.getName());
+ // create new session
+ synchronized (req.getSession()) {
+ serverSession = (IServerSession) req.getSession().getAttribute(IServerSession.class.getName());
+ if (serverSession == null) {
+ String qname = config.getInitParameter("session");
+ Class<? extends IServerSession> serverSessionClass;
+ if (qname == null) {
+ throw new ServletException("Expected init-param \"session\"");
+ }
+ int i = qname.lastIndexOf('.');
+ try {
+ serverSessionClass = (Class<? extends IServerSession>) Platform.getBundle(qname.substring(0, i)).loadClass(qname);
+ }
+ catch (ClassNotFoundException e) {
+ throw new ServletException("Loading class " + qname, e);
+ }
+ try {
+ serverSession = SERVICES.getService(IServerSessionRegistryService.class).newServerSession(serverSessionClass, null);
+ // store new session
+ req.getSession().setAttribute(IServerSession.class.getName(), serverSession);
+ }
+ catch (Throwable t) {
+ LOG.error("create session " + serverSessionClass, t);
+ res.sendError(HttpServletResponse.SC_FORBIDDEN);
+ return;
+ }
+ }
+ }
+ // process service request
+ Map<Class, Object> backup = ThreadContext.backup();
+ try {
+ ThreadContext.putHttpServletRequest(req);
+ ThreadContext.putHttpServletResponse(res);
+
+ ServerJob job = createServiceTunnelServerJob(serverSession, chain, sreq, sres);
+ IStatus status = job.runNow(new NullProgressMonitor());
+ if (!status.isOK()) {
+ try {
+ ProcessingException p = new ProcessingException(status);
+ p.addContextMessage("Client=" + req.getRemoteUser() + "@" + req.getRemoteAddr() + "/" + req.getRemoteHost());
+ SERVICES.getService(IExceptionHandlerService.class).handleException(p);
+ }
+ catch (Throwable fatal) {
+ // nop
+ }
+ }
+ }
+ finally {
+ ThreadContext.restore(backup);
+ }
+ }
+
+ protected ServerJob createServiceTunnelServerJob(IServerSession serverSession, FilterChain chain, ServletRequest request, ServletResponse response) {
+ return new ServiceTunnelServiceJob(serverSession, chain, request, response);
+ }
+
+ protected class ServiceTunnelServiceJob extends ServerJob {
+
+ protected FilterChain m_chain;
+ protected ServletRequest m_request;
+ protected ServletResponse m_response;
+
+ public ServiceTunnelServiceJob(IServerSession serverSession, FilterChain chain, ServletRequest request, ServletResponse response) {
+ super("ServiceTunnel", serverSession);
+ m_chain = chain;
+ m_request = request;
+ m_response = response;
+ }
+
+ @Override
+ protected IStatus runTransaction(IProgressMonitor monitor) throws Exception {
+ // delegate to filter chain
+ m_chain.doFilter(m_request, m_response);
+ return Status.OK_STATUS;
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/ServiceTunnelServlet.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/ServiceTunnelServlet.java
index 5e04f34383..cbdbe70a44 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/ServiceTunnelServlet.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/ServiceTunnelServlet.java
@@ -1,447 +1,447 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InterruptedIOException;
-import java.net.SocketException;
-import java.security.AccessController;
-import java.util.Locale;
-import java.util.Map;
-import java.util.concurrent.atomic.AtomicReference;
-
-import javax.security.auth.Subject;
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.scout.commons.LocaleThreadLocal;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.commons.osgi.BundleInspector;
-import org.eclipse.scout.http.servletfilter.HttpServletEx;
-import org.eclipse.scout.http.servletfilter.helper.HttpAuthJaasFilter;
-import org.eclipse.scout.rt.server.admin.html.AdminSession;
-import org.eclipse.scout.rt.server.internal.Activator;
-import org.eclipse.scout.rt.server.services.common.session.IServerSessionRegistryService;
-import org.eclipse.scout.rt.shared.servicetunnel.DefaultServiceTunnelContentHandler;
-import org.eclipse.scout.rt.shared.servicetunnel.IServiceTunnelContentHandler;
-import org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelRequest;
-import org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelResponse;
-import org.eclipse.scout.rt.shared.ui.UserAgent;
-import org.eclipse.scout.service.SERVICES;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.Version;
-
-/**
- * Use this servlet to dispatch scout gui service requests using {@link ServiceTunnelRequest},
- * {@link ServiceTunnelResponse} and any {@link IServiceTunnelContentHandler} implementation.
- * <p>
- * Override the methods {@link #filterInbound(Object)} and {@link #filterOutbound(Object)} to do central input/output
- * validation.
- * <p>
- * By default there is a jaas convenience filter {@link HttpAuthJaasFilter} on /process and a {@link SoapWsseJaasFilter}
- * on /ajax with priority 1000
- * <p>
- * When using RAP (rich ajax platform) as the ui web app then there must be a {@link WebSessionIdPrincipal} in the
- * subject, in order to map those requests to virtual sessions instead of (the unique) http session.
- */
-public class ServiceTunnelServlet extends HttpServletEx {
- public static final String HTTP_DEBUG_PARAM = "org.eclipse.scout.rt.server.http.debug";
- private static final long serialVersionUID = 1L;
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(ServiceTunnelServlet.class);
-
- private transient IServiceTunnelContentHandler m_contentHandler;
- private transient Bundle[] m_orderedBundleList;
- private Object m_orderedBundleListLock = new Boolean(true);
- private VirtualSessionCache m_ajaxSessionCache = new VirtualSessionCache();
- private Object m_msgEncoderLock = new Boolean(true);
- private Class<? extends IServerSession> m_serverSessionClass;
- private Version m_requestMinVersion;
- private boolean m_debug;
-
- public ServiceTunnelServlet() {
- String text = Activator.getDefault().getBundle().getBundleContext().getProperty(HTTP_DEBUG_PARAM);
- if (text != null && text.equalsIgnoreCase("true")) {
- m_debug = true;
- }
- }
-
- @Override
- public void init(ServletConfig config) throws ServletException {
- super.init(config);
- m_requestMinVersion = initRequestMinVersion(config);
- }
-
- @SuppressWarnings("unchecked")
- protected void lazyInit(HttpServletRequest req, HttpServletResponse res) throws ServletException {
- if (m_serverSessionClass == null) {
- String qname = getServletConfig().getInitParameter("session");
- if (qname != null) {
- int i = qname.lastIndexOf('.');
- try {
- m_serverSessionClass = (Class<? extends IServerSession>) Platform.getBundle(qname.substring(0, i)).loadClass(qname);
- }
- catch (ClassNotFoundException e) {
- throw new ServletException("Loading class " + qname, e);
- }
- }
- }
- if (m_serverSessionClass == null) {
- // find bundle that defines this servlet
- try {
- Bundle bundle = findServletContributor(req.getServletPath());
- if (bundle != null) {
- m_serverSessionClass = (Class<? extends IServerSession>) bundle.loadClass(bundle.getSymbolicName() + ".ServerSession");
- }
- }
- catch (Throwable t) {
- // nop
- }
- }
- if (m_serverSessionClass == null) {
- throw new ServletException("Expected init-param \"session\"");
- }
- }
-
- /**
- * <p>
- * Reads the minimum version a request must have.
- * </p>
- * <p>
- * The version has to be defined as init parameter in the servlet configuration. <br/>
- * This can be done by adding a new init-param at the {@link DefaultHttpProxyHandlerServlet} on the extension point
- * org.eclipse.equinox.http.registry.servlets and setting its name to min-version and its value to the desired version
- * (like 1.2.3).
- * </p>
- * <p>
- * If there is no min-version defined it uses the Bundle-Version of the bundle which contains the running product.
- * </p>
- *
- * @param config
- * @return
- */
- protected Version initRequestMinVersion(ServletConfig config) {
- Version version = null;
- String v = config.getInitParameter("min-version");
- if (v != null) {
- Version tmp = Version.parseVersion(v);
- version = new Version(tmp.getMajor(), tmp.getMinor(), tmp.getMicro());
- }
- else if (Platform.getProduct() != null) {
- v = (String) Platform.getProduct().getDefiningBundle().getHeaders().get("Bundle-Version");
- Version tmp = Version.parseVersion(v);
- version = new Version(tmp.getMajor(), tmp.getMinor(), tmp.getMicro());
- }
-
- return version;
- }
-
- /**
- * @deprecated use {@link #createContentHandler(Class)}
- */
- @Deprecated
- protected IServiceTunnelContentHandler createMessageEncoder(Class<? extends IServerSession> sessionClass) {
- return createContentHandler(sessionClass);
- }
-
- /**
- * create the (reusable) content handler (soap, xml, binary) for marshalling scout/osgi remote service calls
- * <p>
- * This method is part of the protected api and can be overridden.
- */
- protected IServiceTunnelContentHandler createContentHandler(Class<? extends IServerSession> sessionClass) {
- DefaultServiceTunnelContentHandler e = new DefaultServiceTunnelContentHandler();
- e.initialize(getOrderedBundleList(), sessionClass.getClassLoader());
- return e;
- }
-
- private IServiceTunnelContentHandler getServiceTunnelContentHandler() {
- synchronized (m_msgEncoderLock) {
- if (m_contentHandler == null) {
- m_contentHandler = createMessageEncoder(m_serverSessionClass);
- }
- }
- return m_contentHandler;
- }
-
- private Bundle[] getOrderedBundleList() {
- synchronized (m_orderedBundleListLock) {
- if (m_orderedBundleList == null) {
- String prefix = m_serverSessionClass.getPackage().getName().replaceAll("^(.*\\.)(client|shared|server)(\\.core)?.*$", "$1");
- m_orderedBundleList = BundleInspector.getOrderedBundleList(prefix, "org.eclipse.scout.");
- }
- }
- return m_orderedBundleList;
- }
-
- private IServerSession lookupScoutServerSessionOnHttpSession(HttpServletRequest req, HttpServletResponse res, Subject subject, UserAgent userAgent) throws ProcessingException, ServletException {
- //external request: apply locking, this is the session initialization phase
- synchronized (req.getSession()) {
- IServerSession serverSession = (IServerSession) req.getSession().getAttribute(IServerSession.class.getName());
- if (serverSession == null) {
- serverSession = SERVICES.getService(IServerSessionRegistryService.class).newServerSession(m_serverSessionClass, subject, userAgent);
- req.getSession().setAttribute(IServerSession.class.getName(), serverSession);
- }
- return serverSession;
- }
- }
-
- private IServerSession lookupScoutServerSessionOnVirtualSession(HttpServletRequest req, HttpServletResponse res, String ajaxSessionId, Subject subject, UserAgent userAgent) throws ProcessingException, ServletException {
- synchronized (m_ajaxSessionCache) {
- //update session timeout
- int maxInactive = req.getSession().getMaxInactiveInterval();
- if (maxInactive < 0) {
- maxInactive = 3600;
- }
- m_ajaxSessionCache.setSessionTimeoutMillis(Math.max(1000L, 1000L * maxInactive));
- IServerSession serverSession = m_ajaxSessionCache.get(ajaxSessionId);
- if (serverSession == null) {
- serverSession = SERVICES.getService(IServerSessionRegistryService.class).newServerSession(m_serverSessionClass, subject, userAgent);
- m_ajaxSessionCache.put(ajaxSessionId, serverSession);
- }
- else {
- m_ajaxSessionCache.touch(ajaxSessionId);
- }
- return serverSession;
- }
- }
-
- @Override
- protected void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException {
- Subject subject = Subject.getSubject(AccessController.getContext());
- if (subject == null) {
- res.sendError(HttpServletResponse.SC_FORBIDDEN);
- return;
- }
- //invoke
- Map<Class, Object> backup = ThreadContext.backup();
- try {
- lazyInit(req, res);
- //
- //legacy, deprecated, do not use servlet request/response in scout code
- ThreadContext.putHttpServletRequest(req);
- ThreadContext.putHttpServletResponse(res);
- //
- UserAgent userAgent = UserAgent.createDefault();
- IServerSession serverSession = lookupScoutServerSessionOnHttpSession(req, res, subject, userAgent);
- //
- ServerJob job = new AdminServiceJob(serverSession, subject, req, res);
- job.runNow(new NullProgressMonitor());
- job.throwOnError();
- }
- catch (ProcessingException e) {
- throw new ServletException(e);
- }
- finally {
- ThreadContext.restore(backup);
- }
- }
-
- @Override
- protected void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
- Subject subject = Subject.getSubject(AccessController.getContext());
- if (subject == null) {
- res.sendError(HttpServletResponse.SC_FORBIDDEN);
- return;
- }
- try {
- lazyInit(req, res);
- Map<Class, Object> backup = ThreadContext.backup();
- Locale oldLocale = LocaleThreadLocal.get();
- try {
- ThreadContext.putHttpServletRequest(req);
- ThreadContext.putHttpServletResponse(res);
- //read request
- ServiceTunnelRequest serviceRequest = deserializeInput(req.getInputStream());
- LocaleThreadLocal.set(serviceRequest.getLocale());
- //virtual or http session?
- IServerSession serverSession;
- String virtualSessionId = serviceRequest.getVirtualSessionId();
- UserAgent userAgent = UserAgent.createByIdentifier(serviceRequest.getUserAgent());
- if (virtualSessionId != null) {
- serverSession = lookupScoutServerSessionOnVirtualSession(req, res, virtualSessionId, subject, userAgent);
- }
- else {
- serverSession = lookupScoutServerSessionOnHttpSession(req, res, subject, userAgent);
- }
- //invoke
- AtomicReference<ServiceTunnelResponse> serviceResponseHolder = new AtomicReference<ServiceTunnelResponse>();
- ServerJob job = createServiceTunnelServerJob(serverSession, serviceRequest, serviceResponseHolder, subject);
- job.setTransactionSequence(serviceRequest.getRequestSequence());
- job.runNow(new NullProgressMonitor());
- job.throwOnError();
- serializeOutput(res, serviceResponseHolder.get());
- }
- finally {
- ThreadContext.restore(backup);
- LocaleThreadLocal.set(oldLocale);
- }
- }
- catch (Throwable t) {
- //ignore disconnect errors
- // we don't want to throw an exception, if the client closed the connection
- Throwable cause = t;
- while (cause != null) {
- if (cause instanceof SocketException) {
- return;
- }
- else if (cause.getClass().getSimpleName().equalsIgnoreCase("EofException")) {
- return;
- }
- else if (cause instanceof InterruptedIOException) {
- return;
- }
- // next
- cause = cause.getCause();
- }
- LOG.error("Session=" + req.getSession().getId() + ", Client=" + req.getRemoteUser() + "@" + req.getRemoteAddr() + "/" + req.getRemoteHost(), t);
- res.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
- }
- }
-
- protected ServiceTunnelRequest deserializeInput(InputStream in) throws Exception {
- ServiceTunnelRequest req = getServiceTunnelContentHandler().readRequest(in);
- return req;
- }
-
- protected void serializeOutput(HttpServletResponse httpResponse, ServiceTunnelResponse res) throws Exception {
- // security: do not send back error stack trace
- if (res.getException() != null) {
- res.getException().setStackTrace(new StackTraceElement[0]);
- }
- //
- httpResponse.setDateHeader("Expires", -1);
- httpResponse.setHeader("Cache-Control", "no-cache");
- httpResponse.setHeader("pragma", "no-cache");
- httpResponse.setContentType("text/xml");
- getServiceTunnelContentHandler().writeResponse(httpResponse.getOutputStream(), res);
- }
-
- private Bundle findServletContributor(String alias) throws CoreException {
- BundleContext context = Activator.getDefault().getBundle().getBundleContext();
- ServiceReference ref = context.getServiceReference(IExtensionRegistry.class.getName());
- Bundle bundle = null;
- if (ref != null) {
- IExtensionRegistry reg = (IExtensionRegistry) context.getService(ref);
- if (reg != null) {
- IExtensionPoint xpServlet = reg.getExtensionPoint("org.eclipse.equinox.http.registry.servlets");
- if (xpServlet != null) {
- for (IExtension xServlet : xpServlet.getExtensions()) {
- for (IConfigurationElement cServlet : xServlet.getConfigurationElements()) {
- if (cServlet.getName().equals("servlet")) {
- if (this.getClass().getName().equals(cServlet.getAttribute("class"))) {
- // half match, go on looping
- bundle = Platform.getBundle(xServlet.getContributor().getName());
- if (alias.equals(cServlet.getAttribute("alias"))) {
- // full match, return
- return bundle;
- }
- }
- }
- }
- }
- }
- }
- }
- return bundle;
- }
-
- /**
- * Create the {@link ServerJob} that runs the request as a single atomic transaction
- */
- protected ServerJob createServiceTunnelServerJob(IServerSession serverSession, ServiceTunnelRequest serviceRequest, AtomicReference<ServiceTunnelResponse> serviceResponseHolder, Subject subject) {
- return new RemoteServiceJob(serverSession, serviceRequest, serviceResponseHolder, subject);
- }
-
- /**
- * runnable content of the {@link ServerJob}, thzis is the atomic transaction
- * <p>
- * This method is part of the protected api and can be overridden.
- */
- protected ServiceTunnelResponse runServerJobTransaction(ServiceTunnelRequest req) throws Exception {
- return runServerJobTransactionWithDelegate(req, getOrderedBundleList(), m_requestMinVersion, m_debug);
- }
-
- protected ServiceTunnelResponse runServerJobTransactionWithDelegate(ServiceTunnelRequest req, Bundle[] loaderBundles, Version requestMinVersion, boolean debug) throws Exception {
- return new DefaultTransactionDelegate(loaderBundles, requestMinVersion, debug).invoke(req);
- }
-
- private class RemoteServiceJob extends ServerJob {
-
- private final ServiceTunnelRequest m_serviceRequest;
- private final AtomicReference<ServiceTunnelResponse> m_serviceResponseHolder;
-
- public RemoteServiceJob(IServerSession serverSession, ServiceTunnelRequest serviceRequest, AtomicReference<ServiceTunnelResponse> serviceResponseHolder, Subject subject) {
- super("RemoteServiceCall", serverSession, subject);
- m_serviceRequest = serviceRequest;
- m_serviceResponseHolder = serviceResponseHolder;
- }
-
- public ServiceTunnelRequest getServiceRequest() {
- return m_serviceRequest;
- }
-
- public AtomicReference<ServiceTunnelResponse> getServiceResponseHolder() {
- return m_serviceResponseHolder;
- }
-
- @Override
- protected IStatus runTransaction(IProgressMonitor monitor) throws Exception {
- ServiceTunnelResponse serviceRes = runServerJobTransaction(getServiceRequest());
- getServiceResponseHolder().set(serviceRes);
- return Status.OK_STATUS;
- }
- }
-
- private class AdminServiceJob extends ServerJob {
-
- protected HttpServletRequest m_request;
- protected HttpServletResponse m_response;
-
- public AdminServiceJob(IServerSession serverSession, Subject subject, HttpServletRequest request, HttpServletResponse response) {
- super("AdminServiceCall", serverSession, subject);
- m_request = request;
- m_response = response;
- }
-
- @Override
- protected IStatus runTransaction(IProgressMonitor monitor) throws Exception {
- // get session
- HttpSession session = m_request.getSession();
- String key = AdminSession.class.getName();
- AdminSession as = (AdminSession) session.getAttribute(key);
- if (as == null) {
- as = new AdminSession();
- session.setAttribute(key, as);
- }
- as.serviceRequest(m_request, m_response);
- return Status.OK_STATUS;
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InterruptedIOException;
+import java.net.SocketException;
+import java.security.AccessController;
+import java.util.Locale;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicReference;
+
+import javax.security.auth.Subject;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.scout.commons.LocaleThreadLocal;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.commons.osgi.BundleInspector;
+import org.eclipse.scout.http.servletfilter.HttpServletEx;
+import org.eclipse.scout.http.servletfilter.helper.HttpAuthJaasFilter;
+import org.eclipse.scout.rt.server.admin.html.AdminSession;
+import org.eclipse.scout.rt.server.internal.Activator;
+import org.eclipse.scout.rt.server.services.common.session.IServerSessionRegistryService;
+import org.eclipse.scout.rt.shared.servicetunnel.DefaultServiceTunnelContentHandler;
+import org.eclipse.scout.rt.shared.servicetunnel.IServiceTunnelContentHandler;
+import org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelRequest;
+import org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelResponse;
+import org.eclipse.scout.rt.shared.ui.UserAgent;
+import org.eclipse.scout.service.SERVICES;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.Version;
+
+/**
+ * Use this servlet to dispatch scout gui service requests using {@link ServiceTunnelRequest},
+ * {@link ServiceTunnelResponse} and any {@link IServiceTunnelContentHandler} implementation.
+ * <p>
+ * Override the methods {@link #filterInbound(Object)} and {@link #filterOutbound(Object)} to do central input/output
+ * validation.
+ * <p>
+ * By default there is a jaas convenience filter {@link HttpAuthJaasFilter} on /process and a {@link SoapWsseJaasFilter}
+ * on /ajax with priority 1000
+ * <p>
+ * When using RAP (rich ajax platform) as the ui web app then there must be a {@link WebSessionIdPrincipal} in the
+ * subject, in order to map those requests to virtual sessions instead of (the unique) http session.
+ */
+public class ServiceTunnelServlet extends HttpServletEx {
+ public static final String HTTP_DEBUG_PARAM = "org.eclipse.scout.rt.server.http.debug";
+ private static final long serialVersionUID = 1L;
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(ServiceTunnelServlet.class);
+
+ private transient IServiceTunnelContentHandler m_contentHandler;
+ private transient Bundle[] m_orderedBundleList;
+ private Object m_orderedBundleListLock = new Boolean(true);
+ private VirtualSessionCache m_ajaxSessionCache = new VirtualSessionCache();
+ private Object m_msgEncoderLock = new Boolean(true);
+ private Class<? extends IServerSession> m_serverSessionClass;
+ private Version m_requestMinVersion;
+ private boolean m_debug;
+
+ public ServiceTunnelServlet() {
+ String text = Activator.getDefault().getBundle().getBundleContext().getProperty(HTTP_DEBUG_PARAM);
+ if (text != null && text.equalsIgnoreCase("true")) {
+ m_debug = true;
+ }
+ }
+
+ @Override
+ public void init(ServletConfig config) throws ServletException {
+ super.init(config);
+ m_requestMinVersion = initRequestMinVersion(config);
+ }
+
+ @SuppressWarnings("unchecked")
+ protected void lazyInit(HttpServletRequest req, HttpServletResponse res) throws ServletException {
+ if (m_serverSessionClass == null) {
+ String qname = getServletConfig().getInitParameter("session");
+ if (qname != null) {
+ int i = qname.lastIndexOf('.');
+ try {
+ m_serverSessionClass = (Class<? extends IServerSession>) Platform.getBundle(qname.substring(0, i)).loadClass(qname);
+ }
+ catch (ClassNotFoundException e) {
+ throw new ServletException("Loading class " + qname, e);
+ }
+ }
+ }
+ if (m_serverSessionClass == null) {
+ // find bundle that defines this servlet
+ try {
+ Bundle bundle = findServletContributor(req.getServletPath());
+ if (bundle != null) {
+ m_serverSessionClass = (Class<? extends IServerSession>) bundle.loadClass(bundle.getSymbolicName() + ".ServerSession");
+ }
+ }
+ catch (Throwable t) {
+ // nop
+ }
+ }
+ if (m_serverSessionClass == null) {
+ throw new ServletException("Expected init-param \"session\"");
+ }
+ }
+
+ /**
+ * <p>
+ * Reads the minimum version a request must have.
+ * </p>
+ * <p>
+ * The version has to be defined as init parameter in the servlet configuration. <br/>
+ * This can be done by adding a new init-param at the {@link DefaultHttpProxyHandlerServlet} on the extension point
+ * org.eclipse.equinox.http.registry.servlets and setting its name to min-version and its value to the desired version
+ * (like 1.2.3).
+ * </p>
+ * <p>
+ * If there is no min-version defined it uses the Bundle-Version of the bundle which contains the running product.
+ * </p>
+ *
+ * @param config
+ * @return
+ */
+ protected Version initRequestMinVersion(ServletConfig config) {
+ Version version = null;
+ String v = config.getInitParameter("min-version");
+ if (v != null) {
+ Version tmp = Version.parseVersion(v);
+ version = new Version(tmp.getMajor(), tmp.getMinor(), tmp.getMicro());
+ }
+ else if (Platform.getProduct() != null) {
+ v = (String) Platform.getProduct().getDefiningBundle().getHeaders().get("Bundle-Version");
+ Version tmp = Version.parseVersion(v);
+ version = new Version(tmp.getMajor(), tmp.getMinor(), tmp.getMicro());
+ }
+
+ return version;
+ }
+
+ /**
+ * @deprecated use {@link #createContentHandler(Class)}
+ */
+ @Deprecated
+ protected IServiceTunnelContentHandler createMessageEncoder(Class<? extends IServerSession> sessionClass) {
+ return createContentHandler(sessionClass);
+ }
+
+ /**
+ * create the (reusable) content handler (soap, xml, binary) for marshalling scout/osgi remote service calls
+ * <p>
+ * This method is part of the protected api and can be overridden.
+ */
+ protected IServiceTunnelContentHandler createContentHandler(Class<? extends IServerSession> sessionClass) {
+ DefaultServiceTunnelContentHandler e = new DefaultServiceTunnelContentHandler();
+ e.initialize(getOrderedBundleList(), sessionClass.getClassLoader());
+ return e;
+ }
+
+ private IServiceTunnelContentHandler getServiceTunnelContentHandler() {
+ synchronized (m_msgEncoderLock) {
+ if (m_contentHandler == null) {
+ m_contentHandler = createMessageEncoder(m_serverSessionClass);
+ }
+ }
+ return m_contentHandler;
+ }
+
+ private Bundle[] getOrderedBundleList() {
+ synchronized (m_orderedBundleListLock) {
+ if (m_orderedBundleList == null) {
+ String prefix = m_serverSessionClass.getPackage().getName().replaceAll("^(.*\\.)(client|shared|server)(\\.core)?.*$", "$1");
+ m_orderedBundleList = BundleInspector.getOrderedBundleList(prefix, "org.eclipse.scout.");
+ }
+ }
+ return m_orderedBundleList;
+ }
+
+ private IServerSession lookupScoutServerSessionOnHttpSession(HttpServletRequest req, HttpServletResponse res, Subject subject, UserAgent userAgent) throws ProcessingException, ServletException {
+ //external request: apply locking, this is the session initialization phase
+ synchronized (req.getSession()) {
+ IServerSession serverSession = (IServerSession) req.getSession().getAttribute(IServerSession.class.getName());
+ if (serverSession == null) {
+ serverSession = SERVICES.getService(IServerSessionRegistryService.class).newServerSession(m_serverSessionClass, subject, userAgent);
+ req.getSession().setAttribute(IServerSession.class.getName(), serverSession);
+ }
+ return serverSession;
+ }
+ }
+
+ private IServerSession lookupScoutServerSessionOnVirtualSession(HttpServletRequest req, HttpServletResponse res, String ajaxSessionId, Subject subject, UserAgent userAgent) throws ProcessingException, ServletException {
+ synchronized (m_ajaxSessionCache) {
+ //update session timeout
+ int maxInactive = req.getSession().getMaxInactiveInterval();
+ if (maxInactive < 0) {
+ maxInactive = 3600;
+ }
+ m_ajaxSessionCache.setSessionTimeoutMillis(Math.max(1000L, 1000L * maxInactive));
+ IServerSession serverSession = m_ajaxSessionCache.get(ajaxSessionId);
+ if (serverSession == null) {
+ serverSession = SERVICES.getService(IServerSessionRegistryService.class).newServerSession(m_serverSessionClass, subject, userAgent);
+ m_ajaxSessionCache.put(ajaxSessionId, serverSession);
+ }
+ else {
+ m_ajaxSessionCache.touch(ajaxSessionId);
+ }
+ return serverSession;
+ }
+ }
+
+ @Override
+ protected void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException {
+ Subject subject = Subject.getSubject(AccessController.getContext());
+ if (subject == null) {
+ res.sendError(HttpServletResponse.SC_FORBIDDEN);
+ return;
+ }
+ //invoke
+ Map<Class, Object> backup = ThreadContext.backup();
+ try {
+ lazyInit(req, res);
+ //
+ //legacy, deprecated, do not use servlet request/response in scout code
+ ThreadContext.putHttpServletRequest(req);
+ ThreadContext.putHttpServletResponse(res);
+ //
+ UserAgent userAgent = UserAgent.createDefault();
+ IServerSession serverSession = lookupScoutServerSessionOnHttpSession(req, res, subject, userAgent);
+ //
+ ServerJob job = new AdminServiceJob(serverSession, subject, req, res);
+ job.runNow(new NullProgressMonitor());
+ job.throwOnError();
+ }
+ catch (ProcessingException e) {
+ throw new ServletException(e);
+ }
+ finally {
+ ThreadContext.restore(backup);
+ }
+ }
+
+ @Override
+ protected void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
+ Subject subject = Subject.getSubject(AccessController.getContext());
+ if (subject == null) {
+ res.sendError(HttpServletResponse.SC_FORBIDDEN);
+ return;
+ }
+ try {
+ lazyInit(req, res);
+ Map<Class, Object> backup = ThreadContext.backup();
+ Locale oldLocale = LocaleThreadLocal.get();
+ try {
+ ThreadContext.putHttpServletRequest(req);
+ ThreadContext.putHttpServletResponse(res);
+ //read request
+ ServiceTunnelRequest serviceRequest = deserializeInput(req.getInputStream());
+ LocaleThreadLocal.set(serviceRequest.getLocale());
+ //virtual or http session?
+ IServerSession serverSession;
+ String virtualSessionId = serviceRequest.getVirtualSessionId();
+ UserAgent userAgent = UserAgent.createByIdentifier(serviceRequest.getUserAgent());
+ if (virtualSessionId != null) {
+ serverSession = lookupScoutServerSessionOnVirtualSession(req, res, virtualSessionId, subject, userAgent);
+ }
+ else {
+ serverSession = lookupScoutServerSessionOnHttpSession(req, res, subject, userAgent);
+ }
+ //invoke
+ AtomicReference<ServiceTunnelResponse> serviceResponseHolder = new AtomicReference<ServiceTunnelResponse>();
+ ServerJob job = createServiceTunnelServerJob(serverSession, serviceRequest, serviceResponseHolder, subject);
+ job.setTransactionSequence(serviceRequest.getRequestSequence());
+ job.runNow(new NullProgressMonitor());
+ job.throwOnError();
+ serializeOutput(res, serviceResponseHolder.get());
+ }
+ finally {
+ ThreadContext.restore(backup);
+ LocaleThreadLocal.set(oldLocale);
+ }
+ }
+ catch (Throwable t) {
+ //ignore disconnect errors
+ // we don't want to throw an exception, if the client closed the connection
+ Throwable cause = t;
+ while (cause != null) {
+ if (cause instanceof SocketException) {
+ return;
+ }
+ else if (cause.getClass().getSimpleName().equalsIgnoreCase("EofException")) {
+ return;
+ }
+ else if (cause instanceof InterruptedIOException) {
+ return;
+ }
+ // next
+ cause = cause.getCause();
+ }
+ LOG.error("Session=" + req.getSession().getId() + ", Client=" + req.getRemoteUser() + "@" + req.getRemoteAddr() + "/" + req.getRemoteHost(), t);
+ res.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ }
+ }
+
+ protected ServiceTunnelRequest deserializeInput(InputStream in) throws Exception {
+ ServiceTunnelRequest req = getServiceTunnelContentHandler().readRequest(in);
+ return req;
+ }
+
+ protected void serializeOutput(HttpServletResponse httpResponse, ServiceTunnelResponse res) throws Exception {
+ // security: do not send back error stack trace
+ if (res.getException() != null) {
+ res.getException().setStackTrace(new StackTraceElement[0]);
+ }
+ //
+ httpResponse.setDateHeader("Expires", -1);
+ httpResponse.setHeader("Cache-Control", "no-cache");
+ httpResponse.setHeader("pragma", "no-cache");
+ httpResponse.setContentType("text/xml");
+ getServiceTunnelContentHandler().writeResponse(httpResponse.getOutputStream(), res);
+ }
+
+ private Bundle findServletContributor(String alias) throws CoreException {
+ BundleContext context = Activator.getDefault().getBundle().getBundleContext();
+ ServiceReference ref = context.getServiceReference(IExtensionRegistry.class.getName());
+ Bundle bundle = null;
+ if (ref != null) {
+ IExtensionRegistry reg = (IExtensionRegistry) context.getService(ref);
+ if (reg != null) {
+ IExtensionPoint xpServlet = reg.getExtensionPoint("org.eclipse.equinox.http.registry.servlets");
+ if (xpServlet != null) {
+ for (IExtension xServlet : xpServlet.getExtensions()) {
+ for (IConfigurationElement cServlet : xServlet.getConfigurationElements()) {
+ if (cServlet.getName().equals("servlet")) {
+ if (this.getClass().getName().equals(cServlet.getAttribute("class"))) {
+ // half match, go on looping
+ bundle = Platform.getBundle(xServlet.getContributor().getName());
+ if (alias.equals(cServlet.getAttribute("alias"))) {
+ // full match, return
+ return bundle;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return bundle;
+ }
+
+ /**
+ * Create the {@link ServerJob} that runs the request as a single atomic transaction
+ */
+ protected ServerJob createServiceTunnelServerJob(IServerSession serverSession, ServiceTunnelRequest serviceRequest, AtomicReference<ServiceTunnelResponse> serviceResponseHolder, Subject subject) {
+ return new RemoteServiceJob(serverSession, serviceRequest, serviceResponseHolder, subject);
+ }
+
+ /**
+ * runnable content of the {@link ServerJob}, thzis is the atomic transaction
+ * <p>
+ * This method is part of the protected api and can be overridden.
+ */
+ protected ServiceTunnelResponse runServerJobTransaction(ServiceTunnelRequest req) throws Exception {
+ return runServerJobTransactionWithDelegate(req, getOrderedBundleList(), m_requestMinVersion, m_debug);
+ }
+
+ protected ServiceTunnelResponse runServerJobTransactionWithDelegate(ServiceTunnelRequest req, Bundle[] loaderBundles, Version requestMinVersion, boolean debug) throws Exception {
+ return new DefaultTransactionDelegate(loaderBundles, requestMinVersion, debug).invoke(req);
+ }
+
+ private class RemoteServiceJob extends ServerJob {
+
+ private final ServiceTunnelRequest m_serviceRequest;
+ private final AtomicReference<ServiceTunnelResponse> m_serviceResponseHolder;
+
+ public RemoteServiceJob(IServerSession serverSession, ServiceTunnelRequest serviceRequest, AtomicReference<ServiceTunnelResponse> serviceResponseHolder, Subject subject) {
+ super("RemoteServiceCall", serverSession, subject);
+ m_serviceRequest = serviceRequest;
+ m_serviceResponseHolder = serviceResponseHolder;
+ }
+
+ public ServiceTunnelRequest getServiceRequest() {
+ return m_serviceRequest;
+ }
+
+ public AtomicReference<ServiceTunnelResponse> getServiceResponseHolder() {
+ return m_serviceResponseHolder;
+ }
+
+ @Override
+ protected IStatus runTransaction(IProgressMonitor monitor) throws Exception {
+ ServiceTunnelResponse serviceRes = runServerJobTransaction(getServiceRequest());
+ getServiceResponseHolder().set(serviceRes);
+ return Status.OK_STATUS;
+ }
+ }
+
+ private class AdminServiceJob extends ServerJob {
+
+ protected HttpServletRequest m_request;
+ protected HttpServletResponse m_response;
+
+ public AdminServiceJob(IServerSession serverSession, Subject subject, HttpServletRequest request, HttpServletResponse response) {
+ super("AdminServiceCall", serverSession, subject);
+ m_request = request;
+ m_response = response;
+ }
+
+ @Override
+ protected IStatus runTransaction(IProgressMonitor monitor) throws Exception {
+ // get session
+ HttpSession session = m_request.getSession();
+ String key = AdminSession.class.getName();
+ AdminSession as = (AdminSession) session.getAttribute(key);
+ if (as == null) {
+ as = new AdminSession();
+ session.setAttribute(key, as);
+ }
+ as.serviceRequest(m_request, m_response);
+ return Status.OK_STATUS;
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/SoapWsseJaasFilter.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/SoapWsseJaasFilter.java
index 573e00d5ad..6cac4bfccf 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/SoapWsseJaasFilter.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/SoapWsseJaasFilter.java
@@ -1,370 +1,370 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.UnsupportedEncodingException;
-import java.security.AccessController;
-import java.security.Principal;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-
-import javax.security.auth.Subject;
-import javax.servlet.Filter;
-import javax.servlet.FilterChain;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-import javax.servlet.ServletInputStream;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletRequestWrapper;
-import javax.servlet.http.HttpServletResponse;
-import javax.xml.namespace.QName;
-import javax.xml.parsers.SAXParserFactory;
-
-import org.eclipse.scout.commons.Base64Utility;
-import org.eclipse.scout.commons.EncryptionUtility;
-import org.eclipse.scout.commons.SoapHandlingUtility;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.commons.security.SimplePrincipal;
-import org.eclipse.scout.http.servletfilter.FilterConfigInjection;
-import org.eclipse.scout.http.servletfilter.security.SecureHttpServletRequestWrapper;
-import org.eclipse.scout.rt.server.internal.Activator;
-import org.xml.sax.Attributes;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.DefaultHandler;
-
-/**
- * Transformation filter used to create a subject based on the soap headers containing a virtual request (from ajax,
- * rap)
- * <p>
- * If there is already a subject set as {@link Subject#getSubject(java.security.AccessControlContext)} then the filter
- * is transparent.
- * <p>
- * Reads the soap wsse header and transforms it to a subject with the user principal. The password is the triple-des
- * encoding of "${timestamp}:${username}" using the config.ini parameter <code>scout.ajax.token.key</code>
- * <p>
- * Normally this filters the alias /ajax
- * <p>
- * This filter is registered in the scout server plugin.xml as /ajax by default with order 1'000'010 and has the active
- * flag set to true
- */
-public class SoapWsseJaasFilter implements Filter {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(SoapWsseJaasFilter.class);
-
- private static final byte[] tripleDesKey;
- static {
- String key = Activator.getDefault().getBundle().getBundleContext().getProperty("scout.ajax.token.key");
- if (key == null) {
- tripleDesKey = null;
- }
- else {
- tripleDesKey = new byte[24];
- byte[] keyBytes;
- try {
- keyBytes = key.getBytes("UTF-8");
- System.arraycopy(keyBytes, 0, tripleDesKey, 0, Math.min(keyBytes.length, tripleDesKey.length));
- }
- catch (UnsupportedEncodingException e) {
- LOG.error("reading property 'scout.ajax.token.key'", e);
- }
- }
- }
-
- private SAXParserFactory m_saxParserFactory;
- private FilterConfigInjection m_injection;
-
- @Override
- public void init(FilterConfig config0) throws ServletException {
- m_injection = new FilterConfigInjection(config0, getClass());
- try {
- m_saxParserFactory = SoapHandlingUtility.createSaxParserFactory();
- }
- catch (Exception e) {
- throw new ServletException(e);
- }
- }
-
- @Override
- public void destroy() {
- m_saxParserFactory = null;
- m_injection = null;
- }
-
- @Override
- public void doFilter(ServletRequest request, final ServletResponse response, final FilterChain chain) throws IOException, ServletException {
- if (isSubjectSet()) {
- chain.doFilter(request, response);
- return;
- }
- FilterConfigInjection.FilterConfig config = m_injection.getConfig(request);
- if (!config.isActive()) {
- chain.doFilter(request, response);
- return;
- }
-
- InputStream httpIn = request.getInputStream();
- ByteArrayOutputStream cacheOut = new ByteArrayOutputStream();
- Subject subject;
- try {
- subject = parseSubject(httpIn, cacheOut);
- }
- catch (Throwable t) {
- LOG.warn("WS-Security check", t);
- ((HttpServletResponse) response).sendError(HttpServletResponse.SC_FORBIDDEN);
- return;
- }
- final InputStream cacheIn = new ByteArrayInputStream(cacheOut.toByteArray());
- cacheOut = null;
- //
- final HttpServletRequestWrapper replayRequest = new HttpServletRequestWrapper((HttpServletRequest) request) {
- @Override
- public ServletInputStream getInputStream() throws IOException {
- return new ServletInputStream() {
- @Override
- public int read() throws IOException {
- return cacheIn.read();
- }
- };
- }
- };
- continueChainWithPrincipal(subject, replayRequest, (HttpServletResponse) response, chain);
- }
-
- private void continueChainWithPrincipal(Subject subject, final HttpServletRequest req, final HttpServletResponse res, final FilterChain chain) throws IOException, ServletException {
- try {
- Subject.doAs(
- subject,
- new PrivilegedExceptionAction<Object>() {
- @Override
- public Object run() throws Exception {
- Principal principal = Subject.getSubject(AccessController.getContext()).getPrincipals().iterator().next();
- HttpServletRequest secureReq = new SecureHttpServletRequestWrapper(req, principal);
- chain.doFilter(secureReq, res);
- return null;
- }
- }
- );
- }
- catch (PrivilegedActionException e) {
- Throwable t = e.getCause();
- if (t instanceof IOException) {
- throw (IOException) t;
- }
- else if (t instanceof ServletException) {
- throw (ServletException) t;
- }
- else {
- throw new ServletException(t);
- }
- }
- }
-
- protected Subject parseSubject(final InputStream httpIn, final ByteArrayOutputStream cacheOut) throws Exception {
- InputStream filterIn = new InputStream() {
- @Override
- public int read() throws IOException {
- int ch = httpIn.read();
- if (ch < 0) {
- return ch;
- }
- cacheOut.write(ch);
- return ch;
- }
-
- @Override
- public int read(byte[] b) throws IOException {
- int n = httpIn.read(b);
- if (n <= 0) {
- return n;
- }
- cacheOut.write(b, 0, n);
- return n;
- }
-
- @Override
- public int read(byte[] b, int off, int len) throws IOException {
- int n = httpIn.read(b, off, len);
- if (n <= 0) {
- return n;
- }
- cacheOut.write(b, off, n);
- return n;
- }
- };
- WSSEUserTokenHandler handler = new WSSEUserTokenHandler();
- SoapHandlingUtility.createSaxParser(m_saxParserFactory).parse(new InputSource(filterIn), handler);
- return createSubject(cleanString(handler.user), cleanString(handler.tokenRaw), cleanString(handler.tokenEncoding));
- }
-
- /**
- * override this method to do additional checks on credentials
- */
- protected Subject createSubject(String user, String tokenRaw, String tokenEncoding) throws Exception {
- if (user == null || tokenRaw == null) {
- LOG.error("Ajax back-end call contains no ws-security token. Check if the config.ini of the /rap and the /ajax webapp contains the property 'scout.ajax.token.key'.");
- throw new SecurityException("SOAP header contains no ws-security token");
- }
- byte[] token = Base64Utility.decode(tokenRaw);
- String msg = new String(EncryptionUtility.decrypt(token, tripleDesKey), "UTF-8");
- String[] tupel = msg.split(":", 2);
- long timestamp = Long.parseLong(tupel[0]);
- String userRef = tupel[1];
- if (timestamp < 0L || userRef == null || !userRef.equals(user)) {
- throw new SecurityException("SOAP header contains no ws-security token");
- }
- Subject subject = new Subject();
- subject.getPrincipals().add(new SimplePrincipal(user));
- subject.setReadOnly();
- return subject;
- }
-
- private boolean isSubjectSet() {
- Subject subject = Subject.getSubject(AccessController.getContext());
- if (subject == null) {
- return false;
- }
- if (subject.getPrincipals().size() == 0) {
- return false;
- }
- String name = subject.getPrincipals().iterator().next().getName();
- if (name == null || name.trim().length() == 0) {
- return false;
- }
- return true;
- }
-
- private String cleanString(String s) {
- if (s == null) {
- return null;
- }
- s = s.trim();
- if (s.length() == 0) {
- return null;
- }
- if (s.equalsIgnoreCase("null")) {
- return null;
- }
- return s;
- }
-
- /**
- * <pre>
- * <wsse:Security soapenv:mustUnderstand="1">
- * <wsse:UsernameToken>
- * <wsse:Username>user</wsse:Username>
- * <wsse:Password Type="http://...#Virtual">QDgxVkqYnuqk...==</wsse:Password>
- * </wsse:UsernameToken>
- * </wsse:Security>
- * </pre>
- */
- private static class WSSEUserTokenHandler extends DefaultHandler {
- public String user;
- public String tokenEncoding;
- public String tokenRaw;
- //
- private boolean insideEnvelope;
- private boolean insideHeader;
- private boolean insideSecurity;
- private boolean insideUsernameToken;
- private boolean insideUsername;
- private boolean insidePasswort;
- private boolean done;
-
- @Override
- public void startElement(String namespaceURI, String localName, String qNameText, Attributes attributes) throws SAXException {
- if (done) {
- return;
- }
- QName qname = new QName(namespaceURI, localName);
- if (SoapHandlingUtility.SOAPENV_ENVELOPE_ELEMENT.equals(qname)) {
- insideEnvelope = true;
- return;
- }
- if (SoapHandlingUtility.SOAPENV_HEADER_ELEMENT.equals(qname)) {
- insideHeader = true;
- return;
- }
- if (SoapHandlingUtility.WSSE_SECURITY_ELEMENT.equals(qname)) {
- insideSecurity = true;
- return;
- }
- if (SoapHandlingUtility.WSSE_USERNAME_TOKEN_ELEMENT.equals(qname)) {
- insideUsernameToken = true;
- return;
- }
- if (SoapHandlingUtility.WSSE_USERNAME_ELEMENT.equals(qname)) {
- insideUsername = true;
- return;
- }
- if (SoapHandlingUtility.WSSE_PASSWORD_ELEMENT.equals(qname)) {
- insidePasswort = true;
- tokenEncoding = attributes.getValue("", SoapHandlingUtility.WSSE_PASSWORD_TYPE_ATTRIBUTE);
- return;
- }
- }
-
- @Override
- public void characters(char[] ch, int start, int length) throws SAXException {
- if (done) {
- return;
- }
- if (insideEnvelope && insideHeader && insideSecurity && insideUsernameToken) {
- if (insideUsername) {
- user = new String(ch, start, length);
- }
- if (insidePasswort) {
- tokenRaw = new String(ch, start, length);
- }
- }
-
- }
-
- @Override
- public void endElement(String namespaceURI, String localName, String qNameText) throws SAXException {
- if (done) {
- return;
- }
- QName qname = new QName(namespaceURI, localName);
- if (SoapHandlingUtility.SOAPENV_ENVELOPE_ELEMENT.equals(qname)) {
- insideEnvelope = false;
- done = true;
- return;
- }
- if (SoapHandlingUtility.SOAPENV_HEADER_ELEMENT.equals(qname)) {
- insideHeader = false;
- return;
- }
- if (SoapHandlingUtility.WSSE_SECURITY_ELEMENT.equals(qname)) {
- insideSecurity = false;
- return;
- }
- if (SoapHandlingUtility.WSSE_USERNAME_TOKEN_ELEMENT.equals(qname)) {
- insideUsernameToken = false;
- return;
- }
- if (SoapHandlingUtility.WSSE_USERNAME_ELEMENT.equals(qname)) {
- insideUsername = false;
- return;
- }
- if (SoapHandlingUtility.WSSE_PASSWORD_ELEMENT.equals(qname)) {
- insidePasswort = false;
- return;
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.security.AccessController;
+import java.security.Principal;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+
+import javax.security.auth.Subject;
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletInputStream;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletRequestWrapper;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.namespace.QName;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.eclipse.scout.commons.Base64Utility;
+import org.eclipse.scout.commons.EncryptionUtility;
+import org.eclipse.scout.commons.SoapHandlingUtility;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.commons.security.SimplePrincipal;
+import org.eclipse.scout.http.servletfilter.FilterConfigInjection;
+import org.eclipse.scout.http.servletfilter.security.SecureHttpServletRequestWrapper;
+import org.eclipse.scout.rt.server.internal.Activator;
+import org.xml.sax.Attributes;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/**
+ * Transformation filter used to create a subject based on the soap headers containing a virtual request (from ajax,
+ * rap)
+ * <p>
+ * If there is already a subject set as {@link Subject#getSubject(java.security.AccessControlContext)} then the filter
+ * is transparent.
+ * <p>
+ * Reads the soap wsse header and transforms it to a subject with the user principal. The password is the triple-des
+ * encoding of "${timestamp}:${username}" using the config.ini parameter <code>scout.ajax.token.key</code>
+ * <p>
+ * Normally this filters the alias /ajax
+ * <p>
+ * This filter is registered in the scout server plugin.xml as /ajax by default with order 1'000'010 and has the active
+ * flag set to true
+ */
+public class SoapWsseJaasFilter implements Filter {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(SoapWsseJaasFilter.class);
+
+ private static final byte[] tripleDesKey;
+ static {
+ String key = Activator.getDefault().getBundle().getBundleContext().getProperty("scout.ajax.token.key");
+ if (key == null) {
+ tripleDesKey = null;
+ }
+ else {
+ tripleDesKey = new byte[24];
+ byte[] keyBytes;
+ try {
+ keyBytes = key.getBytes("UTF-8");
+ System.arraycopy(keyBytes, 0, tripleDesKey, 0, Math.min(keyBytes.length, tripleDesKey.length));
+ }
+ catch (UnsupportedEncodingException e) {
+ LOG.error("reading property 'scout.ajax.token.key'", e);
+ }
+ }
+ }
+
+ private SAXParserFactory m_saxParserFactory;
+ private FilterConfigInjection m_injection;
+
+ @Override
+ public void init(FilterConfig config0) throws ServletException {
+ m_injection = new FilterConfigInjection(config0, getClass());
+ try {
+ m_saxParserFactory = SoapHandlingUtility.createSaxParserFactory();
+ }
+ catch (Exception e) {
+ throw new ServletException(e);
+ }
+ }
+
+ @Override
+ public void destroy() {
+ m_saxParserFactory = null;
+ m_injection = null;
+ }
+
+ @Override
+ public void doFilter(ServletRequest request, final ServletResponse response, final FilterChain chain) throws IOException, ServletException {
+ if (isSubjectSet()) {
+ chain.doFilter(request, response);
+ return;
+ }
+ FilterConfigInjection.FilterConfig config = m_injection.getConfig(request);
+ if (!config.isActive()) {
+ chain.doFilter(request, response);
+ return;
+ }
+
+ InputStream httpIn = request.getInputStream();
+ ByteArrayOutputStream cacheOut = new ByteArrayOutputStream();
+ Subject subject;
+ try {
+ subject = parseSubject(httpIn, cacheOut);
+ }
+ catch (Throwable t) {
+ LOG.warn("WS-Security check", t);
+ ((HttpServletResponse) response).sendError(HttpServletResponse.SC_FORBIDDEN);
+ return;
+ }
+ final InputStream cacheIn = new ByteArrayInputStream(cacheOut.toByteArray());
+ cacheOut = null;
+ //
+ final HttpServletRequestWrapper replayRequest = new HttpServletRequestWrapper((HttpServletRequest) request) {
+ @Override
+ public ServletInputStream getInputStream() throws IOException {
+ return new ServletInputStream() {
+ @Override
+ public int read() throws IOException {
+ return cacheIn.read();
+ }
+ };
+ }
+ };
+ continueChainWithPrincipal(subject, replayRequest, (HttpServletResponse) response, chain);
+ }
+
+ private void continueChainWithPrincipal(Subject subject, final HttpServletRequest req, final HttpServletResponse res, final FilterChain chain) throws IOException, ServletException {
+ try {
+ Subject.doAs(
+ subject,
+ new PrivilegedExceptionAction<Object>() {
+ @Override
+ public Object run() throws Exception {
+ Principal principal = Subject.getSubject(AccessController.getContext()).getPrincipals().iterator().next();
+ HttpServletRequest secureReq = new SecureHttpServletRequestWrapper(req, principal);
+ chain.doFilter(secureReq, res);
+ return null;
+ }
+ }
+ );
+ }
+ catch (PrivilegedActionException e) {
+ Throwable t = e.getCause();
+ if (t instanceof IOException) {
+ throw (IOException) t;
+ }
+ else if (t instanceof ServletException) {
+ throw (ServletException) t;
+ }
+ else {
+ throw new ServletException(t);
+ }
+ }
+ }
+
+ protected Subject parseSubject(final InputStream httpIn, final ByteArrayOutputStream cacheOut) throws Exception {
+ InputStream filterIn = new InputStream() {
+ @Override
+ public int read() throws IOException {
+ int ch = httpIn.read();
+ if (ch < 0) {
+ return ch;
+ }
+ cacheOut.write(ch);
+ return ch;
+ }
+
+ @Override
+ public int read(byte[] b) throws IOException {
+ int n = httpIn.read(b);
+ if (n <= 0) {
+ return n;
+ }
+ cacheOut.write(b, 0, n);
+ return n;
+ }
+
+ @Override
+ public int read(byte[] b, int off, int len) throws IOException {
+ int n = httpIn.read(b, off, len);
+ if (n <= 0) {
+ return n;
+ }
+ cacheOut.write(b, off, n);
+ return n;
+ }
+ };
+ WSSEUserTokenHandler handler = new WSSEUserTokenHandler();
+ SoapHandlingUtility.createSaxParser(m_saxParserFactory).parse(new InputSource(filterIn), handler);
+ return createSubject(cleanString(handler.user), cleanString(handler.tokenRaw), cleanString(handler.tokenEncoding));
+ }
+
+ /**
+ * override this method to do additional checks on credentials
+ */
+ protected Subject createSubject(String user, String tokenRaw, String tokenEncoding) throws Exception {
+ if (user == null || tokenRaw == null) {
+ LOG.error("Ajax back-end call contains no ws-security token. Check if the config.ini of the /rap and the /ajax webapp contains the property 'scout.ajax.token.key'.");
+ throw new SecurityException("SOAP header contains no ws-security token");
+ }
+ byte[] token = Base64Utility.decode(tokenRaw);
+ String msg = new String(EncryptionUtility.decrypt(token, tripleDesKey), "UTF-8");
+ String[] tupel = msg.split(":", 2);
+ long timestamp = Long.parseLong(tupel[0]);
+ String userRef = tupel[1];
+ if (timestamp < 0L || userRef == null || !userRef.equals(user)) {
+ throw new SecurityException("SOAP header contains no ws-security token");
+ }
+ Subject subject = new Subject();
+ subject.getPrincipals().add(new SimplePrincipal(user));
+ subject.setReadOnly();
+ return subject;
+ }
+
+ private boolean isSubjectSet() {
+ Subject subject = Subject.getSubject(AccessController.getContext());
+ if (subject == null) {
+ return false;
+ }
+ if (subject.getPrincipals().size() == 0) {
+ return false;
+ }
+ String name = subject.getPrincipals().iterator().next().getName();
+ if (name == null || name.trim().length() == 0) {
+ return false;
+ }
+ return true;
+ }
+
+ private String cleanString(String s) {
+ if (s == null) {
+ return null;
+ }
+ s = s.trim();
+ if (s.length() == 0) {
+ return null;
+ }
+ if (s.equalsIgnoreCase("null")) {
+ return null;
+ }
+ return s;
+ }
+
+ /**
+ * <pre>
+ * <wsse:Security soapenv:mustUnderstand="1">
+ * <wsse:UsernameToken>
+ * <wsse:Username>user</wsse:Username>
+ * <wsse:Password Type="http://...#Virtual">QDgxVkqYnuqk...==</wsse:Password>
+ * </wsse:UsernameToken>
+ * </wsse:Security>
+ * </pre>
+ */
+ private static class WSSEUserTokenHandler extends DefaultHandler {
+ public String user;
+ public String tokenEncoding;
+ public String tokenRaw;
+ //
+ private boolean insideEnvelope;
+ private boolean insideHeader;
+ private boolean insideSecurity;
+ private boolean insideUsernameToken;
+ private boolean insideUsername;
+ private boolean insidePasswort;
+ private boolean done;
+
+ @Override
+ public void startElement(String namespaceURI, String localName, String qNameText, Attributes attributes) throws SAXException {
+ if (done) {
+ return;
+ }
+ QName qname = new QName(namespaceURI, localName);
+ if (SoapHandlingUtility.SOAPENV_ENVELOPE_ELEMENT.equals(qname)) {
+ insideEnvelope = true;
+ return;
+ }
+ if (SoapHandlingUtility.SOAPENV_HEADER_ELEMENT.equals(qname)) {
+ insideHeader = true;
+ return;
+ }
+ if (SoapHandlingUtility.WSSE_SECURITY_ELEMENT.equals(qname)) {
+ insideSecurity = true;
+ return;
+ }
+ if (SoapHandlingUtility.WSSE_USERNAME_TOKEN_ELEMENT.equals(qname)) {
+ insideUsernameToken = true;
+ return;
+ }
+ if (SoapHandlingUtility.WSSE_USERNAME_ELEMENT.equals(qname)) {
+ insideUsername = true;
+ return;
+ }
+ if (SoapHandlingUtility.WSSE_PASSWORD_ELEMENT.equals(qname)) {
+ insidePasswort = true;
+ tokenEncoding = attributes.getValue("", SoapHandlingUtility.WSSE_PASSWORD_TYPE_ATTRIBUTE);
+ return;
+ }
+ }
+
+ @Override
+ public void characters(char[] ch, int start, int length) throws SAXException {
+ if (done) {
+ return;
+ }
+ if (insideEnvelope && insideHeader && insideSecurity && insideUsernameToken) {
+ if (insideUsername) {
+ user = new String(ch, start, length);
+ }
+ if (insidePasswort) {
+ tokenRaw = new String(ch, start, length);
+ }
+ }
+
+ }
+
+ @Override
+ public void endElement(String namespaceURI, String localName, String qNameText) throws SAXException {
+ if (done) {
+ return;
+ }
+ QName qname = new QName(namespaceURI, localName);
+ if (SoapHandlingUtility.SOAPENV_ENVELOPE_ELEMENT.equals(qname)) {
+ insideEnvelope = false;
+ done = true;
+ return;
+ }
+ if (SoapHandlingUtility.SOAPENV_HEADER_ELEMENT.equals(qname)) {
+ insideHeader = false;
+ return;
+ }
+ if (SoapHandlingUtility.WSSE_SECURITY_ELEMENT.equals(qname)) {
+ insideSecurity = false;
+ return;
+ }
+ if (SoapHandlingUtility.WSSE_USERNAME_TOKEN_ELEMENT.equals(qname)) {
+ insideUsernameToken = false;
+ return;
+ }
+ if (SoapHandlingUtility.WSSE_USERNAME_ELEMENT.equals(qname)) {
+ insideUsername = false;
+ return;
+ }
+ if (SoapHandlingUtility.WSSE_PASSWORD_ELEMENT.equals(qname)) {
+ insidePasswort = false;
+ return;
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/ThreadContext.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/ThreadContext.java
index 7fbec5ccfc..b6284ed191 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/ThreadContext.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/ThreadContext.java
@@ -1,93 +1,93 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server;
-
-import java.util.Map;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.server.transaction.ITransaction;
-
-/**
- * This singleton is a container for objects associated with the
- * current Thread These objects are not accessible outside the Thread
- * This eliminates the need of creating special event dispatching
- * threads to run job queues, handle Thread-based session values etc.
- */
-
-public final class ThreadContext {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(ThreadContext.class);
- private static final ThreadLocal<HttpServletRequest> HTTP_SERVLET_REQUEST = new ThreadLocal<HttpServletRequest>();
- private static final ThreadLocal<HttpServletResponse> HTTP_SERVLET_RESPONSE = new ThreadLocal<HttpServletResponse>();
- private static final ThreadLocal<IServerSession> SERVER_SESSION = new ThreadLocal<IServerSession>();
- private static final ThreadLocal<ITransaction> TRANSACTION = new ThreadLocal<ITransaction>();
-
- private ThreadContext() {
- }
-
- public static HttpServletRequest getHttpServletRequest() {
- return HTTP_SERVLET_REQUEST.get();
- }
-
- public static HttpServletResponse getHttpServletResponse() {
- return HTTP_SERVLET_RESPONSE.get();
- }
-
- public static IServerSession getServerSession() {
- return SERVER_SESSION.get();
- }
-
- public static ITransaction getTransaction() {
- return TRANSACTION.get();
- }
-
- @SuppressWarnings("deprecation")
- public static Map<Class, Object> backup() {
- return ThreadContextLegacy.backup();
- }
-
- @SuppressWarnings("deprecation")
- public static void restore(Map<Class, Object> map) {
- ThreadContextLegacy.restore(map);
- }
-
- public static void putHttpServletRequest(HttpServletRequest value) {
- HTTP_SERVLET_REQUEST.set(value);
- }
-
- public static void putHttpServletResponse(HttpServletResponse value) {
- HTTP_SERVLET_RESPONSE.set(value);
- }
-
- public static void putServerSession(IServerSession value) {
- SERVER_SESSION.set(value);
- }
-
- public static void putTransaction(ITransaction value) {
- TRANSACTION.set(value);
- }
-
- @SuppressWarnings("deprecation")
- @Deprecated
- public static <T> T get(Class<T> key) {
- return ThreadContextLegacy.get(key);
- }
-
- @SuppressWarnings("deprecation")
- @Deprecated
- public static <T> void put(T value) {
- ThreadContextLegacy.put(value);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server;
+
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.server.transaction.ITransaction;
+
+/**
+ * This singleton is a container for objects associated with the
+ * current Thread These objects are not accessible outside the Thread
+ * This eliminates the need of creating special event dispatching
+ * threads to run job queues, handle Thread-based session values etc.
+ */
+
+public final class ThreadContext {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(ThreadContext.class);
+ private static final ThreadLocal<HttpServletRequest> HTTP_SERVLET_REQUEST = new ThreadLocal<HttpServletRequest>();
+ private static final ThreadLocal<HttpServletResponse> HTTP_SERVLET_RESPONSE = new ThreadLocal<HttpServletResponse>();
+ private static final ThreadLocal<IServerSession> SERVER_SESSION = new ThreadLocal<IServerSession>();
+ private static final ThreadLocal<ITransaction> TRANSACTION = new ThreadLocal<ITransaction>();
+
+ private ThreadContext() {
+ }
+
+ public static HttpServletRequest getHttpServletRequest() {
+ return HTTP_SERVLET_REQUEST.get();
+ }
+
+ public static HttpServletResponse getHttpServletResponse() {
+ return HTTP_SERVLET_RESPONSE.get();
+ }
+
+ public static IServerSession getServerSession() {
+ return SERVER_SESSION.get();
+ }
+
+ public static ITransaction getTransaction() {
+ return TRANSACTION.get();
+ }
+
+ @SuppressWarnings("deprecation")
+ public static Map<Class, Object> backup() {
+ return ThreadContextLegacy.backup();
+ }
+
+ @SuppressWarnings("deprecation")
+ public static void restore(Map<Class, Object> map) {
+ ThreadContextLegacy.restore(map);
+ }
+
+ public static void putHttpServletRequest(HttpServletRequest value) {
+ HTTP_SERVLET_REQUEST.set(value);
+ }
+
+ public static void putHttpServletResponse(HttpServletResponse value) {
+ HTTP_SERVLET_RESPONSE.set(value);
+ }
+
+ public static void putServerSession(IServerSession value) {
+ SERVER_SESSION.set(value);
+ }
+
+ public static void putTransaction(ITransaction value) {
+ TRANSACTION.set(value);
+ }
+
+ @SuppressWarnings("deprecation")
+ @Deprecated
+ public static <T> T get(Class<T> key) {
+ return ThreadContextLegacy.get(key);
+ }
+
+ @SuppressWarnings("deprecation")
+ @Deprecated
+ public static <T> void put(T value) {
+ ThreadContextLegacy.put(value);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/ThreadContextLegacy.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/ThreadContextLegacy.java
index 0802b924ce..baf9c8e409 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/ThreadContextLegacy.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/ThreadContextLegacy.java
@@ -1,189 +1,189 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Locale;
-import java.util.Map;
-import java.util.WeakHashMap;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.eclipse.scout.commons.LocaleThreadLocal;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.server.transaction.ITransaction;
-
-/**
- * This legacy utility will be removed in the next release.
- *
- * @deprecated
- */
-@Deprecated
-public final class ThreadContextLegacy {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(ThreadContextLegacy.class);
-
- private ThreadContextLegacy() {
- }
-
- private static final Object MAP_LOCK;
- private static final WeakHashMap<Thread, HashMap<Class, Object>> MAP;
-
- static {
- MAP_LOCK = new Object();
- MAP = new WeakHashMap<Thread, HashMap<Class, Object>>();
- }
-
- private static HashMap<Class, Object> getThreadMap(boolean autoCreate) {
- synchronized (MAP_LOCK) {
- HashMap<Class, Object> threadMap = MAP.get(Thread.currentThread());
- if (threadMap == null && autoCreate) {
- threadMap = new HashMap<Class, Object>();
- MAP.put(Thread.currentThread(), threadMap);
- }
- return threadMap;
- }
- }
-
- public static <T> T getCustomValue(Class<T> key) {
- return getInternal(key);
- }
-
- public static <T> T get(Class<T> key) {
- return getInternal(key);
- }
-
- @SuppressWarnings("unchecked")
- private static <T> T getInternal(Class<T> key) {
- if (key == null) {
- return null;
- }
- if (Locale.class.isAssignableFrom(key)) {
- return (T) LocaleThreadLocal.get();
- }
- if (HttpServletRequest.class.isAssignableFrom(key)) {
- return (T) ThreadContext.getHttpServletRequest();
- }
- if (HttpServletResponse.class.isAssignableFrom(key)) {
- return (T) ThreadContext.getHttpServletResponse();
- }
- if (IServerSession.class.isAssignableFrom(key)) {
- return (T) ThreadContext.getServerSession();
- }
- if (ITransaction.class.isAssignableFrom(key)) {
- return (T) ThreadContext.getTransaction();
- }
- //
- HashMap<Class, Object> threadMap = getThreadMap(false);
- if (threadMap != null) {
- return (T) threadMap.get(key);
- }
- return null;
- }
-
- public static Map<Class, Object> backup() {
- HashMap<Class, Object> copyMap = new HashMap<Class, Object>();
- Map<Class, Object> rawMap = getThreadMap(false);
- if (rawMap != null) {
- copyMap.putAll(rawMap);
- }
- copyMap.put(HttpServletRequest.class, ThreadContext.getHttpServletRequest());
- copyMap.put(HttpServletResponse.class, ThreadContext.getHttpServletResponse());
- copyMap.put(IServerSession.class, ThreadContext.getServerSession());
- copyMap.put(ITransaction.class, ThreadContext.getTransaction());
- return copyMap;
- }
-
- public static void restore(Map<Class, Object> map) {
- HashMap<Class, Object> copyMap = (map != null ? new HashMap<Class, Object>(map) : new HashMap<Class, Object>());
- ThreadContext.putHttpServletRequest((HttpServletRequest) copyMap.remove(HttpServletRequest.class));
- ThreadContext.putHttpServletResponse((HttpServletResponse) copyMap.remove(HttpServletResponse.class));
- ThreadContext.putServerSession((IServerSession) copyMap.remove(IServerSession.class));
- ThreadContext.putTransaction((ITransaction) copyMap.remove(ITransaction.class));
- synchronized (MAP_LOCK) {
- MAP.put(Thread.currentThread(), copyMap);
- }
- }
-
- /**
- * store the value in the current thread context (with all interfaces and
- * super classes of value as keys)
- */
- public static <T> void putCustomValue(T value) {
- putInternal(value);
- }
-
- public static <T> void put(T value) {
- putInternal(value);
- }
-
- private static <T> void putInternal(T value) {
- if (value == null) {
- return;
- }
- if (value instanceof Locale) {
- LocaleThreadLocal.set((Locale) value);
- return;
- }
- if (value instanceof HttpServletRequest) {
- ThreadContext.putHttpServletRequest((HttpServletRequest) value);
- return;
- }
- if (value instanceof HttpServletResponse) {
- ThreadContext.putHttpServletResponse((HttpServletResponse) value);
- return;
- }
- if (value instanceof IServerSession) {
- ThreadContext.putServerSession((IServerSession) value);
- return;
- }
- if (value instanceof ITransaction) {
- ThreadContext.putTransaction((ITransaction) value);
- return;
- }
- HashMap<Class, Object> threadMap = getThreadMap(true);
- HashSet<Class> keys = new HashSet<Class>();
- enumKeys(value.getClass(), keys);
- for (Class key : keys) {
- threadMap.put(key, value);
- }
- }
-
- public static <T> void clear(T value) {
- clearInternal(value);
- }
-
- public static <T> void clearInternal(T value) {
- if (value == null) {
- return;
- }
- HashMap<Class, Object> threadMap = getThreadMap(false);
- if (threadMap != null) {
- HashSet<Class> keys = new HashSet<Class>();
- enumKeys(value.getClass(), keys);
- for (Class key : keys) {
- threadMap.remove(key);
- }
- }
- }
-
- private static void enumKeys(Class c, HashSet<Class> keys) {
- if (c != null) {
- keys.add(c);
- for (Class i : c.getInterfaces()) {
- enumKeys(i, keys);
- }
- enumKeys(c.getSuperclass(), keys);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Locale;
+import java.util.Map;
+import java.util.WeakHashMap;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.eclipse.scout.commons.LocaleThreadLocal;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.server.transaction.ITransaction;
+
+/**
+ * This legacy utility will be removed in the next release.
+ *
+ * @deprecated
+ */
+@Deprecated
+public final class ThreadContextLegacy {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(ThreadContextLegacy.class);
+
+ private ThreadContextLegacy() {
+ }
+
+ private static final Object MAP_LOCK;
+ private static final WeakHashMap<Thread, HashMap<Class, Object>> MAP;
+
+ static {
+ MAP_LOCK = new Object();
+ MAP = new WeakHashMap<Thread, HashMap<Class, Object>>();
+ }
+
+ private static HashMap<Class, Object> getThreadMap(boolean autoCreate) {
+ synchronized (MAP_LOCK) {
+ HashMap<Class, Object> threadMap = MAP.get(Thread.currentThread());
+ if (threadMap == null && autoCreate) {
+ threadMap = new HashMap<Class, Object>();
+ MAP.put(Thread.currentThread(), threadMap);
+ }
+ return threadMap;
+ }
+ }
+
+ public static <T> T getCustomValue(Class<T> key) {
+ return getInternal(key);
+ }
+
+ public static <T> T get(Class<T> key) {
+ return getInternal(key);
+ }
+
+ @SuppressWarnings("unchecked")
+ private static <T> T getInternal(Class<T> key) {
+ if (key == null) {
+ return null;
+ }
+ if (Locale.class.isAssignableFrom(key)) {
+ return (T) LocaleThreadLocal.get();
+ }
+ if (HttpServletRequest.class.isAssignableFrom(key)) {
+ return (T) ThreadContext.getHttpServletRequest();
+ }
+ if (HttpServletResponse.class.isAssignableFrom(key)) {
+ return (T) ThreadContext.getHttpServletResponse();
+ }
+ if (IServerSession.class.isAssignableFrom(key)) {
+ return (T) ThreadContext.getServerSession();
+ }
+ if (ITransaction.class.isAssignableFrom(key)) {
+ return (T) ThreadContext.getTransaction();
+ }
+ //
+ HashMap<Class, Object> threadMap = getThreadMap(false);
+ if (threadMap != null) {
+ return (T) threadMap.get(key);
+ }
+ return null;
+ }
+
+ public static Map<Class, Object> backup() {
+ HashMap<Class, Object> copyMap = new HashMap<Class, Object>();
+ Map<Class, Object> rawMap = getThreadMap(false);
+ if (rawMap != null) {
+ copyMap.putAll(rawMap);
+ }
+ copyMap.put(HttpServletRequest.class, ThreadContext.getHttpServletRequest());
+ copyMap.put(HttpServletResponse.class, ThreadContext.getHttpServletResponse());
+ copyMap.put(IServerSession.class, ThreadContext.getServerSession());
+ copyMap.put(ITransaction.class, ThreadContext.getTransaction());
+ return copyMap;
+ }
+
+ public static void restore(Map<Class, Object> map) {
+ HashMap<Class, Object> copyMap = (map != null ? new HashMap<Class, Object>(map) : new HashMap<Class, Object>());
+ ThreadContext.putHttpServletRequest((HttpServletRequest) copyMap.remove(HttpServletRequest.class));
+ ThreadContext.putHttpServletResponse((HttpServletResponse) copyMap.remove(HttpServletResponse.class));
+ ThreadContext.putServerSession((IServerSession) copyMap.remove(IServerSession.class));
+ ThreadContext.putTransaction((ITransaction) copyMap.remove(ITransaction.class));
+ synchronized (MAP_LOCK) {
+ MAP.put(Thread.currentThread(), copyMap);
+ }
+ }
+
+ /**
+ * store the value in the current thread context (with all interfaces and
+ * super classes of value as keys)
+ */
+ public static <T> void putCustomValue(T value) {
+ putInternal(value);
+ }
+
+ public static <T> void put(T value) {
+ putInternal(value);
+ }
+
+ private static <T> void putInternal(T value) {
+ if (value == null) {
+ return;
+ }
+ if (value instanceof Locale) {
+ LocaleThreadLocal.set((Locale) value);
+ return;
+ }
+ if (value instanceof HttpServletRequest) {
+ ThreadContext.putHttpServletRequest((HttpServletRequest) value);
+ return;
+ }
+ if (value instanceof HttpServletResponse) {
+ ThreadContext.putHttpServletResponse((HttpServletResponse) value);
+ return;
+ }
+ if (value instanceof IServerSession) {
+ ThreadContext.putServerSession((IServerSession) value);
+ return;
+ }
+ if (value instanceof ITransaction) {
+ ThreadContext.putTransaction((ITransaction) value);
+ return;
+ }
+ HashMap<Class, Object> threadMap = getThreadMap(true);
+ HashSet<Class> keys = new HashSet<Class>();
+ enumKeys(value.getClass(), keys);
+ for (Class key : keys) {
+ threadMap.put(key, value);
+ }
+ }
+
+ public static <T> void clear(T value) {
+ clearInternal(value);
+ }
+
+ public static <T> void clearInternal(T value) {
+ if (value == null) {
+ return;
+ }
+ HashMap<Class, Object> threadMap = getThreadMap(false);
+ if (threadMap != null) {
+ HashSet<Class> keys = new HashSet<Class>();
+ enumKeys(value.getClass(), keys);
+ for (Class key : keys) {
+ threadMap.remove(key);
+ }
+ }
+ }
+
+ private static void enumKeys(Class c, HashSet<Class> keys) {
+ if (c != null) {
+ keys.add(c);
+ for (Class i : c.getInterfaces()) {
+ enumKeys(i, keys);
+ }
+ enumKeys(c.getSuperclass(), keys);
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/VirtualSessionCache.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/VirtualSessionCache.java
index 9e892c75ad..d681a30422 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/VirtualSessionCache.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/VirtualSessionCache.java
@@ -1,62 +1,62 @@
-package org.eclipse.scout.rt.server;
-
-import org.eclipse.scout.commons.AbstractDynamicHashMap;
-
-class VirtualSessionCache extends AbstractDynamicHashMap<String, IServerSession> {
- private static final long serialVersionUID = 1L;
-
- private long m_sessionTimeoutMillis = 300000L;//default 5 minutes
- private long m_nextMaintenance = 0L;//default 5 minutes
-
- public long getSessionTimeoutMillis() {
- return m_sessionTimeoutMillis;
- }
-
- public void setSessionTimeoutMillis(long sessionTimeoutMillis) {
- m_sessionTimeoutMillis = sessionTimeoutMillis;
- }
-
- @Override
- protected void beforeAccessToInternalMap() {
- if (System.currentTimeMillis() > m_nextMaintenance) {
- validateInternalMap();
- m_nextMaintenance = System.currentTimeMillis() + m_sessionTimeoutMillis / 2;
- }
- }
-
- @Override
- protected DynamicEntry<IServerSession> createDynamicEntry(IServerSession value) {
- return new VirtualSessionEntry(value, getSessionTimeoutMillis());
- }
-
- @Override
- protected boolean isEntryValid(DynamicEntry e) {
- VirtualSessionEntry v = (VirtualSessionEntry) e;
- return v.getTimestamp() + v.getInactivityTimeout() >= System.currentTimeMillis();
- }
-
- static class VirtualSessionEntry extends DynamicEntry<IServerSession> {
- private long m_time;
- private long m_timeout;
-
- public VirtualSessionEntry(IServerSession value, long timeout) {
- super(value);
- m_timeout = timeout;
- m_time = System.currentTimeMillis();
- }
-
- public long getTimestamp() {
- return m_time;
- }
-
- public long getInactivityTimeout() {
- return m_timeout;
- }
-
- @Override
- public void touch() {
- m_time = System.currentTimeMillis();
- }
-
- }
-}
+package org.eclipse.scout.rt.server;
+
+import org.eclipse.scout.commons.AbstractDynamicHashMap;
+
+class VirtualSessionCache extends AbstractDynamicHashMap<String, IServerSession> {
+ private static final long serialVersionUID = 1L;
+
+ private long m_sessionTimeoutMillis = 300000L;//default 5 minutes
+ private long m_nextMaintenance = 0L;//default 5 minutes
+
+ public long getSessionTimeoutMillis() {
+ return m_sessionTimeoutMillis;
+ }
+
+ public void setSessionTimeoutMillis(long sessionTimeoutMillis) {
+ m_sessionTimeoutMillis = sessionTimeoutMillis;
+ }
+
+ @Override
+ protected void beforeAccessToInternalMap() {
+ if (System.currentTimeMillis() > m_nextMaintenance) {
+ validateInternalMap();
+ m_nextMaintenance = System.currentTimeMillis() + m_sessionTimeoutMillis / 2;
+ }
+ }
+
+ @Override
+ protected DynamicEntry<IServerSession> createDynamicEntry(IServerSession value) {
+ return new VirtualSessionEntry(value, getSessionTimeoutMillis());
+ }
+
+ @Override
+ protected boolean isEntryValid(DynamicEntry e) {
+ VirtualSessionEntry v = (VirtualSessionEntry) e;
+ return v.getTimestamp() + v.getInactivityTimeout() >= System.currentTimeMillis();
+ }
+
+ static class VirtualSessionEntry extends DynamicEntry<IServerSession> {
+ private long m_time;
+ private long m_timeout;
+
+ public VirtualSessionEntry(IServerSession value, long timeout) {
+ super(value);
+ m_timeout = timeout;
+ m_time = System.currentTimeMillis();
+ }
+
+ public long getTimestamp() {
+ return m_time;
+ }
+
+ public long getInactivityTimeout() {
+ return m_timeout;
+ }
+
+ @Override
+ public void touch() {
+ m_time = System.currentTimeMillis();
+ }
+
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/AbstractHtmlAction.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/AbstractHtmlAction.java
index b150ad9e68..04c13dc4bb 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/AbstractHtmlAction.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/AbstractHtmlAction.java
@@ -1,71 +1,71 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.admin.html;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public abstract class AbstractHtmlAction implements Runnable {
- private HashMap<String, String> m_formParameters = new HashMap<String, String>();
- private String m_plainText;
- private String m_htmlText;
- private Throwable m_exception;
- private String m_uid;
-
- public AbstractHtmlAction(String uid) {
- super();
- m_uid = uid;
- }
-
- public String getUid() {
- return m_uid;
- }
-
- public void setFormParameters(Map<String, String> m) {
- m_formParameters = new HashMap<String, String>(m);
- }
-
- public Map getFormParameters() {
- return m_formParameters;
- }
-
- public void setPlainText(String s) {
- m_plainText = s;
- }
-
- public String getPlainText() {
- return m_plainText;
- }
-
- public void setHtmlText(String s) {
- m_htmlText = s;
- }
-
- public String getHtmlText() {
- return m_htmlText;
- }
-
- public void setException(Throwable e) {
- m_exception = e;
- }
-
- public Throwable getException() {
- return m_exception;
- }
-
- public String getFormParameter(String name, String defaultValue) {
- String s = m_formParameters.get(name);
- if (s == null) {
- s = defaultValue;
- }
- return s;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.admin.html;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public abstract class AbstractHtmlAction implements Runnable {
+ private HashMap<String, String> m_formParameters = new HashMap<String, String>();
+ private String m_plainText;
+ private String m_htmlText;
+ private Throwable m_exception;
+ private String m_uid;
+
+ public AbstractHtmlAction(String uid) {
+ super();
+ m_uid = uid;
+ }
+
+ public String getUid() {
+ return m_uid;
+ }
+
+ public void setFormParameters(Map<String, String> m) {
+ m_formParameters = new HashMap<String, String>(m);
+ }
+
+ public Map getFormParameters() {
+ return m_formParameters;
+ }
+
+ public void setPlainText(String s) {
+ m_plainText = s;
+ }
+
+ public String getPlainText() {
+ return m_plainText;
+ }
+
+ public void setHtmlText(String s) {
+ m_htmlText = s;
+ }
+
+ public String getHtmlText() {
+ return m_htmlText;
+ }
+
+ public void setException(Throwable e) {
+ m_exception = e;
+ }
+
+ public Throwable getException() {
+ return m_exception;
+ }
+
+ public String getFormParameter(String name, String defaultValue) {
+ String s = m_formParameters.get(name);
+ if (s == null) {
+ s = defaultValue;
+ }
+ return s;
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/AdminSession.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/AdminSession.java
index d5b88e897d..cfb863a71d 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/AdminSession.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/AdminSession.java
@@ -1,104 +1,104 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.admin.html;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import javax.servlet.ServletOutputStream;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.rt.server.admin.html.view.TopView;
-import org.eclipse.scout.rt.server.admin.html.widget.table.HtmlComponent;
-import org.eclipse.scout.rt.server.admin.inspector.ProcessInspector;
-import org.eclipse.scout.rt.shared.OfficialVersion;
-
-public class AdminSession {
- private TopView m_topView;
- private Map<String, AbstractHtmlAction> m_actionMap;
-
- public AdminSession() {
- m_topView = new TopView(this);
- m_actionMap = new HashMap<String, AbstractHtmlAction>();
- }
-
- public void serviceRequest(HttpServletRequest req, HttpServletResponse res) throws IOException {
- HtmlComponent emitter = new HtmlComponent(req, res);
- //
- String actionId = req.getParameter("actionId");
- if (actionId != null) {
- AbstractHtmlAction action = getAction(actionId);
- if (action != null) {
- HashMap<String, String> paramMap = new HashMap<String, String>();
- for (Iterator it = req.getParameterMap().keySet().iterator(); it.hasNext();) {
- String n = (String) it.next();
- String v = StringUtility.valueOf(req.getParameter(n));
- paramMap.put(n, v);
- }
- // set parameters
- action.setFormParameters(paramMap);
- try {
- action.run();
- }
- catch (Exception e) {
- action.setException(e);
- }
- emitter.setInvokedAction(action);
- }
- }
- ProcessInspector.getDefault().update();
- m_topView.produceBody(emitter);
- setActionMap(emitter.getActionMap());
- // prepare output
- res.setContentType("text/html");
- res.setDateHeader("Expires", -1);
- res.setHeader("Cache-Control", "no-cache");
- res.setHeader("pragma", "no-cache");
- // output
- ServletOutputStream out = res.getOutputStream();
- out.println("<html>");
- out.println("<head>");
- out.println("<title>Eclipse Scout</title>");
- out.println("<style>");
- out.println("body {font-family: sans-serif; font-size: 12; background-color : #F6F6F6;}");
- out.println("a,a:VISITED {color: #6666ff;text-decoration: none;}");
- out.println("table {font-size: 12; empty-cells: show;}");
- out.println("th {text-align: left;vertical-align: top; padding-left: 2; background-color : #cccccc;}");
- out.println("td {text-align: left;vertical-align: top; padding-left: 2;}");
- out.println("p {margin-top: 4; margin-bottom: 4; padding-top: 4; padding-bottom: 4;}");
- out.println(".copyright {font-size: 10;}");
- out.println("</style>");
- out.println("</head>");
- out.println("<body>");
- out.println("<h3>Eclipse Scout</h3>");
- out.print(emitter.getProducedHtml());
- out.println("<p class=\"copyright\">&copy; " + OfficialVersion.COPYRIGHT + "</p>");
- out.println("</body>");
- out.println("</html>");
- }
-
- private AbstractHtmlAction getAction(String actionId) {
- return m_actionMap.get(actionId);
- }
-
- private void setActionMap(Map<String, AbstractHtmlAction> newActionMap) {
- m_actionMap = new HashMap<String, AbstractHtmlAction>(newActionMap);
- }
-
- public TopView getTopView() {
- return m_topView;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.admin.html;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.rt.server.admin.html.view.TopView;
+import org.eclipse.scout.rt.server.admin.html.widget.table.HtmlComponent;
+import org.eclipse.scout.rt.server.admin.inspector.ProcessInspector;
+import org.eclipse.scout.rt.shared.OfficialVersion;
+
+public class AdminSession {
+ private TopView m_topView;
+ private Map<String, AbstractHtmlAction> m_actionMap;
+
+ public AdminSession() {
+ m_topView = new TopView(this);
+ m_actionMap = new HashMap<String, AbstractHtmlAction>();
+ }
+
+ public void serviceRequest(HttpServletRequest req, HttpServletResponse res) throws IOException {
+ HtmlComponent emitter = new HtmlComponent(req, res);
+ //
+ String actionId = req.getParameter("actionId");
+ if (actionId != null) {
+ AbstractHtmlAction action = getAction(actionId);
+ if (action != null) {
+ HashMap<String, String> paramMap = new HashMap<String, String>();
+ for (Iterator it = req.getParameterMap().keySet().iterator(); it.hasNext();) {
+ String n = (String) it.next();
+ String v = StringUtility.valueOf(req.getParameter(n));
+ paramMap.put(n, v);
+ }
+ // set parameters
+ action.setFormParameters(paramMap);
+ try {
+ action.run();
+ }
+ catch (Exception e) {
+ action.setException(e);
+ }
+ emitter.setInvokedAction(action);
+ }
+ }
+ ProcessInspector.getDefault().update();
+ m_topView.produceBody(emitter);
+ setActionMap(emitter.getActionMap());
+ // prepare output
+ res.setContentType("text/html");
+ res.setDateHeader("Expires", -1);
+ res.setHeader("Cache-Control", "no-cache");
+ res.setHeader("pragma", "no-cache");
+ // output
+ ServletOutputStream out = res.getOutputStream();
+ out.println("<html>");
+ out.println("<head>");
+ out.println("<title>Eclipse Scout</title>");
+ out.println("<style>");
+ out.println("body {font-family: sans-serif; font-size: 12; background-color : #F6F6F6;}");
+ out.println("a,a:VISITED {color: #6666ff;text-decoration: none;}");
+ out.println("table {font-size: 12; empty-cells: show;}");
+ out.println("th {text-align: left;vertical-align: top; padding-left: 2; background-color : #cccccc;}");
+ out.println("td {text-align: left;vertical-align: top; padding-left: 2;}");
+ out.println("p {margin-top: 4; margin-bottom: 4; padding-top: 4; padding-bottom: 4;}");
+ out.println(".copyright {font-size: 10;}");
+ out.println("</style>");
+ out.println("</head>");
+ out.println("<body>");
+ out.println("<h3>Eclipse Scout</h3>");
+ out.print(emitter.getProducedHtml());
+ out.println("<p class=\"copyright\">&copy; " + OfficialVersion.COPYRIGHT + "</p>");
+ out.println("</body>");
+ out.println("</html>");
+ }
+
+ private AbstractHtmlAction getAction(String actionId) {
+ return m_actionMap.get(actionId);
+ }
+
+ private void setActionMap(Map<String, AbstractHtmlAction> newActionMap) {
+ m_actionMap = new HashMap<String, AbstractHtmlAction>(newActionMap);
+ }
+
+ public TopView getTopView() {
+ return m_topView;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/IHtmlEmitter.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/IHtmlEmitter.java
index f4a62613aa..199ea29080 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/IHtmlEmitter.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/IHtmlEmitter.java
@@ -1,20 +1,20 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.admin.html;
-
-import java.util.Map;
-
-public interface IHtmlEmitter {
-
- Map<String, AbstractHtmlAction> getActionMap();
-
- String getProducedHtml();
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.admin.html;
+
+import java.util.Map;
+
+public interface IHtmlEmitter {
+
+ Map<String, AbstractHtmlAction> getActionMap();
+
+ String getProducedHtml();
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/IView.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/IView.java
index 6f05459c4d..365b4300b9 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/IView.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/IView.java
@@ -1,24 +1,24 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.admin.html;
-
-import org.eclipse.scout.rt.server.admin.html.widget.table.HtmlComponent;
-
-public interface IView {
-
- void produceTitle(HtmlComponent p);
-
- void produceBody(HtmlComponent p);
-
- boolean isVisible();
-
- void activated();
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.admin.html;
+
+import org.eclipse.scout.rt.server.admin.html.widget.table.HtmlComponent;
+
+public interface IView {
+
+ void produceTitle(HtmlComponent p);
+
+ void produceBody(HtmlComponent p);
+
+ boolean isVisible();
+
+ void activated();
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/view/CallsView.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/view/CallsView.java
index 320d49c8e3..b21814414f 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/view/CallsView.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/view/CallsView.java
@@ -1,332 +1,332 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.admin.html.view;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.lang.reflect.Array;
-import java.text.SimpleDateFormat;
-import java.util.Collection;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.TreeMap;
-
-import org.eclipse.scout.commons.CompositeObject;
-import org.eclipse.scout.rt.server.admin.html.AbstractHtmlAction;
-import org.eclipse.scout.rt.server.admin.html.AdminSession;
-import org.eclipse.scout.rt.server.admin.html.widget.table.HtmlComponent;
-import org.eclipse.scout.rt.server.admin.inspector.CallInspector;
-import org.eclipse.scout.rt.server.admin.inspector.ProcessInspector;
-import org.eclipse.scout.rt.server.admin.inspector.SessionInspector;
-import org.eclipse.scout.rt.server.admin.inspector.info.CallInfo;
-import org.eclipse.scout.rt.server.transaction.ITransactionMember;
-
-public class CallsView extends DefaultView {
- private CallInspector m_selectedCall;
-
- public CallsView(AdminSession as) {
- super(as);
- }
-
- public CallInspector getSelectedCall() {
- return m_selectedCall;
- }
-
- @Override
- public boolean isVisible() {
- return ProcessInspector.getDefault().isEnabled() && getAdminSession().getTopView().getSessionsView().getSelectedSession() != null;
- }
-
- @Override
- public void produceTitle(HtmlComponent p) {
- final SessionInspector session = getAdminSession().getTopView().getSessionsView().getSelectedSession();
- p.print("Calls of " + (session != null ? session.getInfo().getUserId() + "/" + session.getInfo().getSessionId() : "?"));
- }
-
- @Override
- public void produceBody(HtmlComponent p) {
- final SessionInspector session = getAdminSession().getTopView().getSessionsView().getSelectedSession();
- p.linkAction("Clear calls", new AbstractHtmlAction("clearCalls") {
- @Override
- public void run() {
- session.clearCallInspectors();
- }
- });
- p.p();
- //
- p.startTable(0, 5, 5);
- p.startTableRow();
- p.startTableCell();
- renderCallTable(p, session);
- p.startTableCell();
- // selected call
- if (m_selectedCall != null) {
- renderCallDetail(p, m_selectedCall);
- }
- p.endTableCell();
- p.endTableRow();
- p.endTable();
- }
-
- private void renderCallTable(HtmlComponent p, SessionInspector session) {
- TreeMap<CompositeObject, CallInspector> timeToCalls = new TreeMap<CompositeObject, CallInspector>();
- CallInspector[] callInspectors = session.getCallInspectors();
- for (int i = 0; i < callInspectors.length; i++) {
- long startTime = callInspectors[i].getInfo().getStartTime();
- timeToCalls.put(new CompositeObject(startTime, i), callInspectors[i]);
- }
- CallInspector[] sorted = timeToCalls.values().toArray(new CallInspector[timeToCalls.size()]);
- p.bold("Calls");
- p.startTable(1, 0, 3);
- p.startTableRow();
- p.tableHeaderCell("#");
- p.tableHeaderCell("Operation");
- p.tableHeaderCell("Started");
- p.tableHeaderCell("Duration");
- p.tableHeaderCell("Status");
- p.endTableRow();
- CallInspector validSelection = null;
- for (int i = sorted.length - 1; i >= 0; i--) {
- if (sorted[i] == m_selectedCall) {
- validSelection = m_selectedCall;
- }
- renderCallRow(p, i + 1, sorted[i]);
- }
- m_selectedCall = validSelection;
- p.endTable();
- }
-
- private void renderCallRow(HtmlComponent p, int index, final CallInspector call) {
- boolean selected = m_selectedCall != null && (m_selectedCall == call);
- SimpleDateFormat startFmt = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
- String serviceShortName = call.getInfo().getService();
- int i = Math.max(serviceShortName.lastIndexOf('.'), serviceShortName.lastIndexOf('$'));
- if (i >= 0) {
- serviceShortName = serviceShortName.substring(i + 1);
- }
- CallInfo info = call.getInfo();
- //
- p.startTableRow();
- p.tableCell("" + index);
- p.startTableCell();
- String callId = serviceShortName + "." + info.getOperation();
- String callKey = serviceShortName + "." + info.getOperation() + "." + info.getStartTime();
- if (selected) {
- p.focusAnchor();
- }
- p.startLinkAction(new AbstractHtmlAction("selectCall." + callKey) {
- @Override
- public void run() {
- m_selectedCall = call;
- }
- });
- if (selected) {
- p.bold(callId);
- }
- else {
- p.print(callId);
- }
- p.endLinkAction();
- p.endTableCell();
- p.startTableCell();
- p.printNoBreak(startFmt.format(new Date(info.getStartTime())));
- p.endTableCell();
- p.startTableCell();
- p.printNoBreak("" + info.getDuration() + " ms");
- p.endTableCell();
- p.startTableCell();
- if (info.isActive()) {
- p.printNoBreak("RUNNING");
- }
- else {
- if (info.getReturnException() == null) {
- p.raw("<font color='008800'>");
- p.printNoBreak("COMPLETED OK");
- p.raw("</font>");
- }
- else {
- p.raw("<font color='880000'>");
- p.printNoBreak("COMPLETED WITH ERROR");
- p.raw("</font>");
- }
- }
- p.endTableCell();
- p.endTableRow();
- }
-
- private void renderCallDetail(HtmlComponent p, CallInspector call) {
- SimpleDateFormat startFmt = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
- CallInfo info = call.getInfo();
- //
- p.startTable(0);
- //
- p.startTableRow();
- p.tableCell("Service");
- p.tableCell(info.getService());
- p.endTableRow();
- //
- p.spacingRow(2);
- //
- p.startTableRow();
- p.tableCell("Operation");
- p.tableCell(info.getOperation());
- p.endTableRow();
- //
- p.spacingRow(2);
- //
- p.startTableRow();
- p.tableCell("Start");
- p.tableCell(startFmt.format(new Date(info.getStartTime())));
- p.endTableRow();
- //
- p.spacingRow(2);
- //
- p.startTableRow();
- p.tableCell("End");
- if (info.isActive()) {
- p.tableCell("PENDING");
- }
- else {
- p.tableCell(startFmt.format(new Date(info.getEndTime())));
- }
- p.endTableRow();
- //
- p.spacingRow(2);
- //
- p.startTableRow();
- p.tableCell("Duration");
- p.tableCell(info.getDuration() + " ms");
- p.endTableRow();
- //
- p.spacingRow(2);
- //
- p.startTableRow();
- p.tableCell("XA&nbsp;resources");
- p.startTableCell();
- ITransactionMember[] xaresources = info.getXaResources();
- renderValueTable(p, xaresources);
- p.endTableCell();
- p.endTableRow();
- //
- if (!info.isActive()) {
- //
- p.spacingRow(2);
- //
- p.startTableRow();
- p.tableCell("Arguments");
- p.startTableCell();
- renderValueTable(p, info.getArguments());
- p.endTableCell();
- p.endTableRow();
- if (info.getReturnException() == null) {
- //
- p.spacingRow(2);
- //
- p.startTableRow();
- p.tableCell("Out&nbsp;variables");
- p.startTableCell();
- renderValueTable(p, info.getOutVariables());
- p.endTableCell();
- p.endTableRow();
- //
- p.spacingRow(2);
- //
- p.startTableRow();
- p.tableCell("Return&nbsp;data");
- p.startTableCell();
- renderValueTable(p, new Object[]{info.getReturnData()});
- p.endTableCell();
- p.endTableRow();
- }
- else {
- StringWriter sw = new StringWriter();
- info.getReturnException().printStackTrace(new PrintWriter(sw, true));
- //
- p.spacingRow(2);
- //
- p.startTableRow();
- p.tableCell("Return&nbsp;exception");
- p.tableCell(sw.toString());
- p.endTableRow();
- }
- }
- p.endTable();
- }
-
- protected void renderValueTable(HtmlComponent p, Object o) {
- boolean singleValue;
- if (o == null) {
- singleValue = true;
- }
- else if (o.getClass().isArray()) {
- singleValue = false;
- }
- else if (o instanceof Map) {
- singleValue = false;
- }
- else if (o instanceof Collection) {
- singleValue = false;
- }
- else {
- // bean introspection
- singleValue = true;
- }
- //
- if (o == null || singleValue) {
- p.print("" + o);
- }
- else {
- p.startTable(1);
- p.startTableRow();
- p.tableHeaderCell("Name");
- p.tableHeaderCell("Type");
- p.tableHeaderCell("Value");
- p.endTableRow();
- if (o.getClass().isArray()) {
- int len = Array.getLength(o);
- for (int i = 0; i < len; i++) {
- renderValueRow(p, "[" + i + "]", Array.get(o, i));
- }
- }
- else if (o instanceof Map) {
- for (Iterator it = ((Map) o).entrySet().iterator(); it.hasNext();) {
- Map.Entry e = (Map.Entry) it.next();
- renderValueRow(p, "{" + "" + e.getKey() + "}", e.getValue());
- }
- }
- else if (o instanceof Collection) {
- int index = 0;
- for (Iterator it = ((Collection) o).iterator(); it.hasNext();) {
- Object value = it.next();
- renderValueRow(p, "" + index, value);
- index++;
- }
- }
- else {
- // only reached when doing further inspection
- renderValueRow(p, "", o);
- }
- p.endTable();
- }
- }
-
- protected void renderValueRow(HtmlComponent p, String name, Object value) {
- p.startTableRow();
- p.tableCell(name);
- p.tableCell((value != null ? value.getClass().getName() : ""));
- p.startTableCell();
- renderValueTable(p, value);
- p.endTableCell();
- p.endTableRow();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.admin.html.view;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.lang.reflect.Array;
+import java.text.SimpleDateFormat;
+import java.util.Collection;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.eclipse.scout.commons.CompositeObject;
+import org.eclipse.scout.rt.server.admin.html.AbstractHtmlAction;
+import org.eclipse.scout.rt.server.admin.html.AdminSession;
+import org.eclipse.scout.rt.server.admin.html.widget.table.HtmlComponent;
+import org.eclipse.scout.rt.server.admin.inspector.CallInspector;
+import org.eclipse.scout.rt.server.admin.inspector.ProcessInspector;
+import org.eclipse.scout.rt.server.admin.inspector.SessionInspector;
+import org.eclipse.scout.rt.server.admin.inspector.info.CallInfo;
+import org.eclipse.scout.rt.server.transaction.ITransactionMember;
+
+public class CallsView extends DefaultView {
+ private CallInspector m_selectedCall;
+
+ public CallsView(AdminSession as) {
+ super(as);
+ }
+
+ public CallInspector getSelectedCall() {
+ return m_selectedCall;
+ }
+
+ @Override
+ public boolean isVisible() {
+ return ProcessInspector.getDefault().isEnabled() && getAdminSession().getTopView().getSessionsView().getSelectedSession() != null;
+ }
+
+ @Override
+ public void produceTitle(HtmlComponent p) {
+ final SessionInspector session = getAdminSession().getTopView().getSessionsView().getSelectedSession();
+ p.print("Calls of " + (session != null ? session.getInfo().getUserId() + "/" + session.getInfo().getSessionId() : "?"));
+ }
+
+ @Override
+ public void produceBody(HtmlComponent p) {
+ final SessionInspector session = getAdminSession().getTopView().getSessionsView().getSelectedSession();
+ p.linkAction("Clear calls", new AbstractHtmlAction("clearCalls") {
+ @Override
+ public void run() {
+ session.clearCallInspectors();
+ }
+ });
+ p.p();
+ //
+ p.startTable(0, 5, 5);
+ p.startTableRow();
+ p.startTableCell();
+ renderCallTable(p, session);
+ p.startTableCell();
+ // selected call
+ if (m_selectedCall != null) {
+ renderCallDetail(p, m_selectedCall);
+ }
+ p.endTableCell();
+ p.endTableRow();
+ p.endTable();
+ }
+
+ private void renderCallTable(HtmlComponent p, SessionInspector session) {
+ TreeMap<CompositeObject, CallInspector> timeToCalls = new TreeMap<CompositeObject, CallInspector>();
+ CallInspector[] callInspectors = session.getCallInspectors();
+ for (int i = 0; i < callInspectors.length; i++) {
+ long startTime = callInspectors[i].getInfo().getStartTime();
+ timeToCalls.put(new CompositeObject(startTime, i), callInspectors[i]);
+ }
+ CallInspector[] sorted = timeToCalls.values().toArray(new CallInspector[timeToCalls.size()]);
+ p.bold("Calls");
+ p.startTable(1, 0, 3);
+ p.startTableRow();
+ p.tableHeaderCell("#");
+ p.tableHeaderCell("Operation");
+ p.tableHeaderCell("Started");
+ p.tableHeaderCell("Duration");
+ p.tableHeaderCell("Status");
+ p.endTableRow();
+ CallInspector validSelection = null;
+ for (int i = sorted.length - 1; i >= 0; i--) {
+ if (sorted[i] == m_selectedCall) {
+ validSelection = m_selectedCall;
+ }
+ renderCallRow(p, i + 1, sorted[i]);
+ }
+ m_selectedCall = validSelection;
+ p.endTable();
+ }
+
+ private void renderCallRow(HtmlComponent p, int index, final CallInspector call) {
+ boolean selected = m_selectedCall != null && (m_selectedCall == call);
+ SimpleDateFormat startFmt = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
+ String serviceShortName = call.getInfo().getService();
+ int i = Math.max(serviceShortName.lastIndexOf('.'), serviceShortName.lastIndexOf('$'));
+ if (i >= 0) {
+ serviceShortName = serviceShortName.substring(i + 1);
+ }
+ CallInfo info = call.getInfo();
+ //
+ p.startTableRow();
+ p.tableCell("" + index);
+ p.startTableCell();
+ String callId = serviceShortName + "." + info.getOperation();
+ String callKey = serviceShortName + "." + info.getOperation() + "." + info.getStartTime();
+ if (selected) {
+ p.focusAnchor();
+ }
+ p.startLinkAction(new AbstractHtmlAction("selectCall." + callKey) {
+ @Override
+ public void run() {
+ m_selectedCall = call;
+ }
+ });
+ if (selected) {
+ p.bold(callId);
+ }
+ else {
+ p.print(callId);
+ }
+ p.endLinkAction();
+ p.endTableCell();
+ p.startTableCell();
+ p.printNoBreak(startFmt.format(new Date(info.getStartTime())));
+ p.endTableCell();
+ p.startTableCell();
+ p.printNoBreak("" + info.getDuration() + " ms");
+ p.endTableCell();
+ p.startTableCell();
+ if (info.isActive()) {
+ p.printNoBreak("RUNNING");
+ }
+ else {
+ if (info.getReturnException() == null) {
+ p.raw("<font color='008800'>");
+ p.printNoBreak("COMPLETED OK");
+ p.raw("</font>");
+ }
+ else {
+ p.raw("<font color='880000'>");
+ p.printNoBreak("COMPLETED WITH ERROR");
+ p.raw("</font>");
+ }
+ }
+ p.endTableCell();
+ p.endTableRow();
+ }
+
+ private void renderCallDetail(HtmlComponent p, CallInspector call) {
+ SimpleDateFormat startFmt = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
+ CallInfo info = call.getInfo();
+ //
+ p.startTable(0);
+ //
+ p.startTableRow();
+ p.tableCell("Service");
+ p.tableCell(info.getService());
+ p.endTableRow();
+ //
+ p.spacingRow(2);
+ //
+ p.startTableRow();
+ p.tableCell("Operation");
+ p.tableCell(info.getOperation());
+ p.endTableRow();
+ //
+ p.spacingRow(2);
+ //
+ p.startTableRow();
+ p.tableCell("Start");
+ p.tableCell(startFmt.format(new Date(info.getStartTime())));
+ p.endTableRow();
+ //
+ p.spacingRow(2);
+ //
+ p.startTableRow();
+ p.tableCell("End");
+ if (info.isActive()) {
+ p.tableCell("PENDING");
+ }
+ else {
+ p.tableCell(startFmt.format(new Date(info.getEndTime())));
+ }
+ p.endTableRow();
+ //
+ p.spacingRow(2);
+ //
+ p.startTableRow();
+ p.tableCell("Duration");
+ p.tableCell(info.getDuration() + " ms");
+ p.endTableRow();
+ //
+ p.spacingRow(2);
+ //
+ p.startTableRow();
+ p.tableCell("XA&nbsp;resources");
+ p.startTableCell();
+ ITransactionMember[] xaresources = info.getXaResources();
+ renderValueTable(p, xaresources);
+ p.endTableCell();
+ p.endTableRow();
+ //
+ if (!info.isActive()) {
+ //
+ p.spacingRow(2);
+ //
+ p.startTableRow();
+ p.tableCell("Arguments");
+ p.startTableCell();
+ renderValueTable(p, info.getArguments());
+ p.endTableCell();
+ p.endTableRow();
+ if (info.getReturnException() == null) {
+ //
+ p.spacingRow(2);
+ //
+ p.startTableRow();
+ p.tableCell("Out&nbsp;variables");
+ p.startTableCell();
+ renderValueTable(p, info.getOutVariables());
+ p.endTableCell();
+ p.endTableRow();
+ //
+ p.spacingRow(2);
+ //
+ p.startTableRow();
+ p.tableCell("Return&nbsp;data");
+ p.startTableCell();
+ renderValueTable(p, new Object[]{info.getReturnData()});
+ p.endTableCell();
+ p.endTableRow();
+ }
+ else {
+ StringWriter sw = new StringWriter();
+ info.getReturnException().printStackTrace(new PrintWriter(sw, true));
+ //
+ p.spacingRow(2);
+ //
+ p.startTableRow();
+ p.tableCell("Return&nbsp;exception");
+ p.tableCell(sw.toString());
+ p.endTableRow();
+ }
+ }
+ p.endTable();
+ }
+
+ protected void renderValueTable(HtmlComponent p, Object o) {
+ boolean singleValue;
+ if (o == null) {
+ singleValue = true;
+ }
+ else if (o.getClass().isArray()) {
+ singleValue = false;
+ }
+ else if (o instanceof Map) {
+ singleValue = false;
+ }
+ else if (o instanceof Collection) {
+ singleValue = false;
+ }
+ else {
+ // bean introspection
+ singleValue = true;
+ }
+ //
+ if (o == null || singleValue) {
+ p.print("" + o);
+ }
+ else {
+ p.startTable(1);
+ p.startTableRow();
+ p.tableHeaderCell("Name");
+ p.tableHeaderCell("Type");
+ p.tableHeaderCell("Value");
+ p.endTableRow();
+ if (o.getClass().isArray()) {
+ int len = Array.getLength(o);
+ for (int i = 0; i < len; i++) {
+ renderValueRow(p, "[" + i + "]", Array.get(o, i));
+ }
+ }
+ else if (o instanceof Map) {
+ for (Iterator it = ((Map) o).entrySet().iterator(); it.hasNext();) {
+ Map.Entry e = (Map.Entry) it.next();
+ renderValueRow(p, "{" + "" + e.getKey() + "}", e.getValue());
+ }
+ }
+ else if (o instanceof Collection) {
+ int index = 0;
+ for (Iterator it = ((Collection) o).iterator(); it.hasNext();) {
+ Object value = it.next();
+ renderValueRow(p, "" + index, value);
+ index++;
+ }
+ }
+ else {
+ // only reached when doing further inspection
+ renderValueRow(p, "", o);
+ }
+ p.endTable();
+ }
+ }
+
+ protected void renderValueRow(HtmlComponent p, String name, Object value) {
+ p.startTableRow();
+ p.tableCell(name);
+ p.tableCell((value != null ? value.getClass().getName() : ""));
+ p.startTableCell();
+ renderValueTable(p, value);
+ p.endTableCell();
+ p.endTableRow();
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/view/DefaultView.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/view/DefaultView.java
index f378581c14..9371ee015a 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/view/DefaultView.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/view/DefaultView.java
@@ -1,45 +1,45 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.admin.html.view;
-
-import org.eclipse.scout.rt.server.admin.html.AdminSession;
-import org.eclipse.scout.rt.server.admin.html.IView;
-import org.eclipse.scout.rt.server.admin.html.widget.table.HtmlComponent;
-
-public class DefaultView implements IView {
- private AdminSession m_as;
-
- public DefaultView(AdminSession as) {
- m_as = as;
- }
-
- public AdminSession getAdminSession() {
- return m_as;
- }
-
- @Override
- public boolean isVisible() {
- return true;
- }
-
- @Override
- public void produceTitle(HtmlComponent p) {
- }
-
- @Override
- public void produceBody(HtmlComponent p) {
- }
-
- @Override
- public void activated() {
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.admin.html.view;
+
+import org.eclipse.scout.rt.server.admin.html.AdminSession;
+import org.eclipse.scout.rt.server.admin.html.IView;
+import org.eclipse.scout.rt.server.admin.html.widget.table.HtmlComponent;
+
+public class DefaultView implements IView {
+ private AdminSession m_as;
+
+ public DefaultView(AdminSession as) {
+ m_as = as;
+ }
+
+ public AdminSession getAdminSession() {
+ return m_as;
+ }
+
+ @Override
+ public boolean isVisible() {
+ return true;
+ }
+
+ @Override
+ public void produceTitle(HtmlComponent p) {
+ }
+
+ @Override
+ public void produceBody(HtmlComponent p) {
+ }
+
+ @Override
+ public void activated() {
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/view/GeneralView.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/view/GeneralView.java
index a4a2b3376d..2e262318db 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/view/GeneralView.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/view/GeneralView.java
@@ -1,274 +1,274 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.admin.html.view;
-
-import java.security.AccessController;
-import java.security.Principal;
-import java.util.Date;
-import java.util.Iterator;
-
-import javax.security.auth.Subject;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.scout.commons.VerboseUtility;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.server.admin.html.AbstractHtmlAction;
-import org.eclipse.scout.rt.server.admin.html.AdminSession;
-import org.eclipse.scout.rt.server.admin.html.widget.table.HtmlComponent;
-import org.eclipse.scout.rt.server.admin.inspector.ProcessInspector;
-import org.eclipse.scout.rt.shared.security.UpdateServiceConfigurationPermission;
-import org.eclipse.scout.rt.shared.services.common.ping.IPingService;
-import org.eclipse.scout.rt.shared.services.common.security.ACCESS;
-
-public class GeneralView extends DefaultView {
-
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(GeneralView.class);
-
- public GeneralView(AdminSession as) {
- super(as);
- }
-
- @Override
- public void produceTitle(HtmlComponent p) {
- p.print("General");
- }
-
- @Override
- public void produceBody(HtmlComponent p) {
- // menu
- String monitoringStatusMessage = createMonitoringQuickLink(p);
- String loggingStatusMessage = createLoggingQuickLink(p);
-
- // infos
- if (Platform.getProduct() != null) {
- p.print("Product: id=" + Platform.getProduct().getId() + ", name=" + Platform.getProduct().getName() + ", app=" + Platform.getProduct().getApplication() + ", bundle=" + Platform.getProduct().getDefiningBundle());
- p.br();
- }
- else {
- p.print("No product available");
- }
- p.br();
- p.print("Date: " + new Date());
- p.br();
- p.print("You connect from: " + p.getRequest().getRemoteAddr() + " / " + p.getRequest().getRemoteHost());
- p.p();
- // show jaas context
- p.print("Session ID: " + p.getRequest().getSession().getId());
- p.br();
- p.print("Session Created: " + new Date(p.getRequest().getSession().getCreationTime()));
- p.br();
- p.print("JAAS Context");
- p.br();
- p.print("&nbsp;&nbsp;remoteUser: " + p.getRequest().getRemoteUser());
- p.br();
- Principal remotePrincipal = p.getRequest().getUserPrincipal();
- if (remotePrincipal != null) {
- p.print("&nbsp;&nbsp;userPrincipal: " + remotePrincipal.getName() + " [" + remotePrincipal.getClass().getSimpleName() + "]");
- }
- else {
- p.print("&nbsp;&nbsp;userPrincipal: null");
- }
- p.br();
- try {
- SecurityManager sm = System.getSecurityManager();
- p.print("&nbsp;&nbsp;SecurityManager: " + sm);
- p.br();
- Subject subject = Subject.getSubject(AccessController.getContext());
- p.print("&nbsp;&nbsp;Subject: " + VerboseUtility.dumpObject(subject));
- p.br();
- if (subject != null) {
- int i1 = 0;
- for (Iterator it1 = subject.getPrincipals().iterator(); it1.hasNext();) {
- Principal principal = (Principal) it1.next();
- if (principal != null) {
- p.print("&nbsp;&nbsp;&nbsp;&nbsp;principal[" + i1 + "]=" + principal.getName() + " [" + principal.getClass().getName() + "]");
- p.br();
- }
- i1++;
- }
- }
- }
- catch (Exception e) {
- p.print("Exception: " + e);
- p.br();
- }
- p.br();
- if (monitoringStatusMessage != null) {
- p.raw(monitoringStatusMessage);
- }
- if (loggingStatusMessage != null) {
- p.raw(loggingStatusMessage);
- }
- }
-
- private String createMonitoringQuickLink(HtmlComponent p) {
- if (!ACCESS.check(new UpdateServiceConfigurationPermission())) {
- return null;
- }
-
- final ProcessInspector inst = ProcessInspector.getDefault();
- if (inst.isEnabled()) {
- p.print("Monitor is active with maximum caching of " + (inst.getTimeout() / 1000 / 60) + " minutes [ ");
- p.linkAction("cache 2 min", new P_SetTimeoutAction(2));
- p.print(" | ");
- p.linkAction("cache 15 min", new P_SetTimeoutAction(15));
- p.print(" | ");
- p.linkAction("cache 60 min", new P_SetTimeoutAction(60));
- p.print(" | ");
- p.linkAction("deactivate", new P_EnableAction(false));
- p.print(" ]");
- p.br();
- if (inst.acceptCall(IPingService.class.getName(), "ping")) {
- p.linkAction("IPingService.ping (click to toggle)", new AbstractHtmlAction("IPingService.ignore") {
- @Override
- public void run() {
- inst.getIgnoredCallSet().clear();
- inst.getIgnoredCallSet().add(".*\\.IPingService\\.ping");
- }
- });
- }
- else {
- p.startLinkAction(new AbstractHtmlAction("IPingService.accept") {
- @Override
- public void run() {
- inst.getIgnoredCallSet().clear();
- }
- });
- p.raw("<s>");
- p.printNoBreak("IPingService.ping");
- p.raw("</s>");
- p.printNoBreak(" (click to toggle)");
- p.endLinkAction();
- }
- }
- else {
- p.print("Monitor is inactive [ ");
- p.linkAction("activate", new P_EnableAction(true));
- p.print(" ]");
- }
- p.p();
-
- if (inst.isEnabled()) {
- return "<p><b>Note: Session Activity Monitor is enabled; this might affect performance and memory due to higher resource consumption during analysis.</b><p>";
- }
- return null;
- }
-
- private String createLoggingQuickLink(HtmlComponent p) {
- if (!ACCESS.check(new UpdateServiceConfigurationPermission())) {
- return null;
- }
-
- Integer globalLogLevel;
- try {
- // check whether global log level is supported by installed log manager
- globalLogLevel = ScoutLogManager.getGlobalLogLevel();
- }
- catch (UnsupportedOperationException e) {
- LOG.info("Use of global log level is not supported", e);
- return null;
- }
-
- if (globalLogLevel != null) {
- p.print("Global logging is active [ ");
- p.linkAction("deactivate", new P_ToggleGlobalLoggingAction(false));
- p.print(" ]");
-
- addLogLevelRadioEntry(p, IScoutLogger.LEVEL_ERROR, "ERROR");
- addLogLevelRadioEntry(p, IScoutLogger.LEVEL_WARN, "WARNING");
- addLogLevelRadioEntry(p, IScoutLogger.LEVEL_INFO, "INFO");
- addLogLevelRadioEntry(p, IScoutLogger.LEVEL_DEBUG, "DEBUG");
- addLogLevelRadioEntry(p, IScoutLogger.LEVEL_TRACE, "TRACE");
- addLogLevelRadioEntry(p, IScoutLogger.LEVEL_OFF, "OFF");
- }
- else {
- p.print("Global logging is inactive [");
- p.linkAction("activate", new P_ToggleGlobalLoggingAction(true));
- p.print(" ]");
- }
- p.p();
-
- if (globalLogLevel != null && globalLogLevel > IScoutLogger.LEVEL_WARN) {
- return "<p><b>Note: Global logging is active with a level finer than WARNING; this might affect performance due to increased log output.</b><p>";
- }
- return null;
- }
-
- private void addLogLevelRadioEntry(HtmlComponent p, final int logLevel, String logLevelText) {
- Integer globalLogLevel = ScoutLogManager.getGlobalLogLevel();
- if (globalLogLevel == null) {
- globalLogLevel = -1;
- }
-
- AbstractHtmlAction action = new AbstractHtmlAction("level=" + logLevel) {
- @Override
- public void run() {
- if (logLevel >= 0 && logLevel <= 5) {
- ScoutLogManager.setGlobalLogLevel(logLevel);
- }
- else {
- ScoutLogManager.setGlobalLogLevel(null);
- }
- }
- };
- p.radioBoxOption("globalLogLevel", logLevelText, action, logLevel == globalLogLevel);
- }
-
- private class P_EnableAction extends AbstractHtmlAction {
- private boolean m_enabled;
-
- public P_EnableAction(boolean b) {
- super("mon.enabled." + b);
- m_enabled = b;
- }
-
- @Override
- public void run() {
- ProcessInspector.getDefault().setEnabled(m_enabled);
- }
- }
-
- private class P_SetTimeoutAction extends AbstractHtmlAction {
- private long m_minutes;
-
- public P_SetTimeoutAction(long minutes) {
- super("mon.cache." + minutes);
- m_minutes = minutes;
- }
-
- @Override
- public void run() {
- ProcessInspector.getDefault().setTimeout(m_minutes * 60000L);
- }
- }
-
- private final class P_ToggleGlobalLoggingAction extends AbstractHtmlAction {
-
- private boolean m_activate;
-
- public P_ToggleGlobalLoggingAction(boolean activate) {
- super(P_ToggleGlobalLoggingAction.class.getName() + "." + (activate ? "global" : "default"));
- m_activate = activate;
- }
-
- @Override
- public void run() {
- if (m_activate) {
- ScoutLogManager.setGlobalLogLevel(IScoutLogger.LEVEL_ERROR);
- }
- else {
- ScoutLogManager.setGlobalLogLevel(null);
- }
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.admin.html.view;
+
+import java.security.AccessController;
+import java.security.Principal;
+import java.util.Date;
+import java.util.Iterator;
+
+import javax.security.auth.Subject;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.scout.commons.VerboseUtility;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.server.admin.html.AbstractHtmlAction;
+import org.eclipse.scout.rt.server.admin.html.AdminSession;
+import org.eclipse.scout.rt.server.admin.html.widget.table.HtmlComponent;
+import org.eclipse.scout.rt.server.admin.inspector.ProcessInspector;
+import org.eclipse.scout.rt.shared.security.UpdateServiceConfigurationPermission;
+import org.eclipse.scout.rt.shared.services.common.ping.IPingService;
+import org.eclipse.scout.rt.shared.services.common.security.ACCESS;
+
+public class GeneralView extends DefaultView {
+
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(GeneralView.class);
+
+ public GeneralView(AdminSession as) {
+ super(as);
+ }
+
+ @Override
+ public void produceTitle(HtmlComponent p) {
+ p.print("General");
+ }
+
+ @Override
+ public void produceBody(HtmlComponent p) {
+ // menu
+ String monitoringStatusMessage = createMonitoringQuickLink(p);
+ String loggingStatusMessage = createLoggingQuickLink(p);
+
+ // infos
+ if (Platform.getProduct() != null) {
+ p.print("Product: id=" + Platform.getProduct().getId() + ", name=" + Platform.getProduct().getName() + ", app=" + Platform.getProduct().getApplication() + ", bundle=" + Platform.getProduct().getDefiningBundle());
+ p.br();
+ }
+ else {
+ p.print("No product available");
+ }
+ p.br();
+ p.print("Date: " + new Date());
+ p.br();
+ p.print("You connect from: " + p.getRequest().getRemoteAddr() + " / " + p.getRequest().getRemoteHost());
+ p.p();
+ // show jaas context
+ p.print("Session ID: " + p.getRequest().getSession().getId());
+ p.br();
+ p.print("Session Created: " + new Date(p.getRequest().getSession().getCreationTime()));
+ p.br();
+ p.print("JAAS Context");
+ p.br();
+ p.print("&nbsp;&nbsp;remoteUser: " + p.getRequest().getRemoteUser());
+ p.br();
+ Principal remotePrincipal = p.getRequest().getUserPrincipal();
+ if (remotePrincipal != null) {
+ p.print("&nbsp;&nbsp;userPrincipal: " + remotePrincipal.getName() + " [" + remotePrincipal.getClass().getSimpleName() + "]");
+ }
+ else {
+ p.print("&nbsp;&nbsp;userPrincipal: null");
+ }
+ p.br();
+ try {
+ SecurityManager sm = System.getSecurityManager();
+ p.print("&nbsp;&nbsp;SecurityManager: " + sm);
+ p.br();
+ Subject subject = Subject.getSubject(AccessController.getContext());
+ p.print("&nbsp;&nbsp;Subject: " + VerboseUtility.dumpObject(subject));
+ p.br();
+ if (subject != null) {
+ int i1 = 0;
+ for (Iterator it1 = subject.getPrincipals().iterator(); it1.hasNext();) {
+ Principal principal = (Principal) it1.next();
+ if (principal != null) {
+ p.print("&nbsp;&nbsp;&nbsp;&nbsp;principal[" + i1 + "]=" + principal.getName() + " [" + principal.getClass().getName() + "]");
+ p.br();
+ }
+ i1++;
+ }
+ }
+ }
+ catch (Exception e) {
+ p.print("Exception: " + e);
+ p.br();
+ }
+ p.br();
+ if (monitoringStatusMessage != null) {
+ p.raw(monitoringStatusMessage);
+ }
+ if (loggingStatusMessage != null) {
+ p.raw(loggingStatusMessage);
+ }
+ }
+
+ private String createMonitoringQuickLink(HtmlComponent p) {
+ if (!ACCESS.check(new UpdateServiceConfigurationPermission())) {
+ return null;
+ }
+
+ final ProcessInspector inst = ProcessInspector.getDefault();
+ if (inst.isEnabled()) {
+ p.print("Monitor is active with maximum caching of " + (inst.getTimeout() / 1000 / 60) + " minutes [ ");
+ p.linkAction("cache 2 min", new P_SetTimeoutAction(2));
+ p.print(" | ");
+ p.linkAction("cache 15 min", new P_SetTimeoutAction(15));
+ p.print(" | ");
+ p.linkAction("cache 60 min", new P_SetTimeoutAction(60));
+ p.print(" | ");
+ p.linkAction("deactivate", new P_EnableAction(false));
+ p.print(" ]");
+ p.br();
+ if (inst.acceptCall(IPingService.class.getName(), "ping")) {
+ p.linkAction("IPingService.ping (click to toggle)", new AbstractHtmlAction("IPingService.ignore") {
+ @Override
+ public void run() {
+ inst.getIgnoredCallSet().clear();
+ inst.getIgnoredCallSet().add(".*\\.IPingService\\.ping");
+ }
+ });
+ }
+ else {
+ p.startLinkAction(new AbstractHtmlAction("IPingService.accept") {
+ @Override
+ public void run() {
+ inst.getIgnoredCallSet().clear();
+ }
+ });
+ p.raw("<s>");
+ p.printNoBreak("IPingService.ping");
+ p.raw("</s>");
+ p.printNoBreak(" (click to toggle)");
+ p.endLinkAction();
+ }
+ }
+ else {
+ p.print("Monitor is inactive [ ");
+ p.linkAction("activate", new P_EnableAction(true));
+ p.print(" ]");
+ }
+ p.p();
+
+ if (inst.isEnabled()) {
+ return "<p><b>Note: Session Activity Monitor is enabled; this might affect performance and memory due to higher resource consumption during analysis.</b><p>";
+ }
+ return null;
+ }
+
+ private String createLoggingQuickLink(HtmlComponent p) {
+ if (!ACCESS.check(new UpdateServiceConfigurationPermission())) {
+ return null;
+ }
+
+ Integer globalLogLevel;
+ try {
+ // check whether global log level is supported by installed log manager
+ globalLogLevel = ScoutLogManager.getGlobalLogLevel();
+ }
+ catch (UnsupportedOperationException e) {
+ LOG.info("Use of global log level is not supported", e);
+ return null;
+ }
+
+ if (globalLogLevel != null) {
+ p.print("Global logging is active [ ");
+ p.linkAction("deactivate", new P_ToggleGlobalLoggingAction(false));
+ p.print(" ]");
+
+ addLogLevelRadioEntry(p, IScoutLogger.LEVEL_ERROR, "ERROR");
+ addLogLevelRadioEntry(p, IScoutLogger.LEVEL_WARN, "WARNING");
+ addLogLevelRadioEntry(p, IScoutLogger.LEVEL_INFO, "INFO");
+ addLogLevelRadioEntry(p, IScoutLogger.LEVEL_DEBUG, "DEBUG");
+ addLogLevelRadioEntry(p, IScoutLogger.LEVEL_TRACE, "TRACE");
+ addLogLevelRadioEntry(p, IScoutLogger.LEVEL_OFF, "OFF");
+ }
+ else {
+ p.print("Global logging is inactive [");
+ p.linkAction("activate", new P_ToggleGlobalLoggingAction(true));
+ p.print(" ]");
+ }
+ p.p();
+
+ if (globalLogLevel != null && globalLogLevel > IScoutLogger.LEVEL_WARN) {
+ return "<p><b>Note: Global logging is active with a level finer than WARNING; this might affect performance due to increased log output.</b><p>";
+ }
+ return null;
+ }
+
+ private void addLogLevelRadioEntry(HtmlComponent p, final int logLevel, String logLevelText) {
+ Integer globalLogLevel = ScoutLogManager.getGlobalLogLevel();
+ if (globalLogLevel == null) {
+ globalLogLevel = -1;
+ }
+
+ AbstractHtmlAction action = new AbstractHtmlAction("level=" + logLevel) {
+ @Override
+ public void run() {
+ if (logLevel >= 0 && logLevel <= 5) {
+ ScoutLogManager.setGlobalLogLevel(logLevel);
+ }
+ else {
+ ScoutLogManager.setGlobalLogLevel(null);
+ }
+ }
+ };
+ p.radioBoxOption("globalLogLevel", logLevelText, action, logLevel == globalLogLevel);
+ }
+
+ private class P_EnableAction extends AbstractHtmlAction {
+ private boolean m_enabled;
+
+ public P_EnableAction(boolean b) {
+ super("mon.enabled." + b);
+ m_enabled = b;
+ }
+
+ @Override
+ public void run() {
+ ProcessInspector.getDefault().setEnabled(m_enabled);
+ }
+ }
+
+ private class P_SetTimeoutAction extends AbstractHtmlAction {
+ private long m_minutes;
+
+ public P_SetTimeoutAction(long minutes) {
+ super("mon.cache." + minutes);
+ m_minutes = minutes;
+ }
+
+ @Override
+ public void run() {
+ ProcessInspector.getDefault().setTimeout(m_minutes * 60000L);
+ }
+ }
+
+ private final class P_ToggleGlobalLoggingAction extends AbstractHtmlAction {
+
+ private boolean m_activate;
+
+ public P_ToggleGlobalLoggingAction(boolean activate) {
+ super(P_ToggleGlobalLoggingAction.class.getName() + "." + (activate ? "global" : "default"));
+ m_activate = activate;
+ }
+
+ @Override
+ public void run() {
+ if (m_activate) {
+ ScoutLogManager.setGlobalLogLevel(IScoutLogger.LEVEL_ERROR);
+ }
+ else {
+ ScoutLogManager.setGlobalLogLevel(null);
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/view/MessagesView.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/view/MessagesView.java
index 6ad98eec46..2e172d22b5 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/view/MessagesView.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/view/MessagesView.java
@@ -1,84 +1,84 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.admin.html.view;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-
-import org.eclipse.scout.rt.server.admin.html.AbstractHtmlAction;
-import org.eclipse.scout.rt.server.admin.html.AdminSession;
-import org.eclipse.scout.rt.server.admin.html.widget.table.HtmlComponent;
-import org.eclipse.scout.rt.shared.security.UpdateServiceConfigurationPermission;
-import org.eclipse.scout.rt.shared.services.common.security.ACCESS;
-
-public class MessagesView extends DefaultView {
-
- public MessagesView(AdminSession as) {
- super(as);
- }
-
- @Override
- public boolean isVisible() {
- return ACCESS.check(new UpdateServiceConfigurationPermission());
- }
-
- @Override
- public void produceTitle(HtmlComponent p) {
- p.pBold("Information");
- }
-
- @Override
- public void produceBody(HtmlComponent p) {
- if (!isEmpty(p)) {
- p.startTable(1);
- p.startTableRow();
- p.startTableCell(1, 1, "ffff00");
- renderMessages(p);
- p.endTableCell();
- p.endTableRow();
- p.endTable();
- p.p("");
- }
- }
-
- private void renderMessages(HtmlComponent p) {
- AbstractHtmlAction a = p.getInvokedAction();
- if (a != null) {
- if (a.getException() != null) {
- StringWriter sw = new StringWriter();
- a.getException().printStackTrace(new PrintWriter(sw, true));
- p.raw("<pre>");
- p.print(sw.toString());
- p.raw("</pre>");
- p.br();
- }
- if (a.getPlainText() != null) {
- p.raw("<pre>");
- p.print(a.getPlainText());
- p.raw("</pre>");
- p.br();
- }
- }
- }
-
- public boolean isEmpty(HtmlComponent p) {
- AbstractHtmlAction a = p.getInvokedAction();
- if (a != null) {
- if (a.getException() != null) {
- return false;
- }
- if (a.getPlainText() != null) {
- return false;
- }
- }
- return true;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.admin.html.view;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+import org.eclipse.scout.rt.server.admin.html.AbstractHtmlAction;
+import org.eclipse.scout.rt.server.admin.html.AdminSession;
+import org.eclipse.scout.rt.server.admin.html.widget.table.HtmlComponent;
+import org.eclipse.scout.rt.shared.security.UpdateServiceConfigurationPermission;
+import org.eclipse.scout.rt.shared.services.common.security.ACCESS;
+
+public class MessagesView extends DefaultView {
+
+ public MessagesView(AdminSession as) {
+ super(as);
+ }
+
+ @Override
+ public boolean isVisible() {
+ return ACCESS.check(new UpdateServiceConfigurationPermission());
+ }
+
+ @Override
+ public void produceTitle(HtmlComponent p) {
+ p.pBold("Information");
+ }
+
+ @Override
+ public void produceBody(HtmlComponent p) {
+ if (!isEmpty(p)) {
+ p.startTable(1);
+ p.startTableRow();
+ p.startTableCell(1, 1, "ffff00");
+ renderMessages(p);
+ p.endTableCell();
+ p.endTableRow();
+ p.endTable();
+ p.p("");
+ }
+ }
+
+ private void renderMessages(HtmlComponent p) {
+ AbstractHtmlAction a = p.getInvokedAction();
+ if (a != null) {
+ if (a.getException() != null) {
+ StringWriter sw = new StringWriter();
+ a.getException().printStackTrace(new PrintWriter(sw, true));
+ p.raw("<pre>");
+ p.print(sw.toString());
+ p.raw("</pre>");
+ p.br();
+ }
+ if (a.getPlainText() != null) {
+ p.raw("<pre>");
+ p.print(a.getPlainText());
+ p.raw("</pre>");
+ p.br();
+ }
+ }
+ }
+
+ public boolean isEmpty(HtmlComponent p) {
+ AbstractHtmlAction a = p.getInvokedAction();
+ if (a != null) {
+ if (a.getException() != null) {
+ return false;
+ }
+ if (a.getPlainText() != null) {
+ return false;
+ }
+ }
+ return true;
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/view/ServicesView.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/view/ServicesView.java
index 914435d337..06e851d4e3 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/view/ServicesView.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/view/ServicesView.java
@@ -1,427 +1,427 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.admin.html.view;
-
-import java.beans.PropertyDescriptor;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.TreeMap;
-
-import org.eclipse.scout.commons.CompositeObject;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.server.admin.html.AbstractHtmlAction;
-import org.eclipse.scout.rt.server.admin.html.AdminSession;
-import org.eclipse.scout.rt.server.admin.html.widget.table.HtmlComponent;
-import org.eclipse.scout.rt.server.admin.inspector.ReflectServiceInventory;
-import org.eclipse.scout.rt.server.admin.inspector.ServiceInspector;
-import org.eclipse.scout.rt.server.internal.Activator;
-import org.eclipse.scout.rt.shared.security.UpdateServiceConfigurationPermission;
-import org.eclipse.scout.rt.shared.services.common.security.ACCESS;
-import org.eclipse.scout.service.SERVICES;
-import org.eclipse.scout.service.ServiceUtility;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-
-public class ServicesView extends DefaultView {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(ServicesView.class);
-
- private ServiceInspector[] m_serviceInspectors;
- private ServiceInspector m_selectedService;
-
- public ServicesView(AdminSession as) {
- super(as);
- }
-
- @Override
- public boolean isVisible() {
- return ACCESS.check(new UpdateServiceConfigurationPermission());
- }
-
- @Override
- public void activated() {
- // read all services
- m_serviceInspectors = null;
- Activator a = Activator.getDefault();
- if (a != null) {
- SERVICES.getService(String.class);
- BundleContext context = a.getBundle().getBundleContext();
- try {
- ServiceReference[] refs = context.getAllServiceReferences(null, null);
- if (refs != null) {
- try {
- ArrayList<ServiceInspector> list = new ArrayList<ServiceInspector>(refs.length);
- for (ServiceReference ref : refs) {
- Object s = context.getService(ref);
- if (s != null) {
- list.add(new ServiceInspector(s));
- }
- }
- m_serviceInspectors = list.toArray(new ServiceInspector[list.size()]);
- }
- finally {
- for (ServiceReference ref : refs) {
- context.ungetService(ref);
- }
- }
- }
- }
- catch (Exception e) {
- // nop
- }
- }
- }
-
- @Override
- public void produceTitle(HtmlComponent p) {
- p.print("Services");
- }
-
- @Override
- public void produceBody(HtmlComponent p) {
- p.startTable(0, 5, 5);
- p.startTableRow();
- p.startTableCell();
- renderServiceTables(p);
- p.startTableCell();
- // selected call
- if (m_selectedService != null) {
- renderServiceDetail(p, m_selectedService);
- }
- p.endTableCell();
- p.endTableRow();
- p.endTable();
- }
-
- private void renderServiceTables(HtmlComponent p) {
- // categorize services
- TreeMap<CompositeObject, Collection<ServiceInspector>> servicesMap = new TreeMap<CompositeObject, Collection<ServiceInspector>>();
- if (m_serviceInspectors != null) {
- for (ServiceInspector inspector : m_serviceInspectors) {
- String serviceName = inspector.getService().getClass().getSimpleName();
- String sectionName = null;
- int sectionOrder;
- try {
- if (serviceName.matches(".*ProcessService")) {
- sectionOrder = 1;
- sectionName = "Process Services";
- }
- else if (serviceName.matches(".*OutlineService")) {
- sectionOrder = 2;
- sectionName = "Outline Services";
- }
- else if (serviceName.matches(".*LookupService")) {
- sectionOrder = 3;
- sectionName = "Lookup Services";
- }
- else {
- Class[] serviceInterfaces = ServiceUtility.getInterfacesHierarchy(inspector.getService().getClass(), Object.class);
- Class topInterface = (serviceInterfaces.length > 0 ? serviceInterfaces[serviceInterfaces.length - 1] : null);
- if (topInterface != null && topInterface.getPackage() != null && topInterface.getPackage().getName().indexOf(".common.") >= 0) {
- sectionOrder = 4;
- sectionName = "Common Services";
- }
- else {
- sectionOrder = 5;
- sectionName = "Other Services";
- }
- }
- CompositeObject key = new CompositeObject(sectionOrder, sectionName);
- Collection<ServiceInspector> list = servicesMap.get(key);
- if (list == null) {
- list = new ArrayList<ServiceInspector>();
- servicesMap.put(key, list);
- }
- list.add(inspector);
- }
- catch (Throwable t) {
- LOG.warn("Failed inspecting service " + inspector.getService().getClass());
- }
- }
- }
- // tables per section
- for (Map.Entry<CompositeObject, Collection<ServiceInspector>> e : servicesMap.entrySet()) {
- String sectionName = (String) e.getKey().getComponent(1);
- Collection<ServiceInspector> list = e.getValue();
- renderServiceTable(p, sectionName, list);
- p.p();
- }
- }
-
- private void renderServiceTable(HtmlComponent p, String sectionName, Collection<ServiceInspector> serviceInspectors) {
- // sort
- TreeMap<String, ServiceInspector> sortMap = new TreeMap<String, ServiceInspector>();
- for (ServiceInspector inspector : serviceInspectors) {
- String s = inspector.getService().getClass().getName();
- sortMap.put(s, inspector);
- }
-
- p.p(sectionName);
- p.startListBox("listBox", 1, true);
- p.listBoxOption(" ", new AbstractHtmlAction("selectService.choose") {
- @Override
- public void run() {
- }
- }, false);
- for (ServiceInspector serviceInspector : sortMap.values()) {
- boolean selected = m_selectedService != null && (m_selectedService.getService() == serviceInspector.getService());
- final ServiceInspector finalServiceInspector = serviceInspector;
- p.listBoxOption(serviceInspector.getService().getClass().getName(), new AbstractHtmlAction("selectService2." + serviceInspector.getService().getClass().getName()) {
- @Override
- public void run() {
- m_selectedService = finalServiceInspector;
- }
- }, selected);
- }
- p.endListBox();
-
- /*
- * p.startTable(0,0,3,"100%"); p.startTableRow();
- * p.tableHeaderCell(sectionName); p.endTableRow(); for(ServiceInspector
- * serviceInspector: sortMap.values()){
- * renderServiceRow(p,serviceInspector); } p.endTable();
- */
- }
-
- private void renderServiceRow(HtmlComponent p, final ServiceInspector service) {
- boolean selected = m_selectedService != null && (m_selectedService.getService() == service.getService());
- p.startTableRow();
- p.startTableCell();
- String serviceId = service.getService().getClass().getSimpleName();
- if (selected) {
- p.bold(serviceId);
- }
- else {
- p.linkAction(serviceId, new AbstractHtmlAction("selectService." + service.getService().getClass().getName()) {
- @Override
- public void run() {
- m_selectedService = service;
- }
- });
- }
- p.endTableCell();
- p.endTableRow();
- }
-
- private void renderServiceDetail(HtmlComponent p, ServiceInspector service) {
- p.bold(service.getService().getClass().getSimpleName());
- p.p();
- ReflectServiceInventory inv;
- try {
- inv = service.buildInventory();
- }
- catch (Throwable t) {
- p.raw("<font color=red>Inventory failed: " + t + "</font>");
- return;
- }
- renderHierarchy(p, service, inv);
- renderProperties(p, service, inv);
- renderOperations(p, service, inv);
- renderStates(p, service, inv);
- }
-
- private void renderHierarchy(HtmlComponent p, ServiceInspector service, ReflectServiceInventory inv) {
- // hierarchy
- Class serviceClass = service.getService().getClass();
- ArrayList<Class> interfaceHierarchy = new ArrayList<Class>();
- for (Class c : serviceClass.getInterfaces()) {
- interfaceHierarchy.addAll(Arrays.asList(ServiceUtility.getInterfacesHierarchy(c, Object.class)));
- }
- if (interfaceHierarchy.size() == 0) {
- interfaceHierarchy.addAll(Arrays.asList(ServiceUtility.getInterfacesHierarchy(serviceClass, Object.class)));
- }
- interfaceHierarchy.add(serviceClass);
- ArrayList<Class> classHierarchy = new ArrayList<Class>();
- Class test = service.getService().getClass();
- while (test != null) {
- if (Object.class.isAssignableFrom(test)) {
- classHierarchy.add(0, test);
- }
- test = test.getSuperclass();
- }
- //
- p.pBold("Hierarchy");
- p.startTable(1, 0, 4);
- p.startTableRow();
- p.tableHeaderCell("Interfaces");
- p.tableHeaderCell("Classes");
- p.endTableRow();
- p.startTableRow();
- p.startTableCell();
- String prefix = "";
- for (Iterator it = interfaceHierarchy.iterator(); it.hasNext();) {
- Class c = (Class) it.next();
- p.print(prefix + c.getName());
- if (it.hasNext()) {
- p.br();
- prefix = prefix + "&nbsp;&nbsp;";
- }
- }
- p.endTableCell();
- p.startTableCell();
- prefix = "";
- for (Iterator it = classHierarchy.iterator(); it.hasNext();) {
- Class c = (Class) it.next();
- p.print(prefix + c.getName());
- if (it.hasNext()) {
- p.br();
- prefix = prefix + "&nbsp;&nbsp;";
- }
- }
- p.endTableCell();
- p.endTableRow();
- p.endTable();
- }
-
- private void renderProperties(HtmlComponent p, final ServiceInspector service, ReflectServiceInventory inv) {
- PropertyDescriptor[] properties = inv.getProperties();
- if (properties.length > 0) {
- p.pBold("Properties (" + properties.length + ")");
- p.startTable(1, 0, 4);
- p.startTableRow();
- p.tableHeaderCell("Property name");
- p.tableHeaderCell("Value");
- p.endTableRow();
- for (PropertyDescriptor desc : properties) {
- String propName = desc.getName();
- String propValue = "[value not available]";
- if (desc.getReadMethod() != null) {
- try {
- propValue = formatPropertyValue(desc, desc.getReadMethod().invoke(service.getService(), (Object[]) null));
- }
- catch (Exception e) {
- // nop
- }
- }
- boolean editable = desc.getWriteMethod() != null;
- //
- if (editable) {
- final PropertyDescriptor finalDesc = desc;
- p.startForm(
- new AbstractHtmlAction("changeProp." + service.getService().getClass().getName() + "." + desc.getName()) {
- @Override
- public void run() {
- String propText = getFormParameter("value", "");
- if (propText.length() == 0) {
- propText = null;
- }
- try {
- service.changeProperty(finalDesc, propText);
- }
- catch (Exception e) {
- LOG.error("setting " + finalDesc.getName() + "=" + propText, e);
- }
- }
- }
- );
- }
- p.startTableRow();
- p.tableCell(propName);
- p.startTableCell();
- if (editable) {
- p.formTextArea("value", getPropertyDisplayValue(propName, propValue));
- p.formSubmit("Change");
- }
- else {
- p.print(getPropertyDisplayValue(propName, propValue));
- }
- p.endTableCell();
- p.endTableRow();
- if (editable) {
- p.endForm();
- }
- }
- p.endTable();
- }
- }
-
- private void renderOperations(HtmlComponent p, ServiceInspector service, ReflectServiceInventory inv) {
- Method[] operations = inv.getOperations();
- if (operations.length > 0) {
- p.pBold("Operations (" + operations.length + ")");
- p.startTable(1, 0, 4);
- p.startTableRow();
- p.tableHeaderCell("Operation");
- p.tableHeaderCell("Detail");
- p.endTableRow();
- for (Method m : operations) {
- p.startTableRow();
- p.tableCell(m.getName());
- p.tableCell(createSignature(m.getReturnType()) + " " + m.getName() + "(" + createSignature(m.getParameterTypes()) + ")");
- p.endTableRow();
- }
- p.endTable();
- }
- }
-
- private void renderStates(HtmlComponent p, ServiceInspector service, ReflectServiceInventory inv) {
- String[] states = inv.getStates();
- if (states.length > 0) {
- p.pBold("State");
- p.raw("<pre>");
- for (String s : states) {
- p.print(s);
- p.br();
- }
- p.raw("</pre>");
- }
- }
-
- /**
- * @return Value to be displayed (sensitive information is not displayed).
- */
- private String getPropertyDisplayValue(String propertyName, String propertyValue) {
- if (isPropertySuppressed(propertyName)) {
- return "***";
- }
- else {
- return propertyValue;
- }
- }
-
- /**
- * @return true if property contains sensitive information and is therefore not shown
- */
- private boolean isPropertySuppressed(String propertyName) {
- return propertyName != null && propertyName.toLowerCase().contains("password");
- }
-
- private String formatPropertyValue(PropertyDescriptor p, Object value) {
- Object formattedValue = value;
- return StringUtility.valueOf(formattedValue);
- }
-
- private String createSignature(Class c) {
- if (c == null) {
- return "void";
- }
- else {
- return createSignature(new Class[]{c});
- }
- }
-
- private String createSignature(Class[] a) {
- StringBuffer sig = new StringBuffer();
- for (Class c : a) {
- if (sig.length() > 0) {
- sig.append(", ");
- }
- sig.append(c.getSimpleName());
- }
- return sig.toString();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.admin.html.view;
+
+import java.beans.PropertyDescriptor;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.eclipse.scout.commons.CompositeObject;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.server.admin.html.AbstractHtmlAction;
+import org.eclipse.scout.rt.server.admin.html.AdminSession;
+import org.eclipse.scout.rt.server.admin.html.widget.table.HtmlComponent;
+import org.eclipse.scout.rt.server.admin.inspector.ReflectServiceInventory;
+import org.eclipse.scout.rt.server.admin.inspector.ServiceInspector;
+import org.eclipse.scout.rt.server.internal.Activator;
+import org.eclipse.scout.rt.shared.security.UpdateServiceConfigurationPermission;
+import org.eclipse.scout.rt.shared.services.common.security.ACCESS;
+import org.eclipse.scout.service.SERVICES;
+import org.eclipse.scout.service.ServiceUtility;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+
+public class ServicesView extends DefaultView {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(ServicesView.class);
+
+ private ServiceInspector[] m_serviceInspectors;
+ private ServiceInspector m_selectedService;
+
+ public ServicesView(AdminSession as) {
+ super(as);
+ }
+
+ @Override
+ public boolean isVisible() {
+ return ACCESS.check(new UpdateServiceConfigurationPermission());
+ }
+
+ @Override
+ public void activated() {
+ // read all services
+ m_serviceInspectors = null;
+ Activator a = Activator.getDefault();
+ if (a != null) {
+ SERVICES.getService(String.class);
+ BundleContext context = a.getBundle().getBundleContext();
+ try {
+ ServiceReference[] refs = context.getAllServiceReferences(null, null);
+ if (refs != null) {
+ try {
+ ArrayList<ServiceInspector> list = new ArrayList<ServiceInspector>(refs.length);
+ for (ServiceReference ref : refs) {
+ Object s = context.getService(ref);
+ if (s != null) {
+ list.add(new ServiceInspector(s));
+ }
+ }
+ m_serviceInspectors = list.toArray(new ServiceInspector[list.size()]);
+ }
+ finally {
+ for (ServiceReference ref : refs) {
+ context.ungetService(ref);
+ }
+ }
+ }
+ }
+ catch (Exception e) {
+ // nop
+ }
+ }
+ }
+
+ @Override
+ public void produceTitle(HtmlComponent p) {
+ p.print("Services");
+ }
+
+ @Override
+ public void produceBody(HtmlComponent p) {
+ p.startTable(0, 5, 5);
+ p.startTableRow();
+ p.startTableCell();
+ renderServiceTables(p);
+ p.startTableCell();
+ // selected call
+ if (m_selectedService != null) {
+ renderServiceDetail(p, m_selectedService);
+ }
+ p.endTableCell();
+ p.endTableRow();
+ p.endTable();
+ }
+
+ private void renderServiceTables(HtmlComponent p) {
+ // categorize services
+ TreeMap<CompositeObject, Collection<ServiceInspector>> servicesMap = new TreeMap<CompositeObject, Collection<ServiceInspector>>();
+ if (m_serviceInspectors != null) {
+ for (ServiceInspector inspector : m_serviceInspectors) {
+ String serviceName = inspector.getService().getClass().getSimpleName();
+ String sectionName = null;
+ int sectionOrder;
+ try {
+ if (serviceName.matches(".*ProcessService")) {
+ sectionOrder = 1;
+ sectionName = "Process Services";
+ }
+ else if (serviceName.matches(".*OutlineService")) {
+ sectionOrder = 2;
+ sectionName = "Outline Services";
+ }
+ else if (serviceName.matches(".*LookupService")) {
+ sectionOrder = 3;
+ sectionName = "Lookup Services";
+ }
+ else {
+ Class[] serviceInterfaces = ServiceUtility.getInterfacesHierarchy(inspector.getService().getClass(), Object.class);
+ Class topInterface = (serviceInterfaces.length > 0 ? serviceInterfaces[serviceInterfaces.length - 1] : null);
+ if (topInterface != null && topInterface.getPackage() != null && topInterface.getPackage().getName().indexOf(".common.") >= 0) {
+ sectionOrder = 4;
+ sectionName = "Common Services";
+ }
+ else {
+ sectionOrder = 5;
+ sectionName = "Other Services";
+ }
+ }
+ CompositeObject key = new CompositeObject(sectionOrder, sectionName);
+ Collection<ServiceInspector> list = servicesMap.get(key);
+ if (list == null) {
+ list = new ArrayList<ServiceInspector>();
+ servicesMap.put(key, list);
+ }
+ list.add(inspector);
+ }
+ catch (Throwable t) {
+ LOG.warn("Failed inspecting service " + inspector.getService().getClass());
+ }
+ }
+ }
+ // tables per section
+ for (Map.Entry<CompositeObject, Collection<ServiceInspector>> e : servicesMap.entrySet()) {
+ String sectionName = (String) e.getKey().getComponent(1);
+ Collection<ServiceInspector> list = e.getValue();
+ renderServiceTable(p, sectionName, list);
+ p.p();
+ }
+ }
+
+ private void renderServiceTable(HtmlComponent p, String sectionName, Collection<ServiceInspector> serviceInspectors) {
+ // sort
+ TreeMap<String, ServiceInspector> sortMap = new TreeMap<String, ServiceInspector>();
+ for (ServiceInspector inspector : serviceInspectors) {
+ String s = inspector.getService().getClass().getName();
+ sortMap.put(s, inspector);
+ }
+
+ p.p(sectionName);
+ p.startListBox("listBox", 1, true);
+ p.listBoxOption(" ", new AbstractHtmlAction("selectService.choose") {
+ @Override
+ public void run() {
+ }
+ }, false);
+ for (ServiceInspector serviceInspector : sortMap.values()) {
+ boolean selected = m_selectedService != null && (m_selectedService.getService() == serviceInspector.getService());
+ final ServiceInspector finalServiceInspector = serviceInspector;
+ p.listBoxOption(serviceInspector.getService().getClass().getName(), new AbstractHtmlAction("selectService2." + serviceInspector.getService().getClass().getName()) {
+ @Override
+ public void run() {
+ m_selectedService = finalServiceInspector;
+ }
+ }, selected);
+ }
+ p.endListBox();
+
+ /*
+ * p.startTable(0,0,3,"100%"); p.startTableRow();
+ * p.tableHeaderCell(sectionName); p.endTableRow(); for(ServiceInspector
+ * serviceInspector: sortMap.values()){
+ * renderServiceRow(p,serviceInspector); } p.endTable();
+ */
+ }
+
+ private void renderServiceRow(HtmlComponent p, final ServiceInspector service) {
+ boolean selected = m_selectedService != null && (m_selectedService.getService() == service.getService());
+ p.startTableRow();
+ p.startTableCell();
+ String serviceId = service.getService().getClass().getSimpleName();
+ if (selected) {
+ p.bold(serviceId);
+ }
+ else {
+ p.linkAction(serviceId, new AbstractHtmlAction("selectService." + service.getService().getClass().getName()) {
+ @Override
+ public void run() {
+ m_selectedService = service;
+ }
+ });
+ }
+ p.endTableCell();
+ p.endTableRow();
+ }
+
+ private void renderServiceDetail(HtmlComponent p, ServiceInspector service) {
+ p.bold(service.getService().getClass().getSimpleName());
+ p.p();
+ ReflectServiceInventory inv;
+ try {
+ inv = service.buildInventory();
+ }
+ catch (Throwable t) {
+ p.raw("<font color=red>Inventory failed: " + t + "</font>");
+ return;
+ }
+ renderHierarchy(p, service, inv);
+ renderProperties(p, service, inv);
+ renderOperations(p, service, inv);
+ renderStates(p, service, inv);
+ }
+
+ private void renderHierarchy(HtmlComponent p, ServiceInspector service, ReflectServiceInventory inv) {
+ // hierarchy
+ Class serviceClass = service.getService().getClass();
+ ArrayList<Class> interfaceHierarchy = new ArrayList<Class>();
+ for (Class c : serviceClass.getInterfaces()) {
+ interfaceHierarchy.addAll(Arrays.asList(ServiceUtility.getInterfacesHierarchy(c, Object.class)));
+ }
+ if (interfaceHierarchy.size() == 0) {
+ interfaceHierarchy.addAll(Arrays.asList(ServiceUtility.getInterfacesHierarchy(serviceClass, Object.class)));
+ }
+ interfaceHierarchy.add(serviceClass);
+ ArrayList<Class> classHierarchy = new ArrayList<Class>();
+ Class test = service.getService().getClass();
+ while (test != null) {
+ if (Object.class.isAssignableFrom(test)) {
+ classHierarchy.add(0, test);
+ }
+ test = test.getSuperclass();
+ }
+ //
+ p.pBold("Hierarchy");
+ p.startTable(1, 0, 4);
+ p.startTableRow();
+ p.tableHeaderCell("Interfaces");
+ p.tableHeaderCell("Classes");
+ p.endTableRow();
+ p.startTableRow();
+ p.startTableCell();
+ String prefix = "";
+ for (Iterator it = interfaceHierarchy.iterator(); it.hasNext();) {
+ Class c = (Class) it.next();
+ p.print(prefix + c.getName());
+ if (it.hasNext()) {
+ p.br();
+ prefix = prefix + "&nbsp;&nbsp;";
+ }
+ }
+ p.endTableCell();
+ p.startTableCell();
+ prefix = "";
+ for (Iterator it = classHierarchy.iterator(); it.hasNext();) {
+ Class c = (Class) it.next();
+ p.print(prefix + c.getName());
+ if (it.hasNext()) {
+ p.br();
+ prefix = prefix + "&nbsp;&nbsp;";
+ }
+ }
+ p.endTableCell();
+ p.endTableRow();
+ p.endTable();
+ }
+
+ private void renderProperties(HtmlComponent p, final ServiceInspector service, ReflectServiceInventory inv) {
+ PropertyDescriptor[] properties = inv.getProperties();
+ if (properties.length > 0) {
+ p.pBold("Properties (" + properties.length + ")");
+ p.startTable(1, 0, 4);
+ p.startTableRow();
+ p.tableHeaderCell("Property name");
+ p.tableHeaderCell("Value");
+ p.endTableRow();
+ for (PropertyDescriptor desc : properties) {
+ String propName = desc.getName();
+ String propValue = "[value not available]";
+ if (desc.getReadMethod() != null) {
+ try {
+ propValue = formatPropertyValue(desc, desc.getReadMethod().invoke(service.getService(), (Object[]) null));
+ }
+ catch (Exception e) {
+ // nop
+ }
+ }
+ boolean editable = desc.getWriteMethod() != null;
+ //
+ if (editable) {
+ final PropertyDescriptor finalDesc = desc;
+ p.startForm(
+ new AbstractHtmlAction("changeProp." + service.getService().getClass().getName() + "." + desc.getName()) {
+ @Override
+ public void run() {
+ String propText = getFormParameter("value", "");
+ if (propText.length() == 0) {
+ propText = null;
+ }
+ try {
+ service.changeProperty(finalDesc, propText);
+ }
+ catch (Exception e) {
+ LOG.error("setting " + finalDesc.getName() + "=" + propText, e);
+ }
+ }
+ }
+ );
+ }
+ p.startTableRow();
+ p.tableCell(propName);
+ p.startTableCell();
+ if (editable) {
+ p.formTextArea("value", getPropertyDisplayValue(propName, propValue));
+ p.formSubmit("Change");
+ }
+ else {
+ p.print(getPropertyDisplayValue(propName, propValue));
+ }
+ p.endTableCell();
+ p.endTableRow();
+ if (editable) {
+ p.endForm();
+ }
+ }
+ p.endTable();
+ }
+ }
+
+ private void renderOperations(HtmlComponent p, ServiceInspector service, ReflectServiceInventory inv) {
+ Method[] operations = inv.getOperations();
+ if (operations.length > 0) {
+ p.pBold("Operations (" + operations.length + ")");
+ p.startTable(1, 0, 4);
+ p.startTableRow();
+ p.tableHeaderCell("Operation");
+ p.tableHeaderCell("Detail");
+ p.endTableRow();
+ for (Method m : operations) {
+ p.startTableRow();
+ p.tableCell(m.getName());
+ p.tableCell(createSignature(m.getReturnType()) + " " + m.getName() + "(" + createSignature(m.getParameterTypes()) + ")");
+ p.endTableRow();
+ }
+ p.endTable();
+ }
+ }
+
+ private void renderStates(HtmlComponent p, ServiceInspector service, ReflectServiceInventory inv) {
+ String[] states = inv.getStates();
+ if (states.length > 0) {
+ p.pBold("State");
+ p.raw("<pre>");
+ for (String s : states) {
+ p.print(s);
+ p.br();
+ }
+ p.raw("</pre>");
+ }
+ }
+
+ /**
+ * @return Value to be displayed (sensitive information is not displayed).
+ */
+ private String getPropertyDisplayValue(String propertyName, String propertyValue) {
+ if (isPropertySuppressed(propertyName)) {
+ return "***";
+ }
+ else {
+ return propertyValue;
+ }
+ }
+
+ /**
+ * @return true if property contains sensitive information and is therefore not shown
+ */
+ private boolean isPropertySuppressed(String propertyName) {
+ return propertyName != null && propertyName.toLowerCase().contains("password");
+ }
+
+ private String formatPropertyValue(PropertyDescriptor p, Object value) {
+ Object formattedValue = value;
+ return StringUtility.valueOf(formattedValue);
+ }
+
+ private String createSignature(Class c) {
+ if (c == null) {
+ return "void";
+ }
+ else {
+ return createSignature(new Class[]{c});
+ }
+ }
+
+ private String createSignature(Class[] a) {
+ StringBuffer sig = new StringBuffer();
+ for (Class c : a) {
+ if (sig.length() > 0) {
+ sig.append(", ");
+ }
+ sig.append(c.getSimpleName());
+ }
+ return sig.toString();
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/view/SessionsView.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/view/SessionsView.java
index 290fb92a7c..5405325f0a 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/view/SessionsView.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/view/SessionsView.java
@@ -1,184 +1,184 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.admin.html.view;
-
-import java.security.Principal;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.TreeMap;
-
-import javax.security.auth.Subject;
-
-import org.eclipse.scout.commons.CompositeObject;
-import org.eclipse.scout.rt.server.admin.html.AbstractHtmlAction;
-import org.eclipse.scout.rt.server.admin.html.AdminSession;
-import org.eclipse.scout.rt.server.admin.html.widget.table.HtmlComponent;
-import org.eclipse.scout.rt.server.admin.html.widget.table.HtmlTable;
-import org.eclipse.scout.rt.server.admin.html.widget.table.SortInfo;
-import org.eclipse.scout.rt.server.admin.html.widget.table.VirtualRow;
-import org.eclipse.scout.rt.server.admin.inspector.ProcessInspector;
-import org.eclipse.scout.rt.server.admin.inspector.SessionInspector;
-import org.eclipse.scout.rt.shared.security.UpdateServiceConfigurationPermission;
-import org.eclipse.scout.rt.shared.services.common.security.ACCESS;
-
-public class SessionsView extends DefaultView {
- private SessionInspector m_selectedSession;
- private SortInfo m_table1SortInfo;
-
- public SessionsView(AdminSession as) {
- super(as);
- m_table1SortInfo = new SortInfo();
- }
-
- public SessionInspector getSelectedSession() {
- return m_selectedSession;
- }
-
- @Override
- public boolean isVisible() {
- return ACCESS.check(new UpdateServiceConfigurationPermission()) && ProcessInspector.getDefault().isEnabled();
- }
-
- @Override
- public void produceTitle(HtmlComponent p) {
- p.print("Sessions");
- }
-
- @Override
- public void produceBody(HtmlComponent p) {
- p.linkAction("Clear sessions", new AbstractHtmlAction("clearSessions") {
- @Override
- public void run() {
- ProcessInspector.getDefault().clearSessionInspectors();
- }
- });
- p.p();
- //
- renderSessionTable(p);
- }
-
- private void renderSessionTable(HtmlComponent p) {
- SessionInspector[] sessionInspectors = ProcessInspector.getDefault().getSessionInspectors();
- TreeMap<CompositeObject, SessionInspector> userAndTimeToSessions = new TreeMap<CompositeObject, SessionInspector>();
- for (int i = 0; i < sessionInspectors.length; i++) {
- String user = sessionInspectors[i].getInfo().getUserId();
- long lastAccess = sessionInspectors[i].getInfo().getLastAccessedTime();
- userAndTimeToSessions.put(new CompositeObject(lastAccess, user, i), sessionInspectors[i]);
- }
- SessionInspector[] sorted = userAndTimeToSessions.values().toArray(new SessionInspector[userAndTimeToSessions.size()]);
- // render
- HtmlTable table1 = new HtmlTable(p, "table1", m_table1SortInfo);
- table1.startTable(1, 0, 3);
- table1.startTableRow();
- table1.tableHeaderCell("#");
- table1.tableHeaderCell("User");
- table1.tableHeaderCell("SessionID");
- table1.tableHeaderCell("Details");
- table1.tableHeaderCell("Created");
- table1.tableHeaderCell("Last&nbsp;accessed");
- table1.tableHeaderCell("JAAS");
- table1.tableHeaderCell("UserAgent");
- table1.endTableRow();
- SessionInspector validSelection = null;
- for (int i = sorted.length - 1; i >= 0; i--) {
- if (sorted[i] == m_selectedSession) {
- validSelection = m_selectedSession;
- }
- VirtualRow vrow = table1.addVirtualRow();
- renderSessionRow(vrow, i + 1, sorted[i]);
- }
- table1.appendVirtualRows();
- m_selectedSession = validSelection;
- table1.endTable();
- p.append(table1);
- }
-
- private void renderSessionRow(HtmlComponent p, int index, final SessionInspector session) {
- boolean selected = m_selectedSession != null && (m_selectedSession == session);
- SimpleDateFormat fmt = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
- //
- p.startTableRow();
- p.tableCell("" + index);
- p.tableCell(session.getInfo().getUserId());
- p.startTableCell();
- if (selected) {
- p.focusAnchor();
- }
- p.startLinkAction(new AbstractHtmlAction("selectSession" + session.getInfo().getSessionId()) {
- @Override
- public void run() {
- m_selectedSession = session;
- }
- });
- p.print(session.getInfo().getSessionId());
- p.endLinkAction();
- p.endTableCell();
- p.startTableCell();
- p.startLinkAction(new AbstractHtmlAction("showServicesOf" + session.getInfo().getSessionId()) {
- @Override
- public void run() {
- m_selectedSession = session;
- getAdminSession().getTopView().showServices();
- }
- });
- p.print("Services");
- p.endLinkAction();
- p.raw("&nbsp;");
- p.startLinkAction(new AbstractHtmlAction("showCallsOf" + session.getInfo().getSessionId()) {
- @Override
- public void run() {
- m_selectedSession = session;
- getAdminSession().getTopView().showCalls();
- }
- });
- p.print("Calls");
- p.endLinkAction();
- p.endTableCell();
- p.startTableCell();
- p.printNoBreak(fmt.format(new Date(session.getInfo().getCreationTime())));
- p.endTableCell();
- p.startTableCell();
- p.printNoBreak(fmt.format(new Date(session.getInfo().getLastAccessedTime())));
- p.endTableCell();
- p.startTableCell();
- // show jaas context
- try {
- Subject subject = session.getInfo().getSubject();
- if (subject != null) {
- int i = 0;
- for (Principal principal : subject.getPrincipals()) {
- if (principal != null) {
- if (i > 0) {
- p.br();
- }
- String s = "principal[" + i + "] name=" + principal.getName() + " toString=" + principal.toString() + " class=" + principal.getClass();
- s = s.replaceAll("[\\n\\r]+", " ");
- p.printNoBreak(s);
- i++;
- }
- }
- }
- else {
- p.printNoBreak("no subject available");
- }
- }
- catch (Exception e) {
- p.br();
- p.print("Exception: " + e);
- }
- p.endTableCell();
- p.startTableCell();
- p.printNoBreak(session.getInfo().getUserAgent().toString());
- p.endTableCell();
- p.endTableRow();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.admin.html.view;
+
+import java.security.Principal;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.TreeMap;
+
+import javax.security.auth.Subject;
+
+import org.eclipse.scout.commons.CompositeObject;
+import org.eclipse.scout.rt.server.admin.html.AbstractHtmlAction;
+import org.eclipse.scout.rt.server.admin.html.AdminSession;
+import org.eclipse.scout.rt.server.admin.html.widget.table.HtmlComponent;
+import org.eclipse.scout.rt.server.admin.html.widget.table.HtmlTable;
+import org.eclipse.scout.rt.server.admin.html.widget.table.SortInfo;
+import org.eclipse.scout.rt.server.admin.html.widget.table.VirtualRow;
+import org.eclipse.scout.rt.server.admin.inspector.ProcessInspector;
+import org.eclipse.scout.rt.server.admin.inspector.SessionInspector;
+import org.eclipse.scout.rt.shared.security.UpdateServiceConfigurationPermission;
+import org.eclipse.scout.rt.shared.services.common.security.ACCESS;
+
+public class SessionsView extends DefaultView {
+ private SessionInspector m_selectedSession;
+ private SortInfo m_table1SortInfo;
+
+ public SessionsView(AdminSession as) {
+ super(as);
+ m_table1SortInfo = new SortInfo();
+ }
+
+ public SessionInspector getSelectedSession() {
+ return m_selectedSession;
+ }
+
+ @Override
+ public boolean isVisible() {
+ return ACCESS.check(new UpdateServiceConfigurationPermission()) && ProcessInspector.getDefault().isEnabled();
+ }
+
+ @Override
+ public void produceTitle(HtmlComponent p) {
+ p.print("Sessions");
+ }
+
+ @Override
+ public void produceBody(HtmlComponent p) {
+ p.linkAction("Clear sessions", new AbstractHtmlAction("clearSessions") {
+ @Override
+ public void run() {
+ ProcessInspector.getDefault().clearSessionInspectors();
+ }
+ });
+ p.p();
+ //
+ renderSessionTable(p);
+ }
+
+ private void renderSessionTable(HtmlComponent p) {
+ SessionInspector[] sessionInspectors = ProcessInspector.getDefault().getSessionInspectors();
+ TreeMap<CompositeObject, SessionInspector> userAndTimeToSessions = new TreeMap<CompositeObject, SessionInspector>();
+ for (int i = 0; i < sessionInspectors.length; i++) {
+ String user = sessionInspectors[i].getInfo().getUserId();
+ long lastAccess = sessionInspectors[i].getInfo().getLastAccessedTime();
+ userAndTimeToSessions.put(new CompositeObject(lastAccess, user, i), sessionInspectors[i]);
+ }
+ SessionInspector[] sorted = userAndTimeToSessions.values().toArray(new SessionInspector[userAndTimeToSessions.size()]);
+ // render
+ HtmlTable table1 = new HtmlTable(p, "table1", m_table1SortInfo);
+ table1.startTable(1, 0, 3);
+ table1.startTableRow();
+ table1.tableHeaderCell("#");
+ table1.tableHeaderCell("User");
+ table1.tableHeaderCell("SessionID");
+ table1.tableHeaderCell("Details");
+ table1.tableHeaderCell("Created");
+ table1.tableHeaderCell("Last&nbsp;accessed");
+ table1.tableHeaderCell("JAAS");
+ table1.tableHeaderCell("UserAgent");
+ table1.endTableRow();
+ SessionInspector validSelection = null;
+ for (int i = sorted.length - 1; i >= 0; i--) {
+ if (sorted[i] == m_selectedSession) {
+ validSelection = m_selectedSession;
+ }
+ VirtualRow vrow = table1.addVirtualRow();
+ renderSessionRow(vrow, i + 1, sorted[i]);
+ }
+ table1.appendVirtualRows();
+ m_selectedSession = validSelection;
+ table1.endTable();
+ p.append(table1);
+ }
+
+ private void renderSessionRow(HtmlComponent p, int index, final SessionInspector session) {
+ boolean selected = m_selectedSession != null && (m_selectedSession == session);
+ SimpleDateFormat fmt = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
+ //
+ p.startTableRow();
+ p.tableCell("" + index);
+ p.tableCell(session.getInfo().getUserId());
+ p.startTableCell();
+ if (selected) {
+ p.focusAnchor();
+ }
+ p.startLinkAction(new AbstractHtmlAction("selectSession" + session.getInfo().getSessionId()) {
+ @Override
+ public void run() {
+ m_selectedSession = session;
+ }
+ });
+ p.print(session.getInfo().getSessionId());
+ p.endLinkAction();
+ p.endTableCell();
+ p.startTableCell();
+ p.startLinkAction(new AbstractHtmlAction("showServicesOf" + session.getInfo().getSessionId()) {
+ @Override
+ public void run() {
+ m_selectedSession = session;
+ getAdminSession().getTopView().showServices();
+ }
+ });
+ p.print("Services");
+ p.endLinkAction();
+ p.raw("&nbsp;");
+ p.startLinkAction(new AbstractHtmlAction("showCallsOf" + session.getInfo().getSessionId()) {
+ @Override
+ public void run() {
+ m_selectedSession = session;
+ getAdminSession().getTopView().showCalls();
+ }
+ });
+ p.print("Calls");
+ p.endLinkAction();
+ p.endTableCell();
+ p.startTableCell();
+ p.printNoBreak(fmt.format(new Date(session.getInfo().getCreationTime())));
+ p.endTableCell();
+ p.startTableCell();
+ p.printNoBreak(fmt.format(new Date(session.getInfo().getLastAccessedTime())));
+ p.endTableCell();
+ p.startTableCell();
+ // show jaas context
+ try {
+ Subject subject = session.getInfo().getSubject();
+ if (subject != null) {
+ int i = 0;
+ for (Principal principal : subject.getPrincipals()) {
+ if (principal != null) {
+ if (i > 0) {
+ p.br();
+ }
+ String s = "principal[" + i + "] name=" + principal.getName() + " toString=" + principal.toString() + " class=" + principal.getClass();
+ s = s.replaceAll("[\\n\\r]+", " ");
+ p.printNoBreak(s);
+ i++;
+ }
+ }
+ }
+ else {
+ p.printNoBreak("no subject available");
+ }
+ }
+ catch (Exception e) {
+ p.br();
+ p.print("Exception: " + e);
+ }
+ p.endTableCell();
+ p.startTableCell();
+ p.printNoBreak(session.getInfo().getUserAgent().toString());
+ p.endTableCell();
+ p.endTableRow();
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/view/TopView.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/view/TopView.java
index 3656a2ea00..63aef87d03 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/view/TopView.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/view/TopView.java
@@ -1,116 +1,116 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.admin.html.view;
-
-import org.eclipse.scout.rt.server.admin.html.AbstractHtmlAction;
-import org.eclipse.scout.rt.server.admin.html.AdminSession;
-import org.eclipse.scout.rt.server.admin.html.IView;
-import org.eclipse.scout.rt.server.admin.html.widget.table.HtmlComponent;
-
-public class TopView extends DefaultView {
- private MessagesView m_messagesView;
- private GeneralView m_generalView;
- private ServicesView m_servicesView;
- private SessionsView m_sessionsView;
- private CallsView m_callsView;
-
- private IView m_activeView;
-
- public TopView(AdminSession as) {
- super(as);
- m_messagesView = new MessagesView(as);
- m_generalView = new GeneralView(as);
- m_servicesView = new ServicesView(as);
- m_sessionsView = new SessionsView(as);
- m_callsView = new CallsView(as);
-
- m_activeView = m_generalView;
- }
-
- public IView getActiveView() {
- return m_activeView;
- }
-
- public void showGeneral() {
- m_activeView = m_generalView;
- }
-
- public void showServices() {
- m_activeView = m_servicesView;
- }
-
- public void showUsers() {
- m_activeView = m_sessionsView;
- }
-
- public void showSessions() {
- m_activeView = m_sessionsView;
- }
-
- public void showCalls() {
- m_activeView = m_callsView;
- }
-
- public GeneralView getGeneralView() {
- return m_generalView;
- }
-
- public ServicesView getServicesView() {
- return m_servicesView;
- }
-
- public SessionsView getSessionsView() {
- return m_sessionsView;
- }
-
- public CallsView getCallsView() {
- return m_callsView;
- }
-
- @Override
- public void produceBody(HtmlComponent p) {
- m_messagesView.produceBody(p);
- p.raw("[ ");
- for (IView v : new IView[]{m_generalView, m_servicesView, m_sessionsView, m_callsView}) {
- if (v.isVisible()) {
- p.raw("&nbsp;");
- if (v == m_activeView) {
- p.raw("<b>");
- v.produceTitle(p);
- p.raw("</b>");
- }
- else {
- final IView finalV = v;
- p.startLinkAction(
- new AbstractHtmlAction("tab." + v.getClass().getSimpleName()) {
- @Override
- public void run() {
- m_activeView = finalV;
- if (m_activeView != null) {
- m_activeView.activated();
- }
- }
- }
- );
- v.produceTitle(p);
- p.endLinkAction();
- }
- p.raw("&nbsp;");
- p.raw("&nbsp;");
- }
- }
- p.raw(" ]");
- p.p();
- if (m_activeView != null) {
- m_activeView.produceBody(p);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.admin.html.view;
+
+import org.eclipse.scout.rt.server.admin.html.AbstractHtmlAction;
+import org.eclipse.scout.rt.server.admin.html.AdminSession;
+import org.eclipse.scout.rt.server.admin.html.IView;
+import org.eclipse.scout.rt.server.admin.html.widget.table.HtmlComponent;
+
+public class TopView extends DefaultView {
+ private MessagesView m_messagesView;
+ private GeneralView m_generalView;
+ private ServicesView m_servicesView;
+ private SessionsView m_sessionsView;
+ private CallsView m_callsView;
+
+ private IView m_activeView;
+
+ public TopView(AdminSession as) {
+ super(as);
+ m_messagesView = new MessagesView(as);
+ m_generalView = new GeneralView(as);
+ m_servicesView = new ServicesView(as);
+ m_sessionsView = new SessionsView(as);
+ m_callsView = new CallsView(as);
+
+ m_activeView = m_generalView;
+ }
+
+ public IView getActiveView() {
+ return m_activeView;
+ }
+
+ public void showGeneral() {
+ m_activeView = m_generalView;
+ }
+
+ public void showServices() {
+ m_activeView = m_servicesView;
+ }
+
+ public void showUsers() {
+ m_activeView = m_sessionsView;
+ }
+
+ public void showSessions() {
+ m_activeView = m_sessionsView;
+ }
+
+ public void showCalls() {
+ m_activeView = m_callsView;
+ }
+
+ public GeneralView getGeneralView() {
+ return m_generalView;
+ }
+
+ public ServicesView getServicesView() {
+ return m_servicesView;
+ }
+
+ public SessionsView getSessionsView() {
+ return m_sessionsView;
+ }
+
+ public CallsView getCallsView() {
+ return m_callsView;
+ }
+
+ @Override
+ public void produceBody(HtmlComponent p) {
+ m_messagesView.produceBody(p);
+ p.raw("[ ");
+ for (IView v : new IView[]{m_generalView, m_servicesView, m_sessionsView, m_callsView}) {
+ if (v.isVisible()) {
+ p.raw("&nbsp;");
+ if (v == m_activeView) {
+ p.raw("<b>");
+ v.produceTitle(p);
+ p.raw("</b>");
+ }
+ else {
+ final IView finalV = v;
+ p.startLinkAction(
+ new AbstractHtmlAction("tab." + v.getClass().getSimpleName()) {
+ @Override
+ public void run() {
+ m_activeView = finalV;
+ if (m_activeView != null) {
+ m_activeView.activated();
+ }
+ }
+ }
+ );
+ v.produceTitle(p);
+ p.endLinkAction();
+ }
+ p.raw("&nbsp;");
+ p.raw("&nbsp;");
+ }
+ }
+ p.raw(" ]");
+ p.p();
+ if (m_activeView != null) {
+ m_activeView.produceBody(p);
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/widget/table/HtmlComponent.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/widget/table/HtmlComponent.java
index 37f521d20b..f260a342dc 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/widget/table/HtmlComponent.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/widget/table/HtmlComponent.java
@@ -1,333 +1,333 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.admin.html.widget.table;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.rt.server.admin.html.AbstractHtmlAction;
-
-public class HtmlComponent {
- protected String m_baseURL;
- protected HttpServletRequest m_req;
- protected HttpServletResponse m_res;
- protected StringWriter m_writer;
- protected PrintWriter out;
- // action list
- protected Map<String, AbstractHtmlAction> m_actionMap;
- // action invokation feedback
- protected AbstractHtmlAction m_invokedAction;
-
- public HtmlComponent(HttpServletRequest req, HttpServletResponse res) {
- m_req = req;
- m_res = res;
- m_baseURL = m_req.getContextPath() + m_req.getServletPath();
- m_writer = new StringWriter();
- out = new PrintWriter(m_writer, true);
- m_actionMap = new HashMap<String, AbstractHtmlAction>();
- }
-
- public HtmlComponent(HtmlComponent other) {
- m_req = other.m_req;
- m_res = other.m_res;
- m_baseURL = other.m_baseURL;
- m_invokedAction = other.m_invokedAction;
- //
- m_writer = new StringWriter();
- out = new PrintWriter(m_writer, true);
- m_actionMap = new HashMap<String, AbstractHtmlAction>();
- }
-
- public void append(HtmlComponent other) {
- out.print(other.getProducedHtml());
- m_actionMap.putAll(other.m_actionMap);
- }
-
- public void setInvokedAction(AbstractHtmlAction invokedAction) {
- m_invokedAction = invokedAction;
- }
-
- public AbstractHtmlAction getInvokedAction() {
- return m_invokedAction;
- }
-
- private String buildActionId(AbstractHtmlAction action) {
- return action.getUid();
- }
-
- public HttpServletRequest getRequest() {
- return m_req;
- }
-
- public HttpServletResponse getResponse() {
- return m_res;
- }
-
- public Map<String, AbstractHtmlAction> getActionMap() {
- return m_actionMap;
- }
-
- public String getProducedHtml() {
- return m_writer.toString();
- }
-
- public void linkAction(String actionName, AbstractHtmlAction action) {
- startLinkAction(action);
- print(actionName);
- endLinkAction();
- }
-
- public void startLinkAction(AbstractHtmlAction action) {
- String actionId = buildActionId(action);
- m_actionMap.put(actionId, action);
- String u = m_baseURL + "?actionId=" + actionId + "#focus";
- out.print("<a href='" + u + "'>");
- }
-
- public void endLinkAction() {
- out.print("</a>");
- }
-
- public void startForm(AbstractHtmlAction action) {
- String actionId = buildActionId(action);
- m_actionMap.put(actionId, action);
- String u = m_baseURL;
- out.print("<form action='" + u + "' method='get'>");
- out.print("<input type='hidden' name='actionId' value='" + actionId + "'>");
- }
-
- public void formTextArea(String fieldName, String value) {
- if (value == null) {
- value = "";
- }
- int valueLen = value.length();
- int cols = 50;
- int rows = 1;
- rows = Math.max(rows, (valueLen + cols - 1) / cols);
- rows = Math.max(rows, StringUtility.getLineCount(value));
- out.print("<textarea rows=" + rows + " cols=" + cols + " name='" + fieldName + "'>");
- print(value);
- out.print("</textarea>");
- }
-
- public void startListBox(String fieldName, int size, boolean actionOnClick) {
- out.print("<select name=\"" + fieldName + "\" size=\"" + size + "\"");
- if (actionOnClick) {
- out.print(" onchange=\"javascript:window.location.href='" + m_baseURL + "?actionId='+this.value+'#focus';\"");
- }
- out.print(">");
- }
-
- public void radioBoxOption(String fieldName, String text, AbstractHtmlAction action, boolean selected) {
- String actionId = buildActionId(action);
- m_actionMap.put(actionId, action);
- out.print("<input type=\"radio\" name=\"" + fieldName + "\" value=\"" + actionId + "\" " + (selected ? " checked=\"checked\" " : "") + " onchange=\"javascript:window.location.href='" + m_baseURL + "?actionId='+this.value+'#focus';\">" + javaToHtml(text) + "</input>");
- }
-
- /**
- * normaly used with {@link #startListBox(int, FALSE)}
- */
- public void listBoxOption(String text, String value, boolean selected) {
- out.print("<option" + (selected ? " selected" : "") + " value=\"" + value + "\">" + javaToHtml(text) + "</option>");
- }
-
- /**
- * normaly used with {@link #startListBox(int, TRUE)}
- */
- public void listBoxOption(String text, AbstractHtmlAction action, boolean selected) {
- String actionId = buildActionId(action);
- m_actionMap.put(actionId, action);
- out.print("<option" + (selected ? " selected" : "") + " value=\"" + actionId + "\">" + javaToHtml(text) + "</option>");
- }
-
- public void endListBox() {
- out.print("</select>");
- }
-
- public void formSubmit(String value) {
- out.print("<input type=submit value='" + value + "'>");
- }
-
- public void endForm() {
- out.print("</form>");
- }
-
- public void print(String s) {
- out.print(javaToHtml(s));
- }
-
- public void printNoBreak(String s) {
- s = javaToHtml(s);
- s = s.replaceAll(" ", "&nbsp;");
- out.print(s);
- }
-
- public void br() {
- out.print("<br>");
- }
-
- public void focusAnchor() {
- out.print("<a name=\"focus\"></a>");
- }
-
- public void bold(String text) {
- out.print("<b>");
- print(text);
- out.print("</b>");
- }
-
- public void pBold(String text) {
- out.print("<p><b>");
- print(text);
- out.print("</b></p>");
- }
-
- public void pItalic(String text) {
- out.print("<p><i>");
- print(text);
- out.print("</i></p>");
- }
-
- public void p(String text) {
- out.print("<p>");
- print(text);
- out.print("</p>");
- }
-
- public void p() {
- out.print("<p>");
- }
-
- public void raw(String s) {
- out.print(s);
- }
-
- public void startTable() {
- startTable(0);
- }
-
- public void startTable(int border) {
- startTable(border, 0, 0);
- }
-
- public void startTable(int border, int cellspacing, int cellpadding) {
- startTable(border, cellspacing, cellpadding, null);
- }
-
- public void startTable(int border, int cellspacing, int cellpadding, String width) {
- out.print("<table");
- if (border >= 0) {
- out.print(" border=" + border);
- }
- if (cellspacing >= 0) {
- out.print(" cellspacing=" + cellspacing);
- }
- if (cellpadding >= 0) {
- out.print(" cellpadding=" + cellpadding);
- }
- if (width != null) {
- out.print(" width='" + width + "'");
- }
- out.print(">");
- }
-
- public void endTable() {
- out.print("</table>");
- }
-
- public void startTableRow() {
- out.print("<tr>");
- }
-
- public void endTableRow() {
- out.println("</tr>");
- }
-
- public void spacingRow(int columnCount) {
- out.print("<tr>");
- out.print("<td colspan=\"" + columnCount + "\">");
- out.print("&nbsp;");
- out.print("</td>");
- out.println("</tr>");
- }
-
- public void startTableCell() {
- startTableCell(1, 1);
- }
-
- public void startTableCell(int rows, int cols) {
- startTableCell(rows, cols, null);
- }
-
- public void startTableCell(int rows, int cols, String color) {
- out.print("<td");
- if (rows > 1) {
- out.print(" rowspan=" + rows);
- }
- if (cols > 1) {
- out.print(" colspan=" + cols);
- }
- if (color != null) {
- out.print(" bgcolor='#" + color + "'");
- }
- out.print(">");
- }
-
- public void endTableCell() {
- out.print("</td>");
- }
-
- public void tableCell(String content) {
- tableCell(content, 1, 1);
- }
-
- public void tableCell(String content, int rows, int cols) {
- tableCell(content, 1, 1, null);
- }
-
- public void tableCell(String content, int rows, int cols, String color) {
- startTableCell(rows, cols, color);
- if (content == null || content.trim().length() == 0) {
- out.print("&nbsp;");
- }
- else {
- print(content);
- }
- endTableCell();
- }
-
- public void tableHeaderCell(String content) {
- out.print("<th>");
- if (content == null || content.trim().length() == 0) {
- out.print("&nbsp;");
- }
- else {
- print(content);
- }
- out.print("</th>");
- }
-
- public String javaToHtml(String s) {
- if (s == null) {
- return "";
- }
- s = s.replaceAll("<", "&lt;");
- s = s.replaceAll(">", "&gt;");
- return s;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.admin.html.widget.table;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.rt.server.admin.html.AbstractHtmlAction;
+
+public class HtmlComponent {
+ protected String m_baseURL;
+ protected HttpServletRequest m_req;
+ protected HttpServletResponse m_res;
+ protected StringWriter m_writer;
+ protected PrintWriter out;
+ // action list
+ protected Map<String, AbstractHtmlAction> m_actionMap;
+ // action invokation feedback
+ protected AbstractHtmlAction m_invokedAction;
+
+ public HtmlComponent(HttpServletRequest req, HttpServletResponse res) {
+ m_req = req;
+ m_res = res;
+ m_baseURL = m_req.getContextPath() + m_req.getServletPath();
+ m_writer = new StringWriter();
+ out = new PrintWriter(m_writer, true);
+ m_actionMap = new HashMap<String, AbstractHtmlAction>();
+ }
+
+ public HtmlComponent(HtmlComponent other) {
+ m_req = other.m_req;
+ m_res = other.m_res;
+ m_baseURL = other.m_baseURL;
+ m_invokedAction = other.m_invokedAction;
+ //
+ m_writer = new StringWriter();
+ out = new PrintWriter(m_writer, true);
+ m_actionMap = new HashMap<String, AbstractHtmlAction>();
+ }
+
+ public void append(HtmlComponent other) {
+ out.print(other.getProducedHtml());
+ m_actionMap.putAll(other.m_actionMap);
+ }
+
+ public void setInvokedAction(AbstractHtmlAction invokedAction) {
+ m_invokedAction = invokedAction;
+ }
+
+ public AbstractHtmlAction getInvokedAction() {
+ return m_invokedAction;
+ }
+
+ private String buildActionId(AbstractHtmlAction action) {
+ return action.getUid();
+ }
+
+ public HttpServletRequest getRequest() {
+ return m_req;
+ }
+
+ public HttpServletResponse getResponse() {
+ return m_res;
+ }
+
+ public Map<String, AbstractHtmlAction> getActionMap() {
+ return m_actionMap;
+ }
+
+ public String getProducedHtml() {
+ return m_writer.toString();
+ }
+
+ public void linkAction(String actionName, AbstractHtmlAction action) {
+ startLinkAction(action);
+ print(actionName);
+ endLinkAction();
+ }
+
+ public void startLinkAction(AbstractHtmlAction action) {
+ String actionId = buildActionId(action);
+ m_actionMap.put(actionId, action);
+ String u = m_baseURL + "?actionId=" + actionId + "#focus";
+ out.print("<a href='" + u + "'>");
+ }
+
+ public void endLinkAction() {
+ out.print("</a>");
+ }
+
+ public void startForm(AbstractHtmlAction action) {
+ String actionId = buildActionId(action);
+ m_actionMap.put(actionId, action);
+ String u = m_baseURL;
+ out.print("<form action='" + u + "' method='get'>");
+ out.print("<input type='hidden' name='actionId' value='" + actionId + "'>");
+ }
+
+ public void formTextArea(String fieldName, String value) {
+ if (value == null) {
+ value = "";
+ }
+ int valueLen = value.length();
+ int cols = 50;
+ int rows = 1;
+ rows = Math.max(rows, (valueLen + cols - 1) / cols);
+ rows = Math.max(rows, StringUtility.getLineCount(value));
+ out.print("<textarea rows=" + rows + " cols=" + cols + " name='" + fieldName + "'>");
+ print(value);
+ out.print("</textarea>");
+ }
+
+ public void startListBox(String fieldName, int size, boolean actionOnClick) {
+ out.print("<select name=\"" + fieldName + "\" size=\"" + size + "\"");
+ if (actionOnClick) {
+ out.print(" onchange=\"javascript:window.location.href='" + m_baseURL + "?actionId='+this.value+'#focus';\"");
+ }
+ out.print(">");
+ }
+
+ public void radioBoxOption(String fieldName, String text, AbstractHtmlAction action, boolean selected) {
+ String actionId = buildActionId(action);
+ m_actionMap.put(actionId, action);
+ out.print("<input type=\"radio\" name=\"" + fieldName + "\" value=\"" + actionId + "\" " + (selected ? " checked=\"checked\" " : "") + " onchange=\"javascript:window.location.href='" + m_baseURL + "?actionId='+this.value+'#focus';\">" + javaToHtml(text) + "</input>");
+ }
+
+ /**
+ * normaly used with {@link #startListBox(int, FALSE)}
+ */
+ public void listBoxOption(String text, String value, boolean selected) {
+ out.print("<option" + (selected ? " selected" : "") + " value=\"" + value + "\">" + javaToHtml(text) + "</option>");
+ }
+
+ /**
+ * normaly used with {@link #startListBox(int, TRUE)}
+ */
+ public void listBoxOption(String text, AbstractHtmlAction action, boolean selected) {
+ String actionId = buildActionId(action);
+ m_actionMap.put(actionId, action);
+ out.print("<option" + (selected ? " selected" : "") + " value=\"" + actionId + "\">" + javaToHtml(text) + "</option>");
+ }
+
+ public void endListBox() {
+ out.print("</select>");
+ }
+
+ public void formSubmit(String value) {
+ out.print("<input type=submit value='" + value + "'>");
+ }
+
+ public void endForm() {
+ out.print("</form>");
+ }
+
+ public void print(String s) {
+ out.print(javaToHtml(s));
+ }
+
+ public void printNoBreak(String s) {
+ s = javaToHtml(s);
+ s = s.replaceAll(" ", "&nbsp;");
+ out.print(s);
+ }
+
+ public void br() {
+ out.print("<br>");
+ }
+
+ public void focusAnchor() {
+ out.print("<a name=\"focus\"></a>");
+ }
+
+ public void bold(String text) {
+ out.print("<b>");
+ print(text);
+ out.print("</b>");
+ }
+
+ public void pBold(String text) {
+ out.print("<p><b>");
+ print(text);
+ out.print("</b></p>");
+ }
+
+ public void pItalic(String text) {
+ out.print("<p><i>");
+ print(text);
+ out.print("</i></p>");
+ }
+
+ public void p(String text) {
+ out.print("<p>");
+ print(text);
+ out.print("</p>");
+ }
+
+ public void p() {
+ out.print("<p>");
+ }
+
+ public void raw(String s) {
+ out.print(s);
+ }
+
+ public void startTable() {
+ startTable(0);
+ }
+
+ public void startTable(int border) {
+ startTable(border, 0, 0);
+ }
+
+ public void startTable(int border, int cellspacing, int cellpadding) {
+ startTable(border, cellspacing, cellpadding, null);
+ }
+
+ public void startTable(int border, int cellspacing, int cellpadding, String width) {
+ out.print("<table");
+ if (border >= 0) {
+ out.print(" border=" + border);
+ }
+ if (cellspacing >= 0) {
+ out.print(" cellspacing=" + cellspacing);
+ }
+ if (cellpadding >= 0) {
+ out.print(" cellpadding=" + cellpadding);
+ }
+ if (width != null) {
+ out.print(" width='" + width + "'");
+ }
+ out.print(">");
+ }
+
+ public void endTable() {
+ out.print("</table>");
+ }
+
+ public void startTableRow() {
+ out.print("<tr>");
+ }
+
+ public void endTableRow() {
+ out.println("</tr>");
+ }
+
+ public void spacingRow(int columnCount) {
+ out.print("<tr>");
+ out.print("<td colspan=\"" + columnCount + "\">");
+ out.print("&nbsp;");
+ out.print("</td>");
+ out.println("</tr>");
+ }
+
+ public void startTableCell() {
+ startTableCell(1, 1);
+ }
+
+ public void startTableCell(int rows, int cols) {
+ startTableCell(rows, cols, null);
+ }
+
+ public void startTableCell(int rows, int cols, String color) {
+ out.print("<td");
+ if (rows > 1) {
+ out.print(" rowspan=" + rows);
+ }
+ if (cols > 1) {
+ out.print(" colspan=" + cols);
+ }
+ if (color != null) {
+ out.print(" bgcolor='#" + color + "'");
+ }
+ out.print(">");
+ }
+
+ public void endTableCell() {
+ out.print("</td>");
+ }
+
+ public void tableCell(String content) {
+ tableCell(content, 1, 1);
+ }
+
+ public void tableCell(String content, int rows, int cols) {
+ tableCell(content, 1, 1, null);
+ }
+
+ public void tableCell(String content, int rows, int cols, String color) {
+ startTableCell(rows, cols, color);
+ if (content == null || content.trim().length() == 0) {
+ out.print("&nbsp;");
+ }
+ else {
+ print(content);
+ }
+ endTableCell();
+ }
+
+ public void tableHeaderCell(String content) {
+ out.print("<th>");
+ if (content == null || content.trim().length() == 0) {
+ out.print("&nbsp;");
+ }
+ else {
+ print(content);
+ }
+ out.print("</th>");
+ }
+
+ public String javaToHtml(String s) {
+ if (s == null) {
+ return "";
+ }
+ s = s.replaceAll("<", "&lt;");
+ s = s.replaceAll(">", "&gt;");
+ return s;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/widget/table/HtmlTable.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/widget/table/HtmlTable.java
index 680984506e..167d0032cf 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/widget/table/HtmlTable.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/widget/table/HtmlTable.java
@@ -1,119 +1,119 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.admin.html.widget.table;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.TreeMap;
-
-import org.eclipse.scout.commons.CompositeObject;
-import org.eclipse.scout.rt.server.admin.html.AbstractHtmlAction;
-
-public class HtmlTable extends HtmlComponent {
- private String m_tableId;
- private SortInfo m_sortInfo;
- private List<VirtualRow> m_rows;
- // temporary
- private int m_temporaryColumn;
-
- public HtmlTable(HtmlComponent other, String tableId, SortInfo sortInfo) {
- super(other);
- m_tableId = tableId;
- m_sortInfo = sortInfo;
- m_rows = new ArrayList<VirtualRow>();
- }
-
- @Override
- public void tableHeaderCell(String content) {
- out.print("<th>");
- final int columnIndex = m_temporaryColumn;
- // next
- m_temporaryColumn++;
- String sortId;
- if (m_sortInfo.getColumnIndex() == columnIndex) {
- if (m_sortInfo.isAscending()) {
- sortId = m_tableId + ".sortCol." + columnIndex + ".down";
- }
- else {
- sortId = m_tableId + ".sortCol." + columnIndex + ".up";
- }
- }
- else {
- sortId = m_tableId + ".sortCol." + columnIndex;
- }
- startLinkAction(new AbstractHtmlAction(sortId) {
- @Override
- public void run() {
- if (m_sortInfo.getColumnIndex() == columnIndex) {
- m_sortInfo.setAscending(!m_sortInfo.isAscending());
- }
- else {
- m_sortInfo.setColumnIndex(columnIndex);
- m_sortInfo.setAscending(true);
- }
- }
- });
- if (m_sortInfo.getColumnIndex() == columnIndex) {
- out.print("<b>");
- }
- if (content == null || content.trim().length() == 0) {
- out.print("&nbsp;");
- }
- else {
- print(content);
- }
- if (m_sortInfo.getColumnIndex() == columnIndex) {
- out.print("</b>");
- }
- endLinkAction();
- out.print("</th>");
- }
-
- public VirtualRow addVirtualRow() {
- VirtualRow v = new VirtualRow(this);
- m_rows.add(v);
- return v;
- }
-
- public void appendVirtualRows() {
- for (VirtualRow row : getSortedRows()) {
- append(row);
- }
- }
-
- private VirtualRow[] getSortedRows() {
- TreeMap<CompositeObject, VirtualRow> sortMap = new TreeMap<CompositeObject, VirtualRow>();
- int rowIndex = 0;
- for (VirtualRow row : m_rows) {
- sortMap.put(new CompositeObject(row.getCellAt(m_sortInfo.getColumnIndex()), rowIndex), row);
- rowIndex++;
- }
- VirtualRow[] result = new VirtualRow[m_rows.size()];
- if (m_sortInfo.getColumnIndex() >= 0 && !m_sortInfo.isAscending()) {
- // reverse
- int i = m_rows.size() - 1;
- for (VirtualRow row : sortMap.values()) {
- result[i] = row;
- i--;
- }
- }
- else {
- // forward
- int i = 0;
- for (VirtualRow row : sortMap.values()) {
- result[i] = row;
- i++;
- }
- }
- return result;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.admin.html.widget.table;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.TreeMap;
+
+import org.eclipse.scout.commons.CompositeObject;
+import org.eclipse.scout.rt.server.admin.html.AbstractHtmlAction;
+
+public class HtmlTable extends HtmlComponent {
+ private String m_tableId;
+ private SortInfo m_sortInfo;
+ private List<VirtualRow> m_rows;
+ // temporary
+ private int m_temporaryColumn;
+
+ public HtmlTable(HtmlComponent other, String tableId, SortInfo sortInfo) {
+ super(other);
+ m_tableId = tableId;
+ m_sortInfo = sortInfo;
+ m_rows = new ArrayList<VirtualRow>();
+ }
+
+ @Override
+ public void tableHeaderCell(String content) {
+ out.print("<th>");
+ final int columnIndex = m_temporaryColumn;
+ // next
+ m_temporaryColumn++;
+ String sortId;
+ if (m_sortInfo.getColumnIndex() == columnIndex) {
+ if (m_sortInfo.isAscending()) {
+ sortId = m_tableId + ".sortCol." + columnIndex + ".down";
+ }
+ else {
+ sortId = m_tableId + ".sortCol." + columnIndex + ".up";
+ }
+ }
+ else {
+ sortId = m_tableId + ".sortCol." + columnIndex;
+ }
+ startLinkAction(new AbstractHtmlAction(sortId) {
+ @Override
+ public void run() {
+ if (m_sortInfo.getColumnIndex() == columnIndex) {
+ m_sortInfo.setAscending(!m_sortInfo.isAscending());
+ }
+ else {
+ m_sortInfo.setColumnIndex(columnIndex);
+ m_sortInfo.setAscending(true);
+ }
+ }
+ });
+ if (m_sortInfo.getColumnIndex() == columnIndex) {
+ out.print("<b>");
+ }
+ if (content == null || content.trim().length() == 0) {
+ out.print("&nbsp;");
+ }
+ else {
+ print(content);
+ }
+ if (m_sortInfo.getColumnIndex() == columnIndex) {
+ out.print("</b>");
+ }
+ endLinkAction();
+ out.print("</th>");
+ }
+
+ public VirtualRow addVirtualRow() {
+ VirtualRow v = new VirtualRow(this);
+ m_rows.add(v);
+ return v;
+ }
+
+ public void appendVirtualRows() {
+ for (VirtualRow row : getSortedRows()) {
+ append(row);
+ }
+ }
+
+ private VirtualRow[] getSortedRows() {
+ TreeMap<CompositeObject, VirtualRow> sortMap = new TreeMap<CompositeObject, VirtualRow>();
+ int rowIndex = 0;
+ for (VirtualRow row : m_rows) {
+ sortMap.put(new CompositeObject(row.getCellAt(m_sortInfo.getColumnIndex()), rowIndex), row);
+ rowIndex++;
+ }
+ VirtualRow[] result = new VirtualRow[m_rows.size()];
+ if (m_sortInfo.getColumnIndex() >= 0 && !m_sortInfo.isAscending()) {
+ // reverse
+ int i = m_rows.size() - 1;
+ for (VirtualRow row : sortMap.values()) {
+ result[i] = row;
+ i--;
+ }
+ }
+ else {
+ // forward
+ int i = 0;
+ for (VirtualRow row : sortMap.values()) {
+ result[i] = row;
+ i++;
+ }
+ }
+ return result;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/widget/table/SortInfo.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/widget/table/SortInfo.java
index 466a07856c..81764c70a5 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/widget/table/SortInfo.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/widget/table/SortInfo.java
@@ -1,32 +1,32 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.admin.html.widget.table;
-
-public class SortInfo {
- private int columnIndex = -1;
- private boolean ascending = true;
-
- public int getColumnIndex() {
- return columnIndex;
- }
-
- public void setColumnIndex(int columnIndex) {
- this.columnIndex = columnIndex;
- }
-
- public boolean isAscending() {
- return ascending;
- }
-
- public void setAscending(boolean ascending) {
- this.ascending = ascending;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.admin.html.widget.table;
+
+public class SortInfo {
+ private int columnIndex = -1;
+ private boolean ascending = true;
+
+ public int getColumnIndex() {
+ return columnIndex;
+ }
+
+ public void setColumnIndex(int columnIndex) {
+ this.columnIndex = columnIndex;
+ }
+
+ public boolean isAscending() {
+ return ascending;
+ }
+
+ public void setAscending(boolean ascending) {
+ this.ascending = ascending;
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/widget/table/VirtualRow.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/widget/table/VirtualRow.java
index da2edb0ddb..23c298b5e5 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/widget/table/VirtualRow.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/html/widget/table/VirtualRow.java
@@ -1,50 +1,50 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.admin.html.widget.table;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.scout.commons.StringUtility;
-
-public class VirtualRow extends HtmlComponent {
- private List<String> m_cells;
- // temporary
- private int m_cellBegin;
-
- public VirtualRow(HtmlComponent parent) {
- super(parent);
- m_cells = new ArrayList<String>();
- }
-
- public String getCellAt(int columnIndex) {
- if (columnIndex >= 0 && columnIndex < m_cells.size()) {
- return m_cells.get(columnIndex);
- }
- else {
- return null;
- }
- }
-
- @Override
- public void startTableCell(int rows, int cols, String color) {
- super.startTableCell(rows, cols, color);
- m_cellBegin = m_writer.getBuffer().length();
- }
-
- @Override
- public void endTableCell() {
- int end = m_writer.getBuffer().length();
- String s = StringUtility.removeTags(m_writer.getBuffer().substring(m_cellBegin, end));
- m_cells.add(s);
- super.endTableCell();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.admin.html.widget.table;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.scout.commons.StringUtility;
+
+public class VirtualRow extends HtmlComponent {
+ private List<String> m_cells;
+ // temporary
+ private int m_cellBegin;
+
+ public VirtualRow(HtmlComponent parent) {
+ super(parent);
+ m_cells = new ArrayList<String>();
+ }
+
+ public String getCellAt(int columnIndex) {
+ if (columnIndex >= 0 && columnIndex < m_cells.size()) {
+ return m_cells.get(columnIndex);
+ }
+ else {
+ return null;
+ }
+ }
+
+ @Override
+ public void startTableCell(int rows, int cols, String color) {
+ super.startTableCell(rows, cols, color);
+ m_cellBegin = m_writer.getBuffer().length();
+ }
+
+ @Override
+ public void endTableCell() {
+ int end = m_writer.getBuffer().length();
+ String s = StringUtility.removeTags(m_writer.getBuffer().substring(m_cellBegin, end));
+ m_cells.add(s);
+ super.endTableCell();
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/inspector/CallInspector.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/inspector/CallInspector.java
index 74ae1e2bcb..06d04a33e7 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/inspector/CallInspector.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/inspector/CallInspector.java
@@ -1,77 +1,77 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.admin.inspector;
-
-import org.eclipse.scout.rt.server.ThreadContext;
-import org.eclipse.scout.rt.server.admin.inspector.info.CallInfo;
-import org.eclipse.scout.rt.server.transaction.ITransaction;
-import org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelRequest;
-import org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelResponse;
-
-public class CallInspector {
- private SessionInspector m_parent;
- private CallInfo m_info;
-
- protected CallInspector(SessionInspector parent, ServiceTunnelRequest call) {
- m_parent = parent;
- m_info = new CallInfo();
- m_info.setStartTime(System.currentTimeMillis());
- m_info.setService(call.getServiceInterfaceClassName());
- m_info.setOperation(call.getOperation());
- Object[] args = call.getArgs();
- Object[] newArgs = new Object[(args != null ? args.length : 0)];
- if (newArgs.length > 0) {
- System.arraycopy(args, 0, newArgs, 0, newArgs.length);
- }
- m_info.setArguments(newArgs);
- }
-
- public SessionInspector getSessionInspector() {
- return m_parent;
- }
-
- public boolean isTimeout(long millis) {
- if (!m_info.isActive()) {
- long dt = System.currentTimeMillis() - m_info.getEndTime();
- if (dt >= millis) {
- return true;
- }
- }
- return false;
- }
-
- public void close(ServiceTunnelResponse res) {
- update();
- m_info.setEndTime(System.currentTimeMillis());
- if (res != null) {
- m_info.setReturnData(res.getData());
- m_info.setReturnException(res.getException());
- Object[] args = res.getOutVars();
- Object[] newArgs = new Object[(args != null ? args.length : 0)];
- if (newArgs.length > 0) {
- System.arraycopy(args, 0, newArgs, 0, newArgs.length);
- }
- m_info.setOutVariables(newArgs);
- }
- }
-
- public void update() {
- ITransaction xa = ThreadContext.getTransaction();
- if (xa != null) {
- m_info.setXaResources(xa.getMembers());
- }
- }
-
- public CallInfo getInfo() {
- return m_info;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.admin.inspector;
+
+import org.eclipse.scout.rt.server.ThreadContext;
+import org.eclipse.scout.rt.server.admin.inspector.info.CallInfo;
+import org.eclipse.scout.rt.server.transaction.ITransaction;
+import org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelRequest;
+import org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelResponse;
+
+public class CallInspector {
+ private SessionInspector m_parent;
+ private CallInfo m_info;
+
+ protected CallInspector(SessionInspector parent, ServiceTunnelRequest call) {
+ m_parent = parent;
+ m_info = new CallInfo();
+ m_info.setStartTime(System.currentTimeMillis());
+ m_info.setService(call.getServiceInterfaceClassName());
+ m_info.setOperation(call.getOperation());
+ Object[] args = call.getArgs();
+ Object[] newArgs = new Object[(args != null ? args.length : 0)];
+ if (newArgs.length > 0) {
+ System.arraycopy(args, 0, newArgs, 0, newArgs.length);
+ }
+ m_info.setArguments(newArgs);
+ }
+
+ public SessionInspector getSessionInspector() {
+ return m_parent;
+ }
+
+ public boolean isTimeout(long millis) {
+ if (!m_info.isActive()) {
+ long dt = System.currentTimeMillis() - m_info.getEndTime();
+ if (dt >= millis) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public void close(ServiceTunnelResponse res) {
+ update();
+ m_info.setEndTime(System.currentTimeMillis());
+ if (res != null) {
+ m_info.setReturnData(res.getData());
+ m_info.setReturnException(res.getException());
+ Object[] args = res.getOutVars();
+ Object[] newArgs = new Object[(args != null ? args.length : 0)];
+ if (newArgs.length > 0) {
+ System.arraycopy(args, 0, newArgs, 0, newArgs.length);
+ }
+ m_info.setOutVariables(newArgs);
+ }
+ }
+
+ public void update() {
+ ITransaction xa = ThreadContext.getTransaction();
+ if (xa != null) {
+ m_info.setXaResources(xa.getMembers());
+ }
+ }
+
+ public CallInfo getInfo() {
+ return m_info;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/inspector/ProcessInspector.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/inspector/ProcessInspector.java
index f19ba41a0e..de5cf40b67 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/inspector/ProcessInspector.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/inspector/ProcessInspector.java
@@ -1,149 +1,149 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.admin.inspector;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.scout.commons.TTLCache;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.server.IServerSession;
-import org.eclipse.scout.rt.server.internal.Activator;
-
-/**
- * process monitor of servlet context
- */
-public class ProcessInspector {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(ProcessInspector.class);
-
- public static synchronized ProcessInspector getDefault() {
- return Activator.getDefault().getProcessInspector();
- }
-
- /**
- * Instance
- */
- private boolean m_servletInspectorEnabled = false;
- private TTLCache<IServerSession, SessionInspector> m_sessionToInspectorMap;
- private Object m_sessionToInspectorMapLock;
- private Set<String> m_ignoredCallSet;
-
- public ProcessInspector() {
- m_sessionToInspectorMapLock = new Object();
- m_sessionToInspectorMap = new TTLCache<IServerSession, SessionInspector>(120000L);
- m_ignoredCallSet = new HashSet<String>();
- }
-
- public boolean isEnabled() {
- return m_servletInspectorEnabled;
- }
-
- public void setEnabled(boolean b) {
- m_servletInspectorEnabled = b;
- if (b) {
- // nop
- }
- else {
- clearSessionInspectors();
- }
- }
-
- public Set<String> getIgnoredCallSet() {
- return m_ignoredCallSet;
- }
-
- public boolean acceptCall(String serviceClassName, String operation) {
- String callId = serviceClassName + "." + operation;
- for (String s : m_ignoredCallSet) {
- if (callId.matches(s)) {
- return false;
- }
- }
- return true;
- }
-
- public void update() {
- for (SessionInspector i : getSessionInspectors()) {
- i.doHousekeeping(getTimeout());
- }
- }
-
- public long getTimeout() {
- return m_sessionToInspectorMap.getTTL();
- }
-
- public void setTimeout(long timeoutMillis) {
- m_sessionToInspectorMap.setTTL(timeoutMillis);
- }
-
- public SessionInspector[] getSessionInspectors(String user) {
- synchronized (m_sessionToInspectorMapLock) {
- ArrayList<SessionInspector> a = new ArrayList<SessionInspector>();
- for (SessionInspector si : m_sessionToInspectorMap.values()) {
- if (("" + user).equalsIgnoreCase("" + si.getInfo().getUserId())) {
- a.add(si);
- }
- }
- return a.toArray(new SessionInspector[0]);
- }
- }
-
- public SessionInspector[] getSessionInspectors() {
- synchronized (m_sessionToInspectorMapLock) {
- return m_sessionToInspectorMap.values().toArray(new SessionInspector[0]);
- }
- }
-
- public SessionInspector getSessionInspector(IServerSession session, boolean autoCreate) {
- synchronized (m_sessionToInspectorMapLock) {
- SessionInspector insp = m_sessionToInspectorMap.get(session);
- if (insp == null && isEnabled() && autoCreate) {
- insp = new SessionInspector(this, session);
- m_sessionToInspectorMap.put(session, insp);
- }
- return insp;
- }
- }
-
- public void clearSessionInspectors(String user) {
- for (IServerSession key : m_sessionToInspectorMap.keySet()) { // ttlcach uses
- // unlinked
- // keyset,
- // therefor we
- // can simple
- // iterate and
- // delete
- SessionInspector session = m_sessionToInspectorMap.get(key);
- if (("" + user).equalsIgnoreCase("" + session.getInfo().getUserId())) {
- m_sessionToInspectorMap.remove(key);
- }
- }
- }
-
- public void clearSessionInspectors() {
- synchronized (m_sessionToInspectorMapLock) {
- for (IServerSession session : m_sessionToInspectorMap.keySet()) { // ttlcach
- // uses
- // unlinked
- // keyset,
- // therefor
- // we can
- // simple
- // iterate
- // and
- // delete
- m_sessionToInspectorMap.remove(session);
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.admin.inspector;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.scout.commons.TTLCache;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.server.IServerSession;
+import org.eclipse.scout.rt.server.internal.Activator;
+
+/**
+ * process monitor of servlet context
+ */
+public class ProcessInspector {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(ProcessInspector.class);
+
+ public static synchronized ProcessInspector getDefault() {
+ return Activator.getDefault().getProcessInspector();
+ }
+
+ /**
+ * Instance
+ */
+ private boolean m_servletInspectorEnabled = false;
+ private TTLCache<IServerSession, SessionInspector> m_sessionToInspectorMap;
+ private Object m_sessionToInspectorMapLock;
+ private Set<String> m_ignoredCallSet;
+
+ public ProcessInspector() {
+ m_sessionToInspectorMapLock = new Object();
+ m_sessionToInspectorMap = new TTLCache<IServerSession, SessionInspector>(120000L);
+ m_ignoredCallSet = new HashSet<String>();
+ }
+
+ public boolean isEnabled() {
+ return m_servletInspectorEnabled;
+ }
+
+ public void setEnabled(boolean b) {
+ m_servletInspectorEnabled = b;
+ if (b) {
+ // nop
+ }
+ else {
+ clearSessionInspectors();
+ }
+ }
+
+ public Set<String> getIgnoredCallSet() {
+ return m_ignoredCallSet;
+ }
+
+ public boolean acceptCall(String serviceClassName, String operation) {
+ String callId = serviceClassName + "." + operation;
+ for (String s : m_ignoredCallSet) {
+ if (callId.matches(s)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public void update() {
+ for (SessionInspector i : getSessionInspectors()) {
+ i.doHousekeeping(getTimeout());
+ }
+ }
+
+ public long getTimeout() {
+ return m_sessionToInspectorMap.getTTL();
+ }
+
+ public void setTimeout(long timeoutMillis) {
+ m_sessionToInspectorMap.setTTL(timeoutMillis);
+ }
+
+ public SessionInspector[] getSessionInspectors(String user) {
+ synchronized (m_sessionToInspectorMapLock) {
+ ArrayList<SessionInspector> a = new ArrayList<SessionInspector>();
+ for (SessionInspector si : m_sessionToInspectorMap.values()) {
+ if (("" + user).equalsIgnoreCase("" + si.getInfo().getUserId())) {
+ a.add(si);
+ }
+ }
+ return a.toArray(new SessionInspector[0]);
+ }
+ }
+
+ public SessionInspector[] getSessionInspectors() {
+ synchronized (m_sessionToInspectorMapLock) {
+ return m_sessionToInspectorMap.values().toArray(new SessionInspector[0]);
+ }
+ }
+
+ public SessionInspector getSessionInspector(IServerSession session, boolean autoCreate) {
+ synchronized (m_sessionToInspectorMapLock) {
+ SessionInspector insp = m_sessionToInspectorMap.get(session);
+ if (insp == null && isEnabled() && autoCreate) {
+ insp = new SessionInspector(this, session);
+ m_sessionToInspectorMap.put(session, insp);
+ }
+ return insp;
+ }
+ }
+
+ public void clearSessionInspectors(String user) {
+ for (IServerSession key : m_sessionToInspectorMap.keySet()) { // ttlcach uses
+ // unlinked
+ // keyset,
+ // therefor we
+ // can simple
+ // iterate and
+ // delete
+ SessionInspector session = m_sessionToInspectorMap.get(key);
+ if (("" + user).equalsIgnoreCase("" + session.getInfo().getUserId())) {
+ m_sessionToInspectorMap.remove(key);
+ }
+ }
+ }
+
+ public void clearSessionInspectors() {
+ synchronized (m_sessionToInspectorMapLock) {
+ for (IServerSession session : m_sessionToInspectorMap.keySet()) { // ttlcach
+ // uses
+ // unlinked
+ // keyset,
+ // therefor
+ // we can
+ // simple
+ // iterate
+ // and
+ // delete
+ m_sessionToInspectorMap.remove(session);
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/inspector/ReflectServiceInventory.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/inspector/ReflectServiceInventory.java
index 9b57ecab10..856fe66d62 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/inspector/ReflectServiceInventory.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/inspector/ReflectServiceInventory.java
@@ -1,134 +1,134 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.admin.inspector;
-
-import java.beans.BeanInfo;
-import java.beans.Introspector;
-import java.beans.PropertyDescriptor;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.TreeMap;
-
-import org.eclipse.scout.commons.CompositeObject;
-
-/**
- * Convenience for use with {@link IInventoryProvider}
- */
-public class ReflectServiceInventory {
- private HashSet<PropertyDescriptor> m_properties = new HashSet<PropertyDescriptor>();
- private HashSet<Method> m_operations = new HashSet<Method>();
- private ArrayList<String> m_states = new ArrayList<String>();
-
- public ReflectServiceInventory(Object service) {
- analyzeService(service);
- }
-
- private void analyzeService(Object service) {
- // properties
- HashSet<Method> propertyMethods = new HashSet<Method>();
- try {
- BeanInfo info = Introspector.getBeanInfo(service.getClass());
- PropertyDescriptor[] a = info.getPropertyDescriptors();
- for (PropertyDescriptor desc : a) {
- if (desc.getReadMethod() != null && desc.getWriteMethod() != null) {
- addProperty(desc);
- }
- else if (desc.getName().startsWith("configured")) {
- addProperty(desc);
- }
- if (desc.getReadMethod() != null) {
- propertyMethods.add(desc.getReadMethod());
- }
- if (desc.getWriteMethod() != null) {
- propertyMethods.add(desc.getWriteMethod());
- }
- }
- }
- catch (Throwable t) {
- m_states.add("Failure to analyze properties: " + t);
- }
- // operations
- Method[] methods = service.getClass().getMethods();
- for (Method m : methods) {
- if (Object.class.isAssignableFrom(m.getDeclaringClass())) {
- if (!propertyMethods.contains(m)) {
- addOperation(m);
- }
- }
- }
- }
-
- public PropertyDescriptor[] getProperties() {
- TreeMap<CompositeObject, PropertyDescriptor> sortMap = new TreeMap<CompositeObject, PropertyDescriptor>();
- int index = 0;
- for (PropertyDescriptor p : m_properties) {
- if (p.getName().equals("class")) {
- // ignore
- }
- else {
- if (p.getName().startsWith("configured")) {
- sortMap.put(new CompositeObject(1, p.getName(), index), p);
- }
- else {
- sortMap.put(new CompositeObject(2, p.getName(), index), p);
- }
- }
- index++;
- }
- return sortMap.values().toArray(new PropertyDescriptor[0]);
- }
-
- public void addProperty(PropertyDescriptor desc) {
- m_properties.add(desc);
- }
-
- public void removeProperty(PropertyDescriptor desc) {
- m_properties.remove(desc);
- }
-
- public Method[] getOperations() {
- TreeMap<CompositeObject, Method> sortMap = new TreeMap<CompositeObject, Method>();
- int index = 0;
- for (Method m : m_operations) {
- if (m.getName().equals("getInventory")) {
- // ignore
- }
- else {
- if (m.getName().startsWith("exec")) {
- sortMap.put(new CompositeObject(1, m.getName(), index), m);
- }
- else {
- sortMap.put(new CompositeObject(2, m.getName(), index), m);
- }
- }
- index++;
- }
- return sortMap.values().toArray(new Method[0]);
- }
-
- public void addOperation(Method op) {
- m_operations.add(op);
- }
-
- public void removeOperation(Method op) {
- m_operations.remove(op);
- }
-
- public String[] getStates() {
- return m_states.toArray(new String[0]);
- }
-
- public void addState(String text) {
- m_states.add(text);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.admin.inspector;
+
+import java.beans.BeanInfo;
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.TreeMap;
+
+import org.eclipse.scout.commons.CompositeObject;
+
+/**
+ * Convenience for use with {@link IInventoryProvider}
+ */
+public class ReflectServiceInventory {
+ private HashSet<PropertyDescriptor> m_properties = new HashSet<PropertyDescriptor>();
+ private HashSet<Method> m_operations = new HashSet<Method>();
+ private ArrayList<String> m_states = new ArrayList<String>();
+
+ public ReflectServiceInventory(Object service) {
+ analyzeService(service);
+ }
+
+ private void analyzeService(Object service) {
+ // properties
+ HashSet<Method> propertyMethods = new HashSet<Method>();
+ try {
+ BeanInfo info = Introspector.getBeanInfo(service.getClass());
+ PropertyDescriptor[] a = info.getPropertyDescriptors();
+ for (PropertyDescriptor desc : a) {
+ if (desc.getReadMethod() != null && desc.getWriteMethod() != null) {
+ addProperty(desc);
+ }
+ else if (desc.getName().startsWith("configured")) {
+ addProperty(desc);
+ }
+ if (desc.getReadMethod() != null) {
+ propertyMethods.add(desc.getReadMethod());
+ }
+ if (desc.getWriteMethod() != null) {
+ propertyMethods.add(desc.getWriteMethod());
+ }
+ }
+ }
+ catch (Throwable t) {
+ m_states.add("Failure to analyze properties: " + t);
+ }
+ // operations
+ Method[] methods = service.getClass().getMethods();
+ for (Method m : methods) {
+ if (Object.class.isAssignableFrom(m.getDeclaringClass())) {
+ if (!propertyMethods.contains(m)) {
+ addOperation(m);
+ }
+ }
+ }
+ }
+
+ public PropertyDescriptor[] getProperties() {
+ TreeMap<CompositeObject, PropertyDescriptor> sortMap = new TreeMap<CompositeObject, PropertyDescriptor>();
+ int index = 0;
+ for (PropertyDescriptor p : m_properties) {
+ if (p.getName().equals("class")) {
+ // ignore
+ }
+ else {
+ if (p.getName().startsWith("configured")) {
+ sortMap.put(new CompositeObject(1, p.getName(), index), p);
+ }
+ else {
+ sortMap.put(new CompositeObject(2, p.getName(), index), p);
+ }
+ }
+ index++;
+ }
+ return sortMap.values().toArray(new PropertyDescriptor[0]);
+ }
+
+ public void addProperty(PropertyDescriptor desc) {
+ m_properties.add(desc);
+ }
+
+ public void removeProperty(PropertyDescriptor desc) {
+ m_properties.remove(desc);
+ }
+
+ public Method[] getOperations() {
+ TreeMap<CompositeObject, Method> sortMap = new TreeMap<CompositeObject, Method>();
+ int index = 0;
+ for (Method m : m_operations) {
+ if (m.getName().equals("getInventory")) {
+ // ignore
+ }
+ else {
+ if (m.getName().startsWith("exec")) {
+ sortMap.put(new CompositeObject(1, m.getName(), index), m);
+ }
+ else {
+ sortMap.put(new CompositeObject(2, m.getName(), index), m);
+ }
+ }
+ index++;
+ }
+ return sortMap.values().toArray(new Method[0]);
+ }
+
+ public void addOperation(Method op) {
+ m_operations.add(op);
+ }
+
+ public void removeOperation(Method op) {
+ m_operations.remove(op);
+ }
+
+ public String[] getStates() {
+ return m_states.toArray(new String[0]);
+ }
+
+ public void addState(String text) {
+ m_states.add(text);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/inspector/ServiceInspector.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/inspector/ServiceInspector.java
index b7bdfd3ae2..df657f2ec2 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/inspector/ServiceInspector.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/inspector/ServiceInspector.java
@@ -1,59 +1,59 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.admin.inspector;
-
-import java.beans.PropertyDescriptor;
-import java.lang.reflect.Method;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.scout.commons.TypeCastUtility;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.service.IServiceInventory;
-
-public class ServiceInspector {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(ServiceInspector.class);
-
- private Object m_service;
- private ReflectServiceInventory m_inv;
-
- public ServiceInspector(Object service) {
- m_service = service;
- }
-
- public ReflectServiceInventory buildInventory() {
- ReflectServiceInventory inv = new ReflectServiceInventory(m_service);
- // make service inventory
- if (m_service instanceof IAdaptable) {
- IServiceInventory si = (IServiceInventory) ((IAdaptable) m_service).getAdapter(IServiceInventory.class);
- if (si != null) {
- inv.addState(si.getInventory());
- }
- }
- return inv;
- }
-
- public Object getService() {
- return m_service;
- }
-
- public void changeProperty(PropertyDescriptor propDesc, String propText) throws Exception {
- if (propText != null && propText.length() == 0) {
- propText = null;
- }
- Method setterMethod = propDesc.getWriteMethod();
- if (setterMethod != null) {
- Object value = TypeCastUtility.castValue(propText, propDesc.getPropertyType());
- setterMethod.invoke(m_service, new Object[]{value});
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.admin.inspector;
+
+import java.beans.PropertyDescriptor;
+import java.lang.reflect.Method;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.scout.commons.TypeCastUtility;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.service.IServiceInventory;
+
+public class ServiceInspector {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(ServiceInspector.class);
+
+ private Object m_service;
+ private ReflectServiceInventory m_inv;
+
+ public ServiceInspector(Object service) {
+ m_service = service;
+ }
+
+ public ReflectServiceInventory buildInventory() {
+ ReflectServiceInventory inv = new ReflectServiceInventory(m_service);
+ // make service inventory
+ if (m_service instanceof IAdaptable) {
+ IServiceInventory si = (IServiceInventory) ((IAdaptable) m_service).getAdapter(IServiceInventory.class);
+ if (si != null) {
+ inv.addState(si.getInventory());
+ }
+ }
+ return inv;
+ }
+
+ public Object getService() {
+ return m_service;
+ }
+
+ public void changeProperty(PropertyDescriptor propDesc, String propText) throws Exception {
+ if (propText != null && propText.length() == 0) {
+ propText = null;
+ }
+ Method setterMethod = propDesc.getWriteMethod();
+ if (setterMethod != null) {
+ Object value = TypeCastUtility.castValue(propText, propDesc.getPropertyType());
+ setterMethod.invoke(m_service, new Object[]{value});
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/inspector/SessionInspector.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/inspector/SessionInspector.java
index 0aba62fe0e..5d726db571 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/inspector/SessionInspector.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/inspector/SessionInspector.java
@@ -1,115 +1,115 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.admin.inspector;
-
-import java.security.AccessController;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import javax.security.auth.Subject;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpSession;
-
-import org.eclipse.scout.rt.server.IServerSession;
-import org.eclipse.scout.rt.server.ThreadContext;
-import org.eclipse.scout.rt.server.admin.inspector.info.SessionInfo;
-import org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelRequest;
-
-public class SessionInspector {
- private ProcessInspector m_parent;
- private IServerSession m_session;
- private SessionInfo m_info;
- private Object m_callListLock = new Object();
- private ArrayList<CallInspector> m_callList = new ArrayList<CallInspector>();
-
- protected SessionInspector(ProcessInspector parent, IServerSession session) {
- m_parent = parent;
- m_session = session;
- m_info = new SessionInfo();
- HttpServletRequest httpReq = ThreadContext.getHttpServletRequest();
- HttpSession httpSession = (httpReq != null ? httpReq.getSession() : null);
- if (httpSession != null) {
- m_info.setSessionId(httpSession.getId());
- m_info.setCreationTime(httpSession.getCreationTime());
- m_info.setLastAccessedTime(httpSession.getLastAccessedTime());
- }
- m_info.setUserId(session.getUserId());
- m_info.setUserAgent(session.getUserAgent());
- try {
- m_info.setSubject(Subject.getSubject(AccessController.getContext()));
- }
- catch (Exception e) {
- // ignore
- }
- }
-
- public ProcessInspector getProcessInspector() {
- return m_parent;
- }
-
- public IServerSession getServerSession() {
- return m_session;
- }
-
- public SessionInfo getInfo() {
- return m_info;
- }
-
- /**
- * requests on this session
- */
- public CallInspector[] getCallInspectors() {
- synchronized (m_callListLock) {
- return m_callList.toArray(new CallInspector[0]);
- }
- }
-
- public CallInspector requestCallInspector(ServiceTunnelRequest call) {
- synchronized (m_callListLock) {
- if (getProcessInspector().isEnabled()) {
- if (getProcessInspector().acceptCall(call.getServiceInterfaceClassName(), call.getOperation())) {
- CallInspector callInspector = new CallInspector(this, call);
- m_callList.add(callInspector);
- return callInspector;
- }
- }
- }
- return null;
- }
-
- public void clearCallInspectors() {
- synchronized (m_callListLock) {
- m_callList.clear();
- }
- }
-
- public void doHousekeeping(long timeoutMillis) {
- manageCallInspectorList(timeoutMillis);
- }
-
- public void update() {
- }
-
- private void manageCallInspectorList(long timeoutMillis) {
- synchronized (m_callListLock) {
- for (Iterator it = m_callList.iterator(); it.hasNext();) {
- CallInspector c = (CallInspector) it.next();
- if (c.isTimeout(timeoutMillis)) {
- it.remove();
- }
- else {
- c.update();
- }
- }
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.admin.inspector;
+
+import java.security.AccessController;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import javax.security.auth.Subject;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import org.eclipse.scout.rt.server.IServerSession;
+import org.eclipse.scout.rt.server.ThreadContext;
+import org.eclipse.scout.rt.server.admin.inspector.info.SessionInfo;
+import org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelRequest;
+
+public class SessionInspector {
+ private ProcessInspector m_parent;
+ private IServerSession m_session;
+ private SessionInfo m_info;
+ private Object m_callListLock = new Object();
+ private ArrayList<CallInspector> m_callList = new ArrayList<CallInspector>();
+
+ protected SessionInspector(ProcessInspector parent, IServerSession session) {
+ m_parent = parent;
+ m_session = session;
+ m_info = new SessionInfo();
+ HttpServletRequest httpReq = ThreadContext.getHttpServletRequest();
+ HttpSession httpSession = (httpReq != null ? httpReq.getSession() : null);
+ if (httpSession != null) {
+ m_info.setSessionId(httpSession.getId());
+ m_info.setCreationTime(httpSession.getCreationTime());
+ m_info.setLastAccessedTime(httpSession.getLastAccessedTime());
+ }
+ m_info.setUserId(session.getUserId());
+ m_info.setUserAgent(session.getUserAgent());
+ try {
+ m_info.setSubject(Subject.getSubject(AccessController.getContext()));
+ }
+ catch (Exception e) {
+ // ignore
+ }
+ }
+
+ public ProcessInspector getProcessInspector() {
+ return m_parent;
+ }
+
+ public IServerSession getServerSession() {
+ return m_session;
+ }
+
+ public SessionInfo getInfo() {
+ return m_info;
+ }
+
+ /**
+ * requests on this session
+ */
+ public CallInspector[] getCallInspectors() {
+ synchronized (m_callListLock) {
+ return m_callList.toArray(new CallInspector[0]);
+ }
+ }
+
+ public CallInspector requestCallInspector(ServiceTunnelRequest call) {
+ synchronized (m_callListLock) {
+ if (getProcessInspector().isEnabled()) {
+ if (getProcessInspector().acceptCall(call.getServiceInterfaceClassName(), call.getOperation())) {
+ CallInspector callInspector = new CallInspector(this, call);
+ m_callList.add(callInspector);
+ return callInspector;
+ }
+ }
+ }
+ return null;
+ }
+
+ public void clearCallInspectors() {
+ synchronized (m_callListLock) {
+ m_callList.clear();
+ }
+ }
+
+ public void doHousekeeping(long timeoutMillis) {
+ manageCallInspectorList(timeoutMillis);
+ }
+
+ public void update() {
+ }
+
+ private void manageCallInspectorList(long timeoutMillis) {
+ synchronized (m_callListLock) {
+ for (Iterator it = m_callList.iterator(); it.hasNext();) {
+ CallInspector c = (CallInspector) it.next();
+ if (c.isTimeout(timeoutMillis)) {
+ it.remove();
+ }
+ else {
+ c.update();
+ }
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/inspector/info/CallInfo.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/inspector/info/CallInfo.java
index 51b8b9cdb0..729bbe244b 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/inspector/info/CallInfo.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/inspector/info/CallInfo.java
@@ -1,113 +1,113 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.admin.inspector.info;
-
-import org.eclipse.scout.rt.server.transaction.ITransactionMember;
-
-public class CallInfo {
- private String m_service;
- private String m_operation;
- private Object[] m_arguments;
- private ITransactionMember[] m_xaResources;
- private long m_startTime;
- private long m_endTime;
- private Object m_returnData;
- private Throwable m_returnException;
- private Object[] m_outVariables;
-
- public CallInfo() {
- }
-
- public String getService() {
- return m_service;
- }
-
- public void setService(String s) {
- m_service = s;
- }
-
- public String getOperation() {
- return m_operation;
- }
-
- public void setOperation(String op) {
- m_operation = op;
- }
-
- public Object[] getArguments() {
- return m_arguments;
- }
-
- public void setArguments(Object[] arguments) {
- m_arguments = arguments;
- }
-
- public ITransactionMember[] getXaResources() {
- return m_xaResources;
- }
-
- public void setXaResources(ITransactionMember[] xaResources) {
- m_xaResources = xaResources;
- }
-
- public long getStartTime() {
- return m_startTime;
- }
-
- public void setStartTime(long t) {
- m_startTime = t;
- }
-
- public boolean isActive() {
- return m_endTime == 0L;
- }
-
- public long getEndTime() {
- return m_endTime;
- }
-
- public void setEndTime(long t) {
- m_endTime = t;
- }
-
- public long getDuration() {
- if (m_endTime == 0 || isActive()) {
- return System.currentTimeMillis() - m_startTime;
- }
- else {
- return m_endTime - m_startTime;
- }
- }
-
- public Throwable getReturnException() {
- return m_returnException;
- }
-
- public void setReturnException(Throwable t) {
- m_returnException = t;
- }
-
- public Object getReturnData() {
- return m_returnData;
- }
-
- public void setReturnData(Object o) {
- m_returnData = o;
- }
-
- public Object[] getOutVariables() {
- return m_outVariables;
- }
-
- public void setOutVariables(Object[] a) {
- m_outVariables = a;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.admin.inspector.info;
+
+import org.eclipse.scout.rt.server.transaction.ITransactionMember;
+
+public class CallInfo {
+ private String m_service;
+ private String m_operation;
+ private Object[] m_arguments;
+ private ITransactionMember[] m_xaResources;
+ private long m_startTime;
+ private long m_endTime;
+ private Object m_returnData;
+ private Throwable m_returnException;
+ private Object[] m_outVariables;
+
+ public CallInfo() {
+ }
+
+ public String getService() {
+ return m_service;
+ }
+
+ public void setService(String s) {
+ m_service = s;
+ }
+
+ public String getOperation() {
+ return m_operation;
+ }
+
+ public void setOperation(String op) {
+ m_operation = op;
+ }
+
+ public Object[] getArguments() {
+ return m_arguments;
+ }
+
+ public void setArguments(Object[] arguments) {
+ m_arguments = arguments;
+ }
+
+ public ITransactionMember[] getXaResources() {
+ return m_xaResources;
+ }
+
+ public void setXaResources(ITransactionMember[] xaResources) {
+ m_xaResources = xaResources;
+ }
+
+ public long getStartTime() {
+ return m_startTime;
+ }
+
+ public void setStartTime(long t) {
+ m_startTime = t;
+ }
+
+ public boolean isActive() {
+ return m_endTime == 0L;
+ }
+
+ public long getEndTime() {
+ return m_endTime;
+ }
+
+ public void setEndTime(long t) {
+ m_endTime = t;
+ }
+
+ public long getDuration() {
+ if (m_endTime == 0 || isActive()) {
+ return System.currentTimeMillis() - m_startTime;
+ }
+ else {
+ return m_endTime - m_startTime;
+ }
+ }
+
+ public Throwable getReturnException() {
+ return m_returnException;
+ }
+
+ public void setReturnException(Throwable t) {
+ m_returnException = t;
+ }
+
+ public Object getReturnData() {
+ return m_returnData;
+ }
+
+ public void setReturnData(Object o) {
+ m_returnData = o;
+ }
+
+ public Object[] getOutVariables() {
+ return m_outVariables;
+ }
+
+ public void setOutVariables(Object[] a) {
+ m_outVariables = a;
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/inspector/info/SessionInfo.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/inspector/info/SessionInfo.java
index 2e5c135f67..a233ebb900 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/inspector/info/SessionInfo.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/admin/inspector/info/SessionInfo.java
@@ -1,76 +1,76 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.admin.inspector.info;
-
-import javax.security.auth.Subject;
-
-import org.eclipse.scout.rt.shared.ui.UserAgent;
-
-public class SessionInfo {
- private String m_sessionId;
- private long m_creationTime;
- private long m_lastAccessedTime;
- private String m_userId;
- private Subject m_subject;
- private UserAgent m_userAgent;
-
- public SessionInfo() {
- }
-
- public String getUserId() {
- return m_userId;
- }
-
- public void setUserId(String user) {
- this.m_userId = user;
- }
-
- public Subject getSubject() {
- return m_subject;
- }
-
- public void setSubject(Subject s) {
- m_subject = s;
- }
-
- public long getCreationTime() {
- return m_creationTime;
- }
-
- public void setCreationTime(long t) {
- this.m_creationTime = t;
- }
-
- public long getLastAccessedTime() {
- return m_lastAccessedTime;
- }
-
- public void setLastAccessedTime(long t) {
- this.m_lastAccessedTime = t;
- }
-
- public String getSessionId() {
- return m_sessionId;
- }
-
- public void setSessionId(String s) {
- this.m_sessionId = s;
- }
-
- public UserAgent getUserAgent() {
- return m_userAgent;
- }
-
- public void setUserAgent(UserAgent userAgent) {
- m_userAgent = userAgent;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.admin.inspector.info;
+
+import javax.security.auth.Subject;
+
+import org.eclipse.scout.rt.shared.ui.UserAgent;
+
+public class SessionInfo {
+ private String m_sessionId;
+ private long m_creationTime;
+ private long m_lastAccessedTime;
+ private String m_userId;
+ private Subject m_subject;
+ private UserAgent m_userAgent;
+
+ public SessionInfo() {
+ }
+
+ public String getUserId() {
+ return m_userId;
+ }
+
+ public void setUserId(String user) {
+ this.m_userId = user;
+ }
+
+ public Subject getSubject() {
+ return m_subject;
+ }
+
+ public void setSubject(Subject s) {
+ m_subject = s;
+ }
+
+ public long getCreationTime() {
+ return m_creationTime;
+ }
+
+ public void setCreationTime(long t) {
+ this.m_creationTime = t;
+ }
+
+ public long getLastAccessedTime() {
+ return m_lastAccessedTime;
+ }
+
+ public void setLastAccessedTime(long t) {
+ this.m_lastAccessedTime = t;
+ }
+
+ public String getSessionId() {
+ return m_sessionId;
+ }
+
+ public void setSessionId(String s) {
+ this.m_sessionId = s;
+ }
+
+ public UserAgent getUserAgent() {
+ return m_userAgent;
+ }
+
+ public void setUserAgent(UserAgent userAgent) {
+ m_userAgent = userAgent;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/internal/Activator.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/internal/Activator.java
index d4c08cc310..9fd3b75393 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/internal/Activator.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/internal/Activator.java
@@ -1,138 +1,138 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.internal;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.IProduct;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.equinox.app.IApplication;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.server.admin.inspector.ProcessInspector;
-import org.eclipse.scout.service.SERVICES;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleEvent;
-import org.osgi.framework.SynchronousBundleListener;
-
-public class Activator extends Plugin {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(Activator.class);
-
- public static final String PLUGIN_ID = "org.eclipse.scout.rt.server";
- private static Activator plugin;
-
- public static Activator getDefault() {
- return plugin;
- }
-
- private ProcessInspector m_processInspector;
-
- /*
- * (non-Javadoc)
- * @see
- * org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
- */
- @Override
- public void start(final BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- m_processInspector = new ProcessInspector();
- // workaround for bug in serverside equinox implementation with servletbridge
- // wait until done and launch product if one exists
- if (Platform.getBundle("org.eclipse.scout.sdk") == null) {
- context.addBundleListener(new SynchronousBundleListener() {
- @Override
- public void bundleChanged(BundleEvent event) {
- if (event.getType() == BundleEvent.STARTED && event.getBundle().equals(getBundle())) {
- new Job("Product launcher") {
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- if (Platform.getBundle("org.eclipse.equinox.http.servletbridge") != null) {
- runProduct();
- }
- return Status.OK_STATUS;
- }
- }.schedule();
- }
- }
- });
- }
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- m_processInspector = null;
- plugin = null;
- super.stop(context);
- }
-
- public ProcessInspector getProcessInspector() {
- return m_processInspector;
- }
-
- private void runProduct() {
- IProduct product = Platform.getProduct();
- try {
- Object app = findApplicationClass(product);
- if (app instanceof IApplication) {
- ((IApplication) app).start(new ServerApplicationContext());
- }
- }
- catch (Throwable t) {
- t.printStackTrace();
- }
- }
-
- private Object findApplicationClass(IProduct product) throws CoreException {
- if (product != null) {
- IExtensionRegistry reg = SERVICES.getService(IExtensionRegistry.class);
- if (reg != null) {
- IExtensionPoint xpProd = reg.getExtensionPoint("org.eclipse.core.runtime.products");
- if (xpProd != null) {
- IExtension xProd = xpProd.getExtension(product.getId());
- if (xProd != null) {
- for (IConfigurationElement cProd : xProd.getConfigurationElements()) {
- if (cProd.getName().equals("product")) {
- String appId = cProd.getAttribute("application");
- IExtensionPoint xpApp = reg.getExtensionPoint("org.eclipse.core.runtime.applications");
- if (xpApp != null) {
- IExtension xApp = xpApp.getExtension(appId);
- if (xApp != null) {
- for (IConfigurationElement cApp : xApp.getConfigurationElements()) {
- if (cApp.getName().equals("application")) {
- for (IConfigurationElement cRun : cApp.getChildren("run")) {
- return cRun.createExecutableExtension("class");
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- return null;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.internal;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.IProduct;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.equinox.app.IApplication;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.server.admin.inspector.ProcessInspector;
+import org.eclipse.scout.service.SERVICES;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleEvent;
+import org.osgi.framework.SynchronousBundleListener;
+
+public class Activator extends Plugin {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(Activator.class);
+
+ public static final String PLUGIN_ID = "org.eclipse.scout.rt.server";
+ private static Activator plugin;
+
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ private ProcessInspector m_processInspector;
+
+ /*
+ * (non-Javadoc)
+ * @see
+ * org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(final BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ m_processInspector = new ProcessInspector();
+ // workaround for bug in serverside equinox implementation with servletbridge
+ // wait until done and launch product if one exists
+ if (Platform.getBundle("org.eclipse.scout.sdk") == null) {
+ context.addBundleListener(new SynchronousBundleListener() {
+ @Override
+ public void bundleChanged(BundleEvent event) {
+ if (event.getType() == BundleEvent.STARTED && event.getBundle().equals(getBundle())) {
+ new Job("Product launcher") {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ if (Platform.getBundle("org.eclipse.equinox.http.servletbridge") != null) {
+ runProduct();
+ }
+ return Status.OK_STATUS;
+ }
+ }.schedule();
+ }
+ }
+ });
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ m_processInspector = null;
+ plugin = null;
+ super.stop(context);
+ }
+
+ public ProcessInspector getProcessInspector() {
+ return m_processInspector;
+ }
+
+ private void runProduct() {
+ IProduct product = Platform.getProduct();
+ try {
+ Object app = findApplicationClass(product);
+ if (app instanceof IApplication) {
+ ((IApplication) app).start(new ServerApplicationContext());
+ }
+ }
+ catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+
+ private Object findApplicationClass(IProduct product) throws CoreException {
+ if (product != null) {
+ IExtensionRegistry reg = SERVICES.getService(IExtensionRegistry.class);
+ if (reg != null) {
+ IExtensionPoint xpProd = reg.getExtensionPoint("org.eclipse.core.runtime.products");
+ if (xpProd != null) {
+ IExtension xProd = xpProd.getExtension(product.getId());
+ if (xProd != null) {
+ for (IConfigurationElement cProd : xProd.getConfigurationElements()) {
+ if (cProd.getName().equals("product")) {
+ String appId = cProd.getAttribute("application");
+ IExtensionPoint xpApp = reg.getExtensionPoint("org.eclipse.core.runtime.applications");
+ if (xpApp != null) {
+ IExtension xApp = xpApp.getExtension(appId);
+ if (xApp != null) {
+ for (IConfigurationElement cApp : xApp.getConfigurationElements()) {
+ if (cApp.getName().equals("application")) {
+ for (IConfigurationElement cRun : cApp.getChildren("run")) {
+ return cRun.createExecutableExtension("class");
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return null;
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/internal/ServerApplicationContext.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/internal/ServerApplicationContext.java
index b3f56e3678..02511d4028 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/internal/ServerApplicationContext.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/internal/ServerApplicationContext.java
@@ -1,67 +1,67 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.internal;
-
-import java.util.Map;
-
-import org.eclipse.equinox.app.IApplication;
-import org.eclipse.equinox.app.IApplicationContext;
-import org.osgi.framework.Bundle;
-
-/**
- * Empty Application Context
- */
-public class ServerApplicationContext implements IApplicationContext {
-
- @Override
- public void applicationRunning() {
- }
-
- @Override
- public Map getArguments() {
- return null;
- }
-
- @Override
- public String getBrandingApplication() {
- return null;
- }
-
- @Override
- public Bundle getBrandingBundle() {
- return null;
- }
-
- @Override
- public String getBrandingDescription() {
- return null;
- }
-
- @Override
- public String getBrandingId() {
- return null;
- }
-
- @Override
- public String getBrandingName() {
- return null;
- }
-
- @Override
- public String getBrandingProperty(String key) {
- return null;
- }
-
-// @Override In Eclipse 3.4 this method is not in the Interface
- public void setResult(Object result, IApplication application) {
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.internal;
+
+import java.util.Map;
+
+import org.eclipse.equinox.app.IApplication;
+import org.eclipse.equinox.app.IApplicationContext;
+import org.osgi.framework.Bundle;
+
+/**
+ * Empty Application Context
+ */
+public class ServerApplicationContext implements IApplicationContext {
+
+ @Override
+ public void applicationRunning() {
+ }
+
+ @Override
+ public Map getArguments() {
+ return null;
+ }
+
+ @Override
+ public String getBrandingApplication() {
+ return null;
+ }
+
+ @Override
+ public Bundle getBrandingBundle() {
+ return null;
+ }
+
+ @Override
+ public String getBrandingDescription() {
+ return null;
+ }
+
+ @Override
+ public String getBrandingId() {
+ return null;
+ }
+
+ @Override
+ public String getBrandingName() {
+ return null;
+ }
+
+ @Override
+ public String getBrandingProperty(String key) {
+ return null;
+ }
+
+// @Override In Eclipse 3.4 this method is not in the Interface
+ public void setResult(Object result, IApplication application) {
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/AbstractSchedulerJob.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/AbstractSchedulerJob.java
index 20166e7e16..2f75584493 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/AbstractSchedulerJob.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/AbstractSchedulerJob.java
@@ -1,104 +1,104 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.scheduler;
-
-import org.eclipse.scout.commons.annotations.ConfigOperation;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-
-public abstract class AbstractSchedulerJob implements ISchedulerJob {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractSchedulerJob.class);
-
- private final String m_groupId;
- private final String m_jobId;
- private volatile boolean m_disposed;
- private volatile boolean m_interrupted;
-
- public AbstractSchedulerJob(String groupId, String jobId) {
- m_groupId = groupId;
- m_jobId = jobId;
- }
-
- @Override
- public String getGroupId() {
- return m_groupId;
- }
-
- @Override
- public String getJobId() {
- return m_jobId;
- }
-
- @Override
- public boolean acceptTick(TickSignal signal) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("task " + getJobId() + " at " + signal);
- }
- int second = signal.getSecond();
- int minute = signal.getMinute();
- int hour = signal.getHour();
- int day = signal.getDay();
- int week = signal.getWeek();
- int month = signal.getMonth();
- int year = signal.getYear();
- int dayOfWeek = signal.getDayOfWeek();
- int dayOfMonthReverse = signal.getDayOfMonthReverse();
- int dayOfYear = signal.getDayOfYear();
- int secondOfDay = signal.getSecondOfDay();
- boolean accepted = execAcceptTick(signal, second, minute, hour, day, week, month, year, dayOfWeek, dayOfMonthReverse, dayOfYear, secondOfDay);
- if (accepted) {
- if (LOG.isInfoEnabled()) {
- LOG.info("accepted task " + getJobId() + " triggered at " + signal);
- }
- }
- return accepted;
- }
-
- @Override
- @ConfigOperation
- @Order(20)
- public void run(IScheduler scheduler, TickSignal signal) throws ProcessingException {
- }
-
- @ConfigOperation
- @Order(10)
- protected boolean execAcceptTick(TickSignal signal, int second, int minute, int hour, int day, int week, int month, int year, int dayOfWeek, int dayOfMonthReverse, int dayOfYear, int secondOfDay) {
- return false;
- }
-
- @Override
- public boolean isInterrupted() {
- return m_interrupted;
- }
-
- @Override
- public void setInterrupted(boolean b) {
- m_interrupted = b;
- }
-
- @Override
- public boolean isDisposed() {
- return m_disposed;
- }
-
- @Override
- public void setDisposed(boolean b) {
- m_disposed = b;
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName() + "[" + m_groupId + "." + m_jobId + "]";
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.scheduler;
+
+import org.eclipse.scout.commons.annotations.ConfigOperation;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+
+public abstract class AbstractSchedulerJob implements ISchedulerJob {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractSchedulerJob.class);
+
+ private final String m_groupId;
+ private final String m_jobId;
+ private volatile boolean m_disposed;
+ private volatile boolean m_interrupted;
+
+ public AbstractSchedulerJob(String groupId, String jobId) {
+ m_groupId = groupId;
+ m_jobId = jobId;
+ }
+
+ @Override
+ public String getGroupId() {
+ return m_groupId;
+ }
+
+ @Override
+ public String getJobId() {
+ return m_jobId;
+ }
+
+ @Override
+ public boolean acceptTick(TickSignal signal) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("task " + getJobId() + " at " + signal);
+ }
+ int second = signal.getSecond();
+ int minute = signal.getMinute();
+ int hour = signal.getHour();
+ int day = signal.getDay();
+ int week = signal.getWeek();
+ int month = signal.getMonth();
+ int year = signal.getYear();
+ int dayOfWeek = signal.getDayOfWeek();
+ int dayOfMonthReverse = signal.getDayOfMonthReverse();
+ int dayOfYear = signal.getDayOfYear();
+ int secondOfDay = signal.getSecondOfDay();
+ boolean accepted = execAcceptTick(signal, second, minute, hour, day, week, month, year, dayOfWeek, dayOfMonthReverse, dayOfYear, secondOfDay);
+ if (accepted) {
+ if (LOG.isInfoEnabled()) {
+ LOG.info("accepted task " + getJobId() + " triggered at " + signal);
+ }
+ }
+ return accepted;
+ }
+
+ @Override
+ @ConfigOperation
+ @Order(20)
+ public void run(IScheduler scheduler, TickSignal signal) throws ProcessingException {
+ }
+
+ @ConfigOperation
+ @Order(10)
+ protected boolean execAcceptTick(TickSignal signal, int second, int minute, int hour, int day, int week, int month, int year, int dayOfWeek, int dayOfMonthReverse, int dayOfYear, int secondOfDay) {
+ return false;
+ }
+
+ @Override
+ public boolean isInterrupted() {
+ return m_interrupted;
+ }
+
+ @Override
+ public void setInterrupted(boolean b) {
+ m_interrupted = b;
+ }
+
+ @Override
+ public boolean isDisposed() {
+ return m_disposed;
+ }
+
+ @Override
+ public void setDisposed(boolean b) {
+ m_disposed = b;
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + "[" + m_groupId + "." + m_jobId + "]";
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/AbstractSchedulerJobWithFormula.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/AbstractSchedulerJobWithFormula.java
index eb14220698..64a3c03bd9 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/AbstractSchedulerJobWithFormula.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/AbstractSchedulerJobWithFormula.java
@@ -1,88 +1,88 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.scheduler;
-
-import java.text.ParseException;
-
-import org.eclipse.scout.commons.VerboseUtility;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.server.scheduler.internal.FormulaParser;
-import org.eclipse.scout.rt.server.scheduler.internal.SchedulingFormula;
-
-/**
- * Special job with a formula that defines the pattern interval
- */
-public abstract class AbstractSchedulerJobWithFormula extends AbstractSchedulerJob {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractSchedulerJobWithFormula.class);
- private ISchedulingFormula m_formulaCompiled;
- private String m_action;
- private Object[] m_args;
-
- /**
- * see {@link AbstractSchedulerJobWithFormula(String, String, String, String,
- * Object[])}
- */
- public AbstractSchedulerJobWithFormula(String groupId, String jobId, String formula) throws ProcessingException {
- this(groupId, jobId, formula, null);
- }
-
- /**
- * @param formula
- * see syntax in {@link com.bsiag.scheduler.formula.FormulaParser} FORMULA is a boolean expression that can
- * use the following
- * variables: second (0..59) minute (0..59) hour (0..23) day (1..31)
- * week (1..52) month (1..12) year (1900..9999) dayOfWeek (1..7) 1 is
- * monday dayOfMonthReverse (1..31) 1 is last day of month dayOfYear
- * (1..365) arg0....argN where arg0 is the value of param args[0],...
- * Examples of a formula: (second==0) && (minute % 2 == 0) //every
- * even minute (second==0) && (minute==0) && (hour==13) && (day==1)
- * //every first day of each month at 13:00:00
- */
- public AbstractSchedulerJobWithFormula(String groupId, String jobId, String formula, String action, Object... args) throws ProcessingException {
- super(groupId, jobId);
- m_action = action;
- m_args = args;
- m_formulaCompiled = createFormula(formula);
- }
-
- public ISchedulingFormula getFormula() {
- return m_formulaCompiled;
- }
-
- public String getAction() {
- return m_action;
- }
-
- public Object[] getArgs() {
- return m_args;
- }
-
- @Override
- public final boolean acceptTick(TickSignal signal) {
- return m_formulaCompiled.eval(signal, getArgs());
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName() + "[" + getGroupId() + "." + getJobId() + " formula=" + m_formulaCompiled + ", action=" + m_action + ", args=" + VerboseUtility.dumpObjects(m_args) + "]";
- }
-
- public static ISchedulingFormula createFormula(String formula) throws ProcessingException {
- try {
- return new SchedulingFormula(new FormulaParser().parse(formula));
- }
- catch (ParseException e) {
- throw new ProcessingException("invalid formula: " + formula, e);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.scheduler;
+
+import java.text.ParseException;
+
+import org.eclipse.scout.commons.VerboseUtility;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.server.scheduler.internal.FormulaParser;
+import org.eclipse.scout.rt.server.scheduler.internal.SchedulingFormula;
+
+/**
+ * Special job with a formula that defines the pattern interval
+ */
+public abstract class AbstractSchedulerJobWithFormula extends AbstractSchedulerJob {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractSchedulerJobWithFormula.class);
+ private ISchedulingFormula m_formulaCompiled;
+ private String m_action;
+ private Object[] m_args;
+
+ /**
+ * see {@link AbstractSchedulerJobWithFormula(String, String, String, String,
+ * Object[])}
+ */
+ public AbstractSchedulerJobWithFormula(String groupId, String jobId, String formula) throws ProcessingException {
+ this(groupId, jobId, formula, null);
+ }
+
+ /**
+ * @param formula
+ * see syntax in {@link com.bsiag.scheduler.formula.FormulaParser} FORMULA is a boolean expression that can
+ * use the following
+ * variables: second (0..59) minute (0..59) hour (0..23) day (1..31)
+ * week (1..52) month (1..12) year (1900..9999) dayOfWeek (1..7) 1 is
+ * monday dayOfMonthReverse (1..31) 1 is last day of month dayOfYear
+ * (1..365) arg0....argN where arg0 is the value of param args[0],...
+ * Examples of a formula: (second==0) && (minute % 2 == 0) //every
+ * even minute (second==0) && (minute==0) && (hour==13) && (day==1)
+ * //every first day of each month at 13:00:00
+ */
+ public AbstractSchedulerJobWithFormula(String groupId, String jobId, String formula, String action, Object... args) throws ProcessingException {
+ super(groupId, jobId);
+ m_action = action;
+ m_args = args;
+ m_formulaCompiled = createFormula(formula);
+ }
+
+ public ISchedulingFormula getFormula() {
+ return m_formulaCompiled;
+ }
+
+ public String getAction() {
+ return m_action;
+ }
+
+ public Object[] getArgs() {
+ return m_args;
+ }
+
+ @Override
+ public final boolean acceptTick(TickSignal signal) {
+ return m_formulaCompiled.eval(signal, getArgs());
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + "[" + getGroupId() + "." + getJobId() + " formula=" + m_formulaCompiled + ", action=" + m_action + ", args=" + VerboseUtility.dumpObjects(m_args) + "]";
+ }
+
+ public static ISchedulingFormula createFormula(String formula) throws ProcessingException {
+ try {
+ return new SchedulingFormula(new FormulaParser().parse(formula));
+ }
+ catch (ParseException e) {
+ throw new ProcessingException("invalid formula: " + formula, e);
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/IScheduler.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/IScheduler.java
index 505c0fb2bc..0b0057548f 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/IScheduler.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/IScheduler.java
@@ -1,104 +1,104 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.scheduler;
-
-import java.util.Collection;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-
-public interface IScheduler {
-
- boolean isActive();
-
- void setActive(boolean b);
-
- Ticker getTicker();
-
- /**
- * Add a new job to the scheduler. All jobs with matching groupId || jobId are
- * disposed (removed). A null value for groupId or jobId is interpreted as
- * wildcard when no existing matching job is currently running, then this new
- * job is immediately scheduled when ready otherwiese it is just queued and
- * the existing jobs are finished (not interrupted)
- */
- void addJob(ISchedulerJob newJob);
-
- /**
- * convenience for removeJobs(null,null)
- */
- void removeAllJobs();
-
- /**
- * @param groupId
- * filter value or null as wildcard
- * @param jobId
- * filter value or null as wildcard
- * @return the list of removed jobs
- */
- Collection<ISchedulerJob> removeJobs(String groupId, String jobId);
-
- /**
- * convenience for interruptJobs(null,null)
- */
- void interruptAllJobs();
-
- /**
- * @param groupId
- * filter value or null as wildcard
- * @param jobId
- * filter value or null as wildcard
- * @return the list of interrupted jobs
- */
- Collection<ISchedulerJob> interruptJobs(String groupId, String jobId);
-
- int getJobCount();
-
- int getRunningJobCount();
-
- /**
- * convenience for getJobs(null,jobId) Note that this will return the first
- * found job with that id even though there might be other jobs with that same
- * id
- */
- ISchedulerJob getJob(String jobId);
-
- /**
- * convenience for getJobs(null,null)
- */
- Collection<ISchedulerJob> getAllJobs();
-
- Collection<ISchedulerJob> getJobs(String groupId, String jobId);
-
- /**
- * convenience for getRunningJobs(null,null)
- */
- Collection<ISchedulerJob> getAllRunningJobs();
-
- Collection<ISchedulerJob> getRunningJobs(String groupId, String jobId);
-
- /**
- * Override this filter to control the running of scheduler jobs This method
- * is synchronous and must wait until the call to {@link ISchedulerJob#run(TickSignal)} has returned The default
- * implementation just calls job.run(signal);
- */
- void handleJobExecution(ISchedulerJob job, TickSignal signal) throws ProcessingException;
-
- /**
- * start scheduler if already running, this method does nothing
- */
- void start();
-
- /**
- * stop scheduler if not running, this method does nothing else it interrupts
- * all jobs, disposes all jobs and stops scheduler
- */
- void stop();
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.scheduler;
+
+import java.util.Collection;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+
+public interface IScheduler {
+
+ boolean isActive();
+
+ void setActive(boolean b);
+
+ Ticker getTicker();
+
+ /**
+ * Add a new job to the scheduler. All jobs with matching groupId || jobId are
+ * disposed (removed). A null value for groupId or jobId is interpreted as
+ * wildcard when no existing matching job is currently running, then this new
+ * job is immediately scheduled when ready otherwiese it is just queued and
+ * the existing jobs are finished (not interrupted)
+ */
+ void addJob(ISchedulerJob newJob);
+
+ /**
+ * convenience for removeJobs(null,null)
+ */
+ void removeAllJobs();
+
+ /**
+ * @param groupId
+ * filter value or null as wildcard
+ * @param jobId
+ * filter value or null as wildcard
+ * @return the list of removed jobs
+ */
+ Collection<ISchedulerJob> removeJobs(String groupId, String jobId);
+
+ /**
+ * convenience for interruptJobs(null,null)
+ */
+ void interruptAllJobs();
+
+ /**
+ * @param groupId
+ * filter value or null as wildcard
+ * @param jobId
+ * filter value or null as wildcard
+ * @return the list of interrupted jobs
+ */
+ Collection<ISchedulerJob> interruptJobs(String groupId, String jobId);
+
+ int getJobCount();
+
+ int getRunningJobCount();
+
+ /**
+ * convenience for getJobs(null,jobId) Note that this will return the first
+ * found job with that id even though there might be other jobs with that same
+ * id
+ */
+ ISchedulerJob getJob(String jobId);
+
+ /**
+ * convenience for getJobs(null,null)
+ */
+ Collection<ISchedulerJob> getAllJobs();
+
+ Collection<ISchedulerJob> getJobs(String groupId, String jobId);
+
+ /**
+ * convenience for getRunningJobs(null,null)
+ */
+ Collection<ISchedulerJob> getAllRunningJobs();
+
+ Collection<ISchedulerJob> getRunningJobs(String groupId, String jobId);
+
+ /**
+ * Override this filter to control the running of scheduler jobs This method
+ * is synchronous and must wait until the call to {@link ISchedulerJob#run(TickSignal)} has returned The default
+ * implementation just calls job.run(signal);
+ */
+ void handleJobExecution(ISchedulerJob job, TickSignal signal) throws ProcessingException;
+
+ /**
+ * start scheduler if already running, this method does nothing
+ */
+ void start();
+
+ /**
+ * stop scheduler if not running, this method does nothing else it interrupts
+ * all jobs, disposes all jobs and stops scheduler
+ */
+ void stop();
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/ISchedulerJob.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/ISchedulerJob.java
index 6ba038d810..7f57da0944 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/ISchedulerJob.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/ISchedulerJob.java
@@ -1,54 +1,54 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.scheduler;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-
-public interface ISchedulerJob {
-
- /**
- * jobs can be grouped using this groupId
- */
- String getGroupId();
-
- /**
- * every job (should) have a unique id which is composed of the jobId and the
- * groupId
- */
- String getJobId();
-
- /**
- * This call is synchronous from the job queue and therefore must not block
- * for long times during execution
- */
- boolean acceptTick(TickSignal signal);
-
- void run(IScheduler scheduler, TickSignal signal) throws ProcessingException;
-
- /**
- * the interrupted property is set to false by the scheduler every time just
- * before the job is run the interrupted property is set to true by the
- * scheduler whenever the scheduler or one of its job should interrupt
- */
- boolean isInterrupted();
-
- void setInterrupted(boolean b);
-
- /**
- * the dispose property when set to true (by the scheduler or by the job
- * itself) causes the scheduler to remove the job from the queue after its
- * pending execution when a job is (re-) added to the scheduler this property
- * is set to false by the scheduler
- */
- boolean isDisposed();
-
- void setDisposed(boolean b);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.scheduler;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+
+public interface ISchedulerJob {
+
+ /**
+ * jobs can be grouped using this groupId
+ */
+ String getGroupId();
+
+ /**
+ * every job (should) have a unique id which is composed of the jobId and the
+ * groupId
+ */
+ String getJobId();
+
+ /**
+ * This call is synchronous from the job queue and therefore must not block
+ * for long times during execution
+ */
+ boolean acceptTick(TickSignal signal);
+
+ void run(IScheduler scheduler, TickSignal signal) throws ProcessingException;
+
+ /**
+ * the interrupted property is set to false by the scheduler every time just
+ * before the job is run the interrupted property is set to true by the
+ * scheduler whenever the scheduler or one of its job should interrupt
+ */
+ boolean isInterrupted();
+
+ void setInterrupted(boolean b);
+
+ /**
+ * the dispose property when set to true (by the scheduler or by the job
+ * itself) causes the scheduler to remove the job from the queue after its
+ * pending execution when a job is (re-) added to the scheduler this property
+ * is set to false by the scheduler
+ */
+ boolean isDisposed();
+
+ void setDisposed(boolean b);
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/ISchedulingFormula.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/ISchedulingFormula.java
index 517723edfc..49996b1c05 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/ISchedulingFormula.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/ISchedulingFormula.java
@@ -1,20 +1,20 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.scheduler;
-
-public interface ISchedulingFormula {
-
- @Override
- String toString();
-
- boolean eval(TickSignal signal, Object[] args);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.scheduler;
+
+public interface ISchedulingFormula {
+
+ @Override
+ String toString();
+
+ boolean eval(TickSignal signal, Object[] args);
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/Scheduler.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/Scheduler.java
index ce24ad840e..5f81172569 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/Scheduler.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/Scheduler.java
@@ -1,430 +1,430 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.scheduler;
-
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Collection;
-import java.util.HashSet;
-
-import javax.security.auth.Subject;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.scout.commons.StoppableThread;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.server.IServerSession;
-import org.eclipse.scout.rt.server.ServerJob;
-import org.eclipse.scout.rt.server.services.common.session.IServerSessionRegistryService;
-import org.eclipse.scout.service.SERVICES;
-
-public class Scheduler implements IScheduler {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(Scheduler.class);
-
- // dispatcher
- private P_Dispatcher m_dispatcher;
- // queue
- private Object m_queueLock;
- private HashSet<ISchedulerJob> m_availableJobs;
- private HashSet<ISchedulerJob> m_runningJobs;
- // timer
- private Ticker m_ticker;
- private boolean m_active = true;
- //
- private Subject m_subject;
- private IServerSession m_serverSession;
-
- public Scheduler(Subject subject, Class<? extends IServerSession> serverSessionType) throws ProcessingException {
- this(subject, serverSessionType, new Ticker(Calendar.MINUTE));
- }
-
- public Scheduler(Subject subject, Class<? extends IServerSession> serverSessionType, Ticker ticker) throws ProcessingException {
- m_availableJobs = new HashSet<ISchedulerJob>();
- m_runningJobs = new HashSet<ISchedulerJob>();
- m_queueLock = new Object();
- m_ticker = ticker;
- m_subject = subject;
- m_serverSession = SERVICES.getService(IServerSessionRegistryService.class).newServerSession(serverSessionType, subject);
- }
-
- @Override
- public void setActive(boolean b) {
- m_active = b;
- }
-
- @Override
- public boolean isActive() {
- return m_active;
- }
-
- @Override
- public Ticker getTicker() {
- return m_ticker;
- }
-
- @Override
- public void start() {
- synchronized (m_queueLock) {
- if (m_dispatcher == null) {
- m_dispatcher = new P_Dispatcher();
- m_dispatcher.start();
- }
- }
- }
-
- @Override
- public void stop() {
- synchronized (m_queueLock) {
- if (m_dispatcher != null) {
- m_dispatcher.setStopSignal();
- m_dispatcher = null;
- for (ISchedulerJob job : m_runningJobs) {
- try {
- job.setInterrupted(true);
- }
- catch (Throwable t) {
- LOG.error("" + job, t);
- }
- }
- }
- }
- }
-
- /**
- * Job Queue
- */
-
- private boolean matches(ISchedulerJob job, String groupId, String jobId) {
- return (groupId == null || groupId.equals(job.getGroupId())) && (jobId == null || jobId.equals(job.getJobId()));
- }
-
- @Override
- public void addJob(ISchedulerJob newJob) {
- if (newJob == null) {
- throw new IllegalArgumentException("job must not be null");
- }
- synchronized (m_queueLock) {
- newJob.setDisposed(false);
- String groupId = newJob.getGroupId();
- String jobId = newJob.getJobId();
- ArrayList<ISchedulerJob> oldJobs = new ArrayList<ISchedulerJob>();
- for (ISchedulerJob job : m_availableJobs) {
- if (matches(job, groupId, jobId)) {
- job.setDisposed(true);
- oldJobs.add(job);
- }
- }
- m_availableJobs.removeAll(oldJobs);
- m_availableJobs.add(newJob);
- // check if job should already be run
- boolean oldJobsRunning = false;
- for (ISchedulerJob job : m_runningJobs) {
- if (matches(job, groupId, jobId)) {
- oldJobsRunning = true;
- break;
- }
- }
- if (!oldJobsRunning) {
- TickSignal tick = m_ticker.getCurrentTick();
- visitJobWithoutLocking(newJob, tick);
- }
- }
- }
-
- /**
- * convenience for removeJobs(null,null)
- */
- @Override
- public void removeAllJobs() {
- removeJobs(null, null);
- }
-
- /**
- * @param groupId
- * filter value or null as wildcard
- * @param jobId
- * filter value or null as wildcard
- * @return the list of removed jobs
- */
- @Override
- public Collection<ISchedulerJob> removeJobs(String groupId, String jobId) {
- synchronized (m_queueLock) {
- ArrayList<ISchedulerJob> removedJobs = new ArrayList<ISchedulerJob>();
- for (ISchedulerJob job : m_availableJobs) {
- if (matches(job, groupId, jobId)) {
- job.setDisposed(true);
- removedJobs.add(job);
- }
- }
- m_availableJobs.removeAll(removedJobs);
- return removedJobs;
- }
- }
-
- /**
- * convenience for interruptJobs(null,null)
- */
- @Override
- public void interruptAllJobs() {
- interruptJobs(null, null);
- }
-
- /**
- * @param groupId
- * filter value or null as wildcard
- * @param jobId
- * filter value or null as wildcard
- * @return the list of interrupted jobs
- */
- @Override
- public Collection<ISchedulerJob> interruptJobs(String groupId, String jobId) {
- synchronized (m_queueLock) {
- ArrayList<ISchedulerJob> intJobs = new ArrayList<ISchedulerJob>();
- for (ISchedulerJob job : m_availableJobs) {
- if (matches(job, groupId, jobId)) {
- if (m_runningJobs.contains(job)) {
- job.setInterrupted(true);
- intJobs.add(job);
- }
- }
- }
- return intJobs;
- }
- }
-
- @Override
- public int getJobCount() {
- synchronized (m_queueLock) {
- return m_availableJobs.size();
- }
- }
-
- @Override
- public int getRunningJobCount() {
- synchronized (m_queueLock) {
- return m_runningJobs.size();
- }
- }
-
- /**
- * convenience for getJobs(null,jobId) Note that this will return the first
- * found job with that id even though there might be other jobs with that same
- * id
- */
- @Override
- public ISchedulerJob getJob(String jobId) {
- Collection<ISchedulerJob> list = getJobs(null, jobId);
- if (list.size() >= 1) {
- return list.iterator().next();
- }
- else {
- return null;
- }
- }
-
- /**
- * convenience for getJobs(null,null)
- */
- @Override
- public Collection<ISchedulerJob> getAllJobs() {
- return getJobs(null, null);
- }
-
- @Override
- public Collection<ISchedulerJob> getJobs(String groupId, String jobId) {
- synchronized (m_queueLock) {
- ArrayList<ISchedulerJob> jobs = new ArrayList<ISchedulerJob>();
- for (ISchedulerJob job : m_availableJobs) {
- if (matches(job, groupId, jobId)) {
- jobs.add(job);
- }
- }
- return jobs;
- }
- }
-
- /**
- * convenience for getRunningJobs(null,null)
- */
- @Override
- public Collection<ISchedulerJob> getAllRunningJobs() {
- return getRunningJobs(null, null);
- }
-
- @Override
- public Collection<ISchedulerJob> getRunningJobs(String groupId, String jobId) {
- synchronized (m_queueLock) {
- ArrayList<ISchedulerJob> jobs = new ArrayList<ISchedulerJob>();
- for (ISchedulerJob job : m_availableJobs) {
- if (matches(job, groupId, jobId)) {
- jobs.add(job);
- }
- }
- return jobs;
- }
- }
-
- protected void visitAllJobs(TickSignal tick) {
- synchronized (m_queueLock) {
- visitAllJobsWithoutLocking(tick);
- }
- }
-
- protected void visitAllJobsWithoutLocking(TickSignal tick) {
- for (ISchedulerJob job : new ArrayList<ISchedulerJob>(m_availableJobs)) {
- visitJobWithoutLocking(job, tick);
- }
- }
-
- protected void visitJob(ISchedulerJob job, TickSignal tick) {
- synchronized (m_queueLock) {
- visitJobWithoutLocking(job, tick);
- }
- }
-
- protected void visitJobWithoutLocking(ISchedulerJob job, TickSignal tick) {
- try {
- if (m_runningJobs.contains(job)) {
- // still running
- if (LOG.isInfoEnabled()) {
- if (job.acceptTick(tick)) {
- LOG.info("job " + job + " is still running at " + tick);
- }
- }
- }
- else {
- // idle
- if (job.isDisposed()) {
- m_availableJobs.remove(job);
- }
- else if (job.acceptTick(tick)) {
- m_runningJobs.add(job);
- if (LOG.isInfoEnabled()) {
- LOG.info("job " + job + " triggered at " + tick);
- }
- P_JobRunner runner = new P_JobRunner(job, tick);
- Thread t = new Thread(runner, "Scheduler.JobLauncher." + job.getGroupId() + "." + job.getJobId());
- t.setDaemon(true);
- t.start();
- }
- }
- }
- catch (Throwable t) {
- LOG.error("" + job, t);
- }
- }
-
- @Override
- public void handleJobExecution(final ISchedulerJob job, final TickSignal signal) throws ProcessingException {
- ServerJob serverJob = new ServerJob("Scheduler", m_serverSession, m_subject) {
- @Override
- protected IStatus runTransaction(IProgressMonitor monitor) throws Exception {
- job.run(Scheduler.this, signal);
- return Status.OK_STATUS;
- }
- };
- serverJob.schedule();
- try {
- serverJob.join();
- }
- catch (InterruptedException ie) {
- throw new ProcessingException("Interrupted", ie);
- }
- }
-
- /**
- * Every job trigger is launched using this private class
- */
- private class P_JobRunner implements Runnable {
- private ISchedulerJob m_job;
- private TickSignal m_signal;
-
- public P_JobRunner(ISchedulerJob job, TickSignal signal) {
- m_job = job;
- m_signal = signal;
- }
-
- public ISchedulerJob getJob() {
- return m_job;
- }
-
- public TickSignal getTickSignal() {
- return m_signal;
- }
-
- @Override
- public void run() {
- try {
- m_job.setInterrupted(false);
- handleJobExecution(m_job, m_signal);
- }
- catch (Throwable t) {
- LOG.error("uncaught exception", t);
- }
- finally {
- // remove job from running queue
- synchronized (m_queueLock) {
- m_runningJobs.remove(m_job);
- if (m_job.isDisposed()) {
- m_availableJobs.remove(m_job);
- }
- }
- }
- }
- }// end private class
-
- private class P_Dispatcher extends StoppableThread {
-
- public P_Dispatcher() {
- setName("Scheduler.Dispatcher");
- setDaemon(true);
- }
-
- @Override
- public void run() {
- if (LOG.isInfoEnabled()) {
- LOG.info("scheduler started");
- }
- while (!isStopSignal()) {
- try {
- if (isActive()) {
- TickSignal signal = m_ticker.waitForNextTick();
- if (LOG.isDebugEnabled()) {
- LOG.debug("tick " + signal);
- }
- visitAllJobs(signal);
- }
- else {
- if (LOG.isDebugEnabled()) {
- LOG.debug("ticking suspended");
- }
- try {
- sleep(1000);
- }
- catch (InterruptedException ie) {
- }
- }
- }
- catch (Throwable t) {
- t.printStackTrace();
- LOG.error("unexpected error: ", t);
- }
- }
- if (LOG.isInfoEnabled()) {
- LOG.info("scheduler stopped");
- }
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.scheduler;
+
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Collection;
+import java.util.HashSet;
+
+import javax.security.auth.Subject;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.scout.commons.StoppableThread;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.server.IServerSession;
+import org.eclipse.scout.rt.server.ServerJob;
+import org.eclipse.scout.rt.server.services.common.session.IServerSessionRegistryService;
+import org.eclipse.scout.service.SERVICES;
+
+public class Scheduler implements IScheduler {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(Scheduler.class);
+
+ // dispatcher
+ private P_Dispatcher m_dispatcher;
+ // queue
+ private Object m_queueLock;
+ private HashSet<ISchedulerJob> m_availableJobs;
+ private HashSet<ISchedulerJob> m_runningJobs;
+ // timer
+ private Ticker m_ticker;
+ private boolean m_active = true;
+ //
+ private Subject m_subject;
+ private IServerSession m_serverSession;
+
+ public Scheduler(Subject subject, Class<? extends IServerSession> serverSessionType) throws ProcessingException {
+ this(subject, serverSessionType, new Ticker(Calendar.MINUTE));
+ }
+
+ public Scheduler(Subject subject, Class<? extends IServerSession> serverSessionType, Ticker ticker) throws ProcessingException {
+ m_availableJobs = new HashSet<ISchedulerJob>();
+ m_runningJobs = new HashSet<ISchedulerJob>();
+ m_queueLock = new Object();
+ m_ticker = ticker;
+ m_subject = subject;
+ m_serverSession = SERVICES.getService(IServerSessionRegistryService.class).newServerSession(serverSessionType, subject);
+ }
+
+ @Override
+ public void setActive(boolean b) {
+ m_active = b;
+ }
+
+ @Override
+ public boolean isActive() {
+ return m_active;
+ }
+
+ @Override
+ public Ticker getTicker() {
+ return m_ticker;
+ }
+
+ @Override
+ public void start() {
+ synchronized (m_queueLock) {
+ if (m_dispatcher == null) {
+ m_dispatcher = new P_Dispatcher();
+ m_dispatcher.start();
+ }
+ }
+ }
+
+ @Override
+ public void stop() {
+ synchronized (m_queueLock) {
+ if (m_dispatcher != null) {
+ m_dispatcher.setStopSignal();
+ m_dispatcher = null;
+ for (ISchedulerJob job : m_runningJobs) {
+ try {
+ job.setInterrupted(true);
+ }
+ catch (Throwable t) {
+ LOG.error("" + job, t);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Job Queue
+ */
+
+ private boolean matches(ISchedulerJob job, String groupId, String jobId) {
+ return (groupId == null || groupId.equals(job.getGroupId())) && (jobId == null || jobId.equals(job.getJobId()));
+ }
+
+ @Override
+ public void addJob(ISchedulerJob newJob) {
+ if (newJob == null) {
+ throw new IllegalArgumentException("job must not be null");
+ }
+ synchronized (m_queueLock) {
+ newJob.setDisposed(false);
+ String groupId = newJob.getGroupId();
+ String jobId = newJob.getJobId();
+ ArrayList<ISchedulerJob> oldJobs = new ArrayList<ISchedulerJob>();
+ for (ISchedulerJob job : m_availableJobs) {
+ if (matches(job, groupId, jobId)) {
+ job.setDisposed(true);
+ oldJobs.add(job);
+ }
+ }
+ m_availableJobs.removeAll(oldJobs);
+ m_availableJobs.add(newJob);
+ // check if job should already be run
+ boolean oldJobsRunning = false;
+ for (ISchedulerJob job : m_runningJobs) {
+ if (matches(job, groupId, jobId)) {
+ oldJobsRunning = true;
+ break;
+ }
+ }
+ if (!oldJobsRunning) {
+ TickSignal tick = m_ticker.getCurrentTick();
+ visitJobWithoutLocking(newJob, tick);
+ }
+ }
+ }
+
+ /**
+ * convenience for removeJobs(null,null)
+ */
+ @Override
+ public void removeAllJobs() {
+ removeJobs(null, null);
+ }
+
+ /**
+ * @param groupId
+ * filter value or null as wildcard
+ * @param jobId
+ * filter value or null as wildcard
+ * @return the list of removed jobs
+ */
+ @Override
+ public Collection<ISchedulerJob> removeJobs(String groupId, String jobId) {
+ synchronized (m_queueLock) {
+ ArrayList<ISchedulerJob> removedJobs = new ArrayList<ISchedulerJob>();
+ for (ISchedulerJob job : m_availableJobs) {
+ if (matches(job, groupId, jobId)) {
+ job.setDisposed(true);
+ removedJobs.add(job);
+ }
+ }
+ m_availableJobs.removeAll(removedJobs);
+ return removedJobs;
+ }
+ }
+
+ /**
+ * convenience for interruptJobs(null,null)
+ */
+ @Override
+ public void interruptAllJobs() {
+ interruptJobs(null, null);
+ }
+
+ /**
+ * @param groupId
+ * filter value or null as wildcard
+ * @param jobId
+ * filter value or null as wildcard
+ * @return the list of interrupted jobs
+ */
+ @Override
+ public Collection<ISchedulerJob> interruptJobs(String groupId, String jobId) {
+ synchronized (m_queueLock) {
+ ArrayList<ISchedulerJob> intJobs = new ArrayList<ISchedulerJob>();
+ for (ISchedulerJob job : m_availableJobs) {
+ if (matches(job, groupId, jobId)) {
+ if (m_runningJobs.contains(job)) {
+ job.setInterrupted(true);
+ intJobs.add(job);
+ }
+ }
+ }
+ return intJobs;
+ }
+ }
+
+ @Override
+ public int getJobCount() {
+ synchronized (m_queueLock) {
+ return m_availableJobs.size();
+ }
+ }
+
+ @Override
+ public int getRunningJobCount() {
+ synchronized (m_queueLock) {
+ return m_runningJobs.size();
+ }
+ }
+
+ /**
+ * convenience for getJobs(null,jobId) Note that this will return the first
+ * found job with that id even though there might be other jobs with that same
+ * id
+ */
+ @Override
+ public ISchedulerJob getJob(String jobId) {
+ Collection<ISchedulerJob> list = getJobs(null, jobId);
+ if (list.size() >= 1) {
+ return list.iterator().next();
+ }
+ else {
+ return null;
+ }
+ }
+
+ /**
+ * convenience for getJobs(null,null)
+ */
+ @Override
+ public Collection<ISchedulerJob> getAllJobs() {
+ return getJobs(null, null);
+ }
+
+ @Override
+ public Collection<ISchedulerJob> getJobs(String groupId, String jobId) {
+ synchronized (m_queueLock) {
+ ArrayList<ISchedulerJob> jobs = new ArrayList<ISchedulerJob>();
+ for (ISchedulerJob job : m_availableJobs) {
+ if (matches(job, groupId, jobId)) {
+ jobs.add(job);
+ }
+ }
+ return jobs;
+ }
+ }
+
+ /**
+ * convenience for getRunningJobs(null,null)
+ */
+ @Override
+ public Collection<ISchedulerJob> getAllRunningJobs() {
+ return getRunningJobs(null, null);
+ }
+
+ @Override
+ public Collection<ISchedulerJob> getRunningJobs(String groupId, String jobId) {
+ synchronized (m_queueLock) {
+ ArrayList<ISchedulerJob> jobs = new ArrayList<ISchedulerJob>();
+ for (ISchedulerJob job : m_availableJobs) {
+ if (matches(job, groupId, jobId)) {
+ jobs.add(job);
+ }
+ }
+ return jobs;
+ }
+ }
+
+ protected void visitAllJobs(TickSignal tick) {
+ synchronized (m_queueLock) {
+ visitAllJobsWithoutLocking(tick);
+ }
+ }
+
+ protected void visitAllJobsWithoutLocking(TickSignal tick) {
+ for (ISchedulerJob job : new ArrayList<ISchedulerJob>(m_availableJobs)) {
+ visitJobWithoutLocking(job, tick);
+ }
+ }
+
+ protected void visitJob(ISchedulerJob job, TickSignal tick) {
+ synchronized (m_queueLock) {
+ visitJobWithoutLocking(job, tick);
+ }
+ }
+
+ protected void visitJobWithoutLocking(ISchedulerJob job, TickSignal tick) {
+ try {
+ if (m_runningJobs.contains(job)) {
+ // still running
+ if (LOG.isInfoEnabled()) {
+ if (job.acceptTick(tick)) {
+ LOG.info("job " + job + " is still running at " + tick);
+ }
+ }
+ }
+ else {
+ // idle
+ if (job.isDisposed()) {
+ m_availableJobs.remove(job);
+ }
+ else if (job.acceptTick(tick)) {
+ m_runningJobs.add(job);
+ if (LOG.isInfoEnabled()) {
+ LOG.info("job " + job + " triggered at " + tick);
+ }
+ P_JobRunner runner = new P_JobRunner(job, tick);
+ Thread t = new Thread(runner, "Scheduler.JobLauncher." + job.getGroupId() + "." + job.getJobId());
+ t.setDaemon(true);
+ t.start();
+ }
+ }
+ }
+ catch (Throwable t) {
+ LOG.error("" + job, t);
+ }
+ }
+
+ @Override
+ public void handleJobExecution(final ISchedulerJob job, final TickSignal signal) throws ProcessingException {
+ ServerJob serverJob = new ServerJob("Scheduler", m_serverSession, m_subject) {
+ @Override
+ protected IStatus runTransaction(IProgressMonitor monitor) throws Exception {
+ job.run(Scheduler.this, signal);
+ return Status.OK_STATUS;
+ }
+ };
+ serverJob.schedule();
+ try {
+ serverJob.join();
+ }
+ catch (InterruptedException ie) {
+ throw new ProcessingException("Interrupted", ie);
+ }
+ }
+
+ /**
+ * Every job trigger is launched using this private class
+ */
+ private class P_JobRunner implements Runnable {
+ private ISchedulerJob m_job;
+ private TickSignal m_signal;
+
+ public P_JobRunner(ISchedulerJob job, TickSignal signal) {
+ m_job = job;
+ m_signal = signal;
+ }
+
+ public ISchedulerJob getJob() {
+ return m_job;
+ }
+
+ public TickSignal getTickSignal() {
+ return m_signal;
+ }
+
+ @Override
+ public void run() {
+ try {
+ m_job.setInterrupted(false);
+ handleJobExecution(m_job, m_signal);
+ }
+ catch (Throwable t) {
+ LOG.error("uncaught exception", t);
+ }
+ finally {
+ // remove job from running queue
+ synchronized (m_queueLock) {
+ m_runningJobs.remove(m_job);
+ if (m_job.isDisposed()) {
+ m_availableJobs.remove(m_job);
+ }
+ }
+ }
+ }
+ }// end private class
+
+ private class P_Dispatcher extends StoppableThread {
+
+ public P_Dispatcher() {
+ setName("Scheduler.Dispatcher");
+ setDaemon(true);
+ }
+
+ @Override
+ public void run() {
+ if (LOG.isInfoEnabled()) {
+ LOG.info("scheduler started");
+ }
+ while (!isStopSignal()) {
+ try {
+ if (isActive()) {
+ TickSignal signal = m_ticker.waitForNextTick();
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("tick " + signal);
+ }
+ visitAllJobs(signal);
+ }
+ else {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("ticking suspended");
+ }
+ try {
+ sleep(1000);
+ }
+ catch (InterruptedException ie) {
+ }
+ }
+ }
+ catch (Throwable t) {
+ t.printStackTrace();
+ LOG.error("unexpected error: ", t);
+ }
+ }
+ if (LOG.isInfoEnabled()) {
+ LOG.info("scheduler stopped");
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/SchedulerAccessor.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/SchedulerAccessor.java
index 82b4f2a95d..9e423e7aa4 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/SchedulerAccessor.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/SchedulerAccessor.java
@@ -1,123 +1,123 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.scheduler;
-
-import java.util.Collection;
-
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-
-/**
- * This accessor can be used to give individual sessions limited access to a
- * global {@link IScheduler} via their {@link com.bsiag.service.scheduler.ISchedulerService} This implementation is
- * a transparent proxy. Override the methods that are subject to access control
- * restrictions
- */
-public class SchedulerAccessor implements IScheduler {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(SchedulerAccessor.class);
-
- private IScheduler m_scheduler;
-
- public SchedulerAccessor(IScheduler s) {
- m_scheduler = s;
- }
-
- @Override
- public void addJob(ISchedulerJob newJob) {
- m_scheduler.addJob(newJob);
- }
-
- @Override
- public Collection<ISchedulerJob> getAllJobs() {
- return m_scheduler.getAllJobs();
- }
-
- @Override
- public Collection<ISchedulerJob> getAllRunningJobs() {
- return m_scheduler.getAllRunningJobs();
- }
-
- @Override
- public ISchedulerJob getJob(String jobId) {
- return m_scheduler.getJob(jobId);
- }
-
- @Override
- public int getJobCount() {
- return m_scheduler.getJobCount();
- }
-
- @Override
- public Collection<ISchedulerJob> getJobs(String groupId, String jobId) {
- return m_scheduler.getJobs(groupId, jobId);
- }
-
- @Override
- public int getRunningJobCount() {
- return m_scheduler.getRunningJobCount();
- }
-
- @Override
- public Collection<ISchedulerJob> getRunningJobs(String groupId, String jobId) {
- return m_scheduler.getRunningJobs(groupId, jobId);
- }
-
- @Override
- public Ticker getTicker() {
- return m_scheduler.getTicker();
- }
-
- @Override
- public void interruptAllJobs() {
- m_scheduler.interruptAllJobs();
- }
-
- @Override
- public Collection<ISchedulerJob> interruptJobs(String groupId, String jobId) {
- return m_scheduler.interruptJobs(groupId, jobId);
- }
-
- @Override
- public boolean isActive() {
- return m_scheduler.isActive();
- }
-
- @Override
- public void removeAllJobs() {
- m_scheduler.removeAllJobs();
- }
-
- @Override
- public Collection<ISchedulerJob> removeJobs(String groupId, String jobId) {
- return m_scheduler.removeJobs(groupId, jobId);
- }
-
- @Override
- public void setActive(boolean b) {
- m_scheduler.setActive(b);
- }
-
- @Override
- public void handleJobExecution(ISchedulerJob job, TickSignal signal) {
- // nop, is never called on an access wrapper
- }
-
- @Override
- public void start() {
- m_scheduler.start();
- }
-
- @Override
- public void stop() {
- m_scheduler.stop();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.scheduler;
+
+import java.util.Collection;
+
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+
+/**
+ * This accessor can be used to give individual sessions limited access to a
+ * global {@link IScheduler} via their {@link com.bsiag.service.scheduler.ISchedulerService} This implementation is
+ * a transparent proxy. Override the methods that are subject to access control
+ * restrictions
+ */
+public class SchedulerAccessor implements IScheduler {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(SchedulerAccessor.class);
+
+ private IScheduler m_scheduler;
+
+ public SchedulerAccessor(IScheduler s) {
+ m_scheduler = s;
+ }
+
+ @Override
+ public void addJob(ISchedulerJob newJob) {
+ m_scheduler.addJob(newJob);
+ }
+
+ @Override
+ public Collection<ISchedulerJob> getAllJobs() {
+ return m_scheduler.getAllJobs();
+ }
+
+ @Override
+ public Collection<ISchedulerJob> getAllRunningJobs() {
+ return m_scheduler.getAllRunningJobs();
+ }
+
+ @Override
+ public ISchedulerJob getJob(String jobId) {
+ return m_scheduler.getJob(jobId);
+ }
+
+ @Override
+ public int getJobCount() {
+ return m_scheduler.getJobCount();
+ }
+
+ @Override
+ public Collection<ISchedulerJob> getJobs(String groupId, String jobId) {
+ return m_scheduler.getJobs(groupId, jobId);
+ }
+
+ @Override
+ public int getRunningJobCount() {
+ return m_scheduler.getRunningJobCount();
+ }
+
+ @Override
+ public Collection<ISchedulerJob> getRunningJobs(String groupId, String jobId) {
+ return m_scheduler.getRunningJobs(groupId, jobId);
+ }
+
+ @Override
+ public Ticker getTicker() {
+ return m_scheduler.getTicker();
+ }
+
+ @Override
+ public void interruptAllJobs() {
+ m_scheduler.interruptAllJobs();
+ }
+
+ @Override
+ public Collection<ISchedulerJob> interruptJobs(String groupId, String jobId) {
+ return m_scheduler.interruptJobs(groupId, jobId);
+ }
+
+ @Override
+ public boolean isActive() {
+ return m_scheduler.isActive();
+ }
+
+ @Override
+ public void removeAllJobs() {
+ m_scheduler.removeAllJobs();
+ }
+
+ @Override
+ public Collection<ISchedulerJob> removeJobs(String groupId, String jobId) {
+ return m_scheduler.removeJobs(groupId, jobId);
+ }
+
+ @Override
+ public void setActive(boolean b) {
+ m_scheduler.setActive(b);
+ }
+
+ @Override
+ public void handleJobExecution(ISchedulerJob job, TickSignal signal) {
+ // nop, is never called on an access wrapper
+ }
+
+ @Override
+ public void start() {
+ m_scheduler.start();
+ }
+
+ @Override
+ public void stop() {
+ m_scheduler.stop();
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/TickSignal.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/TickSignal.java
index b5a01a9f01..0cda6232bf 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/TickSignal.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/TickSignal.java
@@ -1,111 +1,111 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.scheduler;
-
-public class TickSignal {
- private int m_second;
- private int m_minute;
- private int m_hour;
- private int m_dayOfWeek;
- private int m_day;
- private int m_dayOfMonthReverse;
- private int m_dayOfYear;
- private int m_week;
- private int m_month;
- private int m_year;
- private int m_secondOfDay;
-
- public TickSignal(int second, int minute, int hour, int dayOfWeek, int day, int dayOfMonthReverse, int dayOfYear, int week, int month, int year) {
- m_second = second;
- m_minute = minute;
- m_hour = hour;
- m_dayOfWeek = dayOfWeek;
- m_day = day;
- m_dayOfMonthReverse = dayOfMonthReverse;
- m_dayOfYear = dayOfYear;
- m_week = week;
- m_month = month;
- m_year = year;
- m_secondOfDay = m_hour * 3600 + m_minute * 60 + m_second;
- }
-
- public int getSecond() {
- return m_second;
- }
-
- public int getMinute() {
- return m_minute;
- }
-
- public int getHour() {
- return m_hour;
- }
-
- public int getDayOfWeek() {
- return m_dayOfWeek;
- }
-
- /**
- * day of month
- */
- public int getDay() {
- return m_day;
- }
-
- public int getDayOfMonthReverse() {
- return m_dayOfMonthReverse;
- }
-
- public int getDayOfYear() {
- return m_dayOfYear;
- }
-
- /**
- * week of year
- */
- public int getWeek() {
- return m_week;
- }
-
- /**
- * month of year
- */
- public int getMonth() {
- return m_month;
- }
-
- public int getYear() {
- return m_year;
- }
-
- public int getSecondOfDay() {
- return m_secondOfDay;
- }
-
- public String getTextShort() {
- return formatAsDoubleDigit(m_day) + "." + formatAsDoubleDigit(m_month) + "." + m_year + " " + formatAsDoubleDigit(m_hour) + ":" + formatAsDoubleDigit(m_minute) + ":" + formatAsDoubleDigit(m_second);
- }
-
- public String getTextLong() {
- return formatAsDoubleDigit(m_day) + "." + formatAsDoubleDigit(m_month) + "." + m_year + " " + formatAsDoubleDigit(m_hour) + ":" + formatAsDoubleDigit(m_minute) + ":" + formatAsDoubleDigit(m_second) + " dayOfWeek=" + m_dayOfWeek + " dayOfMonthReverse=" + m_dayOfMonthReverse + " week=" + m_week + " dayOfYear=" + m_dayOfYear;
- }
-
- @Override
- public String toString() {
- return "TickSignal[" + getTextLong() + "]";
- }
-
- private String formatAsDoubleDigit(int i) {
- String s = "" + (i + 100);
- return s.substring(s.length() - 2);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.scheduler;
+
+public class TickSignal {
+ private int m_second;
+ private int m_minute;
+ private int m_hour;
+ private int m_dayOfWeek;
+ private int m_day;
+ private int m_dayOfMonthReverse;
+ private int m_dayOfYear;
+ private int m_week;
+ private int m_month;
+ private int m_year;
+ private int m_secondOfDay;
+
+ public TickSignal(int second, int minute, int hour, int dayOfWeek, int day, int dayOfMonthReverse, int dayOfYear, int week, int month, int year) {
+ m_second = second;
+ m_minute = minute;
+ m_hour = hour;
+ m_dayOfWeek = dayOfWeek;
+ m_day = day;
+ m_dayOfMonthReverse = dayOfMonthReverse;
+ m_dayOfYear = dayOfYear;
+ m_week = week;
+ m_month = month;
+ m_year = year;
+ m_secondOfDay = m_hour * 3600 + m_minute * 60 + m_second;
+ }
+
+ public int getSecond() {
+ return m_second;
+ }
+
+ public int getMinute() {
+ return m_minute;
+ }
+
+ public int getHour() {
+ return m_hour;
+ }
+
+ public int getDayOfWeek() {
+ return m_dayOfWeek;
+ }
+
+ /**
+ * day of month
+ */
+ public int getDay() {
+ return m_day;
+ }
+
+ public int getDayOfMonthReverse() {
+ return m_dayOfMonthReverse;
+ }
+
+ public int getDayOfYear() {
+ return m_dayOfYear;
+ }
+
+ /**
+ * week of year
+ */
+ public int getWeek() {
+ return m_week;
+ }
+
+ /**
+ * month of year
+ */
+ public int getMonth() {
+ return m_month;
+ }
+
+ public int getYear() {
+ return m_year;
+ }
+
+ public int getSecondOfDay() {
+ return m_secondOfDay;
+ }
+
+ public String getTextShort() {
+ return formatAsDoubleDigit(m_day) + "." + formatAsDoubleDigit(m_month) + "." + m_year + " " + formatAsDoubleDigit(m_hour) + ":" + formatAsDoubleDigit(m_minute) + ":" + formatAsDoubleDigit(m_second);
+ }
+
+ public String getTextLong() {
+ return formatAsDoubleDigit(m_day) + "." + formatAsDoubleDigit(m_month) + "." + m_year + " " + formatAsDoubleDigit(m_hour) + ":" + formatAsDoubleDigit(m_minute) + ":" + formatAsDoubleDigit(m_second) + " dayOfWeek=" + m_dayOfWeek + " dayOfMonthReverse=" + m_dayOfMonthReverse + " week=" + m_week + " dayOfYear=" + m_dayOfYear;
+ }
+
+ @Override
+ public String toString() {
+ return "TickSignal[" + getTextLong() + "]";
+ }
+
+ private String formatAsDoubleDigit(int i) {
+ String s = "" + (i + 100);
+ return s.substring(s.length() - 2);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/Ticker.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/Ticker.java
index 6153b49f79..cb13a5e906 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/Ticker.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/Ticker.java
@@ -1,145 +1,145 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.scheduler;
-
-import java.util.Calendar;
-import java.util.GregorianCalendar;
-
-public class Ticker {
- private Calendar m_cal;
- private int m_tickField = Calendar.MINUTE;
-
- /**
- * create a ticker with {@link Calendar#MINUTE} interval
- */
- public Ticker() {
- this(Calendar.MINUTE);
- }
-
- /**
- * @param tickMode
- * one of {@link Calendar#DATE} {@link Calendar#HOUR_OF_DAY} {@link Calendar#MINUTE} {@link Calendar#SECOND}
- */
- public Ticker(int tickMode) {
- m_cal = Calendar.getInstance();
- setTickMode(tickMode);
- }
-
- /**
- * create a copy of a ticker
- */
- public Ticker(Ticker other) {
- setTickMode(other.getTickMode());
- setTime(other.getTime());
- }
-
- /**
- * @param calendarField
- * one of {@link Calendar#DATE} {@link Calendar#HOUR_OF_DAY} {@link Calendar#MINUTE} {@link Calendar#SECOND}
- */
- public void setTickMode(int calendarField) {
- switch (calendarField) {
- case Calendar.DATE:
- case Calendar.HOUR_OF_DAY:
- case Calendar.MINUTE:
- case Calendar.SECOND: {
- m_tickField = calendarField;
- break;
- }
- default: {
- throw new IllegalArgumentException("tickMode must be one of: Calendar.DATE,Calendar.HOUR_OF_DAY, Calendar.MINUTE, Calendar.SECOND");
- }
- }
- adjustTime();
- }
-
- /**
- * one of {@link Calendar#DATE} {@link Calendar#HOUR_OF_DAY} {@link Calendar#MINUTE} {@link Calendar#SECOND}
- */
- public int getTickMode() {
- return m_tickField;
- }
-
- public void setTime(long time) {
- m_cal.setTimeInMillis(time);
- adjustTime();
- }
-
- private void adjustTime() {
- switch (m_tickField) {
- case Calendar.DATE: {
- m_cal.set(Calendar.HOUR_OF_DAY, 0);
- m_cal.set(Calendar.HOUR, 0);
- m_cal.set(Calendar.MINUTE, 0);
- m_cal.set(Calendar.SECOND, 0);
- m_cal.set(Calendar.MILLISECOND, 0);
- break;
- }
- case Calendar.HOUR_OF_DAY: {
- m_cal.set(Calendar.MINUTE, 0);
- m_cal.set(Calendar.SECOND, 0);
- m_cal.set(Calendar.MILLISECOND, 0);
- break;
- }
- case Calendar.MINUTE: {
- m_cal.set(Calendar.SECOND, 0);
- m_cal.set(Calendar.MILLISECOND, 0);
- break;
- }
- case Calendar.SECOND: {
- m_cal.set(Calendar.MILLISECOND, 0);
- break;
- }
- }
- }
-
- /**
- * Wait for next tick
- */
- public TickSignal waitForNextTick() {
- Calendar nextCal = new GregorianCalendar();
- nextCal.setTime(m_cal.getTime());
- nextCal.add(m_tickField, 1);
- // wait until this tick is reached
- long t = nextCal.getTimeInMillis();
- long dt = t - System.currentTimeMillis();
- while (dt > 0) {
- try {
- Thread.sleep(Math.min(dt, 15000));
- }
- catch (InterruptedException ie) {
- }
- dt = t - System.currentTimeMillis();
- }
- // apply next time
- m_cal.add(m_tickField, 1);
- return getCurrentTick();
- }
-
- public long getTime() {
- return m_cal.getTimeInMillis();
- }
-
- public TickSignal getCurrentTick() {
- return new TickSignal(
- m_cal.get(Calendar.SECOND),
- m_cal.get(Calendar.MINUTE),
- m_cal.get(Calendar.HOUR_OF_DAY),
- ((7 + m_cal.get(Calendar.DAY_OF_WEEK) - Calendar.MONDAY) % 7) + 1,
- m_cal.get(Calendar.DAY_OF_MONTH),
- m_cal.getActualMaximum(Calendar.DAY_OF_MONTH) - m_cal.get(Calendar.DAY_OF_MONTH),
- m_cal.get(Calendar.DAY_OF_YEAR),
- m_cal.get(Calendar.WEEK_OF_YEAR),
- ((12 + m_cal.get(Calendar.MONTH) - Calendar.JANUARY) % 12) + 1,
- m_cal.get(Calendar.YEAR));
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.scheduler;
+
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+
+public class Ticker {
+ private Calendar m_cal;
+ private int m_tickField = Calendar.MINUTE;
+
+ /**
+ * create a ticker with {@link Calendar#MINUTE} interval
+ */
+ public Ticker() {
+ this(Calendar.MINUTE);
+ }
+
+ /**
+ * @param tickMode
+ * one of {@link Calendar#DATE} {@link Calendar#HOUR_OF_DAY} {@link Calendar#MINUTE} {@link Calendar#SECOND}
+ */
+ public Ticker(int tickMode) {
+ m_cal = Calendar.getInstance();
+ setTickMode(tickMode);
+ }
+
+ /**
+ * create a copy of a ticker
+ */
+ public Ticker(Ticker other) {
+ setTickMode(other.getTickMode());
+ setTime(other.getTime());
+ }
+
+ /**
+ * @param calendarField
+ * one of {@link Calendar#DATE} {@link Calendar#HOUR_OF_DAY} {@link Calendar#MINUTE} {@link Calendar#SECOND}
+ */
+ public void setTickMode(int calendarField) {
+ switch (calendarField) {
+ case Calendar.DATE:
+ case Calendar.HOUR_OF_DAY:
+ case Calendar.MINUTE:
+ case Calendar.SECOND: {
+ m_tickField = calendarField;
+ break;
+ }
+ default: {
+ throw new IllegalArgumentException("tickMode must be one of: Calendar.DATE,Calendar.HOUR_OF_DAY, Calendar.MINUTE, Calendar.SECOND");
+ }
+ }
+ adjustTime();
+ }
+
+ /**
+ * one of {@link Calendar#DATE} {@link Calendar#HOUR_OF_DAY} {@link Calendar#MINUTE} {@link Calendar#SECOND}
+ */
+ public int getTickMode() {
+ return m_tickField;
+ }
+
+ public void setTime(long time) {
+ m_cal.setTimeInMillis(time);
+ adjustTime();
+ }
+
+ private void adjustTime() {
+ switch (m_tickField) {
+ case Calendar.DATE: {
+ m_cal.set(Calendar.HOUR_OF_DAY, 0);
+ m_cal.set(Calendar.HOUR, 0);
+ m_cal.set(Calendar.MINUTE, 0);
+ m_cal.set(Calendar.SECOND, 0);
+ m_cal.set(Calendar.MILLISECOND, 0);
+ break;
+ }
+ case Calendar.HOUR_OF_DAY: {
+ m_cal.set(Calendar.MINUTE, 0);
+ m_cal.set(Calendar.SECOND, 0);
+ m_cal.set(Calendar.MILLISECOND, 0);
+ break;
+ }
+ case Calendar.MINUTE: {
+ m_cal.set(Calendar.SECOND, 0);
+ m_cal.set(Calendar.MILLISECOND, 0);
+ break;
+ }
+ case Calendar.SECOND: {
+ m_cal.set(Calendar.MILLISECOND, 0);
+ break;
+ }
+ }
+ }
+
+ /**
+ * Wait for next tick
+ */
+ public TickSignal waitForNextTick() {
+ Calendar nextCal = new GregorianCalendar();
+ nextCal.setTime(m_cal.getTime());
+ nextCal.add(m_tickField, 1);
+ // wait until this tick is reached
+ long t = nextCal.getTimeInMillis();
+ long dt = t - System.currentTimeMillis();
+ while (dt > 0) {
+ try {
+ Thread.sleep(Math.min(dt, 15000));
+ }
+ catch (InterruptedException ie) {
+ }
+ dt = t - System.currentTimeMillis();
+ }
+ // apply next time
+ m_cal.add(m_tickField, 1);
+ return getCurrentTick();
+ }
+
+ public long getTime() {
+ return m_cal.getTimeInMillis();
+ }
+
+ public TickSignal getCurrentTick() {
+ return new TickSignal(
+ m_cal.get(Calendar.SECOND),
+ m_cal.get(Calendar.MINUTE),
+ m_cal.get(Calendar.HOUR_OF_DAY),
+ ((7 + m_cal.get(Calendar.DAY_OF_WEEK) - Calendar.MONDAY) % 7) + 1,
+ m_cal.get(Calendar.DAY_OF_MONTH),
+ m_cal.getActualMaximum(Calendar.DAY_OF_MONTH) - m_cal.get(Calendar.DAY_OF_MONTH),
+ m_cal.get(Calendar.DAY_OF_YEAR),
+ m_cal.get(Calendar.WEEK_OF_YEAR),
+ ((12 + m_cal.get(Calendar.MONTH) - Calendar.JANUARY) % 12) + 1,
+ m_cal.get(Calendar.YEAR));
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/FormulaParser.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/FormulaParser.java
index a115584288..1639cfb385 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/FormulaParser.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/FormulaParser.java
@@ -1,580 +1,580 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.scheduler.internal;
-
-import java.text.ParseException;
-import java.text.ParsePosition;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.server.scheduler.internal.node.ArgRef;
-import org.eclipse.scout.rt.server.scheduler.internal.node.BooleanAtom;
-import org.eclipse.scout.rt.server.scheduler.internal.node.FormulaRoot;
-import org.eclipse.scout.rt.server.scheduler.internal.node.INode;
-import org.eclipse.scout.rt.server.scheduler.internal.node.IntegerAtom;
-import org.eclipse.scout.rt.server.scheduler.internal.node.NotToken;
-import org.eclipse.scout.rt.server.scheduler.internal.node.NullAtom;
-import org.eclipse.scout.rt.server.scheduler.internal.node.Op;
-import org.eclipse.scout.rt.server.scheduler.internal.node.SignalRef;
-import org.eclipse.scout.rt.server.scheduler.internal.node.StringAtom;
-import org.eclipse.scout.rt.server.scheduler.internal.node.WrappedToken;
-
-/**
- * Parser for dynamic formulas
- * Syntax (EBNF):
- * token=token0 = token1 (S? op1 S? token1)* .
- * token1 = token2 (S? op2 S? token2)* .
- * token2 = token3 (S? op3 S? token3)* .
- * token3 = token4 (S? op4 S? token4)* .
- * token4 = token5 (S? op5 S? token5)* .
- * token5 = atom .
- * op1 = '&&' | '||' .
- * op2 = '==' | '<=' | '>=' | '<>' | '!=' | '<' | '>'.
- * op3 = '+' | '-' .
- * op4 = '*' | '/' | '%' .
- * op5 = '^' | '.' | '&' | '|' | '<<' | '>>'.
- * atom = wrapped-token | not-token | null-atom | int-atom | boolean-atom | string-atom | signal-ref | arg-ref .
- * wrapped-token = '(' S? token S? ')' .
- * not-token = '!' token .
- * null-atom = 'null' .
- * int-atom = [+-]? [0-9]* [.]? [0-9]* .
- * boolean-atom = 'true' | 'false' .
- * string-atom = `'` [^delim]* `'` | `"` [^delim]* `"` . NOTE: delim is the delimiting character
- * signal-ref = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year' | 'dayOfWeek' | 'dayOfMonthReverse' | 'dayOfYear' | 'secondOfDay' .
- * arg-ref = 'arg' [0-9]+ .
- * S = ([ \n\t\r] | S_comment)+ .
- */
-
-public class FormulaParser {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(FormulaParser.class);
- private static final String S_MAP = " \n\t\r";
-
- private String str;
- private ParsePosition pos;
-
- public FormulaParser() {
- }
-
- public FormulaRoot parse(String formula) throws ParseException {
- str = formula;
- if (str != null) {
- str = str.trim();
- }
- FormulaRoot root;
- if (str == null || str.length() == 0) {
- root = new FormulaRoot(new NullAtom());
- }
- else {
- // parse not-empty string
- pos = new ParsePosition(0);
- try {
- INode t = parseToken(0);
- if (t == null) {
- throw new ParseException("no node parsed", pos.getIndex());
- }
- if (pos.getIndex() < str.length()) {
- throw new ParseException("formula not fully parsed (index " + pos.getIndex() + " of " + str.length() + ") : " + formula, pos.getIndex());
- }
- root = new FormulaRoot(t);
- }
- catch (ParseException ce) {
- throw ce;
- }
- catch (Exception other) {
- LOG.error(null, other);
- throw new ParseException("unexpected exception: " + other, pos.getIndex());
- }
- }
- return root;
- }
-
- private INode parseToken(int level) throws ParseException {
- if (level >= 5) {
- return parseAtom();
- }
- INode leftToken;
- if ((leftToken = parseToken(level + 1)) != null) {
- int save = pos.getIndex();
- String op;
- INode rightToken;
- while (parseWhitespace(0) && (op = parseOp(level + 1)) != null && parseWhitespace(0) && (rightToken = parseToken(level + 1)) != null) {
- if (op.equals("&&")) {
- leftToken = new Op.And(leftToken, rightToken);
- }
- else if (op.equals("||")) {
- leftToken = new Op.Or(leftToken, rightToken);// OR or CONCAT
- }
- else if (op.equals("==")) {
- leftToken = new Op.Equal(leftToken, rightToken);
- }
- else if (op.equals("<=")) {
- leftToken = new Op.LessThanOrEqual(leftToken, rightToken);
- }
- else if (op.equals(">=")) {
- leftToken = new Op.GreaterThanOrEqual(leftToken, rightToken);
- }
- else if (op.equals("<>") || op.equals("!=")) {
- leftToken = new Op.NotEqual(leftToken, rightToken);
- }
- else if (op.equals("<")) {
- leftToken = new Op.LessThan(leftToken, rightToken);
- }
- else if (op.equals(">")) {
- leftToken = new Op.GreaterThan(leftToken, rightToken);
- }
- else if (op.equals("+")) {
- leftToken = new Op.Add(leftToken, rightToken);
- }
- else if (op.equals("-")) {
- leftToken = new Op.Sub(leftToken, rightToken);
- }
- else if (op.equals("*")) {
- leftToken = new Op.Mul(leftToken, rightToken);
- }
- else if (op.equals("/")) {
- leftToken = new Op.Div(leftToken, rightToken);
- }
- else if (op.equals("%")) {
- leftToken = new Op.Mod(leftToken, rightToken);
- }
- else if (op.equals("^")) {// Build 177
- leftToken = new Op.BitXor(leftToken, rightToken);
- }
- else if (op.equals("|")) {// Build 177
- leftToken = new Op.BitOr(leftToken, rightToken);
- }
- else if (op.equals("&")) {// Build 177
- leftToken = new Op.BitAnd(leftToken, rightToken);
- }
- else if (op.equals("<<")) {// Build 177
- leftToken = new Op.BitShiftLeft(leftToken, rightToken);
- }
- else if (op.equals(">>")) {// Build 177
- leftToken = new Op.BitShiftRight(leftToken, rightToken);
- }
- else if (op.equals(">>>")) {// Build 206
- leftToken = new Op.BitShiftRightZeroExtending(leftToken, rightToken);
- }
- else {
- throw new ParseException("unexpected operation " + op, pos.getIndex());
- }
- //
- save = pos.getIndex();
- }// end while
- pos.setIndex(save);
- return leftToken;
- }// end if parse token of next level
- // failed
- return null;
- }
-
- private String parseOp(int level) throws ParseException {
- int index = pos.getIndex();
- if (matches("&&") || matches("||") || matches("==") || matches("<=") || matches(">=") || matches("<>") || matches("!=") || matches("<<") || matches(">>") || matches("<") || matches(">") || matches("+") || matches("-") || matches("*") || matches("/") || matches("%") || matches("^") || matches("&") || matches("|")) {
- // ok,found op, valid in current level ?
- String op = str.substring(index, pos.getIndex());
- if (level == 1) {
- if (op.equals("&&")) {
- return op;
- }
- else if (op.equals("||")) {
- return op;
- }
- else {
- return null;
- }
- }
- else if (level == 2) {
- if (op.equals("==")) {
- return op;
- }
- else if (op.equals("<=")) {
- return op;
- }
- else if (op.equals(">=")) {
- return op;
- }
- else if (op.equals("<>")) {
- return op;
- }
- else if (op.equals("!=")) {
- return op;
- }
- else if (op.equals("<")) {
- return op;
- }
- else if (op.equals(">")) {
- return op;
- }
- else {
- return null;
- }
- }
- else if (level == 3) {
- if (op.equals("+")) {
- return op;
- }
- else if (op.equals("-")) {
- return op;
- }
- else {
- return null;
- }
- }
- else if (level == 4) {
- if (op.equals("*")) {
- return op;
- }
- else if (op.equals("/")) {
- return op;
- }
- else if (op.equals("%")) {
- return op;
- }
- else {
- return null;
- }
- }
- else if (level == 5) {
- if (op.equals("^")) {
- return op;
- }
- else if (op.equals("&")) {
- return op;
- }
- else if (op.equals("|")) {
- return op;
- }
- else if (op.equals("<<")) {
- return op;
- }
- else if (op.equals(">>")) {
- return op;
- }
- return null;
- }
- else {
- throw new ParseException("invalid op level " + level, pos.getIndex());
- }
- }
- else {
- return null;
- }
- }
-
- private INode parseAtom() throws ParseException {
- INode cmd;
- if ((cmd = parseWrappedToken()) != null) {
- return cmd;
- }
- if ((cmd = parseNotToken()) != null) {
- return cmd;
- }
- if ((cmd = parseNullAtom()) != null) {
- return cmd;
- }
- if ((cmd = parseIntegerAtom()) != null) {
- return cmd;
- }
- if ((cmd = parseBooleanAtom()) != null) {
- return cmd;
- }
- if ((cmd = parseStringAtom()) != null) {
- return cmd;
- }
- if ((cmd = parseSignalRef()) != null) {
- return cmd;
- }
- if ((cmd = parseArgRef()) != null) {
- return cmd;
- }
- else {
- // failed
- return null;
- }
- }
-
- private WrappedToken parseWrappedToken() throws ParseException {
- int index = pos.getIndex();
- INode node = null;
- if (matches("(") && parseWhitespace(0) && (node = parseToken(0)) != null && parseWhitespace(0) && matches(")")) {
- return new WrappedToken(node);
- }
- pos.setIndex(index);
- return null;
- }
-
- private NotToken parseNotToken() throws ParseException {
- int index = pos.getIndex();
- INode node = null;
- if (matches("!") && parseWhitespace(0) && (node = parseToken(0)) != null) {
- return new NotToken(node);
- }
- pos.setIndex(index);
- return null;
- }
-
- private NullAtom parseNullAtom() {
- int index = pos.getIndex();
- String name = parseName();
- if (name != null && name.equalsIgnoreCase("null")) {
- return new NullAtom();
- }
- pos.setIndex(index);
- return null;
- }
-
- private IntegerAtom parseIntegerAtom() throws ParseException {
- int index = pos.getIndex();
- int len = str.length();
- int i = index;
- if (matches("+") || matches("-")) {
- i++;
- }
- while (i < len && Character.isDigit(str.charAt(i))) {
- i++;
- }
- if (i < len && str.charAt(i) == '.') {
- i++;
- while (i < len && Character.isDigit(str.charAt(i))) {
- i++;
- }
- }
- if (i > index) {
- pos.setIndex(i);
- String s = str.substring(index, pos.getIndex());
- s = s.trim();
- if (s.startsWith("+")) {
- s = s.substring(1);
- }
- if (s.indexOf(".") >= 0) {
- throw new ParseException("only supporting integer numbers: " + s, index);
- }
- else {
- return new IntegerAtom(new Integer(s));
- }
- }
- return null;
- }
-
- private BooleanAtom parseBooleanAtom() {
- int index = pos.getIndex();
- String name = parseName();
- if (name != null) {
- if (name.equalsIgnoreCase("true")) {
- return new BooleanAtom(true);
- }
- else if (name.equalsIgnoreCase("false")) {
- return new BooleanAtom(false);
- }
- }
- pos.setIndex(index);
- return null;
- }
-
- private StringAtom parseStringAtom() throws ParseException {
- int index = pos.getIndex();
- if (matches("'") || matches("\"")) {
- char delimChar = str.charAt(index);
- StringBuffer text = new StringBuffer();
- char ch;
- while ((ch = parseChar(delimChar)) != 0x00) {
- text.append(ch);
- }
- if (matches("" + delimChar)) {
- return new StringAtom(text.toString());
- }
- else {
- throw new ParseException("unclosed string; expected delimChar " + delimChar, pos.getIndex());
- }
- }
- pos.setIndex(index);
- return null;
- }
-
- private SignalRef parseSignalRef() throws ParseException {
- int index = pos.getIndex();
- String name = parseName();
- if (name != null) {
- if (name.equalsIgnoreCase("second")) {
- return new SignalRef(SignalRef.SECOND);
- }
- else if (name.equalsIgnoreCase("minute")) {
- return new SignalRef(SignalRef.MINUTE);
- }
- else if (name.equalsIgnoreCase("hour")) {
- return new SignalRef(SignalRef.HOUR);
- }
- else if (name.equalsIgnoreCase("day")) {
- return new SignalRef(SignalRef.DAY);
- }
- else if (name.equalsIgnoreCase("week")) {
- return new SignalRef(SignalRef.WEEK);
- }
- else if (name.equalsIgnoreCase("month")) {
- return new SignalRef(SignalRef.MONTH);
- }
- else if (name.equalsIgnoreCase("year")) {
- return new SignalRef(SignalRef.YEAR);
- }
- else if (name.equalsIgnoreCase("dayOfWeek")) {
- return new SignalRef(SignalRef.DAY_OF_WEEK);
- }
- else if (name.equalsIgnoreCase("dayOfMonthReverse")) {
- return new SignalRef(SignalRef.DAY_OF_MONTH_REVERSE);
- }
- else if (name.equalsIgnoreCase("dayOfYear")) {
- return new SignalRef(SignalRef.DAY_OF_YEAR);
- }
- else if (name.equalsIgnoreCase("secondOfDay")) {
- return new SignalRef(SignalRef.SECOND_OF_DAY);
- }
- }
- pos.setIndex(index);
- return null;
- }
-
- private ArgRef parseArgRef() throws ParseException {
- int index = pos.getIndex();
- String name = parseName();
- if (name != null) {
- name = name.toLowerCase();
- Matcher mat = Pattern.compile("arg([0-9]+)").matcher(name.toLowerCase());
- if (mat.matches()) {
- return new ArgRef(Integer.parseInt(mat.group(1)));
- }
- }
- pos.setIndex(index);
- return null;
- }
-
- private String parseName() {
- int index = pos.getIndex();
- int len = str.length();
- int i = index;
- if (i < len && Character.isJavaIdentifierStart(str.charAt(i))) {
- i++;
- while (i < len && (Character.isJavaIdentifierPart(str.charAt(i)))) {
- i++;
- }
- }
- if (i > index) {
- pos.setIndex(i);
- return str.substring(index, pos.getIndex());
- }
- else {
- pos.setIndex(index);
- return null;
- }
- }
-
- private char parseChar(char quoteChar) {
- try {
- String notCharacterMap = "\\";
- if (quoteChar != 0x00) {
- notCharacterMap += quoteChar;
- }
- int index = pos.getIndex();
- int len = str.length();
- if (index >= len) {
- return 0x00;
- }
- char ch = str.charAt(index);
- if (index < len && notCharacterMap.indexOf(ch) < 0) {// regular character
- pos.setIndex(index + 1);
- return ch;
- }
- else if (index + 1 < len && ch == '\\') { // escaped character
- pos.setIndex(index + 2);
- ch = str.charAt(index + 1);
- // unesc some characters
- switch (ch) {
- case 'b': {
- ch = '\b';
- break;
- }
- case 't': {
- ch = '\t';
- break;
- }
- case 'n': {
- ch = '\n';
- break;
- }
- case 'f': {
- ch = '\f';
- break;
- }
- case 'r': {
- ch = '\r';
- break;
- }
- }
- return ch;
- }
- else {
- return 0x00;
- }
- }
- finally {
-
- }
- }
-
- private boolean matches(String m) {
- int index = pos.getIndex();
- int len = m.length();
- if (index + len <= str.length() && m.equalsIgnoreCase(str.substring(index, index + len))) {
- pos.setIndex(index + len);
- return true;
- }
- else {
- return false;
- }
- }
-
- private boolean parseWhitespace(int numRequired) throws ParseException {
- int index = pos.getIndex();
- int len = str.length();
- int i = index;
- // white
- while (i < len && S_MAP.indexOf(str.charAt(i)) >= 0) {
- i++;
- }
- // comment?
- while (i + 1 < len && str.charAt(i) == '/' && str.charAt(i + 1) == '*') {
- i = i + 2;
- int end = str.indexOf("*/", i);
- if (end < 0) {
- throw new ParseException("missing comment end: */", i);
- }
- String text = str.substring(i, end).trim();
- if (text.length() > 0) {
- // found comment
- }
- i = end + 2;
- // white
- while (i < len && S_MAP.indexOf(str.charAt(i)) >= 0) {
- i++;
- }
- }
- if (i - index >= numRequired) {
- pos.setIndex(i);
- return true;
- }
- else {
- return false;
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.scheduler.internal;
+
+import java.text.ParseException;
+import java.text.ParsePosition;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.server.scheduler.internal.node.ArgRef;
+import org.eclipse.scout.rt.server.scheduler.internal.node.BooleanAtom;
+import org.eclipse.scout.rt.server.scheduler.internal.node.FormulaRoot;
+import org.eclipse.scout.rt.server.scheduler.internal.node.INode;
+import org.eclipse.scout.rt.server.scheduler.internal.node.IntegerAtom;
+import org.eclipse.scout.rt.server.scheduler.internal.node.NotToken;
+import org.eclipse.scout.rt.server.scheduler.internal.node.NullAtom;
+import org.eclipse.scout.rt.server.scheduler.internal.node.Op;
+import org.eclipse.scout.rt.server.scheduler.internal.node.SignalRef;
+import org.eclipse.scout.rt.server.scheduler.internal.node.StringAtom;
+import org.eclipse.scout.rt.server.scheduler.internal.node.WrappedToken;
+
+/**
+ * Parser for dynamic formulas
+ * Syntax (EBNF):
+ * token=token0 = token1 (S? op1 S? token1)* .
+ * token1 = token2 (S? op2 S? token2)* .
+ * token2 = token3 (S? op3 S? token3)* .
+ * token3 = token4 (S? op4 S? token4)* .
+ * token4 = token5 (S? op5 S? token5)* .
+ * token5 = atom .
+ * op1 = '&&' | '||' .
+ * op2 = '==' | '<=' | '>=' | '<>' | '!=' | '<' | '>'.
+ * op3 = '+' | '-' .
+ * op4 = '*' | '/' | '%' .
+ * op5 = '^' | '.' | '&' | '|' | '<<' | '>>'.
+ * atom = wrapped-token | not-token | null-atom | int-atom | boolean-atom | string-atom | signal-ref | arg-ref .
+ * wrapped-token = '(' S? token S? ')' .
+ * not-token = '!' token .
+ * null-atom = 'null' .
+ * int-atom = [+-]? [0-9]* [.]? [0-9]* .
+ * boolean-atom = 'true' | 'false' .
+ * string-atom = `'` [^delim]* `'` | `"` [^delim]* `"` . NOTE: delim is the delimiting character
+ * signal-ref = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year' | 'dayOfWeek' | 'dayOfMonthReverse' | 'dayOfYear' | 'secondOfDay' .
+ * arg-ref = 'arg' [0-9]+ .
+ * S = ([ \n\t\r] | S_comment)+ .
+ */
+
+public class FormulaParser {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(FormulaParser.class);
+ private static final String S_MAP = " \n\t\r";
+
+ private String str;
+ private ParsePosition pos;
+
+ public FormulaParser() {
+ }
+
+ public FormulaRoot parse(String formula) throws ParseException {
+ str = formula;
+ if (str != null) {
+ str = str.trim();
+ }
+ FormulaRoot root;
+ if (str == null || str.length() == 0) {
+ root = new FormulaRoot(new NullAtom());
+ }
+ else {
+ // parse not-empty string
+ pos = new ParsePosition(0);
+ try {
+ INode t = parseToken(0);
+ if (t == null) {
+ throw new ParseException("no node parsed", pos.getIndex());
+ }
+ if (pos.getIndex() < str.length()) {
+ throw new ParseException("formula not fully parsed (index " + pos.getIndex() + " of " + str.length() + ") : " + formula, pos.getIndex());
+ }
+ root = new FormulaRoot(t);
+ }
+ catch (ParseException ce) {
+ throw ce;
+ }
+ catch (Exception other) {
+ LOG.error(null, other);
+ throw new ParseException("unexpected exception: " + other, pos.getIndex());
+ }
+ }
+ return root;
+ }
+
+ private INode parseToken(int level) throws ParseException {
+ if (level >= 5) {
+ return parseAtom();
+ }
+ INode leftToken;
+ if ((leftToken = parseToken(level + 1)) != null) {
+ int save = pos.getIndex();
+ String op;
+ INode rightToken;
+ while (parseWhitespace(0) && (op = parseOp(level + 1)) != null && parseWhitespace(0) && (rightToken = parseToken(level + 1)) != null) {
+ if (op.equals("&&")) {
+ leftToken = new Op.And(leftToken, rightToken);
+ }
+ else if (op.equals("||")) {
+ leftToken = new Op.Or(leftToken, rightToken);// OR or CONCAT
+ }
+ else if (op.equals("==")) {
+ leftToken = new Op.Equal(leftToken, rightToken);
+ }
+ else if (op.equals("<=")) {
+ leftToken = new Op.LessThanOrEqual(leftToken, rightToken);
+ }
+ else if (op.equals(">=")) {
+ leftToken = new Op.GreaterThanOrEqual(leftToken, rightToken);
+ }
+ else if (op.equals("<>") || op.equals("!=")) {
+ leftToken = new Op.NotEqual(leftToken, rightToken);
+ }
+ else if (op.equals("<")) {
+ leftToken = new Op.LessThan(leftToken, rightToken);
+ }
+ else if (op.equals(">")) {
+ leftToken = new Op.GreaterThan(leftToken, rightToken);
+ }
+ else if (op.equals("+")) {
+ leftToken = new Op.Add(leftToken, rightToken);
+ }
+ else if (op.equals("-")) {
+ leftToken = new Op.Sub(leftToken, rightToken);
+ }
+ else if (op.equals("*")) {
+ leftToken = new Op.Mul(leftToken, rightToken);
+ }
+ else if (op.equals("/")) {
+ leftToken = new Op.Div(leftToken, rightToken);
+ }
+ else if (op.equals("%")) {
+ leftToken = new Op.Mod(leftToken, rightToken);
+ }
+ else if (op.equals("^")) {// Build 177
+ leftToken = new Op.BitXor(leftToken, rightToken);
+ }
+ else if (op.equals("|")) {// Build 177
+ leftToken = new Op.BitOr(leftToken, rightToken);
+ }
+ else if (op.equals("&")) {// Build 177
+ leftToken = new Op.BitAnd(leftToken, rightToken);
+ }
+ else if (op.equals("<<")) {// Build 177
+ leftToken = new Op.BitShiftLeft(leftToken, rightToken);
+ }
+ else if (op.equals(">>")) {// Build 177
+ leftToken = new Op.BitShiftRight(leftToken, rightToken);
+ }
+ else if (op.equals(">>>")) {// Build 206
+ leftToken = new Op.BitShiftRightZeroExtending(leftToken, rightToken);
+ }
+ else {
+ throw new ParseException("unexpected operation " + op, pos.getIndex());
+ }
+ //
+ save = pos.getIndex();
+ }// end while
+ pos.setIndex(save);
+ return leftToken;
+ }// end if parse token of next level
+ // failed
+ return null;
+ }
+
+ private String parseOp(int level) throws ParseException {
+ int index = pos.getIndex();
+ if (matches("&&") || matches("||") || matches("==") || matches("<=") || matches(">=") || matches("<>") || matches("!=") || matches("<<") || matches(">>") || matches("<") || matches(">") || matches("+") || matches("-") || matches("*") || matches("/") || matches("%") || matches("^") || matches("&") || matches("|")) {
+ // ok,found op, valid in current level ?
+ String op = str.substring(index, pos.getIndex());
+ if (level == 1) {
+ if (op.equals("&&")) {
+ return op;
+ }
+ else if (op.equals("||")) {
+ return op;
+ }
+ else {
+ return null;
+ }
+ }
+ else if (level == 2) {
+ if (op.equals("==")) {
+ return op;
+ }
+ else if (op.equals("<=")) {
+ return op;
+ }
+ else if (op.equals(">=")) {
+ return op;
+ }
+ else if (op.equals("<>")) {
+ return op;
+ }
+ else if (op.equals("!=")) {
+ return op;
+ }
+ else if (op.equals("<")) {
+ return op;
+ }
+ else if (op.equals(">")) {
+ return op;
+ }
+ else {
+ return null;
+ }
+ }
+ else if (level == 3) {
+ if (op.equals("+")) {
+ return op;
+ }
+ else if (op.equals("-")) {
+ return op;
+ }
+ else {
+ return null;
+ }
+ }
+ else if (level == 4) {
+ if (op.equals("*")) {
+ return op;
+ }
+ else if (op.equals("/")) {
+ return op;
+ }
+ else if (op.equals("%")) {
+ return op;
+ }
+ else {
+ return null;
+ }
+ }
+ else if (level == 5) {
+ if (op.equals("^")) {
+ return op;
+ }
+ else if (op.equals("&")) {
+ return op;
+ }
+ else if (op.equals("|")) {
+ return op;
+ }
+ else if (op.equals("<<")) {
+ return op;
+ }
+ else if (op.equals(">>")) {
+ return op;
+ }
+ return null;
+ }
+ else {
+ throw new ParseException("invalid op level " + level, pos.getIndex());
+ }
+ }
+ else {
+ return null;
+ }
+ }
+
+ private INode parseAtom() throws ParseException {
+ INode cmd;
+ if ((cmd = parseWrappedToken()) != null) {
+ return cmd;
+ }
+ if ((cmd = parseNotToken()) != null) {
+ return cmd;
+ }
+ if ((cmd = parseNullAtom()) != null) {
+ return cmd;
+ }
+ if ((cmd = parseIntegerAtom()) != null) {
+ return cmd;
+ }
+ if ((cmd = parseBooleanAtom()) != null) {
+ return cmd;
+ }
+ if ((cmd = parseStringAtom()) != null) {
+ return cmd;
+ }
+ if ((cmd = parseSignalRef()) != null) {
+ return cmd;
+ }
+ if ((cmd = parseArgRef()) != null) {
+ return cmd;
+ }
+ else {
+ // failed
+ return null;
+ }
+ }
+
+ private WrappedToken parseWrappedToken() throws ParseException {
+ int index = pos.getIndex();
+ INode node = null;
+ if (matches("(") && parseWhitespace(0) && (node = parseToken(0)) != null && parseWhitespace(0) && matches(")")) {
+ return new WrappedToken(node);
+ }
+ pos.setIndex(index);
+ return null;
+ }
+
+ private NotToken parseNotToken() throws ParseException {
+ int index = pos.getIndex();
+ INode node = null;
+ if (matches("!") && parseWhitespace(0) && (node = parseToken(0)) != null) {
+ return new NotToken(node);
+ }
+ pos.setIndex(index);
+ return null;
+ }
+
+ private NullAtom parseNullAtom() {
+ int index = pos.getIndex();
+ String name = parseName();
+ if (name != null && name.equalsIgnoreCase("null")) {
+ return new NullAtom();
+ }
+ pos.setIndex(index);
+ return null;
+ }
+
+ private IntegerAtom parseIntegerAtom() throws ParseException {
+ int index = pos.getIndex();
+ int len = str.length();
+ int i = index;
+ if (matches("+") || matches("-")) {
+ i++;
+ }
+ while (i < len && Character.isDigit(str.charAt(i))) {
+ i++;
+ }
+ if (i < len && str.charAt(i) == '.') {
+ i++;
+ while (i < len && Character.isDigit(str.charAt(i))) {
+ i++;
+ }
+ }
+ if (i > index) {
+ pos.setIndex(i);
+ String s = str.substring(index, pos.getIndex());
+ s = s.trim();
+ if (s.startsWith("+")) {
+ s = s.substring(1);
+ }
+ if (s.indexOf(".") >= 0) {
+ throw new ParseException("only supporting integer numbers: " + s, index);
+ }
+ else {
+ return new IntegerAtom(new Integer(s));
+ }
+ }
+ return null;
+ }
+
+ private BooleanAtom parseBooleanAtom() {
+ int index = pos.getIndex();
+ String name = parseName();
+ if (name != null) {
+ if (name.equalsIgnoreCase("true")) {
+ return new BooleanAtom(true);
+ }
+ else if (name.equalsIgnoreCase("false")) {
+ return new BooleanAtom(false);
+ }
+ }
+ pos.setIndex(index);
+ return null;
+ }
+
+ private StringAtom parseStringAtom() throws ParseException {
+ int index = pos.getIndex();
+ if (matches("'") || matches("\"")) {
+ char delimChar = str.charAt(index);
+ StringBuffer text = new StringBuffer();
+ char ch;
+ while ((ch = parseChar(delimChar)) != 0x00) {
+ text.append(ch);
+ }
+ if (matches("" + delimChar)) {
+ return new StringAtom(text.toString());
+ }
+ else {
+ throw new ParseException("unclosed string; expected delimChar " + delimChar, pos.getIndex());
+ }
+ }
+ pos.setIndex(index);
+ return null;
+ }
+
+ private SignalRef parseSignalRef() throws ParseException {
+ int index = pos.getIndex();
+ String name = parseName();
+ if (name != null) {
+ if (name.equalsIgnoreCase("second")) {
+ return new SignalRef(SignalRef.SECOND);
+ }
+ else if (name.equalsIgnoreCase("minute")) {
+ return new SignalRef(SignalRef.MINUTE);
+ }
+ else if (name.equalsIgnoreCase("hour")) {
+ return new SignalRef(SignalRef.HOUR);
+ }
+ else if (name.equalsIgnoreCase("day")) {
+ return new SignalRef(SignalRef.DAY);
+ }
+ else if (name.equalsIgnoreCase("week")) {
+ return new SignalRef(SignalRef.WEEK);
+ }
+ else if (name.equalsIgnoreCase("month")) {
+ return new SignalRef(SignalRef.MONTH);
+ }
+ else if (name.equalsIgnoreCase("year")) {
+ return new SignalRef(SignalRef.YEAR);
+ }
+ else if (name.equalsIgnoreCase("dayOfWeek")) {
+ return new SignalRef(SignalRef.DAY_OF_WEEK);
+ }
+ else if (name.equalsIgnoreCase("dayOfMonthReverse")) {
+ return new SignalRef(SignalRef.DAY_OF_MONTH_REVERSE);
+ }
+ else if (name.equalsIgnoreCase("dayOfYear")) {
+ return new SignalRef(SignalRef.DAY_OF_YEAR);
+ }
+ else if (name.equalsIgnoreCase("secondOfDay")) {
+ return new SignalRef(SignalRef.SECOND_OF_DAY);
+ }
+ }
+ pos.setIndex(index);
+ return null;
+ }
+
+ private ArgRef parseArgRef() throws ParseException {
+ int index = pos.getIndex();
+ String name = parseName();
+ if (name != null) {
+ name = name.toLowerCase();
+ Matcher mat = Pattern.compile("arg([0-9]+)").matcher(name.toLowerCase());
+ if (mat.matches()) {
+ return new ArgRef(Integer.parseInt(mat.group(1)));
+ }
+ }
+ pos.setIndex(index);
+ return null;
+ }
+
+ private String parseName() {
+ int index = pos.getIndex();
+ int len = str.length();
+ int i = index;
+ if (i < len && Character.isJavaIdentifierStart(str.charAt(i))) {
+ i++;
+ while (i < len && (Character.isJavaIdentifierPart(str.charAt(i)))) {
+ i++;
+ }
+ }
+ if (i > index) {
+ pos.setIndex(i);
+ return str.substring(index, pos.getIndex());
+ }
+ else {
+ pos.setIndex(index);
+ return null;
+ }
+ }
+
+ private char parseChar(char quoteChar) {
+ try {
+ String notCharacterMap = "\\";
+ if (quoteChar != 0x00) {
+ notCharacterMap += quoteChar;
+ }
+ int index = pos.getIndex();
+ int len = str.length();
+ if (index >= len) {
+ return 0x00;
+ }
+ char ch = str.charAt(index);
+ if (index < len && notCharacterMap.indexOf(ch) < 0) {// regular character
+ pos.setIndex(index + 1);
+ return ch;
+ }
+ else if (index + 1 < len && ch == '\\') { // escaped character
+ pos.setIndex(index + 2);
+ ch = str.charAt(index + 1);
+ // unesc some characters
+ switch (ch) {
+ case 'b': {
+ ch = '\b';
+ break;
+ }
+ case 't': {
+ ch = '\t';
+ break;
+ }
+ case 'n': {
+ ch = '\n';
+ break;
+ }
+ case 'f': {
+ ch = '\f';
+ break;
+ }
+ case 'r': {
+ ch = '\r';
+ break;
+ }
+ }
+ return ch;
+ }
+ else {
+ return 0x00;
+ }
+ }
+ finally {
+
+ }
+ }
+
+ private boolean matches(String m) {
+ int index = pos.getIndex();
+ int len = m.length();
+ if (index + len <= str.length() && m.equalsIgnoreCase(str.substring(index, index + len))) {
+ pos.setIndex(index + len);
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+
+ private boolean parseWhitespace(int numRequired) throws ParseException {
+ int index = pos.getIndex();
+ int len = str.length();
+ int i = index;
+ // white
+ while (i < len && S_MAP.indexOf(str.charAt(i)) >= 0) {
+ i++;
+ }
+ // comment?
+ while (i + 1 < len && str.charAt(i) == '/' && str.charAt(i + 1) == '*') {
+ i = i + 2;
+ int end = str.indexOf("*/", i);
+ if (end < 0) {
+ throw new ParseException("missing comment end: */", i);
+ }
+ String text = str.substring(i, end).trim();
+ if (text.length() > 0) {
+ // found comment
+ }
+ i = end + 2;
+ // white
+ while (i < len && S_MAP.indexOf(str.charAt(i)) >= 0) {
+ i++;
+ }
+ }
+ if (i - index >= numRequired) {
+ pos.setIndex(i);
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/SchedulingFormula.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/SchedulingFormula.java
index e273b43c31..67b1cd9706 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/SchedulingFormula.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/SchedulingFormula.java
@@ -1,38 +1,38 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.scheduler.internal;
-
-import org.eclipse.scout.rt.server.scheduler.ISchedulingFormula;
-import org.eclipse.scout.rt.server.scheduler.TickSignal;
-import org.eclipse.scout.rt.server.scheduler.internal.node.FormulaRoot;
-import org.eclipse.scout.rt.server.scheduler.internal.visitor.DefaultEvalVisitor;
-import org.eclipse.scout.rt.server.scheduler.internal.visitor.DefaultFormatVisitor;
-
-public class SchedulingFormula implements ISchedulingFormula {
- private FormulaRoot m_root;
-
- public SchedulingFormula(FormulaRoot root) {
- m_root = root;
- }
-
- @Override
- public boolean eval(TickSignal signal, Object[] args) {
- DefaultEvalVisitor v = new DefaultEvalVisitor(signal, args);
- return v.toBoolean(m_root.eval(v));
- }
-
- @Override
- public String toString() {
- DefaultFormatVisitor v = new DefaultFormatVisitor();
- m_root.format(v);
- return v.getText();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.scheduler.internal;
+
+import org.eclipse.scout.rt.server.scheduler.ISchedulingFormula;
+import org.eclipse.scout.rt.server.scheduler.TickSignal;
+import org.eclipse.scout.rt.server.scheduler.internal.node.FormulaRoot;
+import org.eclipse.scout.rt.server.scheduler.internal.visitor.DefaultEvalVisitor;
+import org.eclipse.scout.rt.server.scheduler.internal.visitor.DefaultFormatVisitor;
+
+public class SchedulingFormula implements ISchedulingFormula {
+ private FormulaRoot m_root;
+
+ public SchedulingFormula(FormulaRoot root) {
+ m_root = root;
+ }
+
+ @Override
+ public boolean eval(TickSignal signal, Object[] args) {
+ DefaultEvalVisitor v = new DefaultEvalVisitor(signal, args);
+ return v.toBoolean(m_root.eval(v));
+ }
+
+ @Override
+ public String toString() {
+ DefaultFormatVisitor v = new DefaultFormatVisitor();
+ m_root.format(v);
+ return v.getText();
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/AbstractNode.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/AbstractNode.java
index 47b9c86513..a6410c15ab 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/AbstractNode.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/AbstractNode.java
@@ -1,15 +1,15 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.scheduler.internal.node;
-
-public abstract class AbstractNode implements INode {
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.scheduler.internal.node;
+
+public abstract class AbstractNode implements INode {
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/AbstractOperation.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/AbstractOperation.java
index c209720ed7..c30fe17452 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/AbstractOperation.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/AbstractOperation.java
@@ -1,51 +1,51 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.scheduler.internal.node;
-
-import org.eclipse.scout.rt.server.scheduler.internal.visitor.IEvalVisitor;
-import org.eclipse.scout.rt.server.scheduler.internal.visitor.IFormatVisitor;
-
-public abstract class AbstractOperation extends AbstractNode implements INode {
- private INode m_leftCmd;
- private INode m_rightCmd;
-
- public AbstractOperation(INode leftCmd, INode rightCmd) {
- m_leftCmd = leftCmd;
- m_rightCmd = rightCmd;
- }
-
- public INode getLeftSide() {
- return m_leftCmd;
- }
-
- public INode getRightSide() {
- return m_rightCmd;
- }
-
- @Override
- public void format(IFormatVisitor v) {
- m_leftCmd.format(v);
- v.print(" ");
- formatOpImpl(v);
- v.print(" ");
- m_rightCmd.format(v);
- }
-
- @Override
- public Object eval(IEvalVisitor v) {
- return evalImpl(v, m_leftCmd.eval(v), m_rightCmd.eval(v));
- }
-
- public abstract void formatOpImpl(IFormatVisitor v);
-
- public abstract Object evalImpl(IEvalVisitor v, Object a, Object b);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.scheduler.internal.node;
+
+import org.eclipse.scout.rt.server.scheduler.internal.visitor.IEvalVisitor;
+import org.eclipse.scout.rt.server.scheduler.internal.visitor.IFormatVisitor;
+
+public abstract class AbstractOperation extends AbstractNode implements INode {
+ private INode m_leftCmd;
+ private INode m_rightCmd;
+
+ public AbstractOperation(INode leftCmd, INode rightCmd) {
+ m_leftCmd = leftCmd;
+ m_rightCmd = rightCmd;
+ }
+
+ public INode getLeftSide() {
+ return m_leftCmd;
+ }
+
+ public INode getRightSide() {
+ return m_rightCmd;
+ }
+
+ @Override
+ public void format(IFormatVisitor v) {
+ m_leftCmd.format(v);
+ v.print(" ");
+ formatOpImpl(v);
+ v.print(" ");
+ m_rightCmd.format(v);
+ }
+
+ @Override
+ public Object eval(IEvalVisitor v) {
+ return evalImpl(v, m_leftCmd.eval(v), m_rightCmd.eval(v));
+ }
+
+ public abstract void formatOpImpl(IFormatVisitor v);
+
+ public abstract Object evalImpl(IEvalVisitor v, Object a, Object b);
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/ArgRef.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/ArgRef.java
index 9cf49afb10..5a47a71cde 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/ArgRef.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/ArgRef.java
@@ -1,47 +1,47 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.scheduler.internal.node;
-
-import org.eclipse.scout.rt.server.scheduler.internal.visitor.IEvalVisitor;
-import org.eclipse.scout.rt.server.scheduler.internal.visitor.IFormatVisitor;
-
-/**
- * always returns the referenced value except the method getReference() return
- * the reference itself
- */
-public class ArgRef extends AbstractNode implements INode {
- private int m_index;
-
- public ArgRef(int index) {
- m_index = index;
- }
-
- public int getIndex() {
- return m_index;
- }
-
- @Override
- public void format(IFormatVisitor v) {
- v.print("arg" + m_index);
- }
-
- @Override
- public Object eval(IEvalVisitor v) {
- Object[] args = v.getArgs();
- if (args != null && args.length > m_index) {
- return args[m_index];
- }
- else {
- return null;
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.scheduler.internal.node;
+
+import org.eclipse.scout.rt.server.scheduler.internal.visitor.IEvalVisitor;
+import org.eclipse.scout.rt.server.scheduler.internal.visitor.IFormatVisitor;
+
+/**
+ * always returns the referenced value except the method getReference() return
+ * the reference itself
+ */
+public class ArgRef extends AbstractNode implements INode {
+ private int m_index;
+
+ public ArgRef(int index) {
+ m_index = index;
+ }
+
+ public int getIndex() {
+ return m_index;
+ }
+
+ @Override
+ public void format(IFormatVisitor v) {
+ v.print("arg" + m_index);
+ }
+
+ @Override
+ public Object eval(IEvalVisitor v) {
+ Object[] args = v.getArgs();
+ if (args != null && args.length > m_index) {
+ return args[m_index];
+ }
+ else {
+ return null;
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/BooleanAtom.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/BooleanAtom.java
index 7389b8169d..81a90810b6 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/BooleanAtom.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/BooleanAtom.java
@@ -1,37 +1,37 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.scheduler.internal.node;
-
-import org.eclipse.scout.rt.server.scheduler.internal.visitor.IEvalVisitor;
-import org.eclipse.scout.rt.server.scheduler.internal.visitor.IFormatVisitor;
-
-public class BooleanAtom extends AbstractNode implements INode {
- private Boolean m_value;
-
- public BooleanAtom(Boolean value) {
- m_value = value;
- }
-
- public Boolean getValue() {
- return m_value;
- }
-
- @Override
- public void format(IFormatVisitor v) {
- v.print(m_value.booleanValue() ? "true" : "false");
- }
-
- @Override
- public Object eval(IEvalVisitor v) {
- return m_value;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.scheduler.internal.node;
+
+import org.eclipse.scout.rt.server.scheduler.internal.visitor.IEvalVisitor;
+import org.eclipse.scout.rt.server.scheduler.internal.visitor.IFormatVisitor;
+
+public class BooleanAtom extends AbstractNode implements INode {
+ private Boolean m_value;
+
+ public BooleanAtom(Boolean value) {
+ m_value = value;
+ }
+
+ public Boolean getValue() {
+ return m_value;
+ }
+
+ @Override
+ public void format(IFormatVisitor v) {
+ v.print(m_value.booleanValue() ? "true" : "false");
+ }
+
+ @Override
+ public Object eval(IEvalVisitor v) {
+ return m_value;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/FormulaRoot.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/FormulaRoot.java
index 9c00eb2e80..d91af914c9 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/FormulaRoot.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/FormulaRoot.java
@@ -1,35 +1,35 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.scheduler.internal.node;
-
-import org.eclipse.scout.rt.server.scheduler.internal.visitor.IEvalVisitor;
-import org.eclipse.scout.rt.server.scheduler.internal.visitor.IFormatVisitor;
-
-public class FormulaRoot extends AbstractNode {
- private INode m_node;
-
- public FormulaRoot(INode node) {
- m_node = node;
- }
-
- @Override
- public void format(IFormatVisitor v) {
- v.start();
- m_node.format(v);
- v.end();
- }
-
- @Override
- public Object eval(IEvalVisitor v) {
- return m_node.eval(v);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.scheduler.internal.node;
+
+import org.eclipse.scout.rt.server.scheduler.internal.visitor.IEvalVisitor;
+import org.eclipse.scout.rt.server.scheduler.internal.visitor.IFormatVisitor;
+
+public class FormulaRoot extends AbstractNode {
+ private INode m_node;
+
+ public FormulaRoot(INode node) {
+ m_node = node;
+ }
+
+ @Override
+ public void format(IFormatVisitor v) {
+ v.start();
+ m_node.format(v);
+ v.end();
+ }
+
+ @Override
+ public Object eval(IEvalVisitor v) {
+ return m_node.eval(v);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/INode.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/INode.java
index 20fb92e64f..559eeca7fb 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/INode.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/INode.java
@@ -1,22 +1,22 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.scheduler.internal.node;
-
-import org.eclipse.scout.rt.server.scheduler.internal.visitor.IEvalVisitor;
-import org.eclipse.scout.rt.server.scheduler.internal.visitor.IFormatVisitor;
-
-public interface INode {
-
- void format(IFormatVisitor v);
-
- Object eval(IEvalVisitor v);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.scheduler.internal.node;
+
+import org.eclipse.scout.rt.server.scheduler.internal.visitor.IEvalVisitor;
+import org.eclipse.scout.rt.server.scheduler.internal.visitor.IFormatVisitor;
+
+public interface INode {
+
+ void format(IFormatVisitor v);
+
+ Object eval(IEvalVisitor v);
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/IntegerAtom.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/IntegerAtom.java
index 80edb70ed5..5caeee4923 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/IntegerAtom.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/IntegerAtom.java
@@ -1,37 +1,37 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.scheduler.internal.node;
-
-import org.eclipse.scout.rt.server.scheduler.internal.visitor.IEvalVisitor;
-import org.eclipse.scout.rt.server.scheduler.internal.visitor.IFormatVisitor;
-
-public class IntegerAtom extends AbstractNode implements INode {
- private Integer m_value;
-
- public IntegerAtom(Integer value) {
- m_value = value;
- }
-
- public Integer getValue() {
- return m_value;
- }
-
- @Override
- public void format(IFormatVisitor v) {
- v.print(m_value.toString());
- }
-
- @Override
- public Object eval(IEvalVisitor v) {
- return m_value;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.scheduler.internal.node;
+
+import org.eclipse.scout.rt.server.scheduler.internal.visitor.IEvalVisitor;
+import org.eclipse.scout.rt.server.scheduler.internal.visitor.IFormatVisitor;
+
+public class IntegerAtom extends AbstractNode implements INode {
+ private Integer m_value;
+
+ public IntegerAtom(Integer value) {
+ m_value = value;
+ }
+
+ public Integer getValue() {
+ return m_value;
+ }
+
+ @Override
+ public void format(IFormatVisitor v) {
+ v.print(m_value.toString());
+ }
+
+ @Override
+ public Object eval(IEvalVisitor v) {
+ return m_value;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/NotToken.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/NotToken.java
index afc76dd869..859a07404f 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/NotToken.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/NotToken.java
@@ -1,39 +1,39 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.scheduler.internal.node;
-
-import org.eclipse.scout.rt.server.scheduler.internal.visitor.IEvalVisitor;
-import org.eclipse.scout.rt.server.scheduler.internal.visitor.IFormatVisitor;
-
-public class NotToken extends AbstractNode implements INode {
- private INode m_node;
-
- public NotToken(INode node) {
- m_node = node;
- }
-
- public INode getNode() {
- return m_node;
- }
-
- @Override
- public void format(IFormatVisitor v) {
- v.print("!");
- m_node.format(v);
- }
-
- @Override
- public Object eval(IEvalVisitor v) {
- boolean b = v.toBoolean(m_node.eval(v));
- return !b;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.scheduler.internal.node;
+
+import org.eclipse.scout.rt.server.scheduler.internal.visitor.IEvalVisitor;
+import org.eclipse.scout.rt.server.scheduler.internal.visitor.IFormatVisitor;
+
+public class NotToken extends AbstractNode implements INode {
+ private INode m_node;
+
+ public NotToken(INode node) {
+ m_node = node;
+ }
+
+ public INode getNode() {
+ return m_node;
+ }
+
+ @Override
+ public void format(IFormatVisitor v) {
+ v.print("!");
+ m_node.format(v);
+ }
+
+ @Override
+ public Object eval(IEvalVisitor v) {
+ boolean b = v.toBoolean(m_node.eval(v));
+ return !b;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/NullAtom.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/NullAtom.java
index d6d5a337de..377057200d 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/NullAtom.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/NullAtom.java
@@ -1,31 +1,31 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.scheduler.internal.node;
-
-import org.eclipse.scout.rt.server.scheduler.internal.visitor.IEvalVisitor;
-import org.eclipse.scout.rt.server.scheduler.internal.visitor.IFormatVisitor;
-
-public class NullAtom extends AbstractNode implements INode {
-
- public NullAtom() {
- }
-
- @Override
- public void format(IFormatVisitor v) {
- v.print("null");
- }
-
- @Override
- public Object eval(IEvalVisitor v) {
- return null;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.scheduler.internal.node;
+
+import org.eclipse.scout.rt.server.scheduler.internal.visitor.IEvalVisitor;
+import org.eclipse.scout.rt.server.scheduler.internal.visitor.IFormatVisitor;
+
+public class NullAtom extends AbstractNode implements INode {
+
+ public NullAtom() {
+ }
+
+ @Override
+ public void format(IFormatVisitor v) {
+ v.print("null");
+ }
+
+ @Override
+ public Object eval(IEvalVisitor v) {
+ return null;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/Op.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/Op.java
index 02a98795ef..e814da81a0 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/Op.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/Op.java
@@ -1,338 +1,338 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.scheduler.internal.node;
-
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.server.scheduler.internal.visitor.IEvalVisitor;
-import org.eclipse.scout.rt.server.scheduler.internal.visitor.IFormatVisitor;
-
-public final class Op {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(Op.class);
-
- private Op() {
- }
-
- public static class And extends AbstractOperation {
-
- public And(INode leftCmd, INode rightCmd) {
- super(leftCmd, rightCmd);
- }
-
- @Override
- public void formatOpImpl(IFormatVisitor v) {
- v.print("&&");
- }
-
- @Override
- public Object evalImpl(IEvalVisitor v, Object a, Object b) {
- return v.toBoolean(a) && v.toBoolean(b);
- }
- }
-
- public static class Or extends AbstractOperation {
-
- public Or(INode leftCmd, INode rightCmd) {
- super(leftCmd, rightCmd);
- }
-
- @Override
- public void formatOpImpl(IFormatVisitor v) {
- v.print("||");
- }
-
- @Override
- public Object evalImpl(IEvalVisitor v, Object a, Object b) {
- if ((a instanceof String) || (b instanceof String)) {
- return StringUtility.emptyIfNull(a) + StringUtility.emptyIfNull(b);
- }
- else {
- return v.toBoolean(a) || v.toBoolean(b);
- }
- }
- }
-
- public static class Equal extends AbstractOperation {
-
- public Equal(INode leftCmd, INode rightCmd) {
- super(leftCmd, rightCmd);
- }
-
- @Override
- public void formatOpImpl(IFormatVisitor v) {
- v.print("==");
- }
-
- @Override
- public Object evalImpl(IEvalVisitor v, Object a, Object b) {
- return CompareUtility.equals(a, b);
- }
- }
-
- public static class NotEqual extends AbstractOperation {
-
- public NotEqual(INode leftCmd, INode rightCmd) {
- super(leftCmd, rightCmd);
- }
-
- @Override
- public void formatOpImpl(IFormatVisitor v) {
- v.print("!=");
- }
-
- @Override
- public Object evalImpl(IEvalVisitor v, Object a, Object b) {
- return !CompareUtility.equals(a, b);
- }
- }
-
- public static class LessThanOrEqual extends AbstractOperation {
- public LessThanOrEqual(INode leftCmd, INode rightCmd) {
- super(leftCmd, rightCmd);
- }
-
- @Override
- public void formatOpImpl(IFormatVisitor v) {
- v.print("<=");
- }
-
- @Override
- public Object evalImpl(IEvalVisitor v, Object a, Object b) {
- return v.toInt(a) <= v.toInt(b);
- }
- }
-
- public static class GreaterThanOrEqual extends AbstractOperation {
- public GreaterThanOrEqual(INode leftCmd, INode rightCmd) {
- super(leftCmd, rightCmd);
- }
-
- @Override
- public void formatOpImpl(IFormatVisitor v) {
- v.print(">=");
- }
-
- @Override
- public Object evalImpl(IEvalVisitor v, Object a, Object b) {
- return v.toInt(a) >= v.toInt(b);
- }
- }
-
- public static class LessThan extends AbstractOperation {
- public LessThan(INode leftCmd, INode rightCmd) {
- super(leftCmd, rightCmd);
- }
-
- @Override
- public void formatOpImpl(IFormatVisitor v) {
- v.print("<");
- }
-
- @Override
- public Object evalImpl(IEvalVisitor v, Object a, Object b) {
- return v.toInt(a) < v.toInt(b);
- }
- }
-
- public static class GreaterThan extends AbstractOperation {
- public GreaterThan(INode leftCmd, INode rightCmd) {
- super(leftCmd, rightCmd);
- }
-
- @Override
- public void formatOpImpl(IFormatVisitor v) {
- v.print(">");
- }
-
- @Override
- public Object evalImpl(IEvalVisitor v, Object a, Object b) {
- return v.toInt(a) > v.toInt(b);
- }
- }
-
- public static class Add extends AbstractOperation {
- public Add(INode leftCmd, INode rightCmd) {
- super(leftCmd, rightCmd);
- }
-
- @Override
- public void formatOpImpl(IFormatVisitor v) {
- v.print("+");
- }
-
- @Override
- public Object evalImpl(IEvalVisitor v, Object a, Object b) {
- return v.toInt(a) + v.toInt(b);
- }
- }
-
- public static class Sub extends AbstractOperation {
- public Sub(INode leftCmd, INode rightCmd) {
- super(leftCmd, rightCmd);
- }
-
- @Override
- public void formatOpImpl(IFormatVisitor v) {
- v.print("-");
- }
-
- @Override
- public Object evalImpl(IEvalVisitor v, Object a, Object b) {
- return v.toInt(a) - v.toInt(b);
- }
- }
-
- public static class Mul extends AbstractOperation {
- public Mul(INode leftCmd, INode rightCmd) {
- super(leftCmd, rightCmd);
- }
-
- @Override
- public void formatOpImpl(IFormatVisitor v) {
- v.print("*");
- }
-
- @Override
- public Object evalImpl(IEvalVisitor v, Object a, Object b) {
- return v.toInt(a) * v.toInt(b);
- }
- }
-
- public static class Div extends AbstractOperation {
- public Div(INode leftCmd, INode rightCmd) {
- super(leftCmd, rightCmd);
- }
-
- @Override
- public void formatOpImpl(IFormatVisitor v) {
- v.print("/");
- }
-
- @Override
- public Object evalImpl(IEvalVisitor v, Object a, Object b) {
- return v.toInt(a) / v.toInt(b);
- }
- }
-
- public static class Mod extends AbstractOperation {
- public Mod(INode leftCmd, INode rightCmd) {
- super(leftCmd, rightCmd);
- }
-
- @Override
- public void formatOpImpl(IFormatVisitor v) {
- v.print("%");
- }
-
- @Override
- public Object evalImpl(IEvalVisitor v, Object a, Object b) {
- return v.toInt(a) % v.toInt(b);
- }
- }
-
- public static class BitXor extends AbstractOperation {
- public BitXor(INode leftCmd, INode rightCmd) {
- super(leftCmd, rightCmd);
- }
-
- @Override
- public void formatOpImpl(IFormatVisitor v) {
- v.print("^");
- }
-
- @Override
- public Object evalImpl(IEvalVisitor v, Object a, Object b) {
- return v.toInt(a) ^ v.toInt(b);
- }
- }
-
- public static class BitOr extends AbstractOperation {
- public BitOr(INode leftCmd, INode rightCmd) {
- super(leftCmd, rightCmd);
- }
-
- @Override
- public void formatOpImpl(IFormatVisitor v) {
- v.print("|");
- }
-
- @Override
- public Object evalImpl(IEvalVisitor v, Object a, Object b) {
- return v.toInt(a) | v.toInt(b);
- }
- }
-
- public static class BitAnd extends AbstractOperation {
- public BitAnd(INode leftCmd, INode rightCmd) {
- super(leftCmd, rightCmd);
- }
-
- @Override
- public void formatOpImpl(IFormatVisitor v) {
- v.print("&");
- }
-
- @Override
- public Object evalImpl(IEvalVisitor v, Object a, Object b) {
- return v.toInt(a) & v.toInt(b);
- }
- }
-
- public static class BitShiftLeft extends AbstractOperation {
- public BitShiftLeft(INode leftCmd, INode rightCmd) {
- super(leftCmd, rightCmd);
- }
-
- @Override
- public void formatOpImpl(IFormatVisitor v) {
- v.print("<<");
- }
-
- @Override
- public Object evalImpl(IEvalVisitor v, Object a, Object b) {
- return v.toInt(a) << v.toInt(b);
- }
- }
-
- public static class BitShiftRight extends AbstractOperation {
- public BitShiftRight(INode leftCmd, INode rightCmd) {
- super(leftCmd, rightCmd);
- }
-
- @Override
- public void formatOpImpl(IFormatVisitor v) {
- v.print(">>");
- }
-
- @Override
- public Object evalImpl(IEvalVisitor v, Object a, Object b) {
- return v.toInt(a) >> v.toInt(b);
- }
- }
-
- public static class BitShiftRightZeroExtending extends AbstractOperation {
- public BitShiftRightZeroExtending(INode leftCmd, INode rightCmd) {
- super(leftCmd, rightCmd);
- }
-
- @Override
- public void formatOpImpl(IFormatVisitor v) {
- v.print(">>>");
- }
-
- @Override
- public Object evalImpl(IEvalVisitor v, Object a, Object b) {
- return v.toInt(a) >>> v.toInt(b);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.scheduler.internal.node;
+
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.server.scheduler.internal.visitor.IEvalVisitor;
+import org.eclipse.scout.rt.server.scheduler.internal.visitor.IFormatVisitor;
+
+public final class Op {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(Op.class);
+
+ private Op() {
+ }
+
+ public static class And extends AbstractOperation {
+
+ public And(INode leftCmd, INode rightCmd) {
+ super(leftCmd, rightCmd);
+ }
+
+ @Override
+ public void formatOpImpl(IFormatVisitor v) {
+ v.print("&&");
+ }
+
+ @Override
+ public Object evalImpl(IEvalVisitor v, Object a, Object b) {
+ return v.toBoolean(a) && v.toBoolean(b);
+ }
+ }
+
+ public static class Or extends AbstractOperation {
+
+ public Or(INode leftCmd, INode rightCmd) {
+ super(leftCmd, rightCmd);
+ }
+
+ @Override
+ public void formatOpImpl(IFormatVisitor v) {
+ v.print("||");
+ }
+
+ @Override
+ public Object evalImpl(IEvalVisitor v, Object a, Object b) {
+ if ((a instanceof String) || (b instanceof String)) {
+ return StringUtility.emptyIfNull(a) + StringUtility.emptyIfNull(b);
+ }
+ else {
+ return v.toBoolean(a) || v.toBoolean(b);
+ }
+ }
+ }
+
+ public static class Equal extends AbstractOperation {
+
+ public Equal(INode leftCmd, INode rightCmd) {
+ super(leftCmd, rightCmd);
+ }
+
+ @Override
+ public void formatOpImpl(IFormatVisitor v) {
+ v.print("==");
+ }
+
+ @Override
+ public Object evalImpl(IEvalVisitor v, Object a, Object b) {
+ return CompareUtility.equals(a, b);
+ }
+ }
+
+ public static class NotEqual extends AbstractOperation {
+
+ public NotEqual(INode leftCmd, INode rightCmd) {
+ super(leftCmd, rightCmd);
+ }
+
+ @Override
+ public void formatOpImpl(IFormatVisitor v) {
+ v.print("!=");
+ }
+
+ @Override
+ public Object evalImpl(IEvalVisitor v, Object a, Object b) {
+ return !CompareUtility.equals(a, b);
+ }
+ }
+
+ public static class LessThanOrEqual extends AbstractOperation {
+ public LessThanOrEqual(INode leftCmd, INode rightCmd) {
+ super(leftCmd, rightCmd);
+ }
+
+ @Override
+ public void formatOpImpl(IFormatVisitor v) {
+ v.print("<=");
+ }
+
+ @Override
+ public Object evalImpl(IEvalVisitor v, Object a, Object b) {
+ return v.toInt(a) <= v.toInt(b);
+ }
+ }
+
+ public static class GreaterThanOrEqual extends AbstractOperation {
+ public GreaterThanOrEqual(INode leftCmd, INode rightCmd) {
+ super(leftCmd, rightCmd);
+ }
+
+ @Override
+ public void formatOpImpl(IFormatVisitor v) {
+ v.print(">=");
+ }
+
+ @Override
+ public Object evalImpl(IEvalVisitor v, Object a, Object b) {
+ return v.toInt(a) >= v.toInt(b);
+ }
+ }
+
+ public static class LessThan extends AbstractOperation {
+ public LessThan(INode leftCmd, INode rightCmd) {
+ super(leftCmd, rightCmd);
+ }
+
+ @Override
+ public void formatOpImpl(IFormatVisitor v) {
+ v.print("<");
+ }
+
+ @Override
+ public Object evalImpl(IEvalVisitor v, Object a, Object b) {
+ return v.toInt(a) < v.toInt(b);
+ }
+ }
+
+ public static class GreaterThan extends AbstractOperation {
+ public GreaterThan(INode leftCmd, INode rightCmd) {
+ super(leftCmd, rightCmd);
+ }
+
+ @Override
+ public void formatOpImpl(IFormatVisitor v) {
+ v.print(">");
+ }
+
+ @Override
+ public Object evalImpl(IEvalVisitor v, Object a, Object b) {
+ return v.toInt(a) > v.toInt(b);
+ }
+ }
+
+ public static class Add extends AbstractOperation {
+ public Add(INode leftCmd, INode rightCmd) {
+ super(leftCmd, rightCmd);
+ }
+
+ @Override
+ public void formatOpImpl(IFormatVisitor v) {
+ v.print("+");
+ }
+
+ @Override
+ public Object evalImpl(IEvalVisitor v, Object a, Object b) {
+ return v.toInt(a) + v.toInt(b);
+ }
+ }
+
+ public static class Sub extends AbstractOperation {
+ public Sub(INode leftCmd, INode rightCmd) {
+ super(leftCmd, rightCmd);
+ }
+
+ @Override
+ public void formatOpImpl(IFormatVisitor v) {
+ v.print("-");
+ }
+
+ @Override
+ public Object evalImpl(IEvalVisitor v, Object a, Object b) {
+ return v.toInt(a) - v.toInt(b);
+ }
+ }
+
+ public static class Mul extends AbstractOperation {
+ public Mul(INode leftCmd, INode rightCmd) {
+ super(leftCmd, rightCmd);
+ }
+
+ @Override
+ public void formatOpImpl(IFormatVisitor v) {
+ v.print("*");
+ }
+
+ @Override
+ public Object evalImpl(IEvalVisitor v, Object a, Object b) {
+ return v.toInt(a) * v.toInt(b);
+ }
+ }
+
+ public static class Div extends AbstractOperation {
+ public Div(INode leftCmd, INode rightCmd) {
+ super(leftCmd, rightCmd);
+ }
+
+ @Override
+ public void formatOpImpl(IFormatVisitor v) {
+ v.print("/");
+ }
+
+ @Override
+ public Object evalImpl(IEvalVisitor v, Object a, Object b) {
+ return v.toInt(a) / v.toInt(b);
+ }
+ }
+
+ public static class Mod extends AbstractOperation {
+ public Mod(INode leftCmd, INode rightCmd) {
+ super(leftCmd, rightCmd);
+ }
+
+ @Override
+ public void formatOpImpl(IFormatVisitor v) {
+ v.print("%");
+ }
+
+ @Override
+ public Object evalImpl(IEvalVisitor v, Object a, Object b) {
+ return v.toInt(a) % v.toInt(b);
+ }
+ }
+
+ public static class BitXor extends AbstractOperation {
+ public BitXor(INode leftCmd, INode rightCmd) {
+ super(leftCmd, rightCmd);
+ }
+
+ @Override
+ public void formatOpImpl(IFormatVisitor v) {
+ v.print("^");
+ }
+
+ @Override
+ public Object evalImpl(IEvalVisitor v, Object a, Object b) {
+ return v.toInt(a) ^ v.toInt(b);
+ }
+ }
+
+ public static class BitOr extends AbstractOperation {
+ public BitOr(INode leftCmd, INode rightCmd) {
+ super(leftCmd, rightCmd);
+ }
+
+ @Override
+ public void formatOpImpl(IFormatVisitor v) {
+ v.print("|");
+ }
+
+ @Override
+ public Object evalImpl(IEvalVisitor v, Object a, Object b) {
+ return v.toInt(a) | v.toInt(b);
+ }
+ }
+
+ public static class BitAnd extends AbstractOperation {
+ public BitAnd(INode leftCmd, INode rightCmd) {
+ super(leftCmd, rightCmd);
+ }
+
+ @Override
+ public void formatOpImpl(IFormatVisitor v) {
+ v.print("&");
+ }
+
+ @Override
+ public Object evalImpl(IEvalVisitor v, Object a, Object b) {
+ return v.toInt(a) & v.toInt(b);
+ }
+ }
+
+ public static class BitShiftLeft extends AbstractOperation {
+ public BitShiftLeft(INode leftCmd, INode rightCmd) {
+ super(leftCmd, rightCmd);
+ }
+
+ @Override
+ public void formatOpImpl(IFormatVisitor v) {
+ v.print("<<");
+ }
+
+ @Override
+ public Object evalImpl(IEvalVisitor v, Object a, Object b) {
+ return v.toInt(a) << v.toInt(b);
+ }
+ }
+
+ public static class BitShiftRight extends AbstractOperation {
+ public BitShiftRight(INode leftCmd, INode rightCmd) {
+ super(leftCmd, rightCmd);
+ }
+
+ @Override
+ public void formatOpImpl(IFormatVisitor v) {
+ v.print(">>");
+ }
+
+ @Override
+ public Object evalImpl(IEvalVisitor v, Object a, Object b) {
+ return v.toInt(a) >> v.toInt(b);
+ }
+ }
+
+ public static class BitShiftRightZeroExtending extends AbstractOperation {
+ public BitShiftRightZeroExtending(INode leftCmd, INode rightCmd) {
+ super(leftCmd, rightCmd);
+ }
+
+ @Override
+ public void formatOpImpl(IFormatVisitor v) {
+ v.print(">>>");
+ }
+
+ @Override
+ public Object evalImpl(IEvalVisitor v, Object a, Object b) {
+ return v.toInt(a) >>> v.toInt(b);
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/SignalRef.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/SignalRef.java
index eb049773bd..2ca75e5203 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/SignalRef.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/SignalRef.java
@@ -1,133 +1,133 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.scheduler.internal.node;
-
-import org.eclipse.scout.rt.server.scheduler.internal.visitor.IEvalVisitor;
-import org.eclipse.scout.rt.server.scheduler.internal.visitor.IFormatVisitor;
-
-/**
- * always returns the referenced value except the method getReference() return
- * the reference itself
- */
-public class SignalRef extends AbstractNode implements INode {
- public static final int SECOND = 1;
- public static final int MINUTE = 2;
- public static final int HOUR = 3;
- public static final int DAY = 4;
- public static final int WEEK = 5;
- public static final int MONTH = 6;
- public static final int YEAR = 7;
- public static final int DAY_OF_WEEK = 8;
- public static final int DAY_OF_MONTH_REVERSE = 9;
- public static final int DAY_OF_YEAR = 10;
- public static final int SECOND_OF_DAY = 11;
-
- private int m_field;
-
- public SignalRef(int field) {
- m_field = field;
- }
-
- public int getField() {
- return m_field;
- }
-
- @Override
- public void format(IFormatVisitor v) {
- switch (m_field) {
- case SECOND: {
- v.print("second");
- break;
- }
- case MINUTE: {
- v.print("minute");
- break;
- }
- case HOUR: {
- v.print("hour");
- break;
- }
- case DAY: {
- v.print("day");
- break;
- }
- case WEEK: {
- v.print("week");
- break;
- }
- case MONTH: {
- v.print("month");
- break;
- }
- case YEAR: {
- v.print("year");
- break;
- }
- case DAY_OF_WEEK: {
- v.print("dayOfWeek");
- break;
- }
- case DAY_OF_MONTH_REVERSE: {
- v.print("dayOfMonthReverse");
- break;
- }
- case DAY_OF_YEAR: {
- v.print("dayOfYear");
- break;
- }
- case SECOND_OF_DAY: {
- v.print("secondOfDay");
- break;
- }
- }
- }
-
- @Override
- public Object eval(IEvalVisitor v) {
- switch (m_field) {
- case SECOND: {
- return v.getSignal().getSecond();
- }
- case MINUTE: {
- return v.getSignal().getMinute();
- }
- case HOUR: {
- return v.getSignal().getHour();
- }
- case DAY: {
- return v.getSignal().getDay();
- }
- case WEEK: {
- return v.getSignal().getWeek();
- }
- case MONTH: {
- return v.getSignal().getMonth();
- }
- case YEAR: {
- return v.getSignal().getYear();
- }
- case DAY_OF_WEEK: {
- return v.getSignal().getDayOfWeek();
- }
- case DAY_OF_MONTH_REVERSE: {
- return v.getSignal().getDayOfMonthReverse();
- }
- case DAY_OF_YEAR: {
- return v.getSignal().getDayOfYear();
- }
- case SECOND_OF_DAY: {
- return v.getSignal().getSecondOfDay();
- }
- }
- throw new IllegalArgumentException("unexpected field " + m_field);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.scheduler.internal.node;
+
+import org.eclipse.scout.rt.server.scheduler.internal.visitor.IEvalVisitor;
+import org.eclipse.scout.rt.server.scheduler.internal.visitor.IFormatVisitor;
+
+/**
+ * always returns the referenced value except the method getReference() return
+ * the reference itself
+ */
+public class SignalRef extends AbstractNode implements INode {
+ public static final int SECOND = 1;
+ public static final int MINUTE = 2;
+ public static final int HOUR = 3;
+ public static final int DAY = 4;
+ public static final int WEEK = 5;
+ public static final int MONTH = 6;
+ public static final int YEAR = 7;
+ public static final int DAY_OF_WEEK = 8;
+ public static final int DAY_OF_MONTH_REVERSE = 9;
+ public static final int DAY_OF_YEAR = 10;
+ public static final int SECOND_OF_DAY = 11;
+
+ private int m_field;
+
+ public SignalRef(int field) {
+ m_field = field;
+ }
+
+ public int getField() {
+ return m_field;
+ }
+
+ @Override
+ public void format(IFormatVisitor v) {
+ switch (m_field) {
+ case SECOND: {
+ v.print("second");
+ break;
+ }
+ case MINUTE: {
+ v.print("minute");
+ break;
+ }
+ case HOUR: {
+ v.print("hour");
+ break;
+ }
+ case DAY: {
+ v.print("day");
+ break;
+ }
+ case WEEK: {
+ v.print("week");
+ break;
+ }
+ case MONTH: {
+ v.print("month");
+ break;
+ }
+ case YEAR: {
+ v.print("year");
+ break;
+ }
+ case DAY_OF_WEEK: {
+ v.print("dayOfWeek");
+ break;
+ }
+ case DAY_OF_MONTH_REVERSE: {
+ v.print("dayOfMonthReverse");
+ break;
+ }
+ case DAY_OF_YEAR: {
+ v.print("dayOfYear");
+ break;
+ }
+ case SECOND_OF_DAY: {
+ v.print("secondOfDay");
+ break;
+ }
+ }
+ }
+
+ @Override
+ public Object eval(IEvalVisitor v) {
+ switch (m_field) {
+ case SECOND: {
+ return v.getSignal().getSecond();
+ }
+ case MINUTE: {
+ return v.getSignal().getMinute();
+ }
+ case HOUR: {
+ return v.getSignal().getHour();
+ }
+ case DAY: {
+ return v.getSignal().getDay();
+ }
+ case WEEK: {
+ return v.getSignal().getWeek();
+ }
+ case MONTH: {
+ return v.getSignal().getMonth();
+ }
+ case YEAR: {
+ return v.getSignal().getYear();
+ }
+ case DAY_OF_WEEK: {
+ return v.getSignal().getDayOfWeek();
+ }
+ case DAY_OF_MONTH_REVERSE: {
+ return v.getSignal().getDayOfMonthReverse();
+ }
+ case DAY_OF_YEAR: {
+ return v.getSignal().getDayOfYear();
+ }
+ case SECOND_OF_DAY: {
+ return v.getSignal().getSecondOfDay();
+ }
+ }
+ throw new IllegalArgumentException("unexpected field " + m_field);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/StringAtom.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/StringAtom.java
index 6bd7a228e3..57495ab5b3 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/StringAtom.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/StringAtom.java
@@ -1,41 +1,41 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.scheduler.internal.node;
-
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.rt.server.scheduler.internal.visitor.IEvalVisitor;
-import org.eclipse.scout.rt.server.scheduler.internal.visitor.IFormatVisitor;
-
-public class StringAtom extends AbstractNode implements INode {
- private String m_value;
-
- public StringAtom(String value) {
- m_value = value;
- }
-
- public String getValue() {
- return m_value;
- }
-
- @Override
- public void format(IFormatVisitor v) {
- String escText = "" + m_value;
- escText = escText.replaceAll("\"", "\\\\\"");
- escText = StringUtility.escapeWhitespace(escText);
- v.print("\"" + escText + "\"");
- }
-
- @Override
- public Object eval(IEvalVisitor v) {
- return m_value;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.scheduler.internal.node;
+
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.rt.server.scheduler.internal.visitor.IEvalVisitor;
+import org.eclipse.scout.rt.server.scheduler.internal.visitor.IFormatVisitor;
+
+public class StringAtom extends AbstractNode implements INode {
+ private String m_value;
+
+ public StringAtom(String value) {
+ m_value = value;
+ }
+
+ public String getValue() {
+ return m_value;
+ }
+
+ @Override
+ public void format(IFormatVisitor v) {
+ String escText = "" + m_value;
+ escText = escText.replaceAll("\"", "\\\\\"");
+ escText = StringUtility.escapeWhitespace(escText);
+ v.print("\"" + escText + "\"");
+ }
+
+ @Override
+ public Object eval(IEvalVisitor v) {
+ return m_value;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/WrappedToken.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/WrappedToken.java
index 776e9d9846..2be4eef2a5 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/WrappedToken.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/node/WrappedToken.java
@@ -1,39 +1,39 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.scheduler.internal.node;
-
-import org.eclipse.scout.rt.server.scheduler.internal.visitor.IEvalVisitor;
-import org.eclipse.scout.rt.server.scheduler.internal.visitor.IFormatVisitor;
-
-public class WrappedToken extends AbstractNode implements INode {
- private INode m_node;
-
- public WrappedToken(INode node) {
- m_node = node;
- }
-
- public INode getNode() {
- return m_node;
- }
-
- @Override
- public void format(IFormatVisitor v) {
- v.print("(");
- m_node.format(v);
- v.print(")");
- }
-
- @Override
- public Object eval(IEvalVisitor v) {
- return m_node.eval(v);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.scheduler.internal.node;
+
+import org.eclipse.scout.rt.server.scheduler.internal.visitor.IEvalVisitor;
+import org.eclipse.scout.rt.server.scheduler.internal.visitor.IFormatVisitor;
+
+public class WrappedToken extends AbstractNode implements INode {
+ private INode m_node;
+
+ public WrappedToken(INode node) {
+ m_node = node;
+ }
+
+ public INode getNode() {
+ return m_node;
+ }
+
+ @Override
+ public void format(IFormatVisitor v) {
+ v.print("(");
+ m_node.format(v);
+ v.print(")");
+ }
+
+ @Override
+ public Object eval(IEvalVisitor v) {
+ return m_node.eval(v);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/visitor/DefaultEvalVisitor.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/visitor/DefaultEvalVisitor.java
index 90f57ef73d..ab59585e58 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/visitor/DefaultEvalVisitor.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/visitor/DefaultEvalVisitor.java
@@ -1,53 +1,53 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.scheduler.internal.visitor;
-
-import org.eclipse.scout.commons.TypeCastUtility;
-import org.eclipse.scout.rt.server.scheduler.TickSignal;
-
-public class DefaultEvalVisitor implements IEvalVisitor {
-
- private TickSignal m_signal;
- private Object[] m_args;
-
- public DefaultEvalVisitor(TickSignal signal, Object[] args) {
- m_signal = signal;
- m_args = args;
- }
-
- @Override
- public Object[] getArgs() {
- return m_args;
- }
-
- @Override
- public TickSignal getSignal() {
- return m_signal;
- }
-
- @Override
- public boolean toBoolean(Object o) {
- Boolean b = TypeCastUtility.castValue(o, Boolean.class);
- if (b == null) {
- b = false;
- }
- return b;
- }
-
- @Override
- public int toInt(Object o) {
- Integer n = TypeCastUtility.castValue(o, Integer.class);
- if (n == null) {
- n = 0;
- }
- return n;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.scheduler.internal.visitor;
+
+import org.eclipse.scout.commons.TypeCastUtility;
+import org.eclipse.scout.rt.server.scheduler.TickSignal;
+
+public class DefaultEvalVisitor implements IEvalVisitor {
+
+ private TickSignal m_signal;
+ private Object[] m_args;
+
+ public DefaultEvalVisitor(TickSignal signal, Object[] args) {
+ m_signal = signal;
+ m_args = args;
+ }
+
+ @Override
+ public Object[] getArgs() {
+ return m_args;
+ }
+
+ @Override
+ public TickSignal getSignal() {
+ return m_signal;
+ }
+
+ @Override
+ public boolean toBoolean(Object o) {
+ Boolean b = TypeCastUtility.castValue(o, Boolean.class);
+ if (b == null) {
+ b = false;
+ }
+ return b;
+ }
+
+ @Override
+ public int toInt(Object o) {
+ Integer n = TypeCastUtility.castValue(o, Integer.class);
+ if (n == null) {
+ n = 0;
+ }
+ return n;
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/visitor/DefaultFormatVisitor.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/visitor/DefaultFormatVisitor.java
index 3db0bdd854..e366eda55d 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/visitor/DefaultFormatVisitor.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/visitor/DefaultFormatVisitor.java
@@ -1,38 +1,38 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.scheduler.internal.visitor;
-
-public class DefaultFormatVisitor implements IFormatVisitor {
- private StringBuffer m_buf;
- private String m_text;
-
- @Override
- public void start() {
- m_buf = new StringBuffer();
- }
-
- @Override
- public void end() {
- m_text = m_buf.toString();
- m_buf = null;
- }
-
- @Override
- public void print(String s) {
- m_buf.append(s);
- }
-
- @Override
- public String getText() {
- return m_text;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.scheduler.internal.visitor;
+
+public class DefaultFormatVisitor implements IFormatVisitor {
+ private StringBuffer m_buf;
+ private String m_text;
+
+ @Override
+ public void start() {
+ m_buf = new StringBuffer();
+ }
+
+ @Override
+ public void end() {
+ m_text = m_buf.toString();
+ m_buf = null;
+ }
+
+ @Override
+ public void print(String s) {
+ m_buf.append(s);
+ }
+
+ @Override
+ public String getText() {
+ return m_text;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/visitor/IEvalVisitor.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/visitor/IEvalVisitor.java
index b48c6c4665..24c5014c25 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/visitor/IEvalVisitor.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/visitor/IEvalVisitor.java
@@ -1,24 +1,24 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.scheduler.internal.visitor;
-
-import org.eclipse.scout.rt.server.scheduler.TickSignal;
-
-public interface IEvalVisitor {
-
- TickSignal getSignal();
-
- Object[] getArgs();
-
- boolean toBoolean(Object o);
-
- int toInt(Object o);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.scheduler.internal.visitor;
+
+import org.eclipse.scout.rt.server.scheduler.TickSignal;
+
+public interface IEvalVisitor {
+
+ TickSignal getSignal();
+
+ Object[] getArgs();
+
+ boolean toBoolean(Object o);
+
+ int toInt(Object o);
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/visitor/IFormatVisitor.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/visitor/IFormatVisitor.java
index a954c81ffa..e029d4fd73 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/visitor/IFormatVisitor.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/scheduler/internal/visitor/IFormatVisitor.java
@@ -1,23 +1,23 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.scheduler.internal.visitor;
-
-public interface IFormatVisitor {
-
- void start();
-
- void end();
-
- void print(String s);
-
- String getText();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.scheduler.internal.visitor;
+
+public interface IFormatVisitor {
+
+ void start();
+
+ void end();
+
+ void print(String s);
+
+ String getText();
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/ServerServiceFactory.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/ServerServiceFactory.java
index 3f878e728d..b940fe8c2d 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/ServerServiceFactory.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/ServerServiceFactory.java
@@ -1,149 +1,149 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.server.IServerSession;
-import org.eclipse.scout.rt.server.IServerSessionProvider;
-import org.eclipse.scout.rt.server.ServerJob;
-import org.eclipse.scout.rt.server.ThreadContext;
-import org.eclipse.scout.rt.shared.OfflineState;
-import org.eclipse.scout.rt.shared.TierState;
-import org.eclipse.scout.rt.shared.TierState.Tier;
-import org.eclipse.scout.service.CreateServiceImmediatelySchedulingRule;
-import org.eclipse.scout.service.IService;
-import org.eclipse.scout.service.IService2;
-import org.eclipse.scout.service.IServiceFactory;
-import org.eclipse.scout.service.ServiceConstants;
-import org.eclipse.scout.service.ServiceUtility;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.ServiceRegistration;
-
-/**
- * Service factory handling server services based on a {@link IServerSession}.
- * The service exists once per osgi environment and is cached persistent. The
- * service is only available within a {@link Job} that implements {@link IServerSessionProvider} with a compatible
- * {@link IServerSession} type
- * or within a thread with {@link ThreadContext#getServerSession()}!=null see {@link ServerJob}
- * <p>
- * The factory supports {@link ServiceConstants#SERVICE_SCOPE} with an {@link IServerSession} class.<br>
- * The factory supports {@link ServiceConstants#SERVICE_CREATE_IMMEDIATELY}
- * <p>
- * Visiblity: ServerJob.getCurrentSession()!=null && (BE || OFF), see also {@link IService} for details
- */
-public class ServerServiceFactory implements IServiceFactory {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(ServerServiceFactory.class);
-
- private Bundle m_bundle;
- private Class<?> m_serviceClass;
- private String m_sessionType;
- private Class<? extends IServerSession> m_sessionClass;
- // lazy creation
- private Object m_service;
- private Object m_serviceLock = new Object();
-
- public ServerServiceFactory(Class<?> serviceClass) {
- if (serviceClass == null) {
- throw new IllegalArgumentException("service type must not be null");
- }
- if (serviceClass.isInterface()) {
- throw new IllegalArgumentException("service type must not be an interface: " + serviceClass);
- }
- m_serviceClass = serviceClass;
- }
-
- @Override
- public void serviceRegistered(final ServiceRegistration registration) throws Throwable {
- Boolean createImmediately = (Boolean) registration.getReference().getProperty(ServiceConstants.SERVICE_CREATE_IMMEDIATELY);
- if (createImmediately != null && createImmediately) {
- Job job = new Job("create service " + m_serviceClass.getSimpleName()) {
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- updateClassCache(registration);
- updateInstanceCache(registration);
- return Status.OK_STATUS;
- }
- };
- job.setRule(new CreateServiceImmediatelySchedulingRule());
- job.schedule();
- }
- }
-
- @Override
- public Object getService(Bundle bundle, ServiceRegistration registration) {
- updateClassCache(registration);
- IServerSession session = ServerJob.getCurrentSession(m_sessionClass);
- if (session != null) {
- if (TierState.get() == Tier.BackEnd || TierState.get() == Tier.Undefined || OfflineState.isOfflineInCurrentThread()) {
- updateInstanceCache(registration);
- return m_service;
- }
- }
- return ServiceUtility.NULL_SERVICE;
- }
-
- @Override
- public void ungetService(Bundle bundle, ServiceRegistration registration, Object service) {
- }
-
- @SuppressWarnings("unchecked")
- private void updateClassCache(ServiceRegistration registration) {
- synchronized (m_serviceLock) {
- if (m_bundle == null) {
- m_bundle = registration.getReference().getBundle();
- }
- if (m_sessionType == null) {
- m_sessionType = (String) registration.getReference().getProperty(ServiceConstants.SERVICE_SCOPE);
- }
- try {
- if (m_sessionClass == null) {
- if (m_sessionType == null) {
- m_sessionClass = IServerSession.class;
- }
- else {
- m_sessionClass = (Class<? extends IServerSession>) m_bundle.loadClass(m_sessionType);
- if (!IServerSession.class.isAssignableFrom(m_sessionClass)) {
- throw new IllegalArgumentException("session type must be a subtype of " + IServerSession.class + ": " + m_sessionType);
- }
- }
- }
- }
- catch (Throwable t) {
- LOG.error("Failed creating class of " + m_serviceClass, t);
- }
- }
- }
-
- private void updateInstanceCache(ServiceRegistration registration) {
- synchronized (m_serviceLock) {
- if (m_service == null) {
- try {
- m_service = m_serviceClass.newInstance();
- if (m_service instanceof IService2) {
- ((IService2) m_service).initializeService(registration);
- }
- else if (m_service instanceof IService) {
- ((IService) m_service).initializeService();
- }
- }
- catch (Throwable t) {
- LOG.error("Failed creating instance of " + m_serviceClass, t);
- }
- }
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.server.IServerSession;
+import org.eclipse.scout.rt.server.IServerSessionProvider;
+import org.eclipse.scout.rt.server.ServerJob;
+import org.eclipse.scout.rt.server.ThreadContext;
+import org.eclipse.scout.rt.shared.OfflineState;
+import org.eclipse.scout.rt.shared.TierState;
+import org.eclipse.scout.rt.shared.TierState.Tier;
+import org.eclipse.scout.service.CreateServiceImmediatelySchedulingRule;
+import org.eclipse.scout.service.IService;
+import org.eclipse.scout.service.IService2;
+import org.eclipse.scout.service.IServiceFactory;
+import org.eclipse.scout.service.ServiceConstants;
+import org.eclipse.scout.service.ServiceUtility;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.ServiceRegistration;
+
+/**
+ * Service factory handling server services based on a {@link IServerSession}.
+ * The service exists once per osgi environment and is cached persistent. The
+ * service is only available within a {@link Job} that implements {@link IServerSessionProvider} with a compatible
+ * {@link IServerSession} type
+ * or within a thread with {@link ThreadContext#getServerSession()}!=null see {@link ServerJob}
+ * <p>
+ * The factory supports {@link ServiceConstants#SERVICE_SCOPE} with an {@link IServerSession} class.<br>
+ * The factory supports {@link ServiceConstants#SERVICE_CREATE_IMMEDIATELY}
+ * <p>
+ * Visiblity: ServerJob.getCurrentSession()!=null && (BE || OFF), see also {@link IService} for details
+ */
+public class ServerServiceFactory implements IServiceFactory {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(ServerServiceFactory.class);
+
+ private Bundle m_bundle;
+ private Class<?> m_serviceClass;
+ private String m_sessionType;
+ private Class<? extends IServerSession> m_sessionClass;
+ // lazy creation
+ private Object m_service;
+ private Object m_serviceLock = new Object();
+
+ public ServerServiceFactory(Class<?> serviceClass) {
+ if (serviceClass == null) {
+ throw new IllegalArgumentException("service type must not be null");
+ }
+ if (serviceClass.isInterface()) {
+ throw new IllegalArgumentException("service type must not be an interface: " + serviceClass);
+ }
+ m_serviceClass = serviceClass;
+ }
+
+ @Override
+ public void serviceRegistered(final ServiceRegistration registration) throws Throwable {
+ Boolean createImmediately = (Boolean) registration.getReference().getProperty(ServiceConstants.SERVICE_CREATE_IMMEDIATELY);
+ if (createImmediately != null && createImmediately) {
+ Job job = new Job("create service " + m_serviceClass.getSimpleName()) {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ updateClassCache(registration);
+ updateInstanceCache(registration);
+ return Status.OK_STATUS;
+ }
+ };
+ job.setRule(new CreateServiceImmediatelySchedulingRule());
+ job.schedule();
+ }
+ }
+
+ @Override
+ public Object getService(Bundle bundle, ServiceRegistration registration) {
+ updateClassCache(registration);
+ IServerSession session = ServerJob.getCurrentSession(m_sessionClass);
+ if (session != null) {
+ if (TierState.get() == Tier.BackEnd || TierState.get() == Tier.Undefined || OfflineState.isOfflineInCurrentThread()) {
+ updateInstanceCache(registration);
+ return m_service;
+ }
+ }
+ return ServiceUtility.NULL_SERVICE;
+ }
+
+ @Override
+ public void ungetService(Bundle bundle, ServiceRegistration registration, Object service) {
+ }
+
+ @SuppressWarnings("unchecked")
+ private void updateClassCache(ServiceRegistration registration) {
+ synchronized (m_serviceLock) {
+ if (m_bundle == null) {
+ m_bundle = registration.getReference().getBundle();
+ }
+ if (m_sessionType == null) {
+ m_sessionType = (String) registration.getReference().getProperty(ServiceConstants.SERVICE_SCOPE);
+ }
+ try {
+ if (m_sessionClass == null) {
+ if (m_sessionType == null) {
+ m_sessionClass = IServerSession.class;
+ }
+ else {
+ m_sessionClass = (Class<? extends IServerSession>) m_bundle.loadClass(m_sessionType);
+ if (!IServerSession.class.isAssignableFrom(m_sessionClass)) {
+ throw new IllegalArgumentException("session type must be a subtype of " + IServerSession.class + ": " + m_sessionType);
+ }
+ }
+ }
+ }
+ catch (Throwable t) {
+ LOG.error("Failed creating class of " + m_serviceClass, t);
+ }
+ }
+ }
+
+ private void updateInstanceCache(ServiceRegistration registration) {
+ synchronized (m_serviceLock) {
+ if (m_service == null) {
+ try {
+ m_service = m_serviceClass.newInstance();
+ if (m_service instanceof IService2) {
+ ((IService2) m_service).initializeService(registration);
+ }
+ else if (m_service instanceof IService) {
+ ((IService) m_service).initializeService();
+ }
+ }
+ catch (Throwable t) {
+ LOG.error("Failed creating instance of " + m_serviceClass, t);
+ }
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/bookmark/AbstractBookmarkStorageService.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/bookmark/AbstractBookmarkStorageService.java
index 8b0eae1345..aa6cd567c0 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/bookmark/AbstractBookmarkStorageService.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/bookmark/AbstractBookmarkStorageService.java
@@ -1,157 +1,157 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.bookmark;
-
-import java.util.Map;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.shared.security.ReadGlobalBookmarkPermission;
-import org.eclipse.scout.rt.shared.security.UpdateGlobalBookmarkPermission;
-import org.eclipse.scout.rt.shared.security.UpdateUserBookmarkPermission;
-import org.eclipse.scout.rt.shared.services.common.bookmark.Bookmark;
-import org.eclipse.scout.rt.shared.services.common.bookmark.BookmarkData;
-import org.eclipse.scout.rt.shared.services.common.bookmark.BookmarkFolder;
-import org.eclipse.scout.rt.shared.services.common.bookmark.IBookmarkStorageService;
-import org.eclipse.scout.rt.shared.services.common.security.ACCESS;
-import org.eclipse.scout.service.AbstractService;
-
-public abstract class AbstractBookmarkStorageService extends AbstractService implements IBookmarkStorageService {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractBookmarkStorageService.class);
-
- public AbstractBookmarkStorageService() {
- }
-
- @Override
- public BookmarkData getBookmarkData() throws ProcessingException {
- Object userId = getCurrentUserId();
- BookmarkData newData = readBookmarks(userId);
- if (processSpoolToInbox(newData.getUserBookmarks())) {
- writeUserFolder(newData.getUserBookmarks(), userId);
- }
- return newData;
- }
-
- @Override
- public BookmarkData storeBookmarkData(BookmarkData newData) throws ProcessingException {
- Object userId = getCurrentUserId();
- BookmarkFolder existingUserFolder = readUserFolder(userId);
- if (existingUserFolder != null) {
- BookmarkFolder existingSpoolFolder = existingUserFolder.getFolder(Bookmark.SPOOL_FOLDER_NAME);
- if (existingSpoolFolder != null) {
- newData.getUserBookmarks().getFolders().add(existingSpoolFolder);
- processSpoolToInbox(newData.getUserBookmarks());
- }
- }
- writeBookmarks(newData, userId);
- return readBookmarks(userId);
- }
-
- /**
- * @return true if there was some data to process
- */
- private boolean processSpoolToInbox(BookmarkFolder folder) {
- if (folder != null) {
- BookmarkFolder spoolFolder = folder.getFolder(Bookmark.SPOOL_FOLDER_NAME);
- if (spoolFolder != null) {
- BookmarkFolder inboxFolder = folder.getFolder(Bookmark.INBOX_FOLDER_NAME);
- if (inboxFolder == null) {
- inboxFolder = new BookmarkFolder();
- inboxFolder.setTitle(Bookmark.INBOX_FOLDER_NAME);
- folder.getFolders().add(0, inboxFolder);
- }
- inboxFolder.addBookmarks(spoolFolder, true, false);
- folder.getFolders().remove(spoolFolder);
- return true;
- }
- }
- return false;
- }
-
- @Override
- public void publishBookmarkData(BookmarkFolder publishFolder, Map<String, Object> targetGroup) throws ProcessingException {
- //default is empty
- }
-
- /**
- * default is <code>return ServerJob.getCurrentSession().getUserId();</code>
- */
- protected abstract Object getCurrentUserId();
-
- /**
- * add bookmarks to the publish folder of a user
- */
- protected void publishBookmarkDataToUser(BookmarkFolder publishFolder, Object userId) throws ProcessingException {
- if (userId != null) {
- BookmarkFolder userFolder = readUserFolder(userId);
- if (userFolder == null) {
- userFolder = new BookmarkFolder();
- }
- BookmarkFolder userSpool = userFolder.getFolder(Bookmark.SPOOL_FOLDER_NAME);
- if (userSpool == null) {
- userSpool = new BookmarkFolder();
- userSpool.setTitle(Bookmark.SPOOL_FOLDER_NAME);
- userFolder.getFolders().add(0, userSpool);
- }
- userSpool.addBookmarks(publishFolder, true, false);
- writeUserFolder(userFolder, userId);
- }
- }
-
- protected BookmarkData readBookmarks(Object userId) throws ProcessingException {
- BookmarkData model = new BookmarkData();
- //user
- BookmarkFolder folder = readUserFolder(userId);
- if (folder != null) {
- model.setUserBookmarks(folder);
- }
- //global
- if (ACCESS.check(new ReadGlobalBookmarkPermission())) {
- folder = readGlobalFolder();
- if (folder != null) {
- model.setGlobalBookmarks(folder);
- }
- }
- return model;
- }
-
- protected void writeBookmarks(BookmarkData model, Object userId) throws ProcessingException {
- //user
- if (ACCESS.check(new UpdateUserBookmarkPermission())) {
- writeUserFolder(model.getUserBookmarks(), userId);
- }
- //global
- if (ACCESS.check(new UpdateGlobalBookmarkPermission())) {
- writeGlobalFolder(model.getGlobalBookmarks());
- }
- }
-
- /**
- * read resource containing user folder
- */
- protected abstract BookmarkFolder readUserFolder(Object userId) throws ProcessingException;
-
- /**
- * read resource containing global folder
- */
- protected abstract BookmarkFolder readGlobalFolder() throws ProcessingException;
-
- /**
- * write resource containing user folder
- */
- protected abstract void writeUserFolder(BookmarkFolder folder, Object userId) throws ProcessingException;
-
- /**
- * read resource containing global folder
- */
- protected abstract void writeGlobalFolder(BookmarkFolder folder) throws ProcessingException;
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.bookmark;
+
+import java.util.Map;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.shared.security.ReadGlobalBookmarkPermission;
+import org.eclipse.scout.rt.shared.security.UpdateGlobalBookmarkPermission;
+import org.eclipse.scout.rt.shared.security.UpdateUserBookmarkPermission;
+import org.eclipse.scout.rt.shared.services.common.bookmark.Bookmark;
+import org.eclipse.scout.rt.shared.services.common.bookmark.BookmarkData;
+import org.eclipse.scout.rt.shared.services.common.bookmark.BookmarkFolder;
+import org.eclipse.scout.rt.shared.services.common.bookmark.IBookmarkStorageService;
+import org.eclipse.scout.rt.shared.services.common.security.ACCESS;
+import org.eclipse.scout.service.AbstractService;
+
+public abstract class AbstractBookmarkStorageService extends AbstractService implements IBookmarkStorageService {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractBookmarkStorageService.class);
+
+ public AbstractBookmarkStorageService() {
+ }
+
+ @Override
+ public BookmarkData getBookmarkData() throws ProcessingException {
+ Object userId = getCurrentUserId();
+ BookmarkData newData = readBookmarks(userId);
+ if (processSpoolToInbox(newData.getUserBookmarks())) {
+ writeUserFolder(newData.getUserBookmarks(), userId);
+ }
+ return newData;
+ }
+
+ @Override
+ public BookmarkData storeBookmarkData(BookmarkData newData) throws ProcessingException {
+ Object userId = getCurrentUserId();
+ BookmarkFolder existingUserFolder = readUserFolder(userId);
+ if (existingUserFolder != null) {
+ BookmarkFolder existingSpoolFolder = existingUserFolder.getFolder(Bookmark.SPOOL_FOLDER_NAME);
+ if (existingSpoolFolder != null) {
+ newData.getUserBookmarks().getFolders().add(existingSpoolFolder);
+ processSpoolToInbox(newData.getUserBookmarks());
+ }
+ }
+ writeBookmarks(newData, userId);
+ return readBookmarks(userId);
+ }
+
+ /**
+ * @return true if there was some data to process
+ */
+ private boolean processSpoolToInbox(BookmarkFolder folder) {
+ if (folder != null) {
+ BookmarkFolder spoolFolder = folder.getFolder(Bookmark.SPOOL_FOLDER_NAME);
+ if (spoolFolder != null) {
+ BookmarkFolder inboxFolder = folder.getFolder(Bookmark.INBOX_FOLDER_NAME);
+ if (inboxFolder == null) {
+ inboxFolder = new BookmarkFolder();
+ inboxFolder.setTitle(Bookmark.INBOX_FOLDER_NAME);
+ folder.getFolders().add(0, inboxFolder);
+ }
+ inboxFolder.addBookmarks(spoolFolder, true, false);
+ folder.getFolders().remove(spoolFolder);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public void publishBookmarkData(BookmarkFolder publishFolder, Map<String, Object> targetGroup) throws ProcessingException {
+ //default is empty
+ }
+
+ /**
+ * default is <code>return ServerJob.getCurrentSession().getUserId();</code>
+ */
+ protected abstract Object getCurrentUserId();
+
+ /**
+ * add bookmarks to the publish folder of a user
+ */
+ protected void publishBookmarkDataToUser(BookmarkFolder publishFolder, Object userId) throws ProcessingException {
+ if (userId != null) {
+ BookmarkFolder userFolder = readUserFolder(userId);
+ if (userFolder == null) {
+ userFolder = new BookmarkFolder();
+ }
+ BookmarkFolder userSpool = userFolder.getFolder(Bookmark.SPOOL_FOLDER_NAME);
+ if (userSpool == null) {
+ userSpool = new BookmarkFolder();
+ userSpool.setTitle(Bookmark.SPOOL_FOLDER_NAME);
+ userFolder.getFolders().add(0, userSpool);
+ }
+ userSpool.addBookmarks(publishFolder, true, false);
+ writeUserFolder(userFolder, userId);
+ }
+ }
+
+ protected BookmarkData readBookmarks(Object userId) throws ProcessingException {
+ BookmarkData model = new BookmarkData();
+ //user
+ BookmarkFolder folder = readUserFolder(userId);
+ if (folder != null) {
+ model.setUserBookmarks(folder);
+ }
+ //global
+ if (ACCESS.check(new ReadGlobalBookmarkPermission())) {
+ folder = readGlobalFolder();
+ if (folder != null) {
+ model.setGlobalBookmarks(folder);
+ }
+ }
+ return model;
+ }
+
+ protected void writeBookmarks(BookmarkData model, Object userId) throws ProcessingException {
+ //user
+ if (ACCESS.check(new UpdateUserBookmarkPermission())) {
+ writeUserFolder(model.getUserBookmarks(), userId);
+ }
+ //global
+ if (ACCESS.check(new UpdateGlobalBookmarkPermission())) {
+ writeGlobalFolder(model.getGlobalBookmarks());
+ }
+ }
+
+ /**
+ * read resource containing user folder
+ */
+ protected abstract BookmarkFolder readUserFolder(Object userId) throws ProcessingException;
+
+ /**
+ * read resource containing global folder
+ */
+ protected abstract BookmarkFolder readGlobalFolder() throws ProcessingException;
+
+ /**
+ * write resource containing user folder
+ */
+ protected abstract void writeUserFolder(BookmarkFolder folder, Object userId) throws ProcessingException;
+
+ /**
+ * read resource containing global folder
+ */
+ protected abstract void writeGlobalFolder(BookmarkFolder folder) throws ProcessingException;
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/bookmark/AbstractSqlBookmarkStorageService.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/bookmark/AbstractSqlBookmarkStorageService.java
index 75b2da1959..dd7421378e 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/bookmark/AbstractSqlBookmarkStorageService.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/bookmark/AbstractSqlBookmarkStorageService.java
@@ -1,270 +1,270 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.bookmark;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-
-import org.eclipse.scout.commons.annotations.ConfigOperation;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.shared.services.common.bookmark.BookmarkFolder;
-import org.eclipse.scout.rt.shared.services.common.bookmark.IBookmarkStorageService;
-
-/**
- * This service stores the bookmark data's 3 root folders as individial data records
- */
-public abstract class AbstractSqlBookmarkStorageService extends AbstractBookmarkStorageService implements IBookmarkStorageService {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractSqlBookmarkStorageService.class);
- private static final int KIND_MODEL = 99;
-
- /**
- * @return sql data with the following columns
- *
- * <pre>
- * ID NUMBER required
- * DATA BINARY BookmarkFolder object required
- * </pre>
- */
- @ConfigOperation
- @Order(10)
- protected Object[][] execSelectUserBookmarkFolder(Object userId) throws ProcessingException {
- return new Object[0][];
- }
-
- /**
- * @return sql data with the following columns
- *
- * <pre>
- * ID NUMBER required
- * DATA BINARY BookmarkFolder object required
- * </pre>
- */
- @ConfigOperation
- @Order(11)
- protected Object[][] execSelectGlobalBookmarkFolder() throws ProcessingException {
- return new Object[0][];
- }
-
- /**
- * <p>
- * The sql statement is created based on the 'folderData' and 'id' property of the model<br>
- *
- * <pre>
- * if (folderData != null) {
- * if (id == 0) {
- * //INSERT
- * }
- * else {
- * //UPDATE
- * }
- * }
- * else {
- * //DELETE
- * }
- * </pre>
- *
- * SQL Examples:
- *
- * <pre>
- * SQL.insert(
- * &quot;INSERT INTO BOOKMARKS(ID,BINARY) VALUES( SEQ.NEXTVAL, :kind, :folderData )&quot;,
- * new NVPair(&quot;folderData&quot;, folderData)
- * );
- *
- * SQL.update(
- * &quot;UPDATE BOOKMARKS SET BINARY=folderData WHERE ID=:id&quot;,
- * new NVPair(&quot;id&quot;, id),
- * new NVPair(&quot;folderData&quot;, folderData)
- * );
- *
- * SQL.delete(
- * &quot;DELETE FROM BOOKMARKS WHERE ID=:id&quot;,
- * new NVPair(&quot;id&quot;, id)
- * );
- * </pre>
- */
- @ConfigOperation
- @Order(20)
- protected void execStoreUserBookmarkFolder(Object userId, long id, byte[] folderData) throws ProcessingException {
- }
-
- /**
- * <p>
- * The sql statement is created based on the 'folderData' and 'id' property of the model<br>
- *
- * <pre>
- * if (folderData != null) {
- * if (id == 0) {
- * //INSERT
- * }
- * else {
- * //UPDATE
- * }
- * }
- * else {
- * //DELETE
- * }
- * </pre>
- *
- * SQL Examples:
- *
- * <pre>
- * SQL.insert(
- * &quot;INSERT INTO BOOKMARKS(ID,BINARY) VALUES( SEQ.NEXTVAL, :kind, :folderData )&quot;,
- * new NVPair(&quot;folderData&quot;, folderData)
- * );
- *
- * SQL.update(
- * &quot;UPDATE BOOKMARKS SET BINARY=folderData WHERE ID=:id&quot;,
- * new NVPair(&quot;id&quot;, id),
- * new NVPair(&quot;folderData&quot;, folderData)
- * );
- *
- * SQL.delete(
- * &quot;DELETE FROM BOOKMARKS WHERE ID=:id&quot;,
- * new NVPair(&quot;id&quot;, id)
- * );
- * </pre>
- */
- @ConfigOperation
- @Order(21)
- protected void execStoreGlobalBookmarkFolder(long id, byte[] folderData) throws ProcessingException {
- }
-
- /**
- * @param id
- * @param binary
- * data
- * @return the {@link BookmarkFolder} created by the binary data
- * @throws ProcessingException
- */
- @ConfigOperation
- @Order(30)
- protected BookmarkFolder execResolveBookmarkFolder(long id, Object binaryData) throws ProcessingException {
- ObjectInputStream oin = null;
- try {
- byte[] bytesResolved = (byte[]) binaryData;
- ByteArrayInputStream bin = new ByteArrayInputStream(bytesResolved);
- oin = new ObjectInputStream(bin);
- return (BookmarkFolder) oin.readObject();
- }
- catch (Throwable t) {
- //delete is also an option: execStoreBookmarkFolder(id, kind, null);
- throw new ProcessingException("loading object" + id, t);
- }
- finally {
- if (oin != null) {
- try {
- oin.close();
- }
- catch (Throwable t) {
- }
- }
- }
- }
-
- @Override
- protected BookmarkFolder readUserFolder(Object userId) throws ProcessingException {
- Object[][] data = execSelectUserBookmarkFolder(userId);
- for (int r = 0; r < data.length; r++) {
- Object[] row = data[r];
- long id = ((Number) row[0]).longValue();
- try {
- BookmarkFolder folder = execResolveBookmarkFolder(id, row[1]);
- if (folder != null) {
- folder.setId(id);
- return folder;
- }
- }
- catch (ProcessingException p) {
- LOG.warn("invalid bookmark folder binary data for id=" + id + ": " + p);
- }
- }
- return null;
- }
-
- @Override
- protected BookmarkFolder readGlobalFolder() throws ProcessingException {
- Object[][] data = execSelectGlobalBookmarkFolder();
- for (int r = 0; r < data.length; r++) {
- Object[] row = data[r];
- long id = ((Number) row[0]).longValue();
- try {
- BookmarkFolder folder = execResolveBookmarkFolder(id, row[1]);
- if (folder != null) {
- folder.setId(id);
- return folder;
- }
- }
- catch (ProcessingException p) {
- LOG.warn("invalid bookmark folder binary data for id=" + id + ": " + p);
- }
- }
- return null;
- }
-
- @Override
- protected void writeUserFolder(BookmarkFolder folder, Object userId) throws ProcessingException {
- ObjectOutputStream oout = null;
- try {
- ByteArrayOutputStream bout = new ByteArrayOutputStream();
- oout = new ObjectOutputStream(bout);
- oout.writeObject(folder);
- oout.close();
- oout = null;
- execStoreUserBookmarkFolder(userId, folder.getId(), bout.toByteArray());
- }
- catch (IOException e) {
- throw new ProcessingException("storing user bookmarks", e);
- }
- finally {
- if (oout != null) {
- try {
- oout.close();
- }
- catch (Throwable t) {
- }
- }
- }
- }
-
- @Override
- protected void writeGlobalFolder(BookmarkFolder folder) throws ProcessingException {
- ObjectOutputStream oout = null;
- try {
- ByteArrayOutputStream bout = new ByteArrayOutputStream();
- oout = new ObjectOutputStream(bout);
- oout.writeObject(folder);
- oout.close();
- oout = null;
- execStoreGlobalBookmarkFolder(folder.getId(), bout.toByteArray());
- }
- catch (IOException e) {
- throw new ProcessingException("storing global bookmarks", e);
- }
- finally {
- if (oout != null) {
- try {
- oout.close();
- }
- catch (Throwable t) {
- }
- }
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.bookmark;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+import org.eclipse.scout.commons.annotations.ConfigOperation;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.shared.services.common.bookmark.BookmarkFolder;
+import org.eclipse.scout.rt.shared.services.common.bookmark.IBookmarkStorageService;
+
+/**
+ * This service stores the bookmark data's 3 root folders as individial data records
+ */
+public abstract class AbstractSqlBookmarkStorageService extends AbstractBookmarkStorageService implements IBookmarkStorageService {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractSqlBookmarkStorageService.class);
+ private static final int KIND_MODEL = 99;
+
+ /**
+ * @return sql data with the following columns
+ *
+ * <pre>
+ * ID NUMBER required
+ * DATA BINARY BookmarkFolder object required
+ * </pre>
+ */
+ @ConfigOperation
+ @Order(10)
+ protected Object[][] execSelectUserBookmarkFolder(Object userId) throws ProcessingException {
+ return new Object[0][];
+ }
+
+ /**
+ * @return sql data with the following columns
+ *
+ * <pre>
+ * ID NUMBER required
+ * DATA BINARY BookmarkFolder object required
+ * </pre>
+ */
+ @ConfigOperation
+ @Order(11)
+ protected Object[][] execSelectGlobalBookmarkFolder() throws ProcessingException {
+ return new Object[0][];
+ }
+
+ /**
+ * <p>
+ * The sql statement is created based on the 'folderData' and 'id' property of the model<br>
+ *
+ * <pre>
+ * if (folderData != null) {
+ * if (id == 0) {
+ * //INSERT
+ * }
+ * else {
+ * //UPDATE
+ * }
+ * }
+ * else {
+ * //DELETE
+ * }
+ * </pre>
+ *
+ * SQL Examples:
+ *
+ * <pre>
+ * SQL.insert(
+ * &quot;INSERT INTO BOOKMARKS(ID,BINARY) VALUES( SEQ.NEXTVAL, :kind, :folderData )&quot;,
+ * new NVPair(&quot;folderData&quot;, folderData)
+ * );
+ *
+ * SQL.update(
+ * &quot;UPDATE BOOKMARKS SET BINARY=folderData WHERE ID=:id&quot;,
+ * new NVPair(&quot;id&quot;, id),
+ * new NVPair(&quot;folderData&quot;, folderData)
+ * );
+ *
+ * SQL.delete(
+ * &quot;DELETE FROM BOOKMARKS WHERE ID=:id&quot;,
+ * new NVPair(&quot;id&quot;, id)
+ * );
+ * </pre>
+ */
+ @ConfigOperation
+ @Order(20)
+ protected void execStoreUserBookmarkFolder(Object userId, long id, byte[] folderData) throws ProcessingException {
+ }
+
+ /**
+ * <p>
+ * The sql statement is created based on the 'folderData' and 'id' property of the model<br>
+ *
+ * <pre>
+ * if (folderData != null) {
+ * if (id == 0) {
+ * //INSERT
+ * }
+ * else {
+ * //UPDATE
+ * }
+ * }
+ * else {
+ * //DELETE
+ * }
+ * </pre>
+ *
+ * SQL Examples:
+ *
+ * <pre>
+ * SQL.insert(
+ * &quot;INSERT INTO BOOKMARKS(ID,BINARY) VALUES( SEQ.NEXTVAL, :kind, :folderData )&quot;,
+ * new NVPair(&quot;folderData&quot;, folderData)
+ * );
+ *
+ * SQL.update(
+ * &quot;UPDATE BOOKMARKS SET BINARY=folderData WHERE ID=:id&quot;,
+ * new NVPair(&quot;id&quot;, id),
+ * new NVPair(&quot;folderData&quot;, folderData)
+ * );
+ *
+ * SQL.delete(
+ * &quot;DELETE FROM BOOKMARKS WHERE ID=:id&quot;,
+ * new NVPair(&quot;id&quot;, id)
+ * );
+ * </pre>
+ */
+ @ConfigOperation
+ @Order(21)
+ protected void execStoreGlobalBookmarkFolder(long id, byte[] folderData) throws ProcessingException {
+ }
+
+ /**
+ * @param id
+ * @param binary
+ * data
+ * @return the {@link BookmarkFolder} created by the binary data
+ * @throws ProcessingException
+ */
+ @ConfigOperation
+ @Order(30)
+ protected BookmarkFolder execResolveBookmarkFolder(long id, Object binaryData) throws ProcessingException {
+ ObjectInputStream oin = null;
+ try {
+ byte[] bytesResolved = (byte[]) binaryData;
+ ByteArrayInputStream bin = new ByteArrayInputStream(bytesResolved);
+ oin = new ObjectInputStream(bin);
+ return (BookmarkFolder) oin.readObject();
+ }
+ catch (Throwable t) {
+ //delete is also an option: execStoreBookmarkFolder(id, kind, null);
+ throw new ProcessingException("loading object" + id, t);
+ }
+ finally {
+ if (oin != null) {
+ try {
+ oin.close();
+ }
+ catch (Throwable t) {
+ }
+ }
+ }
+ }
+
+ @Override
+ protected BookmarkFolder readUserFolder(Object userId) throws ProcessingException {
+ Object[][] data = execSelectUserBookmarkFolder(userId);
+ for (int r = 0; r < data.length; r++) {
+ Object[] row = data[r];
+ long id = ((Number) row[0]).longValue();
+ try {
+ BookmarkFolder folder = execResolveBookmarkFolder(id, row[1]);
+ if (folder != null) {
+ folder.setId(id);
+ return folder;
+ }
+ }
+ catch (ProcessingException p) {
+ LOG.warn("invalid bookmark folder binary data for id=" + id + ": " + p);
+ }
+ }
+ return null;
+ }
+
+ @Override
+ protected BookmarkFolder readGlobalFolder() throws ProcessingException {
+ Object[][] data = execSelectGlobalBookmarkFolder();
+ for (int r = 0; r < data.length; r++) {
+ Object[] row = data[r];
+ long id = ((Number) row[0]).longValue();
+ try {
+ BookmarkFolder folder = execResolveBookmarkFolder(id, row[1]);
+ if (folder != null) {
+ folder.setId(id);
+ return folder;
+ }
+ }
+ catch (ProcessingException p) {
+ LOG.warn("invalid bookmark folder binary data for id=" + id + ": " + p);
+ }
+ }
+ return null;
+ }
+
+ @Override
+ protected void writeUserFolder(BookmarkFolder folder, Object userId) throws ProcessingException {
+ ObjectOutputStream oout = null;
+ try {
+ ByteArrayOutputStream bout = new ByteArrayOutputStream();
+ oout = new ObjectOutputStream(bout);
+ oout.writeObject(folder);
+ oout.close();
+ oout = null;
+ execStoreUserBookmarkFolder(userId, folder.getId(), bout.toByteArray());
+ }
+ catch (IOException e) {
+ throw new ProcessingException("storing user bookmarks", e);
+ }
+ finally {
+ if (oout != null) {
+ try {
+ oout.close();
+ }
+ catch (Throwable t) {
+ }
+ }
+ }
+ }
+
+ @Override
+ protected void writeGlobalFolder(BookmarkFolder folder) throws ProcessingException {
+ ObjectOutputStream oout = null;
+ try {
+ ByteArrayOutputStream bout = new ByteArrayOutputStream();
+ oout = new ObjectOutputStream(bout);
+ oout.writeObject(folder);
+ oout.close();
+ oout = null;
+ execStoreGlobalBookmarkFolder(folder.getId(), bout.toByteArray());
+ }
+ catch (IOException e) {
+ throw new ProcessingException("storing global bookmarks", e);
+ }
+ finally {
+ if (oout != null) {
+ try {
+ oout.close();
+ }
+ catch (Throwable t) {
+ }
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/bookmark/FileSystemBookmarkStorageService.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/bookmark/FileSystemBookmarkStorageService.java
index 10958fd131..b073b7f20f 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/bookmark/FileSystemBookmarkStorageService.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/bookmark/FileSystemBookmarkStorageService.java
@@ -1,210 +1,210 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.bookmark;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Map;
-
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.server.ServerJob;
-import org.eclipse.scout.rt.shared.security.PublishUserBookmarkPermission;
-import org.eclipse.scout.rt.shared.security.UpdateUserBookmarkPermission;
-import org.eclipse.scout.rt.shared.services.common.bookmark.BookmarkFolder;
-import org.eclipse.scout.rt.shared.services.common.bookmark.IBookmarkStorageService;
-import org.eclipse.scout.rt.shared.services.common.file.IRemoteFileService;
-import org.eclipse.scout.rt.shared.services.common.file.RemoteFile;
-import org.eclipse.scout.rt.shared.services.common.security.ACCESS;
-import org.eclipse.scout.service.SERVICES;
-
-@Priority(-1)
-public class FileSystemBookmarkStorageService extends AbstractBookmarkStorageService implements IBookmarkStorageService {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(FileSystemBookmarkStorageService.class);
-
- public static final String GLOBAL_FILE_NAME = "all_users";
-
- public FileSystemBookmarkStorageService() {
- }
-
- /**
- * supports the targetGroup properties
- * <ul>
- * <li>userId Object</li>
- * <li>userIdList Collection of Object</li>
- * </ul>
- */
- @SuppressWarnings("unchecked")
- @Override
- public void publishBookmarkData(BookmarkFolder publishFolder, Map<String, Object> targetGroup) throws ProcessingException {
- if (!ACCESS.check(new PublishUserBookmarkPermission())) {
- throw new ProcessingException("Function denied", new SecurityException("Function denied"));
- }
- //
- HashSet<Object> set = new HashSet<Object>();
- Collection<Object> userIdList = (Collection<Object>) targetGroup.get("userIdList");
- if (userIdList != null) {
- for (Object userId : userIdList) {
- set.add(userId);
- }
- }
- Object userId = targetGroup.get("userId");
- if (userId != null) {
- set.add(userId);
- }
- for (Object id : set) {
- publishBookmarkDataToUser(publishFolder, id);
- }
- }
-
- @Override
- protected Object getCurrentUserId() {
- return ServerJob.getCurrentSession().getUserId();
- }
-
- @Override
- protected BookmarkFolder readUserFolder(Object userId) throws ProcessingException {
- String filename = userId + ".ser";
- RemoteFile spec = new RemoteFile("bookmarks", filename, 0);
- RemoteFile f = SERVICES.getService(IRemoteFileService.class).getRemoteFile(spec);
- if (f.exists()) {
- ObjectInputStream oin = null;
- try {
- byte[] bytes = f.extractData();
- oin = new ObjectInputStream(new ByteArrayInputStream(bytes));
- BookmarkFolder folder = (BookmarkFolder) oin.readObject();
- return folder;
- }
- catch (Throwable t) {
- LOG.error(null, t);
- }
- finally {
- if (oin != null) {
- try {
- oin.close();
- }
- catch (Throwable fatal) {
- }
- }
- }
- }
- return null;
- }
-
- @Override
- protected BookmarkFolder readGlobalFolder() throws ProcessingException {
- String filename = GLOBAL_FILE_NAME + ".ser";
- RemoteFile spec = new RemoteFile("bookmarks", filename, 0);
- RemoteFile f = SERVICES.getService(IRemoteFileService.class).getRemoteFile(spec);
- if (f.exists()) {
- ObjectInputStream oin = null;
- try {
- byte[] bytes = f.extractData();
- oin = new ObjectInputStream(new ByteArrayInputStream(bytes));
- BookmarkFolder folder = (BookmarkFolder) oin.readObject();
- return folder;
- }
- catch (Throwable t) {
- LOG.error(null, t);
- }
- finally {
- if (oin != null) {
- try {
- oin.close();
- }
- catch (Throwable fatal) {
- }
- }
- }
- }
- return null;
- }
-
- @Override
- protected void writeUserFolder(BookmarkFolder folder, Object userId) throws ProcessingException {
- ObjectOutputStream oout = null;
- byte[] bytes;
- try {
- if (ACCESS.check(new UpdateUserBookmarkPermission())) {
- ByteArrayOutputStream b = new ByteArrayOutputStream();
- oout = new ObjectOutputStream(b);
- oout.writeObject(folder);
- oout.close();
- oout = null;
- bytes = b.toByteArray();
- //
- String filename = userId + ".ser";
- RemoteFile spec = new RemoteFile("bookmarks", filename, 0);
- spec.readData(new ByteArrayInputStream(bytes));
- SERVICES.getService(IRemoteFileService.class).putRemoteFile(spec);
- }
- }
- catch (ProcessingException e) {
- throw e;
- }
- catch (IOException e) {
- throw new ProcessingException("", e);
- }
- finally {
- if (oout != null) {
- try {
- oout.close();
- }
- catch (Throwable fatal) {
- }
- }
- }
- }
-
- @Override
- protected void writeGlobalFolder(BookmarkFolder folder) throws ProcessingException {
- ObjectOutputStream oout = null;
- byte[] bytes;
- try {
- if (ACCESS.check(new UpdateUserBookmarkPermission())) {
- ByteArrayOutputStream b = new ByteArrayOutputStream();
- oout = new ObjectOutputStream(b);
- oout.writeObject(folder);
- oout.close();
- oout = null;
- bytes = b.toByteArray();
- //
- String filename = GLOBAL_FILE_NAME + ".ser";
- RemoteFile spec = new RemoteFile("bookmarks", filename, 0);
- spec.readData(new ByteArrayInputStream(bytes));
- SERVICES.getService(IRemoteFileService.class).putRemoteFile(spec);
- }
- }
- catch (ProcessingException e) {
- throw e;
- }
- catch (IOException e) {
- throw new ProcessingException("", e);
- }
- finally {
- if (oout != null) {
- try {
- oout.close();
- }
- catch (Throwable fatal) {
- }
- }
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.bookmark;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Map;
+
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.server.ServerJob;
+import org.eclipse.scout.rt.shared.security.PublishUserBookmarkPermission;
+import org.eclipse.scout.rt.shared.security.UpdateUserBookmarkPermission;
+import org.eclipse.scout.rt.shared.services.common.bookmark.BookmarkFolder;
+import org.eclipse.scout.rt.shared.services.common.bookmark.IBookmarkStorageService;
+import org.eclipse.scout.rt.shared.services.common.file.IRemoteFileService;
+import org.eclipse.scout.rt.shared.services.common.file.RemoteFile;
+import org.eclipse.scout.rt.shared.services.common.security.ACCESS;
+import org.eclipse.scout.service.SERVICES;
+
+@Priority(-1)
+public class FileSystemBookmarkStorageService extends AbstractBookmarkStorageService implements IBookmarkStorageService {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(FileSystemBookmarkStorageService.class);
+
+ public static final String GLOBAL_FILE_NAME = "all_users";
+
+ public FileSystemBookmarkStorageService() {
+ }
+
+ /**
+ * supports the targetGroup properties
+ * <ul>
+ * <li>userId Object</li>
+ * <li>userIdList Collection of Object</li>
+ * </ul>
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void publishBookmarkData(BookmarkFolder publishFolder, Map<String, Object> targetGroup) throws ProcessingException {
+ if (!ACCESS.check(new PublishUserBookmarkPermission())) {
+ throw new ProcessingException("Function denied", new SecurityException("Function denied"));
+ }
+ //
+ HashSet<Object> set = new HashSet<Object>();
+ Collection<Object> userIdList = (Collection<Object>) targetGroup.get("userIdList");
+ if (userIdList != null) {
+ for (Object userId : userIdList) {
+ set.add(userId);
+ }
+ }
+ Object userId = targetGroup.get("userId");
+ if (userId != null) {
+ set.add(userId);
+ }
+ for (Object id : set) {
+ publishBookmarkDataToUser(publishFolder, id);
+ }
+ }
+
+ @Override
+ protected Object getCurrentUserId() {
+ return ServerJob.getCurrentSession().getUserId();
+ }
+
+ @Override
+ protected BookmarkFolder readUserFolder(Object userId) throws ProcessingException {
+ String filename = userId + ".ser";
+ RemoteFile spec = new RemoteFile("bookmarks", filename, 0);
+ RemoteFile f = SERVICES.getService(IRemoteFileService.class).getRemoteFile(spec);
+ if (f.exists()) {
+ ObjectInputStream oin = null;
+ try {
+ byte[] bytes = f.extractData();
+ oin = new ObjectInputStream(new ByteArrayInputStream(bytes));
+ BookmarkFolder folder = (BookmarkFolder) oin.readObject();
+ return folder;
+ }
+ catch (Throwable t) {
+ LOG.error(null, t);
+ }
+ finally {
+ if (oin != null) {
+ try {
+ oin.close();
+ }
+ catch (Throwable fatal) {
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ @Override
+ protected BookmarkFolder readGlobalFolder() throws ProcessingException {
+ String filename = GLOBAL_FILE_NAME + ".ser";
+ RemoteFile spec = new RemoteFile("bookmarks", filename, 0);
+ RemoteFile f = SERVICES.getService(IRemoteFileService.class).getRemoteFile(spec);
+ if (f.exists()) {
+ ObjectInputStream oin = null;
+ try {
+ byte[] bytes = f.extractData();
+ oin = new ObjectInputStream(new ByteArrayInputStream(bytes));
+ BookmarkFolder folder = (BookmarkFolder) oin.readObject();
+ return folder;
+ }
+ catch (Throwable t) {
+ LOG.error(null, t);
+ }
+ finally {
+ if (oin != null) {
+ try {
+ oin.close();
+ }
+ catch (Throwable fatal) {
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ @Override
+ protected void writeUserFolder(BookmarkFolder folder, Object userId) throws ProcessingException {
+ ObjectOutputStream oout = null;
+ byte[] bytes;
+ try {
+ if (ACCESS.check(new UpdateUserBookmarkPermission())) {
+ ByteArrayOutputStream b = new ByteArrayOutputStream();
+ oout = new ObjectOutputStream(b);
+ oout.writeObject(folder);
+ oout.close();
+ oout = null;
+ bytes = b.toByteArray();
+ //
+ String filename = userId + ".ser";
+ RemoteFile spec = new RemoteFile("bookmarks", filename, 0);
+ spec.readData(new ByteArrayInputStream(bytes));
+ SERVICES.getService(IRemoteFileService.class).putRemoteFile(spec);
+ }
+ }
+ catch (ProcessingException e) {
+ throw e;
+ }
+ catch (IOException e) {
+ throw new ProcessingException("", e);
+ }
+ finally {
+ if (oout != null) {
+ try {
+ oout.close();
+ }
+ catch (Throwable fatal) {
+ }
+ }
+ }
+ }
+
+ @Override
+ protected void writeGlobalFolder(BookmarkFolder folder) throws ProcessingException {
+ ObjectOutputStream oout = null;
+ byte[] bytes;
+ try {
+ if (ACCESS.check(new UpdateUserBookmarkPermission())) {
+ ByteArrayOutputStream b = new ByteArrayOutputStream();
+ oout = new ObjectOutputStream(b);
+ oout.writeObject(folder);
+ oout.close();
+ oout = null;
+ bytes = b.toByteArray();
+ //
+ String filename = GLOBAL_FILE_NAME + ".ser";
+ RemoteFile spec = new RemoteFile("bookmarks", filename, 0);
+ spec.readData(new ByteArrayInputStream(bytes));
+ SERVICES.getService(IRemoteFileService.class).putRemoteFile(spec);
+ }
+ }
+ catch (ProcessingException e) {
+ throw e;
+ }
+ catch (IOException e) {
+ throw new ProcessingException("", e);
+ }
+ finally {
+ if (oout != null) {
+ try {
+ oout.close();
+ }
+ catch (Throwable fatal) {
+ }
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/calendar/HolidayCalendarService.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/calendar/HolidayCalendarService.java
index 9c9fcc1fd9..3c72c641c7 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/calendar/HolidayCalendarService.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/calendar/HolidayCalendarService.java
@@ -1,66 +1,66 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.calendar;
-
-import java.util.Date;
-
-import org.eclipse.scout.commons.LocaleThreadLocal;
-import org.eclipse.scout.commons.TTLCache;
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.shared.services.common.calendar.HolidayCalendarItemParser;
-import org.eclipse.scout.rt.shared.services.common.calendar.ICalendarItem;
-import org.eclipse.scout.rt.shared.services.common.calendar.IHolidayCalendarService;
-import org.eclipse.scout.rt.shared.services.common.file.IRemoteFileService;
-import org.eclipse.scout.rt.shared.services.common.file.RemoteFile;
-import org.eclipse.scout.service.AbstractService;
-import org.eclipse.scout.service.SERVICES;
-
-/**
- * For details see {@link HolidayCalendarItemParser}
- */
-@Priority(-1)
-public class HolidayCalendarService extends AbstractService implements IHolidayCalendarService {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(HolidayCalendarService.class);
-
- private TTLCache<String/* resourceFileName */, HolidayCalendarItemParser> m_holidayXmlCache = new TTLCache<String, HolidayCalendarItemParser>(5 * 60000L);// 5
-
- // minutes
-
- @Override
- public ICalendarItem[] getItems(RemoteFile spec, Date minDate, Date maxDate) throws ProcessingException {
- // load new items
- HolidayCalendarItemParser p = null;
- String key = spec.getPath();
- synchronized (m_holidayXmlCache) {
- if (m_holidayXmlCache.containsKey(key)) {
- p = m_holidayXmlCache.get(key);
- }
- else {
- RemoteFile f = null;
- try {
- f = SERVICES.getService(IRemoteFileService.class).getRemoteFile(spec);
- if (f != null) {
- p = new HolidayCalendarItemParser(f.getDecompressedInputStream(), spec.getPath());
- m_holidayXmlCache.put(key, p);
- }
- }
- catch (Exception e) {
- LOG.warn("parsing remote file:" + spec, e);
- }
- }
- }
- return p != null ? p.getItems(LocaleThreadLocal.get(), minDate, maxDate) : new ICalendarItem[0];
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.calendar;
+
+import java.util.Date;
+
+import org.eclipse.scout.commons.LocaleThreadLocal;
+import org.eclipse.scout.commons.TTLCache;
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.shared.services.common.calendar.HolidayCalendarItemParser;
+import org.eclipse.scout.rt.shared.services.common.calendar.ICalendarItem;
+import org.eclipse.scout.rt.shared.services.common.calendar.IHolidayCalendarService;
+import org.eclipse.scout.rt.shared.services.common.file.IRemoteFileService;
+import org.eclipse.scout.rt.shared.services.common.file.RemoteFile;
+import org.eclipse.scout.service.AbstractService;
+import org.eclipse.scout.service.SERVICES;
+
+/**
+ * For details see {@link HolidayCalendarItemParser}
+ */
+@Priority(-1)
+public class HolidayCalendarService extends AbstractService implements IHolidayCalendarService {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(HolidayCalendarService.class);
+
+ private TTLCache<String/* resourceFileName */, HolidayCalendarItemParser> m_holidayXmlCache = new TTLCache<String, HolidayCalendarItemParser>(5 * 60000L);// 5
+
+ // minutes
+
+ @Override
+ public ICalendarItem[] getItems(RemoteFile spec, Date minDate, Date maxDate) throws ProcessingException {
+ // load new items
+ HolidayCalendarItemParser p = null;
+ String key = spec.getPath();
+ synchronized (m_holidayXmlCache) {
+ if (m_holidayXmlCache.containsKey(key)) {
+ p = m_holidayXmlCache.get(key);
+ }
+ else {
+ RemoteFile f = null;
+ try {
+ f = SERVICES.getService(IRemoteFileService.class).getRemoteFile(spec);
+ if (f != null) {
+ p = new HolidayCalendarItemParser(f.getDecompressedInputStream(), spec.getPath());
+ m_holidayXmlCache.put(key, p);
+ }
+ }
+ catch (Exception e) {
+ LOG.warn("parsing remote file:" + spec, e);
+ }
+ }
+ }
+ return p != null ? p.getItems(LocaleThreadLocal.get(), minDate, maxDate) : new ICalendarItem[0];
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/clientnotification/AllUserFilter.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/clientnotification/AllUserFilter.java
index f4b9caf495..fc3c6e75ab 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/clientnotification/AllUserFilter.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/clientnotification/AllUserFilter.java
@@ -1,64 +1,64 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.clientnotification;
-
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-/**
- * Filter to broadcast a notification to all users
- */
-public class AllUserFilter implements IClientNotificationFilter {
- private static final long serialVersionUID = 1L;
- private long m_validUntil;
-
- public AllUserFilter(long timeout) {
- m_validUntil = System.currentTimeMillis() + timeout;
- }
-
- @Override
- public boolean isActive() {
- return System.currentTimeMillis() <= m_validUntil;
- }
-
- @Override
- public boolean isMulticast() {
- return true;
- }
-
- @Override
- public boolean accept() {
- return true;
- }
-
- @Override
- public int hashCode() {
- return 0;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == null) {
- return false;
- }
- return obj.getClass() == this.getClass();
- }
-
- @Override
- public String toString() {
- StringBuffer b = new StringBuffer(getClass().getSimpleName());
- b.append("[");
- b.append("validUntil=" + new SimpleDateFormat("HH:mm:ss.SSS").format(new Date(m_validUntil)));
- b.append("]");
- return b.toString();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.clientnotification;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+/**
+ * Filter to broadcast a notification to all users
+ */
+public class AllUserFilter implements IClientNotificationFilter {
+ private static final long serialVersionUID = 1L;
+ private long m_validUntil;
+
+ public AllUserFilter(long timeout) {
+ m_validUntil = System.currentTimeMillis() + timeout;
+ }
+
+ @Override
+ public boolean isActive() {
+ return System.currentTimeMillis() <= m_validUntil;
+ }
+
+ @Override
+ public boolean isMulticast() {
+ return true;
+ }
+
+ @Override
+ public boolean accept() {
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return 0;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == null) {
+ return false;
+ }
+ return obj.getClass() == this.getClass();
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer b = new StringBuffer(getClass().getSimpleName());
+ b.append("[");
+ b.append("validUntil=" + new SimpleDateFormat("HH:mm:ss.SSS").format(new Date(m_validUntil)));
+ b.append("]");
+ return b.toString();
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/clientnotification/ClientNotificationQueueEvent.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/clientnotification/ClientNotificationQueueEvent.java
index ea47bdcbfe..9c764cdf4b 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/clientnotification/ClientNotificationQueueEvent.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/clientnotification/ClientNotificationQueueEvent.java
@@ -1,43 +1,43 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.clientnotification;
-
-import java.io.Serializable;
-
-import org.eclipse.scout.rt.shared.services.common.clientnotification.IClientNotification;
-
-public class ClientNotificationQueueEvent implements Serializable {
- private static final long serialVersionUID = 1L;
-
- public static final int TYPE_NOTIFICATION_ADDED = 10;
-
- private int m_type;
- private IClientNotification m_notification;
- private IClientNotificationFilter m_filter;
-
- public ClientNotificationQueueEvent(IClientNotification notification, IClientNotificationFilter filter, int type) {
- m_notification = notification;
- m_filter = filter;
- m_type = type;
- }
-
- public int getType() {
- return m_type;
- }
-
- public IClientNotification getNotification() {
- return m_notification;
- }
-
- public IClientNotificationFilter getFilter() {
- return m_filter;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.clientnotification;
+
+import java.io.Serializable;
+
+import org.eclipse.scout.rt.shared.services.common.clientnotification.IClientNotification;
+
+public class ClientNotificationQueueEvent implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ public static final int TYPE_NOTIFICATION_ADDED = 10;
+
+ private int m_type;
+ private IClientNotification m_notification;
+ private IClientNotificationFilter m_filter;
+
+ public ClientNotificationQueueEvent(IClientNotification notification, IClientNotificationFilter filter, int type) {
+ m_notification = notification;
+ m_filter = filter;
+ m_type = type;
+ }
+
+ public int getType() {
+ return m_type;
+ }
+
+ public IClientNotification getNotification() {
+ return m_notification;
+ }
+
+ public IClientNotificationFilter getFilter() {
+ return m_filter;
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/clientnotification/IClientNotificationFilter.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/clientnotification/IClientNotificationFilter.java
index 9ce966c565..46812140c5 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/clientnotification/IClientNotificationFilter.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/clientnotification/IClientNotificationFilter.java
@@ -1,61 +1,61 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.clientnotification;
-
-import java.io.Serializable;
-
-import org.eclipse.scout.rt.server.services.common.clientnotification.internal.ClientNotificationQueue;
-import org.eclipse.scout.rt.shared.services.common.clientnotification.IClientNotification;
-
-/**
- * Filter to add a {@link org.eclipse.scout.rt.shared.services.common.clientnotification.IClientNotification} to the
- * {@link ClientNotificationQueue} <br>
- * The filter is only used on the server side, it is not sent to the client
- * <p>
- * Make sure to implement the {@link #hashCode()} and {@link #equals(Object)} method of the filter to allow for
- * {@link IClientNotification#coalesce(IClientNotification)}
- */
-public interface IClientNotificationFilter extends Serializable {
-
- /**
- * @return true if notification is still valid and has not timed out <br>
- * The notification is discarded when deactivated. In case the
- * notification started already it is normally finished.
- * <p>
- * This method is used on the server side
- */
- boolean isActive();
-
- /**
- * @return true if notification is mutlicast <br>
- * A multicast notification can be sent to multiple consumers
- * (clients) until it becomes inactive <br>
- * A singlecast notification is discarded once it has been fetched by
- * a client <br>
- * Most notifications are singlecast.
- * <p>
- * This method is used on the server side
- */
- boolean isMulticast();
-
- /**
- * @return true if the notification should be delivered to the session's
- * frontend <br>
- * If this is a multicast notification, it remains queued until it is
- * deativated <br>
- * If this is a singlecast notification it is removed after it
- * returned true for at least one session
- * <p>
- * This method is used on the server side, so you can get the server session with
- * ThreadContext.getServerSession()
- */
- boolean accept();
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.clientnotification;
+
+import java.io.Serializable;
+
+import org.eclipse.scout.rt.server.services.common.clientnotification.internal.ClientNotificationQueue;
+import org.eclipse.scout.rt.shared.services.common.clientnotification.IClientNotification;
+
+/**
+ * Filter to add a {@link org.eclipse.scout.rt.shared.services.common.clientnotification.IClientNotification} to the
+ * {@link ClientNotificationQueue} <br>
+ * The filter is only used on the server side, it is not sent to the client
+ * <p>
+ * Make sure to implement the {@link #hashCode()} and {@link #equals(Object)} method of the filter to allow for
+ * {@link IClientNotification#coalesce(IClientNotification)}
+ */
+public interface IClientNotificationFilter extends Serializable {
+
+ /**
+ * @return true if notification is still valid and has not timed out <br>
+ * The notification is discarded when deactivated. In case the
+ * notification started already it is normally finished.
+ * <p>
+ * This method is used on the server side
+ */
+ boolean isActive();
+
+ /**
+ * @return true if notification is mutlicast <br>
+ * A multicast notification can be sent to multiple consumers
+ * (clients) until it becomes inactive <br>
+ * A singlecast notification is discarded once it has been fetched by
+ * a client <br>
+ * Most notifications are singlecast.
+ * <p>
+ * This method is used on the server side
+ */
+ boolean isMulticast();
+
+ /**
+ * @return true if the notification should be delivered to the session's
+ * frontend <br>
+ * If this is a multicast notification, it remains queued until it is
+ * deativated <br>
+ * If this is a singlecast notification it is removed after it
+ * returned true for at least one session
+ * <p>
+ * This method is used on the server side, so you can get the server session with
+ * ThreadContext.getServerSession()
+ */
+ boolean accept();
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/clientnotification/IClientNotificationQueueListener.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/clientnotification/IClientNotificationQueueListener.java
index b27fb5e2a4..f28e6cc947 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/clientnotification/IClientNotificationQueueListener.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/clientnotification/IClientNotificationQueueListener.java
@@ -1,19 +1,19 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.clientnotification;
-
-import java.util.EventListener;
-
-public interface IClientNotificationQueueListener extends EventListener {
-
- void queueChanged(ClientNotificationQueueEvent event);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.clientnotification;
+
+import java.util.EventListener;
+
+public interface IClientNotificationQueueListener extends EventListener {
+
+ void queueChanged(ClientNotificationQueueEvent event);
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/clientnotification/IClientNotificationService.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/clientnotification/IClientNotificationService.java
index 2a1d7b7032..77d855d18f 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/clientnotification/IClientNotificationService.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/clientnotification/IClientNotificationService.java
@@ -1,40 +1,40 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.clientnotification;
-
-import org.eclipse.scout.rt.shared.services.common.clientnotification.IClientNotification;
-import org.eclipse.scout.service.IService;
-
-public interface IClientNotificationService extends IService {
-
- /**
- * this methods will be called asynchronous, there is no session available but
- * a proxyHandler is.
- */
- IClientNotification[] getNextNotifications(long blockingTimeout);
-
- /**
- * Put a notification to the queue on the server. <br>
- * The notification is enqueued in XA-transaction first and will be put in the
- * global-queue after the commit of the XA-transaction.
- * <p>
- * Please consider, that the accept method of the filter is launched in server session thread and the run method of
- * the notification is launched in client session thread.
- *
- * @param notification
- * @param filter
- */
- void putNotification(IClientNotification notification, IClientNotificationFilter filter);
-
- void addClientNotificationQueueListener(IClientNotificationQueueListener listener);
-
- void removeClientNotificationQueueListener(IClientNotificationQueueListener listener);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.clientnotification;
+
+import org.eclipse.scout.rt.shared.services.common.clientnotification.IClientNotification;
+import org.eclipse.scout.service.IService;
+
+public interface IClientNotificationService extends IService {
+
+ /**
+ * this methods will be called asynchronous, there is no session available but
+ * a proxyHandler is.
+ */
+ IClientNotification[] getNextNotifications(long blockingTimeout);
+
+ /**
+ * Put a notification to the queue on the server. <br>
+ * The notification is enqueued in XA-transaction first and will be put in the
+ * global-queue after the commit of the XA-transaction.
+ * <p>
+ * Please consider, that the accept method of the filter is launched in server session thread and the run method of
+ * the notification is launched in client session thread.
+ *
+ * @param notification
+ * @param filter
+ */
+ void putNotification(IClientNotification notification, IClientNotificationFilter filter);
+
+ void addClientNotificationQueueListener(IClientNotificationQueueListener listener);
+
+ void removeClientNotificationQueueListener(IClientNotificationQueueListener listener);
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/clientnotification/PrincipalNameFilter.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/clientnotification/PrincipalNameFilter.java
index 08b2a38b40..64d2ffe60f 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/clientnotification/PrincipalNameFilter.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/clientnotification/PrincipalNameFilter.java
@@ -1,102 +1,102 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.clientnotification;
-
-import java.security.AccessController;
-import java.security.Principal;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import javax.security.auth.Subject;
-
-/**
- * <p>
- * Filter used to send notifications to users owning any of the principal names (case insensitive) in their subject
- * </p>
- * <p>
- * This is a value object.
- * </p>
- */
-public class PrincipalNameFilter implements IClientNotificationFilter {
- private static final long serialVersionUID = 1L;
- private final String m_principalName;
- private final long m_validUntil;
-
- /**
- * @param principalName
- * case insensitive
- * @param timeout
- */
- public PrincipalNameFilter(String principalName, long timeout) {
- if (principalName != null) {
- m_principalName = principalName.toLowerCase();
- }
- else {
- m_principalName = null;
- }
-
- m_validUntil = System.currentTimeMillis() + timeout;
- }
-
- @Override
- public boolean isActive() {
- return System.currentTimeMillis() <= m_validUntil;
- }
-
- @Override
- public boolean isMulticast() {
- return true;
- }
-
- public String getPrincipalName() {
- return m_principalName;
- }
-
- @Override
- public boolean accept() {
- Subject subject = Subject.getSubject(AccessController.getContext());
- if (subject != null) {
- for (Principal principal : subject.getPrincipals()) {
- if (principal != null && m_principalName.equalsIgnoreCase(principal.getName())) {
- return true;
- }
- }
- }
- return false;
- }
-
- @Override
- public int hashCode() {
- return m_principalName != null ? m_principalName.hashCode() : 0;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == null) {
- return false;
- }
- if (obj.getClass() == this.getClass()) {
- PrincipalNameFilter o = (PrincipalNameFilter) obj;
- return o.m_principalName == this.m_principalName || (o.m_principalName != null && o.m_principalName.equals(this.m_principalName));
- }
- return false;
- }
-
- @Override
- public String toString() {
- StringBuffer b = new StringBuffer(getClass().getSimpleName());
- b.append("[");
- b.append(m_principalName);
- b.append(", validUntil=" + new SimpleDateFormat("HH:mm:ss.SSS").format(new Date(m_validUntil)));
- b.append("]");
- return b.toString();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.clientnotification;
+
+import java.security.AccessController;
+import java.security.Principal;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import javax.security.auth.Subject;
+
+/**
+ * <p>
+ * Filter used to send notifications to users owning any of the principal names (case insensitive) in their subject
+ * </p>
+ * <p>
+ * This is a value object.
+ * </p>
+ */
+public class PrincipalNameFilter implements IClientNotificationFilter {
+ private static final long serialVersionUID = 1L;
+ private final String m_principalName;
+ private final long m_validUntil;
+
+ /**
+ * @param principalName
+ * case insensitive
+ * @param timeout
+ */
+ public PrincipalNameFilter(String principalName, long timeout) {
+ if (principalName != null) {
+ m_principalName = principalName.toLowerCase();
+ }
+ else {
+ m_principalName = null;
+ }
+
+ m_validUntil = System.currentTimeMillis() + timeout;
+ }
+
+ @Override
+ public boolean isActive() {
+ return System.currentTimeMillis() <= m_validUntil;
+ }
+
+ @Override
+ public boolean isMulticast() {
+ return true;
+ }
+
+ public String getPrincipalName() {
+ return m_principalName;
+ }
+
+ @Override
+ public boolean accept() {
+ Subject subject = Subject.getSubject(AccessController.getContext());
+ if (subject != null) {
+ for (Principal principal : subject.getPrincipals()) {
+ if (principal != null && m_principalName.equalsIgnoreCase(principal.getName())) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return m_principalName != null ? m_principalName.hashCode() : 0;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == null) {
+ return false;
+ }
+ if (obj.getClass() == this.getClass()) {
+ PrincipalNameFilter o = (PrincipalNameFilter) obj;
+ return o.m_principalName == this.m_principalName || (o.m_principalName != null && o.m_principalName.equals(this.m_principalName));
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer b = new StringBuffer(getClass().getSimpleName());
+ b.append("[");
+ b.append(m_principalName);
+ b.append(", validUntil=" + new SimpleDateFormat("HH:mm:ss.SSS").format(new Date(m_validUntil)));
+ b.append("]");
+ return b.toString();
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/clientnotification/SessionFilter.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/clientnotification/SessionFilter.java
index 483846a740..45d1495e48 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/clientnotification/SessionFilter.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/clientnotification/SessionFilter.java
@@ -1,78 +1,78 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.clientnotification;
-
-import java.lang.ref.WeakReference;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import org.eclipse.scout.rt.server.IServerSession;
-import org.eclipse.scout.rt.server.ThreadContext;
-
-/**
- * Filter to send a notification to a specific session
- */
-public class SessionFilter implements IClientNotificationFilter {
- private static final long serialVersionUID = 1L;
- private transient WeakReference<IServerSession> m_sessionRef;
- private long m_validUntil;
-
- public SessionFilter(IServerSession session, long timeout) {
- m_sessionRef = new WeakReference<IServerSession>(session);
- m_validUntil = System.currentTimeMillis() + timeout;
- }
-
- @Override
- public boolean isActive() {
- return m_sessionRef != null && m_sessionRef.get() != null && System.currentTimeMillis() <= m_validUntil;
- }
-
- @Override
- public boolean isMulticast() {
- return false;
- }
-
- @Override
- public boolean accept() {
- return m_sessionRef != null && ThreadContext.getServerSession() == m_sessionRef.get();
- }
-
- @Override
- public int hashCode() {
- IServerSession session = m_sessionRef.get();
- return session != null ? session.hashCode() : 0;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == null) {
- return false;
- }
- if (obj.getClass() == this.getClass()) {
- SessionFilter o = (SessionFilter) obj;
- return o.m_sessionRef.get() == this.m_sessionRef.get();
- }
- return false;
- }
-
- @Override
- public String toString() {
- StringBuffer b = new StringBuffer(getClass().getSimpleName());
- b.append("[");
- if (m_sessionRef != null) {
- b.append(m_sessionRef.get());
- }
- b.append(", validUntil=" + new SimpleDateFormat("HH:mm:ss.SSS").format(new Date(m_validUntil)));
- b.append("]");
- return b.toString();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.clientnotification;
+
+import java.lang.ref.WeakReference;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.eclipse.scout.rt.server.IServerSession;
+import org.eclipse.scout.rt.server.ThreadContext;
+
+/**
+ * Filter to send a notification to a specific session
+ */
+public class SessionFilter implements IClientNotificationFilter {
+ private static final long serialVersionUID = 1L;
+ private transient WeakReference<IServerSession> m_sessionRef;
+ private long m_validUntil;
+
+ public SessionFilter(IServerSession session, long timeout) {
+ m_sessionRef = new WeakReference<IServerSession>(session);
+ m_validUntil = System.currentTimeMillis() + timeout;
+ }
+
+ @Override
+ public boolean isActive() {
+ return m_sessionRef != null && m_sessionRef.get() != null && System.currentTimeMillis() <= m_validUntil;
+ }
+
+ @Override
+ public boolean isMulticast() {
+ return false;
+ }
+
+ @Override
+ public boolean accept() {
+ return m_sessionRef != null && ThreadContext.getServerSession() == m_sessionRef.get();
+ }
+
+ @Override
+ public int hashCode() {
+ IServerSession session = m_sessionRef.get();
+ return session != null ? session.hashCode() : 0;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == null) {
+ return false;
+ }
+ if (obj.getClass() == this.getClass()) {
+ SessionFilter o = (SessionFilter) obj;
+ return o.m_sessionRef.get() == this.m_sessionRef.get();
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer b = new StringBuffer(getClass().getSimpleName());
+ b.append("[");
+ if (m_sessionRef != null) {
+ b.append(m_sessionRef.get());
+ }
+ b.append(", validUntil=" + new SimpleDateFormat("HH:mm:ss.SSS").format(new Date(m_validUntil)));
+ b.append("]");
+ return b.toString();
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/clientnotification/SingleUserFilter.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/clientnotification/SingleUserFilter.java
index 19096a0924..08fccf84ee 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/clientnotification/SingleUserFilter.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/clientnotification/SingleUserFilter.java
@@ -1,76 +1,76 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.clientnotification;
-
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import org.eclipse.scout.rt.server.ThreadContext;
-
-/**
- * Filter to send a notification to a specific user
- */
-public class SingleUserFilter implements IClientNotificationFilter {
- private static final long serialVersionUID = 1L;
- private String m_userId;
- private long m_validUntil;
-
- public SingleUserFilter(String userId, long timeout) {
- m_userId = userId;
- m_validUntil = System.currentTimeMillis() + timeout;
- }
-
- public String getUserId() {
- return m_userId;
- }
-
- @Override
- public boolean isActive() {
- return System.currentTimeMillis() <= m_validUntil;
- }
-
- @Override
- public boolean isMulticast() {
- return false;
- }
-
- @Override
- public boolean accept() {
- return m_userId != null && m_userId.equalsIgnoreCase(ThreadContext.getServerSession().getUserId());
- }
-
- @Override
- public int hashCode() {
- return m_userId != null ? m_userId.hashCode() : 0;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == null) {
- return false;
- }
- if (obj.getClass() == this.getClass()) {
- SingleUserFilter o = (SingleUserFilter) obj;
- return o.m_userId == this.m_userId || (o.m_userId != null && o.m_userId.equals(this.m_userId));
- }
- return false;
- }
-
- @Override
- public String toString() {
- StringBuffer b = new StringBuffer(getClass().getSimpleName());
- b.append("[");
- b.append(m_userId);
- b.append(", validUntil=" + new SimpleDateFormat("HH:mm:ss.SSS").format(new Date(m_validUntil)));
- b.append("]");
- return b.toString();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.clientnotification;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.eclipse.scout.rt.server.ThreadContext;
+
+/**
+ * Filter to send a notification to a specific user
+ */
+public class SingleUserFilter implements IClientNotificationFilter {
+ private static final long serialVersionUID = 1L;
+ private String m_userId;
+ private long m_validUntil;
+
+ public SingleUserFilter(String userId, long timeout) {
+ m_userId = userId;
+ m_validUntil = System.currentTimeMillis() + timeout;
+ }
+
+ public String getUserId() {
+ return m_userId;
+ }
+
+ @Override
+ public boolean isActive() {
+ return System.currentTimeMillis() <= m_validUntil;
+ }
+
+ @Override
+ public boolean isMulticast() {
+ return false;
+ }
+
+ @Override
+ public boolean accept() {
+ return m_userId != null && m_userId.equalsIgnoreCase(ThreadContext.getServerSession().getUserId());
+ }
+
+ @Override
+ public int hashCode() {
+ return m_userId != null ? m_userId.hashCode() : 0;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == null) {
+ return false;
+ }
+ if (obj.getClass() == this.getClass()) {
+ SingleUserFilter o = (SingleUserFilter) obj;
+ return o.m_userId == this.m_userId || (o.m_userId != null && o.m_userId.equals(this.m_userId));
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer b = new StringBuffer(getClass().getSimpleName());
+ b.append("[");
+ b.append(m_userId);
+ b.append(", validUntil=" + new SimpleDateFormat("HH:mm:ss.SSS").format(new Date(m_validUntil)));
+ b.append("]");
+ return b.toString();
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/clientnotification/internal/ClientNotificationQueue.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/clientnotification/internal/ClientNotificationQueue.java
index a764e251f6..baf2c5327b 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/clientnotification/internal/ClientNotificationQueue.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/clientnotification/internal/ClientNotificationQueue.java
@@ -1,191 +1,191 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.clientnotification.internal;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.WeakHashMap;
-
-import org.eclipse.scout.commons.EventListenerList;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.server.IServerSession;
-import org.eclipse.scout.rt.server.ThreadContext;
-import org.eclipse.scout.rt.server.services.common.clientnotification.ClientNotificationQueueEvent;
-import org.eclipse.scout.rt.server.services.common.clientnotification.IClientNotificationFilter;
-import org.eclipse.scout.rt.server.services.common.clientnotification.IClientNotificationQueueListener;
-import org.eclipse.scout.rt.shared.services.common.clientnotification.IClientNotification;
-
-/**
- * element type used in CTIStateCache
- */
-public class ClientNotificationQueue {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(ClientNotificationQueue.class);
- private EventListenerList m_listenerList = new EventListenerList();
-
- private LinkedList<QueueElement> m_queue;
- private Object m_queueLock = new Object();
-
- public ClientNotificationQueue() {
- m_queue = new LinkedList<QueueElement>();
- }
-
- public void putNotification(IClientNotification notification, IClientNotificationFilter filter) {
- if (notification == null) {
- throw new IllegalArgumentException("notification must not be null");
- }
- if (filter == null) {
- throw new IllegalArgumentException("filter must not be null");
- }
- if (LOG.isDebugEnabled()) {
- LOG.debug("put " + notification + " for " + filter);
- }
- synchronized (m_queueLock) {
- for (Iterator<QueueElement> it = m_queue.iterator(); it.hasNext();) {
- QueueElement e = it.next();
- if (!e.getFilter().isActive()) {
- it.remove();
- }
- else if (e.getClientNotification() == notification) {
- it.remove();
- }
- else if (e.getClientNotification().getClass() == notification.getClass() && filter.equals(e.getFilter()) && notification.coalesce(e.getClientNotification())) {
- it.remove();
- }
- }
- m_queue.add(new QueueElement(notification, filter));
- m_queueLock.notifyAll();
- }
- fireEvent(notification, filter);
- }
-
- public IClientNotification[] getNextNotifications(long blockingTimeout) {
- long endTime = System.currentTimeMillis() + blockingTimeout;
- ArrayList<IClientNotification> list = new ArrayList<IClientNotification>();
- synchronized (m_queueLock) {
- while (true) {
- if (!m_queue.isEmpty()) {
- for (Iterator<QueueElement> it = m_queue.iterator(); it.hasNext();) {
- QueueElement e = it.next();
- if (e.getFilter().isActive()) {
- IServerSession serverSession = ThreadContext.getServerSession();
- if (!e.isConsumedBy(serverSession)) {
- if (e.getFilter().accept()) {
- list.add(e.getClientNotification());
- if (e.getFilter().isMulticast()) {
- e.setConsumedBy(serverSession);
- }
- else {
- it.remove();
- }
- }
- }
- }
- else {
- it.remove();
- }
- }
- }
- long dt = endTime - System.currentTimeMillis();
- if (list.size() > 0 || dt <= 0) {
- break;
- }
- else {
- try {
- m_queueLock.wait(dt);
- }
- catch (InterruptedException ie) {
- }
- }
- }
- }
- return list.toArray(new IClientNotification[list.size()]);
- }
-
- private class QueueElement {
- private IClientNotification m_notification;
- private IClientNotificationFilter m_filter;
- private Object m_consumedBySessionsLock;
- private WeakHashMap<IServerSession, Object> m_consumedBySessions;
-
- public QueueElement(IClientNotification notification, IClientNotificationFilter filter) {
- m_notification = notification;
- m_filter = filter;
- m_consumedBySessionsLock = new Object();
- }
-
- public IClientNotification getClientNotification() {
- return m_notification;
- }
-
- public IClientNotificationFilter getFilter() {
- return m_filter;
- }
-
- /**
- * @return true if this notifcation is already consumed by the session
- * specified
- */
- public boolean isConsumedBy(IServerSession session) {
- // fast check
- if (session == null) {
- return false;
- }
- if (m_consumedBySessions == null) {
- return false;
- }
- //
- synchronized (m_consumedBySessionsLock) {
- if (m_consumedBySessions != null) {
- return m_consumedBySessions.containsKey(session);
- }
- else {
- return false;
- }
- }
- }
-
- /**
- * keeps in mind that this notifcation was consumed by the session specified
- */
- public void setConsumedBy(IServerSession session) {
- if (session != null) {
- synchronized (m_consumedBySessionsLock) {
- if (m_consumedBySessions == null) {
- m_consumedBySessions = new WeakHashMap<IServerSession, Object>();
- }
- m_consumedBySessions.put(session, null);
- }
- }
- }
- }
-
- /**
- * Model Observer
- */
- public void addClientNotificationQueueListener(IClientNotificationQueueListener listener) {
- m_listenerList.add(IClientNotificationQueueListener.class, listener);
- }
-
- public void removeClientNotificationQueueListener(IClientNotificationQueueListener listener) {
- m_listenerList.remove(IClientNotificationQueueListener.class, listener);
- }
-
- private void fireEvent(IClientNotification notification, IClientNotificationFilter filter) {
- IClientNotificationQueueListener[] listeners = m_listenerList.getListeners(IClientNotificationQueueListener.class);
- if (listeners != null && listeners.length > 0) {
- for (int i = 0; i < listeners.length; i++) {
- (listeners[i]).queueChanged(new ClientNotificationQueueEvent(notification, filter, ClientNotificationQueueEvent.TYPE_NOTIFICATION_ADDED));
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.clientnotification.internal;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.WeakHashMap;
+
+import org.eclipse.scout.commons.EventListenerList;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.server.IServerSession;
+import org.eclipse.scout.rt.server.ThreadContext;
+import org.eclipse.scout.rt.server.services.common.clientnotification.ClientNotificationQueueEvent;
+import org.eclipse.scout.rt.server.services.common.clientnotification.IClientNotificationFilter;
+import org.eclipse.scout.rt.server.services.common.clientnotification.IClientNotificationQueueListener;
+import org.eclipse.scout.rt.shared.services.common.clientnotification.IClientNotification;
+
+/**
+ * element type used in CTIStateCache
+ */
+public class ClientNotificationQueue {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(ClientNotificationQueue.class);
+ private EventListenerList m_listenerList = new EventListenerList();
+
+ private LinkedList<QueueElement> m_queue;
+ private Object m_queueLock = new Object();
+
+ public ClientNotificationQueue() {
+ m_queue = new LinkedList<QueueElement>();
+ }
+
+ public void putNotification(IClientNotification notification, IClientNotificationFilter filter) {
+ if (notification == null) {
+ throw new IllegalArgumentException("notification must not be null");
+ }
+ if (filter == null) {
+ throw new IllegalArgumentException("filter must not be null");
+ }
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("put " + notification + " for " + filter);
+ }
+ synchronized (m_queueLock) {
+ for (Iterator<QueueElement> it = m_queue.iterator(); it.hasNext();) {
+ QueueElement e = it.next();
+ if (!e.getFilter().isActive()) {
+ it.remove();
+ }
+ else if (e.getClientNotification() == notification) {
+ it.remove();
+ }
+ else if (e.getClientNotification().getClass() == notification.getClass() && filter.equals(e.getFilter()) && notification.coalesce(e.getClientNotification())) {
+ it.remove();
+ }
+ }
+ m_queue.add(new QueueElement(notification, filter));
+ m_queueLock.notifyAll();
+ }
+ fireEvent(notification, filter);
+ }
+
+ public IClientNotification[] getNextNotifications(long blockingTimeout) {
+ long endTime = System.currentTimeMillis() + blockingTimeout;
+ ArrayList<IClientNotification> list = new ArrayList<IClientNotification>();
+ synchronized (m_queueLock) {
+ while (true) {
+ if (!m_queue.isEmpty()) {
+ for (Iterator<QueueElement> it = m_queue.iterator(); it.hasNext();) {
+ QueueElement e = it.next();
+ if (e.getFilter().isActive()) {
+ IServerSession serverSession = ThreadContext.getServerSession();
+ if (!e.isConsumedBy(serverSession)) {
+ if (e.getFilter().accept()) {
+ list.add(e.getClientNotification());
+ if (e.getFilter().isMulticast()) {
+ e.setConsumedBy(serverSession);
+ }
+ else {
+ it.remove();
+ }
+ }
+ }
+ }
+ else {
+ it.remove();
+ }
+ }
+ }
+ long dt = endTime - System.currentTimeMillis();
+ if (list.size() > 0 || dt <= 0) {
+ break;
+ }
+ else {
+ try {
+ m_queueLock.wait(dt);
+ }
+ catch (InterruptedException ie) {
+ }
+ }
+ }
+ }
+ return list.toArray(new IClientNotification[list.size()]);
+ }
+
+ private class QueueElement {
+ private IClientNotification m_notification;
+ private IClientNotificationFilter m_filter;
+ private Object m_consumedBySessionsLock;
+ private WeakHashMap<IServerSession, Object> m_consumedBySessions;
+
+ public QueueElement(IClientNotification notification, IClientNotificationFilter filter) {
+ m_notification = notification;
+ m_filter = filter;
+ m_consumedBySessionsLock = new Object();
+ }
+
+ public IClientNotification getClientNotification() {
+ return m_notification;
+ }
+
+ public IClientNotificationFilter getFilter() {
+ return m_filter;
+ }
+
+ /**
+ * @return true if this notifcation is already consumed by the session
+ * specified
+ */
+ public boolean isConsumedBy(IServerSession session) {
+ // fast check
+ if (session == null) {
+ return false;
+ }
+ if (m_consumedBySessions == null) {
+ return false;
+ }
+ //
+ synchronized (m_consumedBySessionsLock) {
+ if (m_consumedBySessions != null) {
+ return m_consumedBySessions.containsKey(session);
+ }
+ else {
+ return false;
+ }
+ }
+ }
+
+ /**
+ * keeps in mind that this notifcation was consumed by the session specified
+ */
+ public void setConsumedBy(IServerSession session) {
+ if (session != null) {
+ synchronized (m_consumedBySessionsLock) {
+ if (m_consumedBySessions == null) {
+ m_consumedBySessions = new WeakHashMap<IServerSession, Object>();
+ }
+ m_consumedBySessions.put(session, null);
+ }
+ }
+ }
+ }
+
+ /**
+ * Model Observer
+ */
+ public void addClientNotificationQueueListener(IClientNotificationQueueListener listener) {
+ m_listenerList.add(IClientNotificationQueueListener.class, listener);
+ }
+
+ public void removeClientNotificationQueueListener(IClientNotificationQueueListener listener) {
+ m_listenerList.remove(IClientNotificationQueueListener.class, listener);
+ }
+
+ private void fireEvent(IClientNotification notification, IClientNotificationFilter filter) {
+ IClientNotificationQueueListener[] listeners = m_listenerList.getListeners(IClientNotificationQueueListener.class);
+ if (listeners != null && listeners.length > 0) {
+ for (int i = 0; i < listeners.length; i++) {
+ (listeners[i]).queueChanged(new ClientNotificationQueueEvent(notification, filter, ClientNotificationQueueEvent.TYPE_NOTIFICATION_ADDED));
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/clientnotification/internal/ClientNotificationService.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/clientnotification/internal/ClientNotificationService.java
index 5828d6e448..dff5afcb18 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/clientnotification/internal/ClientNotificationService.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/clientnotification/internal/ClientNotificationService.java
@@ -1,54 +1,54 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.clientnotification.internal;
-
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.server.services.common.clientnotification.IClientNotificationFilter;
-import org.eclipse.scout.rt.server.services.common.clientnotification.IClientNotificationQueueListener;
-import org.eclipse.scout.rt.server.services.common.clientnotification.IClientNotificationService;
-import org.eclipse.scout.rt.shared.services.common.clientnotification.IClientNotification;
-import org.eclipse.scout.rt.shared.servicetunnel.RemoteServiceAccessDenied;
-import org.eclipse.scout.service.AbstractService;
-
-public class ClientNotificationService extends AbstractService implements IClientNotificationService {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(ClientNotificationService.class);
-
- private ClientNotificationQueue m_clientNotificationQueue;
-
- public ClientNotificationService() {
- m_clientNotificationQueue = new ClientNotificationQueue();
- }
-
- @Override
- public IClientNotification[] getNextNotifications(long blockingTimeout) {
- return m_clientNotificationQueue.getNextNotifications(blockingTimeout);
- }
-
- @Override
- @RemoteServiceAccessDenied
- public void putNotification(IClientNotification notification, IClientNotificationFilter filter) {
- m_clientNotificationQueue.putNotification(notification, filter);
- }
-
- @Override
- @RemoteServiceAccessDenied
- public void addClientNotificationQueueListener(IClientNotificationQueueListener listener) {
- m_clientNotificationQueue.addClientNotificationQueueListener(listener);
- }
-
- @Override
- @RemoteServiceAccessDenied
- public void removeClientNotificationQueueListener(IClientNotificationQueueListener listener) {
- m_clientNotificationQueue.removeClientNotificationQueueListener(listener);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.clientnotification.internal;
+
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.server.services.common.clientnotification.IClientNotificationFilter;
+import org.eclipse.scout.rt.server.services.common.clientnotification.IClientNotificationQueueListener;
+import org.eclipse.scout.rt.server.services.common.clientnotification.IClientNotificationService;
+import org.eclipse.scout.rt.shared.services.common.clientnotification.IClientNotification;
+import org.eclipse.scout.rt.shared.servicetunnel.RemoteServiceAccessDenied;
+import org.eclipse.scout.service.AbstractService;
+
+public class ClientNotificationService extends AbstractService implements IClientNotificationService {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(ClientNotificationService.class);
+
+ private ClientNotificationQueue m_clientNotificationQueue;
+
+ public ClientNotificationService() {
+ m_clientNotificationQueue = new ClientNotificationQueue();
+ }
+
+ @Override
+ public IClientNotification[] getNextNotifications(long blockingTimeout) {
+ return m_clientNotificationQueue.getNextNotifications(blockingTimeout);
+ }
+
+ @Override
+ @RemoteServiceAccessDenied
+ public void putNotification(IClientNotification notification, IClientNotificationFilter filter) {
+ m_clientNotificationQueue.putNotification(notification, filter);
+ }
+
+ @Override
+ @RemoteServiceAccessDenied
+ public void addClientNotificationQueueListener(IClientNotificationQueueListener listener) {
+ m_clientNotificationQueue.addClientNotificationQueueListener(listener);
+ }
+
+ @Override
+ @RemoteServiceAccessDenied
+ public void removeClientNotificationQueueListener(IClientNotificationQueueListener listener) {
+ m_clientNotificationQueue.removeClientNotificationQueueListener(listener);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/code/CodeService.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/code/CodeService.java
index 22e64a03bd..d214186fbb 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/code/CodeService.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/code/CodeService.java
@@ -1,217 +1,217 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.code;
-
-import java.lang.reflect.Modifier;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.scout.commons.LocaleThreadLocal;
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.commons.osgi.BundleClassDescriptor;
-import org.eclipse.scout.commons.runtime.BundleBrowser;
-import org.eclipse.scout.rt.server.internal.Activator;
-import org.eclipse.scout.rt.shared.services.common.code.ICode;
-import org.eclipse.scout.rt.shared.services.common.code.ICodeService;
-import org.eclipse.scout.rt.shared.services.common.code.ICodeType;
-import org.eclipse.scout.rt.shared.servicetunnel.RemoteServiceAccessDenied;
-import org.eclipse.scout.service.AbstractService;
-import org.osgi.framework.Bundle;
-
-/**
- * delegates to {@link CodeTypeStore}
- */
-@Priority(-1)
-public class CodeService extends AbstractService implements ICodeService {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(CodeService.class);
-
- private CodeTypeStore m_codeTypeStore;
- private Object m_codeTypeClassDescriptorMapLock;
- private HashMap<String, BundleClassDescriptor[]> m_codeTypeClassDescriptorMap;
-
- public CodeService() {
- m_codeTypeStore = new CodeTypeStore();
- m_codeTypeClassDescriptorMapLock = new Object();
- m_codeTypeClassDescriptorMap = new HashMap<String, BundleClassDescriptor[]>();
- }
-
- @Override
- public <T extends ICodeType> T getCodeType(Class<T> type) {
- return getCodeTypeCache().getCodeType(type);
- }
-
- @Override
- public <T extends ICodeType> T getCodeType(Long partitionId, Class<T> type) {
- return getCodeTypeCache(partitionId).getCodeType(type);
- }
-
- @Override
- public ICodeType findCodeTypeById(Object id) {
- if (id == null) {
- return null;
- }
- ICodeType ct = getCodeTypeCache().findCodeTypeById(id);
- if (ct != null) {
- return ct;
- }
- // populate code type cache
- getAllCodeTypes("");
- return getCodeTypeCache().findCodeTypeById(id);
- }
-
- @Override
- public ICodeType findCodeTypeById(Long partitionId, Object id) {
- if (id == null) {
- return null;
- }
- ICodeType ct = getCodeTypeCache(partitionId).findCodeTypeById(id);
- if (ct != null) {
- return ct;
- }
- // populate code type cache
- getAllCodeTypes("");
- return getCodeTypeCache(partitionId).findCodeTypeById(id);
- }
-
- @Override
- public ICodeType[] getCodeTypes(Class... types) {
- return getCodeTypeCache().getCodeTypes(types);
- }
-
- @Override
- public ICodeType[] getCodeTypes(Long partitionId, Class... types) {
- return getCodeTypeCache(partitionId).getCodeTypes(types);
- }
-
- @Override
- public <T extends ICode> T getCode(final Class<T> type) {
- return getCodeTypeCache().getCode(type);
- }
-
- @Override
- public <T extends ICode> T getCode(final Long partitionId, final Class<T> type) {
- return getCodeTypeCache(partitionId).getCode(type);
- }
-
- @Override
- public <T extends ICodeType> T reloadCodeType(Class<T> type) {
- if (type == null) {
- return null;
- }
- m_codeTypeStore.unloadCodeTypeCache(type);
- return getCodeTypeCache().reloadCodeType(type);
- }
-
- @Override
- public ICodeType[] reloadCodeTypes(Class... types) {
- if (types == null) {
- return null;
- }
- m_codeTypeStore.unloadCodeTypeCache(types);
- return getCodeTypeCache().reloadCodeTypes(types);
- }
-
- @Override
- public BundleClassDescriptor[] getAllCodeTypeClasses(String classPrefix) {
- if (classPrefix == null) {
- return new BundleClassDescriptor[0];
- }
- synchronized (m_codeTypeClassDescriptorMapLock) {
- BundleClassDescriptor[] a = m_codeTypeClassDescriptorMap.get(classPrefix);
- if (a != null) {
- return a;
- }
- //
- HashSet<BundleClassDescriptor> discoveredCodeTypes = new HashSet<BundleClassDescriptor>();
- for (Bundle bundle : Activator.getDefault().getBundle().getBundleContext().getBundles()) {
- if (bundle.getSymbolicName().startsWith(classPrefix)) {
- // ok
- }
- else if (classPrefix.startsWith(bundle.getSymbolicName() + ".")) {
- // ok
- }
- else {
- continue;
- }
- String[] classNames;
- try {
- BundleBrowser bundleBrowser = new BundleBrowser(bundle.getSymbolicName(), bundle.getSymbolicName());
- classNames = bundleBrowser.getClasses(false, true);
- }
- catch (Exception e1) {
- LOG.warn(null, e1);
- continue;
- }
- // filter
- for (String className : classNames) {
- // fast pre-check
- if (className.indexOf("CodeType") >= 0) {
- try {
- Class c = null;
- c = bundle.loadClass(className);
- if (ICodeType.class.isAssignableFrom(c)) {
- if (!c.isInterface()) {
- int flags = c.getModifiers();
- if (Modifier.isPublic(flags) && (!Modifier.isAbstract(flags)) && (!c.getSimpleName().startsWith("Abstract"))) {
- if (ICodeType.class.isAssignableFrom(c)) {
- discoveredCodeTypes.add(new BundleClassDescriptor(bundle.getSymbolicName(), c.getName()));
- }
- }
- }
- }
- }
- catch (Throwable t) {
- // nop
- }
- }
- }
- }
- a = discoveredCodeTypes.toArray(new BundleClassDescriptor[discoveredCodeTypes.size()]);
- m_codeTypeClassDescriptorMap.put(classPrefix, a);
- return a;
- }
- }
-
- @Override
- @RemoteServiceAccessDenied
- public ICodeType[] getAllCodeTypes(String classPrefix) {
- ArrayList<Class> list = new ArrayList<Class>();
- for (BundleClassDescriptor d : getAllCodeTypeClasses(classPrefix)) {
- try {
- list.add(Platform.getBundle(d.getBundleSymbolicName()).loadClass(d.getClassName()));
- }
- catch (Throwable t) {
- LOG.warn("Loading " + d.getClassName() + " of bundle " + d.getBundleSymbolicName(), t);
- continue;
- }
- }
- return getCodeTypes(list.toArray(new Class[list.size()]));
- }
-
- @Override
- @RemoteServiceAccessDenied
- public ICodeType[] getAllCodeTypes(String classPrefix, Long partitionId) {
- return getAllCodeTypes(classPrefix);
- }
-
- private CodeTypeCache getCodeTypeCache() {
- return m_codeTypeStore.getCodeTypeCache(LocaleThreadLocal.get());
- }
-
- private CodeTypeCache getCodeTypeCache(Long partitionId) {
- return m_codeTypeStore.getCodeTypeCache(partitionId, LocaleThreadLocal.get());
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.code;
+
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.scout.commons.LocaleThreadLocal;
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.commons.osgi.BundleClassDescriptor;
+import org.eclipse.scout.commons.runtime.BundleBrowser;
+import org.eclipse.scout.rt.server.internal.Activator;
+import org.eclipse.scout.rt.shared.services.common.code.ICode;
+import org.eclipse.scout.rt.shared.services.common.code.ICodeService;
+import org.eclipse.scout.rt.shared.services.common.code.ICodeType;
+import org.eclipse.scout.rt.shared.servicetunnel.RemoteServiceAccessDenied;
+import org.eclipse.scout.service.AbstractService;
+import org.osgi.framework.Bundle;
+
+/**
+ * delegates to {@link CodeTypeStore}
+ */
+@Priority(-1)
+public class CodeService extends AbstractService implements ICodeService {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(CodeService.class);
+
+ private CodeTypeStore m_codeTypeStore;
+ private Object m_codeTypeClassDescriptorMapLock;
+ private HashMap<String, BundleClassDescriptor[]> m_codeTypeClassDescriptorMap;
+
+ public CodeService() {
+ m_codeTypeStore = new CodeTypeStore();
+ m_codeTypeClassDescriptorMapLock = new Object();
+ m_codeTypeClassDescriptorMap = new HashMap<String, BundleClassDescriptor[]>();
+ }
+
+ @Override
+ public <T extends ICodeType> T getCodeType(Class<T> type) {
+ return getCodeTypeCache().getCodeType(type);
+ }
+
+ @Override
+ public <T extends ICodeType> T getCodeType(Long partitionId, Class<T> type) {
+ return getCodeTypeCache(partitionId).getCodeType(type);
+ }
+
+ @Override
+ public ICodeType findCodeTypeById(Object id) {
+ if (id == null) {
+ return null;
+ }
+ ICodeType ct = getCodeTypeCache().findCodeTypeById(id);
+ if (ct != null) {
+ return ct;
+ }
+ // populate code type cache
+ getAllCodeTypes("");
+ return getCodeTypeCache().findCodeTypeById(id);
+ }
+
+ @Override
+ public ICodeType findCodeTypeById(Long partitionId, Object id) {
+ if (id == null) {
+ return null;
+ }
+ ICodeType ct = getCodeTypeCache(partitionId).findCodeTypeById(id);
+ if (ct != null) {
+ return ct;
+ }
+ // populate code type cache
+ getAllCodeTypes("");
+ return getCodeTypeCache(partitionId).findCodeTypeById(id);
+ }
+
+ @Override
+ public ICodeType[] getCodeTypes(Class... types) {
+ return getCodeTypeCache().getCodeTypes(types);
+ }
+
+ @Override
+ public ICodeType[] getCodeTypes(Long partitionId, Class... types) {
+ return getCodeTypeCache(partitionId).getCodeTypes(types);
+ }
+
+ @Override
+ public <T extends ICode> T getCode(final Class<T> type) {
+ return getCodeTypeCache().getCode(type);
+ }
+
+ @Override
+ public <T extends ICode> T getCode(final Long partitionId, final Class<T> type) {
+ return getCodeTypeCache(partitionId).getCode(type);
+ }
+
+ @Override
+ public <T extends ICodeType> T reloadCodeType(Class<T> type) {
+ if (type == null) {
+ return null;
+ }
+ m_codeTypeStore.unloadCodeTypeCache(type);
+ return getCodeTypeCache().reloadCodeType(type);
+ }
+
+ @Override
+ public ICodeType[] reloadCodeTypes(Class... types) {
+ if (types == null) {
+ return null;
+ }
+ m_codeTypeStore.unloadCodeTypeCache(types);
+ return getCodeTypeCache().reloadCodeTypes(types);
+ }
+
+ @Override
+ public BundleClassDescriptor[] getAllCodeTypeClasses(String classPrefix) {
+ if (classPrefix == null) {
+ return new BundleClassDescriptor[0];
+ }
+ synchronized (m_codeTypeClassDescriptorMapLock) {
+ BundleClassDescriptor[] a = m_codeTypeClassDescriptorMap.get(classPrefix);
+ if (a != null) {
+ return a;
+ }
+ //
+ HashSet<BundleClassDescriptor> discoveredCodeTypes = new HashSet<BundleClassDescriptor>();
+ for (Bundle bundle : Activator.getDefault().getBundle().getBundleContext().getBundles()) {
+ if (bundle.getSymbolicName().startsWith(classPrefix)) {
+ // ok
+ }
+ else if (classPrefix.startsWith(bundle.getSymbolicName() + ".")) {
+ // ok
+ }
+ else {
+ continue;
+ }
+ String[] classNames;
+ try {
+ BundleBrowser bundleBrowser = new BundleBrowser(bundle.getSymbolicName(), bundle.getSymbolicName());
+ classNames = bundleBrowser.getClasses(false, true);
+ }
+ catch (Exception e1) {
+ LOG.warn(null, e1);
+ continue;
+ }
+ // filter
+ for (String className : classNames) {
+ // fast pre-check
+ if (className.indexOf("CodeType") >= 0) {
+ try {
+ Class c = null;
+ c = bundle.loadClass(className);
+ if (ICodeType.class.isAssignableFrom(c)) {
+ if (!c.isInterface()) {
+ int flags = c.getModifiers();
+ if (Modifier.isPublic(flags) && (!Modifier.isAbstract(flags)) && (!c.getSimpleName().startsWith("Abstract"))) {
+ if (ICodeType.class.isAssignableFrom(c)) {
+ discoveredCodeTypes.add(new BundleClassDescriptor(bundle.getSymbolicName(), c.getName()));
+ }
+ }
+ }
+ }
+ }
+ catch (Throwable t) {
+ // nop
+ }
+ }
+ }
+ }
+ a = discoveredCodeTypes.toArray(new BundleClassDescriptor[discoveredCodeTypes.size()]);
+ m_codeTypeClassDescriptorMap.put(classPrefix, a);
+ return a;
+ }
+ }
+
+ @Override
+ @RemoteServiceAccessDenied
+ public ICodeType[] getAllCodeTypes(String classPrefix) {
+ ArrayList<Class> list = new ArrayList<Class>();
+ for (BundleClassDescriptor d : getAllCodeTypeClasses(classPrefix)) {
+ try {
+ list.add(Platform.getBundle(d.getBundleSymbolicName()).loadClass(d.getClassName()));
+ }
+ catch (Throwable t) {
+ LOG.warn("Loading " + d.getClassName() + " of bundle " + d.getBundleSymbolicName(), t);
+ continue;
+ }
+ }
+ return getCodeTypes(list.toArray(new Class[list.size()]));
+ }
+
+ @Override
+ @RemoteServiceAccessDenied
+ public ICodeType[] getAllCodeTypes(String classPrefix, Long partitionId) {
+ return getAllCodeTypes(classPrefix);
+ }
+
+ private CodeTypeCache getCodeTypeCache() {
+ return m_codeTypeStore.getCodeTypeCache(LocaleThreadLocal.get());
+ }
+
+ private CodeTypeCache getCodeTypeCache(Long partitionId) {
+ return m_codeTypeStore.getCodeTypeCache(partitionId, LocaleThreadLocal.get());
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/code/CodeTypeCache.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/code/CodeTypeCache.java
index 5230879902..c09dace387 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/code/CodeTypeCache.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/code/CodeTypeCache.java
@@ -1,133 +1,133 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.code;
-
-import java.util.HashMap;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.holders.Holder;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.shared.services.common.code.ICode;
-import org.eclipse.scout.rt.shared.services.common.code.ICodeType;
-import org.eclipse.scout.rt.shared.services.common.code.ICodeVisitor;
-import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
-import org.eclipse.scout.service.SERVICES;
-
-/**
- * Maintains a cache of ICodeType objects that can be (re)loaded using the
- * methods reloadCodeType, reloadCodeTypes
- */
-public class CodeTypeCache {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(CodeTypeCache.class);
-
- private Object m_cacheLock = new Object();
- private HashMap<Class<? extends ICodeType>, ICodeType> m_cache = new HashMap<Class<? extends ICodeType>, ICodeType>();
-
- public CodeTypeCache() {
- }
-
- public ICodeType findCodeTypeById(Object id) {
- if (id == null) {
- return null;
- }
- synchronized (m_cacheLock) {
- for (ICodeType ct : m_cache.values()) {
- if (id.equals(ct.getId())) {
- return ct;
- }
- }
- }
- return null;
- }
-
- public <T extends ICodeType> T getCodeType(Class<T> type) {
- synchronized (m_cacheLock) {
- @SuppressWarnings("unchecked")
- T instance = (T) m_cache.get(type);
- if (instance == null) {
- try {
- instance = type.newInstance();
- m_cache.put(type, instance);
- }
- catch (Throwable t) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("create " + type.getName(), t));
- }
- }
- return instance;
- }
- }
-
- @SuppressWarnings("unchecked")
- public ICodeType[] getCodeTypes(Class... types) {
- ICodeType[] instances = new ICodeType[types.length];
- for (int i = 0; i < instances.length; i++) {
- instances[i] = getCodeType(types[i]);
- }
- return instances;
- }
-
- @SuppressWarnings("unchecked")
- public <T extends ICode> T getCode(final Class<T> type) {
- if (type == null) {
- return null;
- }
- Class declaringCodeTypeClass = null;
- if (type.getDeclaringClass() != null) {
- // code is inner type of code type or another code
- Class c = type.getDeclaringClass();
- while (c != null && !(ICodeType.class.isAssignableFrom(c))) {
- c = c.getDeclaringClass();
- }
- declaringCodeTypeClass = c;
- }
- if (declaringCodeTypeClass == null) {
- try {
- declaringCodeTypeClass = type.newInstance().getCodeType().getClass();
- }
- catch (Throwable t) {
- LOG.error("find code " + type, t);
- }
- }
- ICodeType codeType = getCodeType(declaringCodeTypeClass);
- final Holder<ICode> codeHolder = new Holder<ICode>(ICode.class);
- ICodeVisitor v = new ICodeVisitor() {
- @Override
- public boolean visit(ICode code, int treeLevel) {
- if (code.getClass() == type) {
- codeHolder.setValue(code);
- return false;
- }
- return true;
- }
- };
- codeType.visit(v);
- return (T) codeHolder.getValue();
- }
-
- public <T extends ICodeType> T reloadCodeType(Class<T> type) {
- unloadCodeTypes(new Class[]{type});
- return getCodeType(type);
- }
-
- public ICodeType[] reloadCodeTypes(Class... types) {
- unloadCodeTypes(types);
- return getCodeTypes(types);
- }
-
- protected void unloadCodeTypes(Class[] types) {
- synchronized (m_cacheLock) {
- for (int i = 0; i < types.length; i++) {
- m_cache.remove(types[i]);
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.code;
+
+import java.util.HashMap;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.holders.Holder;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.shared.services.common.code.ICode;
+import org.eclipse.scout.rt.shared.services.common.code.ICodeType;
+import org.eclipse.scout.rt.shared.services.common.code.ICodeVisitor;
+import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
+import org.eclipse.scout.service.SERVICES;
+
+/**
+ * Maintains a cache of ICodeType objects that can be (re)loaded using the
+ * methods reloadCodeType, reloadCodeTypes
+ */
+public class CodeTypeCache {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(CodeTypeCache.class);
+
+ private Object m_cacheLock = new Object();
+ private HashMap<Class<? extends ICodeType>, ICodeType> m_cache = new HashMap<Class<? extends ICodeType>, ICodeType>();
+
+ public CodeTypeCache() {
+ }
+
+ public ICodeType findCodeTypeById(Object id) {
+ if (id == null) {
+ return null;
+ }
+ synchronized (m_cacheLock) {
+ for (ICodeType ct : m_cache.values()) {
+ if (id.equals(ct.getId())) {
+ return ct;
+ }
+ }
+ }
+ return null;
+ }
+
+ public <T extends ICodeType> T getCodeType(Class<T> type) {
+ synchronized (m_cacheLock) {
+ @SuppressWarnings("unchecked")
+ T instance = (T) m_cache.get(type);
+ if (instance == null) {
+ try {
+ instance = type.newInstance();
+ m_cache.put(type, instance);
+ }
+ catch (Throwable t) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("create " + type.getName(), t));
+ }
+ }
+ return instance;
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public ICodeType[] getCodeTypes(Class... types) {
+ ICodeType[] instances = new ICodeType[types.length];
+ for (int i = 0; i < instances.length; i++) {
+ instances[i] = getCodeType(types[i]);
+ }
+ return instances;
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T extends ICode> T getCode(final Class<T> type) {
+ if (type == null) {
+ return null;
+ }
+ Class declaringCodeTypeClass = null;
+ if (type.getDeclaringClass() != null) {
+ // code is inner type of code type or another code
+ Class c = type.getDeclaringClass();
+ while (c != null && !(ICodeType.class.isAssignableFrom(c))) {
+ c = c.getDeclaringClass();
+ }
+ declaringCodeTypeClass = c;
+ }
+ if (declaringCodeTypeClass == null) {
+ try {
+ declaringCodeTypeClass = type.newInstance().getCodeType().getClass();
+ }
+ catch (Throwable t) {
+ LOG.error("find code " + type, t);
+ }
+ }
+ ICodeType codeType = getCodeType(declaringCodeTypeClass);
+ final Holder<ICode> codeHolder = new Holder<ICode>(ICode.class);
+ ICodeVisitor v = new ICodeVisitor() {
+ @Override
+ public boolean visit(ICode code, int treeLevel) {
+ if (code.getClass() == type) {
+ codeHolder.setValue(code);
+ return false;
+ }
+ return true;
+ }
+ };
+ codeType.visit(v);
+ return (T) codeHolder.getValue();
+ }
+
+ public <T extends ICodeType> T reloadCodeType(Class<T> type) {
+ unloadCodeTypes(new Class[]{type});
+ return getCodeType(type);
+ }
+
+ public ICodeType[] reloadCodeTypes(Class... types) {
+ unloadCodeTypes(types);
+ return getCodeTypes(types);
+ }
+
+ protected void unloadCodeTypes(Class[] types) {
+ synchronized (m_cacheLock) {
+ for (int i = 0; i < types.length; i++) {
+ m_cache.remove(types[i]);
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/code/CodeTypeStore.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/code/CodeTypeStore.java
index 72d262c7f7..a17aa13bc3 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/code/CodeTypeStore.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/code/CodeTypeStore.java
@@ -1,136 +1,136 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.code;
-
-/**
- * Title: BSI Scout V3
- * Copyright (c) 2001,2009 BSI AG
- * @version 3.x
- */
-
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.server.ServerJob;
-import org.eclipse.scout.rt.server.services.common.clientnotification.AllUserFilter;
-import org.eclipse.scout.rt.server.services.common.clientnotification.IClientNotificationService;
-import org.eclipse.scout.rt.shared.services.common.code.CodeTypeChangedNotification;
-import org.eclipse.scout.rt.shared.services.common.code.ICodeType;
-import org.eclipse.scout.service.SERVICES;
-
-/**
- * CodeType store in servlet context for global code providing to http sessions
- * Maintains a map of partition- and language-dependent code type caches
- */
-public class CodeTypeStore {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(CodeTypeStore.class);
-
- private Object m_storeLock;
- private HashMap<PartitionLanguageComposite, CodeTypeCache> m_store;
-
- public CodeTypeStore() {
- m_storeLock = new Object();
- m_store = new HashMap<PartitionLanguageComposite, CodeTypeCache>();
- }
-
- public CodeTypeCache getCodeTypeCache(Locale locale) {
- Long partitionId = 0L;
- Map<String, Object> sharedVariableMap = ServerJob.getCurrentSession().getSharedVariableMap();
- if (sharedVariableMap.containsKey(ICodeType.PROP_PARTITION_ID)) {
- partitionId = (Long) sharedVariableMap.get(ICodeType.PROP_PARTITION_ID);
- }
- return getCodeTypeCache(partitionId, locale);
- }
-
- public CodeTypeCache getCodeTypeCache(Long partitionId, Locale locale) {
- synchronized (m_storeLock) {
- String key = locale.toString();
- PartitionLanguageComposite comp = new PartitionLanguageComposite(partitionId, key);
-
- CodeTypeCache cache = m_store.get(comp);
- if (cache == null) {
- cache = new CodeTypeCache();
- m_store.put(comp, cache);
- }
- return cache;
- }
- }
-
- @SuppressWarnings("unchecked")
- public void unloadCodeTypeCache(Class... types) {
- for (CodeTypeCache cache : m_store.values()) {
- cache.unloadCodeTypes(types);
- }
- // notify clients
- SERVICES.getService(IClientNotificationService.class).putNotification(new CodeTypeChangedNotification(types), new AllUserFilter(120000L));
- }
-
- private class PartitionLanguageComposite {
- private Long partitionId;
- private String language;
-
- public PartitionLanguageComposite(Long partitionId, String language) {
- this.partitionId = partitionId;
- this.language = language;
- }
-
- public Long getPartitionId() {
- return partitionId;
- }
-
- public String getLanguage() {
- return language;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((language == null) ? 0 : language.hashCode());
- result = prime * result + ((partitionId == null) ? 0 : partitionId.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;
- }
- PartitionLanguageComposite other = (PartitionLanguageComposite) obj;
- if (language == null) {
- if (other.language != null) {
- return false;
- }
- }
- else if (!language.equals(other.language)) {
- return false;
- }
- if (partitionId == null) {
- if (other.partitionId != null) {
- return false;
- }
- }
- else if (!partitionId.equals(other.partitionId)) {
- return false;
- }
- return true;
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.code;
+
+/**
+ * Title: BSI Scout V3
+ * Copyright (c) 2001,2009 BSI AG
+ * @version 3.x
+ */
+
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.server.ServerJob;
+import org.eclipse.scout.rt.server.services.common.clientnotification.AllUserFilter;
+import org.eclipse.scout.rt.server.services.common.clientnotification.IClientNotificationService;
+import org.eclipse.scout.rt.shared.services.common.code.CodeTypeChangedNotification;
+import org.eclipse.scout.rt.shared.services.common.code.ICodeType;
+import org.eclipse.scout.service.SERVICES;
+
+/**
+ * CodeType store in servlet context for global code providing to http sessions
+ * Maintains a map of partition- and language-dependent code type caches
+ */
+public class CodeTypeStore {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(CodeTypeStore.class);
+
+ private Object m_storeLock;
+ private HashMap<PartitionLanguageComposite, CodeTypeCache> m_store;
+
+ public CodeTypeStore() {
+ m_storeLock = new Object();
+ m_store = new HashMap<PartitionLanguageComposite, CodeTypeCache>();
+ }
+
+ public CodeTypeCache getCodeTypeCache(Locale locale) {
+ Long partitionId = 0L;
+ Map<String, Object> sharedVariableMap = ServerJob.getCurrentSession().getSharedVariableMap();
+ if (sharedVariableMap.containsKey(ICodeType.PROP_PARTITION_ID)) {
+ partitionId = (Long) sharedVariableMap.get(ICodeType.PROP_PARTITION_ID);
+ }
+ return getCodeTypeCache(partitionId, locale);
+ }
+
+ public CodeTypeCache getCodeTypeCache(Long partitionId, Locale locale) {
+ synchronized (m_storeLock) {
+ String key = locale.toString();
+ PartitionLanguageComposite comp = new PartitionLanguageComposite(partitionId, key);
+
+ CodeTypeCache cache = m_store.get(comp);
+ if (cache == null) {
+ cache = new CodeTypeCache();
+ m_store.put(comp, cache);
+ }
+ return cache;
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public void unloadCodeTypeCache(Class... types) {
+ for (CodeTypeCache cache : m_store.values()) {
+ cache.unloadCodeTypes(types);
+ }
+ // notify clients
+ SERVICES.getService(IClientNotificationService.class).putNotification(new CodeTypeChangedNotification(types), new AllUserFilter(120000L));
+ }
+
+ private class PartitionLanguageComposite {
+ private Long partitionId;
+ private String language;
+
+ public PartitionLanguageComposite(Long partitionId, String language) {
+ this.partitionId = partitionId;
+ this.language = language;
+ }
+
+ public Long getPartitionId() {
+ return partitionId;
+ }
+
+ public String getLanguage() {
+ return language;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((language == null) ? 0 : language.hashCode());
+ result = prime * result + ((partitionId == null) ? 0 : partitionId.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;
+ }
+ PartitionLanguageComposite other = (PartitionLanguageComposite) obj;
+ if (language == null) {
+ if (other.language != null) {
+ return false;
+ }
+ }
+ else if (!language.equals(other.language)) {
+ return false;
+ }
+ if (partitionId == null) {
+ if (other.partitionId != null) {
+ return false;
+ }
+ }
+ else if (!partitionId.equals(other.partitionId)) {
+ return false;
+ }
+ return true;
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/csv/CsvSqlAdapter.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/csv/CsvSqlAdapter.java
index d34c07a6ba..3e9e277339 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/csv/CsvSqlAdapter.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/csv/CsvSqlAdapter.java
@@ -1,372 +1,372 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.csv;
-
-/**
- * Title: BSI Scout V3
- */
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStreamWriter;
-import java.io.Reader;
-import java.io.Writer;
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Locale;
-
-import org.eclipse.scout.commons.csv.CsvHelper;
-import org.eclipse.scout.commons.csv.IDataConsumer;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.holders.NVPair;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.server.services.common.jdbc.ISelectStreamHandler;
-import org.eclipse.scout.rt.server.services.common.jdbc.ISqlService;
-import org.eclipse.scout.rt.server.services.common.jdbc.SqlBind;
-
-public class CsvSqlAdapter {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(CsvSqlAdapter.class);
-
- private ISqlService m_sqlService;
-
- public CsvSqlAdapter(ISqlService service) {
- if (service == null) {
- throw new IllegalArgumentException("sql service must not be null");
- }
- m_sqlService = service;
- }
-
- /**
- * Export a table's data into a file
- *
- * @param f
- * file to write data to
- * @param contentLocale
- * see {@link CsvHelper}
- * @param colSeparator
- * see {@link CsvHelper}
- * @param textDelimiter
- * see {@link CsvHelper}
- * @param tableName
- * database table to export from
- * @param groupKeyColumnName
- * the column where the id for this import is stored (or null if not
- * used)
- * @param groupKeyValue
- * the id for this csv import
- * @param lineNumberColumnName
- * where the line number starting with 1 is stored
- * @param csvColumnNames
- * the names that should appear in the csv file
- * @param writeColumnNames
- * the sql names that are exported
- * @param csvColumnTypes
- * the csv types of the corresponding column
- * @param writeColumnTypes
- * the sql types of the corresponding column
- * @throws ProcessingException
- */
- public void exportDataFromTable(File f, String encoding, Locale contentLocale, String colSeparator, String textDelimiter, String tableName, String groupKeyColumnName, Object groupKeyValue, String lineNumberColumnName, List<String> csvColumnNames, boolean writeColumnNames, List<String> csvColumnTypes, boolean writeColumnTypes) throws ProcessingException {
- if (encoding == null) {
- encoding = "UTF-8";
- }
- try {
- CsvSqlSettings params = new CsvSqlSettings();
- params.setFile(f);
- params.setEncoding(encoding);
- params.setContentLocale(contentLocale);
- params.setColSeparator((colSeparator == null) ? 0 : colSeparator.charAt(0));
- params.setTextDelimiter((textDelimiter == null) ? 0 : textDelimiter.charAt(0));
- params.setTableName(tableName);
- params.setGroupKeyColumnName(groupKeyColumnName);
- params.setGroupKeyValue(groupKeyValue);
- params.setLineNumberColumnName(lineNumberColumnName);
- params.setWriteColumnNames(writeColumnNames);
- params.setWriteColumnTypes(writeColumnTypes);
- if (csvColumnNames != null) {
- params.setCsvColumnNames(csvColumnNames);
- }
- if (csvColumnTypes != null) {
- params.setCsvColumnTypes(csvColumnTypes);
- }
- exportData(params);
- }
- catch (Exception e) {
- throw new ProcessingException(e.getMessage(), e);
- }
- }
-
- /**
- * Export sql select data into a file
- *
- * @param f
- * file to write data to
- * @param contentLocale
- * see {@link CsvHelper}
- * @param colSeparator
- * see {@link CsvHelper}
- * @param textDelimiter
- * see {@link CsvHelper}
- * @param sqlSelect
- * the source sql statement
- * @param bindBase
- * the necessary jdbc binds
- * @param csvColumnNames
- * the names that should appear in the csv file
- * @param writeColumnNames
- * the sql names that are exported
- * @param csvColumnTypes
- * the csv types of the corresponding column
- * @param writeColumnTypes
- * the sql types of the corresponding column
- * @throws ProcessingException
- */
- public void exportDataWithSql(File f, String encoding, Locale contentLocale, String colSeparator, String textDelimiter, String sqlSelect, NVPair[] bindBase, List<String> csvColumnNames, boolean writeColumNames, List<String> csvColumnTypes, boolean writeColumnTypes) throws ProcessingException {
- if (encoding == null) {
- encoding = "UTF-8";
- }
- try {
- CsvSqlSettings params = new CsvSqlSettings();
- params.setFile(f);
- params.setEncoding(encoding);
- params.setContentLocale(contentLocale);
- params.setColSeparator((colSeparator == null) ? 0 : colSeparator.charAt(0));
- params.setTextDelimiter((textDelimiter == null) ? 0 : textDelimiter.charAt(0));
- params.setSqlSelect(sqlSelect);
- params.setBindBase(bindBase);
- params.setWriteColumnNames(writeColumNames);
- params.setWriteColumnTypes(writeColumnTypes);
- if (csvColumnNames != null) {
- params.setCsvColumnNames(csvColumnNames);
- }
- if (csvColumnTypes != null) {
- params.setCsvColumnTypes(csvColumnTypes);
- }
- exportData(params);
- }
- catch (Exception e) {
- throw new ProcessingException(e.getMessage(), e);
- }
- }
-
- /**
- * Export sql data into a file
- *
- * @param params
- * @throws ProcessingException
- */
- public void exportData(CsvSqlSettings params) throws ProcessingException {
- final CsvHelper h = new CsvHelper(params.getContentLocale(), params.getColSeparator(), params.getTextDelimiter(), "\n");
- if (params.getCsvColumnTypes() != null) {
- h.setColumnTypes(params.getCsvColumnTypes());
- }
- if (params.getCsvColumnNames() != null) {
- h.setColumnNames(params.getCsvColumnNames());
- }
- try {
- ArrayList<String> cols = new ArrayList<String>();
- cols.addAll(params.getCsvColumnNames());
- // prepare select statement
- String sqlText;
- Object[] base = null;
- if (params.getSqlSelect() != null) {
- sqlText = params.getSqlSelect();
- base = params.getBindBase();
- }
- else {
- StringBuffer buf = new StringBuffer();
- buf.append("SELECT ");
- for (Iterator<String> it = cols.iterator(); it.hasNext();) {
- String colName = it.next();
- buf.append(colName);
- if (it.hasNext()) {
- buf.append(",");
- }
- }
- buf.append(" FROM ");
- buf.append(params.getTableName());
- if (params.getGroupKeyValue() != null) {
- buf.append(" WHERE ");
- buf.append(params.getGroupKeyColumnName());
- buf.append("=:groupKeyColumnValue");
- }
- if (params.getLineNumberColumnName() != null) {
- buf.append(" ORDER BY ");
- buf.append(params.getLineNumberColumnName());
- }
- sqlText = buf.toString();
- if (params.getGroupKeyValue() != null) {
- base = new Object[1];
- base[0] = new NVPair("groupKeyColumnValue", params.getGroupKeyValue());
- }
- }
- final Writer w = new OutputStreamWriter(new FileOutputStream(params.getFile()), params.getEncoding());
- try {
- h.exportHeaderRows(w, params.getWriteColumnNames(), params.getWriteColumnTypes());
- ISelectStreamHandler handler = new ISelectStreamHandler() {
- @Override
- public void handleRow(Connection con, PreparedStatement stm, ResultSet rs, int rowIndex, List<SqlBind> values) throws ProcessingException {
- Object[] row = new Object[values.size()];
- for (int i = 0; i < row.length; i++) {
- row[i] = values.get(i).getValue();
- }
- h.exportDataRow(row, w, false);
- }
-
- @Override
- public void finished(Connection con, PreparedStatement stm, ResultSet rs, int rowCount) throws ProcessingException {
- }
- };
- m_sqlService.selectStreaming(sqlText, handler, base);
- }
- finally {
- try {
- w.close();
- }
- catch (Exception e) {
- }
- }
- }
- catch (Exception e) {
- throw new ProcessingException(e.getMessage(), e);
- }
- }
-
- public void importDataIntoTable(File f, String encoding, Locale contentLocale, int headerRowCount, String colSeparator, String textDelimiter, String tableName, String groupKeyColumnName, Object groupKeyValue, String lineNumberColumnName, List<String> csvColumnNames, List<String> csvColumnTypes, boolean allowVariableColumnCount) throws ProcessingException {
- if (encoding == null) {
- encoding = "UTF-8";
- }
- try {
- CsvSqlSettings params = new CsvSqlSettings();
- params.setFile(f);
- params.setEncoding(encoding);
- params.setContentLocale(contentLocale);
- params.setHeaderRowCount(headerRowCount);
- params.setColSeparator((colSeparator == null) ? 0 : colSeparator.charAt(0));
- params.setTextDelimiter((textDelimiter == null) ? 0 : textDelimiter.charAt(0));
- params.setTableName(tableName);
- params.setGroupKeyColumnName(groupKeyColumnName);
- params.setGroupKeyValue(groupKeyValue);
- params.setLineNumberColumnName(lineNumberColumnName);
- params.setAllowVariableColumnCount(allowVariableColumnCount);
- if (csvColumnNames != null) {
- params.setCsvColumnNames(csvColumnNames);
- }
- if (csvColumnTypes != null) {
- params.setCsvColumnTypes(csvColumnTypes);
- }
- importData(params);
- }
- catch (Exception e) {
- throw new ProcessingException(e.getMessage(), e);
- }
- }
-
- public void importData(CsvSqlSettings params) throws ProcessingException {
- CsvHelper h = new CsvHelper(params.getContentLocale(), params.getColSeparator(), params.getTextDelimiter(), "\n");
- if (params.getCsvColumnTypes() != null) {
- h.setColumnTypes(params.getCsvColumnTypes());
- }
- if (params.getCsvColumnNames() != null) {
- h.setColumnNames(params.getCsvColumnNames());
- }
- try {
- ArrayList<String> cols = new ArrayList<String>();
- if (params.getGroupKeyValue() != null) {
- cols.add(params.getGroupKeyColumnName());
- }
- if (params.getLineNumberColumnName() != null) {
- cols.add(params.getLineNumberColumnName());
- }
- cols.addAll(params.getCsvColumnNames()); //
- StringBuffer buf = new StringBuffer();
- buf.append("INSERT INTO ");
- buf.append(params.getTableName());
- buf.append("(");
- for (Iterator<String> it = cols.iterator(); it.hasNext();) {
- String colName = it.next();
- if (!CsvHelper.IGNORED_COLUMN_NAME.equals(colName)) {
- buf.append(colName);
- buf.append(",");
- }
- }
- buf.deleteCharAt(buf.length() - 1);
- buf.append(") VALUES (");
- int i = 0;
- for (Iterator<String> it = cols.iterator(); it.hasNext();) {
- String colName = it.next();
- if (!CsvHelper.IGNORED_COLUMN_NAME.equals(colName)) {
- buf.append(":v" + i);
- buf.append(",");
- i++;
- }
- }
- buf.deleteCharAt(buf.length() - 1);
- buf.append(")");
- String stm = buf.toString();
-
- final Reader reader = new InputStreamReader(new FileInputStream(params.getFile()), params.getEncoding());
- try {
- SqlInsertDataConsumer cons = new SqlInsertDataConsumer(stm, params.getGroupKeyValue(), params.getLineNumberColumnName() != null);
- h.importData(cons, reader, false, false, params.getHeaderRowCount(), -1, params.getAllowVariableColumnCount());
- }
- finally {
- reader.close();
- }
- }
- catch (Exception e) {
- throw new ProcessingException(e.getMessage(), e);
- }
- }
-
- private class SqlInsertDataConsumer implements IDataConsumer {
- private String m_statement;
- private Object m_groupKey;
- private boolean m_useLineNumberColumnName;
-
- public SqlInsertDataConsumer(String stm, Object groupKey, boolean useLineNumberColumnName) {
- m_statement = stm;
- m_groupKey = groupKey;
- m_useLineNumberColumnName = useLineNumberColumnName;
- }
-
- @Override
- public void processRow(int lineNr, List<Object> row) throws ProcessingException {
- try {
- ArrayList<Object> bindBase = new ArrayList<Object>();
- int i = 0;
- if (m_groupKey != null) {
- bindBase.add(new NVPair("v" + i, m_groupKey));
- i++;
- }
- if (m_useLineNumberColumnName) {
- bindBase.add(new NVPair("v" + i, lineNr));
- i++;
- }
- for (Iterator<Object> it = row.iterator(); it.hasNext();) {
- bindBase.add(new NVPair("v" + i, it.next()));
- i++;
- }
- m_sqlService.insert(m_statement, bindBase.toArray());
- }
- catch (Exception e) {
- throw new ProcessingException("line=" + lineNr + " row=" + row + "\n" + e.getMessage());
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.csv;
+
+/**
+ * Title: BSI Scout V3
+ */
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.io.Reader;
+import java.io.Writer;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+
+import org.eclipse.scout.commons.csv.CsvHelper;
+import org.eclipse.scout.commons.csv.IDataConsumer;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.holders.NVPair;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.server.services.common.jdbc.ISelectStreamHandler;
+import org.eclipse.scout.rt.server.services.common.jdbc.ISqlService;
+import org.eclipse.scout.rt.server.services.common.jdbc.SqlBind;
+
+public class CsvSqlAdapter {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(CsvSqlAdapter.class);
+
+ private ISqlService m_sqlService;
+
+ public CsvSqlAdapter(ISqlService service) {
+ if (service == null) {
+ throw new IllegalArgumentException("sql service must not be null");
+ }
+ m_sqlService = service;
+ }
+
+ /**
+ * Export a table's data into a file
+ *
+ * @param f
+ * file to write data to
+ * @param contentLocale
+ * see {@link CsvHelper}
+ * @param colSeparator
+ * see {@link CsvHelper}
+ * @param textDelimiter
+ * see {@link CsvHelper}
+ * @param tableName
+ * database table to export from
+ * @param groupKeyColumnName
+ * the column where the id for this import is stored (or null if not
+ * used)
+ * @param groupKeyValue
+ * the id for this csv import
+ * @param lineNumberColumnName
+ * where the line number starting with 1 is stored
+ * @param csvColumnNames
+ * the names that should appear in the csv file
+ * @param writeColumnNames
+ * the sql names that are exported
+ * @param csvColumnTypes
+ * the csv types of the corresponding column
+ * @param writeColumnTypes
+ * the sql types of the corresponding column
+ * @throws ProcessingException
+ */
+ public void exportDataFromTable(File f, String encoding, Locale contentLocale, String colSeparator, String textDelimiter, String tableName, String groupKeyColumnName, Object groupKeyValue, String lineNumberColumnName, List<String> csvColumnNames, boolean writeColumnNames, List<String> csvColumnTypes, boolean writeColumnTypes) throws ProcessingException {
+ if (encoding == null) {
+ encoding = "UTF-8";
+ }
+ try {
+ CsvSqlSettings params = new CsvSqlSettings();
+ params.setFile(f);
+ params.setEncoding(encoding);
+ params.setContentLocale(contentLocale);
+ params.setColSeparator((colSeparator == null) ? 0 : colSeparator.charAt(0));
+ params.setTextDelimiter((textDelimiter == null) ? 0 : textDelimiter.charAt(0));
+ params.setTableName(tableName);
+ params.setGroupKeyColumnName(groupKeyColumnName);
+ params.setGroupKeyValue(groupKeyValue);
+ params.setLineNumberColumnName(lineNumberColumnName);
+ params.setWriteColumnNames(writeColumnNames);
+ params.setWriteColumnTypes(writeColumnTypes);
+ if (csvColumnNames != null) {
+ params.setCsvColumnNames(csvColumnNames);
+ }
+ if (csvColumnTypes != null) {
+ params.setCsvColumnTypes(csvColumnTypes);
+ }
+ exportData(params);
+ }
+ catch (Exception e) {
+ throw new ProcessingException(e.getMessage(), e);
+ }
+ }
+
+ /**
+ * Export sql select data into a file
+ *
+ * @param f
+ * file to write data to
+ * @param contentLocale
+ * see {@link CsvHelper}
+ * @param colSeparator
+ * see {@link CsvHelper}
+ * @param textDelimiter
+ * see {@link CsvHelper}
+ * @param sqlSelect
+ * the source sql statement
+ * @param bindBase
+ * the necessary jdbc binds
+ * @param csvColumnNames
+ * the names that should appear in the csv file
+ * @param writeColumnNames
+ * the sql names that are exported
+ * @param csvColumnTypes
+ * the csv types of the corresponding column
+ * @param writeColumnTypes
+ * the sql types of the corresponding column
+ * @throws ProcessingException
+ */
+ public void exportDataWithSql(File f, String encoding, Locale contentLocale, String colSeparator, String textDelimiter, String sqlSelect, NVPair[] bindBase, List<String> csvColumnNames, boolean writeColumNames, List<String> csvColumnTypes, boolean writeColumnTypes) throws ProcessingException {
+ if (encoding == null) {
+ encoding = "UTF-8";
+ }
+ try {
+ CsvSqlSettings params = new CsvSqlSettings();
+ params.setFile(f);
+ params.setEncoding(encoding);
+ params.setContentLocale(contentLocale);
+ params.setColSeparator((colSeparator == null) ? 0 : colSeparator.charAt(0));
+ params.setTextDelimiter((textDelimiter == null) ? 0 : textDelimiter.charAt(0));
+ params.setSqlSelect(sqlSelect);
+ params.setBindBase(bindBase);
+ params.setWriteColumnNames(writeColumNames);
+ params.setWriteColumnTypes(writeColumnTypes);
+ if (csvColumnNames != null) {
+ params.setCsvColumnNames(csvColumnNames);
+ }
+ if (csvColumnTypes != null) {
+ params.setCsvColumnTypes(csvColumnTypes);
+ }
+ exportData(params);
+ }
+ catch (Exception e) {
+ throw new ProcessingException(e.getMessage(), e);
+ }
+ }
+
+ /**
+ * Export sql data into a file
+ *
+ * @param params
+ * @throws ProcessingException
+ */
+ public void exportData(CsvSqlSettings params) throws ProcessingException {
+ final CsvHelper h = new CsvHelper(params.getContentLocale(), params.getColSeparator(), params.getTextDelimiter(), "\n");
+ if (params.getCsvColumnTypes() != null) {
+ h.setColumnTypes(params.getCsvColumnTypes());
+ }
+ if (params.getCsvColumnNames() != null) {
+ h.setColumnNames(params.getCsvColumnNames());
+ }
+ try {
+ ArrayList<String> cols = new ArrayList<String>();
+ cols.addAll(params.getCsvColumnNames());
+ // prepare select statement
+ String sqlText;
+ Object[] base = null;
+ if (params.getSqlSelect() != null) {
+ sqlText = params.getSqlSelect();
+ base = params.getBindBase();
+ }
+ else {
+ StringBuffer buf = new StringBuffer();
+ buf.append("SELECT ");
+ for (Iterator<String> it = cols.iterator(); it.hasNext();) {
+ String colName = it.next();
+ buf.append(colName);
+ if (it.hasNext()) {
+ buf.append(",");
+ }
+ }
+ buf.append(" FROM ");
+ buf.append(params.getTableName());
+ if (params.getGroupKeyValue() != null) {
+ buf.append(" WHERE ");
+ buf.append(params.getGroupKeyColumnName());
+ buf.append("=:groupKeyColumnValue");
+ }
+ if (params.getLineNumberColumnName() != null) {
+ buf.append(" ORDER BY ");
+ buf.append(params.getLineNumberColumnName());
+ }
+ sqlText = buf.toString();
+ if (params.getGroupKeyValue() != null) {
+ base = new Object[1];
+ base[0] = new NVPair("groupKeyColumnValue", params.getGroupKeyValue());
+ }
+ }
+ final Writer w = new OutputStreamWriter(new FileOutputStream(params.getFile()), params.getEncoding());
+ try {
+ h.exportHeaderRows(w, params.getWriteColumnNames(), params.getWriteColumnTypes());
+ ISelectStreamHandler handler = new ISelectStreamHandler() {
+ @Override
+ public void handleRow(Connection con, PreparedStatement stm, ResultSet rs, int rowIndex, List<SqlBind> values) throws ProcessingException {
+ Object[] row = new Object[values.size()];
+ for (int i = 0; i < row.length; i++) {
+ row[i] = values.get(i).getValue();
+ }
+ h.exportDataRow(row, w, false);
+ }
+
+ @Override
+ public void finished(Connection con, PreparedStatement stm, ResultSet rs, int rowCount) throws ProcessingException {
+ }
+ };
+ m_sqlService.selectStreaming(sqlText, handler, base);
+ }
+ finally {
+ try {
+ w.close();
+ }
+ catch (Exception e) {
+ }
+ }
+ }
+ catch (Exception e) {
+ throw new ProcessingException(e.getMessage(), e);
+ }
+ }
+
+ public void importDataIntoTable(File f, String encoding, Locale contentLocale, int headerRowCount, String colSeparator, String textDelimiter, String tableName, String groupKeyColumnName, Object groupKeyValue, String lineNumberColumnName, List<String> csvColumnNames, List<String> csvColumnTypes, boolean allowVariableColumnCount) throws ProcessingException {
+ if (encoding == null) {
+ encoding = "UTF-8";
+ }
+ try {
+ CsvSqlSettings params = new CsvSqlSettings();
+ params.setFile(f);
+ params.setEncoding(encoding);
+ params.setContentLocale(contentLocale);
+ params.setHeaderRowCount(headerRowCount);
+ params.setColSeparator((colSeparator == null) ? 0 : colSeparator.charAt(0));
+ params.setTextDelimiter((textDelimiter == null) ? 0 : textDelimiter.charAt(0));
+ params.setTableName(tableName);
+ params.setGroupKeyColumnName(groupKeyColumnName);
+ params.setGroupKeyValue(groupKeyValue);
+ params.setLineNumberColumnName(lineNumberColumnName);
+ params.setAllowVariableColumnCount(allowVariableColumnCount);
+ if (csvColumnNames != null) {
+ params.setCsvColumnNames(csvColumnNames);
+ }
+ if (csvColumnTypes != null) {
+ params.setCsvColumnTypes(csvColumnTypes);
+ }
+ importData(params);
+ }
+ catch (Exception e) {
+ throw new ProcessingException(e.getMessage(), e);
+ }
+ }
+
+ public void importData(CsvSqlSettings params) throws ProcessingException {
+ CsvHelper h = new CsvHelper(params.getContentLocale(), params.getColSeparator(), params.getTextDelimiter(), "\n");
+ if (params.getCsvColumnTypes() != null) {
+ h.setColumnTypes(params.getCsvColumnTypes());
+ }
+ if (params.getCsvColumnNames() != null) {
+ h.setColumnNames(params.getCsvColumnNames());
+ }
+ try {
+ ArrayList<String> cols = new ArrayList<String>();
+ if (params.getGroupKeyValue() != null) {
+ cols.add(params.getGroupKeyColumnName());
+ }
+ if (params.getLineNumberColumnName() != null) {
+ cols.add(params.getLineNumberColumnName());
+ }
+ cols.addAll(params.getCsvColumnNames()); //
+ StringBuffer buf = new StringBuffer();
+ buf.append("INSERT INTO ");
+ buf.append(params.getTableName());
+ buf.append("(");
+ for (Iterator<String> it = cols.iterator(); it.hasNext();) {
+ String colName = it.next();
+ if (!CsvHelper.IGNORED_COLUMN_NAME.equals(colName)) {
+ buf.append(colName);
+ buf.append(",");
+ }
+ }
+ buf.deleteCharAt(buf.length() - 1);
+ buf.append(") VALUES (");
+ int i = 0;
+ for (Iterator<String> it = cols.iterator(); it.hasNext();) {
+ String colName = it.next();
+ if (!CsvHelper.IGNORED_COLUMN_NAME.equals(colName)) {
+ buf.append(":v" + i);
+ buf.append(",");
+ i++;
+ }
+ }
+ buf.deleteCharAt(buf.length() - 1);
+ buf.append(")");
+ String stm = buf.toString();
+
+ final Reader reader = new InputStreamReader(new FileInputStream(params.getFile()), params.getEncoding());
+ try {
+ SqlInsertDataConsumer cons = new SqlInsertDataConsumer(stm, params.getGroupKeyValue(), params.getLineNumberColumnName() != null);
+ h.importData(cons, reader, false, false, params.getHeaderRowCount(), -1, params.getAllowVariableColumnCount());
+ }
+ finally {
+ reader.close();
+ }
+ }
+ catch (Exception e) {
+ throw new ProcessingException(e.getMessage(), e);
+ }
+ }
+
+ private class SqlInsertDataConsumer implements IDataConsumer {
+ private String m_statement;
+ private Object m_groupKey;
+ private boolean m_useLineNumberColumnName;
+
+ public SqlInsertDataConsumer(String stm, Object groupKey, boolean useLineNumberColumnName) {
+ m_statement = stm;
+ m_groupKey = groupKey;
+ m_useLineNumberColumnName = useLineNumberColumnName;
+ }
+
+ @Override
+ public void processRow(int lineNr, List<Object> row) throws ProcessingException {
+ try {
+ ArrayList<Object> bindBase = new ArrayList<Object>();
+ int i = 0;
+ if (m_groupKey != null) {
+ bindBase.add(new NVPair("v" + i, m_groupKey));
+ i++;
+ }
+ if (m_useLineNumberColumnName) {
+ bindBase.add(new NVPair("v" + i, lineNr));
+ i++;
+ }
+ for (Iterator<Object> it = row.iterator(); it.hasNext();) {
+ bindBase.add(new NVPair("v" + i, it.next()));
+ i++;
+ }
+ m_sqlService.insert(m_statement, bindBase.toArray());
+ }
+ catch (Exception e) {
+ throw new ProcessingException("line=" + lineNr + " row=" + row + "\n" + e.getMessage());
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/csv/CsvSqlSettings.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/csv/CsvSqlSettings.java
index 0b6ad19478..e57fc4cd9d 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/csv/CsvSqlSettings.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/csv/CsvSqlSettings.java
@@ -1,182 +1,182 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.csv;
-
-import java.io.File;
-import java.io.Serializable;
-import java.util.List;
-import java.util.Locale;
-
-public class CsvSqlSettings implements Serializable {
- private static final long serialVersionUID = 1L;
- private File m_file;
- private String m_encoding;
- private Locale m_contentLocale;
- private int m_headerRowCount;
- private char m_colSeparator;
- private char m_textDelimiter;
- private String m_tableName;
- private String m_groupKeyColumnName;
- private Object m_groupKeyValue;
- private String m_lineNumberColumnName;
- private List<String> m_csvColumnNames;
- private List<String> m_csvColumnTypes;
- private String m_sqlSelect;
- private Object[] m_bindBase;
- private boolean m_writeColumnNames;
- private boolean m_writeColumnTypes;
- private boolean m_allowVariableColumnCount;
-
- public CsvSqlSettings() {
- }
-
- public File getFile() {
- return m_file;
- }
-
- public void setFile(File file) {
- m_file = file;
- }
-
- public String getEncoding() {
- return m_encoding;
- }
-
- public void setEncoding(String encoding) {
- m_encoding = encoding;
- }
-
- public char getColSeparator() {
- return m_colSeparator;
- }
-
- public void setColSeparator(char colSeparator) {
- m_colSeparator = colSeparator;
- }
-
- public Locale getContentLocale() {
- return m_contentLocale;
- }
-
- public void setContentLocale(Locale contentLocale) {
- m_contentLocale = contentLocale;
- }
-
- public List<String> getCsvColumnNames() {
- return m_csvColumnNames;
- }
-
- public void setCsvColumnNames(List<String> csvColumnNames) {
- m_csvColumnNames = csvColumnNames;
- }
-
- public List<String> getCsvColumnTypes() {
- return m_csvColumnTypes;
- }
-
- public void setCsvColumnTypes(List<String> csvColumnTypes) {
- m_csvColumnTypes = csvColumnTypes;
- }
-
- public String getGroupKeyColumnName() {
- return m_groupKeyColumnName;
- }
-
- public void setGroupKeyColumnName(String groupKeyColumnName) {
- m_groupKeyColumnName = groupKeyColumnName;
- }
-
- public Object getGroupKeyValue() {
- return m_groupKeyValue;
- }
-
- public void setGroupKeyValue(Object groupKeyValue) {
- m_groupKeyValue = groupKeyValue;
- }
-
- public int getHeaderRowCount() {
- return m_headerRowCount;
- }
-
- public void setHeaderRowCount(int headerRowCount) {
- m_headerRowCount = headerRowCount;
- }
-
- public String getLineNumberColumnName() {
- return m_lineNumberColumnName;
- }
-
- public void setLineNumberColumnName(String lineNumberColumnName) {
- m_lineNumberColumnName = lineNumberColumnName;
- }
-
- public String getTableName() {
- return m_tableName;
- }
-
- public void setTableName(String tableName) {
- m_tableName = tableName;
- }
-
- public char getTextDelimiter() {
- return m_textDelimiter;
- }
-
- public void setTextDelimiter(char textDelimiter) {
- m_textDelimiter = textDelimiter;
- }
-
- public void setWriteColumnNames(boolean val) {
- m_writeColumnNames = val;
- }
-
- public boolean getWriteColumnNames() {
- return m_writeColumnNames;
- }
-
- public void setWriteColumnTypes(boolean val) {
- m_writeColumnTypes = val;
- }
-
- public boolean getWriteColumnTypes() {
- return m_writeColumnTypes;
- }
-
- public void setAllowVariableColumnCount(boolean val) {
- m_allowVariableColumnCount = val;
- }
-
- public boolean getAllowVariableColumnCount() {
- return m_allowVariableColumnCount;
- }
-
- /**
- * @since 2.6
- */
- public void setSqlSelect(String s) {
- m_sqlSelect = s;
- }
-
- /**
- * @since 2.6
- */
- public String getSqlSelect() {
- return m_sqlSelect;
- }
-
- public void setBindBase(Object[] base) {
- m_bindBase = base;
- }
-
- public Object[] getBindBase() {
- return m_bindBase;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.csv;
+
+import java.io.File;
+import java.io.Serializable;
+import java.util.List;
+import java.util.Locale;
+
+public class CsvSqlSettings implements Serializable {
+ private static final long serialVersionUID = 1L;
+ private File m_file;
+ private String m_encoding;
+ private Locale m_contentLocale;
+ private int m_headerRowCount;
+ private char m_colSeparator;
+ private char m_textDelimiter;
+ private String m_tableName;
+ private String m_groupKeyColumnName;
+ private Object m_groupKeyValue;
+ private String m_lineNumberColumnName;
+ private List<String> m_csvColumnNames;
+ private List<String> m_csvColumnTypes;
+ private String m_sqlSelect;
+ private Object[] m_bindBase;
+ private boolean m_writeColumnNames;
+ private boolean m_writeColumnTypes;
+ private boolean m_allowVariableColumnCount;
+
+ public CsvSqlSettings() {
+ }
+
+ public File getFile() {
+ return m_file;
+ }
+
+ public void setFile(File file) {
+ m_file = file;
+ }
+
+ public String getEncoding() {
+ return m_encoding;
+ }
+
+ public void setEncoding(String encoding) {
+ m_encoding = encoding;
+ }
+
+ public char getColSeparator() {
+ return m_colSeparator;
+ }
+
+ public void setColSeparator(char colSeparator) {
+ m_colSeparator = colSeparator;
+ }
+
+ public Locale getContentLocale() {
+ return m_contentLocale;
+ }
+
+ public void setContentLocale(Locale contentLocale) {
+ m_contentLocale = contentLocale;
+ }
+
+ public List<String> getCsvColumnNames() {
+ return m_csvColumnNames;
+ }
+
+ public void setCsvColumnNames(List<String> csvColumnNames) {
+ m_csvColumnNames = csvColumnNames;
+ }
+
+ public List<String> getCsvColumnTypes() {
+ return m_csvColumnTypes;
+ }
+
+ public void setCsvColumnTypes(List<String> csvColumnTypes) {
+ m_csvColumnTypes = csvColumnTypes;
+ }
+
+ public String getGroupKeyColumnName() {
+ return m_groupKeyColumnName;
+ }
+
+ public void setGroupKeyColumnName(String groupKeyColumnName) {
+ m_groupKeyColumnName = groupKeyColumnName;
+ }
+
+ public Object getGroupKeyValue() {
+ return m_groupKeyValue;
+ }
+
+ public void setGroupKeyValue(Object groupKeyValue) {
+ m_groupKeyValue = groupKeyValue;
+ }
+
+ public int getHeaderRowCount() {
+ return m_headerRowCount;
+ }
+
+ public void setHeaderRowCount(int headerRowCount) {
+ m_headerRowCount = headerRowCount;
+ }
+
+ public String getLineNumberColumnName() {
+ return m_lineNumberColumnName;
+ }
+
+ public void setLineNumberColumnName(String lineNumberColumnName) {
+ m_lineNumberColumnName = lineNumberColumnName;
+ }
+
+ public String getTableName() {
+ return m_tableName;
+ }
+
+ public void setTableName(String tableName) {
+ m_tableName = tableName;
+ }
+
+ public char getTextDelimiter() {
+ return m_textDelimiter;
+ }
+
+ public void setTextDelimiter(char textDelimiter) {
+ m_textDelimiter = textDelimiter;
+ }
+
+ public void setWriteColumnNames(boolean val) {
+ m_writeColumnNames = val;
+ }
+
+ public boolean getWriteColumnNames() {
+ return m_writeColumnNames;
+ }
+
+ public void setWriteColumnTypes(boolean val) {
+ m_writeColumnTypes = val;
+ }
+
+ public boolean getWriteColumnTypes() {
+ return m_writeColumnTypes;
+ }
+
+ public void setAllowVariableColumnCount(boolean val) {
+ m_allowVariableColumnCount = val;
+ }
+
+ public boolean getAllowVariableColumnCount() {
+ return m_allowVariableColumnCount;
+ }
+
+ /**
+ * @since 2.6
+ */
+ public void setSqlSelect(String s) {
+ m_sqlSelect = s;
+ }
+
+ /**
+ * @since 2.6
+ */
+ public String getSqlSelect() {
+ return m_sqlSelect;
+ }
+
+ public void setBindBase(Object[] base) {
+ m_bindBase = base;
+ }
+
+ public Object[] getBindBase() {
+ return m_bindBase;
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/file/RemoteFileService.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/file/RemoteFileService.java
index 7041f6ae0b..eb0d1b1592 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/file/RemoteFileService.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/file/RemoteFileService.java
@@ -1,354 +1,354 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.file;
-
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.FilenameFilter;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.regex.Pattern;
-
-import org.eclipse.scout.commons.BundleContextUtility;
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.shared.services.common.file.IRemoteFileService;
-import org.eclipse.scout.rt.shared.services.common.file.RemoteFile;
-import org.eclipse.scout.rt.shared.servicetunnel.RemoteServiceAccessDenied;
-import org.eclipse.scout.service.AbstractService;
-
-@Priority(-1)
-public class RemoteFileService extends AbstractService implements IRemoteFileService {
- private String m_rootPath;
-
- public RemoteFileService() throws ProcessingException {
- initConfig();
- }
-
- @ConfigProperty(ConfigProperty.STRING)
- protected String getConfiguredRootPath() {
- return null;
- }
-
- protected void initConfig() throws ProcessingException {
- setRootPath(getConfiguredRootPath());
- }
-
- public String getRootPath() {
- return m_rootPath;
- }
-
- /**
- * Supports ${...} variables resolved by {@link BundleContextUtility#resolve(String)}
- */
- public void setRootPath(String rootPath) throws ProcessingException {
- if (rootPath == null || rootPath.length() == 0) {
- m_rootPath = null;
- }
- else {
- String tmp = BundleContextUtility.resolve(rootPath);
- tmp = tmp.replaceAll("\\\\", "/");
- tmp = tmp.replaceAll("//", "/");
- File f = new File(tmp);
- try {
- m_rootPath = f.getCanonicalPath();
- }
- catch (IOException e) {
- m_rootPath = null;
- throw new ProcessingException("invalid path for file service: '" + rootPath + "'", e);
- }
- }
- }
-
- @Override
- public RemoteFile getRemoteFileHeader(RemoteFile spec) throws ProcessingException {
- return getRemoteFileInternal(spec, false, 0, -1);
- }
-
- @Override
- public RemoteFile getRemoteFile(RemoteFile spec) throws ProcessingException {
- return getRemoteFileInternal(spec, null, 0, -1);
- }
-
- public RemoteFile getRemoteFile(RemoteFile spec, long maxBlockSize) throws ProcessingException {
- return getRemoteFileInternal(spec, null, 0, maxBlockSize);
- }
-
- @Override
- public RemoteFile getRemoteFilePart(RemoteFile spec, long blockNumber) throws ProcessingException {
- return getRemoteFileInternal(spec, null, blockNumber * RemoteFile.DEFAULT_MAX_BLOCK_SIZE, RemoteFile.DEFAULT_MAX_BLOCK_SIZE);
- }
-
- private RemoteFile getRemoteFileInternal(RemoteFile spec, Boolean includeContent, long startPosition, long maxBlockSize) throws ProcessingException {
- if (m_rootPath == null) {
- throw new SecurityException("invalid path for file service: path may not be null");
- }
- File file = getFileInternal(spec);
- RemoteFile result = new RemoteFile(spec.getDirectory(), file.getName(), spec.getLocale(), -1, spec.getCharsetName());
- result.setContentType(spec.getContentType());
- if (!StringUtility.hasText(result.getContentType())) {
- int pos = result.getName().lastIndexOf('.');
- String ext = "";
- if (pos >= 0) {
- ext = result.getName().substring(pos + 1);
- }
- result.setContentTypeByExtension(ext);
- }
- //
- if (file.exists()) {
- result.setExists(true);
- result.setLastModified(file.lastModified());
- long partLength = file.length();
- if (maxBlockSize > -1 && partLength > maxBlockSize) {
- partLength = partLength - startPosition;
- if (partLength > maxBlockSize) {
- partLength = maxBlockSize;
- }
- if (partLength <= 0) {
- partLength = 0;
- }
- }
- result.setContentLength((int) partLength);
- if (includeContent != null && (!includeContent)) {
- // no content requested
- }
- else if (CompareUtility.equals(spec.getName(), result.getName()) && result.getLastModified() <= spec.getLastModified() && result.getPartStartPosition() == spec.getPartStartPosition()) {
- // no content change, keep null
- }
- else {
- try {
- result.readData(new FileInputStream(file), startPosition, maxBlockSize);
- }
- catch (IOException e) {
- throw new ProcessingException("error reading file: " + file.getAbsolutePath(), e);
- }
- }
- }
- return result;
- }
-
- private String[][] getFiles(String folderBase, FilenameFilter filter) throws ProcessingException {
- if (m_rootPath == null) {
- throw new SecurityException("invalid path for file service: path may not be null");
- }
- File root = new File(getRootPath());
- File path = null;
- if (folderBase == null || folderBase.length() == 0) {
- path = new File(getRootPath());
- }
- else {
- String tmp = folderBase;
- tmp = tmp.replaceAll("\\\\", "/");
- tmp = tmp.replaceAll("//", "/");
- path = new File(getRootPath(), tmp);
- }
- String canonicalRoot;
- String canonicalFolder;
- try {
- canonicalFolder = path.getCanonicalPath();
- canonicalRoot = root.getCanonicalPath();
- }
- catch (IOException e) {
- throw new ProcessingException("invalid path for file service for file: '" + folderBase + "'", e);
- }
- if (canonicalFolder == null || !canonicalFolder.startsWith(canonicalRoot)) {
- throw new SecurityException("invalid path for file service: path outside root-path");
- }
-
- ArrayList<String> dirList = new ArrayList<String>();
- ArrayList<String> fileList = new ArrayList<String>();
- String[] dir = path.list(filter);
- if (dir != null) {
- for (int i = 0; i < dir.length; i++) {
- try {
- File file = new File(path.getCanonicalPath() + "/" + dir[i]);
- if (!file.isHidden()) {
- if (file.exists() && file.isDirectory()) {
- String[][] tmp = getFiles((folderBase == null ? dir[i] : folderBase + "/" + dir[i]), filter);
- for (String[] f : tmp) {
- dirList.add(f[0]);
- fileList.add(f[1]);
- }
- }
- else {
- dirList.add(folderBase);
- fileList.add(dir[i]);
- }
- }
- }
- catch (IOException e) {
- throw new ProcessingException("FileService.getFiles:", e);
- }
- }
- }
- String[][] retVal = new String[dirList.size()][2];
- for (int i = 0; i < dirList.size(); i++) {
- retVal[i][0] = dirList.get(i);
- retVal[i][1] = fileList.get(i);
- }
- return retVal;
- }
-
- @Override
- public RemoteFile[] getRemoteFiles(String folderPath, FilenameFilter filter, RemoteFile[] existingFileInfoOnClient) throws ProcessingException {
- return getRemoteFiles(folderPath, filter, existingFileInfoOnClient, "UTF-8");
- }
-
- public RemoteFile[] getRemoteFiles(String folderPath, FilenameFilter filter, RemoteFile[] existingFileInfoOnClient, String charsetName) throws ProcessingException {
- return getRemoteFiles(folderPath, filter, existingFileInfoOnClient, charsetName, RemoteFile.DEFAULT_MAX_BLOCK_SIZE);
- }
-
- public RemoteFile[] getRemoteFiles(String folderPath, FilenameFilter filter, RemoteFile[] existingFileInfoOnClient, String charsetName, long maxBlockSize) throws ProcessingException {
- HashMap<String, RemoteFile> fileList = new HashMap<String, RemoteFile>();
- if (existingFileInfoOnClient != null) {
- for (RemoteFile rf : existingFileInfoOnClient) {
- fileList.put((rf.getDirectory().endsWith("/") ? rf.getDirectory() : rf.getDirectory() + "/") + rf.getName(), rf);
- }
- }
- String[][] files = getFiles(folderPath, filter);
- for (String[] file : files) {
- if (!fileList.containsKey((file[0].endsWith("/") ? file[0] : file[0] + "/") + file[1])) {
- fileList.put((file[0].endsWith("/") ? file[0] : file[0] + "/") + file[1], new RemoteFile(file[0], file[1], 0L, charsetName));
- }
- }
- RemoteFile[] retVal = new RemoteFile[fileList.size()];
- int i = 0;
- for (RemoteFile rf : fileList.values()) {
- retVal[i] = getRemoteFile(rf, maxBlockSize);
- i++;
- }
- return retVal;
- }
-
- @Override
- @RemoteServiceAccessDenied
- public void putRemoteFile(RemoteFile spec) throws ProcessingException {
- File file = getFileInternal(spec);
- try {
- file.getParentFile().mkdirs();
- spec.writeData(new FileOutputStream(file));
- file.setLastModified(file.lastModified());
- }
- catch (Exception e) {
- throw new ProcessingException("error writing file: " + file.getAbsoluteFile(), e);
- }
- }
-
- private static final Pattern LOCALE_SECURITY_PATTERN = Pattern.compile("[a-z]+([_][a-z0-9]+)?([_][a-z0-9_]+)?", Pattern.CASE_INSENSITIVE);
-
- private File getFileInternal(RemoteFile spec) throws ProcessingException {
- File root = new File(getRootPath());
- File folder = null;
- if (spec.getDirectory() == null || spec.getDirectory().length() == 0) {
- folder = new File(getRootPath());
- }
- else {
- String tmp = spec.getDirectory();
- tmp = tmp.replaceAll("\\\\", "/");
- tmp = tmp.replaceAll("//", "/");
- folder = new File(getRootPath(), tmp);
- }
- String canonicalRoot;
- String canonicalFolder;
- String canonicalSimpleName;
- try {
- canonicalRoot = root.getCanonicalPath();
- canonicalFolder = folder.getCanonicalPath();
- canonicalSimpleName = new File(canonicalFolder, spec.getName()).getName();
- }
- catch (IOException e) {
- throw new ProcessingException("invalid or unaccessible path", e);
- }
- if (canonicalFolder == null || !canonicalFolder.startsWith(canonicalRoot)) {
- throw new SecurityException("invalid or unaccessible path");
- }
- // if the remote file is requested from the RemoteFileServlet, spec.getName() will start with an "/"
- if (canonicalSimpleName == null || !canonicalSimpleName.equals(spec.getName().startsWith("/") ? spec.getName().substring(1) : spec.getName())) {
- throw new SecurityException("invalid or unaccessible path");
- }
- //
- String filename = canonicalSimpleName;
- if (spec.getLocale() != null && filename.lastIndexOf(".") != -1) {
- //check locale string for hacking patterns (only allow
- String localeText = spec.getLocale().toString().replaceAll("__", "_");
- if (!LOCALE_SECURITY_PATTERN.matcher(localeText).matches()) {
- throw new SecurityException("invalid or unaccessible path");
- }
- String[] checkedLocaleParts = localeText.split("_", 3);
- String prefix = filename.substring(0, filename.lastIndexOf("."));
- String suffix = filename.substring(filename.lastIndexOf("."));
- for (int i = checkedLocaleParts.length - 1; i >= 0; i--) {
- if (prefix.toLowerCase().endsWith(checkedLocaleParts[i].toLowerCase())) {
- prefix = prefix.substring(0, prefix.length() - checkedLocaleParts[i].length());
- if (prefix.endsWith("_")) {
- prefix = prefix.substring(0, prefix.length() - 1);
- }
- }
- }
- if (!prefix.endsWith("_")) {
- prefix = prefix + "_";
- }
- filename = prefix + localeText + suffix;
- File test = new File(canonicalFolder, filename);
- while (!test.exists()) {
- if (localeText.indexOf("_") == -1) {
- filename = canonicalSimpleName;
- break;
- }
- localeText = localeText.substring(0, localeText.lastIndexOf("_"));
- filename = prefix + localeText + suffix;
- test = new File(canonicalFolder, filename);
- }
- }
-
- File file = new File(canonicalFolder, filename);
- return file;
- }
-
- @Override
- public void streamRemoteFile(RemoteFile spec, OutputStream out) throws ProcessingException {
- if (m_rootPath == null) {
- throw new SecurityException("invalid path for file service: path may not be null");
- }
- File file = getFileInternal(spec);
- if (!file.exists()) {
- throw new ProcessingException("remote file does not exist: " + spec.getPath());
- }
- try {
- int len = (int) file.length();
- byte[] buf = new byte[Math.min(102400, len)];
- int written = 0;
- int delta = 0;
- BufferedInputStream in = new BufferedInputStream(new FileInputStream(file));
- try {
- while (written < len) {
- delta = in.read(buf);
- out.write(buf, 0, delta);
- written += delta;
- }
- }
- finally {
- in.close();
- }
- }
- catch (IOException e) {
- throw new ProcessingException("error streaming file: " + file.getAbsolutePath(), e);
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.file;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.regex.Pattern;
+
+import org.eclipse.scout.commons.BundleContextUtility;
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.shared.services.common.file.IRemoteFileService;
+import org.eclipse.scout.rt.shared.services.common.file.RemoteFile;
+import org.eclipse.scout.rt.shared.servicetunnel.RemoteServiceAccessDenied;
+import org.eclipse.scout.service.AbstractService;
+
+@Priority(-1)
+public class RemoteFileService extends AbstractService implements IRemoteFileService {
+ private String m_rootPath;
+
+ public RemoteFileService() throws ProcessingException {
+ initConfig();
+ }
+
+ @ConfigProperty(ConfigProperty.STRING)
+ protected String getConfiguredRootPath() {
+ return null;
+ }
+
+ protected void initConfig() throws ProcessingException {
+ setRootPath(getConfiguredRootPath());
+ }
+
+ public String getRootPath() {
+ return m_rootPath;
+ }
+
+ /**
+ * Supports ${...} variables resolved by {@link BundleContextUtility#resolve(String)}
+ */
+ public void setRootPath(String rootPath) throws ProcessingException {
+ if (rootPath == null || rootPath.length() == 0) {
+ m_rootPath = null;
+ }
+ else {
+ String tmp = BundleContextUtility.resolve(rootPath);
+ tmp = tmp.replaceAll("\\\\", "/");
+ tmp = tmp.replaceAll("//", "/");
+ File f = new File(tmp);
+ try {
+ m_rootPath = f.getCanonicalPath();
+ }
+ catch (IOException e) {
+ m_rootPath = null;
+ throw new ProcessingException("invalid path for file service: '" + rootPath + "'", e);
+ }
+ }
+ }
+
+ @Override
+ public RemoteFile getRemoteFileHeader(RemoteFile spec) throws ProcessingException {
+ return getRemoteFileInternal(spec, false, 0, -1);
+ }
+
+ @Override
+ public RemoteFile getRemoteFile(RemoteFile spec) throws ProcessingException {
+ return getRemoteFileInternal(spec, null, 0, -1);
+ }
+
+ public RemoteFile getRemoteFile(RemoteFile spec, long maxBlockSize) throws ProcessingException {
+ return getRemoteFileInternal(spec, null, 0, maxBlockSize);
+ }
+
+ @Override
+ public RemoteFile getRemoteFilePart(RemoteFile spec, long blockNumber) throws ProcessingException {
+ return getRemoteFileInternal(spec, null, blockNumber * RemoteFile.DEFAULT_MAX_BLOCK_SIZE, RemoteFile.DEFAULT_MAX_BLOCK_SIZE);
+ }
+
+ private RemoteFile getRemoteFileInternal(RemoteFile spec, Boolean includeContent, long startPosition, long maxBlockSize) throws ProcessingException {
+ if (m_rootPath == null) {
+ throw new SecurityException("invalid path for file service: path may not be null");
+ }
+ File file = getFileInternal(spec);
+ RemoteFile result = new RemoteFile(spec.getDirectory(), file.getName(), spec.getLocale(), -1, spec.getCharsetName());
+ result.setContentType(spec.getContentType());
+ if (!StringUtility.hasText(result.getContentType())) {
+ int pos = result.getName().lastIndexOf('.');
+ String ext = "";
+ if (pos >= 0) {
+ ext = result.getName().substring(pos + 1);
+ }
+ result.setContentTypeByExtension(ext);
+ }
+ //
+ if (file.exists()) {
+ result.setExists(true);
+ result.setLastModified(file.lastModified());
+ long partLength = file.length();
+ if (maxBlockSize > -1 && partLength > maxBlockSize) {
+ partLength = partLength - startPosition;
+ if (partLength > maxBlockSize) {
+ partLength = maxBlockSize;
+ }
+ if (partLength <= 0) {
+ partLength = 0;
+ }
+ }
+ result.setContentLength((int) partLength);
+ if (includeContent != null && (!includeContent)) {
+ // no content requested
+ }
+ else if (CompareUtility.equals(spec.getName(), result.getName()) && result.getLastModified() <= spec.getLastModified() && result.getPartStartPosition() == spec.getPartStartPosition()) {
+ // no content change, keep null
+ }
+ else {
+ try {
+ result.readData(new FileInputStream(file), startPosition, maxBlockSize);
+ }
+ catch (IOException e) {
+ throw new ProcessingException("error reading file: " + file.getAbsolutePath(), e);
+ }
+ }
+ }
+ return result;
+ }
+
+ private String[][] getFiles(String folderBase, FilenameFilter filter) throws ProcessingException {
+ if (m_rootPath == null) {
+ throw new SecurityException("invalid path for file service: path may not be null");
+ }
+ File root = new File(getRootPath());
+ File path = null;
+ if (folderBase == null || folderBase.length() == 0) {
+ path = new File(getRootPath());
+ }
+ else {
+ String tmp = folderBase;
+ tmp = tmp.replaceAll("\\\\", "/");
+ tmp = tmp.replaceAll("//", "/");
+ path = new File(getRootPath(), tmp);
+ }
+ String canonicalRoot;
+ String canonicalFolder;
+ try {
+ canonicalFolder = path.getCanonicalPath();
+ canonicalRoot = root.getCanonicalPath();
+ }
+ catch (IOException e) {
+ throw new ProcessingException("invalid path for file service for file: '" + folderBase + "'", e);
+ }
+ if (canonicalFolder == null || !canonicalFolder.startsWith(canonicalRoot)) {
+ throw new SecurityException("invalid path for file service: path outside root-path");
+ }
+
+ ArrayList<String> dirList = new ArrayList<String>();
+ ArrayList<String> fileList = new ArrayList<String>();
+ String[] dir = path.list(filter);
+ if (dir != null) {
+ for (int i = 0; i < dir.length; i++) {
+ try {
+ File file = new File(path.getCanonicalPath() + "/" + dir[i]);
+ if (!file.isHidden()) {
+ if (file.exists() && file.isDirectory()) {
+ String[][] tmp = getFiles((folderBase == null ? dir[i] : folderBase + "/" + dir[i]), filter);
+ for (String[] f : tmp) {
+ dirList.add(f[0]);
+ fileList.add(f[1]);
+ }
+ }
+ else {
+ dirList.add(folderBase);
+ fileList.add(dir[i]);
+ }
+ }
+ }
+ catch (IOException e) {
+ throw new ProcessingException("FileService.getFiles:", e);
+ }
+ }
+ }
+ String[][] retVal = new String[dirList.size()][2];
+ for (int i = 0; i < dirList.size(); i++) {
+ retVal[i][0] = dirList.get(i);
+ retVal[i][1] = fileList.get(i);
+ }
+ return retVal;
+ }
+
+ @Override
+ public RemoteFile[] getRemoteFiles(String folderPath, FilenameFilter filter, RemoteFile[] existingFileInfoOnClient) throws ProcessingException {
+ return getRemoteFiles(folderPath, filter, existingFileInfoOnClient, "UTF-8");
+ }
+
+ public RemoteFile[] getRemoteFiles(String folderPath, FilenameFilter filter, RemoteFile[] existingFileInfoOnClient, String charsetName) throws ProcessingException {
+ return getRemoteFiles(folderPath, filter, existingFileInfoOnClient, charsetName, RemoteFile.DEFAULT_MAX_BLOCK_SIZE);
+ }
+
+ public RemoteFile[] getRemoteFiles(String folderPath, FilenameFilter filter, RemoteFile[] existingFileInfoOnClient, String charsetName, long maxBlockSize) throws ProcessingException {
+ HashMap<String, RemoteFile> fileList = new HashMap<String, RemoteFile>();
+ if (existingFileInfoOnClient != null) {
+ for (RemoteFile rf : existingFileInfoOnClient) {
+ fileList.put((rf.getDirectory().endsWith("/") ? rf.getDirectory() : rf.getDirectory() + "/") + rf.getName(), rf);
+ }
+ }
+ String[][] files = getFiles(folderPath, filter);
+ for (String[] file : files) {
+ if (!fileList.containsKey((file[0].endsWith("/") ? file[0] : file[0] + "/") + file[1])) {
+ fileList.put((file[0].endsWith("/") ? file[0] : file[0] + "/") + file[1], new RemoteFile(file[0], file[1], 0L, charsetName));
+ }
+ }
+ RemoteFile[] retVal = new RemoteFile[fileList.size()];
+ int i = 0;
+ for (RemoteFile rf : fileList.values()) {
+ retVal[i] = getRemoteFile(rf, maxBlockSize);
+ i++;
+ }
+ return retVal;
+ }
+
+ @Override
+ @RemoteServiceAccessDenied
+ public void putRemoteFile(RemoteFile spec) throws ProcessingException {
+ File file = getFileInternal(spec);
+ try {
+ file.getParentFile().mkdirs();
+ spec.writeData(new FileOutputStream(file));
+ file.setLastModified(file.lastModified());
+ }
+ catch (Exception e) {
+ throw new ProcessingException("error writing file: " + file.getAbsoluteFile(), e);
+ }
+ }
+
+ private static final Pattern LOCALE_SECURITY_PATTERN = Pattern.compile("[a-z]+([_][a-z0-9]+)?([_][a-z0-9_]+)?", Pattern.CASE_INSENSITIVE);
+
+ private File getFileInternal(RemoteFile spec) throws ProcessingException {
+ File root = new File(getRootPath());
+ File folder = null;
+ if (spec.getDirectory() == null || spec.getDirectory().length() == 0) {
+ folder = new File(getRootPath());
+ }
+ else {
+ String tmp = spec.getDirectory();
+ tmp = tmp.replaceAll("\\\\", "/");
+ tmp = tmp.replaceAll("//", "/");
+ folder = new File(getRootPath(), tmp);
+ }
+ String canonicalRoot;
+ String canonicalFolder;
+ String canonicalSimpleName;
+ try {
+ canonicalRoot = root.getCanonicalPath();
+ canonicalFolder = folder.getCanonicalPath();
+ canonicalSimpleName = new File(canonicalFolder, spec.getName()).getName();
+ }
+ catch (IOException e) {
+ throw new ProcessingException("invalid or unaccessible path", e);
+ }
+ if (canonicalFolder == null || !canonicalFolder.startsWith(canonicalRoot)) {
+ throw new SecurityException("invalid or unaccessible path");
+ }
+ // if the remote file is requested from the RemoteFileServlet, spec.getName() will start with an "/"
+ if (canonicalSimpleName == null || !canonicalSimpleName.equals(spec.getName().startsWith("/") ? spec.getName().substring(1) : spec.getName())) {
+ throw new SecurityException("invalid or unaccessible path");
+ }
+ //
+ String filename = canonicalSimpleName;
+ if (spec.getLocale() != null && filename.lastIndexOf(".") != -1) {
+ //check locale string for hacking patterns (only allow
+ String localeText = spec.getLocale().toString().replaceAll("__", "_");
+ if (!LOCALE_SECURITY_PATTERN.matcher(localeText).matches()) {
+ throw new SecurityException("invalid or unaccessible path");
+ }
+ String[] checkedLocaleParts = localeText.split("_", 3);
+ String prefix = filename.substring(0, filename.lastIndexOf("."));
+ String suffix = filename.substring(filename.lastIndexOf("."));
+ for (int i = checkedLocaleParts.length - 1; i >= 0; i--) {
+ if (prefix.toLowerCase().endsWith(checkedLocaleParts[i].toLowerCase())) {
+ prefix = prefix.substring(0, prefix.length() - checkedLocaleParts[i].length());
+ if (prefix.endsWith("_")) {
+ prefix = prefix.substring(0, prefix.length() - 1);
+ }
+ }
+ }
+ if (!prefix.endsWith("_")) {
+ prefix = prefix + "_";
+ }
+ filename = prefix + localeText + suffix;
+ File test = new File(canonicalFolder, filename);
+ while (!test.exists()) {
+ if (localeText.indexOf("_") == -1) {
+ filename = canonicalSimpleName;
+ break;
+ }
+ localeText = localeText.substring(0, localeText.lastIndexOf("_"));
+ filename = prefix + localeText + suffix;
+ test = new File(canonicalFolder, filename);
+ }
+ }
+
+ File file = new File(canonicalFolder, filename);
+ return file;
+ }
+
+ @Override
+ public void streamRemoteFile(RemoteFile spec, OutputStream out) throws ProcessingException {
+ if (m_rootPath == null) {
+ throw new SecurityException("invalid path for file service: path may not be null");
+ }
+ File file = getFileInternal(spec);
+ if (!file.exists()) {
+ throw new ProcessingException("remote file does not exist: " + spec.getPath());
+ }
+ try {
+ int len = (int) file.length();
+ byte[] buf = new byte[Math.min(102400, len)];
+ int written = 0;
+ int delta = 0;
+ BufferedInputStream in = new BufferedInputStream(new FileInputStream(file));
+ try {
+ while (written < len) {
+ delta = in.read(buf);
+ out.write(buf, 0, delta);
+ written += delta;
+ }
+ }
+ finally {
+ in.close();
+ }
+ }
+ catch (IOException e) {
+ throw new ProcessingException("error streaming file: " + file.getAbsolutePath(), e);
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/imap/AbstractIMAPService.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/imap/AbstractIMAPService.java
index ed8033a5af..a843748e43 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/imap/AbstractIMAPService.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/imap/AbstractIMAPService.java
@@ -1,298 +1,298 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.imap;
-
-import java.lang.reflect.Array;
-import java.util.ArrayList;
-import java.util.Properties;
-
-import javax.mail.Flags;
-import javax.mail.Folder;
-import javax.mail.Message;
-import javax.mail.Session;
-import javax.mail.Store;
-
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.service.AbstractService;
-
-public abstract class AbstractIMAPService extends AbstractService implements IIMAPService {
-
- private String m_host;
- private int m_port;
- private String m_mailbox;
- private String m_username;
- private String m_password;
- private boolean m_opened = false;
- private Folder m_folder;
- private Store m_store;
-
- public AbstractIMAPService() {
- init();
- }
-
- @ConfigProperty(ConfigProperty.STRING)
- @Order(10)
- @ConfigPropertyValue("null")
- protected String getConfiguredHost() {
- return null;
- }
-
- public String getHost() {
- return m_host;
- }
-
- public void setHost(String s) {
- m_host = s;
- }
-
- @ConfigProperty(ConfigProperty.STRING)
- @Order(20)
- @ConfigPropertyValue("-1")
- protected int getConfiguredPort() {
- return -1;
- }
-
- public int getPort() {
- return m_port;
- }
-
- public void setPort(int i) {
- m_port = i;
- }
-
- @ConfigProperty(ConfigProperty.STRING)
- @Order(30)
- @ConfigPropertyValue("null")
- protected String getConfiguredMailbox() {
- return null;
- }
-
- public String getMailbox() {
- return m_mailbox;
- }
-
- public void setMailbox(String s) {
- m_mailbox = s;
- }
-
- @ConfigProperty(ConfigProperty.STRING)
- @Order(40)
- @ConfigPropertyValue("null")
- protected String getConfiguredUserName() {
- return null;
- }
-
- public String getUserName() {
- return m_username;
- }
-
- public void setUserName(String s) {
- m_username = s;
- }
-
- @ConfigProperty(ConfigProperty.STRING)
- @Order(50)
- @ConfigPropertyValue("null")
- protected String getConfiguredPassword() {
- return null;
- }
-
- public String getPassword() {
- return m_password;
- }
-
- public void setPassword(String s) {
- m_password = s;
- }
-
- public void openConnection() throws ProcessingException {
- openConnection(false);
- }
-
- public void openConnection(boolean useSSL) throws ProcessingException {
- try {
- Properties props = new Properties();
- props.put("mail.transport.protocol", "imap");
- if (m_host != null) {
- props.put("mail.imap.host", m_host);
- }
- if (m_port > 0) {
- props.put("mail.imap.port", "" + m_port);
- }
- if (m_username != null) {
- props.put("mail.imap.user", m_username);
- }
- if (useSSL) {
- props.setProperty("mail.imap.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
- props.setProperty("mail.imap.socketFactory.fallback", "false");
- props.setProperty("mail.imap.socketFactory.port", "993");
- }
- Session session = Session.getInstance(props, null);
- m_store = session.getStore("imap");
- if (m_username != null && m_host != null) {
- m_store.connect(System.getProperty("mail.imap.host"), m_username, m_password);
- }
- else {
- m_store.connect();
- }
- if (m_mailbox != null) {
- m_folder = m_store.getFolder(m_mailbox);
- }
- else {
- m_folder = m_store.getDefaultFolder();
- }
- m_folder.open(Folder.READ_WRITE);
- m_opened = true;
- }
- catch (Exception e) {
- throw new ProcessingException("opening", e);
- }
- }
-
- public void closeConnection() throws ProcessingException {
- try {
- m_folder.close(true);
- m_folder = null;
- m_store.close();
- m_store = null;
- m_opened = false;
- }
- catch (Exception e) {
- throw new ProcessingException(e.getMessage(), e);
- }
- finally {
- if (m_folder != null) {
- try {
- m_folder.close(false);
- }
- catch (Throwable fatal) {
- }
- }
- if (m_store != null) {
- try {
- m_store.close();
- }
- catch (Throwable fatal) {
- }
- }
- }
- }
-
- @Override
- public Message[] getUnreadMessages() throws ProcessingException {
- ReadMailTask task = new ReadMailTask();
- doTask(task);
- return task.getUnreadMessages();
- }
-
- @Override
- public void deleteAllMessages() throws ProcessingException {
- DeleteMailTask task = new DeleteMailTask(true);
- doTask(task);
- }
-
- @Override
- public void deleteMessages(Message... toDelete) throws ProcessingException {
- DeleteMailTask task = new DeleteMailTask(false);
- task.setMessagesToDelete(toDelete);
- doTask(task);
- }
-
- private void doTask(AbstractMailTask task) throws ProcessingException {
- if (m_opened == false) {
- throw new ProcessingException("No connection opened");
- }
- else {
- task.doTask(m_folder);
- }
- }
-
- private void init() {
- setHost(getConfiguredHost());
- setPort(getConfiguredPort());
- setMailbox(getConfiguredMailbox());
- setUserName(getConfiguredUserName());
- setPassword(getConfiguredPassword());
- }
-
- private abstract class AbstractMailTask {
- public void doTask(Folder folder) throws ProcessingException {
- }
- }
-
- private class ReadMailTask extends AbstractMailTask {
-
- private ArrayList<Message> messages = new ArrayList<Message>();
-
- @Override
- public void doTask(Folder folder) throws ProcessingException {
- try {
- Message item;
- Message[] m = folder.getMessages();
- for (int i = 0; i < Array.getLength(m); i++) {
- item = m[i];
- if (!item.isSet(Flags.Flag.SEEN)) {
- messages.add(item);
- }
- }
- }
- catch (Exception e) {
- throw new ProcessingException(e.getMessage(), e);
- }
- }
-
- public Message[] getUnreadMessages() {
- Message[] messageArray = new Message[messages.size()];
- messages.toArray(messageArray);
- return messageArray;
- }
- }
-
- private class DeleteMailTask extends AbstractMailTask {
-
- private Message[] toDelete;
- private boolean deleteAll;
-
- DeleteMailTask(boolean all) {
- deleteAll = all;
- }
-
- @Override
- public void doTask(Folder folder) throws ProcessingException {
- try {
- Message[] m = folder.getMessages();
- if (deleteAll == true) {
- toDelete = folder.getMessages();
- }
- for (int i = 0; i < Array.getLength(toDelete); i++) {
- Message item = toDelete[i];
- for (int j = 0; j < Array.getLength(m); j++) {
- Message msg = m[j];
- if (item.equals(msg)) {
- msg.setFlag(Flags.Flag.DELETED, true);
- }
- }
- }
- }
- catch (Exception e) {
- throw new ProcessingException(e.getMessage(), e);
- }
- }
-
- public void setMessagesToDelete(Message[] msgs) {
- toDelete = msgs;
- }
-
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.imap;
+
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.Properties;
+
+import javax.mail.Flags;
+import javax.mail.Folder;
+import javax.mail.Message;
+import javax.mail.Session;
+import javax.mail.Store;
+
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.service.AbstractService;
+
+public abstract class AbstractIMAPService extends AbstractService implements IIMAPService {
+
+ private String m_host;
+ private int m_port;
+ private String m_mailbox;
+ private String m_username;
+ private String m_password;
+ private boolean m_opened = false;
+ private Folder m_folder;
+ private Store m_store;
+
+ public AbstractIMAPService() {
+ init();
+ }
+
+ @ConfigProperty(ConfigProperty.STRING)
+ @Order(10)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredHost() {
+ return null;
+ }
+
+ public String getHost() {
+ return m_host;
+ }
+
+ public void setHost(String s) {
+ m_host = s;
+ }
+
+ @ConfigProperty(ConfigProperty.STRING)
+ @Order(20)
+ @ConfigPropertyValue("-1")
+ protected int getConfiguredPort() {
+ return -1;
+ }
+
+ public int getPort() {
+ return m_port;
+ }
+
+ public void setPort(int i) {
+ m_port = i;
+ }
+
+ @ConfigProperty(ConfigProperty.STRING)
+ @Order(30)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredMailbox() {
+ return null;
+ }
+
+ public String getMailbox() {
+ return m_mailbox;
+ }
+
+ public void setMailbox(String s) {
+ m_mailbox = s;
+ }
+
+ @ConfigProperty(ConfigProperty.STRING)
+ @Order(40)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredUserName() {
+ return null;
+ }
+
+ public String getUserName() {
+ return m_username;
+ }
+
+ public void setUserName(String s) {
+ m_username = s;
+ }
+
+ @ConfigProperty(ConfigProperty.STRING)
+ @Order(50)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredPassword() {
+ return null;
+ }
+
+ public String getPassword() {
+ return m_password;
+ }
+
+ public void setPassword(String s) {
+ m_password = s;
+ }
+
+ public void openConnection() throws ProcessingException {
+ openConnection(false);
+ }
+
+ public void openConnection(boolean useSSL) throws ProcessingException {
+ try {
+ Properties props = new Properties();
+ props.put("mail.transport.protocol", "imap");
+ if (m_host != null) {
+ props.put("mail.imap.host", m_host);
+ }
+ if (m_port > 0) {
+ props.put("mail.imap.port", "" + m_port);
+ }
+ if (m_username != null) {
+ props.put("mail.imap.user", m_username);
+ }
+ if (useSSL) {
+ props.setProperty("mail.imap.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
+ props.setProperty("mail.imap.socketFactory.fallback", "false");
+ props.setProperty("mail.imap.socketFactory.port", "993");
+ }
+ Session session = Session.getInstance(props, null);
+ m_store = session.getStore("imap");
+ if (m_username != null && m_host != null) {
+ m_store.connect(System.getProperty("mail.imap.host"), m_username, m_password);
+ }
+ else {
+ m_store.connect();
+ }
+ if (m_mailbox != null) {
+ m_folder = m_store.getFolder(m_mailbox);
+ }
+ else {
+ m_folder = m_store.getDefaultFolder();
+ }
+ m_folder.open(Folder.READ_WRITE);
+ m_opened = true;
+ }
+ catch (Exception e) {
+ throw new ProcessingException("opening", e);
+ }
+ }
+
+ public void closeConnection() throws ProcessingException {
+ try {
+ m_folder.close(true);
+ m_folder = null;
+ m_store.close();
+ m_store = null;
+ m_opened = false;
+ }
+ catch (Exception e) {
+ throw new ProcessingException(e.getMessage(), e);
+ }
+ finally {
+ if (m_folder != null) {
+ try {
+ m_folder.close(false);
+ }
+ catch (Throwable fatal) {
+ }
+ }
+ if (m_store != null) {
+ try {
+ m_store.close();
+ }
+ catch (Throwable fatal) {
+ }
+ }
+ }
+ }
+
+ @Override
+ public Message[] getUnreadMessages() throws ProcessingException {
+ ReadMailTask task = new ReadMailTask();
+ doTask(task);
+ return task.getUnreadMessages();
+ }
+
+ @Override
+ public void deleteAllMessages() throws ProcessingException {
+ DeleteMailTask task = new DeleteMailTask(true);
+ doTask(task);
+ }
+
+ @Override
+ public void deleteMessages(Message... toDelete) throws ProcessingException {
+ DeleteMailTask task = new DeleteMailTask(false);
+ task.setMessagesToDelete(toDelete);
+ doTask(task);
+ }
+
+ private void doTask(AbstractMailTask task) throws ProcessingException {
+ if (m_opened == false) {
+ throw new ProcessingException("No connection opened");
+ }
+ else {
+ task.doTask(m_folder);
+ }
+ }
+
+ private void init() {
+ setHost(getConfiguredHost());
+ setPort(getConfiguredPort());
+ setMailbox(getConfiguredMailbox());
+ setUserName(getConfiguredUserName());
+ setPassword(getConfiguredPassword());
+ }
+
+ private abstract class AbstractMailTask {
+ public void doTask(Folder folder) throws ProcessingException {
+ }
+ }
+
+ private class ReadMailTask extends AbstractMailTask {
+
+ private ArrayList<Message> messages = new ArrayList<Message>();
+
+ @Override
+ public void doTask(Folder folder) throws ProcessingException {
+ try {
+ Message item;
+ Message[] m = folder.getMessages();
+ for (int i = 0; i < Array.getLength(m); i++) {
+ item = m[i];
+ if (!item.isSet(Flags.Flag.SEEN)) {
+ messages.add(item);
+ }
+ }
+ }
+ catch (Exception e) {
+ throw new ProcessingException(e.getMessage(), e);
+ }
+ }
+
+ public Message[] getUnreadMessages() {
+ Message[] messageArray = new Message[messages.size()];
+ messages.toArray(messageArray);
+ return messageArray;
+ }
+ }
+
+ private class DeleteMailTask extends AbstractMailTask {
+
+ private Message[] toDelete;
+ private boolean deleteAll;
+
+ DeleteMailTask(boolean all) {
+ deleteAll = all;
+ }
+
+ @Override
+ public void doTask(Folder folder) throws ProcessingException {
+ try {
+ Message[] m = folder.getMessages();
+ if (deleteAll == true) {
+ toDelete = folder.getMessages();
+ }
+ for (int i = 0; i < Array.getLength(toDelete); i++) {
+ Message item = toDelete[i];
+ for (int j = 0; j < Array.getLength(m); j++) {
+ Message msg = m[j];
+ if (item.equals(msg)) {
+ msg.setFlag(Flags.Flag.DELETED, true);
+ }
+ }
+ }
+ }
+ catch (Exception e) {
+ throw new ProcessingException(e.getMessage(), e);
+ }
+ }
+
+ public void setMessagesToDelete(Message[] msgs) {
+ toDelete = msgs;
+ }
+
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/imap/IIMAPService.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/imap/IIMAPService.java
index 41ef19f427..e0366efe8e 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/imap/IIMAPService.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/imap/IIMAPService.java
@@ -1,30 +1,30 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.imap;
-
-import javax.mail.Message;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.service.IService;
-
-/**
- * This service is normally registered as a scout server service extension, so
- * it exists per session
- */
-public interface IIMAPService extends IService {
-
- Message[] getUnreadMessages() throws ProcessingException;
-
- void deleteMessages(Message... toDelete) throws ProcessingException;
-
- void deleteAllMessages() throws ProcessingException;
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.imap;
+
+import javax.mail.Message;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.service.IService;
+
+/**
+ * This service is normally registered as a scout server service extension, so
+ * it exists per session
+ */
+public interface IIMAPService extends IService {
+
+ Message[] getUnreadMessages() throws ProcessingException;
+
+ void deleteMessages(Message... toDelete) throws ProcessingException;
+
+ void deleteAllMessages() throws ProcessingException;
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/imap/ImapAdapter.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/imap/ImapAdapter.java
index 9f1d27f643..9a0841bf9a 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/imap/ImapAdapter.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/imap/ImapAdapter.java
@@ -1,345 +1,345 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.imap;
-
-import java.lang.reflect.Array;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Properties;
-
-import javax.mail.AuthenticationFailedException;
-import javax.mail.Flags;
-import javax.mail.Folder;
-import javax.mail.Message;
-import javax.mail.MessagingException;
-import javax.mail.Session;
-import javax.mail.Store;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-
-public class ImapAdapter {
-
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(ImapAdapter.class);
-
- public static final String TRASH_FOLDER_NAME = "Trash";
- private boolean m_useSSL;
- private String m_host;
- private int m_port = 143;
- private String m_username;
- private String m_password;
- private String m_defaultFolderName;
- private Store m_store;
- private HashMap<String, Folder> m_cachedFolders;
- private boolean m_connected = false;
-
- public ImapAdapter() {
- m_cachedFolders = new HashMap<String, Folder>();
- }
-
- public ImapAdapter(String host, int port, String username, String password) {
- this();
- m_host = host;
- m_port = port;
- m_username = username;
- m_password = password;
- }
-
- @Override
- protected void finalize() throws Throwable {
- closeConnection();
- super.finalize();
- }
-
- public Message[] getUnseenMessages() throws ProcessingException {
- return getUnseenMessages(getDefaultFolderName());
- }
-
- public Message[] getUnseenMessages(String folderName) throws ProcessingException {
- connect();
- ArrayList<Message> messages = new ArrayList<Message>();
- Folder folder = null;
- try {
- folder = findFolder(folderName);
- if (folder != null) {
- Message item;
- Message[] m = folder.getMessages();
- for (int i = 0; i < Array.getLength(m); i++) {
- item = m[i];
- if (!item.isSet(Flags.Flag.SEEN)) {
- messages.add(item);
- }
-
- }
- }
- }
- catch (MessagingException e) {
- throw new ProcessingException(e.getMessage(), e);
- }
- return messages.toArray(new Message[messages.size()]);
- }
-
- public Message[] getAllMessages() throws ProcessingException {
- return getAllMessages(getDefaultFolderName());
- }
-
- public Message[] getAllMessages(String folderName) throws ProcessingException {
- connect();
- Message[] messages = new Message[0];
- Folder folder = null;
- try {
- folder = findFolder(folderName);
- if (folder != null) {
- messages = folder.getMessages();
- }
- }
- catch (MessagingException e) {
- throw new ProcessingException(e.getMessage(), e);
- }
- return messages;
- }
-
- public void moveToTrash(Message[] messages) throws ProcessingException {
- moveMessages(TRASH_FOLDER_NAME, messages);
- }
-
- public void moveMessages(String destFolderName, Message[] messages) throws ProcessingException {
- copyMessages(destFolderName, messages, true);
- }
-
- public void copyMessages(String destFolderName, Message[] messages) throws ProcessingException {
- copyMessages(destFolderName, messages, false);
- }
-
- protected void copyMessages(String destFolderName, Message[] messages, boolean deleteSourceMessages) throws ProcessingException {
- connect();
- Folder destFolder = null;
- try {
- destFolder = findFolder(destFolderName);
- if (destFolder != null) {
- destFolder.appendMessages(messages);
- if (deleteSourceMessages) {
- deleteMessagesPermanently(messages);
- }
- }
- }
- catch (MessagingException e) {
- throw new ProcessingException(e.getMessage(), e);
- }
- }
-
- public void deleteMessagesPermanently(Message[] messages) throws ProcessingException {
- connect();
- for (Message msg : messages) {
- try {
- msg.setFlag(Flags.Flag.DELETED, true);
- }
- catch (MessagingException e) {
- throw new ProcessingException(e.getMessage(), e);
- }
- }
- }
-
- public void createFolder(String folderName) throws ProcessingException {
- findFolder(folderName, true);
- }
-
- public void removeFolder(String folderName) throws ProcessingException {
- connect();
- try {
- Folder folder = findFolder(folderName);
- if (folder != null && folder.exists()) {
- if (folder.isOpen()) {
- folder.close(true);
- }
- folder.delete(true);
- }
- }
- catch (MessagingException e) {
- throw new ProcessingException(e.getMessage(), e);
- }
- }
-
- public void connect() throws ProcessingException {
- if (!isConnected()) {
- // try{
- Properties props = new Properties();
- props.put("mail.transport.protocol", "imap");
- if (getHost() != null) {
- props.put("mail.imap.host", getHost());
- }
- if (getPort() > 0) {
- props.put("mail.imap.port", "" + getPort());
- }
- if (getUsername() != null) {
- props.put("mail.imap.user", getUsername());
- }
- if (isUseSSL()) {
- props.setProperty("mail.imap.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
- props.setProperty("mail.imap.socketFactory.fallback", "false");
- props.setProperty("mail.imap.socketFactory.port", "993");
- }
- Session session = Session.getInstance(props, null);
- try {
- m_store = session.getStore("imap");
- if (!m_store.isConnected()) {
- if (getUsername() != null && getHost() != null) {
- m_store.connect(System.getProperty("mail.imap.host"), getUsername(), getPassword());
- }
- else {
- m_store.connect();
- }
- }
- }
- catch (AuthenticationFailedException e) {
- throw new ProcessingException("IMAP-Authentication failed on " + (m_host == null ? "?" : m_host) + ":" + m_port);
- }
- catch (Exception e) {
- throw new ProcessingException(e.getMessage(), e);
- }
- m_connected = true;
- }
- }
-
- protected Folder findFolder(String name) throws ProcessingException {
- return findFolder(name, false);
- }
-
- protected Folder findFolder(String name, boolean createNonExisting) throws ProcessingException {
- connect();
- Folder folder = m_cachedFolders.get(name);
- if (folder == null) {
- try {
- Folder f = m_store.getFolder(name);
- if (f.exists()) {
- folder = f;
- }
- else if (createNonExisting) {
- f.create(Folder.HOLDS_FOLDERS | Folder.HOLDS_MESSAGES);
- folder = f;
- }
- if (folder != null) {
- m_cachedFolders.put(name, folder);
- }
- }
- catch (MessagingException e) {
- throw new ProcessingException("could not find folder: " + name, e);
- }
- }
- try {
- if (folder != null && !folder.isOpen()) {
- folder.open(Folder.READ_WRITE);
- }
- }
- catch (MessagingException e) {
- throw new ProcessingException("could not open folder: " + name, e);
- }
- return folder;
- }
-
- public void closeConnection() throws ProcessingException {
- if (isConnected()) {
- List<MessagingException> exceptions = new ArrayList<MessagingException>();
- for (Folder folder : m_cachedFolders.values()) {
- try {
- if (folder.isOpen()) {
- folder.close(true);
- }
- }
- catch (MessagingException e) {
- exceptions.add(e);
- }
- finally {
- try {
- if (folder.isOpen()) {
- folder.close(false);
- }
- }
- catch (Throwable fatal) {
- }
- }
- }
- try {
- if (m_store.isConnected()) {
- m_store.close();
- }
- }
- catch (MessagingException e) {
- exceptions.add(e);
- }
- m_cachedFolders.clear();
- m_connected = false;
- if (exceptions.size() > 0) {
- throw new ProcessingException(exceptions.get(0).getMessage());
- }
- }
- }
-
- public boolean isConnected() {
- return m_connected;
- }
-
- public Store getStore() throws ProcessingException {
- connect();
- return m_store;
- }
-
- public String getDefaultFolderName() {
- return m_defaultFolderName;
- }
-
- public void setDefaultFolderName(String defaultFolderName) {
- m_defaultFolderName = defaultFolderName;
- }
-
- public String getHost() {
- return m_host;
- }
-
- public void setHost(String host) {
- m_host = host;
- }
-
- public int getPort() {
- return m_port;
- }
-
- public void setPort(int port) {
- m_port = port;
- }
-
- public String getUsername() {
- return m_username;
- }
-
- public void setUsername(String username) {
- m_username = username;
- }
-
- public String getPassword() {
- return m_password;
- }
-
- public void setPassword(String password) {
- m_password = password;
- }
-
- public boolean isUseSSL() {
- return m_useSSL;
- }
-
- public void setUseSSL(boolean useSSL) {
- m_useSSL = useSSL;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.imap;
+
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Properties;
+
+import javax.mail.AuthenticationFailedException;
+import javax.mail.Flags;
+import javax.mail.Folder;
+import javax.mail.Message;
+import javax.mail.MessagingException;
+import javax.mail.Session;
+import javax.mail.Store;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+
+public class ImapAdapter {
+
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(ImapAdapter.class);
+
+ public static final String TRASH_FOLDER_NAME = "Trash";
+ private boolean m_useSSL;
+ private String m_host;
+ private int m_port = 143;
+ private String m_username;
+ private String m_password;
+ private String m_defaultFolderName;
+ private Store m_store;
+ private HashMap<String, Folder> m_cachedFolders;
+ private boolean m_connected = false;
+
+ public ImapAdapter() {
+ m_cachedFolders = new HashMap<String, Folder>();
+ }
+
+ public ImapAdapter(String host, int port, String username, String password) {
+ this();
+ m_host = host;
+ m_port = port;
+ m_username = username;
+ m_password = password;
+ }
+
+ @Override
+ protected void finalize() throws Throwable {
+ closeConnection();
+ super.finalize();
+ }
+
+ public Message[] getUnseenMessages() throws ProcessingException {
+ return getUnseenMessages(getDefaultFolderName());
+ }
+
+ public Message[] getUnseenMessages(String folderName) throws ProcessingException {
+ connect();
+ ArrayList<Message> messages = new ArrayList<Message>();
+ Folder folder = null;
+ try {
+ folder = findFolder(folderName);
+ if (folder != null) {
+ Message item;
+ Message[] m = folder.getMessages();
+ for (int i = 0; i < Array.getLength(m); i++) {
+ item = m[i];
+ if (!item.isSet(Flags.Flag.SEEN)) {
+ messages.add(item);
+ }
+
+ }
+ }
+ }
+ catch (MessagingException e) {
+ throw new ProcessingException(e.getMessage(), e);
+ }
+ return messages.toArray(new Message[messages.size()]);
+ }
+
+ public Message[] getAllMessages() throws ProcessingException {
+ return getAllMessages(getDefaultFolderName());
+ }
+
+ public Message[] getAllMessages(String folderName) throws ProcessingException {
+ connect();
+ Message[] messages = new Message[0];
+ Folder folder = null;
+ try {
+ folder = findFolder(folderName);
+ if (folder != null) {
+ messages = folder.getMessages();
+ }
+ }
+ catch (MessagingException e) {
+ throw new ProcessingException(e.getMessage(), e);
+ }
+ return messages;
+ }
+
+ public void moveToTrash(Message[] messages) throws ProcessingException {
+ moveMessages(TRASH_FOLDER_NAME, messages);
+ }
+
+ public void moveMessages(String destFolderName, Message[] messages) throws ProcessingException {
+ copyMessages(destFolderName, messages, true);
+ }
+
+ public void copyMessages(String destFolderName, Message[] messages) throws ProcessingException {
+ copyMessages(destFolderName, messages, false);
+ }
+
+ protected void copyMessages(String destFolderName, Message[] messages, boolean deleteSourceMessages) throws ProcessingException {
+ connect();
+ Folder destFolder = null;
+ try {
+ destFolder = findFolder(destFolderName);
+ if (destFolder != null) {
+ destFolder.appendMessages(messages);
+ if (deleteSourceMessages) {
+ deleteMessagesPermanently(messages);
+ }
+ }
+ }
+ catch (MessagingException e) {
+ throw new ProcessingException(e.getMessage(), e);
+ }
+ }
+
+ public void deleteMessagesPermanently(Message[] messages) throws ProcessingException {
+ connect();
+ for (Message msg : messages) {
+ try {
+ msg.setFlag(Flags.Flag.DELETED, true);
+ }
+ catch (MessagingException e) {
+ throw new ProcessingException(e.getMessage(), e);
+ }
+ }
+ }
+
+ public void createFolder(String folderName) throws ProcessingException {
+ findFolder(folderName, true);
+ }
+
+ public void removeFolder(String folderName) throws ProcessingException {
+ connect();
+ try {
+ Folder folder = findFolder(folderName);
+ if (folder != null && folder.exists()) {
+ if (folder.isOpen()) {
+ folder.close(true);
+ }
+ folder.delete(true);
+ }
+ }
+ catch (MessagingException e) {
+ throw new ProcessingException(e.getMessage(), e);
+ }
+ }
+
+ public void connect() throws ProcessingException {
+ if (!isConnected()) {
+ // try{
+ Properties props = new Properties();
+ props.put("mail.transport.protocol", "imap");
+ if (getHost() != null) {
+ props.put("mail.imap.host", getHost());
+ }
+ if (getPort() > 0) {
+ props.put("mail.imap.port", "" + getPort());
+ }
+ if (getUsername() != null) {
+ props.put("mail.imap.user", getUsername());
+ }
+ if (isUseSSL()) {
+ props.setProperty("mail.imap.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
+ props.setProperty("mail.imap.socketFactory.fallback", "false");
+ props.setProperty("mail.imap.socketFactory.port", "993");
+ }
+ Session session = Session.getInstance(props, null);
+ try {
+ m_store = session.getStore("imap");
+ if (!m_store.isConnected()) {
+ if (getUsername() != null && getHost() != null) {
+ m_store.connect(System.getProperty("mail.imap.host"), getUsername(), getPassword());
+ }
+ else {
+ m_store.connect();
+ }
+ }
+ }
+ catch (AuthenticationFailedException e) {
+ throw new ProcessingException("IMAP-Authentication failed on " + (m_host == null ? "?" : m_host) + ":" + m_port);
+ }
+ catch (Exception e) {
+ throw new ProcessingException(e.getMessage(), e);
+ }
+ m_connected = true;
+ }
+ }
+
+ protected Folder findFolder(String name) throws ProcessingException {
+ return findFolder(name, false);
+ }
+
+ protected Folder findFolder(String name, boolean createNonExisting) throws ProcessingException {
+ connect();
+ Folder folder = m_cachedFolders.get(name);
+ if (folder == null) {
+ try {
+ Folder f = m_store.getFolder(name);
+ if (f.exists()) {
+ folder = f;
+ }
+ else if (createNonExisting) {
+ f.create(Folder.HOLDS_FOLDERS | Folder.HOLDS_MESSAGES);
+ folder = f;
+ }
+ if (folder != null) {
+ m_cachedFolders.put(name, folder);
+ }
+ }
+ catch (MessagingException e) {
+ throw new ProcessingException("could not find folder: " + name, e);
+ }
+ }
+ try {
+ if (folder != null && !folder.isOpen()) {
+ folder.open(Folder.READ_WRITE);
+ }
+ }
+ catch (MessagingException e) {
+ throw new ProcessingException("could not open folder: " + name, e);
+ }
+ return folder;
+ }
+
+ public void closeConnection() throws ProcessingException {
+ if (isConnected()) {
+ List<MessagingException> exceptions = new ArrayList<MessagingException>();
+ for (Folder folder : m_cachedFolders.values()) {
+ try {
+ if (folder.isOpen()) {
+ folder.close(true);
+ }
+ }
+ catch (MessagingException e) {
+ exceptions.add(e);
+ }
+ finally {
+ try {
+ if (folder.isOpen()) {
+ folder.close(false);
+ }
+ }
+ catch (Throwable fatal) {
+ }
+ }
+ }
+ try {
+ if (m_store.isConnected()) {
+ m_store.close();
+ }
+ }
+ catch (MessagingException e) {
+ exceptions.add(e);
+ }
+ m_cachedFolders.clear();
+ m_connected = false;
+ if (exceptions.size() > 0) {
+ throw new ProcessingException(exceptions.get(0).getMessage());
+ }
+ }
+ }
+
+ public boolean isConnected() {
+ return m_connected;
+ }
+
+ public Store getStore() throws ProcessingException {
+ connect();
+ return m_store;
+ }
+
+ public String getDefaultFolderName() {
+ return m_defaultFolderName;
+ }
+
+ public void setDefaultFolderName(String defaultFolderName) {
+ m_defaultFolderName = defaultFolderName;
+ }
+
+ public String getHost() {
+ return m_host;
+ }
+
+ public void setHost(String host) {
+ m_host = host;
+ }
+
+ public int getPort() {
+ return m_port;
+ }
+
+ public void setPort(int port) {
+ m_port = port;
+ }
+
+ public String getUsername() {
+ return m_username;
+ }
+
+ public void setUsername(String username) {
+ m_username = username;
+ }
+
+ public String getPassword() {
+ return m_password;
+ }
+
+ public void setPassword(String password) {
+ m_password = password;
+ }
+
+ public boolean isUseSSL() {
+ return m_useSSL;
+ }
+
+ public void setUseSSL(boolean useSSL) {
+ m_useSSL = useSSL;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/AbstractSqlService.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/AbstractSqlService.java
index 338989b1f4..d8f79d30b4 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/AbstractSqlService.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/AbstractSqlService.java
@@ -1,931 +1,931 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc;
-
-import java.lang.reflect.Method;
-import java.security.Permission;
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.scout.commons.BundleContextUtility;
-import org.eclipse.scout.commons.NumberUtility;
-import org.eclipse.scout.commons.annotations.ConfigOperation;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.holders.IHolder;
-import org.eclipse.scout.commons.holders.LongHolder;
-import org.eclipse.scout.commons.holders.StringHolder;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.commons.osgi.BundleClassDescriptor;
-import org.eclipse.scout.rt.server.ThreadContext;
-import org.eclipse.scout.rt.server.services.common.code.CodeService;
-import org.eclipse.scout.rt.server.services.common.jdbc.internal.exec.PreparedStatementCache;
-import org.eclipse.scout.rt.server.services.common.jdbc.internal.exec.StatementProcessor;
-import org.eclipse.scout.rt.server.services.common.jdbc.internal.legacy.LegacyStatementBuilder;
-import org.eclipse.scout.rt.server.services.common.jdbc.internal.pool.SqlConnectionBuilder;
-import org.eclipse.scout.rt.server.services.common.jdbc.internal.pool.SqlConnectionPool;
-import org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle;
-import org.eclipse.scout.rt.server.services.common.jdbc.style.OracleSqlStyle;
-import org.eclipse.scout.rt.server.transaction.ITransaction;
-import org.eclipse.scout.rt.server.transaction.ITransactionMember;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.services.common.jdbc.ILegacySqlQueryService;
-import org.eclipse.scout.rt.shared.services.common.jdbc.LegacySearchFilter;
-import org.eclipse.scout.rt.shared.services.common.jdbc.LegacySearchFilter.WhereToken;
-import org.eclipse.scout.rt.shared.services.common.security.IAccessControlService;
-import org.eclipse.scout.rt.shared.services.common.security.IPermissionService;
-import org.eclipse.scout.service.AbstractService;
-import org.eclipse.scout.service.IServiceInventory;
-import org.eclipse.scout.service.SERVICES;
-
-public abstract class AbstractSqlService extends AbstractService implements ISqlService, ILegacySqlQueryService, IAdaptable {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractSqlService.class);
-
- private SqlConnectionPool m_pool;
- private Class<? extends ScoutTexts> m_nlsProvider;
- private ISqlStyle m_sqlStyle;
- private String m_transactionMemberId;
- private boolean m_directJdbcConnection;
- private String m_jndiName;
- private String m_jndiInitialContextFactory;
- private String m_jndiProviderUrl;
- private String m_jndiUrlPkgPrefixes;
- private String m_jdbcMappingName;
- private String m_jdbcDriverName;
- private String m_jdbcProps;
- private int m_jdbcPoolSize;
- private long m_jdbcPoolConnectionLifetime;
- private long m_jdbcPoolConnectionBusyTimeout;
- private String m_defaultUser;
- private String m_defaultPass;
- private int m_queryCacheSize;
- //
- private HashMap<String, List<BundleClassDescriptor>> m_permissionNameToDescriptor;
- private HashMap<String, List<BundleClassDescriptor>> m_codeNameToDescriptor;
-
- public AbstractSqlService() {
- initConfig();
- }
-
- @SuppressWarnings("deprecation")
- @Override
- public void initializeService() {
- super.initializeService();
- // load code and permission names
- m_permissionNameToDescriptor = new HashMap<String, List<BundleClassDescriptor>>();
- IPermissionService psvc = SERVICES.getService(IPermissionService.class);
- if (psvc != null) {
- for (BundleClassDescriptor d : psvc.getAllPermissionClasses()) {
- List<BundleClassDescriptor> list = m_permissionNameToDescriptor.get(d.getSimpleClassName());
- if (list == null) {
- list = new ArrayList<BundleClassDescriptor>();
- m_permissionNameToDescriptor.put(d.getSimpleClassName(), list);
- }
- list.add(d);
- //
- list = m_permissionNameToDescriptor.get(d.getClassName());
- if (list == null) {
- list = new ArrayList<BundleClassDescriptor>();
- m_permissionNameToDescriptor.put(d.getClassName(), list);
- }
- list.add(d);
- }
- }
- m_codeNameToDescriptor = new HashMap<String, List<BundleClassDescriptor>>();
- CodeService csvc = SERVICES.getService(CodeService.class);
- if (csvc != null) {
- for (BundleClassDescriptor d : csvc.getAllCodeTypeClasses("")) {
- List<BundleClassDescriptor> list = m_codeNameToDescriptor.get(d.getSimpleClassName());
- if (list == null) {
- list = new ArrayList<BundleClassDescriptor>();
- m_codeNameToDescriptor.put(d.getSimpleClassName(), list);
- }
- list.add(d);
- //
- list = m_codeNameToDescriptor.get(d.getClassName());
- if (list == null) {
- list = new ArrayList<BundleClassDescriptor>();
- m_codeNameToDescriptor.put(d.getClassName(), list);
- }
- list.add(d);
- }
- }
- }
-
- /*
- * Configuration
- */
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(10)
- @ConfigPropertyValue("true")
- protected boolean getConfiguredDirectJdbcConnection() {
- return true;
- }
-
- @ConfigProperty(ConfigProperty.STRING)
- @Order(20)
- @ConfigPropertyValue("null")
- protected String getConfiguredUsername() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.STRING)
- @Order(30)
- @ConfigPropertyValue("null")
- protected String getConfiguredPassword() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.NLS_PROVIDER)
- @Order(70)
- @ConfigPropertyValue("null")
- protected Class<? extends ScoutTexts> getConfiguredNlsProvider() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.SQL_STYLE)
- @Order(80)
- @ConfigPropertyValue("null")
- protected Class<? extends ISqlStyle> getConfiguredSqlStyle() {
- return null;
- }
-
- /**
- * @deprecated use {@link #getConfiguredTransactionMemberId()}
- */
- @Deprecated
- protected String getConfiguredXAResourceId() {
- return getConfiguredTransactionMemberId();
- }
-
- @ConfigProperty(ConfigProperty.STRING)
- @Order(90)
- @ConfigPropertyValue("null")
- protected String getConfiguredTransactionMemberId() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.STRING)
- @Order(100)
- @ConfigPropertyValue("\"oracle.jdbc.OracleDriver\"")
- protected String getConfiguredJdbcDriverName() {
- return "oracle.jdbc.OracleDriver";
- }
-
- @ConfigProperty(ConfigProperty.STRING)
- @Order(110)
- @ConfigPropertyValue("\"jdbc:oracle:thin:@localhost:1521:ORCL\"")
- protected String getConfiguredJdbcMappingName() {
- return "jdbc:oracle:thin:@localhost:1521:ORCL";
- }
-
- @ConfigProperty(ConfigProperty.STRING)
- @Order(120)
- @ConfigPropertyValue("null")
- protected String getConfiguredJdbcProperties() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.INTEGER)
- @Order(130)
- @ConfigPropertyValue("25")
- protected int getConfiguredJdbcPoolSize() {
- return 25;
- }
-
- @ConfigProperty(ConfigProperty.LONG)
- @Order(140)
- @ConfigPropertyValue("300000L")
- protected long getConfiguredJdbcPoolConnectionLifetime() {
- return 300000L;
- }
-
- @ConfigProperty(ConfigProperty.LONG)
- @Order(150)
- @ConfigPropertyValue("21600000L")
- protected long getConfiguredJdbcPoolConnectionBusyTimeout() {
- return 21600000L;
- }
-
- @ConfigProperty(ConfigProperty.INTEGER)
- @Order(160)
- @ConfigPropertyValue("25")
- protected int getConfiguredJdbcStatementCacheSize() {
- return 25;
- }
-
- @ConfigProperty(ConfigProperty.STRING)
- @Order(170)
- @ConfigPropertyValue("null")
- protected String getConfiguredJndiName() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.STRING)
- @Order(180)
- @ConfigPropertyValue("null")
- protected String getConfiguredJndiInitialContextFactory() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.STRING)
- @Order(190)
- @ConfigPropertyValue("null")
- protected String getConfiguredJndiProviderUrl() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.STRING)
- @Order(200)
- @ConfigPropertyValue("null")
- protected String getConfiguredJndiUrlPkgPrefixes() {
- return null;
- }
-
- @ConfigOperation
- @Order(10)
- protected void execTestConnection(Connection conn) throws Throwable {
- ISqlStyle s = getSqlStyle();
- if (s != null) {
- s.testConnection(conn);
- }
- }
-
- @ConfigOperation
- @Order(15)
- protected void execAfterConnectionCreated(Connection conn) throws ProcessingException {
- }
-
- /**
- * called just after the transaction has started
- */
- @ConfigOperation
- @Order(20)
- protected void execBeginTransaction() throws ProcessingException {
- }
-
- @ConfigOperation
- @Order(30)
- protected Connection execCreateConnection() throws Throwable {
- return leaseConnectionInternal();
- }
-
- @ConfigOperation
- @Order(35)
- protected void execReleaseConnection(Connection conn) throws Throwable {
- releaseConnectionInternal(conn);
- }
-
- /**
- * Custom functions that can be used in sql statements as binds or sql style independent functions
- * <p>
- * Default functions are<br>
- * ::level(permissionClass) --> int //to resolve a permissin level by executing a permission<br>
- * ::level(permissionLevel) --> int //to resolve a permissin level by its id<br>
- * ::code(codeClass or codeTypeClass) --> the ID of the code or code type<br>
- * ::text(textId) --> the text in the user sessions language
- * <p>
- * Examples:<br>
- * ::level(UpdatePersonPermission)<br>
- * ::level(UpdatePersonPermission.LEVEL_OWN)<br>
- * <br>
- * ::code(CompanyAddressCodeType.MainAddressCode)<br>
- * ::code(MainAddressCode)<br>
- * <br>
- * ::text(SalutationMr)
- * <p>
- *
- * @return a plain object value or in case of a null value preferrably a {@link IHolder} of the correct value type
- */
- @ConfigOperation
- @Order(40)
- protected Object execCustomBindFunction(String functionName, String[] args, Object[] bindBases) throws ProcessingException {
- if (functionName.equals("level")) {
- if (args.length != 1) {
- throw new IllegalArgumentException("expected 1 argument for function '" + functionName + "'");
- }
- String permissionClassName = args[0];
- String levelField = null;
- // eventually a level id?
- int levelDot = permissionClassName.indexOf(".LEVEL_");
- if (levelDot >= 0) {
- levelField = permissionClassName.substring(levelDot + 1);
- permissionClassName = permissionClassName.substring(0, levelDot);
- }
- Class permissionClass = loadBundleClassLenient(m_permissionNameToDescriptor, permissionClassName);
- IAccessControlService accessControlService = SERVICES.getService(IAccessControlService.class);
- Object ret = tryGetPermissionLevel(permissionClass, levelField, accessControlService);
- return ret != null ? ret : new LongHolder();
- }
- else if (functionName.equals("code")) {
- if (args.length != 1) {
- throw new IllegalArgumentException("expected 1 argument for function '" + functionName + "'");
- }
- String codeClassName = args[0];
- Class codeClass = loadBundleClassLenient(m_codeNameToDescriptor, codeClassName);
- if (codeClass == null) {
- throw new ProcessingException("cannot find class for code '" + args[0] + "'");
- }
- try {
- Object ret = codeClass.getField("ID").get(null);
- return ret != null ? ret : new LongHolder();
- }
- catch (Throwable t) {
- throw new ProcessingException("ID of code '" + args[0] + "'", t);
- }
- }
- else if (functionName.equals("text")) {
- if (args.length < 1) {
- throw new IllegalArgumentException("expected at least 1 argument for function '" + functionName + "'");
- }
- if (args.length == 1) {
- String[] tmp = new String[2];
- tmp[0] = args[0];
- tmp[1] = null;
- args = tmp;
- }
- try {
- Method m = getNlsProvider().getMethod("get", new Class[]{String.class, String[].class});
- Object ret = m.invoke(null, (Object[]) args);
- return ret != null ? ret : new StringHolder();
- }
- catch (Throwable t) {
- throw new ProcessingException("unknown function in DynamicNls, check 'getConfiguredNlsProvider' / 'getNlsProvider': get", t);
- }
- }
- else {
- throw new IllegalArgumentException("undefined function '" + functionName + "'");
- }
- }
-
- private Object tryGetPermissionLevel(Class permissionClass, String levelField, IAccessControlService accessControlService) throws ProcessingException {
- if (permissionClass == null) {
- return null;
- }
- try {
- if (levelField != null) {
- return permissionClass.getField(levelField).get(null);
- }
- else {
- Permission p = (Permission) permissionClass.newInstance();
- return accessControlService.getPermissionLevel(p);
- }
- }
- catch (Exception e) {
- throw new ProcessingException("getLevel of permission '" + permissionClass + "'", e);
- }
- }
-
- /**
- * called just before the transaction is being committed or rollbacked<br>
- * do not call commit here, the flag is just meant as a hint
- */
- @ConfigOperation
- @Order(50)
- protected void execEndTransaction(boolean willBeCommitted) throws ProcessingException {
- }
-
- protected void initConfig() {
- String tid = getConfiguredTransactionMemberId();
- if (tid == null) {
- tid = getClass().getSimpleName() + "." + "transaction";
- }
- setTransactionMemberId(tid);
- setDirectJdbcConnection(getConfiguredDirectJdbcConnection());
- setUsername(getConfiguredUsername());
- setPassword(getConfiguredPassword());
- setJndiName(getConfiguredJndiName());
- setJndiInitialContextFactory(getConfiguredJndiInitialContextFactory());
- setJndiProviderUrl(getConfiguredJndiProviderUrl());
- setJndiUrlPkgPrefixes(getConfiguredJndiUrlPkgPrefixes());
- setJdbcMappingName(getConfiguredJdbcMappingName());
- setJdbcDriverName(getConfiguredJdbcDriverName());
- setJdbcProperties(getConfiguredJdbcProperties());
- setJdbcStatementCacheSize(getConfiguredJdbcStatementCacheSize());
- setJdbcPoolSize(getConfiguredJdbcPoolSize());
- setJdbcPoolConnectionBusyTimeout(getConfiguredJdbcPoolConnectionBusyTimeout());
- setJdbcPoolConnectionLifetime(getConfiguredJdbcPoolConnectionLifetime());
- setNlsProvider(getConfiguredNlsProvider());
- // sql style
- Class<? extends ISqlStyle> styleClass = getConfiguredSqlStyle();
- if (styleClass != null) {
- try {
- setSqlStyle(styleClass.newInstance());
- }
- catch (Exception e) {
- LOG.warn(null, e);
- }
- }
- else {
- setSqlStyle(new OracleSqlStyle());
- }
- }
-
- /*
- * Runtime
- */
- public void callbackAfterConnectionCreated(Connection conn) throws ProcessingException {
- execAfterConnectionCreated(conn);
- }
-
- public void callbackTestConnection(Connection conn) throws Throwable {
- execTestConnection(conn);
- }
-
- public Object callbackCustomBindFunction(String functionName, String[] args, Object[] bindBases) throws ProcessingException {
- return execCustomBindFunction(functionName, args, bindBases);
- }
-
- @Override
- public String getTransactionMemberId() {
- return m_transactionMemberId;
- }
-
- public boolean isDirectJdbcConnection() {
- return m_directJdbcConnection;
- }
-
- public int getJdbcStatementCacheSize() {
- return m_queryCacheSize;
- }
-
- public String getJndiName() {
- return m_jndiName;
- }
-
- public String getJndiInitialContextFactory() {
- return m_jndiInitialContextFactory;
- }
-
- public String getJndiProviderUrl() {
- return m_jndiProviderUrl;
- }
-
- public String getJndiUrlPkgPrefixes() {
- return m_jndiUrlPkgPrefixes;
- }
-
- public String getJdbcMappingName() {
- return m_jdbcMappingName;
- }
-
- public String getJdbcDriverName() {
- return m_jdbcDriverName;
- }
-
- public String getJdbcProperties() {
- return m_jdbcProps;
- }
-
- public String getUsername() {
- return m_defaultUser;
- }
-
- public String getPassword() {
- return m_defaultPass;
- }
-
- public int getJdbcPoolSize() {
- return m_jdbcPoolSize;
- }
-
- public long getJdbcPoolConnectionLifetime() {
- return m_jdbcPoolConnectionLifetime;
- }
-
- public long getJdbcPoolConnectionBusyTimeout() {
- return m_jdbcPoolConnectionBusyTimeout;
- }
-
- public void setTransactionMemberId(String s) {
- m_transactionMemberId = s;
- }
-
- public void setDirectJdbcConnection(boolean b) {
- m_directJdbcConnection = b;
- }
-
- public void setJdbcStatementCacheSize(int n) {
- m_queryCacheSize = n;
- }
-
- public void setJndiName(String s) {
- m_jndiName = s;
- }
-
- public void setJndiInitialContextFactory(String s) {
- m_jndiInitialContextFactory = s;
- }
-
- public void setJndiProviderUrl(String s) {
- m_jndiProviderUrl = s;
- }
-
- public void setJndiUrlPkgPrefixes(String s) {
- m_jndiUrlPkgPrefixes = s;
- }
-
- /**
- * Supports ${...} variables resolved by {@link BundleContextUtility#resolve(String)}
- */
- public void setJdbcMappingName(String s) {
- m_jdbcMappingName = BundleContextUtility.resolve(s);
- }
-
- public void setJdbcDriverName(String s) {
- m_jdbcDriverName = s;
- }
-
- public void setJdbcProperties(String s) {
- m_jdbcProps = s;
- }
-
- public void setUsername(String s) {
- m_defaultUser = s;
- }
-
- public void setPassword(String s) {
- m_defaultPass = s;
- }
-
- public void setJdbcPoolSize(int n) {
- m_jdbcPoolSize = n;
- }
-
- public void setJdbcPoolConnectionLifetime(long t) {
- m_jdbcPoolConnectionLifetime = t;
- }
-
- public void setJdbcPoolConnectionBusyTimeout(long t) {
- m_jdbcPoolConnectionBusyTimeout = t;
- }
-
- @Override
- public Object getAdapter(Class adapter) {
- if (adapter == IServiceInventory.class) {
- if (m_pool != null) {
- return m_pool.getInventory();
- }
- }
- return null;
- }
-
- public Class<? extends ScoutTexts> getNlsProvider() {
- return m_nlsProvider;
- }
-
- public void setNlsProvider(Class<? extends ScoutTexts> nlsProvider) {
- m_nlsProvider = nlsProvider;
- }
-
- @Override
- public ISqlStyle getSqlStyle() {
- return m_sqlStyle;
- }
-
- public void setSqlStyle(ISqlStyle sqlStyle) {
- m_sqlStyle = sqlStyle;
- }
-
- /*
- * Internals
- */
- private Connection leaseConnection() throws Throwable {
- Connection conn = execCreateConnection();
- return conn;
- }
-
- private Connection leaseConnectionInternal() throws Throwable {
- try {
- if (isDirectJdbcConnection()) {
- // get connection from internal pool
- Connection conn = getSqlConnectionPool().leaseConnection(this);
- return conn;
- }
- else {
- Connection conn = new SqlConnectionBuilder().createJndiConnection(this);
- // do not call execAfterConnectionCreated(conn) because jndi connections
- // are normally pooled
- return conn;
- }
- }
- catch (Exception e) {
- ProcessingException pe;
- if (e instanceof ProcessingException) {
- pe = (ProcessingException) e;
- }
- else {
- pe = new ProcessingException("unexpected exception", e);
- }
- if (isDirectJdbcConnection()) {
- pe.addContextMessage("jdbcDriverName=" + getJdbcDriverName() + ", jdbcMappingName=" + getJdbcMappingName());
- }
- else {
- pe.addContextMessage("jndiName=" + getJndiName());
- }
- throw pe;
- }
- }
-
- private void releaseConnection(Connection conn) {
- try {
- execReleaseConnection(conn);
- }
- catch (Throwable e) {
- LOG.error(null, e);
- }
- }
-
- private void releaseConnectionInternal(Connection conn) throws Throwable {
- if (isDirectJdbcConnection()) {
- // delegate to internal pool
- getSqlConnectionPool().releaseConnection(conn);
- }
- else {
- conn.close();
- }
- }
-
- private synchronized SqlConnectionPool getSqlConnectionPool() {
- if (m_pool == null) {
- m_pool = SqlConnectionPool.getPool(getClass(), getJdbcPoolSize(), getJdbcPoolConnectionLifetime(), getJdbcPoolConnectionBusyTimeout());
- }
- return m_pool;
- }
-
- @Override
- public Connection getConnection() throws ProcessingException {
- return getTransaction();
- }
-
- protected Connection getTransaction() throws ProcessingException {
- ITransaction reg = ThreadContext.getTransaction();
- if (reg == null) {
- throw new ProcessingException("no ITransaction available, use ServerJob to run truncactions");
- }
- SqlTransactionMember member = (SqlTransactionMember) reg.getMember(getTransactionMemberId());
- if (member == null) {
- Connection conn;
- try {
- conn = leaseConnection();
- member = new SqlTransactionMember(getTransactionMemberId(), conn);
- reg.registerMember(member);
- // this is the start of the transaction
- execBeginTransaction();
- }
- catch (ProcessingException e) {
- throw e;
- }
- catch (Throwable e) {
- throw new ProcessingException("getTransaction", e);
- }
- }
- return member.getConnection();
- }
-
- /**
- * @return the statement cache used for this {@link ITransaction} transaction
- */
- protected final IStatementCache getStatementCache() throws ProcessingException {
- ITransaction reg = ThreadContext.getTransaction();
- if (reg == null) {
- throw new ProcessingException("no ITransaction available, use ServerJob to run truncactions");
- }
- IStatementCache res = (IStatementCache) reg.getMember(PreparedStatementCache.TRANSACTION_MEMBER_ID);
- if (res == null) {
- res = new PreparedStatementCache(getJdbcStatementCacheSize());
- reg.registerMember((ITransactionMember) res);
- }
- return res;
- }
-
- /*
- * Operations
- */
-
- @Override
- public Object[][] select(String s, Object... bindBases) throws ProcessingException {
- return createStatementProcessor(s, bindBases, 0).processSelect(getTransaction(), getStatementCache(), null);
- }
-
- @Override
- public Object[][] selectLimited(String s, int maxRowCount, Object... bindBases) throws ProcessingException {
- return createStatementProcessor(s, bindBases, maxRowCount).processSelect(getTransaction(), getStatementCache(), null);
- }
-
- @Override
- public void selectInto(String s, Object... bindBases) throws ProcessingException {
- createStatementProcessor(s, bindBases, 0).processSelectInto(getTransaction(), getStatementCache(), null);
- }
-
- @Override
- public void selectIntoLimited(String s, int maxRowCount, Object... bindBases) throws ProcessingException {
- createStatementProcessor(s, bindBases, maxRowCount).processSelectInto(getTransaction(), getStatementCache(), null);
- }
-
- @Override
- public void selectStreaming(String s, ISelectStreamHandler handler, Object... bindBases) throws ProcessingException {
- createStatementProcessor(s, bindBases, 0).processSelectStreaming(getTransaction(), getStatementCache(), handler);
- }
-
- @Override
- public void selectStreamingLimited(String s, ISelectStreamHandler handler, int maxRowCount, Object... bindBases) throws ProcessingException {
- createStatementProcessor(s, bindBases, maxRowCount).processSelectStreaming(getTransaction(), getStatementCache(), handler);
- }
-
- @Override
- public int insert(String s, Object... bindBases) throws ProcessingException {
- return createStatementProcessor(s, bindBases, 0).processModification(getTransaction(), getStatementCache(), null);
- }
-
- @Override
- public int update(String s, Object... bindBases) throws ProcessingException {
- return createStatementProcessor(s, bindBases, 0).processModification(getTransaction(), getStatementCache(), null);
- }
-
- @Override
- public int delete(String s, Object... bindBases) throws ProcessingException {
- return createStatementProcessor(s, bindBases, 0).processModification(getTransaction(), getStatementCache(), null);
- }
-
- @Override
- public boolean callStoredProcedure(String s, Object... bindBases) throws ProcessingException {
- return createStatementProcessor(s, bindBases, 0).processStoredProcedure(getTransaction(), getStatementCache(), null);
- }
-
- @Override
- public void commit() throws ProcessingException {
- try {
- getTransaction().commit();
- }
- catch (SQLException e) {
- throw new ProcessingException("unexpected exception", e);
- }
- }
-
- @Override
- public String createPlainText(String s, Object... bindBases) throws ProcessingException {
- return createStatementProcessor(s, bindBases, 0).createPlainText();
- }
-
- @Override
- public WhereToken resolveSpecialConstraint(Object specialConstraint) throws ProcessingException {
- if (specialConstraint instanceof LegacySearchFilter.StringLikeConstraint) {
- LegacySearchFilter.StringLikeConstraint c = (LegacySearchFilter.StringLikeConstraint) specialConstraint;
- String s = getSqlStyle().toLikePattern(c.getValue());
- return new LegacySearchFilter.WhereToken(c.getTerm(), s, null);
- }
- else if (specialConstraint instanceof LegacySearchFilter.ComposerConstraint) {
- LegacySearchFilter.ComposerConstraint c = (LegacySearchFilter.ComposerConstraint) specialConstraint;
- HashMap<String, Object> map = new HashMap<String, Object>();
- String term = c.getTerm();
- for (Map.Entry<String, LegacySearchFilter.ComposerAttributeRef> e : c.getAttributeRefMap().entrySet()) {
- String key = e.getKey();
- LegacySearchFilter.ComposerAttributeRef att = e.getValue();
- LegacyStatementBuilder b = new LegacyStatementBuilder(getSqlStyle());
- String attValue = b.resolveComposerAttribute(att.getOp(), att.getAttribute(), att.getBindName(), att.getValue());
- map.putAll(b.getBindMap());
- term = term.replace(key, attValue);
- }
- return new LegacySearchFilter.WhereToken(term, null, map);
- }
- return null;
- }
-
- protected IStatementProcessor createStatementProcessor(String s, Object[] bindBases, int maxRowCount) throws ProcessingException {
- return new StatementProcessor(this, s, bindBases, maxRowCount);
- }
-
- /**
- * When the service completes work with an exception, a xa rollback is done on
- * ALL used service request resources
- *
- * @see commit
- */
- @Override
- public void rollback() throws ProcessingException {
- try {
- getTransaction().rollback();
- }
- catch (SQLException e) {
- throw new ProcessingException("unexpected exception", e);
- }
- }
-
- @Override
- public Long getSequenceNextval(String sequenceName) throws ProcessingException {
- String s = "SELECT " + sequenceName + ".NEXTVAL FROM DUAL ";
- Object[][] ret = createStatementProcessor(s, null, 0).processSelect(getTransaction(), getStatementCache(), null);
- if (ret.length == 1) {
- return NumberUtility.toLong(NumberUtility.nvl((Number) ret[0][0], 0));
- }
- return 0L;
- }
-
- /**
- * @return the class loaded by the first bundle with a matching symbolic name
- * Example: name "com.myapp.shared.core.security.ReadDataPermission" is loaded by the bundle with symbolic
- * name "com.myapp.shared.core".
- */
- private Class loadBundleClassLenient(Map<String, List<BundleClassDescriptor>> map, String name) {
- String base = name;
- String suffix = "";
- while (base.length() > 0) {
- List<BundleClassDescriptor> list = map.get(base);
- if (list != null) {
- for (BundleClassDescriptor desc : list) {
- try {
- Class c = Platform.getBundle(desc.getBundleSymbolicName()).loadClass(desc.getClassName());
- if (suffix.length() > 0) {
- c = Platform.getBundle(desc.getBundleSymbolicName()).loadClass(desc.getClassName() + suffix.replace(".", "$"));
- return c;
- }
- else {
- return c;
- }
- }
- catch (Throwable t) {
- LOG.warn("Could not load class with lenient name '" + name + "' in bundle " + desc.getBundleSymbolicName());
- }
- }
- }
- //
- int i = base.lastIndexOf('.');
- if (i >= 0) {
- String seg = base.substring(i);
- base = base.substring(0, i);
- suffix = seg + suffix;
- }
- else {
- String seg = base;
- base = "";
- suffix = seg + suffix;
- }
- }
- LOG.warn("Could not find class with lenient name '" + name + "'");
- return null;
- }
-
- private class SqlTransactionMember extends AbstractSqlTransactionMember {
- private final Connection m_conn;
-
- public SqlTransactionMember(String transactionMemberId, Connection conn) {
- super(transactionMemberId);
- m_conn = conn;
- }
-
- public Connection getConnection() {
- return m_conn;
- }
-
- @Override
- public void commitPhase2() {
- try {
- // this is the end of the transaction
- execEndTransaction(true);
- m_conn.commit();
- }
- catch (Exception e) {
- LOG.error(null, e);
- }
- }
-
- @Override
- public void rollback() {
- try {
- // this is the end of the transaction
- execEndTransaction(false);
- m_conn.rollback();
- }
- catch (Exception e) {
- if (!ThreadContext.getTransaction().isCancelled()) {
- LOG.error(null, e);
- }
- }
- }
-
- @Override
- public void release() {
- releaseConnection(m_conn);
- }
- }// end private class
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc;
+
+import java.lang.reflect.Method;
+import java.security.Permission;
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.scout.commons.BundleContextUtility;
+import org.eclipse.scout.commons.NumberUtility;
+import org.eclipse.scout.commons.annotations.ConfigOperation;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.holders.IHolder;
+import org.eclipse.scout.commons.holders.LongHolder;
+import org.eclipse.scout.commons.holders.StringHolder;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.commons.osgi.BundleClassDescriptor;
+import org.eclipse.scout.rt.server.ThreadContext;
+import org.eclipse.scout.rt.server.services.common.code.CodeService;
+import org.eclipse.scout.rt.server.services.common.jdbc.internal.exec.PreparedStatementCache;
+import org.eclipse.scout.rt.server.services.common.jdbc.internal.exec.StatementProcessor;
+import org.eclipse.scout.rt.server.services.common.jdbc.internal.legacy.LegacyStatementBuilder;
+import org.eclipse.scout.rt.server.services.common.jdbc.internal.pool.SqlConnectionBuilder;
+import org.eclipse.scout.rt.server.services.common.jdbc.internal.pool.SqlConnectionPool;
+import org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle;
+import org.eclipse.scout.rt.server.services.common.jdbc.style.OracleSqlStyle;
+import org.eclipse.scout.rt.server.transaction.ITransaction;
+import org.eclipse.scout.rt.server.transaction.ITransactionMember;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.services.common.jdbc.ILegacySqlQueryService;
+import org.eclipse.scout.rt.shared.services.common.jdbc.LegacySearchFilter;
+import org.eclipse.scout.rt.shared.services.common.jdbc.LegacySearchFilter.WhereToken;
+import org.eclipse.scout.rt.shared.services.common.security.IAccessControlService;
+import org.eclipse.scout.rt.shared.services.common.security.IPermissionService;
+import org.eclipse.scout.service.AbstractService;
+import org.eclipse.scout.service.IServiceInventory;
+import org.eclipse.scout.service.SERVICES;
+
+public abstract class AbstractSqlService extends AbstractService implements ISqlService, ILegacySqlQueryService, IAdaptable {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractSqlService.class);
+
+ private SqlConnectionPool m_pool;
+ private Class<? extends ScoutTexts> m_nlsProvider;
+ private ISqlStyle m_sqlStyle;
+ private String m_transactionMemberId;
+ private boolean m_directJdbcConnection;
+ private String m_jndiName;
+ private String m_jndiInitialContextFactory;
+ private String m_jndiProviderUrl;
+ private String m_jndiUrlPkgPrefixes;
+ private String m_jdbcMappingName;
+ private String m_jdbcDriverName;
+ private String m_jdbcProps;
+ private int m_jdbcPoolSize;
+ private long m_jdbcPoolConnectionLifetime;
+ private long m_jdbcPoolConnectionBusyTimeout;
+ private String m_defaultUser;
+ private String m_defaultPass;
+ private int m_queryCacheSize;
+ //
+ private HashMap<String, List<BundleClassDescriptor>> m_permissionNameToDescriptor;
+ private HashMap<String, List<BundleClassDescriptor>> m_codeNameToDescriptor;
+
+ public AbstractSqlService() {
+ initConfig();
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public void initializeService() {
+ super.initializeService();
+ // load code and permission names
+ m_permissionNameToDescriptor = new HashMap<String, List<BundleClassDescriptor>>();
+ IPermissionService psvc = SERVICES.getService(IPermissionService.class);
+ if (psvc != null) {
+ for (BundleClassDescriptor d : psvc.getAllPermissionClasses()) {
+ List<BundleClassDescriptor> list = m_permissionNameToDescriptor.get(d.getSimpleClassName());
+ if (list == null) {
+ list = new ArrayList<BundleClassDescriptor>();
+ m_permissionNameToDescriptor.put(d.getSimpleClassName(), list);
+ }
+ list.add(d);
+ //
+ list = m_permissionNameToDescriptor.get(d.getClassName());
+ if (list == null) {
+ list = new ArrayList<BundleClassDescriptor>();
+ m_permissionNameToDescriptor.put(d.getClassName(), list);
+ }
+ list.add(d);
+ }
+ }
+ m_codeNameToDescriptor = new HashMap<String, List<BundleClassDescriptor>>();
+ CodeService csvc = SERVICES.getService(CodeService.class);
+ if (csvc != null) {
+ for (BundleClassDescriptor d : csvc.getAllCodeTypeClasses("")) {
+ List<BundleClassDescriptor> list = m_codeNameToDescriptor.get(d.getSimpleClassName());
+ if (list == null) {
+ list = new ArrayList<BundleClassDescriptor>();
+ m_codeNameToDescriptor.put(d.getSimpleClassName(), list);
+ }
+ list.add(d);
+ //
+ list = m_codeNameToDescriptor.get(d.getClassName());
+ if (list == null) {
+ list = new ArrayList<BundleClassDescriptor>();
+ m_codeNameToDescriptor.put(d.getClassName(), list);
+ }
+ list.add(d);
+ }
+ }
+ }
+
+ /*
+ * Configuration
+ */
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(10)
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredDirectJdbcConnection() {
+ return true;
+ }
+
+ @ConfigProperty(ConfigProperty.STRING)
+ @Order(20)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredUsername() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.STRING)
+ @Order(30)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredPassword() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.NLS_PROVIDER)
+ @Order(70)
+ @ConfigPropertyValue("null")
+ protected Class<? extends ScoutTexts> getConfiguredNlsProvider() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.SQL_STYLE)
+ @Order(80)
+ @ConfigPropertyValue("null")
+ protected Class<? extends ISqlStyle> getConfiguredSqlStyle() {
+ return null;
+ }
+
+ /**
+ * @deprecated use {@link #getConfiguredTransactionMemberId()}
+ */
+ @Deprecated
+ protected String getConfiguredXAResourceId() {
+ return getConfiguredTransactionMemberId();
+ }
+
+ @ConfigProperty(ConfigProperty.STRING)
+ @Order(90)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredTransactionMemberId() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.STRING)
+ @Order(100)
+ @ConfigPropertyValue("\"oracle.jdbc.OracleDriver\"")
+ protected String getConfiguredJdbcDriverName() {
+ return "oracle.jdbc.OracleDriver";
+ }
+
+ @ConfigProperty(ConfigProperty.STRING)
+ @Order(110)
+ @ConfigPropertyValue("\"jdbc:oracle:thin:@localhost:1521:ORCL\"")
+ protected String getConfiguredJdbcMappingName() {
+ return "jdbc:oracle:thin:@localhost:1521:ORCL";
+ }
+
+ @ConfigProperty(ConfigProperty.STRING)
+ @Order(120)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredJdbcProperties() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.INTEGER)
+ @Order(130)
+ @ConfigPropertyValue("25")
+ protected int getConfiguredJdbcPoolSize() {
+ return 25;
+ }
+
+ @ConfigProperty(ConfigProperty.LONG)
+ @Order(140)
+ @ConfigPropertyValue("300000L")
+ protected long getConfiguredJdbcPoolConnectionLifetime() {
+ return 300000L;
+ }
+
+ @ConfigProperty(ConfigProperty.LONG)
+ @Order(150)
+ @ConfigPropertyValue("21600000L")
+ protected long getConfiguredJdbcPoolConnectionBusyTimeout() {
+ return 21600000L;
+ }
+
+ @ConfigProperty(ConfigProperty.INTEGER)
+ @Order(160)
+ @ConfigPropertyValue("25")
+ protected int getConfiguredJdbcStatementCacheSize() {
+ return 25;
+ }
+
+ @ConfigProperty(ConfigProperty.STRING)
+ @Order(170)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredJndiName() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.STRING)
+ @Order(180)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredJndiInitialContextFactory() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.STRING)
+ @Order(190)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredJndiProviderUrl() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.STRING)
+ @Order(200)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredJndiUrlPkgPrefixes() {
+ return null;
+ }
+
+ @ConfigOperation
+ @Order(10)
+ protected void execTestConnection(Connection conn) throws Throwable {
+ ISqlStyle s = getSqlStyle();
+ if (s != null) {
+ s.testConnection(conn);
+ }
+ }
+
+ @ConfigOperation
+ @Order(15)
+ protected void execAfterConnectionCreated(Connection conn) throws ProcessingException {
+ }
+
+ /**
+ * called just after the transaction has started
+ */
+ @ConfigOperation
+ @Order(20)
+ protected void execBeginTransaction() throws ProcessingException {
+ }
+
+ @ConfigOperation
+ @Order(30)
+ protected Connection execCreateConnection() throws Throwable {
+ return leaseConnectionInternal();
+ }
+
+ @ConfigOperation
+ @Order(35)
+ protected void execReleaseConnection(Connection conn) throws Throwable {
+ releaseConnectionInternal(conn);
+ }
+
+ /**
+ * Custom functions that can be used in sql statements as binds or sql style independent functions
+ * <p>
+ * Default functions are<br>
+ * ::level(permissionClass) --> int //to resolve a permissin level by executing a permission<br>
+ * ::level(permissionLevel) --> int //to resolve a permissin level by its id<br>
+ * ::code(codeClass or codeTypeClass) --> the ID of the code or code type<br>
+ * ::text(textId) --> the text in the user sessions language
+ * <p>
+ * Examples:<br>
+ * ::level(UpdatePersonPermission)<br>
+ * ::level(UpdatePersonPermission.LEVEL_OWN)<br>
+ * <br>
+ * ::code(CompanyAddressCodeType.MainAddressCode)<br>
+ * ::code(MainAddressCode)<br>
+ * <br>
+ * ::text(SalutationMr)
+ * <p>
+ *
+ * @return a plain object value or in case of a null value preferrably a {@link IHolder} of the correct value type
+ */
+ @ConfigOperation
+ @Order(40)
+ protected Object execCustomBindFunction(String functionName, String[] args, Object[] bindBases) throws ProcessingException {
+ if (functionName.equals("level")) {
+ if (args.length != 1) {
+ throw new IllegalArgumentException("expected 1 argument for function '" + functionName + "'");
+ }
+ String permissionClassName = args[0];
+ String levelField = null;
+ // eventually a level id?
+ int levelDot = permissionClassName.indexOf(".LEVEL_");
+ if (levelDot >= 0) {
+ levelField = permissionClassName.substring(levelDot + 1);
+ permissionClassName = permissionClassName.substring(0, levelDot);
+ }
+ Class permissionClass = loadBundleClassLenient(m_permissionNameToDescriptor, permissionClassName);
+ IAccessControlService accessControlService = SERVICES.getService(IAccessControlService.class);
+ Object ret = tryGetPermissionLevel(permissionClass, levelField, accessControlService);
+ return ret != null ? ret : new LongHolder();
+ }
+ else if (functionName.equals("code")) {
+ if (args.length != 1) {
+ throw new IllegalArgumentException("expected 1 argument for function '" + functionName + "'");
+ }
+ String codeClassName = args[0];
+ Class codeClass = loadBundleClassLenient(m_codeNameToDescriptor, codeClassName);
+ if (codeClass == null) {
+ throw new ProcessingException("cannot find class for code '" + args[0] + "'");
+ }
+ try {
+ Object ret = codeClass.getField("ID").get(null);
+ return ret != null ? ret : new LongHolder();
+ }
+ catch (Throwable t) {
+ throw new ProcessingException("ID of code '" + args[0] + "'", t);
+ }
+ }
+ else if (functionName.equals("text")) {
+ if (args.length < 1) {
+ throw new IllegalArgumentException("expected at least 1 argument for function '" + functionName + "'");
+ }
+ if (args.length == 1) {
+ String[] tmp = new String[2];
+ tmp[0] = args[0];
+ tmp[1] = null;
+ args = tmp;
+ }
+ try {
+ Method m = getNlsProvider().getMethod("get", new Class[]{String.class, String[].class});
+ Object ret = m.invoke(null, (Object[]) args);
+ return ret != null ? ret : new StringHolder();
+ }
+ catch (Throwable t) {
+ throw new ProcessingException("unknown function in DynamicNls, check 'getConfiguredNlsProvider' / 'getNlsProvider': get", t);
+ }
+ }
+ else {
+ throw new IllegalArgumentException("undefined function '" + functionName + "'");
+ }
+ }
+
+ private Object tryGetPermissionLevel(Class permissionClass, String levelField, IAccessControlService accessControlService) throws ProcessingException {
+ if (permissionClass == null) {
+ return null;
+ }
+ try {
+ if (levelField != null) {
+ return permissionClass.getField(levelField).get(null);
+ }
+ else {
+ Permission p = (Permission) permissionClass.newInstance();
+ return accessControlService.getPermissionLevel(p);
+ }
+ }
+ catch (Exception e) {
+ throw new ProcessingException("getLevel of permission '" + permissionClass + "'", e);
+ }
+ }
+
+ /**
+ * called just before the transaction is being committed or rollbacked<br>
+ * do not call commit here, the flag is just meant as a hint
+ */
+ @ConfigOperation
+ @Order(50)
+ protected void execEndTransaction(boolean willBeCommitted) throws ProcessingException {
+ }
+
+ protected void initConfig() {
+ String tid = getConfiguredTransactionMemberId();
+ if (tid == null) {
+ tid = getClass().getSimpleName() + "." + "transaction";
+ }
+ setTransactionMemberId(tid);
+ setDirectJdbcConnection(getConfiguredDirectJdbcConnection());
+ setUsername(getConfiguredUsername());
+ setPassword(getConfiguredPassword());
+ setJndiName(getConfiguredJndiName());
+ setJndiInitialContextFactory(getConfiguredJndiInitialContextFactory());
+ setJndiProviderUrl(getConfiguredJndiProviderUrl());
+ setJndiUrlPkgPrefixes(getConfiguredJndiUrlPkgPrefixes());
+ setJdbcMappingName(getConfiguredJdbcMappingName());
+ setJdbcDriverName(getConfiguredJdbcDriverName());
+ setJdbcProperties(getConfiguredJdbcProperties());
+ setJdbcStatementCacheSize(getConfiguredJdbcStatementCacheSize());
+ setJdbcPoolSize(getConfiguredJdbcPoolSize());
+ setJdbcPoolConnectionBusyTimeout(getConfiguredJdbcPoolConnectionBusyTimeout());
+ setJdbcPoolConnectionLifetime(getConfiguredJdbcPoolConnectionLifetime());
+ setNlsProvider(getConfiguredNlsProvider());
+ // sql style
+ Class<? extends ISqlStyle> styleClass = getConfiguredSqlStyle();
+ if (styleClass != null) {
+ try {
+ setSqlStyle(styleClass.newInstance());
+ }
+ catch (Exception e) {
+ LOG.warn(null, e);
+ }
+ }
+ else {
+ setSqlStyle(new OracleSqlStyle());
+ }
+ }
+
+ /*
+ * Runtime
+ */
+ public void callbackAfterConnectionCreated(Connection conn) throws ProcessingException {
+ execAfterConnectionCreated(conn);
+ }
+
+ public void callbackTestConnection(Connection conn) throws Throwable {
+ execTestConnection(conn);
+ }
+
+ public Object callbackCustomBindFunction(String functionName, String[] args, Object[] bindBases) throws ProcessingException {
+ return execCustomBindFunction(functionName, args, bindBases);
+ }
+
+ @Override
+ public String getTransactionMemberId() {
+ return m_transactionMemberId;
+ }
+
+ public boolean isDirectJdbcConnection() {
+ return m_directJdbcConnection;
+ }
+
+ public int getJdbcStatementCacheSize() {
+ return m_queryCacheSize;
+ }
+
+ public String getJndiName() {
+ return m_jndiName;
+ }
+
+ public String getJndiInitialContextFactory() {
+ return m_jndiInitialContextFactory;
+ }
+
+ public String getJndiProviderUrl() {
+ return m_jndiProviderUrl;
+ }
+
+ public String getJndiUrlPkgPrefixes() {
+ return m_jndiUrlPkgPrefixes;
+ }
+
+ public String getJdbcMappingName() {
+ return m_jdbcMappingName;
+ }
+
+ public String getJdbcDriverName() {
+ return m_jdbcDriverName;
+ }
+
+ public String getJdbcProperties() {
+ return m_jdbcProps;
+ }
+
+ public String getUsername() {
+ return m_defaultUser;
+ }
+
+ public String getPassword() {
+ return m_defaultPass;
+ }
+
+ public int getJdbcPoolSize() {
+ return m_jdbcPoolSize;
+ }
+
+ public long getJdbcPoolConnectionLifetime() {
+ return m_jdbcPoolConnectionLifetime;
+ }
+
+ public long getJdbcPoolConnectionBusyTimeout() {
+ return m_jdbcPoolConnectionBusyTimeout;
+ }
+
+ public void setTransactionMemberId(String s) {
+ m_transactionMemberId = s;
+ }
+
+ public void setDirectJdbcConnection(boolean b) {
+ m_directJdbcConnection = b;
+ }
+
+ public void setJdbcStatementCacheSize(int n) {
+ m_queryCacheSize = n;
+ }
+
+ public void setJndiName(String s) {
+ m_jndiName = s;
+ }
+
+ public void setJndiInitialContextFactory(String s) {
+ m_jndiInitialContextFactory = s;
+ }
+
+ public void setJndiProviderUrl(String s) {
+ m_jndiProviderUrl = s;
+ }
+
+ public void setJndiUrlPkgPrefixes(String s) {
+ m_jndiUrlPkgPrefixes = s;
+ }
+
+ /**
+ * Supports ${...} variables resolved by {@link BundleContextUtility#resolve(String)}
+ */
+ public void setJdbcMappingName(String s) {
+ m_jdbcMappingName = BundleContextUtility.resolve(s);
+ }
+
+ public void setJdbcDriverName(String s) {
+ m_jdbcDriverName = s;
+ }
+
+ public void setJdbcProperties(String s) {
+ m_jdbcProps = s;
+ }
+
+ public void setUsername(String s) {
+ m_defaultUser = s;
+ }
+
+ public void setPassword(String s) {
+ m_defaultPass = s;
+ }
+
+ public void setJdbcPoolSize(int n) {
+ m_jdbcPoolSize = n;
+ }
+
+ public void setJdbcPoolConnectionLifetime(long t) {
+ m_jdbcPoolConnectionLifetime = t;
+ }
+
+ public void setJdbcPoolConnectionBusyTimeout(long t) {
+ m_jdbcPoolConnectionBusyTimeout = t;
+ }
+
+ @Override
+ public Object getAdapter(Class adapter) {
+ if (adapter == IServiceInventory.class) {
+ if (m_pool != null) {
+ return m_pool.getInventory();
+ }
+ }
+ return null;
+ }
+
+ public Class<? extends ScoutTexts> getNlsProvider() {
+ return m_nlsProvider;
+ }
+
+ public void setNlsProvider(Class<? extends ScoutTexts> nlsProvider) {
+ m_nlsProvider = nlsProvider;
+ }
+
+ @Override
+ public ISqlStyle getSqlStyle() {
+ return m_sqlStyle;
+ }
+
+ public void setSqlStyle(ISqlStyle sqlStyle) {
+ m_sqlStyle = sqlStyle;
+ }
+
+ /*
+ * Internals
+ */
+ private Connection leaseConnection() throws Throwable {
+ Connection conn = execCreateConnection();
+ return conn;
+ }
+
+ private Connection leaseConnectionInternal() throws Throwable {
+ try {
+ if (isDirectJdbcConnection()) {
+ // get connection from internal pool
+ Connection conn = getSqlConnectionPool().leaseConnection(this);
+ return conn;
+ }
+ else {
+ Connection conn = new SqlConnectionBuilder().createJndiConnection(this);
+ // do not call execAfterConnectionCreated(conn) because jndi connections
+ // are normally pooled
+ return conn;
+ }
+ }
+ catch (Exception e) {
+ ProcessingException pe;
+ if (e instanceof ProcessingException) {
+ pe = (ProcessingException) e;
+ }
+ else {
+ pe = new ProcessingException("unexpected exception", e);
+ }
+ if (isDirectJdbcConnection()) {
+ pe.addContextMessage("jdbcDriverName=" + getJdbcDriverName() + ", jdbcMappingName=" + getJdbcMappingName());
+ }
+ else {
+ pe.addContextMessage("jndiName=" + getJndiName());
+ }
+ throw pe;
+ }
+ }
+
+ private void releaseConnection(Connection conn) {
+ try {
+ execReleaseConnection(conn);
+ }
+ catch (Throwable e) {
+ LOG.error(null, e);
+ }
+ }
+
+ private void releaseConnectionInternal(Connection conn) throws Throwable {
+ if (isDirectJdbcConnection()) {
+ // delegate to internal pool
+ getSqlConnectionPool().releaseConnection(conn);
+ }
+ else {
+ conn.close();
+ }
+ }
+
+ private synchronized SqlConnectionPool getSqlConnectionPool() {
+ if (m_pool == null) {
+ m_pool = SqlConnectionPool.getPool(getClass(), getJdbcPoolSize(), getJdbcPoolConnectionLifetime(), getJdbcPoolConnectionBusyTimeout());
+ }
+ return m_pool;
+ }
+
+ @Override
+ public Connection getConnection() throws ProcessingException {
+ return getTransaction();
+ }
+
+ protected Connection getTransaction() throws ProcessingException {
+ ITransaction reg = ThreadContext.getTransaction();
+ if (reg == null) {
+ throw new ProcessingException("no ITransaction available, use ServerJob to run truncactions");
+ }
+ SqlTransactionMember member = (SqlTransactionMember) reg.getMember(getTransactionMemberId());
+ if (member == null) {
+ Connection conn;
+ try {
+ conn = leaseConnection();
+ member = new SqlTransactionMember(getTransactionMemberId(), conn);
+ reg.registerMember(member);
+ // this is the start of the transaction
+ execBeginTransaction();
+ }
+ catch (ProcessingException e) {
+ throw e;
+ }
+ catch (Throwable e) {
+ throw new ProcessingException("getTransaction", e);
+ }
+ }
+ return member.getConnection();
+ }
+
+ /**
+ * @return the statement cache used for this {@link ITransaction} transaction
+ */
+ protected final IStatementCache getStatementCache() throws ProcessingException {
+ ITransaction reg = ThreadContext.getTransaction();
+ if (reg == null) {
+ throw new ProcessingException("no ITransaction available, use ServerJob to run truncactions");
+ }
+ IStatementCache res = (IStatementCache) reg.getMember(PreparedStatementCache.TRANSACTION_MEMBER_ID);
+ if (res == null) {
+ res = new PreparedStatementCache(getJdbcStatementCacheSize());
+ reg.registerMember((ITransactionMember) res);
+ }
+ return res;
+ }
+
+ /*
+ * Operations
+ */
+
+ @Override
+ public Object[][] select(String s, Object... bindBases) throws ProcessingException {
+ return createStatementProcessor(s, bindBases, 0).processSelect(getTransaction(), getStatementCache(), null);
+ }
+
+ @Override
+ public Object[][] selectLimited(String s, int maxRowCount, Object... bindBases) throws ProcessingException {
+ return createStatementProcessor(s, bindBases, maxRowCount).processSelect(getTransaction(), getStatementCache(), null);
+ }
+
+ @Override
+ public void selectInto(String s, Object... bindBases) throws ProcessingException {
+ createStatementProcessor(s, bindBases, 0).processSelectInto(getTransaction(), getStatementCache(), null);
+ }
+
+ @Override
+ public void selectIntoLimited(String s, int maxRowCount, Object... bindBases) throws ProcessingException {
+ createStatementProcessor(s, bindBases, maxRowCount).processSelectInto(getTransaction(), getStatementCache(), null);
+ }
+
+ @Override
+ public void selectStreaming(String s, ISelectStreamHandler handler, Object... bindBases) throws ProcessingException {
+ createStatementProcessor(s, bindBases, 0).processSelectStreaming(getTransaction(), getStatementCache(), handler);
+ }
+
+ @Override
+ public void selectStreamingLimited(String s, ISelectStreamHandler handler, int maxRowCount, Object... bindBases) throws ProcessingException {
+ createStatementProcessor(s, bindBases, maxRowCount).processSelectStreaming(getTransaction(), getStatementCache(), handler);
+ }
+
+ @Override
+ public int insert(String s, Object... bindBases) throws ProcessingException {
+ return createStatementProcessor(s, bindBases, 0).processModification(getTransaction(), getStatementCache(), null);
+ }
+
+ @Override
+ public int update(String s, Object... bindBases) throws ProcessingException {
+ return createStatementProcessor(s, bindBases, 0).processModification(getTransaction(), getStatementCache(), null);
+ }
+
+ @Override
+ public int delete(String s, Object... bindBases) throws ProcessingException {
+ return createStatementProcessor(s, bindBases, 0).processModification(getTransaction(), getStatementCache(), null);
+ }
+
+ @Override
+ public boolean callStoredProcedure(String s, Object... bindBases) throws ProcessingException {
+ return createStatementProcessor(s, bindBases, 0).processStoredProcedure(getTransaction(), getStatementCache(), null);
+ }
+
+ @Override
+ public void commit() throws ProcessingException {
+ try {
+ getTransaction().commit();
+ }
+ catch (SQLException e) {
+ throw new ProcessingException("unexpected exception", e);
+ }
+ }
+
+ @Override
+ public String createPlainText(String s, Object... bindBases) throws ProcessingException {
+ return createStatementProcessor(s, bindBases, 0).createPlainText();
+ }
+
+ @Override
+ public WhereToken resolveSpecialConstraint(Object specialConstraint) throws ProcessingException {
+ if (specialConstraint instanceof LegacySearchFilter.StringLikeConstraint) {
+ LegacySearchFilter.StringLikeConstraint c = (LegacySearchFilter.StringLikeConstraint) specialConstraint;
+ String s = getSqlStyle().toLikePattern(c.getValue());
+ return new LegacySearchFilter.WhereToken(c.getTerm(), s, null);
+ }
+ else if (specialConstraint instanceof LegacySearchFilter.ComposerConstraint) {
+ LegacySearchFilter.ComposerConstraint c = (LegacySearchFilter.ComposerConstraint) specialConstraint;
+ HashMap<String, Object> map = new HashMap<String, Object>();
+ String term = c.getTerm();
+ for (Map.Entry<String, LegacySearchFilter.ComposerAttributeRef> e : c.getAttributeRefMap().entrySet()) {
+ String key = e.getKey();
+ LegacySearchFilter.ComposerAttributeRef att = e.getValue();
+ LegacyStatementBuilder b = new LegacyStatementBuilder(getSqlStyle());
+ String attValue = b.resolveComposerAttribute(att.getOp(), att.getAttribute(), att.getBindName(), att.getValue());
+ map.putAll(b.getBindMap());
+ term = term.replace(key, attValue);
+ }
+ return new LegacySearchFilter.WhereToken(term, null, map);
+ }
+ return null;
+ }
+
+ protected IStatementProcessor createStatementProcessor(String s, Object[] bindBases, int maxRowCount) throws ProcessingException {
+ return new StatementProcessor(this, s, bindBases, maxRowCount);
+ }
+
+ /**
+ * When the service completes work with an exception, a xa rollback is done on
+ * ALL used service request resources
+ *
+ * @see commit
+ */
+ @Override
+ public void rollback() throws ProcessingException {
+ try {
+ getTransaction().rollback();
+ }
+ catch (SQLException e) {
+ throw new ProcessingException("unexpected exception", e);
+ }
+ }
+
+ @Override
+ public Long getSequenceNextval(String sequenceName) throws ProcessingException {
+ String s = "SELECT " + sequenceName + ".NEXTVAL FROM DUAL ";
+ Object[][] ret = createStatementProcessor(s, null, 0).processSelect(getTransaction(), getStatementCache(), null);
+ if (ret.length == 1) {
+ return NumberUtility.toLong(NumberUtility.nvl((Number) ret[0][0], 0));
+ }
+ return 0L;
+ }
+
+ /**
+ * @return the class loaded by the first bundle with a matching symbolic name
+ * Example: name "com.myapp.shared.core.security.ReadDataPermission" is loaded by the bundle with symbolic
+ * name "com.myapp.shared.core".
+ */
+ private Class loadBundleClassLenient(Map<String, List<BundleClassDescriptor>> map, String name) {
+ String base = name;
+ String suffix = "";
+ while (base.length() > 0) {
+ List<BundleClassDescriptor> list = map.get(base);
+ if (list != null) {
+ for (BundleClassDescriptor desc : list) {
+ try {
+ Class c = Platform.getBundle(desc.getBundleSymbolicName()).loadClass(desc.getClassName());
+ if (suffix.length() > 0) {
+ c = Platform.getBundle(desc.getBundleSymbolicName()).loadClass(desc.getClassName() + suffix.replace(".", "$"));
+ return c;
+ }
+ else {
+ return c;
+ }
+ }
+ catch (Throwable t) {
+ LOG.warn("Could not load class with lenient name '" + name + "' in bundle " + desc.getBundleSymbolicName());
+ }
+ }
+ }
+ //
+ int i = base.lastIndexOf('.');
+ if (i >= 0) {
+ String seg = base.substring(i);
+ base = base.substring(0, i);
+ suffix = seg + suffix;
+ }
+ else {
+ String seg = base;
+ base = "";
+ suffix = seg + suffix;
+ }
+ }
+ LOG.warn("Could not find class with lenient name '" + name + "'");
+ return null;
+ }
+
+ private class SqlTransactionMember extends AbstractSqlTransactionMember {
+ private final Connection m_conn;
+
+ public SqlTransactionMember(String transactionMemberId, Connection conn) {
+ super(transactionMemberId);
+ m_conn = conn;
+ }
+
+ public Connection getConnection() {
+ return m_conn;
+ }
+
+ @Override
+ public void commitPhase2() {
+ try {
+ // this is the end of the transaction
+ execEndTransaction(true);
+ m_conn.commit();
+ }
+ catch (Exception e) {
+ LOG.error(null, e);
+ }
+ }
+
+ @Override
+ public void rollback() {
+ try {
+ // this is the end of the transaction
+ execEndTransaction(false);
+ m_conn.rollback();
+ }
+ catch (Exception e) {
+ if (!ThreadContext.getTransaction().isCancelled()) {
+ LOG.error(null, e);
+ }
+ }
+ }
+
+ @Override
+ public void release() {
+ releaseConnection(m_conn);
+ }
+ }// end private class
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/AbstractSqlTransactionMember.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/AbstractSqlTransactionMember.java
index 36d8fe763f..354d119c51 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/AbstractSqlTransactionMember.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/AbstractSqlTransactionMember.java
@@ -1,83 +1,83 @@
-package org.eclipse.scout.rt.server.services.common.jdbc;
-
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.HashSet;
-
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.server.transaction.AbstractTransactionMember;
-import org.eclipse.scout.rt.server.transaction.ITransaction;
-
-public abstract class AbstractSqlTransactionMember extends AbstractTransactionMember {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractSqlTransactionMember.class);
-
- private final Object m_activeStatementsLock = new Object();
- private final HashSet<Statement> m_activeStatements = new HashSet<Statement>();
- private boolean m_cancelled;
-
- public AbstractSqlTransactionMember(String transactionMemberId) {
- super(transactionMemberId);
- }
-
- @Override
- public boolean needsCommit() {
- return true;
- }
-
- @Override
- public boolean commitPhase1() {
- return true;
- }
-
- /**
- * Registers a statement in order to be canceled by {@link ITransaction#cancel()}
- *
- * @param statement
- * the statement to be registered
- * @throws SQLException
- */
- public void registerActiveStatement(Statement statement) throws SQLException {
- synchronized (m_activeStatementsLock) {
- if (m_cancelled) {
- throw new SQLException("Transaction was cancelled");
- }
- m_activeStatements.add(statement);
- }
- }
-
- /**
- * Removes a statement
- *
- * @param statement
- * the statement to be removed
- */
- public void unregisterActiveStatement(Statement statement) {
- synchronized (m_activeStatementsLock) {
- m_activeStatements.remove(statement);
- }
- }
-
- @Override
- public void cancel() {
- HashSet<Statement> set;
- synchronized (m_activeStatementsLock) {
- if (m_cancelled) {
- return;
- }
- m_cancelled = true;
- set = new HashSet<Statement>(m_activeStatements);
- m_activeStatements.clear();
- }
- for (Statement s : set) {
- try {
- LOG.info("request sent to cancel jdbc statement");
- s.cancel();
- }
- catch (Throwable e) {
- LOG.error("failed to cancel jdbc statement", e);
- }
- }
- }
-
-}
+package org.eclipse.scout.rt.server.services.common.jdbc;
+
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.HashSet;
+
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.server.transaction.AbstractTransactionMember;
+import org.eclipse.scout.rt.server.transaction.ITransaction;
+
+public abstract class AbstractSqlTransactionMember extends AbstractTransactionMember {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractSqlTransactionMember.class);
+
+ private final Object m_activeStatementsLock = new Object();
+ private final HashSet<Statement> m_activeStatements = new HashSet<Statement>();
+ private boolean m_cancelled;
+
+ public AbstractSqlTransactionMember(String transactionMemberId) {
+ super(transactionMemberId);
+ }
+
+ @Override
+ public boolean needsCommit() {
+ return true;
+ }
+
+ @Override
+ public boolean commitPhase1() {
+ return true;
+ }
+
+ /**
+ * Registers a statement in order to be canceled by {@link ITransaction#cancel()}
+ *
+ * @param statement
+ * the statement to be registered
+ * @throws SQLException
+ */
+ public void registerActiveStatement(Statement statement) throws SQLException {
+ synchronized (m_activeStatementsLock) {
+ if (m_cancelled) {
+ throw new SQLException("Transaction was cancelled");
+ }
+ m_activeStatements.add(statement);
+ }
+ }
+
+ /**
+ * Removes a statement
+ *
+ * @param statement
+ * the statement to be removed
+ */
+ public void unregisterActiveStatement(Statement statement) {
+ synchronized (m_activeStatementsLock) {
+ m_activeStatements.remove(statement);
+ }
+ }
+
+ @Override
+ public void cancel() {
+ HashSet<Statement> set;
+ synchronized (m_activeStatementsLock) {
+ if (m_cancelled) {
+ return;
+ }
+ m_cancelled = true;
+ set = new HashSet<Statement>(m_activeStatements);
+ m_activeStatements.clear();
+ }
+ for (Statement s : set) {
+ try {
+ LOG.info("request sent to cancel jdbc statement");
+ s.cancel();
+ }
+ catch (Throwable e) {
+ LOG.error("failed to cancel jdbc statement", e);
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/ByteArrayRowVisitor.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/ByteArrayRowVisitor.java
index 02a39c7158..e4a296709b 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/ByteArrayRowVisitor.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/ByteArrayRowVisitor.java
@@ -1,62 +1,62 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc;
-
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.util.List;
-
-import org.eclipse.scout.commons.CompressedObjectWriter;
-import org.eclipse.scout.commons.exception.ProcessingException;
-
-/**
- * RowVisitor implementation that stores the result set in a compressed
- * byte-array.
- */
-public class ByteArrayRowVisitor implements ISelectStreamHandler {
- private static final long serialVersionUID = 1L;
- private static final int INITIAL_BUFFER_SIZE = 1024 * 1024; // 1MB
- private static final int DEFLATER_BUFFER_SIZE = 1024 * 10; // 10KB
-
- private CompressedObjectWriter out;
-
- public ByteArrayRowVisitor() throws ProcessingException {
- out = new CompressedObjectWriter(INITIAL_BUFFER_SIZE, DEFLATER_BUFFER_SIZE);
- }
-
- @Override
- public void handleRow(Connection con, PreparedStatement stm, ResultSet rs, int rowIndex, List<SqlBind> values) throws ProcessingException {
- Object[] row = new Object[values.size()];
- for (int i = 0; i < row.length; i++) {
- row[i] = values.get(i).getValue();
- }
- out.compress(row);
-
- /*
- * [mvi, 2010-08-31]: Ticket 93222
- */
- out.resetWrittenObjectCache();
- }
-
- @Override
- public void finished(Connection con, PreparedStatement stm, ResultSet rs, int rowCount) throws ProcessingException {
- }
-
- public byte[] getBytes() throws ProcessingException {
- return out.getCompressedBytes();
- }
-
- public void close() {
- out.close();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.util.List;
+
+import org.eclipse.scout.commons.CompressedObjectWriter;
+import org.eclipse.scout.commons.exception.ProcessingException;
+
+/**
+ * RowVisitor implementation that stores the result set in a compressed
+ * byte-array.
+ */
+public class ByteArrayRowVisitor implements ISelectStreamHandler {
+ private static final long serialVersionUID = 1L;
+ private static final int INITIAL_BUFFER_SIZE = 1024 * 1024; // 1MB
+ private static final int DEFLATER_BUFFER_SIZE = 1024 * 10; // 10KB
+
+ private CompressedObjectWriter out;
+
+ public ByteArrayRowVisitor() throws ProcessingException {
+ out = new CompressedObjectWriter(INITIAL_BUFFER_SIZE, DEFLATER_BUFFER_SIZE);
+ }
+
+ @Override
+ public void handleRow(Connection con, PreparedStatement stm, ResultSet rs, int rowIndex, List<SqlBind> values) throws ProcessingException {
+ Object[] row = new Object[values.size()];
+ for (int i = 0; i < row.length; i++) {
+ row[i] = values.get(i).getValue();
+ }
+ out.compress(row);
+
+ /*
+ * [mvi, 2010-08-31]: Ticket 93222
+ */
+ out.resetWrittenObjectCache();
+ }
+
+ @Override
+ public void finished(Connection con, PreparedStatement stm, ResultSet rs, int rowCount) throws ProcessingException {
+ }
+
+ public byte[] getBytes() throws ProcessingException {
+ return out.getCompressedBytes();
+ }
+
+ public void close() {
+ out.close();
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/ISelectStreamHandler.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/ISelectStreamHandler.java
index 4949f4be89..9f43773f55 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/ISelectStreamHandler.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/ISelectStreamHandler.java
@@ -1,26 +1,26 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc;
-
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.util.List;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-
-public interface ISelectStreamHandler {
-
- void handleRow(Connection con, PreparedStatement stm, ResultSet rs, int rowIndex, List<SqlBind> values) throws ProcessingException;
-
- void finished(Connection con, PreparedStatement stm, ResultSet rs, int rowCount) throws ProcessingException;
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.util.List;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+
+public interface ISelectStreamHandler {
+
+ void handleRow(Connection con, PreparedStatement stm, ResultSet rs, int rowIndex, List<SqlBind> values) throws ProcessingException;
+
+ void finished(Connection con, PreparedStatement stm, ResultSet rs, int rowCount) throws ProcessingException;
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/ISqlService.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/ISqlService.java
index e1bbb719dd..8921740274 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/ISqlService.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/ISqlService.java
@@ -1,316 +1,316 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc;
-
-import java.sql.Connection;
-import java.util.Collection;
-import java.util.Map;
-
-import javax.sql.DataSource;
-
-import org.eclipse.scout.commons.TypeCastUtility;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.server.ThreadContext;
-import org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle;
-import org.eclipse.scout.rt.server.transaction.ITransaction;
-import org.eclipse.scout.rt.server.transaction.ITransactionMember;
-import org.eclipse.scout.service.IService;
-
-/**
- * <p>
- * This interface is used for access to a database. It adds functionality additional to that of the underlying JDBC
- * driver.
- * </p>
- * <p>
- * Classes implementing this interface also provide a {@link ISqlStyle} (by {@link #getSqlStyle()}). This interface
- * helps writing database SQL statements.
- * </p>
- * <h2>Simple example</h2>
- *
- * <pre>
- * ISqlService service = SERVICES.getService(ISqlService.class);
- * String sql = &quot;SELECT PERSON_NR, PERSON_NAME FROM PERSON WHERE COMPANY_NR = :companyNr&quot;;
- * Object[][] queryResult = service.select(sql,
- * new NVPair(&quot;companyNr&quot;, companyNr));
- * Long firstPersonNr = queryResult[0][0];
- * Long thirdPersonName = queryResult[2][1];
- * </pre>
- *
- * <h2>Bind Variables</h2>
- * <p>
- * The statements passed to be executed can contain bind variables (<code>:variableName</code>). The values to be bound
- * are also passed to the various methods of the class. They are type object, e.g. <code>Object... values</code>.
- * {@link ISqlService} can handle bind bases of the types
- * <ul>
- * <li><code>NVPair(String, Object)</code><br />
- * to directly pass known values. The {@link String} parameter is the name of the bind variable used in the SQL, without
- * prefix <code>:</code></li>
- * <li><code>IFormData</code><br />
- * The properties (bean properties) and fields of the bean are used.</li>
- * <li>a plain java bean<br />
- * The name of the bind variable (e.g. <code>:companyNr</code>) must match the property name (e.g. the bean must
- * implement <code>Long getCompanyNr()</code>)</li>
- * <li>a {@link Map} with name/value pairs</li>
- * <li>by default the ServerSession's bean properties are used as well</li>
- * </ul>
- * </p>
- * <h3>Database specific tokens</h3> Often used sql functions that may have different names in different sql styles can
- * be written with a leading @ character and are replaced by the correct token.
- * <ul>
- * <li>@sysdate</li>
- * <li>@upper</li>
- * <li>@lower</li>
- * <li>@trim</li>
- * <li>@nvl</li>
- * </ul>
- * <p>
- * <h3>Type Matching</h3>
- * <p>
- * When using this service the database column types are converted to Java types using {@link TypeCastUtility} that can
- * match basically all "normal" java types.
- * </p>
- * </p> <h3>Input Binds</h3>
- * <p>
- * Input binds are treated as follows
- * <ul>
- * <li><code>:name</code> is bound either directly or as a SQL <code>IN</code> list if it is an array or a
- * {@link Collection}</li>
- * <li><code>:{name}</code> is a batch value. For every value in the array the statement is executed once</li>
- * <li><code>:tableHolder.column</code> is also a batch value. For every row in the tableHolder the statement is
- * executed once. If a statement contains both <code>tableHolder</code> batch values and normal batch values, the batch
- * row count is determined by the number of rows in the table. Missing normal batch values are filled with
- * <code>null</code>.</li>
- * </ul>
- * </p>
- * <p>
- * Valid SQL bind and Java variable combinations, (bind bases):
- * <table>
- * <tr valign="top">
- * <th>Java</th>
- * <th>Sql</th>
- * <th>Executed Statement(s)</th>
- * </tr>
- * <tr valign="top">
- * <td><code>NVPair("var",String s)</code></td>
- * <td><code>PERSON_NR=:var</code></td>
- * <td><code>PERSON_NR=?</code></td>
- * </tr>
- * <tr valign="top">
- * <td><code>NVPair("var",String[] a)</code></td>
- * <td><code>PERSON_NR=:var</code></td>
- * <td><code><code>PERSON_NR IN (a, b, c, ... )</code></td>
- * </tr>
- * <tr valign="top">
- * <td><code>NVPair("var",Collection list)</code></td>
- * <td><code>PERSON_NR=:var</code></td>
- * <td><code>PERSON_NR IN (a, b, c, ...)</code></td>
- * </tr>
- * <tr valign="top">
- * <td><code>NVPair("var",Collection list)</code></td>
- * <td><code>PERSON_NR=:{var}</code></td>
- * <td>for first list element: <code>PERSON_NR=?</code><br />
- * for second list element: <code>PERSON_NR=?</code></td>
- * </tr>
- * </table>
- * </p>
- * <h3>Output Binds</h3>
- * <ul>
- * <li>Output (<code>SELECT INTO</code>) binds are treated as follows
- * <ul>
- * <li><code>:name</code> is filled by the column value. If there are multiple rows it is filled by an array containing
- * all values of the corresponding column.</li>
- * <li><code>:tableHolder.column</code> is a batch <code>INTO</code> bind. For every row in the select, one tableHolder
- * row is created and filled up.</li>
- * </ul>
- * </li>
- * <li>Output (Stored Procedure Out Parameters) binds are treated as follows
- * <ul>
- * <li><code>:[OUT]name</code> is filled by the single out parameter value<br />
- * Note that <code>:{name}</code> is not a legal <code>INTO</code> bind.</li>
- * </ul>
- * </li>
- * </ul>
- * <h3>Pooling modes</h3>
- * <p>
- * This service supports for two modes of connection pooling<br>
- * <ol>
- * <li>Direct (Scout) simple connection pooling when {@link AbstractSqlService#isDirectJdbcConnection()}==true <br>
- * these properties have a prefix of jdbc... and should only be used when there is no j2ee container supporting
- * {@link DataSource}s</li>
- * <li>J2EE connection pooling when {@link AbstractSqlService#isDirectJdbcConnection()}==true<br>
- * these properties have a prefix of jndi...</li>
- * </ol>
- * </p>
- *
- * @see SQL
- * @see ISqlStyle
- */
-public interface ISqlService extends IService {
-
- /**
- * Provides {@link ISqlStyle} to write database independent SQL statements.
- *
- * @return the {@link ISqlStyle} for the database used
- */
- ISqlStyle getSqlStyle();
-
- /**
- * <p>
- * Selects a normal matrix of data.
- * </p>
- * <p>
- * See the interface comment of {@link ISqlService} for description of how to use bind variables
- * </p>
- *
- * @return a two dimensional array, the first index referencing the rows, the second referencing the column. Cannot be
- * <code>null</code>
- */
- Object[][] select(String s, Object... bindBases) throws ProcessingException;
-
- /**
- * Select a normal matrix of data and limit amount of returned rows.
- * <p>
- * See the interface comment of {@link ISqlService} for description of how to use bind variables
- * </p>
- *
- * @param maxRowCount
- * the maximum number of rows returned
- * @return a two dimensional array, the first index referencing the rows, the second referencing the column. Cannot be
- * <code>null</code>
- */
- Object[][] selectLimited(String s, int maxRowCount, Object... bindBases) throws ProcessingException;
-
- /**
- * The <code>INTO</code> binds are filled by the corresponding result column.
- * <p>
- * See the interface comment of {@link ISqlService} for description of how to use bind variables
- * </p>
- *
- * @see #select(String, Object...)
- */
- void selectInto(String s, Object... bindBases) throws ProcessingException;
-
- /**
- * The <code>INTO</code> binds are filled by the corresponding result column.
- * <p>
- * See the interface comment of {@link ISqlService} for description of how to use bind variables
- * </p>
- *
- * @see #selectLimited(String, int, Object...)
- */
- void selectIntoLimited(String s, int maxRowCount, Object... bindBases) throws ProcessingException;
-
- /**
- * The callback can handle each row individually and therefore stream data
- * <p>
- * See the interface comment of {@link ISqlService} for description of how to use bind variables
- * </p>
- *
- * @param handler
- * callback to handle individual rows
- * @see #select(String, Object...)
- */
- void selectStreaming(String s, ISelectStreamHandler handler, Object... bindBases) throws ProcessingException;
-
- /**
- * The callback can handle each row individually and therefore stream data
- * <p>
- * See the interface comment of {@link ISqlService} for description of how to use bind variables
- * </p>
- *
- * @param handler
- * callback to handle individual rows
- * @see #selectLimited(String, int, Object...)
- */
- void selectStreamingLimited(String s, ISelectStreamHandler handler, int maxRowCount, Object... bindBases) throws ProcessingException;
-
- /**
- * insert rows
- * <p>
- * See the interface comment of {@link ISqlService} for description of how to use bind variables
- * </p>
- *
- * @return number of inserted rows
- */
- int insert(String s, Object... bindBases) throws ProcessingException;
-
- /**
- * update rows
- * <p>
- * See the interface comment of {@link ISqlService} for description of how to use bind variables
- * </p>
- *
- * @return number of updated rows
- */
- int update(String s, Object... bindBases) throws ProcessingException;
-
- /**
- * delete rows
- * <p>
- * See the interface comment of {@link ISqlService} for description of how to use bind variables
- * </p>
- *
- * @return number of deleted rows
- */
- int delete(String s, Object... bindBases) throws ProcessingException;
-
- /**
- * call a stored procedure
- * <p>
- * See the interface comment of {@link ISqlService} for description of how to use bind variables
- * </p>
- *
- * @return result code
- */
- boolean callStoredProcedure(String s, Object... bindBases) throws ProcessingException;
-
- /**
- * <p>
- * Normally a <code>commit</code> is not necessary since all SQL is running inside the service request xa transaction.
- * That means all SQL executed in the same service request is guaranteed to run on the same connection.
- * </p>
- * <p>
- * When the service completes work without an exception, a xa commit is done on ALL used service request resources.
- * </p>
- */
- void commit() throws ProcessingException;
-
- /**
- * <p>
- * Normally not necessary. When the service completes work with an exception, a xa rollback is done on ALL used
- * service request resources
- * </p>
- *
- * @see #commit()
- */
- void rollback() throws ProcessingException;
-
- /**
- * @returns the next value from a given sequence
- */
- Long getSequenceNextval(String sequenceName) throws ProcessingException;
-
- /**
- * Creates plaintext SQL from the given SQL part by plaining all binds
- *
- * @see ISqlStyle.createPlainText()
- */
- String createPlainText(String s, Object... bindBases) throws ProcessingException;
-
- String getTransactionMemberId();
-
- /**
- * @return current connection from {@link ITransactionMember} that is registered inside the {@link ITransaction} (see
- * {@link ThreadContext#getTransaction()}) as {@link #getTransactionMemberId()}
- */
- Connection getConnection() throws ProcessingException;
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc;
+
+import java.sql.Connection;
+import java.util.Collection;
+import java.util.Map;
+
+import javax.sql.DataSource;
+
+import org.eclipse.scout.commons.TypeCastUtility;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.server.ThreadContext;
+import org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle;
+import org.eclipse.scout.rt.server.transaction.ITransaction;
+import org.eclipse.scout.rt.server.transaction.ITransactionMember;
+import org.eclipse.scout.service.IService;
+
+/**
+ * <p>
+ * This interface is used for access to a database. It adds functionality additional to that of the underlying JDBC
+ * driver.
+ * </p>
+ * <p>
+ * Classes implementing this interface also provide a {@link ISqlStyle} (by {@link #getSqlStyle()}). This interface
+ * helps writing database SQL statements.
+ * </p>
+ * <h2>Simple example</h2>
+ *
+ * <pre>
+ * ISqlService service = SERVICES.getService(ISqlService.class);
+ * String sql = &quot;SELECT PERSON_NR, PERSON_NAME FROM PERSON WHERE COMPANY_NR = :companyNr&quot;;
+ * Object[][] queryResult = service.select(sql,
+ * new NVPair(&quot;companyNr&quot;, companyNr));
+ * Long firstPersonNr = queryResult[0][0];
+ * Long thirdPersonName = queryResult[2][1];
+ * </pre>
+ *
+ * <h2>Bind Variables</h2>
+ * <p>
+ * The statements passed to be executed can contain bind variables (<code>:variableName</code>). The values to be bound
+ * are also passed to the various methods of the class. They are type object, e.g. <code>Object... values</code>.
+ * {@link ISqlService} can handle bind bases of the types
+ * <ul>
+ * <li><code>NVPair(String, Object)</code><br />
+ * to directly pass known values. The {@link String} parameter is the name of the bind variable used in the SQL, without
+ * prefix <code>:</code></li>
+ * <li><code>IFormData</code><br />
+ * The properties (bean properties) and fields of the bean are used.</li>
+ * <li>a plain java bean<br />
+ * The name of the bind variable (e.g. <code>:companyNr</code>) must match the property name (e.g. the bean must
+ * implement <code>Long getCompanyNr()</code>)</li>
+ * <li>a {@link Map} with name/value pairs</li>
+ * <li>by default the ServerSession's bean properties are used as well</li>
+ * </ul>
+ * </p>
+ * <h3>Database specific tokens</h3> Often used sql functions that may have different names in different sql styles can
+ * be written with a leading @ character and are replaced by the correct token.
+ * <ul>
+ * <li>@sysdate</li>
+ * <li>@upper</li>
+ * <li>@lower</li>
+ * <li>@trim</li>
+ * <li>@nvl</li>
+ * </ul>
+ * <p>
+ * <h3>Type Matching</h3>
+ * <p>
+ * When using this service the database column types are converted to Java types using {@link TypeCastUtility} that can
+ * match basically all "normal" java types.
+ * </p>
+ * </p> <h3>Input Binds</h3>
+ * <p>
+ * Input binds are treated as follows
+ * <ul>
+ * <li><code>:name</code> is bound either directly or as a SQL <code>IN</code> list if it is an array or a
+ * {@link Collection}</li>
+ * <li><code>:{name}</code> is a batch value. For every value in the array the statement is executed once</li>
+ * <li><code>:tableHolder.column</code> is also a batch value. For every row in the tableHolder the statement is
+ * executed once. If a statement contains both <code>tableHolder</code> batch values and normal batch values, the batch
+ * row count is determined by the number of rows in the table. Missing normal batch values are filled with
+ * <code>null</code>.</li>
+ * </ul>
+ * </p>
+ * <p>
+ * Valid SQL bind and Java variable combinations, (bind bases):
+ * <table>
+ * <tr valign="top">
+ * <th>Java</th>
+ * <th>Sql</th>
+ * <th>Executed Statement(s)</th>
+ * </tr>
+ * <tr valign="top">
+ * <td><code>NVPair("var",String s)</code></td>
+ * <td><code>PERSON_NR=:var</code></td>
+ * <td><code>PERSON_NR=?</code></td>
+ * </tr>
+ * <tr valign="top">
+ * <td><code>NVPair("var",String[] a)</code></td>
+ * <td><code>PERSON_NR=:var</code></td>
+ * <td><code><code>PERSON_NR IN (a, b, c, ... )</code></td>
+ * </tr>
+ * <tr valign="top">
+ * <td><code>NVPair("var",Collection list)</code></td>
+ * <td><code>PERSON_NR=:var</code></td>
+ * <td><code>PERSON_NR IN (a, b, c, ...)</code></td>
+ * </tr>
+ * <tr valign="top">
+ * <td><code>NVPair("var",Collection list)</code></td>
+ * <td><code>PERSON_NR=:{var}</code></td>
+ * <td>for first list element: <code>PERSON_NR=?</code><br />
+ * for second list element: <code>PERSON_NR=?</code></td>
+ * </tr>
+ * </table>
+ * </p>
+ * <h3>Output Binds</h3>
+ * <ul>
+ * <li>Output (<code>SELECT INTO</code>) binds are treated as follows
+ * <ul>
+ * <li><code>:name</code> is filled by the column value. If there are multiple rows it is filled by an array containing
+ * all values of the corresponding column.</li>
+ * <li><code>:tableHolder.column</code> is a batch <code>INTO</code> bind. For every row in the select, one tableHolder
+ * row is created and filled up.</li>
+ * </ul>
+ * </li>
+ * <li>Output (Stored Procedure Out Parameters) binds are treated as follows
+ * <ul>
+ * <li><code>:[OUT]name</code> is filled by the single out parameter value<br />
+ * Note that <code>:{name}</code> is not a legal <code>INTO</code> bind.</li>
+ * </ul>
+ * </li>
+ * </ul>
+ * <h3>Pooling modes</h3>
+ * <p>
+ * This service supports for two modes of connection pooling<br>
+ * <ol>
+ * <li>Direct (Scout) simple connection pooling when {@link AbstractSqlService#isDirectJdbcConnection()}==true <br>
+ * these properties have a prefix of jdbc... and should only be used when there is no j2ee container supporting
+ * {@link DataSource}s</li>
+ * <li>J2EE connection pooling when {@link AbstractSqlService#isDirectJdbcConnection()}==true<br>
+ * these properties have a prefix of jndi...</li>
+ * </ol>
+ * </p>
+ *
+ * @see SQL
+ * @see ISqlStyle
+ */
+public interface ISqlService extends IService {
+
+ /**
+ * Provides {@link ISqlStyle} to write database independent SQL statements.
+ *
+ * @return the {@link ISqlStyle} for the database used
+ */
+ ISqlStyle getSqlStyle();
+
+ /**
+ * <p>
+ * Selects a normal matrix of data.
+ * </p>
+ * <p>
+ * See the interface comment of {@link ISqlService} for description of how to use bind variables
+ * </p>
+ *
+ * @return a two dimensional array, the first index referencing the rows, the second referencing the column. Cannot be
+ * <code>null</code>
+ */
+ Object[][] select(String s, Object... bindBases) throws ProcessingException;
+
+ /**
+ * Select a normal matrix of data and limit amount of returned rows.
+ * <p>
+ * See the interface comment of {@link ISqlService} for description of how to use bind variables
+ * </p>
+ *
+ * @param maxRowCount
+ * the maximum number of rows returned
+ * @return a two dimensional array, the first index referencing the rows, the second referencing the column. Cannot be
+ * <code>null</code>
+ */
+ Object[][] selectLimited(String s, int maxRowCount, Object... bindBases) throws ProcessingException;
+
+ /**
+ * The <code>INTO</code> binds are filled by the corresponding result column.
+ * <p>
+ * See the interface comment of {@link ISqlService} for description of how to use bind variables
+ * </p>
+ *
+ * @see #select(String, Object...)
+ */
+ void selectInto(String s, Object... bindBases) throws ProcessingException;
+
+ /**
+ * The <code>INTO</code> binds are filled by the corresponding result column.
+ * <p>
+ * See the interface comment of {@link ISqlService} for description of how to use bind variables
+ * </p>
+ *
+ * @see #selectLimited(String, int, Object...)
+ */
+ void selectIntoLimited(String s, int maxRowCount, Object... bindBases) throws ProcessingException;
+
+ /**
+ * The callback can handle each row individually and therefore stream data
+ * <p>
+ * See the interface comment of {@link ISqlService} for description of how to use bind variables
+ * </p>
+ *
+ * @param handler
+ * callback to handle individual rows
+ * @see #select(String, Object...)
+ */
+ void selectStreaming(String s, ISelectStreamHandler handler, Object... bindBases) throws ProcessingException;
+
+ /**
+ * The callback can handle each row individually and therefore stream data
+ * <p>
+ * See the interface comment of {@link ISqlService} for description of how to use bind variables
+ * </p>
+ *
+ * @param handler
+ * callback to handle individual rows
+ * @see #selectLimited(String, int, Object...)
+ */
+ void selectStreamingLimited(String s, ISelectStreamHandler handler, int maxRowCount, Object... bindBases) throws ProcessingException;
+
+ /**
+ * insert rows
+ * <p>
+ * See the interface comment of {@link ISqlService} for description of how to use bind variables
+ * </p>
+ *
+ * @return number of inserted rows
+ */
+ int insert(String s, Object... bindBases) throws ProcessingException;
+
+ /**
+ * update rows
+ * <p>
+ * See the interface comment of {@link ISqlService} for description of how to use bind variables
+ * </p>
+ *
+ * @return number of updated rows
+ */
+ int update(String s, Object... bindBases) throws ProcessingException;
+
+ /**
+ * delete rows
+ * <p>
+ * See the interface comment of {@link ISqlService} for description of how to use bind variables
+ * </p>
+ *
+ * @return number of deleted rows
+ */
+ int delete(String s, Object... bindBases) throws ProcessingException;
+
+ /**
+ * call a stored procedure
+ * <p>
+ * See the interface comment of {@link ISqlService} for description of how to use bind variables
+ * </p>
+ *
+ * @return result code
+ */
+ boolean callStoredProcedure(String s, Object... bindBases) throws ProcessingException;
+
+ /**
+ * <p>
+ * Normally a <code>commit</code> is not necessary since all SQL is running inside the service request xa transaction.
+ * That means all SQL executed in the same service request is guaranteed to run on the same connection.
+ * </p>
+ * <p>
+ * When the service completes work without an exception, a xa commit is done on ALL used service request resources.
+ * </p>
+ */
+ void commit() throws ProcessingException;
+
+ /**
+ * <p>
+ * Normally not necessary. When the service completes work with an exception, a xa rollback is done on ALL used
+ * service request resources
+ * </p>
+ *
+ * @see #commit()
+ */
+ void rollback() throws ProcessingException;
+
+ /**
+ * @returns the next value from a given sequence
+ */
+ Long getSequenceNextval(String sequenceName) throws ProcessingException;
+
+ /**
+ * Creates plaintext SQL from the given SQL part by plaining all binds
+ *
+ * @see ISqlStyle.createPlainText()
+ */
+ String createPlainText(String s, Object... bindBases) throws ProcessingException;
+
+ String getTransactionMemberId();
+
+ /**
+ * @return current connection from {@link ITransactionMember} that is registered inside the {@link ITransaction} (see
+ * {@link ThreadContext#getTransaction()}) as {@link #getTransactionMemberId()}
+ */
+ Connection getConnection() throws ProcessingException;
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/IStatementCache.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/IStatementCache.java
index 478cd40412..5d4857a96c 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/IStatementCache.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/IStatementCache.java
@@ -1,28 +1,28 @@
-/*******************************************************************************
- * Copyright (c) 2010,2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc;
-
-import java.sql.CallableStatement;
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.SQLException;
-
-public interface IStatementCache {
-
- PreparedStatement getPreparedStatement(Connection conn, String s) throws SQLException;
-
- void releasePreparedStatement(PreparedStatement ps);
-
- CallableStatement getCallableStatement(Connection conn, String s) throws SQLException;
-
- void releaseCallableStatement(CallableStatement cs);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010,2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc;
+
+import java.sql.CallableStatement;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+
+public interface IStatementCache {
+
+ PreparedStatement getPreparedStatement(Connection conn, String s) throws SQLException;
+
+ void releasePreparedStatement(PreparedStatement ps);
+
+ CallableStatement getCallableStatement(Connection conn, String s) throws SQLException;
+
+ void releaseCallableStatement(CallableStatement cs);
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/IStatementProcessor.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/IStatementProcessor.java
index 3d3bb4aa87..c4bbc31712 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/IStatementProcessor.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/IStatementProcessor.java
@@ -1,36 +1,36 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc;
-
-import java.sql.Connection;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-
-public interface IStatementProcessor {
-
- Object[][] processSelect(Connection conn, IStatementCache cache, IStatementProcessorMonitor monitor) throws ProcessingException;
-
- void processSelectInto(Connection conn, IStatementCache cache, IStatementProcessorMonitor monitor) throws ProcessingException;
-
- void processSelectStreaming(Connection conn, IStatementCache cache, ISelectStreamHandler handler) throws ProcessingException;
-
- int processModification(Connection conn, IStatementCache cache, IStatementProcessorMonitor monitor) throws ProcessingException;
-
- boolean processStoredProcedure(Connection conn, IStatementCache cache, IStatementProcessorMonitor monitor) throws ProcessingException;
-
- String createPlainText() throws ProcessingException;
-
- /**
- * Simulate the execution of the statement and dump output to System.out
- */
- void simulate() throws ProcessingException;
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc;
+
+import java.sql.Connection;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+
+public interface IStatementProcessor {
+
+ Object[][] processSelect(Connection conn, IStatementCache cache, IStatementProcessorMonitor monitor) throws ProcessingException;
+
+ void processSelectInto(Connection conn, IStatementCache cache, IStatementProcessorMonitor monitor) throws ProcessingException;
+
+ void processSelectStreaming(Connection conn, IStatementCache cache, ISelectStreamHandler handler) throws ProcessingException;
+
+ int processModification(Connection conn, IStatementCache cache, IStatementProcessorMonitor monitor) throws ProcessingException;
+
+ boolean processStoredProcedure(Connection conn, IStatementCache cache, IStatementProcessorMonitor monitor) throws ProcessingException;
+
+ String createPlainText() throws ProcessingException;
+
+ /**
+ * Simulate the execution of the statement and dump output to System.out
+ */
+ void simulate() throws ProcessingException;
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/IStatementProcessorMonitor.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/IStatementProcessorMonitor.java
index 39bc59a69f..431c510095 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/IStatementProcessorMonitor.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/IStatementProcessorMonitor.java
@@ -1,33 +1,33 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc;
-
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.util.List;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-
-public interface IStatementProcessorMonitor {
-
- /**
- * Called after data has been completely fetched and before operation is going
- * to close affected resources.
- *
- * @param rows
- * is the life list of rows fetched so far, changes to this list will
- * be returned by the original method call. Used in methods
- * {@link IStatementProcessor#processSelect(Connection, IStatementCache, IStatementProcessorMonitor)}
- * {@link IStatementProcessor#processSelectInto(Connection, IStatementCache, IStatementProcessorMonitor)}
- */
- void postFetchData(Connection con, PreparedStatement stm, ResultSet rs, List<Object[]> rows) throws ProcessingException;
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.util.List;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+
+public interface IStatementProcessorMonitor {
+
+ /**
+ * Called after data has been completely fetched and before operation is going
+ * to close affected resources.
+ *
+ * @param rows
+ * is the life list of rows fetched so far, changes to this list will
+ * be returned by the original method call. Used in methods
+ * {@link IStatementProcessor#processSelect(Connection, IStatementCache, IStatementProcessorMonitor)}
+ * {@link IStatementProcessor#processSelectInto(Connection, IStatementCache, IStatementProcessorMonitor)}
+ */
+ void postFetchData(Connection con, PreparedStatement stm, ResultSet rs, List<Object[]> rows) throws ProcessingException;
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/SQL.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/SQL.java
index e1ead13dc1..de18c37327 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/SQL.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/SQL.java
@@ -1,192 +1,192 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc;
-
-import java.sql.Connection;
-import java.sql.SQLException;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle;
-import org.eclipse.scout.service.SERVICES;
-
-/**
- * <p>
- * This is a convenience class to use {@link ISqlService}.
- * </p>
- * <p>
- * It is just wrapper for a service class implementing {@link ISqlService} and contains almost no logic on its own.
- * Other references would be {@link ISqlStyle} to generate SQL code independent of the used database.
- * </p>
- * <h4>Usage</h4>
- * <p>
- * Example:
- *
- * <pre>
- * Object[][] queryResult = SQL.select(&quot;SELECT PERSON_NR, PERSON_NAME FROM PERSON&quot;);
- * Long firstPersonNr = queryResult[0][0];
- * Long thirdPersonName = queryResult[2][1];
- * </pre>
- *
- * Without this class the necessary code would look like this
- *
- * <pre>
- * ISqlService service = SERVICES.getService(ISqlService.class);
- * Object[][] queryResult = service.select(&quot;SELECT PERSON_NR, PERSON_NAME FROM PERSON&quot;);
- * Long firstPersonNr = queryResult[0][0];
- * Long thirdPersonName = queryResult[2][1];
- * </pre>
- *
- * </p>
- *
- * @see ISqlService
- */
-public final class SQL {
- public static Class<? extends ISqlService> usedServiceType = ISqlService.class;
-
- private SQL() {
- }
-
- /**
- * <p>
- * Access to the driver name
- * </p>
- * <p>
- * Note: {@link ProcessingException} and {@link SQLException} are caught without logging or rethrowing them again.
- * </p>
- *
- * @return the name of the JDBC driver used
- */
- public static String getDriverName() {
- String driverName = null;
- Connection conn;
- try {
- conn = getConnection();
- driverName = conn.getMetaData().getDriverName();
- }
- catch (ProcessingException e) {
- // nop
- }
- catch (SQLException e) {
- // nop
- }
- return driverName;
- }
-
- /**
- * @throws ProcessingException
- */
- public static Connection getConnection() throws ProcessingException {
- ISqlService service = SERVICES.getService(usedServiceType);
- return service.getConnection();
- }
-
- public static ISqlStyle getSqlStyle() {
- ISqlService service = SERVICES.getService(usedServiceType);
- return service.getSqlStyle();
- }
-
- /**
- * @see ISqlService#select(String, Object...)
- */
- public static Object[][] select(String s, Object... bindBases) throws ProcessingException {
- ISqlService service = SERVICES.getService(usedServiceType);
- return service.select(s, bindBases);
- }
-
- /**
- * @see ISqlService#selectLimited(String, int, Object...)
- */
- public static Object[][] selectLimited(String s, int maxRowCount, Object... bindBases) throws ProcessingException {
- ISqlService service = SERVICES.getService(usedServiceType);
- return service.selectLimited(s, maxRowCount, bindBases);
- }
-
- /**
- * @see ISqlService#selectInto(String, Object...)
- */
- public static void selectInto(String s, Object... bindBases) throws ProcessingException {
- ISqlService service = SERVICES.getService(usedServiceType);
- service.selectInto(s, bindBases);
- }
-
- /**
- * @see ISqlService#selectIntoLimited(String, int, Object...)
- */
- public static void selectIntoLimited(String s, int maxRowCount, Object... bindBases) throws ProcessingException {
- ISqlService service = SERVICES.getService(usedServiceType);
- service.selectIntoLimited(s, maxRowCount, bindBases);
- }
-
- /**
- * @see ISqlService#insert(String, Object...)
- */
- public static int insert(String s, Object... bindBases) throws ProcessingException {
- ISqlService service = SERVICES.getService(usedServiceType);
- return service.insert(s, bindBases);
- }
-
- /**
- * @see ISqlService#update(String, Object...)
- */
- public static int update(String s, Object... bindBases) throws ProcessingException {
- ISqlService service = SERVICES.getService(usedServiceType);
- return service.update(s, bindBases);
- }
-
- /**
- * @see ISqlService#delete(String, Object...)
- */
- public static int delete(String s, Object... bindBases) throws ProcessingException {
- ISqlService service = SERVICES.getService(usedServiceType);
- return service.delete(s, bindBases);
- }
-
- /**
- * @see ISqlService#callStoredProcedure(String, Object...)
- */
- public static boolean callStoredProcedure(String s, Object... bindBases) throws ProcessingException {
- ISqlService service = SERVICES.getService(usedServiceType);
- return service.callStoredProcedure(s, bindBases);
- }
-
- /**
- * @see ISqlService#createPlainText(String, Object...)
- */
- public static String createPlainText(String s, Object... bindBases) throws ProcessingException {
- ISqlService service = SERVICES.getService(usedServiceType);
- return service.createPlainText(s, bindBases);
- }
-
- /**
- * @see ISqlService#commit()
- */
- public static void commit() throws ProcessingException {
- ISqlService service = SERVICES.getService(usedServiceType);
- service.commit();
- }
-
- /**
- * @see ISqlService#rollback()
- */
- public static void rollback() throws ProcessingException {
- ISqlService service = SERVICES.getService(usedServiceType);
- service.rollback();
- }
-
- /**
- * @see ISqlService#getSequenceNextval(String)
- */
- public static Long getSequenceNextval(String sequenceName) throws ProcessingException {
- ISqlService service = SERVICES.getService(usedServiceType);
- return service.getSequenceNextval(sequenceName);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle;
+import org.eclipse.scout.service.SERVICES;
+
+/**
+ * <p>
+ * This is a convenience class to use {@link ISqlService}.
+ * </p>
+ * <p>
+ * It is just wrapper for a service class implementing {@link ISqlService} and contains almost no logic on its own.
+ * Other references would be {@link ISqlStyle} to generate SQL code independent of the used database.
+ * </p>
+ * <h4>Usage</h4>
+ * <p>
+ * Example:
+ *
+ * <pre>
+ * Object[][] queryResult = SQL.select(&quot;SELECT PERSON_NR, PERSON_NAME FROM PERSON&quot;);
+ * Long firstPersonNr = queryResult[0][0];
+ * Long thirdPersonName = queryResult[2][1];
+ * </pre>
+ *
+ * Without this class the necessary code would look like this
+ *
+ * <pre>
+ * ISqlService service = SERVICES.getService(ISqlService.class);
+ * Object[][] queryResult = service.select(&quot;SELECT PERSON_NR, PERSON_NAME FROM PERSON&quot;);
+ * Long firstPersonNr = queryResult[0][0];
+ * Long thirdPersonName = queryResult[2][1];
+ * </pre>
+ *
+ * </p>
+ *
+ * @see ISqlService
+ */
+public final class SQL {
+ public static Class<? extends ISqlService> usedServiceType = ISqlService.class;
+
+ private SQL() {
+ }
+
+ /**
+ * <p>
+ * Access to the driver name
+ * </p>
+ * <p>
+ * Note: {@link ProcessingException} and {@link SQLException} are caught without logging or rethrowing them again.
+ * </p>
+ *
+ * @return the name of the JDBC driver used
+ */
+ public static String getDriverName() {
+ String driverName = null;
+ Connection conn;
+ try {
+ conn = getConnection();
+ driverName = conn.getMetaData().getDriverName();
+ }
+ catch (ProcessingException e) {
+ // nop
+ }
+ catch (SQLException e) {
+ // nop
+ }
+ return driverName;
+ }
+
+ /**
+ * @throws ProcessingException
+ */
+ public static Connection getConnection() throws ProcessingException {
+ ISqlService service = SERVICES.getService(usedServiceType);
+ return service.getConnection();
+ }
+
+ public static ISqlStyle getSqlStyle() {
+ ISqlService service = SERVICES.getService(usedServiceType);
+ return service.getSqlStyle();
+ }
+
+ /**
+ * @see ISqlService#select(String, Object...)
+ */
+ public static Object[][] select(String s, Object... bindBases) throws ProcessingException {
+ ISqlService service = SERVICES.getService(usedServiceType);
+ return service.select(s, bindBases);
+ }
+
+ /**
+ * @see ISqlService#selectLimited(String, int, Object...)
+ */
+ public static Object[][] selectLimited(String s, int maxRowCount, Object... bindBases) throws ProcessingException {
+ ISqlService service = SERVICES.getService(usedServiceType);
+ return service.selectLimited(s, maxRowCount, bindBases);
+ }
+
+ /**
+ * @see ISqlService#selectInto(String, Object...)
+ */
+ public static void selectInto(String s, Object... bindBases) throws ProcessingException {
+ ISqlService service = SERVICES.getService(usedServiceType);
+ service.selectInto(s, bindBases);
+ }
+
+ /**
+ * @see ISqlService#selectIntoLimited(String, int, Object...)
+ */
+ public static void selectIntoLimited(String s, int maxRowCount, Object... bindBases) throws ProcessingException {
+ ISqlService service = SERVICES.getService(usedServiceType);
+ service.selectIntoLimited(s, maxRowCount, bindBases);
+ }
+
+ /**
+ * @see ISqlService#insert(String, Object...)
+ */
+ public static int insert(String s, Object... bindBases) throws ProcessingException {
+ ISqlService service = SERVICES.getService(usedServiceType);
+ return service.insert(s, bindBases);
+ }
+
+ /**
+ * @see ISqlService#update(String, Object...)
+ */
+ public static int update(String s, Object... bindBases) throws ProcessingException {
+ ISqlService service = SERVICES.getService(usedServiceType);
+ return service.update(s, bindBases);
+ }
+
+ /**
+ * @see ISqlService#delete(String, Object...)
+ */
+ public static int delete(String s, Object... bindBases) throws ProcessingException {
+ ISqlService service = SERVICES.getService(usedServiceType);
+ return service.delete(s, bindBases);
+ }
+
+ /**
+ * @see ISqlService#callStoredProcedure(String, Object...)
+ */
+ public static boolean callStoredProcedure(String s, Object... bindBases) throws ProcessingException {
+ ISqlService service = SERVICES.getService(usedServiceType);
+ return service.callStoredProcedure(s, bindBases);
+ }
+
+ /**
+ * @see ISqlService#createPlainText(String, Object...)
+ */
+ public static String createPlainText(String s, Object... bindBases) throws ProcessingException {
+ ISqlService service = SERVICES.getService(usedServiceType);
+ return service.createPlainText(s, bindBases);
+ }
+
+ /**
+ * @see ISqlService#commit()
+ */
+ public static void commit() throws ProcessingException {
+ ISqlService service = SERVICES.getService(usedServiceType);
+ service.commit();
+ }
+
+ /**
+ * @see ISqlService#rollback()
+ */
+ public static void rollback() throws ProcessingException {
+ ISqlService service = SERVICES.getService(usedServiceType);
+ service.rollback();
+ }
+
+ /**
+ * @see ISqlService#getSequenceNextval(String)
+ */
+ public static Long getSequenceNextval(String sequenceName) throws ProcessingException {
+ ISqlService service = SERVICES.getService(usedServiceType);
+ return service.getSequenceNextval(sequenceName);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/SqlBind.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/SqlBind.java
index ae33904bc0..312ca853e2 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/SqlBind.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/SqlBind.java
@@ -1,54 +1,54 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-import java.sql.Types;
-
-public class SqlBind {
- private int m_sqlType;
- private Object m_value;
-
- public SqlBind(int sqlType, Object value) {
- m_sqlType = sqlType;
- m_value = value;
- }
-
- public Object getValue() {
- return m_value;
- }
-
- public int getSqlType() {
- return m_sqlType;
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName() + "[" + decodeJdbcType(m_sqlType) + " " + m_value + "]";
- }
-
- public static String decodeJdbcType(int i) {
- try {
- Field[] fields = Types.class.getFields();
- for (Field f : fields) {
- int flags = f.getModifiers();
- if (Modifier.isPublic(flags) && Modifier.isStatic(flags) && Modifier.isFinal(flags) && ((Integer) f.get(null)) == i) {
- return f.getName();
- }
- }
- }
- catch (Throwable t) {
- // nop
- }
- return "type=" + i;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.sql.Types;
+
+public class SqlBind {
+ private int m_sqlType;
+ private Object m_value;
+
+ public SqlBind(int sqlType, Object value) {
+ m_sqlType = sqlType;
+ m_value = value;
+ }
+
+ public Object getValue() {
+ return m_value;
+ }
+
+ public int getSqlType() {
+ return m_sqlType;
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + "[" + decodeJdbcType(m_sqlType) + " " + m_value + "]";
+ }
+
+ public static String decodeJdbcType(int i) {
+ try {
+ Field[] fields = Types.class.getFields();
+ for (Field f : fields) {
+ int flags = f.getModifiers();
+ if (Modifier.isPublic(flags) && Modifier.isStatic(flags) && Modifier.isFinal(flags) && ((Integer) f.get(null)) == i) {
+ return f.getName();
+ }
+ }
+ }
+ catch (Throwable t) {
+ // nop
+ }
+ return "type=" + i;
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/AliasMapper.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/AliasMapper.java
index 312749bd0c..edbe8dca36 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/AliasMapper.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/AliasMapper.java
@@ -1,250 +1,250 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc.builder;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-
-/**
- * Alias management for form data statement builder
- */
-public class AliasMapper {
- private static final Pattern CLEAN_ENTITY_NAME = Pattern.compile("[@]?(parent\\.)?([a-zA-Z0-9_]+)[@]?");
- private static final Pattern ENTITY_NAME = Pattern.compile("[@](parent\\.)?([a-zA-Z0-9_]+)[@]");
-
- /**
- * Pattern to recognize entity definitions.
- * The pattern does not recognize an entity definition in case the
- * string is terminated after the ending @. Thus when using the entity definition,
- * append a space to the string before applying the pattern.
- */
- private static final Pattern ENTITY_DEFINITION = Pattern.compile("[@]([a-zA-Z0-9_]+)[@]([^.])");
- private static final Pattern ENTITY_REFERENCE = Pattern.compile("[@](parent\\.)?([a-zA-Z0-9_]+)[@][.]");
-
- private AtomicInteger m_sequenceProvider;
- private final Map<String, String> m_rootAliases;
- private final Map<Object, Map<String, String>> m_nodeAliases;
-
- public AliasMapper() {
- m_rootAliases = new HashMap<String, String>();
- m_nodeAliases = new HashMap<Object, Map<String, String>>();
- m_sequenceProvider = new AtomicInteger(0);
- }
-
- /**
- * use another sequence provider (counts 0,1,2... for aliases)
- */
- public void setSequenceProvider(AtomicInteger sequenceProvider) {
- m_sequenceProvider = sequenceProvider;
- }
-
- /**
- * cleans an entity name
- * <ul>
- * <li>@PERSON@ =&gt; PERSON</li>
- * <li>@person@ =&gt; PERSON</li>
- * <li>@parent.PERSON@ =&gt; PERSON</li>
- * <li>Person =&gt; PERSON</li>
- * </ul>
- */
- public static String cleanEntityName(String e) {
- if (e == null) {
- return e;
- }
- Matcher m = CLEAN_ENTITY_NAME.matcher(e);
- if (m.matches()) {
- return m.group(2).toUpperCase();
- }
- else {
- return e.toUpperCase();
- }
- }
-
- /**
- * generates next unique alias name such as p1, p2, p3 etc.
- */
- public String nextAlias() {
- int seq = m_sequenceProvider.incrementAndGet();
- return "a" + (("" + (10000 + seq)).substring(1));
- }
-
- /**
- * @return the live map with the effective aliases per entity for example {PERSON = p, TASK = t}
- * never returns null
- */
- public Map<String, String> getRootAliases() {
- return m_rootAliases;
- }
-
- /**
- * @param entityName
- * with or without the @ delimiters (lenient), for example
- * <ul>
- * <li>PERSON</li>
- * <li>TASK</li>
- * <li>@PERSON@</li>
- * <li>@TASK@</li>
- * </ul>
- * @return the alias for an entity, for example p, t etc.
- */
- public String getRootAlias(String entityName) {
- return m_rootAliases.get(cleanEntityName(entityName));
- }
-
- /**
- * @param entityName
- * with or without the @ delimiters (lenient), for example
- * <ul>
- * <li>PERSON</li>
- * <li>TASK</li>
- * <li>@PERSON@</li>
- * <li>@TASK@</li>
- * </ul>
- * @param alias
- * for example p, t etc.
- * @return the alias for the root entity
- */
- public void setRootAlias(String entityName, String alias) {
- m_rootAliases.put(cleanEntityName(entityName), alias);
- }
-
- /**
- * @return the live map with the effective aliases per entity for example {PERSON = p, TASK = t}
- * never returns null
- */
- public Map<String, String> getNodeAliases(Object node) {
- Map<String, String> map = m_nodeAliases.get(node);
- if (map == null) {
- map = new HashMap<String, String>();
- m_nodeAliases.put(node, map);
- }
- return map;
- }
-
- /**
- * @param entityName
- * with or without the @ delimiters (lenient), for example
- * <ul>
- * <li>PERSON</li>
- * <li>TASK</li>
- * <li>@PERSON@</li>
- * <li>@TASK@</li>
- * </ul>
- * @return the alias for an entity, for example p, t etc.
- */
- public String getNodeAlias(Object node, String entityName) {
- Map<String, String> map = m_nodeAliases.get(node);
- if (map != null) {
- return map.get(cleanEntityName(entityName));
- }
- else {
- return null;
- }
- }
-
- /**
- * @param entityName
- * with or without the @ delimiters (lenient), for example
- * <ul>
- * <li>PERSON</li>
- * <li>TASK</li>
- * <li>@PERSON@</li>
- * <li>@TASK@</li>
- * </ul>
- * @param alias
- * for example p, t etc.
- * @return the alias for the node entity
- */
- public void setNodeAlias(Object node, String entityName, String alias) {
- Map<String, String> map = m_nodeAliases.get(node);
- if (map == null) {
- map = new HashMap<String, String>();
- m_nodeAliases.put(node, map);
- }
- map.put(cleanEntityName(entityName), alias);
- }
-
- /**
- * Parse all entity definitions in the statement part and define a new (local) alias that is associate with the node.
- */
- public void addAllNodeEntitiesFrom(Object node, String statementPart) {
- Matcher m = ENTITY_DEFINITION.matcher(statementPart + " ");
- while (m.find()) {
- setNodeAlias(node, m.group(1), nextAlias());
- }
- }
-
- public void addMissingNodeEntitiesFrom(Object node, String statementPart) {
- Matcher m = ENTITY_DEFINITION.matcher(statementPart + " ");
- while (m.find()) {
- if (getNodeAlias(node, m.group(1)) == null) {
- setNodeAlias(node, m.group(1), nextAlias());
- }
- }
- }
-
- /**
- * Parse all entity definitions in the statement part and define in the root map if there is not yet a definition for
- * it.
- */
- public void addMissingRootEntitiesFrom(String statementPart) {
- Matcher m = ENTITY_DEFINITION.matcher(statementPart + " ");
- while (m.find()) {
- if (getRootAlias(m.group(1)) == null) {
- setRootAlias(m.group(1), nextAlias());
- }
- }
- }
-
- /**
- * Resolve and replace all entity definitions and references inthe statement part.
- * <p>
- * Example entity: <code>SELECT 1 FROM Person @Person@ where @Person@.personNr=@parent.Person@.personNr</code> -&gt;
- * <code>SELECT 1 FROM Person a002 where a002.personNr=a001.personNr</code>
- * <p>
- * Example attribute: <code>lastName</code> -&gt; <code>lastName</code>
- * <p>
- * Example attribute: <code>@Person@.lastName</code> -&gt; <code>a002.lastName</code>
- * <p>
- * Example attribute: <code>@parent.Person@.lastName</code> -&gt; <code>a002.lastName</code>
- * <p>
- * <b>Note that on attributes @parent.Person@ and @Person@ is the same and is both supported since an attribute is
- * attached to an entity. Therefore both declarations are equally "correct" and mean the same entitie's alias.
- */
- public String replaceMarkersByAliases(String statementPart, Map<String, String> aliasMap, Map<String, String> parentAliasMap) throws ProcessingException {
- String s = statementPart;
- Matcher m = ENTITY_NAME.matcher(s);
- while (m.find()) {
- boolean parent = m.group(1) != null && m.group(1).length() > 0;
- String name = cleanEntityName(m.group(2));
- String replacement = null;
- if (parent) {
- replacement = parentAliasMap.get(name);
- }
- else {
- replacement = aliasMap.get(name);
- }
- if (replacement == null) {
- throw new ProcessingException("missing alias '" + name + "' for entity '" + m.group() + "' in statement part: " + statementPart + "; map=" + aliasMap + " parentMap=" + parentAliasMap);
- }
- s = s.substring(0, m.start()) + replacement + s.substring(m.end());
- //next
- m = ENTITY_NAME.matcher(s);
- }
- return s;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc.builder;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+
+/**
+ * Alias management for form data statement builder
+ */
+public class AliasMapper {
+ private static final Pattern CLEAN_ENTITY_NAME = Pattern.compile("[@]?(parent\\.)?([a-zA-Z0-9_]+)[@]?");
+ private static final Pattern ENTITY_NAME = Pattern.compile("[@](parent\\.)?([a-zA-Z0-9_]+)[@]");
+
+ /**
+ * Pattern to recognize entity definitions.
+ * The pattern does not recognize an entity definition in case the
+ * string is terminated after the ending @. Thus when using the entity definition,
+ * append a space to the string before applying the pattern.
+ */
+ private static final Pattern ENTITY_DEFINITION = Pattern.compile("[@]([a-zA-Z0-9_]+)[@]([^.])");
+ private static final Pattern ENTITY_REFERENCE = Pattern.compile("[@](parent\\.)?([a-zA-Z0-9_]+)[@][.]");
+
+ private AtomicInteger m_sequenceProvider;
+ private final Map<String, String> m_rootAliases;
+ private final Map<Object, Map<String, String>> m_nodeAliases;
+
+ public AliasMapper() {
+ m_rootAliases = new HashMap<String, String>();
+ m_nodeAliases = new HashMap<Object, Map<String, String>>();
+ m_sequenceProvider = new AtomicInteger(0);
+ }
+
+ /**
+ * use another sequence provider (counts 0,1,2... for aliases)
+ */
+ public void setSequenceProvider(AtomicInteger sequenceProvider) {
+ m_sequenceProvider = sequenceProvider;
+ }
+
+ /**
+ * cleans an entity name
+ * <ul>
+ * <li>@PERSON@ =&gt; PERSON</li>
+ * <li>@person@ =&gt; PERSON</li>
+ * <li>@parent.PERSON@ =&gt; PERSON</li>
+ * <li>Person =&gt; PERSON</li>
+ * </ul>
+ */
+ public static String cleanEntityName(String e) {
+ if (e == null) {
+ return e;
+ }
+ Matcher m = CLEAN_ENTITY_NAME.matcher(e);
+ if (m.matches()) {
+ return m.group(2).toUpperCase();
+ }
+ else {
+ return e.toUpperCase();
+ }
+ }
+
+ /**
+ * generates next unique alias name such as p1, p2, p3 etc.
+ */
+ public String nextAlias() {
+ int seq = m_sequenceProvider.incrementAndGet();
+ return "a" + (("" + (10000 + seq)).substring(1));
+ }
+
+ /**
+ * @return the live map with the effective aliases per entity for example {PERSON = p, TASK = t}
+ * never returns null
+ */
+ public Map<String, String> getRootAliases() {
+ return m_rootAliases;
+ }
+
+ /**
+ * @param entityName
+ * with or without the @ delimiters (lenient), for example
+ * <ul>
+ * <li>PERSON</li>
+ * <li>TASK</li>
+ * <li>@PERSON@</li>
+ * <li>@TASK@</li>
+ * </ul>
+ * @return the alias for an entity, for example p, t etc.
+ */
+ public String getRootAlias(String entityName) {
+ return m_rootAliases.get(cleanEntityName(entityName));
+ }
+
+ /**
+ * @param entityName
+ * with or without the @ delimiters (lenient), for example
+ * <ul>
+ * <li>PERSON</li>
+ * <li>TASK</li>
+ * <li>@PERSON@</li>
+ * <li>@TASK@</li>
+ * </ul>
+ * @param alias
+ * for example p, t etc.
+ * @return the alias for the root entity
+ */
+ public void setRootAlias(String entityName, String alias) {
+ m_rootAliases.put(cleanEntityName(entityName), alias);
+ }
+
+ /**
+ * @return the live map with the effective aliases per entity for example {PERSON = p, TASK = t}
+ * never returns null
+ */
+ public Map<String, String> getNodeAliases(Object node) {
+ Map<String, String> map = m_nodeAliases.get(node);
+ if (map == null) {
+ map = new HashMap<String, String>();
+ m_nodeAliases.put(node, map);
+ }
+ return map;
+ }
+
+ /**
+ * @param entityName
+ * with or without the @ delimiters (lenient), for example
+ * <ul>
+ * <li>PERSON</li>
+ * <li>TASK</li>
+ * <li>@PERSON@</li>
+ * <li>@TASK@</li>
+ * </ul>
+ * @return the alias for an entity, for example p, t etc.
+ */
+ public String getNodeAlias(Object node, String entityName) {
+ Map<String, String> map = m_nodeAliases.get(node);
+ if (map != null) {
+ return map.get(cleanEntityName(entityName));
+ }
+ else {
+ return null;
+ }
+ }
+
+ /**
+ * @param entityName
+ * with or without the @ delimiters (lenient), for example
+ * <ul>
+ * <li>PERSON</li>
+ * <li>TASK</li>
+ * <li>@PERSON@</li>
+ * <li>@TASK@</li>
+ * </ul>
+ * @param alias
+ * for example p, t etc.
+ * @return the alias for the node entity
+ */
+ public void setNodeAlias(Object node, String entityName, String alias) {
+ Map<String, String> map = m_nodeAliases.get(node);
+ if (map == null) {
+ map = new HashMap<String, String>();
+ m_nodeAliases.put(node, map);
+ }
+ map.put(cleanEntityName(entityName), alias);
+ }
+
+ /**
+ * Parse all entity definitions in the statement part and define a new (local) alias that is associate with the node.
+ */
+ public void addAllNodeEntitiesFrom(Object node, String statementPart) {
+ Matcher m = ENTITY_DEFINITION.matcher(statementPart + " ");
+ while (m.find()) {
+ setNodeAlias(node, m.group(1), nextAlias());
+ }
+ }
+
+ public void addMissingNodeEntitiesFrom(Object node, String statementPart) {
+ Matcher m = ENTITY_DEFINITION.matcher(statementPart + " ");
+ while (m.find()) {
+ if (getNodeAlias(node, m.group(1)) == null) {
+ setNodeAlias(node, m.group(1), nextAlias());
+ }
+ }
+ }
+
+ /**
+ * Parse all entity definitions in the statement part and define in the root map if there is not yet a definition for
+ * it.
+ */
+ public void addMissingRootEntitiesFrom(String statementPart) {
+ Matcher m = ENTITY_DEFINITION.matcher(statementPart + " ");
+ while (m.find()) {
+ if (getRootAlias(m.group(1)) == null) {
+ setRootAlias(m.group(1), nextAlias());
+ }
+ }
+ }
+
+ /**
+ * Resolve and replace all entity definitions and references inthe statement part.
+ * <p>
+ * Example entity: <code>SELECT 1 FROM Person @Person@ where @Person@.personNr=@parent.Person@.personNr</code> -&gt;
+ * <code>SELECT 1 FROM Person a002 where a002.personNr=a001.personNr</code>
+ * <p>
+ * Example attribute: <code>lastName</code> -&gt; <code>lastName</code>
+ * <p>
+ * Example attribute: <code>@Person@.lastName</code> -&gt; <code>a002.lastName</code>
+ * <p>
+ * Example attribute: <code>@parent.Person@.lastName</code> -&gt; <code>a002.lastName</code>
+ * <p>
+ * <b>Note that on attributes @parent.Person@ and @Person@ is the same and is both supported since an attribute is
+ * attached to an entity. Therefore both declarations are equally "correct" and mean the same entitie's alias.
+ */
+ public String replaceMarkersByAliases(String statementPart, Map<String, String> aliasMap, Map<String, String> parentAliasMap) throws ProcessingException {
+ String s = statementPart;
+ Matcher m = ENTITY_NAME.matcher(s);
+ while (m.find()) {
+ boolean parent = m.group(1) != null && m.group(1).length() > 0;
+ String name = cleanEntityName(m.group(2));
+ String replacement = null;
+ if (parent) {
+ replacement = parentAliasMap.get(name);
+ }
+ else {
+ replacement = aliasMap.get(name);
+ }
+ if (replacement == null) {
+ throw new ProcessingException("missing alias '" + name + "' for entity '" + m.group() + "' in statement part: " + statementPart + "; map=" + aliasMap + " parentMap=" + parentAliasMap);
+ }
+ s = s.substring(0, m.start()) + replacement + s.substring(m.end());
+ //next
+ m = ENTITY_NAME.matcher(s);
+ }
+ return s;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/BasicPartDefinition.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/BasicPartDefinition.java
index 36f17ae5d3..4af515389b 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/BasicPartDefinition.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/BasicPartDefinition.java
@@ -1,281 +1,281 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc.builder;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.scout.commons.ClassIdentifier;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.shared.data.form.AbstractFormData;
-import org.eclipse.scout.rt.shared.data.form.fields.AbstractFormFieldData;
-import org.eclipse.scout.rt.shared.data.form.fields.AbstractValueFieldData;
-import org.eclipse.scout.rt.shared.data.form.properties.AbstractPropertyData;
-import org.eclipse.scout.rt.shared.data.model.DataModelConstants;
-
-/**
- * Definition of a properties-to-sql, fields-to-sql mapping for {@link AbstractPropertyData}s and
- * {@link AbstractFormFieldData}s
- * <p>
- * The part definition uses 1..n fields and properties of a form-data and constructs a statement contribution for the
- * query.
- * <p>
- * The {@link FormDataStatementBuilder} first calls {@link #accept(AbstractFormData, Map, Map)} to decide if this part
- * is used or not. Then it calls {@link #getValueTypeClassIdentifiers()} to collect the filled out values of the form
- * data, to finally call {@link #createInstance(FormDataStatementBuilder, List, List, List, Map)} to retrieve the
- * statement contribution. In its simplest form, the result is just a whereClause.
- */
-public class BasicPartDefinition implements DataModelConstants {
- private final ClassIdentifier[] m_valueTypeClassIdentifiers;
- private final String m_sqlAttribute;
- private final int m_operation;
- private final boolean m_plainBind;
-
- /**
- * @param valueType
- * {@link AbstractPropertyData} or {@link AbstractFormFieldData}
- * @param sqlAttribute
- * contains bind names :a, :b, :c for the values of the values correcpsonding to valueTypes
- * <p>
- * If different bind names are used,
- * {@link #createNewInstance(FormDataStatementBuilder, List, List, List, Map)} shoult be overridden
- * @param operator
- * any of the {@link DataModelConstants#OPERATOR_*} values
- */
- public BasicPartDefinition(Class<?> valueType, String sqlAttribute, int operator) {
- this(new Class[]{valueType}, sqlAttribute, operator, false);
- }
-
- /**
- * @param fieldTypeClassIdentifier
- * @param sqlAttribute
- * @param operator
- */
- public BasicPartDefinition(ClassIdentifier fieldTypeClassIdentifier, String sqlAttribute, int operator) {
- this(new ClassIdentifier[]{fieldTypeClassIdentifier}, sqlAttribute, operator, false);
- }
-
- /**
- * see {@link #ValuePartDefinition(Class, String, int)}
- */
- public BasicPartDefinition(Class<?> valueType, String sqlAttribute) {
- this(new Class[]{valueType}, sqlAttribute, DataModelConstants.OPERATOR_NONE, false);
- }
-
- /**
- * see {@link #ValuePartDefinition(Class, String, int)}
- */
- public BasicPartDefinition(Class<?>[] valueTypes, String sqlAttribute) {
- this(valueTypes, sqlAttribute, DataModelConstants.OPERATOR_NONE, false);
- }
-
- /**
- * see {@link #ValuePartDefinition(Class, String, int)}
- */
- public BasicPartDefinition(Class<?> valueType, String sqlAttribute, int operator, boolean plainBind) {
- this(new Class[]{valueType}, sqlAttribute, operator, plainBind);
- }
-
- /**
- * see {@link #ValuePartDefinition(Class, String, int)}
- */
- public BasicPartDefinition(ClassIdentifier valueTypeIdentifier, String sqlAttribute, int operator, boolean plainBind) {
- this(new ClassIdentifier[]{valueTypeIdentifier}, sqlAttribute, operator, plainBind);
- }
-
- /**
- * see {@link #ValuePartDefinition(Class, String, int)}
- */
- public BasicPartDefinition(Class<?>[] valueTypes, String sqlAttribute, int operator) {
- this(valueTypes, sqlAttribute, operator, false);
- }
-
- /**
- * see {@link #ValuePartDefinition(Class, String, int)}
- */
- public BasicPartDefinition(Class<?>[] valueTypes, String sqlAttribute, int operator, boolean plainBind) {
- this(ClassIdentifier.convertClassArrayToClassIdentifierArray(valueTypes), sqlAttribute, operator, plainBind);
- }
-
- /**
- * see {@link #ValuePartDefinition(Class, String, int)}
- */
- public BasicPartDefinition(ClassIdentifier[] valueTypeClassIdentifiers, String sqlAttribute, int operator, boolean plainBind) {
- m_valueTypeClassIdentifiers = valueTypeClassIdentifiers != null ? valueTypeClassIdentifiers : new ClassIdentifier[0];
- m_sqlAttribute = sqlAttribute;
- m_operation = operator;
- m_plainBind = plainBind;
- //check types
- for (ClassIdentifier classIdentifier : m_valueTypeClassIdentifiers) {
- Class<?> c = classIdentifier.getLastSegment();
- if (AbstractPropertyData.class.isAssignableFrom(c)) {
- //ok
- }
- else if (AbstractFormFieldData.class.isAssignableFrom(c)) {
- //ok
- }
- else {
- throw new IllegalArgumentException("" + c + " is not of type AbstractPropertyData or AbstractFormFieldData");
- }
- for (int i = 0; i < classIdentifier.getClasses().length - 1; i++) {
- Class<?> containerClass = classIdentifier.getClasses()[i];
- if (AbstractFormFieldData.class.isAssignableFrom(containerClass)) {
- // ok
- }
- else {
- throw new IllegalArgumentException("" + containerClass + " is not of type AbstractFormFieldData (segment " + i + " in " + classIdentifier + ")");
- }
- }
- }
- }
-
- protected String getSqlAttribute() {
- return m_sqlAttribute;
- }
-
- protected int getOperation() {
- return m_operation;
- }
-
- /**
- * @return true for a plain bind (without jdbc ?) and false for jdbc ? binds.
- */
- protected boolean isPlainBind() {
- return m_plainBind;
- }
-
- /**
- * @return array of {@link AbstractValueData} class identifiers (fields, properties) that are accepted by this part
- * definition. This is used by {@link #accept(AbstractFormData, Map, Map)} and
- * {@link #createInstance(FormDataStatementBuilder, List, List, List, Map)}
- */
- protected ClassIdentifier[] getValueTypeClassIdentifiers() {
- return m_valueTypeClassIdentifiers;
- }
-
- /**
- * Computes whether this {@link BasicPartDefinition} takes part in building the filter criterion.
- *
- * @param formData
- * the form data to be checked.
- * @return <code>true</code> if the properties in the form data are sufficient in order to append this part to the
- * result statement This will result in a call to
- * {@link #createNewInstance(FormDataStatementBuilder, List, List, List, Map)} building that part.
- * <p>
- * Default accepts when any of the value of the valueType set is set (isValueSet) and has a non-null value in
- * the form data
- * @throws ProcessingException
- */
- public boolean accept(AbstractFormData formData) throws ProcessingException {
- Map<Integer, Map<String, AbstractFormFieldData>> fieldsBreathFirstMap = formData.getAllFieldsRec();
- Map<Integer, Map<String, AbstractPropertyData<?>>> propertiesBreathFirstMap = formData.getAllPropertiesRec();
- if (getValueTypeClassIdentifiers().length > 0) {
- for (ClassIdentifier valueType : getValueTypeClassIdentifiers()) {
- Object dataObject = formData.findFieldByClass(fieldsBreathFirstMap, valueType);
- if (dataObject instanceof AbstractFormFieldData) {
- AbstractValueFieldData<?> v = (dataObject instanceof AbstractValueFieldData<?> ? (AbstractValueFieldData<?>) dataObject : null);
- AbstractFormFieldData f = (AbstractFormFieldData) dataObject;
- if (f.isValueSet() && (v == null || v.getValue() != null)) {
- return true;
- }
- }
- dataObject = formData.findPropertyByClass(propertiesBreathFirstMap, valueType);
- if (dataObject instanceof AbstractPropertyData<?>) {
- AbstractPropertyData<?> p = (AbstractPropertyData<?>) dataObject;
- if (p.isValueSet() && p.getValue() != null) {
- return true;
- }
- }
- }
- }
- return false;
- }
-
- /**
- * Override this method to intercept and change part instance properties such as values, operation type, etc.<br>
- * Sometimes it is convenient to set the operation to {@link DataModelConstants#OPERATOR_NONE} which uses the
- * attribute
- * itself as the complete statement part.
- *
- * @param builder
- * @param formData
- * the form data to be checked.
- * @return the result EntityContribution. null if that part is to be ignored
- * <p>
- * normally calls
- * {@link FormDataStatementBuilder#createStatementPart(Integer, String, int, List, List, boolean, Map)}
- * <p>
- * Can make use of alias markers such as @Person@.LAST_NAME, these are resolved in the
- * {@link FormDataStatementBuilder}
- * <p>
- * Only additional bind values - other than the bindValues passed to createStatementPart - must be added using
- * {@link FormDataStatementBuilder#addBind(String, Object)}
- * @throws ProcessingException
- */
- public EntityContribution createInstance(FormDataStatementBuilder builder, AbstractFormData formData, Map<String, String> parentAliasMap) throws ProcessingException {
- Map<Integer, Map<String, AbstractFormFieldData>> fieldsBreathFirstMap = formData.getAllFieldsRec();
- Map<Integer, Map<String, AbstractPropertyData<?>>> propertiesBreathFirstMap = formData.getAllPropertiesRec();
- ClassIdentifier[] valueTypes = getValueTypeClassIdentifiers();
- /**
- * the form data objects containing the runtime values {@link AbstractFormFieldData} and
- * {@link AbstractPropertyData}
- */
- ArrayList<Object> valueDatas = new ArrayList<Object>(valueTypes.length);
- /**
- * by default the names "a", "b", "c", ... represent the bindValues in the same order as the
- * values
- */
- ArrayList<String> bindNames = new ArrayList<String>(valueTypes.length);
- /**
- * the values of the {@link AbstractFormFieldData}s and {@link AbstractPropertyData}s in the same order
- */
- ArrayList<Object> bindValues = new ArrayList<Object>(valueTypes.length);
- for (int i = 0; i < valueTypes.length; i++) {
- if (AbstractFormFieldData.class.isAssignableFrom(valueTypes[i].getLastSegment())) {
- AbstractFormFieldData field = formData.findFieldByClass(fieldsBreathFirstMap, valueTypes[i]);
- valueDatas.add(field);
- bindNames.add("" + (char) (('a') + i));
- if (field instanceof AbstractValueFieldData<?>) {
- bindValues.add(((AbstractValueFieldData<?>) field).getValue());
- }
- else {
- bindValues.add(null);
- }
- }
- else if (AbstractPropertyData.class.isAssignableFrom(valueTypes[i].getLastSegment())) {
- AbstractPropertyData<?> property = formData.findPropertyByClass(propertiesBreathFirstMap, valueTypes[i]);
- valueDatas.add(property);
- bindNames.add("" + (char) (('a') + i));
- bindValues.add(property.getValue());
- }
- else {
- valueDatas.add(null);
- bindNames.add("" + (char) (('a') + i));
- bindValues.add(null);
- }
- }
- //
- String wherePart = createInstanceImpl(builder, valueDatas, bindNames, bindValues, parentAliasMap);
- return EntityContribution.create(wherePart);
- }
-
- /**
- * This method is called when {@link #createInstance(FormDataStatementBuilder, AbstractFormData, Map)} is not
- * overridden and can be used to only override the core of create instance.
- * <p>
- * valueDatas, bindNames, bindValues are all pre-processed.
- */
- protected String createInstanceImpl(FormDataStatementBuilder builder, List<Object> valueDatas, List<String> bindNames, List<Object> bindValues, Map<String, String> parentAliasMap) throws ProcessingException {
- return builder.createSqlPart(DataModelConstants.AGGREGATION_NONE, getSqlAttribute(), getOperation(), bindNames, bindValues, isPlainBind(), parentAliasMap);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc.builder;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.scout.commons.ClassIdentifier;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.shared.data.form.AbstractFormData;
+import org.eclipse.scout.rt.shared.data.form.fields.AbstractFormFieldData;
+import org.eclipse.scout.rt.shared.data.form.fields.AbstractValueFieldData;
+import org.eclipse.scout.rt.shared.data.form.properties.AbstractPropertyData;
+import org.eclipse.scout.rt.shared.data.model.DataModelConstants;
+
+/**
+ * Definition of a properties-to-sql, fields-to-sql mapping for {@link AbstractPropertyData}s and
+ * {@link AbstractFormFieldData}s
+ * <p>
+ * The part definition uses 1..n fields and properties of a form-data and constructs a statement contribution for the
+ * query.
+ * <p>
+ * The {@link FormDataStatementBuilder} first calls {@link #accept(AbstractFormData, Map, Map)} to decide if this part
+ * is used or not. Then it calls {@link #getValueTypeClassIdentifiers()} to collect the filled out values of the form
+ * data, to finally call {@link #createInstance(FormDataStatementBuilder, List, List, List, Map)} to retrieve the
+ * statement contribution. In its simplest form, the result is just a whereClause.
+ */
+public class BasicPartDefinition implements DataModelConstants {
+ private final ClassIdentifier[] m_valueTypeClassIdentifiers;
+ private final String m_sqlAttribute;
+ private final int m_operation;
+ private final boolean m_plainBind;
+
+ /**
+ * @param valueType
+ * {@link AbstractPropertyData} or {@link AbstractFormFieldData}
+ * @param sqlAttribute
+ * contains bind names :a, :b, :c for the values of the values correcpsonding to valueTypes
+ * <p>
+ * If different bind names are used,
+ * {@link #createNewInstance(FormDataStatementBuilder, List, List, List, Map)} shoult be overridden
+ * @param operator
+ * any of the {@link DataModelConstants#OPERATOR_*} values
+ */
+ public BasicPartDefinition(Class<?> valueType, String sqlAttribute, int operator) {
+ this(new Class[]{valueType}, sqlAttribute, operator, false);
+ }
+
+ /**
+ * @param fieldTypeClassIdentifier
+ * @param sqlAttribute
+ * @param operator
+ */
+ public BasicPartDefinition(ClassIdentifier fieldTypeClassIdentifier, String sqlAttribute, int operator) {
+ this(new ClassIdentifier[]{fieldTypeClassIdentifier}, sqlAttribute, operator, false);
+ }
+
+ /**
+ * see {@link #ValuePartDefinition(Class, String, int)}
+ */
+ public BasicPartDefinition(Class<?> valueType, String sqlAttribute) {
+ this(new Class[]{valueType}, sqlAttribute, DataModelConstants.OPERATOR_NONE, false);
+ }
+
+ /**
+ * see {@link #ValuePartDefinition(Class, String, int)}
+ */
+ public BasicPartDefinition(Class<?>[] valueTypes, String sqlAttribute) {
+ this(valueTypes, sqlAttribute, DataModelConstants.OPERATOR_NONE, false);
+ }
+
+ /**
+ * see {@link #ValuePartDefinition(Class, String, int)}
+ */
+ public BasicPartDefinition(Class<?> valueType, String sqlAttribute, int operator, boolean plainBind) {
+ this(new Class[]{valueType}, sqlAttribute, operator, plainBind);
+ }
+
+ /**
+ * see {@link #ValuePartDefinition(Class, String, int)}
+ */
+ public BasicPartDefinition(ClassIdentifier valueTypeIdentifier, String sqlAttribute, int operator, boolean plainBind) {
+ this(new ClassIdentifier[]{valueTypeIdentifier}, sqlAttribute, operator, plainBind);
+ }
+
+ /**
+ * see {@link #ValuePartDefinition(Class, String, int)}
+ */
+ public BasicPartDefinition(Class<?>[] valueTypes, String sqlAttribute, int operator) {
+ this(valueTypes, sqlAttribute, operator, false);
+ }
+
+ /**
+ * see {@link #ValuePartDefinition(Class, String, int)}
+ */
+ public BasicPartDefinition(Class<?>[] valueTypes, String sqlAttribute, int operator, boolean plainBind) {
+ this(ClassIdentifier.convertClassArrayToClassIdentifierArray(valueTypes), sqlAttribute, operator, plainBind);
+ }
+
+ /**
+ * see {@link #ValuePartDefinition(Class, String, int)}
+ */
+ public BasicPartDefinition(ClassIdentifier[] valueTypeClassIdentifiers, String sqlAttribute, int operator, boolean plainBind) {
+ m_valueTypeClassIdentifiers = valueTypeClassIdentifiers != null ? valueTypeClassIdentifiers : new ClassIdentifier[0];
+ m_sqlAttribute = sqlAttribute;
+ m_operation = operator;
+ m_plainBind = plainBind;
+ //check types
+ for (ClassIdentifier classIdentifier : m_valueTypeClassIdentifiers) {
+ Class<?> c = classIdentifier.getLastSegment();
+ if (AbstractPropertyData.class.isAssignableFrom(c)) {
+ //ok
+ }
+ else if (AbstractFormFieldData.class.isAssignableFrom(c)) {
+ //ok
+ }
+ else {
+ throw new IllegalArgumentException("" + c + " is not of type AbstractPropertyData or AbstractFormFieldData");
+ }
+ for (int i = 0; i < classIdentifier.getClasses().length - 1; i++) {
+ Class<?> containerClass = classIdentifier.getClasses()[i];
+ if (AbstractFormFieldData.class.isAssignableFrom(containerClass)) {
+ // ok
+ }
+ else {
+ throw new IllegalArgumentException("" + containerClass + " is not of type AbstractFormFieldData (segment " + i + " in " + classIdentifier + ")");
+ }
+ }
+ }
+ }
+
+ protected String getSqlAttribute() {
+ return m_sqlAttribute;
+ }
+
+ protected int getOperation() {
+ return m_operation;
+ }
+
+ /**
+ * @return true for a plain bind (without jdbc ?) and false for jdbc ? binds.
+ */
+ protected boolean isPlainBind() {
+ return m_plainBind;
+ }
+
+ /**
+ * @return array of {@link AbstractValueData} class identifiers (fields, properties) that are accepted by this part
+ * definition. This is used by {@link #accept(AbstractFormData, Map, Map)} and
+ * {@link #createInstance(FormDataStatementBuilder, List, List, List, Map)}
+ */
+ protected ClassIdentifier[] getValueTypeClassIdentifiers() {
+ return m_valueTypeClassIdentifiers;
+ }
+
+ /**
+ * Computes whether this {@link BasicPartDefinition} takes part in building the filter criterion.
+ *
+ * @param formData
+ * the form data to be checked.
+ * @return <code>true</code> if the properties in the form data are sufficient in order to append this part to the
+ * result statement This will result in a call to
+ * {@link #createNewInstance(FormDataStatementBuilder, List, List, List, Map)} building that part.
+ * <p>
+ * Default accepts when any of the value of the valueType set is set (isValueSet) and has a non-null value in
+ * the form data
+ * @throws ProcessingException
+ */
+ public boolean accept(AbstractFormData formData) throws ProcessingException {
+ Map<Integer, Map<String, AbstractFormFieldData>> fieldsBreathFirstMap = formData.getAllFieldsRec();
+ Map<Integer, Map<String, AbstractPropertyData<?>>> propertiesBreathFirstMap = formData.getAllPropertiesRec();
+ if (getValueTypeClassIdentifiers().length > 0) {
+ for (ClassIdentifier valueType : getValueTypeClassIdentifiers()) {
+ Object dataObject = formData.findFieldByClass(fieldsBreathFirstMap, valueType);
+ if (dataObject instanceof AbstractFormFieldData) {
+ AbstractValueFieldData<?> v = (dataObject instanceof AbstractValueFieldData<?> ? (AbstractValueFieldData<?>) dataObject : null);
+ AbstractFormFieldData f = (AbstractFormFieldData) dataObject;
+ if (f.isValueSet() && (v == null || v.getValue() != null)) {
+ return true;
+ }
+ }
+ dataObject = formData.findPropertyByClass(propertiesBreathFirstMap, valueType);
+ if (dataObject instanceof AbstractPropertyData<?>) {
+ AbstractPropertyData<?> p = (AbstractPropertyData<?>) dataObject;
+ if (p.isValueSet() && p.getValue() != null) {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Override this method to intercept and change part instance properties such as values, operation type, etc.<br>
+ * Sometimes it is convenient to set the operation to {@link DataModelConstants#OPERATOR_NONE} which uses the
+ * attribute
+ * itself as the complete statement part.
+ *
+ * @param builder
+ * @param formData
+ * the form data to be checked.
+ * @return the result EntityContribution. null if that part is to be ignored
+ * <p>
+ * normally calls
+ * {@link FormDataStatementBuilder#createStatementPart(Integer, String, int, List, List, boolean, Map)}
+ * <p>
+ * Can make use of alias markers such as @Person@.LAST_NAME, these are resolved in the
+ * {@link FormDataStatementBuilder}
+ * <p>
+ * Only additional bind values - other than the bindValues passed to createStatementPart - must be added using
+ * {@link FormDataStatementBuilder#addBind(String, Object)}
+ * @throws ProcessingException
+ */
+ public EntityContribution createInstance(FormDataStatementBuilder builder, AbstractFormData formData, Map<String, String> parentAliasMap) throws ProcessingException {
+ Map<Integer, Map<String, AbstractFormFieldData>> fieldsBreathFirstMap = formData.getAllFieldsRec();
+ Map<Integer, Map<String, AbstractPropertyData<?>>> propertiesBreathFirstMap = formData.getAllPropertiesRec();
+ ClassIdentifier[] valueTypes = getValueTypeClassIdentifiers();
+ /**
+ * the form data objects containing the runtime values {@link AbstractFormFieldData} and
+ * {@link AbstractPropertyData}
+ */
+ ArrayList<Object> valueDatas = new ArrayList<Object>(valueTypes.length);
+ /**
+ * by default the names "a", "b", "c", ... represent the bindValues in the same order as the
+ * values
+ */
+ ArrayList<String> bindNames = new ArrayList<String>(valueTypes.length);
+ /**
+ * the values of the {@link AbstractFormFieldData}s and {@link AbstractPropertyData}s in the same order
+ */
+ ArrayList<Object> bindValues = new ArrayList<Object>(valueTypes.length);
+ for (int i = 0; i < valueTypes.length; i++) {
+ if (AbstractFormFieldData.class.isAssignableFrom(valueTypes[i].getLastSegment())) {
+ AbstractFormFieldData field = formData.findFieldByClass(fieldsBreathFirstMap, valueTypes[i]);
+ valueDatas.add(field);
+ bindNames.add("" + (char) (('a') + i));
+ if (field instanceof AbstractValueFieldData<?>) {
+ bindValues.add(((AbstractValueFieldData<?>) field).getValue());
+ }
+ else {
+ bindValues.add(null);
+ }
+ }
+ else if (AbstractPropertyData.class.isAssignableFrom(valueTypes[i].getLastSegment())) {
+ AbstractPropertyData<?> property = formData.findPropertyByClass(propertiesBreathFirstMap, valueTypes[i]);
+ valueDatas.add(property);
+ bindNames.add("" + (char) (('a') + i));
+ bindValues.add(property.getValue());
+ }
+ else {
+ valueDatas.add(null);
+ bindNames.add("" + (char) (('a') + i));
+ bindValues.add(null);
+ }
+ }
+ //
+ String wherePart = createInstanceImpl(builder, valueDatas, bindNames, bindValues, parentAliasMap);
+ return EntityContribution.create(wherePart);
+ }
+
+ /**
+ * This method is called when {@link #createInstance(FormDataStatementBuilder, AbstractFormData, Map)} is not
+ * overridden and can be used to only override the core of create instance.
+ * <p>
+ * valueDatas, bindNames, bindValues are all pre-processed.
+ */
+ protected String createInstanceImpl(FormDataStatementBuilder builder, List<Object> valueDatas, List<String> bindNames, List<Object> bindValues, Map<String, String> parentAliasMap) throws ProcessingException {
+ return builder.createSqlPart(DataModelConstants.AGGREGATION_NONE, getSqlAttribute(), getOperation(), bindNames, bindValues, isPlainBind(), parentAliasMap);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/ComposerAttributePartDefinition.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/ComposerAttributePartDefinition.java
index 869ebbafd3..8c0a071465 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/ComposerAttributePartDefinition.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/ComposerAttributePartDefinition.java
@@ -1,46 +1,46 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc.builder;
-
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.server.services.common.jdbc.builder.FormDataStatementBuilder.AttributeStrategy;
-import org.eclipse.scout.rt.shared.data.form.fields.composer.ComposerAttributeNodeData;
-import org.eclipse.scout.rt.shared.data.model.IDataModelAttribute;
-
-/**
- * @deprecated use {@link DataModelAttributePartDefinition}
- */
-@Deprecated
-public class ComposerAttributePartDefinition extends DataModelAttributePartDefinition {
-
- public ComposerAttributePartDefinition(Class<? extends IDataModelAttribute> attributeType, String whereClause, boolean plainBind) {
- super(attributeType, whereClause, plainBind);
- }
-
- public ComposerAttributePartDefinition(Class<? extends IDataModelAttribute> attributeType, String whereClause, String selectClause, boolean plainBind) {
- super(attributeType, whereClause, selectClause, plainBind);
- }
-
- public String createNewInstance(FormDataStatementBuilder builder, ComposerAttributeNodeData attributeNodeData, List<String> bindNames, List<Object> bindValues, Map<String, String> parentAliasMap) throws ProcessingException {
- return builder.createAttributePartSimple(AttributeStrategy.BuildConstraintOfAttributeWithContext, attributeNodeData.getAggregationType(), getWhereClause(), attributeNodeData.getOperator(), bindNames, bindValues, this.isPlainBind(), parentAliasMap);
- }
-
- /**
- * @deprecated use {@link #getWhereClause() }
- */
- @Deprecated
- public String getSqlAttribute() {
- return super.getWhereClause();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc.builder;
+
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.server.services.common.jdbc.builder.FormDataStatementBuilder.AttributeStrategy;
+import org.eclipse.scout.rt.shared.data.form.fields.composer.ComposerAttributeNodeData;
+import org.eclipse.scout.rt.shared.data.model.IDataModelAttribute;
+
+/**
+ * @deprecated use {@link DataModelAttributePartDefinition}
+ */
+@Deprecated
+public class ComposerAttributePartDefinition extends DataModelAttributePartDefinition {
+
+ public ComposerAttributePartDefinition(Class<? extends IDataModelAttribute> attributeType, String whereClause, boolean plainBind) {
+ super(attributeType, whereClause, plainBind);
+ }
+
+ public ComposerAttributePartDefinition(Class<? extends IDataModelAttribute> attributeType, String whereClause, String selectClause, boolean plainBind) {
+ super(attributeType, whereClause, selectClause, plainBind);
+ }
+
+ public String createNewInstance(FormDataStatementBuilder builder, ComposerAttributeNodeData attributeNodeData, List<String> bindNames, List<Object> bindValues, Map<String, String> parentAliasMap) throws ProcessingException {
+ return builder.createAttributePartSimple(AttributeStrategy.BuildConstraintOfAttributeWithContext, attributeNodeData.getAggregationType(), getWhereClause(), attributeNodeData.getOperator(), bindNames, bindValues, this.isPlainBind(), parentAliasMap);
+ }
+
+ /**
+ * @deprecated use {@link #getWhereClause() }
+ */
+ @Deprecated
+ public String getSqlAttribute() {
+ return super.getWhereClause();
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/ComposerEntityPartDefinition.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/ComposerEntityPartDefinition.java
index da0b8af821..4a8dafcd8e 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/ComposerEntityPartDefinition.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/ComposerEntityPartDefinition.java
@@ -1,37 +1,37 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc.builder;
-
-import java.util.Map;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.shared.data.form.fields.composer.ComposerEntityNodeData;
-import org.eclipse.scout.rt.shared.data.model.IDataModelEntity;
-
-/**
- * @deprecated use {@link DataModelEntityPartDefinition}
- */
-@Deprecated
-public class ComposerEntityPartDefinition extends DataModelEntityPartDefinition {
-
- public ComposerEntityPartDefinition(Class<? extends IDataModelEntity> entityType, String whereClause) {
- super(entityType, whereClause);
- }
-
- public ComposerEntityPartDefinition(Class<? extends IDataModelEntity> entityType, String whereClause, String selectClause) {
- super(entityType, whereClause, selectClause);
- }
-
- public String createNewInstance(FormDataStatementBuilder builder, ComposerEntityNodeData entityNodeData, Map<String, String> parentAliasMap) throws ProcessingException {
- return getWhereClause();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc.builder;
+
+import java.util.Map;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.shared.data.form.fields.composer.ComposerEntityNodeData;
+import org.eclipse.scout.rt.shared.data.model.IDataModelEntity;
+
+/**
+ * @deprecated use {@link DataModelEntityPartDefinition}
+ */
+@Deprecated
+public class ComposerEntityPartDefinition extends DataModelEntityPartDefinition {
+
+ public ComposerEntityPartDefinition(Class<? extends IDataModelEntity> entityType, String whereClause) {
+ super(entityType, whereClause);
+ }
+
+ public ComposerEntityPartDefinition(Class<? extends IDataModelEntity> entityType, String whereClause, String selectClause) {
+ super(entityType, whereClause, selectClause);
+ }
+
+ public String createNewInstance(FormDataStatementBuilder builder, ComposerEntityNodeData entityNodeData, Map<String, String> parentAliasMap) throws ProcessingException {
+ return getWhereClause();
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/DataModelAttributePartDefinition.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/DataModelAttributePartDefinition.java
index 612e79d221..49e1cdfbc7 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/DataModelAttributePartDefinition.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/DataModelAttributePartDefinition.java
@@ -1,160 +1,160 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc.builder;
-
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.server.services.common.jdbc.builder.FormDataStatementBuilder.AttributeStrategy;
-import org.eclipse.scout.rt.shared.data.form.fields.AbstractValueFieldData;
-import org.eclipse.scout.rt.shared.data.form.fields.composer.ComposerAttributeNodeData;
-import org.eclipse.scout.rt.shared.data.model.DataModelConstants;
-import org.eclipse.scout.rt.shared.data.model.IDataModelAttribute;
-
-/**
- * Definition of a attribute-to-sql mapping for {@link IDataModelAttribute}
- */
-public class DataModelAttributePartDefinition implements DataModelConstants {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(DataModelAttributePartDefinition.class);
-
- private final String m_whereClause;
- private final String m_selectClause;
- private final boolean m_plainBind;
- private final Class<? extends IDataModelAttribute> m_attributeType;
-
- /**
- * see {@link #DataModelAttributePartDefinition(Class, String, String, boolean)}
- */
- public DataModelAttributePartDefinition(Class<? extends IDataModelAttribute> attributeType, String whereClause, boolean plainBind) {
- this(attributeType, whereClause, autoCreateSelectClause(whereClause), plainBind);
- }
-
- /**
- * @param whereClause
- * is normally something like @Person@.LAST_NAME
- * <p>
- * Maximum extent is using tags like
- *
- * <pre>
- * &lt;attribute&gt;@Person@.LAST_NAME&lt;/attribute&gt;
- * &lt;fromPart&gt;MY_PERSON @Person@&lt;/fromPart&gt;
- * &lt;wherePart&gt;@Person@.PERSON_ID=...&lt;/wherePart&gt;
- * &lt;havingPart&gt;...&lt;/havingPart&gt;
- * </pre>
- *
- * That way the wherePart is added to the entities whereParts section and never to the havingParts section,
- * which would be wrong.
- * @param selectClause
- * is by default the same as the where clause, but sometimes it is necessary to have a different select
- * clause than the where clause.
- */
- public DataModelAttributePartDefinition(Class<? extends IDataModelAttribute> attributeType, String whereClause, String selectClause, boolean plainBind) {
- m_attributeType = attributeType;
- m_whereClause = whereClause;
- m_selectClause = selectClause;
- m_plainBind = plainBind;
- check();
- }
-
- private static String autoCreateSelectClause(String whereClause) {
- if (whereClause == null) {
- return null;
- }
- String tmp = whereClause;
- tmp = StringUtility.removeTag(tmp, "fromPart");
- tmp = StringUtility.removeTag(tmp, "wherePart");
- tmp = StringUtility.removeTag(tmp, "havingPart");
- if (tmp.trim().length() == 0) {
- return null;
- }
- if ((" " + tmp).matches(".*[^a-zA-Z_$]SELECT[^a-zA-Z_$].*")) {
- return null;
- }
- return whereClause;
- }
-
- /**
- * Override to do customized checks on select and where clause or to deactivate default checks.
- * <p>
- * Called by the constructor after calling {@link #autoCreateSelectClause(String)} and setting its member fields
- * <p>
- * Default does 99%-safe check of correct usage of wherePart on non-trivial attributes.
- */
- protected void check() {
- if (m_whereClause != null) {
- String low = m_whereClause.toLowerCase().replaceAll("\\s", " ");
- if (low.indexOf("<attribute") >= 0 && low.indexOf("<wherepart") < 0 && low.indexOf(" and ") >= 0) {
- LOG.info(m_attributeType.getName() + " is a non-trivial attribute and should have the form <wherePart>... AND ...</wherePart> <attribute>...</attribute>: " + m_whereClause);
- }
- }
- }
-
- public String getWhereClause() {
- return m_whereClause;
- }
-
- public String getSelectClause() {
- return m_selectClause;
- }
-
- public Class<? extends IDataModelAttribute> getAttributeType() {
- return m_attributeType;
- }
-
- /**
- * @return true for a plain bind (without jdbc ?) and false for jdbc ? binds.
- */
- public boolean isPlainBind() {
- return m_plainBind;
- }
-
- /**
- * Override this method to intercept and change part instance properties such as values, operation type, etc.<br>
- * Sometimes it is convenient to set the operation to {@link DataModelConstants#OPERATOR_NONE} which uses the
- * attribute
- * itself as the complete statement part.
- *
- * @param builder
- * containging all binds and sql parts
- * @param attributeNodeData
- * the form data object containing the runtime value {@link ComposerAttributeNodeData}
- * @param stm
- * is either {@link #getSelectClause()} or {@link #getWhereClause()} depending on the strategy
- * @param bindNames
- * by default the names "a", "b", "c", ... representing then field bindValues in the same order as the fields
- * @param bindValues
- * the values of the {@link AbstractValueFieldData}s
- * @param parentAliasMap
- * the map of meta-alias to alias for this entity, for example @Person@ -> p1
- * @param strategy
- * is one of the {@link AttributeStrategy} enums and decides whether {@link #getSelectClause()} or
- * {@link #getWhereClause()} is used
- * @return the result; empty {@link EntityContribution} if that part is to be ignored
- * <p>
- * default calls
- * {@link FormDataStatementBuilder2#createAttributePart(AttributeStrategy, Integer, String, int, List, List, boolean, Map)}
- * <p>
- * Can make use of alias markers such as @Person@.LAST_NAME, these are resolved in the
- * {@link FormDataStatementBuilder2}
- * <p>
- * Additional bind values - other than the parameter bindNames/bindValues - must be added using
- * {@link FormDataStatementBuilder2#addBind(String, Object)}
- * @throws ProcessingException
- */
- public EntityContribution createInstance(FormDataStatementBuilder builder, ComposerAttributeNodeData attributeNodeData, AttributeStrategy strategy, String stm, List<String> bindNames, List<Object> bindValues, Map<String, String> parentAliasMap) throws ProcessingException {
- return builder.createAttributePart(strategy, attributeNodeData.getAggregationType(), stm, attributeNodeData.getOperator(), bindNames, bindValues, this.isPlainBind(), parentAliasMap);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc.builder;
+
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.server.services.common.jdbc.builder.FormDataStatementBuilder.AttributeStrategy;
+import org.eclipse.scout.rt.shared.data.form.fields.AbstractValueFieldData;
+import org.eclipse.scout.rt.shared.data.form.fields.composer.ComposerAttributeNodeData;
+import org.eclipse.scout.rt.shared.data.model.DataModelConstants;
+import org.eclipse.scout.rt.shared.data.model.IDataModelAttribute;
+
+/**
+ * Definition of a attribute-to-sql mapping for {@link IDataModelAttribute}
+ */
+public class DataModelAttributePartDefinition implements DataModelConstants {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(DataModelAttributePartDefinition.class);
+
+ private final String m_whereClause;
+ private final String m_selectClause;
+ private final boolean m_plainBind;
+ private final Class<? extends IDataModelAttribute> m_attributeType;
+
+ /**
+ * see {@link #DataModelAttributePartDefinition(Class, String, String, boolean)}
+ */
+ public DataModelAttributePartDefinition(Class<? extends IDataModelAttribute> attributeType, String whereClause, boolean plainBind) {
+ this(attributeType, whereClause, autoCreateSelectClause(whereClause), plainBind);
+ }
+
+ /**
+ * @param whereClause
+ * is normally something like @Person@.LAST_NAME
+ * <p>
+ * Maximum extent is using tags like
+ *
+ * <pre>
+ * &lt;attribute&gt;@Person@.LAST_NAME&lt;/attribute&gt;
+ * &lt;fromPart&gt;MY_PERSON @Person@&lt;/fromPart&gt;
+ * &lt;wherePart&gt;@Person@.PERSON_ID=...&lt;/wherePart&gt;
+ * &lt;havingPart&gt;...&lt;/havingPart&gt;
+ * </pre>
+ *
+ * That way the wherePart is added to the entities whereParts section and never to the havingParts section,
+ * which would be wrong.
+ * @param selectClause
+ * is by default the same as the where clause, but sometimes it is necessary to have a different select
+ * clause than the where clause.
+ */
+ public DataModelAttributePartDefinition(Class<? extends IDataModelAttribute> attributeType, String whereClause, String selectClause, boolean plainBind) {
+ m_attributeType = attributeType;
+ m_whereClause = whereClause;
+ m_selectClause = selectClause;
+ m_plainBind = plainBind;
+ check();
+ }
+
+ private static String autoCreateSelectClause(String whereClause) {
+ if (whereClause == null) {
+ return null;
+ }
+ String tmp = whereClause;
+ tmp = StringUtility.removeTag(tmp, "fromPart");
+ tmp = StringUtility.removeTag(tmp, "wherePart");
+ tmp = StringUtility.removeTag(tmp, "havingPart");
+ if (tmp.trim().length() == 0) {
+ return null;
+ }
+ if ((" " + tmp).matches(".*[^a-zA-Z_$]SELECT[^a-zA-Z_$].*")) {
+ return null;
+ }
+ return whereClause;
+ }
+
+ /**
+ * Override to do customized checks on select and where clause or to deactivate default checks.
+ * <p>
+ * Called by the constructor after calling {@link #autoCreateSelectClause(String)} and setting its member fields
+ * <p>
+ * Default does 99%-safe check of correct usage of wherePart on non-trivial attributes.
+ */
+ protected void check() {
+ if (m_whereClause != null) {
+ String low = m_whereClause.toLowerCase().replaceAll("\\s", " ");
+ if (low.indexOf("<attribute") >= 0 && low.indexOf("<wherepart") < 0 && low.indexOf(" and ") >= 0) {
+ LOG.info(m_attributeType.getName() + " is a non-trivial attribute and should have the form <wherePart>... AND ...</wherePart> <attribute>...</attribute>: " + m_whereClause);
+ }
+ }
+ }
+
+ public String getWhereClause() {
+ return m_whereClause;
+ }
+
+ public String getSelectClause() {
+ return m_selectClause;
+ }
+
+ public Class<? extends IDataModelAttribute> getAttributeType() {
+ return m_attributeType;
+ }
+
+ /**
+ * @return true for a plain bind (without jdbc ?) and false for jdbc ? binds.
+ */
+ public boolean isPlainBind() {
+ return m_plainBind;
+ }
+
+ /**
+ * Override this method to intercept and change part instance properties such as values, operation type, etc.<br>
+ * Sometimes it is convenient to set the operation to {@link DataModelConstants#OPERATOR_NONE} which uses the
+ * attribute
+ * itself as the complete statement part.
+ *
+ * @param builder
+ * containging all binds and sql parts
+ * @param attributeNodeData
+ * the form data object containing the runtime value {@link ComposerAttributeNodeData}
+ * @param stm
+ * is either {@link #getSelectClause()} or {@link #getWhereClause()} depending on the strategy
+ * @param bindNames
+ * by default the names "a", "b", "c", ... representing then field bindValues in the same order as the fields
+ * @param bindValues
+ * the values of the {@link AbstractValueFieldData}s
+ * @param parentAliasMap
+ * the map of meta-alias to alias for this entity, for example @Person@ -> p1
+ * @param strategy
+ * is one of the {@link AttributeStrategy} enums and decides whether {@link #getSelectClause()} or
+ * {@link #getWhereClause()} is used
+ * @return the result; empty {@link EntityContribution} if that part is to be ignored
+ * <p>
+ * default calls
+ * {@link FormDataStatementBuilder2#createAttributePart(AttributeStrategy, Integer, String, int, List, List, boolean, Map)}
+ * <p>
+ * Can make use of alias markers such as @Person@.LAST_NAME, these are resolved in the
+ * {@link FormDataStatementBuilder2}
+ * <p>
+ * Additional bind values - other than the parameter bindNames/bindValues - must be added using
+ * {@link FormDataStatementBuilder2#addBind(String, Object)}
+ * @throws ProcessingException
+ */
+ public EntityContribution createInstance(FormDataStatementBuilder builder, ComposerAttributeNodeData attributeNodeData, AttributeStrategy strategy, String stm, List<String> bindNames, List<Object> bindValues, Map<String, String> parentAliasMap) throws ProcessingException {
+ return builder.createAttributePart(strategy, attributeNodeData.getAggregationType(), stm, attributeNodeData.getOperator(), bindNames, bindValues, this.isPlainBind(), parentAliasMap);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/DataModelEntityPartDefinition.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/DataModelEntityPartDefinition.java
index 00733659da..82aadc295f 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/DataModelEntityPartDefinition.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/DataModelEntityPartDefinition.java
@@ -1,145 +1,145 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc.builder;
-
-import java.util.Map;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.server.services.common.jdbc.builder.FormDataStatementBuilder.EntityStrategy;
-import org.eclipse.scout.rt.shared.data.form.fields.composer.ComposerEntityNodeData;
-import org.eclipse.scout.rt.shared.data.model.DataModelConstants;
-import org.eclipse.scout.rt.shared.data.model.IDataModelEntity;
-
-/**
- * Definition of a entity-to-sql mapping for {@link IDataModelEntity}
- */
-public class DataModelEntityPartDefinition implements DataModelConstants {
- private final Class<? extends IDataModelEntity> m_entityType;
- private final String m_whereClause;
- private final String m_selectClause;
-
- /**
- * see {@link #DataModelEntityPartDefinition(Class, String, String)}
- */
- public DataModelEntityPartDefinition(Class<? extends IDataModelEntity> entityType, String whereClause) {
- this(entityType, whereClause, null);
- }
-
- /**
- * @param whereClause
- * is the clause used to find data by constraining the where clause. This is normally something like
- *
- * <pre>
- * EXISTS (
- * SELECT 1
- * FROM ... &lt;fromParts/&gt;
- * WHERE 1=1 &lt;whereParts/&gt;
- * &lt;groupBy&gt;
- * GROUP BY &lt;groupByParts/&gt;
- * HAVING 1=1 &lt;havingParts/&gt;
- * &lt;/groupBy&gt;
- * )
- * </pre>
- * <p>
- * whereParts and havingParts is replaced in the build process by the corresponding attributes with/without
- * aggregation.
- * @param selectClause
- * is the clause to add n attributes of an entity to the base entity.
- * This parameter is the join clause used to join the additional entity to the
- * base entity in the select part. It must have the form (SELECT <selectParts/> FROM ... ) or a similar form
- * containing a <column/> tag and a @parent.TableAlias@.PRIMARY_KEY_ID
- * <p>
- * Example for a Person-Contact-Entity-join select-clause:
- *
- * <pre>
- * SELECT &lt;selectParts/&gt;
- * FROM MY_CONTACT @Contact@ &lt;fromParts/&gt;
- * WHERE @Contact@.PERSON_FK=@parent.Person@.PERSON_ID
- * &lt;whereParts/&gt;
- * &lt;groupBy&gt;
- * GROUP BY &lt;groupByParts/&gt;
- * HAVING 1=1 &lt;havingParts/&gt;
- * &lt;/groupBy&gt;
- * </pre>
- * <p>
- */
- public DataModelEntityPartDefinition(Class<? extends IDataModelEntity> entityType, String whereClause, String selectClause) {
- m_entityType = entityType;
- m_whereClause = autoCompleteTags(whereClause);
- m_selectClause = autoCompleteTags(selectClause);
- check();
- }
-
- protected String autoCompleteTags(String s) {
- return s;
- }
-
- /**
- * Override to do customized checks on select and where clause or to deactivate default checks.
- * <p>
- * Called by the constructor after calling {@link #autoCompleteTags(String)} and setting its member fields
- */
- protected void check() {
- /*
- if (m_whereClause != null) {
- for (String tag : new String[]{"whereParts", "groupBy", "groupByParts", "havingParts"}) {
- if (StringUtility.getTag(m_whereClause, tag) == null) {
- throw new IllegalArgumentException("whereClause must contain a " + tag + " tag");
- }
- }
- }
- if (m_selectClause != null) {
- for (String tag : new String[]{"selectParts", "fromParts", "whereParts", "groupBy", "groupByParts", "havingParts"}) {
- if (StringUtility.getTag(m_selectClause, tag) == null) {
- throw new IllegalArgumentException("selectClause must contain a " + tag + " tag");
- }
- }
- }
- */
- }
-
- public String getSelectClause() {
- return m_selectClause;
- }
-
- public String getWhereClause() {
- return m_whereClause;
- }
-
- public Class<? extends IDataModelEntity> getEntityType() {
- return m_entityType;
- }
-
- /**
- * Override this method to intercept and change the sql fragment that is created by this entity.<br>
- * Sometimes it is convenient to have dynamic joins depending on what attributes are contained within the
- * {@link ComposerEntityNodeData#getContainingAttributeNodes()}.
- *
- * @param builder
- * containging all binds and sql parts
- * @param entityNodeData
- * the form data object containing the runtime value {@link ComposerEntityNodeData}
- * @param strategy
- * is one of the {@link EntityStrategy} enums and decides whether {@link #getSelectClause()} or
- * {@link #getWhereClause()} is used
- * @param stm
- * is either {@link #getSelectClause()} or {@link #getWhereClause()} depending on the strategy
- * @param parentAliasMap
- * the map of meta-alias to alias for this entity, for example @Person@ -> p1
- * @return the result sql text; null if that part is to be ignored
- * <p>
- * default just returns the incoming stm (either {@link #getSelectClause()} or {@link #getWhereClause()})
- * @throws ProcessingException
- */
- public String createInstance(FormDataStatementBuilder builder, ComposerEntityNodeData entityNodeData, EntityStrategy strategy, String stm, Map<String, String> parentAliasMap) throws ProcessingException {
- return stm;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc.builder;
+
+import java.util.Map;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.server.services.common.jdbc.builder.FormDataStatementBuilder.EntityStrategy;
+import org.eclipse.scout.rt.shared.data.form.fields.composer.ComposerEntityNodeData;
+import org.eclipse.scout.rt.shared.data.model.DataModelConstants;
+import org.eclipse.scout.rt.shared.data.model.IDataModelEntity;
+
+/**
+ * Definition of a entity-to-sql mapping for {@link IDataModelEntity}
+ */
+public class DataModelEntityPartDefinition implements DataModelConstants {
+ private final Class<? extends IDataModelEntity> m_entityType;
+ private final String m_whereClause;
+ private final String m_selectClause;
+
+ /**
+ * see {@link #DataModelEntityPartDefinition(Class, String, String)}
+ */
+ public DataModelEntityPartDefinition(Class<? extends IDataModelEntity> entityType, String whereClause) {
+ this(entityType, whereClause, null);
+ }
+
+ /**
+ * @param whereClause
+ * is the clause used to find data by constraining the where clause. This is normally something like
+ *
+ * <pre>
+ * EXISTS (
+ * SELECT 1
+ * FROM ... &lt;fromParts/&gt;
+ * WHERE 1=1 &lt;whereParts/&gt;
+ * &lt;groupBy&gt;
+ * GROUP BY &lt;groupByParts/&gt;
+ * HAVING 1=1 &lt;havingParts/&gt;
+ * &lt;/groupBy&gt;
+ * )
+ * </pre>
+ * <p>
+ * whereParts and havingParts is replaced in the build process by the corresponding attributes with/without
+ * aggregation.
+ * @param selectClause
+ * is the clause to add n attributes of an entity to the base entity.
+ * This parameter is the join clause used to join the additional entity to the
+ * base entity in the select part. It must have the form (SELECT <selectParts/> FROM ... ) or a similar form
+ * containing a <column/> tag and a @parent.TableAlias@.PRIMARY_KEY_ID
+ * <p>
+ * Example for a Person-Contact-Entity-join select-clause:
+ *
+ * <pre>
+ * SELECT &lt;selectParts/&gt;
+ * FROM MY_CONTACT @Contact@ &lt;fromParts/&gt;
+ * WHERE @Contact@.PERSON_FK=@parent.Person@.PERSON_ID
+ * &lt;whereParts/&gt;
+ * &lt;groupBy&gt;
+ * GROUP BY &lt;groupByParts/&gt;
+ * HAVING 1=1 &lt;havingParts/&gt;
+ * &lt;/groupBy&gt;
+ * </pre>
+ * <p>
+ */
+ public DataModelEntityPartDefinition(Class<? extends IDataModelEntity> entityType, String whereClause, String selectClause) {
+ m_entityType = entityType;
+ m_whereClause = autoCompleteTags(whereClause);
+ m_selectClause = autoCompleteTags(selectClause);
+ check();
+ }
+
+ protected String autoCompleteTags(String s) {
+ return s;
+ }
+
+ /**
+ * Override to do customized checks on select and where clause or to deactivate default checks.
+ * <p>
+ * Called by the constructor after calling {@link #autoCompleteTags(String)} and setting its member fields
+ */
+ protected void check() {
+ /*
+ if (m_whereClause != null) {
+ for (String tag : new String[]{"whereParts", "groupBy", "groupByParts", "havingParts"}) {
+ if (StringUtility.getTag(m_whereClause, tag) == null) {
+ throw new IllegalArgumentException("whereClause must contain a " + tag + " tag");
+ }
+ }
+ }
+ if (m_selectClause != null) {
+ for (String tag : new String[]{"selectParts", "fromParts", "whereParts", "groupBy", "groupByParts", "havingParts"}) {
+ if (StringUtility.getTag(m_selectClause, tag) == null) {
+ throw new IllegalArgumentException("selectClause must contain a " + tag + " tag");
+ }
+ }
+ }
+ */
+ }
+
+ public String getSelectClause() {
+ return m_selectClause;
+ }
+
+ public String getWhereClause() {
+ return m_whereClause;
+ }
+
+ public Class<? extends IDataModelEntity> getEntityType() {
+ return m_entityType;
+ }
+
+ /**
+ * Override this method to intercept and change the sql fragment that is created by this entity.<br>
+ * Sometimes it is convenient to have dynamic joins depending on what attributes are contained within the
+ * {@link ComposerEntityNodeData#getContainingAttributeNodes()}.
+ *
+ * @param builder
+ * containging all binds and sql parts
+ * @param entityNodeData
+ * the form data object containing the runtime value {@link ComposerEntityNodeData}
+ * @param strategy
+ * is one of the {@link EntityStrategy} enums and decides whether {@link #getSelectClause()} or
+ * {@link #getWhereClause()} is used
+ * @param stm
+ * is either {@link #getSelectClause()} or {@link #getWhereClause()} depending on the strategy
+ * @param parentAliasMap
+ * the map of meta-alias to alias for this entity, for example @Person@ -> p1
+ * @return the result sql text; null if that part is to be ignored
+ * <p>
+ * default just returns the incoming stm (either {@link #getSelectClause()} or {@link #getWhereClause()})
+ * @throws ProcessingException
+ */
+ public String createInstance(FormDataStatementBuilder builder, ComposerEntityNodeData entityNodeData, EntityStrategy strategy, String stm, Map<String, String> parentAliasMap) throws ProcessingException {
+ return stm;
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/EntityContribution.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/EntityContribution.java
index ae27913a69..eedf1749ef 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/EntityContribution.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/EntityContribution.java
@@ -1,235 +1,235 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc.builder;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Contribution of an attribute to its containing entity
- */
-public class EntityContribution {
- private final List<String> m_selectParts;
- private final List<String> m_fromParts;
- private final List<String> m_whereParts;
- private final List<String> m_groupByParts;
- private final List<String> m_havingParts;
-
- /**
- * moved to {@link EntityContributionUtility#constraintTextToContribution(String)}
- */
- public static EntityContribution create(String wherePart) {
- return EntityContributionUtility.constraintTextToContribution(wherePart);
- }
-
- public EntityContribution() {
- m_selectParts = new ArrayList<String>(2);
- m_fromParts = new ArrayList<String>(2);
- m_whereParts = new ArrayList<String>(2);
- m_groupByParts = new ArrayList<String>(2);
- m_havingParts = new ArrayList<String>(2);
- }
-
- public EntityContribution(EntityContribution... contributions) {
- this();
- if (contributions != null) {
- for (EntityContribution contrib : contributions) {
- add(contrib);
- }
- }
- }
-
- public boolean isEmpty() {
- return m_selectParts.size() + m_fromParts.size() + m_whereParts.size() + m_groupByParts.size() + m_havingParts.size() == 0;
- }
-
- public void add(EntityContribution c) {
- if (c == null) {
- return;
- }
- getSelectParts().addAll(c.getSelectParts());
- getFromParts().addAll(c.getFromParts());
- getWhereParts().addAll(c.getWhereParts());
- getGroupByParts().addAll(c.getGroupByParts());
- getHavingParts().addAll(c.getHavingParts());
- }
-
- /**
- * @return the life list
- * Note that when adding a non-aggregated part to this list, also add it to the {@link #getGroupByParts()}
- * <p>
- * The entity builder checks if the size of {@link #getSelectParts()} and {@link #getGroupByParts()} is
- * different. If yes, it activates the groupBy clause otherwise it hides it.
- */
- public List<String> getSelectParts() {
- return m_selectParts;
- }
-
- /**
- * @return the life list
- */
- public List<String> getFromParts() {
- return m_fromParts;
- }
-
- /**
- * @return the life list
- */
- public List<String> getWhereParts() {
- return m_whereParts;
- }
-
- /**
- * @return the life list
- */
- public List<String> getGroupByParts() {
- return m_groupByParts;
- }
-
- /**
- * @return the life list
- */
- public List<String> getHavingParts() {
- return m_havingParts;
- }
-
- /**
- * Adds the given expression to the list of select parts. If the expression is not aggregating, it is added to the
- * group by parts as well.
- * <p/>
- * <b>Note</b>: The given expression represents exactly one column in the result set and it must not define an alias.
- *
- * @param expression
- * SQL expression representing a single column in the result set without an attribute alias
- * @param aggregating
- * <code>true</code> if the given expression uses a SQL aggregation, <code>false</code> otherwise.
- * @since 3.8.1
- */
- public void addSelectExpression(String expression, boolean aggregating) {
- getSelectParts().add(expression);
- if (!aggregating) {
- getGroupByParts().add(expression);
- }
- }
-
- /**
- * Adds the given expression to the list of from parts.
- *
- * @param expression
- * SQL table expression (e.g. table name or subquery)
- * @since 3.8.1
- */
- public void addFromExpression(String expression) {
- getFromParts().add(expression);
- }
-
- /**
- * Adds the given constraint to the list of where parts.
- *
- * @param constraint
- * SQL where constraint
- * @since 3.8.1
- */
- public void addWhereConstraint(String constraint) {
- getWhereParts().add(constraint);
- }
-
- /**
- * Adds the given expression to the list of group by parts.
- * <p/>
- * <b>Note</b>: The given expression represents exactly one column in the result set.
- *
- * @param expression
- * SQL expression representing a single column in the result set
- * @since 3.8.1
- */
- public void addGroupByExpression(String expression) {
- getGroupByParts().add(expression);
- }
-
- /**
- * Adds the given constraint to the list of having parts.
- *
- * @param constraint
- * SQL having constraint
- * @since 3.8.1
- */
- public void addHavingConstraint(String constraint) {
- getHavingParts().add(constraint);
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((m_fromParts == null) ? 0 : m_fromParts.hashCode());
- result = prime * result + ((m_groupByParts == null) ? 0 : m_groupByParts.hashCode());
- result = prime * result + ((m_havingParts == null) ? 0 : m_havingParts.hashCode());
- result = prime * result + ((m_selectParts == null) ? 0 : m_selectParts.hashCode());
- result = prime * result + ((m_whereParts == null) ? 0 : m_whereParts.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;
- }
- EntityContribution other = (EntityContribution) obj;
- if (m_fromParts == null) {
- if (other.m_fromParts != null) {
- return false;
- }
- }
- else if (!m_fromParts.equals(other.m_fromParts)) {
- return false;
- }
- if (m_groupByParts == null) {
- if (other.m_groupByParts != null) {
- return false;
- }
- }
- else if (!m_groupByParts.equals(other.m_groupByParts)) {
- return false;
- }
- if (m_havingParts == null) {
- if (other.m_havingParts != null) {
- return false;
- }
- }
- else if (!m_havingParts.equals(other.m_havingParts)) {
- return false;
- }
- if (m_selectParts == null) {
- if (other.m_selectParts != null) {
- return false;
- }
- }
- else if (!m_selectParts.equals(other.m_selectParts)) {
- return false;
- }
- if (m_whereParts == null) {
- if (other.m_whereParts != null) {
- return false;
- }
- }
- else if (!m_whereParts.equals(other.m_whereParts)) {
- return false;
- }
- return true;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc.builder;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Contribution of an attribute to its containing entity
+ */
+public class EntityContribution {
+ private final List<String> m_selectParts;
+ private final List<String> m_fromParts;
+ private final List<String> m_whereParts;
+ private final List<String> m_groupByParts;
+ private final List<String> m_havingParts;
+
+ /**
+ * moved to {@link EntityContributionUtility#constraintTextToContribution(String)}
+ */
+ public static EntityContribution create(String wherePart) {
+ return EntityContributionUtility.constraintTextToContribution(wherePart);
+ }
+
+ public EntityContribution() {
+ m_selectParts = new ArrayList<String>(2);
+ m_fromParts = new ArrayList<String>(2);
+ m_whereParts = new ArrayList<String>(2);
+ m_groupByParts = new ArrayList<String>(2);
+ m_havingParts = new ArrayList<String>(2);
+ }
+
+ public EntityContribution(EntityContribution... contributions) {
+ this();
+ if (contributions != null) {
+ for (EntityContribution contrib : contributions) {
+ add(contrib);
+ }
+ }
+ }
+
+ public boolean isEmpty() {
+ return m_selectParts.size() + m_fromParts.size() + m_whereParts.size() + m_groupByParts.size() + m_havingParts.size() == 0;
+ }
+
+ public void add(EntityContribution c) {
+ if (c == null) {
+ return;
+ }
+ getSelectParts().addAll(c.getSelectParts());
+ getFromParts().addAll(c.getFromParts());
+ getWhereParts().addAll(c.getWhereParts());
+ getGroupByParts().addAll(c.getGroupByParts());
+ getHavingParts().addAll(c.getHavingParts());
+ }
+
+ /**
+ * @return the life list
+ * Note that when adding a non-aggregated part to this list, also add it to the {@link #getGroupByParts()}
+ * <p>
+ * The entity builder checks if the size of {@link #getSelectParts()} and {@link #getGroupByParts()} is
+ * different. If yes, it activates the groupBy clause otherwise it hides it.
+ */
+ public List<String> getSelectParts() {
+ return m_selectParts;
+ }
+
+ /**
+ * @return the life list
+ */
+ public List<String> getFromParts() {
+ return m_fromParts;
+ }
+
+ /**
+ * @return the life list
+ */
+ public List<String> getWhereParts() {
+ return m_whereParts;
+ }
+
+ /**
+ * @return the life list
+ */
+ public List<String> getGroupByParts() {
+ return m_groupByParts;
+ }
+
+ /**
+ * @return the life list
+ */
+ public List<String> getHavingParts() {
+ return m_havingParts;
+ }
+
+ /**
+ * Adds the given expression to the list of select parts. If the expression is not aggregating, it is added to the
+ * group by parts as well.
+ * <p/>
+ * <b>Note</b>: The given expression represents exactly one column in the result set and it must not define an alias.
+ *
+ * @param expression
+ * SQL expression representing a single column in the result set without an attribute alias
+ * @param aggregating
+ * <code>true</code> if the given expression uses a SQL aggregation, <code>false</code> otherwise.
+ * @since 3.8.1
+ */
+ public void addSelectExpression(String expression, boolean aggregating) {
+ getSelectParts().add(expression);
+ if (!aggregating) {
+ getGroupByParts().add(expression);
+ }
+ }
+
+ /**
+ * Adds the given expression to the list of from parts.
+ *
+ * @param expression
+ * SQL table expression (e.g. table name or subquery)
+ * @since 3.8.1
+ */
+ public void addFromExpression(String expression) {
+ getFromParts().add(expression);
+ }
+
+ /**
+ * Adds the given constraint to the list of where parts.
+ *
+ * @param constraint
+ * SQL where constraint
+ * @since 3.8.1
+ */
+ public void addWhereConstraint(String constraint) {
+ getWhereParts().add(constraint);
+ }
+
+ /**
+ * Adds the given expression to the list of group by parts.
+ * <p/>
+ * <b>Note</b>: The given expression represents exactly one column in the result set.
+ *
+ * @param expression
+ * SQL expression representing a single column in the result set
+ * @since 3.8.1
+ */
+ public void addGroupByExpression(String expression) {
+ getGroupByParts().add(expression);
+ }
+
+ /**
+ * Adds the given constraint to the list of having parts.
+ *
+ * @param constraint
+ * SQL having constraint
+ * @since 3.8.1
+ */
+ public void addHavingConstraint(String constraint) {
+ getHavingParts().add(constraint);
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((m_fromParts == null) ? 0 : m_fromParts.hashCode());
+ result = prime * result + ((m_groupByParts == null) ? 0 : m_groupByParts.hashCode());
+ result = prime * result + ((m_havingParts == null) ? 0 : m_havingParts.hashCode());
+ result = prime * result + ((m_selectParts == null) ? 0 : m_selectParts.hashCode());
+ result = prime * result + ((m_whereParts == null) ? 0 : m_whereParts.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;
+ }
+ EntityContribution other = (EntityContribution) obj;
+ if (m_fromParts == null) {
+ if (other.m_fromParts != null) {
+ return false;
+ }
+ }
+ else if (!m_fromParts.equals(other.m_fromParts)) {
+ return false;
+ }
+ if (m_groupByParts == null) {
+ if (other.m_groupByParts != null) {
+ return false;
+ }
+ }
+ else if (!m_groupByParts.equals(other.m_groupByParts)) {
+ return false;
+ }
+ if (m_havingParts == null) {
+ if (other.m_havingParts != null) {
+ return false;
+ }
+ }
+ else if (!m_havingParts.equals(other.m_havingParts)) {
+ return false;
+ }
+ if (m_selectParts == null) {
+ if (other.m_selectParts != null) {
+ return false;
+ }
+ }
+ else if (!m_selectParts.equals(other.m_selectParts)) {
+ return false;
+ }
+ if (m_whereParts == null) {
+ if (other.m_whereParts != null) {
+ return false;
+ }
+ }
+ else if (!m_whereParts.equals(other.m_whereParts)) {
+ return false;
+ }
+ return true;
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/EntityContributionUtility.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/EntityContributionUtility.java
index 848068ddb9..047c811aae 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/EntityContributionUtility.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/EntityContributionUtility.java
@@ -1,378 +1,378 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc.builder;
-
-import java.util.TreeSet;
-import java.util.regex.Pattern;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.scout.commons.ListUtility;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.StringUtility.ITagProcessor;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.server.services.common.jdbc.builder.FormDataStatementBuilder.EntityStrategy;
-
-/**
- * Utility for building statements with {@link EntityContribution}
- */
-public final class EntityContributionUtility {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(EntityContributionUtility.class);
-
- public static EntityContribution constraintTextToContribution(String wherePart) {
- EntityContribution contrib = new EntityContribution();
- if (wherePart != null) {
- contrib.getWhereParts().add(wherePart);
- }
- return contrib;
- }
-
- /**
- * Creates a where constraints based on the {@link EntityContribution}. This means that from parts etc. are wrapped
- * inside an EXISTS (SELECT 1 FROM ... WHERE ... ) clause.
- *
- * @returns a where constraint or null if the {@link EntityContribution} is empty.
- * <p>
- * The constraint does not start with "AND" and can be added with {@link #addWhere(String, NVPair...)} by
- * prepending "AND"
- */
- public static String contributionToConstraintText(EntityContribution contrib) {
- // if there are no where parts, do nothing
- EntityContribution whereContribution = createConstraintsContribution(contrib);
- if (whereContribution == null) {
- return null;
- }
- if (whereContribution.getWhereParts().isEmpty()) {
- return null;
- }
- return ListUtility.format(whereContribution.getWhereParts(), " AND ");
- }
-
- /**
- * Creates constraints based on the {@link EntityContribution}. This means that from parts etc. are wrapped
- * inside an EXISTS (SELECT 1 FROM ... WHERE ... GROUP BY ... HAVING ...) clause.
- *
- * @return Returns an {@link EntityContribution} with constraints or null if the given {@link EntityContribution} is
- * empty.
- */
- public static EntityContribution createConstraintsContribution(EntityContribution contrib) {
- // if there are no where or having parts, do nothing
- if (contrib == null) {
- return null;
- }
- if (contrib.getWhereParts().isEmpty() && contrib.getHavingParts().isEmpty()) {
- return null;
- }
- if (contrib.getFromParts().isEmpty()) {
- // no from parts, just use where, group by and having parts
- EntityContribution result = new EntityContribution();
- result.getWhereParts().addAll(contrib.getWhereParts());
- result.getGroupByParts().addAll(contrib.getGroupByParts());
- result.getHavingParts().addAll(contrib.getHavingParts());
- return result;
- }
- // there are from parts
- // create an EXISTS (SELECT 1 FROM ... WHERE ... GROUP BY ... HAVING ...)
- StringBuilder sb = new StringBuilder();
- sb.append(" EXISTS (SELECT 1 FROM ");
- sb.append(ListUtility.format(contrib.getFromParts(), ", "));
- if (!contrib.getWhereParts().isEmpty()) {
- sb.append(" WHERE ");
- sb.append(ListUtility.format(contrib.getWhereParts(), " AND "));
- }
- if (!contrib.getGroupByParts().isEmpty()) {
- sb.append(" GROUP BY ");
- sb.append(ListUtility.format(contrib.getGroupByParts(), ", "));
- }
- if (!contrib.getHavingParts().isEmpty()) {
- sb.append(" HAVING ");
- sb.append(ListUtility.format(contrib.getHavingParts(), " AND "));
- }
- sb.append(")");
- return EntityContribution.create(sb.toString());
- }
-
- /**
- * Evaluates the collecting tags in the entity statement and fills in the values of the {@link EntityContribution}.
- * If the contributing tags are missing, the complete part is treated as 'select' on {@link EntityStrategy#BuildQuery}
- * and as 'where' on {@link EntityStrategy#BuildConstraints}
- * <p>
- * Before the call is processed, all {@link IFormDataStatementBuilderInjection}s are invoked.
- *
- * @param entityStrategy
- * @param entityPartWithTags
- * may contain the collecting tags selectParts, fromParts, whereParts, groupBy, groupByParts, havingParts<br/>
- * as well as the contributing selectPart, fromPart, wherePart, groupByPart, havingPart for the outer calling
- * part.
- * @param childContributions
- * is the set of tags collected by all children
- * @param consumeChildContributions
- * true: consume the child tags inside the entity statement. The returned entity contributions will not
- * contain any of these tags
- * <p>
- * false: don't consume the child tags inside the entity statement. The returned entity contribution contains
- * its onw plus all of these child tags (proxy)
- */
- public static EntityContribution mergeContributions(EntityStrategy entityStrategy, final String entityPartWithTags, EntityContribution childContributions, boolean consumeChildContributions) throws ProcessingException {
- String entityPart = entityPartWithTags;
- EntityContribution parentContrib = new EntityContribution();
- //PROCESS collectiong tags: selectParts, fromParts, whereParts, groupBy, groupByParts, havingParts
- if (!consumeChildContributions) {
- //just proxy through to parent
- parentContrib.add(childContributions);
- }
- else {
- // extend the select section
- if (childContributions.getSelectParts().size() > 0) {
- StringBuilder selectBuf = new StringBuilder();
- for (String selectPart : childContributions.getSelectParts()) {
- if (selectBuf.length() > 0) {
- selectBuf.append(", ");
- }
- selectBuf.append(autoBracketSelectPart(selectPart));
- }
- final String s = selectBuf.toString();
- if (StringUtility.getTag(entityPart, "selectParts") != null) {
- entityPart = StringUtility.replaceTags(entityPart, "selectParts", new ITagProcessor() {
- @Override
- public String processTag(String tagName, String tagContent) {
- if (tagContent.length() > 0) {
- return tagContent + ", " + s;
- }
- return s;
- }
- });
- }
- else {
- throw new IllegalArgumentException("missing <selectParts/> tag");
- }
- }
- entityPart = StringUtility.removeTagBounds(entityPart, "selectParts");
- // extend the from section
- TreeSet<String> fromParts = new TreeSet<String>(childContributions.getFromParts());
- if (fromParts.size() > 0) {
- StringBuilder buf = new StringBuilder();
- for (String fromPart : fromParts) {
- if (!isAnsiJoin(fromPart)) {
- buf.append(",");
- }
- buf.append(" ");
- buf.append(fromPart);
- }
- final String s = buf.toString();
- if (StringUtility.getTag(entityPart, "fromParts") != null) {
- entityPart = StringUtility.replaceTags(entityPart, "fromParts", new ITagProcessor() {
- @Override
- public String processTag(String tagName, String tagContent) {
- return tagContent + s;
- }
- });
- }
- else {
- throw new IllegalArgumentException("missing <fromParts/> tag");
- }
- }
- entityPart = StringUtility.removeTagBounds(entityPart, "fromParts");
- // extend the where section
- if (childContributions.getWhereParts().size() > 0) {
- final String s = ListUtility.format(childContributions.getWhereParts(), " AND ");
- if (StringUtility.getTag(entityPart, "whereParts") != null) {
- entityPart = StringUtility.replaceTags(entityPart, "whereParts", new ITagProcessor() {
- @Override
- public String processTag(String tagName, String tagContent) {
- return tagContent + " AND " + s;//legacy: always prefix an additional AND
- }
- });
- }
- else {
- entityPart = entityPart + " AND " + s;
- }
- }
- entityPart = StringUtility.removeTagBounds(entityPart, "whereParts");
- // extend the group by / having section
- if (StringUtility.getTag(entityPart, "groupBy") != null) {
- int selectGroupByDelta = childContributions.getSelectParts().size() - childContributions.getGroupByParts().size();
- if ((selectGroupByDelta > 0 && childContributions.getGroupByParts().size() > 0) || childContributions.getHavingParts().size() > 0) {
- entityPart = StringUtility.removeTagBounds(entityPart, "groupBy");
- if (childContributions.getGroupByParts().size() > 0) {
- //check group by parts
- for (String s : childContributions.getGroupByParts()) {
- checkGroupByPart(s);
- }
- final String s = ListUtility.format(childContributions.getGroupByParts(), ", ");
- if (StringUtility.getTag(entityPart, "groupByParts") != null) {
- entityPart = StringUtility.replaceTags(entityPart, "groupByParts", new ITagProcessor() {
- @Override
- public String processTag(String tagName, String tagContent) {
- if (tagContent.length() > 0) {
- return tagContent + ", " + s;
- }
- return s;
- }
- });
- }
- else {
- throw new IllegalArgumentException("missing <groupByParts/> tag");
- }
- }
- else {
- //no group by parts, avoid empty GROUP BY clause
- entityPart = StringUtility.replaceTags(entityPart, "groupByParts", new ITagProcessor() {
- @Override
- public String processTag(String tagName, String tagContent) {
- if (tagContent.length() > 0) {
- return tagContent;
- }
- return tagContent + " 1 ";
- }
- });
- }
- entityPart = StringUtility.removeTagBounds(entityPart, "groupByParts");
- //
- if (childContributions.getHavingParts().size() > 0) {
- final String s = ListUtility.format(childContributions.getHavingParts(), " AND ");
- if (StringUtility.getTag(entityPart, "havingParts") != null) {
- entityPart = StringUtility.replaceTags(entityPart, "havingParts", new ITagProcessor() {
- @Override
- public String processTag(String tagName, String tagContent) {
- return tagContent + " AND " + s;//legacy: always prefix an additional AND
- }
- });
- }
- else {
- throw new IllegalArgumentException("missing <havingParts/> tag");
- }
- }
- else {
- entityPart = StringUtility.removeTagBounds(entityPart, "havingParts");
- }
- }
- else {
- entityPart = StringUtility.replaceTags(entityPart, "groupBy", new ITagProcessor() {
- @Override
- public String processTag(String tagName, String tagContent) {
- if (!StringUtility.hasText(StringUtility.getTag(tagContent, "groupByParts"))
- && !StringUtility.hasText(StringUtility.getTag(tagContent, "havingParts"))) {
- return "";
- }
-
- // preserve statically defined group-by and having parts
- tagContent = StringUtility.replaceTags(tagContent, "groupByParts", new ITagProcessor() {
- @Override
- public String processTag(String innerTagName, String innerTagContent) {
- if (innerTagContent.length() > 0) {
- return innerTagContent;
- }
- return innerTagContent + " 1 ";
- }
- });
- tagContent = StringUtility.replaceTags(tagContent, "havingParts", new ITagProcessor() {
- @Override
- public String processTag(String innerTagName, String innerTagContent) {
- return innerTagContent;
- }
- });
- return tagContent;
- }
- });
- }
- }
- }
- //PROCESS contributing tags: selectPart, fromPart, wherePart, groupByPart, havingPart
- String selectPart = StringUtility.getTag(entityPart, "selectPart");
- if (selectPart != null) {
- parentContrib.getSelectParts().add(selectPart);
- entityPart = StringUtility.removeTag(entityPart, "selectPart").trim();
- }
- //
- String fromPart = StringUtility.getTag(entityPart, "fromPart");
- if (fromPart != null) {
- parentContrib.getFromParts().add(fromPart);
- entityPart = StringUtility.removeTag(entityPart, "fromPart").trim();
- }
- //
- String wherePart = StringUtility.getTag(entityPart, "wherePart");
- if (wherePart != null) {
- parentContrib.getWhereParts().add(wherePart);
- entityPart = StringUtility.removeTag(entityPart, "wherePart").trim();
- }
- //
- String groupByPart = StringUtility.getTag(entityPart, "groupByPart");
- if (groupByPart != null) {
- parentContrib.getGroupByParts().add(groupByPart);
- entityPart = StringUtility.removeTag(entityPart, "groupByPart").trim();
- }
- //
- String havingPart = StringUtility.getTag(entityPart, "havingPart");
- if (havingPart != null) {
- parentContrib.getHavingParts().add(havingPart);
- entityPart = StringUtility.removeTag(entityPart, "havingPart").trim();
- }
- if (parentContrib.isEmpty()) {
- switch (entityStrategy) {
- case BuildConstraints: {
- parentContrib.getWhereParts().add(entityPart);
- break;
- }
- case BuildQuery: {
- parentContrib.getSelectParts().add(entityPart);
- parentContrib.getGroupByParts().add("1");
- break;
- }
- }
- }
- else {
- //check for remaining dirt
- if (entityPart.length() > 0) {
- LOG.warn("entityPart " + entityPartWithTags + " contains content that is not wrapped in a tag: " + entityPart);
- }
- }
- return parentContrib;
- }
-
- private static final Pattern ANSI_JOIN_PATTERN = Pattern.compile("\\s*(LEFT\\s+|RIGHT\\s+)?(OUTER\\s+|INNER\\s+)?JOIN\\s+.*", Pattern.CASE_INSENSITIVE | Pattern.DOTALL);
-
- public static boolean isAnsiJoin(String fromPart) {
- if (fromPart == null) {
- return false;
- }
- return ANSI_JOIN_PATTERN.matcher(fromPart).matches();
- }
-
- private static final Pattern CHECK_GROUP_BY_CONTAINS_SELECT_PATTERN = Pattern.compile("[^a-z0-9\"'.%$_]SELECT[^a-z0-9\"'.%$_]", Pattern.CASE_INSENSITIVE | Pattern.DOTALL);
-
- public static final int STATUS_CODE_INVALID_GROUP_BY_PART = 0x70000001;
-
- /**
- * Check if a group by part is valid, i.e. ist not a SELECT clause.
- *
- * @throws ProcessingException
- * with {@link IStatus#getCode()} = X
- * @since 3.8
- */
- public static void checkGroupByPart(String groupByPart) throws ProcessingException {
- if (groupByPart == null) {
- return;
- }
- if (CHECK_GROUP_BY_CONTAINS_SELECT_PATTERN.matcher(groupByPart).find()) {
- throw new ProcessingException("Invalid group by clause", null, STATUS_CODE_INVALID_GROUP_BY_PART);
- }
- }
-
- private static String autoBracketSelectPart(String s) {
- if (s != null && !s.startsWith("(") && s.toLowerCase().contains("select")) {
- return "(" + s + ")";
- }
- return s;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc.builder;
+
+import java.util.TreeSet;
+import java.util.regex.Pattern;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.scout.commons.ListUtility;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.StringUtility.ITagProcessor;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.server.services.common.jdbc.builder.FormDataStatementBuilder.EntityStrategy;
+
+/**
+ * Utility for building statements with {@link EntityContribution}
+ */
+public final class EntityContributionUtility {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(EntityContributionUtility.class);
+
+ public static EntityContribution constraintTextToContribution(String wherePart) {
+ EntityContribution contrib = new EntityContribution();
+ if (wherePart != null) {
+ contrib.getWhereParts().add(wherePart);
+ }
+ return contrib;
+ }
+
+ /**
+ * Creates a where constraints based on the {@link EntityContribution}. This means that from parts etc. are wrapped
+ * inside an EXISTS (SELECT 1 FROM ... WHERE ... ) clause.
+ *
+ * @returns a where constraint or null if the {@link EntityContribution} is empty.
+ * <p>
+ * The constraint does not start with "AND" and can be added with {@link #addWhere(String, NVPair...)} by
+ * prepending "AND"
+ */
+ public static String contributionToConstraintText(EntityContribution contrib) {
+ // if there are no where parts, do nothing
+ EntityContribution whereContribution = createConstraintsContribution(contrib);
+ if (whereContribution == null) {
+ return null;
+ }
+ if (whereContribution.getWhereParts().isEmpty()) {
+ return null;
+ }
+ return ListUtility.format(whereContribution.getWhereParts(), " AND ");
+ }
+
+ /**
+ * Creates constraints based on the {@link EntityContribution}. This means that from parts etc. are wrapped
+ * inside an EXISTS (SELECT 1 FROM ... WHERE ... GROUP BY ... HAVING ...) clause.
+ *
+ * @return Returns an {@link EntityContribution} with constraints or null if the given {@link EntityContribution} is
+ * empty.
+ */
+ public static EntityContribution createConstraintsContribution(EntityContribution contrib) {
+ // if there are no where or having parts, do nothing
+ if (contrib == null) {
+ return null;
+ }
+ if (contrib.getWhereParts().isEmpty() && contrib.getHavingParts().isEmpty()) {
+ return null;
+ }
+ if (contrib.getFromParts().isEmpty()) {
+ // no from parts, just use where, group by and having parts
+ EntityContribution result = new EntityContribution();
+ result.getWhereParts().addAll(contrib.getWhereParts());
+ result.getGroupByParts().addAll(contrib.getGroupByParts());
+ result.getHavingParts().addAll(contrib.getHavingParts());
+ return result;
+ }
+ // there are from parts
+ // create an EXISTS (SELECT 1 FROM ... WHERE ... GROUP BY ... HAVING ...)
+ StringBuilder sb = new StringBuilder();
+ sb.append(" EXISTS (SELECT 1 FROM ");
+ sb.append(ListUtility.format(contrib.getFromParts(), ", "));
+ if (!contrib.getWhereParts().isEmpty()) {
+ sb.append(" WHERE ");
+ sb.append(ListUtility.format(contrib.getWhereParts(), " AND "));
+ }
+ if (!contrib.getGroupByParts().isEmpty()) {
+ sb.append(" GROUP BY ");
+ sb.append(ListUtility.format(contrib.getGroupByParts(), ", "));
+ }
+ if (!contrib.getHavingParts().isEmpty()) {
+ sb.append(" HAVING ");
+ sb.append(ListUtility.format(contrib.getHavingParts(), " AND "));
+ }
+ sb.append(")");
+ return EntityContribution.create(sb.toString());
+ }
+
+ /**
+ * Evaluates the collecting tags in the entity statement and fills in the values of the {@link EntityContribution}.
+ * If the contributing tags are missing, the complete part is treated as 'select' on {@link EntityStrategy#BuildQuery}
+ * and as 'where' on {@link EntityStrategy#BuildConstraints}
+ * <p>
+ * Before the call is processed, all {@link IFormDataStatementBuilderInjection}s are invoked.
+ *
+ * @param entityStrategy
+ * @param entityPartWithTags
+ * may contain the collecting tags selectParts, fromParts, whereParts, groupBy, groupByParts, havingParts<br/>
+ * as well as the contributing selectPart, fromPart, wherePart, groupByPart, havingPart for the outer calling
+ * part.
+ * @param childContributions
+ * is the set of tags collected by all children
+ * @param consumeChildContributions
+ * true: consume the child tags inside the entity statement. The returned entity contributions will not
+ * contain any of these tags
+ * <p>
+ * false: don't consume the child tags inside the entity statement. The returned entity contribution contains
+ * its onw plus all of these child tags (proxy)
+ */
+ public static EntityContribution mergeContributions(EntityStrategy entityStrategy, final String entityPartWithTags, EntityContribution childContributions, boolean consumeChildContributions) throws ProcessingException {
+ String entityPart = entityPartWithTags;
+ EntityContribution parentContrib = new EntityContribution();
+ //PROCESS collectiong tags: selectParts, fromParts, whereParts, groupBy, groupByParts, havingParts
+ if (!consumeChildContributions) {
+ //just proxy through to parent
+ parentContrib.add(childContributions);
+ }
+ else {
+ // extend the select section
+ if (childContributions.getSelectParts().size() > 0) {
+ StringBuilder selectBuf = new StringBuilder();
+ for (String selectPart : childContributions.getSelectParts()) {
+ if (selectBuf.length() > 0) {
+ selectBuf.append(", ");
+ }
+ selectBuf.append(autoBracketSelectPart(selectPart));
+ }
+ final String s = selectBuf.toString();
+ if (StringUtility.getTag(entityPart, "selectParts") != null) {
+ entityPart = StringUtility.replaceTags(entityPart, "selectParts", new ITagProcessor() {
+ @Override
+ public String processTag(String tagName, String tagContent) {
+ if (tagContent.length() > 0) {
+ return tagContent + ", " + s;
+ }
+ return s;
+ }
+ });
+ }
+ else {
+ throw new IllegalArgumentException("missing <selectParts/> tag");
+ }
+ }
+ entityPart = StringUtility.removeTagBounds(entityPart, "selectParts");
+ // extend the from section
+ TreeSet<String> fromParts = new TreeSet<String>(childContributions.getFromParts());
+ if (fromParts.size() > 0) {
+ StringBuilder buf = new StringBuilder();
+ for (String fromPart : fromParts) {
+ if (!isAnsiJoin(fromPart)) {
+ buf.append(",");
+ }
+ buf.append(" ");
+ buf.append(fromPart);
+ }
+ final String s = buf.toString();
+ if (StringUtility.getTag(entityPart, "fromParts") != null) {
+ entityPart = StringUtility.replaceTags(entityPart, "fromParts", new ITagProcessor() {
+ @Override
+ public String processTag(String tagName, String tagContent) {
+ return tagContent + s;
+ }
+ });
+ }
+ else {
+ throw new IllegalArgumentException("missing <fromParts/> tag");
+ }
+ }
+ entityPart = StringUtility.removeTagBounds(entityPart, "fromParts");
+ // extend the where section
+ if (childContributions.getWhereParts().size() > 0) {
+ final String s = ListUtility.format(childContributions.getWhereParts(), " AND ");
+ if (StringUtility.getTag(entityPart, "whereParts") != null) {
+ entityPart = StringUtility.replaceTags(entityPart, "whereParts", new ITagProcessor() {
+ @Override
+ public String processTag(String tagName, String tagContent) {
+ return tagContent + " AND " + s;//legacy: always prefix an additional AND
+ }
+ });
+ }
+ else {
+ entityPart = entityPart + " AND " + s;
+ }
+ }
+ entityPart = StringUtility.removeTagBounds(entityPart, "whereParts");
+ // extend the group by / having section
+ if (StringUtility.getTag(entityPart, "groupBy") != null) {
+ int selectGroupByDelta = childContributions.getSelectParts().size() - childContributions.getGroupByParts().size();
+ if ((selectGroupByDelta > 0 && childContributions.getGroupByParts().size() > 0) || childContributions.getHavingParts().size() > 0) {
+ entityPart = StringUtility.removeTagBounds(entityPart, "groupBy");
+ if (childContributions.getGroupByParts().size() > 0) {
+ //check group by parts
+ for (String s : childContributions.getGroupByParts()) {
+ checkGroupByPart(s);
+ }
+ final String s = ListUtility.format(childContributions.getGroupByParts(), ", ");
+ if (StringUtility.getTag(entityPart, "groupByParts") != null) {
+ entityPart = StringUtility.replaceTags(entityPart, "groupByParts", new ITagProcessor() {
+ @Override
+ public String processTag(String tagName, String tagContent) {
+ if (tagContent.length() > 0) {
+ return tagContent + ", " + s;
+ }
+ return s;
+ }
+ });
+ }
+ else {
+ throw new IllegalArgumentException("missing <groupByParts/> tag");
+ }
+ }
+ else {
+ //no group by parts, avoid empty GROUP BY clause
+ entityPart = StringUtility.replaceTags(entityPart, "groupByParts", new ITagProcessor() {
+ @Override
+ public String processTag(String tagName, String tagContent) {
+ if (tagContent.length() > 0) {
+ return tagContent;
+ }
+ return tagContent + " 1 ";
+ }
+ });
+ }
+ entityPart = StringUtility.removeTagBounds(entityPart, "groupByParts");
+ //
+ if (childContributions.getHavingParts().size() > 0) {
+ final String s = ListUtility.format(childContributions.getHavingParts(), " AND ");
+ if (StringUtility.getTag(entityPart, "havingParts") != null) {
+ entityPart = StringUtility.replaceTags(entityPart, "havingParts", new ITagProcessor() {
+ @Override
+ public String processTag(String tagName, String tagContent) {
+ return tagContent + " AND " + s;//legacy: always prefix an additional AND
+ }
+ });
+ }
+ else {
+ throw new IllegalArgumentException("missing <havingParts/> tag");
+ }
+ }
+ else {
+ entityPart = StringUtility.removeTagBounds(entityPart, "havingParts");
+ }
+ }
+ else {
+ entityPart = StringUtility.replaceTags(entityPart, "groupBy", new ITagProcessor() {
+ @Override
+ public String processTag(String tagName, String tagContent) {
+ if (!StringUtility.hasText(StringUtility.getTag(tagContent, "groupByParts"))
+ && !StringUtility.hasText(StringUtility.getTag(tagContent, "havingParts"))) {
+ return "";
+ }
+
+ // preserve statically defined group-by and having parts
+ tagContent = StringUtility.replaceTags(tagContent, "groupByParts", new ITagProcessor() {
+ @Override
+ public String processTag(String innerTagName, String innerTagContent) {
+ if (innerTagContent.length() > 0) {
+ return innerTagContent;
+ }
+ return innerTagContent + " 1 ";
+ }
+ });
+ tagContent = StringUtility.replaceTags(tagContent, "havingParts", new ITagProcessor() {
+ @Override
+ public String processTag(String innerTagName, String innerTagContent) {
+ return innerTagContent;
+ }
+ });
+ return tagContent;
+ }
+ });
+ }
+ }
+ }
+ //PROCESS contributing tags: selectPart, fromPart, wherePart, groupByPart, havingPart
+ String selectPart = StringUtility.getTag(entityPart, "selectPart");
+ if (selectPart != null) {
+ parentContrib.getSelectParts().add(selectPart);
+ entityPart = StringUtility.removeTag(entityPart, "selectPart").trim();
+ }
+ //
+ String fromPart = StringUtility.getTag(entityPart, "fromPart");
+ if (fromPart != null) {
+ parentContrib.getFromParts().add(fromPart);
+ entityPart = StringUtility.removeTag(entityPart, "fromPart").trim();
+ }
+ //
+ String wherePart = StringUtility.getTag(entityPart, "wherePart");
+ if (wherePart != null) {
+ parentContrib.getWhereParts().add(wherePart);
+ entityPart = StringUtility.removeTag(entityPart, "wherePart").trim();
+ }
+ //
+ String groupByPart = StringUtility.getTag(entityPart, "groupByPart");
+ if (groupByPart != null) {
+ parentContrib.getGroupByParts().add(groupByPart);
+ entityPart = StringUtility.removeTag(entityPart, "groupByPart").trim();
+ }
+ //
+ String havingPart = StringUtility.getTag(entityPart, "havingPart");
+ if (havingPart != null) {
+ parentContrib.getHavingParts().add(havingPart);
+ entityPart = StringUtility.removeTag(entityPart, "havingPart").trim();
+ }
+ if (parentContrib.isEmpty()) {
+ switch (entityStrategy) {
+ case BuildConstraints: {
+ parentContrib.getWhereParts().add(entityPart);
+ break;
+ }
+ case BuildQuery: {
+ parentContrib.getSelectParts().add(entityPart);
+ parentContrib.getGroupByParts().add("1");
+ break;
+ }
+ }
+ }
+ else {
+ //check for remaining dirt
+ if (entityPart.length() > 0) {
+ LOG.warn("entityPart " + entityPartWithTags + " contains content that is not wrapped in a tag: " + entityPart);
+ }
+ }
+ return parentContrib;
+ }
+
+ private static final Pattern ANSI_JOIN_PATTERN = Pattern.compile("\\s*(LEFT\\s+|RIGHT\\s+)?(OUTER\\s+|INNER\\s+)?JOIN\\s+.*", Pattern.CASE_INSENSITIVE | Pattern.DOTALL);
+
+ public static boolean isAnsiJoin(String fromPart) {
+ if (fromPart == null) {
+ return false;
+ }
+ return ANSI_JOIN_PATTERN.matcher(fromPart).matches();
+ }
+
+ private static final Pattern CHECK_GROUP_BY_CONTAINS_SELECT_PATTERN = Pattern.compile("[^a-z0-9\"'.%$_]SELECT[^a-z0-9\"'.%$_]", Pattern.CASE_INSENSITIVE | Pattern.DOTALL);
+
+ public static final int STATUS_CODE_INVALID_GROUP_BY_PART = 0x70000001;
+
+ /**
+ * Check if a group by part is valid, i.e. ist not a SELECT clause.
+ *
+ * @throws ProcessingException
+ * with {@link IStatus#getCode()} = X
+ * @since 3.8
+ */
+ public static void checkGroupByPart(String groupByPart) throws ProcessingException {
+ if (groupByPart == null) {
+ return;
+ }
+ if (CHECK_GROUP_BY_CONTAINS_SELECT_PATTERN.matcher(groupByPart).find()) {
+ throw new ProcessingException("Invalid group by clause", null, STATUS_CODE_INVALID_GROUP_BY_PART);
+ }
+ }
+
+ private static String autoBracketSelectPart(String s) {
+ if (s != null && !s.startsWith("(") && s.toLowerCase().contains("select")) {
+ return "(" + s + ")";
+ }
+ return s;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/ExampleFullTextPartDefinition.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/ExampleFullTextPartDefinition.java
index 4011586fde..81596cc6c8 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/ExampleFullTextPartDefinition.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/ExampleFullTextPartDefinition.java
@@ -1,45 +1,45 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc.builder;
-
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.shared.data.model.DataModelConstants;
-
-/**
- * Example handler that demonstrates custom part building for a full-text search field based on a oracle
- * database
- * with full-text engine.
- * <p>
- * the part is registered with {@link FormDataStatementBuilder#setPartDefinition(Class, new
- * PartDefinition("LAST_NAME"))}
- */
-public class ExampleFullTextPartDefinition extends BasicPartDefinition {
-
- /**
- * @param attribute
- */
- public ExampleFullTextPartDefinition(Class fieldType, String sqlAttribute) {
- super(fieldType, sqlAttribute, DataModelConstants.OPERATOR_NONE);
- }
-
- @Override
- protected String createInstanceImpl(FormDataStatementBuilder builder, List<Object> valueDatas, List<String> bindNames, List<Object> bindValues, Map<String, String> parentAliasMap) throws ProcessingException {
- String pattern = (String) bindValues.get(0);
- //generate a search patter from pattern, decorate and replace pattern
- //...
- String sqlAttribute = "CONTAINS(<attribute>" + this.getSqlAttribute() + "</attribute>,'" + pattern + "')>0";
- return builder.createSqlPart(DataModelConstants.AGGREGATION_NONE, sqlAttribute, getOperation(), null, null, isPlainBind(), parentAliasMap);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc.builder;
+
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.shared.data.model.DataModelConstants;
+
+/**
+ * Example handler that demonstrates custom part building for a full-text search field based on a oracle
+ * database
+ * with full-text engine.
+ * <p>
+ * the part is registered with {@link FormDataStatementBuilder#setPartDefinition(Class, new
+ * PartDefinition("LAST_NAME"))}
+ */
+public class ExampleFullTextPartDefinition extends BasicPartDefinition {
+
+ /**
+ * @param attribute
+ */
+ public ExampleFullTextPartDefinition(Class fieldType, String sqlAttribute) {
+ super(fieldType, sqlAttribute, DataModelConstants.OPERATOR_NONE);
+ }
+
+ @Override
+ protected String createInstanceImpl(FormDataStatementBuilder builder, List<Object> valueDatas, List<String> bindNames, List<Object> bindValues, Map<String, String> parentAliasMap) throws ProcessingException {
+ String pattern = (String) bindValues.get(0);
+ //generate a search patter from pattern, decorate and replace pattern
+ //...
+ String sqlAttribute = "CONTAINS(<attribute>" + this.getSqlAttribute() + "</attribute>,'" + pattern + "')>0";
+ return builder.createSqlPart(DataModelConstants.AGGREGATION_NONE, sqlAttribute, getOperation(), null, null, isPlainBind(), parentAliasMap);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/FormDataStatementBuilder.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/FormDataStatementBuilder.java
index 7cddce25f9..e47757e567 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/FormDataStatementBuilder.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/FormDataStatementBuilder.java
@@ -1,2046 +1,2046 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc.builder;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.scout.commons.ClassIdentifier;
-import org.eclipse.scout.commons.ListUtility;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.StringUtility.ITagProcessor;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.holders.NVPair;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.commons.parsers.BindModel;
-import org.eclipse.scout.commons.parsers.BindParser;
-import org.eclipse.scout.commons.parsers.token.IToken;
-import org.eclipse.scout.commons.parsers.token.ValueInputToken;
-import org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle;
-import org.eclipse.scout.rt.shared.data.form.AbstractFormData;
-import org.eclipse.scout.rt.shared.data.form.fields.AbstractFormFieldData;
-import org.eclipse.scout.rt.shared.data.form.fields.composer.ComposerAttributeNodeData;
-import org.eclipse.scout.rt.shared.data.form.fields.composer.ComposerEitherOrNodeData;
-import org.eclipse.scout.rt.shared.data.form.fields.composer.ComposerEntityNodeData;
-import org.eclipse.scout.rt.shared.data.form.fields.treefield.AbstractTreeFieldData;
-import org.eclipse.scout.rt.shared.data.form.fields.treefield.TreeNodeData;
-import org.eclipse.scout.rt.shared.data.model.AttributePath;
-import org.eclipse.scout.rt.shared.data.model.DataModelConstants;
-import org.eclipse.scout.rt.shared.data.model.DataModelUtility;
-import org.eclipse.scout.rt.shared.data.model.EntityPath;
-import org.eclipse.scout.rt.shared.data.model.IDataModel;
-import org.eclipse.scout.rt.shared.data.model.IDataModelAttribute;
-import org.eclipse.scout.rt.shared.data.model.IDataModelEntity;
-
-/**
- * <pre>
- * Usage:
- * <ul>
- * <li>call {@link #setDataModelEntityDefinition(Class, String, boolean)}, {@link #setDataModelAttributeDefinition(Class, String, boolean)} and {@link #addStatementMapping(Class, String, int, int, boolean)}
- * for all member classes in the FormData</li>
- * <li>call {@link #build(AbstractFormData)}</li>
- * <li>add {@link #getWhereConstraints()} to the base sql statement (starts with an AND)</li>
- * <li>add {@link #getBindMap()} to the sql bind bases</li>
- * </pre>
- * <p>
- * The method {@link #buildComposerEntityNode(ComposerEntityNodeData)} corrects composer trees for correct handling of
- * zero-traversing aggregation attributes and normal attributes using
- * {@link #isZeroTraversingAttribute(ComposerAttributeNodeData)}.<br>
- * An attribute is zero-traversing when it contains 0 and therefore null/non-existence together with the operator &lt;,
- * &gt;, &lt;=, &gt;=, =, !=, &lt;&gt;, between. Only numeric attributes can be zero-traversing. Dates never are.
- * <p>
- * Examples of zero-traversing:
- * <ul>
- * <li>Count(Person) &lt; 3</li>
- * <li>priority between -10 and 10</li>
- * <li>Sum(payment) &lt;= 1'000'000</li>
- * <li></li>
- * </ul>
- * <p>
- * Examples of <b>not</b> zero-traversing:
- * <ul>
- * <li>Count(Person) between 2 and 4</li>
- * <li>priority between 1 and 5</li>
- * <li>Sum(payment) &gt;= 1'000'000</li>
- * <li></li>
- * </ul>
- * <p>
- * When an entity e contains zero-traversing <b>aggregation</b> attributes (such as Count(.), Sum(.)) z1..zn and
- * non-zero-traversing attributes a1..an it is splittet into 2 entities as follows:<br>
- * <code>
- * <pre>either (
- * e
- * a1..an
- * z1..zn
- * )
- * or NOT (
- * e
- * a1..an
- * )
- * </pre>
- * </code>
- * <p>
- * In sql this would be something like<br>
- * <code>
- * <pre>exists (select 1 from Person ... where a1 and z1 groupy by ... having a2 and z2)
- * </pre>
- * </code> will be transformed to <code>
- * <pre>
- * (
- * exists (select 1 from Person ... where a1 and z1 groupy by ... having a2 and z2)
- * OR NOT
- * exists (select 1 from Person ... where a1 groupy by ... having a2)
- * )
- * </pre>
- * </code>
- * <p>
- * Zero-traversing non aggregation attributes are simply wrapped using NLV(attribute).
- * <p>
- * That way non-existent matches are added to the result, which matches the expected behaviour.
- *
- * @author imo
- */
-@SuppressWarnings("deprecation")
-public class FormDataStatementBuilder implements DataModelConstants {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(FormDataStatementBuilder.class);
- private static final Pattern PLAIN_ATTRIBUTE_PATTERN = Pattern.compile("(<attribute>)([a-zA-Z_][a-zA-Z0-9_]*)(</attribute>)");
-
- /**
- * Strategy used in
- * {@link DataModelAttributePartDefinition#createInstance(FormDataStatementBuilder, ComposerAttributeNodeData, AttributeStrategy, String, List, List, Map)}
- */
- public static enum AttributeStrategy {
- /**
- * Assuming the constraint "SALARY &gt;= 1000" and the attribute statement
- *
- * <pre>
- * &lt;attribute&gt;@Person@.SALARY&lt;/attribute&gt;
- * AND ACTIVE=1
- * </pre>
- *
- * this strategy only creates the contraint of the attribute part
- *
- * <pre>
- * {@link EntityContribution#getWhereParts()} = SALARY&gt;=1000
- * </pre>
- */
- BuildConstraintOfAttribute,
- /**
- * Assuming the constraint "SALARY &gt;= 1000" and the attribute statement
- *
- * <pre>
- * &lt;attribute&gt;@Person@.SALARY&lt;/attribute&gt;
- * AND ACTIVE=1
- * </pre>
- *
- * this strategy only creates the contraint of the context (excluding the attribute)
- *
- * <pre>
- * {@link EntityContribution#getWhereParts()} = ACTIVE=1
- * </pre>
- */
- BuildConstraintOfContext,
- /**
- * Assuming the constraint "SALARY &gt;= 1000" and the attribute statement
- *
- * <pre>
- * &lt;attribute&gt;@Person@.SALARY&lt;/attribute&gt;
- * AND ACTIVE=1
- * </pre>
- *
- * this strategy creates the contraint of the context and the attribute
- *
- * <pre>
- * {@link EntityContribution#getWhereParts()} = SALARY&gt;=1000 AND ACTIVE=1
- * </pre>
- */
- BuildConstraintOfAttributeWithContext,
- /**
- * Assuming the query "SALARY" and the attribute statement
- *
- * <pre>
- * &lt;attribute&gt;@Person@.SALARY&lt;/attribute&gt;
- * AND ACTIVE=1
- * </pre>
- *
- * this strategy creates the select query part of the attribute and adds constraints for the context
- *
- * <pre>
- * {@link EntityContribution#getSelectParts()} = SALARY
- * {@link EntityContribution#getWhereParts()} = ACTIVE=1
- * </pre>
- */
- BuildQueryOfAttributeAndConstraintOfContext,
- }
-
- /**
- * Strategy used in
- * {@link DataModelEntityPartDefinition#createInstance(FormDataStatementBuilder, ComposerEntityNodeData, EntityStrategy, String, Map)}
- */
- public static enum EntityStrategy {
- BuildConstraints,
- BuildQuery,
- }
-
- public static enum AttributeKind {
- /**
- * no attribute node
- */
- Undefined,
- NonAggregation,
- Aggregation,
- NonAggregationNonZeroTraversing,
- AggregationNonZeroTraversing,
- }
-
- private ISqlStyle m_sqlStyle;
- private IDataModel m_dataModel;
- private AliasMapper m_aliasMapper;
- private Map<Class<?>, DataModelAttributePartDefinition> m_dataModelAttMap;
- private Map<Class<?>, DataModelEntityPartDefinition> m_dataModelEntMap;
- private List<BasicPartDefinition> m_basicDefs;
- private Map<String, Object> m_bindMap;
- private AtomicInteger m_sequenceProvider;
- private StringBuffer m_where;
- private List<IFormDataStatementBuilderInjection> m_formDataStatementBuilderInjections;
-
- /**
- * @param sqlStyle
- */
- public FormDataStatementBuilder(ISqlStyle sqlStyle) {
- m_sqlStyle = sqlStyle;
- m_aliasMapper = new AliasMapper();
- m_bindMap = new HashMap<String, Object>();
- m_dataModelAttMap = new HashMap<Class<?>, DataModelAttributePartDefinition>();
- m_dataModelEntMap = new HashMap<Class<?>, DataModelEntityPartDefinition>();
- m_basicDefs = new ArrayList<BasicPartDefinition>();
- setSequenceProvider(new AtomicInteger(0));
- }
-
- public IDataModel getDataModel() {
- return m_dataModel;
- }
-
- /**
- * @return true to consume child contributions by this entity.
- * Default returns true. If the entity is a 1:1 or 1:0 relation to its base and its sql contribution is just a
- * join clause or similar, this method must return false to let the parent entity colelct all parts. Use
- * <code>return {@link IDataModelEntity#isOneToMany()}</code> when such behaviour is implemented.
- */
- protected boolean isConsumeChildContributions(EntityPath ePath) {
- return true;
- //return ePath.lastElement().isOneToMany();
- }
-
- /**
- * add an injection that allows to manipulate every call to
- * {@link #buildComposerAttributeNode(ComposerAttributeNodeData, AttributeStrategy)} and
- * {@link #buildComposerEntityNodeContribution(ComposerEntityNodeData, EntityStrategy)}
- */
- public void addFormDataStatementBuilderInjection(IFormDataStatementBuilderInjection j) {
- if (j == null) {
- return;
- }
- if (m_formDataStatementBuilderInjections == null) {
- m_formDataStatementBuilderInjections = new ArrayList<IFormDataStatementBuilderInjection>(1);
- }
- m_formDataStatementBuilderInjections.add(j);
- }
-
- public void removeFormDataStatementBuilderInjection(IFormDataStatementBuilderInjection j) {
- if (j == null) {
- return;
- }
- if (m_formDataStatementBuilderInjections != null) {
- m_formDataStatementBuilderInjections.remove(j);
- if (m_formDataStatementBuilderInjections.isEmpty()) {
- m_formDataStatementBuilderInjections = null;
- }
- }
- }
-
- private boolean hasInjections() {
- return (m_formDataStatementBuilderInjections != null && !m_formDataStatementBuilderInjections.isEmpty());
- }
-
- private void injectPreBuildEntity(ComposerEntityNodeData node, EntityStrategy entityStrategy, EntityContribution childContrib) {
- if (m_formDataStatementBuilderInjections != null) {
- for (IFormDataStatementBuilderInjection j : m_formDataStatementBuilderInjections) {
- j.preBuildEntity(node, entityStrategy, childContrib);
- }
- }
- }
-
- private void injectPostBuildEntity(ComposerEntityNodeData node, EntityStrategy entityStrategy, EntityContribution parentContrib) {
- if (m_formDataStatementBuilderInjections != null) {
- for (IFormDataStatementBuilderInjection j : m_formDataStatementBuilderInjections) {
- j.postBuildEntity(node, entityStrategy, parentContrib);
- }
- }
- }
-
- private void injectPostBuildAttribute(ComposerAttributeNodeData node, AttributeStrategy attributeStrategy, EntityContribution contrib) {
- if (m_formDataStatementBuilderInjections != null) {
- for (IFormDataStatementBuilderInjection j : m_formDataStatementBuilderInjections) {
- j.postBuildAttribute(node, attributeStrategy, contrib);
- }
- }
- }
-
- public void setDataModel(IDataModel dataModel) {
- m_dataModel = dataModel;
- }
-
- /**
- * @returns the reference to the sequence provider to be used outside for additional sequenced items or sub statemet
- * builders
- */
- public AtomicInteger getSequenceProvider() {
- return m_sequenceProvider;
- }
-
- /**
- * use another sequence provider (counts 0,1,2... for aliases)
- */
- public void setSequenceProvider(AtomicInteger sequenceProvider) {
- m_sequenceProvider = sequenceProvider;
- m_aliasMapper.setSequenceProvider(m_sequenceProvider);
- }
-
- /**
- * Define the statement part for a sql part. For composer attributes and entites use
- * {@link #setDataModelAttributeDefinition(DataModelAttributePartDefinition)} and
- * {@link #setDataModelEntityDefinition(DataModelEntityPartDefinition)}
- * <p>
- * <b>Number, Date, String, Boolean field</b>:<br>
- * The sqlAttribute is something like <code>@PERSON@.LAST_NAME</code><br>
- * When multiple occurrences are simultaneously used, the sqlAttribute may be written as
- * <code>(&lt;attribute&gt;@PERSON@.ORDER_STATUS&lt;/attribute&gt; OR &lt;attribute&gt;@PERSON@.DELIVERY_STATUS&lt;/attribute&gt;)</code>
- * <p>
- * The operator and aggregationType are required, unless a {@link BasicPartDefinition} is used.
- */
- public void setBasicDefinition(Class<?> fieldType, String sqlAttribute, int operator) {
- setBasicDefinition(new BasicPartDefinition(fieldType, sqlAttribute, operator));
- }
-
- /**
- * see {@link #setBasicDefinition(Class, String, int)}
- */
- public void setBasicDefinition(ClassIdentifier fieldTypeIdentifier, String sqlAttribute, int operator) {
- setBasicDefinition(new BasicPartDefinition(fieldTypeIdentifier, sqlAttribute, operator));
- }
-
- /**
- * see {@link #setBasicDefinition(Class, String, int)}
- */
- public void setBasicDefinition(Class<?> fieldType, String sqlAttribute, int operator, boolean plainBind) {
- setBasicDefinition(new BasicPartDefinition(fieldType, sqlAttribute, operator, plainBind));
- }
-
- /**
- * see {@link #setBasicDefinition(Class, String, int)}
- */
- public void setBasicDefinition(ClassIdentifier fieldTypeIdentifier, String sqlAttribute, int operator, boolean plainBind) {
- setBasicDefinition(new BasicPartDefinition(fieldTypeIdentifier, sqlAttribute, operator, plainBind));
- }
-
- /**
- * see {@link #setBasicDefinition(Class, String, int)}
- */
- public void setBasicDefinition(Class<?>[] fieldTypes, String sqlAttribute, int operator) {
- setBasicDefinition(new BasicPartDefinition(fieldTypes, sqlAttribute, operator, false));
- }
-
- /**
- * see {@link #setBasicDefinition(Class, String, int)}
- */
- public void setBasicDefinition(ClassIdentifier[] fieldTypeIdentifiers, String sqlAttribute, int operator) {
- setBasicDefinition(new BasicPartDefinition(fieldTypeIdentifiers, sqlAttribute, operator, false));
- }
-
- /**
- * see {@link #setBasicDefinition(Class, String, int)}
- */
- public void setBasicDefinition(BasicPartDefinition def) {
- m_basicDefs.add(def);
- }
-
- /**
- * @deprecated use setBasicDefinition instead
- */
- @Deprecated
- public void setValueDefinition(Class<?> fieldType, String sqlAttribute, int operator) {
- setValueDefinition(new ValuePartDefinition(fieldType, sqlAttribute, operator));
- }
-
- /**
- * @deprecated use setBasicDefinition instead
- */
- @Deprecated
- public void setValueDefinition(ClassIdentifier fieldTypeIdentifier, String sqlAttribute, int operator) {
- setValueDefinition(new ValuePartDefinition(fieldTypeIdentifier, sqlAttribute, operator));
- }
-
- /**
- * @deprecated use setBasicDefinition instead
- */
- @Deprecated
- public void setValueDefinition(Class<?> fieldType, String sqlAttribute, int operator, boolean plainBind) {
- setValueDefinition(new ValuePartDefinition(fieldType, sqlAttribute, operator, plainBind));
- }
-
- /**
- * @deprecated use setBasicDefinition instead
- */
- @Deprecated
- public void setValueDefinition(ClassIdentifier fieldTypeIdentifier, String sqlAttribute, int operator, boolean plainBind) {
- setValueDefinition(new ValuePartDefinition(fieldTypeIdentifier, sqlAttribute, operator, plainBind));
- }
-
- /**
- * @deprecated use setBasicDefinition instead
- */
- @Deprecated
- public void setValueDefinition(Class<?>[] fieldTypes, String sqlAttribute, int operator) {
- setValueDefinition(new ValuePartDefinition(fieldTypes, sqlAttribute, operator, false));
- }
-
- /**
- * @deprecated use setBasicDefinition instead
- */
- @Deprecated
- public void setValueDefinition(ClassIdentifier[] fieldTypeIdentifiers, String sqlAttribute, int operator) {
- setValueDefinition(new ValuePartDefinition(fieldTypeIdentifiers, sqlAttribute, operator, false));
- }
-
- /**
- * @deprecated use setBasicDefinition instead
- */
- @Deprecated
- public void setValueDefinition(ValuePartDefinition def) {
- m_basicDefs.add(def);
- }
-
- /**
- * <b>Data model attribute</b>:<br>
- * The sqlAttribute is something like LAST_NAME, STATUS or @PERSON@.LAST_NAME, @PERSON@.STATUS.
- *
- * @PERSON@ will be replaced by the parent entitie's generated alias.
- * <p>
- * The @PERSON@ prefix is added automatically if missing, but only if the entity where the attribute is
- * contained has only <b>one</b> alias.<br>
- * When multiple occurrences are simultaneously used, the sqlAttribute may be written as
- * <code>(&lt;attribute&gt;ORDER_STATUS&lt;/attribute&gt; OR &lt;attribute&gt;DELIVERY_STATUS&lt;/attribute&gt;)</code>
- */
- public void setDataModelAttributeDefinition(Class<? extends IDataModelAttribute> attributeType, String sqlAttribute) {
- setDataModelAttributeDefinition(attributeType, sqlAttribute, false);
- }
-
- /**
- * see {@link #setDataModelAttributeDefinition(Class, String)}
- */
- public void setDataModelAttributeDefinition(Class<? extends IDataModelAttribute> attributeType, String sqlAttribute, boolean plainBind) {
- setDataModelAttributeDefinition(new DataModelAttributePartDefinition(attributeType, sqlAttribute, plainBind));
- }
-
- /**
- * see {@link #setDataModelAttributeDefinition(Class, String)}
- */
- public void setDataModelAttributeDefinition(Class<? extends IDataModelAttribute> attributeType, String whereClause, String selectClause, boolean plainBind) {
- setDataModelAttributeDefinition(new DataModelAttributePartDefinition(attributeType, whereClause, selectClause, plainBind));
- }
-
- /**
- * see {@link #setDataModelAttributeDefinition(Class, String)}
- */
- public void setDataModelAttributeDefinition(DataModelAttributePartDefinition def) {
- m_dataModelAttMap.put(def.getAttributeType(), def);
- }
-
- /**
- * see {@link #setDataModelEntityDefinition(Class, String, String)}
- */
- public void setDataModelEntityDefinition(Class<? extends IDataModelEntity> entityType, String whereClause) {
- setDataModelEntityDefinition(new DataModelEntityPartDefinition(entityType, whereClause));
- }
-
- /**
- * <b>Data model entity</b>:<br>
- * The whereClause is something like <code><pre>
- * EXISTS (
- * SELECT 1
- * FROM PERSON @PERSON@
- * WHERE @PERSON@.PERSON_ID=@parent.PERSON@.PERSON_ID
- * &lt;whereParts/&gt;
- * &lt;groupBy&gt;
- * GROUP BY @PERSON@.PERSON_ID
- * HAVING 1=1
- * &lt;havingParts/&gt;
- * &lt;/groupBy&gt;
- * )
- * </pre></code> <br>
- * The selectClause is something like <code><pre>
- * ( SELECT &lt; selectParts/&gt;
- * FROM PERSON @PERSON@
- * WHERE @PERSON@.PERSON_ID=@parent.PERSON@.PERSON_ID
- * &lt;whereParts/&gt;
- * )
- * </pre></code> It is not allowed, that the selectClause contains a <i>UNION</i> because this part is needed for
- * aggregation too.<br>
- * The <i>selectParts</i> tag is replaced with all attributes which are selected.
- * If there are more than one attributes, they are separated by a comma
- * "<i>attribute1</i> <i>,</i> <i>attribute2</i>".<br>
- * The <i>whereParts</i> tag is replaced with all attributes contained in the entity that have no aggregation type.
- * Every attribute contributes a "AND <i>attribute</i> <i>op</i> <i>value</i>" line.<br>
- * The <i>groupBy</i> tag is only used when there are attributes in the entity that have an aggregation type.<br>
- * The <i>havingParts</i> tag is replaced with all attributes contained in the entity that have an aggregation type.
- * Every aggregation attribute contributes a "AND <i>fun</i>(<i>attribute</i>) <i>op</i> <i>value</i>" line.<br>
- */
-
- public void setDataModelEntityDefinition(Class<? extends IDataModelEntity> entityType, String whereClause, String selectClause) {
- setDataModelEntityDefinition(new DataModelEntityPartDefinition(entityType, whereClause, selectClause));
- }
-
- /**
- * see {@link #setDataModelEntityDefinition(Class, String)}
- */
- public void setDataModelEntityDefinition(DataModelEntityPartDefinition def) {
- m_dataModelEntMap.put(def.getEntityType(), def);
- }
-
- /**
- * Convenience for {@link #getAliasMapper()} and {@link AliasMapper#setRootAlias(String, String)}
- */
- public void setRootAlias(String entityName, String alias) {
- getAliasMapper().setRootAlias(entityName, alias);
- }
-
- protected FormDataStatementBuilderCheck createCheckInstance() {
- return new FormDataStatementBuilderCheck(this);
- }
-
- public void check(Object o) {
- FormDataStatementBuilderCheck c = createCheckInstance();
- c.check(o);
- System.out.println(c.toString());
- }
-
- @SuppressWarnings("cast")
- public String build(AbstractFormData formData) throws ProcessingException {
- m_where = new StringBuffer();
- // get all formData fields and properties defined directly and indirectly by extending template fields, respectively
- //build constraints for fields
- for (BasicPartDefinition def : m_basicDefs) {
- if (def.accept(formData)) {
- Map<String, String> parentAliasMap = getAliasMapper().getRootAliases();
- EntityContribution contrib = def.createInstance(this, formData, parentAliasMap);
- String cons = createWhereConstraint(contrib);
- if (cons != null) {
- addWhere(" AND " + cons);
- }
- }
- }
- //build constraints for composer trees
- Map<Integer, Map<String, AbstractFormFieldData>> fieldsBreathFirstMap = formData.getAllFieldsRec();
- for (Map<String, AbstractFormFieldData> map : fieldsBreathFirstMap.values()) {
- for (AbstractFormFieldData f : map.values()) {
- if (f.isValueSet()) {
- if (f instanceof AbstractTreeFieldData) {
- // composer tree with entity, attribute
- EntityContribution contrib = buildTreeNodes(((AbstractTreeFieldData) f).getRoots(), EntityStrategy.BuildConstraints, AttributeStrategy.BuildConstraintOfAttributeWithContext);
- String cons = createWhereConstraint(contrib);
- if (cons != null) {
- addWhere(" AND " + cons);
- }
- }
- }
- }
- }
- return getWhereConstraints();
- }
-
- /**
- * Creates a select statement by merging the given entity contributions with the given base statement. This builder's
- * {@link #getWhereConstraints()} are added as well.
- *
- * @param stm
- * base statement with &lt;selectParts/&gt;, &lt;fromParts/&gt;, &lt;whereParts/&gt;, &lt;groupByParts/&gt;
- * or &lt;havingParts/&gt; place holders.
- * @param contributions
- * entity contributions that are used to replace markers in the given base statement.
- * @return Returns given base statement having all place holders replaced by the given entity contributions.
- * @throws ProcessingException
- * @since 3.8.1
- */
- public String createSelectStatement(String stm, EntityContribution... contributions) throws ProcessingException {
- EntityContribution mergedContribution = new EntityContribution();
- if (contributions != null) {
- for (EntityContribution c : contributions) {
- mergedContribution.add(c);
- }
- }
- String where = StringUtility.trim(getWhereConstraints());
- if (StringUtility.hasText(where)) {
- if (where.toUpperCase().startsWith("AND")) {
- where = where.substring(3);
- }
- mergedContribution.getWhereParts().add(where);
- }
- return createEntityPart(stm, false, mergedContribution);
- }
-
- /**
- * do not use or override this method, it is protected for unit test purposes
- */
- protected boolean isZeroTraversingAttribute(int operation, Object[] values) {
- Number value1 = values != null && values.length > 0 && values[0] instanceof Number ? (Number) values[0] : null;
- Number value2 = values != null && values.length > 1 && values[1] instanceof Number ? (Number) values[1] : null;
- switch (operation) {
- case OPERATOR_EQ: {
- if (value1 != null) {
- return value1.longValue() == 0;
- }
- break;
- }
- case OPERATOR_GE: {
- if (value1 != null) {
- return value1.doubleValue() <= 0;
- }
- break;
- }
- case OPERATOR_GT: {
- if (value1 != null) {
- return value1.doubleValue() < 0;
- }
- break;
- }
- case OPERATOR_LE: {
- if (value1 != null) {
- return value1.doubleValue() >= 0;
- }
- break;
- }
- case OPERATOR_LT: {
- if (value1 != null) {
- return value1.doubleValue() > 0;
- }
- break;
- }
- case OPERATOR_NEQ: {
- if (value1 != null) {
- return value1.longValue() != 0;
- }
- break;
- }
- case OPERATOR_BETWEEN: {
- if (value1 != null && value2 != null) {
- return value1.doubleValue() <= 0 && value2.doubleValue() >= 0;
- }
- else if (value1 != null) {
- return value1.doubleValue() <= 0;
- }
- else if (value2 != null) {
- return value2.doubleValue() >= 0;
- }
- break;
- }
- }
- return false;
- }
-
- public AliasMapper getAliasMapper() {
- return m_aliasMapper;
- }
-
- /**
- * @return the life bind map
- */
- public Map<String, Object> getBindMap() {
- return m_bindMap;
- }
-
- public ISqlStyle getSqlStyle() {
- return m_sqlStyle;
- }
-
- /**
- * Convenience for {@link #getBindMap()}.put(name,value)
- */
- public void addBinds(String[] names, Object[] values) {
- if (names != null) {
- for (int i = 0; i < names.length; i++) {
- addBind(names[i], values[i]);
- }
- }
- }
-
- /**
- * Convenience for {@link #getBindMap()}.put(name,value)
- */
- public void addBind(String name, Object value) {
- if (name != null && !name.startsWith(ISqlStyle.PLAIN_BIND_MARKER_PREFIX)) {
- getBindMap().put(name, value);
- }
- }
-
- /**
- * add sql part with custom binds the ADD keyword is NOT added (pre-pended)
- * automatically
- */
- public void addWhere(String sql, NVPair... customBinds) {
- if (sql != null) {
- m_where.append(" ");
- m_where.append(sql);
- for (NVPair p : customBinds) {
- addBind(p.getName(), p.getValue());
- }
- }
- }
-
- /**
- * @deprecated use {@link #getBasicPartDefinitions()} instead
- */
- @Deprecated
- public List<BasicPartDefinition> getValuePartDefinitions() {
- return Collections.unmodifiableList(m_basicDefs);
- }
-
- public List<BasicPartDefinition> getBasicPartDefinitions() {
- return Collections.unmodifiableList(m_basicDefs);
- }
-
- public Map<Class<?>, DataModelAttributePartDefinition> getDataModelAttributePartDefinitions() {
- return Collections.unmodifiableMap(m_dataModelAttMap);
- }
-
- public Map<Class<?>, DataModelEntityPartDefinition> getDataModelEntityPartDefinitions() {
- return Collections.unmodifiableMap(m_dataModelEntMap);
- }
-
- public String getWhereConstraints() {
- return (m_where != null ? m_where.toString() : null);
- }
-
- /**
- * Replace bind name by unique bind name so that it is not
- * conflicting with other parts that use the same statement
- * part and bind name. For example S is replaces by __S123.
- */
- public String localizeBindName(String bindName, String prefix) {
- if (bindName != null) {
- String locName = prefix + bindName + getNextBindSeqNo();
- return locName;
- }
- return null;
- }
-
- /**
- * Replace bind name in statement
- */
- public String localizeStatement(String stm, String oldBindName, String newBindName) {
- stm = stm.replaceAll("#" + oldBindName + "#", "#" + newBindName + "#");
- stm = stm.replaceAll("\\&" + oldBindName + "\\&", "&" + newBindName + "&");
- stm = stm.replaceAll(":" + oldBindName + "([^A-Za-z0-9_])", ":" + newBindName + "$1");
- stm = stm.replaceAll(":" + oldBindName + "$", ":" + newBindName);
- return stm;
- }
-
- protected long getNextBindSeqNo() {
- return m_sequenceProvider.incrementAndGet();
- }
-
- @SuppressWarnings("unchecked")
- public static <T extends TreeNodeData> T getParentNodeOfType(TreeNodeData node, Class<T> type) {
- if (node == null) {
- return null;
- }
- while (node != null) {
- node = node.getParentNode();
- if (node != null && type.isAssignableFrom(node.getClass())) {
- return (T) node;
- }
- }
- return null;
- }
-
- /**
- * moved to {@link EntityContributionUtility#contributionToConstraintText(EntityContribution)}
- */
- public static String createWhereConstraint(EntityContribution contrib) {
- return EntityContributionUtility.contributionToConstraintText(contrib);
- }
-
- public AttributeKind getAttributeKind(TreeNodeData node) {
- if (!(node instanceof ComposerAttributeNodeData)) {
- return AttributeKind.Undefined;
- }
- //
- ComposerAttributeNodeData attributeNode = (ComposerAttributeNodeData) node;
- Integer agg = attributeNode.getAggregationType();
- if (agg == null || agg == AGGREGATION_NONE) {
- if (!isZeroTraversingAttribute(attributeNode.getOperator(), attributeNode.getValues())) {
- return AttributeKind.NonAggregationNonZeroTraversing;
- }
- return AttributeKind.NonAggregation;
- }
- //
- if (!isZeroTraversingAttribute(attributeNode.getOperator(), attributeNode.getValues())) {
- return AttributeKind.AggregationNonZeroTraversing;
- }
- return AttributeKind.Aggregation;
- }
-
- /**
- * @param nodes
- * @return the complete string of all attribute contributions
- * @throws ProcessingException
- */
- public EntityContribution buildTreeNodes(List<TreeNodeData> nodes, EntityStrategy entityStrategy, AttributeStrategy attributeStrategy) throws ProcessingException {
- EntityContribution contrib = new EntityContribution();
- int i = 0;
- while (i < nodes.size()) {
- if (nodes.get(i) instanceof ComposerEntityNodeData) {
- EntityContribution subContrib = buildComposerEntityNodeContribution((ComposerEntityNodeData) nodes.get(i), entityStrategy);
- appendTreeSubContribution(contrib, subContrib, entityStrategy);
- i++;
- }
- else if (nodes.get(i) instanceof ComposerAttributeNodeData) {
- EntityContribution subContrib = buildComposerAttributeNode((ComposerAttributeNodeData) nodes.get(i), attributeStrategy);
- appendTreeSubContribution(contrib, subContrib, entityStrategy);
- i++;
- }
- else if (nodes.get(i) instanceof ComposerEitherOrNodeData) {
- ArrayList<ComposerEitherOrNodeData> orNodes = new ArrayList<ComposerEitherOrNodeData>();
- orNodes.add((ComposerEitherOrNodeData) nodes.get(i));
- int k = i;
- while (k + 1 < nodes.size() && (nodes.get(k + 1) instanceof ComposerEitherOrNodeData) && !((ComposerEitherOrNodeData) nodes.get(k + 1)).isBeginOfEitherOr()) {
- orNodes.add((ComposerEitherOrNodeData) nodes.get(k + 1));
- k++;
- }
- EntityContribution subContrib = buildComposerOrNodes(orNodes, entityStrategy, attributeStrategy);
- appendTreeSubContribution(contrib, subContrib, entityStrategy);
- i = k + 1;
- }
- else {
- EntityContribution subContrib = buildTreeNodes(nodes.get(i).getChildNodes(), entityStrategy, attributeStrategy);
- appendTreeSubContribution(contrib, subContrib, entityStrategy);
- }
- }
- return contrib;
- }
-
- private void appendTreeSubContribution(EntityContribution parent, EntityContribution child, EntityStrategy entityStrategy) {
- switch (entityStrategy) {
- case BuildConstraints: {
- EntityContribution whereConstraints = EntityContributionUtility.createConstraintsContribution(child);
- if (whereConstraints != null) {
- parent.add(whereConstraints);
- }
- break;
- }
- default: {
- if (child != null && !child.isEmpty()) {
- parent.add(child);
- }
- }
- }
- }
-
- /**
- * do not use or override this method, it is protected for unit test purposes
- */
- @SuppressWarnings("unchecked")
- protected EntityContribution buildComposerOrNodes(List<ComposerEitherOrNodeData> nodes, EntityStrategy entityStrategy, AttributeStrategy attributeStrategy) throws ProcessingException {
- EntityContribution contrib = new EntityContribution();
- // check if only one condition
- StringBuilder buf = new StringBuilder();
- int count = 0;
- for (ComposerEitherOrNodeData node : nodes) {
- EntityContribution subContrib = buildTreeNodes(node.getChildNodes(), entityStrategy, attributeStrategy);
- contrib.getFromParts().addAll(subContrib.getFromParts());
- if (subContrib.getWhereParts().size() + subContrib.getHavingParts().size() > 0) {
- if (count > 0) {
- buf.append(" OR ");
- if (node.isNegative()) {
- buf.append(" NOT ");
- }
- }
- buf.append("(");
- // remove possible outer join signs (+) in where / having constraint
- // this is necessary because outer joins are not allowed in OR clause
- // the removal of outer joins does not influence the result set
- buf.append(ListUtility.format(ListUtility.combine(subContrib.getWhereParts(), subContrib.getHavingParts()), " AND ").replaceAll("\\(\\+\\)", ""));
- buf.append(")");
- count++;
- }
- }
- if (count > 0) {
- if (count > 1) {
- buf.insert(0, "(");
- buf.append(")");
- contrib.getWhereParts().add(buf.toString());
- }
- else {
- String s = buf.toString();
- if (s.matches("\\(.*\\)")) {
- s = s.substring(1, s.length() - 1).trim();
- }
- contrib.getWhereParts().add(s);
- }
- }
- return contrib;
- }
-
- /**
- * @deprecated use {@link #buildComposerEntityNodeContribution(ComposerEntityNodeData, EntityStrategy)} instead
- */
- @Deprecated
- public String buildComposerEntityNode(ComposerEntityNodeData node, EntityStrategy entityStrategy) throws ProcessingException {
- EntityContribution contrib = buildComposerEntityNodeContribution(node, entityStrategy);
- switch (entityStrategy) {
- case BuildConstraints: {
- if (contrib.getWhereParts().size() > 0) {
- return contrib.getWhereParts().get(0);
- }
- break;
- }
- case BuildQuery: {
- if (contrib.getSelectParts().size() > 0) {
- return contrib.getSelectParts().get(0);
- }
- break;
- }
- }
- return null;
- }
-
- public EntityContribution buildComposerEntityNodeContribution(ComposerEntityNodeData node, EntityStrategy entityStrategy) throws ProcessingException {
- if (getDataModel() == null) {
- throw new ProcessingException("there is no data model set, call FormDataStatementBuilder.setDataModel to set one");
- }
- EntityPath entityPath = DataModelUtility.externalIdToEntityPath(getDataModel(), node.getEntityExternalId());
- IDataModelEntity entity = (entityPath != null ? entityPath.lastElement() : null);
- if (entity == null) {
- LOG.warn("no entity for external id: " + node.getEntityExternalId());
- return null;
- }
- DataModelEntityPartDefinition def = m_dataModelEntMap.get(entity.getClass());
- if (def == null) {
- LOG.warn("no PartDefinition for entity: " + entity);
- return null;
- }
- ComposerEntityNodeData parentEntityNode = getParentNodeOfType(node, ComposerEntityNodeData.class);
- Map<String, String> parentAliasMap = (parentEntityNode != null ? m_aliasMapper.getNodeAliases(parentEntityNode) : m_aliasMapper.getRootAliases());
- String baseStm;
- switch (entityStrategy) {
- case BuildQuery: {
- baseStm = def.getSelectClause();
- break;
- }
- case BuildConstraints: {
- baseStm = def.getWhereClause();
- break;
- }
- default: {
- baseStm = null;
- }
- }
- String stm = null;
- if (baseStm != null) {
- stm = def.createInstance(this, node, entityStrategy, baseStm, parentAliasMap);
- }
- if (stm == null) {
- return null;
- }
- m_aliasMapper.addAllNodeEntitiesFrom(node, stm);
- stm = m_aliasMapper.replaceMarkersByAliases(stm, m_aliasMapper.getNodeAliases(node), parentAliasMap);
- switch (entityStrategy) {
- case BuildQuery: {
- EntityContribution resultContrib = buildComposerEntityUnitContribution(node, entityStrategy, stm, node.getChildNodes(), isConsumeChildContributions(entityPath));
- return resultContrib;
- }
- case BuildConstraints: {
- String s = buildComposerEntityEitherOrSplit(entityStrategy, stm, node.isNegative(), node.getChildNodes());
- EntityContribution resultContrib = (s != null ? EntityContribution.create(s) : new EntityContribution());
- return resultContrib;
- }
- default: {
- return null;
- }
- }
- }
-
- /**
- * only used with strategy {@link EntityStrategy#BuildConstraints}
- * <p>
- * do not use or override this method, it is protected for unit test purposes
- */
- protected String buildComposerEntityEitherOrSplit(EntityStrategy entityStrategy, String baseStm, boolean negative, List<TreeNodeData> childParts) throws ProcessingException {
- if (entityStrategy != EntityStrategy.BuildConstraints) {
- return null;
- }
- List<List<ComposerEitherOrNodeData>> orBlocks = new ArrayList<List<ComposerEitherOrNodeData>>();
- List<TreeNodeData> otherParts = new ArrayList<TreeNodeData>();
- List<ComposerEitherOrNodeData> currentOrBlock = new ArrayList<ComposerEitherOrNodeData>();
- for (TreeNodeData ch : childParts) {
- if (ch instanceof ComposerEitherOrNodeData) {
- ComposerEitherOrNodeData orData = (ComposerEitherOrNodeData) ch;
- if (orData.isBeginOfEitherOr()) {
- if (currentOrBlock.size() > 0) {
- orBlocks.add(new ArrayList<ComposerEitherOrNodeData>(currentOrBlock));
- }
- currentOrBlock.clear();
- }
- currentOrBlock.add(orData);
- }
- else {
- otherParts.add(ch);
- }
- }
- if (currentOrBlock.size() > 0) {
- orBlocks.add(new ArrayList<ComposerEitherOrNodeData>(currentOrBlock));
- currentOrBlock.clear();
- }
- //
- if (orBlocks.size() > 0) {
- StringBuilder blockBuf = new StringBuilder();
- int blockCount = 0;
- for (List<ComposerEitherOrNodeData> list : orBlocks) {
- int elemCount = 0;
- StringBuilder elemBuf = new StringBuilder();
- for (ComposerEitherOrNodeData orData : list) {
- ArrayList<TreeNodeData> subList = new ArrayList<TreeNodeData>();
- subList.addAll(otherParts);
- subList.addAll(orData.getChildNodes());
- String s = buildComposerEntityEitherOrSplit(entityStrategy, baseStm, negative ^ orData.isNegative(), subList);
- if (s != null) {
- if (elemCount > 0) {
- elemBuf.append(" OR ");
- }
- elemBuf.append(" ( ");
- elemBuf.append(s);
- elemBuf.append(" ) ");
- elemCount++;
- }
- }
- if (elemCount > 0) {
- if (blockCount > 0) {
- blockBuf.append(" AND ");
- }
- blockBuf.append(" ( ");
- blockBuf.append(elemBuf.toString());
- blockBuf.append(" ) ");
- blockCount++;
- }
- }
- if (blockCount > 0) {
- return blockBuf.toString();
- }
- return null;
- }
- return buildComposerEntityZeroTraversingSplit(entityStrategy, baseStm, negative, childParts);
- }
-
- /**
- * only used with strategy {@link EntityStrategy#BuildConstraints} and one-to-many entity relation
- * <p>
- * do not use or override this method, it is protected for unit test purposes
- */
- protected String buildComposerEntityZeroTraversingSplit(EntityStrategy entityStrategy, String baseStm, boolean negative, List<TreeNodeData> childParts) throws ProcessingException {
- if (entityStrategy != EntityStrategy.BuildConstraints) {
- return null;
- }
- ArrayList<TreeNodeData> nonZeroChildren = new ArrayList<TreeNodeData>(2);
- for (TreeNodeData ch : childParts) {
- switch (getAttributeKind(ch)) {
- case Undefined:
- case NonAggregation/*non-aggregations must not be handled as zero-traversal*/:
- case NonAggregationNonZeroTraversing:
- case AggregationNonZeroTraversing: {
- nonZeroChildren.add(ch);
- break;
- }
- }
- }
- //
- //create entity part 1
- String entityPart1 = buildComposerEntityUnit(entityStrategy, baseStm, negative, childParts);
- //create negated entity part 2
- String entityPart2 = null;
- if (nonZeroChildren.size() < childParts.size()) {
- // negated negation
- entityPart2 = buildComposerEntityUnit(entityStrategy, baseStm, !negative, nonZeroChildren);
- }
- //combine parts
- if (entityPart2 != null) {
- return " ( " + entityPart1 + " OR " + entityPart2 + " ) ";
- }
- return entityPart1;
- }
-
- /**
- * do not use or override this method, it is protected for unit test purposes
- */
- protected EntityContribution buildComposerEntityUnitContribution(ComposerEntityNodeData node, EntityStrategy entityStrategy, String baseStm, List<TreeNodeData> childParts, boolean consumeChildContributions) throws ProcessingException {
- EntityContribution childContributions = new EntityContribution();
- switch (entityStrategy) {
- case BuildConstraints: {
- ArrayList<TreeNodeData> nonAggregationParts = new ArrayList<TreeNodeData>(childParts.size());
- ArrayList<TreeNodeData> aggregationParts = new ArrayList<TreeNodeData>(2);
- for (TreeNodeData ch : childParts) {
- switch (getAttributeKind(ch)) {
- case Undefined:
- case NonAggregation:
- case NonAggregationNonZeroTraversing: {
- nonAggregationParts.add(ch);
- break;
- }
- case Aggregation:
- case AggregationNonZeroTraversing: {
- aggregationParts.add(ch);
- break;
- }
- }
- }
- //
- EntityContribution subContrib = buildTreeNodes(nonAggregationParts, entityStrategy, AttributeStrategy.BuildConstraintOfAttributeWithContext);
- childContributions.add(subContrib);
- //
- subContrib = buildTreeNodes(aggregationParts, entityStrategy, AttributeStrategy.BuildConstraintOfContext);
- childContributions.add(subContrib);
- //
- subContrib = buildTreeNodes(aggregationParts, entityStrategy, AttributeStrategy.BuildConstraintOfAttribute);
- childContributions.add(subContrib);
- break;
- }
- case BuildQuery: {
- EntityContribution subContrib = buildTreeNodes(childParts, entityStrategy, AttributeStrategy.BuildQueryOfAttributeAndConstraintOfContext);
- childContributions.add(subContrib);
- break;
- }
- }
- //legacy: node may be null from legacy calls
- if (node != null && hasInjections()) {
- injectPreBuildEntity(node, entityStrategy, childContributions);
- }
- EntityContribution parentContributions = createEntityPart(entityStrategy, baseStm, childContributions, consumeChildContributions);
- if (node != null && hasInjections()) {
- injectPostBuildEntity(node, entityStrategy, parentContributions);
- }
- return parentContributions;
- }
-
- /**
- * only used with strategy {@link EntityStrategy#BuildConstraints} and one-to-many entity relation
- * <p>
- * do not use or override this method, it is protected for unit test purposes
- */
- protected String buildComposerEntityUnit(EntityStrategy entityStrategy, String baseStm, boolean negative, List<TreeNodeData> childParts) throws ProcessingException {
- EntityContribution contrib = buildComposerEntityUnitContribution(null, entityStrategy, baseStm, childParts, true);
- List<String> list = contrib.getWhereParts();
- if (list.isEmpty()) {
- list = contrib.getFromParts();
- }
- if (list.isEmpty()) {
- list = contrib.getSelectParts();
- }
- if (list.isEmpty()) {
- return "1=1";
- }
- String s = list.get(0);
- // negation
- if (negative) {
- s = " NOT (" + s + ") ";
- }
- return s;
- }
-
- @SuppressWarnings("cast")
- public EntityContribution buildComposerAttributeNode(final ComposerAttributeNodeData node, AttributeStrategy attributeStrategy) throws ProcessingException {
- if (getDataModel() == null) {
- throw new ProcessingException("there is no data model set, call FormDataStatementBuilder.setDataModel to set one");
- }
- AttributePath attPath = DataModelUtility.externalIdToAttributePath(getDataModel(), node.getAttributeExternalId());
- IDataModelAttribute attribute = (attPath != null ? attPath.getAttribute() : null);
- if (attribute == null) {
- LOG.warn("no attribute for external id: " + node.getAttributeExternalId());
- return new EntityContribution();
- }
- DataModelAttributePartDefinition def = m_dataModelAttMap.get(attribute.getClass());
- if (def == null) {
- Integer agg = node.getAggregationType();
- if (agg != null && agg == AGGREGATION_COUNT) {
- def = new DataModelAttributePartDefinition(null, "1", false);
- }
- }
- if (def == null) {
- LOG.warn("no PartDefinition for attribute: " + attribute);
- return new EntityContribution();
- }
- List<Object> bindValues = new ArrayList<Object>();
- if (node.getValues() != null) {
- bindValues.addAll(Arrays.asList(node.getValues()));
- }
- List<String> bindNames = new ArrayList<String>(bindValues.size());
- for (int i = 0; i < bindValues.size(); i++) {
- bindNames.add("" + (char) (((int) 'a') + i));
- }
- AliasMapper aliasMap = getAliasMapper();
- ComposerEntityNodeData parentEntityNode = FormDataStatementBuilder.getParentNodeOfType(node, ComposerEntityNodeData.class);
- Map<String, String> parentAliasMap = parentEntityNode != null ? aliasMap.getNodeAliases(parentEntityNode) : aliasMap.getRootAliases();
- String stm = null;
- switch (attributeStrategy) {
- case BuildConstraintOfAttribute:
- case BuildConstraintOfContext:
- case BuildConstraintOfAttributeWithContext: {
- stm = def.getWhereClause();
- break;
- }
- case BuildQueryOfAttributeAndConstraintOfContext: {
- stm = def.getSelectClause();
- break;
- }
- }
- EntityContribution contrib = null;
- if (stm != null) {
- contrib = def.createInstance(this, node, attributeStrategy, stm, bindNames, bindValues, parentAliasMap);
- }
- if (contrib == null) {
- contrib = new EntityContribution();
- }
- switch (attributeStrategy) {
- case BuildQueryOfAttributeAndConstraintOfContext: {
- if (contrib.getSelectParts().isEmpty()) {
- contrib.getSelectParts().add("NULL");
- contrib.getGroupByParts().add("NULL");
- }
- break;
- }
- }
- if (hasInjections()) {
- injectPostBuildAttribute(node, attributeStrategy, contrib);
- }
- return contrib;
- }
-
- /**
- * Evaluates the collecting tags in the entity statement and fills in the values of the {@link EntityContribution}.
- * If the contributing tags are missing, the complete part is treated as 'select' on {@link EntityStrategy#BuildQuery}
- * and as 'where' on {@link EntityStrategy#BuildConstraints}
- * <p>
- * Default calls {@link EntityContributionUtility#createEntityPart(String, EntityContribution, boolean)}
- *
- * @param entityStrategy
- * @param entityPartWithTags
- * may contain the collecting tags selectParts, fromParts, whereParts, groupBy, groupByParts, havingParts<br/>
- * as well as the contributing selectPart, fromPart, wherePart, groupByPart, havingPart for the outer calling
- * part.
- * @param childContributions
- * is the set of tags collected by all children
- * @param consumeChildContributions
- * true: consume the child tags inside the entity statement. The returned entity contributions will not
- * contain any of these tags
- * <p>
- * false: don't consume the child tags inside the entity statement. The returned entity contribution contains
- * its onw plus all of these child tags (proxy)
- */
- public EntityContribution createEntityPart(EntityStrategy entityStrategy, String entityPartWithTags, EntityContribution childContributions, boolean consumeChildContributions) throws ProcessingException {
- if (consumeChildContributions) {
- entityPartWithTags = autoCompleteEntityPartTags(entityPartWithTags);
- }
- EntityContribution parentContrib = EntityContributionUtility.mergeContributions(entityStrategy, entityPartWithTags, childContributions, consumeChildContributions);
- return parentContrib;
- }
-
- /**
- * only used with strategy {@link EntityStrategy#BuildConstraints}
- * <p>
- *
- * @return the statement combined with the contributions
- */
- public String createEntityPart(String stm, boolean negative, EntityContribution childContributions) throws ProcessingException {
- EntityContribution contrib = createEntityPart(EntityStrategy.BuildConstraints, stm, childContributions, true);
- List<String> list = contrib.getWhereParts();
- if (list.isEmpty()) {
- list = contrib.getFromParts();
- }
- if (list.isEmpty()) {
- list = contrib.getSelectParts();
- }
- if (list.isEmpty()) {
- return "1=1";
- }
- String s = list.get(0);
- // negation
- if (negative) {
- s = " NOT (" + s + ") ";
- }
- return s;
- }
-
- /**
- * @deprecated moved to {@link EntityContributionUtility}
- */
- @Deprecated
- protected String autoBracketSelectPart(String s) {
- if (s != null && !s.startsWith("(") && s.toLowerCase().contains("select")) {
- return "(" + s + ")";
- }
- return s;
- }
-
- protected String autoCompleteEntityPartTags(String s) {
- if (s == null) {
- return null;
- }
- if (StringUtility.getTag(s, "whereParts") == null) {
- s = s + " <whereParts/>";
- }
- if (StringUtility.getTag(s, "groupBy") == null) {
- s = s + " <groupBy/>";
- }
- s = s.replace("<groupBy/>", "<groupBy>GROUP BY <groupByParts/> HAVING 1=1 <havingParts/></groupBy>");
- return s;
- }
-
- public static final int STATUS_CODE_INVALID_GROUP_BY_PART = EntityContributionUtility.STATUS_CODE_INVALID_GROUP_BY_PART;
-
- /**
- * Check if a group by part is valid, i.e. ist not a SELECT clause.
- * default uses {@link EntityContributionUtility#checkGroupByPart(String)}
- *
- * @throws ProcessingException
- * with {@link IStatus#getCode()} = X
- * @since 3.8
- */
- protected void checkGroupByPart(String groupByPart) throws ProcessingException {
- EntityContributionUtility.checkGroupByPart(groupByPart);
- }
-
- /**
- * adding an attribute as an entity contribution
- * <p>
- * Evaluates the tags in the attribute statement and creates an {@link EntityContribution} based on it.
- *
- * @param stm
- * may contain attribute, fromPart and wherePart tags
- */
- public EntityContribution createAttributePart(AttributeStrategy attributeStrategy, Integer aggregationType, String stm, int operation, List<String> bindNames, List<Object> bindValues, final boolean plainBind, Map<String, String> parentAliasMap) throws ProcessingException {
- if (stm == null) {
- return new EntityContribution();
- }
- //convenience: automatically wrap attribute in attribute tags
- if (stm.indexOf("<attribute>") < 0) {
- stm = "<attribute>" + stm + "</attribute>";
- }
- //convenience: automatically add missing alias on plain attributes, but only if the parent entity has at most 1 alias mapping
- Matcher m = PLAIN_ATTRIBUTE_PATTERN.matcher(stm);
- if (m.find()) {
- if (parentAliasMap.size() == 0) {
- //nop
- }
- else if (parentAliasMap.size() == 1) {
- stm = m.replaceAll("$1@parent." + parentAliasMap.keySet().iterator().next() + "@.$2$3");
- }
- else {
- throw new ProcessingException("composer attribute " + stm + " uses no @...@ alias prefix, but parent has more than 1 alias: " + parentAliasMap);
- }
- }
- boolean isAg = (aggregationType != null && aggregationType != AGGREGATION_NONE);
- EntityContribution contrib = new EntityContribution();
- //special handling of NOT: wrap NOT around complete constraint text and not only in attribute operator
- int positiveOperation;
- boolean negation;
- switch (operation) {
- case OPERATOR_DATE_IS_NOT_TODAY: {
- positiveOperation = OPERATOR_DATE_IS_TODAY;
- negation = true;
- break;
- }
- case OPERATOR_DATE_NEQ: {
- positiveOperation = OPERATOR_DATE_EQ;
- negation = true;
- break;
- }
- case OPERATOR_DATE_TIME_IS_NOT_NOW: {
- positiveOperation = OPERATOR_DATE_TIME_IS_NOW;
- negation = true;
- break;
- }
- case OPERATOR_DATE_TIME_NEQ: {
- positiveOperation = OPERATOR_DATE_TIME_EQ;
- negation = true;
- break;
- }
- case OPERATOR_NEQ: {
- positiveOperation = OPERATOR_EQ;
- negation = true;
- break;
- }
- case OPERATOR_NOT_CONTAINS: {
- positiveOperation = OPERATOR_CONTAINS;
- negation = true;
- break;
- }
- case OPERATOR_NOT_ENDS_WITH: {
- positiveOperation = OPERATOR_ENDS_WITH;
- negation = true;
- break;
- }
- case OPERATOR_NOT_IN: {
- positiveOperation = OPERATOR_IN;
- negation = true;
- break;
- }
- case OPERATOR_NOT_NULL: {
- positiveOperation = OPERATOR_NULL;
- negation = true;
- break;
- }
- case OPERATOR_NOT_STARTS_WITH: {
- positiveOperation = OPERATOR_STARTS_WITH;
- negation = true;
- break;
- }
- case OPERATOR_NUMBER_NOT_NULL: {
- positiveOperation = OPERATOR_NUMBER_NULL;
- negation = true;
- break;
- }
- case OPERATOR_TIME_IS_NOT_NOW: {
- positiveOperation = OPERATOR_TIME_IS_NOW;
- negation = true;
- break;
- }
- default: {
- positiveOperation = operation;
- negation = false;
- }
- }
- //
- String fromPart = StringUtility.getTag(stm, "fromPart");
- stm = StringUtility.removeTag(stm, "fromPart").trim();
- String wherePart = StringUtility.getTag(stm, "wherePart");
- if (wherePart == null) {
- String tmp = StringUtility.removeTag(stm, "attribute").trim();
- if (tmp.length() > 0) {
- wherePart = stm;
- stm = "";
- }
- }
- stm = StringUtility.removeTag(stm, "wherePart").trim();
- String attPart = StringUtility.getTag(stm, "attribute");
- stm = StringUtility.removeTag(stm, "attribute").trim();
- if (stm.length() > 0) {
- LOG.warn("attribute part is not well-formed; contains wherePart tag and also other sql text: " + stm);
- }
- //
- //from
- if (fromPart != null) {
- //resolve aliases in from
- // mis-using 'contrib' as a "node" because real node is not accessible
- m_aliasMapper.addMissingNodeEntitiesFrom(contrib, fromPart);
- Map<String, String> aliasMap = m_aliasMapper.getNodeAliases(contrib);
- parentAliasMap.putAll(aliasMap);
- fromPart = m_aliasMapper.replaceMarkersByAliases(fromPart, parentAliasMap, parentAliasMap);
- contrib.getFromParts().add(fromPart);
- }
- switch (attributeStrategy) {
- //select ... where
- case BuildQueryOfAttributeAndConstraintOfContext: {
- //select
- if (attPart != null) {
- String sql = createSqlPart(aggregationType, attPart, OPERATOR_NONE, bindNames, bindValues, plainBind, parentAliasMap);
- if (sql != null) {
- contrib.getSelectParts().add(sql);
- if (!isAg) {
- contrib.getGroupByParts().add(sql);
- }
- }
- }
- //where
- if (wherePart != null) {
- wherePart = StringUtility.replaceTags(wherePart, "attribute", "1=1").trim();
- String sql = createSqlPart(wherePart, bindNames, bindValues, plainBind, parentAliasMap);
- if (sql != null) {
- contrib.getWhereParts().add(sql);
- }
- }
- break;
- }
- //where / having
- case BuildConstraintOfAttribute: {
- if (attPart != null) {
- String sql = createSqlPart(aggregationType, attPart, positiveOperation, bindNames, bindValues, plainBind, parentAliasMap);
- if (sql != null) {
- if (negation) {
- sql = "NOT(" + sql + ")";
- }
- if (isAg) {
- contrib.getHavingParts().add(sql);
- }
- else {
- contrib.getWhereParts().add(sql);
- }
- }
- }
- break;
- }
- case BuildConstraintOfContext: {
- if (wherePart != null) {
- wherePart = StringUtility.replaceTags(wherePart, "attribute", "1=1").trim();
- String sql = createSqlPart(wherePart, bindNames, bindValues, plainBind, parentAliasMap);
- if (sql != null) {
- contrib.getWhereParts().add(sql);
- }
- }
- break;
- }
- case BuildConstraintOfAttributeWithContext: {
- String whereAndAttPart = (wherePart != null ? wherePart : "") + (wherePart != null && attPart != null ? " AND " : "") + (attPart != null ? "<attribute>" + attPart + "</attribute>" : "");
- if (whereAndAttPart.length() > 0) {
- String sql = createSqlPart(aggregationType, whereAndAttPart, positiveOperation, bindNames, bindValues, plainBind, parentAliasMap);
- if (sql != null) {
- if (negation) {
- sql = "NOT(" + sql + ")";
- }
- contrib.getWhereParts().add(sql);
- }
- }
- break;
- }
- }
- return contrib;
- }
-
- /**
- * adding an attribute as an entity contribution
- * <p>
- *
- * @param stm
- * may contain attribute, fromPart and wherePart tags
- */
- public String createAttributePartSimple(AttributeStrategy attributeStrategy, Integer aggregationType, String stm, int operation, List<String> bindNames, List<Object> bindValues, boolean plainBind, Map<String, String> parentAliasMap) throws ProcessingException {
- EntityContribution contrib = createAttributePart(attributeStrategy, aggregationType, stm, operation, bindNames, bindValues, plainBind, parentAliasMap);
- if (contrib.isEmpty()) {
- return null;
- }
- return ListUtility.format(contrib.getWhereParts(), " AND ");
- }
-
- /**
- * Create sql text, makes bind names unique, and adds all binds to the bind map
- * <p>
- * Convenience for {@link #createSqlPart(AGGREGATION_NONE, String, OPERATOR_NONE, List, List, boolean, Map)}
- */
- public String createSqlPart(String sql, List<String> bindNames, List<Object> bindValues, final boolean plainBind, Map<String, String> parentAliasMap) throws ProcessingException {
- return createSqlPart(AGGREGATION_NONE, sql, OPERATOR_NONE, bindNames, bindValues, plainBind, parentAliasMap);
- }
-
- /**
- * Create sql text, makes bind names unique, and adds all binds to the bind map
- * <p>
- * To use no operator use {@link DataModelConstants#OPERATOR_NONE} and null for binds and values, stm will be
- * decorated and is the result itself
- * <p>
- * To use no aggregation use {@link DataModelConstants#AGGREGATION_NONE}
- */
- public String createSqlPart(final Integer aggregationType, String sql, final int operation, List<String> bindNames, List<Object> bindValues, final boolean plainBind, Map<String, String> parentAliasMap) throws ProcessingException {
- if (sql == null) {
- sql = "";
- }
- if (bindNames == null) {
- bindNames = new ArrayList<String>(0);
- }
- if (bindValues == null) {
- bindValues = new ArrayList<Object>(0);
- }
- // the attribute was of the form: NAME or
- // <attribute>NAME</attribute>
- // make sure there is an attribute tag in the string, if none enclose all
- // by default
- if (sql.indexOf("<attribute>") < 0) {
- sql = "<attribute>" + sql + "</attribute>";
- }
- //convenience: automatically add missing alias on plain attributes, but only if the parent entity has at most 1 alias mapping
- Matcher m = PLAIN_ATTRIBUTE_PATTERN.matcher(sql);
- if (m.find()) {
- if (parentAliasMap.size() == 0) {
- //nop
- }
- else if (parentAliasMap.size() == 1) {
- sql = m.replaceAll("$1@parent." + parentAliasMap.keySet().iterator().next() + "@.$2$3");
- }
- else {
- throw new ProcessingException("root attribute with " + sql + " uses no @...@ alias prefix, but parent has more than 1 alias: " + parentAliasMap);
- }
- }
- //resolve aliases
- sql = m_aliasMapper.replaceMarkersByAliases(sql, parentAliasMap, parentAliasMap);
- // generate unique bind names
- final ArrayList<String> newBindNames = new ArrayList<String>(2);
- for (int i = 0; i < bindNames.size(); i++) {
- String o = bindNames.get(i);
- String n = localizeBindName(o, "__");
- newBindNames.add(n);
- sql = localizeStatement(sql, o, n);
- }
- // part decoration
- final List<Object> valuesFinal = bindValues;
- ITagProcessor processor = new ITagProcessor() {
- @Override
- public String processTag(String tagName, String a) {
- return createSqlOpValuePart(aggregationType, a, operation, newBindNames, valuesFinal, plainBind);
- }
- };
- return StringUtility.replaceTags(sql, "attribute", processor);
- }
-
- public String createSqlOpValuePart(Integer aggregationType, String sql, int operation, List<String> bindNames, List<Object> bindValues, boolean plainBind) {
- String[] names = (bindNames != null ? bindNames.toArray(new String[bindNames.size()]) : new String[0]);
- Object[] values = (bindValues != null ? bindValues.toArray(new Object[bindValues.size()]) : new Object[0]);
- if (plainBind && operation != OPERATOR_NONE) {
- //rewrite bindNames by plain values
- for (int i = 0; i < names.length; i++) {
- names[i] = ISqlStyle.PLAIN_BIND_MARKER_PREFIX + m_sqlStyle.toPlainText(values[i]);
- }
- }
- //
- if (aggregationType != null && aggregationType != AGGREGATION_NONE) {
- switch (aggregationType) {
- case AGGREGATION_COUNT: {
- sql = m_sqlStyle.toAggregationCount(sql);
- break;
- }
- case AGGREGATION_MIN: {
- sql = m_sqlStyle.toAggregationMin(sql);
- break;
- }
- case AGGREGATION_MAX: {
- sql = m_sqlStyle.toAggregationMax(sql);
- break;
- }
- case AGGREGATION_SUM: {
- sql = m_sqlStyle.toAggregationSum(sql);
- break;
- }
- case AGGREGATION_AVG: {
- sql = m_sqlStyle.toAggregationAvg(sql);
- break;
- }
- case AGGREGATION_MEDIAN: {
- sql = m_sqlStyle.toAggregationMedian(sql);
- break;
- }
- }
- }
- else if (isZeroTraversingAttribute(operation, values)) {
- sql = m_sqlStyle.getNvlToken() + "(" + sql + ",0)";
- }
- //
- switch (operation) {
- case OPERATOR_NONE: {
- if (plainBind) {
- if (names != null) {
- HashMap<String, String> tokenValue = new HashMap<String, String>();
- for (int i = 0; i < names.length; i++) {
- tokenValue.put(names[i], m_sqlStyle.toPlainText(values[i]));
- }
- BindModel m = new BindParser(sql).parse();
- IToken[] tokens = m.getIOTokens();
- if (tokens != null) {
- for (IToken iToken : tokens) {
- if (iToken instanceof ValueInputToken) {
- ValueInputToken t = (ValueInputToken) iToken;
- t.setPlainValue(true);
- t.setReplaceToken(tokenValue.get(t.getName()));
- }
- }
- }
- sql = m.getFilteredStatement();
- }
- }
- else {
- addBinds(names, values);
- }
- return sql;
- }
- case OPERATOR_BETWEEN: {
- if (!plainBind) {
- addBinds(names, values);
- }
- if (values[0] == null) {
- return m_sqlStyle.createLE(sql, names[1]);
- }
- else if (values[1] == null) {
- return m_sqlStyle.createGE(sql, names[0]);
- }
- else {
- return m_sqlStyle.createBetween(sql, names[0], names[1]);
- }
- }
- case OPERATOR_DATE_BETWEEN: {
- if (!plainBind) {
- addBinds(names, values);
- }
- if (values[0] == null) {
- return m_sqlStyle.createDateLE(sql, names[1]);
- }
- else if (values[1] == null) {
- return m_sqlStyle.createDateGE(sql, names[0]);
- }
- else {
- return m_sqlStyle.createDateBetween(sql, names[0], names[1]);
- }
- }
- case OPERATOR_DATE_TIME_BETWEEN: {
- if (!plainBind) {
- addBinds(names, values);
- }
- if (values[0] == null) {
- return m_sqlStyle.createDateTimeLE(sql, names[1]);
- }
- else if (values[1] == null) {
- return m_sqlStyle.createDateTimeGE(sql, names[0]);
- }
- else {
- return m_sqlStyle.createDateTimeBetween(sql, names[0], names[1]);
- }
- }
- case OPERATOR_EQ: {
- if (!plainBind) {
- addBinds(names, values);
- }
- return m_sqlStyle.createEQ(sql, names[0]);
- }
- case OPERATOR_DATE_EQ: {
- if (!plainBind) {
- addBinds(names, values);
- }
- return m_sqlStyle.createDateEQ(sql, names[0]);
- }
- case OPERATOR_DATE_TIME_EQ: {
- if (!plainBind) {
- addBinds(names, values);
- }
- return m_sqlStyle.createDateTimeEQ(sql, names[0]);
- }
- case OPERATOR_GE: {
- if (!plainBind) {
- addBinds(names, values);
- }
- return m_sqlStyle.createGE(sql, names[0]);
- }
- case OPERATOR_DATE_GE: {
- if (!plainBind) {
- addBinds(names, values);
- }
- return m_sqlStyle.createDateGE(sql, names[0]);
- }
- case OPERATOR_DATE_TIME_GE: {
- if (!plainBind) {
- addBinds(names, values);
- }
- return m_sqlStyle.createDateTimeGE(sql, names[0]);
- }
- case OPERATOR_GT: {
- if (!plainBind) {
- addBinds(names, values);
- }
- return m_sqlStyle.createGT(sql, names[0]);
- }
- case OPERATOR_DATE_GT: {
- if (!plainBind) {
- addBinds(names, values);
- }
- return m_sqlStyle.createDateGT(sql, names[0]);
- }
- case OPERATOR_DATE_TIME_GT: {
- if (!plainBind) {
- addBinds(names, values);
- }
- return m_sqlStyle.createDateTimeGT(sql, names[0]);
- }
- case OPERATOR_LE: {
- if (!plainBind) {
- addBinds(names, values);
- }
- return m_sqlStyle.createLE(sql, names[0]);
- }
- case OPERATOR_DATE_LE: {
- if (!plainBind) {
- addBinds(names, values);
- }
- return m_sqlStyle.createDateLE(sql, names[0]);
- }
- case OPERATOR_DATE_TIME_LE: {
- if (!plainBind) {
- addBinds(names, values);
- }
- return m_sqlStyle.createDateTimeLE(sql, names[0]);
- }
- case OPERATOR_LT: {
- if (!plainBind) {
- addBinds(names, values);
- }
- return m_sqlStyle.createLT(sql, names[0]);
- }
- case OPERATOR_DATE_LT: {
- if (!plainBind) {
- addBinds(names, values);
- }
- return m_sqlStyle.createDateLT(sql, names[0]);
- }
- case OPERATOR_DATE_TIME_LT: {
- if (!plainBind) {
- addBinds(names, values);
- }
- return m_sqlStyle.createDateTimeLT(sql, names[0]);
- }
- case OPERATOR_NEQ: {
- if (!plainBind) {
- addBinds(names, values);
- }
- return m_sqlStyle.createNEQ(sql, names[0]);
- }
- case OPERATOR_DATE_NEQ: {
- if (!plainBind) {
- addBinds(names, values);
- }
- return m_sqlStyle.createDateNEQ(sql, names[0]);
- }
- case OPERATOR_DATE_TIME_NEQ: {
- if (!plainBind) {
- addBinds(names, values);
- }
- return m_sqlStyle.createDateTimeNEQ(sql, names[0]);
- }
- case OPERATOR_DATE_IS_IN_DAYS: {
- if (!plainBind) {
- addBinds(names, values);
- }
- return m_sqlStyle.createDateIsInDays(sql, names[0]);
- }
- case OPERATOR_DATE_IS_IN_GE_DAYS: {
- if (!plainBind) {
- addBinds(names, values);
- }
- return m_sqlStyle.createDateIsInGEDays(sql, names[0]);
- }
- case OPERATOR_DATE_IS_IN_GE_MONTHS: {
- if (!plainBind) {
- addBinds(names, values);
- }
- return m_sqlStyle.createDateIsInGEMonths(sql, names[0]);
- }
- case OPERATOR_DATE_IS_IN_LE_DAYS: {
- if (!plainBind) {
- addBinds(names, values);
- }
- return m_sqlStyle.createDateIsInLEDays(sql, names[0]);
- }
- case OPERATOR_DATE_IS_IN_LE_MONTHS: {
- if (!plainBind) {
- addBinds(names, values);
- }
- return m_sqlStyle.createDateIsInLEMonths(sql, names[0]);
- }
- case OPERATOR_DATE_IS_IN_LAST_DAYS: {
- if (!plainBind) {
- addBinds(names, values);
- }
- return m_sqlStyle.createDateIsInLastDays(sql, names[0]);
- }
- case OPERATOR_DATE_IS_IN_LAST_MONTHS: {
- if (!plainBind) {
- addBinds(names, values);
- }
- return m_sqlStyle.createDateIsInLastMonths(sql, names[0]);
- }
- case OPERATOR_DATE_IS_IN_MONTHS: {
- if (!plainBind) {
- addBinds(names, values);
- }
- return m_sqlStyle.createDateIsInMonths(sql, names[0]);
- }
- case OPERATOR_DATE_IS_IN_NEXT_DAYS: {
- if (!plainBind) {
- addBinds(names, values);
- }
- return m_sqlStyle.createDateIsInNextDays(sql, names[0]);
- }
- case OPERATOR_DATE_IS_IN_NEXT_MONTHS: {
- if (!plainBind) {
- addBinds(names, values);
- }
- return m_sqlStyle.createDateIsInNextMonths(sql, names[0]);
- }
- case OPERATOR_DATE_IS_NOT_TODAY: {
- return m_sqlStyle.createDateIsNotToday(sql);
- }
- case OPERATOR_DATE_IS_TODAY: {
- return m_sqlStyle.createDateIsToday(sql);
- }
- case OPERATOR_DATE_TIME_IS_IN_GE_HOURS: {
- if (!plainBind) {
- addBinds(names, values);
- }
- return m_sqlStyle.createDateTimeIsInGEHours(sql, names[0]);
- }
- case OPERATOR_DATE_TIME_IS_IN_GE_MINUTES: {
- if (!plainBind) {
- addBinds(names, values);
- }
- return m_sqlStyle.createDateTimeIsInGEMinutes(sql, names[0]);
- }
- case OPERATOR_DATE_TIME_IS_IN_LE_HOURS: {
- if (!plainBind) {
- addBinds(names, values);
- }
- return m_sqlStyle.createDateTimeIsInLEHours(sql, names[0]);
- }
- case OPERATOR_DATE_TIME_IS_IN_LE_MINUTES: {
- if (!plainBind) {
- addBinds(names, values);
- }
- return m_sqlStyle.createDateTimeIsInLEMinutes(sql, names[0]);
- }
- case OPERATOR_DATE_TIME_IS_NOT_NOW: {
- return m_sqlStyle.createDateTimeIsNotNow(sql);
- }
- case OPERATOR_DATE_TIME_IS_NOW: {
- return m_sqlStyle.createDateTimeIsNow(sql);
- }
- case OPERATOR_ENDS_WITH: {
- if (!plainBind) {
- addBind(names[0], m_sqlStyle.toLikePattern(values[0]));
- }
- return m_sqlStyle.createEndsWith(sql, names[0]);
- }
- case OPERATOR_NOT_ENDS_WITH: {
- if (!plainBind) {
- addBind(names[0], m_sqlStyle.toLikePattern(values[0]));
- }
- return m_sqlStyle.createNotEndsWith(sql, names[0]);
- }
- case OPERATOR_IN: {
- if (!plainBind) {
- addBinds(names, values);
- return m_sqlStyle.createIn(sql, names[0]);
- }
- return m_sqlStyle.createInList(sql, values[0]);
- }
- case OPERATOR_CONTAINS: {
- if (!plainBind) {
- addBind(names[0], m_sqlStyle.toLikePattern(values[0]));
- }
- return m_sqlStyle.createContains(sql, names[0]);
- }
- case OPERATOR_LIKE: {
- if (!plainBind) {
- addBind(names[0], m_sqlStyle.toLikePattern(values[0]));
- }
- return m_sqlStyle.createLike(sql, names[0]);
- }
- case OPERATOR_NOT_IN: {
- if (!plainBind) {
- addBinds(names, values);
- return m_sqlStyle.createNotIn(sql, names[0]);
- }
- return m_sqlStyle.createNotInList(sql, values[0]);
- }
- case OPERATOR_NOT_CONTAINS: {
- if (!plainBind) {
- addBind(names[0], m_sqlStyle.toLikePattern(values[0]));
- }
- return m_sqlStyle.createNotContains(sql, names[0]);
- }
- case OPERATOR_NOT_NULL: {
- return m_sqlStyle.createNotNull(sql);
- }
- case OPERATOR_NUMBER_NOT_NULL: {
- return m_sqlStyle.createNumberNotNull(sql);
- }
- case OPERATOR_NULL: {
- return m_sqlStyle.createNull(sql);
- }
- case OPERATOR_NUMBER_NULL: {
- return m_sqlStyle.createNumberNull(sql);
- }
- case OPERATOR_STARTS_WITH: {
- if (!plainBind) {
- addBind(names[0], m_sqlStyle.toLikePattern(values[0]));
- }
- return m_sqlStyle.createStartsWith(sql, names[0]);
- }
- case OPERATOR_NOT_STARTS_WITH: {
- if (!plainBind) {
- addBind(names[0], m_sqlStyle.toLikePattern(values[0]));
- }
- return m_sqlStyle.createNotStartsWith(sql, names[0]);
- }
- case OPERATOR_TIME_IS_IN_GE_HOURS: {
- if (!plainBind) {
- addBinds(names, values);
- }
- return m_sqlStyle.createTimeIsInGEHours(sql, names[0]);
- }
- case OPERATOR_TIME_IS_IN_GE_MINUTES: {
- if (!plainBind) {
- addBinds(names, values);
- }
- return m_sqlStyle.createTimeIsInGEMinutes(sql, names[0]);
- }
- case OPERATOR_TIME_IS_IN_HOURS: {
- if (!plainBind) {
- addBinds(names, values);
- }
- return m_sqlStyle.createTimeIsInHours(sql, names[0]);
- }
- case OPERATOR_TIME_IS_IN_LE_HOURS: {
- if (!plainBind) {
- addBinds(names, values);
- }
- return m_sqlStyle.createTimeIsInLEHours(sql, names[0]);
- }
- case OPERATOR_TIME_IS_IN_LE_MINUTES: {
- if (!plainBind) {
- addBinds(names, values);
- }
- return m_sqlStyle.createTimeIsInLEMinutes(sql, names[0]);
- }
- case OPERATOR_TIME_IS_IN_MINUTES: {
- if (!plainBind) {
- addBinds(names, values);
- }
- return m_sqlStyle.createTimeIsInMinutes(sql, names[0]);
- }
- case OPERATOR_TIME_IS_NOW: {
- return m_sqlStyle.createTimeIsNow(sql);
- }
- case OPERATOR_TIME_IS_NOT_NOW: {
- return m_sqlStyle.createTimeIsNotNow(sql);
- }
- default: {
- throw new IllegalArgumentException("invalid operator: " + operation);
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc.builder;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.scout.commons.ClassIdentifier;
+import org.eclipse.scout.commons.ListUtility;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.StringUtility.ITagProcessor;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.holders.NVPair;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.commons.parsers.BindModel;
+import org.eclipse.scout.commons.parsers.BindParser;
+import org.eclipse.scout.commons.parsers.token.IToken;
+import org.eclipse.scout.commons.parsers.token.ValueInputToken;
+import org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle;
+import org.eclipse.scout.rt.shared.data.form.AbstractFormData;
+import org.eclipse.scout.rt.shared.data.form.fields.AbstractFormFieldData;
+import org.eclipse.scout.rt.shared.data.form.fields.composer.ComposerAttributeNodeData;
+import org.eclipse.scout.rt.shared.data.form.fields.composer.ComposerEitherOrNodeData;
+import org.eclipse.scout.rt.shared.data.form.fields.composer.ComposerEntityNodeData;
+import org.eclipse.scout.rt.shared.data.form.fields.treefield.AbstractTreeFieldData;
+import org.eclipse.scout.rt.shared.data.form.fields.treefield.TreeNodeData;
+import org.eclipse.scout.rt.shared.data.model.AttributePath;
+import org.eclipse.scout.rt.shared.data.model.DataModelConstants;
+import org.eclipse.scout.rt.shared.data.model.DataModelUtility;
+import org.eclipse.scout.rt.shared.data.model.EntityPath;
+import org.eclipse.scout.rt.shared.data.model.IDataModel;
+import org.eclipse.scout.rt.shared.data.model.IDataModelAttribute;
+import org.eclipse.scout.rt.shared.data.model.IDataModelEntity;
+
+/**
+ * <pre>
+ * Usage:
+ * <ul>
+ * <li>call {@link #setDataModelEntityDefinition(Class, String, boolean)}, {@link #setDataModelAttributeDefinition(Class, String, boolean)} and {@link #addStatementMapping(Class, String, int, int, boolean)}
+ * for all member classes in the FormData</li>
+ * <li>call {@link #build(AbstractFormData)}</li>
+ * <li>add {@link #getWhereConstraints()} to the base sql statement (starts with an AND)</li>
+ * <li>add {@link #getBindMap()} to the sql bind bases</li>
+ * </pre>
+ * <p>
+ * The method {@link #buildComposerEntityNode(ComposerEntityNodeData)} corrects composer trees for correct handling of
+ * zero-traversing aggregation attributes and normal attributes using
+ * {@link #isZeroTraversingAttribute(ComposerAttributeNodeData)}.<br>
+ * An attribute is zero-traversing when it contains 0 and therefore null/non-existence together with the operator &lt;,
+ * &gt;, &lt;=, &gt;=, =, !=, &lt;&gt;, between. Only numeric attributes can be zero-traversing. Dates never are.
+ * <p>
+ * Examples of zero-traversing:
+ * <ul>
+ * <li>Count(Person) &lt; 3</li>
+ * <li>priority between -10 and 10</li>
+ * <li>Sum(payment) &lt;= 1'000'000</li>
+ * <li></li>
+ * </ul>
+ * <p>
+ * Examples of <b>not</b> zero-traversing:
+ * <ul>
+ * <li>Count(Person) between 2 and 4</li>
+ * <li>priority between 1 and 5</li>
+ * <li>Sum(payment) &gt;= 1'000'000</li>
+ * <li></li>
+ * </ul>
+ * <p>
+ * When an entity e contains zero-traversing <b>aggregation</b> attributes (such as Count(.), Sum(.)) z1..zn and
+ * non-zero-traversing attributes a1..an it is splittet into 2 entities as follows:<br>
+ * <code>
+ * <pre>either (
+ * e
+ * a1..an
+ * z1..zn
+ * )
+ * or NOT (
+ * e
+ * a1..an
+ * )
+ * </pre>
+ * </code>
+ * <p>
+ * In sql this would be something like<br>
+ * <code>
+ * <pre>exists (select 1 from Person ... where a1 and z1 groupy by ... having a2 and z2)
+ * </pre>
+ * </code> will be transformed to <code>
+ * <pre>
+ * (
+ * exists (select 1 from Person ... where a1 and z1 groupy by ... having a2 and z2)
+ * OR NOT
+ * exists (select 1 from Person ... where a1 groupy by ... having a2)
+ * )
+ * </pre>
+ * </code>
+ * <p>
+ * Zero-traversing non aggregation attributes are simply wrapped using NLV(attribute).
+ * <p>
+ * That way non-existent matches are added to the result, which matches the expected behaviour.
+ *
+ * @author imo
+ */
+@SuppressWarnings("deprecation")
+public class FormDataStatementBuilder implements DataModelConstants {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(FormDataStatementBuilder.class);
+ private static final Pattern PLAIN_ATTRIBUTE_PATTERN = Pattern.compile("(<attribute>)([a-zA-Z_][a-zA-Z0-9_]*)(</attribute>)");
+
+ /**
+ * Strategy used in
+ * {@link DataModelAttributePartDefinition#createInstance(FormDataStatementBuilder, ComposerAttributeNodeData, AttributeStrategy, String, List, List, Map)}
+ */
+ public static enum AttributeStrategy {
+ /**
+ * Assuming the constraint "SALARY &gt;= 1000" and the attribute statement
+ *
+ * <pre>
+ * &lt;attribute&gt;@Person@.SALARY&lt;/attribute&gt;
+ * AND ACTIVE=1
+ * </pre>
+ *
+ * this strategy only creates the contraint of the attribute part
+ *
+ * <pre>
+ * {@link EntityContribution#getWhereParts()} = SALARY&gt;=1000
+ * </pre>
+ */
+ BuildConstraintOfAttribute,
+ /**
+ * Assuming the constraint "SALARY &gt;= 1000" and the attribute statement
+ *
+ * <pre>
+ * &lt;attribute&gt;@Person@.SALARY&lt;/attribute&gt;
+ * AND ACTIVE=1
+ * </pre>
+ *
+ * this strategy only creates the contraint of the context (excluding the attribute)
+ *
+ * <pre>
+ * {@link EntityContribution#getWhereParts()} = ACTIVE=1
+ * </pre>
+ */
+ BuildConstraintOfContext,
+ /**
+ * Assuming the constraint "SALARY &gt;= 1000" and the attribute statement
+ *
+ * <pre>
+ * &lt;attribute&gt;@Person@.SALARY&lt;/attribute&gt;
+ * AND ACTIVE=1
+ * </pre>
+ *
+ * this strategy creates the contraint of the context and the attribute
+ *
+ * <pre>
+ * {@link EntityContribution#getWhereParts()} = SALARY&gt;=1000 AND ACTIVE=1
+ * </pre>
+ */
+ BuildConstraintOfAttributeWithContext,
+ /**
+ * Assuming the query "SALARY" and the attribute statement
+ *
+ * <pre>
+ * &lt;attribute&gt;@Person@.SALARY&lt;/attribute&gt;
+ * AND ACTIVE=1
+ * </pre>
+ *
+ * this strategy creates the select query part of the attribute and adds constraints for the context
+ *
+ * <pre>
+ * {@link EntityContribution#getSelectParts()} = SALARY
+ * {@link EntityContribution#getWhereParts()} = ACTIVE=1
+ * </pre>
+ */
+ BuildQueryOfAttributeAndConstraintOfContext,
+ }
+
+ /**
+ * Strategy used in
+ * {@link DataModelEntityPartDefinition#createInstance(FormDataStatementBuilder, ComposerEntityNodeData, EntityStrategy, String, Map)}
+ */
+ public static enum EntityStrategy {
+ BuildConstraints,
+ BuildQuery,
+ }
+
+ public static enum AttributeKind {
+ /**
+ * no attribute node
+ */
+ Undefined,
+ NonAggregation,
+ Aggregation,
+ NonAggregationNonZeroTraversing,
+ AggregationNonZeroTraversing,
+ }
+
+ private ISqlStyle m_sqlStyle;
+ private IDataModel m_dataModel;
+ private AliasMapper m_aliasMapper;
+ private Map<Class<?>, DataModelAttributePartDefinition> m_dataModelAttMap;
+ private Map<Class<?>, DataModelEntityPartDefinition> m_dataModelEntMap;
+ private List<BasicPartDefinition> m_basicDefs;
+ private Map<String, Object> m_bindMap;
+ private AtomicInteger m_sequenceProvider;
+ private StringBuffer m_where;
+ private List<IFormDataStatementBuilderInjection> m_formDataStatementBuilderInjections;
+
+ /**
+ * @param sqlStyle
+ */
+ public FormDataStatementBuilder(ISqlStyle sqlStyle) {
+ m_sqlStyle = sqlStyle;
+ m_aliasMapper = new AliasMapper();
+ m_bindMap = new HashMap<String, Object>();
+ m_dataModelAttMap = new HashMap<Class<?>, DataModelAttributePartDefinition>();
+ m_dataModelEntMap = new HashMap<Class<?>, DataModelEntityPartDefinition>();
+ m_basicDefs = new ArrayList<BasicPartDefinition>();
+ setSequenceProvider(new AtomicInteger(0));
+ }
+
+ public IDataModel getDataModel() {
+ return m_dataModel;
+ }
+
+ /**
+ * @return true to consume child contributions by this entity.
+ * Default returns true. If the entity is a 1:1 or 1:0 relation to its base and its sql contribution is just a
+ * join clause or similar, this method must return false to let the parent entity colelct all parts. Use
+ * <code>return {@link IDataModelEntity#isOneToMany()}</code> when such behaviour is implemented.
+ */
+ protected boolean isConsumeChildContributions(EntityPath ePath) {
+ return true;
+ //return ePath.lastElement().isOneToMany();
+ }
+
+ /**
+ * add an injection that allows to manipulate every call to
+ * {@link #buildComposerAttributeNode(ComposerAttributeNodeData, AttributeStrategy)} and
+ * {@link #buildComposerEntityNodeContribution(ComposerEntityNodeData, EntityStrategy)}
+ */
+ public void addFormDataStatementBuilderInjection(IFormDataStatementBuilderInjection j) {
+ if (j == null) {
+ return;
+ }
+ if (m_formDataStatementBuilderInjections == null) {
+ m_formDataStatementBuilderInjections = new ArrayList<IFormDataStatementBuilderInjection>(1);
+ }
+ m_formDataStatementBuilderInjections.add(j);
+ }
+
+ public void removeFormDataStatementBuilderInjection(IFormDataStatementBuilderInjection j) {
+ if (j == null) {
+ return;
+ }
+ if (m_formDataStatementBuilderInjections != null) {
+ m_formDataStatementBuilderInjections.remove(j);
+ if (m_formDataStatementBuilderInjections.isEmpty()) {
+ m_formDataStatementBuilderInjections = null;
+ }
+ }
+ }
+
+ private boolean hasInjections() {
+ return (m_formDataStatementBuilderInjections != null && !m_formDataStatementBuilderInjections.isEmpty());
+ }
+
+ private void injectPreBuildEntity(ComposerEntityNodeData node, EntityStrategy entityStrategy, EntityContribution childContrib) {
+ if (m_formDataStatementBuilderInjections != null) {
+ for (IFormDataStatementBuilderInjection j : m_formDataStatementBuilderInjections) {
+ j.preBuildEntity(node, entityStrategy, childContrib);
+ }
+ }
+ }
+
+ private void injectPostBuildEntity(ComposerEntityNodeData node, EntityStrategy entityStrategy, EntityContribution parentContrib) {
+ if (m_formDataStatementBuilderInjections != null) {
+ for (IFormDataStatementBuilderInjection j : m_formDataStatementBuilderInjections) {
+ j.postBuildEntity(node, entityStrategy, parentContrib);
+ }
+ }
+ }
+
+ private void injectPostBuildAttribute(ComposerAttributeNodeData node, AttributeStrategy attributeStrategy, EntityContribution contrib) {
+ if (m_formDataStatementBuilderInjections != null) {
+ for (IFormDataStatementBuilderInjection j : m_formDataStatementBuilderInjections) {
+ j.postBuildAttribute(node, attributeStrategy, contrib);
+ }
+ }
+ }
+
+ public void setDataModel(IDataModel dataModel) {
+ m_dataModel = dataModel;
+ }
+
+ /**
+ * @returns the reference to the sequence provider to be used outside for additional sequenced items or sub statemet
+ * builders
+ */
+ public AtomicInteger getSequenceProvider() {
+ return m_sequenceProvider;
+ }
+
+ /**
+ * use another sequence provider (counts 0,1,2... for aliases)
+ */
+ public void setSequenceProvider(AtomicInteger sequenceProvider) {
+ m_sequenceProvider = sequenceProvider;
+ m_aliasMapper.setSequenceProvider(m_sequenceProvider);
+ }
+
+ /**
+ * Define the statement part for a sql part. For composer attributes and entites use
+ * {@link #setDataModelAttributeDefinition(DataModelAttributePartDefinition)} and
+ * {@link #setDataModelEntityDefinition(DataModelEntityPartDefinition)}
+ * <p>
+ * <b>Number, Date, String, Boolean field</b>:<br>
+ * The sqlAttribute is something like <code>@PERSON@.LAST_NAME</code><br>
+ * When multiple occurrences are simultaneously used, the sqlAttribute may be written as
+ * <code>(&lt;attribute&gt;@PERSON@.ORDER_STATUS&lt;/attribute&gt; OR &lt;attribute&gt;@PERSON@.DELIVERY_STATUS&lt;/attribute&gt;)</code>
+ * <p>
+ * The operator and aggregationType are required, unless a {@link BasicPartDefinition} is used.
+ */
+ public void setBasicDefinition(Class<?> fieldType, String sqlAttribute, int operator) {
+ setBasicDefinition(new BasicPartDefinition(fieldType, sqlAttribute, operator));
+ }
+
+ /**
+ * see {@link #setBasicDefinition(Class, String, int)}
+ */
+ public void setBasicDefinition(ClassIdentifier fieldTypeIdentifier, String sqlAttribute, int operator) {
+ setBasicDefinition(new BasicPartDefinition(fieldTypeIdentifier, sqlAttribute, operator));
+ }
+
+ /**
+ * see {@link #setBasicDefinition(Class, String, int)}
+ */
+ public void setBasicDefinition(Class<?> fieldType, String sqlAttribute, int operator, boolean plainBind) {
+ setBasicDefinition(new BasicPartDefinition(fieldType, sqlAttribute, operator, plainBind));
+ }
+
+ /**
+ * see {@link #setBasicDefinition(Class, String, int)}
+ */
+ public void setBasicDefinition(ClassIdentifier fieldTypeIdentifier, String sqlAttribute, int operator, boolean plainBind) {
+ setBasicDefinition(new BasicPartDefinition(fieldTypeIdentifier, sqlAttribute, operator, plainBind));
+ }
+
+ /**
+ * see {@link #setBasicDefinition(Class, String, int)}
+ */
+ public void setBasicDefinition(Class<?>[] fieldTypes, String sqlAttribute, int operator) {
+ setBasicDefinition(new BasicPartDefinition(fieldTypes, sqlAttribute, operator, false));
+ }
+
+ /**
+ * see {@link #setBasicDefinition(Class, String, int)}
+ */
+ public void setBasicDefinition(ClassIdentifier[] fieldTypeIdentifiers, String sqlAttribute, int operator) {
+ setBasicDefinition(new BasicPartDefinition(fieldTypeIdentifiers, sqlAttribute, operator, false));
+ }
+
+ /**
+ * see {@link #setBasicDefinition(Class, String, int)}
+ */
+ public void setBasicDefinition(BasicPartDefinition def) {
+ m_basicDefs.add(def);
+ }
+
+ /**
+ * @deprecated use setBasicDefinition instead
+ */
+ @Deprecated
+ public void setValueDefinition(Class<?> fieldType, String sqlAttribute, int operator) {
+ setValueDefinition(new ValuePartDefinition(fieldType, sqlAttribute, operator));
+ }
+
+ /**
+ * @deprecated use setBasicDefinition instead
+ */
+ @Deprecated
+ public void setValueDefinition(ClassIdentifier fieldTypeIdentifier, String sqlAttribute, int operator) {
+ setValueDefinition(new ValuePartDefinition(fieldTypeIdentifier, sqlAttribute, operator));
+ }
+
+ /**
+ * @deprecated use setBasicDefinition instead
+ */
+ @Deprecated
+ public void setValueDefinition(Class<?> fieldType, String sqlAttribute, int operator, boolean plainBind) {
+ setValueDefinition(new ValuePartDefinition(fieldType, sqlAttribute, operator, plainBind));
+ }
+
+ /**
+ * @deprecated use setBasicDefinition instead
+ */
+ @Deprecated
+ public void setValueDefinition(ClassIdentifier fieldTypeIdentifier, String sqlAttribute, int operator, boolean plainBind) {
+ setValueDefinition(new ValuePartDefinition(fieldTypeIdentifier, sqlAttribute, operator, plainBind));
+ }
+
+ /**
+ * @deprecated use setBasicDefinition instead
+ */
+ @Deprecated
+ public void setValueDefinition(Class<?>[] fieldTypes, String sqlAttribute, int operator) {
+ setValueDefinition(new ValuePartDefinition(fieldTypes, sqlAttribute, operator, false));
+ }
+
+ /**
+ * @deprecated use setBasicDefinition instead
+ */
+ @Deprecated
+ public void setValueDefinition(ClassIdentifier[] fieldTypeIdentifiers, String sqlAttribute, int operator) {
+ setValueDefinition(new ValuePartDefinition(fieldTypeIdentifiers, sqlAttribute, operator, false));
+ }
+
+ /**
+ * @deprecated use setBasicDefinition instead
+ */
+ @Deprecated
+ public void setValueDefinition(ValuePartDefinition def) {
+ m_basicDefs.add(def);
+ }
+
+ /**
+ * <b>Data model attribute</b>:<br>
+ * The sqlAttribute is something like LAST_NAME, STATUS or @PERSON@.LAST_NAME, @PERSON@.STATUS.
+ *
+ * @PERSON@ will be replaced by the parent entitie's generated alias.
+ * <p>
+ * The @PERSON@ prefix is added automatically if missing, but only if the entity where the attribute is
+ * contained has only <b>one</b> alias.<br>
+ * When multiple occurrences are simultaneously used, the sqlAttribute may be written as
+ * <code>(&lt;attribute&gt;ORDER_STATUS&lt;/attribute&gt; OR &lt;attribute&gt;DELIVERY_STATUS&lt;/attribute&gt;)</code>
+ */
+ public void setDataModelAttributeDefinition(Class<? extends IDataModelAttribute> attributeType, String sqlAttribute) {
+ setDataModelAttributeDefinition(attributeType, sqlAttribute, false);
+ }
+
+ /**
+ * see {@link #setDataModelAttributeDefinition(Class, String)}
+ */
+ public void setDataModelAttributeDefinition(Class<? extends IDataModelAttribute> attributeType, String sqlAttribute, boolean plainBind) {
+ setDataModelAttributeDefinition(new DataModelAttributePartDefinition(attributeType, sqlAttribute, plainBind));
+ }
+
+ /**
+ * see {@link #setDataModelAttributeDefinition(Class, String)}
+ */
+ public void setDataModelAttributeDefinition(Class<? extends IDataModelAttribute> attributeType, String whereClause, String selectClause, boolean plainBind) {
+ setDataModelAttributeDefinition(new DataModelAttributePartDefinition(attributeType, whereClause, selectClause, plainBind));
+ }
+
+ /**
+ * see {@link #setDataModelAttributeDefinition(Class, String)}
+ */
+ public void setDataModelAttributeDefinition(DataModelAttributePartDefinition def) {
+ m_dataModelAttMap.put(def.getAttributeType(), def);
+ }
+
+ /**
+ * see {@link #setDataModelEntityDefinition(Class, String, String)}
+ */
+ public void setDataModelEntityDefinition(Class<? extends IDataModelEntity> entityType, String whereClause) {
+ setDataModelEntityDefinition(new DataModelEntityPartDefinition(entityType, whereClause));
+ }
+
+ /**
+ * <b>Data model entity</b>:<br>
+ * The whereClause is something like <code><pre>
+ * EXISTS (
+ * SELECT 1
+ * FROM PERSON @PERSON@
+ * WHERE @PERSON@.PERSON_ID=@parent.PERSON@.PERSON_ID
+ * &lt;whereParts/&gt;
+ * &lt;groupBy&gt;
+ * GROUP BY @PERSON@.PERSON_ID
+ * HAVING 1=1
+ * &lt;havingParts/&gt;
+ * &lt;/groupBy&gt;
+ * )
+ * </pre></code> <br>
+ * The selectClause is something like <code><pre>
+ * ( SELECT &lt; selectParts/&gt;
+ * FROM PERSON @PERSON@
+ * WHERE @PERSON@.PERSON_ID=@parent.PERSON@.PERSON_ID
+ * &lt;whereParts/&gt;
+ * )
+ * </pre></code> It is not allowed, that the selectClause contains a <i>UNION</i> because this part is needed for
+ * aggregation too.<br>
+ * The <i>selectParts</i> tag is replaced with all attributes which are selected.
+ * If there are more than one attributes, they are separated by a comma
+ * "<i>attribute1</i> <i>,</i> <i>attribute2</i>".<br>
+ * The <i>whereParts</i> tag is replaced with all attributes contained in the entity that have no aggregation type.
+ * Every attribute contributes a "AND <i>attribute</i> <i>op</i> <i>value</i>" line.<br>
+ * The <i>groupBy</i> tag is only used when there are attributes in the entity that have an aggregation type.<br>
+ * The <i>havingParts</i> tag is replaced with all attributes contained in the entity that have an aggregation type.
+ * Every aggregation attribute contributes a "AND <i>fun</i>(<i>attribute</i>) <i>op</i> <i>value</i>" line.<br>
+ */
+
+ public void setDataModelEntityDefinition(Class<? extends IDataModelEntity> entityType, String whereClause, String selectClause) {
+ setDataModelEntityDefinition(new DataModelEntityPartDefinition(entityType, whereClause, selectClause));
+ }
+
+ /**
+ * see {@link #setDataModelEntityDefinition(Class, String)}
+ */
+ public void setDataModelEntityDefinition(DataModelEntityPartDefinition def) {
+ m_dataModelEntMap.put(def.getEntityType(), def);
+ }
+
+ /**
+ * Convenience for {@link #getAliasMapper()} and {@link AliasMapper#setRootAlias(String, String)}
+ */
+ public void setRootAlias(String entityName, String alias) {
+ getAliasMapper().setRootAlias(entityName, alias);
+ }
+
+ protected FormDataStatementBuilderCheck createCheckInstance() {
+ return new FormDataStatementBuilderCheck(this);
+ }
+
+ public void check(Object o) {
+ FormDataStatementBuilderCheck c = createCheckInstance();
+ c.check(o);
+ System.out.println(c.toString());
+ }
+
+ @SuppressWarnings("cast")
+ public String build(AbstractFormData formData) throws ProcessingException {
+ m_where = new StringBuffer();
+ // get all formData fields and properties defined directly and indirectly by extending template fields, respectively
+ //build constraints for fields
+ for (BasicPartDefinition def : m_basicDefs) {
+ if (def.accept(formData)) {
+ Map<String, String> parentAliasMap = getAliasMapper().getRootAliases();
+ EntityContribution contrib = def.createInstance(this, formData, parentAliasMap);
+ String cons = createWhereConstraint(contrib);
+ if (cons != null) {
+ addWhere(" AND " + cons);
+ }
+ }
+ }
+ //build constraints for composer trees
+ Map<Integer, Map<String, AbstractFormFieldData>> fieldsBreathFirstMap = formData.getAllFieldsRec();
+ for (Map<String, AbstractFormFieldData> map : fieldsBreathFirstMap.values()) {
+ for (AbstractFormFieldData f : map.values()) {
+ if (f.isValueSet()) {
+ if (f instanceof AbstractTreeFieldData) {
+ // composer tree with entity, attribute
+ EntityContribution contrib = buildTreeNodes(((AbstractTreeFieldData) f).getRoots(), EntityStrategy.BuildConstraints, AttributeStrategy.BuildConstraintOfAttributeWithContext);
+ String cons = createWhereConstraint(contrib);
+ if (cons != null) {
+ addWhere(" AND " + cons);
+ }
+ }
+ }
+ }
+ }
+ return getWhereConstraints();
+ }
+
+ /**
+ * Creates a select statement by merging the given entity contributions with the given base statement. This builder's
+ * {@link #getWhereConstraints()} are added as well.
+ *
+ * @param stm
+ * base statement with &lt;selectParts/&gt;, &lt;fromParts/&gt;, &lt;whereParts/&gt;, &lt;groupByParts/&gt;
+ * or &lt;havingParts/&gt; place holders.
+ * @param contributions
+ * entity contributions that are used to replace markers in the given base statement.
+ * @return Returns given base statement having all place holders replaced by the given entity contributions.
+ * @throws ProcessingException
+ * @since 3.8.1
+ */
+ public String createSelectStatement(String stm, EntityContribution... contributions) throws ProcessingException {
+ EntityContribution mergedContribution = new EntityContribution();
+ if (contributions != null) {
+ for (EntityContribution c : contributions) {
+ mergedContribution.add(c);
+ }
+ }
+ String where = StringUtility.trim(getWhereConstraints());
+ if (StringUtility.hasText(where)) {
+ if (where.toUpperCase().startsWith("AND")) {
+ where = where.substring(3);
+ }
+ mergedContribution.getWhereParts().add(where);
+ }
+ return createEntityPart(stm, false, mergedContribution);
+ }
+
+ /**
+ * do not use or override this method, it is protected for unit test purposes
+ */
+ protected boolean isZeroTraversingAttribute(int operation, Object[] values) {
+ Number value1 = values != null && values.length > 0 && values[0] instanceof Number ? (Number) values[0] : null;
+ Number value2 = values != null && values.length > 1 && values[1] instanceof Number ? (Number) values[1] : null;
+ switch (operation) {
+ case OPERATOR_EQ: {
+ if (value1 != null) {
+ return value1.longValue() == 0;
+ }
+ break;
+ }
+ case OPERATOR_GE: {
+ if (value1 != null) {
+ return value1.doubleValue() <= 0;
+ }
+ break;
+ }
+ case OPERATOR_GT: {
+ if (value1 != null) {
+ return value1.doubleValue() < 0;
+ }
+ break;
+ }
+ case OPERATOR_LE: {
+ if (value1 != null) {
+ return value1.doubleValue() >= 0;
+ }
+ break;
+ }
+ case OPERATOR_LT: {
+ if (value1 != null) {
+ return value1.doubleValue() > 0;
+ }
+ break;
+ }
+ case OPERATOR_NEQ: {
+ if (value1 != null) {
+ return value1.longValue() != 0;
+ }
+ break;
+ }
+ case OPERATOR_BETWEEN: {
+ if (value1 != null && value2 != null) {
+ return value1.doubleValue() <= 0 && value2.doubleValue() >= 0;
+ }
+ else if (value1 != null) {
+ return value1.doubleValue() <= 0;
+ }
+ else if (value2 != null) {
+ return value2.doubleValue() >= 0;
+ }
+ break;
+ }
+ }
+ return false;
+ }
+
+ public AliasMapper getAliasMapper() {
+ return m_aliasMapper;
+ }
+
+ /**
+ * @return the life bind map
+ */
+ public Map<String, Object> getBindMap() {
+ return m_bindMap;
+ }
+
+ public ISqlStyle getSqlStyle() {
+ return m_sqlStyle;
+ }
+
+ /**
+ * Convenience for {@link #getBindMap()}.put(name,value)
+ */
+ public void addBinds(String[] names, Object[] values) {
+ if (names != null) {
+ for (int i = 0; i < names.length; i++) {
+ addBind(names[i], values[i]);
+ }
+ }
+ }
+
+ /**
+ * Convenience for {@link #getBindMap()}.put(name,value)
+ */
+ public void addBind(String name, Object value) {
+ if (name != null && !name.startsWith(ISqlStyle.PLAIN_BIND_MARKER_PREFIX)) {
+ getBindMap().put(name, value);
+ }
+ }
+
+ /**
+ * add sql part with custom binds the ADD keyword is NOT added (pre-pended)
+ * automatically
+ */
+ public void addWhere(String sql, NVPair... customBinds) {
+ if (sql != null) {
+ m_where.append(" ");
+ m_where.append(sql);
+ for (NVPair p : customBinds) {
+ addBind(p.getName(), p.getValue());
+ }
+ }
+ }
+
+ /**
+ * @deprecated use {@link #getBasicPartDefinitions()} instead
+ */
+ @Deprecated
+ public List<BasicPartDefinition> getValuePartDefinitions() {
+ return Collections.unmodifiableList(m_basicDefs);
+ }
+
+ public List<BasicPartDefinition> getBasicPartDefinitions() {
+ return Collections.unmodifiableList(m_basicDefs);
+ }
+
+ public Map<Class<?>, DataModelAttributePartDefinition> getDataModelAttributePartDefinitions() {
+ return Collections.unmodifiableMap(m_dataModelAttMap);
+ }
+
+ public Map<Class<?>, DataModelEntityPartDefinition> getDataModelEntityPartDefinitions() {
+ return Collections.unmodifiableMap(m_dataModelEntMap);
+ }
+
+ public String getWhereConstraints() {
+ return (m_where != null ? m_where.toString() : null);
+ }
+
+ /**
+ * Replace bind name by unique bind name so that it is not
+ * conflicting with other parts that use the same statement
+ * part and bind name. For example S is replaces by __S123.
+ */
+ public String localizeBindName(String bindName, String prefix) {
+ if (bindName != null) {
+ String locName = prefix + bindName + getNextBindSeqNo();
+ return locName;
+ }
+ return null;
+ }
+
+ /**
+ * Replace bind name in statement
+ */
+ public String localizeStatement(String stm, String oldBindName, String newBindName) {
+ stm = stm.replaceAll("#" + oldBindName + "#", "#" + newBindName + "#");
+ stm = stm.replaceAll("\\&" + oldBindName + "\\&", "&" + newBindName + "&");
+ stm = stm.replaceAll(":" + oldBindName + "([^A-Za-z0-9_])", ":" + newBindName + "$1");
+ stm = stm.replaceAll(":" + oldBindName + "$", ":" + newBindName);
+ return stm;
+ }
+
+ protected long getNextBindSeqNo() {
+ return m_sequenceProvider.incrementAndGet();
+ }
+
+ @SuppressWarnings("unchecked")
+ public static <T extends TreeNodeData> T getParentNodeOfType(TreeNodeData node, Class<T> type) {
+ if (node == null) {
+ return null;
+ }
+ while (node != null) {
+ node = node.getParentNode();
+ if (node != null && type.isAssignableFrom(node.getClass())) {
+ return (T) node;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * moved to {@link EntityContributionUtility#contributionToConstraintText(EntityContribution)}
+ */
+ public static String createWhereConstraint(EntityContribution contrib) {
+ return EntityContributionUtility.contributionToConstraintText(contrib);
+ }
+
+ public AttributeKind getAttributeKind(TreeNodeData node) {
+ if (!(node instanceof ComposerAttributeNodeData)) {
+ return AttributeKind.Undefined;
+ }
+ //
+ ComposerAttributeNodeData attributeNode = (ComposerAttributeNodeData) node;
+ Integer agg = attributeNode.getAggregationType();
+ if (agg == null || agg == AGGREGATION_NONE) {
+ if (!isZeroTraversingAttribute(attributeNode.getOperator(), attributeNode.getValues())) {
+ return AttributeKind.NonAggregationNonZeroTraversing;
+ }
+ return AttributeKind.NonAggregation;
+ }
+ //
+ if (!isZeroTraversingAttribute(attributeNode.getOperator(), attributeNode.getValues())) {
+ return AttributeKind.AggregationNonZeroTraversing;
+ }
+ return AttributeKind.Aggregation;
+ }
+
+ /**
+ * @param nodes
+ * @return the complete string of all attribute contributions
+ * @throws ProcessingException
+ */
+ public EntityContribution buildTreeNodes(List<TreeNodeData> nodes, EntityStrategy entityStrategy, AttributeStrategy attributeStrategy) throws ProcessingException {
+ EntityContribution contrib = new EntityContribution();
+ int i = 0;
+ while (i < nodes.size()) {
+ if (nodes.get(i) instanceof ComposerEntityNodeData) {
+ EntityContribution subContrib = buildComposerEntityNodeContribution((ComposerEntityNodeData) nodes.get(i), entityStrategy);
+ appendTreeSubContribution(contrib, subContrib, entityStrategy);
+ i++;
+ }
+ else if (nodes.get(i) instanceof ComposerAttributeNodeData) {
+ EntityContribution subContrib = buildComposerAttributeNode((ComposerAttributeNodeData) nodes.get(i), attributeStrategy);
+ appendTreeSubContribution(contrib, subContrib, entityStrategy);
+ i++;
+ }
+ else if (nodes.get(i) instanceof ComposerEitherOrNodeData) {
+ ArrayList<ComposerEitherOrNodeData> orNodes = new ArrayList<ComposerEitherOrNodeData>();
+ orNodes.add((ComposerEitherOrNodeData) nodes.get(i));
+ int k = i;
+ while (k + 1 < nodes.size() && (nodes.get(k + 1) instanceof ComposerEitherOrNodeData) && !((ComposerEitherOrNodeData) nodes.get(k + 1)).isBeginOfEitherOr()) {
+ orNodes.add((ComposerEitherOrNodeData) nodes.get(k + 1));
+ k++;
+ }
+ EntityContribution subContrib = buildComposerOrNodes(orNodes, entityStrategy, attributeStrategy);
+ appendTreeSubContribution(contrib, subContrib, entityStrategy);
+ i = k + 1;
+ }
+ else {
+ EntityContribution subContrib = buildTreeNodes(nodes.get(i).getChildNodes(), entityStrategy, attributeStrategy);
+ appendTreeSubContribution(contrib, subContrib, entityStrategy);
+ }
+ }
+ return contrib;
+ }
+
+ private void appendTreeSubContribution(EntityContribution parent, EntityContribution child, EntityStrategy entityStrategy) {
+ switch (entityStrategy) {
+ case BuildConstraints: {
+ EntityContribution whereConstraints = EntityContributionUtility.createConstraintsContribution(child);
+ if (whereConstraints != null) {
+ parent.add(whereConstraints);
+ }
+ break;
+ }
+ default: {
+ if (child != null && !child.isEmpty()) {
+ parent.add(child);
+ }
+ }
+ }
+ }
+
+ /**
+ * do not use or override this method, it is protected for unit test purposes
+ */
+ @SuppressWarnings("unchecked")
+ protected EntityContribution buildComposerOrNodes(List<ComposerEitherOrNodeData> nodes, EntityStrategy entityStrategy, AttributeStrategy attributeStrategy) throws ProcessingException {
+ EntityContribution contrib = new EntityContribution();
+ // check if only one condition
+ StringBuilder buf = new StringBuilder();
+ int count = 0;
+ for (ComposerEitherOrNodeData node : nodes) {
+ EntityContribution subContrib = buildTreeNodes(node.getChildNodes(), entityStrategy, attributeStrategy);
+ contrib.getFromParts().addAll(subContrib.getFromParts());
+ if (subContrib.getWhereParts().size() + subContrib.getHavingParts().size() > 0) {
+ if (count > 0) {
+ buf.append(" OR ");
+ if (node.isNegative()) {
+ buf.append(" NOT ");
+ }
+ }
+ buf.append("(");
+ // remove possible outer join signs (+) in where / having constraint
+ // this is necessary because outer joins are not allowed in OR clause
+ // the removal of outer joins does not influence the result set
+ buf.append(ListUtility.format(ListUtility.combine(subContrib.getWhereParts(), subContrib.getHavingParts()), " AND ").replaceAll("\\(\\+\\)", ""));
+ buf.append(")");
+ count++;
+ }
+ }
+ if (count > 0) {
+ if (count > 1) {
+ buf.insert(0, "(");
+ buf.append(")");
+ contrib.getWhereParts().add(buf.toString());
+ }
+ else {
+ String s = buf.toString();
+ if (s.matches("\\(.*\\)")) {
+ s = s.substring(1, s.length() - 1).trim();
+ }
+ contrib.getWhereParts().add(s);
+ }
+ }
+ return contrib;
+ }
+
+ /**
+ * @deprecated use {@link #buildComposerEntityNodeContribution(ComposerEntityNodeData, EntityStrategy)} instead
+ */
+ @Deprecated
+ public String buildComposerEntityNode(ComposerEntityNodeData node, EntityStrategy entityStrategy) throws ProcessingException {
+ EntityContribution contrib = buildComposerEntityNodeContribution(node, entityStrategy);
+ switch (entityStrategy) {
+ case BuildConstraints: {
+ if (contrib.getWhereParts().size() > 0) {
+ return contrib.getWhereParts().get(0);
+ }
+ break;
+ }
+ case BuildQuery: {
+ if (contrib.getSelectParts().size() > 0) {
+ return contrib.getSelectParts().get(0);
+ }
+ break;
+ }
+ }
+ return null;
+ }
+
+ public EntityContribution buildComposerEntityNodeContribution(ComposerEntityNodeData node, EntityStrategy entityStrategy) throws ProcessingException {
+ if (getDataModel() == null) {
+ throw new ProcessingException("there is no data model set, call FormDataStatementBuilder.setDataModel to set one");
+ }
+ EntityPath entityPath = DataModelUtility.externalIdToEntityPath(getDataModel(), node.getEntityExternalId());
+ IDataModelEntity entity = (entityPath != null ? entityPath.lastElement() : null);
+ if (entity == null) {
+ LOG.warn("no entity for external id: " + node.getEntityExternalId());
+ return null;
+ }
+ DataModelEntityPartDefinition def = m_dataModelEntMap.get(entity.getClass());
+ if (def == null) {
+ LOG.warn("no PartDefinition for entity: " + entity);
+ return null;
+ }
+ ComposerEntityNodeData parentEntityNode = getParentNodeOfType(node, ComposerEntityNodeData.class);
+ Map<String, String> parentAliasMap = (parentEntityNode != null ? m_aliasMapper.getNodeAliases(parentEntityNode) : m_aliasMapper.getRootAliases());
+ String baseStm;
+ switch (entityStrategy) {
+ case BuildQuery: {
+ baseStm = def.getSelectClause();
+ break;
+ }
+ case BuildConstraints: {
+ baseStm = def.getWhereClause();
+ break;
+ }
+ default: {
+ baseStm = null;
+ }
+ }
+ String stm = null;
+ if (baseStm != null) {
+ stm = def.createInstance(this, node, entityStrategy, baseStm, parentAliasMap);
+ }
+ if (stm == null) {
+ return null;
+ }
+ m_aliasMapper.addAllNodeEntitiesFrom(node, stm);
+ stm = m_aliasMapper.replaceMarkersByAliases(stm, m_aliasMapper.getNodeAliases(node), parentAliasMap);
+ switch (entityStrategy) {
+ case BuildQuery: {
+ EntityContribution resultContrib = buildComposerEntityUnitContribution(node, entityStrategy, stm, node.getChildNodes(), isConsumeChildContributions(entityPath));
+ return resultContrib;
+ }
+ case BuildConstraints: {
+ String s = buildComposerEntityEitherOrSplit(entityStrategy, stm, node.isNegative(), node.getChildNodes());
+ EntityContribution resultContrib = (s != null ? EntityContribution.create(s) : new EntityContribution());
+ return resultContrib;
+ }
+ default: {
+ return null;
+ }
+ }
+ }
+
+ /**
+ * only used with strategy {@link EntityStrategy#BuildConstraints}
+ * <p>
+ * do not use or override this method, it is protected for unit test purposes
+ */
+ protected String buildComposerEntityEitherOrSplit(EntityStrategy entityStrategy, String baseStm, boolean negative, List<TreeNodeData> childParts) throws ProcessingException {
+ if (entityStrategy != EntityStrategy.BuildConstraints) {
+ return null;
+ }
+ List<List<ComposerEitherOrNodeData>> orBlocks = new ArrayList<List<ComposerEitherOrNodeData>>();
+ List<TreeNodeData> otherParts = new ArrayList<TreeNodeData>();
+ List<ComposerEitherOrNodeData> currentOrBlock = new ArrayList<ComposerEitherOrNodeData>();
+ for (TreeNodeData ch : childParts) {
+ if (ch instanceof ComposerEitherOrNodeData) {
+ ComposerEitherOrNodeData orData = (ComposerEitherOrNodeData) ch;
+ if (orData.isBeginOfEitherOr()) {
+ if (currentOrBlock.size() > 0) {
+ orBlocks.add(new ArrayList<ComposerEitherOrNodeData>(currentOrBlock));
+ }
+ currentOrBlock.clear();
+ }
+ currentOrBlock.add(orData);
+ }
+ else {
+ otherParts.add(ch);
+ }
+ }
+ if (currentOrBlock.size() > 0) {
+ orBlocks.add(new ArrayList<ComposerEitherOrNodeData>(currentOrBlock));
+ currentOrBlock.clear();
+ }
+ //
+ if (orBlocks.size() > 0) {
+ StringBuilder blockBuf = new StringBuilder();
+ int blockCount = 0;
+ for (List<ComposerEitherOrNodeData> list : orBlocks) {
+ int elemCount = 0;
+ StringBuilder elemBuf = new StringBuilder();
+ for (ComposerEitherOrNodeData orData : list) {
+ ArrayList<TreeNodeData> subList = new ArrayList<TreeNodeData>();
+ subList.addAll(otherParts);
+ subList.addAll(orData.getChildNodes());
+ String s = buildComposerEntityEitherOrSplit(entityStrategy, baseStm, negative ^ orData.isNegative(), subList);
+ if (s != null) {
+ if (elemCount > 0) {
+ elemBuf.append(" OR ");
+ }
+ elemBuf.append(" ( ");
+ elemBuf.append(s);
+ elemBuf.append(" ) ");
+ elemCount++;
+ }
+ }
+ if (elemCount > 0) {
+ if (blockCount > 0) {
+ blockBuf.append(" AND ");
+ }
+ blockBuf.append(" ( ");
+ blockBuf.append(elemBuf.toString());
+ blockBuf.append(" ) ");
+ blockCount++;
+ }
+ }
+ if (blockCount > 0) {
+ return blockBuf.toString();
+ }
+ return null;
+ }
+ return buildComposerEntityZeroTraversingSplit(entityStrategy, baseStm, negative, childParts);
+ }
+
+ /**
+ * only used with strategy {@link EntityStrategy#BuildConstraints} and one-to-many entity relation
+ * <p>
+ * do not use or override this method, it is protected for unit test purposes
+ */
+ protected String buildComposerEntityZeroTraversingSplit(EntityStrategy entityStrategy, String baseStm, boolean negative, List<TreeNodeData> childParts) throws ProcessingException {
+ if (entityStrategy != EntityStrategy.BuildConstraints) {
+ return null;
+ }
+ ArrayList<TreeNodeData> nonZeroChildren = new ArrayList<TreeNodeData>(2);
+ for (TreeNodeData ch : childParts) {
+ switch (getAttributeKind(ch)) {
+ case Undefined:
+ case NonAggregation/*non-aggregations must not be handled as zero-traversal*/:
+ case NonAggregationNonZeroTraversing:
+ case AggregationNonZeroTraversing: {
+ nonZeroChildren.add(ch);
+ break;
+ }
+ }
+ }
+ //
+ //create entity part 1
+ String entityPart1 = buildComposerEntityUnit(entityStrategy, baseStm, negative, childParts);
+ //create negated entity part 2
+ String entityPart2 = null;
+ if (nonZeroChildren.size() < childParts.size()) {
+ // negated negation
+ entityPart2 = buildComposerEntityUnit(entityStrategy, baseStm, !negative, nonZeroChildren);
+ }
+ //combine parts
+ if (entityPart2 != null) {
+ return " ( " + entityPart1 + " OR " + entityPart2 + " ) ";
+ }
+ return entityPart1;
+ }
+
+ /**
+ * do not use or override this method, it is protected for unit test purposes
+ */
+ protected EntityContribution buildComposerEntityUnitContribution(ComposerEntityNodeData node, EntityStrategy entityStrategy, String baseStm, List<TreeNodeData> childParts, boolean consumeChildContributions) throws ProcessingException {
+ EntityContribution childContributions = new EntityContribution();
+ switch (entityStrategy) {
+ case BuildConstraints: {
+ ArrayList<TreeNodeData> nonAggregationParts = new ArrayList<TreeNodeData>(childParts.size());
+ ArrayList<TreeNodeData> aggregationParts = new ArrayList<TreeNodeData>(2);
+ for (TreeNodeData ch : childParts) {
+ switch (getAttributeKind(ch)) {
+ case Undefined:
+ case NonAggregation:
+ case NonAggregationNonZeroTraversing: {
+ nonAggregationParts.add(ch);
+ break;
+ }
+ case Aggregation:
+ case AggregationNonZeroTraversing: {
+ aggregationParts.add(ch);
+ break;
+ }
+ }
+ }
+ //
+ EntityContribution subContrib = buildTreeNodes(nonAggregationParts, entityStrategy, AttributeStrategy.BuildConstraintOfAttributeWithContext);
+ childContributions.add(subContrib);
+ //
+ subContrib = buildTreeNodes(aggregationParts, entityStrategy, AttributeStrategy.BuildConstraintOfContext);
+ childContributions.add(subContrib);
+ //
+ subContrib = buildTreeNodes(aggregationParts, entityStrategy, AttributeStrategy.BuildConstraintOfAttribute);
+ childContributions.add(subContrib);
+ break;
+ }
+ case BuildQuery: {
+ EntityContribution subContrib = buildTreeNodes(childParts, entityStrategy, AttributeStrategy.BuildQueryOfAttributeAndConstraintOfContext);
+ childContributions.add(subContrib);
+ break;
+ }
+ }
+ //legacy: node may be null from legacy calls
+ if (node != null && hasInjections()) {
+ injectPreBuildEntity(node, entityStrategy, childContributions);
+ }
+ EntityContribution parentContributions = createEntityPart(entityStrategy, baseStm, childContributions, consumeChildContributions);
+ if (node != null && hasInjections()) {
+ injectPostBuildEntity(node, entityStrategy, parentContributions);
+ }
+ return parentContributions;
+ }
+
+ /**
+ * only used with strategy {@link EntityStrategy#BuildConstraints} and one-to-many entity relation
+ * <p>
+ * do not use or override this method, it is protected for unit test purposes
+ */
+ protected String buildComposerEntityUnit(EntityStrategy entityStrategy, String baseStm, boolean negative, List<TreeNodeData> childParts) throws ProcessingException {
+ EntityContribution contrib = buildComposerEntityUnitContribution(null, entityStrategy, baseStm, childParts, true);
+ List<String> list = contrib.getWhereParts();
+ if (list.isEmpty()) {
+ list = contrib.getFromParts();
+ }
+ if (list.isEmpty()) {
+ list = contrib.getSelectParts();
+ }
+ if (list.isEmpty()) {
+ return "1=1";
+ }
+ String s = list.get(0);
+ // negation
+ if (negative) {
+ s = " NOT (" + s + ") ";
+ }
+ return s;
+ }
+
+ @SuppressWarnings("cast")
+ public EntityContribution buildComposerAttributeNode(final ComposerAttributeNodeData node, AttributeStrategy attributeStrategy) throws ProcessingException {
+ if (getDataModel() == null) {
+ throw new ProcessingException("there is no data model set, call FormDataStatementBuilder.setDataModel to set one");
+ }
+ AttributePath attPath = DataModelUtility.externalIdToAttributePath(getDataModel(), node.getAttributeExternalId());
+ IDataModelAttribute attribute = (attPath != null ? attPath.getAttribute() : null);
+ if (attribute == null) {
+ LOG.warn("no attribute for external id: " + node.getAttributeExternalId());
+ return new EntityContribution();
+ }
+ DataModelAttributePartDefinition def = m_dataModelAttMap.get(attribute.getClass());
+ if (def == null) {
+ Integer agg = node.getAggregationType();
+ if (agg != null && agg == AGGREGATION_COUNT) {
+ def = new DataModelAttributePartDefinition(null, "1", false);
+ }
+ }
+ if (def == null) {
+ LOG.warn("no PartDefinition for attribute: " + attribute);
+ return new EntityContribution();
+ }
+ List<Object> bindValues = new ArrayList<Object>();
+ if (node.getValues() != null) {
+ bindValues.addAll(Arrays.asList(node.getValues()));
+ }
+ List<String> bindNames = new ArrayList<String>(bindValues.size());
+ for (int i = 0; i < bindValues.size(); i++) {
+ bindNames.add("" + (char) (((int) 'a') + i));
+ }
+ AliasMapper aliasMap = getAliasMapper();
+ ComposerEntityNodeData parentEntityNode = FormDataStatementBuilder.getParentNodeOfType(node, ComposerEntityNodeData.class);
+ Map<String, String> parentAliasMap = parentEntityNode != null ? aliasMap.getNodeAliases(parentEntityNode) : aliasMap.getRootAliases();
+ String stm = null;
+ switch (attributeStrategy) {
+ case BuildConstraintOfAttribute:
+ case BuildConstraintOfContext:
+ case BuildConstraintOfAttributeWithContext: {
+ stm = def.getWhereClause();
+ break;
+ }
+ case BuildQueryOfAttributeAndConstraintOfContext: {
+ stm = def.getSelectClause();
+ break;
+ }
+ }
+ EntityContribution contrib = null;
+ if (stm != null) {
+ contrib = def.createInstance(this, node, attributeStrategy, stm, bindNames, bindValues, parentAliasMap);
+ }
+ if (contrib == null) {
+ contrib = new EntityContribution();
+ }
+ switch (attributeStrategy) {
+ case BuildQueryOfAttributeAndConstraintOfContext: {
+ if (contrib.getSelectParts().isEmpty()) {
+ contrib.getSelectParts().add("NULL");
+ contrib.getGroupByParts().add("NULL");
+ }
+ break;
+ }
+ }
+ if (hasInjections()) {
+ injectPostBuildAttribute(node, attributeStrategy, contrib);
+ }
+ return contrib;
+ }
+
+ /**
+ * Evaluates the collecting tags in the entity statement and fills in the values of the {@link EntityContribution}.
+ * If the contributing tags are missing, the complete part is treated as 'select' on {@link EntityStrategy#BuildQuery}
+ * and as 'where' on {@link EntityStrategy#BuildConstraints}
+ * <p>
+ * Default calls {@link EntityContributionUtility#createEntityPart(String, EntityContribution, boolean)}
+ *
+ * @param entityStrategy
+ * @param entityPartWithTags
+ * may contain the collecting tags selectParts, fromParts, whereParts, groupBy, groupByParts, havingParts<br/>
+ * as well as the contributing selectPart, fromPart, wherePart, groupByPart, havingPart for the outer calling
+ * part.
+ * @param childContributions
+ * is the set of tags collected by all children
+ * @param consumeChildContributions
+ * true: consume the child tags inside the entity statement. The returned entity contributions will not
+ * contain any of these tags
+ * <p>
+ * false: don't consume the child tags inside the entity statement. The returned entity contribution contains
+ * its onw plus all of these child tags (proxy)
+ */
+ public EntityContribution createEntityPart(EntityStrategy entityStrategy, String entityPartWithTags, EntityContribution childContributions, boolean consumeChildContributions) throws ProcessingException {
+ if (consumeChildContributions) {
+ entityPartWithTags = autoCompleteEntityPartTags(entityPartWithTags);
+ }
+ EntityContribution parentContrib = EntityContributionUtility.mergeContributions(entityStrategy, entityPartWithTags, childContributions, consumeChildContributions);
+ return parentContrib;
+ }
+
+ /**
+ * only used with strategy {@link EntityStrategy#BuildConstraints}
+ * <p>
+ *
+ * @return the statement combined with the contributions
+ */
+ public String createEntityPart(String stm, boolean negative, EntityContribution childContributions) throws ProcessingException {
+ EntityContribution contrib = createEntityPart(EntityStrategy.BuildConstraints, stm, childContributions, true);
+ List<String> list = contrib.getWhereParts();
+ if (list.isEmpty()) {
+ list = contrib.getFromParts();
+ }
+ if (list.isEmpty()) {
+ list = contrib.getSelectParts();
+ }
+ if (list.isEmpty()) {
+ return "1=1";
+ }
+ String s = list.get(0);
+ // negation
+ if (negative) {
+ s = " NOT (" + s + ") ";
+ }
+ return s;
+ }
+
+ /**
+ * @deprecated moved to {@link EntityContributionUtility}
+ */
+ @Deprecated
+ protected String autoBracketSelectPart(String s) {
+ if (s != null && !s.startsWith("(") && s.toLowerCase().contains("select")) {
+ return "(" + s + ")";
+ }
+ return s;
+ }
+
+ protected String autoCompleteEntityPartTags(String s) {
+ if (s == null) {
+ return null;
+ }
+ if (StringUtility.getTag(s, "whereParts") == null) {
+ s = s + " <whereParts/>";
+ }
+ if (StringUtility.getTag(s, "groupBy") == null) {
+ s = s + " <groupBy/>";
+ }
+ s = s.replace("<groupBy/>", "<groupBy>GROUP BY <groupByParts/> HAVING 1=1 <havingParts/></groupBy>");
+ return s;
+ }
+
+ public static final int STATUS_CODE_INVALID_GROUP_BY_PART = EntityContributionUtility.STATUS_CODE_INVALID_GROUP_BY_PART;
+
+ /**
+ * Check if a group by part is valid, i.e. ist not a SELECT clause.
+ * default uses {@link EntityContributionUtility#checkGroupByPart(String)}
+ *
+ * @throws ProcessingException
+ * with {@link IStatus#getCode()} = X
+ * @since 3.8
+ */
+ protected void checkGroupByPart(String groupByPart) throws ProcessingException {
+ EntityContributionUtility.checkGroupByPart(groupByPart);
+ }
+
+ /**
+ * adding an attribute as an entity contribution
+ * <p>
+ * Evaluates the tags in the attribute statement and creates an {@link EntityContribution} based on it.
+ *
+ * @param stm
+ * may contain attribute, fromPart and wherePart tags
+ */
+ public EntityContribution createAttributePart(AttributeStrategy attributeStrategy, Integer aggregationType, String stm, int operation, List<String> bindNames, List<Object> bindValues, final boolean plainBind, Map<String, String> parentAliasMap) throws ProcessingException {
+ if (stm == null) {
+ return new EntityContribution();
+ }
+ //convenience: automatically wrap attribute in attribute tags
+ if (stm.indexOf("<attribute>") < 0) {
+ stm = "<attribute>" + stm + "</attribute>";
+ }
+ //convenience: automatically add missing alias on plain attributes, but only if the parent entity has at most 1 alias mapping
+ Matcher m = PLAIN_ATTRIBUTE_PATTERN.matcher(stm);
+ if (m.find()) {
+ if (parentAliasMap.size() == 0) {
+ //nop
+ }
+ else if (parentAliasMap.size() == 1) {
+ stm = m.replaceAll("$1@parent." + parentAliasMap.keySet().iterator().next() + "@.$2$3");
+ }
+ else {
+ throw new ProcessingException("composer attribute " + stm + " uses no @...@ alias prefix, but parent has more than 1 alias: " + parentAliasMap);
+ }
+ }
+ boolean isAg = (aggregationType != null && aggregationType != AGGREGATION_NONE);
+ EntityContribution contrib = new EntityContribution();
+ //special handling of NOT: wrap NOT around complete constraint text and not only in attribute operator
+ int positiveOperation;
+ boolean negation;
+ switch (operation) {
+ case OPERATOR_DATE_IS_NOT_TODAY: {
+ positiveOperation = OPERATOR_DATE_IS_TODAY;
+ negation = true;
+ break;
+ }
+ case OPERATOR_DATE_NEQ: {
+ positiveOperation = OPERATOR_DATE_EQ;
+ negation = true;
+ break;
+ }
+ case OPERATOR_DATE_TIME_IS_NOT_NOW: {
+ positiveOperation = OPERATOR_DATE_TIME_IS_NOW;
+ negation = true;
+ break;
+ }
+ case OPERATOR_DATE_TIME_NEQ: {
+ positiveOperation = OPERATOR_DATE_TIME_EQ;
+ negation = true;
+ break;
+ }
+ case OPERATOR_NEQ: {
+ positiveOperation = OPERATOR_EQ;
+ negation = true;
+ break;
+ }
+ case OPERATOR_NOT_CONTAINS: {
+ positiveOperation = OPERATOR_CONTAINS;
+ negation = true;
+ break;
+ }
+ case OPERATOR_NOT_ENDS_WITH: {
+ positiveOperation = OPERATOR_ENDS_WITH;
+ negation = true;
+ break;
+ }
+ case OPERATOR_NOT_IN: {
+ positiveOperation = OPERATOR_IN;
+ negation = true;
+ break;
+ }
+ case OPERATOR_NOT_NULL: {
+ positiveOperation = OPERATOR_NULL;
+ negation = true;
+ break;
+ }
+ case OPERATOR_NOT_STARTS_WITH: {
+ positiveOperation = OPERATOR_STARTS_WITH;
+ negation = true;
+ break;
+ }
+ case OPERATOR_NUMBER_NOT_NULL: {
+ positiveOperation = OPERATOR_NUMBER_NULL;
+ negation = true;
+ break;
+ }
+ case OPERATOR_TIME_IS_NOT_NOW: {
+ positiveOperation = OPERATOR_TIME_IS_NOW;
+ negation = true;
+ break;
+ }
+ default: {
+ positiveOperation = operation;
+ negation = false;
+ }
+ }
+ //
+ String fromPart = StringUtility.getTag(stm, "fromPart");
+ stm = StringUtility.removeTag(stm, "fromPart").trim();
+ String wherePart = StringUtility.getTag(stm, "wherePart");
+ if (wherePart == null) {
+ String tmp = StringUtility.removeTag(stm, "attribute").trim();
+ if (tmp.length() > 0) {
+ wherePart = stm;
+ stm = "";
+ }
+ }
+ stm = StringUtility.removeTag(stm, "wherePart").trim();
+ String attPart = StringUtility.getTag(stm, "attribute");
+ stm = StringUtility.removeTag(stm, "attribute").trim();
+ if (stm.length() > 0) {
+ LOG.warn("attribute part is not well-formed; contains wherePart tag and also other sql text: " + stm);
+ }
+ //
+ //from
+ if (fromPart != null) {
+ //resolve aliases in from
+ // mis-using 'contrib' as a "node" because real node is not accessible
+ m_aliasMapper.addMissingNodeEntitiesFrom(contrib, fromPart);
+ Map<String, String> aliasMap = m_aliasMapper.getNodeAliases(contrib);
+ parentAliasMap.putAll(aliasMap);
+ fromPart = m_aliasMapper.replaceMarkersByAliases(fromPart, parentAliasMap, parentAliasMap);
+ contrib.getFromParts().add(fromPart);
+ }
+ switch (attributeStrategy) {
+ //select ... where
+ case BuildQueryOfAttributeAndConstraintOfContext: {
+ //select
+ if (attPart != null) {
+ String sql = createSqlPart(aggregationType, attPart, OPERATOR_NONE, bindNames, bindValues, plainBind, parentAliasMap);
+ if (sql != null) {
+ contrib.getSelectParts().add(sql);
+ if (!isAg) {
+ contrib.getGroupByParts().add(sql);
+ }
+ }
+ }
+ //where
+ if (wherePart != null) {
+ wherePart = StringUtility.replaceTags(wherePart, "attribute", "1=1").trim();
+ String sql = createSqlPart(wherePart, bindNames, bindValues, plainBind, parentAliasMap);
+ if (sql != null) {
+ contrib.getWhereParts().add(sql);
+ }
+ }
+ break;
+ }
+ //where / having
+ case BuildConstraintOfAttribute: {
+ if (attPart != null) {
+ String sql = createSqlPart(aggregationType, attPart, positiveOperation, bindNames, bindValues, plainBind, parentAliasMap);
+ if (sql != null) {
+ if (negation) {
+ sql = "NOT(" + sql + ")";
+ }
+ if (isAg) {
+ contrib.getHavingParts().add(sql);
+ }
+ else {
+ contrib.getWhereParts().add(sql);
+ }
+ }
+ }
+ break;
+ }
+ case BuildConstraintOfContext: {
+ if (wherePart != null) {
+ wherePart = StringUtility.replaceTags(wherePart, "attribute", "1=1").trim();
+ String sql = createSqlPart(wherePart, bindNames, bindValues, plainBind, parentAliasMap);
+ if (sql != null) {
+ contrib.getWhereParts().add(sql);
+ }
+ }
+ break;
+ }
+ case BuildConstraintOfAttributeWithContext: {
+ String whereAndAttPart = (wherePart != null ? wherePart : "") + (wherePart != null && attPart != null ? " AND " : "") + (attPart != null ? "<attribute>" + attPart + "</attribute>" : "");
+ if (whereAndAttPart.length() > 0) {
+ String sql = createSqlPart(aggregationType, whereAndAttPart, positiveOperation, bindNames, bindValues, plainBind, parentAliasMap);
+ if (sql != null) {
+ if (negation) {
+ sql = "NOT(" + sql + ")";
+ }
+ contrib.getWhereParts().add(sql);
+ }
+ }
+ break;
+ }
+ }
+ return contrib;
+ }
+
+ /**
+ * adding an attribute as an entity contribution
+ * <p>
+ *
+ * @param stm
+ * may contain attribute, fromPart and wherePart tags
+ */
+ public String createAttributePartSimple(AttributeStrategy attributeStrategy, Integer aggregationType, String stm, int operation, List<String> bindNames, List<Object> bindValues, boolean plainBind, Map<String, String> parentAliasMap) throws ProcessingException {
+ EntityContribution contrib = createAttributePart(attributeStrategy, aggregationType, stm, operation, bindNames, bindValues, plainBind, parentAliasMap);
+ if (contrib.isEmpty()) {
+ return null;
+ }
+ return ListUtility.format(contrib.getWhereParts(), " AND ");
+ }
+
+ /**
+ * Create sql text, makes bind names unique, and adds all binds to the bind map
+ * <p>
+ * Convenience for {@link #createSqlPart(AGGREGATION_NONE, String, OPERATOR_NONE, List, List, boolean, Map)}
+ */
+ public String createSqlPart(String sql, List<String> bindNames, List<Object> bindValues, final boolean plainBind, Map<String, String> parentAliasMap) throws ProcessingException {
+ return createSqlPart(AGGREGATION_NONE, sql, OPERATOR_NONE, bindNames, bindValues, plainBind, parentAliasMap);
+ }
+
+ /**
+ * Create sql text, makes bind names unique, and adds all binds to the bind map
+ * <p>
+ * To use no operator use {@link DataModelConstants#OPERATOR_NONE} and null for binds and values, stm will be
+ * decorated and is the result itself
+ * <p>
+ * To use no aggregation use {@link DataModelConstants#AGGREGATION_NONE}
+ */
+ public String createSqlPart(final Integer aggregationType, String sql, final int operation, List<String> bindNames, List<Object> bindValues, final boolean plainBind, Map<String, String> parentAliasMap) throws ProcessingException {
+ if (sql == null) {
+ sql = "";
+ }
+ if (bindNames == null) {
+ bindNames = new ArrayList<String>(0);
+ }
+ if (bindValues == null) {
+ bindValues = new ArrayList<Object>(0);
+ }
+ // the attribute was of the form: NAME or
+ // <attribute>NAME</attribute>
+ // make sure there is an attribute tag in the string, if none enclose all
+ // by default
+ if (sql.indexOf("<attribute>") < 0) {
+ sql = "<attribute>" + sql + "</attribute>";
+ }
+ //convenience: automatically add missing alias on plain attributes, but only if the parent entity has at most 1 alias mapping
+ Matcher m = PLAIN_ATTRIBUTE_PATTERN.matcher(sql);
+ if (m.find()) {
+ if (parentAliasMap.size() == 0) {
+ //nop
+ }
+ else if (parentAliasMap.size() == 1) {
+ sql = m.replaceAll("$1@parent." + parentAliasMap.keySet().iterator().next() + "@.$2$3");
+ }
+ else {
+ throw new ProcessingException("root attribute with " + sql + " uses no @...@ alias prefix, but parent has more than 1 alias: " + parentAliasMap);
+ }
+ }
+ //resolve aliases
+ sql = m_aliasMapper.replaceMarkersByAliases(sql, parentAliasMap, parentAliasMap);
+ // generate unique bind names
+ final ArrayList<String> newBindNames = new ArrayList<String>(2);
+ for (int i = 0; i < bindNames.size(); i++) {
+ String o = bindNames.get(i);
+ String n = localizeBindName(o, "__");
+ newBindNames.add(n);
+ sql = localizeStatement(sql, o, n);
+ }
+ // part decoration
+ final List<Object> valuesFinal = bindValues;
+ ITagProcessor processor = new ITagProcessor() {
+ @Override
+ public String processTag(String tagName, String a) {
+ return createSqlOpValuePart(aggregationType, a, operation, newBindNames, valuesFinal, plainBind);
+ }
+ };
+ return StringUtility.replaceTags(sql, "attribute", processor);
+ }
+
+ public String createSqlOpValuePart(Integer aggregationType, String sql, int operation, List<String> bindNames, List<Object> bindValues, boolean plainBind) {
+ String[] names = (bindNames != null ? bindNames.toArray(new String[bindNames.size()]) : new String[0]);
+ Object[] values = (bindValues != null ? bindValues.toArray(new Object[bindValues.size()]) : new Object[0]);
+ if (plainBind && operation != OPERATOR_NONE) {
+ //rewrite bindNames by plain values
+ for (int i = 0; i < names.length; i++) {
+ names[i] = ISqlStyle.PLAIN_BIND_MARKER_PREFIX + m_sqlStyle.toPlainText(values[i]);
+ }
+ }
+ //
+ if (aggregationType != null && aggregationType != AGGREGATION_NONE) {
+ switch (aggregationType) {
+ case AGGREGATION_COUNT: {
+ sql = m_sqlStyle.toAggregationCount(sql);
+ break;
+ }
+ case AGGREGATION_MIN: {
+ sql = m_sqlStyle.toAggregationMin(sql);
+ break;
+ }
+ case AGGREGATION_MAX: {
+ sql = m_sqlStyle.toAggregationMax(sql);
+ break;
+ }
+ case AGGREGATION_SUM: {
+ sql = m_sqlStyle.toAggregationSum(sql);
+ break;
+ }
+ case AGGREGATION_AVG: {
+ sql = m_sqlStyle.toAggregationAvg(sql);
+ break;
+ }
+ case AGGREGATION_MEDIAN: {
+ sql = m_sqlStyle.toAggregationMedian(sql);
+ break;
+ }
+ }
+ }
+ else if (isZeroTraversingAttribute(operation, values)) {
+ sql = m_sqlStyle.getNvlToken() + "(" + sql + ",0)";
+ }
+ //
+ switch (operation) {
+ case OPERATOR_NONE: {
+ if (plainBind) {
+ if (names != null) {
+ HashMap<String, String> tokenValue = new HashMap<String, String>();
+ for (int i = 0; i < names.length; i++) {
+ tokenValue.put(names[i], m_sqlStyle.toPlainText(values[i]));
+ }
+ BindModel m = new BindParser(sql).parse();
+ IToken[] tokens = m.getIOTokens();
+ if (tokens != null) {
+ for (IToken iToken : tokens) {
+ if (iToken instanceof ValueInputToken) {
+ ValueInputToken t = (ValueInputToken) iToken;
+ t.setPlainValue(true);
+ t.setReplaceToken(tokenValue.get(t.getName()));
+ }
+ }
+ }
+ sql = m.getFilteredStatement();
+ }
+ }
+ else {
+ addBinds(names, values);
+ }
+ return sql;
+ }
+ case OPERATOR_BETWEEN: {
+ if (!plainBind) {
+ addBinds(names, values);
+ }
+ if (values[0] == null) {
+ return m_sqlStyle.createLE(sql, names[1]);
+ }
+ else if (values[1] == null) {
+ return m_sqlStyle.createGE(sql, names[0]);
+ }
+ else {
+ return m_sqlStyle.createBetween(sql, names[0], names[1]);
+ }
+ }
+ case OPERATOR_DATE_BETWEEN: {
+ if (!plainBind) {
+ addBinds(names, values);
+ }
+ if (values[0] == null) {
+ return m_sqlStyle.createDateLE(sql, names[1]);
+ }
+ else if (values[1] == null) {
+ return m_sqlStyle.createDateGE(sql, names[0]);
+ }
+ else {
+ return m_sqlStyle.createDateBetween(sql, names[0], names[1]);
+ }
+ }
+ case OPERATOR_DATE_TIME_BETWEEN: {
+ if (!plainBind) {
+ addBinds(names, values);
+ }
+ if (values[0] == null) {
+ return m_sqlStyle.createDateTimeLE(sql, names[1]);
+ }
+ else if (values[1] == null) {
+ return m_sqlStyle.createDateTimeGE(sql, names[0]);
+ }
+ else {
+ return m_sqlStyle.createDateTimeBetween(sql, names[0], names[1]);
+ }
+ }
+ case OPERATOR_EQ: {
+ if (!plainBind) {
+ addBinds(names, values);
+ }
+ return m_sqlStyle.createEQ(sql, names[0]);
+ }
+ case OPERATOR_DATE_EQ: {
+ if (!plainBind) {
+ addBinds(names, values);
+ }
+ return m_sqlStyle.createDateEQ(sql, names[0]);
+ }
+ case OPERATOR_DATE_TIME_EQ: {
+ if (!plainBind) {
+ addBinds(names, values);
+ }
+ return m_sqlStyle.createDateTimeEQ(sql, names[0]);
+ }
+ case OPERATOR_GE: {
+ if (!plainBind) {
+ addBinds(names, values);
+ }
+ return m_sqlStyle.createGE(sql, names[0]);
+ }
+ case OPERATOR_DATE_GE: {
+ if (!plainBind) {
+ addBinds(names, values);
+ }
+ return m_sqlStyle.createDateGE(sql, names[0]);
+ }
+ case OPERATOR_DATE_TIME_GE: {
+ if (!plainBind) {
+ addBinds(names, values);
+ }
+ return m_sqlStyle.createDateTimeGE(sql, names[0]);
+ }
+ case OPERATOR_GT: {
+ if (!plainBind) {
+ addBinds(names, values);
+ }
+ return m_sqlStyle.createGT(sql, names[0]);
+ }
+ case OPERATOR_DATE_GT: {
+ if (!plainBind) {
+ addBinds(names, values);
+ }
+ return m_sqlStyle.createDateGT(sql, names[0]);
+ }
+ case OPERATOR_DATE_TIME_GT: {
+ if (!plainBind) {
+ addBinds(names, values);
+ }
+ return m_sqlStyle.createDateTimeGT(sql, names[0]);
+ }
+ case OPERATOR_LE: {
+ if (!plainBind) {
+ addBinds(names, values);
+ }
+ return m_sqlStyle.createLE(sql, names[0]);
+ }
+ case OPERATOR_DATE_LE: {
+ if (!plainBind) {
+ addBinds(names, values);
+ }
+ return m_sqlStyle.createDateLE(sql, names[0]);
+ }
+ case OPERATOR_DATE_TIME_LE: {
+ if (!plainBind) {
+ addBinds(names, values);
+ }
+ return m_sqlStyle.createDateTimeLE(sql, names[0]);
+ }
+ case OPERATOR_LT: {
+ if (!plainBind) {
+ addBinds(names, values);
+ }
+ return m_sqlStyle.createLT(sql, names[0]);
+ }
+ case OPERATOR_DATE_LT: {
+ if (!plainBind) {
+ addBinds(names, values);
+ }
+ return m_sqlStyle.createDateLT(sql, names[0]);
+ }
+ case OPERATOR_DATE_TIME_LT: {
+ if (!plainBind) {
+ addBinds(names, values);
+ }
+ return m_sqlStyle.createDateTimeLT(sql, names[0]);
+ }
+ case OPERATOR_NEQ: {
+ if (!plainBind) {
+ addBinds(names, values);
+ }
+ return m_sqlStyle.createNEQ(sql, names[0]);
+ }
+ case OPERATOR_DATE_NEQ: {
+ if (!plainBind) {
+ addBinds(names, values);
+ }
+ return m_sqlStyle.createDateNEQ(sql, names[0]);
+ }
+ case OPERATOR_DATE_TIME_NEQ: {
+ if (!plainBind) {
+ addBinds(names, values);
+ }
+ return m_sqlStyle.createDateTimeNEQ(sql, names[0]);
+ }
+ case OPERATOR_DATE_IS_IN_DAYS: {
+ if (!plainBind) {
+ addBinds(names, values);
+ }
+ return m_sqlStyle.createDateIsInDays(sql, names[0]);
+ }
+ case OPERATOR_DATE_IS_IN_GE_DAYS: {
+ if (!plainBind) {
+ addBinds(names, values);
+ }
+ return m_sqlStyle.createDateIsInGEDays(sql, names[0]);
+ }
+ case OPERATOR_DATE_IS_IN_GE_MONTHS: {
+ if (!plainBind) {
+ addBinds(names, values);
+ }
+ return m_sqlStyle.createDateIsInGEMonths(sql, names[0]);
+ }
+ case OPERATOR_DATE_IS_IN_LE_DAYS: {
+ if (!plainBind) {
+ addBinds(names, values);
+ }
+ return m_sqlStyle.createDateIsInLEDays(sql, names[0]);
+ }
+ case OPERATOR_DATE_IS_IN_LE_MONTHS: {
+ if (!plainBind) {
+ addBinds(names, values);
+ }
+ return m_sqlStyle.createDateIsInLEMonths(sql, names[0]);
+ }
+ case OPERATOR_DATE_IS_IN_LAST_DAYS: {
+ if (!plainBind) {
+ addBinds(names, values);
+ }
+ return m_sqlStyle.createDateIsInLastDays(sql, names[0]);
+ }
+ case OPERATOR_DATE_IS_IN_LAST_MONTHS: {
+ if (!plainBind) {
+ addBinds(names, values);
+ }
+ return m_sqlStyle.createDateIsInLastMonths(sql, names[0]);
+ }
+ case OPERATOR_DATE_IS_IN_MONTHS: {
+ if (!plainBind) {
+ addBinds(names, values);
+ }
+ return m_sqlStyle.createDateIsInMonths(sql, names[0]);
+ }
+ case OPERATOR_DATE_IS_IN_NEXT_DAYS: {
+ if (!plainBind) {
+ addBinds(names, values);
+ }
+ return m_sqlStyle.createDateIsInNextDays(sql, names[0]);
+ }
+ case OPERATOR_DATE_IS_IN_NEXT_MONTHS: {
+ if (!plainBind) {
+ addBinds(names, values);
+ }
+ return m_sqlStyle.createDateIsInNextMonths(sql, names[0]);
+ }
+ case OPERATOR_DATE_IS_NOT_TODAY: {
+ return m_sqlStyle.createDateIsNotToday(sql);
+ }
+ case OPERATOR_DATE_IS_TODAY: {
+ return m_sqlStyle.createDateIsToday(sql);
+ }
+ case OPERATOR_DATE_TIME_IS_IN_GE_HOURS: {
+ if (!plainBind) {
+ addBinds(names, values);
+ }
+ return m_sqlStyle.createDateTimeIsInGEHours(sql, names[0]);
+ }
+ case OPERATOR_DATE_TIME_IS_IN_GE_MINUTES: {
+ if (!plainBind) {
+ addBinds(names, values);
+ }
+ return m_sqlStyle.createDateTimeIsInGEMinutes(sql, names[0]);
+ }
+ case OPERATOR_DATE_TIME_IS_IN_LE_HOURS: {
+ if (!plainBind) {
+ addBinds(names, values);
+ }
+ return m_sqlStyle.createDateTimeIsInLEHours(sql, names[0]);
+ }
+ case OPERATOR_DATE_TIME_IS_IN_LE_MINUTES: {
+ if (!plainBind) {
+ addBinds(names, values);
+ }
+ return m_sqlStyle.createDateTimeIsInLEMinutes(sql, names[0]);
+ }
+ case OPERATOR_DATE_TIME_IS_NOT_NOW: {
+ return m_sqlStyle.createDateTimeIsNotNow(sql);
+ }
+ case OPERATOR_DATE_TIME_IS_NOW: {
+ return m_sqlStyle.createDateTimeIsNow(sql);
+ }
+ case OPERATOR_ENDS_WITH: {
+ if (!plainBind) {
+ addBind(names[0], m_sqlStyle.toLikePattern(values[0]));
+ }
+ return m_sqlStyle.createEndsWith(sql, names[0]);
+ }
+ case OPERATOR_NOT_ENDS_WITH: {
+ if (!plainBind) {
+ addBind(names[0], m_sqlStyle.toLikePattern(values[0]));
+ }
+ return m_sqlStyle.createNotEndsWith(sql, names[0]);
+ }
+ case OPERATOR_IN: {
+ if (!plainBind) {
+ addBinds(names, values);
+ return m_sqlStyle.createIn(sql, names[0]);
+ }
+ return m_sqlStyle.createInList(sql, values[0]);
+ }
+ case OPERATOR_CONTAINS: {
+ if (!plainBind) {
+ addBind(names[0], m_sqlStyle.toLikePattern(values[0]));
+ }
+ return m_sqlStyle.createContains(sql, names[0]);
+ }
+ case OPERATOR_LIKE: {
+ if (!plainBind) {
+ addBind(names[0], m_sqlStyle.toLikePattern(values[0]));
+ }
+ return m_sqlStyle.createLike(sql, names[0]);
+ }
+ case OPERATOR_NOT_IN: {
+ if (!plainBind) {
+ addBinds(names, values);
+ return m_sqlStyle.createNotIn(sql, names[0]);
+ }
+ return m_sqlStyle.createNotInList(sql, values[0]);
+ }
+ case OPERATOR_NOT_CONTAINS: {
+ if (!plainBind) {
+ addBind(names[0], m_sqlStyle.toLikePattern(values[0]));
+ }
+ return m_sqlStyle.createNotContains(sql, names[0]);
+ }
+ case OPERATOR_NOT_NULL: {
+ return m_sqlStyle.createNotNull(sql);
+ }
+ case OPERATOR_NUMBER_NOT_NULL: {
+ return m_sqlStyle.createNumberNotNull(sql);
+ }
+ case OPERATOR_NULL: {
+ return m_sqlStyle.createNull(sql);
+ }
+ case OPERATOR_NUMBER_NULL: {
+ return m_sqlStyle.createNumberNull(sql);
+ }
+ case OPERATOR_STARTS_WITH: {
+ if (!plainBind) {
+ addBind(names[0], m_sqlStyle.toLikePattern(values[0]));
+ }
+ return m_sqlStyle.createStartsWith(sql, names[0]);
+ }
+ case OPERATOR_NOT_STARTS_WITH: {
+ if (!plainBind) {
+ addBind(names[0], m_sqlStyle.toLikePattern(values[0]));
+ }
+ return m_sqlStyle.createNotStartsWith(sql, names[0]);
+ }
+ case OPERATOR_TIME_IS_IN_GE_HOURS: {
+ if (!plainBind) {
+ addBinds(names, values);
+ }
+ return m_sqlStyle.createTimeIsInGEHours(sql, names[0]);
+ }
+ case OPERATOR_TIME_IS_IN_GE_MINUTES: {
+ if (!plainBind) {
+ addBinds(names, values);
+ }
+ return m_sqlStyle.createTimeIsInGEMinutes(sql, names[0]);
+ }
+ case OPERATOR_TIME_IS_IN_HOURS: {
+ if (!plainBind) {
+ addBinds(names, values);
+ }
+ return m_sqlStyle.createTimeIsInHours(sql, names[0]);
+ }
+ case OPERATOR_TIME_IS_IN_LE_HOURS: {
+ if (!plainBind) {
+ addBinds(names, values);
+ }
+ return m_sqlStyle.createTimeIsInLEHours(sql, names[0]);
+ }
+ case OPERATOR_TIME_IS_IN_LE_MINUTES: {
+ if (!plainBind) {
+ addBinds(names, values);
+ }
+ return m_sqlStyle.createTimeIsInLEMinutes(sql, names[0]);
+ }
+ case OPERATOR_TIME_IS_IN_MINUTES: {
+ if (!plainBind) {
+ addBinds(names, values);
+ }
+ return m_sqlStyle.createTimeIsInMinutes(sql, names[0]);
+ }
+ case OPERATOR_TIME_IS_NOW: {
+ return m_sqlStyle.createTimeIsNow(sql);
+ }
+ case OPERATOR_TIME_IS_NOT_NOW: {
+ return m_sqlStyle.createTimeIsNotNow(sql);
+ }
+ default: {
+ throw new IllegalArgumentException("invalid operator: " + operation);
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/FormDataStatementBuilderCheck.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/FormDataStatementBuilderCheck.java
index 73451d7cf1..83aeb476ae 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/FormDataStatementBuilderCheck.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/FormDataStatementBuilderCheck.java
@@ -1,293 +1,293 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc.builder;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.TreeSet;
-
-import org.eclipse.scout.commons.ClassIdentifier;
-import org.eclipse.scout.rt.shared.data.form.AbstractFormData;
-import org.eclipse.scout.rt.shared.data.form.fields.AbstractFormFieldData;
-import org.eclipse.scout.rt.shared.data.form.fields.AbstractValueFieldData;
-import org.eclipse.scout.rt.shared.data.model.AbstractDataModel;
-import org.eclipse.scout.rt.shared.data.model.AttributePath;
-import org.eclipse.scout.rt.shared.data.model.EntityPath;
-import org.eclipse.scout.rt.shared.data.model.IDataModelAttribute;
-import org.eclipse.scout.rt.shared.data.model.IDataModelEntity;
-
-public class FormDataStatementBuilderCheck {
- protected final FormDataStatementBuilder builder;
- private TreeSet<String> m_imports;
- private ArrayList<String> m_body;
- private HashSet<Class<?>> m_visited;
-
- public FormDataStatementBuilderCheck(FormDataStatementBuilder builder) {
- this.builder = builder;
- m_imports = new TreeSet<String>();
- m_body = new ArrayList<String>();
- m_visited = new HashSet<Class<?>>();
- }
-
- /**
- * @return the imports
- */
- public TreeSet<String> getImports() {
- return m_imports;
- }
-
- /**
- * @return the body
- */
- public ArrayList<String> getBody() {
- return m_body;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- StringBuffer buf = new StringBuffer();
- if (m_imports.size() > 0) {
- for (String s : m_imports) {
- buf.append(s);
- buf.append("\n");
- }
- buf.append("\n");
- }
- if (m_body.size() > 0) {
- for (String s : m_body) {
- buf.append(s);
- buf.append("\n");
- }
- }
- return buf.toString();
- }
-
- /**
- * Check for all parts a statement mapping was defined
- */
- public boolean check(Object o) {
- m_imports.clear();
- m_body.clear();
- m_visited.clear();
- checkRec(EntityPath.EMPTY, o);
- return m_body.size() == 0;
- }
-
- protected void checkRec(EntityPath parentPath, Object o) {
- if (m_visited.contains(o.getClass())) {
- return;
- }
- m_visited.add(o.getClass());
- //
- if (o instanceof AbstractFormData) {
- for (Object f : ((AbstractFormData) o).getFields()) {
- checkRec(parentPath, f);
- }
- }
- else if (o instanceof AbstractFormFieldData) {
- if (o instanceof AbstractValueFieldData<?>) {
- checkValueField((AbstractValueFieldData<?>) o);
- }
- //children
- for (Object f : ((AbstractFormFieldData) o).getFields()) {
- checkRec(parentPath, f);
- }
- }
- else if (o instanceof AbstractDataModel) {
- for (Object a : ((AbstractDataModel) o).getAttributes()) {
- checkRec(parentPath, a);
- }
- for (Object e : ((AbstractDataModel) o).getEntities()) {
- checkRec(parentPath, e);
- }
- }
- else if (o instanceof IDataModelEntity) {
- EntityPath subPath = parentPath.addToEnd((IDataModelEntity) o);
- checkDataModelEntity(subPath);
- //only
- for (Object a : ((IDataModelEntity) o).getAttributes()) {
- checkRec(subPath, a);
- }
- for (Object e : ((IDataModelEntity) o).getEntities()) {
- checkRec(subPath, e);
- }
- }
- else if (o instanceof IDataModelAttribute) {
- checkDataModelAttribute(parentPath.addToEnd((IDataModelAttribute) o));
- }
- }
-
- protected void checkValueField(AbstractValueFieldData<?> v) {
- BasicPartDefinition part = null;
- for (BasicPartDefinition f : builder.getBasicPartDefinitions()) {
- if (part != null) {
- break;
- }
- for (ClassIdentifier t : f.getValueTypeClassIdentifiers()) {
- if (part != null) {
- break;
- }
- if (t.getLastSegment() == v.getClass()) {
- part = f;
- }
- }
- }
- if (part == null) {
- String name = fieldToName(v);
- String sqlColumnName = toSqlColumn(name);
- String sqlTemplate = "\"${sqlName}\"";
- String sql = sqlTemplate.replace("${sqlColumnName}", sqlColumnName);
- String op;
- Class<?> dataType = v.getHolderType();
- if (String.class.isAssignableFrom(dataType)) {
- op = "DataModelConstants.OPERATOR_CONTAINS";
- }
- else {
- op = "DataModelConstants.OPERATOR_EQ";
- }
- addBodyLine("setBasicDefinition(" + resolveImport(v.getClass()) + ".class," + sql + "," + op + ");");
- }
- }
-
- protected void checkDataModelEntity(EntityPath ePath) {
- IDataModelEntity e = ePath.lastElement();
- DataModelEntityPartDefinition part = builder.getDataModelEntityPartDefinitions().get(e.getClass());
- if (part == null) {
- String name = entityToName(ePath);
- String sqlTableName = toSqlTable(name);
- String sqlPKName = toSqlPrimaryKey(name);
- String parentName = name;
- String parentSqlPKName = sqlPKName;
- EntityPath parentPath = ePath.parent();
- if (!parentPath.isEmpty()) {
- parentName = entityToName(parentPath);
- parentSqlPKName = toSqlPrimaryKey(parentName);
- }
- String sqlTemplate =
- "\"EXISTS ( SELECT 1 \"+\n" +
- "\"FROM ${sqlTableName} @${name}@ \"+\n" +
- "\"WHERE @${name}@.${parentSqlPKName}=@parent.${parentName}@.${parentSqlPKName} \"+\n" +
- "\"<whereParts/> \"+\n" +
- "\"<groupBy> \"+\n" +
- "\" GROUP BY @${name}@.${parentSqlPKName} \"+\n" +
- "\" HAVING 1=1 \"+\n" +
- "\" <havingParts/> \"+\n" +
- "\"</groupBy> \"+\n" +
- "\")\"";
- String sql = sqlTemplate.replace("${name}", name).replace("${parentName}", parentName).replace("${sqlTableName}", sqlTableName).replace("${parentSqlPKName}", parentSqlPKName);
- addBodyLine("//entity " + e.getClass().getSimpleName());
- addBodyLine("setComposerEntityDefinition(" + resolveImport(e.getClass()) + ".class," + sql + ");");
- }
- }
-
- protected void checkDataModelAttribute(AttributePath aPath) {
- IDataModelAttribute a = aPath.getAttribute();
- DataModelAttributePartDefinition part = builder.getDataModelAttributePartDefinitions().get(a.getClass());
- if (part == null) {
- if (a.getClass().getSimpleName().endsWith("CountAttribute")) {
- //default aggregate count attribute
- return;
- }
- String parentName = null;
- EntityPath parentPath = aPath.getEntityPath();
- if (!parentPath.isEmpty()) {
- parentName = entityToName(parentPath);
- }
- String name = attributeToName(aPath);
- String sqlColumnName = toSqlColumn(name);
- //
- String sqlTemplate;
- if (!parentPath.isEmpty()) {
- sqlTemplate = "\"@${parentName}@.${sqlColumnName}\"";
- }
- else {
- sqlTemplate = "\"${sqlColumnName}\"";
- }
- String sql = sqlTemplate.replace("${sqlColumnName}", sqlColumnName).replace("${parentName}", parentName);
- addBodyLine("setComposerAttributeDefinition(" + resolveImport(a.getClass()) + ".class," + sql + ");");
- }
- }
-
- protected String fieldToName(Object f) {
- String name = f.getClass().getSimpleName();
- name = name.replaceAll("^Abstract(.*)$", "$1");
- name = name.replaceAll("^(.*)Data$", "$1");
- name = name.replaceAll("^(.*)Box", "$1");
- return name;
- }
-
- protected String entityToName(EntityPath ePath) {
- if (ePath.isEmpty()) {
- return null;
- }
- IDataModelEntity e = ePath.lastElement();
- String name = e.getClass().getSimpleName();
- name = name.replaceAll("^Abstract(.*)$", "$1");
- name = name.replaceAll("^(.*)Entity$", "$1");
- String[] array = name.replaceAll("([a-z])([A-Z])", "$1 $2").split(" ");
- return array[array.length - 1];
- }
-
- protected String attributeToName(AttributePath aPath) {
- String ename = entityToName(aPath.getEntityPath());
- IDataModelAttribute a = aPath.getAttribute();
- String name = a.getClass().getSimpleName();
- name = name.replaceAll("^Abstract(.*)$", "$1");
- name = name.replaceAll("^(.*)Attribute", "$1");
- if (ename != null) {
- String[] array = ename.replaceAll("([a-z])([A-Z])", "$1 $2").split(" ");
- for (int i = array.length - 1; i >= 0; i--) {
- if (name.startsWith(array[i])) {
- name = name.substring(array[i].length());
- }
- }
- }
- return name;
- }
-
- protected String toSqlTable(String s) {
- s = s.replaceAll("([a-z])([A-Z])", "$1_$2");
- return s.toUpperCase();
- }
-
- protected String toSqlPrimaryKey(String s) {
- s = s.replaceAll("([a-z])([A-Z])", "$1_$2") + "_NR";
- return s.toUpperCase();
- }
-
- protected String toSqlColumn(String s) {
- s = s.replaceAll("([a-z])([A-Z])", "$1_$2");
- return s.toUpperCase();
- }
-
- protected String resolveImport(Class<?> c) {
- String pck = c.getPackage().getName();
- String s = c.getName().substring(pck.length() + 1);
- int i = s.indexOf('$');
- if (i >= 0) {
- s = s.substring(0, i);
- }
- addImportLine("import " + pck + "." + s + ";");
- return c.getName().substring(pck.length() + 1).replace('$', '.');
- }
-
- protected void addImportLine(String s) {
- m_imports.add(s);
- }
-
- protected void addBodyLine(String s) {
- m_body.add(s);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc.builder;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.TreeSet;
+
+import org.eclipse.scout.commons.ClassIdentifier;
+import org.eclipse.scout.rt.shared.data.form.AbstractFormData;
+import org.eclipse.scout.rt.shared.data.form.fields.AbstractFormFieldData;
+import org.eclipse.scout.rt.shared.data.form.fields.AbstractValueFieldData;
+import org.eclipse.scout.rt.shared.data.model.AbstractDataModel;
+import org.eclipse.scout.rt.shared.data.model.AttributePath;
+import org.eclipse.scout.rt.shared.data.model.EntityPath;
+import org.eclipse.scout.rt.shared.data.model.IDataModelAttribute;
+import org.eclipse.scout.rt.shared.data.model.IDataModelEntity;
+
+public class FormDataStatementBuilderCheck {
+ protected final FormDataStatementBuilder builder;
+ private TreeSet<String> m_imports;
+ private ArrayList<String> m_body;
+ private HashSet<Class<?>> m_visited;
+
+ public FormDataStatementBuilderCheck(FormDataStatementBuilder builder) {
+ this.builder = builder;
+ m_imports = new TreeSet<String>();
+ m_body = new ArrayList<String>();
+ m_visited = new HashSet<Class<?>>();
+ }
+
+ /**
+ * @return the imports
+ */
+ public TreeSet<String> getImports() {
+ return m_imports;
+ }
+
+ /**
+ * @return the body
+ */
+ public ArrayList<String> getBody() {
+ return m_body;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ StringBuffer buf = new StringBuffer();
+ if (m_imports.size() > 0) {
+ for (String s : m_imports) {
+ buf.append(s);
+ buf.append("\n");
+ }
+ buf.append("\n");
+ }
+ if (m_body.size() > 0) {
+ for (String s : m_body) {
+ buf.append(s);
+ buf.append("\n");
+ }
+ }
+ return buf.toString();
+ }
+
+ /**
+ * Check for all parts a statement mapping was defined
+ */
+ public boolean check(Object o) {
+ m_imports.clear();
+ m_body.clear();
+ m_visited.clear();
+ checkRec(EntityPath.EMPTY, o);
+ return m_body.size() == 0;
+ }
+
+ protected void checkRec(EntityPath parentPath, Object o) {
+ if (m_visited.contains(o.getClass())) {
+ return;
+ }
+ m_visited.add(o.getClass());
+ //
+ if (o instanceof AbstractFormData) {
+ for (Object f : ((AbstractFormData) o).getFields()) {
+ checkRec(parentPath, f);
+ }
+ }
+ else if (o instanceof AbstractFormFieldData) {
+ if (o instanceof AbstractValueFieldData<?>) {
+ checkValueField((AbstractValueFieldData<?>) o);
+ }
+ //children
+ for (Object f : ((AbstractFormFieldData) o).getFields()) {
+ checkRec(parentPath, f);
+ }
+ }
+ else if (o instanceof AbstractDataModel) {
+ for (Object a : ((AbstractDataModel) o).getAttributes()) {
+ checkRec(parentPath, a);
+ }
+ for (Object e : ((AbstractDataModel) o).getEntities()) {
+ checkRec(parentPath, e);
+ }
+ }
+ else if (o instanceof IDataModelEntity) {
+ EntityPath subPath = parentPath.addToEnd((IDataModelEntity) o);
+ checkDataModelEntity(subPath);
+ //only
+ for (Object a : ((IDataModelEntity) o).getAttributes()) {
+ checkRec(subPath, a);
+ }
+ for (Object e : ((IDataModelEntity) o).getEntities()) {
+ checkRec(subPath, e);
+ }
+ }
+ else if (o instanceof IDataModelAttribute) {
+ checkDataModelAttribute(parentPath.addToEnd((IDataModelAttribute) o));
+ }
+ }
+
+ protected void checkValueField(AbstractValueFieldData<?> v) {
+ BasicPartDefinition part = null;
+ for (BasicPartDefinition f : builder.getBasicPartDefinitions()) {
+ if (part != null) {
+ break;
+ }
+ for (ClassIdentifier t : f.getValueTypeClassIdentifiers()) {
+ if (part != null) {
+ break;
+ }
+ if (t.getLastSegment() == v.getClass()) {
+ part = f;
+ }
+ }
+ }
+ if (part == null) {
+ String name = fieldToName(v);
+ String sqlColumnName = toSqlColumn(name);
+ String sqlTemplate = "\"${sqlName}\"";
+ String sql = sqlTemplate.replace("${sqlColumnName}", sqlColumnName);
+ String op;
+ Class<?> dataType = v.getHolderType();
+ if (String.class.isAssignableFrom(dataType)) {
+ op = "DataModelConstants.OPERATOR_CONTAINS";
+ }
+ else {
+ op = "DataModelConstants.OPERATOR_EQ";
+ }
+ addBodyLine("setBasicDefinition(" + resolveImport(v.getClass()) + ".class," + sql + "," + op + ");");
+ }
+ }
+
+ protected void checkDataModelEntity(EntityPath ePath) {
+ IDataModelEntity e = ePath.lastElement();
+ DataModelEntityPartDefinition part = builder.getDataModelEntityPartDefinitions().get(e.getClass());
+ if (part == null) {
+ String name = entityToName(ePath);
+ String sqlTableName = toSqlTable(name);
+ String sqlPKName = toSqlPrimaryKey(name);
+ String parentName = name;
+ String parentSqlPKName = sqlPKName;
+ EntityPath parentPath = ePath.parent();
+ if (!parentPath.isEmpty()) {
+ parentName = entityToName(parentPath);
+ parentSqlPKName = toSqlPrimaryKey(parentName);
+ }
+ String sqlTemplate =
+ "\"EXISTS ( SELECT 1 \"+\n" +
+ "\"FROM ${sqlTableName} @${name}@ \"+\n" +
+ "\"WHERE @${name}@.${parentSqlPKName}=@parent.${parentName}@.${parentSqlPKName} \"+\n" +
+ "\"<whereParts/> \"+\n" +
+ "\"<groupBy> \"+\n" +
+ "\" GROUP BY @${name}@.${parentSqlPKName} \"+\n" +
+ "\" HAVING 1=1 \"+\n" +
+ "\" <havingParts/> \"+\n" +
+ "\"</groupBy> \"+\n" +
+ "\")\"";
+ String sql = sqlTemplate.replace("${name}", name).replace("${parentName}", parentName).replace("${sqlTableName}", sqlTableName).replace("${parentSqlPKName}", parentSqlPKName);
+ addBodyLine("//entity " + e.getClass().getSimpleName());
+ addBodyLine("setComposerEntityDefinition(" + resolveImport(e.getClass()) + ".class," + sql + ");");
+ }
+ }
+
+ protected void checkDataModelAttribute(AttributePath aPath) {
+ IDataModelAttribute a = aPath.getAttribute();
+ DataModelAttributePartDefinition part = builder.getDataModelAttributePartDefinitions().get(a.getClass());
+ if (part == null) {
+ if (a.getClass().getSimpleName().endsWith("CountAttribute")) {
+ //default aggregate count attribute
+ return;
+ }
+ String parentName = null;
+ EntityPath parentPath = aPath.getEntityPath();
+ if (!parentPath.isEmpty()) {
+ parentName = entityToName(parentPath);
+ }
+ String name = attributeToName(aPath);
+ String sqlColumnName = toSqlColumn(name);
+ //
+ String sqlTemplate;
+ if (!parentPath.isEmpty()) {
+ sqlTemplate = "\"@${parentName}@.${sqlColumnName}\"";
+ }
+ else {
+ sqlTemplate = "\"${sqlColumnName}\"";
+ }
+ String sql = sqlTemplate.replace("${sqlColumnName}", sqlColumnName).replace("${parentName}", parentName);
+ addBodyLine("setComposerAttributeDefinition(" + resolveImport(a.getClass()) + ".class," + sql + ");");
+ }
+ }
+
+ protected String fieldToName(Object f) {
+ String name = f.getClass().getSimpleName();
+ name = name.replaceAll("^Abstract(.*)$", "$1");
+ name = name.replaceAll("^(.*)Data$", "$1");
+ name = name.replaceAll("^(.*)Box", "$1");
+ return name;
+ }
+
+ protected String entityToName(EntityPath ePath) {
+ if (ePath.isEmpty()) {
+ return null;
+ }
+ IDataModelEntity e = ePath.lastElement();
+ String name = e.getClass().getSimpleName();
+ name = name.replaceAll("^Abstract(.*)$", "$1");
+ name = name.replaceAll("^(.*)Entity$", "$1");
+ String[] array = name.replaceAll("([a-z])([A-Z])", "$1 $2").split(" ");
+ return array[array.length - 1];
+ }
+
+ protected String attributeToName(AttributePath aPath) {
+ String ename = entityToName(aPath.getEntityPath());
+ IDataModelAttribute a = aPath.getAttribute();
+ String name = a.getClass().getSimpleName();
+ name = name.replaceAll("^Abstract(.*)$", "$1");
+ name = name.replaceAll("^(.*)Attribute", "$1");
+ if (ename != null) {
+ String[] array = ename.replaceAll("([a-z])([A-Z])", "$1 $2").split(" ");
+ for (int i = array.length - 1; i >= 0; i--) {
+ if (name.startsWith(array[i])) {
+ name = name.substring(array[i].length());
+ }
+ }
+ }
+ return name;
+ }
+
+ protected String toSqlTable(String s) {
+ s = s.replaceAll("([a-z])([A-Z])", "$1_$2");
+ return s.toUpperCase();
+ }
+
+ protected String toSqlPrimaryKey(String s) {
+ s = s.replaceAll("([a-z])([A-Z])", "$1_$2") + "_NR";
+ return s.toUpperCase();
+ }
+
+ protected String toSqlColumn(String s) {
+ s = s.replaceAll("([a-z])([A-Z])", "$1_$2");
+ return s.toUpperCase();
+ }
+
+ protected String resolveImport(Class<?> c) {
+ String pck = c.getPackage().getName();
+ String s = c.getName().substring(pck.length() + 1);
+ int i = s.indexOf('$');
+ if (i >= 0) {
+ s = s.substring(0, i);
+ }
+ addImportLine("import " + pck + "." + s + ";");
+ return c.getName().substring(pck.length() + 1).replace('$', '.');
+ }
+
+ protected void addImportLine(String s) {
+ m_imports.add(s);
+ }
+
+ protected void addBodyLine(String s) {
+ m_body.add(s);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/FormDataStatementBuilderInjectionAdapter.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/FormDataStatementBuilderInjectionAdapter.java
index c2a046a76e..424660ca86 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/FormDataStatementBuilderInjectionAdapter.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/FormDataStatementBuilderInjectionAdapter.java
@@ -1,38 +1,38 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc.builder;
-
-import org.eclipse.scout.rt.server.services.common.jdbc.builder.FormDataStatementBuilder.AttributeStrategy;
-import org.eclipse.scout.rt.server.services.common.jdbc.builder.FormDataStatementBuilder.EntityStrategy;
-import org.eclipse.scout.rt.shared.data.form.fields.composer.ComposerAttributeNodeData;
-import org.eclipse.scout.rt.shared.data.form.fields.composer.ComposerEntityNodeData;
-
-/**
- * see {@link FormDataStatementBuilder#addFormDataStatementBuilderInjection(EntityContributionInjectionAdapter)}
- *
- * @author imo
- * @since 3.8
- */
-public class FormDataStatementBuilderInjectionAdapter implements IFormDataStatementBuilderInjection {
-
- @Override
- public void preBuildEntity(ComposerEntityNodeData node, EntityStrategy entityStrategy, EntityContribution childContributions) {
- }
-
- @Override
- public void postBuildEntity(ComposerEntityNodeData node, EntityStrategy entityStrategy, EntityContribution entityContribution) {
- }
-
- @Override
- public void postBuildAttribute(ComposerAttributeNodeData node, AttributeStrategy attributeStrategy, EntityContribution contrib) {
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc.builder;
+
+import org.eclipse.scout.rt.server.services.common.jdbc.builder.FormDataStatementBuilder.AttributeStrategy;
+import org.eclipse.scout.rt.server.services.common.jdbc.builder.FormDataStatementBuilder.EntityStrategy;
+import org.eclipse.scout.rt.shared.data.form.fields.composer.ComposerAttributeNodeData;
+import org.eclipse.scout.rt.shared.data.form.fields.composer.ComposerEntityNodeData;
+
+/**
+ * see {@link FormDataStatementBuilder#addFormDataStatementBuilderInjection(EntityContributionInjectionAdapter)}
+ *
+ * @author imo
+ * @since 3.8
+ */
+public class FormDataStatementBuilderInjectionAdapter implements IFormDataStatementBuilderInjection {
+
+ @Override
+ public void preBuildEntity(ComposerEntityNodeData node, EntityStrategy entityStrategy, EntityContribution childContributions) {
+ }
+
+ @Override
+ public void postBuildEntity(ComposerEntityNodeData node, EntityStrategy entityStrategy, EntityContribution entityContribution) {
+ }
+
+ @Override
+ public void postBuildAttribute(ComposerAttributeNodeData node, AttributeStrategy attributeStrategy, EntityContribution contrib) {
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/IFormDataStatementBuilderInjection.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/IFormDataStatementBuilderInjection.java
index 440f47e97c..06cb4e72dd 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/IFormDataStatementBuilderInjection.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/IFormDataStatementBuilderInjection.java
@@ -1,57 +1,57 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc.builder;
-
-import org.eclipse.scout.rt.server.services.common.jdbc.builder.FormDataStatementBuilder.AttributeStrategy;
-import org.eclipse.scout.rt.server.services.common.jdbc.builder.FormDataStatementBuilder.EntityStrategy;
-import org.eclipse.scout.rt.shared.data.form.fields.composer.ComposerAttributeNodeData;
-import org.eclipse.scout.rt.shared.data.form.fields.composer.ComposerEntityNodeData;
-
-/**
- * see {@link FormDataStatementBuilder#addFormDataStatementBuilderInjection(IPartDefinitionInjection)}
- *
- * @author imo
- * @since 3.8
- */
-public interface IFormDataStatementBuilderInjection {
-
- /**
- * This method is called in
- * {@link FormDataStatementBuilder#buildComposerEntityNodeContribution(ComposerEntityNodeData, EntityStrategy)}
- * <p>
- * The {@link EntityContribution} is the life object with all <em>child</em> parts.
- * <p>
- * The contents can be manipulated, be careful what to change.
- */
- void preBuildEntity(ComposerEntityNodeData node, EntityStrategy entityStrategy, EntityContribution childContributions);
-
- /**
- * This method is called in
- * {@link FormDataStatementBuilder#buildComposerEntityNodeContribution(ComposerEntityNodeData, EntityStrategy)}
- * <p>
- * The {@link EntityContribution} is the life object with all <em>entity</em> parts after the child parts have been
- * merged with the entity itself.
- * <p>
- * The contents can be manipulated, be careful what to change.
- */
- void postBuildEntity(ComposerEntityNodeData node, EntityStrategy entityStrategy, EntityContribution entityContribution);
-
- /**
- * This method is called in
- * {@link FormDataStatementBuilder#buildComposerAttributeNode(ComposerAttributeNodeData, AttributeStrategy)}
- * <p>
- * The {@link EntityContribution} is the life object.
- * <p>
- * The contents can be manipulated, be careful what to change.
- */
- void postBuildAttribute(ComposerAttributeNodeData node, AttributeStrategy attributeStrategy, EntityContribution contrib);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc.builder;
+
+import org.eclipse.scout.rt.server.services.common.jdbc.builder.FormDataStatementBuilder.AttributeStrategy;
+import org.eclipse.scout.rt.server.services.common.jdbc.builder.FormDataStatementBuilder.EntityStrategy;
+import org.eclipse.scout.rt.shared.data.form.fields.composer.ComposerAttributeNodeData;
+import org.eclipse.scout.rt.shared.data.form.fields.composer.ComposerEntityNodeData;
+
+/**
+ * see {@link FormDataStatementBuilder#addFormDataStatementBuilderInjection(IPartDefinitionInjection)}
+ *
+ * @author imo
+ * @since 3.8
+ */
+public interface IFormDataStatementBuilderInjection {
+
+ /**
+ * This method is called in
+ * {@link FormDataStatementBuilder#buildComposerEntityNodeContribution(ComposerEntityNodeData, EntityStrategy)}
+ * <p>
+ * The {@link EntityContribution} is the life object with all <em>child</em> parts.
+ * <p>
+ * The contents can be manipulated, be careful what to change.
+ */
+ void preBuildEntity(ComposerEntityNodeData node, EntityStrategy entityStrategy, EntityContribution childContributions);
+
+ /**
+ * This method is called in
+ * {@link FormDataStatementBuilder#buildComposerEntityNodeContribution(ComposerEntityNodeData, EntityStrategy)}
+ * <p>
+ * The {@link EntityContribution} is the life object with all <em>entity</em> parts after the child parts have been
+ * merged with the entity itself.
+ * <p>
+ * The contents can be manipulated, be careful what to change.
+ */
+ void postBuildEntity(ComposerEntityNodeData node, EntityStrategy entityStrategy, EntityContribution entityContribution);
+
+ /**
+ * This method is called in
+ * {@link FormDataStatementBuilder#buildComposerAttributeNode(ComposerAttributeNodeData, AttributeStrategy)}
+ * <p>
+ * The {@link EntityContribution} is the life object.
+ * <p>
+ * The contents can be manipulated, be careful what to change.
+ */
+ void postBuildAttribute(ComposerAttributeNodeData node, AttributeStrategy attributeStrategy, EntityContribution contrib);
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/LegacyFormDataStatementBuilder.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/LegacyFormDataStatementBuilder.java
index 791ff37d64..4fe1ad348f 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/LegacyFormDataStatementBuilder.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/LegacyFormDataStatementBuilder.java
@@ -1,120 +1,120 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc.builder;
-
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle;
-import org.eclipse.scout.rt.shared.data.model.IDataModelAttribute;
-import org.eclipse.scout.rt.shared.data.model.IDataModelEntity;
-
-@Deprecated
-@SuppressWarnings("deprecation")
-public class LegacyFormDataStatementBuilder extends FormDataStatementBuilder {
-
- /**
- * @param sqlStyle
- */
- public LegacyFormDataStatementBuilder(ISqlStyle sqlStyle) {
- super(sqlStyle);
- }
-
- /**
- * @deprecated use {@link #getDataModelAttributePartDefinitions()}
- */
- @Deprecated
- public Map<Class<?>, DataModelAttributePartDefinition> getComposerAttributePartDefinitions() {
- return getDataModelAttributePartDefinitions();
- }
-
- /**
- * @deprecated use {@link #getDataModelEntityPartDefinitions()}
- */
- @Deprecated
- public Map<Class<?>, DataModelEntityPartDefinition> getComposerEntityPartDefinitions() {
- return getDataModelEntityPartDefinitions();
- }
-
- /**
- * @deprecated use {@link #setDataModelAttributeDefinition(Class, String)}
- */
- @Deprecated
- public void setComposerAttributeDefinition(Class<? extends IDataModelAttribute> attributeType, String sqlAttribute) {
- setDataModelAttributeDefinition(attributeType, sqlAttribute);
- }
-
- /**
- * @deprecated use {@link #setDataModelAttributeDefinition(Class, String, boolean)}
- */
- @Deprecated
- public void setComposerAttributeDefinition(Class<? extends IDataModelAttribute> attributeType, String sqlAttribute, boolean plainBind) {
- setDataModelAttributeDefinition(attributeType, sqlAttribute, plainBind);
- }
-
- /**
- * @deprecated use {@link #setDataModelAttributeDefinition(Class, String, String, boolean)}
- */
- @Deprecated
- public void setComposerAttributeDefinition(Class<? extends IDataModelAttribute> attributeType, String whereClause, String selectClause, boolean plainBind) {
- setDataModelAttributeDefinition(attributeType, whereClause, selectClause, plainBind);
- }
-
- /**
- * @deprecated use {@link #setDataModelAttributeDefinition(DataModelAttributePartDefinition)}
- */
- @Deprecated
- public void setComposerAttributeDefinition(ComposerAttributePartDefinition def) {
- setDataModelAttributeDefinition(def);
- }
-
- /**
- * @deprecated use {@link #setDataModelEntityDefinition(Class, String)}
- */
- @Deprecated
- public void setComposerEntityDefinition(Class<? extends IDataModelEntity> entityType, String whereClause) {
- setDataModelEntityDefinition(entityType, whereClause);
- }
-
- /**
- * @deprecated use {@link #setDataModelEntityDefinition(Class, String, String)}
- */
- @Deprecated
- public void setComposerEntityDefinition(Class<? extends IDataModelEntity> entityType, String whereClause, String selectClause) {
- setDataModelEntityDefinition(entityType, whereClause, selectClause);
- }
-
- /**
- * @deprecated use {@link #setDataModelEntityDefinition(DataModelEntityPartDefinition)}
- */
- @Deprecated
- public void setComposerEntityDefinition(ComposerEntityPartDefinition def) {
- setDataModelEntityDefinition(def);
- }
-
- /**
- * @deprecated use {@link #createAttributePart(AtributeStrategy,Integer, String, int, List, List, boolean, Map)}
- */
- @Deprecated
- public String createComposerAttributeStatementPart(final Integer aggregationType, String stm, final int operation, List<String> bindNames, List<Object> bindValues, final boolean plainBind, Map<String, String> parentAliasMap) throws ProcessingException {
- return createAttributePartSimple(AttributeStrategy.BuildConstraintOfAttributeWithContext, aggregationType, stm, operation, bindNames, bindValues, plainBind, parentAliasMap);
- }
-
- /**
- * @deprecated use {@link #createSqlPart(Integer, String, int, List, List, boolean, Map)}
- */
- @Deprecated
- public String createStatementPart(final Integer aggregationType, String sql, final int operation, List<String> bindNames, List<Object> bindValues, final boolean plainBind, Map<String, String> parentAliasMap) throws ProcessingException {
- return createSqlPart(aggregationType, sql, operation, bindNames, bindValues, plainBind, parentAliasMap);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc.builder;
+
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle;
+import org.eclipse.scout.rt.shared.data.model.IDataModelAttribute;
+import org.eclipse.scout.rt.shared.data.model.IDataModelEntity;
+
+@Deprecated
+@SuppressWarnings("deprecation")
+public class LegacyFormDataStatementBuilder extends FormDataStatementBuilder {
+
+ /**
+ * @param sqlStyle
+ */
+ public LegacyFormDataStatementBuilder(ISqlStyle sqlStyle) {
+ super(sqlStyle);
+ }
+
+ /**
+ * @deprecated use {@link #getDataModelAttributePartDefinitions()}
+ */
+ @Deprecated
+ public Map<Class<?>, DataModelAttributePartDefinition> getComposerAttributePartDefinitions() {
+ return getDataModelAttributePartDefinitions();
+ }
+
+ /**
+ * @deprecated use {@link #getDataModelEntityPartDefinitions()}
+ */
+ @Deprecated
+ public Map<Class<?>, DataModelEntityPartDefinition> getComposerEntityPartDefinitions() {
+ return getDataModelEntityPartDefinitions();
+ }
+
+ /**
+ * @deprecated use {@link #setDataModelAttributeDefinition(Class, String)}
+ */
+ @Deprecated
+ public void setComposerAttributeDefinition(Class<? extends IDataModelAttribute> attributeType, String sqlAttribute) {
+ setDataModelAttributeDefinition(attributeType, sqlAttribute);
+ }
+
+ /**
+ * @deprecated use {@link #setDataModelAttributeDefinition(Class, String, boolean)}
+ */
+ @Deprecated
+ public void setComposerAttributeDefinition(Class<? extends IDataModelAttribute> attributeType, String sqlAttribute, boolean plainBind) {
+ setDataModelAttributeDefinition(attributeType, sqlAttribute, plainBind);
+ }
+
+ /**
+ * @deprecated use {@link #setDataModelAttributeDefinition(Class, String, String, boolean)}
+ */
+ @Deprecated
+ public void setComposerAttributeDefinition(Class<? extends IDataModelAttribute> attributeType, String whereClause, String selectClause, boolean plainBind) {
+ setDataModelAttributeDefinition(attributeType, whereClause, selectClause, plainBind);
+ }
+
+ /**
+ * @deprecated use {@link #setDataModelAttributeDefinition(DataModelAttributePartDefinition)}
+ */
+ @Deprecated
+ public void setComposerAttributeDefinition(ComposerAttributePartDefinition def) {
+ setDataModelAttributeDefinition(def);
+ }
+
+ /**
+ * @deprecated use {@link #setDataModelEntityDefinition(Class, String)}
+ */
+ @Deprecated
+ public void setComposerEntityDefinition(Class<? extends IDataModelEntity> entityType, String whereClause) {
+ setDataModelEntityDefinition(entityType, whereClause);
+ }
+
+ /**
+ * @deprecated use {@link #setDataModelEntityDefinition(Class, String, String)}
+ */
+ @Deprecated
+ public void setComposerEntityDefinition(Class<? extends IDataModelEntity> entityType, String whereClause, String selectClause) {
+ setDataModelEntityDefinition(entityType, whereClause, selectClause);
+ }
+
+ /**
+ * @deprecated use {@link #setDataModelEntityDefinition(DataModelEntityPartDefinition)}
+ */
+ @Deprecated
+ public void setComposerEntityDefinition(ComposerEntityPartDefinition def) {
+ setDataModelEntityDefinition(def);
+ }
+
+ /**
+ * @deprecated use {@link #createAttributePart(AtributeStrategy,Integer, String, int, List, List, boolean, Map)}
+ */
+ @Deprecated
+ public String createComposerAttributeStatementPart(final Integer aggregationType, String stm, final int operation, List<String> bindNames, List<Object> bindValues, final boolean plainBind, Map<String, String> parentAliasMap) throws ProcessingException {
+ return createAttributePartSimple(AttributeStrategy.BuildConstraintOfAttributeWithContext, aggregationType, stm, operation, bindNames, bindValues, plainBind, parentAliasMap);
+ }
+
+ /**
+ * @deprecated use {@link #createSqlPart(Integer, String, int, List, List, boolean, Map)}
+ */
+ @Deprecated
+ public String createStatementPart(final Integer aggregationType, String sql, final int operation, List<String> bindNames, List<Object> bindValues, final boolean plainBind, Map<String, String> parentAliasMap) throws ProcessingException {
+ return createSqlPart(aggregationType, sql, operation, bindNames, bindValues, plainBind, parentAliasMap);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/TokenBasedStatementBuilder.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/TokenBasedStatementBuilder.java
index deb77f9c9e..1c1e1dd930 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/TokenBasedStatementBuilder.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/TokenBasedStatementBuilder.java
@@ -1,397 +1,397 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc.builder;
-
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.atomic.AtomicLong;
-
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.StringUtility.ITagProcessor;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.server.services.common.jdbc.SQL;
-import org.eclipse.scout.rt.server.services.common.jdbc.internal.legacy.LegacyStatementBuilder;
-import org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle;
-import org.eclipse.scout.rt.shared.services.common.jdbc.SearchFilter;
-import org.eclipse.scout.rt.shared.services.common.jdbc.TokenBasedSearchFilter;
-import org.eclipse.scout.rt.shared.services.common.jdbc.TokenBasedSearchFilter.AndNodeToken;
-import org.eclipse.scout.rt.shared.services.common.jdbc.TokenBasedSearchFilter.AttributeNodeToken;
-import org.eclipse.scout.rt.shared.services.common.jdbc.TokenBasedSearchFilter.EntityNodeToken;
-import org.eclipse.scout.rt.shared.services.common.jdbc.TokenBasedSearchFilter.OrNodeToken;
-import org.eclipse.scout.rt.shared.services.common.jdbc.TokenBasedSearchFilter.TreeNodeToken;
-import org.eclipse.scout.rt.shared.services.common.jdbc.TokenBasedSearchFilter.ValueToken;
-import org.eclipse.scout.rt.shared.services.common.jdbc.TokenBasedSearchFilter.WildcardStringToken;
-
-/**
- * Builds sql based on static defined token fragments.
- * <p>
- * Checks the value type of every bind to avoid unexpected type injections. Makes sure no sql injection is applied.
- * <p>
- * subclass to add token mappings and handle complex tokens in {@link #buildToken(int, Object[])}
- */
-public class TokenBasedStatementBuilder {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(TokenBasedStatementBuilder.class);
-
- private final ISqlStyle m_sqlStyle;
- private final HashMap<Integer, String> m_tokenMappings = new HashMap<Integer, String>();
- private final AtomicLong m_bindSeq = new AtomicLong();
- private final HashMap<String, Object> m_binds = new HashMap<String, Object>();
- private final StringBuffer m_where = new StringBuffer("");
- /**
- * speed-up due to static caching of default mappings
- */
- private TokenBasedStatementBuilder m_staticBuilder;
-
- public TokenBasedStatementBuilder() {
- this(null);
- }
-
- public TokenBasedStatementBuilder(ISqlStyle sqlStyle) {
- m_sqlStyle = sqlStyle != null ? sqlStyle : SQL.getSqlStyle();
- }
-
- public void setStaticBuilder(TokenBasedStatementBuilder staticBuilder) {
- m_staticBuilder = staticBuilder;
- }
-
- public TokenBasedStatementBuilder getStaticBuilder() {
- return m_staticBuilder;
- }
-
- public ISqlStyle getSqlStyle() {
- return m_sqlStyle;
- }
-
- public void build(SearchFilter filter) {
- if (!(filter instanceof TokenBasedSearchFilter)) {
- LOG.warn("unexpected filter type", new IllegalArgumentException("expected search filter of type " + TokenBasedSearchFilter.class.getSimpleName()));
- return;
- }
- TokenBasedSearchFilter tokenFilter = (TokenBasedSearchFilter) filter;
- for (ValueToken t : tokenFilter.getValueTokens()) {
- checkValueTypes(t.getValues());
- buildToken(t.getTokenId(), t.getValues());
- }
- for (WildcardStringToken t : tokenFilter.getWildcardStringTokens()) {
- if (t.getValue() != null) {
- String s = m_sqlStyle.toLikePattern(t.getValue());
- buildToken(t.getTokenId(), new Object[]{s});
- }
- }
- for (AndNodeToken root : tokenFilter.getTreeTokens()) {
- buildTree(root);
- }
- }
-
- public void addTokenMapping(int key, String sql) {
- if (m_tokenMappings.put(key, sql) != null) {
- throw new IllegalArgumentException("duplicate token key: " + key);
- }
- }
-
- public String getTokenMapping(int key) {
- String s = m_tokenMappings.get(key);
- if (s != null) {
- return s;
- }
- if (m_staticBuilder != null) {
- return m_staticBuilder.getTokenMapping(key);
- }
- return null;
- }
-
- public boolean hasTokenMapping(int key) {
- boolean b = m_tokenMappings.containsKey(key);
- if (b) {
- return b;
- }
- if (m_staticBuilder != null) {
- return m_staticBuilder.hasTokenMapping(key);
- }
- return false;
- }
-
- /**
- * {@link #checkValueType(Object)}
- */
- public void checkValueTypes(Object[] args) {
- if (args != null) {
- for (Object o : args) {
- checkValueType(o);
- }
- }
- }
-
- /**
- * Check if value is of basic value type (avoid injection of unexpected complex types)
- * <p>
- * Default allows only Number, String, Date, Boolean, Character, Byte as well as arrays and primitive types of
- * forementioned.
- */
- public void checkValueType(Object o) {
- if (o == null) {
- return;
- }
- Class<?> c = o.getClass();
- while (c != null && c.isArray()) {
- c = c.getComponentType();
- }
- if (c == null) {
- return;
- }
- if (c.isPrimitive()) {
- return;
- }
- if (Number.class.isAssignableFrom(c) ||
- String.class.isAssignableFrom(c) ||
- Date.class.isAssignableFrom(c) ||
- Boolean.class.isAssignableFrom(c) ||
- Character.class.isAssignableFrom(c) ||
- Byte.class.isAssignableFrom(c)) {
- return;
- }
- //illegal type
- throw new IllegalArgumentException("unexpected and therefore illegal parameter type: " + c.getName());
- }
-
- public void addWhereToken(String sql) {
- if (sql != null) {
- m_where.append(" AND ");
- addWhere(sql);
- }
- }
-
- /**
- * @param sql
- * @param sValue
- * is the value for the :S bind
- */
- public void addWhereToken(String sql, Object sValue) {
- if (sql != null) {
- // create generic bind for S
- String bindName = "__" + m_bindSeq.incrementAndGet();
- String sOld = sql;
- sql = sql.replaceAll(":S([^a-zA-Z0-9_])", ":" + bindName + "$1");
- sql = sql.replaceAll(":S$", ":" + bindName);
- sql = sql.replaceAll("#S#", "#" + bindName + "#");
- m_where.append(" AND ");
- m_where.append(sql);
- //add bind if used
- if (!sOld.equals(sql)) {
- m_binds.put(bindName, sValue);
- }
- }
- }
-
- /**
- * Just adds the (localized) bind value for :S, replaces :S by the new bind name inside the statement and returns the
- * localized s
- *
- * @param sql
- * @param sValue
- * is the value for the :S bind
- */
- public String prepareWhereToken(String sql, Object sValue) {
- if (sql == null) {
- return null;
- }
- // create generic bind for S
- String bindName = "__" + m_bindSeq.incrementAndGet();
- String oldSql = sql;
- sql = sql.replaceAll(":S([^a-zA-Z0-9_])", ":" + bindName + "$1");
- sql = sql.replaceAll(":S$", ":" + bindName);
- sql = sql.replaceAll("#S#", "#" + bindName + "#");
- //add bind if used
- if (!oldSql.equals(sql)) {
- m_binds.put(bindName, sValue);
- }
- return sql;
- }
-
- public void addWhere(String sql) {
- if (sql != null) {
- m_where.append(sql);
- }
- }
-
- public String getWhere() {
- return m_where.toString();
- }
-
- public Map<String, Object> getBinds() {
- return m_binds;
- }
-
- /**
- * subclass to handle complex tokens
- */
- protected void buildToken(int key, Object[] args) {
- //default
- String s = getTokenMapping(key);
- if (s == null && !hasTokenMapping(key)) {
- LOG.warn("null BsiCrmFieldMapping for key " + key);
- }
- if (s != null && s.length() > 0 && !"1=1".equals(s)) {
- Object sValue = (args != null && args.length > 0 ? args[0] : null);
- this.addWhereToken(s, sValue);
- }
- }
-
- protected void buildTree(AndNodeToken root) {
- String s = buildAndNodes(root.getChildren(), false);
- if (s != null) {
- addWhereToken(s);
- }
- }
-
- protected String buildNode(TreeNodeToken node) {
- String s = null;
- if (node instanceof EntityNodeToken) {
- s = buildEntityNode((EntityNodeToken) node);
- }
- else if (node instanceof AttributeNodeToken) {
- s = buildAttributeNode((AttributeNodeToken) node);
- }
- else if (node instanceof AndNodeToken) {
- s = buildAndNodes(node.getChildren(), true);
- }
- else if (node instanceof OrNodeToken) {
- s = buildOrNodes(node.getChildren(), true);
- }
- if (s == null) {
- return null;
- }
- if (node.isNegative()) {
- return "NOT (" + s + ")";
- }
- return s;
- }
-
- protected String buildAndNodes(List<TreeNodeToken> nodes, boolean bracket) {
- StringBuilder buf = new StringBuilder();
- int count = 0;
- for (TreeNodeToken node : nodes) {
- String s = buildNode(node);
- if (s != null) {
- if (count > 0) {
- buf.append(" AND ");
- }
- buf.append(s);
- count++;
- }
- }
- if (count == 0) {
- return null;
- }
- if (bracket) {
- return "(" + buf.toString() + ")";
- }
- return buf.toString();
- }
-
- protected String buildOrNodes(List<TreeNodeToken> nodes, boolean bracket) {
- StringBuilder buf = new StringBuilder();
- int count = 0;
- for (TreeNodeToken node : nodes) {
- String s = buildNode(node);
- if (s != null) {
- if (count > 0) {
- buf.append(" OR ");
- }
- buf.append(s);
- count++;
- }
- }
- if (count == 0) {
- return null;
- }
- if (bracket) {
- return "(" + buf.toString() + ")";
- }
- return buf.toString();
- }
-
- protected String buildEntityNode(EntityNodeToken eNode) {
- String stm = getTokenMapping(eNode.getTokenId());
- if (stm == null) {
- LOG.warn("no token defined for entity " + eNode.getTokenId());
- return null;
- }
- // add children
- String ch = buildAndNodes(eNode.getChildren(), true);
- if (ch != null) {
- ch = " AND " + ch;
- }
- else {
- ch = "";
- }
- if (stm.indexOf("<attributes/>") >= 0) {
- stm = StringUtility.replace(stm, "<attributes/>", ch);
- }
- else if (stm.indexOf("#W#") >= 0) {
- // legacy
- stm = StringUtility.replace(stm, "#W#", ch);
- }
- else if (ch.length() > 0) {
- stm = stm + ch;
- }
- if (stm.length() > 0) {
- return stm;
- }
- else {
- return null;
- }
- }
-
- protected String buildAttributeNode(final AttributeNodeToken aNode) {
- String baseStatement = getTokenMapping(aNode.getTokenId());
- if (baseStatement == null) {
- LOG.warn("no token defined for attribute " + aNode.getTokenId());
- return null;
- }
- Object[] args = aNode.getValues();
- final Object sValue = (args != null && args.length > 0 ? args[0] : null);
- // replace the S in the string by the generated unique bind name
- String sql = prepareWhereToken(baseStatement, sValue);
- if (!sql.equals(baseStatement)) {
- // the attribute was of the form: P.PNAME = #S# (contains references to S)
- // this is legacy and is not supported for attribute decoration below
- return sql;
- }
- // the attribute was of the form: P.PNAME or
- // <attribute>P.PNAME</attribute>
- // make sure there is an attribute tag in the string, if none enclose all
- // by default
- if (sql.indexOf("<attribute>") < 0) {
- sql = "<attribute>" + sql + "</attribute>";
- }
- // tag replacement
- ITagProcessor processor = new ITagProcessor() {
- @Override
- public String processTag(String tagName, String attribute) {
- return buildAttributeOpValue(attribute, aNode.getOp(), sValue);
- }
- };
- return StringUtility.replaceTags(sql, "attribute", processor);
- }
-
- protected String buildAttributeOpValue(String att, int op, Object value) {
- LegacyStatementBuilder b = new LegacyStatementBuilder(getSqlStyle());
- String attOpValue = b.resolveComposerAttribute(op, att, "S", value);
- //adds the bind but not the sql text
- String sql = prepareWhereToken(attOpValue, value);
- return sql;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc.builder;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.StringUtility.ITagProcessor;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.server.services.common.jdbc.SQL;
+import org.eclipse.scout.rt.server.services.common.jdbc.internal.legacy.LegacyStatementBuilder;
+import org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle;
+import org.eclipse.scout.rt.shared.services.common.jdbc.SearchFilter;
+import org.eclipse.scout.rt.shared.services.common.jdbc.TokenBasedSearchFilter;
+import org.eclipse.scout.rt.shared.services.common.jdbc.TokenBasedSearchFilter.AndNodeToken;
+import org.eclipse.scout.rt.shared.services.common.jdbc.TokenBasedSearchFilter.AttributeNodeToken;
+import org.eclipse.scout.rt.shared.services.common.jdbc.TokenBasedSearchFilter.EntityNodeToken;
+import org.eclipse.scout.rt.shared.services.common.jdbc.TokenBasedSearchFilter.OrNodeToken;
+import org.eclipse.scout.rt.shared.services.common.jdbc.TokenBasedSearchFilter.TreeNodeToken;
+import org.eclipse.scout.rt.shared.services.common.jdbc.TokenBasedSearchFilter.ValueToken;
+import org.eclipse.scout.rt.shared.services.common.jdbc.TokenBasedSearchFilter.WildcardStringToken;
+
+/**
+ * Builds sql based on static defined token fragments.
+ * <p>
+ * Checks the value type of every bind to avoid unexpected type injections. Makes sure no sql injection is applied.
+ * <p>
+ * subclass to add token mappings and handle complex tokens in {@link #buildToken(int, Object[])}
+ */
+public class TokenBasedStatementBuilder {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(TokenBasedStatementBuilder.class);
+
+ private final ISqlStyle m_sqlStyle;
+ private final HashMap<Integer, String> m_tokenMappings = new HashMap<Integer, String>();
+ private final AtomicLong m_bindSeq = new AtomicLong();
+ private final HashMap<String, Object> m_binds = new HashMap<String, Object>();
+ private final StringBuffer m_where = new StringBuffer("");
+ /**
+ * speed-up due to static caching of default mappings
+ */
+ private TokenBasedStatementBuilder m_staticBuilder;
+
+ public TokenBasedStatementBuilder() {
+ this(null);
+ }
+
+ public TokenBasedStatementBuilder(ISqlStyle sqlStyle) {
+ m_sqlStyle = sqlStyle != null ? sqlStyle : SQL.getSqlStyle();
+ }
+
+ public void setStaticBuilder(TokenBasedStatementBuilder staticBuilder) {
+ m_staticBuilder = staticBuilder;
+ }
+
+ public TokenBasedStatementBuilder getStaticBuilder() {
+ return m_staticBuilder;
+ }
+
+ public ISqlStyle getSqlStyle() {
+ return m_sqlStyle;
+ }
+
+ public void build(SearchFilter filter) {
+ if (!(filter instanceof TokenBasedSearchFilter)) {
+ LOG.warn("unexpected filter type", new IllegalArgumentException("expected search filter of type " + TokenBasedSearchFilter.class.getSimpleName()));
+ return;
+ }
+ TokenBasedSearchFilter tokenFilter = (TokenBasedSearchFilter) filter;
+ for (ValueToken t : tokenFilter.getValueTokens()) {
+ checkValueTypes(t.getValues());
+ buildToken(t.getTokenId(), t.getValues());
+ }
+ for (WildcardStringToken t : tokenFilter.getWildcardStringTokens()) {
+ if (t.getValue() != null) {
+ String s = m_sqlStyle.toLikePattern(t.getValue());
+ buildToken(t.getTokenId(), new Object[]{s});
+ }
+ }
+ for (AndNodeToken root : tokenFilter.getTreeTokens()) {
+ buildTree(root);
+ }
+ }
+
+ public void addTokenMapping(int key, String sql) {
+ if (m_tokenMappings.put(key, sql) != null) {
+ throw new IllegalArgumentException("duplicate token key: " + key);
+ }
+ }
+
+ public String getTokenMapping(int key) {
+ String s = m_tokenMappings.get(key);
+ if (s != null) {
+ return s;
+ }
+ if (m_staticBuilder != null) {
+ return m_staticBuilder.getTokenMapping(key);
+ }
+ return null;
+ }
+
+ public boolean hasTokenMapping(int key) {
+ boolean b = m_tokenMappings.containsKey(key);
+ if (b) {
+ return b;
+ }
+ if (m_staticBuilder != null) {
+ return m_staticBuilder.hasTokenMapping(key);
+ }
+ return false;
+ }
+
+ /**
+ * {@link #checkValueType(Object)}
+ */
+ public void checkValueTypes(Object[] args) {
+ if (args != null) {
+ for (Object o : args) {
+ checkValueType(o);
+ }
+ }
+ }
+
+ /**
+ * Check if value is of basic value type (avoid injection of unexpected complex types)
+ * <p>
+ * Default allows only Number, String, Date, Boolean, Character, Byte as well as arrays and primitive types of
+ * forementioned.
+ */
+ public void checkValueType(Object o) {
+ if (o == null) {
+ return;
+ }
+ Class<?> c = o.getClass();
+ while (c != null && c.isArray()) {
+ c = c.getComponentType();
+ }
+ if (c == null) {
+ return;
+ }
+ if (c.isPrimitive()) {
+ return;
+ }
+ if (Number.class.isAssignableFrom(c) ||
+ String.class.isAssignableFrom(c) ||
+ Date.class.isAssignableFrom(c) ||
+ Boolean.class.isAssignableFrom(c) ||
+ Character.class.isAssignableFrom(c) ||
+ Byte.class.isAssignableFrom(c)) {
+ return;
+ }
+ //illegal type
+ throw new IllegalArgumentException("unexpected and therefore illegal parameter type: " + c.getName());
+ }
+
+ public void addWhereToken(String sql) {
+ if (sql != null) {
+ m_where.append(" AND ");
+ addWhere(sql);
+ }
+ }
+
+ /**
+ * @param sql
+ * @param sValue
+ * is the value for the :S bind
+ */
+ public void addWhereToken(String sql, Object sValue) {
+ if (sql != null) {
+ // create generic bind for S
+ String bindName = "__" + m_bindSeq.incrementAndGet();
+ String sOld = sql;
+ sql = sql.replaceAll(":S([^a-zA-Z0-9_])", ":" + bindName + "$1");
+ sql = sql.replaceAll(":S$", ":" + bindName);
+ sql = sql.replaceAll("#S#", "#" + bindName + "#");
+ m_where.append(" AND ");
+ m_where.append(sql);
+ //add bind if used
+ if (!sOld.equals(sql)) {
+ m_binds.put(bindName, sValue);
+ }
+ }
+ }
+
+ /**
+ * Just adds the (localized) bind value for :S, replaces :S by the new bind name inside the statement and returns the
+ * localized s
+ *
+ * @param sql
+ * @param sValue
+ * is the value for the :S bind
+ */
+ public String prepareWhereToken(String sql, Object sValue) {
+ if (sql == null) {
+ return null;
+ }
+ // create generic bind for S
+ String bindName = "__" + m_bindSeq.incrementAndGet();
+ String oldSql = sql;
+ sql = sql.replaceAll(":S([^a-zA-Z0-9_])", ":" + bindName + "$1");
+ sql = sql.replaceAll(":S$", ":" + bindName);
+ sql = sql.replaceAll("#S#", "#" + bindName + "#");
+ //add bind if used
+ if (!oldSql.equals(sql)) {
+ m_binds.put(bindName, sValue);
+ }
+ return sql;
+ }
+
+ public void addWhere(String sql) {
+ if (sql != null) {
+ m_where.append(sql);
+ }
+ }
+
+ public String getWhere() {
+ return m_where.toString();
+ }
+
+ public Map<String, Object> getBinds() {
+ return m_binds;
+ }
+
+ /**
+ * subclass to handle complex tokens
+ */
+ protected void buildToken(int key, Object[] args) {
+ //default
+ String s = getTokenMapping(key);
+ if (s == null && !hasTokenMapping(key)) {
+ LOG.warn("null BsiCrmFieldMapping for key " + key);
+ }
+ if (s != null && s.length() > 0 && !"1=1".equals(s)) {
+ Object sValue = (args != null && args.length > 0 ? args[0] : null);
+ this.addWhereToken(s, sValue);
+ }
+ }
+
+ protected void buildTree(AndNodeToken root) {
+ String s = buildAndNodes(root.getChildren(), false);
+ if (s != null) {
+ addWhereToken(s);
+ }
+ }
+
+ protected String buildNode(TreeNodeToken node) {
+ String s = null;
+ if (node instanceof EntityNodeToken) {
+ s = buildEntityNode((EntityNodeToken) node);
+ }
+ else if (node instanceof AttributeNodeToken) {
+ s = buildAttributeNode((AttributeNodeToken) node);
+ }
+ else if (node instanceof AndNodeToken) {
+ s = buildAndNodes(node.getChildren(), true);
+ }
+ else if (node instanceof OrNodeToken) {
+ s = buildOrNodes(node.getChildren(), true);
+ }
+ if (s == null) {
+ return null;
+ }
+ if (node.isNegative()) {
+ return "NOT (" + s + ")";
+ }
+ return s;
+ }
+
+ protected String buildAndNodes(List<TreeNodeToken> nodes, boolean bracket) {
+ StringBuilder buf = new StringBuilder();
+ int count = 0;
+ for (TreeNodeToken node : nodes) {
+ String s = buildNode(node);
+ if (s != null) {
+ if (count > 0) {
+ buf.append(" AND ");
+ }
+ buf.append(s);
+ count++;
+ }
+ }
+ if (count == 0) {
+ return null;
+ }
+ if (bracket) {
+ return "(" + buf.toString() + ")";
+ }
+ return buf.toString();
+ }
+
+ protected String buildOrNodes(List<TreeNodeToken> nodes, boolean bracket) {
+ StringBuilder buf = new StringBuilder();
+ int count = 0;
+ for (TreeNodeToken node : nodes) {
+ String s = buildNode(node);
+ if (s != null) {
+ if (count > 0) {
+ buf.append(" OR ");
+ }
+ buf.append(s);
+ count++;
+ }
+ }
+ if (count == 0) {
+ return null;
+ }
+ if (bracket) {
+ return "(" + buf.toString() + ")";
+ }
+ return buf.toString();
+ }
+
+ protected String buildEntityNode(EntityNodeToken eNode) {
+ String stm = getTokenMapping(eNode.getTokenId());
+ if (stm == null) {
+ LOG.warn("no token defined for entity " + eNode.getTokenId());
+ return null;
+ }
+ // add children
+ String ch = buildAndNodes(eNode.getChildren(), true);
+ if (ch != null) {
+ ch = " AND " + ch;
+ }
+ else {
+ ch = "";
+ }
+ if (stm.indexOf("<attributes/>") >= 0) {
+ stm = StringUtility.replace(stm, "<attributes/>", ch);
+ }
+ else if (stm.indexOf("#W#") >= 0) {
+ // legacy
+ stm = StringUtility.replace(stm, "#W#", ch);
+ }
+ else if (ch.length() > 0) {
+ stm = stm + ch;
+ }
+ if (stm.length() > 0) {
+ return stm;
+ }
+ else {
+ return null;
+ }
+ }
+
+ protected String buildAttributeNode(final AttributeNodeToken aNode) {
+ String baseStatement = getTokenMapping(aNode.getTokenId());
+ if (baseStatement == null) {
+ LOG.warn("no token defined for attribute " + aNode.getTokenId());
+ return null;
+ }
+ Object[] args = aNode.getValues();
+ final Object sValue = (args != null && args.length > 0 ? args[0] : null);
+ // replace the S in the string by the generated unique bind name
+ String sql = prepareWhereToken(baseStatement, sValue);
+ if (!sql.equals(baseStatement)) {
+ // the attribute was of the form: P.PNAME = #S# (contains references to S)
+ // this is legacy and is not supported for attribute decoration below
+ return sql;
+ }
+ // the attribute was of the form: P.PNAME or
+ // <attribute>P.PNAME</attribute>
+ // make sure there is an attribute tag in the string, if none enclose all
+ // by default
+ if (sql.indexOf("<attribute>") < 0) {
+ sql = "<attribute>" + sql + "</attribute>";
+ }
+ // tag replacement
+ ITagProcessor processor = new ITagProcessor() {
+ @Override
+ public String processTag(String tagName, String attribute) {
+ return buildAttributeOpValue(attribute, aNode.getOp(), sValue);
+ }
+ };
+ return StringUtility.replaceTags(sql, "attribute", processor);
+ }
+
+ protected String buildAttributeOpValue(String att, int op, Object value) {
+ LegacyStatementBuilder b = new LegacyStatementBuilder(getSqlStyle());
+ String attOpValue = b.resolveComposerAttribute(op, att, "S", value);
+ //adds the bind but not the sql text
+ String sql = prepareWhereToken(attOpValue, value);
+ return sql;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/ValuePartDefinition.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/ValuePartDefinition.java
index b960e93546..5f50092931 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/ValuePartDefinition.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/ValuePartDefinition.java
@@ -1,173 +1,173 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc.builder;
-
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.scout.commons.ClassIdentifier;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.shared.data.form.AbstractFormData;
-import org.eclipse.scout.rt.shared.data.form.fields.AbstractFormFieldData;
-import org.eclipse.scout.rt.shared.data.form.fields.AbstractValueFieldData;
-import org.eclipse.scout.rt.shared.data.form.properties.AbstractPropertyData;
-import org.eclipse.scout.rt.shared.data.model.DataModelConstants;
-
-/**
- * Definition of a property-to-sql and valueField-to-sql mapping for {@link AbstractPropertyData} and
- * {@link AbstractValueFieldData}
- *
- * @deprecated use the more general {@link BasicPartDefinition} instead.
- */
-@Deprecated
-public class ValuePartDefinition extends BasicPartDefinition {
-
- /**
- * @param valueType
- * {@link AbstractPropertyData} or {@link AbstractValueFieldData}
- * @param sqlAttribute
- * contains bind names :a, :b, :c for the values of the values correcpsonding to valueTypes
- * <p>
- * If different bind names are used,
- * {@link #createNewInstance(FormDataStatementBuilder, List, List, List, Map)} shoult be overridden
- * @param operator
- * any of the {@link DataModelConstants#OPERATOR_*} values
- */
- public ValuePartDefinition(Class<?> valueType, String sqlAttribute, int operator) {
- this(new Class[]{valueType}, sqlAttribute, operator, false);
- }
-
- /**
- * @param fieldTypeClassIdentifier
- * @param sqlAttribute
- * @param operator
- */
- public ValuePartDefinition(ClassIdentifier fieldTypeClassIdentifier, String sqlAttribute, int operator) {
- this(new ClassIdentifier[]{fieldTypeClassIdentifier}, sqlAttribute, operator, false);
- }
-
- /**
- * see {@link #ValuePartDefinition(Class, String, int)}
- */
- public ValuePartDefinition(Class<?> valueType, String sqlAttribute) {
- this(new Class[]{valueType}, sqlAttribute, DataModelConstants.OPERATOR_NONE, false);
- }
-
- /**
- * see {@link #ValuePartDefinition(Class, String, int)}
- */
- public ValuePartDefinition(Class<?>[] valueTypes, String sqlAttribute) {
- this(valueTypes, sqlAttribute, DataModelConstants.OPERATOR_NONE, false);
- }
-
- /**
- * see {@link #ValuePartDefinition(Class, String, int)}
- */
- public ValuePartDefinition(Class<?> valueType, String sqlAttribute, int operator, boolean plainBind) {
- this(new Class[]{valueType}, sqlAttribute, operator, plainBind);
- }
-
- /**
- * see {@link #ValuePartDefinition(Class, String, int)}
- */
- public ValuePartDefinition(ClassIdentifier valueTypeIdentifier, String sqlAttribute, int operator, boolean plainBind) {
- this(new ClassIdentifier[]{valueTypeIdentifier}, sqlAttribute, operator, plainBind);
- }
-
- /**
- * see {@link #ValuePartDefinition(Class, String, int)}
- */
- public ValuePartDefinition(Class<?>[] valueTypes, String sqlAttribute, int operator) {
- this(valueTypes, sqlAttribute, operator, false);
- }
-
- /**
- * see {@link #ValuePartDefinition(Class, String, int)}
- */
- public ValuePartDefinition(Class<?>[] valueTypes, String sqlAttribute, int operator, boolean plainBind) {
- this(ClassIdentifier.convertClassArrayToClassIdentifierArray(valueTypes), sqlAttribute, operator, plainBind);
- }
-
- /**
- * see {@link #ValuePartDefinition(Class, String, int)}
- */
- public ValuePartDefinition(ClassIdentifier[] valueTypeClassIdentifiers, String sqlAttribute, int operator, boolean plainBind) {
- super(valueTypeClassIdentifiers, sqlAttribute, operator, plainBind);
- }
-
- @Override
- public boolean accept(AbstractFormData formData) throws ProcessingException {
- Map<Integer, Map<String, AbstractFormFieldData>> fieldsBreathFirstMap = formData.getAllFieldsRec();
- Map<Integer, Map<String, AbstractPropertyData<?>>> propertiesBreathFirstMap = formData.getAllPropertiesRec();
- return accept(formData, fieldsBreathFirstMap, propertiesBreathFirstMap);
- }
-
- /**
- * Computes whether this {@link ValuePartDefinition} takes part in building the filter criterion.
- *
- * @param formData
- * the form data to be checked.
- * @param fieldsBreathFirstMap
- * The breath-first map of all form data fields as returned by {@link AbstractFormData#getAllFieldsRec()}.
- * @param propertiesBreathFirstMap
- * The breath-first map of all property data as returned by {@link AbstractFormData#getAllPropertiesRec()}
- * @return <code>true</code> if the properties in the form data are sufficient in order to append this part to the
- * result statement This will result in a call to
- * {@link #createNewInstance(FormDataStatementBuilder, List, List, List, Map)} building that part.
- * <p>
- * Default accepts when any of the value of the valueType set is set (isValueSet) and has a non-null value in
- * the form data
- * @throws ProcessingException
- */
- protected boolean accept(AbstractFormData formData, Map<Integer, Map<String, AbstractFormFieldData>> fieldsBreathFirstMap, Map<Integer, Map<String, AbstractPropertyData<?>>> propertiesBreathFirstMap) throws ProcessingException {
- if (getValueTypeClassIdentifiers().length > 0) {
- for (ClassIdentifier valueType : getValueTypeClassIdentifiers()) {
- Object dataObject = formData.findFieldByClass(fieldsBreathFirstMap, valueType);
- if (dataObject instanceof AbstractValueFieldData<?>) {
- AbstractValueFieldData<?> v = (AbstractValueFieldData<?>) dataObject;
- if (v.isValueSet() && v.getValue() != null) {
- return true;
- }
- }
- dataObject = formData.findPropertyByClass(propertiesBreathFirstMap, valueType);
- if (dataObject instanceof AbstractPropertyData<?>) {
- AbstractPropertyData<?> p = (AbstractPropertyData<?>) dataObject;
- if (p.isValueSet() && p.getValue() != null) {
- return true;
- }
- }
- }
- }
- return false;
- }
-
- @Override
- protected String createInstanceImpl(FormDataStatementBuilder builder, List<Object> valueDatas, List<String> bindNames, List<Object> bindValues, Map<String, String> parentAliasMap) throws ProcessingException {
- return createInstance(builder, valueDatas, bindNames, bindValues, parentAliasMap);
- }
-
- /**
- * @deprecated override
- * {@link BasicPartDefinition#createInstanceImpl(FormDataStatementBuilder, List, List, List, Map)} instead
- */
- @Deprecated
- protected String createInstance(FormDataStatementBuilder builder, List<Object> valueDatas, List<String> bindNames, List<Object> bindValues, Map<String, String> parentAliasMap) throws ProcessingException {
- return createNewInstance(builder, valueDatas, bindNames, bindValues, parentAliasMap);
- }
-
- /**
- * @deprecated use {@link #createInstance(FormDataStatementBuilder, List, List, List, Map)} instead
- */
- @Deprecated
- protected String createNewInstance(FormDataStatementBuilder builder, List<Object> valueDatas, List<String> bindNames, List<Object> bindValues, Map<String, String> parentAliasMap) throws ProcessingException {
- return builder.createSqlPart(DataModelConstants.AGGREGATION_NONE, getSqlAttribute(), getOperation(), bindNames, bindValues, isPlainBind(), parentAliasMap);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc.builder;
+
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.scout.commons.ClassIdentifier;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.shared.data.form.AbstractFormData;
+import org.eclipse.scout.rt.shared.data.form.fields.AbstractFormFieldData;
+import org.eclipse.scout.rt.shared.data.form.fields.AbstractValueFieldData;
+import org.eclipse.scout.rt.shared.data.form.properties.AbstractPropertyData;
+import org.eclipse.scout.rt.shared.data.model.DataModelConstants;
+
+/**
+ * Definition of a property-to-sql and valueField-to-sql mapping for {@link AbstractPropertyData} and
+ * {@link AbstractValueFieldData}
+ *
+ * @deprecated use the more general {@link BasicPartDefinition} instead.
+ */
+@Deprecated
+public class ValuePartDefinition extends BasicPartDefinition {
+
+ /**
+ * @param valueType
+ * {@link AbstractPropertyData} or {@link AbstractValueFieldData}
+ * @param sqlAttribute
+ * contains bind names :a, :b, :c for the values of the values correcpsonding to valueTypes
+ * <p>
+ * If different bind names are used,
+ * {@link #createNewInstance(FormDataStatementBuilder, List, List, List, Map)} shoult be overridden
+ * @param operator
+ * any of the {@link DataModelConstants#OPERATOR_*} values
+ */
+ public ValuePartDefinition(Class<?> valueType, String sqlAttribute, int operator) {
+ this(new Class[]{valueType}, sqlAttribute, operator, false);
+ }
+
+ /**
+ * @param fieldTypeClassIdentifier
+ * @param sqlAttribute
+ * @param operator
+ */
+ public ValuePartDefinition(ClassIdentifier fieldTypeClassIdentifier, String sqlAttribute, int operator) {
+ this(new ClassIdentifier[]{fieldTypeClassIdentifier}, sqlAttribute, operator, false);
+ }
+
+ /**
+ * see {@link #ValuePartDefinition(Class, String, int)}
+ */
+ public ValuePartDefinition(Class<?> valueType, String sqlAttribute) {
+ this(new Class[]{valueType}, sqlAttribute, DataModelConstants.OPERATOR_NONE, false);
+ }
+
+ /**
+ * see {@link #ValuePartDefinition(Class, String, int)}
+ */
+ public ValuePartDefinition(Class<?>[] valueTypes, String sqlAttribute) {
+ this(valueTypes, sqlAttribute, DataModelConstants.OPERATOR_NONE, false);
+ }
+
+ /**
+ * see {@link #ValuePartDefinition(Class, String, int)}
+ */
+ public ValuePartDefinition(Class<?> valueType, String sqlAttribute, int operator, boolean plainBind) {
+ this(new Class[]{valueType}, sqlAttribute, operator, plainBind);
+ }
+
+ /**
+ * see {@link #ValuePartDefinition(Class, String, int)}
+ */
+ public ValuePartDefinition(ClassIdentifier valueTypeIdentifier, String sqlAttribute, int operator, boolean plainBind) {
+ this(new ClassIdentifier[]{valueTypeIdentifier}, sqlAttribute, operator, plainBind);
+ }
+
+ /**
+ * see {@link #ValuePartDefinition(Class, String, int)}
+ */
+ public ValuePartDefinition(Class<?>[] valueTypes, String sqlAttribute, int operator) {
+ this(valueTypes, sqlAttribute, operator, false);
+ }
+
+ /**
+ * see {@link #ValuePartDefinition(Class, String, int)}
+ */
+ public ValuePartDefinition(Class<?>[] valueTypes, String sqlAttribute, int operator, boolean plainBind) {
+ this(ClassIdentifier.convertClassArrayToClassIdentifierArray(valueTypes), sqlAttribute, operator, plainBind);
+ }
+
+ /**
+ * see {@link #ValuePartDefinition(Class, String, int)}
+ */
+ public ValuePartDefinition(ClassIdentifier[] valueTypeClassIdentifiers, String sqlAttribute, int operator, boolean plainBind) {
+ super(valueTypeClassIdentifiers, sqlAttribute, operator, plainBind);
+ }
+
+ @Override
+ public boolean accept(AbstractFormData formData) throws ProcessingException {
+ Map<Integer, Map<String, AbstractFormFieldData>> fieldsBreathFirstMap = formData.getAllFieldsRec();
+ Map<Integer, Map<String, AbstractPropertyData<?>>> propertiesBreathFirstMap = formData.getAllPropertiesRec();
+ return accept(formData, fieldsBreathFirstMap, propertiesBreathFirstMap);
+ }
+
+ /**
+ * Computes whether this {@link ValuePartDefinition} takes part in building the filter criterion.
+ *
+ * @param formData
+ * the form data to be checked.
+ * @param fieldsBreathFirstMap
+ * The breath-first map of all form data fields as returned by {@link AbstractFormData#getAllFieldsRec()}.
+ * @param propertiesBreathFirstMap
+ * The breath-first map of all property data as returned by {@link AbstractFormData#getAllPropertiesRec()}
+ * @return <code>true</code> if the properties in the form data are sufficient in order to append this part to the
+ * result statement This will result in a call to
+ * {@link #createNewInstance(FormDataStatementBuilder, List, List, List, Map)} building that part.
+ * <p>
+ * Default accepts when any of the value of the valueType set is set (isValueSet) and has a non-null value in
+ * the form data
+ * @throws ProcessingException
+ */
+ protected boolean accept(AbstractFormData formData, Map<Integer, Map<String, AbstractFormFieldData>> fieldsBreathFirstMap, Map<Integer, Map<String, AbstractPropertyData<?>>> propertiesBreathFirstMap) throws ProcessingException {
+ if (getValueTypeClassIdentifiers().length > 0) {
+ for (ClassIdentifier valueType : getValueTypeClassIdentifiers()) {
+ Object dataObject = formData.findFieldByClass(fieldsBreathFirstMap, valueType);
+ if (dataObject instanceof AbstractValueFieldData<?>) {
+ AbstractValueFieldData<?> v = (AbstractValueFieldData<?>) dataObject;
+ if (v.isValueSet() && v.getValue() != null) {
+ return true;
+ }
+ }
+ dataObject = formData.findPropertyByClass(propertiesBreathFirstMap, valueType);
+ if (dataObject instanceof AbstractPropertyData<?>) {
+ AbstractPropertyData<?> p = (AbstractPropertyData<?>) dataObject;
+ if (p.isValueSet() && p.getValue() != null) {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ @Override
+ protected String createInstanceImpl(FormDataStatementBuilder builder, List<Object> valueDatas, List<String> bindNames, List<Object> bindValues, Map<String, String> parentAliasMap) throws ProcessingException {
+ return createInstance(builder, valueDatas, bindNames, bindValues, parentAliasMap);
+ }
+
+ /**
+ * @deprecated override
+ * {@link BasicPartDefinition#createInstanceImpl(FormDataStatementBuilder, List, List, List, Map)} instead
+ */
+ @Deprecated
+ protected String createInstance(FormDataStatementBuilder builder, List<Object> valueDatas, List<String> bindNames, List<Object> bindValues, Map<String, String> parentAliasMap) throws ProcessingException {
+ return createNewInstance(builder, valueDatas, bindNames, bindValues, parentAliasMap);
+ }
+
+ /**
+ * @deprecated use {@link #createInstance(FormDataStatementBuilder, List, List, List, Map)} instead
+ */
+ @Deprecated
+ protected String createNewInstance(FormDataStatementBuilder builder, List<Object> valueDatas, List<String> bindNames, List<Object> bindValues, Map<String, String> parentAliasMap) throws ProcessingException {
+ return builder.createSqlPart(DataModelConstants.AGGREGATION_NONE, getSqlAttribute(), getOperation(), bindNames, bindValues, isPlainBind(), parentAliasMap);
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/dict/ColumnDesc.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/dict/ColumnDesc.java
index eccd3b8622..a4d9655d5d 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/dict/ColumnDesc.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/dict/ColumnDesc.java
@@ -1,93 +1,93 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc.dict;
-
-public class ColumnDesc implements java.io.Serializable {
- private static final long serialVersionUID = 596863413691696972L;
-
- private String m_name;
- private String m_typeName;
- private long m_size;
- private long m_precision;
- private long m_decimalDigits;
- private boolean m_nullable;
- private String m_defaultValue;
-
- // for IScoutSerializable
- private ColumnDesc() {
- }
-
- public ColumnDesc(String name, String typeName, long size, long precision, long decimalDigits, boolean isNullable) {
- this(name, typeName, size, precision, decimalDigits, isNullable, null);
- }
-
- public ColumnDesc(String name, String typeName, long size, long precision, long decimalDigits, boolean isNullable, String defaultValue) {
- m_name = name;
- m_typeName = typeName;
- m_size = size;
- m_precision = precision;
- m_decimalDigits = decimalDigits;
- m_nullable = isNullable;
- if (defaultValue != null) {
- m_defaultValue = defaultValue.trim();
- }
- }
-
- public String getName() {
- return m_name;
- }
-
- public String getTypeName() {
- return m_typeName;
- }
-
- public long getSize() {
- return m_size;
- }
-
- public long getPrecision() {
- return m_precision;
- }
-
- public long getDecimalDigits() {
- return m_decimalDigits;
- }
-
- public boolean isNullable() {
- return m_nullable;
- }
-
- public String getDefaultValue() {
- return m_defaultValue;
- }
-
- public String toXml() {
- StringBuffer buf = new StringBuffer();
- buf.append("<column");
- buf.append(" name=\"" + m_name + "\"");
- buf.append(" type=\"" + m_typeName + "\"");
- buf.append(" nullable=\"" + (m_nullable ? "yes" : "no") + "\"");
- if (m_size != 0) {
- buf.append(" size=\"" + m_size + "\"");
- }
- if (m_precision != 0) {
- buf.append(" precision=\"" + m_precision + "\"");
- }
- if (m_decimalDigits != 0) {
- buf.append(" decimaldigits=\"" + m_decimalDigits + "\"");
- }
- if (m_defaultValue != null) {
- buf.append(" defaultValue=\"" + m_defaultValue + "\"");
- }
- buf.append("/>\n");
- return buf.toString();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc.dict;
+
+public class ColumnDesc implements java.io.Serializable {
+ private static final long serialVersionUID = 596863413691696972L;
+
+ private String m_name;
+ private String m_typeName;
+ private long m_size;
+ private long m_precision;
+ private long m_decimalDigits;
+ private boolean m_nullable;
+ private String m_defaultValue;
+
+ // for IScoutSerializable
+ private ColumnDesc() {
+ }
+
+ public ColumnDesc(String name, String typeName, long size, long precision, long decimalDigits, boolean isNullable) {
+ this(name, typeName, size, precision, decimalDigits, isNullable, null);
+ }
+
+ public ColumnDesc(String name, String typeName, long size, long precision, long decimalDigits, boolean isNullable, String defaultValue) {
+ m_name = name;
+ m_typeName = typeName;
+ m_size = size;
+ m_precision = precision;
+ m_decimalDigits = decimalDigits;
+ m_nullable = isNullable;
+ if (defaultValue != null) {
+ m_defaultValue = defaultValue.trim();
+ }
+ }
+
+ public String getName() {
+ return m_name;
+ }
+
+ public String getTypeName() {
+ return m_typeName;
+ }
+
+ public long getSize() {
+ return m_size;
+ }
+
+ public long getPrecision() {
+ return m_precision;
+ }
+
+ public long getDecimalDigits() {
+ return m_decimalDigits;
+ }
+
+ public boolean isNullable() {
+ return m_nullable;
+ }
+
+ public String getDefaultValue() {
+ return m_defaultValue;
+ }
+
+ public String toXml() {
+ StringBuffer buf = new StringBuffer();
+ buf.append("<column");
+ buf.append(" name=\"" + m_name + "\"");
+ buf.append(" type=\"" + m_typeName + "\"");
+ buf.append(" nullable=\"" + (m_nullable ? "yes" : "no") + "\"");
+ if (m_size != 0) {
+ buf.append(" size=\"" + m_size + "\"");
+ }
+ if (m_precision != 0) {
+ buf.append(" precision=\"" + m_precision + "\"");
+ }
+ if (m_decimalDigits != 0) {
+ buf.append(" decimaldigits=\"" + m_decimalDigits + "\"");
+ }
+ if (m_defaultValue != null) {
+ buf.append(" defaultValue=\"" + m_defaultValue + "\"");
+ }
+ buf.append("/>\n");
+ return buf.toString();
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/dict/CongruencyFilter.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/dict/CongruencyFilter.java
index 27f308e6b4..f82e7a8ad2 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/dict/CongruencyFilter.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/dict/CongruencyFilter.java
@@ -1,220 +1,220 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc.dict;
-
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-
-public class CongruencyFilter {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(CongruencyFilter.class);
- private ArrayList<String> m_forceTriggerChangeTableNames = new ArrayList<String>();
-
- public boolean isRelevant(Object o) {
- return true; // every object is relevant
- }
-
- public boolean allowDropTable() {
- return false;
- }
-
- public boolean allowDropTableColumn() {
- return false;
- }
-
- public void forceTriggerChange(String fullTableName) {
- m_forceTriggerChangeTableNames.add(fullTableName);
- }
-
- public boolean isTriggerChanged(String fullTableName) {
- return m_forceTriggerChangeTableNames.contains(fullTableName);
- }
-
- public boolean isAnyTriggerChanged() {
- return m_forceTriggerChangeTableNames.size() > 0;
- }
-
- public boolean isCongruent(DataDictionary o1, DataDictionary o2) {
- // don't check schema name
- return isCongruentAndRelevant(o1.getTables(), o2.getTables()) &&
- isCongruentAndRelevant(o1.getViews(), o2.getViews()) &&
- isCongruentAndRelevant(o1.getSequences(), o2.getSequences());
- }
-
- public boolean isCongruent(TableDesc o1, TableDesc o2) {
- // forced changes
- if (o1 != null && isTriggerChanged(o1.getFullName())) {
- return false;
- }
- if (o2 != null && isTriggerChanged(o2.getFullName())) {
- return false;
- }
- // default
- if (o1 == o2) {
- return true;
- }
- if (o1 == null || o2 == null) {
- return false;
- }
- return o1.getName().equals(o2.getName()) &&
- isCongruent(o1.getPrimaryKey(), o2.getPrimaryKey()) &&
- isCongruentAndRelevant(o1.getColumns(), o2.getColumns()) &&
- isCongruentAndRelevant(o1.getIndices(), o2.getIndices()) &&
- isCongruentAndRelevant(o1.getGrants(), o2.getGrants());
- }
-
- public boolean isCongruent(ViewDesc o1, ViewDesc o2) {
- if (o1 == o2) {
- return true;
- }
- if (o1 == null || o2 == null) {
- return false;
- }
- return o1.getName().equals(o2.getName()) &&
- o1.getStatement().equals(o2.getStatement()) &&
- isCongruentAndRelevant(o1.getGrants(), o2.getGrants());
- }
-
- public boolean isCongruent(TableGrantDesc o1, TableGrantDesc o2) {
- if (o1 == o2) {
- return true;
- }
- if (o1 == null || o2 == null) {
- return false;
- }
- return o1.getGrantee().equals(o2.getGrantee()) &&
- o1.getType().equals(o2.getType());
- }
-
- public boolean isCongruent(ColumnDesc o1, ColumnDesc o2) {
- if (o1 == o2) {
- return true;
- }
- if (o1 == null || o2 == null) {
- return false;
- }
- //
- return o1.getName().equals(o2.getName()) &&
- o1.isNullable() == o2.isNullable() &&
- getCanonicalColumnType(o1).equals(getCanonicalColumnType(o2));
- }
-
- public boolean isCongruent(IndexDesc o1, IndexDesc o2) {
- if (o1 == o2) {
- return true;
- }
- if (o1 == null || o2 == null) {
- return false;
- }
- return o1.isUnique() == o2.isUnique() &&
- o1.getColumnNames().equals(o2.getColumnNames());// equality of content
- // AND order
- }
-
- public boolean isCongruent(PrimaryKeyDesc o1, PrimaryKeyDesc o2) {
- if (o1 == o2) {
- return true;
- }
- if (o1 == null || o2 == null) {
- return false;
- }
- return o1.getColumnNames().equals(o2.getColumnNames());// equality of
- // content AND order
- }
-
- public boolean isCongruent(SequenceDesc o1, SequenceDesc o2) {
- if (o1 == o2) {
- return true;
- }
- if (o1 == null || o2 == null) {
- return false;
- }
- return o1.getName().equals(o2.getName());
- }
-
- public boolean isCongruentAndRelevant(Collection c1, Collection c2) {
- for (Iterator it = c1.iterator(); it.hasNext();) {
- Object o = it.next();
- if (isRelevant(o)) {
- if (!containsCongruent(c2, o)) {
- return false;
- }
- }
- }
- for (Iterator it = c2.iterator(); it.hasNext();) {
- Object o = it.next();
- if (isRelevant(o)) {
- if (!containsCongruent(c1, o)) {
- return false;
- }
- }
- }
- return true;
- }
-
- public boolean containsCongruent(Collection c, Object o) {
- if (o == null) {
- return false;
- }
- try {
- Method m = getClass().getMethod("isCongruent", new Class[]{o.getClass(), o.getClass()});
- for (Iterator it = c.iterator(); it.hasNext();) {
- Object o1 = it.next();
- // use reflection
- boolean found = ((Boolean) m.invoke(this, new Object[]{o1, o})).booleanValue();
- if (found) {
- return true;
- }
- }
- }
- catch (Exception e) {
- LOG.error("Error in reflection on Collection " + c + " and Object " + o + ":" + e, e);
- }
- return false;
- }
-
- public boolean isNumeric(ColumnDesc cd) {
- String type = cd.getTypeName().toUpperCase();
- return (type.equals("INT") ||
- type.equals("INTEGER") ||
- type.equals("DOUBLE") ||
- type.equals("DOUBLE PRECISION") ||
- type.equals("REAL") ||
- type.equals("BIGINT") ||
- type.equals("SMALLINT") ||
- type.equals("TINYINT") ||
- type.equals("NUMBER") || type.equals("DECIMAL"));
- }
-
- public String getCanonicalColumnType(ColumnDesc cd) {
- String type = cd.getTypeName().toUpperCase();
- // generic, if size <>0 then use size, if also decimaldigits <>0 then also
- // use that parameter
- if (cd.getPrecision() > 0) {
- if (cd.getDecimalDigits() > 0) {
- return type + "(" + cd.getPrecision() + "," + cd.getDecimalDigits() + ")";
- }
- else {
- return type + "(" + cd.getPrecision() + ")";
- }
- }
- if (cd.getSize() > 0) {
- return type + "(" + cd.getSize() + ")";
- }
- // return raw type
- return type;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc.dict;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+
+public class CongruencyFilter {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(CongruencyFilter.class);
+ private ArrayList<String> m_forceTriggerChangeTableNames = new ArrayList<String>();
+
+ public boolean isRelevant(Object o) {
+ return true; // every object is relevant
+ }
+
+ public boolean allowDropTable() {
+ return false;
+ }
+
+ public boolean allowDropTableColumn() {
+ return false;
+ }
+
+ public void forceTriggerChange(String fullTableName) {
+ m_forceTriggerChangeTableNames.add(fullTableName);
+ }
+
+ public boolean isTriggerChanged(String fullTableName) {
+ return m_forceTriggerChangeTableNames.contains(fullTableName);
+ }
+
+ public boolean isAnyTriggerChanged() {
+ return m_forceTriggerChangeTableNames.size() > 0;
+ }
+
+ public boolean isCongruent(DataDictionary o1, DataDictionary o2) {
+ // don't check schema name
+ return isCongruentAndRelevant(o1.getTables(), o2.getTables()) &&
+ isCongruentAndRelevant(o1.getViews(), o2.getViews()) &&
+ isCongruentAndRelevant(o1.getSequences(), o2.getSequences());
+ }
+
+ public boolean isCongruent(TableDesc o1, TableDesc o2) {
+ // forced changes
+ if (o1 != null && isTriggerChanged(o1.getFullName())) {
+ return false;
+ }
+ if (o2 != null && isTriggerChanged(o2.getFullName())) {
+ return false;
+ }
+ // default
+ if (o1 == o2) {
+ return true;
+ }
+ if (o1 == null || o2 == null) {
+ return false;
+ }
+ return o1.getName().equals(o2.getName()) &&
+ isCongruent(o1.getPrimaryKey(), o2.getPrimaryKey()) &&
+ isCongruentAndRelevant(o1.getColumns(), o2.getColumns()) &&
+ isCongruentAndRelevant(o1.getIndices(), o2.getIndices()) &&
+ isCongruentAndRelevant(o1.getGrants(), o2.getGrants());
+ }
+
+ public boolean isCongruent(ViewDesc o1, ViewDesc o2) {
+ if (o1 == o2) {
+ return true;
+ }
+ if (o1 == null || o2 == null) {
+ return false;
+ }
+ return o1.getName().equals(o2.getName()) &&
+ o1.getStatement().equals(o2.getStatement()) &&
+ isCongruentAndRelevant(o1.getGrants(), o2.getGrants());
+ }
+
+ public boolean isCongruent(TableGrantDesc o1, TableGrantDesc o2) {
+ if (o1 == o2) {
+ return true;
+ }
+ if (o1 == null || o2 == null) {
+ return false;
+ }
+ return o1.getGrantee().equals(o2.getGrantee()) &&
+ o1.getType().equals(o2.getType());
+ }
+
+ public boolean isCongruent(ColumnDesc o1, ColumnDesc o2) {
+ if (o1 == o2) {
+ return true;
+ }
+ if (o1 == null || o2 == null) {
+ return false;
+ }
+ //
+ return o1.getName().equals(o2.getName()) &&
+ o1.isNullable() == o2.isNullable() &&
+ getCanonicalColumnType(o1).equals(getCanonicalColumnType(o2));
+ }
+
+ public boolean isCongruent(IndexDesc o1, IndexDesc o2) {
+ if (o1 == o2) {
+ return true;
+ }
+ if (o1 == null || o2 == null) {
+ return false;
+ }
+ return o1.isUnique() == o2.isUnique() &&
+ o1.getColumnNames().equals(o2.getColumnNames());// equality of content
+ // AND order
+ }
+
+ public boolean isCongruent(PrimaryKeyDesc o1, PrimaryKeyDesc o2) {
+ if (o1 == o2) {
+ return true;
+ }
+ if (o1 == null || o2 == null) {
+ return false;
+ }
+ return o1.getColumnNames().equals(o2.getColumnNames());// equality of
+ // content AND order
+ }
+
+ public boolean isCongruent(SequenceDesc o1, SequenceDesc o2) {
+ if (o1 == o2) {
+ return true;
+ }
+ if (o1 == null || o2 == null) {
+ return false;
+ }
+ return o1.getName().equals(o2.getName());
+ }
+
+ public boolean isCongruentAndRelevant(Collection c1, Collection c2) {
+ for (Iterator it = c1.iterator(); it.hasNext();) {
+ Object o = it.next();
+ if (isRelevant(o)) {
+ if (!containsCongruent(c2, o)) {
+ return false;
+ }
+ }
+ }
+ for (Iterator it = c2.iterator(); it.hasNext();) {
+ Object o = it.next();
+ if (isRelevant(o)) {
+ if (!containsCongruent(c1, o)) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ public boolean containsCongruent(Collection c, Object o) {
+ if (o == null) {
+ return false;
+ }
+ try {
+ Method m = getClass().getMethod("isCongruent", new Class[]{o.getClass(), o.getClass()});
+ for (Iterator it = c.iterator(); it.hasNext();) {
+ Object o1 = it.next();
+ // use reflection
+ boolean found = ((Boolean) m.invoke(this, new Object[]{o1, o})).booleanValue();
+ if (found) {
+ return true;
+ }
+ }
+ }
+ catch (Exception e) {
+ LOG.error("Error in reflection on Collection " + c + " and Object " + o + ":" + e, e);
+ }
+ return false;
+ }
+
+ public boolean isNumeric(ColumnDesc cd) {
+ String type = cd.getTypeName().toUpperCase();
+ return (type.equals("INT") ||
+ type.equals("INTEGER") ||
+ type.equals("DOUBLE") ||
+ type.equals("DOUBLE PRECISION") ||
+ type.equals("REAL") ||
+ type.equals("BIGINT") ||
+ type.equals("SMALLINT") ||
+ type.equals("TINYINT") ||
+ type.equals("NUMBER") || type.equals("DECIMAL"));
+ }
+
+ public String getCanonicalColumnType(ColumnDesc cd) {
+ String type = cd.getTypeName().toUpperCase();
+ // generic, if size <>0 then use size, if also decimaldigits <>0 then also
+ // use that parameter
+ if (cd.getPrecision() > 0) {
+ if (cd.getDecimalDigits() > 0) {
+ return type + "(" + cd.getPrecision() + "," + cd.getDecimalDigits() + ")";
+ }
+ else {
+ return type + "(" + cd.getPrecision() + ")";
+ }
+ }
+ if (cd.getSize() > 0) {
+ return type + "(" + cd.getSize() + ")";
+ }
+ // return raw type
+ return type;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/dict/DataDictionary.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/dict/DataDictionary.java
index 5c719d6059..87d07e8b51 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/dict/DataDictionary.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/dict/DataDictionary.java
@@ -1,128 +1,128 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc.dict;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-public class DataDictionary implements Serializable {
- private static final long serialVersionUID = -485573072845041815L;
- private transient boolean m_valid = true;
- private int m_sourceType = 100;
- private String m_schema;
- private HashMap<String, TableDesc> m_tables;
- private HashMap<String, ViewDesc> m_views;
- private HashMap<String, SequenceDesc> m_sequences;
-
- // for IScoutSerializable
- private DataDictionary() {
- }
-
- public boolean isValid() {
- return m_valid;
- }
-
- public void invalidate() {
- m_valid = false;
- }
-
- public DataDictionary(String schema) {
- m_schema = schema.toUpperCase();
- m_tables = new HashMap<String, TableDesc>();
- m_views = new HashMap<String, ViewDesc>();
- m_sequences = new HashMap<String, SequenceDesc>();
- }
-
- public void setSourceType(int t) {
- m_sourceType = t;
- }
-
- public int getSourceType() {
- return m_sourceType;
- }
-
- public String getSchema() {
- return m_schema;
- }
-
- public List<TableDesc> getTables() {
- return new ArrayList<TableDesc>(m_tables.values());
- }
-
- public void addTable(TableDesc td) {
- m_tables.put(td.getName(), td);
- }
-
- public void removeTable(String name) {
- m_tables.remove(name);
- }
-
- /**
- * can be full table name or raw table name
- */
- public TableDesc getTable(String name) {
- // remove qualification
- if (name.startsWith(getSchema() + ".")) {
- name = name.substring(getSchema().length() + 1);
- }
- TableDesc td = m_tables.get(name);
- return td;
- }
-
- public List<ViewDesc> getViews() {
- return new ArrayList<ViewDesc>(m_views.values());
- }
-
- public void addView(ViewDesc vd) {
- m_views.put(vd.getName(), vd);
- }
-
- public ViewDesc getView(String name) {
- return m_views.get(name);
- }
-
- public List<SequenceDesc> getSequences() {
- return new ArrayList<SequenceDesc>(m_sequences.values());
- }
-
- public void addSequence(SequenceDesc sd) {
- m_sequences.put(sd.getName(), sd);
- }
-
- public SequenceDesc getSequence(String name) {
- return m_sequences.get(name);
- }
-
- public String toXml() {
- StringBuffer buf = new StringBuffer();
- buf.append("<datadictionary schema=\"" + m_schema + "\">\n");
- buf.append("<tables>\n");
- for (TableDesc td : m_tables.values()) {
- buf.append(td.toXml() + "\n");
- }
- buf.append("</tables>\n");
- buf.append("<views>\n");
- for (ViewDesc vd : m_views.values()) {
- buf.append(vd.toXml() + "\n");
- }
- buf.append("</views>\n");
- buf.append("<sequences>\n");
- for (SequenceDesc sd : m_sequences.values()) {
- buf.append(sd.toXml() + "\n");
- }
- buf.append("</sequences>\n");
- buf.append("</datadictionary>\n");
- return buf.toString();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc.dict;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+public class DataDictionary implements Serializable {
+ private static final long serialVersionUID = -485573072845041815L;
+ private transient boolean m_valid = true;
+ private int m_sourceType = 100;
+ private String m_schema;
+ private HashMap<String, TableDesc> m_tables;
+ private HashMap<String, ViewDesc> m_views;
+ private HashMap<String, SequenceDesc> m_sequences;
+
+ // for IScoutSerializable
+ private DataDictionary() {
+ }
+
+ public boolean isValid() {
+ return m_valid;
+ }
+
+ public void invalidate() {
+ m_valid = false;
+ }
+
+ public DataDictionary(String schema) {
+ m_schema = schema.toUpperCase();
+ m_tables = new HashMap<String, TableDesc>();
+ m_views = new HashMap<String, ViewDesc>();
+ m_sequences = new HashMap<String, SequenceDesc>();
+ }
+
+ public void setSourceType(int t) {
+ m_sourceType = t;
+ }
+
+ public int getSourceType() {
+ return m_sourceType;
+ }
+
+ public String getSchema() {
+ return m_schema;
+ }
+
+ public List<TableDesc> getTables() {
+ return new ArrayList<TableDesc>(m_tables.values());
+ }
+
+ public void addTable(TableDesc td) {
+ m_tables.put(td.getName(), td);
+ }
+
+ public void removeTable(String name) {
+ m_tables.remove(name);
+ }
+
+ /**
+ * can be full table name or raw table name
+ */
+ public TableDesc getTable(String name) {
+ // remove qualification
+ if (name.startsWith(getSchema() + ".")) {
+ name = name.substring(getSchema().length() + 1);
+ }
+ TableDesc td = m_tables.get(name);
+ return td;
+ }
+
+ public List<ViewDesc> getViews() {
+ return new ArrayList<ViewDesc>(m_views.values());
+ }
+
+ public void addView(ViewDesc vd) {
+ m_views.put(vd.getName(), vd);
+ }
+
+ public ViewDesc getView(String name) {
+ return m_views.get(name);
+ }
+
+ public List<SequenceDesc> getSequences() {
+ return new ArrayList<SequenceDesc>(m_sequences.values());
+ }
+
+ public void addSequence(SequenceDesc sd) {
+ m_sequences.put(sd.getName(), sd);
+ }
+
+ public SequenceDesc getSequence(String name) {
+ return m_sequences.get(name);
+ }
+
+ public String toXml() {
+ StringBuffer buf = new StringBuffer();
+ buf.append("<datadictionary schema=\"" + m_schema + "\">\n");
+ buf.append("<tables>\n");
+ for (TableDesc td : m_tables.values()) {
+ buf.append(td.toXml() + "\n");
+ }
+ buf.append("</tables>\n");
+ buf.append("<views>\n");
+ for (ViewDesc vd : m_views.values()) {
+ buf.append(vd.toXml() + "\n");
+ }
+ buf.append("</views>\n");
+ buf.append("<sequences>\n");
+ for (SequenceDesc sd : m_sequences.values()) {
+ buf.append(sd.toXml() + "\n");
+ }
+ buf.append("</sequences>\n");
+ buf.append("</datadictionary>\n");
+ return buf.toString();
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/dict/IndexDesc.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/dict/IndexDesc.java
index dfb433343e..baabb2919f 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/dict/IndexDesc.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/dict/IndexDesc.java
@@ -1,58 +1,58 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc.dict;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-
-public class IndexDesc implements java.io.Serializable {
- private static final long serialVersionUID = 8473853730094122830L;
- private String m_indexName;
- private boolean m_uniqueness;
- private ArrayList<String> m_columnNames;
-
- // for IScoutSerializable
- private IndexDesc() {
- }
-
- public IndexDesc(String indexName, boolean uniqueness) {
- m_indexName = indexName;
- m_uniqueness = uniqueness;
- m_columnNames = new ArrayList<String>();
- }
-
- public String getName() {
- return m_indexName;
- }
-
- public boolean isUnique() {
- return m_uniqueness;
- }
-
- public ArrayList/* of String */getColumnNames() {
- return m_columnNames;
- }
-
- public void addColumnName(String s) {
- m_columnNames.add(s);
- }
-
- public String toXml() {
- StringBuffer buf = new StringBuffer();
- buf.append("<index name=\"" + m_indexName + "\" uniqueness=\"" + m_uniqueness + "\">\n");
- for (Iterator it = m_columnNames.iterator(); it.hasNext();) {
- buf.append("<columnref name=\"" + it.next() + "\"/>\n");
- }
- buf.append("</index>\n");
- return buf.toString();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc.dict;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+public class IndexDesc implements java.io.Serializable {
+ private static final long serialVersionUID = 8473853730094122830L;
+ private String m_indexName;
+ private boolean m_uniqueness;
+ private ArrayList<String> m_columnNames;
+
+ // for IScoutSerializable
+ private IndexDesc() {
+ }
+
+ public IndexDesc(String indexName, boolean uniqueness) {
+ m_indexName = indexName;
+ m_uniqueness = uniqueness;
+ m_columnNames = new ArrayList<String>();
+ }
+
+ public String getName() {
+ return m_indexName;
+ }
+
+ public boolean isUnique() {
+ return m_uniqueness;
+ }
+
+ public ArrayList/* of String */getColumnNames() {
+ return m_columnNames;
+ }
+
+ public void addColumnName(String s) {
+ m_columnNames.add(s);
+ }
+
+ public String toXml() {
+ StringBuffer buf = new StringBuffer();
+ buf.append("<index name=\"" + m_indexName + "\" uniqueness=\"" + m_uniqueness + "\">\n");
+ for (Iterator it = m_columnNames.iterator(); it.hasNext();) {
+ buf.append("<columnref name=\"" + it.next() + "\"/>\n");
+ }
+ buf.append("</index>\n");
+ return buf.toString();
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/dict/OracleCongruencyFilter.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/dict/OracleCongruencyFilter.java
index 4d7c1dd059..71b3c1b827 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/dict/OracleCongruencyFilter.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/dict/OracleCongruencyFilter.java
@@ -1,87 +1,87 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc.dict;
-
-public class OracleCongruencyFilter extends CongruencyFilter {
- protected int m_minVersion;
- protected int m_majVersion;
- protected boolean m_light;
-
- public OracleCongruencyFilter(int majVersion, int minVersion, boolean light) {
- m_majVersion = majVersion;
- m_minVersion = minVersion;
- m_light = light;
- }
-
- @Override
- public boolean allowDropTableColumn() {
- return m_majVersion >= 8;
- }
-
- @Override
- public String getCanonicalColumnType(ColumnDesc cd) {
- String type = cd.getTypeName().toUpperCase();
- // bugs in oracle are corrected first
- if (type.equals("DOUBLE")) {
- type = "DOUBLE PRECISION";
- }
- // map column type names to canonical names
- if (type.equals("DATE") || type.equals("TIME") || type.equals("TIMESTAMP")) {
- type = "DATE";
- }
- else if (type.equals("INT") || type.equals("INTEGER")) {
- type = "INT";
- }
- // do not use m_size even though oracle reports one for the following types
- if (type.equals("BIT") ||
- type.equals("BLOB") ||
- type.equals("CLOB") ||
- type.equals("DATE") ||
- type.equals("DOUBLE PRECISION") ||
- type.equals("LONG") ||
- type.equals("LONG RAW") ||
- type.equals("REAL") ||
- type.equals("ROWID") ||
- type.equals("INT") ||
- type.equals("BIGINT") ||
- type.equals("SMALLINT") ||
- type.equals("TINYINT")) {
- return type;
- }
- // for DECIMAL and NUMBER use only presicion and decimalDigits
- if (type.equals("NUMBER") ||
- type.equals("DECIMAL")) {
- long prec = (cd.getPrecision() > 0) ? cd.getPrecision() : 38;
- if (cd.getDecimalDigits() > 0) {
- return type + "(" + prec + "," + cd.getDecimalDigits() + ")";
- }
- else {
- return type + "(" + prec + ")";
- }
- }
- // generic, if size <>0 then use size, if also decimaldigits <>0 then also
- // use that parameter
- if (cd.getPrecision() > 0) {
- if (cd.getDecimalDigits() > 0) {
- return type + "(" + cd.getPrecision() + "," + cd.getDecimalDigits() + ")";
- }
- else {
- return type + "(" + cd.getPrecision() + ")";
- }
- }
- if (cd.getSize() > 0) {
- return type + "(" + cd.getSize() + ")";
- }
- // return raw type
- return type;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc.dict;
+
+public class OracleCongruencyFilter extends CongruencyFilter {
+ protected int m_minVersion;
+ protected int m_majVersion;
+ protected boolean m_light;
+
+ public OracleCongruencyFilter(int majVersion, int minVersion, boolean light) {
+ m_majVersion = majVersion;
+ m_minVersion = minVersion;
+ m_light = light;
+ }
+
+ @Override
+ public boolean allowDropTableColumn() {
+ return m_majVersion >= 8;
+ }
+
+ @Override
+ public String getCanonicalColumnType(ColumnDesc cd) {
+ String type = cd.getTypeName().toUpperCase();
+ // bugs in oracle are corrected first
+ if (type.equals("DOUBLE")) {
+ type = "DOUBLE PRECISION";
+ }
+ // map column type names to canonical names
+ if (type.equals("DATE") || type.equals("TIME") || type.equals("TIMESTAMP")) {
+ type = "DATE";
+ }
+ else if (type.equals("INT") || type.equals("INTEGER")) {
+ type = "INT";
+ }
+ // do not use m_size even though oracle reports one for the following types
+ if (type.equals("BIT") ||
+ type.equals("BLOB") ||
+ type.equals("CLOB") ||
+ type.equals("DATE") ||
+ type.equals("DOUBLE PRECISION") ||
+ type.equals("LONG") ||
+ type.equals("LONG RAW") ||
+ type.equals("REAL") ||
+ type.equals("ROWID") ||
+ type.equals("INT") ||
+ type.equals("BIGINT") ||
+ type.equals("SMALLINT") ||
+ type.equals("TINYINT")) {
+ return type;
+ }
+ // for DECIMAL and NUMBER use only presicion and decimalDigits
+ if (type.equals("NUMBER") ||
+ type.equals("DECIMAL")) {
+ long prec = (cd.getPrecision() > 0) ? cd.getPrecision() : 38;
+ if (cd.getDecimalDigits() > 0) {
+ return type + "(" + prec + "," + cd.getDecimalDigits() + ")";
+ }
+ else {
+ return type + "(" + prec + ")";
+ }
+ }
+ // generic, if size <>0 then use size, if also decimaldigits <>0 then also
+ // use that parameter
+ if (cd.getPrecision() > 0) {
+ if (cd.getDecimalDigits() > 0) {
+ return type + "(" + cd.getPrecision() + "," + cd.getDecimalDigits() + ")";
+ }
+ else {
+ return type + "(" + cd.getPrecision() + ")";
+ }
+ }
+ if (cd.getSize() > 0) {
+ return type + "(" + cd.getSize() + ")";
+ }
+ // return raw type
+ return type;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/dict/OracleDataDictionaryBuilder.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/dict/OracleDataDictionaryBuilder.java
index aea64fa3b6..ef75cff56f 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/dict/OracleDataDictionaryBuilder.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/dict/OracleDataDictionaryBuilder.java
@@ -1,227 +1,227 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc.dict;
-
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.HashMap;
-
-public class OracleDataDictionaryBuilder {
- public static final int SOURCE_TYPE_ORACLE_SERVER = 100;
- public static final int SOURCE_TYPE_ORACLE_CLIENT_LITE = 101;
- public static final int SOURCE_TYPE_ORACLE_PPC_LITE = 102;
-
- private static final String SELECT_ALL_TABLES = "select table_name from all_tables where owner=?";
-
- // MVI 26.3.2009 Special all_views statment for oracle lite. to_char needed in
- // some Korean systems
- private static final String SELECT_ALL_VIEWS_ORACLE = "select view_name,text_length,text from all_views where owner=?";
- private static final String SELECT_ALL_VIEWS_LITE = "select view_name,text_length,to_char(text) from all_views where owner=?";
-
- private static final String SELECT_ALL_SEQUENCES = "select SEQUENCE_NAME,MIN_VALUE,MAX_VALUE,INCREMENT_BY from all_sequences where sequence_owner=?";
- // for tables:
- // AMO 22.1.2007 Do not select items from Oracle10g Rel. 2 Recycle Bin
- private static final String SELECT_PRIMARY_KEY_COLUMNS = "select table_name,constraint_name,column_name from all_cons_columns where owner=? and table_name not like 'BIN$%' and constraint_name in (select constraint_name from all_constraints where owner=? and constraint_type='P') order by table_name,constraint_name,position";
- private static final String SELECT_ALL_INDEXES = "select table_name,index_name,uniqueness,index_type from all_indexes where owner=? order by table_name,index_name";
- private static final String SELECT_ALL_INDEXES_ORACLELITE = "select table_name,index_name,uniqueness,'NORMAL' from all_indexes where owner=? order by table_name,index_name";
- private static final String SELECT_ALL_INDEX_COLUMNS = "select index_name,column_name from all_ind_columns where index_owner=? order by index_name,column_position";
- private static final String SELECT_ALL_COLUMNS = "select table_name,COLUMN_NAME,DATA_TYPE,DATA_LENGTH,DATA_PRECISION,DATA_SCALE,NULLABLE,COLUMN_ID,DATA_DEFAULT from all_tab_columns where owner=? and table_name in (select table_name from all_tables where owner=?) order by table_name,column_id";
-
- /**
- * @rn imo, 19.07.2006, granting to rep user is done automatically in
- * DataDictValidator
- * @since Build 204
- */
- /*
- * //for tables and views private static final String
- * SELECT_ALL_TABLE_PRIVILEGES=
- * "select table_name,grantee,privilege,grantable from all_tab_privs where table_schema=? union select distinct table_name,grantee,privilege,grantable from all_col_privs where table_schema=? order by table_name"
- * ; private static final StringSELECT_ALL_TABLE_PRIVILEGES_ORACLELITE=
- * "select table_name,grantee,grant_type,grantable from table_privileges where owner=? union select distinct table_name,grantee,grant_type,grantable from column_privileges where owner=? order by table_name"
- * ;
- */
-
- public DataDictionary build(Connection conn, String schema, boolean lite) throws SQLException {
- schema = schema.toUpperCase();
- DataDictionary dd = new DataDictionary(schema);
- dd.setSourceType(lite ? SOURCE_TYPE_ORACLE_CLIENT_LITE : SOURCE_TYPE_ORACLE_SERVER);
- //
- PreparedStatement stm = null;
- try {
- // load tables
- stm = conn.prepareStatement(SELECT_ALL_TABLES);
- stm.setString(1, schema);
- ResultSet rs;
- rs = stm.executeQuery();
- while (rs.next()) {
- TableDesc td = new TableDesc(rs.getString(1), schema);
- dd.addTable(td);
- }
- stm.close();
- stm = null;
- // load views
- stm = conn.prepareStatement(lite ? SELECT_ALL_VIEWS_LITE : SELECT_ALL_VIEWS_ORACLE);
- stm.setString(1, schema);
- rs = stm.executeQuery();
- while (rs.next()) {
- ViewDesc vd = new ViewDesc(rs.getString(1), schema, rs.getString(3).trim());
- dd.addView(vd);
- }
- stm.close();
- stm = null;
- // load sequences
- stm = conn.prepareStatement(SELECT_ALL_SEQUENCES);
- stm.setString(1, schema);
- rs = stm.executeQuery();
- while (rs.next()) {
- SequenceDesc sd = new SequenceDesc(rs.getString(1), rs.getBigDecimal(2), rs.getBigDecimal(3), rs.getBigDecimal(4));
- dd.addSequence(sd);
- }
- stm.close();
- stm = null;
- // for tables:
- // check if there is a PK
- stm = conn.prepareStatement(SELECT_PRIMARY_KEY_COLUMNS);
- stm.setString(1, schema);
- stm.setString(2, schema);
- rs = stm.executeQuery();
- TableDesc curTableDesc = null;
- PrimaryKeyDesc curPk = null;
- while (rs.next()) {
- String tableName = rs.getString(1);
- String pkName = rs.getString(2);
- String colName = rs.getString(3);
- if (curPk == null || (!curPk.getName().equals(pkName))) {
- curTableDesc = dd.getTable(tableName);
- curPk = new PrimaryKeyDesc(pkName);
- curTableDesc.setPrimaryKey(curPk);
- }
- curPk.addColumnName(colName);
- }
- stm.close();
- stm = null;
-
- // load indexes except pk index
- HashMap<String, IndexDesc> allIndexes = new HashMap<String, IndexDesc>();
- if (lite) {
- stm = conn.prepareStatement(SELECT_ALL_INDEXES_ORACLELITE);
- }
- else {
- stm = conn.prepareStatement(SELECT_ALL_INDEXES);
- }
- stm.setString(1, schema);
- rs = stm.executeQuery();
- curTableDesc = null;
- curPk = null;
- while (rs.next()) {
- String tableName = rs.getString(1);
- String indexName = rs.getString(2);
- String unique = rs.getString(3);
- String indexType = ("" + rs.getString(4)).toUpperCase();
- if (indexType.startsWith("FUNCTION-BASED")) {
- // ignore functional indexes
- }
- else {
- if (curTableDesc == null || (!curTableDesc.getName().equals(tableName))) {
- curTableDesc = dd.getTable(tableName);
- curPk = curTableDesc.getPrimaryKey();
- }
- IndexDesc id = new IndexDesc(indexName, unique.equalsIgnoreCase("unique"));
- if (curPk != null && curPk.getName().equalsIgnoreCase(indexName)) {
- // ignore it, it's the primary key index
- }
- else {
- curTableDesc.addIndex(id);
- }
- allIndexes.put(indexName, id);
- }
- }
- stm.close();
- stm = null;
- // load index columns
- stm = conn.prepareStatement(SELECT_ALL_INDEX_COLUMNS);
- stm.setString(1, schema);
- rs = stm.executeQuery();
- IndexDesc curIndexDesc = null;
- while (rs.next()) {
- String indexName = rs.getString(1);
- String colName = rs.getString(2);
- if (curIndexDesc == null || (!curIndexDesc.getName().equals(indexName))) {
- curIndexDesc = allIndexes.get(indexName);
- }
- if (curIndexDesc != null) {
- curIndexDesc.addColumnName(colName);
- }
- }
- stm.close();
- stm = null;
- // load all columns
- stm = conn.prepareStatement(SELECT_ALL_COLUMNS);
- stm.setString(1, schema);
- stm.setString(2, schema);
- rs = stm.executeQuery();
- curTableDesc = null;
- while (rs.next()) {
- String tableName = rs.getString(1);
- if (curTableDesc == null || (!curTableDesc.getName().equals(tableName))) {
- curTableDesc = dd.getTable(tableName);
- }
- ColumnDesc cd = new ColumnDesc(
- rs.getString(2).toUpperCase(),
- rs.getString(3),
- rs.getLong(4),
- rs.getLong(5),
- rs.getLong(6),
- rs.getString(7).equalsIgnoreCase("y"),
- rs.getString(9)
- );
- curTableDesc.addColumn(cd);
- }
- stm.close();
- stm = null;
- /**
- * @rn imo, 19.07.2006, granting to rep user is done automatically in
- * DataDictValidator
- * @since Build 204
- */
- /*
- * //load table privileges try{ //first try normal oracle query
- * stm=conn.prepareStatement(SELECT_ALL_TABLE_PRIVILEGES); }
- * catch(Exception e){ //try oracle lite query
- * stm=conn.prepareStatement(SELECT_ALL_TABLE_PRIVILEGES_ORACLELITE); }
- * stm.setString(1,schema); stm.setString(2,schema);
- * rs=stm.executeQuery(); curTableDesc=null; while(rs.next()){ String
- * tableName=rs.getString(1); TableDesc td=dd.getTable(tableName);
- * if(td!=null){ TableGrantDesc gd=new
- * TableGrantDesc(rs.getString(2),rs.getString
- * (3),!"no".equalsIgnoreCase(rs.getString(4))); td.addGrant(gd); } else{
- * //a view ViewDesc vd=dd.getView(tableName); if(vd!=null){
- * TableGrantDesc gd=new
- * TableGrantDesc(rs.getString(2),rs.getString(3),!"no"
- * .equalsIgnoreCase(rs.getString(4))); vd.addGrant(gd); } } }
- * stm.close(); stm=null;
- */
- }
- finally {
- if (stm != null) {
- try {
- stm.close();
- }
- catch (Exception fatal) {
- }
- }
- }
- return dd;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc.dict;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.HashMap;
+
+public class OracleDataDictionaryBuilder {
+ public static final int SOURCE_TYPE_ORACLE_SERVER = 100;
+ public static final int SOURCE_TYPE_ORACLE_CLIENT_LITE = 101;
+ public static final int SOURCE_TYPE_ORACLE_PPC_LITE = 102;
+
+ private static final String SELECT_ALL_TABLES = "select table_name from all_tables where owner=?";
+
+ // MVI 26.3.2009 Special all_views statment for oracle lite. to_char needed in
+ // some Korean systems
+ private static final String SELECT_ALL_VIEWS_ORACLE = "select view_name,text_length,text from all_views where owner=?";
+ private static final String SELECT_ALL_VIEWS_LITE = "select view_name,text_length,to_char(text) from all_views where owner=?";
+
+ private static final String SELECT_ALL_SEQUENCES = "select SEQUENCE_NAME,MIN_VALUE,MAX_VALUE,INCREMENT_BY from all_sequences where sequence_owner=?";
+ // for tables:
+ // AMO 22.1.2007 Do not select items from Oracle10g Rel. 2 Recycle Bin
+ private static final String SELECT_PRIMARY_KEY_COLUMNS = "select table_name,constraint_name,column_name from all_cons_columns where owner=? and table_name not like 'BIN$%' and constraint_name in (select constraint_name from all_constraints where owner=? and constraint_type='P') order by table_name,constraint_name,position";
+ private static final String SELECT_ALL_INDEXES = "select table_name,index_name,uniqueness,index_type from all_indexes where owner=? order by table_name,index_name";
+ private static final String SELECT_ALL_INDEXES_ORACLELITE = "select table_name,index_name,uniqueness,'NORMAL' from all_indexes where owner=? order by table_name,index_name";
+ private static final String SELECT_ALL_INDEX_COLUMNS = "select index_name,column_name from all_ind_columns where index_owner=? order by index_name,column_position";
+ private static final String SELECT_ALL_COLUMNS = "select table_name,COLUMN_NAME,DATA_TYPE,DATA_LENGTH,DATA_PRECISION,DATA_SCALE,NULLABLE,COLUMN_ID,DATA_DEFAULT from all_tab_columns where owner=? and table_name in (select table_name from all_tables where owner=?) order by table_name,column_id";
+
+ /**
+ * @rn imo, 19.07.2006, granting to rep user is done automatically in
+ * DataDictValidator
+ * @since Build 204
+ */
+ /*
+ * //for tables and views private static final String
+ * SELECT_ALL_TABLE_PRIVILEGES=
+ * "select table_name,grantee,privilege,grantable from all_tab_privs where table_schema=? union select distinct table_name,grantee,privilege,grantable from all_col_privs where table_schema=? order by table_name"
+ * ; private static final StringSELECT_ALL_TABLE_PRIVILEGES_ORACLELITE=
+ * "select table_name,grantee,grant_type,grantable from table_privileges where owner=? union select distinct table_name,grantee,grant_type,grantable from column_privileges where owner=? order by table_name"
+ * ;
+ */
+
+ public DataDictionary build(Connection conn, String schema, boolean lite) throws SQLException {
+ schema = schema.toUpperCase();
+ DataDictionary dd = new DataDictionary(schema);
+ dd.setSourceType(lite ? SOURCE_TYPE_ORACLE_CLIENT_LITE : SOURCE_TYPE_ORACLE_SERVER);
+ //
+ PreparedStatement stm = null;
+ try {
+ // load tables
+ stm = conn.prepareStatement(SELECT_ALL_TABLES);
+ stm.setString(1, schema);
+ ResultSet rs;
+ rs = stm.executeQuery();
+ while (rs.next()) {
+ TableDesc td = new TableDesc(rs.getString(1), schema);
+ dd.addTable(td);
+ }
+ stm.close();
+ stm = null;
+ // load views
+ stm = conn.prepareStatement(lite ? SELECT_ALL_VIEWS_LITE : SELECT_ALL_VIEWS_ORACLE);
+ stm.setString(1, schema);
+ rs = stm.executeQuery();
+ while (rs.next()) {
+ ViewDesc vd = new ViewDesc(rs.getString(1), schema, rs.getString(3).trim());
+ dd.addView(vd);
+ }
+ stm.close();
+ stm = null;
+ // load sequences
+ stm = conn.prepareStatement(SELECT_ALL_SEQUENCES);
+ stm.setString(1, schema);
+ rs = stm.executeQuery();
+ while (rs.next()) {
+ SequenceDesc sd = new SequenceDesc(rs.getString(1), rs.getBigDecimal(2), rs.getBigDecimal(3), rs.getBigDecimal(4));
+ dd.addSequence(sd);
+ }
+ stm.close();
+ stm = null;
+ // for tables:
+ // check if there is a PK
+ stm = conn.prepareStatement(SELECT_PRIMARY_KEY_COLUMNS);
+ stm.setString(1, schema);
+ stm.setString(2, schema);
+ rs = stm.executeQuery();
+ TableDesc curTableDesc = null;
+ PrimaryKeyDesc curPk = null;
+ while (rs.next()) {
+ String tableName = rs.getString(1);
+ String pkName = rs.getString(2);
+ String colName = rs.getString(3);
+ if (curPk == null || (!curPk.getName().equals(pkName))) {
+ curTableDesc = dd.getTable(tableName);
+ curPk = new PrimaryKeyDesc(pkName);
+ curTableDesc.setPrimaryKey(curPk);
+ }
+ curPk.addColumnName(colName);
+ }
+ stm.close();
+ stm = null;
+
+ // load indexes except pk index
+ HashMap<String, IndexDesc> allIndexes = new HashMap<String, IndexDesc>();
+ if (lite) {
+ stm = conn.prepareStatement(SELECT_ALL_INDEXES_ORACLELITE);
+ }
+ else {
+ stm = conn.prepareStatement(SELECT_ALL_INDEXES);
+ }
+ stm.setString(1, schema);
+ rs = stm.executeQuery();
+ curTableDesc = null;
+ curPk = null;
+ while (rs.next()) {
+ String tableName = rs.getString(1);
+ String indexName = rs.getString(2);
+ String unique = rs.getString(3);
+ String indexType = ("" + rs.getString(4)).toUpperCase();
+ if (indexType.startsWith("FUNCTION-BASED")) {
+ // ignore functional indexes
+ }
+ else {
+ if (curTableDesc == null || (!curTableDesc.getName().equals(tableName))) {
+ curTableDesc = dd.getTable(tableName);
+ curPk = curTableDesc.getPrimaryKey();
+ }
+ IndexDesc id = new IndexDesc(indexName, unique.equalsIgnoreCase("unique"));
+ if (curPk != null && curPk.getName().equalsIgnoreCase(indexName)) {
+ // ignore it, it's the primary key index
+ }
+ else {
+ curTableDesc.addIndex(id);
+ }
+ allIndexes.put(indexName, id);
+ }
+ }
+ stm.close();
+ stm = null;
+ // load index columns
+ stm = conn.prepareStatement(SELECT_ALL_INDEX_COLUMNS);
+ stm.setString(1, schema);
+ rs = stm.executeQuery();
+ IndexDesc curIndexDesc = null;
+ while (rs.next()) {
+ String indexName = rs.getString(1);
+ String colName = rs.getString(2);
+ if (curIndexDesc == null || (!curIndexDesc.getName().equals(indexName))) {
+ curIndexDesc = allIndexes.get(indexName);
+ }
+ if (curIndexDesc != null) {
+ curIndexDesc.addColumnName(colName);
+ }
+ }
+ stm.close();
+ stm = null;
+ // load all columns
+ stm = conn.prepareStatement(SELECT_ALL_COLUMNS);
+ stm.setString(1, schema);
+ stm.setString(2, schema);
+ rs = stm.executeQuery();
+ curTableDesc = null;
+ while (rs.next()) {
+ String tableName = rs.getString(1);
+ if (curTableDesc == null || (!curTableDesc.getName().equals(tableName))) {
+ curTableDesc = dd.getTable(tableName);
+ }
+ ColumnDesc cd = new ColumnDesc(
+ rs.getString(2).toUpperCase(),
+ rs.getString(3),
+ rs.getLong(4),
+ rs.getLong(5),
+ rs.getLong(6),
+ rs.getString(7).equalsIgnoreCase("y"),
+ rs.getString(9)
+ );
+ curTableDesc.addColumn(cd);
+ }
+ stm.close();
+ stm = null;
+ /**
+ * @rn imo, 19.07.2006, granting to rep user is done automatically in
+ * DataDictValidator
+ * @since Build 204
+ */
+ /*
+ * //load table privileges try{ //first try normal oracle query
+ * stm=conn.prepareStatement(SELECT_ALL_TABLE_PRIVILEGES); }
+ * catch(Exception e){ //try oracle lite query
+ * stm=conn.prepareStatement(SELECT_ALL_TABLE_PRIVILEGES_ORACLELITE); }
+ * stm.setString(1,schema); stm.setString(2,schema);
+ * rs=stm.executeQuery(); curTableDesc=null; while(rs.next()){ String
+ * tableName=rs.getString(1); TableDesc td=dd.getTable(tableName);
+ * if(td!=null){ TableGrantDesc gd=new
+ * TableGrantDesc(rs.getString(2),rs.getString
+ * (3),!"no".equalsIgnoreCase(rs.getString(4))); td.addGrant(gd); } else{
+ * //a view ViewDesc vd=dd.getView(tableName); if(vd!=null){
+ * TableGrantDesc gd=new
+ * TableGrantDesc(rs.getString(2),rs.getString(3),!"no"
+ * .equalsIgnoreCase(rs.getString(4))); vd.addGrant(gd); } } }
+ * stm.close(); stm=null;
+ */
+ }
+ finally {
+ if (stm != null) {
+ try {
+ stm.close();
+ }
+ catch (Exception fatal) {
+ }
+ }
+ }
+ return dd;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/dict/PrimaryKeyDesc.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/dict/PrimaryKeyDesc.java
index ecb949234a..3ebf0bf4dd 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/dict/PrimaryKeyDesc.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/dict/PrimaryKeyDesc.java
@@ -1,51 +1,51 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc.dict;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-
-public class PrimaryKeyDesc implements java.io.Serializable {
- private static final long serialVersionUID = 9164041758420662753L;
- private String m_name;
- private ArrayList<String> m_columnNames;
-
- // for IScoutSerializable
- private PrimaryKeyDesc() {
- }
-
- public PrimaryKeyDesc(String name) {
- m_name = name;
- m_columnNames = new ArrayList<String>();
- }
-
- public String getName() {
- return m_name;
- }
-
- public void addColumnName(String col) {
- m_columnNames.add(col);
- }
-
- public ArrayList/* of String */getColumnNames() {
- return m_columnNames;
- }
-
- public String toXml() {
- StringBuffer buf = new StringBuffer();
- buf.append("<primarykey name=\"" + m_name + "\">\n");
- for (Iterator it = m_columnNames.iterator(); it.hasNext();) {
- buf.append("<columnref name=\"" + it.next() + "\"/>\n");
- }
- buf.append("</primarykey>\n");
- return buf.toString();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc.dict;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+public class PrimaryKeyDesc implements java.io.Serializable {
+ private static final long serialVersionUID = 9164041758420662753L;
+ private String m_name;
+ private ArrayList<String> m_columnNames;
+
+ // for IScoutSerializable
+ private PrimaryKeyDesc() {
+ }
+
+ public PrimaryKeyDesc(String name) {
+ m_name = name;
+ m_columnNames = new ArrayList<String>();
+ }
+
+ public String getName() {
+ return m_name;
+ }
+
+ public void addColumnName(String col) {
+ m_columnNames.add(col);
+ }
+
+ public ArrayList/* of String */getColumnNames() {
+ return m_columnNames;
+ }
+
+ public String toXml() {
+ StringBuffer buf = new StringBuffer();
+ buf.append("<primarykey name=\"" + m_name + "\">\n");
+ for (Iterator it = m_columnNames.iterator(); it.hasNext();) {
+ buf.append("<columnref name=\"" + it.next() + "\"/>\n");
+ }
+ buf.append("</primarykey>\n");
+ return buf.toString();
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/dict/SequenceDesc.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/dict/SequenceDesc.java
index 48f10e39a8..5a61ee935e 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/dict/SequenceDesc.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/dict/SequenceDesc.java
@@ -1,80 +1,80 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc.dict;
-
-import java.math.BigDecimal;
-
-public class SequenceDesc implements java.io.Serializable {
- private static final long serialVersionUID = -4529107990427422020L;
- private String m_name;
- private long m_min;
- private long m_max;
- private long m_increment;
-
- // for IScoutSerializable
- private SequenceDesc() {
- }
-
- public SequenceDesc(String name, BigDecimal min, BigDecimal max, BigDecimal increment) {
- m_name = name;
- m_min = checkLongRange(min);
- m_max = checkLongRange(max);
- m_increment = checkLongRange(increment);
- }
-
- public SequenceDesc(String name, long min, long max, long increment) {
- m_name = name;
- m_min = min;
- m_max = max;
- m_increment = increment;
- }
-
- public String getName() {
- return m_name;
- }
-
- public long getMin() {
- return m_min;
- }
-
- public long getMax() {
- return m_max;
- }
-
- public long getIncrement() {
- return m_increment;
- }
-
- public String toXml() {
- StringBuffer buf = new StringBuffer();
- buf.append("<sequence");
- buf.append(" name=\"" + m_name + "\"");
- if (m_min != 0) {
- buf.append(" min=\"" + m_min + "\"");
- }
- if (m_max != 0) {
- buf.append(" max=\"" + m_max + "\"");
- }
- if (m_increment != 0) {
- buf.append(" increment=\"" + m_increment + "\"");
- }
- buf.append("/>\n");
- return buf.toString();
- }
-
- private long checkLongRange(BigDecimal d) {
- if (d != null && d.compareTo(BigDecimal.valueOf(0)) >= 0 && d.compareTo(BigDecimal.valueOf(Long.MAX_VALUE)) <= 0) {
- return d.longValue();
- }
- return 0;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc.dict;
+
+import java.math.BigDecimal;
+
+public class SequenceDesc implements java.io.Serializable {
+ private static final long serialVersionUID = -4529107990427422020L;
+ private String m_name;
+ private long m_min;
+ private long m_max;
+ private long m_increment;
+
+ // for IScoutSerializable
+ private SequenceDesc() {
+ }
+
+ public SequenceDesc(String name, BigDecimal min, BigDecimal max, BigDecimal increment) {
+ m_name = name;
+ m_min = checkLongRange(min);
+ m_max = checkLongRange(max);
+ m_increment = checkLongRange(increment);
+ }
+
+ public SequenceDesc(String name, long min, long max, long increment) {
+ m_name = name;
+ m_min = min;
+ m_max = max;
+ m_increment = increment;
+ }
+
+ public String getName() {
+ return m_name;
+ }
+
+ public long getMin() {
+ return m_min;
+ }
+
+ public long getMax() {
+ return m_max;
+ }
+
+ public long getIncrement() {
+ return m_increment;
+ }
+
+ public String toXml() {
+ StringBuffer buf = new StringBuffer();
+ buf.append("<sequence");
+ buf.append(" name=\"" + m_name + "\"");
+ if (m_min != 0) {
+ buf.append(" min=\"" + m_min + "\"");
+ }
+ if (m_max != 0) {
+ buf.append(" max=\"" + m_max + "\"");
+ }
+ if (m_increment != 0) {
+ buf.append(" increment=\"" + m_increment + "\"");
+ }
+ buf.append("/>\n");
+ return buf.toString();
+ }
+
+ private long checkLongRange(BigDecimal d) {
+ if (d != null && d.compareTo(BigDecimal.valueOf(0)) >= 0 && d.compareTo(BigDecimal.valueOf(Long.MAX_VALUE)) <= 0) {
+ return d.longValue();
+ }
+ return 0;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/dict/TableDesc.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/dict/TableDesc.java
index 5d15cc4c43..2bcd483067 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/dict/TableDesc.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/dict/TableDesc.java
@@ -1,151 +1,151 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc.dict;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.zip.CRC32;
-
-public class TableDesc implements java.io.Serializable {
- private static final long serialVersionUID = -8904163472086670246L;
- private String m_name, m_owner;
- private String m_internalShortName;
- private HashMap<String, ColumnDesc> m_columns;
- private Collection<TableGrantDesc> m_grants;
- private Collection<IndexDesc> m_indices;
- private PrimaryKeyDesc m_pk;
-
- // for IScoutSerializable
- private TableDesc() {
- }
-
- public TableDesc(String name, String owner) {
- m_name = name;
- m_owner = owner;
- m_columns = new HashMap<String, ColumnDesc>();
- m_indices = new HashSet<IndexDesc>();
- m_grants = new HashSet<TableGrantDesc>();
- rebuildInternalShortName();
- }
-
- public String getName() {
- return m_name;
- }
-
- public String getOwner() {
- return m_owner;
- }
-
- public String getFullName() {
- return m_owner + "." + m_name;
- }
-
- /**
- * Short name, shorted and (if necessary) hashed to 25 characters (name limit
- * 30 chars - 5 = 25)
- */
- public String getInternalShortName() {
- return m_internalShortName;
- }
-
- public List<ColumnDesc> getColumns() {
- return new ArrayList<ColumnDesc>(m_columns.values());
- }
-
- public ColumnDesc getColumn(String name) {
- return m_columns.get(name);
- }
-
- public void addColumn(ColumnDesc cd) {
- m_columns.put(cd.getName(), cd);
- }
-
- public Collection<IndexDesc> getIndices() {
- return m_indices;
- }
-
- public void addIndex(IndexDesc id) {
- m_indices.add(id);
- }
-
- public Collection<TableGrantDesc> getGrants() {
- return m_grants;
- }
-
- public void addGrant(TableGrantDesc gd) {
- m_grants.add(gd);
- }
-
- public PrimaryKeyDesc getPrimaryKey() {
- return m_pk;
- }
-
- public void setPrimaryKey(PrimaryKeyDesc pk) {
- m_pk = pk;
- }
-
- public String toXml() {
- StringBuffer buf = new StringBuffer();
- buf.append("<table name=\"" + getName() + "\">\n");
- buf.append("<columns>\n");
- for (Iterator it = m_columns.values().iterator(); it.hasNext();) {
- ColumnDesc cd = (ColumnDesc) it.next();
- buf.append(cd.toXml());
- }
- buf.append("</columns>\n");
- if (m_pk != null) {
- buf.append(m_pk.toXml());
- }
- buf.append("<indexes>\n");
- for (Iterator it = m_indices.iterator(); it.hasNext();) {
- IndexDesc id = (IndexDesc) it.next();
- buf.append(id.toXml());
- }
- buf.append("</indexes>\n");
- buf.append("<grants>\n");
- for (Iterator it = m_grants.iterator(); it.hasNext();) {
- TableGrantDesc gd = (TableGrantDesc) it.next();
- buf.append(gd.toXml());
- }
- buf.append("</grants>\n");
- buf.append("</table>\n");
- return buf.toString();
- }
-
- private void rebuildInternalShortName() {
- m_internalShortName = createInternalShortName(m_name);
- }
-
- public static String createInternalShortName(String name) {
- String s = name;
- if (s.length() > 25) {
- CRC32 crc = new CRC32();
- crc.update(s.getBytes());
- // too long, shorten to 25-4 characters (21 name and 4 hashcode)
- s = s.substring(0, 21) + Integer.toHexString((int) (crc.getValue() & 0xffff));
- }
- return s;
- }
-
- public static String removeOwner(String fullName) {
- String s = fullName;
- int i = s.indexOf('.');
- if (i >= 0) {
- s = s.substring(i + 1);
- }
- return s;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc.dict;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.zip.CRC32;
+
+public class TableDesc implements java.io.Serializable {
+ private static final long serialVersionUID = -8904163472086670246L;
+ private String m_name, m_owner;
+ private String m_internalShortName;
+ private HashMap<String, ColumnDesc> m_columns;
+ private Collection<TableGrantDesc> m_grants;
+ private Collection<IndexDesc> m_indices;
+ private PrimaryKeyDesc m_pk;
+
+ // for IScoutSerializable
+ private TableDesc() {
+ }
+
+ public TableDesc(String name, String owner) {
+ m_name = name;
+ m_owner = owner;
+ m_columns = new HashMap<String, ColumnDesc>();
+ m_indices = new HashSet<IndexDesc>();
+ m_grants = new HashSet<TableGrantDesc>();
+ rebuildInternalShortName();
+ }
+
+ public String getName() {
+ return m_name;
+ }
+
+ public String getOwner() {
+ return m_owner;
+ }
+
+ public String getFullName() {
+ return m_owner + "." + m_name;
+ }
+
+ /**
+ * Short name, shorted and (if necessary) hashed to 25 characters (name limit
+ * 30 chars - 5 = 25)
+ */
+ public String getInternalShortName() {
+ return m_internalShortName;
+ }
+
+ public List<ColumnDesc> getColumns() {
+ return new ArrayList<ColumnDesc>(m_columns.values());
+ }
+
+ public ColumnDesc getColumn(String name) {
+ return m_columns.get(name);
+ }
+
+ public void addColumn(ColumnDesc cd) {
+ m_columns.put(cd.getName(), cd);
+ }
+
+ public Collection<IndexDesc> getIndices() {
+ return m_indices;
+ }
+
+ public void addIndex(IndexDesc id) {
+ m_indices.add(id);
+ }
+
+ public Collection<TableGrantDesc> getGrants() {
+ return m_grants;
+ }
+
+ public void addGrant(TableGrantDesc gd) {
+ m_grants.add(gd);
+ }
+
+ public PrimaryKeyDesc getPrimaryKey() {
+ return m_pk;
+ }
+
+ public void setPrimaryKey(PrimaryKeyDesc pk) {
+ m_pk = pk;
+ }
+
+ public String toXml() {
+ StringBuffer buf = new StringBuffer();
+ buf.append("<table name=\"" + getName() + "\">\n");
+ buf.append("<columns>\n");
+ for (Iterator it = m_columns.values().iterator(); it.hasNext();) {
+ ColumnDesc cd = (ColumnDesc) it.next();
+ buf.append(cd.toXml());
+ }
+ buf.append("</columns>\n");
+ if (m_pk != null) {
+ buf.append(m_pk.toXml());
+ }
+ buf.append("<indexes>\n");
+ for (Iterator it = m_indices.iterator(); it.hasNext();) {
+ IndexDesc id = (IndexDesc) it.next();
+ buf.append(id.toXml());
+ }
+ buf.append("</indexes>\n");
+ buf.append("<grants>\n");
+ for (Iterator it = m_grants.iterator(); it.hasNext();) {
+ TableGrantDesc gd = (TableGrantDesc) it.next();
+ buf.append(gd.toXml());
+ }
+ buf.append("</grants>\n");
+ buf.append("</table>\n");
+ return buf.toString();
+ }
+
+ private void rebuildInternalShortName() {
+ m_internalShortName = createInternalShortName(m_name);
+ }
+
+ public static String createInternalShortName(String name) {
+ String s = name;
+ if (s.length() > 25) {
+ CRC32 crc = new CRC32();
+ crc.update(s.getBytes());
+ // too long, shorten to 25-4 characters (21 name and 4 hashcode)
+ s = s.substring(0, 21) + Integer.toHexString((int) (crc.getValue() & 0xffff));
+ }
+ return s;
+ }
+
+ public static String removeOwner(String fullName) {
+ String s = fullName;
+ int i = s.indexOf('.');
+ if (i >= 0) {
+ s = s.substring(i + 1);
+ }
+ return s;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/dict/TableGrantDesc.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/dict/TableGrantDesc.java
index fef9a4c19d..ec9e4b4c29 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/dict/TableGrantDesc.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/dict/TableGrantDesc.java
@@ -1,51 +1,51 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc.dict;
-
-public class TableGrantDesc implements java.io.Serializable {
- private static final long serialVersionUID = -4877847488885163712L;
- private String m_grantee;
- private String m_type;
- private boolean m_grantOption;
-
- // for IScoutSerializable
- private TableGrantDesc() {
- }
-
- public TableGrantDesc(String grantee, String type, boolean grantOption) {
- m_grantee = grantee;
- m_type = type;
- m_grantOption = grantOption;
- }
-
- public String getGrantee() {
- return m_grantee;
- }
-
- public String getType() {
- return m_type;
- }
-
- public boolean withGrantOption() {
- return m_grantOption;
- }
-
- public String toXml() {
- StringBuffer buf = new StringBuffer();
- buf.append("<tablegrant");
- buf.append(" grantee=\"" + m_grantee + "\"");
- buf.append(" type=\"" + m_type + "\"");
- buf.append(" grantoption=\"" + (m_grantOption ? "yes" : "no") + "\"");
- buf.append("/>\n");
- return buf.toString();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc.dict;
+
+public class TableGrantDesc implements java.io.Serializable {
+ private static final long serialVersionUID = -4877847488885163712L;
+ private String m_grantee;
+ private String m_type;
+ private boolean m_grantOption;
+
+ // for IScoutSerializable
+ private TableGrantDesc() {
+ }
+
+ public TableGrantDesc(String grantee, String type, boolean grantOption) {
+ m_grantee = grantee;
+ m_type = type;
+ m_grantOption = grantOption;
+ }
+
+ public String getGrantee() {
+ return m_grantee;
+ }
+
+ public String getType() {
+ return m_type;
+ }
+
+ public boolean withGrantOption() {
+ return m_grantOption;
+ }
+
+ public String toXml() {
+ StringBuffer buf = new StringBuffer();
+ buf.append("<tablegrant");
+ buf.append(" grantee=\"" + m_grantee + "\"");
+ buf.append(" type=\"" + m_type + "\"");
+ buf.append(" grantoption=\"" + (m_grantOption ? "yes" : "no") + "\"");
+ buf.append("/>\n");
+ return buf.toString();
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/dict/ViewDesc.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/dict/ViewDesc.java
index 369b2a36bc..d32586d2b0 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/dict/ViewDesc.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/dict/ViewDesc.java
@@ -1,73 +1,73 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc.dict;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Iterator;
-
-public class ViewDesc implements java.io.Serializable {
- private static final long serialVersionUID = 5293982375734275306L;
- private String m_name, m_owner;
- private String m_statement;
- private Collection<TableGrantDesc> m_grants;
-
- // for IScoutSerializable
- private ViewDesc() {
- }
-
- public ViewDesc(String name, String owner, String statement) {
- m_name = name;
- m_owner = owner;
- m_statement = statement;
- m_grants = new HashSet<TableGrantDesc>();
- }
-
- public String getName() {
- return m_name;
- }
-
- public String getOwner() {
- return m_owner;
- }
-
- public Collection<TableGrantDesc> getGrants() {
- return m_grants;
- }
-
- public void addGrant(TableGrantDesc gd) {
- m_grants.add(gd);
- }
-
- public String getFullName() {
- return m_owner + "." + m_name;
- }
-
- public String getStatement() {
- return m_statement;
- }
-
- public String toXml() {
- StringBuffer buf = new StringBuffer();
- buf.append("<view name=\"" + getName() + "\">\n");
- buf.append("<statement>\n");
- buf.append(m_statement);
- buf.append("</statement>\n");
- buf.append("<grants>\n");
- for (Iterator it = m_grants.iterator(); it.hasNext();) {
- TableGrantDesc gd = (TableGrantDesc) it.next();
- buf.append(gd.toXml());
- }
- buf.append("</grants>\n");
- buf.append("</view>\n");
- return buf.toString();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc.dict;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+
+public class ViewDesc implements java.io.Serializable {
+ private static final long serialVersionUID = 5293982375734275306L;
+ private String m_name, m_owner;
+ private String m_statement;
+ private Collection<TableGrantDesc> m_grants;
+
+ // for IScoutSerializable
+ private ViewDesc() {
+ }
+
+ public ViewDesc(String name, String owner, String statement) {
+ m_name = name;
+ m_owner = owner;
+ m_statement = statement;
+ m_grants = new HashSet<TableGrantDesc>();
+ }
+
+ public String getName() {
+ return m_name;
+ }
+
+ public String getOwner() {
+ return m_owner;
+ }
+
+ public Collection<TableGrantDesc> getGrants() {
+ return m_grants;
+ }
+
+ public void addGrant(TableGrantDesc gd) {
+ m_grants.add(gd);
+ }
+
+ public String getFullName() {
+ return m_owner + "." + m_name;
+ }
+
+ public String getStatement() {
+ return m_statement;
+ }
+
+ public String toXml() {
+ StringBuffer buf = new StringBuffer();
+ buf.append("<view name=\"" + getName() + "\">\n");
+ buf.append("<statement>\n");
+ buf.append(m_statement);
+ buf.append("</statement>\n");
+ buf.append("<grants>\n");
+ for (Iterator it = m_grants.iterator(); it.hasNext();) {
+ TableGrantDesc gd = (TableGrantDesc) it.next();
+ buf.append(gd.toXml());
+ }
+ buf.append("</grants>\n");
+ buf.append("</view>\n");
+ return buf.toString();
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/AbstractBeanPropertyOutput.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/AbstractBeanPropertyOutput.java
index eca795f1d1..62e4db9ac0 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/AbstractBeanPropertyOutput.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/AbstractBeanPropertyOutput.java
@@ -1,148 +1,148 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc.internal.exec;
-
-import java.util.ArrayList;
-
-import org.eclipse.scout.commons.BeanUtility;
-import org.eclipse.scout.commons.TypeCastUtility;
-import org.eclipse.scout.commons.beans.FastPropertyDescriptor;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.holders.IHolder;
-import org.eclipse.scout.commons.parsers.token.IToken;
-import org.eclipse.scout.commons.parsers.token.ValueOutputToken;
-import org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle;
-
-abstract class AbstractBeanPropertyOutput implements IBindOutput {
- private String m_propertyName;
- private Class m_propertyType;
- private ValueOutputToken m_source;
- private int m_batchIndex = -1;
- private int m_jdbcBindIndex = -1;
- private ArrayList<Object> m_accumulator;
-
- public AbstractBeanPropertyOutput(Class beanType, String propertyName, ValueOutputToken source) throws ProcessingException {
- m_propertyName = propertyName;
- m_accumulator = new ArrayList<Object>();
- m_source = source;
- //
- try {
- FastPropertyDescriptor desc = BeanUtility.getFastBeanInfo(beanType, null).getPropertyDescriptor(m_propertyName);
- m_propertyType = desc.getPropertyType();
- }
- catch (Exception e) {
- throw new ProcessingException("property " + m_propertyName, e);
- }
- }
-
- @Override
- public IToken getToken() {
- return m_source;
- }
-
- @Override
- public boolean isJdbcBind() {
- return !m_source.isSelectInto();
- }
-
- @Override
- public int getJdbcBindIndex() {
- return m_jdbcBindIndex;
- }
-
- @Override
- public void setJdbcBindIndex(int index) {
- m_jdbcBindIndex = index;
- }
-
- @Override
- public boolean isBatch() {
- return m_source.isBatch();
- }
-
- @Override
- public boolean isSelectInto() {
- return m_source.isSelectInto();
- }
-
- @Override
- public Class getBindType() {
- return m_propertyType;
- }
-
- public int getBatchIndex() {
- return m_batchIndex;
- }
-
- @Override
- public void setNextBatchIndex(int i) {
- m_batchIndex = i;
- }
-
- /**
- * called from {@link #finishBatch()}
- */
- protected abstract Object[] getFinalBeanArray();
-
- @Override
- public void finishBatch() throws ProcessingException {
- FastPropertyDescriptor desc = null;
- Object[] beans = getFinalBeanArray();
- if (beans != null) {
- int accSize = m_accumulator.size();
- for (int i = 0; i < beans.length; i++) {
- try {
- Object bean = beans[i];
- if (bean != null) {
- if (desc == null) {
- desc = BeanUtility.getFastBeanInfo(bean.getClass(), null).getPropertyDescriptor(m_propertyName);
- }
- Object value = null;
- if (i < accSize) {
- value = m_accumulator.get(i);
- }
- if (IHolder.class.isAssignableFrom(desc.getPropertyType())) {
- @SuppressWarnings("unchecked")
- IHolder<Object> h = (IHolder<Object>) desc.getReadMethod().invoke(bean);
- if (h != null) {
- Object castValue = TypeCastUtility.castValue(value, h.getHolderType());
- h.setValue(castValue);
- }
- }
- else {
- Object castValue = TypeCastUtility.castValue(value, desc.getPropertyType());
- desc.getWriteMethod().invoke(bean, castValue);
- }
- }
- }
- catch (Exception e) {
- throw new ProcessingException("property " + m_propertyName, e);
- }
- }
- }
- }
-
- @Override
- public void setReplaceToken(ISqlStyle style) {
- m_source.setReplaceToken("?");
- }
-
- @Override
- public void consumeValue(Object value) {
- m_accumulator.add(value);
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName() + "[bindType=" + getBindType() + ", name=" + m_propertyName + ", source=" + m_source + "]";
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc.internal.exec;
+
+import java.util.ArrayList;
+
+import org.eclipse.scout.commons.BeanUtility;
+import org.eclipse.scout.commons.TypeCastUtility;
+import org.eclipse.scout.commons.beans.FastPropertyDescriptor;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.holders.IHolder;
+import org.eclipse.scout.commons.parsers.token.IToken;
+import org.eclipse.scout.commons.parsers.token.ValueOutputToken;
+import org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle;
+
+abstract class AbstractBeanPropertyOutput implements IBindOutput {
+ private String m_propertyName;
+ private Class m_propertyType;
+ private ValueOutputToken m_source;
+ private int m_batchIndex = -1;
+ private int m_jdbcBindIndex = -1;
+ private ArrayList<Object> m_accumulator;
+
+ public AbstractBeanPropertyOutput(Class beanType, String propertyName, ValueOutputToken source) throws ProcessingException {
+ m_propertyName = propertyName;
+ m_accumulator = new ArrayList<Object>();
+ m_source = source;
+ //
+ try {
+ FastPropertyDescriptor desc = BeanUtility.getFastBeanInfo(beanType, null).getPropertyDescriptor(m_propertyName);
+ m_propertyType = desc.getPropertyType();
+ }
+ catch (Exception e) {
+ throw new ProcessingException("property " + m_propertyName, e);
+ }
+ }
+
+ @Override
+ public IToken getToken() {
+ return m_source;
+ }
+
+ @Override
+ public boolean isJdbcBind() {
+ return !m_source.isSelectInto();
+ }
+
+ @Override
+ public int getJdbcBindIndex() {
+ return m_jdbcBindIndex;
+ }
+
+ @Override
+ public void setJdbcBindIndex(int index) {
+ m_jdbcBindIndex = index;
+ }
+
+ @Override
+ public boolean isBatch() {
+ return m_source.isBatch();
+ }
+
+ @Override
+ public boolean isSelectInto() {
+ return m_source.isSelectInto();
+ }
+
+ @Override
+ public Class getBindType() {
+ return m_propertyType;
+ }
+
+ public int getBatchIndex() {
+ return m_batchIndex;
+ }
+
+ @Override
+ public void setNextBatchIndex(int i) {
+ m_batchIndex = i;
+ }
+
+ /**
+ * called from {@link #finishBatch()}
+ */
+ protected abstract Object[] getFinalBeanArray();
+
+ @Override
+ public void finishBatch() throws ProcessingException {
+ FastPropertyDescriptor desc = null;
+ Object[] beans = getFinalBeanArray();
+ if (beans != null) {
+ int accSize = m_accumulator.size();
+ for (int i = 0; i < beans.length; i++) {
+ try {
+ Object bean = beans[i];
+ if (bean != null) {
+ if (desc == null) {
+ desc = BeanUtility.getFastBeanInfo(bean.getClass(), null).getPropertyDescriptor(m_propertyName);
+ }
+ Object value = null;
+ if (i < accSize) {
+ value = m_accumulator.get(i);
+ }
+ if (IHolder.class.isAssignableFrom(desc.getPropertyType())) {
+ @SuppressWarnings("unchecked")
+ IHolder<Object> h = (IHolder<Object>) desc.getReadMethod().invoke(bean);
+ if (h != null) {
+ Object castValue = TypeCastUtility.castValue(value, h.getHolderType());
+ h.setValue(castValue);
+ }
+ }
+ else {
+ Object castValue = TypeCastUtility.castValue(value, desc.getPropertyType());
+ desc.getWriteMethod().invoke(bean, castValue);
+ }
+ }
+ }
+ catch (Exception e) {
+ throw new ProcessingException("property " + m_propertyName, e);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void setReplaceToken(ISqlStyle style) {
+ m_source.setReplaceToken("?");
+ }
+
+ @Override
+ public void consumeValue(Object value) {
+ m_accumulator.add(value);
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + "[bindType=" + getBindType() + ", name=" + m_propertyName + ", source=" + m_source + "]";
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/ArrayHolderOutput.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/ArrayHolderOutput.java
index d8615d126b..934c82dc8f 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/ArrayHolderOutput.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/ArrayHolderOutput.java
@@ -1,93 +1,93 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc.internal.exec;
-
-import java.util.ArrayList;
-
-import org.eclipse.scout.commons.holders.HolderUtility;
-import org.eclipse.scout.commons.holders.IHolder;
-import org.eclipse.scout.commons.parsers.token.IToken;
-import org.eclipse.scout.commons.parsers.token.ValueOutputToken;
-import org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle;
-
-class ArrayHolderOutput implements IBindOutput {
- private IHolder<?> m_holder;
- private ValueOutputToken m_source;
- private ArrayList<Object> m_accumulator = new ArrayList<Object>();
- private int m_batchIndex = -1;
- private int m_jdbcBindIndex = -1;
-
- public ArrayHolderOutput(IHolder<?> holder, ValueOutputToken source) {
- m_holder = holder;
- m_source = source;
- }
-
- @Override
- public IToken getToken() {
- return m_source;
- }
-
- @Override
- public boolean isJdbcBind() {
- return !m_source.isSelectInto();
- }
-
- @Override
- public int getJdbcBindIndex() {
- return m_jdbcBindIndex;
- }
-
- @Override
- public void setJdbcBindIndex(int index) {
- m_jdbcBindIndex = index;
- }
-
- @Override
- public boolean isBatch() {
- return m_source.isBatch();
- }
-
- @Override
- public boolean isSelectInto() {
- return m_source.isSelectInto();
- }
-
- @Override
- public Class getBindType() {
- return m_holder.getHolderType().getComponentType();
- }
-
- @Override
- public void setNextBatchIndex(int i) {
- m_batchIndex = i;
- }
-
- @Override
- public void finishBatch() {
- HolderUtility.setAndCastValue(m_holder, m_accumulator.toArray());
- }
-
- @Override
- public void setReplaceToken(ISqlStyle style) {
- m_source.setReplaceToken("?");
- }
-
- @Override
- public void consumeValue(Object value) {
- m_accumulator.add(value);
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName() + "[bindType=" + getBindType() + ", source=" + m_source + "]";
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc.internal.exec;
+
+import java.util.ArrayList;
+
+import org.eclipse.scout.commons.holders.HolderUtility;
+import org.eclipse.scout.commons.holders.IHolder;
+import org.eclipse.scout.commons.parsers.token.IToken;
+import org.eclipse.scout.commons.parsers.token.ValueOutputToken;
+import org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle;
+
+class ArrayHolderOutput implements IBindOutput {
+ private IHolder<?> m_holder;
+ private ValueOutputToken m_source;
+ private ArrayList<Object> m_accumulator = new ArrayList<Object>();
+ private int m_batchIndex = -1;
+ private int m_jdbcBindIndex = -1;
+
+ public ArrayHolderOutput(IHolder<?> holder, ValueOutputToken source) {
+ m_holder = holder;
+ m_source = source;
+ }
+
+ @Override
+ public IToken getToken() {
+ return m_source;
+ }
+
+ @Override
+ public boolean isJdbcBind() {
+ return !m_source.isSelectInto();
+ }
+
+ @Override
+ public int getJdbcBindIndex() {
+ return m_jdbcBindIndex;
+ }
+
+ @Override
+ public void setJdbcBindIndex(int index) {
+ m_jdbcBindIndex = index;
+ }
+
+ @Override
+ public boolean isBatch() {
+ return m_source.isBatch();
+ }
+
+ @Override
+ public boolean isSelectInto() {
+ return m_source.isSelectInto();
+ }
+
+ @Override
+ public Class getBindType() {
+ return m_holder.getHolderType().getComponentType();
+ }
+
+ @Override
+ public void setNextBatchIndex(int i) {
+ m_batchIndex = i;
+ }
+
+ @Override
+ public void finishBatch() {
+ HolderUtility.setAndCastValue(m_holder, m_accumulator.toArray());
+ }
+
+ @Override
+ public void setReplaceToken(ISqlStyle style) {
+ m_source.setReplaceToken("?");
+ }
+
+ @Override
+ public void consumeValue(Object value) {
+ m_accumulator.add(value);
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + "[bindType=" + getBindType() + ", source=" + m_source + "]";
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/ArrayInput.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/ArrayInput.java
index 96e910cf91..054205d44f 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/ArrayInput.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/ArrayInput.java
@@ -1,147 +1,147 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc.internal.exec;
-
-import java.lang.reflect.Array;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.parsers.token.IToken;
-import org.eclipse.scout.commons.parsers.token.ValueInputToken;
-import org.eclipse.scout.rt.server.services.common.jdbc.SqlBind;
-import org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle;
-
-class ArrayInput implements IBindInput {
- private Object m_array;
-
- private ValueInputToken m_target;
- private int m_arrayLen = 0;
- private int m_batchIndex = -1;
- private int m_jdbcBindIndex = -1;
-
- public ArrayInput(Object array, ValueInputToken target) throws ProcessingException {
- if (array != null && !array.getClass().isArray()) {
- throw new ProcessingException("array parameter must be an array type: " + array.getClass());
- }
- m_array = array;
- m_arrayLen = m_array != null ? Array.getLength(m_array) : 0;
- m_target = target;
- // initialize target
- if (isBatch()) {
- }
- else {
- m_target.setPlainValue(true);
- // if the op is = or <> change it to IN or NOT IN
- if (m_target.getParsedOp() != null) {
- if (m_target.getParsedOp().equals("=")) {
- m_target.setParsedOp("IN");
- }
- else if (m_target.getParsedOp().equals("<>")) {
- m_target.setParsedOp("NOT IN");
- }
- }
- }
- }
-
- @Override
- public IToken getToken() {
- return m_target;
- }
-
- @Override
- public boolean isBatch() {
- return m_target.isBatch();
- }
-
- @Override
- public boolean hasBatch(int i) {
- if (isBatch()) {
- return i < m_arrayLen;
- }
- else {
- return i <= 0;
- }
- }
-
- @Override
- public void setNextBatchIndex(int i) {
- m_batchIndex = i;
- }
-
- @Override
- public boolean isJdbcBind() {
- if (isBatch()) {
- if (m_target.isPlainValue()) {
- return false;
- }
- else if (m_target.isPlainSql()) {
- return false;
- }
- else {
- return true;
- }
- }
- else {
- return false;
- }
- }
-
- @Override
- public int getJdbcBindIndex() {
- return m_jdbcBindIndex;
- }
-
- @Override
- public void setJdbcBindIndex(int index) {
- m_jdbcBindIndex = index;
- }
-
- @Override
- public SqlBind produceSqlBindAndSetReplaceToken(ISqlStyle sqlStyle) throws ProcessingException {
- if (isBatch()) {
- Object value = null;
- if (m_batchIndex < m_arrayLen) {
- value = Array.get(m_array, m_batchIndex);
- }
- //
- if (m_target.isPlainValue()) {
- m_target.setReplaceToken(sqlStyle.toPlainText(value));
- return null;
- }
- else if (m_target.isPlainSql()) {
- m_target.setReplaceToken("" + value);
- return null;
- }
- else {
- m_target.setReplaceToken("?");
- return sqlStyle.buildBindFor(value, m_array.getClass().getComponentType());
- }
- }
- else {
- if (m_target.getParsedAttribute() != null) {
- String att = m_target.getParsedAttribute();
- String op = m_target.getParsedOp();
- m_target.setParsedAttribute(null);
- m_target.setParsedOp(null);
- if (op.equalsIgnoreCase("IN") || op.equalsIgnoreCase("=")) {
- m_target.setReplaceToken(sqlStyle.createInList(att, m_array));
- }
- else {
- m_target.setReplaceToken(sqlStyle.createNotInList(att, m_array));
- }
- }
- else {
- m_target.setReplaceToken(sqlStyle.toPlainText(m_array));
- }
- return null;
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc.internal.exec;
+
+import java.lang.reflect.Array;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.parsers.token.IToken;
+import org.eclipse.scout.commons.parsers.token.ValueInputToken;
+import org.eclipse.scout.rt.server.services.common.jdbc.SqlBind;
+import org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle;
+
+class ArrayInput implements IBindInput {
+ private Object m_array;
+
+ private ValueInputToken m_target;
+ private int m_arrayLen = 0;
+ private int m_batchIndex = -1;
+ private int m_jdbcBindIndex = -1;
+
+ public ArrayInput(Object array, ValueInputToken target) throws ProcessingException {
+ if (array != null && !array.getClass().isArray()) {
+ throw new ProcessingException("array parameter must be an array type: " + array.getClass());
+ }
+ m_array = array;
+ m_arrayLen = m_array != null ? Array.getLength(m_array) : 0;
+ m_target = target;
+ // initialize target
+ if (isBatch()) {
+ }
+ else {
+ m_target.setPlainValue(true);
+ // if the op is = or <> change it to IN or NOT IN
+ if (m_target.getParsedOp() != null) {
+ if (m_target.getParsedOp().equals("=")) {
+ m_target.setParsedOp("IN");
+ }
+ else if (m_target.getParsedOp().equals("<>")) {
+ m_target.setParsedOp("NOT IN");
+ }
+ }
+ }
+ }
+
+ @Override
+ public IToken getToken() {
+ return m_target;
+ }
+
+ @Override
+ public boolean isBatch() {
+ return m_target.isBatch();
+ }
+
+ @Override
+ public boolean hasBatch(int i) {
+ if (isBatch()) {
+ return i < m_arrayLen;
+ }
+ else {
+ return i <= 0;
+ }
+ }
+
+ @Override
+ public void setNextBatchIndex(int i) {
+ m_batchIndex = i;
+ }
+
+ @Override
+ public boolean isJdbcBind() {
+ if (isBatch()) {
+ if (m_target.isPlainValue()) {
+ return false;
+ }
+ else if (m_target.isPlainSql()) {
+ return false;
+ }
+ else {
+ return true;
+ }
+ }
+ else {
+ return false;
+ }
+ }
+
+ @Override
+ public int getJdbcBindIndex() {
+ return m_jdbcBindIndex;
+ }
+
+ @Override
+ public void setJdbcBindIndex(int index) {
+ m_jdbcBindIndex = index;
+ }
+
+ @Override
+ public SqlBind produceSqlBindAndSetReplaceToken(ISqlStyle sqlStyle) throws ProcessingException {
+ if (isBatch()) {
+ Object value = null;
+ if (m_batchIndex < m_arrayLen) {
+ value = Array.get(m_array, m_batchIndex);
+ }
+ //
+ if (m_target.isPlainValue()) {
+ m_target.setReplaceToken(sqlStyle.toPlainText(value));
+ return null;
+ }
+ else if (m_target.isPlainSql()) {
+ m_target.setReplaceToken("" + value);
+ return null;
+ }
+ else {
+ m_target.setReplaceToken("?");
+ return sqlStyle.buildBindFor(value, m_array.getClass().getComponentType());
+ }
+ }
+ else {
+ if (m_target.getParsedAttribute() != null) {
+ String att = m_target.getParsedAttribute();
+ String op = m_target.getParsedOp();
+ m_target.setParsedAttribute(null);
+ m_target.setParsedOp(null);
+ if (op.equalsIgnoreCase("IN") || op.equalsIgnoreCase("=")) {
+ m_target.setReplaceToken(sqlStyle.createInList(att, m_array));
+ }
+ else {
+ m_target.setReplaceToken(sqlStyle.createNotInList(att, m_array));
+ }
+ }
+ else {
+ m_target.setReplaceToken(sqlStyle.toPlainText(m_array));
+ }
+ return null;
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/BeanArrayHolderInput.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/BeanArrayHolderInput.java
index 20b2348b54..7c90c22014 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/BeanArrayHolderInput.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/BeanArrayHolderInput.java
@@ -1,72 +1,72 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc.internal.exec;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.holders.IBeanArrayHolder;
-import org.eclipse.scout.commons.parsers.token.IToken;
-import org.eclipse.scout.commons.parsers.token.ValueInputToken;
-import org.eclipse.scout.rt.server.services.common.jdbc.SqlBind;
-import org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle;
-
-class BeanArrayHolderInput implements IBindInput {
- private IBeanArrayHolder m_holder;
- private BeanPropertyInput m_delegate;
-
- public BeanArrayHolderInput(IBeanArrayHolder holder, Object[] beans, String propertyName, ValueInputToken target) throws ProcessingException {
- m_holder = holder;
- if (beans == null) {
- beans = m_holder.getBeans();
- }
- m_delegate = new BeanPropertyInput(propertyName, beans, target);
- }
-
- @Override
- public IToken getToken() {
- return m_delegate.getToken();
- }
-
- @Override
- public boolean isBatch() {
- return m_delegate.isBatch();
- }
-
- @Override
- public boolean hasBatch(int i) {
- return m_delegate.hasBatch(i);
- }
-
- @Override
- public void setNextBatchIndex(int i) {
- m_delegate.setNextBatchIndex(i);
- }
-
- @Override
- public boolean isJdbcBind() {
- return m_delegate.isJdbcBind();
- }
-
- @Override
- public int getJdbcBindIndex() {
- return m_delegate.getJdbcBindIndex();
- }
-
- @Override
- public void setJdbcBindIndex(int index) {
- m_delegate.setJdbcBindIndex(index);
- }
-
- @Override
- public SqlBind produceSqlBindAndSetReplaceToken(ISqlStyle sqlStyle) throws ProcessingException {
- return m_delegate.produceSqlBindAndSetReplaceToken(sqlStyle);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc.internal.exec;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.holders.IBeanArrayHolder;
+import org.eclipse.scout.commons.parsers.token.IToken;
+import org.eclipse.scout.commons.parsers.token.ValueInputToken;
+import org.eclipse.scout.rt.server.services.common.jdbc.SqlBind;
+import org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle;
+
+class BeanArrayHolderInput implements IBindInput {
+ private IBeanArrayHolder m_holder;
+ private BeanPropertyInput m_delegate;
+
+ public BeanArrayHolderInput(IBeanArrayHolder holder, Object[] beans, String propertyName, ValueInputToken target) throws ProcessingException {
+ m_holder = holder;
+ if (beans == null) {
+ beans = m_holder.getBeans();
+ }
+ m_delegate = new BeanPropertyInput(propertyName, beans, target);
+ }
+
+ @Override
+ public IToken getToken() {
+ return m_delegate.getToken();
+ }
+
+ @Override
+ public boolean isBatch() {
+ return m_delegate.isBatch();
+ }
+
+ @Override
+ public boolean hasBatch(int i) {
+ return m_delegate.hasBatch(i);
+ }
+
+ @Override
+ public void setNextBatchIndex(int i) {
+ m_delegate.setNextBatchIndex(i);
+ }
+
+ @Override
+ public boolean isJdbcBind() {
+ return m_delegate.isJdbcBind();
+ }
+
+ @Override
+ public int getJdbcBindIndex() {
+ return m_delegate.getJdbcBindIndex();
+ }
+
+ @Override
+ public void setJdbcBindIndex(int index) {
+ m_delegate.setJdbcBindIndex(index);
+ }
+
+ @Override
+ public SqlBind produceSqlBindAndSetReplaceToken(ISqlStyle sqlStyle) throws ProcessingException {
+ return m_delegate.produceSqlBindAndSetReplaceToken(sqlStyle);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/BeanArrayHolderOutput.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/BeanArrayHolderOutput.java
index f4926dbb76..0a35953951 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/BeanArrayHolderOutput.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/BeanArrayHolderOutput.java
@@ -1,94 +1,94 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc.internal.exec;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.holders.IBeanArrayHolder;
-import org.eclipse.scout.commons.parsers.token.IToken;
-import org.eclipse.scout.commons.parsers.token.ValueOutputToken;
-import org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle;
-
-class BeanArrayHolderOutput implements IBindOutput {
- private IBeanArrayHolder m_holder;
- private AbstractBeanPropertyOutput m_delegate;
-
- public BeanArrayHolderOutput(IBeanArrayHolder holder, String propertyName, ValueOutputToken source) throws ProcessingException {
- m_holder = holder;
- m_delegate = new AbstractBeanPropertyOutput(m_holder.getHolderType(), propertyName, source) {
- @Override
- protected Object[] getFinalBeanArray() {
- return m_holder.getBeans();
- }
- };
- }
-
- @Override
- public IToken getToken() {
- return m_delegate.getToken();
- }
-
- @Override
- public boolean isJdbcBind() {
- return m_delegate.isJdbcBind();
- }
-
- @Override
- public int getJdbcBindIndex() {
- return m_delegate.getJdbcBindIndex();
- }
-
- @Override
- public void setJdbcBindIndex(int index) {
- m_delegate.setJdbcBindIndex(index);
- }
-
- @Override
- public boolean isBatch() {
- return m_delegate.isBatch();
- }
-
- @Override
- public boolean isSelectInto() {
- return m_delegate.isSelectInto();
- }
-
- @Override
- public Class getBindType() {
- return m_delegate.getBindType();
- }
-
- @Override
- public void setNextBatchIndex(int i) {
- m_delegate.setNextBatchIndex(i);
- }
-
- @Override
- public void finishBatch() throws ProcessingException {
- m_holder.ensureSize(m_delegate.getBatchIndex() + 1);
- m_delegate.finishBatch();
- }
-
- @Override
- public void setReplaceToken(ISqlStyle style) {
- m_delegate.setReplaceToken(style);
- }
-
- @Override
- public void consumeValue(Object value) throws ProcessingException {
- m_delegate.consumeValue(value);
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName() + "[delegate=" + m_delegate + "]";
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc.internal.exec;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.holders.IBeanArrayHolder;
+import org.eclipse.scout.commons.parsers.token.IToken;
+import org.eclipse.scout.commons.parsers.token.ValueOutputToken;
+import org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle;
+
+class BeanArrayHolderOutput implements IBindOutput {
+ private IBeanArrayHolder m_holder;
+ private AbstractBeanPropertyOutput m_delegate;
+
+ public BeanArrayHolderOutput(IBeanArrayHolder holder, String propertyName, ValueOutputToken source) throws ProcessingException {
+ m_holder = holder;
+ m_delegate = new AbstractBeanPropertyOutput(m_holder.getHolderType(), propertyName, source) {
+ @Override
+ protected Object[] getFinalBeanArray() {
+ return m_holder.getBeans();
+ }
+ };
+ }
+
+ @Override
+ public IToken getToken() {
+ return m_delegate.getToken();
+ }
+
+ @Override
+ public boolean isJdbcBind() {
+ return m_delegate.isJdbcBind();
+ }
+
+ @Override
+ public int getJdbcBindIndex() {
+ return m_delegate.getJdbcBindIndex();
+ }
+
+ @Override
+ public void setJdbcBindIndex(int index) {
+ m_delegate.setJdbcBindIndex(index);
+ }
+
+ @Override
+ public boolean isBatch() {
+ return m_delegate.isBatch();
+ }
+
+ @Override
+ public boolean isSelectInto() {
+ return m_delegate.isSelectInto();
+ }
+
+ @Override
+ public Class getBindType() {
+ return m_delegate.getBindType();
+ }
+
+ @Override
+ public void setNextBatchIndex(int i) {
+ m_delegate.setNextBatchIndex(i);
+ }
+
+ @Override
+ public void finishBatch() throws ProcessingException {
+ m_holder.ensureSize(m_delegate.getBatchIndex() + 1);
+ m_delegate.finishBatch();
+ }
+
+ @Override
+ public void setReplaceToken(ISqlStyle style) {
+ m_delegate.setReplaceToken(style);
+ }
+
+ @Override
+ public void consumeValue(Object value) throws ProcessingException {
+ m_delegate.consumeValue(value);
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + "[delegate=" + m_delegate + "]";
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/BeanPropertyInput.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/BeanPropertyInput.java
index a5393af2a9..eb1ea185cd 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/BeanPropertyInput.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/BeanPropertyInput.java
@@ -1,187 +1,187 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc.internal.exec;
-
-import org.eclipse.scout.commons.BeanUtility;
-import org.eclipse.scout.commons.beans.FastPropertyDescriptor;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.parsers.token.IToken;
-import org.eclipse.scout.commons.parsers.token.ValueInputToken;
-import org.eclipse.scout.rt.server.services.common.jdbc.SqlBind;
-import org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle;
-
-class BeanPropertyInput implements IBindInput {
- private String m_propertyName;
- private FastPropertyDescriptor m_propertyDesc;
- private Object[] m_beans;
- private ValueInputToken m_target;
- private int m_batchIndex = -1;
- private int m_jdbcBindIndex = -1;
-
- public BeanPropertyInput(String propertyName, Object[] beans, ValueInputToken target) throws ProcessingException {
- if (beans == null) {
- beans = new Object[0];
- }
- m_propertyName = propertyName;
- m_beans = beans;
- m_target = target;
- try {
- if (m_propertyDesc == null) {
- FastPropertyDescriptor test = BeanUtility.getFastBeanInfo(m_beans.getClass().getComponentType(), null).getPropertyDescriptor(m_propertyName);
- if (test != null && test.getReadMethod() != null) {
- m_propertyDesc = test;
- }
- }
- if (m_propertyDesc == null) {
- for (Object bean : m_beans) {
- if (bean != null) {
- m_propertyDesc = BeanUtility.getFastBeanInfo(bean.getClass(), null).getPropertyDescriptor(m_propertyName);
- break;
- }
- }
- }
- }
- catch (Exception e) {
- throw new ProcessingException("property " + m_propertyName, e);
- }
- // initialize target
- if (isBatch()) {
- }
- else if (m_beans.length >= 2) {
- m_target.setPlainValue(true);
- // if the op is = or <> change it to IN or NOT IN
- if (m_target.getParsedOp() != null) {
- if (m_target.getParsedOp().equals("=")) {
- m_target.setParsedOp("IN");
- }
- else if (m_target.getParsedOp().equals("<>")) {
- m_target.setParsedOp("NOT IN");
- }
- }
- }
- }
-
- @Override
- public IToken getToken() {
- return m_target;
- }
-
- @Override
- public boolean isBatch() {
- return m_target.isBatch();
- }
-
- @Override
- public boolean hasBatch(int i) {
- if (isBatch()) {
- return i < m_beans.length;
- }
- else {
- return i <= 0;
- }
- }
-
- @Override
- public void setNextBatchIndex(int i) {
- m_batchIndex = i;
- }
-
- @Override
- public boolean isJdbcBind() {
- if (isBatch()) {
- if (m_target.isPlainValue()) {
- return false;
- }
- else if (m_target.isPlainSql()) {
- return false;
- }
- else {
- return true;
- }
- }
- else {
- return false;
- }
- }
-
- @Override
- public int getJdbcBindIndex() {
- return m_jdbcBindIndex;
- }
-
- @Override
- public void setJdbcBindIndex(int index) {
- m_jdbcBindIndex = index;
- }
-
- @Override
- public SqlBind produceSqlBindAndSetReplaceToken(ISqlStyle sqlStyle) throws ProcessingException {
- if (isBatch()) {
- Object value = null;
- Class valueType = m_propertyDesc != null ? m_propertyDesc.getPropertyType() : null;
- if (m_batchIndex < m_beans.length) {
- Object bean = m_beans[m_batchIndex];
- if (bean != null && m_propertyDesc != null) {
- try {
- value = m_propertyDesc.getReadMethod().invoke(bean);
- }
- catch (Exception e) {
- throw new ProcessingException("property " + m_propertyName, e);
- }
- }
- }
- //
- if (m_target.isPlainValue()) {
- m_target.setReplaceToken(sqlStyle.toPlainText(value));
- return null;
- }
- else if (m_target.isPlainSql()) {
- m_target.setReplaceToken("" + value);
- return null;
- }
- else {
- m_target.setReplaceToken("?");
- return sqlStyle.buildBindFor(value, valueType);
- }
- }
- else {
- Object[] values = new Object[m_beans.length];
- for (int i = 0; i < values.length; i++) {
- Object bean = m_beans[i];
- if (bean != null && m_propertyDesc != null) {
- try {
- values[i] = m_propertyDesc.getReadMethod().invoke(bean);
- }
- catch (Exception e) {
- throw new ProcessingException("property " + m_propertyName, e);
- }
- }
- }
- if (m_target.getParsedAttribute() != null) {
- String att = m_target.getParsedAttribute();
- String op = m_target.getParsedOp();
- m_target.setParsedAttribute(null);
- m_target.setParsedOp(null);
- if (op.equalsIgnoreCase("IN") || op.equalsIgnoreCase("=")) {
- m_target.setReplaceToken(sqlStyle.createInList(att, values));
- }
- else {
- m_target.setReplaceToken(sqlStyle.createNotInList(att, values));
- }
- }
- else {
- m_target.setReplaceToken(sqlStyle.toPlainText(values));
- }
- return null;
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc.internal.exec;
+
+import org.eclipse.scout.commons.BeanUtility;
+import org.eclipse.scout.commons.beans.FastPropertyDescriptor;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.parsers.token.IToken;
+import org.eclipse.scout.commons.parsers.token.ValueInputToken;
+import org.eclipse.scout.rt.server.services.common.jdbc.SqlBind;
+import org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle;
+
+class BeanPropertyInput implements IBindInput {
+ private String m_propertyName;
+ private FastPropertyDescriptor m_propertyDesc;
+ private Object[] m_beans;
+ private ValueInputToken m_target;
+ private int m_batchIndex = -1;
+ private int m_jdbcBindIndex = -1;
+
+ public BeanPropertyInput(String propertyName, Object[] beans, ValueInputToken target) throws ProcessingException {
+ if (beans == null) {
+ beans = new Object[0];
+ }
+ m_propertyName = propertyName;
+ m_beans = beans;
+ m_target = target;
+ try {
+ if (m_propertyDesc == null) {
+ FastPropertyDescriptor test = BeanUtility.getFastBeanInfo(m_beans.getClass().getComponentType(), null).getPropertyDescriptor(m_propertyName);
+ if (test != null && test.getReadMethod() != null) {
+ m_propertyDesc = test;
+ }
+ }
+ if (m_propertyDesc == null) {
+ for (Object bean : m_beans) {
+ if (bean != null) {
+ m_propertyDesc = BeanUtility.getFastBeanInfo(bean.getClass(), null).getPropertyDescriptor(m_propertyName);
+ break;
+ }
+ }
+ }
+ }
+ catch (Exception e) {
+ throw new ProcessingException("property " + m_propertyName, e);
+ }
+ // initialize target
+ if (isBatch()) {
+ }
+ else if (m_beans.length >= 2) {
+ m_target.setPlainValue(true);
+ // if the op is = or <> change it to IN or NOT IN
+ if (m_target.getParsedOp() != null) {
+ if (m_target.getParsedOp().equals("=")) {
+ m_target.setParsedOp("IN");
+ }
+ else if (m_target.getParsedOp().equals("<>")) {
+ m_target.setParsedOp("NOT IN");
+ }
+ }
+ }
+ }
+
+ @Override
+ public IToken getToken() {
+ return m_target;
+ }
+
+ @Override
+ public boolean isBatch() {
+ return m_target.isBatch();
+ }
+
+ @Override
+ public boolean hasBatch(int i) {
+ if (isBatch()) {
+ return i < m_beans.length;
+ }
+ else {
+ return i <= 0;
+ }
+ }
+
+ @Override
+ public void setNextBatchIndex(int i) {
+ m_batchIndex = i;
+ }
+
+ @Override
+ public boolean isJdbcBind() {
+ if (isBatch()) {
+ if (m_target.isPlainValue()) {
+ return false;
+ }
+ else if (m_target.isPlainSql()) {
+ return false;
+ }
+ else {
+ return true;
+ }
+ }
+ else {
+ return false;
+ }
+ }
+
+ @Override
+ public int getJdbcBindIndex() {
+ return m_jdbcBindIndex;
+ }
+
+ @Override
+ public void setJdbcBindIndex(int index) {
+ m_jdbcBindIndex = index;
+ }
+
+ @Override
+ public SqlBind produceSqlBindAndSetReplaceToken(ISqlStyle sqlStyle) throws ProcessingException {
+ if (isBatch()) {
+ Object value = null;
+ Class valueType = m_propertyDesc != null ? m_propertyDesc.getPropertyType() : null;
+ if (m_batchIndex < m_beans.length) {
+ Object bean = m_beans[m_batchIndex];
+ if (bean != null && m_propertyDesc != null) {
+ try {
+ value = m_propertyDesc.getReadMethod().invoke(bean);
+ }
+ catch (Exception e) {
+ throw new ProcessingException("property " + m_propertyName, e);
+ }
+ }
+ }
+ //
+ if (m_target.isPlainValue()) {
+ m_target.setReplaceToken(sqlStyle.toPlainText(value));
+ return null;
+ }
+ else if (m_target.isPlainSql()) {
+ m_target.setReplaceToken("" + value);
+ return null;
+ }
+ else {
+ m_target.setReplaceToken("?");
+ return sqlStyle.buildBindFor(value, valueType);
+ }
+ }
+ else {
+ Object[] values = new Object[m_beans.length];
+ for (int i = 0; i < values.length; i++) {
+ Object bean = m_beans[i];
+ if (bean != null && m_propertyDesc != null) {
+ try {
+ values[i] = m_propertyDesc.getReadMethod().invoke(bean);
+ }
+ catch (Exception e) {
+ throw new ProcessingException("property " + m_propertyName, e);
+ }
+ }
+ }
+ if (m_target.getParsedAttribute() != null) {
+ String att = m_target.getParsedAttribute();
+ String op = m_target.getParsedOp();
+ m_target.setParsedAttribute(null);
+ m_target.setParsedOp(null);
+ if (op.equalsIgnoreCase("IN") || op.equalsIgnoreCase("=")) {
+ m_target.setReplaceToken(sqlStyle.createInList(att, values));
+ }
+ else {
+ m_target.setReplaceToken(sqlStyle.createNotInList(att, values));
+ }
+ }
+ else {
+ m_target.setReplaceToken(sqlStyle.toPlainText(values));
+ }
+ return null;
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/FunctionInput.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/FunctionInput.java
index 67e44008f1..8feb07cc3a 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/FunctionInput.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/FunctionInput.java
@@ -1,127 +1,127 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc.internal.exec;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.holders.IHolder;
-import org.eclipse.scout.commons.parsers.token.FunctionInputToken;
-import org.eclipse.scout.commons.parsers.token.IToken;
-import org.eclipse.scout.rt.server.services.common.jdbc.AbstractSqlService;
-import org.eclipse.scout.rt.server.services.common.jdbc.ISqlService;
-import org.eclipse.scout.rt.server.services.common.jdbc.SqlBind;
-import org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle;
-
-class FunctionInput implements IBindInput {
- private ISqlService m_callerService;
- private Object[] m_bindBases;
- //
- private int m_batchIndex = -1;
- private int m_jdbcBindIndex = -1;
- private Object m_value;
- private boolean m_valueSet;
- private FunctionInputToken m_target;
-
- public FunctionInput(ISqlService callerService, Object[] bindBases, FunctionInputToken target) {
- m_callerService = callerService;
- m_bindBases = bindBases;
- m_target = target;
- }
-
- @Override
- public IToken getToken() {
- return m_target;
- }
-
- @Override
- public boolean isBatch() {
- return false;
- }
-
- @Override
- public boolean hasBatch(int i) {
- return i <= 0;
- }
-
- @Override
- public void setNextBatchIndex(int i) {
- m_batchIndex = i;
- }
-
- @Override
- public boolean isJdbcBind() {
- if (m_target.isPlainToken()) {
- return false;
- }
- else if (m_target.isPlainValue()) {
- return false;
- }
- else if (m_target.isPlainSql()) {
- return false;
- }
- else {
- return true;
- }
- }
-
- @Override
- public int getJdbcBindIndex() {
- return m_jdbcBindIndex;
- }
-
- @Override
- public void setJdbcBindIndex(int index) {
- m_jdbcBindIndex = index;
- }
-
- @Override
- public SqlBind produceSqlBindAndSetReplaceToken(ISqlStyle sqlStyle) throws ProcessingException {
- if (isBatch() || !m_valueSet) {
- if (m_callerService instanceof AbstractSqlService) {
- m_value = ((AbstractSqlService) m_callerService).callbackCustomBindFunction(m_target.getName(), m_target.getArgs(), m_bindBases);
- }
- else {
- throw new ProcessingException("don't know how to resolve custom bind function '" + m_target.getName() + "' on service " + m_callerService.getClass().getName());
- }
- m_valueSet = true;
- }
- Object value = null;
- if (isBatch() && m_batchIndex >= 1) {
- value = null;
- }
- else {
- value = m_value;
- }
- Class<?> nullType = null;
- if (value instanceof IHolder<?>) {
- IHolder h = (IHolder<?>) value;
- value = h.getValue();
- nullType = h.getHolderType();
- }
- //
- if (m_target.isPlainToken()) {
- m_target.setReplaceToken(m_target.getParsedToken());
- return null;
- }
- else if (m_target.isPlainValue()) {
- m_target.setReplaceToken(sqlStyle.toPlainText(value));
- return null;
- }
- else if (m_target.isPlainSql()) {
- m_target.setReplaceToken("" + value);
- return null;
- }
- else {
- m_target.setReplaceToken("?");
- return sqlStyle.buildBindFor(value, nullType);
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc.internal.exec;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.holders.IHolder;
+import org.eclipse.scout.commons.parsers.token.FunctionInputToken;
+import org.eclipse.scout.commons.parsers.token.IToken;
+import org.eclipse.scout.rt.server.services.common.jdbc.AbstractSqlService;
+import org.eclipse.scout.rt.server.services.common.jdbc.ISqlService;
+import org.eclipse.scout.rt.server.services.common.jdbc.SqlBind;
+import org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle;
+
+class FunctionInput implements IBindInput {
+ private ISqlService m_callerService;
+ private Object[] m_bindBases;
+ //
+ private int m_batchIndex = -1;
+ private int m_jdbcBindIndex = -1;
+ private Object m_value;
+ private boolean m_valueSet;
+ private FunctionInputToken m_target;
+
+ public FunctionInput(ISqlService callerService, Object[] bindBases, FunctionInputToken target) {
+ m_callerService = callerService;
+ m_bindBases = bindBases;
+ m_target = target;
+ }
+
+ @Override
+ public IToken getToken() {
+ return m_target;
+ }
+
+ @Override
+ public boolean isBatch() {
+ return false;
+ }
+
+ @Override
+ public boolean hasBatch(int i) {
+ return i <= 0;
+ }
+
+ @Override
+ public void setNextBatchIndex(int i) {
+ m_batchIndex = i;
+ }
+
+ @Override
+ public boolean isJdbcBind() {
+ if (m_target.isPlainToken()) {
+ return false;
+ }
+ else if (m_target.isPlainValue()) {
+ return false;
+ }
+ else if (m_target.isPlainSql()) {
+ return false;
+ }
+ else {
+ return true;
+ }
+ }
+
+ @Override
+ public int getJdbcBindIndex() {
+ return m_jdbcBindIndex;
+ }
+
+ @Override
+ public void setJdbcBindIndex(int index) {
+ m_jdbcBindIndex = index;
+ }
+
+ @Override
+ public SqlBind produceSqlBindAndSetReplaceToken(ISqlStyle sqlStyle) throws ProcessingException {
+ if (isBatch() || !m_valueSet) {
+ if (m_callerService instanceof AbstractSqlService) {
+ m_value = ((AbstractSqlService) m_callerService).callbackCustomBindFunction(m_target.getName(), m_target.getArgs(), m_bindBases);
+ }
+ else {
+ throw new ProcessingException("don't know how to resolve custom bind function '" + m_target.getName() + "' on service " + m_callerService.getClass().getName());
+ }
+ m_valueSet = true;
+ }
+ Object value = null;
+ if (isBatch() && m_batchIndex >= 1) {
+ value = null;
+ }
+ else {
+ value = m_value;
+ }
+ Class<?> nullType = null;
+ if (value instanceof IHolder<?>) {
+ IHolder h = (IHolder<?>) value;
+ value = h.getValue();
+ nullType = h.getHolderType();
+ }
+ //
+ if (m_target.isPlainToken()) {
+ m_target.setReplaceToken(m_target.getParsedToken());
+ return null;
+ }
+ else if (m_target.isPlainValue()) {
+ m_target.setReplaceToken(sqlStyle.toPlainText(value));
+ return null;
+ }
+ else if (m_target.isPlainSql()) {
+ m_target.setReplaceToken("" + value);
+ return null;
+ }
+ else {
+ m_target.setReplaceToken("?");
+ return sqlStyle.buildBindFor(value, nullType);
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/IBindInput.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/IBindInput.java
index 4b9cf92f7d..a08bca798c 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/IBindInput.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/IBindInput.java
@@ -1,39 +1,39 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc.internal.exec;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.parsers.token.IToken;
-import org.eclipse.scout.rt.server.services.common.jdbc.SqlBind;
-import org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle;
-
-interface IBindInput {
-
- IToken getToken();
-
- /**
- * @return true if this bind corresponds to a jdbc "?" bind
- */
- boolean isJdbcBind();
-
- int getJdbcBindIndex();
-
- void setJdbcBindIndex(int index);
-
- boolean isBatch();
-
- boolean hasBatch(int i);
-
- void setNextBatchIndex(int i);
-
- SqlBind produceSqlBindAndSetReplaceToken(ISqlStyle sqlStyle) throws ProcessingException;
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc.internal.exec;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.parsers.token.IToken;
+import org.eclipse.scout.rt.server.services.common.jdbc.SqlBind;
+import org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle;
+
+interface IBindInput {
+
+ IToken getToken();
+
+ /**
+ * @return true if this bind corresponds to a jdbc "?" bind
+ */
+ boolean isJdbcBind();
+
+ int getJdbcBindIndex();
+
+ void setJdbcBindIndex(int index);
+
+ boolean isBatch();
+
+ boolean hasBatch(int i);
+
+ void setNextBatchIndex(int i);
+
+ SqlBind produceSqlBindAndSetReplaceToken(ISqlStyle sqlStyle) throws ProcessingException;
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/IBindOutput.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/IBindOutput.java
index 73e6d9cea9..ee187d982a 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/IBindOutput.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/IBindOutput.java
@@ -1,44 +1,44 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc.internal.exec;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.parsers.token.IToken;
-import org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle;
-
-interface IBindOutput {
-
- IToken getToken();
-
- /**
- * @return true if this bind corresponds to a jdbc "?" bind
- */
- boolean isJdbcBind();
-
- int getJdbcBindIndex();
-
- void setJdbcBindIndex(int index);
-
- boolean isBatch();
-
- boolean isSelectInto();
-
- Class getBindType();
-
- void setNextBatchIndex(int i);
-
- void finishBatch() throws ProcessingException;
-
- void setReplaceToken(ISqlStyle style);
-
- void consumeValue(Object value) throws ProcessingException;
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc.internal.exec;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.parsers.token.IToken;
+import org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle;
+
+interface IBindOutput {
+
+ IToken getToken();
+
+ /**
+ * @return true if this bind corresponds to a jdbc "?" bind
+ */
+ boolean isJdbcBind();
+
+ int getJdbcBindIndex();
+
+ void setJdbcBindIndex(int index);
+
+ boolean isBatch();
+
+ boolean isSelectInto();
+
+ Class getBindType();
+
+ void setNextBatchIndex(int i);
+
+ void finishBatch() throws ProcessingException;
+
+ void setReplaceToken(ISqlStyle style);
+
+ void consumeValue(Object value) throws ProcessingException;
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/MapOutput.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/MapOutput.java
index ccf0a81624..cb14b8eb8b 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/MapOutput.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/MapOutput.java
@@ -1,101 +1,101 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc.internal.exec;
-
-import java.util.Map;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.parsers.token.IToken;
-import org.eclipse.scout.commons.parsers.token.ValueOutputToken;
-import org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle;
-
-class MapOutput implements IBindOutput {
- private Map<Object, Object> m_map;
- private Object m_mapKey;
- private ValueOutputToken m_source;
- private int m_batchIndex = -1;
- private int m_jdbcBindIndex = -1;
- private Object m_accumulator;
-
- public MapOutput(Map<Object, Object> map, Object mapKey, ValueOutputToken source) {
- m_map = map;
- m_mapKey = mapKey;
- m_source = source;
- }
-
- @Override
- public IToken getToken() {
- return m_source;
- }
-
- @Override
- public boolean isJdbcBind() {
- return !m_source.isSelectInto();
- }
-
- @Override
- public int getJdbcBindIndex() {
- return m_jdbcBindIndex;
- }
-
- @Override
- public void setJdbcBindIndex(int index) {
- m_jdbcBindIndex = index;
- }
-
- @Override
- public boolean isBatch() {
- return m_source.isBatch();
- }
-
- @Override
- public boolean isSelectInto() {
- return m_source.isSelectInto();
- }
-
- @Override
- public void setNextBatchIndex(int i) {
- m_batchIndex = i;
- }
-
- @Override
- public Class getBindType() {
- Object o = m_map.get(m_mapKey);
- return o != null ? o.getClass() : Object.class;
- }
-
- @Override
- public void finishBatch() {
- m_map.put(m_mapKey, m_accumulator);
- }
-
- @Override
- public void setReplaceToken(ISqlStyle style) {
- m_source.setReplaceToken("?");
- }
-
- @Override
- public void consumeValue(Object value) throws ProcessingException {
- if (m_batchIndex == 0) {
- m_accumulator = value;
- }
- else {
- // ticket 83809
- throw new ProcessingException("expected a single value for map key \"" + m_source.getParsedToken() + "\" but got multiple values");
- }
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName() + "[bindType=" + getBindType() + ", key=" + m_mapKey + ", token=" + m_source + "]";
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc.internal.exec;
+
+import java.util.Map;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.parsers.token.IToken;
+import org.eclipse.scout.commons.parsers.token.ValueOutputToken;
+import org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle;
+
+class MapOutput implements IBindOutput {
+ private Map<Object, Object> m_map;
+ private Object m_mapKey;
+ private ValueOutputToken m_source;
+ private int m_batchIndex = -1;
+ private int m_jdbcBindIndex = -1;
+ private Object m_accumulator;
+
+ public MapOutput(Map<Object, Object> map, Object mapKey, ValueOutputToken source) {
+ m_map = map;
+ m_mapKey = mapKey;
+ m_source = source;
+ }
+
+ @Override
+ public IToken getToken() {
+ return m_source;
+ }
+
+ @Override
+ public boolean isJdbcBind() {
+ return !m_source.isSelectInto();
+ }
+
+ @Override
+ public int getJdbcBindIndex() {
+ return m_jdbcBindIndex;
+ }
+
+ @Override
+ public void setJdbcBindIndex(int index) {
+ m_jdbcBindIndex = index;
+ }
+
+ @Override
+ public boolean isBatch() {
+ return m_source.isBatch();
+ }
+
+ @Override
+ public boolean isSelectInto() {
+ return m_source.isSelectInto();
+ }
+
+ @Override
+ public void setNextBatchIndex(int i) {
+ m_batchIndex = i;
+ }
+
+ @Override
+ public Class getBindType() {
+ Object o = m_map.get(m_mapKey);
+ return o != null ? o.getClass() : Object.class;
+ }
+
+ @Override
+ public void finishBatch() {
+ m_map.put(m_mapKey, m_accumulator);
+ }
+
+ @Override
+ public void setReplaceToken(ISqlStyle style) {
+ m_source.setReplaceToken("?");
+ }
+
+ @Override
+ public void consumeValue(Object value) throws ProcessingException {
+ if (m_batchIndex == 0) {
+ m_accumulator = value;
+ }
+ else {
+ // ticket 83809
+ throw new ProcessingException("expected a single value for map key \"" + m_source.getParsedToken() + "\" but got multiple values");
+ }
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + "[bindType=" + getBindType() + ", key=" + m_mapKey + ", token=" + m_source + "]";
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/PreparedStatementCache.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/PreparedStatementCache.java
index aacadca01c..d1942107cd 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/PreparedStatementCache.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/PreparedStatementCache.java
@@ -1,142 +1,142 @@
-/*******************************************************************************
- * Copyright (c) 2010,2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc.internal.exec;
-
-import java.sql.CallableStatement;
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.SQLException;
-
-import org.eclipse.scout.commons.LRUCache;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.server.services.common.jdbc.IStatementCache;
-import org.eclipse.scout.rt.server.transaction.AbstractTransactionMember;
-
-public class PreparedStatementCache extends AbstractTransactionMember implements IStatementCache {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(PreparedStatementCache.class);
-
- public static final String TRANSACTION_MEMBER_ID = "PreparedStatementCache";
-
- private LRUCache<String, Integer> m_countCache;
- private LRUCache<String, PreparedStatement> m_statementCache;
-
- public PreparedStatementCache(int statementCacheSize) {
- super(TRANSACTION_MEMBER_ID);
- m_countCache = new LRUCache<String, Integer>(200, 120000L);
- m_statementCache = new LRUCache<String, PreparedStatement>(statementCacheSize, 3600000L);
- m_statementCache.addDisposeListener(new LRUCache.DisposeListener() {
- @Override
- public void valueDisposed(Object key, Object value) {
- PreparedStatement ps = (PreparedStatement) value;
- try {
- ps.close();
- }
- catch (SQLException e) {
- LOG.warn("disposing prepared statement");
- }
- }
- });
- }
-
- @Override
- public PreparedStatement getPreparedStatement(Connection conn, String s) throws SQLException {
- // a statement must be used at least 2 times within 2 minutes in order to be
- // cached
- PreparedStatement ps = m_statementCache.get(s);
- if (ps == null) {
- ps = conn.prepareStatement(s);
- Integer count = m_countCache.get(s);
- count = (count != null ? count : 0) + 1;
- m_countCache.put(s, count);
- if (count >= 2) {
- // second access, cache it
- m_statementCache.put(s, ps);
- }
- }
- else {
- ps.clearParameters();
- ps.clearWarnings();
- }
- return ps;
- }
-
- @Override
- public void releasePreparedStatement(PreparedStatement ps) {
- // close statement when it is not cached
- if (ps != null) {
- if (!m_statementCache.containsValue(ps)) {
- try {
- ps.close();
- }
- catch (Throwable t) {
- }
- }
- }
- }
-
- @Override
- public CallableStatement getCallableStatement(Connection conn, String s) throws SQLException {
- // a statement must be used at least 2 times within 2 minutes in order to be
- // cached
- CallableStatement cs = (CallableStatement) m_statementCache.get(s);
- if (cs == null) {
- cs = conn.prepareCall(s);
- Integer count = m_countCache.get(s);
- count = (count != null ? count : 0) + 1;
- m_countCache.put(s, count);
- if (count >= 2) {
- // second access, cache it
- m_statementCache.put(s, cs);
- }
- }
- return cs;
- }
-
- @Override
- public void releaseCallableStatement(CallableStatement cs) {
- // close statement when it is not cached
- if (cs != null) {
- if (!m_statementCache.containsValue(cs)) {
- try {
- cs.close();
- }
- catch (Throwable t) {
- }
- }
- }
- }
-
- @Override
- public boolean needsCommit() {
- return false;
- }
-
- @Override
- public boolean commitPhase1() {
- return true;
- }
-
- @Override
- public void commitPhase2() {
- }
-
- @Override
- public void rollback() {
- }
-
- @Override
- public void release() {
- m_statementCache.clear();// will call the dispose listener
- m_countCache.clear();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010,2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc.internal.exec;
+
+import java.sql.CallableStatement;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+
+import org.eclipse.scout.commons.LRUCache;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.server.services.common.jdbc.IStatementCache;
+import org.eclipse.scout.rt.server.transaction.AbstractTransactionMember;
+
+public class PreparedStatementCache extends AbstractTransactionMember implements IStatementCache {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(PreparedStatementCache.class);
+
+ public static final String TRANSACTION_MEMBER_ID = "PreparedStatementCache";
+
+ private LRUCache<String, Integer> m_countCache;
+ private LRUCache<String, PreparedStatement> m_statementCache;
+
+ public PreparedStatementCache(int statementCacheSize) {
+ super(TRANSACTION_MEMBER_ID);
+ m_countCache = new LRUCache<String, Integer>(200, 120000L);
+ m_statementCache = new LRUCache<String, PreparedStatement>(statementCacheSize, 3600000L);
+ m_statementCache.addDisposeListener(new LRUCache.DisposeListener() {
+ @Override
+ public void valueDisposed(Object key, Object value) {
+ PreparedStatement ps = (PreparedStatement) value;
+ try {
+ ps.close();
+ }
+ catch (SQLException e) {
+ LOG.warn("disposing prepared statement");
+ }
+ }
+ });
+ }
+
+ @Override
+ public PreparedStatement getPreparedStatement(Connection conn, String s) throws SQLException {
+ // a statement must be used at least 2 times within 2 minutes in order to be
+ // cached
+ PreparedStatement ps = m_statementCache.get(s);
+ if (ps == null) {
+ ps = conn.prepareStatement(s);
+ Integer count = m_countCache.get(s);
+ count = (count != null ? count : 0) + 1;
+ m_countCache.put(s, count);
+ if (count >= 2) {
+ // second access, cache it
+ m_statementCache.put(s, ps);
+ }
+ }
+ else {
+ ps.clearParameters();
+ ps.clearWarnings();
+ }
+ return ps;
+ }
+
+ @Override
+ public void releasePreparedStatement(PreparedStatement ps) {
+ // close statement when it is not cached
+ if (ps != null) {
+ if (!m_statementCache.containsValue(ps)) {
+ try {
+ ps.close();
+ }
+ catch (Throwable t) {
+ }
+ }
+ }
+ }
+
+ @Override
+ public CallableStatement getCallableStatement(Connection conn, String s) throws SQLException {
+ // a statement must be used at least 2 times within 2 minutes in order to be
+ // cached
+ CallableStatement cs = (CallableStatement) m_statementCache.get(s);
+ if (cs == null) {
+ cs = conn.prepareCall(s);
+ Integer count = m_countCache.get(s);
+ count = (count != null ? count : 0) + 1;
+ m_countCache.put(s, count);
+ if (count >= 2) {
+ // second access, cache it
+ m_statementCache.put(s, cs);
+ }
+ }
+ return cs;
+ }
+
+ @Override
+ public void releaseCallableStatement(CallableStatement cs) {
+ // close statement when it is not cached
+ if (cs != null) {
+ if (!m_statementCache.containsValue(cs)) {
+ try {
+ cs.close();
+ }
+ catch (Throwable t) {
+ }
+ }
+ }
+ }
+
+ @Override
+ public boolean needsCommit() {
+ return false;
+ }
+
+ @Override
+ public boolean commitPhase1() {
+ return true;
+ }
+
+ @Override
+ public void commitPhase2() {
+ }
+
+ @Override
+ public void rollback() {
+ }
+
+ @Override
+ public void release() {
+ m_statementCache.clear();// will call the dispose listener
+ m_countCache.clear();
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/SingleHolderOutput.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/SingleHolderOutput.java
index 6fc62daf21..a12acd94bc 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/SingleHolderOutput.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/SingleHolderOutput.java
@@ -1,97 +1,97 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc.internal.exec;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.holders.HolderUtility;
-import org.eclipse.scout.commons.holders.IHolder;
-import org.eclipse.scout.commons.parsers.token.IToken;
-import org.eclipse.scout.commons.parsers.token.ValueOutputToken;
-import org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle;
-
-class SingleHolderOutput implements IBindOutput {
- private IHolder<?> m_holder;
- private ValueOutputToken m_source;
- private int m_batchIndex = -1;
- private int m_jdbcBindIndex = -1;
- private Object m_accumulator;
-
- public SingleHolderOutput(IHolder<?> holder, ValueOutputToken source) {
- m_holder = holder;
- m_source = source;
- }
-
- @Override
- public IToken getToken() {
- return m_source;
- }
-
- @Override
- public boolean isJdbcBind() {
- return !m_source.isSelectInto();
- }
-
- @Override
- public int getJdbcBindIndex() {
- return m_jdbcBindIndex;
- }
-
- @Override
- public void setJdbcBindIndex(int index) {
- m_jdbcBindIndex = index;
- }
-
- @Override
- public boolean isBatch() {
- return m_source.isBatch();
- }
-
- @Override
- public boolean isSelectInto() {
- return m_source.isSelectInto();
- }
-
- @Override
- public void setNextBatchIndex(int i) {
- m_batchIndex = i;
- }
-
- @Override
- public Class getBindType() {
- return m_holder.getHolderType();
- }
-
- @Override
- public void finishBatch() {
- HolderUtility.setAndCastValue(m_holder, m_accumulator);
- }
-
- @Override
- public void setReplaceToken(ISqlStyle style) {
- m_source.setReplaceToken("?");
- }
-
- @Override
- public void consumeValue(Object value) throws ProcessingException {
- if (m_batchIndex == 0) {
- m_accumulator = value;
- }
- else {
- // ticket 83809
- throw new ProcessingException("expected a single value for \"" + m_source.getParsedToken() + "\" but got multiple values");
- }
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName() + "[bindType=" + getBindType() + ", source=" + m_source + "]";
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc.internal.exec;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.holders.HolderUtility;
+import org.eclipse.scout.commons.holders.IHolder;
+import org.eclipse.scout.commons.parsers.token.IToken;
+import org.eclipse.scout.commons.parsers.token.ValueOutputToken;
+import org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle;
+
+class SingleHolderOutput implements IBindOutput {
+ private IHolder<?> m_holder;
+ private ValueOutputToken m_source;
+ private int m_batchIndex = -1;
+ private int m_jdbcBindIndex = -1;
+ private Object m_accumulator;
+
+ public SingleHolderOutput(IHolder<?> holder, ValueOutputToken source) {
+ m_holder = holder;
+ m_source = source;
+ }
+
+ @Override
+ public IToken getToken() {
+ return m_source;
+ }
+
+ @Override
+ public boolean isJdbcBind() {
+ return !m_source.isSelectInto();
+ }
+
+ @Override
+ public int getJdbcBindIndex() {
+ return m_jdbcBindIndex;
+ }
+
+ @Override
+ public void setJdbcBindIndex(int index) {
+ m_jdbcBindIndex = index;
+ }
+
+ @Override
+ public boolean isBatch() {
+ return m_source.isBatch();
+ }
+
+ @Override
+ public boolean isSelectInto() {
+ return m_source.isSelectInto();
+ }
+
+ @Override
+ public void setNextBatchIndex(int i) {
+ m_batchIndex = i;
+ }
+
+ @Override
+ public Class getBindType() {
+ return m_holder.getHolderType();
+ }
+
+ @Override
+ public void finishBatch() {
+ HolderUtility.setAndCastValue(m_holder, m_accumulator);
+ }
+
+ @Override
+ public void setReplaceToken(ISqlStyle style) {
+ m_source.setReplaceToken("?");
+ }
+
+ @Override
+ public void consumeValue(Object value) throws ProcessingException {
+ if (m_batchIndex == 0) {
+ m_accumulator = value;
+ }
+ else {
+ // ticket 83809
+ throw new ProcessingException("expected a single value for \"" + m_source.getParsedToken() + "\" but got multiple values");
+ }
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + "[bindType=" + getBindType() + ", source=" + m_source + "]";
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/SingleInput.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/SingleInput.java
index 3f58f87039..f51d1a4ec8 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/SingleInput.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/SingleInput.java
@@ -1,100 +1,100 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc.internal.exec;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.parsers.token.IToken;
-import org.eclipse.scout.commons.parsers.token.ValueInputToken;
-import org.eclipse.scout.rt.server.services.common.jdbc.SqlBind;
-import org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle;
-
-class SingleInput implements IBindInput {
- private int m_batchIndex = -1;
- private int m_jdbcBindIndex = -1;
- private Object m_value;
- private Class m_nullType;
- private ValueInputToken m_target;
-
- public SingleInput(Object value, Class nullType, ValueInputToken target) {
- m_value = value;
- m_nullType = nullType;
- m_target = target;
- }
-
- @Override
- public IToken getToken() {
- return m_target;
- }
-
- @Override
- public boolean isBatch() {
- return m_target.isBatch();
- }
-
- @Override
- public boolean hasBatch(int i) {
- return i <= 0;
- }
-
- @Override
- public void setNextBatchIndex(int i) {
- m_batchIndex = i;
- }
-
- @Override
- public boolean isJdbcBind() {
- if (m_target.isPlainValue()) {
- return false;
- }
- else if (m_target.isPlainSql()) {
- return false;
- }
- else {
- return true;
- }
- }
-
- @Override
- public int getJdbcBindIndex() {
- return m_jdbcBindIndex;
- }
-
- @Override
- public void setJdbcBindIndex(int index) {
- m_jdbcBindIndex = index;
- }
-
- @Override
- public SqlBind produceSqlBindAndSetReplaceToken(ISqlStyle sqlStyle) throws ProcessingException {
- Object value = null;
- if ((!isBatch()) || m_batchIndex <= 0) {
- value = m_value;
- }
- //
- if (m_target.isPlainValue()) {
- m_target.setReplaceToken(sqlStyle.toPlainText(value));
- return null;
- }
- else if (m_target.isPlainSql()) {
- m_target.setReplaceToken("" + value);
- return null;
- }
- else {
- m_target.setReplaceToken("?");
- return sqlStyle.buildBindFor(value, m_nullType);
- }
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName() + "[value=" + m_value + ", token=" + m_target + "]";
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc.internal.exec;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.parsers.token.IToken;
+import org.eclipse.scout.commons.parsers.token.ValueInputToken;
+import org.eclipse.scout.rt.server.services.common.jdbc.SqlBind;
+import org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle;
+
+class SingleInput implements IBindInput {
+ private int m_batchIndex = -1;
+ private int m_jdbcBindIndex = -1;
+ private Object m_value;
+ private Class m_nullType;
+ private ValueInputToken m_target;
+
+ public SingleInput(Object value, Class nullType, ValueInputToken target) {
+ m_value = value;
+ m_nullType = nullType;
+ m_target = target;
+ }
+
+ @Override
+ public IToken getToken() {
+ return m_target;
+ }
+
+ @Override
+ public boolean isBatch() {
+ return m_target.isBatch();
+ }
+
+ @Override
+ public boolean hasBatch(int i) {
+ return i <= 0;
+ }
+
+ @Override
+ public void setNextBatchIndex(int i) {
+ m_batchIndex = i;
+ }
+
+ @Override
+ public boolean isJdbcBind() {
+ if (m_target.isPlainValue()) {
+ return false;
+ }
+ else if (m_target.isPlainSql()) {
+ return false;
+ }
+ else {
+ return true;
+ }
+ }
+
+ @Override
+ public int getJdbcBindIndex() {
+ return m_jdbcBindIndex;
+ }
+
+ @Override
+ public void setJdbcBindIndex(int index) {
+ m_jdbcBindIndex = index;
+ }
+
+ @Override
+ public SqlBind produceSqlBindAndSetReplaceToken(ISqlStyle sqlStyle) throws ProcessingException {
+ Object value = null;
+ if ((!isBatch()) || m_batchIndex <= 0) {
+ value = m_value;
+ }
+ //
+ if (m_target.isPlainValue()) {
+ m_target.setReplaceToken(sqlStyle.toPlainText(value));
+ return null;
+ }
+ else if (m_target.isPlainSql()) {
+ m_target.setReplaceToken("" + value);
+ return null;
+ }
+ else {
+ m_target.setReplaceToken("?");
+ return sqlStyle.buildBindFor(value, m_nullType);
+ }
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + "[value=" + m_value + ", token=" + m_target + "]";
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/StatementProcessor.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/StatementProcessor.java
index b023922931..965ea4a3ae 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/StatementProcessor.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/StatementProcessor.java
@@ -1,1403 +1,1403 @@
-/*******************************************************************************
- * Copyright (c) 2010,2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc.internal.exec;
-
-import java.lang.reflect.Method;
-import java.sql.CallableStatement;
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.ResultSetMetaData;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.sql.Types;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.TreeMap;
-
-import org.eclipse.scout.commons.BeanUtility;
-import org.eclipse.scout.commons.TriState;
-import org.eclipse.scout.commons.beans.FastPropertyDescriptor;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.holders.BeanArrayHolderFilter;
-import org.eclipse.scout.commons.holders.IBeanArrayHolder;
-import org.eclipse.scout.commons.holders.IHolder;
-import org.eclipse.scout.commons.holders.ITableHolder;
-import org.eclipse.scout.commons.holders.NVPair;
-import org.eclipse.scout.commons.holders.TableHolderFilter;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.commons.parsers.BindModel;
-import org.eclipse.scout.commons.parsers.BindParser;
-import org.eclipse.scout.commons.parsers.IntoModel;
-import org.eclipse.scout.commons.parsers.IntoParser;
-import org.eclipse.scout.commons.parsers.sql.SqlFormatter;
-import org.eclipse.scout.commons.parsers.token.DatabaseSpecificToken;
-import org.eclipse.scout.commons.parsers.token.FunctionInputToken;
-import org.eclipse.scout.commons.parsers.token.IToken;
-import org.eclipse.scout.commons.parsers.token.ValueInputToken;
-import org.eclipse.scout.commons.parsers.token.ValueOutputToken;
-import org.eclipse.scout.rt.server.IServerSession;
-import org.eclipse.scout.rt.server.ServerJob;
-import org.eclipse.scout.rt.server.ThreadContext;
-import org.eclipse.scout.rt.server.services.common.jdbc.AbstractSqlTransactionMember;
-import org.eclipse.scout.rt.server.services.common.jdbc.ISelectStreamHandler;
-import org.eclipse.scout.rt.server.services.common.jdbc.ISqlService;
-import org.eclipse.scout.rt.server.services.common.jdbc.IStatementCache;
-import org.eclipse.scout.rt.server.services.common.jdbc.IStatementProcessor;
-import org.eclipse.scout.rt.server.services.common.jdbc.IStatementProcessorMonitor;
-import org.eclipse.scout.rt.server.services.common.jdbc.SqlBind;
-import org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle;
-import org.eclipse.scout.rt.server.transaction.ITransaction;
-import org.eclipse.scout.rt.server.transaction.ITransactionMember;
-
-public class StatementProcessor implements IStatementProcessor {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(StatementProcessor.class);
- private static final Object NULL = new Object();
-
- static {
- if (LOG.isDebugEnabled()) {
- LOG.debug("SQL Log 'DEBUG': statements are logged with bind details and also as plaintext (suitable for direct use in executable form)");
- }
- else if (LOG.isInfoEnabled()) {
- LOG.info("SQL Log 'INFO': statements are logged with bind details, but not as plaintext. Use level 'FINE' to also log SQL as plain text (suitable for direct use in executable form)");
- }
- }
-
- private final ISqlService m_callerService;
- private final String m_originalStm;
- private Object[] m_bindBases;
- private int m_maxRowCount;
- private BindModel m_bindModel;
- private IToken[] m_ioTokens;
- private List<IBindInput> m_inputList;
- private List<IBindOutput> m_outputList;
- // state
- private int m_currentInputBatchIndex = -1;
- private int m_currentOutputBatchIndex = -1;
- private String m_currentInputStm;
- private TreeMap<Integer/* jdbcBindIndex */, SqlBind> m_currentInputBindMap;
-
- public StatementProcessor(ISqlService callerService, String stm, Object[] bindBases) throws ProcessingException {
- this(callerService, stm, bindBases, 0);
- }
-
- public StatementProcessor(ISqlService callerService, String stm, Object[] bindBases, int maxRowCount) throws ProcessingException {
- if (stm == null) {
- throw new ProcessingException("statement is null");
- }
- try {
- m_callerService = callerService;
- m_originalStm = stm;
- m_maxRowCount = maxRowCount;
- // expand bind bases to list
- ArrayList<Object> bases = new ArrayList<Object>();
- if (bindBases != null) {
- for (int i = 0, n = bindBases.length; i < n; i++) {
- bases.add(bindBases[i]);
- }
- }
- // add server session as default
- IServerSession session = ServerJob.getCurrentSession();
- if (session != null) {
- bases.add(session);
- }
- m_bindBases = bases.toArray();
- //
- m_inputList = new ArrayList<IBindInput>();
- m_outputList = new ArrayList<IBindOutput>();
- //
- IntoModel intoModel = new IntoParser(m_originalStm).parse();
- String stmWithoutSelectInto = intoModel.getFilteredStatement();
- //
- m_bindModel = new BindParser(stmWithoutSelectInto).parse();
- m_ioTokens = m_bindModel.getIOTokens();
- //
- int jdbcBindIndex = 1;
- for (IToken t : m_ioTokens) {
- IBindInput in = null;
- IBindOutput out = null;
- if (t.isInput()) {
- in = createInput(t, m_bindBases);
- if (in.isJdbcBind()) {
- in.setJdbcBindIndex(jdbcBindIndex);
- }
- m_inputList.add(in);
- }
- if (t.isOutput()) {
- out = createOutput(t, m_bindBases);
- if (out.isJdbcBind()) {
- out.setJdbcBindIndex(jdbcBindIndex);
- }
- m_outputList.add(out);
- }
- //
- if ((in != null && in.isJdbcBind()) || (out != null && out.isJdbcBind())) {
- jdbcBindIndex++;
- }
- }
- for (IToken t : m_bindModel.getAllTokens()) {
- if (t instanceof DatabaseSpecificToken) {
- processDatabaseSpecificToken((DatabaseSpecificToken) t, callerService.getSqlStyle());
- }
- }
- // add select into out binds
- for (IToken t : intoModel.getOutputTokens()) {
- IBindOutput out = createOutput(t, m_bindBases);
- if (!out.isSelectInto()) {
- throw new ProcessingException("out parameter is not a 'select into': " + out);
- }
- if (out.isJdbcBind()) {
- throw new ProcessingException("out parameter is a jdbc bind: " + out);
- }
- out.setJdbcBindIndex(-1);
- m_outputList.add(out);
- }
- }
- catch (ProcessingException e) {
- e.addContextMessage(createSqlDump(true, false));
- throw e;
- }
- catch (Throwable e) {
- throw new ProcessingException(createSqlDump(true, false), e);
- }
- }
-
- protected TreeMap<Integer, SqlBind> getCurrentInputBindMap() {
- return m_currentInputBindMap;
- }
-
- protected ISqlService getCallerService() {
- return m_callerService;
- }
-
- protected Object[] processResultRow(ResultSet rs) throws SQLException {
- ISqlStyle sqlStyle = m_callerService.getSqlStyle();
- ResultSetMetaData meta = rs.getMetaData();
- int colCount = meta.getColumnCount();
- Object[] row = new Object[colCount];
- for (int i = 0; i < colCount; i++) {
- int type = meta.getColumnType(i + 1);
- row[i] = sqlStyle.readBind(rs, meta, type, i + 1);
- }
- return row;
- }
-
- protected List<Object[]> processResultRows(ResultSet rs, int maxRowCount) throws SQLException, ProcessingException {
- ArrayList<Object[]> rows = new ArrayList<Object[]>();
- while (rs.next()) {
- Object[] row = processResultRow(rs);
- rows.add(row);
- if (maxRowCount > 0 && rows.size() >= maxRowCount) {
- break;
- }
- }
- return rows;
- }
-
- /*
- * (non-Javadoc)
- * @seeorg.eclipse.scout.rt.server.services.common.sql.internal.exec.
- * IStatementProcessor#processSelect(java.sql.Connection,
- * org.eclipse.scout.rt.
- * server.services.common.sql.internal.exec.PreparedStatementCache)
- */
- @Override
- public Object[][] processSelect(Connection conn, IStatementCache cache, IStatementProcessorMonitor monitor) throws ProcessingException {
- PreparedStatement ps = null;
- ResultSet rs = null;
- try {
- ArrayList<Object[]> rows = new ArrayList<Object[]>();
- while (hasNextInputBatch()) {
- nextInputBatch();
- prepareInputStatementAndBinds();
- dump();
- ps = cache.getPreparedStatement(conn, m_currentInputStm);
- bindBatch(ps);
- registerActiveStatement(ps);
- try {
- rs = ps.executeQuery();
- for (Object[] row : processResultRows(rs, m_maxRowCount)) {
- rows.add(row);
- nextOutputBatch();
- consumeSelectIntoRow(row);
- }
- }
- finally {
- unregisterActiveStatement(ps);
- /*
- * The PreparedStatement and the ResultSet of the last input batch are not allowed to be closed
- * yet because the monitor could do some post-fetching of the data.
- * Closing the last PreparedStatement and its ResultSet is done in the outer finally block.
- */
- if (hasNextInputBatch()) {
- releasePreparedStatementAndResultSet(ps, cache, rs);
- }
- }
- }
- finishOutputBatch();
- if (monitor != null) {
- monitor.postFetchData(conn, ps, rs, rows);
- }
- return rows.toArray(new Object[rows.size()][]);
- }
- catch (ProcessingException e) {
- e.addContextMessage(createSqlDump(true, false));
- throw e;
- }
- catch (Throwable e) {
- throw new ProcessingException(createSqlDump(true, false), e);
- }
- finally {
- releasePreparedStatementAndResultSet(ps, cache, rs);
- }
- }
-
- /*
- * (non-Javadoc)
- * @seeorg.eclipse.scout.rt.server.services.common.sql.internal.exec.
- * IStatementProcessor
- * #processSelectInto(java.sql.Connection,org.eclipse.scout.
- * rt.server.services.common.sql.internal.exec.PreparedStatementCache)
- */
- @Override
- public void processSelectInto(Connection conn, IStatementCache cache, IStatementProcessorMonitor monitor) throws ProcessingException {
- PreparedStatement ps = null;
- ResultSet rs = null;
- try {
- int rowCount = 0;
- while (hasNextInputBatch()) {
- nextInputBatch();
- prepareInputStatementAndBinds();
- dump();
- ps = cache.getPreparedStatement(conn, m_currentInputStm);
- bindBatch(ps);
- registerActiveStatement(ps);
- try {
- rs = ps.executeQuery();
- for (Object[] row : processResultRows(rs, m_maxRowCount)) {
- nextOutputBatch();
- consumeSelectIntoRow(row);
- rowCount++;
- }
- }
- finally {
- unregisterActiveStatement(ps);
- /*
- * The PreparedStatement and the ResultSet of the last input batch are not allowed to be closed
- * yet because the monitor could do some post-fetching of the data.
- * Closing the last PreparedStatement and its ResultSet is done in the outer finally block.
- */
- if (hasNextInputBatch()) {
- releasePreparedStatementAndResultSet(ps, cache, rs);
- }
- }
- }
- finishOutputBatch();
- if (monitor != null) {
- monitor.postFetchData(conn, ps, rs, null);
- }
- }
- catch (ProcessingException e) {
- e.addContextMessage(createSqlDump(true, false));
- throw e;
- }
- catch (Throwable e) {
- throw new ProcessingException(createSqlDump(true, false), e);
- }
- finally {
- releasePreparedStatementAndResultSet(ps, cache, rs);
- }
- }
-
- @Override
- public void processSelectStreaming(Connection conn, IStatementCache cache, ISelectStreamHandler handler) throws ProcessingException {
- PreparedStatement ps = null;
- ResultSet rs = null;
- ISqlStyle sqlStyle = m_callerService.getSqlStyle();
- try {
- int rowCount = 0;
- while (hasNextInputBatch()) {
- nextInputBatch();
- prepareInputStatementAndBinds();
- dump();
- ps = cache.getPreparedStatement(conn, m_currentInputStm);
- bindBatch(ps);
- registerActiveStatement(ps);
- try {
- rs = ps.executeQuery();
-
- ResultSetMetaData meta = rs.getMetaData();
- int colCount = meta.getColumnCount();
- while (rs.next()) {
- ArrayList<SqlBind> row = new ArrayList<SqlBind>(colCount);
- for (int i = 0; i < colCount; i++) {
- int type = meta.getColumnType(i + 1);
- Object value = sqlStyle.readBind(rs, meta, type, i + 1);
- row.add(new SqlBind(type, value));
- }
- handler.handleRow(conn, ps, rs, rowCount, row);
- rowCount++;
- if (m_maxRowCount > 0 && rowCount >= m_maxRowCount) {
- break;
- }
- }
- }
- finally {
- unregisterActiveStatement(ps);
- /*
- * The PreparedStatement and the ResultSet of the last input batch are not allowed to be closed
- * yet because the handler could do finishing work.
- * Closing the last PreparedStatement and its ResultSet is done in the outer finally block.
- */
- if (hasNextInputBatch()) {
- releasePreparedStatementAndResultSet(ps, cache, rs);
- }
- }
- }
- finishOutputBatch();
- handler.finished(conn, ps, rs, rowCount);
- }
- catch (ProcessingException e) {
- e.addContextMessage(createSqlDump(true, false));
- throw e;
- }
- catch (Throwable e) {
- throw new ProcessingException(createSqlDump(true, false), e);
- }
- finally {
- releasePreparedStatementAndResultSet(ps, cache, rs);
- }
- }
-
- /*
- * (non-Javadoc)
- * @seeorg.eclipse.scout.rt.server.services.common.sql.internal.exec.
- * IStatementProcessor#processModification(java.sql.Connection,
- * org.eclipse.scout
- * .rt.server.services.common.sql.internal.exec.PreparedStatementCache)
- */
- @Override
- public int processModification(Connection conn, IStatementCache cache, IStatementProcessorMonitor monitor) throws ProcessingException {
- PreparedStatement ps = null;
- int rowCount = 0;
- try {
- while (hasNextInputBatch()) {
- nextInputBatch();
- prepareInputStatementAndBinds();
- dump();
- ps = cache.getPreparedStatement(conn, m_currentInputStm);
- bindBatch(ps);
- registerActiveStatement(ps);
- try {
- rowCount = rowCount + ps.executeUpdate();
- }
- finally {
- unregisterActiveStatement(ps);
- cache.releasePreparedStatement(ps);
- }
- }
- return rowCount;
- }
- catch (ProcessingException e) {
- e.addContextMessage(createSqlDump(true, false));
- throw e;
- }
- catch (Throwable e) {
- throw new ProcessingException(createSqlDump(true, false), e);
- }
- finally {
- cache.releasePreparedStatement(ps);
- }
- }
-
- /*
- * (non-Javadoc)
- * @seeorg.eclipse.scout.rt.server.services.common.sql.internal.exec.
- * IStatementProcessor#processStoredProcedure(java.sql.Connection,
- * org.eclipse.
- * scout.rt.server.services.common.sql.internal.exec.PreparedStatementCache)
- */
- @Override
- public boolean processStoredProcedure(Connection conn, IStatementCache cache, IStatementProcessorMonitor monitor) throws ProcessingException {
- CallableStatement cs = null;
- boolean status = true;
- try {
- while (hasNextInputBatch()) {
- nextInputBatch();
- prepareInputStatementAndBinds();
- dump();
- cs = cache.getCallableStatement(conn, m_currentInputStm);
- bindBatch(cs);
- registerActiveStatement(cs);
- try {
- status = status && cs.execute();
- nextOutputBatch();
- consumeOutputRow(cs);
- }
- finally {
- unregisterActiveStatement(cs);
- cache.releaseCallableStatement(cs);
- }
- }
- finishOutputBatch();
- return status;
- }
- catch (ProcessingException e) {
- e.addContextMessage(createSqlDump(true, false));
- throw e;
- }
- catch (Throwable e) {
- throw new ProcessingException(createSqlDump(true, false), e);
- }
- finally {
- cache.releaseCallableStatement(cs);
- }
- }
-
- /*
- * (non-Javadoc)
- * @seeorg.eclipse.scout.rt.server.services.common.sql.internal.exec.
- * IStatementProcessor#createPlainText()
- */
- @Override
- public String createPlainText() throws ProcessingException {
- for (IToken t : m_ioTokens) {
- if (t instanceof ValueInputToken) {
- ValueInputToken vt = (ValueInputToken) t;
- if (vt.isPlainSql()) {
- // ok
- }
- else if (vt.isPlainValue()) {
- // ok
- }
- else {
- vt.setPlainValue(true);
- }
- }
- else if (t instanceof FunctionInputToken) {
- FunctionInputToken ft = (FunctionInputToken) t;
- ft.setPlainValue(true);
- }
- }
- if (hasNextInputBatch()) {
- nextInputBatch();
- prepareInputStatementAndBinds();
- resetInputBatch();
- }
- return m_currentInputStm;
- }
-
- /*
- * (non-Javadoc)
- * @seeorg.eclipse.scout.rt.server.services.common.sql.internal.exec.
- * IStatementProcessor#simulate()
- */
- @Override
- public void simulate() throws ProcessingException {
- while (hasNextInputBatch()) {
- nextInputBatch();
- prepareInputStatementAndBinds();
- dump();
- }
- }
-
- /**
- * when there are batch inputs, all batch inputs must agree to have another
- * batch when there are no batch inputs, only first batch is valid
- */
- private boolean hasNextInputBatch() {
- int nextIndex = m_currentInputBatchIndex + 1;
- int batchInputCount = 0;
- int batchAcceptCount = 0;
- for (IBindInput input : m_inputList) {
- if (input.isBatch()) {
- batchInputCount++;
- if (input.hasBatch(nextIndex)) {
- batchAcceptCount++;
- }
- }
- }
- if (batchInputCount > 0) {
- return batchInputCount == batchAcceptCount;
- }
- else {
- return nextIndex == 0;
- }
- }
-
- private void resetInputBatch() {
- m_currentInputBatchIndex = -1;
- for (IBindInput in : m_inputList) {
- in.setNextBatchIndex(m_currentInputBatchIndex);
- }
- }
-
- private void nextInputBatch() {
- m_currentInputBatchIndex++;
- for (IBindInput in : m_inputList) {
- in.setNextBatchIndex(m_currentInputBatchIndex);
- }
- }
-
- private void nextOutputBatch() {
- m_currentOutputBatchIndex++;
- for (IBindOutput out : m_outputList) {
- out.setNextBatchIndex(m_currentOutputBatchIndex);
- }
- }
-
- private void consumeSelectIntoRow(Object[] row) throws ProcessingException {
- int index = 0;
- for (IBindOutput out : m_outputList) {
- if (out.isSelectInto()) {
- out.consumeValue(row[index]);
- index++;
- }
- }
- }
-
- private void consumeOutputRow(CallableStatement cs) throws ProcessingException, SQLException {
- for (IBindOutput out : m_outputList) {
- if (out.isJdbcBind()) {
- out.consumeValue(cs.getObject(out.getJdbcBindIndex()));
- }
- }
- }
-
- private void finishOutputBatch() throws ProcessingException {
- for (IBindOutput out : m_outputList) {
- out.finishBatch();
- }
- }
-
- private void prepareInputStatementAndBinds() throws ProcessingException {
- // bind inputs and set replace token on inputs
- m_currentInputBindMap = new TreeMap<Integer, SqlBind>();
- for (IBindInput in : m_inputList) {
- SqlBind bind = in.produceSqlBindAndSetReplaceToken(m_callerService.getSqlStyle());
- assert (bind != null) == in.isJdbcBind();
- if (bind != null) {
- m_currentInputBindMap.put(in.getJdbcBindIndex(), bind);
- }
- }
- // set replace token on outputs
- for (IBindOutput out : m_outputList) {
- out.setReplaceToken(m_callerService.getSqlStyle());
- }
- m_currentInputStm = m_bindModel.getFilteredStatement();
- }
-
- protected String createSqlDump(boolean statementWithBinds, boolean statementPlainText) {
- StringBuffer debugBindBuf = new StringBuffer();
- if (m_currentInputBindMap == null) {
- try {
- prepareInputStatementAndBinds();
- }
- catch (Throwable t) {
- return t.getMessage();
- }
- }
- if (m_currentInputBindMap == null) {
- return "";
- }
- if (m_inputList != null) {
- for (IBindInput in : m_inputList) {
- SqlBind bind = m_currentInputBindMap.get(in.getJdbcBindIndex());
- if (bind == null) {
- continue;
- }
- debugBindBuf.append("IN ");
- debugBindBuf.append(in.getToken().getParsedToken());
- debugBindBuf.append(" => ");
- debugBindBuf.append(in.getToken().getReplaceToken());
- debugBindBuf.append(" [");
- debugBindBuf.append(SqlBind.decodeJdbcType(bind.getSqlType()));
- switch (bind.getSqlType()) {
- case Types.BLOB:
- case Types.CLOB: {
- //nop
- break;
- }
- default: {
- debugBindBuf.append(" ");
- debugBindBuf.append(bind.getValue());
- }
- }
- debugBindBuf.append("]");
- debugBindBuf.append("\n");
- }
- }
- if (m_outputList != null) {
- for (IBindOutput out : m_outputList) {
- debugBindBuf.append("OUT ");
- debugBindBuf.append(out.getToken().getParsedToken());
- debugBindBuf.append(" => ");
- debugBindBuf.append(out.getToken().getReplaceToken());
- debugBindBuf.append(" [");
- debugBindBuf.append(out.getBindType().getSimpleName());
- debugBindBuf.append("]");
- debugBindBuf.append("\n");
- }
- }
- StringBuffer buf = new StringBuffer();
- if (statementWithBinds) {
- buf.append("SQL with binds:\n");
- buf.append(SqlFormatter.wellform(m_originalStm).trim());
- if (debugBindBuf != null && debugBindBuf.length() > 0) {
- buf.append("\n");
- buf.append(debugBindBuf.toString().trim());
- }
- }
- if (statementPlainText) {
- String p = "" + m_currentInputStm;
- ArrayList<SqlBind> bindList = new ArrayList<SqlBind>(m_currentInputBindMap.values());
- int pos = findNextBind(p, 0);
- int bindIndex = 0;
- while (pos >= 0 && bindIndex < bindList.size()) {
- SqlBind bind = bindList.get(bindIndex);
- String replacement;
- switch (bind.getSqlType()) {
- case Types.BLOB: {
- replacement = "__BLOB__";
- break;
- }
- case Types.CLOB: {
- replacement = "__CLOB__";
- break;
- }
- default: {
- replacement = m_callerService.getSqlStyle().toPlainText(bind.getValue());
- }
- }
- if (replacement == null) {
- replacement = "NULL";
- }
- replacement = replacement.replace('?', ' ');
- //next
- p = p.substring(0, pos) + replacement + p.substring(pos + 1);
- pos = findNextBind(p, pos);
- bindIndex++;
- }
- if (buf.length() > 0) {
- buf.append("\n");
- }
- buf.append("SQL PLAIN Log:\n");
- buf.append(SqlFormatter.wellform(p).trim());
- }
- return buf.toString();
- }
-
- private static int findNextBind(String s, int start) {
- if (s == null || start < 0 || start >= s.length()) {
- return -1;
- }
- int candidate = s.indexOf('?', start);
- if (candidate < 0) {
- return -1;
- }
- P_TextSectionFinder red = new P_TextSectionFinder(s);
- while (red.find()) {
- if (candidate < red.start()) {
- //outside red section
- return candidate;
- }
- if (candidate >= red.start() && candidate < red.end()) {
- //inside red section, find next candidate outside red section
- candidate = s.indexOf('?', red.end());
- if (candidate < 0) {
- return -1;
- }
- //got next candidate after red section
- }
- //continue with next red section
- }
- return candidate;
- }
-
- /**
- * Replacement for:
- * <p>
- * <code>
- * Pattern TEXT_SECTION_PATTERN = Pattern.compile("'([^']|'')*'", Pattern.DOTALL);
- * Matcher red = TEXT_SECTION_PATTERN.matcher(s);
- * </code>
- * <p>
- * which is broken due to <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6337993">Sun bug 6337993</a>
- * when matching large (> ~1000 characters) texts.
- */
- private static class P_TextSectionFinder {
-
- private final String m_string;
- private P_TextSection m_currentTextSection = null;
-
- public P_TextSectionFinder(String s) {
- m_string = s;
- }
-
- public boolean find() {
- int start = 0;
- if (m_currentTextSection != null) {
- start = m_currentTextSection.to + 1;
- }
- m_currentTextSection = findNextTextSection(m_string, start);
- return (m_currentTextSection != null);
- }
-
- public int start() {
- return (m_currentTextSection == null ? -1 : m_currentTextSection.from);
- }
-
- public int end() {
- return (m_currentTextSection == null ? -1 : m_currentTextSection.to);
- }
-
- private static P_TextSection findNextTextSection(String s, int start) {
- if (s == null || start < 0 || start >= s.length()) {
- return null;
- }
- int secStart = -1;
- int pos = start;
- while (pos < s.length()) {
- char c = s.charAt(pos);
- if (c == '\'') {
- if (secStart < 0) {
- // Outside section -> start a new one
- secStart = pos;
- }
- else {
- // Inside section
- if (pos == s.length() - 1 || s.charAt(pos + 1) != '\'') {
- // Last position or next position is not a ' -> we found a section
- return new P_TextSection(secStart, pos + 1);
- }
- // Skip double '
- pos++;
- }
- }
- pos++;
- }
- return null;
- }
-
- private static class P_TextSection {
- public int from;
- public int to;
-
- public P_TextSection(int from, int to) {
- this.from = from;
- this.to = to;
- }
- }
- }
-
- protected void dump() {
- if (LOG.isDebugEnabled()) {
- LOG.debug("\n" + createSqlDump(true, true));
- }
- else if (LOG.isInfoEnabled()) {
- LOG.info("\n" + createSqlDump(true, false));
- }
- }
-
- private void bindBatch(PreparedStatement ps) throws ProcessingException {
- try {
- // bind inputs
- if (ps instanceof PreparedStatement) {
- writeBinds(ps);
- }
- // register outputs
- if (ps instanceof CallableStatement) {
- registerOutputs((CallableStatement) ps);
- }
- }
- catch (Throwable e) {
- throw new ProcessingException("unexpected exception", e);
- }
- }
-
- protected void writeBinds(PreparedStatement ps) throws SQLException {
- ISqlStyle sqlStyle = m_callerService.getSqlStyle();
- for (Map.Entry<Integer, SqlBind> e : m_currentInputBindMap.entrySet()) {
- sqlStyle.writeBind(ps, e.getKey(), e.getValue());
- }
- }
-
- protected void registerOutputs(CallableStatement cs) throws SQLException {
- ISqlStyle sqlStyle = m_callerService.getSqlStyle();
- for (IBindOutput out : m_outputList) {
- if (out.isJdbcBind()) {
- sqlStyle.registerOutput(cs, out.getJdbcBindIndex(), out.getBindType());
- }
- }
- }
-
- private IBindInput createInput(IToken bindToken, Object[] bindBases) throws ProcessingException {
- IBindInput o = null;
- if (bindToken instanceof ValueInputToken) {
- ValueInputToken valueInputToken = (ValueInputToken) bindToken;
- String[] path = valueInputToken.getName().split("[.]");
- for (int i = 0; i < bindBases.length; i++) {
- Object bindBase = bindBases[i];
- Class nullType = null;
- if (bindBase instanceof NVPair) {
- nullType = ((NVPair) bindBase).getNullType();
- }
- o = createInputRec(valueInputToken, path, bindBases[i], nullType);
- if (o != null) {
- break;
- }
- }
- if (o == null) {
- throw new ProcessingException("Cannot find input for '" + valueInputToken + "' in bind bases.");
- }
- }
- else if (bindToken instanceof FunctionInputToken) {
- o = new FunctionInput(m_callerService, m_bindBases, (FunctionInputToken) bindToken);
- }
- return o;
- }
-
- private IBindInput createInputRec(ValueInputToken bindToken, String[] path, Object bindBase, Class nullType) throws ProcessingException {
- boolean terminal = (path.length == 1);
- Object o = null;
- boolean found = false;
- if (bindBase instanceof Map) {
- // handle all terminal cases for map
- o = ((Map) bindBase).get(path[0]);
- if (o != null) {
- found = true;
- }
- else if (((Map) bindBase).containsKey(path[0])) {
- found = true;
- }
- if (found) {
- // special case: table holder and table filter are preemptive terminals
- if (o instanceof ITableHolder) {
- return new TableHolderInput((ITableHolder) o, null, path[1], bindToken);
- }
- else if (o instanceof TableHolderFilter) {
- return new TableHolderInput(((TableHolderFilter) o).getTableHolder(), ((TableHolderFilter) o).getFilteredRows(), path[1], bindToken);
- }
- else if (o instanceof IBeanArrayHolder) {
- return new BeanArrayHolderInput((IBeanArrayHolder) o, null, path[1], bindToken);
- }
- else if (o instanceof BeanArrayHolderFilter) {
- return new BeanArrayHolderInput(((BeanArrayHolderFilter) o).getBeanArrayHolder(), ((BeanArrayHolderFilter) o).getFilteredBeans(), path[1], bindToken);
- }
- else {
- if (terminal) {
- return createInputTerminal(o, nullType, bindToken);
- }
- else {
- if (o == null) {
- throw new ProcessingException("input bind " + bindToken + " resolves to null on path element: " + path[0]);
- }
- }
- }
- }
- }
- else if (bindBase instanceof NVPair) {
- // handle all terminal cases for nvpair
- if (((NVPair) bindBase).getName().equals(path[0])) {
- o = ((NVPair) bindBase).getValue();
- found = true;
- // special case: table holder and table filter are preemptive terminals
- if (o instanceof ITableHolder) {
- return new TableHolderInput((ITableHolder) o, null, path[1], bindToken);
- }
- else if (o instanceof TableHolderFilter) {
- return new TableHolderInput(((TableHolderFilter) o).getTableHolder(), ((TableHolderFilter) o).getFilteredRows(), path[1], bindToken);
- }
- else if (o instanceof IBeanArrayHolder) {
- return new BeanArrayHolderInput((IBeanArrayHolder) o, null, path[1], bindToken);
- }
- else if (o instanceof BeanArrayHolderFilter) {
- return new BeanArrayHolderInput(((BeanArrayHolderFilter) o).getBeanArrayHolder(), ((BeanArrayHolderFilter) o).getFilteredBeans(), path[1], bindToken);
- }
- else {
- if (terminal) {
- return createInputTerminal(o, nullType, bindToken);
- }
- else {
- if (o == null) {
- throw new ProcessingException("input bind " + bindToken + " resolves to null on path element: " + path[0]);
- }
- }
- }
- }
- }
- else if (bindBase instanceof ITableHolder) {
- // handle all terminal cases for table holder
- ITableHolder table = (ITableHolder) bindBase;
- try {
- Method m = table.getClass().getMethod("get" + Character.toUpperCase(path[0].charAt(0)) + path[0].substring(1), new Class[]{int.class});
- if (m != null) {
- found = true;
- return new TableHolderInput(table, null, path[0], bindToken);
- }
- }
- catch (Throwable t) {
- found = false;
- // nop
- }
- }
- else if (bindBase instanceof TableHolderFilter) {
- // handle all terminal cases for table holder filter
- TableHolderFilter filter = (TableHolderFilter) bindBase;
- ITableHolder table = filter.getTableHolder();
- try {
- Method m = table.getClass().getMethod("get" + Character.toUpperCase(path[0].charAt(0)) + path[0].substring(1), new Class[]{int.class});
- if (m != null) {
- found = true;
- return new TableHolderInput(table, filter.getFilteredRows(), path[0], bindToken);
- }
- }
- catch (Throwable t) {
- // nop
- found = false;
- }
- }
- else if (bindBase instanceof IBeanArrayHolder) {
- // handle all terminal cases for BeanArrayHolder
- IBeanArrayHolder<?> holder = (IBeanArrayHolder) bindBase;
- try {
- Method m = holder.getHolderType().getMethod("get" + Character.toUpperCase(path[0].charAt(0)) + path[0].substring(1));
- if (m != null) {
- found = true;
- return new BeanArrayHolderInput(holder, null, path[0], bindToken);
- }
- }
- catch (Throwable t1) {
- try {
- Method m = holder.getHolderType().getMethod("is" + Character.toUpperCase(path[0].charAt(0)) + path[0].substring(1));
- if (m != null) {
- found = true;
- return new BeanArrayHolderInput(holder, null, path[0], bindToken);
- }
- }
- catch (Throwable t2) {
- found = false;
- // nop
- }
- }
- }
- else if (bindBase instanceof BeanArrayHolderFilter) {
- // handle all terminal cases for table holder filter
- BeanArrayHolderFilter filter = (BeanArrayHolderFilter) bindBase;
- IBeanArrayHolder<?> holder = filter.getBeanArrayHolder();
- try {
- Method m = holder.getHolderType().getMethod("get" + Character.toUpperCase(path[0].charAt(0)) + path[0].substring(1));
- if (m != null) {
- found = true;
- return new BeanArrayHolderInput(holder, filter.getFilteredBeans(), path[0], bindToken);
- }
- }
- catch (Throwable t1) {
- try {
- Method m = holder.getHolderType().getMethod("is" + Character.toUpperCase(path[0].charAt(0)) + path[0].substring(1));
- if (m != null) {
- found = true;
- return new BeanArrayHolderInput(holder, null, path[0], bindToken);
- }
- }
- catch (Throwable t2) {
- found = false;
- // nop
- }
- }
- }
- else if (bindBase != null) {
- if (bindBase.getClass().isArray() && terminal) {
- return new BeanPropertyInput(path[0], (Object[]) bindBase, bindToken);
- }
- if (bindBase instanceof Collection && terminal) {
- return new BeanPropertyInput(path[0], ((Collection) bindBase).toArray(), bindToken);
- }
- /* bean propertry */
- try {
- Object propertyBean = bindBase;
- FastPropertyDescriptor pd = BeanUtility.getFastBeanInfo(propertyBean.getClass(), null).getPropertyDescriptor(path[0]);
- Method getter = pd != null ? pd.getReadMethod() : null;
- if (getter != null) {
- // getter exists
- o = getter.invoke(propertyBean);
- found = true;
- if (terminal) {
- return createInputTerminal(o, getter.getReturnType(), bindToken);
- }
- else {
- if (o == null) {
- throw new ProcessingException("input bind " + bindToken + " resolves to null on path element: " + path[0]);
- }
- }
- }
- }
- catch (Exception e) {
- // obviously there is no such property
- }
- }
- //
- if (found) {
- if (terminal) {
- throw new ProcessingException("input bind '" + bindToken.getName() + "' was not recognized as a terminal");
- }
- // continue
- String[] newPath = new String[path.length - 1];
- System.arraycopy(path, 1, newPath, 0, newPath.length);
- IBindInput input = null;
- if (o instanceof IHolder<?>) {
- /* dereference value if current object is an IHolder. If input cannot be resolved (i.e. ProcessingException occurs),
- * search given property names on holder. Hence both of the following forms are supported on holder types:
- * :holder.property
- * :holder.value.property
- */
- try {
- input = createInputRec(bindToken, newPath, ((IHolder) o).getValue(), nullType);
- }
- catch (ProcessingException pe) {
- // nop, see below
- }
- }
- if (input == null) {
- // strict search without dereferncing holder objects
- input = createInputRec(bindToken, newPath, o, nullType);
- }
- return input;
- }
- else {
- return null;
- }
- }
-
- private IBindOutput createOutput(IToken bindToken, Object[] bindBases) throws ProcessingException {
- IBindOutput o = null;
- if (bindToken instanceof ValueOutputToken) {
- ValueOutputToken valueOutputToken = (ValueOutputToken) bindToken;
- String[] path = valueOutputToken.getName().split("[.]");
- for (int i = 0; i < bindBases.length; i++) {
- o = createOutputRec(valueOutputToken, path, bindBases[i]);
- if (o != null) {
- break;
- }
- }
- if (o == null) {
- throw new ProcessingException("Cannot find output for '" + valueOutputToken + "' in bind base. When selecting into shared context variables make sure these variables are initialized using CONTEXT.set<i>PropertyName</i>(null)");
- }
- }
- else {
- throw new ProcessingException("Cannot find output for '" + bindToken.getClass());
- }
- return o;
- }
-
- @SuppressWarnings("unchecked")
- private IBindOutput createOutputRec(ValueOutputToken bindToken, String[] path, final Object bindBase) throws ProcessingException {
- boolean terminal = (path.length == 1);
- Object o = null;
- boolean found = false;
- if (bindBase instanceof Map) {
- // handle all terminal cases for map
- o = ((Map) bindBase).get(path[0]);
- if (o != null) {
- found = true;
- }
- else if (((Map) bindBase).containsKey(path[0])) {
- found = true;
- }
- if (found) {
- // special case: table holder is preemptive terminal
- if (o instanceof ITableHolder) {
- ITableHolder table = (ITableHolder) o;
- return new TableHolderOutput(table, path[1], bindToken);
- }
- else if (o instanceof IBeanArrayHolder) {
- IBeanArrayHolder holder = (IBeanArrayHolder) o;
- return new BeanArrayHolderOutput(holder, path[1], bindToken);
- }
- else if (o instanceof IHolder) {
- if (terminal) {
- return createOutputTerminal((IHolder) o, bindToken);
- }
- else {
- o = ((IHolder) o).getValue();
- }
- }
- else if (o == null) {
- if (terminal) {
- return new MapOutput((Map) bindBase, path[0], bindToken);
- }
- else {
- throw new ProcessingException("output bind " + bindToken + " resolves to null on path element: " + path[0]);
- }
- }
- else {
- if (terminal) {
- return new MapOutput((Map) bindBase, path[0], bindToken);
- }
- }
- }
- }
- else if (bindBase instanceof NVPair) {
- // handle all terminal cases for nvpair
- if (((NVPair) bindBase).getName().equals(path[0])) {
- o = ((NVPair) bindBase).getValue();
- found = true;
- // special case: table holder is preemptive terminal
- if (o instanceof ITableHolder) {
- ITableHolder table = (ITableHolder) o;
- return new TableHolderOutput(table, path[1], bindToken);
- }
- else if (o instanceof IBeanArrayHolder) {
- IBeanArrayHolder holder = (IBeanArrayHolder) o;
- return new BeanArrayHolderOutput(holder, path[1], bindToken);
- }
- else if (o instanceof IHolder) {
- if (terminal) {
- return createOutputTerminal((IHolder) o, bindToken);
- }
- else {
- o = ((IHolder) o).getValue();
- }
- }
- else if (o == null) {
- throw new ProcessingException("output bind " + bindToken + " resolves to null on path element: " + path[0]);
- }
- else {
- if (terminal) {
- throw new ProcessingException("output bind " + bindToken + " is not a valid output container");
- }
- }
- }
- }
- else if (bindBase instanceof ITableHolder) {
- // handle all terminal cases for table holder
- ITableHolder table = (ITableHolder) bindBase;
- try {
- Method m = table.getClass().getMethod("get" + Character.toUpperCase(path[0].charAt(0)) + path[0].substring(1), new Class[]{int.class});
- if (m != null) {
- found = true;
- return new TableHolderOutput(table, path[0], bindToken);
- }
- }
- catch (Throwable t) {
- // nop
- found = false;
- }
- }
- else if (bindBase instanceof IBeanArrayHolder) {
- // handle all terminal cases for BeanArrayHolder
- IBeanArrayHolder holder = (IBeanArrayHolder) bindBase;
- try {
- Method m = holder.getHolderType().getMethod("get" + Character.toUpperCase(path[0].charAt(0)) + path[0].substring(1));
- if (m != null) {
- found = true;
- return new BeanArrayHolderOutput(holder, path[0], bindToken);
- }
- }
- catch (Throwable t1) {
- try {
- Method m = holder.getHolderType().getMethod("is" + Character.toUpperCase(path[0].charAt(0)) + path[0].substring(1));
- if (m != null) {
- found = true;
- return new BeanArrayHolderOutput(holder, path[0], bindToken);
- }
- }
- catch (Throwable t2) {
- found = false;
- // nop
- }
- }
- }
- else/* bean property */{
- // handle all terminal cases for bean property
- try {
- FastPropertyDescriptor pd = BeanUtility.getFastBeanInfo(bindBase.getClass(), null).getPropertyDescriptor(path[0]);
- if (terminal) {
- Method setter = pd != null ? pd.getWriteMethod() : null;
- if (setter != null) {
- found = true;
- return new AbstractBeanPropertyOutput(bindBase.getClass(), path[0], bindToken) {
- @Override
- protected Object[] getFinalBeanArray() {
- return new Object[]{bindBase};
- }
- };
- }
- else {
- Method getter = pd != null ? pd.getReadMethod() : null;
- if (getter != null) {
- o = getter.invoke(bindBase, (Object[]) null);
- if (o instanceof ITableHolder) {
- throw new ProcessingException("output bind '" + bindToken.getName() + "' is a table and should not be a terminal");
- }
- else if (o instanceof IBeanArrayHolder) {
- throw new ProcessingException("output bind '" + bindToken.getName() + "' is a bean array and should not be a terminal");
- }
- else if (o instanceof IHolder) {
- return createOutputTerminal((IHolder) o, bindToken);
- }
- else {
- throw new ProcessingException("output bind '" + bindToken.getName() + "' is not a holder");
- }
- }
- }
- }
- else {
- Method getter = pd != null ? pd.getReadMethod() : null;
- if (getter != null) {
- Object readValue = getter.invoke(bindBase, (Object[]) null);
- o = readValue;
- found = true;
- }
- }
- }
- catch (Exception e) {
- // obviously there is no such property
- }
- }
- //
- if (found) {
- if (terminal) {
- throw new ProcessingException("output bind '" + bindToken.getName() + "' was not recognized as a terminal");
- }
- // continue
- String[] newPath = new String[path.length - 1];
- System.arraycopy(path, 1, newPath, 0, newPath.length);
- return createOutputRec(bindToken, newPath, o);
- }
- else {
- return null;
- }
- }
-
- private IBindOutput createOutputTerminal(IHolder h, ValueOutputToken bindToken) {
- Class cls = h.getHolderType();
- if (cls.isArray()) {
- // byte[] and char[] are no "arrays"
- if (cls == byte[].class || cls == char[].class) {
- return new SingleHolderOutput(h, bindToken);
- }
- else {
- return new ArrayHolderOutput(h, bindToken);
- }
- }
- else {
- return new SingleHolderOutput(h, bindToken);
- }
- }
-
- private IBindInput createInputTerminal(Object o, Class nullType, ValueInputToken bindToken) throws ProcessingException {
- if (o == null) {
- return new SingleInput(null, nullType, bindToken);
- }
- else if (o instanceof IHolder) {
- Class cls = ((IHolder) o).getHolderType();
- if (nullType == null) {
- nullType = cls;
- }
- if (cls.isArray()) {
- // byte[] and char[] are no "arrays"
- if (cls == byte[].class || cls == char[].class) {
- return new SingleInput(((IHolder) o).getValue(), nullType, bindToken);
- }
- else {
- return new ArrayInput(((IHolder) o).getValue(), bindToken);
- }
- }
- else if (cls == TriState.class) {
- return new TriStateInput((TriState) ((IHolder) o).getValue(), bindToken);
- }
- else {
- return new SingleInput(((IHolder) o).getValue(), nullType, bindToken);
- }
- }
- else {
- if (o instanceof Collection) {
- return new ArrayInput(((Collection) o).toArray(), bindToken);
- }
- else if (o.getClass().isArray()) {
- Class cls = o.getClass();
- // byte[] and char[] are no "arrays"
- if (cls == byte[].class || cls == char[].class) {
- return new SingleInput(o, nullType, bindToken);
- }
- else {
- return new ArrayInput(o, bindToken);
- }
- }
- else if (o.getClass() == TriState.class) {
- return new TriStateInput((TriState) o, bindToken);
- }
- else {
- return new SingleInput(o, nullType, bindToken);
- }
- }
- }
-
- protected void processDatabaseSpecificToken(DatabaseSpecificToken t, ISqlStyle sqlStyle) {
- String name = t.getName().toLowerCase();
- if (name.equals("sysdate")) {
- t.setReplaceToken(sqlStyle.getSysdateToken());
- }
- else if (name.equals("upper")) {
- t.setReplaceToken(sqlStyle.getUpperToken());
- }
- else if (name.equals("lower")) {
- t.setReplaceToken(sqlStyle.getLowerToken());
- }
- else if (name.equals("trim")) {
- t.setReplaceToken(sqlStyle.getTrimToken());
- }
- else if (name.equals("nvl")) {
- t.setReplaceToken(sqlStyle.getNvlToken());
- }
- else {
- LOG.warn("used unknown database specific token " + t.getParsedToken());
- t.setReplaceToken(name);
- }
- }
-
- protected void registerActiveStatement(Statement s) throws SQLException {
- ITransaction tx = ThreadContext.getTransaction();
- if (tx == null) {
- return;
- }
- ITransactionMember member = tx.getMember(getCallerService().getTransactionMemberId());
- if (member instanceof AbstractSqlTransactionMember) {
- ((AbstractSqlTransactionMember) member).registerActiveStatement(s);
- }
- }
-
- protected void unregisterActiveStatement(Statement s) throws SQLException {
- ITransaction tx = ThreadContext.getTransaction();
- if (tx == null) {
- return;
- }
- ITransactionMember member = tx.getMember(getCallerService().getTransactionMemberId());
- if (member instanceof AbstractSqlTransactionMember) {
- ((AbstractSqlTransactionMember) member).unregisterActiveStatement(s);
- }
- }
-
- private void releasePreparedStatementAndResultSet(PreparedStatement ps, IStatementCache cache, ResultSet rs) {
- if (rs != null) {
- try {
- rs.close();
- }
- catch (Throwable t) {
- }
- }
- cache.releasePreparedStatement(ps);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010,2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc.internal.exec;
+
+import java.lang.reflect.Method;
+import java.sql.CallableStatement;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.sql.Types;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.eclipse.scout.commons.BeanUtility;
+import org.eclipse.scout.commons.TriState;
+import org.eclipse.scout.commons.beans.FastPropertyDescriptor;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.holders.BeanArrayHolderFilter;
+import org.eclipse.scout.commons.holders.IBeanArrayHolder;
+import org.eclipse.scout.commons.holders.IHolder;
+import org.eclipse.scout.commons.holders.ITableHolder;
+import org.eclipse.scout.commons.holders.NVPair;
+import org.eclipse.scout.commons.holders.TableHolderFilter;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.commons.parsers.BindModel;
+import org.eclipse.scout.commons.parsers.BindParser;
+import org.eclipse.scout.commons.parsers.IntoModel;
+import org.eclipse.scout.commons.parsers.IntoParser;
+import org.eclipse.scout.commons.parsers.sql.SqlFormatter;
+import org.eclipse.scout.commons.parsers.token.DatabaseSpecificToken;
+import org.eclipse.scout.commons.parsers.token.FunctionInputToken;
+import org.eclipse.scout.commons.parsers.token.IToken;
+import org.eclipse.scout.commons.parsers.token.ValueInputToken;
+import org.eclipse.scout.commons.parsers.token.ValueOutputToken;
+import org.eclipse.scout.rt.server.IServerSession;
+import org.eclipse.scout.rt.server.ServerJob;
+import org.eclipse.scout.rt.server.ThreadContext;
+import org.eclipse.scout.rt.server.services.common.jdbc.AbstractSqlTransactionMember;
+import org.eclipse.scout.rt.server.services.common.jdbc.ISelectStreamHandler;
+import org.eclipse.scout.rt.server.services.common.jdbc.ISqlService;
+import org.eclipse.scout.rt.server.services.common.jdbc.IStatementCache;
+import org.eclipse.scout.rt.server.services.common.jdbc.IStatementProcessor;
+import org.eclipse.scout.rt.server.services.common.jdbc.IStatementProcessorMonitor;
+import org.eclipse.scout.rt.server.services.common.jdbc.SqlBind;
+import org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle;
+import org.eclipse.scout.rt.server.transaction.ITransaction;
+import org.eclipse.scout.rt.server.transaction.ITransactionMember;
+
+public class StatementProcessor implements IStatementProcessor {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(StatementProcessor.class);
+ private static final Object NULL = new Object();
+
+ static {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("SQL Log 'DEBUG': statements are logged with bind details and also as plaintext (suitable for direct use in executable form)");
+ }
+ else if (LOG.isInfoEnabled()) {
+ LOG.info("SQL Log 'INFO': statements are logged with bind details, but not as plaintext. Use level 'FINE' to also log SQL as plain text (suitable for direct use in executable form)");
+ }
+ }
+
+ private final ISqlService m_callerService;
+ private final String m_originalStm;
+ private Object[] m_bindBases;
+ private int m_maxRowCount;
+ private BindModel m_bindModel;
+ private IToken[] m_ioTokens;
+ private List<IBindInput> m_inputList;
+ private List<IBindOutput> m_outputList;
+ // state
+ private int m_currentInputBatchIndex = -1;
+ private int m_currentOutputBatchIndex = -1;
+ private String m_currentInputStm;
+ private TreeMap<Integer/* jdbcBindIndex */, SqlBind> m_currentInputBindMap;
+
+ public StatementProcessor(ISqlService callerService, String stm, Object[] bindBases) throws ProcessingException {
+ this(callerService, stm, bindBases, 0);
+ }
+
+ public StatementProcessor(ISqlService callerService, String stm, Object[] bindBases, int maxRowCount) throws ProcessingException {
+ if (stm == null) {
+ throw new ProcessingException("statement is null");
+ }
+ try {
+ m_callerService = callerService;
+ m_originalStm = stm;
+ m_maxRowCount = maxRowCount;
+ // expand bind bases to list
+ ArrayList<Object> bases = new ArrayList<Object>();
+ if (bindBases != null) {
+ for (int i = 0, n = bindBases.length; i < n; i++) {
+ bases.add(bindBases[i]);
+ }
+ }
+ // add server session as default
+ IServerSession session = ServerJob.getCurrentSession();
+ if (session != null) {
+ bases.add(session);
+ }
+ m_bindBases = bases.toArray();
+ //
+ m_inputList = new ArrayList<IBindInput>();
+ m_outputList = new ArrayList<IBindOutput>();
+ //
+ IntoModel intoModel = new IntoParser(m_originalStm).parse();
+ String stmWithoutSelectInto = intoModel.getFilteredStatement();
+ //
+ m_bindModel = new BindParser(stmWithoutSelectInto).parse();
+ m_ioTokens = m_bindModel.getIOTokens();
+ //
+ int jdbcBindIndex = 1;
+ for (IToken t : m_ioTokens) {
+ IBindInput in = null;
+ IBindOutput out = null;
+ if (t.isInput()) {
+ in = createInput(t, m_bindBases);
+ if (in.isJdbcBind()) {
+ in.setJdbcBindIndex(jdbcBindIndex);
+ }
+ m_inputList.add(in);
+ }
+ if (t.isOutput()) {
+ out = createOutput(t, m_bindBases);
+ if (out.isJdbcBind()) {
+ out.setJdbcBindIndex(jdbcBindIndex);
+ }
+ m_outputList.add(out);
+ }
+ //
+ if ((in != null && in.isJdbcBind()) || (out != null && out.isJdbcBind())) {
+ jdbcBindIndex++;
+ }
+ }
+ for (IToken t : m_bindModel.getAllTokens()) {
+ if (t instanceof DatabaseSpecificToken) {
+ processDatabaseSpecificToken((DatabaseSpecificToken) t, callerService.getSqlStyle());
+ }
+ }
+ // add select into out binds
+ for (IToken t : intoModel.getOutputTokens()) {
+ IBindOutput out = createOutput(t, m_bindBases);
+ if (!out.isSelectInto()) {
+ throw new ProcessingException("out parameter is not a 'select into': " + out);
+ }
+ if (out.isJdbcBind()) {
+ throw new ProcessingException("out parameter is a jdbc bind: " + out);
+ }
+ out.setJdbcBindIndex(-1);
+ m_outputList.add(out);
+ }
+ }
+ catch (ProcessingException e) {
+ e.addContextMessage(createSqlDump(true, false));
+ throw e;
+ }
+ catch (Throwable e) {
+ throw new ProcessingException(createSqlDump(true, false), e);
+ }
+ }
+
+ protected TreeMap<Integer, SqlBind> getCurrentInputBindMap() {
+ return m_currentInputBindMap;
+ }
+
+ protected ISqlService getCallerService() {
+ return m_callerService;
+ }
+
+ protected Object[] processResultRow(ResultSet rs) throws SQLException {
+ ISqlStyle sqlStyle = m_callerService.getSqlStyle();
+ ResultSetMetaData meta = rs.getMetaData();
+ int colCount = meta.getColumnCount();
+ Object[] row = new Object[colCount];
+ for (int i = 0; i < colCount; i++) {
+ int type = meta.getColumnType(i + 1);
+ row[i] = sqlStyle.readBind(rs, meta, type, i + 1);
+ }
+ return row;
+ }
+
+ protected List<Object[]> processResultRows(ResultSet rs, int maxRowCount) throws SQLException, ProcessingException {
+ ArrayList<Object[]> rows = new ArrayList<Object[]>();
+ while (rs.next()) {
+ Object[] row = processResultRow(rs);
+ rows.add(row);
+ if (maxRowCount > 0 && rows.size() >= maxRowCount) {
+ break;
+ }
+ }
+ return rows;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @seeorg.eclipse.scout.rt.server.services.common.sql.internal.exec.
+ * IStatementProcessor#processSelect(java.sql.Connection,
+ * org.eclipse.scout.rt.
+ * server.services.common.sql.internal.exec.PreparedStatementCache)
+ */
+ @Override
+ public Object[][] processSelect(Connection conn, IStatementCache cache, IStatementProcessorMonitor monitor) throws ProcessingException {
+ PreparedStatement ps = null;
+ ResultSet rs = null;
+ try {
+ ArrayList<Object[]> rows = new ArrayList<Object[]>();
+ while (hasNextInputBatch()) {
+ nextInputBatch();
+ prepareInputStatementAndBinds();
+ dump();
+ ps = cache.getPreparedStatement(conn, m_currentInputStm);
+ bindBatch(ps);
+ registerActiveStatement(ps);
+ try {
+ rs = ps.executeQuery();
+ for (Object[] row : processResultRows(rs, m_maxRowCount)) {
+ rows.add(row);
+ nextOutputBatch();
+ consumeSelectIntoRow(row);
+ }
+ }
+ finally {
+ unregisterActiveStatement(ps);
+ /*
+ * The PreparedStatement and the ResultSet of the last input batch are not allowed to be closed
+ * yet because the monitor could do some post-fetching of the data.
+ * Closing the last PreparedStatement and its ResultSet is done in the outer finally block.
+ */
+ if (hasNextInputBatch()) {
+ releasePreparedStatementAndResultSet(ps, cache, rs);
+ }
+ }
+ }
+ finishOutputBatch();
+ if (monitor != null) {
+ monitor.postFetchData(conn, ps, rs, rows);
+ }
+ return rows.toArray(new Object[rows.size()][]);
+ }
+ catch (ProcessingException e) {
+ e.addContextMessage(createSqlDump(true, false));
+ throw e;
+ }
+ catch (Throwable e) {
+ throw new ProcessingException(createSqlDump(true, false), e);
+ }
+ finally {
+ releasePreparedStatementAndResultSet(ps, cache, rs);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @seeorg.eclipse.scout.rt.server.services.common.sql.internal.exec.
+ * IStatementProcessor
+ * #processSelectInto(java.sql.Connection,org.eclipse.scout.
+ * rt.server.services.common.sql.internal.exec.PreparedStatementCache)
+ */
+ @Override
+ public void processSelectInto(Connection conn, IStatementCache cache, IStatementProcessorMonitor monitor) throws ProcessingException {
+ PreparedStatement ps = null;
+ ResultSet rs = null;
+ try {
+ int rowCount = 0;
+ while (hasNextInputBatch()) {
+ nextInputBatch();
+ prepareInputStatementAndBinds();
+ dump();
+ ps = cache.getPreparedStatement(conn, m_currentInputStm);
+ bindBatch(ps);
+ registerActiveStatement(ps);
+ try {
+ rs = ps.executeQuery();
+ for (Object[] row : processResultRows(rs, m_maxRowCount)) {
+ nextOutputBatch();
+ consumeSelectIntoRow(row);
+ rowCount++;
+ }
+ }
+ finally {
+ unregisterActiveStatement(ps);
+ /*
+ * The PreparedStatement and the ResultSet of the last input batch are not allowed to be closed
+ * yet because the monitor could do some post-fetching of the data.
+ * Closing the last PreparedStatement and its ResultSet is done in the outer finally block.
+ */
+ if (hasNextInputBatch()) {
+ releasePreparedStatementAndResultSet(ps, cache, rs);
+ }
+ }
+ }
+ finishOutputBatch();
+ if (monitor != null) {
+ monitor.postFetchData(conn, ps, rs, null);
+ }
+ }
+ catch (ProcessingException e) {
+ e.addContextMessage(createSqlDump(true, false));
+ throw e;
+ }
+ catch (Throwable e) {
+ throw new ProcessingException(createSqlDump(true, false), e);
+ }
+ finally {
+ releasePreparedStatementAndResultSet(ps, cache, rs);
+ }
+ }
+
+ @Override
+ public void processSelectStreaming(Connection conn, IStatementCache cache, ISelectStreamHandler handler) throws ProcessingException {
+ PreparedStatement ps = null;
+ ResultSet rs = null;
+ ISqlStyle sqlStyle = m_callerService.getSqlStyle();
+ try {
+ int rowCount = 0;
+ while (hasNextInputBatch()) {
+ nextInputBatch();
+ prepareInputStatementAndBinds();
+ dump();
+ ps = cache.getPreparedStatement(conn, m_currentInputStm);
+ bindBatch(ps);
+ registerActiveStatement(ps);
+ try {
+ rs = ps.executeQuery();
+
+ ResultSetMetaData meta = rs.getMetaData();
+ int colCount = meta.getColumnCount();
+ while (rs.next()) {
+ ArrayList<SqlBind> row = new ArrayList<SqlBind>(colCount);
+ for (int i = 0; i < colCount; i++) {
+ int type = meta.getColumnType(i + 1);
+ Object value = sqlStyle.readBind(rs, meta, type, i + 1);
+ row.add(new SqlBind(type, value));
+ }
+ handler.handleRow(conn, ps, rs, rowCount, row);
+ rowCount++;
+ if (m_maxRowCount > 0 && rowCount >= m_maxRowCount) {
+ break;
+ }
+ }
+ }
+ finally {
+ unregisterActiveStatement(ps);
+ /*
+ * The PreparedStatement and the ResultSet of the last input batch are not allowed to be closed
+ * yet because the handler could do finishing work.
+ * Closing the last PreparedStatement and its ResultSet is done in the outer finally block.
+ */
+ if (hasNextInputBatch()) {
+ releasePreparedStatementAndResultSet(ps, cache, rs);
+ }
+ }
+ }
+ finishOutputBatch();
+ handler.finished(conn, ps, rs, rowCount);
+ }
+ catch (ProcessingException e) {
+ e.addContextMessage(createSqlDump(true, false));
+ throw e;
+ }
+ catch (Throwable e) {
+ throw new ProcessingException(createSqlDump(true, false), e);
+ }
+ finally {
+ releasePreparedStatementAndResultSet(ps, cache, rs);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @seeorg.eclipse.scout.rt.server.services.common.sql.internal.exec.
+ * IStatementProcessor#processModification(java.sql.Connection,
+ * org.eclipse.scout
+ * .rt.server.services.common.sql.internal.exec.PreparedStatementCache)
+ */
+ @Override
+ public int processModification(Connection conn, IStatementCache cache, IStatementProcessorMonitor monitor) throws ProcessingException {
+ PreparedStatement ps = null;
+ int rowCount = 0;
+ try {
+ while (hasNextInputBatch()) {
+ nextInputBatch();
+ prepareInputStatementAndBinds();
+ dump();
+ ps = cache.getPreparedStatement(conn, m_currentInputStm);
+ bindBatch(ps);
+ registerActiveStatement(ps);
+ try {
+ rowCount = rowCount + ps.executeUpdate();
+ }
+ finally {
+ unregisterActiveStatement(ps);
+ cache.releasePreparedStatement(ps);
+ }
+ }
+ return rowCount;
+ }
+ catch (ProcessingException e) {
+ e.addContextMessage(createSqlDump(true, false));
+ throw e;
+ }
+ catch (Throwable e) {
+ throw new ProcessingException(createSqlDump(true, false), e);
+ }
+ finally {
+ cache.releasePreparedStatement(ps);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @seeorg.eclipse.scout.rt.server.services.common.sql.internal.exec.
+ * IStatementProcessor#processStoredProcedure(java.sql.Connection,
+ * org.eclipse.
+ * scout.rt.server.services.common.sql.internal.exec.PreparedStatementCache)
+ */
+ @Override
+ public boolean processStoredProcedure(Connection conn, IStatementCache cache, IStatementProcessorMonitor monitor) throws ProcessingException {
+ CallableStatement cs = null;
+ boolean status = true;
+ try {
+ while (hasNextInputBatch()) {
+ nextInputBatch();
+ prepareInputStatementAndBinds();
+ dump();
+ cs = cache.getCallableStatement(conn, m_currentInputStm);
+ bindBatch(cs);
+ registerActiveStatement(cs);
+ try {
+ status = status && cs.execute();
+ nextOutputBatch();
+ consumeOutputRow(cs);
+ }
+ finally {
+ unregisterActiveStatement(cs);
+ cache.releaseCallableStatement(cs);
+ }
+ }
+ finishOutputBatch();
+ return status;
+ }
+ catch (ProcessingException e) {
+ e.addContextMessage(createSqlDump(true, false));
+ throw e;
+ }
+ catch (Throwable e) {
+ throw new ProcessingException(createSqlDump(true, false), e);
+ }
+ finally {
+ cache.releaseCallableStatement(cs);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @seeorg.eclipse.scout.rt.server.services.common.sql.internal.exec.
+ * IStatementProcessor#createPlainText()
+ */
+ @Override
+ public String createPlainText() throws ProcessingException {
+ for (IToken t : m_ioTokens) {
+ if (t instanceof ValueInputToken) {
+ ValueInputToken vt = (ValueInputToken) t;
+ if (vt.isPlainSql()) {
+ // ok
+ }
+ else if (vt.isPlainValue()) {
+ // ok
+ }
+ else {
+ vt.setPlainValue(true);
+ }
+ }
+ else if (t instanceof FunctionInputToken) {
+ FunctionInputToken ft = (FunctionInputToken) t;
+ ft.setPlainValue(true);
+ }
+ }
+ if (hasNextInputBatch()) {
+ nextInputBatch();
+ prepareInputStatementAndBinds();
+ resetInputBatch();
+ }
+ return m_currentInputStm;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @seeorg.eclipse.scout.rt.server.services.common.sql.internal.exec.
+ * IStatementProcessor#simulate()
+ */
+ @Override
+ public void simulate() throws ProcessingException {
+ while (hasNextInputBatch()) {
+ nextInputBatch();
+ prepareInputStatementAndBinds();
+ dump();
+ }
+ }
+
+ /**
+ * when there are batch inputs, all batch inputs must agree to have another
+ * batch when there are no batch inputs, only first batch is valid
+ */
+ private boolean hasNextInputBatch() {
+ int nextIndex = m_currentInputBatchIndex + 1;
+ int batchInputCount = 0;
+ int batchAcceptCount = 0;
+ for (IBindInput input : m_inputList) {
+ if (input.isBatch()) {
+ batchInputCount++;
+ if (input.hasBatch(nextIndex)) {
+ batchAcceptCount++;
+ }
+ }
+ }
+ if (batchInputCount > 0) {
+ return batchInputCount == batchAcceptCount;
+ }
+ else {
+ return nextIndex == 0;
+ }
+ }
+
+ private void resetInputBatch() {
+ m_currentInputBatchIndex = -1;
+ for (IBindInput in : m_inputList) {
+ in.setNextBatchIndex(m_currentInputBatchIndex);
+ }
+ }
+
+ private void nextInputBatch() {
+ m_currentInputBatchIndex++;
+ for (IBindInput in : m_inputList) {
+ in.setNextBatchIndex(m_currentInputBatchIndex);
+ }
+ }
+
+ private void nextOutputBatch() {
+ m_currentOutputBatchIndex++;
+ for (IBindOutput out : m_outputList) {
+ out.setNextBatchIndex(m_currentOutputBatchIndex);
+ }
+ }
+
+ private void consumeSelectIntoRow(Object[] row) throws ProcessingException {
+ int index = 0;
+ for (IBindOutput out : m_outputList) {
+ if (out.isSelectInto()) {
+ out.consumeValue(row[index]);
+ index++;
+ }
+ }
+ }
+
+ private void consumeOutputRow(CallableStatement cs) throws ProcessingException, SQLException {
+ for (IBindOutput out : m_outputList) {
+ if (out.isJdbcBind()) {
+ out.consumeValue(cs.getObject(out.getJdbcBindIndex()));
+ }
+ }
+ }
+
+ private void finishOutputBatch() throws ProcessingException {
+ for (IBindOutput out : m_outputList) {
+ out.finishBatch();
+ }
+ }
+
+ private void prepareInputStatementAndBinds() throws ProcessingException {
+ // bind inputs and set replace token on inputs
+ m_currentInputBindMap = new TreeMap<Integer, SqlBind>();
+ for (IBindInput in : m_inputList) {
+ SqlBind bind = in.produceSqlBindAndSetReplaceToken(m_callerService.getSqlStyle());
+ assert (bind != null) == in.isJdbcBind();
+ if (bind != null) {
+ m_currentInputBindMap.put(in.getJdbcBindIndex(), bind);
+ }
+ }
+ // set replace token on outputs
+ for (IBindOutput out : m_outputList) {
+ out.setReplaceToken(m_callerService.getSqlStyle());
+ }
+ m_currentInputStm = m_bindModel.getFilteredStatement();
+ }
+
+ protected String createSqlDump(boolean statementWithBinds, boolean statementPlainText) {
+ StringBuffer debugBindBuf = new StringBuffer();
+ if (m_currentInputBindMap == null) {
+ try {
+ prepareInputStatementAndBinds();
+ }
+ catch (Throwable t) {
+ return t.getMessage();
+ }
+ }
+ if (m_currentInputBindMap == null) {
+ return "";
+ }
+ if (m_inputList != null) {
+ for (IBindInput in : m_inputList) {
+ SqlBind bind = m_currentInputBindMap.get(in.getJdbcBindIndex());
+ if (bind == null) {
+ continue;
+ }
+ debugBindBuf.append("IN ");
+ debugBindBuf.append(in.getToken().getParsedToken());
+ debugBindBuf.append(" => ");
+ debugBindBuf.append(in.getToken().getReplaceToken());
+ debugBindBuf.append(" [");
+ debugBindBuf.append(SqlBind.decodeJdbcType(bind.getSqlType()));
+ switch (bind.getSqlType()) {
+ case Types.BLOB:
+ case Types.CLOB: {
+ //nop
+ break;
+ }
+ default: {
+ debugBindBuf.append(" ");
+ debugBindBuf.append(bind.getValue());
+ }
+ }
+ debugBindBuf.append("]");
+ debugBindBuf.append("\n");
+ }
+ }
+ if (m_outputList != null) {
+ for (IBindOutput out : m_outputList) {
+ debugBindBuf.append("OUT ");
+ debugBindBuf.append(out.getToken().getParsedToken());
+ debugBindBuf.append(" => ");
+ debugBindBuf.append(out.getToken().getReplaceToken());
+ debugBindBuf.append(" [");
+ debugBindBuf.append(out.getBindType().getSimpleName());
+ debugBindBuf.append("]");
+ debugBindBuf.append("\n");
+ }
+ }
+ StringBuffer buf = new StringBuffer();
+ if (statementWithBinds) {
+ buf.append("SQL with binds:\n");
+ buf.append(SqlFormatter.wellform(m_originalStm).trim());
+ if (debugBindBuf != null && debugBindBuf.length() > 0) {
+ buf.append("\n");
+ buf.append(debugBindBuf.toString().trim());
+ }
+ }
+ if (statementPlainText) {
+ String p = "" + m_currentInputStm;
+ ArrayList<SqlBind> bindList = new ArrayList<SqlBind>(m_currentInputBindMap.values());
+ int pos = findNextBind(p, 0);
+ int bindIndex = 0;
+ while (pos >= 0 && bindIndex < bindList.size()) {
+ SqlBind bind = bindList.get(bindIndex);
+ String replacement;
+ switch (bind.getSqlType()) {
+ case Types.BLOB: {
+ replacement = "__BLOB__";
+ break;
+ }
+ case Types.CLOB: {
+ replacement = "__CLOB__";
+ break;
+ }
+ default: {
+ replacement = m_callerService.getSqlStyle().toPlainText(bind.getValue());
+ }
+ }
+ if (replacement == null) {
+ replacement = "NULL";
+ }
+ replacement = replacement.replace('?', ' ');
+ //next
+ p = p.substring(0, pos) + replacement + p.substring(pos + 1);
+ pos = findNextBind(p, pos);
+ bindIndex++;
+ }
+ if (buf.length() > 0) {
+ buf.append("\n");
+ }
+ buf.append("SQL PLAIN Log:\n");
+ buf.append(SqlFormatter.wellform(p).trim());
+ }
+ return buf.toString();
+ }
+
+ private static int findNextBind(String s, int start) {
+ if (s == null || start < 0 || start >= s.length()) {
+ return -1;
+ }
+ int candidate = s.indexOf('?', start);
+ if (candidate < 0) {
+ return -1;
+ }
+ P_TextSectionFinder red = new P_TextSectionFinder(s);
+ while (red.find()) {
+ if (candidate < red.start()) {
+ //outside red section
+ return candidate;
+ }
+ if (candidate >= red.start() && candidate < red.end()) {
+ //inside red section, find next candidate outside red section
+ candidate = s.indexOf('?', red.end());
+ if (candidate < 0) {
+ return -1;
+ }
+ //got next candidate after red section
+ }
+ //continue with next red section
+ }
+ return candidate;
+ }
+
+ /**
+ * Replacement for:
+ * <p>
+ * <code>
+ * Pattern TEXT_SECTION_PATTERN = Pattern.compile("'([^']|'')*'", Pattern.DOTALL);
+ * Matcher red = TEXT_SECTION_PATTERN.matcher(s);
+ * </code>
+ * <p>
+ * which is broken due to <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6337993">Sun bug 6337993</a>
+ * when matching large (> ~1000 characters) texts.
+ */
+ private static class P_TextSectionFinder {
+
+ private final String m_string;
+ private P_TextSection m_currentTextSection = null;
+
+ public P_TextSectionFinder(String s) {
+ m_string = s;
+ }
+
+ public boolean find() {
+ int start = 0;
+ if (m_currentTextSection != null) {
+ start = m_currentTextSection.to + 1;
+ }
+ m_currentTextSection = findNextTextSection(m_string, start);
+ return (m_currentTextSection != null);
+ }
+
+ public int start() {
+ return (m_currentTextSection == null ? -1 : m_currentTextSection.from);
+ }
+
+ public int end() {
+ return (m_currentTextSection == null ? -1 : m_currentTextSection.to);
+ }
+
+ private static P_TextSection findNextTextSection(String s, int start) {
+ if (s == null || start < 0 || start >= s.length()) {
+ return null;
+ }
+ int secStart = -1;
+ int pos = start;
+ while (pos < s.length()) {
+ char c = s.charAt(pos);
+ if (c == '\'') {
+ if (secStart < 0) {
+ // Outside section -> start a new one
+ secStart = pos;
+ }
+ else {
+ // Inside section
+ if (pos == s.length() - 1 || s.charAt(pos + 1) != '\'') {
+ // Last position or next position is not a ' -> we found a section
+ return new P_TextSection(secStart, pos + 1);
+ }
+ // Skip double '
+ pos++;
+ }
+ }
+ pos++;
+ }
+ return null;
+ }
+
+ private static class P_TextSection {
+ public int from;
+ public int to;
+
+ public P_TextSection(int from, int to) {
+ this.from = from;
+ this.to = to;
+ }
+ }
+ }
+
+ protected void dump() {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("\n" + createSqlDump(true, true));
+ }
+ else if (LOG.isInfoEnabled()) {
+ LOG.info("\n" + createSqlDump(true, false));
+ }
+ }
+
+ private void bindBatch(PreparedStatement ps) throws ProcessingException {
+ try {
+ // bind inputs
+ if (ps instanceof PreparedStatement) {
+ writeBinds(ps);
+ }
+ // register outputs
+ if (ps instanceof CallableStatement) {
+ registerOutputs((CallableStatement) ps);
+ }
+ }
+ catch (Throwable e) {
+ throw new ProcessingException("unexpected exception", e);
+ }
+ }
+
+ protected void writeBinds(PreparedStatement ps) throws SQLException {
+ ISqlStyle sqlStyle = m_callerService.getSqlStyle();
+ for (Map.Entry<Integer, SqlBind> e : m_currentInputBindMap.entrySet()) {
+ sqlStyle.writeBind(ps, e.getKey(), e.getValue());
+ }
+ }
+
+ protected void registerOutputs(CallableStatement cs) throws SQLException {
+ ISqlStyle sqlStyle = m_callerService.getSqlStyle();
+ for (IBindOutput out : m_outputList) {
+ if (out.isJdbcBind()) {
+ sqlStyle.registerOutput(cs, out.getJdbcBindIndex(), out.getBindType());
+ }
+ }
+ }
+
+ private IBindInput createInput(IToken bindToken, Object[] bindBases) throws ProcessingException {
+ IBindInput o = null;
+ if (bindToken instanceof ValueInputToken) {
+ ValueInputToken valueInputToken = (ValueInputToken) bindToken;
+ String[] path = valueInputToken.getName().split("[.]");
+ for (int i = 0; i < bindBases.length; i++) {
+ Object bindBase = bindBases[i];
+ Class nullType = null;
+ if (bindBase instanceof NVPair) {
+ nullType = ((NVPair) bindBase).getNullType();
+ }
+ o = createInputRec(valueInputToken, path, bindBases[i], nullType);
+ if (o != null) {
+ break;
+ }
+ }
+ if (o == null) {
+ throw new ProcessingException("Cannot find input for '" + valueInputToken + "' in bind bases.");
+ }
+ }
+ else if (bindToken instanceof FunctionInputToken) {
+ o = new FunctionInput(m_callerService, m_bindBases, (FunctionInputToken) bindToken);
+ }
+ return o;
+ }
+
+ private IBindInput createInputRec(ValueInputToken bindToken, String[] path, Object bindBase, Class nullType) throws ProcessingException {
+ boolean terminal = (path.length == 1);
+ Object o = null;
+ boolean found = false;
+ if (bindBase instanceof Map) {
+ // handle all terminal cases for map
+ o = ((Map) bindBase).get(path[0]);
+ if (o != null) {
+ found = true;
+ }
+ else if (((Map) bindBase).containsKey(path[0])) {
+ found = true;
+ }
+ if (found) {
+ // special case: table holder and table filter are preemptive terminals
+ if (o instanceof ITableHolder) {
+ return new TableHolderInput((ITableHolder) o, null, path[1], bindToken);
+ }
+ else if (o instanceof TableHolderFilter) {
+ return new TableHolderInput(((TableHolderFilter) o).getTableHolder(), ((TableHolderFilter) o).getFilteredRows(), path[1], bindToken);
+ }
+ else if (o instanceof IBeanArrayHolder) {
+ return new BeanArrayHolderInput((IBeanArrayHolder) o, null, path[1], bindToken);
+ }
+ else if (o instanceof BeanArrayHolderFilter) {
+ return new BeanArrayHolderInput(((BeanArrayHolderFilter) o).getBeanArrayHolder(), ((BeanArrayHolderFilter) o).getFilteredBeans(), path[1], bindToken);
+ }
+ else {
+ if (terminal) {
+ return createInputTerminal(o, nullType, bindToken);
+ }
+ else {
+ if (o == null) {
+ throw new ProcessingException("input bind " + bindToken + " resolves to null on path element: " + path[0]);
+ }
+ }
+ }
+ }
+ }
+ else if (bindBase instanceof NVPair) {
+ // handle all terminal cases for nvpair
+ if (((NVPair) bindBase).getName().equals(path[0])) {
+ o = ((NVPair) bindBase).getValue();
+ found = true;
+ // special case: table holder and table filter are preemptive terminals
+ if (o instanceof ITableHolder) {
+ return new TableHolderInput((ITableHolder) o, null, path[1], bindToken);
+ }
+ else if (o instanceof TableHolderFilter) {
+ return new TableHolderInput(((TableHolderFilter) o).getTableHolder(), ((TableHolderFilter) o).getFilteredRows(), path[1], bindToken);
+ }
+ else if (o instanceof IBeanArrayHolder) {
+ return new BeanArrayHolderInput((IBeanArrayHolder) o, null, path[1], bindToken);
+ }
+ else if (o instanceof BeanArrayHolderFilter) {
+ return new BeanArrayHolderInput(((BeanArrayHolderFilter) o).getBeanArrayHolder(), ((BeanArrayHolderFilter) o).getFilteredBeans(), path[1], bindToken);
+ }
+ else {
+ if (terminal) {
+ return createInputTerminal(o, nullType, bindToken);
+ }
+ else {
+ if (o == null) {
+ throw new ProcessingException("input bind " + bindToken + " resolves to null on path element: " + path[0]);
+ }
+ }
+ }
+ }
+ }
+ else if (bindBase instanceof ITableHolder) {
+ // handle all terminal cases for table holder
+ ITableHolder table = (ITableHolder) bindBase;
+ try {
+ Method m = table.getClass().getMethod("get" + Character.toUpperCase(path[0].charAt(0)) + path[0].substring(1), new Class[]{int.class});
+ if (m != null) {
+ found = true;
+ return new TableHolderInput(table, null, path[0], bindToken);
+ }
+ }
+ catch (Throwable t) {
+ found = false;
+ // nop
+ }
+ }
+ else if (bindBase instanceof TableHolderFilter) {
+ // handle all terminal cases for table holder filter
+ TableHolderFilter filter = (TableHolderFilter) bindBase;
+ ITableHolder table = filter.getTableHolder();
+ try {
+ Method m = table.getClass().getMethod("get" + Character.toUpperCase(path[0].charAt(0)) + path[0].substring(1), new Class[]{int.class});
+ if (m != null) {
+ found = true;
+ return new TableHolderInput(table, filter.getFilteredRows(), path[0], bindToken);
+ }
+ }
+ catch (Throwable t) {
+ // nop
+ found = false;
+ }
+ }
+ else if (bindBase instanceof IBeanArrayHolder) {
+ // handle all terminal cases for BeanArrayHolder
+ IBeanArrayHolder<?> holder = (IBeanArrayHolder) bindBase;
+ try {
+ Method m = holder.getHolderType().getMethod("get" + Character.toUpperCase(path[0].charAt(0)) + path[0].substring(1));
+ if (m != null) {
+ found = true;
+ return new BeanArrayHolderInput(holder, null, path[0], bindToken);
+ }
+ }
+ catch (Throwable t1) {
+ try {
+ Method m = holder.getHolderType().getMethod("is" + Character.toUpperCase(path[0].charAt(0)) + path[0].substring(1));
+ if (m != null) {
+ found = true;
+ return new BeanArrayHolderInput(holder, null, path[0], bindToken);
+ }
+ }
+ catch (Throwable t2) {
+ found = false;
+ // nop
+ }
+ }
+ }
+ else if (bindBase instanceof BeanArrayHolderFilter) {
+ // handle all terminal cases for table holder filter
+ BeanArrayHolderFilter filter = (BeanArrayHolderFilter) bindBase;
+ IBeanArrayHolder<?> holder = filter.getBeanArrayHolder();
+ try {
+ Method m = holder.getHolderType().getMethod("get" + Character.toUpperCase(path[0].charAt(0)) + path[0].substring(1));
+ if (m != null) {
+ found = true;
+ return new BeanArrayHolderInput(holder, filter.getFilteredBeans(), path[0], bindToken);
+ }
+ }
+ catch (Throwable t1) {
+ try {
+ Method m = holder.getHolderType().getMethod("is" + Character.toUpperCase(path[0].charAt(0)) + path[0].substring(1));
+ if (m != null) {
+ found = true;
+ return new BeanArrayHolderInput(holder, null, path[0], bindToken);
+ }
+ }
+ catch (Throwable t2) {
+ found = false;
+ // nop
+ }
+ }
+ }
+ else if (bindBase != null) {
+ if (bindBase.getClass().isArray() && terminal) {
+ return new BeanPropertyInput(path[0], (Object[]) bindBase, bindToken);
+ }
+ if (bindBase instanceof Collection && terminal) {
+ return new BeanPropertyInput(path[0], ((Collection) bindBase).toArray(), bindToken);
+ }
+ /* bean propertry */
+ try {
+ Object propertyBean = bindBase;
+ FastPropertyDescriptor pd = BeanUtility.getFastBeanInfo(propertyBean.getClass(), null).getPropertyDescriptor(path[0]);
+ Method getter = pd != null ? pd.getReadMethod() : null;
+ if (getter != null) {
+ // getter exists
+ o = getter.invoke(propertyBean);
+ found = true;
+ if (terminal) {
+ return createInputTerminal(o, getter.getReturnType(), bindToken);
+ }
+ else {
+ if (o == null) {
+ throw new ProcessingException("input bind " + bindToken + " resolves to null on path element: " + path[0]);
+ }
+ }
+ }
+ }
+ catch (Exception e) {
+ // obviously there is no such property
+ }
+ }
+ //
+ if (found) {
+ if (terminal) {
+ throw new ProcessingException("input bind '" + bindToken.getName() + "' was not recognized as a terminal");
+ }
+ // continue
+ String[] newPath = new String[path.length - 1];
+ System.arraycopy(path, 1, newPath, 0, newPath.length);
+ IBindInput input = null;
+ if (o instanceof IHolder<?>) {
+ /* dereference value if current object is an IHolder. If input cannot be resolved (i.e. ProcessingException occurs),
+ * search given property names on holder. Hence both of the following forms are supported on holder types:
+ * :holder.property
+ * :holder.value.property
+ */
+ try {
+ input = createInputRec(bindToken, newPath, ((IHolder) o).getValue(), nullType);
+ }
+ catch (ProcessingException pe) {
+ // nop, see below
+ }
+ }
+ if (input == null) {
+ // strict search without dereferncing holder objects
+ input = createInputRec(bindToken, newPath, o, nullType);
+ }
+ return input;
+ }
+ else {
+ return null;
+ }
+ }
+
+ private IBindOutput createOutput(IToken bindToken, Object[] bindBases) throws ProcessingException {
+ IBindOutput o = null;
+ if (bindToken instanceof ValueOutputToken) {
+ ValueOutputToken valueOutputToken = (ValueOutputToken) bindToken;
+ String[] path = valueOutputToken.getName().split("[.]");
+ for (int i = 0; i < bindBases.length; i++) {
+ o = createOutputRec(valueOutputToken, path, bindBases[i]);
+ if (o != null) {
+ break;
+ }
+ }
+ if (o == null) {
+ throw new ProcessingException("Cannot find output for '" + valueOutputToken + "' in bind base. When selecting into shared context variables make sure these variables are initialized using CONTEXT.set<i>PropertyName</i>(null)");
+ }
+ }
+ else {
+ throw new ProcessingException("Cannot find output for '" + bindToken.getClass());
+ }
+ return o;
+ }
+
+ @SuppressWarnings("unchecked")
+ private IBindOutput createOutputRec(ValueOutputToken bindToken, String[] path, final Object bindBase) throws ProcessingException {
+ boolean terminal = (path.length == 1);
+ Object o = null;
+ boolean found = false;
+ if (bindBase instanceof Map) {
+ // handle all terminal cases for map
+ o = ((Map) bindBase).get(path[0]);
+ if (o != null) {
+ found = true;
+ }
+ else if (((Map) bindBase).containsKey(path[0])) {
+ found = true;
+ }
+ if (found) {
+ // special case: table holder is preemptive terminal
+ if (o instanceof ITableHolder) {
+ ITableHolder table = (ITableHolder) o;
+ return new TableHolderOutput(table, path[1], bindToken);
+ }
+ else if (o instanceof IBeanArrayHolder) {
+ IBeanArrayHolder holder = (IBeanArrayHolder) o;
+ return new BeanArrayHolderOutput(holder, path[1], bindToken);
+ }
+ else if (o instanceof IHolder) {
+ if (terminal) {
+ return createOutputTerminal((IHolder) o, bindToken);
+ }
+ else {
+ o = ((IHolder) o).getValue();
+ }
+ }
+ else if (o == null) {
+ if (terminal) {
+ return new MapOutput((Map) bindBase, path[0], bindToken);
+ }
+ else {
+ throw new ProcessingException("output bind " + bindToken + " resolves to null on path element: " + path[0]);
+ }
+ }
+ else {
+ if (terminal) {
+ return new MapOutput((Map) bindBase, path[0], bindToken);
+ }
+ }
+ }
+ }
+ else if (bindBase instanceof NVPair) {
+ // handle all terminal cases for nvpair
+ if (((NVPair) bindBase).getName().equals(path[0])) {
+ o = ((NVPair) bindBase).getValue();
+ found = true;
+ // special case: table holder is preemptive terminal
+ if (o instanceof ITableHolder) {
+ ITableHolder table = (ITableHolder) o;
+ return new TableHolderOutput(table, path[1], bindToken);
+ }
+ else if (o instanceof IBeanArrayHolder) {
+ IBeanArrayHolder holder = (IBeanArrayHolder) o;
+ return new BeanArrayHolderOutput(holder, path[1], bindToken);
+ }
+ else if (o instanceof IHolder) {
+ if (terminal) {
+ return createOutputTerminal((IHolder) o, bindToken);
+ }
+ else {
+ o = ((IHolder) o).getValue();
+ }
+ }
+ else if (o == null) {
+ throw new ProcessingException("output bind " + bindToken + " resolves to null on path element: " + path[0]);
+ }
+ else {
+ if (terminal) {
+ throw new ProcessingException("output bind " + bindToken + " is not a valid output container");
+ }
+ }
+ }
+ }
+ else if (bindBase instanceof ITableHolder) {
+ // handle all terminal cases for table holder
+ ITableHolder table = (ITableHolder) bindBase;
+ try {
+ Method m = table.getClass().getMethod("get" + Character.toUpperCase(path[0].charAt(0)) + path[0].substring(1), new Class[]{int.class});
+ if (m != null) {
+ found = true;
+ return new TableHolderOutput(table, path[0], bindToken);
+ }
+ }
+ catch (Throwable t) {
+ // nop
+ found = false;
+ }
+ }
+ else if (bindBase instanceof IBeanArrayHolder) {
+ // handle all terminal cases for BeanArrayHolder
+ IBeanArrayHolder holder = (IBeanArrayHolder) bindBase;
+ try {
+ Method m = holder.getHolderType().getMethod("get" + Character.toUpperCase(path[0].charAt(0)) + path[0].substring(1));
+ if (m != null) {
+ found = true;
+ return new BeanArrayHolderOutput(holder, path[0], bindToken);
+ }
+ }
+ catch (Throwable t1) {
+ try {
+ Method m = holder.getHolderType().getMethod("is" + Character.toUpperCase(path[0].charAt(0)) + path[0].substring(1));
+ if (m != null) {
+ found = true;
+ return new BeanArrayHolderOutput(holder, path[0], bindToken);
+ }
+ }
+ catch (Throwable t2) {
+ found = false;
+ // nop
+ }
+ }
+ }
+ else/* bean property */{
+ // handle all terminal cases for bean property
+ try {
+ FastPropertyDescriptor pd = BeanUtility.getFastBeanInfo(bindBase.getClass(), null).getPropertyDescriptor(path[0]);
+ if (terminal) {
+ Method setter = pd != null ? pd.getWriteMethod() : null;
+ if (setter != null) {
+ found = true;
+ return new AbstractBeanPropertyOutput(bindBase.getClass(), path[0], bindToken) {
+ @Override
+ protected Object[] getFinalBeanArray() {
+ return new Object[]{bindBase};
+ }
+ };
+ }
+ else {
+ Method getter = pd != null ? pd.getReadMethod() : null;
+ if (getter != null) {
+ o = getter.invoke(bindBase, (Object[]) null);
+ if (o instanceof ITableHolder) {
+ throw new ProcessingException("output bind '" + bindToken.getName() + "' is a table and should not be a terminal");
+ }
+ else if (o instanceof IBeanArrayHolder) {
+ throw new ProcessingException("output bind '" + bindToken.getName() + "' is a bean array and should not be a terminal");
+ }
+ else if (o instanceof IHolder) {
+ return createOutputTerminal((IHolder) o, bindToken);
+ }
+ else {
+ throw new ProcessingException("output bind '" + bindToken.getName() + "' is not a holder");
+ }
+ }
+ }
+ }
+ else {
+ Method getter = pd != null ? pd.getReadMethod() : null;
+ if (getter != null) {
+ Object readValue = getter.invoke(bindBase, (Object[]) null);
+ o = readValue;
+ found = true;
+ }
+ }
+ }
+ catch (Exception e) {
+ // obviously there is no such property
+ }
+ }
+ //
+ if (found) {
+ if (terminal) {
+ throw new ProcessingException("output bind '" + bindToken.getName() + "' was not recognized as a terminal");
+ }
+ // continue
+ String[] newPath = new String[path.length - 1];
+ System.arraycopy(path, 1, newPath, 0, newPath.length);
+ return createOutputRec(bindToken, newPath, o);
+ }
+ else {
+ return null;
+ }
+ }
+
+ private IBindOutput createOutputTerminal(IHolder h, ValueOutputToken bindToken) {
+ Class cls = h.getHolderType();
+ if (cls.isArray()) {
+ // byte[] and char[] are no "arrays"
+ if (cls == byte[].class || cls == char[].class) {
+ return new SingleHolderOutput(h, bindToken);
+ }
+ else {
+ return new ArrayHolderOutput(h, bindToken);
+ }
+ }
+ else {
+ return new SingleHolderOutput(h, bindToken);
+ }
+ }
+
+ private IBindInput createInputTerminal(Object o, Class nullType, ValueInputToken bindToken) throws ProcessingException {
+ if (o == null) {
+ return new SingleInput(null, nullType, bindToken);
+ }
+ else if (o instanceof IHolder) {
+ Class cls = ((IHolder) o).getHolderType();
+ if (nullType == null) {
+ nullType = cls;
+ }
+ if (cls.isArray()) {
+ // byte[] and char[] are no "arrays"
+ if (cls == byte[].class || cls == char[].class) {
+ return new SingleInput(((IHolder) o).getValue(), nullType, bindToken);
+ }
+ else {
+ return new ArrayInput(((IHolder) o).getValue(), bindToken);
+ }
+ }
+ else if (cls == TriState.class) {
+ return new TriStateInput((TriState) ((IHolder) o).getValue(), bindToken);
+ }
+ else {
+ return new SingleInput(((IHolder) o).getValue(), nullType, bindToken);
+ }
+ }
+ else {
+ if (o instanceof Collection) {
+ return new ArrayInput(((Collection) o).toArray(), bindToken);
+ }
+ else if (o.getClass().isArray()) {
+ Class cls = o.getClass();
+ // byte[] and char[] are no "arrays"
+ if (cls == byte[].class || cls == char[].class) {
+ return new SingleInput(o, nullType, bindToken);
+ }
+ else {
+ return new ArrayInput(o, bindToken);
+ }
+ }
+ else if (o.getClass() == TriState.class) {
+ return new TriStateInput((TriState) o, bindToken);
+ }
+ else {
+ return new SingleInput(o, nullType, bindToken);
+ }
+ }
+ }
+
+ protected void processDatabaseSpecificToken(DatabaseSpecificToken t, ISqlStyle sqlStyle) {
+ String name = t.getName().toLowerCase();
+ if (name.equals("sysdate")) {
+ t.setReplaceToken(sqlStyle.getSysdateToken());
+ }
+ else if (name.equals("upper")) {
+ t.setReplaceToken(sqlStyle.getUpperToken());
+ }
+ else if (name.equals("lower")) {
+ t.setReplaceToken(sqlStyle.getLowerToken());
+ }
+ else if (name.equals("trim")) {
+ t.setReplaceToken(sqlStyle.getTrimToken());
+ }
+ else if (name.equals("nvl")) {
+ t.setReplaceToken(sqlStyle.getNvlToken());
+ }
+ else {
+ LOG.warn("used unknown database specific token " + t.getParsedToken());
+ t.setReplaceToken(name);
+ }
+ }
+
+ protected void registerActiveStatement(Statement s) throws SQLException {
+ ITransaction tx = ThreadContext.getTransaction();
+ if (tx == null) {
+ return;
+ }
+ ITransactionMember member = tx.getMember(getCallerService().getTransactionMemberId());
+ if (member instanceof AbstractSqlTransactionMember) {
+ ((AbstractSqlTransactionMember) member).registerActiveStatement(s);
+ }
+ }
+
+ protected void unregisterActiveStatement(Statement s) throws SQLException {
+ ITransaction tx = ThreadContext.getTransaction();
+ if (tx == null) {
+ return;
+ }
+ ITransactionMember member = tx.getMember(getCallerService().getTransactionMemberId());
+ if (member instanceof AbstractSqlTransactionMember) {
+ ((AbstractSqlTransactionMember) member).unregisterActiveStatement(s);
+ }
+ }
+
+ private void releasePreparedStatementAndResultSet(PreparedStatement ps, IStatementCache cache, ResultSet rs) {
+ if (rs != null) {
+ try {
+ rs.close();
+ }
+ catch (Throwable t) {
+ }
+ }
+ cache.releasePreparedStatement(ps);
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/TableHolderInput.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/TableHolderInput.java
index a9087a5fdf..3774058c69 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/TableHolderInput.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/TableHolderInput.java
@@ -1,117 +1,117 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc.internal.exec;
-
-import java.lang.reflect.Method;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.holders.ITableHolder;
-import org.eclipse.scout.commons.parsers.token.IToken;
-import org.eclipse.scout.commons.parsers.token.ValueInputToken;
-import org.eclipse.scout.rt.server.services.common.jdbc.SqlBind;
-import org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle;
-
-class TableHolderInput implements IBindInput {
- private ITableHolder m_table;
- private int[] m_filteredRowIndices;
- private Method m_getterMethod;
- private ValueInputToken m_target;
- private int m_batchIndex = -1;
- private int m_jdbcBindIndex = -1;
-
- public TableHolderInput(ITableHolder table, int[] filteredRowIndices, String columnName, ValueInputToken target) throws ProcessingException {
- m_table = table;
- if (filteredRowIndices == null) {
- filteredRowIndices = new int[table.getRowCount()];
- for (int i = 0; i < filteredRowIndices.length; i++) {
- filteredRowIndices[i] = i;
- }
- }
- m_filteredRowIndices = filteredRowIndices;
- try {
- m_getterMethod = table.getClass().getMethod("get" + Character.toUpperCase(columnName.charAt(0)) + columnName.substring(1), new Class[]{int.class});
- }
- catch (Throwable e) {
- throw new ProcessingException("unexpected exception", e);
- }
- m_target = target;
- }
-
- @Override
- public IToken getToken() {
- return m_target;
- }
-
- @Override
- public boolean isBatch() {
- return true;
- }
-
- @Override
- public boolean hasBatch(int i) {
- return i < m_filteredRowIndices.length;
- }
-
- @Override
- public void setNextBatchIndex(int i) {
- m_batchIndex = i;
- }
-
- @Override
- public boolean isJdbcBind() {
- if (m_target.isPlainValue()) {
- return false;
- }
- else if (m_target.isPlainSql()) {
- return false;
- }
- else {
- return true;
- }
- }
-
- @Override
- public int getJdbcBindIndex() {
- return m_jdbcBindIndex;
- }
-
- @Override
- public void setJdbcBindIndex(int index) {
- m_jdbcBindIndex = index;
- }
-
- @Override
- public SqlBind produceSqlBindAndSetReplaceToken(ISqlStyle sqlStyle) throws ProcessingException {
- Object value = null;
- if (m_batchIndex < m_filteredRowIndices.length) {
- try {
- value = m_getterMethod.invoke(m_table, new Object[]{new Integer(m_filteredRowIndices[m_batchIndex])});
- }
- catch (Throwable e) {
- throw new ProcessingException("unexpected exception", e);
- }
- }
- //
- if (m_target.isPlainValue()) {
- m_target.setReplaceToken(sqlStyle.toPlainText(value));
- return null;
- }
- else if (m_target.isPlainSql()) {
- m_target.setReplaceToken("" + value);
- return null;
- }
- else {
- m_target.setReplaceToken("?");
- return sqlStyle.buildBindFor(value, m_getterMethod.getReturnType());
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc.internal.exec;
+
+import java.lang.reflect.Method;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.holders.ITableHolder;
+import org.eclipse.scout.commons.parsers.token.IToken;
+import org.eclipse.scout.commons.parsers.token.ValueInputToken;
+import org.eclipse.scout.rt.server.services.common.jdbc.SqlBind;
+import org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle;
+
+class TableHolderInput implements IBindInput {
+ private ITableHolder m_table;
+ private int[] m_filteredRowIndices;
+ private Method m_getterMethod;
+ private ValueInputToken m_target;
+ private int m_batchIndex = -1;
+ private int m_jdbcBindIndex = -1;
+
+ public TableHolderInput(ITableHolder table, int[] filteredRowIndices, String columnName, ValueInputToken target) throws ProcessingException {
+ m_table = table;
+ if (filteredRowIndices == null) {
+ filteredRowIndices = new int[table.getRowCount()];
+ for (int i = 0; i < filteredRowIndices.length; i++) {
+ filteredRowIndices[i] = i;
+ }
+ }
+ m_filteredRowIndices = filteredRowIndices;
+ try {
+ m_getterMethod = table.getClass().getMethod("get" + Character.toUpperCase(columnName.charAt(0)) + columnName.substring(1), new Class[]{int.class});
+ }
+ catch (Throwable e) {
+ throw new ProcessingException("unexpected exception", e);
+ }
+ m_target = target;
+ }
+
+ @Override
+ public IToken getToken() {
+ return m_target;
+ }
+
+ @Override
+ public boolean isBatch() {
+ return true;
+ }
+
+ @Override
+ public boolean hasBatch(int i) {
+ return i < m_filteredRowIndices.length;
+ }
+
+ @Override
+ public void setNextBatchIndex(int i) {
+ m_batchIndex = i;
+ }
+
+ @Override
+ public boolean isJdbcBind() {
+ if (m_target.isPlainValue()) {
+ return false;
+ }
+ else if (m_target.isPlainSql()) {
+ return false;
+ }
+ else {
+ return true;
+ }
+ }
+
+ @Override
+ public int getJdbcBindIndex() {
+ return m_jdbcBindIndex;
+ }
+
+ @Override
+ public void setJdbcBindIndex(int index) {
+ m_jdbcBindIndex = index;
+ }
+
+ @Override
+ public SqlBind produceSqlBindAndSetReplaceToken(ISqlStyle sqlStyle) throws ProcessingException {
+ Object value = null;
+ if (m_batchIndex < m_filteredRowIndices.length) {
+ try {
+ value = m_getterMethod.invoke(m_table, new Object[]{new Integer(m_filteredRowIndices[m_batchIndex])});
+ }
+ catch (Throwable e) {
+ throw new ProcessingException("unexpected exception", e);
+ }
+ }
+ //
+ if (m_target.isPlainValue()) {
+ m_target.setReplaceToken(sqlStyle.toPlainText(value));
+ return null;
+ }
+ else if (m_target.isPlainSql()) {
+ m_target.setReplaceToken("" + value);
+ return null;
+ }
+ else {
+ m_target.setReplaceToken("?");
+ return sqlStyle.buildBindFor(value, m_getterMethod.getReturnType());
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/TableHolderOutput.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/TableHolderOutput.java
index 606324ba4c..ef9873aa15 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/TableHolderOutput.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/TableHolderOutput.java
@@ -1,112 +1,112 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc.internal.exec;
-
-import java.lang.reflect.Method;
-
-import org.eclipse.scout.commons.TypeCastUtility;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.holders.ITableHolder;
-import org.eclipse.scout.commons.parsers.token.IToken;
-import org.eclipse.scout.commons.parsers.token.ValueOutputToken;
-import org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle;
-
-class TableHolderOutput implements IBindOutput {
- private ITableHolder m_holder;
- private Method m_getterMethod;
- private Method m_setterMethod;
- private Class m_beanType;
- private ValueOutputToken m_source;
- private int m_batchIndex = -1;
- private int m_jdbcBindIndex = -1;
-
- public TableHolderOutput(ITableHolder holder, String columnName, ValueOutputToken source) throws ProcessingException {
- m_holder = holder;
- try {
- m_getterMethod = m_holder.getClass().getMethod("get" + Character.toUpperCase(columnName.charAt(0)) + columnName.substring(1), new Class[]{int.class});
- m_beanType = m_getterMethod.getReturnType();
- m_setterMethod = m_holder.getClass().getMethod("set" + Character.toUpperCase(columnName.charAt(0)) + columnName.substring(1), new Class[]{int.class, m_beanType});
- }
- catch (Throwable e) {
- throw new ProcessingException("unexpected exception", e);
- }
- m_source = source;
- }
-
- @Override
- public IToken getToken() {
- return m_source;
- }
-
- @Override
- public boolean isJdbcBind() {
- return !m_source.isSelectInto();
- }
-
- @Override
- public int getJdbcBindIndex() {
- return m_jdbcBindIndex;
- }
-
- @Override
- public void setJdbcBindIndex(int index) {
- m_jdbcBindIndex = index;
- }
-
- @Override
- public boolean isBatch() {
- return true;
- }
-
- @Override
- public boolean isSelectInto() {
- return m_source.isSelectInto();
- }
-
- @Override
- public Class getBindType() {
- return m_getterMethod.getReturnType();
- }
-
- @Override
- public void setNextBatchIndex(int i) {
- m_batchIndex = i;
- }
-
- @Override
- public void finishBatch() {
- m_holder.ensureSize(m_batchIndex + 1);
- }
-
- @Override
- public void setReplaceToken(ISqlStyle style) {
- m_source.setReplaceToken("?");
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public void consumeValue(Object value) throws ProcessingException {
- m_holder.ensureSize(m_batchIndex + 1);
- try {
- Object castValue = TypeCastUtility.castValue(value, m_beanType);
- m_setterMethod.invoke(m_holder, new Object[]{m_batchIndex, castValue});
- }
- catch (Throwable e) {
- throw new ProcessingException("unexpected exception", e);
- }
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName() + "[bindType=" + getBindType() + ", source=" + m_source + "]";
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc.internal.exec;
+
+import java.lang.reflect.Method;
+
+import org.eclipse.scout.commons.TypeCastUtility;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.holders.ITableHolder;
+import org.eclipse.scout.commons.parsers.token.IToken;
+import org.eclipse.scout.commons.parsers.token.ValueOutputToken;
+import org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle;
+
+class TableHolderOutput implements IBindOutput {
+ private ITableHolder m_holder;
+ private Method m_getterMethod;
+ private Method m_setterMethod;
+ private Class m_beanType;
+ private ValueOutputToken m_source;
+ private int m_batchIndex = -1;
+ private int m_jdbcBindIndex = -1;
+
+ public TableHolderOutput(ITableHolder holder, String columnName, ValueOutputToken source) throws ProcessingException {
+ m_holder = holder;
+ try {
+ m_getterMethod = m_holder.getClass().getMethod("get" + Character.toUpperCase(columnName.charAt(0)) + columnName.substring(1), new Class[]{int.class});
+ m_beanType = m_getterMethod.getReturnType();
+ m_setterMethod = m_holder.getClass().getMethod("set" + Character.toUpperCase(columnName.charAt(0)) + columnName.substring(1), new Class[]{int.class, m_beanType});
+ }
+ catch (Throwable e) {
+ throw new ProcessingException("unexpected exception", e);
+ }
+ m_source = source;
+ }
+
+ @Override
+ public IToken getToken() {
+ return m_source;
+ }
+
+ @Override
+ public boolean isJdbcBind() {
+ return !m_source.isSelectInto();
+ }
+
+ @Override
+ public int getJdbcBindIndex() {
+ return m_jdbcBindIndex;
+ }
+
+ @Override
+ public void setJdbcBindIndex(int index) {
+ m_jdbcBindIndex = index;
+ }
+
+ @Override
+ public boolean isBatch() {
+ return true;
+ }
+
+ @Override
+ public boolean isSelectInto() {
+ return m_source.isSelectInto();
+ }
+
+ @Override
+ public Class getBindType() {
+ return m_getterMethod.getReturnType();
+ }
+
+ @Override
+ public void setNextBatchIndex(int i) {
+ m_batchIndex = i;
+ }
+
+ @Override
+ public void finishBatch() {
+ m_holder.ensureSize(m_batchIndex + 1);
+ }
+
+ @Override
+ public void setReplaceToken(ISqlStyle style) {
+ m_source.setReplaceToken("?");
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public void consumeValue(Object value) throws ProcessingException {
+ m_holder.ensureSize(m_batchIndex + 1);
+ try {
+ Object castValue = TypeCastUtility.castValue(value, m_beanType);
+ m_setterMethod.invoke(m_holder, new Object[]{m_batchIndex, castValue});
+ }
+ catch (Throwable e) {
+ throw new ProcessingException("unexpected exception", e);
+ }
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + "[bindType=" + getBindType() + ", source=" + m_source + "]";
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/TestStatementProcessor.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/TestStatementProcessor.java
index 4c0754ef09..8ce6179f7d 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/TestStatementProcessor.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/TestStatementProcessor.java
@@ -1,178 +1,178 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc.internal.exec;
-
-import java.sql.Connection;
-import java.sql.Driver;
-import java.sql.DriverManager;
-import java.util.Date;
-
-import org.eclipse.scout.commons.holders.IntegerHolder;
-import org.eclipse.scout.commons.holders.LongHolder;
-import org.eclipse.scout.commons.holders.NVPair;
-import org.eclipse.scout.rt.server.services.common.jdbc.AbstractSqlService;
-import org.eclipse.scout.rt.shared.data.form.AbstractFormData;
-import org.eclipse.scout.rt.shared.data.form.fields.AbstractValueFieldData;
-import org.eclipse.scout.rt.shared.data.form.fields.tablefield.AbstractTableFieldData;
-import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
-
-public class TestStatementProcessor {
-
- public static void main(String[] args) throws Exception {
- new TestStatementProcessor().testSelectLike();
- // new TestStatementProcessor().testFormData();
- // new TestStatementProcessor().testLookupCall();
- // new TestStatementProcessor().testStoredProc();
- }
-
- public void testLookupCall() throws Exception {
- LookupCall call = new LookupCall() {
-
- private static final long serialVersionUID = 1L;
- };
- //
- new StatementProcessor(
- new AbstractSqlService() {
- },
- "SELECT P.PERSON_NR,P.NAME" +
- "FROM PERSON P " +
- "WHERE P.PERSON_NR=:key " +
- "AND P.NAME like '%'||:text||'%'",
- new Object[]{call}).simulate();
- }
-
- public void testSelectLike() throws Exception {
- new StatementProcessor(
- new AbstractSqlService() {
- },
- "SELECT BP_NR FROM FLM_BP WHERE BP_NO LIKE :bpNo INTO :bpNr",
- new Object[]{new NVPair("bpNo", "12"), new NVPair("bpNr", new LongHolder())}).simulate();
- }
-
- public void testFormData() throws Exception {
- IntegerHolder countConcurrent = new IntegerHolder();
- PersonFormData formData = new PersonFormData();
- formData.getAddressTable().addRow();
- formData.getAddressTable().addRow();
- //
- new StatementProcessor(
- new AbstractSqlService() {
- },
- "SELECT COUNT(*) " +
- "FROM PERSON P " +
- "WHERE NVL(:birthdate,TO_DATE('1.1.3000','dd.mm.yyyy')) >= SYSDATE " +
- "AND :name like '%Me%' " +
- "AND :{addressTable.street} like '%Park%' " +
- "INTO :countConcurrent ",
- new Object[]{formData, new NVPair("countConcurrent", countConcurrent)}).simulate();
- }
-
- public void testStoredProc() throws Exception {
- DriverManager.registerDriver((Driver) Class.forName("oracle.jdbc.OracleDriver").newInstance());
- Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@db_bsi4.bsiag.local:1521:BSICRM", "ORSUSER", "ORSUSER");
- //
- IntegerHolder used = new IntegerHolder();
- //
- new StatementProcessor(
- new AbstractSqlService() {
- },
- "DECLARE " +
- " v_used PLS_INTEGER := 2; " +
- "BEGIN " +
- " :[OUT]used := v_used; " +
- "END; ",
- new Object[]{new NVPair("used", used)}
- // ).simulate();
- ).processStoredProcedure(conn, new PreparedStatementCache(10), null);
- System.out.println("used=" + used.getValue());
- }
-
- public static class PersonFormData extends AbstractFormData {
- private static final long serialVersionUID = 1L;
-
- public long getPersonId() {
- return 1;
- }
-
- public Name getName() {
- return getFieldByClass(Name.class);
- }
-
- public Birthdate getBirthdate() {
- return getFieldByClass(Birthdate.class);
- }
-
- public AddressTable getAddressTable() {
- return getFieldByClass(AddressTable.class);
- }
-
- public class Name extends AbstractValueFieldData<String> {
-
- private static final long serialVersionUID = 1L;
- }
-
- public class Birthdate extends AbstractValueFieldData<Date> {
-
- private static final long serialVersionUID = 1L;
- }
-
- public class AddressTable extends AbstractTableFieldData {
-
- private static final long serialVersionUID = 1L;
-
- @Override
- public int getColumnCount() {
- return 2;
- }
-
- @Override
- public Object getValueAt(int row, int column) {
- switch (column) {
- case 0:
- return getAddressId(row);
- case 1:
- return getStreet(row);
- default:
- return null;
- }
- }
-
- @Override
- public void setValueAt(int row, int column, Object value) {
- switch (column) {
- case 0:
- setAddressId(row, (Long) value);
- break;
- case 1:
- setStreet(row, (String) value);
- break;
- }
- }
-
- public Long getAddressId(int row) {
- return (Long) getValueInternal(row, 0);
- }
-
- public void setAddressId(int row, Long addressType) {
- setValueInternal(row, 0, addressType);
- }
-
- public String getStreet(int row) {
- return (String) getValueInternal(row, 1);
- }
-
- public void setStreet(int row, String street) {
- setValueInternal(row, 1, street);
- }
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc.internal.exec;
+
+import java.sql.Connection;
+import java.sql.Driver;
+import java.sql.DriverManager;
+import java.util.Date;
+
+import org.eclipse.scout.commons.holders.IntegerHolder;
+import org.eclipse.scout.commons.holders.LongHolder;
+import org.eclipse.scout.commons.holders.NVPair;
+import org.eclipse.scout.rt.server.services.common.jdbc.AbstractSqlService;
+import org.eclipse.scout.rt.shared.data.form.AbstractFormData;
+import org.eclipse.scout.rt.shared.data.form.fields.AbstractValueFieldData;
+import org.eclipse.scout.rt.shared.data.form.fields.tablefield.AbstractTableFieldData;
+import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
+
+public class TestStatementProcessor {
+
+ public static void main(String[] args) throws Exception {
+ new TestStatementProcessor().testSelectLike();
+ // new TestStatementProcessor().testFormData();
+ // new TestStatementProcessor().testLookupCall();
+ // new TestStatementProcessor().testStoredProc();
+ }
+
+ public void testLookupCall() throws Exception {
+ LookupCall call = new LookupCall() {
+
+ private static final long serialVersionUID = 1L;
+ };
+ //
+ new StatementProcessor(
+ new AbstractSqlService() {
+ },
+ "SELECT P.PERSON_NR,P.NAME" +
+ "FROM PERSON P " +
+ "WHERE P.PERSON_NR=:key " +
+ "AND P.NAME like '%'||:text||'%'",
+ new Object[]{call}).simulate();
+ }
+
+ public void testSelectLike() throws Exception {
+ new StatementProcessor(
+ new AbstractSqlService() {
+ },
+ "SELECT BP_NR FROM FLM_BP WHERE BP_NO LIKE :bpNo INTO :bpNr",
+ new Object[]{new NVPair("bpNo", "12"), new NVPair("bpNr", new LongHolder())}).simulate();
+ }
+
+ public void testFormData() throws Exception {
+ IntegerHolder countConcurrent = new IntegerHolder();
+ PersonFormData formData = new PersonFormData();
+ formData.getAddressTable().addRow();
+ formData.getAddressTable().addRow();
+ //
+ new StatementProcessor(
+ new AbstractSqlService() {
+ },
+ "SELECT COUNT(*) " +
+ "FROM PERSON P " +
+ "WHERE NVL(:birthdate,TO_DATE('1.1.3000','dd.mm.yyyy')) >= SYSDATE " +
+ "AND :name like '%Me%' " +
+ "AND :{addressTable.street} like '%Park%' " +
+ "INTO :countConcurrent ",
+ new Object[]{formData, new NVPair("countConcurrent", countConcurrent)}).simulate();
+ }
+
+ public void testStoredProc() throws Exception {
+ DriverManager.registerDriver((Driver) Class.forName("oracle.jdbc.OracleDriver").newInstance());
+ Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@db_bsi4.bsiag.local:1521:BSICRM", "ORSUSER", "ORSUSER");
+ //
+ IntegerHolder used = new IntegerHolder();
+ //
+ new StatementProcessor(
+ new AbstractSqlService() {
+ },
+ "DECLARE " +
+ " v_used PLS_INTEGER := 2; " +
+ "BEGIN " +
+ " :[OUT]used := v_used; " +
+ "END; ",
+ new Object[]{new NVPair("used", used)}
+ // ).simulate();
+ ).processStoredProcedure(conn, new PreparedStatementCache(10), null);
+ System.out.println("used=" + used.getValue());
+ }
+
+ public static class PersonFormData extends AbstractFormData {
+ private static final long serialVersionUID = 1L;
+
+ public long getPersonId() {
+ return 1;
+ }
+
+ public Name getName() {
+ return getFieldByClass(Name.class);
+ }
+
+ public Birthdate getBirthdate() {
+ return getFieldByClass(Birthdate.class);
+ }
+
+ public AddressTable getAddressTable() {
+ return getFieldByClass(AddressTable.class);
+ }
+
+ public class Name extends AbstractValueFieldData<String> {
+
+ private static final long serialVersionUID = 1L;
+ }
+
+ public class Birthdate extends AbstractValueFieldData<Date> {
+
+ private static final long serialVersionUID = 1L;
+ }
+
+ public class AddressTable extends AbstractTableFieldData {
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public int getColumnCount() {
+ return 2;
+ }
+
+ @Override
+ public Object getValueAt(int row, int column) {
+ switch (column) {
+ case 0:
+ return getAddressId(row);
+ case 1:
+ return getStreet(row);
+ default:
+ return null;
+ }
+ }
+
+ @Override
+ public void setValueAt(int row, int column, Object value) {
+ switch (column) {
+ case 0:
+ setAddressId(row, (Long) value);
+ break;
+ case 1:
+ setStreet(row, (String) value);
+ break;
+ }
+ }
+
+ public Long getAddressId(int row) {
+ return (Long) getValueInternal(row, 0);
+ }
+
+ public void setAddressId(int row, Long addressType) {
+ setValueInternal(row, 0, addressType);
+ }
+
+ public String getStreet(int row) {
+ return (String) getValueInternal(row, 1);
+ }
+
+ public void setStreet(int row, String street) {
+ setValueInternal(row, 1, street);
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/TriStateInput.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/TriStateInput.java
index 95e24f0284..1333c8f806 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/TriStateInput.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/exec/TriStateInput.java
@@ -1,72 +1,72 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc.internal.exec;
-
-import org.eclipse.scout.commons.TriState;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.parsers.token.IToken;
-import org.eclipse.scout.commons.parsers.token.ValueInputToken;
-import org.eclipse.scout.rt.server.services.common.jdbc.SqlBind;
-import org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle;
-
-class TriStateInput implements IBindInput {
- private IBindInput m_delegate;
-
- public TriStateInput(TriState ts, ValueInputToken target) throws ProcessingException {
- if (ts == null || ts.isUndefined()) {
- m_delegate = new ArrayInput(new int[]{0, 1}, target);
- }
- else {
- m_delegate = new SingleInput(ts.getBooleanValue(), Boolean.class, target);
- }
- }
-
- @Override
- public IToken getToken() {
- return m_delegate.getToken();
- }
-
- @Override
- public boolean isBatch() {
- return m_delegate.isBatch();
- }
-
- @Override
- public boolean hasBatch(int i) {
- return m_delegate.hasBatch(i);
- }
-
- @Override
- public void setNextBatchIndex(int i) {
- m_delegate.setNextBatchIndex(i);
- }
-
- @Override
- public boolean isJdbcBind() {
- return m_delegate.isJdbcBind();
- }
-
- @Override
- public int getJdbcBindIndex() {
- return m_delegate.getJdbcBindIndex();
- }
-
- @Override
- public void setJdbcBindIndex(int index) {
- m_delegate.setJdbcBindIndex(index);
- }
-
- @Override
- public SqlBind produceSqlBindAndSetReplaceToken(ISqlStyle sqlStyle) throws ProcessingException {
- return m_delegate.produceSqlBindAndSetReplaceToken(sqlStyle);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc.internal.exec;
+
+import org.eclipse.scout.commons.TriState;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.parsers.token.IToken;
+import org.eclipse.scout.commons.parsers.token.ValueInputToken;
+import org.eclipse.scout.rt.server.services.common.jdbc.SqlBind;
+import org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle;
+
+class TriStateInput implements IBindInput {
+ private IBindInput m_delegate;
+
+ public TriStateInput(TriState ts, ValueInputToken target) throws ProcessingException {
+ if (ts == null || ts.isUndefined()) {
+ m_delegate = new ArrayInput(new int[]{0, 1}, target);
+ }
+ else {
+ m_delegate = new SingleInput(ts.getBooleanValue(), Boolean.class, target);
+ }
+ }
+
+ @Override
+ public IToken getToken() {
+ return m_delegate.getToken();
+ }
+
+ @Override
+ public boolean isBatch() {
+ return m_delegate.isBatch();
+ }
+
+ @Override
+ public boolean hasBatch(int i) {
+ return m_delegate.hasBatch(i);
+ }
+
+ @Override
+ public void setNextBatchIndex(int i) {
+ m_delegate.setNextBatchIndex(i);
+ }
+
+ @Override
+ public boolean isJdbcBind() {
+ return m_delegate.isJdbcBind();
+ }
+
+ @Override
+ public int getJdbcBindIndex() {
+ return m_delegate.getJdbcBindIndex();
+ }
+
+ @Override
+ public void setJdbcBindIndex(int index) {
+ m_delegate.setJdbcBindIndex(index);
+ }
+
+ @Override
+ public SqlBind produceSqlBindAndSetReplaceToken(ISqlStyle sqlStyle) throws ProcessingException {
+ return m_delegate.produceSqlBindAndSetReplaceToken(sqlStyle);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/legacy/LegacyStatementBuilder.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/legacy/LegacyStatementBuilder.java
index fc8de6f42e..9bf6c314b8 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/legacy/LegacyStatementBuilder.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/legacy/LegacyStatementBuilder.java
@@ -1,323 +1,323 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc.internal.legacy;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.scout.commons.holders.NVPair;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle;
-import org.eclipse.scout.rt.shared.data.model.DataModelConstants;
-
-public class LegacyStatementBuilder {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(LegacyStatementBuilder.class);
-
- private ISqlStyle m_sqlStyle;
- private Map<String, Object> m_bindMap;
- private long m_bindSeqNo = 0;
- private StringBuffer m_where;
-
- /**
- * @param sqlStyle
- */
- public LegacyStatementBuilder(ISqlStyle sqlStyle) {
- m_sqlStyle = sqlStyle;
- m_bindMap = new HashMap<String, Object>();
- }
-
- public String resolveComposerAttribute(int op, String attribute, String bindName, Object value) {
- return createComposerAttributeOpPattern(op, attribute, bindName, value);
- }
-
- /**
- * @return the life bind map
- */
- public Map<String, Object> getBindMap() {
- return m_bindMap;
- }
-
- public ISqlStyle getSqlStyle() {
- return m_sqlStyle;
- }
-
- /**
- * Convenience for {@link #getBindMap()}.put(name,value)
- */
- public void addBind(String name, Object value) {
- if (name != null) {
- getBindMap().put(name, value);
- }
- }
-
- /**
- * add sql part the ADD keyword is added (pre-pended) automatically
- */
- public void addWhereToken(String sql) {
- if (sql != null) {
- m_where.append(" AND ");
- addWhere(sql);
- }
- }
-
- /**
- * add sql part with bind references to :S and #S# the ADD keyword is added
- * (pre-pended) automatically
- */
- public void addWhereToken(String sql, Object valueForS) {
- if (sql != null) {
- // create generic bind for S
- String bindName = localizeBindName("S", "__");
- sql = localizeStatement(sql, "S", bindName);
- //
- m_where.append(" AND ");
- addWhere(sql, new NVPair(bindName, valueForS));
- }
- }
-
- /**
- * add sql part with custom binds the ADD keyword is NOT added (pre-pended)
- * automatically
- */
- public void addWhere(String sql, NVPair... customBinds) {
- if (sql != null) {
- m_where.append(sql);
- for (NVPair p : customBinds) {
- addBind(p.getName(), p.getValue());
- }
- }
- }
-
- public String getWhereConstraints() {
- return m_where.toString();
- }
-
- protected long getNextBindSeqNo() {
- return m_bindSeqNo++;
- }
-
- /**
- * Replace bind name by unique bind name so that it is not
- * conflicting with other parts that use the same statement
- * part and bind name. For example S is replaces by __S123.
- */
- protected String localizeBindName(String bindName, String prefix) {
- if (bindName != null) {
- String locName = prefix + bindName + getNextBindSeqNo();
- return locName;
- }
- else {
- return null;
- }
- }
-
- /**
- * Replace bind name in statement
- */
- protected String localizeStatement(String stm, String oldBindName, String newBindName) {
- stm = stm.replaceAll("#" + oldBindName + "#", "#" + newBindName + "#");
- stm = stm.replaceAll("\\&" + oldBindName + "\\&", "&" + newBindName + "&");
- stm = stm.replaceAll(":" + oldBindName + "([^A-Za-z0-9_])", ":" + newBindName + "$1");
- stm = stm.replaceAll(":" + oldBindName + "$", ":" + newBindName);
- return stm;
- }
-
- /**
- * @param bindMap
- * out parameter containing all binds used in the created pattern
- * @return sql text with operation and bind names
- * <p>
- * Simple example for EQ operation
- *
- * <pre>
- * return something in the form of: attribute + &quot;=&quot; + &quot;:&quot; + bindName;
- * </pre>
- */
- protected String createComposerAttributeOpPattern(int op, String attribute, String bindName, Object value) {
- switch (op) {
- case DataModelConstants.OPERATOR_NEQ: {
- getBindMap().put(bindName, value);
- return m_sqlStyle.createNEQ(attribute, bindName);
- }
- case DataModelConstants.OPERATOR_LT: {
- getBindMap().put(bindName, value);
- return m_sqlStyle.createLT(attribute, bindName);
- }
- case DataModelConstants.OPERATOR_LE: {
- getBindMap().put(bindName, value);
- return m_sqlStyle.createLE(attribute, bindName);
- }
- case DataModelConstants.OPERATOR_EQ: {
- getBindMap().put(bindName, value);
- return m_sqlStyle.createEQ(attribute, bindName);
- }
- case DataModelConstants.OPERATOR_GT: {
- getBindMap().put(bindName, value);
- return m_sqlStyle.createGT(attribute, bindName);
- }
- case DataModelConstants.OPERATOR_GE: {
- getBindMap().put(bindName, value);
- return m_sqlStyle.createGE(attribute, bindName);
- }
- case DataModelConstants.OPERATOR_DATE_IS_IN_DAYS: {
- getBindMap().put(bindName, value);
- return m_sqlStyle.createDateIsInDays(attribute, bindName);
- }
- case DataModelConstants.OPERATOR_DATE_IS_IN_GE_DAYS: {
- getBindMap().put(bindName, value);
- return m_sqlStyle.createDateIsInGEDays(attribute, bindName);
- }
- case DataModelConstants.OPERATOR_DATE_IS_IN_GE_MONTHS: {
- getBindMap().put(bindName, value);
- return m_sqlStyle.createDateIsInGEMonths(attribute, bindName);
- }
- case DataModelConstants.OPERATOR_DATE_IS_IN_LE_DAYS: {
- getBindMap().put(bindName, value);
- return m_sqlStyle.createDateIsInLEDays(attribute, bindName);
- }
- case DataModelConstants.OPERATOR_DATE_IS_IN_LE_MONTHS: {
- getBindMap().put(bindName, value);
- return m_sqlStyle.createDateIsInLEMonths(attribute, bindName);
- }
- case DataModelConstants.OPERATOR_DATE_IS_IN_LAST_DAYS: {
- getBindMap().put(bindName, value);
- return m_sqlStyle.createDateIsInLastDays(attribute, bindName);
- }
- case DataModelConstants.OPERATOR_DATE_IS_IN_LAST_MONTHS: {
- getBindMap().put(bindName, value);
- return m_sqlStyle.createDateIsInLastMonths(attribute, bindName);
- }
- case DataModelConstants.OPERATOR_DATE_IS_IN_MONTHS: {
- getBindMap().put(bindName, value);
- return m_sqlStyle.createDateIsInMonths(attribute, bindName);
- }
- case DataModelConstants.OPERATOR_DATE_IS_IN_NEXT_DAYS: {
- getBindMap().put(bindName, value);
- return m_sqlStyle.createDateIsInNextDays(attribute, bindName);
- }
- case DataModelConstants.OPERATOR_DATE_IS_IN_NEXT_MONTHS: {
- getBindMap().put(bindName, value);
- return m_sqlStyle.createDateIsInNextMonths(attribute, bindName);
- }
- case DataModelConstants.OPERATOR_DATE_IS_NOT_TODAY: {
- return m_sqlStyle.createDateIsNotToday(attribute);
- }
- case DataModelConstants.OPERATOR_DATE_IS_TODAY: {
- return m_sqlStyle.createDateIsToday(attribute);
- }
- case DataModelConstants.OPERATOR_DATE_TIME_IS_IN_GE_HOURS: {
- getBindMap().put(bindName, value);
- return m_sqlStyle.createDateTimeIsInGEHours(attribute, bindName);
- }
- case DataModelConstants.OPERATOR_DATE_TIME_IS_IN_GE_MINUTES: {
- getBindMap().put(bindName, value);
- return m_sqlStyle.createDateTimeIsInGEMinutes(attribute, bindName);
- }
- case DataModelConstants.OPERATOR_DATE_TIME_IS_IN_LE_HOURS: {
- getBindMap().put(bindName, value);
- return m_sqlStyle.createDateTimeIsInLEHours(attribute, bindName);
- }
- case DataModelConstants.OPERATOR_DATE_TIME_IS_IN_LE_MINUTES: {
- getBindMap().put(bindName, value);
- return m_sqlStyle.createDateTimeIsInLEMinutes(attribute, bindName);
- }
- case DataModelConstants.OPERATOR_DATE_TIME_IS_NOT_NOW: {
- return m_sqlStyle.createDateTimeIsNotNow(attribute);
- }
- case DataModelConstants.OPERATOR_DATE_TIME_IS_NOW: {
- return m_sqlStyle.createDateTimeIsNow(attribute);
- }
- case DataModelConstants.OPERATOR_ENDS_WITH: {
- getBindMap().put(bindName, m_sqlStyle.toLikePattern(value));
- return m_sqlStyle.createEndsWith(attribute, bindName);
- }
- case DataModelConstants.OPERATOR_NOT_ENDS_WITH: {
- getBindMap().put(bindName, m_sqlStyle.toLikePattern(value));
- return m_sqlStyle.createNotEndsWith(attribute, bindName);
- }
- case DataModelConstants.OPERATOR_IN: {
- getBindMap().put(bindName, value);
- return m_sqlStyle.createIn(attribute, bindName);
- }
- case DataModelConstants.OPERATOR_CONTAINS: {
- getBindMap().put(bindName, m_sqlStyle.toLikePattern(value));
- return m_sqlStyle.createContains(attribute, bindName);
- }
- case DataModelConstants.OPERATOR_LIKE: {
- getBindMap().put(bindName, value);
- return m_sqlStyle.createLike(attribute, bindName);
- }
- case DataModelConstants.OPERATOR_NOT_IN: {
- getBindMap().put(bindName, value);
- return m_sqlStyle.createNotIn(attribute, bindName);
- }
- case DataModelConstants.OPERATOR_NOT_CONTAINS: {
- getBindMap().put(bindName, m_sqlStyle.toLikePattern(value));
- return m_sqlStyle.createNotContains(attribute, bindName);
- }
- case DataModelConstants.OPERATOR_NOT_NULL: {
- return m_sqlStyle.createNotNull(attribute);
- }
- case DataModelConstants.OPERATOR_NUMBER_NOT_NULL: {
- return m_sqlStyle.createNumberNotNull(attribute);
- }
- case DataModelConstants.OPERATOR_NULL: {
- return m_sqlStyle.createNull(attribute);
- }
- case DataModelConstants.OPERATOR_NUMBER_NULL: {
- return m_sqlStyle.createNumberNull(attribute);
- }
- case DataModelConstants.OPERATOR_STARTS_WITH: {
- getBindMap().put(bindName, m_sqlStyle.toLikePattern(value));
- return m_sqlStyle.createStartsWith(attribute, bindName);
- }
- case DataModelConstants.OPERATOR_NOT_STARTS_WITH: {
- getBindMap().put(bindName, m_sqlStyle.toLikePattern(value));
- return m_sqlStyle.createNotStartsWith(attribute, bindName);
- }
- case DataModelConstants.OPERATOR_TIME_IS_IN_GE_HOURS: {
- getBindMap().put(bindName, value);
- return m_sqlStyle.createTimeIsInGEHours(attribute, bindName);
- }
- case DataModelConstants.OPERATOR_TIME_IS_IN_GE_MINUTES: {
- getBindMap().put(bindName, value);
- return m_sqlStyle.createTimeIsInGEMinutes(attribute, bindName);
- }
- case DataModelConstants.OPERATOR_TIME_IS_IN_HOURS: {
- getBindMap().put(bindName, value);
- return m_sqlStyle.createTimeIsInHours(attribute, bindName);
- }
- case DataModelConstants.OPERATOR_TIME_IS_IN_LE_HOURS: {
- getBindMap().put(bindName, value);
- return m_sqlStyle.createTimeIsInLEHours(attribute, bindName);
- }
- case DataModelConstants.OPERATOR_TIME_IS_IN_LE_MINUTES: {
- getBindMap().put(bindName, value);
- return m_sqlStyle.createTimeIsInLEMinutes(attribute, bindName);
- }
- case DataModelConstants.OPERATOR_TIME_IS_IN_MINUTES: {
- getBindMap().put(bindName, value);
- return m_sqlStyle.createTimeIsInMinutes(attribute, bindName);
- }
- case DataModelConstants.OPERATOR_TIME_IS_NOW: {
- return m_sqlStyle.createTimeIsNow(attribute);
- }
- case DataModelConstants.OPERATOR_TIME_IS_NOT_NOW: {
- return m_sqlStyle.createTimeIsNotNow(attribute);
- }
- default: {
- throw new IllegalArgumentException("invalid operator: " + op);
- }
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc.internal.legacy;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.scout.commons.holders.NVPair;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle;
+import org.eclipse.scout.rt.shared.data.model.DataModelConstants;
+
+public class LegacyStatementBuilder {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(LegacyStatementBuilder.class);
+
+ private ISqlStyle m_sqlStyle;
+ private Map<String, Object> m_bindMap;
+ private long m_bindSeqNo = 0;
+ private StringBuffer m_where;
+
+ /**
+ * @param sqlStyle
+ */
+ public LegacyStatementBuilder(ISqlStyle sqlStyle) {
+ m_sqlStyle = sqlStyle;
+ m_bindMap = new HashMap<String, Object>();
+ }
+
+ public String resolveComposerAttribute(int op, String attribute, String bindName, Object value) {
+ return createComposerAttributeOpPattern(op, attribute, bindName, value);
+ }
+
+ /**
+ * @return the life bind map
+ */
+ public Map<String, Object> getBindMap() {
+ return m_bindMap;
+ }
+
+ public ISqlStyle getSqlStyle() {
+ return m_sqlStyle;
+ }
+
+ /**
+ * Convenience for {@link #getBindMap()}.put(name,value)
+ */
+ public void addBind(String name, Object value) {
+ if (name != null) {
+ getBindMap().put(name, value);
+ }
+ }
+
+ /**
+ * add sql part the ADD keyword is added (pre-pended) automatically
+ */
+ public void addWhereToken(String sql) {
+ if (sql != null) {
+ m_where.append(" AND ");
+ addWhere(sql);
+ }
+ }
+
+ /**
+ * add sql part with bind references to :S and #S# the ADD keyword is added
+ * (pre-pended) automatically
+ */
+ public void addWhereToken(String sql, Object valueForS) {
+ if (sql != null) {
+ // create generic bind for S
+ String bindName = localizeBindName("S", "__");
+ sql = localizeStatement(sql, "S", bindName);
+ //
+ m_where.append(" AND ");
+ addWhere(sql, new NVPair(bindName, valueForS));
+ }
+ }
+
+ /**
+ * add sql part with custom binds the ADD keyword is NOT added (pre-pended)
+ * automatically
+ */
+ public void addWhere(String sql, NVPair... customBinds) {
+ if (sql != null) {
+ m_where.append(sql);
+ for (NVPair p : customBinds) {
+ addBind(p.getName(), p.getValue());
+ }
+ }
+ }
+
+ public String getWhereConstraints() {
+ return m_where.toString();
+ }
+
+ protected long getNextBindSeqNo() {
+ return m_bindSeqNo++;
+ }
+
+ /**
+ * Replace bind name by unique bind name so that it is not
+ * conflicting with other parts that use the same statement
+ * part and bind name. For example S is replaces by __S123.
+ */
+ protected String localizeBindName(String bindName, String prefix) {
+ if (bindName != null) {
+ String locName = prefix + bindName + getNextBindSeqNo();
+ return locName;
+ }
+ else {
+ return null;
+ }
+ }
+
+ /**
+ * Replace bind name in statement
+ */
+ protected String localizeStatement(String stm, String oldBindName, String newBindName) {
+ stm = stm.replaceAll("#" + oldBindName + "#", "#" + newBindName + "#");
+ stm = stm.replaceAll("\\&" + oldBindName + "\\&", "&" + newBindName + "&");
+ stm = stm.replaceAll(":" + oldBindName + "([^A-Za-z0-9_])", ":" + newBindName + "$1");
+ stm = stm.replaceAll(":" + oldBindName + "$", ":" + newBindName);
+ return stm;
+ }
+
+ /**
+ * @param bindMap
+ * out parameter containing all binds used in the created pattern
+ * @return sql text with operation and bind names
+ * <p>
+ * Simple example for EQ operation
+ *
+ * <pre>
+ * return something in the form of: attribute + &quot;=&quot; + &quot;:&quot; + bindName;
+ * </pre>
+ */
+ protected String createComposerAttributeOpPattern(int op, String attribute, String bindName, Object value) {
+ switch (op) {
+ case DataModelConstants.OPERATOR_NEQ: {
+ getBindMap().put(bindName, value);
+ return m_sqlStyle.createNEQ(attribute, bindName);
+ }
+ case DataModelConstants.OPERATOR_LT: {
+ getBindMap().put(bindName, value);
+ return m_sqlStyle.createLT(attribute, bindName);
+ }
+ case DataModelConstants.OPERATOR_LE: {
+ getBindMap().put(bindName, value);
+ return m_sqlStyle.createLE(attribute, bindName);
+ }
+ case DataModelConstants.OPERATOR_EQ: {
+ getBindMap().put(bindName, value);
+ return m_sqlStyle.createEQ(attribute, bindName);
+ }
+ case DataModelConstants.OPERATOR_GT: {
+ getBindMap().put(bindName, value);
+ return m_sqlStyle.createGT(attribute, bindName);
+ }
+ case DataModelConstants.OPERATOR_GE: {
+ getBindMap().put(bindName, value);
+ return m_sqlStyle.createGE(attribute, bindName);
+ }
+ case DataModelConstants.OPERATOR_DATE_IS_IN_DAYS: {
+ getBindMap().put(bindName, value);
+ return m_sqlStyle.createDateIsInDays(attribute, bindName);
+ }
+ case DataModelConstants.OPERATOR_DATE_IS_IN_GE_DAYS: {
+ getBindMap().put(bindName, value);
+ return m_sqlStyle.createDateIsInGEDays(attribute, bindName);
+ }
+ case DataModelConstants.OPERATOR_DATE_IS_IN_GE_MONTHS: {
+ getBindMap().put(bindName, value);
+ return m_sqlStyle.createDateIsInGEMonths(attribute, bindName);
+ }
+ case DataModelConstants.OPERATOR_DATE_IS_IN_LE_DAYS: {
+ getBindMap().put(bindName, value);
+ return m_sqlStyle.createDateIsInLEDays(attribute, bindName);
+ }
+ case DataModelConstants.OPERATOR_DATE_IS_IN_LE_MONTHS: {
+ getBindMap().put(bindName, value);
+ return m_sqlStyle.createDateIsInLEMonths(attribute, bindName);
+ }
+ case DataModelConstants.OPERATOR_DATE_IS_IN_LAST_DAYS: {
+ getBindMap().put(bindName, value);
+ return m_sqlStyle.createDateIsInLastDays(attribute, bindName);
+ }
+ case DataModelConstants.OPERATOR_DATE_IS_IN_LAST_MONTHS: {
+ getBindMap().put(bindName, value);
+ return m_sqlStyle.createDateIsInLastMonths(attribute, bindName);
+ }
+ case DataModelConstants.OPERATOR_DATE_IS_IN_MONTHS: {
+ getBindMap().put(bindName, value);
+ return m_sqlStyle.createDateIsInMonths(attribute, bindName);
+ }
+ case DataModelConstants.OPERATOR_DATE_IS_IN_NEXT_DAYS: {
+ getBindMap().put(bindName, value);
+ return m_sqlStyle.createDateIsInNextDays(attribute, bindName);
+ }
+ case DataModelConstants.OPERATOR_DATE_IS_IN_NEXT_MONTHS: {
+ getBindMap().put(bindName, value);
+ return m_sqlStyle.createDateIsInNextMonths(attribute, bindName);
+ }
+ case DataModelConstants.OPERATOR_DATE_IS_NOT_TODAY: {
+ return m_sqlStyle.createDateIsNotToday(attribute);
+ }
+ case DataModelConstants.OPERATOR_DATE_IS_TODAY: {
+ return m_sqlStyle.createDateIsToday(attribute);
+ }
+ case DataModelConstants.OPERATOR_DATE_TIME_IS_IN_GE_HOURS: {
+ getBindMap().put(bindName, value);
+ return m_sqlStyle.createDateTimeIsInGEHours(attribute, bindName);
+ }
+ case DataModelConstants.OPERATOR_DATE_TIME_IS_IN_GE_MINUTES: {
+ getBindMap().put(bindName, value);
+ return m_sqlStyle.createDateTimeIsInGEMinutes(attribute, bindName);
+ }
+ case DataModelConstants.OPERATOR_DATE_TIME_IS_IN_LE_HOURS: {
+ getBindMap().put(bindName, value);
+ return m_sqlStyle.createDateTimeIsInLEHours(attribute, bindName);
+ }
+ case DataModelConstants.OPERATOR_DATE_TIME_IS_IN_LE_MINUTES: {
+ getBindMap().put(bindName, value);
+ return m_sqlStyle.createDateTimeIsInLEMinutes(attribute, bindName);
+ }
+ case DataModelConstants.OPERATOR_DATE_TIME_IS_NOT_NOW: {
+ return m_sqlStyle.createDateTimeIsNotNow(attribute);
+ }
+ case DataModelConstants.OPERATOR_DATE_TIME_IS_NOW: {
+ return m_sqlStyle.createDateTimeIsNow(attribute);
+ }
+ case DataModelConstants.OPERATOR_ENDS_WITH: {
+ getBindMap().put(bindName, m_sqlStyle.toLikePattern(value));
+ return m_sqlStyle.createEndsWith(attribute, bindName);
+ }
+ case DataModelConstants.OPERATOR_NOT_ENDS_WITH: {
+ getBindMap().put(bindName, m_sqlStyle.toLikePattern(value));
+ return m_sqlStyle.createNotEndsWith(attribute, bindName);
+ }
+ case DataModelConstants.OPERATOR_IN: {
+ getBindMap().put(bindName, value);
+ return m_sqlStyle.createIn(attribute, bindName);
+ }
+ case DataModelConstants.OPERATOR_CONTAINS: {
+ getBindMap().put(bindName, m_sqlStyle.toLikePattern(value));
+ return m_sqlStyle.createContains(attribute, bindName);
+ }
+ case DataModelConstants.OPERATOR_LIKE: {
+ getBindMap().put(bindName, value);
+ return m_sqlStyle.createLike(attribute, bindName);
+ }
+ case DataModelConstants.OPERATOR_NOT_IN: {
+ getBindMap().put(bindName, value);
+ return m_sqlStyle.createNotIn(attribute, bindName);
+ }
+ case DataModelConstants.OPERATOR_NOT_CONTAINS: {
+ getBindMap().put(bindName, m_sqlStyle.toLikePattern(value));
+ return m_sqlStyle.createNotContains(attribute, bindName);
+ }
+ case DataModelConstants.OPERATOR_NOT_NULL: {
+ return m_sqlStyle.createNotNull(attribute);
+ }
+ case DataModelConstants.OPERATOR_NUMBER_NOT_NULL: {
+ return m_sqlStyle.createNumberNotNull(attribute);
+ }
+ case DataModelConstants.OPERATOR_NULL: {
+ return m_sqlStyle.createNull(attribute);
+ }
+ case DataModelConstants.OPERATOR_NUMBER_NULL: {
+ return m_sqlStyle.createNumberNull(attribute);
+ }
+ case DataModelConstants.OPERATOR_STARTS_WITH: {
+ getBindMap().put(bindName, m_sqlStyle.toLikePattern(value));
+ return m_sqlStyle.createStartsWith(attribute, bindName);
+ }
+ case DataModelConstants.OPERATOR_NOT_STARTS_WITH: {
+ getBindMap().put(bindName, m_sqlStyle.toLikePattern(value));
+ return m_sqlStyle.createNotStartsWith(attribute, bindName);
+ }
+ case DataModelConstants.OPERATOR_TIME_IS_IN_GE_HOURS: {
+ getBindMap().put(bindName, value);
+ return m_sqlStyle.createTimeIsInGEHours(attribute, bindName);
+ }
+ case DataModelConstants.OPERATOR_TIME_IS_IN_GE_MINUTES: {
+ getBindMap().put(bindName, value);
+ return m_sqlStyle.createTimeIsInGEMinutes(attribute, bindName);
+ }
+ case DataModelConstants.OPERATOR_TIME_IS_IN_HOURS: {
+ getBindMap().put(bindName, value);
+ return m_sqlStyle.createTimeIsInHours(attribute, bindName);
+ }
+ case DataModelConstants.OPERATOR_TIME_IS_IN_LE_HOURS: {
+ getBindMap().put(bindName, value);
+ return m_sqlStyle.createTimeIsInLEHours(attribute, bindName);
+ }
+ case DataModelConstants.OPERATOR_TIME_IS_IN_LE_MINUTES: {
+ getBindMap().put(bindName, value);
+ return m_sqlStyle.createTimeIsInLEMinutes(attribute, bindName);
+ }
+ case DataModelConstants.OPERATOR_TIME_IS_IN_MINUTES: {
+ getBindMap().put(bindName, value);
+ return m_sqlStyle.createTimeIsInMinutes(attribute, bindName);
+ }
+ case DataModelConstants.OPERATOR_TIME_IS_NOW: {
+ return m_sqlStyle.createTimeIsNow(attribute);
+ }
+ case DataModelConstants.OPERATOR_TIME_IS_NOT_NOW: {
+ return m_sqlStyle.createTimeIsNotNow(attribute);
+ }
+ default: {
+ throw new IllegalArgumentException("invalid operator: " + op);
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/pool/ConnectionCloseThread.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/pool/ConnectionCloseThread.java
index 94534ae33c..cc7bce8315 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/pool/ConnectionCloseThread.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/pool/ConnectionCloseThread.java
@@ -1,42 +1,42 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc.internal.pool;
-
-import java.sql.Connection;
-import java.sql.SQLException;
-
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-
-class ConnectionCloseThread extends Thread {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(SqlConnectionPool.class);
-
- private Connection m_conn;
-
- public ConnectionCloseThread(String name, Connection conn) {
- super(name);
- m_conn = conn;
- setDaemon(true);
- }
-
- @Override
- public void run() {
- if (LOG.isInfoEnabled()) {
- LOG.info("close connection " + m_conn);
- }
- try {
- m_conn.close();
- }
- catch (SQLException e) {
- LOG.error("connection: " + m_conn, e);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc.internal.pool;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+
+class ConnectionCloseThread extends Thread {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(SqlConnectionPool.class);
+
+ private Connection m_conn;
+
+ public ConnectionCloseThread(String name, Connection conn) {
+ super(name);
+ m_conn = conn;
+ setDaemon(true);
+ }
+
+ @Override
+ public void run() {
+ if (LOG.isInfoEnabled()) {
+ LOG.info("close connection " + m_conn);
+ }
+ try {
+ m_conn.close();
+ }
+ catch (SQLException e) {
+ LOG.error("connection: " + m_conn, e);
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/pool/PoolEntry.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/pool/PoolEntry.java
index 55463ef836..e3b6ab96ae 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/pool/PoolEntry.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/pool/PoolEntry.java
@@ -1,20 +1,20 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc.internal.pool;
-
-import java.sql.Connection;
-
-class PoolEntry {
- public Connection conn;
- public long createTime;
- public long leaseBegin;
- public int leaseCount;
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc.internal.pool;
+
+import java.sql.Connection;
+
+class PoolEntry {
+ public Connection conn;
+ public long createTime;
+ public long leaseBegin;
+ public int leaseCount;
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/pool/SqlConnectionBuilder.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/pool/SqlConnectionBuilder.java
index e7644a3efe..535ee56a93 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/pool/SqlConnectionBuilder.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/pool/SqlConnectionBuilder.java
@@ -1,127 +1,127 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc.internal.pool;
-
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.SQLException;
-import java.util.Hashtable;
-import java.util.Properties;
-import java.util.StringTokenizer;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import javax.sql.DataSource;
-
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.server.services.common.jdbc.AbstractSqlService;
-
-public class SqlConnectionBuilder {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(SqlConnectionBuilder.class);
-
- public Connection createJdbcConnection(AbstractSqlService sqlService) throws ClassNotFoundException, SQLException, InstantiationException, IllegalAccessException {
- String user = sqlService.getUsername();
- String pass = sqlService.getPassword();
- Class.forName(sqlService.getJdbcDriverName());
- //
- Connection conn;
- if (user != null && pass != null) {
- conn = DriverManager.getConnection(sqlService.getJdbcMappingName(), user, pass);
- }
- else {
- Properties p = null;
- String s = sqlService.getJdbcProperties();
- if (s != null && s.trim().length() == 0) {
- s = null;
- }
- if (s != null) {
- p = new Properties();
- StringTokenizer tok = new StringTokenizer(s, ";");
- while (tok.hasMoreTokens()) {
- String t = tok.nextToken();
- StringTokenizer tok2 = new StringTokenizer(t, "=");
- String n = tok2.nextToken();
- String v = tok2.nextToken();
- p.setProperty(n, v);
- }
- }
- if (p != null) {
- conn = DriverManager.getConnection(sqlService.getJdbcMappingName(), p);
- }
- else {
- conn = DriverManager.getConnection(sqlService.getJdbcMappingName());
- }
- }
- conn.setAutoCommit(false);
- return conn;
- }
-
- public Connection createJndiConnection(AbstractSqlService sqlService) throws NamingException, SQLException {
- InitialContext initialContext = null;
- try {
- String user = sqlService.getUsername();
- String pass = sqlService.getPassword();
- String jndiName = sqlService.getJndiName();
- String jndiInitialContextFactory = sqlService.getJndiInitialContextFactory();
- String jndiProviderUrl = sqlService.getJndiProviderUrl();
- String jndiUrlPkgPrefixes = sqlService.getJndiUrlPkgPrefixes();
- if (LOG.isInfoEnabled()) {
- LOG.info("Opening rmi connection to: " + jndiName + "," + user);
- }
- if (LOG.isInfoEnabled()) {
- LOG.info(" using initial context factory: " + jndiInitialContextFactory);
- }
- if (LOG.isInfoEnabled()) {
- LOG.info(" using provider url: " + jndiProviderUrl);
- }
- Hashtable<String, String> ht = new Hashtable<String, String>();
- if (jndiInitialContextFactory != null) {
- ht.put(Context.INITIAL_CONTEXT_FACTORY, jndiInitialContextFactory);
- }
- if (jndiProviderUrl != null) {
- ht.put(Context.PROVIDER_URL, jndiProviderUrl);
- }
- if (jndiUrlPkgPrefixes != null) {
- ht.put(Context.URL_PKG_PREFIXES, jndiUrlPkgPrefixes);
- }
- DataSource dataSource = null;
- if (ht.size() > 0) {
- initialContext = new InitialContext(ht);
- }
- else {
- initialContext = new InitialContext();
- }
- dataSource = (DataSource) initialContext.lookup(jndiName);
- // Grab a connection
- Connection conn;
- if (user != null && pass != null) {
- conn = dataSource.getConnection(user, pass);
- }
- else {
- conn = dataSource.getConnection();
- }
- conn.setAutoCommit(false);
- return conn;
- }
- finally {
- if (initialContext != null) {
- try {
- initialContext.close();
- }
- catch (Exception e) {
- }
- }
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc.internal.pool;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.util.Hashtable;
+import java.util.Properties;
+import java.util.StringTokenizer;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.sql.DataSource;
+
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.server.services.common.jdbc.AbstractSqlService;
+
+public class SqlConnectionBuilder {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(SqlConnectionBuilder.class);
+
+ public Connection createJdbcConnection(AbstractSqlService sqlService) throws ClassNotFoundException, SQLException, InstantiationException, IllegalAccessException {
+ String user = sqlService.getUsername();
+ String pass = sqlService.getPassword();
+ Class.forName(sqlService.getJdbcDriverName());
+ //
+ Connection conn;
+ if (user != null && pass != null) {
+ conn = DriverManager.getConnection(sqlService.getJdbcMappingName(), user, pass);
+ }
+ else {
+ Properties p = null;
+ String s = sqlService.getJdbcProperties();
+ if (s != null && s.trim().length() == 0) {
+ s = null;
+ }
+ if (s != null) {
+ p = new Properties();
+ StringTokenizer tok = new StringTokenizer(s, ";");
+ while (tok.hasMoreTokens()) {
+ String t = tok.nextToken();
+ StringTokenizer tok2 = new StringTokenizer(t, "=");
+ String n = tok2.nextToken();
+ String v = tok2.nextToken();
+ p.setProperty(n, v);
+ }
+ }
+ if (p != null) {
+ conn = DriverManager.getConnection(sqlService.getJdbcMappingName(), p);
+ }
+ else {
+ conn = DriverManager.getConnection(sqlService.getJdbcMappingName());
+ }
+ }
+ conn.setAutoCommit(false);
+ return conn;
+ }
+
+ public Connection createJndiConnection(AbstractSqlService sqlService) throws NamingException, SQLException {
+ InitialContext initialContext = null;
+ try {
+ String user = sqlService.getUsername();
+ String pass = sqlService.getPassword();
+ String jndiName = sqlService.getJndiName();
+ String jndiInitialContextFactory = sqlService.getJndiInitialContextFactory();
+ String jndiProviderUrl = sqlService.getJndiProviderUrl();
+ String jndiUrlPkgPrefixes = sqlService.getJndiUrlPkgPrefixes();
+ if (LOG.isInfoEnabled()) {
+ LOG.info("Opening rmi connection to: " + jndiName + "," + user);
+ }
+ if (LOG.isInfoEnabled()) {
+ LOG.info(" using initial context factory: " + jndiInitialContextFactory);
+ }
+ if (LOG.isInfoEnabled()) {
+ LOG.info(" using provider url: " + jndiProviderUrl);
+ }
+ Hashtable<String, String> ht = new Hashtable<String, String>();
+ if (jndiInitialContextFactory != null) {
+ ht.put(Context.INITIAL_CONTEXT_FACTORY, jndiInitialContextFactory);
+ }
+ if (jndiProviderUrl != null) {
+ ht.put(Context.PROVIDER_URL, jndiProviderUrl);
+ }
+ if (jndiUrlPkgPrefixes != null) {
+ ht.put(Context.URL_PKG_PREFIXES, jndiUrlPkgPrefixes);
+ }
+ DataSource dataSource = null;
+ if (ht.size() > 0) {
+ initialContext = new InitialContext(ht);
+ }
+ else {
+ initialContext = new InitialContext();
+ }
+ dataSource = (DataSource) initialContext.lookup(jndiName);
+ // Grab a connection
+ Connection conn;
+ if (user != null && pass != null) {
+ conn = dataSource.getConnection(user, pass);
+ }
+ else {
+ conn = dataSource.getConnection();
+ }
+ conn.setAutoCommit(false);
+ return conn;
+ }
+ finally {
+ if (initialContext != null) {
+ try {
+ initialContext.close();
+ }
+ catch (Exception e) {
+ }
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/pool/SqlConnectionPool.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/pool/SqlConnectionPool.java
index 86fb7d1353..595c52f4c7 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/pool/SqlConnectionPool.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/internal/pool/SqlConnectionPool.java
@@ -1,276 +1,276 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc.internal.pool;
-
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.server.services.common.jdbc.AbstractSqlService;
-import org.eclipse.scout.service.IServiceInventory;
-
-/**
- * System-wide connection pool for pooling connections There is one pool for
- * every ISqlService sub class type If possible, every scout Session is provided
- * with always the same connection it had in the last request this class is
- * thread-safe
- */
-public final class SqlConnectionPool {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(SqlConnectionPool.class);
-
- /*
- * Pool factory per service type (top-level class)
- */
- private static Object poolStoreLock = new Object();
- private static HashMap<Class, SqlConnectionPool> poolStore = new HashMap<Class, SqlConnectionPool>();
-
- public static SqlConnectionPool getPool(Class serviceType, int poolSize, long connectionLifetime, long connectionBusyTimeout) {
- synchronized (poolStoreLock) {
- SqlConnectionPool pool = poolStore.get(serviceType);
- if (pool == null) {
- pool = new SqlConnectionPool(serviceType, poolSize, connectionLifetime, connectionBusyTimeout);
- poolStore.put(serviceType, pool);
- }
- return pool;
- }
- }
-
- /*
- * Instance
- */
- private Object m_poolLock = new Object();
- private HashSet<PoolEntry> m_idleEntries = new HashSet<PoolEntry>();
- private HashSet<PoolEntry> m_busyEntries = new HashSet<PoolEntry>();
- //
- private Class m_serviceType;
- private int m_poolSize;
- private long m_connectionLifetime;
- private long m_connectionBusyTimeout;
-
- private SqlConnectionPool(Class serviceType, int poolSize, long connectionLifetime, long connectionBusyTimeout) {
- m_serviceType = serviceType;
- m_poolSize = poolSize;
- m_connectionLifetime = connectionLifetime;
- m_connectionBusyTimeout = connectionBusyTimeout;
- Thread t = new Thread("SqlConnectionPool[" + m_serviceType.getName() + "].managePool") {
- @Override
- public void run() {
- while (true) {
- try {
- Thread.sleep(60000L);
- }
- catch (InterruptedException ie) {
- }
- managePool();
- }
- }
- };
- t.setDaemon(true);
- t.start();
- }
-
- public Connection leaseConnection(AbstractSqlService service) throws Exception {
- managePool();
- synchronized (m_poolLock) {
- PoolEntry candidate = null;
- while (candidate == null) {
- if (candidate == null) {
- // get next available conn
- for (Iterator it = m_idleEntries.iterator(); it.hasNext();) {
- candidate = (PoolEntry) it.next();
- break;
- }
- }
- if (candidate == null) {
- if (m_idleEntries.size() + m_busyEntries.size() < m_poolSize) {
- // create new connection
- PoolEntry test = new PoolEntry();
- test.conn = new SqlConnectionBuilder().createJdbcConnection(service);
- if (LOG.isInfoEnabled()) {
- LOG.info("created jdbc connection " + test.conn);
- }
- service.callbackAfterConnectionCreated(test.conn);
- test.createTime = System.currentTimeMillis();
- m_idleEntries.add(test);
- candidate = test;
- }
- }
- if (candidate == null) {
- // wait
- try {
- m_poolLock.wait();
- }
- catch (InterruptedException ie) {
- throw ie;
- }
- }
- // test candidate connection
- if (candidate != null) {
- try {
- service.callbackTestConnection(candidate.conn);
- }
- catch (Throwable t) {
- // remove candidate from idle pool and close it
- m_idleEntries.remove(candidate);
- LOG.warn("closing dirty connection: " + candidate.conn);
- try {
- candidate.conn.close();
- }
- catch (Throwable fatal) {
- }
- candidate = null;
- }
- }
- }// end while
- // move to busy pool
- m_idleEntries.remove(candidate);
- candidate.leaseBegin = System.currentTimeMillis();
- candidate.leaseCount++;
- m_busyEntries.add(candidate);
- if (LOG.isDebugEnabled()) {
- LOG.debug("lease " + candidate.conn);
- }
- return candidate.conn;
- }
- }
-
- public void releaseConnection(Connection conn) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("release " + conn);
- }
- synchronized (m_poolLock) {
- PoolEntry candidate = null;
- for (Iterator it = m_busyEntries.iterator(); it.hasNext();) {
- PoolEntry e = (PoolEntry) it.next();
- if (e.conn == conn) {
- candidate = e;
- it.remove();
- break;
- }
- }
- // check close status of connection
- if (candidate != null) {
- try {
- if (candidate.conn.isClosed()) {
- candidate = null;
- }
- }
- catch (Throwable e) {
- // ignore
- candidate = null;
- }
- }
- // check error status of connection
- if (candidate != null) {
- try {
- if (candidate.conn.getWarnings() != null) {
- /*
- * connection is normally valid again after clearing the warnings.
- * Since oracle is not supporting warnings, the subsequent call has no effect!
- */
- candidate.conn.clearWarnings();
- // candidate=null;
- }
- }
- catch (Throwable e) {
- // ignore
- candidate = null;
- }
- }
- // all checks passed, candidate is either non-null or null, in the latter
- // case conn is a dirty connection
- // back to idle pool
- if (candidate != null) {
- // move to idle pool
- candidate.leaseBegin = 0;
- m_idleEntries.add(candidate);
- }
- else {
- LOG.warn("closing dirty connection: " + conn);
- try {
- conn.close();
- }
- catch (SQLException e) {
- // ignored
- }
- }
- m_poolLock.notifyAll();
- }
- managePool();
- }
-
- public IServiceInventory getInventory() {
- StringBuffer buf = new StringBuffer();
- synchronized (m_poolLock) {
- SimpleDateFormat fmt = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss.SSSS");
- buf.append("Total connections: " + (m_busyEntries.size() + m_idleEntries.size()));
- buf.append("\n");
- buf.append("Busy: " + m_busyEntries.size());
- buf.append("\n");
- for (PoolEntry e : m_busyEntries) {
- buf.append(" class=" + e.conn.getClass().getName() + ", created=" + fmt.format(new Date(e.createTime)) + ", leaseCount=" + e.leaseCount + ", leaseBegin=" + fmt.format(new Date(e.leaseBegin)));
- buf.append("\n");
- }
- buf.append("Idle: " + m_idleEntries.size());
- buf.append("\n");
- for (PoolEntry e : m_idleEntries) {
- buf.append(" class=" + e.conn.getClass().getName() + ", created=" + fmt.format(new Date(e.createTime)) + ", leaseCount=" + e.leaseCount);
- buf.append("\n");
- }
- }
- final String f = buf.toString();
- return new IServiceInventory() {
- @Override
- public String getInventory() {
- return new String(f);
- }
- };
- }
-
- /**
- * Thread worker to manage pool
- */
- private void managePool() {
- try {
- synchronized (m_poolLock) {
- // close old idle connections
- for (Iterator it = m_idleEntries.iterator(); it.hasNext();) {
- PoolEntry e = (PoolEntry) it.next();
- if (System.currentTimeMillis() - e.createTime > m_connectionLifetime) {
- ConnectionCloseThread t = new ConnectionCloseThread("CloseOldIdleConnection for " + m_serviceType.getName(), e.conn);
- t.start();
- e.conn = null;
- it.remove();
- }
- }
- // close timed out busy connections
- for (Iterator it = m_busyEntries.iterator(); it.hasNext();) {
- PoolEntry e = (PoolEntry) it.next();
- if (System.currentTimeMillis() - e.leaseBegin > m_connectionBusyTimeout) {
- ConnectionCloseThread t = new ConnectionCloseThread("CloseTimeoutBusyConnection for " + m_serviceType.getName(), e.conn);
- t.start();
- e.conn = null;
- it.remove();
- }
- }
- }
- }
- catch (Throwable t) {
- LOG.warn(null, t);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc.internal.pool;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.server.services.common.jdbc.AbstractSqlService;
+import org.eclipse.scout.service.IServiceInventory;
+
+/**
+ * System-wide connection pool for pooling connections There is one pool for
+ * every ISqlService sub class type If possible, every scout Session is provided
+ * with always the same connection it had in the last request this class is
+ * thread-safe
+ */
+public final class SqlConnectionPool {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(SqlConnectionPool.class);
+
+ /*
+ * Pool factory per service type (top-level class)
+ */
+ private static Object poolStoreLock = new Object();
+ private static HashMap<Class, SqlConnectionPool> poolStore = new HashMap<Class, SqlConnectionPool>();
+
+ public static SqlConnectionPool getPool(Class serviceType, int poolSize, long connectionLifetime, long connectionBusyTimeout) {
+ synchronized (poolStoreLock) {
+ SqlConnectionPool pool = poolStore.get(serviceType);
+ if (pool == null) {
+ pool = new SqlConnectionPool(serviceType, poolSize, connectionLifetime, connectionBusyTimeout);
+ poolStore.put(serviceType, pool);
+ }
+ return pool;
+ }
+ }
+
+ /*
+ * Instance
+ */
+ private Object m_poolLock = new Object();
+ private HashSet<PoolEntry> m_idleEntries = new HashSet<PoolEntry>();
+ private HashSet<PoolEntry> m_busyEntries = new HashSet<PoolEntry>();
+ //
+ private Class m_serviceType;
+ private int m_poolSize;
+ private long m_connectionLifetime;
+ private long m_connectionBusyTimeout;
+
+ private SqlConnectionPool(Class serviceType, int poolSize, long connectionLifetime, long connectionBusyTimeout) {
+ m_serviceType = serviceType;
+ m_poolSize = poolSize;
+ m_connectionLifetime = connectionLifetime;
+ m_connectionBusyTimeout = connectionBusyTimeout;
+ Thread t = new Thread("SqlConnectionPool[" + m_serviceType.getName() + "].managePool") {
+ @Override
+ public void run() {
+ while (true) {
+ try {
+ Thread.sleep(60000L);
+ }
+ catch (InterruptedException ie) {
+ }
+ managePool();
+ }
+ }
+ };
+ t.setDaemon(true);
+ t.start();
+ }
+
+ public Connection leaseConnection(AbstractSqlService service) throws Exception {
+ managePool();
+ synchronized (m_poolLock) {
+ PoolEntry candidate = null;
+ while (candidate == null) {
+ if (candidate == null) {
+ // get next available conn
+ for (Iterator it = m_idleEntries.iterator(); it.hasNext();) {
+ candidate = (PoolEntry) it.next();
+ break;
+ }
+ }
+ if (candidate == null) {
+ if (m_idleEntries.size() + m_busyEntries.size() < m_poolSize) {
+ // create new connection
+ PoolEntry test = new PoolEntry();
+ test.conn = new SqlConnectionBuilder().createJdbcConnection(service);
+ if (LOG.isInfoEnabled()) {
+ LOG.info("created jdbc connection " + test.conn);
+ }
+ service.callbackAfterConnectionCreated(test.conn);
+ test.createTime = System.currentTimeMillis();
+ m_idleEntries.add(test);
+ candidate = test;
+ }
+ }
+ if (candidate == null) {
+ // wait
+ try {
+ m_poolLock.wait();
+ }
+ catch (InterruptedException ie) {
+ throw ie;
+ }
+ }
+ // test candidate connection
+ if (candidate != null) {
+ try {
+ service.callbackTestConnection(candidate.conn);
+ }
+ catch (Throwable t) {
+ // remove candidate from idle pool and close it
+ m_idleEntries.remove(candidate);
+ LOG.warn("closing dirty connection: " + candidate.conn);
+ try {
+ candidate.conn.close();
+ }
+ catch (Throwable fatal) {
+ }
+ candidate = null;
+ }
+ }
+ }// end while
+ // move to busy pool
+ m_idleEntries.remove(candidate);
+ candidate.leaseBegin = System.currentTimeMillis();
+ candidate.leaseCount++;
+ m_busyEntries.add(candidate);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("lease " + candidate.conn);
+ }
+ return candidate.conn;
+ }
+ }
+
+ public void releaseConnection(Connection conn) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("release " + conn);
+ }
+ synchronized (m_poolLock) {
+ PoolEntry candidate = null;
+ for (Iterator it = m_busyEntries.iterator(); it.hasNext();) {
+ PoolEntry e = (PoolEntry) it.next();
+ if (e.conn == conn) {
+ candidate = e;
+ it.remove();
+ break;
+ }
+ }
+ // check close status of connection
+ if (candidate != null) {
+ try {
+ if (candidate.conn.isClosed()) {
+ candidate = null;
+ }
+ }
+ catch (Throwable e) {
+ // ignore
+ candidate = null;
+ }
+ }
+ // check error status of connection
+ if (candidate != null) {
+ try {
+ if (candidate.conn.getWarnings() != null) {
+ /*
+ * connection is normally valid again after clearing the warnings.
+ * Since oracle is not supporting warnings, the subsequent call has no effect!
+ */
+ candidate.conn.clearWarnings();
+ // candidate=null;
+ }
+ }
+ catch (Throwable e) {
+ // ignore
+ candidate = null;
+ }
+ }
+ // all checks passed, candidate is either non-null or null, in the latter
+ // case conn is a dirty connection
+ // back to idle pool
+ if (candidate != null) {
+ // move to idle pool
+ candidate.leaseBegin = 0;
+ m_idleEntries.add(candidate);
+ }
+ else {
+ LOG.warn("closing dirty connection: " + conn);
+ try {
+ conn.close();
+ }
+ catch (SQLException e) {
+ // ignored
+ }
+ }
+ m_poolLock.notifyAll();
+ }
+ managePool();
+ }
+
+ public IServiceInventory getInventory() {
+ StringBuffer buf = new StringBuffer();
+ synchronized (m_poolLock) {
+ SimpleDateFormat fmt = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss.SSSS");
+ buf.append("Total connections: " + (m_busyEntries.size() + m_idleEntries.size()));
+ buf.append("\n");
+ buf.append("Busy: " + m_busyEntries.size());
+ buf.append("\n");
+ for (PoolEntry e : m_busyEntries) {
+ buf.append(" class=" + e.conn.getClass().getName() + ", created=" + fmt.format(new Date(e.createTime)) + ", leaseCount=" + e.leaseCount + ", leaseBegin=" + fmt.format(new Date(e.leaseBegin)));
+ buf.append("\n");
+ }
+ buf.append("Idle: " + m_idleEntries.size());
+ buf.append("\n");
+ for (PoolEntry e : m_idleEntries) {
+ buf.append(" class=" + e.conn.getClass().getName() + ", created=" + fmt.format(new Date(e.createTime)) + ", leaseCount=" + e.leaseCount);
+ buf.append("\n");
+ }
+ }
+ final String f = buf.toString();
+ return new IServiceInventory() {
+ @Override
+ public String getInventory() {
+ return new String(f);
+ }
+ };
+ }
+
+ /**
+ * Thread worker to manage pool
+ */
+ private void managePool() {
+ try {
+ synchronized (m_poolLock) {
+ // close old idle connections
+ for (Iterator it = m_idleEntries.iterator(); it.hasNext();) {
+ PoolEntry e = (PoolEntry) it.next();
+ if (System.currentTimeMillis() - e.createTime > m_connectionLifetime) {
+ ConnectionCloseThread t = new ConnectionCloseThread("CloseOldIdleConnection for " + m_serviceType.getName(), e.conn);
+ t.start();
+ e.conn = null;
+ it.remove();
+ }
+ }
+ // close timed out busy connections
+ for (Iterator it = m_busyEntries.iterator(); it.hasNext();) {
+ PoolEntry e = (PoolEntry) it.next();
+ if (System.currentTimeMillis() - e.leaseBegin > m_connectionBusyTimeout) {
+ ConnectionCloseThread t = new ConnectionCloseThread("CloseTimeoutBusyConnection for " + m_serviceType.getName(), e.conn);
+ t.start();
+ e.conn = null;
+ it.remove();
+ }
+ }
+ }
+ }
+ catch (Throwable t) {
+ LOG.warn(null, t);
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/style/AbstractSqlStyle.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/style/AbstractSqlStyle.java
index d483cfeb1a..97d861b6fd 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/style/AbstractSqlStyle.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/style/AbstractSqlStyle.java
@@ -1,1027 +1,1027 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc.style;
-
-import java.io.ByteArrayInputStream;
-import java.io.Reader;
-import java.io.StringReader;
-import java.lang.reflect.Array;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.sql.Blob;
-import java.sql.CallableStatement;
-import java.sql.Clob;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.ResultSetMetaData;
-import java.sql.SQLException;
-import java.sql.Timestamp;
-import java.sql.Types;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Collection;
-import java.util.Date;
-
-import org.eclipse.scout.commons.IOUtility;
-import org.eclipse.scout.commons.TriState;
-import org.eclipse.scout.commons.TypeCastUtility;
-import org.eclipse.scout.commons.holders.IHolder;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.server.services.common.jdbc.SqlBind;
-
-public abstract class AbstractSqlStyle implements ISqlStyle {
- private static final long serialVersionUID = 1L;
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractSqlStyle.class);
-
- @Override
- public String getConcatOp() {
- return "||";
- }
-
- @Override
- public String getLikeWildcard() {
- return "%";
- }
-
- @Override
- public String toLikePattern(Object value) {
- String s = (value != null ? value.toString() : "");
- s = s.replace("*", getLikeWildcard());
- return s;
- }
-
- @Override
- public String toPlainText(Object value) {
- if (value instanceof IHolder) {
- value = ((IHolder) value).getValue();
- }
- //
- if (value == null) {
- return "null";
- }
- else if (value instanceof Boolean) {
- Boolean b = (Boolean) value;
- return b ? "1" : "0";
- }
- else if (value instanceof TriState) {
- TriState t = (TriState) value;
- return "" + t.toString();
- }
- else if (value instanceof String) {
- String s = (String) value;
- if (s.length() > 4000) {
- s = s.substring(0, 4000);
- LOG.warn("toPlainText of a String with more than 4000 characters failed; truncated to '" + s + "'");
- return "'" + s.replaceAll("'", "''") + "'";
- }
- return "'" + s.replaceAll("'", "''") + "'";
- }
- else if (value instanceof char[]) {
- if (((char[]) value).length > 4000) {
- String s = new String((char[]) value, 0, 4000);
- LOG.warn("toPlainText of a CLOB with more than 4000 characters failed; truncated to '" + s + "'");
- return "'" + s.replaceAll("'", "''") + "'";
- }
- String s = new String((char[]) value);
- return "'" + s.replaceAll("'", "''") + "'";
- }
- else if (value instanceof byte[]) {
- LOG.warn("toPlainText of a BLOB failed; using NULL");
- return "NULL";
- }
- else if (value instanceof Date) {
- Date d = (Date) value;
- SimpleDateFormat fmt = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
- return "to_date('" + fmt.format(d) + "','dd.mm.yyyy hh24:mi:ss')";
- }
- else if (value instanceof Collection || value.getClass().isArray()) {
- Object array;
- if (value instanceof Collection) {
- array = ((Collection) value).toArray();
- }
- else {
- array = value;
- }
- int n = Array.getLength(array);
- StringBuffer buf = new StringBuffer();
- buf.append("(");
- if (n > 0) {
- for (int i = 0; i < n; i++) {
- if (i > 0) {
- buf.append(",");
- }
- buf.append(toPlainText(Array.get(array, i)));
- }
- }
- else {
- buf.append("-1");
- }
- buf.append(")");
- return buf.toString();
- }
- else {
- return value.toString();
- }
- }
-
- @Override
- public String toAggregationAvg(String attribute) {
- return "AVG(" + attribute + ")";
- }
-
- @Override
- public String toAggregationCount(String attribute) {
- return "COUNT(" + attribute + ")";
- }
-
- @Override
- public String toAggregationMax(String attribute) {
- return "MAX(" + attribute + ")";
- }
-
- @Override
- public String toAggregationMedian(String attribute) {
- return "MEDIAN(" + attribute + ")";
- }
-
- @Override
- public String toAggregationMin(String attribute) {
- return "MIN(" + attribute + ")";
- }
-
- @Override
- public String toAggregationSum(String attribute) {
- return "SUM(" + attribute + ")";
- }
-
- @Override
- public SqlBind buildBindFor(Object o, Class nullType) {
- if (o instanceof IHolder) {
- IHolder h = (IHolder) o;
- o = h.getValue();
- nullType = h.getHolderType();
- }
- //
- Class c;
- if (o != null) {
- c = o.getClass();
- }
- else {
- if (nullType != null && IHolder.class.isAssignableFrom(nullType)) {
- try {
- nullType = TypeCastUtility.getGenericsParameterClass(nullType, IHolder.class);
- }
- catch (Throwable t) {
- nullType = null;
- }
- }
- c = nullType;
- }
- //
- if (o == null && c == null) {
- return new SqlBind(Types.NULL, o);
- }
- //
- if (Timestamp.class.isAssignableFrom(c)) {
- return new SqlBind(Types.TIMESTAMP, o);
- }
- else if (java.sql.Date.class.isAssignableFrom(c)) {
- return new SqlBind(Types.DATE, o);
- }
- else if (Calendar.class.isAssignableFrom(c)) {
- if (o == null) {
- return new SqlBind(Types.TIMESTAMP, o);
- }
- else {
- return new SqlBind(Types.TIMESTAMP, new Timestamp(((Calendar) o).getTimeInMillis()));
- }
- }
- else if (java.util.Date.class.isAssignableFrom(c)) {
- if (o == null) {
- return new SqlBind(Types.TIMESTAMP, o);
- }
- else {
- return new SqlBind(Types.TIMESTAMP, new Timestamp(((Date) o).getTime()));
- }
- }
- else if (Double.class.isAssignableFrom(c)) {
- return new SqlBind(Types.DOUBLE, o);
- }
- else if (Float.class.isAssignableFrom(c)) {
- return new SqlBind(Types.FLOAT, o);
- }
- else if (Integer.class.isAssignableFrom(c)) {
- return new SqlBind(Types.INTEGER, o);
- }
- else if (Long.class.isAssignableFrom(c)) {
- return new SqlBind(Types.BIGINT, o);
- }
- else if (BigInteger.class.isAssignableFrom(c)) {
- return new SqlBind(Types.BIGINT, o);
- }
- else if (BigDecimal.class.isAssignableFrom(c)) {
- return new SqlBind(Types.NUMERIC, o);
- }
- else if (String.class.isAssignableFrom(c) || char[].class == c) {
- if (o == null) {
- return new SqlBind(Types.VARCHAR, o);
- }
- else {
- String s;
- boolean large;
- if (String.class.isAssignableFrom(c)) {
- s = (String) o;
- large = isLargeString(s);
- }
- else {
- // char[] binds are always treated as lobs
- s = new String((char[]) o);
- large = true;
- }
- if (large) {
- if (isClobEnabled()) {
- return new SqlBind(Types.CLOB, s);
- }
- else {
- return new SqlBind(Types.LONGVARCHAR, s);
- }
- }
- else {
- return new SqlBind(Types.VARCHAR, s);
- }
- }
- }
- else if (byte[].class == c) {
- if (o == null) {
- if (isBlobEnabled()) {
- return new SqlBind(Types.BLOB, o);
- }
- else {
- return new SqlBind(Types.LONGVARBINARY, o);
- }
- }
- else {
- if (isBlobEnabled()) {
- return new SqlBind(Types.BLOB, o);
- }
- else {
- return new SqlBind(Types.LONGVARBINARY, o);
- }
- }
- }
- else if (Boolean.class.isAssignableFrom(c)) {
- if (o == null) {
- return new SqlBind(Types.INTEGER, null);
- }
- else {
- return new SqlBind(Types.INTEGER, ((Boolean) o).booleanValue() ? 1 : 0);
- }
- }
- else if (TriState.class.isAssignableFrom(c)) {
- if (o == null) {
- return new SqlBind(Types.INTEGER, null);
- }
- else {
- return new SqlBind(Types.INTEGER, ((TriState) o).getIntegerValue());
- }
- }
- else if (Blob.class.isAssignableFrom(c)) {
- return new SqlBind(Types.BLOB, o);
- }
- else if (Clob.class.isAssignableFrom(c)) {
- return new SqlBind(Types.CLOB, o);
- }
- else if (c.isArray()) {
- return new SqlBind(Types.ARRAY, o);
- }
- else {
- if (o == null) {
- return new SqlBind(Types.VARCHAR, o);
- }
- else {
- throw new IllegalArgumentException("no SqlBind mapping for " + c);
- }
- }
- }
-
- @Override
- public void writeBind(PreparedStatement ps, int jdbcBindIndex, SqlBind bind) throws SQLException {
- switch (bind.getSqlType()) {
- case Types.NULL: {
- try {
- ps.setNull(jdbcBindIndex, Types.NULL);
-
- }
- catch (SQLException e) {
- ps.setNull(jdbcBindIndex, Types.VARCHAR);
- }
- break;
- }
- case Types.CLOB: {
- if (bind.getValue() instanceof Clob) {
- ps.setClob(jdbcBindIndex, (Clob) bind.getValue());
- }
- else {
- String s = (String) bind.getValue();
- ps.setCharacterStream(jdbcBindIndex, new StringReader(s), s.length());
- }
- break;
- }
- case Types.BLOB: {
- if (bind.getValue() instanceof Blob) {
- ps.setBlob(jdbcBindIndex, (Blob) bind.getValue());
- }
- else {
- byte[] data = (byte[]) bind.getValue();
- ps.setBinaryStream(jdbcBindIndex, new ByteArrayInputStream(data), data.length);
- }
- break;
- }
- case Types.LONGVARCHAR: {
- String s = (String) bind.getValue();
- ps.setCharacterStream(jdbcBindIndex, new StringReader(s), s.length());
- break;
- }
- case Types.LONGVARBINARY: {
- byte[] data = (byte[]) bind.getValue();
- try {
- // try using setBytes()
- ps.setBytes(jdbcBindIndex, data);
- }
- catch (Throwable e1) {
- try {
- // try using byte stream
- ps.setBinaryStream(jdbcBindIndex, new ByteArrayInputStream(data), data.length);
- }
- catch (SQLException e2) {
- // send original exception
- if (e1 instanceof SQLException) {
- throw (SQLException) e1;
- }
- else {
- throw new SQLException("failed setting bytes on jdbcBindIndex " + jdbcBindIndex);
- }
- }
- }
- break;
- }
- default: {
- ps.setObject(jdbcBindIndex, bind.getValue(), bind.getSqlType());
- }
- }
- }
-
- @Override
- public Object readBind(ResultSet rs, ResultSetMetaData meta, int type, int jdbcBindIndex) throws SQLException {
- Object o = null;
- switch (type) {
- // General Number
- case Types.DECIMAL:
- case Types.NUMERIC: {
- BigDecimal bd = rs.getBigDecimal(jdbcBindIndex);
- if (bd != null) {
- if (bd.scale() == 0) {
- o = new Long(bd.longValue());
- }
- else {
- o = new Double(bd.doubleValue());
- }
- }
- break;
- }
- // Long
- case Types.BIT:
- case Types.BIGINT:
- case Types.SMALLINT:
- case Types.INTEGER:
- case Types.TINYINT: {
- o = new Long(rs.getLong(jdbcBindIndex));
- break;
- }
- // Double
- case Types.DOUBLE:
- case Types.FLOAT:
- case Types.REAL: {
- o = new Double(rs.getDouble(jdbcBindIndex));
- break;
- }
- // String
- case Types.VARCHAR:
- case Types.CHAR: {
- o = rs.getString(jdbcBindIndex);
- break;
- }
- // Date
- case Types.DATE: {
- // Build 154: changed from getDate to getTimestamp()
- // o=result.getDate(i+1);
- o = rs.getTimestamp(jdbcBindIndex);
- break;
- }
- case Types.TIME: {
- o = rs.getTime(jdbcBindIndex);
- break;
- }
- case Types.TIMESTAMP: {
- o = rs.getTimestamp(jdbcBindIndex);
- break;
- }
- // Raw
- case Types.LONGVARCHAR: {
- try {
- o = rs.getString(jdbcBindIndex);
- }
- catch (SQLException e) {
- throw e;
- }
- break;
- }
- case Types.LONGVARBINARY:
- case Types.VARBINARY:
- case Types.BINARY: {
- o = rs.getBytes(jdbcBindIndex);
- break;
- }
- case Types.CLOB: {
- Clob c = rs.getClob(jdbcBindIndex);
- if (c == null) {
- o = null;
- }
- else {
- try {
- int len = (int) c.length();
- if (len > 0) {
- // fast read
- char[] ch = new char[len];
- Reader r = c.getCharacterStream();
- int processed = 0;
- while (processed < len) {
- processed += r.read(ch, processed, len - processed);
- }
- o = new String(ch);
- }
- else {
- // dynamic read
- o = IOUtility.getContent(c.getCharacterStream());
- }
- }
- catch (SQLException e) {
- throw e;
- }
- catch (Exception e) {
- SQLException sqe = new SQLException("read CLOB on column0=" + jdbcBindIndex);
- sqe.initCause(e);
- throw sqe;
- }
- }
- break;
- }
- case Types.BLOB: {
- Blob b = rs.getBlob(jdbcBindIndex);
- if (b == null) {
- o = null;
- }
- else {
- o = b.getBytes(1, (int) b.length());
- }
- break;
- }
- default: {
- o = rs.getObject(jdbcBindIndex);
- }
- }
- // set to null if necessary
- if (rs.wasNull()) {
- o = null;
- }
- return o;
- }
-
- @Override
- public void registerOutput(CallableStatement cs, int index, Class c) throws SQLException {
- if (c == null) {
- throw new SQLException("registering output index " + index + " with type null");
- }
- int jdbcType = getJdbcType(c);
- cs.registerOutParameter(index, jdbcType);
- }
-
- protected int getJdbcType(Class c) {
- int jdbcType;
- if (Timestamp.class.isAssignableFrom(c)) {
- jdbcType = Types.TIMESTAMP;
- }
- else if (java.sql.Date.class.isAssignableFrom(c)) {
- jdbcType = Types.DATE;
- }
- else if (Calendar.class.isAssignableFrom(c)) {
- jdbcType = Types.TIMESTAMP;
- }
- else if (java.util.Date.class.isAssignableFrom(c)) {
- jdbcType = Types.TIMESTAMP;
- }
- else if (Double.class.isAssignableFrom(c)) {
- jdbcType = Types.DOUBLE;
- }
- else if (Float.class.isAssignableFrom(c)) {
- jdbcType = Types.FLOAT;
- }
- else if (Integer.class.isAssignableFrom(c)) {
- jdbcType = Types.INTEGER;
- }
- else if (Long.class.isAssignableFrom(c)) {
- jdbcType = Types.BIGINT;
- }
- else if (BigInteger.class.isAssignableFrom(c)) {
- jdbcType = Types.BIGINT;
- }
- else if (BigDecimal.class.isAssignableFrom(c)) {
- jdbcType = Types.NUMERIC;
- }
- else if (String.class.isAssignableFrom(c) || char[].class == c) {
- jdbcType = Types.VARCHAR;
- }
- else if (byte[].class == c) {
- if (isBlobEnabled()) {
- jdbcType = Types.BLOB;
- }
- else {
- jdbcType = Types.LONGVARBINARY;
- }
- }
- else if (Boolean.class.isAssignableFrom(c)) {
- jdbcType = Types.INTEGER;
- }
- else if (TriState.class.isAssignableFrom(c)) {
- jdbcType = Types.INTEGER;
- }
- else if (Blob.class.isAssignableFrom(c)) {
- jdbcType = Types.BLOB;
- }
- else if (Clob.class.isAssignableFrom(c)) {
- jdbcType = Types.CLOB;
- }
- else if (c.isArray()) {
- jdbcType = Types.ARRAY;
- }
- else {
- jdbcType = Types.NUMERIC;
- }
- return jdbcType;
- }
-
- @Override
- public String createBetween(String attribute, String bindName1, String bindName2) {
- return attribute + " BETWEEN " + adaptBindName(bindName1) + " AND " + adaptBindName(bindName2);
- }
-
- @Override
- public String createDateBetween(String attribute, String bindName1, String bindName2) {
- return attribute + " BETWEEN TRUNC(" + adaptBindNameTimeDateOp(bindName1) + ") AND (TRUNC(" + adaptBindNameTimeDateOp(bindName2) + ")+(86399/86400)) ";
- }
-
- @Override
- public String createDateTimeBetween(String attribute, String bindName1, String bindName2) {
- return attribute + " BETWEEN TRUNC(" + adaptBindNameTimeDateOp(bindName1) + ",'MI') AND (TRUNC(" + adaptBindNameTimeDateOp(bindName2) + ",'MI')+(59/1440)) ";
- }
-
- @Override
- public String createStartsWith(String attribute, String bindName) {
- return "upper(" + attribute + ") like upper(" + adaptBindName(bindName) + "||'%')";
- }
-
- @Override
- public String createNotStartsWith(String attribute, String bindName) {
- return "upper(" + attribute + ") not like upper(" + adaptBindName(bindName) + "||'%')";
- }
-
- @Override
- public String createEndsWith(String attribute, String bindName) {
- return "upper(" + attribute + ") like upper('%'||" + adaptBindName(bindName) + ")";
- }
-
- @Override
- public String createNotEndsWith(String attribute, String bindName) {
- return "upper(" + attribute + ") not like upper('%'||" + adaptBindName(bindName) + ")";
- }
-
- @Override
- public String createContains(String attribute, String bindName) {
- return "upper(" + attribute + ") like upper('%'||" + adaptBindName(bindName) + "||'%')";
- }
-
- @Override
- public String createNotContains(String attribute, String bindName) {
- return "upper(" + attribute + ") not like upper('%'||" + adaptBindName(bindName) + "||'%')";
- }
-
- @Override
- public String createLike(String attribute, String bindName) {
- return "upper(" + attribute + ") like upper(" + adaptBindName(bindName) + ")";
- }
-
- @Override
- public String createNotLike(String attribute, String bindName) {
- return "upper(" + attribute + ") not like upper(" + adaptBindName(bindName) + ")";
- }
-
- @Override
- public String createNull(String attribute) {
- return attribute + " is null";
- }
-
- @Override
- public String createNotNull(String attribute) {
- return attribute + " is not null";
- }
-
- @Override
- public String createNumberNull(String attribute) {
- return "nvl(" + attribute + ",0)=0";
- }
-
- @Override
- public String createNumberNotNull(String attribute) {
- return "nvl(" + attribute + ",0)<>0";
- }
-
- @Override
- public String createTextNull(String attribute) {
- return "nvl(" + attribute + ",'0')='0'";
- }
-
- @Override
- public String createTextNotNull(String attribute) {
- return "nvl(" + attribute + ",'0')<>'0'";
- }
-
- @Override
- public String createIn(String attribute, String bindName) {
- return attribute + "=" + adaptBindName(bindName);
- }
-
- @Override
- public String createNotIn(String attribute, String bindName) {
- return "NOT(" + attribute + "=" + adaptBindName(bindName) + ")";
- }
-
- @Override
- public String createDateIsToday(String attribute) {
- return attribute + ">=TRUNC(SYSDATE) AND " + attribute + "<TRUNC(SYSDATE+1)";
- }
-
- @Override
- public String createDateIsInLastDays(String attribute, String bindName) {
- return attribute + ">=TRUNC(SYSDATE-(" + adaptBindNameTimeDateOp(bindName) + ")) AND " + attribute + "<TRUNC(SYSDATE+1)";
- }
-
- @Override
- public String createDateIsInNextDays(String attribute, String bindName) {
- return attribute + ">=TRUNC(SYSDATE) AND " + attribute + "<TRUNC(SYSDATE+" + adaptBindNameTimeDateOp(bindName) + "+1)";
- }
-
- @Override
- public String createDateIsInDays(String attribute, String bindName) {
- return attribute + ">=TRUNC(SYSDATE+" + adaptBindNameTimeDateOp(bindName) + ") AND " + attribute + "<TRUNC(SYSDATE+" + adaptBindNameTimeDateOp(bindName) + "+1)";
- }
-
- @Override
- public String createDateIsInWeeks(String attribute, String bindName) {
- return attribute + ">=TRUNC(SYSDATE+((" + adaptBindNameTimeDateOp(bindName) + ")*7)) AND " + attribute + "<TRUNC(SYSDATE+((" + adaptBindNameTimeDateOp(bindName) + ")*7)+1)";
- }
-
- @Override
- public String createDateIsInLastMonths(String attribute, String bindName) {
- return attribute + ">=TRUNC(ADD_MONTHS(SYSDATE,(-1)*(" + adaptBindNameTimeDateOp(bindName) + "))) AND " + attribute + "<TRUNC(SYSDATE+1)";
- }
-
- @Override
- public String createDateIsInNextMonths(String attribute, String bindName) {
- return attribute + ">=TRUNC(SYSDATE) AND " + attribute + "<TRUNC(ADD_MONTHS(SYSDATE," + adaptBindNameTimeDateOp(bindName) + ")+1)";
- }
-
- @Override
- public String createDateIsInMonths(String attribute, String bindName) {
- return attribute + ">=TRUNC(ADD_MONTHS(SYSDATE," + adaptBindNameTimeDateOp(bindName) + ")) AND " + attribute + "<TRUNC(ADD_MONTHS(SYSDATE," + adaptBindNameTimeDateOp(bindName) + ")+1)";
- }
-
- @Override
- public String createDateIsInLEDays(String attribute, String bindName) {
- return attribute + "<TRUNC(SYSDATE+" + adaptBindNameTimeDateOp(bindName) + "+1)";
- }
-
- @Override
- public String createDateIsInLEWeeks(String attribute, String bindName) {
- return attribute + "<TRUNC(SYSDATE+((" + adaptBindNameTimeDateOp(bindName) + ")*7)+1)";
- }
-
- @Override
- public String createDateIsInLEMonths(String attribute, String bindName) {
- return attribute + "<TRUNC(ADD_MONTHS(SYSDATE," + adaptBindNameTimeDateOp(bindName) + ")+1)";
- }
-
- @Override
- public String createDateIsInGEDays(String attribute, String bindName) {
- return attribute + ">=TRUNC(SYSDATE+" + adaptBindNameTimeDateOp(bindName) + ")";
- }
-
- @Override
- public String createDateIsInGEWeeks(String attribute, String bindName) {
- return attribute + ">=TRUNC(SYSDATE+((" + adaptBindNameTimeDateOp(bindName) + ")*7))";
- }
-
- @Override
- public String createDateIsInGEMonths(String attribute, String bindName) {
- return attribute + ">=TRUNC(ADD_MONTHS(SYSDATE," + adaptBindNameTimeDateOp(bindName) + "))";
- }
-
- @Override
- public String createDateIsNotToday(String attribute) {
- return "(" + attribute + "<TRUNC(SYSDATE) OR " + attribute + ">=TRUNC(SYSDATE+1))";
- }
-
- @Override
- public String createDateTimeIsNow(String attribute) {
- return "(" + attribute + ">=TRUNC(SYSDATE, 'MI') AND " + attribute + "<(TRUNC(SYSDATE, 'MI')+(1/24/60)))";
- }
-
- @Override
- public String createDateTimeIsInLEMinutes(String attribute, String bindName) {
- return attribute + "<(TRUNC(SYSDATE, 'MI')+((" + adaptBindNameTimeDateOp(bindName) + "+1)/24/60))";
- }
-
- @Override
- public String createDateTimeIsInLEHours(String attribute, String bindName) {
- return attribute + "<(TRUNC(SYSDATE, 'MI')+((1/24/60)+(" + adaptBindNameTimeDateOp(bindName) + "/24)))";
- }
-
- @Override
- public String createDateTimeIsInGEMinutes(String attribute, String bindName) {
- return attribute + ">=(TRUNC(SYSDATE, 'MI')+(" + adaptBindNameTimeDateOp(bindName) + "/24/60))";
- }
-
- @Override
- public String createDateTimeIsInGEHours(String attribute, String bindName) {
- return attribute + ">=(TRUNC(SYSDATE, 'MI')+(" + adaptBindNameTimeDateOp(bindName) + "/24))";
- }
-
- @Override
- public String createDateTimeIsNotNow(String attribute) {
- return "(" + attribute + "<TRUNC(SYSDATE, 'MI') OR " + attribute + ">=(TRUNC(SYSDATE, 'MI')+(1/24/60)))";
- }
-
- @Override
- public String createTimeIsNow(String attribute) {
- return attribute + ">=((TO_CHAR(SYSDATE,'HH24')*60) + TO_CHAR(SYSDATE,'MI'))/24/60 AND " + attribute + "<((TO_CHAR(SYSDATE,'HH24')*60)+TO_CHAR(SYSDATE,'MI')+(1/24/60))/24/60";
- }
-
- @Override
- public String createTimeIsNotNow(String attribute) {
- return attribute + "<((TO_CHAR(SYSDATE,'HH24')*60) + TO_CHAR(SYSDATE,'MI'))/24/60 OR " + attribute + ">((TO_CHAR(SYSDATE,'HH24')*60)+TO_CHAR(SYSDATE,'MI')+(1/24/60))/24/60";
- }
-
- @Override
- public String createTimeIsInMinutes(String attribute, String bindName) {
- return attribute + ">=((TO_CHAR(SYSDATE,'HH24')*60) + TO_CHAR(SYSDATE,'MI')+(" + adaptBindNameTimeDateOp(bindName) + "/24/60))/24/60 AND " + attribute + "<((TO_CHAR(SYSDATE,'HH24')*60)+TO_CHAR(SYSDATE,'MI')+((" + adaptBindNameTimeDateOp(bindName) + "+1)/24/60))/24/60";
- }
-
- @Override
- public String createTimeIsInHours(String attribute, String bindName) {
- return attribute + ">=((TO_CHAR(SYSDATE,'HH24')*60) + TO_CHAR(SYSDATE,'MI')+(" + adaptBindNameTimeDateOp(bindName) + "/24))/24/60 AND " + attribute + "<((TO_CHAR(SYSDATE,'HH24')*60)+TO_CHAR(SYSDATE,'MI')+(" + adaptBindNameTimeDateOp(bindName) + "/24)+(1/24/60))/24/60";
- }
-
- @Override
- public String createTimeIsInLEMinutes(String attribute, String bindName) {
- return attribute + "<((TO_CHAR(SYSDATE,'HH24')*60) + TO_CHAR(SYSDATE,'MI')+((" + adaptBindNameTimeDateOp(bindName) + "+1)/24/60))/24/60";
- }
-
- @Override
- public String createTimeIsInLEHours(String attribute, String bindName) {
- return attribute + "<((TO_CHAR(SYSDATE,'HH24')*60) + TO_CHAR(SYSDATE,'MI')+(" + adaptBindNameTimeDateOp(bindName) + "/24)+(1/24/60))/24/60";
- }
-
- @Override
- public String createTimeIsInGEMinutes(String attribute, String bindName) {
- return attribute + ">=((TO_CHAR(SYSDATE,'HH24')*60) + TO_CHAR(SYSDATE,'MI')+(" + adaptBindNameTimeDateOp(bindName) + "/24/60))/24/60";
- }
-
- @Override
- public String createTimeIsInGEHours(String attribute, String bindName) {
- return attribute + ">=((TO_CHAR(SYSDATE,'HH24')*60) + TO_CHAR(SYSDATE,'MI')+(" + adaptBindNameTimeDateOp(bindName) + "/24))/24/60";
- }
-
- @Override
- public String createEQ(String attribute, String bindName) {
- return attribute + "=" + adaptBindName(bindName);
- }
-
- @Override
- public String createDateEQ(String attribute, String bindName) {
- return attribute + "=TRUNC(" + adaptBindName(bindName) + ")";
- }
-
- @Override
- public String createDateTimeEQ(String attribute, String bindName) {
- return attribute + "=TRUNC(" + adaptBindNameTimeDateOp(bindName) + ",'MI')";
- }
-
- @Override
- public String createGE(String attribute, String bindName) {
- return attribute + ">=" + adaptBindName(bindName);
- }
-
- @Override
- public String createDateGE(String attribute, String bindName) {
- return attribute + ">=TRUNC(" + adaptBindName(bindName) + ")";
- }
-
- @Override
- public String createDateTimeGE(String attribute, String bindName) {
- return attribute + ">=TRUNC(" + adaptBindNameTimeDateOp(bindName) + ",'MI')";
- }
-
- @Override
- public String createGT(String attribute, String bindName) {
- return attribute + ">" + adaptBindName(bindName);
- }
-
- @Override
- public String createDateGT(String attribute, String bindName) {
- return attribute + ">TRUNC(" + adaptBindName(bindName) + ")";
- }
-
- @Override
- public String createDateTimeGT(String attribute, String bindName) {
- return attribute + ">TRUNC(" + adaptBindNameTimeDateOp(bindName) + ",'MI')";
- }
-
- @Override
- public String createLE(String attribute, String bindName) {
- return attribute + "<=" + adaptBindName(bindName);
- }
-
- @Override
- public String createDateLE(String attribute, String bindName) {
- return attribute + "<=(TRUNC(" + adaptBindName(bindName) + ")+(86399/86400))";
- }
-
- @Override
- public String createDateTimeLE(String attribute, String bindName) {
- return attribute + "<=(TRUNC(" + adaptBindNameTimeDateOp(bindName) + ",'MI')+(59/1440))";
- }
-
- @Override
- public String createLT(String attribute, String bindName) {
- return attribute + "<" + adaptBindName(bindName);
- }
-
- @Override
- public String createDateLT(String attribute, String bindName) {
- return attribute + "<TRUNC(" + adaptBindName(bindName) + ")";
- }
-
- @Override
- public String createDateTimeLT(String attribute, String bindName) {
- return attribute + "<TRUNC(" + adaptBindNameTimeDateOp(bindName) + ",'MI')";
- }
-
- @Override
- public String createNEQ(String attribute, String bindName) {
- return attribute + "<>" + adaptBindName(bindName);
- }
-
- @Override
- public String createDateNEQ(String attribute, String bindName) {
- return attribute + "<>TRUNC(" + adaptBindName(bindName) + ")";
- }
-
- @Override
- public String createDateTimeNEQ(String attribute, String bindName) {
- return attribute + "<>TRUNC(" + adaptBindNameTimeDateOp(bindName) + ",'MI')";
- }
-
- protected abstract int getMaxListSize();
-
- @Override
- public String createInList(String attribute, Object array) {
- Object[] values = toArray(array);
- if (values.length == 0) {
- return createNull(attribute);
- }
- int max = getMaxListSize();
- StringBuffer buf = new StringBuffer();
- buf.append("(");// bracket 1
- for (int i = 0; i < values.length; i = i + max) {
- if (i > 0) {
- buf.append(" OR ");
- }
- buf.append("(");// bracket 2
- buf.append(attribute);
- buf.append(" IN ");
- buf.append("(");// bracket 3
- for (int k = i; k < values.length && k < i + max; k++) {
- if (k > i) {
- buf.append(",");
- }
- buf.append(toPlainText(values[k]));
- }
- buf.append(")");// bracket 3
- buf.append(")");// bracket 2
- }
- buf.append(")");// bracket 1
- return buf.toString();
- }
-
- @Override
- public String createNotInList(String attribute, Object array) {
- Object[] values = toArray(array);
- if (values.length == 0) {
- return createNotNull(attribute);
- }
- int max = getMaxListSize();
- StringBuffer buf = new StringBuffer();
- buf.append("(");// bracket 1
- for (int i = 0; i < values.length; i = i + max) {
- if (i > 0) {
- buf.append(" AND ");
- }
- buf.append("(");// bracket 2
- buf.append(attribute);
- buf.append(" NOT IN ");
- buf.append("(");// bracket 3
- for (int k = i; k < values.length && k < i + max; k++) {
- if (k > i) {
- buf.append(",");
- }
- buf.append(toPlainText(values[k]));
- }
- buf.append(")");// bracket 3
- buf.append(")");// bracket 2
- }
- buf.append(")");// bracket 1
- return buf.toString();
- }
-
- @Override
- public String getSysdateToken() {
- return "SYSDATE";
- }
-
- @Override
- public String getLowerToken() {
- return "LOWER";
- }
-
- @Override
- public String getUpperToken() {
- return "UPPER";
- }
-
- @Override
- public String getTrimToken() {
- return "TRIM";
- }
-
- @Override
- public String getNvlToken() {
- return "NVL";
- }
-
- protected Object[] toArray(Object array) {
- if (array == null) {
- return new Object[0];
- }
- if (!array.getClass().isArray()) {
- return new Object[]{array};
- }
- int len = Array.getLength(array);
- Object[] a = new Object[len];
- for (int i = 0; i < a.length; i++) {
- a[i] = Array.get(array, i);
- }
- return a;
- }
-
- protected String adaptBindName(String bindName) {
- if (bindName == null) {
- return bindName;
- }
- if (bindName.startsWith(PLAIN_BIND_MARKER_PREFIX)) {
- return bindName.substring(1);
- }
- return ":" + bindName;
- }
-
- protected String adaptBindNameTimeDateOp(String bindName) {
- return adaptBindName(bindName);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc.style;
+
+import java.io.ByteArrayInputStream;
+import java.io.Reader;
+import java.io.StringReader;
+import java.lang.reflect.Array;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.sql.Blob;
+import java.sql.CallableStatement;
+import java.sql.Clob;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.sql.Timestamp;
+import java.sql.Types;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Collection;
+import java.util.Date;
+
+import org.eclipse.scout.commons.IOUtility;
+import org.eclipse.scout.commons.TriState;
+import org.eclipse.scout.commons.TypeCastUtility;
+import org.eclipse.scout.commons.holders.IHolder;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.server.services.common.jdbc.SqlBind;
+
+public abstract class AbstractSqlStyle implements ISqlStyle {
+ private static final long serialVersionUID = 1L;
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractSqlStyle.class);
+
+ @Override
+ public String getConcatOp() {
+ return "||";
+ }
+
+ @Override
+ public String getLikeWildcard() {
+ return "%";
+ }
+
+ @Override
+ public String toLikePattern(Object value) {
+ String s = (value != null ? value.toString() : "");
+ s = s.replace("*", getLikeWildcard());
+ return s;
+ }
+
+ @Override
+ public String toPlainText(Object value) {
+ if (value instanceof IHolder) {
+ value = ((IHolder) value).getValue();
+ }
+ //
+ if (value == null) {
+ return "null";
+ }
+ else if (value instanceof Boolean) {
+ Boolean b = (Boolean) value;
+ return b ? "1" : "0";
+ }
+ else if (value instanceof TriState) {
+ TriState t = (TriState) value;
+ return "" + t.toString();
+ }
+ else if (value instanceof String) {
+ String s = (String) value;
+ if (s.length() > 4000) {
+ s = s.substring(0, 4000);
+ LOG.warn("toPlainText of a String with more than 4000 characters failed; truncated to '" + s + "'");
+ return "'" + s.replaceAll("'", "''") + "'";
+ }
+ return "'" + s.replaceAll("'", "''") + "'";
+ }
+ else if (value instanceof char[]) {
+ if (((char[]) value).length > 4000) {
+ String s = new String((char[]) value, 0, 4000);
+ LOG.warn("toPlainText of a CLOB with more than 4000 characters failed; truncated to '" + s + "'");
+ return "'" + s.replaceAll("'", "''") + "'";
+ }
+ String s = new String((char[]) value);
+ return "'" + s.replaceAll("'", "''") + "'";
+ }
+ else if (value instanceof byte[]) {
+ LOG.warn("toPlainText of a BLOB failed; using NULL");
+ return "NULL";
+ }
+ else if (value instanceof Date) {
+ Date d = (Date) value;
+ SimpleDateFormat fmt = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
+ return "to_date('" + fmt.format(d) + "','dd.mm.yyyy hh24:mi:ss')";
+ }
+ else if (value instanceof Collection || value.getClass().isArray()) {
+ Object array;
+ if (value instanceof Collection) {
+ array = ((Collection) value).toArray();
+ }
+ else {
+ array = value;
+ }
+ int n = Array.getLength(array);
+ StringBuffer buf = new StringBuffer();
+ buf.append("(");
+ if (n > 0) {
+ for (int i = 0; i < n; i++) {
+ if (i > 0) {
+ buf.append(",");
+ }
+ buf.append(toPlainText(Array.get(array, i)));
+ }
+ }
+ else {
+ buf.append("-1");
+ }
+ buf.append(")");
+ return buf.toString();
+ }
+ else {
+ return value.toString();
+ }
+ }
+
+ @Override
+ public String toAggregationAvg(String attribute) {
+ return "AVG(" + attribute + ")";
+ }
+
+ @Override
+ public String toAggregationCount(String attribute) {
+ return "COUNT(" + attribute + ")";
+ }
+
+ @Override
+ public String toAggregationMax(String attribute) {
+ return "MAX(" + attribute + ")";
+ }
+
+ @Override
+ public String toAggregationMedian(String attribute) {
+ return "MEDIAN(" + attribute + ")";
+ }
+
+ @Override
+ public String toAggregationMin(String attribute) {
+ return "MIN(" + attribute + ")";
+ }
+
+ @Override
+ public String toAggregationSum(String attribute) {
+ return "SUM(" + attribute + ")";
+ }
+
+ @Override
+ public SqlBind buildBindFor(Object o, Class nullType) {
+ if (o instanceof IHolder) {
+ IHolder h = (IHolder) o;
+ o = h.getValue();
+ nullType = h.getHolderType();
+ }
+ //
+ Class c;
+ if (o != null) {
+ c = o.getClass();
+ }
+ else {
+ if (nullType != null && IHolder.class.isAssignableFrom(nullType)) {
+ try {
+ nullType = TypeCastUtility.getGenericsParameterClass(nullType, IHolder.class);
+ }
+ catch (Throwable t) {
+ nullType = null;
+ }
+ }
+ c = nullType;
+ }
+ //
+ if (o == null && c == null) {
+ return new SqlBind(Types.NULL, o);
+ }
+ //
+ if (Timestamp.class.isAssignableFrom(c)) {
+ return new SqlBind(Types.TIMESTAMP, o);
+ }
+ else if (java.sql.Date.class.isAssignableFrom(c)) {
+ return new SqlBind(Types.DATE, o);
+ }
+ else if (Calendar.class.isAssignableFrom(c)) {
+ if (o == null) {
+ return new SqlBind(Types.TIMESTAMP, o);
+ }
+ else {
+ return new SqlBind(Types.TIMESTAMP, new Timestamp(((Calendar) o).getTimeInMillis()));
+ }
+ }
+ else if (java.util.Date.class.isAssignableFrom(c)) {
+ if (o == null) {
+ return new SqlBind(Types.TIMESTAMP, o);
+ }
+ else {
+ return new SqlBind(Types.TIMESTAMP, new Timestamp(((Date) o).getTime()));
+ }
+ }
+ else if (Double.class.isAssignableFrom(c)) {
+ return new SqlBind(Types.DOUBLE, o);
+ }
+ else if (Float.class.isAssignableFrom(c)) {
+ return new SqlBind(Types.FLOAT, o);
+ }
+ else if (Integer.class.isAssignableFrom(c)) {
+ return new SqlBind(Types.INTEGER, o);
+ }
+ else if (Long.class.isAssignableFrom(c)) {
+ return new SqlBind(Types.BIGINT, o);
+ }
+ else if (BigInteger.class.isAssignableFrom(c)) {
+ return new SqlBind(Types.BIGINT, o);
+ }
+ else if (BigDecimal.class.isAssignableFrom(c)) {
+ return new SqlBind(Types.NUMERIC, o);
+ }
+ else if (String.class.isAssignableFrom(c) || char[].class == c) {
+ if (o == null) {
+ return new SqlBind(Types.VARCHAR, o);
+ }
+ else {
+ String s;
+ boolean large;
+ if (String.class.isAssignableFrom(c)) {
+ s = (String) o;
+ large = isLargeString(s);
+ }
+ else {
+ // char[] binds are always treated as lobs
+ s = new String((char[]) o);
+ large = true;
+ }
+ if (large) {
+ if (isClobEnabled()) {
+ return new SqlBind(Types.CLOB, s);
+ }
+ else {
+ return new SqlBind(Types.LONGVARCHAR, s);
+ }
+ }
+ else {
+ return new SqlBind(Types.VARCHAR, s);
+ }
+ }
+ }
+ else if (byte[].class == c) {
+ if (o == null) {
+ if (isBlobEnabled()) {
+ return new SqlBind(Types.BLOB, o);
+ }
+ else {
+ return new SqlBind(Types.LONGVARBINARY, o);
+ }
+ }
+ else {
+ if (isBlobEnabled()) {
+ return new SqlBind(Types.BLOB, o);
+ }
+ else {
+ return new SqlBind(Types.LONGVARBINARY, o);
+ }
+ }
+ }
+ else if (Boolean.class.isAssignableFrom(c)) {
+ if (o == null) {
+ return new SqlBind(Types.INTEGER, null);
+ }
+ else {
+ return new SqlBind(Types.INTEGER, ((Boolean) o).booleanValue() ? 1 : 0);
+ }
+ }
+ else if (TriState.class.isAssignableFrom(c)) {
+ if (o == null) {
+ return new SqlBind(Types.INTEGER, null);
+ }
+ else {
+ return new SqlBind(Types.INTEGER, ((TriState) o).getIntegerValue());
+ }
+ }
+ else if (Blob.class.isAssignableFrom(c)) {
+ return new SqlBind(Types.BLOB, o);
+ }
+ else if (Clob.class.isAssignableFrom(c)) {
+ return new SqlBind(Types.CLOB, o);
+ }
+ else if (c.isArray()) {
+ return new SqlBind(Types.ARRAY, o);
+ }
+ else {
+ if (o == null) {
+ return new SqlBind(Types.VARCHAR, o);
+ }
+ else {
+ throw new IllegalArgumentException("no SqlBind mapping for " + c);
+ }
+ }
+ }
+
+ @Override
+ public void writeBind(PreparedStatement ps, int jdbcBindIndex, SqlBind bind) throws SQLException {
+ switch (bind.getSqlType()) {
+ case Types.NULL: {
+ try {
+ ps.setNull(jdbcBindIndex, Types.NULL);
+
+ }
+ catch (SQLException e) {
+ ps.setNull(jdbcBindIndex, Types.VARCHAR);
+ }
+ break;
+ }
+ case Types.CLOB: {
+ if (bind.getValue() instanceof Clob) {
+ ps.setClob(jdbcBindIndex, (Clob) bind.getValue());
+ }
+ else {
+ String s = (String) bind.getValue();
+ ps.setCharacterStream(jdbcBindIndex, new StringReader(s), s.length());
+ }
+ break;
+ }
+ case Types.BLOB: {
+ if (bind.getValue() instanceof Blob) {
+ ps.setBlob(jdbcBindIndex, (Blob) bind.getValue());
+ }
+ else {
+ byte[] data = (byte[]) bind.getValue();
+ ps.setBinaryStream(jdbcBindIndex, new ByteArrayInputStream(data), data.length);
+ }
+ break;
+ }
+ case Types.LONGVARCHAR: {
+ String s = (String) bind.getValue();
+ ps.setCharacterStream(jdbcBindIndex, new StringReader(s), s.length());
+ break;
+ }
+ case Types.LONGVARBINARY: {
+ byte[] data = (byte[]) bind.getValue();
+ try {
+ // try using setBytes()
+ ps.setBytes(jdbcBindIndex, data);
+ }
+ catch (Throwable e1) {
+ try {
+ // try using byte stream
+ ps.setBinaryStream(jdbcBindIndex, new ByteArrayInputStream(data), data.length);
+ }
+ catch (SQLException e2) {
+ // send original exception
+ if (e1 instanceof SQLException) {
+ throw (SQLException) e1;
+ }
+ else {
+ throw new SQLException("failed setting bytes on jdbcBindIndex " + jdbcBindIndex);
+ }
+ }
+ }
+ break;
+ }
+ default: {
+ ps.setObject(jdbcBindIndex, bind.getValue(), bind.getSqlType());
+ }
+ }
+ }
+
+ @Override
+ public Object readBind(ResultSet rs, ResultSetMetaData meta, int type, int jdbcBindIndex) throws SQLException {
+ Object o = null;
+ switch (type) {
+ // General Number
+ case Types.DECIMAL:
+ case Types.NUMERIC: {
+ BigDecimal bd = rs.getBigDecimal(jdbcBindIndex);
+ if (bd != null) {
+ if (bd.scale() == 0) {
+ o = new Long(bd.longValue());
+ }
+ else {
+ o = new Double(bd.doubleValue());
+ }
+ }
+ break;
+ }
+ // Long
+ case Types.BIT:
+ case Types.BIGINT:
+ case Types.SMALLINT:
+ case Types.INTEGER:
+ case Types.TINYINT: {
+ o = new Long(rs.getLong(jdbcBindIndex));
+ break;
+ }
+ // Double
+ case Types.DOUBLE:
+ case Types.FLOAT:
+ case Types.REAL: {
+ o = new Double(rs.getDouble(jdbcBindIndex));
+ break;
+ }
+ // String
+ case Types.VARCHAR:
+ case Types.CHAR: {
+ o = rs.getString(jdbcBindIndex);
+ break;
+ }
+ // Date
+ case Types.DATE: {
+ // Build 154: changed from getDate to getTimestamp()
+ // o=result.getDate(i+1);
+ o = rs.getTimestamp(jdbcBindIndex);
+ break;
+ }
+ case Types.TIME: {
+ o = rs.getTime(jdbcBindIndex);
+ break;
+ }
+ case Types.TIMESTAMP: {
+ o = rs.getTimestamp(jdbcBindIndex);
+ break;
+ }
+ // Raw
+ case Types.LONGVARCHAR: {
+ try {
+ o = rs.getString(jdbcBindIndex);
+ }
+ catch (SQLException e) {
+ throw e;
+ }
+ break;
+ }
+ case Types.LONGVARBINARY:
+ case Types.VARBINARY:
+ case Types.BINARY: {
+ o = rs.getBytes(jdbcBindIndex);
+ break;
+ }
+ case Types.CLOB: {
+ Clob c = rs.getClob(jdbcBindIndex);
+ if (c == null) {
+ o = null;
+ }
+ else {
+ try {
+ int len = (int) c.length();
+ if (len > 0) {
+ // fast read
+ char[] ch = new char[len];
+ Reader r = c.getCharacterStream();
+ int processed = 0;
+ while (processed < len) {
+ processed += r.read(ch, processed, len - processed);
+ }
+ o = new String(ch);
+ }
+ else {
+ // dynamic read
+ o = IOUtility.getContent(c.getCharacterStream());
+ }
+ }
+ catch (SQLException e) {
+ throw e;
+ }
+ catch (Exception e) {
+ SQLException sqe = new SQLException("read CLOB on column0=" + jdbcBindIndex);
+ sqe.initCause(e);
+ throw sqe;
+ }
+ }
+ break;
+ }
+ case Types.BLOB: {
+ Blob b = rs.getBlob(jdbcBindIndex);
+ if (b == null) {
+ o = null;
+ }
+ else {
+ o = b.getBytes(1, (int) b.length());
+ }
+ break;
+ }
+ default: {
+ o = rs.getObject(jdbcBindIndex);
+ }
+ }
+ // set to null if necessary
+ if (rs.wasNull()) {
+ o = null;
+ }
+ return o;
+ }
+
+ @Override
+ public void registerOutput(CallableStatement cs, int index, Class c) throws SQLException {
+ if (c == null) {
+ throw new SQLException("registering output index " + index + " with type null");
+ }
+ int jdbcType = getJdbcType(c);
+ cs.registerOutParameter(index, jdbcType);
+ }
+
+ protected int getJdbcType(Class c) {
+ int jdbcType;
+ if (Timestamp.class.isAssignableFrom(c)) {
+ jdbcType = Types.TIMESTAMP;
+ }
+ else if (java.sql.Date.class.isAssignableFrom(c)) {
+ jdbcType = Types.DATE;
+ }
+ else if (Calendar.class.isAssignableFrom(c)) {
+ jdbcType = Types.TIMESTAMP;
+ }
+ else if (java.util.Date.class.isAssignableFrom(c)) {
+ jdbcType = Types.TIMESTAMP;
+ }
+ else if (Double.class.isAssignableFrom(c)) {
+ jdbcType = Types.DOUBLE;
+ }
+ else if (Float.class.isAssignableFrom(c)) {
+ jdbcType = Types.FLOAT;
+ }
+ else if (Integer.class.isAssignableFrom(c)) {
+ jdbcType = Types.INTEGER;
+ }
+ else if (Long.class.isAssignableFrom(c)) {
+ jdbcType = Types.BIGINT;
+ }
+ else if (BigInteger.class.isAssignableFrom(c)) {
+ jdbcType = Types.BIGINT;
+ }
+ else if (BigDecimal.class.isAssignableFrom(c)) {
+ jdbcType = Types.NUMERIC;
+ }
+ else if (String.class.isAssignableFrom(c) || char[].class == c) {
+ jdbcType = Types.VARCHAR;
+ }
+ else if (byte[].class == c) {
+ if (isBlobEnabled()) {
+ jdbcType = Types.BLOB;
+ }
+ else {
+ jdbcType = Types.LONGVARBINARY;
+ }
+ }
+ else if (Boolean.class.isAssignableFrom(c)) {
+ jdbcType = Types.INTEGER;
+ }
+ else if (TriState.class.isAssignableFrom(c)) {
+ jdbcType = Types.INTEGER;
+ }
+ else if (Blob.class.isAssignableFrom(c)) {
+ jdbcType = Types.BLOB;
+ }
+ else if (Clob.class.isAssignableFrom(c)) {
+ jdbcType = Types.CLOB;
+ }
+ else if (c.isArray()) {
+ jdbcType = Types.ARRAY;
+ }
+ else {
+ jdbcType = Types.NUMERIC;
+ }
+ return jdbcType;
+ }
+
+ @Override
+ public String createBetween(String attribute, String bindName1, String bindName2) {
+ return attribute + " BETWEEN " + adaptBindName(bindName1) + " AND " + adaptBindName(bindName2);
+ }
+
+ @Override
+ public String createDateBetween(String attribute, String bindName1, String bindName2) {
+ return attribute + " BETWEEN TRUNC(" + adaptBindNameTimeDateOp(bindName1) + ") AND (TRUNC(" + adaptBindNameTimeDateOp(bindName2) + ")+(86399/86400)) ";
+ }
+
+ @Override
+ public String createDateTimeBetween(String attribute, String bindName1, String bindName2) {
+ return attribute + " BETWEEN TRUNC(" + adaptBindNameTimeDateOp(bindName1) + ",'MI') AND (TRUNC(" + adaptBindNameTimeDateOp(bindName2) + ",'MI')+(59/1440)) ";
+ }
+
+ @Override
+ public String createStartsWith(String attribute, String bindName) {
+ return "upper(" + attribute + ") like upper(" + adaptBindName(bindName) + "||'%')";
+ }
+
+ @Override
+ public String createNotStartsWith(String attribute, String bindName) {
+ return "upper(" + attribute + ") not like upper(" + adaptBindName(bindName) + "||'%')";
+ }
+
+ @Override
+ public String createEndsWith(String attribute, String bindName) {
+ return "upper(" + attribute + ") like upper('%'||" + adaptBindName(bindName) + ")";
+ }
+
+ @Override
+ public String createNotEndsWith(String attribute, String bindName) {
+ return "upper(" + attribute + ") not like upper('%'||" + adaptBindName(bindName) + ")";
+ }
+
+ @Override
+ public String createContains(String attribute, String bindName) {
+ return "upper(" + attribute + ") like upper('%'||" + adaptBindName(bindName) + "||'%')";
+ }
+
+ @Override
+ public String createNotContains(String attribute, String bindName) {
+ return "upper(" + attribute + ") not like upper('%'||" + adaptBindName(bindName) + "||'%')";
+ }
+
+ @Override
+ public String createLike(String attribute, String bindName) {
+ return "upper(" + attribute + ") like upper(" + adaptBindName(bindName) + ")";
+ }
+
+ @Override
+ public String createNotLike(String attribute, String bindName) {
+ return "upper(" + attribute + ") not like upper(" + adaptBindName(bindName) + ")";
+ }
+
+ @Override
+ public String createNull(String attribute) {
+ return attribute + " is null";
+ }
+
+ @Override
+ public String createNotNull(String attribute) {
+ return attribute + " is not null";
+ }
+
+ @Override
+ public String createNumberNull(String attribute) {
+ return "nvl(" + attribute + ",0)=0";
+ }
+
+ @Override
+ public String createNumberNotNull(String attribute) {
+ return "nvl(" + attribute + ",0)<>0";
+ }
+
+ @Override
+ public String createTextNull(String attribute) {
+ return "nvl(" + attribute + ",'0')='0'";
+ }
+
+ @Override
+ public String createTextNotNull(String attribute) {
+ return "nvl(" + attribute + ",'0')<>'0'";
+ }
+
+ @Override
+ public String createIn(String attribute, String bindName) {
+ return attribute + "=" + adaptBindName(bindName);
+ }
+
+ @Override
+ public String createNotIn(String attribute, String bindName) {
+ return "NOT(" + attribute + "=" + adaptBindName(bindName) + ")";
+ }
+
+ @Override
+ public String createDateIsToday(String attribute) {
+ return attribute + ">=TRUNC(SYSDATE) AND " + attribute + "<TRUNC(SYSDATE+1)";
+ }
+
+ @Override
+ public String createDateIsInLastDays(String attribute, String bindName) {
+ return attribute + ">=TRUNC(SYSDATE-(" + adaptBindNameTimeDateOp(bindName) + ")) AND " + attribute + "<TRUNC(SYSDATE+1)";
+ }
+
+ @Override
+ public String createDateIsInNextDays(String attribute, String bindName) {
+ return attribute + ">=TRUNC(SYSDATE) AND " + attribute + "<TRUNC(SYSDATE+" + adaptBindNameTimeDateOp(bindName) + "+1)";
+ }
+
+ @Override
+ public String createDateIsInDays(String attribute, String bindName) {
+ return attribute + ">=TRUNC(SYSDATE+" + adaptBindNameTimeDateOp(bindName) + ") AND " + attribute + "<TRUNC(SYSDATE+" + adaptBindNameTimeDateOp(bindName) + "+1)";
+ }
+
+ @Override
+ public String createDateIsInWeeks(String attribute, String bindName) {
+ return attribute + ">=TRUNC(SYSDATE+((" + adaptBindNameTimeDateOp(bindName) + ")*7)) AND " + attribute + "<TRUNC(SYSDATE+((" + adaptBindNameTimeDateOp(bindName) + ")*7)+1)";
+ }
+
+ @Override
+ public String createDateIsInLastMonths(String attribute, String bindName) {
+ return attribute + ">=TRUNC(ADD_MONTHS(SYSDATE,(-1)*(" + adaptBindNameTimeDateOp(bindName) + "))) AND " + attribute + "<TRUNC(SYSDATE+1)";
+ }
+
+ @Override
+ public String createDateIsInNextMonths(String attribute, String bindName) {
+ return attribute + ">=TRUNC(SYSDATE) AND " + attribute + "<TRUNC(ADD_MONTHS(SYSDATE," + adaptBindNameTimeDateOp(bindName) + ")+1)";
+ }
+
+ @Override
+ public String createDateIsInMonths(String attribute, String bindName) {
+ return attribute + ">=TRUNC(ADD_MONTHS(SYSDATE," + adaptBindNameTimeDateOp(bindName) + ")) AND " + attribute + "<TRUNC(ADD_MONTHS(SYSDATE," + adaptBindNameTimeDateOp(bindName) + ")+1)";
+ }
+
+ @Override
+ public String createDateIsInLEDays(String attribute, String bindName) {
+ return attribute + "<TRUNC(SYSDATE+" + adaptBindNameTimeDateOp(bindName) + "+1)";
+ }
+
+ @Override
+ public String createDateIsInLEWeeks(String attribute, String bindName) {
+ return attribute + "<TRUNC(SYSDATE+((" + adaptBindNameTimeDateOp(bindName) + ")*7)+1)";
+ }
+
+ @Override
+ public String createDateIsInLEMonths(String attribute, String bindName) {
+ return attribute + "<TRUNC(ADD_MONTHS(SYSDATE," + adaptBindNameTimeDateOp(bindName) + ")+1)";
+ }
+
+ @Override
+ public String createDateIsInGEDays(String attribute, String bindName) {
+ return attribute + ">=TRUNC(SYSDATE+" + adaptBindNameTimeDateOp(bindName) + ")";
+ }
+
+ @Override
+ public String createDateIsInGEWeeks(String attribute, String bindName) {
+ return attribute + ">=TRUNC(SYSDATE+((" + adaptBindNameTimeDateOp(bindName) + ")*7))";
+ }
+
+ @Override
+ public String createDateIsInGEMonths(String attribute, String bindName) {
+ return attribute + ">=TRUNC(ADD_MONTHS(SYSDATE," + adaptBindNameTimeDateOp(bindName) + "))";
+ }
+
+ @Override
+ public String createDateIsNotToday(String attribute) {
+ return "(" + attribute + "<TRUNC(SYSDATE) OR " + attribute + ">=TRUNC(SYSDATE+1))";
+ }
+
+ @Override
+ public String createDateTimeIsNow(String attribute) {
+ return "(" + attribute + ">=TRUNC(SYSDATE, 'MI') AND " + attribute + "<(TRUNC(SYSDATE, 'MI')+(1/24/60)))";
+ }
+
+ @Override
+ public String createDateTimeIsInLEMinutes(String attribute, String bindName) {
+ return attribute + "<(TRUNC(SYSDATE, 'MI')+((" + adaptBindNameTimeDateOp(bindName) + "+1)/24/60))";
+ }
+
+ @Override
+ public String createDateTimeIsInLEHours(String attribute, String bindName) {
+ return attribute + "<(TRUNC(SYSDATE, 'MI')+((1/24/60)+(" + adaptBindNameTimeDateOp(bindName) + "/24)))";
+ }
+
+ @Override
+ public String createDateTimeIsInGEMinutes(String attribute, String bindName) {
+ return attribute + ">=(TRUNC(SYSDATE, 'MI')+(" + adaptBindNameTimeDateOp(bindName) + "/24/60))";
+ }
+
+ @Override
+ public String createDateTimeIsInGEHours(String attribute, String bindName) {
+ return attribute + ">=(TRUNC(SYSDATE, 'MI')+(" + adaptBindNameTimeDateOp(bindName) + "/24))";
+ }
+
+ @Override
+ public String createDateTimeIsNotNow(String attribute) {
+ return "(" + attribute + "<TRUNC(SYSDATE, 'MI') OR " + attribute + ">=(TRUNC(SYSDATE, 'MI')+(1/24/60)))";
+ }
+
+ @Override
+ public String createTimeIsNow(String attribute) {
+ return attribute + ">=((TO_CHAR(SYSDATE,'HH24')*60) + TO_CHAR(SYSDATE,'MI'))/24/60 AND " + attribute + "<((TO_CHAR(SYSDATE,'HH24')*60)+TO_CHAR(SYSDATE,'MI')+(1/24/60))/24/60";
+ }
+
+ @Override
+ public String createTimeIsNotNow(String attribute) {
+ return attribute + "<((TO_CHAR(SYSDATE,'HH24')*60) + TO_CHAR(SYSDATE,'MI'))/24/60 OR " + attribute + ">((TO_CHAR(SYSDATE,'HH24')*60)+TO_CHAR(SYSDATE,'MI')+(1/24/60))/24/60";
+ }
+
+ @Override
+ public String createTimeIsInMinutes(String attribute, String bindName) {
+ return attribute + ">=((TO_CHAR(SYSDATE,'HH24')*60) + TO_CHAR(SYSDATE,'MI')+(" + adaptBindNameTimeDateOp(bindName) + "/24/60))/24/60 AND " + attribute + "<((TO_CHAR(SYSDATE,'HH24')*60)+TO_CHAR(SYSDATE,'MI')+((" + adaptBindNameTimeDateOp(bindName) + "+1)/24/60))/24/60";
+ }
+
+ @Override
+ public String createTimeIsInHours(String attribute, String bindName) {
+ return attribute + ">=((TO_CHAR(SYSDATE,'HH24')*60) + TO_CHAR(SYSDATE,'MI')+(" + adaptBindNameTimeDateOp(bindName) + "/24))/24/60 AND " + attribute + "<((TO_CHAR(SYSDATE,'HH24')*60)+TO_CHAR(SYSDATE,'MI')+(" + adaptBindNameTimeDateOp(bindName) + "/24)+(1/24/60))/24/60";
+ }
+
+ @Override
+ public String createTimeIsInLEMinutes(String attribute, String bindName) {
+ return attribute + "<((TO_CHAR(SYSDATE,'HH24')*60) + TO_CHAR(SYSDATE,'MI')+((" + adaptBindNameTimeDateOp(bindName) + "+1)/24/60))/24/60";
+ }
+
+ @Override
+ public String createTimeIsInLEHours(String attribute, String bindName) {
+ return attribute + "<((TO_CHAR(SYSDATE,'HH24')*60) + TO_CHAR(SYSDATE,'MI')+(" + adaptBindNameTimeDateOp(bindName) + "/24)+(1/24/60))/24/60";
+ }
+
+ @Override
+ public String createTimeIsInGEMinutes(String attribute, String bindName) {
+ return attribute + ">=((TO_CHAR(SYSDATE,'HH24')*60) + TO_CHAR(SYSDATE,'MI')+(" + adaptBindNameTimeDateOp(bindName) + "/24/60))/24/60";
+ }
+
+ @Override
+ public String createTimeIsInGEHours(String attribute, String bindName) {
+ return attribute + ">=((TO_CHAR(SYSDATE,'HH24')*60) + TO_CHAR(SYSDATE,'MI')+(" + adaptBindNameTimeDateOp(bindName) + "/24))/24/60";
+ }
+
+ @Override
+ public String createEQ(String attribute, String bindName) {
+ return attribute + "=" + adaptBindName(bindName);
+ }
+
+ @Override
+ public String createDateEQ(String attribute, String bindName) {
+ return attribute + "=TRUNC(" + adaptBindName(bindName) + ")";
+ }
+
+ @Override
+ public String createDateTimeEQ(String attribute, String bindName) {
+ return attribute + "=TRUNC(" + adaptBindNameTimeDateOp(bindName) + ",'MI')";
+ }
+
+ @Override
+ public String createGE(String attribute, String bindName) {
+ return attribute + ">=" + adaptBindName(bindName);
+ }
+
+ @Override
+ public String createDateGE(String attribute, String bindName) {
+ return attribute + ">=TRUNC(" + adaptBindName(bindName) + ")";
+ }
+
+ @Override
+ public String createDateTimeGE(String attribute, String bindName) {
+ return attribute + ">=TRUNC(" + adaptBindNameTimeDateOp(bindName) + ",'MI')";
+ }
+
+ @Override
+ public String createGT(String attribute, String bindName) {
+ return attribute + ">" + adaptBindName(bindName);
+ }
+
+ @Override
+ public String createDateGT(String attribute, String bindName) {
+ return attribute + ">TRUNC(" + adaptBindName(bindName) + ")";
+ }
+
+ @Override
+ public String createDateTimeGT(String attribute, String bindName) {
+ return attribute + ">TRUNC(" + adaptBindNameTimeDateOp(bindName) + ",'MI')";
+ }
+
+ @Override
+ public String createLE(String attribute, String bindName) {
+ return attribute + "<=" + adaptBindName(bindName);
+ }
+
+ @Override
+ public String createDateLE(String attribute, String bindName) {
+ return attribute + "<=(TRUNC(" + adaptBindName(bindName) + ")+(86399/86400))";
+ }
+
+ @Override
+ public String createDateTimeLE(String attribute, String bindName) {
+ return attribute + "<=(TRUNC(" + adaptBindNameTimeDateOp(bindName) + ",'MI')+(59/1440))";
+ }
+
+ @Override
+ public String createLT(String attribute, String bindName) {
+ return attribute + "<" + adaptBindName(bindName);
+ }
+
+ @Override
+ public String createDateLT(String attribute, String bindName) {
+ return attribute + "<TRUNC(" + adaptBindName(bindName) + ")";
+ }
+
+ @Override
+ public String createDateTimeLT(String attribute, String bindName) {
+ return attribute + "<TRUNC(" + adaptBindNameTimeDateOp(bindName) + ",'MI')";
+ }
+
+ @Override
+ public String createNEQ(String attribute, String bindName) {
+ return attribute + "<>" + adaptBindName(bindName);
+ }
+
+ @Override
+ public String createDateNEQ(String attribute, String bindName) {
+ return attribute + "<>TRUNC(" + adaptBindName(bindName) + ")";
+ }
+
+ @Override
+ public String createDateTimeNEQ(String attribute, String bindName) {
+ return attribute + "<>TRUNC(" + adaptBindNameTimeDateOp(bindName) + ",'MI')";
+ }
+
+ protected abstract int getMaxListSize();
+
+ @Override
+ public String createInList(String attribute, Object array) {
+ Object[] values = toArray(array);
+ if (values.length == 0) {
+ return createNull(attribute);
+ }
+ int max = getMaxListSize();
+ StringBuffer buf = new StringBuffer();
+ buf.append("(");// bracket 1
+ for (int i = 0; i < values.length; i = i + max) {
+ if (i > 0) {
+ buf.append(" OR ");
+ }
+ buf.append("(");// bracket 2
+ buf.append(attribute);
+ buf.append(" IN ");
+ buf.append("(");// bracket 3
+ for (int k = i; k < values.length && k < i + max; k++) {
+ if (k > i) {
+ buf.append(",");
+ }
+ buf.append(toPlainText(values[k]));
+ }
+ buf.append(")");// bracket 3
+ buf.append(")");// bracket 2
+ }
+ buf.append(")");// bracket 1
+ return buf.toString();
+ }
+
+ @Override
+ public String createNotInList(String attribute, Object array) {
+ Object[] values = toArray(array);
+ if (values.length == 0) {
+ return createNotNull(attribute);
+ }
+ int max = getMaxListSize();
+ StringBuffer buf = new StringBuffer();
+ buf.append("(");// bracket 1
+ for (int i = 0; i < values.length; i = i + max) {
+ if (i > 0) {
+ buf.append(" AND ");
+ }
+ buf.append("(");// bracket 2
+ buf.append(attribute);
+ buf.append(" NOT IN ");
+ buf.append("(");// bracket 3
+ for (int k = i; k < values.length && k < i + max; k++) {
+ if (k > i) {
+ buf.append(",");
+ }
+ buf.append(toPlainText(values[k]));
+ }
+ buf.append(")");// bracket 3
+ buf.append(")");// bracket 2
+ }
+ buf.append(")");// bracket 1
+ return buf.toString();
+ }
+
+ @Override
+ public String getSysdateToken() {
+ return "SYSDATE";
+ }
+
+ @Override
+ public String getLowerToken() {
+ return "LOWER";
+ }
+
+ @Override
+ public String getUpperToken() {
+ return "UPPER";
+ }
+
+ @Override
+ public String getTrimToken() {
+ return "TRIM";
+ }
+
+ @Override
+ public String getNvlToken() {
+ return "NVL";
+ }
+
+ protected Object[] toArray(Object array) {
+ if (array == null) {
+ return new Object[0];
+ }
+ if (!array.getClass().isArray()) {
+ return new Object[]{array};
+ }
+ int len = Array.getLength(array);
+ Object[] a = new Object[len];
+ for (int i = 0; i < a.length; i++) {
+ a[i] = Array.get(array, i);
+ }
+ return a;
+ }
+
+ protected String adaptBindName(String bindName) {
+ if (bindName == null) {
+ return bindName;
+ }
+ if (bindName.startsWith(PLAIN_BIND_MARKER_PREFIX)) {
+ return bindName.substring(1);
+ }
+ return ":" + bindName;
+ }
+
+ protected String adaptBindNameTimeDateOp(String bindName) {
+ return adaptBindName(bindName);
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/style/DB2OracleModeSqlStyle.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/style/DB2OracleModeSqlStyle.java
index 7abf077afa..73b76a813a 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/style/DB2OracleModeSqlStyle.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/style/DB2OracleModeSqlStyle.java
@@ -1,38 +1,38 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc.style;
-
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.sql.Statement;
-
-public class DB2OracleModeSqlStyle extends DB2SqlStyle {
-
- private static final long serialVersionUID = 1L;
-
- @Override
- public void testConnection(Connection conn) throws SQLException {
- Statement testStatement = null;
- try {
- testStatement = conn.createStatement();
- testStatement.execute("SELECT 1 FROM DUAL");
- }
- finally {
- if (testStatement != null) {
- try {
- testStatement.close();
- }
- catch (Throwable t) {
- }
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc.style;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+public class DB2OracleModeSqlStyle extends DB2SqlStyle {
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void testConnection(Connection conn) throws SQLException {
+ Statement testStatement = null;
+ try {
+ testStatement = conn.createStatement();
+ testStatement.execute("SELECT 1 FROM DUAL");
+ }
+ finally {
+ if (testStatement != null) {
+ try {
+ testStatement.close();
+ }
+ catch (Throwable t) {
+ }
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/style/DB2SqlStyle.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/style/DB2SqlStyle.java
index 372569ea2b..440f26a1df 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/style/DB2SqlStyle.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/style/DB2SqlStyle.java
@@ -1,66 +1,66 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc.style;
-
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.SQLException;
-
-import org.eclipse.scout.rt.server.services.common.jdbc.SqlBind;
-
-public class DB2SqlStyle extends AbstractSqlStyle {
-
- private static final long serialVersionUID = 1L;
-
- @Override
- public String getConcatOp() {
- return "||";
- }
-
- @Override
- public String getLikeWildcard() {
- return "%";
- }
-
- @Override
- protected int getMaxListSize() {
- return 1000;
- }
-
- @Override
- public boolean isLargeString(String s) {
- return (s.length() > 4000);
- }
-
- @Override
- public boolean isBlobEnabled() {
- return true;
- }
-
- @Override
- public boolean isClobEnabled() {
- return true;
- }
-
- @Override
- public void testConnection(Connection conn) throws SQLException {
- }
-
- @Override
- public void writeBind(PreparedStatement ps, int jdbcBindIndex, SqlBind bind) throws SQLException {
- super.writeBind(ps, jdbcBindIndex, bind);
- }
-
- @Override
- protected String adaptBindNameTimeDateOp(String bindName) {
- return " TO_NUMBER(" + adaptBindName(bindName) + ") ";
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc.style;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+
+import org.eclipse.scout.rt.server.services.common.jdbc.SqlBind;
+
+public class DB2SqlStyle extends AbstractSqlStyle {
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public String getConcatOp() {
+ return "||";
+ }
+
+ @Override
+ public String getLikeWildcard() {
+ return "%";
+ }
+
+ @Override
+ protected int getMaxListSize() {
+ return 1000;
+ }
+
+ @Override
+ public boolean isLargeString(String s) {
+ return (s.length() > 4000);
+ }
+
+ @Override
+ public boolean isBlobEnabled() {
+ return true;
+ }
+
+ @Override
+ public boolean isClobEnabled() {
+ return true;
+ }
+
+ @Override
+ public void testConnection(Connection conn) throws SQLException {
+ }
+
+ @Override
+ public void writeBind(PreparedStatement ps, int jdbcBindIndex, SqlBind bind) throws SQLException {
+ super.writeBind(ps, jdbcBindIndex, bind);
+ }
+
+ @Override
+ protected String adaptBindNameTimeDateOp(String bindName) {
+ return " TO_NUMBER(" + adaptBindName(bindName) + ") ";
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/style/ISqlStyle.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/style/ISqlStyle.java
index da3709498a..b3ea7ac6fa 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/style/ISqlStyle.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/style/ISqlStyle.java
@@ -1,1116 +1,1116 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc.style;
-
-import java.io.Serializable;
-import java.sql.CallableStatement;
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.ResultSetMetaData;
-import java.sql.SQLException;
-
-import org.eclipse.scout.commons.holders.IHolder;
-import org.eclipse.scout.rt.server.services.common.jdbc.SqlBind;
-
-/**
- * <p>
- * The interface provides database independent access to SQL building blocks.
- * </p>
- * <h2>Example:</h2>
- * <p>
- * Instead of writing in Oracle syntax a condition like
- *
- * <pre>
- * String condition = &quot;AND NVL(start_date, SYSDATE) &gt; :date&quot;;
- * </pre>
- *
- * the code
- *
- * <pre>
- * {@link ISqlStyle} style = service.getSqlStyle();
- * String condition = &quot;AND &quot; + style.nvl(&quot;start_date&quot;, &quot;end_date&quot;) + &quot;(start_date, end_date) &gt; :date&quot;;
- * </pre>
- *
- * is used. On Oracle it will be translated to <code>NVL(start_date, end_date)</code>, but when running MSSQL you would
- * get <code>ISNULL(start_date, end_date)</code>
- * </p>
- * <h2>Bind Names</h2>
- * <p>
- * All methods that require a bindName accept bind names (without <code>:</code> prefix) <i>or</i> a plain bind value
- * (prepend a {@value #PLAIN_BIND_MARKER_PREFIX}). Plain bind values are created using {@link #toPlainText(Object)}
- * <table>
- * <tr>
- * <td>Examples for bind names:</td>
- * <td> <code>personId</code>, <code>id</code>, <code>name</code>, <code>age</code>, <code>active</code></td>
- * </tr>
- * <tr>
- * <td>Examples for plain bind values inclusive marker prefix:</td>
- * <td><code>&123</code>, <code>&'John'</code>, <code>&to_date('01.01.2010','dd.mm.yyyy')</code></td>
- * </tr>
- * </table>
- * </p>
- */
-public interface ISqlStyle extends Serializable {
- /**
- * Can be used to escape plain text that must not be prefixed by <code>:</code><br />
- * E.g.
- *
- * <pre>
- * createNotLike(&quot;P.NAME&quot;, PLAIN_BIND_MARKER_PREFIX + &quot;'%test'&quot;)
- * </pre>
- *
- * to generate <code>P.NAME not like '%test'</code> instead of <code>P.NAME not like :'%test'</code>
- */
- String PLAIN_BIND_MARKER_PREFIX = "&";
-
- /**
- * ansi: <code>+</code>
- */
- String getConcatOp();
-
- /**
- * ansi: <code>*</code>
- */
- String getLikeWildcard();
-
- String toPlainText(Object value);
-
- /**
- * convert <code>*</code> into <code>%</code>
- */
- String toLikePattern(Object value);
-
- /**
- * bind factory see {@link #isBlobEnabled()}, {@link #isClobEnabled()} and {@link #isLargeString(String)}
- *
- * @param o
- * the value to be bound. If the value is a {@link IHolder} then its content value is used
- * @param nullType
- * only used in case o is null. If the type is a {@link IHolder} type then its component type is used
- * Ignored otherwise.
- */
- SqlBind buildBindFor(Object o, Class nullType);
-
- /**
- * <code>COUNT(p.BUDGET)</code>
- */
- String toAggregationCount(String attribute);
-
- /**
- * <code>MIN(p.BUDGET)</code>
- */
- String toAggregationMin(String attribute);
-
- /**
- * <code>MAX(p.BUDGET)</code>
- */
- String toAggregationMax(String attribute);
-
- /**
- * <code>SUM(p.BUDGET)</code>
- */
- String toAggregationSum(String attribute);
-
- /**
- * <code>AVG(p.BUDGET)</code>
- */
- String toAggregationAvg(String attribute);
-
- /**
- * <code>MEDIAN(p.BUDGET)</code>
- */
- String toAggregationMedian(String attribute);
-
- /**
- * apply bind value to a {@link PreparedStatement}
- */
- void writeBind(PreparedStatement ps, int jdbcBindIndex, SqlBind bind) throws SQLException;
-
- /**
- * read bind value from a {@link ResultSet}
- */
- Object readBind(ResultSet rs, ResultSetMetaData meta, int type, int jdbcBindIndex) throws SQLException;
-
- /**
- * apply out parameter to a stored procedure call in a {@link CallableStatement}
- */
- void registerOutput(CallableStatement cs, int index, Class bindType) throws SQLException;
-
- /**
- * test a connection before use<br />
- * Note: this method is called before *every* sql connection pool transaction<br />
- * Note: this method is not called when an rmi connection pool is used
- */
- void testConnection(Connection conn) throws SQLException;
-
- /**
- * flag signaling whether <code>BLOB</code> or <code>LONG RAW</code> should be used for <code>byte[]</code> binds
- */
- boolean isBlobEnabled();
-
- /**
- * flag signaling whether <code>CLOB</code> or <code>LONG VARCHAR</code> should be used for <code>char[]</code> and
- * large {@link String} binds
- */
- boolean isClobEnabled();
-
- /**
- * @return <code>true</code> to handle string as <code>CLOB</code> resp. <code>LONG VARCHAR</code> or
- * <code>false</code> to handle
- * string as simple {@link String} see {@link #isClobEnabled()}
- */
- boolean isLargeString(String s);
-
- /*
- * Attribute filters Aggregate SQL code transforming the template code to
- * specific database sql the following methods display an example of an
- * "sql attribute constraint" in the javadoc comment
- */
-
- /**
- * <code>P.BUDGET between :bindName1 and :bindName2</code><br />
- * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
- * <p>
- * for dates use {@link #createDateBetween(String, String, String)} and
- * {@link #createDateTimeBetween(String, String, String)}
- * </p>
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * attribute BETWEEN :firstBind AND :secondBind
- * </pre>
- */
- String createBetween(String attribute, String bindName1, String bindName2);
-
- /**
- * <code>P.EVT_CREATED between :bindName1 and :bindName2</code><br />
- * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- * </p>
- *
- * <pre>
- * attribute BETWEEN TRUNC( :firstBind ) AND (TRUNC( :secondBind ) + (86399/86400))
- * </pre>
- */
- String createDateBetween(String attribute, String bindName1, String bindName2);
-
- /**
- * <code>P.EVT_CREATED between :bindName1 and :bindName2</code><br />
- * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * attribute BETWEEN TRUNC( :firstBind , 'MI' ) AND (TRUNC( :secondBind , 'MI') + (59/1440))
- * </pre>
- */
- String createDateTimeBetween(String attribute, String bindName1, String bindName2);
-
- /**
- * <code>P.NAME like :bindName||'*'</code><br />
- * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * UPPER( attribute ) LIKE UPPER( :firstBind || '%')
- * </pre>
- */
- String createStartsWith(String attribute, String bindName);
-
- /**
- * <code>P.NAME not like :bindName||'*'</code><br />
- * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * UPPER( attribute ) NOT LIKE UPPER( :firstBind || '%')
- * </pre>
- */
- String createNotStartsWith(String attribute, String bindName);
-
- /**
- * <code>P.NAME like '*'||:bindName</code><br />
- * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * UPPER( attribute ) LIKE UPPER( '%' || :firstBind )
- * </pre>
- */
- String createEndsWith(String attribute, String bindName);
-
- /**
- * <code>P.NAME not like '*'||:bindName</code><br />
- * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * UPPER( attribute ) NOT LIKE UPPER( '%' || :firstBind )
- * </pre>
- */
- String createNotEndsWith(String attribute, String bindName);
-
- /**
- * <code>P.NAME like '*'||:bindName||'*'</code><br />
- * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * UPPER( attribute ) LIKE UPPER('%'|| :firstBind ||'%')
- * </pre>
- */
- String createContains(String attribute, String bindName);
-
- /**
- * <p>
- * <code>P.NAME not like '*'||:bindName||'*'</code><br />
- * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
- * </p>
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * UPPER( attribute ) NOT LIKE UPPER('%'|| :firstBind ||'%')
- * </pre>
- */
- String createNotContains(String attribute, String bindName);
-
- /**
- * <code>P.NAME like :bindName</code><br />
- * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * UPPER( attribute ) LIKE UPPER( :firstBind )
- * </pre>
- */
- String createLike(String attribute, String bindName);
-
- /**
- * <code>P.NAME not like :bindName</code><br />
- * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * UPPER( attribute ) NOT LIKE UPPER( :firstBind )
- * </pre>
- */
- String createNotLike(String attribute, String bindName);
-
- /**
- * <code>P.NAME is null</code>
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * attribute IS NULL</code>
- * </p>
- */
- String createNull(String attribute);
-
- /**
- * <code>P.NAME not null</code><br />
- * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * attribute IS NOT NULL
- * </pre>
- */
- String createNotNull(String attribute);
-
- /**
- * <code>nvl(P.NAME,0) = 0</code><br />
- * special case for '<code>number is null</code>', if <code>0</code> and <code>null</code> are
- * treated equally
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * NVL(attribute, 0) = 0
- * </pre>
- */
- String createNumberNull(String attribute);
-
- /**
- * <code>nvl(P.NAME,0)<>0</code><br />
- * special case for '<code>number is null</code>', if <code>0</code> and <code>null</code> are
- * treated equally
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * NVL( attribute, 0) <> 0
- * </pre>
- */
- String createNumberNotNull(String attribute);
-
- /**
- * <code>nvl(P.NAME,'0')=='0'</code><br />
- * special case for '<code>text is null</code>', if <code>'0'</code> and <code>null</code> are
- * treated equally
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * NVL(attribute, '0') = '0'
- * </pre>
- */
- String createTextNull(String attribute);
-
- /**
- * <code>nvl(P.NAME,'0')<>'0'</code><br />
- * special case for '<code>text is null</code>' when <code>'0'</code> and <code>null</code> are
- * treated equally
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * NVL( attribute, '0') <> '0'
- * </pre>
- */
- String createTextNotNull(String attribute);
-
- /**
- * <code>P.NAME in :bindName</code><br />
- * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX} )
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * attribute IN ( :{firstBind} )
- * </pre>
- */
- String createIn(String attribute, String bindName);
-
- /**
- * <code>P.NAME not in :bindName</code><br />
- * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * NOT( attribute IN ( :{firstBind} ))
- * </pre>
- */
- String createNotIn(String attribute, String bindName);
-
- /**
- * <code>P.NAME in (o1,o2,...)</code><br />
- * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
- */
- String createInList(String attribute, Object array);
-
- /**
- * <code>P.NAME not in (o1,o2,...)</code><br />
- * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
- */
- String createNotInList(String attribute, Object array);
-
- /**
- * <code>P.NAME dateIsToday</code>
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * attribute >= TRUNC(SYSDATE) AND attribute < TRUNC(SYSDATE+1)
- * </pre>
- */
- String createDateIsToday(String attribute);
-
- /**
- * <code>P.NAME dateIsInLastDays :bindName</code><br />
- * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * attribute >= TRUNC(SYSDATE-( :firstBind ))
- * AND
- * attribute < TRUNC(SYSDATE+1)
- * </pre>
- */
- String createDateIsInLastDays(String attribute, String bindName);
-
- /**
- * <code>P.NAME dateIsInNextDays :bindName</code><br />
- * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * attribute &gt;= TRUNC(SYSDATE)
- * AND
- * attribute < TRUNC(SYSDATE+ :firstBind +1)
- * </pre>
- */
- String createDateIsInNextDays(String attribute, String bindName);
-
- /**
- * <code>P.NAME dateIsInDays :bindName</code><br />
- * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * attribute >= TRUNC(SYSDATE+ :firstBind )
- * AND
- * attribute < TRUNC(SYSDATE+ :firstBind +1)
- * </pre>
- */
- String createDateIsInDays(String attribute, String bindName);
-
- /**
- * <code>P.NAME dateIsInWeeks :bindName</code><br />
- * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * attribute >= TRUNC(SYSDATE+ (( :firstBind ) *7) )
- * AND
- * attribute < TRUNC(SYSDATE+(( :firstBind ) *7)+1)
- * </pre>
- */
- String createDateIsInWeeks(String attribute, String bindName);
-
- /**
- * <code>P.NAME dateIsInLastMonths :bindName</code><br />
- * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * attribute >= TRUNC(ADD_MONTHS(SYSDATE,(-1)*( :firstBind )))
- * AND
- * attribute < TRUNC(SYSDATE+1)
- * </pre>
- */
- String createDateIsInLastMonths(String attribute, String bindName);
-
- /**
- * <code>P.NAME dateIsInNextMonths :bindName</code><br />
- * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * attribute >= TRUNC(SYSDATE)
- * AND
- * attribute < TRUNC(ADD_MONTHS(SYSDATE, :firstBind )+1)
- * </pre>
- */
- String createDateIsInNextMonths(String attribute, String bindName);
-
- /**
- * <code>P.NAME dateIsInMonths :bindName</code><br />
- * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * attribute >= TRUNC(ADD_MONTHS(SYSDATE, :firstBind ))
- * AND
- * attribute < TRUNC(ADD_MONTHS(SYSDATE, :firstBind )+1)
- * </pre>
- */
- String createDateIsInMonths(String attribute, String bindName);
-
- /**
- * <code>P.NAME dateIsInLEDays :bindName</code><br />
- * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * attribute < TRUNC(SYSDATE + :firstBind +1)
- * </pre>
- */
- String createDateIsInLEDays(String attribute, String bindName);
-
- /**
- * <code>P.NAME dateIsInLEWeeks :bindName</code><br />
- * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX} )
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * attribute < TRUNC(SYSDATE+(( :firstBind )*7)+1)
- * </pre>
- */
- String createDateIsInLEWeeks(String attribute, String bindName);
-
- /**
- * <code>P.NAME dateIsInLEMonths :bindName</code><br />
- * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * attribute < TRUNC(ADD_MONTHS(SYSDATE, :firstBind )+1)
- * </pre>
- */
- String createDateIsInLEMonths(String attribute, String bindName);
-
- /**
- * <code>P.NAME dateIsInGEDays :bindName</code><br />
- * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * attribute >= TRUNC(SYSDATE + :firstBind )
- * </pre>
- */
- String createDateIsInGEDays(String attribute, String bindName);
-
- /**
- * <code>P.NAME dateIsInGEWeeks :bindName</code><br />
- * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX} )
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * attribute >= TRUNC(SYSDATE+(( :firstBind )*7))
- * </pre>
- */
- String createDateIsInGEWeeks(String attribute, String bindName);
-
- /**
- * <code>P.NAME dateIsInGEMonths :bindName</code><br />
- * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * attribute >=TRUNC(ADD_MONTHS(SYSDATE, :firstBind ))
- * </pre>
- */
- String createDateIsInGEMonths(String attribute, String bindName);
-
- /**
- * <code>P.NAME dateIsNotToday</code>
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- * <code>( attribute <TRUNC(SYSDATE) OR attribute >=TRUNC(SYSDATE+1))</pre>
- * </p>
- */
- String createDateIsNotToday(String attribute);
-
- /**
- * <code>P.NAME dateTimeIsNow</code>
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * ( attribute >= TRUNC(SYSDATE, 'MI') AND attribute < (TRUNC(SYSDATE, 'MI')+(1/24/60)))
- * </pre>
- */
- String createDateTimeIsNow(String attribute);
-
- /**
- * <code>P.NAME dateTimeIsInLEMinutes :bindName</code><br />
- * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * attribute < (TRUNC(SYSDATE, 'MI')+(( :firstBind +1)/24/60))
- * </pre>
- */
- String createDateTimeIsInLEMinutes(String attribute, String bindName);
-
- /**
- * <code>P.NAME dateTimeIsInLEHours :bindName</code><br />
- * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * attribute <(TRUNC(SYSDATE, 'MI')+((1/24/60)+( :firstBind /24)))
- * </pre>
- */
- String createDateTimeIsInLEHours(String attribute, String bindName);
-
- /**
- * <code>P.NAME dateTimeIsInGEMinutes :bindName</code><br />
- * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * attribute >=(TRUNC(SYSDATE, 'MI')+( :firstBind /24/60))
- * </pre>
- */
- String createDateTimeIsInGEMinutes(String attribute, String bindName);
-
- /**
- * <code>P.NAME dateTimeIsInGEHours :bindName</code><br />
- * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * attribute >= (TRUNC(SYSDATE, 'MI')+( :firstBind /24))
- * </pre>
- */
- String createDateTimeIsInGEHours(String attribute, String bindName);
-
- /**
- * <code>P.NAME dateTimeIsNotNow</code>
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * ( attribute <TRUNC(SYSDATE, 'MI') OR attribute >=(TRUNC(SYSDATE, 'MI')+(1/24/60)))
- * </pre>
- */
- String createDateTimeIsNotNow(String attribute);
-
- /**
- * <code>P.NAME timeIsNow</code>
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * attribute >= ((TO_CHAR(SYSDATE,'HH24')*60) + TO_CHAR(SYSDATE,'MI'))/24/60</code><br />
- * AND
- * attribute < ((TO_CHAR(SYSDATE,'HH24')*60) + TO_CHAR(SYSDATE,'MI')+(1/24/60))/24/60
- * </pre>
- */
- String createTimeIsNow(String attribute);
-
- /**
- * <code>P.NAME timeIsNow</code>
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * attribute < ((TO_CHAR(SYSDATE,'HH24')*60) + TO_CHAR(SYSDATE,'MI'))/24/60</code><br />
- * OR
- * attribute > ((TO_CHAR(SYSDATE,'HH24')*60)+TO_CHAR(SYSDATE,'MI')+(1/24/60))/24/60
- * </pre>
- */
- String createTimeIsNotNow(String attribute);
-
- /**
- * <code>P.NAME timeIsInMinutes :bindName</code><br />
- * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX} )
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * attribute >=((TO_CHAR(SYSDATE,'HH24')*60) + TO_CHAR(SYSDATE,'MI')+( :firstBind /24/60))/24/60
- * AND
- * attribute <((TO_CHAR(SYSDATE,'HH24')*60)+TO_CHAR(SYSDATE,'MI')+(( :firstBind +1)/24/60))/24/60
- * </pre>
- */
- String createTimeIsInMinutes(String attribute, String bindName);
-
- /**
- * <code>P.NAME timeIsInHours :bindName</code><br />
- * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * attribute >=((TO_CHAR(SYSDATE,'HH24')*60) + TO_CHAR(SYSDATE,'MI')+( :firstBind /24))/24/60
- * AND
- * attribute <((TO_CHAR(SYSDATE,'HH24')*60)+TO_CHAR(SYSDATE,'MI')+( :firstBind /24)+(1/24/60))/24/60
- * </pre>
- */
- String createTimeIsInHours(String attribute, String bindName);
-
- /**
- * <code>P.NAME timeIsInLEMinutes :bindName</code><br />
- * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * attribute <((TO_CHAR(SYSDATE,'HH24')*60) + TO_CHAR(SYSDATE,'MI')+(( :firstBind +1)/24/60))/24/60
- * </pre>
- */
- String createTimeIsInLEMinutes(String attribute, String bindName);
-
- /**
- * <code>P.NAME timeIsInLEHours :bindName</code><br />
- * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX} )
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * attribute <((TO_CHAR(SYSDATE,'HH24')*60) + TO_CHAR(SYSDATE,'MI')+( :firstBind /24)+(1/24/60))/24/60
- * </pre>
- */
- String createTimeIsInLEHours(String attribute, String bindName);
-
- /**
- * <code>P.NAME timeIsInGEMinutes :bindName</code><br />
- * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * attribute >=((TO_CHAR(SYSDATE,'HH24')*60) + TO_CHAR(SYSDATE,'MI')+( :firstBind /24/60))/24/60
- * </pre>
- */
- String createTimeIsInGEMinutes(String attribute, String bindName);
-
- /**
- * <code>P.NAME timeIsInGEHours :bindName</code><br />
- * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX} )
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * attribute >=((TO_CHAR(SYSDATE,'HH24')*60) + TO_CHAR(SYSDATE,'MI')+( :firstBind /24))/24/60
- * </pre>
- */
- String createTimeIsInGEHours(String attribute, String bindName);
-
- /**
- * <code>P.NAME = :bindName</code><br />
- * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
- * <p>
- * for dates use {@link #createDateEQ(String, String)} and {@link #createDateTimeEQ(String, String)}
- * </p>
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * attribute = :firstBind
- * </pre>
- */
- String createEQ(String attribute, String bindName);
-
- /**
- * <code>P.EVT_CREATED= :bindName</code><br />
- * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * attribute = TRUNC( :firstBind )
- * </pre>
- */
- String createDateEQ(String attribute, String bindName);
-
- /**
- * <code>P.EVT_CREATED = :bindName</code><br />
- * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * attribute = TRUNC( :firstBind ,'MI')
- * </pre>
- */
- String createDateTimeEQ(String attribute, String bindName);
-
- /**
- * <code>P.NAME <> :bindName</code><br />
- * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
- * <p>
- * for dates use {@link #createDateNEQ(String, String)} and {@link #createDateTimeNEQ(String, String)}
- * </p>
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * attribute <> :firstBind
- * </pre>
- */
- String createNEQ(String attribute, String bindName);
-
- /**
- * <code>P.EVT_CREATED<> :bindName</code><br />
- * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * attribute <> TRUNC( :firstBind )
- * </pre>
- */
- String createDateNEQ(String attribute, String bindName);
-
- /**
- * <code>P.EVT_CREATED <> :bindName</code><br />
- * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * attribute <> TRUNC( :firstBind ,'MI')
- * </pre>
- */
- String createDateTimeNEQ(String attribute, String bindName);
-
- /**
- * <code>P.NAME < :bindName</code><br />
- * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
- * <p>
- * for dates use {@link #createDateLT(String, String)} and {@link #createDateTimeLT(String, String)}
- * </p>
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * attribute < :firstBind
- * </pre>
- */
- String createLT(String attribute, String bindName);
-
- /**
- * <code>P.EVT_CREATED < :bindName</code><br />
- * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * attribute < TRUNC( :firstBind )
- * </pre>
- */
- String createDateLT(String attribute, String bindName);
-
- /**
- * <code>P.EVT_CREATED < :bindName</code><br />
- * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * attribute < TRUNC( :firstBind ,'MI')
- * </pre>
- */
- String createDateTimeLT(String attribute, String bindName);
-
- /**
- * <code>P.NAME <= :bindName</code><br />
- * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
- * <p>
- * for dates use {@link #createDateLE(String, String)} and {@link #createDateTimeLE(String, String)}
- * </p>
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * attribute <= :firstBind
- * </pre>
- */
- String createLE(String attribute, String bindName);
-
- /**
- * <code>P.EVT_CREATED <= :bindName</code><br />
- * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * attribute <= (TRUNC( :firstBind )+(86399/86400))
- * </pre>
- */
- String createDateLE(String attribute, String bindName);
-
- /**
- * <code>P.EVT_CREATED <= :bindName</code><br />
- * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * attribute <= (TRUNC( :firstBind ,'MI')+(59/1440))
- * </pre>
- */
- String createDateTimeLE(String attribute, String bindName);
-
- /**
- * <code>P.NAME > :bindName</code><br />
- * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
- * <p>
- * for dates use {@link #createDateGT(String, String)} and {@link #createDateTimeGT(String, String)}
- * </p>
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * attribute > :firstBind
- * </pre>
- */
- String createGT(String attribute, String bindName);
-
- /**
- * <code>P.EVT_CREATED > :bindName</code><br />
- * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * attribute > TRUNC( :firstBind )
- * </pre>
- */
- String createDateGT(String attribute, String bindName);
-
- /**
- * <code>P.EVT_CREATED > :bindName</code><br />
- * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * attribute > TRUNC( :firstBind ,'MI')
- * </pre>
- */
- String createDateTimeGT(String attribute, String bindName);
-
- /**
- * <code>P.NAME >= :bindName</code><br />
- * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
- * <p>
- * for dates use {@link #createDateGE(String, String)} and {@link #createDateTimeGE(String, String)}
- * </p>
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * attribute >= :firstBind
- * </pre>
- */
- String createGE(String attribute, String bindName);
-
- /**
- * <code>P.EVT_CREATED >= :bindName</code><br />
- * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * attribute >= TRUNC( :firstBind )
- * </pre>
- */
- String createDateGE(String attribute, String bindName);
-
- /**
- * <code>P.EVT_CREATED >= :bindName</code><br />
- * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
- * <p>
- * In an Oracle implementation this could be represented as
- * </p>
- *
- * <pre>
- * attribute >= TRUNC( :firstBind ,'MI')
- * </pre>
- */
- String createDateTimeGE(String attribute, String bindName);
-
- /**
- * expression for the current date using the database specific keyword, <code>SYSDATE</code> on oracle
- */
- String getSysdateToken();
-
- /**
- * expression for upper case text using the database specific keyword, <code>UPPER</code> on oracle
- */
- String getUpperToken();
-
- /**
- * expression for lower case text using the database specific keyword, <code>LOWER</code> on oracle
- */
- String getLowerToken();
-
- /**
- * expression for trimmed text using the database specific keyword, <code>TRIM</code> on oracle
- */
- String getTrimToken();
-
- /**
- * expression for null-value/default-value using the database specific keyword, <code>NVL</code> on oracle
- */
- String getNvlToken();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc.style;
+
+import java.io.Serializable;
+import java.sql.CallableStatement;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+
+import org.eclipse.scout.commons.holders.IHolder;
+import org.eclipse.scout.rt.server.services.common.jdbc.SqlBind;
+
+/**
+ * <p>
+ * The interface provides database independent access to SQL building blocks.
+ * </p>
+ * <h2>Example:</h2>
+ * <p>
+ * Instead of writing in Oracle syntax a condition like
+ *
+ * <pre>
+ * String condition = &quot;AND NVL(start_date, SYSDATE) &gt; :date&quot;;
+ * </pre>
+ *
+ * the code
+ *
+ * <pre>
+ * {@link ISqlStyle} style = service.getSqlStyle();
+ * String condition = &quot;AND &quot; + style.nvl(&quot;start_date&quot;, &quot;end_date&quot;) + &quot;(start_date, end_date) &gt; :date&quot;;
+ * </pre>
+ *
+ * is used. On Oracle it will be translated to <code>NVL(start_date, end_date)</code>, but when running MSSQL you would
+ * get <code>ISNULL(start_date, end_date)</code>
+ * </p>
+ * <h2>Bind Names</h2>
+ * <p>
+ * All methods that require a bindName accept bind names (without <code>:</code> prefix) <i>or</i> a plain bind value
+ * (prepend a {@value #PLAIN_BIND_MARKER_PREFIX}). Plain bind values are created using {@link #toPlainText(Object)}
+ * <table>
+ * <tr>
+ * <td>Examples for bind names:</td>
+ * <td> <code>personId</code>, <code>id</code>, <code>name</code>, <code>age</code>, <code>active</code></td>
+ * </tr>
+ * <tr>
+ * <td>Examples for plain bind values inclusive marker prefix:</td>
+ * <td><code>&123</code>, <code>&'John'</code>, <code>&to_date('01.01.2010','dd.mm.yyyy')</code></td>
+ * </tr>
+ * </table>
+ * </p>
+ */
+public interface ISqlStyle extends Serializable {
+ /**
+ * Can be used to escape plain text that must not be prefixed by <code>:</code><br />
+ * E.g.
+ *
+ * <pre>
+ * createNotLike(&quot;P.NAME&quot;, PLAIN_BIND_MARKER_PREFIX + &quot;'%test'&quot;)
+ * </pre>
+ *
+ * to generate <code>P.NAME not like '%test'</code> instead of <code>P.NAME not like :'%test'</code>
+ */
+ String PLAIN_BIND_MARKER_PREFIX = "&";
+
+ /**
+ * ansi: <code>+</code>
+ */
+ String getConcatOp();
+
+ /**
+ * ansi: <code>*</code>
+ */
+ String getLikeWildcard();
+
+ String toPlainText(Object value);
+
+ /**
+ * convert <code>*</code> into <code>%</code>
+ */
+ String toLikePattern(Object value);
+
+ /**
+ * bind factory see {@link #isBlobEnabled()}, {@link #isClobEnabled()} and {@link #isLargeString(String)}
+ *
+ * @param o
+ * the value to be bound. If the value is a {@link IHolder} then its content value is used
+ * @param nullType
+ * only used in case o is null. If the type is a {@link IHolder} type then its component type is used
+ * Ignored otherwise.
+ */
+ SqlBind buildBindFor(Object o, Class nullType);
+
+ /**
+ * <code>COUNT(p.BUDGET)</code>
+ */
+ String toAggregationCount(String attribute);
+
+ /**
+ * <code>MIN(p.BUDGET)</code>
+ */
+ String toAggregationMin(String attribute);
+
+ /**
+ * <code>MAX(p.BUDGET)</code>
+ */
+ String toAggregationMax(String attribute);
+
+ /**
+ * <code>SUM(p.BUDGET)</code>
+ */
+ String toAggregationSum(String attribute);
+
+ /**
+ * <code>AVG(p.BUDGET)</code>
+ */
+ String toAggregationAvg(String attribute);
+
+ /**
+ * <code>MEDIAN(p.BUDGET)</code>
+ */
+ String toAggregationMedian(String attribute);
+
+ /**
+ * apply bind value to a {@link PreparedStatement}
+ */
+ void writeBind(PreparedStatement ps, int jdbcBindIndex, SqlBind bind) throws SQLException;
+
+ /**
+ * read bind value from a {@link ResultSet}
+ */
+ Object readBind(ResultSet rs, ResultSetMetaData meta, int type, int jdbcBindIndex) throws SQLException;
+
+ /**
+ * apply out parameter to a stored procedure call in a {@link CallableStatement}
+ */
+ void registerOutput(CallableStatement cs, int index, Class bindType) throws SQLException;
+
+ /**
+ * test a connection before use<br />
+ * Note: this method is called before *every* sql connection pool transaction<br />
+ * Note: this method is not called when an rmi connection pool is used
+ */
+ void testConnection(Connection conn) throws SQLException;
+
+ /**
+ * flag signaling whether <code>BLOB</code> or <code>LONG RAW</code> should be used for <code>byte[]</code> binds
+ */
+ boolean isBlobEnabled();
+
+ /**
+ * flag signaling whether <code>CLOB</code> or <code>LONG VARCHAR</code> should be used for <code>char[]</code> and
+ * large {@link String} binds
+ */
+ boolean isClobEnabled();
+
+ /**
+ * @return <code>true</code> to handle string as <code>CLOB</code> resp. <code>LONG VARCHAR</code> or
+ * <code>false</code> to handle
+ * string as simple {@link String} see {@link #isClobEnabled()}
+ */
+ boolean isLargeString(String s);
+
+ /*
+ * Attribute filters Aggregate SQL code transforming the template code to
+ * specific database sql the following methods display an example of an
+ * "sql attribute constraint" in the javadoc comment
+ */
+
+ /**
+ * <code>P.BUDGET between :bindName1 and :bindName2</code><br />
+ * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
+ * <p>
+ * for dates use {@link #createDateBetween(String, String, String)} and
+ * {@link #createDateTimeBetween(String, String, String)}
+ * </p>
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * attribute BETWEEN :firstBind AND :secondBind
+ * </pre>
+ */
+ String createBetween(String attribute, String bindName1, String bindName2);
+
+ /**
+ * <code>P.EVT_CREATED between :bindName1 and :bindName2</code><br />
+ * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ * </p>
+ *
+ * <pre>
+ * attribute BETWEEN TRUNC( :firstBind ) AND (TRUNC( :secondBind ) + (86399/86400))
+ * </pre>
+ */
+ String createDateBetween(String attribute, String bindName1, String bindName2);
+
+ /**
+ * <code>P.EVT_CREATED between :bindName1 and :bindName2</code><br />
+ * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * attribute BETWEEN TRUNC( :firstBind , 'MI' ) AND (TRUNC( :secondBind , 'MI') + (59/1440))
+ * </pre>
+ */
+ String createDateTimeBetween(String attribute, String bindName1, String bindName2);
+
+ /**
+ * <code>P.NAME like :bindName||'*'</code><br />
+ * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * UPPER( attribute ) LIKE UPPER( :firstBind || '%')
+ * </pre>
+ */
+ String createStartsWith(String attribute, String bindName);
+
+ /**
+ * <code>P.NAME not like :bindName||'*'</code><br />
+ * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * UPPER( attribute ) NOT LIKE UPPER( :firstBind || '%')
+ * </pre>
+ */
+ String createNotStartsWith(String attribute, String bindName);
+
+ /**
+ * <code>P.NAME like '*'||:bindName</code><br />
+ * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * UPPER( attribute ) LIKE UPPER( '%' || :firstBind )
+ * </pre>
+ */
+ String createEndsWith(String attribute, String bindName);
+
+ /**
+ * <code>P.NAME not like '*'||:bindName</code><br />
+ * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * UPPER( attribute ) NOT LIKE UPPER( '%' || :firstBind )
+ * </pre>
+ */
+ String createNotEndsWith(String attribute, String bindName);
+
+ /**
+ * <code>P.NAME like '*'||:bindName||'*'</code><br />
+ * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * UPPER( attribute ) LIKE UPPER('%'|| :firstBind ||'%')
+ * </pre>
+ */
+ String createContains(String attribute, String bindName);
+
+ /**
+ * <p>
+ * <code>P.NAME not like '*'||:bindName||'*'</code><br />
+ * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
+ * </p>
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * UPPER( attribute ) NOT LIKE UPPER('%'|| :firstBind ||'%')
+ * </pre>
+ */
+ String createNotContains(String attribute, String bindName);
+
+ /**
+ * <code>P.NAME like :bindName</code><br />
+ * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * UPPER( attribute ) LIKE UPPER( :firstBind )
+ * </pre>
+ */
+ String createLike(String attribute, String bindName);
+
+ /**
+ * <code>P.NAME not like :bindName</code><br />
+ * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * UPPER( attribute ) NOT LIKE UPPER( :firstBind )
+ * </pre>
+ */
+ String createNotLike(String attribute, String bindName);
+
+ /**
+ * <code>P.NAME is null</code>
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * attribute IS NULL</code>
+ * </p>
+ */
+ String createNull(String attribute);
+
+ /**
+ * <code>P.NAME not null</code><br />
+ * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * attribute IS NOT NULL
+ * </pre>
+ */
+ String createNotNull(String attribute);
+
+ /**
+ * <code>nvl(P.NAME,0) = 0</code><br />
+ * special case for '<code>number is null</code>', if <code>0</code> and <code>null</code> are
+ * treated equally
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * NVL(attribute, 0) = 0
+ * </pre>
+ */
+ String createNumberNull(String attribute);
+
+ /**
+ * <code>nvl(P.NAME,0)<>0</code><br />
+ * special case for '<code>number is null</code>', if <code>0</code> and <code>null</code> are
+ * treated equally
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * NVL( attribute, 0) <> 0
+ * </pre>
+ */
+ String createNumberNotNull(String attribute);
+
+ /**
+ * <code>nvl(P.NAME,'0')=='0'</code><br />
+ * special case for '<code>text is null</code>', if <code>'0'</code> and <code>null</code> are
+ * treated equally
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * NVL(attribute, '0') = '0'
+ * </pre>
+ */
+ String createTextNull(String attribute);
+
+ /**
+ * <code>nvl(P.NAME,'0')<>'0'</code><br />
+ * special case for '<code>text is null</code>' when <code>'0'</code> and <code>null</code> are
+ * treated equally
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * NVL( attribute, '0') <> '0'
+ * </pre>
+ */
+ String createTextNotNull(String attribute);
+
+ /**
+ * <code>P.NAME in :bindName</code><br />
+ * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX} )
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * attribute IN ( :{firstBind} )
+ * </pre>
+ */
+ String createIn(String attribute, String bindName);
+
+ /**
+ * <code>P.NAME not in :bindName</code><br />
+ * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * NOT( attribute IN ( :{firstBind} ))
+ * </pre>
+ */
+ String createNotIn(String attribute, String bindName);
+
+ /**
+ * <code>P.NAME in (o1,o2,...)</code><br />
+ * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
+ */
+ String createInList(String attribute, Object array);
+
+ /**
+ * <code>P.NAME not in (o1,o2,...)</code><br />
+ * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
+ */
+ String createNotInList(String attribute, Object array);
+
+ /**
+ * <code>P.NAME dateIsToday</code>
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * attribute >= TRUNC(SYSDATE) AND attribute < TRUNC(SYSDATE+1)
+ * </pre>
+ */
+ String createDateIsToday(String attribute);
+
+ /**
+ * <code>P.NAME dateIsInLastDays :bindName</code><br />
+ * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * attribute >= TRUNC(SYSDATE-( :firstBind ))
+ * AND
+ * attribute < TRUNC(SYSDATE+1)
+ * </pre>
+ */
+ String createDateIsInLastDays(String attribute, String bindName);
+
+ /**
+ * <code>P.NAME dateIsInNextDays :bindName</code><br />
+ * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * attribute &gt;= TRUNC(SYSDATE)
+ * AND
+ * attribute < TRUNC(SYSDATE+ :firstBind +1)
+ * </pre>
+ */
+ String createDateIsInNextDays(String attribute, String bindName);
+
+ /**
+ * <code>P.NAME dateIsInDays :bindName</code><br />
+ * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * attribute >= TRUNC(SYSDATE+ :firstBind )
+ * AND
+ * attribute < TRUNC(SYSDATE+ :firstBind +1)
+ * </pre>
+ */
+ String createDateIsInDays(String attribute, String bindName);
+
+ /**
+ * <code>P.NAME dateIsInWeeks :bindName</code><br />
+ * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * attribute >= TRUNC(SYSDATE+ (( :firstBind ) *7) )
+ * AND
+ * attribute < TRUNC(SYSDATE+(( :firstBind ) *7)+1)
+ * </pre>
+ */
+ String createDateIsInWeeks(String attribute, String bindName);
+
+ /**
+ * <code>P.NAME dateIsInLastMonths :bindName</code><br />
+ * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * attribute >= TRUNC(ADD_MONTHS(SYSDATE,(-1)*( :firstBind )))
+ * AND
+ * attribute < TRUNC(SYSDATE+1)
+ * </pre>
+ */
+ String createDateIsInLastMonths(String attribute, String bindName);
+
+ /**
+ * <code>P.NAME dateIsInNextMonths :bindName</code><br />
+ * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * attribute >= TRUNC(SYSDATE)
+ * AND
+ * attribute < TRUNC(ADD_MONTHS(SYSDATE, :firstBind )+1)
+ * </pre>
+ */
+ String createDateIsInNextMonths(String attribute, String bindName);
+
+ /**
+ * <code>P.NAME dateIsInMonths :bindName</code><br />
+ * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * attribute >= TRUNC(ADD_MONTHS(SYSDATE, :firstBind ))
+ * AND
+ * attribute < TRUNC(ADD_MONTHS(SYSDATE, :firstBind )+1)
+ * </pre>
+ */
+ String createDateIsInMonths(String attribute, String bindName);
+
+ /**
+ * <code>P.NAME dateIsInLEDays :bindName</code><br />
+ * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * attribute < TRUNC(SYSDATE + :firstBind +1)
+ * </pre>
+ */
+ String createDateIsInLEDays(String attribute, String bindName);
+
+ /**
+ * <code>P.NAME dateIsInLEWeeks :bindName</code><br />
+ * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX} )
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * attribute < TRUNC(SYSDATE+(( :firstBind )*7)+1)
+ * </pre>
+ */
+ String createDateIsInLEWeeks(String attribute, String bindName);
+
+ /**
+ * <code>P.NAME dateIsInLEMonths :bindName</code><br />
+ * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * attribute < TRUNC(ADD_MONTHS(SYSDATE, :firstBind )+1)
+ * </pre>
+ */
+ String createDateIsInLEMonths(String attribute, String bindName);
+
+ /**
+ * <code>P.NAME dateIsInGEDays :bindName</code><br />
+ * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * attribute >= TRUNC(SYSDATE + :firstBind )
+ * </pre>
+ */
+ String createDateIsInGEDays(String attribute, String bindName);
+
+ /**
+ * <code>P.NAME dateIsInGEWeeks :bindName</code><br />
+ * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX} )
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * attribute >= TRUNC(SYSDATE+(( :firstBind )*7))
+ * </pre>
+ */
+ String createDateIsInGEWeeks(String attribute, String bindName);
+
+ /**
+ * <code>P.NAME dateIsInGEMonths :bindName</code><br />
+ * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * attribute >=TRUNC(ADD_MONTHS(SYSDATE, :firstBind ))
+ * </pre>
+ */
+ String createDateIsInGEMonths(String attribute, String bindName);
+
+ /**
+ * <code>P.NAME dateIsNotToday</code>
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ * <code>( attribute <TRUNC(SYSDATE) OR attribute >=TRUNC(SYSDATE+1))</pre>
+ * </p>
+ */
+ String createDateIsNotToday(String attribute);
+
+ /**
+ * <code>P.NAME dateTimeIsNow</code>
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * ( attribute >= TRUNC(SYSDATE, 'MI') AND attribute < (TRUNC(SYSDATE, 'MI')+(1/24/60)))
+ * </pre>
+ */
+ String createDateTimeIsNow(String attribute);
+
+ /**
+ * <code>P.NAME dateTimeIsInLEMinutes :bindName</code><br />
+ * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * attribute < (TRUNC(SYSDATE, 'MI')+(( :firstBind +1)/24/60))
+ * </pre>
+ */
+ String createDateTimeIsInLEMinutes(String attribute, String bindName);
+
+ /**
+ * <code>P.NAME dateTimeIsInLEHours :bindName</code><br />
+ * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * attribute <(TRUNC(SYSDATE, 'MI')+((1/24/60)+( :firstBind /24)))
+ * </pre>
+ */
+ String createDateTimeIsInLEHours(String attribute, String bindName);
+
+ /**
+ * <code>P.NAME dateTimeIsInGEMinutes :bindName</code><br />
+ * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * attribute >=(TRUNC(SYSDATE, 'MI')+( :firstBind /24/60))
+ * </pre>
+ */
+ String createDateTimeIsInGEMinutes(String attribute, String bindName);
+
+ /**
+ * <code>P.NAME dateTimeIsInGEHours :bindName</code><br />
+ * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * attribute >= (TRUNC(SYSDATE, 'MI')+( :firstBind /24))
+ * </pre>
+ */
+ String createDateTimeIsInGEHours(String attribute, String bindName);
+
+ /**
+ * <code>P.NAME dateTimeIsNotNow</code>
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * ( attribute <TRUNC(SYSDATE, 'MI') OR attribute >=(TRUNC(SYSDATE, 'MI')+(1/24/60)))
+ * </pre>
+ */
+ String createDateTimeIsNotNow(String attribute);
+
+ /**
+ * <code>P.NAME timeIsNow</code>
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * attribute >= ((TO_CHAR(SYSDATE,'HH24')*60) + TO_CHAR(SYSDATE,'MI'))/24/60</code><br />
+ * AND
+ * attribute < ((TO_CHAR(SYSDATE,'HH24')*60) + TO_CHAR(SYSDATE,'MI')+(1/24/60))/24/60
+ * </pre>
+ */
+ String createTimeIsNow(String attribute);
+
+ /**
+ * <code>P.NAME timeIsNow</code>
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * attribute < ((TO_CHAR(SYSDATE,'HH24')*60) + TO_CHAR(SYSDATE,'MI'))/24/60</code><br />
+ * OR
+ * attribute > ((TO_CHAR(SYSDATE,'HH24')*60)+TO_CHAR(SYSDATE,'MI')+(1/24/60))/24/60
+ * </pre>
+ */
+ String createTimeIsNotNow(String attribute);
+
+ /**
+ * <code>P.NAME timeIsInMinutes :bindName</code><br />
+ * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX} )
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * attribute >=((TO_CHAR(SYSDATE,'HH24')*60) + TO_CHAR(SYSDATE,'MI')+( :firstBind /24/60))/24/60
+ * AND
+ * attribute <((TO_CHAR(SYSDATE,'HH24')*60)+TO_CHAR(SYSDATE,'MI')+(( :firstBind +1)/24/60))/24/60
+ * </pre>
+ */
+ String createTimeIsInMinutes(String attribute, String bindName);
+
+ /**
+ * <code>P.NAME timeIsInHours :bindName</code><br />
+ * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * attribute >=((TO_CHAR(SYSDATE,'HH24')*60) + TO_CHAR(SYSDATE,'MI')+( :firstBind /24))/24/60
+ * AND
+ * attribute <((TO_CHAR(SYSDATE,'HH24')*60)+TO_CHAR(SYSDATE,'MI')+( :firstBind /24)+(1/24/60))/24/60
+ * </pre>
+ */
+ String createTimeIsInHours(String attribute, String bindName);
+
+ /**
+ * <code>P.NAME timeIsInLEMinutes :bindName</code><br />
+ * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * attribute <((TO_CHAR(SYSDATE,'HH24')*60) + TO_CHAR(SYSDATE,'MI')+(( :firstBind +1)/24/60))/24/60
+ * </pre>
+ */
+ String createTimeIsInLEMinutes(String attribute, String bindName);
+
+ /**
+ * <code>P.NAME timeIsInLEHours :bindName</code><br />
+ * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX} )
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * attribute <((TO_CHAR(SYSDATE,'HH24')*60) + TO_CHAR(SYSDATE,'MI')+( :firstBind /24)+(1/24/60))/24/60
+ * </pre>
+ */
+ String createTimeIsInLEHours(String attribute, String bindName);
+
+ /**
+ * <code>P.NAME timeIsInGEMinutes :bindName</code><br />
+ * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * attribute >=((TO_CHAR(SYSDATE,'HH24')*60) + TO_CHAR(SYSDATE,'MI')+( :firstBind /24/60))/24/60
+ * </pre>
+ */
+ String createTimeIsInGEMinutes(String attribute, String bindName);
+
+ /**
+ * <code>P.NAME timeIsInGEHours :bindName</code><br />
+ * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX} )
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * attribute >=((TO_CHAR(SYSDATE,'HH24')*60) + TO_CHAR(SYSDATE,'MI')+( :firstBind /24))/24/60
+ * </pre>
+ */
+ String createTimeIsInGEHours(String attribute, String bindName);
+
+ /**
+ * <code>P.NAME = :bindName</code><br />
+ * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
+ * <p>
+ * for dates use {@link #createDateEQ(String, String)} and {@link #createDateTimeEQ(String, String)}
+ * </p>
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * attribute = :firstBind
+ * </pre>
+ */
+ String createEQ(String attribute, String bindName);
+
+ /**
+ * <code>P.EVT_CREATED= :bindName</code><br />
+ * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * attribute = TRUNC( :firstBind )
+ * </pre>
+ */
+ String createDateEQ(String attribute, String bindName);
+
+ /**
+ * <code>P.EVT_CREATED = :bindName</code><br />
+ * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * attribute = TRUNC( :firstBind ,'MI')
+ * </pre>
+ */
+ String createDateTimeEQ(String attribute, String bindName);
+
+ /**
+ * <code>P.NAME <> :bindName</code><br />
+ * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
+ * <p>
+ * for dates use {@link #createDateNEQ(String, String)} and {@link #createDateTimeNEQ(String, String)}
+ * </p>
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * attribute <> :firstBind
+ * </pre>
+ */
+ String createNEQ(String attribute, String bindName);
+
+ /**
+ * <code>P.EVT_CREATED<> :bindName</code><br />
+ * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * attribute <> TRUNC( :firstBind )
+ * </pre>
+ */
+ String createDateNEQ(String attribute, String bindName);
+
+ /**
+ * <code>P.EVT_CREATED <> :bindName</code><br />
+ * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * attribute <> TRUNC( :firstBind ,'MI')
+ * </pre>
+ */
+ String createDateTimeNEQ(String attribute, String bindName);
+
+ /**
+ * <code>P.NAME < :bindName</code><br />
+ * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
+ * <p>
+ * for dates use {@link #createDateLT(String, String)} and {@link #createDateTimeLT(String, String)}
+ * </p>
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * attribute < :firstBind
+ * </pre>
+ */
+ String createLT(String attribute, String bindName);
+
+ /**
+ * <code>P.EVT_CREATED < :bindName</code><br />
+ * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * attribute < TRUNC( :firstBind )
+ * </pre>
+ */
+ String createDateLT(String attribute, String bindName);
+
+ /**
+ * <code>P.EVT_CREATED < :bindName</code><br />
+ * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * attribute < TRUNC( :firstBind ,'MI')
+ * </pre>
+ */
+ String createDateTimeLT(String attribute, String bindName);
+
+ /**
+ * <code>P.NAME <= :bindName</code><br />
+ * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
+ * <p>
+ * for dates use {@link #createDateLE(String, String)} and {@link #createDateTimeLE(String, String)}
+ * </p>
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * attribute <= :firstBind
+ * </pre>
+ */
+ String createLE(String attribute, String bindName);
+
+ /**
+ * <code>P.EVT_CREATED <= :bindName</code><br />
+ * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * attribute <= (TRUNC( :firstBind )+(86399/86400))
+ * </pre>
+ */
+ String createDateLE(String attribute, String bindName);
+
+ /**
+ * <code>P.EVT_CREATED <= :bindName</code><br />
+ * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * attribute <= (TRUNC( :firstBind ,'MI')+(59/1440))
+ * </pre>
+ */
+ String createDateTimeLE(String attribute, String bindName);
+
+ /**
+ * <code>P.NAME > :bindName</code><br />
+ * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
+ * <p>
+ * for dates use {@link #createDateGT(String, String)} and {@link #createDateTimeGT(String, String)}
+ * </p>
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * attribute > :firstBind
+ * </pre>
+ */
+ String createGT(String attribute, String bindName);
+
+ /**
+ * <code>P.EVT_CREATED > :bindName</code><br />
+ * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * attribute > TRUNC( :firstBind )
+ * </pre>
+ */
+ String createDateGT(String attribute, String bindName);
+
+ /**
+ * <code>P.EVT_CREATED > :bindName</code><br />
+ * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * attribute > TRUNC( :firstBind ,'MI')
+ * </pre>
+ */
+ String createDateTimeGT(String attribute, String bindName);
+
+ /**
+ * <code>P.NAME >= :bindName</code><br />
+ * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
+ * <p>
+ * for dates use {@link #createDateGE(String, String)} and {@link #createDateTimeGE(String, String)}
+ * </p>
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * attribute >= :firstBind
+ * </pre>
+ */
+ String createGE(String attribute, String bindName);
+
+ /**
+ * <code>P.EVT_CREATED >= :bindName</code><br />
+ * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * attribute >= TRUNC( :firstBind )
+ * </pre>
+ */
+ String createDateGE(String attribute, String bindName);
+
+ /**
+ * <code>P.EVT_CREATED >= :bindName</code><br />
+ * (or "<code>&text</code>" for non-binds, see also {@link #PLAIN_BIND_MARKER_PREFIX})
+ * <p>
+ * In an Oracle implementation this could be represented as
+ * </p>
+ *
+ * <pre>
+ * attribute >= TRUNC( :firstBind ,'MI')
+ * </pre>
+ */
+ String createDateTimeGE(String attribute, String bindName);
+
+ /**
+ * expression for the current date using the database specific keyword, <code>SYSDATE</code> on oracle
+ */
+ String getSysdateToken();
+
+ /**
+ * expression for upper case text using the database specific keyword, <code>UPPER</code> on oracle
+ */
+ String getUpperToken();
+
+ /**
+ * expression for lower case text using the database specific keyword, <code>LOWER</code> on oracle
+ */
+ String getLowerToken();
+
+ /**
+ * expression for trimmed text using the database specific keyword, <code>TRIM</code> on oracle
+ */
+ String getTrimToken();
+
+ /**
+ * expression for null-value/default-value using the database specific keyword, <code>NVL</code> on oracle
+ */
+ String getNvlToken();
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/style/MSSQLSqlStyle.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/style/MSSQLSqlStyle.java
index 2b7a6d31fd..7bb6a30383 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/style/MSSQLSqlStyle.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/style/MSSQLSqlStyle.java
@@ -1,76 +1,76 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc.style;
-
-import java.sql.Connection;
-import java.sql.SQLException;
-
-/**
- * @since Build 206
- */
-public class MSSQLSqlStyle extends AbstractSqlStyle {
- private static final long serialVersionUID = 1L;
-
- @Override
- public String getConcatOp() {
- return "+";
- }
-
- @Override
- public String getLikeWildcard() {
- return "%";
- }
-
- @Override
- protected int getMaxListSize() {
- return 1000;
- }
-
- @Override
- public boolean isLargeString(String s) {
- return (s.length() > 4000);
- }
-
- @Override
- public boolean isBlobEnabled() {
- return true;
- }
-
- @Override
- public boolean isClobEnabled() {
- return true;
- }
-
- @Override
- public String createDateTimeIsNow(String attribute) {
- return "TRUNC(" + attribute + ", 'MI')=TRUNC(SYSDATE, 'MI')";
- }
-
- @Override
- public String createDateTimeIsNotNow(String attribute) {
- return "TRUNC(" + attribute + ", 'MI')!=TRUNC(SYSDATE, 'MI')";
- }
-
- @Override
- public void testConnection(Connection conn) throws SQLException {
- /*
- * Statement testStatement=null;
- * try{ testStatement=conn.createStatement();
- * testStatement.execute("SELECT 1 FROM DUAL");
- * //TODO what is the name of a dummy table or typical check statement to run as a test?
- * }
- * finally{
- * if(testStatement!=null) try{testStatement.close();}catch(Throwable t){}
- * }
- */
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc.style;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+
+/**
+ * @since Build 206
+ */
+public class MSSQLSqlStyle extends AbstractSqlStyle {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public String getConcatOp() {
+ return "+";
+ }
+
+ @Override
+ public String getLikeWildcard() {
+ return "%";
+ }
+
+ @Override
+ protected int getMaxListSize() {
+ return 1000;
+ }
+
+ @Override
+ public boolean isLargeString(String s) {
+ return (s.length() > 4000);
+ }
+
+ @Override
+ public boolean isBlobEnabled() {
+ return true;
+ }
+
+ @Override
+ public boolean isClobEnabled() {
+ return true;
+ }
+
+ @Override
+ public String createDateTimeIsNow(String attribute) {
+ return "TRUNC(" + attribute + ", 'MI')=TRUNC(SYSDATE, 'MI')";
+ }
+
+ @Override
+ public String createDateTimeIsNotNow(String attribute) {
+ return "TRUNC(" + attribute + ", 'MI')!=TRUNC(SYSDATE, 'MI')";
+ }
+
+ @Override
+ public void testConnection(Connection conn) throws SQLException {
+ /*
+ * Statement testStatement=null;
+ * try{ testStatement=conn.createStatement();
+ * testStatement.execute("SELECT 1 FROM DUAL");
+ * //TODO what is the name of a dummy table or typical check statement to run as a test?
+ * }
+ * finally{
+ * if(testStatement!=null) try{testStatement.close();}catch(Throwable t){}
+ * }
+ */
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/style/OracleSqlStyle.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/style/OracleSqlStyle.java
index f59bc22ec3..8c3860d1f3 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/style/OracleSqlStyle.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/style/OracleSqlStyle.java
@@ -1,149 +1,149 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jdbc.style;
-
-import java.sql.Blob;
-import java.sql.Clob;
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.sql.Types;
-
-import org.eclipse.scout.rt.server.services.common.jdbc.SqlBind;
-
-public class OracleSqlStyle extends AbstractSqlStyle {
- private static final long serialVersionUID = 1L;
-
- @Override
- public String getConcatOp() {
- return "||";
- }
-
- @Override
- public String getLikeWildcard() {
- return "%";
- }
-
- @Override
- protected int getMaxListSize() {
- return 1000;
- }
-
- @Override
- public boolean isLargeString(String s) {
- return (s.length() > 4000);
- }
-
- @Override
- public boolean isBlobEnabled() {
- return true;
- }
-
- @Override
- public boolean isClobEnabled() {
- return true;
- }
-
- @Override
- public void testConnection(Connection conn) throws SQLException {
- Statement testStatement = null;
- try {
- testStatement = conn.createStatement();
- testStatement.execute("SELECT 1 FROM DUAL");
- }
- finally {
- if (testStatement != null) {
- try {
- testStatement.close();
- }
- catch (Throwable t) {
- }
- }
- }
- }
-
- @Override
- public void writeBind(PreparedStatement ps, int jdbcBindIndex, SqlBind bind) throws SQLException {
- switch (bind.getSqlType()) {
- case Types.CLOB: {
- if (bind.getValue() instanceof Clob) {
- super.writeBind(ps, jdbcBindIndex, bind);
- }
- else {
- String s = (String) bind.getValue();
- /*
- * Reflect: CLOB
- * newClob=CLOB.createTemporary(conn,false,oracle.sql.CLOB
- * .DURATION_SESSION); (a) newClob.putString(1,s); (b)
- * newClob.setString(1,s);
- */
- Clob clob;
- try {
- Class<?> clobClass;
- clobClass = Class.forName("oracle.sql.CLOB", true, ps.getClass().getClassLoader());
- clob = (Clob) clobClass.getMethod("createTemporary", new Class[]{Connection.class, boolean.class, int.class}).invoke(null, new Object[]{ps.getConnection(), false, clobClass.getField("DURATION_SESSION").get(null)});
- }
- catch (Throwable t) {
- SQLException ex = new SQLException("bind clob on jdbcIndex " + jdbcBindIndex);
- ex.initCause(t);
- throw ex;
- }
- //
- try {
- clob.getClass().getMethod("putString", new Class[]{long.class, String.class}).invoke(clob, new Object[]{1, s});
- }
- catch (Throwable t) {
- clob.setString(1, s);
- }
- ps.setClob(jdbcBindIndex, clob);
- }
- break;
- }
- case Types.BLOB: {
- if (bind.getValue() instanceof Blob) {
- super.writeBind(ps, jdbcBindIndex, bind);
- }
- else {
- byte[] data = (byte[]) bind.getValue();
- /*
- * Reflect: BLOB
- * newBlob=BLOB.createTemporary(conn,false,oracle.sql.BLOB
- * .DURATION_SESSION); (a) newBlob.putBytes(1,data); (b)
- * newBlob.setBytes(1,data);
- */
- Blob blob;
- try {
- Class<?> blobClass = Class.forName("oracle.sql.BLOB", true, ps.getClass().getClassLoader());
- blob = (Blob) blobClass.getMethod("createTemporary", new Class[]{Connection.class, boolean.class, int.class}).invoke(null, new Object[]{ps.getConnection(), false, blobClass.getField("DURATION_SESSION").get(null)});
- }
- catch (Throwable t) {
- SQLException ex = new SQLException("bind blob on jdbcIndex " + jdbcBindIndex);
- ex.initCause(t);
- throw ex;
- }
- //
- try {
- blob.getClass().getMethod("putBytes", new Class[]{long.class, byte[].class}).invoke(blob, new Object[]{1, data});
- }
- catch (Throwable t) {
- blob.setBytes(1, data);
- }
- ps.setBlob(jdbcBindIndex, blob);
- }
- break;
- }
- default: {
- super.writeBind(ps, jdbcBindIndex, bind);
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jdbc.style;
+
+import java.sql.Blob;
+import java.sql.Clob;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.sql.Types;
+
+import org.eclipse.scout.rt.server.services.common.jdbc.SqlBind;
+
+public class OracleSqlStyle extends AbstractSqlStyle {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public String getConcatOp() {
+ return "||";
+ }
+
+ @Override
+ public String getLikeWildcard() {
+ return "%";
+ }
+
+ @Override
+ protected int getMaxListSize() {
+ return 1000;
+ }
+
+ @Override
+ public boolean isLargeString(String s) {
+ return (s.length() > 4000);
+ }
+
+ @Override
+ public boolean isBlobEnabled() {
+ return true;
+ }
+
+ @Override
+ public boolean isClobEnabled() {
+ return true;
+ }
+
+ @Override
+ public void testConnection(Connection conn) throws SQLException {
+ Statement testStatement = null;
+ try {
+ testStatement = conn.createStatement();
+ testStatement.execute("SELECT 1 FROM DUAL");
+ }
+ finally {
+ if (testStatement != null) {
+ try {
+ testStatement.close();
+ }
+ catch (Throwable t) {
+ }
+ }
+ }
+ }
+
+ @Override
+ public void writeBind(PreparedStatement ps, int jdbcBindIndex, SqlBind bind) throws SQLException {
+ switch (bind.getSqlType()) {
+ case Types.CLOB: {
+ if (bind.getValue() instanceof Clob) {
+ super.writeBind(ps, jdbcBindIndex, bind);
+ }
+ else {
+ String s = (String) bind.getValue();
+ /*
+ * Reflect: CLOB
+ * newClob=CLOB.createTemporary(conn,false,oracle.sql.CLOB
+ * .DURATION_SESSION); (a) newClob.putString(1,s); (b)
+ * newClob.setString(1,s);
+ */
+ Clob clob;
+ try {
+ Class<?> clobClass;
+ clobClass = Class.forName("oracle.sql.CLOB", true, ps.getClass().getClassLoader());
+ clob = (Clob) clobClass.getMethod("createTemporary", new Class[]{Connection.class, boolean.class, int.class}).invoke(null, new Object[]{ps.getConnection(), false, clobClass.getField("DURATION_SESSION").get(null)});
+ }
+ catch (Throwable t) {
+ SQLException ex = new SQLException("bind clob on jdbcIndex " + jdbcBindIndex);
+ ex.initCause(t);
+ throw ex;
+ }
+ //
+ try {
+ clob.getClass().getMethod("putString", new Class[]{long.class, String.class}).invoke(clob, new Object[]{1, s});
+ }
+ catch (Throwable t) {
+ clob.setString(1, s);
+ }
+ ps.setClob(jdbcBindIndex, clob);
+ }
+ break;
+ }
+ case Types.BLOB: {
+ if (bind.getValue() instanceof Blob) {
+ super.writeBind(ps, jdbcBindIndex, bind);
+ }
+ else {
+ byte[] data = (byte[]) bind.getValue();
+ /*
+ * Reflect: BLOB
+ * newBlob=BLOB.createTemporary(conn,false,oracle.sql.BLOB
+ * .DURATION_SESSION); (a) newBlob.putBytes(1,data); (b)
+ * newBlob.setBytes(1,data);
+ */
+ Blob blob;
+ try {
+ Class<?> blobClass = Class.forName("oracle.sql.BLOB", true, ps.getClass().getClassLoader());
+ blob = (Blob) blobClass.getMethod("createTemporary", new Class[]{Connection.class, boolean.class, int.class}).invoke(null, new Object[]{ps.getConnection(), false, blobClass.getField("DURATION_SESSION").get(null)});
+ }
+ catch (Throwable t) {
+ SQLException ex = new SQLException("bind blob on jdbcIndex " + jdbcBindIndex);
+ ex.initCause(t);
+ throw ex;
+ }
+ //
+ try {
+ blob.getClass().getMethod("putBytes", new Class[]{long.class, byte[].class}).invoke(blob, new Object[]{1, data});
+ }
+ catch (Throwable t) {
+ blob.setBytes(1, data);
+ }
+ ps.setBlob(jdbcBindIndex, blob);
+ }
+ break;
+ }
+ default: {
+ super.writeBind(ps, jdbcBindIndex, bind);
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jms/AbstractJmsConsumerService.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jms/AbstractJmsConsumerService.java
index 691ce4b050..4730e4055c 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jms/AbstractJmsConsumerService.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jms/AbstractJmsConsumerService.java
@@ -1,186 +1,186 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jms;
-
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.server.ThreadContext;
-import org.eclipse.scout.rt.server.services.common.jms.internal.JmsTransactionMember;
-import org.eclipse.scout.rt.server.transaction.ITransaction;
-import org.eclipse.scout.service.AbstractService;
-
-public abstract class AbstractJmsConsumerService extends AbstractService implements IJmsConsumerService {
-
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractJmsConsumerService.class);
-
- private JmsJndiConfig m_config = new JmsJndiConfig();
-
- public AbstractJmsConsumerService() {
- initConfig();
- }
-
- @ConfigProperty(ConfigProperty.STRING)
- @Order(10)
- @ConfigPropertyValue("null")
- protected String getConfiguredContextFactory() {
- return null;
- }
-
- public String getContextFactory() {
- return m_config.getInitialContextFactory();
- }
-
- public void setContextFactory(String s) {
- m_config.setInitialContextFactory(s);
- }
-
- @ConfigProperty(ConfigProperty.STRING)
- @Order(20)
- @ConfigPropertyValue("null")
- protected String getConfiguredProviderUrl() {
- return null;
- }
-
- public String getProviderUrl() {
- return m_config.getProviderUrl();
- }
-
- public void setProviderUrl(String s) {
- m_config.setProviderUrl(s);
- }
-
- @ConfigProperty(ConfigProperty.STRING)
- @Order(30)
- @ConfigPropertyValue("null")
- protected String getConfiguredConnectionFactoryJndiName() {
- return null;
- }
-
- public String getConnectionFactoryJndiName() {
- return m_config.getConnectionFactoryJndiName();
- }
-
- public void setConnectionFactoryJndiName(String s) {
- m_config.setConnectionFactoryJndiName(s);
- }
-
- @ConfigProperty(ConfigProperty.STRING)
- @Order(40)
- @ConfigPropertyValue("null")
- protected String getConfiguredJndiName() {
- return null;
- }
-
- public String getJndiName() {
- return m_config.getJndiName();
- }
-
- public void setJndiName(String s) {
- m_config.setJndiName(s);
- }
-
- @ConfigProperty(ConfigProperty.STRING)
- @Order(50)
- @ConfigPropertyValue("null")
- protected String getConfiguredJmsUsername() {
- return null;
- }
-
- public String getJmsUsername() {
- return m_config.getUserName();
- }
-
- public void setJmsUsername(String s) {
- m_config.setUserName(s);
- }
-
- @ConfigProperty(ConfigProperty.STRING)
- @Order(60)
- @ConfigPropertyValue("null")
- protected String getConfiguredJmsPassword() {
- return null;
- }
-
- public String getJmsPassword() {
- return m_config.getPassword();
- }
-
- public void setJmsPassword(String s) {
- m_config.setPassword(s);
- }
-
- protected void initConfig() {
- setConnectionFactoryJndiName(getConfiguredConnectionFactoryJndiName());
- setContextFactory(getConfiguredContextFactory());
- setJmsPassword(getConfiguredJmsPassword());
- setJmsUsername(getConfiguredJmsUsername());
- setJndiName(getConfiguredJndiName());
- setProviderUrl(getConfiguredProviderUrl());
- }
-
- /**
- * Sends given object to the JMS queue / topic
- *
- * @param object
- * {@link Object}
- */
- @Override
- public void putObject(Object object) throws ProcessingException {
- if (LOG.isInfoEnabled()) {
- LOG.info("obj=" + object);
- }
- getJmsXAResource().putObject(object, true);
- }
-
- /**
- * Retrieve next object from JMS queue / topic.<br>
- * Unlimited wait.
- */
- @Override
- public Object getObject() throws ProcessingException {
- return getObject(-1);
- }
-
- /**
- * Retrieve next object from queue / topic.<br>
- * Wait max given milliseconds for next message if not there yet.
- *
- * @param timeoutMillis
- * long
- */
- @Override
- public Object getObject(long timeoutMillis) throws ProcessingException {
- return getJmsXAResource().getObject(timeoutMillis, true);
- }
-
- /**
- * Get the XA Resource on message queue. One per config.<br>
- * Retrieve from registry or create new if not existing and register.<br>
- * Uses configs hashCode to identify queue configuration.
- */
- private JmsTransactionMember getJmsXAResource() throws ProcessingException {
- String resId = new Long(m_config.getCrc()).toString();
- ITransaction reg = ThreadContext.getTransaction();
- if (reg == null) {
- throw new ProcessingException("no ITransaction available, use ServerJob to run truncactions");
- }
- JmsTransactionMember res = (JmsTransactionMember) reg.getMember(resId);
- if (res == null) {
- res = new JmsTransactionMember(m_config);
- reg.registerMember(res);
- }
- return res;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jms;
+
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.server.ThreadContext;
+import org.eclipse.scout.rt.server.services.common.jms.internal.JmsTransactionMember;
+import org.eclipse.scout.rt.server.transaction.ITransaction;
+import org.eclipse.scout.service.AbstractService;
+
+public abstract class AbstractJmsConsumerService extends AbstractService implements IJmsConsumerService {
+
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractJmsConsumerService.class);
+
+ private JmsJndiConfig m_config = new JmsJndiConfig();
+
+ public AbstractJmsConsumerService() {
+ initConfig();
+ }
+
+ @ConfigProperty(ConfigProperty.STRING)
+ @Order(10)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredContextFactory() {
+ return null;
+ }
+
+ public String getContextFactory() {
+ return m_config.getInitialContextFactory();
+ }
+
+ public void setContextFactory(String s) {
+ m_config.setInitialContextFactory(s);
+ }
+
+ @ConfigProperty(ConfigProperty.STRING)
+ @Order(20)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredProviderUrl() {
+ return null;
+ }
+
+ public String getProviderUrl() {
+ return m_config.getProviderUrl();
+ }
+
+ public void setProviderUrl(String s) {
+ m_config.setProviderUrl(s);
+ }
+
+ @ConfigProperty(ConfigProperty.STRING)
+ @Order(30)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredConnectionFactoryJndiName() {
+ return null;
+ }
+
+ public String getConnectionFactoryJndiName() {
+ return m_config.getConnectionFactoryJndiName();
+ }
+
+ public void setConnectionFactoryJndiName(String s) {
+ m_config.setConnectionFactoryJndiName(s);
+ }
+
+ @ConfigProperty(ConfigProperty.STRING)
+ @Order(40)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredJndiName() {
+ return null;
+ }
+
+ public String getJndiName() {
+ return m_config.getJndiName();
+ }
+
+ public void setJndiName(String s) {
+ m_config.setJndiName(s);
+ }
+
+ @ConfigProperty(ConfigProperty.STRING)
+ @Order(50)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredJmsUsername() {
+ return null;
+ }
+
+ public String getJmsUsername() {
+ return m_config.getUserName();
+ }
+
+ public void setJmsUsername(String s) {
+ m_config.setUserName(s);
+ }
+
+ @ConfigProperty(ConfigProperty.STRING)
+ @Order(60)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredJmsPassword() {
+ return null;
+ }
+
+ public String getJmsPassword() {
+ return m_config.getPassword();
+ }
+
+ public void setJmsPassword(String s) {
+ m_config.setPassword(s);
+ }
+
+ protected void initConfig() {
+ setConnectionFactoryJndiName(getConfiguredConnectionFactoryJndiName());
+ setContextFactory(getConfiguredContextFactory());
+ setJmsPassword(getConfiguredJmsPassword());
+ setJmsUsername(getConfiguredJmsUsername());
+ setJndiName(getConfiguredJndiName());
+ setProviderUrl(getConfiguredProviderUrl());
+ }
+
+ /**
+ * Sends given object to the JMS queue / topic
+ *
+ * @param object
+ * {@link Object}
+ */
+ @Override
+ public void putObject(Object object) throws ProcessingException {
+ if (LOG.isInfoEnabled()) {
+ LOG.info("obj=" + object);
+ }
+ getJmsXAResource().putObject(object, true);
+ }
+
+ /**
+ * Retrieve next object from JMS queue / topic.<br>
+ * Unlimited wait.
+ */
+ @Override
+ public Object getObject() throws ProcessingException {
+ return getObject(-1);
+ }
+
+ /**
+ * Retrieve next object from queue / topic.<br>
+ * Wait max given milliseconds for next message if not there yet.
+ *
+ * @param timeoutMillis
+ * long
+ */
+ @Override
+ public Object getObject(long timeoutMillis) throws ProcessingException {
+ return getJmsXAResource().getObject(timeoutMillis, true);
+ }
+
+ /**
+ * Get the XA Resource on message queue. One per config.<br>
+ * Retrieve from registry or create new if not existing and register.<br>
+ * Uses configs hashCode to identify queue configuration.
+ */
+ private JmsTransactionMember getJmsXAResource() throws ProcessingException {
+ String resId = new Long(m_config.getCrc()).toString();
+ ITransaction reg = ThreadContext.getTransaction();
+ if (reg == null) {
+ throw new ProcessingException("no ITransaction available, use ServerJob to run truncactions");
+ }
+ JmsTransactionMember res = (JmsTransactionMember) reg.getMember(resId);
+ if (res == null) {
+ res = new JmsTransactionMember(m_config);
+ reg.registerMember(res);
+ }
+ return res;
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jms/IJmsCallback.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jms/IJmsCallback.java
index 2223885883..b680de5c9b 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jms/IJmsCallback.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jms/IJmsCallback.java
@@ -1,31 +1,31 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jms;
-
-import javax.jms.Message;
-
-import org.eclipse.scout.commons.annotations.ConfigOperation;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.service.IService;
-
-/**
- * Generic interface that needs to be implemented by any service that should be
- * called via JMS. Inherits from IService to make sure the service can be
- * retrieved from Service Registry.
- */
-public interface IJmsCallback extends IService {
-
- /**
- * This method is called inside the server session context
- */
- @ConfigOperation
- void execOnMessage(Message msg, Object value) throws ProcessingException;
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jms;
+
+import javax.jms.Message;
+
+import org.eclipse.scout.commons.annotations.ConfigOperation;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.service.IService;
+
+/**
+ * Generic interface that needs to be implemented by any service that should be
+ * called via JMS. Inherits from IService to make sure the service can be
+ * retrieved from Service Registry.
+ */
+public interface IJmsCallback extends IService {
+
+ /**
+ * This method is called inside the server session context
+ */
+ @ConfigOperation
+ void execOnMessage(Message msg, Object value) throws ProcessingException;
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jms/IJmsConsumerService.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jms/IJmsConsumerService.java
index add5b42f8e..617d45b161 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jms/IJmsConsumerService.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jms/IJmsConsumerService.java
@@ -1,23 +1,23 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jms;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.service.IService;
-
-public interface IJmsConsumerService extends IService {
-
- void putObject(Object object) throws ProcessingException;
-
- Object getObject() throws ProcessingException;
-
- Object getObject(long timeoutMillis) throws ProcessingException;
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jms;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.service.IService;
+
+public interface IJmsConsumerService extends IService {
+
+ void putObject(Object object) throws ProcessingException;
+
+ Object getObject() throws ProcessingException;
+
+ Object getObject(long timeoutMillis) throws ProcessingException;
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jms/JmsJndiConfig.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jms/JmsJndiConfig.java
index aa05430309..d97937a89d 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jms/JmsJndiConfig.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jms/JmsJndiConfig.java
@@ -1,191 +1,191 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jms;
-
-import java.util.Hashtable;
-import java.util.zip.CRC32;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.commons.exception.ProcessingException;
-
-public class JmsJndiConfig {
-
- // JNDI config
- // optional, if in same context as application itself
- private String m_initialContextFactory; // "org.jnp.interfaces.NamingContextFactory"
- private String m_providerUrl; // "localhost:1099"
- private String m_userName;
- private String m_password;
- // required
- private String m_connectionFactoryJndiName; // "ConnectionFactory"
- private String m_jndiName; // "queue/A" OR "topic/testTopic"
-
- public String getInitialContextFactory() {
- return m_initialContextFactory;
- }
-
- public void setInitialContextFactory(String contextFactory) {
- m_initialContextFactory = contextFactory;
- }
-
- public String getProviderUrl() {
- return m_providerUrl;
- }
-
- public void setProviderUrl(String url) {
- m_providerUrl = url;
- }
-
- public String getUserName() {
- return m_userName;
- }
-
- public void setUserName(String name) {
- m_userName = name;
- }
-
- public String getPassword() {
- return m_password;
- }
-
- public void setPassword(String password) {
- m_password = password;
- }
-
- public String getConnectionFactoryJndiName() {
- return m_connectionFactoryJndiName;
- }
-
- public void setConnectionFactoryJndiName(String factoryJndiName) {
- m_connectionFactoryJndiName = factoryJndiName;
- }
-
- public String getJndiName() {
- return m_jndiName;
- }
-
- public void setJndiName(String name) {
- m_jndiName = name;
- }
-
- /**
- * Creates the initial JNDI context to work with.
- *
- * @return context {@link InitialContext}
- * @throws ProcessingException
- */
- public InitialContext createInitialContext() throws ProcessingException {
- Hashtable<String, String> props = new Hashtable<String, String>();
- if (m_initialContextFactory != null) {
- props.put(Context.INITIAL_CONTEXT_FACTORY, m_initialContextFactory);
- }
- if (m_providerUrl != null) {
- props.put(Context.PROVIDER_URL, m_providerUrl);
- }
- if (m_userName != null && m_userName.length() > 0) {
- props.put(Context.SECURITY_PRINCIPAL, m_userName);
- }
- if (m_password != null) {
- props.put(Context.SECURITY_CREDENTIALS, m_password);
- }
- InitialContext ctx;
- try {
- if (props.size() > 0) {
- ctx = new InitialContext(props);
- }
- else {
- ctx = new InitialContext();
- }
- }
- catch (NamingException e) {
- throw new ProcessingException(e.getMessage(), e.getCause());
- }
- return ctx;
- }
-
- public long getCrc() {
- CRC32 crc = new CRC32();
- if (m_connectionFactoryJndiName != null) {
- crc.update(m_connectionFactoryJndiName.getBytes());
- }
- if (m_initialContextFactory != null) {
- crc.update(m_initialContextFactory.getBytes());
- }
- if (m_jndiName != null) {
- crc.update(m_jndiName.getBytes());
- }
- if (m_password != null) {
- crc.update(m_password.getBytes());
- }
- if (m_userName != null) {
- crc.update(m_userName.getBytes());
- }
- if (m_providerUrl != null) {
- crc.update(m_providerUrl.getBytes());
- }
-
- return crc.getValue();
- }
-
- @Override
- public int hashCode() {
- int h = 0;
- if (m_connectionFactoryJndiName != null) {
- h = h ^ m_connectionFactoryJndiName.hashCode();
- }
- if (m_initialContextFactory != null) {
- h = h ^ m_initialContextFactory.hashCode();
- }
- if (m_jndiName != null) {
- h = h ^ m_jndiName.hashCode();
- }
- if (m_password != null) {
- h = h ^ m_password.hashCode();
- }
- if (m_providerUrl != null) {
- h = h ^ m_providerUrl.hashCode();
- }
- if (m_userName != null) {
- h = h ^ m_userName.hashCode();
- }
- return h;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == null) {
- return false;
- }
- if (!(obj instanceof JmsJndiConfig)) {
- return false;
- }
- return compareTo(obj) == 0;
- }
-
- private int compareTo(Object obj) {
- JmsJndiConfig c = (JmsJndiConfig) obj;
- if (CompareUtility.compareTo(c.getConnectionFactoryJndiName(), this.m_connectionFactoryJndiName) == 0 &&
- CompareUtility.compareTo(c.getInitialContextFactory(), this.m_initialContextFactory) == 0 &&
- CompareUtility.compareTo(c.getJndiName(), this.m_jndiName) == 0 &&
- CompareUtility.compareTo(c.getPassword(), this.m_password) == 0 &&
- CompareUtility.compareTo(c.getProviderUrl(), this.m_providerUrl) == 0 &&
- CompareUtility.compareTo(c.getUserName(), this.m_userName) == 0) {
- return 0;
- }
- else {
- return -1;
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jms;
+
+import java.util.Hashtable;
+import java.util.zip.CRC32;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.commons.exception.ProcessingException;
+
+public class JmsJndiConfig {
+
+ // JNDI config
+ // optional, if in same context as application itself
+ private String m_initialContextFactory; // "org.jnp.interfaces.NamingContextFactory"
+ private String m_providerUrl; // "localhost:1099"
+ private String m_userName;
+ private String m_password;
+ // required
+ private String m_connectionFactoryJndiName; // "ConnectionFactory"
+ private String m_jndiName; // "queue/A" OR "topic/testTopic"
+
+ public String getInitialContextFactory() {
+ return m_initialContextFactory;
+ }
+
+ public void setInitialContextFactory(String contextFactory) {
+ m_initialContextFactory = contextFactory;
+ }
+
+ public String getProviderUrl() {
+ return m_providerUrl;
+ }
+
+ public void setProviderUrl(String url) {
+ m_providerUrl = url;
+ }
+
+ public String getUserName() {
+ return m_userName;
+ }
+
+ public void setUserName(String name) {
+ m_userName = name;
+ }
+
+ public String getPassword() {
+ return m_password;
+ }
+
+ public void setPassword(String password) {
+ m_password = password;
+ }
+
+ public String getConnectionFactoryJndiName() {
+ return m_connectionFactoryJndiName;
+ }
+
+ public void setConnectionFactoryJndiName(String factoryJndiName) {
+ m_connectionFactoryJndiName = factoryJndiName;
+ }
+
+ public String getJndiName() {
+ return m_jndiName;
+ }
+
+ public void setJndiName(String name) {
+ m_jndiName = name;
+ }
+
+ /**
+ * Creates the initial JNDI context to work with.
+ *
+ * @return context {@link InitialContext}
+ * @throws ProcessingException
+ */
+ public InitialContext createInitialContext() throws ProcessingException {
+ Hashtable<String, String> props = new Hashtable<String, String>();
+ if (m_initialContextFactory != null) {
+ props.put(Context.INITIAL_CONTEXT_FACTORY, m_initialContextFactory);
+ }
+ if (m_providerUrl != null) {
+ props.put(Context.PROVIDER_URL, m_providerUrl);
+ }
+ if (m_userName != null && m_userName.length() > 0) {
+ props.put(Context.SECURITY_PRINCIPAL, m_userName);
+ }
+ if (m_password != null) {
+ props.put(Context.SECURITY_CREDENTIALS, m_password);
+ }
+ InitialContext ctx;
+ try {
+ if (props.size() > 0) {
+ ctx = new InitialContext(props);
+ }
+ else {
+ ctx = new InitialContext();
+ }
+ }
+ catch (NamingException e) {
+ throw new ProcessingException(e.getMessage(), e.getCause());
+ }
+ return ctx;
+ }
+
+ public long getCrc() {
+ CRC32 crc = new CRC32();
+ if (m_connectionFactoryJndiName != null) {
+ crc.update(m_connectionFactoryJndiName.getBytes());
+ }
+ if (m_initialContextFactory != null) {
+ crc.update(m_initialContextFactory.getBytes());
+ }
+ if (m_jndiName != null) {
+ crc.update(m_jndiName.getBytes());
+ }
+ if (m_password != null) {
+ crc.update(m_password.getBytes());
+ }
+ if (m_userName != null) {
+ crc.update(m_userName.getBytes());
+ }
+ if (m_providerUrl != null) {
+ crc.update(m_providerUrl.getBytes());
+ }
+
+ return crc.getValue();
+ }
+
+ @Override
+ public int hashCode() {
+ int h = 0;
+ if (m_connectionFactoryJndiName != null) {
+ h = h ^ m_connectionFactoryJndiName.hashCode();
+ }
+ if (m_initialContextFactory != null) {
+ h = h ^ m_initialContextFactory.hashCode();
+ }
+ if (m_jndiName != null) {
+ h = h ^ m_jndiName.hashCode();
+ }
+ if (m_password != null) {
+ h = h ^ m_password.hashCode();
+ }
+ if (m_providerUrl != null) {
+ h = h ^ m_providerUrl.hashCode();
+ }
+ if (m_userName != null) {
+ h = h ^ m_userName.hashCode();
+ }
+ return h;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == null) {
+ return false;
+ }
+ if (!(obj instanceof JmsJndiConfig)) {
+ return false;
+ }
+ return compareTo(obj) == 0;
+ }
+
+ private int compareTo(Object obj) {
+ JmsJndiConfig c = (JmsJndiConfig) obj;
+ if (CompareUtility.compareTo(c.getConnectionFactoryJndiName(), this.m_connectionFactoryJndiName) == 0 &&
+ CompareUtility.compareTo(c.getInitialContextFactory(), this.m_initialContextFactory) == 0 &&
+ CompareUtility.compareTo(c.getJndiName(), this.m_jndiName) == 0 &&
+ CompareUtility.compareTo(c.getPassword(), this.m_password) == 0 &&
+ CompareUtility.compareTo(c.getProviderUrl(), this.m_providerUrl) == 0 &&
+ CompareUtility.compareTo(c.getUserName(), this.m_userName) == 0) {
+ return 0;
+ }
+ else {
+ return -1;
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jms/JmsObserver.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jms/JmsObserver.java
index db6c1b5a08..8f4f152fc4 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jms/JmsObserver.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jms/JmsObserver.java
@@ -1,305 +1,305 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jms;
-
-import java.lang.ref.WeakReference;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-
-import javax.jms.BytesMessage;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageListener;
-import javax.jms.ObjectMessage;
-import javax.jms.TextMessage;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.server.services.common.jms.internal.JmsTransactionMember;
-
-/**
- * J2eeJmsObserver implementation with anchor in servlet context J2eeJmsObserver
- * expects to find its IServerSession in the servlet context
- */
-public class JmsObserver {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(JmsObserver.class);
-
- private Object m_observerMapLock;
- private HashMap<JmsJndiConfig, Collection<WeakReference<IJmsCallback>>> m_observerMap;
- private Object m_jmsListenerMapLock;
- private HashMap<JmsJndiConfig, JmsListener> m_jmsListenerMap;
-
- public JmsObserver() {
- m_observerMapLock = new Object();
- m_observerMap = new HashMap<JmsJndiConfig, Collection<WeakReference<IJmsCallback>>>();
- m_jmsListenerMapLock = new Object();
- m_jmsListenerMap = new HashMap<JmsJndiConfig, JmsListener>();
- }
-
- /**
- * Cleanup all weak references. Should be called when a Session terminates to
- * remove all potentially weak referenced callback classes.
- *
- * @throws ProcessingException
- */
- public void cleanup() throws ProcessingException {
- ArrayList<JmsJndiConfig> empty = new ArrayList<JmsJndiConfig>();
- synchronized (m_observerMap) {
- Collection<JmsJndiConfig> allLists = m_observerMap.keySet();
- for (JmsJndiConfig conf : allLists) {
- Collection<WeakReference<IJmsCallback>> list = m_observerMap.get(conf);
- for (Iterator<WeakReference<IJmsCallback>> it = list.iterator(); it.hasNext();) {
- WeakReference<IJmsCallback> ref = it.next();
- IJmsCallback o = ref.get();
- if (o == null) {
- it.remove();
- }
- }
- if (list.size() == 0) {
- empty.add(conf);
- }
- }
- }
- synchronized (m_jmsListenerMapLock) {
- for (JmsJndiConfig conf : empty) {
- m_observerMap.remove(conf);
- JmsListener listener = m_jmsListenerMap.get(conf);
- if (listener != null) {
- listener.stopListeningOnQueue();
- m_jmsListenerMap.remove(conf);
- }
- }
- }
- }
-
- /**
- * Callback method that gets called by all listeners on the queue. Iterates
- * the observer map for given config and calls all registered callback classes
- * for this config.
- *
- * @param config
- * {@link JmsJndiConfig}
- * @param msg
- * {@link Message}
- * @param value
- * {@link Object}
- */
- private void fireCallback(JmsJndiConfig config, final Message msg, final Object value) {
- synchronized (m_observerMapLock) {
- if (m_observerMap != null) {
- for (WeakReference<IJmsCallback> callback : m_observerMap.get(config)) {
- final IJmsCallback c = callback.get();
- if (c != null) {
- try {
- c.execOnMessage(msg, value);
- }
- catch (ProcessingException e) {
- LOG.error("Message " + msg, e);
- }
- }
- }
- }
- }
- }
-
- /**
- * Adds a listener to the queue. Makes sure that only one listener per service
- * and configuration is added. Takes a implementation of the {@link IJmsCallback} interface as parameter. This service
- * will be called
- * upon a message to the queue. Method is thread safe. Creates an {@link JmsListener} object that is listening on the
- * queue. Will enable the
- * use of username password to connect to JMS-server. Warning: IJmsCallback
- * classes given are weak referenced! Make sure the reference to it is managed
- * outside this class. It will be garbage collected otherwise!
- *
- * @param callback
- * {@link IJmsCallback}
- * @param config
- * {@link JmsJndiConfig}
- * @throws ProcessingException
- */
- public void addListener(IJmsCallback callback, JmsJndiConfig config) throws ProcessingException {
- // only add if not already added
- cleanup();
- Collection<WeakReference<IJmsCallback>> list = null;
- synchronized (m_observerMapLock) {
- list = m_observerMap.get(config);
- if (list == null) {
- list = new ArrayList<WeakReference<IJmsCallback>>();
- m_observerMap.put(config, list);
- }
- list.add(new WeakReference<IJmsCallback>(callback));
- }
- synchronized (m_jmsListenerMapLock) {
- JmsListener listener = m_jmsListenerMap.get(config);
- if (listener == null) {
- listener = new JmsListener(config);
- m_jmsListenerMap.put(config, new JmsListener(config));
- }
- listener.startListeningOnQueue();
- }
- }
-
- /**
- * Removes listener from the queue. Takes a implementation of the {@link IJmsCallback} interface and the config that
- * defines the queue that
- * the callback is listening on as parameter. Makes sure that listener is
- * removed if no callback class is listening on the given config anymore.
- * Method is thread safe.
- *
- * @param callback
- * {@link IJmsCallback}
- * @param config
- * {@link JmsJndiConfig}
- * @throws ProcessingException
- */
- public void removeListener(IJmsCallback callback, JmsJndiConfig config) throws ProcessingException {
- cleanup();
- Collection<WeakReference<IJmsCallback>> list = null;
- synchronized (m_observerMap) {
- list = m_observerMap.get(config);
- if (list != null) {
- list.remove(callback);
- }
- }
- synchronized (m_jmsListenerMap) {
- if (list != null && list.size() == 0) {
- JmsListener listener = m_jmsListenerMap.get(config);
- if (listener != null) {
- if (LOG.isInfoEnabled()) {
- LOG.info("method=" + callback.getClass().getName());
- }
- listener.stopListeningOnQueue();
- m_jmsListenerMap.remove(config);
- m_observerMap.remove(config);
- }
- }
- }
- }
-
- /**
- * Removes all listeners from the queue. Cleanup using this method. Warning:
- * removes all listeners and callback classes!
- */
- public void removeAllListeners() throws ProcessingException {
- cleanup();
- // only add if not already added
- synchronized (m_jmsListenerMap) {
- if (LOG.isInfoEnabled()) {
- LOG.info("" + m_observerMap + " listeners");
- }
- for (JmsListener listener : m_jmsListenerMap.values()) {
- try {
- listener.stopListeningOnQueue();
- }
- catch (ProcessingException e) {
- LOG.error(null, e);
- }
- }
- }
- m_jmsListenerMap.clear();
- synchronized (m_observerMapLock) {
- for (Collection<WeakReference<IJmsCallback>> list : m_observerMap.values()) {
- list.clear();
- }
- m_observerMap.clear();
- }
- }
-
- /**
- * Inner class defining a listener on a JMS queue or topic. Inherits from the {@link MessageListener} interface.
- */
- private class JmsListener implements javax.jms.MessageListener {
-
- private JmsJndiConfig m_config;
- private JmsTransactionMember m_jmsXaResource;
-
- public JmsListener(JmsJndiConfig config) {
- m_config = config;
- m_jmsXaResource = new JmsTransactionMember(m_config);
- }
-
- /**
- * make sure resources are freed
- */
- @Override
- protected void finalize() throws Throwable {
-
- m_jmsXaResource.release();
- m_jmsXaResource = null;
- }
-
- /**
- * Start to listen on the queue defined in {@link JmsTransactionMember} instance of
- * this class.
- *
- * @throws ProcessingException
- */
- public void startListeningOnQueue() throws ProcessingException {
- stopListeningOnQueue();
- try {
- MessageConsumer consumer = m_jmsXaResource.getMessageConsumer();
- consumer.setMessageListener(this);
- }
- catch (JMSException e) {
- stopListeningOnQueue();
- throw new ProcessingException(e.getLocalizedMessage(), e.getCause());
- }
- }
-
- /**
- * Stop to listen on the queue defined in {@link ScoutJMSXAResource} instance of this class.
- *
- * @throws ProcessingException
- */
- public void stopListeningOnQueue() throws ProcessingException {
- m_jmsXaResource.release();
- }
-
- /**
- * The onMessage Method is called by JMS when a message has arrived for the
- * queue / topic that this listener listens to.
- */
- @Override
- public final void onMessage(Message msg) {
- try {
- if (msg != null) {
- Object valueForS = null;
- if (msg instanceof TextMessage) {
- valueForS = ((TextMessage) msg).getText();
- }
- else if (msg instanceof BytesMessage) {
- byte[] ba = new byte[(int) ((BytesMessage) msg).getBodyLength()];
- ((BytesMessage) msg).readBytes(ba);
- valueForS = ba;
- }
- else if (msg instanceof ObjectMessage) {
- valueForS = ((ObjectMessage) msg).getObject();
- }
- fireCallback(m_config, msg, valueForS);
- msg.acknowledge();
- if (m_jmsXaResource.commitPhase1()) {
- m_jmsXaResource.commitPhase2();
- }
- }
- }
- catch (JMSException ex) {
- LOG.error("receiving message: " + msg, ex);
- // err, no acknowledge
- m_jmsXaResource.rollback();
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jms;
+
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import javax.jms.BytesMessage;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageListener;
+import javax.jms.ObjectMessage;
+import javax.jms.TextMessage;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.server.services.common.jms.internal.JmsTransactionMember;
+
+/**
+ * J2eeJmsObserver implementation with anchor in servlet context J2eeJmsObserver
+ * expects to find its IServerSession in the servlet context
+ */
+public class JmsObserver {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(JmsObserver.class);
+
+ private Object m_observerMapLock;
+ private HashMap<JmsJndiConfig, Collection<WeakReference<IJmsCallback>>> m_observerMap;
+ private Object m_jmsListenerMapLock;
+ private HashMap<JmsJndiConfig, JmsListener> m_jmsListenerMap;
+
+ public JmsObserver() {
+ m_observerMapLock = new Object();
+ m_observerMap = new HashMap<JmsJndiConfig, Collection<WeakReference<IJmsCallback>>>();
+ m_jmsListenerMapLock = new Object();
+ m_jmsListenerMap = new HashMap<JmsJndiConfig, JmsListener>();
+ }
+
+ /**
+ * Cleanup all weak references. Should be called when a Session terminates to
+ * remove all potentially weak referenced callback classes.
+ *
+ * @throws ProcessingException
+ */
+ public void cleanup() throws ProcessingException {
+ ArrayList<JmsJndiConfig> empty = new ArrayList<JmsJndiConfig>();
+ synchronized (m_observerMap) {
+ Collection<JmsJndiConfig> allLists = m_observerMap.keySet();
+ for (JmsJndiConfig conf : allLists) {
+ Collection<WeakReference<IJmsCallback>> list = m_observerMap.get(conf);
+ for (Iterator<WeakReference<IJmsCallback>> it = list.iterator(); it.hasNext();) {
+ WeakReference<IJmsCallback> ref = it.next();
+ IJmsCallback o = ref.get();
+ if (o == null) {
+ it.remove();
+ }
+ }
+ if (list.size() == 0) {
+ empty.add(conf);
+ }
+ }
+ }
+ synchronized (m_jmsListenerMapLock) {
+ for (JmsJndiConfig conf : empty) {
+ m_observerMap.remove(conf);
+ JmsListener listener = m_jmsListenerMap.get(conf);
+ if (listener != null) {
+ listener.stopListeningOnQueue();
+ m_jmsListenerMap.remove(conf);
+ }
+ }
+ }
+ }
+
+ /**
+ * Callback method that gets called by all listeners on the queue. Iterates
+ * the observer map for given config and calls all registered callback classes
+ * for this config.
+ *
+ * @param config
+ * {@link JmsJndiConfig}
+ * @param msg
+ * {@link Message}
+ * @param value
+ * {@link Object}
+ */
+ private void fireCallback(JmsJndiConfig config, final Message msg, final Object value) {
+ synchronized (m_observerMapLock) {
+ if (m_observerMap != null) {
+ for (WeakReference<IJmsCallback> callback : m_observerMap.get(config)) {
+ final IJmsCallback c = callback.get();
+ if (c != null) {
+ try {
+ c.execOnMessage(msg, value);
+ }
+ catch (ProcessingException e) {
+ LOG.error("Message " + msg, e);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Adds a listener to the queue. Makes sure that only one listener per service
+ * and configuration is added. Takes a implementation of the {@link IJmsCallback} interface as parameter. This service
+ * will be called
+ * upon a message to the queue. Method is thread safe. Creates an {@link JmsListener} object that is listening on the
+ * queue. Will enable the
+ * use of username password to connect to JMS-server. Warning: IJmsCallback
+ * classes given are weak referenced! Make sure the reference to it is managed
+ * outside this class. It will be garbage collected otherwise!
+ *
+ * @param callback
+ * {@link IJmsCallback}
+ * @param config
+ * {@link JmsJndiConfig}
+ * @throws ProcessingException
+ */
+ public void addListener(IJmsCallback callback, JmsJndiConfig config) throws ProcessingException {
+ // only add if not already added
+ cleanup();
+ Collection<WeakReference<IJmsCallback>> list = null;
+ synchronized (m_observerMapLock) {
+ list = m_observerMap.get(config);
+ if (list == null) {
+ list = new ArrayList<WeakReference<IJmsCallback>>();
+ m_observerMap.put(config, list);
+ }
+ list.add(new WeakReference<IJmsCallback>(callback));
+ }
+ synchronized (m_jmsListenerMapLock) {
+ JmsListener listener = m_jmsListenerMap.get(config);
+ if (listener == null) {
+ listener = new JmsListener(config);
+ m_jmsListenerMap.put(config, new JmsListener(config));
+ }
+ listener.startListeningOnQueue();
+ }
+ }
+
+ /**
+ * Removes listener from the queue. Takes a implementation of the {@link IJmsCallback} interface and the config that
+ * defines the queue that
+ * the callback is listening on as parameter. Makes sure that listener is
+ * removed if no callback class is listening on the given config anymore.
+ * Method is thread safe.
+ *
+ * @param callback
+ * {@link IJmsCallback}
+ * @param config
+ * {@link JmsJndiConfig}
+ * @throws ProcessingException
+ */
+ public void removeListener(IJmsCallback callback, JmsJndiConfig config) throws ProcessingException {
+ cleanup();
+ Collection<WeakReference<IJmsCallback>> list = null;
+ synchronized (m_observerMap) {
+ list = m_observerMap.get(config);
+ if (list != null) {
+ list.remove(callback);
+ }
+ }
+ synchronized (m_jmsListenerMap) {
+ if (list != null && list.size() == 0) {
+ JmsListener listener = m_jmsListenerMap.get(config);
+ if (listener != null) {
+ if (LOG.isInfoEnabled()) {
+ LOG.info("method=" + callback.getClass().getName());
+ }
+ listener.stopListeningOnQueue();
+ m_jmsListenerMap.remove(config);
+ m_observerMap.remove(config);
+ }
+ }
+ }
+ }
+
+ /**
+ * Removes all listeners from the queue. Cleanup using this method. Warning:
+ * removes all listeners and callback classes!
+ */
+ public void removeAllListeners() throws ProcessingException {
+ cleanup();
+ // only add if not already added
+ synchronized (m_jmsListenerMap) {
+ if (LOG.isInfoEnabled()) {
+ LOG.info("" + m_observerMap + " listeners");
+ }
+ for (JmsListener listener : m_jmsListenerMap.values()) {
+ try {
+ listener.stopListeningOnQueue();
+ }
+ catch (ProcessingException e) {
+ LOG.error(null, e);
+ }
+ }
+ }
+ m_jmsListenerMap.clear();
+ synchronized (m_observerMapLock) {
+ for (Collection<WeakReference<IJmsCallback>> list : m_observerMap.values()) {
+ list.clear();
+ }
+ m_observerMap.clear();
+ }
+ }
+
+ /**
+ * Inner class defining a listener on a JMS queue or topic. Inherits from the {@link MessageListener} interface.
+ */
+ private class JmsListener implements javax.jms.MessageListener {
+
+ private JmsJndiConfig m_config;
+ private JmsTransactionMember m_jmsXaResource;
+
+ public JmsListener(JmsJndiConfig config) {
+ m_config = config;
+ m_jmsXaResource = new JmsTransactionMember(m_config);
+ }
+
+ /**
+ * make sure resources are freed
+ */
+ @Override
+ protected void finalize() throws Throwable {
+
+ m_jmsXaResource.release();
+ m_jmsXaResource = null;
+ }
+
+ /**
+ * Start to listen on the queue defined in {@link JmsTransactionMember} instance of
+ * this class.
+ *
+ * @throws ProcessingException
+ */
+ public void startListeningOnQueue() throws ProcessingException {
+ stopListeningOnQueue();
+ try {
+ MessageConsumer consumer = m_jmsXaResource.getMessageConsumer();
+ consumer.setMessageListener(this);
+ }
+ catch (JMSException e) {
+ stopListeningOnQueue();
+ throw new ProcessingException(e.getLocalizedMessage(), e.getCause());
+ }
+ }
+
+ /**
+ * Stop to listen on the queue defined in {@link ScoutJMSXAResource} instance of this class.
+ *
+ * @throws ProcessingException
+ */
+ public void stopListeningOnQueue() throws ProcessingException {
+ m_jmsXaResource.release();
+ }
+
+ /**
+ * The onMessage Method is called by JMS when a message has arrived for the
+ * queue / topic that this listener listens to.
+ */
+ @Override
+ public final void onMessage(Message msg) {
+ try {
+ if (msg != null) {
+ Object valueForS = null;
+ if (msg instanceof TextMessage) {
+ valueForS = ((TextMessage) msg).getText();
+ }
+ else if (msg instanceof BytesMessage) {
+ byte[] ba = new byte[(int) ((BytesMessage) msg).getBodyLength()];
+ ((BytesMessage) msg).readBytes(ba);
+ valueForS = ba;
+ }
+ else if (msg instanceof ObjectMessage) {
+ valueForS = ((ObjectMessage) msg).getObject();
+ }
+ fireCallback(m_config, msg, valueForS);
+ msg.acknowledge();
+ if (m_jmsXaResource.commitPhase1()) {
+ m_jmsXaResource.commitPhase2();
+ }
+ }
+ }
+ catch (JMSException ex) {
+ LOG.error("receiving message: " + msg, ex);
+ // err, no acknowledge
+ m_jmsXaResource.rollback();
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jms/internal/ExampleJmsConsumer.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jms/internal/ExampleJmsConsumer.java
index 52d1523324..7febc864d3 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jms/internal/ExampleJmsConsumer.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jms/internal/ExampleJmsConsumer.java
@@ -1,38 +1,38 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jms.internal;
-
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.rt.server.services.common.jms.AbstractJmsConsumerService;
-
-@Priority(-1)
-public class ExampleJmsConsumer extends AbstractJmsConsumerService {
-
- @Override
- protected String getConfiguredConnectionFactoryJndiName() {
- return "ConnectionFactory";
- }
-
- @Override
- protected String getConfiguredJndiName() {
- return "queue2";
- }
-
- @Override
- protected String getConfiguredProviderUrl() {
- return "tcp://10.0.2.128:3035";
- }
-
- @Override
- protected String getConfiguredContextFactory() {
- return "org.exolab.jms.jndi.InitialContextFactory";
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jms.internal;
+
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.rt.server.services.common.jms.AbstractJmsConsumerService;
+
+@Priority(-1)
+public class ExampleJmsConsumer extends AbstractJmsConsumerService {
+
+ @Override
+ protected String getConfiguredConnectionFactoryJndiName() {
+ return "ConnectionFactory";
+ }
+
+ @Override
+ protected String getConfiguredJndiName() {
+ return "queue2";
+ }
+
+ @Override
+ protected String getConfiguredProviderUrl() {
+ return "tcp://10.0.2.128:3035";
+ }
+
+ @Override
+ protected String getConfiguredContextFactory() {
+ return "org.exolab.jms.jndi.InitialContextFactory";
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jms/internal/JmsTransactionMember.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jms/internal/JmsTransactionMember.java
index 105860b92c..e8d86ea596 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jms/internal/JmsTransactionMember.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jms/internal/JmsTransactionMember.java
@@ -1,482 +1,482 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.jms.internal;
-
-import java.io.Serializable;
-
-import javax.jms.BytesMessage;
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.ObjectMessage;
-import javax.jms.Queue;
-import javax.jms.QueueConnection;
-import javax.jms.QueueConnectionFactory;
-import javax.jms.QueueReceiver;
-import javax.jms.QueueSender;
-import javax.jms.QueueSession;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.jms.Topic;
-import javax.jms.TopicConnection;
-import javax.jms.TopicConnectionFactory;
-import javax.jms.TopicPublisher;
-import javax.jms.TopicSession;
-import javax.jms.TopicSubscriber;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.server.services.common.jms.JmsJndiConfig;
-import org.eclipse.scout.rt.server.transaction.AbstractTransactionMember;
-
-/**
- * Title: BSI Scout V3
- * , Michael Rudolf
- * @version 3.x
- */
-
-/**
- * Queue/Topic xa resource (per request)
- *
- * @since Build 192
- * (Extracted out of JmsService class to an autonomous class)
- */
-public class JmsTransactionMember extends AbstractTransactionMember {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(JmsTransactionMember.class);
-
- public static final String TRANSACTION_MEMBER_ID = "JmsTransactionMember";
-
- // app ctx
- private ConnectionFactory m_cf;
- private Destination m_destination;
- private JmsJndiConfig m_config;
- // request ctx
- private Connection m_conn;
- private Session m_session;
- private MessageConsumer m_mc;
- private MessageProducer m_mp;
- private boolean m_typeQueue;
- private boolean m_useSecurityCredential;
-
- public JmsTransactionMember(JmsJndiConfig config) {
- super(new Long(config.getCrc()).toString());
- m_config = config;
- m_useSecurityCredential = StringUtility.hasText(config.getUserName());
- }
-
- /**
- * Makes sure the message connection factory and destination (queue / topic)
- * cache is set and can be used.
- *
- * @throws ProcessingException
- */
- public void ensureCache() throws ProcessingException {
- if (m_cf == null || m_destination == null) {
- InitialContext ctx = null;
- try {
- ctx = m_config.createInitialContext();
- try {
- m_cf = (ConnectionFactory) ctx.lookup(m_config.getConnectionFactoryJndiName());
- m_destination = (Destination) ctx.lookup(m_config.getJndiName());
- }
- catch (NamingException e) {
- throw new ProcessingException(e.getMessage(), e.getCause());
- }
- }
- finally {
- if (ctx != null) {
- // try{ctx.close();}catch(Exception fatal){}
- }
- }
- }
- }
-
- public boolean isQueue() {
- return m_typeQueue;
- }
-
- public boolean isTopic() {
- return !m_typeQueue;
- }
-
- /**
- * Forces connection setup
- */
- public void connectToJmsImmediately() throws ProcessingException {
- ensureConnectionToJms();
- }
-
- private void ensureConnectionToJms() throws ProcessingException {
- ensureCache();
- if (m_conn == null || m_session == null) {
- try {
- // new interface
- try {
- if (m_useSecurityCredential) {
- m_conn = m_cf.createConnection(m_config.getUserName(), m_config.getPassword());
- }
- else {
- m_conn = m_cf.createConnection();
- }
- }
- catch (Throwable e2) {
- // old interface
- if (isQueue()) {
- if (m_useSecurityCredential) {
- m_conn = ((QueueConnectionFactory) m_cf).createQueueConnection(m_config.getUserName(), m_config.getPassword());
- }
- else {
- m_conn = ((QueueConnectionFactory) m_cf).createQueueConnection();
- }
- }
- else {
- if (m_useSecurityCredential) {
- m_conn = ((TopicConnectionFactory) m_cf).createTopicConnection(m_config.getUserName(), m_config.getPassword());
- }
- else {
- m_conn = ((TopicConnectionFactory) m_cf).createTopicConnection();
- }
- }
- }
- // new interface
- try {
- m_session = m_conn.createSession(true, Session.CLIENT_ACKNOWLEDGE);
- }
- catch (Throwable e2) {
- // old interface
- if (isQueue()) {
- m_session = ((QueueConnection) m_conn).createQueueSession(true, Session.CLIENT_ACKNOWLEDGE);
- }
- // topic
- else {
- m_session = ((TopicConnection) m_conn).createTopicSession(true, Session.CLIENT_ACKNOWLEDGE);
- }
- }
- m_conn.start();
- }
- catch (JMSException e) {
- release();
- throw new ProcessingException(e.getMessage(), e.getCause());
- }
- }
- }
-
- public Connection getConnection() throws ProcessingException {
- ensureConnectionToJms();
- return m_conn;
- }
-
- public Session getSession() throws ProcessingException {
- ensureConnectionToJms();
- return m_session;
- }
-
- public MessageConsumer getMessageConsumer() throws ProcessingException {
- ensureConnectionToJms();
- try {
- if (m_mc == null) {
- // new interface
- try {
- m_mc = m_session.createConsumer(m_destination);
- }
- catch (Throwable t) {
- if (isQueue()) {
- m_mc = ((QueueSession) m_session).createReceiver((Queue) m_destination);
- }
- else {
- m_mc = ((TopicSession) m_session).createSubscriber((Topic) m_destination);
- }
- }
- }
- }
- catch (JMSException e) {
- throw new ProcessingException(e.getMessage(), e.getCause());
- }
- return m_mc;
- }
-
- public MessageProducer getMessageProducer() throws ProcessingException {
- ensureConnectionToJms();
- try {
- if (m_mp == null) {
- // new interface
- try {
- m_mp = m_session.createProducer(m_destination);
- }
- catch (Throwable t) {
- // old interface
- if (isQueue()) {
- m_mp = ((QueueSession) m_session).createSender((Queue) m_destination);
- }
- else {
- m_mp = ((TopicSession) m_session).createPublisher((Topic) m_destination);
- }
- }
- }
- }
- catch (JMSException e) {
- throw new ProcessingException(e.getMessage(), e.getCause());
- }
- return m_mp;
- }
-
- public void putObject(Object obj, boolean autoCommit) throws ProcessingException {
- ensureCache();
-
- if (LOG.isInfoEnabled()) {
- LOG.info("obj=" + obj);
- }
- Session session = getSession();
- //
- Message msg0 = null;
- try {
- if (obj instanceof byte[]) {
- BytesMessage msg = session.createBytesMessage();
- msg.writeBytes((byte[]) obj);
- msg0 = msg;
- }
- else if (obj instanceof String) {
- TextMessage msg = session.createTextMessage((String) obj);
- msg0 = msg;
- }
- else if (obj instanceof Serializable) {
- ObjectMessage msg = session.createObjectMessage((Serializable) obj);
- msg0 = msg;
- }
- else {
- throw new IllegalArgumentException("Cannot put object of type " + (obj != null ? obj.getClass() : null));
- }
- }
- catch (JMSException e) {
- throw new ProcessingException(e.getMessage(), e.getCause());
- }
- if (msg0 != null) {
- MessageProducer mp = getMessageProducer();
- // new interface
- try {
- mp.send(msg0);
- }
- catch (Throwable t) {
- // old interface
- try {
- if (isQueue()) {
- ((QueueSender) mp).send(msg0);
- }
- else {
- ((TopicPublisher) mp).publish(msg0);
- }
- }
- catch (JMSException e) {
- throw new ProcessingException(e.getMessage(), e.getCause());
- }
- }
- if (autoCommit) {
- try {
- session.commit();
- }
- catch (JMSException e) {
- throw new ProcessingException(e.getMessage(), e.getCause());
- }
- }
- }
- release();
- }
-
- public Object getObject(long timeoutMillis, boolean autoCommit) throws ProcessingException {
- ensureCache();
-
- Session session = getSession();
- //
- MessageConsumer mc = getMessageConsumer();
- Message msg = null;
- if (timeoutMillis > 0) {
- // new interface
- try {
- msg = mc.receive(timeoutMillis);
- }
- catch (Throwable t) {
- // old interface
- try {
- if (isQueue()) {
- msg = ((QueueReceiver) mc).receive(timeoutMillis);
- }
- else {
- msg = ((TopicSubscriber) mc).receive(timeoutMillis);
- }
- }
- catch (JMSException e) {
- throw new ProcessingException(e.getMessage(), e.getCause());
- }
- }
- }
- else if (timeoutMillis == 0) {
- // new interface
- try {
- msg = mc.receiveNoWait();
- }
- catch (Throwable t) {
- // old interface
- try {
- if (isQueue()) {
- msg = ((QueueReceiver) mc).receiveNoWait();
- }
- else {
- msg = ((TopicSubscriber) mc).receiveNoWait();
- }
- }
- catch (JMSException e) {
- throw new ProcessingException(e.getMessage(), e.getCause());
- }
- }
- }
- else {
- // new interface
- try {
- msg = mc.receive();
- }
- catch (Throwable t) {
- // old interface
- try {
- if (isQueue()) {
- msg = ((QueueReceiver) mc).receive();
- }
- else {
- msg = ((TopicSubscriber) mc).receive();
- }
- }
- catch (JMSException e) {
- throw new ProcessingException(e.getMessage(), e.getCause());
- }
- }
- }
- //
- if (msg == null) {
- release();
- return null;
- }
- else {
- Object valueForS = null;
- try {
- if (msg instanceof TextMessage) {
- valueForS = ((TextMessage) msg).getText();
- }
- else if (msg instanceof BytesMessage) {
- byte[] ba = new byte[(int) ((BytesMessage) msg).getBodyLength()];
- ((BytesMessage) msg).readBytes(ba);
- valueForS = ba;
- }
- else if (msg instanceof ObjectMessage) {
- valueForS = ((ObjectMessage) msg).getObject();
- }
- else {
- throw new IllegalArgumentException("Unexpected message of type " + msg.getClass());
- }
- msg.acknowledge();
- if (autoCommit) {
- session.commit();
- }
- }
- catch (JMSException e) {
- throw new ProcessingException(e.getMessage(), e.getCause());
- }
- release();
- return valueForS;
- }
- }
-
- @Override
- public boolean needsCommit() {
- return true;
- }
-
- @Override
- public boolean commitPhase1() {
- return true;
- }
-
- @Override
- public void commitPhase2() {
- if (m_session != null) {
- try {
- m_session.commit();
- }
- catch (JMSException ex) {
- LOG.error("commit: " + m_session, ex);
- }
- }
- }
-
- @Override
- public void rollback() {
- if (m_session != null) {
- try {
- m_session.rollback();
- }
- catch (JMSException ex) {
- LOG.error("rollback: " + m_session, ex);
- }
- }
- }
-
- @Override
- public void release() {
- if (m_mc != null) {
- try {
- m_mc.close();
- }
- catch (JMSException fatal) {
- LOG.error(null, fatal);
- }
- m_mc = null;
- }
- if (m_mp != null) {
- try {
- m_mp.close();
- }
- catch (JMSException fatal) {
- LOG.error(null, fatal);
- }
- m_mp = null;
- }
- if (m_conn != null) {
- try {
- m_conn.stop();
- }
- catch (JMSException fatal) {
- LOG.error(null, fatal);
- }
- try {
- m_conn.close();
- }
- catch (JMSException fatal) {
- LOG.error(null, fatal);
- }
- m_conn = null;
- }
- if (m_session != null) {
- try {
- m_session.close();
- }
- catch (JMSException fatal) {
- LOG.error(null, fatal);
- }
- m_session = null;
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.jms.internal;
+
+import java.io.Serializable;
+
+import javax.jms.BytesMessage;
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.ObjectMessage;
+import javax.jms.Queue;
+import javax.jms.QueueConnection;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.QueueReceiver;
+import javax.jms.QueueSender;
+import javax.jms.QueueSession;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.jms.Topic;
+import javax.jms.TopicConnection;
+import javax.jms.TopicConnectionFactory;
+import javax.jms.TopicPublisher;
+import javax.jms.TopicSession;
+import javax.jms.TopicSubscriber;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.server.services.common.jms.JmsJndiConfig;
+import org.eclipse.scout.rt.server.transaction.AbstractTransactionMember;
+
+/**
+ * Title: BSI Scout V3
+ * , Michael Rudolf
+ * @version 3.x
+ */
+
+/**
+ * Queue/Topic xa resource (per request)
+ *
+ * @since Build 192
+ * (Extracted out of JmsService class to an autonomous class)
+ */
+public class JmsTransactionMember extends AbstractTransactionMember {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(JmsTransactionMember.class);
+
+ public static final String TRANSACTION_MEMBER_ID = "JmsTransactionMember";
+
+ // app ctx
+ private ConnectionFactory m_cf;
+ private Destination m_destination;
+ private JmsJndiConfig m_config;
+ // request ctx
+ private Connection m_conn;
+ private Session m_session;
+ private MessageConsumer m_mc;
+ private MessageProducer m_mp;
+ private boolean m_typeQueue;
+ private boolean m_useSecurityCredential;
+
+ public JmsTransactionMember(JmsJndiConfig config) {
+ super(new Long(config.getCrc()).toString());
+ m_config = config;
+ m_useSecurityCredential = StringUtility.hasText(config.getUserName());
+ }
+
+ /**
+ * Makes sure the message connection factory and destination (queue / topic)
+ * cache is set and can be used.
+ *
+ * @throws ProcessingException
+ */
+ public void ensureCache() throws ProcessingException {
+ if (m_cf == null || m_destination == null) {
+ InitialContext ctx = null;
+ try {
+ ctx = m_config.createInitialContext();
+ try {
+ m_cf = (ConnectionFactory) ctx.lookup(m_config.getConnectionFactoryJndiName());
+ m_destination = (Destination) ctx.lookup(m_config.getJndiName());
+ }
+ catch (NamingException e) {
+ throw new ProcessingException(e.getMessage(), e.getCause());
+ }
+ }
+ finally {
+ if (ctx != null) {
+ // try{ctx.close();}catch(Exception fatal){}
+ }
+ }
+ }
+ }
+
+ public boolean isQueue() {
+ return m_typeQueue;
+ }
+
+ public boolean isTopic() {
+ return !m_typeQueue;
+ }
+
+ /**
+ * Forces connection setup
+ */
+ public void connectToJmsImmediately() throws ProcessingException {
+ ensureConnectionToJms();
+ }
+
+ private void ensureConnectionToJms() throws ProcessingException {
+ ensureCache();
+ if (m_conn == null || m_session == null) {
+ try {
+ // new interface
+ try {
+ if (m_useSecurityCredential) {
+ m_conn = m_cf.createConnection(m_config.getUserName(), m_config.getPassword());
+ }
+ else {
+ m_conn = m_cf.createConnection();
+ }
+ }
+ catch (Throwable e2) {
+ // old interface
+ if (isQueue()) {
+ if (m_useSecurityCredential) {
+ m_conn = ((QueueConnectionFactory) m_cf).createQueueConnection(m_config.getUserName(), m_config.getPassword());
+ }
+ else {
+ m_conn = ((QueueConnectionFactory) m_cf).createQueueConnection();
+ }
+ }
+ else {
+ if (m_useSecurityCredential) {
+ m_conn = ((TopicConnectionFactory) m_cf).createTopicConnection(m_config.getUserName(), m_config.getPassword());
+ }
+ else {
+ m_conn = ((TopicConnectionFactory) m_cf).createTopicConnection();
+ }
+ }
+ }
+ // new interface
+ try {
+ m_session = m_conn.createSession(true, Session.CLIENT_ACKNOWLEDGE);
+ }
+ catch (Throwable e2) {
+ // old interface
+ if (isQueue()) {
+ m_session = ((QueueConnection) m_conn).createQueueSession(true, Session.CLIENT_ACKNOWLEDGE);
+ }
+ // topic
+ else {
+ m_session = ((TopicConnection) m_conn).createTopicSession(true, Session.CLIENT_ACKNOWLEDGE);
+ }
+ }
+ m_conn.start();
+ }
+ catch (JMSException e) {
+ release();
+ throw new ProcessingException(e.getMessage(), e.getCause());
+ }
+ }
+ }
+
+ public Connection getConnection() throws ProcessingException {
+ ensureConnectionToJms();
+ return m_conn;
+ }
+
+ public Session getSession() throws ProcessingException {
+ ensureConnectionToJms();
+ return m_session;
+ }
+
+ public MessageConsumer getMessageConsumer() throws ProcessingException {
+ ensureConnectionToJms();
+ try {
+ if (m_mc == null) {
+ // new interface
+ try {
+ m_mc = m_session.createConsumer(m_destination);
+ }
+ catch (Throwable t) {
+ if (isQueue()) {
+ m_mc = ((QueueSession) m_session).createReceiver((Queue) m_destination);
+ }
+ else {
+ m_mc = ((TopicSession) m_session).createSubscriber((Topic) m_destination);
+ }
+ }
+ }
+ }
+ catch (JMSException e) {
+ throw new ProcessingException(e.getMessage(), e.getCause());
+ }
+ return m_mc;
+ }
+
+ public MessageProducer getMessageProducer() throws ProcessingException {
+ ensureConnectionToJms();
+ try {
+ if (m_mp == null) {
+ // new interface
+ try {
+ m_mp = m_session.createProducer(m_destination);
+ }
+ catch (Throwable t) {
+ // old interface
+ if (isQueue()) {
+ m_mp = ((QueueSession) m_session).createSender((Queue) m_destination);
+ }
+ else {
+ m_mp = ((TopicSession) m_session).createPublisher((Topic) m_destination);
+ }
+ }
+ }
+ }
+ catch (JMSException e) {
+ throw new ProcessingException(e.getMessage(), e.getCause());
+ }
+ return m_mp;
+ }
+
+ public void putObject(Object obj, boolean autoCommit) throws ProcessingException {
+ ensureCache();
+
+ if (LOG.isInfoEnabled()) {
+ LOG.info("obj=" + obj);
+ }
+ Session session = getSession();
+ //
+ Message msg0 = null;
+ try {
+ if (obj instanceof byte[]) {
+ BytesMessage msg = session.createBytesMessage();
+ msg.writeBytes((byte[]) obj);
+ msg0 = msg;
+ }
+ else if (obj instanceof String) {
+ TextMessage msg = session.createTextMessage((String) obj);
+ msg0 = msg;
+ }
+ else if (obj instanceof Serializable) {
+ ObjectMessage msg = session.createObjectMessage((Serializable) obj);
+ msg0 = msg;
+ }
+ else {
+ throw new IllegalArgumentException("Cannot put object of type " + (obj != null ? obj.getClass() : null));
+ }
+ }
+ catch (JMSException e) {
+ throw new ProcessingException(e.getMessage(), e.getCause());
+ }
+ if (msg0 != null) {
+ MessageProducer mp = getMessageProducer();
+ // new interface
+ try {
+ mp.send(msg0);
+ }
+ catch (Throwable t) {
+ // old interface
+ try {
+ if (isQueue()) {
+ ((QueueSender) mp).send(msg0);
+ }
+ else {
+ ((TopicPublisher) mp).publish(msg0);
+ }
+ }
+ catch (JMSException e) {
+ throw new ProcessingException(e.getMessage(), e.getCause());
+ }
+ }
+ if (autoCommit) {
+ try {
+ session.commit();
+ }
+ catch (JMSException e) {
+ throw new ProcessingException(e.getMessage(), e.getCause());
+ }
+ }
+ }
+ release();
+ }
+
+ public Object getObject(long timeoutMillis, boolean autoCommit) throws ProcessingException {
+ ensureCache();
+
+ Session session = getSession();
+ //
+ MessageConsumer mc = getMessageConsumer();
+ Message msg = null;
+ if (timeoutMillis > 0) {
+ // new interface
+ try {
+ msg = mc.receive(timeoutMillis);
+ }
+ catch (Throwable t) {
+ // old interface
+ try {
+ if (isQueue()) {
+ msg = ((QueueReceiver) mc).receive(timeoutMillis);
+ }
+ else {
+ msg = ((TopicSubscriber) mc).receive(timeoutMillis);
+ }
+ }
+ catch (JMSException e) {
+ throw new ProcessingException(e.getMessage(), e.getCause());
+ }
+ }
+ }
+ else if (timeoutMillis == 0) {
+ // new interface
+ try {
+ msg = mc.receiveNoWait();
+ }
+ catch (Throwable t) {
+ // old interface
+ try {
+ if (isQueue()) {
+ msg = ((QueueReceiver) mc).receiveNoWait();
+ }
+ else {
+ msg = ((TopicSubscriber) mc).receiveNoWait();
+ }
+ }
+ catch (JMSException e) {
+ throw new ProcessingException(e.getMessage(), e.getCause());
+ }
+ }
+ }
+ else {
+ // new interface
+ try {
+ msg = mc.receive();
+ }
+ catch (Throwable t) {
+ // old interface
+ try {
+ if (isQueue()) {
+ msg = ((QueueReceiver) mc).receive();
+ }
+ else {
+ msg = ((TopicSubscriber) mc).receive();
+ }
+ }
+ catch (JMSException e) {
+ throw new ProcessingException(e.getMessage(), e.getCause());
+ }
+ }
+ }
+ //
+ if (msg == null) {
+ release();
+ return null;
+ }
+ else {
+ Object valueForS = null;
+ try {
+ if (msg instanceof TextMessage) {
+ valueForS = ((TextMessage) msg).getText();
+ }
+ else if (msg instanceof BytesMessage) {
+ byte[] ba = new byte[(int) ((BytesMessage) msg).getBodyLength()];
+ ((BytesMessage) msg).readBytes(ba);
+ valueForS = ba;
+ }
+ else if (msg instanceof ObjectMessage) {
+ valueForS = ((ObjectMessage) msg).getObject();
+ }
+ else {
+ throw new IllegalArgumentException("Unexpected message of type " + msg.getClass());
+ }
+ msg.acknowledge();
+ if (autoCommit) {
+ session.commit();
+ }
+ }
+ catch (JMSException e) {
+ throw new ProcessingException(e.getMessage(), e.getCause());
+ }
+ release();
+ return valueForS;
+ }
+ }
+
+ @Override
+ public boolean needsCommit() {
+ return true;
+ }
+
+ @Override
+ public boolean commitPhase1() {
+ return true;
+ }
+
+ @Override
+ public void commitPhase2() {
+ if (m_session != null) {
+ try {
+ m_session.commit();
+ }
+ catch (JMSException ex) {
+ LOG.error("commit: " + m_session, ex);
+ }
+ }
+ }
+
+ @Override
+ public void rollback() {
+ if (m_session != null) {
+ try {
+ m_session.rollback();
+ }
+ catch (JMSException ex) {
+ LOG.error("rollback: " + m_session, ex);
+ }
+ }
+ }
+
+ @Override
+ public void release() {
+ if (m_mc != null) {
+ try {
+ m_mc.close();
+ }
+ catch (JMSException fatal) {
+ LOG.error(null, fatal);
+ }
+ m_mc = null;
+ }
+ if (m_mp != null) {
+ try {
+ m_mp.close();
+ }
+ catch (JMSException fatal) {
+ LOG.error(null, fatal);
+ }
+ m_mp = null;
+ }
+ if (m_conn != null) {
+ try {
+ m_conn.stop();
+ }
+ catch (JMSException fatal) {
+ LOG.error(null, fatal);
+ }
+ try {
+ m_conn.close();
+ }
+ catch (JMSException fatal) {
+ LOG.error(null, fatal);
+ }
+ m_conn = null;
+ }
+ if (m_session != null) {
+ try {
+ m_session.close();
+ }
+ catch (JMSException fatal) {
+ LOG.error(null, fatal);
+ }
+ m_session = null;
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/offline/OfflineDispatcherService.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/offline/OfflineDispatcherService.java
index 8d65cc0bc7..3f3c713a75 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/offline/OfflineDispatcherService.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/offline/OfflineDispatcherService.java
@@ -1,246 +1,246 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.offline;
-
-import java.lang.reflect.Method;
-import java.security.AccessController;
-import java.util.LinkedList;
-import java.util.Map;
-
-import javax.security.auth.Subject;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.holders.Holder;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.server.IServerSession;
-import org.eclipse.scout.rt.server.ServerJob;
-import org.eclipse.scout.rt.server.ThreadContext;
-import org.eclipse.scout.rt.server.services.common.clientnotification.IClientNotificationService;
-import org.eclipse.scout.rt.server.services.common.session.IServerSessionRegistryService;
-import org.eclipse.scout.rt.server.transaction.ITransaction;
-import org.eclipse.scout.rt.shared.OfflineState;
-import org.eclipse.scout.rt.shared.services.common.clientnotification.IClientNotification;
-import org.eclipse.scout.rt.shared.services.common.offline.IOfflineDispatcherService;
-import org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelRequest;
-import org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelResponse;
-import org.eclipse.scout.rt.shared.ui.UserAgent;
-import org.eclipse.scout.service.AbstractService;
-import org.eclipse.scout.service.SERVICES;
-import org.eclipse.scout.service.ServiceUtility;
-
-public class OfflineDispatcherService extends AbstractService implements IOfflineDispatcherService {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(OfflineDispatcherService.class);
-
- private Class<? extends IServerSession> m_serverSessionClass;
- private IServerSession m_serverSession;
- private Subject m_subject;
- private final Thread m_dispatcherThread;
- // queue
- private final Object m_queueLock;
- private final LinkedList<Runnable> m_queue;
-
- public OfflineDispatcherService() {
- m_queue = new LinkedList<Runnable>();
- m_queueLock = new Object();
- m_dispatcherThread = new Thread("Dispatcher for " + getClass().getName()) {
- @Override
- public void run() {
- // offline dispatcher thread is always in offline mode
- OfflineState.setOfflineInCurrentThread(true);
- while (true) {
- try {
- dispatchNextJob();
- }
- catch (Throwable t) {
- LOG.error("Error while executing job in offline dispatcher thread.", t);
- }
- }
- }
- };
- m_dispatcherThread.setDaemon(true);
- m_dispatcherThread.start();
- }
-
- @Override
- public String getServerSessionClass() {
- return (m_serverSessionClass != null ? m_serverSessionClass.getName() : null);
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public void setServerSessionClass(String className) {
- int i = className.lastIndexOf('.');
- try {
- m_serverSessionClass = (Class<? extends IServerSession>) Platform.getBundle(className.substring(0, i)).loadClass(className);
- }
- catch (ClassNotFoundException e) {
- throw new IllegalArgumentException("Loading class " + className, e);
- }
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public ServiceTunnelResponse dispatch(final ServiceTunnelRequest request, final IProgressMonitor monitor) {
- final Subject subject = Subject.getSubject(AccessController.getContext());
- if (m_serverSessionClass == null) {
- String className = Platform.getProduct().getDefiningBundle().getSymbolicName();
- className = className.replaceAll("\\.ui\\..*$", ".server.core") + ".ServerSession";
- int i = className.lastIndexOf('.');
- try {
- LOG.warn("missing config.ini property: " + getClass().getName() + "#serverSessionClass=your.app.server.ServerSession. Trying to find default class " + className);
- m_serverSessionClass = (Class<? extends IServerSession>) Platform.getBundle(className.substring(0, i)).loadClass(className);
- }
- catch (ClassNotFoundException e) {
- // nop
- }
- if (m_serverSessionClass == null) {
- return new ServiceTunnelResponse(null, null, new ProcessingException("missing config.ini property: " + getClass().getName() + "#serverSessionClass=your.app.server.ServerSession"));
- }
- }
-
- Thread currentThread = Thread.currentThread();
- if (currentThread == m_dispatcherThread) {
- // when already in dispatcher thread, call service directly
- ServiceTunnelResponse res;
- try {
- res = callService(request);
- }
- catch (Throwable e) {
- return new ServiceTunnelResponse(null, null, e);
- }
- return res;
-
- }
- // create a job and run inside the server dispatcher thread
- final Object waitLock = new Object();
- final Holder<ServiceTunnelResponse> responseHolder = new Holder<ServiceTunnelResponse>(ServiceTunnelResponse.class);
- if ((!currentThread.isInterrupted()) && (monitor == null || !monitor.isCanceled())) {
- Runnable job = new Runnable() {
- @Override
- public void run() {
- try {
- ServiceTunnelResponse res = dispatchInServerThread(request, subject);
- responseHolder.setValue(res);
- }
- finally {
- synchronized (waitLock) {
- waitLock.notifyAll();
- }
- }
- }
- };
- enqueueJob(job);
- // wait until done
- synchronized (waitLock) {
- while (responseHolder.getValue() == null && (!currentThread.isInterrupted()) && (!(monitor != null && monitor.isCanceled()))) {
- try {
- waitLock.wait(2000);
- }
- catch (InterruptedException e) {
- responseHolder.setValue(new ServiceTunnelResponse(null, null, e));
- }
- }
- }
- }
-
- if (responseHolder.getValue() != null) {
- return responseHolder.getValue();
- }
- else {
- return new ServiceTunnelResponse(null, null, new InterruptedException("Result from handler was null"));
- }
- }
-
- private ServiceTunnelResponse dispatchInServerThread(final ServiceTunnelRequest request, final Subject subject) {
- Map<Class, Object> backup = ThreadContext.backup();
- try {
- if (m_serverSession == null || subject == null || !subject.equals(m_subject)) {
- try {
- m_subject = subject;
- UserAgent userAgent = UserAgent.createByIdentifier(request.getUserAgent());
- m_serverSession = SERVICES.getService(IServerSessionRegistryService.class).newServerSession(m_serverSessionClass, subject, userAgent);
- }
- catch (ProcessingException e) {
- return new ServiceTunnelResponse(null, null, e);
- }
- }
- final Holder<ServiceTunnelResponse> responseHolder = new Holder<ServiceTunnelResponse>(ServiceTunnelResponse.class);
- ServerJob job = new ServerJob("Offline invokation", m_serverSession, subject) {
- @Override
- protected IStatus runTransaction(IProgressMonitor monitor) throws Exception {
- responseHolder.setValue(callService(request));
- return Status.OK_STATUS;
- }
- };
- IStatus status = job.runNow(new NullProgressMonitor());
- if (!status.isOK()) {
- return new ServiceTunnelResponse(null, null, new ProcessingException(status));
- }
- return responseHolder.getValue();
- }
- finally {
- ThreadContext.restore(backup);
- }
- }
-
- private ServiceTunnelResponse callService(ServiceTunnelRequest serviceReq) throws Exception {
- try {
- IServerSession serverSession = ThreadContext.getServerSession();
- Class<?> serviceInterfaceClass = serverSession.getBundle().loadClass(serviceReq.getServiceInterfaceClassName());
- Object service = SERVICES.getService(serviceInterfaceClass);
- if (service == null) {
- throw new ProcessingException("service registry does not contain a service of type " + serviceReq.getServiceInterfaceClassName());
- }
- Method serviceOp = ServiceUtility.getServiceOperation(serviceInterfaceClass, serviceReq.getOperation(), serviceReq.getParameterTypes());
- Object data = ServiceUtility.invoke(serviceOp, service, serviceReq.getArgs());
- Object[] outParameters = ServiceUtility.extractHolderArguments(serviceReq.getArgs());
- ServiceTunnelResponse serviceRes = new ServiceTunnelResponse(data, outParameters, null);
- // add accumulated client notifications as side-payload
- IClientNotification[] na = SERVICES.getService(IClientNotificationService.class).getNextNotifications(0);
- serviceRes.setClientNotifications(na);
- return serviceRes;
- }
- catch (Throwable t) {
- // cancel tx
- ITransaction transaction = ThreadContext.getTransaction();
- if (transaction != null) {
- transaction.addFailure(t);
- }
- // send error response
- return new ServiceTunnelResponse(null, null, t);
- }
- }
-
- private void enqueueJob(Runnable r) {
- synchronized (m_queueLock) {
- m_queue.add(r);
- m_queueLock.notifyAll();
- }
- }
-
- private void dispatchNextJob() throws InterruptedException {
- synchronized (m_queueLock) {
- if (m_queue.isEmpty()) {
- m_queueLock.wait();
- }
- if (!m_queue.isEmpty()) {
- Runnable r = m_queue.remove(0);
- r.run();
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.offline;
+
+import java.lang.reflect.Method;
+import java.security.AccessController;
+import java.util.LinkedList;
+import java.util.Map;
+
+import javax.security.auth.Subject;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.holders.Holder;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.server.IServerSession;
+import org.eclipse.scout.rt.server.ServerJob;
+import org.eclipse.scout.rt.server.ThreadContext;
+import org.eclipse.scout.rt.server.services.common.clientnotification.IClientNotificationService;
+import org.eclipse.scout.rt.server.services.common.session.IServerSessionRegistryService;
+import org.eclipse.scout.rt.server.transaction.ITransaction;
+import org.eclipse.scout.rt.shared.OfflineState;
+import org.eclipse.scout.rt.shared.services.common.clientnotification.IClientNotification;
+import org.eclipse.scout.rt.shared.services.common.offline.IOfflineDispatcherService;
+import org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelRequest;
+import org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelResponse;
+import org.eclipse.scout.rt.shared.ui.UserAgent;
+import org.eclipse.scout.service.AbstractService;
+import org.eclipse.scout.service.SERVICES;
+import org.eclipse.scout.service.ServiceUtility;
+
+public class OfflineDispatcherService extends AbstractService implements IOfflineDispatcherService {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(OfflineDispatcherService.class);
+
+ private Class<? extends IServerSession> m_serverSessionClass;
+ private IServerSession m_serverSession;
+ private Subject m_subject;
+ private final Thread m_dispatcherThread;
+ // queue
+ private final Object m_queueLock;
+ private final LinkedList<Runnable> m_queue;
+
+ public OfflineDispatcherService() {
+ m_queue = new LinkedList<Runnable>();
+ m_queueLock = new Object();
+ m_dispatcherThread = new Thread("Dispatcher for " + getClass().getName()) {
+ @Override
+ public void run() {
+ // offline dispatcher thread is always in offline mode
+ OfflineState.setOfflineInCurrentThread(true);
+ while (true) {
+ try {
+ dispatchNextJob();
+ }
+ catch (Throwable t) {
+ LOG.error("Error while executing job in offline dispatcher thread.", t);
+ }
+ }
+ }
+ };
+ m_dispatcherThread.setDaemon(true);
+ m_dispatcherThread.start();
+ }
+
+ @Override
+ public String getServerSessionClass() {
+ return (m_serverSessionClass != null ? m_serverSessionClass.getName() : null);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public void setServerSessionClass(String className) {
+ int i = className.lastIndexOf('.');
+ try {
+ m_serverSessionClass = (Class<? extends IServerSession>) Platform.getBundle(className.substring(0, i)).loadClass(className);
+ }
+ catch (ClassNotFoundException e) {
+ throw new IllegalArgumentException("Loading class " + className, e);
+ }
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public ServiceTunnelResponse dispatch(final ServiceTunnelRequest request, final IProgressMonitor monitor) {
+ final Subject subject = Subject.getSubject(AccessController.getContext());
+ if (m_serverSessionClass == null) {
+ String className = Platform.getProduct().getDefiningBundle().getSymbolicName();
+ className = className.replaceAll("\\.ui\\..*$", ".server.core") + ".ServerSession";
+ int i = className.lastIndexOf('.');
+ try {
+ LOG.warn("missing config.ini property: " + getClass().getName() + "#serverSessionClass=your.app.server.ServerSession. Trying to find default class " + className);
+ m_serverSessionClass = (Class<? extends IServerSession>) Platform.getBundle(className.substring(0, i)).loadClass(className);
+ }
+ catch (ClassNotFoundException e) {
+ // nop
+ }
+ if (m_serverSessionClass == null) {
+ return new ServiceTunnelResponse(null, null, new ProcessingException("missing config.ini property: " + getClass().getName() + "#serverSessionClass=your.app.server.ServerSession"));
+ }
+ }
+
+ Thread currentThread = Thread.currentThread();
+ if (currentThread == m_dispatcherThread) {
+ // when already in dispatcher thread, call service directly
+ ServiceTunnelResponse res;
+ try {
+ res = callService(request);
+ }
+ catch (Throwable e) {
+ return new ServiceTunnelResponse(null, null, e);
+ }
+ return res;
+
+ }
+ // create a job and run inside the server dispatcher thread
+ final Object waitLock = new Object();
+ final Holder<ServiceTunnelResponse> responseHolder = new Holder<ServiceTunnelResponse>(ServiceTunnelResponse.class);
+ if ((!currentThread.isInterrupted()) && (monitor == null || !monitor.isCanceled())) {
+ Runnable job = new Runnable() {
+ @Override
+ public void run() {
+ try {
+ ServiceTunnelResponse res = dispatchInServerThread(request, subject);
+ responseHolder.setValue(res);
+ }
+ finally {
+ synchronized (waitLock) {
+ waitLock.notifyAll();
+ }
+ }
+ }
+ };
+ enqueueJob(job);
+ // wait until done
+ synchronized (waitLock) {
+ while (responseHolder.getValue() == null && (!currentThread.isInterrupted()) && (!(monitor != null && monitor.isCanceled()))) {
+ try {
+ waitLock.wait(2000);
+ }
+ catch (InterruptedException e) {
+ responseHolder.setValue(new ServiceTunnelResponse(null, null, e));
+ }
+ }
+ }
+ }
+
+ if (responseHolder.getValue() != null) {
+ return responseHolder.getValue();
+ }
+ else {
+ return new ServiceTunnelResponse(null, null, new InterruptedException("Result from handler was null"));
+ }
+ }
+
+ private ServiceTunnelResponse dispatchInServerThread(final ServiceTunnelRequest request, final Subject subject) {
+ Map<Class, Object> backup = ThreadContext.backup();
+ try {
+ if (m_serverSession == null || subject == null || !subject.equals(m_subject)) {
+ try {
+ m_subject = subject;
+ UserAgent userAgent = UserAgent.createByIdentifier(request.getUserAgent());
+ m_serverSession = SERVICES.getService(IServerSessionRegistryService.class).newServerSession(m_serverSessionClass, subject, userAgent);
+ }
+ catch (ProcessingException e) {
+ return new ServiceTunnelResponse(null, null, e);
+ }
+ }
+ final Holder<ServiceTunnelResponse> responseHolder = new Holder<ServiceTunnelResponse>(ServiceTunnelResponse.class);
+ ServerJob job = new ServerJob("Offline invokation", m_serverSession, subject) {
+ @Override
+ protected IStatus runTransaction(IProgressMonitor monitor) throws Exception {
+ responseHolder.setValue(callService(request));
+ return Status.OK_STATUS;
+ }
+ };
+ IStatus status = job.runNow(new NullProgressMonitor());
+ if (!status.isOK()) {
+ return new ServiceTunnelResponse(null, null, new ProcessingException(status));
+ }
+ return responseHolder.getValue();
+ }
+ finally {
+ ThreadContext.restore(backup);
+ }
+ }
+
+ private ServiceTunnelResponse callService(ServiceTunnelRequest serviceReq) throws Exception {
+ try {
+ IServerSession serverSession = ThreadContext.getServerSession();
+ Class<?> serviceInterfaceClass = serverSession.getBundle().loadClass(serviceReq.getServiceInterfaceClassName());
+ Object service = SERVICES.getService(serviceInterfaceClass);
+ if (service == null) {
+ throw new ProcessingException("service registry does not contain a service of type " + serviceReq.getServiceInterfaceClassName());
+ }
+ Method serviceOp = ServiceUtility.getServiceOperation(serviceInterfaceClass, serviceReq.getOperation(), serviceReq.getParameterTypes());
+ Object data = ServiceUtility.invoke(serviceOp, service, serviceReq.getArgs());
+ Object[] outParameters = ServiceUtility.extractHolderArguments(serviceReq.getArgs());
+ ServiceTunnelResponse serviceRes = new ServiceTunnelResponse(data, outParameters, null);
+ // add accumulated client notifications as side-payload
+ IClientNotification[] na = SERVICES.getService(IClientNotificationService.class).getNextNotifications(0);
+ serviceRes.setClientNotifications(na);
+ return serviceRes;
+ }
+ catch (Throwable t) {
+ // cancel tx
+ ITransaction transaction = ThreadContext.getTransaction();
+ if (transaction != null) {
+ transaction.addFailure(t);
+ }
+ // send error response
+ return new ServiceTunnelResponse(null, null, t);
+ }
+ }
+
+ private void enqueueJob(Runnable r) {
+ synchronized (m_queueLock) {
+ m_queue.add(r);
+ m_queueLock.notifyAll();
+ }
+ }
+
+ private void dispatchNextJob() throws InterruptedException {
+ synchronized (m_queueLock) {
+ if (m_queue.isEmpty()) {
+ m_queueLock.wait();
+ }
+ if (!m_queue.isEmpty()) {
+ Runnable r = m_queue.remove(0);
+ r.run();
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/ping/PingService.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/ping/PingService.java
index b1c920659f..e2e79cb2e9 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/ping/PingService.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/ping/PingService.java
@@ -1,28 +1,28 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.ping;
-
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.rt.shared.services.common.ping.IPingService;
-import org.eclipse.scout.rt.shared.validate.InputValidation;
-import org.eclipse.scout.rt.shared.validate.IValidationStrategy;
-import org.eclipse.scout.service.AbstractService;
-
-@Priority(-1)
-public class PingService extends AbstractService implements IPingService {
-
- @Override
- @InputValidation(IValidationStrategy.QUERY.class)
- public String ping(String s) {
- return s;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.ping;
+
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.rt.shared.services.common.ping.IPingService;
+import org.eclipse.scout.rt.shared.validate.InputValidation;
+import org.eclipse.scout.rt.shared.validate.IValidationStrategy;
+import org.eclipse.scout.service.AbstractService;
+
+@Priority(-1)
+public class PingService extends AbstractService implements IPingService {
+
+ @Override
+ @InputValidation(IValidationStrategy.QUERY.class)
+ public String ping(String s) {
+ return s;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/pop3/IPOP3MessageVisitor.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/pop3/IPOP3MessageVisitor.java
index 0f69c185eb..99ccf6c38a 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/pop3/IPOP3MessageVisitor.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/pop3/IPOP3MessageVisitor.java
@@ -1,23 +1,23 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.pop3;
-
-import javax.mail.Message;
-import javax.mail.MessagingException;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-
-public interface IPOP3MessageVisitor {
- /**
- * @return true to continue visiting, false to break up further visiting
- */
- boolean visit(Message m) throws ProcessingException, MessagingException;
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.pop3;
+
+import javax.mail.Message;
+import javax.mail.MessagingException;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+
+public interface IPOP3MessageVisitor {
+ /**
+ * @return true to continue visiting, false to break up further visiting
+ */
+ boolean visit(Message m) throws ProcessingException, MessagingException;
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/pop3/POP3Adapter.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/pop3/POP3Adapter.java
index 3e2c15c391..4baa930225 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/pop3/POP3Adapter.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/pop3/POP3Adapter.java
@@ -1,316 +1,316 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.pop3;
-
-import java.io.IOException;
-import java.lang.reflect.Array;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Properties;
-
-import javax.mail.Flags;
-import javax.mail.Folder;
-import javax.mail.Message;
-import javax.mail.MessagingException;
-import javax.mail.Multipart;
-import javax.mail.Part;
-import javax.mail.PasswordAuthentication;
-import javax.mail.Session;
-import javax.mail.Store;
-
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.exception.ProcessingException;
-
-public class POP3Adapter {
-
- public static final String TRASH_FOLDER_NAME = "Trash";
- private boolean m_useSSL;
- private String m_host;
- private int m_port;
- private String m_username;
- private String m_password;
- private String m_defaultFolderName;
- private Store m_store;
- private HashMap<String, Folder> m_cachedFolders;
- private boolean m_connected = false;
-
- public POP3Adapter() {
- m_cachedFolders = new HashMap<String, Folder>();
- }
-
- public POP3Adapter(String host, int port, String username, String password) {
- this();
- m_host = host;
- m_port = port;
- m_username = username;
- m_password = password;
- }
-
- @Override
- protected void finalize() throws Throwable {
- closeConnection();
- super.finalize();
- }
-
- public String[] getUnseenMessageSubjects() throws ProcessingException {
- return getUnseenMessageSubjects(getDefaultFolderName());
- }
-
- public String[] getUnseenMessageSubjects(String folderName) throws ProcessingException {
- connect();
- ArrayList<Message> messages = new ArrayList<Message>();
- Folder folder = null;
- String[] subjects = null;
- try {
- folder = findFolder(folderName);
- if (folder != null) {
- if (!folder.isOpen()) {
- folder.open(Folder.READ_WRITE);
- }
- Message item;
- Message[] m = folder.getMessages();
- for (int i = 0; i < Array.getLength(m); i++) {
- item = m[i];
- if (!item.isSet(Flags.Flag.SEEN)) {
- messages.add(item);
- item.setFlag(Flags.Flag.DELETED, true);
-
- }
- }
- subjects = new String[messages.size()];
- Message[] messageArray = messages.toArray(new Message[messages.size()]);
- for (int i = 0; i < messages.size(); i++) {
- subjects[i] = messageArray[i].getSubject();
- }
- folder.close(true);
- }
- }
- catch (MessagingException e) {
- throw new ProcessingException(e.getMessage(), e);
- }
-
- return subjects;
- }
-
- public Message[] getUnseenMessages(final Flags.Flag markAfterRead) throws ProcessingException {
- final ArrayList<Message> list = new ArrayList<Message>();
- visitUnseenMessages(getDefaultFolderName(), new IPOP3MessageVisitor() {
- @Override
- public boolean visit(Message m) throws MessagingException {
- list.add(m);
- m.setFlag(markAfterRead, true);
- return true;
- }
- });
- return list.toArray(new Message[list.size()]);
- }
-
- public void visitUnseenMessages(String folderName, IPOP3MessageVisitor visitor) throws ProcessingException {
- connect();
- Folder folder = null;
- try {
- folder = findFolder(folderName);
- if (folder != null) {
- if (!folder.isOpen()) {
- folder.open(Folder.READ_WRITE);
- }
- int count = folder.getMessageCount();
- for (int i = 0; i < count; i++) {
- Message m = folder.getMessage(i + 1);
- if (!m.isSet(Flags.Flag.SEEN)) {
- boolean ok = visitor.visit(m);
- if (ok) {
- }
- else {
- break;
- }
- }
- }
- folder.close(true);
- }
- }
- catch (MessagingException e) {
- throw new ProcessingException("reading folder " + folderName, e);
- }
- }
-
- protected void connect() throws ProcessingException {
- try {
- final Properties props = new Properties();
- props.setProperty("mail.pop3.host", getHost());
- props.setProperty("mail.pop3.user", getUsername());
- props.setProperty("mail.pop3.password", getPassword());
- props.setProperty("mail.pop3.port", "" + getPort());
- props.setProperty("mail.pop3.auth", "" + isUseSSL());
-
- Session session = Session.getInstance(props, new javax.mail.Authenticator() {
- @Override
- protected PasswordAuthentication getPasswordAuthentication() {
- return new PasswordAuthentication(props.getProperty("mail.pop3.user"),
- props.getProperty("mail.pop3.password"));
- }
- });
-
- m_store = session.getStore("pop3");
- m_store.connect();
- }
- catch (Exception e) {
- throw new ProcessingException(e.getMessage(), e);
- }
- }
-
- protected Folder findFolder(String name) throws ProcessingException {
- return findFolder(name, false);
- }
-
- protected Folder findFolder(String name, boolean createNonExisting) throws ProcessingException {
- connect();
- Folder folder = m_cachedFolders.get(name);
- if (folder == null) {
- try {
- Folder f = m_store.getFolder(name);
- if (f.exists()) {
- folder = f;
- }
- else if (createNonExisting) {
- f.create(Folder.HOLDS_FOLDERS | Folder.HOLDS_MESSAGES);
- folder = f;
- }
- if (folder != null) {
- folder.open(Folder.READ_WRITE);
- m_cachedFolders.put(name, folder);
- }
- }
- catch (MessagingException e) {
- throw new ProcessingException("could not open folder: " + name, e);
- }
- }
- return folder;
- }
-
- public void closeConnection() throws ProcessingException {
- if (isConnected()) {
- List<MessagingException> exceptions = new ArrayList<MessagingException>();
- for (Folder folder : m_cachedFolders.values()) {
- try {
-
- folder.close(true);
- }
- catch (MessagingException e) {
- exceptions.add(e);
- }
- finally {
- try {
- folder.close(false);
- }
- catch (Throwable fatal) {
- }
- }
- }
- try {
- m_store.close();
- }
- catch (MessagingException e) {
- exceptions.add(e);
- }
- if (exceptions.size() > 0) {
- throw new ProcessingException(exceptions.get(0).getMessage());
- }
- m_cachedFolders.clear();
- m_connected = false;
- }
- }
-
- public boolean hasAttachments(Message message, boolean includingInlineAttachments) throws ProcessingException {
- connect();
- try {
- Object content = message.getContent();
- if (content instanceof Multipart) {
- Multipart multipart = (Multipart) content;
- for (int i = 0; i < multipart.getCount(); i++) {
- if (multipart.getBodyPart(i).getDisposition().equalsIgnoreCase(Part.ATTACHMENT)) {
- return true;
- }
- else if (includingInlineAttachments && multipart.getBodyPart(i).getDisposition().equalsIgnoreCase(Part.INLINE)) {
- return true;
- }
- }
- return false;
- }
- else {
- return false;
- }
- }
- catch (MessagingException me) {
- throw new ProcessingException("could not read message!", me);
- }
- catch (IOException ioe) {
- throw new ProcessingException("could not read message content!", ioe);
- }
- }
-
- public boolean isConnected() {
- return m_connected;
- }
-
- public String getDefaultFolderName() {
- return m_defaultFolderName;
- }
-
- public void setDefaultFolderName(String defaultFolderName) {
- m_defaultFolderName = defaultFolderName;
- }
-
- public String getHost() {
- return m_host;
- }
-
- public void setHost(String host) {
- m_host = host;
- }
-
- public int getPort() {
- return m_port;
- }
-
- public void setPort(int port) {
- m_port = port;
- }
-
- public String getUsername() {
- return m_username;
- }
-
- public void setUsername(String username) {
- m_username = username;
- }
-
- public String getPassword() {
- return m_password;
- }
-
- public void setPassword(String password) {
- m_password = password;
- }
-
- public boolean isUseSSL() {
- return m_useSSL;
- }
-
- public void setUseSSL(boolean useSSL) {
- m_useSSL = useSSL;
- }
-
- public void setUseSSL(String s) {
- m_useSSL = StringUtility.parseBoolean(s, true);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.pop3;
+
+import java.io.IOException;
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Properties;
+
+import javax.mail.Flags;
+import javax.mail.Folder;
+import javax.mail.Message;
+import javax.mail.MessagingException;
+import javax.mail.Multipart;
+import javax.mail.Part;
+import javax.mail.PasswordAuthentication;
+import javax.mail.Session;
+import javax.mail.Store;
+
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.exception.ProcessingException;
+
+public class POP3Adapter {
+
+ public static final String TRASH_FOLDER_NAME = "Trash";
+ private boolean m_useSSL;
+ private String m_host;
+ private int m_port;
+ private String m_username;
+ private String m_password;
+ private String m_defaultFolderName;
+ private Store m_store;
+ private HashMap<String, Folder> m_cachedFolders;
+ private boolean m_connected = false;
+
+ public POP3Adapter() {
+ m_cachedFolders = new HashMap<String, Folder>();
+ }
+
+ public POP3Adapter(String host, int port, String username, String password) {
+ this();
+ m_host = host;
+ m_port = port;
+ m_username = username;
+ m_password = password;
+ }
+
+ @Override
+ protected void finalize() throws Throwable {
+ closeConnection();
+ super.finalize();
+ }
+
+ public String[] getUnseenMessageSubjects() throws ProcessingException {
+ return getUnseenMessageSubjects(getDefaultFolderName());
+ }
+
+ public String[] getUnseenMessageSubjects(String folderName) throws ProcessingException {
+ connect();
+ ArrayList<Message> messages = new ArrayList<Message>();
+ Folder folder = null;
+ String[] subjects = null;
+ try {
+ folder = findFolder(folderName);
+ if (folder != null) {
+ if (!folder.isOpen()) {
+ folder.open(Folder.READ_WRITE);
+ }
+ Message item;
+ Message[] m = folder.getMessages();
+ for (int i = 0; i < Array.getLength(m); i++) {
+ item = m[i];
+ if (!item.isSet(Flags.Flag.SEEN)) {
+ messages.add(item);
+ item.setFlag(Flags.Flag.DELETED, true);
+
+ }
+ }
+ subjects = new String[messages.size()];
+ Message[] messageArray = messages.toArray(new Message[messages.size()]);
+ for (int i = 0; i < messages.size(); i++) {
+ subjects[i] = messageArray[i].getSubject();
+ }
+ folder.close(true);
+ }
+ }
+ catch (MessagingException e) {
+ throw new ProcessingException(e.getMessage(), e);
+ }
+
+ return subjects;
+ }
+
+ public Message[] getUnseenMessages(final Flags.Flag markAfterRead) throws ProcessingException {
+ final ArrayList<Message> list = new ArrayList<Message>();
+ visitUnseenMessages(getDefaultFolderName(), new IPOP3MessageVisitor() {
+ @Override
+ public boolean visit(Message m) throws MessagingException {
+ list.add(m);
+ m.setFlag(markAfterRead, true);
+ return true;
+ }
+ });
+ return list.toArray(new Message[list.size()]);
+ }
+
+ public void visitUnseenMessages(String folderName, IPOP3MessageVisitor visitor) throws ProcessingException {
+ connect();
+ Folder folder = null;
+ try {
+ folder = findFolder(folderName);
+ if (folder != null) {
+ if (!folder.isOpen()) {
+ folder.open(Folder.READ_WRITE);
+ }
+ int count = folder.getMessageCount();
+ for (int i = 0; i < count; i++) {
+ Message m = folder.getMessage(i + 1);
+ if (!m.isSet(Flags.Flag.SEEN)) {
+ boolean ok = visitor.visit(m);
+ if (ok) {
+ }
+ else {
+ break;
+ }
+ }
+ }
+ folder.close(true);
+ }
+ }
+ catch (MessagingException e) {
+ throw new ProcessingException("reading folder " + folderName, e);
+ }
+ }
+
+ protected void connect() throws ProcessingException {
+ try {
+ final Properties props = new Properties();
+ props.setProperty("mail.pop3.host", getHost());
+ props.setProperty("mail.pop3.user", getUsername());
+ props.setProperty("mail.pop3.password", getPassword());
+ props.setProperty("mail.pop3.port", "" + getPort());
+ props.setProperty("mail.pop3.auth", "" + isUseSSL());
+
+ Session session = Session.getInstance(props, new javax.mail.Authenticator() {
+ @Override
+ protected PasswordAuthentication getPasswordAuthentication() {
+ return new PasswordAuthentication(props.getProperty("mail.pop3.user"),
+ props.getProperty("mail.pop3.password"));
+ }
+ });
+
+ m_store = session.getStore("pop3");
+ m_store.connect();
+ }
+ catch (Exception e) {
+ throw new ProcessingException(e.getMessage(), e);
+ }
+ }
+
+ protected Folder findFolder(String name) throws ProcessingException {
+ return findFolder(name, false);
+ }
+
+ protected Folder findFolder(String name, boolean createNonExisting) throws ProcessingException {
+ connect();
+ Folder folder = m_cachedFolders.get(name);
+ if (folder == null) {
+ try {
+ Folder f = m_store.getFolder(name);
+ if (f.exists()) {
+ folder = f;
+ }
+ else if (createNonExisting) {
+ f.create(Folder.HOLDS_FOLDERS | Folder.HOLDS_MESSAGES);
+ folder = f;
+ }
+ if (folder != null) {
+ folder.open(Folder.READ_WRITE);
+ m_cachedFolders.put(name, folder);
+ }
+ }
+ catch (MessagingException e) {
+ throw new ProcessingException("could not open folder: " + name, e);
+ }
+ }
+ return folder;
+ }
+
+ public void closeConnection() throws ProcessingException {
+ if (isConnected()) {
+ List<MessagingException> exceptions = new ArrayList<MessagingException>();
+ for (Folder folder : m_cachedFolders.values()) {
+ try {
+
+ folder.close(true);
+ }
+ catch (MessagingException e) {
+ exceptions.add(e);
+ }
+ finally {
+ try {
+ folder.close(false);
+ }
+ catch (Throwable fatal) {
+ }
+ }
+ }
+ try {
+ m_store.close();
+ }
+ catch (MessagingException e) {
+ exceptions.add(e);
+ }
+ if (exceptions.size() > 0) {
+ throw new ProcessingException(exceptions.get(0).getMessage());
+ }
+ m_cachedFolders.clear();
+ m_connected = false;
+ }
+ }
+
+ public boolean hasAttachments(Message message, boolean includingInlineAttachments) throws ProcessingException {
+ connect();
+ try {
+ Object content = message.getContent();
+ if (content instanceof Multipart) {
+ Multipart multipart = (Multipart) content;
+ for (int i = 0; i < multipart.getCount(); i++) {
+ if (multipart.getBodyPart(i).getDisposition().equalsIgnoreCase(Part.ATTACHMENT)) {
+ return true;
+ }
+ else if (includingInlineAttachments && multipart.getBodyPart(i).getDisposition().equalsIgnoreCase(Part.INLINE)) {
+ return true;
+ }
+ }
+ return false;
+ }
+ else {
+ return false;
+ }
+ }
+ catch (MessagingException me) {
+ throw new ProcessingException("could not read message!", me);
+ }
+ catch (IOException ioe) {
+ throw new ProcessingException("could not read message content!", ioe);
+ }
+ }
+
+ public boolean isConnected() {
+ return m_connected;
+ }
+
+ public String getDefaultFolderName() {
+ return m_defaultFolderName;
+ }
+
+ public void setDefaultFolderName(String defaultFolderName) {
+ m_defaultFolderName = defaultFolderName;
+ }
+
+ public String getHost() {
+ return m_host;
+ }
+
+ public void setHost(String host) {
+ m_host = host;
+ }
+
+ public int getPort() {
+ return m_port;
+ }
+
+ public void setPort(int port) {
+ m_port = port;
+ }
+
+ public String getUsername() {
+ return m_username;
+ }
+
+ public void setUsername(String username) {
+ m_username = username;
+ }
+
+ public String getPassword() {
+ return m_password;
+ }
+
+ public void setPassword(String password) {
+ m_password = password;
+ }
+
+ public boolean isUseSSL() {
+ return m_useSSL;
+ }
+
+ public void setUseSSL(boolean useSSL) {
+ m_useSSL = useSSL;
+ }
+
+ public void setUseSSL(String s) {
+ m_useSSL = StringUtility.parseBoolean(s, true);
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/processing/ServerProcessingCancelService.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/processing/ServerProcessingCancelService.java
index 48834bf515..076a589040 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/processing/ServerProcessingCancelService.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/processing/ServerProcessingCancelService.java
@@ -1,25 +1,25 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.processing;
-
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.rt.server.transaction.internal.ActiveTransactionRegistry;
-import org.eclipse.scout.rt.shared.services.common.processing.IServerProcessingCancelService;
-import org.eclipse.scout.service.AbstractService;
-
-@Priority(-1)
-public class ServerProcessingCancelService extends AbstractService implements IServerProcessingCancelService {
-
- @Override
- public boolean cancel(long transcationSequence) {
- return ActiveTransactionRegistry.cancel(transcationSequence);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.processing;
+
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.rt.server.transaction.internal.ActiveTransactionRegistry;
+import org.eclipse.scout.rt.shared.services.common.processing.IServerProcessingCancelService;
+import org.eclipse.scout.service.AbstractService;
+
+@Priority(-1)
+public class ServerProcessingCancelService extends AbstractService implements IServerProcessingCancelService {
+
+ @Override
+ public boolean cancel(long transcationSequence) {
+ return ActiveTransactionRegistry.cancel(transcationSequence);
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/pwd/AbstractPasswordManagementService.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/pwd/AbstractPasswordManagementService.java
index a42c7cb7ad..e5cbc4fc6b 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/pwd/AbstractPasswordManagementService.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/pwd/AbstractPasswordManagementService.java
@@ -1,72 +1,72 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.pwd;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.shared.services.common.pwd.IPasswordManagementService;
-import org.eclipse.scout.service.AbstractService;
-
-/**
- * This is an abstract implementation of the {@link IPasswordManagementService} using a common password policy.
- * <p>
- * In order to use, register your subclass in the extension "org.eclipse.scout.rt.server.service"
- */
-public abstract class AbstractPasswordManagementService extends AbstractService implements IPasswordManagementService {
- private IPasswordPolicy m_passwordPolicy;
-
- public AbstractPasswordManagementService() {
- setPasswordPolicy(new DefaultPasswordPolicy());
- }
-
- @Override
- public void changePassword(String userId, String oldPassword, String newPassword) throws ProcessingException {
- checkAccess(userId, oldPassword);
- resetPassword(userId, newPassword);
- }
-
- @Override
- public void resetPassword(String userId, String newPassword) throws ProcessingException {
- getPasswordPolicy().check(userId, newPassword, getUsernameFor(userId), getHistoryIndexFor(userId, newPassword));
- resetPasswordInternal(userId, newPassword);
- }
-
- @Override
- public String getPasswordPolicyText() {
- return getPasswordPolicy().getText();
- }
-
- protected IPasswordPolicy getPasswordPolicy() {
- return m_passwordPolicy;
- }
-
- protected void setPasswordPolicy(IPasswordPolicy p) {
- m_passwordPolicy = p;
- }
-
- /**
- * @throws ProcessingException
- * when the userId/password is invalid
- */
- protected abstract void checkAccess(String userId, String password) throws ProcessingException;
-
- protected abstract String getUsernameFor(String userId) throws ProcessingException;
-
- /**
- * @return the previous passwords of the user
- */
- protected abstract int getHistoryIndexFor(String userId, String password) throws ProcessingException;
-
- /**
- * Reset the password, all checks and verifications have already been passed.
- */
- protected abstract void resetPasswordInternal(String userId, String newPassword) throws ProcessingException;
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.pwd;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.shared.services.common.pwd.IPasswordManagementService;
+import org.eclipse.scout.service.AbstractService;
+
+/**
+ * This is an abstract implementation of the {@link IPasswordManagementService} using a common password policy.
+ * <p>
+ * In order to use, register your subclass in the extension "org.eclipse.scout.rt.server.service"
+ */
+public abstract class AbstractPasswordManagementService extends AbstractService implements IPasswordManagementService {
+ private IPasswordPolicy m_passwordPolicy;
+
+ public AbstractPasswordManagementService() {
+ setPasswordPolicy(new DefaultPasswordPolicy());
+ }
+
+ @Override
+ public void changePassword(String userId, String oldPassword, String newPassword) throws ProcessingException {
+ checkAccess(userId, oldPassword);
+ resetPassword(userId, newPassword);
+ }
+
+ @Override
+ public void resetPassword(String userId, String newPassword) throws ProcessingException {
+ getPasswordPolicy().check(userId, newPassword, getUsernameFor(userId), getHistoryIndexFor(userId, newPassword));
+ resetPasswordInternal(userId, newPassword);
+ }
+
+ @Override
+ public String getPasswordPolicyText() {
+ return getPasswordPolicy().getText();
+ }
+
+ protected IPasswordPolicy getPasswordPolicy() {
+ return m_passwordPolicy;
+ }
+
+ protected void setPasswordPolicy(IPasswordPolicy p) {
+ m_passwordPolicy = p;
+ }
+
+ /**
+ * @throws ProcessingException
+ * when the userId/password is invalid
+ */
+ protected abstract void checkAccess(String userId, String password) throws ProcessingException;
+
+ protected abstract String getUsernameFor(String userId) throws ProcessingException;
+
+ /**
+ * @return the previous passwords of the user
+ */
+ protected abstract int getHistoryIndexFor(String userId, String password) throws ProcessingException;
+
+ /**
+ * Reset the password, all checks and verifications have already been passed.
+ */
+ protected abstract void resetPasswordInternal(String userId, String newPassword) throws ProcessingException;
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/pwd/DefaultPasswordPolicy.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/pwd/DefaultPasswordPolicy.java
index 7231698736..8d386680e5 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/pwd/DefaultPasswordPolicy.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/pwd/DefaultPasswordPolicy.java
@@ -1,59 +1,59 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.pwd;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.exception.VetoException;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-
-/**
- * Title: BSI Scout V3 Copyright:
- * Copyright (c) 2001,2009 BSI AG
- *
- * @version 3.x
- */
-
-public class DefaultPasswordPolicy implements IPasswordPolicy {
-
- private static final int MIN_PASSWORD_LENGTH = 8;
-
- @Override
- public String getText() {
- return ScoutTexts.get("DefaultPasswordPolicyText");
- }
-
- @Override
- @SuppressWarnings("null")
- public void check(String userId, String newPassword, String userName, int historyIndex) throws ProcessingException {
- if (newPassword == null || newPassword.length() < MIN_PASSWORD_LENGTH) {
- throwFailure("PasswordMin8Chars");
- }
- if (!newPassword.matches(".*[0-9]+.*")) {
- throwFailure("PasswordMinOneDigit");
- }
- if (!newPassword.matches(".*[[a-z]|[A-Z]]+.*")) {
- throwFailure("PasswordMinOneChar");
- }
- if (!newPassword.matches(".*[!|@|#|\\$|%|\\^|&|\\*|\\(|\\)|_|\\+|\\||~|\\-|=|\\\\|`|\\{|\\}|\\[|\\]|:|\"|;|'|<|>|?|,|.|/]+.*")) {
- throwFailure("PasswordMinOnNonStdChar");
- }
- if (userName != null && newPassword.toUpperCase().indexOf(userName.toUpperCase()) >= 0) {
- throwFailure("PasswordUsernameNotPartOfPass");
- }
- if (historyIndex >= 0) {
- throwFailure("PasswordNotSameAsLasts");
- }
- }
-
- protected void throwFailure(String msgId) throws ProcessingException {
- throw new VetoException(ScoutTexts.get(msgId));
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.pwd;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.exception.VetoException;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+
+/**
+ * Title: BSI Scout V3 Copyright:
+ * Copyright (c) 2001,2009 BSI AG
+ *
+ * @version 3.x
+ */
+
+public class DefaultPasswordPolicy implements IPasswordPolicy {
+
+ private static final int MIN_PASSWORD_LENGTH = 8;
+
+ @Override
+ public String getText() {
+ return ScoutTexts.get("DefaultPasswordPolicyText");
+ }
+
+ @Override
+ @SuppressWarnings("null")
+ public void check(String userId, String newPassword, String userName, int historyIndex) throws ProcessingException {
+ if (newPassword == null || newPassword.length() < MIN_PASSWORD_LENGTH) {
+ throwFailure("PasswordMin8Chars");
+ }
+ if (!newPassword.matches(".*[0-9]+.*")) {
+ throwFailure("PasswordMinOneDigit");
+ }
+ if (!newPassword.matches(".*[[a-z]|[A-Z]]+.*")) {
+ throwFailure("PasswordMinOneChar");
+ }
+ if (!newPassword.matches(".*[!|@|#|\\$|%|\\^|&|\\*|\\(|\\)|_|\\+|\\||~|\\-|=|\\\\|`|\\{|\\}|\\[|\\]|:|\"|;|'|<|>|?|,|.|/]+.*")) {
+ throwFailure("PasswordMinOnNonStdChar");
+ }
+ if (userName != null && newPassword.toUpperCase().indexOf(userName.toUpperCase()) >= 0) {
+ throwFailure("PasswordUsernameNotPartOfPass");
+ }
+ if (historyIndex >= 0) {
+ throwFailure("PasswordNotSameAsLasts");
+ }
+ }
+
+ protected void throwFailure(String msgId) throws ProcessingException {
+ throw new VetoException(ScoutTexts.get(msgId));
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/pwd/IPasswordPolicy.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/pwd/IPasswordPolicy.java
index 27fd92f17b..13aad1e2ef 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/pwd/IPasswordPolicy.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/pwd/IPasswordPolicy.java
@@ -1,40 +1,40 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.pwd;
-
-import org.eclipse.scout.commons.LocaleThreadLocal;
-import org.eclipse.scout.commons.exception.ProcessingException;
-
-/**
- * Title: BSI Scout V3 Copyright:
- * Copyright (c) 2001,2009 BSI AG
- *
- * @version 3.x
- */
-
-public interface IPasswordPolicy {
-
- /**
- * @return a localized text that describes the policy to the user use {@link LocaleThreadLocal#get()} to access the
- * language for user
- * messages
- */
- String getText();
-
- /**
- * @param historyIndex
- * the index where in the history newPassword was used recently or -1
- * @throws ProcessingException
- * when newPassword does not conform to this policy
- */
- void check(String userId, String newPassword, String userName, int historyIndex) throws ProcessingException;
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.pwd;
+
+import org.eclipse.scout.commons.LocaleThreadLocal;
+import org.eclipse.scout.commons.exception.ProcessingException;
+
+/**
+ * Title: BSI Scout V3 Copyright:
+ * Copyright (c) 2001,2009 BSI AG
+ *
+ * @version 3.x
+ */
+
+public interface IPasswordPolicy {
+
+ /**
+ * @return a localized text that describes the policy to the user use {@link LocaleThreadLocal#get()} to access the
+ * language for user
+ * messages
+ */
+ String getText();
+
+ /**
+ * @param historyIndex
+ * the index where in the history newPassword was used recently or -1
+ * @throws ProcessingException
+ * when newPassword does not conform to this policy
+ */
+ void check(String userId, String newPassword, String userName, int historyIndex) throws ProcessingException;
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/security/AbstractAccessControlService.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/security/AbstractAccessControlService.java
index b57305594b..0dbd269388 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/security/AbstractAccessControlService.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/security/AbstractAccessControlService.java
@@ -1,270 +1,270 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.security;
-
-import java.lang.reflect.Method;
-import java.security.AccessController;
-import java.security.AllPermission;
-import java.security.Permission;
-import java.security.Permissions;
-import java.security.Principal;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import javax.security.auth.Subject;
-
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.server.services.common.security.internal.AccessControlStore;
-import org.eclipse.scout.rt.shared.security.BasicHierarchyPermission;
-import org.eclipse.scout.rt.shared.security.RemoteServiceAccessPermission;
-import org.eclipse.scout.rt.shared.services.common.ping.IPingService;
-import org.eclipse.scout.rt.shared.services.common.security.IAccessControlService;
-import org.eclipse.scout.service.AbstractService;
-import org.eclipse.scout.service.SERVICES;
-
-/**
- * Implementations should override {@link #execLoadPermissions()}
- */
-@Priority(-1)
-public class AbstractAccessControlService extends AbstractService implements IAccessControlService {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractAccessControlService.class);
-
- private AccessControlStore m_accessControlStore;
- private Pattern[] m_userIdSearchPatterns;
-
- public AbstractAccessControlService() {
- m_userIdSearchPatterns = new Pattern[]{
- Pattern.compile(".*\\\\([^/@]+)"),
- Pattern.compile(".*\\\\([^/@]+)[/@].*"),
- Pattern.compile("([^/@]+)"),
- Pattern.compile("([^/@]+)[/@].*"),
- };
- }
-
- /**
- * see {@link #setUserIdSearchPatterns(Pattern...)}
- */
- protected Pattern[] getUserIdSearchPatterns() {
- return m_userIdSearchPatterns;
- }
-
- /**
- * see {@link #setUserIdSearchPatterns(Pattern...)}
- */
- protected void setUserIdSearchPatterns(Pattern... patterns) {
- m_userIdSearchPatterns = patterns;
- }
-
- /**
- * Set the pattern by which the userId is searched for in the list of jaas
- * principal names.<br>
- * The first group of the pattern is assumed to be the username.<br>
- * By default the following patterns are applied in this order:
- * <ul>
- * <li>".*\\\\([^/@]+)" matching "DOMAIN\\user" to "user"
- * <li>".*\\\\([^/@]+)[/@].*" matching "DOMAIN\\user@domain.com" to "user"
- * <li>"([^/@]+)" matching "user" to "user"
- * <li>"([^/@]+)[/@].*" matching "user@domain.com" to "user"
- * </ul>
- */
- protected void setUserIdSearchPatterns(String... patterns) {
- Pattern[] a = new Pattern[patterns.length];
- for (int i = 0; i < a.length; i++) {
- a[i] = Pattern.compile(patterns[i]);
- }
- setUserIdSearchPatterns(a);
- }
-
- @Override
- public String getUserIdOfCurrentSubject() {
- Subject s = Subject.getSubject(AccessController.getContext());
- if (s == null) {
- return null;
- }
- if (m_userIdSearchPatterns == null) {
- return null;
- }
- for (Principal p : s.getPrincipals()) {
- String name = p.getName().toLowerCase();
- for (Pattern pat : m_userIdSearchPatterns) {
- Matcher m = pat.matcher(name);
- if (m.matches()) {
- return m.group(1);
- }
- }
- }
- return null;
- }
-
- @SuppressWarnings("deprecation")
- @Override
- public void initializeService() {
- m_accessControlStore = new AccessControlStore();
- super.initializeService();
- }
-
- @Override
- public boolean checkPermission(Permission p) {
- if (p == null) {
- return true;
- }
- Permissions c = getPermissions();
- if (c == null) {
- return true;
- }
- else {
- return c.implies(p);
- }
- }
-
- @Override
- public int getPermissionLevel(Permission p) {
- if (p == null) {
- return BasicHierarchyPermission.LEVEL_NONE;
- }
- if (!(p instanceof BasicHierarchyPermission)) {
- if (checkPermission(p)) {
- return BasicHierarchyPermission.LEVEL_ALL;
- }
- else {
- return BasicHierarchyPermission.LEVEL_NONE;
- }
- }
- BasicHierarchyPermission hp = (BasicHierarchyPermission) p;
- Permissions c = getPermissions();
- if (c == null) {
- List<Integer> levels = hp.getValidLevels();
- return levels.get(levels.size() - 1);
- }
- else {
- int maxLevel = BasicHierarchyPermission.LEVEL_UNDEFINED;
- Enumeration<Permission> en = c.elements();
- while (en.hasMoreElements()) {
- Permission grantedPermission = en.nextElement();
-
- // catch AllPermission
- if (grantedPermission instanceof AllPermission) {
- return BasicHierarchyPermission.LEVEL_ALL;
- }
-
- // process basic hierarchy permissions
- if (grantedPermission instanceof BasicHierarchyPermission) {
- BasicHierarchyPermission hgrantedPermission = (BasicHierarchyPermission) grantedPermission;
- if (hgrantedPermission.getClass().isAssignableFrom(hp.getClass())) {
- maxLevel = Math.max(maxLevel, hgrantedPermission.getLevel());
- if (maxLevel >= BasicHierarchyPermission.LEVEL_ALL) {
- break;
- }
- }
- }
- }
- return maxLevel;
- }
- }
-
- @Override
- public Permissions getPermissions() {
- Permissions permSet = m_accessControlStore.getPermissionsOfCurrentSubject();
-
- if (permSet != null) {
- return permSet;
- }
-
- setPermissions(execLoadPermissions());
- permSet = m_accessControlStore.getPermissionsOfCurrentSubject();
-
- return permSet;
- }
-
- /**
- * This default implementation does nothing
- * Override this method to retrieve permissions from a custom store
- */
- protected Permissions execLoadPermissions() {
- return null;
- }
-
- private void setPermissions(Permissions p) {
- //legacy support: if there are no remote service permissions available, warn and add default rule to allow shared interfaces
- //to support legacy functionality, this default also accepts other so far valid requests but generates a warning.
- //a future release will throw a {@link SecurityException} when no permission is granted.
- if (p != null) {
- if (!p.implies(new RemoteServiceAccessPermission(IPingService.class.getName(), "ping"))) {
- boolean existsAny = false;
- for (Enumeration<Permission> en = p.elements(); en.hasMoreElements();) {
- Permission perm = en.nextElement();
- if (perm instanceof RemoteServiceAccessPermission) {
- existsAny = true;
- break;
- }
- }
- if (!existsAny) {
- LOG.warn("Legacy security hint: missing any RemoteServiceAccessPermissions in AccessController. Please verify the " + SERVICES.getService(IAccessControlService.class).getClass() + " to include such permissions for accessing services using client proxies. Adding default rule to allow services of pattern '*.shared.*'");
- p.add(new RemoteServiceAccessPermission("*.shared.*", "*"));
- }
- }
- }
- //end legacy
- m_accessControlStore.setPermissionsOfCurrentSubject(p);
- }
-
- @Override
- public boolean isProxyService() {
- return false;
- }
-
- @Override
- public void clearCache() {
- m_accessControlStore.clearCache();
- }
-
- /**
- * @deprecated Use {@link #clearCacheOfUserIds(String...)} instead
- */
- @SuppressWarnings("deprecation")
- @Override
- @Deprecated
- public void clearCacheOfPrincipals(String... userIds) {
- clearCacheOfUserIds(userIds);
- }
-
- @Override
- public void clearCacheOfUserIds(String... userIds) {
- if (userIds == null || userIds.length == 0) {
- return;
- }
- String[] users = m_accessControlStore.getUserIds();
- ArrayList<String> toDelete = new ArrayList<String>();
- for (String name : userIds) {
- if (name != null) {
- name = name.toLowerCase();
- for (String p : users) {
- if (p.equals(name)) {
- toDelete.add(p);
- break;
- }
- }
- }
- }
- m_accessControlStore.clearCacheOfUserIds(toDelete.toArray(new String[toDelete.size()]));
- }
-
- @SuppressWarnings("deprecation")
- @Override
- public boolean checkServiceTunnelAccess(Class serviceInterfaceClass, Method method, Object[] args) {
- return false;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.security;
+
+import java.lang.reflect.Method;
+import java.security.AccessController;
+import java.security.AllPermission;
+import java.security.Permission;
+import java.security.Permissions;
+import java.security.Principal;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.security.auth.Subject;
+
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.server.services.common.security.internal.AccessControlStore;
+import org.eclipse.scout.rt.shared.security.BasicHierarchyPermission;
+import org.eclipse.scout.rt.shared.security.RemoteServiceAccessPermission;
+import org.eclipse.scout.rt.shared.services.common.ping.IPingService;
+import org.eclipse.scout.rt.shared.services.common.security.IAccessControlService;
+import org.eclipse.scout.service.AbstractService;
+import org.eclipse.scout.service.SERVICES;
+
+/**
+ * Implementations should override {@link #execLoadPermissions()}
+ */
+@Priority(-1)
+public class AbstractAccessControlService extends AbstractService implements IAccessControlService {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractAccessControlService.class);
+
+ private AccessControlStore m_accessControlStore;
+ private Pattern[] m_userIdSearchPatterns;
+
+ public AbstractAccessControlService() {
+ m_userIdSearchPatterns = new Pattern[]{
+ Pattern.compile(".*\\\\([^/@]+)"),
+ Pattern.compile(".*\\\\([^/@]+)[/@].*"),
+ Pattern.compile("([^/@]+)"),
+ Pattern.compile("([^/@]+)[/@].*"),
+ };
+ }
+
+ /**
+ * see {@link #setUserIdSearchPatterns(Pattern...)}
+ */
+ protected Pattern[] getUserIdSearchPatterns() {
+ return m_userIdSearchPatterns;
+ }
+
+ /**
+ * see {@link #setUserIdSearchPatterns(Pattern...)}
+ */
+ protected void setUserIdSearchPatterns(Pattern... patterns) {
+ m_userIdSearchPatterns = patterns;
+ }
+
+ /**
+ * Set the pattern by which the userId is searched for in the list of jaas
+ * principal names.<br>
+ * The first group of the pattern is assumed to be the username.<br>
+ * By default the following patterns are applied in this order:
+ * <ul>
+ * <li>".*\\\\([^/@]+)" matching "DOMAIN\\user" to "user"
+ * <li>".*\\\\([^/@]+)[/@].*" matching "DOMAIN\\user@domain.com" to "user"
+ * <li>"([^/@]+)" matching "user" to "user"
+ * <li>"([^/@]+)[/@].*" matching "user@domain.com" to "user"
+ * </ul>
+ */
+ protected void setUserIdSearchPatterns(String... patterns) {
+ Pattern[] a = new Pattern[patterns.length];
+ for (int i = 0; i < a.length; i++) {
+ a[i] = Pattern.compile(patterns[i]);
+ }
+ setUserIdSearchPatterns(a);
+ }
+
+ @Override
+ public String getUserIdOfCurrentSubject() {
+ Subject s = Subject.getSubject(AccessController.getContext());
+ if (s == null) {
+ return null;
+ }
+ if (m_userIdSearchPatterns == null) {
+ return null;
+ }
+ for (Principal p : s.getPrincipals()) {
+ String name = p.getName().toLowerCase();
+ for (Pattern pat : m_userIdSearchPatterns) {
+ Matcher m = pat.matcher(name);
+ if (m.matches()) {
+ return m.group(1);
+ }
+ }
+ }
+ return null;
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public void initializeService() {
+ m_accessControlStore = new AccessControlStore();
+ super.initializeService();
+ }
+
+ @Override
+ public boolean checkPermission(Permission p) {
+ if (p == null) {
+ return true;
+ }
+ Permissions c = getPermissions();
+ if (c == null) {
+ return true;
+ }
+ else {
+ return c.implies(p);
+ }
+ }
+
+ @Override
+ public int getPermissionLevel(Permission p) {
+ if (p == null) {
+ return BasicHierarchyPermission.LEVEL_NONE;
+ }
+ if (!(p instanceof BasicHierarchyPermission)) {
+ if (checkPermission(p)) {
+ return BasicHierarchyPermission.LEVEL_ALL;
+ }
+ else {
+ return BasicHierarchyPermission.LEVEL_NONE;
+ }
+ }
+ BasicHierarchyPermission hp = (BasicHierarchyPermission) p;
+ Permissions c = getPermissions();
+ if (c == null) {
+ List<Integer> levels = hp.getValidLevels();
+ return levels.get(levels.size() - 1);
+ }
+ else {
+ int maxLevel = BasicHierarchyPermission.LEVEL_UNDEFINED;
+ Enumeration<Permission> en = c.elements();
+ while (en.hasMoreElements()) {
+ Permission grantedPermission = en.nextElement();
+
+ // catch AllPermission
+ if (grantedPermission instanceof AllPermission) {
+ return BasicHierarchyPermission.LEVEL_ALL;
+ }
+
+ // process basic hierarchy permissions
+ if (grantedPermission instanceof BasicHierarchyPermission) {
+ BasicHierarchyPermission hgrantedPermission = (BasicHierarchyPermission) grantedPermission;
+ if (hgrantedPermission.getClass().isAssignableFrom(hp.getClass())) {
+ maxLevel = Math.max(maxLevel, hgrantedPermission.getLevel());
+ if (maxLevel >= BasicHierarchyPermission.LEVEL_ALL) {
+ break;
+ }
+ }
+ }
+ }
+ return maxLevel;
+ }
+ }
+
+ @Override
+ public Permissions getPermissions() {
+ Permissions permSet = m_accessControlStore.getPermissionsOfCurrentSubject();
+
+ if (permSet != null) {
+ return permSet;
+ }
+
+ setPermissions(execLoadPermissions());
+ permSet = m_accessControlStore.getPermissionsOfCurrentSubject();
+
+ return permSet;
+ }
+
+ /**
+ * This default implementation does nothing
+ * Override this method to retrieve permissions from a custom store
+ */
+ protected Permissions execLoadPermissions() {
+ return null;
+ }
+
+ private void setPermissions(Permissions p) {
+ //legacy support: if there are no remote service permissions available, warn and add default rule to allow shared interfaces
+ //to support legacy functionality, this default also accepts other so far valid requests but generates a warning.
+ //a future release will throw a {@link SecurityException} when no permission is granted.
+ if (p != null) {
+ if (!p.implies(new RemoteServiceAccessPermission(IPingService.class.getName(), "ping"))) {
+ boolean existsAny = false;
+ for (Enumeration<Permission> en = p.elements(); en.hasMoreElements();) {
+ Permission perm = en.nextElement();
+ if (perm instanceof RemoteServiceAccessPermission) {
+ existsAny = true;
+ break;
+ }
+ }
+ if (!existsAny) {
+ LOG.warn("Legacy security hint: missing any RemoteServiceAccessPermissions in AccessController. Please verify the " + SERVICES.getService(IAccessControlService.class).getClass() + " to include such permissions for accessing services using client proxies. Adding default rule to allow services of pattern '*.shared.*'");
+ p.add(new RemoteServiceAccessPermission("*.shared.*", "*"));
+ }
+ }
+ }
+ //end legacy
+ m_accessControlStore.setPermissionsOfCurrentSubject(p);
+ }
+
+ @Override
+ public boolean isProxyService() {
+ return false;
+ }
+
+ @Override
+ public void clearCache() {
+ m_accessControlStore.clearCache();
+ }
+
+ /**
+ * @deprecated Use {@link #clearCacheOfUserIds(String...)} instead
+ */
+ @SuppressWarnings("deprecation")
+ @Override
+ @Deprecated
+ public void clearCacheOfPrincipals(String... userIds) {
+ clearCacheOfUserIds(userIds);
+ }
+
+ @Override
+ public void clearCacheOfUserIds(String... userIds) {
+ if (userIds == null || userIds.length == 0) {
+ return;
+ }
+ String[] users = m_accessControlStore.getUserIds();
+ ArrayList<String> toDelete = new ArrayList<String>();
+ for (String name : userIds) {
+ if (name != null) {
+ name = name.toLowerCase();
+ for (String p : users) {
+ if (p.equals(name)) {
+ toDelete.add(p);
+ break;
+ }
+ }
+ }
+ }
+ m_accessControlStore.clearCacheOfUserIds(toDelete.toArray(new String[toDelete.size()]));
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public boolean checkServiceTunnelAccess(Class serviceInterfaceClass, Method method, Object[] args) {
+ return false;
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/security/LogoutService.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/security/LogoutService.java
index 4004374ee0..7716d6fd18 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/security/LogoutService.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/security/LogoutService.java
@@ -1,42 +1,42 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.security;
-
-import javax.servlet.http.HttpSession;
-
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.server.ThreadContext;
-import org.eclipse.scout.rt.shared.services.common.security.ILogoutService;
-import org.eclipse.scout.service.AbstractService;
-
-@Priority(-1)
-public class LogoutService extends AbstractService implements ILogoutService {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(LogoutService.class);
-
- public LogoutService() {
- }
-
- @Override
- public void logout() {
- try {
- HttpSession session = ThreadContext.getHttpServletRequest().getSession();
- session.invalidate();
- }
- catch (IllegalStateException e) {
- //already invalid
- }
- catch (Throwable t) {
- LOG.warn("Session logout failed");
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.security;
+
+import javax.servlet.http.HttpSession;
+
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.server.ThreadContext;
+import org.eclipse.scout.rt.shared.services.common.security.ILogoutService;
+import org.eclipse.scout.service.AbstractService;
+
+@Priority(-1)
+public class LogoutService extends AbstractService implements ILogoutService {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(LogoutService.class);
+
+ public LogoutService() {
+ }
+
+ @Override
+ public void logout() {
+ try {
+ HttpSession session = ThreadContext.getHttpServletRequest().getSession();
+ session.invalidate();
+ }
+ catch (IllegalStateException e) {
+ //already invalid
+ }
+ catch (Throwable t) {
+ LOG.warn("Session logout failed");
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/security/PermissionService.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/security/PermissionService.java
index dc052ca540..aa2257066e 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/security/PermissionService.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/security/PermissionService.java
@@ -1,100 +1,100 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.security;
-
-import java.lang.reflect.Modifier;
-import java.security.Permission;
-import java.util.HashSet;
-
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.commons.osgi.BundleClassDescriptor;
-import org.eclipse.scout.commons.runtime.BundleBrowser;
-import org.eclipse.scout.rt.server.internal.Activator;
-import org.eclipse.scout.rt.shared.services.common.security.IPermissionService;
-import org.eclipse.scout.service.AbstractService;
-import org.osgi.framework.Bundle;
-
-/**
- * delegates to {@link PermissionStore}
- */
-@Priority(-1)
-public class PermissionService extends AbstractService implements IPermissionService {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(PermissionService.class);
-
- private Object m_permissionClassesLock = new Object();
- private BundleClassDescriptor[] m_permissionClasses;
-
- public PermissionService() {
- }
-
- @Override
- public BundleClassDescriptor[] getAllPermissionClasses() {
- checkCache();
- return m_permissionClasses;
- }
-
- private void checkCache() {
- synchronized (m_permissionClassesLock) {
- // null-check with lock (valid check)
- if (m_permissionClasses == null) {
- HashSet<BundleClassDescriptor> discoveredPermissions = new HashSet<BundleClassDescriptor>();
- for (Bundle bundle : Activator.getDefault().getBundle().getBundleContext().getBundles()) {
- String[] classNames = null;
- try {
- BundleBrowser bundleBrowser = new BundleBrowser(bundle.getSymbolicName(), bundle.getSymbolicName());
- classNames = bundleBrowser.getClasses(false, true);
- }
- catch (Exception e1) {
- LOG.warn(null, e1);
- }
- if (classNames != null) {
- // filter
- for (String className : classNames) {
- // fast pre-check
- if (isCandidate(className)) {
- try {
- Class c = null;
- c = bundle.loadClass(className);
- if (Permission.class.isAssignableFrom(c)) {
- if (!c.isInterface()) {
- int flags = c.getModifiers();
- if (Modifier.isPublic(flags) && !Modifier.isAbstract(flags)) {
- discoveredPermissions.add(new BundleClassDescriptor(bundle.getSymbolicName(), c.getName()));
- }
- }
- }
- }
- catch (Throwable t) {
- }
- }
- }
- }
- }
- m_permissionClasses = discoveredPermissions.toArray(new BundleClassDescriptor[discoveredPermissions.size()]);
- }
- }
- }
-
- /**
- * Checks whether the given class name is a potential permission class. This default implementation checks whether the
- * class name contains <em>Permission</em> and that the class's package path contains an segment called
- * <em>security</em>.
- *
- * @param className
- * The class name to check.
- * @return Returns <code>true</code> if the given class looks like a permission. Otherwise <code>false</code>.
- */
- protected boolean isCandidate(String className) {
- return className.indexOf("Permission") >= 0 && className.indexOf(".security.") >= 0;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.security;
+
+import java.lang.reflect.Modifier;
+import java.security.Permission;
+import java.util.HashSet;
+
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.commons.osgi.BundleClassDescriptor;
+import org.eclipse.scout.commons.runtime.BundleBrowser;
+import org.eclipse.scout.rt.server.internal.Activator;
+import org.eclipse.scout.rt.shared.services.common.security.IPermissionService;
+import org.eclipse.scout.service.AbstractService;
+import org.osgi.framework.Bundle;
+
+/**
+ * delegates to {@link PermissionStore}
+ */
+@Priority(-1)
+public class PermissionService extends AbstractService implements IPermissionService {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(PermissionService.class);
+
+ private Object m_permissionClassesLock = new Object();
+ private BundleClassDescriptor[] m_permissionClasses;
+
+ public PermissionService() {
+ }
+
+ @Override
+ public BundleClassDescriptor[] getAllPermissionClasses() {
+ checkCache();
+ return m_permissionClasses;
+ }
+
+ private void checkCache() {
+ synchronized (m_permissionClassesLock) {
+ // null-check with lock (valid check)
+ if (m_permissionClasses == null) {
+ HashSet<BundleClassDescriptor> discoveredPermissions = new HashSet<BundleClassDescriptor>();
+ for (Bundle bundle : Activator.getDefault().getBundle().getBundleContext().getBundles()) {
+ String[] classNames = null;
+ try {
+ BundleBrowser bundleBrowser = new BundleBrowser(bundle.getSymbolicName(), bundle.getSymbolicName());
+ classNames = bundleBrowser.getClasses(false, true);
+ }
+ catch (Exception e1) {
+ LOG.warn(null, e1);
+ }
+ if (classNames != null) {
+ // filter
+ for (String className : classNames) {
+ // fast pre-check
+ if (isCandidate(className)) {
+ try {
+ Class c = null;
+ c = bundle.loadClass(className);
+ if (Permission.class.isAssignableFrom(c)) {
+ if (!c.isInterface()) {
+ int flags = c.getModifiers();
+ if (Modifier.isPublic(flags) && !Modifier.isAbstract(flags)) {
+ discoveredPermissions.add(new BundleClassDescriptor(bundle.getSymbolicName(), c.getName()));
+ }
+ }
+ }
+ }
+ catch (Throwable t) {
+ }
+ }
+ }
+ }
+ }
+ m_permissionClasses = discoveredPermissions.toArray(new BundleClassDescriptor[discoveredPermissions.size()]);
+ }
+ }
+ }
+
+ /**
+ * Checks whether the given class name is a potential permission class. This default implementation checks whether the
+ * class name contains <em>Permission</em> and that the class's package path contains an segment called
+ * <em>security</em>.
+ *
+ * @param className
+ * The class name to check.
+ * @return Returns <code>true</code> if the given class looks like a permission. Otherwise <code>false</code>.
+ */
+ protected boolean isCandidate(String className) {
+ return className.indexOf("Permission") >= 0 && className.indexOf(".security.") >= 0;
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/security/internal/AccessControlStore.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/security/internal/AccessControlStore.java
index 97a098f070..8d12235a9a 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/security/internal/AccessControlStore.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/security/internal/AccessControlStore.java
@@ -1,152 +1,152 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.security.internal;
-
-import java.security.Permissions;
-
-import org.eclipse.scout.commons.TTLCache;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.server.services.common.clientnotification.IClientNotificationService;
-import org.eclipse.scout.rt.server.services.common.clientnotification.SingleUserFilter;
-import org.eclipse.scout.rt.shared.services.common.security.AccessControlChangedNotification;
-import org.eclipse.scout.rt.shared.services.common.security.IAccessControlService;
-import org.eclipse.scout.rt.shared.services.common.security.ResetAccessControlChangedNotification;
-import org.eclipse.scout.service.SERVICES;
-
-/**
- * <p>
- * {@link Permissions} store per userId
- * </p>
- * <p>
- * Maintains a map of one {@link Permissions} object per userId (derived from their Subject, see
- * {@link IAccessControlService#getUserIdOfCurrentSubject()}).
- * </p>
- * <p>
- * The userId is case insensitive, case does not matter.
- * </p>
- */
-public class AccessControlStore {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AccessControlStore.class);
-
- /**
- * the internal store, the {@link String} used as key is always lower case
- */
- private TTLCache<String/* userId */, Permissions> m_store;
- private Object m_storeLock;
-
- public AccessControlStore() {
- m_storeLock = new Object();
- m_store = new TTLCache<String, Permissions>(3600000L);
- }
-
- /**
- * @return the permission collection that is associated with the current subject
- */
- public Permissions getPermissionsOfCurrentSubject() {
- String userId = SERVICES.getService(IAccessControlService.class).getUserIdOfCurrentSubject();
- if (userId == null) {
- return null;
- }
- return getPermissions(userId);
- }
-
- /**
- * sets permission collection that is associated with the current subject
- *
- * @param p
- * permission collection
- */
- public void setPermissionsOfCurrentSubject(Permissions p) {
- String userId = SERVICES.getService(IAccessControlService.class).getUserIdOfCurrentSubject();
- if (userId == null) {
- throw new SecurityException("userId is null");
- }
- setPermissions(userId, p);
- }
-
- /**
- * @param userId
- * of Subject
- * @return the permission collection that is associated with this userId, <code>null</code> if the parameter is
- * <code>null</code>
- */
- public Permissions getPermissions(String userId) {
- if (userId == null) {
- return null;
- }
- synchronized (m_storeLock) {
- return m_store.get(userId.toLowerCase());
- }
- }
-
- /**
- * associate a permission collection with this userId
- *
- * @param userId
- * if userId is <code>null</code> the method does nothing
- */
- public void setPermissions(String userId, Permissions p) {
- if (userId == null) {
- return;
- }
- synchronized (m_storeLock) {
- if (p == null) {
- p = new Permissions();
- p.setReadOnly();
- }
- m_store.put(userId.toLowerCase(), p);
- }
- // notify clients
- SERVICES.getService(IClientNotificationService.class).putNotification(new AccessControlChangedNotification(p), new SingleUserFilter(userId, 120000L));
- }
-
- /**
- * clears the cache
- */
- public void clearCache() {
- String[] userIds;
- synchronized (m_storeLock) {
- userIds = m_store.keySet().toArray(new String[m_store.size()]);
- }
- // notify with a filter, that will be accepted nowhere
- SERVICES.getService(IClientNotificationService.class).putNotification(new ResetAccessControlChangedNotification(), new SingleUserFilter(null, 0L));
- clearCacheOfUserIds(userIds);
- }
-
- /**
- * clears the cache for a set of userIds
- *
- * @param userIds
- * derived from the Subject, see{@link IAccessControlService#getUserIdOfCurrentSubject()}
- */
- public void clearCacheOfUserIds(String... userIds) {
- synchronized (m_storeLock) {
- for (String userId : userIds) {
- if (userId != null) {
- m_store.remove(userId.toLowerCase());
- }
- }
- }
- //notify clients
- for (String userId : userIds) {
- if (userId != null) {
- SERVICES.getService(IClientNotificationService.class).putNotification(new AccessControlChangedNotification(null), new SingleUserFilter(userId, 120000L));
- }
- }
- }
-
- public String[] getUserIds() {
- synchronized (m_storeLock) {
- return m_store.keySet().toArray(new String[m_store.keySet().size()]);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.security.internal;
+
+import java.security.Permissions;
+
+import org.eclipse.scout.commons.TTLCache;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.server.services.common.clientnotification.IClientNotificationService;
+import org.eclipse.scout.rt.server.services.common.clientnotification.SingleUserFilter;
+import org.eclipse.scout.rt.shared.services.common.security.AccessControlChangedNotification;
+import org.eclipse.scout.rt.shared.services.common.security.IAccessControlService;
+import org.eclipse.scout.rt.shared.services.common.security.ResetAccessControlChangedNotification;
+import org.eclipse.scout.service.SERVICES;
+
+/**
+ * <p>
+ * {@link Permissions} store per userId
+ * </p>
+ * <p>
+ * Maintains a map of one {@link Permissions} object per userId (derived from their Subject, see
+ * {@link IAccessControlService#getUserIdOfCurrentSubject()}).
+ * </p>
+ * <p>
+ * The userId is case insensitive, case does not matter.
+ * </p>
+ */
+public class AccessControlStore {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AccessControlStore.class);
+
+ /**
+ * the internal store, the {@link String} used as key is always lower case
+ */
+ private TTLCache<String/* userId */, Permissions> m_store;
+ private Object m_storeLock;
+
+ public AccessControlStore() {
+ m_storeLock = new Object();
+ m_store = new TTLCache<String, Permissions>(3600000L);
+ }
+
+ /**
+ * @return the permission collection that is associated with the current subject
+ */
+ public Permissions getPermissionsOfCurrentSubject() {
+ String userId = SERVICES.getService(IAccessControlService.class).getUserIdOfCurrentSubject();
+ if (userId == null) {
+ return null;
+ }
+ return getPermissions(userId);
+ }
+
+ /**
+ * sets permission collection that is associated with the current subject
+ *
+ * @param p
+ * permission collection
+ */
+ public void setPermissionsOfCurrentSubject(Permissions p) {
+ String userId = SERVICES.getService(IAccessControlService.class).getUserIdOfCurrentSubject();
+ if (userId == null) {
+ throw new SecurityException("userId is null");
+ }
+ setPermissions(userId, p);
+ }
+
+ /**
+ * @param userId
+ * of Subject
+ * @return the permission collection that is associated with this userId, <code>null</code> if the parameter is
+ * <code>null</code>
+ */
+ public Permissions getPermissions(String userId) {
+ if (userId == null) {
+ return null;
+ }
+ synchronized (m_storeLock) {
+ return m_store.get(userId.toLowerCase());
+ }
+ }
+
+ /**
+ * associate a permission collection with this userId
+ *
+ * @param userId
+ * if userId is <code>null</code> the method does nothing
+ */
+ public void setPermissions(String userId, Permissions p) {
+ if (userId == null) {
+ return;
+ }
+ synchronized (m_storeLock) {
+ if (p == null) {
+ p = new Permissions();
+ p.setReadOnly();
+ }
+ m_store.put(userId.toLowerCase(), p);
+ }
+ // notify clients
+ SERVICES.getService(IClientNotificationService.class).putNotification(new AccessControlChangedNotification(p), new SingleUserFilter(userId, 120000L));
+ }
+
+ /**
+ * clears the cache
+ */
+ public void clearCache() {
+ String[] userIds;
+ synchronized (m_storeLock) {
+ userIds = m_store.keySet().toArray(new String[m_store.size()]);
+ }
+ // notify with a filter, that will be accepted nowhere
+ SERVICES.getService(IClientNotificationService.class).putNotification(new ResetAccessControlChangedNotification(), new SingleUserFilter(null, 0L));
+ clearCacheOfUserIds(userIds);
+ }
+
+ /**
+ * clears the cache for a set of userIds
+ *
+ * @param userIds
+ * derived from the Subject, see{@link IAccessControlService#getUserIdOfCurrentSubject()}
+ */
+ public void clearCacheOfUserIds(String... userIds) {
+ synchronized (m_storeLock) {
+ for (String userId : userIds) {
+ if (userId != null) {
+ m_store.remove(userId.toLowerCase());
+ }
+ }
+ }
+ //notify clients
+ for (String userId : userIds) {
+ if (userId != null) {
+ SERVICES.getService(IClientNotificationService.class).putNotification(new AccessControlChangedNotification(null), new SingleUserFilter(userId, 120000L));
+ }
+ }
+ }
+
+ public String[] getUserIds() {
+ synchronized (m_storeLock) {
+ return m_store.keySet().toArray(new String[m_store.keySet().size()]);
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/session/DefaultServerSessionService.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/session/DefaultServerSessionService.java
index 8c8cc97055..7c84f31d54 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/session/DefaultServerSessionService.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/session/DefaultServerSessionService.java
@@ -1,72 +1,72 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.session;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.commons.job.JobEx;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.server.IServerSession;
-import org.eclipse.scout.rt.server.ServerJob;
-import org.eclipse.scout.rt.shared.services.common.session.IJobRunnable;
-import org.eclipse.scout.rt.shared.services.common.session.ISessionService;
-import org.eclipse.scout.service.AbstractService;
-
-/**
- * Default implementation of {@link ISessionService} used on server-side.
- *
- * @since 3.8.1
- */
-@Priority(-1)
-public class DefaultServerSessionService extends AbstractService implements ISessionService {
-
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(DefaultServerSessionService.class);
-
- @Override
- public IServerSession getCurrentSession() {
- return ServerJob.getCurrentSession();
- }
-
- @Override
- public JobEx createAsyncJob(IJobRunnable runnable) {
- return createAsyncJob(null, runnable);
- }
-
- @Override
- public JobEx createAsyncJob(String name, IJobRunnable runnable) {
- IServerSession session = getCurrentSession();
- if (session == null) {
- LOG.error("server session not available");
- return null;
- }
- if (name == null) {
- name = "server session async job";
- }
- return new P_ServerSessionAsyncJob(name, session, runnable);
- }
-
- private static class P_ServerSessionAsyncJob extends ServerJob {
-
- private final IJobRunnable m_runnable;
-
- public P_ServerSessionAsyncJob(String name, IServerSession serverSession, IJobRunnable runnable) {
- super(name, serverSession);
- m_runnable = runnable;
- }
-
- @Override
- protected IStatus runTransaction(IProgressMonitor monitor) throws Exception {
- return m_runnable.run(monitor);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.session;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.commons.job.JobEx;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.server.IServerSession;
+import org.eclipse.scout.rt.server.ServerJob;
+import org.eclipse.scout.rt.shared.services.common.session.IJobRunnable;
+import org.eclipse.scout.rt.shared.services.common.session.ISessionService;
+import org.eclipse.scout.service.AbstractService;
+
+/**
+ * Default implementation of {@link ISessionService} used on server-side.
+ *
+ * @since 3.8.1
+ */
+@Priority(-1)
+public class DefaultServerSessionService extends AbstractService implements ISessionService {
+
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(DefaultServerSessionService.class);
+
+ @Override
+ public IServerSession getCurrentSession() {
+ return ServerJob.getCurrentSession();
+ }
+
+ @Override
+ public JobEx createAsyncJob(IJobRunnable runnable) {
+ return createAsyncJob(null, runnable);
+ }
+
+ @Override
+ public JobEx createAsyncJob(String name, IJobRunnable runnable) {
+ IServerSession session = getCurrentSession();
+ if (session == null) {
+ LOG.error("server session not available");
+ return null;
+ }
+ if (name == null) {
+ name = "server session async job";
+ }
+ return new P_ServerSessionAsyncJob(name, session, runnable);
+ }
+
+ private static class P_ServerSessionAsyncJob extends ServerJob {
+
+ private final IJobRunnable m_runnable;
+
+ public P_ServerSessionAsyncJob(String name, IServerSession serverSession, IJobRunnable runnable) {
+ super(name, serverSession);
+ m_runnable = runnable;
+ }
+
+ @Override
+ protected IStatus runTransaction(IProgressMonitor monitor) throws Exception {
+ return m_runnable.run(monitor);
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/session/IServerSessionRegistryService.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/session/IServerSessionRegistryService.java
index ab44b3cfc3..eb0397a759 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/session/IServerSessionRegistryService.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/session/IServerSessionRegistryService.java
@@ -1,38 +1,38 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.session;
-
-import javax.security.auth.Subject;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.server.IServerSession;
-import org.eclipse.scout.rt.shared.ui.UserAgent;
-import org.eclipse.scout.service.IService;
-
-public interface IServerSessionRegistryService extends IService {
-
- /**
- * @param clazz
- * @param subject
- * if the creation of the session requires a special jaas context
- * (not the default), it is run inside a {@link Subject#doAs(Subject, java.security.PrivilegedAction)}
- * section
- * @return a new server session The new session is created and loaded, see
- * {@link IServerSession#loadSession(org.osgi.framework.Bundle)}
- */
- <T extends IServerSession> T newServerSession(Class<T> clazz, Subject subject, UserAgent userAgent) throws ProcessingException;
-
- /**
- * @see #newServerSession(Class, Subject, UserAgent)
- */
- <T extends IServerSession> T newServerSession(Class<T> clazz, Subject subject) throws ProcessingException;
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.session;
+
+import javax.security.auth.Subject;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.server.IServerSession;
+import org.eclipse.scout.rt.shared.ui.UserAgent;
+import org.eclipse.scout.service.IService;
+
+public interface IServerSessionRegistryService extends IService {
+
+ /**
+ * @param clazz
+ * @param subject
+ * if the creation of the session requires a special jaas context
+ * (not the default), it is run inside a {@link Subject#doAs(Subject, java.security.PrivilegedAction)}
+ * section
+ * @return a new server session The new session is created and loaded, see
+ * {@link IServerSession#loadSession(org.osgi.framework.Bundle)}
+ */
+ <T extends IServerSession> T newServerSession(Class<T> clazz, Subject subject, UserAgent userAgent) throws ProcessingException;
+
+ /**
+ * @see #newServerSession(Class, Subject, UserAgent)
+ */
+ <T extends IServerSession> T newServerSession(Class<T> clazz, Subject subject) throws ProcessingException;
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/session/ServerSessionRegistryService.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/session/ServerSessionRegistryService.java
index b1e7ba4413..6ed8d8637e 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/session/ServerSessionRegistryService.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/session/ServerSessionRegistryService.java
@@ -1,64 +1,64 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.session;
-
-import javax.security.auth.Subject;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.server.IServerSession;
-import org.eclipse.scout.rt.server.ServerJob;
-import org.eclipse.scout.rt.server.ThreadContext;
-import org.eclipse.scout.rt.shared.ui.UserAgent;
-import org.eclipse.scout.service.AbstractService;
-import org.osgi.framework.Bundle;
-
-public class ServerSessionRegistryService extends AbstractService implements IServerSessionRegistryService {
- public static final IScoutLogger LOG = ScoutLogManager.getLogger(ServerSessionRegistryService.class);
-
- @Override
- public <T extends IServerSession> T newServerSession(Class<T> clazz, Subject subject) throws ProcessingException {
- return newServerSession(clazz, subject, UserAgent.createDefault());
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public <T extends IServerSession> T newServerSession(Class<T> clazz, Subject subject, UserAgent userAgent) throws ProcessingException {
- IServerSession serverSession;
- try {
- serverSession = clazz.newInstance();
- }
- catch (Throwable t) {
- throw new ProcessingException("create instance of " + clazz, t);
- }
- serverSession.setUserAgent(userAgent);
- ServerJob initJob = new ServerJob("new " + clazz.getSimpleName(), serverSession, subject) {
- @Override
- protected IStatus runTransaction(IProgressMonitor monitor) throws Exception {
- // load session
- IServerSession serverSessionInside = ThreadContext.getServerSession();
- String symbolicName = serverSessionInside.getClass().getPackage().getName();
- Bundle bundle = Platform.getBundle(symbolicName);
- serverSessionInside.loadSession(bundle);
- return Status.OK_STATUS;
- }
- };
- initJob.runNow(new NullProgressMonitor());
- initJob.throwOnError();
- return (T) serverSession;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.session;
+
+import javax.security.auth.Subject;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.server.IServerSession;
+import org.eclipse.scout.rt.server.ServerJob;
+import org.eclipse.scout.rt.server.ThreadContext;
+import org.eclipse.scout.rt.shared.ui.UserAgent;
+import org.eclipse.scout.service.AbstractService;
+import org.osgi.framework.Bundle;
+
+public class ServerSessionRegistryService extends AbstractService implements IServerSessionRegistryService {
+ public static final IScoutLogger LOG = ScoutLogManager.getLogger(ServerSessionRegistryService.class);
+
+ @Override
+ public <T extends IServerSession> T newServerSession(Class<T> clazz, Subject subject) throws ProcessingException {
+ return newServerSession(clazz, subject, UserAgent.createDefault());
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public <T extends IServerSession> T newServerSession(Class<T> clazz, Subject subject, UserAgent userAgent) throws ProcessingException {
+ IServerSession serverSession;
+ try {
+ serverSession = clazz.newInstance();
+ }
+ catch (Throwable t) {
+ throw new ProcessingException("create instance of " + clazz, t);
+ }
+ serverSession.setUserAgent(userAgent);
+ ServerJob initJob = new ServerJob("new " + clazz.getSimpleName(), serverSession, subject) {
+ @Override
+ protected IStatus runTransaction(IProgressMonitor monitor) throws Exception {
+ // load session
+ IServerSession serverSessionInside = ThreadContext.getServerSession();
+ String symbolicName = serverSessionInside.getClass().getPackage().getName();
+ Bundle bundle = Platform.getBundle(symbolicName);
+ serverSessionInside.loadSession(bundle);
+ return Status.OK_STATUS;
+ }
+ };
+ initJob.runNow(new NullProgressMonitor());
+ initJob.throwOnError();
+ return (T) serverSession;
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/smtp/AbstractSMTPService.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/smtp/AbstractSMTPService.java
index d9e9d98606..922980134c 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/smtp/AbstractSMTPService.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/smtp/AbstractSMTPService.java
@@ -1,325 +1,325 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.smtp;
-
-import java.util.Properties;
-
-import javax.mail.Address;
-import javax.mail.Session;
-import javax.mail.Transport;
-import javax.mail.internet.InternetAddress;
-import javax.mail.internet.MimeMessage;
-
-import org.eclipse.scout.commons.BundleContextUtility;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.service.AbstractService;
-
-public abstract class AbstractSMTPService extends AbstractService implements ISMTPService {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractSMTPService.class);
-
- private String m_host;
- private int m_port;
- private String m_username;
- private String m_password;
- private boolean m_useAuthentication;
- private String m_debugReceiverEmail;
- private String m_subjectPrefix;
- public String m_defaultFromEmail;
- private String m_sslProtocols;
- private boolean m_useSmtps;
-
- public AbstractSMTPService() {
- init();
- }
-
- // configuration
-
- @ConfigProperty(ConfigProperty.STRING)
- @Order(10)
- @ConfigPropertyValue("null")
- protected String getConfiguredHost() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.INTEGER)
- @Order(20)
- @ConfigPropertyValue("-1")
- protected int getConfiguredPort() {
- return -1;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(30)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredUseAuthentication() {
- return false;
- }
-
- @ConfigProperty(ConfigProperty.STRING)
- @Order(40)
- @ConfigPropertyValue("null")
- protected String getConfiguredUsername() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.STRING)
- @Order(50)
- @ConfigPropertyValue("null")
- protected String getConfiguredPassword() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.STRING)
- @Order(60)
- @ConfigPropertyValue("null")
- protected String getConfiguredSubjectPrefix() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.STRING)
- @Order(70)
- @ConfigPropertyValue("null")
- protected String getConfiguredDefaultFromEmail() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(80)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredUseSmtps() {
- return false;
- }
-
- @ConfigProperty(ConfigProperty.STRING)
- @Order(90)
- @ConfigPropertyValue("null")
- protected String getConfiguredSslProtocols() {
- return null;
- }
-
- private void init() {
- setHost(getConfiguredHost());
- setPort(getConfiguredPort());
- setUsername(getConfiguredUsername());
- setPassword(getConfiguredPassword());
- setSubjectPrefix(getConfiguredSubjectPrefix());
- setDefaultFromEmail(getConfiguredDefaultFromEmail());
- setUseSmtps(getConfiguredUseSmtps());
- setSslProtocols(getConfiguredSslProtocols());
- }
-
- @Override
- public String getHost() {
- return m_host;
- }
-
- @Override
- public void setHost(String s) {
- m_host = s;
- }
-
- @Override
- public int getPort() {
- return m_port;
- }
-
- @Override
- public void setPort(int s) {
- m_port = s;
- }
-
- @Override
- public boolean isUseAuthentication() {
- return m_useAuthentication;
- }
-
- @Override
- public void setUseAuthentication(boolean useAuthentication) {
- m_useAuthentication = useAuthentication;
- }
-
- @Override
- public String getUsername() {
- return m_username;
- }
-
- @Override
- public void setUsername(String s) {
- m_username = s;
- }
-
- @Override
- public String getPassword() {
- return m_password;
- }
-
- @Override
- public void setPassword(String s) {
- m_password = s;
- }
-
- @Override
- public String getSubjectPrefix() {
- return m_subjectPrefix;
- }
-
- @Override
- public void setSubjectPrefix(String subjectPrefix) {
- m_subjectPrefix = subjectPrefix;
- }
-
- @Override
- public String getDefaultFromEmail() {
- return m_defaultFromEmail;
- }
-
- @Override
- public void setDefaultFromEmail(String defaultFromEmail) {
- m_defaultFromEmail = defaultFromEmail;
- }
-
- @Override
- public String getDebugReceiverEmail() {
- return m_debugReceiverEmail;
- }
-
- /**
- * this method is used for debug reasons. If the address is set and not an
- * empty string all emails sent through this service will be sent only to the
- * debug email address.<br>
- * To override the debug email in the config.ini file use the property
- * <code>org.eclipse.scout.rt.server.services.common.smtp.AbstractSMTPService#debugReceiverEmail</code>
- *
- * @param emailAddress
- * a valid email address
- * <p>
- * Supports ${...} variables resolved by {@link BundleContextUtility#resolve(String)}
- */
- public void setDebugReceiverEmail(String emailAddress) {
- m_debugReceiverEmail = BundleContextUtility.resolve(emailAddress);
- }
-
- protected String getProtocol() {
- return isUseSmtps() ? "smtps" : "smtp";
- }
-
- @Override
- public boolean isUseSmtps() {
- return m_useSmtps;
- }
-
- @Override
- public void setUseSmtps(boolean useSmtps) {
- m_useSmtps = useSmtps;
- }
-
- @Override
- public String getSslProtocols() {
- return m_sslProtocols;
- }
-
- @Override
- public void setSslProtocols(String sslProtocols) {
- m_sslProtocols = sslProtocols;
- }
-
- @Override
- public void sendMessage(MimeMessage message) throws ProcessingException {
- sendMessage(message, null);
- }
-
- @Override
- public void sendMessage(MimeMessage message, Session session) throws ProcessingException {
- Transport transport = null;
- try {
- if (session == null) {
- session = createSession();
- }
- transport = session.getTransport(getProtocol());
- if (!StringUtility.isNullOrEmpty(getUsername())) {
- if (StringUtility.isNullOrEmpty(getHost())) {
- transport.connect(System.getProperty("mail." + getProtocol() + ".host"), getUsername(), getPassword());
- }
- else {
- transport.connect(getHost(), getUsername(), getPassword());
- }
- }
- else {
- transport.connect();
- }
- // subject prefix
- String subjectPrefix = getSubjectPrefix();
- if (!StringUtility.isNullOrEmpty(subjectPrefix)) {
- String subject = subjectPrefix + ((message.getSubject() != null) ? (message.getSubject()) : (""));
- message.setSubject(subject);
- }
-
- Address[] allRecipients = message.getAllRecipients();
- // check debug receiver
- String debugReceiverEmail = getDebugReceiverEmail();
- if (debugReceiverEmail != null) {
- allRecipients = new Address[]{new InternetAddress(debugReceiverEmail)};
- LOG.debug("SMTP Service: debug receiver email set to: " + debugReceiverEmail);
- }
- // from address
- Address[] fromAddresses = message.getFrom();
- if (fromAddresses == null || fromAddresses.length == 0) {
- String defaultFromEmail = getDefaultFromEmail();
- if (!StringUtility.isNullOrEmpty(defaultFromEmail)) {
- message.setFrom(new InternetAddress(defaultFromEmail));
- }
- }
- if (allRecipients != null && allRecipients.length > 0) {
- transport.sendMessage(message, allRecipients);
- transport.close();
- transport = null;
- }
- }
- catch (Exception e) {
- throw new ProcessingException("cannot send Mime Message.", e);
- }
- finally {
- try {
- if (transport != null) {
- transport.close();
- }
- }
- catch (Exception e) {
- }
- }
- }
-
- protected Session createSession() {
- Properties props = new Properties();
- props.setProperty("mail.transport.protocol", getProtocol());
- props.setProperty("mail." + getProtocol() + ".quitwait", "false");
- if (!StringUtility.isNullOrEmpty(m_host)) {
- props.setProperty("mail." + getProtocol() + ".host", m_host);
- }
- if (m_port > 0) {
- props.setProperty("mail." + getProtocol() + ".port", "" + m_port);
- }
- if (!StringUtility.isNullOrEmpty(m_username)) {
- props.setProperty("mail." + getProtocol() + ".user", m_username);
- props.setProperty("mail." + getProtocol() + ".auth", "" + m_useAuthentication);
- }
- if (!StringUtility.isNullOrEmpty(getSslProtocols())) {
- props.setProperty("mail." + getProtocol() + ".ssl.protocols", getSslProtocols());
- }
- return Session.getInstance(props, null);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.smtp;
+
+import java.util.Properties;
+
+import javax.mail.Address;
+import javax.mail.Session;
+import javax.mail.Transport;
+import javax.mail.internet.InternetAddress;
+import javax.mail.internet.MimeMessage;
+
+import org.eclipse.scout.commons.BundleContextUtility;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.service.AbstractService;
+
+public abstract class AbstractSMTPService extends AbstractService implements ISMTPService {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractSMTPService.class);
+
+ private String m_host;
+ private int m_port;
+ private String m_username;
+ private String m_password;
+ private boolean m_useAuthentication;
+ private String m_debugReceiverEmail;
+ private String m_subjectPrefix;
+ public String m_defaultFromEmail;
+ private String m_sslProtocols;
+ private boolean m_useSmtps;
+
+ public AbstractSMTPService() {
+ init();
+ }
+
+ // configuration
+
+ @ConfigProperty(ConfigProperty.STRING)
+ @Order(10)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredHost() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.INTEGER)
+ @Order(20)
+ @ConfigPropertyValue("-1")
+ protected int getConfiguredPort() {
+ return -1;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(30)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredUseAuthentication() {
+ return false;
+ }
+
+ @ConfigProperty(ConfigProperty.STRING)
+ @Order(40)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredUsername() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.STRING)
+ @Order(50)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredPassword() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.STRING)
+ @Order(60)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredSubjectPrefix() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.STRING)
+ @Order(70)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredDefaultFromEmail() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(80)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredUseSmtps() {
+ return false;
+ }
+
+ @ConfigProperty(ConfigProperty.STRING)
+ @Order(90)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredSslProtocols() {
+ return null;
+ }
+
+ private void init() {
+ setHost(getConfiguredHost());
+ setPort(getConfiguredPort());
+ setUsername(getConfiguredUsername());
+ setPassword(getConfiguredPassword());
+ setSubjectPrefix(getConfiguredSubjectPrefix());
+ setDefaultFromEmail(getConfiguredDefaultFromEmail());
+ setUseSmtps(getConfiguredUseSmtps());
+ setSslProtocols(getConfiguredSslProtocols());
+ }
+
+ @Override
+ public String getHost() {
+ return m_host;
+ }
+
+ @Override
+ public void setHost(String s) {
+ m_host = s;
+ }
+
+ @Override
+ public int getPort() {
+ return m_port;
+ }
+
+ @Override
+ public void setPort(int s) {
+ m_port = s;
+ }
+
+ @Override
+ public boolean isUseAuthentication() {
+ return m_useAuthentication;
+ }
+
+ @Override
+ public void setUseAuthentication(boolean useAuthentication) {
+ m_useAuthentication = useAuthentication;
+ }
+
+ @Override
+ public String getUsername() {
+ return m_username;
+ }
+
+ @Override
+ public void setUsername(String s) {
+ m_username = s;
+ }
+
+ @Override
+ public String getPassword() {
+ return m_password;
+ }
+
+ @Override
+ public void setPassword(String s) {
+ m_password = s;
+ }
+
+ @Override
+ public String getSubjectPrefix() {
+ return m_subjectPrefix;
+ }
+
+ @Override
+ public void setSubjectPrefix(String subjectPrefix) {
+ m_subjectPrefix = subjectPrefix;
+ }
+
+ @Override
+ public String getDefaultFromEmail() {
+ return m_defaultFromEmail;
+ }
+
+ @Override
+ public void setDefaultFromEmail(String defaultFromEmail) {
+ m_defaultFromEmail = defaultFromEmail;
+ }
+
+ @Override
+ public String getDebugReceiverEmail() {
+ return m_debugReceiverEmail;
+ }
+
+ /**
+ * this method is used for debug reasons. If the address is set and not an
+ * empty string all emails sent through this service will be sent only to the
+ * debug email address.<br>
+ * To override the debug email in the config.ini file use the property
+ * <code>org.eclipse.scout.rt.server.services.common.smtp.AbstractSMTPService#debugReceiverEmail</code>
+ *
+ * @param emailAddress
+ * a valid email address
+ * <p>
+ * Supports ${...} variables resolved by {@link BundleContextUtility#resolve(String)}
+ */
+ public void setDebugReceiverEmail(String emailAddress) {
+ m_debugReceiverEmail = BundleContextUtility.resolve(emailAddress);
+ }
+
+ protected String getProtocol() {
+ return isUseSmtps() ? "smtps" : "smtp";
+ }
+
+ @Override
+ public boolean isUseSmtps() {
+ return m_useSmtps;
+ }
+
+ @Override
+ public void setUseSmtps(boolean useSmtps) {
+ m_useSmtps = useSmtps;
+ }
+
+ @Override
+ public String getSslProtocols() {
+ return m_sslProtocols;
+ }
+
+ @Override
+ public void setSslProtocols(String sslProtocols) {
+ m_sslProtocols = sslProtocols;
+ }
+
+ @Override
+ public void sendMessage(MimeMessage message) throws ProcessingException {
+ sendMessage(message, null);
+ }
+
+ @Override
+ public void sendMessage(MimeMessage message, Session session) throws ProcessingException {
+ Transport transport = null;
+ try {
+ if (session == null) {
+ session = createSession();
+ }
+ transport = session.getTransport(getProtocol());
+ if (!StringUtility.isNullOrEmpty(getUsername())) {
+ if (StringUtility.isNullOrEmpty(getHost())) {
+ transport.connect(System.getProperty("mail." + getProtocol() + ".host"), getUsername(), getPassword());
+ }
+ else {
+ transport.connect(getHost(), getUsername(), getPassword());
+ }
+ }
+ else {
+ transport.connect();
+ }
+ // subject prefix
+ String subjectPrefix = getSubjectPrefix();
+ if (!StringUtility.isNullOrEmpty(subjectPrefix)) {
+ String subject = subjectPrefix + ((message.getSubject() != null) ? (message.getSubject()) : (""));
+ message.setSubject(subject);
+ }
+
+ Address[] allRecipients = message.getAllRecipients();
+ // check debug receiver
+ String debugReceiverEmail = getDebugReceiverEmail();
+ if (debugReceiverEmail != null) {
+ allRecipients = new Address[]{new InternetAddress(debugReceiverEmail)};
+ LOG.debug("SMTP Service: debug receiver email set to: " + debugReceiverEmail);
+ }
+ // from address
+ Address[] fromAddresses = message.getFrom();
+ if (fromAddresses == null || fromAddresses.length == 0) {
+ String defaultFromEmail = getDefaultFromEmail();
+ if (!StringUtility.isNullOrEmpty(defaultFromEmail)) {
+ message.setFrom(new InternetAddress(defaultFromEmail));
+ }
+ }
+ if (allRecipients != null && allRecipients.length > 0) {
+ transport.sendMessage(message, allRecipients);
+ transport.close();
+ transport = null;
+ }
+ }
+ catch (Exception e) {
+ throw new ProcessingException("cannot send Mime Message.", e);
+ }
+ finally {
+ try {
+ if (transport != null) {
+ transport.close();
+ }
+ }
+ catch (Exception e) {
+ }
+ }
+ }
+
+ protected Session createSession() {
+ Properties props = new Properties();
+ props.setProperty("mail.transport.protocol", getProtocol());
+ props.setProperty("mail." + getProtocol() + ".quitwait", "false");
+ if (!StringUtility.isNullOrEmpty(m_host)) {
+ props.setProperty("mail." + getProtocol() + ".host", m_host);
+ }
+ if (m_port > 0) {
+ props.setProperty("mail." + getProtocol() + ".port", "" + m_port);
+ }
+ if (!StringUtility.isNullOrEmpty(m_username)) {
+ props.setProperty("mail." + getProtocol() + ".user", m_username);
+ props.setProperty("mail." + getProtocol() + ".auth", "" + m_useAuthentication);
+ }
+ if (!StringUtility.isNullOrEmpty(getSslProtocols())) {
+ props.setProperty("mail." + getProtocol() + ".ssl.protocols", getSslProtocols());
+ }
+ return Session.getInstance(props, null);
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/smtp/ISMTPService.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/smtp/ISMTPService.java
index 37dbd460a7..973bb94717 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/smtp/ISMTPService.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/smtp/ISMTPService.java
@@ -1,129 +1,129 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.smtp;
-
-import javax.mail.Session;
-import javax.mail.internet.MimeMessage;
-
-import org.eclipse.scout.commons.MailUtility;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.service.IService;
-
-/**
- * <h3>ISMTPService</h3> The service to send messages over the smtp protocol. <br>
- * <p>
- * Usage Example:
- *
- * <pre>
- * DataSource att = MailUtility.createDataSource(new File(&quot;D:\\pictures\\backgroundCorsaire.jpg&quot;));
- * MimeMessage message = MailUtility.createMimeMessage(&quot;Some body part&quot;, &quot;&lt;html&gt;&lt;body&gt;&lt;b&gt;TEST&lt;/b&gt; Mail&lt;/body&gt;&lt;/html&gt;&quot;, new DataSource[]{att});
- * message.setSubject(&quot;test mail java&quot;);
- * message.setRecipient(javax.mail.Message.RecipientType.TO, new InternetAddress(&quot;aho@bsiag.com&quot;, &quot;Andreas Hoegger&quot;));
- * message.setFrom(new InternetAddress(&quot;aho@bsiag.com&quot;, &quot;Andreas Hoegger&quot;));
- * service.sendMessage(message);
- * </pre>
- *
- * @see MailUtility
- */
-public interface ISMTPService extends IService {
-
- /**
- * sends the message over the configured session. Ensure to have set receiver
- * email addresses, sender email addresses, subject and body parts.
- *
- * @param message
- * @throws ProcessingException
- * @see {@link MailUtility} to create a message
- */
- void sendMessage(MimeMessage message) throws ProcessingException;
-
- /**
- * sends the message over the session given as an argument. Ensure to have set
- * receiver email addresses, sender email addresses, subject and body parts.
- *
- * @param session
- * to send the message.
- * @throws ProcessingException
- */
- void sendMessage(MimeMessage message, Session session) throws ProcessingException;
-
- String getHost();
-
- void setHost(String host);
-
- int getPort();
-
- void setPort(int port);
-
- boolean isUseAuthentication();
-
- void setUseAuthentication(boolean useAuthentication);
-
- String getUsername();
-
- void setUsername(String username);
-
- String getPassword();
-
- void setPassword(String password);
-
- /**
- * The prefix will be added to every emails subject sent with the smtp
- * service. <br>
- * subject = prefix+message.subject
- *
- * @param prefix
- */
- void setSubjectPrefix(String prefix);
-
- String getSubjectPrefix();
-
- String getDefaultFromEmail();
-
- void setDefaultFromEmail(String defaultFromEmail);
-
- /**
- * This email is used when no sender address is set on the message to send.
- *
- * @return
- */
- String getDebugReceiverEmail();
-
- /**
- * @return Returns <code>true</code> if the communication between this
- * service and the SMTP host is encrypted (i.e. SMTPS).
- */
- boolean isUseSmtps();
-
- /**
- * Controls whether the communication between this service and the SMTP
- * host is encrypted (i.e. is using SMTPS)
- *
- * @param useSmtps
- */
- void setUseSmtps(boolean useSmtps);
-
- /**
- * @return Returns a comma-separated list of SSL protocols used for
- * establishing the connection to the SMTP host.
- */
- String getSslProtocols();
-
- /**
- * Sets the list of supported SSL protocols used for establishing a
- * connection to the SMTP host.
- *
- * @param sslProtocols
- * comma-separated list of protocol names.
- */
- void setSslProtocols(String sslProtocols);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.smtp;
+
+import javax.mail.Session;
+import javax.mail.internet.MimeMessage;
+
+import org.eclipse.scout.commons.MailUtility;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.service.IService;
+
+/**
+ * <h3>ISMTPService</h3> The service to send messages over the smtp protocol. <br>
+ * <p>
+ * Usage Example:
+ *
+ * <pre>
+ * DataSource att = MailUtility.createDataSource(new File(&quot;D:\\pictures\\backgroundCorsaire.jpg&quot;));
+ * MimeMessage message = MailUtility.createMimeMessage(&quot;Some body part&quot;, &quot;&lt;html&gt;&lt;body&gt;&lt;b&gt;TEST&lt;/b&gt; Mail&lt;/body&gt;&lt;/html&gt;&quot;, new DataSource[]{att});
+ * message.setSubject(&quot;test mail java&quot;);
+ * message.setRecipient(javax.mail.Message.RecipientType.TO, new InternetAddress(&quot;aho@bsiag.com&quot;, &quot;Andreas Hoegger&quot;));
+ * message.setFrom(new InternetAddress(&quot;aho@bsiag.com&quot;, &quot;Andreas Hoegger&quot;));
+ * service.sendMessage(message);
+ * </pre>
+ *
+ * @see MailUtility
+ */
+public interface ISMTPService extends IService {
+
+ /**
+ * sends the message over the configured session. Ensure to have set receiver
+ * email addresses, sender email addresses, subject and body parts.
+ *
+ * @param message
+ * @throws ProcessingException
+ * @see {@link MailUtility} to create a message
+ */
+ void sendMessage(MimeMessage message) throws ProcessingException;
+
+ /**
+ * sends the message over the session given as an argument. Ensure to have set
+ * receiver email addresses, sender email addresses, subject and body parts.
+ *
+ * @param session
+ * to send the message.
+ * @throws ProcessingException
+ */
+ void sendMessage(MimeMessage message, Session session) throws ProcessingException;
+
+ String getHost();
+
+ void setHost(String host);
+
+ int getPort();
+
+ void setPort(int port);
+
+ boolean isUseAuthentication();
+
+ void setUseAuthentication(boolean useAuthentication);
+
+ String getUsername();
+
+ void setUsername(String username);
+
+ String getPassword();
+
+ void setPassword(String password);
+
+ /**
+ * The prefix will be added to every emails subject sent with the smtp
+ * service. <br>
+ * subject = prefix+message.subject
+ *
+ * @param prefix
+ */
+ void setSubjectPrefix(String prefix);
+
+ String getSubjectPrefix();
+
+ String getDefaultFromEmail();
+
+ void setDefaultFromEmail(String defaultFromEmail);
+
+ /**
+ * This email is used when no sender address is set on the message to send.
+ *
+ * @return
+ */
+ String getDebugReceiverEmail();
+
+ /**
+ * @return Returns <code>true</code> if the communication between this
+ * service and the SMTP host is encrypted (i.e. SMTPS).
+ */
+ boolean isUseSmtps();
+
+ /**
+ * Controls whether the communication between this service and the SMTP
+ * host is encrypted (i.e. is using SMTPS)
+ *
+ * @param useSmtps
+ */
+ void setUseSmtps(boolean useSmtps);
+
+ /**
+ * @return Returns a comma-separated list of SSL protocols used for
+ * establishing the connection to the SMTP host.
+ */
+ String getSslProtocols();
+
+ /**
+ * Sets the list of supported SSL protocols used for establishing a
+ * connection to the SMTP host.
+ *
+ * @param sslProtocols
+ * comma-separated list of protocol names.
+ */
+ void setSslProtocols(String sslProtocols);
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/test/AbstractServerTest.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/test/AbstractServerTest.java
index 7b3c1810ab..4f20037ae8 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/test/AbstractServerTest.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/test/AbstractServerTest.java
@@ -1,34 +1,34 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.test;
-
-import org.eclipse.scout.rt.server.IServerSession;
-import org.eclipse.scout.rt.shared.services.common.test.AbstractTest;
-import org.eclipse.scout.rt.shared.services.common.test.ITest;
-
-/**
- * Abstract client test implementation.
- * <p>
- * {@link #getConfiguredProduct()} has special default value calling session symbolic name
- */
-public abstract class AbstractServerTest extends AbstractTest implements ITest {
-
- @Override
- protected void initConfig() {
- super.initConfig();
- if (getProduct() == null) {
- IServerSession session = ServerTestUtility.getServerSession();
- if (session != null && session.getBundle() != null) {
- setProduct(session.getBundle().getSymbolicName());
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.test;
+
+import org.eclipse.scout.rt.server.IServerSession;
+import org.eclipse.scout.rt.shared.services.common.test.AbstractTest;
+import org.eclipse.scout.rt.shared.services.common.test.ITest;
+
+/**
+ * Abstract client test implementation.
+ * <p>
+ * {@link #getConfiguredProduct()} has special default value calling session symbolic name
+ */
+public abstract class AbstractServerTest extends AbstractTest implements ITest {
+
+ @Override
+ protected void initConfig() {
+ super.initConfig();
+ if (getProduct() == null) {
+ IServerSession session = ServerTestUtility.getServerSession();
+ if (session != null && session.getBundle() != null) {
+ setProduct(session.getBundle().getSymbolicName());
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/test/DefaultLookupServicesTest.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/test/DefaultLookupServicesTest.java
index e04aa9cdff..46bb5ee3a0 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/test/DefaultLookupServicesTest.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/test/DefaultLookupServicesTest.java
@@ -1,70 +1,70 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.test;
-
-import java.lang.reflect.Method;
-
-import org.eclipse.scout.rt.server.ThreadContext;
-import org.eclipse.scout.rt.shared.services.lookup.ILookupService;
-import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
-import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
-import org.eclipse.scout.service.SERVICES;
-import org.osgi.framework.Bundle;
-
-public class DefaultLookupServicesTest extends AbstractServerTest {
-
- @Override
- public void run() throws Throwable {
- ILookupService[] services = SERVICES.getServices(ILookupService.class);
- for (ILookupService s : services) {
- testMethodInvocation(s, "getDataByKey");
- testMethodInvocation(s, "getDataByText");
- testMethodInvocation(s, "getDataByAll");
- testMethodInvocation(s, "getDataByRec");
- }
- }
-
- protected void testMethodInvocation(ILookupService s, String methodName) {
- // test
- setSubTitle(s.getClass().getSimpleName() + "." + methodName);
- try {
- //
- LookupCall call = createLookupCall(s, methodName);
- Method m = s.getClass().getMethod(methodName, LookupCall.class);
- @SuppressWarnings("unused")
- LookupRow[] data = (LookupRow[]) m.invoke(s, call);
- addOkStatus();
- }
- catch (Throwable t) {
- addErrorStatus(t);
- }
- }
-
- protected LookupCall createLookupCall(ILookupService s, String methodName) throws Throwable {
- Bundle serverBundle = ThreadContext.getServerSession().getBundle();
- String groupName = serverBundle.getSymbolicName().replace("\\.server$", "");
- String lookupCallClassName = groupName + ".shared.services.lookup." + s.getClass().getSimpleName().replaceAll("LookupService$", "") + "LookupCall";
- LookupCall call = (LookupCall) serverBundle.loadClass(lookupCallClassName).newInstance();
- call.setKey(1L);
- call.setText("XXX");
- call.setAll("XXX");
- call.setRec(1L);
- call.setMaster(1L);
- call.setMaxRowCount(1);
- return call;
- }
-
- @Override
- protected String getConfiguredTitle() {
- return "Lookup Services";
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.test;
+
+import java.lang.reflect.Method;
+
+import org.eclipse.scout.rt.server.ThreadContext;
+import org.eclipse.scout.rt.shared.services.lookup.ILookupService;
+import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
+import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
+import org.eclipse.scout.service.SERVICES;
+import org.osgi.framework.Bundle;
+
+public class DefaultLookupServicesTest extends AbstractServerTest {
+
+ @Override
+ public void run() throws Throwable {
+ ILookupService[] services = SERVICES.getServices(ILookupService.class);
+ for (ILookupService s : services) {
+ testMethodInvocation(s, "getDataByKey");
+ testMethodInvocation(s, "getDataByText");
+ testMethodInvocation(s, "getDataByAll");
+ testMethodInvocation(s, "getDataByRec");
+ }
+ }
+
+ protected void testMethodInvocation(ILookupService s, String methodName) {
+ // test
+ setSubTitle(s.getClass().getSimpleName() + "." + methodName);
+ try {
+ //
+ LookupCall call = createLookupCall(s, methodName);
+ Method m = s.getClass().getMethod(methodName, LookupCall.class);
+ @SuppressWarnings("unused")
+ LookupRow[] data = (LookupRow[]) m.invoke(s, call);
+ addOkStatus();
+ }
+ catch (Throwable t) {
+ addErrorStatus(t);
+ }
+ }
+
+ protected LookupCall createLookupCall(ILookupService s, String methodName) throws Throwable {
+ Bundle serverBundle = ThreadContext.getServerSession().getBundle();
+ String groupName = serverBundle.getSymbolicName().replace("\\.server$", "");
+ String lookupCallClassName = groupName + ".shared.services.lookup." + s.getClass().getSimpleName().replaceAll("LookupService$", "") + "LookupCall";
+ LookupCall call = (LookupCall) serverBundle.loadClass(lookupCallClassName).newInstance();
+ call.setKey(1L);
+ call.setText("XXX");
+ call.setAll("XXX");
+ call.setRec(1L);
+ call.setMaster(1L);
+ call.setMaxRowCount(1);
+ return call;
+ }
+
+ @Override
+ protected String getConfiguredTitle() {
+ return "Lookup Services";
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/test/ServerTestUtility.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/test/ServerTestUtility.java
index 7c8d01b230..15fd090ff3 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/test/ServerTestUtility.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/test/ServerTestUtility.java
@@ -1,48 +1,48 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.test;
-
-import java.util.Date;
-
-import org.eclipse.scout.rt.server.IServerSession;
-import org.eclipse.scout.rt.server.ThreadContext;
-import org.osgi.framework.Bundle;
-
-public final class ServerTestUtility {
-
- private ServerTestUtility() {
- }
-
- public static void sleep(final int seconds) {
- try {
- Thread.sleep(1000L * seconds);
- }
- catch (InterruptedException e) {
- }
- }
-
- public static String getNowAsString() {
- return "" + new Date();
- }
-
- public static Date getNowAsDate() {
- return new Date();
- }
-
- public static IServerSession getServerSession() {
- return ThreadContext.getServerSession();
- }
-
- public static Bundle getServerBundle() {
- return ThreadContext.getServerSession().getBundle();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.test;
+
+import java.util.Date;
+
+import org.eclipse.scout.rt.server.IServerSession;
+import org.eclipse.scout.rt.server.ThreadContext;
+import org.osgi.framework.Bundle;
+
+public final class ServerTestUtility {
+
+ private ServerTestUtility() {
+ }
+
+ public static void sleep(final int seconds) {
+ try {
+ Thread.sleep(1000L * seconds);
+ }
+ catch (InterruptedException e) {
+ }
+ }
+
+ public static String getNowAsString() {
+ return "" + new Date();
+ }
+
+ public static Date getNowAsDate() {
+ return new Date();
+ }
+
+ public static IServerSession getServerSession() {
+ return ThreadContext.getServerSession();
+ }
+
+ public static Bundle getServerBundle() {
+ return ThreadContext.getServerSession().getBundle();
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/useractivity/AbstractUserActivityStateService.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/useractivity/AbstractUserActivityStateService.java
index 06d02e5c80..d8f676805a 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/useractivity/AbstractUserActivityStateService.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/useractivity/AbstractUserActivityStateService.java
@@ -1,59 +1,59 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.useractivity;
-
-import org.eclipse.scout.commons.TTLCache;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.server.services.common.clientnotification.AllUserFilter;
-import org.eclipse.scout.rt.server.services.common.clientnotification.IClientNotificationService;
-import org.eclipse.scout.rt.shared.services.common.useractivity.IUserActivityStateService;
-import org.eclipse.scout.rt.shared.services.common.useractivity.UserActivityClientNotification;
-import org.eclipse.scout.rt.shared.services.common.useractivity.UserStatusMap;
-import org.eclipse.scout.service.AbstractService;
-import org.eclipse.scout.service.SERVICES;
-
-public abstract class AbstractUserActivityStateService extends AbstractService implements IUserActivityStateService {
- private Object m_usersLock;
- private TTLCache<Long, Integer> m_users;
-
- public AbstractUserActivityStateService() {
- m_usersLock = new Object();
- m_users = new TTLCache<Long, Integer>(60000L);
- }
-
- /**
- * Implements this method. This method normally calls {@link #setStatusImpl(long, int)}
- */
- @Override
- public abstract void setStatus(int status) throws ProcessingException;
-
- protected void setStatusImpl(long userId, int status) throws ProcessingException {
- int oldStatus = 0;
- synchronized (m_usersLock) {
- oldStatus = IUserActivityStateService.STATUS_OFFLINE;
- Integer oldStatInt = m_users.get(userId);
- if (oldStatInt != null) {
- oldStatus = m_users.get(userId);
- }
- m_users.put(userId, status);
- if (oldStatus != status) {
- UserStatusMap map = getUserStatusMap();
- SERVICES.getService(IClientNotificationService.class).putNotification(new UserActivityClientNotification(map), new AllUserFilter(120000L));
- }
- }
- }
-
- @Override
- public UserStatusMap getUserStatusMap() {
- return new UserStatusMap(m_users.getEntries());
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.useractivity;
+
+import org.eclipse.scout.commons.TTLCache;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.server.services.common.clientnotification.AllUserFilter;
+import org.eclipse.scout.rt.server.services.common.clientnotification.IClientNotificationService;
+import org.eclipse.scout.rt.shared.services.common.useractivity.IUserActivityStateService;
+import org.eclipse.scout.rt.shared.services.common.useractivity.UserActivityClientNotification;
+import org.eclipse.scout.rt.shared.services.common.useractivity.UserStatusMap;
+import org.eclipse.scout.service.AbstractService;
+import org.eclipse.scout.service.SERVICES;
+
+public abstract class AbstractUserActivityStateService extends AbstractService implements IUserActivityStateService {
+ private Object m_usersLock;
+ private TTLCache<Long, Integer> m_users;
+
+ public AbstractUserActivityStateService() {
+ m_usersLock = new Object();
+ m_users = new TTLCache<Long, Integer>(60000L);
+ }
+
+ /**
+ * Implements this method. This method normally calls {@link #setStatusImpl(long, int)}
+ */
+ @Override
+ public abstract void setStatus(int status) throws ProcessingException;
+
+ protected void setStatusImpl(long userId, int status) throws ProcessingException {
+ int oldStatus = 0;
+ synchronized (m_usersLock) {
+ oldStatus = IUserActivityStateService.STATUS_OFFLINE;
+ Integer oldStatInt = m_users.get(userId);
+ if (oldStatInt != null) {
+ oldStatus = m_users.get(userId);
+ }
+ m_users.put(userId, status);
+ if (oldStatus != status) {
+ UserStatusMap map = getUserStatusMap();
+ SERVICES.getService(IClientNotificationService.class).putNotification(new UserActivityClientNotification(map), new AllUserFilter(120000L));
+ }
+ }
+ }
+
+ @Override
+ public UserStatusMap getUserStatusMap() {
+ return new UserStatusMap(m_users.getEntries());
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/workflow/AbstractWorkflowService.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/workflow/AbstractWorkflowService.java
index 219723432a..1f6dd0d4bb 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/workflow/AbstractWorkflowService.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/workflow/AbstractWorkflowService.java
@@ -1,352 +1,352 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.workflow;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-
-import org.eclipse.scout.commons.ConfigurationUtility;
-import org.eclipse.scout.commons.TypeCastUtility;
-import org.eclipse.scout.commons.annotations.ConfigOperation;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
-import org.eclipse.scout.rt.shared.services.common.jdbc.SearchFilter;
-import org.eclipse.scout.rt.shared.services.common.workflow.AbstractWorkflowData;
-import org.eclipse.scout.rt.shared.services.common.workflow.AbstractWorkflowStepData;
-import org.eclipse.scout.service.AbstractService;
-import org.eclipse.scout.service.SERVICES;
-
-public abstract class AbstractWorkflowService<T extends AbstractWorkflowData> extends AbstractService implements IWorkflowService<T> {
- private ArrayList<IWorkflowStep> m_stepList;
- private HashMap<Class<? extends IWorkflowStep>, IWorkflowStep> m_stepMap;
-
- public AbstractWorkflowService() {
- m_stepList = new ArrayList<IWorkflowStep>();
- m_stepMap = new HashMap<Class<? extends IWorkflowStep>, IWorkflowStep>();
- initConfig();
- }
-
- @Override
- public AbstractWorkflowData[] getAvailableWorkflowTypes(SearchFilter filter) throws ProcessingException {
- AbstractWorkflowData[] a = execCollectAvailableWorkflowTypes(filter);
- if (a == null) {
- a = new AbstractWorkflowData[0];
- }
- return a;
- }
-
- @Override
- public AbstractWorkflowData[] getFilteredWorkflows(SearchFilter filter) throws ProcessingException {
- AbstractWorkflowData[] a = execCollectFilteredWorkflows(filter);
- if (a == null) {
- a = new AbstractWorkflowData[0];
- }
- return a;
- }
-
- @Override
- public T create(T spec) throws ProcessingException {
- T data = execNew(spec);
- if (data != null) {
- data = resume(data);
- }
- return data;
- }
-
- @Override
- public T resume(T spec) throws ProcessingException {
- T data = execLoad(spec);
- if (data != null) {
- data = makeStateTransition(data);
- }
- return data;
- }
-
- @Override
- public T store(T data) throws ProcessingException {
- if (data != null) {
- execStore(data);
- }
- return data;
- }
-
- @Override
- public T finish(T data) throws ProcessingException {
- if (data != null) {
- try {
- execFinish(data);
- }
- finally {
- execStore(data);
- }
- }
- return data;
- }
-
- @Override
- public T discard(T data) throws ProcessingException {
- if (data != null) {
- try {
- execDiscard(data);
- }
- finally {
- execStore(data);
- }
- }
- return data;
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public T makeStateTransition(T data) throws ProcessingException {
- execValidateState(data);
- AbstractWorkflowStepData curStepData = data.getCurrentStepData();
- AbstractWorkflowStepData nextStepData = data.getNextStepData();
- IWorkflowStep curStep = null;
- if (curStepData != null) {
- curStep = execGetStepForData(curStepData);
- }
- IWorkflowStep nextStep = null;
- if (nextStepData != null) {
- nextStep = execGetStepForData(nextStepData);
- }
- //
- if (curStep != null) {
- if (curStepData != null && curStepData.isCompleted()) {
- try {
- curStep.completeStep(data, curStepData, nextStep != null);
- execStore(data);
- }
- catch (ProcessingException e) {
- curStepData.setCompletionDate(null);
- curStep.prepareStep(data, curStepData, nextStep != null);
- throw e;
- }
- if (curStepData.isCompleted()) {
- // go on to next step
- data.advanceStepDataIndex();
- execStore(data);
- curStepData = data.getCurrentStepData();
- nextStepData = data.getNextStepData();
- curStep = null;
- if (curStepData != null) {
- curStep = execGetStepForData(curStepData);
- }
- nextStep = null;
- if (nextStepData != null) {
- nextStep = execGetStepForData(nextStepData);
- }
- // if there is no next step, call finish
- if (curStep != null) {
- curStep.prepareStep(data, curStepData, nextStep != null);
- execStore(data);
- }
- else {
- data = finish(data);
- }
- }
- }
- else {
- curStep.prepareStep(data, curStepData, nextStep != null);
- execStore(data);
- }
- }
- else {
- data = finish(data);
- }
- return data;
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public <S extends IWorkflowStep> S getStepByClass(Class<S> stepClass) {
- if (stepClass == null) {
- return null;
- }
- else {
- return (S) m_stepMap.get(stepClass);
- }
- }
-
- protected IWorkflowStep execGetStepForData(AbstractWorkflowStepData data) {
- if (data != null) {
- for (IWorkflowStep step : m_stepList) {
- Class<?> processingDataType = TypeCastUtility.getGenericsParameterClass(step.getClass(), AbstractWorkflowStep.class);
- if (processingDataType != null && processingDataType.isInstance(data)) {
- return step;
- }
- }
- }
- return null;
- }
-
- @Override
- public IWorkflowStep[] getSteps() {
- return m_stepList.toArray(new IWorkflowStep[m_stepList.size()]);
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public <S extends IWorkflowStep> S resolveStep(S step) {
- if (step == null) {
- return null;
- }
- else {
- return (S) m_stepMap.get(step.getClass());
- }
- }
-
- /**
- * set default properties on AbstractWorkflowData object<br>
- * definitionNr,definitionText,definitionActive,definitionDoc,
- * definitionServiceClass
- */
- @SuppressWarnings("unchecked")
- public void assignDefinitions(AbstractWorkflowData data) {
- if (data != null) {
- data.setDefinitionText(getConfiguredDefinitionText());
- data.setDefinitionActive(getConfiguredDefinitionActive());
- data.setDefinitionServiceClass(getClass().getName());
- for (AbstractWorkflowStepData stepData : data.getStepDataList()) {
- IWorkflowStep step = execGetStepForData(stepData);
- if (step != null) {
- step.assignDefinitions(stepData);
- }
- }
- }
- }
-
- /*
- * Configuration
- */
-
- private Class<? extends IWorkflowStep>[] getConfiguredSteps() {
- Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
- return ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, IWorkflowStep.class);
- }
-
- @ConfigProperty(ConfigProperty.TEXT)
- @Order(50)
- @ConfigPropertyValue("null")
- protected String getConfiguredDefinitionText() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(60)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredDefinitionActive() {
- return false;
- }
-
- @ConfigProperty(ConfigProperty.DOC)
- @Order(10)
- @ConfigPropertyValue("null")
- protected String getConfiguredDoc() {
- return null;
- }
-
- @ConfigOperation
- @Order(10)
- protected AbstractWorkflowData[] execCollectAvailableWorkflowTypes(SearchFilter filter) throws ProcessingException {
- return new AbstractWorkflowData[0];
- }
-
- @ConfigOperation
- @Order(15)
- protected AbstractWorkflowData[] execCollectFilteredWorkflows(SearchFilter filter) throws ProcessingException {
- return new AbstractWorkflowData[0];
- }
-
- /**
- * Create new data object based on the specification data object doesn't have
- * to be be validated yet
- */
- @ConfigOperation
- @Order(20)
- protected T execNew(T spec) throws ProcessingException {
- return spec;
- }
-
- /**
- * Load data object from persistent store based on the specification {@link AbstractWorkflowData#getWorkflowNr()} is
- * the primary key
- * <p>
- * This method is called on the creation of a new workflow data and also when a workflow resumes.
- */
- @ConfigOperation
- @Order(30)
- protected T execLoad(T spec) throws ProcessingException {
- return spec;
- }
-
- /**
- * Make data object persistent<br>
- * This method is called whenever a step has changed, so in most cases it is
- * sufficient to only store the current step data
- */
- @ConfigOperation
- @Order(40)
- protected void execStore(T data) throws ProcessingException {
-
- }
-
- /**
- * Recalculates / validates the currently active (not yet completed) step
- * {@link AbstractWorkflowData#setCurrentStep(AbstractWorkflowStepData)},<br>
- * sets the {@link AbstractWorkflowData#setHistory()} and {@link AbstractWorkflowData#setExpectedFuture()} and
- * validates {@link AbstractWorkflowStepData#setFinishPossible(boolean, int)},
- * {@link AbstractWorkflowStepData#setCancelPossible(boolean)},
- * {@link AbstractWorkflowStepData#setSuspendPossible(boolean)},
- * {@link AbstractWorkflowStepData#setCompletionDate(java.util.Date)}
- */
- @ConfigOperation
- @Order(50)
- protected void execValidateState(T data) throws ProcessingException {
- assignDefinitions(data);
- }
-
- /**
- * Finish workflow based on that data
- */
- @ConfigOperation
- @Order(60)
- protected void execFinish(T data) throws ProcessingException {
- data.setFinishDate(new Date());
- }
-
- /**
- * Discard workflow based on that data
- */
- @ConfigOperation
- @Order(70)
- protected void execDiscard(T data) throws ProcessingException {
-
- }
-
- protected void initConfig() {
- for (Class<? extends IWorkflowStep> c : getConfiguredSteps()) {
- try {
- IWorkflowStep step = ConfigurationUtility.newInnerInstance(this, c);
- m_stepList.add(step);
- m_stepMap.put(c, step);
- }
- catch (Exception e) {
- SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("create instance of " + c, e));
- }
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.workflow;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+
+import org.eclipse.scout.commons.ConfigurationUtility;
+import org.eclipse.scout.commons.TypeCastUtility;
+import org.eclipse.scout.commons.annotations.ConfigOperation;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
+import org.eclipse.scout.rt.shared.services.common.jdbc.SearchFilter;
+import org.eclipse.scout.rt.shared.services.common.workflow.AbstractWorkflowData;
+import org.eclipse.scout.rt.shared.services.common.workflow.AbstractWorkflowStepData;
+import org.eclipse.scout.service.AbstractService;
+import org.eclipse.scout.service.SERVICES;
+
+public abstract class AbstractWorkflowService<T extends AbstractWorkflowData> extends AbstractService implements IWorkflowService<T> {
+ private ArrayList<IWorkflowStep> m_stepList;
+ private HashMap<Class<? extends IWorkflowStep>, IWorkflowStep> m_stepMap;
+
+ public AbstractWorkflowService() {
+ m_stepList = new ArrayList<IWorkflowStep>();
+ m_stepMap = new HashMap<Class<? extends IWorkflowStep>, IWorkflowStep>();
+ initConfig();
+ }
+
+ @Override
+ public AbstractWorkflowData[] getAvailableWorkflowTypes(SearchFilter filter) throws ProcessingException {
+ AbstractWorkflowData[] a = execCollectAvailableWorkflowTypes(filter);
+ if (a == null) {
+ a = new AbstractWorkflowData[0];
+ }
+ return a;
+ }
+
+ @Override
+ public AbstractWorkflowData[] getFilteredWorkflows(SearchFilter filter) throws ProcessingException {
+ AbstractWorkflowData[] a = execCollectFilteredWorkflows(filter);
+ if (a == null) {
+ a = new AbstractWorkflowData[0];
+ }
+ return a;
+ }
+
+ @Override
+ public T create(T spec) throws ProcessingException {
+ T data = execNew(spec);
+ if (data != null) {
+ data = resume(data);
+ }
+ return data;
+ }
+
+ @Override
+ public T resume(T spec) throws ProcessingException {
+ T data = execLoad(spec);
+ if (data != null) {
+ data = makeStateTransition(data);
+ }
+ return data;
+ }
+
+ @Override
+ public T store(T data) throws ProcessingException {
+ if (data != null) {
+ execStore(data);
+ }
+ return data;
+ }
+
+ @Override
+ public T finish(T data) throws ProcessingException {
+ if (data != null) {
+ try {
+ execFinish(data);
+ }
+ finally {
+ execStore(data);
+ }
+ }
+ return data;
+ }
+
+ @Override
+ public T discard(T data) throws ProcessingException {
+ if (data != null) {
+ try {
+ execDiscard(data);
+ }
+ finally {
+ execStore(data);
+ }
+ }
+ return data;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public T makeStateTransition(T data) throws ProcessingException {
+ execValidateState(data);
+ AbstractWorkflowStepData curStepData = data.getCurrentStepData();
+ AbstractWorkflowStepData nextStepData = data.getNextStepData();
+ IWorkflowStep curStep = null;
+ if (curStepData != null) {
+ curStep = execGetStepForData(curStepData);
+ }
+ IWorkflowStep nextStep = null;
+ if (nextStepData != null) {
+ nextStep = execGetStepForData(nextStepData);
+ }
+ //
+ if (curStep != null) {
+ if (curStepData != null && curStepData.isCompleted()) {
+ try {
+ curStep.completeStep(data, curStepData, nextStep != null);
+ execStore(data);
+ }
+ catch (ProcessingException e) {
+ curStepData.setCompletionDate(null);
+ curStep.prepareStep(data, curStepData, nextStep != null);
+ throw e;
+ }
+ if (curStepData.isCompleted()) {
+ // go on to next step
+ data.advanceStepDataIndex();
+ execStore(data);
+ curStepData = data.getCurrentStepData();
+ nextStepData = data.getNextStepData();
+ curStep = null;
+ if (curStepData != null) {
+ curStep = execGetStepForData(curStepData);
+ }
+ nextStep = null;
+ if (nextStepData != null) {
+ nextStep = execGetStepForData(nextStepData);
+ }
+ // if there is no next step, call finish
+ if (curStep != null) {
+ curStep.prepareStep(data, curStepData, nextStep != null);
+ execStore(data);
+ }
+ else {
+ data = finish(data);
+ }
+ }
+ }
+ else {
+ curStep.prepareStep(data, curStepData, nextStep != null);
+ execStore(data);
+ }
+ }
+ else {
+ data = finish(data);
+ }
+ return data;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public <S extends IWorkflowStep> S getStepByClass(Class<S> stepClass) {
+ if (stepClass == null) {
+ return null;
+ }
+ else {
+ return (S) m_stepMap.get(stepClass);
+ }
+ }
+
+ protected IWorkflowStep execGetStepForData(AbstractWorkflowStepData data) {
+ if (data != null) {
+ for (IWorkflowStep step : m_stepList) {
+ Class<?> processingDataType = TypeCastUtility.getGenericsParameterClass(step.getClass(), AbstractWorkflowStep.class);
+ if (processingDataType != null && processingDataType.isInstance(data)) {
+ return step;
+ }
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public IWorkflowStep[] getSteps() {
+ return m_stepList.toArray(new IWorkflowStep[m_stepList.size()]);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public <S extends IWorkflowStep> S resolveStep(S step) {
+ if (step == null) {
+ return null;
+ }
+ else {
+ return (S) m_stepMap.get(step.getClass());
+ }
+ }
+
+ /**
+ * set default properties on AbstractWorkflowData object<br>
+ * definitionNr,definitionText,definitionActive,definitionDoc,
+ * definitionServiceClass
+ */
+ @SuppressWarnings("unchecked")
+ public void assignDefinitions(AbstractWorkflowData data) {
+ if (data != null) {
+ data.setDefinitionText(getConfiguredDefinitionText());
+ data.setDefinitionActive(getConfiguredDefinitionActive());
+ data.setDefinitionServiceClass(getClass().getName());
+ for (AbstractWorkflowStepData stepData : data.getStepDataList()) {
+ IWorkflowStep step = execGetStepForData(stepData);
+ if (step != null) {
+ step.assignDefinitions(stepData);
+ }
+ }
+ }
+ }
+
+ /*
+ * Configuration
+ */
+
+ private Class<? extends IWorkflowStep>[] getConfiguredSteps() {
+ Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
+ return ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, IWorkflowStep.class);
+ }
+
+ @ConfigProperty(ConfigProperty.TEXT)
+ @Order(50)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredDefinitionText() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(60)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredDefinitionActive() {
+ return false;
+ }
+
+ @ConfigProperty(ConfigProperty.DOC)
+ @Order(10)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredDoc() {
+ return null;
+ }
+
+ @ConfigOperation
+ @Order(10)
+ protected AbstractWorkflowData[] execCollectAvailableWorkflowTypes(SearchFilter filter) throws ProcessingException {
+ return new AbstractWorkflowData[0];
+ }
+
+ @ConfigOperation
+ @Order(15)
+ protected AbstractWorkflowData[] execCollectFilteredWorkflows(SearchFilter filter) throws ProcessingException {
+ return new AbstractWorkflowData[0];
+ }
+
+ /**
+ * Create new data object based on the specification data object doesn't have
+ * to be be validated yet
+ */
+ @ConfigOperation
+ @Order(20)
+ protected T execNew(T spec) throws ProcessingException {
+ return spec;
+ }
+
+ /**
+ * Load data object from persistent store based on the specification {@link AbstractWorkflowData#getWorkflowNr()} is
+ * the primary key
+ * <p>
+ * This method is called on the creation of a new workflow data and also when a workflow resumes.
+ */
+ @ConfigOperation
+ @Order(30)
+ protected T execLoad(T spec) throws ProcessingException {
+ return spec;
+ }
+
+ /**
+ * Make data object persistent<br>
+ * This method is called whenever a step has changed, so in most cases it is
+ * sufficient to only store the current step data
+ */
+ @ConfigOperation
+ @Order(40)
+ protected void execStore(T data) throws ProcessingException {
+
+ }
+
+ /**
+ * Recalculates / validates the currently active (not yet completed) step
+ * {@link AbstractWorkflowData#setCurrentStep(AbstractWorkflowStepData)},<br>
+ * sets the {@link AbstractWorkflowData#setHistory()} and {@link AbstractWorkflowData#setExpectedFuture()} and
+ * validates {@link AbstractWorkflowStepData#setFinishPossible(boolean, int)},
+ * {@link AbstractWorkflowStepData#setCancelPossible(boolean)},
+ * {@link AbstractWorkflowStepData#setSuspendPossible(boolean)},
+ * {@link AbstractWorkflowStepData#setCompletionDate(java.util.Date)}
+ */
+ @ConfigOperation
+ @Order(50)
+ protected void execValidateState(T data) throws ProcessingException {
+ assignDefinitions(data);
+ }
+
+ /**
+ * Finish workflow based on that data
+ */
+ @ConfigOperation
+ @Order(60)
+ protected void execFinish(T data) throws ProcessingException {
+ data.setFinishDate(new Date());
+ }
+
+ /**
+ * Discard workflow based on that data
+ */
+ @ConfigOperation
+ @Order(70)
+ protected void execDiscard(T data) throws ProcessingException {
+
+ }
+
+ protected void initConfig() {
+ for (Class<? extends IWorkflowStep> c : getConfiguredSteps()) {
+ try {
+ IWorkflowStep step = ConfigurationUtility.newInnerInstance(this, c);
+ m_stepList.add(step);
+ m_stepMap.put(c, step);
+ }
+ catch (Exception e) {
+ SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("create instance of " + c, e));
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/workflow/AbstractWorkflowStep.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/workflow/AbstractWorkflowStep.java
index fa4270a9fd..e74fa5fef0 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/workflow/AbstractWorkflowStep.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/workflow/AbstractWorkflowStep.java
@@ -1,102 +1,102 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.workflow;
-
-import java.util.Date;
-
-import org.eclipse.scout.commons.annotations.ConfigOperation;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.shared.services.common.workflow.AbstractWorkflowData;
-import org.eclipse.scout.rt.shared.services.common.workflow.AbstractWorkflowStepData;
-
-public abstract class AbstractWorkflowStep<T extends AbstractWorkflowStepData> implements IWorkflowStep<T> {
-
- public AbstractWorkflowStep() {
- initConfig();
- }
-
- /*
- * Configuration
- */
- @ConfigProperty(ConfigProperty.TEXT)
- @Order(50)
- @ConfigPropertyValue("null")
- protected String getConfiguredDefinitionText() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(60)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredDefinitionActive() {
- return false;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(10)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredFinishPossible() {
- return false;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(20)
- @ConfigPropertyValue("true")
- protected boolean getConfiguredCancelPossible() {
- return true;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(30)
- @ConfigPropertyValue("true")
- protected boolean getConfiguredSuspendPossible() {
- return true;
- }
-
- @ConfigOperation
- @Order(10)
- protected void execPrepareStep(AbstractWorkflowData data, T stepData, boolean hasNextStep) throws ProcessingException {
- }
-
- @ConfigOperation
- @Order(20)
- protected void execCompleteStep(AbstractWorkflowData data, T stepData, boolean hasNextStep) throws ProcessingException {
- stepData.setCompletionDate(new Date());
- }
-
- protected void initConfig() {
- }
-
- @Override
- public void assignDefinitions(T data) {
- if (data != null) {
- data.setDefinitionText(getConfiguredDefinitionText());
- data.setDefinitionActive(getConfiguredDefinitionActive());
- data.setFinishPossible(getConfiguredFinishPossible());
- data.setCancelPossible(getConfiguredCancelPossible());
- data.setSuspendPossible(getConfiguredSuspendPossible());
- }
- }
-
- @Override
- public void prepareStep(AbstractWorkflowData data, T stepData, boolean hasNextStep) throws ProcessingException {
- execPrepareStep(data, stepData, hasNextStep);
- }
-
- @Override
- public void completeStep(AbstractWorkflowData data, T stepData, boolean hasNextStep) throws ProcessingException {
- execCompleteStep(data, stepData, hasNextStep);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.workflow;
+
+import java.util.Date;
+
+import org.eclipse.scout.commons.annotations.ConfigOperation;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.shared.services.common.workflow.AbstractWorkflowData;
+import org.eclipse.scout.rt.shared.services.common.workflow.AbstractWorkflowStepData;
+
+public abstract class AbstractWorkflowStep<T extends AbstractWorkflowStepData> implements IWorkflowStep<T> {
+
+ public AbstractWorkflowStep() {
+ initConfig();
+ }
+
+ /*
+ * Configuration
+ */
+ @ConfigProperty(ConfigProperty.TEXT)
+ @Order(50)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredDefinitionText() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(60)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredDefinitionActive() {
+ return false;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(10)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredFinishPossible() {
+ return false;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(20)
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredCancelPossible() {
+ return true;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(30)
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredSuspendPossible() {
+ return true;
+ }
+
+ @ConfigOperation
+ @Order(10)
+ protected void execPrepareStep(AbstractWorkflowData data, T stepData, boolean hasNextStep) throws ProcessingException {
+ }
+
+ @ConfigOperation
+ @Order(20)
+ protected void execCompleteStep(AbstractWorkflowData data, T stepData, boolean hasNextStep) throws ProcessingException {
+ stepData.setCompletionDate(new Date());
+ }
+
+ protected void initConfig() {
+ }
+
+ @Override
+ public void assignDefinitions(T data) {
+ if (data != null) {
+ data.setDefinitionText(getConfiguredDefinitionText());
+ data.setDefinitionActive(getConfiguredDefinitionActive());
+ data.setFinishPossible(getConfiguredFinishPossible());
+ data.setCancelPossible(getConfiguredCancelPossible());
+ data.setSuspendPossible(getConfiguredSuspendPossible());
+ }
+ }
+
+ @Override
+ public void prepareStep(AbstractWorkflowData data, T stepData, boolean hasNextStep) throws ProcessingException {
+ execPrepareStep(data, stepData, hasNextStep);
+ }
+
+ @Override
+ public void completeStep(AbstractWorkflowData data, T stepData, boolean hasNextStep) throws ProcessingException {
+ execCompleteStep(data, stepData, hasNextStep);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/workflow/IWorkflowService.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/workflow/IWorkflowService.java
index f9072a739b..092ab88a7c 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/workflow/IWorkflowService.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/workflow/IWorkflowService.java
@@ -1,89 +1,89 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.workflow;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.shared.services.common.jdbc.SearchFilter;
-import org.eclipse.scout.rt.shared.services.common.workflow.AbstractWorkflowData;
-import org.eclipse.scout.service.IService;
-
-/**
- * A Workflow is a stateless(!) processor of workflow state machine
- */
-public interface IWorkflowService<T extends AbstractWorkflowData> extends IService {
-
- IWorkflowStep[] getSteps();
-
- <S extends IWorkflowStep> S getStepByClass(Class<S> stepClass);
-
- /**
- * @return step if it is contained in the workflow step list, null otherwise
- */
- <S extends IWorkflowStep> S resolveStep(S step);
-
- /**
- * @param filter
- * Standard sql searchFilter
- * @return specs for all available workflow types that can be used in {@link #create(T)} and {@link #resume(T)}
- */
- AbstractWorkflowData[] getAvailableWorkflowTypes(SearchFilter filter) throws ProcessingException;
-
- /**
- * @param filter
- * Standard sql searchFilter
- * @return filtered workflows accessible in the current user session
- */
- AbstractWorkflowData[] getFilteredWorkflows(SearchFilter filter) throws ProcessingException;
-
- /**
- * Create and start a new workflow based on the specification Normally either {@link T#getDefinitionNr()} is set to
- * identify the workflow type or the
- * data type itself uniquely identifies the workflow type
- *
- * @return new workflow or null in case workflow starts asynchronously
- */
- T create(T spec) throws ProcessingException;
-
- T store(T data) throws ProcessingException;
-
- /**
- * Resume an already existing workflow based on the specification At least {@link T#getWorkflowNr()} must be set to
- * identify the existing workflow
- *
- * @return resumed workflow or null in case workflow resumes asynchronously
- */
- T resume(T spec) throws ProcessingException;
-
- /**
- * Make state transition in workflow, that means that the next step is marked
- * as the new current step by calling {@link AbstractWorkflowData#advanceStepDataIndex()} Detailed: If the
- * current step is not yet completed, it is kept as current step, otherwise
- * the next step is activated
- *
- * @return workflow in new state
- */
- T makeStateTransition(T data) throws ProcessingException;
-
- /**
- * Finish and finalize workflow
- *
- * @return workflow in finished state
- */
- T finish(T data) throws ProcessingException;
-
- /**
- * Discard and finalize workflow
- *
- * @return workflow in discarded state
- */
- T discard(T data) throws ProcessingException;
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.workflow;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.shared.services.common.jdbc.SearchFilter;
+import org.eclipse.scout.rt.shared.services.common.workflow.AbstractWorkflowData;
+import org.eclipse.scout.service.IService;
+
+/**
+ * A Workflow is a stateless(!) processor of workflow state machine
+ */
+public interface IWorkflowService<T extends AbstractWorkflowData> extends IService {
+
+ IWorkflowStep[] getSteps();
+
+ <S extends IWorkflowStep> S getStepByClass(Class<S> stepClass);
+
+ /**
+ * @return step if it is contained in the workflow step list, null otherwise
+ */
+ <S extends IWorkflowStep> S resolveStep(S step);
+
+ /**
+ * @param filter
+ * Standard sql searchFilter
+ * @return specs for all available workflow types that can be used in {@link #create(T)} and {@link #resume(T)}
+ */
+ AbstractWorkflowData[] getAvailableWorkflowTypes(SearchFilter filter) throws ProcessingException;
+
+ /**
+ * @param filter
+ * Standard sql searchFilter
+ * @return filtered workflows accessible in the current user session
+ */
+ AbstractWorkflowData[] getFilteredWorkflows(SearchFilter filter) throws ProcessingException;
+
+ /**
+ * Create and start a new workflow based on the specification Normally either {@link T#getDefinitionNr()} is set to
+ * identify the workflow type or the
+ * data type itself uniquely identifies the workflow type
+ *
+ * @return new workflow or null in case workflow starts asynchronously
+ */
+ T create(T spec) throws ProcessingException;
+
+ T store(T data) throws ProcessingException;
+
+ /**
+ * Resume an already existing workflow based on the specification At least {@link T#getWorkflowNr()} must be set to
+ * identify the existing workflow
+ *
+ * @return resumed workflow or null in case workflow resumes asynchronously
+ */
+ T resume(T spec) throws ProcessingException;
+
+ /**
+ * Make state transition in workflow, that means that the next step is marked
+ * as the new current step by calling {@link AbstractWorkflowData#advanceStepDataIndex()} Detailed: If the
+ * current step is not yet completed, it is kept as current step, otherwise
+ * the next step is activated
+ *
+ * @return workflow in new state
+ */
+ T makeStateTransition(T data) throws ProcessingException;
+
+ /**
+ * Finish and finalize workflow
+ *
+ * @return workflow in finished state
+ */
+ T finish(T data) throws ProcessingException;
+
+ /**
+ * Discard and finalize workflow
+ *
+ * @return workflow in discarded state
+ */
+ T discard(T data) throws ProcessingException;
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/workflow/IWorkflowStep.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/workflow/IWorkflowStep.java
index f179d642f4..a74f7c9b6b 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/workflow/IWorkflowStep.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/workflow/IWorkflowStep.java
@@ -1,40 +1,40 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.workflow;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.shared.services.common.workflow.AbstractWorkflowData;
-import org.eclipse.scout.rt.shared.services.common.workflow.AbstractWorkflowStepData;
-
-/**
- * A WorkflowStep is a stateless(!) processor of a step in a workflow
- */
-public interface IWorkflowStep<T extends AbstractWorkflowStepData> {
-
- /**
- * Prepare the step. This method is called when a state transition has entered
- * this step When prepare fails, no save is performed
- */
- void prepareStep(AbstractWorkflowData data, T stepData, boolean hasNextStep) throws ProcessingException;
-
- /**
- * Complete the step by setting {@link AbstractWorkflowStepData#setCompleteDate()} This method is called
- * when a state transition is leaving this step
- */
- void completeStep(AbstractWorkflowData data, T stepData, boolean hasNextStep) throws ProcessingException;
-
- /**
- * set default properties on AbstractWorkflowData object
- * definitionNr,definitionText,definitionActive,definitionDoc, ...
- */
- void assignDefinitions(T data);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.workflow;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.shared.services.common.workflow.AbstractWorkflowData;
+import org.eclipse.scout.rt.shared.services.common.workflow.AbstractWorkflowStepData;
+
+/**
+ * A WorkflowStep is a stateless(!) processor of a step in a workflow
+ */
+public interface IWorkflowStep<T extends AbstractWorkflowStepData> {
+
+ /**
+ * Prepare the step. This method is called when a state transition has entered
+ * this step When prepare fails, no save is performed
+ */
+ void prepareStep(AbstractWorkflowData data, T stepData, boolean hasNextStep) throws ProcessingException;
+
+ /**
+ * Complete the step by setting {@link AbstractWorkflowStepData#setCompleteDate()} This method is called
+ * when a state transition is leaving this step
+ */
+ void completeStep(AbstractWorkflowData data, T stepData, boolean hasNextStep) throws ProcessingException;
+
+ /**
+ * set default properties on AbstractWorkflowData object
+ * definitionNr,definitionText,definitionActive,definitionDoc, ...
+ */
+ void assignDefinitions(T data);
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/workflow/WorkflowProviderService.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/workflow/WorkflowProviderService.java
index a9106dd8dd..a0f716836c 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/workflow/WorkflowProviderService.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/workflow/WorkflowProviderService.java
@@ -1,91 +1,91 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.common.workflow;
-
-import java.util.ArrayList;
-
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.shared.services.common.jdbc.SearchFilter;
-import org.eclipse.scout.rt.shared.services.common.workflow.AbstractWorkflowData;
-import org.eclipse.scout.rt.shared.services.common.workflow.IWorkflowProviderService;
-import org.eclipse.scout.service.AbstractService;
-import org.eclipse.scout.service.SERVICES;
-
-@Priority(-1)
-public class WorkflowProviderService extends AbstractService implements IWorkflowProviderService {
-
- @Override
- public AbstractWorkflowData[] getAvailableWorkflowTypes(SearchFilter filter) throws ProcessingException {
- ArrayList<AbstractWorkflowData> list = new ArrayList<AbstractWorkflowData>();
- for (IWorkflowService s : SERVICES.getServices(IWorkflowService.class)) {
- for (AbstractWorkflowData data : s.getAvailableWorkflowTypes(filter)) {
- list.add(data);
- }
- }
- return list.toArray(new AbstractWorkflowData[list.size()]);
- }
-
- @Override
- public AbstractWorkflowData[] getFilteredWorkflows(SearchFilter filter) throws ProcessingException {
- ArrayList<AbstractWorkflowData> list = new ArrayList<AbstractWorkflowData>();
- for (IWorkflowService s : SERVICES.getServices(IWorkflowService.class)) {
- for (AbstractWorkflowData data : s.getFilteredWorkflows(filter)) {
- list.add(data);
- }
- }
- return list.toArray(new AbstractWorkflowData[list.size()]);
- }
-
- @Override
- public <T extends AbstractWorkflowData> T create(T spec) throws ProcessingException {
- return findWorkflowService(spec).create(spec);
- }
-
- @Override
- public <T extends AbstractWorkflowData> T discard(T data) throws ProcessingException {
- return findWorkflowService(data).discard(data);
- }
-
- @Override
- public <T extends AbstractWorkflowData> T makeStateTransition(T data) throws ProcessingException {
- return findWorkflowService(data).makeStateTransition(data);
- }
-
- @Override
- public <T extends AbstractWorkflowData> T store(T data) throws ProcessingException {
- return findWorkflowService(data).store(data);
- }
-
- @Override
- public <T extends AbstractWorkflowData> T finish(T data) throws ProcessingException {
- return findWorkflowService(data).finish(data);
- }
-
- @Override
- public <T extends AbstractWorkflowData> T resume(T spec) throws ProcessingException {
- return findWorkflowService(spec).resume(spec);
- }
-
- @SuppressWarnings("unchecked")
- private <T extends AbstractWorkflowData> IWorkflowService<T> findWorkflowService(T spec) throws ProcessingException {
- String className = spec.getDefinitionServiceClass();
- if (className != null) {
- for (IWorkflowService s : SERVICES.getServices(IWorkflowService.class)) {
- if (s.getClass().getName().equals(className)) {
- return s;
- }
- }
- }
- throw new ProcessingException("service \"" + className + "\" not found");
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.common.workflow;
+
+import java.util.ArrayList;
+
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.shared.services.common.jdbc.SearchFilter;
+import org.eclipse.scout.rt.shared.services.common.workflow.AbstractWorkflowData;
+import org.eclipse.scout.rt.shared.services.common.workflow.IWorkflowProviderService;
+import org.eclipse.scout.service.AbstractService;
+import org.eclipse.scout.service.SERVICES;
+
+@Priority(-1)
+public class WorkflowProviderService extends AbstractService implements IWorkflowProviderService {
+
+ @Override
+ public AbstractWorkflowData[] getAvailableWorkflowTypes(SearchFilter filter) throws ProcessingException {
+ ArrayList<AbstractWorkflowData> list = new ArrayList<AbstractWorkflowData>();
+ for (IWorkflowService s : SERVICES.getServices(IWorkflowService.class)) {
+ for (AbstractWorkflowData data : s.getAvailableWorkflowTypes(filter)) {
+ list.add(data);
+ }
+ }
+ return list.toArray(new AbstractWorkflowData[list.size()]);
+ }
+
+ @Override
+ public AbstractWorkflowData[] getFilteredWorkflows(SearchFilter filter) throws ProcessingException {
+ ArrayList<AbstractWorkflowData> list = new ArrayList<AbstractWorkflowData>();
+ for (IWorkflowService s : SERVICES.getServices(IWorkflowService.class)) {
+ for (AbstractWorkflowData data : s.getFilteredWorkflows(filter)) {
+ list.add(data);
+ }
+ }
+ return list.toArray(new AbstractWorkflowData[list.size()]);
+ }
+
+ @Override
+ public <T extends AbstractWorkflowData> T create(T spec) throws ProcessingException {
+ return findWorkflowService(spec).create(spec);
+ }
+
+ @Override
+ public <T extends AbstractWorkflowData> T discard(T data) throws ProcessingException {
+ return findWorkflowService(data).discard(data);
+ }
+
+ @Override
+ public <T extends AbstractWorkflowData> T makeStateTransition(T data) throws ProcessingException {
+ return findWorkflowService(data).makeStateTransition(data);
+ }
+
+ @Override
+ public <T extends AbstractWorkflowData> T store(T data) throws ProcessingException {
+ return findWorkflowService(data).store(data);
+ }
+
+ @Override
+ public <T extends AbstractWorkflowData> T finish(T data) throws ProcessingException {
+ return findWorkflowService(data).finish(data);
+ }
+
+ @Override
+ public <T extends AbstractWorkflowData> T resume(T spec) throws ProcessingException {
+ return findWorkflowService(spec).resume(spec);
+ }
+
+ @SuppressWarnings("unchecked")
+ private <T extends AbstractWorkflowData> IWorkflowService<T> findWorkflowService(T spec) throws ProcessingException {
+ String className = spec.getDefinitionServiceClass();
+ if (className != null) {
+ for (IWorkflowService s : SERVICES.getServices(IWorkflowService.class)) {
+ if (s.getClass().getName().equals(className)) {
+ return s;
+ }
+ }
+ }
+ throw new ProcessingException("service \"" + className + "\" not found");
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/lookup/AbstractLookupService.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/lookup/AbstractLookupService.java
index 162bfbd9b7..4363a2c66b 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/lookup/AbstractLookupService.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/lookup/AbstractLookupService.java
@@ -1,77 +1,77 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.lookup;
-
-import java.util.ArrayList;
-
-import org.eclipse.scout.commons.MatrixUtility;
-import org.eclipse.scout.commons.TriState;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.shared.services.lookup.ILookupService;
-import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
-import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
-import org.eclipse.scout.service.AbstractService;
-
-/**
- * <h4>AbstractLookupService</h4>
- */
-public abstract class AbstractLookupService extends AbstractService implements ILookupService {
-
- /**
- * Convenience function to sort data for later call to {@link #createLookupRowArray(Object[][], LookupCall)}.<br>
- * The sort indices are 0-based.
- */
- public static void sortData(Object[][] data, int... sortColumns) {
- MatrixUtility.sort(data, sortColumns);
- }
-
- /**
- * @see #createLookupRowArray(Object[][], int, LookupCall)
- */
- public static LookupRow[] createLookupRowArray(Object[][] data, LookupCall call) throws ProcessingException {
- return createLookupRowArray(data, data != null && data.length > 0 ? data[0].length : 0, call);
- }
-
- /**
- * Convenience function to transform Object[][] data into LookupRow[]
- *
- * @param maxColumnIndex
- * the maximum column index to be used to create the code rows, all
- * column indexes >= columnCount are ignored
- * <p>
- * The Object[][] must contain rows with the elements in the following order:
- * <ul>
- * <li>Object key
- * <li>String text
- * <li>String iconId
- * <li>String tooltip
- * <li>String background color
- * <li>String foreground color
- * <li>String font
- * <li>Boolean enabled
- * <li>Object parentKey used in hierarchical structures to point to the parents primary key
- * <li>Boolean active (0,1) see {@link TriState#parseTriState(Object)}
- * </ul>
- */
- public static LookupRow[] createLookupRowArray(Object[][] data, int maxColumnIndex, LookupCall call) throws ProcessingException {
- ArrayList<LookupRow> list = new ArrayList<LookupRow>(data.length);
- Boolean active = call.getActive().getBooleanValue();
- for (int i = 0; i < data.length; i++) {
- LookupRow row = new LookupRow(data[i], maxColumnIndex);
- // check active flag
- if (active == null || active.booleanValue() == row.isActive()) {
- list.add(row);
- }
- }
- return list.toArray(new LookupRow[list.size()]);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.lookup;
+
+import java.util.ArrayList;
+
+import org.eclipse.scout.commons.MatrixUtility;
+import org.eclipse.scout.commons.TriState;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.shared.services.lookup.ILookupService;
+import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
+import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
+import org.eclipse.scout.service.AbstractService;
+
+/**
+ * <h4>AbstractLookupService</h4>
+ */
+public abstract class AbstractLookupService extends AbstractService implements ILookupService {
+
+ /**
+ * Convenience function to sort data for later call to {@link #createLookupRowArray(Object[][], LookupCall)}.<br>
+ * The sort indices are 0-based.
+ */
+ public static void sortData(Object[][] data, int... sortColumns) {
+ MatrixUtility.sort(data, sortColumns);
+ }
+
+ /**
+ * @see #createLookupRowArray(Object[][], int, LookupCall)
+ */
+ public static LookupRow[] createLookupRowArray(Object[][] data, LookupCall call) throws ProcessingException {
+ return createLookupRowArray(data, data != null && data.length > 0 ? data[0].length : 0, call);
+ }
+
+ /**
+ * Convenience function to transform Object[][] data into LookupRow[]
+ *
+ * @param maxColumnIndex
+ * the maximum column index to be used to create the code rows, all
+ * column indexes >= columnCount are ignored
+ * <p>
+ * The Object[][] must contain rows with the elements in the following order:
+ * <ul>
+ * <li>Object key
+ * <li>String text
+ * <li>String iconId
+ * <li>String tooltip
+ * <li>String background color
+ * <li>String foreground color
+ * <li>String font
+ * <li>Boolean enabled
+ * <li>Object parentKey used in hierarchical structures to point to the parents primary key
+ * <li>Boolean active (0,1) see {@link TriState#parseTriState(Object)}
+ * </ul>
+ */
+ public static LookupRow[] createLookupRowArray(Object[][] data, int maxColumnIndex, LookupCall call) throws ProcessingException {
+ ArrayList<LookupRow> list = new ArrayList<LookupRow>(data.length);
+ Boolean active = call.getActive().getBooleanValue();
+ for (int i = 0; i < data.length; i++) {
+ LookupRow row = new LookupRow(data[i], maxColumnIndex);
+ // check active flag
+ if (active == null || active.booleanValue() == row.isActive()) {
+ list.add(row);
+ }
+ }
+ return list.toArray(new LookupRow[list.size()]);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/lookup/AbstractSqlLookupService.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/lookup/AbstractSqlLookupService.java
index 1544dc2ccb..25a76b57f2 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/lookup/AbstractSqlLookupService.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/lookup/AbstractSqlLookupService.java
@@ -1,169 +1,169 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.lookup;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.TriState;
-import org.eclipse.scout.commons.annotations.ConfigOperation;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.exception.VetoException;
-import org.eclipse.scout.rt.server.services.common.jdbc.ISqlService;
-import org.eclipse.scout.rt.server.services.common.jdbc.SQL;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
-import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
-import org.eclipse.scout.service.SERVICES;
-
-/**
- * Sql SELECT statement for getting {@link LookupRow}s.<br>
- * <p>
- * The expected columns are
- * <ul>
- * <li>Object key
- * <li>String text
- * <li>String iconId
- * <li>String tooltip
- * <li>String background color
- * <li>String foreground color
- * <li>String font
- * <li>Boolean enabled
- * <li>Object parentKey used in hierarchical structures to point to the parents primary key
- * <li>{@link TriState} active (0,1,null,...) see {@link TriState#parseTriState(Object)}
- * </ul>
- * <p>
- * Valid bind names are: Object key, String text, String all, Object rec, {@link TriState} active<br>
- * Valid xml tags are: &lt;key&gt;, &lt;text&gt;, &lt;all&gt;, &lt;rec&gt;
- */
-public abstract class AbstractSqlLookupService extends AbstractLookupService {
-
- public AbstractSqlLookupService() {
- }
-
- /**
- * Sql SELECT statement
- */
- @ConfigProperty(ConfigProperty.SQL)
- @Order(10)
- @ConfigPropertyValue("null")
- protected String getConfiguredSqlSelect() {
- return null;
- }
-
- /**
- * sort column 0-based. -1 if sort is done in sql.
- */
- @ConfigProperty(ConfigProperty.INTEGER)
- @Order(20)
- @ConfigPropertyValue("1")
- protected int getConfiguredSortColumn() {
- return 1;
- }
-
- /**
- * This method is called on server side to load lookup rows.
- */
- @ConfigOperation
- @Order(10)
- protected LookupRow[] execLoadLookupRows(String originalSql, String preprocessedSql, LookupCall call) throws ProcessingException {
- Object[][] data = SQL.selectLimited(preprocessedSql, call.getMaxRowCount(), call);
- if (getConfiguredSortColumn() >= 0) {
- sortData(data, getConfiguredSortColumn());
- }
- return createLookupRowArray(data, call);
- }
-
- @Override
- public LookupRow[] getDataByKey(LookupCall call) throws ProcessingException {
- String sql = getConfiguredSqlSelect();
- return execLoadLookupRows(sql, filterSqlByKey(sql), call);
- }
-
- @Override
- public LookupRow[] getDataByText(LookupCall call) throws ProcessingException {
- // change wildcards * in text to db specific wildcards
- if (call.getText() != null) {
- String s = call.getText();
- String sqlWildcard = SERVICES.getService(ISqlService.class).getSqlStyle().getLikeWildcard();
- call.setText(s.replaceAll("[*]", sqlWildcard));
- }
- String sql = getConfiguredSqlSelect();
- return execLoadLookupRows(sql, filterSqlByText(sql), call);
- }
-
- @Override
- public LookupRow[] getDataByAll(LookupCall call) throws ProcessingException {
- String sql = getConfiguredSqlSelect();
- if (containsRefusingAllTag(sql)) {
- throw new VetoException(ScoutTexts.get("SearchTextIsTooGeneral"));
- }
- LookupRow[] rows = execLoadLookupRows(sql, filterSqlByAll(sql), call);
- return rows;
- }
-
- @Override
- public LookupRow[] getDataByRec(LookupCall call) throws ProcessingException {
- String sql = getConfiguredSqlSelect();
- return execLoadLookupRows(sql, filterSqlByRec(sql), call);
- }
-
- /**
- * Process xml tags.<br>
- * Keep content of "key" tag.<br>
- * Remove text,all,rec tags.
- */
- protected String filterSqlByKey(String sqlSelect) {
- return StringUtility.removeTagBounds(StringUtility.removeTags(sqlSelect, new String[]{"text", "all", "rec"}), "key");
- }
-
- /**
- * Process xml tags.<br>
- * Keep content of "text" tag.<br>
- * Remove key,all,rec tags.
- */
- protected String filterSqlByText(String sqlSelect) {
- return StringUtility.removeTagBounds(StringUtility.removeTags(sqlSelect, new String[]{"key", "all", "rec"}), "text");
- }
-
- /**
- * Process xml tags.<br>
- * Keep content of "all" tag.<br>
- * Remove key,text,rec tags.
- */
- protected String filterSqlByAll(String sqlSelect) {
- return StringUtility.removeTagBounds(StringUtility.removeTags(sqlSelect, new String[]{"key", "text", "rec"}), "all");
- }
-
- protected static boolean containsRefusingAllTag(String sqlSelect) {
- Matcher m = Pattern.compile("<all>\\s*and\\s*([0-9]+)\\s*=\\s*([0-9]+)\\s*</all>", Pattern.DOTALL).matcher(sqlSelect.toLowerCase());
- if (m.find()) {
- if (!m.group(1).equals(m.group(2))) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Process xml tags.<br>
- * Keep content of "rec" tag.<br>
- * Remove key,text,all tags.
- */
- protected String filterSqlByRec(String sqlSelect) {
- return StringUtility.removeTagBounds(StringUtility.removeTags(sqlSelect, new String[]{"key", "text", "all"}), "rec");
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.lookup;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.TriState;
+import org.eclipse.scout.commons.annotations.ConfigOperation;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.exception.VetoException;
+import org.eclipse.scout.rt.server.services.common.jdbc.ISqlService;
+import org.eclipse.scout.rt.server.services.common.jdbc.SQL;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
+import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
+import org.eclipse.scout.service.SERVICES;
+
+/**
+ * Sql SELECT statement for getting {@link LookupRow}s.<br>
+ * <p>
+ * The expected columns are
+ * <ul>
+ * <li>Object key
+ * <li>String text
+ * <li>String iconId
+ * <li>String tooltip
+ * <li>String background color
+ * <li>String foreground color
+ * <li>String font
+ * <li>Boolean enabled
+ * <li>Object parentKey used in hierarchical structures to point to the parents primary key
+ * <li>{@link TriState} active (0,1,null,...) see {@link TriState#parseTriState(Object)}
+ * </ul>
+ * <p>
+ * Valid bind names are: Object key, String text, String all, Object rec, {@link TriState} active<br>
+ * Valid xml tags are: &lt;key&gt;, &lt;text&gt;, &lt;all&gt;, &lt;rec&gt;
+ */
+public abstract class AbstractSqlLookupService extends AbstractLookupService {
+
+ public AbstractSqlLookupService() {
+ }
+
+ /**
+ * Sql SELECT statement
+ */
+ @ConfigProperty(ConfigProperty.SQL)
+ @Order(10)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredSqlSelect() {
+ return null;
+ }
+
+ /**
+ * sort column 0-based. -1 if sort is done in sql.
+ */
+ @ConfigProperty(ConfigProperty.INTEGER)
+ @Order(20)
+ @ConfigPropertyValue("1")
+ protected int getConfiguredSortColumn() {
+ return 1;
+ }
+
+ /**
+ * This method is called on server side to load lookup rows.
+ */
+ @ConfigOperation
+ @Order(10)
+ protected LookupRow[] execLoadLookupRows(String originalSql, String preprocessedSql, LookupCall call) throws ProcessingException {
+ Object[][] data = SQL.selectLimited(preprocessedSql, call.getMaxRowCount(), call);
+ if (getConfiguredSortColumn() >= 0) {
+ sortData(data, getConfiguredSortColumn());
+ }
+ return createLookupRowArray(data, call);
+ }
+
+ @Override
+ public LookupRow[] getDataByKey(LookupCall call) throws ProcessingException {
+ String sql = getConfiguredSqlSelect();
+ return execLoadLookupRows(sql, filterSqlByKey(sql), call);
+ }
+
+ @Override
+ public LookupRow[] getDataByText(LookupCall call) throws ProcessingException {
+ // change wildcards * in text to db specific wildcards
+ if (call.getText() != null) {
+ String s = call.getText();
+ String sqlWildcard = SERVICES.getService(ISqlService.class).getSqlStyle().getLikeWildcard();
+ call.setText(s.replaceAll("[*]", sqlWildcard));
+ }
+ String sql = getConfiguredSqlSelect();
+ return execLoadLookupRows(sql, filterSqlByText(sql), call);
+ }
+
+ @Override
+ public LookupRow[] getDataByAll(LookupCall call) throws ProcessingException {
+ String sql = getConfiguredSqlSelect();
+ if (containsRefusingAllTag(sql)) {
+ throw new VetoException(ScoutTexts.get("SearchTextIsTooGeneral"));
+ }
+ LookupRow[] rows = execLoadLookupRows(sql, filterSqlByAll(sql), call);
+ return rows;
+ }
+
+ @Override
+ public LookupRow[] getDataByRec(LookupCall call) throws ProcessingException {
+ String sql = getConfiguredSqlSelect();
+ return execLoadLookupRows(sql, filterSqlByRec(sql), call);
+ }
+
+ /**
+ * Process xml tags.<br>
+ * Keep content of "key" tag.<br>
+ * Remove text,all,rec tags.
+ */
+ protected String filterSqlByKey(String sqlSelect) {
+ return StringUtility.removeTagBounds(StringUtility.removeTags(sqlSelect, new String[]{"text", "all", "rec"}), "key");
+ }
+
+ /**
+ * Process xml tags.<br>
+ * Keep content of "text" tag.<br>
+ * Remove key,all,rec tags.
+ */
+ protected String filterSqlByText(String sqlSelect) {
+ return StringUtility.removeTagBounds(StringUtility.removeTags(sqlSelect, new String[]{"key", "all", "rec"}), "text");
+ }
+
+ /**
+ * Process xml tags.<br>
+ * Keep content of "all" tag.<br>
+ * Remove key,text,rec tags.
+ */
+ protected String filterSqlByAll(String sqlSelect) {
+ return StringUtility.removeTagBounds(StringUtility.removeTags(sqlSelect, new String[]{"key", "text", "rec"}), "all");
+ }
+
+ protected static boolean containsRefusingAllTag(String sqlSelect) {
+ Matcher m = Pattern.compile("<all>\\s*and\\s*([0-9]+)\\s*=\\s*([0-9]+)\\s*</all>", Pattern.DOTALL).matcher(sqlSelect.toLowerCase());
+ if (m.find()) {
+ if (!m.group(1).equals(m.group(2))) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Process xml tags.<br>
+ * Keep content of "rec" tag.<br>
+ * Remove key,text,all tags.
+ */
+ protected String filterSqlByRec(String sqlSelect) {
+ return StringUtility.removeTagBounds(StringUtility.removeTags(sqlSelect, new String[]{"key", "text", "all"}), "rec");
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/lookup/BatchLookupService.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/lookup/BatchLookupService.java
index 7735a228f9..3bb1709f1f 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/lookup/BatchLookupService.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/lookup/BatchLookupService.java
@@ -1,72 +1,72 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.services.lookup;
-
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.shared.services.lookup.BatchLookupCall;
-import org.eclipse.scout.rt.shared.services.lookup.BatchLookupResultCache;
-import org.eclipse.scout.rt.shared.services.lookup.IBatchLookupService;
-import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
-import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
-import org.eclipse.scout.service.AbstractService;
-
-@Priority(-1)
-public class BatchLookupService extends AbstractService implements IBatchLookupService {
-
- public BatchLookupService() {
- }
-
- @Override
- public LookupRow[][] getBatchDataByKey(BatchLookupCall batch) throws ProcessingException {
- LookupCall[] calls = batch.getCallBatch();
- LookupRow[][] resultArray = new LookupRow[calls.length][];
- BatchLookupResultCache cache = new BatchLookupResultCache();
- for (int i = 0; i < calls.length; i++) {
- resultArray[i] = cache.getDataByKey(calls[i]);
- }
- return resultArray;
- }
-
- @Override
- public LookupRow[][] getBatchDataByText(BatchLookupCall batch) throws ProcessingException {
- LookupCall[] calls = batch.getCallBatch();
- LookupRow[][] resultArray = new LookupRow[calls.length][];
- BatchLookupResultCache cache = new BatchLookupResultCache();
- for (int i = 0; i < calls.length; i++) {
- resultArray[i] = cache.getDataByText(calls[i]);
- }
- return resultArray;
- }
-
- @Override
- public LookupRow[][] getBatchDataByAll(BatchLookupCall batch) throws ProcessingException {
- LookupCall[] calls = batch.getCallBatch();
- LookupRow[][] resultArray = new LookupRow[calls.length][];
- BatchLookupResultCache cache = new BatchLookupResultCache();
- for (int i = 0; i < calls.length; i++) {
- resultArray[i] = cache.getDataByAll(calls[i]);
- }
- return resultArray;
- }
-
- @Override
- public LookupRow[][] getBatchDataByRec(BatchLookupCall batch) throws ProcessingException {
- LookupCall[] calls = batch.getCallBatch();
- LookupRow[][] resultArray = new LookupRow[calls.length][];
- BatchLookupResultCache cache = new BatchLookupResultCache();
- for (int i = 0; i < calls.length; i++) {
- resultArray[i] = cache.getDataByRec(calls[i]);
- }
- return resultArray;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.services.lookup;
+
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.shared.services.lookup.BatchLookupCall;
+import org.eclipse.scout.rt.shared.services.lookup.BatchLookupResultCache;
+import org.eclipse.scout.rt.shared.services.lookup.IBatchLookupService;
+import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
+import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
+import org.eclipse.scout.service.AbstractService;
+
+@Priority(-1)
+public class BatchLookupService extends AbstractService implements IBatchLookupService {
+
+ public BatchLookupService() {
+ }
+
+ @Override
+ public LookupRow[][] getBatchDataByKey(BatchLookupCall batch) throws ProcessingException {
+ LookupCall[] calls = batch.getCallBatch();
+ LookupRow[][] resultArray = new LookupRow[calls.length][];
+ BatchLookupResultCache cache = new BatchLookupResultCache();
+ for (int i = 0; i < calls.length; i++) {
+ resultArray[i] = cache.getDataByKey(calls[i]);
+ }
+ return resultArray;
+ }
+
+ @Override
+ public LookupRow[][] getBatchDataByText(BatchLookupCall batch) throws ProcessingException {
+ LookupCall[] calls = batch.getCallBatch();
+ LookupRow[][] resultArray = new LookupRow[calls.length][];
+ BatchLookupResultCache cache = new BatchLookupResultCache();
+ for (int i = 0; i < calls.length; i++) {
+ resultArray[i] = cache.getDataByText(calls[i]);
+ }
+ return resultArray;
+ }
+
+ @Override
+ public LookupRow[][] getBatchDataByAll(BatchLookupCall batch) throws ProcessingException {
+ LookupCall[] calls = batch.getCallBatch();
+ LookupRow[][] resultArray = new LookupRow[calls.length][];
+ BatchLookupResultCache cache = new BatchLookupResultCache();
+ for (int i = 0; i < calls.length; i++) {
+ resultArray[i] = cache.getDataByAll(calls[i]);
+ }
+ return resultArray;
+ }
+
+ @Override
+ public LookupRow[][] getBatchDataByRec(BatchLookupCall batch) throws ProcessingException {
+ LookupCall[] calls = batch.getCallBatch();
+ LookupRow[][] resultArray = new LookupRow[calls.length][];
+ BatchLookupResultCache cache = new BatchLookupResultCache();
+ for (int i = 0; i < calls.length; i++) {
+ resultArray[i] = cache.getDataByRec(calls[i]);
+ }
+ return resultArray;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/servlet/filter/AbstractChainableSecurityFilter.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/servlet/filter/AbstractChainableSecurityFilter.java
index a13034ef87..0def04dc9e 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/servlet/filter/AbstractChainableSecurityFilter.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/servlet/filter/AbstractChainableSecurityFilter.java
@@ -1,20 +1,20 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.servlet.filter;
-
-/**
- * @see {@link org.eclipse.scout.http.servletfilter.security.AbstractChainableSecurityFilter}
- * @deprecated use {@link org.eclipse.scout.http.servletfilter.security.AbstractChainableSecurityFilter} instead.
- */
-@Deprecated
-public abstract class AbstractChainableSecurityFilter extends org.eclipse.scout.http.servletfilter.security.AbstractChainableSecurityFilter {
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.servlet.filter;
+
+/**
+ * @see {@link org.eclipse.scout.http.servletfilter.security.AbstractChainableSecurityFilter}
+ * @deprecated use {@link org.eclipse.scout.http.servletfilter.security.AbstractChainableSecurityFilter} instead.
+ */
+@Deprecated
+public abstract class AbstractChainableSecurityFilter extends org.eclipse.scout.http.servletfilter.security.AbstractChainableSecurityFilter {
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/servlet/filter/AnonymousSecurityFilter.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/servlet/filter/AnonymousSecurityFilter.java
index 5790c8db3e..1663fdb1bd 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/servlet/filter/AnonymousSecurityFilter.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/servlet/filter/AnonymousSecurityFilter.java
@@ -1,20 +1,20 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.servlet.filter;
-
-/**
- * @see {@link org.eclipse.scout.http.servletfilter.security.AnonymousSecurityFilter}
- * @deprecated use {@link org.eclipse.scout.http.servletfilter.security.AnonymousSecurityFilter} instead.
- */
-@Deprecated
-public class AnonymousSecurityFilter extends org.eclipse.scout.http.servletfilter.security.AnonymousSecurityFilter {
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.servlet.filter;
+
+/**
+ * @see {@link org.eclipse.scout.http.servletfilter.security.AnonymousSecurityFilter}
+ * @deprecated use {@link org.eclipse.scout.http.servletfilter.security.AnonymousSecurityFilter} instead.
+ */
+@Deprecated
+public class AnonymousSecurityFilter extends org.eclipse.scout.http.servletfilter.security.AnonymousSecurityFilter {
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/servlet/filter/BasicSecurityFilter.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/servlet/filter/BasicSecurityFilter.java
index 263388da99..50c9ebd99c 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/servlet/filter/BasicSecurityFilter.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/servlet/filter/BasicSecurityFilter.java
@@ -1,20 +1,20 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.servlet.filter;
-
-
-/**
- * @see {@link org.eclipse.scout.http.servletfilter.security.BasicSecurityFilter}
- * @deprecated use {@link org.eclipse.scout.http.servletfilter.security.BasicSecurityFilter} instead.
- */
-@Deprecated
-public class BasicSecurityFilter extends org.eclipse.scout.http.servletfilter.security.BasicSecurityFilter {
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.servlet.filter;
+
+
+/**
+ * @see {@link org.eclipse.scout.http.servletfilter.security.BasicSecurityFilter}
+ * @deprecated use {@link org.eclipse.scout.http.servletfilter.security.BasicSecurityFilter} instead.
+ */
+@Deprecated
+public class BasicSecurityFilter extends org.eclipse.scout.http.servletfilter.security.BasicSecurityFilter {
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/servlet/filter/DataSourceSecurityFilter.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/servlet/filter/DataSourceSecurityFilter.java
index e499efad0c..107ee0085b 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/servlet/filter/DataSourceSecurityFilter.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/servlet/filter/DataSourceSecurityFilter.java
@@ -1,19 +1,19 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.servlet.filter;
-
-/**
- * @see {@link org.eclipse.scout.http.servletfilter.security.DataSourceSecurityFilter}
- * @deprecated use {@link org.eclipse.scout.http.servletfilter.security.DataSourceSecurityFilter} instead.
- */
-@Deprecated
-public class DataSourceSecurityFilter extends org.eclipse.scout.http.servletfilter.security.DataSourceSecurityFilter {
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.servlet.filter;
+
+/**
+ * @see {@link org.eclipse.scout.http.servletfilter.security.DataSourceSecurityFilter}
+ * @deprecated use {@link org.eclipse.scout.http.servletfilter.security.DataSourceSecurityFilter} instead.
+ */
+@Deprecated
+public class DataSourceSecurityFilter extends org.eclipse.scout.http.servletfilter.security.DataSourceSecurityFilter {
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/servlet/filter/LDAPSecurityFilter.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/servlet/filter/LDAPSecurityFilter.java
index e944f4a6fb..bc4fe79ab0 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/servlet/filter/LDAPSecurityFilter.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/servlet/filter/LDAPSecurityFilter.java
@@ -1,20 +1,20 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.servlet.filter;
-
-
-/**
- * @see {@link org.eclipse.scout.http.servletfilter.security.LDAPSecurityFilter}
- * @deprecated use {@link org.eclipse.scout.http.servletfilter.security.LDAPSecurityFilter} instead.
- */
-@Deprecated
-public class LDAPSecurityFilter extends org.eclipse.scout.http.servletfilter.security.LDAPSecurityFilter {
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.servlet.filter;
+
+
+/**
+ * @see {@link org.eclipse.scout.http.servletfilter.security.LDAPSecurityFilter}
+ * @deprecated use {@link org.eclipse.scout.http.servletfilter.security.LDAPSecurityFilter} instead.
+ */
+@Deprecated
+public class LDAPSecurityFilter extends org.eclipse.scout.http.servletfilter.security.LDAPSecurityFilter {
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/servlet/filter/TomcatSecurityFilter.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/servlet/filter/TomcatSecurityFilter.java
index ccd4ed0b7d..7ddfdea053 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/servlet/filter/TomcatSecurityFilter.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/servlet/filter/TomcatSecurityFilter.java
@@ -1,19 +1,19 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.servlet.filter;
-
-/**
- * @see {@link org.eclipse.scout.http.servletfilter.security.TomcatSecurityFilter}
- * @deprecated use {@link org.eclipse.scout.http.servletfilter.security.TomcatSecurityFilter} instead.
- */
-@Deprecated
-public class TomcatSecurityFilter extends org.eclipse.scout.http.servletfilter.security.TomcatSecurityFilter {
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.servlet.filter;
+
+/**
+ * @see {@link org.eclipse.scout.http.servletfilter.security.TomcatSecurityFilter}
+ * @deprecated use {@link org.eclipse.scout.http.servletfilter.security.TomcatSecurityFilter} instead.
+ */
+@Deprecated
+public class TomcatSecurityFilter extends org.eclipse.scout.http.servletfilter.security.TomcatSecurityFilter {
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/servlet/test/TestServlet.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/servlet/test/TestServlet.java
index db237704e6..c205f87d13 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/servlet/test/TestServlet.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/servlet/test/TestServlet.java
@@ -1,221 +1,221 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.servlet.test;
-
-import java.io.IOException;
-import java.io.PrintStream;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.text.MessageFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import javax.security.auth.Subject;
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.exception.IProcessingStatus;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.security.SimplePrincipal;
-import org.eclipse.scout.http.servletfilter.HttpServletEx;
-import org.eclipse.scout.rt.server.IServerSession;
-import org.eclipse.scout.rt.server.ServerJob;
-import org.eclipse.scout.rt.server.services.common.session.IServerSessionRegistryService;
-import org.eclipse.scout.rt.shared.services.common.test.BasicTestContext;
-import org.eclipse.scout.rt.shared.services.common.test.ITest;
-import org.eclipse.scout.rt.shared.services.common.test.TestStatus;
-import org.eclipse.scout.rt.shared.services.common.test.TestUtility;
-import org.eclipse.scout.service.SERVICES;
-
-/**
- * Typically this servlet is registered in the
- * org.eclipse.scout.commons.servlets extension in your project. It must provide
- * the init-parameters
- * <ul>
- * <li>session</li>
- * <li>runAs</li>
- * </ul>
- */
-public class TestServlet extends HttpServletEx {
- private static final long serialVersionUID = 1L;
-
- private Class<? extends IServerSession> m_serverSessionClass;
- private String m_runAs;
-
- @SuppressWarnings("unchecked")
- @Override
- public void init(ServletConfig config) throws ServletException {
- super.init(config);
- String qname = config.getInitParameter("session");
- if (qname == null) {
- throw new ServletException("Expected init-param \"session\"");
- }
- String runAs = config.getInitParameter("runAs");
- if (runAs == null) {
- throw new ServletException("Expected init-param \"runAs\"");
- }
- //
- int i = qname.lastIndexOf('.');
- try {
- m_serverSessionClass = (Class<? extends IServerSession>) Platform.getBundle(qname.substring(0, i)).loadClass(qname);
- }
- catch (ClassNotFoundException e) {
- throw new ServletException("Loading class " + qname, e);
- }
- m_runAs = runAs;
- }
-
- @Override
- public void destroy() {
- m_serverSessionClass = null;
- m_runAs = null;
- }
-
- @Override
- protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
- res.setContentType("text/html");
- final BasicTestContext ctx = new BasicTestContext();
- Subject subject = new Subject();
- subject.getPrincipals().add(new SimplePrincipal(m_runAs));
- IServerSession serverSession;
- try {
- serverSession = SERVICES.getService(IServerSessionRegistryService.class).newServerSession(m_serverSessionClass, subject);
- }
- catch (ProcessingException e) {
- e.printStackTrace(new PrintStream(res.getOutputStream(), true));
- return;
- }
- IStatus status = new ServerJob("Test", serverSession, subject) {
- @Override
- protected IStatus runTransaction(IProgressMonitor monitor) throws Exception {
- ITest[] tests = SERVICES.getServices(ITest.class);
- TestUtility.runTests(ctx, tests);
- return Status.OK_STATUS;
- }
- }.runNow(new NullProgressMonitor());
- if (!status.isOK()) {
- status.getException().printStackTrace(new PrintStream(res.getOutputStream(), true));
- }
- //
- StringBuffer records = new StringBuffer();
- for (TestStatus s : ctx.getStatusList()) {
- getTestRecordTemplate();
- String severityColor;
- switch (s.getSeverity()) {
- case IProcessingStatus.INFO: {
- severityColor = "00ff00";
- break;
- }
- case IProcessingStatus.WARNING: {
- severityColor = "ffff00";
- break;
- }
- case IProcessingStatus.ERROR: {
- severityColor = "ff0000";
- break;
- }
- case IProcessingStatus.FATAL: {
- severityColor = "880000";
- break;
- }
- default: {
- severityColor = "ffffff";
- }
- }
- String product = StringUtility.htmlEncode(s.getProduct(), true);
- String title = StringUtility.htmlEncode(s.getTitle(), true);
- String subTitle = StringUtility.htmlEncode(s.getSubTitle(), true);
- String message = StringUtility.htmlEncode(s.getMessage(), true);
- String detail;
- if (s.getCause() != null) {
- StringWriter w = new StringWriter();
- s.getCause().printStackTrace(new PrintWriter(w, true));
- detail = "<textarea rows=\"4\" cols=\"80\">" + StringUtility.htmlEncode(w.toString(), true) + "</textarea>";
- message += "<br>" + detail;
- }
- records.append(MessageFormat.format(
- getTestRecordTemplate(),
- severityColor,
- product,
- title,
- subTitle,
- message
- ));
- }
- //
- String date = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss").format(new Date());
- String page = MessageFormat.format(
- getPageTemplate(),
- date,
- ctx.getSeverityCount(TestStatus.INFO),
- ctx.getSeverityCount(TestStatus.WARNING),
- ctx.getSeverityCount(TestStatus.ERROR),
- ctx.getSeverityCount(TestStatus.FATAL),
- records.toString()
- );
- //
- res.getOutputStream().print(page);
- }
-
- /**
- * @return the template for the html page containing the variables {0} =
- * date/time of test {1} = ok count {2} = warning count {3} = error
- * count {4} = fatal count {5} = list of all test statis
- */
- protected String getPageTemplate() {
- return "<html><body>\n" +
- "<h1>Automated Test Run</h1>\n" +
- "<h3>{0}</h3>\n" +
- "<table border=\"0\">\n" +
- "<tr><td>{1}</td><td>Success</td></tr>\n" +
- "<tr><td>{2}</td><td>Warnings</td></tr>\n" +
- "<tr><td>{3}</td><td>Errors</td></tr>\n" +
- "<tr><td>{4}</td><td>Fatals</td></tr>\n" +
- "</table>\n" +
- "<hr>\n" +
- "<table border=\"1\">\n" +
- "{5}" +
- "</table>\n" +
- "</body></html>";
- }
-
- /**
- * @return the template of a test status record {0} = severity color
- * (Ok=00ff00 (green), Warning=ffff00 (yellow), Error=ff0000 (red),
- * Fatal=880000 (dark red)) {1} = product {2} = title {3} = subTitle
- * {4} = message
- */
- protected String getTestRecordTemplate() {
- return "<tr>\n" +
- "<td bgcolor=\"{0}\" valign=\"top\">\n" +
- "<b>{1}</b>\n" +
- "</td>\n" +
- "<td valign=\"top\">\n" +
- "<b>{2}</b>\n" +
- "</td>\n" +
- "<td valign=\"top\">\n" +
- "{3}\n" +
- "</td>\n" +
- "<td valign=\"top\">\n" +
- "{4}\n" +
- "</td>\n" +
- "</tr>\n";
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.servlet.test;
+
+import java.io.IOException;
+import java.io.PrintStream;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.text.MessageFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import javax.security.auth.Subject;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.exception.IProcessingStatus;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.security.SimplePrincipal;
+import org.eclipse.scout.http.servletfilter.HttpServletEx;
+import org.eclipse.scout.rt.server.IServerSession;
+import org.eclipse.scout.rt.server.ServerJob;
+import org.eclipse.scout.rt.server.services.common.session.IServerSessionRegistryService;
+import org.eclipse.scout.rt.shared.services.common.test.BasicTestContext;
+import org.eclipse.scout.rt.shared.services.common.test.ITest;
+import org.eclipse.scout.rt.shared.services.common.test.TestStatus;
+import org.eclipse.scout.rt.shared.services.common.test.TestUtility;
+import org.eclipse.scout.service.SERVICES;
+
+/**
+ * Typically this servlet is registered in the
+ * org.eclipse.scout.commons.servlets extension in your project. It must provide
+ * the init-parameters
+ * <ul>
+ * <li>session</li>
+ * <li>runAs</li>
+ * </ul>
+ */
+public class TestServlet extends HttpServletEx {
+ private static final long serialVersionUID = 1L;
+
+ private Class<? extends IServerSession> m_serverSessionClass;
+ private String m_runAs;
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public void init(ServletConfig config) throws ServletException {
+ super.init(config);
+ String qname = config.getInitParameter("session");
+ if (qname == null) {
+ throw new ServletException("Expected init-param \"session\"");
+ }
+ String runAs = config.getInitParameter("runAs");
+ if (runAs == null) {
+ throw new ServletException("Expected init-param \"runAs\"");
+ }
+ //
+ int i = qname.lastIndexOf('.');
+ try {
+ m_serverSessionClass = (Class<? extends IServerSession>) Platform.getBundle(qname.substring(0, i)).loadClass(qname);
+ }
+ catch (ClassNotFoundException e) {
+ throw new ServletException("Loading class " + qname, e);
+ }
+ m_runAs = runAs;
+ }
+
+ @Override
+ public void destroy() {
+ m_serverSessionClass = null;
+ m_runAs = null;
+ }
+
+ @Override
+ protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
+ res.setContentType("text/html");
+ final BasicTestContext ctx = new BasicTestContext();
+ Subject subject = new Subject();
+ subject.getPrincipals().add(new SimplePrincipal(m_runAs));
+ IServerSession serverSession;
+ try {
+ serverSession = SERVICES.getService(IServerSessionRegistryService.class).newServerSession(m_serverSessionClass, subject);
+ }
+ catch (ProcessingException e) {
+ e.printStackTrace(new PrintStream(res.getOutputStream(), true));
+ return;
+ }
+ IStatus status = new ServerJob("Test", serverSession, subject) {
+ @Override
+ protected IStatus runTransaction(IProgressMonitor monitor) throws Exception {
+ ITest[] tests = SERVICES.getServices(ITest.class);
+ TestUtility.runTests(ctx, tests);
+ return Status.OK_STATUS;
+ }
+ }.runNow(new NullProgressMonitor());
+ if (!status.isOK()) {
+ status.getException().printStackTrace(new PrintStream(res.getOutputStream(), true));
+ }
+ //
+ StringBuffer records = new StringBuffer();
+ for (TestStatus s : ctx.getStatusList()) {
+ getTestRecordTemplate();
+ String severityColor;
+ switch (s.getSeverity()) {
+ case IProcessingStatus.INFO: {
+ severityColor = "00ff00";
+ break;
+ }
+ case IProcessingStatus.WARNING: {
+ severityColor = "ffff00";
+ break;
+ }
+ case IProcessingStatus.ERROR: {
+ severityColor = "ff0000";
+ break;
+ }
+ case IProcessingStatus.FATAL: {
+ severityColor = "880000";
+ break;
+ }
+ default: {
+ severityColor = "ffffff";
+ }
+ }
+ String product = StringUtility.htmlEncode(s.getProduct(), true);
+ String title = StringUtility.htmlEncode(s.getTitle(), true);
+ String subTitle = StringUtility.htmlEncode(s.getSubTitle(), true);
+ String message = StringUtility.htmlEncode(s.getMessage(), true);
+ String detail;
+ if (s.getCause() != null) {
+ StringWriter w = new StringWriter();
+ s.getCause().printStackTrace(new PrintWriter(w, true));
+ detail = "<textarea rows=\"4\" cols=\"80\">" + StringUtility.htmlEncode(w.toString(), true) + "</textarea>";
+ message += "<br>" + detail;
+ }
+ records.append(MessageFormat.format(
+ getTestRecordTemplate(),
+ severityColor,
+ product,
+ title,
+ subTitle,
+ message
+ ));
+ }
+ //
+ String date = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss").format(new Date());
+ String page = MessageFormat.format(
+ getPageTemplate(),
+ date,
+ ctx.getSeverityCount(TestStatus.INFO),
+ ctx.getSeverityCount(TestStatus.WARNING),
+ ctx.getSeverityCount(TestStatus.ERROR),
+ ctx.getSeverityCount(TestStatus.FATAL),
+ records.toString()
+ );
+ //
+ res.getOutputStream().print(page);
+ }
+
+ /**
+ * @return the template for the html page containing the variables {0} =
+ * date/time of test {1} = ok count {2} = warning count {3} = error
+ * count {4} = fatal count {5} = list of all test statis
+ */
+ protected String getPageTemplate() {
+ return "<html><body>\n" +
+ "<h1>Automated Test Run</h1>\n" +
+ "<h3>{0}</h3>\n" +
+ "<table border=\"0\">\n" +
+ "<tr><td>{1}</td><td>Success</td></tr>\n" +
+ "<tr><td>{2}</td><td>Warnings</td></tr>\n" +
+ "<tr><td>{3}</td><td>Errors</td></tr>\n" +
+ "<tr><td>{4}</td><td>Fatals</td></tr>\n" +
+ "</table>\n" +
+ "<hr>\n" +
+ "<table border=\"1\">\n" +
+ "{5}" +
+ "</table>\n" +
+ "</body></html>";
+ }
+
+ /**
+ * @return the template of a test status record {0} = severity color
+ * (Ok=00ff00 (green), Warning=ffff00 (yellow), Error=ff0000 (red),
+ * Fatal=880000 (dark red)) {1} = product {2} = title {3} = subTitle
+ * {4} = message
+ */
+ protected String getTestRecordTemplate() {
+ return "<tr>\n" +
+ "<td bgcolor=\"{0}\" valign=\"top\">\n" +
+ "<b>{1}</b>\n" +
+ "</td>\n" +
+ "<td valign=\"top\">\n" +
+ "<b>{2}</b>\n" +
+ "</td>\n" +
+ "<td valign=\"top\">\n" +
+ "{3}\n" +
+ "</td>\n" +
+ "<td valign=\"top\">\n" +
+ "{4}\n" +
+ "</td>\n" +
+ "</tr>\n";
+ }
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/servlet/test/TestSoapWsseJaasFilter.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/servlet/test/TestSoapWsseJaasFilter.java
index b08c15dbcd..e34e180030 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/servlet/test/TestSoapWsseJaasFilter.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/servlet/test/TestSoapWsseJaasFilter.java
@@ -1,37 +1,37 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.servlet.test;
-
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-
-import javax.security.auth.Subject;
-
-import org.eclipse.scout.rt.server.SoapWsseJaasFilter;
-
-public class TestSoapWsseJaasFilter {
-
- private static class TestFilter extends SoapWsseJaasFilter {
- @Override
- public Subject parseSubject(InputStream httpIn, ByteArrayOutputStream cacheOut) throws Exception {
- return super.parseSubject(httpIn, cacheOut);
- }
- }
-
- public static void main(String[] args) throws Exception {
- TestFilter filter = new TestFilter();
- filter.init(null);
- InputStream httpIn = TestSoapWsseJaasFilter.class.getResourceAsStream("test-request.xml");
- ByteArrayOutputStream cacheOut = new ByteArrayOutputStream();
- Subject subject = filter.parseSubject(httpIn, cacheOut);
- System.out.println("subject: " + subject);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.servlet.test;
+
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+
+import javax.security.auth.Subject;
+
+import org.eclipse.scout.rt.server.SoapWsseJaasFilter;
+
+public class TestSoapWsseJaasFilter {
+
+ private static class TestFilter extends SoapWsseJaasFilter {
+ @Override
+ public Subject parseSubject(InputStream httpIn, ByteArrayOutputStream cacheOut) throws Exception {
+ return super.parseSubject(httpIn, cacheOut);
+ }
+ }
+
+ public static void main(String[] args) throws Exception {
+ TestFilter filter = new TestFilter();
+ filter.init(null);
+ InputStream httpIn = TestSoapWsseJaasFilter.class.getResourceAsStream("test-request.xml");
+ ByteArrayOutputStream cacheOut = new ByteArrayOutputStream();
+ Subject subject = filter.parseSubject(httpIn, cacheOut);
+ System.out.println("subject: " + subject);
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/servlet/test/test-request.xml b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/servlet/test/test-request.xml
index 337a5e0d54..ad8fe2dd20 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/servlet/test/test-request.xml
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/servlet/test/test-request.xml
@@ -1,12 +1,12 @@
-<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/04/secext" xmlns:uiws="${tns}">
- <soapenv:Header>
- <wsse:Security soapenv:mustUnderstand="1">
- <wsse:UsernameToken VirtualSessionId="v-session-123">
- <wsse:Username>Scout</wsse:Username>
- <wsse:Password Type="http://scout.eclipse.org/security#Token">pass-abc</wsse:Password>
- </wsse:UsernameToken>
- </wsse:Security>
- </soapenv:Header>
- <soapenv:Body>
- </soapenv:Body>
-</soapenv:Envelope>
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/04/secext" xmlns:uiws="${tns}">
+ <soapenv:Header>
+ <wsse:Security soapenv:mustUnderstand="1">
+ <wsse:UsernameToken VirtualSessionId="v-session-123">
+ <wsse:Username>Scout</wsse:Username>
+ <wsse:Password Type="http://scout.eclipse.org/security#Token">pass-abc</wsse:Password>
+ </wsse:UsernameToken>
+ </wsse:Security>
+ </soapenv:Header>
+ <soapenv:Body>
+ </soapenv:Body>
+</soapenv:Envelope>
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/transaction/AbstractTransactionMember.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/transaction/AbstractTransactionMember.java
index 6010b59c1b..7bda12b5f5 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/transaction/AbstractTransactionMember.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/transaction/AbstractTransactionMember.java
@@ -1,33 +1,33 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.transaction;
-
-/**
- * Use this base class when implementing custom transaction members
- *
- * @since 3.8
- */
-public abstract class AbstractTransactionMember implements ITransactionMember {
- private final String m_transactionMemberId;
-
- public AbstractTransactionMember(String transactionMemberId) {
- m_transactionMemberId = transactionMemberId;
- }
-
- @Override
- public String getMemberId() {
- return m_transactionMemberId;
- }
-
- @Override
- public void cancel() {
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.transaction;
+
+/**
+ * Use this base class when implementing custom transaction members
+ *
+ * @since 3.8
+ */
+public abstract class AbstractTransactionMember implements ITransactionMember {
+ private final String m_transactionMemberId;
+
+ public AbstractTransactionMember(String transactionMemberId) {
+ m_transactionMemberId = transactionMemberId;
+ }
+
+ @Override
+ public String getMemberId() {
+ return m_transactionMemberId;
+ }
+
+ @Override
+ public void cancel() {
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/transaction/BasicTransaction.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/transaction/BasicTransaction.java
index 70afb141ff..f8bd16743e 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/transaction/BasicTransaction.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/transaction/BasicTransaction.java
@@ -1,254 +1,254 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.transaction;
-
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-
-public class BasicTransaction implements ITransaction {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(BasicTransaction.class);
-
- private final long m_transactionSequence;
- private final Object m_memberMapLock = new Object();
- private final Map<String, ITransactionMember> m_memberMap = new LinkedHashMap<String, ITransactionMember>();
- private ArrayList<Throwable> m_failures = new ArrayList<Throwable>();
- private boolean m_commitPhase;
- private boolean m_cancelled;
-
- public BasicTransaction() {
- this(0L);
- }
-
- /**
- * @param transactionSequence
- * see {@link ITransaction#getTransactionSequence()}
- */
- public BasicTransaction(long transactionSequence) {
- m_transactionSequence = transactionSequence;
- }
-
- @Override
- public long getTransactionSequence() {
- return m_transactionSequence;
- }
-
- @SuppressWarnings("deprecation")
- @Override
- public void registerResource(ITransactionMember member) {
- try {
- registerMember(member);
- }
- catch (ProcessingException e) {
- throw new IllegalStateException("Interrupted");
- }
- }
-
- @Override
- public void registerMember(ITransactionMember member) throws ProcessingException {
- synchronized (m_memberMapLock) {
- String memberId = member.getMemberId();
- if (LOG.isDebugEnabled()) {
- LOG.debug("register transaction member {0}", memberId);
- }
- // release existing
- ITransactionMember old = (ITransactionMember) m_memberMap.get(memberId);
- if (old != null) {
- if (LOG.isWarnEnabled()) {
- LOG.warn("releasing overwritten transaction member {0} / {1}.", memberId, old.getMemberId());
- }
- old.release();
- }
- m_memberMap.put(memberId, member);
- //throw AFTER registering the resource in order to correctly release it later-on, bug 383736.
- if (m_cancelled) {
- throw new ProcessingException("Interrupted", new InterruptedException());
- }
- }
- }
-
- @Override
- public ITransactionMember getMember(String memberId) {
- synchronized (m_memberMapLock) {
- ITransactionMember res = (ITransactionMember) m_memberMap.get(memberId);
- if (LOG.isDebugEnabled()) {
- LOG.debug("get transaction member '{0}' -> '{1}'.", memberId, res);
- }
- return res;
- }
- }
-
- @Override
- public ITransactionMember[] getMembers() {
- synchronized (m_memberMapLock) {
- return getMembersNoLocking();
- }
- }
-
- private ITransactionMember[] getMembersNoLocking() {
- return m_memberMap.values().toArray(new ITransactionMember[m_memberMap.size()]);
- }
-
- @Override
- public void unregisterMember(ITransactionMember member) {
- if (member == null) {
- return;
- }
- unregisterMember(member.getMemberId());
- }
-
- @Override
- public void unregisterMember(String memberId) {
- synchronized (m_memberMapLock) {
- m_memberMap.remove(memberId);
- if (LOG.isDebugEnabled()) {
- LOG.debug("unregister transaction member '{0}'.", memberId);
- }
- }
- }
-
- @Override
- public boolean commitPhase1() throws ProcessingException {
- synchronized (m_memberMapLock) {
- if (m_cancelled) {
- throw new ProcessingException("Interrupted", new InterruptedException());
- }
- m_commitPhase = true;
- }
- boolean allSuccessful = true;
- for (ITransactionMember mem : getMembers()) {
- try {
- if (mem.needsCommit()) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("commit phase 1 of transaction member '{0}'.", mem.getMemberId());
- }
- boolean b = mem.commitPhase1();
- allSuccessful = allSuccessful && b;
- if (!allSuccessful) {
- LOG.error("commit phase 1 failed for transaction member '{}'.", mem.getMemberId());
- break;
- }
- }
- }
- catch (Throwable t) {
- addFailure(t);
- LOG.error("commit phase 1 failed with exception for transaction member '" + mem.getMemberId() + "'.", t);
- break;
- }
- }
- return allSuccessful && !hasFailures();
- }
-
- @Override
- public void commitPhase2() {
- for (ITransactionMember mem : getMembers()) {
- try {
- if (mem.needsCommit()) {
- if (LOG.isDebugEnabled()) {
- LOG.debug(" " + mem);
- }
- mem.commitPhase2();
- }
- }
- catch (Throwable t) {
- addFailure(t);
- LOG.error("commit phase 2 failed for transaction member '" + mem.getMemberId() + "'.", t);
- }
- }
- }
-
- @Override
- public void rollback() {
- for (ITransactionMember mem : getMembers()) {
- try {
- if (mem.needsCommit()) {
- if (LOG.isDebugEnabled()) {
- LOG.debug(" " + mem);
- }
- mem.rollback();
- }
- }
- catch (Throwable t) {
- addFailure(t);
- LOG.error("rollback failed for transaction member '" + mem.getMemberId() + "'.", t);
- }
- }
- }
-
- @Override
- public void release() {
- ITransactionMember[] a;
- synchronized (m_memberMapLock) {
- a = getMembersNoLocking();
- m_memberMap.clear();
- }
- for (ITransactionMember mem : a) {
- try {
- if (LOG.isDebugEnabled()) {
- LOG.debug(" " + mem);
- }
- mem.release();
- }
- catch (Throwable t) {
- LOG.error("release " + mem, t);
- }
- }
- }
-
- @Override
- public boolean hasFailures() {
- return m_failures.size() > 0;
- }
-
- @Override
- public Throwable[] getFailures() {
- return m_failures.toArray(new Throwable[m_failures.size()]);
- }
-
- @Override
- public void addFailure(Throwable t) {
- m_failures.add(t);
- }
-
- @Override
- public synchronized boolean cancel() {
- synchronized (m_memberMapLock) {
- if (m_commitPhase) {
- return false;
- }
- if (m_cancelled) {
- return true;
- }
- m_cancelled = true;
- addFailure(new InterruptedException());
- }
- for (ITransactionMember mem : getMembers()) {
- try {
- mem.cancel();
- }
- catch (Throwable t) {
- LOG.error("cancel " + mem, t);
- }
- }
- return true;
- }
-
- @Override
- public boolean isCancelled() {
- synchronized (m_memberMapLock) {
- return m_cancelled;
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.transaction;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+
+public class BasicTransaction implements ITransaction {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(BasicTransaction.class);
+
+ private final long m_transactionSequence;
+ private final Object m_memberMapLock = new Object();
+ private final Map<String, ITransactionMember> m_memberMap = new LinkedHashMap<String, ITransactionMember>();
+ private ArrayList<Throwable> m_failures = new ArrayList<Throwable>();
+ private boolean m_commitPhase;
+ private boolean m_cancelled;
+
+ public BasicTransaction() {
+ this(0L);
+ }
+
+ /**
+ * @param transactionSequence
+ * see {@link ITransaction#getTransactionSequence()}
+ */
+ public BasicTransaction(long transactionSequence) {
+ m_transactionSequence = transactionSequence;
+ }
+
+ @Override
+ public long getTransactionSequence() {
+ return m_transactionSequence;
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public void registerResource(ITransactionMember member) {
+ try {
+ registerMember(member);
+ }
+ catch (ProcessingException e) {
+ throw new IllegalStateException("Interrupted");
+ }
+ }
+
+ @Override
+ public void registerMember(ITransactionMember member) throws ProcessingException {
+ synchronized (m_memberMapLock) {
+ String memberId = member.getMemberId();
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("register transaction member {0}", memberId);
+ }
+ // release existing
+ ITransactionMember old = (ITransactionMember) m_memberMap.get(memberId);
+ if (old != null) {
+ if (LOG.isWarnEnabled()) {
+ LOG.warn("releasing overwritten transaction member {0} / {1}.", memberId, old.getMemberId());
+ }
+ old.release();
+ }
+ m_memberMap.put(memberId, member);
+ //throw AFTER registering the resource in order to correctly release it later-on, bug 383736.
+ if (m_cancelled) {
+ throw new ProcessingException("Interrupted", new InterruptedException());
+ }
+ }
+ }
+
+ @Override
+ public ITransactionMember getMember(String memberId) {
+ synchronized (m_memberMapLock) {
+ ITransactionMember res = (ITransactionMember) m_memberMap.get(memberId);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("get transaction member '{0}' -> '{1}'.", memberId, res);
+ }
+ return res;
+ }
+ }
+
+ @Override
+ public ITransactionMember[] getMembers() {
+ synchronized (m_memberMapLock) {
+ return getMembersNoLocking();
+ }
+ }
+
+ private ITransactionMember[] getMembersNoLocking() {
+ return m_memberMap.values().toArray(new ITransactionMember[m_memberMap.size()]);
+ }
+
+ @Override
+ public void unregisterMember(ITransactionMember member) {
+ if (member == null) {
+ return;
+ }
+ unregisterMember(member.getMemberId());
+ }
+
+ @Override
+ public void unregisterMember(String memberId) {
+ synchronized (m_memberMapLock) {
+ m_memberMap.remove(memberId);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("unregister transaction member '{0}'.", memberId);
+ }
+ }
+ }
+
+ @Override
+ public boolean commitPhase1() throws ProcessingException {
+ synchronized (m_memberMapLock) {
+ if (m_cancelled) {
+ throw new ProcessingException("Interrupted", new InterruptedException());
+ }
+ m_commitPhase = true;
+ }
+ boolean allSuccessful = true;
+ for (ITransactionMember mem : getMembers()) {
+ try {
+ if (mem.needsCommit()) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("commit phase 1 of transaction member '{0}'.", mem.getMemberId());
+ }
+ boolean b = mem.commitPhase1();
+ allSuccessful = allSuccessful && b;
+ if (!allSuccessful) {
+ LOG.error("commit phase 1 failed for transaction member '{}'.", mem.getMemberId());
+ break;
+ }
+ }
+ }
+ catch (Throwable t) {
+ addFailure(t);
+ LOG.error("commit phase 1 failed with exception for transaction member '" + mem.getMemberId() + "'.", t);
+ break;
+ }
+ }
+ return allSuccessful && !hasFailures();
+ }
+
+ @Override
+ public void commitPhase2() {
+ for (ITransactionMember mem : getMembers()) {
+ try {
+ if (mem.needsCommit()) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug(" " + mem);
+ }
+ mem.commitPhase2();
+ }
+ }
+ catch (Throwable t) {
+ addFailure(t);
+ LOG.error("commit phase 2 failed for transaction member '" + mem.getMemberId() + "'.", t);
+ }
+ }
+ }
+
+ @Override
+ public void rollback() {
+ for (ITransactionMember mem : getMembers()) {
+ try {
+ if (mem.needsCommit()) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug(" " + mem);
+ }
+ mem.rollback();
+ }
+ }
+ catch (Throwable t) {
+ addFailure(t);
+ LOG.error("rollback failed for transaction member '" + mem.getMemberId() + "'.", t);
+ }
+ }
+ }
+
+ @Override
+ public void release() {
+ ITransactionMember[] a;
+ synchronized (m_memberMapLock) {
+ a = getMembersNoLocking();
+ m_memberMap.clear();
+ }
+ for (ITransactionMember mem : a) {
+ try {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug(" " + mem);
+ }
+ mem.release();
+ }
+ catch (Throwable t) {
+ LOG.error("release " + mem, t);
+ }
+ }
+ }
+
+ @Override
+ public boolean hasFailures() {
+ return m_failures.size() > 0;
+ }
+
+ @Override
+ public Throwable[] getFailures() {
+ return m_failures.toArray(new Throwable[m_failures.size()]);
+ }
+
+ @Override
+ public void addFailure(Throwable t) {
+ m_failures.add(t);
+ }
+
+ @Override
+ public synchronized boolean cancel() {
+ synchronized (m_memberMapLock) {
+ if (m_commitPhase) {
+ return false;
+ }
+ if (m_cancelled) {
+ return true;
+ }
+ m_cancelled = true;
+ addFailure(new InterruptedException());
+ }
+ for (ITransactionMember mem : getMembers()) {
+ try {
+ mem.cancel();
+ }
+ catch (Throwable t) {
+ LOG.error("cancel " + mem, t);
+ }
+ }
+ return true;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ synchronized (m_memberMapLock) {
+ return m_cancelled;
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/transaction/ITransaction.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/transaction/ITransaction.java
index 44a2be33c6..81dce172e4 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/transaction/ITransaction.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/transaction/ITransaction.java
@@ -1,110 +1,110 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.transaction;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.server.services.common.jdbc.AbstractSqlTransactionMember;
-import org.eclipse.scout.rt.server.transaction.internal.ActiveTransactionRegistry;
-import org.eclipse.scout.rt.shared.services.common.processing.IServerProcessingCancelService;
-import org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelRequest;
-
-/**
- * Whenever a remote service call is handled by the ServiceTunnelServlet it is dispatched to a
- * DefaultTransactionDelegate that runs a ITransaction as a ServerJob.
- * That transaction does {@link ActiveTransactionRegistry#register(ITransaction)} /
- * {@link ActiveTransactionRegistry#unregister(ITransaction)} with the requestSequence as the
- * {@link ITransaction#getTransactionSequence()} sequence. Resources such as jdbc connections take part on the
- * transaction as {@link ITransactionMember}s.
- * Whenever a sql statement is run, it registers/unregisters on the
- * {@link AbstractSqlTransactionMember#registerActiveStatement(java.sql.Statement)} /
- * {@link AbstractSqlTransactionMember#unregisterActiveStatement(java.sql.Statement)}.
- * Thus canceling a {@link ITransaction#cancel()} also cancels all its members {@link ITransactionMember#cancel()} and
- * that cancels the (potentially) running statement.
- * A canceled transaction can only do a rollback and does not accept new members.
- *
- * @since 3.4
- */
-public interface ITransaction {
-
- /**
- * @return transaction sequence
- * is either 0L for non-cancellable transactions or the {@link ServiceTunnelRequest#getRequestSequence()} for
- * backend calls
- * from the ui. This number is used when cancelling a transaction by
- * {@link IServerProcessingCancelService#cancel(long)}
- */
- long getTransactionSequence();
-
- /**
- * @deprecated use {@link #registerMember(ITransactionMember)} instead
- */
- @Deprecated
- void registerResource(ITransactionMember member);
-
- /**
- * register the member (even if the transaction is canceled)
- *
- * @throws ProcessingException
- * with an {@link InterruptedException} when the transaction is canceled
- */
- void registerMember(ITransactionMember member) throws ProcessingException;
-
- ITransactionMember getMember(String memberId);
-
- ITransactionMember[] getMembers();
-
- void unregisterMember(ITransactionMember member);
-
- void unregisterMember(String memberId);
-
- boolean hasFailures();
-
- Throwable[] getFailures();
-
- void addFailure(Throwable t);
-
- /**
- * Two-phase commit
- * <p>
- * Temporary commits the transaction members
- * <p>
- *
- * @return true without any exception if the commit phase 1 was successful on all members.
- * <p>
- * Subsequently there will be a call to {@link #commitPhase2()} or {@link #rollback()}
- */
- boolean commitPhase1() throws ProcessingException;
-
- /**
- * commit phase 2 of the transaction members (commit phase 1 confirmation)
- */
- void commitPhase2();
-
- /**
- * rollback on the transaction members (commit phase 1 cancel and rollback)
- */
- void rollback();
-
- /**
- * release any members allocated by the transaction members
- */
- void release();
-
- /**
- * an external process tries to cancel the transaction
- *
- * @return true if cancel was successful and transaction was in fact canceled, false otherwise
- */
- boolean cancel();
-
- boolean isCancelled();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.transaction;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.server.services.common.jdbc.AbstractSqlTransactionMember;
+import org.eclipse.scout.rt.server.transaction.internal.ActiveTransactionRegistry;
+import org.eclipse.scout.rt.shared.services.common.processing.IServerProcessingCancelService;
+import org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelRequest;
+
+/**
+ * Whenever a remote service call is handled by the ServiceTunnelServlet it is dispatched to a
+ * DefaultTransactionDelegate that runs a ITransaction as a ServerJob.
+ * That transaction does {@link ActiveTransactionRegistry#register(ITransaction)} /
+ * {@link ActiveTransactionRegistry#unregister(ITransaction)} with the requestSequence as the
+ * {@link ITransaction#getTransactionSequence()} sequence. Resources such as jdbc connections take part on the
+ * transaction as {@link ITransactionMember}s.
+ * Whenever a sql statement is run, it registers/unregisters on the
+ * {@link AbstractSqlTransactionMember#registerActiveStatement(java.sql.Statement)} /
+ * {@link AbstractSqlTransactionMember#unregisterActiveStatement(java.sql.Statement)}.
+ * Thus canceling a {@link ITransaction#cancel()} also cancels all its members {@link ITransactionMember#cancel()} and
+ * that cancels the (potentially) running statement.
+ * A canceled transaction can only do a rollback and does not accept new members.
+ *
+ * @since 3.4
+ */
+public interface ITransaction {
+
+ /**
+ * @return transaction sequence
+ * is either 0L for non-cancellable transactions or the {@link ServiceTunnelRequest#getRequestSequence()} for
+ * backend calls
+ * from the ui. This number is used when cancelling a transaction by
+ * {@link IServerProcessingCancelService#cancel(long)}
+ */
+ long getTransactionSequence();
+
+ /**
+ * @deprecated use {@link #registerMember(ITransactionMember)} instead
+ */
+ @Deprecated
+ void registerResource(ITransactionMember member);
+
+ /**
+ * register the member (even if the transaction is canceled)
+ *
+ * @throws ProcessingException
+ * with an {@link InterruptedException} when the transaction is canceled
+ */
+ void registerMember(ITransactionMember member) throws ProcessingException;
+
+ ITransactionMember getMember(String memberId);
+
+ ITransactionMember[] getMembers();
+
+ void unregisterMember(ITransactionMember member);
+
+ void unregisterMember(String memberId);
+
+ boolean hasFailures();
+
+ Throwable[] getFailures();
+
+ void addFailure(Throwable t);
+
+ /**
+ * Two-phase commit
+ * <p>
+ * Temporary commits the transaction members
+ * <p>
+ *
+ * @return true without any exception if the commit phase 1 was successful on all members.
+ * <p>
+ * Subsequently there will be a call to {@link #commitPhase2()} or {@link #rollback()}
+ */
+ boolean commitPhase1() throws ProcessingException;
+
+ /**
+ * commit phase 2 of the transaction members (commit phase 1 confirmation)
+ */
+ void commitPhase2();
+
+ /**
+ * rollback on the transaction members (commit phase 1 cancel and rollback)
+ */
+ void rollback();
+
+ /**
+ * release any members allocated by the transaction members
+ */
+ void release();
+
+ /**
+ * an external process tries to cancel the transaction
+ *
+ * @return true if cancel was successful and transaction was in fact canceled, false otherwise
+ */
+ boolean cancel();
+
+ boolean isCancelled();
+
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/transaction/ITransactionMember.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/transaction/ITransactionMember.java
index 7d4319fc57..6d97a6827f 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/transaction/ITransactionMember.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/transaction/ITransactionMember.java
@@ -1,55 +1,55 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.transaction;
-
-/**
- * @since 3.4
- */
-public interface ITransactionMember {
-
- String getMemberId();
-
- /**
- * the transaction member needs commit
- */
- boolean needsCommit();
-
- /**
- * Two-phase commit.
- * Temporary commits the transaction member
- * <p>
- *
- * @return true without any exception if the commit phase 1 was successful.
- * <p>
- * Subsequently there will be a call to {@link #commitPhase2()} or {@link #rollback()}
- */
- boolean commitPhase1();
-
- /**
- * commit phase 2 of the transaction member (commit phase 1 confirmation)
- */
- void commitPhase2();
-
- /**
- * rollback on the transaction member (commit phase 1 cancel and rollback)
- */
- void rollback();
-
- /**
- * release any resources allocated by the transaction member
- */
- void release();
-
- /**
- * When a transaction is canceled, it calls this method on all its members
- */
- void cancel();
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.transaction;
+
+/**
+ * @since 3.4
+ */
+public interface ITransactionMember {
+
+ String getMemberId();
+
+ /**
+ * the transaction member needs commit
+ */
+ boolean needsCommit();
+
+ /**
+ * Two-phase commit.
+ * Temporary commits the transaction member
+ * <p>
+ *
+ * @return true without any exception if the commit phase 1 was successful.
+ * <p>
+ * Subsequently there will be a call to {@link #commitPhase2()} or {@link #rollback()}
+ */
+ boolean commitPhase1();
+
+ /**
+ * commit phase 2 of the transaction member (commit phase 1 confirmation)
+ */
+ void commitPhase2();
+
+ /**
+ * rollback on the transaction member (commit phase 1 cancel and rollback)
+ */
+ void rollback();
+
+ /**
+ * release any resources allocated by the transaction member
+ */
+ void release();
+
+ /**
+ * When a transaction is canceled, it calls this method on all its members
+ */
+ void cancel();
+}
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/transaction/internal/ActiveTransactionRegistry.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/transaction/internal/ActiveTransactionRegistry.java
index f1ef8cd7b4..38a557448f 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/transaction/internal/ActiveTransactionRegistry.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/transaction/internal/ActiveTransactionRegistry.java
@@ -1,103 +1,103 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.server.transaction.internal;
-
-import java.lang.ref.WeakReference;
-import java.util.HashMap;
-
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.server.IServerSession;
-import org.eclipse.scout.rt.server.ServerJob;
-import org.eclipse.scout.rt.server.transaction.ITransaction;
-
-/**
- * Cache the transactions per session to enable for cancelling
- */
-public class ActiveTransactionRegistry {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(ActiveTransactionRegistry.class);
- private static final String SESSION_STATE_KEY = "activeTransactions";
-
- private ActiveTransactionRegistry() {
- }
-
- private static SessionState getSessionState(boolean autoCreate) {
- IServerSession session = ServerJob.getCurrentSession();
- if (session == null) {
- return null;
- }
- synchronized (session) {
- SessionState state = (SessionState) session.getAttribute(SESSION_STATE_KEY);
- if (state == null && autoCreate) {
- state = new SessionState();
- session.setAttribute(SESSION_STATE_KEY, state);
- }
- return state;
- }
- }
-
- public static void register(ITransaction tx) {
- if (tx == null || tx.getTransactionSequence() == 0L) {
- return;
- }
- SessionState state = getSessionState(true);
- if (state == null) {
- LOG.error("failed to register transaction due to missing session");
- return;
- }
- synchronized (state.m_txMapLock) {
- state.m_txMap.put(tx.getTransactionSequence(), new WeakReference<ITransaction>(tx));
- }
- }
-
- public static void unregister(ITransaction tx) {
- if (tx == null || tx.getTransactionSequence() == 0L) {
- return;
- }
- SessionState state = getSessionState(false);
- if (state == null) {
- return;
- }
- synchronized (state.m_txMapLock) {
- state.m_txMap.remove(tx.getTransactionSequence());
- }
- }
-
- /**
- * @return true if cancel was successful and transaction was in fact cancelled, false otherwise
- */
- public static boolean cancel(long transactionSequence) {
- if (transactionSequence == 0L) {
- return false;
- }
- SessionState state = getSessionState(false);
- if (state == null) {
- return false;
- }
- ITransaction tx;
- synchronized (state.m_txMapLock) {
- WeakReference<ITransaction> ref = state.m_txMap.get(transactionSequence);
- if (ref == null) {
- return false;
- }
- tx = ref.get();
- if (tx == null) {
- return false;
- }
- }
- return tx.cancel();
- }
-
- private static class SessionState {
- final Object m_txMapLock = new Object();
- final HashMap<Long, WeakReference<ITransaction>> m_txMap = new HashMap<Long, WeakReference<ITransaction>>();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.server.transaction.internal;
+
+import java.lang.ref.WeakReference;
+import java.util.HashMap;
+
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.server.IServerSession;
+import org.eclipse.scout.rt.server.ServerJob;
+import org.eclipse.scout.rt.server.transaction.ITransaction;
+
+/**
+ * Cache the transactions per session to enable for cancelling
+ */
+public class ActiveTransactionRegistry {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(ActiveTransactionRegistry.class);
+ private static final String SESSION_STATE_KEY = "activeTransactions";
+
+ private ActiveTransactionRegistry() {
+ }
+
+ private static SessionState getSessionState(boolean autoCreate) {
+ IServerSession session = ServerJob.getCurrentSession();
+ if (session == null) {
+ return null;
+ }
+ synchronized (session) {
+ SessionState state = (SessionState) session.getAttribute(SESSION_STATE_KEY);
+ if (state == null && autoCreate) {
+ state = new SessionState();
+ session.setAttribute(SESSION_STATE_KEY, state);
+ }
+ return state;
+ }
+ }
+
+ public static void register(ITransaction tx) {
+ if (tx == null || tx.getTransactionSequence() == 0L) {
+ return;
+ }
+ SessionState state = getSessionState(true);
+ if (state == null) {
+ LOG.error("failed to register transaction due to missing session");
+ return;
+ }
+ synchronized (state.m_txMapLock) {
+ state.m_txMap.put(tx.getTransactionSequence(), new WeakReference<ITransaction>(tx));
+ }
+ }
+
+ public static void unregister(ITransaction tx) {
+ if (tx == null || tx.getTransactionSequence() == 0L) {
+ return;
+ }
+ SessionState state = getSessionState(false);
+ if (state == null) {
+ return;
+ }
+ synchronized (state.m_txMapLock) {
+ state.m_txMap.remove(tx.getTransactionSequence());
+ }
+ }
+
+ /**
+ * @return true if cancel was successful and transaction was in fact cancelled, false otherwise
+ */
+ public static boolean cancel(long transactionSequence) {
+ if (transactionSequence == 0L) {
+ return false;
+ }
+ SessionState state = getSessionState(false);
+ if (state == null) {
+ return false;
+ }
+ ITransaction tx;
+ synchronized (state.m_txMapLock) {
+ WeakReference<ITransaction> ref = state.m_txMap.get(transactionSequence);
+ if (ref == null) {
+ return false;
+ }
+ tx = ref.get();
+ if (tx == null) {
+ return false;
+ }
+ }
+ return tx.cancel();
+ }
+
+ private static class SessionState {
+ final Object m_txMapLock = new Object();
+ final HashMap<Long, WeakReference<ITransaction>> m_txMap = new HashMap<Long, WeakReference<ITransaction>>();
+ }
+}
diff --git a/org.eclipse.scout.rt.shared.legacy.texts.fragment/fragment.xml b/org.eclipse.scout.rt.shared.legacy.texts.fragment/fragment.xml
index 5122709d0d..3e2a505291 100644
--- a/org.eclipse.scout.rt.shared.legacy.texts.fragment/fragment.xml
+++ b/org.eclipse.scout.rt.shared.legacy.texts.fragment/fragment.xml
@@ -1,14 +1,14 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<fragment>
- <extension
- point="org.eclipse.scout.service.services">
- <service
- class="org.eclipse.scout.rt.shared.legacy.texts.services.common.text.ScoutLegacyTextProviderService"
- createImmediately="false"
- factory="org.eclipse.scout.service.DefaultServiceFactory"
- ranking="-200">
- </service>
- </extension>
-
-</fragment>
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<fragment>
+ <extension
+ point="org.eclipse.scout.service.services">
+ <service
+ class="org.eclipse.scout.rt.shared.legacy.texts.services.common.text.ScoutLegacyTextProviderService"
+ createImmediately="false"
+ factory="org.eclipse.scout.service.DefaultServiceFactory"
+ ranking="-200">
+ </service>
+ </extension>
+
+</fragment>
diff --git a/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts.properties b/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts.properties
index 766fee00d1..56c28502f5 100644
--- a/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts.properties
+++ b/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts.properties
@@ -1,297 +1,297 @@
-AccessAuthorization=Server authorization
-Application=Application
-ApplicationServer=Application server
-AppointmentProposition=Appointment proposition
-AutomaticallyStopAfterFirstFetch=Fetch only first record
-BackendCall=Service call
-BrowseMenu=Search...
-CTIDialErrorInfo=Please check phone number and connection.
-CTIDialErrorText=Phone server not available
-CTIDialErrorTitle=Phone
-Calendar_itemCont=(tag)
-Calendar_itemFrom=From
-Calendar_itemUntil=to
-CheckFailed=Data error
-CheckFailedMessage=The verification of data failed.
-Choose=Choose
-ComposerAggregationCount=Count
-ComposerFieldAddAttribute=Add attribute
-ComposerFieldAggregationNone=N/A
-ConnectionTest_Button_Cancel=Cancel
-ConnectionTest_Button_CancelHint=Closes this form.
-ConnectionTest_Button_Refresh=Actualize
-ConnectionTest_Label_DBResult=Database connection
-ConnectionTest_Label_ServerResult=Server connection
-Connection_Test_MainForm=Test connection
-Containing=containing
-ContinueMenu=Continue
-CopyPasteHint=For detailed information, press the 'Copy' button and 'Paste' in text editor.
-CouldNotCreateOfflineDirectory=Cannot create local directory
-CouldNotFindOfflineClasses=Could not find offline environment
-CouldNotFindOfflineConfig=Could not find offline configuration
-CouldNotFindOfflineDatabase=Could not find local database
-CouldNotGetApplication=Could not load application
-CouldNotGetApplicationInfo=Could not load application info.
-CreateTriggers=Create triggers
-CurrentLocale=Current language zone
-CurrentStep=current step
-CustomRollback=Action has been cancelled
-DataLoading=Data transfer
-DateErrorText=The entered date '{0}' is invalid. Please correct the value.
-DateErrorTitle=Invalid date
-DismissMenu=Dismiss...
-DisplayedTimerange=Displayed time range
-DoubleWeek=Double week
-DownloadOfflineDatabase=Would you like to download the database?
-DragMenu=Drag (config. marker)
-DropMenu=Drop (config. marker)
-EditMenu=Edit...
-ElapsedTime=Elapsed
-EnableHtmlEditing=Activate HTML mode
-EndStatus=End status
-EnterUrlTooltip=Enter URL or Paste after Copy/Paste
-ErrorAndRetryQuestion=Please inform your system administrator.
-ErrorAndWarning=Error / Warnings
-ErrorAndWarningAndMessage=Error / Warnings / Messages
-ErrorCommandFailedQuestion=Would you like to ignore that error message and continue?
-ErrorCommandFailedText=The action has been aborted.
-ErrorOnly=Error
-ErrorReadingOfflineTable=Error reading offline table
-ErrorReadingOnlineTable=Error reading server table
-ErrorTextLoginOutdated=Password expired
-EstimatedEndDate=Finished
-EstimatedTime=Estimated duration
-ExcelChart_Button_Cancel=Cancel
-ExcelChart_Button_CancelHint=Cancel export and close.
-ExcelChart_Button_OK=Export
-ExcelChart_Button_OKHint=Starts the export.
-ExcelChart_Error_ActivatingWorksheetFailed=activating worksheet failed
-ExcelChart_Error_CreatingWorksheetFailed=creating worksheet failed.
-ExcelChart_Error_FillingChartFailed=filling in the chart failed.
-ExcelChart_Error_OpeningChartFailed=opening the chart failed.
-ExcelChart_Error_OpeningWorksheetFailed=opening the worksheet failed.
-ExcelChart_Error_RetrivingVariableFailed=a variable could not be read
-ExcelChart_Error_SavingWorkbookFailed=saving the Excel document failed.
-ExcelChart_Error_UnknownException=an unknown error occurred
-ExcelChart_Various_AveragedLong=Average of all values belonging to the same X axis value
-ExcelChart_Various_FrequencyLong=Frequency (how often the corresponding X axis value occurs)
-ExcelChart_Various_SummedUpLong=Sum of all values belonging to the same X axis value
-ExtendedSearchEditEntityMenu=Edit...
-ExtendedSearchEntityPrefix=has
-ExtendedSearchEntityPrefixNegated=doesn't have
-ExtendedSearchSaveButton=Paste
-FailedDownloadingFile=Could not download file
-FailedGettingOfflineTableVerification=Offline table verification failed
-FailedGettingOnlineTableVerification=Server table verification failed
-FieldRangeErrorText=The 'from' value may not be greater than the 'to' value.
-FieldRangeErrorTitle=Error in data range
-Fields=Fields
-FilePath=File path
-FormInactivityTimerActivated=Inactivity timer activated
-FormInvalidTextInFields=The following fields contain invalid values\:
-FormMissingMandatoryFields=The following fields are mandatory\:
-FormStateLoadTooltip=Load search criteria from xml file
-FormStateStoreTooltip=Save search criteria to xml file
-GenericSearch=Advanced search
-GetUrlForm=Web address
-HistoryAddColumnMove=move column
-HistoryAddSort=sort by
-HistoryAddSortDesc=descending
-HistoryBackward=Back
-HistoryForward=Forward
-HtmlPluginActionSubmitted=The action was carried out.
-HtmlPluginChangesSaved=Changes were saved.
-HtmlPluginPendingAction=You already have an open pop-up screen in the tool. First close that one and then try again.
-HtmlPopupInfoPanel=A pop-up screen has opened in the tool
-IgnoreCase=Ignore case
-Informations=Information
-InvolvedPersons=Involved persons
-LastStep=Last step
-LiveEdit=Live edit
-LocalServer=Local server
-Logging=Logging
-LogicDateIsInGEWeeks=is earliest in {0} weeks
-LogicDateIsInLEWeeks=is at the latest in {0} weeks
-LogicDateIsInWeeks=is in exactly {0} weeks
-LogicIN=in
-LoginErrorText=Invalid username/password
-LoginErrorTitle=Login failed
-LoginFailed=Login failed
-LoginToApplicationServer=Login
-LotusNotesCode=Lotus Notes
-LotusNotesConnectErrorDetail=Please verify the installation and authorizations for Lotus Notes.
-LotusNotesConnectErrorText=Lotus Notes is not available.
-LotusNotesErrorDLLDetail=The file nlsxbe.dll is installed with Lotus Notes and can be found in the Lotus Notes home folder. e.g. C\:\\Program Files\\lotus\\notes. Make sure the file is properly registered in the Windows Registry.
-LotusNotesErrorDLLText=The resource file nlsxbe.dll could not be found.
-LotusNotesErrorDatabaseOpenDetail=This error occurs if Lotus Notes is in online mode (SIKA Network) while the remote server is not accessible. Please establish a network connection to the server or switch Lotus Notes to offline mode (Island mode). NOTE\: This error also occurs if Lotus Notes was closed while in online mode. In this case you need to start Lotus Notes and change to Island mode.
-LotusNotesErrorDatabaseOpenText=The database is not accessible.
-LotusNotesErrorIDFileDetail=This is usually caused by an open login dialog in Lotus Notes. Please complete or abort the login process in Lotus Notes and try again.
-LotusNotesErrorIDFileOpenDetail=Possible reasons are\:\n 1. The ID file is missing completely. The ID file has an .id ending and is usually located in the /data folder.\n 2. The file notes.ini is missing from the installation folder.
-LotusNotesErrorIDFileOpenText=The user's ID file could not be opened.
-LotusNotesErrorIDFileText=The user's ID file is blocked by another process.
-LotusNotesErrorMailFileDetail=The file notes.ini is located in the installation folder of Lotus Notes. The (BSI CRM - Lotus Notes) COM interface requires that notes.ini contains an entry of the dialogue "MailFile
-LotusNotesErrorMailFileText=Entry missing in notes.ini.
-LotusNotesErrorPasswordDetail=Please try again or contact the system administrator. (Passwords are case sensitive - be sure to use correct upper and lower case spelling.)
-LotusNotesErrorPasswordText=Wrong password
-LotusNotesErrorUnknownDetail=If this error occurs, please inform your system administrator.
-LotusNotesErrorUnknownText=Unknown error
-LotusNotesErrorVersionCheckDetail=Possible reasons are\:\n 1. An open login dialog. In this case the user's ID file is locked. Finish the login procedure and try again.\n 2. The file nlsxbe.dll is missing. This file should be located in the Lotus Notes installation folder. Make sure the file is there and the installation folder is part of the 'Path' environment variable.\n 3. The system is just slow for some reason. In this case you should close unused programms and try again.\n 4. Lotus Notes is not properly installed or missing completely. In this case you should talk to your system administrator.
-LotusNotesErrorVersionCheckText=Lotus Notes version could not be determined.
-MailDraft=Your Mail is now in the Draft-Folder of the eMail-Client.
-MissingOfflineTable=Missing offline table
-MissingOnlineTable=Missing server table
-MoveCalendarItem=Move
-NetworkProxy=Network / Proxy
-NewBookmarkFolder=New folder
-NewButton=New...
-NewMenu=&New...
-NewSearch=New search
-NewStartDate=new start date
-NextStep=Next step
-NoAuthenticationFound=The login information is incorrect.
-NoRowsFound=No matching records
-NoViewAvailable=No view available
-OcrEditorImageTool=Select image
-OcrEditorTextDialog=OCR text
-Offline=Offline
-OfflineAdmin=Offline administrator
-OfflineDirectory=Local directory
-OfflineInstallationInvalidMessage=This offline installation is incomplete
-OfflineInstallationValidMessage=This offline installation is ready and complete
-OfflineMasterServer=Online server
-OfflineReplicationInvalidMessage=Replication could not be performed
-OfflineSetup=Setup offline environment
-OlPrivBody=(private)
-OlPrivLocation=(private)
-OlPrivSubjectAppointment=Private appointment
-OlPrivSubjectTask=Private task
-OldStartDate=old start date
-OpenDate=Creation date
-OpenMenu=Open...
-Operator=Operator
-Operators=Operators
-Options=Options
-OutlookSyncStatusInfo=Outlook synchronization successful.\n\nAppointments\: \#APPOINTMENT_NEW\# new \#APPOINTMENT_MODIFY\# updated \#APPOINTMENT_REMOVE\# removed \#APPOINTMENT_ERROR\# failed\nTasks\: \#TASK_NEW\# new \#TASK_MODIFY\# updated \#TASK_REMOVE\# removed \#TASK_ERROR\# failed
-OutputLevel=Detail level
-PasswordChanged=Your password has been changed.
-PasswordNotChanged=Your password could not be changed.
-PasswordNotReset=The password could not be changed.
-PasswordReset=The password has been changed.
-PasswordViolatesPolicy=The password does not comply with the set policy
-PasswordWrong=Wrong password
-PleaseCheckLogfile=Please check the log file.
-PleaseCheckOfflineDirectory=Please check for the offline directory
-Port=Port
-Programmed=QA
-RepAutoCleanupFailedText=The local database could not be completely validated.
-RepAutoCleanupPerformedText=The local database has successfully been validated.
-RepDone=OK
-RepEndDate=Finished
-RepGetServerUpdate=Receiving server data...
-RepLastSync=Last sync\:
-RepNextExtract=Preparing data...
-RepProgCommit=Confirm
-RepProgExtract=Extract
-RepProgSync=Data exchange
-RepProgUpdate=Compare
-RepStartDate=Start
-Replicate=Replicate
-ReplicationStatus=Replication status
-ReportLayoutTitle=Report type
-ReportNoDataFound=There is no data matching the search constraints.
-ResetPasswordUserHasNoLoginName=The selected person does not have a valid login name.
-ResultOfTableVerification=Result of database check
-RowCountDifferenceOnTable=Data record count mismatch
-SC_DialogTitle_UserDictionary=User dictionary
-SC_Help_AddWord=Adds the word in the text field to the user dictionary
-SC_Help_Close=Closes this dialogue
-SC_Help_Delete=Deletes the selected word
-SC_Help_EditUserDictionary=Edit the user dictionary
-SC_Help_MultiLineFields=Multi-line fields
-SC_Help_SingleLineFields=Single line fields
-SC_Help_UseOfficeDictionary=Uses the Microsoft Office standard dictionary
-SC_Label_AddWord=Add word
-SC_Label_AlwaysCheckAsYouType=Always check in the background
-SC_Label_ApplicationDefault=Application default
-SC_Label_CheckAsYouType=Background checking
-SC_Label_Close=Close
-SC_Label_Delete=Delete
-SC_Label_EditUserDictionary=Edit dictionary...
-SC_Label_MultiLineFields=Multi-line fields
-SC_Label_NeverCheckAsYouType=Never check in background
-SC_Label_Ok=OK
-SC_Label_SingleLineFields=Single-line fields
-SC_Label_UseOfficeDictionary=Use MS Office dictionary
-SC_Label_Word=Word
-SC_Language_En=English
-SC_Language_EnCa=English (Canada)
-SC_Language_EnUk=English (UK)
-SC_Language_EnUs=English (US)
-SC_Language_Fr=French
-SC_Language_FrCa=French (Canada)
-SC_Language_FrFr=French (France)
-SC_Language_Ge=German
-SC_Language_GeAt=German (Austria)
-SC_Language_GeCh=German (Switzerland)
-SC_Language_GeDe=German (Germany)
-SC_Language_It=Italian
-SC_Language_ItIt=Italy (Italy)
-SC_Language_Sp=Spanish
-SC_Language_SpEs=Spanish (Spain)
-SC_Message_UserDictionaryNotFound=User dictionary not found
-SWUpdateMsg10=Error creating backup and installation of\:
-SWUpdateMsg1=A software update is available.\nYour installation version is\: \#OLD\#\nThe new version is\: \#NEW\#
-SWUpdateMsg2=Do you want to update the software?
-SWUpdateMsg3a=The software update was successfully downloaded.\nThe update will be applied next time you start the application.
-SWUpdateMsg4=No network connection to server available
-SWUpdateMsg5=Retrieving server version failed
-SWUpdateMsg6=Installation is up to date.
-SWUpdateMsg7=Software update cancelled
-SWUpdateMsg8=Cannot find application file directory\:
-SWUpdateMsg9=Downloading of the new application files failed.
-SaveAndLoopback=Loopback and save
-ScOutlookErrorCache=The plug-in could not cache Outlook items.\nThe synchronization of all '\#T\#' was skipped.\nPlease check your Outlook configuration.
-ScOutlookErrorGeneral=The plug-in could not initialize Outlook.\nPlease check your Outlook configuration. If the\nproblem still exists contact BSI for help.
-ScOutlookErrorPartial=The plug-in had a problem with synchronizing some items.\nThe following items were skipped\:\n\#T\#
-ScOutlookErrorTooMany=Too many items to display.
-ScOutlookErrorUnknown=The plug-in has caused an unknown error.\nPlease see the error log for more information.
-ScOutlookTitle=ScOutlook plug-in
-ScoutHome=Personal data
-SearchButtonPanelTooltip=Start search
-SearchMenu=Search...
-SearchPartial=Partial search
-SecurityNotAllowed=The transaction has been denied by the server.
-Selected=Selected
-SelectionIsEmpty=Selection is empty
-Servidor_All=All
-ShowAll=Show all
-ShowFileChooser=Showing file selector
-ShowFileErrorText=The file \#T\# could not be opened.
-ShowFileErrorTitle=Show file
-ShowMore=Show more
-Site=Server
-SmartFieldCallSmartDialog=When displaying smart field selection list
-SmartFieldTooManyRows=Many data records. Please narrow your search criteria.
-SpreadsheetPasteWarning1a=Some cells are read-only. Copy/paste is not possible on these.
-SpreadsheetPasteWarning1b=values have therefore been ignored.
-StartupPhaseConfig=Loading application...
-StartupPhaseOffline=Preparing environment
-StartupPhaseUpdate=Checking for updates...
-StoreColumnWidths=Store column widths
-TableVerificationCoefficient=Correlation coefficient
-TableVerificationSuccessful=Database comparison completed
-Timeframe=Timeframe
-TransferProgressLabel=Receiving...
-TransferProgressTitle=Data transfer
-Using=Using
-Verify=Verify
-VerifyOfflineEnvironment=Verify/install
-VetoErrorTitle=Invalid search field entry.
-ViewListLabel=Choose a view
-ViewListTitle=All views
-With=with
-WorkOffline=Work offline
-WorkOfflineInfoText=In order to enable offline working, please enter in the field ""Server"" the URL of the application server. This is normally the same URL as when you login to work online.
-Workflows=Workflows
-aView=a view
-someview=single view
+AccessAuthorization=Server authorization
+Application=Application
+ApplicationServer=Application server
+AppointmentProposition=Appointment proposition
+AutomaticallyStopAfterFirstFetch=Fetch only first record
+BackendCall=Service call
+BrowseMenu=Search...
+CTIDialErrorInfo=Please check phone number and connection.
+CTIDialErrorText=Phone server not available
+CTIDialErrorTitle=Phone
+Calendar_itemCont=(tag)
+Calendar_itemFrom=From
+Calendar_itemUntil=to
+CheckFailed=Data error
+CheckFailedMessage=The verification of data failed.
+Choose=Choose
+ComposerAggregationCount=Count
+ComposerFieldAddAttribute=Add attribute
+ComposerFieldAggregationNone=N/A
+ConnectionTest_Button_Cancel=Cancel
+ConnectionTest_Button_CancelHint=Closes this form.
+ConnectionTest_Button_Refresh=Actualize
+ConnectionTest_Label_DBResult=Database connection
+ConnectionTest_Label_ServerResult=Server connection
+Connection_Test_MainForm=Test connection
+Containing=containing
+ContinueMenu=Continue
+CopyPasteHint=For detailed information, press the 'Copy' button and 'Paste' in text editor.
+CouldNotCreateOfflineDirectory=Cannot create local directory
+CouldNotFindOfflineClasses=Could not find offline environment
+CouldNotFindOfflineConfig=Could not find offline configuration
+CouldNotFindOfflineDatabase=Could not find local database
+CouldNotGetApplication=Could not load application
+CouldNotGetApplicationInfo=Could not load application info.
+CreateTriggers=Create triggers
+CurrentLocale=Current language zone
+CurrentStep=current step
+CustomRollback=Action has been cancelled
+DataLoading=Data transfer
+DateErrorText=The entered date '{0}' is invalid. Please correct the value.
+DateErrorTitle=Invalid date
+DismissMenu=Dismiss...
+DisplayedTimerange=Displayed time range
+DoubleWeek=Double week
+DownloadOfflineDatabase=Would you like to download the database?
+DragMenu=Drag (config. marker)
+DropMenu=Drop (config. marker)
+EditMenu=Edit...
+ElapsedTime=Elapsed
+EnableHtmlEditing=Activate HTML mode
+EndStatus=End status
+EnterUrlTooltip=Enter URL or Paste after Copy/Paste
+ErrorAndRetryQuestion=Please inform your system administrator.
+ErrorAndWarning=Error / Warnings
+ErrorAndWarningAndMessage=Error / Warnings / Messages
+ErrorCommandFailedQuestion=Would you like to ignore that error message and continue?
+ErrorCommandFailedText=The action has been aborted.
+ErrorOnly=Error
+ErrorReadingOfflineTable=Error reading offline table
+ErrorReadingOnlineTable=Error reading server table
+ErrorTextLoginOutdated=Password expired
+EstimatedEndDate=Finished
+EstimatedTime=Estimated duration
+ExcelChart_Button_Cancel=Cancel
+ExcelChart_Button_CancelHint=Cancel export and close.
+ExcelChart_Button_OK=Export
+ExcelChart_Button_OKHint=Starts the export.
+ExcelChart_Error_ActivatingWorksheetFailed=activating worksheet failed
+ExcelChart_Error_CreatingWorksheetFailed=creating worksheet failed.
+ExcelChart_Error_FillingChartFailed=filling in the chart failed.
+ExcelChart_Error_OpeningChartFailed=opening the chart failed.
+ExcelChart_Error_OpeningWorksheetFailed=opening the worksheet failed.
+ExcelChart_Error_RetrivingVariableFailed=a variable could not be read
+ExcelChart_Error_SavingWorkbookFailed=saving the Excel document failed.
+ExcelChart_Error_UnknownException=an unknown error occurred
+ExcelChart_Various_AveragedLong=Average of all values belonging to the same X axis value
+ExcelChart_Various_FrequencyLong=Frequency (how often the corresponding X axis value occurs)
+ExcelChart_Various_SummedUpLong=Sum of all values belonging to the same X axis value
+ExtendedSearchEditEntityMenu=Edit...
+ExtendedSearchEntityPrefix=has
+ExtendedSearchEntityPrefixNegated=doesn't have
+ExtendedSearchSaveButton=Paste
+FailedDownloadingFile=Could not download file
+FailedGettingOfflineTableVerification=Offline table verification failed
+FailedGettingOnlineTableVerification=Server table verification failed
+FieldRangeErrorText=The 'from' value may not be greater than the 'to' value.
+FieldRangeErrorTitle=Error in data range
+Fields=Fields
+FilePath=File path
+FormInactivityTimerActivated=Inactivity timer activated
+FormInvalidTextInFields=The following fields contain invalid values\:
+FormMissingMandatoryFields=The following fields are mandatory\:
+FormStateLoadTooltip=Load search criteria from xml file
+FormStateStoreTooltip=Save search criteria to xml file
+GenericSearch=Advanced search
+GetUrlForm=Web address
+HistoryAddColumnMove=move column
+HistoryAddSort=sort by
+HistoryAddSortDesc=descending
+HistoryBackward=Back
+HistoryForward=Forward
+HtmlPluginActionSubmitted=The action was carried out.
+HtmlPluginChangesSaved=Changes were saved.
+HtmlPluginPendingAction=You already have an open pop-up screen in the tool. First close that one and then try again.
+HtmlPopupInfoPanel=A pop-up screen has opened in the tool
+IgnoreCase=Ignore case
+Informations=Information
+InvolvedPersons=Involved persons
+LastStep=Last step
+LiveEdit=Live edit
+LocalServer=Local server
+Logging=Logging
+LogicDateIsInGEWeeks=is earliest in {0} weeks
+LogicDateIsInLEWeeks=is at the latest in {0} weeks
+LogicDateIsInWeeks=is in exactly {0} weeks
+LogicIN=in
+LoginErrorText=Invalid username/password
+LoginErrorTitle=Login failed
+LoginFailed=Login failed
+LoginToApplicationServer=Login
+LotusNotesCode=Lotus Notes
+LotusNotesConnectErrorDetail=Please verify the installation and authorizations for Lotus Notes.
+LotusNotesConnectErrorText=Lotus Notes is not available.
+LotusNotesErrorDLLDetail=The file nlsxbe.dll is installed with Lotus Notes and can be found in the Lotus Notes home folder. e.g. C\:\\Program Files\\lotus\\notes. Make sure the file is properly registered in the Windows Registry.
+LotusNotesErrorDLLText=The resource file nlsxbe.dll could not be found.
+LotusNotesErrorDatabaseOpenDetail=This error occurs if Lotus Notes is in online mode (SIKA Network) while the remote server is not accessible. Please establish a network connection to the server or switch Lotus Notes to offline mode (Island mode). NOTE\: This error also occurs if Lotus Notes was closed while in online mode. In this case you need to start Lotus Notes and change to Island mode.
+LotusNotesErrorDatabaseOpenText=The database is not accessible.
+LotusNotesErrorIDFileDetail=This is usually caused by an open login dialog in Lotus Notes. Please complete or abort the login process in Lotus Notes and try again.
+LotusNotesErrorIDFileOpenDetail=Possible reasons are\:\n 1. The ID file is missing completely. The ID file has an .id ending and is usually located in the /data folder.\n 2. The file notes.ini is missing from the installation folder.
+LotusNotesErrorIDFileOpenText=The user's ID file could not be opened.
+LotusNotesErrorIDFileText=The user's ID file is blocked by another process.
+LotusNotesErrorMailFileDetail=The file notes.ini is located in the installation folder of Lotus Notes. The (BSI CRM - Lotus Notes) COM interface requires that notes.ini contains an entry of the dialogue "MailFile
+LotusNotesErrorMailFileText=Entry missing in notes.ini.
+LotusNotesErrorPasswordDetail=Please try again or contact the system administrator. (Passwords are case sensitive - be sure to use correct upper and lower case spelling.)
+LotusNotesErrorPasswordText=Wrong password
+LotusNotesErrorUnknownDetail=If this error occurs, please inform your system administrator.
+LotusNotesErrorUnknownText=Unknown error
+LotusNotesErrorVersionCheckDetail=Possible reasons are\:\n 1. An open login dialog. In this case the user's ID file is locked. Finish the login procedure and try again.\n 2. The file nlsxbe.dll is missing. This file should be located in the Lotus Notes installation folder. Make sure the file is there and the installation folder is part of the 'Path' environment variable.\n 3. The system is just slow for some reason. In this case you should close unused programms and try again.\n 4. Lotus Notes is not properly installed or missing completely. In this case you should talk to your system administrator.
+LotusNotesErrorVersionCheckText=Lotus Notes version could not be determined.
+MailDraft=Your Mail is now in the Draft-Folder of the eMail-Client.
+MissingOfflineTable=Missing offline table
+MissingOnlineTable=Missing server table
+MoveCalendarItem=Move
+NetworkProxy=Network / Proxy
+NewBookmarkFolder=New folder
+NewButton=New...
+NewMenu=&New...
+NewSearch=New search
+NewStartDate=new start date
+NextStep=Next step
+NoAuthenticationFound=The login information is incorrect.
+NoRowsFound=No matching records
+NoViewAvailable=No view available
+OcrEditorImageTool=Select image
+OcrEditorTextDialog=OCR text
+Offline=Offline
+OfflineAdmin=Offline administrator
+OfflineDirectory=Local directory
+OfflineInstallationInvalidMessage=This offline installation is incomplete
+OfflineInstallationValidMessage=This offline installation is ready and complete
+OfflineMasterServer=Online server
+OfflineReplicationInvalidMessage=Replication could not be performed
+OfflineSetup=Setup offline environment
+OlPrivBody=(private)
+OlPrivLocation=(private)
+OlPrivSubjectAppointment=Private appointment
+OlPrivSubjectTask=Private task
+OldStartDate=old start date
+OpenDate=Creation date
+OpenMenu=Open...
+Operator=Operator
+Operators=Operators
+Options=Options
+OutlookSyncStatusInfo=Outlook synchronization successful.\n\nAppointments\: \#APPOINTMENT_NEW\# new \#APPOINTMENT_MODIFY\# updated \#APPOINTMENT_REMOVE\# removed \#APPOINTMENT_ERROR\# failed\nTasks\: \#TASK_NEW\# new \#TASK_MODIFY\# updated \#TASK_REMOVE\# removed \#TASK_ERROR\# failed
+OutputLevel=Detail level
+PasswordChanged=Your password has been changed.
+PasswordNotChanged=Your password could not be changed.
+PasswordNotReset=The password could not be changed.
+PasswordReset=The password has been changed.
+PasswordViolatesPolicy=The password does not comply with the set policy
+PasswordWrong=Wrong password
+PleaseCheckLogfile=Please check the log file.
+PleaseCheckOfflineDirectory=Please check for the offline directory
+Port=Port
+Programmed=QA
+RepAutoCleanupFailedText=The local database could not be completely validated.
+RepAutoCleanupPerformedText=The local database has successfully been validated.
+RepDone=OK
+RepEndDate=Finished
+RepGetServerUpdate=Receiving server data...
+RepLastSync=Last sync\:
+RepNextExtract=Preparing data...
+RepProgCommit=Confirm
+RepProgExtract=Extract
+RepProgSync=Data exchange
+RepProgUpdate=Compare
+RepStartDate=Start
+Replicate=Replicate
+ReplicationStatus=Replication status
+ReportLayoutTitle=Report type
+ReportNoDataFound=There is no data matching the search constraints.
+ResetPasswordUserHasNoLoginName=The selected person does not have a valid login name.
+ResultOfTableVerification=Result of database check
+RowCountDifferenceOnTable=Data record count mismatch
+SC_DialogTitle_UserDictionary=User dictionary
+SC_Help_AddWord=Adds the word in the text field to the user dictionary
+SC_Help_Close=Closes this dialogue
+SC_Help_Delete=Deletes the selected word
+SC_Help_EditUserDictionary=Edit the user dictionary
+SC_Help_MultiLineFields=Multi-line fields
+SC_Help_SingleLineFields=Single line fields
+SC_Help_UseOfficeDictionary=Uses the Microsoft Office standard dictionary
+SC_Label_AddWord=Add word
+SC_Label_AlwaysCheckAsYouType=Always check in the background
+SC_Label_ApplicationDefault=Application default
+SC_Label_CheckAsYouType=Background checking
+SC_Label_Close=Close
+SC_Label_Delete=Delete
+SC_Label_EditUserDictionary=Edit dictionary...
+SC_Label_MultiLineFields=Multi-line fields
+SC_Label_NeverCheckAsYouType=Never check in background
+SC_Label_Ok=OK
+SC_Label_SingleLineFields=Single-line fields
+SC_Label_UseOfficeDictionary=Use MS Office dictionary
+SC_Label_Word=Word
+SC_Language_En=English
+SC_Language_EnCa=English (Canada)
+SC_Language_EnUk=English (UK)
+SC_Language_EnUs=English (US)
+SC_Language_Fr=French
+SC_Language_FrCa=French (Canada)
+SC_Language_FrFr=French (France)
+SC_Language_Ge=German
+SC_Language_GeAt=German (Austria)
+SC_Language_GeCh=German (Switzerland)
+SC_Language_GeDe=German (Germany)
+SC_Language_It=Italian
+SC_Language_ItIt=Italy (Italy)
+SC_Language_Sp=Spanish
+SC_Language_SpEs=Spanish (Spain)
+SC_Message_UserDictionaryNotFound=User dictionary not found
+SWUpdateMsg10=Error creating backup and installation of\:
+SWUpdateMsg1=A software update is available.\nYour installation version is\: \#OLD\#\nThe new version is\: \#NEW\#
+SWUpdateMsg2=Do you want to update the software?
+SWUpdateMsg3a=The software update was successfully downloaded.\nThe update will be applied next time you start the application.
+SWUpdateMsg4=No network connection to server available
+SWUpdateMsg5=Retrieving server version failed
+SWUpdateMsg6=Installation is up to date.
+SWUpdateMsg7=Software update cancelled
+SWUpdateMsg8=Cannot find application file directory\:
+SWUpdateMsg9=Downloading of the new application files failed.
+SaveAndLoopback=Loopback and save
+ScOutlookErrorCache=The plug-in could not cache Outlook items.\nThe synchronization of all '\#T\#' was skipped.\nPlease check your Outlook configuration.
+ScOutlookErrorGeneral=The plug-in could not initialize Outlook.\nPlease check your Outlook configuration. If the\nproblem still exists contact BSI for help.
+ScOutlookErrorPartial=The plug-in had a problem with synchronizing some items.\nThe following items were skipped\:\n\#T\#
+ScOutlookErrorTooMany=Too many items to display.
+ScOutlookErrorUnknown=The plug-in has caused an unknown error.\nPlease see the error log for more information.
+ScOutlookTitle=ScOutlook plug-in
+ScoutHome=Personal data
+SearchButtonPanelTooltip=Start search
+SearchMenu=Search...
+SearchPartial=Partial search
+SecurityNotAllowed=The transaction has been denied by the server.
+Selected=Selected
+SelectionIsEmpty=Selection is empty
+Servidor_All=All
+ShowAll=Show all
+ShowFileChooser=Showing file selector
+ShowFileErrorText=The file \#T\# could not be opened.
+ShowFileErrorTitle=Show file
+ShowMore=Show more
+Site=Server
+SmartFieldCallSmartDialog=When displaying smart field selection list
+SmartFieldTooManyRows=Many data records. Please narrow your search criteria.
+SpreadsheetPasteWarning1a=Some cells are read-only. Copy/paste is not possible on these.
+SpreadsheetPasteWarning1b=values have therefore been ignored.
+StartupPhaseConfig=Loading application...
+StartupPhaseOffline=Preparing environment
+StartupPhaseUpdate=Checking for updates...
+StoreColumnWidths=Store column widths
+TableVerificationCoefficient=Correlation coefficient
+TableVerificationSuccessful=Database comparison completed
+Timeframe=Timeframe
+TransferProgressLabel=Receiving...
+TransferProgressTitle=Data transfer
+Using=Using
+Verify=Verify
+VerifyOfflineEnvironment=Verify/install
+VetoErrorTitle=Invalid search field entry.
+ViewListLabel=Choose a view
+ViewListTitle=All views
+With=with
+WorkOffline=Work offline
+WorkOfflineInfoText=In order to enable offline working, please enter in the field ""Server"" the URL of the application server. This is normally the same URL as when you login to work online.
+Workflows=Workflows
+aView=a view
+someview=single view
diff --git a/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_bg.properties b/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_bg.properties
index 1cf06448cc..22109fbaf5 100644
--- a/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_bg.properties
+++ b/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_bg.properties
@@ -1,8 +1,8 @@
-Calendar_itemCont=\u0435\u0442\u0438\u043A\u0435\u0442
-Calendar_itemFrom=\u041E\u0442
-Calendar_itemUntil=\u0434\u043E
-CopyPasteHint=(\u0417\u0430 \u0434\u0435\u0442\u0430\u0439\u043B\u043D\u0430 \u0438\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u044F \u043D\u0430\u0442\u0438\u0441\u043D\u0435\u0442\u0435 \u0431\u0443\u0442\u043E\u043D Copy \u0438 Paste \u0432 \u0442\u0435\u043A\u0441\u0442\u043E\u0432\u0438\u044F \u0440\u0435\u0434\u0430\u043A\u0442\u043E\u0440.)
-DisplayedTimerange=\u041F\u043E\u043A\u0430\u0437\u0430\u043D \u0432\u0440\u0435\u043C\u0435\u0432\u0438 \u043E\u0431\u0445\u0432\u0430\u0442
-DoubleWeek=\u0414\u0432\u043E\u0439\u043D\u0430 \u0441\u0435\u0434\u043C\u0438\u0446\u0430
-InvolvedPersons=\u0412\u043A\u043B\u044E\u0447\u0435\u043D\u0438 \u043B\u0438\u0446\u0430
-LotusNotesCode=\u041B\u043E\u0442\u0443\u0441 \u041D\u043E\u0443\u0442\u0441
+Calendar_itemCont=\u0435\u0442\u0438\u043A\u0435\u0442
+Calendar_itemFrom=\u041E\u0442
+Calendar_itemUntil=\u0434\u043E
+CopyPasteHint=(\u0417\u0430 \u0434\u0435\u0442\u0430\u0439\u043B\u043D\u0430 \u0438\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u044F \u043D\u0430\u0442\u0438\u0441\u043D\u0435\u0442\u0435 \u0431\u0443\u0442\u043E\u043D Copy \u0438 Paste \u0432 \u0442\u0435\u043A\u0441\u0442\u043E\u0432\u0438\u044F \u0440\u0435\u0434\u0430\u043A\u0442\u043E\u0440.)
+DisplayedTimerange=\u041F\u043E\u043A\u0430\u0437\u0430\u043D \u0432\u0440\u0435\u043C\u0435\u0432\u0438 \u043E\u0431\u0445\u0432\u0430\u0442
+DoubleWeek=\u0414\u0432\u043E\u0439\u043D\u0430 \u0441\u0435\u0434\u043C\u0438\u0446\u0430
+InvolvedPersons=\u0412\u043A\u043B\u044E\u0447\u0435\u043D\u0438 \u043B\u0438\u0446\u0430
+LotusNotesCode=\u041B\u043E\u0442\u0443\u0441 \u041D\u043E\u0443\u0442\u0441
diff --git a/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_cs.properties b/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_cs.properties
index 8de6fae5c0..5e330e2367 100644
--- a/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_cs.properties
+++ b/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_cs.properties
@@ -1,2 +1,2 @@
-Calendar_itemFrom=Od
-LotusNotesCode=Lotus Notes
+Calendar_itemFrom=Od
+LotusNotesCode=Lotus Notes
diff --git a/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_da.properties b/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_da.properties
index 8f872775ce..1489979c6b 100644
--- a/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_da.properties
+++ b/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_da.properties
@@ -1,2 +1,2 @@
-Calendar_itemUntil=indtil
-LotusNotesCode=Lotus Notes
+Calendar_itemUntil=indtil
+LotusNotesCode=Lotus Notes
diff --git a/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_de.properties b/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_de.properties
index bd2ac7b7c5..5da80e2bf1 100644
--- a/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_de.properties
+++ b/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_de.properties
@@ -1,292 +1,292 @@
-AccessAuthorization=Server Authorisierung
-Application=Applikation
-ApplicationServer=Applikationsserver
-AppointmentProposition=Terminvorschlag
-AutomaticallyStopAfterFirstFetch=Nur ersten Fetch ausf\u00FChren
-BackendCall=Serviceaufruf
-BrowseMenu=Durchsuchen...
-CTIDialErrorInfo=Bitte Telefonnummer und Verbindung pr\u00FCfen.
-CTIDialErrorText=Telefonserver nicht verf\u00FCgbar
-CTIDialErrorTitle=Telefon
-Calendar_itemCont=(cont)
-Calendar_itemFrom=Ab
-Calendar_itemUntil=-
-CheckFailed=Datenfehler
-CheckFailedMessage=Die \u00DCberpr\u00FCfung der Daten ergab einen Fehler.
-Choose=Ausw\u00E4hlen
-ComposerAggregationCount=Anzahl
-ComposerFieldAddAttribute=Attribut hinzuf\u00FCgen
-ComposerFieldAggregationNone=N/A
-Containing=beinhaltet
-ContinueMenu=Weiterfahren
-CopyPasteHint=F\u00FCr mehr Informationen, 'Kopieren' Knopf dr\u00FCcken und 'Einf\u00FCgen' in einem Texteditor.
-CouldNotCreateOfflineDirectory=Kann lokales Verzeichnis nicht erstellen\:
-CouldNotFindOfflineClasses=Offline Umgebung nicht vorhanden
-CouldNotFindOfflineConfig=Offline Konfiguration nicht vorhanden
-CouldNotFindOfflineDatabase=Keine lokale Datenbank wurde gefunden
-CouldNotGetApplication=Applikation konnte nicht geladen werden.
-CouldNotGetApplicationInfo=Applikationsbeschreibung konnte nicht geladen werden.
-CreateTriggers=Trigger erstellen
-CurrentLocale=Aktuelle Sprachzone
-CurrentStep=Aktueller Schritt
-CustomRollback=Aktion wurde abgebrochen
-DataLoading=Daten\u00FCbertragung
-DateErrorText=Das eingegebene Datum '{0}' ist ung\u00FCltig. Bitte korrigieren Sie den Wert.
-DateErrorTitle=Datumsfehler
-DismissMenu=Verwerfen...
-DisplayedTimerange=Angezeigter Datumsbereich
-DoubleWeek=Doppelwoche
-DownloadOfflineDatabase=M\u00F6chten Sie die Datenbank runterladen?
-DragMenu=Drag (Config Marker)
-DropMenu=Drop (Config Marker)
-EditMenu=Bearbeiten...
-ElapsedTime=Bisher
-EnableHtmlEditing=HTML Modus aktivieren
-EndStatus=End-Status
-EnterUrlTooltip=URL eingeben, oder Einf\u00FCgen von Kopieren/Einf\u00FCgen
-ErrorAndRetryQuestion=Bitte informieren sie ihren Systemadministrator.
-ErrorAndWarning=Fehler / Warnungen
-ErrorAndWarningAndMessage=Fehler / Warnungen / Meldungen
-ErrorCommandFailedQuestion=Wollen Sie die Meldung ignorieren und weiterfahren?
-ErrorCommandFailedText=Die Aktion wurde abgebrochen.
-ErrorOnly=Fehler
-ErrorReadingOfflineTable=Fehler beim Lesen der Offline-Tabelle
-ErrorReadingOnlineTable=Fehler beim Lesen der Server-Tabelle
-ErrorTextLoginOutdated=Passwort abgelaufen
-EstimatedEndDate=Beendet
-EstimatedTime=Gesch\u00E4tzte Dauer
-ExcelChart_Button_Cancel=Abbrechen
-ExcelChart_Button_CancelHint=Export abbrechen und schliessen.
-ExcelChart_Button_OK=Exportieren
-ExcelChart_Button_OKHint=Startet den Export.
-ExcelChart_Error_ActivatingWorksheetFailed=das Aktivieren des Tabellenblattes fehlschlug.
-ExcelChart_Error_CreatingWorksheetFailed=das Erstellen des Tabellenblattes fehlschlug.
-ExcelChart_Error_FillingChartFailed=das F\u00FCllen des Diagramms fehlschlug.
-ExcelChart_Error_OpeningChartFailed=das \u00D6ffnen des Diagramms fehlschlug.
-ExcelChart_Error_OpeningWorksheetFailed=das \u00D6ffnen des Tabellenblattes fehlschlug.
-ExcelChart_Error_RetrivingVariableFailed=eine Variable nicht gelesen werden konnte
-ExcelChart_Error_SavingWorkbookFailed=das Speichern des Excel Dokuments fehlschlug.
-ExcelChart_Error_UnknownException=ein unerwarteter Fehler auftrat
-ExcelChart_Various_AveragedLong=Durchschnitt aller Werte die zum gleichen X-Achsen Wert geh\u00F6ren
-ExcelChart_Various_FrequencyLong=H\u00E4ufigkeit (wie oft der entsprechende X-Achsen Wert vorkommt)
-ExcelChart_Various_SummedUpLong=Summe aller Werte die zum gleichen X-Achsen Wert geh\u00F6ren
-ExtendedSearchEditEntityMenu=Bearbeiten...
-ExtendedSearchEntityPrefix=hat
-ExtendedSearchEntityPrefixNegated=hat nicht
-ExtendedSearchSaveButton=Hinzuf\u00FCgen
-FailedDownloadingFile=Datei konnte nicht runtergeladen werden
-FailedGettingOfflineTableVerification=Verifikation von Offline-Tabelle fehlgeschlagen
-FailedGettingOnlineTableVerification=Verifikation von Server-Tabelle fehlgeschlagen
-FieldRangeErrorText=Der 'von' Wert sollte nicht gr\u00F6sser sein als der 'bis' Wert.
-FieldRangeErrorTitle=Fehler im Wertebereich
-Fields=Felder
-FilePath=Dateipfad
-FormInactivityTimerActivated=Aktivierung des Inaktivit\u00E4ts Timers
-FormInvalidTextInFields=Folgende Felder haben ung\u00FCltige Werte\:
-FormMissingMandatoryFields=Folgende Felder m\u00FCssen ausgef\u00FCllt werden\:
-FormStateLoadTooltip=Suchkriterien aus einem XML File laden
-FormStateStoreTooltip=Suchkriterien in einem XML File speichern
-GenericSearch=Sonderabfrage
-GetUrlForm=Web Adresse
-HistoryAddColumnMove=verschiebe Spalte
-HistoryAddSort=sortiere nach
-HistoryAddSortDesc=absteigend
-HistoryBackward=Zur\u00FCck
-HistoryForward=Vor
-HtmlPluginActionSubmitted=Die Aktion wurde ausgef\u00FChrt.
-HtmlPluginChangesSaved=Die \u00C4nderungen wurden gespeichert.
-HtmlPluginPendingAction=Sie haben in der Applikation bereits ein offenes Popup-Fenster. Bitte schliessen Sie dieses zuerst.
-HtmlPopupInfoPanel=Ein Popup-Fenster wurde in der Applikation ge\u00F6ffnet
-IgnoreCase=Ignoriere Gross/klein
-Informations=Informationen
-InvolvedPersons=Beteiligte Personen
-LastStep=Letzter Schritt
-LiveEdit=Live bearbeiten
-LocalServer=Lokaler Server
-Logging=Protokoll
-LogicDateIsInGEWeeks=ist fr\u00FChestens in {0} Wochen
-LogicDateIsInLEWeeks=ist sp\u00E4testens in {0} Wochen
-LogicDateIsInWeeks=ist genau in {0} Wochen
-LogicIN=in
-LoginErrorText=Benutzername/Passwort falsch
-LoginErrorTitle=Anmeldung fehlgeschlagen
-LoginFailed=Anmeldung fehlgeschlagen
-LoginToApplicationServer=Anmeldung
-LotusNotesCode=Lotus Notes
-LotusNotesConnectErrorDetail=Bitte \u00FCberpr\u00FCfen Sie ob Lotus Notes installiert ist und die Berechtigungen vorhanden sind.
-LotusNotesConnectErrorText=Lotus Notes nicht verf\u00FCgbar.
-LotusNotesErrorDLLDetail=Die Datei nlsxbe.dll wird standartm\u00E4ssig mit Lotus Notes installiert und befindet sich im Installationsverzeichnis von Lotus Notes. z.B C\:\\Programme\\lotus\\notes. Um das Problem zu beheben stellen Sie sicher, dass die Datei korrekt registriert ist (Windows Registrierung).
-LotusNotesErrorDLLText=Die Datei nlsxbe.dll konnte nicht gefunden werden.
-LotusNotesErrorDatabaseOpenDetail=Dieser Fehler tritt auf, wenn sich Lotus Notes im Onling-Modus (SIKA Network) befindet, obwohl keine Verbindung zum Remoteserver besteht. Stellen Sie eine Verbindung zum Server her oder schalten sie LotusNotes auf Offlinebetrieb um. (Island-Mode). WICHTIG\: Dieser Fehler tritt auch dann auf, wenn Lotus Notes im Online-Modus beendet wurde. In diesem Fall m\u00FCssen Sie Lotus Notes starten und auf Island-Mode umstellen.
-LotusNotesErrorDatabaseOpenText=Die Datenbank ist nicht verf\u00FCgbar.
-LotusNotesErrorIDFileDetail=Dieser Fehler wird gew\u00F6hnlich durch einen offenen Login-Dialog von Lotus Notes verursacht. Bitte schliessen sie den Login-Dialog und wiederholen Sie den Vorgang.
-LotusNotesErrorIDFileOpenDetail=M\u00F6gliche Ursachen sind\:\n 1. Ein offener Login Dialog (in diesem Fall ist die ID Datei des Benutzers gesperrt. Beenden Sie den Loginvorgang)\n 2. Die Datei nlsxbe.dll fehlt. Diese Datei befindet sich \u00FCblicherweise im Lotus Notes Stammverzeichnis. Stellen Sie sicher, dass die Datei existiert und das Lotus Notes Stammverzeichnis teil der 'Path' Umgebungsvariablen ist.\n 3. Ein stark belastetes System. Beenden Sie nicht benutze Programme udn versuchen Sie es erneut. \n 4. Eine besch\u00E4digte und oder unvollst\u00E4ndige Lotus Notes Installation.
-LotusNotesErrorIDFileOpenText=Die ID Datei des Benutzers konnte nicht ge\u00F6ffnet werden.
-LotusNotesErrorIDFileText=Die ID Datei des Benutzers ist gesperrt.
-LotusNotesErrorMailFileDetail=Die Datei notes.ini befindet sich zur Laufzeit von Lotus Notes im Installationsverzeichnis. Damit die (BSI CRM - Lotus Notes) COM Schnittstelle funktioniert muss notes.ini einen Eintrag "mailFile\=\#\#\#.nsf" enthalten. \#\#\#.nsf steht dabei f\u00FCr die Datei in der die Offline-Mail-Datenbank gespeichert ist. Bitte informieren Sie ihren Systemadministrator.
-LotusNotesErrorMailFileText=Eintrag in notes.ini fehlt.
-LotusNotesErrorPasswordDetail=Bitte wiederholen Sie den Vorgang oder wenden Sie sich an den Systemadministrator. (Bitte achten Sie auf korrekte Gross- bzw. Kleinschreibung des Passwortes)
-LotusNotesErrorPasswordText=Das Passwort ist falsch
-LotusNotesErrorUnknownDetail=Sollte dieser Fehler weiterhin auftreten, so informieren Sie bitte ihren Systemadministrator.
-LotusNotesErrorUnknownText=Ein unbekannter Fehler ist aufgetreten.
-LotusNotesErrorVersionCheckDetail=M\u00F6gliche Ursachen sind\:\n 1. Ein offener Login-Dialog (in diesem Fall ist die ID Datei des Benutzers gesperrt. Beenden Sie den Loginvorgang)\n 2. Die Datei nlsxbe.dll fehlt. Diese Datei befindet sich \u00FCblicherweise im Lotus Notes Stammverzeichnis. Stellen Sie sicher, dass die Datei existiert und das Lotus Notes Stammverzeichnis teil der 'Path' Umgebungsvariablen ist.\n 3. Ein stark belastetes System. Beenden Sie nicht benutze Programme udn versuchen Sie es erneut. \n 4. Eine besch\u00E4digte und oder unvollst\u00E4ndige Lotus Notes Installation.
-LotusNotesErrorVersionCheckText=Lotus Notes Version konnte nicht erkannt werden. (Timeout)
-MailDraft=Ihr Mail liegt nun im Entwurf-Ordner des EMail-Clients.
-MissingOfflineTable=Fehlende Offline-Tabelle
-MissingOnlineTable=Fehlende Server-Tabelle
-MoveCalendarItem=Verschieben
-NetworkProxy=Netzwerk / Proxy
-NewBookmarkFolder=Neuer Ordner
-NewButton=Neu...
-NewMenu=&Neu...
-NewSearch=Neue Suche
-NewStartDate=neues Start Datum
-NextStep=N\u00E4chster Schritt
-NoAuthenticationFound=Die Anmeldedaten sind nicht korrekt.
-NoRowsFound=Keine Datens\u00E4tze
-NoViewAvailable=Keine View verf\u00FCgbar
-OcrEditorImageTool=Grafik ausw\u00E4hlen
-OcrEditorTextDialog=OCR Text
-Offline=Offline
-OfflineAdmin=Offline Administrator
-OfflineDirectory=Lokales Verzeichnis
-OfflineInstallationInvalidMessage=Die Offline Installation ist unvollst\u00E4ndig
-OfflineInstallationValidMessage=Die Offline Installation ist korrekt und funktionsf\u00E4hig
-OfflineMasterServer=Online Server
-OfflineReplicationInvalidMessage=Die Replikation konnte nicht durchgef\u00FChrt werden
-OfflineSetup=Offlineumgebung einrichten
-OlPrivBody=(Privat)
-OlPrivLocation=(Privat)
-OlPrivSubjectAppointment=Privater Termin
-OlPrivSubjectTask=Private Aufgabe
-OldStartDate=altes Start Datum
-OpenDate=Erstellungsdatum
-OpenMenu=\u00D6ffnen...
-Operator=Operator
-Operators=Operatoren
-Options=Optionen
-OutlookSyncStatusInfo=Outlook Synchronisation erfolgreich.\n\nTermine\: \#APPOINTMENT_NEW\# neu \#APPOINTMENT_MODIFY\# aktualisiert \#APPOINTMENT_REMOVE\# gel\u00F6scht \#APPOINTMENT_ERROR\# abgebrochen\nAufgaben\: \#TASK_NEW\# neu \#TASK_MODIFY\# aktualisiert \#TASK_REMOVE\# gel\u00F6scht \#TASK_ERROR\# abgebrochen
-OutputLevel=Detailgrad
-PasswordChanged=Ihr Passwort wurde ge\u00E4ndert.
-PasswordNotChanged=Ihr Passwort konnte nicht ge\u00E4ndert werden.
-PasswordNotReset=Das Passwort konnte nicht ge\u00E4ndert werden.
-PasswordReset=Das Passwort wurde ge\u00E4ndert.
-PasswordViolatesPolicy=Das Passwort entspricht nicht den vorgegebenen Richtlinien.
-PasswordWillExpireTodayHeader=Ihr Passwort l\u00E4uft heute ab.
-PasswordWrong=Falsches Passwort
-PleaseCheckLogfile=Bitte pr\u00FCfen Sie das Logfile.
-PleaseCheckOfflineDirectory=Bitte \u00FCberpr\u00FCfen Sie ob das offline Verzeichnis existiert
-Port=Port
-Programmed=QS
-RepAutoCleanupFailedText=Die lokale Datenbank konnte nur teilweise bereinigt werden.
-RepAutoCleanupPerformedText=Die lokale Datenbank wurde erfolgreich bereinigt.
-RepDone=Ok
-RepEndDate=Beendet
-RepGetServerUpdate=Empfange Daten von Server...
-RepLastSync=Letzte Synchronisierung\:
-RepNextExtract=Daten werden aufbereitet...
-RepProgCommit=Best\u00E4tigung
-RepProgExtract=Extrakt
-RepProgSync=Datenaustausch
-RepProgUpdate=Abgleich
-RepStartDate=Start
-Replicate=Replikation
-ReplicationStatus=Status der Replikation
-ReportLayoutTitle=Art des Reports
-ReportNoDataFound=Es existieren keine Daten mit den angegebenen Bedingungen.
-ResetPasswordUserHasNoLoginName=Die ausgew\u00E4hlte Person hat keinen g\u00FCltigen Login Namen.
-ResultOfTableVerification=Resultat des Datenbankchecks
-RowCountDifferenceOnTable=Verschiedene Anzahl Datens\u00E4tze
-SC_DialogTitle_UserDictionary=Benutzerw\u00F6rterbuch
-SC_Help_AddWord=F\u00FCgt das Wort im Textfeld dem Benutzerw\u00F6rterbuch hinzu
-SC_Help_Close=Schliesst diesen Dialog
-SC_Help_Delete=L\u00F6scht das markierte Wort
-SC_Help_EditUserDictionary=Das Benutzerw\u00F6rterbuch bearbeiten
-SC_Help_MultiLineFields=Multi-Linien Felder
-SC_Help_SingleLineFields=Single-Linien Felder
-SC_Help_UseOfficeDictionary=Benutzt das Standardbenutzerw\u00F6rterbuch von Microsoft Office
-SC_Label_AddWord=Wort hinzuf\u00FCgen
-SC_Label_AlwaysCheckAsYouType=Immer im Hintergrund pr\u00FCfen
-SC_Label_ApplicationDefault=Anwendungs Standard
-SC_Label_CheckAsYouType=Hintergrundpr\u00FCfung
-SC_Label_Close=Schliessen
-SC_Label_Delete=L\u00F6schen
-SC_Label_EditUserDictionary=W\u00F6rterbuch bearbeiten...
-SC_Label_MultiLineFields=Multi-Linien Felder
-SC_Label_NeverCheckAsYouType=Nie im Hintergrund pr\u00FCfen
-SC_Label_Ok=Ok
-SC_Label_SingleLineFields=Single-Linien Felder
-SC_Label_UseOfficeDictionary=MS Office W\u00F6rterbuch verwenden
-SC_Label_Word=Wort
-SC_Language_En=Englisch
-SC_Language_EnCa=Englisch (Kanada)
-SC_Language_EnUk=Englisch (G.B.)
-SC_Language_EnUs=Englisch (U.S.)
-SC_Language_Fr=Franz\u00F6sisch
-SC_Language_FrCa=Franz\u00F6sisch (Kanada)
-SC_Language_FrFr=Franz\u00F6sisch (Frankreich)
-SC_Language_Ge=Deutsch
-SC_Language_GeAt=Deutsch (\u00D6sterreich)
-SC_Language_GeCh=Deutsch (Schweiz)
-SC_Language_GeDe=Deutsch (Deutschland)
-SC_Language_It=Italienisch
-SC_Language_ItIt=Italienisch (Italien)
-SC_Language_Sp=Spanisch
-SC_Language_SpEs=Spanisch (Spanien)
-SC_Message_UserDictionaryNotFound=Benutzerw\u00F6rterbuch nicht gefunden
-SWUpdateMsg10=Fehler bei Backup und Installation von \:
-SWUpdateMsg1=Ein Softwareupdate steht zur Verf\u00FCgung.\nDie installierte Version ist\: \#OLD\#\nDie neue Version ist\: \#NEW\#
-SWUpdateMsg2=M\u00F6chten Sie den Update jetzt installieren ?
-SWUpdateMsg3a=Der Softwareupdate wurde erfolgreich herunter geladen.\nDer Update wird beim n\u00E4chsten Start der Applikation ausgef\u00FChrt.
-SWUpdateMsg4=Keine Netzwerkverbindung zum Updateserver verf\u00FCgbar
-SWUpdateMsg5=Anfrage der Server Version fehlgeschlagen
-SWUpdateMsg6=Installation ist auf dem neusten Stand.
-SWUpdateMsg7=Softwareupdate abgebrochen
-SWUpdateMsg8=Verzeichnis der Applikationsdateien nicht gefunden\:
-SWUpdateMsg9=Download der neuen Applikationsdateien ist fehlgeschlagen
-SaveAndLoopback=Loopback und Speichern
-ScOutlookErrorCache=Das Plugin konnte keinen Cache erstellen.\nDie Synchronisation aller '\#T\#' wurde \u00FCbersprungen.\nBitte \u00FCberpr\u00FCfen Sie Ihre Outlook-Konfiguration.
-ScOutlookErrorGeneral=Das Plugin konnte Outlook nicht initialisieren.\nBitte \u00FCberpr\u00FCfen sie Ihre Outlook-Konfiguration.\nFalls sich das Problem nicht beheben l\u00E4sst kontaktieren\nSie bitte BSI.
-ScOutlookErrorPartial=Das Plugin konnte einige Datens\u00E4tze nicht synchronisieren.\nFolgende Datens\u00E4tze wurden nicht verabeitet\:\n\#T\#
-ScOutlookErrorTooMany=Zu viele Eintr\u00E4ge zum Anzeigen.
-ScOutlookErrorUnknown=Das Plugin hat einen unbekannten Fehler verursacht.\nBitte konsultieren Sie die Log-Datei f\u00FCr mehr Informationen.
-ScOutlookTitle=ScOutlook Plugin
-ScoutHome=Pers\u00F6nliche Dateien
-SearchButtonPanelTooltip=Startet Suche
-SearchMenu=Suchen...
-SearchPartial=Teilbegriffsuche
-SecurityNotAllowed=Der Vorgang wurde vom Server abgelehnt.
-Selected=Selektiert
-SelectionIsEmpty=Auswahl ist leer
-Servidor_All=Alles
-ShowAll=Alle anzeigen
-ShowFileChooser=Dateisuchdialog
-ShowFileErrorText=Die Datei '\#T\#' konnte leider nicht ge\u00F6ffnet werden.
-ShowFileErrorTitle=Datei Anzeigen
-ShowMore=Weitere anzeigen
-Site=Server
-SmartFieldCallSmartDialog=Beim Anzeigen der Smartfeld Auswahlliste
-SmartFieldTooManyRows=Viele Datens\u00E4tze. Bitte schr\u00E4nken Sie die Suchkriterien ein.
-SpreadsheetPasteWarning1a=Einige Zellen sind schreibgesch\u00FCtz. Bearbeiten/einf\u00FCgen darin ist nicht m\u00F6glich.
-SpreadsheetPasteWarning1b=Werte wurden demenstprechend ignoriert.
-StartupPhaseConfig=Lade Applikation...
-StartupPhaseOffline=Erstelle Umgebung...
-StartupPhaseUpdate=Suche Updates...
-StoreColumnWidths=Spaltenbreite speichern
-TableVerificationCoefficient=Korrelationskoeffizient
-TableVerificationSuccessful=Datenbank Vergleich abgeschlossen
-Timeframe=Zeitspanne
-TransferProgressLabel=Empfangen...
-TransferProgressTitle=Daten\u00FCbertragung
-Using=Benutzt
-Verify=Pr\u00FCfen
-VerifyOfflineEnvironment=Pr\u00FCfen/Installieren
-VetoErrorTitle=Ung\u00FCltige Suchfeldeingabe
-ViewListLabel=Sicht ausw\u00E4hlen
-ViewListTitle=Alle Sichten
-With=mit
-WorkOffline=Offline arbeiten
-WorkOfflineInfoText=Um offline zu arbeiten, geben Sie bitte im Feld ""Server"" die URL des Applikationsserves an. Dies ist \u00FCblicherweise derselbe wie beim online Login.
-Workflows=Workflows
-aView=eine Sicht
-someview=eine Sicht
+AccessAuthorization=Server Authorisierung
+Application=Applikation
+ApplicationServer=Applikationsserver
+AppointmentProposition=Terminvorschlag
+AutomaticallyStopAfterFirstFetch=Nur ersten Fetch ausf\u00FChren
+BackendCall=Serviceaufruf
+BrowseMenu=Durchsuchen...
+CTIDialErrorInfo=Bitte Telefonnummer und Verbindung pr\u00FCfen.
+CTIDialErrorText=Telefonserver nicht verf\u00FCgbar
+CTIDialErrorTitle=Telefon
+Calendar_itemCont=(cont)
+Calendar_itemFrom=Ab
+Calendar_itemUntil=-
+CheckFailed=Datenfehler
+CheckFailedMessage=Die \u00DCberpr\u00FCfung der Daten ergab einen Fehler.
+Choose=Ausw\u00E4hlen
+ComposerAggregationCount=Anzahl
+ComposerFieldAddAttribute=Attribut hinzuf\u00FCgen
+ComposerFieldAggregationNone=N/A
+Containing=beinhaltet
+ContinueMenu=Weiterfahren
+CopyPasteHint=F\u00FCr mehr Informationen, 'Kopieren' Knopf dr\u00FCcken und 'Einf\u00FCgen' in einem Texteditor.
+CouldNotCreateOfflineDirectory=Kann lokales Verzeichnis nicht erstellen\:
+CouldNotFindOfflineClasses=Offline Umgebung nicht vorhanden
+CouldNotFindOfflineConfig=Offline Konfiguration nicht vorhanden
+CouldNotFindOfflineDatabase=Keine lokale Datenbank wurde gefunden
+CouldNotGetApplication=Applikation konnte nicht geladen werden.
+CouldNotGetApplicationInfo=Applikationsbeschreibung konnte nicht geladen werden.
+CreateTriggers=Trigger erstellen
+CurrentLocale=Aktuelle Sprachzone
+CurrentStep=Aktueller Schritt
+CustomRollback=Aktion wurde abgebrochen
+DataLoading=Daten\u00FCbertragung
+DateErrorText=Das eingegebene Datum '{0}' ist ung\u00FCltig. Bitte korrigieren Sie den Wert.
+DateErrorTitle=Datumsfehler
+DismissMenu=Verwerfen...
+DisplayedTimerange=Angezeigter Datumsbereich
+DoubleWeek=Doppelwoche
+DownloadOfflineDatabase=M\u00F6chten Sie die Datenbank runterladen?
+DragMenu=Drag (Config Marker)
+DropMenu=Drop (Config Marker)
+EditMenu=Bearbeiten...
+ElapsedTime=Bisher
+EnableHtmlEditing=HTML Modus aktivieren
+EndStatus=End-Status
+EnterUrlTooltip=URL eingeben, oder Einf\u00FCgen von Kopieren/Einf\u00FCgen
+ErrorAndRetryQuestion=Bitte informieren sie ihren Systemadministrator.
+ErrorAndWarning=Fehler / Warnungen
+ErrorAndWarningAndMessage=Fehler / Warnungen / Meldungen
+ErrorCommandFailedQuestion=Wollen Sie die Meldung ignorieren und weiterfahren?
+ErrorCommandFailedText=Die Aktion wurde abgebrochen.
+ErrorOnly=Fehler
+ErrorReadingOfflineTable=Fehler beim Lesen der Offline-Tabelle
+ErrorReadingOnlineTable=Fehler beim Lesen der Server-Tabelle
+ErrorTextLoginOutdated=Passwort abgelaufen
+EstimatedEndDate=Beendet
+EstimatedTime=Gesch\u00E4tzte Dauer
+ExcelChart_Button_Cancel=Abbrechen
+ExcelChart_Button_CancelHint=Export abbrechen und schliessen.
+ExcelChart_Button_OK=Exportieren
+ExcelChart_Button_OKHint=Startet den Export.
+ExcelChart_Error_ActivatingWorksheetFailed=das Aktivieren des Tabellenblattes fehlschlug.
+ExcelChart_Error_CreatingWorksheetFailed=das Erstellen des Tabellenblattes fehlschlug.
+ExcelChart_Error_FillingChartFailed=das F\u00FCllen des Diagramms fehlschlug.
+ExcelChart_Error_OpeningChartFailed=das \u00D6ffnen des Diagramms fehlschlug.
+ExcelChart_Error_OpeningWorksheetFailed=das \u00D6ffnen des Tabellenblattes fehlschlug.
+ExcelChart_Error_RetrivingVariableFailed=eine Variable nicht gelesen werden konnte
+ExcelChart_Error_SavingWorkbookFailed=das Speichern des Excel Dokuments fehlschlug.
+ExcelChart_Error_UnknownException=ein unerwarteter Fehler auftrat
+ExcelChart_Various_AveragedLong=Durchschnitt aller Werte die zum gleichen X-Achsen Wert geh\u00F6ren
+ExcelChart_Various_FrequencyLong=H\u00E4ufigkeit (wie oft der entsprechende X-Achsen Wert vorkommt)
+ExcelChart_Various_SummedUpLong=Summe aller Werte die zum gleichen X-Achsen Wert geh\u00F6ren
+ExtendedSearchEditEntityMenu=Bearbeiten...
+ExtendedSearchEntityPrefix=hat
+ExtendedSearchEntityPrefixNegated=hat nicht
+ExtendedSearchSaveButton=Hinzuf\u00FCgen
+FailedDownloadingFile=Datei konnte nicht runtergeladen werden
+FailedGettingOfflineTableVerification=Verifikation von Offline-Tabelle fehlgeschlagen
+FailedGettingOnlineTableVerification=Verifikation von Server-Tabelle fehlgeschlagen
+FieldRangeErrorText=Der 'von' Wert sollte nicht gr\u00F6sser sein als der 'bis' Wert.
+FieldRangeErrorTitle=Fehler im Wertebereich
+Fields=Felder
+FilePath=Dateipfad
+FormInactivityTimerActivated=Aktivierung des Inaktivit\u00E4ts Timers
+FormInvalidTextInFields=Folgende Felder haben ung\u00FCltige Werte\:
+FormMissingMandatoryFields=Folgende Felder m\u00FCssen ausgef\u00FCllt werden\:
+FormStateLoadTooltip=Suchkriterien aus einem XML File laden
+FormStateStoreTooltip=Suchkriterien in einem XML File speichern
+GenericSearch=Sonderabfrage
+GetUrlForm=Web Adresse
+HistoryAddColumnMove=verschiebe Spalte
+HistoryAddSort=sortiere nach
+HistoryAddSortDesc=absteigend
+HistoryBackward=Zur\u00FCck
+HistoryForward=Vor
+HtmlPluginActionSubmitted=Die Aktion wurde ausgef\u00FChrt.
+HtmlPluginChangesSaved=Die \u00C4nderungen wurden gespeichert.
+HtmlPluginPendingAction=Sie haben in der Applikation bereits ein offenes Popup-Fenster. Bitte schliessen Sie dieses zuerst.
+HtmlPopupInfoPanel=Ein Popup-Fenster wurde in der Applikation ge\u00F6ffnet
+IgnoreCase=Ignoriere Gross/klein
+Informations=Informationen
+InvolvedPersons=Beteiligte Personen
+LastStep=Letzter Schritt
+LiveEdit=Live bearbeiten
+LocalServer=Lokaler Server
+Logging=Protokoll
+LogicDateIsInGEWeeks=ist fr\u00FChestens in {0} Wochen
+LogicDateIsInLEWeeks=ist sp\u00E4testens in {0} Wochen
+LogicDateIsInWeeks=ist genau in {0} Wochen
+LogicIN=in
+LoginErrorText=Benutzername/Passwort falsch
+LoginErrorTitle=Anmeldung fehlgeschlagen
+LoginFailed=Anmeldung fehlgeschlagen
+LoginToApplicationServer=Anmeldung
+LotusNotesCode=Lotus Notes
+LotusNotesConnectErrorDetail=Bitte \u00FCberpr\u00FCfen Sie ob Lotus Notes installiert ist und die Berechtigungen vorhanden sind.
+LotusNotesConnectErrorText=Lotus Notes nicht verf\u00FCgbar.
+LotusNotesErrorDLLDetail=Die Datei nlsxbe.dll wird standartm\u00E4ssig mit Lotus Notes installiert und befindet sich im Installationsverzeichnis von Lotus Notes. z.B C\:\\Programme\\lotus\\notes. Um das Problem zu beheben stellen Sie sicher, dass die Datei korrekt registriert ist (Windows Registrierung).
+LotusNotesErrorDLLText=Die Datei nlsxbe.dll konnte nicht gefunden werden.
+LotusNotesErrorDatabaseOpenDetail=Dieser Fehler tritt auf, wenn sich Lotus Notes im Onling-Modus (SIKA Network) befindet, obwohl keine Verbindung zum Remoteserver besteht. Stellen Sie eine Verbindung zum Server her oder schalten sie LotusNotes auf Offlinebetrieb um. (Island-Mode). WICHTIG\: Dieser Fehler tritt auch dann auf, wenn Lotus Notes im Online-Modus beendet wurde. In diesem Fall m\u00FCssen Sie Lotus Notes starten und auf Island-Mode umstellen.
+LotusNotesErrorDatabaseOpenText=Die Datenbank ist nicht verf\u00FCgbar.
+LotusNotesErrorIDFileDetail=Dieser Fehler wird gew\u00F6hnlich durch einen offenen Login-Dialog von Lotus Notes verursacht. Bitte schliessen sie den Login-Dialog und wiederholen Sie den Vorgang.
+LotusNotesErrorIDFileOpenDetail=M\u00F6gliche Ursachen sind\:\n 1. Ein offener Login Dialog (in diesem Fall ist die ID Datei des Benutzers gesperrt. Beenden Sie den Loginvorgang)\n 2. Die Datei nlsxbe.dll fehlt. Diese Datei befindet sich \u00FCblicherweise im Lotus Notes Stammverzeichnis. Stellen Sie sicher, dass die Datei existiert und das Lotus Notes Stammverzeichnis teil der 'Path' Umgebungsvariablen ist.\n 3. Ein stark belastetes System. Beenden Sie nicht benutze Programme udn versuchen Sie es erneut. \n 4. Eine besch\u00E4digte und oder unvollst\u00E4ndige Lotus Notes Installation.
+LotusNotesErrorIDFileOpenText=Die ID Datei des Benutzers konnte nicht ge\u00F6ffnet werden.
+LotusNotesErrorIDFileText=Die ID Datei des Benutzers ist gesperrt.
+LotusNotesErrorMailFileDetail=Die Datei notes.ini befindet sich zur Laufzeit von Lotus Notes im Installationsverzeichnis. Damit die (BSI CRM - Lotus Notes) COM Schnittstelle funktioniert muss notes.ini einen Eintrag "mailFile\=\#\#\#.nsf" enthalten. \#\#\#.nsf steht dabei f\u00FCr die Datei in der die Offline-Mail-Datenbank gespeichert ist. Bitte informieren Sie ihren Systemadministrator.
+LotusNotesErrorMailFileText=Eintrag in notes.ini fehlt.
+LotusNotesErrorPasswordDetail=Bitte wiederholen Sie den Vorgang oder wenden Sie sich an den Systemadministrator. (Bitte achten Sie auf korrekte Gross- bzw. Kleinschreibung des Passwortes)
+LotusNotesErrorPasswordText=Das Passwort ist falsch
+LotusNotesErrorUnknownDetail=Sollte dieser Fehler weiterhin auftreten, so informieren Sie bitte ihren Systemadministrator.
+LotusNotesErrorUnknownText=Ein unbekannter Fehler ist aufgetreten.
+LotusNotesErrorVersionCheckDetail=M\u00F6gliche Ursachen sind\:\n 1. Ein offener Login-Dialog (in diesem Fall ist die ID Datei des Benutzers gesperrt. Beenden Sie den Loginvorgang)\n 2. Die Datei nlsxbe.dll fehlt. Diese Datei befindet sich \u00FCblicherweise im Lotus Notes Stammverzeichnis. Stellen Sie sicher, dass die Datei existiert und das Lotus Notes Stammverzeichnis teil der 'Path' Umgebungsvariablen ist.\n 3. Ein stark belastetes System. Beenden Sie nicht benutze Programme udn versuchen Sie es erneut. \n 4. Eine besch\u00E4digte und oder unvollst\u00E4ndige Lotus Notes Installation.
+LotusNotesErrorVersionCheckText=Lotus Notes Version konnte nicht erkannt werden. (Timeout)
+MailDraft=Ihr Mail liegt nun im Entwurf-Ordner des EMail-Clients.
+MissingOfflineTable=Fehlende Offline-Tabelle
+MissingOnlineTable=Fehlende Server-Tabelle
+MoveCalendarItem=Verschieben
+NetworkProxy=Netzwerk / Proxy
+NewBookmarkFolder=Neuer Ordner
+NewButton=Neu...
+NewMenu=&Neu...
+NewSearch=Neue Suche
+NewStartDate=neues Start Datum
+NextStep=N\u00E4chster Schritt
+NoAuthenticationFound=Die Anmeldedaten sind nicht korrekt.
+NoRowsFound=Keine Datens\u00E4tze
+NoViewAvailable=Keine View verf\u00FCgbar
+OcrEditorImageTool=Grafik ausw\u00E4hlen
+OcrEditorTextDialog=OCR Text
+Offline=Offline
+OfflineAdmin=Offline Administrator
+OfflineDirectory=Lokales Verzeichnis
+OfflineInstallationInvalidMessage=Die Offline Installation ist unvollst\u00E4ndig
+OfflineInstallationValidMessage=Die Offline Installation ist korrekt und funktionsf\u00E4hig
+OfflineMasterServer=Online Server
+OfflineReplicationInvalidMessage=Die Replikation konnte nicht durchgef\u00FChrt werden
+OfflineSetup=Offlineumgebung einrichten
+OlPrivBody=(Privat)
+OlPrivLocation=(Privat)
+OlPrivSubjectAppointment=Privater Termin
+OlPrivSubjectTask=Private Aufgabe
+OldStartDate=altes Start Datum
+OpenDate=Erstellungsdatum
+OpenMenu=\u00D6ffnen...
+Operator=Operator
+Operators=Operatoren
+Options=Optionen
+OutlookSyncStatusInfo=Outlook Synchronisation erfolgreich.\n\nTermine\: \#APPOINTMENT_NEW\# neu \#APPOINTMENT_MODIFY\# aktualisiert \#APPOINTMENT_REMOVE\# gel\u00F6scht \#APPOINTMENT_ERROR\# abgebrochen\nAufgaben\: \#TASK_NEW\# neu \#TASK_MODIFY\# aktualisiert \#TASK_REMOVE\# gel\u00F6scht \#TASK_ERROR\# abgebrochen
+OutputLevel=Detailgrad
+PasswordChanged=Ihr Passwort wurde ge\u00E4ndert.
+PasswordNotChanged=Ihr Passwort konnte nicht ge\u00E4ndert werden.
+PasswordNotReset=Das Passwort konnte nicht ge\u00E4ndert werden.
+PasswordReset=Das Passwort wurde ge\u00E4ndert.
+PasswordViolatesPolicy=Das Passwort entspricht nicht den vorgegebenen Richtlinien.
+PasswordWillExpireTodayHeader=Ihr Passwort l\u00E4uft heute ab.
+PasswordWrong=Falsches Passwort
+PleaseCheckLogfile=Bitte pr\u00FCfen Sie das Logfile.
+PleaseCheckOfflineDirectory=Bitte \u00FCberpr\u00FCfen Sie ob das offline Verzeichnis existiert
+Port=Port
+Programmed=QS
+RepAutoCleanupFailedText=Die lokale Datenbank konnte nur teilweise bereinigt werden.
+RepAutoCleanupPerformedText=Die lokale Datenbank wurde erfolgreich bereinigt.
+RepDone=Ok
+RepEndDate=Beendet
+RepGetServerUpdate=Empfange Daten von Server...
+RepLastSync=Letzte Synchronisierung\:
+RepNextExtract=Daten werden aufbereitet...
+RepProgCommit=Best\u00E4tigung
+RepProgExtract=Extrakt
+RepProgSync=Datenaustausch
+RepProgUpdate=Abgleich
+RepStartDate=Start
+Replicate=Replikation
+ReplicationStatus=Status der Replikation
+ReportLayoutTitle=Art des Reports
+ReportNoDataFound=Es existieren keine Daten mit den angegebenen Bedingungen.
+ResetPasswordUserHasNoLoginName=Die ausgew\u00E4hlte Person hat keinen g\u00FCltigen Login Namen.
+ResultOfTableVerification=Resultat des Datenbankchecks
+RowCountDifferenceOnTable=Verschiedene Anzahl Datens\u00E4tze
+SC_DialogTitle_UserDictionary=Benutzerw\u00F6rterbuch
+SC_Help_AddWord=F\u00FCgt das Wort im Textfeld dem Benutzerw\u00F6rterbuch hinzu
+SC_Help_Close=Schliesst diesen Dialog
+SC_Help_Delete=L\u00F6scht das markierte Wort
+SC_Help_EditUserDictionary=Das Benutzerw\u00F6rterbuch bearbeiten
+SC_Help_MultiLineFields=Multi-Linien Felder
+SC_Help_SingleLineFields=Single-Linien Felder
+SC_Help_UseOfficeDictionary=Benutzt das Standardbenutzerw\u00F6rterbuch von Microsoft Office
+SC_Label_AddWord=Wort hinzuf\u00FCgen
+SC_Label_AlwaysCheckAsYouType=Immer im Hintergrund pr\u00FCfen
+SC_Label_ApplicationDefault=Anwendungs Standard
+SC_Label_CheckAsYouType=Hintergrundpr\u00FCfung
+SC_Label_Close=Schliessen
+SC_Label_Delete=L\u00F6schen
+SC_Label_EditUserDictionary=W\u00F6rterbuch bearbeiten...
+SC_Label_MultiLineFields=Multi-Linien Felder
+SC_Label_NeverCheckAsYouType=Nie im Hintergrund pr\u00FCfen
+SC_Label_Ok=Ok
+SC_Label_SingleLineFields=Single-Linien Felder
+SC_Label_UseOfficeDictionary=MS Office W\u00F6rterbuch verwenden
+SC_Label_Word=Wort
+SC_Language_En=Englisch
+SC_Language_EnCa=Englisch (Kanada)
+SC_Language_EnUk=Englisch (G.B.)
+SC_Language_EnUs=Englisch (U.S.)
+SC_Language_Fr=Franz\u00F6sisch
+SC_Language_FrCa=Franz\u00F6sisch (Kanada)
+SC_Language_FrFr=Franz\u00F6sisch (Frankreich)
+SC_Language_Ge=Deutsch
+SC_Language_GeAt=Deutsch (\u00D6sterreich)
+SC_Language_GeCh=Deutsch (Schweiz)
+SC_Language_GeDe=Deutsch (Deutschland)
+SC_Language_It=Italienisch
+SC_Language_ItIt=Italienisch (Italien)
+SC_Language_Sp=Spanisch
+SC_Language_SpEs=Spanisch (Spanien)
+SC_Message_UserDictionaryNotFound=Benutzerw\u00F6rterbuch nicht gefunden
+SWUpdateMsg10=Fehler bei Backup und Installation von \:
+SWUpdateMsg1=Ein Softwareupdate steht zur Verf\u00FCgung.\nDie installierte Version ist\: \#OLD\#\nDie neue Version ist\: \#NEW\#
+SWUpdateMsg2=M\u00F6chten Sie den Update jetzt installieren ?
+SWUpdateMsg3a=Der Softwareupdate wurde erfolgreich herunter geladen.\nDer Update wird beim n\u00E4chsten Start der Applikation ausgef\u00FChrt.
+SWUpdateMsg4=Keine Netzwerkverbindung zum Updateserver verf\u00FCgbar
+SWUpdateMsg5=Anfrage der Server Version fehlgeschlagen
+SWUpdateMsg6=Installation ist auf dem neusten Stand.
+SWUpdateMsg7=Softwareupdate abgebrochen
+SWUpdateMsg8=Verzeichnis der Applikationsdateien nicht gefunden\:
+SWUpdateMsg9=Download der neuen Applikationsdateien ist fehlgeschlagen
+SaveAndLoopback=Loopback und Speichern
+ScOutlookErrorCache=Das Plugin konnte keinen Cache erstellen.\nDie Synchronisation aller '\#T\#' wurde \u00FCbersprungen.\nBitte \u00FCberpr\u00FCfen Sie Ihre Outlook-Konfiguration.
+ScOutlookErrorGeneral=Das Plugin konnte Outlook nicht initialisieren.\nBitte \u00FCberpr\u00FCfen sie Ihre Outlook-Konfiguration.\nFalls sich das Problem nicht beheben l\u00E4sst kontaktieren\nSie bitte BSI.
+ScOutlookErrorPartial=Das Plugin konnte einige Datens\u00E4tze nicht synchronisieren.\nFolgende Datens\u00E4tze wurden nicht verabeitet\:\n\#T\#
+ScOutlookErrorTooMany=Zu viele Eintr\u00E4ge zum Anzeigen.
+ScOutlookErrorUnknown=Das Plugin hat einen unbekannten Fehler verursacht.\nBitte konsultieren Sie die Log-Datei f\u00FCr mehr Informationen.
+ScOutlookTitle=ScOutlook Plugin
+ScoutHome=Pers\u00F6nliche Dateien
+SearchButtonPanelTooltip=Startet Suche
+SearchMenu=Suchen...
+SearchPartial=Teilbegriffsuche
+SecurityNotAllowed=Der Vorgang wurde vom Server abgelehnt.
+Selected=Selektiert
+SelectionIsEmpty=Auswahl ist leer
+Servidor_All=Alles
+ShowAll=Alle anzeigen
+ShowFileChooser=Dateisuchdialog
+ShowFileErrorText=Die Datei '\#T\#' konnte leider nicht ge\u00F6ffnet werden.
+ShowFileErrorTitle=Datei Anzeigen
+ShowMore=Weitere anzeigen
+Site=Server
+SmartFieldCallSmartDialog=Beim Anzeigen der Smartfeld Auswahlliste
+SmartFieldTooManyRows=Viele Datens\u00E4tze. Bitte schr\u00E4nken Sie die Suchkriterien ein.
+SpreadsheetPasteWarning1a=Einige Zellen sind schreibgesch\u00FCtz. Bearbeiten/einf\u00FCgen darin ist nicht m\u00F6glich.
+SpreadsheetPasteWarning1b=Werte wurden demenstprechend ignoriert.
+StartupPhaseConfig=Lade Applikation...
+StartupPhaseOffline=Erstelle Umgebung...
+StartupPhaseUpdate=Suche Updates...
+StoreColumnWidths=Spaltenbreite speichern
+TableVerificationCoefficient=Korrelationskoeffizient
+TableVerificationSuccessful=Datenbank Vergleich abgeschlossen
+Timeframe=Zeitspanne
+TransferProgressLabel=Empfangen...
+TransferProgressTitle=Daten\u00FCbertragung
+Using=Benutzt
+Verify=Pr\u00FCfen
+VerifyOfflineEnvironment=Pr\u00FCfen/Installieren
+VetoErrorTitle=Ung\u00FCltige Suchfeldeingabe
+ViewListLabel=Sicht ausw\u00E4hlen
+ViewListTitle=Alle Sichten
+With=mit
+WorkOffline=Offline arbeiten
+WorkOfflineInfoText=Um offline zu arbeiten, geben Sie bitte im Feld ""Server"" die URL des Applikationsserves an. Dies ist \u00FCblicherweise derselbe wie beim online Login.
+Workflows=Workflows
+aView=eine Sicht
+someview=eine Sicht
diff --git a/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_el.properties b/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_el.properties
index 01b96ca389..3cc68f68da 100644
--- a/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_el.properties
+++ b/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_el.properties
@@ -1,89 +1,89 @@
-AutomaticallyStopAfterFirstFetch=\u03A0\u03C1\u03BF\u03C3\u03BA\u03CC\u03BC\u03B9\u03C3\u03B7 \u03BC\u03CC\u03BD\u03BF \u03C0\u03C1\u03CE\u03C4\u03B7\u03C2 \u03B5\u03B3\u03B3\u03C1\u03B1\u03C6\u03AE\u03C2
-Calendar_itemCont=(tag)
-Calendar_itemFrom=\u03B1\u03C0\u03CC
-Calendar_itemUntil=\u03BC\u03AD\u03C7\u03C1\u03B9
-CopyPasteHint=(\u0393\u03B9\u03B1 \u03B1\u03BD\u03B1\u03BB\u03C5\u03C4\u03B9\u03BA\u03AD\u03C2 \u03C0\u03BB\u03B7\u03C1\u03BF\u03C6\u03BF\u03C1\u03AF\u03B5\u03C2, \u03C0\u03B1\u03C4\u03AE\u03C3\u03C4\u03B5 \u0391\u03BD\u03C4\u03B9\u03B3\u03C1\u03B1\u03C6\u03AE \u03BA\u03B1\u03B9 \u0395\u03C0\u03B9\u03BA\u03CC\u03BB\u03BB\u03B7\u03C3\u03B7 \u03C3\u03C4\u03BF\u03BD \u03B4\u03B9\u03BF\u03C1\u03B8\u03C9\u03C4\u03AE \u03BA\u03B5\u03B9\u03BC\u03AD\u03BD\u03BF\u03C5
-CouldNotCreateOfflineDirectory=\u0394\u03B5\u03BD \u03B5\u03AF\u03BD\u03B1\u03B9 \u03B4\u03C5\u03BD\u03B1\u03C4\u03CC\u03BD \u03BD\u03B1 \u03B4\u03B7\u03BC\u03B9\u03BF\u03C5\u03C1\u03B3\u03B7\u03B8\u03B5\u03AF \u03C4\u03BF\u03C0\u03B9\u03BA\u03CC\u03C2 \u03BA\u03B1\u03C4\u03AC\u03BB\u03BF\u03B3\u03BF\u03C2
-CouldNotFindOfflineClasses=\u0394\u03B5\u03BD \u03B5\u03AF\u03BD\u03B1\u03B9 \u03B4\u03C5\u03BD\u03B1\u03C4\u03CC\u03BD \u03BD\u03B1 \u03B2\u03C1\u03B5\u03B8\u03B5\u03AF \u03C0\u03B5\u03C1\u03B9\u03B2\u03AC\u03BB\u03BB\u03BF\u03BD \u03C7\u03C9\u03C1\u03AF\u03C2 \u03C3\u03CD\u03BD\u03B4\u03B5\u03C3\u03B7
-CouldNotFindOfflineConfig=\u0394\u03B5\u03BD \u03B5\u03AF\u03BD\u03B1\u03B9 \u03B4\u03C5\u03BD\u03B1\u03C4\u03CC\u03BD \u03BD\u03B1 \u03B2\u03C1\u03B5\u03B8\u03B5\u03AF \u03B4\u03B9\u03B1\u03BC\u03CC\u03C1\u03C6\u03C9\u03C3\u03B7 \u03C7\u03C9\u03C1\u03AF\u03C2 \u03C3\u03CD\u03BD\u03B4\u03B5\u03C3\u03B7
-CouldNotFindOfflineDatabase=\u0394\u03B5\u03BD \u03B5\u03AF\u03BD\u03B1\u03B9 \u03B4\u03C5\u03BD\u03B1\u03C4\u03CC\u03BD \u03BD\u03B1 \u03B2\u03C1\u03B5\u03B8\u03B5\u03AF \u03C4\u03BF\u03C0\u03B9\u03BA\u03AE \u03B2\u03AC\u03C3\u03B7 \u03B4\u03B5\u03B4\u03BF\u03BC\u03AD\u03BD\u03C9\u03BD
-DisplayedTimerange=\u0395\u03C0\u03B5\u03BE\u03AE\u03B3\u03B7\u03C3\u03B7 \u03C7\u03C1\u03BF\u03BD\u03B9\u03BA\u03BF\u03CD \u03B5\u03CD\u03C1\u03BF\u03C5\u03C2
-DoubleWeek=\u0394\u03B9\u03C0\u03BB\u03AE \u03B5\u03B2\u03B4\u03BF\u03BC\u03AC\u03B4\u03B1
-DownloadOfflineDatabase=\u0398\u03AD\u03BB\u03B5\u03C4\u03B5 \u03BD\u03B1 \u03BA\u03B1\u03C4\u03B5\u03B2\u03AC\u03C3\u03B5\u03C4\u03B5 \u03C4\u03B7 \u03B2\u03AC\u03C3\u03B7 \u03B4\u03B5\u03B4\u03BF\u03BC\u03AD\u03BD\u03C9\u03BD;
-EditMenu=\u0395\u03C0\u03B5\u03BE\u03B5\u03C1\u03B3\u03B1\u03C3\u03AF\u03B1...
-EndStatus=\u03A4\u03B5\u03BB\u03B9\u03BA\u03AE \u039A\u03B1\u03C4\u03AC\u03C3\u03C4\u03B1\u03C3\u03B7
-ErrorReadingOfflineTable=\u03A3\u03C6\u03AC\u03BB\u03BC\u03B1 \u03BA\u03B1\u03C4\u03AC \u03C4\u03B7\u03BD \u03B1\u03BD\u03AC\u03B3\u03BD\u03C9\u03C3\u03B7 \u03C0\u03AF\u03BD\u03B1\u03BA\u03B1 \u03C7\u03C9\u03C1\u03AF\u03C2 \u03C3\u03CD\u03BD\u03B4\u03B5\u03C3\u03B7
-ErrorReadingOnlineTable=\u03A3\u03C6\u03AC\u03BB\u03BC\u03B1 \u03BA\u03B1\u03C4\u03AC \u03C4\u03B7\u03BD \u03B1\u03BD\u03AC\u03B3\u03BD\u03C9\u03C3\u03B7 \u03C0\u03AF\u03BD\u03B1\u03BA\u03B1 \u03B4\u03B9\u03B1\u03BA\u03BF\u03BC\u03B9\u03C3\u03C4\u03AE
-EstimatedEndDate=\u039F\u03BB\u03BF\u03BA\u03BB\u03B7\u03C1\u03CE\u03B8\u03B7\u03BA\u03B5
-ExtendedSearchSaveButton=\u03A0\u03C1\u03BF\u03C3\u03B8\u03AE\u03BA\u03B7
-FailedDownloadingFile=\u0394\u03B5\u03BD \u03B5\u03AF\u03BD\u03B1\u03B9 \u03B4\u03C5\u03BD\u03B1\u03C4\u03CC\u03BD \u03BD\u03B1 \u03BA\u03B1\u03C4\u03B5\u03B2\u03B5\u03AF \u03C4\u03BF \u03B1\u03C1\u03C7\u03B5\u03AF\u03BF
-FailedGettingOfflineTableVerification=\u0397 \u03B5\u03C0\u03B1\u03BB\u03AE\u03B8\u03B5\u03C5\u03C3\u03B7 \u03C4\u03BF\u03C5 \u03C0\u03AF\u03BD\u03B1\u03BA\u03B1 \u03C7\u03C9\u03C1\u03AF\u03C2 \u03C3\u03CD\u03BD\u03B4\u03B5\u03C3\u03B7 \u03B1\u03C0\u03AD\u03C4\u03C5\u03C7\u03B5
-FailedGettingOnlineTableVerification=\u0397 \u03B5\u03C0\u03B1\u03BB\u03AE\u03B8\u03B5\u03C5\u03C3\u03B7 \u03C4\u03BF\u03C5 \u03C0\u03AF\u03BD\u03B1\u03BA\u03B1 \u03B4\u03B9\u03B1\u03BA\u03BF\u03BC\u03B9\u03C3\u03C4\u03AE \u03B1\u03C0\u03AD\u03C4\u03C5\u03C7\u03B5
-Field=\u03A0\u03B5\u03B4\u03AF\u03BF
-Fields=\u03A0\u03B5\u03B4\u03AF\u03B1
-HtmlPluginActionSubmitted=\u0397 \u03B5\u03BD\u03AD\u03C1\u03B3\u03B5\u03B9\u03B1 \u03B5\u03BA\u03C4\u03B5\u03BB\u03AD\u03C3\u03C4\u03B7\u03BA\u03B5.
-HtmlPluginChangesSaved=\u039F\u03B9 \u03B1\u03BB\u03BB\u03B1\u03B3\u03AD\u03C2 \u03B1\u03C0\u03BF\u03B8\u03B7\u03BA\u03B5\u03CD\u03C4\u03B7\u03BA\u03B1\u03BD
-HtmlPluginPendingAction=\u0388\u03C7\u03B5\u03C4\u03B5 \u03AE\u03B4\u03B7 \u03B1\u03BD\u03BF\u03B9\u03C7\u03C4\u03AE \u03BC\u03B9\u03B1 \u03B1\u03BD\u03B1\u03B4\u03C5\u03CC\u03BC\u03B5\u03BD\u03B7 \u03BF\u03B8\u03CC\u03BD\u03B7 \u03C3\u03C4\u03BF \u03B5\u03C1\u03B3\u03B1\u03BB\u03B5\u03AF\u03BF. \u03A0\u03C1\u03CE\u03C4\u03B1 \u03BA\u03BB\u03B5\u03AF\u03C3\u03C4\u03B5 \u03C4\u03B7 \u03BA\u03B1\u03B9 \u03C0\u03C1\u03BF\u03C3\u03C0\u03B1\u03B8\u03AE\u03C3\u03C4\u03B5 \u03BE\u03B1\u03BD\u03AC.
-HtmlPopupInfoPanel=\u039C\u03B9\u03B1 \u03B1\u03BD\u03B1\u03B4\u03C5\u03CC\u03BC\u03B5\u03BD\u03B7 \u03BF\u03B8\u03CC\u03BD\u03B7 \u03AD\u03C7\u03B5\u03B9 \u03B1\u03BD\u03BF\u03AF\u03BE\u03B5\u03B9 \u03C3\u03C4\u03BF \u03B5\u03C1\u03B3\u03B1\u03BB\u03B5\u03AF\u03BF
-InvolvedPersons=\u0395\u03BC\u03C0\u03BB\u03B5\u03BA\u03CC\u03BC\u03B5\u03BD\u03BF \u03A0\u03C1\u03CC\u03C3\u03C9\u03C0\u03B1
-LiveEdit=\u0395\u03C0\u03B5\u03BE\u03B5\u03C1\u03B3\u03B1\u03C3\u03AF\u03B1 Live
-LotusNotesCode=Lotus Notes
-MissingOfflineTable=\u039F \u03C0\u03AF\u03BD\u03B1\u03BA\u03B1\u03C2 \u03C7\u03C9\u03C1\u03AF\u03C2 \u03C3\u03CD\u03BD\u03B4\u03B5\u03C3\u03B7 \u03BB\u03B5\u03AF\u03C0\u03B5\u03B9
-MissingOnlineTable=\u039F \u03C0\u03AF\u03BD\u03B1\u03BA\u03B1\u03C2 \u03B4\u03B9\u03B1\u03BA\u03BF\u03BC\u03B9\u03C3\u03C4\u03AE \u03BB\u03B5\u03AF\u03C0\u03B5\u03B9
-Offline=\u03A7\u03C9\u03C1\u03AF\u03C2 \u03C3\u03CD\u03BD\u03B4\u03B5\u03C3\u03B7
-OfflineAdmin=\u0394\u03B9\u03B1\u03C7\u03B5\u03B9\u03C1\u03B9\u03C3\u03C4\u03AE\u03C2 \u03A7\u03C9\u03C1\u03AF\u03C2 \u03A3\u03CD\u03BD\u03B4\u03B5\u03C3\u03B7
-OfflineDirectory=\u03A4\u03BF\u03C0\u03B9\u03BA\u03CC\u03C2 \u039A\u03B1\u03C4\u03AC\u03BB\u03BF\u03B3\u03BF\u03C2
-OfflineInstallationInvalidMessage=\u0391\u03C5\u03C4\u03AE \u03B7 \u03B5\u03B3\u03BA\u03B1\u03C4\u03AC\u03C3\u03C4\u03B1\u03C3\u03B7 \u03C7\u03C9\u03C1\u03AF\u03C2 \u03C3\u03CD\u03BD\u03B4\u03B5\u03C3\u03B7 \u03B4\u03B5\u03BD \u03B5\u03AF\u03BD\u03B1\u03B9 \u03C0\u03BB\u03AE\u03C1\u03B7\u03C2
-OfflineInstallationValidMessage=\u0391\u03C5\u03C4\u03AE \u03B7 \u03B5\u03B3\u03BA\u03B1\u03C4\u03AC\u03C3\u03C4\u03B1\u03C3\u03B7 \u03C7\u03C9\u03C1\u03AF\u03C2 \u03C3\u03CD\u03BD\u03B4\u03B5\u03C3\u03B7 \u03B5\u03AF\u03BD\u03B1\u03B9 \u03AD\u03C4\u03BF\u03B9\u03BC\u03B7 \u03BA\u03B1\u03B9 \u03C0\u03BB\u03AE\u03C1\u03B7\u03C2
-OfflineMasterServer=\u0394\u03B9\u03B1\u03BA\u03BF\u03BC\u03B9\u03C3\u03C4\u03AE\u03C2 \u03BC\u03B5 \u03C3\u03CD\u03BD\u03B4\u03B5\u03C3\u03B7
-OfflineReplicationInvalidMessage=\u0394\u03B5\u03BD \u03BC\u03C0\u03BF\u03C1\u03B5\u03AF \u03BD\u03B1 \u03B5\u03BA\u03C4\u03B5\u03BB\u03B5\u03C3\u03C4\u03B5\u03AF \u03B1\u03BD\u03B1\u03C0\u03B1\u03C1\u03B1\u03B3\u03C9\u03B3\u03AE
-OfflineSetup=\u03A1\u03CD\u03B8\u03BC\u03B9\u03C3\u03B7 \u03C0\u03B5\u03C1\u03B9\u03B2\u03AC\u03BB\u03BB\u03BF\u03BD\u03C4\u03BF\u03C2 \u03C7\u03C9\u03C1\u03AF\u03C2 \u03C3\u03CD\u03BD\u03B4\u03B5\u03C3\u03B7
-Operator=\u03A7\u03B5\u03B9\u03C1\u03B9\u03C3\u03C4\u03AE\u03C2
-Operators=\u03A7\u03B5\u03B9\u03C1\u03B9\u03C3\u03C4\u03AD\u03C2
-PleaseCheckOfflineDirectory=\u03A0\u03B1\u03C1\u03B1\u03BA\u03B1\u03BB\u03BF\u03CD\u03BC\u03B5 \u03B5\u03BB\u03AD\u03B3\u03BE\u03C4\u03B5 \u03C4\u03BF\u03BD \u03BA\u03B1\u03C4\u03AC\u03BB\u03BF\u03B3\u03BF \u03C7\u03C9\u03C1\u03AF\u03C2 \u03C3\u03CD\u03BD\u03B4\u03B5\u03C3\u03B7
-Programmed=\u0394\u03B9\u03B1\u03C3\u03C6\u03AC\u03BB\u03B9\u03C3\u03B7 \u03C0\u03BF\u03B9\u03CC\u03C4\u03B7\u03C4\u03B1\u03C2
-RepDone=\u039F\u039A
-RepEndDate=\u039F\u03BB\u03BF\u03BA\u03BB\u03B7\u03C1\u03CE\u03B8\u03B7\u03BA\u03B5
-RepGetServerUpdate=\u039B\u03AE\u03C8\u03B7 \u03B4\u03B5\u03B4\u03BF\u03BC\u03AD\u03BD\u03C9\u03BD \u03B1\u03C0\u03CC \u03B4\u03B9\u03B1\u03BA\u03BF\u03BC\u03B9\u03C3\u03C4\u03AE...
-RepNextExtract=\u03A0\u03C1\u03BF\u03B5\u03C4\u03BF\u03B9\u03BC\u03B1\u03C3\u03AF\u03B1 \u03B4\u03B5\u03B4\u03BF\u03BC\u03AD\u03BD\u03C9\u03BD
-RepProgCommit=\u0395\u03C0\u03B9\u03B2\u03B5\u03B2\u03B1\u03AF\u03C9\u03C3\u03B7
-RepProgExtract=\u0395\u03BE\u03B1\u03B3\u03C9\u03B3\u03AE
-RepProgSync=\u0391\u03BD\u03C4\u03B1\u03BB\u03BB\u03B1\u03B3\u03AE \u03B4\u03B5\u03B4\u03BF\u03BC\u03AD\u03BD\u03C9\u03BD
-RepProgUpdate=\u0395\u03BD\u03B7\u03BC\u03AD\u03C1\u03C9\u03C3\u03B7
-RepStartDate=\u0388\u03BD\u03B1\u03C1\u03BE\u03B7
-Replicate=\u0391\u03BD\u03B1\u03C0\u03B1\u03C1\u03B1\u03B3\u03C9\u03B3\u03AE
-ReplicationStatus=\u039A\u03B1\u03C4\u03AC\u03C3\u03C4\u03B1\u03C3\u03B7 \u03B1\u03BD\u03B1\u03C0\u03B1\u03C1\u03B1\u03B3\u03C9\u03B3\u03AE\u03C2
-ResetPasswordUserHasNoLoginName=\u03A4\u03BF \u03B5\u03C0\u03B9\u03BB\u03B5\u03B3\u03BC\u03AD\u03BD\u03BF \u03C0\u03C1\u03CC\u03C3\u03C9\u03C0\u03BF \u03B4\u03B5\u03BD \u03AD\u03C7\u03B5\u03B9 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF \u03CC\u03BD\u03BF\u03BC\u03B1 \u03C3\u03CD\u03BD\u03B4\u03B5\u03C3\u03B7\u03C2.
-ResultOfTableVerification=\u0391\u03C0\u03BF\u03C4\u03AD\u03BB\u03B5\u03C3\u03BC\u03B1 \u03B5\u03BB\u03AD\u03B3\u03C7\u03BF\u03C5 \u0392\u03AC\u03C3\u03B7\u03C2 \u03B4\u03B5\u03B4\u03BF\u03BC\u03AD\u03BD\u03C9\u03BD
-Row=\u0395\u03B3\u03B3\u03C1\u03B1\u03C6\u03AE
-RowCountDifferenceOnTable=\u0391\u03BD\u03B1\u03BD\u03C4\u03B9\u03C3\u03C4\u03BF\u03B9\u03C7\u03AF\u03B1 \u03B1\u03C1\u03B9\u03B8\u03BC\u03BF\u03CD \u03C3\u03B5\u03B9\u03C1\u03CE\u03BD
-SWUpdateMsg10=\u03A3\u03C6\u03AC\u03BB\u03BC\u03B1 \u03BA\u03B1\u03C4\u03AC \u03C4\u03B7 \u03B4\u03B7\u03BC\u03B9\u03BF\u03C5\u03C1\u03B3\u03AF\u03B1 \u03B1\u03BD\u03C4\u03B9\u03B3\u03C1\u03AC\u03C6\u03C9\u03BD \u03B1\u03C3\u03C6\u03B1\u03BB\u03B5\u03AF\u03B1\u03C2 \u03BA\u03B1\u03B9 \u03C4\u03B7\u03BD \u03B5\u03BD\u03B7\u03BC\u03AD\u03C1\u03C9\u03C3\u03B7 \u03C4\u03BF\u03C5\:
-SWUpdateMsg1=\u039C\u03B9\u03B1 \u03B5\u03BD\u03B7\u03BC\u03AD\u03C1\u03C9\u03C3\u03B7 \u03BB\u03BF\u03B3\u03B9\u03C3\u03BC\u03B9\u03BA\u03BF\u03CD \u03B5\u03AF\u03BD\u03B1\u03B9 \u03B4\u03B9\u03B1\u03B8\u03AD\u03C3\u03B9\u03BC\u03B7.\n\u0397 \u03AD\u03BA\u03B4\u03BF\u03C3\u03B7 \u03C4\u03B7\u03C2 \u03B5\u03B3\u03BA\u03B1\u03C4\u03AC\u03C3\u03C4\u03B1\u03C3\u03AE\u03C2 \u03C3\u03B1\u03C2 \u03B5\u03AF\u03BD\u03B1\u03B9 \: \#OLD\#\n\u0397 \u03BD\u03AD\u03B1 \u03AD\u03BA\u03B4\u03BF\u03C3\u03B7 \u03B5\u03AF\u03BD\u03B1\u03B9\: \#NEW\#
-SWUpdateMsg2=\u0398\u03AD\u03BB\u03B5\u03C4\u03B5 \u03BD\u03B1 \u03B5\u03BD\u03B7\u03BC\u03B5\u03C1\u03CE\u03C3\u03B5\u03C4\u03B5 \u03C4\u03BF \u03BB\u03BF\u03B3\u03B9\u03C3\u03BC\u03B9\u03BA\u03CC;
-SWUpdateMsg3a=\u0397 \u03B5\u03BD\u03B7\u03BC\u03AD\u03C1\u03C9\u03C3\u03B7 \u03C4\u03BF\u03C5 \u03BB\u03BF\u03B3\u03B9\u03C3\u03BC\u03B9\u03BA\u03BF\u03CD \u03BA\u03B1\u03C4\u03AD\u03B2\u03B7\u03BA\u03B5 \u03BC\u03B5 \u03B5\u03C0\u03B9\u03C4\u03C5\u03C7\u03AF\u03B1. \n\u0397 \u03B5\u03BD\u03B7\u03BC\u03AD\u03C1\u03C9\u03C3\u03B7 \u03B8\u03B1 \u03B5\u03C6\u03B1\u03C1\u03BC\u03BF\u03C3\u03C4\u03B5\u03AF \u03C4\u03B7\u03BD \u03B5\u03C0\u03CC\u03BC\u03B5\u03BD\u03B7 \u03C6\u03BF\u03C1\u03AC \u03C0\u03BF\u03C5 \u03B8\u03B1 \u03B1\u03BD\u03BF\u03AF\u03BE\u03B5\u03C4\u03B5 \u03C4\u03B7\u03BD \u03B5\u03C6\u03B1\u03C1\u03BC\u03BF\u03B3\u03AE.
-SWUpdateMsg4=\u0394\u03B5\u03BD \u03C5\u03C0\u03AC\u03C1\u03C7\u03B5\u03B9 \u03B4\u03B9\u03B1\u03B8\u03AD\u03C3\u03B9\u03BC\u03BF \u03B4\u03AF\u03BA\u03C4\u03C5\u03BF
-SWUpdateMsg5=\u0397 \u03BB\u03AE\u03C8\u03B7 \u03C4\u03B7\u03C2 \u03C0\u03B1\u03C1\u03B1\u03BB\u03BB\u03B1\u03B3\u03AE\u03C2 \u03B4\u03B9\u03B1\u03BA\u03BF\u03BC\u03B9\u03C3\u03C4\u03AE \u03B1\u03C0\u03AD\u03C4\u03C5\u03C7\u03B5
-SWUpdateMsg6=\u0397 \u03B5\u03B3\u03BA\u03B1\u03C4\u03AC\u03C3\u03C4\u03B1\u03C3\u03B7 \u03B5\u03AF\u03BD\u03B1\u03B9 \u03B5\u03BD\u03B7\u03BC\u03B5\u03C1\u03C9\u03BC\u03AD\u03BD\u03B7
-SWUpdateMsg7=\u0397 \u03B5\u03BD\u03B7\u03BC\u03AD\u03C1\u03C9\u03C3\u03B7 \u03C4\u03BF\u03C5 \u03BB\u03BF\u03B3\u03B9\u03C3\u03BC\u03B9\u03BA\u03BF\u03CD \u03B1\u03BA\u03C5\u03C1\u03CE\u03B8\u03B7\u03BA\u03B5
-SWUpdateMsg8=\u0394\u03B5\u03BD \u03B5\u03AF\u03BD\u03B1\u03B9 \u03B4\u03C5\u03BD\u03B1\u03C4\u03CC\u03BD \u03BD\u03B1 \u03B2\u03C1\u03B5\u03B8\u03B5\u03AF \u03BF \u03BA\u03B1\u03C4\u03AC\u03BB\u03BF\u03B3\u03BF\u03C2 lib \u03BC\u03B5 \u03B1\u03C1\u03C7\u03B5\u03AF\u03B1 \u03C4\u03CD\u03C0\u03BF\u03C5 jar\:
-SWUpdateMsg9=\u0397 \u03BB\u03AE\u03C8\u03B7 \u03BD\u03AD\u03C9\u03BD \u03B1\u03C1\u03C7\u03B5\u03AF\u03C9\u03BD \u03B1\u03C0\u03CC \u03C4\u03BF \u03B4\u03B9\u03B1\u03BA\u03BF\u03BC\u03B9\u03C3\u03C4\u03AE \u03B1\u03C0\u03AD\u03C4\u03C5\u03C7\u03B5
-SaveAndLoopback=\u0391\u03BD\u03B1\u03BA\u03CD\u03BA\u03BB\u03C9\u03C3\u03B7 \u03BA\u03B1\u03B9 \u03B1\u03C0\u03BF\u03B8\u03AE\u03BA\u03B5\u03C5\u03C3\u03B7
-ScOutlookErrorCache=\u0397 \u03C3\u03C5\u03BD\u03B4\u03B5\u03CC\u03BC\u03B5\u03BD\u03B7 \u03C5\u03C0\u03BF\u03BC\u03BF\u03BD\u03AC\u03B4\u03B1 \u03B4\u03B5\u03BD \u03BC\u03C0\u03CC\u03C1\u03B5\u03C3\u03B5 \u03BD\u03B1 \u03B1\u03C0\u03BF\u03B8\u03B7\u03BA\u03B5\u03CD\u03C3\u03B5\u03B9 \u03B1\u03BD\u03C4\u03B9\u03BA\u03B5\u03AF\u03BC\u03B5\u03BD\u03B1 Outlook. \n\u039F \u03C3\u03C5\u03B3\u03C7\u03C1\u03BF\u03BD\u03B9\u03C3\u03BC\u03CC\u03C2 \u03CC\u03BB\u03C9\u03BD \u03C4\u03C9\u03BD '{0}' \u03C0\u03B1\u03C1\u03B1\u03BA\u03AC\u03BC\u03C6\u03B8\u03B7\u03BA\u03B5. \n\u03A0\u03B1\u03C1\u03B1\u03BA\u03B1\u03BB\u03BF\u03CD\u03BC\u03B5 \u03B5\u03BB\u03AD\u03B3\u03BE\u03C4\u03B5 \u03C4\u03B7\u03BD \u03B4\u03B9\u03B1\u03BC\u03CC\u03C1\u03C6\u03C9\u03C3\u03B7 \u03C4\u03BF\u03C5 Outlook
-ScOutlookErrorGeneral=\u0397 \u03C3\u03C5\u03BD\u03B4\u03B5\u03CC\u03BC\u03B5\u03BD\u03B7 \u03C5\u03C0\u03BF\u03BC\u03BF\u03BD\u03AC\u03B4\u03B1 \u03B4\u03B5\u03BD \u03BC\u03C0\u03CC\u03C1\u03B5\u03C3\u03B5 \u03BD\u03B1 \u03B1\u03C1\u03C7\u03B9\u03BA\u03BF\u03C0\u03BF\u03B9\u03AE\u03C3\u03B5\u03B9 \u03C4\u03BF Outlook. \n\u03A0\u03B1\u03C1\u03B1\u03BA\u03B1\u03BB\u03BF\u03CD\u03BC\u03B5 \u03B5\u03BB\u03AD\u03B3\u03BE\u03C4\u03B5 \u03C4\u03B7 \u03B4\u03B9\u03B1\u03BC\u03CC\u03C1\u03C6\u03C9\u03C3\u03B7 \u03C4\u03BF\u03C5 Outlook. \u0391\u03BD \u03C4\u03BF \n\u03C0\u03C1\u03CC\u03B2\u03BB\u03B7\u03BC\u03B1 \u03B5\u03BE\u03B1\u03BA\u03BF\u03BB\u03BF\u03C5\u03B8\u03B5\u03AF, \u03B5\u03C0\u03B9\u03BA\u03BF\u03BD\u03C9\u03BD\u03AE\u03C3\u03C4\u03B5 \u03B3\u03B9\u03B1 \u03B2\u03BF\u03AE\u03B8\u03B5\u03B9\u03B1 \u03BC\u03B5 \u03C4\u03B7 BSI.
-ScOutlookErrorPartial=\u0397 \u03C3\u03C5\u03BD\u03B4\u03B5\u03CC\u03BC\u03B5\u03BD\u03B7 \u03C5\u03C0\u03BF\u03BC\u03BF\u03BD\u03AC\u03B4\u03B1 \u03B5\u03BC\u03C6\u03AC\u03BD\u03B9\u03C3\u03B5 \u03C0\u03C1\u03CC\u03B2\u03BB\u03B7\u03BC\u03B1 \u03C3\u03C5\u03B3\u03C7\u03C1\u03BF\u03BD\u03B9\u03C3\u03BC\u03BF\u03CD \u03BA\u03AC\u03C0\u03BF\u03B9\u03C9\u03BD \u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03C9\u03BD. \n\u03A4\u03B1 \u03B1\u03BA\u03CC\u03BB\u03BF\u03C5\u03B8\u03B1 \u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1 \u03C0\u03B1\u03C1\u03B1\u03BA\u03AC\u03BC\u03B8\u03C6\u03B7\u03BA\u03B1\u03BD\:\n{0}
-ScOutlookErrorTooMany=\u03A0\u03AC\u03C1\u03B1 \u03C0\u03BF\u03BB\u03BB\u03AC \u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1 \u03B3\u03B9\u03B1 \u03C0\u03C1\u03BF\u03B2\u03BF\u03BB\u03AE.
-ScOutlookErrorUnknown=\u0397 \u03C3\u03C5\u03BD\u03B4\u03B5\u03CC\u03BC\u03B5\u03BD\u03B7 \u03C5\u03C0\u03BF\u03BC\u03BF\u03BD\u03AC\u03B4\u03B1 \u03C0\u03C1\u03BF\u03BA\u03AC\u03BB\u03B5\u03C3\u03B5 \u03AC\u03B3\u03BD\u03C9\u03C3\u03C4\u03BF \u03C3\u03C6\u03AC\u03BB\u03BC\u03B1. \n\u0393\u03B9\u03B1 \u03C0\u03B5\u03C1\u03B9\u03C3\u03C3\u03CC\u03C4\u03B5\u03C1\u03B5\u03C2 \u03C0\u03BB\u03B7\u03C1\u03BF\u03C6\u03BF\u03C1\u03AF\u03B5\u03C2 \u03C0\u03B1\u03C1\u03B1\u03BA\u03B1\u03BB\u03BF\u03CD\u03BC\u03B5 \u03B4\u03B5\u03AF\u03C4\u03B5 \u03C4\u03BF \u03B7\u03BC\u03B5\u03C1\u03BF\u03BB\u03CC\u03B3\u03B9\u03BF \u03C3\u03C6\u03AC\u03BB\u03BC\u03B1\u03C4\u03BF\u03C2
-ScOutlookTitle=ScOutlook Plugin
-Scout=EclipseScout
-SearchButtonPanelTooltip=\u0395\u03BA\u03BA\u03AF\u03BD\u03B7\u03C3\u03B7 \u03B1\u03BD\u03B1\u03B6\u03AE\u03C4\u03B7\u03C3\u03B7\u03C2
-Servidor_All=\u038C\u03BB\u03B1
-SmartFieldInvalidKey=
-StartupPhaseConfig=\u03A6\u03CC\u03C1\u03C4\u03C9\u03C3\u03B7 \u03B5\u03C6\u03B1\u03C1\u03BC\u03BF\u03B3\u03AE\u03C2...
-StartupPhaseOffline=\u03A0\u03C1\u03BF\u03B5\u03C4\u03BF\u03B9\u03BC\u03B1\u03C3\u03AF\u03B1 \u03C0\u03B5\u03C1\u03B9\u03B2\u03AC\u03BB\u03BB\u03BF\u03BD\u03C4\u03BF\u03C2
-StartupPhaseUpdate=\u0388\u03BB\u03B5\u03B3\u03C7\u03BF\u03C2 \u03B3\u03B9\u03B1 \u03B5\u03BD\u03B7\u03BC\u03B5\u03C1\u03CE\u03C3\u03B5\u03B9\u03C2...
-TableVerificationCoefficient=\u03A3\u03C5\u03BD\u03C4\u03B5\u03BB\u03B5\u03C3\u03C4\u03AE\u03C2 \u03C3\u03C5\u03C3\u03C7\u03AD\u03C4\u03B9\u03C3\u03B7\u03C2
-TableVerificationSuccessful=\u039F \u03AD\u03BB\u03B5\u03B3\u03C7\u03BF\u03C2 \u03C3\u03C5\u03C3\u03C7\u03AD\u03C4\u03B9\u03C3\u03B7\u03C2 \u03B2\u03AC\u03C3\u03B7\u03C2 \u03B4\u03B5\u03B4\u03BF\u03BC\u03AD\u03BD\u03C9\u03BD \u03BF\u03BB\u03BF\u03BA\u03BB\u03B7\u03C1\u03CE\u03B8\u03B7\u03BA\u03B5
-Using=\u03A7\u03C1\u03B7\u03C3\u03B9\u03BC\u03BF\u03C0\u03BF\u03B9\u03B5\u03AF
-VerifyOfflineEnvironment=\u0395\u03C0\u03B1\u03BB\u03AE\u03B8\u03B5\u03C5\u03C3\u03B7/\u03AD\u03BB\u03B5\u03B3\u03C7\u03BF\u03C2
-WorkOffline=\u03B5\u03C1\u03B3\u03B1\u03C3\u03AF\u03B1 \u03C7\u03C9\u03C1\u03AF\u03C2 \u03C3\u03CD\u03BD\u03B4\u03B5\u03C3\u03B7
-WorkOfflineInfoText=\u0393\u03B9\u03B1 \u03BD\u03B1 \u03B5\u03BD\u03B5\u03C1\u03B3\u03BF\u03C0\u03BF\u03B9\u03AE\u03C3\u03B5\u03C4\u03B5 \u03C4\u03B7\u03BD \u03B5\u03C1\u03B3\u03B1\u03C3\u03AF\u03B1 \u03C7\u03C9\u03C1\u03AF\u03C2 \u03C3\u03CD\u03BD\u03B4\u03B5\u03C3\u03B7, \u03C0\u03B1\u03C1\u03B1\u03BA\u03B1\u03BB\u03BF\u03CD\u03BC\u03B5 \u03B5\u03B9\u03C3\u03AC\u03B3\u03B5\u03C4\u03B5 \u03C3\u03C4\u03BF \u03C0\u03B5\u03B4\u03AF\u03BF "\u0394\u03B9\u03B1\u03BA\u03BF\u03BC\u03B9\u03C3\u03C4\u03AE\u03C2" \u03C4\u03BF URL \u03C4\u03BF\u03C5 \u03B4\u03B9\u03B1\u03BA\u03BF\u03BC\u03B9\u03C3\u03C4\u03AE \u03B5\u03C6\u03B1\u03C1\u03BC\u03BF\u03B3\u03AE\u03C2. \u0395\u03AF\u03BD\u03B1\u03B9 \u03C3\u03C5\u03BD\u03AE\u03B8\u03C9\u03C2 \u03C4\u03BF \u03AF\u03B4\u03B9\u03BF URL \u03C0\u03BF\u03C5 \u03C7\u03C1\u03B7\u03C3\u03B9\u03BC\u03BF\u03C0\u03BF\u03B9\u03B5\u03AF\u03C4\u03B5 \u03B3\u03B9\u03B1 \u03BD\u03B1 \u03B5\u03C1\u03B3\u03B1\u03C3\u03C4\u03B5\u03AF\u03C4\u03B5 \u03BC\u03B5 \u03C3\u03CD\u03BD\u03B4\u03B5\u03C3\u03B7.
+AutomaticallyStopAfterFirstFetch=\u03A0\u03C1\u03BF\u03C3\u03BA\u03CC\u03BC\u03B9\u03C3\u03B7 \u03BC\u03CC\u03BD\u03BF \u03C0\u03C1\u03CE\u03C4\u03B7\u03C2 \u03B5\u03B3\u03B3\u03C1\u03B1\u03C6\u03AE\u03C2
+Calendar_itemCont=(tag)
+Calendar_itemFrom=\u03B1\u03C0\u03CC
+Calendar_itemUntil=\u03BC\u03AD\u03C7\u03C1\u03B9
+CopyPasteHint=(\u0393\u03B9\u03B1 \u03B1\u03BD\u03B1\u03BB\u03C5\u03C4\u03B9\u03BA\u03AD\u03C2 \u03C0\u03BB\u03B7\u03C1\u03BF\u03C6\u03BF\u03C1\u03AF\u03B5\u03C2, \u03C0\u03B1\u03C4\u03AE\u03C3\u03C4\u03B5 \u0391\u03BD\u03C4\u03B9\u03B3\u03C1\u03B1\u03C6\u03AE \u03BA\u03B1\u03B9 \u0395\u03C0\u03B9\u03BA\u03CC\u03BB\u03BB\u03B7\u03C3\u03B7 \u03C3\u03C4\u03BF\u03BD \u03B4\u03B9\u03BF\u03C1\u03B8\u03C9\u03C4\u03AE \u03BA\u03B5\u03B9\u03BC\u03AD\u03BD\u03BF\u03C5
+CouldNotCreateOfflineDirectory=\u0394\u03B5\u03BD \u03B5\u03AF\u03BD\u03B1\u03B9 \u03B4\u03C5\u03BD\u03B1\u03C4\u03CC\u03BD \u03BD\u03B1 \u03B4\u03B7\u03BC\u03B9\u03BF\u03C5\u03C1\u03B3\u03B7\u03B8\u03B5\u03AF \u03C4\u03BF\u03C0\u03B9\u03BA\u03CC\u03C2 \u03BA\u03B1\u03C4\u03AC\u03BB\u03BF\u03B3\u03BF\u03C2
+CouldNotFindOfflineClasses=\u0394\u03B5\u03BD \u03B5\u03AF\u03BD\u03B1\u03B9 \u03B4\u03C5\u03BD\u03B1\u03C4\u03CC\u03BD \u03BD\u03B1 \u03B2\u03C1\u03B5\u03B8\u03B5\u03AF \u03C0\u03B5\u03C1\u03B9\u03B2\u03AC\u03BB\u03BB\u03BF\u03BD \u03C7\u03C9\u03C1\u03AF\u03C2 \u03C3\u03CD\u03BD\u03B4\u03B5\u03C3\u03B7
+CouldNotFindOfflineConfig=\u0394\u03B5\u03BD \u03B5\u03AF\u03BD\u03B1\u03B9 \u03B4\u03C5\u03BD\u03B1\u03C4\u03CC\u03BD \u03BD\u03B1 \u03B2\u03C1\u03B5\u03B8\u03B5\u03AF \u03B4\u03B9\u03B1\u03BC\u03CC\u03C1\u03C6\u03C9\u03C3\u03B7 \u03C7\u03C9\u03C1\u03AF\u03C2 \u03C3\u03CD\u03BD\u03B4\u03B5\u03C3\u03B7
+CouldNotFindOfflineDatabase=\u0394\u03B5\u03BD \u03B5\u03AF\u03BD\u03B1\u03B9 \u03B4\u03C5\u03BD\u03B1\u03C4\u03CC\u03BD \u03BD\u03B1 \u03B2\u03C1\u03B5\u03B8\u03B5\u03AF \u03C4\u03BF\u03C0\u03B9\u03BA\u03AE \u03B2\u03AC\u03C3\u03B7 \u03B4\u03B5\u03B4\u03BF\u03BC\u03AD\u03BD\u03C9\u03BD
+DisplayedTimerange=\u0395\u03C0\u03B5\u03BE\u03AE\u03B3\u03B7\u03C3\u03B7 \u03C7\u03C1\u03BF\u03BD\u03B9\u03BA\u03BF\u03CD \u03B5\u03CD\u03C1\u03BF\u03C5\u03C2
+DoubleWeek=\u0394\u03B9\u03C0\u03BB\u03AE \u03B5\u03B2\u03B4\u03BF\u03BC\u03AC\u03B4\u03B1
+DownloadOfflineDatabase=\u0398\u03AD\u03BB\u03B5\u03C4\u03B5 \u03BD\u03B1 \u03BA\u03B1\u03C4\u03B5\u03B2\u03AC\u03C3\u03B5\u03C4\u03B5 \u03C4\u03B7 \u03B2\u03AC\u03C3\u03B7 \u03B4\u03B5\u03B4\u03BF\u03BC\u03AD\u03BD\u03C9\u03BD;
+EditMenu=\u0395\u03C0\u03B5\u03BE\u03B5\u03C1\u03B3\u03B1\u03C3\u03AF\u03B1...
+EndStatus=\u03A4\u03B5\u03BB\u03B9\u03BA\u03AE \u039A\u03B1\u03C4\u03AC\u03C3\u03C4\u03B1\u03C3\u03B7
+ErrorReadingOfflineTable=\u03A3\u03C6\u03AC\u03BB\u03BC\u03B1 \u03BA\u03B1\u03C4\u03AC \u03C4\u03B7\u03BD \u03B1\u03BD\u03AC\u03B3\u03BD\u03C9\u03C3\u03B7 \u03C0\u03AF\u03BD\u03B1\u03BA\u03B1 \u03C7\u03C9\u03C1\u03AF\u03C2 \u03C3\u03CD\u03BD\u03B4\u03B5\u03C3\u03B7
+ErrorReadingOnlineTable=\u03A3\u03C6\u03AC\u03BB\u03BC\u03B1 \u03BA\u03B1\u03C4\u03AC \u03C4\u03B7\u03BD \u03B1\u03BD\u03AC\u03B3\u03BD\u03C9\u03C3\u03B7 \u03C0\u03AF\u03BD\u03B1\u03BA\u03B1 \u03B4\u03B9\u03B1\u03BA\u03BF\u03BC\u03B9\u03C3\u03C4\u03AE
+EstimatedEndDate=\u039F\u03BB\u03BF\u03BA\u03BB\u03B7\u03C1\u03CE\u03B8\u03B7\u03BA\u03B5
+ExtendedSearchSaveButton=\u03A0\u03C1\u03BF\u03C3\u03B8\u03AE\u03BA\u03B7
+FailedDownloadingFile=\u0394\u03B5\u03BD \u03B5\u03AF\u03BD\u03B1\u03B9 \u03B4\u03C5\u03BD\u03B1\u03C4\u03CC\u03BD \u03BD\u03B1 \u03BA\u03B1\u03C4\u03B5\u03B2\u03B5\u03AF \u03C4\u03BF \u03B1\u03C1\u03C7\u03B5\u03AF\u03BF
+FailedGettingOfflineTableVerification=\u0397 \u03B5\u03C0\u03B1\u03BB\u03AE\u03B8\u03B5\u03C5\u03C3\u03B7 \u03C4\u03BF\u03C5 \u03C0\u03AF\u03BD\u03B1\u03BA\u03B1 \u03C7\u03C9\u03C1\u03AF\u03C2 \u03C3\u03CD\u03BD\u03B4\u03B5\u03C3\u03B7 \u03B1\u03C0\u03AD\u03C4\u03C5\u03C7\u03B5
+FailedGettingOnlineTableVerification=\u0397 \u03B5\u03C0\u03B1\u03BB\u03AE\u03B8\u03B5\u03C5\u03C3\u03B7 \u03C4\u03BF\u03C5 \u03C0\u03AF\u03BD\u03B1\u03BA\u03B1 \u03B4\u03B9\u03B1\u03BA\u03BF\u03BC\u03B9\u03C3\u03C4\u03AE \u03B1\u03C0\u03AD\u03C4\u03C5\u03C7\u03B5
+Field=\u03A0\u03B5\u03B4\u03AF\u03BF
+Fields=\u03A0\u03B5\u03B4\u03AF\u03B1
+HtmlPluginActionSubmitted=\u0397 \u03B5\u03BD\u03AD\u03C1\u03B3\u03B5\u03B9\u03B1 \u03B5\u03BA\u03C4\u03B5\u03BB\u03AD\u03C3\u03C4\u03B7\u03BA\u03B5.
+HtmlPluginChangesSaved=\u039F\u03B9 \u03B1\u03BB\u03BB\u03B1\u03B3\u03AD\u03C2 \u03B1\u03C0\u03BF\u03B8\u03B7\u03BA\u03B5\u03CD\u03C4\u03B7\u03BA\u03B1\u03BD
+HtmlPluginPendingAction=\u0388\u03C7\u03B5\u03C4\u03B5 \u03AE\u03B4\u03B7 \u03B1\u03BD\u03BF\u03B9\u03C7\u03C4\u03AE \u03BC\u03B9\u03B1 \u03B1\u03BD\u03B1\u03B4\u03C5\u03CC\u03BC\u03B5\u03BD\u03B7 \u03BF\u03B8\u03CC\u03BD\u03B7 \u03C3\u03C4\u03BF \u03B5\u03C1\u03B3\u03B1\u03BB\u03B5\u03AF\u03BF. \u03A0\u03C1\u03CE\u03C4\u03B1 \u03BA\u03BB\u03B5\u03AF\u03C3\u03C4\u03B5 \u03C4\u03B7 \u03BA\u03B1\u03B9 \u03C0\u03C1\u03BF\u03C3\u03C0\u03B1\u03B8\u03AE\u03C3\u03C4\u03B5 \u03BE\u03B1\u03BD\u03AC.
+HtmlPopupInfoPanel=\u039C\u03B9\u03B1 \u03B1\u03BD\u03B1\u03B4\u03C5\u03CC\u03BC\u03B5\u03BD\u03B7 \u03BF\u03B8\u03CC\u03BD\u03B7 \u03AD\u03C7\u03B5\u03B9 \u03B1\u03BD\u03BF\u03AF\u03BE\u03B5\u03B9 \u03C3\u03C4\u03BF \u03B5\u03C1\u03B3\u03B1\u03BB\u03B5\u03AF\u03BF
+InvolvedPersons=\u0395\u03BC\u03C0\u03BB\u03B5\u03BA\u03CC\u03BC\u03B5\u03BD\u03BF \u03A0\u03C1\u03CC\u03C3\u03C9\u03C0\u03B1
+LiveEdit=\u0395\u03C0\u03B5\u03BE\u03B5\u03C1\u03B3\u03B1\u03C3\u03AF\u03B1 Live
+LotusNotesCode=Lotus Notes
+MissingOfflineTable=\u039F \u03C0\u03AF\u03BD\u03B1\u03BA\u03B1\u03C2 \u03C7\u03C9\u03C1\u03AF\u03C2 \u03C3\u03CD\u03BD\u03B4\u03B5\u03C3\u03B7 \u03BB\u03B5\u03AF\u03C0\u03B5\u03B9
+MissingOnlineTable=\u039F \u03C0\u03AF\u03BD\u03B1\u03BA\u03B1\u03C2 \u03B4\u03B9\u03B1\u03BA\u03BF\u03BC\u03B9\u03C3\u03C4\u03AE \u03BB\u03B5\u03AF\u03C0\u03B5\u03B9
+Offline=\u03A7\u03C9\u03C1\u03AF\u03C2 \u03C3\u03CD\u03BD\u03B4\u03B5\u03C3\u03B7
+OfflineAdmin=\u0394\u03B9\u03B1\u03C7\u03B5\u03B9\u03C1\u03B9\u03C3\u03C4\u03AE\u03C2 \u03A7\u03C9\u03C1\u03AF\u03C2 \u03A3\u03CD\u03BD\u03B4\u03B5\u03C3\u03B7
+OfflineDirectory=\u03A4\u03BF\u03C0\u03B9\u03BA\u03CC\u03C2 \u039A\u03B1\u03C4\u03AC\u03BB\u03BF\u03B3\u03BF\u03C2
+OfflineInstallationInvalidMessage=\u0391\u03C5\u03C4\u03AE \u03B7 \u03B5\u03B3\u03BA\u03B1\u03C4\u03AC\u03C3\u03C4\u03B1\u03C3\u03B7 \u03C7\u03C9\u03C1\u03AF\u03C2 \u03C3\u03CD\u03BD\u03B4\u03B5\u03C3\u03B7 \u03B4\u03B5\u03BD \u03B5\u03AF\u03BD\u03B1\u03B9 \u03C0\u03BB\u03AE\u03C1\u03B7\u03C2
+OfflineInstallationValidMessage=\u0391\u03C5\u03C4\u03AE \u03B7 \u03B5\u03B3\u03BA\u03B1\u03C4\u03AC\u03C3\u03C4\u03B1\u03C3\u03B7 \u03C7\u03C9\u03C1\u03AF\u03C2 \u03C3\u03CD\u03BD\u03B4\u03B5\u03C3\u03B7 \u03B5\u03AF\u03BD\u03B1\u03B9 \u03AD\u03C4\u03BF\u03B9\u03BC\u03B7 \u03BA\u03B1\u03B9 \u03C0\u03BB\u03AE\u03C1\u03B7\u03C2
+OfflineMasterServer=\u0394\u03B9\u03B1\u03BA\u03BF\u03BC\u03B9\u03C3\u03C4\u03AE\u03C2 \u03BC\u03B5 \u03C3\u03CD\u03BD\u03B4\u03B5\u03C3\u03B7
+OfflineReplicationInvalidMessage=\u0394\u03B5\u03BD \u03BC\u03C0\u03BF\u03C1\u03B5\u03AF \u03BD\u03B1 \u03B5\u03BA\u03C4\u03B5\u03BB\u03B5\u03C3\u03C4\u03B5\u03AF \u03B1\u03BD\u03B1\u03C0\u03B1\u03C1\u03B1\u03B3\u03C9\u03B3\u03AE
+OfflineSetup=\u03A1\u03CD\u03B8\u03BC\u03B9\u03C3\u03B7 \u03C0\u03B5\u03C1\u03B9\u03B2\u03AC\u03BB\u03BB\u03BF\u03BD\u03C4\u03BF\u03C2 \u03C7\u03C9\u03C1\u03AF\u03C2 \u03C3\u03CD\u03BD\u03B4\u03B5\u03C3\u03B7
+Operator=\u03A7\u03B5\u03B9\u03C1\u03B9\u03C3\u03C4\u03AE\u03C2
+Operators=\u03A7\u03B5\u03B9\u03C1\u03B9\u03C3\u03C4\u03AD\u03C2
+PleaseCheckOfflineDirectory=\u03A0\u03B1\u03C1\u03B1\u03BA\u03B1\u03BB\u03BF\u03CD\u03BC\u03B5 \u03B5\u03BB\u03AD\u03B3\u03BE\u03C4\u03B5 \u03C4\u03BF\u03BD \u03BA\u03B1\u03C4\u03AC\u03BB\u03BF\u03B3\u03BF \u03C7\u03C9\u03C1\u03AF\u03C2 \u03C3\u03CD\u03BD\u03B4\u03B5\u03C3\u03B7
+Programmed=\u0394\u03B9\u03B1\u03C3\u03C6\u03AC\u03BB\u03B9\u03C3\u03B7 \u03C0\u03BF\u03B9\u03CC\u03C4\u03B7\u03C4\u03B1\u03C2
+RepDone=\u039F\u039A
+RepEndDate=\u039F\u03BB\u03BF\u03BA\u03BB\u03B7\u03C1\u03CE\u03B8\u03B7\u03BA\u03B5
+RepGetServerUpdate=\u039B\u03AE\u03C8\u03B7 \u03B4\u03B5\u03B4\u03BF\u03BC\u03AD\u03BD\u03C9\u03BD \u03B1\u03C0\u03CC \u03B4\u03B9\u03B1\u03BA\u03BF\u03BC\u03B9\u03C3\u03C4\u03AE...
+RepNextExtract=\u03A0\u03C1\u03BF\u03B5\u03C4\u03BF\u03B9\u03BC\u03B1\u03C3\u03AF\u03B1 \u03B4\u03B5\u03B4\u03BF\u03BC\u03AD\u03BD\u03C9\u03BD
+RepProgCommit=\u0395\u03C0\u03B9\u03B2\u03B5\u03B2\u03B1\u03AF\u03C9\u03C3\u03B7
+RepProgExtract=\u0395\u03BE\u03B1\u03B3\u03C9\u03B3\u03AE
+RepProgSync=\u0391\u03BD\u03C4\u03B1\u03BB\u03BB\u03B1\u03B3\u03AE \u03B4\u03B5\u03B4\u03BF\u03BC\u03AD\u03BD\u03C9\u03BD
+RepProgUpdate=\u0395\u03BD\u03B7\u03BC\u03AD\u03C1\u03C9\u03C3\u03B7
+RepStartDate=\u0388\u03BD\u03B1\u03C1\u03BE\u03B7
+Replicate=\u0391\u03BD\u03B1\u03C0\u03B1\u03C1\u03B1\u03B3\u03C9\u03B3\u03AE
+ReplicationStatus=\u039A\u03B1\u03C4\u03AC\u03C3\u03C4\u03B1\u03C3\u03B7 \u03B1\u03BD\u03B1\u03C0\u03B1\u03C1\u03B1\u03B3\u03C9\u03B3\u03AE\u03C2
+ResetPasswordUserHasNoLoginName=\u03A4\u03BF \u03B5\u03C0\u03B9\u03BB\u03B5\u03B3\u03BC\u03AD\u03BD\u03BF \u03C0\u03C1\u03CC\u03C3\u03C9\u03C0\u03BF \u03B4\u03B5\u03BD \u03AD\u03C7\u03B5\u03B9 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF \u03CC\u03BD\u03BF\u03BC\u03B1 \u03C3\u03CD\u03BD\u03B4\u03B5\u03C3\u03B7\u03C2.
+ResultOfTableVerification=\u0391\u03C0\u03BF\u03C4\u03AD\u03BB\u03B5\u03C3\u03BC\u03B1 \u03B5\u03BB\u03AD\u03B3\u03C7\u03BF\u03C5 \u0392\u03AC\u03C3\u03B7\u03C2 \u03B4\u03B5\u03B4\u03BF\u03BC\u03AD\u03BD\u03C9\u03BD
+Row=\u0395\u03B3\u03B3\u03C1\u03B1\u03C6\u03AE
+RowCountDifferenceOnTable=\u0391\u03BD\u03B1\u03BD\u03C4\u03B9\u03C3\u03C4\u03BF\u03B9\u03C7\u03AF\u03B1 \u03B1\u03C1\u03B9\u03B8\u03BC\u03BF\u03CD \u03C3\u03B5\u03B9\u03C1\u03CE\u03BD
+SWUpdateMsg10=\u03A3\u03C6\u03AC\u03BB\u03BC\u03B1 \u03BA\u03B1\u03C4\u03AC \u03C4\u03B7 \u03B4\u03B7\u03BC\u03B9\u03BF\u03C5\u03C1\u03B3\u03AF\u03B1 \u03B1\u03BD\u03C4\u03B9\u03B3\u03C1\u03AC\u03C6\u03C9\u03BD \u03B1\u03C3\u03C6\u03B1\u03BB\u03B5\u03AF\u03B1\u03C2 \u03BA\u03B1\u03B9 \u03C4\u03B7\u03BD \u03B5\u03BD\u03B7\u03BC\u03AD\u03C1\u03C9\u03C3\u03B7 \u03C4\u03BF\u03C5\:
+SWUpdateMsg1=\u039C\u03B9\u03B1 \u03B5\u03BD\u03B7\u03BC\u03AD\u03C1\u03C9\u03C3\u03B7 \u03BB\u03BF\u03B3\u03B9\u03C3\u03BC\u03B9\u03BA\u03BF\u03CD \u03B5\u03AF\u03BD\u03B1\u03B9 \u03B4\u03B9\u03B1\u03B8\u03AD\u03C3\u03B9\u03BC\u03B7.\n\u0397 \u03AD\u03BA\u03B4\u03BF\u03C3\u03B7 \u03C4\u03B7\u03C2 \u03B5\u03B3\u03BA\u03B1\u03C4\u03AC\u03C3\u03C4\u03B1\u03C3\u03AE\u03C2 \u03C3\u03B1\u03C2 \u03B5\u03AF\u03BD\u03B1\u03B9 \: \#OLD\#\n\u0397 \u03BD\u03AD\u03B1 \u03AD\u03BA\u03B4\u03BF\u03C3\u03B7 \u03B5\u03AF\u03BD\u03B1\u03B9\: \#NEW\#
+SWUpdateMsg2=\u0398\u03AD\u03BB\u03B5\u03C4\u03B5 \u03BD\u03B1 \u03B5\u03BD\u03B7\u03BC\u03B5\u03C1\u03CE\u03C3\u03B5\u03C4\u03B5 \u03C4\u03BF \u03BB\u03BF\u03B3\u03B9\u03C3\u03BC\u03B9\u03BA\u03CC;
+SWUpdateMsg3a=\u0397 \u03B5\u03BD\u03B7\u03BC\u03AD\u03C1\u03C9\u03C3\u03B7 \u03C4\u03BF\u03C5 \u03BB\u03BF\u03B3\u03B9\u03C3\u03BC\u03B9\u03BA\u03BF\u03CD \u03BA\u03B1\u03C4\u03AD\u03B2\u03B7\u03BA\u03B5 \u03BC\u03B5 \u03B5\u03C0\u03B9\u03C4\u03C5\u03C7\u03AF\u03B1. \n\u0397 \u03B5\u03BD\u03B7\u03BC\u03AD\u03C1\u03C9\u03C3\u03B7 \u03B8\u03B1 \u03B5\u03C6\u03B1\u03C1\u03BC\u03BF\u03C3\u03C4\u03B5\u03AF \u03C4\u03B7\u03BD \u03B5\u03C0\u03CC\u03BC\u03B5\u03BD\u03B7 \u03C6\u03BF\u03C1\u03AC \u03C0\u03BF\u03C5 \u03B8\u03B1 \u03B1\u03BD\u03BF\u03AF\u03BE\u03B5\u03C4\u03B5 \u03C4\u03B7\u03BD \u03B5\u03C6\u03B1\u03C1\u03BC\u03BF\u03B3\u03AE.
+SWUpdateMsg4=\u0394\u03B5\u03BD \u03C5\u03C0\u03AC\u03C1\u03C7\u03B5\u03B9 \u03B4\u03B9\u03B1\u03B8\u03AD\u03C3\u03B9\u03BC\u03BF \u03B4\u03AF\u03BA\u03C4\u03C5\u03BF
+SWUpdateMsg5=\u0397 \u03BB\u03AE\u03C8\u03B7 \u03C4\u03B7\u03C2 \u03C0\u03B1\u03C1\u03B1\u03BB\u03BB\u03B1\u03B3\u03AE\u03C2 \u03B4\u03B9\u03B1\u03BA\u03BF\u03BC\u03B9\u03C3\u03C4\u03AE \u03B1\u03C0\u03AD\u03C4\u03C5\u03C7\u03B5
+SWUpdateMsg6=\u0397 \u03B5\u03B3\u03BA\u03B1\u03C4\u03AC\u03C3\u03C4\u03B1\u03C3\u03B7 \u03B5\u03AF\u03BD\u03B1\u03B9 \u03B5\u03BD\u03B7\u03BC\u03B5\u03C1\u03C9\u03BC\u03AD\u03BD\u03B7
+SWUpdateMsg7=\u0397 \u03B5\u03BD\u03B7\u03BC\u03AD\u03C1\u03C9\u03C3\u03B7 \u03C4\u03BF\u03C5 \u03BB\u03BF\u03B3\u03B9\u03C3\u03BC\u03B9\u03BA\u03BF\u03CD \u03B1\u03BA\u03C5\u03C1\u03CE\u03B8\u03B7\u03BA\u03B5
+SWUpdateMsg8=\u0394\u03B5\u03BD \u03B5\u03AF\u03BD\u03B1\u03B9 \u03B4\u03C5\u03BD\u03B1\u03C4\u03CC\u03BD \u03BD\u03B1 \u03B2\u03C1\u03B5\u03B8\u03B5\u03AF \u03BF \u03BA\u03B1\u03C4\u03AC\u03BB\u03BF\u03B3\u03BF\u03C2 lib \u03BC\u03B5 \u03B1\u03C1\u03C7\u03B5\u03AF\u03B1 \u03C4\u03CD\u03C0\u03BF\u03C5 jar\:
+SWUpdateMsg9=\u0397 \u03BB\u03AE\u03C8\u03B7 \u03BD\u03AD\u03C9\u03BD \u03B1\u03C1\u03C7\u03B5\u03AF\u03C9\u03BD \u03B1\u03C0\u03CC \u03C4\u03BF \u03B4\u03B9\u03B1\u03BA\u03BF\u03BC\u03B9\u03C3\u03C4\u03AE \u03B1\u03C0\u03AD\u03C4\u03C5\u03C7\u03B5
+SaveAndLoopback=\u0391\u03BD\u03B1\u03BA\u03CD\u03BA\u03BB\u03C9\u03C3\u03B7 \u03BA\u03B1\u03B9 \u03B1\u03C0\u03BF\u03B8\u03AE\u03BA\u03B5\u03C5\u03C3\u03B7
+ScOutlookErrorCache=\u0397 \u03C3\u03C5\u03BD\u03B4\u03B5\u03CC\u03BC\u03B5\u03BD\u03B7 \u03C5\u03C0\u03BF\u03BC\u03BF\u03BD\u03AC\u03B4\u03B1 \u03B4\u03B5\u03BD \u03BC\u03C0\u03CC\u03C1\u03B5\u03C3\u03B5 \u03BD\u03B1 \u03B1\u03C0\u03BF\u03B8\u03B7\u03BA\u03B5\u03CD\u03C3\u03B5\u03B9 \u03B1\u03BD\u03C4\u03B9\u03BA\u03B5\u03AF\u03BC\u03B5\u03BD\u03B1 Outlook. \n\u039F \u03C3\u03C5\u03B3\u03C7\u03C1\u03BF\u03BD\u03B9\u03C3\u03BC\u03CC\u03C2 \u03CC\u03BB\u03C9\u03BD \u03C4\u03C9\u03BD '{0}' \u03C0\u03B1\u03C1\u03B1\u03BA\u03AC\u03BC\u03C6\u03B8\u03B7\u03BA\u03B5. \n\u03A0\u03B1\u03C1\u03B1\u03BA\u03B1\u03BB\u03BF\u03CD\u03BC\u03B5 \u03B5\u03BB\u03AD\u03B3\u03BE\u03C4\u03B5 \u03C4\u03B7\u03BD \u03B4\u03B9\u03B1\u03BC\u03CC\u03C1\u03C6\u03C9\u03C3\u03B7 \u03C4\u03BF\u03C5 Outlook
+ScOutlookErrorGeneral=\u0397 \u03C3\u03C5\u03BD\u03B4\u03B5\u03CC\u03BC\u03B5\u03BD\u03B7 \u03C5\u03C0\u03BF\u03BC\u03BF\u03BD\u03AC\u03B4\u03B1 \u03B4\u03B5\u03BD \u03BC\u03C0\u03CC\u03C1\u03B5\u03C3\u03B5 \u03BD\u03B1 \u03B1\u03C1\u03C7\u03B9\u03BA\u03BF\u03C0\u03BF\u03B9\u03AE\u03C3\u03B5\u03B9 \u03C4\u03BF Outlook. \n\u03A0\u03B1\u03C1\u03B1\u03BA\u03B1\u03BB\u03BF\u03CD\u03BC\u03B5 \u03B5\u03BB\u03AD\u03B3\u03BE\u03C4\u03B5 \u03C4\u03B7 \u03B4\u03B9\u03B1\u03BC\u03CC\u03C1\u03C6\u03C9\u03C3\u03B7 \u03C4\u03BF\u03C5 Outlook. \u0391\u03BD \u03C4\u03BF \n\u03C0\u03C1\u03CC\u03B2\u03BB\u03B7\u03BC\u03B1 \u03B5\u03BE\u03B1\u03BA\u03BF\u03BB\u03BF\u03C5\u03B8\u03B5\u03AF, \u03B5\u03C0\u03B9\u03BA\u03BF\u03BD\u03C9\u03BD\u03AE\u03C3\u03C4\u03B5 \u03B3\u03B9\u03B1 \u03B2\u03BF\u03AE\u03B8\u03B5\u03B9\u03B1 \u03BC\u03B5 \u03C4\u03B7 BSI.
+ScOutlookErrorPartial=\u0397 \u03C3\u03C5\u03BD\u03B4\u03B5\u03CC\u03BC\u03B5\u03BD\u03B7 \u03C5\u03C0\u03BF\u03BC\u03BF\u03BD\u03AC\u03B4\u03B1 \u03B5\u03BC\u03C6\u03AC\u03BD\u03B9\u03C3\u03B5 \u03C0\u03C1\u03CC\u03B2\u03BB\u03B7\u03BC\u03B1 \u03C3\u03C5\u03B3\u03C7\u03C1\u03BF\u03BD\u03B9\u03C3\u03BC\u03BF\u03CD \u03BA\u03AC\u03C0\u03BF\u03B9\u03C9\u03BD \u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03C9\u03BD. \n\u03A4\u03B1 \u03B1\u03BA\u03CC\u03BB\u03BF\u03C5\u03B8\u03B1 \u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1 \u03C0\u03B1\u03C1\u03B1\u03BA\u03AC\u03BC\u03B8\u03C6\u03B7\u03BA\u03B1\u03BD\:\n{0}
+ScOutlookErrorTooMany=\u03A0\u03AC\u03C1\u03B1 \u03C0\u03BF\u03BB\u03BB\u03AC \u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1 \u03B3\u03B9\u03B1 \u03C0\u03C1\u03BF\u03B2\u03BF\u03BB\u03AE.
+ScOutlookErrorUnknown=\u0397 \u03C3\u03C5\u03BD\u03B4\u03B5\u03CC\u03BC\u03B5\u03BD\u03B7 \u03C5\u03C0\u03BF\u03BC\u03BF\u03BD\u03AC\u03B4\u03B1 \u03C0\u03C1\u03BF\u03BA\u03AC\u03BB\u03B5\u03C3\u03B5 \u03AC\u03B3\u03BD\u03C9\u03C3\u03C4\u03BF \u03C3\u03C6\u03AC\u03BB\u03BC\u03B1. \n\u0393\u03B9\u03B1 \u03C0\u03B5\u03C1\u03B9\u03C3\u03C3\u03CC\u03C4\u03B5\u03C1\u03B5\u03C2 \u03C0\u03BB\u03B7\u03C1\u03BF\u03C6\u03BF\u03C1\u03AF\u03B5\u03C2 \u03C0\u03B1\u03C1\u03B1\u03BA\u03B1\u03BB\u03BF\u03CD\u03BC\u03B5 \u03B4\u03B5\u03AF\u03C4\u03B5 \u03C4\u03BF \u03B7\u03BC\u03B5\u03C1\u03BF\u03BB\u03CC\u03B3\u03B9\u03BF \u03C3\u03C6\u03AC\u03BB\u03BC\u03B1\u03C4\u03BF\u03C2
+ScOutlookTitle=ScOutlook Plugin
+Scout=EclipseScout
+SearchButtonPanelTooltip=\u0395\u03BA\u03BA\u03AF\u03BD\u03B7\u03C3\u03B7 \u03B1\u03BD\u03B1\u03B6\u03AE\u03C4\u03B7\u03C3\u03B7\u03C2
+Servidor_All=\u038C\u03BB\u03B1
+SmartFieldInvalidKey=
+StartupPhaseConfig=\u03A6\u03CC\u03C1\u03C4\u03C9\u03C3\u03B7 \u03B5\u03C6\u03B1\u03C1\u03BC\u03BF\u03B3\u03AE\u03C2...
+StartupPhaseOffline=\u03A0\u03C1\u03BF\u03B5\u03C4\u03BF\u03B9\u03BC\u03B1\u03C3\u03AF\u03B1 \u03C0\u03B5\u03C1\u03B9\u03B2\u03AC\u03BB\u03BB\u03BF\u03BD\u03C4\u03BF\u03C2
+StartupPhaseUpdate=\u0388\u03BB\u03B5\u03B3\u03C7\u03BF\u03C2 \u03B3\u03B9\u03B1 \u03B5\u03BD\u03B7\u03BC\u03B5\u03C1\u03CE\u03C3\u03B5\u03B9\u03C2...
+TableVerificationCoefficient=\u03A3\u03C5\u03BD\u03C4\u03B5\u03BB\u03B5\u03C3\u03C4\u03AE\u03C2 \u03C3\u03C5\u03C3\u03C7\u03AD\u03C4\u03B9\u03C3\u03B7\u03C2
+TableVerificationSuccessful=\u039F \u03AD\u03BB\u03B5\u03B3\u03C7\u03BF\u03C2 \u03C3\u03C5\u03C3\u03C7\u03AD\u03C4\u03B9\u03C3\u03B7\u03C2 \u03B2\u03AC\u03C3\u03B7\u03C2 \u03B4\u03B5\u03B4\u03BF\u03BC\u03AD\u03BD\u03C9\u03BD \u03BF\u03BB\u03BF\u03BA\u03BB\u03B7\u03C1\u03CE\u03B8\u03B7\u03BA\u03B5
+Using=\u03A7\u03C1\u03B7\u03C3\u03B9\u03BC\u03BF\u03C0\u03BF\u03B9\u03B5\u03AF
+VerifyOfflineEnvironment=\u0395\u03C0\u03B1\u03BB\u03AE\u03B8\u03B5\u03C5\u03C3\u03B7/\u03AD\u03BB\u03B5\u03B3\u03C7\u03BF\u03C2
+WorkOffline=\u03B5\u03C1\u03B3\u03B1\u03C3\u03AF\u03B1 \u03C7\u03C9\u03C1\u03AF\u03C2 \u03C3\u03CD\u03BD\u03B4\u03B5\u03C3\u03B7
+WorkOfflineInfoText=\u0393\u03B9\u03B1 \u03BD\u03B1 \u03B5\u03BD\u03B5\u03C1\u03B3\u03BF\u03C0\u03BF\u03B9\u03AE\u03C3\u03B5\u03C4\u03B5 \u03C4\u03B7\u03BD \u03B5\u03C1\u03B3\u03B1\u03C3\u03AF\u03B1 \u03C7\u03C9\u03C1\u03AF\u03C2 \u03C3\u03CD\u03BD\u03B4\u03B5\u03C3\u03B7, \u03C0\u03B1\u03C1\u03B1\u03BA\u03B1\u03BB\u03BF\u03CD\u03BC\u03B5 \u03B5\u03B9\u03C3\u03AC\u03B3\u03B5\u03C4\u03B5 \u03C3\u03C4\u03BF \u03C0\u03B5\u03B4\u03AF\u03BF "\u0394\u03B9\u03B1\u03BA\u03BF\u03BC\u03B9\u03C3\u03C4\u03AE\u03C2" \u03C4\u03BF URL \u03C4\u03BF\u03C5 \u03B4\u03B9\u03B1\u03BA\u03BF\u03BC\u03B9\u03C3\u03C4\u03AE \u03B5\u03C6\u03B1\u03C1\u03BC\u03BF\u03B3\u03AE\u03C2. \u0395\u03AF\u03BD\u03B1\u03B9 \u03C3\u03C5\u03BD\u03AE\u03B8\u03C9\u03C2 \u03C4\u03BF \u03AF\u03B4\u03B9\u03BF URL \u03C0\u03BF\u03C5 \u03C7\u03C1\u03B7\u03C3\u03B9\u03BC\u03BF\u03C0\u03BF\u03B9\u03B5\u03AF\u03C4\u03B5 \u03B3\u03B9\u03B1 \u03BD\u03B1 \u03B5\u03C1\u03B3\u03B1\u03C3\u03C4\u03B5\u03AF\u03C4\u03B5 \u03BC\u03B5 \u03C3\u03CD\u03BD\u03B4\u03B5\u03C3\u03B7.
diff --git a/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_es.properties b/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_es.properties
index 07fe13c56d..a9bd5e8778 100644
--- a/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_es.properties
+++ b/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_es.properties
@@ -1,160 +1,160 @@
-AccessAuthorization=Autorizaci\u00F3n del servidor
-Application=Aplicaci\u00F3n
-ApplicationServer=Servidor de aplicaci\u00F3n
-AutomaticallyStopAfterFirstFetch=Realizar solamente la primera b\u00FAsqueda y carga de instrucciones
-BrowseMenu=Buscar...
-Calendar_itemCont=(tag)
-Calendar_itemFrom=Desde
-Calendar_itemUntil=hasta
-CheckFailed=Error
-CheckFailedMessage=El control de datos ha fallado.
-Containing=contenido
-CopyPasteHint=(Para informaci\u00F3n detallada, "Copiar" y "Pegar" en documento de texto.)
-CouldNotCreateOfflineDirectory=No consigue crear un directorio local.
-CouldNotFindOfflineClasses=Entorno fuera de l\u00EDnea no encontrado
-CouldNotFindOfflineConfig=Configuraci\u00F3n fuera de l\u00EDnea no encontrado
-CouldNotFindOfflineDatabase=Base de datos local no encontrada
-CouldNotGetApplication=No puede cargar la aplicaci\u00F3n.
-CouldNotGetApplicationInfo=No puede cargar informaci\u00F3n de la aplicaci\u00F3n.
-CreateTriggers=Crear disparadores
-CurrentLocale=Lenguaje actual
-CustomRollback=La acci\u00F3n ha sido cancelada.
-DataLoading=Carga de datos
-DateErrorText=La fecha '{0}' no es v\u00E1lida. Por favor corregir el valor.
-DateErrorTitle=Fecha no v\u00E1lida.
-DisplayedTimerange=Rango tiempos desplegado
-DoubleWeek=Semana doble
-DownloadOfflineDatabase=\u00BFQuiere descargar la base de datos?
-EditMenu=Editar...
-ElapsedTime=Transcurrido
-EnableHtmlEditing=Activar el modo HTML
-EndStatus=Estado final
-EnterUrlTooltip=Poner URL o Pegar despu\u00E9s de Copiar/Pegar
-ErrorAndRetryQuestion=\u00BFQuiere intentarlo de nuevo?
-ErrorAndWarning=Error / Atenci\u00F3n
-ErrorAndWarningAndMessage=Error / Atenci\u00F3n / Mensaje
-ErrorCommandFailedQuestion=\u00BFQuiere ignorar este error y continuar?
-ErrorCommandFailedText=Operaci\u00F3n cancelada
-ErrorOnly=Error
-ErrorReadingOfflineTable=Error al leer la tabla fuera de l\u00EDnea
-ErrorReadingOnlineTable=Error al leer la tabla del servidor
-EstimatedEndDate=Terminado
-EstimatedTime=Duraci\u00F3n estimada
-ExtendedSearchEntityPrefix=tiene
-ExtendedSearchEntityPrefixNegated=no tiene
-ExtendedSearchSaveButton=A\u00F1adir
-FailedDownloadingFile=No puede descargar el archivo
-FailedGettingOfflineTableVerification=Fall\u00F3 la tabla de verificaci\u00F3n fuera de l\u00EDnea
-FailedGettingOnlineTableVerification=Fall\u00F3 la tabla de verificaci\u00F3n del servidor
-Field=Campo
-FieldRangeErrorText=El valor 'desde' debe ser mayor que el valor 'hasta'.
-FieldRangeErrorTitle=Error en el rango de datos
-Fields=Campos
-FilePath=Ruta del archivo
-FormInvalidTextInFields=Los siguientes campos contienen valores no v\u00E1lidos.
-FormMissingMandatoryFields=Los siguientes campos son obligatorios.
-GenericSearch=B\u00FAsqueda extendida
-GetUrlForm=Direcci\u00F3n web
-HtmlPluginActionSubmitted=Acci\u00F3n ejecutada
-HtmlPluginChangesSaved=Las modificaciones han sido registradas
-HtmlPluginPendingAction=En esta aplicaci\u00F3n ya existe una ventana pop-up abierta. Por favor, cerrarla primero.
-HtmlPopupInfoPanel=Una ventana pop-up ha sido abierta en la aplicaci\u00F3n.
-IgnoreCase=Ignorar may\u00FAscula/min\u00FAscula
-Informations=Informaciones
-InvolvedPersons=Personas involucradas
-LiveEdit=Editar en vivo
-LocalServer=Servidor local.
-Logging=Registrado
-LoginFailed=Acceso fallido
-LoginToApplicationServer=Acceso
-LotusNotesCode=Lotus Notes
-MissingOfflineTable=Falta la tabla fuera de l\u00EDnea
-MissingOnlineTable=Falta la tabla del servidor
-NetworkProxy=Red/Proxy
-NewMenu=Nuevo...
-NewSearch=Nueva b\u00FAsqueda
-NoAuthenticationFound=La informaci\u00F3n de la autentificaci\u00F3n no es v\u00E1lida\u00BF
-NoRowsFound=Ning\u00FAn registro
-NoViewAvailable=Vista no disponible
-Offline=Fuera de l\u00EDnea
-OfflineAdmin=Administrador fuera de l\u00EDnea
-OfflineDirectory=Directorio Local
-OfflineInstallationInvalidMessage=Esta instalaci\u00F3n fuera de l\u00EDnea est\u00E1 incompleta
-OfflineInstallationValidMessage=La instalaci\u00F3n fuera de l\u00EDnea est\u00E1 lista y completa
-OfflineMasterServer=Servidor en l\u00EDnea
-OfflineReplicationInvalidMessage=La replicaci\u00F3n no puede realizarse
-OfflineSetup=Configurar entorno fuera de l\u00EDnea
-Operator=Operador
-Operators=Operadores
-Options=Opciones
-OutputLevel=Nivel de salida
-PasswordChanged=T\u00FA password ha cambiado
-PasswordNotChanged=T\u00FA password no puede cambiarse
-PasswordNotReset=La password no puede cambiarse
-PasswordReset=La password se ha cambiado
-PasswordWrong=Password incorrecta
-PleaseCheckLogfile=Por favor comprobar el archivo de registro
-PleaseCheckOfflineDirectory=Por favor comprobar el directorio fuera de l\u00EDnea
-Port=Puerto
-Programmed=GQ
-RepDone=Ok
-RepEndDate=Terminado
-RepGetServerUpdate=Recibiendo datos del servidor...
-RepNextExtract=Preparando datos...
-RepProgCommit=Confirmaci\u00F3n
-RepProgExtract=Extraer
-RepProgSync=Intercambio de datos
-RepProgUpdate=Actualizar
-RepStartDate=Iniciando
-Replicate=Replicar
-ReplicationStatus=Estado de la replicaci\u00F3n
-ReportLayoutTitle=Tipo de informe
-ReportNoDataFound=No hay datos que correspondan a esas condiciones de b\u00FAsqueda.
-ResetPasswordUserHasNoLoginName=La persona seleccionada no tiene un nombre v\u00E1lido de acceso.
-ResultOfTableVerification=Resultado de la comprobaci\u00F3n de la base de datos
-Row=Registro
-RowCountDifferenceOnTable=Diferente n\u00FAmero de columna
-Rows=Registros
-SWUpdateMsg10=Error creando copia de seguridad e instalaci\u00F3n de\:
-SWUpdateMsg1=Est\u00E1 disponible una actualizaci\u00F3n de software.\nSu versi\u00F3n instalada es\: \#OLD\#\nLa nueva versi\u00F3n es\: \#NEW\#
-SWUpdateMsg2=\u00BFQuiere actualizar el software?
-SWUpdateMsg3a=La actualizaci\u00F3n del software se ha descargado con \u00E9xito.\nPara ejecutar la actualizaci\u00F3n, se debe reiniciar a aplicaci\u00F3n.
-SWUpdateMsg4=Conexi\u00F3n al servidor de actualizaci\u00F3n no disponible.
-SWUpdateMsg5=Error al solicitar la versi\u00F3n del servidor
-SWUpdateMsg6=Instalaci\u00F3n est\u00E1 actualizada.
-SWUpdateMsg7=Actualizaci\u00F3n del software cancelada
-SWUpdateMsg8=Directorio de los archivos de instalaci\u00F3n no encontrado\:
-SWUpdateMsg9=Descarga de los nuevos archivos de instalaci\u00F3n no concluida
-SaveAndLoopback=Hacer bucle de prueba y registrar
-ScOutlookErrorCache=El plugin no ha podido crear una memoria cach\u00E9.\nLa sincronizaci\u00F3n de todos los '{0}' no ha sido realizada.\nPor favor, examinar la configuraci\u00F3n del Outlook.
-ScOutlookErrorGeneral=El plugin no puede inicializar Outlook .\nPor favor, examinar la configuraci\u00F3n del Outlook.\nEn el caso de que no pueda resolver el problema, entrar en contacto\n con BSI.
-ScOutlookErrorPartial=El plugin no ha podido sincronizar todos los registros de datos.\nLos registros de datos siguientes no han sido procesados\:\n{0}
-ScOutlookErrorTooMany=No puede mostrar tantas entradas.
-ScOutlookErrorUnknown=El plugin ha causado un error desconocido.\nPor favor, consultar el archivo de registro y de informes de problemas para obtener m\u00E1s informaciones.
-ScOutlookTitle=ScOutlook Plugin
-Scout=EclipseScout
-ScoutHome=Datos personales
-SearchButtonPanelTooltip=Iniciar b\u00FAsqueda
-SearchMenu=Buscar...
-SearchPartial=B\u00FAsqueda parcial
-SecurityNotAllowed=La transacci\u00F3n ha sido denegada por el servidor.
-Servidor_All=Todo
-ShowFileErrorText=El archivo {0} no puede ser abierto.
-ShowFileErrorTitle=Mostrar archivo
-SmartFieldInvalidKey=
-SmartFieldTooManyRows=Muchos datos. Por favor limite sus criterios de b\u00FAsqueda.
-StartupPhaseConfig=Cargando aplicaci\u00F3n...
-StartupPhaseOffline=Preparando entorno
-StartupPhaseUpdate=Buscando actualizaci\u00F3n del software...
-StoreColumnWidths=Guardar ancho de columna
-TableVerificationCoefficient=Coeficiente de correlaci\u00F3n
-TableVerificationSuccessful=Completada la comprobaci\u00F3n de la base de datos
-TransferProgressLabel=Recibiendo...
-TransferProgressTitle=Transferencia de datos
-Using=Utilizando
-Verify=Verificar
-VerifyOfflineEnvironment=Verificar /instalar
-ViewListLabel=Elegir una vista
-ViewListTitle=Todas las vistas
-WorkOffline=Trabajo fuera de l\u00EDnea
-WorkOfflineInfoText=Para permitir el funcionamiento fuera de l\u00EDnea, incorpore por favor en el campo "servidor" la direcci\u00F3n del servidor en uso. \u00C9sta es normalmente la misma URL que cuando usted se conecta para trabajar en l\u00EDnea.
+AccessAuthorization=Autorizaci\u00F3n del servidor
+Application=Aplicaci\u00F3n
+ApplicationServer=Servidor de aplicaci\u00F3n
+AutomaticallyStopAfterFirstFetch=Realizar solamente la primera b\u00FAsqueda y carga de instrucciones
+BrowseMenu=Buscar...
+Calendar_itemCont=(tag)
+Calendar_itemFrom=Desde
+Calendar_itemUntil=hasta
+CheckFailed=Error
+CheckFailedMessage=El control de datos ha fallado.
+Containing=contenido
+CopyPasteHint=(Para informaci\u00F3n detallada, "Copiar" y "Pegar" en documento de texto.)
+CouldNotCreateOfflineDirectory=No consigue crear un directorio local.
+CouldNotFindOfflineClasses=Entorno fuera de l\u00EDnea no encontrado
+CouldNotFindOfflineConfig=Configuraci\u00F3n fuera de l\u00EDnea no encontrado
+CouldNotFindOfflineDatabase=Base de datos local no encontrada
+CouldNotGetApplication=No puede cargar la aplicaci\u00F3n.
+CouldNotGetApplicationInfo=No puede cargar informaci\u00F3n de la aplicaci\u00F3n.
+CreateTriggers=Crear disparadores
+CurrentLocale=Lenguaje actual
+CustomRollback=La acci\u00F3n ha sido cancelada.
+DataLoading=Carga de datos
+DateErrorText=La fecha '{0}' no es v\u00E1lida. Por favor corregir el valor.
+DateErrorTitle=Fecha no v\u00E1lida.
+DisplayedTimerange=Rango tiempos desplegado
+DoubleWeek=Semana doble
+DownloadOfflineDatabase=\u00BFQuiere descargar la base de datos?
+EditMenu=Editar...
+ElapsedTime=Transcurrido
+EnableHtmlEditing=Activar el modo HTML
+EndStatus=Estado final
+EnterUrlTooltip=Poner URL o Pegar despu\u00E9s de Copiar/Pegar
+ErrorAndRetryQuestion=\u00BFQuiere intentarlo de nuevo?
+ErrorAndWarning=Error / Atenci\u00F3n
+ErrorAndWarningAndMessage=Error / Atenci\u00F3n / Mensaje
+ErrorCommandFailedQuestion=\u00BFQuiere ignorar este error y continuar?
+ErrorCommandFailedText=Operaci\u00F3n cancelada
+ErrorOnly=Error
+ErrorReadingOfflineTable=Error al leer la tabla fuera de l\u00EDnea
+ErrorReadingOnlineTable=Error al leer la tabla del servidor
+EstimatedEndDate=Terminado
+EstimatedTime=Duraci\u00F3n estimada
+ExtendedSearchEntityPrefix=tiene
+ExtendedSearchEntityPrefixNegated=no tiene
+ExtendedSearchSaveButton=A\u00F1adir
+FailedDownloadingFile=No puede descargar el archivo
+FailedGettingOfflineTableVerification=Fall\u00F3 la tabla de verificaci\u00F3n fuera de l\u00EDnea
+FailedGettingOnlineTableVerification=Fall\u00F3 la tabla de verificaci\u00F3n del servidor
+Field=Campo
+FieldRangeErrorText=El valor 'desde' debe ser mayor que el valor 'hasta'.
+FieldRangeErrorTitle=Error en el rango de datos
+Fields=Campos
+FilePath=Ruta del archivo
+FormInvalidTextInFields=Los siguientes campos contienen valores no v\u00E1lidos.
+FormMissingMandatoryFields=Los siguientes campos son obligatorios.
+GenericSearch=B\u00FAsqueda extendida
+GetUrlForm=Direcci\u00F3n web
+HtmlPluginActionSubmitted=Acci\u00F3n ejecutada
+HtmlPluginChangesSaved=Las modificaciones han sido registradas
+HtmlPluginPendingAction=En esta aplicaci\u00F3n ya existe una ventana pop-up abierta. Por favor, cerrarla primero.
+HtmlPopupInfoPanel=Una ventana pop-up ha sido abierta en la aplicaci\u00F3n.
+IgnoreCase=Ignorar may\u00FAscula/min\u00FAscula
+Informations=Informaciones
+InvolvedPersons=Personas involucradas
+LiveEdit=Editar en vivo
+LocalServer=Servidor local.
+Logging=Registrado
+LoginFailed=Acceso fallido
+LoginToApplicationServer=Acceso
+LotusNotesCode=Lotus Notes
+MissingOfflineTable=Falta la tabla fuera de l\u00EDnea
+MissingOnlineTable=Falta la tabla del servidor
+NetworkProxy=Red/Proxy
+NewMenu=Nuevo...
+NewSearch=Nueva b\u00FAsqueda
+NoAuthenticationFound=La informaci\u00F3n de la autentificaci\u00F3n no es v\u00E1lida\u00BF
+NoRowsFound=Ning\u00FAn registro
+NoViewAvailable=Vista no disponible
+Offline=Fuera de l\u00EDnea
+OfflineAdmin=Administrador fuera de l\u00EDnea
+OfflineDirectory=Directorio Local
+OfflineInstallationInvalidMessage=Esta instalaci\u00F3n fuera de l\u00EDnea est\u00E1 incompleta
+OfflineInstallationValidMessage=La instalaci\u00F3n fuera de l\u00EDnea est\u00E1 lista y completa
+OfflineMasterServer=Servidor en l\u00EDnea
+OfflineReplicationInvalidMessage=La replicaci\u00F3n no puede realizarse
+OfflineSetup=Configurar entorno fuera de l\u00EDnea
+Operator=Operador
+Operators=Operadores
+Options=Opciones
+OutputLevel=Nivel de salida
+PasswordChanged=T\u00FA password ha cambiado
+PasswordNotChanged=T\u00FA password no puede cambiarse
+PasswordNotReset=La password no puede cambiarse
+PasswordReset=La password se ha cambiado
+PasswordWrong=Password incorrecta
+PleaseCheckLogfile=Por favor comprobar el archivo de registro
+PleaseCheckOfflineDirectory=Por favor comprobar el directorio fuera de l\u00EDnea
+Port=Puerto
+Programmed=GQ
+RepDone=Ok
+RepEndDate=Terminado
+RepGetServerUpdate=Recibiendo datos del servidor...
+RepNextExtract=Preparando datos...
+RepProgCommit=Confirmaci\u00F3n
+RepProgExtract=Extraer
+RepProgSync=Intercambio de datos
+RepProgUpdate=Actualizar
+RepStartDate=Iniciando
+Replicate=Replicar
+ReplicationStatus=Estado de la replicaci\u00F3n
+ReportLayoutTitle=Tipo de informe
+ReportNoDataFound=No hay datos que correspondan a esas condiciones de b\u00FAsqueda.
+ResetPasswordUserHasNoLoginName=La persona seleccionada no tiene un nombre v\u00E1lido de acceso.
+ResultOfTableVerification=Resultado de la comprobaci\u00F3n de la base de datos
+Row=Registro
+RowCountDifferenceOnTable=Diferente n\u00FAmero de columna
+Rows=Registros
+SWUpdateMsg10=Error creando copia de seguridad e instalaci\u00F3n de\:
+SWUpdateMsg1=Est\u00E1 disponible una actualizaci\u00F3n de software.\nSu versi\u00F3n instalada es\: \#OLD\#\nLa nueva versi\u00F3n es\: \#NEW\#
+SWUpdateMsg2=\u00BFQuiere actualizar el software?
+SWUpdateMsg3a=La actualizaci\u00F3n del software se ha descargado con \u00E9xito.\nPara ejecutar la actualizaci\u00F3n, se debe reiniciar a aplicaci\u00F3n.
+SWUpdateMsg4=Conexi\u00F3n al servidor de actualizaci\u00F3n no disponible.
+SWUpdateMsg5=Error al solicitar la versi\u00F3n del servidor
+SWUpdateMsg6=Instalaci\u00F3n est\u00E1 actualizada.
+SWUpdateMsg7=Actualizaci\u00F3n del software cancelada
+SWUpdateMsg8=Directorio de los archivos de instalaci\u00F3n no encontrado\:
+SWUpdateMsg9=Descarga de los nuevos archivos de instalaci\u00F3n no concluida
+SaveAndLoopback=Hacer bucle de prueba y registrar
+ScOutlookErrorCache=El plugin no ha podido crear una memoria cach\u00E9.\nLa sincronizaci\u00F3n de todos los '{0}' no ha sido realizada.\nPor favor, examinar la configuraci\u00F3n del Outlook.
+ScOutlookErrorGeneral=El plugin no puede inicializar Outlook .\nPor favor, examinar la configuraci\u00F3n del Outlook.\nEn el caso de que no pueda resolver el problema, entrar en contacto\n con BSI.
+ScOutlookErrorPartial=El plugin no ha podido sincronizar todos los registros de datos.\nLos registros de datos siguientes no han sido procesados\:\n{0}
+ScOutlookErrorTooMany=No puede mostrar tantas entradas.
+ScOutlookErrorUnknown=El plugin ha causado un error desconocido.\nPor favor, consultar el archivo de registro y de informes de problemas para obtener m\u00E1s informaciones.
+ScOutlookTitle=ScOutlook Plugin
+Scout=EclipseScout
+ScoutHome=Datos personales
+SearchButtonPanelTooltip=Iniciar b\u00FAsqueda
+SearchMenu=Buscar...
+SearchPartial=B\u00FAsqueda parcial
+SecurityNotAllowed=La transacci\u00F3n ha sido denegada por el servidor.
+Servidor_All=Todo
+ShowFileErrorText=El archivo {0} no puede ser abierto.
+ShowFileErrorTitle=Mostrar archivo
+SmartFieldInvalidKey=
+SmartFieldTooManyRows=Muchos datos. Por favor limite sus criterios de b\u00FAsqueda.
+StartupPhaseConfig=Cargando aplicaci\u00F3n...
+StartupPhaseOffline=Preparando entorno
+StartupPhaseUpdate=Buscando actualizaci\u00F3n del software...
+StoreColumnWidths=Guardar ancho de columna
+TableVerificationCoefficient=Coeficiente de correlaci\u00F3n
+TableVerificationSuccessful=Completada la comprobaci\u00F3n de la base de datos
+TransferProgressLabel=Recibiendo...
+TransferProgressTitle=Transferencia de datos
+Using=Utilizando
+Verify=Verificar
+VerifyOfflineEnvironment=Verificar /instalar
+ViewListLabel=Elegir una vista
+ViewListTitle=Todas las vistas
+WorkOffline=Trabajo fuera de l\u00EDnea
+WorkOfflineInfoText=Para permitir el funcionamiento fuera de l\u00EDnea, incorpore por favor en el campo "servidor" la direcci\u00F3n del servidor en uso. \u00C9sta es normalmente la misma URL que cuando usted se conecta para trabajar en l\u00EDnea.
diff --git a/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_fi.properties b/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_fi.properties
index 0fb2ef6ff3..6372ec877a 100644
--- a/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_fi.properties
+++ b/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_fi.properties
@@ -1,8 +1,8 @@
-Calendar_itemCont=(t\u00E4gi)
-Calendar_itemFrom=Alkaen
-Calendar_itemUntil=asti
-CopyPasteHint=Yksityiskohtaisen tiedon saamiseksi paina kopio-painiketta ja liit\u00E4 tekstik\u00E4sittelyohjelmassa.
-DisplayedTimerange=Esitetty aikaj\u00E4nne
-DoubleWeek=Kaksoisviikko
-InvolvedPersons=Mukana olevat henkil\u00F6t
-LotusNotesCode=Lotus Notes
+Calendar_itemCont=(t\u00E4gi)
+Calendar_itemFrom=Alkaen
+Calendar_itemUntil=asti
+CopyPasteHint=Yksityiskohtaisen tiedon saamiseksi paina kopio-painiketta ja liit\u00E4 tekstik\u00E4sittelyohjelmassa.
+DisplayedTimerange=Esitetty aikaj\u00E4nne
+DoubleWeek=Kaksoisviikko
+InvolvedPersons=Mukana olevat henkil\u00F6t
+LotusNotesCode=Lotus Notes
diff --git a/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_fr.properties b/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_fr.properties
index 183f106d14..08585d5684 100644
--- a/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_fr.properties
+++ b/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_fr.properties
@@ -1,292 +1,292 @@
-AccessAuthorization=Autorisation du serveur
-Application=Logiciel
-ApplicationServer=Serveur d'application
-AppointmentProposition=Proposition de date
-AutomaticallyStopAfterFirstFetch=Ex\u00E9cuter uniquement le premier logiciel de t\u00E9l\u00E9chargement
-BackendCall=Appel du service
-BrowseMenu=Chercher...
-CTIDialErrorInfo=Veuillez contr\u00F4ler le numero de t\u00E9l\u00E9phone et la connexion.
-CTIDialErrorText=Serveur de t\u00E9l\u00E9phone inaccessible
-CTIDialErrorTitle=T\u00E9l\u00E9phone
-Calendar_itemCont=(tag)
-Calendar_itemFrom=De
-Calendar_itemUntil=\u00E0
-CheckFailed=Erreur des donn\u00E9es
-CheckFailedMessage=La v\u00E9rification des donn\u00E9es n'est pas r\u00E9ussie.
-Choose=S\u00E9lectionner
-ComposerAggregationCount=Quantit\u00E9
-ComposerFieldAddAttribute=Ajouter un attribut
-ComposerFieldAggregationNone=N/A
-Containing=contenant
-ContinueMenu=Continuer
-CopyPasteHint=Pour plus d'informations, pressez 'Copier' et collez le contenu dans un \u00E9diteur de texte.
-CouldNotCreateOfflineDirectory=Impossible de cr\u00E9er un r\u00E9pertoire local
-CouldNotFindOfflineClasses=Environnement hors-ligne introuvable
-CouldNotFindOfflineConfig=Configuration hors-ligne introuvable
-CouldNotFindOfflineDatabase=Aucune base de donn\u00E9es disponible
-CouldNotGetApplication=Impossible de charger le logiciel.
-CouldNotGetApplicationInfo=Impossible de charger la description du logiciel.
-CreateTriggers=Cr\u00E9er le trigger
-CurrentLocale=Secteur de langue actuel
-CurrentStep=\u00C9tape actuelle
-CustomRollback=L'action a \u00E9t\u00E9 annul\u00E9e
-DataLoading=Transfer de donn\u00E9es
-DateErrorText=La date entr\u00E9e {0} n'est pas valide. Corriger le valeur s.v.p.
-DateErrorTitle=Date non valable
-DismissMenu=Rejeter\u2026
-DisplayedTimerange=Secteur de date visualis\u00E9
-DoubleWeek=Semaine double
-DownloadOfflineDatabase=Souhaitez-vous t\u00E9l\u00E9charger la base de donn\u00E9es ?
-DragMenu=Drag (Config Marker)
-DropMenu=Drop (Config Marker)
-EditMenu=Editer...
-ElapsedTime=\u00C9coul\u00E9
-EnableHtmlEditing=Activer le mode HTML
-EndStatus=\u00C9tat final
-EnterUrlTooltip=Entrer l'URL ou entrer apr\u00E8s on a copi\u00E9/coll\u00E9
-ErrorAndRetryQuestion=Voulez-vous informer votre administrateur des syst\u00E8mes.
-ErrorAndWarning=Erreur / Avertissement
-ErrorAndWarningAndMessage=Erreurs / Avertissements / Message
-ErrorCommandFailedQuestion=Voulez-vous ignorer le message et continuer?
-ErrorCommandFailedText=Op\u00E9ration interrompue.
-ErrorOnly=Erreur
-ErrorReadingOfflineTable=Erreur lors de la lecture de la table hors-ligne
-ErrorReadingOnlineTable=Erreur lors de la lecture de la table serveur
-ErrorTextLoginOutdated=Mot de passe p\u00E9rim\u00E9
-EstimatedEndDate=Termin\u00E9
-EstimatedTime=Dur\u00E9e estim\u00E9e
-ExcelChart_Button_Cancel=Interrompre
-ExcelChart_Button_CancelHint=Interrompt l\u2019export et cl\u00F4ture ce formulaire.
-ExcelChart_Button_OK=Exporter
-ExcelChart_Button_OKHint=D\u00E9marre l\u2019export.
-ExcelChart_Error_ActivatingWorksheetFailed=L\u2019activation de la feuille du tableau a \u00E9chou\u00E9.
-ExcelChart_Error_CreatingWorksheetFailed=la cr\u00E9ation de la feuille du tableau a \u00E9chou\u00E9.
-ExcelChart_Error_FillingChartFailed=le remplissage du diagramme a \u00E9chou\u00E9.
-ExcelChart_Error_OpeningChartFailed=l\u2019ouverture du diagramme a \u00E9chou\u00E9.
-ExcelChart_Error_OpeningWorksheetFailed=l\u2019ouverture de la feuille du tableau a \u00E9chou\u00E9.
-ExcelChart_Error_RetrivingVariableFailed=une variable n\u2019a pas pu \u00EAtre lue
-ExcelChart_Error_SavingWorkbookFailed=la sauvegarde du document Excel a \u00E9chou\u00E9.
-ExcelChart_Error_UnknownException=une erreur inattendue est survenue
-ExcelChart_Various_AveragedLong=Moyenne de toutes les valeurs qui rel\u00E8vent de la m\u00EAme valeur de l\u2019axe X
-ExcelChart_Various_FrequencyLong=Fr\u00E9quence (\u00E0 quelle fr\u00E9quence appara\u00EEt la valeur correspondant \u00E0 l\u2019axe X)
-ExcelChart_Various_SummedUpLong=Somme de toutes les valeurs qui rel\u00E8vent de la m\u00EAme valeur de l\u2019axe X
-ExtendedSearchEditEntityMenu=Modifier...
-ExtendedSearchEntityPrefix=a
-ExtendedSearchEntityPrefixNegated=n'a pas
-ExtendedSearchSaveButton=Ajouter
-FailedDownloadingFile=Impossible de t\u00E9l\u00E9charger le fichier
-FailedGettingOfflineTableVerification=Echec de la v\u00E9rification de la table hors-ligne
-FailedGettingOnlineTableVerification=Echec de la v\u00E9rification de la table serveur
-FieldRangeErrorText=Le valeur 'de' ne peut pas \u00EAtre plus grand du valeur '\u00E0'.
-FieldRangeErrorTitle=Erreur dans le secteur des valeurs
-Fields=Champs
-FilePath=Chemin du fichier
-FormInactivityTimerActivated=Activation du compteur de temps d\u2019inactivit\u00E9
-FormInvalidTextInFields=Les champs suivants ont des valeurs non valable\:
-FormMissingMandatoryFields=Les champs suivants doivent \u00EAtre rempli\:
-FormStateLoadTooltip=Ouvrir les crit\u00E8res de la recherche d'un fichier xml
-FormStateStoreTooltip=Enregistrer les crit\u00E8res de la recherche dans un fichier xml
-GenericSearch=Recherche sp\u00E9ciale
-GetUrlForm=Adresse Web
-HistoryAddColumnMove=d\u00E9place la colonne
-HistoryAddSort=trie par
-HistoryAddSortDesc=d\u00E9croissant
-HistoryBackward=R\u00E9tour
-HistoryForward=Avancer
-HtmlPluginActionSubmitted=Action ex\u00E9cut\u00E9e
-HtmlPluginChangesSaved=Modifications enregistr\u00E9es
-HtmlPluginPendingAction=Vous avez d\u00E9j\u00E0 une fen\u00EAtre popup ouverte dans l'application. Fermez-la en premier.
-HtmlPopupInfoPanel=Une fen\u00EAtre popup a \u00E9t\u00E9 ouverte dans l'application
-IgnoreCase=Ignorer grandement/miniscule
-Informations=Informations
-InvolvedPersons=Personnes impliqu\u00E9es
-LastStep=Derni\u00E8re \u00E9tape
-LiveEdit=Editer en live
-LocalServer=Serveur local
-Logging=Journalisation
-LogicDateIsInGEWeeks=est au plus t\u00F4t dans {0} semaines
-LogicDateIsInLEWeeks=est au plus tard dans {0} semaines
-LogicDateIsInWeeks=est exactement dans {0} semaines
-LogicIN=dans
-LoginErrorText=Nom d'utilisateur/mot de passe incorrect
-LoginErrorTitle=\u00C9chec d'authentification
-LoginFailed=\u00C9chec d'authentification
-LoginToApplicationServer=Authentification
-LotusNotesCode=Lotus Notes
-LotusNotesConnectErrorDetail=Contr\u00F4lez svp si Lotus Notes est install\u00E9 et si les autorisations existent.
-LotusNotesConnectErrorText=Lotus Notes non disponible.
-LotusNotesErrorDLLDetail=Le fichier nlsxbe.dll est install\u00E9 de fa\u00E7on standardis\u00E9e avec Lotus Notes et se trouve dans le r\u00E9pertoire d\u2019installation de Lotus Notes, p.ex. C\:\\Programmes\\lotus\\notes. Pour r\u00E9parer le probl\u00E8me, assurez-vous que le fichier soit correctement enregistr\u00E9 (enregistrement Windows).
-LotusNotesErrorDLLText=Le fichier nlsxbe.dll n\u2019a pas pu \u00EAtre trouv\u00E9.
-LotusNotesErrorDatabaseOpenDetail=Cette erreur survient lorsque Lotus Notes se trouve en mode en ligne (r\u00E9seau SIKA) bien qu'il n'y ait aucune connexion au serveur \u00E0 distance. Veuillez \u00E9tablir une connexion au serveur ou mettre Lotus Notes en mode autonome (Island mode). IMPORTANT \: cette erreur survient \u00E9galement si Lotus Notes a \u00E9t\u00E9 ferm\u00E9 en mode en ligne. Dans ce cas, il vous faut lancer Lotus Notes et passer en mode autonome.
-LotusNotesErrorDatabaseOpenText=La banque de donn\u00E9es n\u2019est pas disponible.
-LotusNotesErrorIDFileDetail=Cette erreur est habituellement caus\u00E9e par une bo\u00EEte ouverte de dialogue de login de Lotus Notes. Veuillez fermer le dialogue de login et r\u00E9essayer.
-LotusNotesErrorIDFileOpenDetail=En voici les causes possibles \: 1. Une bo\u00EEte ouverte de dialogue de login (dans ce cas, le fichier ID de l'utilisateur est bloqu\u00E9. Veuillez terminer le processus de loging). 2. Il manque le fichier nlsxbe.dll. Ce fichier se trouve habituellement dans le r\u00E9pertoire de base de Lotus Notes. Assurez-vous que le fichier existe et que le r\u00E9pertoire de base de Lotus Notes fasse partie des variables d'environnement 'Path'. 3. Un syst\u00E8me tr\u00E8s charg\u00E9. Fermez les programmes que vous n'utilisez pas et r\u00E9essayez. 4. Une installation corrompue ou incompl\u00E8te de Lotus Notes.
-LotusNotesErrorIDFileOpenText=Le fichier ID de l\u2019utilisateur n\u2019a pas pu \u00EAtre ouvert.
-LotusNotesErrorIDFileText=Le fichier ID de l\u2019utilisateur est bloqu\u00E9
-LotusNotesErrorMailFileDetail=Le fichier notes.ini se trouve durant l'exploitation de Lotus Notes dans le r\u00E9pertoire d'installation. Pour fonctionner, l'interface COM (BSI CRM - Lotus Notes) requiert que notes.ini comporte une entr\u00E9e "mailFile\=\#\#\#.nsf". \#\#\#.nsf repr\u00E9sente le fichier dans laquelle est sauvegard\u00E9e la banque de donn\u00E9es des messages hors ligne. Veuillez en informer votre administrateur de syst\u00E8me.
-LotusNotesErrorMailFileText=Il manque l\u2019enregistrement dans notes.ini
-LotusNotesErrorPasswordDetail=Veuillez svp r\u00E9p\u00E9ter le processus ou adressez \u2013vous \u00E0 l\u2019administrateur du syst\u00E8me. (Veuillez svp faire attention \u00E0 l\u2019\u00E9criture correcte du mot de passe en majuscules resp. minuscules)
-LotusNotesErrorPasswordText=Le mot de passe est faux
-LotusNotesErrorUnknownDetail=Si cette erreur devait continuer \u00E0 se produire, informez svp votre administrateur de syst\u00E8me.
-LotusNotesErrorUnknownText=Une erreur inconnue est survenue.
-LotusNotesErrorVersionCheckDetail=En voici les causes possibles \: 1. Une bo\u00EEte ouverte de dialogue de login (dans ce cas, le fichier ID de l'utilisateur est bloqu\u00E9. Veuillez terminer le processus de loging). 2. Il manque le fichier nlsxbe.dll. Ce fichier se trouve habituellement dans le r\u00E9pertoire de base de Lotus Notes. Assurez-vous que le fichier existe et que le r\u00E9pertoire de base de Lotus Notes fasse partie des variables d'environnement 'Path'. 3. Un syst\u00E8me tr\u00E8s charg\u00E9. Fermez les programmes que vous n'utilisez pas et r\u00E9essayez. 4. Une installation corrompue ou incompl\u00E8te de Lotus Notes.
-LotusNotesErrorVersionCheckText=La version Lotus Notes n\u2019a pas pu \u00EAtre reconnue. (temps expir\u00E9)
-MailDraft=Votre mail se situe \u00E0 pr\u00E9sent dans le dossier des brouillons du client de messagerie.
-MissingOfflineTable=Table hors-ligne manquante
-MissingOnlineTable=Table serveur manquante
-MoveCalendarItem=Remettre
-NetworkProxy=R\u00E9seau / Serveur de proximit\u00E9
-NewBookmarkFolder=Nouveau dossier
-NewButton=Nouveau\u2026
-NewMenu=&Nouveau...
-NewSearch=Nouvelle recherche
-NewStartDate=Nouveau d\u00E9marrage date
-NextStep=Prochaine \u00E9tape
-NoAuthenticationFound=L'authentication n'est pas juste.
-NoRowsFound=Pas d'enregistrements
-NoViewAvailable=Pas de vue disponible
-OcrEditorImageTool=S\u00E9lectionner un graphique
-OcrEditorTextDialog=Texte OCR
-Offline=Hors-ligne
-OfflineAdmin=Administrateur hors-ligne
-OfflineDirectory=R\u00E9pertoire local
-OfflineInstallationInvalidMessage=L'installation hors-ligne est incompl\u00E8te
-OfflineInstallationValidMessage=L'installation hors-ligne est correcte et pr\u00EAte \u00E0 fonctionner
-OfflineMasterServer=Serveur en ligne
-OfflineReplicationInvalidMessage=Impossible d'effectuer la duplication
-OfflineSetup=Mise en place de l'environnement hors-ligne
-OlPrivBody=(Priv\u00E9)
-OlPrivLocation=(Priv\u00E9)
-OlPrivSubjectAppointment=Date priv\u00E9e
-OlPrivSubjectTask=T\u00E2che priv\u00E9e
-OldStartDate=ancienne date de d\u00E9marrage
-OpenDate=Date de cr\u00E9ation
-OpenMenu=Ouvrir\u2026
-Operator=Op\u00E9rateur
-Operators=Op\u00E9rateurs
-Options=Configurations
-OutlookSyncStatusInfo=Synchronisation Outlook r\u00E9ussie. Dates \: \#APPOINTMENT_NEW\# nouvelle \#APPOINTMENT_MODIFY\# actualis\u00E9e \#APPOINTMENT_REMOVE\# supprim\u00E9e \#APPOINTMENT_ERROR\# interrompue. T\u00E2ches \: \#TASK_NEW\# nouvelle \#TASK_MODIFY\# actualis\u00E9e \#TASK_REMOVE\# supprim\u00E9e \#TASK_ERROR\# interrompue.
-OutputLevel=Niveau output
-PasswordChanged=Votre mot de passe a \u00E9t\u00E9 chang\u00E9.
-PasswordNotChanged=Votre mot de passe n'a pas pu \u00EAtre chang\u00E9.
-PasswordNotReset=Le mot de passe n'a pas pu \u00EAtre chang\u00E9.
-PasswordReset=Le mot de passe a \u00E9t\u00E9 chang\u00E9.
-PasswordViolatesPolicy=Le mot de passe ne correspond pas aux directives impos\u00E9es.
-PasswordWillExpireTodayHeader=Votre mot de passe expire aujourd'hui.
-PasswordWrong=Mot de passe faux
-PleaseCheckLogfile=V\u00E9rifier le journal s.v.p.
-PleaseCheckOfflineDirectory=Veuillez contr\u00F4ler si le r\u00E9pertoire hors-ligne existe.
-Port=Port
-Programmed=AQ
-RepAutoCleanupFailedText=La banque de donn\u00E9es locale na pu \u00EAtre mise \u00E0 jour que partiellement.
-RepAutoCleanupPerformedText=La banque de donn\u00E9es locale a \u00E9t\u00E9 mise \u00E0 jour avec succ\u00E8s.
-RepDone=OK
-RepEndDate=Termin\u00E9
-RepGetServerUpdate=Donn\u00E9es re\u00E7ues du serveur\u0085
-RepLastSync=Derni\u00E8re synchronisation \:
-RepNextExtract=Pr\u00E9paration des donn\u00E9es\u0085
-RepProgCommit=Confirmation
-RepProgExtract=Extraire
-RepProgSync=Echange de donn\u00E9es
-RepProgUpdate=Actualiser
-RepStartDate=Lancement
-Replicate=Duplication
-ReplicationStatus=Etat de la duplication
-ReportLayoutTitle=Type de report
-ReportNoDataFound=Ils n'existent pas des donn\u00E9es avec les conditions entr\u00E9es.
-ResetPasswordUserHasNoLoginName=La personne choisie n'a pas de login valide
-ResultOfTableVerification=R\u00E9sultat du contr\u00F4le de la banque de donn\u00E9es
-RowCountDifferenceOnTable=Nombre diff\u00E9rent d'enregistrements
-SC_DialogTitle_UserDictionary=Dictionnaire d\u2019utilisateur
-SC_Help_AddWord=Ajoute le mot dans le champ du texte au dictionnaire d\u2019utilisateur
-SC_Help_Close=Ferme ce dialogue
-SC_Help_Delete=Annule le mot noirci
-SC_Help_EditUserDictionary=Traiter le dictionnaire de l\u2019utilisateur
-SC_Help_MultiLineFields=Champs \u00E0 lignes multiples
-SC_Help_SingleLineFields=Champs \u00E0 lignes uniques
-SC_Help_UseOfficeDictionary=Utilise le dictionnaire de l\u2019utilisateur standard de Microsoft Office
-SC_Label_AddWord=Ajouter le mot
-SC_Label_AlwaysCheckAsYouType=Toujours contr\u00F4ler \u00E0 l\u2019arri\u00E8re-plan
-SC_Label_ApplicationDefault=Application standard
-SC_Label_CheckAsYouType=Contr\u00F4le d\u2019arri\u00E8re-plan
-SC_Label_Close=Fermer
-SC_Label_Delete=Annuler
-SC_Label_EditUserDictionary=Traiter le dictionnaire\u2026
-SC_Label_MultiLineFields=Champs \u00E0 lignes multiples
-SC_Label_NeverCheckAsYouType=Ne jamais contr\u00F4ler \u00E0 l\u2019arri\u00E8re-plan
-SC_Label_Ok=Ok
-SC_Label_SingleLineFields=Champs \u00E0 lignes uniques
-SC_Label_UseOfficeDictionary=Utiliser le dictionnaire MS Office
-SC_Label_Word=Mot
-SC_Language_En=Anglais
-SC_Language_EnCa=Anglais (Canada)
-SC_Language_EnUk=Anglais (G.B.)
-SC_Language_EnUs=Anglais (E.U.)
-SC_Language_Fr=Fran\u00E7ais
-SC_Language_FrCa=Fran\u00E7ais (Canada)
-SC_Language_FrFr=Fran\u00E7ais (France)
-SC_Language_Ge=Allemand
-SC_Language_GeAt=Allemand (Autriche)
-SC_Language_GeCh=Allemand (Suisse)
-SC_Language_GeDe=Allemand (Allemagne)
-SC_Language_It=Italien
-SC_Language_ItIt=Italien (Italie)
-SC_Language_Sp=Espagnol
-SC_Language_SpEs=Espagnol (Espagne)
-SC_Message_UserDictionaryNotFound=Dictionnaire d\u2019utilisateur non trouv\u00E9
-SWUpdateMsg10=Erreur lors de la sauvegarde et de l'actualisation de\:
-SWUpdateMsg1=Une mise a jour du logiciel est disponible. \nLa version install\u00E9e est\:\#OLD\#\n. La nouvelle version est\:\#NEW\#
-SWUpdateMsg2=Voulez-vous mettre \u00E0 jour le logiciel ?
-SWUpdateMsg3a=La mise \u00E0 jour du logiciel a \u00E9t\u00E9 t\u00E9l\u00E9charg\u00E9e avec succ\u00E8s.\nLa mise \u00E0 jour sera effectu\u00E9e lors du prochain lancement de l'application.
-SWUpdateMsg4=Aucune connexion r\u00E9seau possible avec le serveur de mise \u00E0 jour
-SWUpdateMsg5=Echec de l'interrogation de la version du serveur
-SWUpdateMsg6=L'installation est \u00E0 jour.
-SWUpdateMsg7=Mise \u00E0 jour du logiciel interrompue.
-SWUpdateMsg8=R\u00E9pertoire des fichiers de l'application introuvable\:
-SWUpdateMsg9=Echec du t\u00E9l\u00E9chargement des nouveaux fichiers de l'application\:
-SaveAndLoopback=Bouclage et sauvegarde
-ScOutlookErrorCache=Le module d'extension n'a pas pu cr\u00E9er une m\u00E9moire cache.\nLa synchronisation de tous les '{0}' n'a pas \u00E9t\u00E9 r\u00E9alis\u00E9e. \nVeuillez contr\u00F4ler votre configuration Outlook.
-ScOutlookErrorGeneral=Le module d'extension n'a pas initialis\u00E9 Outlook.\n Veuillez contr\u00F4ler votre configuration Outlook.
-ScOutlookErrorPartial=Le module d'extension n'a pas pu synchroniser certains enregistrements.\nLes enregistrements suivants n'ont pas \u00E9t\u00E9 trait\u00E9s\:\n{0}
-ScOutlookErrorTooMany=Trop d'entr\u00E9es \u00E0 afficher.
-ScOutlookErrorUnknown=Le module d'extension a occasionn\u00E9 une erreur inconnue.\nVeuillez consulter le journal d'erreurs pour plus d'informations.
-ScOutlookTitle=Module externe ScOutlook
-ScoutHome=Donn\u00E9es personnelles
-SearchButtonPanelTooltip=D\u00E9marrage de la recherche
-SearchMenu=Chercher...
-SearchPartial=Recherche partielle
-SecurityNotAllowed=La transaction a \u00E9t\u00E9 refus\u00E9 par le server.
-Selected=S\u00E9lectionn\u00E9
-SelectionIsEmpty=La s\u00E9lection est vide
-Servidor_All=Tout
-ShowAll=Visualiser tous
-ShowFileChooser=Dialogue de recherche de fichier
-ShowFileErrorText=Impossible d'ouvrir le fichier '{0}'.
-ShowFileErrorTitle=Afficher le fichier
-ShowMore=Visualiser d\u2019autres
-Site=Serveur
-SmartFieldCallSmartDialog=Lors de la visualisation de la liste de s\u00E9lection champ smart
-SmartFieldTooManyRows=Trop d'enregistrements. Limiter la notion de recherche s.v.p.
-SpreadsheetPasteWarning1a=Certaines cellules sont prot\u00E9g\u00E9es en \u00E9criture. Il n\u2019est pas possible d\u2019y traiter/ins\u00E9rer.
-SpreadsheetPasteWarning1b=Les valeurs ont \u00E9t\u00E9 ignor\u00E9es en cons\u00E9quence.
-StartupPhaseConfig=Chargement de l'application\u0085
-StartupPhaseOffline=Pr\u00E9paration de l'environnement
-StartupPhaseUpdate=Recherche mises \u00E0 jour\u0085
-StoreColumnWidths=Enregister la largeur des colonnes
-TableVerificationCoefficient=Coefficient de corr\u00E9lation
-TableVerificationSuccessful=Fin de la corr\u00E9lation de la base de donn\u00E9es
-Timeframe=Cadre de temps
-TransferProgressLabel=R\u00E9ception en cours...
-TransferProgressTitle=Transfer de donn\u00E9es
-Using=Utilis\u00E9
-Verify=V\u00E9rifier
-VerifyOfflineEnvironment=Contr\u00F4le / Installation
-VetoErrorTitle=Entr\u00E9e invalide dans le champ de recherche
-ViewListLabel=Choisissez une vue
-ViewListTitle=Toutes les vues
-With=avec
-WorkOffline=Travailler hors ligne
-WorkOfflineInfoText=Pour pouvoir travailler hors-ligne, veuillez introduire l'URL du serveur d'application dans le champ ""Server"". Il s'agit g\u00E9n\u00E9ralement du m\u00EAme URL utilis\u00E9 pour une connexion en ligne.
-Workflows=D\u00E9roulement des t\u00E2ches
-aView=une visualisation
-someview=une visualisation
+AccessAuthorization=Autorisation du serveur
+Application=Logiciel
+ApplicationServer=Serveur d'application
+AppointmentProposition=Proposition de date
+AutomaticallyStopAfterFirstFetch=Ex\u00E9cuter uniquement le premier logiciel de t\u00E9l\u00E9chargement
+BackendCall=Appel du service
+BrowseMenu=Chercher...
+CTIDialErrorInfo=Veuillez contr\u00F4ler le numero de t\u00E9l\u00E9phone et la connexion.
+CTIDialErrorText=Serveur de t\u00E9l\u00E9phone inaccessible
+CTIDialErrorTitle=T\u00E9l\u00E9phone
+Calendar_itemCont=(tag)
+Calendar_itemFrom=De
+Calendar_itemUntil=\u00E0
+CheckFailed=Erreur des donn\u00E9es
+CheckFailedMessage=La v\u00E9rification des donn\u00E9es n'est pas r\u00E9ussie.
+Choose=S\u00E9lectionner
+ComposerAggregationCount=Quantit\u00E9
+ComposerFieldAddAttribute=Ajouter un attribut
+ComposerFieldAggregationNone=N/A
+Containing=contenant
+ContinueMenu=Continuer
+CopyPasteHint=Pour plus d'informations, pressez 'Copier' et collez le contenu dans un \u00E9diteur de texte.
+CouldNotCreateOfflineDirectory=Impossible de cr\u00E9er un r\u00E9pertoire local
+CouldNotFindOfflineClasses=Environnement hors-ligne introuvable
+CouldNotFindOfflineConfig=Configuration hors-ligne introuvable
+CouldNotFindOfflineDatabase=Aucune base de donn\u00E9es disponible
+CouldNotGetApplication=Impossible de charger le logiciel.
+CouldNotGetApplicationInfo=Impossible de charger la description du logiciel.
+CreateTriggers=Cr\u00E9er le trigger
+CurrentLocale=Secteur de langue actuel
+CurrentStep=\u00C9tape actuelle
+CustomRollback=L'action a \u00E9t\u00E9 annul\u00E9e
+DataLoading=Transfer de donn\u00E9es
+DateErrorText=La date entr\u00E9e {0} n'est pas valide. Corriger le valeur s.v.p.
+DateErrorTitle=Date non valable
+DismissMenu=Rejeter\u2026
+DisplayedTimerange=Secteur de date visualis\u00E9
+DoubleWeek=Semaine double
+DownloadOfflineDatabase=Souhaitez-vous t\u00E9l\u00E9charger la base de donn\u00E9es ?
+DragMenu=Drag (Config Marker)
+DropMenu=Drop (Config Marker)
+EditMenu=Editer...
+ElapsedTime=\u00C9coul\u00E9
+EnableHtmlEditing=Activer le mode HTML
+EndStatus=\u00C9tat final
+EnterUrlTooltip=Entrer l'URL ou entrer apr\u00E8s on a copi\u00E9/coll\u00E9
+ErrorAndRetryQuestion=Voulez-vous informer votre administrateur des syst\u00E8mes.
+ErrorAndWarning=Erreur / Avertissement
+ErrorAndWarningAndMessage=Erreurs / Avertissements / Message
+ErrorCommandFailedQuestion=Voulez-vous ignorer le message et continuer?
+ErrorCommandFailedText=Op\u00E9ration interrompue.
+ErrorOnly=Erreur
+ErrorReadingOfflineTable=Erreur lors de la lecture de la table hors-ligne
+ErrorReadingOnlineTable=Erreur lors de la lecture de la table serveur
+ErrorTextLoginOutdated=Mot de passe p\u00E9rim\u00E9
+EstimatedEndDate=Termin\u00E9
+EstimatedTime=Dur\u00E9e estim\u00E9e
+ExcelChart_Button_Cancel=Interrompre
+ExcelChart_Button_CancelHint=Interrompt l\u2019export et cl\u00F4ture ce formulaire.
+ExcelChart_Button_OK=Exporter
+ExcelChart_Button_OKHint=D\u00E9marre l\u2019export.
+ExcelChart_Error_ActivatingWorksheetFailed=L\u2019activation de la feuille du tableau a \u00E9chou\u00E9.
+ExcelChart_Error_CreatingWorksheetFailed=la cr\u00E9ation de la feuille du tableau a \u00E9chou\u00E9.
+ExcelChart_Error_FillingChartFailed=le remplissage du diagramme a \u00E9chou\u00E9.
+ExcelChart_Error_OpeningChartFailed=l\u2019ouverture du diagramme a \u00E9chou\u00E9.
+ExcelChart_Error_OpeningWorksheetFailed=l\u2019ouverture de la feuille du tableau a \u00E9chou\u00E9.
+ExcelChart_Error_RetrivingVariableFailed=une variable n\u2019a pas pu \u00EAtre lue
+ExcelChart_Error_SavingWorkbookFailed=la sauvegarde du document Excel a \u00E9chou\u00E9.
+ExcelChart_Error_UnknownException=une erreur inattendue est survenue
+ExcelChart_Various_AveragedLong=Moyenne de toutes les valeurs qui rel\u00E8vent de la m\u00EAme valeur de l\u2019axe X
+ExcelChart_Various_FrequencyLong=Fr\u00E9quence (\u00E0 quelle fr\u00E9quence appara\u00EEt la valeur correspondant \u00E0 l\u2019axe X)
+ExcelChart_Various_SummedUpLong=Somme de toutes les valeurs qui rel\u00E8vent de la m\u00EAme valeur de l\u2019axe X
+ExtendedSearchEditEntityMenu=Modifier...
+ExtendedSearchEntityPrefix=a
+ExtendedSearchEntityPrefixNegated=n'a pas
+ExtendedSearchSaveButton=Ajouter
+FailedDownloadingFile=Impossible de t\u00E9l\u00E9charger le fichier
+FailedGettingOfflineTableVerification=Echec de la v\u00E9rification de la table hors-ligne
+FailedGettingOnlineTableVerification=Echec de la v\u00E9rification de la table serveur
+FieldRangeErrorText=Le valeur 'de' ne peut pas \u00EAtre plus grand du valeur '\u00E0'.
+FieldRangeErrorTitle=Erreur dans le secteur des valeurs
+Fields=Champs
+FilePath=Chemin du fichier
+FormInactivityTimerActivated=Activation du compteur de temps d\u2019inactivit\u00E9
+FormInvalidTextInFields=Les champs suivants ont des valeurs non valable\:
+FormMissingMandatoryFields=Les champs suivants doivent \u00EAtre rempli\:
+FormStateLoadTooltip=Ouvrir les crit\u00E8res de la recherche d'un fichier xml
+FormStateStoreTooltip=Enregistrer les crit\u00E8res de la recherche dans un fichier xml
+GenericSearch=Recherche sp\u00E9ciale
+GetUrlForm=Adresse Web
+HistoryAddColumnMove=d\u00E9place la colonne
+HistoryAddSort=trie par
+HistoryAddSortDesc=d\u00E9croissant
+HistoryBackward=R\u00E9tour
+HistoryForward=Avancer
+HtmlPluginActionSubmitted=Action ex\u00E9cut\u00E9e
+HtmlPluginChangesSaved=Modifications enregistr\u00E9es
+HtmlPluginPendingAction=Vous avez d\u00E9j\u00E0 une fen\u00EAtre popup ouverte dans l'application. Fermez-la en premier.
+HtmlPopupInfoPanel=Une fen\u00EAtre popup a \u00E9t\u00E9 ouverte dans l'application
+IgnoreCase=Ignorer grandement/miniscule
+Informations=Informations
+InvolvedPersons=Personnes impliqu\u00E9es
+LastStep=Derni\u00E8re \u00E9tape
+LiveEdit=Editer en live
+LocalServer=Serveur local
+Logging=Journalisation
+LogicDateIsInGEWeeks=est au plus t\u00F4t dans {0} semaines
+LogicDateIsInLEWeeks=est au plus tard dans {0} semaines
+LogicDateIsInWeeks=est exactement dans {0} semaines
+LogicIN=dans
+LoginErrorText=Nom d'utilisateur/mot de passe incorrect
+LoginErrorTitle=\u00C9chec d'authentification
+LoginFailed=\u00C9chec d'authentification
+LoginToApplicationServer=Authentification
+LotusNotesCode=Lotus Notes
+LotusNotesConnectErrorDetail=Contr\u00F4lez svp si Lotus Notes est install\u00E9 et si les autorisations existent.
+LotusNotesConnectErrorText=Lotus Notes non disponible.
+LotusNotesErrorDLLDetail=Le fichier nlsxbe.dll est install\u00E9 de fa\u00E7on standardis\u00E9e avec Lotus Notes et se trouve dans le r\u00E9pertoire d\u2019installation de Lotus Notes, p.ex. C\:\\Programmes\\lotus\\notes. Pour r\u00E9parer le probl\u00E8me, assurez-vous que le fichier soit correctement enregistr\u00E9 (enregistrement Windows).
+LotusNotesErrorDLLText=Le fichier nlsxbe.dll n\u2019a pas pu \u00EAtre trouv\u00E9.
+LotusNotesErrorDatabaseOpenDetail=Cette erreur survient lorsque Lotus Notes se trouve en mode en ligne (r\u00E9seau SIKA) bien qu'il n'y ait aucune connexion au serveur \u00E0 distance. Veuillez \u00E9tablir une connexion au serveur ou mettre Lotus Notes en mode autonome (Island mode). IMPORTANT \: cette erreur survient \u00E9galement si Lotus Notes a \u00E9t\u00E9 ferm\u00E9 en mode en ligne. Dans ce cas, il vous faut lancer Lotus Notes et passer en mode autonome.
+LotusNotesErrorDatabaseOpenText=La banque de donn\u00E9es n\u2019est pas disponible.
+LotusNotesErrorIDFileDetail=Cette erreur est habituellement caus\u00E9e par une bo\u00EEte ouverte de dialogue de login de Lotus Notes. Veuillez fermer le dialogue de login et r\u00E9essayer.
+LotusNotesErrorIDFileOpenDetail=En voici les causes possibles \: 1. Une bo\u00EEte ouverte de dialogue de login (dans ce cas, le fichier ID de l'utilisateur est bloqu\u00E9. Veuillez terminer le processus de loging). 2. Il manque le fichier nlsxbe.dll. Ce fichier se trouve habituellement dans le r\u00E9pertoire de base de Lotus Notes. Assurez-vous que le fichier existe et que le r\u00E9pertoire de base de Lotus Notes fasse partie des variables d'environnement 'Path'. 3. Un syst\u00E8me tr\u00E8s charg\u00E9. Fermez les programmes que vous n'utilisez pas et r\u00E9essayez. 4. Une installation corrompue ou incompl\u00E8te de Lotus Notes.
+LotusNotesErrorIDFileOpenText=Le fichier ID de l\u2019utilisateur n\u2019a pas pu \u00EAtre ouvert.
+LotusNotesErrorIDFileText=Le fichier ID de l\u2019utilisateur est bloqu\u00E9
+LotusNotesErrorMailFileDetail=Le fichier notes.ini se trouve durant l'exploitation de Lotus Notes dans le r\u00E9pertoire d'installation. Pour fonctionner, l'interface COM (BSI CRM - Lotus Notes) requiert que notes.ini comporte une entr\u00E9e "mailFile\=\#\#\#.nsf". \#\#\#.nsf repr\u00E9sente le fichier dans laquelle est sauvegard\u00E9e la banque de donn\u00E9es des messages hors ligne. Veuillez en informer votre administrateur de syst\u00E8me.
+LotusNotesErrorMailFileText=Il manque l\u2019enregistrement dans notes.ini
+LotusNotesErrorPasswordDetail=Veuillez svp r\u00E9p\u00E9ter le processus ou adressez \u2013vous \u00E0 l\u2019administrateur du syst\u00E8me. (Veuillez svp faire attention \u00E0 l\u2019\u00E9criture correcte du mot de passe en majuscules resp. minuscules)
+LotusNotesErrorPasswordText=Le mot de passe est faux
+LotusNotesErrorUnknownDetail=Si cette erreur devait continuer \u00E0 se produire, informez svp votre administrateur de syst\u00E8me.
+LotusNotesErrorUnknownText=Une erreur inconnue est survenue.
+LotusNotesErrorVersionCheckDetail=En voici les causes possibles \: 1. Une bo\u00EEte ouverte de dialogue de login (dans ce cas, le fichier ID de l'utilisateur est bloqu\u00E9. Veuillez terminer le processus de loging). 2. Il manque le fichier nlsxbe.dll. Ce fichier se trouve habituellement dans le r\u00E9pertoire de base de Lotus Notes. Assurez-vous que le fichier existe et que le r\u00E9pertoire de base de Lotus Notes fasse partie des variables d'environnement 'Path'. 3. Un syst\u00E8me tr\u00E8s charg\u00E9. Fermez les programmes que vous n'utilisez pas et r\u00E9essayez. 4. Une installation corrompue ou incompl\u00E8te de Lotus Notes.
+LotusNotesErrorVersionCheckText=La version Lotus Notes n\u2019a pas pu \u00EAtre reconnue. (temps expir\u00E9)
+MailDraft=Votre mail se situe \u00E0 pr\u00E9sent dans le dossier des brouillons du client de messagerie.
+MissingOfflineTable=Table hors-ligne manquante
+MissingOnlineTable=Table serveur manquante
+MoveCalendarItem=Remettre
+NetworkProxy=R\u00E9seau / Serveur de proximit\u00E9
+NewBookmarkFolder=Nouveau dossier
+NewButton=Nouveau\u2026
+NewMenu=&Nouveau...
+NewSearch=Nouvelle recherche
+NewStartDate=Nouveau d\u00E9marrage date
+NextStep=Prochaine \u00E9tape
+NoAuthenticationFound=L'authentication n'est pas juste.
+NoRowsFound=Pas d'enregistrements
+NoViewAvailable=Pas de vue disponible
+OcrEditorImageTool=S\u00E9lectionner un graphique
+OcrEditorTextDialog=Texte OCR
+Offline=Hors-ligne
+OfflineAdmin=Administrateur hors-ligne
+OfflineDirectory=R\u00E9pertoire local
+OfflineInstallationInvalidMessage=L'installation hors-ligne est incompl\u00E8te
+OfflineInstallationValidMessage=L'installation hors-ligne est correcte et pr\u00EAte \u00E0 fonctionner
+OfflineMasterServer=Serveur en ligne
+OfflineReplicationInvalidMessage=Impossible d'effectuer la duplication
+OfflineSetup=Mise en place de l'environnement hors-ligne
+OlPrivBody=(Priv\u00E9)
+OlPrivLocation=(Priv\u00E9)
+OlPrivSubjectAppointment=Date priv\u00E9e
+OlPrivSubjectTask=T\u00E2che priv\u00E9e
+OldStartDate=ancienne date de d\u00E9marrage
+OpenDate=Date de cr\u00E9ation
+OpenMenu=Ouvrir\u2026
+Operator=Op\u00E9rateur
+Operators=Op\u00E9rateurs
+Options=Configurations
+OutlookSyncStatusInfo=Synchronisation Outlook r\u00E9ussie. Dates \: \#APPOINTMENT_NEW\# nouvelle \#APPOINTMENT_MODIFY\# actualis\u00E9e \#APPOINTMENT_REMOVE\# supprim\u00E9e \#APPOINTMENT_ERROR\# interrompue. T\u00E2ches \: \#TASK_NEW\# nouvelle \#TASK_MODIFY\# actualis\u00E9e \#TASK_REMOVE\# supprim\u00E9e \#TASK_ERROR\# interrompue.
+OutputLevel=Niveau output
+PasswordChanged=Votre mot de passe a \u00E9t\u00E9 chang\u00E9.
+PasswordNotChanged=Votre mot de passe n'a pas pu \u00EAtre chang\u00E9.
+PasswordNotReset=Le mot de passe n'a pas pu \u00EAtre chang\u00E9.
+PasswordReset=Le mot de passe a \u00E9t\u00E9 chang\u00E9.
+PasswordViolatesPolicy=Le mot de passe ne correspond pas aux directives impos\u00E9es.
+PasswordWillExpireTodayHeader=Votre mot de passe expire aujourd'hui.
+PasswordWrong=Mot de passe faux
+PleaseCheckLogfile=V\u00E9rifier le journal s.v.p.
+PleaseCheckOfflineDirectory=Veuillez contr\u00F4ler si le r\u00E9pertoire hors-ligne existe.
+Port=Port
+Programmed=AQ
+RepAutoCleanupFailedText=La banque de donn\u00E9es locale na pu \u00EAtre mise \u00E0 jour que partiellement.
+RepAutoCleanupPerformedText=La banque de donn\u00E9es locale a \u00E9t\u00E9 mise \u00E0 jour avec succ\u00E8s.
+RepDone=OK
+RepEndDate=Termin\u00E9
+RepGetServerUpdate=Donn\u00E9es re\u00E7ues du serveur\u0085
+RepLastSync=Derni\u00E8re synchronisation \:
+RepNextExtract=Pr\u00E9paration des donn\u00E9es\u0085
+RepProgCommit=Confirmation
+RepProgExtract=Extraire
+RepProgSync=Echange de donn\u00E9es
+RepProgUpdate=Actualiser
+RepStartDate=Lancement
+Replicate=Duplication
+ReplicationStatus=Etat de la duplication
+ReportLayoutTitle=Type de report
+ReportNoDataFound=Ils n'existent pas des donn\u00E9es avec les conditions entr\u00E9es.
+ResetPasswordUserHasNoLoginName=La personne choisie n'a pas de login valide
+ResultOfTableVerification=R\u00E9sultat du contr\u00F4le de la banque de donn\u00E9es
+RowCountDifferenceOnTable=Nombre diff\u00E9rent d'enregistrements
+SC_DialogTitle_UserDictionary=Dictionnaire d\u2019utilisateur
+SC_Help_AddWord=Ajoute le mot dans le champ du texte au dictionnaire d\u2019utilisateur
+SC_Help_Close=Ferme ce dialogue
+SC_Help_Delete=Annule le mot noirci
+SC_Help_EditUserDictionary=Traiter le dictionnaire de l\u2019utilisateur
+SC_Help_MultiLineFields=Champs \u00E0 lignes multiples
+SC_Help_SingleLineFields=Champs \u00E0 lignes uniques
+SC_Help_UseOfficeDictionary=Utilise le dictionnaire de l\u2019utilisateur standard de Microsoft Office
+SC_Label_AddWord=Ajouter le mot
+SC_Label_AlwaysCheckAsYouType=Toujours contr\u00F4ler \u00E0 l\u2019arri\u00E8re-plan
+SC_Label_ApplicationDefault=Application standard
+SC_Label_CheckAsYouType=Contr\u00F4le d\u2019arri\u00E8re-plan
+SC_Label_Close=Fermer
+SC_Label_Delete=Annuler
+SC_Label_EditUserDictionary=Traiter le dictionnaire\u2026
+SC_Label_MultiLineFields=Champs \u00E0 lignes multiples
+SC_Label_NeverCheckAsYouType=Ne jamais contr\u00F4ler \u00E0 l\u2019arri\u00E8re-plan
+SC_Label_Ok=Ok
+SC_Label_SingleLineFields=Champs \u00E0 lignes uniques
+SC_Label_UseOfficeDictionary=Utiliser le dictionnaire MS Office
+SC_Label_Word=Mot
+SC_Language_En=Anglais
+SC_Language_EnCa=Anglais (Canada)
+SC_Language_EnUk=Anglais (G.B.)
+SC_Language_EnUs=Anglais (E.U.)
+SC_Language_Fr=Fran\u00E7ais
+SC_Language_FrCa=Fran\u00E7ais (Canada)
+SC_Language_FrFr=Fran\u00E7ais (France)
+SC_Language_Ge=Allemand
+SC_Language_GeAt=Allemand (Autriche)
+SC_Language_GeCh=Allemand (Suisse)
+SC_Language_GeDe=Allemand (Allemagne)
+SC_Language_It=Italien
+SC_Language_ItIt=Italien (Italie)
+SC_Language_Sp=Espagnol
+SC_Language_SpEs=Espagnol (Espagne)
+SC_Message_UserDictionaryNotFound=Dictionnaire d\u2019utilisateur non trouv\u00E9
+SWUpdateMsg10=Erreur lors de la sauvegarde et de l'actualisation de\:
+SWUpdateMsg1=Une mise a jour du logiciel est disponible. \nLa version install\u00E9e est\:\#OLD\#\n. La nouvelle version est\:\#NEW\#
+SWUpdateMsg2=Voulez-vous mettre \u00E0 jour le logiciel ?
+SWUpdateMsg3a=La mise \u00E0 jour du logiciel a \u00E9t\u00E9 t\u00E9l\u00E9charg\u00E9e avec succ\u00E8s.\nLa mise \u00E0 jour sera effectu\u00E9e lors du prochain lancement de l'application.
+SWUpdateMsg4=Aucune connexion r\u00E9seau possible avec le serveur de mise \u00E0 jour
+SWUpdateMsg5=Echec de l'interrogation de la version du serveur
+SWUpdateMsg6=L'installation est \u00E0 jour.
+SWUpdateMsg7=Mise \u00E0 jour du logiciel interrompue.
+SWUpdateMsg8=R\u00E9pertoire des fichiers de l'application introuvable\:
+SWUpdateMsg9=Echec du t\u00E9l\u00E9chargement des nouveaux fichiers de l'application\:
+SaveAndLoopback=Bouclage et sauvegarde
+ScOutlookErrorCache=Le module d'extension n'a pas pu cr\u00E9er une m\u00E9moire cache.\nLa synchronisation de tous les '{0}' n'a pas \u00E9t\u00E9 r\u00E9alis\u00E9e. \nVeuillez contr\u00F4ler votre configuration Outlook.
+ScOutlookErrorGeneral=Le module d'extension n'a pas initialis\u00E9 Outlook.\n Veuillez contr\u00F4ler votre configuration Outlook.
+ScOutlookErrorPartial=Le module d'extension n'a pas pu synchroniser certains enregistrements.\nLes enregistrements suivants n'ont pas \u00E9t\u00E9 trait\u00E9s\:\n{0}
+ScOutlookErrorTooMany=Trop d'entr\u00E9es \u00E0 afficher.
+ScOutlookErrorUnknown=Le module d'extension a occasionn\u00E9 une erreur inconnue.\nVeuillez consulter le journal d'erreurs pour plus d'informations.
+ScOutlookTitle=Module externe ScOutlook
+ScoutHome=Donn\u00E9es personnelles
+SearchButtonPanelTooltip=D\u00E9marrage de la recherche
+SearchMenu=Chercher...
+SearchPartial=Recherche partielle
+SecurityNotAllowed=La transaction a \u00E9t\u00E9 refus\u00E9 par le server.
+Selected=S\u00E9lectionn\u00E9
+SelectionIsEmpty=La s\u00E9lection est vide
+Servidor_All=Tout
+ShowAll=Visualiser tous
+ShowFileChooser=Dialogue de recherche de fichier
+ShowFileErrorText=Impossible d'ouvrir le fichier '{0}'.
+ShowFileErrorTitle=Afficher le fichier
+ShowMore=Visualiser d\u2019autres
+Site=Serveur
+SmartFieldCallSmartDialog=Lors de la visualisation de la liste de s\u00E9lection champ smart
+SmartFieldTooManyRows=Trop d'enregistrements. Limiter la notion de recherche s.v.p.
+SpreadsheetPasteWarning1a=Certaines cellules sont prot\u00E9g\u00E9es en \u00E9criture. Il n\u2019est pas possible d\u2019y traiter/ins\u00E9rer.
+SpreadsheetPasteWarning1b=Les valeurs ont \u00E9t\u00E9 ignor\u00E9es en cons\u00E9quence.
+StartupPhaseConfig=Chargement de l'application\u0085
+StartupPhaseOffline=Pr\u00E9paration de l'environnement
+StartupPhaseUpdate=Recherche mises \u00E0 jour\u0085
+StoreColumnWidths=Enregister la largeur des colonnes
+TableVerificationCoefficient=Coefficient de corr\u00E9lation
+TableVerificationSuccessful=Fin de la corr\u00E9lation de la base de donn\u00E9es
+Timeframe=Cadre de temps
+TransferProgressLabel=R\u00E9ception en cours...
+TransferProgressTitle=Transfer de donn\u00E9es
+Using=Utilis\u00E9
+Verify=V\u00E9rifier
+VerifyOfflineEnvironment=Contr\u00F4le / Installation
+VetoErrorTitle=Entr\u00E9e invalide dans le champ de recherche
+ViewListLabel=Choisissez une vue
+ViewListTitle=Toutes les vues
+With=avec
+WorkOffline=Travailler hors ligne
+WorkOfflineInfoText=Pour pouvoir travailler hors-ligne, veuillez introduire l'URL du serveur d'application dans le champ ""Server"". Il s'agit g\u00E9n\u00E9ralement du m\u00EAme URL utilis\u00E9 pour une connexion en ligne.
+Workflows=D\u00E9roulement des t\u00E2ches
+aView=une visualisation
+someview=une visualisation
diff --git a/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_fr_BE.properties b/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_fr_BE.properties
index f0e0e1f973..f036b7f00d 100644
--- a/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_fr_BE.properties
+++ b/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_fr_BE.properties
@@ -1,9 +1,9 @@
-Calendar_itemCont=(tag)
-Calendar_itemFrom=De
-Calendar_itemUntil=Jusqu'\u00E0
-Choose=Choisir
-CopyPasteHint=(Pour plus d'information, pressez sur 'Copier' et coller le contenu dans un \u00E9diteur de texte)
-DisplayedTimerange=Gamme de temps montr\u00E9
-DoubleWeek=Double semaine
-InvolvedPersons=Personnes impliqu\u00E9es
-LotusNotesCode=Lotus Notes
+Calendar_itemCont=(tag)
+Calendar_itemFrom=De
+Calendar_itemUntil=Jusqu'\u00E0
+Choose=Choisir
+CopyPasteHint=(Pour plus d'information, pressez sur 'Copier' et coller le contenu dans un \u00E9diteur de texte)
+DisplayedTimerange=Gamme de temps montr\u00E9
+DoubleWeek=Double semaine
+InvolvedPersons=Personnes impliqu\u00E9es
+LotusNotesCode=Lotus Notes
diff --git a/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_hr.properties b/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_hr.properties
index 5fefaf51f7..7d51f1b091 100644
--- a/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_hr.properties
+++ b/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_hr.properties
@@ -1,8 +1,8 @@
-Calendar_itemCont=(oznaka)
-Calendar_itemFrom=Od
-Calendar_itemUntil=do
-CopyPasteHint=For detailed information, press 'Copy' button and 'Paste' in text editor.
-DisplayedTimerange=Opseg vremena na prikazu
-DoubleWeek=Dupli tjedan
-InvolvedPersons=Umije\u0161ane osobe
-LotusNotesCode=Lotus Notes
+Calendar_itemCont=(oznaka)
+Calendar_itemFrom=Od
+Calendar_itemUntil=do
+CopyPasteHint=For detailed information, press 'Copy' button and 'Paste' in text editor.
+DisplayedTimerange=Opseg vremena na prikazu
+DoubleWeek=Dupli tjedan
+InvolvedPersons=Umije\u0161ane osobe
+LotusNotesCode=Lotus Notes
diff --git a/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_hu.properties b/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_hu.properties
index 145f6e6714..6316b2184e 100644
--- a/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_hu.properties
+++ b/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_hu.properties
@@ -1,8 +1,8 @@
-Calendar_itemCont=(c\u00EDmke)
-Calendar_itemFrom=T\u00F3l
-Calendar_itemUntil=Ig
-CopyPasteHint=R\u00E9szletes inform\u00E1ci\u00F3\u00E9rt nyomja meg a Copy gombot, majd a Paste gombot a sz\u00F6vegszerkesztoben.
-DisplayedTimerange=Displayed timerange
-DoubleWeek=Double week
-InvolvedPersons=\u00C9rdekelt szem\u00E9ly
-LotusNotesCode=Lotus Notes
+Calendar_itemCont=(c\u00EDmke)
+Calendar_itemFrom=T\u00F3l
+Calendar_itemUntil=Ig
+CopyPasteHint=R\u00E9szletes inform\u00E1ci\u00F3\u00E9rt nyomja meg a Copy gombot, majd a Paste gombot a sz\u00F6vegszerkesztoben.
+DisplayedTimerange=Displayed timerange
+DoubleWeek=Double week
+InvolvedPersons=\u00C9rdekelt szem\u00E9ly
+LotusNotesCode=Lotus Notes
diff --git a/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_it.properties b/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_it.properties
index b166759015..0768919e9d 100644
--- a/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_it.properties
+++ b/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_it.properties
@@ -1,298 +1,298 @@
-AccessAuthorization=Autorizzazione del server
-Application=Applicazione
-ApplicationServer=Server di applicazione
-AppointmentProposition=Proposta di scadenza
-AutomaticallyStopAfterFirstFetch=Prendere solo primo record
-BackendCall=Richiamare servizio
-BrowseMenu=Ricerca...
-CTIDialErrorInfo=Verificare il numero di telefono e la connessione al server.
-CTIDialErrorText=Server telefonico non disponibile.
-CTIDialErrorTitle=Telefono
-Calendar_itemCont=(tag)
-Calendar_itemFrom=Dal
-Calendar_itemUntil=al
-CheckFailed=Errore dei dati
-CheckFailedMessage=Vi \u00E8 stato un errore durante la verifica dati.
-Choose=Seleziona
-ComposerAggregationCount=Numero
-ComposerFieldAddAttribute=Aggiungere attributo
-ComposerFieldAggregationNone=N/A
-ConnectionTest_Button_Cancel=Cancellare
-ConnectionTest_Button_CancelHint=Chiudere il modulo.
-ConnectionTest_Button_Refresh=Aggiornare
-ConnectionTest_Label_DBResult=Connessione al database
-ConnectionTest_Label_ServerResult=Connessione al server
-Connection_Test_MainForm=Connessione di prova
-Containing=contenente
-ContinueMenu=Continuare
-CopyPasteHint=Per ulteriori informazioni, premere il pulsante 'copia' e 'incolla' in un editor di testi.
-CouldNotCreateOfflineDirectory=Non \u00E8 possibile creare una directory locale\:
-CouldNotFindOfflineClasses=Non \u00E8 disponibile l'ambiente offline
-CouldNotFindOfflineConfig=Non \u00E8 disponibile la configurazione offline
-CouldNotFindOfflineDatabase=Non \u00E8 stato trovato un database locale
-CouldNotGetApplication=Non \u00E8 stato possibile caricare l'applicazione.
-CouldNotGetApplicationInfo=Non \u00E8 stato possibile caricare la descrizione dell'applicazione.
-CreateTriggers=Creare il trigger
-CurrentLocale=Settore linguistico attuale
-CurrentStep=Fase attuale
-CustomRollback=L'azione \u00E8 stata annullata
-DataLoading=Trasferimento di dati
-DateErrorText=La data '{0}' inserita non \u00E8 valida. Correggere il valore.
-DateErrorTitle=Data non valida
-DismissMenu=Rifiutare\u2026
-DisplayedTimerange=Campo data visualizzato
-DoubleWeek=Settimana doppia
-DownloadOfflineDatabase=Volete scaricare il database?
-DragMenu=Drag (config. marker)
-DropMenu=Drop (config. marker)
-EditMenu=Elabora...
-ElapsedTime=Trascorso
-EnableHtmlEditing=Attivare modalit\u00E0 HTML
-EndStatus=Stato finale
-EnterUrlTooltip=Immettere l'URL o inserilo da copia/incolla
-ErrorAndRetryQuestion=Informate il vostro amministratore di sistema.
-ErrorAndWarning=Errore / Avvertimento
-ErrorAndWarningAndMessage=Errori / Avvertimenti / Messaggi
-ErrorCommandFailedQuestion=Volete ignorare questo messaggio e continuare?
-ErrorCommandFailedText=L'azione \u00E8 stata interrotta.
-ErrorOnly=Errore
-ErrorReadingOfflineTable=Errore di lettura della tabella offline
-ErrorReadingOnlineTable=Errore di lettura della tabella server
-ErrorTextLoginOutdated=Password scaduta
-EstimatedEndDate=Terminato
-EstimatedTime=Durata stimata
-ExcelChart_Button_Cancel=Interrompere
-ExcelChart_Button_CancelHint=Interrompere l\u2019esportazione e chiudere.
-ExcelChart_Button_OK=Esportazione
-ExcelChart_Button_OKHint=Avvia l\u2019esportazione.
-ExcelChart_Error_ActivatingWorksheetFailed=l\u2019attivazione del foglio tabella non \u00E8 riuscita.
-ExcelChart_Error_CreatingWorksheetFailed=la creazione del foglio tabelle \u00E8 fallita.
-ExcelChart_Error_FillingChartFailed=il riempimento del diagramma \u00E8 fallito.
-ExcelChart_Error_OpeningChartFailed=l\u2019apertura del diagramma \u00E8 fallita.
-ExcelChart_Error_OpeningWorksheetFailed=l\u2019apertura del foglio tabelle \u00E8 fallita.
-ExcelChart_Error_RetrivingVariableFailed=non \u00E8 stato possibile leggere una variabile.
-ExcelChart_Error_SavingWorkbookFailed=Il salvataggio del documento Excel \u00E8 fallito.
-ExcelChart_Error_UnknownException=si \u00E8 verificato un errore inatteso
-ExcelChart_Various_AveragedLong=Media di tutti i valori che fanno parte dello stesso valore degli assi X
-ExcelChart_Various_FrequencyLong=Frequenza (con che frequenza compare il rispettivo valore degli assi)
-ExcelChart_Various_SummedUpLong=Somma di tutti i valori, che fanno parte dello stesso valore degli assi X
-ExtendedSearchEditEntityMenu=Elabora..
-ExtendedSearchEntityPrefix=ha
-ExtendedSearchEntityPrefixNegated=non ha
-ExtendedSearchSaveButton=Incolla
-FailedDownloadingFile=Non \u00E8 stato possibile scaricare il file
-FailedGettingOfflineTableVerification=Verifica tabella offline fallita
-FailedGettingOnlineTableVerification=Verifica tabella server fallita
-FieldRangeErrorText=Il valore 'da' non deve essere pi\u00F9 grande del valore 'al'.
-FieldRangeErrorTitle=Errore nel settore dei valori
-Fields=Campi
-FilePath=Percorso di file
-FormInactivityTimerActivated=Attivazione del timer inattivit\u00E0
-FormInvalidTextInFields=I seguenti campi hanno dei valori non validi\:
-FormMissingMandatoryFields=I seguenti campi devono essere compilati\:
-FormStateLoadTooltip=Caricare i criteri di ricerca da un file XML
-FormStateStoreTooltip=Salvare i criteri di ricerca in un file XML
-GenericSearch=Ricerca speciale
-GetUrlForm=Indirizzo Web
-HistoryAddColumnMove=sposta la colonna
-HistoryAddSort=ordina in modo
-HistoryAddSortDesc=decrescente
-HistoryBackward=Indietro
-HistoryForward=Prima
-HtmlPluginActionSubmitted=Azione eseguita.
-HtmlPluginChangesSaved=Le modifiche sono state salvate.
-HtmlPluginPendingAction=C'\u00E8 gi\u00E0 una finestra pop-up aperta nell'applicazione. Chiudere prima questa.
-HtmlPopupInfoPanel=Si \u00E8 aperta una finestra pop-up nell'applicazione
-IgnoreCase=Ignorare maiuscole/minuscole
-Informations=Informazioni
-InvolvedPersons=Persone coinvolte
-LastStep=Ultima fase
-LiveEdit=Modifica in tempo reale
-LocalServer=Server locale
-Logging=Registrazione log
-LogicDateIsInGEWeeks=ha luogo al pi\u00F9 presto fra {0} settimane
-LogicDateIsInLEWeeks=ha luogo al pi\u00F9 tardi fra {0} settimane
-LogicDateIsInWeeks=ha luogo precisamente fra {0} settimane
-LoginErrorText=Nome utente / password sbagliati
-LoginErrorTitle=Accesso fallito
-LoginFailed=Accesso fallito
-LoginToApplicationServer=Accesso
-LotusNotesCode=Lotus Notes
-LotusNotesConnectErrorDetail=Controllare se Lotus Notes \u00E8 installato e se le autorizzazioni sono presenti.
-LotusNotesConnectErrorText=Lotus Notes non disponibile.
-LotusNotesErrorDLLDetail=Di regola, il file nlsxbe.dll viene installato con Lotus Notes e si trova nella directory delle installazioni di Lotus Notes. p.es. C\:\\Programme\\lotus\\notes. Per eliminare il problema, assicuratevi che il file sia registrato correttamente (registrazione Windows).
-LotusNotesErrorDLLText=Impossibile trovare il file nlsxbe.dll .
-LotusNotesErrorDatabaseOpenDetail=Questo errore si verifica quando Lotus Notes si trova in modalit\u00E0 Onling (SIKA Network), bench\u00E9 non sussista alcuna connessione al server remoto. Stabilite un collegamento al server oppure commutate LotusNotes in modalit\u00E0 offline. (Island-Mode). IMPORTANTE\: Questo errore si verifica quando Louts Notes \u00E8 stato chiuso in modalit\u00E0 Online. In tal caso, avviate Lotus Notes e commutatelo in modalit\u00E0 Island.
-LotusNotesErrorDatabaseOpenText=La banca dati non \u00E8 disponibile.
-LotusNotesErrorIDFileDetail=Di norma questo errore \u00E8 causato da un dialogo di login aperto di Lotus Notes. Chiudete il dialogo di login e ripetete l\u2019operazione
-LotusNotesErrorIDFileOpenDetail=Le possibili cause sono\:\n 1. Un dialogo di login aperto (in questo caso, il file ID dell\u2019utente \u00E8 bloccato. Terminate l\u2019operazione di login).\n 2. Il file nlsxbe.dll \u00E8 mancante. Di norma questo file si trova nell\u2019elenco principale di Lotus Notes. Verificate che il file sia esistente e che l\u2019elenco principale di Lotus Notes faccia parte del percorso ('Path') delle variabili dell\u2019ambiente.\n 3. Sistema molto sollecitato. Chiudete i programmi non utilizzati e ripetete l\u2019operazione. \n 4. Un\u2019installazione Lotus Notes danneggiata oppure incompleta.\n
-LotusNotesErrorIDFileOpenText=Impossibile aprire il file ID dell'utente.
-LotusNotesErrorIDFileText=Il file ID dell\u2019utente \u00E8 bloccato.
-LotusNotesErrorMailFileDetail=Il file notes.ini si trova nella directory di installazione durante l'esecuzione di Lotus Notes. Affinch\u00E9 l'interfaccia COM (BSI CRM - Lotus Notes) funzioni, notes.ini deve contenere la registrazione "mailFile\=\#\#\#.nsf". \#\#\#.nsf rappresenta il file memorizzato nella banca dati offline delle mail. Informate il vostro amministratore di sistema.
-LotusNotesErrorMailFileText=Manca la registrazione in notes.ini.
-LotusNotesErrorPasswordDetail=Ripetete la procedura oppure rivolgetevi all\u2019amministratore di sistema. (Prestare attenzione alle lettere maiuscole e minuscole della password).
-LotusNotesErrorPasswordText=La password \u00E8 errata
-LotusNotesErrorUnknownDetail=Se dovesse ripetersi ancora questo errore, informate il vostro amministratore di sistema.
-LotusNotesErrorUnknownText=Si \u00E8 verificato un errore sconosciuto.
-LotusNotesErrorVersionCheckDetail=Le possibili cause sono\:\n 1. Un dialogo di login aperto (in questo caso, il file ID dell\u2019utente \u00E8 bloccato. Terminate l\u2019operazione di login).\n 2. Il nlsxbe.dll \u00E8 mancante. Di norma questo file si trova nell\u2019elenco principale di Lotus Notes. Verificate che il file sia esistente e che l\u2019elenco principale di Lotus Notes faccia parte del percorso ('Path') delle variabili dell\u2019ambiente.\n 3. Sistema molto sollecitato. Chiudete i programmi non utilizzati e ripetete l\u2019operazione. \n 4. Un\u2019installazione Lotus Notes danneggiata oppure incompleta.\n
-LotusNotesErrorVersionCheckText=La versione Lotus Notes non \u00E8 stata riconosciuta. (timeout)
-MailDraft=La vostra e-mail si trova nella cartella di allestimento dell\u2019e-mail Client.
-MissingOfflineTable=Tabella offline mancante
-MissingOnlineTable=Tabella server mancante
-MoveCalendarItem=Spostare
-NetworkProxy=Rete / Proxy
-NewBookmarkFolder=Nuova cartella
-NewButton=Nuovo...
-NewMenu=&Nuovo...
-NewSearch=Nuova ricerca
-NewStartDate=Nuova data di avvio
-NextStep=Prossima fase
-NoAuthenticationFound=I dati di login non sono corretti.
-NoRowsFound=Nessun record di dati
-NoViewAvailable=Nessuna visualizzazione disponibile
-OcrEditorImageTool=Seleziona grafico
-OcrEditorTextDialog=Testo OCR
-Offline=Offline
-OfflineAdmin=Amministratore offline
-OfflineDirectory=Directory locale
-OfflineInstallationInvalidMessage=L'installazione offline \u00E8 incompleta
-OfflineInstallationValidMessage=L'installazione offline \u00E8 pronta e funzionante.
-OfflineMasterServer=Server online
-OfflineReplicationInvalidMessage=Impossibile eseguire la replica.
-OfflineSetup=Impostare l'ambiente offline
-OlPrivBody=(Privato)
-OlPrivLocation=(Privato)
-OlPrivSubjectAppointment=Appuntamento privato
-OlPrivSubjectTask=Mansione privata
-OldStartDate=vecchia data avvio
-OpenDate=Data creazione
-OpenMenu=Aprire...
-Operator=Operatore
-Operators=Operatori
-Options=Opzioni
-OutlookSyncStatusInfo=Sincronizzazione Outlook riuscita.\n\nAppuntamenti\: \#APPOINTMENT_NEW\# nuovo \#APPOINTMENT_MODIFY\# aggiornato \#APPOINTMENT_REMOVE\# cancellato \#APPOINTMENT_ERROR\# interrotto\nMansioni\: \#TASK_NEW\# nuovo \#TASK_MODIFY\# aggiornato \#TASK_REMOVE\# cancellato \#TASK_ERROR\# interrotto
-OutputLevel=Livello output
-PasswordChanged=La vostra password \u00E8 stata cambiata.
-PasswordNotChanged=Impossibile cambiare la vostra password.
-PasswordNotReset=Impossibile cambiare la password.
-PasswordReset=La password \u00E8 stata cambiata.
-PasswordViolatesPolicy=La password non corrisponde alle norme prestabilite.
-PasswordWillExpireTodayHeader=La password scade oggi.
-PasswordWrong=Password errata
-PleaseCheckLogfile=Controllare il file di log.
-PleaseCheckOfflineDirectory=Verificare se esiste la directory offline
-Port=Porta
-Programmed=QA
-RepAutoCleanupFailedText=La banca dati locale \u00E8 stata corretta soltanto parzialmente.
-RepAutoCleanupPerformedText=La banca dati locale \u00E8 stata corretta con successo.
-RepDone=Ok
-RepEndDate=Fine
-RepGetServerUpdate=Ricezione dati dal server...\u0085
-RepLastSync=Ultima sincronizzazione\:
-RepNextExtract=Preparazione dati\u0085 in corso\u2026
-RepProgCommit=Conferma
-RepProgExtract=Estrazione
-RepProgSync=Scambio dati
-RepProgUpdate=Aggiornamento
-RepStartDate=Avvio
-Replicate=Replica
-ReplicationStatus=Stato replica
-ReportLayoutTitle=Tipo di report
-ReportNoDataFound=Non esistono dei dati che corrispondono ai criteri inseriti.
-ResetPasswordUserHasNoLoginName=La persona selezionata non ha un nome di login valido.
-ResultOfTableVerification=Risultato della verifica database
-RowCountDifferenceOnTable=Il numero di record non corrisponde
-SC_DialogTitle_UserDictionary=Dizionario utente
-SC_Help_AddWord=Aggiunge la parola al dizionario utente nel campo del testo
-SC_Help_Close=Chiude questo dialogo
-SC_Help_Delete=Cancella la parola evidenziata
-SC_Help_EditUserDictionary=Elaborare il dizionario utente
-SC_Help_MultiLineFields=Campi linee multiple
-SC_Help_SingleLineFields=Campi linee singole
-SC_Help_UseOfficeDictionary=Utilizza il dizionario standard utente di Microsoft Office
-SC_Label_AddWord=Aggiungere parola
-SC_Label_AlwaysCheckAsYouType=Controllare sempre in background
-SC_Label_ApplicationDefault=Applicazioni standard
-SC_Label_CheckAsYouType=Controllo in background
-SC_Label_Close=Chiudere
-SC_Label_Delete=Cancellare
-SC_Label_EditUserDictionary=Elaborare dizionario...
-SC_Label_MultiLineFields=Campi linee multiple
-SC_Label_NeverCheckAsYouType=Mai controllare in background
-SC_Label_Ok=Ok
-SC_Label_SingleLineFields=Campi linee singole
-SC_Label_UseOfficeDictionary=Usare il dizionario MS Office
-SC_Label_Word=Parola
-SC_Language_En=Inglese
-SC_Language_EnCa=Inglese (Canada)
-SC_Language_EnUk=Inglese (Gran Bretagna)
-SC_Language_EnUs=Inglese (Stati Uniti)
-SC_Language_Fr=Francese
-SC_Language_FrCa=Francese (Canada)
-SC_Language_FrFr=Francese (Francia)
-SC_Language_Ge=Tedesco
-SC_Language_GeAt=Tedesco (Austria)
-SC_Language_GeCh=Tedesco (Svizzera)
-SC_Language_GeDe=Tedesco (Germania)
-SC_Language_It=Italiano
-SC_Language_ItIt=Italiano (Italia)
-SC_Language_Sp=Spagnolo
-SC_Language_SpEs=Spagnolo (Spagna)
-SC_Message_UserDictionaryNotFound=Dizionario utente non trovato
-SWUpdateMsg10=Errore backup e installazione di\:
-SWUpdateMsg1=\u00C8 disponibile un aggiornamento software.\nLa versione installata \u00E8 \#VECCHIA\#\nLa nuova versione \u00E8\: \#NUOVA\#
-SWUpdateMsg2=Volete installare ora l'update?
-SWUpdateMsg3a=L'aggiornamento software \u00E8 stato scaricato correttamente.\nL'aggiornamento sar\u00E0 applicato la prossima volta che si avvia l'applicazione.
-SWUpdateMsg4=Rete non disponibile
-SWUpdateMsg5=Richiesta versione server fallita
-SWUpdateMsg6=L'installazione \u00E8 aggiornata.
-SWUpdateMsg7=Aggiornamento software interrotto
-SWUpdateMsg8=Impossibile trovare la directory dei file dell'applicazione\:
-SWUpdateMsg9=Il download dei file della nuova applicazione \u00E8 fallito
-SaveAndLoopback=Loopback e salva
-ScOutlookErrorCache=Il plugin non ha potuto creare la cache.\nLa sincronizzazione di tutto '\#T\#' \u00E8 stata saltata.\nVerificare la configurazione di Outlook.
-ScOutlookErrorGeneral=Il plugin non \u00E8 riuscito a inizializzare Outlook.\nVerificare la configurazione di Outlook.\nSe il problema persiste contattare\nBSI.
-ScOutlookErrorPartial=Il plugin non ha potuto sincronizzare alcuni record di dati.\nNon sono stati elaborati i seguenti record\:\n\#T\#
-ScOutlookErrorTooMany=Troppe voci da visualizzare.
-ScOutlookErrorUnknown=Il plugin ha provocato un errore sconosciuto.\nConsultare il file di registro per ulteriori informazioni.
-ScOutlookTitle=Plugin ScOutlook
-ScoutHome=Dati personali
-SearchButtonPanelTooltip=Avvia la ricerca
-SearchMenu=Ricerca...
-SearchPartial=Ricerca parziale
-SecurityNotAllowed=Il server ha rifiutato la transazione.
-Selected=Selezionato
-SelectionIsEmpty=Selezione \u00E8 vuota
-Servidor_All=Tutto
-ShowAll=Visualizzare tutti
-ShowFileChooser=Dialogo ricerca file
-ShowFileErrorText=Non \u00E8 stato possibile aprire il file \#T\#.
-ShowFileErrorTitle=Visualizza il file
-ShowMore=Visualizzare altro
-Site=Server
-SmartFieldCallSmartDialog=In caso di visualizzazione del campo smart lista di selezione
-SmartFieldInvalidKey=
-SmartFieldTooManyRows=Troppi record. Limitare i criteri di ricerca.
-SpreadsheetPasteWarning1a=Alcune celle sono a sola lettura. In queste celle non \u00E8 possibile scrivere e/o aggiungere elementi.
-SpreadsheetPasteWarning1b=I valori sono stati conseguentemente ignorati.
-StartupPhaseConfig=Caricamento applicazione\u0085\u2026
-StartupPhaseOffline=Preparazione ambiente\u2026
-StartupPhaseUpdate=Ricerca aggiornamenti\u0085\u2026
-StoreColumnWidths=Salva la larghezza di colonna
-TableVerificationCoefficient=Coefficiente di correlazione
-TableVerificationSuccessful=Confronto database completato
-Timeframe=Periodo
-TransferProgressLabel=Ricezione in corso...
-TransferProgressTitle=Trasferimento di dati
-Using=Utilizzato
-Verify=Verifica
-VerifyOfflineEnvironment=Verifica/installa
-VetoErrorTitle=Immissione non valida nel campo di ricerca
-ViewListLabel=Scegli una visualizzazione
-ViewListTitle=Tutte le visualizzazioni
-With=con
-WorkOffline=Lavorare offline
-WorkOfflineInfoText="Per lavorare offline inserire nel campo ""Server"" l'URL del server di applicazione. Di norma si tratta dello stesso URL usato per accedere alla modalit\u00E0 online."
-Workflows=Workflow
-aView=una visione
-someview=una visione
+AccessAuthorization=Autorizzazione del server
+Application=Applicazione
+ApplicationServer=Server di applicazione
+AppointmentProposition=Proposta di scadenza
+AutomaticallyStopAfterFirstFetch=Prendere solo primo record
+BackendCall=Richiamare servizio
+BrowseMenu=Ricerca...
+CTIDialErrorInfo=Verificare il numero di telefono e la connessione al server.
+CTIDialErrorText=Server telefonico non disponibile.
+CTIDialErrorTitle=Telefono
+Calendar_itemCont=(tag)
+Calendar_itemFrom=Dal
+Calendar_itemUntil=al
+CheckFailed=Errore dei dati
+CheckFailedMessage=Vi \u00E8 stato un errore durante la verifica dati.
+Choose=Seleziona
+ComposerAggregationCount=Numero
+ComposerFieldAddAttribute=Aggiungere attributo
+ComposerFieldAggregationNone=N/A
+ConnectionTest_Button_Cancel=Cancellare
+ConnectionTest_Button_CancelHint=Chiudere il modulo.
+ConnectionTest_Button_Refresh=Aggiornare
+ConnectionTest_Label_DBResult=Connessione al database
+ConnectionTest_Label_ServerResult=Connessione al server
+Connection_Test_MainForm=Connessione di prova
+Containing=contenente
+ContinueMenu=Continuare
+CopyPasteHint=Per ulteriori informazioni, premere il pulsante 'copia' e 'incolla' in un editor di testi.
+CouldNotCreateOfflineDirectory=Non \u00E8 possibile creare una directory locale\:
+CouldNotFindOfflineClasses=Non \u00E8 disponibile l'ambiente offline
+CouldNotFindOfflineConfig=Non \u00E8 disponibile la configurazione offline
+CouldNotFindOfflineDatabase=Non \u00E8 stato trovato un database locale
+CouldNotGetApplication=Non \u00E8 stato possibile caricare l'applicazione.
+CouldNotGetApplicationInfo=Non \u00E8 stato possibile caricare la descrizione dell'applicazione.
+CreateTriggers=Creare il trigger
+CurrentLocale=Settore linguistico attuale
+CurrentStep=Fase attuale
+CustomRollback=L'azione \u00E8 stata annullata
+DataLoading=Trasferimento di dati
+DateErrorText=La data '{0}' inserita non \u00E8 valida. Correggere il valore.
+DateErrorTitle=Data non valida
+DismissMenu=Rifiutare\u2026
+DisplayedTimerange=Campo data visualizzato
+DoubleWeek=Settimana doppia
+DownloadOfflineDatabase=Volete scaricare il database?
+DragMenu=Drag (config. marker)
+DropMenu=Drop (config. marker)
+EditMenu=Elabora...
+ElapsedTime=Trascorso
+EnableHtmlEditing=Attivare modalit\u00E0 HTML
+EndStatus=Stato finale
+EnterUrlTooltip=Immettere l'URL o inserilo da copia/incolla
+ErrorAndRetryQuestion=Informate il vostro amministratore di sistema.
+ErrorAndWarning=Errore / Avvertimento
+ErrorAndWarningAndMessage=Errori / Avvertimenti / Messaggi
+ErrorCommandFailedQuestion=Volete ignorare questo messaggio e continuare?
+ErrorCommandFailedText=L'azione \u00E8 stata interrotta.
+ErrorOnly=Errore
+ErrorReadingOfflineTable=Errore di lettura della tabella offline
+ErrorReadingOnlineTable=Errore di lettura della tabella server
+ErrorTextLoginOutdated=Password scaduta
+EstimatedEndDate=Terminato
+EstimatedTime=Durata stimata
+ExcelChart_Button_Cancel=Interrompere
+ExcelChart_Button_CancelHint=Interrompere l\u2019esportazione e chiudere.
+ExcelChart_Button_OK=Esportazione
+ExcelChart_Button_OKHint=Avvia l\u2019esportazione.
+ExcelChart_Error_ActivatingWorksheetFailed=l\u2019attivazione del foglio tabella non \u00E8 riuscita.
+ExcelChart_Error_CreatingWorksheetFailed=la creazione del foglio tabelle \u00E8 fallita.
+ExcelChart_Error_FillingChartFailed=il riempimento del diagramma \u00E8 fallito.
+ExcelChart_Error_OpeningChartFailed=l\u2019apertura del diagramma \u00E8 fallita.
+ExcelChart_Error_OpeningWorksheetFailed=l\u2019apertura del foglio tabelle \u00E8 fallita.
+ExcelChart_Error_RetrivingVariableFailed=non \u00E8 stato possibile leggere una variabile.
+ExcelChart_Error_SavingWorkbookFailed=Il salvataggio del documento Excel \u00E8 fallito.
+ExcelChart_Error_UnknownException=si \u00E8 verificato un errore inatteso
+ExcelChart_Various_AveragedLong=Media di tutti i valori che fanno parte dello stesso valore degli assi X
+ExcelChart_Various_FrequencyLong=Frequenza (con che frequenza compare il rispettivo valore degli assi)
+ExcelChart_Various_SummedUpLong=Somma di tutti i valori, che fanno parte dello stesso valore degli assi X
+ExtendedSearchEditEntityMenu=Elabora..
+ExtendedSearchEntityPrefix=ha
+ExtendedSearchEntityPrefixNegated=non ha
+ExtendedSearchSaveButton=Incolla
+FailedDownloadingFile=Non \u00E8 stato possibile scaricare il file
+FailedGettingOfflineTableVerification=Verifica tabella offline fallita
+FailedGettingOnlineTableVerification=Verifica tabella server fallita
+FieldRangeErrorText=Il valore 'da' non deve essere pi\u00F9 grande del valore 'al'.
+FieldRangeErrorTitle=Errore nel settore dei valori
+Fields=Campi
+FilePath=Percorso di file
+FormInactivityTimerActivated=Attivazione del timer inattivit\u00E0
+FormInvalidTextInFields=I seguenti campi hanno dei valori non validi\:
+FormMissingMandatoryFields=I seguenti campi devono essere compilati\:
+FormStateLoadTooltip=Caricare i criteri di ricerca da un file XML
+FormStateStoreTooltip=Salvare i criteri di ricerca in un file XML
+GenericSearch=Ricerca speciale
+GetUrlForm=Indirizzo Web
+HistoryAddColumnMove=sposta la colonna
+HistoryAddSort=ordina in modo
+HistoryAddSortDesc=decrescente
+HistoryBackward=Indietro
+HistoryForward=Prima
+HtmlPluginActionSubmitted=Azione eseguita.
+HtmlPluginChangesSaved=Le modifiche sono state salvate.
+HtmlPluginPendingAction=C'\u00E8 gi\u00E0 una finestra pop-up aperta nell'applicazione. Chiudere prima questa.
+HtmlPopupInfoPanel=Si \u00E8 aperta una finestra pop-up nell'applicazione
+IgnoreCase=Ignorare maiuscole/minuscole
+Informations=Informazioni
+InvolvedPersons=Persone coinvolte
+LastStep=Ultima fase
+LiveEdit=Modifica in tempo reale
+LocalServer=Server locale
+Logging=Registrazione log
+LogicDateIsInGEWeeks=ha luogo al pi\u00F9 presto fra {0} settimane
+LogicDateIsInLEWeeks=ha luogo al pi\u00F9 tardi fra {0} settimane
+LogicDateIsInWeeks=ha luogo precisamente fra {0} settimane
+LoginErrorText=Nome utente / password sbagliati
+LoginErrorTitle=Accesso fallito
+LoginFailed=Accesso fallito
+LoginToApplicationServer=Accesso
+LotusNotesCode=Lotus Notes
+LotusNotesConnectErrorDetail=Controllare se Lotus Notes \u00E8 installato e se le autorizzazioni sono presenti.
+LotusNotesConnectErrorText=Lotus Notes non disponibile.
+LotusNotesErrorDLLDetail=Di regola, il file nlsxbe.dll viene installato con Lotus Notes e si trova nella directory delle installazioni di Lotus Notes. p.es. C\:\\Programme\\lotus\\notes. Per eliminare il problema, assicuratevi che il file sia registrato correttamente (registrazione Windows).
+LotusNotesErrorDLLText=Impossibile trovare il file nlsxbe.dll .
+LotusNotesErrorDatabaseOpenDetail=Questo errore si verifica quando Lotus Notes si trova in modalit\u00E0 Onling (SIKA Network), bench\u00E9 non sussista alcuna connessione al server remoto. Stabilite un collegamento al server oppure commutate LotusNotes in modalit\u00E0 offline. (Island-Mode). IMPORTANTE\: Questo errore si verifica quando Louts Notes \u00E8 stato chiuso in modalit\u00E0 Online. In tal caso, avviate Lotus Notes e commutatelo in modalit\u00E0 Island.
+LotusNotesErrorDatabaseOpenText=La banca dati non \u00E8 disponibile.
+LotusNotesErrorIDFileDetail=Di norma questo errore \u00E8 causato da un dialogo di login aperto di Lotus Notes. Chiudete il dialogo di login e ripetete l\u2019operazione
+LotusNotesErrorIDFileOpenDetail=Le possibili cause sono\:\n 1. Un dialogo di login aperto (in questo caso, il file ID dell\u2019utente \u00E8 bloccato. Terminate l\u2019operazione di login).\n 2. Il file nlsxbe.dll \u00E8 mancante. Di norma questo file si trova nell\u2019elenco principale di Lotus Notes. Verificate che il file sia esistente e che l\u2019elenco principale di Lotus Notes faccia parte del percorso ('Path') delle variabili dell\u2019ambiente.\n 3. Sistema molto sollecitato. Chiudete i programmi non utilizzati e ripetete l\u2019operazione. \n 4. Un\u2019installazione Lotus Notes danneggiata oppure incompleta.\n
+LotusNotesErrorIDFileOpenText=Impossibile aprire il file ID dell'utente.
+LotusNotesErrorIDFileText=Il file ID dell\u2019utente \u00E8 bloccato.
+LotusNotesErrorMailFileDetail=Il file notes.ini si trova nella directory di installazione durante l'esecuzione di Lotus Notes. Affinch\u00E9 l'interfaccia COM (BSI CRM - Lotus Notes) funzioni, notes.ini deve contenere la registrazione "mailFile\=\#\#\#.nsf". \#\#\#.nsf rappresenta il file memorizzato nella banca dati offline delle mail. Informate il vostro amministratore di sistema.
+LotusNotesErrorMailFileText=Manca la registrazione in notes.ini.
+LotusNotesErrorPasswordDetail=Ripetete la procedura oppure rivolgetevi all\u2019amministratore di sistema. (Prestare attenzione alle lettere maiuscole e minuscole della password).
+LotusNotesErrorPasswordText=La password \u00E8 errata
+LotusNotesErrorUnknownDetail=Se dovesse ripetersi ancora questo errore, informate il vostro amministratore di sistema.
+LotusNotesErrorUnknownText=Si \u00E8 verificato un errore sconosciuto.
+LotusNotesErrorVersionCheckDetail=Le possibili cause sono\:\n 1. Un dialogo di login aperto (in questo caso, il file ID dell\u2019utente \u00E8 bloccato. Terminate l\u2019operazione di login).\n 2. Il nlsxbe.dll \u00E8 mancante. Di norma questo file si trova nell\u2019elenco principale di Lotus Notes. Verificate che il file sia esistente e che l\u2019elenco principale di Lotus Notes faccia parte del percorso ('Path') delle variabili dell\u2019ambiente.\n 3. Sistema molto sollecitato. Chiudete i programmi non utilizzati e ripetete l\u2019operazione. \n 4. Un\u2019installazione Lotus Notes danneggiata oppure incompleta.\n
+LotusNotesErrorVersionCheckText=La versione Lotus Notes non \u00E8 stata riconosciuta. (timeout)
+MailDraft=La vostra e-mail si trova nella cartella di allestimento dell\u2019e-mail Client.
+MissingOfflineTable=Tabella offline mancante
+MissingOnlineTable=Tabella server mancante
+MoveCalendarItem=Spostare
+NetworkProxy=Rete / Proxy
+NewBookmarkFolder=Nuova cartella
+NewButton=Nuovo...
+NewMenu=&Nuovo...
+NewSearch=Nuova ricerca
+NewStartDate=Nuova data di avvio
+NextStep=Prossima fase
+NoAuthenticationFound=I dati di login non sono corretti.
+NoRowsFound=Nessun record di dati
+NoViewAvailable=Nessuna visualizzazione disponibile
+OcrEditorImageTool=Seleziona grafico
+OcrEditorTextDialog=Testo OCR
+Offline=Offline
+OfflineAdmin=Amministratore offline
+OfflineDirectory=Directory locale
+OfflineInstallationInvalidMessage=L'installazione offline \u00E8 incompleta
+OfflineInstallationValidMessage=L'installazione offline \u00E8 pronta e funzionante.
+OfflineMasterServer=Server online
+OfflineReplicationInvalidMessage=Impossibile eseguire la replica.
+OfflineSetup=Impostare l'ambiente offline
+OlPrivBody=(Privato)
+OlPrivLocation=(Privato)
+OlPrivSubjectAppointment=Appuntamento privato
+OlPrivSubjectTask=Mansione privata
+OldStartDate=vecchia data avvio
+OpenDate=Data creazione
+OpenMenu=Aprire...
+Operator=Operatore
+Operators=Operatori
+Options=Opzioni
+OutlookSyncStatusInfo=Sincronizzazione Outlook riuscita.\n\nAppuntamenti\: \#APPOINTMENT_NEW\# nuovo \#APPOINTMENT_MODIFY\# aggiornato \#APPOINTMENT_REMOVE\# cancellato \#APPOINTMENT_ERROR\# interrotto\nMansioni\: \#TASK_NEW\# nuovo \#TASK_MODIFY\# aggiornato \#TASK_REMOVE\# cancellato \#TASK_ERROR\# interrotto
+OutputLevel=Livello output
+PasswordChanged=La vostra password \u00E8 stata cambiata.
+PasswordNotChanged=Impossibile cambiare la vostra password.
+PasswordNotReset=Impossibile cambiare la password.
+PasswordReset=La password \u00E8 stata cambiata.
+PasswordViolatesPolicy=La password non corrisponde alle norme prestabilite.
+PasswordWillExpireTodayHeader=La password scade oggi.
+PasswordWrong=Password errata
+PleaseCheckLogfile=Controllare il file di log.
+PleaseCheckOfflineDirectory=Verificare se esiste la directory offline
+Port=Porta
+Programmed=QA
+RepAutoCleanupFailedText=La banca dati locale \u00E8 stata corretta soltanto parzialmente.
+RepAutoCleanupPerformedText=La banca dati locale \u00E8 stata corretta con successo.
+RepDone=Ok
+RepEndDate=Fine
+RepGetServerUpdate=Ricezione dati dal server...\u0085
+RepLastSync=Ultima sincronizzazione\:
+RepNextExtract=Preparazione dati\u0085 in corso\u2026
+RepProgCommit=Conferma
+RepProgExtract=Estrazione
+RepProgSync=Scambio dati
+RepProgUpdate=Aggiornamento
+RepStartDate=Avvio
+Replicate=Replica
+ReplicationStatus=Stato replica
+ReportLayoutTitle=Tipo di report
+ReportNoDataFound=Non esistono dei dati che corrispondono ai criteri inseriti.
+ResetPasswordUserHasNoLoginName=La persona selezionata non ha un nome di login valido.
+ResultOfTableVerification=Risultato della verifica database
+RowCountDifferenceOnTable=Il numero di record non corrisponde
+SC_DialogTitle_UserDictionary=Dizionario utente
+SC_Help_AddWord=Aggiunge la parola al dizionario utente nel campo del testo
+SC_Help_Close=Chiude questo dialogo
+SC_Help_Delete=Cancella la parola evidenziata
+SC_Help_EditUserDictionary=Elaborare il dizionario utente
+SC_Help_MultiLineFields=Campi linee multiple
+SC_Help_SingleLineFields=Campi linee singole
+SC_Help_UseOfficeDictionary=Utilizza il dizionario standard utente di Microsoft Office
+SC_Label_AddWord=Aggiungere parola
+SC_Label_AlwaysCheckAsYouType=Controllare sempre in background
+SC_Label_ApplicationDefault=Applicazioni standard
+SC_Label_CheckAsYouType=Controllo in background
+SC_Label_Close=Chiudere
+SC_Label_Delete=Cancellare
+SC_Label_EditUserDictionary=Elaborare dizionario...
+SC_Label_MultiLineFields=Campi linee multiple
+SC_Label_NeverCheckAsYouType=Mai controllare in background
+SC_Label_Ok=Ok
+SC_Label_SingleLineFields=Campi linee singole
+SC_Label_UseOfficeDictionary=Usare il dizionario MS Office
+SC_Label_Word=Parola
+SC_Language_En=Inglese
+SC_Language_EnCa=Inglese (Canada)
+SC_Language_EnUk=Inglese (Gran Bretagna)
+SC_Language_EnUs=Inglese (Stati Uniti)
+SC_Language_Fr=Francese
+SC_Language_FrCa=Francese (Canada)
+SC_Language_FrFr=Francese (Francia)
+SC_Language_Ge=Tedesco
+SC_Language_GeAt=Tedesco (Austria)
+SC_Language_GeCh=Tedesco (Svizzera)
+SC_Language_GeDe=Tedesco (Germania)
+SC_Language_It=Italiano
+SC_Language_ItIt=Italiano (Italia)
+SC_Language_Sp=Spagnolo
+SC_Language_SpEs=Spagnolo (Spagna)
+SC_Message_UserDictionaryNotFound=Dizionario utente non trovato
+SWUpdateMsg10=Errore backup e installazione di\:
+SWUpdateMsg1=\u00C8 disponibile un aggiornamento software.\nLa versione installata \u00E8 \#VECCHIA\#\nLa nuova versione \u00E8\: \#NUOVA\#
+SWUpdateMsg2=Volete installare ora l'update?
+SWUpdateMsg3a=L'aggiornamento software \u00E8 stato scaricato correttamente.\nL'aggiornamento sar\u00E0 applicato la prossima volta che si avvia l'applicazione.
+SWUpdateMsg4=Rete non disponibile
+SWUpdateMsg5=Richiesta versione server fallita
+SWUpdateMsg6=L'installazione \u00E8 aggiornata.
+SWUpdateMsg7=Aggiornamento software interrotto
+SWUpdateMsg8=Impossibile trovare la directory dei file dell'applicazione\:
+SWUpdateMsg9=Il download dei file della nuova applicazione \u00E8 fallito
+SaveAndLoopback=Loopback e salva
+ScOutlookErrorCache=Il plugin non ha potuto creare la cache.\nLa sincronizzazione di tutto '\#T\#' \u00E8 stata saltata.\nVerificare la configurazione di Outlook.
+ScOutlookErrorGeneral=Il plugin non \u00E8 riuscito a inizializzare Outlook.\nVerificare la configurazione di Outlook.\nSe il problema persiste contattare\nBSI.
+ScOutlookErrorPartial=Il plugin non ha potuto sincronizzare alcuni record di dati.\nNon sono stati elaborati i seguenti record\:\n\#T\#
+ScOutlookErrorTooMany=Troppe voci da visualizzare.
+ScOutlookErrorUnknown=Il plugin ha provocato un errore sconosciuto.\nConsultare il file di registro per ulteriori informazioni.
+ScOutlookTitle=Plugin ScOutlook
+ScoutHome=Dati personali
+SearchButtonPanelTooltip=Avvia la ricerca
+SearchMenu=Ricerca...
+SearchPartial=Ricerca parziale
+SecurityNotAllowed=Il server ha rifiutato la transazione.
+Selected=Selezionato
+SelectionIsEmpty=Selezione \u00E8 vuota
+Servidor_All=Tutto
+ShowAll=Visualizzare tutti
+ShowFileChooser=Dialogo ricerca file
+ShowFileErrorText=Non \u00E8 stato possibile aprire il file \#T\#.
+ShowFileErrorTitle=Visualizza il file
+ShowMore=Visualizzare altro
+Site=Server
+SmartFieldCallSmartDialog=In caso di visualizzazione del campo smart lista di selezione
+SmartFieldInvalidKey=
+SmartFieldTooManyRows=Troppi record. Limitare i criteri di ricerca.
+SpreadsheetPasteWarning1a=Alcune celle sono a sola lettura. In queste celle non \u00E8 possibile scrivere e/o aggiungere elementi.
+SpreadsheetPasteWarning1b=I valori sono stati conseguentemente ignorati.
+StartupPhaseConfig=Caricamento applicazione\u0085\u2026
+StartupPhaseOffline=Preparazione ambiente\u2026
+StartupPhaseUpdate=Ricerca aggiornamenti\u0085\u2026
+StoreColumnWidths=Salva la larghezza di colonna
+TableVerificationCoefficient=Coefficiente di correlazione
+TableVerificationSuccessful=Confronto database completato
+Timeframe=Periodo
+TransferProgressLabel=Ricezione in corso...
+TransferProgressTitle=Trasferimento di dati
+Using=Utilizzato
+Verify=Verifica
+VerifyOfflineEnvironment=Verifica/installa
+VetoErrorTitle=Immissione non valida nel campo di ricerca
+ViewListLabel=Scegli una visualizzazione
+ViewListTitle=Tutte le visualizzazioni
+With=con
+WorkOffline=Lavorare offline
+WorkOfflineInfoText="Per lavorare offline inserire nel campo ""Server"" l'URL del server di applicazione. Di norma si tratta dello stesso URL usato per accedere alla modalit\u00E0 online."
+Workflows=Workflow
+aView=una visione
+someview=una visione
diff --git a/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_ja.properties b/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_ja.properties
index 6c6ed95ee4..792613b424 100644
--- a/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_ja.properties
+++ b/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_ja.properties
@@ -1,165 +1,165 @@
-AccessAuthorization=\u30B5\u30FC\u30D0\u30FC\u3092\u8A31\u53EF\u3059\u308B
-Application=\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3
-ApplicationServer=\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u30B5\u30FC\u30D0\u30FC
-AutomaticallyStopAfterFirstFetch=\u6700\u521D\u306E\u884C\u306E\u307F\u6301\u3063\u3066\u304F\u308B
-BrowseMenu=\u30B5\u30FC\u30C1
-CTIDialErrorInfo=\u96FB\u8A71\u756A\u53F7\u3092\u70B9\u691C\u3059\u308B
-CTIDialErrorText=\u30C6\u30EC\u30D5\u30A9\u30F3\u30B5\u30FC\u30D0\u30FC\u306B\u3064\u306A\u304C\u308A\u307E\u305B\u3093
-CTIDialErrorTitle=\u96FB\u8A71
-Calendar_itemCont=\u7D99\u7D9A
-Calendar_itemFrom=\u304B\u3089
-Calendar_itemUntil=\u307E\u3067
-CheckFailed=\u30C7\u30FC\u30BF\u9593\u9055\u3044
-CheckFailedMessage=\u30C7\u30FC\u30BF\u30FC\u30C1\u30A7\u30C3\u30AF\u30A8\u30E9\u30FC
-Containing=\u542B\u3080
-CopyPasteHint=\u3053\u308C\u4EE5\u4E0A\u306E\u30A4\u30F3\u30D5\u30A9\u30E1\u30FC\u30B7\u30E7\u30F3\u306F\u30B3\u30D4\u30FC\u30DC\u30BF\u30F3\u3092\u62BC\u3057\u3066\u304F\u3060\u3055\u3044
-CouldNotCreateOfflineDirectory=\u30D5\u30A9\u30EB\u30C0\u30FC\u3092\u8A2D\u7F6E\u3067\u304D\u307E\u305B\u3093
-CouldNotFindOfflineClasses=\u30AA\u30D5\u30E9\u30A4\u30F3\u3067\u306F\u30B9\u30BF\u30FC\u30C8\u3067\u304D\u307E\u305B\u3093
-CouldNotFindOfflineConfig=\u30AA\u30D5\u30E9\u30A4\u30F3\u3067\u306F\u30B9\u30BF\u30FC\u30C8\u3067\u304D\u307E\u305B\u3093
-CouldNotFindOfflineDatabase=\u30AA\u30D5\u30E9\u30A4\u30F3\u3067\u306F\u30B9\u30BF\u30FC\u30C8\u3067\u304D\u307E\u305B\u3093
-CouldNotGetApplication=\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u3092\u30ED\u30FC\u30C9\u3067\u304D\u307E\u305B\u3093
-CouldNotGetApplicationInfo=\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u30A4\u30F3\u30D5\u30A9\u30E1\u30FC\u30B7\u30E7\u30F3\u3092\u30ED\u30FC\u30C9\u3067\u304D\u307E\u305B\u3093
-CreateTriggers=\u30C8\u30EA\u30AC\u30FC\u3092\u8A2D\u7F6E\u3059\u308B
-CurrentLocale=\u73FE\u5728\u306E\u8A00\u8A9E
-CustomRollback=\u6D3B\u52D5\u304C\u4E2D\u6B62\u3055\u308C\u307E\u3057\u305F
-DataLoading=\u30C7\u30FC\u30BF\u30ED\u30FC\u30C9
-DateErrorText=\u65E5\u4ED8\u304C\u9055\u3044\u307E\u3059\u3002\u6B63\u3057\u3044\u65E5\u4ED8\u3092\u66F8\u3044\u3066\u304F\u3060\u3055\u3044
-DateErrorTitle=\u65E5\u4ED8\u306E\u9593\u9055\u3044
-DownloadOfflineDatabase=\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u3092\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9\u3057\u307E\u3059\u304B\uFF1F
-EditMenu=\u51E6\u7406\u3059\u308B
-ElapsedTime=\u4F7F\u7528\u6642\u9593
-EnableHtmlEditing=HTML\u30E2\u30FC\u30C9\u3092\u6D3B\u52D5\u3055\u305B\u308B
-EndStatus=\u6700\u7D42\u72B6\u6CC1
-EnterUrlTooltip=URL\u3092\u66F8\u304D\u8FBC\u3093\u3067\u304F\u3060\u3055\u3044
-ErrorAndRetryQuestion=\u30B3\u30F3\u30D4\u30E5\u30FC\u30BF\u30FC\u7BA1\u7406\u4EBA\u306B\u5831\u544A\u3057\u3066\u304F\u3060\u3055\u3044
-ErrorAndWarning=\u30A8\u30E9\u30FC/\u8B66\u544A
-ErrorAndWarningAndMessage=\u30A8\u30E9\u30FC/\u8B66\u544A/\u30E1\u30C3\u30BB\u30FC\u30B8
-ErrorCommandFailedQuestion=\u30A8\u30E9\u30FC\u3092\u7121\u8996\u3057\u5148\u3078\u9032\u307F\u307E\u3059\u304B\uFF1F
-ErrorCommandFailedText=\u6D3B\u52D5\u304C\u4E2D\u6B62\u3055\u308C\u307E\u3057\u305F
-ErrorOnly=\u9593\u9055\u3044
-ErrorReadingOfflineTable=\u30AA\u30D5\u30E9\u30A4\u30F3\u30C6\u30FC\u30D6\u30EB\u306E\u8AAD\u307F\u8FBC\u307F\u30A8\u30E9\u30FC
-ErrorReadingOnlineTable=\u30B5\u30FC\u30D0\u30FC\u30C6\u30FC\u30D6\u30EB\u306E\u8AAD\u307F\u8FBC\u307F\u30A8\u30E9\u30FC
-EstimatedEndDate=\u7D42\u4E86\u3059\u308B
-EstimatedTime=\u4E88\u6E2C\u6642\u9593
-ExtendedSearchEntityPrefix=\u6301\u3064
-ExtendedSearchEntityPrefixNegated=\u6301\u3063\u3066\u306A\u3044
-ExtendedSearchSaveButton=\u6DFB\u4ED8\u3059\u308B
-FailedDownloadingFile=\u30C7\u30FC\u30BF\u3092\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9\u3067\u304D\u307E\u305B\u3093
-FailedGettingOfflineTableVerification=\u30AA\u30D5\u30E9\u30A4\u30F3\u30C6\u30FC\u30D6\u30EB\u306E\u691C\u8A3C\u304C\u3067\u304D\u307E\u305B\u3093
-FailedGettingOnlineTableVerification=\u30B5\u30FC\u30D0\u30FC\u30C6\u30FC\u30D6\u30EB\u306E\u691C\u8A3C\u304C\u3067\u304D\u307E\u305B\u3093
-Field=\u9818\u57DF
-FieldRangeErrorText=\u6570\u9818\u57DF\u306E\u30A8\u30E9\u30FC
-FieldRangeErrorTitle=\u6570\u9818\u57DF\u306E\u30A8\u30E9\u30FC
-Fields=\u9818\u57DF
-FilePath=\u30D5\u30A1\u30A4\u30EB
-FormInvalidTextInFields=\u4EE5\u4E0B\u306E\u9818\u57DF\u306B\u8AA4\u308A\u304C\u3042\u308A\u307E\u3059
-FormMissingMandatoryFields=\u4EE5\u4E0B\u306E\u9818\u57DF\u306E\u7A7A\u6B04\u3092\u57CB\u3081\u3066\u304F\u3060\u3055\u3044
-GenericSearch=\u30B9\u30DA\u30B7\u30E3\u30EB\u30B5\u30FC\u30C1
-GetUrlForm=\u30A6\u30A7\u30D6\u30A2\u30C9\u30EC\u30B9
-HtmlPluginActionSubmitted=\u6D3B\u52D5\u3092\u5B9F\u884C\u3057\u307E\u3057\u305F
-HtmlPluginChangesSaved=\u4FEE\u6B63\u3092\u4FDD\u5B58\u3057\u307E\u3057\u305F
-HtmlPluginPendingAction=\u3059\u3067\u306BPop-up\u30B9\u30AF\u30EA\u30FC\u30F3\u304C\u958B\u304B\u308C\u3066\u3044\u307E\u3059\u3002\u5148\u306B\u3053\u308C\u3092\u9589\u3058\u3066\u4E0B\u3055\u3044
-HtmlPopupInfoPanel=Pop-up\u30B9\u30AF\u30EA\u30FC\u30F3\u3092\u958B\u304D\u307E\u3057\u305F
-IgnoreCase=\u7121\u8996\u3000\u5927/\u5C0F
-Informations=\u30A4\u30F3\u30D5\u30A9\u30E1\u30FC\u30B7\u30E7\u30F3
-JavaVM=\u30B8\u30E3\u30F4\u30A1
-LiveEdit=\u30E9\u30A4\u30F4\u4F5C\u6210
-LocalServer=\u30ED\u30FC\u30AB\u30EB\u30B5\u30FC\u30D0\u30FC
-Logging=\u8A18\u9332\u3059\u308B
-LoginFailed=\u30ED\u30B0\u30A4\u30F3\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F
-LoginToApplicationServer=\u30ED\u30B0\u30A4\u30F3
-MissingOfflineTable=\u30AA\u30D5\u30E9\u30A4\u30F3\u30C6\u30FC\u30D6\u30EB\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093
-MissingOnlineTable=\u30B5\u30FC\u30D0\u30FC\u30C6\u30FC\u30D6\u30EB\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093
-NetworkProxy=\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\uFF0F\u30D7\u30ED\u30AD\u30B7\u30FC
-NewMenu=\u65B0\u3057\u3044
-NewSearch=\u30CB\u30E5\u30FC\u30B5\u30FC\u30C1
-NoAuthenticationFound=\u7533\u544A\u30C7\u30FC\u30BF\u304C\u6B63\u3057\u304F\u3042\u308A\u307E\u305B\u3093
-NoRowsFound=\u30C7\u30FC\u30BF\u6587\u7AE0\u304C\u3042\u308A\u307E\u305B\u3093
-NoViewAvailable=\u30DA\u30FC\u30B8\u304C\u3042\u308A\u307E\u305B\u3093
-Offline=\u30AA\u30D5\u30E9\u30A4\u30F3
-OfflineAdmin=\u30AA\u30D5\u30E9\u30A4\u30F3\u7BA1\u7406\u4EBA
-OfflineDirectory=\u30ED\u30FC\u30AB\u30EB\u4E00\u89A7\u8868
-OfflineInstallationInvalidMessage=\u3053\u306E\u30AA\u30D5\u30E9\u30A4\u30F3\u306E\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB\u306F\u4E0D\u5B8C\u5168\u3067\u3059
-OfflineInstallationValidMessage=\u3053\u306E\u30AA\u30D5\u30E9\u30A4\u30F3\u306F\u6B63\u3057\u304F\u6A5F\u80FD\u3057\u3066\u3044\u307E\u3059
-OfflineMasterServer=\u30AA\u30F3\u30E9\u30A4\u30F3\u30B5\u30FC\u30D0\u30FC
-OfflineReplicationInvalidMessage=\u3053\u306E\u30EC\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u306F\u5B9F\u884C\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F
-OfflineSetup=\u30AA\u30D5\u30E9\u30A4\u30F3\u3092\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u3057\u3066\u304F\u3060\u3055\u3044
-Operator=\u30AA\u30DA\u30EC\u30FC\u30BF\u30FC
-Operators=\u30AA\u30DA\u30EC\u30FC\u30BF\u30FC
-Options=\u30BB\u30C3\u30C6\u30A3\u30F3\u30B0
-OutlookSyncStatusInfo=\u30A2\u30A6\u30C8\u30EB\u30C3\u30AF\u30B7\u30F3\u30AF\u30ED\u306F\u6210\u529F\u3057\u307E\u3057\u305F
-OutputLevel=\u30A2\u30A6\u30C8\u30D7\u30C3\u30C8\u30EC\u30D9\u30EB
-PasswordChanged=\u3042\u306A\u305F\u306E\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u5909\u66F4\u3057\u307E\u3057\u305F
-PasswordNotChanged=\u3042\u306A\u305F\u306E\u30D1\u30B9\u30EF\u30FC\u30C9\u306F\u5909\u66F4\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F
-PasswordNotReset=\u3053\u306E\u30D1\u30B9\u30EF\u30FC\u30C9\u306F\u5909\u66F4\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F
-PasswordReset=\u3053\u306E\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u5909\u66F4\u3057\u307E\u3057\u305F
-PasswordWrong=\u30D1\u30B9\u30EF\u30FC\u30C9\u304C\u9055\u3044\u307E\u3059
-PleaseCheckLogfile=\u30ED\u30B0\u30D5\u30A1\u30A4\u30EB\u3092\u70B9\u691C\u3057\u3066\u304F\u3060\u3055\u3044
-PleaseCheckOfflineDirectory=\u30AA\u30D5\u30E9\u30A4\u30F3\u4E00\u89A7\u3092\u70B9\u691C\u3057\u3066\u304F\u3060\u3055\u3044
-Port=Port
-Programmed=\u30D7\u30ED\u30B0\u30E9\u30DE\u30FC
-RepAutoCleanupFailedText=\u30ED\u30FC\u30AB\u30EB\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u304C\u4E0D\u5B8C\u5168\u3067\u3059
-RepAutoCleanupPerformedText=\u30ED\u30FC\u30AB\u30EB\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u306F\u51E6\u7406\u3055\u308C\u307E\u3057\u305F
-RepDone=\u6B21\u3078
-RepEndDate=\u7D42\u4E86\u3059\u308B
-RepGetServerUpdate=\u30B5\u30FC\u30D0\u30FC\u304B\u3089\u30C7\u30FC\u30BF\u3092\u53D7\u3051\u4ED8\u3051\u307E\u3059
-RepNextExtract=\u30C7\u30FC\u30BF\u306F\u518D\u751F\u3055\u308C\u307E\u3057\u305F
-RepProgCommit=\u78BA\u8A8D
-RepProgExtract=\u8981\u70B9
-RepProgSync=\u30C7\u30FC\u30BF\u4EA4\u63DB
-RepProgUpdate=\u30A2\u30C3\u30D7\u30C7\u30FC\u30C8
-RepStartDate=\u30B9\u30BF\u30FC\u30C8
-Replicate=\u8907\u88FD
-ReplicationStatus=\u72B6\u6CC1\u3092\u8907\u88FD\u3059\u308B
-ReportLayoutTitle=\u30EC\u30DD\u30FC\u30C8\u30BF\u30A4\u30D7
-ReportNoDataFound=\u304A\u63A2\u3057\u306E\u30C7\u30FC\u30BF\u306F\u5B58\u5728\u3057\u307E\u305B\u3093
-ResetPasswordUserHasNoLoginName=\u9078\u3070\u308C\u305F\u4EBA\u7269\u306F\u30ED\u30B0\u30A4\u30F3\u540D\u306B\u5B58\u5728\u3057\u307E\u305B\u3093
-ResultOfTableVerification=\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u306E\u30C1\u30A7\u30C3\u30AF\u306E\u7D50\u679C
-Row=\u30C7\u30FC\u30BF\u6587\u7AE0
-RowCountDifferenceOnTable=\u30C7\u30FC\u30BF\u6587\u7AE0\u6570\u304C\u4E00\u81F4\u3057\u307E\u305B\u3093
-Rows=\u30C7\u30FC\u30BF\u6587\u7AE0
-SWUpdateMsg10=\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB\u3068\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u306E\u30A8\u30E9\u30FC
-SWUpdateMsg1=\u30BD\u30D5\u30C8\u30A6\u30A7\u30A2\u30FC\u306E\u30A2\u30C3\u30D7\u30C7\u30FC\u30C8\u3092\u4EFB\u610F\u306B\u51E6\u7406\u3057\u307E\u3057\u305F\u3000
-SWUpdateMsg2=\u30BD\u30D5\u30C8\u30A6\u30A7\u30A2\u30FC\u306E\u30A2\u30C3\u30D7\u30C7\u30FC\u30C8\u3092\u3057\u307E\u3059\u304B
-SWUpdateMsg3a=\u30BD\u30D5\u30C8\u30A6\u30A7\u30A2\u30FC\u306E\u30A2\u30C3\u30D7\u30C7\u30FC\u30C8\u306E\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9\u304C\u53EF\u80FD\u3067\u3059
-SWUpdateMsg4=\u30B5\u30FC\u30D0\u30FC\u306B\u4F7F\u7528\u3067\u304D\u308B\u63A5\u7D9A\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u304C\u3042\u308A\u307E\u305B\u3093
-SWUpdateMsg5=\u30B5\u30FC\u30D0\u30FC\u306E\u5F62\u5F0F\u3092\u7167\u4F1A\u3067\u304D\u307E\u305B\u3093
-SWUpdateMsg6=\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB\u306F\u65B0\u3057\u304F\u7ACB\u3061\u4E0A\u304C\u308A\u307E\u3057\u305F
-SWUpdateMsg7=\u30BD\u30D5\u30C8\u30A6\u30A7\u30A2\u30FC\u306E\u30A2\u30C3\u30D7\u30C7\u30FC\u30C8\u3092\u4E2D\u6B62\u3057\u307E\u3059
-SWUpdateMsg8=\u30D5\u30A1\u30A4\u30EB\u306E\u4E00\u89A7\u8868\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093
-SWUpdateMsg9=\u30B5\u30FC\u30D0\u30FC\u304B\u3089\u306E\u65B0\u898F\u30D5\u30A1\u30A4\u30EB\u306E\u9069\u7528\u304C\u3067\u304D\u307E\u305B\u3093
-SaveAndLoopback=\u30EB\u30FC\u30D7\u30D0\u30C3\u30AF\u3068\u4FDD\u5B58
-ScOutlookErrorCache=\u30A2\u30A6\u30C8\u30EB\u30C3\u30AF\u30B7\u30F3\u30AF\u30ED\u304C\u4F5C\u52D5\u3057\u307E\u305B\u3093
-ScOutlookErrorGeneral=\u30A2\u30A6\u30C8\u30EB\u30C3\u30AF\u30B7\u30F3\u30AF\u30ED\u304C\u4F5C\u52D5\u3057\u307E\u305B\u3093
-ScOutlookErrorPartial=\u30A2\u30A6\u30C8\u30EB\u30C3\u30AF\u30B7\u30F3\u30AF\u30ED\u304C\u4F5C\u52D5\u3057\u307E\u305B\u3093
-ScOutlookErrorTooMany=\u30C7\u30A3\u30B9\u30D7\u30EC\u30A4\u306E\u30A2\u30A4\u30C6\u30E0\u304C\u591A\u3059\u304E\u307E\u3059
-ScOutlookErrorUnknown=\u30D7\u30E9\u30B0\u30A4\u30F3\u306F\u539F\u56E0\u4E0D\u660E\u306E\u30A8\u30E9\u30FC\u3067\u3059
-ScOutlookTitle=Sc\u30A2\u30A6\u30C8\u30EB\u30C3\u30AF\u3000\u30D7\u30E9\u30B0\u30A4\u30F3
-Scout=EclipseScout
-ScoutHome=\u500B\u4EBA\u30C7\u30FC\u30BF
-SearchButtonPanelTooltip=\u30B5\u30FC\u30C1\u958B\u59CB
-SearchMenu=\u30B5\u30FC\u30C1
-SearchPartial=\u30D1\u30FC\u30B7\u30E3\u30EB\u30B5\u30FC\u30C1
-SecurityNotAllowed=\u5148\u4F8B\u306F\u30B5\u30FC\u30D0\u30FC\u306B\u3088\u308A\u62D2\u5426\u3055\u308C\u307E\u3057\u305F
-Servidor_All=\u5168\u3066
-ShowFileErrorText=\u3053\u306E\u30D5\u30A1\u30A4\u30EB\u306F\u958B\u3051\u307E\u305B\u3093
-ShowFileErrorTitle=\u30D5\u30A1\u30A4\u30EB\u3092\u898B\u308B
-SmartFieldInvalidKey=
-SmartFieldTooManyRows=\u30C7\u30FC\u30BF\u6587\u7AE0\u304C\u591A\u3059\u304E\u307E\u3059\u3002\u30B5\u30FC\u30C1\u306E\u57FA\u6E96\u3092\u5236\u9650\u3057\u3066\u304F\u3060\u3055\u3044
-SpreadsheetPasteWarning1a=\u5E7E\u3064\u304B\u306E\u30BB\u30EB\u306F\u30EA\u30FC\u30C9\u306E\u307F\u3067\u3059\u3002\u30B3\u30D4\u30FC/\u633F\u5165\u306F\u4E0D\u53EF\u80FD\u3067\u3059
-SpreadsheetPasteWarning1b=\u4FA1\u5024\u3092\u7121\u8996\u3057\u307E\u3059
-StartupPhaseConfig=\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u306E\u8AAD\u307F\u8FBC\u307F
-StartupPhaseOffline=\u74B0\u5883\u8A2D\u7F6E
-StartupPhaseUpdate=\u30A2\u30C3\u30D7\u30C7\u30FC\u30C8\u3092\u30C1\u30A7\u30C3\u30AF\u3059\u308B
-StoreColumnWidths=\u9593\u9699\u5E45\u3092\u4FDD\u5B58\u3059\u308B
-TableVerificationCoefficient=\u76F8\u95A2\u95A2\u4FC2\u6570
-TableVerificationSuccessful=\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u306E\u7167\u5408\u304C\u5B8C\u4E86\u3057\u307E\u3057\u305F
-TransferProgressLabel=\u53D7\u7406\u3059\u308B
-TransferProgressTitle=\u30C7\u30FC\u30BF\u8EE2\u9001
-Using=\u5229\u7528\u3059\u308B
-Verify=\u691C\u67FB\u3059\u308B
-VerifyOfflineEnvironment=\u691C\u67FB/\u8A2D\u7F6E
-ViewListLabel=\u9818\u57DF\u3092\u9078\u3076
-ViewListTitle=\u30AA\u30FC\u30EB\u30F4\u30E5\u30FC
-WorkOffline=\u30AA\u30D5\u30E9\u30A4\u30F3
-WorkOfflineInfoText=\u30AA\u30D5\u30E9\u30A4\u30F3\u306E\u5834\u5408\u3001\u30AA\u30F3\u30E9\u30A4\u30F3\u306E\u30ED\u30B0\u30A4\u30F3\u3068\u540C\u3058\u3088\u3046\u306B\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u30B5\u30FC\u30D0\u306EURL\u3092\u30B5\u30FC\u30D0\u30FC\u306E\u9818\u57DF\u306B\u66F8\u304D\u8FBC\u3093\u3067\u304F\u3060\u3055\u3044\u3002
+AccessAuthorization=\u30B5\u30FC\u30D0\u30FC\u3092\u8A31\u53EF\u3059\u308B
+Application=\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3
+ApplicationServer=\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u30B5\u30FC\u30D0\u30FC
+AutomaticallyStopAfterFirstFetch=\u6700\u521D\u306E\u884C\u306E\u307F\u6301\u3063\u3066\u304F\u308B
+BrowseMenu=\u30B5\u30FC\u30C1
+CTIDialErrorInfo=\u96FB\u8A71\u756A\u53F7\u3092\u70B9\u691C\u3059\u308B
+CTIDialErrorText=\u30C6\u30EC\u30D5\u30A9\u30F3\u30B5\u30FC\u30D0\u30FC\u306B\u3064\u306A\u304C\u308A\u307E\u305B\u3093
+CTIDialErrorTitle=\u96FB\u8A71
+Calendar_itemCont=\u7D99\u7D9A
+Calendar_itemFrom=\u304B\u3089
+Calendar_itemUntil=\u307E\u3067
+CheckFailed=\u30C7\u30FC\u30BF\u9593\u9055\u3044
+CheckFailedMessage=\u30C7\u30FC\u30BF\u30FC\u30C1\u30A7\u30C3\u30AF\u30A8\u30E9\u30FC
+Containing=\u542B\u3080
+CopyPasteHint=\u3053\u308C\u4EE5\u4E0A\u306E\u30A4\u30F3\u30D5\u30A9\u30E1\u30FC\u30B7\u30E7\u30F3\u306F\u30B3\u30D4\u30FC\u30DC\u30BF\u30F3\u3092\u62BC\u3057\u3066\u304F\u3060\u3055\u3044
+CouldNotCreateOfflineDirectory=\u30D5\u30A9\u30EB\u30C0\u30FC\u3092\u8A2D\u7F6E\u3067\u304D\u307E\u305B\u3093
+CouldNotFindOfflineClasses=\u30AA\u30D5\u30E9\u30A4\u30F3\u3067\u306F\u30B9\u30BF\u30FC\u30C8\u3067\u304D\u307E\u305B\u3093
+CouldNotFindOfflineConfig=\u30AA\u30D5\u30E9\u30A4\u30F3\u3067\u306F\u30B9\u30BF\u30FC\u30C8\u3067\u304D\u307E\u305B\u3093
+CouldNotFindOfflineDatabase=\u30AA\u30D5\u30E9\u30A4\u30F3\u3067\u306F\u30B9\u30BF\u30FC\u30C8\u3067\u304D\u307E\u305B\u3093
+CouldNotGetApplication=\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u3092\u30ED\u30FC\u30C9\u3067\u304D\u307E\u305B\u3093
+CouldNotGetApplicationInfo=\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u30A4\u30F3\u30D5\u30A9\u30E1\u30FC\u30B7\u30E7\u30F3\u3092\u30ED\u30FC\u30C9\u3067\u304D\u307E\u305B\u3093
+CreateTriggers=\u30C8\u30EA\u30AC\u30FC\u3092\u8A2D\u7F6E\u3059\u308B
+CurrentLocale=\u73FE\u5728\u306E\u8A00\u8A9E
+CustomRollback=\u6D3B\u52D5\u304C\u4E2D\u6B62\u3055\u308C\u307E\u3057\u305F
+DataLoading=\u30C7\u30FC\u30BF\u30ED\u30FC\u30C9
+DateErrorText=\u65E5\u4ED8\u304C\u9055\u3044\u307E\u3059\u3002\u6B63\u3057\u3044\u65E5\u4ED8\u3092\u66F8\u3044\u3066\u304F\u3060\u3055\u3044
+DateErrorTitle=\u65E5\u4ED8\u306E\u9593\u9055\u3044
+DownloadOfflineDatabase=\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u3092\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9\u3057\u307E\u3059\u304B\uFF1F
+EditMenu=\u51E6\u7406\u3059\u308B
+ElapsedTime=\u4F7F\u7528\u6642\u9593
+EnableHtmlEditing=HTML\u30E2\u30FC\u30C9\u3092\u6D3B\u52D5\u3055\u305B\u308B
+EndStatus=\u6700\u7D42\u72B6\u6CC1
+EnterUrlTooltip=URL\u3092\u66F8\u304D\u8FBC\u3093\u3067\u304F\u3060\u3055\u3044
+ErrorAndRetryQuestion=\u30B3\u30F3\u30D4\u30E5\u30FC\u30BF\u30FC\u7BA1\u7406\u4EBA\u306B\u5831\u544A\u3057\u3066\u304F\u3060\u3055\u3044
+ErrorAndWarning=\u30A8\u30E9\u30FC/\u8B66\u544A
+ErrorAndWarningAndMessage=\u30A8\u30E9\u30FC/\u8B66\u544A/\u30E1\u30C3\u30BB\u30FC\u30B8
+ErrorCommandFailedQuestion=\u30A8\u30E9\u30FC\u3092\u7121\u8996\u3057\u5148\u3078\u9032\u307F\u307E\u3059\u304B\uFF1F
+ErrorCommandFailedText=\u6D3B\u52D5\u304C\u4E2D\u6B62\u3055\u308C\u307E\u3057\u305F
+ErrorOnly=\u9593\u9055\u3044
+ErrorReadingOfflineTable=\u30AA\u30D5\u30E9\u30A4\u30F3\u30C6\u30FC\u30D6\u30EB\u306E\u8AAD\u307F\u8FBC\u307F\u30A8\u30E9\u30FC
+ErrorReadingOnlineTable=\u30B5\u30FC\u30D0\u30FC\u30C6\u30FC\u30D6\u30EB\u306E\u8AAD\u307F\u8FBC\u307F\u30A8\u30E9\u30FC
+EstimatedEndDate=\u7D42\u4E86\u3059\u308B
+EstimatedTime=\u4E88\u6E2C\u6642\u9593
+ExtendedSearchEntityPrefix=\u6301\u3064
+ExtendedSearchEntityPrefixNegated=\u6301\u3063\u3066\u306A\u3044
+ExtendedSearchSaveButton=\u6DFB\u4ED8\u3059\u308B
+FailedDownloadingFile=\u30C7\u30FC\u30BF\u3092\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9\u3067\u304D\u307E\u305B\u3093
+FailedGettingOfflineTableVerification=\u30AA\u30D5\u30E9\u30A4\u30F3\u30C6\u30FC\u30D6\u30EB\u306E\u691C\u8A3C\u304C\u3067\u304D\u307E\u305B\u3093
+FailedGettingOnlineTableVerification=\u30B5\u30FC\u30D0\u30FC\u30C6\u30FC\u30D6\u30EB\u306E\u691C\u8A3C\u304C\u3067\u304D\u307E\u305B\u3093
+Field=\u9818\u57DF
+FieldRangeErrorText=\u6570\u9818\u57DF\u306E\u30A8\u30E9\u30FC
+FieldRangeErrorTitle=\u6570\u9818\u57DF\u306E\u30A8\u30E9\u30FC
+Fields=\u9818\u57DF
+FilePath=\u30D5\u30A1\u30A4\u30EB
+FormInvalidTextInFields=\u4EE5\u4E0B\u306E\u9818\u57DF\u306B\u8AA4\u308A\u304C\u3042\u308A\u307E\u3059
+FormMissingMandatoryFields=\u4EE5\u4E0B\u306E\u9818\u57DF\u306E\u7A7A\u6B04\u3092\u57CB\u3081\u3066\u304F\u3060\u3055\u3044
+GenericSearch=\u30B9\u30DA\u30B7\u30E3\u30EB\u30B5\u30FC\u30C1
+GetUrlForm=\u30A6\u30A7\u30D6\u30A2\u30C9\u30EC\u30B9
+HtmlPluginActionSubmitted=\u6D3B\u52D5\u3092\u5B9F\u884C\u3057\u307E\u3057\u305F
+HtmlPluginChangesSaved=\u4FEE\u6B63\u3092\u4FDD\u5B58\u3057\u307E\u3057\u305F
+HtmlPluginPendingAction=\u3059\u3067\u306BPop-up\u30B9\u30AF\u30EA\u30FC\u30F3\u304C\u958B\u304B\u308C\u3066\u3044\u307E\u3059\u3002\u5148\u306B\u3053\u308C\u3092\u9589\u3058\u3066\u4E0B\u3055\u3044
+HtmlPopupInfoPanel=Pop-up\u30B9\u30AF\u30EA\u30FC\u30F3\u3092\u958B\u304D\u307E\u3057\u305F
+IgnoreCase=\u7121\u8996\u3000\u5927/\u5C0F
+Informations=\u30A4\u30F3\u30D5\u30A9\u30E1\u30FC\u30B7\u30E7\u30F3
+JavaVM=\u30B8\u30E3\u30F4\u30A1
+LiveEdit=\u30E9\u30A4\u30F4\u4F5C\u6210
+LocalServer=\u30ED\u30FC\u30AB\u30EB\u30B5\u30FC\u30D0\u30FC
+Logging=\u8A18\u9332\u3059\u308B
+LoginFailed=\u30ED\u30B0\u30A4\u30F3\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F
+LoginToApplicationServer=\u30ED\u30B0\u30A4\u30F3
+MissingOfflineTable=\u30AA\u30D5\u30E9\u30A4\u30F3\u30C6\u30FC\u30D6\u30EB\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093
+MissingOnlineTable=\u30B5\u30FC\u30D0\u30FC\u30C6\u30FC\u30D6\u30EB\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093
+NetworkProxy=\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\uFF0F\u30D7\u30ED\u30AD\u30B7\u30FC
+NewMenu=\u65B0\u3057\u3044
+NewSearch=\u30CB\u30E5\u30FC\u30B5\u30FC\u30C1
+NoAuthenticationFound=\u7533\u544A\u30C7\u30FC\u30BF\u304C\u6B63\u3057\u304F\u3042\u308A\u307E\u305B\u3093
+NoRowsFound=\u30C7\u30FC\u30BF\u6587\u7AE0\u304C\u3042\u308A\u307E\u305B\u3093
+NoViewAvailable=\u30DA\u30FC\u30B8\u304C\u3042\u308A\u307E\u305B\u3093
+Offline=\u30AA\u30D5\u30E9\u30A4\u30F3
+OfflineAdmin=\u30AA\u30D5\u30E9\u30A4\u30F3\u7BA1\u7406\u4EBA
+OfflineDirectory=\u30ED\u30FC\u30AB\u30EB\u4E00\u89A7\u8868
+OfflineInstallationInvalidMessage=\u3053\u306E\u30AA\u30D5\u30E9\u30A4\u30F3\u306E\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB\u306F\u4E0D\u5B8C\u5168\u3067\u3059
+OfflineInstallationValidMessage=\u3053\u306E\u30AA\u30D5\u30E9\u30A4\u30F3\u306F\u6B63\u3057\u304F\u6A5F\u80FD\u3057\u3066\u3044\u307E\u3059
+OfflineMasterServer=\u30AA\u30F3\u30E9\u30A4\u30F3\u30B5\u30FC\u30D0\u30FC
+OfflineReplicationInvalidMessage=\u3053\u306E\u30EC\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u306F\u5B9F\u884C\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F
+OfflineSetup=\u30AA\u30D5\u30E9\u30A4\u30F3\u3092\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u3057\u3066\u304F\u3060\u3055\u3044
+Operator=\u30AA\u30DA\u30EC\u30FC\u30BF\u30FC
+Operators=\u30AA\u30DA\u30EC\u30FC\u30BF\u30FC
+Options=\u30BB\u30C3\u30C6\u30A3\u30F3\u30B0
+OutlookSyncStatusInfo=\u30A2\u30A6\u30C8\u30EB\u30C3\u30AF\u30B7\u30F3\u30AF\u30ED\u306F\u6210\u529F\u3057\u307E\u3057\u305F
+OutputLevel=\u30A2\u30A6\u30C8\u30D7\u30C3\u30C8\u30EC\u30D9\u30EB
+PasswordChanged=\u3042\u306A\u305F\u306E\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u5909\u66F4\u3057\u307E\u3057\u305F
+PasswordNotChanged=\u3042\u306A\u305F\u306E\u30D1\u30B9\u30EF\u30FC\u30C9\u306F\u5909\u66F4\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F
+PasswordNotReset=\u3053\u306E\u30D1\u30B9\u30EF\u30FC\u30C9\u306F\u5909\u66F4\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F
+PasswordReset=\u3053\u306E\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u5909\u66F4\u3057\u307E\u3057\u305F
+PasswordWrong=\u30D1\u30B9\u30EF\u30FC\u30C9\u304C\u9055\u3044\u307E\u3059
+PleaseCheckLogfile=\u30ED\u30B0\u30D5\u30A1\u30A4\u30EB\u3092\u70B9\u691C\u3057\u3066\u304F\u3060\u3055\u3044
+PleaseCheckOfflineDirectory=\u30AA\u30D5\u30E9\u30A4\u30F3\u4E00\u89A7\u3092\u70B9\u691C\u3057\u3066\u304F\u3060\u3055\u3044
+Port=Port
+Programmed=\u30D7\u30ED\u30B0\u30E9\u30DE\u30FC
+RepAutoCleanupFailedText=\u30ED\u30FC\u30AB\u30EB\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u304C\u4E0D\u5B8C\u5168\u3067\u3059
+RepAutoCleanupPerformedText=\u30ED\u30FC\u30AB\u30EB\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u306F\u51E6\u7406\u3055\u308C\u307E\u3057\u305F
+RepDone=\u6B21\u3078
+RepEndDate=\u7D42\u4E86\u3059\u308B
+RepGetServerUpdate=\u30B5\u30FC\u30D0\u30FC\u304B\u3089\u30C7\u30FC\u30BF\u3092\u53D7\u3051\u4ED8\u3051\u307E\u3059
+RepNextExtract=\u30C7\u30FC\u30BF\u306F\u518D\u751F\u3055\u308C\u307E\u3057\u305F
+RepProgCommit=\u78BA\u8A8D
+RepProgExtract=\u8981\u70B9
+RepProgSync=\u30C7\u30FC\u30BF\u4EA4\u63DB
+RepProgUpdate=\u30A2\u30C3\u30D7\u30C7\u30FC\u30C8
+RepStartDate=\u30B9\u30BF\u30FC\u30C8
+Replicate=\u8907\u88FD
+ReplicationStatus=\u72B6\u6CC1\u3092\u8907\u88FD\u3059\u308B
+ReportLayoutTitle=\u30EC\u30DD\u30FC\u30C8\u30BF\u30A4\u30D7
+ReportNoDataFound=\u304A\u63A2\u3057\u306E\u30C7\u30FC\u30BF\u306F\u5B58\u5728\u3057\u307E\u305B\u3093
+ResetPasswordUserHasNoLoginName=\u9078\u3070\u308C\u305F\u4EBA\u7269\u306F\u30ED\u30B0\u30A4\u30F3\u540D\u306B\u5B58\u5728\u3057\u307E\u305B\u3093
+ResultOfTableVerification=\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u306E\u30C1\u30A7\u30C3\u30AF\u306E\u7D50\u679C
+Row=\u30C7\u30FC\u30BF\u6587\u7AE0
+RowCountDifferenceOnTable=\u30C7\u30FC\u30BF\u6587\u7AE0\u6570\u304C\u4E00\u81F4\u3057\u307E\u305B\u3093
+Rows=\u30C7\u30FC\u30BF\u6587\u7AE0
+SWUpdateMsg10=\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB\u3068\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u306E\u30A8\u30E9\u30FC
+SWUpdateMsg1=\u30BD\u30D5\u30C8\u30A6\u30A7\u30A2\u30FC\u306E\u30A2\u30C3\u30D7\u30C7\u30FC\u30C8\u3092\u4EFB\u610F\u306B\u51E6\u7406\u3057\u307E\u3057\u305F\u3000
+SWUpdateMsg2=\u30BD\u30D5\u30C8\u30A6\u30A7\u30A2\u30FC\u306E\u30A2\u30C3\u30D7\u30C7\u30FC\u30C8\u3092\u3057\u307E\u3059\u304B
+SWUpdateMsg3a=\u30BD\u30D5\u30C8\u30A6\u30A7\u30A2\u30FC\u306E\u30A2\u30C3\u30D7\u30C7\u30FC\u30C8\u306E\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9\u304C\u53EF\u80FD\u3067\u3059
+SWUpdateMsg4=\u30B5\u30FC\u30D0\u30FC\u306B\u4F7F\u7528\u3067\u304D\u308B\u63A5\u7D9A\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u304C\u3042\u308A\u307E\u305B\u3093
+SWUpdateMsg5=\u30B5\u30FC\u30D0\u30FC\u306E\u5F62\u5F0F\u3092\u7167\u4F1A\u3067\u304D\u307E\u305B\u3093
+SWUpdateMsg6=\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB\u306F\u65B0\u3057\u304F\u7ACB\u3061\u4E0A\u304C\u308A\u307E\u3057\u305F
+SWUpdateMsg7=\u30BD\u30D5\u30C8\u30A6\u30A7\u30A2\u30FC\u306E\u30A2\u30C3\u30D7\u30C7\u30FC\u30C8\u3092\u4E2D\u6B62\u3057\u307E\u3059
+SWUpdateMsg8=\u30D5\u30A1\u30A4\u30EB\u306E\u4E00\u89A7\u8868\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093
+SWUpdateMsg9=\u30B5\u30FC\u30D0\u30FC\u304B\u3089\u306E\u65B0\u898F\u30D5\u30A1\u30A4\u30EB\u306E\u9069\u7528\u304C\u3067\u304D\u307E\u305B\u3093
+SaveAndLoopback=\u30EB\u30FC\u30D7\u30D0\u30C3\u30AF\u3068\u4FDD\u5B58
+ScOutlookErrorCache=\u30A2\u30A6\u30C8\u30EB\u30C3\u30AF\u30B7\u30F3\u30AF\u30ED\u304C\u4F5C\u52D5\u3057\u307E\u305B\u3093
+ScOutlookErrorGeneral=\u30A2\u30A6\u30C8\u30EB\u30C3\u30AF\u30B7\u30F3\u30AF\u30ED\u304C\u4F5C\u52D5\u3057\u307E\u305B\u3093
+ScOutlookErrorPartial=\u30A2\u30A6\u30C8\u30EB\u30C3\u30AF\u30B7\u30F3\u30AF\u30ED\u304C\u4F5C\u52D5\u3057\u307E\u305B\u3093
+ScOutlookErrorTooMany=\u30C7\u30A3\u30B9\u30D7\u30EC\u30A4\u306E\u30A2\u30A4\u30C6\u30E0\u304C\u591A\u3059\u304E\u307E\u3059
+ScOutlookErrorUnknown=\u30D7\u30E9\u30B0\u30A4\u30F3\u306F\u539F\u56E0\u4E0D\u660E\u306E\u30A8\u30E9\u30FC\u3067\u3059
+ScOutlookTitle=Sc\u30A2\u30A6\u30C8\u30EB\u30C3\u30AF\u3000\u30D7\u30E9\u30B0\u30A4\u30F3
+Scout=EclipseScout
+ScoutHome=\u500B\u4EBA\u30C7\u30FC\u30BF
+SearchButtonPanelTooltip=\u30B5\u30FC\u30C1\u958B\u59CB
+SearchMenu=\u30B5\u30FC\u30C1
+SearchPartial=\u30D1\u30FC\u30B7\u30E3\u30EB\u30B5\u30FC\u30C1
+SecurityNotAllowed=\u5148\u4F8B\u306F\u30B5\u30FC\u30D0\u30FC\u306B\u3088\u308A\u62D2\u5426\u3055\u308C\u307E\u3057\u305F
+Servidor_All=\u5168\u3066
+ShowFileErrorText=\u3053\u306E\u30D5\u30A1\u30A4\u30EB\u306F\u958B\u3051\u307E\u305B\u3093
+ShowFileErrorTitle=\u30D5\u30A1\u30A4\u30EB\u3092\u898B\u308B
+SmartFieldInvalidKey=
+SmartFieldTooManyRows=\u30C7\u30FC\u30BF\u6587\u7AE0\u304C\u591A\u3059\u304E\u307E\u3059\u3002\u30B5\u30FC\u30C1\u306E\u57FA\u6E96\u3092\u5236\u9650\u3057\u3066\u304F\u3060\u3055\u3044
+SpreadsheetPasteWarning1a=\u5E7E\u3064\u304B\u306E\u30BB\u30EB\u306F\u30EA\u30FC\u30C9\u306E\u307F\u3067\u3059\u3002\u30B3\u30D4\u30FC/\u633F\u5165\u306F\u4E0D\u53EF\u80FD\u3067\u3059
+SpreadsheetPasteWarning1b=\u4FA1\u5024\u3092\u7121\u8996\u3057\u307E\u3059
+StartupPhaseConfig=\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u306E\u8AAD\u307F\u8FBC\u307F
+StartupPhaseOffline=\u74B0\u5883\u8A2D\u7F6E
+StartupPhaseUpdate=\u30A2\u30C3\u30D7\u30C7\u30FC\u30C8\u3092\u30C1\u30A7\u30C3\u30AF\u3059\u308B
+StoreColumnWidths=\u9593\u9699\u5E45\u3092\u4FDD\u5B58\u3059\u308B
+TableVerificationCoefficient=\u76F8\u95A2\u95A2\u4FC2\u6570
+TableVerificationSuccessful=\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u306E\u7167\u5408\u304C\u5B8C\u4E86\u3057\u307E\u3057\u305F
+TransferProgressLabel=\u53D7\u7406\u3059\u308B
+TransferProgressTitle=\u30C7\u30FC\u30BF\u8EE2\u9001
+Using=\u5229\u7528\u3059\u308B
+Verify=\u691C\u67FB\u3059\u308B
+VerifyOfflineEnvironment=\u691C\u67FB/\u8A2D\u7F6E
+ViewListLabel=\u9818\u57DF\u3092\u9078\u3076
+ViewListTitle=\u30AA\u30FC\u30EB\u30F4\u30E5\u30FC
+WorkOffline=\u30AA\u30D5\u30E9\u30A4\u30F3
+WorkOfflineInfoText=\u30AA\u30D5\u30E9\u30A4\u30F3\u306E\u5834\u5408\u3001\u30AA\u30F3\u30E9\u30A4\u30F3\u306E\u30ED\u30B0\u30A4\u30F3\u3068\u540C\u3058\u3088\u3046\u306B\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u30B5\u30FC\u30D0\u306EURL\u3092\u30B5\u30FC\u30D0\u30FC\u306E\u9818\u57DF\u306B\u66F8\u304D\u8FBC\u3093\u3067\u304F\u3060\u3055\u3044\u3002
diff --git a/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_nl.properties b/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_nl.properties
index 3c617c0ca8..9bdd05735e 100644
--- a/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_nl.properties
+++ b/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_nl.properties
@@ -1,10 +1,10 @@
-BookmarkFolderHelpText=defineer de folder, waarin de Favoriet dient te verschijnen. Voorbeeld Raport/wekelijks.\n dit veld is optionaal.
-Calendar_itemCont=(label)
-Calendar_itemFrom=Van
-Calendar_itemUntil=tot
-Choose=Kies
-CopyPasteHint=Voor gedetailleerde informatie, druk copieknop en plak in tekstverwerker
-DisplayedTimerange=Weergegeven tijdsduur
-DoubleWeek=Dubbele week
-InvolvedPersons=Betrokken personen
-LotusNotesCode=Lotus Notes
+BookmarkFolderHelpText=defineer de folder, waarin de Favoriet dient te verschijnen. Voorbeeld Raport/wekelijks.\n dit veld is optionaal.
+Calendar_itemCont=(label)
+Calendar_itemFrom=Van
+Calendar_itemUntil=tot
+Choose=Kies
+CopyPasteHint=Voor gedetailleerde informatie, druk copieknop en plak in tekstverwerker
+DisplayedTimerange=Weergegeven tijdsduur
+DoubleWeek=Dubbele week
+InvolvedPersons=Betrokken personen
+LotusNotesCode=Lotus Notes
diff --git a/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_nl_BE.properties b/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_nl_BE.properties
index 400672b307..21ee7d13b5 100644
--- a/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_nl_BE.properties
+++ b/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_nl_BE.properties
@@ -1,9 +1,9 @@
-Calendar_itemCont=(label)
-Calendar_itemFrom=van
-Calendar_itemUntil=tot
-Choose=Kies
-CopyPasteHint=Voor gedetailleerde informatie, druk copieknop en plak in tekstverwerker
-DisplayedTimerange=Weergegeven tijdsduur
-DoubleWeek=Dubbele week
-InvolvedPersons=Betrokken personen
-LotusNotesCode=Lotus Notes
+Calendar_itemCont=(label)
+Calendar_itemFrom=van
+Calendar_itemUntil=tot
+Choose=Kies
+CopyPasteHint=Voor gedetailleerde informatie, druk copieknop en plak in tekstverwerker
+DisplayedTimerange=Weergegeven tijdsduur
+DoubleWeek=Dubbele week
+InvolvedPersons=Betrokken personen
+LotusNotesCode=Lotus Notes
diff --git a/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_no.properties b/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_no.properties
index ac48aba997..992f75ef78 100644
--- a/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_no.properties
+++ b/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_no.properties
@@ -1,8 +1,8 @@
-Calendar_itemCont=(merke)
-Calendar_itemFrom=Fra
-Calendar_itemUntil=inntil
-CopyPasteHint=(For detaljert informasjon, velg 'Kopi' og 'Lim inn' i tekstredigering.)
-DisplayedTimerange=Vist tidsgruppe
-DoubleWeek=Dobbel uke
-InvolvedPersons=Involverte personer
-LotusNotesCode=Lotus Notes
+Calendar_itemCont=(merke)
+Calendar_itemFrom=Fra
+Calendar_itemUntil=inntil
+CopyPasteHint=(For detaljert informasjon, velg 'Kopi' og 'Lim inn' i tekstredigering.)
+DisplayedTimerange=Vist tidsgruppe
+DoubleWeek=Dobbel uke
+InvolvedPersons=Involverte personer
+LotusNotesCode=Lotus Notes
diff --git a/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_pl.properties b/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_pl.properties
index d8778c4ab6..f49299a025 100644
--- a/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_pl.properties
+++ b/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_pl.properties
@@ -1,8 +1,8 @@
-Calendar_itemCont=(tag)
-Calendar_itemFrom=Od
-Calendar_itemUntil=A\u017C do
-CopyPasteHint=(Aby uzyska\u0107 szczeg\u00F3\u0142owe informacje, wci\u015Bnij 'Kopiuj', a nast\u0119pnie 'Wklej' w edytorze tekstu
-DisplayedTimerange=Poka\u017C ramy czasowe
-DoubleWeek=Double week
-InvolvedPersons=Zaanga\u017Cowane osoby
-LotusNotesCode=Lotus Notes
+Calendar_itemCont=(tag)
+Calendar_itemFrom=Od
+Calendar_itemUntil=A\u017C do
+CopyPasteHint=(Aby uzyska\u0107 szczeg\u00F3\u0142owe informacje, wci\u015Bnij 'Kopiuj', a nast\u0119pnie 'Wklej' w edytorze tekstu
+DisplayedTimerange=Poka\u017C ramy czasowe
+DoubleWeek=Double week
+InvolvedPersons=Zaanga\u017Cowane osoby
+LotusNotesCode=Lotus Notes
diff --git a/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_pt_br.properties b/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_pt_br.properties
index 95c3a47613..ce1071ea97 100644
--- a/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_pt_br.properties
+++ b/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_pt_br.properties
@@ -1,160 +1,160 @@
-AccessAuthorization=Autoriza\u00E7\u00E3o do
-Application=Aplica\u00E7\u00E3o
-ApplicationServer=Servidor de Aplica\u00E7\u00E3o
-AutomaticallyStopAfterFirstFetch=Localizar e carregar somente o primeiro registro
-BrowseMenu=Procurar...
-Calendar_itemCont=(tag)
-Calendar_itemFrom=A partir de
-Calendar_itemUntil=at\u00E9
-CheckFailed=Erro
-CheckFailedMessage=O controlo dos dados falhou.
-Containing=Cont\u00EAm
-CopyPasteHint=(Para informa\u00E7\u00E3o detalhada, "Copiar" e "Colar" num documento de texto.)
-CouldNotCreateOfflineDirectory=N\u00E3o consegue criar um diret\u00F3rio local.
-CouldNotFindOfflineClasses=Ambiente off-line n\u00E3o encontrado.
-CouldNotFindOfflineConfig=Configura\u00E7\u00E3o off-line n\u00E3o encontrada.
-CouldNotFindOfflineDatabase=Banco de dados local n\u00E3o encontrado.
-CouldNotGetApplication=N\u00E3o consegue carregar a aplica\u00E7\u00E3o.
-CouldNotGetApplicationInfo=N\u00E3o consegue carregar a informa\u00E7\u00E3o da aplica\u00E7\u00E3o.
-CreateTriggers=Gerar Triggers
-CurrentLocale=Localiza\u00E7\u00E3o actual
-CustomRollback=A tarefa foi cancelada.
-DataLoading=A carregar dados
-DateErrorText=A data '{0}' n\u00E3o \u00E9 v\u00E1lida. Por favor corrigir o valor.
-DateErrorTitle=Data inv\u00E1lida.
-DisplayedTimerange=Displayed timerange
-DoubleWeek=semana Dupla
-DownloadOfflineDatabase=Deseja fazer o download do banco de dados?
-EditMenu=Editar...
-ElapsedTime=Decorrido
-EnableHtmlEditing=Permitir edi\u00E7\u00E3o em HTML
-EndStatus=Status de conclus\u00E3o
-EnterUrlTooltip=Introduza o URL ou colar depois de Copiar/Colar
-ErrorAndRetryQuestion=Deseja tentar novamente?
-ErrorAndWarning=Erro / Aviso
-ErrorAndWarningAndMessage=Erro / Aviso / Mensagem
-ErrorCommandFailedQuestion=Quer ignorar o erro e continuar?
-ErrorCommandFailedText=A ac\u00E7\u00E3o foi cancelada.
-ErrorOnly=Erro
-ErrorReadingOfflineTable=Erro ao ler a tabela off-line
-ErrorReadingOnlineTable=Erro ao ler a tabela do servidor
-EstimatedEndDate=Conclu\u00EDdo
-EstimatedTime=Dura\u00E7\u00E3o estimada
-ExtendedSearchEntityPrefix=tem
-ExtendedSearchEntityPrefixNegated=n\u00E3o tem
-ExtendedSearchSaveButton=Acrescentar
-FailedDownloadingFile=N\u00E3o foi poss\u00EDvel concluir o download
-FailedGettingOfflineTableVerification=Verifica\u00E7\u00E3o da tabela off-line falhou
-FailedGettingOnlineTableVerification=Verifica\u00E7\u00E3o da tabela do servidor falhou
-Field=Campo
-FieldRangeErrorText=O valor 'desde' deve ser maior do que o valor 'at\u00E9'.
-FieldRangeErrorTitle=Erro no intervalo dos dados
-Fields=Campos
-FilePath=Caminho do ficheiro
-FormInvalidTextInFields=Os seguintes campos cont\u00EAm valores inv\u00E1lidos.
-FormMissingMandatoryFields=Os campos seguintes s\u00E3o obrigat\u00F3rios.
-GenericSearch=Busca extendida
-GetUrlForm=Endere\u00E7o web
-HtmlPluginActionSubmitted=A\u00E7\u00E3o executada.
-HtmlPluginChangesSaved=As altera\u00E7\u00F5es foram salvas.
-HtmlPluginPendingAction=Neste aplicativo j\u00E1 existe uma janela pop-up aberta. Por favor, feche a janela e tente novamente.
-HtmlPopupInfoPanel=Janela pop-up aberta no aplicativo.
-IgnoreCase=Ignorar mai\u00FAscula/min\u00FAscula
-Informations=Informa\u00E7\u00F5es
-InvolvedPersons=Pessoas envolvidas
-LiveEdit=Editar ao vivo
-LocalServer=Servidor local
-Logging=Acedendo
-LoginFailed=Acesso negado
-LoginToApplicationServer=Acesso
-LotusNotesCode=Lotus Notes
-MissingOfflineTable=Tabela off-line perdida
-MissingOnlineTable=Tabela servidor perdida
-NetworkProxy=Rede / Proxy
-NewMenu=Novo
-NewSearch=Nova procura
-NoAuthenticationFound=A informa\u00E7\u00E3o da autentica\u00E7\u00E3o n\u00E3o est\u00E1 correcta
-NoRowsFound=Nenhum registo
-NoViewAvailable=Nenhuma vista dispon\u00EDvel
-Offline=Off-line
-OfflineAdmin=Administrador off-line
-OfflineDirectory=Diret\u00F3rio local
-OfflineInstallationInvalidMessage=Esta instal\u00E7\u00E3o off-line est\u00E1 incompleta.
-OfflineInstallationValidMessage=Esta instala\u00E7\u00E3o off-line est\u00E1 pronta e completa
-OfflineMasterServer=Servidor on-line
-OfflineReplicationInvalidMessage=N\u00E3o foi poss\u00EDvel executar a c\u00F3pia.
-OfflineSetup=Configurar ambiente off-line
-Operator=Operador
-Operators=Operadores
-Options=Op\u00E7\u00F5es
-OutputLevel=N\u00EDvel de saida
-PasswordChanged=A sua password foi alterada
-PasswordNotChanged=A sua password n\u00E3o pode ser mudada.
-PasswordNotReset=A password n\u00E3o pode ser mudada
-PasswordReset=A password foi mudada.
-PasswordWrong=Password errada
-PleaseCheckLogfile=Por favor verificar o ficheiro do registo.
-PleaseCheckOfflineDirectory=Por favor, verificar a exist\u00E2ncia do diret\u00F3rio off-line
-Port=Porta Programmed_pt\=QA Properties_pt\=Propriedades
-Programmed=GQ
-RepDone=Ok
-RepEndDate=Conclu\u00EDdo
-RepGetServerUpdate=A receber dados do servidor
-RepNextExtract=Preparando dados...
-RepProgCommit=Confirma\u00E7\u00E3o
-RepProgExtract=Extrair
-RepProgSync=Troca de dados
-RepProgUpdate=Atualizar
-RepStartDate=Iniciar
-Replicate=C\u00F3pia
-ReplicationStatus=Status de c\u00F3pia
-ReportLayoutTitle=Tipo de relat\u00F3rio
-ReportNoDataFound=N\u00E3o existe dados que correspondam ao pedido.
-ResetPasswordUserHasNoLoginName=A pessoa selecionada n\u00E3o possue um nome de acesso v\u00E1lido.
-ResultOfTableVerification=Resultado da verifica\u00E7\u00E3o do banco de dados
-Row=Registro
-RowCountDifferenceOnTable=N\u00FAmero de registros diferentes.
-Rows=Registos
-SWUpdateMsg10=Erro na c\u00F3pia de seguran\u00E7a e na instala\u00E7\u00E3o de\:
-SWUpdateMsg1=Atualiza\u00E7\u00E3o de software dispon\u00EDvel. \nVers\u00E3o instalada\: \#OLD\#\nVers\u00E3o nova\: \#NEW\#
-SWUpdateMsg2=Instalar atualiza\u00E7\u00E3o de software agora?
-SWUpdateMsg3a=O download da atualiza\u00E7\u00E3o de software foi conclu\u00EDdo com sucesso.\nPara executar a atualiza\u00E7\u00E3o, o aplicativo deve ser reiniciado.
-SWUpdateMsg4=Conex\u00E3o de rede ao servidor de atualiza\u00E7\u00E3o n\u00E3o dispon\u00EDvel.
-SWUpdateMsg5=Falha ao solicitar vers\u00E3o do servidor
-SWUpdateMsg6=A instala\u00E7\u00E3o foi atualizada.
-SWUpdateMsg7=A atualiza\u00E7\u00E3o de software foi cancelada.
-SWUpdateMsg8=Diret\u00F3rio dos arquivos de aplicativo n\u00E3o encontrado.
-SWUpdateMsg9=Falha ao fazer o download dos arquivos de aplicativo.
-SaveAndLoopback=Testar loopback e salvar
-ScOutlookErrorCache=Plug-in n\u00E3o conseguiu criar mem\u00F3ria cache. \nA sincroniza\u00E7\u00E3o de todos '{0}' foi abandonada.\nFavor verificar a configura\u00E7\u00E3o do Outlook.
-ScOutlookErrorGeneral=Plug-in n\u00E3o conseguiu instalar o Outlook.\nFavor verificar a configura\u00E7\u00E3o do Outlook.\nCaso n\u00E3o seja poss\u00EDvel eliminar o problema\n, favor contatar BSI.
-ScOutlookErrorPartial=Plug-in n\u00E3o conseguiu sincronizar alguns registros.\nOs seguintes registros n\u00E3o foram processados\:\n{0}
-ScOutlookErrorTooMany=Dados demais a serem visualizados.
-ScOutlookErrorUnknown=O plug-in causou um erro desconhecido.\nPara maiores informa\u00E7\u00F5es, favor consultar o relat\u00F3rio de erro.
-ScOutlookTitle=Plug-in ScOutlook
-Scout=EclipseScout
-ScoutHome=Dados pessoais
-SearchButtonPanelTooltip=Inicia busca
-SearchMenu=Procurar
-SearchPartial=Procura parcial
-SecurityNotAllowed=A transac\u00E7\u00E3o foi negada pelo servidor
-Servidor_All=Tudo
-ShowFileErrorText=O ficheiro {0} n\u00E3o pode ser aberto.
-ShowFileErrorTitle=Mostar ficheiro
-SmartFieldInvalidKey=
-SmartFieldTooManyRows=Muitas linhas. Por limite o seu crit\u00E9rio de procura.
-StartupPhaseConfig=Carregar aplicativo...
-StartupPhaseOffline=Preparar ambiente...
-StartupPhaseUpdate=Localizar atualiza\u00E7\u00F5es...
-StoreColumnWidths=Guardar tamanho da coluna
-TableVerificationCoefficient=Coeficiente de correla\u00E7\u00E3o
-TableVerificationSuccessful=Verifica\u00E7\u00E3o da correla\u00E7\u00E3o do banco de dados conclu\u00EDda
-TransferProgressLabel=Recebendo
-TransferProgressTitle=Tranfer\u00EAncia de dados
-Using=Utilizando
-Verify=Verificar
-VerifyOfflineEnvironment=Examinar/instalar
-ViewListLabel=Escolha uma vista
-ViewListTitle=Todas as vistas
-WorkOffline=Trabalhar off-line
-WorkOfflineInfoText="Para trabalhar off-line, favor inserir o endere\u00E7o do servidor de aplicativos no campo ""Servidor"". Normalmente se trata do mesmo endere\u00E7o de acesso \u00E0 rede."
+AccessAuthorization=Autoriza\u00E7\u00E3o do
+Application=Aplica\u00E7\u00E3o
+ApplicationServer=Servidor de Aplica\u00E7\u00E3o
+AutomaticallyStopAfterFirstFetch=Localizar e carregar somente o primeiro registro
+BrowseMenu=Procurar...
+Calendar_itemCont=(tag)
+Calendar_itemFrom=A partir de
+Calendar_itemUntil=at\u00E9
+CheckFailed=Erro
+CheckFailedMessage=O controlo dos dados falhou.
+Containing=Cont\u00EAm
+CopyPasteHint=(Para informa\u00E7\u00E3o detalhada, "Copiar" e "Colar" num documento de texto.)
+CouldNotCreateOfflineDirectory=N\u00E3o consegue criar um diret\u00F3rio local.
+CouldNotFindOfflineClasses=Ambiente off-line n\u00E3o encontrado.
+CouldNotFindOfflineConfig=Configura\u00E7\u00E3o off-line n\u00E3o encontrada.
+CouldNotFindOfflineDatabase=Banco de dados local n\u00E3o encontrado.
+CouldNotGetApplication=N\u00E3o consegue carregar a aplica\u00E7\u00E3o.
+CouldNotGetApplicationInfo=N\u00E3o consegue carregar a informa\u00E7\u00E3o da aplica\u00E7\u00E3o.
+CreateTriggers=Gerar Triggers
+CurrentLocale=Localiza\u00E7\u00E3o actual
+CustomRollback=A tarefa foi cancelada.
+DataLoading=A carregar dados
+DateErrorText=A data '{0}' n\u00E3o \u00E9 v\u00E1lida. Por favor corrigir o valor.
+DateErrorTitle=Data inv\u00E1lida.
+DisplayedTimerange=Displayed timerange
+DoubleWeek=semana Dupla
+DownloadOfflineDatabase=Deseja fazer o download do banco de dados?
+EditMenu=Editar...
+ElapsedTime=Decorrido
+EnableHtmlEditing=Permitir edi\u00E7\u00E3o em HTML
+EndStatus=Status de conclus\u00E3o
+EnterUrlTooltip=Introduza o URL ou colar depois de Copiar/Colar
+ErrorAndRetryQuestion=Deseja tentar novamente?
+ErrorAndWarning=Erro / Aviso
+ErrorAndWarningAndMessage=Erro / Aviso / Mensagem
+ErrorCommandFailedQuestion=Quer ignorar o erro e continuar?
+ErrorCommandFailedText=A ac\u00E7\u00E3o foi cancelada.
+ErrorOnly=Erro
+ErrorReadingOfflineTable=Erro ao ler a tabela off-line
+ErrorReadingOnlineTable=Erro ao ler a tabela do servidor
+EstimatedEndDate=Conclu\u00EDdo
+EstimatedTime=Dura\u00E7\u00E3o estimada
+ExtendedSearchEntityPrefix=tem
+ExtendedSearchEntityPrefixNegated=n\u00E3o tem
+ExtendedSearchSaveButton=Acrescentar
+FailedDownloadingFile=N\u00E3o foi poss\u00EDvel concluir o download
+FailedGettingOfflineTableVerification=Verifica\u00E7\u00E3o da tabela off-line falhou
+FailedGettingOnlineTableVerification=Verifica\u00E7\u00E3o da tabela do servidor falhou
+Field=Campo
+FieldRangeErrorText=O valor 'desde' deve ser maior do que o valor 'at\u00E9'.
+FieldRangeErrorTitle=Erro no intervalo dos dados
+Fields=Campos
+FilePath=Caminho do ficheiro
+FormInvalidTextInFields=Os seguintes campos cont\u00EAm valores inv\u00E1lidos.
+FormMissingMandatoryFields=Os campos seguintes s\u00E3o obrigat\u00F3rios.
+GenericSearch=Busca extendida
+GetUrlForm=Endere\u00E7o web
+HtmlPluginActionSubmitted=A\u00E7\u00E3o executada.
+HtmlPluginChangesSaved=As altera\u00E7\u00F5es foram salvas.
+HtmlPluginPendingAction=Neste aplicativo j\u00E1 existe uma janela pop-up aberta. Por favor, feche a janela e tente novamente.
+HtmlPopupInfoPanel=Janela pop-up aberta no aplicativo.
+IgnoreCase=Ignorar mai\u00FAscula/min\u00FAscula
+Informations=Informa\u00E7\u00F5es
+InvolvedPersons=Pessoas envolvidas
+LiveEdit=Editar ao vivo
+LocalServer=Servidor local
+Logging=Acedendo
+LoginFailed=Acesso negado
+LoginToApplicationServer=Acesso
+LotusNotesCode=Lotus Notes
+MissingOfflineTable=Tabela off-line perdida
+MissingOnlineTable=Tabela servidor perdida
+NetworkProxy=Rede / Proxy
+NewMenu=Novo
+NewSearch=Nova procura
+NoAuthenticationFound=A informa\u00E7\u00E3o da autentica\u00E7\u00E3o n\u00E3o est\u00E1 correcta
+NoRowsFound=Nenhum registo
+NoViewAvailable=Nenhuma vista dispon\u00EDvel
+Offline=Off-line
+OfflineAdmin=Administrador off-line
+OfflineDirectory=Diret\u00F3rio local
+OfflineInstallationInvalidMessage=Esta instal\u00E7\u00E3o off-line est\u00E1 incompleta.
+OfflineInstallationValidMessage=Esta instala\u00E7\u00E3o off-line est\u00E1 pronta e completa
+OfflineMasterServer=Servidor on-line
+OfflineReplicationInvalidMessage=N\u00E3o foi poss\u00EDvel executar a c\u00F3pia.
+OfflineSetup=Configurar ambiente off-line
+Operator=Operador
+Operators=Operadores
+Options=Op\u00E7\u00F5es
+OutputLevel=N\u00EDvel de saida
+PasswordChanged=A sua password foi alterada
+PasswordNotChanged=A sua password n\u00E3o pode ser mudada.
+PasswordNotReset=A password n\u00E3o pode ser mudada
+PasswordReset=A password foi mudada.
+PasswordWrong=Password errada
+PleaseCheckLogfile=Por favor verificar o ficheiro do registo.
+PleaseCheckOfflineDirectory=Por favor, verificar a exist\u00E2ncia do diret\u00F3rio off-line
+Port=Porta Programmed_pt\=QA Properties_pt\=Propriedades
+Programmed=GQ
+RepDone=Ok
+RepEndDate=Conclu\u00EDdo
+RepGetServerUpdate=A receber dados do servidor
+RepNextExtract=Preparando dados...
+RepProgCommit=Confirma\u00E7\u00E3o
+RepProgExtract=Extrair
+RepProgSync=Troca de dados
+RepProgUpdate=Atualizar
+RepStartDate=Iniciar
+Replicate=C\u00F3pia
+ReplicationStatus=Status de c\u00F3pia
+ReportLayoutTitle=Tipo de relat\u00F3rio
+ReportNoDataFound=N\u00E3o existe dados que correspondam ao pedido.
+ResetPasswordUserHasNoLoginName=A pessoa selecionada n\u00E3o possue um nome de acesso v\u00E1lido.
+ResultOfTableVerification=Resultado da verifica\u00E7\u00E3o do banco de dados
+Row=Registro
+RowCountDifferenceOnTable=N\u00FAmero de registros diferentes.
+Rows=Registos
+SWUpdateMsg10=Erro na c\u00F3pia de seguran\u00E7a e na instala\u00E7\u00E3o de\:
+SWUpdateMsg1=Atualiza\u00E7\u00E3o de software dispon\u00EDvel. \nVers\u00E3o instalada\: \#OLD\#\nVers\u00E3o nova\: \#NEW\#
+SWUpdateMsg2=Instalar atualiza\u00E7\u00E3o de software agora?
+SWUpdateMsg3a=O download da atualiza\u00E7\u00E3o de software foi conclu\u00EDdo com sucesso.\nPara executar a atualiza\u00E7\u00E3o, o aplicativo deve ser reiniciado.
+SWUpdateMsg4=Conex\u00E3o de rede ao servidor de atualiza\u00E7\u00E3o n\u00E3o dispon\u00EDvel.
+SWUpdateMsg5=Falha ao solicitar vers\u00E3o do servidor
+SWUpdateMsg6=A instala\u00E7\u00E3o foi atualizada.
+SWUpdateMsg7=A atualiza\u00E7\u00E3o de software foi cancelada.
+SWUpdateMsg8=Diret\u00F3rio dos arquivos de aplicativo n\u00E3o encontrado.
+SWUpdateMsg9=Falha ao fazer o download dos arquivos de aplicativo.
+SaveAndLoopback=Testar loopback e salvar
+ScOutlookErrorCache=Plug-in n\u00E3o conseguiu criar mem\u00F3ria cache. \nA sincroniza\u00E7\u00E3o de todos '{0}' foi abandonada.\nFavor verificar a configura\u00E7\u00E3o do Outlook.
+ScOutlookErrorGeneral=Plug-in n\u00E3o conseguiu instalar o Outlook.\nFavor verificar a configura\u00E7\u00E3o do Outlook.\nCaso n\u00E3o seja poss\u00EDvel eliminar o problema\n, favor contatar BSI.
+ScOutlookErrorPartial=Plug-in n\u00E3o conseguiu sincronizar alguns registros.\nOs seguintes registros n\u00E3o foram processados\:\n{0}
+ScOutlookErrorTooMany=Dados demais a serem visualizados.
+ScOutlookErrorUnknown=O plug-in causou um erro desconhecido.\nPara maiores informa\u00E7\u00F5es, favor consultar o relat\u00F3rio de erro.
+ScOutlookTitle=Plug-in ScOutlook
+Scout=EclipseScout
+ScoutHome=Dados pessoais
+SearchButtonPanelTooltip=Inicia busca
+SearchMenu=Procurar
+SearchPartial=Procura parcial
+SecurityNotAllowed=A transac\u00E7\u00E3o foi negada pelo servidor
+Servidor_All=Tudo
+ShowFileErrorText=O ficheiro {0} n\u00E3o pode ser aberto.
+ShowFileErrorTitle=Mostar ficheiro
+SmartFieldInvalidKey=
+SmartFieldTooManyRows=Muitas linhas. Por limite o seu crit\u00E9rio de procura.
+StartupPhaseConfig=Carregar aplicativo...
+StartupPhaseOffline=Preparar ambiente...
+StartupPhaseUpdate=Localizar atualiza\u00E7\u00F5es...
+StoreColumnWidths=Guardar tamanho da coluna
+TableVerificationCoefficient=Coeficiente de correla\u00E7\u00E3o
+TableVerificationSuccessful=Verifica\u00E7\u00E3o da correla\u00E7\u00E3o do banco de dados conclu\u00EDda
+TransferProgressLabel=Recebendo
+TransferProgressTitle=Tranfer\u00EAncia de dados
+Using=Utilizando
+Verify=Verificar
+VerifyOfflineEnvironment=Examinar/instalar
+ViewListLabel=Escolha uma vista
+ViewListTitle=Todas as vistas
+WorkOffline=Trabalhar off-line
+WorkOfflineInfoText="Para trabalhar off-line, favor inserir o endere\u00E7o do servidor de aplicativos no campo ""Servidor"". Normalmente se trata do mesmo endere\u00E7o de acesso \u00E0 rede."
diff --git a/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_ru.properties b/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_ru.properties
index f8cd3de46b..39cc8a0a38 100644
--- a/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_ru.properties
+++ b/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_ru.properties
@@ -1,8 +1,8 @@
-Calendar_itemCont=(\u043C\u0435\u0442\u043A\u0430)
-Calendar_itemFrom=\u043E\u0442
-Calendar_itemUntil=\u0434\u043E
-CopyPasteHint=\u0414\u043B\u044F \u043F\u043E\u0434\u0440\u043E\u0431\u043D\u043E\u0439 \u0438\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u0438, \u043D\u0430\u0436\u043C\u0438\u0442\u0435 \u043A\u043D\u043E\u043F\u043A\u0443 '\u041A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C' \u0438 \u0437\u0430\u0442\u0435\u043C '\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u044C' \u0432 \u0442\u0435\u043A\u0441\u0442\u043E\u0432\u043E\u043C \u0440\u0435\u0434\u0430\u043A\u0442\u043E\u0440\u0435
-DisplayedTimerange=\u041E\u0442\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u043D\u044B\u0439 \u0432\u0440\u0435\u043C\u0435\u043D\u043D\u043E\u0439 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D
-DoubleWeek=\u0414\u0432\u043E\u0439\u043D\u0430\u044F \u043D\u0435\u0434\u0435\u043B\u044F
-InvolvedPersons=\u0412\u043E\u0432\u043B\u0435\u0447\u0435\u043D\u043D\u044B\u0435 \u043B\u0438\u0446\u0430
-LotusNotesCode=Lotus Notes
+Calendar_itemCont=(\u043C\u0435\u0442\u043A\u0430)
+Calendar_itemFrom=\u043E\u0442
+Calendar_itemUntil=\u0434\u043E
+CopyPasteHint=\u0414\u043B\u044F \u043F\u043E\u0434\u0440\u043E\u0431\u043D\u043E\u0439 \u0438\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u0438, \u043D\u0430\u0436\u043C\u0438\u0442\u0435 \u043A\u043D\u043E\u043F\u043A\u0443 '\u041A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C' \u0438 \u0437\u0430\u0442\u0435\u043C '\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u044C' \u0432 \u0442\u0435\u043A\u0441\u0442\u043E\u0432\u043E\u043C \u0440\u0435\u0434\u0430\u043A\u0442\u043E\u0440\u0435
+DisplayedTimerange=\u041E\u0442\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u043D\u044B\u0439 \u0432\u0440\u0435\u043C\u0435\u043D\u043D\u043E\u0439 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D
+DoubleWeek=\u0414\u0432\u043E\u0439\u043D\u0430\u044F \u043D\u0435\u0434\u0435\u043B\u044F
+InvolvedPersons=\u0412\u043E\u0432\u043B\u0435\u0447\u0435\u043D\u043D\u044B\u0435 \u043B\u0438\u0446\u0430
+LotusNotesCode=Lotus Notes
diff --git a/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_se.properties b/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_se.properties
index 31d4ca1f6e..68ee84fca7 100644
--- a/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_se.properties
+++ b/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_se.properties
@@ -1,8 +1,8 @@
-Calendar_itemCont=(tag)
-Calendar_itemFrom=Fr\u00E5n
-Calendar_itemUntil=tills
-CopyPasteHint=(F\u00F6r detaljerad information, klicka p\u00E5 Kopiera knappen och Klistra in i textredigeraren.
-DisplayedTimerange=Visad tidsintervall
-DoubleWeek=Dubbel vecka
-InvolvedPersons=Involverade personer
-LotusNotesCode=Lotus Notes
+Calendar_itemCont=(tag)
+Calendar_itemFrom=Fr\u00E5n
+Calendar_itemUntil=tills
+CopyPasteHint=(F\u00F6r detaljerad information, klicka p\u00E5 Kopiera knappen och Klistra in i textredigeraren.
+DisplayedTimerange=Visad tidsintervall
+DoubleWeek=Dubbel vecka
+InvolvedPersons=Involverade personer
+LotusNotesCode=Lotus Notes
diff --git a/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_sk.properties b/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_sk.properties
index 3b8a7fd2c6..42fe500e3e 100644
--- a/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_sk.properties
+++ b/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_sk.properties
@@ -1,86 +1,86 @@
-AutomaticallyStopAfterFirstFetch=Uskuto\u010Dni\u0165 iba prv\u00E9 na\u010D\u00EDtanie
-Calendar_itemCont=(Pokr.)
-Calendar_itemFrom=Z
-Calendar_itemUntil=po
-CouldNotCreateOfflineDirectory=Nem\u00F4\u017Eem vytvori\u0165 miestny adres\u00E1r\:
-CouldNotFindOfflineClasses=Nem\u00F4\u017Eem n\u00E1js\u0165 prostredie off-line
-CouldNotFindOfflineConfig=Nem\u00F4\u017Eem n\u00E1js\u0165 konfigur\u00E1ciu off-line
-CouldNotFindOfflineDatabase=Nem\u00F4\u017Eem n\u00E1js\u0165 miestnu datab\u00E1zu
-DownloadOfflineDatabase=Chcete prevzia\u0165 datab\u00E1zu?
-EditMenu=Upravi\u0165...
-EndStatus=Kone\u010Dn\u00FD stav
-ErrorReadingOfflineTable=Chyba pri \u010D\u00EDtan\u00ED tabu\u013Eky off-line
-ErrorReadingOnlineTable=Chyba pri \u010D\u00EDtan\u00ED tabu\u013Eky servera
-EstimatedEndDate=Dokon\u010Den\u00E9
-ExtendedSearchSaveButton=Prida\u0165
-FailedDownloadingFile=Nem\u00F4\u017Eem prevzia\u0165 s\u00FAbor
-FailedGettingOfflineTableVerification=Ne\u00FAspe\u0161n\u00E9 overenie tabu\u013Eky off-line
-FailedGettingOnlineTableVerification=Ne\u00FAspe\u0161n\u00E9 overenie tabu\u013Eky na serveri
-Field=Pole
-Fields=Polia
-HtmlPluginActionSubmitted=Akcia bola vykonan\u00E1.
-HtmlPluginChangesSaved=Zmeny boli ulo\u017Een\u00E9.
-HtmlPluginPendingAction=V n\u00E1stroji u\u017E m\u00E1te otvoren\u00FA kontextov\u00E9 okno. Najprv ho zatvorte a sk\u00FAste znova.
-HtmlPopupInfoPanel=V n\u00E1stroji bolo otvoren\u00E9 kontextov\u00E9 okno
-InvolvedPersons=Zahrnut\u00E9 osoby
-LiveEdit=Upravi\u0165 na\u017Eivo
-LotusNotesCode=Lotus Notes
-MissingOfflineTable=Ch\u00FDbaj\u00FAca tabu\u013Eka off-line
-MissingOnlineTable=Ch\u00FDbaj\u00FAca tabu\u013Eka na serveri
-Offline=Off-line
-OfflineAdmin=Spr\u00E1vca off-line
-OfflineDirectory=Miestny adres\u00E1r
-OfflineInstallationInvalidMessage=T\u00E1to in\u0161tal\u00E1cia off-line je ne\u00FApln\u00E1
-OfflineInstallationValidMessage=T\u00E1to in\u0161tal\u00E1cia off-line je pripraven\u00E1 a skon\u010Den\u00E1
-OfflineMasterServer=Server on-line
-OfflineReplicationInvalidMessage=Replik\u00E1cia sa nedala vykona\u0165
-OfflineSetup=Nastavenie prostredia off-line
-Operator=Oper\u00E1tor
-Operators=Oper\u00E1tori
-PleaseCheckOfflineDirectory=Skontrolujte adres\u00E1r off-line
-Programmed=QA
-RepDone=Ok
-RepEndDate=Dokon\u010Den\u00E9
-RepGetServerUpdate=Prij\u00EDmaj\u00FA sa \u00FAdaje zo servera...
-RepNextExtract=Pr\u00EDprava d\u00E1t...
-RepProgCommit=Potvrdi\u0165
-RepProgExtract=Extrahova\u0165
-RepProgSync=V\u00FDmena d\u00E1t
-RepProgUpdate=Aktualiz\u00E1cia
-RepStartDate=\u0160tart
-Replicate=Replikova\u0165
-ReplicationStatus=Stav replik\u00E1cie
-ResetPasswordUserHasNoLoginName=Vybran\u00E1 osoba nem\u00E1 platn\u00E9 prihlasovacie meno.
-ResultOfTableVerification=V\u00FDsledok kontroly datab\u00E1zy
-Row=Z\u00E1znam
-RowCountDifferenceOnTable=Rozdiel v po\u010Dte d\u00E1tov\u00FDch z\u00E1znamov
-SWUpdateMsg10=Chyba pri tvorbe z\u00E1lohy a in\u0161tal\u00E1cii\:
-SWUpdateMsg1=K dispoz\u00EDcii je aktualiz\u00E1cia softv\u00E9ru.\nVa\u0161a in\u0161tala\u010Dn\u00E1 verzia je\: \#OLD\#\nNov\u00ED verzia je\: \#NEW\#
-SWUpdateMsg2=Chcete in\u0161talova\u0165 aktualiz\u00E1ciu?
-SWUpdateMsg3a=Aktualiz\u00E1cia softv\u00E9ru bola \u00FAspe\u0161ne prevzat\u00E1.\nT\u00E1to aktualiz\u00E1cia bude pou\u017Eit\u00E1 pri najbli\u017E\u0161om spusten\u00ED aplik\u00E1cie.
-SWUpdateMsg4=Nie je k dispoz\u00EDcii sie\u0165ov\u00E9 prepojenie s aktualiza\u010Dn\u00FDm serverom
-SWUpdateMsg5=Nebola zisten\u00E1 verzia na serveri
-SWUpdateMsg6=In\u0161tal\u00E1cia je aktu\u00E1lna.
-SWUpdateMsg7=Aktualiz\u00E1cia softv\u00E9ru bola zru\u0161en\u00E1
-SWUpdateMsg8=Nem\u00F4\u017Eem n\u00E1js\u0165 adres\u00E1r lib so s\u00FAbormi jar\:
-SWUpdateMsg9=Nov\u00E9 s\u00FAbory neboli prevzat\u00E9 zo servera
-SaveAndLoopback=Sp\u00E4tn\u00E1 slu\u010Dka a ulo\u017Ei\u0165
-ScOutlookErrorCache=Z\u00E1suvn\u00FD modul nemohol vytvori\u0165 vyrovn\u00E1vaciuj pam\u00E4\u0165.\nBola vynechan\u00E1 synchroniz\u00E1cia v\u0161etk\u00FDch '{0}'.\nSkontrolujte konfigur\u00E1ciu aplik\u00E1cie Outlook.
-ScOutlookErrorGeneral=Z\u00E1suvn\u00FD modul nemohol inicializova\u0165 aplik\u00E1ciu Outlook.\nSkontrolujte konfigur\u00E1ciu aplik\u00E1cie Outlook.\nAk probl\u00E9m pretrv\u00E1va na\u010Falej, obr\u00E1\u0165te sa s prosbou\no pomoc na BSI.
-ScOutlookErrorPartial=Z\u00E1suvn\u00FD modul nemohol zosynchronizova\u0165 niektor\u00E9 z\u00E1znamy.\nNasleduj\u00FAce z\u00E1znamy boli vynechan\u00E9\:\n{0}
-ScOutlookErrorTooMany=Pr\u00EDli\u0161 ve\u013Ea z\u00E1znamov na zobrazenie.
-ScOutlookErrorUnknown=Z\u00E1suvn\u00FD modul sp\u00F4sobil neur\u010Den\u00FA chybu.\nBli\u017E\u0161ie inform\u00E1cie n\u00E1jdete v denn\u00EDku ch\u00FDb.
-ScOutlookTitle=ScOutlook Plugin
-Scout=EclipseScout
-SearchButtonPanelTooltip=Sp\u00FA\u0161\u0165a sa vyh\u013Ead\u00E1vanie
-Servidor_All=V\u0161etky
-SmartFieldInvalidKey=
-StartupPhaseConfig=Zav\u00E1dzam aplik\u00E1ciu...
-StartupPhaseOffline=Pr\u00EDprava prostredia...
-StartupPhaseUpdate=H\u013Eadanie aktualiz\u00E1ci\u00ED...
-TableVerificationCoefficient=Korela\u010Dn\u00FD koeficient
-TableVerificationSuccessful=Korela\u010Dn\u00E1 kontrola datab\u00E1zy dokon\u010Den\u00E1
-Using=Pou\u017E\u00EDva sa
-VerifyOfflineEnvironment=Overi\u0165/nain\u0161talova\u0165
-WorkOffline=Pracova\u0165 off-line
-WorkOfflineInfoText=Na umo\u017Enenie pr\u00E1ce v re\u017Eime off-line zadajte URL aplika\u010Dn\u00E9ho servera do po\u013Ea \u201EServer\u201C. Oby\u010Dajne je to ten ist\u00FD prihlasovac\u00ED URL pri pr\u00E1ci v re\u017Eime on-line.
+AutomaticallyStopAfterFirstFetch=Uskuto\u010Dni\u0165 iba prv\u00E9 na\u010D\u00EDtanie
+Calendar_itemCont=(Pokr.)
+Calendar_itemFrom=Z
+Calendar_itemUntil=po
+CouldNotCreateOfflineDirectory=Nem\u00F4\u017Eem vytvori\u0165 miestny adres\u00E1r\:
+CouldNotFindOfflineClasses=Nem\u00F4\u017Eem n\u00E1js\u0165 prostredie off-line
+CouldNotFindOfflineConfig=Nem\u00F4\u017Eem n\u00E1js\u0165 konfigur\u00E1ciu off-line
+CouldNotFindOfflineDatabase=Nem\u00F4\u017Eem n\u00E1js\u0165 miestnu datab\u00E1zu
+DownloadOfflineDatabase=Chcete prevzia\u0165 datab\u00E1zu?
+EditMenu=Upravi\u0165...
+EndStatus=Kone\u010Dn\u00FD stav
+ErrorReadingOfflineTable=Chyba pri \u010D\u00EDtan\u00ED tabu\u013Eky off-line
+ErrorReadingOnlineTable=Chyba pri \u010D\u00EDtan\u00ED tabu\u013Eky servera
+EstimatedEndDate=Dokon\u010Den\u00E9
+ExtendedSearchSaveButton=Prida\u0165
+FailedDownloadingFile=Nem\u00F4\u017Eem prevzia\u0165 s\u00FAbor
+FailedGettingOfflineTableVerification=Ne\u00FAspe\u0161n\u00E9 overenie tabu\u013Eky off-line
+FailedGettingOnlineTableVerification=Ne\u00FAspe\u0161n\u00E9 overenie tabu\u013Eky na serveri
+Field=Pole
+Fields=Polia
+HtmlPluginActionSubmitted=Akcia bola vykonan\u00E1.
+HtmlPluginChangesSaved=Zmeny boli ulo\u017Een\u00E9.
+HtmlPluginPendingAction=V n\u00E1stroji u\u017E m\u00E1te otvoren\u00FA kontextov\u00E9 okno. Najprv ho zatvorte a sk\u00FAste znova.
+HtmlPopupInfoPanel=V n\u00E1stroji bolo otvoren\u00E9 kontextov\u00E9 okno
+InvolvedPersons=Zahrnut\u00E9 osoby
+LiveEdit=Upravi\u0165 na\u017Eivo
+LotusNotesCode=Lotus Notes
+MissingOfflineTable=Ch\u00FDbaj\u00FAca tabu\u013Eka off-line
+MissingOnlineTable=Ch\u00FDbaj\u00FAca tabu\u013Eka na serveri
+Offline=Off-line
+OfflineAdmin=Spr\u00E1vca off-line
+OfflineDirectory=Miestny adres\u00E1r
+OfflineInstallationInvalidMessage=T\u00E1to in\u0161tal\u00E1cia off-line je ne\u00FApln\u00E1
+OfflineInstallationValidMessage=T\u00E1to in\u0161tal\u00E1cia off-line je pripraven\u00E1 a skon\u010Den\u00E1
+OfflineMasterServer=Server on-line
+OfflineReplicationInvalidMessage=Replik\u00E1cia sa nedala vykona\u0165
+OfflineSetup=Nastavenie prostredia off-line
+Operator=Oper\u00E1tor
+Operators=Oper\u00E1tori
+PleaseCheckOfflineDirectory=Skontrolujte adres\u00E1r off-line
+Programmed=QA
+RepDone=Ok
+RepEndDate=Dokon\u010Den\u00E9
+RepGetServerUpdate=Prij\u00EDmaj\u00FA sa \u00FAdaje zo servera...
+RepNextExtract=Pr\u00EDprava d\u00E1t...
+RepProgCommit=Potvrdi\u0165
+RepProgExtract=Extrahova\u0165
+RepProgSync=V\u00FDmena d\u00E1t
+RepProgUpdate=Aktualiz\u00E1cia
+RepStartDate=\u0160tart
+Replicate=Replikova\u0165
+ReplicationStatus=Stav replik\u00E1cie
+ResetPasswordUserHasNoLoginName=Vybran\u00E1 osoba nem\u00E1 platn\u00E9 prihlasovacie meno.
+ResultOfTableVerification=V\u00FDsledok kontroly datab\u00E1zy
+Row=Z\u00E1znam
+RowCountDifferenceOnTable=Rozdiel v po\u010Dte d\u00E1tov\u00FDch z\u00E1znamov
+SWUpdateMsg10=Chyba pri tvorbe z\u00E1lohy a in\u0161tal\u00E1cii\:
+SWUpdateMsg1=K dispoz\u00EDcii je aktualiz\u00E1cia softv\u00E9ru.\nVa\u0161a in\u0161tala\u010Dn\u00E1 verzia je\: \#OLD\#\nNov\u00ED verzia je\: \#NEW\#
+SWUpdateMsg2=Chcete in\u0161talova\u0165 aktualiz\u00E1ciu?
+SWUpdateMsg3a=Aktualiz\u00E1cia softv\u00E9ru bola \u00FAspe\u0161ne prevzat\u00E1.\nT\u00E1to aktualiz\u00E1cia bude pou\u017Eit\u00E1 pri najbli\u017E\u0161om spusten\u00ED aplik\u00E1cie.
+SWUpdateMsg4=Nie je k dispoz\u00EDcii sie\u0165ov\u00E9 prepojenie s aktualiza\u010Dn\u00FDm serverom
+SWUpdateMsg5=Nebola zisten\u00E1 verzia na serveri
+SWUpdateMsg6=In\u0161tal\u00E1cia je aktu\u00E1lna.
+SWUpdateMsg7=Aktualiz\u00E1cia softv\u00E9ru bola zru\u0161en\u00E1
+SWUpdateMsg8=Nem\u00F4\u017Eem n\u00E1js\u0165 adres\u00E1r lib so s\u00FAbormi jar\:
+SWUpdateMsg9=Nov\u00E9 s\u00FAbory neboli prevzat\u00E9 zo servera
+SaveAndLoopback=Sp\u00E4tn\u00E1 slu\u010Dka a ulo\u017Ei\u0165
+ScOutlookErrorCache=Z\u00E1suvn\u00FD modul nemohol vytvori\u0165 vyrovn\u00E1vaciuj pam\u00E4\u0165.\nBola vynechan\u00E1 synchroniz\u00E1cia v\u0161etk\u00FDch '{0}'.\nSkontrolujte konfigur\u00E1ciu aplik\u00E1cie Outlook.
+ScOutlookErrorGeneral=Z\u00E1suvn\u00FD modul nemohol inicializova\u0165 aplik\u00E1ciu Outlook.\nSkontrolujte konfigur\u00E1ciu aplik\u00E1cie Outlook.\nAk probl\u00E9m pretrv\u00E1va na\u010Falej, obr\u00E1\u0165te sa s prosbou\no pomoc na BSI.
+ScOutlookErrorPartial=Z\u00E1suvn\u00FD modul nemohol zosynchronizova\u0165 niektor\u00E9 z\u00E1znamy.\nNasleduj\u00FAce z\u00E1znamy boli vynechan\u00E9\:\n{0}
+ScOutlookErrorTooMany=Pr\u00EDli\u0161 ve\u013Ea z\u00E1znamov na zobrazenie.
+ScOutlookErrorUnknown=Z\u00E1suvn\u00FD modul sp\u00F4sobil neur\u010Den\u00FA chybu.\nBli\u017E\u0161ie inform\u00E1cie n\u00E1jdete v denn\u00EDku ch\u00FDb.
+ScOutlookTitle=ScOutlook Plugin
+Scout=EclipseScout
+SearchButtonPanelTooltip=Sp\u00FA\u0161\u0165a sa vyh\u013Ead\u00E1vanie
+Servidor_All=V\u0161etky
+SmartFieldInvalidKey=
+StartupPhaseConfig=Zav\u00E1dzam aplik\u00E1ciu...
+StartupPhaseOffline=Pr\u00EDprava prostredia...
+StartupPhaseUpdate=H\u013Eadanie aktualiz\u00E1ci\u00ED...
+TableVerificationCoefficient=Korela\u010Dn\u00FD koeficient
+TableVerificationSuccessful=Korela\u010Dn\u00E1 kontrola datab\u00E1zy dokon\u010Den\u00E1
+Using=Pou\u017E\u00EDva sa
+VerifyOfflineEnvironment=Overi\u0165/nain\u0161talova\u0165
+WorkOffline=Pracova\u0165 off-line
+WorkOfflineInfoText=Na umo\u017Enenie pr\u00E1ce v re\u017Eime off-line zadajte URL aplika\u010Dn\u00E9ho servera do po\u013Ea \u201EServer\u201C. Oby\u010Dajne je to ten ist\u00FD prihlasovac\u00ED URL pri pr\u00E1ci v re\u017Eime on-line.
diff --git a/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_sl.properties b/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_sl.properties
index 6923e80283..ced1e5aeac 100644
--- a/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_sl.properties
+++ b/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_sl.properties
@@ -1 +1 @@
-LotusNotesCode=Lotus Notes
+LotusNotesCode=Lotus Notes
diff --git a/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_sr.properties b/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_sr.properties
index 5093e4c2a8..b73c8c8153 100644
--- a/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_sr.properties
+++ b/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_sr.properties
@@ -1,8 +1,8 @@
-Calendar_itemCont=(markica)
-Calendar_itemFrom=Iz,od
-Calendar_itemUntil=do
-CopyPasteHint=Za detaljnije informacije pritisni Kopirajtaster i prenesi u tekst editor.
-DisplayedTimerange=Prikazan vremenski raspon
-DoubleWeek=Dupla nedelja
-InvolvedPersons=Uklju\u010Dene osobe
-LotusNotesCode=Lotus notes
+Calendar_itemCont=(markica)
+Calendar_itemFrom=Iz,od
+Calendar_itemUntil=do
+CopyPasteHint=Za detaljnije informacije pritisni Kopirajtaster i prenesi u tekst editor.
+DisplayedTimerange=Prikazan vremenski raspon
+DoubleWeek=Dupla nedelja
+InvolvedPersons=Uklju\u010Dene osobe
+LotusNotesCode=Lotus notes
diff --git a/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_tr.properties b/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_tr.properties
index 81187e5829..6df4a831a8 100644
--- a/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_tr.properties
+++ b/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_tr.properties
@@ -1,9 +1,9 @@
-Calendar_itemCont=(etiket)
-Calendar_itemFrom=dan
-Calendar_itemUntil=e kadar
-CopyPasteHint=(Detayl\u0131 bilgi i\u00E7in 'Kopyala' ya bas ve metin edit\u00F6r\u00FCne 'Yap\u0131\u015Ft\u0131r')
-DisplayedTimerange=Zaman aral\u0131\u011F\u0131 g\u00F6r\u00FCnt\u00FCle
-DoubleWeek=\u00E7ift hafta
-InvolvedPersons=\u0130lgili ki\u015Filer
-Kural=\n- en az 8 karakter\n- en az bir rakam (0-9)\n- en az bir noktalama i\u015Fareti (\!|@|\#|$|%|^|&|*|(|)|_|+|||~|-|
-LotusNotesCode=Lotus Notes
+Calendar_itemCont=(etiket)
+Calendar_itemFrom=dan
+Calendar_itemUntil=e kadar
+CopyPasteHint=(Detayl\u0131 bilgi i\u00E7in 'Kopyala' ya bas ve metin edit\u00F6r\u00FCne 'Yap\u0131\u015Ft\u0131r')
+DisplayedTimerange=Zaman aral\u0131\u011F\u0131 g\u00F6r\u00FCnt\u00FCle
+DoubleWeek=\u00E7ift hafta
+InvolvedPersons=\u0130lgili ki\u015Filer
+Kural=\n- en az 8 karakter\n- en az bir rakam (0-9)\n- en az bir noktalama i\u015Fareti (\!|@|\#|$|%|^|&|*|(|)|_|+|||~|-|
+LotusNotesCode=Lotus Notes
diff --git a/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_zh.properties b/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_zh.properties
index b27710aaee..d9c83cf283 100644
--- a/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_zh.properties
+++ b/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_zh.properties
@@ -1,8 +1,8 @@
-Calendar_itemCont=(\u6807\u7B7E)
-Calendar_itemFrom=\u4ECE
-Calendar_itemUntil=\u76F4\u81F3
-CopyPasteHint=(\u66F4\u591A\u8BE6\u5C3D\u4FE1\u606F\uFF0C\u9009\u62E9\u6587\u672C\u7F16\u8F91\u4E2D\u7684\u201C\u590D\u5236\u201D\u53CA\u201C\u7C98\u8D34\u201D\u6309\u94AE\u3002\uFF09
-DisplayedTimerange=\u663E\u793A\u65F6\u95F4\u8303\u56F4
-DoubleWeek=\u53CC\u5468
-InvolvedPersons=\u76F8\u5173\u4EBA\u5458
-LotusNotesCode=Lotus Notes
+Calendar_itemCont=(\u6807\u7B7E)
+Calendar_itemFrom=\u4ECE
+Calendar_itemUntil=\u76F4\u81F3
+CopyPasteHint=(\u66F4\u591A\u8BE6\u5C3D\u4FE1\u606F\uFF0C\u9009\u62E9\u6587\u672C\u7F16\u8F91\u4E2D\u7684\u201C\u590D\u5236\u201D\u53CA\u201C\u7C98\u8D34\u201D\u6309\u94AE\u3002\uFF09
+DisplayedTimerange=\u663E\u793A\u65F6\u95F4\u8303\u56F4
+DoubleWeek=\u53CC\u5468
+InvolvedPersons=\u76F8\u5173\u4EBA\u5458
+LotusNotesCode=Lotus Notes
diff --git a/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_zh_TW.properties b/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_zh_TW.properties
index 21e999cbb4..d2fb996560 100644
--- a/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_zh_TW.properties
+++ b/org.eclipse.scout.rt.shared.legacy.texts.fragment/resources/texts/LegacyScoutTexts_zh_TW.properties
@@ -1,8 +1,8 @@
-Calendar_itemCont=\u6A19\u7C64
-Calendar_itemFrom=\u5F9E
-Calendar_itemUntil=\u76F4\u5230
-CopyPasteHint=\u8ACB\u6309\u8907\u88FD\u53CA\u8CBC\u4E0A\u6309\u9215\u4F86\u627E\u5C0B\u8A73\u7D30\u8CC7\u6599
-DisplayedTimerange=\u986F\u793A\u6642\u9593\u7BC4\u570D
-DoubleWeek=Double week
-InvolvedPersons=Involved persons
-LotusNotesCode=Lotus Notes
+Calendar_itemCont=\u6A19\u7C64
+Calendar_itemFrom=\u5F9E
+Calendar_itemUntil=\u76F4\u5230
+CopyPasteHint=\u8ACB\u6309\u8907\u88FD\u53CA\u8CBC\u4E0A\u6309\u9215\u4F86\u627E\u5C0B\u8A73\u7D30\u8CC7\u6599
+DisplayedTimerange=\u986F\u793A\u6642\u9593\u7BC4\u570D
+DoubleWeek=Double week
+InvolvedPersons=Involved persons
+LotusNotesCode=Lotus Notes
diff --git a/org.eclipse.scout.rt.shared.legacy.texts.fragment/src/org/eclipse/scout/rt/shared/legacy/texts/services/common/text/ScoutLegacyTextProviderService.java b/org.eclipse.scout.rt.shared.legacy.texts.fragment/src/org/eclipse/scout/rt/shared/legacy/texts/services/common/text/ScoutLegacyTextProviderService.java
index 49434fa658..c240de1a00 100644
--- a/org.eclipse.scout.rt.shared.legacy.texts.fragment/src/org/eclipse/scout/rt/shared/legacy/texts/services/common/text/ScoutLegacyTextProviderService.java
+++ b/org.eclipse.scout.rt.shared.legacy.texts.fragment/src/org/eclipse/scout/rt/shared/legacy/texts/services/common/text/ScoutLegacyTextProviderService.java
@@ -1,23 +1,23 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.legacy.texts.services.common.text;
-
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.rt.shared.services.common.text.AbstractDynamicNlsTextProviderService;
-
-@Priority(-200.0f)
-public class ScoutLegacyTextProviderService extends AbstractDynamicNlsTextProviderService {
-
- @Override
- protected String getDynamicNlsBaseName() {
- return "resources.texts.LegacyScoutTexts";//$NON-NLS-1$
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.legacy.texts.services.common.text;
+
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.rt.shared.services.common.text.AbstractDynamicNlsTextProviderService;
+
+@Priority(-200.0f)
+public class ScoutLegacyTextProviderService extends AbstractDynamicNlsTextProviderService {
+
+ @Override
+ protected String getDynamicNlsBaseName() {
+ return "resources.texts.LegacyScoutTexts";//$NON-NLS-1$
+ }
+}
diff --git a/org.eclipse.scout.rt.shared.test/.project b/org.eclipse.scout.rt.shared.test/.project
index badd370f4a..b75f42fef6 100644
--- a/org.eclipse.scout.rt.shared.test/.project
+++ b/org.eclipse.scout.rt.shared.test/.project
@@ -1,34 +1,34 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.scout.rt.shared.test</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>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>
- </natures>
-</projectDescription>
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.scout.rt.shared.test</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>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>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.scout.rt.shared.test/.settings/de.loskutov.anyedit.AnyEditTools.prefs b/org.eclipse.scout.rt.shared.test/.settings/de.loskutov.anyedit.AnyEditTools.prefs
index 855107fbda..a651cd29e7 100644
--- a/org.eclipse.scout.rt.shared.test/.settings/de.loskutov.anyedit.AnyEditTools.prefs
+++ b/org.eclipse.scout.rt.shared.test/.settings/de.loskutov.anyedit.AnyEditTools.prefs
@@ -1,15 +1,15 @@
-activeContentFilterList=*.makefile,makefile,*.Makefile,Makefile,Makefile.*,*.mk,MANIFEST.MF
-addNewLine=true
-convertActionOnSaave=AnyEdit.CnvrtTabToSpaces
-eclipse.preferences.version=1
-inActiveContentFilterList=
-javaTabWidthForJava=true
-org.eclipse.jdt.ui.editor.tab.width=2
-projectPropsEnabled=true
-removeTrailingSpaces=true
-replaceAllSpaces=false
-replaceAllTabs=true
-saveAndAddLine=true
-saveAndConvert=true
-saveAndTrim=true
-useModulo4Tabs=false
+activeContentFilterList=*.makefile,makefile,*.Makefile,Makefile,Makefile.*,*.mk,MANIFEST.MF
+addNewLine=true
+convertActionOnSaave=AnyEdit.CnvrtTabToSpaces
+eclipse.preferences.version=1
+inActiveContentFilterList=
+javaTabWidthForJava=true
+org.eclipse.jdt.ui.editor.tab.width=2
+projectPropsEnabled=true
+removeTrailingSpaces=true
+replaceAllSpaces=false
+replaceAllTabs=true
+saveAndAddLine=true
+saveAndConvert=true
+saveAndTrim=true
+useModulo4Tabs=false
diff --git a/org.eclipse.scout.rt.shared.test/.settings/org.eclipse.core.resources.prefs b/org.eclipse.scout.rt.shared.test/.settings/org.eclipse.core.resources.prefs
index 4824b80263..99f26c0203 100644
--- a/org.eclipse.scout.rt.shared.test/.settings/org.eclipse.core.resources.prefs
+++ b/org.eclipse.scout.rt.shared.test/.settings/org.eclipse.core.resources.prefs
@@ -1,2 +1,2 @@
-eclipse.preferences.version=1
-encoding/<project>=UTF-8
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/org.eclipse.scout.rt.shared.test/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.scout.rt.shared.test/.settings/org.eclipse.jdt.core.prefs
index 891b4633a6..61b49c5b93 100644
--- a/org.eclipse.scout.rt.shared.test/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.scout.rt.shared.test/.settings/org.eclipse.jdt.core.prefs
@@ -1,371 +1,371 @@
-eclipse.preferences.version=1
-org.eclipse.jdt.core.codeComplete.argumentPrefixes=
-org.eclipse.jdt.core.codeComplete.argumentSuffixes=
-org.eclipse.jdt.core.codeComplete.fieldPrefixes=m_
-org.eclipse.jdt.core.codeComplete.fieldSuffixes=
-org.eclipse.jdt.core.codeComplete.localPrefixes=
-org.eclipse.jdt.core.codeComplete.localSuffixes=
-org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
-org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
-org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
-org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.6
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
-org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
-org.eclipse.jdt.core.compiler.problem.deadCode=warning
-org.eclipse.jdt.core.compiler.problem.deprecation=warning
-org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=enabled
-org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
-org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
-org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
-org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
-org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
-org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
-org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
-org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
-org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
-org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
-org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
-org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
-org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
-org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
-org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
-org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
-org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
-org.eclipse.jdt.core.compiler.problem.nullReference=warning
-org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
-org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
-org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
-org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
-org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
-org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
-org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
-org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
-org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
-org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
-org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
-org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
-org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
-org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
-org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.unusedImport=warning
-org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
-org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
-org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=disabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
-org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=ignore
-org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.6
-org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=0
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=0
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=0
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=0
-org.eclipse.jdt.core.formatter.alignment_for_assignment=0
-org.eclipse.jdt.core.formatter.alignment_for_binary_expression=0
-org.eclipse.jdt.core.formatter.alignment_for_compact_if=0
-org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0
-org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
-org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=0
-org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
-org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0
-org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
-org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
-org.eclipse.jdt.core.formatter.blank_lines_after_package=1
-org.eclipse.jdt.core.formatter.blank_lines_before_field=0
-org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
-org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
-org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
-org.eclipse.jdt.core.formatter.blank_lines_before_method=1
-org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
-org.eclipse.jdt.core.formatter.blank_lines_before_package=0
-org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
-org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
-org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=true
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=true
-org.eclipse.jdt.core.formatter.comment.format_block_comments=false
-org.eclipse.jdt.core.formatter.comment.format_header=false
-org.eclipse.jdt.core.formatter.comment.format_html=true
-org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
-org.eclipse.jdt.core.formatter.comment.format_line_comments=false
-org.eclipse.jdt.core.formatter.comment.format_source_code=true
-org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
-org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
-org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
-org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
-org.eclipse.jdt.core.formatter.comment.line_length=120
-org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
-org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
-org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
-org.eclipse.jdt.core.formatter.compact_else_if=true
-org.eclipse.jdt.core.formatter.continuation_indentation=2
-org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
-org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
-org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
-org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
-org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
-org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_empty_lines=false
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
-org.eclipse.jdt.core.formatter.indentation.size=2
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
-org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
-org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.join_lines_in_comments=false
-org.eclipse.jdt.core.formatter.join_wrapped_lines=false
-org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=true
-org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=true
-org.eclipse.jdt.core.formatter.lineSplit=9999
-org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true
-org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true
-org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
-org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
-org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
-org.eclipse.jdt.core.formatter.tabulation.char=space
-org.eclipse.jdt.core.formatter.tabulation.size=2
-org.eclipse.jdt.core.formatter.use_on_off_tags=false
-org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=true
-org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
-org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
-org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
+eclipse.preferences.version=1
+org.eclipse.jdt.core.codeComplete.argumentPrefixes=
+org.eclipse.jdt.core.codeComplete.argumentSuffixes=
+org.eclipse.jdt.core.codeComplete.fieldPrefixes=m_
+org.eclipse.jdt.core.codeComplete.fieldSuffixes=
+org.eclipse.jdt.core.codeComplete.localPrefixes=
+org.eclipse.jdt.core.codeComplete.localSuffixes=
+org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
+org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
+org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
+org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=enabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=ignore
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=0
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=0
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=0
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=0
+org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=true
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=true
+org.eclipse.jdt.core.formatter.comment.format_block_comments=false
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
+org.eclipse.jdt.core.formatter.comment.format_line_comments=false
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
+org.eclipse.jdt.core.formatter.comment.line_length=120
+org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
+org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
+org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
+org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
+org.eclipse.jdt.core.formatter.indentation.size=2
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.join_lines_in_comments=false
+org.eclipse.jdt.core.formatter.join_wrapped_lines=false
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=true
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=true
+org.eclipse.jdt.core.formatter.lineSplit=9999
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
+org.eclipse.jdt.core.formatter.tabulation.char=space
+org.eclipse.jdt.core.formatter.tabulation.size=2
+org.eclipse.jdt.core.formatter.use_on_off_tags=false
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=true
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
diff --git a/org.eclipse.scout.rt.shared.test/.settings/org.eclipse.jdt.ui.prefs b/org.eclipse.scout.rt.shared.test/.settings/org.eclipse.jdt.ui.prefs
index 4fc999886d..acde688805 100644
--- a/org.eclipse.scout.rt.shared.test/.settings/org.eclipse.jdt.ui.prefs
+++ b/org.eclipse.scout.rt.shared.test/.settings/org.eclipse.jdt.ui.prefs
@@ -1,115 +1,115 @@
-cleanup.add_default_serial_version_id=true
-cleanup.add_generated_serial_version_id=false
-cleanup.add_missing_annotations=true
-cleanup.add_missing_deprecated_annotations=false
-cleanup.add_missing_methods=false
-cleanup.add_missing_nls_tags=false
-cleanup.add_missing_override_annotations=true
-cleanup.add_missing_override_annotations_interface_methods=true
-cleanup.add_serial_version_id=false
-cleanup.always_use_blocks=true
-cleanup.always_use_parentheses_in_expressions=false
-cleanup.always_use_this_for_non_static_field_access=false
-cleanup.always_use_this_for_non_static_method_access=false
-cleanup.convert_to_enhanced_for_loop=false
-cleanup.correct_indentation=true
-cleanup.format_source_code=true
-cleanup.format_source_code_changes_only=false
-cleanup.make_local_variable_final=true
-cleanup.make_parameters_final=false
-cleanup.make_private_fields_final=true
-cleanup.make_type_abstract_if_missing_method=false
-cleanup.make_variable_declarations_final=false
-cleanup.never_use_blocks=false
-cleanup.never_use_parentheses_in_expressions=true
-cleanup.organize_imports=true
-cleanup.qualify_static_field_accesses_with_declaring_class=false
-cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
-cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=false
-cleanup.qualify_static_member_accesses_with_declaring_class=false
-cleanup.qualify_static_method_accesses_with_declaring_class=false
-cleanup.remove_private_constructors=true
-cleanup.remove_trailing_whitespaces=true
-cleanup.remove_trailing_whitespaces_all=true
-cleanup.remove_trailing_whitespaces_ignore_empty=false
-cleanup.remove_unnecessary_casts=false
-cleanup.remove_unnecessary_nls_tags=false
-cleanup.remove_unused_imports=true
-cleanup.remove_unused_local_variables=false
-cleanup.remove_unused_private_fields=true
-cleanup.remove_unused_private_members=false
-cleanup.remove_unused_private_methods=true
-cleanup.remove_unused_private_types=true
-cleanup.sort_members=false
-cleanup.sort_members_all=false
-cleanup.use_blocks=false
-cleanup.use_blocks_only_for_return_and_throw=false
-cleanup.use_parentheses_in_expressions=false
-cleanup.use_this_for_non_static_field_access=false
-cleanup.use_this_for_non_static_field_access_only_if_necessary=true
-cleanup.use_this_for_non_static_method_access=false
-cleanup.use_this_for_non_static_method_access_only_if_necessary=true
-cleanup_profile=_Eclipse Scout
-cleanup_settings_version=2
-eclipse.preferences.version=1
-editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
-formatter_profile=_Eclipse Scout
-formatter_settings_version=12
-org.eclipse.jdt.ui.exception.name=e
-org.eclipse.jdt.ui.gettersetter.use.is=true
-org.eclipse.jdt.ui.javadoc=true
-org.eclipse.jdt.ui.keywordthis=false
-org.eclipse.jdt.ui.overrideannotation=true
-org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="false" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment"/><template autoinsert\="false" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment"/><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*******************************************************************************&\#13;\r\n * Copyright (c) 2010 BSI Business Systems Integration AG.&\#13;\r\n * All rights reserved. This program and the accompanying materials&\#13;\r\n * are made available under the terms of the Eclipse Public License v1.0&\#13;\r\n * which accompanies this distribution, and is available at&\#13;\r\n * http\://www.eclipse.org/legal/epl-v10.html&\#13;\r\n * &\#13;\r\n * Contributors\:&\#13;\r\n * BSI Business Systems Integration AG - initial API and implementation&\#13;\r\n ******************************************************************************/</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment"/><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="false" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">${body_statement}</template><template autoinsert\="false" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template><template autoinsert\="false" context\="gettercomment_context" deleted\="false" description\="Comment for getter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.gettercomment" name\="gettercomment"/><template autoinsert\="false" context\="settercomment_context" deleted\="false" description\="Comment for setter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.settercomment" name\="settercomment"/><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created JavaScript files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="fieldcomment_context" deleted\="false" description\="Comment for vars" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment"/><template autoinsert\="false" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="false" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.catchblock" name\="catchblock">${exception_var}.printStackTrace();</template><template autoinsert\="false" context\="methodbody_context" deleted\="false" description\="Code in created function stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodbody" name\="methodbody">${body_statement}</template><template autoinsert\="false" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
-sp_cleanup.add_default_serial_version_id=true
-sp_cleanup.add_generated_serial_version_id=false
-sp_cleanup.add_missing_annotations=false
-sp_cleanup.add_missing_deprecated_annotations=false
-sp_cleanup.add_missing_methods=false
-sp_cleanup.add_missing_nls_tags=false
-sp_cleanup.add_missing_override_annotations=false
-sp_cleanup.add_missing_override_annotations_interface_methods=true
-sp_cleanup.add_serial_version_id=false
-sp_cleanup.always_use_blocks=true
-sp_cleanup.always_use_parentheses_in_expressions=false
-sp_cleanup.always_use_this_for_non_static_field_access=false
-sp_cleanup.always_use_this_for_non_static_method_access=false
-sp_cleanup.convert_to_enhanced_for_loop=false
-sp_cleanup.correct_indentation=true
-sp_cleanup.format_source_code=true
-sp_cleanup.format_source_code_changes_only=false
-sp_cleanup.make_local_variable_final=false
-sp_cleanup.make_parameters_final=false
-sp_cleanup.make_private_fields_final=true
-sp_cleanup.make_type_abstract_if_missing_method=false
-sp_cleanup.make_variable_declarations_final=false
-sp_cleanup.never_use_blocks=false
-sp_cleanup.never_use_parentheses_in_expressions=true
-sp_cleanup.on_save_use_additional_actions=true
-sp_cleanup.organize_imports=true
-sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
-sp_cleanup.remove_private_constructors=true
-sp_cleanup.remove_trailing_whitespaces=true
-sp_cleanup.remove_trailing_whitespaces_all=true
-sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
-sp_cleanup.remove_unnecessary_casts=false
-sp_cleanup.remove_unnecessary_nls_tags=true
-sp_cleanup.remove_unused_imports=true
-sp_cleanup.remove_unused_local_variables=false
-sp_cleanup.remove_unused_private_fields=true
-sp_cleanup.remove_unused_private_members=false
-sp_cleanup.remove_unused_private_methods=true
-sp_cleanup.remove_unused_private_types=true
-sp_cleanup.sort_members=false
-sp_cleanup.sort_members_all=false
-sp_cleanup.use_blocks=true
-sp_cleanup.use_blocks_only_for_return_and_throw=false
-sp_cleanup.use_parentheses_in_expressions=false
-sp_cleanup.use_this_for_non_static_field_access=false
-sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
-sp_cleanup.use_this_for_non_static_method_access=false
-sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+cleanup.add_default_serial_version_id=true
+cleanup.add_generated_serial_version_id=false
+cleanup.add_missing_annotations=true
+cleanup.add_missing_deprecated_annotations=false
+cleanup.add_missing_methods=false
+cleanup.add_missing_nls_tags=false
+cleanup.add_missing_override_annotations=true
+cleanup.add_missing_override_annotations_interface_methods=true
+cleanup.add_serial_version_id=false
+cleanup.always_use_blocks=true
+cleanup.always_use_parentheses_in_expressions=false
+cleanup.always_use_this_for_non_static_field_access=false
+cleanup.always_use_this_for_non_static_method_access=false
+cleanup.convert_to_enhanced_for_loop=false
+cleanup.correct_indentation=true
+cleanup.format_source_code=true
+cleanup.format_source_code_changes_only=false
+cleanup.make_local_variable_final=true
+cleanup.make_parameters_final=false
+cleanup.make_private_fields_final=true
+cleanup.make_type_abstract_if_missing_method=false
+cleanup.make_variable_declarations_final=false
+cleanup.never_use_blocks=false
+cleanup.never_use_parentheses_in_expressions=true
+cleanup.organize_imports=true
+cleanup.qualify_static_field_accesses_with_declaring_class=false
+cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=false
+cleanup.qualify_static_member_accesses_with_declaring_class=false
+cleanup.qualify_static_method_accesses_with_declaring_class=false
+cleanup.remove_private_constructors=true
+cleanup.remove_trailing_whitespaces=true
+cleanup.remove_trailing_whitespaces_all=true
+cleanup.remove_trailing_whitespaces_ignore_empty=false
+cleanup.remove_unnecessary_casts=false
+cleanup.remove_unnecessary_nls_tags=false
+cleanup.remove_unused_imports=true
+cleanup.remove_unused_local_variables=false
+cleanup.remove_unused_private_fields=true
+cleanup.remove_unused_private_members=false
+cleanup.remove_unused_private_methods=true
+cleanup.remove_unused_private_types=true
+cleanup.sort_members=false
+cleanup.sort_members_all=false
+cleanup.use_blocks=false
+cleanup.use_blocks_only_for_return_and_throw=false
+cleanup.use_parentheses_in_expressions=false
+cleanup.use_this_for_non_static_field_access=false
+cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+cleanup.use_this_for_non_static_method_access=false
+cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+cleanup_profile=_Eclipse Scout
+cleanup_settings_version=2
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_Eclipse Scout
+formatter_settings_version=12
+org.eclipse.jdt.ui.exception.name=e
+org.eclipse.jdt.ui.gettersetter.use.is=true
+org.eclipse.jdt.ui.javadoc=true
+org.eclipse.jdt.ui.keywordthis=false
+org.eclipse.jdt.ui.overrideannotation=true
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="false" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment"/><template autoinsert\="false" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment"/><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*******************************************************************************&\#13;\r\n * Copyright (c) 2010 BSI Business Systems Integration AG.&\#13;\r\n * All rights reserved. This program and the accompanying materials&\#13;\r\n * are made available under the terms of the Eclipse Public License v1.0&\#13;\r\n * which accompanies this distribution, and is available at&\#13;\r\n * http\://www.eclipse.org/legal/epl-v10.html&\#13;\r\n * &\#13;\r\n * Contributors\:&\#13;\r\n * BSI Business Systems Integration AG - initial API and implementation&\#13;\r\n ******************************************************************************/</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment"/><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="false" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">${body_statement}</template><template autoinsert\="false" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template><template autoinsert\="false" context\="gettercomment_context" deleted\="false" description\="Comment for getter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.gettercomment" name\="gettercomment"/><template autoinsert\="false" context\="settercomment_context" deleted\="false" description\="Comment for setter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.settercomment" name\="settercomment"/><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created JavaScript files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="fieldcomment_context" deleted\="false" description\="Comment for vars" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment"/><template autoinsert\="false" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="false" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.catchblock" name\="catchblock">${exception_var}.printStackTrace();</template><template autoinsert\="false" context\="methodbody_context" deleted\="false" description\="Code in created function stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodbody" name\="methodbody">${body_statement}</template><template autoinsert\="false" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=false
+sp_cleanup.add_missing_deprecated_annotations=false
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=false
+sp_cleanup.add_missing_override_annotations_interface_methods=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=true
+sp_cleanup.format_source_code=true
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=true
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=false
+sp_cleanup.remove_unnecessary_nls_tags=true
+sp_cleanup.remove_unused_imports=true
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=true
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/org.eclipse.scout.rt.shared.test/.settings/org.eclipse.m2e.core.prefs b/org.eclipse.scout.rt.shared.test/.settings/org.eclipse.m2e.core.prefs
index 14b697b7bb..f897a7f1cb 100644
--- a/org.eclipse.scout.rt.shared.test/.settings/org.eclipse.m2e.core.prefs
+++ b/org.eclipse.scout.rt.shared.test/.settings/org.eclipse.m2e.core.prefs
@@ -1,4 +1,4 @@
-activeProfiles=
-eclipse.preferences.version=1
-resolveWorkspaceProjects=true
-version=1
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
diff --git a/org.eclipse.scout.rt.shared.test/.settings/org.eclipse.pde.core.prefs b/org.eclipse.scout.rt.shared.test/.settings/org.eclipse.pde.core.prefs
index baef13dd8c..a3a50fc8da 100644
--- a/org.eclipse.scout.rt.shared.test/.settings/org.eclipse.pde.core.prefs
+++ b/org.eclipse.scout.rt.shared.test/.settings/org.eclipse.pde.core.prefs
@@ -1,3 +1,3 @@
-#Mon Jul 11 16:16:00 CEST 2011
-eclipse.preferences.version=1
-pluginProject.extensions=true
+#Mon Jul 11 16:16:00 CEST 2011
+eclipse.preferences.version=1
+pluginProject.extensions=true
diff --git a/org.eclipse.scout.rt.shared.test/about.html b/org.eclipse.scout.rt.shared.test/about.html
index f47dbddbb8..c258ef55d8 100644
--- a/org.eclipse.scout.rt.shared.test/about.html
+++ b/org.eclipse.scout.rt.shared.test/about.html
@@ -1,28 +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 5, 2006</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>
+<!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 5, 2006</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.scout.rt.shared.test/build.properties b/org.eclipse.scout.rt.shared.test/build.properties
index cbe439e7b5..b3615c7b47 100644
--- a/org.eclipse.scout.rt.shared.test/build.properties
+++ b/org.eclipse.scout.rt.shared.test/build.properties
@@ -1,12 +1,12 @@
-###############################################################################
-# Copyright (c) 2010, 2012 BSI Business Systems Integration AG.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-###############################################################################
-source.. = src/
-bin.includes = META-INF/,\
- .,\
- about.html
-src.includes = about.html
+###############################################################################
+# Copyright (c) 2010, 2012 BSI Business Systems Integration AG.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+###############################################################################
+source.. = src/
+bin.includes = META-INF/,\
+ .,\
+ about.html
+src.includes = about.html
diff --git a/org.eclipse.scout.rt.shared.test/src/org/eclipse/scout/rt/shared/services/lookup/LookupRowTest.java b/org.eclipse.scout.rt.shared.test/src/org/eclipse/scout/rt/shared/services/lookup/LookupRowTest.java
index 24085d12d0..8b383f6a03 100644
--- a/org.eclipse.scout.rt.shared.test/src/org/eclipse/scout/rt/shared/services/lookup/LookupRowTest.java
+++ b/org.eclipse.scout.rt.shared.test/src/org/eclipse/scout/rt/shared/services/lookup/LookupRowTest.java
@@ -1,45 +1,45 @@
-/*******************************************************************************
- * Copyright (c) 2010,2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.lookup;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-public class LookupRowTest {
-
- @Test
- public void testSerializeDeserialize() throws Exception {
- LookupRow row = new LookupRow("key", "text");
-
- ByteArrayOutputStream bout = new ByteArrayOutputStream();
- ObjectOutputStream oout = new ObjectOutputStream(bout);
- oout.writeObject(row);
- oout.close();
-
- byte[] serializedData = bout.toByteArray();
-
- ByteArrayInputStream bin = new ByteArrayInputStream(serializedData);
- ObjectInputStream oin = new ObjectInputStream(bin);
- Object obj = oin.readObject();
- oin.close();
-
- Assert.assertNotNull(obj);
- Assert.assertTrue(obj instanceof LookupRow);
- LookupRow deserializedRow = (LookupRow) obj;
- Assert.assertEquals("key", deserializedRow.getKey());
- Assert.assertEquals("text", deserializedRow.getText());
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010,2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.lookup;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class LookupRowTest {
+
+ @Test
+ public void testSerializeDeserialize() throws Exception {
+ LookupRow row = new LookupRow("key", "text");
+
+ ByteArrayOutputStream bout = new ByteArrayOutputStream();
+ ObjectOutputStream oout = new ObjectOutputStream(bout);
+ oout.writeObject(row);
+ oout.close();
+
+ byte[] serializedData = bout.toByteArray();
+
+ ByteArrayInputStream bin = new ByteArrayInputStream(serializedData);
+ ObjectInputStream oin = new ObjectInputStream(bin);
+ Object obj = oin.readObject();
+ oin.close();
+
+ Assert.assertNotNull(obj);
+ Assert.assertTrue(obj instanceof LookupRow);
+ LookupRow deserializedRow = (LookupRow) obj;
+ Assert.assertEquals("key", deserializedRow.getKey());
+ Assert.assertEquals("text", deserializedRow.getText());
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/.settings/org.eclipse.pde.core.prefs b/org.eclipse.scout.rt.shared/.settings/org.eclipse.pde.core.prefs
index baef13dd8c..a3a50fc8da 100644
--- a/org.eclipse.scout.rt.shared/.settings/org.eclipse.pde.core.prefs
+++ b/org.eclipse.scout.rt.shared/.settings/org.eclipse.pde.core.prefs
@@ -1,3 +1,3 @@
-#Mon Jul 11 16:16:00 CEST 2011
-eclipse.preferences.version=1
-pluginProject.extensions=true
+#Mon Jul 11 16:16:00 CEST 2011
+eclipse.preferences.version=1
+pluginProject.extensions=true
diff --git a/org.eclipse.scout.rt.shared/ReleaseNotes.txt b/org.eclipse.scout.rt.shared/ReleaseNotes.txt
index bdd85f53b6..2c66751a5d 100644
--- a/org.eclipse.scout.rt.shared/ReleaseNotes.txt
+++ b/org.eclipse.scout.rt.shared/ReleaseNotes.txt
@@ -1,189 +1,189 @@
-14.09.2010 imo
-Removed org.eclipse.scout.rt.shared.security.AllAccessPermission since it never worked and is not a valid jaas concept
-Migration:
-replace by java.security.AllPermission
-
-21.12.2010 imo
-Extracted DataModel with entities and attributes out of AbstractComposerField and moved to org.eclipse.scout.rt.shared.data.model
-Migration: None, sometimes organize imports is necessary.
-Legacy: There is legacy support with deprecated AbstractComposerAttribute and AbstractComposerEntity. Also inner attributes and entities of a composer field are still valid
-and wrapped in a ComposerFieldDataModel.
-Renaming:
-AbstractComposerAttribute -> AbstractDataModelAttribute
-AbstractComposerEntity -> AbstractDataModelEntity
-ComposerAttributeInjector -> DataModelAttributeInjector
-ComposerOp -> DataModelAttributeOp
-ComposerConstants -> DataModelConstants
-ComposerUtility -> DataModelUtility
-IComposerAttribute -> IDataModelAttribute
-IComposerOp -> IDataModelAttributeOp
-IComposerEntity -> IDataModelEntity
-
-10.02.2011 abr
-Ticket 98'889
-AbstractPropertyData.isValueSet() was not taken into account when importing a form data.
-
-11.02.2011 jgu
-New translations inserted for the languages bg,cs,da,el,es,fi,fr_BE,fr,hr,hu,it,nl_BE,nl,no,pl,pt_br,ru,se,sk,sl,sr,tr,zh_TW,zh.
-
-17.02.2011 imo
-added support for safe and lenient permissions transfer via service tunnel overriding serialization of Permissions object to list of serialized objects thus supporting skipping unknown permissions instead of skipping the whole Permissions class
-see ServiceTunnelInputStream, ServiceTunnelOutputStream, LenientPermissionWrapper, LenientPermissionsWrapper
-
-14.03.2011 dwi
-org.eclipse.scout.rt.shared
-- AbstractDataModelEntity
- Bug-Fix: Initialization of child entities
-
-18.03.2011 imo
-Migration of legacy: moving remaining legacy logic from client to server
-Added TokenBasedSearchFilter, TokenBasedSearchFilterService to support token-based query building on logical level.
-Added LegacySearchFilterService to support global client side legacy handling of search behaviour.
-Migration: None
-
-01.06.2011 imo
-Internal security audit
-- server stack traces must not be sent to client
-- server log must contain all exceptions (except intended business logic exceptions)
-- enhanced access control on gui remote service calls: see enahncements on IAccessControlService.checkServiceTunnelAccess
-- adding logout service and calling it from IClientSession.stop();
-Migration: None
-
-14.10.2011 abr [contributed by Adrian Moser, BSI Business Systems Integration AG]
-bugzilla ticket: 360946
-Bookmarks do not save column visibility
-Migration: None
-
-17.10.2011 imo Iteration 2 of scout validation framwework
-In order to modularize the validation package, the following classes have moved:
-org.eclipse.scout.rt.shared.data.IValidator -> org.eclipse.scout.rt.shared.validate.IValidator
-org.eclipse.scout.rt.shared.data.DefaultValidator -> org.eclipse.scout.rt.shared.validate.DefaultValidator
-org.eclipse.scout.rt.shared.util.ValidationUtility -> org.eclipse.scout.rt.shared.validate.ValidationUtility
-org.eclipse.scout.rt.shared.data.form.InputValidation -> org.eclipse.scout.rt.shared.validate.InputValidation
-org.eclipse.scout.rt.shared.data.form.OutputValidation -> org.eclipse.scout.rt.shared.validate.OutputValidation
-org.eclipse.scout.rt.shared.data.form.ValidationStrategy -> org.eclipse.scout.rt.shared.validate.IValidationStrategy
-And the following code needs to be replaced:
-IValidationStrategy.NO_CHECK -> IValidationStrategy.NO_CHECK.class
-IValidationStrategy.QUERY -> IValidationStrategy.QUERY.class
-IValidationStrategy.PROCESS -> IValidationStrategy.PROCESS.class
-The validation now covers form data field validation using ValidationRule as well as method parameter and bean field validation using
-annotations in org.eclipse.scout.rt.shared.validate.annotations.
-These include:
-@CodeValue
-@LookupValue
-@Mandatory
-@MaxLength
-@MaxValue
-@MinLength
-@MinValue
-@RegexMatch
-@Treat0AsNull
-@FieldReference (meta)
-@ValidateAnnotationMarker (meta)
-
-The (default) input validation on server side is activated using the config.ini property
-org.eclipse.scout.rt.server.validateInput=true
-The main classes doing validation are (in call order):
-- ServiceTunnelServlet
-- DefaultTransactionDelegate
-- DefaultValidator
-- IValidateCheck (and subtypes)
-
-18.10.2011 aho
-bugzilla ticket: 361256
-To make reuse of the ServletFilters in RAP projects. The following classes
-should be moved to the 'org.eclipse.scout.http.servletfilter' bundle:
-- org.eclipse.scout.rt.server.servlet.filter.AbstractChainableSecurityFilter
-- org.eclipse.scout.rt.server.servlet.filter.AnonymousSecurityFilter
-- org.eclipse.scout.rt.server.servlet.filter.BasicSecurityFilter
-- org.eclipse.scout.rt.server.servlet.filter.DataSourceSecurityFilter
-- org.eclipse.scout.rt.server.servlet.filter.LDAPSecurityFilter
-- org.eclipse.scout.rt.server.servlet.filter.TomcatSecurityFilter
-
-All servlet filters in the 'org.eclipse.scout.rt.server' bundle were kept as @deprecated subclasses of the moved ones.
-
-Furthermore the
-'org.eclipse.scout.rt.shared.services.common.security.SimplePrincipal' should
-be moved to the 'org.eclipse.scout.commons' bundle.
-
-Migration: change all 'org.eclipse.scout.rt.shared.services.common.security.SimplePrincipal' imports to 'org.eclipse.scout.commons.security.SimplePrincipal'.
-
-24.10.2011 mvi
-Bugzilla ticket 361816
-Replace current NLS support with Text Provider Services
-- added ITextProviderService, IDocumentationTextProviderService, AbstractDynamicNlsTextProviderService
-- Migrated existing text providers to scout text provider services
-- TEXTS class added for consistent translation retrieval
-- Splitted org.eclipse.scout.rt.shared texts into two plugins:
- - org.eclipse.scout.rt.shared contains text provider service with all texts that are used by the runtime
- - org.eclipse.scout.rt.shared.legacy.texts.fragment contains all texts that are no longer used by the runtime
-- getConfiguredDoc properties moved to different ConfigProperty type for Scout SDK (support for Docs Text Providers)
-- ScoutTexts changed to use text services (cached).
-Migration:
-- Add "org.eclipse.scout.rt.shared.legacy.texts.fragment" to all products.
-- For each existing NLS Class (directly or indirectly extending "org.eclipse.scout.rt.shared.ScoutTexts" or "org.eclipse.scout.commons.nls.DynamicNls"):
- - create a new "<YourSharedPlugin>.services.common.text.<Name>TextProviderService" extending "org.eclipse.scout.rt.shared.services.common.text.AbstractDynamicNlsTextProviderService" in the corresponding shared plugin.
-- For each created TextProvider Service:
- - Overwrite the method "getDynamicNlsBaseName" and return the same value as in the "RESOURCE_BUNDLE_NAME" constant (stored in the corresponding Texts class) as string literal.
- - Register the service in the corresponding plugin as scout service using the "org.eclipse.scout.service.DefaultServiceFactory", no session class and give a ranking > 0. E.g.: <service class="com.bsiag.crm.shared.core.services.common.text.CoreTextProviderService" factory="org.eclipse.scout.service.DefaultServiceFactory" ranking="100" />
-- Delete all Texts classes and replace all uses of the old Texts classes with the class "org.eclipse.scout.rt.shared.TEXTS".
-- Remove the "getNlsTexts" methods from the Session classes if existent (unless you use session-dependent translations).
-- Correct return type of "getConfiguredNlsProvider" of all SqlServices (if existent) to return the new type defined by AbstractSqlService and return "ScoutTexts.class" inside the method.
-- If somewhere the "SwingUtility.setNlsTexts" method or "SwtUtility.setNlsTextsOnDisplay" method is used, set it to "ScoutTexts.getInstance()".
-- Delete all .nls files (NLS Editor can now be accessed using the TextProviderService Node in the Scout Explorer of the Scout perspective).
- If you want to keep the .nls files (e.g. to support key shortcuts like ctrl+shift+r) do the following:
- - Open the .nls file in the text editor (right click -> open with).
- - Remove the following properties: "Nls-Type", "Nls-File-Prefix", "Nls-Translation-Folder".
- - Change the property "Nls-Class" to the fully qualified name of the Text Provider Service you would like to edit with this .nls file.
- - Save the changes and open the .nls file again in the Multilanguage Editor (right click -> open with).
-
-26.10.2011 dwi
-Bugzilla ticket 361795
-Problem:
-Decorating a Date or a Number has to use NlsLocale-Settings.
-Currently, Locale.getLocal() is used which may contradict with user-settings.
-Solution:
-In Java 6 it is possible to contribute custom Locales (e.g. en_CH) to the JRE. That is why Scout NlsLocale is not used anymore and therefore marked as deprecated.
-The user's locale is accessed as follows:
-- On client side, the user's locale is accessed by Locale.getDefault()
-- On server side the request's locale is accessed by LocaleThreadLocal.get() (convenience accessor: ServerSession.get().getLocale())
-Eventhough the class NlsLocale is marked as deprecated for legacy support, its constructor 'NlsLocale(Locale)' was removed because NlsLocale was changed to only act as delegate to the thread's locale (if applicable) or default locale otherwise.
-Please note: A locale consists of its language and country. The country is mainly responsible for format settings as for instance the grouping separator of numbers. A very few locales already exist in the JRE. But if you like to have the application in the English language with Switzerland as its region, you have to contribute your own locale-implementation 'en_CH'. Please see Migration section for detailed instructions to extend JRE with a custom locale.
-Plug-Ins changed:
-- org.eclipse.scout.commons
-- org.eclipse.scout.rt.client
-- org.eclipse.scout.rt.server
-- org.eclipse.scout.rt.shared
-- org.eclipse.scout.rt.ui.swing
-- org.eclipse.scout.rt.oraclelite10g.core
-- org.eclipse.scout.rt.xstream.shared
-Migration:
-- removed NlsLocale(Locale) (constructor): use Locale instead of NlsLocale
-- removed IServerSession#getNlsLocale(): use IServerSession#getLocale() instead (e.g. replace all ServerSession.get().getNlsLocale().getLocale() by ServerSession.get().getLocale())
-- In client Plug-Ins: replace NlsLocale.getDefault().getLocale() by Locale.getDefault()
-- In server Plug-Ins: replace NlsLocale.getThreadDefault().getLocale() by LocaleThreadLocal.get()
-- In shared Plug-Ins: replace NlsLocale.getDefault().getLocale() by NlsUtility.getDefaultLocale()
-Contribution of custom locales to the JRE:
-1. Create a plain Java project, e.g. x.y.localeprovider.en.ch
-2. Create two classes that inherit from {@link DateFormatProvider} and {@link NumberFormatProvider} and implement the method stubs specific to your locale
-3. Create the folder META-INF/services with two files java.text.spi.DateFormatProvider and java.text.spi.NumberFormatProvider
-4. In those files, simply put the the fully qualified name to your date/number provider
-5. Export project as JAR file and put it into \lib\ext of your JRE
-
-28.11.2011 dwi
-Bugzilla: 364019
-Problem:
-There has to be a possibility to disable the behaviour of Ctrl+C on tables. A use case for this would be an application
-with sensitive information (e.g. address data) that should not be allowed to be exported, only to be displayed to the user.
-Solution:
-> Added the method 'AbstractTable#execCopy(ITableRow[])' to return a transfer object to be put into the clipboard
-> By default, a TextTransferObject is returned with a text/plain and text/html representation of the selected rows.
- That means that if the target understands HTML, the HTML representation is used over the plain-text representation.
-> In SWT, added copy support on tables (not implemented yet)
-> Added permission 'CopyToClipboardPermission' to enable / disable the copy functionality
-Migration Swing:
-> So far, the copy functionality was enabled by default. Because protected by a permission, it is disabled by default as of now.
- To enable the CTRL-C behavior on tables, add the permission 'CopyToClipboardPermission' to the permission-set in AbstractAccessControlService#execLoadPermissions
- or directly grant it to specific user roles in your database script.
-Migration SWT:
+14.09.2010 imo
+Removed org.eclipse.scout.rt.shared.security.AllAccessPermission since it never worked and is not a valid jaas concept
+Migration:
+replace by java.security.AllPermission
+
+21.12.2010 imo
+Extracted DataModel with entities and attributes out of AbstractComposerField and moved to org.eclipse.scout.rt.shared.data.model
+Migration: None, sometimes organize imports is necessary.
+Legacy: There is legacy support with deprecated AbstractComposerAttribute and AbstractComposerEntity. Also inner attributes and entities of a composer field are still valid
+and wrapped in a ComposerFieldDataModel.
+Renaming:
+AbstractComposerAttribute -> AbstractDataModelAttribute
+AbstractComposerEntity -> AbstractDataModelEntity
+ComposerAttributeInjector -> DataModelAttributeInjector
+ComposerOp -> DataModelAttributeOp
+ComposerConstants -> DataModelConstants
+ComposerUtility -> DataModelUtility
+IComposerAttribute -> IDataModelAttribute
+IComposerOp -> IDataModelAttributeOp
+IComposerEntity -> IDataModelEntity
+
+10.02.2011 abr
+Ticket 98'889
+AbstractPropertyData.isValueSet() was not taken into account when importing a form data.
+
+11.02.2011 jgu
+New translations inserted for the languages bg,cs,da,el,es,fi,fr_BE,fr,hr,hu,it,nl_BE,nl,no,pl,pt_br,ru,se,sk,sl,sr,tr,zh_TW,zh.
+
+17.02.2011 imo
+added support for safe and lenient permissions transfer via service tunnel overriding serialization of Permissions object to list of serialized objects thus supporting skipping unknown permissions instead of skipping the whole Permissions class
+see ServiceTunnelInputStream, ServiceTunnelOutputStream, LenientPermissionWrapper, LenientPermissionsWrapper
+
+14.03.2011 dwi
+org.eclipse.scout.rt.shared
+- AbstractDataModelEntity
+ Bug-Fix: Initialization of child entities
+
+18.03.2011 imo
+Migration of legacy: moving remaining legacy logic from client to server
+Added TokenBasedSearchFilter, TokenBasedSearchFilterService to support token-based query building on logical level.
+Added LegacySearchFilterService to support global client side legacy handling of search behaviour.
+Migration: None
+
+01.06.2011 imo
+Internal security audit
+- server stack traces must not be sent to client
+- server log must contain all exceptions (except intended business logic exceptions)
+- enhanced access control on gui remote service calls: see enahncements on IAccessControlService.checkServiceTunnelAccess
+- adding logout service and calling it from IClientSession.stop();
+Migration: None
+
+14.10.2011 abr [contributed by Adrian Moser, BSI Business Systems Integration AG]
+bugzilla ticket: 360946
+Bookmarks do not save column visibility
+Migration: None
+
+17.10.2011 imo Iteration 2 of scout validation framwework
+In order to modularize the validation package, the following classes have moved:
+org.eclipse.scout.rt.shared.data.IValidator -> org.eclipse.scout.rt.shared.validate.IValidator
+org.eclipse.scout.rt.shared.data.DefaultValidator -> org.eclipse.scout.rt.shared.validate.DefaultValidator
+org.eclipse.scout.rt.shared.util.ValidationUtility -> org.eclipse.scout.rt.shared.validate.ValidationUtility
+org.eclipse.scout.rt.shared.data.form.InputValidation -> org.eclipse.scout.rt.shared.validate.InputValidation
+org.eclipse.scout.rt.shared.data.form.OutputValidation -> org.eclipse.scout.rt.shared.validate.OutputValidation
+org.eclipse.scout.rt.shared.data.form.ValidationStrategy -> org.eclipse.scout.rt.shared.validate.IValidationStrategy
+And the following code needs to be replaced:
+IValidationStrategy.NO_CHECK -> IValidationStrategy.NO_CHECK.class
+IValidationStrategy.QUERY -> IValidationStrategy.QUERY.class
+IValidationStrategy.PROCESS -> IValidationStrategy.PROCESS.class
+The validation now covers form data field validation using ValidationRule as well as method parameter and bean field validation using
+annotations in org.eclipse.scout.rt.shared.validate.annotations.
+These include:
+@CodeValue
+@LookupValue
+@Mandatory
+@MaxLength
+@MaxValue
+@MinLength
+@MinValue
+@RegexMatch
+@Treat0AsNull
+@FieldReference (meta)
+@ValidateAnnotationMarker (meta)
+
+The (default) input validation on server side is activated using the config.ini property
+org.eclipse.scout.rt.server.validateInput=true
+The main classes doing validation are (in call order):
+- ServiceTunnelServlet
+- DefaultTransactionDelegate
+- DefaultValidator
+- IValidateCheck (and subtypes)
+
+18.10.2011 aho
+bugzilla ticket: 361256
+To make reuse of the ServletFilters in RAP projects. The following classes
+should be moved to the 'org.eclipse.scout.http.servletfilter' bundle:
+- org.eclipse.scout.rt.server.servlet.filter.AbstractChainableSecurityFilter
+- org.eclipse.scout.rt.server.servlet.filter.AnonymousSecurityFilter
+- org.eclipse.scout.rt.server.servlet.filter.BasicSecurityFilter
+- org.eclipse.scout.rt.server.servlet.filter.DataSourceSecurityFilter
+- org.eclipse.scout.rt.server.servlet.filter.LDAPSecurityFilter
+- org.eclipse.scout.rt.server.servlet.filter.TomcatSecurityFilter
+
+All servlet filters in the 'org.eclipse.scout.rt.server' bundle were kept as @deprecated subclasses of the moved ones.
+
+Furthermore the
+'org.eclipse.scout.rt.shared.services.common.security.SimplePrincipal' should
+be moved to the 'org.eclipse.scout.commons' bundle.
+
+Migration: change all 'org.eclipse.scout.rt.shared.services.common.security.SimplePrincipal' imports to 'org.eclipse.scout.commons.security.SimplePrincipal'.
+
+24.10.2011 mvi
+Bugzilla ticket 361816
+Replace current NLS support with Text Provider Services
+- added ITextProviderService, IDocumentationTextProviderService, AbstractDynamicNlsTextProviderService
+- Migrated existing text providers to scout text provider services
+- TEXTS class added for consistent translation retrieval
+- Splitted org.eclipse.scout.rt.shared texts into two plugins:
+ - org.eclipse.scout.rt.shared contains text provider service with all texts that are used by the runtime
+ - org.eclipse.scout.rt.shared.legacy.texts.fragment contains all texts that are no longer used by the runtime
+- getConfiguredDoc properties moved to different ConfigProperty type for Scout SDK (support for Docs Text Providers)
+- ScoutTexts changed to use text services (cached).
+Migration:
+- Add "org.eclipse.scout.rt.shared.legacy.texts.fragment" to all products.
+- For each existing NLS Class (directly or indirectly extending "org.eclipse.scout.rt.shared.ScoutTexts" or "org.eclipse.scout.commons.nls.DynamicNls"):
+ - create a new "<YourSharedPlugin>.services.common.text.<Name>TextProviderService" extending "org.eclipse.scout.rt.shared.services.common.text.AbstractDynamicNlsTextProviderService" in the corresponding shared plugin.
+- For each created TextProvider Service:
+ - Overwrite the method "getDynamicNlsBaseName" and return the same value as in the "RESOURCE_BUNDLE_NAME" constant (stored in the corresponding Texts class) as string literal.
+ - Register the service in the corresponding plugin as scout service using the "org.eclipse.scout.service.DefaultServiceFactory", no session class and give a ranking > 0. E.g.: <service class="com.bsiag.crm.shared.core.services.common.text.CoreTextProviderService" factory="org.eclipse.scout.service.DefaultServiceFactory" ranking="100" />
+- Delete all Texts classes and replace all uses of the old Texts classes with the class "org.eclipse.scout.rt.shared.TEXTS".
+- Remove the "getNlsTexts" methods from the Session classes if existent (unless you use session-dependent translations).
+- Correct return type of "getConfiguredNlsProvider" of all SqlServices (if existent) to return the new type defined by AbstractSqlService and return "ScoutTexts.class" inside the method.
+- If somewhere the "SwingUtility.setNlsTexts" method or "SwtUtility.setNlsTextsOnDisplay" method is used, set it to "ScoutTexts.getInstance()".
+- Delete all .nls files (NLS Editor can now be accessed using the TextProviderService Node in the Scout Explorer of the Scout perspective).
+ If you want to keep the .nls files (e.g. to support key shortcuts like ctrl+shift+r) do the following:
+ - Open the .nls file in the text editor (right click -> open with).
+ - Remove the following properties: "Nls-Type", "Nls-File-Prefix", "Nls-Translation-Folder".
+ - Change the property "Nls-Class" to the fully qualified name of the Text Provider Service you would like to edit with this .nls file.
+ - Save the changes and open the .nls file again in the Multilanguage Editor (right click -> open with).
+
+26.10.2011 dwi
+Bugzilla ticket 361795
+Problem:
+Decorating a Date or a Number has to use NlsLocale-Settings.
+Currently, Locale.getLocal() is used which may contradict with user-settings.
+Solution:
+In Java 6 it is possible to contribute custom Locales (e.g. en_CH) to the JRE. That is why Scout NlsLocale is not used anymore and therefore marked as deprecated.
+The user's locale is accessed as follows:
+- On client side, the user's locale is accessed by Locale.getDefault()
+- On server side the request's locale is accessed by LocaleThreadLocal.get() (convenience accessor: ServerSession.get().getLocale())
+Eventhough the class NlsLocale is marked as deprecated for legacy support, its constructor 'NlsLocale(Locale)' was removed because NlsLocale was changed to only act as delegate to the thread's locale (if applicable) or default locale otherwise.
+Please note: A locale consists of its language and country. The country is mainly responsible for format settings as for instance the grouping separator of numbers. A very few locales already exist in the JRE. But if you like to have the application in the English language with Switzerland as its region, you have to contribute your own locale-implementation 'en_CH'. Please see Migration section for detailed instructions to extend JRE with a custom locale.
+Plug-Ins changed:
+- org.eclipse.scout.commons
+- org.eclipse.scout.rt.client
+- org.eclipse.scout.rt.server
+- org.eclipse.scout.rt.shared
+- org.eclipse.scout.rt.ui.swing
+- org.eclipse.scout.rt.oraclelite10g.core
+- org.eclipse.scout.rt.xstream.shared
+Migration:
+- removed NlsLocale(Locale) (constructor): use Locale instead of NlsLocale
+- removed IServerSession#getNlsLocale(): use IServerSession#getLocale() instead (e.g. replace all ServerSession.get().getNlsLocale().getLocale() by ServerSession.get().getLocale())
+- In client Plug-Ins: replace NlsLocale.getDefault().getLocale() by Locale.getDefault()
+- In server Plug-Ins: replace NlsLocale.getThreadDefault().getLocale() by LocaleThreadLocal.get()
+- In shared Plug-Ins: replace NlsLocale.getDefault().getLocale() by NlsUtility.getDefaultLocale()
+Contribution of custom locales to the JRE:
+1. Create a plain Java project, e.g. x.y.localeprovider.en.ch
+2. Create two classes that inherit from {@link DateFormatProvider} and {@link NumberFormatProvider} and implement the method stubs specific to your locale
+3. Create the folder META-INF/services with two files java.text.spi.DateFormatProvider and java.text.spi.NumberFormatProvider
+4. In those files, simply put the the fully qualified name to your date/number provider
+5. Export project as JAR file and put it into \lib\ext of your JRE
+
+28.11.2011 dwi
+Bugzilla: 364019
+Problem:
+There has to be a possibility to disable the behaviour of Ctrl+C on tables. A use case for this would be an application
+with sensitive information (e.g. address data) that should not be allowed to be exported, only to be displayed to the user.
+Solution:
+> Added the method 'AbstractTable#execCopy(ITableRow[])' to return a transfer object to be put into the clipboard
+> By default, a TextTransferObject is returned with a text/plain and text/html representation of the selected rows.
+ That means that if the target understands HTML, the HTML representation is used over the plain-text representation.
+> In SWT, added copy support on tables (not implemented yet)
+> Added permission 'CopyToClipboardPermission' to enable / disable the copy functionality
+Migration Swing:
+> So far, the copy functionality was enabled by default. Because protected by a permission, it is disabled by default as of now.
+ To enable the CTRL-C behavior on tables, add the permission 'CopyToClipboardPermission' to the permission-set in AbstractAccessControlService#execLoadPermissions
+ or directly grant it to specific user roles in your database script.
+Migration SWT:
> None because not supported yet. To enable the copy functionality, see migration notes for Swing. \ No newline at end of file
diff --git a/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts.properties b/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts.properties
index 7d7d872acd..5f7bee5efa 100644
--- a/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts.properties
+++ b/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts.properties
@@ -1,501 +1,501 @@
-ActivateBookmarkMenu=Open bookmark
-ActiveAndInactiveStates=A&ll
-ActiveStates=&Active
-AddCustomColumnMenu=Add column...
-All=All
-AllStates=All
-Apply=Apply
-ApplyBookmarkToSearchFailedMessage=This bookmark is not applicable on the current search.
-Ascending=Ascending
-Attribute=Attribute
-Bookmark=Favorite
-BookmarkFolder=Folder
-BookmarkResetColumnFilters=The column filters have been removed during loading of the bookmark.
-BookmarkResolutionCanceled=Loading the bookmarks has been canceled because a record is not found in this list.
-BookmarkResolutionCanceledCheckSearchCriteria=Loading the bookmarks has been canceled because a record is not found in this list. Check your search criteria.
-Bookmarks=Favorites
-BookmarksAddMenu=&Add current view to favorites
-BookmarksApplyToCurrentSearch=Perform search using this bookmark
-BookmarksMainMenu=&Favorites
-BookmarksManageMenu=&Manage favorites
-BookmarksPublishMenu=Publish bookmark...
-BookmarksStartPageMenu=&Startup view
-BookmarksStartPageMenuClear=&Reset startup view
-BookmarksStartPageMenuGoto=&Open startup view
-BookmarksStartPageMenuSet=&Set current view as startup view
-Browse=Browse
-BusyBlockingMessage=Processing request. Click here to cancel.
-BusyJob=Busy
-ButtonDeselectAll=Deselect all
-ButtonMoveDown=Down
-ButtonMoveUp=Up
-ButtonSelectAll=Select all
-Calendar_earlier=Earlier
-Calendar_later=Later
-Cancel=Cancel
-CancelButton=&Cancel
-CancelButtonTooltip=Close without saving; ask if in doubt
-ChangePassword=Change password
-CheckAll=Check all
-ClearColumnSorting=No sorting
-Close=Close
-CloseButton=&Close
-CloseButtonTooltip=Close without saving.
-CodeTypeInit=Code type initialization
-Column=Column
-ColumnFilterCheckedText=Checked
-ColumnFilterConstraints=Column filters
-ColumnFilterDateSection=Date filter
-ColumnFilterMenu=Column filter...
-ColumnFilterNullText=Empty
-ColumnFilterNumberSection=Number filter
-ColumnFilterRemoveButton=Remove filter
-ColumnFilterStringSection=Text filter
-ColumnFilterUncheckedText=Unchecked
-ColumnFilterValuesSection=Value filter
-ColumnSortAscending=Sort ascending
-ColumnSorting=Sorting
-ColumnValues=Values
-Columns=Columns
-ComposerFieldAggregationAvg=Average({0})
-ComposerFieldAggregationCount=Count({0})
-ComposerFieldAggregationLabel=Function
-ComposerFieldAggregationMax=Maximum({0})
-ComposerFieldAggregationMedian=Median({0})
-ComposerFieldAggregationMin=Minimum({0})
-ComposerFieldAggregationSum=Sum({0})
-Condensed=6 columns
-Configure=Configuration
-Copy=Copy
-CopyWidthsOfColumnsMenu=Copy column widths
-Criteria=Search criteria
-Cut=Cut
-Day=Day
-DefaultPasswordPolicyText=The password does not comply with the given policy\n\nPolicy\:\n- at least 8 characters\n- at least one number (0-9)\n- at least one non standard character (\!|@|\#|\\$|%|\\^|&|\\*|\\(|\\)|_|\\+|\\||~|-|\n- not used in the past\n- your username can't be a part of the password
-DeleteBookmarkMenu=Delete bookmark
-DeleteConfirmationText=Do you want to delete the following data?
-DeleteConfirmationTextNoItemList=Do you want to delete this data?
-DeleteConfirmationTextNoItemListX=Do you want to delete these {0}?
-DeleteConfirmationTextX=Do you want to delete the following {0}?
-DeleteConfirmationTitle=Confirm delete
-DeleteFolderMenu=Delete folder
-DeleteMenu=Delete
-Descending=Descending
-Detail=Detail
-DetailedVersion=Detailed version
-Details=Details
-EditBookmarkMenu=Edit bookmark...
-EditFilterMenu=Edit...
-EmailCc=CC
-EmailFrom=From
-EmailSent=Sent
-EmailSubject=Subject
-EmailTo=To
-Enabled=Activated
-EndDate=End date
-Error=Error
-ErrorAndRetryTextDefault=An error has occurred.
-ErrorTextLogin=Invalid username/password
-ErrorTextSecurity=Access was denied.
-ErrorTitleLogin=Login failed
-ErrorTitleSecurity=Access denied
-ErrorWhileLoadingData=Failed to load the data.
-ExcelChart_Button_LoadDefaults=Defaults
-ExcelChart_Button_LoadDefaultsHint=Load default values.
-ExcelChart_Button_LoadProfile=Load profile...
-ExcelChart_Button_LoadProfileHint=Loads settings from an XML file.
-ExcelChart_Button_SaveProfile=Save profile...
-ExcelChart_Button_SaveProfileHint=Saves the current settings in an XML file.
-ExcelChart_Error_CreatingChartFailed=creating chart failed.
-ExcelChart_Error_ExportingFailed=Export failed because
-ExcelChart_Error_InitializationFailed=initialization of the support class(es) failed.
-ExcelChart_Error_LoadingProfileFailed=Loading profile failed because
-ExcelChart_Error_LoadingTemplateFailed=loading template failed.
-ExcelChart_Error_RetrivingOutlineDataFailed=the outline data could not be read.
-ExcelChart_Error_SavingProfileFailed=Saving profile failed because
-ExcelChart_Error_WrongProfile=the profile was created for another outline.
-ExcelChart_Label_AutomaticMode=Automatic mode
-ExcelChart_Label_AutomaticModeHint=Hide Excel and save automatically.
-ExcelChart_Label_ChartNumber=Chart no.
-ExcelChart_Label_ChartType=Chart type
-ExcelChart_Label_FileName=File name
-ExcelChart_Label_FirstRow=First line
-ExcelChart_Label_Height=Height
-ExcelChart_Label_HistogramMode=Histogram mode
-ExcelChart_Label_HistogramModeHint=The histogram mode combines identical values on the X axis into one.
-ExcelChart_Label_LastRow=Last line
-ExcelChart_Label_Offset=Position
-ExcelChart_Label_SkipNullValues=Ignore null values
-ExcelChart_Label_SkipNullValuesHint=If checked in the histogram mode, null values on the X-Axis are ignored, otherwise they are combined to <Unknown>.
-ExcelChart_Label_TemplateName=Template
-ExcelChart_Label_UseCustomFormat=Use custom format
-ExcelChart_Label_UseCustomFormatHint=Enables setting of the chart's position and size.
-ExcelChart_Label_UseExistingChart=Use existing chart
-ExcelChart_Label_UseExistingChartHint=If checked the existing chart in the indicated template is used.
-ExcelChart_Label_UseSelectiveExport=Select lines
-ExcelChart_Label_UseSelectiveExportHint=If checked only the lines indicated below are exported.
-ExcelChart_Label_Width=Width
-ExcelChart_Label_WorksheetName=Worksheet
-ExcelChart_Label_XAxis=X axis
-ExcelChart_Label_YAxes=Y axes
-ExcelChart_Status_Done=Excel chart export is finished.
-ExcelChart_Tab_Advanced=Advanced
-ExcelChart_Tab_Basic=Basic
-ExcelChart_Title_MainForm=Excel Chart Export
-ExcelChart_Type_Area3D=Area 3D
-ExcelChart_Type_Area=Area
-ExcelChart_Type_AreaStacked3D=Area stacked 3D
-ExcelChart_Type_AreaStacked=Area stacked
-ExcelChart_Type_BarsClustered3D=Bars clustered 3D
-ExcelChart_Type_BarsClustered=Bars clustered
-ExcelChart_Type_BarsStacked3D=Bars stacked 3D
-ExcelChart_Type_BarsStacked=Bars stacked
-ExcelChart_Type_ColumnsClustered3D=Columns clustered 3D
-ExcelChart_Type_ColumnsClustered=Columns clustered
-ExcelChart_Type_ColumnsStacked3D=Columns stacked 3D
-ExcelChart_Type_ColumnsStacked=Columns stacked
-ExcelChart_Type_Line=Line
-ExcelChart_Type_LineStacked=Line stacked
-ExcelChart_Type_Pie3D=Pie 3D
-ExcelChart_Type_Pie=Pie
-ExcelChart_Type_PieExploded3D=Pie exploded 3D
-ExcelChart_Type_PieExploded=Pie exploded
-ExcelChart_Various_Averaged=averaged
-ExcelChart_Various_Column=Column
-ExcelChart_Various_Frequency=Frequency
-ExcelChart_Various_SummedUp=summed up
-ExcelChart_Various_Unknown=<Unknown>
-ExcelChart_WorksheetName_Chart=Chart
-ExcelChart_WorksheetName_Data=Chart data
-ExecutionTime=Server processing
-ExportDate=Export date
-ExtendedSearchAddAdditionalOrMenu=Add additional or insert
-ExtendedSearchAddAttribute=Constraint
-ExtendedSearchAddAttributeMenu=Add constraint...
-ExtendedSearchAddEitherOrMenu=Add either...or
-ExtendedSearchAddEntityPrefix=has
-ExtendedSearchAnd=and
-ExtendedSearchEditAttributeMenu=Edit...
-ExtendedSearchEither=either
-ExtendedSearchEntitySuffix=with
-ExtendedSearchNegateMenu=Negate
-ExtendedSearchNot=not
-ExtendedSearchOr=or
-ExtendedSearchRemoveAttributeMenu=Remove
-ExtendedSearchRemoveMenu=Remove
-FileExistsOwerwriteQuestion=The selected file exists already. Overwrite this file?
-FileName=File name
-FileNotFoundExceptionMessage=Could not find or access the file.
-FileNotFoundMessage=Could not find the following file\:\n{0}
-FileNotFoundTitle=File not found
-FilesOfType=File type
-FilterBookmarkTree=Browse bookmarks
-Folders=Folders
-FormButtonClicked=While clicking on a button
-FormCloseTimerActivated=Close timer activated
-FormClosing=Close
-FormDisposedMessage=The form {0} has already been disposed and does not allow further processing.
-FormEmptyMandatoryFieldsMessage=The following fields are required
-FormExportXml=Export to XML
-FormFinally=Finalize
-FormFireActivated=When form was activated
-FormFireClosed=When form was closed
-FormFireDiscarded=When form was discarded
-FormFirePrinted=When taking a picture of the form
-FormFireStructureChanged=When the form structure changed
-FormFireToBack=When sending form to back
-FormFireToFront=When sending form to front
-FormIncompleteIntro=Some values have to be verified.
-FormInvalidFieldsMessage=The following fields are invalid
-FormPrint=Print
-FormReset=Reset
-FormSaveChangesQuestion=Do you want to save the changes?
-FormStateLoad=Open...
-FormStateStore=Save
-FormStateStoreAs=Save as...
-FormTimerActivated=Timer activated
-FormattingLocale=Formatting
-GlobalBookmarks=Global favorites
-GlobalBookmarksAddMenu=Add to &global favorites
-Help=Help
-History=History
-Host=Computer
-Hour=Stunde
-IOErrorInfo=Please check files and connection to server.
-IOErrorText=Communication error
-IOErrorTitle=Read / write error
-InDaysX=in {0} days
-InactiveState=inactive
-InactiveStates=&Inactive
-Info=Information
-Information=Information
-Interrupted=Cancelled
-InterruptedErrorText=The process cancelled manually.
-InterruptedErrorTitle=Process cancelled
-InvalidNumberMessageX="{0}" is an invalid number
-InvalidPhoneNumberMessageX="{0}" is an invalid phone number
-InvalidValueMessageX="{0}" is an invalid value
-JavaVMVersion=Java VM
-JavaVersion=Java Runtime
-KeyStroke=Keystroke
-Language=Language
-Live=Live
-LoadFormXmlFailedText=This file is not compatible with this form.
-LogicBetween=is between {0} and {1}
-LogicBetweenShort=between
-LogicDateIsInDays=is in exactly {0} days
-LogicDateIsInGEDays=is earliest in {0} days
-LogicDateIsInGEMonths=is earliest in {0} months
-LogicDateIsInLEDays=is at the latest in {0} days
-LogicDateIsInLEMonths=is at the latest in {0} months
-LogicDateIsInLastDays=was in the last {0} days
-LogicDateIsInLastMonths=was in the last {0} months
-LogicDateIsInMonths=is in exactly {0} months
-LogicDateIsInNextDays=is in the next {0} days
-LogicDateIsInNextMonths=Date is in the next {0} months
-LogicDateIsNotToday=is not today
-LogicDateIsToday=is today
-LogicDateTimeIsInGEHours=is at the earliest in {0} hours
-LogicDateTimeIsInGEMinutes=is at the earliest in {0} minutes
-LogicDateTimeIsInLEHours=is at the latest in {0} hours
-LogicDateTimeIsInLEMinutes=is at the latest in {0} minutes
-LogicDateTimeIsNotNow=is not now
-LogicDateTimeIsNow=is now
-LogicEQ=\=
-LogicEndsWith=ends with
-LogicGE=>\=
-LogicGT=>
-LogicIn=is
-LogicLE=<\=
-LogicLT=<
-LogicLike=contains
-LogicNEQ=<>
-LogicNotEndsWith=doesn't end with
-LogicNotIn=is not
-LogicNotLike=doesn't contain
-LogicNotNull=is not empty
-LogicNotStartsWith=doesn't start with
-LogicNull=is empty
-LogicStartsWith=starts with
-LogicTimeIsInGEHours=is at the earliest in {0} hours
-LogicTimeIsInGEMinutes=is at the earliest in {0} minutes
-LogicTimeIsInHours=is in exactly {0} hours
-LogicTimeIsInLEHours=is at the latest in {0} hours
-LogicTimeIsInLEMinutes=is at the latest in {0} minutes
-LogicTimeIsInMinutes=is in exactly {0} minutes
-LogicTimeIsNotNow=is not now
-LogicTimeIsNow=is now
-Login=Login
-LookAndFeel=Look and feel
-LookIn=Look in
-MemoryStatus=Memory
-Minute=Minute
-ModifyCustomColumnMenu=Edit column...
-Month=Month
-Name=Name
-NavigationBackward=Back
-NavigationForward=Forward
-NetErrorInfo=Please check server name, URL and server connection.
-NetErrorText=Server not found
-NetErrorTitle=Network error
-NetworkLatency=Network delay
-NewBookmarkFolderMenu=New folder...
-NewPassword=New password
-No=No
-NoButton=&No
-None=None
-NumberOfRows=Data record count
-NumberTooLargeMessageXY=The value is too large; must be between {0} and {1}.
-NumberTooSmallMessageXY=The value is too small; must be between {0} and {1}.
-OSUser=System user
-OSVersion=System version
-OcrEditorMoveTool=Move image
-OcrEditorNextPage=Next page
-OcrEditorOCRTool=Character recognition
-OcrEditorOfX=of
-OcrEditorPage=Page
-OcrEditorPreviousPage=Previous page
-OcrEditorRotateLeft=Rotate left
-OcrEditorRotateRight=Rotate right
-OcrEditorZoomIn=Zoom in
-OcrEditorZoomOut=Zoom out
-OcrEditorZoomToFit=Zoom to fit
-Ok=OK
-OkButton=&OK
-OkButtonTooltip=Save and close
-OldPassword=Old password
-OneFiltered=1 hidden by filter
-OneRow=1 object
-OneSelected=1 selected
-Op=Operator
-Open=Open
-OrganizeTableColumnsMenu=Organize columns...
-OrganizeTableColumnsMinimalColumnCountMessage=There must be at least one visible column. Please set a column visible.
-OrganizeTableColumnsTitle=Organize columns
-OriginalErrorMessageIs=The original message is\:\n{0}
-OutlineSelectorAddOrRemoveButtons=Add or remove &buttons
-OutlineSelectorShowFewerButtons=Show &fewer buttons
-OutlineSelectorShowMoreButtons=Show &more buttons
-Password=Password
-PasswordHasExpiredHeader=Your password has expired and should be changed now.
-PasswordHasExpiredTitle=Password expired
-PasswordMin8Chars=at least 8 characters
-PasswordMinOnNonStdChar=at least one non standard character
-PasswordMinOneChar=at least one character a-z/A-Z
-PasswordMinOneDigit=at least one digit 0-9
-PasswordNotSameAsLasts=must not be same as any of the last passwords
-PasswordUsernameNotPartOfPass=user name must not be part of the password
-PasswordWillExpireHeaderX=Your password expires {0}.
-PasswordWillExpireInfo=Would you like to change it now?
-PasswordWillExpireTitle=Password will expire
-PasswordsDoNotMatch=The two passwords do not match.
-Paste=Paste
-PasteTextTooLongForFieldX=The inserted text is too long for this field and was truncated.\nMaximum characters are {0}.
-Path=Path
-Pending=Waiting...
-PrivateBookmarks=Private Bookmarks
-Properties=Properties
-Redo=Redo
-Refresh=Refresh
-Remove=Remove
-RemoveAllCustomColumnsMenu=Remove my columns
-RemoveCustomColumnMenu=Remove column
-RenameBookmarkFolderMenu=Rename Folder...
-RepBuildExtract=Preparing data...
-RepExecAfter=Clean up database
-RepExecBefore=Prepare database
-RepUpdate=Processing data...
-RepeatPassword=Repeat
-RequestProblem=Processing error
-ResetButton=&Reset
-ResetButtonTooltip=Set all fields to empty values
-ResetTableColumnFilter=Filter
-ResetTableColumns=Reset columns
-ResetTableColumnsAll=All
-ResetTableColumnsOrder=Order
-ResetTableColumnsSorting=Sorting
-ResetTableColumnsView=View
-ResetTableColumnsWidth=Width
-SC_Copyright=The Sentry Spelling-Checker Engine and Dictionaries are copyrighted by Wintertree Software, Inc.
-SC_DialogTitle=Spell check
-SC_DialogTitle_Options=Spell check\: Options
-SC_Help_AddToDictionary=Adds the word to the user dictionary
-SC_Help_Cancel=Closes the dialogue and cancel all changes (speed key\: ESC)
-SC_Help_Change=Changes the current appearance of the word
-SC_Help_ChangeAll=Changes all appearances of the word (in the current text field)
-SC_Help_Enable=Activates or deactivates the Scout spell checking
-SC_Help_Ignore=Ignores the current appearance of the word
-SC_Help_IgnoreAll=Ignores this and all other appearances of this word
-SC_Help_IgnoreCase=Ignores upper/lower case spelling
-SC_Help_IgnoreDomainNames=Ignores 'www.bsiag.com', for example
-SC_Help_IgnoreWordsWithNumbers=Ignores words containing numbers
-SC_Help_Language=The chosen language
-SC_Help_Options=Opens the options dialogue
-SC_Help_RemoveWord=Removes the selected word from the user dictionary
-SC_Help_ReplacementWord=The word with which the selected word shall be replaced (press ENTER to replace the unrecognized word with this one)
-SC_Help_Shortcut=The shortcut key for the spell check dialogue. Fixed, cannot be changed.
-SC_Help_SuggestionList=Replacement suggestion for the selected word (double-click to replace the unrecognized word)
-SC_Help_Undo=Undoes the last change that was made
-SC_Help_UseDefaults=Resets all settings to the default values
-SC_Help_UserDictionary=Chooses a 'tlx' (Scout) or 'dic' (Microsoft Word) dictionary as user dictionary
-SC_Label_AddToDictionary=Add
-SC_Label_Cancel=Cancel
-SC_Label_Capitalization=Upper/lowercase spelling
-SC_Label_Change=Change
-SC_Label_ChangeAll=Change all
-SC_Label_ChangeTo=Change to
-SC_Label_ConsiderChanging=Consider changing
-SC_Label_ContainsDigits=Contains digits/numbers
-SC_Label_DoubledWord=Duplicated word
-SC_Label_Enable=Activate spell check
-SC_Label_Ignore=Ignore
-SC_Label_IgnoreAll=Ignore all
-SC_Label_IgnoreCase=Ignore upper/lowercase
-SC_Label_IgnoreDomainNames=Ignore domain names
-SC_Label_IgnoreWordsWithNumbers=Ignore words with numbers
-SC_Label_IgnoredWord=User-defined words
-SC_Label_Main=Spell check
-SC_Label_MixedCase=Mixed upper/lowercase
-SC_Label_NoSuggestions=(No suggestions)
-SC_Label_NotInDictionary=The selected word was not recognized
-SC_Label_Options=Options...
-SC_Label_RemoveWord=Remove word
-SC_Label_Shortcut=Shortcut key
-SC_Label_Spelling=Spelling
-SC_Label_Undo=Undo
-SC_Label_UseDefaults=Default
-SC_Label_UserDictionary=User dictionary
-SC_Language=Language
-SC_Message_CheckRest=Would you like to check the rest of the text?
-SC_Message_Complete=The spell check is complete
-SC_Message_CompleteForSelection=The spell check is complete for the current selection
-SC_Message_NotAvailable=Scout spell checking is not available
-Save=Save
-SaveButton=&Save
-SaveButtonTooltip=Save without closing
-SavePassword=Save username/password
-ScoutStarting=Scout is starting
-ScoutStoping=Scout is stoping
-Search=Search
-SearchButton=&Search
-SearchButtonTooltip=Start search
-SearchConstraints=Search constraint
-SearchTextIsTooGeneral=Please narrow search text
-SearchWasCanceled=Search was canceled. Please execute again.
-SelectedStates=Checked only
-Server=Server
-ServerCallCancelProcessing=Calling server to cancel processing...
-ServerCallProcessing=Calling server...
-SmartFieldCannotComplete=No suggestions for "{0}"
-SmartFieldMoreThanXRows=More than {0} data records
-SmartFindLabel=Search text
-SortDescending=Sort descending
-Source=Source
-StatusExportDone=Export complete
-StringPattern=Expression
-Style=Mode
-Subject=Subject
-TableName=Table
-Timestamp=Timestamp
-Title=Title
-Today=today
-Tomorrow=tomorrow
-TooManyRows=Large dataset. Please narrow using the search function.
-UncheckAll=Uncheck all
-Undo=Undo
-Update=Refresh
-UpdateBookmarkMenu=Update bookmark from current view
-UserCancelledOperation=The operation was manually cancelled
-UserInterrupted=Canceled by user
-Username=User name
-Value=Value
-VersionMismatchAction=Do you want to restart the application with automatic update?
-VersionMismatchTextXY=An application update is required to continue working.\n\nThe current version is {0}, the new version is {1}.
-VersionMismatchTitle=Update required
-VetoErrorText=At least one search field must be filled in.
-Week=Week
-WeekShort=CW
-Without=Without
-WizardBackButton=&Back
-WizardBackButtonTooltip=Back to previous step
-WizardCancelButton=Cancel
-WizardCancelButtonTooltip=Cancels the wizard and discards all data.
-WizardFinishButton=&Finish
-WizardFinishButtonTooltip=Finish this process and return to process selection.
-WizardNextButton=&Next
-WizardNextButtonTooltip=Proceed to next step
-WizardSuspendButton=&Close
-WizardSuspendButtonTooltip=Closes this process and closes the wizard (can be resumed later on).
-WorkWeek=Working week
-XFiltered={0} hidden by filter
-XMustBeGreaterThanOrEqualY='{0}' must be greater than or equal to '{1}'
-XMustBeLessThanOrEqualY='{0}' must be less than or equal to '{1}'
-XRows={0} objects
-XSelected={0} selected
-Yes=Yes
-YesButton=&Yes
-and=and
-between=Between
-from=from
-searchingProposals=searching proposals...
-to=to
+ActivateBookmarkMenu=Open bookmark
+ActiveAndInactiveStates=A&ll
+ActiveStates=&Active
+AddCustomColumnMenu=Add column...
+All=All
+AllStates=All
+Apply=Apply
+ApplyBookmarkToSearchFailedMessage=This bookmark is not applicable on the current search.
+Ascending=Ascending
+Attribute=Attribute
+Bookmark=Favorite
+BookmarkFolder=Folder
+BookmarkResetColumnFilters=The column filters have been removed during loading of the bookmark.
+BookmarkResolutionCanceled=Loading the bookmarks has been canceled because a record is not found in this list.
+BookmarkResolutionCanceledCheckSearchCriteria=Loading the bookmarks has been canceled because a record is not found in this list. Check your search criteria.
+Bookmarks=Favorites
+BookmarksAddMenu=&Add current view to favorites
+BookmarksApplyToCurrentSearch=Perform search using this bookmark
+BookmarksMainMenu=&Favorites
+BookmarksManageMenu=&Manage favorites
+BookmarksPublishMenu=Publish bookmark...
+BookmarksStartPageMenu=&Startup view
+BookmarksStartPageMenuClear=&Reset startup view
+BookmarksStartPageMenuGoto=&Open startup view
+BookmarksStartPageMenuSet=&Set current view as startup view
+Browse=Browse
+BusyBlockingMessage=Processing request. Click here to cancel.
+BusyJob=Busy
+ButtonDeselectAll=Deselect all
+ButtonMoveDown=Down
+ButtonMoveUp=Up
+ButtonSelectAll=Select all
+Calendar_earlier=Earlier
+Calendar_later=Later
+Cancel=Cancel
+CancelButton=&Cancel
+CancelButtonTooltip=Close without saving; ask if in doubt
+ChangePassword=Change password
+CheckAll=Check all
+ClearColumnSorting=No sorting
+Close=Close
+CloseButton=&Close
+CloseButtonTooltip=Close without saving.
+CodeTypeInit=Code type initialization
+Column=Column
+ColumnFilterCheckedText=Checked
+ColumnFilterConstraints=Column filters
+ColumnFilterDateSection=Date filter
+ColumnFilterMenu=Column filter...
+ColumnFilterNullText=Empty
+ColumnFilterNumberSection=Number filter
+ColumnFilterRemoveButton=Remove filter
+ColumnFilterStringSection=Text filter
+ColumnFilterUncheckedText=Unchecked
+ColumnFilterValuesSection=Value filter
+ColumnSortAscending=Sort ascending
+ColumnSorting=Sorting
+ColumnValues=Values
+Columns=Columns
+ComposerFieldAggregationAvg=Average({0})
+ComposerFieldAggregationCount=Count({0})
+ComposerFieldAggregationLabel=Function
+ComposerFieldAggregationMax=Maximum({0})
+ComposerFieldAggregationMedian=Median({0})
+ComposerFieldAggregationMin=Minimum({0})
+ComposerFieldAggregationSum=Sum({0})
+Condensed=6 columns
+Configure=Configuration
+Copy=Copy
+CopyWidthsOfColumnsMenu=Copy column widths
+Criteria=Search criteria
+Cut=Cut
+Day=Day
+DefaultPasswordPolicyText=The password does not comply with the given policy\n\nPolicy\:\n- at least 8 characters\n- at least one number (0-9)\n- at least one non standard character (\!|@|\#|\\$|%|\\^|&|\\*|\\(|\\)|_|\\+|\\||~|-|\n- not used in the past\n- your username can't be a part of the password
+DeleteBookmarkMenu=Delete bookmark
+DeleteConfirmationText=Do you want to delete the following data?
+DeleteConfirmationTextNoItemList=Do you want to delete this data?
+DeleteConfirmationTextNoItemListX=Do you want to delete these {0}?
+DeleteConfirmationTextX=Do you want to delete the following {0}?
+DeleteConfirmationTitle=Confirm delete
+DeleteFolderMenu=Delete folder
+DeleteMenu=Delete
+Descending=Descending
+Detail=Detail
+DetailedVersion=Detailed version
+Details=Details
+EditBookmarkMenu=Edit bookmark...
+EditFilterMenu=Edit...
+EmailCc=CC
+EmailFrom=From
+EmailSent=Sent
+EmailSubject=Subject
+EmailTo=To
+Enabled=Activated
+EndDate=End date
+Error=Error
+ErrorAndRetryTextDefault=An error has occurred.
+ErrorTextLogin=Invalid username/password
+ErrorTextSecurity=Access was denied.
+ErrorTitleLogin=Login failed
+ErrorTitleSecurity=Access denied
+ErrorWhileLoadingData=Failed to load the data.
+ExcelChart_Button_LoadDefaults=Defaults
+ExcelChart_Button_LoadDefaultsHint=Load default values.
+ExcelChart_Button_LoadProfile=Load profile...
+ExcelChart_Button_LoadProfileHint=Loads settings from an XML file.
+ExcelChart_Button_SaveProfile=Save profile...
+ExcelChart_Button_SaveProfileHint=Saves the current settings in an XML file.
+ExcelChart_Error_CreatingChartFailed=creating chart failed.
+ExcelChart_Error_ExportingFailed=Export failed because
+ExcelChart_Error_InitializationFailed=initialization of the support class(es) failed.
+ExcelChart_Error_LoadingProfileFailed=Loading profile failed because
+ExcelChart_Error_LoadingTemplateFailed=loading template failed.
+ExcelChart_Error_RetrivingOutlineDataFailed=the outline data could not be read.
+ExcelChart_Error_SavingProfileFailed=Saving profile failed because
+ExcelChart_Error_WrongProfile=the profile was created for another outline.
+ExcelChart_Label_AutomaticMode=Automatic mode
+ExcelChart_Label_AutomaticModeHint=Hide Excel and save automatically.
+ExcelChart_Label_ChartNumber=Chart no.
+ExcelChart_Label_ChartType=Chart type
+ExcelChart_Label_FileName=File name
+ExcelChart_Label_FirstRow=First line
+ExcelChart_Label_Height=Height
+ExcelChart_Label_HistogramMode=Histogram mode
+ExcelChart_Label_HistogramModeHint=The histogram mode combines identical values on the X axis into one.
+ExcelChart_Label_LastRow=Last line
+ExcelChart_Label_Offset=Position
+ExcelChart_Label_SkipNullValues=Ignore null values
+ExcelChart_Label_SkipNullValuesHint=If checked in the histogram mode, null values on the X-Axis are ignored, otherwise they are combined to <Unknown>.
+ExcelChart_Label_TemplateName=Template
+ExcelChart_Label_UseCustomFormat=Use custom format
+ExcelChart_Label_UseCustomFormatHint=Enables setting of the chart's position and size.
+ExcelChart_Label_UseExistingChart=Use existing chart
+ExcelChart_Label_UseExistingChartHint=If checked the existing chart in the indicated template is used.
+ExcelChart_Label_UseSelectiveExport=Select lines
+ExcelChart_Label_UseSelectiveExportHint=If checked only the lines indicated below are exported.
+ExcelChart_Label_Width=Width
+ExcelChart_Label_WorksheetName=Worksheet
+ExcelChart_Label_XAxis=X axis
+ExcelChart_Label_YAxes=Y axes
+ExcelChart_Status_Done=Excel chart export is finished.
+ExcelChart_Tab_Advanced=Advanced
+ExcelChart_Tab_Basic=Basic
+ExcelChart_Title_MainForm=Excel Chart Export
+ExcelChart_Type_Area3D=Area 3D
+ExcelChart_Type_Area=Area
+ExcelChart_Type_AreaStacked3D=Area stacked 3D
+ExcelChart_Type_AreaStacked=Area stacked
+ExcelChart_Type_BarsClustered3D=Bars clustered 3D
+ExcelChart_Type_BarsClustered=Bars clustered
+ExcelChart_Type_BarsStacked3D=Bars stacked 3D
+ExcelChart_Type_BarsStacked=Bars stacked
+ExcelChart_Type_ColumnsClustered3D=Columns clustered 3D
+ExcelChart_Type_ColumnsClustered=Columns clustered
+ExcelChart_Type_ColumnsStacked3D=Columns stacked 3D
+ExcelChart_Type_ColumnsStacked=Columns stacked
+ExcelChart_Type_Line=Line
+ExcelChart_Type_LineStacked=Line stacked
+ExcelChart_Type_Pie3D=Pie 3D
+ExcelChart_Type_Pie=Pie
+ExcelChart_Type_PieExploded3D=Pie exploded 3D
+ExcelChart_Type_PieExploded=Pie exploded
+ExcelChart_Various_Averaged=averaged
+ExcelChart_Various_Column=Column
+ExcelChart_Various_Frequency=Frequency
+ExcelChart_Various_SummedUp=summed up
+ExcelChart_Various_Unknown=<Unknown>
+ExcelChart_WorksheetName_Chart=Chart
+ExcelChart_WorksheetName_Data=Chart data
+ExecutionTime=Server processing
+ExportDate=Export date
+ExtendedSearchAddAdditionalOrMenu=Add additional or insert
+ExtendedSearchAddAttribute=Constraint
+ExtendedSearchAddAttributeMenu=Add constraint...
+ExtendedSearchAddEitherOrMenu=Add either...or
+ExtendedSearchAddEntityPrefix=has
+ExtendedSearchAnd=and
+ExtendedSearchEditAttributeMenu=Edit...
+ExtendedSearchEither=either
+ExtendedSearchEntitySuffix=with
+ExtendedSearchNegateMenu=Negate
+ExtendedSearchNot=not
+ExtendedSearchOr=or
+ExtendedSearchRemoveAttributeMenu=Remove
+ExtendedSearchRemoveMenu=Remove
+FileExistsOwerwriteQuestion=The selected file exists already. Overwrite this file?
+FileName=File name
+FileNotFoundExceptionMessage=Could not find or access the file.
+FileNotFoundMessage=Could not find the following file\:\n{0}
+FileNotFoundTitle=File not found
+FilesOfType=File type
+FilterBookmarkTree=Browse bookmarks
+Folders=Folders
+FormButtonClicked=While clicking on a button
+FormCloseTimerActivated=Close timer activated
+FormClosing=Close
+FormDisposedMessage=The form {0} has already been disposed and does not allow further processing.
+FormEmptyMandatoryFieldsMessage=The following fields are required
+FormExportXml=Export to XML
+FormFinally=Finalize
+FormFireActivated=When form was activated
+FormFireClosed=When form was closed
+FormFireDiscarded=When form was discarded
+FormFirePrinted=When taking a picture of the form
+FormFireStructureChanged=When the form structure changed
+FormFireToBack=When sending form to back
+FormFireToFront=When sending form to front
+FormIncompleteIntro=Some values have to be verified.
+FormInvalidFieldsMessage=The following fields are invalid
+FormPrint=Print
+FormReset=Reset
+FormSaveChangesQuestion=Do you want to save the changes?
+FormStateLoad=Open...
+FormStateStore=Save
+FormStateStoreAs=Save as...
+FormTimerActivated=Timer activated
+FormattingLocale=Formatting
+GlobalBookmarks=Global favorites
+GlobalBookmarksAddMenu=Add to &global favorites
+Help=Help
+History=History
+Host=Computer
+Hour=Stunde
+IOErrorInfo=Please check files and connection to server.
+IOErrorText=Communication error
+IOErrorTitle=Read / write error
+InDaysX=in {0} days
+InactiveState=inactive
+InactiveStates=&Inactive
+Info=Information
+Information=Information
+Interrupted=Cancelled
+InterruptedErrorText=The process cancelled manually.
+InterruptedErrorTitle=Process cancelled
+InvalidNumberMessageX="{0}" is an invalid number
+InvalidPhoneNumberMessageX="{0}" is an invalid phone number
+InvalidValueMessageX="{0}" is an invalid value
+JavaVMVersion=Java VM
+JavaVersion=Java Runtime
+KeyStroke=Keystroke
+Language=Language
+Live=Live
+LoadFormXmlFailedText=This file is not compatible with this form.
+LogicBetween=is between {0} and {1}
+LogicBetweenShort=between
+LogicDateIsInDays=is in exactly {0} days
+LogicDateIsInGEDays=is earliest in {0} days
+LogicDateIsInGEMonths=is earliest in {0} months
+LogicDateIsInLEDays=is at the latest in {0} days
+LogicDateIsInLEMonths=is at the latest in {0} months
+LogicDateIsInLastDays=was in the last {0} days
+LogicDateIsInLastMonths=was in the last {0} months
+LogicDateIsInMonths=is in exactly {0} months
+LogicDateIsInNextDays=is in the next {0} days
+LogicDateIsInNextMonths=Date is in the next {0} months
+LogicDateIsNotToday=is not today
+LogicDateIsToday=is today
+LogicDateTimeIsInGEHours=is at the earliest in {0} hours
+LogicDateTimeIsInGEMinutes=is at the earliest in {0} minutes
+LogicDateTimeIsInLEHours=is at the latest in {0} hours
+LogicDateTimeIsInLEMinutes=is at the latest in {0} minutes
+LogicDateTimeIsNotNow=is not now
+LogicDateTimeIsNow=is now
+LogicEQ=\=
+LogicEndsWith=ends with
+LogicGE=>\=
+LogicGT=>
+LogicIn=is
+LogicLE=<\=
+LogicLT=<
+LogicLike=contains
+LogicNEQ=<>
+LogicNotEndsWith=doesn't end with
+LogicNotIn=is not
+LogicNotLike=doesn't contain
+LogicNotNull=is not empty
+LogicNotStartsWith=doesn't start with
+LogicNull=is empty
+LogicStartsWith=starts with
+LogicTimeIsInGEHours=is at the earliest in {0} hours
+LogicTimeIsInGEMinutes=is at the earliest in {0} minutes
+LogicTimeIsInHours=is in exactly {0} hours
+LogicTimeIsInLEHours=is at the latest in {0} hours
+LogicTimeIsInLEMinutes=is at the latest in {0} minutes
+LogicTimeIsInMinutes=is in exactly {0} minutes
+LogicTimeIsNotNow=is not now
+LogicTimeIsNow=is now
+Login=Login
+LookAndFeel=Look and feel
+LookIn=Look in
+MemoryStatus=Memory
+Minute=Minute
+ModifyCustomColumnMenu=Edit column...
+Month=Month
+Name=Name
+NavigationBackward=Back
+NavigationForward=Forward
+NetErrorInfo=Please check server name, URL and server connection.
+NetErrorText=Server not found
+NetErrorTitle=Network error
+NetworkLatency=Network delay
+NewBookmarkFolderMenu=New folder...
+NewPassword=New password
+No=No
+NoButton=&No
+None=None
+NumberOfRows=Data record count
+NumberTooLargeMessageXY=The value is too large; must be between {0} and {1}.
+NumberTooSmallMessageXY=The value is too small; must be between {0} and {1}.
+OSUser=System user
+OSVersion=System version
+OcrEditorMoveTool=Move image
+OcrEditorNextPage=Next page
+OcrEditorOCRTool=Character recognition
+OcrEditorOfX=of
+OcrEditorPage=Page
+OcrEditorPreviousPage=Previous page
+OcrEditorRotateLeft=Rotate left
+OcrEditorRotateRight=Rotate right
+OcrEditorZoomIn=Zoom in
+OcrEditorZoomOut=Zoom out
+OcrEditorZoomToFit=Zoom to fit
+Ok=OK
+OkButton=&OK
+OkButtonTooltip=Save and close
+OldPassword=Old password
+OneFiltered=1 hidden by filter
+OneRow=1 object
+OneSelected=1 selected
+Op=Operator
+Open=Open
+OrganizeTableColumnsMenu=Organize columns...
+OrganizeTableColumnsMinimalColumnCountMessage=There must be at least one visible column. Please set a column visible.
+OrganizeTableColumnsTitle=Organize columns
+OriginalErrorMessageIs=The original message is\:\n{0}
+OutlineSelectorAddOrRemoveButtons=Add or remove &buttons
+OutlineSelectorShowFewerButtons=Show &fewer buttons
+OutlineSelectorShowMoreButtons=Show &more buttons
+Password=Password
+PasswordHasExpiredHeader=Your password has expired and should be changed now.
+PasswordHasExpiredTitle=Password expired
+PasswordMin8Chars=at least 8 characters
+PasswordMinOnNonStdChar=at least one non standard character
+PasswordMinOneChar=at least one character a-z/A-Z
+PasswordMinOneDigit=at least one digit 0-9
+PasswordNotSameAsLasts=must not be same as any of the last passwords
+PasswordUsernameNotPartOfPass=user name must not be part of the password
+PasswordWillExpireHeaderX=Your password expires {0}.
+PasswordWillExpireInfo=Would you like to change it now?
+PasswordWillExpireTitle=Password will expire
+PasswordsDoNotMatch=The two passwords do not match.
+Paste=Paste
+PasteTextTooLongForFieldX=The inserted text is too long for this field and was truncated.\nMaximum characters are {0}.
+Path=Path
+Pending=Waiting...
+PrivateBookmarks=Private Bookmarks
+Properties=Properties
+Redo=Redo
+Refresh=Refresh
+Remove=Remove
+RemoveAllCustomColumnsMenu=Remove my columns
+RemoveCustomColumnMenu=Remove column
+RenameBookmarkFolderMenu=Rename Folder...
+RepBuildExtract=Preparing data...
+RepExecAfter=Clean up database
+RepExecBefore=Prepare database
+RepUpdate=Processing data...
+RepeatPassword=Repeat
+RequestProblem=Processing error
+ResetButton=&Reset
+ResetButtonTooltip=Set all fields to empty values
+ResetTableColumnFilter=Filter
+ResetTableColumns=Reset columns
+ResetTableColumnsAll=All
+ResetTableColumnsOrder=Order
+ResetTableColumnsSorting=Sorting
+ResetTableColumnsView=View
+ResetTableColumnsWidth=Width
+SC_Copyright=The Sentry Spelling-Checker Engine and Dictionaries are copyrighted by Wintertree Software, Inc.
+SC_DialogTitle=Spell check
+SC_DialogTitle_Options=Spell check\: Options
+SC_Help_AddToDictionary=Adds the word to the user dictionary
+SC_Help_Cancel=Closes the dialogue and cancel all changes (speed key\: ESC)
+SC_Help_Change=Changes the current appearance of the word
+SC_Help_ChangeAll=Changes all appearances of the word (in the current text field)
+SC_Help_Enable=Activates or deactivates the Scout spell checking
+SC_Help_Ignore=Ignores the current appearance of the word
+SC_Help_IgnoreAll=Ignores this and all other appearances of this word
+SC_Help_IgnoreCase=Ignores upper/lower case spelling
+SC_Help_IgnoreDomainNames=Ignores 'www.bsiag.com', for example
+SC_Help_IgnoreWordsWithNumbers=Ignores words containing numbers
+SC_Help_Language=The chosen language
+SC_Help_Options=Opens the options dialogue
+SC_Help_RemoveWord=Removes the selected word from the user dictionary
+SC_Help_ReplacementWord=The word with which the selected word shall be replaced (press ENTER to replace the unrecognized word with this one)
+SC_Help_Shortcut=The shortcut key for the spell check dialogue. Fixed, cannot be changed.
+SC_Help_SuggestionList=Replacement suggestion for the selected word (double-click to replace the unrecognized word)
+SC_Help_Undo=Undoes the last change that was made
+SC_Help_UseDefaults=Resets all settings to the default values
+SC_Help_UserDictionary=Chooses a 'tlx' (Scout) or 'dic' (Microsoft Word) dictionary as user dictionary
+SC_Label_AddToDictionary=Add
+SC_Label_Cancel=Cancel
+SC_Label_Capitalization=Upper/lowercase spelling
+SC_Label_Change=Change
+SC_Label_ChangeAll=Change all
+SC_Label_ChangeTo=Change to
+SC_Label_ConsiderChanging=Consider changing
+SC_Label_ContainsDigits=Contains digits/numbers
+SC_Label_DoubledWord=Duplicated word
+SC_Label_Enable=Activate spell check
+SC_Label_Ignore=Ignore
+SC_Label_IgnoreAll=Ignore all
+SC_Label_IgnoreCase=Ignore upper/lowercase
+SC_Label_IgnoreDomainNames=Ignore domain names
+SC_Label_IgnoreWordsWithNumbers=Ignore words with numbers
+SC_Label_IgnoredWord=User-defined words
+SC_Label_Main=Spell check
+SC_Label_MixedCase=Mixed upper/lowercase
+SC_Label_NoSuggestions=(No suggestions)
+SC_Label_NotInDictionary=The selected word was not recognized
+SC_Label_Options=Options...
+SC_Label_RemoveWord=Remove word
+SC_Label_Shortcut=Shortcut key
+SC_Label_Spelling=Spelling
+SC_Label_Undo=Undo
+SC_Label_UseDefaults=Default
+SC_Label_UserDictionary=User dictionary
+SC_Language=Language
+SC_Message_CheckRest=Would you like to check the rest of the text?
+SC_Message_Complete=The spell check is complete
+SC_Message_CompleteForSelection=The spell check is complete for the current selection
+SC_Message_NotAvailable=Scout spell checking is not available
+Save=Save
+SaveButton=&Save
+SaveButtonTooltip=Save without closing
+SavePassword=Save username/password
+ScoutStarting=Scout is starting
+ScoutStoping=Scout is stoping
+Search=Search
+SearchButton=&Search
+SearchButtonTooltip=Start search
+SearchConstraints=Search constraint
+SearchTextIsTooGeneral=Please narrow search text
+SearchWasCanceled=Search was canceled. Please execute again.
+SelectedStates=Checked only
+Server=Server
+ServerCallCancelProcessing=Calling server to cancel processing...
+ServerCallProcessing=Calling server...
+SmartFieldCannotComplete=No suggestions for "{0}"
+SmartFieldMoreThanXRows=More than {0} data records
+SmartFindLabel=Search text
+SortDescending=Sort descending
+Source=Source
+StatusExportDone=Export complete
+StringPattern=Expression
+Style=Mode
+Subject=Subject
+TableName=Table
+Timestamp=Timestamp
+Title=Title
+Today=today
+Tomorrow=tomorrow
+TooManyRows=Large dataset. Please narrow using the search function.
+UncheckAll=Uncheck all
+Undo=Undo
+Update=Refresh
+UpdateBookmarkMenu=Update bookmark from current view
+UserCancelledOperation=The operation was manually cancelled
+UserInterrupted=Canceled by user
+Username=User name
+Value=Value
+VersionMismatchAction=Do you want to restart the application with automatic update?
+VersionMismatchTextXY=An application update is required to continue working.\n\nThe current version is {0}, the new version is {1}.
+VersionMismatchTitle=Update required
+VetoErrorText=At least one search field must be filled in.
+Week=Week
+WeekShort=CW
+Without=Without
+WizardBackButton=&Back
+WizardBackButtonTooltip=Back to previous step
+WizardCancelButton=Cancel
+WizardCancelButtonTooltip=Cancels the wizard and discards all data.
+WizardFinishButton=&Finish
+WizardFinishButtonTooltip=Finish this process and return to process selection.
+WizardNextButton=&Next
+WizardNextButtonTooltip=Proceed to next step
+WizardSuspendButton=&Close
+WizardSuspendButtonTooltip=Closes this process and closes the wizard (can be resumed later on).
+WorkWeek=Working week
+XFiltered={0} hidden by filter
+XMustBeGreaterThanOrEqualY='{0}' must be greater than or equal to '{1}'
+XMustBeLessThanOrEqualY='{0}' must be less than or equal to '{1}'
+XRows={0} objects
+XSelected={0} selected
+Yes=Yes
+YesButton=&Yes
+and=and
+between=Between
+from=from
+searchingProposals=searching proposals...
+to=to
diff --git a/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_bg.properties b/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_bg.properties
index bcc851d304..30e83cf713 100644
--- a/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_bg.properties
+++ b/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_bg.properties
@@ -1,224 +1,224 @@
-AllStates=\u0412\u0441\u0438\u0447\u043A\u0438
-Apply=\u041F\u0440\u0438\u043B\u043E\u0436\u0438
-Attribute=\u041A\u0430\u0447\u0435\u0441\u0442\u0432\u043E
-Bookmarks=\u041E\u0442\u043C\u0435\u0442\u043A\u0438
-BookmarksAddMenu=&\u0414\u043E\u0431\u0430\u0432\u0438 \u043A\u044A\u043C \u043E\u0442\u043C\u0435\u0442\u043A\u0438...
-BookmarksMainMenu=&\u041E\u0442\u043C\u0435\u0442\u043A\u0438
-BookmarksManageMenu=&\u0423\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435 \u043D\u0430 \u043E\u0442\u043C\u0435\u0442\u043A\u0438...
-BookmarksStartPageMenu=&\u041D\u0430\u0447\u0430\u043B\u0435\u043D \u0438\u0437\u0433\u043B\u0435\u0434
-BookmarksStartPageMenuClear=&\u0411\u0435\u0437 \u043D\u0430\u0447\u0430\u043B\u0435\u043D \u0438\u0437\u0433\u043B\u0435\u0434
-BookmarksStartPageMenuGoto=&\u041E\u0442\u0432\u043E\u0440\u0438 \u043D\u0430\u0447\u0430\u043B\u0435\u043D \u0438\u0437\u0433\u043B\u0435\u0434
-BookmarksStartPageMenuSet=&\u041D\u0430\u0441\u0442\u0440\u043E\u0439 \u0442\u0435\u043A\u0443\u0449\u0438\u044F\u0442 \u0438\u0437\u0433\u043B\u0435\u0434 \u043A\u0430\u0442\u043E \u043D\u0430\u0447\u0430\u043B\u0435\u043D
-ButtonDeselectAll=\u0414\u0435\u0441\u0435\u043B\u0435\u043A\u0442\u0438\u0440\u0430\u0439 \u0432\u0441\u0438\u0447\u043A\u043E
-ButtonSelectAll=\u0421\u0435\u043B\u0435\u043A\u0442\u0438\u0440\u0430\u0439 \u0432\u0441\u0438\u0447\u043A\u043E
-Calendar_earlier=\u041F\u043E-\u0440\u0430\u043D\u0435\u043D
-Calendar_later=\u041F\u043E-\u043A\u044A\u0441\u0435\u043D
-Cancel=\u041E\u0442\u043A\u0430\u0436\u0438
-CancelButton=&\u041E\u0442\u043A\u0430\u0436\u0438
-CancelButtonTooltip=\u0417\u0430\u0442\u0432\u0430\u0440\u044F\u043D\u0435 \u043D\u0430 \u0434\u0438\u0430\u043B\u043E\u0433\u043E\u0432\u0438\u044F \u043F\u0440\u043E\u0437\u043E\u0440\u0435\u0446 \u0431\u0435\u0437 \u0437\u0430\u043F\u0438\u0441\u0432\u0430\u043D\u0435.
-ChangePassword=\u0421\u043C\u044F\u043D\u0430 \u043D\u0430 \u043F\u0430\u0440\u043E\u043B\u0430
-CloseButton=&\u0417\u0430\u0442\u0432\u043E\u0440\u0438
-CloseButtonTooltip=\u0417\u0430\u0442\u0432\u043E\u0440\u0438 \u0434\u0438\u0430\u043B\u043E\u0433\u043E\u0432\u0438\u044F \u043F\u0440\u043E\u0437\u043E\u0440\u0435\u0446 \u0431\u0435\u0437 \u0437\u0430\u043F\u0430\u0437\u0432\u0430\u043D\u0435 \u043D\u0430 \u043F\u0440\u043E\u043C\u0435\u043D\u0438\u0442\u0435.
-Column=\u041A\u043E\u043B\u043E\u043D\u0430
-Columns=\u041A\u043E\u043B\u043E\u043D\u0438
-ComposerFieldAggregationLabel=\u0424\u0443\u043D\u043A\u0446\u0438\u044F
-Condensed=6 \u043A\u043E\u043B\u043E\u043D\u0438
-Copy=\u041A\u043E\u043F\u0438\u0440\u0430\u043D\u0435
-Cut=\u041E\u0442\u0440\u0435\u0436\u0438
-Day=\u0414\u0435\u043D
-DefaultPasswordPolicyText=The password does not comply with the given policy\n\nPolicy\:\n- at least 8 characters\n- at least one number (0-9)\n- at least one non standard character (\!|@|\#|$|%|^|&|*|(|)|_|+|||~|-|
-EmailFrom=\u041E\u0442
-EmailSubject=\u041F\u0440\u0435\u0434\u043C\u0435\u0442
-EmailTo=\u0414\u043E
-Error=\u0413\u0440\u0435\u0448\u043A\u0430
-ErrorAndRetryTextDefault=\u0412\u044A\u0437\u043D\u0438\u043A\u043D\u0430 \u0433\u0440\u0435\u0448\u043A\u0430 \u043F\u043E \u0432\u0440\u0435\u043C\u0435 \u043D\u0430 \u043F\u0440\u0435\u0445\u0432\u044A\u0440\u043B\u044F\u043D\u0435 \u043D\u0430 \u0434\u0430\u043D\u043D\u0438\u0442\u0435.
-ErrorTextLogin=\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E \u043F\u043E\u0442\u0440\u0435\u0431\u0438\u0442\u0435\u043B\u0441\u043A\u043E \u0438\u043C\u0435/\u043F\u0430\u0440\u043E\u043B\u0430
-ErrorTitleLogin=\u0412\u043B\u0438\u0437\u0430\u043D\u0435\u0442\u043E \u0432 \u0441\u0438\u0441\u0442\u0435\u043C\u0430\u0442\u0430 \u0435 \u043D\u0435\u0443\u0441\u043F\u0435\u0448\u043D\u043E
-ExcelChart_Button_LoadDefaults=\u041F\u043E \u0414\u0435\u0444\u0430\u0443\u043B\u0442
-ExcelChart_Button_LoadDefaultsHint=\u041E\u0442\u043C\u0435\u043D\u0438 \u0442\u043E\u0437\u0438 \u0434\u0438\u0430\u043B\u043E\u0433 \u0447\u0440\u0435\u0437 \u0437\u0430\u0440\u0435\u0436\u0434\u0430\u043D\u0435 \u043D\u0430 \u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442\u0438\u0442\u0435 \u043F\u043E \u0434\u0438\u0444\u043E\u043B\u0442.
-ExcelChart_Button_LoadProfile=\u0417\u0430\u0440\u0435\u0436\u0434\u0430 \u043F\u0440\u043E\u0444\u0438\u043B...
-ExcelChart_Button_LoadProfileHint=\u0417\u0430\u0440\u0435\u0436\u0434\u0430 \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438 \u043E\u0442 XML \u0444\u0430\u0439\u043B.
-ExcelChart_Button_SaveProfile=\u0417\u0430\u043F\u0430\u0437\u0438 \u043F\u0440\u043E\u0444\u0438\u043B...
-ExcelChart_Button_SaveProfileHint=\u0417\u0430\u043F\u0430\u0437\u0438 \u0442\u0435\u043A\u0443\u0449\u0438\u0442\u0435 \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438 \u0432 XML \u0444\u0430\u0439\u043B.
-ExcelChart_Error_CreatingChartFailed=\u0441\u044A\u0437\u0434\u0430\u0432\u0430\u043D\u0435\u0442\u043E \u043D\u0430 \u0433\u0440\u0430\u0444\u0438\u043A\u0430 \u043D\u0435\u0443\u0441\u043F\u0435\u0448\u043D\u043E
-ExcelChart_Error_ExportingFailed=\u0415\u043A\u0441\u043F\u043E\u0440\u0442\u0430 \u043D\u0435\u0443\u0441\u043F\u0435\u0448\u0435\u043D \u043F\u043E\u0440\u0430\u0434\u0438
-ExcelChart_Error_InitializationFailed=initialization of the support class(es) failed.
-ExcelChart_Error_LoadingProfileFailed=\u0417\u0430\u0440\u0435\u0436\u0434\u0430\u043D\u0435\u0442\u043E \u043D\u0430 \u043F\u0440\u043E\u0444\u0438\u043B \u043D\u0435\u0443\u0441\u043F\u0435\u0448\u043D\u043E \u043F\u043E\u0440\u0430\u0434\u0438
-ExcelChart_Error_LoadingTemplateFailed=\u0437\u0430\u0440\u0435\u0436\u0434\u0430\u043D\u0435\u0442\u043E \u043D\u0430 \u0448\u0430\u0431\u043B\u043E\u043D \u043D\u0435\u0443\u0441\u043F\u0435\u0448\u043D\u043E \u043F\u043E\u0440\u0430\u0434\u0438
-ExcelChart_Error_RetrivingOutlineDataFailed=retriving outline data failed.
-ExcelChart_Error_SavingProfileFailed=\u0417\u0430\u043F\u0430\u0437\u0432\u0430\u043D\u0435\u0442\u043E \u043D\u0430 \u043F\u0440\u043E\u0444\u0438\u043B\u0430 \u043D\u0435\u0443\u0441\u043F\u0435\u0448\u043D\u043E \u043F\u043E\u0440\u0430\u0434\u0438
-ExcelChart_Error_WrongProfile=the profile was created for another outline.
-ExcelChart_Label_AutomaticMode=\u0410\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u0435\u043D \u0440\u0435\u0436\u0438\u043C
-ExcelChart_Label_AutomaticModeHint=\u0421\u043A\u0440\u0438\u0439 \u0415\u043A\u0441\u0435\u043B \u0438 \u0437\u0430\u043F\u0430\u0437\u0438 \u0430\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u043D\u043E
-ExcelChart_Label_ChartNumber=\u041D\u043E\u043C\u0435\u0440 \u043D\u0430 \u0433\u0440\u0430\u0444\u0438\u043A\u0430
-ExcelChart_Label_ChartType=\u0422\u0438\u043F \u0433\u0440\u0430\u0444\u0438\u043A\u0430
-ExcelChart_Label_FileName=\u0418\u043C\u0435 \u043D\u0430 \u0444\u0430\u0439\u043B
-ExcelChart_Label_FirstRow=\u041F\u0440\u044A\u0432 \u0440\u0435\u0434
-ExcelChart_Label_Height=\u0412\u0438\u0441\u043E\u0447\u0438\u043D\u0430
-ExcelChart_Label_HistogramMode=\u0420\u0435\u0436\u0438\u043C \u043D\u0430 \u0425\u0438\u0441\u0442\u043E\u0433\u0440\u0430\u043C\u0430
-ExcelChart_Label_HistogramModeHint=The histogram mode combines identical values on the X-Axis to one.
-ExcelChart_Label_LastRow=\u041F\u043E\u0441\u043B\u0435\u0434\u0435\u043D \u0440\u0435\u0434
-ExcelChart_Label_Offset=\u041F\u043E\u0437\u0438\u0446\u0438\u044F
-ExcelChart_Label_SkipNullValues=\u041F\u0440\u0435\u0441\u043A\u043E\u0447\u0438 \u043D\u0443\u043B\u0435\u0432\u0438\u0442\u0435 \u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442\u0438 \u0438 \u0440\u0435\u0436\u0438\u043C \u0425\u0438\u0441\u0442\u043E\u0433\u0440\u0430\u043C\u0430
-ExcelChart_Label_SkipNullValuesHint=If checked null values on the X-Axis are ignored, otherwise they are combined to <Unknown>.
-ExcelChart_Label_TemplateName=\u0428\u0430\u0431\u043B\u043E\u043D
-ExcelChart_Label_UseCustomFormat=\u0418\u0437\u043F\u043E\u043B\u0437\u0432\u0430\u0439 \u043F\u043E\u0434\u0445\u043E\u0434\u044F\u0449 \u0444\u043E\u0440\u043C\u0430\u0442
-ExcelChart_Label_UseCustomFormatHint=\u0410\u043A\u043E \u0435 \u043E\u0442\u0431\u0435\u043B\u044F\u0437\u0430\u043D\u043E \u0432\u0438\u0435 \u043C\u043E\u0436\u0435\u0442\u0435 \u0434\u0430 \u043E\u0442\u0431\u0435\u043B\u0435\u0436\u0438\u0442\u0435 \u043F\u043E\u0437\u0438\u0446\u0438\u044F\u0442\u0430 \u0438 \u0440\u0430\u0437\u043C\u0435\u0440\u044A\u0442 \u043D\u0430 \u0433\u0440\u0430\u0444\u0438\u043A\u0430\u0442\u0430.
-ExcelChart_Label_UseExistingChart=\u0418\u0437\u043F\u043E\u043B\u0437\u0432\u0430 \u0441\u044A\u0449\u0435\u0441\u0442\u0432\u0443\u0432\u0430\u0449\u0430 \u0433\u0440\u0430\u0444\u0438\u043A\u0430
-ExcelChart_Label_UseExistingChartHint=\u0410\u043A\u043E \u0435 \u043E\u0442\u0431\u0435\u043B\u044F\u0437\u0430\u043D\u043E \u0441\u044A\u0449\u0435\u0441\u0442\u0432\u0443\u0432\u0430\u0449\u0430\u0442\u0430 \u0433\u0440\u0430\u0444\u0438\u043A\u0430 \u0432 \u043E\u0442\u0431\u0435\u043B\u044F\u0437\u0430\u043D\u0438\u044F\u0442 \u0448\u0430\u0431\u043B\u043E\u043D \u0435 \u0438\u0437\u043F\u043E\u043B\u0437\u0432\u0430\u043D\u0430.
-ExcelChart_Label_UseSelectiveExport=\u0418\u0437\u043F\u043E\u043B\u0437\u0432\u0430\u0439 \u0441\u0435\u043B\u0435\u043A\u0442\u0438\u0440\u0430\u043D \u0435\u043A\u0441\u043F\u043E\u0440\u0442
-ExcelChart_Label_UseSelectiveExportHint=\u0410\u043A\u043E \u0435 \u043E\u0442\u0431\u0435\u043B\u044F\u0437\u0430\u043D\u043E, \u0441\u0430\u043C\u043E \u0440\u0435\u0434\u043E\u0432\u0435\u0442\u0435 \u043E\u0442\u0431\u0435\u043B\u044F\u0437\u0430\u043D\u0438 \u043F\u043E-\u0434\u043E\u043B\u0443 \u0441\u0430 \u0435\u043A\u0441\u043F\u043E\u0440\u0442\u0438\u0440\u0430\u043D\u0438.
-ExcelChart_Label_Width=\u0428\u0438\u0440\u043E\u0447\u0438\u043D\u0430
-ExcelChart_Label_WorksheetName=\u0420\u0430\u0431\u043E\u0442\u043D\u0430 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0430
-ExcelChart_Label_XAxis=X-Axis
-ExcelChart_Label_YAxes=Y-Axes
-ExcelChart_Status_Done=\u0415\u043A\u0441\u043F\u043E\u0440\u0442\u0430 \u043D\u0430 \u0415\u043A\u0441\u0435\u043B\u0441\u043A\u0430\u0442\u0430 \u0422\u0430\u0431\u043B\u0438\u0446\u0430 \u0435 \u043D\u0430\u043F\u0440\u0430\u0432\u0435\u043D
-ExcelChart_Tab_Advanced=\u041D\u0430\u043F\u0440\u0435\u0434\u043D\u0430\u043B
-ExcelChart_Tab_Basic=\u041E\u0441\u043D\u043E\u0432\u0435\u043D
-ExcelChart_Title_MainForm=\u0415\u043A\u0441\u043F\u043E\u0440\u0442 \u043D\u0430 \u0415\u043A\u0441\u0435\u043B\u0441\u043A\u0430 \u0422\u0430\u0431\u043B\u0438\u0446\u0430
-ExcelChart_Type_Area3D=Area 3D
-ExcelChart_Type_Area=\u041E\u0431\u043B\u0430\u0441\u0442
-ExcelChart_Type_AreaStacked3D=Area Stacked 3D
-ExcelChart_Type_AreaStacked=Area Stacked
-ExcelChart_Type_BarsClustered3D=Bars Clustered 3D
-ExcelChart_Type_BarsClustered=Bars Clustered
-ExcelChart_Type_BarsStacked3D=Bars Stacked 3D
-ExcelChart_Type_BarsStacked=Bars Stacked
-ExcelChart_Type_ColumnsClustered3D=Columns Clustered 3D
-ExcelChart_Type_ColumnsClustered=Columns Clustered
-ExcelChart_Type_ColumnsStacked3D=Columns Stacked 3D
-ExcelChart_Type_ColumnsStacked=Columns Stacked
-ExcelChart_Type_Line=\u041B\u0438\u043D\u0438\u044F
-ExcelChart_Type_LineStacked=Line Stacked
-ExcelChart_Type_Pie3D=Pie 3D
-ExcelChart_Type_Pie=Pie
-ExcelChart_Type_PieExploded3D=Pie Exploded 3D
-ExcelChart_Type_PieExploded=Pie exploded
-ExcelChart_Various_Averaged=\u0443\u0441\u0440\u0435\u0434\u043D\u0435\u043D
-ExcelChart_Various_Column=\u041A\u043E\u043B\u043E\u043D\u0430
-ExcelChart_Various_Frequency=\u0427\u0435\u0441\u0442\u043E\u0442\u0430
-ExcelChart_Various_SummedUp=summed up
-ExcelChart_Various_Unknown=<\u041D\u0435\u043F\u043E\u0437\u043D\u0430\u0442>
-ExportDate=\u0415\u043A\u0441\u043F\u043E\u0440\u0442 \u043D\u0430 \u0434\u0430\u043D\u043D\u0438
-ExtendedSearchAddAttributeMenu=\u0414\u043E\u0431\u0430\u0432\u0435\u0442\u0435 \u043E\u0433\u0440\u0430\u043D\u0438\u0447\u0430\u0432\u0430\u0449\u0438 \u0443\u0441\u043B\u043E\u0432\u0438\u044F...
-ExtendedSearchAddEntityPrefix=\u0438\u043C\u0430
-ExtendedSearchAnd=\u0438
-ExtendedSearchEditAttributeMenu=\u0420\u0435\u0434\u0430\u043A\u0442\u0438\u0440\u0430\u043D\u0435...
-ExtendedSearchEntitySuffix=\u0441
-ExtendedSearchNegateMenu=\u041E\u0442\u0445\u0432\u044A\u0440\u043B\u044F\u043C
-ExtendedSearchRemoveAttributeMenu=\u041F\u0440\u0435\u043C\u0430\u0445\u043D\u0438
-ExtendedSearchRemoveMenu=\u041F\u0440\u0435\u043C\u0430\u0445\u043D\u0438
-FileExistsOwerwriteQuestion=\u0418\u0437\u0431\u0440\u0430\u043D\u0438\u044F\u0442 \u0444\u0430\u0439\u043B \u0432\u0435\u0447\u0435 \u0441\u044A\u0449\u0435\u0441\u0442\u0432\u0443\u0432\u0430. \u0414\u0430 \u043F\u0440\u0435\u0437\u0430\u043F\u0438\u0448\u0430 \u043B\u0438 \u0442\u043E\u0437\u0438 \u0444\u0430\u0439\u043B?
-FileName=&\u0414\u043E\u0431\u0430\u0432\u0438 \u043A\u044A\u043C \u043E\u0442\u043C\u0435\u0442\u043A\u0438...
-FileNotFoundMessage=\u0424\u0430\u0439\u043B\u044A\u0442 \u043D\u0435 \u043C\u043E\u0436\u0435 \u0434\u0430 \u0431\u044A\u0434\u0435 \u043D\u0430\u043C\u0435\u0440\u0435\u043D.
-FileNotFoundTitle=\u0424\u0430\u0439\u043B\u044A\u0442 \u043D\u0435 \u0435 \u043D\u0430\u043C\u0435\u0440\u0435\u043D.
-FilesOfType=\u0422\u0438\u043F \u043D\u0430 \u0444\u0430\u0439\u043B\u0430
-FormPrint=\u041F\u0435\u0447\u0430\u0442
-FormSaveChangesQuestion=\u0416\u0435\u043B\u0430\u0435\u0442\u0435 \u043B\u0438 \u0434\u0430 \u0437\u0430\u043F\u0430\u0437\u0438\u0442\u0435 \u043F\u0440\u043E\u043C\u0435\u043D\u0438\u0442\u0435?
-FormStateLoad=\u0417\u0430\u0440\u0435\u0436\u0434\u0430\u043D\u0435...
-FormStateStore=\u0417\u0430\u043F\u0438\u0441\u0432\u0430\u043C
-FormStateStoreAs=\u0417\u0430\u043F\u0438\u0448\u0438 \u043A\u0430\u0442\u043E...
-GlobalBookmarks=\u041E\u0431\u0449\u0438 \u0431\u0443\u043A\u043C\u0430\u0440\u043A\u0441
-GlobalBookmarksAddMenu=Add to &global bookmarks
-Help=\u041F\u043E\u043C\u043E\u0449
-IOErrorInfo=\u041C\u043E\u043B\u044F \u043F\u0440\u043E\u0432\u0435\u0440\u0435\u0442\u0435 \u0444\u0430\u0439\u043B\u043E\u0432\u0435\u0442\u0435 \u0438 \u0432\u0440\u044A\u0437\u043A\u0430\u0442\u0430.
-IOErrorText=\u041A\u043E\u043C\u0443\u043D\u0438\u043A\u0430\u0446\u0438\u043E\u043D\u043D\u0430 \u0433\u0440\u0435\u0448\u043A\u0430.
-IOErrorTitle=\u0413\u0440\u0435\u0448\u043A\u0430 \u043F\u0440\u0438 \u0447\u0435\u0442\u0435\u043D\u0435/\u043F\u0438\u0441\u0430\u043D\u0435
-Info=\u0418\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u044F
-Interrupted=\u041F\u0440\u0435\u043A\u044A\u0441\u043D\u0430\u0442
-InterruptedErrorText=\u041F\u0440\u043E\u0446\u0435\u0441\u044A\u0442 \u0435 \u0431\u0438\u043B \u0441\u043F\u0440\u044F\u043D \u0440\u044A\u0447\u043D\u043E
-InterruptedErrorTitle=\u041F\u0440\u043E\u0446\u0435\u0441\u044A\u0442 \u0435 \u043E\u0442\u043C\u0435\u043D\u0435\u043D
-JavaVMVersion=Java VM
-Language=\u0415\u0437\u0438\u043A
-LoadFormXmlFailedText=\u0424\u0430\u0439\u043B\u0430 \u043D\u0435 \u0435 \u0441\u044A\u0432\u043C\u0435\u0441\u0442\u0438\u043C \u0441 \u0442\u043E\u0437\u0438 \u0434\u0438\u0430\u043B\u043E\u0433.
-LogicDateIsInDays=\u0435 \u0441\u043B\u0435\u0434 \u0442\u043E\u0447\u043D\u043E (\u0434\u043D\u0438)
-LogicDateIsInGEDays=\u0435 \u043D\u0430\u0439-\u0440\u0430\u043D\u043E \u0441\u043B\u0435\u0434 (\u0434\u0435\u043D\u0430)
-LogicDateIsInGEMonths=\u0435 \u043D\u0430\u0439-\u0440\u0430\u043D\u043E \u0441\u043B\u0435\u0434 (\u043C\u0435\u0441\u0435\u0446\u0430)
-LogicDateIsInLEDays=\u0435 \u043D\u0430\u0439-\u043A\u044A\u0441\u043D\u043E \u0441\u043B\u0435\u0434 (\u0434\u043D\u0438)
-LogicDateIsInLEMonths=\u0435 \u043D\u0430\u0439-\u043A\u044A\u0441\u043D\u043E \u0441\u043B\u0435\u0434 (\u043C\u0435\u0441\u0435\u0446\u0430)
-LogicDateIsInLastDays=\u0431\u0435\u0448\u0435 \u0432 \u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0442\u0435 n \u0434\u0435\u043D\u0430
-LogicDateIsInLastMonths=\u0431\u0435\u0448\u0435 \u0432 \u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0442\u0435 n \u041C\u0435\u0441\u0435\u0446\u0430
-LogicDateIsInMonths=\u0435 \u0442\u043E\u0447\u043D\u043E \u0441\u043B\u0435\u0434 (\u043C\u0435\u0441\u0435\u0446\u0438)
-LogicDateIsInNextDays=was in next n days
-LogicDateIsInNextMonths=was in next n Months
-LogicDateIsNotToday=\u043D\u0435 \u0435 \u0434\u043D\u0435\u0441
-LogicDateIsToday=\u0435 \u0434\u043D\u0435\u0441
-LogicDateTimeIsInGEHours=\u0435 \u043D\u0430\u0439-\u0440\u0430\u043D\u043E (\u0447\u0430\u0441\u0430)
-LogicDateTimeIsInGEMinutes=\u0435 \u043D\u0430\u0439-\u0440\u0430\u043D\u043E (\u043C\u0438\u043D\u0443\u0442\u0438)
-LogicDateTimeIsInLEHours=\u0435 \u043D\u0430\u0439-\u043A\u044A\u0441\u043D\u043E (\u0447\u0430\u0441\u0430)
-LogicDateTimeIsInLEMinutes=\u0435 \u043D\u0430\u0439-\u043A\u044A\u0441\u043D\u043E (\u043C\u0438\u043D\u0443\u0442\u0438)
-LogicDateTimeIsNotNow=\u043D\u0435 \u0435 \u0441\u0435\u0433\u0430
-LogicDateTimeIsNow=\u0435 \u0441\u0435\u0433\u0430
-LogicEQ=\=
-LogicEndsWith=\u0417\u0430\u0432\u044A\u0440\u0448\u0432\u0430 \u0441
-LogicGE=>\=
-LogicGT=>
-LogicIn=\u0435
-LogicLE=<\=
-LogicLT=<
-LogicLike=\u0421\u044A\u0434\u044A\u0440\u0436\u0430
-LogicNEQ=<>
-LogicNotIn=\u043D\u0435 \u0435
-LogicNotLike=\u043D\u0435 \u0441\u044A\u0434\u044A\u0440\u0436\u0430
-LogicNotNull=\u043D\u0435 \u0435 \u043F\u0440\u0430\u0437\u043D\u043E
-LogicNull=\u0435 \u043F\u0440\u0430\u0437\u043D\u043E
-LogicStartsWith=\u0417\u0430\u043F\u043E\u0447\u043D\u0438 \u0441
-LogicTimeIsInGEHours=\u0435 \u043D\u0430\u0439-\u0440\u0430\u043D\u043E \u0441\u043B\u0435\u0434 (\u0447\u0430\u0441\u0430)
-LogicTimeIsInGEMinutes=\u0435 \u043D\u0430\u0439-\u0440\u0430\u043D\u043E \u0441\u043B\u0435\u0434 (\u043C\u0438\u043D\u0443\u0442\u0438)
-LogicTimeIsInHours=\u0435 \u0441\u043B\u0435\u0434 \u0442\u043E\u0447\u043D\u043E (\u0447\u0430\u0441\u0430)
-LogicTimeIsInLEHours=\u0435 \u043D\u0430\u0439-\u043A\u044A\u0441\u043D\u043E \u0441\u043B\u0435\u0434 (\u0447\u0430\u0441\u0430)
-LogicTimeIsInLEMinutes=\u0435 \u043D\u0430\u0439-\u043A\u044A\u0441\u043D\u043E \u0441\u043B\u0435\u0434 (\u043C\u0438\u043D\u0443\u0442\u0438)
-LogicTimeIsInMinutes=\u0435 \u0441\u043B\u0435\u0434 \u0442\u043E\u0447\u043D\u043E (\u043C\u0438\u043D\u0443\u0442\u0438)
-LogicTimeIsNotNow=\u043D\u0435 \u0435 \u0441\u0435\u0433\u0430
-LogicTimeIsNow=\u0435 \u0441\u0435\u0433\u0430
-Login=\u0412\u043B\u0438\u0437\u0430\u043C
-LookIn=\u041F\u043E\u0433\u043B\u0435\u0434\u043D\u0438 \u0432
-Month=\u041C\u0435\u0441\u0435\u0446
-Name=\u0418\u043C\u0435
-NetErrorInfo=\u041C\u043E\u043B\u044F \u043F\u0440\u043E\u0432\u0435\u0440\u0435\u0442\u0435 \u0438\u043C\u0435\u0442\u043E \u043D\u0430 \u0441\u044A\u0440\u0432\u044A\u0440\u0430, URL \u0438 \u0432\u0440\u044A\u0437\u043A\u0430\u0442\u0430.
-NetErrorText=\u0421\u044A\u0440\u0432\u044A\u0440\u044A\u0442 \u043D\u0435 \u0435 \u043D\u0430\u043C\u0435\u0440\u0435\u043D
-NetErrorTitle=\u0413\u0440\u0435\u0448\u043A\u0430 \u043F\u043E \u043C\u0440\u0435\u0436\u0430\u0442\u0430
-NewPassword=\u041D\u043E\u0432\u0430 \u043F\u0430\u0440\u043E\u043B\u0430
-No=\u041D\u0435
-NoButton=&\u041D\u0435
-NumberOfRows=\u0411\u0440\u043E\u044F\u0447 \u043D\u0430 \u0440\u0435\u0434\u043E\u0432\u0435\u0442\u0435
-OSUser=\u0421\u0438\u0441\u0442\u0435\u043C\u0435\u043D \u043F\u043E\u0442\u0440\u0435\u0431\u0438\u0442\u0435\u043B
-OSVersion=\u0412\u0435\u0440\u0441\u0438\u044F \u043D\u0430 \u0441\u0438\u0441\u0442\u0435\u043C\u0430\u0442\u0430
-Ok=Ok
-OkButton=&\u041E\u043A
-OkButtonTooltip=\u0417\u0430\u043F\u0438\u0448\u0438 \u0438 \u0437\u0430\u0442\u0432\u043E\u0440\u0438 \u0434\u0438\u0430\u043B\u043E\u0433\u043E\u0432\u0438\u044F \u043F\u0440\u043E\u0437\u043E\u0440\u0435\u0446.
-OldPassword=\u0421\u0442\u0430\u0440\u0430 \u043F\u0430\u0440\u043E\u043B\u0430
-Op=\u041E\u043F\u0435\u0440\u0430\u0442\u043E\u0440
-Open=\u041E\u0442\u0432\u043E\u0440\u0438
-Password=\u041F\u0430\u0440\u043E\u043B\u0430
-PasswordsDoNotMatch=\u0414\u0432\u0435\u0442\u0435 \u043F\u0430\u0440\u043E\u043B\u0438 \u043D\u0435 \u0441\u044A\u0432\u043F\u0430\u0434\u0430\u0442.
-Paste=\u0412\u043C\u044A\u043A\u0432\u0430\u043C
-Path=\u041F\u044A\u0442\u0435\u043A\u0430
-RepeatPassword=\u041F\u043E\u0432\u0442\u043E\u0440\u0438
-ResetButton=&\u0410\u043D\u0443\u043B\u0438\u0440\u0430\u043D\u0435
-ResetButtonTooltip=\u0412\u0441\u0438\u0447\u043A\u0438 \u0434\u0438\u0430\u043B\u043E\u0433\u043E\u0432\u0438 \u043F\u043E\u043B\u0435\u0442\u0430 \u0441\u0435 \u0438\u0437\u0447\u0438\u0441\u0442\u0432\u0430\u0442.
-Save=\u0417\u0430\u043F\u0438\u0448\u0438
-SaveButton=&\u0417\u0430\u043F\u0430\u0437\u0438
-SaveButtonTooltip=\u0417\u0430\u043F\u0430\u0437\u0438 \u0434\u0438\u0430\u043B\u043E\u0433\u0430 \u0431\u0435\u0437 \u0434\u0430 \u0433\u043E \u0437\u0430\u0442\u0432\u0430\u0440\u044F\u0448.
-SearchButton=&\u0422\u044A\u0440\u0441\u0435\u043D\u0435
-SearchButtonTooltip=\u0417\u0430\u0442\u0432\u0430\u0440\u044F\u043D\u0435 \u043D\u0430 \u0434\u0438\u0430\u043B\u043E\u0433\u043E\u0432\u0438\u044F \u043F\u0440\u043E\u0437\u043E\u0440\u0435\u0446 \u0438 \u0437\u0430\u043F\u043E\u0447\u0432\u0430\u043D\u0435 \u043D\u0430 \u0442\u044A\u0440\u0441\u0435\u043D\u0435\u0442\u043E.
-SearchConstraints=\u0421\u0442\u0435\u0441\u043D\u044F\u0432\u0430\u043D\u0435 \u043D\u0430 \u0442\u044A\u0440\u0441\u0435\u043D\u0435\u0442\u043E
-Server=\u0421\u044A\u0440\u0432\u044A\u0440
-SmartFindLabel=\u0422\u044A\u0440\u0441\u0435\u043D\u0435 \u043D\u0430 \u0442\u0435\u043A\u0441\u0442
-StatusExportDone=\u0418\u0437\u043D\u0430\u0441\u044F\u043D\u0435\u0442\u043E \u0437\u0430\u0432\u044A\u0440\u0448\u0435\u043D\u043E
-Today=\u0434\u043D\u0435\u0441
-TooManyRows=\u0422\u0432\u044A\u0440\u0434\u0435 \u043C\u043D\u043E\u0433\u043E \u0438\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u044F. \u041C\u043E\u043B\u044F \u043A\u043E\u043D\u043A\u0440\u0435\u0442\u0438\u0437\u0438\u0440\u0430\u0439\u0442\u0435 \u043F\u043E\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043E\u043C Serach Panel.
-Update=\u041E\u0431\u043D\u043E\u0432\u044F\u0432\u0430\u043D\u0435
-UserInterrupted=\u041F\u0440\u0435\u043A\u044A\u0441\u043D\u0430\u0442\u043E \u043E\u0442 \u043F\u043E\u0442\u0440\u0435\u0431\u0438\u0442\u0435\u043B\u044F
-Username=\u0418\u043C\u0435 \u043D\u0430 \u043F\u043E\u0442\u0440\u0435\u0431\u0438\u0442\u0435\u043B\u044F
-Value=\u0421\u0442\u043E\u0439\u043D\u043E\u0441\u0442
-Week=\u0421\u0435\u0434\u043C\u0438\u0446\u0430
-WeekShort=CW
-WizardCancelButton=\u041E\u0442\u043C\u0435\u043D\u044F\u043C
-WizardSuspendButton=&\u0417\u0430\u0442\u0432\u043E\u0440\u0438
-WorkWeek=\u0420\u0430\u0431\u043E\u0442\u043D\u0430 \u0441\u0435\u0434\u043C\u0438\u0446\u0430
-Yes=\u0414\u0430
-YesButton=&\u0414\u0430
-and=\u0438
-from=\u043E\u0442
-to=\u0434\u043E
+AllStates=\u0412\u0441\u0438\u0447\u043A\u0438
+Apply=\u041F\u0440\u0438\u043B\u043E\u0436\u0438
+Attribute=\u041A\u0430\u0447\u0435\u0441\u0442\u0432\u043E
+Bookmarks=\u041E\u0442\u043C\u0435\u0442\u043A\u0438
+BookmarksAddMenu=&\u0414\u043E\u0431\u0430\u0432\u0438 \u043A\u044A\u043C \u043E\u0442\u043C\u0435\u0442\u043A\u0438...
+BookmarksMainMenu=&\u041E\u0442\u043C\u0435\u0442\u043A\u0438
+BookmarksManageMenu=&\u0423\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435 \u043D\u0430 \u043E\u0442\u043C\u0435\u0442\u043A\u0438...
+BookmarksStartPageMenu=&\u041D\u0430\u0447\u0430\u043B\u0435\u043D \u0438\u0437\u0433\u043B\u0435\u0434
+BookmarksStartPageMenuClear=&\u0411\u0435\u0437 \u043D\u0430\u0447\u0430\u043B\u0435\u043D \u0438\u0437\u0433\u043B\u0435\u0434
+BookmarksStartPageMenuGoto=&\u041E\u0442\u0432\u043E\u0440\u0438 \u043D\u0430\u0447\u0430\u043B\u0435\u043D \u0438\u0437\u0433\u043B\u0435\u0434
+BookmarksStartPageMenuSet=&\u041D\u0430\u0441\u0442\u0440\u043E\u0439 \u0442\u0435\u043A\u0443\u0449\u0438\u044F\u0442 \u0438\u0437\u0433\u043B\u0435\u0434 \u043A\u0430\u0442\u043E \u043D\u0430\u0447\u0430\u043B\u0435\u043D
+ButtonDeselectAll=\u0414\u0435\u0441\u0435\u043B\u0435\u043A\u0442\u0438\u0440\u0430\u0439 \u0432\u0441\u0438\u0447\u043A\u043E
+ButtonSelectAll=\u0421\u0435\u043B\u0435\u043A\u0442\u0438\u0440\u0430\u0439 \u0432\u0441\u0438\u0447\u043A\u043E
+Calendar_earlier=\u041F\u043E-\u0440\u0430\u043D\u0435\u043D
+Calendar_later=\u041F\u043E-\u043A\u044A\u0441\u0435\u043D
+Cancel=\u041E\u0442\u043A\u0430\u0436\u0438
+CancelButton=&\u041E\u0442\u043A\u0430\u0436\u0438
+CancelButtonTooltip=\u0417\u0430\u0442\u0432\u0430\u0440\u044F\u043D\u0435 \u043D\u0430 \u0434\u0438\u0430\u043B\u043E\u0433\u043E\u0432\u0438\u044F \u043F\u0440\u043E\u0437\u043E\u0440\u0435\u0446 \u0431\u0435\u0437 \u0437\u0430\u043F\u0438\u0441\u0432\u0430\u043D\u0435.
+ChangePassword=\u0421\u043C\u044F\u043D\u0430 \u043D\u0430 \u043F\u0430\u0440\u043E\u043B\u0430
+CloseButton=&\u0417\u0430\u0442\u0432\u043E\u0440\u0438
+CloseButtonTooltip=\u0417\u0430\u0442\u0432\u043E\u0440\u0438 \u0434\u0438\u0430\u043B\u043E\u0433\u043E\u0432\u0438\u044F \u043F\u0440\u043E\u0437\u043E\u0440\u0435\u0446 \u0431\u0435\u0437 \u0437\u0430\u043F\u0430\u0437\u0432\u0430\u043D\u0435 \u043D\u0430 \u043F\u0440\u043E\u043C\u0435\u043D\u0438\u0442\u0435.
+Column=\u041A\u043E\u043B\u043E\u043D\u0430
+Columns=\u041A\u043E\u043B\u043E\u043D\u0438
+ComposerFieldAggregationLabel=\u0424\u0443\u043D\u043A\u0446\u0438\u044F
+Condensed=6 \u043A\u043E\u043B\u043E\u043D\u0438
+Copy=\u041A\u043E\u043F\u0438\u0440\u0430\u043D\u0435
+Cut=\u041E\u0442\u0440\u0435\u0436\u0438
+Day=\u0414\u0435\u043D
+DefaultPasswordPolicyText=The password does not comply with the given policy\n\nPolicy\:\n- at least 8 characters\n- at least one number (0-9)\n- at least one non standard character (\!|@|\#|$|%|^|&|*|(|)|_|+|||~|-|
+EmailFrom=\u041E\u0442
+EmailSubject=\u041F\u0440\u0435\u0434\u043C\u0435\u0442
+EmailTo=\u0414\u043E
+Error=\u0413\u0440\u0435\u0448\u043A\u0430
+ErrorAndRetryTextDefault=\u0412\u044A\u0437\u043D\u0438\u043A\u043D\u0430 \u0433\u0440\u0435\u0448\u043A\u0430 \u043F\u043E \u0432\u0440\u0435\u043C\u0435 \u043D\u0430 \u043F\u0440\u0435\u0445\u0432\u044A\u0440\u043B\u044F\u043D\u0435 \u043D\u0430 \u0434\u0430\u043D\u043D\u0438\u0442\u0435.
+ErrorTextLogin=\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E \u043F\u043E\u0442\u0440\u0435\u0431\u0438\u0442\u0435\u043B\u0441\u043A\u043E \u0438\u043C\u0435/\u043F\u0430\u0440\u043E\u043B\u0430
+ErrorTitleLogin=\u0412\u043B\u0438\u0437\u0430\u043D\u0435\u0442\u043E \u0432 \u0441\u0438\u0441\u0442\u0435\u043C\u0430\u0442\u0430 \u0435 \u043D\u0435\u0443\u0441\u043F\u0435\u0448\u043D\u043E
+ExcelChart_Button_LoadDefaults=\u041F\u043E \u0414\u0435\u0444\u0430\u0443\u043B\u0442
+ExcelChart_Button_LoadDefaultsHint=\u041E\u0442\u043C\u0435\u043D\u0438 \u0442\u043E\u0437\u0438 \u0434\u0438\u0430\u043B\u043E\u0433 \u0447\u0440\u0435\u0437 \u0437\u0430\u0440\u0435\u0436\u0434\u0430\u043D\u0435 \u043D\u0430 \u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442\u0438\u0442\u0435 \u043F\u043E \u0434\u0438\u0444\u043E\u043B\u0442.
+ExcelChart_Button_LoadProfile=\u0417\u0430\u0440\u0435\u0436\u0434\u0430 \u043F\u0440\u043E\u0444\u0438\u043B...
+ExcelChart_Button_LoadProfileHint=\u0417\u0430\u0440\u0435\u0436\u0434\u0430 \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438 \u043E\u0442 XML \u0444\u0430\u0439\u043B.
+ExcelChart_Button_SaveProfile=\u0417\u0430\u043F\u0430\u0437\u0438 \u043F\u0440\u043E\u0444\u0438\u043B...
+ExcelChart_Button_SaveProfileHint=\u0417\u0430\u043F\u0430\u0437\u0438 \u0442\u0435\u043A\u0443\u0449\u0438\u0442\u0435 \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438 \u0432 XML \u0444\u0430\u0439\u043B.
+ExcelChart_Error_CreatingChartFailed=\u0441\u044A\u0437\u0434\u0430\u0432\u0430\u043D\u0435\u0442\u043E \u043D\u0430 \u0433\u0440\u0430\u0444\u0438\u043A\u0430 \u043D\u0435\u0443\u0441\u043F\u0435\u0448\u043D\u043E
+ExcelChart_Error_ExportingFailed=\u0415\u043A\u0441\u043F\u043E\u0440\u0442\u0430 \u043D\u0435\u0443\u0441\u043F\u0435\u0448\u0435\u043D \u043F\u043E\u0440\u0430\u0434\u0438
+ExcelChart_Error_InitializationFailed=initialization of the support class(es) failed.
+ExcelChart_Error_LoadingProfileFailed=\u0417\u0430\u0440\u0435\u0436\u0434\u0430\u043D\u0435\u0442\u043E \u043D\u0430 \u043F\u0440\u043E\u0444\u0438\u043B \u043D\u0435\u0443\u0441\u043F\u0435\u0448\u043D\u043E \u043F\u043E\u0440\u0430\u0434\u0438
+ExcelChart_Error_LoadingTemplateFailed=\u0437\u0430\u0440\u0435\u0436\u0434\u0430\u043D\u0435\u0442\u043E \u043D\u0430 \u0448\u0430\u0431\u043B\u043E\u043D \u043D\u0435\u0443\u0441\u043F\u0435\u0448\u043D\u043E \u043F\u043E\u0440\u0430\u0434\u0438
+ExcelChart_Error_RetrivingOutlineDataFailed=retriving outline data failed.
+ExcelChart_Error_SavingProfileFailed=\u0417\u0430\u043F\u0430\u0437\u0432\u0430\u043D\u0435\u0442\u043E \u043D\u0430 \u043F\u0440\u043E\u0444\u0438\u043B\u0430 \u043D\u0435\u0443\u0441\u043F\u0435\u0448\u043D\u043E \u043F\u043E\u0440\u0430\u0434\u0438
+ExcelChart_Error_WrongProfile=the profile was created for another outline.
+ExcelChart_Label_AutomaticMode=\u0410\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u0435\u043D \u0440\u0435\u0436\u0438\u043C
+ExcelChart_Label_AutomaticModeHint=\u0421\u043A\u0440\u0438\u0439 \u0415\u043A\u0441\u0435\u043B \u0438 \u0437\u0430\u043F\u0430\u0437\u0438 \u0430\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u043D\u043E
+ExcelChart_Label_ChartNumber=\u041D\u043E\u043C\u0435\u0440 \u043D\u0430 \u0433\u0440\u0430\u0444\u0438\u043A\u0430
+ExcelChart_Label_ChartType=\u0422\u0438\u043F \u0433\u0440\u0430\u0444\u0438\u043A\u0430
+ExcelChart_Label_FileName=\u0418\u043C\u0435 \u043D\u0430 \u0444\u0430\u0439\u043B
+ExcelChart_Label_FirstRow=\u041F\u0440\u044A\u0432 \u0440\u0435\u0434
+ExcelChart_Label_Height=\u0412\u0438\u0441\u043E\u0447\u0438\u043D\u0430
+ExcelChart_Label_HistogramMode=\u0420\u0435\u0436\u0438\u043C \u043D\u0430 \u0425\u0438\u0441\u0442\u043E\u0433\u0440\u0430\u043C\u0430
+ExcelChart_Label_HistogramModeHint=The histogram mode combines identical values on the X-Axis to one.
+ExcelChart_Label_LastRow=\u041F\u043E\u0441\u043B\u0435\u0434\u0435\u043D \u0440\u0435\u0434
+ExcelChart_Label_Offset=\u041F\u043E\u0437\u0438\u0446\u0438\u044F
+ExcelChart_Label_SkipNullValues=\u041F\u0440\u0435\u0441\u043A\u043E\u0447\u0438 \u043D\u0443\u043B\u0435\u0432\u0438\u0442\u0435 \u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442\u0438 \u0438 \u0440\u0435\u0436\u0438\u043C \u0425\u0438\u0441\u0442\u043E\u0433\u0440\u0430\u043C\u0430
+ExcelChart_Label_SkipNullValuesHint=If checked null values on the X-Axis are ignored, otherwise they are combined to <Unknown>.
+ExcelChart_Label_TemplateName=\u0428\u0430\u0431\u043B\u043E\u043D
+ExcelChart_Label_UseCustomFormat=\u0418\u0437\u043F\u043E\u043B\u0437\u0432\u0430\u0439 \u043F\u043E\u0434\u0445\u043E\u0434\u044F\u0449 \u0444\u043E\u0440\u043C\u0430\u0442
+ExcelChart_Label_UseCustomFormatHint=\u0410\u043A\u043E \u0435 \u043E\u0442\u0431\u0435\u043B\u044F\u0437\u0430\u043D\u043E \u0432\u0438\u0435 \u043C\u043E\u0436\u0435\u0442\u0435 \u0434\u0430 \u043E\u0442\u0431\u0435\u043B\u0435\u0436\u0438\u0442\u0435 \u043F\u043E\u0437\u0438\u0446\u0438\u044F\u0442\u0430 \u0438 \u0440\u0430\u0437\u043C\u0435\u0440\u044A\u0442 \u043D\u0430 \u0433\u0440\u0430\u0444\u0438\u043A\u0430\u0442\u0430.
+ExcelChart_Label_UseExistingChart=\u0418\u0437\u043F\u043E\u043B\u0437\u0432\u0430 \u0441\u044A\u0449\u0435\u0441\u0442\u0432\u0443\u0432\u0430\u0449\u0430 \u0433\u0440\u0430\u0444\u0438\u043A\u0430
+ExcelChart_Label_UseExistingChartHint=\u0410\u043A\u043E \u0435 \u043E\u0442\u0431\u0435\u043B\u044F\u0437\u0430\u043D\u043E \u0441\u044A\u0449\u0435\u0441\u0442\u0432\u0443\u0432\u0430\u0449\u0430\u0442\u0430 \u0433\u0440\u0430\u0444\u0438\u043A\u0430 \u0432 \u043E\u0442\u0431\u0435\u043B\u044F\u0437\u0430\u043D\u0438\u044F\u0442 \u0448\u0430\u0431\u043B\u043E\u043D \u0435 \u0438\u0437\u043F\u043E\u043B\u0437\u0432\u0430\u043D\u0430.
+ExcelChart_Label_UseSelectiveExport=\u0418\u0437\u043F\u043E\u043B\u0437\u0432\u0430\u0439 \u0441\u0435\u043B\u0435\u043A\u0442\u0438\u0440\u0430\u043D \u0435\u043A\u0441\u043F\u043E\u0440\u0442
+ExcelChart_Label_UseSelectiveExportHint=\u0410\u043A\u043E \u0435 \u043E\u0442\u0431\u0435\u043B\u044F\u0437\u0430\u043D\u043E, \u0441\u0430\u043C\u043E \u0440\u0435\u0434\u043E\u0432\u0435\u0442\u0435 \u043E\u0442\u0431\u0435\u043B\u044F\u0437\u0430\u043D\u0438 \u043F\u043E-\u0434\u043E\u043B\u0443 \u0441\u0430 \u0435\u043A\u0441\u043F\u043E\u0440\u0442\u0438\u0440\u0430\u043D\u0438.
+ExcelChart_Label_Width=\u0428\u0438\u0440\u043E\u0447\u0438\u043D\u0430
+ExcelChart_Label_WorksheetName=\u0420\u0430\u0431\u043E\u0442\u043D\u0430 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0430
+ExcelChart_Label_XAxis=X-Axis
+ExcelChart_Label_YAxes=Y-Axes
+ExcelChart_Status_Done=\u0415\u043A\u0441\u043F\u043E\u0440\u0442\u0430 \u043D\u0430 \u0415\u043A\u0441\u0435\u043B\u0441\u043A\u0430\u0442\u0430 \u0422\u0430\u0431\u043B\u0438\u0446\u0430 \u0435 \u043D\u0430\u043F\u0440\u0430\u0432\u0435\u043D
+ExcelChart_Tab_Advanced=\u041D\u0430\u043F\u0440\u0435\u0434\u043D\u0430\u043B
+ExcelChart_Tab_Basic=\u041E\u0441\u043D\u043E\u0432\u0435\u043D
+ExcelChart_Title_MainForm=\u0415\u043A\u0441\u043F\u043E\u0440\u0442 \u043D\u0430 \u0415\u043A\u0441\u0435\u043B\u0441\u043A\u0430 \u0422\u0430\u0431\u043B\u0438\u0446\u0430
+ExcelChart_Type_Area3D=Area 3D
+ExcelChart_Type_Area=\u041E\u0431\u043B\u0430\u0441\u0442
+ExcelChart_Type_AreaStacked3D=Area Stacked 3D
+ExcelChart_Type_AreaStacked=Area Stacked
+ExcelChart_Type_BarsClustered3D=Bars Clustered 3D
+ExcelChart_Type_BarsClustered=Bars Clustered
+ExcelChart_Type_BarsStacked3D=Bars Stacked 3D
+ExcelChart_Type_BarsStacked=Bars Stacked
+ExcelChart_Type_ColumnsClustered3D=Columns Clustered 3D
+ExcelChart_Type_ColumnsClustered=Columns Clustered
+ExcelChart_Type_ColumnsStacked3D=Columns Stacked 3D
+ExcelChart_Type_ColumnsStacked=Columns Stacked
+ExcelChart_Type_Line=\u041B\u0438\u043D\u0438\u044F
+ExcelChart_Type_LineStacked=Line Stacked
+ExcelChart_Type_Pie3D=Pie 3D
+ExcelChart_Type_Pie=Pie
+ExcelChart_Type_PieExploded3D=Pie Exploded 3D
+ExcelChart_Type_PieExploded=Pie exploded
+ExcelChart_Various_Averaged=\u0443\u0441\u0440\u0435\u0434\u043D\u0435\u043D
+ExcelChart_Various_Column=\u041A\u043E\u043B\u043E\u043D\u0430
+ExcelChart_Various_Frequency=\u0427\u0435\u0441\u0442\u043E\u0442\u0430
+ExcelChart_Various_SummedUp=summed up
+ExcelChart_Various_Unknown=<\u041D\u0435\u043F\u043E\u0437\u043D\u0430\u0442>
+ExportDate=\u0415\u043A\u0441\u043F\u043E\u0440\u0442 \u043D\u0430 \u0434\u0430\u043D\u043D\u0438
+ExtendedSearchAddAttributeMenu=\u0414\u043E\u0431\u0430\u0432\u0435\u0442\u0435 \u043E\u0433\u0440\u0430\u043D\u0438\u0447\u0430\u0432\u0430\u0449\u0438 \u0443\u0441\u043B\u043E\u0432\u0438\u044F...
+ExtendedSearchAddEntityPrefix=\u0438\u043C\u0430
+ExtendedSearchAnd=\u0438
+ExtendedSearchEditAttributeMenu=\u0420\u0435\u0434\u0430\u043A\u0442\u0438\u0440\u0430\u043D\u0435...
+ExtendedSearchEntitySuffix=\u0441
+ExtendedSearchNegateMenu=\u041E\u0442\u0445\u0432\u044A\u0440\u043B\u044F\u043C
+ExtendedSearchRemoveAttributeMenu=\u041F\u0440\u0435\u043C\u0430\u0445\u043D\u0438
+ExtendedSearchRemoveMenu=\u041F\u0440\u0435\u043C\u0430\u0445\u043D\u0438
+FileExistsOwerwriteQuestion=\u0418\u0437\u0431\u0440\u0430\u043D\u0438\u044F\u0442 \u0444\u0430\u0439\u043B \u0432\u0435\u0447\u0435 \u0441\u044A\u0449\u0435\u0441\u0442\u0432\u0443\u0432\u0430. \u0414\u0430 \u043F\u0440\u0435\u0437\u0430\u043F\u0438\u0448\u0430 \u043B\u0438 \u0442\u043E\u0437\u0438 \u0444\u0430\u0439\u043B?
+FileName=&\u0414\u043E\u0431\u0430\u0432\u0438 \u043A\u044A\u043C \u043E\u0442\u043C\u0435\u0442\u043A\u0438...
+FileNotFoundMessage=\u0424\u0430\u0439\u043B\u044A\u0442 \u043D\u0435 \u043C\u043E\u0436\u0435 \u0434\u0430 \u0431\u044A\u0434\u0435 \u043D\u0430\u043C\u0435\u0440\u0435\u043D.
+FileNotFoundTitle=\u0424\u0430\u0439\u043B\u044A\u0442 \u043D\u0435 \u0435 \u043D\u0430\u043C\u0435\u0440\u0435\u043D.
+FilesOfType=\u0422\u0438\u043F \u043D\u0430 \u0444\u0430\u0439\u043B\u0430
+FormPrint=\u041F\u0435\u0447\u0430\u0442
+FormSaveChangesQuestion=\u0416\u0435\u043B\u0430\u0435\u0442\u0435 \u043B\u0438 \u0434\u0430 \u0437\u0430\u043F\u0430\u0437\u0438\u0442\u0435 \u043F\u0440\u043E\u043C\u0435\u043D\u0438\u0442\u0435?
+FormStateLoad=\u0417\u0430\u0440\u0435\u0436\u0434\u0430\u043D\u0435...
+FormStateStore=\u0417\u0430\u043F\u0438\u0441\u0432\u0430\u043C
+FormStateStoreAs=\u0417\u0430\u043F\u0438\u0448\u0438 \u043A\u0430\u0442\u043E...
+GlobalBookmarks=\u041E\u0431\u0449\u0438 \u0431\u0443\u043A\u043C\u0430\u0440\u043A\u0441
+GlobalBookmarksAddMenu=Add to &global bookmarks
+Help=\u041F\u043E\u043C\u043E\u0449
+IOErrorInfo=\u041C\u043E\u043B\u044F \u043F\u0440\u043E\u0432\u0435\u0440\u0435\u0442\u0435 \u0444\u0430\u0439\u043B\u043E\u0432\u0435\u0442\u0435 \u0438 \u0432\u0440\u044A\u0437\u043A\u0430\u0442\u0430.
+IOErrorText=\u041A\u043E\u043C\u0443\u043D\u0438\u043A\u0430\u0446\u0438\u043E\u043D\u043D\u0430 \u0433\u0440\u0435\u0448\u043A\u0430.
+IOErrorTitle=\u0413\u0440\u0435\u0448\u043A\u0430 \u043F\u0440\u0438 \u0447\u0435\u0442\u0435\u043D\u0435/\u043F\u0438\u0441\u0430\u043D\u0435
+Info=\u0418\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u044F
+Interrupted=\u041F\u0440\u0435\u043A\u044A\u0441\u043D\u0430\u0442
+InterruptedErrorText=\u041F\u0440\u043E\u0446\u0435\u0441\u044A\u0442 \u0435 \u0431\u0438\u043B \u0441\u043F\u0440\u044F\u043D \u0440\u044A\u0447\u043D\u043E
+InterruptedErrorTitle=\u041F\u0440\u043E\u0446\u0435\u0441\u044A\u0442 \u0435 \u043E\u0442\u043C\u0435\u043D\u0435\u043D
+JavaVMVersion=Java VM
+Language=\u0415\u0437\u0438\u043A
+LoadFormXmlFailedText=\u0424\u0430\u0439\u043B\u0430 \u043D\u0435 \u0435 \u0441\u044A\u0432\u043C\u0435\u0441\u0442\u0438\u043C \u0441 \u0442\u043E\u0437\u0438 \u0434\u0438\u0430\u043B\u043E\u0433.
+LogicDateIsInDays=\u0435 \u0441\u043B\u0435\u0434 \u0442\u043E\u0447\u043D\u043E (\u0434\u043D\u0438)
+LogicDateIsInGEDays=\u0435 \u043D\u0430\u0439-\u0440\u0430\u043D\u043E \u0441\u043B\u0435\u0434 (\u0434\u0435\u043D\u0430)
+LogicDateIsInGEMonths=\u0435 \u043D\u0430\u0439-\u0440\u0430\u043D\u043E \u0441\u043B\u0435\u0434 (\u043C\u0435\u0441\u0435\u0446\u0430)
+LogicDateIsInLEDays=\u0435 \u043D\u0430\u0439-\u043A\u044A\u0441\u043D\u043E \u0441\u043B\u0435\u0434 (\u0434\u043D\u0438)
+LogicDateIsInLEMonths=\u0435 \u043D\u0430\u0439-\u043A\u044A\u0441\u043D\u043E \u0441\u043B\u0435\u0434 (\u043C\u0435\u0441\u0435\u0446\u0430)
+LogicDateIsInLastDays=\u0431\u0435\u0448\u0435 \u0432 \u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0442\u0435 n \u0434\u0435\u043D\u0430
+LogicDateIsInLastMonths=\u0431\u0435\u0448\u0435 \u0432 \u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0442\u0435 n \u041C\u0435\u0441\u0435\u0446\u0430
+LogicDateIsInMonths=\u0435 \u0442\u043E\u0447\u043D\u043E \u0441\u043B\u0435\u0434 (\u043C\u0435\u0441\u0435\u0446\u0438)
+LogicDateIsInNextDays=was in next n days
+LogicDateIsInNextMonths=was in next n Months
+LogicDateIsNotToday=\u043D\u0435 \u0435 \u0434\u043D\u0435\u0441
+LogicDateIsToday=\u0435 \u0434\u043D\u0435\u0441
+LogicDateTimeIsInGEHours=\u0435 \u043D\u0430\u0439-\u0440\u0430\u043D\u043E (\u0447\u0430\u0441\u0430)
+LogicDateTimeIsInGEMinutes=\u0435 \u043D\u0430\u0439-\u0440\u0430\u043D\u043E (\u043C\u0438\u043D\u0443\u0442\u0438)
+LogicDateTimeIsInLEHours=\u0435 \u043D\u0430\u0439-\u043A\u044A\u0441\u043D\u043E (\u0447\u0430\u0441\u0430)
+LogicDateTimeIsInLEMinutes=\u0435 \u043D\u0430\u0439-\u043A\u044A\u0441\u043D\u043E (\u043C\u0438\u043D\u0443\u0442\u0438)
+LogicDateTimeIsNotNow=\u043D\u0435 \u0435 \u0441\u0435\u0433\u0430
+LogicDateTimeIsNow=\u0435 \u0441\u0435\u0433\u0430
+LogicEQ=\=
+LogicEndsWith=\u0417\u0430\u0432\u044A\u0440\u0448\u0432\u0430 \u0441
+LogicGE=>\=
+LogicGT=>
+LogicIn=\u0435
+LogicLE=<\=
+LogicLT=<
+LogicLike=\u0421\u044A\u0434\u044A\u0440\u0436\u0430
+LogicNEQ=<>
+LogicNotIn=\u043D\u0435 \u0435
+LogicNotLike=\u043D\u0435 \u0441\u044A\u0434\u044A\u0440\u0436\u0430
+LogicNotNull=\u043D\u0435 \u0435 \u043F\u0440\u0430\u0437\u043D\u043E
+LogicNull=\u0435 \u043F\u0440\u0430\u0437\u043D\u043E
+LogicStartsWith=\u0417\u0430\u043F\u043E\u0447\u043D\u0438 \u0441
+LogicTimeIsInGEHours=\u0435 \u043D\u0430\u0439-\u0440\u0430\u043D\u043E \u0441\u043B\u0435\u0434 (\u0447\u0430\u0441\u0430)
+LogicTimeIsInGEMinutes=\u0435 \u043D\u0430\u0439-\u0440\u0430\u043D\u043E \u0441\u043B\u0435\u0434 (\u043C\u0438\u043D\u0443\u0442\u0438)
+LogicTimeIsInHours=\u0435 \u0441\u043B\u0435\u0434 \u0442\u043E\u0447\u043D\u043E (\u0447\u0430\u0441\u0430)
+LogicTimeIsInLEHours=\u0435 \u043D\u0430\u0439-\u043A\u044A\u0441\u043D\u043E \u0441\u043B\u0435\u0434 (\u0447\u0430\u0441\u0430)
+LogicTimeIsInLEMinutes=\u0435 \u043D\u0430\u0439-\u043A\u044A\u0441\u043D\u043E \u0441\u043B\u0435\u0434 (\u043C\u0438\u043D\u0443\u0442\u0438)
+LogicTimeIsInMinutes=\u0435 \u0441\u043B\u0435\u0434 \u0442\u043E\u0447\u043D\u043E (\u043C\u0438\u043D\u0443\u0442\u0438)
+LogicTimeIsNotNow=\u043D\u0435 \u0435 \u0441\u0435\u0433\u0430
+LogicTimeIsNow=\u0435 \u0441\u0435\u0433\u0430
+Login=\u0412\u043B\u0438\u0437\u0430\u043C
+LookIn=\u041F\u043E\u0433\u043B\u0435\u0434\u043D\u0438 \u0432
+Month=\u041C\u0435\u0441\u0435\u0446
+Name=\u0418\u043C\u0435
+NetErrorInfo=\u041C\u043E\u043B\u044F \u043F\u0440\u043E\u0432\u0435\u0440\u0435\u0442\u0435 \u0438\u043C\u0435\u0442\u043E \u043D\u0430 \u0441\u044A\u0440\u0432\u044A\u0440\u0430, URL \u0438 \u0432\u0440\u044A\u0437\u043A\u0430\u0442\u0430.
+NetErrorText=\u0421\u044A\u0440\u0432\u044A\u0440\u044A\u0442 \u043D\u0435 \u0435 \u043D\u0430\u043C\u0435\u0440\u0435\u043D
+NetErrorTitle=\u0413\u0440\u0435\u0448\u043A\u0430 \u043F\u043E \u043C\u0440\u0435\u0436\u0430\u0442\u0430
+NewPassword=\u041D\u043E\u0432\u0430 \u043F\u0430\u0440\u043E\u043B\u0430
+No=\u041D\u0435
+NoButton=&\u041D\u0435
+NumberOfRows=\u0411\u0440\u043E\u044F\u0447 \u043D\u0430 \u0440\u0435\u0434\u043E\u0432\u0435\u0442\u0435
+OSUser=\u0421\u0438\u0441\u0442\u0435\u043C\u0435\u043D \u043F\u043E\u0442\u0440\u0435\u0431\u0438\u0442\u0435\u043B
+OSVersion=\u0412\u0435\u0440\u0441\u0438\u044F \u043D\u0430 \u0441\u0438\u0441\u0442\u0435\u043C\u0430\u0442\u0430
+Ok=Ok
+OkButton=&\u041E\u043A
+OkButtonTooltip=\u0417\u0430\u043F\u0438\u0448\u0438 \u0438 \u0437\u0430\u0442\u0432\u043E\u0440\u0438 \u0434\u0438\u0430\u043B\u043E\u0433\u043E\u0432\u0438\u044F \u043F\u0440\u043E\u0437\u043E\u0440\u0435\u0446.
+OldPassword=\u0421\u0442\u0430\u0440\u0430 \u043F\u0430\u0440\u043E\u043B\u0430
+Op=\u041E\u043F\u0435\u0440\u0430\u0442\u043E\u0440
+Open=\u041E\u0442\u0432\u043E\u0440\u0438
+Password=\u041F\u0430\u0440\u043E\u043B\u0430
+PasswordsDoNotMatch=\u0414\u0432\u0435\u0442\u0435 \u043F\u0430\u0440\u043E\u043B\u0438 \u043D\u0435 \u0441\u044A\u0432\u043F\u0430\u0434\u0430\u0442.
+Paste=\u0412\u043C\u044A\u043A\u0432\u0430\u043C
+Path=\u041F\u044A\u0442\u0435\u043A\u0430
+RepeatPassword=\u041F\u043E\u0432\u0442\u043E\u0440\u0438
+ResetButton=&\u0410\u043D\u0443\u043B\u0438\u0440\u0430\u043D\u0435
+ResetButtonTooltip=\u0412\u0441\u0438\u0447\u043A\u0438 \u0434\u0438\u0430\u043B\u043E\u0433\u043E\u0432\u0438 \u043F\u043E\u043B\u0435\u0442\u0430 \u0441\u0435 \u0438\u0437\u0447\u0438\u0441\u0442\u0432\u0430\u0442.
+Save=\u0417\u0430\u043F\u0438\u0448\u0438
+SaveButton=&\u0417\u0430\u043F\u0430\u0437\u0438
+SaveButtonTooltip=\u0417\u0430\u043F\u0430\u0437\u0438 \u0434\u0438\u0430\u043B\u043E\u0433\u0430 \u0431\u0435\u0437 \u0434\u0430 \u0433\u043E \u0437\u0430\u0442\u0432\u0430\u0440\u044F\u0448.
+SearchButton=&\u0422\u044A\u0440\u0441\u0435\u043D\u0435
+SearchButtonTooltip=\u0417\u0430\u0442\u0432\u0430\u0440\u044F\u043D\u0435 \u043D\u0430 \u0434\u0438\u0430\u043B\u043E\u0433\u043E\u0432\u0438\u044F \u043F\u0440\u043E\u0437\u043E\u0440\u0435\u0446 \u0438 \u0437\u0430\u043F\u043E\u0447\u0432\u0430\u043D\u0435 \u043D\u0430 \u0442\u044A\u0440\u0441\u0435\u043D\u0435\u0442\u043E.
+SearchConstraints=\u0421\u0442\u0435\u0441\u043D\u044F\u0432\u0430\u043D\u0435 \u043D\u0430 \u0442\u044A\u0440\u0441\u0435\u043D\u0435\u0442\u043E
+Server=\u0421\u044A\u0440\u0432\u044A\u0440
+SmartFindLabel=\u0422\u044A\u0440\u0441\u0435\u043D\u0435 \u043D\u0430 \u0442\u0435\u043A\u0441\u0442
+StatusExportDone=\u0418\u0437\u043D\u0430\u0441\u044F\u043D\u0435\u0442\u043E \u0437\u0430\u0432\u044A\u0440\u0448\u0435\u043D\u043E
+Today=\u0434\u043D\u0435\u0441
+TooManyRows=\u0422\u0432\u044A\u0440\u0434\u0435 \u043C\u043D\u043E\u0433\u043E \u0438\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u044F. \u041C\u043E\u043B\u044F \u043A\u043E\u043D\u043A\u0440\u0435\u0442\u0438\u0437\u0438\u0440\u0430\u0439\u0442\u0435 \u043F\u043E\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043E\u043C Serach Panel.
+Update=\u041E\u0431\u043D\u043E\u0432\u044F\u0432\u0430\u043D\u0435
+UserInterrupted=\u041F\u0440\u0435\u043A\u044A\u0441\u043D\u0430\u0442\u043E \u043E\u0442 \u043F\u043E\u0442\u0440\u0435\u0431\u0438\u0442\u0435\u043B\u044F
+Username=\u0418\u043C\u0435 \u043D\u0430 \u043F\u043E\u0442\u0440\u0435\u0431\u0438\u0442\u0435\u043B\u044F
+Value=\u0421\u0442\u043E\u0439\u043D\u043E\u0441\u0442
+Week=\u0421\u0435\u0434\u043C\u0438\u0446\u0430
+WeekShort=CW
+WizardCancelButton=\u041E\u0442\u043C\u0435\u043D\u044F\u043C
+WizardSuspendButton=&\u0417\u0430\u0442\u0432\u043E\u0440\u0438
+WorkWeek=\u0420\u0430\u0431\u043E\u0442\u043D\u0430 \u0441\u0435\u0434\u043C\u0438\u0446\u0430
+Yes=\u0414\u0430
+YesButton=&\u0414\u0430
+and=\u0438
+from=\u043E\u0442
+to=\u0434\u043E
diff --git a/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_cs.properties b/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_cs.properties
index a2cff20d05..77df1f37e0 100644
--- a/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_cs.properties
+++ b/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_cs.properties
@@ -1,161 +1,161 @@
-ActivateBookmarkMenu=Otev\u0159\u00EDt obl\u00EDbenou polo\u017Eku
-AllStates=V\u0161echny
-ApplyBookmarkToSearchFailedMessage=Pomoc\u00ED t\u00E9to polo\u017Eky nelze vyhled\u00E1vat.
-Bookmark=Obl\u00EDben\u00E9
-BookmarkFolder=Slo\u017Eka
-Bookmarks=Obl\u00EDben\u00E9
-BookmarksAddMenu=&P\u0159idat k obl\u00EDben\u00FDm
-BookmarksApplyToCurrentSearch=Vyhled\u00E1vat pomoc\u00ED t\u00E9to obl\u00EDben\u00E9 polo\u017Eky
-BookmarksMainMenu=&Obl\u00EDben\u00E9
-BookmarksManageMenu=&Spravovat obl\u00EDben\u00E9...
-BookmarksPublishMenu=Uve\u0159ejnit obl\u00EDbenou polo\u017Eku...
-BookmarksStartPageMenu=&V\u00FDchoz\u00ED zobrazen\u00ED
-BookmarksStartPageMenuClear=&P\u016Fvodn\u00ED v\u00FDchoz\u00ED zobrazen\u00ED
-BookmarksStartPageMenuGoto=&Otev\u0159\u00EDt v\u00FDchoz\u00ED zobrazen\u00ED
-BookmarksStartPageMenuSet=&Nastavit sou\u010Dasn\u00E9 zobrazen\u00ED jako v\u00FDchoz\u00ED
-ButtonSelectAll=Vybrat v\u0161e
-Cancel=Zru\u0161it
-CancelButton=&Zru\u0161it
-CancelButtonTooltip=Uzav\u0159\u00EDt dialog bez ulo\u017Een\u00ED; pokud to bude nutn\u00E9, zobraz\u00ED se \u017E\u00E1dost o potvrzen\u00ED.
-ChangePassword=Zm\u011Bna hesla
-CloseButton=&Zav\u0159\u00EDt
-CloseButtonTooltip=Zav\u0159\u00EDt dialog bez ulo\u017Een\u00ED.
-Column=Sloupec
-ComposerFieldAggregationLabel=Funkce
-Day=Den
-DefaultPasswordPolicyText=Heslo nespl\u0148uje stanoven\u00E1 pravidla\n\nPravidla\:\n- minim\u00E1ln\u011B 8 znak\u016F\n- minim\u00E1ln\u011B jedno \u010D\u00EDslo (0-9)\n- minim\u00E1ln\u011B jeden nestandardn\u00ED znak (\!|@|\#|$|%|^|&|*|(|)|_|+|||~|-|)
-DeleteBookmarkMenu=Odstranit obl\u00EDbenou polo\u017Eku
-DeleteConfirmationText=Chcete odstranit n\u00E1sleduj\u00EDc\u00ED data?
-DeleteFolderMenu=Odstranit slo\u017Eku
-EditBookmarkMenu=Upravit obl\u00EDbenou polo\u017Eku...
-EmailFrom=Od
-EmailSubject=V\u011Bc
-EmailTo=Do
-Error=Chyba
-ErrorTextLogin=\u0160patn\u00E9 p\u0159ihla\u0161ovac\u00ED jm\u00E9no/heslo.
-ExcelChart_Button_SaveProfile=Ulo\u017Eit profil...
-ExcelChart_Button_SaveProfileHint=Ulo\u017E\u00ED sou\u010Dasn\u00E9 nastaven\u00ED do XML souboru.
-ExcelChart_Label_FirstRow=Prvn\u00ED \u0159ada
-ExcelChart_Various_Column=Sloupec
-ExtendedSearchAddAttributeMenu=P\u0159idat podm\u00EDnku...
-ExtendedSearchAddEntityPrefix=m\u00E1
-ExtendedSearchAnd=a
-ExtendedSearchOr=nebo
-FileNotFoundMessage=Nelze naj\u00EDt soubor\:
-FileNotFoundTitle=Soubor nenalezen
-FilterBookmarkTree=Proch\u00E1zet obl\u00EDben\u00E9 polo\u017Eky
-Folders=Slo\u017Eky
-FormCloseTimerActivated=Odpo\u010Det vypnut\u00ED zah\u00E1jen
-FormClosing=Zav\u0159\u00EDt
-FormPrint=Tisk
-FormReset=Vymazat
-FormSaveChangesQuestion=Chcete ulo\u017Eit zm\u011Bny?
-FormStateLoad=Na\u010D\u00EDst...
-FormStateStore=Ulo\u017Eit
-FormStateStoreAs=Ulo\u017Eit jako...
-GlobalBookmarks=Glob\u00E1ln\u00ED obl\u00EDben\u00E9 polo\u017Eky
-GlobalBookmarksAddMenu=P\u0159idat ke &glob\u00E1ln\u00EDm obl\u00EDben\u00FDm polo\u017Ek\u00E1m
-InDaysX=za {0} dn\u00ED
-InterruptedErrorText=Proces byl ru\u010Dn\u011B ukon\u010Den.
-InterruptedErrorTitle=Proces zru\u0161en
-InvalidNumberMessageX="{0}" je neplatn\u00E9 \u010D\u00EDslo
-InvalidPhoneNumberMessageX="{0}" je neplatn\u00E9 telefonn\u00ED \u010D\u00EDslo
-InvalidValueMessageX="{0}" je neplatn\u00E1 hodnota
-Language=Jazyk
-LogicBetween=je mezi {0} a {1}
-LogicDateIsInDays=p\u0159esn\u011B za n dn\u00ED
-LogicDateIsInGEDays=Datum >\= dnes + n dn\u00ED
-LogicDateIsInGEMonths=Datum >\= dnes + n m\u011Bs\u00EDc\u016F
-LogicDateIsInLEDays=Datum <\= dnes + n dn\u00ED
-LogicDateIsInLEMonths=Datum <\= dnes + n m\u011Bs\u00EDc\u016F
-LogicDateIsInMonths=p\u0159esn\u011B za n m\u011Bs\u00EDc\u016F
-LogicDateIsInNextDays=bude b\u011Bhem p\u0159\u00ED\u0161t\u00EDch n dn\u016F
-LogicDateIsInNextMonths=bude b\u011Bhem p\u0159\u00ED\u0161t\u00EDch n m\u011Bs\u00EDc\u016F
-LogicDateTimeIsInGEHours=Datum >\= nyn\u00ED + n hodin
-LogicDateTimeIsInGEMinutes=Datum >\= nyn\u00ED + n minut
-LogicDateTimeIsInLEHours=Datum <\= nyn\u00ED + n hodin
-LogicDateTimeIsInLEMinutes=Datum <\= nyn\u00ED + n minut
-LogicDateTimeIsNotNow=ne dne\u0161n\u00ED datum
-LogicDateTimeIsNow=dne\u0161n\u00ED datum
-LogicEndsWith=kon\u010D\u00ED na
-LogicIn=je
-LogicLike=obsahuje
-LogicNotEndsWith=nekon\u010D\u00ED na
-LogicNotIn=nen\u00ED
-LogicNotLike=neobsahuje
-LogicNotNull=nen\u00ED pr\u00E1zdn\u00E9
-LogicNotStartsWith=neza\u010D\u00EDn\u00E1 na
-LogicStartsWith=za\u010D\u00EDn\u00E1 na
-LogicTimeIsInHours=bude p\u0159esn\u011B za (hodin)
-LogicTimeIsInMinutes=je p\u0159esn\u011B za (minut)
-LogicTimeIsNotNow=ne aktu\u00E1ln\u00ED \u010Das
-LogicTimeIsNow=aktu\u00E1ln\u00ED \u010Das
-Name=Jm\u00E9no
-NetErrorText=Server nenalezen
-NewBookmarkFolderMenu=Nov\u00E1 slo\u017Eka...
-NewPassword=Nov\u00E9 heslo
-No=Ne
-NoButton=&Ne
-OkButton=&OK
-OkButtonTooltip=Ulo\u017Eit a zav\u0159\u00EDt dialog
-OldPassword=P\u016Fvodn\u00ED heslo
-Open=Otev\u0159\u00EDt
-Password=Heslo
-PasswordHasExpiredHeader=Va\u0161e heslo vypr\u0161elo a m\u011Blo by b\u00FDt hned zm\u011Bn\u011Bno.
-PasswordHasExpiredTitle=Platnost hesla vypr\u0161ela
-PasswordWillExpireHeaderX=Va\u0161e heslo vypr\u0161\u00ED {0}.
-PasswordWillExpireInfo=Chcete jej nyn\u00ED zm\u011Bnit?
-PasswordWillExpireTitle=Heslo vypr\u0161\u00ED
-PasswordsDoNotMatch=Hesla nesouhlas\u00ED.
-RenameBookmarkFolderMenu=P\u0159ejmenovat slo\u017Eku...
-RepeatPassword=Zopakovat
-ResetButton=&Vymazat
-SC_Help_AddToDictionary=P\u0159idat nespr\u00E1vn\u011B napsan\u00E9 slovo do slovn\u00EDku
-SC_Help_Cancel=Uzav\u0159e dialog bez ulo\u017Een\u00ED zm\u011Bn (Kl\u00E1vesa ESC)
-SC_Help_Change=Zm\u011Bn\u00ED aktu\u00E1ln\u00ED v\u00FDskyt \u0161patn\u011B zadan\u00E9ho slova
-SC_Help_ChangeAll=Zm\u011Bn\u00ED v\u0161echny v\u00FDskyty \u0161patn\u011B zadan\u00E9ho slova (v aktu\u00E1ln\u00EDm prvku s textem)
-SC_Help_Options=Otev\u0159e dialog s nastaven\u00EDm
-SC_Help_Undo=Vr\u00E1tit zp\u011Bt posledn\u00ED zm\u011Bnu
-SC_Label_Cancel=Zru\u0161it
-SC_Label_Change=Zm\u011Bnit
-SC_Label_ChangeAll=Zm\u011Bnit v\u0161e
-SC_Label_ChangeTo=Zm\u011Bnit na
-SC_Label_Ignore=P\u0159esko\u010Dit
-SC_Label_IgnoreAll=P\u0159esko\u010Dit v\u0161e
-SC_Label_NotInDictionary=Zv\u00FDrazn\u011Bn\u00E9 slovo nebylo rozpozn\u00E1no
-SC_Label_Options=Mo\u017Enosti...
-SC_Message_Complete=Kontrola pravopisu dokon\u010Dena
-Save=Ulo\u017Eit
-SaveButton=&Ulo\u017Eit
-SaveButtonTooltip=Ulo\u017Eit dialog bez uzav\u0159en\u00ED
-SavePassword=Ulo\u017Eit jm\u00E9no/heslo
-ScoutStarting=Scout nab\u00EDh\u00E1
-SearchButton=&Naj\u00EDt
-SearchButtonTooltip=Zav\u0159\u00EDt dialog a spustit vyhled\u00E1v\u00E1n\u00ED.
-SearchConstraints=Hledat v\u00FDraz
-SearchTextIsTooGeneral=Pros\u00EDm up\u0159esn\u011Bte hledan\u00FD text
-SmartFindLabel=Vyhledat text
-TooManyRows=P\u0159\u00EDli\u0161 mnoho dat. Pros\u00EDm up\u0159esn\u011Bte vyhled\u00E1v\u00E1n\u00ED.
-Update=Aktualizace
-UserCancelledOperation=Operace byla ru\u010Dn\u011B ukon\u010Dena
-UserInterrupted=Zru\u0161eno u\u017Eivatelem
-VersionMismatchAction=Chcete aplikaci s automatick\u00FDm updatem restartovat?
-VersionMismatchTextXY=Pro pokra\u010Dov\u00E1n\u00ED pr\u00E1ce je vy\u017Eadov\u00E1na aktualizace aplikace.\n\nSou\u010Dasn\u00E1 verze je {0}, nov\u00E1 verze je {1}.
-VersionMismatchTitle=Je vy\u017Eadov\u00E1na aktualizace
-VetoErrorText=Mus\u00ED b\u00FDt vypln\u011Bno alespo\u0148 jedno vyhled\u00E1vac\u00ED pole.
-WizardBackButton=&Zp\u011Bt
-WizardBackButtonTooltip=Zp\u011Bt k p\u0159edchoz\u00EDmu kroku
-WizardCancelButton=Zru\u0161it
-WizardCancelButtonTooltip=Zru\u0161\u00ED pr\u016Fvodce a zahod\u00ED v\u0161echna data.
-WizardNextButton=&Dal\u0161\u00ED
-WizardNextButtonTooltip=Pokra\u010Dovat k dal\u0161\u00EDmu kroku
-WizardSuspendButton=&Zav\u0159\u00EDt
-XMustBeGreaterThanOrEqualY='{0}' mus\u00ED b\u00FDt v\u011Bt\u0161\u00ED nebo rovno '{1}'
-XMustBeLessThanOrEqualY='{0}' mus\u00ED b\u00FDt men\u0161\u00ED nebo rovno '{1}'
-XRows={0} polo\u017Eek
-Yes=Ano
-YesButton=&Ano
-and=a
-from=od
-searchingProposals=n\u00E1vrhy hled\u00E1n\u00ED...
-to=do
+ActivateBookmarkMenu=Otev\u0159\u00EDt obl\u00EDbenou polo\u017Eku
+AllStates=V\u0161echny
+ApplyBookmarkToSearchFailedMessage=Pomoc\u00ED t\u00E9to polo\u017Eky nelze vyhled\u00E1vat.
+Bookmark=Obl\u00EDben\u00E9
+BookmarkFolder=Slo\u017Eka
+Bookmarks=Obl\u00EDben\u00E9
+BookmarksAddMenu=&P\u0159idat k obl\u00EDben\u00FDm
+BookmarksApplyToCurrentSearch=Vyhled\u00E1vat pomoc\u00ED t\u00E9to obl\u00EDben\u00E9 polo\u017Eky
+BookmarksMainMenu=&Obl\u00EDben\u00E9
+BookmarksManageMenu=&Spravovat obl\u00EDben\u00E9...
+BookmarksPublishMenu=Uve\u0159ejnit obl\u00EDbenou polo\u017Eku...
+BookmarksStartPageMenu=&V\u00FDchoz\u00ED zobrazen\u00ED
+BookmarksStartPageMenuClear=&P\u016Fvodn\u00ED v\u00FDchoz\u00ED zobrazen\u00ED
+BookmarksStartPageMenuGoto=&Otev\u0159\u00EDt v\u00FDchoz\u00ED zobrazen\u00ED
+BookmarksStartPageMenuSet=&Nastavit sou\u010Dasn\u00E9 zobrazen\u00ED jako v\u00FDchoz\u00ED
+ButtonSelectAll=Vybrat v\u0161e
+Cancel=Zru\u0161it
+CancelButton=&Zru\u0161it
+CancelButtonTooltip=Uzav\u0159\u00EDt dialog bez ulo\u017Een\u00ED; pokud to bude nutn\u00E9, zobraz\u00ED se \u017E\u00E1dost o potvrzen\u00ED.
+ChangePassword=Zm\u011Bna hesla
+CloseButton=&Zav\u0159\u00EDt
+CloseButtonTooltip=Zav\u0159\u00EDt dialog bez ulo\u017Een\u00ED.
+Column=Sloupec
+ComposerFieldAggregationLabel=Funkce
+Day=Den
+DefaultPasswordPolicyText=Heslo nespl\u0148uje stanoven\u00E1 pravidla\n\nPravidla\:\n- minim\u00E1ln\u011B 8 znak\u016F\n- minim\u00E1ln\u011B jedno \u010D\u00EDslo (0-9)\n- minim\u00E1ln\u011B jeden nestandardn\u00ED znak (\!|@|\#|$|%|^|&|*|(|)|_|+|||~|-|)
+DeleteBookmarkMenu=Odstranit obl\u00EDbenou polo\u017Eku
+DeleteConfirmationText=Chcete odstranit n\u00E1sleduj\u00EDc\u00ED data?
+DeleteFolderMenu=Odstranit slo\u017Eku
+EditBookmarkMenu=Upravit obl\u00EDbenou polo\u017Eku...
+EmailFrom=Od
+EmailSubject=V\u011Bc
+EmailTo=Do
+Error=Chyba
+ErrorTextLogin=\u0160patn\u00E9 p\u0159ihla\u0161ovac\u00ED jm\u00E9no/heslo.
+ExcelChart_Button_SaveProfile=Ulo\u017Eit profil...
+ExcelChart_Button_SaveProfileHint=Ulo\u017E\u00ED sou\u010Dasn\u00E9 nastaven\u00ED do XML souboru.
+ExcelChart_Label_FirstRow=Prvn\u00ED \u0159ada
+ExcelChart_Various_Column=Sloupec
+ExtendedSearchAddAttributeMenu=P\u0159idat podm\u00EDnku...
+ExtendedSearchAddEntityPrefix=m\u00E1
+ExtendedSearchAnd=a
+ExtendedSearchOr=nebo
+FileNotFoundMessage=Nelze naj\u00EDt soubor\:
+FileNotFoundTitle=Soubor nenalezen
+FilterBookmarkTree=Proch\u00E1zet obl\u00EDben\u00E9 polo\u017Eky
+Folders=Slo\u017Eky
+FormCloseTimerActivated=Odpo\u010Det vypnut\u00ED zah\u00E1jen
+FormClosing=Zav\u0159\u00EDt
+FormPrint=Tisk
+FormReset=Vymazat
+FormSaveChangesQuestion=Chcete ulo\u017Eit zm\u011Bny?
+FormStateLoad=Na\u010D\u00EDst...
+FormStateStore=Ulo\u017Eit
+FormStateStoreAs=Ulo\u017Eit jako...
+GlobalBookmarks=Glob\u00E1ln\u00ED obl\u00EDben\u00E9 polo\u017Eky
+GlobalBookmarksAddMenu=P\u0159idat ke &glob\u00E1ln\u00EDm obl\u00EDben\u00FDm polo\u017Ek\u00E1m
+InDaysX=za {0} dn\u00ED
+InterruptedErrorText=Proces byl ru\u010Dn\u011B ukon\u010Den.
+InterruptedErrorTitle=Proces zru\u0161en
+InvalidNumberMessageX="{0}" je neplatn\u00E9 \u010D\u00EDslo
+InvalidPhoneNumberMessageX="{0}" je neplatn\u00E9 telefonn\u00ED \u010D\u00EDslo
+InvalidValueMessageX="{0}" je neplatn\u00E1 hodnota
+Language=Jazyk
+LogicBetween=je mezi {0} a {1}
+LogicDateIsInDays=p\u0159esn\u011B za n dn\u00ED
+LogicDateIsInGEDays=Datum >\= dnes + n dn\u00ED
+LogicDateIsInGEMonths=Datum >\= dnes + n m\u011Bs\u00EDc\u016F
+LogicDateIsInLEDays=Datum <\= dnes + n dn\u00ED
+LogicDateIsInLEMonths=Datum <\= dnes + n m\u011Bs\u00EDc\u016F
+LogicDateIsInMonths=p\u0159esn\u011B za n m\u011Bs\u00EDc\u016F
+LogicDateIsInNextDays=bude b\u011Bhem p\u0159\u00ED\u0161t\u00EDch n dn\u016F
+LogicDateIsInNextMonths=bude b\u011Bhem p\u0159\u00ED\u0161t\u00EDch n m\u011Bs\u00EDc\u016F
+LogicDateTimeIsInGEHours=Datum >\= nyn\u00ED + n hodin
+LogicDateTimeIsInGEMinutes=Datum >\= nyn\u00ED + n minut
+LogicDateTimeIsInLEHours=Datum <\= nyn\u00ED + n hodin
+LogicDateTimeIsInLEMinutes=Datum <\= nyn\u00ED + n minut
+LogicDateTimeIsNotNow=ne dne\u0161n\u00ED datum
+LogicDateTimeIsNow=dne\u0161n\u00ED datum
+LogicEndsWith=kon\u010D\u00ED na
+LogicIn=je
+LogicLike=obsahuje
+LogicNotEndsWith=nekon\u010D\u00ED na
+LogicNotIn=nen\u00ED
+LogicNotLike=neobsahuje
+LogicNotNull=nen\u00ED pr\u00E1zdn\u00E9
+LogicNotStartsWith=neza\u010D\u00EDn\u00E1 na
+LogicStartsWith=za\u010D\u00EDn\u00E1 na
+LogicTimeIsInHours=bude p\u0159esn\u011B za (hodin)
+LogicTimeIsInMinutes=je p\u0159esn\u011B za (minut)
+LogicTimeIsNotNow=ne aktu\u00E1ln\u00ED \u010Das
+LogicTimeIsNow=aktu\u00E1ln\u00ED \u010Das
+Name=Jm\u00E9no
+NetErrorText=Server nenalezen
+NewBookmarkFolderMenu=Nov\u00E1 slo\u017Eka...
+NewPassword=Nov\u00E9 heslo
+No=Ne
+NoButton=&Ne
+OkButton=&OK
+OkButtonTooltip=Ulo\u017Eit a zav\u0159\u00EDt dialog
+OldPassword=P\u016Fvodn\u00ED heslo
+Open=Otev\u0159\u00EDt
+Password=Heslo
+PasswordHasExpiredHeader=Va\u0161e heslo vypr\u0161elo a m\u011Blo by b\u00FDt hned zm\u011Bn\u011Bno.
+PasswordHasExpiredTitle=Platnost hesla vypr\u0161ela
+PasswordWillExpireHeaderX=Va\u0161e heslo vypr\u0161\u00ED {0}.
+PasswordWillExpireInfo=Chcete jej nyn\u00ED zm\u011Bnit?
+PasswordWillExpireTitle=Heslo vypr\u0161\u00ED
+PasswordsDoNotMatch=Hesla nesouhlas\u00ED.
+RenameBookmarkFolderMenu=P\u0159ejmenovat slo\u017Eku...
+RepeatPassword=Zopakovat
+ResetButton=&Vymazat
+SC_Help_AddToDictionary=P\u0159idat nespr\u00E1vn\u011B napsan\u00E9 slovo do slovn\u00EDku
+SC_Help_Cancel=Uzav\u0159e dialog bez ulo\u017Een\u00ED zm\u011Bn (Kl\u00E1vesa ESC)
+SC_Help_Change=Zm\u011Bn\u00ED aktu\u00E1ln\u00ED v\u00FDskyt \u0161patn\u011B zadan\u00E9ho slova
+SC_Help_ChangeAll=Zm\u011Bn\u00ED v\u0161echny v\u00FDskyty \u0161patn\u011B zadan\u00E9ho slova (v aktu\u00E1ln\u00EDm prvku s textem)
+SC_Help_Options=Otev\u0159e dialog s nastaven\u00EDm
+SC_Help_Undo=Vr\u00E1tit zp\u011Bt posledn\u00ED zm\u011Bnu
+SC_Label_Cancel=Zru\u0161it
+SC_Label_Change=Zm\u011Bnit
+SC_Label_ChangeAll=Zm\u011Bnit v\u0161e
+SC_Label_ChangeTo=Zm\u011Bnit na
+SC_Label_Ignore=P\u0159esko\u010Dit
+SC_Label_IgnoreAll=P\u0159esko\u010Dit v\u0161e
+SC_Label_NotInDictionary=Zv\u00FDrazn\u011Bn\u00E9 slovo nebylo rozpozn\u00E1no
+SC_Label_Options=Mo\u017Enosti...
+SC_Message_Complete=Kontrola pravopisu dokon\u010Dena
+Save=Ulo\u017Eit
+SaveButton=&Ulo\u017Eit
+SaveButtonTooltip=Ulo\u017Eit dialog bez uzav\u0159en\u00ED
+SavePassword=Ulo\u017Eit jm\u00E9no/heslo
+ScoutStarting=Scout nab\u00EDh\u00E1
+SearchButton=&Naj\u00EDt
+SearchButtonTooltip=Zav\u0159\u00EDt dialog a spustit vyhled\u00E1v\u00E1n\u00ED.
+SearchConstraints=Hledat v\u00FDraz
+SearchTextIsTooGeneral=Pros\u00EDm up\u0159esn\u011Bte hledan\u00FD text
+SmartFindLabel=Vyhledat text
+TooManyRows=P\u0159\u00EDli\u0161 mnoho dat. Pros\u00EDm up\u0159esn\u011Bte vyhled\u00E1v\u00E1n\u00ED.
+Update=Aktualizace
+UserCancelledOperation=Operace byla ru\u010Dn\u011B ukon\u010Dena
+UserInterrupted=Zru\u0161eno u\u017Eivatelem
+VersionMismatchAction=Chcete aplikaci s automatick\u00FDm updatem restartovat?
+VersionMismatchTextXY=Pro pokra\u010Dov\u00E1n\u00ED pr\u00E1ce je vy\u017Eadov\u00E1na aktualizace aplikace.\n\nSou\u010Dasn\u00E1 verze je {0}, nov\u00E1 verze je {1}.
+VersionMismatchTitle=Je vy\u017Eadov\u00E1na aktualizace
+VetoErrorText=Mus\u00ED b\u00FDt vypln\u011Bno alespo\u0148 jedno vyhled\u00E1vac\u00ED pole.
+WizardBackButton=&Zp\u011Bt
+WizardBackButtonTooltip=Zp\u011Bt k p\u0159edchoz\u00EDmu kroku
+WizardCancelButton=Zru\u0161it
+WizardCancelButtonTooltip=Zru\u0161\u00ED pr\u016Fvodce a zahod\u00ED v\u0161echna data.
+WizardNextButton=&Dal\u0161\u00ED
+WizardNextButtonTooltip=Pokra\u010Dovat k dal\u0161\u00EDmu kroku
+WizardSuspendButton=&Zav\u0159\u00EDt
+XMustBeGreaterThanOrEqualY='{0}' mus\u00ED b\u00FDt v\u011Bt\u0161\u00ED nebo rovno '{1}'
+XMustBeLessThanOrEqualY='{0}' mus\u00ED b\u00FDt men\u0161\u00ED nebo rovno '{1}'
+XRows={0} polo\u017Eek
+Yes=Ano
+YesButton=&Ano
+and=a
+from=od
+searchingProposals=n\u00E1vrhy hled\u00E1n\u00ED...
+to=do
diff --git a/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_da.properties b/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_da.properties
index 5000cac40e..ea9586e501 100644
--- a/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_da.properties
+++ b/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_da.properties
@@ -1,97 +1,97 @@
-ActivateBookmarkMenu=\u00C5bn bookmark
-AllStates=Alle
-Attribute=Egenskab
-Bookmark=Favorit
-BookmarksApplyToCurrentSearch=S\u00F8g v.h.a. bookmark
-ButtonMoveDown=Ned
-ButtonMoveUp=Op
-Cancel=Annuller
-CancelButton=&Annuller
-ChangePassword=Skift password
-Column=Kolonne
-ComposerFieldAggregationCount=Opt\u00E6lling({0})
-ComposerFieldAggregationLabel=Funktion
-Copy=Kopi
-Day=Dag
-DefaultPasswordPolicyText=Kodeordet overholder ikke en given politik. Politik\: Mindst 8 tegn. Heraf mindst et tal (0-9). Mindst et ikke-standard bogstav (\!@\#...etc.)
-DeleteBookmarkMenu=Slet bookmark
-DeleteConfirmationText=Vil du slette f\u00F8lgende data?
-DeleteConfirmationTextNoItemList=Vil du slette disse data?
-DeleteConfirmationTextNoItemListX=Vil du slette disse {0}?
-DeleteConfirmationTextX=Vil du slette f\u00F8lgende {0}?
-DeleteConfirmationTitle=Bekr\u00E6ft at du vil slette
-DeleteFolderMenu=Slet mappe
-DetailedVersion=Detaljeret udgave
-EditBookmarkMenu=Rediger bookmark...
-EmailFrom=Fra
-EmailSubject=Emne
-EmailTo=Til
-Error=Fejl
-ErrorAndRetryTextDefault=Fejl i forbindelse med data overf\u00F8rsel.
-ExcelChart_Label_TemplateName=Skabelon
-ExtendedSearchAddAdditionalOrMenu=Tilf\u00F8j yderligere eller inds\u00E6t
-ExtendedSearchAddAttribute=Begr\u00E6nsning
-ExtendedSearchAddEitherOrMenu=Tilf\u00F8j enten...eller
-ExtendedSearchEither=enten
-ExtendedSearchNot=ikke
-ExtendedSearchOr=eller
-FileName=Filnavn
-FileNotFoundMessage=Kunne ikke finde filen\:
-FilterBookmarkTree=Gennemse bookmarks
-FormButtonClicked=Mens du klikker p\u00E5 en knap
-FormEmptyMandatoryFieldsMessage=F\u00F8lgende felter er obligatoriske
-FormExportXml=Eksporter til XML
-FormFinally=Afslutte
-FormFireToBack=N\u00E5r du returnerer formularen
-FormFireToFront=N\u00E5r du sender formularen til forsiden
-FormIncompleteIntro=Ikke alle obligatoriske felter er udfyldt.
-FormInvalidFieldsMessage=F\u00F8lgende felter er ugyldige
-FormPrint=Udskriv
-FormReset=Nulstil
-FormSaveChangesQuestion=Vil du gemme \u00E6ndringerne?
-FormStateStoreAs=Gem som...
-Hour=Timer
-InDaysX=om {0} dage
-InvalidNumberMessageX="{0}" er et ugyldigt tal
-InvalidPhoneNumberMessageX="{0}" er et ugyldigt telefonnummer
-InvalidValueMessageX="{0}" er en ugyldig v\u00E6rdi
-Language=Sprog
-LogicBetween=er mellem {0} og {1}
-LogicBetweenShort=mellem
-LogicNotEndsWith=slutter ikke med
-Month=M\u00E5ned
-Name=Navn
-NewBookmarkFolderMenu=Ny mappe...
-NewPassword=Nyt password
-No=Nej
-NumberTooSmallMessageXY=V\u00E6rdien er for lille; skal v\u00E6re mellem {0} og {1}.
-OneSelected=1 valgt
-OriginalErrorMessageIs=Oprindelig besked\: {0}
-PasswordHasExpiredHeader=Dit password er udl\u00F8bet, og skal \u00E6ndres.
-PasswordHasExpiredTitle=Password er udl\u00F8bet
-PasswordWillExpireInfo=Vil du \u00E6ndre det nu?
-PasswordWillExpireTitle=Password udl\u00F8ber
-Path=Sti
-ResetButtonTooltip=Nulstil alle felter
-SavePassword=Gem brugernavn/password
-SearchTextIsTooGeneral=Indskr\u00E6nk s\u00F8getekst
-SmartFieldCannotComplete=Ingen forslag til "{0}"
-Tomorrow=imorgen
-Username=Brugernavn
-Value=V\u00E6rdi
-VersionMismatchAction=Vil du genstarte programmet med automatisk opdatering?
-VersionMismatchTextXY=En opdatering af systemet er n\u00F8dvending for at fors\u00E6tte. Nuv\u00E6rende version er {0}, den nye version er {1}.
-VersionMismatchTitle=Opdatering p\u00E5kr\u00E6vet
-VetoErrorText=Mindst et s\u00F8gefelt skal udfyldes.
-Week=Uge
-WizardBackButtonTooltip=Tilbage til forrige trin
-WizardCancelButton=Annuller
-WizardNextButtonTooltip=Forts\u00E6t til n\u00E6ste trin
-WizardSuspendButton=&Luk
-XMustBeGreaterThanOrEqualY='{0}' skal v\u00E6re st\u00F8rre eller lig med '{1}'
-XMustBeLessThanOrEqualY='{0}' skal v\u00E6re mindre end eller lig '{1}'
-XSelected={0} valgt
-Yes=Ja
-from=fra
-searchingProposals=Forslag til s\u00F8gning...
-to=til
+ActivateBookmarkMenu=\u00C5bn bookmark
+AllStates=Alle
+Attribute=Egenskab
+Bookmark=Favorit
+BookmarksApplyToCurrentSearch=S\u00F8g v.h.a. bookmark
+ButtonMoveDown=Ned
+ButtonMoveUp=Op
+Cancel=Annuller
+CancelButton=&Annuller
+ChangePassword=Skift password
+Column=Kolonne
+ComposerFieldAggregationCount=Opt\u00E6lling({0})
+ComposerFieldAggregationLabel=Funktion
+Copy=Kopi
+Day=Dag
+DefaultPasswordPolicyText=Kodeordet overholder ikke en given politik. Politik\: Mindst 8 tegn. Heraf mindst et tal (0-9). Mindst et ikke-standard bogstav (\!@\#...etc.)
+DeleteBookmarkMenu=Slet bookmark
+DeleteConfirmationText=Vil du slette f\u00F8lgende data?
+DeleteConfirmationTextNoItemList=Vil du slette disse data?
+DeleteConfirmationTextNoItemListX=Vil du slette disse {0}?
+DeleteConfirmationTextX=Vil du slette f\u00F8lgende {0}?
+DeleteConfirmationTitle=Bekr\u00E6ft at du vil slette
+DeleteFolderMenu=Slet mappe
+DetailedVersion=Detaljeret udgave
+EditBookmarkMenu=Rediger bookmark...
+EmailFrom=Fra
+EmailSubject=Emne
+EmailTo=Til
+Error=Fejl
+ErrorAndRetryTextDefault=Fejl i forbindelse med data overf\u00F8rsel.
+ExcelChart_Label_TemplateName=Skabelon
+ExtendedSearchAddAdditionalOrMenu=Tilf\u00F8j yderligere eller inds\u00E6t
+ExtendedSearchAddAttribute=Begr\u00E6nsning
+ExtendedSearchAddEitherOrMenu=Tilf\u00F8j enten...eller
+ExtendedSearchEither=enten
+ExtendedSearchNot=ikke
+ExtendedSearchOr=eller
+FileName=Filnavn
+FileNotFoundMessage=Kunne ikke finde filen\:
+FilterBookmarkTree=Gennemse bookmarks
+FormButtonClicked=Mens du klikker p\u00E5 en knap
+FormEmptyMandatoryFieldsMessage=F\u00F8lgende felter er obligatoriske
+FormExportXml=Eksporter til XML
+FormFinally=Afslutte
+FormFireToBack=N\u00E5r du returnerer formularen
+FormFireToFront=N\u00E5r du sender formularen til forsiden
+FormIncompleteIntro=Ikke alle obligatoriske felter er udfyldt.
+FormInvalidFieldsMessage=F\u00F8lgende felter er ugyldige
+FormPrint=Udskriv
+FormReset=Nulstil
+FormSaveChangesQuestion=Vil du gemme \u00E6ndringerne?
+FormStateStoreAs=Gem som...
+Hour=Timer
+InDaysX=om {0} dage
+InvalidNumberMessageX="{0}" er et ugyldigt tal
+InvalidPhoneNumberMessageX="{0}" er et ugyldigt telefonnummer
+InvalidValueMessageX="{0}" er en ugyldig v\u00E6rdi
+Language=Sprog
+LogicBetween=er mellem {0} og {1}
+LogicBetweenShort=mellem
+LogicNotEndsWith=slutter ikke med
+Month=M\u00E5ned
+Name=Navn
+NewBookmarkFolderMenu=Ny mappe...
+NewPassword=Nyt password
+No=Nej
+NumberTooSmallMessageXY=V\u00E6rdien er for lille; skal v\u00E6re mellem {0} og {1}.
+OneSelected=1 valgt
+OriginalErrorMessageIs=Oprindelig besked\: {0}
+PasswordHasExpiredHeader=Dit password er udl\u00F8bet, og skal \u00E6ndres.
+PasswordHasExpiredTitle=Password er udl\u00F8bet
+PasswordWillExpireInfo=Vil du \u00E6ndre det nu?
+PasswordWillExpireTitle=Password udl\u00F8ber
+Path=Sti
+ResetButtonTooltip=Nulstil alle felter
+SavePassword=Gem brugernavn/password
+SearchTextIsTooGeneral=Indskr\u00E6nk s\u00F8getekst
+SmartFieldCannotComplete=Ingen forslag til "{0}"
+Tomorrow=imorgen
+Username=Brugernavn
+Value=V\u00E6rdi
+VersionMismatchAction=Vil du genstarte programmet med automatisk opdatering?
+VersionMismatchTextXY=En opdatering af systemet er n\u00F8dvending for at fors\u00E6tte. Nuv\u00E6rende version er {0}, den nye version er {1}.
+VersionMismatchTitle=Opdatering p\u00E5kr\u00E6vet
+VetoErrorText=Mindst et s\u00F8gefelt skal udfyldes.
+Week=Uge
+WizardBackButtonTooltip=Tilbage til forrige trin
+WizardCancelButton=Annuller
+WizardNextButtonTooltip=Forts\u00E6t til n\u00E6ste trin
+WizardSuspendButton=&Luk
+XMustBeGreaterThanOrEqualY='{0}' skal v\u00E6re st\u00F8rre eller lig med '{1}'
+XMustBeLessThanOrEqualY='{0}' skal v\u00E6re mindre end eller lig '{1}'
+XSelected={0} valgt
+Yes=Ja
+from=fra
+searchingProposals=Forslag til s\u00F8gning...
+to=til
diff --git a/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_de.properties b/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_de.properties
index 2df8555714..fbc51440c3 100644
--- a/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_de.properties
+++ b/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_de.properties
@@ -1,498 +1,498 @@
-ActivateBookmarkMenu=Favorit \u00F6ffnen
-ActiveAndInactiveStates=A&lle
-ActiveStates=&Aktive
-AddCustomColumnMenu=Spalte hinzuf\u00FCgen...
-All=Alle
-AllStates=Alle
-Apply=\u00DCbernehmen
-ApplyBookmarkToSearchFailedMessage=Dieser Favorit ist auf der aktuellen Suche nicht anwendbar.
-Ascending=Aufsteigend
-Attribute=Attribut
-Bookmark=Favorit
-BookmarkFolder=Ordner
-BookmarkResetColumnFilters=Die Spaltenfilter wurden beim Laden des Favoriten entfernt.
-BookmarkResolutionCanceled=Das Laden des Favoriten wurde abgebrochen, da ein Eintrag in dieser Ansicht nicht vorhanden ist.
-BookmarkResolutionCanceledCheckSearchCriteria=Das Laden des Favoriten wurde abgebrochen, da ein Eintrag in dieser Ansicht nicht vorhanden ist. Pr\u00FCfen Sie die Suchbedingungen.
-Bookmarks=Favoriten
-BookmarksAddMenu=&Aktuelle Ansicht zu Favoriten hinzuf\u00FCgen
-BookmarksApplyToCurrentSearch=Suche mit diesem Favoriten ausf\u00FChren
-BookmarksMainMenu=&Favoriten
-BookmarksManageMenu=Favoriten &verwalten...
-BookmarksPublishMenu=Favorit freigeben...
-BookmarksStartPageMenu=&Startansicht
-BookmarksStartPageMenuClear=Startsicht &zur\u00FCcksetzen
-BookmarksStartPageMenuGoto=Startansicht \u00F6ffnen
-BookmarksStartPageMenuSet=Aktuelle Ansicht als &Startsicht festlegen
-Browse=Durchsuchen
-BusyBlockingMessage=Verarbeitung l\u00E4uft. Hier klicken um abzubrechen.
-BusyJob=Warten
-ButtonDeselectAll=Keine ausw\u00E4hlen
-ButtonMoveDown=Nach unten
-ButtonMoveUp=Nach oben
-ButtonSelectAll=Alle ausw\u00E4hlen
-Calendar_earlier=Fr\u00FCher
-Calendar_later=Sp\u00E4ter
-Cancel=Abbrechen
-CancelButton=&Abbrechen
-CancelButtonTooltip=Schliesst ohne zu speichern; im Zweifelsfall mit R\u00FCckfrage.
-ChangePassword=Passwort \u00E4ndern
-CheckAll=Alle markieren
-ClearColumnSorting=nicht sortieren
-Close=Schliessen
-CloseButton=&Schliessen
-CloseButtonTooltip=Schliesst ohne zu speichern.
-CodeTypeInit=Code typ Initialisierung
-Column=Spalte
-ColumnFilterCheckedText=Markierte
-ColumnFilterConstraints=Spalten-Filter
-ColumnFilterDateSection=Datum-Filter
-ColumnFilterMenu=Spalten-Filter...
-ColumnFilterNullText=Leere
-ColumnFilterNumberSection=Zahlen-Filter
-ColumnFilterRemoveButton=Filter entfernen
-ColumnFilterStringSection=Text-Filter
-ColumnFilterUncheckedText=Nicht markierte
-ColumnFilterValuesSection=Werte-Filter
-ColumnSortAscending=aufsteigend sortieren
-ColumnSorting=Sortierung
-ColumnValues=Werte
-Columns=Spalten
-ComposerFieldAggregationAvg=Mittelwert({0})
-ComposerFieldAggregationCount=Anzahl({0})
-ComposerFieldAggregationLabel=Funktion
-ComposerFieldAggregationMax=Maximum({0})
-ComposerFieldAggregationMedian=Median({0})
-ComposerFieldAggregationMin=Minimum({0})
-ComposerFieldAggregationSum=Summe({0})
-Condensed=6 Spalten
-Configure=Konfiguration
-Copy=Kopieren
-CopyWidthsOfColumnsMenu=Spaltenbreiten kopieren
-Criteria=Kriterien
-Cut=Ausschneiden
-Day=Tag
-DefaultPasswordPolicyText=Das Passwort entspricht nicht den vorgegebenen Richtlinien.\n\nRichtlinien\:\n- mind. 8 Zeichen\n- mind. eine Ziffer (0-9)\n- mind. ein Sonderzeichen (\!|@|\#|\\$|%|\\^|&|\\*|\\(|\\)|_|\\+|\\||~|-|\n- nicht schon in der Vergangenheit verwendet\n- der Benutzername darf kein Teil davon sein
-DeleteBookmarkMenu=Favorit l\u00F6schen
-DeleteConfirmationText=Wollen Sie folgende Daten l\u00F6schen?
-DeleteConfirmationTextNoItemList=Wollen Sie diese Daten l\u00F6schen?
-DeleteConfirmationTextNoItemListX=Wollen Sie diese {0} l\u00F6schen?
-DeleteConfirmationTextX=Wollen Sie folgende {0} l\u00F6schen?
-DeleteConfirmationTitle=L\u00F6schen best\u00E4tigen
-DeleteFolderMenu=Ordner l\u00F6schen
-DeleteMenu=L\u00F6schen
-Descending=Absteigend
-Detail=Detail
-DetailedVersion=Detailversion
-Details=Details
-EditBookmarkMenu=Favorit bearbeiten...
-EditFilterMenu=Bearbeiten...
-EmailCc=CC
-EmailFrom=Von
-EmailSent=Gesendet
-EmailSubject=Betreff
-EmailTo=An
-Enabled=Aktiviert
-EndDate=End Datum
-Error=Fehler
-ErrorAndRetryTextDefault=Ein Fehler ist aufgetreten
-ErrorTextLogin=Username/Passwort falsch
-ErrorTextSecurity=Der Zugriff wurde verweigert.
-ErrorTitleLogin=Anmeldung fehlgeschlagen
-ErrorTitleSecurity=Zugriffsfehler
-ErrorWhileLoadingData=Fehler beim Laden der Daten.
-ExcelChart_Button_LoadDefaults=Standardeinstellungen
-ExcelChart_Button_LoadDefaultsHint=Standardeinstellungen laden
-ExcelChart_Button_LoadProfile=Profil laden...
-ExcelChart_Button_LoadProfileHint=L\u00E4dt gespeicherte Einstellungen aus einer XML Datei.
-ExcelChart_Button_SaveProfile=Profil speichern...
-ExcelChart_Button_SaveProfileHint=Speichert die aktuellen Einstellungen in einer XML Datei.
-ExcelChart_Error_CreatingChartFailed=das Erstellen des Diagrammes fehlschlug.
-ExcelChart_Error_ExportingFailed=Export schlug fehl, da
-ExcelChart_Error_InitializationFailed=die Initialisierung der Supportklasse(n) fehl schlug.
-ExcelChart_Error_LoadingProfileFailed=Laden des Profils schlug fehl, da
-ExcelChart_Error_LoadingTemplateFailed=die Vorlage nicht geladen werden konnte.
-ExcelChart_Error_RetrivingOutlineDataFailed=die Outlinedaten nicht gelesen werden konnten.
-ExcelChart_Error_SavingProfileFailed=Speichern des Profils schlug fehl, da
-ExcelChart_Error_WrongProfile=dieses Profil f\u00FCr eine andere Outline erstellt wurde.
-ExcelChart_Label_AutomaticMode=Automatischer Modus
-ExcelChart_Label_AutomaticModeHint=Excel verstecken und automatisch speichern.
-ExcelChart_Label_ChartNumber=Diagramm-Nr.
-ExcelChart_Label_ChartType=Diagrammtyp
-ExcelChart_Label_FileName=Dateiname
-ExcelChart_Label_FirstRow=Erste Zeile
-ExcelChart_Label_Height=H\u00F6he
-ExcelChart_Label_HistogramMode=Histogrammmodus
-ExcelChart_Label_HistogramModeHint=Im Histogrammmodus werden gleiche Werte der X-Achse zusammengefasst.
-ExcelChart_Label_LastRow=Letzte Zeile
-ExcelChart_Label_Offset=Position
-ExcelChart_Label_SkipNullValues=Leere Werte ignorieren
-ExcelChart_Label_SkipNullValuesHint=Falls aktiviert werden im Histogrammmodus leere Werte auf der X-Achse ignoriert, andernfalls werden sie zu <Unbekannt> zusammengefasst.
-ExcelChart_Label_TemplateName=Vorlage
-ExcelChart_Label_UseCustomFormat=Eigenes Format verwenden
-ExcelChart_Label_UseCustomFormatHint=Erm\u00F6glicht es Gr\u00F6sse und Position des Diagramms zu bestimmen.
-ExcelChart_Label_UseExistingChart=Vorhandenes Diagramm verwenden
-ExcelChart_Label_UseExistingChartHint=Benutzt das in der angegebenen Vorlage bereits vorhandene Diagramm.
-ExcelChart_Label_UseSelectiveExport=Zeilen ausw\u00E4hlen
-ExcelChart_Label_UseSelectiveExportHint=Exportiert nur die Zeilen im unten angegebenen Bereich.
-ExcelChart_Label_Width=Breite
-ExcelChart_Label_WorksheetName=Tabellenblatt
-ExcelChart_Label_XAxis=X-Achse
-ExcelChart_Label_YAxes=Y-Achsen
-ExcelChart_Status_Done=Excel Diagramm Export beendet.
-ExcelChart_Tab_Advanced=Erweitert
-ExcelChart_Tab_Basic=Standard
-ExcelChart_Title_MainForm=Excel Diagramm Export
-ExcelChart_Type_Area3D=Fl\u00E4che 3D
-ExcelChart_Type_Area=Fl\u00E4che
-ExcelChart_Type_AreaStacked3D=Fl\u00E4che gestapelt 3D
-ExcelChart_Type_AreaStacked=Fl\u00E4che gestapelt
-ExcelChart_Type_BarsClustered3D=Balken gruppiert 3D
-ExcelChart_Type_BarsClustered=Balken gruppiert
-ExcelChart_Type_BarsStacked3D=Balken gestapelt 3D
-ExcelChart_Type_BarsStacked=Balken gestapelt
-ExcelChart_Type_ColumnsClustered3D=S\u00E4ulen gruppiert 3D
-ExcelChart_Type_ColumnsClustered=S\u00E4ulen gruppiert
-ExcelChart_Type_ColumnsStacked3D=S\u00E4ulen gestapelt 3D
-ExcelChart_Type_ColumnsStacked=S\u00E4ulen gestapelt
-ExcelChart_Type_Line=Linie
-ExcelChart_Type_LineStacked=Linie gestapelt
-ExcelChart_Type_Pie3D=Kreis 3D
-ExcelChart_Type_Pie=Kreis
-ExcelChart_Type_PieExploded3D=Kreis explodiert 3D
-ExcelChart_Type_PieExploded=Kreis explodiert
-ExcelChart_Various_Averaged=gemittelt
-ExcelChart_Various_Column=Spalte
-ExcelChart_Various_Frequency=H\u00E4ufigkeit
-ExcelChart_Various_SummedUp=aufsummiert
-ExcelChart_Various_Unknown=<Unbekannt>
-ExcelChart_WorksheetName_Chart=Diagramm
-ExcelChart_WorksheetName_Data=Diagramm Daten
-ExecutionTime=Server Verarbeitung
-ExportDate=Export Datum
-ExtendedSearchAddAdditionalOrMenu=Zus\u00E4tzliches oder hinzuf\u00FCgen
-ExtendedSearchAddAttribute=Bedingung
-ExtendedSearchAddAttributeMenu=Bedingung hinzuf\u00FCgen...
-ExtendedSearchAddEitherOrMenu=Entweder...oder einf\u00FCgen
-ExtendedSearchAddEntityPrefix=hat
-ExtendedSearchAnd=und
-ExtendedSearchEditAttributeMenu=Bearbeiten...
-ExtendedSearchEither=entweder
-ExtendedSearchEntitySuffix=mit
-ExtendedSearchNegateMenu=Negieren
-ExtendedSearchNot=nicht
-ExtendedSearchOr=oder
-ExtendedSearchRemoveAttributeMenu=Entfernen
-ExtendedSearchRemoveMenu=Entfernen
-FileExistsOwerwriteQuestion=Die ausgew\u00E4hlte Datei existiert bereits. Datei \u00FCberschreiben?
-FileName=Dateiname
-FileNotFoundExceptionMessage=Die Datei wurde nicht gefunden oder Zugriff verweigert.
-FileNotFoundMessage=Folgende Datei wurde nicht gefunden oder Zugriff verweigert\:\n{0}
-FileNotFoundTitle=Datei nicht gefunden
-FilesOfType=Dateityp
-FilterBookmarkTree=Favoriten durchsuchen
-Folders=Ordner
-FormButtonClicked=Beim klick auf einen Knopf
-FormCloseTimerActivated=Aktivierung des Formular-Schliessen Timers
-FormClosing=Schliessen
-FormDisposedMessage=Das Formular {0} wurde bereits geschlossen. Es k\u00F6nnen keine weiteren Aktionen darauf ausgef\u00FCllt werden.
-FormEmptyMandatoryFieldsMessage=Folgende Felder m\u00FCssen ausgef\u00FCllt werden
-FormExportXml=Export nach XML
-FormFinally=Abschliessen
-FormFireActivated=Beim Aktivieren des Formulars
-FormFireClosed=Beim Schliessen des Formulars
-FormFireDiscarded=Beim Verwerfen des Formulars
-FormFirePrinted=Beim erstellen eines Bildes der Form
-FormFireStructureChanged=Beim \u00C4ndern der Formularstruktur
-FormIncompleteIntro=Einige Werte m\u00FCssen angepasst werden.
-FormInvalidFieldsMessage=Folgende Felder haben einen ung\u00FCltigen Wert
-FormPrint=Drucken
-FormReset=Zur\u00FCcksetzen
-FormSaveChangesQuestion=M\u00F6chten Sie die \u00C4nderungen speichern?
-FormStateLoad=\u00D6ffnen...
-FormStateStore=Speichern
-FormStateStoreAs=Speichern unter...
-FormTimerActivated=Timer aktiviert
-FormattingLocale=Formatierung
-GlobalBookmarks=Globale Favoriten
-GlobalBookmarksAddMenu=Zu &globalen Favoriten hinzuf\u00FCgen
-Help=Hilfe
-History=Verlauf
-Host=Computer
-Hour=Stunde
-IOErrorInfo=Bitte betroffene Dateien und Verbindung zum Server pr\u00FCfen.
-IOErrorText=Kommunikationsfehler
-IOErrorTitle=Lese- /Schreibfehler
-InDaysX=in {0} Tagen
-InactiveState=inaktiv
-InactiveStates=&Inaktive
-Info=Informationen
-Information=Informationen
-Interrupted=Abgebrochen
-InterruptedErrorText=Die Ausf\u00FChrung wurde manuell abgebrochen.
-InterruptedErrorTitle=Ausf\u00FChrung abgebrochen
-InvalidNumberMessageX="{0}" ist eine ung\u00FCltige Zahl
-InvalidPhoneNumberMessageX="{0}" ist eine ung\u00FCltige Telefonnummer
-InvalidValueMessageX="{0}" ist ein ung\u00FCltiger Wert
-JavaVMVersion=Java VM
-JavaVersion=Java Runtime
-KeyStroke=Tastenkombination
-Language=Sprache
-Live=Live
-LoadFormXmlFailedText=Dieses File stammt nicht von diesem Form.
-LogicBetween=ist zwischen {0} und {1}
-LogicBetweenShort=zwischen
-LogicDateIsInDays=ist genau in {0} Tagen
-LogicDateIsInGEDays=ist fr\u00FChestens in {0} Tagen
-LogicDateIsInGEMonths=ist fr\u00FChestens in {0} Monaten
-LogicDateIsInLEDays=ist sp\u00E4testens in {0} Tagen
-LogicDateIsInLEMonths=ist sp\u00E4testens in {0} Monaten
-LogicDateIsInLastDays=war in den letzten {0} Tagen
-LogicDateIsInLastMonths=war in den letzten {0} Monaten
-LogicDateIsInMonths=ist genau in {0} Monaten
-LogicDateIsInNextDays=ist in den n\u00E4chsten {0} Tagen
-LogicDateIsInNextMonths=ist in den n\u00E4chsten {0} Monaten
-LogicDateIsNotToday=ist nicht heute
-LogicDateIsToday=ist heute
-LogicDateTimeIsInGEHours=ist fr\u00FChestens in {0} Stunden
-LogicDateTimeIsInGEMinutes=ist fr\u00FChestens in {0} Minuten
-LogicDateTimeIsInLEHours=ist sp\u00E4testens in {0} Stunden
-LogicDateTimeIsInLEMinutes=ist sp\u00E4testens in {0} Minuten
-LogicDateTimeIsNotNow=ist nicht jetzt
-LogicDateTimeIsNow=ist jetzt
-LogicEQ=\=
-LogicEndsWith=endet mit
-LogicGE=>\=
-LogicGT=>
-LogicIn=ist
-LogicLE=<\=
-LogicLT=<
-LogicLike=enth\u00E4lt
-LogicNEQ=<>
-LogicNotEndsWith=endet nicht mit
-LogicNotIn=ist nicht
-LogicNotLike=enth\u00E4lt nicht
-LogicNotNull=ist nicht leer
-LogicNotStartsWith=beginnt nicht mit
-LogicNull=ist leer
-LogicStartsWith=beginnt mit
-LogicTimeIsInGEHours=ist fr\u00FChestens in {0} Stunden
-LogicTimeIsInGEMinutes=ist fr\u00FChestens in {0} Minuten
-LogicTimeIsInHours=ist genau in {0} Stunden
-LogicTimeIsInLEHours=ist sp\u00E4testens in {0} Stunden
-LogicTimeIsInLEMinutes=ist sp\u00E4testens in {0} Minuten
-LogicTimeIsInMinutes=ist genau in {0} Minuten
-LogicTimeIsNotNow=ist nicht jetzt
-LogicTimeIsNow=ist jetzt
-Login=Anmeldung
-LookAndFeel=Look and Feel
-LookIn=Suchen in
-MemoryStatus=Speicher
-Minute=Minute
-ModifyCustomColumnMenu=Spalte \u00E4ndern...
-Month=Monat
-Name=Name
-NavigationBackward=Zur\u00FCck
-NavigationForward=Vorw\u00E4rts
-NetErrorInfo=Bitte Servername, Serveradresse und Verbindung zum Server pr\u00FCfen.
-NetErrorText=Server nicht gefunden
-NetErrorTitle=Netzfehler
-NetworkLatency=Netzwerk Verz\u00F6gerung
-NewBookmarkFolderMenu=Neuer Ordner...
-NewPassword=Neues Passwort
-No=Nein
-NoButton=&Nein
-None=Keine
-NumberOfRows=Anzahl Datens\u00E4tze
-NumberTooLargeMessageXY=Der Wert ist zu gross; muss zwischen {0} und {1} liegen.
-NumberTooSmallMessageXY=Der Wert ist zu klein; muss zwischen {0} und {1} liegen.
-OSUser=System Benutzer
-OSVersion=System Version
-OcrEditorMoveTool=Bild verschieben
-OcrEditorNextPage=N\u00E4chste Seite
-OcrEditorOCRTool=Texterkennung
-OcrEditorOfX=von
-OcrEditorPage=Seite
-OcrEditorPreviousPage=Vorherige Seite
-OcrEditorRotateLeft=Nach links drehen
-OcrEditorRotateRight=Nach rechts drehen
-OcrEditorZoomIn=Vergr\u00F6ssern
-OcrEditorZoomOut=Verkleinern
-OcrEditorZoomToFit=Einpassen
-Ok=Ok
-OkButton=&Ok
-OkButtonTooltip=Speichern und schliessen
-OldPassword=Altes Passwort
-OneFiltered=1 durch Filter ausgeblendet
-OneRow=1 Objekt
-OneSelected=1 ausgew\u00E4hlt
-Op=Operator
-Open=\u00D6ffnen
-OrganizeTableColumnsMenu=Spalten organisieren...
-OrganizeTableColumnsMinimalColumnCountMessage=Mindestens eine Spalte muss sichtbar sein. Bitte setzen Sie eine Spalte auf sichtbar.
-OrganizeTableColumnsTitle=Spalten organisieren
-OriginalErrorMessageIs=Die urspr\u00FCngliche Fehlermeldung ist\:\n{0}
-OutlineSelectorAddOrRemoveButtons=&Sichten hinzuf\u00FCgen oder entfernen
-OutlineSelectorShowFewerButtons=W&eniger Sichten anzeigen
-OutlineSelectorShowMoreButtons=&Weitere Sichten anzeigen
-Password=Passwort
-PasswordHasExpiredHeader=Ihr Passwort ist abgelaufen, Sie sollten es jetzt \u00E4ndern.
-PasswordHasExpiredTitle=Passwort abgelaufen
-PasswordMin8Chars=mindestens 8 Zeichen
-PasswordMinOnNonStdChar=mindestens ein Spezialzeichen
-PasswordMinOneChar=Mindestens ein Buchstaben a-z/A-Z
-PasswordMinOneDigit=Mindestens eine Zahl 0-9
-PasswordNotSameAsLasts=Password darf nicht gleich wie die letzten sein
-PasswordUsernameNotPartOfPass=Username darf nicht Teil des Passwortes sein
-PasswordWillExpireHeaderX=Ihr Passwort l\u00E4uft {0} ab.
-PasswordWillExpireInfo=M\u00F6chten Sie es jetzt \u00E4ndern?
-PasswordWillExpireTitle=Passwort l\u00E4uft ab
-PasswordsDoNotMatch=Die zwei Passw\u00F6rter stimmen nicht \u00FCberein.
-Paste=Einf\u00FCgen
-PasteTextTooLongForFieldX=Der eingef\u00FCgte Text ist zu lange und wurde gek\u00FCrzt.\nMaximale Anzahl Zeichen ist {0}.
-Path=Pfad
-Pending=Warten...
-PrivateBookmarks=Private Favoriten
-Properties=Eigenschaften
-Redo=Wiederherstellen
-Refresh=Aktualisieren
-Remove=Entfernen
-RemoveAllCustomColumnsMenu=Eigene Spalten entfernen
-RemoveCustomColumnMenu=Spalte entfernen
-RenameBookmarkFolderMenu=Ordner umbenennen...
-RepBuildExtract=Daten werden aufbereitet...
-RepExecAfter=Datenbank aufr\u00E4umen
-RepExecBefore=Datenbank vorbereiten
-RepUpdate=Verarbeite Daten...
-RepeatPassword=Wiederholen
-RequestProblem=Verarbeitungsfehler
-ResetButton=&Zur\u00FCcksetzen
-ResetButtonTooltip=Alle Suchbedingungen zur\u00FCcksetzen
-ResetTableColumnFilter=Filter
-ResetTableColumns=Spalten zur\u00FCcksetzen
-ResetTableColumnsAll=Alles
-ResetTableColumnsOrder=Reihenfolge
-ResetTableColumnsSorting=Sortierung
-ResetTableColumnsView=Ansicht
-ResetTableColumnsWidth=Breite
-SC_Copyright=Sentry Spelling-Checker Engine und Bibliotheken sind gesch\u00FCtzte Marken von Wintertree Software, Inc.
-SC_DialogTitle=Rechtschreibepr\u00FCfung
-SC_DialogTitle_Options=Rechtschreibepr\u00FCfung\: Optionen
-SC_Help_AddToDictionary=F\u00FCgt das Wort dem Benutzerw\u00F6rterbuch hinzu
-SC_Help_Cancel=Schliesst den Dialog und verwirft alle \u00C4nderungen (Schnelltaste\: ESC)
-SC_Help_Change=\u00C4ndert das aktuelle Vorkommen des Wortes
-SC_Help_ChangeAll=\u00C4ndert alle Vorkommnisse des Wortes (im aktuellen Textfeld)
-SC_Help_Enable=Schaltet die Scout Rechtschreibepr\u00FCfung ein oder aus
-SC_Help_Ignore=Ignoriert das aktuelle Vorkommen des Wortes
-SC_Help_IgnoreAll=Ignorierte dieses und alle weiteren Vorkommnisse des Wortes
-SC_Help_IgnoreCase=Gross/Kleinschreibung ignorieren
-SC_Help_IgnoreDomainNames=Ignoriert zum Beispiel 'www.bsiag.com'
-SC_Help_IgnoreWordsWithNumbers=Ignoriert W\u00F6rter mit Zahlen
-SC_Help_Language=Die ausgew\u00E4hlte Sprache
-SC_Help_Options=\u00D6ffnet den Optionen Dialog
-SC_Help_RemoveWord=Entfernt das markierte Wort aus dem Benutzerw\u00F6rterbuch
-SC_Help_ReplacementWord=Das Wort mit welchem das markierte Wort ersetzt werden soll (dr\u00FCcken Sie ENTER um das nicht erkannte Wort mit diesem zu ersetzen)
-SC_Help_Shortcut=Die Schnelltaste f\u00FCr den Rechtschreibedialog. Fix, kann nicht ver\u00E4ndert werden.
-SC_Help_SuggestionList=Ersatzvorschl\u00E4ge f\u00FCr das markierte Wort (doppelklicken, um das nicht erkannte Wort mit dem selektierten zu ersetzen)
-SC_Help_Undo=Macht die letzte \u00C4nderung r\u00FCckg\u00E4ngig
-SC_Help_UseDefaults=Alle Einstellungen auf die Standardwerte zur\u00FCcksetzen
-SC_Help_UserDictionary=W\u00E4hlen Sie ein 'tlx' (Scout) oder 'dic' (Microsoft Word) W\u00F6rterbuch als Benutzerw\u00F6rterbuch
-SC_Label_AddToDictionary=Hinzuf\u00FCgen
-SC_Label_Cancel=Abbrechen
-SC_Label_Capitalization=Gross/Kleinschreibung
-SC_Label_Change=\u00C4ndern
-SC_Label_ChangeAll=Alle \u00E4ndern
-SC_Label_ChangeTo=\u00C4ndern nach
-SC_Label_ConsiderChanging=\u00C4nderung in Betracht ziehen
-SC_Label_ContainsDigits=Enth\u00E4lt Zahlen
-SC_Label_DoubledWord=Zweifaches Vorkommen des Wortes
-SC_Label_Enable=Rechtschreibepr\u00FCfung aktivieren
-SC_Label_Ignore=Ignorieren
-SC_Label_IgnoreAll=Alle ignorieren
-SC_Label_IgnoreCase=Gross/Kleinschreibung ignorieren
-SC_Label_IgnoreDomainNames=Domain Namen ignorieren
-SC_Label_IgnoreWordsWithNumbers=W\u00F6rter mit Zahlen ignorieren
-SC_Label_IgnoredWord=Benutzerdefinierte W\u00F6rter
-SC_Label_Main=Rechtschreibung
-SC_Label_MixedCase=Gross/Kleinschreibung gemischt
-SC_Label_NoSuggestions=(Keine Vorschl\u00E4ge)
-SC_Label_NotInDictionary=Das markierte Wort wurde nicht erkannt
-SC_Label_Options=Optionen...
-SC_Label_RemoveWord=Wort entfernen
-SC_Label_Shortcut=Schnelltaste
-SC_Label_Spelling=Rechtschreibung
-SC_Label_Undo=R\u00FCckg\u00E4ngig
-SC_Label_UseDefaults=Standard
-SC_Label_UserDictionary=Benutzerw\u00F6rterbuch
-SC_Language=Sprache
-SC_Message_CheckRest=M\u00F6chten Sie den Rest des Textes \u00FCberpr\u00FCfen?
-SC_Message_Complete=Die Rechtschreibepr\u00FCfung is komplett
-SC_Message_CompleteForSelection=Die Rechtschreibepr\u00FCfung is komplett f\u00FCr die aktuelle Markierung
-SC_Message_NotAvailable=Die Scout Rechtschreibepr\u00FCfung ist nicht verf\u00FCgbar
-Save=Speichern
-SaveButton=&Speichern
-SaveButtonTooltip=Speichern ohne zu schliessen
-SavePassword=Benutzername/Passwort speichern
-ScoutStarting=Scout wird gestartet
-ScoutStoping=Scout wird beendet
-Search=Suchen
-SearchButton=&Suche
-SearchButtonTooltip=Suche starten
-SearchConstraints=Suchbedingung
-SearchTextIsTooGeneral=Bitte Suchbegriff pr\u00E4zisieren
-SearchWasCanceled=Die Suche wurde abgebrochen. Bitte erneut ausf\u00FChren.
-SelectedStates=Nur markierte
-Server=Server
-ServerCallProcessing=Server Aufruf...
-SmartFieldCannotComplete=Keine Vorschl\u00E4ge f\u00FCr "{0}"
-SmartFieldMoreThanXRows=Mehr als {0} Datens\u00E4tze.
-SmartFindLabel=Suchbegriff
-SortDescending=absteigend sortieren
-Source=Quelltext
-StatusExportDone=Export ausgef\u00FChrt
-StringPattern=Ausdruck
-Style=Modus
-Subject=Betreff
-TableName=Tabelle
-Timestamp=Datumssiegel
-Title=Titel
-Today=heute
-Tomorrow=morgen
-TooManyRows=Umfangreiche Datenmenge. Bitte mit Suche einschr\u00E4nken.
-UncheckAll=Keine markieren
-Undo=R\u00FCckg\u00E4ngig
-Update=Aktualisieren
-UpdateBookmarkMenu=Favorit aus aktueller Ansicht aktualisieren
-UserCancelledOperation=Die Operation wurde manuell abgebrochen
-UserInterrupted=Abbruch durch Benutzer
-Username=Benutzername
-Value=Wert
-VersionMismatchAction=M\u00F6chten Sie die Applikation neu starten und die Aktualisierung automatisch ausf\u00FChren?
-VersionMismatchTextXY=Eine Applikations-Aktualisierung ist notwendig um weiterzuarbeiten.\n\nDie aktuelle Version ist {0}, die neue ist {1}.
-VersionMismatchTitle=Aktualisierung notwendig
-VetoErrorText=Mindestens ein Suchfeld muss ausgef\u00FCllt sein.
-Week=Woche
-WeekShort=KW
-Without=Ohne
-WizardBackButton=&Zur\u00FCck
-WizardBackButtonTooltip=Zur\u00FCck zu vorherigem Schritt
-WizardCancelButton=Abbrechen
-WizardCancelButtonTooltip=Bricht den Wizard ab und verwirft alle Daten.
-WizardFinishButton=&Abschliessen
-WizardFinishButtonTooltip=Diesen Prozess abschliessen und zur Prozesswahl zur\u00FCckkehren.
-WizardNextButton=&Weiter
-WizardNextButtonTooltip=Weiter zum n\u00E4chsten Schritt
-WizardSuspendButton=&Unterbrechen
-WizardSuspendButtonTooltip=Unterbricht den Prozess und schliesst den Wizard (kann sp\u00E4ter weitergef\u00FChrt werden).
-WorkWeek=Arbeitswoche
-XFiltered={0} durch Filter ausgeblendet
-XMustBeGreaterThanOrEqualY='{0}' muss gr\u00F6sser oder gleich '{1}' sein
-XMustBeLessThanOrEqualY='{0}' muss kleiner oder gleich '{1}' sein
-XRows={0} Objekte
-XSelected={0} ausgew\u00E4hlt
-Yes=Ja
-YesButton=&Ja
-and=und
-between=Zwischen
-from=von
-searchingProposals=Suche Vorschl\u00E4ge...
-to=bis
+ActivateBookmarkMenu=Favorit \u00F6ffnen
+ActiveAndInactiveStates=A&lle
+ActiveStates=&Aktive
+AddCustomColumnMenu=Spalte hinzuf\u00FCgen...
+All=Alle
+AllStates=Alle
+Apply=\u00DCbernehmen
+ApplyBookmarkToSearchFailedMessage=Dieser Favorit ist auf der aktuellen Suche nicht anwendbar.
+Ascending=Aufsteigend
+Attribute=Attribut
+Bookmark=Favorit
+BookmarkFolder=Ordner
+BookmarkResetColumnFilters=Die Spaltenfilter wurden beim Laden des Favoriten entfernt.
+BookmarkResolutionCanceled=Das Laden des Favoriten wurde abgebrochen, da ein Eintrag in dieser Ansicht nicht vorhanden ist.
+BookmarkResolutionCanceledCheckSearchCriteria=Das Laden des Favoriten wurde abgebrochen, da ein Eintrag in dieser Ansicht nicht vorhanden ist. Pr\u00FCfen Sie die Suchbedingungen.
+Bookmarks=Favoriten
+BookmarksAddMenu=&Aktuelle Ansicht zu Favoriten hinzuf\u00FCgen
+BookmarksApplyToCurrentSearch=Suche mit diesem Favoriten ausf\u00FChren
+BookmarksMainMenu=&Favoriten
+BookmarksManageMenu=Favoriten &verwalten...
+BookmarksPublishMenu=Favorit freigeben...
+BookmarksStartPageMenu=&Startansicht
+BookmarksStartPageMenuClear=Startsicht &zur\u00FCcksetzen
+BookmarksStartPageMenuGoto=Startansicht \u00F6ffnen
+BookmarksStartPageMenuSet=Aktuelle Ansicht als &Startsicht festlegen
+Browse=Durchsuchen
+BusyBlockingMessage=Verarbeitung l\u00E4uft. Hier klicken um abzubrechen.
+BusyJob=Warten
+ButtonDeselectAll=Keine ausw\u00E4hlen
+ButtonMoveDown=Nach unten
+ButtonMoveUp=Nach oben
+ButtonSelectAll=Alle ausw\u00E4hlen
+Calendar_earlier=Fr\u00FCher
+Calendar_later=Sp\u00E4ter
+Cancel=Abbrechen
+CancelButton=&Abbrechen
+CancelButtonTooltip=Schliesst ohne zu speichern; im Zweifelsfall mit R\u00FCckfrage.
+ChangePassword=Passwort \u00E4ndern
+CheckAll=Alle markieren
+ClearColumnSorting=nicht sortieren
+Close=Schliessen
+CloseButton=&Schliessen
+CloseButtonTooltip=Schliesst ohne zu speichern.
+CodeTypeInit=Code typ Initialisierung
+Column=Spalte
+ColumnFilterCheckedText=Markierte
+ColumnFilterConstraints=Spalten-Filter
+ColumnFilterDateSection=Datum-Filter
+ColumnFilterMenu=Spalten-Filter...
+ColumnFilterNullText=Leere
+ColumnFilterNumberSection=Zahlen-Filter
+ColumnFilterRemoveButton=Filter entfernen
+ColumnFilterStringSection=Text-Filter
+ColumnFilterUncheckedText=Nicht markierte
+ColumnFilterValuesSection=Werte-Filter
+ColumnSortAscending=aufsteigend sortieren
+ColumnSorting=Sortierung
+ColumnValues=Werte
+Columns=Spalten
+ComposerFieldAggregationAvg=Mittelwert({0})
+ComposerFieldAggregationCount=Anzahl({0})
+ComposerFieldAggregationLabel=Funktion
+ComposerFieldAggregationMax=Maximum({0})
+ComposerFieldAggregationMedian=Median({0})
+ComposerFieldAggregationMin=Minimum({0})
+ComposerFieldAggregationSum=Summe({0})
+Condensed=6 Spalten
+Configure=Konfiguration
+Copy=Kopieren
+CopyWidthsOfColumnsMenu=Spaltenbreiten kopieren
+Criteria=Kriterien
+Cut=Ausschneiden
+Day=Tag
+DefaultPasswordPolicyText=Das Passwort entspricht nicht den vorgegebenen Richtlinien.\n\nRichtlinien\:\n- mind. 8 Zeichen\n- mind. eine Ziffer (0-9)\n- mind. ein Sonderzeichen (\!|@|\#|\\$|%|\\^|&|\\*|\\(|\\)|_|\\+|\\||~|-|\n- nicht schon in der Vergangenheit verwendet\n- der Benutzername darf kein Teil davon sein
+DeleteBookmarkMenu=Favorit l\u00F6schen
+DeleteConfirmationText=Wollen Sie folgende Daten l\u00F6schen?
+DeleteConfirmationTextNoItemList=Wollen Sie diese Daten l\u00F6schen?
+DeleteConfirmationTextNoItemListX=Wollen Sie diese {0} l\u00F6schen?
+DeleteConfirmationTextX=Wollen Sie folgende {0} l\u00F6schen?
+DeleteConfirmationTitle=L\u00F6schen best\u00E4tigen
+DeleteFolderMenu=Ordner l\u00F6schen
+DeleteMenu=L\u00F6schen
+Descending=Absteigend
+Detail=Detail
+DetailedVersion=Detailversion
+Details=Details
+EditBookmarkMenu=Favorit bearbeiten...
+EditFilterMenu=Bearbeiten...
+EmailCc=CC
+EmailFrom=Von
+EmailSent=Gesendet
+EmailSubject=Betreff
+EmailTo=An
+Enabled=Aktiviert
+EndDate=End Datum
+Error=Fehler
+ErrorAndRetryTextDefault=Ein Fehler ist aufgetreten
+ErrorTextLogin=Username/Passwort falsch
+ErrorTextSecurity=Der Zugriff wurde verweigert.
+ErrorTitleLogin=Anmeldung fehlgeschlagen
+ErrorTitleSecurity=Zugriffsfehler
+ErrorWhileLoadingData=Fehler beim Laden der Daten.
+ExcelChart_Button_LoadDefaults=Standardeinstellungen
+ExcelChart_Button_LoadDefaultsHint=Standardeinstellungen laden
+ExcelChart_Button_LoadProfile=Profil laden...
+ExcelChart_Button_LoadProfileHint=L\u00E4dt gespeicherte Einstellungen aus einer XML Datei.
+ExcelChart_Button_SaveProfile=Profil speichern...
+ExcelChart_Button_SaveProfileHint=Speichert die aktuellen Einstellungen in einer XML Datei.
+ExcelChart_Error_CreatingChartFailed=das Erstellen des Diagrammes fehlschlug.
+ExcelChart_Error_ExportingFailed=Export schlug fehl, da
+ExcelChart_Error_InitializationFailed=die Initialisierung der Supportklasse(n) fehl schlug.
+ExcelChart_Error_LoadingProfileFailed=Laden des Profils schlug fehl, da
+ExcelChart_Error_LoadingTemplateFailed=die Vorlage nicht geladen werden konnte.
+ExcelChart_Error_RetrivingOutlineDataFailed=die Outlinedaten nicht gelesen werden konnten.
+ExcelChart_Error_SavingProfileFailed=Speichern des Profils schlug fehl, da
+ExcelChart_Error_WrongProfile=dieses Profil f\u00FCr eine andere Outline erstellt wurde.
+ExcelChart_Label_AutomaticMode=Automatischer Modus
+ExcelChart_Label_AutomaticModeHint=Excel verstecken und automatisch speichern.
+ExcelChart_Label_ChartNumber=Diagramm-Nr.
+ExcelChart_Label_ChartType=Diagrammtyp
+ExcelChart_Label_FileName=Dateiname
+ExcelChart_Label_FirstRow=Erste Zeile
+ExcelChart_Label_Height=H\u00F6he
+ExcelChart_Label_HistogramMode=Histogrammmodus
+ExcelChart_Label_HistogramModeHint=Im Histogrammmodus werden gleiche Werte der X-Achse zusammengefasst.
+ExcelChart_Label_LastRow=Letzte Zeile
+ExcelChart_Label_Offset=Position
+ExcelChart_Label_SkipNullValues=Leere Werte ignorieren
+ExcelChart_Label_SkipNullValuesHint=Falls aktiviert werden im Histogrammmodus leere Werte auf der X-Achse ignoriert, andernfalls werden sie zu <Unbekannt> zusammengefasst.
+ExcelChart_Label_TemplateName=Vorlage
+ExcelChart_Label_UseCustomFormat=Eigenes Format verwenden
+ExcelChart_Label_UseCustomFormatHint=Erm\u00F6glicht es Gr\u00F6sse und Position des Diagramms zu bestimmen.
+ExcelChart_Label_UseExistingChart=Vorhandenes Diagramm verwenden
+ExcelChart_Label_UseExistingChartHint=Benutzt das in der angegebenen Vorlage bereits vorhandene Diagramm.
+ExcelChart_Label_UseSelectiveExport=Zeilen ausw\u00E4hlen
+ExcelChart_Label_UseSelectiveExportHint=Exportiert nur die Zeilen im unten angegebenen Bereich.
+ExcelChart_Label_Width=Breite
+ExcelChart_Label_WorksheetName=Tabellenblatt
+ExcelChart_Label_XAxis=X-Achse
+ExcelChart_Label_YAxes=Y-Achsen
+ExcelChart_Status_Done=Excel Diagramm Export beendet.
+ExcelChart_Tab_Advanced=Erweitert
+ExcelChart_Tab_Basic=Standard
+ExcelChart_Title_MainForm=Excel Diagramm Export
+ExcelChart_Type_Area3D=Fl\u00E4che 3D
+ExcelChart_Type_Area=Fl\u00E4che
+ExcelChart_Type_AreaStacked3D=Fl\u00E4che gestapelt 3D
+ExcelChart_Type_AreaStacked=Fl\u00E4che gestapelt
+ExcelChart_Type_BarsClustered3D=Balken gruppiert 3D
+ExcelChart_Type_BarsClustered=Balken gruppiert
+ExcelChart_Type_BarsStacked3D=Balken gestapelt 3D
+ExcelChart_Type_BarsStacked=Balken gestapelt
+ExcelChart_Type_ColumnsClustered3D=S\u00E4ulen gruppiert 3D
+ExcelChart_Type_ColumnsClustered=S\u00E4ulen gruppiert
+ExcelChart_Type_ColumnsStacked3D=S\u00E4ulen gestapelt 3D
+ExcelChart_Type_ColumnsStacked=S\u00E4ulen gestapelt
+ExcelChart_Type_Line=Linie
+ExcelChart_Type_LineStacked=Linie gestapelt
+ExcelChart_Type_Pie3D=Kreis 3D
+ExcelChart_Type_Pie=Kreis
+ExcelChart_Type_PieExploded3D=Kreis explodiert 3D
+ExcelChart_Type_PieExploded=Kreis explodiert
+ExcelChart_Various_Averaged=gemittelt
+ExcelChart_Various_Column=Spalte
+ExcelChart_Various_Frequency=H\u00E4ufigkeit
+ExcelChart_Various_SummedUp=aufsummiert
+ExcelChart_Various_Unknown=<Unbekannt>
+ExcelChart_WorksheetName_Chart=Diagramm
+ExcelChart_WorksheetName_Data=Diagramm Daten
+ExecutionTime=Server Verarbeitung
+ExportDate=Export Datum
+ExtendedSearchAddAdditionalOrMenu=Zus\u00E4tzliches oder hinzuf\u00FCgen
+ExtendedSearchAddAttribute=Bedingung
+ExtendedSearchAddAttributeMenu=Bedingung hinzuf\u00FCgen...
+ExtendedSearchAddEitherOrMenu=Entweder...oder einf\u00FCgen
+ExtendedSearchAddEntityPrefix=hat
+ExtendedSearchAnd=und
+ExtendedSearchEditAttributeMenu=Bearbeiten...
+ExtendedSearchEither=entweder
+ExtendedSearchEntitySuffix=mit
+ExtendedSearchNegateMenu=Negieren
+ExtendedSearchNot=nicht
+ExtendedSearchOr=oder
+ExtendedSearchRemoveAttributeMenu=Entfernen
+ExtendedSearchRemoveMenu=Entfernen
+FileExistsOwerwriteQuestion=Die ausgew\u00E4hlte Datei existiert bereits. Datei \u00FCberschreiben?
+FileName=Dateiname
+FileNotFoundExceptionMessage=Die Datei wurde nicht gefunden oder Zugriff verweigert.
+FileNotFoundMessage=Folgende Datei wurde nicht gefunden oder Zugriff verweigert\:\n{0}
+FileNotFoundTitle=Datei nicht gefunden
+FilesOfType=Dateityp
+FilterBookmarkTree=Favoriten durchsuchen
+Folders=Ordner
+FormButtonClicked=Beim klick auf einen Knopf
+FormCloseTimerActivated=Aktivierung des Formular-Schliessen Timers
+FormClosing=Schliessen
+FormDisposedMessage=Das Formular {0} wurde bereits geschlossen. Es k\u00F6nnen keine weiteren Aktionen darauf ausgef\u00FCllt werden.
+FormEmptyMandatoryFieldsMessage=Folgende Felder m\u00FCssen ausgef\u00FCllt werden
+FormExportXml=Export nach XML
+FormFinally=Abschliessen
+FormFireActivated=Beim Aktivieren des Formulars
+FormFireClosed=Beim Schliessen des Formulars
+FormFireDiscarded=Beim Verwerfen des Formulars
+FormFirePrinted=Beim erstellen eines Bildes der Form
+FormFireStructureChanged=Beim \u00C4ndern der Formularstruktur
+FormIncompleteIntro=Einige Werte m\u00FCssen angepasst werden.
+FormInvalidFieldsMessage=Folgende Felder haben einen ung\u00FCltigen Wert
+FormPrint=Drucken
+FormReset=Zur\u00FCcksetzen
+FormSaveChangesQuestion=M\u00F6chten Sie die \u00C4nderungen speichern?
+FormStateLoad=\u00D6ffnen...
+FormStateStore=Speichern
+FormStateStoreAs=Speichern unter...
+FormTimerActivated=Timer aktiviert
+FormattingLocale=Formatierung
+GlobalBookmarks=Globale Favoriten
+GlobalBookmarksAddMenu=Zu &globalen Favoriten hinzuf\u00FCgen
+Help=Hilfe
+History=Verlauf
+Host=Computer
+Hour=Stunde
+IOErrorInfo=Bitte betroffene Dateien und Verbindung zum Server pr\u00FCfen.
+IOErrorText=Kommunikationsfehler
+IOErrorTitle=Lese- /Schreibfehler
+InDaysX=in {0} Tagen
+InactiveState=inaktiv
+InactiveStates=&Inaktive
+Info=Informationen
+Information=Informationen
+Interrupted=Abgebrochen
+InterruptedErrorText=Die Ausf\u00FChrung wurde manuell abgebrochen.
+InterruptedErrorTitle=Ausf\u00FChrung abgebrochen
+InvalidNumberMessageX="{0}" ist eine ung\u00FCltige Zahl
+InvalidPhoneNumberMessageX="{0}" ist eine ung\u00FCltige Telefonnummer
+InvalidValueMessageX="{0}" ist ein ung\u00FCltiger Wert
+JavaVMVersion=Java VM
+JavaVersion=Java Runtime
+KeyStroke=Tastenkombination
+Language=Sprache
+Live=Live
+LoadFormXmlFailedText=Dieses File stammt nicht von diesem Form.
+LogicBetween=ist zwischen {0} und {1}
+LogicBetweenShort=zwischen
+LogicDateIsInDays=ist genau in {0} Tagen
+LogicDateIsInGEDays=ist fr\u00FChestens in {0} Tagen
+LogicDateIsInGEMonths=ist fr\u00FChestens in {0} Monaten
+LogicDateIsInLEDays=ist sp\u00E4testens in {0} Tagen
+LogicDateIsInLEMonths=ist sp\u00E4testens in {0} Monaten
+LogicDateIsInLastDays=war in den letzten {0} Tagen
+LogicDateIsInLastMonths=war in den letzten {0} Monaten
+LogicDateIsInMonths=ist genau in {0} Monaten
+LogicDateIsInNextDays=ist in den n\u00E4chsten {0} Tagen
+LogicDateIsInNextMonths=ist in den n\u00E4chsten {0} Monaten
+LogicDateIsNotToday=ist nicht heute
+LogicDateIsToday=ist heute
+LogicDateTimeIsInGEHours=ist fr\u00FChestens in {0} Stunden
+LogicDateTimeIsInGEMinutes=ist fr\u00FChestens in {0} Minuten
+LogicDateTimeIsInLEHours=ist sp\u00E4testens in {0} Stunden
+LogicDateTimeIsInLEMinutes=ist sp\u00E4testens in {0} Minuten
+LogicDateTimeIsNotNow=ist nicht jetzt
+LogicDateTimeIsNow=ist jetzt
+LogicEQ=\=
+LogicEndsWith=endet mit
+LogicGE=>\=
+LogicGT=>
+LogicIn=ist
+LogicLE=<\=
+LogicLT=<
+LogicLike=enth\u00E4lt
+LogicNEQ=<>
+LogicNotEndsWith=endet nicht mit
+LogicNotIn=ist nicht
+LogicNotLike=enth\u00E4lt nicht
+LogicNotNull=ist nicht leer
+LogicNotStartsWith=beginnt nicht mit
+LogicNull=ist leer
+LogicStartsWith=beginnt mit
+LogicTimeIsInGEHours=ist fr\u00FChestens in {0} Stunden
+LogicTimeIsInGEMinutes=ist fr\u00FChestens in {0} Minuten
+LogicTimeIsInHours=ist genau in {0} Stunden
+LogicTimeIsInLEHours=ist sp\u00E4testens in {0} Stunden
+LogicTimeIsInLEMinutes=ist sp\u00E4testens in {0} Minuten
+LogicTimeIsInMinutes=ist genau in {0} Minuten
+LogicTimeIsNotNow=ist nicht jetzt
+LogicTimeIsNow=ist jetzt
+Login=Anmeldung
+LookAndFeel=Look and Feel
+LookIn=Suchen in
+MemoryStatus=Speicher
+Minute=Minute
+ModifyCustomColumnMenu=Spalte \u00E4ndern...
+Month=Monat
+Name=Name
+NavigationBackward=Zur\u00FCck
+NavigationForward=Vorw\u00E4rts
+NetErrorInfo=Bitte Servername, Serveradresse und Verbindung zum Server pr\u00FCfen.
+NetErrorText=Server nicht gefunden
+NetErrorTitle=Netzfehler
+NetworkLatency=Netzwerk Verz\u00F6gerung
+NewBookmarkFolderMenu=Neuer Ordner...
+NewPassword=Neues Passwort
+No=Nein
+NoButton=&Nein
+None=Keine
+NumberOfRows=Anzahl Datens\u00E4tze
+NumberTooLargeMessageXY=Der Wert ist zu gross; muss zwischen {0} und {1} liegen.
+NumberTooSmallMessageXY=Der Wert ist zu klein; muss zwischen {0} und {1} liegen.
+OSUser=System Benutzer
+OSVersion=System Version
+OcrEditorMoveTool=Bild verschieben
+OcrEditorNextPage=N\u00E4chste Seite
+OcrEditorOCRTool=Texterkennung
+OcrEditorOfX=von
+OcrEditorPage=Seite
+OcrEditorPreviousPage=Vorherige Seite
+OcrEditorRotateLeft=Nach links drehen
+OcrEditorRotateRight=Nach rechts drehen
+OcrEditorZoomIn=Vergr\u00F6ssern
+OcrEditorZoomOut=Verkleinern
+OcrEditorZoomToFit=Einpassen
+Ok=Ok
+OkButton=&Ok
+OkButtonTooltip=Speichern und schliessen
+OldPassword=Altes Passwort
+OneFiltered=1 durch Filter ausgeblendet
+OneRow=1 Objekt
+OneSelected=1 ausgew\u00E4hlt
+Op=Operator
+Open=\u00D6ffnen
+OrganizeTableColumnsMenu=Spalten organisieren...
+OrganizeTableColumnsMinimalColumnCountMessage=Mindestens eine Spalte muss sichtbar sein. Bitte setzen Sie eine Spalte auf sichtbar.
+OrganizeTableColumnsTitle=Spalten organisieren
+OriginalErrorMessageIs=Die urspr\u00FCngliche Fehlermeldung ist\:\n{0}
+OutlineSelectorAddOrRemoveButtons=&Sichten hinzuf\u00FCgen oder entfernen
+OutlineSelectorShowFewerButtons=W&eniger Sichten anzeigen
+OutlineSelectorShowMoreButtons=&Weitere Sichten anzeigen
+Password=Passwort
+PasswordHasExpiredHeader=Ihr Passwort ist abgelaufen, Sie sollten es jetzt \u00E4ndern.
+PasswordHasExpiredTitle=Passwort abgelaufen
+PasswordMin8Chars=mindestens 8 Zeichen
+PasswordMinOnNonStdChar=mindestens ein Spezialzeichen
+PasswordMinOneChar=Mindestens ein Buchstaben a-z/A-Z
+PasswordMinOneDigit=Mindestens eine Zahl 0-9
+PasswordNotSameAsLasts=Password darf nicht gleich wie die letzten sein
+PasswordUsernameNotPartOfPass=Username darf nicht Teil des Passwortes sein
+PasswordWillExpireHeaderX=Ihr Passwort l\u00E4uft {0} ab.
+PasswordWillExpireInfo=M\u00F6chten Sie es jetzt \u00E4ndern?
+PasswordWillExpireTitle=Passwort l\u00E4uft ab
+PasswordsDoNotMatch=Die zwei Passw\u00F6rter stimmen nicht \u00FCberein.
+Paste=Einf\u00FCgen
+PasteTextTooLongForFieldX=Der eingef\u00FCgte Text ist zu lange und wurde gek\u00FCrzt.\nMaximale Anzahl Zeichen ist {0}.
+Path=Pfad
+Pending=Warten...
+PrivateBookmarks=Private Favoriten
+Properties=Eigenschaften
+Redo=Wiederherstellen
+Refresh=Aktualisieren
+Remove=Entfernen
+RemoveAllCustomColumnsMenu=Eigene Spalten entfernen
+RemoveCustomColumnMenu=Spalte entfernen
+RenameBookmarkFolderMenu=Ordner umbenennen...
+RepBuildExtract=Daten werden aufbereitet...
+RepExecAfter=Datenbank aufr\u00E4umen
+RepExecBefore=Datenbank vorbereiten
+RepUpdate=Verarbeite Daten...
+RepeatPassword=Wiederholen
+RequestProblem=Verarbeitungsfehler
+ResetButton=&Zur\u00FCcksetzen
+ResetButtonTooltip=Alle Suchbedingungen zur\u00FCcksetzen
+ResetTableColumnFilter=Filter
+ResetTableColumns=Spalten zur\u00FCcksetzen
+ResetTableColumnsAll=Alles
+ResetTableColumnsOrder=Reihenfolge
+ResetTableColumnsSorting=Sortierung
+ResetTableColumnsView=Ansicht
+ResetTableColumnsWidth=Breite
+SC_Copyright=Sentry Spelling-Checker Engine und Bibliotheken sind gesch\u00FCtzte Marken von Wintertree Software, Inc.
+SC_DialogTitle=Rechtschreibepr\u00FCfung
+SC_DialogTitle_Options=Rechtschreibepr\u00FCfung\: Optionen
+SC_Help_AddToDictionary=F\u00FCgt das Wort dem Benutzerw\u00F6rterbuch hinzu
+SC_Help_Cancel=Schliesst den Dialog und verwirft alle \u00C4nderungen (Schnelltaste\: ESC)
+SC_Help_Change=\u00C4ndert das aktuelle Vorkommen des Wortes
+SC_Help_ChangeAll=\u00C4ndert alle Vorkommnisse des Wortes (im aktuellen Textfeld)
+SC_Help_Enable=Schaltet die Scout Rechtschreibepr\u00FCfung ein oder aus
+SC_Help_Ignore=Ignoriert das aktuelle Vorkommen des Wortes
+SC_Help_IgnoreAll=Ignorierte dieses und alle weiteren Vorkommnisse des Wortes
+SC_Help_IgnoreCase=Gross/Kleinschreibung ignorieren
+SC_Help_IgnoreDomainNames=Ignoriert zum Beispiel 'www.bsiag.com'
+SC_Help_IgnoreWordsWithNumbers=Ignoriert W\u00F6rter mit Zahlen
+SC_Help_Language=Die ausgew\u00E4hlte Sprache
+SC_Help_Options=\u00D6ffnet den Optionen Dialog
+SC_Help_RemoveWord=Entfernt das markierte Wort aus dem Benutzerw\u00F6rterbuch
+SC_Help_ReplacementWord=Das Wort mit welchem das markierte Wort ersetzt werden soll (dr\u00FCcken Sie ENTER um das nicht erkannte Wort mit diesem zu ersetzen)
+SC_Help_Shortcut=Die Schnelltaste f\u00FCr den Rechtschreibedialog. Fix, kann nicht ver\u00E4ndert werden.
+SC_Help_SuggestionList=Ersatzvorschl\u00E4ge f\u00FCr das markierte Wort (doppelklicken, um das nicht erkannte Wort mit dem selektierten zu ersetzen)
+SC_Help_Undo=Macht die letzte \u00C4nderung r\u00FCckg\u00E4ngig
+SC_Help_UseDefaults=Alle Einstellungen auf die Standardwerte zur\u00FCcksetzen
+SC_Help_UserDictionary=W\u00E4hlen Sie ein 'tlx' (Scout) oder 'dic' (Microsoft Word) W\u00F6rterbuch als Benutzerw\u00F6rterbuch
+SC_Label_AddToDictionary=Hinzuf\u00FCgen
+SC_Label_Cancel=Abbrechen
+SC_Label_Capitalization=Gross/Kleinschreibung
+SC_Label_Change=\u00C4ndern
+SC_Label_ChangeAll=Alle \u00E4ndern
+SC_Label_ChangeTo=\u00C4ndern nach
+SC_Label_ConsiderChanging=\u00C4nderung in Betracht ziehen
+SC_Label_ContainsDigits=Enth\u00E4lt Zahlen
+SC_Label_DoubledWord=Zweifaches Vorkommen des Wortes
+SC_Label_Enable=Rechtschreibepr\u00FCfung aktivieren
+SC_Label_Ignore=Ignorieren
+SC_Label_IgnoreAll=Alle ignorieren
+SC_Label_IgnoreCase=Gross/Kleinschreibung ignorieren
+SC_Label_IgnoreDomainNames=Domain Namen ignorieren
+SC_Label_IgnoreWordsWithNumbers=W\u00F6rter mit Zahlen ignorieren
+SC_Label_IgnoredWord=Benutzerdefinierte W\u00F6rter
+SC_Label_Main=Rechtschreibung
+SC_Label_MixedCase=Gross/Kleinschreibung gemischt
+SC_Label_NoSuggestions=(Keine Vorschl\u00E4ge)
+SC_Label_NotInDictionary=Das markierte Wort wurde nicht erkannt
+SC_Label_Options=Optionen...
+SC_Label_RemoveWord=Wort entfernen
+SC_Label_Shortcut=Schnelltaste
+SC_Label_Spelling=Rechtschreibung
+SC_Label_Undo=R\u00FCckg\u00E4ngig
+SC_Label_UseDefaults=Standard
+SC_Label_UserDictionary=Benutzerw\u00F6rterbuch
+SC_Language=Sprache
+SC_Message_CheckRest=M\u00F6chten Sie den Rest des Textes \u00FCberpr\u00FCfen?
+SC_Message_Complete=Die Rechtschreibepr\u00FCfung is komplett
+SC_Message_CompleteForSelection=Die Rechtschreibepr\u00FCfung is komplett f\u00FCr die aktuelle Markierung
+SC_Message_NotAvailable=Die Scout Rechtschreibepr\u00FCfung ist nicht verf\u00FCgbar
+Save=Speichern
+SaveButton=&Speichern
+SaveButtonTooltip=Speichern ohne zu schliessen
+SavePassword=Benutzername/Passwort speichern
+ScoutStarting=Scout wird gestartet
+ScoutStoping=Scout wird beendet
+Search=Suchen
+SearchButton=&Suche
+SearchButtonTooltip=Suche starten
+SearchConstraints=Suchbedingung
+SearchTextIsTooGeneral=Bitte Suchbegriff pr\u00E4zisieren
+SearchWasCanceled=Die Suche wurde abgebrochen. Bitte erneut ausf\u00FChren.
+SelectedStates=Nur markierte
+Server=Server
+ServerCallProcessing=Server Aufruf...
+SmartFieldCannotComplete=Keine Vorschl\u00E4ge f\u00FCr "{0}"
+SmartFieldMoreThanXRows=Mehr als {0} Datens\u00E4tze.
+SmartFindLabel=Suchbegriff
+SortDescending=absteigend sortieren
+Source=Quelltext
+StatusExportDone=Export ausgef\u00FChrt
+StringPattern=Ausdruck
+Style=Modus
+Subject=Betreff
+TableName=Tabelle
+Timestamp=Datumssiegel
+Title=Titel
+Today=heute
+Tomorrow=morgen
+TooManyRows=Umfangreiche Datenmenge. Bitte mit Suche einschr\u00E4nken.
+UncheckAll=Keine markieren
+Undo=R\u00FCckg\u00E4ngig
+Update=Aktualisieren
+UpdateBookmarkMenu=Favorit aus aktueller Ansicht aktualisieren
+UserCancelledOperation=Die Operation wurde manuell abgebrochen
+UserInterrupted=Abbruch durch Benutzer
+Username=Benutzername
+Value=Wert
+VersionMismatchAction=M\u00F6chten Sie die Applikation neu starten und die Aktualisierung automatisch ausf\u00FChren?
+VersionMismatchTextXY=Eine Applikations-Aktualisierung ist notwendig um weiterzuarbeiten.\n\nDie aktuelle Version ist {0}, die neue ist {1}.
+VersionMismatchTitle=Aktualisierung notwendig
+VetoErrorText=Mindestens ein Suchfeld muss ausgef\u00FCllt sein.
+Week=Woche
+WeekShort=KW
+Without=Ohne
+WizardBackButton=&Zur\u00FCck
+WizardBackButtonTooltip=Zur\u00FCck zu vorherigem Schritt
+WizardCancelButton=Abbrechen
+WizardCancelButtonTooltip=Bricht den Wizard ab und verwirft alle Daten.
+WizardFinishButton=&Abschliessen
+WizardFinishButtonTooltip=Diesen Prozess abschliessen und zur Prozesswahl zur\u00FCckkehren.
+WizardNextButton=&Weiter
+WizardNextButtonTooltip=Weiter zum n\u00E4chsten Schritt
+WizardSuspendButton=&Unterbrechen
+WizardSuspendButtonTooltip=Unterbricht den Prozess und schliesst den Wizard (kann sp\u00E4ter weitergef\u00FChrt werden).
+WorkWeek=Arbeitswoche
+XFiltered={0} durch Filter ausgeblendet
+XMustBeGreaterThanOrEqualY='{0}' muss gr\u00F6sser oder gleich '{1}' sein
+XMustBeLessThanOrEqualY='{0}' muss kleiner oder gleich '{1}' sein
+XRows={0} Objekte
+XSelected={0} ausgew\u00E4hlt
+Yes=Ja
+YesButton=&Ja
+and=und
+between=Zwischen
+from=von
+searchingProposals=Suche Vorschl\u00E4ge...
+to=bis
diff --git a/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_el.properties b/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_el.properties
index 2f0d6fde29..32842a0dee 100644
--- a/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_el.properties
+++ b/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_el.properties
@@ -1,284 +1,284 @@
-ActiveAndInactiveStates=\u0395\u03BD\u03B5\u03C1\u03B3\u03CC+\u0391\u03BD\u03B5\u03BD\u03B5\u03C1\u03B3\u03CC
-ActiveStates=\u0395\u03BD\u03B5\u03C1\u03B3\u03CC
-All=\u038C\u03BB\u03B1
-AllStates=\u038C\u03BB\u03B1
-Apply=\u0395\u03C6\u03B1\u03C1\u03BC\u03BF\u03B3\u03AE
-Attribute=\u0399\u03B4\u03B9\u03CC\u03C4\u03B7\u03C4\u03B1
-BookmarkFolder=\u03A6\u03AC\u03BA\u03B5\u03BB\u03BF\u03C2
-Bookmarks=\u03A3\u03B5\u03BB\u03B9\u03B4\u03BF\u03B4\u03B5\u03AF\u03BA\u03C4\u03B5\u03C2
-BookmarksAddMenu=&\u03A0\u03C1\u03BF\u03C3\u03B8\u03AE\u03BA\u03B7 \u03C3\u03C4\u03BF\u03C5\u03C2 \u03C3\u03B5\u03BB\u03B9\u03B4\u03BF\u03B4\u03B5\u03AF\u03BA\u03C4\u03B5\u03C2
-BookmarksMainMenu=&\u03A3\u03B5\u03BB\u03B9\u03B4\u03BF\u03B4\u03B5\u03AF\u03BA\u03C4\u03B5\u03C2
-BookmarksManageMenu=&\u0394\u03B9\u03B1\u03C7\u03B5\u03AF\u03C1\u03B9\u03C3\u03B7 \u03C3\u03B5\u03BB\u03B9\u03B4\u03BF\u03B4\u03B5\u03B9\u03BA\u03C4\u03CE\u03BD
-BookmarksStartPageMenu=&\u03A0\u03C1\u03BF\u03B2\u03BF\u03BB\u03AE \u03B5\u03BA\u03BA\u03AF\u03BD\u03B7\u03C3\u03B7\u03C2
-BookmarksStartPageMenuClear=&\u038C\u03C7\u03B9 \u03C0\u03C1\u03BF\u03B2\u03BF\u03BB\u03AE \u03B5\u03BA\u03BA\u03AF\u03BD\u03B7\u03C3\u03B7\u03C2
-BookmarksStartPageMenuGoto=&\u0386\u03BD\u03BF\u03B9\u03B3\u03BC\u03B1 \u03C0\u03C1\u03BF\u03B2\u03BF\u03BB\u03AE\u03C2 \u03B5\u03BA\u03BA\u03AF\u03BD\u03B7\u03C3\u03B7\u03C2
-BookmarksStartPageMenuSet=&\u039F\u03C1\u03B9\u03C3\u03BC\u03CC\u03C2 \u03C4\u03C1\u03AD\u03C7\u03BF\u03C5\u03C3\u03B1\u03C2 \u03C0\u03C1\u03BF\u03B2\u03BF\u03BB\u03AE\u03C2 \u03C9\u03C2 \u03C0\u03C1\u03BF\u03B2\u03BF\u03BB\u03AE\u03C2 \u03B5\u03BA\u03BA\u03AF\u03BD\u03B7\u03C3\u03B7\u03C2
-ButtonDeselectAll=\u0391\u03C0\u03B5\u03BD\u03B5\u03C1\u03B3\u03BF\u03C0\u03BF\u03AF\u03B7\u03C3\u03B7 \u03CC\u03BB\u03C9\u03BD \u03C4\u03C9\u03BD \u03B5\u03C0\u03B9\u03BB\u03BF\u03B3\u03CE\u03BD
-ButtonSelectAll=\u0395\u03C0\u03B9\u03BB\u03BF\u03B3\u03AE \u03CC\u03BB\u03C9\u03BD
-Calendar_earlier=\u03BD\u03C9\u03C1\u03AF\u03C4\u03B5\u03C1\u03B1
-Calendar_later=\u03B1\u03C1\u03B3\u03CC\u03C4\u03B5\u03C1\u03B1
-Cancel=\u0391\u03BA\u03CD\u03C1\u03C9\u03C3\u03B7
-CancelButton=&\u0391\u03BA\u03CD\u03C1\u03C9\u03C3\u03B7
-CancelButtonTooltip=\u039A\u03BB\u03B5\u03AF\u03C3\u03B5 \u03C4\u03BF\u03BD \u03B4\u03B9\u03AC\u03BB\u03BF\u03B3\u03BF \u03C7\u03C9\u03C1\u03AF\u03C2 \u03B1\u03C0\u03BF\u03B8\u03AE\u03BA\u03B5\u03C5\u03C3\u03B7; \u039C\u03B5 \u03B5\u03C0\u03B9\u03B2\u03B5\u03B2\u03B1\u03AF\u03C9\u03C3\u03B7 \u03C4\u03BF\u03C5 \u03B4\u03B9\u03B1\u03BB\u03CC\u03B3\u03BF\u03C5 \u03B5\u03AC\u03BD \u03B5\u03AF\u03BD\u03B1\u03B9 \u03B1\u03C0\u03B1\u03C1\u03B1\u03AF\u03C4\u03B7\u03C4\u03BF
-ChangePassword=\u039A\u03C9\u03B4\u03B9\u03BA\u03CC\u03C2 \u03A0\u03C1\u03CC\u03C3\u03B2\u03B1\u03C3\u03B7\u03C2
-Close=\u039A\u03BB\u03B5\u03AF\u03C3\u03B9\u03BC\u03BF \u03B4\u03B9\u03B1\u03BB\u03CC\u03B3\u03BF\u03C5 \u03BA\u03B1\u03B9 \u03B5\u03BA\u03BA\u03AF\u03BD\u03B7\u03C3\u03B7 \u03B1\u03BD\u03B1\u03B6\u03AE\u03C4\u03B7\u03C3\u03B7\u03C2
-CloseButton=\u039A\u03BB\u03B5\u03AF\u03C3\u03B5
-CloseButtonTooltip=\u039A\u03BB\u03B5\u03AF\u03C3\u03C4\u03B5 \u03C4\u03BF\u03BD \u03B4\u03B9\u03AC\u03BB\u03BF\u03B3\u03BF \u03C7\u03C9\u03C1\u03AF\u03C2 \u03B1\u03C0\u03BF\u03B8\u03AE\u03BA\u03B5\u03C5\u03C3\u03B7
-Column=\u03A3\u03C4\u03AE\u03BB\u03B7
-Columns=\u03A3\u03C4\u03AE\u03BB\u03B5\u03C2
-ComposerFieldAggregationLabel=\u039B\u03B5\u03B9\u03C4\u03BF\u03C5\u03C1\u03B3\u03AF\u03B1
-Condensed=6 \u03C3\u03C4\u03AE\u03BB\u03B5\u03C2
-Copy=\u0391\u03BD\u03C4\u03B9\u03B3\u03C1\u03B1\u03C6\u03AE
-Cut=\u0391\u03C0\u03BF\u03BA\u03BF\u03C0\u03AE
-Day=\u0397\u03BC\u03AD\u03C1\u03B1
-DefaultPasswordPolicyText=\u039F \u039A\u03C9\u03B4\u03B9\u03BA\u03CC\u03C2 \u03A0\u03C1\u03CC\u03C3\u03B2\u03B1\u03C3\u03B7\u03C2 \u03B4\u03B5\u03BD \u03C3\u03C5\u03BC\u03BC\u03BF\u03C1\u03C6\u03CE\u03BD\u03B5\u03C4\u03B1\u03B9 \u03BC\u03B5 \u03C4\u03B9\u03C2 \u03B4\u03BF\u03B8\u03AD\u03BD\u03C4\u03B5\u03C2 \u03B1\u03C1\u03C7\u03AD\u03C2 \u03B1\u03C3\u03C6\u03B1\u03BB\u03B5\u03AF\u03B1\u03C2 \n\n\u0391\u03C1\u03C7\u03AD\u03C2 \u03B1\u03C3\u03C6\u03B1\u03BB\u03B5\u03AF\u03B1\u03C2\: \n- \u03C4\u03BF\u03C5\u03BB\u03AC\u03C7\u03B9\u03C3\u03C4\u03BF\u03BD 8 \u03C7\u03B1\u03C1\u03B1\u03BA\u03C4\u03AE\u03C1\u03B5\u03C2\n- \u03C4\u03BF\u03C5\u03BB\u03AC\u03C7\u03B9\u03C3\u03C4\u03BF\u03BD \u03AD\u03BD\u03B1\u03BD \u03B1\u03C1\u03B9\u03B8\u03BC\u03CC (0-9)\n- \u03C4\u03BF\u03C5\u03BB\u03AC\u03C7\u03B9\u03C3\u03C4\u03BF\u03BD \u03AD\u03BD\u03B1 \u03BC\u03B7 \u03BA\u03B1\u03BD\u03BF\u03BD\u03B9\u03BA\u03CC \u03C7\u03B1\u03C1\u03B1\u03BA\u03C4\u03AE\u03C1\u03B1 (\!|@|\#|$|%|^|&|*|(|)|_|+|||~|-|
-Detail=\u039B\u03B5\u03C0\u03C4\u03BF\u03BC\u03AD\u03C1\u03B5\u03B9\u03B1
-Details=\u039B\u03B5\u03C0\u03C4\u03BF\u03BC\u03AD\u03C1\u03B5\u03B9\u03B5\u03C2
-EmailFrom=\u0391\u03C0\u03CC
-EmailSubject=\u0398\u03AD\u03BC\u03B1
-EmailTo=\u03A0\u03C1\u03BF\u03C2
-Enabled=\u0395\u03BD\u03B5\u03C1\u03B3\u03BF\u03C0\u03BF\u03B9\u03AE\u03B8\u03B7\u03BA\u03B5
-Error=\u03A3\u03C6\u03AC\u03BB\u03BC\u03B1
-ErrorAndRetryTextDefault=\u0388\u03BD\u03B1 \u03C3\u03C6\u03AC\u03BB\u03BC\u03B1 \u03B5\u03BC\u03C6\u03B1\u03BD\u03AF\u03C3\u03C4\u03B7\u03BA\u03B5 \u03BA\u03B1\u03C4\u03AC \u03C4\u03B7\u03BD \u03B4\u03B9\u03AC\u03C1\u03BA\u03B5\u03B9\u03B1 \u03C4\u03B7\u03C2 \u03BC\u03B5\u03C4\u03B1\u03C6\u03BF\u03C1\u03AC\u03C2.
-ErrorTextLogin=\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF \u03CC\u03BD\u03BF\u03BC\u03B1 \u03C7\u03C1\u03AE\u03C3\u03C4\u03B7/\u03BA\u03C9\u03B4\u03B9\u03BA\u03CC\u03C2
-ErrorTitleLogin=\u0391\u03C0\u03BF\u03C4\u03C5\u03C7\u03AE \u03C3\u03CD\u03BD\u03B4\u03B5\u03C3\u03B7
-ExcelChart_Button_LoadDefaults=\u03A0\u03C1\u03BF\u03B5\u03C0\u03B9\u03BB\u03BF\u03B3\u03AD\u03C2
-ExcelChart_Button_LoadDefaultsHint=\u0395\u03C0\u03B1\u03BD\u03B1\u03C6\u03AD\u03C1\u03B5\u03B9 \u03B1\u03C5\u03C4\u03CC \u03C4\u03BF \u03B4\u03B9\u03B1\u03BB\u03CC\u03BB\u03BF \u03B5\u03C0\u03B9\u03BA\u03BF\u03B9\u03BD\u03C9\u03BD\u03AF\u03B1\u03C2 \u03C6\u03BF\u03C1\u03C4\u03CE\u03BD\u03BF\u03BD\u03C4\u03B1\u03C2 \u03C4\u03B9\u03C2 \u03C0\u03C1\u03BF\u03B5\u03C0\u03B9\u03BB\u03B5\u03B3\u03BC\u03AD\u03BD\u03B5\u03C2 \u03C4\u03B9\u03BC\u03AD\u03C2.
-ExcelChart_Button_LoadProfile=\u03A6\u03CC\u03C1\u03C4\u03C9\u03C3\u03B7 \u03C0\u03C1\u03BF\u03C6\u03AF\u03BB...
-ExcelChart_Button_LoadProfileHint=\u03A6\u03BF\u03C1\u03C4\u03CE\u03BD\u03B5\u03B9 \u03C4\u03B9\u03C2 \u03C1\u03C5\u03B8\u03BC\u03AF\u03C3\u03B5\u03B9\u03C2 \u03B1\u03C0\u03CC \u03AD\u03BD\u03B1 \u03B1\u03C1\u03C7\u03B5\u03AF\u03BF XML.
-ExcelChart_Button_SaveProfile=\u0391\u03C0\u03BF\u03B8\u03AE\u03BA\u03B5\u03C5\u03C3\u03B7 \u03C0\u03C1\u03BF\u03C6\u03AF\u03BB...
-ExcelChart_Button_SaveProfileHint=\u0391\u03C0\u03BF\u03B8\u03B7\u03BA\u03B5\u03CD\u03B5\u03B9 \u03C4\u03B9\u03C2 \u03C4\u03C1\u03AD\u03C7\u03BF\u03C5\u03C3\u03B5\u03C2 \u03C1\u03C5\u03B8\u03BC\u03AF\u03C3\u03B5\u03B9\u03C2 \u03C3\u03B5 \u03AD\u03BD\u03B1 \u03B1\u03C1\u03C7\u03B5\u03AF\u03BF XML.
-ExcelChart_Error_CreatingChartFailed=\u03B1\u03C0\u03BF\u03C4\u03C5\u03C7\u03AF\u03B1 \u03B4\u03B7\u03BC\u03B9\u03BF\u03C5\u03C1\u03B3\u03AF\u03B1\u03C2 \u03B3\u03C1\u03B1\u03C6\u03AE\u03BC\u03B1\u03C4\u03BF\u03C2.
-ExcelChart_Error_ExportingFailed=\u0397 \u03B5\u03BE\u03B1\u03B3\u03C9\u03B3\u03AE \u03B4\u03B5\u03B4\u03BF\u03BC\u03AD\u03BD\u03C9\u03BD \u03B1\u03C0\u03BF\u03C4\u03C5\u03B3\u03C7\u03AC\u03BD\u03B5\u03B9 \u03B4\u03B9\u03CC\u03C4\u03B9
-ExcelChart_Error_InitializationFailed=\u03B1\u03C0\u03BF\u03C4\u03C5\u03C7\u03AF\u03B1 \u03B5\u03BA\u03BA\u03AF\u03BD\u03B7\u03C3\u03B7\u03C2 \u03C4\u03C9\u03BD \u03BA\u03B1\u03C4\u03B7\u03B3\u03BF\u03C1\u03B9\u03CE\u03BD \u03C5\u03C0\u03BF\u03C3\u03C4\u03AE\u03C1\u03B9\u03BE\u03B7\u03C2.
-ExcelChart_Error_LoadingProfileFailed=\u0397 \u03C6\u03CC\u03C1\u03C4\u03C9\u03C3\u03B7 \u03C4\u03BF\u03C5 \u03C0\u03C1\u03BF\u03C6\u03AF\u03BB \u03B1\u03C0\u03AD\u03C4\u03C5\u03C7\u03B5 \u03B4\u03B9\u03CC\u03C4\u03B9
-ExcelChart_Error_LoadingTemplateFailed=\u03B1\u03C0\u03BF\u03C4\u03C5\u03C7\u03AF\u03B1 \u03C6\u03CC\u03C1\u03C4\u03C9\u03C3\u03B7\u03C2 \u03A0\u03C1\u03BF\u03C4\u03CD\u03C0\u03BF\u03C5.
-ExcelChart_Error_RetrivingOutlineDataFailed=\u03B1\u03C0\u03BF\u03C4\u03C5\u03C7\u03AF\u03B1 \u03B1\u03BD\u03AC\u03BA\u03C4\u03B7\u03C3\u03B7\u03C2 \u03C0\u03B5\u03C1\u03AF\u03B3\u03C1\u03B1\u03BC\u03BC\u03B1 \u03B4\u03B5\u03B4\u03BF\u03BC\u03AD\u03BD\u03C9\u03BD.
-ExcelChart_Error_SavingProfileFailed=\u0391\u03C0\u03BF\u03C4\u03C5\u03C7\u03AF\u03B1 \u03B1\u03C0\u03BF\u03B8\u03AE\u03BA\u03B5\u03C5\u03C3\u03B7\u03C2 \u03C4\u03BF\u03C5 \u03A0\u03C1\u03BF\u03C6\u03AF\u03BB \u03B4\u03B9\u03CC\u03C4\u03B9
-ExcelChart_Error_WrongProfile=\u03C4\u03BF \u03C0\u03C1\u03BF\u03C6\u03AF\u03BB \u03B4\u03B7\u03BC\u03B9\u03BF\u03C5\u03C1\u03B3\u03B5\u03AF\u03C4\u03B1\u03B9 \u03B3\u03B9\u03B1 \u03AD\u03BD\u03B1 \u03AC\u03BB\u03BB\u03BF \u03C0\u03B5\u03C1\u03AF\u03B3\u03C1\u03B1\u03BC\u03BC\u03B1.
-ExcelChart_Label_AutomaticMode=\u0391\u03C5\u03C4\u03CC\u03BC\u03B1\u03C4\u03B7 \u03BA\u03B1\u03C4\u03AC\u03C3\u03C4\u03B1\u03C3\u03B7
-ExcelChart_Label_AutomaticModeHint=\u0391\u03C0\u03CC\u03BA\u03C1\u03C5\u03C8\u03B7 \u03C4\u03BF\u03C5 Excel \u03BA\u03B1\u03B9 \u03B1\u03C5\u03C4\u03CC\u03BC\u03B1\u03C4\u03B7 \u03B1\u03C0\u03BF\u03B8\u03AE\u03BA\u03B5\u03C5\u03C3\u03B7.
-ExcelChart_Label_ChartNumber=\u0391\u03C1\u03B9\u03B8\u03BC\u03CC\u03C2 \u03B3\u03C1\u03B1\u03C6\u03AE\u03BC\u03B1\u03C4\u03BF\u03C2.
-ExcelChart_Label_ChartType=\u03A4\u03CD\u03C0\u03BF\u03C2 \u03B3\u03C1\u03B1\u03C6\u03AE\u03BC\u03B1\u03C4\u03BF\u03C2
-ExcelChart_Label_FileName=\u038C\u03BD\u03BF\u03BC\u03B1 \u03B1\u03C1\u03C7\u03B5\u03AF\u03BF\u03C5
-ExcelChart_Label_FirstRow=\u03A0\u03C1\u03CE\u03C4\u03B7 \u03B3\u03C1\u03B1\u03BC\u03BC\u03AE
-ExcelChart_Label_Height=\u038E\u03C8\u03BF\u03C2
-ExcelChart_Label_HistogramMode=\u03A4\u03CD\u03C0\u03BF\u03C2 \u03B9\u03C3\u03C4\u03BF\u03B3\u03C1\u03AC\u03BC\u03BC\u03B1\u03C4\u03BF\u03C2
-ExcelChart_Label_HistogramModeHint=\u0397 \u03BA\u03B1\u03C4\u03AC\u03C3\u03C4\u03B1\u03C3\u03B7 \u03B9\u03C3\u03C4\u03BF\u03B3\u03C1\u03AC\u03BC\u03BC\u03B1\u03C4\u03BF\u03C2 \u03C3\u03C5\u03BD\u03B4\u03B9\u03AC\u03B6\u03B5\u03B9 \u03B5\u03C0\u03B1\u03BA\u03C1\u03AF\u03B2\u03CE\u03C2 \u03C4\u03B9\u03BC\u03AD\u03C2 \u03BA\u03B1\u03C4\u03AC \u03C4\u03BF\u03BD \u03AC\u03BE\u03BF\u03BD\u03B1 \u03A7-\u03A7\u2019.
-ExcelChart_Label_LastRow=\u03A4\u03B5\u03BB\u03B5\u03C5\u03C4\u03B1\u03AF\u03B1 \u03B3\u03C1\u03B1\u03BC\u03BC\u03AE
-ExcelChart_Label_Offset=\u0398\u03AD\u03C3\u03B7
-ExcelChart_Label_SkipNullValues=\u03A0\u03B1\u03C1\u03B1\u03BB\u03B5\u03AF\u03C8\u03C4\u03B5 \u03C4\u03B9\u03C2 \u03BC\u03B7\u03B4\u03B5\u03BD\u03B9\u03BA\u03AD\u03C2 \u03C4\u03B9\u03BC\u03AD\u03C2 \u03C3\u03C4\u03BF\u03BD \u03C4\u03CD\u03C0\u03BF \u03B9\u03C3\u03C4\u03BF\u03B3\u03C1\u03AC\u03BC\u03BC\u03B1\u03C4\u03BF\u03C2
-ExcelChart_Label_SkipNullValuesHint=\u0395\u03AC\u03BD \u03B5\u03BB\u03AD\u03B3\u03C7\u03BF\u03BD\u03C4\u03B1\u03B9 \u03BC\u03B7\u03B4\u03B5\u03BD\u03B9\u03BA\u03AD\u03C2 \u03C4\u03B9\u03BC\u03AD\u03C2 \u03C3\u03C4\u03BF \u03AC\u03BE\u03BF\u03BD\u03B1 \u03A7-\u03A7\u0384 \u03B1\u03C5\u03C4\u03AD\u03C2 \u03C0\u03B1\u03C1\u03B1\u03BB\u03B5\u03AF\u03C0\u03BF\u03BD\u03C4\u03B1\u03B9, \u03B4\u03B9\u03B1\u03C6\u03BF\u03C1\u03B5\u03C4\u03B9\u03BA\u03AC \u03C3\u03C5\u03BD\u03B4\u03C5\u03AC\u03B6\u03BF\u03BD\u03C4\u03B1\u03B9 \u03BC\u03B5 <\u0386\u03B3\u03BD\u03C9\u03C3\u03C4\u03BF\u03C2>.
-ExcelChart_Label_TemplateName=\u03A0\u03C1\u03CC\u03C4\u03C5\u03C0\u03BF
-ExcelChart_Label_UseCustomFormat=\u03A7\u03C1\u03B7\u03C3\u03B9\u03BC\u03BF\u03C0\u03BF\u03B9\u03B5\u03AF\u03C3\u03C4\u03B5 \u03C0\u03C1\u03BF\u03C3\u03B1\u03C1\u03BC\u03BF\u03C3\u03BC\u03AD\u03BD\u03B7 \u03BC\u03BF\u03C1\u03C6\u03BF\u03C0\u03BF\u03AF\u03B7\u03C3\u03B7
-ExcelChart_Label_UseCustomFormatHint=\u0395\u03AC\u03BD \u03B5\u03C0\u03B1\u03BB\u03B7\u03B8\u03B5\u03C5\u03B8\u03B5\u03AF, \u03BC\u03C0\u03BF\u03C1\u03B5\u03AF\u03C4\u03B5 \u03BD\u03B1 \u03C5\u03C0\u03BF\u03B4\u03B5\u03AF\u03BE\u03B5\u03C4\u03B5 \u03C4\u03B7 \u03B8\u03AD\u03C3\u03B7 \u03BA\u03B1\u03B9 \u03C4\u03BF \u03BC\u03AD\u03B3\u03B5\u03B8\u03BF\u03C2 \u03C4\u03BF\u03C5 \u03B3\u03C1\u03B1\u03C6\u03AE\u03BC\u03B1\u03C4\u03BF\u03C2.
-ExcelChart_Label_UseExistingChart=\u03A7\u03C1\u03B7\u03C3\u03B9\u03BC\u03C0\u03BF\u03B9\u03B5\u03AF\u03C3\u03C4\u03B5 \u03C5\u03C0\u03AC\u03C1\u03C7\u03BF\u03BD\u03C4\u03B1 \u03B3\u03C1\u03B1\u03C6\u03AE\u03BC\u03B1\u03C4\u03B1
-ExcelChart_Label_UseExistingChartHint=\u0395\u03AC\u03BD \u03B5\u03C0\u03B1\u03BB\u03B7\u03B8\u03B5\u03C5\u03B8\u03B5\u03AF, \u03C7\u03C1\u03B7\u03C3\u03B9\u03BC\u03BF\u03C0\u03BF\u03B9\u03BF\u03CD\u03BD\u03C4\u03B1\u03B9 \u03C4\u03B1 \u03C5\u03C0\u03AC\u03C1\u03C7\u03BF\u03BD\u03C4\u03B1 \u03B3\u03C1\u03B1\u03C6\u03AE\u03BC\u03B1\u03C4\u03B1 \u03BC\u03B5 \u03C4\u03B1 \u03B5\u03BD\u03B4\u03B5\u03B9\u03BA\u03BD\u03C5\u03CC\u03BC\u03B5\u03BD\u03B1 \u03C0\u03C1\u03CC\u03C4\u03C5\u03C0\u03B1.
-ExcelChart_Label_UseSelectiveExport=\u03A7\u03C1\u03B7\u03C3\u03B9\u03BC\u03BF\u03C0\u03BF\u03B9\u03B5\u03AF\u03C3\u03C4\u03B5 \u03B5\u03C0\u03B9\u03BB\u03B5\u03BA\u03C4\u03B9\u03BA\u03AC \u03B5\u03BE\u03B1\u03B3\u03CE\u03BC\u03B5\u03BD\u03B1
-ExcelChart_Label_UseSelectiveExportHint=\u0395\u03AC\u03BD \u03B5\u03C0\u03B1\u03BB\u03B7\u03B8\u03B5\u03C5\u03C4\u03B5\u03AF, \u03B5\u03BE\u03AC\u03B3\u03BF\u03BD\u03C4\u03B1\u03B9 \u03BC\u03CC\u03BD\u03BF \u03BF\u03B9 \u03C5\u03C0\u03AC\u03C1\u03C7\u03BF\u03C5\u03C3\u03B5\u03C2 \u03B3\u03C1\u03B1\u03BC\u03BC\u03AD\u03C2 \u03C0\u03B1\u03C1\u03B1\u03BA\u03AC\u03C4\u03C9.
-ExcelChart_Label_Width=\u03A0\u03BB\u03AC\u03C4\u03BF\u03C2
-ExcelChart_Label_WorksheetName=\u03A6\u03CD\u03BB\u03BB\u03BF \u0395\u03C1\u03B3\u03B1\u03C3\u03AF\u03B1\u03C2
-ExcelChart_Label_XAxis=\u0386\u03BE\u03BF\u03BD\u03B1 \u03A7
-ExcelChart_Label_YAxes=\u0386\u03BE\u03BF\u03BD\u03B1\u03C2 \u03A8
-ExcelChart_Status_Done=\u03A0\u03C1\u03B1\u03B3\u03BC\u03B1\u03C4\u03BF\u03C0\u03BF\u03B9\u03B5\u03AF\u03C4\u03B1\u03B9 \u03C4\u03BF \u03B3\u03C1\u03AC\u03C6\u03B7\u03BC\u03B1 \u03B5\u03BE\u03B1\u03B3\u03C9\u03B3\u03AE\u03C2 \u03C4\u03BF\u03C5 Excel
-ExcelChart_Tab_Advanced=\u03A0\u03C1\u03BF\u03B7\u03B3\u03BC\u03AD\u03BD\u03BF
-ExcelChart_Tab_Basic=\u0392\u03B1\u03C3\u03B9\u03BA\u03CC
-ExcelChart_Title_MainForm=\u0395\u03BE\u03B1\u03B3\u03C9\u03B3\u03AE \u03B3\u03C1\u03B1\u03C6\u03AE\u03BC\u03B1\u03C4\u03BF\u03C2 Excel
-ExcelChart_Type_Area3D=3D \u03A0\u03B5\u03C1\u03B9\u03BF\u03C7\u03AE
-ExcelChart_Type_Area=\u03A0\u03B5\u03C1\u03B9\u03BF\u03C7\u03AE
-ExcelChart_Type_AreaStacked3D=3D \u0391\u03B8\u03C1\u03BF\u03B9\u03C3\u03C4\u03B9\u03BA\u03AE \u03A0\u03B5\u03C1\u03B9\u03BF\u03C7\u03AE
-ExcelChart_Type_AreaStacked=\u0391\u03B8\u03C1\u03BF\u03B9\u03C3\u03C4\u03B9\u03BA\u03AE \u03A0\u03B5\u03C1\u03B9\u03BF\u03C7\u03AE
-ExcelChart_Type_BarsClustered3D=\u039F\u03BC\u03BF\u03B5\u03B9\u03B4\u03B5\u03AF\u03C2 3D \u03A1\u03AC\u03B2\u03B4\u03BF\u03B9
-ExcelChart_Type_BarsClustered=\u039F\u03BC\u03BF\u03B5\u03B9\u03B4\u03B5\u03AF\u03C2 \u03A1\u03AC\u03B2\u03B4\u03BF\u03B9
-ExcelChart_Type_BarsStacked3D=\u0391\u03B8\u03C1\u03BF\u03B9\u03C3\u03C4\u03B9\u03BA\u03AD\u03C2 3D \u03A1\u03AC\u03B2\u03B4\u03BF\u03B9
-ExcelChart_Type_BarsStacked=\u0391\u03B8\u03C1\u03BF\u03B9\u03C3\u03C4\u03B9\u03BA\u03AD\u03C2 \u03A1\u03AC\u03B2\u03B4\u03BF\u03B9
-ExcelChart_Type_ColumnsClustered3D=\u039F\u03BC\u03BF\u03B5\u03B9\u03B4\u03B5\u03AF\u03C2 3D \u03A3\u03C4\u03AE\u03BB\u03B5\u03C2
-ExcelChart_Type_ColumnsClustered=\u039F\u03BC\u03BF\u03B5\u03B9\u03B4\u03B5\u03AF\u03C2 \u03A3\u03C4\u03AE\u03BB\u03B5\u03C2
-ExcelChart_Type_ColumnsStacked3D=\u0391\u03B8\u03C1\u03BF\u03B9\u03C3\u03C4\u03B9\u03BA\u03AD\u03C2 3D \u03A3\u03C4\u03AE\u03BB\u03B5\u03C2
-ExcelChart_Type_ColumnsStacked=\u0391\u03B8\u03C1\u03BF\u03B9\u03C3\u03C4\u03B9\u03BA\u03AD\u03C2 \u03A3\u03C4\u03AE\u03BB\u03B5\u03C2
-ExcelChart_Type_Line=\u0393\u03C1\u03B1\u03BC\u03BC\u03AD\u03C2
-ExcelChart_Type_LineStacked=\u0391\u03B8\u03C1\u03BF\u03B9\u03C3\u03C4\u03B9\u03BA\u03AD\u03C2 \u0393\u03C1\u03B1\u03BC\u03BC\u03AD\u03C2
-ExcelChart_Type_Pie3D=3D \u03A0\u03AF\u03C4\u03B1
-ExcelChart_Type_Pie=\u03A0\u03AF\u03C4\u03B1
-ExcelChart_Type_PieExploded3D=3D \u0391\u03BD\u03AC\u03C0\u03C4\u03C5\u03B3\u03BC\u03B1 \u03A0\u03AF\u03C4\u03B1\u03C2
-ExcelChart_Type_PieExploded=\u0391\u03BD\u03AC\u03C0\u03C4\u03C5\u03B3\u03BC\u03B1 \u03A0\u03AF\u03C4\u03B1\u03C2
-ExcelChart_Various_Averaged=\u03A3\u03C4\u03C1\u03BF\u03B3\u03B3\u03C5\u03BB\u03B5\u03BC\u03AD\u03BD\u03BF\u03C2 \u03C3\u03B5 \u03BC\u03AD\u03C3\u03BF \u03CC\u03C1\u03BF
-ExcelChart_Various_Column=\u03A3\u03C4\u03AE\u03BB\u03B7
-ExcelChart_Various_Frequency=\u03A3\u03C5\u03C7\u03BD\u03CC\u03C4\u03B7\u03C4\u03B1
-ExcelChart_Various_SummedUp=\u03A3\u03CD\u03BD\u03BF\u03BB\u03BF
-ExcelChart_Various_Unknown=<\u0386\u03B3\u03BD\u03C9\u03C3\u03C4\u03BF\u03C2>
-ExportDate=\u03A0\u03B1\u03C1\u03BF\u03C5\u03C3\u03AF\u03B1\u03C3\u03B7 \u03B4\u03B5\u03B4\u03BF\u03BC\u03AD\u03BD\u03C9\u03BD
-ExtendedSearchAddAttributeMenu=\u03A0\u03C1\u03BF\u03C3\u03B8\u03AD\u03C3\u03C4\u03B5 \u03C0\u03B5\u03C1\u03B9\u03BF\u03C1\u03B9\u03C3\u03BC\u03BF\u03CD\u03C2
-ExtendedSearchAddEntityPrefix=\u03AD\u03C7\u03B5\u03B9
-ExtendedSearchAnd=\u03BA\u03B1\u03B9
-ExtendedSearchEditAttributeMenu=\u0395\u03C0\u03B5\u03BE\u03B5\u03C1\u03B3\u03B1\u03C3\u03AF\u03B1...
-ExtendedSearchEntitySuffix=\u03BC\u03B5
-ExtendedSearchNegateMenu=\u0386\u03C1\u03BD\u03B7\u03C3\u03B7
-ExtendedSearchRemoveAttributeMenu=\u039A\u03B1\u03C4\u03AC\u03C1\u03B3\u03B7\u03C3\u03B5
-ExtendedSearchRemoveMenu=\u039A\u03B1\u03C4\u03AC\u03C1\u03B3\u03B7\u03C3\u03B7
-FileExistsOwerwriteQuestion=\u03A4\u03BF \u03B5\u03C0\u03B9\u03BB\u03B5\u03B3\u03BC\u03AD\u03BD\u03BF \u03B1\u03C1\u03C7\u03B5\u03AF\u03BF \u03C0\u03C1\u03BF\u03CB\u03C0\u03AC\u03C1\u03C7\u03B5\u03B9. \u0395\u03C0\u03B1\u03BD\u03B1\u03B3\u03C1\u03AC\u03C8\u03C4\u03B5 \u03B1\u03C5\u03C4\u03CC \u03C4\u03BF \u03B1\u03C1\u03C7\u03B5\u03AF\u03BF;
-FileName=\u038C\u03BD\u03BF\u03BC\u03B1 \u03B1\u03C1\u03C7\u03B5\u03AF\u03BF\u03C5
-FileNotFoundExceptionMessage=\u0394\u03B5\u03BD \u03B5\u03AF\u03BD\u03B1\u03B9 \u03B4\u03C5\u03BD\u03B1\u03C4\u03AE \u03B7 \u03B5\u03CD\u03C1\u03B5\u03C3\u03B7 \u03AE \u03B7 \u03C0\u03C1\u03BF\u03C3\u03C0\u03AD\u03BB\u03B1\u03C3\u03B7 \u03C4\u03BF\u03C5 \u03B1\u03C1\u03C7\u03B5\u03AF\u03BF\u03C5
-FileNotFoundMessage=\u0394\u03B5\u03BD \u03B5\u03C5\u03C1\u03AD\u03B8\u03B7 \u03C4\u03BF \u03B1\u03C1\u03C7\u03B5\u03AF\u03BF\:
-FileNotFoundTitle=\u03A4\u03BF \u03B1\u03C1\u03C7\u03B5\u03AF\u03BF \u03B4\u03B5\u03BD \u03B5\u03C5\u03C1\u03AD\u03B8\u03B7
-FilesOfType=\u0395\u03AF\u03B4\u03BF\u03C2 \u03B1\u03C1\u03C7\u03B5\u03AF\u03BF\u03C5
-FormClosing=\u039A\u03BB\u03B5\u03AF\u03C3\u03B9\u03BC\u03BF
-FormPrint=\u0395\u03BA\u03C4\u03CD\u03C0\u03C9\u03C3\u03B7
-FormSaveChangesQuestion=\u0398\u03AD\u03BB\u03B5\u03C4\u03B5 \u03BD\u03B1 \u03B1\u03C0\u03BF\u03B8\u03B7\u03BA\u03B5\u03C5\u03C4\u03BF\u03CD\u03BD \u03BF\u03B9 \u03B1\u03BB\u03BB\u03B1\u03B3\u03AD\u03C2;
-FormStateLoad=\u03A6\u03CC\u03C1\u03C4\u03C9\u03C3\u03B5...
-FormStateStore=\u0391\u03C0\u03BF\u03B8\u03AE\u03BA\u03B5\u03C5\u03C3\u03B7
-FormStateStoreAs=\u0391\u03C0\u03BF\u03B8\u03AE\u03BA\u03B5\u03C5\u03C3\u03B7 \u03C9\u03C2...
-GlobalBookmarks=\u03A0\u03B1\u03B3\u03BA\u03CC\u03C3\u03BC\u03B9\u03BF \u03A3\u03B5\u03BB\u03B9\u03B4\u03BF\u03B4\u03B5\u03AF\u03BA\u03C4\u03B7\u03C2
-GlobalBookmarksAddMenu=\u03A0\u03C1\u03BF\u03C3\u03B8\u03AD\u03C3\u03C4\u03B5 \u03C3\u03C4o\u03BF\u03C5\u03C2 &\u03C0\u03B1\u03B3\u03BA\u03CC\u03C3\u03BC\u03B9\u03BF\u03C5\u03C2 \u03C3\u03B5\u03BB\u03B9\u03B4\u03BF\u03B4\u03B5\u03AF\u03BA\u03C4\u03B5\u03C2
-Help=\u0392\u03BF\u03AE\u03B8\u03B5\u03B9\u03B1
-Host=\u03A5\u03C0\u03BF\u03BB\u03BF\u03B3\u03B9\u03C3\u03C4\u03AE\u03C2 \u03C5\u03C0\u03B7\u03C1\u03B5\u03C3\u03AF\u03B1\u03C2
-IOErrorInfo=\u03A0\u03B1\u03C1\u03B1\u03BA\u03B1\u03BB\u03BF\u03CD\u03BC\u03B5 \u03B5\u03BB\u03AD\u03B3\u03BE\u03C4\u03B5 \u03B1\u03C1\u03C7\u03B5\u03AF\u03B1 \u03BA\u03B1\u03B9 \u03C3\u03CD\u03BD\u03B4\u03B5\u03C3\u03B7
-IOErrorText=\u03A3\u03C6\u03AC\u03BB\u03BC\u03B1 \u0395\u03C0\u03B9\u03BA\u03BF\u03B9\u03BD\u03C9\u03BD\u03AF\u03B1\u03C2
-IOErrorTitle=\u03A3\u03C6\u03AC\u03BB\u03BC\u03B1 \u0391\u03BD\u03AC\u03B3\u03BD\u03C9\u03C3\u03B7\u03C2/ \u0395\u03B3\u03B3\u03C1\u03B1\u03C6\u03AE\u03C2
-InactiveState=\u03B1\u03BD\u03B5\u03BD\u03B5\u03C1\u03B3\u03CC
-InactiveStates=\u0391\u03BD\u03B5\u03BD\u03B5\u03C1\u03B3\u03CC
-Info=\u03A0\u03BB\u03B7\u03C1\u03BF\u03C6\u03BF\u03C1\u03AF\u03B5\u03C2
-Interrupted=\u0394\u03B9\u03B1\u03BA\u03CC\u03C0\u03B7\u03BA\u03B5
-InterruptedErrorText=\u0397 \u03B4\u03B9\u03B1\u03B4\u03B9\u03BA\u03B1\u03C3\u03AF\u03B1 \u03AD\u03C7\u03B5\u03B9 \u03B1\u03BA\u03C5\u03C1\u03C9\u03B8\u03B5\u03AF \u03BC\u03B5 \u03C4\u03BF \u03C7\u03AD\u03C1\u03B9
-InterruptedErrorTitle=\u0391\u03BA\u03C5\u03C1\u03CE\u03BD\u03B5\u03C4\u03B1\u03B9 \u03B7 \u03B4\u03B9\u03B1\u03B4\u03B9\u03BA\u03B1\u03C3\u03AF\u03B1
-JavaVMVersion=Java VM
-Language=\u0393\u03BB\u03CE\u03C3\u03C3\u03B1
-Live=Live
-LoadFormXmlFailedText=\u0391\u03C5\u03C4\u03CC \u03C4\u03BF \u03B1\u03C1\u03C7\u03B5\u03AF\u03BF \u03B4\u03B5\u03BD \u03B5\u03AF\u03BD\u03B1\u03B9 \u03C3\u03C5\u03BC\u03B2\u03B1\u03C4\u03CC \u03BC\u03B5 \u03B1\u03C5\u03C4\u03CC\u03BD \u03C4\u03BF \u03B4\u03B9\u03AC\u03BB\u03BF\u03B3\u03BF
-LogicDateIsInDays=\u03B5\u03AF\u03BD\u03B1\u03B9 \u03B1\u03BA\u03C1\u03B9\u03B2\u03CE\u03C2 \u03C3\u03B5 (\u03B7\u03BC\u03AD\u03C1\u03B5\u03C2)
-LogicDateIsInGEDays=\u03B5\u03AF\u03BD\u03B1\u03B9 \u03BD\u03C9\u03C1\u03AF\u03C4\u03B5\u03C1\u03B1 \u03C3\u03B5 (\u03B7\u03BC\u03AD\u03C1\u03B5\u03C2)
-LogicDateIsInGEMonths=\u03B5\u03AF\u03BD\u03B1\u03B9 \u03BD\u03C9\u03C1\u03AF\u03C4\u03B5\u03C1\u03B1 \u03C3\u03B5 (\u03BC\u03AE\u03BD\u03B5\u03C2)
-LogicDateIsInLEDays=\u03B5\u03AF\u03BD\u03B1\u03B9 \u03B1\u03C1\u03B3\u03CC\u03C4\u03B5\u03C1\u03B1 \u03C3\u03B5 (\u03B7\u03BC\u03AD\u03C1\u03B5\u03C2)
-LogicDateIsInLEMonths=\u03B5\u03AF\u03BD\u03B1\u03B9 \u03B1\u03C1\u03B3\u03CC\u03C4\u03B5\u03C1\u03B1 \u03C3\u03B5 (\u03B5\u03B2\u03B4\u03BF\u03BC\u03AC\u03B4\u03B5\u03C2)
-LogicDateIsInLastDays=\u03AE\u03C4\u03B1\u03BD \u03C4\u03B9\u03C2 \u03C4\u03B5\u03BB\u03B5\u03C5\u03C4\u03B1\u03AF\u03B5\u03C2 \u03BD \u03BC\u03AD\u03C1\u03B5\u03C2
-LogicDateIsInLastMonths=\u03AE\u03C4\u03B1\u03BD \u03C4\u03BF\u03C5\u03C2 \u03C4\u03B5\u03BB\u03B5\u03C5\u03C4\u03B1\u03AF\u03BF\u03C5\u03C2 \u03BD \u039C\u03AE\u03BD\u03B5\u03C2
-LogicDateIsInMonths=\u03B5\u03AF\u03BD\u03B1\u03B9 \u03B1\u03BA\u03C1\u03B9\u03B2\u03CE\u03C2 \u03C3\u03B5 (\u03BC\u03AE\u03BD\u03B5\u03C2)
-LogicDateIsInNextDays=\u03AE\u03C4\u03B1\u03BD \u03C4\u03B9\u03C2 \u03B5\u03C0\u03CC\u03BC\u03B5\u03BD\u03B5\u03C2 \u03BD \u03BC\u03AD\u03C1\u03B5\u03C2
-LogicDateIsInNextMonths=\u03AE\u03C4\u03B1\u03BD \u03C4\u03BF\u03C5\u03C2 \u03B5\u03C0\u03CC\u03BC\u03B5\u03BD\u03BF\u03C5\u03C2 \u03BD \u039C\u03AE\u03BD\u03B5\u03C2
-LogicDateIsNotToday=\u03B4\u03B5\u03BD \u03B5\u03AF\u03BD\u03B1\u03B9 \u03C3\u03AE\u03BC\u03B5\u03C1\u03B1
-LogicDateIsToday=\u03B5\u03AF\u03BD\u03B1\u03B9 \u03C3\u03AE\u03BC\u03B5\u03C1\u03B1
-LogicDateTimeIsInGEHours=\u03B5\u03AF\u03BD\u03B1\u03B9 \u03BD\u03C9\u03C1\u03AF\u03C4\u03B5\u03C1\u03B1 \u03C3\u03B5 (\u03B7\u03BC\u03AD\u03C1\u03B5\u03C2)
-LogicDateTimeIsInGEMinutes=\u03B5\u03AF\u03BD\u03B1\u03B9 \u03BD\u03C9\u03C1\u03AF\u03C4\u03B5\u03C1\u03B1 \u03C3\u03B5 (\u03BB\u03B5\u03C0\u03C4\u03AC)
-LogicDateTimeIsInLEHours=\u03B5\u03AF\u03BD\u03B1\u03B9 \u03B1\u03C1\u03B3\u03CC\u03C4\u03B5\u03C1\u03B1 \u03C3\u03B5 (\u03CE\u03C1\u03B5\u03C2)
-LogicDateTimeIsInLEMinutes=\u03B5\u03AF\u03BD\u03B1\u03B9 \u03B1\u03C1\u03B3\u03CC\u03C4\u03B5\u03C1\u03B1 \u03C3\u03B5 (\u03BB\u03B5\u03C0\u03C4\u03AC)
-LogicDateTimeIsNotNow=\u03B4\u03B5\u03BD \u03B5\u03AF\u03BD\u03B1\u03B9 \u03C4\u03CE\u03C1\u03B1
-LogicDateTimeIsNow=\u03B5\u03AF\u03BD\u03B1\u03B9 \u03C4\u03CE\u03C1\u03B1
-LogicEQ=\=
-LogicEndsWith=\u03C4\u03B5\u03BB\u03B5\u03B9\u03CE\u03BD\u03B5\u03B9 \u03BC\u03B5
-LogicGE=>\=
-LogicGT=>
-LogicIn=\u03B5\u03AF\u03BD\u03B1\u03B9
-LogicLE=<\=
-LogicLT=<
-LogicLike=\u03C0\u03B5\u03C1\u03B9\u03AD\u03C7\u03B5\u03B9
-LogicNEQ=<>
-LogicNotIn=\u03B4\u03B5\u03BD \u03B5\u03AF\u03BD\u03B1\u03B9
-LogicNotLike=\u03B4\u03B5\u03BD \u03C0\u03B5\u03C1\u03B9\u03AD\u03C7\u03B5\u03B9
-LogicNotNull=\u03B4\u03B5\u03BD \u03B5\u03AF\u03BD\u03B1\u03B9 \u03AC\u03B4\u03B5\u03B9\u03BF
-LogicNull=\u03B5\u03AF\u03BD\u03B1\u03B9 \u03AC\u03B4\u03B5\u03B9\u03BF
-LogicStartsWith=\u03B1\u03C1\u03C7\u03AF\u03B6\u03B5\u03B9 \u03BC\u03B5
-LogicTimeIsInGEHours=\u03B5\u03AF\u03BD\u03B1\u03B9 \u03BD\u03C9\u03C1\u03AF\u03C4\u03B5\u03C1\u03B1 \u03C3\u03B5 (\u03BB\u03B5\u03C0\u03C4\u03AC)
-LogicTimeIsInGEMinutes=\u03B5\u03AF\u03BD\u03B1\u03B9 \u03BD\u03C9\u03C1\u03AF\u03C4\u03B5\u03C1\u03B1 \u03C3\u03B5 (\u03CE\u03C1\u03B5\u03C2)
-LogicTimeIsInHours=\u03B5\u03AF\u03BD\u03B1\u03B9 \u03B1\u03BA\u03C1\u03B9\u03B2\u03CE\u03C2 \u03C3\u03B5 (\u03CE\u03C1\u03B5\u03C2)
-LogicTimeIsInLEHours=\u03B5\u03AF\u03BD\u03B1\u03B9 \u03B1\u03C1\u03B3\u03CC\u03C4\u03B5\u03C1\u03B1 \u03C3\u03B5 (\u03CE\u03C1\u03B5\u03C2)
-LogicTimeIsInLEMinutes=\u03B5\u03AF\u03BD\u03B1\u03B9 \u03B1\u03C1\u03B3\u03CC\u03C4\u03B5\u03C1\u03B1 \u03C3\u03B5 (\u03BB\u03B5\u03C0\u03C4\u03AC)
-LogicTimeIsInMinutes=\u03B5\u03AF\u03BD\u03B1\u03B9 \u03B1\u03BA\u03C1\u03B9\u03B2\u03CE\u03C2 \u03C3\u03B5 (\u03BB\u03B5\u03C0\u03C4\u03AC)
-LogicTimeIsNotNow=\u03B4\u03B5\u03BD \u03B5\u03AF\u03BD\u03B1\u03B9 \u03C4\u03CE\u03C1\u03B1
-LogicTimeIsNow=\u03B5\u03AF\u03BD\u03B1\u03B9 \u03C4\u03CE\u03C1\u03B1
-Login=\u03A3\u03CD\u03BD\u03B4\u03B5\u03C3\u03B7
-LookAndFeel=\u039A\u03BF\u03AF\u03C4\u03B1 \u03BA\u03B1\u03B9 \u03BD\u03B9\u03CE\u03C3\u03B5
-LookIn=\u0394\u03B9\u03B5\u03C1\u03B5\u03CD\u03BD\u03B7\u03C3\u03B7 \u03C3\u03B5
-Month=\u039C\u03AE\u03BD\u03B1\u03C2
-Name=\u038C\u03BD\u03BF\u03BC\u03B1
-NetErrorInfo=\u03A0\u03B1\u03C1\u03B1\u03BA\u03B1\u03BB\u03BF\u03CD\u03BC\u03B5 \u03B5\u03BB\u03AD\u03B3\u03BE\u03C4\u03B5 \u03CC\u03BD\u03BF\u03BC\u03B1 \u03B4\u03B9\u03B1\u03BA\u03BF\u03BC\u03B9\u03C3\u03C4\u03AE, URL \u03BA\u03B1\u03B9 \u03C3\u03CD\u03BD\u03B4\u03B5\u03C3\u03B7
-NetErrorText=\u0394\u03B5\u03BD \u03B2\u03C1\u03AD\u03B8\u03B7\u03BA\u03B5 \u03B4\u03B9\u03B1\u03BA\u03BF\u03BC\u03B9\u03C3\u03C4\u03AE\u03C2
-NetErrorTitle=\u03A3\u03C6\u03AC\u03BB\u03BC\u03B1 \u03B4\u03B9\u03BA\u03C4\u03CD\u03BF\u03C5
-NewPassword=\u039D\u03AD\u03BF\u03C2 \u039A\u03C9\u03B4\u03B9\u03BA\u03CC\u03C2 \u03A0\u03C1\u03CC\u03C3\u03B2\u03B1\u03C3\u03B7\u03C2
-No=\u038C\u03C7\u03B9
-NoButton=&\u038C\u03C7\u03B9 \u03C0\u03C1\u03BF\u03B2\u03BF\u03BB\u03AE \u03B5\u03BA\u03BA\u03AF\u03BD\u03B7\u03C3\u03B7\u03C2
-NumberOfRows=\u0395\u03B3\u03B3\u03C1\u03B1\u03C6\u03AD\u03C2
-OSUser=\u03A7\u03C1\u03AE\u03C3\u03C4\u03B7\u03C2 \u03A3\u03C5\u03C3\u03C4\u03AE\u03BC\u03B1\u03C4\u03BF\u03C2
-OSVersion=\u0388\u03BA\u03B4\u03BF\u03C3\u03B7 \u03A3\u03C5\u03C3\u03C4\u03AE\u03BC\u03B1\u03C4\u03BF\u03C2
-Ok=\u039F\u039A
-OkButton=\u039F\u039A
-OkButtonTooltip=\u0391\u03C0\u03BF\u03B8\u03B7\u03BA\u03B5\u03CD\u03C3\u03C4\u03B5 \u03BA\u03B1\u03B9 \u03BA\u03BB\u03B5\u03AF\u03C3\u03C4\u03B5 \u03C4\u03BF \u03C0\u03BB\u03B1\u03AF\u03C3\u03B9\u03BF \u03B4\u03B9\u03B1\u03BB\u03CC\u03B3\u03BF\u03C5
-OldPassword=\u0391\u03C0\u03B1\u03C1\u03C7\u03B1\u03B9\u03C9\u03BC\u03AD\u03BD\u03BF\u03C2 \u039A\u03C9\u03B4\u03B9\u03BA\u03CC\u03C2 \u03A0\u03C1\u03CC\u03C3\u03B2\u03B1\u03C3\u03B7\u03C2
-Op=\u03A7\u03B5\u03B9\u03C1\u03B9\u03C3\u03C4\u03AE\u03C2
-Open=\u0386\u03BD\u03BF\u03B9\u03BE\u03B5
-Password=\u039A\u03C9\u03B4\u03B9\u03BA\u03CC\u03C2
-PasswordsDoNotMatch=\u039F\u03B9 \u03B4\u03CD\u03BF \u03BA\u03C9\u03B4\u03B9\u03BA\u03BF\u03AF \u03C0\u03C1\u03CC\u03C3\u03B2\u03B1\u03C3\u03B7\u03C2 \u03B4\u03B5\u03BD \u03C4\u03B1\u03B9\u03C1\u03B9\u03AC\u03B6\u03BF\u03C5\u03BD.
-Paste=\u0395\u03C0\u03B9\u03BA\u03CC\u03BB\u03BB\u03B7\u03C3\u03B7
-Path=\u0394\u03B9\u03B1\u03B4\u03C1\u03BF\u03BC\u03AE
-Pending=\u03A0\u03B5\u03C1\u03B9\u03BC\u03AD\u03BD\u03B5\u03C4\u03B5...
-Properties=\u0399\u03B4\u03B9\u03CC\u03C4\u03B7\u03C4\u03B5\u03C2
-RepBuildExtract=\u03A0\u03C1\u03BF\u03B5\u03C4\u03BF\u03B9\u03BC\u03B1\u03C3\u03AF\u03B1 \u03B4\u03B5\u03B4\u03BF\u03BC\u03AD\u03BD\u03C9\u03BD
-RepExecAfter=\u039A\u03B1\u03B8\u03B1\u03C1\u03B9\u03C3\u03BC\u03CC\u03C2 \u03B2\u03AC\u03C3\u03B7\u03C2 \u03B4\u03B5\u03B4\u03BF\u03BC\u03AD\u03BD\u03C9\u03BD
-RepExecBefore=\u03A0\u03C1\u03BF\u03B5\u03C4\u03BF\u03B9\u03BC\u03B1\u03C3\u03AF\u03B1 \u03B2\u03AC\u03C3\u03B7\u03C2 \u03B4\u03B5\u03B4\u03BF\u03BC\u03AD\u03BD\u03C9\u03BD
-RepUpdate=\u0395\u03C0\u03B5\u03BE\u03B5\u03C1\u03B3\u03B1\u03C3\u03AF\u03B1 \u03B4\u03B5\u03B4\u03BF\u03BC\u03AD\u03BD\u03C9\u03BD...
-RepeatPassword=\u0395\u03C0\u03B1\u03BD\u03AC\u03BB\u03B7\u03C8\u03B7
-ResetButton=\u0395\u03C0\u03B1\u03BD\u03B1\u03C6\u03BF\u03C1\u03AC
-ResetButtonTooltip=\u0398\u03AD\u03C3\u03C4\u03B5 \u03CC\u03BB\u03B1 \u03C4\u03B1 \u03C0\u03BB\u03B1\u03AF\u03C3\u03B9\u03B1 \u03B4\u03B9\u03B1\u03BB\u03CC\u03B3\u03BF\u03C5 \u03C3\u03B5 \u03BA\u03B5\u03BD\u03AD\u03C2 \u03C4\u03B9\u03BC\u03AD\u03C2
-SC_Help_AddToDictionary=\u03A0\u03C1\u03BF\u03C3\u03B8\u03AD\u03C4\u03B5\u03B9 \u03C4\u03B7\u03BD \u03B1\u03BD\u03BF\u03C1\u03B8\u03CC\u03B3\u03C1\u03B1\u03C6\u03B7 \u03BB\u03AD\u03BE\u03B7 \u03C3\u03C4\u03BF \u03BB\u03B5\u03BE\u03B9\u03BA\u03CC
-SC_Help_Cancel=\u039A\u03BB\u03B5\u03AF\u03BD\u03B5\u03B9 \u03C4\u03BF \u03C0\u03B1\u03C1\u03AC\u03B8\u03C5\u03C1\u03BF \u03BA\u03B1\u03B9 \u03B1\u03C0\u03BF\u03C1\u03C1\u03AF\u03C0\u03C4\u03B5\u03B9 \u03CC\u03BB\u03B5\u03C2 \u03C4\u03B9\u03C2 \u03B1\u03BB\u03BB\u03B1\u03B3\u03AD\u03C2
-SC_Help_Change=\u0391\u03BB\u03BB\u03AC\u03B6\u03B5\u03B9 \u03C4\u03B7\u03BD \u03C4\u03C1\u03AD\u03C7\u03BF\u03C5\u03C3\u03B1 \u03B5\u03BC\u03C6\u03AC\u03BD\u03B9\u03C3\u03B7 \u03C4\u03B7\u03C2 \u03B1\u03BD\u03BF\u03C1\u03B8\u03CC\u03B3\u03C1\u03B1\u03C6\u03B7\u03C2 \u03BB\u03AD\u03BE\u03B7\u03C2
-SC_Help_ChangeAll=\u0391\u03BB\u03BB\u03AC\u03B6\u03B5\u03B9 \u03CC\u03BB\u03B5\u03C2 \u03C4\u03B9\u03C2 \u03C0\u03B5\u03C1\u03B9\u03C0\u03C4\u03CE\u03C3\u03B5\u03B9\u03C2 \u03B5\u03BC\u03C6\u03AC\u03BD\u03B9\u03C3\u03B7\u03C2 \u03C4\u03B7\u03C2 \u03B1\u03BD\u03BF\u03C1\u03B8\u03CC\u03B3\u03C1\u03B1\u03C6\u03B7\u03C2 \u03BB\u03AD\u03BE\u03B7\u03C2 (\u03C3\u03C4\u03BF \u03C4\u03C1\u03AD\u03C7\u03BF\u03BD \u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03BF \u03BA\u03B5\u03B9\u03BC\u03AD\u03BD\u03BF\u03C5)
-SC_Help_Ignore=\u0391\u03B3\u03BD\u03BF\u03B5\u03AF\u03C3\u03C4\u03B5 \u03C4\u03B7\u03BD \u03C4\u03C1\u03AD\u03C7\u03BF\u03C5\u03C3\u03B1 \u03B5\u03BC\u03C6\u03AC\u03BD\u03B9\u03C3\u03B7 \u03C4\u03B7\u03C2 \u03B1\u03BD\u03BF\u03C1\u03B8\u03CC\u03B3\u03C1\u03B1\u03C6\u03B7\u03C2 \u03BB\u03AD\u03BE\u03B7\u03C2
-SC_Help_IgnoreAll=\u0391\u03B3\u03BD\u03BF\u03B5\u03AF\u03C3\u03C4\u03B5 \u03B1\u03C5\u03C4\u03AE \u03BA\u03B1\u03B9 \u03CC\u03BB\u03B5\u03C2 \u03C4\u03B9\u03C2 \u03C0\u03B5\u03C1\u03B1\u03B9\u03C4\u03AD\u03C1\u03C9 \u03B5\u03BC\u03C6\u03B1\u03BD\u03AF\u03C3\u03B5\u03B9\u03C2 \u03C4\u03B7\u03C2 \u03BB\u03AD\u03BE\u03B7\u03C2
-SC_Help_Options=\u0386\u03BD\u03BF\u03B9\u03B3\u03BC\u03B1 \u03C0\u03B1\u03C1\u03B1\u03B8\u03CD\u03C1\u03BF\u03C5 \u03B5\u03C0\u03B9\u03BB\u03BF\u03B3\u03CE\u03BD
-SC_Help_RemoveWord=\u039A\u03B1\u03C4\u03B1\u03C1\u03B3\u03B5\u03AF \u03C4\u03B7\u03BD \u03B5\u03C0\u03B9\u03BB\u03B5\u03B3\u03BC\u03AD\u03BD\u03B7 \u03BB\u03AD\u03BE\u03B7 \u03B1\u03C0\u03CC \u03C4\u03BF \u03BB\u03B5\u03BE\u03B9\u03BA\u03CC \u03C7\u03C1\u03AE\u03C3\u03C4\u03B7
-SC_Label_AddToDictionary=\u03A0\u03C1\u03BF\u03C3\u03B8\u03AE\u03BA\u03B7 \u03C3\u03C4\u03BF \u039B\u03B5\u03BE\u03B9\u03BA\u03CC
-SC_Label_Cancel=\u0391\u03BA\u03CD\u03C1\u03C9\u03C3\u03B7
-SC_Label_Capitalization=\u039A\u03B5\u03C6\u03B1\u03BB\u03B1\u03B9\u03BF\u03C0\u03BF\u03AF\u03B7\u03C3\u03B7
-SC_Label_Change=\u0391\u03BB\u03BB\u03B1\u03B3\u03AE
-SC_Label_ChangeAll=\u0391\u03BB\u03BB\u03B1\u03B3\u03AE \u038C\u03BB\u03C9\u03BD
-SC_Label_ChangeTo=\u0391\u03BB\u03BB\u03B1\u03B3\u03AE \u03C3\u03B5
-SC_Label_ContainsDigits=\u0395\u03BC\u03C0\u03B5\u03C1\u03B9\u03AD\u03C7\u03B5\u03B9 \u03A8\u03B7\u03C6\u03AF\u03B1
-SC_Label_DoubledWord=\u0394\u03B9\u03C0\u03BB\u03AE \u03BB\u03AD\u03BE\u03B7
-SC_Label_Enable=\u0395\u03BD\u03B5\u03C1\u03B3\u03BF\u03C0\u03BF\u03AF\u03B7\u03C3\u03B7 \u03B5\u03BB\u03AD\u03B3\u03C7\u03BF\u03C5 \u03BF\u03C1\u03B8\u03BF\u03B3\u03C1\u03B1\u03C6\u03AF\u03B1\u03C2
-SC_Label_Ignore=\u0391\u03B3\u03BD\u03CC\u03B7\u03C3\u03B7
-SC_Label_IgnoreAll=\u0391\u03B3\u03BD\u03CC\u03B7\u03C3\u03B7 \u038C\u03BB\u03C9\u03BD
-SC_Label_IgnoreCase=\u0391\u03B3\u03BD\u03BF\u03B5\u03AF\u03C3\u03C4\u03B5 \u03C4\u03B7\u03BD \u03C0\u03B5\u03C1\u03AF\u03C0\u03C4\u03C9\u03C3\u03B7
-SC_Label_IgnoreDomainNames=\u0391\u03B3\u03BD\u03CC\u03B7\u03C3\u03B7 \u039F\u03BD\u03BF\u03BC\u03AC\u03C4\u03C9\u03BD \u03A0\u03B5\u03B4\u03AF\u03BF\u03C5 \u039F\u03C1\u03B9\u03C3\u03BC\u03BF\u03CD
-SC_Label_IgnoreWordsWithNumbers=\u0391\u03B3\u03BD\u03BF\u03B5\u03AF\u03C3\u03C4\u03B5 \u039B\u03AD\u03BE\u03B5\u03B9\u03C2 \u03BC\u03B5 \u0391\u03C1\u03B9\u03B8\u03BC\u03BF\u03CD\u03C2
-SC_Label_IgnoredWord=\u039B\u03AD\u03BE\u03B7 \u03C0\u03BF\u03C5 \u03B1\u03B3\u03BD\u03BF\u03AE\u03B8\u03B7\u03BA\u03B5
-SC_Label_Main=\u0392\u03B1\u03C3\u03B9\u03BA\u03AD\u03C2 \u03A1\u03C5\u03B8\u03BC\u03AF\u03C3\u03B5\u03B9\u03C2
-SC_Label_MixedCase=\u039C\u03B9\u03BA\u03C4\u03AE \u03A5\u03C0\u03CC\u03B8\u03B5\u03C3\u03B7
-SC_Label_NoSuggestions=(\u03BA\u03B1\u03BC\u03AF\u03B1 \u03C0\u03C1\u03CC\u03C4\u03B1\u03C3\u03B7)
-SC_Label_Options=\u0395\u03C0\u03B9\u03BB\u03BF\u03B3\u03AD\u03C2...
-SC_Label_RemoveWord=\u039A\u03B1\u03C4\u03AC\u03C1\u03B3\u03B7\u03C3\u03B7 \u039B\u03AD\u03BE\u03B7\u03C2
-SC_Label_Shortcut=\u03A3\u03C5\u03BD\u03C4\u03CC\u03BC\u03B5\u03C5\u03C3\u03B7
-SC_Label_Spelling=\u039F\u03C1\u03B8\u03BF\u03B3\u03C1\u03B1\u03C6\u03AF\u03B1
-SC_Language=\u0393\u03BB\u03CE\u03C3\u03C3\u03B1
-Save=\u0391\u03C0\u03BF\u03B8\u03AE\u03BA\u03B5\u03C5\u03C3\u03B7
-SaveButton=&\u0391\u03C0\u03BF\u03B8\u03AE\u03BA\u03B5\u03C5\u03C3\u03B7
-SaveButtonTooltip=\u0391\u03C0\u03BF\u03B8\u03B7\u03BA\u03B5\u03CD\u03C3\u03C4\u03B5 \u03C4\u03BF \u03C0\u03BB\u03B1\u03AF\u03C3\u03B9\u03BF \u03B4\u03B9\u03B1\u03BB\u03CC\u03B3\u03BF\u03C5 \u03C7\u03C9\u03C1\u03AF\u03C2 \u03BD\u03B1 \u03C4\u03BF \u03BA\u03BB\u03B5\u03AF\u03C3\u03B5\u03C4\u03B5
-SearchButton=&\u0391\u03BD\u03B1\u03B6\u03AE\u03C4\u03B7\u03C3\u03B7
-SearchButtonTooltip=\u039A\u03BB\u03B5\u03AF\u03C3\u03B9\u03BC\u03BF \u03B4\u03B9\u03B1\u03BB\u03CC\u03B3\u03BF\u03C5 \u03BA\u03B1\u03B9 \u03B5\u03BA\u03BA\u03AF\u03BD\u03B7\u03C3\u03B7 \u03B1\u03BD\u03B1\u03B6\u03AE\u03C4\u03B7\u03C3\u03B7\u03C2
-SearchConstraints=\u03A0\u03B5\u03C1\u03B9\u03BF\u03C1\u03B9\u03C3\u03BC\u03CC\u03C2 \u03B1\u03BD\u03B1\u03B6\u03AE\u03C4\u03B7\u03C3\u03B7\u03C2
-Server=\u0394\u03B9\u03B1\u03BA\u03BF\u03BC\u03B9\u03C3\u03C4\u03AE\u03C2 \u03BC\u03B5 \u03C3\u03CD\u03BD\u03B4\u03B5\u03C3\u03B7
-SmartFieldMoreThanXRows=\u03A0\u03B5\u03C1\u03B9\u03C3\u03C3\u03CC\u03C4\u03B5\u03C1\u03B5\u03C2 \u03B1\u03C0\u03CC {0} \u03B3\u03C1\u03B1\u03BC\u03BC\u03AD\u03C2. \u03A0\u03C1\u03BF\u03B2\u03BF\u03BB\u03AE \u03BC\u03CC\u03BD\u03BF {1}.
-SmartFindLabel=\u0391\u03BD\u03B1\u03B6\u03AE\u03C4\u03B7\u03C3\u03B7 \u03BA\u03B5\u03B9\u03BC\u03AD\u03BD\u03BF\u03C5
-StatusExportDone=\u0397 \u03B5\u03BE\u03B1\u03B3\u03C9\u03B3\u03AE \u03BF\u03BB\u03BF\u03BA\u03BB\u03B7\u03C1\u03CE\u03B8\u03B7\u03BA\u03B5
-Style=\u03A3\u03C4\u03C5\u03BB
-TableName=\u03A0\u03AF\u03BD\u03B1\u03BA\u03B1\u03C2
-Timestamp=\u03A7\u03C1\u03BF\u03BD\u03BF\u03C3\u03C6\u03C1\u03B1\u03B3\u03AF\u03B4\u03B1
-Today=\u03C3\u03AE\u03BC\u03B5\u03C1\u03B1
-TooManyRows=\u03A5\u03C0\u03B5\u03C1\u03BC\u03B5\u03B3\u03AD\u03B8\u03B7\u03C2 \u03B2\u03AC\u03C3\u03B7 \u03B4\u03B5\u03B4\u03BF\u03BC\u03AD\u03BD\u03C9\u03BD. \u03A0\u03B1\u03C1\u03B1\u03BA\u03B1\u03BB\u03CE \u03C0\u03B5\u03C1\u03B9\u03BF\u03C1\u03AF\u03C3\u03C4\u03B5 \u03C4\u03B7 \u03C7\u03C1\u03B7\u03C3\u03B9\u03BC\u03BF\u03C0\u03BF\u03B9\u03CE\u03BD\u03C4\u03B1\u03C2 \u03C4\u03B1 \u03C6\u03AF\u03BB\u03C4\u03C1\u03B1 \u0391\u03BD\u03B1\u03B6\u03AE\u03C4\u03B7\u03C3\u03B7\u03C2.
-Update=\u0395\u03BD\u03B7\u03BC\u03AD\u03C1\u03C9\u03C3\u03B7
-UserInterrupted=\u0391\u03BA\u03C5\u03C1\u03CE\u03B8\u03B7\u03BA\u03B5 \u03B1\u03C0\u03CC \u03C4\u03BF\u03BD \u03C7\u03C1\u03AE\u03C3\u03C4\u03B7
-Username=\u038C\u03BD\u03BF\u03BC\u03B1 \u03A7\u03C1\u03AE\u03C3\u03C4\u03B7
-Value=\u03A4\u03B9\u03BC\u03AE
-Week=\u0395\u03B2\u03B4\u03BF\u03BC\u03AC\u03B4\u03B1
-WeekShort=CW
-WizardBackButton=\u03A0\u03AF\u03C3\u03C9
-WizardCancelButton=\u0391\u03BA\u03CD\u03C1\u03C9\u03C3\u03B7
-WizardFinishButton=\u03A4\u03AD\u03BB\u03BF\u03C2
-WizardNextButton=\u0395\u03C0\u03CC\u03BC\u03B5\u03BD\u03BF
-WizardSuspendButton=\u039A\u03BB\u03B5\u03AF\u03C3\u03B9\u03BC\u03BF
-WorkWeek=\u0395\u03B2\u03B4\u03BF\u03BC\u03AC\u03B4\u03B1 \u03B5\u03C1\u03B3\u03B1\u03C3\u03AF\u03B1\u03C2
-Yes=\u039D\u03B1\u03B9
-YesButton=\u039D\u03B1\u03B9
-and=\u03BA\u03B1\u03B9
-between=\u03BC\u03B5\u03C4\u03B1\u03BE\u03CD
-from=\u03B1\u03C0\u03CC
-to=\u03C9\u03C2
+ActiveAndInactiveStates=\u0395\u03BD\u03B5\u03C1\u03B3\u03CC+\u0391\u03BD\u03B5\u03BD\u03B5\u03C1\u03B3\u03CC
+ActiveStates=\u0395\u03BD\u03B5\u03C1\u03B3\u03CC
+All=\u038C\u03BB\u03B1
+AllStates=\u038C\u03BB\u03B1
+Apply=\u0395\u03C6\u03B1\u03C1\u03BC\u03BF\u03B3\u03AE
+Attribute=\u0399\u03B4\u03B9\u03CC\u03C4\u03B7\u03C4\u03B1
+BookmarkFolder=\u03A6\u03AC\u03BA\u03B5\u03BB\u03BF\u03C2
+Bookmarks=\u03A3\u03B5\u03BB\u03B9\u03B4\u03BF\u03B4\u03B5\u03AF\u03BA\u03C4\u03B5\u03C2
+BookmarksAddMenu=&\u03A0\u03C1\u03BF\u03C3\u03B8\u03AE\u03BA\u03B7 \u03C3\u03C4\u03BF\u03C5\u03C2 \u03C3\u03B5\u03BB\u03B9\u03B4\u03BF\u03B4\u03B5\u03AF\u03BA\u03C4\u03B5\u03C2
+BookmarksMainMenu=&\u03A3\u03B5\u03BB\u03B9\u03B4\u03BF\u03B4\u03B5\u03AF\u03BA\u03C4\u03B5\u03C2
+BookmarksManageMenu=&\u0394\u03B9\u03B1\u03C7\u03B5\u03AF\u03C1\u03B9\u03C3\u03B7 \u03C3\u03B5\u03BB\u03B9\u03B4\u03BF\u03B4\u03B5\u03B9\u03BA\u03C4\u03CE\u03BD
+BookmarksStartPageMenu=&\u03A0\u03C1\u03BF\u03B2\u03BF\u03BB\u03AE \u03B5\u03BA\u03BA\u03AF\u03BD\u03B7\u03C3\u03B7\u03C2
+BookmarksStartPageMenuClear=&\u038C\u03C7\u03B9 \u03C0\u03C1\u03BF\u03B2\u03BF\u03BB\u03AE \u03B5\u03BA\u03BA\u03AF\u03BD\u03B7\u03C3\u03B7\u03C2
+BookmarksStartPageMenuGoto=&\u0386\u03BD\u03BF\u03B9\u03B3\u03BC\u03B1 \u03C0\u03C1\u03BF\u03B2\u03BF\u03BB\u03AE\u03C2 \u03B5\u03BA\u03BA\u03AF\u03BD\u03B7\u03C3\u03B7\u03C2
+BookmarksStartPageMenuSet=&\u039F\u03C1\u03B9\u03C3\u03BC\u03CC\u03C2 \u03C4\u03C1\u03AD\u03C7\u03BF\u03C5\u03C3\u03B1\u03C2 \u03C0\u03C1\u03BF\u03B2\u03BF\u03BB\u03AE\u03C2 \u03C9\u03C2 \u03C0\u03C1\u03BF\u03B2\u03BF\u03BB\u03AE\u03C2 \u03B5\u03BA\u03BA\u03AF\u03BD\u03B7\u03C3\u03B7\u03C2
+ButtonDeselectAll=\u0391\u03C0\u03B5\u03BD\u03B5\u03C1\u03B3\u03BF\u03C0\u03BF\u03AF\u03B7\u03C3\u03B7 \u03CC\u03BB\u03C9\u03BD \u03C4\u03C9\u03BD \u03B5\u03C0\u03B9\u03BB\u03BF\u03B3\u03CE\u03BD
+ButtonSelectAll=\u0395\u03C0\u03B9\u03BB\u03BF\u03B3\u03AE \u03CC\u03BB\u03C9\u03BD
+Calendar_earlier=\u03BD\u03C9\u03C1\u03AF\u03C4\u03B5\u03C1\u03B1
+Calendar_later=\u03B1\u03C1\u03B3\u03CC\u03C4\u03B5\u03C1\u03B1
+Cancel=\u0391\u03BA\u03CD\u03C1\u03C9\u03C3\u03B7
+CancelButton=&\u0391\u03BA\u03CD\u03C1\u03C9\u03C3\u03B7
+CancelButtonTooltip=\u039A\u03BB\u03B5\u03AF\u03C3\u03B5 \u03C4\u03BF\u03BD \u03B4\u03B9\u03AC\u03BB\u03BF\u03B3\u03BF \u03C7\u03C9\u03C1\u03AF\u03C2 \u03B1\u03C0\u03BF\u03B8\u03AE\u03BA\u03B5\u03C5\u03C3\u03B7; \u039C\u03B5 \u03B5\u03C0\u03B9\u03B2\u03B5\u03B2\u03B1\u03AF\u03C9\u03C3\u03B7 \u03C4\u03BF\u03C5 \u03B4\u03B9\u03B1\u03BB\u03CC\u03B3\u03BF\u03C5 \u03B5\u03AC\u03BD \u03B5\u03AF\u03BD\u03B1\u03B9 \u03B1\u03C0\u03B1\u03C1\u03B1\u03AF\u03C4\u03B7\u03C4\u03BF
+ChangePassword=\u039A\u03C9\u03B4\u03B9\u03BA\u03CC\u03C2 \u03A0\u03C1\u03CC\u03C3\u03B2\u03B1\u03C3\u03B7\u03C2
+Close=\u039A\u03BB\u03B5\u03AF\u03C3\u03B9\u03BC\u03BF \u03B4\u03B9\u03B1\u03BB\u03CC\u03B3\u03BF\u03C5 \u03BA\u03B1\u03B9 \u03B5\u03BA\u03BA\u03AF\u03BD\u03B7\u03C3\u03B7 \u03B1\u03BD\u03B1\u03B6\u03AE\u03C4\u03B7\u03C3\u03B7\u03C2
+CloseButton=\u039A\u03BB\u03B5\u03AF\u03C3\u03B5
+CloseButtonTooltip=\u039A\u03BB\u03B5\u03AF\u03C3\u03C4\u03B5 \u03C4\u03BF\u03BD \u03B4\u03B9\u03AC\u03BB\u03BF\u03B3\u03BF \u03C7\u03C9\u03C1\u03AF\u03C2 \u03B1\u03C0\u03BF\u03B8\u03AE\u03BA\u03B5\u03C5\u03C3\u03B7
+Column=\u03A3\u03C4\u03AE\u03BB\u03B7
+Columns=\u03A3\u03C4\u03AE\u03BB\u03B5\u03C2
+ComposerFieldAggregationLabel=\u039B\u03B5\u03B9\u03C4\u03BF\u03C5\u03C1\u03B3\u03AF\u03B1
+Condensed=6 \u03C3\u03C4\u03AE\u03BB\u03B5\u03C2
+Copy=\u0391\u03BD\u03C4\u03B9\u03B3\u03C1\u03B1\u03C6\u03AE
+Cut=\u0391\u03C0\u03BF\u03BA\u03BF\u03C0\u03AE
+Day=\u0397\u03BC\u03AD\u03C1\u03B1
+DefaultPasswordPolicyText=\u039F \u039A\u03C9\u03B4\u03B9\u03BA\u03CC\u03C2 \u03A0\u03C1\u03CC\u03C3\u03B2\u03B1\u03C3\u03B7\u03C2 \u03B4\u03B5\u03BD \u03C3\u03C5\u03BC\u03BC\u03BF\u03C1\u03C6\u03CE\u03BD\u03B5\u03C4\u03B1\u03B9 \u03BC\u03B5 \u03C4\u03B9\u03C2 \u03B4\u03BF\u03B8\u03AD\u03BD\u03C4\u03B5\u03C2 \u03B1\u03C1\u03C7\u03AD\u03C2 \u03B1\u03C3\u03C6\u03B1\u03BB\u03B5\u03AF\u03B1\u03C2 \n\n\u0391\u03C1\u03C7\u03AD\u03C2 \u03B1\u03C3\u03C6\u03B1\u03BB\u03B5\u03AF\u03B1\u03C2\: \n- \u03C4\u03BF\u03C5\u03BB\u03AC\u03C7\u03B9\u03C3\u03C4\u03BF\u03BD 8 \u03C7\u03B1\u03C1\u03B1\u03BA\u03C4\u03AE\u03C1\u03B5\u03C2\n- \u03C4\u03BF\u03C5\u03BB\u03AC\u03C7\u03B9\u03C3\u03C4\u03BF\u03BD \u03AD\u03BD\u03B1\u03BD \u03B1\u03C1\u03B9\u03B8\u03BC\u03CC (0-9)\n- \u03C4\u03BF\u03C5\u03BB\u03AC\u03C7\u03B9\u03C3\u03C4\u03BF\u03BD \u03AD\u03BD\u03B1 \u03BC\u03B7 \u03BA\u03B1\u03BD\u03BF\u03BD\u03B9\u03BA\u03CC \u03C7\u03B1\u03C1\u03B1\u03BA\u03C4\u03AE\u03C1\u03B1 (\!|@|\#|$|%|^|&|*|(|)|_|+|||~|-|
+Detail=\u039B\u03B5\u03C0\u03C4\u03BF\u03BC\u03AD\u03C1\u03B5\u03B9\u03B1
+Details=\u039B\u03B5\u03C0\u03C4\u03BF\u03BC\u03AD\u03C1\u03B5\u03B9\u03B5\u03C2
+EmailFrom=\u0391\u03C0\u03CC
+EmailSubject=\u0398\u03AD\u03BC\u03B1
+EmailTo=\u03A0\u03C1\u03BF\u03C2
+Enabled=\u0395\u03BD\u03B5\u03C1\u03B3\u03BF\u03C0\u03BF\u03B9\u03AE\u03B8\u03B7\u03BA\u03B5
+Error=\u03A3\u03C6\u03AC\u03BB\u03BC\u03B1
+ErrorAndRetryTextDefault=\u0388\u03BD\u03B1 \u03C3\u03C6\u03AC\u03BB\u03BC\u03B1 \u03B5\u03BC\u03C6\u03B1\u03BD\u03AF\u03C3\u03C4\u03B7\u03BA\u03B5 \u03BA\u03B1\u03C4\u03AC \u03C4\u03B7\u03BD \u03B4\u03B9\u03AC\u03C1\u03BA\u03B5\u03B9\u03B1 \u03C4\u03B7\u03C2 \u03BC\u03B5\u03C4\u03B1\u03C6\u03BF\u03C1\u03AC\u03C2.
+ErrorTextLogin=\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF \u03CC\u03BD\u03BF\u03BC\u03B1 \u03C7\u03C1\u03AE\u03C3\u03C4\u03B7/\u03BA\u03C9\u03B4\u03B9\u03BA\u03CC\u03C2
+ErrorTitleLogin=\u0391\u03C0\u03BF\u03C4\u03C5\u03C7\u03AE \u03C3\u03CD\u03BD\u03B4\u03B5\u03C3\u03B7
+ExcelChart_Button_LoadDefaults=\u03A0\u03C1\u03BF\u03B5\u03C0\u03B9\u03BB\u03BF\u03B3\u03AD\u03C2
+ExcelChart_Button_LoadDefaultsHint=\u0395\u03C0\u03B1\u03BD\u03B1\u03C6\u03AD\u03C1\u03B5\u03B9 \u03B1\u03C5\u03C4\u03CC \u03C4\u03BF \u03B4\u03B9\u03B1\u03BB\u03CC\u03BB\u03BF \u03B5\u03C0\u03B9\u03BA\u03BF\u03B9\u03BD\u03C9\u03BD\u03AF\u03B1\u03C2 \u03C6\u03BF\u03C1\u03C4\u03CE\u03BD\u03BF\u03BD\u03C4\u03B1\u03C2 \u03C4\u03B9\u03C2 \u03C0\u03C1\u03BF\u03B5\u03C0\u03B9\u03BB\u03B5\u03B3\u03BC\u03AD\u03BD\u03B5\u03C2 \u03C4\u03B9\u03BC\u03AD\u03C2.
+ExcelChart_Button_LoadProfile=\u03A6\u03CC\u03C1\u03C4\u03C9\u03C3\u03B7 \u03C0\u03C1\u03BF\u03C6\u03AF\u03BB...
+ExcelChart_Button_LoadProfileHint=\u03A6\u03BF\u03C1\u03C4\u03CE\u03BD\u03B5\u03B9 \u03C4\u03B9\u03C2 \u03C1\u03C5\u03B8\u03BC\u03AF\u03C3\u03B5\u03B9\u03C2 \u03B1\u03C0\u03CC \u03AD\u03BD\u03B1 \u03B1\u03C1\u03C7\u03B5\u03AF\u03BF XML.
+ExcelChart_Button_SaveProfile=\u0391\u03C0\u03BF\u03B8\u03AE\u03BA\u03B5\u03C5\u03C3\u03B7 \u03C0\u03C1\u03BF\u03C6\u03AF\u03BB...
+ExcelChart_Button_SaveProfileHint=\u0391\u03C0\u03BF\u03B8\u03B7\u03BA\u03B5\u03CD\u03B5\u03B9 \u03C4\u03B9\u03C2 \u03C4\u03C1\u03AD\u03C7\u03BF\u03C5\u03C3\u03B5\u03C2 \u03C1\u03C5\u03B8\u03BC\u03AF\u03C3\u03B5\u03B9\u03C2 \u03C3\u03B5 \u03AD\u03BD\u03B1 \u03B1\u03C1\u03C7\u03B5\u03AF\u03BF XML.
+ExcelChart_Error_CreatingChartFailed=\u03B1\u03C0\u03BF\u03C4\u03C5\u03C7\u03AF\u03B1 \u03B4\u03B7\u03BC\u03B9\u03BF\u03C5\u03C1\u03B3\u03AF\u03B1\u03C2 \u03B3\u03C1\u03B1\u03C6\u03AE\u03BC\u03B1\u03C4\u03BF\u03C2.
+ExcelChart_Error_ExportingFailed=\u0397 \u03B5\u03BE\u03B1\u03B3\u03C9\u03B3\u03AE \u03B4\u03B5\u03B4\u03BF\u03BC\u03AD\u03BD\u03C9\u03BD \u03B1\u03C0\u03BF\u03C4\u03C5\u03B3\u03C7\u03AC\u03BD\u03B5\u03B9 \u03B4\u03B9\u03CC\u03C4\u03B9
+ExcelChart_Error_InitializationFailed=\u03B1\u03C0\u03BF\u03C4\u03C5\u03C7\u03AF\u03B1 \u03B5\u03BA\u03BA\u03AF\u03BD\u03B7\u03C3\u03B7\u03C2 \u03C4\u03C9\u03BD \u03BA\u03B1\u03C4\u03B7\u03B3\u03BF\u03C1\u03B9\u03CE\u03BD \u03C5\u03C0\u03BF\u03C3\u03C4\u03AE\u03C1\u03B9\u03BE\u03B7\u03C2.
+ExcelChart_Error_LoadingProfileFailed=\u0397 \u03C6\u03CC\u03C1\u03C4\u03C9\u03C3\u03B7 \u03C4\u03BF\u03C5 \u03C0\u03C1\u03BF\u03C6\u03AF\u03BB \u03B1\u03C0\u03AD\u03C4\u03C5\u03C7\u03B5 \u03B4\u03B9\u03CC\u03C4\u03B9
+ExcelChart_Error_LoadingTemplateFailed=\u03B1\u03C0\u03BF\u03C4\u03C5\u03C7\u03AF\u03B1 \u03C6\u03CC\u03C1\u03C4\u03C9\u03C3\u03B7\u03C2 \u03A0\u03C1\u03BF\u03C4\u03CD\u03C0\u03BF\u03C5.
+ExcelChart_Error_RetrivingOutlineDataFailed=\u03B1\u03C0\u03BF\u03C4\u03C5\u03C7\u03AF\u03B1 \u03B1\u03BD\u03AC\u03BA\u03C4\u03B7\u03C3\u03B7\u03C2 \u03C0\u03B5\u03C1\u03AF\u03B3\u03C1\u03B1\u03BC\u03BC\u03B1 \u03B4\u03B5\u03B4\u03BF\u03BC\u03AD\u03BD\u03C9\u03BD.
+ExcelChart_Error_SavingProfileFailed=\u0391\u03C0\u03BF\u03C4\u03C5\u03C7\u03AF\u03B1 \u03B1\u03C0\u03BF\u03B8\u03AE\u03BA\u03B5\u03C5\u03C3\u03B7\u03C2 \u03C4\u03BF\u03C5 \u03A0\u03C1\u03BF\u03C6\u03AF\u03BB \u03B4\u03B9\u03CC\u03C4\u03B9
+ExcelChart_Error_WrongProfile=\u03C4\u03BF \u03C0\u03C1\u03BF\u03C6\u03AF\u03BB \u03B4\u03B7\u03BC\u03B9\u03BF\u03C5\u03C1\u03B3\u03B5\u03AF\u03C4\u03B1\u03B9 \u03B3\u03B9\u03B1 \u03AD\u03BD\u03B1 \u03AC\u03BB\u03BB\u03BF \u03C0\u03B5\u03C1\u03AF\u03B3\u03C1\u03B1\u03BC\u03BC\u03B1.
+ExcelChart_Label_AutomaticMode=\u0391\u03C5\u03C4\u03CC\u03BC\u03B1\u03C4\u03B7 \u03BA\u03B1\u03C4\u03AC\u03C3\u03C4\u03B1\u03C3\u03B7
+ExcelChart_Label_AutomaticModeHint=\u0391\u03C0\u03CC\u03BA\u03C1\u03C5\u03C8\u03B7 \u03C4\u03BF\u03C5 Excel \u03BA\u03B1\u03B9 \u03B1\u03C5\u03C4\u03CC\u03BC\u03B1\u03C4\u03B7 \u03B1\u03C0\u03BF\u03B8\u03AE\u03BA\u03B5\u03C5\u03C3\u03B7.
+ExcelChart_Label_ChartNumber=\u0391\u03C1\u03B9\u03B8\u03BC\u03CC\u03C2 \u03B3\u03C1\u03B1\u03C6\u03AE\u03BC\u03B1\u03C4\u03BF\u03C2.
+ExcelChart_Label_ChartType=\u03A4\u03CD\u03C0\u03BF\u03C2 \u03B3\u03C1\u03B1\u03C6\u03AE\u03BC\u03B1\u03C4\u03BF\u03C2
+ExcelChart_Label_FileName=\u038C\u03BD\u03BF\u03BC\u03B1 \u03B1\u03C1\u03C7\u03B5\u03AF\u03BF\u03C5
+ExcelChart_Label_FirstRow=\u03A0\u03C1\u03CE\u03C4\u03B7 \u03B3\u03C1\u03B1\u03BC\u03BC\u03AE
+ExcelChart_Label_Height=\u038E\u03C8\u03BF\u03C2
+ExcelChart_Label_HistogramMode=\u03A4\u03CD\u03C0\u03BF\u03C2 \u03B9\u03C3\u03C4\u03BF\u03B3\u03C1\u03AC\u03BC\u03BC\u03B1\u03C4\u03BF\u03C2
+ExcelChart_Label_HistogramModeHint=\u0397 \u03BA\u03B1\u03C4\u03AC\u03C3\u03C4\u03B1\u03C3\u03B7 \u03B9\u03C3\u03C4\u03BF\u03B3\u03C1\u03AC\u03BC\u03BC\u03B1\u03C4\u03BF\u03C2 \u03C3\u03C5\u03BD\u03B4\u03B9\u03AC\u03B6\u03B5\u03B9 \u03B5\u03C0\u03B1\u03BA\u03C1\u03AF\u03B2\u03CE\u03C2 \u03C4\u03B9\u03BC\u03AD\u03C2 \u03BA\u03B1\u03C4\u03AC \u03C4\u03BF\u03BD \u03AC\u03BE\u03BF\u03BD\u03B1 \u03A7-\u03A7\u2019.
+ExcelChart_Label_LastRow=\u03A4\u03B5\u03BB\u03B5\u03C5\u03C4\u03B1\u03AF\u03B1 \u03B3\u03C1\u03B1\u03BC\u03BC\u03AE
+ExcelChart_Label_Offset=\u0398\u03AD\u03C3\u03B7
+ExcelChart_Label_SkipNullValues=\u03A0\u03B1\u03C1\u03B1\u03BB\u03B5\u03AF\u03C8\u03C4\u03B5 \u03C4\u03B9\u03C2 \u03BC\u03B7\u03B4\u03B5\u03BD\u03B9\u03BA\u03AD\u03C2 \u03C4\u03B9\u03BC\u03AD\u03C2 \u03C3\u03C4\u03BF\u03BD \u03C4\u03CD\u03C0\u03BF \u03B9\u03C3\u03C4\u03BF\u03B3\u03C1\u03AC\u03BC\u03BC\u03B1\u03C4\u03BF\u03C2
+ExcelChart_Label_SkipNullValuesHint=\u0395\u03AC\u03BD \u03B5\u03BB\u03AD\u03B3\u03C7\u03BF\u03BD\u03C4\u03B1\u03B9 \u03BC\u03B7\u03B4\u03B5\u03BD\u03B9\u03BA\u03AD\u03C2 \u03C4\u03B9\u03BC\u03AD\u03C2 \u03C3\u03C4\u03BF \u03AC\u03BE\u03BF\u03BD\u03B1 \u03A7-\u03A7\u0384 \u03B1\u03C5\u03C4\u03AD\u03C2 \u03C0\u03B1\u03C1\u03B1\u03BB\u03B5\u03AF\u03C0\u03BF\u03BD\u03C4\u03B1\u03B9, \u03B4\u03B9\u03B1\u03C6\u03BF\u03C1\u03B5\u03C4\u03B9\u03BA\u03AC \u03C3\u03C5\u03BD\u03B4\u03C5\u03AC\u03B6\u03BF\u03BD\u03C4\u03B1\u03B9 \u03BC\u03B5 <\u0386\u03B3\u03BD\u03C9\u03C3\u03C4\u03BF\u03C2>.
+ExcelChart_Label_TemplateName=\u03A0\u03C1\u03CC\u03C4\u03C5\u03C0\u03BF
+ExcelChart_Label_UseCustomFormat=\u03A7\u03C1\u03B7\u03C3\u03B9\u03BC\u03BF\u03C0\u03BF\u03B9\u03B5\u03AF\u03C3\u03C4\u03B5 \u03C0\u03C1\u03BF\u03C3\u03B1\u03C1\u03BC\u03BF\u03C3\u03BC\u03AD\u03BD\u03B7 \u03BC\u03BF\u03C1\u03C6\u03BF\u03C0\u03BF\u03AF\u03B7\u03C3\u03B7
+ExcelChart_Label_UseCustomFormatHint=\u0395\u03AC\u03BD \u03B5\u03C0\u03B1\u03BB\u03B7\u03B8\u03B5\u03C5\u03B8\u03B5\u03AF, \u03BC\u03C0\u03BF\u03C1\u03B5\u03AF\u03C4\u03B5 \u03BD\u03B1 \u03C5\u03C0\u03BF\u03B4\u03B5\u03AF\u03BE\u03B5\u03C4\u03B5 \u03C4\u03B7 \u03B8\u03AD\u03C3\u03B7 \u03BA\u03B1\u03B9 \u03C4\u03BF \u03BC\u03AD\u03B3\u03B5\u03B8\u03BF\u03C2 \u03C4\u03BF\u03C5 \u03B3\u03C1\u03B1\u03C6\u03AE\u03BC\u03B1\u03C4\u03BF\u03C2.
+ExcelChart_Label_UseExistingChart=\u03A7\u03C1\u03B7\u03C3\u03B9\u03BC\u03C0\u03BF\u03B9\u03B5\u03AF\u03C3\u03C4\u03B5 \u03C5\u03C0\u03AC\u03C1\u03C7\u03BF\u03BD\u03C4\u03B1 \u03B3\u03C1\u03B1\u03C6\u03AE\u03BC\u03B1\u03C4\u03B1
+ExcelChart_Label_UseExistingChartHint=\u0395\u03AC\u03BD \u03B5\u03C0\u03B1\u03BB\u03B7\u03B8\u03B5\u03C5\u03B8\u03B5\u03AF, \u03C7\u03C1\u03B7\u03C3\u03B9\u03BC\u03BF\u03C0\u03BF\u03B9\u03BF\u03CD\u03BD\u03C4\u03B1\u03B9 \u03C4\u03B1 \u03C5\u03C0\u03AC\u03C1\u03C7\u03BF\u03BD\u03C4\u03B1 \u03B3\u03C1\u03B1\u03C6\u03AE\u03BC\u03B1\u03C4\u03B1 \u03BC\u03B5 \u03C4\u03B1 \u03B5\u03BD\u03B4\u03B5\u03B9\u03BA\u03BD\u03C5\u03CC\u03BC\u03B5\u03BD\u03B1 \u03C0\u03C1\u03CC\u03C4\u03C5\u03C0\u03B1.
+ExcelChart_Label_UseSelectiveExport=\u03A7\u03C1\u03B7\u03C3\u03B9\u03BC\u03BF\u03C0\u03BF\u03B9\u03B5\u03AF\u03C3\u03C4\u03B5 \u03B5\u03C0\u03B9\u03BB\u03B5\u03BA\u03C4\u03B9\u03BA\u03AC \u03B5\u03BE\u03B1\u03B3\u03CE\u03BC\u03B5\u03BD\u03B1
+ExcelChart_Label_UseSelectiveExportHint=\u0395\u03AC\u03BD \u03B5\u03C0\u03B1\u03BB\u03B7\u03B8\u03B5\u03C5\u03C4\u03B5\u03AF, \u03B5\u03BE\u03AC\u03B3\u03BF\u03BD\u03C4\u03B1\u03B9 \u03BC\u03CC\u03BD\u03BF \u03BF\u03B9 \u03C5\u03C0\u03AC\u03C1\u03C7\u03BF\u03C5\u03C3\u03B5\u03C2 \u03B3\u03C1\u03B1\u03BC\u03BC\u03AD\u03C2 \u03C0\u03B1\u03C1\u03B1\u03BA\u03AC\u03C4\u03C9.
+ExcelChart_Label_Width=\u03A0\u03BB\u03AC\u03C4\u03BF\u03C2
+ExcelChart_Label_WorksheetName=\u03A6\u03CD\u03BB\u03BB\u03BF \u0395\u03C1\u03B3\u03B1\u03C3\u03AF\u03B1\u03C2
+ExcelChart_Label_XAxis=\u0386\u03BE\u03BF\u03BD\u03B1 \u03A7
+ExcelChart_Label_YAxes=\u0386\u03BE\u03BF\u03BD\u03B1\u03C2 \u03A8
+ExcelChart_Status_Done=\u03A0\u03C1\u03B1\u03B3\u03BC\u03B1\u03C4\u03BF\u03C0\u03BF\u03B9\u03B5\u03AF\u03C4\u03B1\u03B9 \u03C4\u03BF \u03B3\u03C1\u03AC\u03C6\u03B7\u03BC\u03B1 \u03B5\u03BE\u03B1\u03B3\u03C9\u03B3\u03AE\u03C2 \u03C4\u03BF\u03C5 Excel
+ExcelChart_Tab_Advanced=\u03A0\u03C1\u03BF\u03B7\u03B3\u03BC\u03AD\u03BD\u03BF
+ExcelChart_Tab_Basic=\u0392\u03B1\u03C3\u03B9\u03BA\u03CC
+ExcelChart_Title_MainForm=\u0395\u03BE\u03B1\u03B3\u03C9\u03B3\u03AE \u03B3\u03C1\u03B1\u03C6\u03AE\u03BC\u03B1\u03C4\u03BF\u03C2 Excel
+ExcelChart_Type_Area3D=3D \u03A0\u03B5\u03C1\u03B9\u03BF\u03C7\u03AE
+ExcelChart_Type_Area=\u03A0\u03B5\u03C1\u03B9\u03BF\u03C7\u03AE
+ExcelChart_Type_AreaStacked3D=3D \u0391\u03B8\u03C1\u03BF\u03B9\u03C3\u03C4\u03B9\u03BA\u03AE \u03A0\u03B5\u03C1\u03B9\u03BF\u03C7\u03AE
+ExcelChart_Type_AreaStacked=\u0391\u03B8\u03C1\u03BF\u03B9\u03C3\u03C4\u03B9\u03BA\u03AE \u03A0\u03B5\u03C1\u03B9\u03BF\u03C7\u03AE
+ExcelChart_Type_BarsClustered3D=\u039F\u03BC\u03BF\u03B5\u03B9\u03B4\u03B5\u03AF\u03C2 3D \u03A1\u03AC\u03B2\u03B4\u03BF\u03B9
+ExcelChart_Type_BarsClustered=\u039F\u03BC\u03BF\u03B5\u03B9\u03B4\u03B5\u03AF\u03C2 \u03A1\u03AC\u03B2\u03B4\u03BF\u03B9
+ExcelChart_Type_BarsStacked3D=\u0391\u03B8\u03C1\u03BF\u03B9\u03C3\u03C4\u03B9\u03BA\u03AD\u03C2 3D \u03A1\u03AC\u03B2\u03B4\u03BF\u03B9
+ExcelChart_Type_BarsStacked=\u0391\u03B8\u03C1\u03BF\u03B9\u03C3\u03C4\u03B9\u03BA\u03AD\u03C2 \u03A1\u03AC\u03B2\u03B4\u03BF\u03B9
+ExcelChart_Type_ColumnsClustered3D=\u039F\u03BC\u03BF\u03B5\u03B9\u03B4\u03B5\u03AF\u03C2 3D \u03A3\u03C4\u03AE\u03BB\u03B5\u03C2
+ExcelChart_Type_ColumnsClustered=\u039F\u03BC\u03BF\u03B5\u03B9\u03B4\u03B5\u03AF\u03C2 \u03A3\u03C4\u03AE\u03BB\u03B5\u03C2
+ExcelChart_Type_ColumnsStacked3D=\u0391\u03B8\u03C1\u03BF\u03B9\u03C3\u03C4\u03B9\u03BA\u03AD\u03C2 3D \u03A3\u03C4\u03AE\u03BB\u03B5\u03C2
+ExcelChart_Type_ColumnsStacked=\u0391\u03B8\u03C1\u03BF\u03B9\u03C3\u03C4\u03B9\u03BA\u03AD\u03C2 \u03A3\u03C4\u03AE\u03BB\u03B5\u03C2
+ExcelChart_Type_Line=\u0393\u03C1\u03B1\u03BC\u03BC\u03AD\u03C2
+ExcelChart_Type_LineStacked=\u0391\u03B8\u03C1\u03BF\u03B9\u03C3\u03C4\u03B9\u03BA\u03AD\u03C2 \u0393\u03C1\u03B1\u03BC\u03BC\u03AD\u03C2
+ExcelChart_Type_Pie3D=3D \u03A0\u03AF\u03C4\u03B1
+ExcelChart_Type_Pie=\u03A0\u03AF\u03C4\u03B1
+ExcelChart_Type_PieExploded3D=3D \u0391\u03BD\u03AC\u03C0\u03C4\u03C5\u03B3\u03BC\u03B1 \u03A0\u03AF\u03C4\u03B1\u03C2
+ExcelChart_Type_PieExploded=\u0391\u03BD\u03AC\u03C0\u03C4\u03C5\u03B3\u03BC\u03B1 \u03A0\u03AF\u03C4\u03B1\u03C2
+ExcelChart_Various_Averaged=\u03A3\u03C4\u03C1\u03BF\u03B3\u03B3\u03C5\u03BB\u03B5\u03BC\u03AD\u03BD\u03BF\u03C2 \u03C3\u03B5 \u03BC\u03AD\u03C3\u03BF \u03CC\u03C1\u03BF
+ExcelChart_Various_Column=\u03A3\u03C4\u03AE\u03BB\u03B7
+ExcelChart_Various_Frequency=\u03A3\u03C5\u03C7\u03BD\u03CC\u03C4\u03B7\u03C4\u03B1
+ExcelChart_Various_SummedUp=\u03A3\u03CD\u03BD\u03BF\u03BB\u03BF
+ExcelChart_Various_Unknown=<\u0386\u03B3\u03BD\u03C9\u03C3\u03C4\u03BF\u03C2>
+ExportDate=\u03A0\u03B1\u03C1\u03BF\u03C5\u03C3\u03AF\u03B1\u03C3\u03B7 \u03B4\u03B5\u03B4\u03BF\u03BC\u03AD\u03BD\u03C9\u03BD
+ExtendedSearchAddAttributeMenu=\u03A0\u03C1\u03BF\u03C3\u03B8\u03AD\u03C3\u03C4\u03B5 \u03C0\u03B5\u03C1\u03B9\u03BF\u03C1\u03B9\u03C3\u03BC\u03BF\u03CD\u03C2
+ExtendedSearchAddEntityPrefix=\u03AD\u03C7\u03B5\u03B9
+ExtendedSearchAnd=\u03BA\u03B1\u03B9
+ExtendedSearchEditAttributeMenu=\u0395\u03C0\u03B5\u03BE\u03B5\u03C1\u03B3\u03B1\u03C3\u03AF\u03B1...
+ExtendedSearchEntitySuffix=\u03BC\u03B5
+ExtendedSearchNegateMenu=\u0386\u03C1\u03BD\u03B7\u03C3\u03B7
+ExtendedSearchRemoveAttributeMenu=\u039A\u03B1\u03C4\u03AC\u03C1\u03B3\u03B7\u03C3\u03B5
+ExtendedSearchRemoveMenu=\u039A\u03B1\u03C4\u03AC\u03C1\u03B3\u03B7\u03C3\u03B7
+FileExistsOwerwriteQuestion=\u03A4\u03BF \u03B5\u03C0\u03B9\u03BB\u03B5\u03B3\u03BC\u03AD\u03BD\u03BF \u03B1\u03C1\u03C7\u03B5\u03AF\u03BF \u03C0\u03C1\u03BF\u03CB\u03C0\u03AC\u03C1\u03C7\u03B5\u03B9. \u0395\u03C0\u03B1\u03BD\u03B1\u03B3\u03C1\u03AC\u03C8\u03C4\u03B5 \u03B1\u03C5\u03C4\u03CC \u03C4\u03BF \u03B1\u03C1\u03C7\u03B5\u03AF\u03BF;
+FileName=\u038C\u03BD\u03BF\u03BC\u03B1 \u03B1\u03C1\u03C7\u03B5\u03AF\u03BF\u03C5
+FileNotFoundExceptionMessage=\u0394\u03B5\u03BD \u03B5\u03AF\u03BD\u03B1\u03B9 \u03B4\u03C5\u03BD\u03B1\u03C4\u03AE \u03B7 \u03B5\u03CD\u03C1\u03B5\u03C3\u03B7 \u03AE \u03B7 \u03C0\u03C1\u03BF\u03C3\u03C0\u03AD\u03BB\u03B1\u03C3\u03B7 \u03C4\u03BF\u03C5 \u03B1\u03C1\u03C7\u03B5\u03AF\u03BF\u03C5
+FileNotFoundMessage=\u0394\u03B5\u03BD \u03B5\u03C5\u03C1\u03AD\u03B8\u03B7 \u03C4\u03BF \u03B1\u03C1\u03C7\u03B5\u03AF\u03BF\:
+FileNotFoundTitle=\u03A4\u03BF \u03B1\u03C1\u03C7\u03B5\u03AF\u03BF \u03B4\u03B5\u03BD \u03B5\u03C5\u03C1\u03AD\u03B8\u03B7
+FilesOfType=\u0395\u03AF\u03B4\u03BF\u03C2 \u03B1\u03C1\u03C7\u03B5\u03AF\u03BF\u03C5
+FormClosing=\u039A\u03BB\u03B5\u03AF\u03C3\u03B9\u03BC\u03BF
+FormPrint=\u0395\u03BA\u03C4\u03CD\u03C0\u03C9\u03C3\u03B7
+FormSaveChangesQuestion=\u0398\u03AD\u03BB\u03B5\u03C4\u03B5 \u03BD\u03B1 \u03B1\u03C0\u03BF\u03B8\u03B7\u03BA\u03B5\u03C5\u03C4\u03BF\u03CD\u03BD \u03BF\u03B9 \u03B1\u03BB\u03BB\u03B1\u03B3\u03AD\u03C2;
+FormStateLoad=\u03A6\u03CC\u03C1\u03C4\u03C9\u03C3\u03B5...
+FormStateStore=\u0391\u03C0\u03BF\u03B8\u03AE\u03BA\u03B5\u03C5\u03C3\u03B7
+FormStateStoreAs=\u0391\u03C0\u03BF\u03B8\u03AE\u03BA\u03B5\u03C5\u03C3\u03B7 \u03C9\u03C2...
+GlobalBookmarks=\u03A0\u03B1\u03B3\u03BA\u03CC\u03C3\u03BC\u03B9\u03BF \u03A3\u03B5\u03BB\u03B9\u03B4\u03BF\u03B4\u03B5\u03AF\u03BA\u03C4\u03B7\u03C2
+GlobalBookmarksAddMenu=\u03A0\u03C1\u03BF\u03C3\u03B8\u03AD\u03C3\u03C4\u03B5 \u03C3\u03C4o\u03BF\u03C5\u03C2 &\u03C0\u03B1\u03B3\u03BA\u03CC\u03C3\u03BC\u03B9\u03BF\u03C5\u03C2 \u03C3\u03B5\u03BB\u03B9\u03B4\u03BF\u03B4\u03B5\u03AF\u03BA\u03C4\u03B5\u03C2
+Help=\u0392\u03BF\u03AE\u03B8\u03B5\u03B9\u03B1
+Host=\u03A5\u03C0\u03BF\u03BB\u03BF\u03B3\u03B9\u03C3\u03C4\u03AE\u03C2 \u03C5\u03C0\u03B7\u03C1\u03B5\u03C3\u03AF\u03B1\u03C2
+IOErrorInfo=\u03A0\u03B1\u03C1\u03B1\u03BA\u03B1\u03BB\u03BF\u03CD\u03BC\u03B5 \u03B5\u03BB\u03AD\u03B3\u03BE\u03C4\u03B5 \u03B1\u03C1\u03C7\u03B5\u03AF\u03B1 \u03BA\u03B1\u03B9 \u03C3\u03CD\u03BD\u03B4\u03B5\u03C3\u03B7
+IOErrorText=\u03A3\u03C6\u03AC\u03BB\u03BC\u03B1 \u0395\u03C0\u03B9\u03BA\u03BF\u03B9\u03BD\u03C9\u03BD\u03AF\u03B1\u03C2
+IOErrorTitle=\u03A3\u03C6\u03AC\u03BB\u03BC\u03B1 \u0391\u03BD\u03AC\u03B3\u03BD\u03C9\u03C3\u03B7\u03C2/ \u0395\u03B3\u03B3\u03C1\u03B1\u03C6\u03AE\u03C2
+InactiveState=\u03B1\u03BD\u03B5\u03BD\u03B5\u03C1\u03B3\u03CC
+InactiveStates=\u0391\u03BD\u03B5\u03BD\u03B5\u03C1\u03B3\u03CC
+Info=\u03A0\u03BB\u03B7\u03C1\u03BF\u03C6\u03BF\u03C1\u03AF\u03B5\u03C2
+Interrupted=\u0394\u03B9\u03B1\u03BA\u03CC\u03C0\u03B7\u03BA\u03B5
+InterruptedErrorText=\u0397 \u03B4\u03B9\u03B1\u03B4\u03B9\u03BA\u03B1\u03C3\u03AF\u03B1 \u03AD\u03C7\u03B5\u03B9 \u03B1\u03BA\u03C5\u03C1\u03C9\u03B8\u03B5\u03AF \u03BC\u03B5 \u03C4\u03BF \u03C7\u03AD\u03C1\u03B9
+InterruptedErrorTitle=\u0391\u03BA\u03C5\u03C1\u03CE\u03BD\u03B5\u03C4\u03B1\u03B9 \u03B7 \u03B4\u03B9\u03B1\u03B4\u03B9\u03BA\u03B1\u03C3\u03AF\u03B1
+JavaVMVersion=Java VM
+Language=\u0393\u03BB\u03CE\u03C3\u03C3\u03B1
+Live=Live
+LoadFormXmlFailedText=\u0391\u03C5\u03C4\u03CC \u03C4\u03BF \u03B1\u03C1\u03C7\u03B5\u03AF\u03BF \u03B4\u03B5\u03BD \u03B5\u03AF\u03BD\u03B1\u03B9 \u03C3\u03C5\u03BC\u03B2\u03B1\u03C4\u03CC \u03BC\u03B5 \u03B1\u03C5\u03C4\u03CC\u03BD \u03C4\u03BF \u03B4\u03B9\u03AC\u03BB\u03BF\u03B3\u03BF
+LogicDateIsInDays=\u03B5\u03AF\u03BD\u03B1\u03B9 \u03B1\u03BA\u03C1\u03B9\u03B2\u03CE\u03C2 \u03C3\u03B5 (\u03B7\u03BC\u03AD\u03C1\u03B5\u03C2)
+LogicDateIsInGEDays=\u03B5\u03AF\u03BD\u03B1\u03B9 \u03BD\u03C9\u03C1\u03AF\u03C4\u03B5\u03C1\u03B1 \u03C3\u03B5 (\u03B7\u03BC\u03AD\u03C1\u03B5\u03C2)
+LogicDateIsInGEMonths=\u03B5\u03AF\u03BD\u03B1\u03B9 \u03BD\u03C9\u03C1\u03AF\u03C4\u03B5\u03C1\u03B1 \u03C3\u03B5 (\u03BC\u03AE\u03BD\u03B5\u03C2)
+LogicDateIsInLEDays=\u03B5\u03AF\u03BD\u03B1\u03B9 \u03B1\u03C1\u03B3\u03CC\u03C4\u03B5\u03C1\u03B1 \u03C3\u03B5 (\u03B7\u03BC\u03AD\u03C1\u03B5\u03C2)
+LogicDateIsInLEMonths=\u03B5\u03AF\u03BD\u03B1\u03B9 \u03B1\u03C1\u03B3\u03CC\u03C4\u03B5\u03C1\u03B1 \u03C3\u03B5 (\u03B5\u03B2\u03B4\u03BF\u03BC\u03AC\u03B4\u03B5\u03C2)
+LogicDateIsInLastDays=\u03AE\u03C4\u03B1\u03BD \u03C4\u03B9\u03C2 \u03C4\u03B5\u03BB\u03B5\u03C5\u03C4\u03B1\u03AF\u03B5\u03C2 \u03BD \u03BC\u03AD\u03C1\u03B5\u03C2
+LogicDateIsInLastMonths=\u03AE\u03C4\u03B1\u03BD \u03C4\u03BF\u03C5\u03C2 \u03C4\u03B5\u03BB\u03B5\u03C5\u03C4\u03B1\u03AF\u03BF\u03C5\u03C2 \u03BD \u039C\u03AE\u03BD\u03B5\u03C2
+LogicDateIsInMonths=\u03B5\u03AF\u03BD\u03B1\u03B9 \u03B1\u03BA\u03C1\u03B9\u03B2\u03CE\u03C2 \u03C3\u03B5 (\u03BC\u03AE\u03BD\u03B5\u03C2)
+LogicDateIsInNextDays=\u03AE\u03C4\u03B1\u03BD \u03C4\u03B9\u03C2 \u03B5\u03C0\u03CC\u03BC\u03B5\u03BD\u03B5\u03C2 \u03BD \u03BC\u03AD\u03C1\u03B5\u03C2
+LogicDateIsInNextMonths=\u03AE\u03C4\u03B1\u03BD \u03C4\u03BF\u03C5\u03C2 \u03B5\u03C0\u03CC\u03BC\u03B5\u03BD\u03BF\u03C5\u03C2 \u03BD \u039C\u03AE\u03BD\u03B5\u03C2
+LogicDateIsNotToday=\u03B4\u03B5\u03BD \u03B5\u03AF\u03BD\u03B1\u03B9 \u03C3\u03AE\u03BC\u03B5\u03C1\u03B1
+LogicDateIsToday=\u03B5\u03AF\u03BD\u03B1\u03B9 \u03C3\u03AE\u03BC\u03B5\u03C1\u03B1
+LogicDateTimeIsInGEHours=\u03B5\u03AF\u03BD\u03B1\u03B9 \u03BD\u03C9\u03C1\u03AF\u03C4\u03B5\u03C1\u03B1 \u03C3\u03B5 (\u03B7\u03BC\u03AD\u03C1\u03B5\u03C2)
+LogicDateTimeIsInGEMinutes=\u03B5\u03AF\u03BD\u03B1\u03B9 \u03BD\u03C9\u03C1\u03AF\u03C4\u03B5\u03C1\u03B1 \u03C3\u03B5 (\u03BB\u03B5\u03C0\u03C4\u03AC)
+LogicDateTimeIsInLEHours=\u03B5\u03AF\u03BD\u03B1\u03B9 \u03B1\u03C1\u03B3\u03CC\u03C4\u03B5\u03C1\u03B1 \u03C3\u03B5 (\u03CE\u03C1\u03B5\u03C2)
+LogicDateTimeIsInLEMinutes=\u03B5\u03AF\u03BD\u03B1\u03B9 \u03B1\u03C1\u03B3\u03CC\u03C4\u03B5\u03C1\u03B1 \u03C3\u03B5 (\u03BB\u03B5\u03C0\u03C4\u03AC)
+LogicDateTimeIsNotNow=\u03B4\u03B5\u03BD \u03B5\u03AF\u03BD\u03B1\u03B9 \u03C4\u03CE\u03C1\u03B1
+LogicDateTimeIsNow=\u03B5\u03AF\u03BD\u03B1\u03B9 \u03C4\u03CE\u03C1\u03B1
+LogicEQ=\=
+LogicEndsWith=\u03C4\u03B5\u03BB\u03B5\u03B9\u03CE\u03BD\u03B5\u03B9 \u03BC\u03B5
+LogicGE=>\=
+LogicGT=>
+LogicIn=\u03B5\u03AF\u03BD\u03B1\u03B9
+LogicLE=<\=
+LogicLT=<
+LogicLike=\u03C0\u03B5\u03C1\u03B9\u03AD\u03C7\u03B5\u03B9
+LogicNEQ=<>
+LogicNotIn=\u03B4\u03B5\u03BD \u03B5\u03AF\u03BD\u03B1\u03B9
+LogicNotLike=\u03B4\u03B5\u03BD \u03C0\u03B5\u03C1\u03B9\u03AD\u03C7\u03B5\u03B9
+LogicNotNull=\u03B4\u03B5\u03BD \u03B5\u03AF\u03BD\u03B1\u03B9 \u03AC\u03B4\u03B5\u03B9\u03BF
+LogicNull=\u03B5\u03AF\u03BD\u03B1\u03B9 \u03AC\u03B4\u03B5\u03B9\u03BF
+LogicStartsWith=\u03B1\u03C1\u03C7\u03AF\u03B6\u03B5\u03B9 \u03BC\u03B5
+LogicTimeIsInGEHours=\u03B5\u03AF\u03BD\u03B1\u03B9 \u03BD\u03C9\u03C1\u03AF\u03C4\u03B5\u03C1\u03B1 \u03C3\u03B5 (\u03BB\u03B5\u03C0\u03C4\u03AC)
+LogicTimeIsInGEMinutes=\u03B5\u03AF\u03BD\u03B1\u03B9 \u03BD\u03C9\u03C1\u03AF\u03C4\u03B5\u03C1\u03B1 \u03C3\u03B5 (\u03CE\u03C1\u03B5\u03C2)
+LogicTimeIsInHours=\u03B5\u03AF\u03BD\u03B1\u03B9 \u03B1\u03BA\u03C1\u03B9\u03B2\u03CE\u03C2 \u03C3\u03B5 (\u03CE\u03C1\u03B5\u03C2)
+LogicTimeIsInLEHours=\u03B5\u03AF\u03BD\u03B1\u03B9 \u03B1\u03C1\u03B3\u03CC\u03C4\u03B5\u03C1\u03B1 \u03C3\u03B5 (\u03CE\u03C1\u03B5\u03C2)
+LogicTimeIsInLEMinutes=\u03B5\u03AF\u03BD\u03B1\u03B9 \u03B1\u03C1\u03B3\u03CC\u03C4\u03B5\u03C1\u03B1 \u03C3\u03B5 (\u03BB\u03B5\u03C0\u03C4\u03AC)
+LogicTimeIsInMinutes=\u03B5\u03AF\u03BD\u03B1\u03B9 \u03B1\u03BA\u03C1\u03B9\u03B2\u03CE\u03C2 \u03C3\u03B5 (\u03BB\u03B5\u03C0\u03C4\u03AC)
+LogicTimeIsNotNow=\u03B4\u03B5\u03BD \u03B5\u03AF\u03BD\u03B1\u03B9 \u03C4\u03CE\u03C1\u03B1
+LogicTimeIsNow=\u03B5\u03AF\u03BD\u03B1\u03B9 \u03C4\u03CE\u03C1\u03B1
+Login=\u03A3\u03CD\u03BD\u03B4\u03B5\u03C3\u03B7
+LookAndFeel=\u039A\u03BF\u03AF\u03C4\u03B1 \u03BA\u03B1\u03B9 \u03BD\u03B9\u03CE\u03C3\u03B5
+LookIn=\u0394\u03B9\u03B5\u03C1\u03B5\u03CD\u03BD\u03B7\u03C3\u03B7 \u03C3\u03B5
+Month=\u039C\u03AE\u03BD\u03B1\u03C2
+Name=\u038C\u03BD\u03BF\u03BC\u03B1
+NetErrorInfo=\u03A0\u03B1\u03C1\u03B1\u03BA\u03B1\u03BB\u03BF\u03CD\u03BC\u03B5 \u03B5\u03BB\u03AD\u03B3\u03BE\u03C4\u03B5 \u03CC\u03BD\u03BF\u03BC\u03B1 \u03B4\u03B9\u03B1\u03BA\u03BF\u03BC\u03B9\u03C3\u03C4\u03AE, URL \u03BA\u03B1\u03B9 \u03C3\u03CD\u03BD\u03B4\u03B5\u03C3\u03B7
+NetErrorText=\u0394\u03B5\u03BD \u03B2\u03C1\u03AD\u03B8\u03B7\u03BA\u03B5 \u03B4\u03B9\u03B1\u03BA\u03BF\u03BC\u03B9\u03C3\u03C4\u03AE\u03C2
+NetErrorTitle=\u03A3\u03C6\u03AC\u03BB\u03BC\u03B1 \u03B4\u03B9\u03BA\u03C4\u03CD\u03BF\u03C5
+NewPassword=\u039D\u03AD\u03BF\u03C2 \u039A\u03C9\u03B4\u03B9\u03BA\u03CC\u03C2 \u03A0\u03C1\u03CC\u03C3\u03B2\u03B1\u03C3\u03B7\u03C2
+No=\u038C\u03C7\u03B9
+NoButton=&\u038C\u03C7\u03B9 \u03C0\u03C1\u03BF\u03B2\u03BF\u03BB\u03AE \u03B5\u03BA\u03BA\u03AF\u03BD\u03B7\u03C3\u03B7\u03C2
+NumberOfRows=\u0395\u03B3\u03B3\u03C1\u03B1\u03C6\u03AD\u03C2
+OSUser=\u03A7\u03C1\u03AE\u03C3\u03C4\u03B7\u03C2 \u03A3\u03C5\u03C3\u03C4\u03AE\u03BC\u03B1\u03C4\u03BF\u03C2
+OSVersion=\u0388\u03BA\u03B4\u03BF\u03C3\u03B7 \u03A3\u03C5\u03C3\u03C4\u03AE\u03BC\u03B1\u03C4\u03BF\u03C2
+Ok=\u039F\u039A
+OkButton=\u039F\u039A
+OkButtonTooltip=\u0391\u03C0\u03BF\u03B8\u03B7\u03BA\u03B5\u03CD\u03C3\u03C4\u03B5 \u03BA\u03B1\u03B9 \u03BA\u03BB\u03B5\u03AF\u03C3\u03C4\u03B5 \u03C4\u03BF \u03C0\u03BB\u03B1\u03AF\u03C3\u03B9\u03BF \u03B4\u03B9\u03B1\u03BB\u03CC\u03B3\u03BF\u03C5
+OldPassword=\u0391\u03C0\u03B1\u03C1\u03C7\u03B1\u03B9\u03C9\u03BC\u03AD\u03BD\u03BF\u03C2 \u039A\u03C9\u03B4\u03B9\u03BA\u03CC\u03C2 \u03A0\u03C1\u03CC\u03C3\u03B2\u03B1\u03C3\u03B7\u03C2
+Op=\u03A7\u03B5\u03B9\u03C1\u03B9\u03C3\u03C4\u03AE\u03C2
+Open=\u0386\u03BD\u03BF\u03B9\u03BE\u03B5
+Password=\u039A\u03C9\u03B4\u03B9\u03BA\u03CC\u03C2
+PasswordsDoNotMatch=\u039F\u03B9 \u03B4\u03CD\u03BF \u03BA\u03C9\u03B4\u03B9\u03BA\u03BF\u03AF \u03C0\u03C1\u03CC\u03C3\u03B2\u03B1\u03C3\u03B7\u03C2 \u03B4\u03B5\u03BD \u03C4\u03B1\u03B9\u03C1\u03B9\u03AC\u03B6\u03BF\u03C5\u03BD.
+Paste=\u0395\u03C0\u03B9\u03BA\u03CC\u03BB\u03BB\u03B7\u03C3\u03B7
+Path=\u0394\u03B9\u03B1\u03B4\u03C1\u03BF\u03BC\u03AE
+Pending=\u03A0\u03B5\u03C1\u03B9\u03BC\u03AD\u03BD\u03B5\u03C4\u03B5...
+Properties=\u0399\u03B4\u03B9\u03CC\u03C4\u03B7\u03C4\u03B5\u03C2
+RepBuildExtract=\u03A0\u03C1\u03BF\u03B5\u03C4\u03BF\u03B9\u03BC\u03B1\u03C3\u03AF\u03B1 \u03B4\u03B5\u03B4\u03BF\u03BC\u03AD\u03BD\u03C9\u03BD
+RepExecAfter=\u039A\u03B1\u03B8\u03B1\u03C1\u03B9\u03C3\u03BC\u03CC\u03C2 \u03B2\u03AC\u03C3\u03B7\u03C2 \u03B4\u03B5\u03B4\u03BF\u03BC\u03AD\u03BD\u03C9\u03BD
+RepExecBefore=\u03A0\u03C1\u03BF\u03B5\u03C4\u03BF\u03B9\u03BC\u03B1\u03C3\u03AF\u03B1 \u03B2\u03AC\u03C3\u03B7\u03C2 \u03B4\u03B5\u03B4\u03BF\u03BC\u03AD\u03BD\u03C9\u03BD
+RepUpdate=\u0395\u03C0\u03B5\u03BE\u03B5\u03C1\u03B3\u03B1\u03C3\u03AF\u03B1 \u03B4\u03B5\u03B4\u03BF\u03BC\u03AD\u03BD\u03C9\u03BD...
+RepeatPassword=\u0395\u03C0\u03B1\u03BD\u03AC\u03BB\u03B7\u03C8\u03B7
+ResetButton=\u0395\u03C0\u03B1\u03BD\u03B1\u03C6\u03BF\u03C1\u03AC
+ResetButtonTooltip=\u0398\u03AD\u03C3\u03C4\u03B5 \u03CC\u03BB\u03B1 \u03C4\u03B1 \u03C0\u03BB\u03B1\u03AF\u03C3\u03B9\u03B1 \u03B4\u03B9\u03B1\u03BB\u03CC\u03B3\u03BF\u03C5 \u03C3\u03B5 \u03BA\u03B5\u03BD\u03AD\u03C2 \u03C4\u03B9\u03BC\u03AD\u03C2
+SC_Help_AddToDictionary=\u03A0\u03C1\u03BF\u03C3\u03B8\u03AD\u03C4\u03B5\u03B9 \u03C4\u03B7\u03BD \u03B1\u03BD\u03BF\u03C1\u03B8\u03CC\u03B3\u03C1\u03B1\u03C6\u03B7 \u03BB\u03AD\u03BE\u03B7 \u03C3\u03C4\u03BF \u03BB\u03B5\u03BE\u03B9\u03BA\u03CC
+SC_Help_Cancel=\u039A\u03BB\u03B5\u03AF\u03BD\u03B5\u03B9 \u03C4\u03BF \u03C0\u03B1\u03C1\u03AC\u03B8\u03C5\u03C1\u03BF \u03BA\u03B1\u03B9 \u03B1\u03C0\u03BF\u03C1\u03C1\u03AF\u03C0\u03C4\u03B5\u03B9 \u03CC\u03BB\u03B5\u03C2 \u03C4\u03B9\u03C2 \u03B1\u03BB\u03BB\u03B1\u03B3\u03AD\u03C2
+SC_Help_Change=\u0391\u03BB\u03BB\u03AC\u03B6\u03B5\u03B9 \u03C4\u03B7\u03BD \u03C4\u03C1\u03AD\u03C7\u03BF\u03C5\u03C3\u03B1 \u03B5\u03BC\u03C6\u03AC\u03BD\u03B9\u03C3\u03B7 \u03C4\u03B7\u03C2 \u03B1\u03BD\u03BF\u03C1\u03B8\u03CC\u03B3\u03C1\u03B1\u03C6\u03B7\u03C2 \u03BB\u03AD\u03BE\u03B7\u03C2
+SC_Help_ChangeAll=\u0391\u03BB\u03BB\u03AC\u03B6\u03B5\u03B9 \u03CC\u03BB\u03B5\u03C2 \u03C4\u03B9\u03C2 \u03C0\u03B5\u03C1\u03B9\u03C0\u03C4\u03CE\u03C3\u03B5\u03B9\u03C2 \u03B5\u03BC\u03C6\u03AC\u03BD\u03B9\u03C3\u03B7\u03C2 \u03C4\u03B7\u03C2 \u03B1\u03BD\u03BF\u03C1\u03B8\u03CC\u03B3\u03C1\u03B1\u03C6\u03B7\u03C2 \u03BB\u03AD\u03BE\u03B7\u03C2 (\u03C3\u03C4\u03BF \u03C4\u03C1\u03AD\u03C7\u03BF\u03BD \u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03BF \u03BA\u03B5\u03B9\u03BC\u03AD\u03BD\u03BF\u03C5)
+SC_Help_Ignore=\u0391\u03B3\u03BD\u03BF\u03B5\u03AF\u03C3\u03C4\u03B5 \u03C4\u03B7\u03BD \u03C4\u03C1\u03AD\u03C7\u03BF\u03C5\u03C3\u03B1 \u03B5\u03BC\u03C6\u03AC\u03BD\u03B9\u03C3\u03B7 \u03C4\u03B7\u03C2 \u03B1\u03BD\u03BF\u03C1\u03B8\u03CC\u03B3\u03C1\u03B1\u03C6\u03B7\u03C2 \u03BB\u03AD\u03BE\u03B7\u03C2
+SC_Help_IgnoreAll=\u0391\u03B3\u03BD\u03BF\u03B5\u03AF\u03C3\u03C4\u03B5 \u03B1\u03C5\u03C4\u03AE \u03BA\u03B1\u03B9 \u03CC\u03BB\u03B5\u03C2 \u03C4\u03B9\u03C2 \u03C0\u03B5\u03C1\u03B1\u03B9\u03C4\u03AD\u03C1\u03C9 \u03B5\u03BC\u03C6\u03B1\u03BD\u03AF\u03C3\u03B5\u03B9\u03C2 \u03C4\u03B7\u03C2 \u03BB\u03AD\u03BE\u03B7\u03C2
+SC_Help_Options=\u0386\u03BD\u03BF\u03B9\u03B3\u03BC\u03B1 \u03C0\u03B1\u03C1\u03B1\u03B8\u03CD\u03C1\u03BF\u03C5 \u03B5\u03C0\u03B9\u03BB\u03BF\u03B3\u03CE\u03BD
+SC_Help_RemoveWord=\u039A\u03B1\u03C4\u03B1\u03C1\u03B3\u03B5\u03AF \u03C4\u03B7\u03BD \u03B5\u03C0\u03B9\u03BB\u03B5\u03B3\u03BC\u03AD\u03BD\u03B7 \u03BB\u03AD\u03BE\u03B7 \u03B1\u03C0\u03CC \u03C4\u03BF \u03BB\u03B5\u03BE\u03B9\u03BA\u03CC \u03C7\u03C1\u03AE\u03C3\u03C4\u03B7
+SC_Label_AddToDictionary=\u03A0\u03C1\u03BF\u03C3\u03B8\u03AE\u03BA\u03B7 \u03C3\u03C4\u03BF \u039B\u03B5\u03BE\u03B9\u03BA\u03CC
+SC_Label_Cancel=\u0391\u03BA\u03CD\u03C1\u03C9\u03C3\u03B7
+SC_Label_Capitalization=\u039A\u03B5\u03C6\u03B1\u03BB\u03B1\u03B9\u03BF\u03C0\u03BF\u03AF\u03B7\u03C3\u03B7
+SC_Label_Change=\u0391\u03BB\u03BB\u03B1\u03B3\u03AE
+SC_Label_ChangeAll=\u0391\u03BB\u03BB\u03B1\u03B3\u03AE \u038C\u03BB\u03C9\u03BD
+SC_Label_ChangeTo=\u0391\u03BB\u03BB\u03B1\u03B3\u03AE \u03C3\u03B5
+SC_Label_ContainsDigits=\u0395\u03BC\u03C0\u03B5\u03C1\u03B9\u03AD\u03C7\u03B5\u03B9 \u03A8\u03B7\u03C6\u03AF\u03B1
+SC_Label_DoubledWord=\u0394\u03B9\u03C0\u03BB\u03AE \u03BB\u03AD\u03BE\u03B7
+SC_Label_Enable=\u0395\u03BD\u03B5\u03C1\u03B3\u03BF\u03C0\u03BF\u03AF\u03B7\u03C3\u03B7 \u03B5\u03BB\u03AD\u03B3\u03C7\u03BF\u03C5 \u03BF\u03C1\u03B8\u03BF\u03B3\u03C1\u03B1\u03C6\u03AF\u03B1\u03C2
+SC_Label_Ignore=\u0391\u03B3\u03BD\u03CC\u03B7\u03C3\u03B7
+SC_Label_IgnoreAll=\u0391\u03B3\u03BD\u03CC\u03B7\u03C3\u03B7 \u038C\u03BB\u03C9\u03BD
+SC_Label_IgnoreCase=\u0391\u03B3\u03BD\u03BF\u03B5\u03AF\u03C3\u03C4\u03B5 \u03C4\u03B7\u03BD \u03C0\u03B5\u03C1\u03AF\u03C0\u03C4\u03C9\u03C3\u03B7
+SC_Label_IgnoreDomainNames=\u0391\u03B3\u03BD\u03CC\u03B7\u03C3\u03B7 \u039F\u03BD\u03BF\u03BC\u03AC\u03C4\u03C9\u03BD \u03A0\u03B5\u03B4\u03AF\u03BF\u03C5 \u039F\u03C1\u03B9\u03C3\u03BC\u03BF\u03CD
+SC_Label_IgnoreWordsWithNumbers=\u0391\u03B3\u03BD\u03BF\u03B5\u03AF\u03C3\u03C4\u03B5 \u039B\u03AD\u03BE\u03B5\u03B9\u03C2 \u03BC\u03B5 \u0391\u03C1\u03B9\u03B8\u03BC\u03BF\u03CD\u03C2
+SC_Label_IgnoredWord=\u039B\u03AD\u03BE\u03B7 \u03C0\u03BF\u03C5 \u03B1\u03B3\u03BD\u03BF\u03AE\u03B8\u03B7\u03BA\u03B5
+SC_Label_Main=\u0392\u03B1\u03C3\u03B9\u03BA\u03AD\u03C2 \u03A1\u03C5\u03B8\u03BC\u03AF\u03C3\u03B5\u03B9\u03C2
+SC_Label_MixedCase=\u039C\u03B9\u03BA\u03C4\u03AE \u03A5\u03C0\u03CC\u03B8\u03B5\u03C3\u03B7
+SC_Label_NoSuggestions=(\u03BA\u03B1\u03BC\u03AF\u03B1 \u03C0\u03C1\u03CC\u03C4\u03B1\u03C3\u03B7)
+SC_Label_Options=\u0395\u03C0\u03B9\u03BB\u03BF\u03B3\u03AD\u03C2...
+SC_Label_RemoveWord=\u039A\u03B1\u03C4\u03AC\u03C1\u03B3\u03B7\u03C3\u03B7 \u039B\u03AD\u03BE\u03B7\u03C2
+SC_Label_Shortcut=\u03A3\u03C5\u03BD\u03C4\u03CC\u03BC\u03B5\u03C5\u03C3\u03B7
+SC_Label_Spelling=\u039F\u03C1\u03B8\u03BF\u03B3\u03C1\u03B1\u03C6\u03AF\u03B1
+SC_Language=\u0393\u03BB\u03CE\u03C3\u03C3\u03B1
+Save=\u0391\u03C0\u03BF\u03B8\u03AE\u03BA\u03B5\u03C5\u03C3\u03B7
+SaveButton=&\u0391\u03C0\u03BF\u03B8\u03AE\u03BA\u03B5\u03C5\u03C3\u03B7
+SaveButtonTooltip=\u0391\u03C0\u03BF\u03B8\u03B7\u03BA\u03B5\u03CD\u03C3\u03C4\u03B5 \u03C4\u03BF \u03C0\u03BB\u03B1\u03AF\u03C3\u03B9\u03BF \u03B4\u03B9\u03B1\u03BB\u03CC\u03B3\u03BF\u03C5 \u03C7\u03C9\u03C1\u03AF\u03C2 \u03BD\u03B1 \u03C4\u03BF \u03BA\u03BB\u03B5\u03AF\u03C3\u03B5\u03C4\u03B5
+SearchButton=&\u0391\u03BD\u03B1\u03B6\u03AE\u03C4\u03B7\u03C3\u03B7
+SearchButtonTooltip=\u039A\u03BB\u03B5\u03AF\u03C3\u03B9\u03BC\u03BF \u03B4\u03B9\u03B1\u03BB\u03CC\u03B3\u03BF\u03C5 \u03BA\u03B1\u03B9 \u03B5\u03BA\u03BA\u03AF\u03BD\u03B7\u03C3\u03B7 \u03B1\u03BD\u03B1\u03B6\u03AE\u03C4\u03B7\u03C3\u03B7\u03C2
+SearchConstraints=\u03A0\u03B5\u03C1\u03B9\u03BF\u03C1\u03B9\u03C3\u03BC\u03CC\u03C2 \u03B1\u03BD\u03B1\u03B6\u03AE\u03C4\u03B7\u03C3\u03B7\u03C2
+Server=\u0394\u03B9\u03B1\u03BA\u03BF\u03BC\u03B9\u03C3\u03C4\u03AE\u03C2 \u03BC\u03B5 \u03C3\u03CD\u03BD\u03B4\u03B5\u03C3\u03B7
+SmartFieldMoreThanXRows=\u03A0\u03B5\u03C1\u03B9\u03C3\u03C3\u03CC\u03C4\u03B5\u03C1\u03B5\u03C2 \u03B1\u03C0\u03CC {0} \u03B3\u03C1\u03B1\u03BC\u03BC\u03AD\u03C2. \u03A0\u03C1\u03BF\u03B2\u03BF\u03BB\u03AE \u03BC\u03CC\u03BD\u03BF {1}.
+SmartFindLabel=\u0391\u03BD\u03B1\u03B6\u03AE\u03C4\u03B7\u03C3\u03B7 \u03BA\u03B5\u03B9\u03BC\u03AD\u03BD\u03BF\u03C5
+StatusExportDone=\u0397 \u03B5\u03BE\u03B1\u03B3\u03C9\u03B3\u03AE \u03BF\u03BB\u03BF\u03BA\u03BB\u03B7\u03C1\u03CE\u03B8\u03B7\u03BA\u03B5
+Style=\u03A3\u03C4\u03C5\u03BB
+TableName=\u03A0\u03AF\u03BD\u03B1\u03BA\u03B1\u03C2
+Timestamp=\u03A7\u03C1\u03BF\u03BD\u03BF\u03C3\u03C6\u03C1\u03B1\u03B3\u03AF\u03B4\u03B1
+Today=\u03C3\u03AE\u03BC\u03B5\u03C1\u03B1
+TooManyRows=\u03A5\u03C0\u03B5\u03C1\u03BC\u03B5\u03B3\u03AD\u03B8\u03B7\u03C2 \u03B2\u03AC\u03C3\u03B7 \u03B4\u03B5\u03B4\u03BF\u03BC\u03AD\u03BD\u03C9\u03BD. \u03A0\u03B1\u03C1\u03B1\u03BA\u03B1\u03BB\u03CE \u03C0\u03B5\u03C1\u03B9\u03BF\u03C1\u03AF\u03C3\u03C4\u03B5 \u03C4\u03B7 \u03C7\u03C1\u03B7\u03C3\u03B9\u03BC\u03BF\u03C0\u03BF\u03B9\u03CE\u03BD\u03C4\u03B1\u03C2 \u03C4\u03B1 \u03C6\u03AF\u03BB\u03C4\u03C1\u03B1 \u0391\u03BD\u03B1\u03B6\u03AE\u03C4\u03B7\u03C3\u03B7\u03C2.
+Update=\u0395\u03BD\u03B7\u03BC\u03AD\u03C1\u03C9\u03C3\u03B7
+UserInterrupted=\u0391\u03BA\u03C5\u03C1\u03CE\u03B8\u03B7\u03BA\u03B5 \u03B1\u03C0\u03CC \u03C4\u03BF\u03BD \u03C7\u03C1\u03AE\u03C3\u03C4\u03B7
+Username=\u038C\u03BD\u03BF\u03BC\u03B1 \u03A7\u03C1\u03AE\u03C3\u03C4\u03B7
+Value=\u03A4\u03B9\u03BC\u03AE
+Week=\u0395\u03B2\u03B4\u03BF\u03BC\u03AC\u03B4\u03B1
+WeekShort=CW
+WizardBackButton=\u03A0\u03AF\u03C3\u03C9
+WizardCancelButton=\u0391\u03BA\u03CD\u03C1\u03C9\u03C3\u03B7
+WizardFinishButton=\u03A4\u03AD\u03BB\u03BF\u03C2
+WizardNextButton=\u0395\u03C0\u03CC\u03BC\u03B5\u03BD\u03BF
+WizardSuspendButton=\u039A\u03BB\u03B5\u03AF\u03C3\u03B9\u03BC\u03BF
+WorkWeek=\u0395\u03B2\u03B4\u03BF\u03BC\u03AC\u03B4\u03B1 \u03B5\u03C1\u03B3\u03B1\u03C3\u03AF\u03B1\u03C2
+Yes=\u039D\u03B1\u03B9
+YesButton=\u039D\u03B1\u03B9
+and=\u03BA\u03B1\u03B9
+between=\u03BC\u03B5\u03C4\u03B1\u03BE\u03CD
+from=\u03B1\u03C0\u03CC
+to=\u03C9\u03C2
diff --git a/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_es.properties b/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_es.properties
index 1050993785..468b00d878 100644
--- a/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_es.properties
+++ b/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_es.properties
@@ -1,272 +1,272 @@
-All=Todos
-AllStates=Todos
-Apply=Aplicar
-Attribute=Atributo
-Bookmarks=Favoritos
-BookmarksAddMenu=Adicionar a f&avoritos
-BookmarksMainMenu=&Favoritos
-BookmarksManageMenu=&Administrar favoritos
-BookmarksStartPageMenu=&P\u00E1gina inicial
-BookmarksStartPageMenuClear=&No utilizar p\u00E1gina inicial
-BookmarksStartPageMenuGoto=&Abrir p\u00E1gina inicial
-BookmarksStartPageMenuSet=&Definir esta p\u00E1gina como p\u00E1gina inicial
-ButtonDeselectAll=No seleccionar todo
-ButtonSelectAll=Seleccionar todo
-Calendar_earlier=antes
-Calendar_later=M\u00E1s adelante
-Cancel=Cancelar
-CancelButton=&Cancelar
-CancelButtonTooltip=Cerrar sin salvar;con mensaje de confirmaci\u00F3n si es necesario.
-ChangePassword=Cambiar password
-Close=Cerrar
-CloseButton=&Cerrar
-CloseButtonTooltip=Cerrar sin guardar
-Column=Columna
-Columns=Columnas
-ComposerFieldAggregationLabel=Funci\u00F3n
-Condensed=6 columnas
-Configure=Configuraci\u00F3n
-Copy=Copia
-Criteria=Criterio de b\u00FAsqueda
-Cut=Cortar
-Day=D\u00EDa
-DefaultPasswordPolicyText=La contrase\u00F1a no cumple con la pol\u00EDtica marcada\n\nPol\u00EDtica\:\n- por lo menos 8 caracteres\n- por lo menos un n\u00FAmero(0-9)\n- por lo menos un n\u00FAmero no st\u00E1ndard (\!|@|\#|$|%|^|&|*|(|)|_|+|||~|-|
-DeleteMenu=Borrar
-Detail=Detalle
-Details=Detalles
-EmailFrom=Desde
-EmailSubject=Asunto
-EmailTo=A
-Enabled=Activado
-Error=Error
-ErrorAndRetryTextDefault=Ha ocurrido un error durante la transferencia de datos.
-ErrorTextLogin=Nombre de usuario /password no v\u00E1lido
-ErrorTitleLogin=Acceso fallido
-ExcelChart_Button_LoadDefaults=Por defecto
-ExcelChart_Button_LoadDefaultsHint=Resetea este di\u00E1logo cargando valores predeterminados
-ExcelChart_Button_LoadProfile=Carga perfil...
-ExcelChart_Button_LoadProfileHint=Carga configuraci\u00F3n desde un archivo XML
-ExcelChart_Button_SaveProfile=Salvar el perfil...
-ExcelChart_Button_SaveProfileHint=Guarda la configuraci\u00F3n en un fichero XML.
-ExcelChart_Error_CreatingChartFailed=creaci\u00F3n de la tabla fall\u00F3
-ExcelChart_Error_ExportingFailed=Exportaci\u00F3n fall\u00F3 porque
-ExcelChart_Error_InitializationFailed=iniciaci\u00F3n de la clase(s) fall\u00F3.
-ExcelChart_Error_LoadingProfileFailed=Carga de perfiles fall\u00F3 porque
-ExcelChart_Error_LoadingTemplateFailed=carga del plantilla fall\u00F3
-ExcelChart_Error_RetrivingOutlineDataFailed=fall\u00F3 la recuperaci\u00F3n de informaci\u00F3n
-ExcelChart_Error_SavingProfileFailed=Guardar perfil fall\u00F3 porque
-ExcelChart_Error_WrongProfile=el perfil fue creado para otra configuraci\u00F3n
-ExcelChart_Label_AutomaticMode=Modo autom\u00E1tico
-ExcelChart_Label_AutomaticModeHint=Ocultar Excel y salvar autom\u00E1ticamente.
-ExcelChart_Label_ChartNumber=N\u00FAmero de gr\u00E1fica
-ExcelChart_Label_ChartType=Tipo de gr\u00E1fica
-ExcelChart_Label_FileName=Nombre fichero
-ExcelChart_Label_FirstRow=Primera fila
-ExcelChart_Label_Height=Altura
-ExcelChart_Label_HistogramMode=Modo histograma
-ExcelChart_Label_HistogramModeHint=El modo del histograma combina valores id\u00E9nticos en el eje-x a uno
-ExcelChart_Label_LastRow=\u00DAltima fila
-ExcelChart_Label_Offset=Posici\u00F3n
-ExcelChart_Label_SkipNullValues=Ignorar valores nulos del histograma
-ExcelChart_Label_SkipNullValuesHint=Los valores nulos del Eje X son ignarados, de lo contrario son asociados a <Desconocido>
-ExcelChart_Label_TemplateName=Plantilla
-ExcelChart_Label_UseCustomFormat=Usar formato parametrizado
-ExcelChart_Label_UseCustomFormatHint=si seleccionas, puedes indicar la posici\u00F3n y tama\u00F1o de la gr\u00E1fica
-ExcelChart_Label_UseExistingChart=Usar gr\u00E1fica existente
-ExcelChart_Label_UseExistingChartHint=Comprobando el gr\u00E1fico existente se usa el formato indicado.
-ExcelChart_Label_UseSelectiveExport=Use exportaci\u00F3n seleccionada
-ExcelChart_Label_UseSelectiveExportHint=Si seleccionas \u00FAnicamente las columnas indicadas ser\u00E1n exportadas
-ExcelChart_Label_Width=Ancho
-ExcelChart_Label_WorksheetName=Hoja de trabajo
-ExcelChart_Label_XAxis=Eje X
-ExcelChart_Label_YAxes=Eje Y
-ExcelChart_Status_Done=Gr\u00E1fica de Excel terminada
-ExcelChart_Tab_Advanced=Avanzado
-ExcelChart_Tab_Basic=B\u00E1sico
-ExcelChart_Title_MainForm=Gr\u00E1fica de Excel
-ExcelChart_Type_Area3D=Area 3D
-ExcelChart_Type_Area=Area
-ExcelChart_Type_AreaStacked3D=Areas apiladas 3D
-ExcelChart_Type_AreaStacked=Areas apiladas
-ExcelChart_Type_BarsClustered3D=Barras 3D
-ExcelChart_Type_BarsClustered=Barras
-ExcelChart_Type_BarsStacked3D=Barras Apiladas 3D
-ExcelChart_Type_BarsStacked=Barras Apiladas
-ExcelChart_Type_ColumnsClustered3D=Columnas 3D
-ExcelChart_Type_ColumnsClustered=Columnas
-ExcelChart_Type_ColumnsStacked3D=Columnas Apiladas 3D
-ExcelChart_Type_ColumnsStacked=Columnas Apiladas
-ExcelChart_Type_Line=L\u00EDnea
-ExcelChart_Type_LineStacked=L\u00EDnea Apilada
-ExcelChart_Type_Pie3D=Circular 3D
-ExcelChart_Type_Pie=Circular
-ExcelChart_Type_PieExploded3D=Circular Seccionado 3D
-ExcelChart_Type_PieExploded=Circular seccionado
-ExcelChart_Various_Averaged=Promedio
-ExcelChart_Various_Column=Columna
-ExcelChart_Various_Frequency=Frecuencia
-ExcelChart_Various_SummedUp=suma
-ExcelChart_Various_Unknown=<Desconocido>
-ExportDate=Fecha de exportaci\u00F3n
-ExtendedSearchAddAttributeMenu=A\u00F1adir una condici\u00F3n
-ExtendedSearchAddEntityPrefix=tiene
-ExtendedSearchAnd=y
-ExtendedSearchEditAttributeMenu=Editar...
-ExtendedSearchEntitySuffix=con
-ExtendedSearchNegateMenu=Negar
-ExtendedSearchRemoveAttributeMenu=Suprimir
-ExtendedSearchRemoveMenu=Borrar
-FileExistsOwerwriteQuestion=El archive seleccionado ya existe. \u00BFQuiere reescribirlo?
-FileName=Nombre del archivo
-FileNotFoundExceptionMessage=Archivo no encontrado
-FileNotFoundMessage=No puede encontrar el archivo
-FileNotFoundTitle=Archivo no encontrado
-FilesOfType=Tipo de archivo
-FormPrint=Imprimir
-FormSaveChangesQuestion=\u00BFQuiere guardar los cambios?
-FormStateLoad=Cargar...
-FormStateStore=Guardar
-FormStateStoreAs=Guardar como...
-GlobalBookmarks=Favoritos
-GlobalBookmarksAddMenu=A\u00F1adir a &favoritos
-Help=Ayuda
-Host=Ordenador
-IOErrorInfo=Por favor, examinar archivos relacionados y conexi\u00F3n con el servidor.
-IOErrorText=Error de comunicaci\u00F3n
-IOErrorTitle=Error de lectura / escritura
-InactiveState=inactivo
-InactiveStates=Inactivo
-Info=Informaci\u00F3n
-Information=Informaci\u00F3n
-Interrupted=Interrumpido
-InterruptedErrorText=El proceso ha sido cancelado manualmente.
-InterruptedErrorTitle=Proceso cancelado
-JavaVMVersion=Java VM
-Language=Idioma
-Live=en vivo
-LoadFormXmlFailedText=El archivo no es compatible con este di\u00E1logo.
-LogicDateIsInDays=es exactamente en (d\u00EDas)
-LogicDateIsInGEDays=D\u00EDa >\=hoy + n d\u00EDas
-LogicDateIsInGEMonths=D\u00EDa >\=hoy + n meses
-LogicDateIsInLEDays=D\u00EDa <\=hoy + n d\u00EDas
-LogicDateIsInLEMonths=D\u00EDa <\=hoy + n meses
-LogicDateIsInLastDays=fue en los \u00FAltimos n d\u00EDas
-LogicDateIsInLastMonths=fue en los \u00FAltimos n meses
-LogicDateIsInMonths=es exactamente en (meses)
-LogicDateIsInNextDays=fue en los pr\u00F3ximos n d\u00EDas
-LogicDateIsInNextMonths=fue en los pr\u00F3ximos n meses
-LogicDateIsNotToday=no es hoy
-LogicDateIsToday=es hoy
-LogicDateTimeIsInGEHours=D\u00EDa >\=ahora + n horas
-LogicDateTimeIsInGEMinutes=D\u00EDa >\=ahora + n minutos
-LogicDateTimeIsInLEHours=D\u00EDa <\=ahora + n horas
-LogicDateTimeIsInLEMinutes=D\u00EDa <\=ahora + n minutos
-LogicDateTimeIsNotNow=no es ahora
-LogicDateTimeIsNow=es ahora
-LogicEQ=\=
-LogicEndsWith=termina en
-LogicGE=>\=
-LogicGT=>
-LogicIn=es
-LogicLE=<\=
-LogicLT=<
-LogicLike=Contiene
-LogicNEQ=<>
-LogicNotIn=no es
-LogicNotLike=No contiene
-LogicNotNull=no est\u00E1 vacio
-LogicNull=est\u00E1 vacio
-LogicStartsWith=empieza con
-LogicTimeIsInGEHours=es m\u00E1s temprano (horas)
-LogicTimeIsInGEMinutes=es m\u00E1s temprano (minutos)
-LogicTimeIsInHours=es exactamente (horas)
-LogicTimeIsInLEHours=es m\u00E1s tarde en (horas)
-LogicTimeIsInLEMinutes=es m\u00E1s tarde en (minutos)
-LogicTimeIsInMinutes=es exactamente (minutos)
-LogicTimeIsNotNow=no es ahora
-LogicTimeIsNow=es ahora
-Login=Acceso
-LookAndFeel=Ver y comprobar
-LookIn=Mirar dentro
-Month=Mes
-Name=Nombre
-NetErrorInfo=Por favor, examinar el nombre, la direcci\u00F3n y la conexi\u00F3n con el servidor.
-NetErrorText=Servidor no encontrado
-NetErrorTitle=Error de red
-NewPassword=Nueva password
-No=No
-NoButton=&No
-None=Ninguno
-NumberOfRows=N\u00FAmero de filas
-OSUser=Usuario del sistema
-OSVersion=Versi\u00F3n del sistema
-Ok=Ok
-OkButton=&Ok
-OkButtonTooltip=Guardar y cerrar el di\u00E1logo
-OldPassword=Password antigua
-Op=Operador
-Open=Abierto
-Password=Contrase\u00F1a
-PasswordsDoNotMatch=Las dos contrase\u00F1as no son las mismas
-Paste=Pegar
-Path=Ruta
-Pending=Esperando
-Properties=Propiedades
-RepBuildExtract=Preparando datos...
-RepExecAfter=Limpiar base de datos
-RepExecBefore=Preparar la base de datos
-RepUpdate=Procesando datos...
-RepeatPassword=Repetir
-RequestProblem=Fallo del proceso
-ResetButton=&Reiniciar
-ResetButtonTooltip=Poner todos los campos del di\u00E1logo sin valor
-SC_DialogTitle_Options=Scout Spell Checker\: Opciones
-SC_Help_AddToDictionary=Agrega la palabra mal deletreada al diccionario
-SC_Help_Cancel=Cierra el di\u00E1logo y descarta todos los cambios (Shortcut\:ESC)
-SC_Help_ChangeAll=Cambia todas las ocurrencias de la palabra mal deletreada (en el art\u00EDculo actual del texto)
-SC_Help_Ignore=Ignore la ocurrencia actual de la palabra mal deletreada
-SC_Help_IgnoreCase=Si el caso comprobado es ignorado, por ejemplo "HoLa" ser\u00EDa aceptado
-SC_Help_IgnoreDomainNames=Si los nombres de dominio chequeados son ignorados, por ejemplo "www.bsiag.com" ser\u00EDa aceptado
-SC_Help_Language=El idioma seleccionado
-SC_Help_SuggestionList=Cambios sugeridos para la palabra mal deletreada (doble-click para substituir la palabra mal deletreada por la seleccionada)
-SC_Help_UseDefaults=Usar ajustes por defecto
-SC_Label_Capitalization=Capitalizaci\u00F3n
-SC_Label_ChangeTo=Cambiar a
-SC_Label_Ignore=Ignorar
-SC_Label_IgnoreCase=\ Ignorar Caso
-SC_Label_MixedCase=Caso mezclado
-SC_Label_NotInDictionary=La palabra destacada no fue reconocida
-SC_Label_Options=Opciones...
-SC_Label_Spelling=Deletreo
-SC_Message_Complete=La revisi\u00F3n del deletreo est\u00E1 completa
-Save=Guardar
-SaveButton=&Registrar
-SaveButtonTooltip=Guardar di\u00E1logo sin cerrar
-Search=Buscar
-SearchButton=&B\u00FAsqueda
-SearchButtonTooltip=Iniciar b\u00FAsqueda
-SearchConstraints=B\u00FAsqueda restringida
-Server=Servidor
-SmartFindLabel=Buscar texto
-Source=Fuente
-StatusExportDone=Exportaci\u00F3n completa
-Style=Modo
-TableName=Tabla
-Timestamp=Marca de tiempo
-Today=hoy
-TooManyRows=Demasiados datos.Por favor limite la b\u00FAsqueda.
-Update=Actualizaci\u00F3n
-UserInterrupted=Cancelado por el usuario
-Username=Nombre de usuario
-Value=Valor
-Week=Semana
-WeekShort=CW
-WizardCancelButton=Cancelar
-WizardSuspendButton=&Cerrado
-WorkWeek=Dias laborables
-Yes=S\u00ED
-YesButton=&S\u00ED
-and=y
-between=Entre
-from=Desde
-to=a
+All=Todos
+AllStates=Todos
+Apply=Aplicar
+Attribute=Atributo
+Bookmarks=Favoritos
+BookmarksAddMenu=Adicionar a f&avoritos
+BookmarksMainMenu=&Favoritos
+BookmarksManageMenu=&Administrar favoritos
+BookmarksStartPageMenu=&P\u00E1gina inicial
+BookmarksStartPageMenuClear=&No utilizar p\u00E1gina inicial
+BookmarksStartPageMenuGoto=&Abrir p\u00E1gina inicial
+BookmarksStartPageMenuSet=&Definir esta p\u00E1gina como p\u00E1gina inicial
+ButtonDeselectAll=No seleccionar todo
+ButtonSelectAll=Seleccionar todo
+Calendar_earlier=antes
+Calendar_later=M\u00E1s adelante
+Cancel=Cancelar
+CancelButton=&Cancelar
+CancelButtonTooltip=Cerrar sin salvar;con mensaje de confirmaci\u00F3n si es necesario.
+ChangePassword=Cambiar password
+Close=Cerrar
+CloseButton=&Cerrar
+CloseButtonTooltip=Cerrar sin guardar
+Column=Columna
+Columns=Columnas
+ComposerFieldAggregationLabel=Funci\u00F3n
+Condensed=6 columnas
+Configure=Configuraci\u00F3n
+Copy=Copia
+Criteria=Criterio de b\u00FAsqueda
+Cut=Cortar
+Day=D\u00EDa
+DefaultPasswordPolicyText=La contrase\u00F1a no cumple con la pol\u00EDtica marcada\n\nPol\u00EDtica\:\n- por lo menos 8 caracteres\n- por lo menos un n\u00FAmero(0-9)\n- por lo menos un n\u00FAmero no st\u00E1ndard (\!|@|\#|$|%|^|&|*|(|)|_|+|||~|-|
+DeleteMenu=Borrar
+Detail=Detalle
+Details=Detalles
+EmailFrom=Desde
+EmailSubject=Asunto
+EmailTo=A
+Enabled=Activado
+Error=Error
+ErrorAndRetryTextDefault=Ha ocurrido un error durante la transferencia de datos.
+ErrorTextLogin=Nombre de usuario /password no v\u00E1lido
+ErrorTitleLogin=Acceso fallido
+ExcelChart_Button_LoadDefaults=Por defecto
+ExcelChart_Button_LoadDefaultsHint=Resetea este di\u00E1logo cargando valores predeterminados
+ExcelChart_Button_LoadProfile=Carga perfil...
+ExcelChart_Button_LoadProfileHint=Carga configuraci\u00F3n desde un archivo XML
+ExcelChart_Button_SaveProfile=Salvar el perfil...
+ExcelChart_Button_SaveProfileHint=Guarda la configuraci\u00F3n en un fichero XML.
+ExcelChart_Error_CreatingChartFailed=creaci\u00F3n de la tabla fall\u00F3
+ExcelChart_Error_ExportingFailed=Exportaci\u00F3n fall\u00F3 porque
+ExcelChart_Error_InitializationFailed=iniciaci\u00F3n de la clase(s) fall\u00F3.
+ExcelChart_Error_LoadingProfileFailed=Carga de perfiles fall\u00F3 porque
+ExcelChart_Error_LoadingTemplateFailed=carga del plantilla fall\u00F3
+ExcelChart_Error_RetrivingOutlineDataFailed=fall\u00F3 la recuperaci\u00F3n de informaci\u00F3n
+ExcelChart_Error_SavingProfileFailed=Guardar perfil fall\u00F3 porque
+ExcelChart_Error_WrongProfile=el perfil fue creado para otra configuraci\u00F3n
+ExcelChart_Label_AutomaticMode=Modo autom\u00E1tico
+ExcelChart_Label_AutomaticModeHint=Ocultar Excel y salvar autom\u00E1ticamente.
+ExcelChart_Label_ChartNumber=N\u00FAmero de gr\u00E1fica
+ExcelChart_Label_ChartType=Tipo de gr\u00E1fica
+ExcelChart_Label_FileName=Nombre fichero
+ExcelChart_Label_FirstRow=Primera fila
+ExcelChart_Label_Height=Altura
+ExcelChart_Label_HistogramMode=Modo histograma
+ExcelChart_Label_HistogramModeHint=El modo del histograma combina valores id\u00E9nticos en el eje-x a uno
+ExcelChart_Label_LastRow=\u00DAltima fila
+ExcelChart_Label_Offset=Posici\u00F3n
+ExcelChart_Label_SkipNullValues=Ignorar valores nulos del histograma
+ExcelChart_Label_SkipNullValuesHint=Los valores nulos del Eje X son ignarados, de lo contrario son asociados a <Desconocido>
+ExcelChart_Label_TemplateName=Plantilla
+ExcelChart_Label_UseCustomFormat=Usar formato parametrizado
+ExcelChart_Label_UseCustomFormatHint=si seleccionas, puedes indicar la posici\u00F3n y tama\u00F1o de la gr\u00E1fica
+ExcelChart_Label_UseExistingChart=Usar gr\u00E1fica existente
+ExcelChart_Label_UseExistingChartHint=Comprobando el gr\u00E1fico existente se usa el formato indicado.
+ExcelChart_Label_UseSelectiveExport=Use exportaci\u00F3n seleccionada
+ExcelChart_Label_UseSelectiveExportHint=Si seleccionas \u00FAnicamente las columnas indicadas ser\u00E1n exportadas
+ExcelChart_Label_Width=Ancho
+ExcelChart_Label_WorksheetName=Hoja de trabajo
+ExcelChart_Label_XAxis=Eje X
+ExcelChart_Label_YAxes=Eje Y
+ExcelChart_Status_Done=Gr\u00E1fica de Excel terminada
+ExcelChart_Tab_Advanced=Avanzado
+ExcelChart_Tab_Basic=B\u00E1sico
+ExcelChart_Title_MainForm=Gr\u00E1fica de Excel
+ExcelChart_Type_Area3D=Area 3D
+ExcelChart_Type_Area=Area
+ExcelChart_Type_AreaStacked3D=Areas apiladas 3D
+ExcelChart_Type_AreaStacked=Areas apiladas
+ExcelChart_Type_BarsClustered3D=Barras 3D
+ExcelChart_Type_BarsClustered=Barras
+ExcelChart_Type_BarsStacked3D=Barras Apiladas 3D
+ExcelChart_Type_BarsStacked=Barras Apiladas
+ExcelChart_Type_ColumnsClustered3D=Columnas 3D
+ExcelChart_Type_ColumnsClustered=Columnas
+ExcelChart_Type_ColumnsStacked3D=Columnas Apiladas 3D
+ExcelChart_Type_ColumnsStacked=Columnas Apiladas
+ExcelChart_Type_Line=L\u00EDnea
+ExcelChart_Type_LineStacked=L\u00EDnea Apilada
+ExcelChart_Type_Pie3D=Circular 3D
+ExcelChart_Type_Pie=Circular
+ExcelChart_Type_PieExploded3D=Circular Seccionado 3D
+ExcelChart_Type_PieExploded=Circular seccionado
+ExcelChart_Various_Averaged=Promedio
+ExcelChart_Various_Column=Columna
+ExcelChart_Various_Frequency=Frecuencia
+ExcelChart_Various_SummedUp=suma
+ExcelChart_Various_Unknown=<Desconocido>
+ExportDate=Fecha de exportaci\u00F3n
+ExtendedSearchAddAttributeMenu=A\u00F1adir una condici\u00F3n
+ExtendedSearchAddEntityPrefix=tiene
+ExtendedSearchAnd=y
+ExtendedSearchEditAttributeMenu=Editar...
+ExtendedSearchEntitySuffix=con
+ExtendedSearchNegateMenu=Negar
+ExtendedSearchRemoveAttributeMenu=Suprimir
+ExtendedSearchRemoveMenu=Borrar
+FileExistsOwerwriteQuestion=El archive seleccionado ya existe. \u00BFQuiere reescribirlo?
+FileName=Nombre del archivo
+FileNotFoundExceptionMessage=Archivo no encontrado
+FileNotFoundMessage=No puede encontrar el archivo
+FileNotFoundTitle=Archivo no encontrado
+FilesOfType=Tipo de archivo
+FormPrint=Imprimir
+FormSaveChangesQuestion=\u00BFQuiere guardar los cambios?
+FormStateLoad=Cargar...
+FormStateStore=Guardar
+FormStateStoreAs=Guardar como...
+GlobalBookmarks=Favoritos
+GlobalBookmarksAddMenu=A\u00F1adir a &favoritos
+Help=Ayuda
+Host=Ordenador
+IOErrorInfo=Por favor, examinar archivos relacionados y conexi\u00F3n con el servidor.
+IOErrorText=Error de comunicaci\u00F3n
+IOErrorTitle=Error de lectura / escritura
+InactiveState=inactivo
+InactiveStates=Inactivo
+Info=Informaci\u00F3n
+Information=Informaci\u00F3n
+Interrupted=Interrumpido
+InterruptedErrorText=El proceso ha sido cancelado manualmente.
+InterruptedErrorTitle=Proceso cancelado
+JavaVMVersion=Java VM
+Language=Idioma
+Live=en vivo
+LoadFormXmlFailedText=El archivo no es compatible con este di\u00E1logo.
+LogicDateIsInDays=es exactamente en (d\u00EDas)
+LogicDateIsInGEDays=D\u00EDa >\=hoy + n d\u00EDas
+LogicDateIsInGEMonths=D\u00EDa >\=hoy + n meses
+LogicDateIsInLEDays=D\u00EDa <\=hoy + n d\u00EDas
+LogicDateIsInLEMonths=D\u00EDa <\=hoy + n meses
+LogicDateIsInLastDays=fue en los \u00FAltimos n d\u00EDas
+LogicDateIsInLastMonths=fue en los \u00FAltimos n meses
+LogicDateIsInMonths=es exactamente en (meses)
+LogicDateIsInNextDays=fue en los pr\u00F3ximos n d\u00EDas
+LogicDateIsInNextMonths=fue en los pr\u00F3ximos n meses
+LogicDateIsNotToday=no es hoy
+LogicDateIsToday=es hoy
+LogicDateTimeIsInGEHours=D\u00EDa >\=ahora + n horas
+LogicDateTimeIsInGEMinutes=D\u00EDa >\=ahora + n minutos
+LogicDateTimeIsInLEHours=D\u00EDa <\=ahora + n horas
+LogicDateTimeIsInLEMinutes=D\u00EDa <\=ahora + n minutos
+LogicDateTimeIsNotNow=no es ahora
+LogicDateTimeIsNow=es ahora
+LogicEQ=\=
+LogicEndsWith=termina en
+LogicGE=>\=
+LogicGT=>
+LogicIn=es
+LogicLE=<\=
+LogicLT=<
+LogicLike=Contiene
+LogicNEQ=<>
+LogicNotIn=no es
+LogicNotLike=No contiene
+LogicNotNull=no est\u00E1 vacio
+LogicNull=est\u00E1 vacio
+LogicStartsWith=empieza con
+LogicTimeIsInGEHours=es m\u00E1s temprano (horas)
+LogicTimeIsInGEMinutes=es m\u00E1s temprano (minutos)
+LogicTimeIsInHours=es exactamente (horas)
+LogicTimeIsInLEHours=es m\u00E1s tarde en (horas)
+LogicTimeIsInLEMinutes=es m\u00E1s tarde en (minutos)
+LogicTimeIsInMinutes=es exactamente (minutos)
+LogicTimeIsNotNow=no es ahora
+LogicTimeIsNow=es ahora
+Login=Acceso
+LookAndFeel=Ver y comprobar
+LookIn=Mirar dentro
+Month=Mes
+Name=Nombre
+NetErrorInfo=Por favor, examinar el nombre, la direcci\u00F3n y la conexi\u00F3n con el servidor.
+NetErrorText=Servidor no encontrado
+NetErrorTitle=Error de red
+NewPassword=Nueva password
+No=No
+NoButton=&No
+None=Ninguno
+NumberOfRows=N\u00FAmero de filas
+OSUser=Usuario del sistema
+OSVersion=Versi\u00F3n del sistema
+Ok=Ok
+OkButton=&Ok
+OkButtonTooltip=Guardar y cerrar el di\u00E1logo
+OldPassword=Password antigua
+Op=Operador
+Open=Abierto
+Password=Contrase\u00F1a
+PasswordsDoNotMatch=Las dos contrase\u00F1as no son las mismas
+Paste=Pegar
+Path=Ruta
+Pending=Esperando
+Properties=Propiedades
+RepBuildExtract=Preparando datos...
+RepExecAfter=Limpiar base de datos
+RepExecBefore=Preparar la base de datos
+RepUpdate=Procesando datos...
+RepeatPassword=Repetir
+RequestProblem=Fallo del proceso
+ResetButton=&Reiniciar
+ResetButtonTooltip=Poner todos los campos del di\u00E1logo sin valor
+SC_DialogTitle_Options=Scout Spell Checker\: Opciones
+SC_Help_AddToDictionary=Agrega la palabra mal deletreada al diccionario
+SC_Help_Cancel=Cierra el di\u00E1logo y descarta todos los cambios (Shortcut\:ESC)
+SC_Help_ChangeAll=Cambia todas las ocurrencias de la palabra mal deletreada (en el art\u00EDculo actual del texto)
+SC_Help_Ignore=Ignore la ocurrencia actual de la palabra mal deletreada
+SC_Help_IgnoreCase=Si el caso comprobado es ignorado, por ejemplo "HoLa" ser\u00EDa aceptado
+SC_Help_IgnoreDomainNames=Si los nombres de dominio chequeados son ignorados, por ejemplo "www.bsiag.com" ser\u00EDa aceptado
+SC_Help_Language=El idioma seleccionado
+SC_Help_SuggestionList=Cambios sugeridos para la palabra mal deletreada (doble-click para substituir la palabra mal deletreada por la seleccionada)
+SC_Help_UseDefaults=Usar ajustes por defecto
+SC_Label_Capitalization=Capitalizaci\u00F3n
+SC_Label_ChangeTo=Cambiar a
+SC_Label_Ignore=Ignorar
+SC_Label_IgnoreCase=\ Ignorar Caso
+SC_Label_MixedCase=Caso mezclado
+SC_Label_NotInDictionary=La palabra destacada no fue reconocida
+SC_Label_Options=Opciones...
+SC_Label_Spelling=Deletreo
+SC_Message_Complete=La revisi\u00F3n del deletreo est\u00E1 completa
+Save=Guardar
+SaveButton=&Registrar
+SaveButtonTooltip=Guardar di\u00E1logo sin cerrar
+Search=Buscar
+SearchButton=&B\u00FAsqueda
+SearchButtonTooltip=Iniciar b\u00FAsqueda
+SearchConstraints=B\u00FAsqueda restringida
+Server=Servidor
+SmartFindLabel=Buscar texto
+Source=Fuente
+StatusExportDone=Exportaci\u00F3n completa
+Style=Modo
+TableName=Tabla
+Timestamp=Marca de tiempo
+Today=hoy
+TooManyRows=Demasiados datos.Por favor limite la b\u00FAsqueda.
+Update=Actualizaci\u00F3n
+UserInterrupted=Cancelado por el usuario
+Username=Nombre de usuario
+Value=Valor
+Week=Semana
+WeekShort=CW
+WizardCancelButton=Cancelar
+WizardSuspendButton=&Cerrado
+WorkWeek=Dias laborables
+Yes=S\u00ED
+YesButton=&S\u00ED
+and=y
+between=Entre
+from=Desde
+to=a
diff --git a/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_fi.properties b/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_fi.properties
index b6c1a45785..f7009c8d91 100644
--- a/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_fi.properties
+++ b/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_fi.properties
@@ -1,220 +1,220 @@
-AllStates=Kaikki
-Apply=K\u00E4ytt\u00E4\u00E4 (Apply)
-Attribute=Attribuutti
-Bookmarks=Kirjamerkki (Bookmark)
-BookmarksAddMenu=&Lis\u00E4\u00E4 kirjamerkkeihin
-BookmarksMainMenu=&Kirjamerkit (Bookmarks)
-BookmarksManageMenu=&Hallinnoi kirjamerkkej\u00E4...
-BookmarksStartPageMenu=&Aloitusn\u00E4kym\u00E4
-BookmarksStartPageMenuClear=&Ei aloitusn\u00E4kym\u00E4\u00E4
-BookmarksStartPageMenuGoto=&Avaa aloitusn\u00E4kym\u00E4
-BookmarksStartPageMenuSet=&Aseta t\u00E4m\u00E4nhetkinen n\u00E4kym\u00E4 aloitusn\u00E4kym\u00E4ksi
-ButtonDeselectAll=Poista kaikki valinnat
-ButtonSelectAll=Valitse kaikki
-Calendar_earlier=Aikaisempi
-Calendar_later=My\u00F6hemmin
-Cancel=Peruuta
-CancelButton=&Peruuta
-CancelButtonTooltip=Sulje dialogi tallentamatta; vahvistusdialogin kanssa mik\u00E4li aiheellista.
-ChangePassword=Vaihda salasana
-CloseButton=&Sulje
-CloseButtonTooltip=Sulje dialogi tallentamatta.
-Column=Sarake
-Columns=Sarakkeet
-ComposerFieldAggregationLabel=Tarkoitus
-Condensed=6 saraketta
-Copy=Kopio
-Cut=Leikkaa
-Day=P\u00E4iv\u00E4
-DefaultPasswordPolicyText=Salasana ei ole vaatimusten mukainen\:\n\nVaatimukset\:\n- ainakin 8 merkki\u00E4\n- ainakin yksi numero (0-9)\n- ainakin yksi ei standardi merkki (\!|@|\#|$|%|^|&|*|(|)|_|+|||~|-|
-EmailFrom=l\u00E4htien
-EmailSubject=Aihe
-EmailTo=To
-Error=Virhe
-ErrorAndRetryTextDefault=On tapahtunut virhe tiedonsiirron aikana.
-ErrorTextLogin=Virheellinen k\u00E4ytt\u00E4j\u00E4nimi / salasana
-ErrorTitleLogin=Kirjautuminen ep\u00E4onnistui
-ExcelChart_Button_LoadDefaults=Oletusasetukset (Defaults)
-ExcelChart_Button_LoadDefaultsHint=Palauttaa t\u00E4m\u00E4n dialogin lataamalla oletusasetukset.
-ExcelChart_Button_LoadProfile=Lataa profiili...
-ExcelChart_Button_LoadProfileHint=Lataa setukset XML tiedostosta.
-ExcelChart_Button_SaveProfile=Tallenna profiili...
-ExcelChart_Button_SaveProfileHint=Tallentaa nykyiset asetukset XML tiedostoon.
-ExcelChart_Error_CreatingChartFailed=taulukon luonti ep\u00E4onnistui
-ExcelChart_Error_ExportingFailed=Vienti (Export) ep\u00E4onnistui koska
-ExcelChart_Error_InitializationFailed=tukiluokituksen alustus ep\u00E4onnistui.
-ExcelChart_Error_LoadingProfileFailed=Profiilin lataaminen ep\u00E4onnistui koska
-ExcelChart_Error_LoadingTemplateFailed=templaatin lataaminen ep\u00E4onnistui.
-ExcelChart_Error_RetrivingOutlineDataFailed=j\u00E4sennystietojen takaisin saaminen ep\u00E4onnistui.
-ExcelChart_Error_SavingProfileFailed=Profiilin tallennus ep\u00E4onnistui koska
-ExcelChart_Error_WrongProfile=profiili on luotu toista j\u00E4sennyst\u00E4 varten
-ExcelChart_Label_AutomaticMode=Automaattitila
-ExcelChart_Label_AutomaticModeHint=Piilota Excel ja tallenna automaattisesti.
-ExcelChart_Label_ChartNumber=Taulukon numero
-ExcelChart_Label_ChartType=Taulukon tyyppi
-ExcelChart_Label_FileName=Tiedostonimi
-ExcelChart_Label_FirstRow=Ensimm\u00E4inen rivi
-ExcelChart_Label_Height=Korkeus
-ExcelChart_Label_HistogramMode=Pylv\u00E4sdiagrammitila
-ExcelChart_Label_HistogramModeHint=Pylv\u00E4sdiagrammitila yhdist\u00E4\u00E4 identtiset arvot X-akselilla yhdeksi
-ExcelChart_Label_LastRow=Viimeinen rivi
-ExcelChart_Label_Offset=Asema
-ExcelChart_Label_SkipNullValues=Ohita tyhj\u00E4t arvot pylv\u00E4sdiagrammitilassa
-ExcelChart_Label_SkipNullValuesHint=Jos merkityt tyhj\u00E4t arvot X-aksellilla on j\u00E4tetty huomiotta, muutoin ne yhdistet\u00E4\u00E4n <Unknown>.
-ExcelChart_Label_TemplateName=Templaatti
-ExcelChart_Label_UseCustomFormat=K\u00E4yt\u00E4 mittatilaus formaattia
-ExcelChart_Label_UseCustomFormatHint=Jos merkitty voit osoittaa taulukon sijainnin ja koon
-ExcelChart_Label_UseExistingChart=K\u00E4yt\u00E4 olemassa olevaa taulukkoa
-ExcelChart_Label_UseExistingChartHint=Jos merkitty niin k\u00E4ytet\u00E4\u00E4n olemassa olevaa taulukkoa osoitetussa templaatissa
-ExcelChart_Label_UseSelectiveExport=K\u00E4yt\u00E4 valikoivaa vienti\u00E4 (Export)
-ExcelChart_Label_UseSelectiveExportHint=Jos merkitty, niin vain alla osoitetut rivit vied\u00E4\u00E4n.
-ExcelChart_Label_Width=Leveys
-ExcelChart_Label_WorksheetName=Ty\u00F6kirja
-ExcelChart_Label_XAxis=X-akseli
-ExcelChart_Label_YAxes=Y-akseli
-ExcelChart_Status_Done=Excel-taulukon vienti (Export) on valmis.
-ExcelChart_Tab_Advanced=Kehittynyt
-ExcelChart_Tab_Basic=Perus
-ExcelChart_Title_MainForm=Excel-taulukon vienti (Export)
-ExcelChart_Type_Area3D=Alue 3D
-ExcelChart_Type_Area=Alue
-ExcelChart_Type_AreaStacked3D=Pinottu alue 3D
-ExcelChart_Type_AreaStacked=Pinottu alue
-ExcelChart_Type_BarsClustered3D=Palkkiryhm\u00E4t 3D
-ExcelChart_Type_BarsClustered=Palkkiryhm\u00E4t
-ExcelChart_Type_BarsStacked3D=Palkkipinot 3D
-ExcelChart_Type_BarsStacked=Palkkipinot
-ExcelChart_Type_ColumnsClustered3D=Pylv\u00E4sryhm\u00E4t 3D
-ExcelChart_Type_ColumnsClustered=Pylv\u00E4sryhm\u00E4t
-ExcelChart_Type_ColumnsStacked3D=Pylv\u00E4spinot 3D
-ExcelChart_Type_ColumnsStacked=Pylv\u00E4spinot
-ExcelChart_Type_Line=Viiva
-ExcelChart_Type_LineStacked=Viivapinot
-ExcelChart_Type_Pie3D=Piirakka 3D
-ExcelChart_Type_Pie=Piirakka
-ExcelChart_Type_PieExploded3D=Piirakka hajoitettu 3D
-ExcelChart_Type_PieExploded=Piirakka hajoitettu
-ExcelChart_Various_Averaged=keskim\u00E4\u00E4r\u00E4istetty (averaged)
-ExcelChart_Various_Column=Sarake
-ExcelChart_Various_Frequency=Frekvenssi
-ExcelChart_Various_SummedUp=Summattu
-ExcelChart_Various_Unknown=<Tuntematon>
-ExportDate=Vienti (Export) p\u00E4iv\u00E4
-ExtendedSearchAddAttributeMenu=Lis\u00E4\u00E4 rajoite / rajaus...
-ExtendedSearchAddEntityPrefix=omistaa / on
-ExtendedSearchAnd=ja
-ExtendedSearchEditAttributeMenu=Muokkaa...
-ExtendedSearchEntitySuffix=kanssa
-ExtendedSearchNegateMenu=Kumoa (Negate)
-ExtendedSearchRemoveAttributeMenu=Poista
-ExtendedSearchRemoveMenu=Poista
-FileExistsOwerwriteQuestion=Valittu tiedosto on jo olemassa. Tallenna tiedoston p\u00E4\u00E4lle?
-FileName=Tiedostonimi
-FileNotFoundMessage=Tiedostoa ei l\u00F6ydetty\:
-FileNotFoundTitle=Tiedostoa ei l\u00F6ydetty
-FilesOfType=Tiedostotyyppi
-FormPrint=Tulosta
-FormSaveChangesQuestion=Haluatteko tallentaa muutokset?
-FormStateLoad=Lataa...
-FormStateStore=tallenna
-FormStateStoreAs=tallenna nimell\u00E4
-GlobalBookmarks=Globaalit kirjamerkit (bookmark)
-GlobalBookmarksAddMenu=Lis\u00E4\u00E4 globaalit kirjamerkit (bookmark)
-Help=Apua
-IOErrorInfo=Olkaa hyv\u00E4 tarkastakaa tiedostot ja yhteys.
-IOErrorText=Kommunikaatiovirhe
-IOErrorTitle=Luku- / kirjoitusvirhe
-Info=Informaatio
-Interrupted=Keskeytetty
-InterruptedErrorText=Prosessi on peruutettu manuaalisesti.
-InterruptedErrorTitle=Prosessi peruttu
-JavaVMVersion=Java VM
-Language=Kieli
-LoadFormXmlFailedText=T\u00E4m\u00E4 tiedosto ei ole yhteensopiva t\u00E4m\u00E4n dialogin kanssa.
-LogicDateIsInDays=on tarkalleen sis\u00E4ll\u00E4 (p\u00E4ivi\u00E4)
-LogicDateIsInGEDays=on aikaisintaan sis\u00E4ll\u00E4 (p\u00E4ivi\u00E4)
-LogicDateIsInGEMonths=on aikaisintaan sis\u00E4ll\u00E4 (kuukausia)
-LogicDateIsInLEDays=on viimeist\u00E4\u00E4n sis\u00E4ll\u00E4 (p\u00E4ivi\u00E4)
-LogicDateIsInLEMonths=on viimeist\u00E4\u00E4n sis\u00E4ll\u00E4 (kuukausia)
-LogicDateIsInMonths=on tarkalleen sis\u00E4ll\u00E4 (kuukausia)
-LogicDateIsNotToday=ei ole t\u00E4n\u00E4\u00E4n
-LogicDateIsToday=on t\u00E4n\u00E4\u00E4n
-LogicDateTimeIsInGEHours=on aikaisintaan sis\u00E4ll\u00E4 (tunteja)
-LogicDateTimeIsInGEMinutes=on aikaisintaan sis\u00E4ll\u00E4 (minuutteja)
-LogicDateTimeIsInLEHours=on viimeist\u00E4\u00E4n sis\u00E4ll\u00E4 (tunteja)
-LogicDateTimeIsInLEMinutes=on viimeist\u00E4\u00E4n sis\u00E4ll\u00E4 (minuutteja)
-LogicDateTimeIsNotNow=ei ole nyt
-LogicDateTimeIsNow=on nyt
-LogicEQ=\=
-LogicEndsWith=p\u00E4\u00E4ttyy
-LogicGE=>\=
-LogicGT=>
-LogicIn=on
-LogicLE=<\=
-LogicLT=<
-LogicLike=sis\u00E4lt\u00E4\u00E4
-LogicNEQ=<>
-LogicNotIn=ei ole
-LogicNotLike=ei sis\u00E4ll\u00E4
-LogicNotNull=ei ole tyhj\u00E4
-LogicNull=on tyhj\u00E4
-LogicStartsWith=Alkaa
-LogicTimeIsInGEHours=on aikaisintaan sis\u00E4ll\u00E4 (tunteja)
-LogicTimeIsInGEMinutes=on aikaisintaan sis\u00E4ll\u00E4 (minuutteja)
-LogicTimeIsInHours=on tarkalleen sis\u00E4ll\u00E4 (tunteja)
-LogicTimeIsInLEHours=on viimeist\u00E4\u00E4n sis\u00E4ll\u00E4 (tunteja)
-LogicTimeIsInLEMinutes=on viimeist\u00E4\u00E4n sis\u00E4ll\u00E4 (minuutteja)
-LogicTimeIsInMinutes=on tarkalleen sis\u00E4ll\u00E4 (minuutteja)
-LogicTimeIsNotNow=ei ole nyt
-LogicTimeIsNow=on nyt
-Login=Kirjaudu
-LookIn=Katso sis\u00E4\u00E4n
-Month=Kuukausi
-Name=Nimi
-NetErrorInfo=Olkaa hyv\u00E4 tarkistakaa serverin nimi, URL ja yhteys.
-NetErrorText=Serveri\u00E4 ei l\u00F6ydetty
-NetErrorTitle=Verkkovirhe
-NewPassword=Uusi salasana
-No=Ei
-NoButton=&Ei
-NumberOfRows=Rivim\u00E4\u00E4r\u00E4
-OSUser=Systeemin k\u00E4ytt\u00E4j\u00E4
-OSVersion=Systeemin versio
-Ok=OK
-OkButton=&OK
-OkButtonTooltip=Tallenna ja sulje dialogi
-OldPassword=Vanha salasana
-Op=Operaattori
-Open=Avaa
-Password=Salasana
-PasswordsDoNotMatch=N\u00E4m\u00E4 kaksi salasanaa eiv\u00E4t t\u00E4sm\u00E4\u00E4.
-Paste=Liit\u00E4
-Path=Polku
-RepeatPassword=Toista
-ResetButton=&resetointi
-ResetButtonTooltip=Aseta dialogin kaikki kent\u00E4t tyhjiksi arvoiksi
-Save=Tallenna
-SaveButton=&Tallenna
-SaveButtonTooltip=Tallenna dialogi sulkematta
-SearchButton=&Etsi
-SearchButtonTooltip=Sulje dialogi ja aloita haku
-SearchConstraints=Hakurajat
-Server=Serveri
-SmartFindLabel=Hakuteksti
-StatusExportDone=Vienti (Export) valmis
-Today=t\u00E4n\u00E4\u00E4n
-TooManyRows=Iso tietom\u00E4\u00E4r\u00E4. Olkaa hyv\u00E4 rajatkaa k\u00E4ytt\u00E4m\u00E4ll\u00E4 Etsi paneelia
-Update=P\u00E4ivitys
-UserInterrupted=K\u00E4ytt\u00E4j\u00E4 peruuttanut
-Username=K\u00E4ytt\u00E4j\u00E4nimi
-Value=Arvo
-Week=Viikko
-WeekShort=CW
-WizardCancelButton=Keskeyt\u00E4
-WizardSuspendButton=&Sulje
-WorkWeek=Ty\u00F6viikko
-Yes=Kyll\u00E4
-YesButton=&Kyll\u00E4
-and=ja
-from=jostakin (from)
-to=asti
+AllStates=Kaikki
+Apply=K\u00E4ytt\u00E4\u00E4 (Apply)
+Attribute=Attribuutti
+Bookmarks=Kirjamerkki (Bookmark)
+BookmarksAddMenu=&Lis\u00E4\u00E4 kirjamerkkeihin
+BookmarksMainMenu=&Kirjamerkit (Bookmarks)
+BookmarksManageMenu=&Hallinnoi kirjamerkkej\u00E4...
+BookmarksStartPageMenu=&Aloitusn\u00E4kym\u00E4
+BookmarksStartPageMenuClear=&Ei aloitusn\u00E4kym\u00E4\u00E4
+BookmarksStartPageMenuGoto=&Avaa aloitusn\u00E4kym\u00E4
+BookmarksStartPageMenuSet=&Aseta t\u00E4m\u00E4nhetkinen n\u00E4kym\u00E4 aloitusn\u00E4kym\u00E4ksi
+ButtonDeselectAll=Poista kaikki valinnat
+ButtonSelectAll=Valitse kaikki
+Calendar_earlier=Aikaisempi
+Calendar_later=My\u00F6hemmin
+Cancel=Peruuta
+CancelButton=&Peruuta
+CancelButtonTooltip=Sulje dialogi tallentamatta; vahvistusdialogin kanssa mik\u00E4li aiheellista.
+ChangePassword=Vaihda salasana
+CloseButton=&Sulje
+CloseButtonTooltip=Sulje dialogi tallentamatta.
+Column=Sarake
+Columns=Sarakkeet
+ComposerFieldAggregationLabel=Tarkoitus
+Condensed=6 saraketta
+Copy=Kopio
+Cut=Leikkaa
+Day=P\u00E4iv\u00E4
+DefaultPasswordPolicyText=Salasana ei ole vaatimusten mukainen\:\n\nVaatimukset\:\n- ainakin 8 merkki\u00E4\n- ainakin yksi numero (0-9)\n- ainakin yksi ei standardi merkki (\!|@|\#|$|%|^|&|*|(|)|_|+|||~|-|
+EmailFrom=l\u00E4htien
+EmailSubject=Aihe
+EmailTo=To
+Error=Virhe
+ErrorAndRetryTextDefault=On tapahtunut virhe tiedonsiirron aikana.
+ErrorTextLogin=Virheellinen k\u00E4ytt\u00E4j\u00E4nimi / salasana
+ErrorTitleLogin=Kirjautuminen ep\u00E4onnistui
+ExcelChart_Button_LoadDefaults=Oletusasetukset (Defaults)
+ExcelChart_Button_LoadDefaultsHint=Palauttaa t\u00E4m\u00E4n dialogin lataamalla oletusasetukset.
+ExcelChart_Button_LoadProfile=Lataa profiili...
+ExcelChart_Button_LoadProfileHint=Lataa setukset XML tiedostosta.
+ExcelChart_Button_SaveProfile=Tallenna profiili...
+ExcelChart_Button_SaveProfileHint=Tallentaa nykyiset asetukset XML tiedostoon.
+ExcelChart_Error_CreatingChartFailed=taulukon luonti ep\u00E4onnistui
+ExcelChart_Error_ExportingFailed=Vienti (Export) ep\u00E4onnistui koska
+ExcelChart_Error_InitializationFailed=tukiluokituksen alustus ep\u00E4onnistui.
+ExcelChart_Error_LoadingProfileFailed=Profiilin lataaminen ep\u00E4onnistui koska
+ExcelChart_Error_LoadingTemplateFailed=templaatin lataaminen ep\u00E4onnistui.
+ExcelChart_Error_RetrivingOutlineDataFailed=j\u00E4sennystietojen takaisin saaminen ep\u00E4onnistui.
+ExcelChart_Error_SavingProfileFailed=Profiilin tallennus ep\u00E4onnistui koska
+ExcelChart_Error_WrongProfile=profiili on luotu toista j\u00E4sennyst\u00E4 varten
+ExcelChart_Label_AutomaticMode=Automaattitila
+ExcelChart_Label_AutomaticModeHint=Piilota Excel ja tallenna automaattisesti.
+ExcelChart_Label_ChartNumber=Taulukon numero
+ExcelChart_Label_ChartType=Taulukon tyyppi
+ExcelChart_Label_FileName=Tiedostonimi
+ExcelChart_Label_FirstRow=Ensimm\u00E4inen rivi
+ExcelChart_Label_Height=Korkeus
+ExcelChart_Label_HistogramMode=Pylv\u00E4sdiagrammitila
+ExcelChart_Label_HistogramModeHint=Pylv\u00E4sdiagrammitila yhdist\u00E4\u00E4 identtiset arvot X-akselilla yhdeksi
+ExcelChart_Label_LastRow=Viimeinen rivi
+ExcelChart_Label_Offset=Asema
+ExcelChart_Label_SkipNullValues=Ohita tyhj\u00E4t arvot pylv\u00E4sdiagrammitilassa
+ExcelChart_Label_SkipNullValuesHint=Jos merkityt tyhj\u00E4t arvot X-aksellilla on j\u00E4tetty huomiotta, muutoin ne yhdistet\u00E4\u00E4n <Unknown>.
+ExcelChart_Label_TemplateName=Templaatti
+ExcelChart_Label_UseCustomFormat=K\u00E4yt\u00E4 mittatilaus formaattia
+ExcelChart_Label_UseCustomFormatHint=Jos merkitty voit osoittaa taulukon sijainnin ja koon
+ExcelChart_Label_UseExistingChart=K\u00E4yt\u00E4 olemassa olevaa taulukkoa
+ExcelChart_Label_UseExistingChartHint=Jos merkitty niin k\u00E4ytet\u00E4\u00E4n olemassa olevaa taulukkoa osoitetussa templaatissa
+ExcelChart_Label_UseSelectiveExport=K\u00E4yt\u00E4 valikoivaa vienti\u00E4 (Export)
+ExcelChart_Label_UseSelectiveExportHint=Jos merkitty, niin vain alla osoitetut rivit vied\u00E4\u00E4n.
+ExcelChart_Label_Width=Leveys
+ExcelChart_Label_WorksheetName=Ty\u00F6kirja
+ExcelChart_Label_XAxis=X-akseli
+ExcelChart_Label_YAxes=Y-akseli
+ExcelChart_Status_Done=Excel-taulukon vienti (Export) on valmis.
+ExcelChart_Tab_Advanced=Kehittynyt
+ExcelChart_Tab_Basic=Perus
+ExcelChart_Title_MainForm=Excel-taulukon vienti (Export)
+ExcelChart_Type_Area3D=Alue 3D
+ExcelChart_Type_Area=Alue
+ExcelChart_Type_AreaStacked3D=Pinottu alue 3D
+ExcelChart_Type_AreaStacked=Pinottu alue
+ExcelChart_Type_BarsClustered3D=Palkkiryhm\u00E4t 3D
+ExcelChart_Type_BarsClustered=Palkkiryhm\u00E4t
+ExcelChart_Type_BarsStacked3D=Palkkipinot 3D
+ExcelChart_Type_BarsStacked=Palkkipinot
+ExcelChart_Type_ColumnsClustered3D=Pylv\u00E4sryhm\u00E4t 3D
+ExcelChart_Type_ColumnsClustered=Pylv\u00E4sryhm\u00E4t
+ExcelChart_Type_ColumnsStacked3D=Pylv\u00E4spinot 3D
+ExcelChart_Type_ColumnsStacked=Pylv\u00E4spinot
+ExcelChart_Type_Line=Viiva
+ExcelChart_Type_LineStacked=Viivapinot
+ExcelChart_Type_Pie3D=Piirakka 3D
+ExcelChart_Type_Pie=Piirakka
+ExcelChart_Type_PieExploded3D=Piirakka hajoitettu 3D
+ExcelChart_Type_PieExploded=Piirakka hajoitettu
+ExcelChart_Various_Averaged=keskim\u00E4\u00E4r\u00E4istetty (averaged)
+ExcelChart_Various_Column=Sarake
+ExcelChart_Various_Frequency=Frekvenssi
+ExcelChart_Various_SummedUp=Summattu
+ExcelChart_Various_Unknown=<Tuntematon>
+ExportDate=Vienti (Export) p\u00E4iv\u00E4
+ExtendedSearchAddAttributeMenu=Lis\u00E4\u00E4 rajoite / rajaus...
+ExtendedSearchAddEntityPrefix=omistaa / on
+ExtendedSearchAnd=ja
+ExtendedSearchEditAttributeMenu=Muokkaa...
+ExtendedSearchEntitySuffix=kanssa
+ExtendedSearchNegateMenu=Kumoa (Negate)
+ExtendedSearchRemoveAttributeMenu=Poista
+ExtendedSearchRemoveMenu=Poista
+FileExistsOwerwriteQuestion=Valittu tiedosto on jo olemassa. Tallenna tiedoston p\u00E4\u00E4lle?
+FileName=Tiedostonimi
+FileNotFoundMessage=Tiedostoa ei l\u00F6ydetty\:
+FileNotFoundTitle=Tiedostoa ei l\u00F6ydetty
+FilesOfType=Tiedostotyyppi
+FormPrint=Tulosta
+FormSaveChangesQuestion=Haluatteko tallentaa muutokset?
+FormStateLoad=Lataa...
+FormStateStore=tallenna
+FormStateStoreAs=tallenna nimell\u00E4
+GlobalBookmarks=Globaalit kirjamerkit (bookmark)
+GlobalBookmarksAddMenu=Lis\u00E4\u00E4 globaalit kirjamerkit (bookmark)
+Help=Apua
+IOErrorInfo=Olkaa hyv\u00E4 tarkastakaa tiedostot ja yhteys.
+IOErrorText=Kommunikaatiovirhe
+IOErrorTitle=Luku- / kirjoitusvirhe
+Info=Informaatio
+Interrupted=Keskeytetty
+InterruptedErrorText=Prosessi on peruutettu manuaalisesti.
+InterruptedErrorTitle=Prosessi peruttu
+JavaVMVersion=Java VM
+Language=Kieli
+LoadFormXmlFailedText=T\u00E4m\u00E4 tiedosto ei ole yhteensopiva t\u00E4m\u00E4n dialogin kanssa.
+LogicDateIsInDays=on tarkalleen sis\u00E4ll\u00E4 (p\u00E4ivi\u00E4)
+LogicDateIsInGEDays=on aikaisintaan sis\u00E4ll\u00E4 (p\u00E4ivi\u00E4)
+LogicDateIsInGEMonths=on aikaisintaan sis\u00E4ll\u00E4 (kuukausia)
+LogicDateIsInLEDays=on viimeist\u00E4\u00E4n sis\u00E4ll\u00E4 (p\u00E4ivi\u00E4)
+LogicDateIsInLEMonths=on viimeist\u00E4\u00E4n sis\u00E4ll\u00E4 (kuukausia)
+LogicDateIsInMonths=on tarkalleen sis\u00E4ll\u00E4 (kuukausia)
+LogicDateIsNotToday=ei ole t\u00E4n\u00E4\u00E4n
+LogicDateIsToday=on t\u00E4n\u00E4\u00E4n
+LogicDateTimeIsInGEHours=on aikaisintaan sis\u00E4ll\u00E4 (tunteja)
+LogicDateTimeIsInGEMinutes=on aikaisintaan sis\u00E4ll\u00E4 (minuutteja)
+LogicDateTimeIsInLEHours=on viimeist\u00E4\u00E4n sis\u00E4ll\u00E4 (tunteja)
+LogicDateTimeIsInLEMinutes=on viimeist\u00E4\u00E4n sis\u00E4ll\u00E4 (minuutteja)
+LogicDateTimeIsNotNow=ei ole nyt
+LogicDateTimeIsNow=on nyt
+LogicEQ=\=
+LogicEndsWith=p\u00E4\u00E4ttyy
+LogicGE=>\=
+LogicGT=>
+LogicIn=on
+LogicLE=<\=
+LogicLT=<
+LogicLike=sis\u00E4lt\u00E4\u00E4
+LogicNEQ=<>
+LogicNotIn=ei ole
+LogicNotLike=ei sis\u00E4ll\u00E4
+LogicNotNull=ei ole tyhj\u00E4
+LogicNull=on tyhj\u00E4
+LogicStartsWith=Alkaa
+LogicTimeIsInGEHours=on aikaisintaan sis\u00E4ll\u00E4 (tunteja)
+LogicTimeIsInGEMinutes=on aikaisintaan sis\u00E4ll\u00E4 (minuutteja)
+LogicTimeIsInHours=on tarkalleen sis\u00E4ll\u00E4 (tunteja)
+LogicTimeIsInLEHours=on viimeist\u00E4\u00E4n sis\u00E4ll\u00E4 (tunteja)
+LogicTimeIsInLEMinutes=on viimeist\u00E4\u00E4n sis\u00E4ll\u00E4 (minuutteja)
+LogicTimeIsInMinutes=on tarkalleen sis\u00E4ll\u00E4 (minuutteja)
+LogicTimeIsNotNow=ei ole nyt
+LogicTimeIsNow=on nyt
+Login=Kirjaudu
+LookIn=Katso sis\u00E4\u00E4n
+Month=Kuukausi
+Name=Nimi
+NetErrorInfo=Olkaa hyv\u00E4 tarkistakaa serverin nimi, URL ja yhteys.
+NetErrorText=Serveri\u00E4 ei l\u00F6ydetty
+NetErrorTitle=Verkkovirhe
+NewPassword=Uusi salasana
+No=Ei
+NoButton=&Ei
+NumberOfRows=Rivim\u00E4\u00E4r\u00E4
+OSUser=Systeemin k\u00E4ytt\u00E4j\u00E4
+OSVersion=Systeemin versio
+Ok=OK
+OkButton=&OK
+OkButtonTooltip=Tallenna ja sulje dialogi
+OldPassword=Vanha salasana
+Op=Operaattori
+Open=Avaa
+Password=Salasana
+PasswordsDoNotMatch=N\u00E4m\u00E4 kaksi salasanaa eiv\u00E4t t\u00E4sm\u00E4\u00E4.
+Paste=Liit\u00E4
+Path=Polku
+RepeatPassword=Toista
+ResetButton=&resetointi
+ResetButtonTooltip=Aseta dialogin kaikki kent\u00E4t tyhjiksi arvoiksi
+Save=Tallenna
+SaveButton=&Tallenna
+SaveButtonTooltip=Tallenna dialogi sulkematta
+SearchButton=&Etsi
+SearchButtonTooltip=Sulje dialogi ja aloita haku
+SearchConstraints=Hakurajat
+Server=Serveri
+SmartFindLabel=Hakuteksti
+StatusExportDone=Vienti (Export) valmis
+Today=t\u00E4n\u00E4\u00E4n
+TooManyRows=Iso tietom\u00E4\u00E4r\u00E4. Olkaa hyv\u00E4 rajatkaa k\u00E4ytt\u00E4m\u00E4ll\u00E4 Etsi paneelia
+Update=P\u00E4ivitys
+UserInterrupted=K\u00E4ytt\u00E4j\u00E4 peruuttanut
+Username=K\u00E4ytt\u00E4j\u00E4nimi
+Value=Arvo
+Week=Viikko
+WeekShort=CW
+WizardCancelButton=Keskeyt\u00E4
+WizardSuspendButton=&Sulje
+WorkWeek=Ty\u00F6viikko
+Yes=Kyll\u00E4
+YesButton=&Kyll\u00E4
+and=ja
+from=jostakin (from)
+to=asti
diff --git a/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_fr.properties b/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_fr.properties
index 5163c57ebf..acc084ad12 100644
--- a/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_fr.properties
+++ b/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_fr.properties
@@ -1,472 +1,472 @@
-ActivateBookmarkMenu=Ouvrir le favori
-ActiveAndInactiveStates=Actifs+inactifs
-ActiveStates=Actifs
-AddCustomColumnMenu=Ajouter une colonne...
-All=Tous
-AllStates=Tous
-Apply=Appliquer
-ApplyBookmarkToSearchFailedMessage=Impossible d'appliquer ce favori \u00E0 la recherche actuelle.
-Attribute=Attribut
-Bookmark=Favori
-BookmarkFolder=Dossier
-Bookmarks=Favoris
-BookmarksAddMenu=Ajouter aux f&avoris
-BookmarksApplyToCurrentSearch=Lancer la recherche en utilisant ce favori
-BookmarksMainMenu=&Favoris
-BookmarksManageMenu=&Gestion des favoris
-BookmarksPublishMenu=Activer le favori...
-BookmarksStartPageMenu=&Ecran de lancement
-BookmarksStartPageMenuClear=&Aucun \u00E9cran de lancement
-BookmarksStartPageMenuGoto=&Ouvrir \u00E9cran de lancement
-BookmarksStartPageMenuSet=&Programmer l' \u00E9cran actuelle en vue de lancement
-ButtonDeselectAll=S\u00E9lectionner aucun (e)
-ButtonMoveDown=Vers le bas
-ButtonMoveUp=Vers le haut
-ButtonSelectAll=S\u00E9lectionner tous
-Calendar_earlier=Plus t\u00F4t
-Calendar_later=Plus tard
-Cancel=&Annuler
-CancelButton=&Annuler
-CancelButtonTooltip=Ferme le formue sans enregistrer; dans le cas de doute le syst\u00E8me demande de nouveau.
-ChangePassword=Changer le mot de passe
-CheckAll=Tout s\u00E9lectionner
-ClearColumnSorting=ne pas trier
-Close=Fermer
-CloseButton=&Fermer
-CloseButtonTooltip=Ferme le formue sans enregistrer.
-CodeTypeInit=Code type initialisation
-Column=Colonne
-ColumnFilterCheckedText=S\u00E9lectionn\u00E9s
-ColumnFilterConstraints=Filtres colonnes
-ColumnFilterDateSection=Filtre de la date
-ColumnFilterMenu=Filtre colonne...
-ColumnFilterNullText=Vide
-ColumnFilterNumberSection=Filtre des chiffres
-ColumnFilterRemoveButton=Supprimer le filtre
-ColumnFilterStringSection=Filtre de texte
-ColumnFilterUncheckedText=Non s\u00E9lectionn\u00E9s
-ColumnFilterValuesSection=Filtre des valeurs
-ColumnSortAscending=trier par ordre croissant
-ColumnSorting=Tri
-ColumnValues=Valeurs
-Columns=Colonnes
-ComposerFieldAggregationAvg=Valeur moyenne({0})
-ComposerFieldAggregationCount=Nombre({0})
-ComposerFieldAggregationLabel=Fonction
-ComposerFieldAggregationMax=Maximum({0})
-ComposerFieldAggregationMedian=M\u00E9dian({0})
-ComposerFieldAggregationMin=Minimum({0})
-ComposerFieldAggregationSum=Somme({0})
-Condensed=6 colonnes
-Configure=Configuration
-Copy=Copier
-CopyWidthsOfColumnsMenu=Copier les largeurs des colonnes
-Criteria=Crit\u00E8res de recherche
-Cut=Couper
-Day=Jour
-DefaultPasswordPolicyText=Le mot de passe ne r\u00E9pond pas aux r\u00E8gles\n\nR\u00E8gles\:\n- Au moins 8 caract\u00E8res\n- Au moins un nombre (0-9)\n- Au moins un caract\u00E8re non standard (\!|@|\#|$|%|^|&|*|(|)|_|+|||~|-|
-DeleteBookmarkMenu=Supprimer le favori
-DeleteConfirmationText=Voulez-vous vraiment annuler?
-DeleteConfirmationTextNoItemList=Voulez-vous supprimer ces fichiers ?
-DeleteConfirmationTextNoItemListX=Voulez-vous supprimer ces {0} ?
-DeleteConfirmationTextX=Voulez-vous supprimer les {0} suivants ?
-DeleteConfirmationTitle=Confirmer l\u2019annulation
-DeleteFolderMenu=Supprimer le dossier
-DeleteMenu=Supprimer
-Detail=D\u00E9tail
-DetailedVersion=Version d\u00E9taill\u00E9e
-Details=D\u00E9tails
-EditBookmarkMenu=Modifier le favori...
-EmailCc=CC
-EmailFrom=De
-EmailSent=Envoy\u00E9
-EmailSubject=Objet
-EmailTo=\u00C0
-Enabled=Activ\u00E9
-EndDate=Date finale
-Error=Erreur
-ErrorAndRetryTextDefault=Un erreur est apparu
-ErrorTextLogin=Mauvais nom d'utilisateur / mot de passe
-ErrorTextSecurity=L'acc\u00E8s a \u00E9t\u00E9 refus\u00E9.
-ErrorTitleLogin=\u00C9chec d'authentification
-ErrorTitleSecurity=Erreur d'acc\u00E8s
-ExcelChart_Button_LoadDefaults=R\u00E9glages standard
-ExcelChart_Button_LoadDefaultsHint=Remet ce formulaire au niveau initial en t\u00E9l\u00E9chargeant les r\u00E9glages standard.
-ExcelChart_Button_LoadProfile=T\u00E9l\u00E9charger le profil\u2026
-ExcelChart_Button_LoadProfileHint=T\u00E9l\u00E9charge des r\u00E9glages sauvegard\u00E9s \u00E0 partir d\u2019un fichier XML.
-ExcelChart_Button_SaveProfile=Sauvegarder le profil\u2026
-ExcelChart_Button_SaveProfileHint=Sauvegarde les r\u00E9glages actuels dans un fichier XML.
-ExcelChart_Error_CreatingChartFailed=la cr\u00E9ation du diagramme a \u00E9chou\u00E9.
-ExcelChart_Error_ExportingFailed=L\u2019export a \u00E9chou\u00E9, vu que
-ExcelChart_Error_InitializationFailed=l\u2019initialisation de la / des classes de support a \u00E9chou\u00E9.
-ExcelChart_Error_LoadingProfileFailed=Le t\u00E9l\u00E9chargement du profil a \u00E9chou\u00E9, vu que
-ExcelChart_Error_LoadingTemplateFailed=le mod\u00E8le n\u2019a pas pu \u00EAtre t\u00E9l\u00E9charg\u00E9.
-ExcelChart_Error_RetrivingOutlineDataFailed=les donn\u00E9es outlines n\u2019ont pas pu \u00EAtre lues.
-ExcelChart_Error_SavingProfileFailed=La sauvegarde du profil a \u00E9chou\u00E9, vu que
-ExcelChart_Error_WrongProfile=ce profil a \u00E9t\u00E9 cr\u00E9\u00E9 pour un autre contour.
-ExcelChart_Label_AutomaticMode=Mode automatique
-ExcelChart_Label_AutomaticModeHint=Cacher Excel et sauvegarder automatiquement.
-ExcelChart_Label_ChartNumber=N\u00B0 de diagramme
-ExcelChart_Label_ChartType=Type de diagramme
-ExcelChart_Label_FileName=Nom de fichier
-ExcelChart_Label_FirstRow=Premi\u00E8re ligne
-ExcelChart_Label_Height=Hauteur
-ExcelChart_Label_HistogramMode=Mode histogramme
-ExcelChart_Label_HistogramModeHint=Des valeurs identiques de l\u2019axe X sont r\u00E9sum\u00E9es dans le mode histogramme.
-ExcelChart_Label_LastRow=Derni\u00E8re ligne
-ExcelChart_Label_Offset=Position
-ExcelChart_Label_SkipNullValues=Ignorer les valeurs vides
-ExcelChart_Label_SkipNullValuesHint=Si elles sont activ\u00E9es, les valeurs vides figurant sur l\u2019axe X sont ignor\u00E9es dans le mode histogramme, autrement elles sont r\u00E9sum\u00E9es en <Inconnu>
-ExcelChart_Label_TemplateName=Mod\u00E8le
-ExcelChart_Label_UseCustomFormat=Utiliser son propre format
-ExcelChart_Label_UseCustomFormatHint=Permet de d\u00E9terminer la taille et la position du diagramme.
-ExcelChart_Label_UseExistingChart=Utiliser le diagramme existant
-ExcelChart_Label_UseExistingChartHint=Utilise le diagramme existant d\u00E9j\u00E0 dans le mod\u00E8le indiqu\u00E9.
-ExcelChart_Label_UseSelectiveExport=S\u00E9lectionner les lignes
-ExcelChart_Label_UseSelectiveExportHint=N\u2019exporte que les lignes dans le secteur indiqu\u00E9 en bas.
-ExcelChart_Label_Width=Largeur
-ExcelChart_Label_WorksheetName=Feuille du tableau
-ExcelChart_Label_XAxis=Axe X
-ExcelChart_Label_YAxes=Axes Y
-ExcelChart_Status_Done=Diagramme Excel export termin\u00E9.
-ExcelChart_Tab_Advanced=Elargi
-ExcelChart_Tab_Basic=Standard
-ExcelChart_Title_MainForm=Export diagramme Excel
-ExcelChart_Type_Area3D=Surface 3D
-ExcelChart_Type_Area=Surface
-ExcelChart_Type_AreaStacked3D=Surface empil\u00E9e 3D
-ExcelChart_Type_AreaStacked=Surface empil\u00E9e
-ExcelChart_Type_BarsClustered3D=Barre group\u00E9e 3D
-ExcelChart_Type_BarsClustered=Barre group\u00E9e
-ExcelChart_Type_BarsStacked3D=Barre empil\u00E9e 3D
-ExcelChart_Type_BarsStacked=Barre empil\u00E9e
-ExcelChart_Type_ColumnsClustered3D=Colonnes group\u00E9s 3D
-ExcelChart_Type_ColumnsClustered=Colonnes group\u00E9s
-ExcelChart_Type_ColumnsStacked3D=Colonnes empil\u00E9s 3D
-ExcelChart_Type_ColumnsStacked=Colonnes empil\u00E9s
-ExcelChart_Type_Line=Ligne
-ExcelChart_Type_LineStacked=Ligne empil\u00E9e
-ExcelChart_Type_Pie3D=Secteurs 3D
-ExcelChart_Type_Pie=Secteurs
-ExcelChart_Type_PieExploded3D=Secteurs dispers\u00E9s 3D
-ExcelChart_Type_PieExploded=Secteurs dispers\u00E9s
-ExcelChart_Various_Averaged=moyenne
-ExcelChart_Various_Column=Colonne
-ExcelChart_Various_Frequency=Fr\u00E9quence
-ExcelChart_Various_SummedUp=additionn\u00E9
-ExcelChart_Various_Unknown=<Inconnu>
-ExcelChart_WorksheetName_Chart=Diagramme
-ExcelChart_WorksheetName_Data=Donn\u00E9es du diagramme
-ExecutionTime=Traitement du serveur
-ExportDate=Date d'exportation
-ExtendedSearchAddAdditionalOrMenu=En suppl\u00E9ment ou ajouter
-ExtendedSearchAddAttribute=Condition
-ExtendedSearchAddAttributeMenu=Ajouter une condition...
-ExtendedSearchAddEitherOrMenu=Ins\u00E9rer ou...ou
-ExtendedSearchAddEntityPrefix=a
-ExtendedSearchAnd=et
-ExtendedSearchEditAttributeMenu=Modifier...
-ExtendedSearchEither=ou
-ExtendedSearchEntitySuffix=avec
-ExtendedSearchNegateMenu=N\u00E9gation
-ExtendedSearchNot=ne... pas
-ExtendedSearchOr=ou
-ExtendedSearchRemoveAttributeMenu=Supprimer
-ExtendedSearchRemoveMenu=Supprimer
-FileExistsOwerwriteQuestion=Le fichier s\u00E9lectionn\u00E9 existe d\u00E9j\u00E0. Voulez-vous quand m\u00EAme enregistrer?
-FileName=Nom de fichier
-FileNotFoundExceptionMessage=Fichier introuvable ou inaccessible.
-FileNotFoundMessage=Le fichier suivant n'a pas \u00E9t\u00E9 trouv\u00E9\:\n{0}
-FileNotFoundTitle=Fichier introuvable
-FilesOfType=Type de fichier
-FilterBookmarkTree=Rechercher dans les favoris
-Folders=Classeur
-FormButtonClicked=En cliquant sur un bouton
-FormCloseTimerActivated=Activation du cadenceur de cl\u00F4ture de formulaire
-FormClosing=Fermer
-FormEmptyMandatoryFieldsMessage=Les champs suivants doivent \u00EAtre remplis
-FormExportXml=Export vers XML
-FormFinally=Cl\u00F4turer
-FormFireActivated=En activant le formulaire / lors de l\u2019activation du formulaire
-FormFireClosed=En cl\u00F4turant le formulaire
-FormFireDiscarded=En rejetant le formulaire
-FormFireStructureChanged=En modifiant la structure du formulaire
-FormIncompleteIntro=Tous les champs obligatoires n\u2019ont pas \u00E9t\u00E9 remplis.
-FormInvalidFieldsMessage=Les champs suivants ont une valeur invalide
-FormPrint=Imprimer
-FormReset=Remettre
-FormSaveChangesQuestion=Est-ce-que vous voulez enregistrer les modifications?
-FormStateLoad=Ouvrir...
-FormStateStore=Enregistrer
-FormStateStoreAs=Enregistrer sous...
-FormTimerActivated=Compteur de temps activ\u00E9
-FormattingLocale=Formatage
-GlobalBookmarks=Favoris Globals
-GlobalBookmarksAddMenu=Ajouter aux favoris &globals
-Help=Aide
-Host=Ordinateur h\u00F4te
-Hour=Heure
-IOErrorInfo=Veuillez contr\u00F4ler les fichiers concern\u00E9s et la connexion au serveur.
-IOErrorText=Erreur de communication
-IOErrorTitle=Erreur de lecture/d'\u00E9criture
-InDaysX=entre {0} jours
-InactiveState=Inactif
-InactiveStates=Inactifs
-Info=Informations
-Information=Information
-Interrupted=Interrompu
-InterruptedErrorText=Le Proc\u00E8s a \u00E9t\u00E9 interrumpu.
-InterruptedErrorTitle=Proc\u00E8s interrompu
-InvalidNumberMessageX="{0}" est un chiffre invalide
-InvalidPhoneNumberMessageX="{0}" est un num\u00E9ro de t\u00E9l\u00E9phone invalide
-InvalidValueMessageX="{0}" est une valeur invalide
-JavaVMVersion=Java VM
-JavaVersion=Java Runtime
-KeyStroke=Combinaison de touches
-Language=Langue
-Live=Live
-LoadFormXmlFailedText=Ce fichier ne provient pas de ce formue.
-LogicBetween=est entre {0} et {1}
-LogicBetweenShort=entre
-LogicDateIsInDays=est exactement dans {0} jours
-LogicDateIsInGEDays=est au plus t\u00F4t dans {0} jours
-LogicDateIsInGEMonths=est au plus t\u00F4t dans {0} mois
-LogicDateIsInLEDays=est au plus tard dans {0} jours
-LogicDateIsInLEMonths=est au plus tard dans {0} mois
-LogicDateIsInLastDays=\u00E9tait dans les {0} derniers jours
-LogicDateIsInLastMonths=\u00E9tait dans les {0} derniers mois
-LogicDateIsInMonths=est exactement dans {0} mois
-LogicDateIsInNextDays=est dans les {0} prochains jours
-LogicDateIsInNextMonths=est dans les {0} prochains mois
-LogicDateIsNotToday=n\u2019est pas aujourd\u2019hui
-LogicDateIsToday=est aujourd\u2019hui
-LogicDateTimeIsInGEHours=est au plus t\u00F4t dans {0} heures
-LogicDateTimeIsInGEMinutes=est au plus t\u00F4t dans {0} minutes
-LogicDateTimeIsInLEHours=est au plus tard dans {0} heures
-LogicDateTimeIsInLEMinutes=est au plus tard dans {0} minutes
-LogicDateTimeIsNotNow=n\u2019est pas maintenant
-LogicDateTimeIsNow=est maintenant
-LogicEQ=\=
-LogicEndsWith=finit avec
-LogicGE=>\=
-LogicGT=>
-LogicIn=est
-LogicLE=<\=
-LogicLT=<
-LogicLike=contient
-LogicNEQ=<>
-LogicNotEndsWith=ne se termine pas par
-LogicNotIn=n'est pas
-LogicNotLike=ne contient pas
-LogicNotNull=n'est pas vide
-LogicNotStartsWith=ne commence pas par
-LogicNull=est vide
-LogicStartsWith=commence avec
-LogicTimeIsInGEHours=est au plus t\u00F4t dans {0} heures
-LogicTimeIsInGEMinutes=est au plus t\u00F4t dans {0} minutes
-LogicTimeIsInHours=est exactement dans {0} heures
-LogicTimeIsInLEHours=est au plus tard dans {0} heures
-LogicTimeIsInLEMinutes=est au plus tard dans {0} minutes
-LogicTimeIsInMinutes=est exactement dans {0} minutes
-LogicTimeIsNotNow=n\u2019est pas maintenant
-LogicTimeIsNow=est maintenant
-Login=Inscription
-LookAndFeel=Look and feel
-LookIn=Chercher dans
-MemoryStatus=M\u00E9moire
-Minute=Minute
-ModifyCustomColumnMenu=Modifier la colonne...
-Month=Mese
-Name=Nom
-NetErrorInfo=Veuillez contr\u00F4ler le nom, l'adresse du serveur et la connexion.
-NetErrorText=Serveur introuvable
-NetErrorTitle=Erreur r\u00E9seau
-NetworkLatency=Ralentissement du r\u00E9seau
-NewBookmarkFolderMenu=Nouveau dossier...
-NewPassword=Mot de passe nouveau
-No=Non
-NoButton=&Non
-None=Rien
-NumberOfRows=Nombre d'enregistrement
-NumberTooLargeMessageXY=La valeur est trop grande; doit se situer entre {0} et {1} .
-NumberTooSmallMessageXY=La valeur est trop petite; doit se situer entre {0} et {1}.
-OSUser=Syst\u00E8me utilisateur
-OSVersion=Version du syst\u00E8me
-OcrEditorMoveTool=D\u00E9placer l'image
-OcrEditorNextPage=Page suivante
-OcrEditorOCRTool=Reconnaissance de texte
-OcrEditorOfX=de
-OcrEditorPage=Page
-OcrEditorPreviousPage=Page pr\u00E9c\u00E9dente
-OcrEditorRotateLeft=Tourner vers la gauche
-OcrEditorRotateRight=Tourner vers la droite
-OcrEditorZoomIn=Agrandir
-OcrEditorZoomOut=R\u00E9duire
-OcrEditorZoomToFit=Adapter
-Ok=Ok
-OkButton=&Ok
-OkButtonTooltip=Enregistre et ferme le formue
-OldPassword=Mot de passe vieux
-OneRow=1 objet
-OneSelected=1 s\u00E9lectionn\u00E9
-Op=Op\u00E9rateur
-Open=Ouvrir
-OrganizeTableColumnsMenu=Organiser les colonnes...
-OrganizeTableColumnsTitle=Organiser les colonnes
-OriginalErrorMessageIs=Le message d\u2019erreur d\u2019origine est\:\r\n{0}
-OutlineSelectorAddOrRemoveButtons=Surajouter ou \u00E9carter de &boutons
-OutlineSelectorShowFewerButtons=&Moins boutons
-OutlineSelectorShowMoreButtons=&Plus boutons
-Password=Mot de passe
-PasswordHasExpiredHeader=Votre mot de passe a expir\u00E9, vous devriez le modifier d\u00E8s maintenant.
-PasswordHasExpiredTitle=Mot de passe expir\u00E9
-PasswordMin8Chars=au moins 8 caract\u00E8res
-PasswordMinOnNonStdChar=au moins un caract\u00E8re sp\u00E9cial
-PasswordMinOneChar=au moins une lettre a-z/A-Z
-PasswordMinOneDigit=au moins un chiffre 0-9
-PasswordNotSameAsLasts=Le mot de passe ne doit pas \u00EAtre le m\u00EAme que la derni\u00E8re fois.
-PasswordUsernameNotPartOfPass=Le mot de passe ne peut pas \u00EAtre une partie du nom d'utilisateur.
-PasswordWillExpireHeaderX=Votre mot de passe expire {0}.
-PasswordWillExpireInfo=Souhaitez-vous le modifier maintenant ?
-PasswordWillExpireTitle=Votre mot de passe expire.
-PasswordsDoNotMatch=Les deux mots de passe ne correspondons pas.
-Paste=Coller
-PasteTextTooLongForFieldX=Le texte ins\u00E9r\u00E9 est trop long et a \u00E9t\u00E9 raccourci. Le nombre maximal de caract\u00E8res est de {0}.
-Path=Chemin
-Pending=Veuillez patienter\u0085
-Properties=Propri\u00E9t\u00E9s
-Redo=R\u00E9tablir
-RemoveAllCustomColumnsMenu=Supprimer mes colonnes
-RemoveCustomColumnMenu=Supprimer une colonne
-RenameBookmarkFolderMenu=Renommer le dossier...
-RepBuildExtract=Pr\u00E9paration des donn\u00E9es\u0085
-RepExecAfter=Nettoyer la base de donn\u00E9es
-RepExecBefore=Pr\u00E9parer la base de donn\u00E9es
-RepUpdate=Traitement des donn\u00E9es\u0085
-RepeatPassword=R\u00E9p\u00E9ter
-RequestProblem=Erreur d'emploi
-ResetButton=&R\u00E9initialiser
-ResetButtonTooltip=Transforme tout les formues en valeurs vide.
-ResetTableColumnFilter=Filtre
-ResetTableColumns=R\u00E9initialiser les colonnes
-ResetTableColumnsAll=Tout
-ResetTableColumnsOrder=Ordre
-ResetTableColumnsSorting=Tri
-ResetTableColumnsView=Voir
-ResetTableColumnsWidth=Largeur
-SC_Copyright=Le contr\u00F4le orthographique et les dictionnaires Sentry sont prot\u00E9g\u00E9s en droits d\u2019auteurs par le logiciel Wintertree Inc.
-SC_DialogTitle=Contr\u00F4le orthographique
-SC_DialogTitle_Options=Contr\u00F4le orthographique\: options
-SC_Help_AddToDictionary=Ajoute le mot au dictionnaire d\u2019utilisateur
-SC_Help_Cancel=Ferme le dialogue et rejette toutes les modifications (touche rapide\: ESC)
-SC_Help_Change=Modifie l\u2019apparition actuelle du mot
-SC_Help_ChangeAll=Modifie toutes les apparitions du mot (dans le champ de texte actuel)
-SC_Help_Enable=Active ou d\u00E9sactive le contr\u00F4le orthographique Scout
-SC_Help_Ignore=Ignore l\u2019apparition actuelle du mot
-SC_Help_IgnoreAll=A ignor\u00E9 cette acception et toutes les indications suivantes du mot
-SC_Help_IgnoreCase=Ignorer la casse
-SC_Help_IgnoreDomainNames=Ignore par exemple \u201Awww.bsiag.com\u2019
-SC_Help_IgnoreWordsWithNumbers=Ignore les mots avec des chiffres
-SC_Help_Language=La langue s\u00E9lectionn\u00E9e
-SC_Help_Options=Ouvre le dialogue options
-SC_Help_RemoveWord=Supprime le mot marqu\u00E9 du dictionnaire de l\u2019utilisateur
-SC_Help_ReplacementWord=Le mot par lequel le mot marqu\u00E9 doit \u00EAtre remplac\u00E9 (appuyez sur ENTER pour remplacer le mot non reconnu par celui-l\u00E0)
-SC_Help_Shortcut=La touche rapide pour le dialogue de correction orthographique. Fixe, ne peut pas \u00EAtre modifi\u00E9e.
-SC_Help_SuggestionList=Proposition de remplacement du mot marqu\u00E9 (double-cliquer pour remplacer le mot non reconnu par le mot s\u00E9lectionn\u00E9)
-SC_Help_Undo=Annule la derni\u00E8re modification
-SC_Help_UseDefaults=Remettre tous les r\u00E9glages sur les valeurs standard
-SC_Help_UserDictionary=S\u00E9lectionnez un dictionnaire \u201Atlx\u2019 (scout) ou \u201Adic\u2019 (Microsoft Word) en tant que dictionnaire d\u2019utilisateur
-SC_Label_AddToDictionary=Ajouter
-SC_Label_Cancel=Interrompre
-SC_Label_Capitalization=Majuscules-minuscules
-SC_Label_Change=Modifier
-SC_Label_ChangeAll=Modifier tous
-SC_Label_ChangeTo=Modifier selon
-SC_Label_ConsiderChanging=Prendre en compte la modification
-SC_Label_ContainsDigits=Contient des chiffres
-SC_Label_DoubledWord=Le mot appara\u00EEt deux fois
-SC_Label_Enable=Activer le contr\u00F4le orthographique
-SC_Label_Ignore=Ignorer
-SC_Label_IgnoreAll=Ignorer tous
-SC_Label_IgnoreCase=Ignorer majuscules / minuscules
-SC_Label_IgnoreDomainNames=Ignorer domaine du nom
-SC_Label_IgnoreWordsWithNumbers=Ignorer les mots avec des chiffres
-SC_Label_IgnoredWord=Mots d\u00E9finis par l'utilisateur
-SC_Label_Main=Orthographe
-SC_Label_MixedCase=Majuscules / minuscules m\u00E9lang\u00E9es
-SC_Label_NoSuggestions=(Aucune proposition)
-SC_Label_NotInDictionary=Le mot marqu\u00E9 n\u2019a pas \u00E9t\u00E9 reconnu
-SC_Label_Options=Options\u2026
-SC_Label_RemoveWord=Supprimer le mot
-SC_Label_Shortcut=Touche rapide
-SC_Label_Spelling=Orthographe
-SC_Label_Undo=Annul\u00E9
-SC_Label_UseDefaults=Standard
-SC_Label_UserDictionary=Dictionnaire de l\u2019utilisateur
-SC_Language=Langue
-SC_Message_CheckRest=Voulez-vous contr\u00F4ler le reste du texte?
-SC_Message_Complete=Le contr\u00F4le orthographique est complet
-SC_Message_CompleteForSelection=Le contr\u00F4le orthographique est complet pour le marquage actuel
-SC_Message_NotAvailable=Le contr\u00F4le de l\u2019orthographe Scout n\u2019est pas disponible
-Save=Enregistrer
-SaveButton=&Enregistrer
-SaveButtonTooltip=Enregistrer sans fermer le formue
-SavePassword=Sauvegarder le nom d'utilisateur/mot de passe
-ScoutStarting=Lancement de Scout
-Search=Chercher
-SearchButton=&Recherche
-SearchButtonTooltip=D\u00E9marrage de la recherche
-SearchConstraints=Contrainte de recherche
-SearchTextIsTooGeneral=Pr\u00E9ciser les crit\u00E8res de recherche
-SelectedStates=Uniquement marqu\u00E9s
-Server=Serveur
-SmartFieldCannotComplete=Aucune proposition pour \u201C{0}\u201C
-SmartFieldMoreThanXRows=Plus de {0} sets de donn\u00E9es. Montre seulement {0}.
-SmartFindLabel=Notation de recherche
-SortDescending=trier par ordre d\u00E9croissant
-Source=Code source
-StatusExportDone=Exportation termin\u00E9e
-StringPattern=Expression
-Style=Mode
-Subject=Concerne
-TableName=Table
-Timestamp=Estampille temporelle
-Title=Titre
-Today=aujourd\u2019hui
-Tomorrow=demain
-TooManyRows=Quantit\u00E9 des donn\u00E9es volumineux. Limiter la recherche s.v.p.
-UncheckAll=Tout d\u00E9s\u00E9lectionner
-Undo=Annuler
-Update=Actualiser
-UserCancelledOperation=L\u2019op\u00E9ration a \u00E9t\u00E9 interrompue manuellement
-UserInterrupted=Annul\u00E9 par l'utilisateur
-Username=Nom d'utilisateur
-Value=Valeur
-VersionMismatchAction=Voulez-vous red\u00E9marrer l\u2019application et effectuer automatiquement l\u2019actualisation ?
-VersionMismatchTextXY=Une actualisation de l\u2019application est n\u00E9cessaire pour continuer \u00E0 travailler.\n\nLa version actuelle est {0}, la nouvelle est {1}.
-VersionMismatchTitle=Actualisation n\u00E9cessaire
-VetoErrorText=Au moins un champ de recherche doit \u00EAtre rempli.
-Week=Semaine
-WeekShort=SC
-WizardBackButton=&Retour
-WizardBackButtonTooltip=Retour \u00E0 l\u2019\u00E9tape ant\u00E9rieure
-WizardCancelButton=Annuler
-WizardCancelButtonTooltip=Annule l\u2019assistant (donn\u00E9es non sauvegard\u00E9es).
-WizardFinishButton=&Cl\u00F4turer
-WizardFinishButtonTooltip=Cl\u00F4turer ce processus et retourner \u00E0 la s\u00E9lection de processus.
-WizardNextButton=&Continuer
-WizardNextButtonTooltip=Continuer \u00E0 la prochaine \u00E9tape
-WizardSuspendButton=&Interrompre
-WizardSuspendButtonTooltip=Interrompt le processus et ferme l\u2019assistant (peut \u00EAtre continu\u00E9 plus tard).
-WorkWeek=Semaine de travail
-XMustBeGreaterThanOrEqualY='{0}' doit \u00EAtre sup\u00E9rieur ou \u00E9gal \u00E0 '{1}'
-XMustBeLessThanOrEqualY='{0}' doit \u00EAtre inf\u00E9rieur ou \u00E9gal \u00E0 '{1}'
-XRows={0} objets
-XSelected={0} s\u00E9lectionn\u00E9
-Yes=Oui
-YesButton=&Oui
-and=et
-between=Entre
-from=de
-searchingProposals=Recherche propositions...
-to=\u00E0
+ActivateBookmarkMenu=Ouvrir le favori
+ActiveAndInactiveStates=Actifs+inactifs
+ActiveStates=Actifs
+AddCustomColumnMenu=Ajouter une colonne...
+All=Tous
+AllStates=Tous
+Apply=Appliquer
+ApplyBookmarkToSearchFailedMessage=Impossible d'appliquer ce favori \u00E0 la recherche actuelle.
+Attribute=Attribut
+Bookmark=Favori
+BookmarkFolder=Dossier
+Bookmarks=Favoris
+BookmarksAddMenu=Ajouter aux f&avoris
+BookmarksApplyToCurrentSearch=Lancer la recherche en utilisant ce favori
+BookmarksMainMenu=&Favoris
+BookmarksManageMenu=&Gestion des favoris
+BookmarksPublishMenu=Activer le favori...
+BookmarksStartPageMenu=&Ecran de lancement
+BookmarksStartPageMenuClear=&Aucun \u00E9cran de lancement
+BookmarksStartPageMenuGoto=&Ouvrir \u00E9cran de lancement
+BookmarksStartPageMenuSet=&Programmer l' \u00E9cran actuelle en vue de lancement
+ButtonDeselectAll=S\u00E9lectionner aucun (e)
+ButtonMoveDown=Vers le bas
+ButtonMoveUp=Vers le haut
+ButtonSelectAll=S\u00E9lectionner tous
+Calendar_earlier=Plus t\u00F4t
+Calendar_later=Plus tard
+Cancel=&Annuler
+CancelButton=&Annuler
+CancelButtonTooltip=Ferme le formue sans enregistrer; dans le cas de doute le syst\u00E8me demande de nouveau.
+ChangePassword=Changer le mot de passe
+CheckAll=Tout s\u00E9lectionner
+ClearColumnSorting=ne pas trier
+Close=Fermer
+CloseButton=&Fermer
+CloseButtonTooltip=Ferme le formue sans enregistrer.
+CodeTypeInit=Code type initialisation
+Column=Colonne
+ColumnFilterCheckedText=S\u00E9lectionn\u00E9s
+ColumnFilterConstraints=Filtres colonnes
+ColumnFilterDateSection=Filtre de la date
+ColumnFilterMenu=Filtre colonne...
+ColumnFilterNullText=Vide
+ColumnFilterNumberSection=Filtre des chiffres
+ColumnFilterRemoveButton=Supprimer le filtre
+ColumnFilterStringSection=Filtre de texte
+ColumnFilterUncheckedText=Non s\u00E9lectionn\u00E9s
+ColumnFilterValuesSection=Filtre des valeurs
+ColumnSortAscending=trier par ordre croissant
+ColumnSorting=Tri
+ColumnValues=Valeurs
+Columns=Colonnes
+ComposerFieldAggregationAvg=Valeur moyenne({0})
+ComposerFieldAggregationCount=Nombre({0})
+ComposerFieldAggregationLabel=Fonction
+ComposerFieldAggregationMax=Maximum({0})
+ComposerFieldAggregationMedian=M\u00E9dian({0})
+ComposerFieldAggregationMin=Minimum({0})
+ComposerFieldAggregationSum=Somme({0})
+Condensed=6 colonnes
+Configure=Configuration
+Copy=Copier
+CopyWidthsOfColumnsMenu=Copier les largeurs des colonnes
+Criteria=Crit\u00E8res de recherche
+Cut=Couper
+Day=Jour
+DefaultPasswordPolicyText=Le mot de passe ne r\u00E9pond pas aux r\u00E8gles\n\nR\u00E8gles\:\n- Au moins 8 caract\u00E8res\n- Au moins un nombre (0-9)\n- Au moins un caract\u00E8re non standard (\!|@|\#|$|%|^|&|*|(|)|_|+|||~|-|
+DeleteBookmarkMenu=Supprimer le favori
+DeleteConfirmationText=Voulez-vous vraiment annuler?
+DeleteConfirmationTextNoItemList=Voulez-vous supprimer ces fichiers ?
+DeleteConfirmationTextNoItemListX=Voulez-vous supprimer ces {0} ?
+DeleteConfirmationTextX=Voulez-vous supprimer les {0} suivants ?
+DeleteConfirmationTitle=Confirmer l\u2019annulation
+DeleteFolderMenu=Supprimer le dossier
+DeleteMenu=Supprimer
+Detail=D\u00E9tail
+DetailedVersion=Version d\u00E9taill\u00E9e
+Details=D\u00E9tails
+EditBookmarkMenu=Modifier le favori...
+EmailCc=CC
+EmailFrom=De
+EmailSent=Envoy\u00E9
+EmailSubject=Objet
+EmailTo=\u00C0
+Enabled=Activ\u00E9
+EndDate=Date finale
+Error=Erreur
+ErrorAndRetryTextDefault=Un erreur est apparu
+ErrorTextLogin=Mauvais nom d'utilisateur / mot de passe
+ErrorTextSecurity=L'acc\u00E8s a \u00E9t\u00E9 refus\u00E9.
+ErrorTitleLogin=\u00C9chec d'authentification
+ErrorTitleSecurity=Erreur d'acc\u00E8s
+ExcelChart_Button_LoadDefaults=R\u00E9glages standard
+ExcelChart_Button_LoadDefaultsHint=Remet ce formulaire au niveau initial en t\u00E9l\u00E9chargeant les r\u00E9glages standard.
+ExcelChart_Button_LoadProfile=T\u00E9l\u00E9charger le profil\u2026
+ExcelChart_Button_LoadProfileHint=T\u00E9l\u00E9charge des r\u00E9glages sauvegard\u00E9s \u00E0 partir d\u2019un fichier XML.
+ExcelChart_Button_SaveProfile=Sauvegarder le profil\u2026
+ExcelChart_Button_SaveProfileHint=Sauvegarde les r\u00E9glages actuels dans un fichier XML.
+ExcelChart_Error_CreatingChartFailed=la cr\u00E9ation du diagramme a \u00E9chou\u00E9.
+ExcelChart_Error_ExportingFailed=L\u2019export a \u00E9chou\u00E9, vu que
+ExcelChart_Error_InitializationFailed=l\u2019initialisation de la / des classes de support a \u00E9chou\u00E9.
+ExcelChart_Error_LoadingProfileFailed=Le t\u00E9l\u00E9chargement du profil a \u00E9chou\u00E9, vu que
+ExcelChart_Error_LoadingTemplateFailed=le mod\u00E8le n\u2019a pas pu \u00EAtre t\u00E9l\u00E9charg\u00E9.
+ExcelChart_Error_RetrivingOutlineDataFailed=les donn\u00E9es outlines n\u2019ont pas pu \u00EAtre lues.
+ExcelChart_Error_SavingProfileFailed=La sauvegarde du profil a \u00E9chou\u00E9, vu que
+ExcelChart_Error_WrongProfile=ce profil a \u00E9t\u00E9 cr\u00E9\u00E9 pour un autre contour.
+ExcelChart_Label_AutomaticMode=Mode automatique
+ExcelChart_Label_AutomaticModeHint=Cacher Excel et sauvegarder automatiquement.
+ExcelChart_Label_ChartNumber=N\u00B0 de diagramme
+ExcelChart_Label_ChartType=Type de diagramme
+ExcelChart_Label_FileName=Nom de fichier
+ExcelChart_Label_FirstRow=Premi\u00E8re ligne
+ExcelChart_Label_Height=Hauteur
+ExcelChart_Label_HistogramMode=Mode histogramme
+ExcelChart_Label_HistogramModeHint=Des valeurs identiques de l\u2019axe X sont r\u00E9sum\u00E9es dans le mode histogramme.
+ExcelChart_Label_LastRow=Derni\u00E8re ligne
+ExcelChart_Label_Offset=Position
+ExcelChart_Label_SkipNullValues=Ignorer les valeurs vides
+ExcelChart_Label_SkipNullValuesHint=Si elles sont activ\u00E9es, les valeurs vides figurant sur l\u2019axe X sont ignor\u00E9es dans le mode histogramme, autrement elles sont r\u00E9sum\u00E9es en <Inconnu>
+ExcelChart_Label_TemplateName=Mod\u00E8le
+ExcelChart_Label_UseCustomFormat=Utiliser son propre format
+ExcelChart_Label_UseCustomFormatHint=Permet de d\u00E9terminer la taille et la position du diagramme.
+ExcelChart_Label_UseExistingChart=Utiliser le diagramme existant
+ExcelChart_Label_UseExistingChartHint=Utilise le diagramme existant d\u00E9j\u00E0 dans le mod\u00E8le indiqu\u00E9.
+ExcelChart_Label_UseSelectiveExport=S\u00E9lectionner les lignes
+ExcelChart_Label_UseSelectiveExportHint=N\u2019exporte que les lignes dans le secteur indiqu\u00E9 en bas.
+ExcelChart_Label_Width=Largeur
+ExcelChart_Label_WorksheetName=Feuille du tableau
+ExcelChart_Label_XAxis=Axe X
+ExcelChart_Label_YAxes=Axes Y
+ExcelChart_Status_Done=Diagramme Excel export termin\u00E9.
+ExcelChart_Tab_Advanced=Elargi
+ExcelChart_Tab_Basic=Standard
+ExcelChart_Title_MainForm=Export diagramme Excel
+ExcelChart_Type_Area3D=Surface 3D
+ExcelChart_Type_Area=Surface
+ExcelChart_Type_AreaStacked3D=Surface empil\u00E9e 3D
+ExcelChart_Type_AreaStacked=Surface empil\u00E9e
+ExcelChart_Type_BarsClustered3D=Barre group\u00E9e 3D
+ExcelChart_Type_BarsClustered=Barre group\u00E9e
+ExcelChart_Type_BarsStacked3D=Barre empil\u00E9e 3D
+ExcelChart_Type_BarsStacked=Barre empil\u00E9e
+ExcelChart_Type_ColumnsClustered3D=Colonnes group\u00E9s 3D
+ExcelChart_Type_ColumnsClustered=Colonnes group\u00E9s
+ExcelChart_Type_ColumnsStacked3D=Colonnes empil\u00E9s 3D
+ExcelChart_Type_ColumnsStacked=Colonnes empil\u00E9s
+ExcelChart_Type_Line=Ligne
+ExcelChart_Type_LineStacked=Ligne empil\u00E9e
+ExcelChart_Type_Pie3D=Secteurs 3D
+ExcelChart_Type_Pie=Secteurs
+ExcelChart_Type_PieExploded3D=Secteurs dispers\u00E9s 3D
+ExcelChart_Type_PieExploded=Secteurs dispers\u00E9s
+ExcelChart_Various_Averaged=moyenne
+ExcelChart_Various_Column=Colonne
+ExcelChart_Various_Frequency=Fr\u00E9quence
+ExcelChart_Various_SummedUp=additionn\u00E9
+ExcelChart_Various_Unknown=<Inconnu>
+ExcelChart_WorksheetName_Chart=Diagramme
+ExcelChart_WorksheetName_Data=Donn\u00E9es du diagramme
+ExecutionTime=Traitement du serveur
+ExportDate=Date d'exportation
+ExtendedSearchAddAdditionalOrMenu=En suppl\u00E9ment ou ajouter
+ExtendedSearchAddAttribute=Condition
+ExtendedSearchAddAttributeMenu=Ajouter une condition...
+ExtendedSearchAddEitherOrMenu=Ins\u00E9rer ou...ou
+ExtendedSearchAddEntityPrefix=a
+ExtendedSearchAnd=et
+ExtendedSearchEditAttributeMenu=Modifier...
+ExtendedSearchEither=ou
+ExtendedSearchEntitySuffix=avec
+ExtendedSearchNegateMenu=N\u00E9gation
+ExtendedSearchNot=ne... pas
+ExtendedSearchOr=ou
+ExtendedSearchRemoveAttributeMenu=Supprimer
+ExtendedSearchRemoveMenu=Supprimer
+FileExistsOwerwriteQuestion=Le fichier s\u00E9lectionn\u00E9 existe d\u00E9j\u00E0. Voulez-vous quand m\u00EAme enregistrer?
+FileName=Nom de fichier
+FileNotFoundExceptionMessage=Fichier introuvable ou inaccessible.
+FileNotFoundMessage=Le fichier suivant n'a pas \u00E9t\u00E9 trouv\u00E9\:\n{0}
+FileNotFoundTitle=Fichier introuvable
+FilesOfType=Type de fichier
+FilterBookmarkTree=Rechercher dans les favoris
+Folders=Classeur
+FormButtonClicked=En cliquant sur un bouton
+FormCloseTimerActivated=Activation du cadenceur de cl\u00F4ture de formulaire
+FormClosing=Fermer
+FormEmptyMandatoryFieldsMessage=Les champs suivants doivent \u00EAtre remplis
+FormExportXml=Export vers XML
+FormFinally=Cl\u00F4turer
+FormFireActivated=En activant le formulaire / lors de l\u2019activation du formulaire
+FormFireClosed=En cl\u00F4turant le formulaire
+FormFireDiscarded=En rejetant le formulaire
+FormFireStructureChanged=En modifiant la structure du formulaire
+FormIncompleteIntro=Tous les champs obligatoires n\u2019ont pas \u00E9t\u00E9 remplis.
+FormInvalidFieldsMessage=Les champs suivants ont une valeur invalide
+FormPrint=Imprimer
+FormReset=Remettre
+FormSaveChangesQuestion=Est-ce-que vous voulez enregistrer les modifications?
+FormStateLoad=Ouvrir...
+FormStateStore=Enregistrer
+FormStateStoreAs=Enregistrer sous...
+FormTimerActivated=Compteur de temps activ\u00E9
+FormattingLocale=Formatage
+GlobalBookmarks=Favoris Globals
+GlobalBookmarksAddMenu=Ajouter aux favoris &globals
+Help=Aide
+Host=Ordinateur h\u00F4te
+Hour=Heure
+IOErrorInfo=Veuillez contr\u00F4ler les fichiers concern\u00E9s et la connexion au serveur.
+IOErrorText=Erreur de communication
+IOErrorTitle=Erreur de lecture/d'\u00E9criture
+InDaysX=entre {0} jours
+InactiveState=Inactif
+InactiveStates=Inactifs
+Info=Informations
+Information=Information
+Interrupted=Interrompu
+InterruptedErrorText=Le Proc\u00E8s a \u00E9t\u00E9 interrumpu.
+InterruptedErrorTitle=Proc\u00E8s interrompu
+InvalidNumberMessageX="{0}" est un chiffre invalide
+InvalidPhoneNumberMessageX="{0}" est un num\u00E9ro de t\u00E9l\u00E9phone invalide
+InvalidValueMessageX="{0}" est une valeur invalide
+JavaVMVersion=Java VM
+JavaVersion=Java Runtime
+KeyStroke=Combinaison de touches
+Language=Langue
+Live=Live
+LoadFormXmlFailedText=Ce fichier ne provient pas de ce formue.
+LogicBetween=est entre {0} et {1}
+LogicBetweenShort=entre
+LogicDateIsInDays=est exactement dans {0} jours
+LogicDateIsInGEDays=est au plus t\u00F4t dans {0} jours
+LogicDateIsInGEMonths=est au plus t\u00F4t dans {0} mois
+LogicDateIsInLEDays=est au plus tard dans {0} jours
+LogicDateIsInLEMonths=est au plus tard dans {0} mois
+LogicDateIsInLastDays=\u00E9tait dans les {0} derniers jours
+LogicDateIsInLastMonths=\u00E9tait dans les {0} derniers mois
+LogicDateIsInMonths=est exactement dans {0} mois
+LogicDateIsInNextDays=est dans les {0} prochains jours
+LogicDateIsInNextMonths=est dans les {0} prochains mois
+LogicDateIsNotToday=n\u2019est pas aujourd\u2019hui
+LogicDateIsToday=est aujourd\u2019hui
+LogicDateTimeIsInGEHours=est au plus t\u00F4t dans {0} heures
+LogicDateTimeIsInGEMinutes=est au plus t\u00F4t dans {0} minutes
+LogicDateTimeIsInLEHours=est au plus tard dans {0} heures
+LogicDateTimeIsInLEMinutes=est au plus tard dans {0} minutes
+LogicDateTimeIsNotNow=n\u2019est pas maintenant
+LogicDateTimeIsNow=est maintenant
+LogicEQ=\=
+LogicEndsWith=finit avec
+LogicGE=>\=
+LogicGT=>
+LogicIn=est
+LogicLE=<\=
+LogicLT=<
+LogicLike=contient
+LogicNEQ=<>
+LogicNotEndsWith=ne se termine pas par
+LogicNotIn=n'est pas
+LogicNotLike=ne contient pas
+LogicNotNull=n'est pas vide
+LogicNotStartsWith=ne commence pas par
+LogicNull=est vide
+LogicStartsWith=commence avec
+LogicTimeIsInGEHours=est au plus t\u00F4t dans {0} heures
+LogicTimeIsInGEMinutes=est au plus t\u00F4t dans {0} minutes
+LogicTimeIsInHours=est exactement dans {0} heures
+LogicTimeIsInLEHours=est au plus tard dans {0} heures
+LogicTimeIsInLEMinutes=est au plus tard dans {0} minutes
+LogicTimeIsInMinutes=est exactement dans {0} minutes
+LogicTimeIsNotNow=n\u2019est pas maintenant
+LogicTimeIsNow=est maintenant
+Login=Inscription
+LookAndFeel=Look and feel
+LookIn=Chercher dans
+MemoryStatus=M\u00E9moire
+Minute=Minute
+ModifyCustomColumnMenu=Modifier la colonne...
+Month=Mese
+Name=Nom
+NetErrorInfo=Veuillez contr\u00F4ler le nom, l'adresse du serveur et la connexion.
+NetErrorText=Serveur introuvable
+NetErrorTitle=Erreur r\u00E9seau
+NetworkLatency=Ralentissement du r\u00E9seau
+NewBookmarkFolderMenu=Nouveau dossier...
+NewPassword=Mot de passe nouveau
+No=Non
+NoButton=&Non
+None=Rien
+NumberOfRows=Nombre d'enregistrement
+NumberTooLargeMessageXY=La valeur est trop grande; doit se situer entre {0} et {1} .
+NumberTooSmallMessageXY=La valeur est trop petite; doit se situer entre {0} et {1}.
+OSUser=Syst\u00E8me utilisateur
+OSVersion=Version du syst\u00E8me
+OcrEditorMoveTool=D\u00E9placer l'image
+OcrEditorNextPage=Page suivante
+OcrEditorOCRTool=Reconnaissance de texte
+OcrEditorOfX=de
+OcrEditorPage=Page
+OcrEditorPreviousPage=Page pr\u00E9c\u00E9dente
+OcrEditorRotateLeft=Tourner vers la gauche
+OcrEditorRotateRight=Tourner vers la droite
+OcrEditorZoomIn=Agrandir
+OcrEditorZoomOut=R\u00E9duire
+OcrEditorZoomToFit=Adapter
+Ok=Ok
+OkButton=&Ok
+OkButtonTooltip=Enregistre et ferme le formue
+OldPassword=Mot de passe vieux
+OneRow=1 objet
+OneSelected=1 s\u00E9lectionn\u00E9
+Op=Op\u00E9rateur
+Open=Ouvrir
+OrganizeTableColumnsMenu=Organiser les colonnes...
+OrganizeTableColumnsTitle=Organiser les colonnes
+OriginalErrorMessageIs=Le message d\u2019erreur d\u2019origine est\:\r\n{0}
+OutlineSelectorAddOrRemoveButtons=Surajouter ou \u00E9carter de &boutons
+OutlineSelectorShowFewerButtons=&Moins boutons
+OutlineSelectorShowMoreButtons=&Plus boutons
+Password=Mot de passe
+PasswordHasExpiredHeader=Votre mot de passe a expir\u00E9, vous devriez le modifier d\u00E8s maintenant.
+PasswordHasExpiredTitle=Mot de passe expir\u00E9
+PasswordMin8Chars=au moins 8 caract\u00E8res
+PasswordMinOnNonStdChar=au moins un caract\u00E8re sp\u00E9cial
+PasswordMinOneChar=au moins une lettre a-z/A-Z
+PasswordMinOneDigit=au moins un chiffre 0-9
+PasswordNotSameAsLasts=Le mot de passe ne doit pas \u00EAtre le m\u00EAme que la derni\u00E8re fois.
+PasswordUsernameNotPartOfPass=Le mot de passe ne peut pas \u00EAtre une partie du nom d'utilisateur.
+PasswordWillExpireHeaderX=Votre mot de passe expire {0}.
+PasswordWillExpireInfo=Souhaitez-vous le modifier maintenant ?
+PasswordWillExpireTitle=Votre mot de passe expire.
+PasswordsDoNotMatch=Les deux mots de passe ne correspondons pas.
+Paste=Coller
+PasteTextTooLongForFieldX=Le texte ins\u00E9r\u00E9 est trop long et a \u00E9t\u00E9 raccourci. Le nombre maximal de caract\u00E8res est de {0}.
+Path=Chemin
+Pending=Veuillez patienter\u0085
+Properties=Propri\u00E9t\u00E9s
+Redo=R\u00E9tablir
+RemoveAllCustomColumnsMenu=Supprimer mes colonnes
+RemoveCustomColumnMenu=Supprimer une colonne
+RenameBookmarkFolderMenu=Renommer le dossier...
+RepBuildExtract=Pr\u00E9paration des donn\u00E9es\u0085
+RepExecAfter=Nettoyer la base de donn\u00E9es
+RepExecBefore=Pr\u00E9parer la base de donn\u00E9es
+RepUpdate=Traitement des donn\u00E9es\u0085
+RepeatPassword=R\u00E9p\u00E9ter
+RequestProblem=Erreur d'emploi
+ResetButton=&R\u00E9initialiser
+ResetButtonTooltip=Transforme tout les formues en valeurs vide.
+ResetTableColumnFilter=Filtre
+ResetTableColumns=R\u00E9initialiser les colonnes
+ResetTableColumnsAll=Tout
+ResetTableColumnsOrder=Ordre
+ResetTableColumnsSorting=Tri
+ResetTableColumnsView=Voir
+ResetTableColumnsWidth=Largeur
+SC_Copyright=Le contr\u00F4le orthographique et les dictionnaires Sentry sont prot\u00E9g\u00E9s en droits d\u2019auteurs par le logiciel Wintertree Inc.
+SC_DialogTitle=Contr\u00F4le orthographique
+SC_DialogTitle_Options=Contr\u00F4le orthographique\: options
+SC_Help_AddToDictionary=Ajoute le mot au dictionnaire d\u2019utilisateur
+SC_Help_Cancel=Ferme le dialogue et rejette toutes les modifications (touche rapide\: ESC)
+SC_Help_Change=Modifie l\u2019apparition actuelle du mot
+SC_Help_ChangeAll=Modifie toutes les apparitions du mot (dans le champ de texte actuel)
+SC_Help_Enable=Active ou d\u00E9sactive le contr\u00F4le orthographique Scout
+SC_Help_Ignore=Ignore l\u2019apparition actuelle du mot
+SC_Help_IgnoreAll=A ignor\u00E9 cette acception et toutes les indications suivantes du mot
+SC_Help_IgnoreCase=Ignorer la casse
+SC_Help_IgnoreDomainNames=Ignore par exemple \u201Awww.bsiag.com\u2019
+SC_Help_IgnoreWordsWithNumbers=Ignore les mots avec des chiffres
+SC_Help_Language=La langue s\u00E9lectionn\u00E9e
+SC_Help_Options=Ouvre le dialogue options
+SC_Help_RemoveWord=Supprime le mot marqu\u00E9 du dictionnaire de l\u2019utilisateur
+SC_Help_ReplacementWord=Le mot par lequel le mot marqu\u00E9 doit \u00EAtre remplac\u00E9 (appuyez sur ENTER pour remplacer le mot non reconnu par celui-l\u00E0)
+SC_Help_Shortcut=La touche rapide pour le dialogue de correction orthographique. Fixe, ne peut pas \u00EAtre modifi\u00E9e.
+SC_Help_SuggestionList=Proposition de remplacement du mot marqu\u00E9 (double-cliquer pour remplacer le mot non reconnu par le mot s\u00E9lectionn\u00E9)
+SC_Help_Undo=Annule la derni\u00E8re modification
+SC_Help_UseDefaults=Remettre tous les r\u00E9glages sur les valeurs standard
+SC_Help_UserDictionary=S\u00E9lectionnez un dictionnaire \u201Atlx\u2019 (scout) ou \u201Adic\u2019 (Microsoft Word) en tant que dictionnaire d\u2019utilisateur
+SC_Label_AddToDictionary=Ajouter
+SC_Label_Cancel=Interrompre
+SC_Label_Capitalization=Majuscules-minuscules
+SC_Label_Change=Modifier
+SC_Label_ChangeAll=Modifier tous
+SC_Label_ChangeTo=Modifier selon
+SC_Label_ConsiderChanging=Prendre en compte la modification
+SC_Label_ContainsDigits=Contient des chiffres
+SC_Label_DoubledWord=Le mot appara\u00EEt deux fois
+SC_Label_Enable=Activer le contr\u00F4le orthographique
+SC_Label_Ignore=Ignorer
+SC_Label_IgnoreAll=Ignorer tous
+SC_Label_IgnoreCase=Ignorer majuscules / minuscules
+SC_Label_IgnoreDomainNames=Ignorer domaine du nom
+SC_Label_IgnoreWordsWithNumbers=Ignorer les mots avec des chiffres
+SC_Label_IgnoredWord=Mots d\u00E9finis par l'utilisateur
+SC_Label_Main=Orthographe
+SC_Label_MixedCase=Majuscules / minuscules m\u00E9lang\u00E9es
+SC_Label_NoSuggestions=(Aucune proposition)
+SC_Label_NotInDictionary=Le mot marqu\u00E9 n\u2019a pas \u00E9t\u00E9 reconnu
+SC_Label_Options=Options\u2026
+SC_Label_RemoveWord=Supprimer le mot
+SC_Label_Shortcut=Touche rapide
+SC_Label_Spelling=Orthographe
+SC_Label_Undo=Annul\u00E9
+SC_Label_UseDefaults=Standard
+SC_Label_UserDictionary=Dictionnaire de l\u2019utilisateur
+SC_Language=Langue
+SC_Message_CheckRest=Voulez-vous contr\u00F4ler le reste du texte?
+SC_Message_Complete=Le contr\u00F4le orthographique est complet
+SC_Message_CompleteForSelection=Le contr\u00F4le orthographique est complet pour le marquage actuel
+SC_Message_NotAvailable=Le contr\u00F4le de l\u2019orthographe Scout n\u2019est pas disponible
+Save=Enregistrer
+SaveButton=&Enregistrer
+SaveButtonTooltip=Enregistrer sans fermer le formue
+SavePassword=Sauvegarder le nom d'utilisateur/mot de passe
+ScoutStarting=Lancement de Scout
+Search=Chercher
+SearchButton=&Recherche
+SearchButtonTooltip=D\u00E9marrage de la recherche
+SearchConstraints=Contrainte de recherche
+SearchTextIsTooGeneral=Pr\u00E9ciser les crit\u00E8res de recherche
+SelectedStates=Uniquement marqu\u00E9s
+Server=Serveur
+SmartFieldCannotComplete=Aucune proposition pour \u201C{0}\u201C
+SmartFieldMoreThanXRows=Plus de {0} sets de donn\u00E9es. Montre seulement {0}.
+SmartFindLabel=Notation de recherche
+SortDescending=trier par ordre d\u00E9croissant
+Source=Code source
+StatusExportDone=Exportation termin\u00E9e
+StringPattern=Expression
+Style=Mode
+Subject=Concerne
+TableName=Table
+Timestamp=Estampille temporelle
+Title=Titre
+Today=aujourd\u2019hui
+Tomorrow=demain
+TooManyRows=Quantit\u00E9 des donn\u00E9es volumineux. Limiter la recherche s.v.p.
+UncheckAll=Tout d\u00E9s\u00E9lectionner
+Undo=Annuler
+Update=Actualiser
+UserCancelledOperation=L\u2019op\u00E9ration a \u00E9t\u00E9 interrompue manuellement
+UserInterrupted=Annul\u00E9 par l'utilisateur
+Username=Nom d'utilisateur
+Value=Valeur
+VersionMismatchAction=Voulez-vous red\u00E9marrer l\u2019application et effectuer automatiquement l\u2019actualisation ?
+VersionMismatchTextXY=Une actualisation de l\u2019application est n\u00E9cessaire pour continuer \u00E0 travailler.\n\nLa version actuelle est {0}, la nouvelle est {1}.
+VersionMismatchTitle=Actualisation n\u00E9cessaire
+VetoErrorText=Au moins un champ de recherche doit \u00EAtre rempli.
+Week=Semaine
+WeekShort=SC
+WizardBackButton=&Retour
+WizardBackButtonTooltip=Retour \u00E0 l\u2019\u00E9tape ant\u00E9rieure
+WizardCancelButton=Annuler
+WizardCancelButtonTooltip=Annule l\u2019assistant (donn\u00E9es non sauvegard\u00E9es).
+WizardFinishButton=&Cl\u00F4turer
+WizardFinishButtonTooltip=Cl\u00F4turer ce processus et retourner \u00E0 la s\u00E9lection de processus.
+WizardNextButton=&Continuer
+WizardNextButtonTooltip=Continuer \u00E0 la prochaine \u00E9tape
+WizardSuspendButton=&Interrompre
+WizardSuspendButtonTooltip=Interrompt le processus et ferme l\u2019assistant (peut \u00EAtre continu\u00E9 plus tard).
+WorkWeek=Semaine de travail
+XMustBeGreaterThanOrEqualY='{0}' doit \u00EAtre sup\u00E9rieur ou \u00E9gal \u00E0 '{1}'
+XMustBeLessThanOrEqualY='{0}' doit \u00EAtre inf\u00E9rieur ou \u00E9gal \u00E0 '{1}'
+XRows={0} objets
+XSelected={0} s\u00E9lectionn\u00E9
+Yes=Oui
+YesButton=&Oui
+and=et
+between=Entre
+from=de
+searchingProposals=Recherche propositions...
+to=\u00E0
diff --git a/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_fr_BE.properties b/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_fr_BE.properties
index f9ca50eb07..4aa874a70d 100644
--- a/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_fr_BE.properties
+++ b/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_fr_BE.properties
@@ -1,389 +1,389 @@
-ActivateBookmarkMenu=Ouvrir marque-page
-ActiveAndInactiveStates=Active+Inactive
-ActiveStates=Active
-AllStates=Tout
-Apply=Appliquer
-ApplyBookmarkToSearchFailedMessage=Ce marque-page n'est pas applicable \u00E0 la recherche en cours
-Attribute=Attribuer
-Bookmark=Favori
-BookmarkFolder=R\u00E9pertoire
-Bookmarks=Favoris
-BookmarksAddMenu=&Ajouter au favoris
-BookmarksApplyToCurrentSearch=Effectuer recherche en utilisant ce marque-page
-BookmarksMainMenu=&Favoris
-BookmarksManageMenu=&Organiser les favoris
-BookmarksPublishMenu=Publier marque-page\u2026
-BookmarksStartPageMenu=&Page d'accueil
-BookmarksStartPageMenuClear=&Pas de vue de d\u00E9marrage
-BookmarksStartPageMenuGoto=&Ouvrir la page d'accueil
-BookmarksStartPageMenuSet=&Faire de la vue actuelle la page d'accueil
-ButtonDeselectAll=Tout d\u00E9s\u00E9lectionner
-ButtonMoveDown=En bas
-ButtonMoveUp=En haut
-ButtonSelectAll=Tout s\u00E9lectionner
-Calendar_earlier=Plus t\u00F4t
-Calendar_later=Plus tard
-Cancel=Annuler
-CancelButton=&Annuler
-CancelButtonTooltip=Fermer la fen\u00EAtre sans sauvegarder, avec confirmation si n\u00E9cessaire.
-ChangePassword=Changer le mot de passe
-CloseButton=&Fermer
-CloseButtonTooltip=Fermer la fen\u00EAtre sans sauvegarder
-CodeTypeInit=Initialisation type de code
-Column=Colonne
-Columns=Colonnes
-ComposerFieldAggregationAvg=Moyen({0})
-ComposerFieldAggregationCount=D\u00E9compte({0})
-ComposerFieldAggregationLabel=Fonction
-ComposerFieldAggregationMax=Maximum({0})
-ComposerFieldAggregationMedian=M\u00E9dian({0})
-ComposerFieldAggregationMin=Minimum({0})
-ComposerFieldAggregationSum=Somme({0})
-Condensed=6 colonnes
-Copy=Copier
-Cut=Coupe
-Day=Jour
-DefaultPasswordPolicyText=Le mot de passe ne correspond pas aux directives donn\u00E9es.\n\nDirectives\:\n- au moins 8 caract\u00E8res\n- au moins un num\u00E9ro (0-9)\n- au moins un caract\u00E8re non standard (\!|@|\#|$|%|^|&|*|(|)|_|+|||~|-|
-DeleteBookmarkMenu=Supprimer marque-page
-DeleteConfirmationText=Voulez-vous supprimer les donn\u00E9es suivantes ?
-DeleteConfirmationTextNoItemList=Voulez-vous supprimer cette donn\u00E9e ?
-DeleteConfirmationTextNoItemListX=Voulez-vous supprimer ceci {0} ?
-DeleteConfirmationTextX=Voulez-vous effacer ce qui suit {0} ?
-DeleteConfirmationTitle=Confirmer suppression
-DeleteFolderMenu=Supprimer dossier
-DetailedVersion=Version d\u00E9taill\u00E9e
-EditBookmarkMenu=Editer marque-page\u2026
-EmailCc=CC
-EmailFrom=A partir de
-EmailSubject=Sujet
-EmailTo=Vers
-Error=Erreur
-ErrorAndRetryTextDefault=Une erreur s'est produite durant le transfert des donn\u00E9es.
-ErrorTextLogin=Nom d'utilisateur ou mot de passe incorrect
-ErrorTitleLogin=Echec de connection
-ExcelChart_Button_LoadDefaults=D\u00E9fauts
-ExcelChart_Button_LoadDefaultsHint=Red\u00E9marre ce dialogue en chargeant les valeurs par d\u00E9faut
-ExcelChart_Button_LoadProfile=Profile de chargement
-ExcelChart_Button_LoadProfileHint=Charge les configurations d'un fichier XML
-ExcelChart_Button_SaveProfile=Sauver le profile...
-ExcelChart_Button_SaveProfileHint=Sauve les configurations actuelles dans un fichier XML
-ExcelChart_Error_CreatingChartFailed=Echec de la cr\u00E9ation du graphique
-ExcelChart_Error_ExportingFailed=Echec de l'exportation car
-ExcelChart_Error_InitializationFailed=Echec de l'initialisation des classes de support
-ExcelChart_Error_LoadingProfileFailed=Echec du chargement du profile car
-ExcelChart_Error_LoadingTemplateFailed=Echec du chargement du mod\u00E8le
-ExcelChart_Error_RetrivingOutlineDataFailed=Echec de la r\u00E9cup\u00E9ration de la configuration
-ExcelChart_Error_SavingProfileFailed=Echec de l'enregistrement du profile car
-ExcelChart_Error_WrongProfile=le profile a \u00E9t\u00E9 cr\u00E9\u00E9 \u00E0 partire d'une autre configuration
-ExcelChart_Label_AutomaticMode=Mode automatique
-ExcelChart_Label_AutomaticModeHint=Cacher Excel et enregistrer automatiquement
-ExcelChart_Label_ChartNumber=Num\u00E9ro de graphique
-ExcelChart_Label_ChartType=Type de graphique
-ExcelChart_Label_FileName=Nom de fichier
-ExcelChart_Label_FirstRow=Premi\u00E8re ligne
-ExcelChart_Label_Height=Hauteur
-ExcelChart_Label_HistogramMode=Mode historique
-ExcelChart_Label_HistogramModeHint=Le mode historique combine les m\u00EAmes valeurs de l'axe X en une seule
-ExcelChart_Label_LastRow=Derni\u00E8re ligne
-ExcelChart_Label_Offset=Position
-ExcelChart_Label_SkipNullValues=Laisse tomber les valeurs nulles en mode historique
-ExcelChart_Label_SkipNullValuesHint=Si les valeurs nulles sur l'axe X sont ignor\u00E9es, sinon elles sont combin\u00E9es en <Inconnu>
-ExcelChart_Label_TemplateName=Mod\u00E8le
-ExcelChart_Label_UseCustomFormat=Utiliser le mod\u00E8le standard
-ExcelChart_Label_UseCustomFormatHint=Si coch\u00E9, vous pouvez indiquer la position et taille du graphique
-ExcelChart_Label_UseExistingChart=Utiliser le graphique existant
-ExcelChart_Label_UseExistingChartHint=Si coch\u00E9, le graphique existant dans le mod\u00E8le indiqu\u00E9 est utilis\u00E9
-ExcelChart_Label_UseSelectiveExport=Utiliser une exportation s\u00E9lective
-ExcelChart_Label_UseSelectiveExportHint=Si coch\u00E9es, uniquement les lignes marqu\u00E9es ci-dessous seront export\u00E9es
-ExcelChart_Label_Width=Largeur
-ExcelChart_Label_WorksheetName=Feuille de travail
-ExcelChart_Label_XAxis=Axe X
-ExcelChart_Label_YAxes=Axe Y
-ExcelChart_Status_Done=Exportation du Graphique Excel termin\u00E9e
-ExcelChart_Tab_Advanced=Avanc\u00E9
-ExcelChart_Tab_Basic=Basique
-ExcelChart_Title_MainForm=Exportation du Graphique Excel
-ExcelChart_Type_Area3D=Surface 3D
-ExcelChart_Type_Area=Surface
-ExcelChart_Type_AreaStacked3D=Surface superpos\u00E9e 3D
-ExcelChart_Type_AreaStacked=Surface superpos\u00E9e
-ExcelChart_Type_BarsClustered3D=Barres group\u00E9es 3D
-ExcelChart_Type_BarsClustered=Barres group\u00E9es
-ExcelChart_Type_BarsStacked3D=Barres superpos\u00E9es 3D
-ExcelChart_Type_BarsStacked=Barres superpos\u00E9es
-ExcelChart_Type_ColumnsClustered3D=Colonnes group\u00E9es 3D
-ExcelChart_Type_ColumnsClustered=Colonnes group\u00E9es
-ExcelChart_Type_ColumnsStacked3D=Colonnes superpos\u00E9es 3D
-ExcelChart_Type_ColumnsStacked=Colonnes superpos\u00E9es
-ExcelChart_Type_Line=Ligne
-ExcelChart_Type_LineStacked=Ligne superpos\u00E9e
-ExcelChart_Type_Pie3D=G\u00E2teau 3D
-ExcelChart_Type_Pie=G\u00E2teau
-ExcelChart_Type_PieExploded3D=G\u00E2teau explos\u00E9 3D
-ExcelChart_Type_PieExploded=G\u00E2teau explos\u00E9
-ExcelChart_Various_Averaged=moyenne
-ExcelChart_Various_Column=Colonne
-ExcelChart_Various_Frequency=Fr\u00E9quence
-ExcelChart_Various_SummedUp=Additionn\u00E9
-ExcelChart_Various_Unknown=<Inconnu>
-ExecutionTime=traitement serveur
-ExportDate=Date d'exportation
-ExtendedSearchAddAdditionalOrMenu=Ajouter en plus ou ins\u00E9rer
-ExtendedSearchAddAttribute=Contrainte
-ExtendedSearchAddAttributeMenu=Ajouter crit\u00E8re
-ExtendedSearchAddEitherOrMenu=Ajouter soit\u2026ou
-ExtendedSearchAddEntityPrefix=a
-ExtendedSearchAnd=et
-ExtendedSearchEditAttributeMenu=Modifier
-ExtendedSearchEither=l'un ou l'autre
-ExtendedSearchEntitySuffix=avec
-ExtendedSearchNegateMenu=N\u00E9gation
-ExtendedSearchNot=ne pas
-ExtendedSearchOr=ou
-ExtendedSearchRemoveAttributeMenu=Enlever
-ExtendedSearchRemoveMenu=Enlever
-FileExistsOwerwriteQuestion=Le fichier s\u00E9lectionn\u00E9 existe d\u00E9j\u00E0. Voulez-vous le remplacer?
-FileName=Nom du fichier
-FileNotFoundMessage=Impossible de trouver le fichier\:
-FileNotFoundTitle=Fichier introuvable.
-FilesOfType=Type de fichier
-FilterBookmarkTree=Parcourir les marque-pages
-Folders=Dossiers
-FormButtonClicked=Tout en cliquant sur un bouton
-FormCloseTimerActivated=Minuteur de fermeture activ\u00E9
-FormClosing=Fermer
-FormEmptyMandatoryFieldsMessage=Les champs suivants sont requis
-FormExportXml=Exporter en XML
-FormFinally=Finaliser
-FormFireActivated=Lorsque le formulaire a \u00E9t\u00E9 activ\u00E9
-FormFireClosed=Lorsque le formulaire a \u00E9t\u00E9 ferm\u00E9
-FormFireDiscarded=Lorsque le formulaire a \u00E9t\u00E9 supprim\u00E9
-FormFireStructureChanged=Lorsque la structure du formulaire a chang\u00E9
-FormFireToBack=Lors de l'envoi du formulaire \u00E0 l'arri\u00E8re
-FormFireToFront=Lors de l'envoi du formulaire \u00E0 l'avant
-FormIncompleteIntro=Tous les champs obligatoires ne sont pas remplis.
-FormInvalidFieldsMessage=Les champs suivants sont invalides
-FormPrint=Imprimer
-FormReset=R\u00E9initialiser
-FormSaveChangesQuestion=Voulez-vous sauvegarder les modifications ?
-FormStateLoad=Ouvrir ...
-FormStateStore=Enregistrer
-FormStateStoreAs=Enregistrer sous ...
-FormTimerActivated=Minuteur activ\u00E9
-FormattingLocale=Formatage
-GlobalBookmarks=Signets globaux
-GlobalBookmarksAddMenu=Ajouter \u00E0 &signets globaux
-Help=Aide
-Hour=Heure
-IOErrorInfo=Veuillez v\u00E9rifer les fichiers et la connexion.
-IOErrorText=Erreur de communication.
-IOErrorTitle=Erreur de lecture/\u00E9criture.
-InDaysX=en {0} jours
-InactiveState=inactive
-InactiveStates=Inactive
-Info=Information
-Interrupted=Interrompu
-InterruptedErrorText=Le Processus a \u00E9t\u00E9 annul\u00E9 manuellement
-InterruptedErrorTitle=Processus annul\u00E9
-InvalidNumberMessageX="{0}" n'est pas un nombre valide
-InvalidPhoneNumberMessageX="{0}" est un num\u00E9ro de t\u00E9l\u00E9phone non valide
-InvalidValueMessageX="{0}" est une valeur non valide
-JavaVMVersion=Java VM
-JavaVersion=Java Runtime
-KeyStroke=Frappe
-Language=Langage
-LoadFormXmlFailedText=Ce fichier n'est pas compatible avec cette fen\u00EAtre
-LogicBetween=se situe entre {0} et {1}
-LogicBetweenShort=entre
-LogicDateIsInDays=est dans exactement (jours)
-LogicDateIsInGEDays=Date >\= aujourd'hui + n jours
-LogicDateIsInGEMonths=Date >\= aujourd'hui + n mois
-LogicDateIsInLEDays=Date <\= aujourd'hui + n jours
-LogicDateIsInLEMonths=Date <\= aujourd'hui + n mois
-LogicDateIsInLastDays=\u00E9tait dans les derniers n jours
-LogicDateIsInLastMonths=\u00E9tait dans les derniers n mois
-LogicDateIsInMonths=est dans exactement (mois)
-LogicDateIsInNextDays=\u00E9tait dans les prochains n jours
-LogicDateIsInNextMonths=\u00E9tait dans les prochains n mois
-LogicDateIsNotToday=n'est pas aujourd'hui
-LogicDateIsToday=est aujourd'hui
-LogicDateTimeIsInGEHours=Date >\= \u00E0 pr\u00E9sent + n heures
-LogicDateTimeIsInGEMinutes=Date >\= \u00E0 pr\u00E9sent + n minutes
-LogicDateTimeIsInLEHours=Date <\= \u00E0 pr\u00E9sent + n heures
-LogicDateTimeIsInLEMinutes=Date <\= \u00E0 pr\u00E9sent + n minutes
-LogicDateTimeIsNotNow=n'est pas maintenant
-LogicDateTimeIsNow=est maintenant
-LogicEQ=\=
-LogicEndsWith=Se termine par
-LogicGE=>\=
-LogicGT=>
-LogicIn=Est
-LogicLE=<\=
-LogicLT=<
-LogicLike=Contient
-LogicNEQ=<>
-LogicNotEndsWith=ne finit pas en
-LogicNotIn=n'est pas
-LogicNotLike=ne contient pas
-LogicNotNull=n'est pas vide
-LogicNotStartsWith=ne commence pas avec
-LogicNull=est vide
-LogicStartsWith=Commence par
-LogicTimeIsInGEHours=est au plus t\u00F4t dans (heures)
-LogicTimeIsInGEMinutes=est au plus t\u00F4t dans (minutes)
-LogicTimeIsInHours=est dans exactement (heures)
-LogicTimeIsInLEHours=est au plus tard dans (heures)
-LogicTimeIsInLEMinutes=est au plus tard dans (minutes)
-LogicTimeIsInMinutes=est dans exactement (minutes)
-LogicTimeIsNotNow=n'est pas maintenant
-LogicTimeIsNow=est maintenant
-Login=Authentification
-LookIn=Chercher dans
-MemoryStatus=M\u00E9moire
-Minute=Minute
-Month=Mois
-Name=Nom
-NetErrorInfo=V\u00E9rifier le nom du serveur, l'URL et la connexion
-NetErrorText=Serveur introuvable
-NetErrorTitle=Erreur r\u00E9seau
-NetworkLatency=Retard r\u00E9seau
-NewBookmarkFolderMenu=Nouveau dossier\u2026
-NewPassword=Nouveau mot de passe
-No=Non
-NoButton=&Non
-NumberOfRows=Nombre d'enregistrements
-NumberTooLargeMessageXY=La valeur est trop large ; elle doit \u00EAtre entre {0} et {1}.
-NumberTooSmallMessageXY=La valeur est trop faible ; elle doit se situer entre {0} et {1}.
-OSUser=Nom d'utilisateur du syst\u00E8me
-OSVersion=Version du syst\u00E8me
-Ok=Ok
-OkButton=&Valider
-OkButtonTooltip=Sauvegarder et fermer la fen\u00EAtre.
-OldPassword=Ancien mot de passe
-OneRow=1 objet
-OneSelected=1 s\u00E9lectionn\u00E9
-Op=Op\u00E9rateur
-Open=Ouvrir
-OriginalErrorMessageIs=Le message d'origine est \:\n{0}
-OutlineSelectorAddOrRemoveButtons=Ajouter ou retirer &boutons
-OutlineSelectorShowFewerButtons=Montrer &moins de boutons
-OutlineSelectorShowMoreButtons=Afficher &plus de boutons
-Password=Mot de passe
-PasswordHasExpiredHeader=Votre mot de passe a expir\u00E9 et doit \u00EAtre chang\u00E9 maintenant.
-PasswordHasExpiredTitle=Mot de passe expir\u00E9
-PasswordWillExpireHeaderX=Votre mot de passe expire '{0}.
-PasswordWillExpireInfo=Voulez-vous le changer maintenant
-PasswordWillExpireTitle=Le mot de passe va expirer
-PasswordsDoNotMatch=Les deux mots de passse sont diff\u00E9rents
-Paste=Coller
-Path=Chemin d'acc\u00E9s
-Redo=R\u00E9tablir
-RenameBookmarkFolderMenu=Renommer dossier
-RepeatPassword=R\u00E9p\u00E9ter
-ResetButton=&Remettre \u00E0 z\u00E9ro
-ResetButtonTooltip=Remettre \u00E0 vide tous les champs
-SC_Copyright=Le Sentry Spelling Checker-moteur et les dictionnaires sont prot\u00E9g\u00E9es par Wintertree Software, Inc
-SC_DialogTitle=Scout Spell Checker
-SC_DialogTitle_Options=Scout Spell Checker\: Options
-SC_Help_AddToDictionary=Ajoute le mot mal orthographi\u00E9 au dictionnaire
-SC_Help_Cancel=Ferme la bo\u00EEte de dialogue et rejette tous les changements (raccourci clavier\: ESC)
-SC_Help_Change=Changer cette occurenses du mot mal orthographi\u00E9
-SC_Help_ChangeAll=Changer toutes occurenses du mot mal orthographi\u00E9 (dans l'\u00E9l\u00E9ment de texte actuel)
-SC_Help_Enable=Si coch\u00E9e, le Scout Correcteur Orthographique est activ\u00E9
-SC_Help_Ignore=Ignorer cette occurense du mot mal orthographi\u00E9
-SC_Help_IgnoreAll=Ignorer toutes occurenses de ce mot
-SC_Help_IgnoreCase=Si la case coch\u00E9e est ignor\u00E9, 'HeLLo' par exemple sera accept\u00E9
-SC_Help_IgnoreDomainNames=Si les noms de domaine coch\u00E9s sont ignor\u00E9s, 'www.bsiag.com' par exemple sera accept\u00E9
-SC_Help_IgnoreWordsWithNumbers=Si les mots avec de num\u00E9ros coch\u00E9s sont ignor\u00E9s, 'Super7' par exemple sera accept\u00E9
-SC_Help_Language=La langue s\u00E9lectionn\u00E9e
-SC_Help_Options=Ouvre le dialogue Options
-SC_Help_RemoveWord=Supprime le mot s\u00E9lectionn\u00E9 dans le dictionnaire del' utilisateur
-SC_Help_ReplacementWord=Le mot utilis\u00E9 pour remplacer le mot mal orthographi\u00E9 (presse ENTER afin de remplacer le mot mal orthographi\u00E9 apr celui-ci)
-SC_Help_Shortcut=Le raccourci vers la dialogue d'orthographe. Fix, ne peut pas \u00EAtre chang\u00E9.
-SC_Help_SuggestionList=Remplacements sugg\u00E9r\u00E9s pour le mot mal orthographi\u00E9 (double-clique pour remplacer le mot mal orthographi\u00E9 avec le mot s\u00E9lectionn\u00E9.
-SC_Help_Undo=Annule le dernier changement
-SC_Help_UseDefaults=Utilise le param\u00E8tres par d\u00E9faut
-SC_Help_UserDictionary=Merci de choisir un dictionnaire .tlx (Scout) ou .dic (MS Word) comme dictionnaire de l'utilisateur
-SC_Label_AddToDictionary=Ajouter au dictionnaire
-SC_Label_Cancel=Annuler
-SC_Label_Capitalization=Capitalisation
-SC_Label_Change=Changer
-SC_Label_ChangeAll=Changer Tous
-SC_Label_ChangeTo=Changer vers
-SC_Label_ConsiderChanging=Pensez \u00E0 Cahnger
-SC_Label_ContainsDigits=Contient des Digits
-SC_Label_DoubledWord=Mot doubl\u00E9
-SC_Label_Enable=Activer correcteur orthographique
-SC_Label_Ignore=Ignorer
-SC_Label_IgnoreAll=Ignorer Tous
-SC_Label_IgnoreCase=Ignorer la case
-SC_Label_IgnoreDomainNames=Ignorer Noms de domaine
-SC_Label_IgnoreWordsWithNumbers=Ignorer Mots avec Num\u00E9ros
-SC_Label_IgnoredWord=Ignorer Mot
-SC_Label_Main=Param\u00E8tres Principaux
-SC_Label_MixedCase=Case Mixed
-SC_Label_NoSuggestions=(Aucune suggestion)
-SC_Label_NotInDictionary=Le mor soulign\u00E9 n'est pas reconnu
-SC_Label_Options=Options\u2026
-SC_Label_RemoveWord=Supprimer Mot
-SC_Label_Shortcut=Raccourci
-SC_Label_Spelling=Orthographe
-SC_Label_Undo=Annuler
-SC_Label_UseDefaults=Utilisation par d\u00E9faut
-SC_Label_UserDictionary=Dictionnaire de l'utilisateur
-SC_Language=Langage
-SC_Message_CheckRest=Voulez-vous v\u00E9rifier le restant du texte?
-SC_Message_Complete=La v\u00E9rification orthographique est termin\u00E9e
-SC_Message_CompleteForSelection=La v\u00E9rification orthographique est termin\u00E9e pour la s\u00E9lection
-SC_Message_NotAvailable=Le Scout Spell Checker n'est pas disponible
-Save=Sauvegarder
-SaveButton=&Sauver
-SaveButtonTooltip=Fermer la fen\u00EAtre sans sauvegarder
-SavePassword=Sauvegarder nom utilisateur/mot de passe
-ScoutStarting=La reconnaissance commence
-SearchButton=&Rechercher
-SearchButtonTooltip=Fermer la fen\u00EAtre et lancer la recherche.
-SearchConstraints=Crit\u00E8res de recherche
-SearchTextIsTooGeneral=Veuillez restreindre le texte de recherche
-SelectedStates=V\u00E9rifi\u00E9 seulement
-Server=Serveur
-SmartFieldCannotComplete=Pas de suggestion pour "{0}"
-SmartFieldMoreThanXRows=Plus de {0} ligens. Affichage uniquement {1}.
-SmartFindLabel=Rechercher Texte
-StatusExportDone=Export termin\u00E9e
-Today=aujourd'hui
-Tomorrow=demain
-TooManyRows=Quantit\u00E9 des donn\u00E9es volumineuse. Merci de limiter la recherche
-Undo=Annuler
-Update=Mise \u00E0 jour
-UserCancelledOperation=L'op\u00E9ration a \u00E9t\u00E9 annul\u00E9e manuellement
-UserInterrupted=Annul\u00E9 par l'utilisateur
-Username=Nom d'utilisateur
-Value=Valeur
-VersionMismatchAction=Voulez-vous red\u00E9marrer l'application avec une mise \u00E0 jour automatique ?
-VersionMismatchTextXY=Une mise \u00E0 jour de l'application est n\u00E9cessaire pour continuer \u00E0 travailler.\n\nLa version actuelle est {0}, la nouvelle version est {1}.
-VersionMismatchTitle=Mise \u00E0 jour requise
-VetoErrorText=Vous devez remplir au moins un champs de recherche.
-Week=Semaine
-WeekShort=S
-WizardBackButton=&Retour
-WizardBackButtonTooltip=Retour \u00E0 l'\u00E9tape pr\u00E9c\u00E9dente
-WizardCancelButton=Annuler
-WizardCancelButtonTooltip=Annuler les assistants et jeter toutes les donn\u00E9es.
-WizardFinishButton=&Terminer
-WizardFinishButtonTooltip=Terminer ce processus et retourner au processus de s\u00E9lection.
-WizardNextButton=&Suivant
-WizardNextButtonTooltip=Proc\u00E9der \u00E0 l'\u00E9tape suivante
-WizardSuspendButton=&Fermer
-WizardSuspendButtonTooltip=Ferme ce processus et ferme l'assistant (peut \u00EAtre repris plus tard).
-WorkWeek=Semaine ouvr\u00E9e
-XMustBeGreaterThanOrEqualY={0}' doit \u00EAtre sup\u00E9rieur ou \u00E9gal \u00E0 '{1}'
-XMustBeLessThanOrEqualY={0}' doit \u00EAtre inf\u00E9rieur ou \u00E9gal \u00E0 '{1}'
-XRows={0} objets
-XSelected={0} s\u00E9lectionn\u00E9
-Yes=Oui
-YesButton=&Oui
-and=et
-from=de
-searchingProposals=rechercher des propositions\u2026
-to=\u00E0
+ActivateBookmarkMenu=Ouvrir marque-page
+ActiveAndInactiveStates=Active+Inactive
+ActiveStates=Active
+AllStates=Tout
+Apply=Appliquer
+ApplyBookmarkToSearchFailedMessage=Ce marque-page n'est pas applicable \u00E0 la recherche en cours
+Attribute=Attribuer
+Bookmark=Favori
+BookmarkFolder=R\u00E9pertoire
+Bookmarks=Favoris
+BookmarksAddMenu=&Ajouter au favoris
+BookmarksApplyToCurrentSearch=Effectuer recherche en utilisant ce marque-page
+BookmarksMainMenu=&Favoris
+BookmarksManageMenu=&Organiser les favoris
+BookmarksPublishMenu=Publier marque-page\u2026
+BookmarksStartPageMenu=&Page d'accueil
+BookmarksStartPageMenuClear=&Pas de vue de d\u00E9marrage
+BookmarksStartPageMenuGoto=&Ouvrir la page d'accueil
+BookmarksStartPageMenuSet=&Faire de la vue actuelle la page d'accueil
+ButtonDeselectAll=Tout d\u00E9s\u00E9lectionner
+ButtonMoveDown=En bas
+ButtonMoveUp=En haut
+ButtonSelectAll=Tout s\u00E9lectionner
+Calendar_earlier=Plus t\u00F4t
+Calendar_later=Plus tard
+Cancel=Annuler
+CancelButton=&Annuler
+CancelButtonTooltip=Fermer la fen\u00EAtre sans sauvegarder, avec confirmation si n\u00E9cessaire.
+ChangePassword=Changer le mot de passe
+CloseButton=&Fermer
+CloseButtonTooltip=Fermer la fen\u00EAtre sans sauvegarder
+CodeTypeInit=Initialisation type de code
+Column=Colonne
+Columns=Colonnes
+ComposerFieldAggregationAvg=Moyen({0})
+ComposerFieldAggregationCount=D\u00E9compte({0})
+ComposerFieldAggregationLabel=Fonction
+ComposerFieldAggregationMax=Maximum({0})
+ComposerFieldAggregationMedian=M\u00E9dian({0})
+ComposerFieldAggregationMin=Minimum({0})
+ComposerFieldAggregationSum=Somme({0})
+Condensed=6 colonnes
+Copy=Copier
+Cut=Coupe
+Day=Jour
+DefaultPasswordPolicyText=Le mot de passe ne correspond pas aux directives donn\u00E9es.\n\nDirectives\:\n- au moins 8 caract\u00E8res\n- au moins un num\u00E9ro (0-9)\n- au moins un caract\u00E8re non standard (\!|@|\#|$|%|^|&|*|(|)|_|+|||~|-|
+DeleteBookmarkMenu=Supprimer marque-page
+DeleteConfirmationText=Voulez-vous supprimer les donn\u00E9es suivantes ?
+DeleteConfirmationTextNoItemList=Voulez-vous supprimer cette donn\u00E9e ?
+DeleteConfirmationTextNoItemListX=Voulez-vous supprimer ceci {0} ?
+DeleteConfirmationTextX=Voulez-vous effacer ce qui suit {0} ?
+DeleteConfirmationTitle=Confirmer suppression
+DeleteFolderMenu=Supprimer dossier
+DetailedVersion=Version d\u00E9taill\u00E9e
+EditBookmarkMenu=Editer marque-page\u2026
+EmailCc=CC
+EmailFrom=A partir de
+EmailSubject=Sujet
+EmailTo=Vers
+Error=Erreur
+ErrorAndRetryTextDefault=Une erreur s'est produite durant le transfert des donn\u00E9es.
+ErrorTextLogin=Nom d'utilisateur ou mot de passe incorrect
+ErrorTitleLogin=Echec de connection
+ExcelChart_Button_LoadDefaults=D\u00E9fauts
+ExcelChart_Button_LoadDefaultsHint=Red\u00E9marre ce dialogue en chargeant les valeurs par d\u00E9faut
+ExcelChart_Button_LoadProfile=Profile de chargement
+ExcelChart_Button_LoadProfileHint=Charge les configurations d'un fichier XML
+ExcelChart_Button_SaveProfile=Sauver le profile...
+ExcelChart_Button_SaveProfileHint=Sauve les configurations actuelles dans un fichier XML
+ExcelChart_Error_CreatingChartFailed=Echec de la cr\u00E9ation du graphique
+ExcelChart_Error_ExportingFailed=Echec de l'exportation car
+ExcelChart_Error_InitializationFailed=Echec de l'initialisation des classes de support
+ExcelChart_Error_LoadingProfileFailed=Echec du chargement du profile car
+ExcelChart_Error_LoadingTemplateFailed=Echec du chargement du mod\u00E8le
+ExcelChart_Error_RetrivingOutlineDataFailed=Echec de la r\u00E9cup\u00E9ration de la configuration
+ExcelChart_Error_SavingProfileFailed=Echec de l'enregistrement du profile car
+ExcelChart_Error_WrongProfile=le profile a \u00E9t\u00E9 cr\u00E9\u00E9 \u00E0 partire d'une autre configuration
+ExcelChart_Label_AutomaticMode=Mode automatique
+ExcelChart_Label_AutomaticModeHint=Cacher Excel et enregistrer automatiquement
+ExcelChart_Label_ChartNumber=Num\u00E9ro de graphique
+ExcelChart_Label_ChartType=Type de graphique
+ExcelChart_Label_FileName=Nom de fichier
+ExcelChart_Label_FirstRow=Premi\u00E8re ligne
+ExcelChart_Label_Height=Hauteur
+ExcelChart_Label_HistogramMode=Mode historique
+ExcelChart_Label_HistogramModeHint=Le mode historique combine les m\u00EAmes valeurs de l'axe X en une seule
+ExcelChart_Label_LastRow=Derni\u00E8re ligne
+ExcelChart_Label_Offset=Position
+ExcelChart_Label_SkipNullValues=Laisse tomber les valeurs nulles en mode historique
+ExcelChart_Label_SkipNullValuesHint=Si les valeurs nulles sur l'axe X sont ignor\u00E9es, sinon elles sont combin\u00E9es en <Inconnu>
+ExcelChart_Label_TemplateName=Mod\u00E8le
+ExcelChart_Label_UseCustomFormat=Utiliser le mod\u00E8le standard
+ExcelChart_Label_UseCustomFormatHint=Si coch\u00E9, vous pouvez indiquer la position et taille du graphique
+ExcelChart_Label_UseExistingChart=Utiliser le graphique existant
+ExcelChart_Label_UseExistingChartHint=Si coch\u00E9, le graphique existant dans le mod\u00E8le indiqu\u00E9 est utilis\u00E9
+ExcelChart_Label_UseSelectiveExport=Utiliser une exportation s\u00E9lective
+ExcelChart_Label_UseSelectiveExportHint=Si coch\u00E9es, uniquement les lignes marqu\u00E9es ci-dessous seront export\u00E9es
+ExcelChart_Label_Width=Largeur
+ExcelChart_Label_WorksheetName=Feuille de travail
+ExcelChart_Label_XAxis=Axe X
+ExcelChart_Label_YAxes=Axe Y
+ExcelChart_Status_Done=Exportation du Graphique Excel termin\u00E9e
+ExcelChart_Tab_Advanced=Avanc\u00E9
+ExcelChart_Tab_Basic=Basique
+ExcelChart_Title_MainForm=Exportation du Graphique Excel
+ExcelChart_Type_Area3D=Surface 3D
+ExcelChart_Type_Area=Surface
+ExcelChart_Type_AreaStacked3D=Surface superpos\u00E9e 3D
+ExcelChart_Type_AreaStacked=Surface superpos\u00E9e
+ExcelChart_Type_BarsClustered3D=Barres group\u00E9es 3D
+ExcelChart_Type_BarsClustered=Barres group\u00E9es
+ExcelChart_Type_BarsStacked3D=Barres superpos\u00E9es 3D
+ExcelChart_Type_BarsStacked=Barres superpos\u00E9es
+ExcelChart_Type_ColumnsClustered3D=Colonnes group\u00E9es 3D
+ExcelChart_Type_ColumnsClustered=Colonnes group\u00E9es
+ExcelChart_Type_ColumnsStacked3D=Colonnes superpos\u00E9es 3D
+ExcelChart_Type_ColumnsStacked=Colonnes superpos\u00E9es
+ExcelChart_Type_Line=Ligne
+ExcelChart_Type_LineStacked=Ligne superpos\u00E9e
+ExcelChart_Type_Pie3D=G\u00E2teau 3D
+ExcelChart_Type_Pie=G\u00E2teau
+ExcelChart_Type_PieExploded3D=G\u00E2teau explos\u00E9 3D
+ExcelChart_Type_PieExploded=G\u00E2teau explos\u00E9
+ExcelChart_Various_Averaged=moyenne
+ExcelChart_Various_Column=Colonne
+ExcelChart_Various_Frequency=Fr\u00E9quence
+ExcelChart_Various_SummedUp=Additionn\u00E9
+ExcelChart_Various_Unknown=<Inconnu>
+ExecutionTime=traitement serveur
+ExportDate=Date d'exportation
+ExtendedSearchAddAdditionalOrMenu=Ajouter en plus ou ins\u00E9rer
+ExtendedSearchAddAttribute=Contrainte
+ExtendedSearchAddAttributeMenu=Ajouter crit\u00E8re
+ExtendedSearchAddEitherOrMenu=Ajouter soit\u2026ou
+ExtendedSearchAddEntityPrefix=a
+ExtendedSearchAnd=et
+ExtendedSearchEditAttributeMenu=Modifier
+ExtendedSearchEither=l'un ou l'autre
+ExtendedSearchEntitySuffix=avec
+ExtendedSearchNegateMenu=N\u00E9gation
+ExtendedSearchNot=ne pas
+ExtendedSearchOr=ou
+ExtendedSearchRemoveAttributeMenu=Enlever
+ExtendedSearchRemoveMenu=Enlever
+FileExistsOwerwriteQuestion=Le fichier s\u00E9lectionn\u00E9 existe d\u00E9j\u00E0. Voulez-vous le remplacer?
+FileName=Nom du fichier
+FileNotFoundMessage=Impossible de trouver le fichier\:
+FileNotFoundTitle=Fichier introuvable.
+FilesOfType=Type de fichier
+FilterBookmarkTree=Parcourir les marque-pages
+Folders=Dossiers
+FormButtonClicked=Tout en cliquant sur un bouton
+FormCloseTimerActivated=Minuteur de fermeture activ\u00E9
+FormClosing=Fermer
+FormEmptyMandatoryFieldsMessage=Les champs suivants sont requis
+FormExportXml=Exporter en XML
+FormFinally=Finaliser
+FormFireActivated=Lorsque le formulaire a \u00E9t\u00E9 activ\u00E9
+FormFireClosed=Lorsque le formulaire a \u00E9t\u00E9 ferm\u00E9
+FormFireDiscarded=Lorsque le formulaire a \u00E9t\u00E9 supprim\u00E9
+FormFireStructureChanged=Lorsque la structure du formulaire a chang\u00E9
+FormFireToBack=Lors de l'envoi du formulaire \u00E0 l'arri\u00E8re
+FormFireToFront=Lors de l'envoi du formulaire \u00E0 l'avant
+FormIncompleteIntro=Tous les champs obligatoires ne sont pas remplis.
+FormInvalidFieldsMessage=Les champs suivants sont invalides
+FormPrint=Imprimer
+FormReset=R\u00E9initialiser
+FormSaveChangesQuestion=Voulez-vous sauvegarder les modifications ?
+FormStateLoad=Ouvrir ...
+FormStateStore=Enregistrer
+FormStateStoreAs=Enregistrer sous ...
+FormTimerActivated=Minuteur activ\u00E9
+FormattingLocale=Formatage
+GlobalBookmarks=Signets globaux
+GlobalBookmarksAddMenu=Ajouter \u00E0 &signets globaux
+Help=Aide
+Hour=Heure
+IOErrorInfo=Veuillez v\u00E9rifer les fichiers et la connexion.
+IOErrorText=Erreur de communication.
+IOErrorTitle=Erreur de lecture/\u00E9criture.
+InDaysX=en {0} jours
+InactiveState=inactive
+InactiveStates=Inactive
+Info=Information
+Interrupted=Interrompu
+InterruptedErrorText=Le Processus a \u00E9t\u00E9 annul\u00E9 manuellement
+InterruptedErrorTitle=Processus annul\u00E9
+InvalidNumberMessageX="{0}" n'est pas un nombre valide
+InvalidPhoneNumberMessageX="{0}" est un num\u00E9ro de t\u00E9l\u00E9phone non valide
+InvalidValueMessageX="{0}" est une valeur non valide
+JavaVMVersion=Java VM
+JavaVersion=Java Runtime
+KeyStroke=Frappe
+Language=Langage
+LoadFormXmlFailedText=Ce fichier n'est pas compatible avec cette fen\u00EAtre
+LogicBetween=se situe entre {0} et {1}
+LogicBetweenShort=entre
+LogicDateIsInDays=est dans exactement (jours)
+LogicDateIsInGEDays=Date >\= aujourd'hui + n jours
+LogicDateIsInGEMonths=Date >\= aujourd'hui + n mois
+LogicDateIsInLEDays=Date <\= aujourd'hui + n jours
+LogicDateIsInLEMonths=Date <\= aujourd'hui + n mois
+LogicDateIsInLastDays=\u00E9tait dans les derniers n jours
+LogicDateIsInLastMonths=\u00E9tait dans les derniers n mois
+LogicDateIsInMonths=est dans exactement (mois)
+LogicDateIsInNextDays=\u00E9tait dans les prochains n jours
+LogicDateIsInNextMonths=\u00E9tait dans les prochains n mois
+LogicDateIsNotToday=n'est pas aujourd'hui
+LogicDateIsToday=est aujourd'hui
+LogicDateTimeIsInGEHours=Date >\= \u00E0 pr\u00E9sent + n heures
+LogicDateTimeIsInGEMinutes=Date >\= \u00E0 pr\u00E9sent + n minutes
+LogicDateTimeIsInLEHours=Date <\= \u00E0 pr\u00E9sent + n heures
+LogicDateTimeIsInLEMinutes=Date <\= \u00E0 pr\u00E9sent + n minutes
+LogicDateTimeIsNotNow=n'est pas maintenant
+LogicDateTimeIsNow=est maintenant
+LogicEQ=\=
+LogicEndsWith=Se termine par
+LogicGE=>\=
+LogicGT=>
+LogicIn=Est
+LogicLE=<\=
+LogicLT=<
+LogicLike=Contient
+LogicNEQ=<>
+LogicNotEndsWith=ne finit pas en
+LogicNotIn=n'est pas
+LogicNotLike=ne contient pas
+LogicNotNull=n'est pas vide
+LogicNotStartsWith=ne commence pas avec
+LogicNull=est vide
+LogicStartsWith=Commence par
+LogicTimeIsInGEHours=est au plus t\u00F4t dans (heures)
+LogicTimeIsInGEMinutes=est au plus t\u00F4t dans (minutes)
+LogicTimeIsInHours=est dans exactement (heures)
+LogicTimeIsInLEHours=est au plus tard dans (heures)
+LogicTimeIsInLEMinutes=est au plus tard dans (minutes)
+LogicTimeIsInMinutes=est dans exactement (minutes)
+LogicTimeIsNotNow=n'est pas maintenant
+LogicTimeIsNow=est maintenant
+Login=Authentification
+LookIn=Chercher dans
+MemoryStatus=M\u00E9moire
+Minute=Minute
+Month=Mois
+Name=Nom
+NetErrorInfo=V\u00E9rifier le nom du serveur, l'URL et la connexion
+NetErrorText=Serveur introuvable
+NetErrorTitle=Erreur r\u00E9seau
+NetworkLatency=Retard r\u00E9seau
+NewBookmarkFolderMenu=Nouveau dossier\u2026
+NewPassword=Nouveau mot de passe
+No=Non
+NoButton=&Non
+NumberOfRows=Nombre d'enregistrements
+NumberTooLargeMessageXY=La valeur est trop large ; elle doit \u00EAtre entre {0} et {1}.
+NumberTooSmallMessageXY=La valeur est trop faible ; elle doit se situer entre {0} et {1}.
+OSUser=Nom d'utilisateur du syst\u00E8me
+OSVersion=Version du syst\u00E8me
+Ok=Ok
+OkButton=&Valider
+OkButtonTooltip=Sauvegarder et fermer la fen\u00EAtre.
+OldPassword=Ancien mot de passe
+OneRow=1 objet
+OneSelected=1 s\u00E9lectionn\u00E9
+Op=Op\u00E9rateur
+Open=Ouvrir
+OriginalErrorMessageIs=Le message d'origine est \:\n{0}
+OutlineSelectorAddOrRemoveButtons=Ajouter ou retirer &boutons
+OutlineSelectorShowFewerButtons=Montrer &moins de boutons
+OutlineSelectorShowMoreButtons=Afficher &plus de boutons
+Password=Mot de passe
+PasswordHasExpiredHeader=Votre mot de passe a expir\u00E9 et doit \u00EAtre chang\u00E9 maintenant.
+PasswordHasExpiredTitle=Mot de passe expir\u00E9
+PasswordWillExpireHeaderX=Votre mot de passe expire '{0}.
+PasswordWillExpireInfo=Voulez-vous le changer maintenant
+PasswordWillExpireTitle=Le mot de passe va expirer
+PasswordsDoNotMatch=Les deux mots de passse sont diff\u00E9rents
+Paste=Coller
+Path=Chemin d'acc\u00E9s
+Redo=R\u00E9tablir
+RenameBookmarkFolderMenu=Renommer dossier
+RepeatPassword=R\u00E9p\u00E9ter
+ResetButton=&Remettre \u00E0 z\u00E9ro
+ResetButtonTooltip=Remettre \u00E0 vide tous les champs
+SC_Copyright=Le Sentry Spelling Checker-moteur et les dictionnaires sont prot\u00E9g\u00E9es par Wintertree Software, Inc
+SC_DialogTitle=Scout Spell Checker
+SC_DialogTitle_Options=Scout Spell Checker\: Options
+SC_Help_AddToDictionary=Ajoute le mot mal orthographi\u00E9 au dictionnaire
+SC_Help_Cancel=Ferme la bo\u00EEte de dialogue et rejette tous les changements (raccourci clavier\: ESC)
+SC_Help_Change=Changer cette occurenses du mot mal orthographi\u00E9
+SC_Help_ChangeAll=Changer toutes occurenses du mot mal orthographi\u00E9 (dans l'\u00E9l\u00E9ment de texte actuel)
+SC_Help_Enable=Si coch\u00E9e, le Scout Correcteur Orthographique est activ\u00E9
+SC_Help_Ignore=Ignorer cette occurense du mot mal orthographi\u00E9
+SC_Help_IgnoreAll=Ignorer toutes occurenses de ce mot
+SC_Help_IgnoreCase=Si la case coch\u00E9e est ignor\u00E9, 'HeLLo' par exemple sera accept\u00E9
+SC_Help_IgnoreDomainNames=Si les noms de domaine coch\u00E9s sont ignor\u00E9s, 'www.bsiag.com' par exemple sera accept\u00E9
+SC_Help_IgnoreWordsWithNumbers=Si les mots avec de num\u00E9ros coch\u00E9s sont ignor\u00E9s, 'Super7' par exemple sera accept\u00E9
+SC_Help_Language=La langue s\u00E9lectionn\u00E9e
+SC_Help_Options=Ouvre le dialogue Options
+SC_Help_RemoveWord=Supprime le mot s\u00E9lectionn\u00E9 dans le dictionnaire del' utilisateur
+SC_Help_ReplacementWord=Le mot utilis\u00E9 pour remplacer le mot mal orthographi\u00E9 (presse ENTER afin de remplacer le mot mal orthographi\u00E9 apr celui-ci)
+SC_Help_Shortcut=Le raccourci vers la dialogue d'orthographe. Fix, ne peut pas \u00EAtre chang\u00E9.
+SC_Help_SuggestionList=Remplacements sugg\u00E9r\u00E9s pour le mot mal orthographi\u00E9 (double-clique pour remplacer le mot mal orthographi\u00E9 avec le mot s\u00E9lectionn\u00E9.
+SC_Help_Undo=Annule le dernier changement
+SC_Help_UseDefaults=Utilise le param\u00E8tres par d\u00E9faut
+SC_Help_UserDictionary=Merci de choisir un dictionnaire .tlx (Scout) ou .dic (MS Word) comme dictionnaire de l'utilisateur
+SC_Label_AddToDictionary=Ajouter au dictionnaire
+SC_Label_Cancel=Annuler
+SC_Label_Capitalization=Capitalisation
+SC_Label_Change=Changer
+SC_Label_ChangeAll=Changer Tous
+SC_Label_ChangeTo=Changer vers
+SC_Label_ConsiderChanging=Pensez \u00E0 Cahnger
+SC_Label_ContainsDigits=Contient des Digits
+SC_Label_DoubledWord=Mot doubl\u00E9
+SC_Label_Enable=Activer correcteur orthographique
+SC_Label_Ignore=Ignorer
+SC_Label_IgnoreAll=Ignorer Tous
+SC_Label_IgnoreCase=Ignorer la case
+SC_Label_IgnoreDomainNames=Ignorer Noms de domaine
+SC_Label_IgnoreWordsWithNumbers=Ignorer Mots avec Num\u00E9ros
+SC_Label_IgnoredWord=Ignorer Mot
+SC_Label_Main=Param\u00E8tres Principaux
+SC_Label_MixedCase=Case Mixed
+SC_Label_NoSuggestions=(Aucune suggestion)
+SC_Label_NotInDictionary=Le mor soulign\u00E9 n'est pas reconnu
+SC_Label_Options=Options\u2026
+SC_Label_RemoveWord=Supprimer Mot
+SC_Label_Shortcut=Raccourci
+SC_Label_Spelling=Orthographe
+SC_Label_Undo=Annuler
+SC_Label_UseDefaults=Utilisation par d\u00E9faut
+SC_Label_UserDictionary=Dictionnaire de l'utilisateur
+SC_Language=Langage
+SC_Message_CheckRest=Voulez-vous v\u00E9rifier le restant du texte?
+SC_Message_Complete=La v\u00E9rification orthographique est termin\u00E9e
+SC_Message_CompleteForSelection=La v\u00E9rification orthographique est termin\u00E9e pour la s\u00E9lection
+SC_Message_NotAvailable=Le Scout Spell Checker n'est pas disponible
+Save=Sauvegarder
+SaveButton=&Sauver
+SaveButtonTooltip=Fermer la fen\u00EAtre sans sauvegarder
+SavePassword=Sauvegarder nom utilisateur/mot de passe
+ScoutStarting=La reconnaissance commence
+SearchButton=&Rechercher
+SearchButtonTooltip=Fermer la fen\u00EAtre et lancer la recherche.
+SearchConstraints=Crit\u00E8res de recherche
+SearchTextIsTooGeneral=Veuillez restreindre le texte de recherche
+SelectedStates=V\u00E9rifi\u00E9 seulement
+Server=Serveur
+SmartFieldCannotComplete=Pas de suggestion pour "{0}"
+SmartFieldMoreThanXRows=Plus de {0} ligens. Affichage uniquement {1}.
+SmartFindLabel=Rechercher Texte
+StatusExportDone=Export termin\u00E9e
+Today=aujourd'hui
+Tomorrow=demain
+TooManyRows=Quantit\u00E9 des donn\u00E9es volumineuse. Merci de limiter la recherche
+Undo=Annuler
+Update=Mise \u00E0 jour
+UserCancelledOperation=L'op\u00E9ration a \u00E9t\u00E9 annul\u00E9e manuellement
+UserInterrupted=Annul\u00E9 par l'utilisateur
+Username=Nom d'utilisateur
+Value=Valeur
+VersionMismatchAction=Voulez-vous red\u00E9marrer l'application avec une mise \u00E0 jour automatique ?
+VersionMismatchTextXY=Une mise \u00E0 jour de l'application est n\u00E9cessaire pour continuer \u00E0 travailler.\n\nLa version actuelle est {0}, la nouvelle version est {1}.
+VersionMismatchTitle=Mise \u00E0 jour requise
+VetoErrorText=Vous devez remplir au moins un champs de recherche.
+Week=Semaine
+WeekShort=S
+WizardBackButton=&Retour
+WizardBackButtonTooltip=Retour \u00E0 l'\u00E9tape pr\u00E9c\u00E9dente
+WizardCancelButton=Annuler
+WizardCancelButtonTooltip=Annuler les assistants et jeter toutes les donn\u00E9es.
+WizardFinishButton=&Terminer
+WizardFinishButtonTooltip=Terminer ce processus et retourner au processus de s\u00E9lection.
+WizardNextButton=&Suivant
+WizardNextButtonTooltip=Proc\u00E9der \u00E0 l'\u00E9tape suivante
+WizardSuspendButton=&Fermer
+WizardSuspendButtonTooltip=Ferme ce processus et ferme l'assistant (peut \u00EAtre repris plus tard).
+WorkWeek=Semaine ouvr\u00E9e
+XMustBeGreaterThanOrEqualY={0}' doit \u00EAtre sup\u00E9rieur ou \u00E9gal \u00E0 '{1}'
+XMustBeLessThanOrEqualY={0}' doit \u00EAtre inf\u00E9rieur ou \u00E9gal \u00E0 '{1}'
+XRows={0} objets
+XSelected={0} s\u00E9lectionn\u00E9
+Yes=Oui
+YesButton=&Oui
+and=et
+from=de
+searchingProposals=rechercher des propositions\u2026
+to=\u00E0
diff --git a/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_hr.properties b/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_hr.properties
index d6a15dcea2..a1e0cc23de 100644
--- a/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_hr.properties
+++ b/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_hr.properties
@@ -1,266 +1,266 @@
-ActiveAndInactiveStates=Aktivni+Naektivni
-ActiveStates=Aktivan
-AllStates=Sve
-Apply=Primijeni
-Attribute=Pripi\u0161i
-Bookmarks=Ozna\u010Dene stranice (bookmarks)
-BookmarksAddMenu=&Dodaj me\u0111u ozna\u010Dene stranice (bookmarks)
-BookmarksMainMenu=&Ozna\u010Dene stranice (bookmarks)
-BookmarksManageMenu=&Upravljaj ozna\u010Denim stranicama (bookmarks)...
-BookmarksStartPageMenu=&Po\u010Detni pregled
-BookmarksStartPageMenuClear=&Nema po\u010Detnog pogleda
-BookmarksStartPageMenuGoto=&Otvori po\u010Detni pregled
-BookmarksStartPageMenuSet=&Postavi trenutni pogled kao po\u010Detni
-ButtonDeselectAll=Odzna\u010Di sve
-ButtonSelectAll=Ozna\u010Di sve
-Calendar_earlier=Ranije
-Calendar_later=Kasnije
-Cancel=Odustani
-CancelButton=&Odustani
-CancelButtonTooltip=Zatvori dijalo\u0161ki okvir bez spremanja; i dijalo\u0161ki okvir za potvrdu ako je potrebno.
-ChangePassword=Promijeni lozinku
-CloseButton=&Zatvori
-CloseButtonTooltip=Zatvori dijalo\u0161ki okvir bez spremanja.
-Column=Stupac
-Columns=Stupci
-ComposerFieldAggregationLabel=Funkcija
-Condensed=6 stupaca
-Copy=Kopiraj
-Cut=Izre\u017Ei
-Day=Dan
-DefaultPasswordPolicyText=Lozinka ne zadovoljava sigurnosne propise o snazi lozinke\n\nSigurnosni propis\n- najmanje 8 znakova\n- najmanje jedan broj (0-9)\n- najmanje jedan specijalni znak (\!|@|\#|$|%|^|&|*|(|)|_|+|||~|-|)
-EmailFrom=Iz
-EmailSubject=Predmet
-EmailTo=To
-Error=Gre\u0161ka
-ErrorAndRetryTextDefault=Do\u0161lo je do gre\u0161ke prilikom prijenosa podataka.
-ErrorTextLogin=Neva\u017Ee\u0107e korisni\u010Dko ime/lozinka
-ErrorTitleLogin=Prijava nije uspjela
-ExcelChart_Button_LoadDefaults=Defaults
-ExcelChart_Button_LoadDefaultsHint=Resetiraj ovaj dijalog u\u010Ditavaju\u0107i default vrijednosti
-ExcelChart_Button_LoadProfile=U\u010Ditavam profil...
-ExcelChart_Button_LoadProfileHint=U\u010Ditaj postavke iz XML datoteke
-ExcelChart_Button_SaveProfile=Spremi profil
-ExcelChart_Button_SaveProfileHint=Spremi trenutne postavke u XML datoteku
-ExcelChart_Error_CreatingChartFailed=Izrada grafikona nije uspjela
-ExcelChart_Error_ExportingFailed=Izvoz nije uspio iz razloga
-ExcelChart_Error_InitializationFailed=Inicijalizacija klase/a za podr\u0161ku nije uspjela
-ExcelChart_Error_LoadingProfileFailed=U\u010Ditavanje profila nije uspjelo iz razloga
-ExcelChart_Error_LoadingTemplateFailed=U\u010Ditavanje predlo\u0161ka nije uspjelo
-ExcelChart_Error_RetrivingOutlineDataFailed=Dobivanje pregleda podataka nije uspjelo
-ExcelChart_Error_SavingProfileFailed=Spremanje profila nije uspjelo
-ExcelChart_Error_WrongProfile=Profil je kreiran za drugi pregled
-ExcelChart_Label_AutomaticMode=Automatski mod
-ExcelChart_Label_AutomaticModeHint=Sakrij Excel i automatski spremi
-ExcelChart_Label_ChartNumber=Broj grafikona
-ExcelChart_Label_ChartType=Tip grafikona
-ExcelChart_Label_FileName=Ime datoteke
-ExcelChart_Label_FirstRow=Prvi redak
-ExcelChart_Label_Height=Visina
-ExcelChart_Label_HistogramMode=Histogram mod
-ExcelChart_Label_HistogramModeHint=Histogram mod kombinira ovoj vrijednosti jednake vrijednosti na X-osi
-ExcelChart_Label_LastRow=Zadnji redak
-ExcelChart_Label_Offset=Pozicija
-ExcelChart_Label_SkipNullValues=Presko\u010Di null vrijednosti u histogram modu
-ExcelChart_Label_SkipNullValuesHint=Ako su ozna\u010Dene null vrijednosti na X-osi ignorirane , ina\u010De su kombinirane sa <Unknown>
-ExcelChart_Label_TemplateName=Predlo\u017Eak
-ExcelChart_Label_UseCustomFormat=Upotrijebi prilago\u0111eni format
-ExcelChart_Label_UseCustomFormatHint=Ako je selektirano mo\u017Eete ozna\u010Diti polo\u017Eaj i veli\u010Dinu grafikona
-ExcelChart_Label_UseExistingChart=Upotrijebi postoje\u0107i grafikon
-ExcelChart_Label_UseExistingChartHint=Ako je selektiran postoje\u0107i grafikon upotrebljava se ozna\u010Deni predlo\u017Eak
-ExcelChart_Label_UseSelectiveExport=Upotrijebiti selektivni izvoz
-ExcelChart_Label_UseSelectiveExportHint=Ako je selektirano samo redovi ozna\u010Deni ispod su izvezeni
-ExcelChart_Label_Width=\u0160irina
-ExcelChart_Label_WorksheetName=Radni list
-ExcelChart_Label_XAxis=X-os
-ExcelChart_Label_YAxes=Y-os
-ExcelChart_Status_Done=Excel grafikon je izvezen
-ExcelChart_Tab_Advanced=Napredno
-ExcelChart_Tab_Basic=Osnovno
-ExcelChart_Title_MainForm=Izvoz Excel grafikona
-ExcelChart_Type_Area3D=3D podru\u010Dje
-ExcelChart_Type_Area=Podru\u010Dje
-ExcelChart_Type_AreaStacked3D=Povr\u0161inski 3D
-ExcelChart_Type_AreaStacked=Povr\u0161inski
-ExcelChart_Type_BarsClustered3D=Trakasti grupirani stupac 3D
-ExcelChart_Type_BarsClustered=Trakasti grupirani stupac
-ExcelChart_Type_BarsStacked3D=Povr\u0161inski stupac 3D
-ExcelChart_Type_BarsStacked=Povr\u0161inski stupac
-ExcelChart_Type_ColumnsClustered3D=Stupci 3D
-ExcelChart_Type_ColumnsClustered=Stupci
-ExcelChart_Type_ColumnsStacked3D=Povr\u0161inski stup\u010Dasti 3D
-ExcelChart_Type_ColumnsStacked=Povr\u0161inski stup\u010Dasti
-ExcelChart_Type_Line=Linija
-ExcelChart_Type_LineStacked=Linijski povr\u0161inski
-ExcelChart_Type_Pie3D=Tortni 3D
-ExcelChart_Type_Pie=Tortni
-ExcelChart_Type_PieExploded3D=Razrezani tortni 3D
-ExcelChart_Type_PieExploded=Razrezani tortni
-ExcelChart_Various_Averaged=Prosje\u010Dno
-ExcelChart_Various_Column=Stupac
-ExcelChart_Various_Frequency=Frekvencija
-ExcelChart_Various_SummedUp=Sumirano
-ExcelChart_Various_Unknown=<Nepoznato>
-ExportDate=Datum izvoza
-ExtendedSearchAddAttributeMenu=Dodaj ograni\u010Denje (kriterij)...
-ExtendedSearchAddEntityPrefix=ima
-ExtendedSearchAnd=i
-ExtendedSearchEditAttributeMenu=Promijeni...
-ExtendedSearchEntitySuffix=s(a)
-ExtendedSearchNegateMenu=Negiraj
-ExtendedSearchRemoveAttributeMenu=Izbaci
-ExtendedSearchRemoveMenu=Izbaci
-FileExistsOwerwriteQuestion=Odabrana datoteka ve\u0107 postoji. Presnimi preko ove datoteke?
-FileName=Ime datoteke
-FileNotFoundMessage=Datoteku nije mogu\u0107e prona\u0107i\:
-FileNotFoundTitle=Datoteka nije prona\u0111ena.
-FilesOfType=Tip datoteke
-FormClosing=Zatvori
-FormPrint=Ispis
-FormSaveChangesQuestion=\u017Delite li spremiti promjene?
-FormStateLoad=U\u010Ditaj...
-FormStateStore=Spremi
-FormStateStoreAs=Spremi kao...
-GlobalBookmarks=Globalni Bookmark-ovi
-GlobalBookmarksAddMenu=Dodaj u Globalne Bookmark-ove
-Help=Pomo\u0107
-IOErrorInfo=Provjerite dokumente i vezu.
-IOErrorText=Gre\u0161ka u komunikaciji.
-IOErrorTitle=Pro\u010Ditaj / zapi\u0161i gre\u0161ku.
-InactiveState=neaktivno
-InactiveStates=Neaktivno
-Info=Informacija
-Interrupted=Prekinuto
-InterruptedErrorText=Proces je ru\u010Dno otkazan
-InterruptedErrorTitle=Proces otkazan
-JavaVMVersion=Java VM
-Language=Jezik
-LoadFormXmlFailedText=Datoteka nije kompatibilna s ovim dijalo\u0161kim okvirom.
-LogicDateIsInDays=je to\u010Dno u (dani)
-LogicDateIsInGEDays=je najranije u (dani)
-LogicDateIsInGEMonths=je najranije u (mjeseci)
-LogicDateIsInLEDays=je najkasnije u (dani)
-LogicDateIsInLEMonths=je najkasnije u (mjeseci)
-LogicDateIsInLastDays=je bilo nekoliko n dana
-LogicDateIsInLastMonths=je bilo nekoliko n mjeseci
-LogicDateIsInMonths=je to\u010Dno u (mjeseci)
-LogicDateIsInNextDays=\u0107e biti u nekoliko n dana
-LogicDateIsInNextMonths=\u0107e biti u sljede\u0107ih n mjeseci
-LogicDateIsNotToday=nije danas
-LogicDateIsToday=je danas
-LogicDateTimeIsInGEHours=je najranije u (sati)
-LogicDateTimeIsInGEMinutes=je najranije u (minute)
-LogicDateTimeIsInLEHours=je najkasnije u (sati)
-LogicDateTimeIsInLEMinutes=je najkasnije u (minute)
-LogicDateTimeIsNotNow=nije sad
-LogicDateTimeIsNow=sad
-LogicEQ=\=
-LogicEndsWith=zavr\u0161ava sa
-LogicGE=>\=
-LogicGT=>
-LogicIn=Je
-LogicLE=<\=
-LogicLT=<
-LogicLike=Sadr\u017Ei
-LogicNEQ=<>
-LogicNotIn=nije
-LogicNotLike=ne sadr\u017Ei
-LogicNotNull=nije prazno
-LogicNull=je prazno
-LogicStartsWith=Po\u010Dinje sa
-LogicTimeIsInGEHours=je najranije u (sati)
-LogicTimeIsInGEMinutes=je najranije u (minute)
-LogicTimeIsInHours=je to\u010Dno u (sati)
-LogicTimeIsInLEHours=je najkasnije u (sati)
-LogicTimeIsInLEMinutes=je najkasnije u (minute)
-LogicTimeIsInMinutes=je to\u010Dno u (minute)
-LogicTimeIsNotNow=nije sad
-LogicTimeIsNow=je sad
-Login=Prijava
-LookIn=Pogledaj u
-Month=Mjesec
-Name=Ime
-NetErrorInfo=Provjeri ime servera (poslu\u017Eitelja), URL i vezu.
-NetErrorText=Server nije prona\u0111en.
-NetErrorTitle=Gre\u0161ka u mre\u017Ei
-NewPassword=Nova lozinka
-No=Ne
-NoButton=&Ne
-NumberOfRows=Brojanje redaka
-OSUser=Korisnik sustava
-OSVersion=Verzija sustava
-Ok=Ok
-OkButton=&Ok
-OkButtonTooltip=Spremi i zatvori dijalo\u0161ki okvir.
-OldPassword=Stara lozinka
-Op=Operater
-Open=Otvori
-Password=Lozinka
-PasswordsDoNotMatch=Ove dvije lozinka se ne sla\u017Eu.
-Paste=Zalijepi
-Path=Put
-RepeatPassword=Ponovi
-ResetButton=&Ponovo pokreni
-ResetButtonTooltip=Postavi sva dijalo\u0161ka polja na prazne vrijednosti.
-SC_Help_AddToDictionary=Dodaj krivo napisane rije\u010Di u rje\u010Dnik
-SC_Help_IgnoreAll=Ne obaziri se sada i za sve ostalo
-SC_Help_Language=Ozna\u010Deni jezik
-SC_Help_RemoveWord=Ukloni ozna\u010Denu rije\u010D iz korisni\u010Dkog rje\u010Dnika
-SC_Help_Undo=Vrati posljednju promjenu
-SC_Help_UseDefaults=Koristi predodre\u0111ene postavke
-SC_Label_AddToDictionary=Dodaj u rje\u010Dnik
-SC_Label_Cancel=Poni\u0161ti
-SC_Label_Capitalization=Veliko slovo
-SC_Label_Change=Promijeni
-SC_Label_ChangeAll=Promijeni sve
-SC_Label_ChangeTo=Promijeni u
-SC_Label_ContainsDigits=Sadr\u017Ei znamenke
-SC_Label_Enable=Aktiviraj provjeru pravopisa
-SC_Label_Ignore=Zanemari
-SC_Label_IgnoreAll=Zanemari sve
-SC_Label_IgnoreCase=Ignoriraj slu\u010Daj
-SC_Label_IgnoreDomainNames=Zanemari imena domena
-SC_Label_IgnoreWordsWithNumbers=Zanemari rije\u010Di s brojevima
-SC_Label_IgnoredWord=Zanemarena rije\u010D
-SC_Label_Main=Glavne postavke
-SC_Label_MixedCase=Mije\u0161ani slu\u010Daj
-SC_Label_NoSuggestions=(Nema prijedloga)
-SC_Label_NotInDictionary=Ozna\u010Dena rije\u010D nije prepoznata
-SC_Label_Options=Opcije
-SC_Label_RemoveWord=Ukloni rije\u010D
-SC_Label_Shortcut=Pre\u010Dica
-SC_Label_Spelling=Pravopis
-SC_Label_Undo=Obri\u0161i
-SC_Label_UseDefaults=Koristi predlo\u017Eeno
-SC_Label_UserDictionary=Korisni\u010Dki rje\u010Dnik
-SC_Language=Jezik
-SC_Message_CheckRest=Da li \u017Eeli\u0161 provjeriti ostatak teksta?
-SC_Message_Complete=Provjera pravopisa zavr\u0161ena
-SC_Message_CompleteForSelection=Provjera pravopisa izvr\u0161ena za ozna\u010Deno
-Save=Spremi
-SaveButton=&Spremi
-SaveButtonTooltip=Spremi dijalo\u0161ki okvir bez zatvaranja.
-SearchButton=&Tra\u017Ei
-SearchButtonTooltip=Zatvori dijalo\u0161ki okvir i zapo\u010Dni pretra\u017Eivanje.
-SearchConstraints=Ograni\u010Denja (kriteriji) pretra\u017Eivanja
-Server=Server (poslu\u017Eitelj)
-SmartFieldMoreThanXRows=Vi\u0161e od {0} redova. Poka\u017Ei samo {1}
-SmartFindLabel=Pretra\u017Ei tekst
-StatusExportDone=Izvoz izvr\u0161en
-Today=danas
-TooManyRows=Velika koli\u010Dina podataka. Smanjite koli\u010Dinu podataka koriste\u0107i Pretra\u017Eivanje.
-Update=A\u017Euriraj
-UserInterrupted=Korisnik obustavio.
-Username=Korisni\u010Dko ime
-Value=Vrijednost
-Week=Tjedan
-WeekShort=CW
-WizardCancelButton=Odustani
-WizardNextButton=&Slijede\u0107e
-WizardSuspendButton=&Zatvori
-WorkWeek=Radni tjedan
-Yes=Da
-YesButton=&Da
-and=i
-from=od
-to=do
+ActiveAndInactiveStates=Aktivni+Naektivni
+ActiveStates=Aktivan
+AllStates=Sve
+Apply=Primijeni
+Attribute=Pripi\u0161i
+Bookmarks=Ozna\u010Dene stranice (bookmarks)
+BookmarksAddMenu=&Dodaj me\u0111u ozna\u010Dene stranice (bookmarks)
+BookmarksMainMenu=&Ozna\u010Dene stranice (bookmarks)
+BookmarksManageMenu=&Upravljaj ozna\u010Denim stranicama (bookmarks)...
+BookmarksStartPageMenu=&Po\u010Detni pregled
+BookmarksStartPageMenuClear=&Nema po\u010Detnog pogleda
+BookmarksStartPageMenuGoto=&Otvori po\u010Detni pregled
+BookmarksStartPageMenuSet=&Postavi trenutni pogled kao po\u010Detni
+ButtonDeselectAll=Odzna\u010Di sve
+ButtonSelectAll=Ozna\u010Di sve
+Calendar_earlier=Ranije
+Calendar_later=Kasnije
+Cancel=Odustani
+CancelButton=&Odustani
+CancelButtonTooltip=Zatvori dijalo\u0161ki okvir bez spremanja; i dijalo\u0161ki okvir za potvrdu ako je potrebno.
+ChangePassword=Promijeni lozinku
+CloseButton=&Zatvori
+CloseButtonTooltip=Zatvori dijalo\u0161ki okvir bez spremanja.
+Column=Stupac
+Columns=Stupci
+ComposerFieldAggregationLabel=Funkcija
+Condensed=6 stupaca
+Copy=Kopiraj
+Cut=Izre\u017Ei
+Day=Dan
+DefaultPasswordPolicyText=Lozinka ne zadovoljava sigurnosne propise o snazi lozinke\n\nSigurnosni propis\n- najmanje 8 znakova\n- najmanje jedan broj (0-9)\n- najmanje jedan specijalni znak (\!|@|\#|$|%|^|&|*|(|)|_|+|||~|-|)
+EmailFrom=Iz
+EmailSubject=Predmet
+EmailTo=To
+Error=Gre\u0161ka
+ErrorAndRetryTextDefault=Do\u0161lo je do gre\u0161ke prilikom prijenosa podataka.
+ErrorTextLogin=Neva\u017Ee\u0107e korisni\u010Dko ime/lozinka
+ErrorTitleLogin=Prijava nije uspjela
+ExcelChart_Button_LoadDefaults=Defaults
+ExcelChart_Button_LoadDefaultsHint=Resetiraj ovaj dijalog u\u010Ditavaju\u0107i default vrijednosti
+ExcelChart_Button_LoadProfile=U\u010Ditavam profil...
+ExcelChart_Button_LoadProfileHint=U\u010Ditaj postavke iz XML datoteke
+ExcelChart_Button_SaveProfile=Spremi profil
+ExcelChart_Button_SaveProfileHint=Spremi trenutne postavke u XML datoteku
+ExcelChart_Error_CreatingChartFailed=Izrada grafikona nije uspjela
+ExcelChart_Error_ExportingFailed=Izvoz nije uspio iz razloga
+ExcelChart_Error_InitializationFailed=Inicijalizacija klase/a za podr\u0161ku nije uspjela
+ExcelChart_Error_LoadingProfileFailed=U\u010Ditavanje profila nije uspjelo iz razloga
+ExcelChart_Error_LoadingTemplateFailed=U\u010Ditavanje predlo\u0161ka nije uspjelo
+ExcelChart_Error_RetrivingOutlineDataFailed=Dobivanje pregleda podataka nije uspjelo
+ExcelChart_Error_SavingProfileFailed=Spremanje profila nije uspjelo
+ExcelChart_Error_WrongProfile=Profil je kreiran za drugi pregled
+ExcelChart_Label_AutomaticMode=Automatski mod
+ExcelChart_Label_AutomaticModeHint=Sakrij Excel i automatski spremi
+ExcelChart_Label_ChartNumber=Broj grafikona
+ExcelChart_Label_ChartType=Tip grafikona
+ExcelChart_Label_FileName=Ime datoteke
+ExcelChart_Label_FirstRow=Prvi redak
+ExcelChart_Label_Height=Visina
+ExcelChart_Label_HistogramMode=Histogram mod
+ExcelChart_Label_HistogramModeHint=Histogram mod kombinira ovoj vrijednosti jednake vrijednosti na X-osi
+ExcelChart_Label_LastRow=Zadnji redak
+ExcelChart_Label_Offset=Pozicija
+ExcelChart_Label_SkipNullValues=Presko\u010Di null vrijednosti u histogram modu
+ExcelChart_Label_SkipNullValuesHint=Ako su ozna\u010Dene null vrijednosti na X-osi ignorirane , ina\u010De su kombinirane sa <Unknown>
+ExcelChart_Label_TemplateName=Predlo\u017Eak
+ExcelChart_Label_UseCustomFormat=Upotrijebi prilago\u0111eni format
+ExcelChart_Label_UseCustomFormatHint=Ako je selektirano mo\u017Eete ozna\u010Diti polo\u017Eaj i veli\u010Dinu grafikona
+ExcelChart_Label_UseExistingChart=Upotrijebi postoje\u0107i grafikon
+ExcelChart_Label_UseExistingChartHint=Ako je selektiran postoje\u0107i grafikon upotrebljava se ozna\u010Deni predlo\u017Eak
+ExcelChart_Label_UseSelectiveExport=Upotrijebiti selektivni izvoz
+ExcelChart_Label_UseSelectiveExportHint=Ako je selektirano samo redovi ozna\u010Deni ispod su izvezeni
+ExcelChart_Label_Width=\u0160irina
+ExcelChart_Label_WorksheetName=Radni list
+ExcelChart_Label_XAxis=X-os
+ExcelChart_Label_YAxes=Y-os
+ExcelChart_Status_Done=Excel grafikon je izvezen
+ExcelChart_Tab_Advanced=Napredno
+ExcelChart_Tab_Basic=Osnovno
+ExcelChart_Title_MainForm=Izvoz Excel grafikona
+ExcelChart_Type_Area3D=3D podru\u010Dje
+ExcelChart_Type_Area=Podru\u010Dje
+ExcelChart_Type_AreaStacked3D=Povr\u0161inski 3D
+ExcelChart_Type_AreaStacked=Povr\u0161inski
+ExcelChart_Type_BarsClustered3D=Trakasti grupirani stupac 3D
+ExcelChart_Type_BarsClustered=Trakasti grupirani stupac
+ExcelChart_Type_BarsStacked3D=Povr\u0161inski stupac 3D
+ExcelChart_Type_BarsStacked=Povr\u0161inski stupac
+ExcelChart_Type_ColumnsClustered3D=Stupci 3D
+ExcelChart_Type_ColumnsClustered=Stupci
+ExcelChart_Type_ColumnsStacked3D=Povr\u0161inski stup\u010Dasti 3D
+ExcelChart_Type_ColumnsStacked=Povr\u0161inski stup\u010Dasti
+ExcelChart_Type_Line=Linija
+ExcelChart_Type_LineStacked=Linijski povr\u0161inski
+ExcelChart_Type_Pie3D=Tortni 3D
+ExcelChart_Type_Pie=Tortni
+ExcelChart_Type_PieExploded3D=Razrezani tortni 3D
+ExcelChart_Type_PieExploded=Razrezani tortni
+ExcelChart_Various_Averaged=Prosje\u010Dno
+ExcelChart_Various_Column=Stupac
+ExcelChart_Various_Frequency=Frekvencija
+ExcelChart_Various_SummedUp=Sumirano
+ExcelChart_Various_Unknown=<Nepoznato>
+ExportDate=Datum izvoza
+ExtendedSearchAddAttributeMenu=Dodaj ograni\u010Denje (kriterij)...
+ExtendedSearchAddEntityPrefix=ima
+ExtendedSearchAnd=i
+ExtendedSearchEditAttributeMenu=Promijeni...
+ExtendedSearchEntitySuffix=s(a)
+ExtendedSearchNegateMenu=Negiraj
+ExtendedSearchRemoveAttributeMenu=Izbaci
+ExtendedSearchRemoveMenu=Izbaci
+FileExistsOwerwriteQuestion=Odabrana datoteka ve\u0107 postoji. Presnimi preko ove datoteke?
+FileName=Ime datoteke
+FileNotFoundMessage=Datoteku nije mogu\u0107e prona\u0107i\:
+FileNotFoundTitle=Datoteka nije prona\u0111ena.
+FilesOfType=Tip datoteke
+FormClosing=Zatvori
+FormPrint=Ispis
+FormSaveChangesQuestion=\u017Delite li spremiti promjene?
+FormStateLoad=U\u010Ditaj...
+FormStateStore=Spremi
+FormStateStoreAs=Spremi kao...
+GlobalBookmarks=Globalni Bookmark-ovi
+GlobalBookmarksAddMenu=Dodaj u Globalne Bookmark-ove
+Help=Pomo\u0107
+IOErrorInfo=Provjerite dokumente i vezu.
+IOErrorText=Gre\u0161ka u komunikaciji.
+IOErrorTitle=Pro\u010Ditaj / zapi\u0161i gre\u0161ku.
+InactiveState=neaktivno
+InactiveStates=Neaktivno
+Info=Informacija
+Interrupted=Prekinuto
+InterruptedErrorText=Proces je ru\u010Dno otkazan
+InterruptedErrorTitle=Proces otkazan
+JavaVMVersion=Java VM
+Language=Jezik
+LoadFormXmlFailedText=Datoteka nije kompatibilna s ovim dijalo\u0161kim okvirom.
+LogicDateIsInDays=je to\u010Dno u (dani)
+LogicDateIsInGEDays=je najranije u (dani)
+LogicDateIsInGEMonths=je najranije u (mjeseci)
+LogicDateIsInLEDays=je najkasnije u (dani)
+LogicDateIsInLEMonths=je najkasnije u (mjeseci)
+LogicDateIsInLastDays=je bilo nekoliko n dana
+LogicDateIsInLastMonths=je bilo nekoliko n mjeseci
+LogicDateIsInMonths=je to\u010Dno u (mjeseci)
+LogicDateIsInNextDays=\u0107e biti u nekoliko n dana
+LogicDateIsInNextMonths=\u0107e biti u sljede\u0107ih n mjeseci
+LogicDateIsNotToday=nije danas
+LogicDateIsToday=je danas
+LogicDateTimeIsInGEHours=je najranije u (sati)
+LogicDateTimeIsInGEMinutes=je najranije u (minute)
+LogicDateTimeIsInLEHours=je najkasnije u (sati)
+LogicDateTimeIsInLEMinutes=je najkasnije u (minute)
+LogicDateTimeIsNotNow=nije sad
+LogicDateTimeIsNow=sad
+LogicEQ=\=
+LogicEndsWith=zavr\u0161ava sa
+LogicGE=>\=
+LogicGT=>
+LogicIn=Je
+LogicLE=<\=
+LogicLT=<
+LogicLike=Sadr\u017Ei
+LogicNEQ=<>
+LogicNotIn=nije
+LogicNotLike=ne sadr\u017Ei
+LogicNotNull=nije prazno
+LogicNull=je prazno
+LogicStartsWith=Po\u010Dinje sa
+LogicTimeIsInGEHours=je najranije u (sati)
+LogicTimeIsInGEMinutes=je najranije u (minute)
+LogicTimeIsInHours=je to\u010Dno u (sati)
+LogicTimeIsInLEHours=je najkasnije u (sati)
+LogicTimeIsInLEMinutes=je najkasnije u (minute)
+LogicTimeIsInMinutes=je to\u010Dno u (minute)
+LogicTimeIsNotNow=nije sad
+LogicTimeIsNow=je sad
+Login=Prijava
+LookIn=Pogledaj u
+Month=Mjesec
+Name=Ime
+NetErrorInfo=Provjeri ime servera (poslu\u017Eitelja), URL i vezu.
+NetErrorText=Server nije prona\u0111en.
+NetErrorTitle=Gre\u0161ka u mre\u017Ei
+NewPassword=Nova lozinka
+No=Ne
+NoButton=&Ne
+NumberOfRows=Brojanje redaka
+OSUser=Korisnik sustava
+OSVersion=Verzija sustava
+Ok=Ok
+OkButton=&Ok
+OkButtonTooltip=Spremi i zatvori dijalo\u0161ki okvir.
+OldPassword=Stara lozinka
+Op=Operater
+Open=Otvori
+Password=Lozinka
+PasswordsDoNotMatch=Ove dvije lozinka se ne sla\u017Eu.
+Paste=Zalijepi
+Path=Put
+RepeatPassword=Ponovi
+ResetButton=&Ponovo pokreni
+ResetButtonTooltip=Postavi sva dijalo\u0161ka polja na prazne vrijednosti.
+SC_Help_AddToDictionary=Dodaj krivo napisane rije\u010Di u rje\u010Dnik
+SC_Help_IgnoreAll=Ne obaziri se sada i za sve ostalo
+SC_Help_Language=Ozna\u010Deni jezik
+SC_Help_RemoveWord=Ukloni ozna\u010Denu rije\u010D iz korisni\u010Dkog rje\u010Dnika
+SC_Help_Undo=Vrati posljednju promjenu
+SC_Help_UseDefaults=Koristi predodre\u0111ene postavke
+SC_Label_AddToDictionary=Dodaj u rje\u010Dnik
+SC_Label_Cancel=Poni\u0161ti
+SC_Label_Capitalization=Veliko slovo
+SC_Label_Change=Promijeni
+SC_Label_ChangeAll=Promijeni sve
+SC_Label_ChangeTo=Promijeni u
+SC_Label_ContainsDigits=Sadr\u017Ei znamenke
+SC_Label_Enable=Aktiviraj provjeru pravopisa
+SC_Label_Ignore=Zanemari
+SC_Label_IgnoreAll=Zanemari sve
+SC_Label_IgnoreCase=Ignoriraj slu\u010Daj
+SC_Label_IgnoreDomainNames=Zanemari imena domena
+SC_Label_IgnoreWordsWithNumbers=Zanemari rije\u010Di s brojevima
+SC_Label_IgnoredWord=Zanemarena rije\u010D
+SC_Label_Main=Glavne postavke
+SC_Label_MixedCase=Mije\u0161ani slu\u010Daj
+SC_Label_NoSuggestions=(Nema prijedloga)
+SC_Label_NotInDictionary=Ozna\u010Dena rije\u010D nije prepoznata
+SC_Label_Options=Opcije
+SC_Label_RemoveWord=Ukloni rije\u010D
+SC_Label_Shortcut=Pre\u010Dica
+SC_Label_Spelling=Pravopis
+SC_Label_Undo=Obri\u0161i
+SC_Label_UseDefaults=Koristi predlo\u017Eeno
+SC_Label_UserDictionary=Korisni\u010Dki rje\u010Dnik
+SC_Language=Jezik
+SC_Message_CheckRest=Da li \u017Eeli\u0161 provjeriti ostatak teksta?
+SC_Message_Complete=Provjera pravopisa zavr\u0161ena
+SC_Message_CompleteForSelection=Provjera pravopisa izvr\u0161ena za ozna\u010Deno
+Save=Spremi
+SaveButton=&Spremi
+SaveButtonTooltip=Spremi dijalo\u0161ki okvir bez zatvaranja.
+SearchButton=&Tra\u017Ei
+SearchButtonTooltip=Zatvori dijalo\u0161ki okvir i zapo\u010Dni pretra\u017Eivanje.
+SearchConstraints=Ograni\u010Denja (kriteriji) pretra\u017Eivanja
+Server=Server (poslu\u017Eitelj)
+SmartFieldMoreThanXRows=Vi\u0161e od {0} redova. Poka\u017Ei samo {1}
+SmartFindLabel=Pretra\u017Ei tekst
+StatusExportDone=Izvoz izvr\u0161en
+Today=danas
+TooManyRows=Velika koli\u010Dina podataka. Smanjite koli\u010Dinu podataka koriste\u0107i Pretra\u017Eivanje.
+Update=A\u017Euriraj
+UserInterrupted=Korisnik obustavio.
+Username=Korisni\u010Dko ime
+Value=Vrijednost
+Week=Tjedan
+WeekShort=CW
+WizardCancelButton=Odustani
+WizardNextButton=&Slijede\u0107e
+WizardSuspendButton=&Zatvori
+WorkWeek=Radni tjedan
+Yes=Da
+YesButton=&Da
+and=i
+from=od
+to=do
diff --git a/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_hu.properties b/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_hu.properties
index 56a6776e39..5352b7e969 100644
--- a/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_hu.properties
+++ b/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_hu.properties
@@ -1,222 +1,222 @@
-ActiveAndInactiveStates=Akt\u00EDv + inakt\u00EDv
-AllStates=Mind
-Apply=Alkalmaz
-Attribute=Tulajdons\u00E1g
-Bookmarks=K\u00F6nyvjelzok
-BookmarksAddMenu=K\u00F6nyvjelzokh\u00F6z ad.
-BookmarksMainMenu=K\u00F6nyvjelzok
-BookmarksManageMenu=K\u00F6nyvjelzok rendez\u00E9se
-BookmarksStartPageMenu=Ind\u00EDt\u00E1si n\u00E9zet
-BookmarksStartPageMenuClear=Nincs ind\u00EDt\u00E1si n\u00E9zet
-BookmarksStartPageMenuGoto=Ind\u00EDt\u00E1si n\u00E9zet megnyit\u00E1sa
-BookmarksStartPageMenuSet=Jelen n\u00E9zet be\u00E1ll\u00EDt\u00E1sa ind\u00EDt\u00E1si n\u00E9zetnek
-ButtonDeselectAll=Deselect all
-ButtonSelectAll=Mindent kiv\u00E1laszt
-Calendar_earlier=Kor\u00E1bban
-Calendar_later=K\u00E9sobb
-Cancel=M\u00E9gse
-CancelButton=&M\u00E9gse
-CancelButtonTooltip=P\u00E1rbesz\u00E9d bez\u00E1r\u00E1sa ment\u00E9s n\u00E9lk\u00FCl, megeros\u00EDto p\u00E1rbesz\u00E9ddel, ha sz\u00FCks\u00E9ges
-ChangePassword=Jelsz\u00F3 megv\u00E1ltoztat\u00E1sa
-CloseButton=&Bez\u00E1r
-CloseButtonTooltip=P\u00E1rbesz\u00E9d bez\u00E1r\u00E1sa ment\u00E9s n\u00E9lk\u00FCl
-Column=Oszlop
-Columns=Oszlopok
-ComposerFieldAggregationLabel=Function
-Condensed=6 oszlop
-Copy=M\u00E1sol
-Cut=Kiv\u00E1g\u00E1s
-Day=Nap
-DefaultPasswordPolicyText=The password does not comply with the given policy\n\nPolicy\:\n- at least 8 characters\n- at least one number (0-9)\n- at least one non standard character (\!|@|\#|$|%|^|&|*|(|)|_|+|||~|-|
-EmailSubject=T\u00E1rgy
-Error=Hiba
-ErrorAndRetryTextDefault=Hiba mer\u00FClt fel az adattov\u00E1bb\u00EDt\u00E1s sor\u00E1n
-ErrorTextLogin=\u00C9rv\u00E9nytelen felhaszn\u00E1l\u00F3n\u00E9v vagy jelsz\u00F3
-ErrorTitleLogin=Bel\u00E9p\u00E9s meghi\u00FAsult
-ExcelChart_Button_LoadDefaults=Defaults
-ExcelChart_Button_LoadDefaultsHint=Resets this dialog by loading the default values.
-ExcelChart_Button_LoadProfile=Load profile...
-ExcelChart_Button_LoadProfileHint=Loads settings from an XML file.
-ExcelChart_Button_SaveProfile=Save profile...
-ExcelChart_Button_SaveProfileHint=Aktu\u00E1lis be\u00E1l\u00EDt\u00E1sok elment\u00E9se XML-be
-ExcelChart_Error_CreatingChartFailed=creating chart failed.
-ExcelChart_Error_ExportingFailed=Export failed because
-ExcelChart_Error_InitializationFailed=A t\u00E1mogat\u00F3 oszt\u00E1ly(ok) inicializ\u00E1l\u00E1sa nem siker\u00FClt
-ExcelChart_Error_LoadingProfileFailed=Loading profile failed because
-ExcelChart_Error_LoadingTemplateFailed=loading template failed.
-ExcelChart_Error_RetrivingOutlineDataFailed=retriving outline data failed.
-ExcelChart_Error_SavingProfileFailed=Saving profile failed because
-ExcelChart_Error_WrongProfile=the profile was created for another outline.
-ExcelChart_Label_AutomaticMode=Automatic mode
-ExcelChart_Label_AutomaticModeHint=Hide Excel and save automatically.
-ExcelChart_Label_ChartNumber=Chart number
-ExcelChart_Label_ChartType=Chart type
-ExcelChart_Label_FileName=Filename
-ExcelChart_Label_FirstRow=First row
-ExcelChart_Label_Height=Height
-ExcelChart_Label_HistogramMode=Histogram mode
-ExcelChart_Label_HistogramModeHint=The histogram mode combines identical values on the X-Axis to one.
-ExcelChart_Label_LastRow=Last row
-ExcelChart_Label_Offset=Position
-ExcelChart_Label_SkipNullValues=Skip null values in histogram mode
-ExcelChart_Label_SkipNullValuesHint=If checked null values on the X-Axis are ignored, otherwise they are combined to <Unknown>.
-ExcelChart_Label_TemplateName=Template
-ExcelChart_Label_UseCustomFormat=Egy\u00E9ni fomr\u00E1tum haszn\u00E1lata
-ExcelChart_Label_UseCustomFormatHint=Ha be van jel\u00F6lve, megadhat\u00F3 a diagram poz\u00EDci\u00F3ja \u00E9s m\u00E9rete.
-ExcelChart_Label_UseExistingChart=Use existing chart
-ExcelChart_Label_UseExistingChartHint=If checked the existing chart in the indicated template is used.
-ExcelChart_Label_UseSelectiveExport=Use selective export
-ExcelChart_Label_UseSelectiveExportHint=If checked only the rows indicated below are exported.
-ExcelChart_Label_Width=Width
-ExcelChart_Label_WorksheetName=Worksheet
-ExcelChart_Label_XAxis=X-Axis
-ExcelChart_Label_YAxes=Y-tengely
-ExcelChart_Status_Done=Excel Chart Export is done.
-ExcelChart_Tab_Advanced=Advanced
-ExcelChart_Tab_Basic=Basic
-ExcelChart_Title_MainForm=Excel Chart Export
-ExcelChart_Type_Area3D=Area 3D
-ExcelChart_Type_Area=Area
-ExcelChart_Type_AreaStacked3D=Area Stacked 3D
-ExcelChart_Type_AreaStacked=Area Stacked
-ExcelChart_Type_BarsClustered3D=Bars Clustered 3D
-ExcelChart_Type_BarsClustered=Bars Clustered
-ExcelChart_Type_BarsStacked3D=Bars Stacked 3D
-ExcelChart_Type_BarsStacked=Bars Stacked
-ExcelChart_Type_ColumnsClustered3D=Columns Clustered 3D
-ExcelChart_Type_ColumnsClustered=Columns Clustered
-ExcelChart_Type_ColumnsStacked3D=Columns Stacked 3D
-ExcelChart_Type_ColumnsStacked=Columns Stacked
-ExcelChart_Type_Line=Line
-ExcelChart_Type_LineStacked=Line Stacked
-ExcelChart_Type_Pie3D=Pie 3D
-ExcelChart_Type_Pie=Pie
-ExcelChart_Type_PieExploded3D=Pie Exploded 3D
-ExcelChart_Type_PieExploded=Pie exploded
-ExcelChart_Various_Averaged=averaged
-ExcelChart_Various_Column=Column
-ExcelChart_Various_Frequency=Frequency
-ExcelChart_Various_SummedUp=summed up
-ExcelChart_Various_Unknown=<Unknown>
-ExportDate=Export d\u00E1tuma
-ExtendedSearchAddAttributeMenu=Sz\u0171k\u00EDt\u00E9s hozz\u00E1ad\u00E1sa
-ExtendedSearchAddEntityPrefix=van
-ExtendedSearchAnd=and
-ExtendedSearchEditAttributeMenu=Szerkeszt...
-ExtendedSearchEntitySuffix=val
-ExtendedSearchNegateMenu=k\u00F6z\u00F6mb\u00F6s\u00EDt
-ExtendedSearchRemoveAttributeMenu=T\u00F6r\u00F6l...
-ExtendedSearchRemoveMenu=T\u00F6r\u00F6l...
-FileExistsOwerwriteQuestion=A kiv\u00E1lasztott f\u00E1jl m\u00E1r l\u00E9tezik. Fel\u00FCl\u00EDrja ezt a f\u00E1ljt?
-FileName=F\u00E1jln\u00E9v
-FileNotFoundMessage=F\u00E1jl nem tal\u00E1lhat\u00F3
-FileNotFoundTitle=F\u00E1jl nem tal\u00E1lhat\u00F3
-FilesOfType=F\u00E1jlt\u00EDpus
-FormPrint=Nyomtat
-FormSaveChangesQuestion=El akarja menteni a v\u00E1ltoz\u00E1sokat?
-FormStateLoad=T\u00F6lt\u00E9s...
-FormStateStore=Ment\u00E9s
-FormStateStoreAs=Ment\u00E9s m\u00E1sk\u00E9nt
-GlobalBookmarks=Global Bookmarks
-GlobalBookmarksAddMenu=Add to &global bookmarks
-Help=S\u00FAg\u00F3
-IOErrorInfo=Ellenorizze a f\u00E1jlokat \u00E9s a csatlakoz\u00E1st
-IOErrorText=Kommunik\u00E1ci\u00F3s hiba
-IOErrorTitle=Olvas\u00E1s/\u00EDr\u00E1s hiba
-Info=Inform\u00E1ci\u00F3
-Interrupted=Megszak\u00EDtva
-InterruptedErrorText=The Process has manually been cancelled.
-InterruptedErrorTitle=Process cancelled
-JavaVMVersion=Java VM
-Language=Nyelv
-LoadFormXmlFailedText=Ez a f\u00E1jl nem kompatibilis ezzel a p\u00E1rbesz\u00E9ddel
-LogicDateIsInDays=is in exactly (days)
-LogicDateIsInGEDays=is earliest in (days)
-LogicDateIsInGEMonths=is earliest in (months)
-LogicDateIsInLEDays=is latest in (days)
-LogicDateIsInLEMonths=is latest in (months)
-LogicDateIsInMonths=Pontosan n h\u00F3nap m\u00FAlva
-LogicDateIsNotToday=nem ma
-LogicDateIsToday=is today
-LogicDateTimeIsInGEHours=is earliest in (hours)
-LogicDateTimeIsInGEMinutes=is earliest in (minutes)
-LogicDateTimeIsInLEHours=is latest in (hours)
-LogicDateTimeIsInLEMinutes=is latest in (minutes)
-LogicDateTimeIsNotNow=is not now
-LogicDateTimeIsNow=is now
-LogicEQ=\=
-LogicEndsWith=V\u00E9gzodik
-LogicGE=>\=
-LogicGT=>
-LogicIn=Van
-LogicLE=<\=
-LogicLT=<
-LogicLike=Tartalmaz
-LogicNEQ=<>
-LogicNotIn=nem
-LogicNotLike=nem tartalmaz
-LogicNotNull=nem \u00FCres
-LogicNull=\u00FCres
-LogicStartsWith=Vel kezdodik
-LogicTimeIsInGEHours=is earliest in (hours)
-LogicTimeIsInGEMinutes=is earliest in (minutes)
-LogicTimeIsInHours=pontosan (hours) \u00F3ra m\u00FAlva
-LogicTimeIsInLEHours=is latest in (hours)
-LogicTimeIsInLEMinutes=is latest in (minutes)
-LogicTimeIsInMinutes=is in exactly (minutes)
-LogicTimeIsNotNow=is not now
-LogicTimeIsNow=is now
-Login=Bel\u00E9p\u00E9s
-LookIn=Ben\u00E9z
-Month=H\u00F3nap
-Name=N\u00E9v
-NetErrorInfo=Ellenorizze a szerver nevet, URL-t \u00E9s a kapcsolatot.
-NetErrorText=Szerver nem tal\u00E1lhat\u00F3
-NetErrorTitle=H\u00E1l\u00F3zati hiba
-NewPassword=\u00DAj jelsz\u00F3
-No=Nem
-NoButton=Nem
-NumberOfRows=Sorsz\u00E1ml\u00E1l\u00E1s
-OSUser=Rendszerfelhaszn\u00E1l\u00F3
-OSVersion=Rendszerverzi\u00F3
-Ok=Ok
-OkButton=Ok
-OkButtonTooltip=P\u00E1rbesz\u00E9d ment\u00E9se \u00E9s bez\u00E1r\u00E1sa
-OldPassword=R\u00E9gi jelsz\u00F3
-Op=Oper\u00E1tor
-Open=Megnyit
-Password=Jelsz\u00F3
-PasswordsDoNotMatch=A k\u00E9t jelsz\u00F3 nem egyezik.
-Paste=Beilleszt
-Path=\u00DAt
-RepeatPassword=\u00DAjra
-ResetButton=\u00DAjraind\u00EDt
-ResetButtonTooltip=\u00D6sszes p\u00E1rbesz\u00E9d mez\u0151 be\u00E1ll\u00EDt\u00E1sa \u00FCres \u00E9rt\u00E9kre
-SC_Label_AddToDictionary=Hozz\u00E1ad\u00E1s a sz\u00F3t\u00E1rhoz
-SC_Label_Ignore=Figyelmen k\u00EDv\u00FCl hagy\u00E1s
-Save=Ment\u00E9s
-SaveButton=Ment\u00E9s
-SaveButtonTooltip=P\u00E1rbesz\u00E9d ment\u00E9se bez\u00E1r\u00E1s n\u00E9lk\u00FCl
-SearchButton=Keres\u00E9s
-SearchButtonTooltip=P\u00E1rbesz\u00E9d bez\u00E1r\u00E1sa \u00E9s keres\u00E9s ind\u00EDt\u00E1sa
-SearchConstraints=Keres\u00E9si felt\u00E9telek
-Server=Szerver
-SmartFieldMoreThanXRows=T\u00F6bb mint {0} sor. {1} sor megjelen\u00EDtve.
-SmartFindLabel=Sz\u00F6veg keres\u00E9se
-StatusExportDone=Export\u00E1l\u00E1s befejezve
-Today=today
-TooManyRows=Nagy adatk\u00E9szlet. K\u00E9rem szuk\u00EDtsen a Keres panel haszn\u00E1lat\u00E1val.
-Update=Friss\u00EDt\u00E9s
-UserInterrupted=Felhaszn\u00E1l\u00F3 \u00E1ltal megszak\u00EDtva
-Username=Felhaszn\u00E1l\u00F3n\u00E9v
-Value=\u00C9rt\u00E9k
-Week=H\u00E9t
-WeekShort=CW
-WizardCancelButton=M\u00E9gse
-WizardSuspendButton=&Bez\u00E1r
-WorkWeek=Munkah\u00E9t
-Yes=Igen
-YesButton=&Yes
-and=and
-from=from
-to=to
+ActiveAndInactiveStates=Akt\u00EDv + inakt\u00EDv
+AllStates=Mind
+Apply=Alkalmaz
+Attribute=Tulajdons\u00E1g
+Bookmarks=K\u00F6nyvjelzok
+BookmarksAddMenu=K\u00F6nyvjelzokh\u00F6z ad.
+BookmarksMainMenu=K\u00F6nyvjelzok
+BookmarksManageMenu=K\u00F6nyvjelzok rendez\u00E9se
+BookmarksStartPageMenu=Ind\u00EDt\u00E1si n\u00E9zet
+BookmarksStartPageMenuClear=Nincs ind\u00EDt\u00E1si n\u00E9zet
+BookmarksStartPageMenuGoto=Ind\u00EDt\u00E1si n\u00E9zet megnyit\u00E1sa
+BookmarksStartPageMenuSet=Jelen n\u00E9zet be\u00E1ll\u00EDt\u00E1sa ind\u00EDt\u00E1si n\u00E9zetnek
+ButtonDeselectAll=Deselect all
+ButtonSelectAll=Mindent kiv\u00E1laszt
+Calendar_earlier=Kor\u00E1bban
+Calendar_later=K\u00E9sobb
+Cancel=M\u00E9gse
+CancelButton=&M\u00E9gse
+CancelButtonTooltip=P\u00E1rbesz\u00E9d bez\u00E1r\u00E1sa ment\u00E9s n\u00E9lk\u00FCl, megeros\u00EDto p\u00E1rbesz\u00E9ddel, ha sz\u00FCks\u00E9ges
+ChangePassword=Jelsz\u00F3 megv\u00E1ltoztat\u00E1sa
+CloseButton=&Bez\u00E1r
+CloseButtonTooltip=P\u00E1rbesz\u00E9d bez\u00E1r\u00E1sa ment\u00E9s n\u00E9lk\u00FCl
+Column=Oszlop
+Columns=Oszlopok
+ComposerFieldAggregationLabel=Function
+Condensed=6 oszlop
+Copy=M\u00E1sol
+Cut=Kiv\u00E1g\u00E1s
+Day=Nap
+DefaultPasswordPolicyText=The password does not comply with the given policy\n\nPolicy\:\n- at least 8 characters\n- at least one number (0-9)\n- at least one non standard character (\!|@|\#|$|%|^|&|*|(|)|_|+|||~|-|
+EmailSubject=T\u00E1rgy
+Error=Hiba
+ErrorAndRetryTextDefault=Hiba mer\u00FClt fel az adattov\u00E1bb\u00EDt\u00E1s sor\u00E1n
+ErrorTextLogin=\u00C9rv\u00E9nytelen felhaszn\u00E1l\u00F3n\u00E9v vagy jelsz\u00F3
+ErrorTitleLogin=Bel\u00E9p\u00E9s meghi\u00FAsult
+ExcelChart_Button_LoadDefaults=Defaults
+ExcelChart_Button_LoadDefaultsHint=Resets this dialog by loading the default values.
+ExcelChart_Button_LoadProfile=Load profile...
+ExcelChart_Button_LoadProfileHint=Loads settings from an XML file.
+ExcelChart_Button_SaveProfile=Save profile...
+ExcelChart_Button_SaveProfileHint=Aktu\u00E1lis be\u00E1l\u00EDt\u00E1sok elment\u00E9se XML-be
+ExcelChart_Error_CreatingChartFailed=creating chart failed.
+ExcelChart_Error_ExportingFailed=Export failed because
+ExcelChart_Error_InitializationFailed=A t\u00E1mogat\u00F3 oszt\u00E1ly(ok) inicializ\u00E1l\u00E1sa nem siker\u00FClt
+ExcelChart_Error_LoadingProfileFailed=Loading profile failed because
+ExcelChart_Error_LoadingTemplateFailed=loading template failed.
+ExcelChart_Error_RetrivingOutlineDataFailed=retriving outline data failed.
+ExcelChart_Error_SavingProfileFailed=Saving profile failed because
+ExcelChart_Error_WrongProfile=the profile was created for another outline.
+ExcelChart_Label_AutomaticMode=Automatic mode
+ExcelChart_Label_AutomaticModeHint=Hide Excel and save automatically.
+ExcelChart_Label_ChartNumber=Chart number
+ExcelChart_Label_ChartType=Chart type
+ExcelChart_Label_FileName=Filename
+ExcelChart_Label_FirstRow=First row
+ExcelChart_Label_Height=Height
+ExcelChart_Label_HistogramMode=Histogram mode
+ExcelChart_Label_HistogramModeHint=The histogram mode combines identical values on the X-Axis to one.
+ExcelChart_Label_LastRow=Last row
+ExcelChart_Label_Offset=Position
+ExcelChart_Label_SkipNullValues=Skip null values in histogram mode
+ExcelChart_Label_SkipNullValuesHint=If checked null values on the X-Axis are ignored, otherwise they are combined to <Unknown>.
+ExcelChart_Label_TemplateName=Template
+ExcelChart_Label_UseCustomFormat=Egy\u00E9ni fomr\u00E1tum haszn\u00E1lata
+ExcelChart_Label_UseCustomFormatHint=Ha be van jel\u00F6lve, megadhat\u00F3 a diagram poz\u00EDci\u00F3ja \u00E9s m\u00E9rete.
+ExcelChart_Label_UseExistingChart=Use existing chart
+ExcelChart_Label_UseExistingChartHint=If checked the existing chart in the indicated template is used.
+ExcelChart_Label_UseSelectiveExport=Use selective export
+ExcelChart_Label_UseSelectiveExportHint=If checked only the rows indicated below are exported.
+ExcelChart_Label_Width=Width
+ExcelChart_Label_WorksheetName=Worksheet
+ExcelChart_Label_XAxis=X-Axis
+ExcelChart_Label_YAxes=Y-tengely
+ExcelChart_Status_Done=Excel Chart Export is done.
+ExcelChart_Tab_Advanced=Advanced
+ExcelChart_Tab_Basic=Basic
+ExcelChart_Title_MainForm=Excel Chart Export
+ExcelChart_Type_Area3D=Area 3D
+ExcelChart_Type_Area=Area
+ExcelChart_Type_AreaStacked3D=Area Stacked 3D
+ExcelChart_Type_AreaStacked=Area Stacked
+ExcelChart_Type_BarsClustered3D=Bars Clustered 3D
+ExcelChart_Type_BarsClustered=Bars Clustered
+ExcelChart_Type_BarsStacked3D=Bars Stacked 3D
+ExcelChart_Type_BarsStacked=Bars Stacked
+ExcelChart_Type_ColumnsClustered3D=Columns Clustered 3D
+ExcelChart_Type_ColumnsClustered=Columns Clustered
+ExcelChart_Type_ColumnsStacked3D=Columns Stacked 3D
+ExcelChart_Type_ColumnsStacked=Columns Stacked
+ExcelChart_Type_Line=Line
+ExcelChart_Type_LineStacked=Line Stacked
+ExcelChart_Type_Pie3D=Pie 3D
+ExcelChart_Type_Pie=Pie
+ExcelChart_Type_PieExploded3D=Pie Exploded 3D
+ExcelChart_Type_PieExploded=Pie exploded
+ExcelChart_Various_Averaged=averaged
+ExcelChart_Various_Column=Column
+ExcelChart_Various_Frequency=Frequency
+ExcelChart_Various_SummedUp=summed up
+ExcelChart_Various_Unknown=<Unknown>
+ExportDate=Export d\u00E1tuma
+ExtendedSearchAddAttributeMenu=Sz\u0171k\u00EDt\u00E9s hozz\u00E1ad\u00E1sa
+ExtendedSearchAddEntityPrefix=van
+ExtendedSearchAnd=and
+ExtendedSearchEditAttributeMenu=Szerkeszt...
+ExtendedSearchEntitySuffix=val
+ExtendedSearchNegateMenu=k\u00F6z\u00F6mb\u00F6s\u00EDt
+ExtendedSearchRemoveAttributeMenu=T\u00F6r\u00F6l...
+ExtendedSearchRemoveMenu=T\u00F6r\u00F6l...
+FileExistsOwerwriteQuestion=A kiv\u00E1lasztott f\u00E1jl m\u00E1r l\u00E9tezik. Fel\u00FCl\u00EDrja ezt a f\u00E1ljt?
+FileName=F\u00E1jln\u00E9v
+FileNotFoundMessage=F\u00E1jl nem tal\u00E1lhat\u00F3
+FileNotFoundTitle=F\u00E1jl nem tal\u00E1lhat\u00F3
+FilesOfType=F\u00E1jlt\u00EDpus
+FormPrint=Nyomtat
+FormSaveChangesQuestion=El akarja menteni a v\u00E1ltoz\u00E1sokat?
+FormStateLoad=T\u00F6lt\u00E9s...
+FormStateStore=Ment\u00E9s
+FormStateStoreAs=Ment\u00E9s m\u00E1sk\u00E9nt
+GlobalBookmarks=Global Bookmarks
+GlobalBookmarksAddMenu=Add to &global bookmarks
+Help=S\u00FAg\u00F3
+IOErrorInfo=Ellenorizze a f\u00E1jlokat \u00E9s a csatlakoz\u00E1st
+IOErrorText=Kommunik\u00E1ci\u00F3s hiba
+IOErrorTitle=Olvas\u00E1s/\u00EDr\u00E1s hiba
+Info=Inform\u00E1ci\u00F3
+Interrupted=Megszak\u00EDtva
+InterruptedErrorText=The Process has manually been cancelled.
+InterruptedErrorTitle=Process cancelled
+JavaVMVersion=Java VM
+Language=Nyelv
+LoadFormXmlFailedText=Ez a f\u00E1jl nem kompatibilis ezzel a p\u00E1rbesz\u00E9ddel
+LogicDateIsInDays=is in exactly (days)
+LogicDateIsInGEDays=is earliest in (days)
+LogicDateIsInGEMonths=is earliest in (months)
+LogicDateIsInLEDays=is latest in (days)
+LogicDateIsInLEMonths=is latest in (months)
+LogicDateIsInMonths=Pontosan n h\u00F3nap m\u00FAlva
+LogicDateIsNotToday=nem ma
+LogicDateIsToday=is today
+LogicDateTimeIsInGEHours=is earliest in (hours)
+LogicDateTimeIsInGEMinutes=is earliest in (minutes)
+LogicDateTimeIsInLEHours=is latest in (hours)
+LogicDateTimeIsInLEMinutes=is latest in (minutes)
+LogicDateTimeIsNotNow=is not now
+LogicDateTimeIsNow=is now
+LogicEQ=\=
+LogicEndsWith=V\u00E9gzodik
+LogicGE=>\=
+LogicGT=>
+LogicIn=Van
+LogicLE=<\=
+LogicLT=<
+LogicLike=Tartalmaz
+LogicNEQ=<>
+LogicNotIn=nem
+LogicNotLike=nem tartalmaz
+LogicNotNull=nem \u00FCres
+LogicNull=\u00FCres
+LogicStartsWith=Vel kezdodik
+LogicTimeIsInGEHours=is earliest in (hours)
+LogicTimeIsInGEMinutes=is earliest in (minutes)
+LogicTimeIsInHours=pontosan (hours) \u00F3ra m\u00FAlva
+LogicTimeIsInLEHours=is latest in (hours)
+LogicTimeIsInLEMinutes=is latest in (minutes)
+LogicTimeIsInMinutes=is in exactly (minutes)
+LogicTimeIsNotNow=is not now
+LogicTimeIsNow=is now
+Login=Bel\u00E9p\u00E9s
+LookIn=Ben\u00E9z
+Month=H\u00F3nap
+Name=N\u00E9v
+NetErrorInfo=Ellenorizze a szerver nevet, URL-t \u00E9s a kapcsolatot.
+NetErrorText=Szerver nem tal\u00E1lhat\u00F3
+NetErrorTitle=H\u00E1l\u00F3zati hiba
+NewPassword=\u00DAj jelsz\u00F3
+No=Nem
+NoButton=Nem
+NumberOfRows=Sorsz\u00E1ml\u00E1l\u00E1s
+OSUser=Rendszerfelhaszn\u00E1l\u00F3
+OSVersion=Rendszerverzi\u00F3
+Ok=Ok
+OkButton=Ok
+OkButtonTooltip=P\u00E1rbesz\u00E9d ment\u00E9se \u00E9s bez\u00E1r\u00E1sa
+OldPassword=R\u00E9gi jelsz\u00F3
+Op=Oper\u00E1tor
+Open=Megnyit
+Password=Jelsz\u00F3
+PasswordsDoNotMatch=A k\u00E9t jelsz\u00F3 nem egyezik.
+Paste=Beilleszt
+Path=\u00DAt
+RepeatPassword=\u00DAjra
+ResetButton=\u00DAjraind\u00EDt
+ResetButtonTooltip=\u00D6sszes p\u00E1rbesz\u00E9d mez\u0151 be\u00E1ll\u00EDt\u00E1sa \u00FCres \u00E9rt\u00E9kre
+SC_Label_AddToDictionary=Hozz\u00E1ad\u00E1s a sz\u00F3t\u00E1rhoz
+SC_Label_Ignore=Figyelmen k\u00EDv\u00FCl hagy\u00E1s
+Save=Ment\u00E9s
+SaveButton=Ment\u00E9s
+SaveButtonTooltip=P\u00E1rbesz\u00E9d ment\u00E9se bez\u00E1r\u00E1s n\u00E9lk\u00FCl
+SearchButton=Keres\u00E9s
+SearchButtonTooltip=P\u00E1rbesz\u00E9d bez\u00E1r\u00E1sa \u00E9s keres\u00E9s ind\u00EDt\u00E1sa
+SearchConstraints=Keres\u00E9si felt\u00E9telek
+Server=Szerver
+SmartFieldMoreThanXRows=T\u00F6bb mint {0} sor. {1} sor megjelen\u00EDtve.
+SmartFindLabel=Sz\u00F6veg keres\u00E9se
+StatusExportDone=Export\u00E1l\u00E1s befejezve
+Today=today
+TooManyRows=Nagy adatk\u00E9szlet. K\u00E9rem szuk\u00EDtsen a Keres panel haszn\u00E1lat\u00E1val.
+Update=Friss\u00EDt\u00E9s
+UserInterrupted=Felhaszn\u00E1l\u00F3 \u00E1ltal megszak\u00EDtva
+Username=Felhaszn\u00E1l\u00F3n\u00E9v
+Value=\u00C9rt\u00E9k
+Week=H\u00E9t
+WeekShort=CW
+WizardCancelButton=M\u00E9gse
+WizardSuspendButton=&Bez\u00E1r
+WorkWeek=Munkah\u00E9t
+Yes=Igen
+YesButton=&Yes
+and=and
+from=from
+to=to
diff --git a/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_it.properties b/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_it.properties
index 42ba4ea054..fe2e0e3096 100644
--- a/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_it.properties
+++ b/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_it.properties
@@ -1,472 +1,472 @@
-ActivateBookmarkMenu=Aprire i preferiti
-ActiveAndInactiveStates=T&utti
-ActiveStates=&Attivi
-AddCustomColumnMenu=Aggiungi colonna\u2026
-All=Tutti
-AllStates=Tutti
-Apply=Applica
-ApplyBookmarkToSearchFailedMessage=Questo preferito non \u00E8 applicabite alla ricerca corrente.
-Attribute=Attributo
-Bookmark=Preferito
-BookmarkFolder=Cartella
-Bookmarks=Preferiti
-BookmarksAddMenu=&Aggiungi visualizzazione attuale a preferiti
-BookmarksApplyToCurrentSearch=Eseguire la ricerca con questo preferito
-BookmarksMainMenu=&Preferiti
-BookmarksManageMenu=&Gestione preferiti\u2026
-BookmarksPublishMenu=Attivare il preferito\u2026
-BookmarksStartPageMenu=&Visualizzazione di avvio
-BookmarksStartPageMenuClear=&Ripristina visualizzazione di avvio
-BookmarksStartPageMenuGoto=Apri visualizzazione di avvio
-BookmarksStartPageMenuSet=Imposta visualizzazione corrente come &visualizzazione di avvio
-ButtonDeselectAll=Non selezionare nessun elemento
-ButtonMoveDown=In basso
-ButtonMoveUp=In alto
-ButtonSelectAll=Selezionare tutti
-Calendar_earlier=Pi\u00F9 presto
-Calendar_later=Pi\u00F9 tardi
-Cancel=Annulla
-CancelButton=&Annulla
-CancelButtonTooltip=Chiude senza memorizzare; in caso di dubbio il sistema chiede nuovamente.
-ChangePassword=Cambiare la password
-CheckAll=Seleziona tutti
-ClearColumnSorting=Non ordinare
-Close=Chiudere
-CloseButton=&Chiudere
-CloseButtonTooltip=Chiudere senza memorizzare.
-CodeTypeInit=Inizializzazione tipo codice
-Column=Colonna
-ColumnFilterCheckedText=Selezionato
-ColumnFilterConstraints=Filtri colonne
-ColumnFilterDateSection=Data filtri
-ColumnFilterMenu=Filtri colonne...
-ColumnFilterNullText=Vuoto
-ColumnFilterNumberSection=Filtri numeri\u2026
-ColumnFilterRemoveButton=Rimuovi filtri
-ColumnFilterStringSection=Filtri testo
-ColumnFilterUncheckedText=Non selezionato
-ColumnFilterValuesSection=Filtri valore
-ColumnSortAscending=Ordinare in modo crescente
-ColumnSorting=Ordinare
-ColumnValues=Valori
-Columns=Colonne
-ComposerFieldAggregationAvg=Valore medio({0})
-ComposerFieldAggregationCount=Numero({0})
-ComposerFieldAggregationLabel=Funzione
-ComposerFieldAggregationMax=Massimo({0})
-ComposerFieldAggregationMedian=Media({0})
-ComposerFieldAggregationMin=Minimo({0})
-ComposerFieldAggregationSum=Somma({0})
-Condensed=6 colonne
-Configure=Configurazione
-Copy=Copia
-CopyWidthsOfColumnsMenu=Copia larghezza colonne
-Criteria=Criteri
-Cut=Taglia
-Day=Giorno
-DefaultPasswordPolicyText=La password non corrisponde alle regole prestabilite\:\n\nRegole\:\n- almeno 8 caratteri\n- almeno un numero (0-9)\n- almeno un carattere speciale (\!|@|\#|\\$|%|\\^|&|\\*|\\(|\\)|_|\\+|\\||~|-|\n- non pu\u00F2 corrispondere una password utilizzata in precedenza\n- non pu\u00F2 comprendere il nome utente\n
-DeleteBookmarkMenu=Cancellare preferito
-DeleteConfirmationText=Volete eliminare questi dati?
-DeleteConfirmationTextNoItemList=Volete eliminare questi dati?
-DeleteConfirmationTextNoItemListX=Volete eliminare questi {0} ?
-DeleteConfirmationTextX=Volete eliminare i seguenti {0} ?
-DeleteConfirmationTitle=Conferma eliminazione.
-DeleteFolderMenu=Elimina cartella
-DeleteMenu=Elimina
-Detail=Dettaglio
-DetailedVersion=Versione dettagliata
-Details=Dettagli
-EditBookmarkMenu=Elabora preferiti...
-EmailCc=CC
-EmailFrom=Da
-EmailSent=Inviato
-EmailSubject=Oggetto
-EmailTo=A
-Enabled=Attivato
-EndDate=Data finale
-Error=Errore
-ErrorAndRetryTextDefault=Si \u00E8 verificato un errore.
-ErrorTextLogin=Nome utente/password sbagliata
-ErrorTextSecurity=L'accesso \u00E8 stato negato.
-ErrorTitleLogin=Accesso fallito
-ErrorTitleSecurity=Errore di accesso
-ExcelChart_Button_LoadDefaults=Impostazioni standard
-ExcelChart_Button_LoadDefaultsHint=Caricare le impostazioni standard
-ExcelChart_Button_LoadProfile=Caricare il profilo...
-ExcelChart_Button_LoadProfileHint=Carica le impostazioni salvate da un file XML.
-ExcelChart_Button_SaveProfile=Salvare profilo...
-ExcelChart_Button_SaveProfileHint=Salva le impostazioni attuali in un file XML.
-ExcelChart_Error_CreatingChartFailed=la creazione del diagramma \u00E8 fallita.
-ExcelChart_Error_ExportingFailed=L\u2019esportazione non \u00E8 riuscita, poich\u00E9
-ExcelChart_Error_InitializationFailed=l\u2019inizializzazione della/e categoria/e di supporto non \u00E8 riuscita.
-ExcelChart_Error_LoadingProfileFailed=Il caricamento del profilo non \u00E8 riuscito, poich\u00E9
-ExcelChart_Error_LoadingTemplateFailed=non \u00E8 stato possibile caricare il modello.
-ExcelChart_Error_RetrivingOutlineDataFailed=non \u00E8 stato possibile leggere i dati outline.
-ExcelChart_Error_SavingProfileFailed=Il salvataggio del profilo non \u00E8 riuscito, poich\u00E9
-ExcelChart_Error_WrongProfile=questo profilo \u00E8 stato creato per un altro outline.
-ExcelChart_Label_AutomaticMode=Modalit\u00E0 automatica
-ExcelChart_Label_AutomaticModeHint=Nascondere Excel e salvare automaticamente.
-ExcelChart_Label_ChartNumber=N. diagramma
-ExcelChart_Label_ChartType=Tipo diagramma
-ExcelChart_Label_FileName=Nome file
-ExcelChart_Label_FirstRow=Prima riga
-ExcelChart_Label_Height=Altezza
-ExcelChart_Label_HistogramMode=Modalit\u00E0 istogrammi
-ExcelChart_Label_HistogramModeHint=Nella modalit\u00E0 istogrammi sono riuniti gli stessi valori dell\u2019asse X.
-ExcelChart_Label_LastRow=Ultima riga
-ExcelChart_Label_Offset=Posizione
-ExcelChart_Label_SkipNullValues=Ignorare i valori vuoti
-ExcelChart_Label_SkipNullValuesHint=Se attivati, nella modalit\u00E0 istogrammi i valori vuoti sull\u2019asse X vengono ignorati, altrimenti vengono riuniti in <Sconosciuto>.
-ExcelChart_Label_TemplateName=Modello
-ExcelChart_Label_UseCustomFormat=Utilizzare il proprio formato
-ExcelChart_Label_UseCustomFormatHint=Consente di definire la grandezza e la posizione del diagramma.
-ExcelChart_Label_UseExistingChart=Utilizzare il diagramma disponibile
-ExcelChart_Label_UseExistingChartHint=Utilizzare il diagramma gi\u00E0 presente nel modello indicato.
-ExcelChart_Label_UseSelectiveExport=Selezionare le righe
-ExcelChart_Label_UseSelectiveExportHint=Esporta soltanto le righe nell\u2019area sotto indicata.
-ExcelChart_Label_Width=Larghezza
-ExcelChart_Label_WorksheetName=Foglio tabella
-ExcelChart_Label_XAxis=Asse X
-ExcelChart_Label_YAxes=Assi Y
-ExcelChart_Status_Done=Esportazione del diagramma Excel terminata.
-ExcelChart_Tab_Advanced=Ampliato
-ExcelChart_Tab_Basic=Standard
-ExcelChart_Title_MainForm=Esportazione del diagramma Excel
-ExcelChart_Type_Area3D=Superficie 3D
-ExcelChart_Type_Area=Superficie
-ExcelChart_Type_AreaStacked3D=Superficie in pila 3D
-ExcelChart_Type_AreaStacked=Superficie in pila
-ExcelChart_Type_BarsClustered3D=Barre raggruppate 3D
-ExcelChart_Type_BarsClustered=Barre raggruppate
-ExcelChart_Type_BarsStacked3D=Barre in pila 3D
-ExcelChart_Type_BarsStacked=Barre in pila
-ExcelChart_Type_ColumnsClustered3D=Colonne raggruppate 3D
-ExcelChart_Type_ColumnsClustered=Colonne raggruppate
-ExcelChart_Type_ColumnsStacked3D=Colonne in pila 3D
-ExcelChart_Type_ColumnsStacked=Colonne in pila
-ExcelChart_Type_Line=Linea
-ExcelChart_Type_LineStacked=Linea in pila
-ExcelChart_Type_Pie3D=Anello 3D
-ExcelChart_Type_Pie=Anello
-ExcelChart_Type_PieExploded3D=Anello esploso 3D
-ExcelChart_Type_PieExploded=Anello esploso
-ExcelChart_Various_Averaged=mediana
-ExcelChart_Various_Column=Colonna
-ExcelChart_Various_Frequency=Frequenza
-ExcelChart_Various_SummedUp=sommato
-ExcelChart_Various_Unknown=<Sconosciuto>
-ExcelChart_WorksheetName_Chart=Diagramma
-ExcelChart_WorksheetName_Data=Dati del diagramma
-ExecutionTime=Elaborazione server
-ExportDate=Data esportazione
-ExtendedSearchAddAdditionalOrMenu=Aggiungere un altro oppure inserire
-ExtendedSearchAddAttribute=Condizione
-ExtendedSearchAddAttributeMenu=Aggiungi una condizione...
-ExtendedSearchAddEitherOrMenu=Inserire o \u2026 oppure
-ExtendedSearchAddEntityPrefix=ha
-ExtendedSearchAnd=e
-ExtendedSearchEditAttributeMenu=Elabora...
-ExtendedSearchEither=oppure
-ExtendedSearchEntitySuffix=con
-ExtendedSearchNegateMenu=Negazione
-ExtendedSearchNot=non
-ExtendedSearchOr=oppure
-ExtendedSearchRemoveAttributeMenu=Eliminare
-ExtendedSearchRemoveMenu=Eliminare
-FileExistsOwerwriteQuestion=Il file selezionato esiste gi\u00E0. Deve essere sovrascritto?
-FileName=Nome file
-FileNotFoundExceptionMessage=Il file non \u00E8 stato trovato oppure l'accesso \u00E8 stato rifiutato.
-FileNotFoundMessage=Il file seguente non \u00E8 stato trovato oppure l'accesso \u00E8 stato rifiutato\:\n{0}
-FileNotFoundTitle=File non trovato
-FilesOfType=Tipo di file
-FilterBookmarkTree=Sfoglia preferiti
-Folders=Cartella
-FormButtonClicked=Cliccando su un pulsante
-FormCloseTimerActivated=Attivazione del timer di chiusura modulo
-FormClosing=Chiudere
-FormEmptyMandatoryFieldsMessage=I seguenti campi devono essere compilati
-FormExportXml=Esportazione in XML
-FormFinally=Concludere
-FormFireActivated=In caso di attivazione del modulo
-FormFireClosed=In caso di chiusura del modulo
-FormFireDiscarded=In caso di rifiuto del modulo
-FormFireStructureChanged=In caso di modifica della struttura del modulo
-FormIncompleteIntro=\u00C8 necessario modificare alcuni valori.
-FormInvalidFieldsMessage=I seguenti campi non hanno un valore valido
-FormPrint=Stampare
-FormReset=Ripristinare
-FormSaveChangesQuestion=Volete salvare le modifiche?
-FormStateLoad=Apri...
-FormStateStore=Salva
-FormStateStoreAs=Salva con nome...
-FormTimerActivated=Timer attivato
-FormattingLocale=Formattazione
-GlobalBookmarks=Preferiti globali
-GlobalBookmarksAddMenu=Aggiungere a preferiti &globali
-Help=Aiuto
-Host=Host
-Hour=Ora
-IOErrorInfo=Verificare i file e la connessione al server.
-IOErrorText=Errore di comunicazione
-IOErrorTitle=Errore di lettura/scrittura
-InDaysX=entro {0} giorni
-InactiveState=Inattivo
-InactiveStates=Inattivi
-Info=Informazioni
-Information=Informazioni
-Interrupted=Interrotto
-InterruptedErrorText=L\u2019esecuzione \u00E8 stata interrotta manualmente.
-InterruptedErrorTitle=Esecuzione interrotta
-InvalidNumberMessageX="{0}" non \u00E8 un numero valido
-InvalidPhoneNumberMessageX="{0}" non \u00E8 un numero di telefono valido
-InvalidValueMessageX="{0}" non \u00E8 un valore valido
-JavaVMVersion=Java VM
-JavaVersion=Java Runtime
-KeyStroke=Combinazioni di tasti
-Language=Lingua
-Live=In tempo reale
-LoadFormXmlFailedText=Questo file non proviente da questo form.
-LogicBetween=\u00E8 tra {0} e {1}
-LogicBetweenShort=tra
-LogicDateIsInDays=ha luogo precisamente fra {0} giorni
-LogicDateIsInGEDays=ha luogo al pi\u00F9 presto fra {0} giorni
-LogicDateIsInGEMonths=ha luogo al pi\u00F9 presto fra {0} mesi
-LogicDateIsInLEDays=ha luogo al pi\u00F9 tardi fra {0} giorni
-LogicDateIsInLEMonths=ha luogo al pi\u00F9 tardi fra {0} mesi
-LogicDateIsInLastDays=ha avuto luogo negli ultimi {0} giorni
-LogicDateIsInLastMonths=ha avuto luogo negli ultimi {0} mesi
-LogicDateIsInMonths=ha luogo precisamente fra {0} mesi
-LogicDateIsInNextDays=ha luogo nei prossimi {0} giorni
-LogicDateIsInNextMonths=ha luogo nei prossimi {0} mesi
-LogicDateIsNotToday=non ha luogo oggi
-LogicDateIsToday=ha avuto luogo oggi
-LogicDateTimeIsInGEHours=ha luogo al pi\u00F9 presto tra {0} ore
-LogicDateTimeIsInGEMinutes=ha luogo al pi\u00F9 presto fra {0} minuti
-LogicDateTimeIsInLEHours=ha luogo al pi\u00F9 tardi fra {0} ore
-LogicDateTimeIsInLEMinutes=ha luogo al pi\u00F9 tardi fra {0} minuti
-LogicDateTimeIsNotNow=non ha luogo adesso
-LogicDateTimeIsNow=ha luogo adesso
-LogicEQ=\=
-LogicEndsWith=finisce con
-LogicGE=>\=
-LogicGT=>
-LogicIn=\u00E8
-LogicLE=<\=
-LogicLT=<
-LogicLike=contiene
-LogicNEQ=<>
-LogicNotEndsWith=non finisce con
-LogicNotIn=non \u00E8
-LogicNotLike=non contiene
-LogicNotNull=non \u00E8 vuoto
-LogicNotStartsWith=non comincia con
-LogicNull=\u00E8 vuoto
-LogicStartsWith=comincia con
-LogicTimeIsInGEHours=ha luogo al pi\u00F9 presto fra {0} ore
-LogicTimeIsInGEMinutes=ha luogo al pi\u00F9 presto fra {0} minuti
-LogicTimeIsInHours=ha luogo precisamente fra {0} ore
-LogicTimeIsInLEHours=ha luogo al pi\u00F9 tardi fra {0} ore
-LogicTimeIsInLEMinutes=ha luogo al pi\u00F9 tardi fra {0} minuti
-LogicTimeIsInMinutes=ha luogo precisamente fra {0} minuti
-LogicTimeIsNotNow=non ha luogo adesso
-LogicTimeIsNow=ha luogo adesso
-Login=Accesso
-LookAndFeel=Look and feel
-LookIn=Cerca in
-MemoryStatus=Memoria
-Minute=Minuto
-ModifyCustomColumnMenu=Modifica colonna\u2026
-Month=Mese
-Name=Cognome
-NetErrorInfo=Verificare il nome e l'indirizzo del server e la connessione al server.
-NetErrorText=Server non trovato
-NetErrorTitle=Errore rete
-NetworkLatency=Ritardo rete
-NewBookmarkFolderMenu=Nuova cartella\u2026
-NewPassword=Nuova password
-No=No
-NoButton=&No
-None=Niente
-NumberOfRows=Numero record di dati
-NumberTooLargeMessageXY=Il valore \u00E8 troppo elevato; deve essere tra {0} e {1}.
-NumberTooSmallMessageXY=Il valore \u00E8 troppo basso; deve essere tra {0} e {1}.
-OSUser=Utente del sistema
-OSVersion=Versione del sistema
-OcrEditorMoveTool=Sposta immagine
-OcrEditorNextPage=Pagina seguente
-OcrEditorOCRTool=Riconoscimento testo
-OcrEditorOfX=di
-OcrEditorPage=Pagina
-OcrEditorPreviousPage=Pagina precedente
-OcrEditorRotateLeft=Ruotare a sinistra
-OcrEditorRotateRight=Ruotare a destra
-OcrEditorZoomIn=Ingrandire
-OcrEditorZoomOut=Rimpicciolire
-OcrEditorZoomToFit=Modificare
-Ok=Ok
-OkButton=&Ok
-OkButtonTooltip=Salva e chiudi
-OldPassword=Vecchia password
-OneRow=1 oggetto
-OneSelected=1 selezionato
-Op=Operatore
-Open=Apri
-OrganizeTableColumnsMenu=Organizzare le colonne...
-OrganizeTableColumnsTitle=Organizzare le colonne
-OriginalErrorMessageIs=La notifica di errore originaria \u00E8\:\r\n{0}
-OutlineSelectorAddOrRemoveButtons=Aggiungere o eliminare &pulsanti
-OutlineSelectorShowFewerButtons=&Meno pulsanti
-OutlineSelectorShowMoreButtons=&Pi\u00F9 pulsanti
-Password=Password
-PasswordHasExpiredHeader=La password \u00E8 scaduta, dovreste cambiarla ora.
-PasswordHasExpiredTitle=Password scaduta
-PasswordMin8Chars=Almeno 8 caratteri
-PasswordMinOnNonStdChar=Almeno un carattere speciale
-PasswordMinOneChar=Almeno una lettera a-z/A-Z
-PasswordMinOneDigit=Almeno un numero da 0 a 9
-PasswordNotSameAsLasts=La password non pu\u00F2 essere uguale alle ultime password utilizzate.
-PasswordUsernameNotPartOfPass=Il nome utente non pu\u00F2 essere compreso nella password.
-PasswordWillExpireHeaderX=La password scadr\u00E0 tra {0}.
-PasswordWillExpireInfo=Volete cambiarla ora?
-PasswordWillExpireTitle=La password sta per scadere
-PasswordsDoNotMatch=Le due password non corrispondono.
-Paste=Incolla
-PasteTextTooLongForFieldX=Il testo inserito \u00E8 troppo lungo ed \u00E8 stato accorciato. Il numero massimo di caratteri \u00E8 {0}.
-Path=Percorso
-Pending=Attendere\u0085\u2026
-Properties=Propriet\u00E0
-Redo=Ripeti
-RemoveAllCustomColumnsMenu=Cancella colonne proprie
-RemoveCustomColumnMenu=Cancella colonna
-RenameBookmarkFolderMenu=Rinomina cartelle\u2026
-RepBuildExtract=Preparazione dati..
-RepExecAfter=Pulizia database
-RepExecBefore=Preparazione database
-RepUpdate=Elaborazione dati\u0085
-RepeatPassword=Ripeti
-RequestProblem=Errore di elaborazione
-ResetButton=&Riprisitna
-ResetButtonTooltip=Ripristina tutti i criteri di ricerca
-ResetTableColumnFilter=Filtro
-ResetTableColumns=Azzera le colonne
-ResetTableColumnsAll=Tutto
-ResetTableColumnsOrder=Sequenza
-ResetTableColumnsSorting=Ordinamento
-ResetTableColumnsView=Vista
-ResetTableColumnsWidth=Larghezza
-SC_Copyright=Il controllo ortografico Sentry e i dizionari sono marchi protetti di Wintertree Software, Inc.
-SC_DialogTitle=Controllo ortografico
-SC_DialogTitle_Options=Controllo ortografico\: opzioni
-SC_Help_AddToDictionary=Aggiunge la parola al dizionario utente
-SC_Help_Cancel=Chiude il dialogo e rifiuta tutte le modifiche (tasto di scelta rapida\: ESC)
-SC_Help_Change=Modifica l\u2019attuale occorrenza della parola
-SC_Help_ChangeAll=Modifica tutte le occorrenze della parola (nell\u2019attuale campo del testo)
-SC_Help_Enable=Attiva o disattiva il controllo ortografico Scout
-SC_Help_Ignore=Ignora l\u2019attuale occorrenza della parola
-SC_Help_IgnoreAll=Ignora questa e tutte le altre occorrenze della parola
-SC_Help_IgnoreCase=Ignorare maiuscole/minuscole
-SC_Help_IgnoreDomainNames=Ignora per esempio 'www.bsiag.com'
-SC_Help_IgnoreWordsWithNumbers=Ignora le parole con numeri
-SC_Help_Language=La lingua scelta
-SC_Help_Options=Apre il dialogo opzioni
-SC_Help_RemoveWord=Rimuove la parola evidenziata dal dizionario utente
-SC_Help_ReplacementWord=La parola, con la quale deve essere sostituita la parola evidenziata (premere ENTER per sostituire con questa parola quella non riconosciuta).
-SC_Help_Shortcut=La scelta del tasto di scelta rapida per il dialogo ortografico. Fisso, non pu\u00F2 essere modificato.
-SC_Help_SuggestionList=Proposte sostitutive per la parola evidenziata (cliccare due volte per sostituire la parola non riconosciuta con quella selezionata).
-SC_Help_Undo=Annulla l\u2019ultima modifica
-SC_Help_UseDefaults=Ripristinare tutte le impostazioni sui valori standard
-SC_Help_UserDictionary=Scegliere un dizionario \u201Ctlx\u201D (Scout) oppure \u201Cdic\u201D (Microsoft Word) come dizionario utente.
-SC_Label_AddToDictionary=Aggiungere
-SC_Label_Cancel=Interrompere
-SC_Label_Capitalization=Maiuscole/minuscole
-SC_Label_Change=Modificare
-SC_Label_ChangeAll=Variare tutti
-SC_Label_ChangeTo=Modificare secondo
-SC_Label_ConsiderChanging=Considerare la variazione
-SC_Label_ContainsDigits=Contiene cifre
-SC_Label_DoubledWord=Due occorrenze della parola
-SC_Label_Enable=Attivare controllo ortografico
-SC_Label_Ignore=Ignorare
-SC_Label_IgnoreAll=Ignorare tutti
-SC_Label_IgnoreCase=Ignorare maiuscole/minuscole
-SC_Label_IgnoreDomainNames=Ignorare il dominio nome
-SC_Label_IgnoreWordsWithNumbers=Ignorare le parole con numeri
-SC_Label_IgnoredWord=Parole definite dall'utente
-SC_Label_Main=Ortografia
-SC_Label_MixedCase=Maiuscolo/minuscolo misto
-SC_Label_NoSuggestions=(Nessuna proposta)
-SC_Label_NotInDictionary=La parola selezionata non \u00E8 stata riconosciuta
-SC_Label_Options=Opzioni\u2026
-SC_Label_RemoveWord=Rimuovere la parola
-SC_Label_Shortcut=Tasto di scelta rapida
-SC_Label_Spelling=Ortografia
-SC_Label_Undo=Annullare
-SC_Label_UseDefaults=Standard
-SC_Label_UserDictionary=Dizionario utente
-SC_Language=Lingua
-SC_Message_CheckRest=Volete controllare il resto del testo?
-SC_Message_Complete=Il controllo ortografico \u00E8 completo
-SC_Message_CompleteForSelection=Il controllo ortografico \u00E8 completo per l\u2019attuale selezione
-SC_Message_NotAvailable=Il controllo ortografico Scout non \u00E8 disponibile
-Save=Salva
-SaveButton=&Salva
-SaveButtonTooltip=Salva senza chiudere
-SavePassword=Salva nome utente/password
-ScoutStarting=Avvio Scout
-Search=Ricerca
-SearchButton=&Cerca
-SearchButtonTooltip=Avvia la ricerca
-SearchConstraints=Condizione di ricerca
-SearchTextIsTooGeneral=Specificare i criteri di ricerca
-SelectedStates=Soltanto selezionati
-Server=Server
-SmartFieldCannotComplete=Nessuna proposta per "{0}"
-SmartFieldMoreThanXRows=Pi\u00F9 di {0} record.
-SmartFindLabel=Testo di ricerca
-SortDescending=ordinare in ordine decrescente
-Source=Codice sorgente
-StatusExportDone=Esportazione completata
-StringPattern=Stampa
-Style=Modalit\u00E0
-Subject=Oggetto
-TableName=Tabella
-Timestamp=Data e ora
-Title=Titolo
-Today=oggi
-Tomorrow=domani
-TooManyRows=Quantit\u00E0 di dati troppo vasta. Limitare la ricerca.
-UncheckAll=Deseleziona tutti
-Undo=Annulla
-Update=Aggiorna
-UserCancelledOperation=L\u2019operazione \u00E8 stata interrotta manualmente
-UserInterrupted=Annullato dall'utente
-Username=Nome utente
-Value=Valore
-VersionMismatchAction=Volete riavviare l\u2019applicazione ora ed eseguire automaticamente l\u2019aggiornamento?
-VersionMismatchTextXY=L\u2019aggiornamento dell\u2019applicazione \u00E8 necessario per continuare a lavorare.\n\nL\u2019attuale versione \u00E8 {0}, la nuova \u00E8 {1}.
-VersionMismatchTitle=Aggiornamento necessario
-VetoErrorText=Almeno un campo di ricerca deve essere compilato.
-Week=Settimana
-WeekShort=SC
-WizardBackButton=&Indietro
-WizardBackButtonTooltip=Ritornare alla fase precedente
-WizardCancelButton=Annullare
-WizardCancelButtonTooltip=Annulla il wizard e rifiuta tutti i dati.
-WizardFinishButton=&Concludere
-WizardFinishButtonTooltip=Completare questo processo e ritornare alla selezione dei processi.
-WizardNextButton=&Avanti
-WizardNextButtonTooltip=Avanti alla prossima fase
-WizardSuspendButton=&Interrompere
-WizardSuspendButtonTooltip=Interrompe il processo e chiude il wizard (si pu\u00F2 proseguire pi\u00F9 tardi).
-WorkWeek=Settimana lavorativa
-XMustBeGreaterThanOrEqualY='{0}' deve essere maggiore oppure uguale a '{1}'
-XMustBeLessThanOrEqualY='{0}' deve essere minore oppure uguale a '{1}'
-XRows={0} oggetti
-XSelected={0} selezionato
-Yes=S\u00EC
-YesButton=&S\u00EC
-and=e
-between=Fra
-from=Da
-searchingProposals=Ricerca proposte...
-to=a
+ActivateBookmarkMenu=Aprire i preferiti
+ActiveAndInactiveStates=T&utti
+ActiveStates=&Attivi
+AddCustomColumnMenu=Aggiungi colonna\u2026
+All=Tutti
+AllStates=Tutti
+Apply=Applica
+ApplyBookmarkToSearchFailedMessage=Questo preferito non \u00E8 applicabite alla ricerca corrente.
+Attribute=Attributo
+Bookmark=Preferito
+BookmarkFolder=Cartella
+Bookmarks=Preferiti
+BookmarksAddMenu=&Aggiungi visualizzazione attuale a preferiti
+BookmarksApplyToCurrentSearch=Eseguire la ricerca con questo preferito
+BookmarksMainMenu=&Preferiti
+BookmarksManageMenu=&Gestione preferiti\u2026
+BookmarksPublishMenu=Attivare il preferito\u2026
+BookmarksStartPageMenu=&Visualizzazione di avvio
+BookmarksStartPageMenuClear=&Ripristina visualizzazione di avvio
+BookmarksStartPageMenuGoto=Apri visualizzazione di avvio
+BookmarksStartPageMenuSet=Imposta visualizzazione corrente come &visualizzazione di avvio
+ButtonDeselectAll=Non selezionare nessun elemento
+ButtonMoveDown=In basso
+ButtonMoveUp=In alto
+ButtonSelectAll=Selezionare tutti
+Calendar_earlier=Pi\u00F9 presto
+Calendar_later=Pi\u00F9 tardi
+Cancel=Annulla
+CancelButton=&Annulla
+CancelButtonTooltip=Chiude senza memorizzare; in caso di dubbio il sistema chiede nuovamente.
+ChangePassword=Cambiare la password
+CheckAll=Seleziona tutti
+ClearColumnSorting=Non ordinare
+Close=Chiudere
+CloseButton=&Chiudere
+CloseButtonTooltip=Chiudere senza memorizzare.
+CodeTypeInit=Inizializzazione tipo codice
+Column=Colonna
+ColumnFilterCheckedText=Selezionato
+ColumnFilterConstraints=Filtri colonne
+ColumnFilterDateSection=Data filtri
+ColumnFilterMenu=Filtri colonne...
+ColumnFilterNullText=Vuoto
+ColumnFilterNumberSection=Filtri numeri\u2026
+ColumnFilterRemoveButton=Rimuovi filtri
+ColumnFilterStringSection=Filtri testo
+ColumnFilterUncheckedText=Non selezionato
+ColumnFilterValuesSection=Filtri valore
+ColumnSortAscending=Ordinare in modo crescente
+ColumnSorting=Ordinare
+ColumnValues=Valori
+Columns=Colonne
+ComposerFieldAggregationAvg=Valore medio({0})
+ComposerFieldAggregationCount=Numero({0})
+ComposerFieldAggregationLabel=Funzione
+ComposerFieldAggregationMax=Massimo({0})
+ComposerFieldAggregationMedian=Media({0})
+ComposerFieldAggregationMin=Minimo({0})
+ComposerFieldAggregationSum=Somma({0})
+Condensed=6 colonne
+Configure=Configurazione
+Copy=Copia
+CopyWidthsOfColumnsMenu=Copia larghezza colonne
+Criteria=Criteri
+Cut=Taglia
+Day=Giorno
+DefaultPasswordPolicyText=La password non corrisponde alle regole prestabilite\:\n\nRegole\:\n- almeno 8 caratteri\n- almeno un numero (0-9)\n- almeno un carattere speciale (\!|@|\#|\\$|%|\\^|&|\\*|\\(|\\)|_|\\+|\\||~|-|\n- non pu\u00F2 corrispondere una password utilizzata in precedenza\n- non pu\u00F2 comprendere il nome utente\n
+DeleteBookmarkMenu=Cancellare preferito
+DeleteConfirmationText=Volete eliminare questi dati?
+DeleteConfirmationTextNoItemList=Volete eliminare questi dati?
+DeleteConfirmationTextNoItemListX=Volete eliminare questi {0} ?
+DeleteConfirmationTextX=Volete eliminare i seguenti {0} ?
+DeleteConfirmationTitle=Conferma eliminazione.
+DeleteFolderMenu=Elimina cartella
+DeleteMenu=Elimina
+Detail=Dettaglio
+DetailedVersion=Versione dettagliata
+Details=Dettagli
+EditBookmarkMenu=Elabora preferiti...
+EmailCc=CC
+EmailFrom=Da
+EmailSent=Inviato
+EmailSubject=Oggetto
+EmailTo=A
+Enabled=Attivato
+EndDate=Data finale
+Error=Errore
+ErrorAndRetryTextDefault=Si \u00E8 verificato un errore.
+ErrorTextLogin=Nome utente/password sbagliata
+ErrorTextSecurity=L'accesso \u00E8 stato negato.
+ErrorTitleLogin=Accesso fallito
+ErrorTitleSecurity=Errore di accesso
+ExcelChart_Button_LoadDefaults=Impostazioni standard
+ExcelChart_Button_LoadDefaultsHint=Caricare le impostazioni standard
+ExcelChart_Button_LoadProfile=Caricare il profilo...
+ExcelChart_Button_LoadProfileHint=Carica le impostazioni salvate da un file XML.
+ExcelChart_Button_SaveProfile=Salvare profilo...
+ExcelChart_Button_SaveProfileHint=Salva le impostazioni attuali in un file XML.
+ExcelChart_Error_CreatingChartFailed=la creazione del diagramma \u00E8 fallita.
+ExcelChart_Error_ExportingFailed=L\u2019esportazione non \u00E8 riuscita, poich\u00E9
+ExcelChart_Error_InitializationFailed=l\u2019inizializzazione della/e categoria/e di supporto non \u00E8 riuscita.
+ExcelChart_Error_LoadingProfileFailed=Il caricamento del profilo non \u00E8 riuscito, poich\u00E9
+ExcelChart_Error_LoadingTemplateFailed=non \u00E8 stato possibile caricare il modello.
+ExcelChart_Error_RetrivingOutlineDataFailed=non \u00E8 stato possibile leggere i dati outline.
+ExcelChart_Error_SavingProfileFailed=Il salvataggio del profilo non \u00E8 riuscito, poich\u00E9
+ExcelChart_Error_WrongProfile=questo profilo \u00E8 stato creato per un altro outline.
+ExcelChart_Label_AutomaticMode=Modalit\u00E0 automatica
+ExcelChart_Label_AutomaticModeHint=Nascondere Excel e salvare automaticamente.
+ExcelChart_Label_ChartNumber=N. diagramma
+ExcelChart_Label_ChartType=Tipo diagramma
+ExcelChart_Label_FileName=Nome file
+ExcelChart_Label_FirstRow=Prima riga
+ExcelChart_Label_Height=Altezza
+ExcelChart_Label_HistogramMode=Modalit\u00E0 istogrammi
+ExcelChart_Label_HistogramModeHint=Nella modalit\u00E0 istogrammi sono riuniti gli stessi valori dell\u2019asse X.
+ExcelChart_Label_LastRow=Ultima riga
+ExcelChart_Label_Offset=Posizione
+ExcelChart_Label_SkipNullValues=Ignorare i valori vuoti
+ExcelChart_Label_SkipNullValuesHint=Se attivati, nella modalit\u00E0 istogrammi i valori vuoti sull\u2019asse X vengono ignorati, altrimenti vengono riuniti in <Sconosciuto>.
+ExcelChart_Label_TemplateName=Modello
+ExcelChart_Label_UseCustomFormat=Utilizzare il proprio formato
+ExcelChart_Label_UseCustomFormatHint=Consente di definire la grandezza e la posizione del diagramma.
+ExcelChart_Label_UseExistingChart=Utilizzare il diagramma disponibile
+ExcelChart_Label_UseExistingChartHint=Utilizzare il diagramma gi\u00E0 presente nel modello indicato.
+ExcelChart_Label_UseSelectiveExport=Selezionare le righe
+ExcelChart_Label_UseSelectiveExportHint=Esporta soltanto le righe nell\u2019area sotto indicata.
+ExcelChart_Label_Width=Larghezza
+ExcelChart_Label_WorksheetName=Foglio tabella
+ExcelChart_Label_XAxis=Asse X
+ExcelChart_Label_YAxes=Assi Y
+ExcelChart_Status_Done=Esportazione del diagramma Excel terminata.
+ExcelChart_Tab_Advanced=Ampliato
+ExcelChart_Tab_Basic=Standard
+ExcelChart_Title_MainForm=Esportazione del diagramma Excel
+ExcelChart_Type_Area3D=Superficie 3D
+ExcelChart_Type_Area=Superficie
+ExcelChart_Type_AreaStacked3D=Superficie in pila 3D
+ExcelChart_Type_AreaStacked=Superficie in pila
+ExcelChart_Type_BarsClustered3D=Barre raggruppate 3D
+ExcelChart_Type_BarsClustered=Barre raggruppate
+ExcelChart_Type_BarsStacked3D=Barre in pila 3D
+ExcelChart_Type_BarsStacked=Barre in pila
+ExcelChart_Type_ColumnsClustered3D=Colonne raggruppate 3D
+ExcelChart_Type_ColumnsClustered=Colonne raggruppate
+ExcelChart_Type_ColumnsStacked3D=Colonne in pila 3D
+ExcelChart_Type_ColumnsStacked=Colonne in pila
+ExcelChart_Type_Line=Linea
+ExcelChart_Type_LineStacked=Linea in pila
+ExcelChart_Type_Pie3D=Anello 3D
+ExcelChart_Type_Pie=Anello
+ExcelChart_Type_PieExploded3D=Anello esploso 3D
+ExcelChart_Type_PieExploded=Anello esploso
+ExcelChart_Various_Averaged=mediana
+ExcelChart_Various_Column=Colonna
+ExcelChart_Various_Frequency=Frequenza
+ExcelChart_Various_SummedUp=sommato
+ExcelChart_Various_Unknown=<Sconosciuto>
+ExcelChart_WorksheetName_Chart=Diagramma
+ExcelChart_WorksheetName_Data=Dati del diagramma
+ExecutionTime=Elaborazione server
+ExportDate=Data esportazione
+ExtendedSearchAddAdditionalOrMenu=Aggiungere un altro oppure inserire
+ExtendedSearchAddAttribute=Condizione
+ExtendedSearchAddAttributeMenu=Aggiungi una condizione...
+ExtendedSearchAddEitherOrMenu=Inserire o \u2026 oppure
+ExtendedSearchAddEntityPrefix=ha
+ExtendedSearchAnd=e
+ExtendedSearchEditAttributeMenu=Elabora...
+ExtendedSearchEither=oppure
+ExtendedSearchEntitySuffix=con
+ExtendedSearchNegateMenu=Negazione
+ExtendedSearchNot=non
+ExtendedSearchOr=oppure
+ExtendedSearchRemoveAttributeMenu=Eliminare
+ExtendedSearchRemoveMenu=Eliminare
+FileExistsOwerwriteQuestion=Il file selezionato esiste gi\u00E0. Deve essere sovrascritto?
+FileName=Nome file
+FileNotFoundExceptionMessage=Il file non \u00E8 stato trovato oppure l'accesso \u00E8 stato rifiutato.
+FileNotFoundMessage=Il file seguente non \u00E8 stato trovato oppure l'accesso \u00E8 stato rifiutato\:\n{0}
+FileNotFoundTitle=File non trovato
+FilesOfType=Tipo di file
+FilterBookmarkTree=Sfoglia preferiti
+Folders=Cartella
+FormButtonClicked=Cliccando su un pulsante
+FormCloseTimerActivated=Attivazione del timer di chiusura modulo
+FormClosing=Chiudere
+FormEmptyMandatoryFieldsMessage=I seguenti campi devono essere compilati
+FormExportXml=Esportazione in XML
+FormFinally=Concludere
+FormFireActivated=In caso di attivazione del modulo
+FormFireClosed=In caso di chiusura del modulo
+FormFireDiscarded=In caso di rifiuto del modulo
+FormFireStructureChanged=In caso di modifica della struttura del modulo
+FormIncompleteIntro=\u00C8 necessario modificare alcuni valori.
+FormInvalidFieldsMessage=I seguenti campi non hanno un valore valido
+FormPrint=Stampare
+FormReset=Ripristinare
+FormSaveChangesQuestion=Volete salvare le modifiche?
+FormStateLoad=Apri...
+FormStateStore=Salva
+FormStateStoreAs=Salva con nome...
+FormTimerActivated=Timer attivato
+FormattingLocale=Formattazione
+GlobalBookmarks=Preferiti globali
+GlobalBookmarksAddMenu=Aggiungere a preferiti &globali
+Help=Aiuto
+Host=Host
+Hour=Ora
+IOErrorInfo=Verificare i file e la connessione al server.
+IOErrorText=Errore di comunicazione
+IOErrorTitle=Errore di lettura/scrittura
+InDaysX=entro {0} giorni
+InactiveState=Inattivo
+InactiveStates=Inattivi
+Info=Informazioni
+Information=Informazioni
+Interrupted=Interrotto
+InterruptedErrorText=L\u2019esecuzione \u00E8 stata interrotta manualmente.
+InterruptedErrorTitle=Esecuzione interrotta
+InvalidNumberMessageX="{0}" non \u00E8 un numero valido
+InvalidPhoneNumberMessageX="{0}" non \u00E8 un numero di telefono valido
+InvalidValueMessageX="{0}" non \u00E8 un valore valido
+JavaVMVersion=Java VM
+JavaVersion=Java Runtime
+KeyStroke=Combinazioni di tasti
+Language=Lingua
+Live=In tempo reale
+LoadFormXmlFailedText=Questo file non proviente da questo form.
+LogicBetween=\u00E8 tra {0} e {1}
+LogicBetweenShort=tra
+LogicDateIsInDays=ha luogo precisamente fra {0} giorni
+LogicDateIsInGEDays=ha luogo al pi\u00F9 presto fra {0} giorni
+LogicDateIsInGEMonths=ha luogo al pi\u00F9 presto fra {0} mesi
+LogicDateIsInLEDays=ha luogo al pi\u00F9 tardi fra {0} giorni
+LogicDateIsInLEMonths=ha luogo al pi\u00F9 tardi fra {0} mesi
+LogicDateIsInLastDays=ha avuto luogo negli ultimi {0} giorni
+LogicDateIsInLastMonths=ha avuto luogo negli ultimi {0} mesi
+LogicDateIsInMonths=ha luogo precisamente fra {0} mesi
+LogicDateIsInNextDays=ha luogo nei prossimi {0} giorni
+LogicDateIsInNextMonths=ha luogo nei prossimi {0} mesi
+LogicDateIsNotToday=non ha luogo oggi
+LogicDateIsToday=ha avuto luogo oggi
+LogicDateTimeIsInGEHours=ha luogo al pi\u00F9 presto tra {0} ore
+LogicDateTimeIsInGEMinutes=ha luogo al pi\u00F9 presto fra {0} minuti
+LogicDateTimeIsInLEHours=ha luogo al pi\u00F9 tardi fra {0} ore
+LogicDateTimeIsInLEMinutes=ha luogo al pi\u00F9 tardi fra {0} minuti
+LogicDateTimeIsNotNow=non ha luogo adesso
+LogicDateTimeIsNow=ha luogo adesso
+LogicEQ=\=
+LogicEndsWith=finisce con
+LogicGE=>\=
+LogicGT=>
+LogicIn=\u00E8
+LogicLE=<\=
+LogicLT=<
+LogicLike=contiene
+LogicNEQ=<>
+LogicNotEndsWith=non finisce con
+LogicNotIn=non \u00E8
+LogicNotLike=non contiene
+LogicNotNull=non \u00E8 vuoto
+LogicNotStartsWith=non comincia con
+LogicNull=\u00E8 vuoto
+LogicStartsWith=comincia con
+LogicTimeIsInGEHours=ha luogo al pi\u00F9 presto fra {0} ore
+LogicTimeIsInGEMinutes=ha luogo al pi\u00F9 presto fra {0} minuti
+LogicTimeIsInHours=ha luogo precisamente fra {0} ore
+LogicTimeIsInLEHours=ha luogo al pi\u00F9 tardi fra {0} ore
+LogicTimeIsInLEMinutes=ha luogo al pi\u00F9 tardi fra {0} minuti
+LogicTimeIsInMinutes=ha luogo precisamente fra {0} minuti
+LogicTimeIsNotNow=non ha luogo adesso
+LogicTimeIsNow=ha luogo adesso
+Login=Accesso
+LookAndFeel=Look and feel
+LookIn=Cerca in
+MemoryStatus=Memoria
+Minute=Minuto
+ModifyCustomColumnMenu=Modifica colonna\u2026
+Month=Mese
+Name=Cognome
+NetErrorInfo=Verificare il nome e l'indirizzo del server e la connessione al server.
+NetErrorText=Server non trovato
+NetErrorTitle=Errore rete
+NetworkLatency=Ritardo rete
+NewBookmarkFolderMenu=Nuova cartella\u2026
+NewPassword=Nuova password
+No=No
+NoButton=&No
+None=Niente
+NumberOfRows=Numero record di dati
+NumberTooLargeMessageXY=Il valore \u00E8 troppo elevato; deve essere tra {0} e {1}.
+NumberTooSmallMessageXY=Il valore \u00E8 troppo basso; deve essere tra {0} e {1}.
+OSUser=Utente del sistema
+OSVersion=Versione del sistema
+OcrEditorMoveTool=Sposta immagine
+OcrEditorNextPage=Pagina seguente
+OcrEditorOCRTool=Riconoscimento testo
+OcrEditorOfX=di
+OcrEditorPage=Pagina
+OcrEditorPreviousPage=Pagina precedente
+OcrEditorRotateLeft=Ruotare a sinistra
+OcrEditorRotateRight=Ruotare a destra
+OcrEditorZoomIn=Ingrandire
+OcrEditorZoomOut=Rimpicciolire
+OcrEditorZoomToFit=Modificare
+Ok=Ok
+OkButton=&Ok
+OkButtonTooltip=Salva e chiudi
+OldPassword=Vecchia password
+OneRow=1 oggetto
+OneSelected=1 selezionato
+Op=Operatore
+Open=Apri
+OrganizeTableColumnsMenu=Organizzare le colonne...
+OrganizeTableColumnsTitle=Organizzare le colonne
+OriginalErrorMessageIs=La notifica di errore originaria \u00E8\:\r\n{0}
+OutlineSelectorAddOrRemoveButtons=Aggiungere o eliminare &pulsanti
+OutlineSelectorShowFewerButtons=&Meno pulsanti
+OutlineSelectorShowMoreButtons=&Pi\u00F9 pulsanti
+Password=Password
+PasswordHasExpiredHeader=La password \u00E8 scaduta, dovreste cambiarla ora.
+PasswordHasExpiredTitle=Password scaduta
+PasswordMin8Chars=Almeno 8 caratteri
+PasswordMinOnNonStdChar=Almeno un carattere speciale
+PasswordMinOneChar=Almeno una lettera a-z/A-Z
+PasswordMinOneDigit=Almeno un numero da 0 a 9
+PasswordNotSameAsLasts=La password non pu\u00F2 essere uguale alle ultime password utilizzate.
+PasswordUsernameNotPartOfPass=Il nome utente non pu\u00F2 essere compreso nella password.
+PasswordWillExpireHeaderX=La password scadr\u00E0 tra {0}.
+PasswordWillExpireInfo=Volete cambiarla ora?
+PasswordWillExpireTitle=La password sta per scadere
+PasswordsDoNotMatch=Le due password non corrispondono.
+Paste=Incolla
+PasteTextTooLongForFieldX=Il testo inserito \u00E8 troppo lungo ed \u00E8 stato accorciato. Il numero massimo di caratteri \u00E8 {0}.
+Path=Percorso
+Pending=Attendere\u0085\u2026
+Properties=Propriet\u00E0
+Redo=Ripeti
+RemoveAllCustomColumnsMenu=Cancella colonne proprie
+RemoveCustomColumnMenu=Cancella colonna
+RenameBookmarkFolderMenu=Rinomina cartelle\u2026
+RepBuildExtract=Preparazione dati..
+RepExecAfter=Pulizia database
+RepExecBefore=Preparazione database
+RepUpdate=Elaborazione dati\u0085
+RepeatPassword=Ripeti
+RequestProblem=Errore di elaborazione
+ResetButton=&Riprisitna
+ResetButtonTooltip=Ripristina tutti i criteri di ricerca
+ResetTableColumnFilter=Filtro
+ResetTableColumns=Azzera le colonne
+ResetTableColumnsAll=Tutto
+ResetTableColumnsOrder=Sequenza
+ResetTableColumnsSorting=Ordinamento
+ResetTableColumnsView=Vista
+ResetTableColumnsWidth=Larghezza
+SC_Copyright=Il controllo ortografico Sentry e i dizionari sono marchi protetti di Wintertree Software, Inc.
+SC_DialogTitle=Controllo ortografico
+SC_DialogTitle_Options=Controllo ortografico\: opzioni
+SC_Help_AddToDictionary=Aggiunge la parola al dizionario utente
+SC_Help_Cancel=Chiude il dialogo e rifiuta tutte le modifiche (tasto di scelta rapida\: ESC)
+SC_Help_Change=Modifica l\u2019attuale occorrenza della parola
+SC_Help_ChangeAll=Modifica tutte le occorrenze della parola (nell\u2019attuale campo del testo)
+SC_Help_Enable=Attiva o disattiva il controllo ortografico Scout
+SC_Help_Ignore=Ignora l\u2019attuale occorrenza della parola
+SC_Help_IgnoreAll=Ignora questa e tutte le altre occorrenze della parola
+SC_Help_IgnoreCase=Ignorare maiuscole/minuscole
+SC_Help_IgnoreDomainNames=Ignora per esempio 'www.bsiag.com'
+SC_Help_IgnoreWordsWithNumbers=Ignora le parole con numeri
+SC_Help_Language=La lingua scelta
+SC_Help_Options=Apre il dialogo opzioni
+SC_Help_RemoveWord=Rimuove la parola evidenziata dal dizionario utente
+SC_Help_ReplacementWord=La parola, con la quale deve essere sostituita la parola evidenziata (premere ENTER per sostituire con questa parola quella non riconosciuta).
+SC_Help_Shortcut=La scelta del tasto di scelta rapida per il dialogo ortografico. Fisso, non pu\u00F2 essere modificato.
+SC_Help_SuggestionList=Proposte sostitutive per la parola evidenziata (cliccare due volte per sostituire la parola non riconosciuta con quella selezionata).
+SC_Help_Undo=Annulla l\u2019ultima modifica
+SC_Help_UseDefaults=Ripristinare tutte le impostazioni sui valori standard
+SC_Help_UserDictionary=Scegliere un dizionario \u201Ctlx\u201D (Scout) oppure \u201Cdic\u201D (Microsoft Word) come dizionario utente.
+SC_Label_AddToDictionary=Aggiungere
+SC_Label_Cancel=Interrompere
+SC_Label_Capitalization=Maiuscole/minuscole
+SC_Label_Change=Modificare
+SC_Label_ChangeAll=Variare tutti
+SC_Label_ChangeTo=Modificare secondo
+SC_Label_ConsiderChanging=Considerare la variazione
+SC_Label_ContainsDigits=Contiene cifre
+SC_Label_DoubledWord=Due occorrenze della parola
+SC_Label_Enable=Attivare controllo ortografico
+SC_Label_Ignore=Ignorare
+SC_Label_IgnoreAll=Ignorare tutti
+SC_Label_IgnoreCase=Ignorare maiuscole/minuscole
+SC_Label_IgnoreDomainNames=Ignorare il dominio nome
+SC_Label_IgnoreWordsWithNumbers=Ignorare le parole con numeri
+SC_Label_IgnoredWord=Parole definite dall'utente
+SC_Label_Main=Ortografia
+SC_Label_MixedCase=Maiuscolo/minuscolo misto
+SC_Label_NoSuggestions=(Nessuna proposta)
+SC_Label_NotInDictionary=La parola selezionata non \u00E8 stata riconosciuta
+SC_Label_Options=Opzioni\u2026
+SC_Label_RemoveWord=Rimuovere la parola
+SC_Label_Shortcut=Tasto di scelta rapida
+SC_Label_Spelling=Ortografia
+SC_Label_Undo=Annullare
+SC_Label_UseDefaults=Standard
+SC_Label_UserDictionary=Dizionario utente
+SC_Language=Lingua
+SC_Message_CheckRest=Volete controllare il resto del testo?
+SC_Message_Complete=Il controllo ortografico \u00E8 completo
+SC_Message_CompleteForSelection=Il controllo ortografico \u00E8 completo per l\u2019attuale selezione
+SC_Message_NotAvailable=Il controllo ortografico Scout non \u00E8 disponibile
+Save=Salva
+SaveButton=&Salva
+SaveButtonTooltip=Salva senza chiudere
+SavePassword=Salva nome utente/password
+ScoutStarting=Avvio Scout
+Search=Ricerca
+SearchButton=&Cerca
+SearchButtonTooltip=Avvia la ricerca
+SearchConstraints=Condizione di ricerca
+SearchTextIsTooGeneral=Specificare i criteri di ricerca
+SelectedStates=Soltanto selezionati
+Server=Server
+SmartFieldCannotComplete=Nessuna proposta per "{0}"
+SmartFieldMoreThanXRows=Pi\u00F9 di {0} record.
+SmartFindLabel=Testo di ricerca
+SortDescending=ordinare in ordine decrescente
+Source=Codice sorgente
+StatusExportDone=Esportazione completata
+StringPattern=Stampa
+Style=Modalit\u00E0
+Subject=Oggetto
+TableName=Tabella
+Timestamp=Data e ora
+Title=Titolo
+Today=oggi
+Tomorrow=domani
+TooManyRows=Quantit\u00E0 di dati troppo vasta. Limitare la ricerca.
+UncheckAll=Deseleziona tutti
+Undo=Annulla
+Update=Aggiorna
+UserCancelledOperation=L\u2019operazione \u00E8 stata interrotta manualmente
+UserInterrupted=Annullato dall'utente
+Username=Nome utente
+Value=Valore
+VersionMismatchAction=Volete riavviare l\u2019applicazione ora ed eseguire automaticamente l\u2019aggiornamento?
+VersionMismatchTextXY=L\u2019aggiornamento dell\u2019applicazione \u00E8 necessario per continuare a lavorare.\n\nL\u2019attuale versione \u00E8 {0}, la nuova \u00E8 {1}.
+VersionMismatchTitle=Aggiornamento necessario
+VetoErrorText=Almeno un campo di ricerca deve essere compilato.
+Week=Settimana
+WeekShort=SC
+WizardBackButton=&Indietro
+WizardBackButtonTooltip=Ritornare alla fase precedente
+WizardCancelButton=Annullare
+WizardCancelButtonTooltip=Annulla il wizard e rifiuta tutti i dati.
+WizardFinishButton=&Concludere
+WizardFinishButtonTooltip=Completare questo processo e ritornare alla selezione dei processi.
+WizardNextButton=&Avanti
+WizardNextButtonTooltip=Avanti alla prossima fase
+WizardSuspendButton=&Interrompere
+WizardSuspendButtonTooltip=Interrompe il processo e chiude il wizard (si pu\u00F2 proseguire pi\u00F9 tardi).
+WorkWeek=Settimana lavorativa
+XMustBeGreaterThanOrEqualY='{0}' deve essere maggiore oppure uguale a '{1}'
+XMustBeLessThanOrEqualY='{0}' deve essere minore oppure uguale a '{1}'
+XRows={0} oggetti
+XSelected={0} selezionato
+Yes=S\u00EC
+YesButton=&S\u00EC
+and=e
+between=Fra
+from=Da
+searchingProposals=Ricerca proposte...
+to=a
diff --git a/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_ja.properties b/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_ja.properties
index 18598000d3..31b9fa682c 100644
--- a/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_ja.properties
+++ b/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_ja.properties
@@ -1,137 +1,137 @@
-All=\u5168\u3066
-Apply=\u53D6\u308A\u5165\u308C\u308B
-Attribute=\u7279\u5FB4
-Bookmarks=\u30D6\u30C3\u30AF\u30DE\u30FC\u30AF
-BookmarksAddMenu=\u65B0\u3057\u3044\u30D6\u30C3\u30AF\u30DE\u30FC\u30AF\u3092\u4F5C\u308B
-BookmarksMainMenu=\u30D6\u30C3\u30AF\u30DE\u30FC\u30AF
-BookmarksManageMenu=\u30D6\u30C3\u30AF\u30DE\u30FC\u30AF\u3092\u4F5C\u6210\u3059\u308B
-BookmarksStartPageMenu=\u30B9\u30BF\u30FC\u30C8\u30DA\u30FC\u30B8
-BookmarksStartPageMenuClear=\u30B9\u30BF\u30FC\u30C8\u30DA\u30FC\u30B8\u7121\u3057
-BookmarksStartPageMenuGoto=\u30B9\u30BF\u30FC\u30C8\u30DA\u30FC\u30B8\u3092\u958B\u304F
-BookmarksStartPageMenuSet=\u3053\u306E\u30DA\u30FC\u30B8\u3092\u30B9\u30BF\u30FC\u30C8\u30DA\u30FC\u30B8\u306B\u3059\u308B
-Calendar_earlier=\u65E9\u3044
-Calendar_later=\u9045\u3044
-Cancel=\u30AD\u30E3\u30F3\u30BB\u30EB
-CancelButton=\u30AD\u30E3\u30F3\u30BB\u30EB
-CancelButtonTooltip=\u3053\u306E\u30C0\u30A4\u30A2\u30ED\u30FC\u30B0\u3092\u4FDD\u5B58\u305B\u305A\u306B\u7D42\u4E86\u3059\u308B
-ChangePassword=\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u5909\u66F4\u3059\u308B
-Close=\u9589\u3058\u308B
-CloseButton=\u9589\u3058\u308B
-CloseButtonTooltip=\u4FDD\u5B58\u305B\u305A\u306B\u9589\u3058\u308B
-Column=\u9593\u9699
-Columns=\u9593\u9699
-Condensed=\uFF16\u9593\u9699
-Configure=\u69CB\u6210
-Copy=\u30B3\u30D4\u30FC
-Criteria=\u7279\u5FB4\u30B5\u30FC\u30C1
-Day=\u65E5
-DeleteMenu=\u53D6\u308A\u6D88\u3059
-Detail=\u8A73\u7D30
-Details=\u8A73\u7D30
-Enabled=\u6D3B\u52D5
-ErrorAndRetryTextDefault=\u554F\u984C\u304C\u751F\u3058\u307E\u3057\u305F
-ErrorTextLogin=\u30E6\u30FC\u30B6\u30FC\u540D/\u30D1\u30B9\u30EF\u30FC\u30C9\u304C\u9055\u3044\u307E\u3059
-ErrorTitleLogin=\u30ED\u30B0\u30A4\u30F3\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F
-ExtendedSearchAddAttributeMenu=\u6761\u4EF6\u3092\u66F8\u304D\u8FBC\u3080
-ExtendedSearchAddEntityPrefix=\u6301\u3064
-ExtendedSearchEditAttributeMenu=\u51E6\u7406\u3059\u308B
-ExtendedSearchEntitySuffix=\u4E00\u7DD2\u306B
-ExtendedSearchNegateMenu=\u62D2\u5426\u3059\u308B
-ExtendedSearchRemoveAttributeMenu=\u9664\u53BB\u3059\u308B
-ExtendedSearchRemoveMenu=\u9664\u53BB\u3059\u308B
-FileExistsOwerwriteQuestion=\u9078\u3093\u3060\u30C7\u30FC\u30BF\u306F\u3059\u3067\u306B\u5B58\u5728\u3057\u3066\u3044\u307E\u3059\u3002\u30C7\u30FC\u30BF\u3092\u66F8\u304D\u76F4\u3057\u307E\u3059\u304B\uFF1F
-FileName=\u30D5\u30A1\u30A4\u30EB\u540D
-FileNotFoundExceptionMessage=\u30D5\u30A1\u30A4\u30EB\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093/\u4ECB\u5165\u3092\u62D2\u5426\u3055\u308C\u307E\u3057\u305F
-FileNotFoundMessage=\u30D5\u30A1\u30A4\u30EB\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093/\u4ECB\u5165\u3092\u62D2\u5426\u3055\u308C\u307E\u3057\u305F
-FileNotFoundTitle=\u30D5\u30A1\u30A4\u30EB\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093
-FilesOfType=\u30D5\u30A1\u30A4\u30EB\u306E\u30BF\u30A4\u30D7
-FormSaveChangesQuestion=\u4FEE\u6B63\u3057\u305F\u3082\u306E\u3092\u4FDD\u5B58\u3057\u307E\u3059\u304B\uFF1F
-FormStateLoad=\u958B\u304F
-FormStateStore=\u4FDD\u5B58\u3059\u308B
-FormStateStoreAs=\u4FDD\u5B58\u3059\u308B
-GlobalBookmarks=\u30D6\u30C3\u30AF\u30DE\u30FC\u30AF
-Help=\u30D8\u30EB\u30D7
-Host=\u30B3\u30F3\u30D4\u30E5\u30FC\u30BF\u30FC
-IOErrorInfo=\u30C7\u30FC\u30BF\u3068\u63A5\u7D9A\u3092\u70B9\u691C\u3057\u3066\u304F\u3060\u3055\u3044
-IOErrorText=\u30B3\u30DF\u30E5\u30CB\u30B1\u30FC\u30B7\u30E7\u30F3\u30A8\u30E9\u30FC
-IOErrorTitle=\u8AAD\u307F\u8FBC\u307F/\u66F8\u304D\u8FBC\u307F\u30A8\u30E9\u30FC
-Info=\u30A4\u30F3\u30D5\u30A9\u30E1\u30FC\u30B7\u30E7\u30F3
-Information=\u30A4\u30F3\u30D5\u30A9\u30E1\u30FC\u30B7\u30E7\u30F3
-Interrupted=\u4E2D\u6B62\u3057\u307E\u3057\u305F
-Language=\u8A00\u8A9E
-Live=\u30E9\u30A4\u30F4
-LoadFormXmlFailedText=\u3053\u306E\u30D5\u30A1\u30A4\u30EB\u306F\u3053\u306E\u30C0\u30A4\u30A2\u30ED\u30FC\u30B0\u306B\u9069\u5408\u3057\u307E\u305B\u3093
-LogicEQ=\=
-LogicEndsWith=\u3067\u7D42\u308F\u308B
-LogicGE=>\=
-LogicGT=>
-LogicIn=\u306F
-LogicLE=<\=
-LogicLT=<
-LogicLike=\u542B\u3080
-LogicNEQ=<>
-LogicNotIn=\u3067\u306A\u3044
-LogicNotLike=\u542B\u307E\u306A\u3044
-LogicNotNull=\u306F\u7A7A\u767D\u3067\u306F\u3042\u308A\u307E\u305B\u3093
-LogicNull=\u306F\u7A7A\u767D\u3067\u3059
-LogicStartsWith=\u3068\u59CB\u52D5\u3059\u308B
-LookAndFeel=\u30EB\u30C3\u30AF\u30A2\u30F3\u30C9\u30D5\u30A3\u30FC\u30EB
-LookIn=\u306E\u4E2D\u3092\u63A2\u3059
-Month=\u6708
-NetErrorInfo=\u30B5\u30FC\u30D0\u30FC\u540D\u3001\u30B5\u30FC\u30D0\u30FC\u30A2\u30C9\u30EC\u30B9\u3068\u63A5\u7D9A\u3092\u70B9\u691C\u3057\u3066\u304F\u3060\u3055\u3044
-NetErrorText=\u30B5\u30FC\u30D0\u30FC\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093
-NetErrorTitle=\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u30A8\u30E9\u30FC
-NewPassword=\u65B0\u898F\u30D1\u30B9\u30EF\u30FC\u30C9
-No=\u3044\u3044\u3048
-NoButton=\u3044\u3044\u3048
-None=\u7121\u3044
-NumberOfRows=\u30C7\u30FC\u30BF\u6587\u7AE0\u6570
-OSUser=\u30E6\u30FC\u30B6\u30FC
-OSVersion=\u30F4\u30A1\u30FC\u30B8\u30E7\u30F3
-Ok=\u6B21\u3078
-OkButton=\u6B21\u3078
-OkButtonTooltip=\u5BFE\u8A71\u3092\u4FDD\u5B58\u7D42\u4E86\u3059\u308B
-OldPassword=\u53E4\u3044\u30D1\u30B9\u30EF\u30FC\u30C9
-Op=\u30AA\u30DA\u30EC\u30FC\u30BF\u30FC
-Open=\u958B\u304F
-Password=\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u5909\u66F4\u3059\u308B
-PasswordsDoNotMatch=\u30D1\u30B9\u30EF\u30FC\u30C9\u304C\u4E00\u81F4\u3057\u307E\u305B\u3093
-Paste=\u8CBC\u308A\u4ED8\u3051
-Path=Path
-Pending=\u5F85\u3064
-Properties=\u7279\u6027
-RepBuildExtract=\u30C7\u30FC\u30BF\u306F\u518D\u751F\u3055\u308C\u307E\u3057\u305F
-RepExecAfter=\u30C7\u30FC\u30BF\u30D0\u30F3\u30AF\u3092\u6574\u7406\u3059\u308B
-RepExecBefore=\u30C7\u30FC\u30BF\u30D0\u30F3\u30AF\u3092\u6E96\u5099\u3059\u308B
-RepUpdate=\u30C7\u30FC\u30BF\u306E\u51E6\u7406
-RepeatPassword=\u7E70\u308A\u8FD4\u3059
-RequestProblem=\u51E6\u7406\u30DF\u30B9
-ResetButton=\u30EA\u30BB\u30C3\u30C8
-ResetButtonTooltip=\u5168\u3066\u306E\u30C0\u30A4\u30A2\u30ED\u30FC\u30B0\u3092\u7A7A\u767D\u306B\u3059\u308B
-Save=\u4FDD\u5B58
-SaveButton=\u4FDD\u5B58
-SaveButtonTooltip=\u30C0\u30A4\u30A2\u30ED\u30FC\u30B0\u3092\u9589\u3058\u305A\u306B\u4FDD\u5B58
-Search=\u30B5\u30FC\u30C1
-SearchButton=\u30B5\u30FC\u30C1
-SearchButtonTooltip=\u30C0\u30A4\u30A2\u30ED\u30FC\u30B0\u3092\u9589\u3058\u30B5\u30FC\u30C1\u3092\u958B\u59CB
-SearchConstraints=\u30B5\u30FC\u30C1\u6761\u4EF6
-Server=\u30B5\u30FC\u30D0\u30FC
-SmartFindLabel=\u30B5\u30FC\u30C1\u3092\u4E86\u89E3\u3059\u308B
-Source=\u30BD\u30FC\u30B9
-StatusExportDone=\u30A8\u30AD\u30B9\u30DD\u30FC\u30C8\u3092\u5B9F\u884C\u3059\u308B
-Style=\u30B9\u30BF\u30A4\u30EB
-TableName=\u4E00\u89A7\u8868
-Timestamp=\u65E5\u4ED8\u5370
-TooManyRows=\u30C7\u30FC\u30BF\u30FC\u91CF\u304C\u8A31\u5BB9\u7BC4\u56F2\u3092\u8D85\u3048\u3066\u3044\u307E\u3059\u3002\u30B5\u30FC\u30C1\u30D1\u30CD\u30EB\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044
-Update=\u30A2\u30C3\u30D7\u30C7\u30FC\u30C8
-UserInterrupted=\u30E6\u30FC\u30B6\u30FC\u3092\u30AD\u30E3\u30F3\u30BB\u30EB\u3057\u307E\u3057\u305F
-Username=\u30E6\u30FC\u30B6\u30FC\u540D
-Value=\u4FA1\u5024
-Week=\u9031
-WeekShort=\u66A6\u9031
-Yes=\u306F\u3044
-YesButton=\u306F\u3044
-and=\u3068
-between=\u9593
-from=\u304B\u3089
-to=\u307E\u3067
+All=\u5168\u3066
+Apply=\u53D6\u308A\u5165\u308C\u308B
+Attribute=\u7279\u5FB4
+Bookmarks=\u30D6\u30C3\u30AF\u30DE\u30FC\u30AF
+BookmarksAddMenu=\u65B0\u3057\u3044\u30D6\u30C3\u30AF\u30DE\u30FC\u30AF\u3092\u4F5C\u308B
+BookmarksMainMenu=\u30D6\u30C3\u30AF\u30DE\u30FC\u30AF
+BookmarksManageMenu=\u30D6\u30C3\u30AF\u30DE\u30FC\u30AF\u3092\u4F5C\u6210\u3059\u308B
+BookmarksStartPageMenu=\u30B9\u30BF\u30FC\u30C8\u30DA\u30FC\u30B8
+BookmarksStartPageMenuClear=\u30B9\u30BF\u30FC\u30C8\u30DA\u30FC\u30B8\u7121\u3057
+BookmarksStartPageMenuGoto=\u30B9\u30BF\u30FC\u30C8\u30DA\u30FC\u30B8\u3092\u958B\u304F
+BookmarksStartPageMenuSet=\u3053\u306E\u30DA\u30FC\u30B8\u3092\u30B9\u30BF\u30FC\u30C8\u30DA\u30FC\u30B8\u306B\u3059\u308B
+Calendar_earlier=\u65E9\u3044
+Calendar_later=\u9045\u3044
+Cancel=\u30AD\u30E3\u30F3\u30BB\u30EB
+CancelButton=\u30AD\u30E3\u30F3\u30BB\u30EB
+CancelButtonTooltip=\u3053\u306E\u30C0\u30A4\u30A2\u30ED\u30FC\u30B0\u3092\u4FDD\u5B58\u305B\u305A\u306B\u7D42\u4E86\u3059\u308B
+ChangePassword=\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u5909\u66F4\u3059\u308B
+Close=\u9589\u3058\u308B
+CloseButton=\u9589\u3058\u308B
+CloseButtonTooltip=\u4FDD\u5B58\u305B\u305A\u306B\u9589\u3058\u308B
+Column=\u9593\u9699
+Columns=\u9593\u9699
+Condensed=\uFF16\u9593\u9699
+Configure=\u69CB\u6210
+Copy=\u30B3\u30D4\u30FC
+Criteria=\u7279\u5FB4\u30B5\u30FC\u30C1
+Day=\u65E5
+DeleteMenu=\u53D6\u308A\u6D88\u3059
+Detail=\u8A73\u7D30
+Details=\u8A73\u7D30
+Enabled=\u6D3B\u52D5
+ErrorAndRetryTextDefault=\u554F\u984C\u304C\u751F\u3058\u307E\u3057\u305F
+ErrorTextLogin=\u30E6\u30FC\u30B6\u30FC\u540D/\u30D1\u30B9\u30EF\u30FC\u30C9\u304C\u9055\u3044\u307E\u3059
+ErrorTitleLogin=\u30ED\u30B0\u30A4\u30F3\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F
+ExtendedSearchAddAttributeMenu=\u6761\u4EF6\u3092\u66F8\u304D\u8FBC\u3080
+ExtendedSearchAddEntityPrefix=\u6301\u3064
+ExtendedSearchEditAttributeMenu=\u51E6\u7406\u3059\u308B
+ExtendedSearchEntitySuffix=\u4E00\u7DD2\u306B
+ExtendedSearchNegateMenu=\u62D2\u5426\u3059\u308B
+ExtendedSearchRemoveAttributeMenu=\u9664\u53BB\u3059\u308B
+ExtendedSearchRemoveMenu=\u9664\u53BB\u3059\u308B
+FileExistsOwerwriteQuestion=\u9078\u3093\u3060\u30C7\u30FC\u30BF\u306F\u3059\u3067\u306B\u5B58\u5728\u3057\u3066\u3044\u307E\u3059\u3002\u30C7\u30FC\u30BF\u3092\u66F8\u304D\u76F4\u3057\u307E\u3059\u304B\uFF1F
+FileName=\u30D5\u30A1\u30A4\u30EB\u540D
+FileNotFoundExceptionMessage=\u30D5\u30A1\u30A4\u30EB\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093/\u4ECB\u5165\u3092\u62D2\u5426\u3055\u308C\u307E\u3057\u305F
+FileNotFoundMessage=\u30D5\u30A1\u30A4\u30EB\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093/\u4ECB\u5165\u3092\u62D2\u5426\u3055\u308C\u307E\u3057\u305F
+FileNotFoundTitle=\u30D5\u30A1\u30A4\u30EB\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093
+FilesOfType=\u30D5\u30A1\u30A4\u30EB\u306E\u30BF\u30A4\u30D7
+FormSaveChangesQuestion=\u4FEE\u6B63\u3057\u305F\u3082\u306E\u3092\u4FDD\u5B58\u3057\u307E\u3059\u304B\uFF1F
+FormStateLoad=\u958B\u304F
+FormStateStore=\u4FDD\u5B58\u3059\u308B
+FormStateStoreAs=\u4FDD\u5B58\u3059\u308B
+GlobalBookmarks=\u30D6\u30C3\u30AF\u30DE\u30FC\u30AF
+Help=\u30D8\u30EB\u30D7
+Host=\u30B3\u30F3\u30D4\u30E5\u30FC\u30BF\u30FC
+IOErrorInfo=\u30C7\u30FC\u30BF\u3068\u63A5\u7D9A\u3092\u70B9\u691C\u3057\u3066\u304F\u3060\u3055\u3044
+IOErrorText=\u30B3\u30DF\u30E5\u30CB\u30B1\u30FC\u30B7\u30E7\u30F3\u30A8\u30E9\u30FC
+IOErrorTitle=\u8AAD\u307F\u8FBC\u307F/\u66F8\u304D\u8FBC\u307F\u30A8\u30E9\u30FC
+Info=\u30A4\u30F3\u30D5\u30A9\u30E1\u30FC\u30B7\u30E7\u30F3
+Information=\u30A4\u30F3\u30D5\u30A9\u30E1\u30FC\u30B7\u30E7\u30F3
+Interrupted=\u4E2D\u6B62\u3057\u307E\u3057\u305F
+Language=\u8A00\u8A9E
+Live=\u30E9\u30A4\u30F4
+LoadFormXmlFailedText=\u3053\u306E\u30D5\u30A1\u30A4\u30EB\u306F\u3053\u306E\u30C0\u30A4\u30A2\u30ED\u30FC\u30B0\u306B\u9069\u5408\u3057\u307E\u305B\u3093
+LogicEQ=\=
+LogicEndsWith=\u3067\u7D42\u308F\u308B
+LogicGE=>\=
+LogicGT=>
+LogicIn=\u306F
+LogicLE=<\=
+LogicLT=<
+LogicLike=\u542B\u3080
+LogicNEQ=<>
+LogicNotIn=\u3067\u306A\u3044
+LogicNotLike=\u542B\u307E\u306A\u3044
+LogicNotNull=\u306F\u7A7A\u767D\u3067\u306F\u3042\u308A\u307E\u305B\u3093
+LogicNull=\u306F\u7A7A\u767D\u3067\u3059
+LogicStartsWith=\u3068\u59CB\u52D5\u3059\u308B
+LookAndFeel=\u30EB\u30C3\u30AF\u30A2\u30F3\u30C9\u30D5\u30A3\u30FC\u30EB
+LookIn=\u306E\u4E2D\u3092\u63A2\u3059
+Month=\u6708
+NetErrorInfo=\u30B5\u30FC\u30D0\u30FC\u540D\u3001\u30B5\u30FC\u30D0\u30FC\u30A2\u30C9\u30EC\u30B9\u3068\u63A5\u7D9A\u3092\u70B9\u691C\u3057\u3066\u304F\u3060\u3055\u3044
+NetErrorText=\u30B5\u30FC\u30D0\u30FC\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093
+NetErrorTitle=\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u30A8\u30E9\u30FC
+NewPassword=\u65B0\u898F\u30D1\u30B9\u30EF\u30FC\u30C9
+No=\u3044\u3044\u3048
+NoButton=\u3044\u3044\u3048
+None=\u7121\u3044
+NumberOfRows=\u30C7\u30FC\u30BF\u6587\u7AE0\u6570
+OSUser=\u30E6\u30FC\u30B6\u30FC
+OSVersion=\u30F4\u30A1\u30FC\u30B8\u30E7\u30F3
+Ok=\u6B21\u3078
+OkButton=\u6B21\u3078
+OkButtonTooltip=\u5BFE\u8A71\u3092\u4FDD\u5B58\u7D42\u4E86\u3059\u308B
+OldPassword=\u53E4\u3044\u30D1\u30B9\u30EF\u30FC\u30C9
+Op=\u30AA\u30DA\u30EC\u30FC\u30BF\u30FC
+Open=\u958B\u304F
+Password=\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u5909\u66F4\u3059\u308B
+PasswordsDoNotMatch=\u30D1\u30B9\u30EF\u30FC\u30C9\u304C\u4E00\u81F4\u3057\u307E\u305B\u3093
+Paste=\u8CBC\u308A\u4ED8\u3051
+Path=Path
+Pending=\u5F85\u3064
+Properties=\u7279\u6027
+RepBuildExtract=\u30C7\u30FC\u30BF\u306F\u518D\u751F\u3055\u308C\u307E\u3057\u305F
+RepExecAfter=\u30C7\u30FC\u30BF\u30D0\u30F3\u30AF\u3092\u6574\u7406\u3059\u308B
+RepExecBefore=\u30C7\u30FC\u30BF\u30D0\u30F3\u30AF\u3092\u6E96\u5099\u3059\u308B
+RepUpdate=\u30C7\u30FC\u30BF\u306E\u51E6\u7406
+RepeatPassword=\u7E70\u308A\u8FD4\u3059
+RequestProblem=\u51E6\u7406\u30DF\u30B9
+ResetButton=\u30EA\u30BB\u30C3\u30C8
+ResetButtonTooltip=\u5168\u3066\u306E\u30C0\u30A4\u30A2\u30ED\u30FC\u30B0\u3092\u7A7A\u767D\u306B\u3059\u308B
+Save=\u4FDD\u5B58
+SaveButton=\u4FDD\u5B58
+SaveButtonTooltip=\u30C0\u30A4\u30A2\u30ED\u30FC\u30B0\u3092\u9589\u3058\u305A\u306B\u4FDD\u5B58
+Search=\u30B5\u30FC\u30C1
+SearchButton=\u30B5\u30FC\u30C1
+SearchButtonTooltip=\u30C0\u30A4\u30A2\u30ED\u30FC\u30B0\u3092\u9589\u3058\u30B5\u30FC\u30C1\u3092\u958B\u59CB
+SearchConstraints=\u30B5\u30FC\u30C1\u6761\u4EF6
+Server=\u30B5\u30FC\u30D0\u30FC
+SmartFindLabel=\u30B5\u30FC\u30C1\u3092\u4E86\u89E3\u3059\u308B
+Source=\u30BD\u30FC\u30B9
+StatusExportDone=\u30A8\u30AD\u30B9\u30DD\u30FC\u30C8\u3092\u5B9F\u884C\u3059\u308B
+Style=\u30B9\u30BF\u30A4\u30EB
+TableName=\u4E00\u89A7\u8868
+Timestamp=\u65E5\u4ED8\u5370
+TooManyRows=\u30C7\u30FC\u30BF\u30FC\u91CF\u304C\u8A31\u5BB9\u7BC4\u56F2\u3092\u8D85\u3048\u3066\u3044\u307E\u3059\u3002\u30B5\u30FC\u30C1\u30D1\u30CD\u30EB\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044
+Update=\u30A2\u30C3\u30D7\u30C7\u30FC\u30C8
+UserInterrupted=\u30E6\u30FC\u30B6\u30FC\u3092\u30AD\u30E3\u30F3\u30BB\u30EB\u3057\u307E\u3057\u305F
+Username=\u30E6\u30FC\u30B6\u30FC\u540D
+Value=\u4FA1\u5024
+Week=\u9031
+WeekShort=\u66A6\u9031
+Yes=\u306F\u3044
+YesButton=\u306F\u3044
+and=\u3068
+between=\u9593
+from=\u304B\u3089
+to=\u307E\u3067
diff --git a/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_nl.properties b/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_nl.properties
index d7a6f38135..451f9e4f55 100644
--- a/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_nl.properties
+++ b/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_nl.properties
@@ -1,387 +1,387 @@
-ActivateBookmarkMenu=Open favoriet
-ActiveAndInactiveStates=Actief+Inactief
-ActiveStates=Actief
-AllStates=Alles
-Apply=Toepassen
-ApplyBookmarkToSearchFailedMessage=Deze favoriet kan niet toegepast worden op de huidige zoekopdracht.
-Attribute=Bijdragen
-Bookmark=Favoriet
-BookmarkFolder=Map
-Bookmarks=Favorieten
-BookmarksAddMenu=&Voeg aan favorieten toe
-BookmarksApplyToCurrentSearch=Zoekopdracht uitvoeren met gebruik van deze favoriet
-BookmarksMainMenu=&Favorieten
-BookmarksManageMenu=&Stel favorieten in...
-BookmarksPublishMenu=Publiceer favoriet...
-BookmarksStartPageMenu=& Opstartweergave
-BookmarksStartPageMenuClear=&Geen Opstartweergave
-BookmarksStartPageMenuGoto=&Open Opstartweergave
-BookmarksStartPageMenuSet=&Stel huidige weergave als beginweergave in
-ButtonDeselectAll=Deselecteer alles
-ButtonMoveDown=Naar beneden
-ButtonMoveUp=Naar boven
-ButtonSelectAll=Selecteer alles
-Calendar_earlier=Eerder
-Calendar_later=Later
-Cancel=Annuleren
-CancelButton=&Annuleer
-CancelButtonTooltip=Sluit venster zonder op te slaan, indien noodzakelijk met bevestiging dialoogvenster
-ChangePassword=Wachtwoord wijzigen
-CloseButton=&Sluit
-CloseButtonTooltip=Sluit dialoogvenster zonder op te slaan.
-CodeTypeInit=Code type initialisatie
-Column=Kolom
-Columns=Kolommen gegroepeerd
-ComposerFieldAggregationAvg=Gemiddeld({0})
-ComposerFieldAggregationCount=Tel({0})
-ComposerFieldAggregationLabel=Functie
-ComposerFieldAggregationMax=Maximum({0})
-ComposerFieldAggregationMedian=Mediaan({0})
-ComposerFieldAggregationMin=Minimum({0})
-ComposerFieldAggregationSum=Som({0})
-Condensed=6 kolommen
-Copy=Copi\u00EBer
-Cut=Eindigen
-Day=Dag
-DefaultPasswordPolicyText=Het paswoord komt niet overeen met de opgegeven waarden\n\nWaarden\:\n- tenminste 8 tekens\n- tenminste een cijfer (0-9)\n- tenminste een niet standaard teken (\!|@|\#|$|%|^|&|*|(|)|_|+|||~|-|
-DeleteBookmarkMenu=Verwijder favoriet
-DeleteConfirmationText=Wilt u volgende data verwijderen?
-DeleteConfirmationTextNoItemList=Wilt u deze data verwijderen?
-DeleteConfirmationTextNoItemListX=Wilt u deze verwijderen {0}?
-DeleteConfirmationTextX=Wilt u het volgende verwijderen\: {0}?
-DeleteConfirmationTitle=Bevesting verwijdering
-DeleteFolderMenu=Verwijder map
-DetailedVersion=Gedetailleerde Versie
-EditBookmarkMenu=Bewerk favoriet...
-EmailCc=Cc
-EmailFrom=Van
-EmailSubject=Onderwerp
-EmailTo=tot
-Error=Fout
-ErrorAndRetryTextDefault=Een fout is opgetreden tijdens gegevensoverbrenging
-ErrorTextLogin=Ongeldige gebruikersnaam / wachtwoord
-ErrorTitleLogin=Login mislukt
-ExcelChart_Button_LoadDefaults=Begininstellingen
-ExcelChart_Button_LoadDefaultsHint=Stelt dit venster opnieuw in door de beginwaarden te laden
-ExcelChart_Button_LoadProfile=Laadt profiel...
-ExcelChart_Button_LoadProfileHint=Laadt instellingen van xml bestand
-ExcelChart_Button_SaveProfile=Bewaar profiel...
-ExcelChart_Button_SaveProfileHint=Bewaart de huidige instellingen in een XML bestand.
-ExcelChart_Error_CreatingChartFailed=Grafiek aanmaken mislukt.
-ExcelChart_Error_ExportingFailed=Export mislukt vanwege
-ExcelChart_Error_InitializationFailed=Initialisatie van de aanvullende klasse(n) mislukt.
-ExcelChart_Error_LoadingProfileFailed=Laadprofiel mislukt vanwege
-ExcelChart_Error_LoadingTemplateFailed=Laden sjabloon mislukt.
-ExcelChart_Error_RetrivingOutlineDataFailed=Terugkrijgen outlinegegevens mislukt.
-ExcelChart_Error_SavingProfileFailed=Opslaan profiel mislukt vanwege
-ExcelChart_Error_WrongProfile=Het profiel werd aangemaakt voor een andere outline.
-ExcelChart_Label_AutomaticMode=Automatische modus
-ExcelChart_Label_AutomaticModeHint=Verberg Excel en sla automatisch op
-ExcelChart_Label_ChartNumber=Grafieknummer
-ExcelChart_Label_ChartType=Grafiektype
-ExcelChart_Label_FileName=Bestandsnaam
-ExcelChart_Label_FirstRow=Eerste rij
-ExcelChart_Label_Height=Hoogte
-ExcelChart_Label_HistogramMode=Histogram modus
-ExcelChart_Label_HistogramModeHint=De histogram modus combineert gelijke waarden op de X-as naar een waarde.
-ExcelChart_Label_LastRow=Laatste rij
-ExcelChart_Label_Offset=Functie
-ExcelChart_Label_SkipNullValues=Sla nul waarden over in de histogram modus
-ExcelChart_Label_SkipNullValuesHint=Indien gecontroleerde nul waarden op de X-as worden genegeerd, indien anders worden deze gecombineerd naar <Onbekend>.
-ExcelChart_Label_TemplateName=Sjabloon
-ExcelChart_Label_UseCustomFormat=Gebruik standaardformaat
-ExcelChart_Label_UseCustomFormatHint=Indien gecontroleerd kunt u de positie van de grafiek en grootte aangeven.
-ExcelChart_Label_UseExistingChart=Gebruik bestaande grafiek
-ExcelChart_Label_UseExistingChartHint=Indien gecontroleerd wordt de aangegeven grafiek in het bepaalde sjabloon gebruikt.
-ExcelChart_Label_UseSelectiveExport=Gebruik selectieve export
-ExcelChart_Label_UseSelectiveExportHint=Indien gecontroleerd worden alleen de aangegeven rijen hieronder ge\u00EBxporteerd.
-ExcelChart_Label_Width=Breedte
-ExcelChart_Label_WorksheetName=Werkblad
-ExcelChart_Label_XAxis=X-As
-ExcelChart_Label_YAxes=Y-As
-ExcelChart_Status_Done=Excel Grafiek Export gereed.
-ExcelChart_Tab_Advanced=Geavanceerd
-ExcelChart_Tab_Basic=Standaard
-ExcelChart_Title_MainForm=Excel Grafiek Export
-ExcelChart_Type_Area3D=Gebied 3D
-ExcelChart_Type_Area=Gebied
-ExcelChart_Type_AreaStacked3D=Gebied gestapeld 3D
-ExcelChart_Type_AreaStacked=Gebied gestapeld
-ExcelChart_Type_BarsClustered3D=Staafdiagram gegroepeerd 3D
-ExcelChart_Type_BarsClustered=Staafdiagram gegroepeerd
-ExcelChart_Type_BarsStacked3D=Staafdiagram gestapeld 3D
-ExcelChart_Type_BarsStacked=Staafdiagram
-ExcelChart_Type_ColumnsClustered3D=Kolommen gegroepeerd 3D
-ExcelChart_Type_ColumnsClustered=Kolommen
-ExcelChart_Type_ColumnsStacked3D=Kolommen gestapeld 3D
-ExcelChart_Type_ColumnsStacked=Kolommen gestapeld
-ExcelChart_Type_Line=Lijn
-ExcelChart_Type_LineStacked=Gestapelde lijn
-ExcelChart_Type_Pie3D=Taart 3D
-ExcelChart_Type_Pie=Taart
-ExcelChart_Type_PieExploded3D=Taart Gesegmenteerd 3D
-ExcelChart_Type_PieExploded=Taart gesegmenteerd
-ExcelChart_Various_Averaged=Gemiddeld
-ExcelChart_Various_Column=Kolom
-ExcelChart_Various_Frequency=Frequentie
-ExcelChart_Various_SummedUp=Opgeteld
-ExcelChart_Various_Unknown=<Onbekend>
-ExecutionTime=Server processing
-ExportDate=Exporteer tijdstip
-ExtendedSearchAddAdditionalOrMenu=Voeg extra in of vervang
-ExtendedSearchAddAttribute=Belemmering
-ExtendedSearchAddAttributeMenu=Voeg selectievoorwaarde toe...
-ExtendedSearchAddEitherOrMenu=Voeg toe ... of
-ExtendedSearchAddEntityPrefix=heeft
-ExtendedSearchAnd=en
-ExtendedSearchEditAttributeMenu=Bewerk...
-ExtendedSearchEither=hetzij
-ExtendedSearchEntitySuffix=met
-ExtendedSearchNegateMenu=Doe teniet...
-ExtendedSearchNot=niet
-ExtendedSearchOr=of
-ExtendedSearchRemoveAttributeMenu=Verwijder
-ExtendedSearchRemoveMenu=Verwijder
-FileExistsOwerwriteQuestion=Het geselecteerde bestand bestaat al. Dit bestand overschrijven?
-FileName=Bestandnaam
-FileNotFoundMessage=Kan het bestand niet vinden\:
-FileNotFoundTitle=Bestand niet gevonden
-FilesOfType=Bestandstype
-FilterBookmarkTree=Bladeren favorieten
-Folders=Mappen
-FormButtonClicked=Terwijl u op een knop klikt
-FormCloseTimerActivated=Sluitingstimer geactiveerd
-FormClosing=Sluiten
-FormEmptyMandatoryFieldsMessage=Volgende velden zijn verplicht
-FormExportXml=Exporteer naar XML
-FormFinally=Finaliseer
-FormFireActivated=Wanneer het formulier werd geactiveerd
-FormFireClosed=Wanneer het formulier gesloten werd
-FormFireDiscarded=Als formulier werd verwijderd
-FormFireStructureChanged=Bij de wijziging van de formulierstrustuur
-FormFireToBack=Bij sturen van het formulier naar achter
-FormFireToFront=Bij sturen van het formulier naar voor
-FormIncompleteIntro=Niet alle verplichte velden zijn ingevuld.
-FormInvalidFieldsMessage=Volgende velden zijn ongeldig
-FormPrint=Print
-FormReset=Reset
-FormSaveChangesQuestion=Wilt u de wijzigingen opslaan?
-FormStateLoad=Laden..
-FormStateStore=Bewaar
-FormStateStoreAs=Opslaan als...
-FormTimerActivated=Timer geactiveerd
-FormattingLocale=Opmaak
-GlobalBookmarks=Globale Favorieten
-GlobalBookmarksAddMenu=Voeg toe &globale favorieten
-Help=Help
-Hour=Uur
-IOErrorInfo=Controleer bestanden en verbinding a.u.b.
-IOErrorText=Communicatiefout
-IOErrorTitle=Lees / schrijffout
-InDaysX=in {0} dagen
-InactiveState=Inactief
-InactiveStates=Inactief
-Info=Informatie
-Interrupted=Onderbroken
-InterruptedErrorText=Het proces is handmatig geannuleerd
-InterruptedErrorTitle=Proces geannuleerd
-InvalidNumberMessageX="{0}" is een ongeldig nummer
-InvalidPhoneNumberMessageX="{0}" is een ongeldig telefoonnummer
-InvalidValueMessageX="{0}" is een ongeldige waarde
-JavaVMVersion=Java VM
-JavaVersion=Java Runtime
-KeyStroke=Toetsaanslag
-Language=Taal
-LoadFormXmlFailedText=Dit bestand is niet compatibel met dit venster.
-LogicBetween=is tussen {0} en {1}
-LogicBetweenShort=Tussen
-LogicDateIsInDays=is in precies n (dagen)
-LogicDateIsInGEDays=Datum >\= vandaag + n dagen
-LogicDateIsInGEMonths=Datum >\= vandaag + n maanden
-LogicDateIsInLEDays=Datum <\=vandaag + n dagen
-LogicDateIsInLEMonths=Datum <\=vandaag + n maanden
-LogicDateIsInLastDays=was in de laatste n dagen
-LogicDateIsInLastMonths=was in de laatste n maanden
-LogicDateIsInMonths=is in precies (maanden)
-LogicDateIsInNextDays=zou binnen n dagen zijn
-LogicDateIsInNextMonths=zou binnen n maanden zijn
-LogicDateIsNotToday=is niet vandaag
-LogicDateIsToday=is vandaag
-LogicDateTimeIsInGEHours=Datum >\= nu + n uur
-LogicDateTimeIsInGEMinutes=Datum >\= nu + n minuten
-LogicDateTimeIsInLEHours=Datum <\= nu + n uur
-LogicDateTimeIsInLEMinutes=Datum <\= nu + n minuten
-LogicDateTimeIsNotNow=is niet nu
-LogicDateTimeIsNow=is nu
-LogicEQ=\=
-LogicEndsWith=Eindigt met
-LogicGE=>\=
-LogicGT=>
-LogicIn=is
-LogicLE=<\=
-LogicLT=<
-LogicLike=bevat
-LogicNEQ=<>
-LogicNotEndsWith=eindigd niet met
-LogicNotIn=is niet
-LogicNotLike=niet bevattend
-LogicNotNull=is niet leeg
-LogicNotStartsWith=begint niet met
-LogicNull=is leeg
-LogicStartsWith=begint met
-LogicTimeIsInGEHours=is ten vroegste binnen (uren)
-LogicTimeIsInGEMinutes=is ten vroegste binnen (minuten)
-LogicTimeIsInHours=is in precies (uren)
-LogicTimeIsInLEHours=is ten laatste binnen (uren)
-LogicTimeIsInLEMinutes=is ten laatste binnen (minuten)
-LogicTimeIsInMinutes=is in precies (minuten)
-LogicTimeIsNotNow=is niet nu
-LogicTimeIsNow=is nu
-Login=Login
-LookIn=Kijk in
-MemoryStatus=Geheugen
-Minute=Minuut
-Month=Maand
-Name=Naam
-NetErrorInfo=Controleer servernaam, URL en verbinding a.u.b.
-NetErrorText=Server niet gevonden
-NetErrorTitle=Netwerkfout
-NetworkLatency=Netwerk vertraging
-NewBookmarkFolderMenu=Niewe map...
-NewPassword=Nieuw Wachtwoord
-No=Nee
-NoButton=&Nee
-NumberOfRows=Rijtelling
-NumberTooLargeMessageXY=De waarde is te groot; moet tussen (0) en (1) zijn.
-NumberTooSmallMessageXY=De waarde is te klein; moet tussen (0) en (1) zijn.
-OSUser=Systeemgebruiker
-OSVersion=Systeemversie
-Ok=Ok
-OkButton=&Ok
-OkButtonTooltip=Opslaan en venster sluiten
-OldPassword=Oud wachtwoord
-OneRow=1 object
-OneSelected=1 geselecteerd
-Op=Operator
-Open=Open
-OriginalErrorMessageIs=Het origineel bericht is\: {0}
-OutlineSelectorAddOrRemoveButtons=Voeg toe of verwijder &buttons
-OutlineSelectorShowFewerButtons=Toon &minder knoppen
-OutlineSelectorShowMoreButtons=Toon &meer knoppen
-Password=Wachtwoord
-PasswordHasExpiredHeader=Uw wachtwoord is vervallen ne moet nu gewijzigd worden.
-PasswordHasExpiredTitle=Wachtwoord vervallen
-PasswordWillExpireHeaderX=Uw wachtwoord vervalt {0}.
-PasswordWillExpireInfo=Wilt u het nu wijzigen?
-PasswordWillExpireTitle=Wachtwoord zal vervallen
-PasswordsDoNotMatch=De twee wachtwoorden komen niet overeen.
-Paste=Plakken
-Path=Pad
-RenameBookmarkFolderMenu=Hernoem Map...
-RepeatPassword=Herhaal
-ResetButton=&Herstel
-ResetButtonTooltip=Stel alle dialoogvelden op lege waarden in.
-SC_Copyright=De Sentry spellingcontrole en woordenboeken zijn auteursrechtelijk beschermd door Wintertree Software, Inc.
-SC_DialogTitle=Spellingcontrole
-SC_DialogTitle_Options=Spellingcontrole\: Opties
-SC_Help_AddToDictionary=Voegt het verkeerd gespelde woord aan het woordenboek toe
-SC_Help_Cancel=Sluit het dialoogvenster en verwijder alle wijzigingen (Snelkoppeling\: ESC)
-SC_Help_Change=Wijzigt het verkeerd gespelde woord
-SC_Help_ChangeAll=Wijzigt alle versies van het fout gespelde woord (in de huidige tekst-item)
-SC_Help_Enable=Als aangevinkt, dan is de spellingcontrole ingeschakeld
-SC_Help_Ignore=Negeer het verkeerd gespelde woord
-SC_Help_IgnoreAll=Negeer deze en alle verdere versies van het woord
-SC_Help_IgnoreCase=Als aangevinkt, dan wordt de zaak genegeerd, bijvoorbeeld 'Hello' zou worden aanvaard
-SC_Help_IgnoreDomainNames=Als aangevinkt, dan worden domeinnamen genegeerd, bijvoorbeeld 'www.bsiag.com' zou worden aanvaard
-SC_Help_IgnoreWordsWithNumbers=Als aangevinkt, dan worden woorden met getallen genegeerd, bijvoorbeeld 'Super7' zou worden aanvaard
-SC_Help_Language=De geselecteerde taal
-SC_Help_Options=Hiermee opent u het dialoogvenster opties
-SC_Help_RemoveWord=Verwijder het geselecteerde woord uit het woordenboek
-SC_Help_ReplacementWord=Het woord om het verkeerd gespelde woord te vervangen met (druk op ENTER om het verkeerd gespelde woord te vervangen door deze)
-SC_Help_Shortcut=De snelkoppeling om het dialoogvenster Spelling op te roepen. Vast, kan niet worden gewijzigd.
-SC_Help_SuggestionList=Voorgestelde vervanging voor het verkeerd gespelde woord (dubbel-klik om het verkeerd gespelde woord te vervangen met de geselecteerde)
-SC_Help_Undo=Maakt de laatste wijziging ongedaan
-SC_Help_UseDefaults=Gebruik standaard instellingen
-SC_Help_UserDictionary=Kies een .tlx (Scout) of.dic (Microsoft Word) woordenboek als gebruikers woordenboek
-SC_Label_AddToDictionary=Toevoegen aan woordenboek
-SC_Label_Cancel=Annuleer
-SC_Label_Capitalization=Hoofdletter gebruik
-SC_Label_Change=Wijzigen
-SC_Label_ChangeAll=Alles veranderen
-SC_Label_ChangeTo=Wijzigen in
-SC_Label_ConsiderChanging=Overweeg wijziging
-SC_Label_ContainsDigits=Bevat cijfers
-SC_Label_DoubledWord=Dubbel woord
-SC_Label_Enable=Spellingcontrole inschakelen
-SC_Label_Ignore=Negeren
-SC_Label_IgnoreAll=Alles negeren
-SC_Label_IgnoreCase=Negeer zaak
-SC_Label_IgnoreDomainNames=Negeer Domein Namen
-SC_Label_IgnoreWordsWithNumbers=Woorden met getallen negeren
-SC_Label_IgnoredWord=Genegeerd Word
-SC_Label_Main=Algemene instellingen
-SC_Label_MixedCase=Gemengde zaak
-SC_Label_NoSuggestions=&Ja
-SC_Label_NotInDictionary=Het geselecteerde woord werd niet herkend
-SC_Label_Options=Opties ...
-SC_Label_RemoveWord=Verwijder woord
-SC_Label_Shortcut=Afkorting
-SC_Label_Spelling=Spelling
-SC_Label_Undo=Ongedaan maken
-SC_Label_UseDefaults=Gebruik Standaard
-SC_Label_UserDictionary=Gebruik woordenboek
-SC_Language=Taal
-SC_Message_CheckRest=Wilt u de rest van de tekst controleren?
-SC_Message_Complete=De spellingcontrole is klaar
-SC_Message_CompleteForSelection=De spellingcontrole is voltooid voor de huidig selectie
-SC_Message_NotAvailable=De Spellingcontrole is niet beschikbaar
-Save=Opslaan
-SaveButton=&Opslaan
-SaveButtonTooltip=Sla venster op zonder te sluiten.
-SavePassword=Bewaar Gebruikersnaam/wachtwoord
-ScoutStarting=Scout start
-SearchButton=&Zoeken
-SearchButtonTooltip=Sluit venster en start zoeken
-SearchConstraints=Zoeken selectievoorwaarde
-SearchTextIsTooGeneral=Gelieve de zoektekst te verfijnen
-SelectedStates=Enkel Geverifieerd
-Server=Server
-SmartFieldCannotComplete=Geen suggesties voor "{0}"
-SmartFieldMoreThanXRows=Meer dan {0} rijen. Enkel {1} zichtbaar.
-SmartFindLabel=Zoek tekst
-StatusExportDone=Uitvoer compleet
-Today=vandaag
-Tomorrow=morgen
-TooManyRows=Grote gegevensverzameling. Verklein a.u.b. d.m.v. het zoekscherm
-Update=Update
-UserCancelledOperation=De operatie werd handmatig geannuleerd
-UserInterrupted=Geannuleerd door gebruiker.
-Username=Gebruikersnaam
-Value=Waarde
-VersionMismatchAction=Wilt u de applicatie herstarten met automatische update?
-VersionMismatchTextXY=Een applicatie-update is nodig om verder te kunnen werken. De huige versie is {0}, the nieuwe versie is {1}.
-VersionMismatchTitle=Update vereist
-VetoErrorText=Ten minste 1 zoekveld moet ingevuld zijn.
-Week=Week
-WeekShort=CW
-WizardBackButton=&Terug
-WizardBackButtonTooltip=Terug naar de vorige stap
-WizardCancelButton=Annuleer
-WizardCancelButtonTooltip=Stopt de wizard en verwijderd alle data.
-WizardFinishButton=&Einde
-WizardFinishButtonTooltip=Be\u00EBindig dit proces en keer terug naar proceskeuze.
-WizardNextButton=&Volgende
-WizardNextButtonTooltip=Ga door naar de volgende stap
-WizardSuspendButton=&Sluit
-WizardSuspendButtonTooltip=Sluit dit proces en sluit de wizard (kan op later tijdstip hervat worden).
-WorkWeek=Werkweek
-XMustBeGreaterThanOrEqualY={0}' moet groter dan of gelijk zijn aan '{1}'
-XMustBeLessThanOrEqualY={0}' moet kleiner dan of gelijk zijn aan '{1}'
-XRows={0} objecten
-XSelected={0} geselecteerd
-Yes=Ja
-YesButton=&Ja
-and=en
-from=van
-searchingProposals=Doorzoeken voorstellen...
-to=Naar
+ActivateBookmarkMenu=Open favoriet
+ActiveAndInactiveStates=Actief+Inactief
+ActiveStates=Actief
+AllStates=Alles
+Apply=Toepassen
+ApplyBookmarkToSearchFailedMessage=Deze favoriet kan niet toegepast worden op de huidige zoekopdracht.
+Attribute=Bijdragen
+Bookmark=Favoriet
+BookmarkFolder=Map
+Bookmarks=Favorieten
+BookmarksAddMenu=&Voeg aan favorieten toe
+BookmarksApplyToCurrentSearch=Zoekopdracht uitvoeren met gebruik van deze favoriet
+BookmarksMainMenu=&Favorieten
+BookmarksManageMenu=&Stel favorieten in...
+BookmarksPublishMenu=Publiceer favoriet...
+BookmarksStartPageMenu=& Opstartweergave
+BookmarksStartPageMenuClear=&Geen Opstartweergave
+BookmarksStartPageMenuGoto=&Open Opstartweergave
+BookmarksStartPageMenuSet=&Stel huidige weergave als beginweergave in
+ButtonDeselectAll=Deselecteer alles
+ButtonMoveDown=Naar beneden
+ButtonMoveUp=Naar boven
+ButtonSelectAll=Selecteer alles
+Calendar_earlier=Eerder
+Calendar_later=Later
+Cancel=Annuleren
+CancelButton=&Annuleer
+CancelButtonTooltip=Sluit venster zonder op te slaan, indien noodzakelijk met bevestiging dialoogvenster
+ChangePassword=Wachtwoord wijzigen
+CloseButton=&Sluit
+CloseButtonTooltip=Sluit dialoogvenster zonder op te slaan.
+CodeTypeInit=Code type initialisatie
+Column=Kolom
+Columns=Kolommen gegroepeerd
+ComposerFieldAggregationAvg=Gemiddeld({0})
+ComposerFieldAggregationCount=Tel({0})
+ComposerFieldAggregationLabel=Functie
+ComposerFieldAggregationMax=Maximum({0})
+ComposerFieldAggregationMedian=Mediaan({0})
+ComposerFieldAggregationMin=Minimum({0})
+ComposerFieldAggregationSum=Som({0})
+Condensed=6 kolommen
+Copy=Copi\u00EBer
+Cut=Eindigen
+Day=Dag
+DefaultPasswordPolicyText=Het paswoord komt niet overeen met de opgegeven waarden\n\nWaarden\:\n- tenminste 8 tekens\n- tenminste een cijfer (0-9)\n- tenminste een niet standaard teken (\!|@|\#|$|%|^|&|*|(|)|_|+|||~|-|
+DeleteBookmarkMenu=Verwijder favoriet
+DeleteConfirmationText=Wilt u volgende data verwijderen?
+DeleteConfirmationTextNoItemList=Wilt u deze data verwijderen?
+DeleteConfirmationTextNoItemListX=Wilt u deze verwijderen {0}?
+DeleteConfirmationTextX=Wilt u het volgende verwijderen\: {0}?
+DeleteConfirmationTitle=Bevesting verwijdering
+DeleteFolderMenu=Verwijder map
+DetailedVersion=Gedetailleerde Versie
+EditBookmarkMenu=Bewerk favoriet...
+EmailCc=Cc
+EmailFrom=Van
+EmailSubject=Onderwerp
+EmailTo=tot
+Error=Fout
+ErrorAndRetryTextDefault=Een fout is opgetreden tijdens gegevensoverbrenging
+ErrorTextLogin=Ongeldige gebruikersnaam / wachtwoord
+ErrorTitleLogin=Login mislukt
+ExcelChart_Button_LoadDefaults=Begininstellingen
+ExcelChart_Button_LoadDefaultsHint=Stelt dit venster opnieuw in door de beginwaarden te laden
+ExcelChart_Button_LoadProfile=Laadt profiel...
+ExcelChart_Button_LoadProfileHint=Laadt instellingen van xml bestand
+ExcelChart_Button_SaveProfile=Bewaar profiel...
+ExcelChart_Button_SaveProfileHint=Bewaart de huidige instellingen in een XML bestand.
+ExcelChart_Error_CreatingChartFailed=Grafiek aanmaken mislukt.
+ExcelChart_Error_ExportingFailed=Export mislukt vanwege
+ExcelChart_Error_InitializationFailed=Initialisatie van de aanvullende klasse(n) mislukt.
+ExcelChart_Error_LoadingProfileFailed=Laadprofiel mislukt vanwege
+ExcelChart_Error_LoadingTemplateFailed=Laden sjabloon mislukt.
+ExcelChart_Error_RetrivingOutlineDataFailed=Terugkrijgen outlinegegevens mislukt.
+ExcelChart_Error_SavingProfileFailed=Opslaan profiel mislukt vanwege
+ExcelChart_Error_WrongProfile=Het profiel werd aangemaakt voor een andere outline.
+ExcelChart_Label_AutomaticMode=Automatische modus
+ExcelChart_Label_AutomaticModeHint=Verberg Excel en sla automatisch op
+ExcelChart_Label_ChartNumber=Grafieknummer
+ExcelChart_Label_ChartType=Grafiektype
+ExcelChart_Label_FileName=Bestandsnaam
+ExcelChart_Label_FirstRow=Eerste rij
+ExcelChart_Label_Height=Hoogte
+ExcelChart_Label_HistogramMode=Histogram modus
+ExcelChart_Label_HistogramModeHint=De histogram modus combineert gelijke waarden op de X-as naar een waarde.
+ExcelChart_Label_LastRow=Laatste rij
+ExcelChart_Label_Offset=Functie
+ExcelChart_Label_SkipNullValues=Sla nul waarden over in de histogram modus
+ExcelChart_Label_SkipNullValuesHint=Indien gecontroleerde nul waarden op de X-as worden genegeerd, indien anders worden deze gecombineerd naar <Onbekend>.
+ExcelChart_Label_TemplateName=Sjabloon
+ExcelChart_Label_UseCustomFormat=Gebruik standaardformaat
+ExcelChart_Label_UseCustomFormatHint=Indien gecontroleerd kunt u de positie van de grafiek en grootte aangeven.
+ExcelChart_Label_UseExistingChart=Gebruik bestaande grafiek
+ExcelChart_Label_UseExistingChartHint=Indien gecontroleerd wordt de aangegeven grafiek in het bepaalde sjabloon gebruikt.
+ExcelChart_Label_UseSelectiveExport=Gebruik selectieve export
+ExcelChart_Label_UseSelectiveExportHint=Indien gecontroleerd worden alleen de aangegeven rijen hieronder ge\u00EBxporteerd.
+ExcelChart_Label_Width=Breedte
+ExcelChart_Label_WorksheetName=Werkblad
+ExcelChart_Label_XAxis=X-As
+ExcelChart_Label_YAxes=Y-As
+ExcelChart_Status_Done=Excel Grafiek Export gereed.
+ExcelChart_Tab_Advanced=Geavanceerd
+ExcelChart_Tab_Basic=Standaard
+ExcelChart_Title_MainForm=Excel Grafiek Export
+ExcelChart_Type_Area3D=Gebied 3D
+ExcelChart_Type_Area=Gebied
+ExcelChart_Type_AreaStacked3D=Gebied gestapeld 3D
+ExcelChart_Type_AreaStacked=Gebied gestapeld
+ExcelChart_Type_BarsClustered3D=Staafdiagram gegroepeerd 3D
+ExcelChart_Type_BarsClustered=Staafdiagram gegroepeerd
+ExcelChart_Type_BarsStacked3D=Staafdiagram gestapeld 3D
+ExcelChart_Type_BarsStacked=Staafdiagram
+ExcelChart_Type_ColumnsClustered3D=Kolommen gegroepeerd 3D
+ExcelChart_Type_ColumnsClustered=Kolommen
+ExcelChart_Type_ColumnsStacked3D=Kolommen gestapeld 3D
+ExcelChart_Type_ColumnsStacked=Kolommen gestapeld
+ExcelChart_Type_Line=Lijn
+ExcelChart_Type_LineStacked=Gestapelde lijn
+ExcelChart_Type_Pie3D=Taart 3D
+ExcelChart_Type_Pie=Taart
+ExcelChart_Type_PieExploded3D=Taart Gesegmenteerd 3D
+ExcelChart_Type_PieExploded=Taart gesegmenteerd
+ExcelChart_Various_Averaged=Gemiddeld
+ExcelChart_Various_Column=Kolom
+ExcelChart_Various_Frequency=Frequentie
+ExcelChart_Various_SummedUp=Opgeteld
+ExcelChart_Various_Unknown=<Onbekend>
+ExecutionTime=Server processing
+ExportDate=Exporteer tijdstip
+ExtendedSearchAddAdditionalOrMenu=Voeg extra in of vervang
+ExtendedSearchAddAttribute=Belemmering
+ExtendedSearchAddAttributeMenu=Voeg selectievoorwaarde toe...
+ExtendedSearchAddEitherOrMenu=Voeg toe ... of
+ExtendedSearchAddEntityPrefix=heeft
+ExtendedSearchAnd=en
+ExtendedSearchEditAttributeMenu=Bewerk...
+ExtendedSearchEither=hetzij
+ExtendedSearchEntitySuffix=met
+ExtendedSearchNegateMenu=Doe teniet...
+ExtendedSearchNot=niet
+ExtendedSearchOr=of
+ExtendedSearchRemoveAttributeMenu=Verwijder
+ExtendedSearchRemoveMenu=Verwijder
+FileExistsOwerwriteQuestion=Het geselecteerde bestand bestaat al. Dit bestand overschrijven?
+FileName=Bestandnaam
+FileNotFoundMessage=Kan het bestand niet vinden\:
+FileNotFoundTitle=Bestand niet gevonden
+FilesOfType=Bestandstype
+FilterBookmarkTree=Bladeren favorieten
+Folders=Mappen
+FormButtonClicked=Terwijl u op een knop klikt
+FormCloseTimerActivated=Sluitingstimer geactiveerd
+FormClosing=Sluiten
+FormEmptyMandatoryFieldsMessage=Volgende velden zijn verplicht
+FormExportXml=Exporteer naar XML
+FormFinally=Finaliseer
+FormFireActivated=Wanneer het formulier werd geactiveerd
+FormFireClosed=Wanneer het formulier gesloten werd
+FormFireDiscarded=Als formulier werd verwijderd
+FormFireStructureChanged=Bij de wijziging van de formulierstrustuur
+FormFireToBack=Bij sturen van het formulier naar achter
+FormFireToFront=Bij sturen van het formulier naar voor
+FormIncompleteIntro=Niet alle verplichte velden zijn ingevuld.
+FormInvalidFieldsMessage=Volgende velden zijn ongeldig
+FormPrint=Print
+FormReset=Reset
+FormSaveChangesQuestion=Wilt u de wijzigingen opslaan?
+FormStateLoad=Laden..
+FormStateStore=Bewaar
+FormStateStoreAs=Opslaan als...
+FormTimerActivated=Timer geactiveerd
+FormattingLocale=Opmaak
+GlobalBookmarks=Globale Favorieten
+GlobalBookmarksAddMenu=Voeg toe &globale favorieten
+Help=Help
+Hour=Uur
+IOErrorInfo=Controleer bestanden en verbinding a.u.b.
+IOErrorText=Communicatiefout
+IOErrorTitle=Lees / schrijffout
+InDaysX=in {0} dagen
+InactiveState=Inactief
+InactiveStates=Inactief
+Info=Informatie
+Interrupted=Onderbroken
+InterruptedErrorText=Het proces is handmatig geannuleerd
+InterruptedErrorTitle=Proces geannuleerd
+InvalidNumberMessageX="{0}" is een ongeldig nummer
+InvalidPhoneNumberMessageX="{0}" is een ongeldig telefoonnummer
+InvalidValueMessageX="{0}" is een ongeldige waarde
+JavaVMVersion=Java VM
+JavaVersion=Java Runtime
+KeyStroke=Toetsaanslag
+Language=Taal
+LoadFormXmlFailedText=Dit bestand is niet compatibel met dit venster.
+LogicBetween=is tussen {0} en {1}
+LogicBetweenShort=Tussen
+LogicDateIsInDays=is in precies n (dagen)
+LogicDateIsInGEDays=Datum >\= vandaag + n dagen
+LogicDateIsInGEMonths=Datum >\= vandaag + n maanden
+LogicDateIsInLEDays=Datum <\=vandaag + n dagen
+LogicDateIsInLEMonths=Datum <\=vandaag + n maanden
+LogicDateIsInLastDays=was in de laatste n dagen
+LogicDateIsInLastMonths=was in de laatste n maanden
+LogicDateIsInMonths=is in precies (maanden)
+LogicDateIsInNextDays=zou binnen n dagen zijn
+LogicDateIsInNextMonths=zou binnen n maanden zijn
+LogicDateIsNotToday=is niet vandaag
+LogicDateIsToday=is vandaag
+LogicDateTimeIsInGEHours=Datum >\= nu + n uur
+LogicDateTimeIsInGEMinutes=Datum >\= nu + n minuten
+LogicDateTimeIsInLEHours=Datum <\= nu + n uur
+LogicDateTimeIsInLEMinutes=Datum <\= nu + n minuten
+LogicDateTimeIsNotNow=is niet nu
+LogicDateTimeIsNow=is nu
+LogicEQ=\=
+LogicEndsWith=Eindigt met
+LogicGE=>\=
+LogicGT=>
+LogicIn=is
+LogicLE=<\=
+LogicLT=<
+LogicLike=bevat
+LogicNEQ=<>
+LogicNotEndsWith=eindigd niet met
+LogicNotIn=is niet
+LogicNotLike=niet bevattend
+LogicNotNull=is niet leeg
+LogicNotStartsWith=begint niet met
+LogicNull=is leeg
+LogicStartsWith=begint met
+LogicTimeIsInGEHours=is ten vroegste binnen (uren)
+LogicTimeIsInGEMinutes=is ten vroegste binnen (minuten)
+LogicTimeIsInHours=is in precies (uren)
+LogicTimeIsInLEHours=is ten laatste binnen (uren)
+LogicTimeIsInLEMinutes=is ten laatste binnen (minuten)
+LogicTimeIsInMinutes=is in precies (minuten)
+LogicTimeIsNotNow=is niet nu
+LogicTimeIsNow=is nu
+Login=Login
+LookIn=Kijk in
+MemoryStatus=Geheugen
+Minute=Minuut
+Month=Maand
+Name=Naam
+NetErrorInfo=Controleer servernaam, URL en verbinding a.u.b.
+NetErrorText=Server niet gevonden
+NetErrorTitle=Netwerkfout
+NetworkLatency=Netwerk vertraging
+NewBookmarkFolderMenu=Niewe map...
+NewPassword=Nieuw Wachtwoord
+No=Nee
+NoButton=&Nee
+NumberOfRows=Rijtelling
+NumberTooLargeMessageXY=De waarde is te groot; moet tussen (0) en (1) zijn.
+NumberTooSmallMessageXY=De waarde is te klein; moet tussen (0) en (1) zijn.
+OSUser=Systeemgebruiker
+OSVersion=Systeemversie
+Ok=Ok
+OkButton=&Ok
+OkButtonTooltip=Opslaan en venster sluiten
+OldPassword=Oud wachtwoord
+OneRow=1 object
+OneSelected=1 geselecteerd
+Op=Operator
+Open=Open
+OriginalErrorMessageIs=Het origineel bericht is\: {0}
+OutlineSelectorAddOrRemoveButtons=Voeg toe of verwijder &buttons
+OutlineSelectorShowFewerButtons=Toon &minder knoppen
+OutlineSelectorShowMoreButtons=Toon &meer knoppen
+Password=Wachtwoord
+PasswordHasExpiredHeader=Uw wachtwoord is vervallen ne moet nu gewijzigd worden.
+PasswordHasExpiredTitle=Wachtwoord vervallen
+PasswordWillExpireHeaderX=Uw wachtwoord vervalt {0}.
+PasswordWillExpireInfo=Wilt u het nu wijzigen?
+PasswordWillExpireTitle=Wachtwoord zal vervallen
+PasswordsDoNotMatch=De twee wachtwoorden komen niet overeen.
+Paste=Plakken
+Path=Pad
+RenameBookmarkFolderMenu=Hernoem Map...
+RepeatPassword=Herhaal
+ResetButton=&Herstel
+ResetButtonTooltip=Stel alle dialoogvelden op lege waarden in.
+SC_Copyright=De Sentry spellingcontrole en woordenboeken zijn auteursrechtelijk beschermd door Wintertree Software, Inc.
+SC_DialogTitle=Spellingcontrole
+SC_DialogTitle_Options=Spellingcontrole\: Opties
+SC_Help_AddToDictionary=Voegt het verkeerd gespelde woord aan het woordenboek toe
+SC_Help_Cancel=Sluit het dialoogvenster en verwijder alle wijzigingen (Snelkoppeling\: ESC)
+SC_Help_Change=Wijzigt het verkeerd gespelde woord
+SC_Help_ChangeAll=Wijzigt alle versies van het fout gespelde woord (in de huidige tekst-item)
+SC_Help_Enable=Als aangevinkt, dan is de spellingcontrole ingeschakeld
+SC_Help_Ignore=Negeer het verkeerd gespelde woord
+SC_Help_IgnoreAll=Negeer deze en alle verdere versies van het woord
+SC_Help_IgnoreCase=Als aangevinkt, dan wordt de zaak genegeerd, bijvoorbeeld 'Hello' zou worden aanvaard
+SC_Help_IgnoreDomainNames=Als aangevinkt, dan worden domeinnamen genegeerd, bijvoorbeeld 'www.bsiag.com' zou worden aanvaard
+SC_Help_IgnoreWordsWithNumbers=Als aangevinkt, dan worden woorden met getallen genegeerd, bijvoorbeeld 'Super7' zou worden aanvaard
+SC_Help_Language=De geselecteerde taal
+SC_Help_Options=Hiermee opent u het dialoogvenster opties
+SC_Help_RemoveWord=Verwijder het geselecteerde woord uit het woordenboek
+SC_Help_ReplacementWord=Het woord om het verkeerd gespelde woord te vervangen met (druk op ENTER om het verkeerd gespelde woord te vervangen door deze)
+SC_Help_Shortcut=De snelkoppeling om het dialoogvenster Spelling op te roepen. Vast, kan niet worden gewijzigd.
+SC_Help_SuggestionList=Voorgestelde vervanging voor het verkeerd gespelde woord (dubbel-klik om het verkeerd gespelde woord te vervangen met de geselecteerde)
+SC_Help_Undo=Maakt de laatste wijziging ongedaan
+SC_Help_UseDefaults=Gebruik standaard instellingen
+SC_Help_UserDictionary=Kies een .tlx (Scout) of.dic (Microsoft Word) woordenboek als gebruikers woordenboek
+SC_Label_AddToDictionary=Toevoegen aan woordenboek
+SC_Label_Cancel=Annuleer
+SC_Label_Capitalization=Hoofdletter gebruik
+SC_Label_Change=Wijzigen
+SC_Label_ChangeAll=Alles veranderen
+SC_Label_ChangeTo=Wijzigen in
+SC_Label_ConsiderChanging=Overweeg wijziging
+SC_Label_ContainsDigits=Bevat cijfers
+SC_Label_DoubledWord=Dubbel woord
+SC_Label_Enable=Spellingcontrole inschakelen
+SC_Label_Ignore=Negeren
+SC_Label_IgnoreAll=Alles negeren
+SC_Label_IgnoreCase=Negeer zaak
+SC_Label_IgnoreDomainNames=Negeer Domein Namen
+SC_Label_IgnoreWordsWithNumbers=Woorden met getallen negeren
+SC_Label_IgnoredWord=Genegeerd Word
+SC_Label_Main=Algemene instellingen
+SC_Label_MixedCase=Gemengde zaak
+SC_Label_NoSuggestions=&Ja
+SC_Label_NotInDictionary=Het geselecteerde woord werd niet herkend
+SC_Label_Options=Opties ...
+SC_Label_RemoveWord=Verwijder woord
+SC_Label_Shortcut=Afkorting
+SC_Label_Spelling=Spelling
+SC_Label_Undo=Ongedaan maken
+SC_Label_UseDefaults=Gebruik Standaard
+SC_Label_UserDictionary=Gebruik woordenboek
+SC_Language=Taal
+SC_Message_CheckRest=Wilt u de rest van de tekst controleren?
+SC_Message_Complete=De spellingcontrole is klaar
+SC_Message_CompleteForSelection=De spellingcontrole is voltooid voor de huidig selectie
+SC_Message_NotAvailable=De Spellingcontrole is niet beschikbaar
+Save=Opslaan
+SaveButton=&Opslaan
+SaveButtonTooltip=Sla venster op zonder te sluiten.
+SavePassword=Bewaar Gebruikersnaam/wachtwoord
+ScoutStarting=Scout start
+SearchButton=&Zoeken
+SearchButtonTooltip=Sluit venster en start zoeken
+SearchConstraints=Zoeken selectievoorwaarde
+SearchTextIsTooGeneral=Gelieve de zoektekst te verfijnen
+SelectedStates=Enkel Geverifieerd
+Server=Server
+SmartFieldCannotComplete=Geen suggesties voor "{0}"
+SmartFieldMoreThanXRows=Meer dan {0} rijen. Enkel {1} zichtbaar.
+SmartFindLabel=Zoek tekst
+StatusExportDone=Uitvoer compleet
+Today=vandaag
+Tomorrow=morgen
+TooManyRows=Grote gegevensverzameling. Verklein a.u.b. d.m.v. het zoekscherm
+Update=Update
+UserCancelledOperation=De operatie werd handmatig geannuleerd
+UserInterrupted=Geannuleerd door gebruiker.
+Username=Gebruikersnaam
+Value=Waarde
+VersionMismatchAction=Wilt u de applicatie herstarten met automatische update?
+VersionMismatchTextXY=Een applicatie-update is nodig om verder te kunnen werken. De huige versie is {0}, the nieuwe versie is {1}.
+VersionMismatchTitle=Update vereist
+VetoErrorText=Ten minste 1 zoekveld moet ingevuld zijn.
+Week=Week
+WeekShort=CW
+WizardBackButton=&Terug
+WizardBackButtonTooltip=Terug naar de vorige stap
+WizardCancelButton=Annuleer
+WizardCancelButtonTooltip=Stopt de wizard en verwijderd alle data.
+WizardFinishButton=&Einde
+WizardFinishButtonTooltip=Be\u00EBindig dit proces en keer terug naar proceskeuze.
+WizardNextButton=&Volgende
+WizardNextButtonTooltip=Ga door naar de volgende stap
+WizardSuspendButton=&Sluit
+WizardSuspendButtonTooltip=Sluit dit proces en sluit de wizard (kan op later tijdstip hervat worden).
+WorkWeek=Werkweek
+XMustBeGreaterThanOrEqualY={0}' moet groter dan of gelijk zijn aan '{1}'
+XMustBeLessThanOrEqualY={0}' moet kleiner dan of gelijk zijn aan '{1}'
+XRows={0} objecten
+XSelected={0} geselecteerd
+Yes=Ja
+YesButton=&Ja
+and=en
+from=van
+searchingProposals=Doorzoeken voorstellen...
+to=Naar
diff --git a/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_nl_BE.properties b/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_nl_BE.properties
index b8fae6cf56..bf526a338c 100644
--- a/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_nl_BE.properties
+++ b/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_nl_BE.properties
@@ -1,386 +1,386 @@
-ActivateBookmarkMenu=Open favoriet
-ActiveAndInactiveStates=Actief+Inactief
-ActiveStates=Actief
-AllStates=Allen
-Apply=Toepassen
-ApplyBookmarkToSearchFailedMessage=Deze favoriet kan niet toegepast worden op de huidige zoekopdracht.
-Attribute=Bijdragen
-Bookmark=Favoriet
-BookmarkFolder=Map
-Bookmarks=Favorieten
-BookmarksAddMenu=&Voeg aan favorieten toe
-BookmarksApplyToCurrentSearch=Zoekopdracht uitvoeren met gebruik van deze favoriet
-BookmarksMainMenu=&Favorieten
-BookmarksManageMenu=&Stel favorieten in...
-BookmarksPublishMenu=Publiceer favoriet...
-BookmarksStartPageMenu=& Opstartweergave
-BookmarksStartPageMenuClear=&Geen Opstartweergave
-BookmarksStartPageMenuGoto=&Open Opstartweergave
-BookmarksStartPageMenuSet=&Stel huidige weergave als beginweergave in
-ButtonDeselectAll=Deselecteer alles
-ButtonMoveDown=Naar beneden
-ButtonMoveUp=Naar boven
-ButtonSelectAll=Selecteer alles
-Calendar_earlier=Eerder
-Calendar_later=Later
-Cancel=Annuleer
-CancelButton=&Annuleer
-CancelButtonTooltip=Sluit venster zonder op te slaan, indien noodzakelijk met bevestiging dialoogvenster
-ChangePassword=Wachtwoord wijzigen
-CloseButton=&Sluit
-CloseButtonTooltip=Sluit dialoogvenster zonder op te slaan.
-CodeTypeInit=Code type initialisatie
-Column=Kolom
-Columns=Kolommen
-ComposerFieldAggregationAvg=Gemiddeld({0})
-ComposerFieldAggregationCount=Tel({0})
-ComposerFieldAggregationLabel=Functie
-ComposerFieldAggregationMax=Maximum({0})
-ComposerFieldAggregationMedian=Mediaan({0})
-ComposerFieldAggregationMin=Minimum({0})
-ComposerFieldAggregationSum=Som({0})
-Condensed=6 kolommen
-Copy=Copi\u00EBer
-Cut=Eindigen
-Day=Dag
-DefaultPasswordPolicyText=Het paswoord komt niet overeen met de opgegeven waarden\n\nWaarden\:\n- tenminste 8 tekens\n- tenminste een cijfer (0-9)\n- tenminste \u00E9\u00E9n niet standaard teken (\!|@|\#|$|%|^|&|*|(|)|_|+|||~|-|
-DeleteBookmarkMenu=Verwijder favoriet
-DeleteConfirmationText=Wilt u volgende data verwijderen?
-DeleteConfirmationTextNoItemList=Wilt u deze data verwijderen?
-DeleteConfirmationTextNoItemListX=Wilt u deze verwijderen {0}?
-DeleteConfirmationTextX=Wilt u het volgende verwijderen\: {0}?
-DeleteConfirmationTitle=Bevesting verwijdering
-DeleteFolderMenu=Verwijder map
-DetailedVersion=Gedetailleerde Versie
-EditBookmarkMenu=Bewerk favoriet...
-EmailCc=CC
-EmailFrom=Van
-EmailSubject=Onderwerp
-EmailTo=Naar
-Error=Fout
-ErrorAndRetryTextDefault=Een fout is opgetreden tijdens gegevensoverbrenging
-ErrorTextLogin=Ongeldige gebruikersnaam/wachtwoord
-ErrorTitleLogin=Login mislukt
-ExcelChart_Button_LoadDefaults=Begininstellingen
-ExcelChart_Button_LoadDefaultsHint=Stelt dit venster opnieuw in door de beginwaarden te laden
-ExcelChart_Button_LoadProfile=Laadt profiel...
-ExcelChart_Button_LoadProfileHint=Laadt instellingen van xml bestand
-ExcelChart_Button_SaveProfile=Bewaar profiel...
-ExcelChart_Button_SaveProfileHint=Bewaart de huidige instellingen in een XML bestand.
-ExcelChart_Error_CreatingChartFailed=Grafiek aanmaken mislukt.
-ExcelChart_Error_ExportingFailed=Export mislukt vanwege
-ExcelChart_Error_InitializationFailed=Initialisatie van de aanvullende klasse(n) mislukt.
-ExcelChart_Error_LoadingTemplateFailed=Laden sjabloon mislukt.
-ExcelChart_Error_RetrivingOutlineDataFailed=Terugkrijgen outlinegegevens mislukt.
-ExcelChart_Error_SavingProfileFailed=Opslaan profiel mislukt vanwege
-ExcelChart_Error_WrongProfile=Het profiel werd aangemaakt voor een andere outline.
-ExcelChart_Label_AutomaticMode=Automatische modus
-ExcelChart_Label_AutomaticModeHint=Verberg Excel en sla automatisch op
-ExcelChart_Label_ChartNumber=Grafieknummer
-ExcelChart_Label_ChartType=Grafiektype
-ExcelChart_Label_FileName=Bestandnaam
-ExcelChart_Label_FirstRow=Eerste rij
-ExcelChart_Label_Height=Hoogte
-ExcelChart_Label_HistogramMode=Histogram modus
-ExcelChart_Label_HistogramModeHint=De histogram modus combineert gelijke waarden op de X-as naar een waarde.
-ExcelChart_Label_LastRow=Laatste rij
-ExcelChart_Label_Offset=Positie
-ExcelChart_Label_SkipNullValues=Sla nul waarden over in de histogram modus
-ExcelChart_Label_SkipNullValuesHint=Indien gecontroleerde nul waarden op de X-as worden genegeerd, indien anders worden deze gecombineerd naar <Onbekend>.
-ExcelChart_Label_TemplateName=Sjabloon
-ExcelChart_Label_UseCustomFormat=Gebruik standaardformaat
-ExcelChart_Label_UseCustomFormatHint=Indien gecontroleerd kunt u de positie van de grafiek en grootte aangeven.
-ExcelChart_Label_UseExistingChart=Gebruik bestaande grafiek
-ExcelChart_Label_UseExistingChartHint=Indien gecontroleerd wordt de aangegeven grafiek in het bepaalde sjabloon gebruikt.
-ExcelChart_Label_UseSelectiveExport=Gebruik selectieve export
-ExcelChart_Label_UseSelectiveExportHint=Indien gecontroleerd worden alleen de aangegeven rijen hieronder ge\u00EBxporteerd.
-ExcelChart_Label_Width=Breedte
-ExcelChart_Label_WorksheetName=Werkblad
-ExcelChart_Label_XAxis=X-As
-ExcelChart_Label_YAxes=Y-As
-ExcelChart_Status_Done=Excel Grafiek Export gereed.
-ExcelChart_Tab_Advanced=Geavanceerd
-ExcelChart_Tab_Basic=Standaard
-ExcelChart_Title_MainForm=Excel Grafiek Export
-ExcelChart_Type_Area3D=Gebied 3D
-ExcelChart_Type_Area=Gebied
-ExcelChart_Type_AreaStacked3D=Gebied gestapeld 3D
-ExcelChart_Type_AreaStacked=Gebied gestapeld
-ExcelChart_Type_BarsClustered3D=Staafdiagram gegroepeerd 3D
-ExcelChart_Type_BarsClustered=Staafdiagram gegroepeerd
-ExcelChart_Type_BarsStacked3D=Staafdiagram gestapeld 3D
-ExcelChart_Type_BarsStacked=Staafdiagram
-ExcelChart_Type_ColumnsClustered3D=Kolommen gegroepeerd 3D
-ExcelChart_Type_ColumnsClustered=Kolommen gegroepeerd
-ExcelChart_Type_ColumnsStacked3D=Kolommen gestapeld 3D
-ExcelChart_Type_ColumnsStacked=Kolommen gestapeld
-ExcelChart_Type_Line=Lijn
-ExcelChart_Type_LineStacked=Gestapelde lijn
-ExcelChart_Type_Pie3D=Taart 3D
-ExcelChart_Type_Pie=Taart
-ExcelChart_Type_PieExploded3D=Taart Gesegmenteerd 3D
-ExcelChart_Type_PieExploded=Taart gesegmenteerd
-ExcelChart_Various_Averaged=Gemiddeld
-ExcelChart_Various_Column=Kolom
-ExcelChart_Various_Frequency=Frequentie
-ExcelChart_Various_SummedUp=Opgeteld
-ExcelChart_Various_Unknown=<Onbekend>
-ExecutionTime=Server processing
-ExportDate=Exporteer tijdstip
-ExtendedSearchAddAdditionalOrMenu=Voeg extra in of vervang
-ExtendedSearchAddAttribute=Belemmering
-ExtendedSearchAddAttributeMenu=Voeg selectievoorwaarde toe...
-ExtendedSearchAddEitherOrMenu=Voeg toe ... of
-ExtendedSearchAddEntityPrefix=heeft
-ExtendedSearchAnd=en
-ExtendedSearchEditAttributeMenu=Bewerk...
-ExtendedSearchEither=hetzij
-ExtendedSearchEntitySuffix=met
-ExtendedSearchNegateMenu=Doe teniet...
-ExtendedSearchNot=niet
-ExtendedSearchOr=of
-ExtendedSearchRemoveAttributeMenu=Verwijder...
-ExtendedSearchRemoveMenu=Verwijder
-FileExistsOwerwriteQuestion=Het geselecteerde bestand bestaat al. Dit bestand overschrijven?
-FileName=Bestandsnaam
-FileNotFoundMessage=Kan het bestand niet vinden\:
-FileNotFoundTitle=Bestand niet gevonden
-FilesOfType=Bestandstype
-FilterBookmarkTree=Bladeren favorieten
-Folders=Mappen
-FormButtonClicked=Terwijl u op een knop klikt
-FormCloseTimerActivated=Sluitingstimer geactiveerd
-FormClosing=Sluiten
-FormEmptyMandatoryFieldsMessage=Volgende velden zijn verplicht
-FormExportXml=Exporteer naar XML
-FormFinally=Finaliseer
-FormFireActivated=Wanneer het formulier werd geactiveerd
-FormFireClosed=Wanneer het formulier gesloten werd
-FormFireDiscarded=Als formulier werd verwijderd
-FormFireStructureChanged=Bij de wijziging van de formulierstrustuur
-FormFireToBack=Bij sturen van het formulier naar achter
-FormFireToFront=Bij sturen van het formulier naar voor
-FormIncompleteIntro=Niet alle verplichte velden zijn ingevuld.
-FormInvalidFieldsMessage=Volgende velden zijn ongeldig
-FormPrint=Print
-FormReset=Reset
-FormSaveChangesQuestion=Wilt u de wijzigingen opslaan?
-FormStateLoad=Laden..
-FormStateStore=Opslaan
-FormStateStoreAs=Opslaan als...
-FormTimerActivated=Timer geactiveerd
-FormattingLocale=Opmaak
-GlobalBookmarks=Globale Favorieten
-GlobalBookmarksAddMenu=Voeg toe &globale favorieten
-Help=Help
-Hour=Uur
-IOErrorInfo=Controleer bestanden en verbinding a.u.b.
-IOErrorText=Communicatiefout
-IOErrorTitle=Lees / schrijffout
-InDaysX=in {0} dagen
-InactiveState=Inactief
-InactiveStates=Inactief
-Info=Informatie
-Interrupted=Onderbroken
-InterruptedErrorText=Het proces is handmatig geannuleerd
-InterruptedErrorTitle=Proces geannuleerd
-InvalidNumberMessageX="{0}" is een ongeldig nummer
-InvalidPhoneNumberMessageX="{0}" is een ongeldig telefoonnummer
-InvalidValueMessageX="{0}" is een ongeldige waarde
-JavaVMVersion=Java VM
-JavaVersion=Java Runtime
-KeyStroke=Toetsaanslag
-Language=Taal
-LoadFormXmlFailedText=Dit bestand is niet compatibel met dit venster.
-LogicBetween=is tussen {0} en {1}
-LogicBetweenShort=tussen
-LogicDateIsInDays=is in precies n (dagen)
-LogicDateIsInGEDays=Datum >\= vandaag + n dagen
-LogicDateIsInGEMonths=Datum >\= vandaag + n maanden
-LogicDateIsInLEDays=Datum <\=vandaag + n dagen
-LogicDateIsInLEMonths=Datum <\=vandaag + n maanden
-LogicDateIsInLastDays=was in de laatste n dagen
-LogicDateIsInLastMonths=was in de laatste n maanden
-LogicDateIsInMonths=is in precies (maanden)
-LogicDateIsInNextDays=zou binnen n dagen zijn
-LogicDateIsInNextMonths=zou binnen n maanden zijn
-LogicDateIsNotToday=is niet vandaag
-LogicDateIsToday=is vandaag
-LogicDateTimeIsInGEHours=Datum >\= nu + n uur
-LogicDateTimeIsInGEMinutes=Datum >\= nu + n minuten
-LogicDateTimeIsInLEHours=Datum <\= nu + n uur
-LogicDateTimeIsInLEMinutes=Datum <\= nu + n minuten
-LogicDateTimeIsNotNow=is niet nu
-LogicDateTimeIsNow=is nu
-LogicEQ=\=
-LogicEndsWith=Eindigt met
-LogicGE=>\=
-LogicGT=>
-LogicIn=is
-LogicLE=<\=
-LogicLT=<
-LogicLike=bevat
-LogicNEQ=<>
-LogicNotEndsWith=eindigd niet met
-LogicNotIn=is niet
-LogicNotLike=niet bevattend
-LogicNotNull=is niet leeg
-LogicNotStartsWith=begint niet met
-LogicNull=is leeg
-LogicStartsWith=begint met
-LogicTimeIsInGEHours=is ten vroegste binnen (uren)
-LogicTimeIsInGEMinutes=is ten vroegste binnen (minuten)
-LogicTimeIsInHours=is in precies (uren)
-LogicTimeIsInLEHours=is ten laatste binnen (uren)
-LogicTimeIsInLEMinutes=is ten laatste binnen (minuten)
-LogicTimeIsInMinutes=is in precies (minuten)
-LogicTimeIsNotNow=is niet nu
-LogicTimeIsNow=is nu
-Login=Login
-LookIn=Kijk in
-MemoryStatus=Geheugen
-Minute=Minuut
-Month=Maand
-Name=Naam
-NetErrorInfo=Controleer servernaam, URL en verbinding a.u.b.
-NetErrorText=Server niet gevonden
-NetErrorTitle=Netwerkfout
-NetworkLatency=Netwerk vertraging
-NewBookmarkFolderMenu=Niewe map...
-NewPassword=Nieuw wachtwoord
-No=Nee
-NoButton=&Nee
-NumberOfRows=Rijtelling
-NumberTooLargeMessageXY=De waarde is te groot; moet tussen (0) en (1) zijn.
-NumberTooSmallMessageXY=De waarde is te klein; moet tussen (0) en (1) zijn.
-OSUser=Systeemgebruiker
-OSVersion=Systeemversie
-Ok=Ok
-OkButton=&Ok
-OkButtonTooltip=Opslaan en venster sluiten
-OldPassword=Oud wachtwoord
-OneRow=1 object
-OneSelected=1 geselecteerd
-Op=Operator
-Open=Open
-OriginalErrorMessageIs=Het origineel bericht is\: {0}
-OutlineSelectorAddOrRemoveButtons=Voeg toe of verwijder &buttons
-OutlineSelectorShowFewerButtons=Toon &minder knoppen
-OutlineSelectorShowMoreButtons=Toon &meer knoppen
-Password=Wachtwoord
-PasswordHasExpiredHeader=Uw wachtwoord is vervallen ne moet nu gewijzigd worden.
-PasswordHasExpiredTitle=Wachtwoord vervallen
-PasswordWillExpireHeaderX=Uw wachtwoord vervalt {0}.
-PasswordWillExpireInfo=Wilt u het nu wijzigen?
-PasswordWillExpireTitle=Wachtwoord zal vervallen
-PasswordsDoNotMatch=De twee wachtwoorden komen niet overeen.
-Paste=Plakken
-Path=Pad
-RenameBookmarkFolderMenu=Hernoem Map...
-RepeatPassword=Herhaal
-ResetButton=&Herstel
-ResetButtonTooltip=Stel alle dialoogvelden op lege waarden in.
-SC_Copyright=De Sentry spellingcontrole en woordenboeken zijn auteursrechtelijk beschermd door Wintertree Software, Inc.
-SC_DialogTitle=Spellingcontrole
-SC_DialogTitle_Options=Spellingcontrole\: Opties
-SC_Help_AddToDictionary=Voegt het verkeerd gespelde woord aan het woordenboek toe
-SC_Help_Cancel=Sluit het dialoogvenster en verwijder alle wijzigingen (Snelkoppeling\: ESC)
-SC_Help_Change=Wijzigt het verkeerd gespelde woord
-SC_Help_ChangeAll=Wijzigt alle versies van het fout gespelde woord (in de huidige tekst-item)
-SC_Help_Enable=Als aangevinkt, dan is de spellingcontrole ingeschakeld
-SC_Help_Ignore=Negeer het verkeerd gespelde woord
-SC_Help_IgnoreAll=Negeer deze en alle verdere versies van het woord
-SC_Help_IgnoreCase=Als aangevinkt, dan wordt de zaak genegeerd, bijvoorbeeld 'Hello' zou worden aanvaard
-SC_Help_IgnoreDomainNames=Als aangevinkt, dan worden domeinnamen genegeerd, bijvoorbeeld 'www.bsiag.com' zou worden aanvaard
-SC_Help_IgnoreWordsWithNumbers=Als aangevinkt, dan worden woorden met getallen genegeerd, bijvoorbeeld 'Super7' zou worden aanvaard
-SC_Help_Language=De geselecteerde taal
-SC_Help_Options=Hiermee opent u het dialoogvenster opties
-SC_Help_RemoveWord=Verwijder het geselecteerde woord uit het woordenboek
-SC_Help_ReplacementWord=Het woord om het verkeerd gespelde woord te vervangen met (druk op ENTER om het verkeerd gespelde woord te vervangen door deze)
-SC_Help_Shortcut=De snelkoppeling om het dialoogvenster Spelling op te roepen. Vast, kan niet worden gewijzigd.
-SC_Help_SuggestionList=Voorgestelde vervanging voor het verkeerd gespelde woord (dubbel-klik om het verkeerd gespelde woord te vervangen met de geselecteerde)
-SC_Help_Undo=Maakt de laatste wijziging ongedaan
-SC_Help_UseDefaults=Gebruik standaard instellingen
-SC_Help_UserDictionary=Kies een .tlx (Scout) of.dic (Microsoft Word) woordenboek als gebruikers woordenboek
-SC_Label_AddToDictionary=Toevoegen aan woordenboek
-SC_Label_Cancel=Anuleren
-SC_Label_Capitalization=Hoofdletter gebruik
-SC_Label_Change=Wijzigen
-SC_Label_ChangeAll=Alles veranderen
-SC_Label_ChangeTo=Wijzigen in
-SC_Label_ConsiderChanging=Overweeg wijziging
-SC_Label_ContainsDigits=Bevat cijfers
-SC_Label_DoubledWord=Dubbel woord
-SC_Label_Enable=Spellingcontrole inschakelen
-SC_Label_Ignore=Negeren
-SC_Label_IgnoreAll=Alles negeren
-SC_Label_IgnoreCase=Negeer zaak
-SC_Label_IgnoreDomainNames=Negeer Domein Namen
-SC_Label_IgnoreWordsWithNumbers=Woorden met getallen negeren
-SC_Label_IgnoredWord=Genegeerd Word
-SC_Label_Main=Algemene instellingen
-SC_Label_MixedCase=Gemengde zaak
-SC_Label_NoSuggestions=&Ja
-SC_Label_NotInDictionary=Het geselecteerde woord werd niet herkend
-SC_Label_Options=Opties ...
-SC_Label_RemoveWord=Verwijder woord
-SC_Label_Shortcut=Snelkoppeling
-SC_Label_Spelling=Spelling
-SC_Label_Undo=Ongedaan maken
-SC_Label_UseDefaults=Gebruik Standaard
-SC_Label_UserDictionary=Gebruikers woordenboek
-SC_Language=Taal
-SC_Message_CheckRest=Wilt u de rest van de tekst controleren?
-SC_Message_Complete=De spellingcontrole is klaar
-SC_Message_CompleteForSelection=De spellingcontrole is voltooid voor de huidig selectie
-SC_Message_NotAvailable=De Spellingcontrole is niet beschikbaar
-Save=Bewaar
-SaveButton=&Opslaan
-SaveButtonTooltip=Sla venster op zonder te sluiten.
-SavePassword=Bewaar Gebruikersnaam/wachtwoord
-ScoutStarting=Scout start
-SearchButton=&Zoeken
-SearchButtonTooltip=Sluit venster en start zoeken
-SearchConstraints=Zoeken selectievoorwaarde
-SearchTextIsTooGeneral=Gelieve de zoektekst te verfijnen
-SelectedStates=Enkel Geverifieerd
-Server=Server
-SmartFieldCannotComplete=Geen suggesties voor "{0}"
-SmartFieldMoreThanXRows=Meer dan {0} rijen. Enkel {1} zichtbaar.
-SmartFindLabel=Zoek tekst
-StatusExportDone=Uitvoer compleet
-Today=vandaag
-Tomorrow=morgen
-TooManyRows=Grote gegevensverzameling. Verklein a.u.b. d.m.v. het zoekscherm
-Update=Update
-UserCancelledOperation=De operatie werd handmatig geannuleerd
-UserInterrupted=Geannuleerd door gebruiker.
-Username=Gebruikersnaam
-Value=Waarde
-VersionMismatchAction=Wilt u de applicatie herstarten met automatische update?
-VersionMismatchTextXY=Een applicatie-update is nodig om verder te kunnen werken. De huige versie is {0}, the nieuwe versie is {1}.
-VersionMismatchTitle=Update vereist
-VetoErrorText=Ten minste 1 zoekveld moet ingevuld zijn.
-Week=Week
-WeekShort=CW
-WizardBackButton=&Terug
-WizardBackButtonTooltip=Terug naar de vorige stap
-WizardCancelButton=Annuleer
-WizardCancelButtonTooltip=Stopt de wizard en verwijderd alle data.
-WizardFinishButton=&Einde
-WizardFinishButtonTooltip=Be\u00EBindig dit proces en keer terug naar proceskeuze.
-WizardNextButton=&Volgende
-WizardNextButtonTooltip=Ga door naar de volgende stap
-WizardSuspendButton=&Sluit
-WizardSuspendButtonTooltip=Sluit dit proces en sluit de wizard (kan op later tijdstip hervat worden).
-WorkWeek=Werkweek
-XMustBeGreaterThanOrEqualY='{0}' moet groter dan of gelijk zijn aan '{1}'
-XMustBeLessThanOrEqualY='{0}' moet kleiner dan of gelijk zijn aan '{1}'
-XRows={0} objecten
-XSelected={0} geselecteerd
-Yes=Ja
-YesButton=&Ja
-and=en
-from=van
-searchingProposals=Doorzoeken voorstellen...
-to=tot
+ActivateBookmarkMenu=Open favoriet
+ActiveAndInactiveStates=Actief+Inactief
+ActiveStates=Actief
+AllStates=Allen
+Apply=Toepassen
+ApplyBookmarkToSearchFailedMessage=Deze favoriet kan niet toegepast worden op de huidige zoekopdracht.
+Attribute=Bijdragen
+Bookmark=Favoriet
+BookmarkFolder=Map
+Bookmarks=Favorieten
+BookmarksAddMenu=&Voeg aan favorieten toe
+BookmarksApplyToCurrentSearch=Zoekopdracht uitvoeren met gebruik van deze favoriet
+BookmarksMainMenu=&Favorieten
+BookmarksManageMenu=&Stel favorieten in...
+BookmarksPublishMenu=Publiceer favoriet...
+BookmarksStartPageMenu=& Opstartweergave
+BookmarksStartPageMenuClear=&Geen Opstartweergave
+BookmarksStartPageMenuGoto=&Open Opstartweergave
+BookmarksStartPageMenuSet=&Stel huidige weergave als beginweergave in
+ButtonDeselectAll=Deselecteer alles
+ButtonMoveDown=Naar beneden
+ButtonMoveUp=Naar boven
+ButtonSelectAll=Selecteer alles
+Calendar_earlier=Eerder
+Calendar_later=Later
+Cancel=Annuleer
+CancelButton=&Annuleer
+CancelButtonTooltip=Sluit venster zonder op te slaan, indien noodzakelijk met bevestiging dialoogvenster
+ChangePassword=Wachtwoord wijzigen
+CloseButton=&Sluit
+CloseButtonTooltip=Sluit dialoogvenster zonder op te slaan.
+CodeTypeInit=Code type initialisatie
+Column=Kolom
+Columns=Kolommen
+ComposerFieldAggregationAvg=Gemiddeld({0})
+ComposerFieldAggregationCount=Tel({0})
+ComposerFieldAggregationLabel=Functie
+ComposerFieldAggregationMax=Maximum({0})
+ComposerFieldAggregationMedian=Mediaan({0})
+ComposerFieldAggregationMin=Minimum({0})
+ComposerFieldAggregationSum=Som({0})
+Condensed=6 kolommen
+Copy=Copi\u00EBer
+Cut=Eindigen
+Day=Dag
+DefaultPasswordPolicyText=Het paswoord komt niet overeen met de opgegeven waarden\n\nWaarden\:\n- tenminste 8 tekens\n- tenminste een cijfer (0-9)\n- tenminste \u00E9\u00E9n niet standaard teken (\!|@|\#|$|%|^|&|*|(|)|_|+|||~|-|
+DeleteBookmarkMenu=Verwijder favoriet
+DeleteConfirmationText=Wilt u volgende data verwijderen?
+DeleteConfirmationTextNoItemList=Wilt u deze data verwijderen?
+DeleteConfirmationTextNoItemListX=Wilt u deze verwijderen {0}?
+DeleteConfirmationTextX=Wilt u het volgende verwijderen\: {0}?
+DeleteConfirmationTitle=Bevesting verwijdering
+DeleteFolderMenu=Verwijder map
+DetailedVersion=Gedetailleerde Versie
+EditBookmarkMenu=Bewerk favoriet...
+EmailCc=CC
+EmailFrom=Van
+EmailSubject=Onderwerp
+EmailTo=Naar
+Error=Fout
+ErrorAndRetryTextDefault=Een fout is opgetreden tijdens gegevensoverbrenging
+ErrorTextLogin=Ongeldige gebruikersnaam/wachtwoord
+ErrorTitleLogin=Login mislukt
+ExcelChart_Button_LoadDefaults=Begininstellingen
+ExcelChart_Button_LoadDefaultsHint=Stelt dit venster opnieuw in door de beginwaarden te laden
+ExcelChart_Button_LoadProfile=Laadt profiel...
+ExcelChart_Button_LoadProfileHint=Laadt instellingen van xml bestand
+ExcelChart_Button_SaveProfile=Bewaar profiel...
+ExcelChart_Button_SaveProfileHint=Bewaart de huidige instellingen in een XML bestand.
+ExcelChart_Error_CreatingChartFailed=Grafiek aanmaken mislukt.
+ExcelChart_Error_ExportingFailed=Export mislukt vanwege
+ExcelChart_Error_InitializationFailed=Initialisatie van de aanvullende klasse(n) mislukt.
+ExcelChart_Error_LoadingTemplateFailed=Laden sjabloon mislukt.
+ExcelChart_Error_RetrivingOutlineDataFailed=Terugkrijgen outlinegegevens mislukt.
+ExcelChart_Error_SavingProfileFailed=Opslaan profiel mislukt vanwege
+ExcelChart_Error_WrongProfile=Het profiel werd aangemaakt voor een andere outline.
+ExcelChart_Label_AutomaticMode=Automatische modus
+ExcelChart_Label_AutomaticModeHint=Verberg Excel en sla automatisch op
+ExcelChart_Label_ChartNumber=Grafieknummer
+ExcelChart_Label_ChartType=Grafiektype
+ExcelChart_Label_FileName=Bestandnaam
+ExcelChart_Label_FirstRow=Eerste rij
+ExcelChart_Label_Height=Hoogte
+ExcelChart_Label_HistogramMode=Histogram modus
+ExcelChart_Label_HistogramModeHint=De histogram modus combineert gelijke waarden op de X-as naar een waarde.
+ExcelChart_Label_LastRow=Laatste rij
+ExcelChart_Label_Offset=Positie
+ExcelChart_Label_SkipNullValues=Sla nul waarden over in de histogram modus
+ExcelChart_Label_SkipNullValuesHint=Indien gecontroleerde nul waarden op de X-as worden genegeerd, indien anders worden deze gecombineerd naar <Onbekend>.
+ExcelChart_Label_TemplateName=Sjabloon
+ExcelChart_Label_UseCustomFormat=Gebruik standaardformaat
+ExcelChart_Label_UseCustomFormatHint=Indien gecontroleerd kunt u de positie van de grafiek en grootte aangeven.
+ExcelChart_Label_UseExistingChart=Gebruik bestaande grafiek
+ExcelChart_Label_UseExistingChartHint=Indien gecontroleerd wordt de aangegeven grafiek in het bepaalde sjabloon gebruikt.
+ExcelChart_Label_UseSelectiveExport=Gebruik selectieve export
+ExcelChart_Label_UseSelectiveExportHint=Indien gecontroleerd worden alleen de aangegeven rijen hieronder ge\u00EBxporteerd.
+ExcelChart_Label_Width=Breedte
+ExcelChart_Label_WorksheetName=Werkblad
+ExcelChart_Label_XAxis=X-As
+ExcelChart_Label_YAxes=Y-As
+ExcelChart_Status_Done=Excel Grafiek Export gereed.
+ExcelChart_Tab_Advanced=Geavanceerd
+ExcelChart_Tab_Basic=Standaard
+ExcelChart_Title_MainForm=Excel Grafiek Export
+ExcelChart_Type_Area3D=Gebied 3D
+ExcelChart_Type_Area=Gebied
+ExcelChart_Type_AreaStacked3D=Gebied gestapeld 3D
+ExcelChart_Type_AreaStacked=Gebied gestapeld
+ExcelChart_Type_BarsClustered3D=Staafdiagram gegroepeerd 3D
+ExcelChart_Type_BarsClustered=Staafdiagram gegroepeerd
+ExcelChart_Type_BarsStacked3D=Staafdiagram gestapeld 3D
+ExcelChart_Type_BarsStacked=Staafdiagram
+ExcelChart_Type_ColumnsClustered3D=Kolommen gegroepeerd 3D
+ExcelChart_Type_ColumnsClustered=Kolommen gegroepeerd
+ExcelChart_Type_ColumnsStacked3D=Kolommen gestapeld 3D
+ExcelChart_Type_ColumnsStacked=Kolommen gestapeld
+ExcelChart_Type_Line=Lijn
+ExcelChart_Type_LineStacked=Gestapelde lijn
+ExcelChart_Type_Pie3D=Taart 3D
+ExcelChart_Type_Pie=Taart
+ExcelChart_Type_PieExploded3D=Taart Gesegmenteerd 3D
+ExcelChart_Type_PieExploded=Taart gesegmenteerd
+ExcelChart_Various_Averaged=Gemiddeld
+ExcelChart_Various_Column=Kolom
+ExcelChart_Various_Frequency=Frequentie
+ExcelChart_Various_SummedUp=Opgeteld
+ExcelChart_Various_Unknown=<Onbekend>
+ExecutionTime=Server processing
+ExportDate=Exporteer tijdstip
+ExtendedSearchAddAdditionalOrMenu=Voeg extra in of vervang
+ExtendedSearchAddAttribute=Belemmering
+ExtendedSearchAddAttributeMenu=Voeg selectievoorwaarde toe...
+ExtendedSearchAddEitherOrMenu=Voeg toe ... of
+ExtendedSearchAddEntityPrefix=heeft
+ExtendedSearchAnd=en
+ExtendedSearchEditAttributeMenu=Bewerk...
+ExtendedSearchEither=hetzij
+ExtendedSearchEntitySuffix=met
+ExtendedSearchNegateMenu=Doe teniet...
+ExtendedSearchNot=niet
+ExtendedSearchOr=of
+ExtendedSearchRemoveAttributeMenu=Verwijder...
+ExtendedSearchRemoveMenu=Verwijder
+FileExistsOwerwriteQuestion=Het geselecteerde bestand bestaat al. Dit bestand overschrijven?
+FileName=Bestandsnaam
+FileNotFoundMessage=Kan het bestand niet vinden\:
+FileNotFoundTitle=Bestand niet gevonden
+FilesOfType=Bestandstype
+FilterBookmarkTree=Bladeren favorieten
+Folders=Mappen
+FormButtonClicked=Terwijl u op een knop klikt
+FormCloseTimerActivated=Sluitingstimer geactiveerd
+FormClosing=Sluiten
+FormEmptyMandatoryFieldsMessage=Volgende velden zijn verplicht
+FormExportXml=Exporteer naar XML
+FormFinally=Finaliseer
+FormFireActivated=Wanneer het formulier werd geactiveerd
+FormFireClosed=Wanneer het formulier gesloten werd
+FormFireDiscarded=Als formulier werd verwijderd
+FormFireStructureChanged=Bij de wijziging van de formulierstrustuur
+FormFireToBack=Bij sturen van het formulier naar achter
+FormFireToFront=Bij sturen van het formulier naar voor
+FormIncompleteIntro=Niet alle verplichte velden zijn ingevuld.
+FormInvalidFieldsMessage=Volgende velden zijn ongeldig
+FormPrint=Print
+FormReset=Reset
+FormSaveChangesQuestion=Wilt u de wijzigingen opslaan?
+FormStateLoad=Laden..
+FormStateStore=Opslaan
+FormStateStoreAs=Opslaan als...
+FormTimerActivated=Timer geactiveerd
+FormattingLocale=Opmaak
+GlobalBookmarks=Globale Favorieten
+GlobalBookmarksAddMenu=Voeg toe &globale favorieten
+Help=Help
+Hour=Uur
+IOErrorInfo=Controleer bestanden en verbinding a.u.b.
+IOErrorText=Communicatiefout
+IOErrorTitle=Lees / schrijffout
+InDaysX=in {0} dagen
+InactiveState=Inactief
+InactiveStates=Inactief
+Info=Informatie
+Interrupted=Onderbroken
+InterruptedErrorText=Het proces is handmatig geannuleerd
+InterruptedErrorTitle=Proces geannuleerd
+InvalidNumberMessageX="{0}" is een ongeldig nummer
+InvalidPhoneNumberMessageX="{0}" is een ongeldig telefoonnummer
+InvalidValueMessageX="{0}" is een ongeldige waarde
+JavaVMVersion=Java VM
+JavaVersion=Java Runtime
+KeyStroke=Toetsaanslag
+Language=Taal
+LoadFormXmlFailedText=Dit bestand is niet compatibel met dit venster.
+LogicBetween=is tussen {0} en {1}
+LogicBetweenShort=tussen
+LogicDateIsInDays=is in precies n (dagen)
+LogicDateIsInGEDays=Datum >\= vandaag + n dagen
+LogicDateIsInGEMonths=Datum >\= vandaag + n maanden
+LogicDateIsInLEDays=Datum <\=vandaag + n dagen
+LogicDateIsInLEMonths=Datum <\=vandaag + n maanden
+LogicDateIsInLastDays=was in de laatste n dagen
+LogicDateIsInLastMonths=was in de laatste n maanden
+LogicDateIsInMonths=is in precies (maanden)
+LogicDateIsInNextDays=zou binnen n dagen zijn
+LogicDateIsInNextMonths=zou binnen n maanden zijn
+LogicDateIsNotToday=is niet vandaag
+LogicDateIsToday=is vandaag
+LogicDateTimeIsInGEHours=Datum >\= nu + n uur
+LogicDateTimeIsInGEMinutes=Datum >\= nu + n minuten
+LogicDateTimeIsInLEHours=Datum <\= nu + n uur
+LogicDateTimeIsInLEMinutes=Datum <\= nu + n minuten
+LogicDateTimeIsNotNow=is niet nu
+LogicDateTimeIsNow=is nu
+LogicEQ=\=
+LogicEndsWith=Eindigt met
+LogicGE=>\=
+LogicGT=>
+LogicIn=is
+LogicLE=<\=
+LogicLT=<
+LogicLike=bevat
+LogicNEQ=<>
+LogicNotEndsWith=eindigd niet met
+LogicNotIn=is niet
+LogicNotLike=niet bevattend
+LogicNotNull=is niet leeg
+LogicNotStartsWith=begint niet met
+LogicNull=is leeg
+LogicStartsWith=begint met
+LogicTimeIsInGEHours=is ten vroegste binnen (uren)
+LogicTimeIsInGEMinutes=is ten vroegste binnen (minuten)
+LogicTimeIsInHours=is in precies (uren)
+LogicTimeIsInLEHours=is ten laatste binnen (uren)
+LogicTimeIsInLEMinutes=is ten laatste binnen (minuten)
+LogicTimeIsInMinutes=is in precies (minuten)
+LogicTimeIsNotNow=is niet nu
+LogicTimeIsNow=is nu
+Login=Login
+LookIn=Kijk in
+MemoryStatus=Geheugen
+Minute=Minuut
+Month=Maand
+Name=Naam
+NetErrorInfo=Controleer servernaam, URL en verbinding a.u.b.
+NetErrorText=Server niet gevonden
+NetErrorTitle=Netwerkfout
+NetworkLatency=Netwerk vertraging
+NewBookmarkFolderMenu=Niewe map...
+NewPassword=Nieuw wachtwoord
+No=Nee
+NoButton=&Nee
+NumberOfRows=Rijtelling
+NumberTooLargeMessageXY=De waarde is te groot; moet tussen (0) en (1) zijn.
+NumberTooSmallMessageXY=De waarde is te klein; moet tussen (0) en (1) zijn.
+OSUser=Systeemgebruiker
+OSVersion=Systeemversie
+Ok=Ok
+OkButton=&Ok
+OkButtonTooltip=Opslaan en venster sluiten
+OldPassword=Oud wachtwoord
+OneRow=1 object
+OneSelected=1 geselecteerd
+Op=Operator
+Open=Open
+OriginalErrorMessageIs=Het origineel bericht is\: {0}
+OutlineSelectorAddOrRemoveButtons=Voeg toe of verwijder &buttons
+OutlineSelectorShowFewerButtons=Toon &minder knoppen
+OutlineSelectorShowMoreButtons=Toon &meer knoppen
+Password=Wachtwoord
+PasswordHasExpiredHeader=Uw wachtwoord is vervallen ne moet nu gewijzigd worden.
+PasswordHasExpiredTitle=Wachtwoord vervallen
+PasswordWillExpireHeaderX=Uw wachtwoord vervalt {0}.
+PasswordWillExpireInfo=Wilt u het nu wijzigen?
+PasswordWillExpireTitle=Wachtwoord zal vervallen
+PasswordsDoNotMatch=De twee wachtwoorden komen niet overeen.
+Paste=Plakken
+Path=Pad
+RenameBookmarkFolderMenu=Hernoem Map...
+RepeatPassword=Herhaal
+ResetButton=&Herstel
+ResetButtonTooltip=Stel alle dialoogvelden op lege waarden in.
+SC_Copyright=De Sentry spellingcontrole en woordenboeken zijn auteursrechtelijk beschermd door Wintertree Software, Inc.
+SC_DialogTitle=Spellingcontrole
+SC_DialogTitle_Options=Spellingcontrole\: Opties
+SC_Help_AddToDictionary=Voegt het verkeerd gespelde woord aan het woordenboek toe
+SC_Help_Cancel=Sluit het dialoogvenster en verwijder alle wijzigingen (Snelkoppeling\: ESC)
+SC_Help_Change=Wijzigt het verkeerd gespelde woord
+SC_Help_ChangeAll=Wijzigt alle versies van het fout gespelde woord (in de huidige tekst-item)
+SC_Help_Enable=Als aangevinkt, dan is de spellingcontrole ingeschakeld
+SC_Help_Ignore=Negeer het verkeerd gespelde woord
+SC_Help_IgnoreAll=Negeer deze en alle verdere versies van het woord
+SC_Help_IgnoreCase=Als aangevinkt, dan wordt de zaak genegeerd, bijvoorbeeld 'Hello' zou worden aanvaard
+SC_Help_IgnoreDomainNames=Als aangevinkt, dan worden domeinnamen genegeerd, bijvoorbeeld 'www.bsiag.com' zou worden aanvaard
+SC_Help_IgnoreWordsWithNumbers=Als aangevinkt, dan worden woorden met getallen genegeerd, bijvoorbeeld 'Super7' zou worden aanvaard
+SC_Help_Language=De geselecteerde taal
+SC_Help_Options=Hiermee opent u het dialoogvenster opties
+SC_Help_RemoveWord=Verwijder het geselecteerde woord uit het woordenboek
+SC_Help_ReplacementWord=Het woord om het verkeerd gespelde woord te vervangen met (druk op ENTER om het verkeerd gespelde woord te vervangen door deze)
+SC_Help_Shortcut=De snelkoppeling om het dialoogvenster Spelling op te roepen. Vast, kan niet worden gewijzigd.
+SC_Help_SuggestionList=Voorgestelde vervanging voor het verkeerd gespelde woord (dubbel-klik om het verkeerd gespelde woord te vervangen met de geselecteerde)
+SC_Help_Undo=Maakt de laatste wijziging ongedaan
+SC_Help_UseDefaults=Gebruik standaard instellingen
+SC_Help_UserDictionary=Kies een .tlx (Scout) of.dic (Microsoft Word) woordenboek als gebruikers woordenboek
+SC_Label_AddToDictionary=Toevoegen aan woordenboek
+SC_Label_Cancel=Anuleren
+SC_Label_Capitalization=Hoofdletter gebruik
+SC_Label_Change=Wijzigen
+SC_Label_ChangeAll=Alles veranderen
+SC_Label_ChangeTo=Wijzigen in
+SC_Label_ConsiderChanging=Overweeg wijziging
+SC_Label_ContainsDigits=Bevat cijfers
+SC_Label_DoubledWord=Dubbel woord
+SC_Label_Enable=Spellingcontrole inschakelen
+SC_Label_Ignore=Negeren
+SC_Label_IgnoreAll=Alles negeren
+SC_Label_IgnoreCase=Negeer zaak
+SC_Label_IgnoreDomainNames=Negeer Domein Namen
+SC_Label_IgnoreWordsWithNumbers=Woorden met getallen negeren
+SC_Label_IgnoredWord=Genegeerd Word
+SC_Label_Main=Algemene instellingen
+SC_Label_MixedCase=Gemengde zaak
+SC_Label_NoSuggestions=&Ja
+SC_Label_NotInDictionary=Het geselecteerde woord werd niet herkend
+SC_Label_Options=Opties ...
+SC_Label_RemoveWord=Verwijder woord
+SC_Label_Shortcut=Snelkoppeling
+SC_Label_Spelling=Spelling
+SC_Label_Undo=Ongedaan maken
+SC_Label_UseDefaults=Gebruik Standaard
+SC_Label_UserDictionary=Gebruikers woordenboek
+SC_Language=Taal
+SC_Message_CheckRest=Wilt u de rest van de tekst controleren?
+SC_Message_Complete=De spellingcontrole is klaar
+SC_Message_CompleteForSelection=De spellingcontrole is voltooid voor de huidig selectie
+SC_Message_NotAvailable=De Spellingcontrole is niet beschikbaar
+Save=Bewaar
+SaveButton=&Opslaan
+SaveButtonTooltip=Sla venster op zonder te sluiten.
+SavePassword=Bewaar Gebruikersnaam/wachtwoord
+ScoutStarting=Scout start
+SearchButton=&Zoeken
+SearchButtonTooltip=Sluit venster en start zoeken
+SearchConstraints=Zoeken selectievoorwaarde
+SearchTextIsTooGeneral=Gelieve de zoektekst te verfijnen
+SelectedStates=Enkel Geverifieerd
+Server=Server
+SmartFieldCannotComplete=Geen suggesties voor "{0}"
+SmartFieldMoreThanXRows=Meer dan {0} rijen. Enkel {1} zichtbaar.
+SmartFindLabel=Zoek tekst
+StatusExportDone=Uitvoer compleet
+Today=vandaag
+Tomorrow=morgen
+TooManyRows=Grote gegevensverzameling. Verklein a.u.b. d.m.v. het zoekscherm
+Update=Update
+UserCancelledOperation=De operatie werd handmatig geannuleerd
+UserInterrupted=Geannuleerd door gebruiker.
+Username=Gebruikersnaam
+Value=Waarde
+VersionMismatchAction=Wilt u de applicatie herstarten met automatische update?
+VersionMismatchTextXY=Een applicatie-update is nodig om verder te kunnen werken. De huige versie is {0}, the nieuwe versie is {1}.
+VersionMismatchTitle=Update vereist
+VetoErrorText=Ten minste 1 zoekveld moet ingevuld zijn.
+Week=Week
+WeekShort=CW
+WizardBackButton=&Terug
+WizardBackButtonTooltip=Terug naar de vorige stap
+WizardCancelButton=Annuleer
+WizardCancelButtonTooltip=Stopt de wizard en verwijderd alle data.
+WizardFinishButton=&Einde
+WizardFinishButtonTooltip=Be\u00EBindig dit proces en keer terug naar proceskeuze.
+WizardNextButton=&Volgende
+WizardNextButtonTooltip=Ga door naar de volgende stap
+WizardSuspendButton=&Sluit
+WizardSuspendButtonTooltip=Sluit dit proces en sluit de wizard (kan op later tijdstip hervat worden).
+WorkWeek=Werkweek
+XMustBeGreaterThanOrEqualY='{0}' moet groter dan of gelijk zijn aan '{1}'
+XMustBeLessThanOrEqualY='{0}' moet kleiner dan of gelijk zijn aan '{1}'
+XRows={0} objecten
+XSelected={0} geselecteerd
+Yes=Ja
+YesButton=&Ja
+and=en
+from=van
+searchingProposals=Doorzoeken voorstellen...
+to=tot
diff --git a/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_no.properties b/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_no.properties
index 4bba959f48..4d2dfeea83 100644
--- a/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_no.properties
+++ b/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_no.properties
@@ -1,224 +1,224 @@
-AllStates=Alle
-Apply=Bruk
-Attribute=Egenskap
-Bookmarks=Favoritter
-BookmarksAddMenu=&Legg til favoritter...
-BookmarksMainMenu=&Favoritter
-BookmarksManageMenu=&Administrer bokmerker...
-BookmarksStartPageMenu=&Oppstartsvindu
-BookmarksStartPageMenuClear=&Ingen oppstartvindu
-BookmarksStartPageMenuGoto=&\u00C5pne oppstartsvindu
-BookmarksStartPageMenuSet=&Sett aktuelt vindu som oppstartsvindu
-ButtonDeselectAll=Opphev valg alle
-ButtonSelectAll=Velg alle
-Calendar_earlier=Tidligere
-Calendar_later=Senere
-Cancel=Avbryt
-CancelButton=&Avbryt
-CancelButtonTooltip=with confirmation dialog if necessary.
-ChangePassword=Endre passord
-CloseButton=&Lukk
-CloseButtonTooltip=Lukk dialog uten \u00E5 lagre.
-Column=Kolonne
-Columns=Kolonner
-ComposerFieldAggregationLabel=Funksjon
-Condensed=6 kolonner
-Copy=Kopi
-Cut=Klipp
-Day=Dag
-DefaultPasswordPolicyText=Passordet overholder ikke gjeldende policy\n\nPolicy\:\n- minst 8 tegn\n- minst ett siffer (0-9)\n- minst ett ikke-standard tegn (\!|@|\#|$|%|^|&|*|(|)|_|+|||~|-|
-EmailFrom=Fra
-EmailSubject=Subjekt
-EmailTo=Til
-Error=Feil
-ErrorAndRetryTextDefault=En feil oppstod under dataoverf\u00F8ring.
-ErrorTextLogin=Ugyldig brukernavn/passord
-ErrorTitleLogin=Innlogging mislykket
-ExcelChart_Button_LoadDefaults=Normalinnstillinger
-ExcelChart_Button_LoadDefaultsHint=Tilbakestiller denne dialogen ved \u00E5 laste normalverdier
-ExcelChart_Button_LoadProfile=Last profil...
-ExcelChart_Button_LoadProfileHint=Last innstillinger fra en XML-fil.
-ExcelChart_Button_SaveProfile=Lagre profil...
-ExcelChart_Button_SaveProfileHint=Lagrer n\u00E5v\u00E6rende innstillinger i en XML fil
-ExcelChart_Error_CreatingChartFailed=Opprettelse av diagram mislyktes.
-ExcelChart_Error_ExportingFailed=Eksport mislyktes fordi
-ExcelChart_Error_InitializationFailed=Initialisering av support-class(es) mislyktes
-ExcelChart_Error_LoadingProfileFailed=Lasting av profil mislyktes fordi
-ExcelChart_Error_LoadingTemplateFailed=lasting av mal mislyktes
-ExcelChart_Error_RetrivingOutlineDataFailed=gjenoppretting av outline-data mislyktes
-ExcelChart_Error_SavingProfileFailed=Lagring av profil mislyktes fordi
-ExcelChart_Error_WrongProfile=profilen ble opprettet for en annen outline.
-ExcelChart_Label_AutomaticMode=Automatisk modus
-ExcelChart_Label_AutomaticModeHint=Skjul Excel og lagre automatisk
-ExcelChart_Label_ChartNumber=Diagram nr.
-ExcelChart_Label_ChartType=Diagram type
-ExcelChart_Label_FileName=Filnavn
-ExcelChart_Label_FirstRow=F\u00F8rste rad
-ExcelChart_Label_Height=H\u00F8yde
-ExcelChart_Label_HistogramMode=Histogram modus
-ExcelChart_Label_HistogramModeHint=Histogram modus kominerer identiske verdier p\u00E5 X-akse til \u00E9n verdi.
-ExcelChart_Label_LastRow=Siste rad
-ExcelChart_Label_Offset=Plassering
-ExcelChart_Label_SkipNullValues=Hopp over null-verdier i histogram-modus
-ExcelChart_Label_SkipNullValuesHint=Hvis avkrysset vil null-verdier p\u00E5 X-aksen blir ignorert, ellers vil de bli kombinert til en verdi.
-ExcelChart_Label_TemplateName=Mal
-ExcelChart_Label_UseCustomFormat=Benytt spesielt format
-ExcelChart_Label_UseCustomFormatHint=Hvis avkrysset kan du indikere diagrammets plassering og st\u00F8rrelse.
-ExcelChart_Label_UseExistingChart=Bruk eksisterende diagram
-ExcelChart_Label_UseExistingChartHint=Hvis avkrysset vil eksisterende diagram bli brukt med indikerte malen.
-ExcelChart_Label_UseSelectiveExport=Benytt selektiv eksport
-ExcelChart_Label_UseSelectiveExportHint=Hvis avkrysset vil bare de indikerte radene nedenfor bli eksportert,
-ExcelChart_Label_Width=Bredde
-ExcelChart_Label_WorksheetName=Regneark
-ExcelChart_Label_XAxis=X-akse
-ExcelChart_Label_YAxes=Y-akse
-ExcelChart_Status_Done=Excel Diagram Eksport er utf\u00F8rt.
-ExcelChart_Tab_Advanced=Avansert
-ExcelChart_Tab_Basic=Grunnleggende
-ExcelChart_Title_MainForm=Excel Diagram Eksport.
-ExcelChart_Type_Area3D=Areal 3D
-ExcelChart_Type_Area=Areal
-ExcelChart_Type_AreaStacked3D=Areal stablet 3D
-ExcelChart_Type_AreaStacked=Areal stablet
-ExcelChart_Type_BarsClustered3D=Stolpegruppe 3D
-ExcelChart_Type_BarsClustered=Stolpegruppe
-ExcelChart_Type_BarsStacked3D=Stolper stablet 3D
-ExcelChart_Type_BarsStacked=Stolper stablet
-ExcelChart_Type_ColumnsClustered3D=S\u00F8ylegruppe 3D
-ExcelChart_Type_ColumnsClustered=S\u00F8ylegruppe
-ExcelChart_Type_ColumnsStacked3D=S\u00F8yler stablet 3D
-ExcelChart_Type_ColumnsStacked=S\u00F8yler stablet
-ExcelChart_Type_Line=Linje
-ExcelChart_Type_LineStacked=Linje stablet
-ExcelChart_Type_Pie3D=Kake 3D
-ExcelChart_Type_Pie=Kake
-ExcelChart_Type_PieExploded3D=Kape ekspander 3D
-ExcelChart_Type_PieExploded=Kake ekspandert
-ExcelChart_Various_Averaged=midlet
-ExcelChart_Various_Column=Kolonne
-ExcelChart_Various_Frequency=Frekvens
-ExcelChart_Various_SummedUp=oppsummert
-ExcelChart_Various_Unknown=<Ukjent>
-ExportDate=Eksport dato
-ExtendedSearchAddAttributeMenu=Legg til innskrenking...
-ExtendedSearchAddEntityPrefix=har ikke
-ExtendedSearchAnd=og
-ExtendedSearchEditAttributeMenu=Rediger...
-ExtendedSearchEntitySuffix=med
-ExtendedSearchNegateMenu=Nekte
-ExtendedSearchRemoveAttributeMenu=Fjern
-ExtendedSearchRemoveMenu=Fjern
-FileExistsOwerwriteQuestion=Den valgte filen eksisterer allerede. Skrive over filen?
-FileName=Filnavn
-FileNotFoundMessage=Kunne ikke finne filen\:
-FileNotFoundTitle=Dokument ikke funnet.
-FilesOfType=Filtype
-FormPrint=Skriv ut
-FormSaveChangesQuestion=\u00D8nsker du \u00E5 lagre endringene?
-FormStateLoad=\u00C5pne...
-FormStateStore=Lagre
-FormStateStoreAs=Lagre som...
-GlobalBookmarks=Globale bokmerker
-GlobalBookmarksAddMenu=Legg til &globale bokmerker
-Help=Hjelp
-IOErrorInfo=Vennligst kontroller dokument og forbindelse.
-IOErrorText=Kommunikasjonsfeil
-IOErrorTitle=Lese-/skrivefeil.
-Info=Informasjon
-Interrupted=Avbrutt
-InterruptedErrorText=Prosessen har blitt kansellert manuelt
-InterruptedErrorTitle=Prosess kansellert
-JavaVMVersion=Java VM
-Language=Spr\u00E5k
-LoadFormXmlFailedText=Denne filen er ikke forenlig med denne dialogen.
-LogicDateIsInDays=er om n\u00F8yaktig (dager)
-LogicDateIsInGEDays=er tidligst om (dager)
-LogicDateIsInGEMonths=er tidligst om (m\u00E5neder)
-LogicDateIsInLEDays=er senest om (dager)
-LogicDateIsInLEMonths=er senest om (m\u00E5neder)
-LogicDateIsInLastDays=Var i siste n dager
-LogicDateIsInLastMonths=Var i siste n m\u00E5ndeder
-LogicDateIsInMonths=er om n\u00F8yaktig (m\u00E5neder)
-LogicDateIsInNextDays=Var i neste n dager
-LogicDateIsInNextMonths=Var i neste n m\u00E5neder
-LogicDateIsNotToday=er ikke i dag
-LogicDateIsToday=er i dag
-LogicDateTimeIsInGEHours=er tidligst om (timer)
-LogicDateTimeIsInGEMinutes=er tidligst om (minutter)
-LogicDateTimeIsInLEHours=er senest om (timer)
-LogicDateTimeIsInLEMinutes=er senest om (minutter)
-LogicDateTimeIsNotNow=er ikke n\u00E5
-LogicDateTimeIsNow=er n\u00E5
-LogicEQ=\=
-LogicEndsWith=slutter med
-LogicGE=>\=
-LogicGT=>
-LogicIn=Er
-LogicLE=<\=
-LogicLT=<
-LogicLike=Inneholder
-LogicNEQ=<>
-LogicNotIn=er ikke
-LogicNotLike=inneholder ikke
-LogicNotNull=er ikke tom
-LogicNull=er tom
-LogicStartsWith=Begynner med
-LogicTimeIsInGEHours=er tidligst om (timer)
-LogicTimeIsInGEMinutes=er tidligst om (minutter)
-LogicTimeIsInHours=er om n\u00F8yaktig (timer)
-LogicTimeIsInLEHours=er senest om (timer)
-LogicTimeIsInLEMinutes=er senest om (minutter)
-LogicTimeIsInMinutes=er om n\u00F8yaktig (minutter)
-LogicTimeIsNotNow=er ikke n\u00E5
-LogicTimeIsNow=er n\u00E5
-Login=Logg inn
-LookIn=S\u00F8k i
-Month=M\u00E5ned
-Name=Navn
-NetErrorInfo=Vennligst kontroller servernavn, URL og forbindelse.
-NetErrorText=Server ikke funnet.
-NetErrorTitle=Nettverksfeil
-NewPassword=Nytt passord
-No=Nei
-NoButton=&Nei
-NumberOfRows=Datasett
-OSUser=Systembruker
-OSVersion=Systemversjon
-Ok=Ok
-OkButton=&Ok
-OkButtonTooltip=Lagre og lukk dialog.
-OldPassword=Gammelt passord
-Op=Operat\u00F8r
-Open=\u00C5pne
-Password=Passord
-PasswordsDoNotMatch=De to passordene stemmer ikke overens.
-Paste=Lim inn
-Path=Bane
-RepeatPassword=Gjenta
-ResetButton=&Tilbakestill
-ResetButtonTooltip=T\u00F8m alle dialogfelt
-Save=Lagre
-SaveButton=&Lagre
-SaveButtonTooltip=Lagre data uten \u00E5 lukke
-SearchButton=&S\u00F8k
-SearchButtonTooltip=Lukk dialog og begynn s\u00F8k.
-SearchConstraints=S\u00F8kebetingelser
-Server=Server
-SmartFindLabel=S\u00F8k tekst
-StatusExportDone=Eksport fullf\u00F8rt
-Today=idag
-TooManyRows=Stor datamengde. Vennligst begrens ved \u00E5 bruke s\u00F8kemeny.
-Update=Oppdater
-UserInterrupted=Avbrutt av bruker.
-Username=Brukernavn
-Value=Verdi
-Week=Uke
-WeekShort=CW
-WizardCancelButton=Avbryt
-WizardSuspendButton=&Lukk
-WorkWeek=Arbeidsuke
-Yes=Ja
-YesButton=&Ja
-and=og
-from=fra
-to=til
+AllStates=Alle
+Apply=Bruk
+Attribute=Egenskap
+Bookmarks=Favoritter
+BookmarksAddMenu=&Legg til favoritter...
+BookmarksMainMenu=&Favoritter
+BookmarksManageMenu=&Administrer bokmerker...
+BookmarksStartPageMenu=&Oppstartsvindu
+BookmarksStartPageMenuClear=&Ingen oppstartvindu
+BookmarksStartPageMenuGoto=&\u00C5pne oppstartsvindu
+BookmarksStartPageMenuSet=&Sett aktuelt vindu som oppstartsvindu
+ButtonDeselectAll=Opphev valg alle
+ButtonSelectAll=Velg alle
+Calendar_earlier=Tidligere
+Calendar_later=Senere
+Cancel=Avbryt
+CancelButton=&Avbryt
+CancelButtonTooltip=with confirmation dialog if necessary.
+ChangePassword=Endre passord
+CloseButton=&Lukk
+CloseButtonTooltip=Lukk dialog uten \u00E5 lagre.
+Column=Kolonne
+Columns=Kolonner
+ComposerFieldAggregationLabel=Funksjon
+Condensed=6 kolonner
+Copy=Kopi
+Cut=Klipp
+Day=Dag
+DefaultPasswordPolicyText=Passordet overholder ikke gjeldende policy\n\nPolicy\:\n- minst 8 tegn\n- minst ett siffer (0-9)\n- minst ett ikke-standard tegn (\!|@|\#|$|%|^|&|*|(|)|_|+|||~|-|
+EmailFrom=Fra
+EmailSubject=Subjekt
+EmailTo=Til
+Error=Feil
+ErrorAndRetryTextDefault=En feil oppstod under dataoverf\u00F8ring.
+ErrorTextLogin=Ugyldig brukernavn/passord
+ErrorTitleLogin=Innlogging mislykket
+ExcelChart_Button_LoadDefaults=Normalinnstillinger
+ExcelChart_Button_LoadDefaultsHint=Tilbakestiller denne dialogen ved \u00E5 laste normalverdier
+ExcelChart_Button_LoadProfile=Last profil...
+ExcelChart_Button_LoadProfileHint=Last innstillinger fra en XML-fil.
+ExcelChart_Button_SaveProfile=Lagre profil...
+ExcelChart_Button_SaveProfileHint=Lagrer n\u00E5v\u00E6rende innstillinger i en XML fil
+ExcelChart_Error_CreatingChartFailed=Opprettelse av diagram mislyktes.
+ExcelChart_Error_ExportingFailed=Eksport mislyktes fordi
+ExcelChart_Error_InitializationFailed=Initialisering av support-class(es) mislyktes
+ExcelChart_Error_LoadingProfileFailed=Lasting av profil mislyktes fordi
+ExcelChart_Error_LoadingTemplateFailed=lasting av mal mislyktes
+ExcelChart_Error_RetrivingOutlineDataFailed=gjenoppretting av outline-data mislyktes
+ExcelChart_Error_SavingProfileFailed=Lagring av profil mislyktes fordi
+ExcelChart_Error_WrongProfile=profilen ble opprettet for en annen outline.
+ExcelChart_Label_AutomaticMode=Automatisk modus
+ExcelChart_Label_AutomaticModeHint=Skjul Excel og lagre automatisk
+ExcelChart_Label_ChartNumber=Diagram nr.
+ExcelChart_Label_ChartType=Diagram type
+ExcelChart_Label_FileName=Filnavn
+ExcelChart_Label_FirstRow=F\u00F8rste rad
+ExcelChart_Label_Height=H\u00F8yde
+ExcelChart_Label_HistogramMode=Histogram modus
+ExcelChart_Label_HistogramModeHint=Histogram modus kominerer identiske verdier p\u00E5 X-akse til \u00E9n verdi.
+ExcelChart_Label_LastRow=Siste rad
+ExcelChart_Label_Offset=Plassering
+ExcelChart_Label_SkipNullValues=Hopp over null-verdier i histogram-modus
+ExcelChart_Label_SkipNullValuesHint=Hvis avkrysset vil null-verdier p\u00E5 X-aksen blir ignorert, ellers vil de bli kombinert til en verdi.
+ExcelChart_Label_TemplateName=Mal
+ExcelChart_Label_UseCustomFormat=Benytt spesielt format
+ExcelChart_Label_UseCustomFormatHint=Hvis avkrysset kan du indikere diagrammets plassering og st\u00F8rrelse.
+ExcelChart_Label_UseExistingChart=Bruk eksisterende diagram
+ExcelChart_Label_UseExistingChartHint=Hvis avkrysset vil eksisterende diagram bli brukt med indikerte malen.
+ExcelChart_Label_UseSelectiveExport=Benytt selektiv eksport
+ExcelChart_Label_UseSelectiveExportHint=Hvis avkrysset vil bare de indikerte radene nedenfor bli eksportert,
+ExcelChart_Label_Width=Bredde
+ExcelChart_Label_WorksheetName=Regneark
+ExcelChart_Label_XAxis=X-akse
+ExcelChart_Label_YAxes=Y-akse
+ExcelChart_Status_Done=Excel Diagram Eksport er utf\u00F8rt.
+ExcelChart_Tab_Advanced=Avansert
+ExcelChart_Tab_Basic=Grunnleggende
+ExcelChart_Title_MainForm=Excel Diagram Eksport.
+ExcelChart_Type_Area3D=Areal 3D
+ExcelChart_Type_Area=Areal
+ExcelChart_Type_AreaStacked3D=Areal stablet 3D
+ExcelChart_Type_AreaStacked=Areal stablet
+ExcelChart_Type_BarsClustered3D=Stolpegruppe 3D
+ExcelChart_Type_BarsClustered=Stolpegruppe
+ExcelChart_Type_BarsStacked3D=Stolper stablet 3D
+ExcelChart_Type_BarsStacked=Stolper stablet
+ExcelChart_Type_ColumnsClustered3D=S\u00F8ylegruppe 3D
+ExcelChart_Type_ColumnsClustered=S\u00F8ylegruppe
+ExcelChart_Type_ColumnsStacked3D=S\u00F8yler stablet 3D
+ExcelChart_Type_ColumnsStacked=S\u00F8yler stablet
+ExcelChart_Type_Line=Linje
+ExcelChart_Type_LineStacked=Linje stablet
+ExcelChart_Type_Pie3D=Kake 3D
+ExcelChart_Type_Pie=Kake
+ExcelChart_Type_PieExploded3D=Kape ekspander 3D
+ExcelChart_Type_PieExploded=Kake ekspandert
+ExcelChart_Various_Averaged=midlet
+ExcelChart_Various_Column=Kolonne
+ExcelChart_Various_Frequency=Frekvens
+ExcelChart_Various_SummedUp=oppsummert
+ExcelChart_Various_Unknown=<Ukjent>
+ExportDate=Eksport dato
+ExtendedSearchAddAttributeMenu=Legg til innskrenking...
+ExtendedSearchAddEntityPrefix=har ikke
+ExtendedSearchAnd=og
+ExtendedSearchEditAttributeMenu=Rediger...
+ExtendedSearchEntitySuffix=med
+ExtendedSearchNegateMenu=Nekte
+ExtendedSearchRemoveAttributeMenu=Fjern
+ExtendedSearchRemoveMenu=Fjern
+FileExistsOwerwriteQuestion=Den valgte filen eksisterer allerede. Skrive over filen?
+FileName=Filnavn
+FileNotFoundMessage=Kunne ikke finne filen\:
+FileNotFoundTitle=Dokument ikke funnet.
+FilesOfType=Filtype
+FormPrint=Skriv ut
+FormSaveChangesQuestion=\u00D8nsker du \u00E5 lagre endringene?
+FormStateLoad=\u00C5pne...
+FormStateStore=Lagre
+FormStateStoreAs=Lagre som...
+GlobalBookmarks=Globale bokmerker
+GlobalBookmarksAddMenu=Legg til &globale bokmerker
+Help=Hjelp
+IOErrorInfo=Vennligst kontroller dokument og forbindelse.
+IOErrorText=Kommunikasjonsfeil
+IOErrorTitle=Lese-/skrivefeil.
+Info=Informasjon
+Interrupted=Avbrutt
+InterruptedErrorText=Prosessen har blitt kansellert manuelt
+InterruptedErrorTitle=Prosess kansellert
+JavaVMVersion=Java VM
+Language=Spr\u00E5k
+LoadFormXmlFailedText=Denne filen er ikke forenlig med denne dialogen.
+LogicDateIsInDays=er om n\u00F8yaktig (dager)
+LogicDateIsInGEDays=er tidligst om (dager)
+LogicDateIsInGEMonths=er tidligst om (m\u00E5neder)
+LogicDateIsInLEDays=er senest om (dager)
+LogicDateIsInLEMonths=er senest om (m\u00E5neder)
+LogicDateIsInLastDays=Var i siste n dager
+LogicDateIsInLastMonths=Var i siste n m\u00E5ndeder
+LogicDateIsInMonths=er om n\u00F8yaktig (m\u00E5neder)
+LogicDateIsInNextDays=Var i neste n dager
+LogicDateIsInNextMonths=Var i neste n m\u00E5neder
+LogicDateIsNotToday=er ikke i dag
+LogicDateIsToday=er i dag
+LogicDateTimeIsInGEHours=er tidligst om (timer)
+LogicDateTimeIsInGEMinutes=er tidligst om (minutter)
+LogicDateTimeIsInLEHours=er senest om (timer)
+LogicDateTimeIsInLEMinutes=er senest om (minutter)
+LogicDateTimeIsNotNow=er ikke n\u00E5
+LogicDateTimeIsNow=er n\u00E5
+LogicEQ=\=
+LogicEndsWith=slutter med
+LogicGE=>\=
+LogicGT=>
+LogicIn=Er
+LogicLE=<\=
+LogicLT=<
+LogicLike=Inneholder
+LogicNEQ=<>
+LogicNotIn=er ikke
+LogicNotLike=inneholder ikke
+LogicNotNull=er ikke tom
+LogicNull=er tom
+LogicStartsWith=Begynner med
+LogicTimeIsInGEHours=er tidligst om (timer)
+LogicTimeIsInGEMinutes=er tidligst om (minutter)
+LogicTimeIsInHours=er om n\u00F8yaktig (timer)
+LogicTimeIsInLEHours=er senest om (timer)
+LogicTimeIsInLEMinutes=er senest om (minutter)
+LogicTimeIsInMinutes=er om n\u00F8yaktig (minutter)
+LogicTimeIsNotNow=er ikke n\u00E5
+LogicTimeIsNow=er n\u00E5
+Login=Logg inn
+LookIn=S\u00F8k i
+Month=M\u00E5ned
+Name=Navn
+NetErrorInfo=Vennligst kontroller servernavn, URL og forbindelse.
+NetErrorText=Server ikke funnet.
+NetErrorTitle=Nettverksfeil
+NewPassword=Nytt passord
+No=Nei
+NoButton=&Nei
+NumberOfRows=Datasett
+OSUser=Systembruker
+OSVersion=Systemversjon
+Ok=Ok
+OkButton=&Ok
+OkButtonTooltip=Lagre og lukk dialog.
+OldPassword=Gammelt passord
+Op=Operat\u00F8r
+Open=\u00C5pne
+Password=Passord
+PasswordsDoNotMatch=De to passordene stemmer ikke overens.
+Paste=Lim inn
+Path=Bane
+RepeatPassword=Gjenta
+ResetButton=&Tilbakestill
+ResetButtonTooltip=T\u00F8m alle dialogfelt
+Save=Lagre
+SaveButton=&Lagre
+SaveButtonTooltip=Lagre data uten \u00E5 lukke
+SearchButton=&S\u00F8k
+SearchButtonTooltip=Lukk dialog og begynn s\u00F8k.
+SearchConstraints=S\u00F8kebetingelser
+Server=Server
+SmartFindLabel=S\u00F8k tekst
+StatusExportDone=Eksport fullf\u00F8rt
+Today=idag
+TooManyRows=Stor datamengde. Vennligst begrens ved \u00E5 bruke s\u00F8kemeny.
+Update=Oppdater
+UserInterrupted=Avbrutt av bruker.
+Username=Brukernavn
+Value=Verdi
+Week=Uke
+WeekShort=CW
+WizardCancelButton=Avbryt
+WizardSuspendButton=&Lukk
+WorkWeek=Arbeidsuke
+Yes=Ja
+YesButton=&Ja
+and=og
+from=fra
+to=til
diff --git a/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_pl.properties b/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_pl.properties
index a5042c0146..6d6a6bdc23 100644
--- a/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_pl.properties
+++ b/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_pl.properties
@@ -1,224 +1,224 @@
-AllStates=Wszystko
-Apply=Zastosuj
-Attribute=Atrybut
-Bookmarks=Zak\u0142adki
-BookmarksAddMenu=&Dodaj zak\u0142adk\u0119
-BookmarksMainMenu=&Zak\u0142adki
-BookmarksManageMenu=&Zarz\u0105dzaj zak\u0142adkami
-BookmarksStartPageMenu=&Widok startowy
-BookmarksStartPageMenuClear=&Brak widoku startowego
-BookmarksStartPageMenuGoto=&Otw\u00F3rz widok startowy
-BookmarksStartPageMenuSet=&Ustaw bie\u017C\u0105cy widok jako startowy
-ButtonDeselectAll=Usu\u0144 zaznaczenie wszystkiego
-ButtonSelectAll=Zaznacz wszystko
-Calendar_earlier=Wcze\u015Bniej
-Calendar_later=P\u00F3\u017Aniej
-Cancel=Anuluj
-CancelButton=&Anuluj
-CancelButtonTooltip=Zamknij okno dialogowe bez zapisywania; z potwierdzeniem je\u017Celi to konieczne
-ChangePassword=Zmie\u0144 has\u0142o
-CloseButton=&Zamknij
-CloseButtonTooltip=Zamknij okno dialogowe bez zapisywania
-Column=Kolumna
-Columns=Kolumny
-ComposerFieldAggregationLabel=Funkcja
-Condensed=6 kolumn
-Copy=Kopiuj
-Cut=Przytnij
-Day=Dzie\u0144
-DefaultPasswordPolicyText=Has\u0142o nie spe\u0142nia wymaga\u0144\n\nWymagania\:\n- co najmniej 8 znak\u00F3w\n- co najmniej jedna cyfra (0-9)\n- co najmniej jeden znak nie standardowy (\!|@|\#|$|%|^|&|*|(|)|_|+|||~|-|\n- nie u\u017Cywane w przesz\u0142o\u015Bci\n- nazwa u\u017Cytkownika nie mo\u017Ce by\u0107 cz\u0119\u015Bci\u0105 has\u0142a
-EmailFrom=Od
-EmailSubject=Temat
-EmailTo=Do
-Error=B\u0142\u0105d
-ErrorAndRetryTextDefault=Wyst\u0105pi\u0142 b\u0142\u0105d podczas transferu danych
-ErrorTextLogin=Niepoprawna nazwa u\u017Cytkownika / has\u0142o
-ErrorTitleLogin=Niepowodzenie logowania
-ExcelChart_Button_LoadDefaults=Domy\u015Blne
-ExcelChart_Button_LoadDefaultsHint=Wyczy\u015B\u0107 to okno poprzez za\u0142adowanie domy\u015Blnych danych
-ExcelChart_Button_LoadProfile=Za\u0142aduj profil\u2026
-ExcelChart_Button_LoadProfileHint=Za\u0142aduj ustawienia z pliku xml
-ExcelChart_Button_SaveProfile=Zapisz profil\u2026
-ExcelChart_Button_SaveProfileHint=Zapisz obecne ustawienia w pliku XML
-ExcelChart_Error_CreatingChartFailed=niepowodzenie tworzenia wykresu
-ExcelChart_Error_ExportingFailed=Niepowodzenie eksportu z powodu
-ExcelChart_Error_InitializationFailed=niepowodzenie rozpocz\u0119cia support class
-ExcelChart_Error_LoadingProfileFailed=Niepowodzenie \u0142adowania profilu z powodu
-ExcelChart_Error_LoadingTemplateFailed=Niepowodzenie \u0142adowania szablonu.
-ExcelChart_Error_RetrivingOutlineDataFailed=Niepowodzenie odzyskania danych outline
-ExcelChart_Error_SavingProfileFailed=Niepowodzenie zapisania profilu z powodu
-ExcelChart_Error_WrongProfile=profil stworzono dla innego ekranu
-ExcelChart_Label_AutomaticMode=Tryb automatyczny
-ExcelChart_Label_AutomaticModeHint=Ukryj Excel i zapisz automatycznie
-ExcelChart_Label_ChartNumber=Numer wykresu
-ExcelChart_Label_ChartType=Typ wykresu
-ExcelChart_Label_FileName=Nazwa pliku
-ExcelChart_Label_FirstRow=Pierwszy wiersz
-ExcelChart_Label_Height=Wysoko\u015B\u0107
-ExcelChart_Label_HistogramMode=Tryb wykresu
-ExcelChart_Label_HistogramModeHint=Tryb wykresu \u0142\u0105czy te same warto\u015Bci na osi X w jedn\u0105 warto\u015B\u0107
-ExcelChart_Label_LastRow=Ostatni wiersz
-ExcelChart_Label_Offset=Pozycja
-ExcelChart_Label_SkipNullValues=Pomi\u0144 zera w typie wykresu
-ExcelChart_Label_SkipNullValuesHint=Je\u017Celi sprawdzanie warto\u015Bci zerowych na osi X zosta\u0142o pomini\u0119te, zostan\u0105 one po\u0142\u0105czone z <nieznany>
-ExcelChart_Label_TemplateName=Szablon
-ExcelChart_Label_UseCustomFormat=U\u017Cyj zwyk\u0142ego formatu
-ExcelChart_Label_UseCustomFormatHint=Je\u017Celi zaznaczono, mo\u017Cesz okre\u015Bli\u0107 po\u0142o\u017Cenie i rozmiar wykresu
-ExcelChart_Label_UseExistingChart=U\u017Cyj istniej\u0105cego wykresu
-ExcelChart_Label_UseExistingChartHint=Je\u017Celi zaznaczono, u\u017Cyty zostanie istniej\u0105cy wykres w okre\u015Blonym szablonie
-ExcelChart_Label_UseSelectiveExport=Eksportuj wybrane dane
-ExcelChart_Label_UseSelectiveExportHint=Je\u017Celi zaznaczono, wyeksportowanie zostan\u0105 tylko okre\u015Blone wiersze
-ExcelChart_Label_Width=Szeroko\u015B\u0107
-ExcelChart_Label_WorksheetName=Arkusz
-ExcelChart_Label_XAxis=O\u015B X
-ExcelChart_Label_YAxes=Osie Y
-ExcelChart_Status_Done=Wykonano eksport wykresu Excel
-ExcelChart_Tab_Advanced=Zaawansowany
-ExcelChart_Tab_Basic=Podstawowy
-ExcelChart_Title_MainForm=Eksport wykresu Excel
-ExcelChart_Type_Area3D=Powierzchniowy 3D
-ExcelChart_Type_Area=Powierzchniowy
-ExcelChart_Type_AreaStacked3D=Powierzchniowy skumulowany 3D
-ExcelChart_Type_AreaStacked=Powierzchniowy skumulowany
-ExcelChart_Type_BarsClustered3D=S\u0142upkowy 3D
-ExcelChart_Type_BarsClustered=S\u0142upkowy
-ExcelChart_Type_BarsStacked3D=S\u0142upkowy skumulowany 3D
-ExcelChart_Type_BarsStacked=S\u0142upkowy skumulowany
-ExcelChart_Type_ColumnsClustered3D=Kolumnowy 3D
-ExcelChart_Type_ColumnsClustered=Kolumnowy
-ExcelChart_Type_ColumnsStacked3D=Kolumnowy skumulowany 3D
-ExcelChart_Type_ColumnsStacked=Kolumnowy skumulowany
-ExcelChart_Type_Line=Liniowy
-ExcelChart_Type_LineStacked=Liniowy skumulowany
-ExcelChart_Type_Pie3D=Ko\u0142owy 3D
-ExcelChart_Type_Pie=Ko\u0142owy
-ExcelChart_Type_PieExploded3D=Ko\u0142owy rozsuni\u0119ty 3D
-ExcelChart_Type_PieExploded=Ko\u0142owy rozsuni\u0119ty
-ExcelChart_Various_Averaged=u\u015Bredniony
-ExcelChart_Various_Column=Kolumna
-ExcelChart_Various_Frequency=Cz\u0119stotliwo\u015B\u0107
-ExcelChart_Various_SummedUp=Zsumowany
-ExcelChart_Various_Unknown=<Nieznany>
-ExportDate=Eksportuj dane
-ExtendedSearchAddAttributeMenu=Dodaj ograniczenie\u2026
-ExtendedSearchAddEntityPrefix=ma
-ExtendedSearchAnd=i
-ExtendedSearchEditAttributeMenu=Edytuj\u2026
-ExtendedSearchEntitySuffix=z
-ExtendedSearchNegateMenu=Negacja
-ExtendedSearchRemoveAttributeMenu=Usu\u0144
-ExtendedSearchRemoveMenu=Usu\u0144
-FileExistsOwerwriteQuestion=Zaznaczony plik ju\u017C istnieje. Zast\u0105pi\u0107 ten plik?
-FileName=Nazwa pliku
-FileNotFoundMessage=Nie mo\u017Ce znale\u017A\u0107 pliku\:
-FileNotFoundTitle=Nie znaleziono pliku
-FilesOfType=Typ pliku
-FormPrint=Drukuj
-FormSaveChangesQuestion=Czy zapisa\u0107 zmiany?
-FormStateLoad=\u0141aduj\u2026
-FormStateStore=Zapisz
-FormStateStoreAs=Zapisz jako\u2026
-GlobalBookmarks=Globalne zak\u0142adki
-GlobalBookmarksAddMenu=Dodaj do &globalnych zak\u0142adek
-Help=Pomoc
-IOErrorInfo=Sprawd\u017A pliki i zawarto\u015B\u0107
-IOErrorText=B\u0142\u0105d komunikacji
-IOErrorTitle=B\u0142\u0105d pisania / czytania
-Info=Informacja
-Interrupted=Przerwano
-InterruptedErrorText=Proces anulowano r\u0119cznie
-InterruptedErrorTitle=Proces anulowany
-JavaVMVersion=Java VM
-Language=J\u0119zyk
-LoadFormXmlFailedText=Plik nie jest kompatybilny z\u2026\u2026.
-LogicDateIsInDays=jest dok\u0142adnie w ci\u0105gu n dni
-LogicDateIsInGEDays=Data >\= dzi\u015B + n dni
-LogicDateIsInGEMonths=Data >\= dzi\u015B + n miesi\u0119cy
-LogicDateIsInLEDays=Data <\= dzi\u015B + n dni
-LogicDateIsInLEMonths=Data <\= dzi\u015B + n miesi\u0119cy
-LogicDateIsInLastDays=by\u0142 w ostatnich n dniach
-LogicDateIsInLastMonths=by\u0142 w ostatnich n miesi\u0105cach
-LogicDateIsInMonths=jest dok\u0142adnie w ci\u0105gu n miesi\u0119cy
-LogicDateIsInNextDays=by\u0142 w ci\u0105gu nast\u0119pnych n dni
-LogicDateIsInNextMonths=by\u0142 w ci\u0105gu nast\u0119pnych n miesi\u0119cy
-LogicDateIsNotToday=nie jest dzisiaj
-LogicDateIsToday=jest dzisiaj
-LogicDateTimeIsInGEHours=Data >\= teraz + n dni
-LogicDateTimeIsInGEMinutes=Data >\= teraz + n minut
-LogicDateTimeIsInLEHours=Data <\= teraz + n dni
-LogicDateTimeIsInLEMinutes=Data <\= teraz + n minut
-LogicDateTimeIsNotNow=nie jest teraz
-LogicDateTimeIsNow=jest teraz
-LogicEQ=\=
-LogicEndsWith=Zako\u0144cz z
-LogicGE=>\=
-LogicGT=>
-LogicIn=Jest
-LogicLE=<\=
-LogicLT=<
-LogicLike=Zawiera
-LogicNEQ=<>
-LogicNotIn=nie jest
-LogicNotLike=nie zawiera
-LogicNotNull=nie jest pusta
-LogicNull=jest pusty
-LogicStartsWith=Zacznij z
-LogicTimeIsInGEHours=najwcze\u015Bniej w (godziny)
-LogicTimeIsInGEMinutes=najwcze\u015Bniej w (minuty)
-LogicTimeIsInHours=dok\u0142adnie (godziny)
-LogicTimeIsInLEHours=najp\u00F3\u017Aniej w (godziny)
-LogicTimeIsInLEMinutes=najp\u00F3\u017Aniej w (minuty)
-LogicTimeIsInMinutes=dok\u0142adnie (minuty)
-LogicTimeIsNotNow=nie jest teraz
-LogicTimeIsNow=jest teraz
-Login=Login
-LookIn=Patrz
-Month=Miesi\u0105c
-Name=Nazwa
-NetErrorInfo=Sprawd\u017A nazw\u0119 serwera, URL i po\u0142\u0105czenie
-NetErrorText=Nie odnaleziono serwera
-NetErrorTitle=B\u0142\u0105d sieci
-NewPassword=Nowe has\u0142o
-No=Nie
-NoButton=&Nie
-NumberOfRows=Liczba wierszy
-OSUser=U\u017Cytkownik systemu
-OSVersion=Wersja systemu
-Ok=Ok.
-OkButton=&Ok
-OkButtonTooltip=Zapisz i zamknij okno dialogowe
-OldPassword=Stare has\u0142o
-Op=Operator
-Open=Otw\u00F3rz
-Password=Has\u0142o
-PasswordsDoNotMatch=Has\u0142a nie pasuj\u0105 do siebie
-Paste=Wklej
-Path=\u015Acie\u017Cka
-RepeatPassword=Powt\u00F3rz
-ResetButton=&Reset
-ResetButtonTooltip=Wszystkie okna dialogowe maj\u0105 by\u0107 puste
-Save=Zapisz
-SaveButton=&Zapisz
-SaveButtonTooltip=Zapisz okno dialogowe bez zamykania
-SearchButton=&Szukaj
-SearchButtonTooltip=Zamknij okno dialogowe i rozpocznij szukanie
-SearchConstraints=Szukaj ograniczenia
-Server=Serwer
-SmartFindLabel=Szukaj tekstu
-StatusExportDone=Eksport zako\u0144czony
-Today=dzi\u015B
-TooManyRows=Wiele danych. Ogranicz w panelu Szukania
-Update=Aktualizacja
-UserInterrupted=Odwo\u0142ane przez u\u017Cytkownika
-Username=Nazwa u\u017Cytkownika
-Value=Warto\u015B\u0107
-Week=Tydzie\u0144
-WeekShort=CW
-WizardCancelButton=Anuluj
-WizardSuspendButton=&Zamknij
-WorkWeek=Tydzie\u0144 roboczy
-Yes=Tak
-YesButton=&Tak
-and=i
-from=Od
-to=do
+AllStates=Wszystko
+Apply=Zastosuj
+Attribute=Atrybut
+Bookmarks=Zak\u0142adki
+BookmarksAddMenu=&Dodaj zak\u0142adk\u0119
+BookmarksMainMenu=&Zak\u0142adki
+BookmarksManageMenu=&Zarz\u0105dzaj zak\u0142adkami
+BookmarksStartPageMenu=&Widok startowy
+BookmarksStartPageMenuClear=&Brak widoku startowego
+BookmarksStartPageMenuGoto=&Otw\u00F3rz widok startowy
+BookmarksStartPageMenuSet=&Ustaw bie\u017C\u0105cy widok jako startowy
+ButtonDeselectAll=Usu\u0144 zaznaczenie wszystkiego
+ButtonSelectAll=Zaznacz wszystko
+Calendar_earlier=Wcze\u015Bniej
+Calendar_later=P\u00F3\u017Aniej
+Cancel=Anuluj
+CancelButton=&Anuluj
+CancelButtonTooltip=Zamknij okno dialogowe bez zapisywania; z potwierdzeniem je\u017Celi to konieczne
+ChangePassword=Zmie\u0144 has\u0142o
+CloseButton=&Zamknij
+CloseButtonTooltip=Zamknij okno dialogowe bez zapisywania
+Column=Kolumna
+Columns=Kolumny
+ComposerFieldAggregationLabel=Funkcja
+Condensed=6 kolumn
+Copy=Kopiuj
+Cut=Przytnij
+Day=Dzie\u0144
+DefaultPasswordPolicyText=Has\u0142o nie spe\u0142nia wymaga\u0144\n\nWymagania\:\n- co najmniej 8 znak\u00F3w\n- co najmniej jedna cyfra (0-9)\n- co najmniej jeden znak nie standardowy (\!|@|\#|$|%|^|&|*|(|)|_|+|||~|-|\n- nie u\u017Cywane w przesz\u0142o\u015Bci\n- nazwa u\u017Cytkownika nie mo\u017Ce by\u0107 cz\u0119\u015Bci\u0105 has\u0142a
+EmailFrom=Od
+EmailSubject=Temat
+EmailTo=Do
+Error=B\u0142\u0105d
+ErrorAndRetryTextDefault=Wyst\u0105pi\u0142 b\u0142\u0105d podczas transferu danych
+ErrorTextLogin=Niepoprawna nazwa u\u017Cytkownika / has\u0142o
+ErrorTitleLogin=Niepowodzenie logowania
+ExcelChart_Button_LoadDefaults=Domy\u015Blne
+ExcelChart_Button_LoadDefaultsHint=Wyczy\u015B\u0107 to okno poprzez za\u0142adowanie domy\u015Blnych danych
+ExcelChart_Button_LoadProfile=Za\u0142aduj profil\u2026
+ExcelChart_Button_LoadProfileHint=Za\u0142aduj ustawienia z pliku xml
+ExcelChart_Button_SaveProfile=Zapisz profil\u2026
+ExcelChart_Button_SaveProfileHint=Zapisz obecne ustawienia w pliku XML
+ExcelChart_Error_CreatingChartFailed=niepowodzenie tworzenia wykresu
+ExcelChart_Error_ExportingFailed=Niepowodzenie eksportu z powodu
+ExcelChart_Error_InitializationFailed=niepowodzenie rozpocz\u0119cia support class
+ExcelChart_Error_LoadingProfileFailed=Niepowodzenie \u0142adowania profilu z powodu
+ExcelChart_Error_LoadingTemplateFailed=Niepowodzenie \u0142adowania szablonu.
+ExcelChart_Error_RetrivingOutlineDataFailed=Niepowodzenie odzyskania danych outline
+ExcelChart_Error_SavingProfileFailed=Niepowodzenie zapisania profilu z powodu
+ExcelChart_Error_WrongProfile=profil stworzono dla innego ekranu
+ExcelChart_Label_AutomaticMode=Tryb automatyczny
+ExcelChart_Label_AutomaticModeHint=Ukryj Excel i zapisz automatycznie
+ExcelChart_Label_ChartNumber=Numer wykresu
+ExcelChart_Label_ChartType=Typ wykresu
+ExcelChart_Label_FileName=Nazwa pliku
+ExcelChart_Label_FirstRow=Pierwszy wiersz
+ExcelChart_Label_Height=Wysoko\u015B\u0107
+ExcelChart_Label_HistogramMode=Tryb wykresu
+ExcelChart_Label_HistogramModeHint=Tryb wykresu \u0142\u0105czy te same warto\u015Bci na osi X w jedn\u0105 warto\u015B\u0107
+ExcelChart_Label_LastRow=Ostatni wiersz
+ExcelChart_Label_Offset=Pozycja
+ExcelChart_Label_SkipNullValues=Pomi\u0144 zera w typie wykresu
+ExcelChart_Label_SkipNullValuesHint=Je\u017Celi sprawdzanie warto\u015Bci zerowych na osi X zosta\u0142o pomini\u0119te, zostan\u0105 one po\u0142\u0105czone z <nieznany>
+ExcelChart_Label_TemplateName=Szablon
+ExcelChart_Label_UseCustomFormat=U\u017Cyj zwyk\u0142ego formatu
+ExcelChart_Label_UseCustomFormatHint=Je\u017Celi zaznaczono, mo\u017Cesz okre\u015Bli\u0107 po\u0142o\u017Cenie i rozmiar wykresu
+ExcelChart_Label_UseExistingChart=U\u017Cyj istniej\u0105cego wykresu
+ExcelChart_Label_UseExistingChartHint=Je\u017Celi zaznaczono, u\u017Cyty zostanie istniej\u0105cy wykres w okre\u015Blonym szablonie
+ExcelChart_Label_UseSelectiveExport=Eksportuj wybrane dane
+ExcelChart_Label_UseSelectiveExportHint=Je\u017Celi zaznaczono, wyeksportowanie zostan\u0105 tylko okre\u015Blone wiersze
+ExcelChart_Label_Width=Szeroko\u015B\u0107
+ExcelChart_Label_WorksheetName=Arkusz
+ExcelChart_Label_XAxis=O\u015B X
+ExcelChart_Label_YAxes=Osie Y
+ExcelChart_Status_Done=Wykonano eksport wykresu Excel
+ExcelChart_Tab_Advanced=Zaawansowany
+ExcelChart_Tab_Basic=Podstawowy
+ExcelChart_Title_MainForm=Eksport wykresu Excel
+ExcelChart_Type_Area3D=Powierzchniowy 3D
+ExcelChart_Type_Area=Powierzchniowy
+ExcelChart_Type_AreaStacked3D=Powierzchniowy skumulowany 3D
+ExcelChart_Type_AreaStacked=Powierzchniowy skumulowany
+ExcelChart_Type_BarsClustered3D=S\u0142upkowy 3D
+ExcelChart_Type_BarsClustered=S\u0142upkowy
+ExcelChart_Type_BarsStacked3D=S\u0142upkowy skumulowany 3D
+ExcelChart_Type_BarsStacked=S\u0142upkowy skumulowany
+ExcelChart_Type_ColumnsClustered3D=Kolumnowy 3D
+ExcelChart_Type_ColumnsClustered=Kolumnowy
+ExcelChart_Type_ColumnsStacked3D=Kolumnowy skumulowany 3D
+ExcelChart_Type_ColumnsStacked=Kolumnowy skumulowany
+ExcelChart_Type_Line=Liniowy
+ExcelChart_Type_LineStacked=Liniowy skumulowany
+ExcelChart_Type_Pie3D=Ko\u0142owy 3D
+ExcelChart_Type_Pie=Ko\u0142owy
+ExcelChart_Type_PieExploded3D=Ko\u0142owy rozsuni\u0119ty 3D
+ExcelChart_Type_PieExploded=Ko\u0142owy rozsuni\u0119ty
+ExcelChart_Various_Averaged=u\u015Bredniony
+ExcelChart_Various_Column=Kolumna
+ExcelChart_Various_Frequency=Cz\u0119stotliwo\u015B\u0107
+ExcelChart_Various_SummedUp=Zsumowany
+ExcelChart_Various_Unknown=<Nieznany>
+ExportDate=Eksportuj dane
+ExtendedSearchAddAttributeMenu=Dodaj ograniczenie\u2026
+ExtendedSearchAddEntityPrefix=ma
+ExtendedSearchAnd=i
+ExtendedSearchEditAttributeMenu=Edytuj\u2026
+ExtendedSearchEntitySuffix=z
+ExtendedSearchNegateMenu=Negacja
+ExtendedSearchRemoveAttributeMenu=Usu\u0144
+ExtendedSearchRemoveMenu=Usu\u0144
+FileExistsOwerwriteQuestion=Zaznaczony plik ju\u017C istnieje. Zast\u0105pi\u0107 ten plik?
+FileName=Nazwa pliku
+FileNotFoundMessage=Nie mo\u017Ce znale\u017A\u0107 pliku\:
+FileNotFoundTitle=Nie znaleziono pliku
+FilesOfType=Typ pliku
+FormPrint=Drukuj
+FormSaveChangesQuestion=Czy zapisa\u0107 zmiany?
+FormStateLoad=\u0141aduj\u2026
+FormStateStore=Zapisz
+FormStateStoreAs=Zapisz jako\u2026
+GlobalBookmarks=Globalne zak\u0142adki
+GlobalBookmarksAddMenu=Dodaj do &globalnych zak\u0142adek
+Help=Pomoc
+IOErrorInfo=Sprawd\u017A pliki i zawarto\u015B\u0107
+IOErrorText=B\u0142\u0105d komunikacji
+IOErrorTitle=B\u0142\u0105d pisania / czytania
+Info=Informacja
+Interrupted=Przerwano
+InterruptedErrorText=Proces anulowano r\u0119cznie
+InterruptedErrorTitle=Proces anulowany
+JavaVMVersion=Java VM
+Language=J\u0119zyk
+LoadFormXmlFailedText=Plik nie jest kompatybilny z\u2026\u2026.
+LogicDateIsInDays=jest dok\u0142adnie w ci\u0105gu n dni
+LogicDateIsInGEDays=Data >\= dzi\u015B + n dni
+LogicDateIsInGEMonths=Data >\= dzi\u015B + n miesi\u0119cy
+LogicDateIsInLEDays=Data <\= dzi\u015B + n dni
+LogicDateIsInLEMonths=Data <\= dzi\u015B + n miesi\u0119cy
+LogicDateIsInLastDays=by\u0142 w ostatnich n dniach
+LogicDateIsInLastMonths=by\u0142 w ostatnich n miesi\u0105cach
+LogicDateIsInMonths=jest dok\u0142adnie w ci\u0105gu n miesi\u0119cy
+LogicDateIsInNextDays=by\u0142 w ci\u0105gu nast\u0119pnych n dni
+LogicDateIsInNextMonths=by\u0142 w ci\u0105gu nast\u0119pnych n miesi\u0119cy
+LogicDateIsNotToday=nie jest dzisiaj
+LogicDateIsToday=jest dzisiaj
+LogicDateTimeIsInGEHours=Data >\= teraz + n dni
+LogicDateTimeIsInGEMinutes=Data >\= teraz + n minut
+LogicDateTimeIsInLEHours=Data <\= teraz + n dni
+LogicDateTimeIsInLEMinutes=Data <\= teraz + n minut
+LogicDateTimeIsNotNow=nie jest teraz
+LogicDateTimeIsNow=jest teraz
+LogicEQ=\=
+LogicEndsWith=Zako\u0144cz z
+LogicGE=>\=
+LogicGT=>
+LogicIn=Jest
+LogicLE=<\=
+LogicLT=<
+LogicLike=Zawiera
+LogicNEQ=<>
+LogicNotIn=nie jest
+LogicNotLike=nie zawiera
+LogicNotNull=nie jest pusta
+LogicNull=jest pusty
+LogicStartsWith=Zacznij z
+LogicTimeIsInGEHours=najwcze\u015Bniej w (godziny)
+LogicTimeIsInGEMinutes=najwcze\u015Bniej w (minuty)
+LogicTimeIsInHours=dok\u0142adnie (godziny)
+LogicTimeIsInLEHours=najp\u00F3\u017Aniej w (godziny)
+LogicTimeIsInLEMinutes=najp\u00F3\u017Aniej w (minuty)
+LogicTimeIsInMinutes=dok\u0142adnie (minuty)
+LogicTimeIsNotNow=nie jest teraz
+LogicTimeIsNow=jest teraz
+Login=Login
+LookIn=Patrz
+Month=Miesi\u0105c
+Name=Nazwa
+NetErrorInfo=Sprawd\u017A nazw\u0119 serwera, URL i po\u0142\u0105czenie
+NetErrorText=Nie odnaleziono serwera
+NetErrorTitle=B\u0142\u0105d sieci
+NewPassword=Nowe has\u0142o
+No=Nie
+NoButton=&Nie
+NumberOfRows=Liczba wierszy
+OSUser=U\u017Cytkownik systemu
+OSVersion=Wersja systemu
+Ok=Ok.
+OkButton=&Ok
+OkButtonTooltip=Zapisz i zamknij okno dialogowe
+OldPassword=Stare has\u0142o
+Op=Operator
+Open=Otw\u00F3rz
+Password=Has\u0142o
+PasswordsDoNotMatch=Has\u0142a nie pasuj\u0105 do siebie
+Paste=Wklej
+Path=\u015Acie\u017Cka
+RepeatPassword=Powt\u00F3rz
+ResetButton=&Reset
+ResetButtonTooltip=Wszystkie okna dialogowe maj\u0105 by\u0107 puste
+Save=Zapisz
+SaveButton=&Zapisz
+SaveButtonTooltip=Zapisz okno dialogowe bez zamykania
+SearchButton=&Szukaj
+SearchButtonTooltip=Zamknij okno dialogowe i rozpocznij szukanie
+SearchConstraints=Szukaj ograniczenia
+Server=Serwer
+SmartFindLabel=Szukaj tekstu
+StatusExportDone=Eksport zako\u0144czony
+Today=dzi\u015B
+TooManyRows=Wiele danych. Ogranicz w panelu Szukania
+Update=Aktualizacja
+UserInterrupted=Odwo\u0142ane przez u\u017Cytkownika
+Username=Nazwa u\u017Cytkownika
+Value=Warto\u015B\u0107
+Week=Tydzie\u0144
+WeekShort=CW
+WizardCancelButton=Anuluj
+WizardSuspendButton=&Zamknij
+WorkWeek=Tydzie\u0144 roboczy
+Yes=Tak
+YesButton=&Tak
+and=i
+from=Od
+to=do
diff --git a/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_pt_br.properties b/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_pt_br.properties
index 5ba616e5d4..033dbba48a 100644
--- a/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_pt_br.properties
+++ b/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_pt_br.properties
@@ -1,252 +1,252 @@
-All=Todos
-AllStates=Todos
-Apply=Aplicar
-Attribute=Atributo
-Bookmarks=Favoritos
-BookmarksAddMenu=Adicionar aos favoritos
-BookmarksMainMenu=&Favoritos
-BookmarksManageMenu=Organizar favoritos
-BookmarksStartPageMenu=&P\u00E1gina inicial
-BookmarksStartPageMenuClear=&N\u00E3o utilizar p\u00E1gina inicial
-BookmarksStartPageMenuGoto=&Abrir p\u00E1gina inicial
-BookmarksStartPageMenuSet=&Definir esta p\u00E1gina como p\u00E1gina inicial
-ButtonDeselectAll=tirar sele\u00E7\u00E3o de todos
-ButtonSelectAll=Selecioanr tudo
-Calendar_earlier=anterior
-Calendar_later=posterior
-Cancel=Cancelar
-CancelButton=&Cancelar
-CancelButtonTooltip=Fechar sem guardar; com mensagem de confirma\u00E7\u00E3o se necess\u00E1rio.
-ChangePassword=Alterar Password
-Close=Fechar
-CloseButton=&Fechar
-CloseButtonTooltip=Fechar sem guardar.
-Column=Coluna
-Columns=Colunas
-ComposerFieldAggregationLabel=Fun\u00E7\u00E3o
-Condensed=6 colunas
-Configure=Configura\u00E7\u00E3o
-Copy=Copiar
-Criteria=Crit\u00E9rio de procura
-Cut=recortar
-Day=Dia
-DefaultPasswordPolicyText=A senha n\u00E3o \u00E9 compat\u00EDvel com a pol\u00EDtica\:\n\nPol\u00EDtica\:\n- no m\u00EDnimo 8 caracteres (A-Z)\n- no m\u00EDnimo 1 n\u00FAmero (0-9)\n- no m\u00EDnimo 1 s\u00EDmbolo (\!|@|\#|$|%|^|&|*|(|)|_|+|||~|-|)\n- n\u00E3o ter utilizado esta senha nenhuma vez\n- seu nome do usu\u00E1rio n\u00E3o dever\u00E1 fazer parte da senha
-DeleteMenu=Apagar
-Detail=Detalhe
-Details=Detalhes
-EmailFrom=Remetente
-EmailSubject=Assunto
-EmailTo=Para
-Enabled=Ativado
-Error=Erro
-ErrorAndRetryTextDefault=Um erro ocorreu durante a transfer\u00EAncia.
-ErrorTextLogin=Nome do utilizador / Senha
-ErrorTitleLogin=Acesso negado
-ExcelChart_Button_LoadDefaults=Defaults
-ExcelChart_Button_LoadDefaultsHint=Zera esta janela carregando os valores padr\u00F5es
-ExcelChart_Button_LoadProfile=Carregando perfil
-ExcelChart_Button_LoadProfileHint=Carregando configura\u00E7\u00F5es do arquivo XML
-ExcelChart_Button_SaveProfile=salvar perfil
-ExcelChart_Button_SaveProfileHint=Salva as configura\u00E7\u00F5es atuais em um arquivo XML
-ExcelChart_Error_CreatingChartFailed=Falha na cria\u00E7\u00E3o do Gr\u00E1fico
-ExcelChart_Error_ExportingFailed=Falha na exporta\u00E7\u00E3o porque
-ExcelChart_Error_InitializationFailed=Inicializa\u00E7\u00E3o do suporte a classe(s) falhou
-ExcelChart_Error_LoadingProfileFailed=Falha ao carregar perfil porque
-ExcelChart_Error_LoadingTemplateFailed=Falha ao carregar template
-ExcelChart_Error_RetrivingOutlineDataFailed=Falha nos dados de perfil, recuperar
-ExcelChart_Error_SavingProfileFailed=Falha ao salvar perfil porque
-ExcelChart_Error_WrongProfile=O perfil foi criado por um outro esquema
-ExcelChart_Label_AutomaticMode=Modo autom\u00E1tico
-ExcelChart_Label_AutomaticModeHint=Feche Excel e salve automaticamente
-ExcelChart_Label_ChartNumber=N\u00FAmero do Gr\u00E1fico
-ExcelChart_Label_ChartType=Tipo de Gr\u00E1fico
-ExcelChart_Label_FileName=Nome do arquivo
-ExcelChart_Label_FirstRow=Primeira linha
-ExcelChart_Label_Height=altura
-ExcelChart_Label_HistogramMode=Modo de histograma
-ExcelChart_Label_HistogramModeHint=A modalidade histograma combina valores id\u00EAnticos sobre o eixo- X para um.
-ExcelChart_Label_LastRow=\u00FAltima linha
-ExcelChart_Label_Offset=Posi\u00E7\u00E3o
-ExcelChart_Label_SkipNullValues=pular valores nulos no modo histograma
-ExcelChart_Label_SkipNullValuesHint=Se verificado valores nulo sobre o eixo- X ser\u00E3o ignorados, de outra forma elas s\u00E3o combinados para <Unknown>.
-ExcelChart_Label_TemplateName=Template
-ExcelChart_Label_UseCustomFormat=Use formato personalizado
-ExcelChart_Label_UseCustomFormatHint=Se marcado pode indicar a posi\u00E7\u00E3o e o tamanho do gr\u00E1fico
-ExcelChart_Label_UseExistingChart=Use Gr\u00E1fico existente
-ExcelChart_Label_UseExistingChartHint=Se verificado o gr\u00E1fico existente o modelo referido \u00E9 usado.
-ExcelChart_Label_UseSelectiveExport=use exporta\u00E7\u00E3o seletiva
-ExcelChart_Label_UseSelectiveExportHint=Se verificado, apenas as linhas abaixo indicados ser\u00E3o exportadas
-ExcelChart_Label_Width=Largura
-ExcelChart_Label_WorksheetName=Planilha
-ExcelChart_Label_XAxis=Eixo X
-ExcelChart_Label_YAxes=Eixo Y
-ExcelChart_Status_Done=Exporta\u00E7\u00E3o do Gr\u00E1fico do Excel conclu\u00EDda
-ExcelChart_Tab_Advanced=Avan\u00E7ado
-ExcelChart_Tab_Basic=B\u00E1sico
-ExcelChart_Title_MainForm=Exportar para gr\u00E1fico do Excel
-ExcelChart_Type_Area3D=\u00C1rea 3D
-ExcelChart_Type_Area=\u00C1rea
-ExcelChart_Type_AreaStacked3D=Area 3D atraente
-ExcelChart_Type_AreaStacked=Area atraente
-ExcelChart_Type_BarsClustered3D=Barra 3D
-ExcelChart_Type_BarsClustered=barra
-ExcelChart_Type_BarsStacked3D=Barra 3D Atraente
-ExcelChart_Type_BarsStacked=Bars Stacked
-ExcelChart_Type_ColumnsClustered3D=Colunas 3D
-ExcelChart_Type_ColumnsClustered=Colunas
-ExcelChart_Type_ColumnsStacked3D=Coluna 3D Atraente
-ExcelChart_Type_ColumnsStacked=Coluna Atraente
-ExcelChart_Type_Line=linha
-ExcelChart_Type_LineStacked=Linha atraente
-ExcelChart_Type_Pie3D=Pie 3D
-ExcelChart_Type_Pie=Pie
-ExcelChart_Type_PieExploded3D=Pie reprovado 3D
-ExcelChart_Type_PieExploded=Pie reprovado
-ExcelChart_Various_Averaged=m\u00E9dia
-ExcelChart_Various_Column=Column
-ExcelChart_Various_Frequency=Frequ\u00EAncia
-ExcelChart_Various_SummedUp=Somando
-ExcelChart_Various_Unknown=<Desconhecido>
-ExportDate=Exportar data
-ExtendedSearchAddAttributeMenu=Acrescentar uma condi\u00E7\u00E3o...
-ExtendedSearchAddEntityPrefix=tem
-ExtendedSearchAnd=e
-ExtendedSearchEditAttributeMenu=Editar
-ExtendedSearchEntitySuffix=com
-ExtendedSearchNegateMenu=Negado
-ExtendedSearchRemoveAttributeMenu=Remover
-ExtendedSearchRemoveMenu=Remover
-FileExistsOwerwriteQuestion=O ficheiro seleccionado j\u00E1 existe. Deseja substituir?
-FileName=Nome do ficheiro
-FileNotFoundExceptionMessage=Documento n\u00E3o encontrado ou acesso negado.
-FileNotFoundMessage=N\u00E3o consegue encontrar o ficheiro\:
-FileNotFoundTitle=Ficheiro n\u00E3o encontrado
-FilesOfType=Tipo de ficheiro
-FormPrint=Imprimir
-FormSaveChangesQuestion=Quer guardar as altera\u00E7\u00F5es?
-FormStateLoad=Carregar...
-FormStateStore=Salvar
-FormStateStoreAs=Salvar como...
-GlobalBookmarks=Favoritos Globais
-GlobalBookmarksAddMenu=Adicionar &global bookmarks
-Help=Ajuda
-Host=Host
-IOErrorInfo=Favor examinar documentos relacionados e conex\u00E3o do servidor.
-IOErrorText=Erro de comunica\u00E7\u00E3o
-IOErrorTitle=Erro de leitura / ortografia
-Info=Informa\u00E7\u00E3o
-Information=Informa\u00E7\u00E3o
-Interrupted=A\u00E7\u00E3o cancelada
-InterruptedErrorText=O Processo manual foi cancelado
-InterruptedErrorTitle=Processo Cancelado
-JavaVMVersion=Java VM
-Language=Linguagem
-Live=Ao vivo
-LoadFormXmlFailedText=Este documento n\u00E3o \u00E9 compativ\u00E9l com este di\u00E1logo.
-LogicDateIsInDays=\u00E9 em exatamente n dias
-LogicDateIsInGEDays=Data >\= hoje + n dias
-LogicDateIsInGEMonths=Data >\= hoje + n meses
-LogicDateIsInLEDays=data >\= hoje + n dias
-LogicDateIsInLEMonths=Data <\= hoje + n Meses
-LogicDateIsInLastDays=foi no \u00FAltimo n dias
-LogicDateIsInLastMonths=foi nos \u00FAltimos n meses
-LogicDateIsInMonths=\u00E9 em exatamente n meses
-LogicDateIsInNextDays=\u00E9 na pr\u00F3xima n dias
-LogicDateIsInNextMonths=nos pr\u00F3ximos n meses
-LogicDateIsNotToday=n\u00E3o \u00E9 hoje
-LogicDateIsToday=\u00E9 hoje
-LogicDateTimeIsInGEHours=Data>\= Agora + n Horas
-LogicDateTimeIsInGEMinutes=data >\= agora + n minutos
-LogicDateTimeIsInLEHours=Data <\= agora + n horas
-LogicDateTimeIsInLEMinutes=Data <\= agora+ n minutos
-LogicDateTimeIsNotNow=n\u00E3o \u00E9 agora
-LogicDateTimeIsNow=\u00E9 agora
-LogicEQ=\=
-LogicEndsWith=termina com
-LogicGE=>\=
-LogicGT=>
-LogicIn=\u00E9
-LogicLE=<\=
-LogicLT=<
-LogicLike=Cont\u00EAm
-LogicNEQ=<>
-LogicNotIn=n\u00E3o \u00E9
-LogicNotLike=n\u00E3o cont\u00EAm
-LogicNotNull=n\u00E3o est\u00E1 vazio
-LogicNull=est\u00E1 vazio
-LogicStartsWith=come\u00E7a com
-LogicTimeIsInGEHours=\u00E9 antes de (horas)
-LogicTimeIsInGEMinutes=\u00E9 antes de (minutos)
-LogicTimeIsInHours=\u00E9 exatamente em (Horas)
-LogicTimeIsInLEHours=\u00E9 depois de (horas)
-LogicTimeIsInMinutes=\u00E9 em exatamente (minutos)
-LogicTimeIsNotNow=n\u00E3o \u00E9 agora
-LogicTimeIsNow=\u00E9 agora
-Login=Login
-LookAndFeel=Aspecto do ambiente operativo
-LookIn=Visualizar
-Month=M\u00EAs
-Name=Nome
-NetErrorInfo=Favor examinar nome, endere\u00E7o e conex\u00E3o do servidor.
-NetErrorText=Servidor n\u00E3o encontrado
-NetErrorTitle=Erro de rede
-NewPassword=Nova password
-No=n\u00E3o
-NoButton=&N\u00E3o
-None=Nenhum
-NumberOfRows=N\u00FAmero de linhas
-OSUser=usu\u00E1rio do sistema
-OSVersion=Vers\u00E3o do Sistema
-Ok=Ok
-OkButton=&Ok
-OkButtonTooltip=Guardar e fechar o regsito
-OldPassword=Password antiga
-Op=Operador
-Open=Aberto
-Password=Senha
-PasswordHasExpiredHeader=Sua senha expirou e deve ser alterada agora.
-PasswordWillExpireHeaderX=Sua senha expira em {0}
-PasswordsDoNotMatch=As duas passwords n\u00E3o correspondem
-Paste=Colar
-Path=Caminho
-Pending=Aguardando...
-Properties=Propriedades
-RepBuildExtract=Preparando dados...
-RepExecAfter=Organizar banco de dados
-RepExecBefore=Preparar banco de dados
-RepUpdate=Processando os dados
-RepeatPassword=Repetir
-RequestProblem=Falha do processo
-ResetButton=Reinicializar
-ResetButtonTooltip=Colocar todos os campos do registo sem valores
-Save=Salvar
-SaveButton=&Salvar
-SaveButtonTooltip=Guardar sem fechar
-Search=Procurar
-SearchButton=&Busca
-SearchButtonTooltip=Inicia busca
-SearchConstraints=Busca restringida
-Server=Servidor
-SmartFindLabel=Texto a procurar
-Source=Fonte
-StatusExportDone=Exporta\u00E7\u00E3o completa
-Style=Modo
-TableName=Tabela
-Timestamp=Marca de tempo
-Today=Hoje
-TooManyRows=Demasiados dados. Por favor limite a procura.
-Update=Actualizar
-UserInterrupted=Cancelado pelo utilizador
-Username=Nome do utilizador
-Value=Valor
-Week=Semana
-WeekShort=SC
-WizardCancelButton=Cancelar
-WizardSuspendButton=&Fechar
-WorkWeek=Dias \uFFFDteis
-Yes=Sim
-YesButton=&Sim
-and=s
-between=Entre
-from=A partir de
-to=a
+All=Todos
+AllStates=Todos
+Apply=Aplicar
+Attribute=Atributo
+Bookmarks=Favoritos
+BookmarksAddMenu=Adicionar aos favoritos
+BookmarksMainMenu=&Favoritos
+BookmarksManageMenu=Organizar favoritos
+BookmarksStartPageMenu=&P\u00E1gina inicial
+BookmarksStartPageMenuClear=&N\u00E3o utilizar p\u00E1gina inicial
+BookmarksStartPageMenuGoto=&Abrir p\u00E1gina inicial
+BookmarksStartPageMenuSet=&Definir esta p\u00E1gina como p\u00E1gina inicial
+ButtonDeselectAll=tirar sele\u00E7\u00E3o de todos
+ButtonSelectAll=Selecioanr tudo
+Calendar_earlier=anterior
+Calendar_later=posterior
+Cancel=Cancelar
+CancelButton=&Cancelar
+CancelButtonTooltip=Fechar sem guardar; com mensagem de confirma\u00E7\u00E3o se necess\u00E1rio.
+ChangePassword=Alterar Password
+Close=Fechar
+CloseButton=&Fechar
+CloseButtonTooltip=Fechar sem guardar.
+Column=Coluna
+Columns=Colunas
+ComposerFieldAggregationLabel=Fun\u00E7\u00E3o
+Condensed=6 colunas
+Configure=Configura\u00E7\u00E3o
+Copy=Copiar
+Criteria=Crit\u00E9rio de procura
+Cut=recortar
+Day=Dia
+DefaultPasswordPolicyText=A senha n\u00E3o \u00E9 compat\u00EDvel com a pol\u00EDtica\:\n\nPol\u00EDtica\:\n- no m\u00EDnimo 8 caracteres (A-Z)\n- no m\u00EDnimo 1 n\u00FAmero (0-9)\n- no m\u00EDnimo 1 s\u00EDmbolo (\!|@|\#|$|%|^|&|*|(|)|_|+|||~|-|)\n- n\u00E3o ter utilizado esta senha nenhuma vez\n- seu nome do usu\u00E1rio n\u00E3o dever\u00E1 fazer parte da senha
+DeleteMenu=Apagar
+Detail=Detalhe
+Details=Detalhes
+EmailFrom=Remetente
+EmailSubject=Assunto
+EmailTo=Para
+Enabled=Ativado
+Error=Erro
+ErrorAndRetryTextDefault=Um erro ocorreu durante a transfer\u00EAncia.
+ErrorTextLogin=Nome do utilizador / Senha
+ErrorTitleLogin=Acesso negado
+ExcelChart_Button_LoadDefaults=Defaults
+ExcelChart_Button_LoadDefaultsHint=Zera esta janela carregando os valores padr\u00F5es
+ExcelChart_Button_LoadProfile=Carregando perfil
+ExcelChart_Button_LoadProfileHint=Carregando configura\u00E7\u00F5es do arquivo XML
+ExcelChart_Button_SaveProfile=salvar perfil
+ExcelChart_Button_SaveProfileHint=Salva as configura\u00E7\u00F5es atuais em um arquivo XML
+ExcelChart_Error_CreatingChartFailed=Falha na cria\u00E7\u00E3o do Gr\u00E1fico
+ExcelChart_Error_ExportingFailed=Falha na exporta\u00E7\u00E3o porque
+ExcelChart_Error_InitializationFailed=Inicializa\u00E7\u00E3o do suporte a classe(s) falhou
+ExcelChart_Error_LoadingProfileFailed=Falha ao carregar perfil porque
+ExcelChart_Error_LoadingTemplateFailed=Falha ao carregar template
+ExcelChart_Error_RetrivingOutlineDataFailed=Falha nos dados de perfil, recuperar
+ExcelChart_Error_SavingProfileFailed=Falha ao salvar perfil porque
+ExcelChart_Error_WrongProfile=O perfil foi criado por um outro esquema
+ExcelChart_Label_AutomaticMode=Modo autom\u00E1tico
+ExcelChart_Label_AutomaticModeHint=Feche Excel e salve automaticamente
+ExcelChart_Label_ChartNumber=N\u00FAmero do Gr\u00E1fico
+ExcelChart_Label_ChartType=Tipo de Gr\u00E1fico
+ExcelChart_Label_FileName=Nome do arquivo
+ExcelChart_Label_FirstRow=Primeira linha
+ExcelChart_Label_Height=altura
+ExcelChart_Label_HistogramMode=Modo de histograma
+ExcelChart_Label_HistogramModeHint=A modalidade histograma combina valores id\u00EAnticos sobre o eixo- X para um.
+ExcelChart_Label_LastRow=\u00FAltima linha
+ExcelChart_Label_Offset=Posi\u00E7\u00E3o
+ExcelChart_Label_SkipNullValues=pular valores nulos no modo histograma
+ExcelChart_Label_SkipNullValuesHint=Se verificado valores nulo sobre o eixo- X ser\u00E3o ignorados, de outra forma elas s\u00E3o combinados para <Unknown>.
+ExcelChart_Label_TemplateName=Template
+ExcelChart_Label_UseCustomFormat=Use formato personalizado
+ExcelChart_Label_UseCustomFormatHint=Se marcado pode indicar a posi\u00E7\u00E3o e o tamanho do gr\u00E1fico
+ExcelChart_Label_UseExistingChart=Use Gr\u00E1fico existente
+ExcelChart_Label_UseExistingChartHint=Se verificado o gr\u00E1fico existente o modelo referido \u00E9 usado.
+ExcelChart_Label_UseSelectiveExport=use exporta\u00E7\u00E3o seletiva
+ExcelChart_Label_UseSelectiveExportHint=Se verificado, apenas as linhas abaixo indicados ser\u00E3o exportadas
+ExcelChart_Label_Width=Largura
+ExcelChart_Label_WorksheetName=Planilha
+ExcelChart_Label_XAxis=Eixo X
+ExcelChart_Label_YAxes=Eixo Y
+ExcelChart_Status_Done=Exporta\u00E7\u00E3o do Gr\u00E1fico do Excel conclu\u00EDda
+ExcelChart_Tab_Advanced=Avan\u00E7ado
+ExcelChart_Tab_Basic=B\u00E1sico
+ExcelChart_Title_MainForm=Exportar para gr\u00E1fico do Excel
+ExcelChart_Type_Area3D=\u00C1rea 3D
+ExcelChart_Type_Area=\u00C1rea
+ExcelChart_Type_AreaStacked3D=Area 3D atraente
+ExcelChart_Type_AreaStacked=Area atraente
+ExcelChart_Type_BarsClustered3D=Barra 3D
+ExcelChart_Type_BarsClustered=barra
+ExcelChart_Type_BarsStacked3D=Barra 3D Atraente
+ExcelChart_Type_BarsStacked=Bars Stacked
+ExcelChart_Type_ColumnsClustered3D=Colunas 3D
+ExcelChart_Type_ColumnsClustered=Colunas
+ExcelChart_Type_ColumnsStacked3D=Coluna 3D Atraente
+ExcelChart_Type_ColumnsStacked=Coluna Atraente
+ExcelChart_Type_Line=linha
+ExcelChart_Type_LineStacked=Linha atraente
+ExcelChart_Type_Pie3D=Pie 3D
+ExcelChart_Type_Pie=Pie
+ExcelChart_Type_PieExploded3D=Pie reprovado 3D
+ExcelChart_Type_PieExploded=Pie reprovado
+ExcelChart_Various_Averaged=m\u00E9dia
+ExcelChart_Various_Column=Column
+ExcelChart_Various_Frequency=Frequ\u00EAncia
+ExcelChart_Various_SummedUp=Somando
+ExcelChart_Various_Unknown=<Desconhecido>
+ExportDate=Exportar data
+ExtendedSearchAddAttributeMenu=Acrescentar uma condi\u00E7\u00E3o...
+ExtendedSearchAddEntityPrefix=tem
+ExtendedSearchAnd=e
+ExtendedSearchEditAttributeMenu=Editar
+ExtendedSearchEntitySuffix=com
+ExtendedSearchNegateMenu=Negado
+ExtendedSearchRemoveAttributeMenu=Remover
+ExtendedSearchRemoveMenu=Remover
+FileExistsOwerwriteQuestion=O ficheiro seleccionado j\u00E1 existe. Deseja substituir?
+FileName=Nome do ficheiro
+FileNotFoundExceptionMessage=Documento n\u00E3o encontrado ou acesso negado.
+FileNotFoundMessage=N\u00E3o consegue encontrar o ficheiro\:
+FileNotFoundTitle=Ficheiro n\u00E3o encontrado
+FilesOfType=Tipo de ficheiro
+FormPrint=Imprimir
+FormSaveChangesQuestion=Quer guardar as altera\u00E7\u00F5es?
+FormStateLoad=Carregar...
+FormStateStore=Salvar
+FormStateStoreAs=Salvar como...
+GlobalBookmarks=Favoritos Globais
+GlobalBookmarksAddMenu=Adicionar &global bookmarks
+Help=Ajuda
+Host=Host
+IOErrorInfo=Favor examinar documentos relacionados e conex\u00E3o do servidor.
+IOErrorText=Erro de comunica\u00E7\u00E3o
+IOErrorTitle=Erro de leitura / ortografia
+Info=Informa\u00E7\u00E3o
+Information=Informa\u00E7\u00E3o
+Interrupted=A\u00E7\u00E3o cancelada
+InterruptedErrorText=O Processo manual foi cancelado
+InterruptedErrorTitle=Processo Cancelado
+JavaVMVersion=Java VM
+Language=Linguagem
+Live=Ao vivo
+LoadFormXmlFailedText=Este documento n\u00E3o \u00E9 compativ\u00E9l com este di\u00E1logo.
+LogicDateIsInDays=\u00E9 em exatamente n dias
+LogicDateIsInGEDays=Data >\= hoje + n dias
+LogicDateIsInGEMonths=Data >\= hoje + n meses
+LogicDateIsInLEDays=data >\= hoje + n dias
+LogicDateIsInLEMonths=Data <\= hoje + n Meses
+LogicDateIsInLastDays=foi no \u00FAltimo n dias
+LogicDateIsInLastMonths=foi nos \u00FAltimos n meses
+LogicDateIsInMonths=\u00E9 em exatamente n meses
+LogicDateIsInNextDays=\u00E9 na pr\u00F3xima n dias
+LogicDateIsInNextMonths=nos pr\u00F3ximos n meses
+LogicDateIsNotToday=n\u00E3o \u00E9 hoje
+LogicDateIsToday=\u00E9 hoje
+LogicDateTimeIsInGEHours=Data>\= Agora + n Horas
+LogicDateTimeIsInGEMinutes=data >\= agora + n minutos
+LogicDateTimeIsInLEHours=Data <\= agora + n horas
+LogicDateTimeIsInLEMinutes=Data <\= agora+ n minutos
+LogicDateTimeIsNotNow=n\u00E3o \u00E9 agora
+LogicDateTimeIsNow=\u00E9 agora
+LogicEQ=\=
+LogicEndsWith=termina com
+LogicGE=>\=
+LogicGT=>
+LogicIn=\u00E9
+LogicLE=<\=
+LogicLT=<
+LogicLike=Cont\u00EAm
+LogicNEQ=<>
+LogicNotIn=n\u00E3o \u00E9
+LogicNotLike=n\u00E3o cont\u00EAm
+LogicNotNull=n\u00E3o est\u00E1 vazio
+LogicNull=est\u00E1 vazio
+LogicStartsWith=come\u00E7a com
+LogicTimeIsInGEHours=\u00E9 antes de (horas)
+LogicTimeIsInGEMinutes=\u00E9 antes de (minutos)
+LogicTimeIsInHours=\u00E9 exatamente em (Horas)
+LogicTimeIsInLEHours=\u00E9 depois de (horas)
+LogicTimeIsInMinutes=\u00E9 em exatamente (minutos)
+LogicTimeIsNotNow=n\u00E3o \u00E9 agora
+LogicTimeIsNow=\u00E9 agora
+Login=Login
+LookAndFeel=Aspecto do ambiente operativo
+LookIn=Visualizar
+Month=M\u00EAs
+Name=Nome
+NetErrorInfo=Favor examinar nome, endere\u00E7o e conex\u00E3o do servidor.
+NetErrorText=Servidor n\u00E3o encontrado
+NetErrorTitle=Erro de rede
+NewPassword=Nova password
+No=n\u00E3o
+NoButton=&N\u00E3o
+None=Nenhum
+NumberOfRows=N\u00FAmero de linhas
+OSUser=usu\u00E1rio do sistema
+OSVersion=Vers\u00E3o do Sistema
+Ok=Ok
+OkButton=&Ok
+OkButtonTooltip=Guardar e fechar o regsito
+OldPassword=Password antiga
+Op=Operador
+Open=Aberto
+Password=Senha
+PasswordHasExpiredHeader=Sua senha expirou e deve ser alterada agora.
+PasswordWillExpireHeaderX=Sua senha expira em {0}
+PasswordsDoNotMatch=As duas passwords n\u00E3o correspondem
+Paste=Colar
+Path=Caminho
+Pending=Aguardando...
+Properties=Propriedades
+RepBuildExtract=Preparando dados...
+RepExecAfter=Organizar banco de dados
+RepExecBefore=Preparar banco de dados
+RepUpdate=Processando os dados
+RepeatPassword=Repetir
+RequestProblem=Falha do processo
+ResetButton=Reinicializar
+ResetButtonTooltip=Colocar todos os campos do registo sem valores
+Save=Salvar
+SaveButton=&Salvar
+SaveButtonTooltip=Guardar sem fechar
+Search=Procurar
+SearchButton=&Busca
+SearchButtonTooltip=Inicia busca
+SearchConstraints=Busca restringida
+Server=Servidor
+SmartFindLabel=Texto a procurar
+Source=Fonte
+StatusExportDone=Exporta\u00E7\u00E3o completa
+Style=Modo
+TableName=Tabela
+Timestamp=Marca de tempo
+Today=Hoje
+TooManyRows=Demasiados dados. Por favor limite a procura.
+Update=Actualizar
+UserInterrupted=Cancelado pelo utilizador
+Username=Nome do utilizador
+Value=Valor
+Week=Semana
+WeekShort=SC
+WizardCancelButton=Cancelar
+WizardSuspendButton=&Fechar
+WorkWeek=Dias \uFFFDteis
+Yes=Sim
+YesButton=&Sim
+and=s
+between=Entre
+from=A partir de
+to=a
diff --git a/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_ru.properties b/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_ru.properties
index 56b4a83169..1522668533 100644
--- a/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_ru.properties
+++ b/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_ru.properties
@@ -1,223 +1,223 @@
-AllStates=\u0412\u0441\u0435
-Apply=\u041F\u0440\u0438\u043C\u0435\u043D\u0438\u0442\u044C
-Attribute=\u0410\u0442\u0440\u0438\u0431\u0443\u0442
-Bookmarks=\u0417\u0430\u043A\u043B\u0430\u0434\u043A\u0438
-BookmarksAddMenu=&\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0432 \u0437\u0430\u043A\u043B\u0430\u0434\u043A\u0438...
-BookmarksMainMenu=&\u0417\u0430\u043A\u043B\u0430\u0434\u043A\u0438
-BookmarksManageMenu=&\u0423\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435 \u0437\u0430\u043A\u043B\u0430\u0434\u043A\u0430\u043C\u0438...
-BookmarksStartPageMenu=&\u041D\u0430\u0447\u0430\u043B\u044C\u043D\u044B\u0439 \u0432\u0438\u0434
-BookmarksStartPageMenuClear=&\u041D\u0435 \u043D\u0430\u0447\u0430\u043B\u044C\u043D\u044B\u0439 \u0432\u0438\u0434
-BookmarksStartPageMenuGoto=&\u041E\u0442\u043A\u0440\u044B\u0442\u044C \u043D\u0430\u0447\u0430\u043B\u044C\u043D\u044B\u0439 \u0432\u0438\u0434
-BookmarksStartPageMenuSet=&\u0423\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C \u0442\u0435\u043A\u0443\u0449\u0438\u0439 \u0432\u0438\u0434 \u043A\u0430\u043A \u043D\u0430\u0447\u0430\u043B\u044C\u043D\u044B\u0439 \u0432\u0438\u0434
-ButtonDeselectAll=\u0421\u043D\u044F\u0442\u044C \u0432\u0441\u0435 \u043E\u0442\u043C\u0435\u0447\u0435\u043D\u043D\u044B\u0435
-ButtonSelectAll=\u041E\u0442\u043C\u0435\u0442\u0438\u0442\u044C \u0432\u0441\u0435
-Calendar_earlier=\u0420\u0430\u043D\u0435\u0435
-Calendar_later=\u041F\u043E\u0437\u0436\u0435
-Cancel=\u041E\u0442\u043C\u0435\u043D\u0430
-CancelButton=&\u041E\u0442\u043C\u0435\u043D\u0438\u0442\u044C
-CancelButtonTooltip=\u0417\u0430\u043A\u0440\u043E\u0439\u0442\u0435 \u0434\u0438\u0430\u043B\u043E\u0433 \u0431\u0435\u0437 \u0441\u043E\u0445\u0440\u0430\u043D\u0435\u043D\u0438\u044F \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u0439; \u0441 \u043F\u043E\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043D\u0438\u0435\u043C \u0435\u0441\u043B\u0438 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044F
-ChangePassword=\u0418\u0437\u043C\u0435\u043D\u0438\u0442\u044C \u043F\u0430\u0440\u043E\u043B\u044C
-CloseButton=&\u0417\u0430\u043A\u0440\u044B\u0442\u044C
-CloseButtonTooltip=\u0417\u0430\u043A\u0440\u043E\u0439\u0442\u0435 \u0434\u0438\u0430\u043B\u043E\u0433 \u0431\u0435\u0437 \u0441\u043E\u0445\u0440\u0430\u043D\u0435\u043D\u0438\u044F \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u0439
-Column=\u0421\u0442\u043E\u043B\u0431\u0435\u0446
-Columns=\u0421\u0442\u043E\u043B\u0431\u0446\u044B
-ComposerFieldAggregationLabel=\u0424\u0443\u043D\u043A\u0446\u0438\u044F
-Condensed=6 \u0441\u0442\u043E\u043B\u0431\u0446\u043E\u0432
-Copy=\u041A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C
-Cut=\u0412\u044B\u0440\u0435\u0437\u0430\u0442\u044C
-Day=\u0414\u0435\u043D\u044C
-DefaultPasswordPolicyText=\u041F\u0430\u0440\u043E\u043B\u044C \u043D\u0435 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043F\u043E\u043B\u0438\u0442\u0438\u043A\u0435 \u0431\u0435\u0437\u043E\u043F\u0430\u0441\u043D\u043E\u0441\u0442\u0438\n\n\u041F\u043E\u043B\u0438\u0442\u0438\u043A\u0430 \u0431\u0435\u0437\u043E\u043F\u0430\u0441\u043D\u043E\u0441\u0442\u0438\:\n- \u043F\u043E \u043A\u0440\u0430\u0439\u043D\u0435\u0439 \u043C\u0435\u0440\u0435 8\u043C\u044C \u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432;\n- \u0434\u043E\u043B\u0436\u043D\u0430 \u0431\u044B\u0442\u044C \u043E\u0434\u043D\u0430 \u0446\u0438\u0444\u0440\u0430 (0-9);\n- \u0434\u043E\u043B\u0436\u0435\u043D \u0431\u044B\u0442\u044C \u043E\u0434\u0438\u043D \u043D\u0435\u0441\u0442\u0430\u043D\u0434\u0430\u0440\u0442\u043D\u044B\u0439 \u0441\u0438\u043C\u0432\u043E\u043B (\!|@|\#|$|%|^|&|*|(|)|_|+|||~|-|)
-EmailFrom=\u041E\u0442
-EmailSubject=\u041F\u0440\u0435\u0434\u043C\u0435\u0442
-EmailTo=\u043A
-Error=\u041E\u0448\u0438\u0431\u043A\u0430
-ErrorAndRetryTextDefault=\u041E\u0448\u0438\u0431\u043A\u0430 \u043F\u0440\u0438 \u043F\u0435\u0440\u0435\u0434\u0430\u0447\u0435 \u0434\u0430\u043D\u043D\u044B\u0445.
-ErrorTextLogin=\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0438\u043C\u044F \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044F/\u043F\u0430\u0440\u043E\u043B\u044C
-ErrorTitleLogin=\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u043B\u043E\u0433\u0438\u043D
-ExcelChart_Button_LoadDefaults=\u041F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E
-ExcelChart_Button_LoadDefaultsHint=\u0418\u043D\u0438\u0446\u0438\u0430\u043B\u0438\u0437\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u044D\u0442\u043E\u0442 \u0434\u0438\u0430\u043B\u043E\u0433 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0432 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u044F \u043F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E.
-ExcelChart_Button_LoadProfile=\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u043F\u0440\u043E\u0444\u0438\u043B\u044C...
-ExcelChart_Button_LoadProfileHint=\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043A\u0438 \u0438\u0437 xml \u0444\u0430\u0439\u043B\u0430.
-ExcelChart_Button_SaveProfile=\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C \u043F\u0440\u043E\u0444\u0438\u043B\u044C...
-ExcelChart_Button_SaveProfileHint=\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C \u0442\u0435\u043A\u0443\u0449\u0438\u0435 \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043A\u0438 \u0432 xml \u0444\u0430\u0439\u043B\u0435.
-ExcelChart_Error_CreatingChartFailed=\u0441\u043E\u0437\u0434\u0430\u043D\u0438\u0435 \u0433\u0440\u0430\u0444\u0438\u043A\u0430 \u043D\u0435\u0443\u0434\u0430\u0447\u043D\u043E.
-ExcelChart_Error_ExportingFailed=\u041E\u0448\u0438\u0431\u043A\u0430 \u044D\u043A\u0441\u043F\u043E\u0440\u0442\u0430 \u043F\u043E \u043F\u0440\u0438\u0447\u0438\u043D\u0435
-ExcelChart_Error_InitializationFailed=\u0438\u043D\u0438\u0446\u0438\u0430\u043B\u0438\u0437\u0430\u0446\u0438\u044F \u043A\u043B\u0430\u0441\u0441\u0430(\u043E\u0432) \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u043A\u0438 \u043F\u043E\u0442\u0435\u0440\u043F\u0435\u043B\u0430 \u043D\u0435\u0443\u0434\u0430\u0447\u0443.
-ExcelChart_Error_LoadingProfileFailed=\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430 \u043F\u0440\u043E\u0444\u0438\u043B\u044F \u043D\u0435\u0443\u0434\u0430\u0447\u043D\u043E \u043F\u043E\u0441\u043A\u043E\u043B\u044C\u043A\u0443
-ExcelChart_Error_LoadingTemplateFailed=\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430 \u0448\u0430\u0431\u043B\u043E\u043D\u0430 \u043D\u0435\u0443\u0434\u0430\u0447\u043D\u043E.
-ExcelChart_Error_RetrivingOutlineDataFailed=\u043F\u043E\u043B\u0443\u0447\u0435\u043D\u0438\u0435 \u0441\u0445\u0435\u043C\u044B \u0434\u0430\u043D\u043D\u044B\u0445 \u043D\u0435\u0443\u0434\u0430\u0447\u043D\u043E.
-ExcelChart_Error_SavingProfileFailed=\u0421\u043E\u0445\u0440\u0430\u043D\u0435\u043D\u0438\u0435 \u043F\u0440\u043E\u0444\u0438\u043B\u044F \u043D\u0435\u0443\u0434\u0430\u0447\u043D\u043E \u043F\u043E\u0441\u043A\u043E\u043B\u044C\u043A\u0443
-ExcelChart_Error_WrongProfile=\u043F\u0440\u043E\u0444\u0438\u043B\u044C \u0431\u044B\u043B \u0441\u043E\u0437\u0434\u0430\u043D \u0434\u043B\u044F \u0434\u0440\u0443\u0433\u043E\u0439 \u0441\u0442\u0440\u0443\u043A\u0442\u0443\u0440\u044B
-ExcelChart_Label_AutomaticMode=\u0410\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u0438\u0439 \u0440\u0435\u0436\u0438\u043C
-ExcelChart_Label_AutomaticModeHint=\u0421\u043A\u0440\u044B\u0442\u044C Excel \u0438 \u0441\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C \u0430\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u0438.
-ExcelChart_Label_ChartNumber=\u041D\u043E\u043C\u0435\u0440 \u0434\u0438\u0430\u0433\u0440\u0430\u043C\u043C\u044B
-ExcelChart_Label_ChartType=\u0422\u0438\u043F \u0434\u0438\u0430\u0433\u0440\u0430\u043C\u043C\u044B
-ExcelChart_Label_FileName=\u0418\u043C\u044F \u0444\u0430\u0439\u043B\u0430
-ExcelChart_Label_FirstRow=\u041F\u0435\u0440\u0432\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430
-ExcelChart_Label_Height=\u0412\u044B\u0441\u043E\u0442\u0430
-ExcelChart_Label_HistogramMode=\u0420\u0435\u0436\u0438\u043C \u0413\u0438\u0441\u0442\u043E\u0433\u0440\u0430\u043C\u043C\u044B
-ExcelChart_Label_HistogramModeHint=\u0420\u0435\u0436\u0438\u043C \u0413\u0438\u0441\u0442\u043E\u0433\u0440\u0430\u043C\u043C\u044B \u043E\u0431\u044A\u0435\u0434\u0438\u043D\u044F\u0435\u0442 \u043E\u0434\u0438\u043D\u0430\u043A\u043E\u0432\u044B\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u044F \u043F\u043E \u043E\u0441\u0438 X
-ExcelChart_Label_LastRow=\u041F\u043E\u0441\u043B\u0435\u0434\u043D\u044F\u044F \u0441\u0442\u0440\u043E\u043A\u0430
-ExcelChart_Label_Offset=\u041F\u043E\u0437\u0438\u0446\u0438\u044F
-ExcelChart_Label_SkipNullValues=\u041F\u0440\u043E\u043F\u0443\u0441\u0442\u0438\u0442\u0435 \u043F\u0443\u0441\u0442\u044B\u0435 \u0432\u0435\u043B\u0438\u0447\u0438\u043D\u044B \u0432 \u0440\u0435\u0436\u0438\u043C\u0435 \u0433\u0438\u0441\u0442\u043E\u0433\u0440\u0430\u043C\u043C\u044B
-ExcelChart_Label_SkipNullValuesHint=\u041F\u0443\u0441\u0442\u044B\u0435 \u0432\u0435\u043B\u0438\u0447\u0438\u043D\u044B \u043D\u0430 X-\u043E\u0441\u044F\u0445 \u0438\u0433\u043D\u043E\u0440\u0438\u0440\u0443\u044E\u0442\u0441\u044F, \u043F\u0440\u043E\u0447\u0438\u0435 \u043E\u0431\u044A\u0435\u0434\u0438\u043D\u044F\u044E\u0442\u0441\u044F \u0432 <Unknown>.\n
-ExcelChart_Label_TemplateName=\u0428\u0430\u0431\u043B\u043E\u043D
-ExcelChart_Label_UseCustomFormat=\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u043D\u0438\u0435 \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C\u0441\u043A\u043E\u0433\u043E \u0444\u043E\u0440\u043C\u0430\u0442\u0430
-ExcelChart_Label_UseCustomFormatHint=\u0415\u0441\u043B\u0438 \u0432\u044B\u0431\u0440\u0430\u043D\u043E, \u0412\u044B \u043C\u043E\u0436\u0435\u0442\u0435 \u0443\u043A\u0430\u0437\u0430\u0442\u044C \u043F\u043E\u0437\u0438\u0446\u0438\u044E \u0434\u0438\u0430\u0433\u0440\u0430\u043C\u043C\u044B \u0438 \u0440\u0430\u0437\u043C\u0435\u0440.
-ExcelChart_Label_UseExistingChart=\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044E\u0449\u0443\u044E \u0434\u0438\u0430\u0433\u0440\u0430\u043C\u043C\u0443.
-ExcelChart_Label_UseExistingChartHint=\u0415\u0441\u043B\u0438 \u0432\u044B\u0431\u0440\u0430\u043D\u043E, \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0435\u0442\u0441\u044F \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044E\u0449\u0430\u044F \u0434\u0438\u0430\u0433\u0440\u0430\u043C\u043C\u0430 \u0432 \u0443\u043A\u0430\u0437\u0430\u043D\u043D\u043E\u043C \u0448\u0430\u0431\u043B\u043E\u043D\u0435.
-ExcelChart_Label_UseSelectiveExport=\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u0432\u044B\u0431\u043E\u0440\u043E\u0447\u043D\u044B\u0439 \u044D\u043A\u0441\u043F\u043E\u0440\u0442.
-ExcelChart_Label_UseSelectiveExportHint=\u0415\u0441\u043B\u0438 \u0432\u044B\u0431\u0440\u0430\u043D\u043E, \u0442\u043E \u044D\u043A\u0441\u043F\u043E\u0440\u0442\u0438\u0440\u0443\u044E\u0442\u0441\u044F \u0442\u043E\u043B\u044C\u043A\u043E \u0442\u0435 \u0441\u0442\u0440\u043E\u043A\u0438, \u043A\u043E\u0442\u043E\u0440\u044B\u0435 \u0443\u043A\u0430\u0437\u0430\u043D\u044B \u043D\u0438\u0436\u0435.
-ExcelChart_Label_Width=\u0428\u0438\u0440\u0438\u043D\u0430
-ExcelChart_Label_WorksheetName=\u0420\u0430\u0431\u043E\u0447\u0438\u0439 \u043B\u0438\u0441\u0442
-ExcelChart_Label_XAxis=X-\u043E\u0441\u044C
-ExcelChart_Label_YAxes=Y-\u043E\u0441\u044C
-ExcelChart_Status_Done=\u042D\u043A\u0441\u043F\u043E\u0440\u0442 \u0434\u0438\u0430\u0433\u0440\u0430\u043C\u043C\u044B Excel \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043D.
-ExcelChart_Tab_Advanced=\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043D\u043D\u043E
-ExcelChart_Tab_Basic=\u041E\u0441\u043D\u043E\u0432\u043D\u043E\u0435
-ExcelChart_Title_MainForm=\u042D\u043A\u0441\u043F\u043E\u0440\u0442 \u0434\u0438\u0430\u0433\u0440\u0430\u043C\u043C\u044B Excel
-ExcelChart_Type_Area3D=\u041E\u0431\u043B\u0430\u0441\u0442\u044C 3D
-ExcelChart_Type_Area=\u041E\u0431\u043B\u0430\u0441\u0442\u044C
-ExcelChart_Type_AreaStacked3D=C\u043A\u043E\u043C\u043F\u043E\u043D\u043E\u0432\u0430\u043D\u043D\u0430\u044F \u043E\u0431\u043B\u0430\u0441\u0442\u044C 3D
-ExcelChart_Type_AreaStacked=C\u043A\u043E\u043C\u043F\u043E\u043D\u043E\u0432\u0430\u043D\u043D\u0430\u044F \u043E\u0431\u043B\u0430\u0441\u0442\u044C
-ExcelChart_Type_BarsClustered3D=\u0421\u0433\u0440\u0443\u043F\u043F\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0435 \u043B\u0438\u043D\u0438\u0438 3D
-ExcelChart_Type_BarsClustered=\u0421\u0433\u0440\u0443\u043F\u043F\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0435 \u043B\u0438\u043D\u0438\u0438
-ExcelChart_Type_BarsStacked3D=C\u043A\u043E\u043C\u043F\u043E\u043D\u043E\u0432\u0430\u043D\u043D\u0430\u044F \u043B\u0438\u043D\u0438\u0438 3D
-ExcelChart_Type_BarsStacked=C\u043A\u043E\u043C\u043F\u043E\u043D\u043E\u0432\u0430\u043D\u043D\u0430\u044F \u043B\u0438\u043D\u0438\u0438
-ExcelChart_Type_ColumnsClustered3D=\u0421\u0433\u0440\u0443\u043F\u043F\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0435 \u043A\u043E\u043B\u043E\u043D\u043A\u0438 3D
-ExcelChart_Type_ColumnsClustered=\u0421\u0433\u0440\u0443\u043F\u043F\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0435 \u043A\u043E\u043B\u043E\u043D\u043A\u0438
-ExcelChart_Type_ColumnsStacked3D=C\u043A\u043E\u043C\u043F\u043E\u043D\u043E\u0432\u0430\u043D\u043D\u044B\u0435 \u043A\u043E\u043B\u043E\u043D\u043A\u0438 3D
-ExcelChart_Type_ColumnsStacked=C\u043A\u043E\u043C\u043F\u043E\u043D\u043E\u0432\u0430\u043D\u043D\u044B\u0435 \u043A\u043E\u043B\u043E\u043D\u043A\u0438
-ExcelChart_Type_Line=\u041B\u0438\u043D\u0438\u044F
-ExcelChart_Type_LineStacked=C\u043A\u043E\u043C\u043F\u043E\u043D\u043E\u0432\u0430\u043D\u043D\u0430\u044F \u043B\u0438\u043D\u0438\u044F
-ExcelChart_Type_Pie3D=\u041D\u0430\u0431\u043E\u0440 \u0441\u043C\u0435\u0448\u0430\u043D\u043D\u043E\u0433\u043E \u0448\u0440\u0438\u0444\u0442\u0430 3D
-ExcelChart_Type_Pie=\u041D\u0430\u0431\u043E\u0440 \u0441\u043C\u0435\u0448\u0430\u043D\u043D\u043E\u0433\u043E \u0448\u0440\u0438\u0444\u0442\u0430
-ExcelChart_Type_PieExploded3D=\u041D\u0430\u0431\u043E\u0440 \u0441\u043C\u0435\u0448\u0430\u043D\u043D\u043E\u0433\u043E \u0448\u0440\u0438\u0444\u0442\u0430 \u043F\u043E \u043E\u0442\u0434\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u0438 3D
-ExcelChart_Type_PieExploded=\u041D\u0430\u0431\u043E\u0440 \u0441\u043C\u0435\u0448\u0430\u043D\u043D\u043E\u0433\u043E \u0448\u0440\u0438\u0444\u0442\u0430 \u043F\u043E \u043E\u0442\u0434\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u0438
-ExcelChart_Various_Averaged=\u0423\u0441\u0440\u0435\u0434\u043D\u0451\u043D\u043D\u044B\u0439
-ExcelChart_Various_Column=\u041A\u043E\u043B\u043E\u043D\u043A\u0430
-ExcelChart_Various_Frequency=\u0427\u0430\u0441\u0442\u043E\u0442\u0430
-ExcelChart_Various_SummedUp=\u041F\u0440\u043E\u0441\u0443\u043C\u043C\u0438\u0440\u043E\u0432\u0430\u043D\u043E
-ExcelChart_Various_Unknown=<\u041D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u043E>
-ExportDate=\u0414\u0430\u0442\u0430 \u044D\u043A\u0441\u043F\u043E\u0440\u0442\u0430
-ExtendedSearchAddAttributeMenu=\u0414\u043E\u0431\u0430\u0432\u043B\u0435\u043D\u0438\u0435 \u0443\u0441\u043B\u043E\u0432\u0438\u044F \u043E\u0433\u0440\u0430\u043D\u0438\u0447\u0435\u043D\u0438\u044F...
-ExtendedSearchAddEntityPrefix=\u0438\u043C\u0435\u0435\u0442
-ExtendedSearchAnd=\u0438
-ExtendedSearchEditAttributeMenu=\u0420\u0435\u0434\u0430\u043A\u0442\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u0435..
-ExtendedSearchEntitySuffix=\u0441
-ExtendedSearchNegateMenu=\u0421\u0434\u0435\u043B\u0430\u0442\u044C \u043E\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043B\u044C\u043D\u044B\u043C
-ExtendedSearchRemoveAttributeMenu=\u0423\u0434\u0430\u043B\u0438\u0442\u044C
-ExtendedSearchRemoveMenu=\u0423\u0434\u0430\u043B\u0438\u0442\u044C
-FileExistsOwerwriteQuestion=\u0412\u044B\u0431\u0440\u0430\u043D\u043D\u044B\u0439 \u0444\u0430\u0439\u043B \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442. \u041F\u0435\u0440\u0435\u043F\u0438\u0441\u0430\u0442\u044C \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044E\u0449\u0438\u0439 \u0444\u0430\u0439\u043B?
-FileName=\u0418\u043C\u044F \u0444\u0430\u0439\u043B\u0430
-FileNotFoundMessage=\u041D\u0435 \u043C\u043E\u0433\u0443 \u043D\u0430\u0439\u0442\u0438 \u0444\u0430\u0439\u043B\:
-FileNotFoundTitle=\u0424\u0430\u0439\u043B \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D
-FilesOfType=\u0422\u0438\u043F\u0430 \u0444\u0430\u0439\u043B\u0430
-FormPrint=\u041F\u0435\u0447\u0430\u0442\u044C
-FormSaveChangesQuestion=\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u044F?
-FormStateLoad=\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430...
-FormStateStore=\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C
-FormStateStoreAs=\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C \u043A\u0430\u043A...
-GlobalBookmarks=\u0413\u043B\u043E\u0431\u0430\u043B\u044C\u043D\u044B\u0435 \u0437\u0430\u043A\u043B\u0430\u0434\u043A\u0438
-GlobalBookmarksAddMenu=\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0432 &\u0433\u043B\u043E\u0431\u0430\u043B\u044C\u043D\u044B\u0435 \u0437\u0430\u043A\u043B\u0430\u0434\u043A\u0438
-Help=\u041F\u043E\u043C\u043E\u0449\u044C
-IOErrorInfo=\u041F\u0440\u043E\u0432\u0435\u0440\u044C\u0442\u0435 \u0444\u0430\u0439\u043B\u044B \u0438 \u0441\u043E\u0441\u0442\u043E\u044F\u043D\u0438\u0435 \u043F\u043E\u0434\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u044F.
-IOErrorText=\u041E\u0448\u0438\u0431\u043A\u0430 \u043F\u043E\u0434\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u044F
-IOErrorTitle=\u041E\u0448\u0438\u0431\u043A\u0430 \u0447\u0442\u0435\u043D\u0438\u044F/\u0437\u0430\u043F\u0438\u0441\u0438
-Info=\u0418\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u044F
-Interrupted=\u041F\u0440\u0435\u0440\u0432\u0430\u043D\u043E
-InterruptedErrorText=\u041F\u0440\u043E\u0446\u0435\u0441\u0441 \u0431\u044B\u043B \u043F\u0440\u0435\u0440\u0432\u0430\u043D \u0432\u0440\u0443\u0447\u043D\u0443\u044E.
-InterruptedErrorTitle=\u041F\u0440\u043E\u0446\u0435\u0441\u0441 \u043E\u0442\u043C\u0435\u043D\u0435\u043D.
-JavaVMVersion=Java \u0412\u0438\u0440\u0442\u0443\u0430\u043B\u044C\u043D\u0430\u044F \u043C\u0430\u0448\u0438\u043D\u0430
-Language=\u042F\u0437\u044B\u043A
-LoadFormXmlFailedText=\u0414\u0430\u043D\u043D\u044B\u0439 \u0444\u0430\u0439\u043B \u043D\u0435 \u0441\u043E\u0432\u043C\u0435\u0441\u0442\u0438\u043C \u0441 \u044D\u0442\u0438\u043C \u0434\u0438\u0430\u043B\u043E\u0433\u043E\u043C
-LogicDateIsInDays=\u0442\u043E\u0447\u043D\u043E \u0432 n \u0434\u043D\u0435\u0439
-LogicDateIsInGEDays=\u0414\u0430\u0442\u0430 >\= \u0441\u0435\u0433\u043E\u0434\u043D\u044F + n \u0434\u043D\u0435\u0439
-LogicDateIsInGEMonths=\u0414\u0430\u0442\u0430 >\= \u0441\u0435\u0433\u043E\u0434\u043D\u044F + n \u043C\u0435\u0441\u044F\u0446\u0435\u0432
-LogicDateIsInLEDays=\u0414\u0430\u0442\u0430 <\= \u0441\u0435\u0433\u043E\u0434\u043D\u044F + n \u0434\u043D\u0435\u0439
-LogicDateIsInLEMonths=\u0414\u0430\u0442\u0430 <\= \u0441\u0435\u0433\u043E\u0434\u043D\u044F + n \u043C\u0435\u0441\u044F\u0446\u0435\u0432
-LogicDateIsInLastDays=\u0431\u044B\u043B\u043E \u0432 \u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0435 n \u0434\u043D\u0435\u0439
-LogicDateIsInLastMonths=\u0431\u044B\u043B\u043E \u0432 \u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0435 n \u043C\u0435\u0441\u044F\u0446\u0435\u0432
-LogicDateIsInMonths=\u0442\u043E\u0447\u043D\u043E \u0432 n \u043C\u0435\u0441\u044F\u0446\u0435\u0432
-LogicDateIsInNextDays=\u0431\u044B\u043B\u043E \u0432 \u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0438\u0435 n \u0434\u043D\u0435\u0439
-LogicDateIsInNextMonths=\u0431\u044B\u043B\u043E \u0432 \u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0438\u0435 n \u043C\u0435\u0441\u044F\u0446\u0435\u0432
-LogicDateIsNotToday=\u043D\u0435 \u0441\u0435\u0433\u043E\u0434\u043D\u044F
-LogicDateIsToday=\u0441\u0435\u0433\u043E\u0434\u043D\u044F
-LogicDateTimeIsInGEHours=\u0414\u0430\u0442\u0430 >\= \u0441\u0435\u0439\u0447\u0430\u0441 + n \u0447\u0430\u0441\u043E\u0432
-LogicDateTimeIsInGEMinutes=\u0414\u0430\u0442\u0430 >\= \u0441\u0435\u0439\u0447\u0430\u0441 + n \u043C\u0438\u043D\u0443\u0442
-LogicDateTimeIsInLEHours=\u0414\u0430\u0442\u0430 <\= \u0441\u0435\u0439\u0447\u0430\u0441 + n \u0447\u0430\u0441\u043E\u0432
-LogicDateTimeIsInLEMinutes=\u0414\u0430\u0442\u0430 <\= \u0441\u0435\u0439\u0447\u0430\u0441 + n \u043C\u0438\u043D\u0443\u0442
-LogicDateTimeIsNotNow=\u043D\u0435 \u0441\u0435\u0439\u0447\u0430\u0441
-LogicDateTimeIsNow=\u0441\u0435\u0439\u0447\u0430\u0441
-LogicEQ=\=
-LogicEndsWith=\u0417\u0430\u043A\u0430\u043D\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044F \u043D\u0430
-LogicGE=>\=
-LogicGT=>
-LogicLE=<\=
-LogicLT=<
-LogicLike=\u0441\u043E\u0434\u0435\u0440\u0436\u0438\u0442
-LogicNEQ=<>
-LogicNotIn=\u043D\u0435 \u044F\u0432\u043B\u044F\u0435\u0442\u0441\u044F
-LogicNotLike=\u043D\u0435 \u0441\u043E\u0434\u0435\u0440\u0436\u0438\u0442
-LogicNotNull=\u043D\u0435 \u043F\u0443\u0441\u0442\u043E
-LogicNull=\u043F\u0443\u0441\u0442\u043E
-LogicStartsWith=\u043D\u0430\u0447\u0438\u043D\u0430\u0435\u0442\u0441\u044F \u0441
-LogicTimeIsInGEHours=\u044F\u0432\u043B\u044F\u0435\u0442\u0441\u044F \u043D\u0430\u0438\u0431\u043E\u043B\u0435\u0435 \u0440\u0430\u043D\u043D\u0438\u043C (\u0447\u0430\u0441\u044B)
-LogicTimeIsInGEMinutes=\u044F\u0432\u043B\u044F\u0435\u0442\u0441\u044F \u043D\u0430\u0438\u0431\u043E\u043B\u0435\u0435 \u0440\u0430\u043D\u043D\u0438\u043C (\u043C\u0438\u043D\u0443\u0442\u044B)
-LogicTimeIsInHours=\u0432 \u0442\u043E\u0447\u043D\u043E\u0441\u0442\u0438 (\u0447\u0430\u0441\u044B)
-LogicTimeIsInLEHours=\u044F\u0432\u043B\u044F\u0435\u0442\u0441\u044F \u043D\u0430\u0438\u0431\u043E\u043B\u0435\u0435 \u043F\u043E\u0437\u0434\u043D\u0438\u043C (\u0447\u0430\u0441\u044B)
-LogicTimeIsInLEMinutes=\u044F\u0432\u043B\u044F\u0435\u0442\u0441\u044F \u043D\u0430\u0438\u0431\u043E\u043B\u0435\u0435 \u043F\u043E\u0437\u0434\u043D\u0438\u043C (\u043C\u0438\u043D\u0443\u0442\u044B)
-LogicTimeIsInMinutes=\u044F\u0432\u043B\u044F\u0435\u0442\u0441\u044F \u0432 \u0442\u043E\u0447\u043D\u043E\u0441\u0442\u0438 (\u043C\u0438\u043D\u0443\u0442\u044B)
-LogicTimeIsNotNow=\u043D\u0435 \u0441\u0435\u0439\u0447\u0430\u0441
-LogicTimeIsNow=\u0441\u0435\u0439\u0447\u0430\u0441
-Login=\u0412\u0445\u043E\u0434 \u0432 \u0441\u0438\u0441\u0442\u0435\u043C\u0443
-LookIn=\u041F\u0440\u043E\u0441\u043C\u043E\u0442\u0440\u0435\u0442\u044C
-Month=\u041C\u0435\u0441\u044F\u0446
-Name=\u0418\u043C\u044F
-NetErrorInfo=\u041F\u0440\u043E\u0432\u0435\u0440\u044C\u0442\u0435 \u0438\u043C\u044F \u0441\u0435\u0440\u0432\u0435\u0440\u0430, URL \u0438 \u0441\u043E\u0441\u0442\u043E\u044F\u043D\u0438\u0435 \u043F\u043E\u0434\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u044F.
-NetErrorText=\u0421\u0435\u0440\u0432\u0435\u0440 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D
-NetErrorTitle=\u041E\u0448\u0438\u0431\u043A\u0430 \u0441\u0435\u0442\u0435\u0432\u043E\u0433\u043E \u043F\u043E\u0434\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u044F
-NewPassword=\u041D\u043E\u0432\u044B\u0439 \u043F\u0430\u0440\u043E\u043B\u044C
-No=\u041D\u0435\u0442
-NoButton=&\u041D\u0435\u0442
-NumberOfRows=\u0427\u0438\u0441\u043B\u043E \u0441\u0442\u0440\u043E\u043A
-OSUser=\u0421\u0438\u0441\u0442\u0435\u043C\u043D\u044B\u0439 \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C
-OSVersion=\u0412\u0435\u0440\u0441\u0438\u044F \u0441\u0438\u0441\u0442\u0435\u043C\u044B
-Ok=\u0414\u0430
-OkButton=&Ok
-OkButtonTooltip=\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u0435 \u0438 \u0437\u0430\u043A\u0440\u043E\u0439\u0442\u0435 \u0434\u0438\u0430\u043B\u043E\u0433
-OldPassword=\u041F\u0440\u0435\u0436\u043D\u0438\u0439 \u043F\u0430\u0440\u043E\u043B\u044C
-Op=\u041E\u043F\u0435\u0440\u0430\u0442\u043E\u0440
-Open=\u041E\u0442\u043A\u0440\u044B\u0442\u044C
-Password=\u041F\u0430\u0440\u043E\u043B\u044C
-PasswordsDoNotMatch=\u041F\u0430\u0440\u043E\u043B\u0438 \u043D\u0435 \u0441\u043E\u0432\u043F\u0430\u0434\u0430\u044E\u0442
-Paste=\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u044C
-Path=\u041F\u0443\u0442\u044C
-RepeatPassword=\u041F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u044C
-ResetButton=&\u0421\u0431\u0440\u043E\u0441/\u0412\u0435\u043D\u0443\u0442\u044C\u0441\u044F \u043A \u0438\u0441\u0445\u043E\u0434\u043D\u043E\u043C\u0443
-ResetButtonTooltip=\u0423\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C \u043F\u0443\u0441\u0442\u044B\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u044F \u0432 \u0434\u0438\u0430\u043B\u043E\u0433\u0435
-Save=\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C
-SaveButton=&\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C
-SaveButtonTooltip=\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C \u0434\u0438\u0430\u043B\u043E\u0433 \u0431\u0435\u0437 \u0437\u0430\u043A\u0440\u044B\u0442\u0438\u044F
-SearchButton=&\u041F\u043E\u0438\u0441\u043A
-SearchButtonTooltip=\u0417\u0430\u043A\u0440\u044B\u0442\u044C \u0434\u0438\u0430\u043B\u043E\u0433 \u0438 \u043D\u0430\u0447\u0430\u0442\u044C \u043F\u043E\u0438\u0441\u043A
-SearchConstraints=\u0423\u0441\u043B\u043E\u0432\u0438\u0435 \u043F\u043E\u0438\u0441\u043A\u0430
-Server=\u0421\u0435\u0440\u0432\u0435\u0440
-SmartFindLabel=\u0422\u0435\u043A\u0441\u0442 \u043F\u043E\u0438\u0441\u043A\u0430
-StatusExportDone=\u042D\u043A\u0441\u043F\u043E\u0440\u0442 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043D
-Today=\u0421\u0435\u0433\u043E\u0434\u043D\u044F
-TooManyRows=\u0411\u043E\u043B\u044C\u0448\u043E\u0439 \u043D\u0430\u0431\u043E\u0440 \u0434\u0430\u043D\u043D\u044B\u0445. \u041F\u043E\u0436\u0430\u043B\u0443\u0439\u0441\u0442\u0430 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0439\u0442\u0435 \u043F\u0430\u043D\u0435\u043B\u044C \u043F\u043E\u0438\u0441\u043A\u0430, \u0443\u043C\u0435\u043D\u044C\u0448\u0438\u0432 \u043A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u043E\u0432.
-Update=\u041E\u0431\u043D\u043E\u0432\u0438\u0442\u044C
-UserInterrupted=\u041E\u0442\u043C\u0435\u043D\u0435\u043D\u043E \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u0435\u043C
-Username=\u0418\u043C\u044F \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044F
-Value=\u0417\u043D\u0430\u0447\u0435\u043D\u0438\u0435
-Week=\u041D\u0435\u0434\u0435\u043B\u044F
-WeekShort=\u0421\u043E\u043A\u0440\u0430\u0449\u0435\u043D\u043D\u0430\u044F \u043D\u0435\u0434\u0435\u043B\u044F
-WizardCancelButton=\u041E\u0442\u043C\u0435\u043D\u0430
-WizardSuspendButton=&\u0417\u0430\u043A\u0440\u044B\u0442\u0438\u0435
-WorkWeek=\u0420\u0430\u0431\u043E\u0447\u0430\u044F \u043D\u0435\u0434\u0435\u043B\u044F
-Yes=\u0414\u0430
-YesButton=&\u0414\u0430
-and=\u0438
-from=\u043E\u0442
-to=\u043A
+AllStates=\u0412\u0441\u0435
+Apply=\u041F\u0440\u0438\u043C\u0435\u043D\u0438\u0442\u044C
+Attribute=\u0410\u0442\u0440\u0438\u0431\u0443\u0442
+Bookmarks=\u0417\u0430\u043A\u043B\u0430\u0434\u043A\u0438
+BookmarksAddMenu=&\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0432 \u0437\u0430\u043A\u043B\u0430\u0434\u043A\u0438...
+BookmarksMainMenu=&\u0417\u0430\u043A\u043B\u0430\u0434\u043A\u0438
+BookmarksManageMenu=&\u0423\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435 \u0437\u0430\u043A\u043B\u0430\u0434\u043A\u0430\u043C\u0438...
+BookmarksStartPageMenu=&\u041D\u0430\u0447\u0430\u043B\u044C\u043D\u044B\u0439 \u0432\u0438\u0434
+BookmarksStartPageMenuClear=&\u041D\u0435 \u043D\u0430\u0447\u0430\u043B\u044C\u043D\u044B\u0439 \u0432\u0438\u0434
+BookmarksStartPageMenuGoto=&\u041E\u0442\u043A\u0440\u044B\u0442\u044C \u043D\u0430\u0447\u0430\u043B\u044C\u043D\u044B\u0439 \u0432\u0438\u0434
+BookmarksStartPageMenuSet=&\u0423\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C \u0442\u0435\u043A\u0443\u0449\u0438\u0439 \u0432\u0438\u0434 \u043A\u0430\u043A \u043D\u0430\u0447\u0430\u043B\u044C\u043D\u044B\u0439 \u0432\u0438\u0434
+ButtonDeselectAll=\u0421\u043D\u044F\u0442\u044C \u0432\u0441\u0435 \u043E\u0442\u043C\u0435\u0447\u0435\u043D\u043D\u044B\u0435
+ButtonSelectAll=\u041E\u0442\u043C\u0435\u0442\u0438\u0442\u044C \u0432\u0441\u0435
+Calendar_earlier=\u0420\u0430\u043D\u0435\u0435
+Calendar_later=\u041F\u043E\u0437\u0436\u0435
+Cancel=\u041E\u0442\u043C\u0435\u043D\u0430
+CancelButton=&\u041E\u0442\u043C\u0435\u043D\u0438\u0442\u044C
+CancelButtonTooltip=\u0417\u0430\u043A\u0440\u043E\u0439\u0442\u0435 \u0434\u0438\u0430\u043B\u043E\u0433 \u0431\u0435\u0437 \u0441\u043E\u0445\u0440\u0430\u043D\u0435\u043D\u0438\u044F \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u0439; \u0441 \u043F\u043E\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043D\u0438\u0435\u043C \u0435\u0441\u043B\u0438 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044F
+ChangePassword=\u0418\u0437\u043C\u0435\u043D\u0438\u0442\u044C \u043F\u0430\u0440\u043E\u043B\u044C
+CloseButton=&\u0417\u0430\u043A\u0440\u044B\u0442\u044C
+CloseButtonTooltip=\u0417\u0430\u043A\u0440\u043E\u0439\u0442\u0435 \u0434\u0438\u0430\u043B\u043E\u0433 \u0431\u0435\u0437 \u0441\u043E\u0445\u0440\u0430\u043D\u0435\u043D\u0438\u044F \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u0439
+Column=\u0421\u0442\u043E\u043B\u0431\u0435\u0446
+Columns=\u0421\u0442\u043E\u043B\u0431\u0446\u044B
+ComposerFieldAggregationLabel=\u0424\u0443\u043D\u043A\u0446\u0438\u044F
+Condensed=6 \u0441\u0442\u043E\u043B\u0431\u0446\u043E\u0432
+Copy=\u041A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C
+Cut=\u0412\u044B\u0440\u0435\u0437\u0430\u0442\u044C
+Day=\u0414\u0435\u043D\u044C
+DefaultPasswordPolicyText=\u041F\u0430\u0440\u043E\u043B\u044C \u043D\u0435 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043F\u043E\u043B\u0438\u0442\u0438\u043A\u0435 \u0431\u0435\u0437\u043E\u043F\u0430\u0441\u043D\u043E\u0441\u0442\u0438\n\n\u041F\u043E\u043B\u0438\u0442\u0438\u043A\u0430 \u0431\u0435\u0437\u043E\u043F\u0430\u0441\u043D\u043E\u0441\u0442\u0438\:\n- \u043F\u043E \u043A\u0440\u0430\u0439\u043D\u0435\u0439 \u043C\u0435\u0440\u0435 8\u043C\u044C \u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432;\n- \u0434\u043E\u043B\u0436\u043D\u0430 \u0431\u044B\u0442\u044C \u043E\u0434\u043D\u0430 \u0446\u0438\u0444\u0440\u0430 (0-9);\n- \u0434\u043E\u043B\u0436\u0435\u043D \u0431\u044B\u0442\u044C \u043E\u0434\u0438\u043D \u043D\u0435\u0441\u0442\u0430\u043D\u0434\u0430\u0440\u0442\u043D\u044B\u0439 \u0441\u0438\u043C\u0432\u043E\u043B (\!|@|\#|$|%|^|&|*|(|)|_|+|||~|-|)
+EmailFrom=\u041E\u0442
+EmailSubject=\u041F\u0440\u0435\u0434\u043C\u0435\u0442
+EmailTo=\u043A
+Error=\u041E\u0448\u0438\u0431\u043A\u0430
+ErrorAndRetryTextDefault=\u041E\u0448\u0438\u0431\u043A\u0430 \u043F\u0440\u0438 \u043F\u0435\u0440\u0435\u0434\u0430\u0447\u0435 \u0434\u0430\u043D\u043D\u044B\u0445.
+ErrorTextLogin=\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0438\u043C\u044F \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044F/\u043F\u0430\u0440\u043E\u043B\u044C
+ErrorTitleLogin=\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u043B\u043E\u0433\u0438\u043D
+ExcelChart_Button_LoadDefaults=\u041F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E
+ExcelChart_Button_LoadDefaultsHint=\u0418\u043D\u0438\u0446\u0438\u0430\u043B\u0438\u0437\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u044D\u0442\u043E\u0442 \u0434\u0438\u0430\u043B\u043E\u0433 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0432 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u044F \u043F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E.
+ExcelChart_Button_LoadProfile=\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u043F\u0440\u043E\u0444\u0438\u043B\u044C...
+ExcelChart_Button_LoadProfileHint=\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043A\u0438 \u0438\u0437 xml \u0444\u0430\u0439\u043B\u0430.
+ExcelChart_Button_SaveProfile=\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C \u043F\u0440\u043E\u0444\u0438\u043B\u044C...
+ExcelChart_Button_SaveProfileHint=\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C \u0442\u0435\u043A\u0443\u0449\u0438\u0435 \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043A\u0438 \u0432 xml \u0444\u0430\u0439\u043B\u0435.
+ExcelChart_Error_CreatingChartFailed=\u0441\u043E\u0437\u0434\u0430\u043D\u0438\u0435 \u0433\u0440\u0430\u0444\u0438\u043A\u0430 \u043D\u0435\u0443\u0434\u0430\u0447\u043D\u043E.
+ExcelChart_Error_ExportingFailed=\u041E\u0448\u0438\u0431\u043A\u0430 \u044D\u043A\u0441\u043F\u043E\u0440\u0442\u0430 \u043F\u043E \u043F\u0440\u0438\u0447\u0438\u043D\u0435
+ExcelChart_Error_InitializationFailed=\u0438\u043D\u0438\u0446\u0438\u0430\u043B\u0438\u0437\u0430\u0446\u0438\u044F \u043A\u043B\u0430\u0441\u0441\u0430(\u043E\u0432) \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u043A\u0438 \u043F\u043E\u0442\u0435\u0440\u043F\u0435\u043B\u0430 \u043D\u0435\u0443\u0434\u0430\u0447\u0443.
+ExcelChart_Error_LoadingProfileFailed=\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430 \u043F\u0440\u043E\u0444\u0438\u043B\u044F \u043D\u0435\u0443\u0434\u0430\u0447\u043D\u043E \u043F\u043E\u0441\u043A\u043E\u043B\u044C\u043A\u0443
+ExcelChart_Error_LoadingTemplateFailed=\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430 \u0448\u0430\u0431\u043B\u043E\u043D\u0430 \u043D\u0435\u0443\u0434\u0430\u0447\u043D\u043E.
+ExcelChart_Error_RetrivingOutlineDataFailed=\u043F\u043E\u043B\u0443\u0447\u0435\u043D\u0438\u0435 \u0441\u0445\u0435\u043C\u044B \u0434\u0430\u043D\u043D\u044B\u0445 \u043D\u0435\u0443\u0434\u0430\u0447\u043D\u043E.
+ExcelChart_Error_SavingProfileFailed=\u0421\u043E\u0445\u0440\u0430\u043D\u0435\u043D\u0438\u0435 \u043F\u0440\u043E\u0444\u0438\u043B\u044F \u043D\u0435\u0443\u0434\u0430\u0447\u043D\u043E \u043F\u043E\u0441\u043A\u043E\u043B\u044C\u043A\u0443
+ExcelChart_Error_WrongProfile=\u043F\u0440\u043E\u0444\u0438\u043B\u044C \u0431\u044B\u043B \u0441\u043E\u0437\u0434\u0430\u043D \u0434\u043B\u044F \u0434\u0440\u0443\u0433\u043E\u0439 \u0441\u0442\u0440\u0443\u043A\u0442\u0443\u0440\u044B
+ExcelChart_Label_AutomaticMode=\u0410\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u0438\u0439 \u0440\u0435\u0436\u0438\u043C
+ExcelChart_Label_AutomaticModeHint=\u0421\u043A\u0440\u044B\u0442\u044C Excel \u0438 \u0441\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C \u0430\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u0438.
+ExcelChart_Label_ChartNumber=\u041D\u043E\u043C\u0435\u0440 \u0434\u0438\u0430\u0433\u0440\u0430\u043C\u043C\u044B
+ExcelChart_Label_ChartType=\u0422\u0438\u043F \u0434\u0438\u0430\u0433\u0440\u0430\u043C\u043C\u044B
+ExcelChart_Label_FileName=\u0418\u043C\u044F \u0444\u0430\u0439\u043B\u0430
+ExcelChart_Label_FirstRow=\u041F\u0435\u0440\u0432\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430
+ExcelChart_Label_Height=\u0412\u044B\u0441\u043E\u0442\u0430
+ExcelChart_Label_HistogramMode=\u0420\u0435\u0436\u0438\u043C \u0413\u0438\u0441\u0442\u043E\u0433\u0440\u0430\u043C\u043C\u044B
+ExcelChart_Label_HistogramModeHint=\u0420\u0435\u0436\u0438\u043C \u0413\u0438\u0441\u0442\u043E\u0433\u0440\u0430\u043C\u043C\u044B \u043E\u0431\u044A\u0435\u0434\u0438\u043D\u044F\u0435\u0442 \u043E\u0434\u0438\u043D\u0430\u043A\u043E\u0432\u044B\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u044F \u043F\u043E \u043E\u0441\u0438 X
+ExcelChart_Label_LastRow=\u041F\u043E\u0441\u043B\u0435\u0434\u043D\u044F\u044F \u0441\u0442\u0440\u043E\u043A\u0430
+ExcelChart_Label_Offset=\u041F\u043E\u0437\u0438\u0446\u0438\u044F
+ExcelChart_Label_SkipNullValues=\u041F\u0440\u043E\u043F\u0443\u0441\u0442\u0438\u0442\u0435 \u043F\u0443\u0441\u0442\u044B\u0435 \u0432\u0435\u043B\u0438\u0447\u0438\u043D\u044B \u0432 \u0440\u0435\u0436\u0438\u043C\u0435 \u0433\u0438\u0441\u0442\u043E\u0433\u0440\u0430\u043C\u043C\u044B
+ExcelChart_Label_SkipNullValuesHint=\u041F\u0443\u0441\u0442\u044B\u0435 \u0432\u0435\u043B\u0438\u0447\u0438\u043D\u044B \u043D\u0430 X-\u043E\u0441\u044F\u0445 \u0438\u0433\u043D\u043E\u0440\u0438\u0440\u0443\u044E\u0442\u0441\u044F, \u043F\u0440\u043E\u0447\u0438\u0435 \u043E\u0431\u044A\u0435\u0434\u0438\u043D\u044F\u044E\u0442\u0441\u044F \u0432 <Unknown>.\n
+ExcelChart_Label_TemplateName=\u0428\u0430\u0431\u043B\u043E\u043D
+ExcelChart_Label_UseCustomFormat=\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u043D\u0438\u0435 \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C\u0441\u043A\u043E\u0433\u043E \u0444\u043E\u0440\u043C\u0430\u0442\u0430
+ExcelChart_Label_UseCustomFormatHint=\u0415\u0441\u043B\u0438 \u0432\u044B\u0431\u0440\u0430\u043D\u043E, \u0412\u044B \u043C\u043E\u0436\u0435\u0442\u0435 \u0443\u043A\u0430\u0437\u0430\u0442\u044C \u043F\u043E\u0437\u0438\u0446\u0438\u044E \u0434\u0438\u0430\u0433\u0440\u0430\u043C\u043C\u044B \u0438 \u0440\u0430\u0437\u043C\u0435\u0440.
+ExcelChart_Label_UseExistingChart=\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044E\u0449\u0443\u044E \u0434\u0438\u0430\u0433\u0440\u0430\u043C\u043C\u0443.
+ExcelChart_Label_UseExistingChartHint=\u0415\u0441\u043B\u0438 \u0432\u044B\u0431\u0440\u0430\u043D\u043E, \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0435\u0442\u0441\u044F \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044E\u0449\u0430\u044F \u0434\u0438\u0430\u0433\u0440\u0430\u043C\u043C\u0430 \u0432 \u0443\u043A\u0430\u0437\u0430\u043D\u043D\u043E\u043C \u0448\u0430\u0431\u043B\u043E\u043D\u0435.
+ExcelChart_Label_UseSelectiveExport=\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u0432\u044B\u0431\u043E\u0440\u043E\u0447\u043D\u044B\u0439 \u044D\u043A\u0441\u043F\u043E\u0440\u0442.
+ExcelChart_Label_UseSelectiveExportHint=\u0415\u0441\u043B\u0438 \u0432\u044B\u0431\u0440\u0430\u043D\u043E, \u0442\u043E \u044D\u043A\u0441\u043F\u043E\u0440\u0442\u0438\u0440\u0443\u044E\u0442\u0441\u044F \u0442\u043E\u043B\u044C\u043A\u043E \u0442\u0435 \u0441\u0442\u0440\u043E\u043A\u0438, \u043A\u043E\u0442\u043E\u0440\u044B\u0435 \u0443\u043A\u0430\u0437\u0430\u043D\u044B \u043D\u0438\u0436\u0435.
+ExcelChart_Label_Width=\u0428\u0438\u0440\u0438\u043D\u0430
+ExcelChart_Label_WorksheetName=\u0420\u0430\u0431\u043E\u0447\u0438\u0439 \u043B\u0438\u0441\u0442
+ExcelChart_Label_XAxis=X-\u043E\u0441\u044C
+ExcelChart_Label_YAxes=Y-\u043E\u0441\u044C
+ExcelChart_Status_Done=\u042D\u043A\u0441\u043F\u043E\u0440\u0442 \u0434\u0438\u0430\u0433\u0440\u0430\u043C\u043C\u044B Excel \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043D.
+ExcelChart_Tab_Advanced=\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043D\u043D\u043E
+ExcelChart_Tab_Basic=\u041E\u0441\u043D\u043E\u0432\u043D\u043E\u0435
+ExcelChart_Title_MainForm=\u042D\u043A\u0441\u043F\u043E\u0440\u0442 \u0434\u0438\u0430\u0433\u0440\u0430\u043C\u043C\u044B Excel
+ExcelChart_Type_Area3D=\u041E\u0431\u043B\u0430\u0441\u0442\u044C 3D
+ExcelChart_Type_Area=\u041E\u0431\u043B\u0430\u0441\u0442\u044C
+ExcelChart_Type_AreaStacked3D=C\u043A\u043E\u043C\u043F\u043E\u043D\u043E\u0432\u0430\u043D\u043D\u0430\u044F \u043E\u0431\u043B\u0430\u0441\u0442\u044C 3D
+ExcelChart_Type_AreaStacked=C\u043A\u043E\u043C\u043F\u043E\u043D\u043E\u0432\u0430\u043D\u043D\u0430\u044F \u043E\u0431\u043B\u0430\u0441\u0442\u044C
+ExcelChart_Type_BarsClustered3D=\u0421\u0433\u0440\u0443\u043F\u043F\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0435 \u043B\u0438\u043D\u0438\u0438 3D
+ExcelChart_Type_BarsClustered=\u0421\u0433\u0440\u0443\u043F\u043F\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0435 \u043B\u0438\u043D\u0438\u0438
+ExcelChart_Type_BarsStacked3D=C\u043A\u043E\u043C\u043F\u043E\u043D\u043E\u0432\u0430\u043D\u043D\u0430\u044F \u043B\u0438\u043D\u0438\u0438 3D
+ExcelChart_Type_BarsStacked=C\u043A\u043E\u043C\u043F\u043E\u043D\u043E\u0432\u0430\u043D\u043D\u0430\u044F \u043B\u0438\u043D\u0438\u0438
+ExcelChart_Type_ColumnsClustered3D=\u0421\u0433\u0440\u0443\u043F\u043F\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0435 \u043A\u043E\u043B\u043E\u043D\u043A\u0438 3D
+ExcelChart_Type_ColumnsClustered=\u0421\u0433\u0440\u0443\u043F\u043F\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0435 \u043A\u043E\u043B\u043E\u043D\u043A\u0438
+ExcelChart_Type_ColumnsStacked3D=C\u043A\u043E\u043C\u043F\u043E\u043D\u043E\u0432\u0430\u043D\u043D\u044B\u0435 \u043A\u043E\u043B\u043E\u043D\u043A\u0438 3D
+ExcelChart_Type_ColumnsStacked=C\u043A\u043E\u043C\u043F\u043E\u043D\u043E\u0432\u0430\u043D\u043D\u044B\u0435 \u043A\u043E\u043B\u043E\u043D\u043A\u0438
+ExcelChart_Type_Line=\u041B\u0438\u043D\u0438\u044F
+ExcelChart_Type_LineStacked=C\u043A\u043E\u043C\u043F\u043E\u043D\u043E\u0432\u0430\u043D\u043D\u0430\u044F \u043B\u0438\u043D\u0438\u044F
+ExcelChart_Type_Pie3D=\u041D\u0430\u0431\u043E\u0440 \u0441\u043C\u0435\u0448\u0430\u043D\u043D\u043E\u0433\u043E \u0448\u0440\u0438\u0444\u0442\u0430 3D
+ExcelChart_Type_Pie=\u041D\u0430\u0431\u043E\u0440 \u0441\u043C\u0435\u0448\u0430\u043D\u043D\u043E\u0433\u043E \u0448\u0440\u0438\u0444\u0442\u0430
+ExcelChart_Type_PieExploded3D=\u041D\u0430\u0431\u043E\u0440 \u0441\u043C\u0435\u0448\u0430\u043D\u043D\u043E\u0433\u043E \u0448\u0440\u0438\u0444\u0442\u0430 \u043F\u043E \u043E\u0442\u0434\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u0438 3D
+ExcelChart_Type_PieExploded=\u041D\u0430\u0431\u043E\u0440 \u0441\u043C\u0435\u0448\u0430\u043D\u043D\u043E\u0433\u043E \u0448\u0440\u0438\u0444\u0442\u0430 \u043F\u043E \u043E\u0442\u0434\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u0438
+ExcelChart_Various_Averaged=\u0423\u0441\u0440\u0435\u0434\u043D\u0451\u043D\u043D\u044B\u0439
+ExcelChart_Various_Column=\u041A\u043E\u043B\u043E\u043D\u043A\u0430
+ExcelChart_Various_Frequency=\u0427\u0430\u0441\u0442\u043E\u0442\u0430
+ExcelChart_Various_SummedUp=\u041F\u0440\u043E\u0441\u0443\u043C\u043C\u0438\u0440\u043E\u0432\u0430\u043D\u043E
+ExcelChart_Various_Unknown=<\u041D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u043E>
+ExportDate=\u0414\u0430\u0442\u0430 \u044D\u043A\u0441\u043F\u043E\u0440\u0442\u0430
+ExtendedSearchAddAttributeMenu=\u0414\u043E\u0431\u0430\u0432\u043B\u0435\u043D\u0438\u0435 \u0443\u0441\u043B\u043E\u0432\u0438\u044F \u043E\u0433\u0440\u0430\u043D\u0438\u0447\u0435\u043D\u0438\u044F...
+ExtendedSearchAddEntityPrefix=\u0438\u043C\u0435\u0435\u0442
+ExtendedSearchAnd=\u0438
+ExtendedSearchEditAttributeMenu=\u0420\u0435\u0434\u0430\u043A\u0442\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u0435..
+ExtendedSearchEntitySuffix=\u0441
+ExtendedSearchNegateMenu=\u0421\u0434\u0435\u043B\u0430\u0442\u044C \u043E\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043B\u044C\u043D\u044B\u043C
+ExtendedSearchRemoveAttributeMenu=\u0423\u0434\u0430\u043B\u0438\u0442\u044C
+ExtendedSearchRemoveMenu=\u0423\u0434\u0430\u043B\u0438\u0442\u044C
+FileExistsOwerwriteQuestion=\u0412\u044B\u0431\u0440\u0430\u043D\u043D\u044B\u0439 \u0444\u0430\u0439\u043B \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442. \u041F\u0435\u0440\u0435\u043F\u0438\u0441\u0430\u0442\u044C \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044E\u0449\u0438\u0439 \u0444\u0430\u0439\u043B?
+FileName=\u0418\u043C\u044F \u0444\u0430\u0439\u043B\u0430
+FileNotFoundMessage=\u041D\u0435 \u043C\u043E\u0433\u0443 \u043D\u0430\u0439\u0442\u0438 \u0444\u0430\u0439\u043B\:
+FileNotFoundTitle=\u0424\u0430\u0439\u043B \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D
+FilesOfType=\u0422\u0438\u043F\u0430 \u0444\u0430\u0439\u043B\u0430
+FormPrint=\u041F\u0435\u0447\u0430\u0442\u044C
+FormSaveChangesQuestion=\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u044F?
+FormStateLoad=\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430...
+FormStateStore=\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C
+FormStateStoreAs=\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C \u043A\u0430\u043A...
+GlobalBookmarks=\u0413\u043B\u043E\u0431\u0430\u043B\u044C\u043D\u044B\u0435 \u0437\u0430\u043A\u043B\u0430\u0434\u043A\u0438
+GlobalBookmarksAddMenu=\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0432 &\u0433\u043B\u043E\u0431\u0430\u043B\u044C\u043D\u044B\u0435 \u0437\u0430\u043A\u043B\u0430\u0434\u043A\u0438
+Help=\u041F\u043E\u043C\u043E\u0449\u044C
+IOErrorInfo=\u041F\u0440\u043E\u0432\u0435\u0440\u044C\u0442\u0435 \u0444\u0430\u0439\u043B\u044B \u0438 \u0441\u043E\u0441\u0442\u043E\u044F\u043D\u0438\u0435 \u043F\u043E\u0434\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u044F.
+IOErrorText=\u041E\u0448\u0438\u0431\u043A\u0430 \u043F\u043E\u0434\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u044F
+IOErrorTitle=\u041E\u0448\u0438\u0431\u043A\u0430 \u0447\u0442\u0435\u043D\u0438\u044F/\u0437\u0430\u043F\u0438\u0441\u0438
+Info=\u0418\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u044F
+Interrupted=\u041F\u0440\u0435\u0440\u0432\u0430\u043D\u043E
+InterruptedErrorText=\u041F\u0440\u043E\u0446\u0435\u0441\u0441 \u0431\u044B\u043B \u043F\u0440\u0435\u0440\u0432\u0430\u043D \u0432\u0440\u0443\u0447\u043D\u0443\u044E.
+InterruptedErrorTitle=\u041F\u0440\u043E\u0446\u0435\u0441\u0441 \u043E\u0442\u043C\u0435\u043D\u0435\u043D.
+JavaVMVersion=Java \u0412\u0438\u0440\u0442\u0443\u0430\u043B\u044C\u043D\u0430\u044F \u043C\u0430\u0448\u0438\u043D\u0430
+Language=\u042F\u0437\u044B\u043A
+LoadFormXmlFailedText=\u0414\u0430\u043D\u043D\u044B\u0439 \u0444\u0430\u0439\u043B \u043D\u0435 \u0441\u043E\u0432\u043C\u0435\u0441\u0442\u0438\u043C \u0441 \u044D\u0442\u0438\u043C \u0434\u0438\u0430\u043B\u043E\u0433\u043E\u043C
+LogicDateIsInDays=\u0442\u043E\u0447\u043D\u043E \u0432 n \u0434\u043D\u0435\u0439
+LogicDateIsInGEDays=\u0414\u0430\u0442\u0430 >\= \u0441\u0435\u0433\u043E\u0434\u043D\u044F + n \u0434\u043D\u0435\u0439
+LogicDateIsInGEMonths=\u0414\u0430\u0442\u0430 >\= \u0441\u0435\u0433\u043E\u0434\u043D\u044F + n \u043C\u0435\u0441\u044F\u0446\u0435\u0432
+LogicDateIsInLEDays=\u0414\u0430\u0442\u0430 <\= \u0441\u0435\u0433\u043E\u0434\u043D\u044F + n \u0434\u043D\u0435\u0439
+LogicDateIsInLEMonths=\u0414\u0430\u0442\u0430 <\= \u0441\u0435\u0433\u043E\u0434\u043D\u044F + n \u043C\u0435\u0441\u044F\u0446\u0435\u0432
+LogicDateIsInLastDays=\u0431\u044B\u043B\u043E \u0432 \u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0435 n \u0434\u043D\u0435\u0439
+LogicDateIsInLastMonths=\u0431\u044B\u043B\u043E \u0432 \u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0435 n \u043C\u0435\u0441\u044F\u0446\u0435\u0432
+LogicDateIsInMonths=\u0442\u043E\u0447\u043D\u043E \u0432 n \u043C\u0435\u0441\u044F\u0446\u0435\u0432
+LogicDateIsInNextDays=\u0431\u044B\u043B\u043E \u0432 \u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0438\u0435 n \u0434\u043D\u0435\u0439
+LogicDateIsInNextMonths=\u0431\u044B\u043B\u043E \u0432 \u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0438\u0435 n \u043C\u0435\u0441\u044F\u0446\u0435\u0432
+LogicDateIsNotToday=\u043D\u0435 \u0441\u0435\u0433\u043E\u0434\u043D\u044F
+LogicDateIsToday=\u0441\u0435\u0433\u043E\u0434\u043D\u044F
+LogicDateTimeIsInGEHours=\u0414\u0430\u0442\u0430 >\= \u0441\u0435\u0439\u0447\u0430\u0441 + n \u0447\u0430\u0441\u043E\u0432
+LogicDateTimeIsInGEMinutes=\u0414\u0430\u0442\u0430 >\= \u0441\u0435\u0439\u0447\u0430\u0441 + n \u043C\u0438\u043D\u0443\u0442
+LogicDateTimeIsInLEHours=\u0414\u0430\u0442\u0430 <\= \u0441\u0435\u0439\u0447\u0430\u0441 + n \u0447\u0430\u0441\u043E\u0432
+LogicDateTimeIsInLEMinutes=\u0414\u0430\u0442\u0430 <\= \u0441\u0435\u0439\u0447\u0430\u0441 + n \u043C\u0438\u043D\u0443\u0442
+LogicDateTimeIsNotNow=\u043D\u0435 \u0441\u0435\u0439\u0447\u0430\u0441
+LogicDateTimeIsNow=\u0441\u0435\u0439\u0447\u0430\u0441
+LogicEQ=\=
+LogicEndsWith=\u0417\u0430\u043A\u0430\u043D\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044F \u043D\u0430
+LogicGE=>\=
+LogicGT=>
+LogicLE=<\=
+LogicLT=<
+LogicLike=\u0441\u043E\u0434\u0435\u0440\u0436\u0438\u0442
+LogicNEQ=<>
+LogicNotIn=\u043D\u0435 \u044F\u0432\u043B\u044F\u0435\u0442\u0441\u044F
+LogicNotLike=\u043D\u0435 \u0441\u043E\u0434\u0435\u0440\u0436\u0438\u0442
+LogicNotNull=\u043D\u0435 \u043F\u0443\u0441\u0442\u043E
+LogicNull=\u043F\u0443\u0441\u0442\u043E
+LogicStartsWith=\u043D\u0430\u0447\u0438\u043D\u0430\u0435\u0442\u0441\u044F \u0441
+LogicTimeIsInGEHours=\u044F\u0432\u043B\u044F\u0435\u0442\u0441\u044F \u043D\u0430\u0438\u0431\u043E\u043B\u0435\u0435 \u0440\u0430\u043D\u043D\u0438\u043C (\u0447\u0430\u0441\u044B)
+LogicTimeIsInGEMinutes=\u044F\u0432\u043B\u044F\u0435\u0442\u0441\u044F \u043D\u0430\u0438\u0431\u043E\u043B\u0435\u0435 \u0440\u0430\u043D\u043D\u0438\u043C (\u043C\u0438\u043D\u0443\u0442\u044B)
+LogicTimeIsInHours=\u0432 \u0442\u043E\u0447\u043D\u043E\u0441\u0442\u0438 (\u0447\u0430\u0441\u044B)
+LogicTimeIsInLEHours=\u044F\u0432\u043B\u044F\u0435\u0442\u0441\u044F \u043D\u0430\u0438\u0431\u043E\u043B\u0435\u0435 \u043F\u043E\u0437\u0434\u043D\u0438\u043C (\u0447\u0430\u0441\u044B)
+LogicTimeIsInLEMinutes=\u044F\u0432\u043B\u044F\u0435\u0442\u0441\u044F \u043D\u0430\u0438\u0431\u043E\u043B\u0435\u0435 \u043F\u043E\u0437\u0434\u043D\u0438\u043C (\u043C\u0438\u043D\u0443\u0442\u044B)
+LogicTimeIsInMinutes=\u044F\u0432\u043B\u044F\u0435\u0442\u0441\u044F \u0432 \u0442\u043E\u0447\u043D\u043E\u0441\u0442\u0438 (\u043C\u0438\u043D\u0443\u0442\u044B)
+LogicTimeIsNotNow=\u043D\u0435 \u0441\u0435\u0439\u0447\u0430\u0441
+LogicTimeIsNow=\u0441\u0435\u0439\u0447\u0430\u0441
+Login=\u0412\u0445\u043E\u0434 \u0432 \u0441\u0438\u0441\u0442\u0435\u043C\u0443
+LookIn=\u041F\u0440\u043E\u0441\u043C\u043E\u0442\u0440\u0435\u0442\u044C
+Month=\u041C\u0435\u0441\u044F\u0446
+Name=\u0418\u043C\u044F
+NetErrorInfo=\u041F\u0440\u043E\u0432\u0435\u0440\u044C\u0442\u0435 \u0438\u043C\u044F \u0441\u0435\u0440\u0432\u0435\u0440\u0430, URL \u0438 \u0441\u043E\u0441\u0442\u043E\u044F\u043D\u0438\u0435 \u043F\u043E\u0434\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u044F.
+NetErrorText=\u0421\u0435\u0440\u0432\u0435\u0440 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D
+NetErrorTitle=\u041E\u0448\u0438\u0431\u043A\u0430 \u0441\u0435\u0442\u0435\u0432\u043E\u0433\u043E \u043F\u043E\u0434\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u044F
+NewPassword=\u041D\u043E\u0432\u044B\u0439 \u043F\u0430\u0440\u043E\u043B\u044C
+No=\u041D\u0435\u0442
+NoButton=&\u041D\u0435\u0442
+NumberOfRows=\u0427\u0438\u0441\u043B\u043E \u0441\u0442\u0440\u043E\u043A
+OSUser=\u0421\u0438\u0441\u0442\u0435\u043C\u043D\u044B\u0439 \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C
+OSVersion=\u0412\u0435\u0440\u0441\u0438\u044F \u0441\u0438\u0441\u0442\u0435\u043C\u044B
+Ok=\u0414\u0430
+OkButton=&Ok
+OkButtonTooltip=\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u0435 \u0438 \u0437\u0430\u043A\u0440\u043E\u0439\u0442\u0435 \u0434\u0438\u0430\u043B\u043E\u0433
+OldPassword=\u041F\u0440\u0435\u0436\u043D\u0438\u0439 \u043F\u0430\u0440\u043E\u043B\u044C
+Op=\u041E\u043F\u0435\u0440\u0430\u0442\u043E\u0440
+Open=\u041E\u0442\u043A\u0440\u044B\u0442\u044C
+Password=\u041F\u0430\u0440\u043E\u043B\u044C
+PasswordsDoNotMatch=\u041F\u0430\u0440\u043E\u043B\u0438 \u043D\u0435 \u0441\u043E\u0432\u043F\u0430\u0434\u0430\u044E\u0442
+Paste=\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u044C
+Path=\u041F\u0443\u0442\u044C
+RepeatPassword=\u041F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u044C
+ResetButton=&\u0421\u0431\u0440\u043E\u0441/\u0412\u0435\u043D\u0443\u0442\u044C\u0441\u044F \u043A \u0438\u0441\u0445\u043E\u0434\u043D\u043E\u043C\u0443
+ResetButtonTooltip=\u0423\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C \u043F\u0443\u0441\u0442\u044B\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u044F \u0432 \u0434\u0438\u0430\u043B\u043E\u0433\u0435
+Save=\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C
+SaveButton=&\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C
+SaveButtonTooltip=\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C \u0434\u0438\u0430\u043B\u043E\u0433 \u0431\u0435\u0437 \u0437\u0430\u043A\u0440\u044B\u0442\u0438\u044F
+SearchButton=&\u041F\u043E\u0438\u0441\u043A
+SearchButtonTooltip=\u0417\u0430\u043A\u0440\u044B\u0442\u044C \u0434\u0438\u0430\u043B\u043E\u0433 \u0438 \u043D\u0430\u0447\u0430\u0442\u044C \u043F\u043E\u0438\u0441\u043A
+SearchConstraints=\u0423\u0441\u043B\u043E\u0432\u0438\u0435 \u043F\u043E\u0438\u0441\u043A\u0430
+Server=\u0421\u0435\u0440\u0432\u0435\u0440
+SmartFindLabel=\u0422\u0435\u043A\u0441\u0442 \u043F\u043E\u0438\u0441\u043A\u0430
+StatusExportDone=\u042D\u043A\u0441\u043F\u043E\u0440\u0442 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043D
+Today=\u0421\u0435\u0433\u043E\u0434\u043D\u044F
+TooManyRows=\u0411\u043E\u043B\u044C\u0448\u043E\u0439 \u043D\u0430\u0431\u043E\u0440 \u0434\u0430\u043D\u043D\u044B\u0445. \u041F\u043E\u0436\u0430\u043B\u0443\u0439\u0441\u0442\u0430 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0439\u0442\u0435 \u043F\u0430\u043D\u0435\u043B\u044C \u043F\u043E\u0438\u0441\u043A\u0430, \u0443\u043C\u0435\u043D\u044C\u0448\u0438\u0432 \u043A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u043E\u0432.
+Update=\u041E\u0431\u043D\u043E\u0432\u0438\u0442\u044C
+UserInterrupted=\u041E\u0442\u043C\u0435\u043D\u0435\u043D\u043E \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u0435\u043C
+Username=\u0418\u043C\u044F \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044F
+Value=\u0417\u043D\u0430\u0447\u0435\u043D\u0438\u0435
+Week=\u041D\u0435\u0434\u0435\u043B\u044F
+WeekShort=\u0421\u043E\u043A\u0440\u0430\u0449\u0435\u043D\u043D\u0430\u044F \u043D\u0435\u0434\u0435\u043B\u044F
+WizardCancelButton=\u041E\u0442\u043C\u0435\u043D\u0430
+WizardSuspendButton=&\u0417\u0430\u043A\u0440\u044B\u0442\u0438\u0435
+WorkWeek=\u0420\u0430\u0431\u043E\u0447\u0430\u044F \u043D\u0435\u0434\u0435\u043B\u044F
+Yes=\u0414\u0430
+YesButton=&\u0414\u0430
+and=\u0438
+from=\u043E\u0442
+to=\u043A
diff --git a/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_se.properties b/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_se.properties
index 21c5aa4456..4e1dcbfbb4 100644
--- a/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_se.properties
+++ b/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_se.properties
@@ -1,226 +1,226 @@
-AllStates=Alla
-Apply=L\u00E4gg till
-Attribute=Attribut
-Bookmarks=Bokm\u00E4rken
-BookmarksAddMenu=&L\u00E4gg till bokm\u00E4rken...
-BookmarksMainMenu=&Bokm\u00E4rken
-BookmarksManageMenu=&Hantera bokm\u00E4rken...
-BookmarksStartPageMenu=&Startvy
-BookmarksStartPageMenuClear=&Ingen Startvy
-BookmarksStartPageMenuGoto=&\u00D6ppna Startvyn
-BookmarksStartPageMenuSet=&Ange nuvarande vy som startvy
-ButtonDeselectAll=Avmarkera alla
-ButtonSelectAll=Markera alla
-Calendar_earlier=Tidigare
-Calendar_later=Senare
-Cancel=Avbryt
-CancelButton=Avbryt
-CancelButtonTooltip=St\u00E4ng dialogrutan utan att spara; anv\u00E4nd dialogrutan bekr\u00E4fta om n\u00F6dv\u00E4ndigt.
-ChangePassword=\u00C4ndra l\u00F6senord
-CloseButton=&St\u00E4ng
-CloseButtonTooltip=St\u00E4ng dialogrutan utan att spara.
-Column=Kolumn
-Columns=Kolumner
-ComposerFieldAggregationLabel=Funktion
-Condensed=6 kolumner
-Copy=Kopiera
-Cut=Avbryt
-Day=Dag
-DefaultPasswordPolicyText=L\u00F6senordet f\u00F6ljer inte given Sika policy\n\nPolicy\:\n- minst 8 tecken\n- minst en siffra (0-9)\n- minst ett tecken som inte \u00E4r ett standardtecken (\!|@|\#|$|%|^|&|*|(|)|_|+|||~|-|
-EmailFrom=Fr\u00E5n
-EmailSubject=\u00C4mne
-EmailTo=Till
-Error=Fel
-ErrorAndRetryTextDefault=Ett fel intr\u00E4ffade under \u00F6verf\u00F6ringen av data.
-ErrorTextLogin=Ogiltigt anv\u00E4ndarnamn/l\u00F6senord
-ErrorTitleLogin=Login misslyckades
-ExcelChart_Button_LoadDefaults=Standard
-ExcelChart_Button_LoadDefaultsHint=Laddar standardv\u00E4rdena och \u00E5terst\u00E4ller dialogrutan.
-ExcelChart_Button_LoadProfile=Laddar profil...
-ExcelChart_Button_LoadProfileHint=Laddar inst\u00E4llningar fr\u00E5n en XML-fil.
-ExcelChart_Button_SaveProfile=Spara profil...
-ExcelChart_Button_SaveProfileHint=Sparar nuvarande inst\u00E4llningar till en XML-fil.
-ExcelChart_Error_CreatingChartFailed=misslyckades att skapa diagram
-ExcelChart_Error_ExportingFailed=Exporten misslyckades p\u00E5 grund av
-ExcelChart_Error_InitializationFailed=initialisering av support klass(erna) misslyckades.
-ExcelChart_Error_LoadingProfileFailed=Laddning av profilen misslyckadeds p\u00E5 grund av
-ExcelChart_Error_LoadingTemplateFailed=mallen kunde inte laddas.
-ExcelChart_Error_RetrivingOutlineDataFailed=datan p\u00E5 dispositionssidan kunde inte \u00E5terh\u00E4mtas
-ExcelChart_Error_SavingProfileFailed=Profilen kunde inte sparas p\u00E5 grund av
-ExcelChart_Error_WrongProfile=profilen skapades f\u00F6r en annan disposition.
-ExcelChart_Label_AutomaticMode=Automatiskt l\u00E4ge
-ExcelChart_Label_AutomaticModeHint=D\u00F6lj Excel och spara automatiskt.
-ExcelChart_Label_ChartNumber=Diagramnummer
-ExcelChart_Label_ChartType=Diagramtyp
-ExcelChart_Label_FileName=Filnamn
-ExcelChart_Label_FirstRow=F\u00F6rsta raden
-ExcelChart_Label_Height=H\u00F6jd
-ExcelChart_Label_HistogramMode=Stapeldiagram
-ExcelChart_Label_HistogramModeHint=Stapeldiagrammet kombinerar identiska v\u00E4rden p\u00E5 X-axlen till ett.
-ExcelChart_Label_LastRow=Sista raden
-ExcelChart_Label_Offset=Postition
-ExcelChart_Label_SkipNullValues=Ta ej med noll-v\u00E4rden i stapeldiagram
-ExcelChart_Label_SkipNullValuesHint=Om alternativet \u00E4r markerat, noll-v\u00E4rden p\u00E5 X-axlen \u00E4r uteslutna, annars \u00E4r de kombinerade till <Unknown>.
-ExcelChart_Label_TemplateName=Mall
-ExcelChart_Label_UseCustomFormat=Anv\u00E4nd standardformat
-ExcelChart_Label_UseCustomFormatHint=Om alternativet \u00E4r markerat kan du ange diagrammets position och storlek.
-ExcelChart_Label_UseExistingChart=Anv\u00E4nd befintligt diagram
-ExcelChart_Label_UseExistingChartHint=Om alternativet \u00E4r markerat anv\u00E4nds befintligt diagram i angiven mall.
-ExcelChart_Label_UseSelectiveExport=Anv\u00E4nd selektiv export
-ExcelChart_Label_UseSelectiveExportHint=Om alternativet \u00E4r markerat, endast nedan angivna rader \u00E4r exporterade.
-ExcelChart_Label_Width=Bredd
-ExcelChart_Label_WorksheetName=Kalkylblad
-ExcelChart_Label_XAxis=X-axel
-ExcelChart_Label_YAxes=Y-axel
-ExcelChart_Status_Done=Excel Diagram-export genomf\u00F6rd.
-ExcelChart_Tab_Advanced=Avancerad
-ExcelChart_Tab_Basic=Bas
-ExcelChart_Title_MainForm=Excel Diagram-export
-ExcelChart_Type_Area3D=Yta med 3D-effekt
-ExcelChart_Type_Area=Yta
-ExcelChart_Type_AreaStacked3D=Staplad yta med 3D-effekter
-ExcelChart_Type_AreaStacked=Staplad Yta
-ExcelChart_Type_BarsClustered3D=Grupperad liggande stapel med 3D-effekter
-ExcelChart_Type_BarsClustered=Grupperad liggande
-ExcelChart_Type_BarsStacked3D=Staplad liggande med 3D-effekt
-ExcelChart_Type_BarsStacked=Staplad liggande
-ExcelChart_Type_ColumnsClustered3D=Grupperad stapel med 3D-effekt
-ExcelChart_Type_ColumnsClustered=Grupperad stapel
-ExcelChart_Type_ColumnsStacked3D=Staplad stapel med 3D-effekt
-ExcelChart_Type_ColumnsStacked=Staplad stapel
-ExcelChart_Type_Line=Linje
-ExcelChart_Type_LineStacked=Staplad linje
-ExcelChart_Type_Pie3D=Cirkel med 3D-effekt
-ExcelChart_Type_Pie=Cirkel
-ExcelChart_Type_PieExploded3D=Uppdelad cirkel med 3D-effekt
-ExcelChart_Type_PieExploded=Uppdelad cirkel
-ExcelChart_Various_Averaged=medel
-ExcelChart_Various_Column=Kolumn
-ExcelChart_Various_Frequency=F\u00F6rekomst
-ExcelChart_Various_SummedUp=summerad
-ExcelChart_Various_Unknown=<Unknown>
-ExportDate=Exportera data
-ExtendedSearchAddAttributeMenu=L\u00E4gg till villkor...
-ExtendedSearchAddEntityPrefix=har
-ExtendedSearchAnd=och
-ExtendedSearchEditAttributeMenu=Redigera...
-ExtendedSearchEntitySuffix=med
-ExtendedSearchNegateMenu=Negera
-ExtendedSearchRemoveAttributeMenu=Ta bort
-ExtendedSearchRemoveMenu=Ta bort
-FileExistsOwerwriteQuestion=Den markerade filen finns redan. Vill du skriva \u00F6ver den?
-FileName=Filnamn
-FileNotFoundMessage=Filen kunde inte hittas\:
-FileNotFoundTitle=Filen hittades inte
-FilesOfType=Filtyp
-FormPrint=Skriv ut
-FormSaveChangesQuestion=Vill du spara \u00E4ndringarna?
-FormStateLoad=Laddar...
-FormStateStore=Spara
-FormStateStoreAs=Spara som...
-GlobalBookmarks=Globala Bokm\u00E4rken
-GlobalBookmarksAddMenu=L\u00E4gg till i &globala bokm\u00E4rken
-Help=Hj\u00E4lp
-IOErrorInfo=V\u00E4nligen kontrollera filer och anslutning.
-IOErrorText=Fel i kommunikationen.
-IOErrorTitle=L\u00E4s-/ skrivfel
-InactiveState=inaktiv
-Info=Information
-Interrupted=Avbruten
-InterruptedErrorText=Processen har avbrutits manuellt.
-InterruptedErrorTitle=Processen har avbrutits
-JavaVMVersion=Java VM
-Language=Spr\u00E5k
-LoadFormXmlFailedText=Den h\u00E4r filen \u00E4r inte kompatibel med den h\u00E4r dialogen.
-LogicDateIsInDays=\u00E4r om exakt (dagar)
-LogicDateIsInGEDays=\u00E4r tidigast om (dagar)
-LogicDateIsInGEMonths=\u00E4r tidigast om (m\u00E5nader)
-LogicDateIsInLEDays=Datum <\= idag + n dagar
-LogicDateIsInLEMonths=Datum <\= idag + n m\u00E5nader
-LogicDateIsInLastDays=var f\u00F6r n dagar sedan
-LogicDateIsInLastMonths=var f\u00F6r n m\u00E5nader sedan
-LogicDateIsInMonths=\u00E4r exakt om n m\u00E5nader
-LogicDateIsInNextDays=var f\u00F6r n dagar sedan
-LogicDateIsInNextMonths=var f\u00F6r n m\u00E5nader sedan
-LogicDateIsNotToday=\u00E4r inte idag
-LogicDateIsToday=\u00E4r idag
-LogicDateTimeIsInGEHours=Datum >\= nu + n timmar
-LogicDateTimeIsInGEMinutes=Datum >\= nu + n minuter
-LogicDateTimeIsInLEHours=Datum <\= nu + n timmar
-LogicDateTimeIsInLEMinutes=Datum <\= nu + minuter
-LogicDateTimeIsNotNow=\u00E4r inte nu
-LogicDateTimeIsNow=\u00E4r nu
-LogicEQ=\=
-LogicEndsWith=Slutar med
-LogicGE=>\=
-LogicGT=>
-LogicIn=\u00C4r
-LogicLE=<\=
-LogicLT=<
-LogicLike=Inneh\u00E5ller
-LogicNEQ=<>
-LogicNotIn=\u00E4r inte
-LogicNotLike=inneh\u00E5ller inte
-LogicNotNull=\u00E4r inte tom
-LogicNull=\u00E4r tom
-LogicStartsWith=starta med
-LogicTimeIsInGEHours=\u00E4r tidigast om (timmar)
-LogicTimeIsInGEMinutes=\u00E4r tidigast om (minuter)
-LogicTimeIsInHours=\u00E4r exakt om (timmar)
-LogicTimeIsInLEHours=\u00E4r senast om (timmar)
-LogicTimeIsInLEMinutes=\u00E4r senast om (minuter)
-LogicTimeIsInMinutes=\u00E4r exakt om (minuter)
-LogicTimeIsNotNow=\u00E4r inte nu
-LogicTimeIsNow=\u00E4r nu
-Login=Login
-LookIn=Leta i
-Month=M\u00E5nad
-Name=Namn
-NetErrorInfo=V\u00E4nligen kontrollera servernamn, URL och anslutning.
-NetErrorText=Servern hittades inte.
-NetErrorTitle=N\u00E4tverksfel
-NewPassword=Nytt l\u00F6senord
-No=Nej
-NoButton=&Nej
-NumberOfRows=Radr\u00E4kning
-OSUser=Systemanv\u00E4ndare
-OSVersion=Systemversion
-Ok=OK
-OkButton=&OK
-OkButtonTooltip=Spara och st\u00E4ng dialogrutan.
-OldPassword=Tidigare l\u00F6senord
-Op=Operat\u00F6r
-Open=\u00D6ppna
-Password=L\u00F6senord
-PasswordsDoNotMatch=De tv\u00E5 l\u00F6senorden \u00E4r inte lika.
-Paste=Klistra in
-Path=S\u00F6kv\u00E4g
-RepeatPassword=Upprepa
-ResetButton=&\u00C5terst\u00E4ll
-ResetButtonTooltip=Alla dialogf\u00E4lt ska vara tomma
-Save=Spara
-SaveButton=&Spara
-SaveButtonTooltip=Spara dialogrutan utan att st\u00E4nga.
-SearchButton=&S\u00F6k
-SearchButtonTooltip=St\u00E4ng dialogrutan och b\u00F6rja s\u00F6k
-SearchConstraints=S\u00F6kvillkor
-Server=Server
-SmartFindLabel=S\u00F6ktext
-StatusExportDone=Exporten genomf\u00F6rd
-Today=idag
-TooManyRows=Stor datam\u00E4ngd. V\u00E4nligen begr\u00E4nsa med hj\u00E4lp av S\u00F6kpanelen.
-Update=Uppdatera
-UserInterrupted=Avbruten av anv\u00E4ndare
-Username=Anv\u00E4ndarnamn
-Value=V\u00E4rde
-Week=Vecka
-WeekShort=CW
-WizardCancelButton=Avbryt
-WizardNextButton=&N\u00E4sta
-WizardSuspendButton=&St\u00E4ng
-WorkWeek=Arbetsvecka
-Yes=Ja
-YesButton=&Ja
-and=och
-from=fr\u00E5n
-to=till
+AllStates=Alla
+Apply=L\u00E4gg till
+Attribute=Attribut
+Bookmarks=Bokm\u00E4rken
+BookmarksAddMenu=&L\u00E4gg till bokm\u00E4rken...
+BookmarksMainMenu=&Bokm\u00E4rken
+BookmarksManageMenu=&Hantera bokm\u00E4rken...
+BookmarksStartPageMenu=&Startvy
+BookmarksStartPageMenuClear=&Ingen Startvy
+BookmarksStartPageMenuGoto=&\u00D6ppna Startvyn
+BookmarksStartPageMenuSet=&Ange nuvarande vy som startvy
+ButtonDeselectAll=Avmarkera alla
+ButtonSelectAll=Markera alla
+Calendar_earlier=Tidigare
+Calendar_later=Senare
+Cancel=Avbryt
+CancelButton=Avbryt
+CancelButtonTooltip=St\u00E4ng dialogrutan utan att spara; anv\u00E4nd dialogrutan bekr\u00E4fta om n\u00F6dv\u00E4ndigt.
+ChangePassword=\u00C4ndra l\u00F6senord
+CloseButton=&St\u00E4ng
+CloseButtonTooltip=St\u00E4ng dialogrutan utan att spara.
+Column=Kolumn
+Columns=Kolumner
+ComposerFieldAggregationLabel=Funktion
+Condensed=6 kolumner
+Copy=Kopiera
+Cut=Avbryt
+Day=Dag
+DefaultPasswordPolicyText=L\u00F6senordet f\u00F6ljer inte given Sika policy\n\nPolicy\:\n- minst 8 tecken\n- minst en siffra (0-9)\n- minst ett tecken som inte \u00E4r ett standardtecken (\!|@|\#|$|%|^|&|*|(|)|_|+|||~|-|
+EmailFrom=Fr\u00E5n
+EmailSubject=\u00C4mne
+EmailTo=Till
+Error=Fel
+ErrorAndRetryTextDefault=Ett fel intr\u00E4ffade under \u00F6verf\u00F6ringen av data.
+ErrorTextLogin=Ogiltigt anv\u00E4ndarnamn/l\u00F6senord
+ErrorTitleLogin=Login misslyckades
+ExcelChart_Button_LoadDefaults=Standard
+ExcelChart_Button_LoadDefaultsHint=Laddar standardv\u00E4rdena och \u00E5terst\u00E4ller dialogrutan.
+ExcelChart_Button_LoadProfile=Laddar profil...
+ExcelChart_Button_LoadProfileHint=Laddar inst\u00E4llningar fr\u00E5n en XML-fil.
+ExcelChart_Button_SaveProfile=Spara profil...
+ExcelChart_Button_SaveProfileHint=Sparar nuvarande inst\u00E4llningar till en XML-fil.
+ExcelChart_Error_CreatingChartFailed=misslyckades att skapa diagram
+ExcelChart_Error_ExportingFailed=Exporten misslyckades p\u00E5 grund av
+ExcelChart_Error_InitializationFailed=initialisering av support klass(erna) misslyckades.
+ExcelChart_Error_LoadingProfileFailed=Laddning av profilen misslyckadeds p\u00E5 grund av
+ExcelChart_Error_LoadingTemplateFailed=mallen kunde inte laddas.
+ExcelChart_Error_RetrivingOutlineDataFailed=datan p\u00E5 dispositionssidan kunde inte \u00E5terh\u00E4mtas
+ExcelChart_Error_SavingProfileFailed=Profilen kunde inte sparas p\u00E5 grund av
+ExcelChart_Error_WrongProfile=profilen skapades f\u00F6r en annan disposition.
+ExcelChart_Label_AutomaticMode=Automatiskt l\u00E4ge
+ExcelChart_Label_AutomaticModeHint=D\u00F6lj Excel och spara automatiskt.
+ExcelChart_Label_ChartNumber=Diagramnummer
+ExcelChart_Label_ChartType=Diagramtyp
+ExcelChart_Label_FileName=Filnamn
+ExcelChart_Label_FirstRow=F\u00F6rsta raden
+ExcelChart_Label_Height=H\u00F6jd
+ExcelChart_Label_HistogramMode=Stapeldiagram
+ExcelChart_Label_HistogramModeHint=Stapeldiagrammet kombinerar identiska v\u00E4rden p\u00E5 X-axlen till ett.
+ExcelChart_Label_LastRow=Sista raden
+ExcelChart_Label_Offset=Postition
+ExcelChart_Label_SkipNullValues=Ta ej med noll-v\u00E4rden i stapeldiagram
+ExcelChart_Label_SkipNullValuesHint=Om alternativet \u00E4r markerat, noll-v\u00E4rden p\u00E5 X-axlen \u00E4r uteslutna, annars \u00E4r de kombinerade till <Unknown>.
+ExcelChart_Label_TemplateName=Mall
+ExcelChart_Label_UseCustomFormat=Anv\u00E4nd standardformat
+ExcelChart_Label_UseCustomFormatHint=Om alternativet \u00E4r markerat kan du ange diagrammets position och storlek.
+ExcelChart_Label_UseExistingChart=Anv\u00E4nd befintligt diagram
+ExcelChart_Label_UseExistingChartHint=Om alternativet \u00E4r markerat anv\u00E4nds befintligt diagram i angiven mall.
+ExcelChart_Label_UseSelectiveExport=Anv\u00E4nd selektiv export
+ExcelChart_Label_UseSelectiveExportHint=Om alternativet \u00E4r markerat, endast nedan angivna rader \u00E4r exporterade.
+ExcelChart_Label_Width=Bredd
+ExcelChart_Label_WorksheetName=Kalkylblad
+ExcelChart_Label_XAxis=X-axel
+ExcelChart_Label_YAxes=Y-axel
+ExcelChart_Status_Done=Excel Diagram-export genomf\u00F6rd.
+ExcelChart_Tab_Advanced=Avancerad
+ExcelChart_Tab_Basic=Bas
+ExcelChart_Title_MainForm=Excel Diagram-export
+ExcelChart_Type_Area3D=Yta med 3D-effekt
+ExcelChart_Type_Area=Yta
+ExcelChart_Type_AreaStacked3D=Staplad yta med 3D-effekter
+ExcelChart_Type_AreaStacked=Staplad Yta
+ExcelChart_Type_BarsClustered3D=Grupperad liggande stapel med 3D-effekter
+ExcelChart_Type_BarsClustered=Grupperad liggande
+ExcelChart_Type_BarsStacked3D=Staplad liggande med 3D-effekt
+ExcelChart_Type_BarsStacked=Staplad liggande
+ExcelChart_Type_ColumnsClustered3D=Grupperad stapel med 3D-effekt
+ExcelChart_Type_ColumnsClustered=Grupperad stapel
+ExcelChart_Type_ColumnsStacked3D=Staplad stapel med 3D-effekt
+ExcelChart_Type_ColumnsStacked=Staplad stapel
+ExcelChart_Type_Line=Linje
+ExcelChart_Type_LineStacked=Staplad linje
+ExcelChart_Type_Pie3D=Cirkel med 3D-effekt
+ExcelChart_Type_Pie=Cirkel
+ExcelChart_Type_PieExploded3D=Uppdelad cirkel med 3D-effekt
+ExcelChart_Type_PieExploded=Uppdelad cirkel
+ExcelChart_Various_Averaged=medel
+ExcelChart_Various_Column=Kolumn
+ExcelChart_Various_Frequency=F\u00F6rekomst
+ExcelChart_Various_SummedUp=summerad
+ExcelChart_Various_Unknown=<Unknown>
+ExportDate=Exportera data
+ExtendedSearchAddAttributeMenu=L\u00E4gg till villkor...
+ExtendedSearchAddEntityPrefix=har
+ExtendedSearchAnd=och
+ExtendedSearchEditAttributeMenu=Redigera...
+ExtendedSearchEntitySuffix=med
+ExtendedSearchNegateMenu=Negera
+ExtendedSearchRemoveAttributeMenu=Ta bort
+ExtendedSearchRemoveMenu=Ta bort
+FileExistsOwerwriteQuestion=Den markerade filen finns redan. Vill du skriva \u00F6ver den?
+FileName=Filnamn
+FileNotFoundMessage=Filen kunde inte hittas\:
+FileNotFoundTitle=Filen hittades inte
+FilesOfType=Filtyp
+FormPrint=Skriv ut
+FormSaveChangesQuestion=Vill du spara \u00E4ndringarna?
+FormStateLoad=Laddar...
+FormStateStore=Spara
+FormStateStoreAs=Spara som...
+GlobalBookmarks=Globala Bokm\u00E4rken
+GlobalBookmarksAddMenu=L\u00E4gg till i &globala bokm\u00E4rken
+Help=Hj\u00E4lp
+IOErrorInfo=V\u00E4nligen kontrollera filer och anslutning.
+IOErrorText=Fel i kommunikationen.
+IOErrorTitle=L\u00E4s-/ skrivfel
+InactiveState=inaktiv
+Info=Information
+Interrupted=Avbruten
+InterruptedErrorText=Processen har avbrutits manuellt.
+InterruptedErrorTitle=Processen har avbrutits
+JavaVMVersion=Java VM
+Language=Spr\u00E5k
+LoadFormXmlFailedText=Den h\u00E4r filen \u00E4r inte kompatibel med den h\u00E4r dialogen.
+LogicDateIsInDays=\u00E4r om exakt (dagar)
+LogicDateIsInGEDays=\u00E4r tidigast om (dagar)
+LogicDateIsInGEMonths=\u00E4r tidigast om (m\u00E5nader)
+LogicDateIsInLEDays=Datum <\= idag + n dagar
+LogicDateIsInLEMonths=Datum <\= idag + n m\u00E5nader
+LogicDateIsInLastDays=var f\u00F6r n dagar sedan
+LogicDateIsInLastMonths=var f\u00F6r n m\u00E5nader sedan
+LogicDateIsInMonths=\u00E4r exakt om n m\u00E5nader
+LogicDateIsInNextDays=var f\u00F6r n dagar sedan
+LogicDateIsInNextMonths=var f\u00F6r n m\u00E5nader sedan
+LogicDateIsNotToday=\u00E4r inte idag
+LogicDateIsToday=\u00E4r idag
+LogicDateTimeIsInGEHours=Datum >\= nu + n timmar
+LogicDateTimeIsInGEMinutes=Datum >\= nu + n minuter
+LogicDateTimeIsInLEHours=Datum <\= nu + n timmar
+LogicDateTimeIsInLEMinutes=Datum <\= nu + minuter
+LogicDateTimeIsNotNow=\u00E4r inte nu
+LogicDateTimeIsNow=\u00E4r nu
+LogicEQ=\=
+LogicEndsWith=Slutar med
+LogicGE=>\=
+LogicGT=>
+LogicIn=\u00C4r
+LogicLE=<\=
+LogicLT=<
+LogicLike=Inneh\u00E5ller
+LogicNEQ=<>
+LogicNotIn=\u00E4r inte
+LogicNotLike=inneh\u00E5ller inte
+LogicNotNull=\u00E4r inte tom
+LogicNull=\u00E4r tom
+LogicStartsWith=starta med
+LogicTimeIsInGEHours=\u00E4r tidigast om (timmar)
+LogicTimeIsInGEMinutes=\u00E4r tidigast om (minuter)
+LogicTimeIsInHours=\u00E4r exakt om (timmar)
+LogicTimeIsInLEHours=\u00E4r senast om (timmar)
+LogicTimeIsInLEMinutes=\u00E4r senast om (minuter)
+LogicTimeIsInMinutes=\u00E4r exakt om (minuter)
+LogicTimeIsNotNow=\u00E4r inte nu
+LogicTimeIsNow=\u00E4r nu
+Login=Login
+LookIn=Leta i
+Month=M\u00E5nad
+Name=Namn
+NetErrorInfo=V\u00E4nligen kontrollera servernamn, URL och anslutning.
+NetErrorText=Servern hittades inte.
+NetErrorTitle=N\u00E4tverksfel
+NewPassword=Nytt l\u00F6senord
+No=Nej
+NoButton=&Nej
+NumberOfRows=Radr\u00E4kning
+OSUser=Systemanv\u00E4ndare
+OSVersion=Systemversion
+Ok=OK
+OkButton=&OK
+OkButtonTooltip=Spara och st\u00E4ng dialogrutan.
+OldPassword=Tidigare l\u00F6senord
+Op=Operat\u00F6r
+Open=\u00D6ppna
+Password=L\u00F6senord
+PasswordsDoNotMatch=De tv\u00E5 l\u00F6senorden \u00E4r inte lika.
+Paste=Klistra in
+Path=S\u00F6kv\u00E4g
+RepeatPassword=Upprepa
+ResetButton=&\u00C5terst\u00E4ll
+ResetButtonTooltip=Alla dialogf\u00E4lt ska vara tomma
+Save=Spara
+SaveButton=&Spara
+SaveButtonTooltip=Spara dialogrutan utan att st\u00E4nga.
+SearchButton=&S\u00F6k
+SearchButtonTooltip=St\u00E4ng dialogrutan och b\u00F6rja s\u00F6k
+SearchConstraints=S\u00F6kvillkor
+Server=Server
+SmartFindLabel=S\u00F6ktext
+StatusExportDone=Exporten genomf\u00F6rd
+Today=idag
+TooManyRows=Stor datam\u00E4ngd. V\u00E4nligen begr\u00E4nsa med hj\u00E4lp av S\u00F6kpanelen.
+Update=Uppdatera
+UserInterrupted=Avbruten av anv\u00E4ndare
+Username=Anv\u00E4ndarnamn
+Value=V\u00E4rde
+Week=Vecka
+WeekShort=CW
+WizardCancelButton=Avbryt
+WizardNextButton=&N\u00E4sta
+WizardSuspendButton=&St\u00E4ng
+WorkWeek=Arbetsvecka
+Yes=Ja
+YesButton=&Ja
+and=och
+from=fr\u00E5n
+to=till
diff --git a/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_sk.properties b/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_sk.properties
index 2533fe920d..0e8fb8f42b 100644
--- a/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_sk.properties
+++ b/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_sk.properties
@@ -1,234 +1,234 @@
-All=V\u0161etky
-Apply=Pou\u017Ei\u0165
-Attribute=Atrib\u00FAt
-Bookmarks=Z\u00E1lo\u017Eky
-BookmarksAddMenu=&Prida\u0165 k z\u00E1lo\u017Ek\u00E1m
-BookmarksMainMenu=&Z\u00E1lo\u017Eky
-BookmarksManageMenu=&Spr\u00E1va z\u00E1lo\u017Eiek...
-BookmarksStartPageMenu=&\u0160tartovac\u00ED poh\u013Ead
-BookmarksStartPageMenuClear=&Bez \u0161tartovacieho poh\u013Eadu
-BookmarksStartPageMenuGoto=&Otvori\u0165 \u0161tartovac\u00ED poh\u013Ead
-BookmarksStartPageMenuSet=&Nastavi\u0165 aktu\u00E1lny poh\u013Ead ako \u0161tartovac\u00ED
-Calendar_earlier=Sk\u00F4r
-Calendar_later=Nesk\u00F4r
-Cancel=Zru\u0161i\u0165
-CancelButton=&Zru\u0161i\u0165
-CancelButtonTooltip=Od\u00EDs\u0165 bez ulo\u017Eenia; s dotazom a je potrebn\u00E9
-ChangePassword=Zmeni\u0165 heslo
-Close=Zatvori\u0165
-CloseButton=&Zatvori\u0165
-CloseButtonTooltip=Od\u00EDs\u0165 bez ulo\u017Eenia
-Column=St\u013Apec
-Columns=St\u013Apce
-ComposerFieldAggregationLabel=Funkcia
-Condensed=6 st\u013Apcov
-Copy=K\u00F3p\u00EDruj
-Cut=Vystrihni
-Day=De\u0148
-DefaultPasswordPolicyText=Heslo mus\u00ED sp\u013A\u0148a\u0165 nasledovn\u00E9 krit\u00E9ria bezpe\u010Dnosti\:\n\nPravidl\u00E1\:\n- d\u013A\u017Eka aspo\u0148 8 znakov\n- aspo\u0148 jedna \u010D\u00EDslica (0-9)\n- aspo\u0148 jeden ne\u0161tandardn\u00FD znak (\!|@|\#|$|%|^|&|*|(|)|_|+|||~|-|
-Detail=Podrobnos\u0165
-Details=Podrobnosti
-EmailSubject=Predmet
-Enabled=Aktivovan\u00FD
-Error=Chyba
-ErrorAndRetryTextDefault=Pri prenose d\u00E1t sa vyskytla chyba.
-ErrorTextLogin=Nespr\u00E1vne meno/heslo
-ErrorTitleLogin=Prihl\u00E1senie zlyhalo
-ExcelChart_Button_LoadDefaults=Povodn\u00E9 hodnoty
-ExcelChart_Button_LoadDefaultsHint=Na\u010D\u00EDta\u0165 p\u00F4vodn\u00E9 hodnoty
-ExcelChart_Button_LoadProfile=Na\u010D\u00EDta\u0165 profil...
-ExcelChart_Button_LoadProfileHint=Na\u010D\u00EDta\u0165 nastavenia z XML
-ExcelChart_Button_SaveProfile=Ulo\u017Ei\u0165 profil...
-ExcelChart_Button_SaveProfileHint=Ulo\u017E\u0165 aktu\u00E1lne nastavenia do XML
-ExcelChart_Error_CreatingChartFailed=vytvorenie grafu zlyhalo
-ExcelChart_Error_ExportingFailed=Export zlyhal preto\u017Ee
-ExcelChart_Error_InitializationFailed=inicializ\u00E1cia podpornej triedy zlyhala.
-ExcelChart_Error_LoadingProfileFailed=Na\u010D\u00EDtanie profilu zlyhalo preto\u017Ee
-ExcelChart_Error_LoadingTemplateFailed=na\u010D\u00EDtanie \u0161ablony zlyhalo.
-ExcelChart_Error_RetrivingOutlineDataFailed=vyh\u013Eadanie d\u00E1t outlinu zlyhalo.
-ExcelChart_Error_SavingProfileFailed=Ulo\u017Eenie profilu zlyhalo preto\u017Ee
-ExcelChart_Error_WrongProfile=profil bol vytvoren\u00FD pre in\u00FD outline.
-ExcelChart_Label_AutomaticMode=Automatick\u00FD m\u00F3d
-ExcelChart_Label_AutomaticModeHint=Skry Excel a ulo\u017E automaticky
-ExcelChart_Label_ChartNumber=\u010C\u00EDslo grafu
-ExcelChart_Label_ChartType=Typ grafu
-ExcelChart_Label_FileName=Meno s\u00FAboru
-ExcelChart_Label_FirstRow=Prv\u00FD riadok
-ExcelChart_Label_Height=V\u00FD\u0161ka
-ExcelChart_Label_HistogramMode=Histogram
-ExcelChart_Label_HistogramModeHint=Histogram p\u00E1ruje rovnak\u00E9 hodnoty na os X.
-ExcelChart_Label_LastRow=Posledn\u00FD riadok
-ExcelChart_Label_Offset=Poz\u00EDcia
-ExcelChart_Label_SkipNullValues=Presko\u010Di\u0165 nulov\u00E9 hodnoty v histograme
-ExcelChart_Label_SkipNullValuesHint=Ak za\u0161krtnut\u00E9, nulov\u00E9 hodnoty na osi X bud\u00FA ignorovan\u00E9, inak bud\u00FA sp\u00E1rovan\u00E9 s <nezn\u00E1my>.
-ExcelChart_Label_TemplateName=\u0160ablona
-ExcelChart_Label_UseCustomFormat=Pou\u017Ei\u0165 vlastn\u00FD form\u00E1t
-ExcelChart_Label_UseCustomFormatHint=Ak za\u0161krtnut\u00E9, je mo\u017En\u00E9 ur\u010Di\u0165 poz\u00EDciu a ve\u013Ekot grafu.
-ExcelChart_Label_UseExistingChart=Pou\u017Ei\u0165 existuj\u00FAci graf
-ExcelChart_Label_UseExistingChartHint=Ak za\u0161krtnut\u00E9, bude pou\u017Eit\u00FD existuj\u00FAci graf v \u0161ablone
-ExcelChart_Label_UseSelectiveExport=Pou\u017Ei\u0165 podmien\u00FD export
-ExcelChart_Label_UseSelectiveExportHint=Ak za\u0161krtnut\u00E9, bud\u00FA exportovan\u00E9 iba dole ur\u010Den\u00E9 riadky.
-ExcelChart_Label_Width=\u0160\u00EDrka
-ExcelChart_Label_WorksheetName=XLS zo\u0161it
-ExcelChart_Label_XAxis=X-os
-ExcelChart_Label_YAxes=Y-os
-ExcelChart_Status_Done=Export grafu do Excelu je hotov\u00FD.
-ExcelChart_Tab_Advanced=Roz\u0161\u00EDren\u00E9
-ExcelChart_Tab_Basic=Z\u00E1kladn\u00E9
-ExcelChart_Title_MainForm=Export grafu do Excelu
-ExcelChart_Type_Area3D=Oblas\u0165 3D
-ExcelChart_Type_Area=Oblas\u0165
-ExcelChart_Type_AreaStacked3D=Oblas\u0165 3D preplnen\u00E1
-ExcelChart_Type_AreaStacked=Oblas\u0165 preplnen\u00E1
-ExcelChart_Type_BarsClustered3D=St\u013Apce 3D natrieskan\u00E9
-ExcelChart_Type_BarsClustered=St\u013Apce natrieskan\u00E9
-ExcelChart_Type_BarsStacked3D=St\u013Apce 3D preplnen\u00E9
-ExcelChart_Type_BarsStacked=St\u013Apce preplnen\u00E9
-ExcelChart_Type_ColumnsClustered3D=St\u013Apce 3D natrieskan\u00E9
-ExcelChart_Type_ColumnsClustered=St\u013Apce natrieskan\u00E9
-ExcelChart_Type_ColumnsStacked3D=St\u013Apce 3D preplnen\u00E9
-ExcelChart_Type_ColumnsStacked=St\u013Apce preplnen\u00E9
-ExcelChart_Type_Line=\u010Ciara
-ExcelChart_Type_LineStacked=\u010Ciary sa nezmestia
-ExcelChart_Type_Pie3D=Kol\u00E1\u010D 3D
-ExcelChart_Type_Pie=Kol\u00E1\u010D
-ExcelChart_Type_PieExploded3D=Delen\u00FD kol\u00E1\u010D 3D
-ExcelChart_Type_PieExploded=Delen\u00FD kol\u00E1\u010D
-ExcelChart_Various_Averaged=spriemerovan\u00FD
-ExcelChart_Various_Column=St\u013Apec
-ExcelChart_Various_Frequency=Frekvencia
-ExcelChart_Various_SummedUp=zosumovan\u00E9
-ExcelChart_Various_Unknown=<nezn\u00E1me>
-ExportDate=D\u00E1tum exportu
-ExtendedSearchAddAttributeMenu=Prida\u0165 podmienku...
-ExtendedSearchAddEntityPrefix=m\u00E1
-ExtendedSearchAnd=a
-ExtendedSearchEditAttributeMenu=Upravi\u0165...
-ExtendedSearchEntitySuffix=s
-ExtendedSearchNegateMenu=Negova\u0165
-ExtendedSearchRemoveAttributeMenu=Odstr\u00E1ni\u0165
-ExtendedSearchRemoveMenu=Odstr\u00E1ni\u0165
-FileExistsOwerwriteQuestion=Vybran\u00FD s\u00FAbor u\u017E existuje. Prep\u00EDsa\u0165?
-FileName=N\u00E1zov s\u00FAboru
-FileNotFoundExceptionMessage=Ne\u00FAspe\u0161n\u00E9 vyh\u013Ead\u00E1vanie alebo pr\u00EDstup do s\u00FAboru.
-FileNotFoundMessage=S\u00FAbor nedostupn\u00FD.
-FileNotFoundTitle=S\u00FAbor nen\u00E1jden\u00FD.
-FilesOfType=Typ s\u00FAboru
-FormPrint=Tla\u010D
-FormSaveChangesQuestion=Ulo\u017Ei\u0165 zmeny?
-FormStateLoad=Na\u010D\u00EDta\u0165...
-FormStateStore=Ulo\u017Ei\u0165
-FormStateStoreAs=Ulo\u017Ei\u0165 ako...
-GlobalBookmarks=Ob\u013E\u00FAben\u00E9
-GlobalBookmarksAddMenu=Prida\u0165 k &ob\u013E\u00FAben\u00FDm
-Help=N\u00E1poveda
-Host=Hostite\u013E
-IOErrorInfo=Skontrolujte pr\u00EDslu\u0161n\u00E9 s\u00FAbory a pripojenie na server.
-IOErrorText=Chyba pri komunik\u00E1cii
-IOErrorTitle=Chyba \u010D\u00EDtania/z\u00E1pisu
-Info=Info
-Interrupted=Preru\u0161en\u00E9
-InterruptedErrorText=Proces bol preru\u0161en\u00FD u\u017E\u00EDvate\u013Eom.
-InterruptedErrorTitle=Proces zru\u0161en\u00FD
-JavaVMVersion=Java VM
-Language=Jazyk
-Live=Na\u017Eivo
-LoadFormXmlFailedText=Tento s\u00FAbor nepoch\u00E1dza z tohto dial\u00F3gu.
-LogicDateIsInDays=je presne (dn\u00ED)
-LogicDateIsInGEDays=je v najbli\u017E\u0161\u00EDch (d\u0148och)
-LogicDateIsInGEMonths=je v najbli\u017E\u0161\u00EDch (mesiacoch)
-LogicDateIsInLEDays=je v podledn\u00FDch (d\u0148och)
-LogicDateIsInLEMonths=je v podledn\u00FDch (mesiacoch)
-LogicDateIsInMonths=je presne (mesiacov)
-LogicDateIsNotToday=nie je dnes
-LogicDateIsToday=je dnes
-LogicDateTimeIsInGEHours=je v najbli\u017E\u0161\u00EDch (hodin\u00E1ch)
-LogicDateTimeIsInGEMinutes=je v najbli\u017E\u0161\u00EDch (min\u00FAtach)
-LogicDateTimeIsInLEHours=je v posledn\u00FDch (hodin\u00E1ch)
-LogicDateTimeIsInLEMinutes=je v posledn\u00FDch (min\u00FAtach)
-LogicDateTimeIsNotNow=nie je teraz
-LogicDateTimeIsNow=je teraz
-LogicEQ=\=
-LogicEndsWith=Kon\u010D\u00ED sa na
-LogicGE=>\=
-LogicGT=>
-LogicIn=Je
-LogicLE=<\=
-LogicLT=<
-LogicLike=Obsahuje
-LogicNEQ=<>
-LogicNotIn=nie je
-LogicNotLike=neobsahuje
-LogicNotNull=nie je pr\u00E1zdne
-LogicNull=je pr\u00E1zdne
-LogicStartsWith=Za\u010D\u00EDna sa na
-LogicTimeIsInGEHours=je v najbli\u017E\u0161\u00EDch (hodin\u00E1ch)
-LogicTimeIsInGEMinutes=je v najbli\u017E\u0161\u00EDch (min\u00FAtach)
-LogicTimeIsInHours=je presne (hod.)
-LogicTimeIsInLEHours=je v posledn\u00FDch (hodin\u00E1ch)
-LogicTimeIsInLEMinutes=je v posledn\u00FDch (min\u00FAtach)
-LogicTimeIsInMinutes=je presne (min.)
-LogicTimeIsNotNow=nie je teraz
-LogicTimeIsNow=je teraz
-Login=Prihl\u00E1senie
-LookAndFeel=Look and feel
-LookIn=Pozri v
-Month=Mesiac
-Name=Meno
-NetErrorInfo=Skontrolujte n\u00E1zov servera, adresu servera a pripojenie na server.
-NetErrorText=Server nebol n\u00E1jden\u00FD
-NetErrorTitle=Chyba siete
-NewPassword=Nov\u00E9 heslo
-No=Nie
-NoButton=&Nie
-NumberOfRows=Po\u010Det riadkov
-OSUser=WIN u\u017E\u00EDvate\u013E
-OSVersion=Verzia syst\u00E9mu
-Ok=OK
-OkButton=&OK
-OkButtonTooltip=Ulo\u017Ei\u0165 a zavrie\u0165
-OldPassword=Star\u00E9 heslo
-Op=Oper\u00E1tor
-Open=Otvori\u0165
-Password=Heslo
-PasswordsDoNotMatch=Nespr\u00E1vne overenie hesla
-Paste=Vlo\u017Ei\u0165
-Path=Cesta
-Pending=\u010Cak\u00E1m...
-Properties=Vlastnosti
-RepBuildExtract=Pr\u00EDprava d\u00E1t...
-RepExecAfter=Vy\u010Disti\u0165 datab\u00E1zu
-RepExecBefore=Pripravi\u0165 datab\u00E1zu
-RepUpdate=Spracov\u00E1van\u00E9 \u00FAdaje...
-RepeatPassword=Opakova\u0165
-ResetButton=&Reset
-ResetButtonTooltip=Vynuluj v\u0161etky polia
-Save=Ulo\u017Ei\u0165
-SaveButton=&Ulo\u017Ei\u0165
-SaveButtonTooltip=Ulo\u017Ei\u0165 bez od\u00EDdenia
-SearchButton=&Vyh\u013Ead\u00E1va\u0165
-SearchButtonTooltip=Zatv\u00E1ra dial\u00F3g a sp\u00FA\u0161\u0165a vyh\u013Ead\u00E1vanie
-SearchConstraints=Obmedzenie vyh\u013Ead\u00E1vania
-Server=Server
-SmartFindLabel=Vyh\u013Ead\u00E1vac\u00ED text
-StatusExportDone=Export hotov\u00FD.
-Style=\u0160t\u00FDl
-TableName=Tabu\u013Eka
-Timestamp=\u010Casov\u00E1 zn\u00E1mka
-Today=dnes
-TooManyRows=\u0160irok\u00FD v\u00FDber. Pou\u017Eite panel pre vyh\u013Ead\u00E1vanie.
-Update=Aktualiz\u00E1cia
-UserInterrupted=Zru\u0161en\u00E9 u\u017E\u00EDvate\u013Eom
-Username=U\u017E\u00EDvate\u013Esk\u00E9 meno
-Value=Hodnota
-Week=T\u00FD\u017Ede\u0148
-WeekShort=CW
-WizardCancelButton=Zru\u0161i\u0165
-WizardSuspendButton=&Zatvori\u0165
-WorkWeek=Pracovn\u00FD t\u00FD\u017Ede\u0148
-Yes=\u00C1no
-YesButton=&\u00C1no
-and=a
-between=Medzi
-from=Z
-to=do
+All=V\u0161etky
+Apply=Pou\u017Ei\u0165
+Attribute=Atrib\u00FAt
+Bookmarks=Z\u00E1lo\u017Eky
+BookmarksAddMenu=&Prida\u0165 k z\u00E1lo\u017Ek\u00E1m
+BookmarksMainMenu=&Z\u00E1lo\u017Eky
+BookmarksManageMenu=&Spr\u00E1va z\u00E1lo\u017Eiek...
+BookmarksStartPageMenu=&\u0160tartovac\u00ED poh\u013Ead
+BookmarksStartPageMenuClear=&Bez \u0161tartovacieho poh\u013Eadu
+BookmarksStartPageMenuGoto=&Otvori\u0165 \u0161tartovac\u00ED poh\u013Ead
+BookmarksStartPageMenuSet=&Nastavi\u0165 aktu\u00E1lny poh\u013Ead ako \u0161tartovac\u00ED
+Calendar_earlier=Sk\u00F4r
+Calendar_later=Nesk\u00F4r
+Cancel=Zru\u0161i\u0165
+CancelButton=&Zru\u0161i\u0165
+CancelButtonTooltip=Od\u00EDs\u0165 bez ulo\u017Eenia; s dotazom a je potrebn\u00E9
+ChangePassword=Zmeni\u0165 heslo
+Close=Zatvori\u0165
+CloseButton=&Zatvori\u0165
+CloseButtonTooltip=Od\u00EDs\u0165 bez ulo\u017Eenia
+Column=St\u013Apec
+Columns=St\u013Apce
+ComposerFieldAggregationLabel=Funkcia
+Condensed=6 st\u013Apcov
+Copy=K\u00F3p\u00EDruj
+Cut=Vystrihni
+Day=De\u0148
+DefaultPasswordPolicyText=Heslo mus\u00ED sp\u013A\u0148a\u0165 nasledovn\u00E9 krit\u00E9ria bezpe\u010Dnosti\:\n\nPravidl\u00E1\:\n- d\u013A\u017Eka aspo\u0148 8 znakov\n- aspo\u0148 jedna \u010D\u00EDslica (0-9)\n- aspo\u0148 jeden ne\u0161tandardn\u00FD znak (\!|@|\#|$|%|^|&|*|(|)|_|+|||~|-|
+Detail=Podrobnos\u0165
+Details=Podrobnosti
+EmailSubject=Predmet
+Enabled=Aktivovan\u00FD
+Error=Chyba
+ErrorAndRetryTextDefault=Pri prenose d\u00E1t sa vyskytla chyba.
+ErrorTextLogin=Nespr\u00E1vne meno/heslo
+ErrorTitleLogin=Prihl\u00E1senie zlyhalo
+ExcelChart_Button_LoadDefaults=Povodn\u00E9 hodnoty
+ExcelChart_Button_LoadDefaultsHint=Na\u010D\u00EDta\u0165 p\u00F4vodn\u00E9 hodnoty
+ExcelChart_Button_LoadProfile=Na\u010D\u00EDta\u0165 profil...
+ExcelChart_Button_LoadProfileHint=Na\u010D\u00EDta\u0165 nastavenia z XML
+ExcelChart_Button_SaveProfile=Ulo\u017Ei\u0165 profil...
+ExcelChart_Button_SaveProfileHint=Ulo\u017E\u0165 aktu\u00E1lne nastavenia do XML
+ExcelChart_Error_CreatingChartFailed=vytvorenie grafu zlyhalo
+ExcelChart_Error_ExportingFailed=Export zlyhal preto\u017Ee
+ExcelChart_Error_InitializationFailed=inicializ\u00E1cia podpornej triedy zlyhala.
+ExcelChart_Error_LoadingProfileFailed=Na\u010D\u00EDtanie profilu zlyhalo preto\u017Ee
+ExcelChart_Error_LoadingTemplateFailed=na\u010D\u00EDtanie \u0161ablony zlyhalo.
+ExcelChart_Error_RetrivingOutlineDataFailed=vyh\u013Eadanie d\u00E1t outlinu zlyhalo.
+ExcelChart_Error_SavingProfileFailed=Ulo\u017Eenie profilu zlyhalo preto\u017Ee
+ExcelChart_Error_WrongProfile=profil bol vytvoren\u00FD pre in\u00FD outline.
+ExcelChart_Label_AutomaticMode=Automatick\u00FD m\u00F3d
+ExcelChart_Label_AutomaticModeHint=Skry Excel a ulo\u017E automaticky
+ExcelChart_Label_ChartNumber=\u010C\u00EDslo grafu
+ExcelChart_Label_ChartType=Typ grafu
+ExcelChart_Label_FileName=Meno s\u00FAboru
+ExcelChart_Label_FirstRow=Prv\u00FD riadok
+ExcelChart_Label_Height=V\u00FD\u0161ka
+ExcelChart_Label_HistogramMode=Histogram
+ExcelChart_Label_HistogramModeHint=Histogram p\u00E1ruje rovnak\u00E9 hodnoty na os X.
+ExcelChart_Label_LastRow=Posledn\u00FD riadok
+ExcelChart_Label_Offset=Poz\u00EDcia
+ExcelChart_Label_SkipNullValues=Presko\u010Di\u0165 nulov\u00E9 hodnoty v histograme
+ExcelChart_Label_SkipNullValuesHint=Ak za\u0161krtnut\u00E9, nulov\u00E9 hodnoty na osi X bud\u00FA ignorovan\u00E9, inak bud\u00FA sp\u00E1rovan\u00E9 s <nezn\u00E1my>.
+ExcelChart_Label_TemplateName=\u0160ablona
+ExcelChart_Label_UseCustomFormat=Pou\u017Ei\u0165 vlastn\u00FD form\u00E1t
+ExcelChart_Label_UseCustomFormatHint=Ak za\u0161krtnut\u00E9, je mo\u017En\u00E9 ur\u010Di\u0165 poz\u00EDciu a ve\u013Ekot grafu.
+ExcelChart_Label_UseExistingChart=Pou\u017Ei\u0165 existuj\u00FAci graf
+ExcelChart_Label_UseExistingChartHint=Ak za\u0161krtnut\u00E9, bude pou\u017Eit\u00FD existuj\u00FAci graf v \u0161ablone
+ExcelChart_Label_UseSelectiveExport=Pou\u017Ei\u0165 podmien\u00FD export
+ExcelChart_Label_UseSelectiveExportHint=Ak za\u0161krtnut\u00E9, bud\u00FA exportovan\u00E9 iba dole ur\u010Den\u00E9 riadky.
+ExcelChart_Label_Width=\u0160\u00EDrka
+ExcelChart_Label_WorksheetName=XLS zo\u0161it
+ExcelChart_Label_XAxis=X-os
+ExcelChart_Label_YAxes=Y-os
+ExcelChart_Status_Done=Export grafu do Excelu je hotov\u00FD.
+ExcelChart_Tab_Advanced=Roz\u0161\u00EDren\u00E9
+ExcelChart_Tab_Basic=Z\u00E1kladn\u00E9
+ExcelChart_Title_MainForm=Export grafu do Excelu
+ExcelChart_Type_Area3D=Oblas\u0165 3D
+ExcelChart_Type_Area=Oblas\u0165
+ExcelChart_Type_AreaStacked3D=Oblas\u0165 3D preplnen\u00E1
+ExcelChart_Type_AreaStacked=Oblas\u0165 preplnen\u00E1
+ExcelChart_Type_BarsClustered3D=St\u013Apce 3D natrieskan\u00E9
+ExcelChart_Type_BarsClustered=St\u013Apce natrieskan\u00E9
+ExcelChart_Type_BarsStacked3D=St\u013Apce 3D preplnen\u00E9
+ExcelChart_Type_BarsStacked=St\u013Apce preplnen\u00E9
+ExcelChart_Type_ColumnsClustered3D=St\u013Apce 3D natrieskan\u00E9
+ExcelChart_Type_ColumnsClustered=St\u013Apce natrieskan\u00E9
+ExcelChart_Type_ColumnsStacked3D=St\u013Apce 3D preplnen\u00E9
+ExcelChart_Type_ColumnsStacked=St\u013Apce preplnen\u00E9
+ExcelChart_Type_Line=\u010Ciara
+ExcelChart_Type_LineStacked=\u010Ciary sa nezmestia
+ExcelChart_Type_Pie3D=Kol\u00E1\u010D 3D
+ExcelChart_Type_Pie=Kol\u00E1\u010D
+ExcelChart_Type_PieExploded3D=Delen\u00FD kol\u00E1\u010D 3D
+ExcelChart_Type_PieExploded=Delen\u00FD kol\u00E1\u010D
+ExcelChart_Various_Averaged=spriemerovan\u00FD
+ExcelChart_Various_Column=St\u013Apec
+ExcelChart_Various_Frequency=Frekvencia
+ExcelChart_Various_SummedUp=zosumovan\u00E9
+ExcelChart_Various_Unknown=<nezn\u00E1me>
+ExportDate=D\u00E1tum exportu
+ExtendedSearchAddAttributeMenu=Prida\u0165 podmienku...
+ExtendedSearchAddEntityPrefix=m\u00E1
+ExtendedSearchAnd=a
+ExtendedSearchEditAttributeMenu=Upravi\u0165...
+ExtendedSearchEntitySuffix=s
+ExtendedSearchNegateMenu=Negova\u0165
+ExtendedSearchRemoveAttributeMenu=Odstr\u00E1ni\u0165
+ExtendedSearchRemoveMenu=Odstr\u00E1ni\u0165
+FileExistsOwerwriteQuestion=Vybran\u00FD s\u00FAbor u\u017E existuje. Prep\u00EDsa\u0165?
+FileName=N\u00E1zov s\u00FAboru
+FileNotFoundExceptionMessage=Ne\u00FAspe\u0161n\u00E9 vyh\u013Ead\u00E1vanie alebo pr\u00EDstup do s\u00FAboru.
+FileNotFoundMessage=S\u00FAbor nedostupn\u00FD.
+FileNotFoundTitle=S\u00FAbor nen\u00E1jden\u00FD.
+FilesOfType=Typ s\u00FAboru
+FormPrint=Tla\u010D
+FormSaveChangesQuestion=Ulo\u017Ei\u0165 zmeny?
+FormStateLoad=Na\u010D\u00EDta\u0165...
+FormStateStore=Ulo\u017Ei\u0165
+FormStateStoreAs=Ulo\u017Ei\u0165 ako...
+GlobalBookmarks=Ob\u013E\u00FAben\u00E9
+GlobalBookmarksAddMenu=Prida\u0165 k &ob\u013E\u00FAben\u00FDm
+Help=N\u00E1poveda
+Host=Hostite\u013E
+IOErrorInfo=Skontrolujte pr\u00EDslu\u0161n\u00E9 s\u00FAbory a pripojenie na server.
+IOErrorText=Chyba pri komunik\u00E1cii
+IOErrorTitle=Chyba \u010D\u00EDtania/z\u00E1pisu
+Info=Info
+Interrupted=Preru\u0161en\u00E9
+InterruptedErrorText=Proces bol preru\u0161en\u00FD u\u017E\u00EDvate\u013Eom.
+InterruptedErrorTitle=Proces zru\u0161en\u00FD
+JavaVMVersion=Java VM
+Language=Jazyk
+Live=Na\u017Eivo
+LoadFormXmlFailedText=Tento s\u00FAbor nepoch\u00E1dza z tohto dial\u00F3gu.
+LogicDateIsInDays=je presne (dn\u00ED)
+LogicDateIsInGEDays=je v najbli\u017E\u0161\u00EDch (d\u0148och)
+LogicDateIsInGEMonths=je v najbli\u017E\u0161\u00EDch (mesiacoch)
+LogicDateIsInLEDays=je v podledn\u00FDch (d\u0148och)
+LogicDateIsInLEMonths=je v podledn\u00FDch (mesiacoch)
+LogicDateIsInMonths=je presne (mesiacov)
+LogicDateIsNotToday=nie je dnes
+LogicDateIsToday=je dnes
+LogicDateTimeIsInGEHours=je v najbli\u017E\u0161\u00EDch (hodin\u00E1ch)
+LogicDateTimeIsInGEMinutes=je v najbli\u017E\u0161\u00EDch (min\u00FAtach)
+LogicDateTimeIsInLEHours=je v posledn\u00FDch (hodin\u00E1ch)
+LogicDateTimeIsInLEMinutes=je v posledn\u00FDch (min\u00FAtach)
+LogicDateTimeIsNotNow=nie je teraz
+LogicDateTimeIsNow=je teraz
+LogicEQ=\=
+LogicEndsWith=Kon\u010D\u00ED sa na
+LogicGE=>\=
+LogicGT=>
+LogicIn=Je
+LogicLE=<\=
+LogicLT=<
+LogicLike=Obsahuje
+LogicNEQ=<>
+LogicNotIn=nie je
+LogicNotLike=neobsahuje
+LogicNotNull=nie je pr\u00E1zdne
+LogicNull=je pr\u00E1zdne
+LogicStartsWith=Za\u010D\u00EDna sa na
+LogicTimeIsInGEHours=je v najbli\u017E\u0161\u00EDch (hodin\u00E1ch)
+LogicTimeIsInGEMinutes=je v najbli\u017E\u0161\u00EDch (min\u00FAtach)
+LogicTimeIsInHours=je presne (hod.)
+LogicTimeIsInLEHours=je v posledn\u00FDch (hodin\u00E1ch)
+LogicTimeIsInLEMinutes=je v posledn\u00FDch (min\u00FAtach)
+LogicTimeIsInMinutes=je presne (min.)
+LogicTimeIsNotNow=nie je teraz
+LogicTimeIsNow=je teraz
+Login=Prihl\u00E1senie
+LookAndFeel=Look and feel
+LookIn=Pozri v
+Month=Mesiac
+Name=Meno
+NetErrorInfo=Skontrolujte n\u00E1zov servera, adresu servera a pripojenie na server.
+NetErrorText=Server nebol n\u00E1jden\u00FD
+NetErrorTitle=Chyba siete
+NewPassword=Nov\u00E9 heslo
+No=Nie
+NoButton=&Nie
+NumberOfRows=Po\u010Det riadkov
+OSUser=WIN u\u017E\u00EDvate\u013E
+OSVersion=Verzia syst\u00E9mu
+Ok=OK
+OkButton=&OK
+OkButtonTooltip=Ulo\u017Ei\u0165 a zavrie\u0165
+OldPassword=Star\u00E9 heslo
+Op=Oper\u00E1tor
+Open=Otvori\u0165
+Password=Heslo
+PasswordsDoNotMatch=Nespr\u00E1vne overenie hesla
+Paste=Vlo\u017Ei\u0165
+Path=Cesta
+Pending=\u010Cak\u00E1m...
+Properties=Vlastnosti
+RepBuildExtract=Pr\u00EDprava d\u00E1t...
+RepExecAfter=Vy\u010Disti\u0165 datab\u00E1zu
+RepExecBefore=Pripravi\u0165 datab\u00E1zu
+RepUpdate=Spracov\u00E1van\u00E9 \u00FAdaje...
+RepeatPassword=Opakova\u0165
+ResetButton=&Reset
+ResetButtonTooltip=Vynuluj v\u0161etky polia
+Save=Ulo\u017Ei\u0165
+SaveButton=&Ulo\u017Ei\u0165
+SaveButtonTooltip=Ulo\u017Ei\u0165 bez od\u00EDdenia
+SearchButton=&Vyh\u013Ead\u00E1va\u0165
+SearchButtonTooltip=Zatv\u00E1ra dial\u00F3g a sp\u00FA\u0161\u0165a vyh\u013Ead\u00E1vanie
+SearchConstraints=Obmedzenie vyh\u013Ead\u00E1vania
+Server=Server
+SmartFindLabel=Vyh\u013Ead\u00E1vac\u00ED text
+StatusExportDone=Export hotov\u00FD.
+Style=\u0160t\u00FDl
+TableName=Tabu\u013Eka
+Timestamp=\u010Casov\u00E1 zn\u00E1mka
+Today=dnes
+TooManyRows=\u0160irok\u00FD v\u00FDber. Pou\u017Eite panel pre vyh\u013Ead\u00E1vanie.
+Update=Aktualiz\u00E1cia
+UserInterrupted=Zru\u0161en\u00E9 u\u017E\u00EDvate\u013Eom
+Username=U\u017E\u00EDvate\u013Esk\u00E9 meno
+Value=Hodnota
+Week=T\u00FD\u017Ede\u0148
+WeekShort=CW
+WizardCancelButton=Zru\u0161i\u0165
+WizardSuspendButton=&Zatvori\u0165
+WorkWeek=Pracovn\u00FD t\u00FD\u017Ede\u0148
+Yes=\u00C1no
+YesButton=&\u00C1no
+and=a
+between=Medzi
+from=Z
+to=do
diff --git a/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_sl.properties b/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_sl.properties
index ba049cf6f5..06535ebace 100644
--- a/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_sl.properties
+++ b/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_sl.properties
@@ -1,38 +1,38 @@
-ActiveAndInactiveStates=Aktivno+Neaktivno
-ActiveStates=Aktiven
-AllStates=Vse
-BookmarksMainMenu=&Zapiski
-CancelButton=&Preklicati
-ComposerFieldAggregationLabel=Funkcija
-Day=Dan
-DefaultPasswordPolicyText=Geslo ni v skladu s predpisanimi zahtevami\:\n\nZahteve\:\n- vsaj 8 znakov\n- vsaj ena \u0161tevilka (0-9)\n- vsaj en nestandardni znak\n(\!|@|\#|$|%|^|&|*|(|)|_|+|||~|-|
-EmailFrom=Od
-EmailSubject=Predmet
-EmailTo=Za
-Error=Napaka
-ExcelChart_Button_SaveProfile=Shrani profil...
-ExcelChart_Error_ExportingFailed=Izvoz ni uspel ker
-ExcelChart_Label_FirstRow=Prva vrstica
-ExcelChart_Label_LastRow=Zadnja vrstica
-ExcelChart_Label_Offset=Pozicija
-ExcelChart_Type_Area3D=Obmo\u010Dje 3D
-ExcelChart_Type_ColumnsClustered=Stolpci
-ExcelChart_Type_ColumnsStacked=Zlo\u017Eeno v stolpce
-ExcelChart_Type_Line=Vrstica
-ExcelChart_Various_Column=Stolpec
-ExtendedSearchRemoveMenu=Odstraniti
-FileNotFoundMessage=Datoteke ni bilo mogo\u010De najti\:
-FormPrint=Tiskanje
-FormStateStore=Shraniti
-InactiveState=neaktivno
-InactiveStates=Neaktiven
-LogicDateIsInGEDays=Datum>\=danes + \u0161t. dni
-LogicEndsWith=kon\u010Dati z
-LogicIn=je
-LogicNull=je prazen
-Name=Ime
-SearchConstraints=Omejitev iskanja
-Value=Vrednost
-WizardCancelButton=Prekli\u010Di
-WizardSuspendButton=&Zapri
-WorkWeek=Delovni teden
+ActiveAndInactiveStates=Aktivno+Neaktivno
+ActiveStates=Aktiven
+AllStates=Vse
+BookmarksMainMenu=&Zapiski
+CancelButton=&Preklicati
+ComposerFieldAggregationLabel=Funkcija
+Day=Dan
+DefaultPasswordPolicyText=Geslo ni v skladu s predpisanimi zahtevami\:\n\nZahteve\:\n- vsaj 8 znakov\n- vsaj ena \u0161tevilka (0-9)\n- vsaj en nestandardni znak\n(\!|@|\#|$|%|^|&|*|(|)|_|+|||~|-|
+EmailFrom=Od
+EmailSubject=Predmet
+EmailTo=Za
+Error=Napaka
+ExcelChart_Button_SaveProfile=Shrani profil...
+ExcelChart_Error_ExportingFailed=Izvoz ni uspel ker
+ExcelChart_Label_FirstRow=Prva vrstica
+ExcelChart_Label_LastRow=Zadnja vrstica
+ExcelChart_Label_Offset=Pozicija
+ExcelChart_Type_Area3D=Obmo\u010Dje 3D
+ExcelChart_Type_ColumnsClustered=Stolpci
+ExcelChart_Type_ColumnsStacked=Zlo\u017Eeno v stolpce
+ExcelChart_Type_Line=Vrstica
+ExcelChart_Various_Column=Stolpec
+ExtendedSearchRemoveMenu=Odstraniti
+FileNotFoundMessage=Datoteke ni bilo mogo\u010De najti\:
+FormPrint=Tiskanje
+FormStateStore=Shraniti
+InactiveState=neaktivno
+InactiveStates=Neaktiven
+LogicDateIsInGEDays=Datum>\=danes + \u0161t. dni
+LogicEndsWith=kon\u010Dati z
+LogicIn=je
+LogicNull=je prazen
+Name=Ime
+SearchConstraints=Omejitev iskanja
+Value=Vrednost
+WizardCancelButton=Prekli\u010Di
+WizardSuspendButton=&Zapri
+WorkWeek=Delovni teden
diff --git a/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_sr.properties b/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_sr.properties
index 15965729ea..97153bfa81 100644
--- a/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_sr.properties
+++ b/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_sr.properties
@@ -1,217 +1,217 @@
-AllStates=Svi, sve
-Apply=Primeni
-Attribute=Osobina
-Bookmarks=Bookmarks
-BookmarksAddMenu=&Dodaj u bookmarks
-BookmarksMainMenu=&Bookmarks
-BookmarksManageMenu=&Upravljanje bookmarks
-BookmarksStartPageMenu=&Po\u010Detni pogled
-BookmarksStartPageMenuClear=&Nema po\u010Detnog pogleda
-BookmarksStartPageMenuGoto=&Otvori po\u010Detni pogled
-BookmarksStartPageMenuSet=&Postavi trenutni pogled kao po\u010Detni
-ButtonDeselectAll=Ukini izbor svih
-ButtonSelectAll=Izaberi sve
-Calendar_earlier=Raniji
-Calendar_later=Kasnije
-Cancel=Odustani
-CancelButton=&Odustani
-CancelButtonTooltip=Zatvori dijalog bez \u010Duvanja; sa potvrdom dijaloga ako je potrebno
-ChangePassword=Izmeni lozinku
-CloseButton=&Zatvori
-CloseButtonTooltip=Zatvori dijalog bez \u010Duvanja
-Column=Kolona
-Columns=Kolone
-ComposerFieldAggregationLabel=Funkcija
-Condensed=6 kolona
-Copy=Kopiraj
-Cut=Iseci
-Day=Dan
-DefaultPasswordPolicyText=lozinka ne odgovara zadatom pravilu.
-EmailSubject=Predmet
-Error=Gre\u0161ka
-ErrorAndRetryTextDefault=Pojavila se gre\u0161ka prilikom prenosa podataka
-ErrorTextLogin=Neispravno korisni\u010Dko ime / lozinka
-ErrorTitleLogin=Prijavljivanje nije uspelo
-ExcelChart_Button_LoadDefaults=Predefinisane vrednosti
-ExcelChart_Button_LoadDefaultsHint=Poni\u0161tava ovaj dijalog u\u010Ditavanjem predefinisanih vrednosti.
-ExcelChart_Button_LoadProfile=U\u010Ditaj profil...
-ExcelChart_Button_LoadProfileHint=U\u010Ditaj pode\u0161avanja iz XML datoteke.
-ExcelChart_Button_SaveProfile=Sa\u010Duvaj profil...
-ExcelChart_Button_SaveProfileHint=\u010Cuva teku\u0107a pode\u0161avanja u XML datoteci.
-ExcelChart_Error_CreatingChartFailed=Neuspelo pravljenje dijagrama
-ExcelChart_Error_ExportingFailed=Izvoz neuspeo zbog
-ExcelChart_Error_InitializationFailed=Neuspelo iniciranje klase(a) za podr\u0161ku.
-ExcelChart_Error_LoadingProfileFailed=Neuspelo u\u010Ditavanje profila zbog
-ExcelChart_Error_LoadingTemplateFailed=Neuspelo u\u010Ditavanje modela.
-ExcelChart_Error_RetrivingOutlineDataFailed=Neuspelo preuzimanje spoljnih podataka.
-ExcelChart_Error_SavingProfileFailed=Neuspelo \u010Duvanje profila zbog
-ExcelChart_Error_WrongProfile=Profil je kreiran za drugi okvir.
-ExcelChart_Label_AutomaticMode=Automatski na\u010Din
-ExcelChart_Label_AutomaticModeHint=Sakrij Excel i sa\u010Duvaj automatski.
-ExcelChart_Label_ChartNumber=Broj dijagrama
-ExcelChart_Label_ChartType=Tip dijagrama
-ExcelChart_Label_FileName=Ime datoteke
-ExcelChart_Label_FirstRow=Prvi red
-ExcelChart_Label_Height=Visina
-ExcelChart_Label_HistogramMode=Histogram na\u010Din
-ExcelChart_Label_HistogramModeHint=The histogram mode combines identical values on the X-Axis to one.
-ExcelChart_Label_LastRow=Posledni red
-ExcelChart_Label_Offset=Pozicija
-ExcelChart_Label_SkipNullValues=Presko\u010Di vrednosti nula u histogram na\u010Dinu
-ExcelChart_Label_TemplateName=Model
-ExcelChart_Label_UseCustomFormat=Koristi sopstveni format
-ExcelChart_Label_UseCustomFormatHint=Ako je ozna\u010Deno mo\u017Eete odrediti polo\u017Eaj i veli\u010Dinu dijagrama
-ExcelChart_Label_UseExistingChart=Koristite postoje\u0107i dijagram
-ExcelChart_Label_UseExistingChartHint=Ako je ozna\u010Deno koristi se postoje\u0107i dijagram u ozna\u010Denom modelu
-ExcelChart_Label_UseSelectiveExport=Koristi selektivni izvoz
-ExcelChart_Label_UseSelectiveExportHint=Ako je ozna\u010Deno izvoze se samo ni\u017Ee navedeni redovi
-ExcelChart_Label_Width=\u0160irina
-ExcelChart_Label_WorksheetName=radni list
-ExcelChart_Label_XAxis=X-osa
-ExcelChart_Label_YAxes=Z-ose
-ExcelChart_Status_Done=Izvoz Excel dijagrama je zavr\u0161en.
-ExcelChart_Tab_Advanced=Napredni
-ExcelChart_Tab_Basic=Osnovni
-ExcelChart_Title_MainForm=Izvoz Excel dijagrama je zavr\u0161en.
-ExcelChart_Type_Area3D=Oblast 3D
-ExcelChart_Type_Area=Oblast
-ExcelChart_Type_AreaStacked3D=Sabijena 3D oblast
-ExcelChart_Type_AreaStacked=Sabijena oblast
-ExcelChart_Type_BarsClustered3D=Bars Clustered 3D
-ExcelChart_Type_BarsClustered=Bars Clustered
-ExcelChart_Type_BarsStacked3D=Bars Stacked 3D
-ExcelChart_Type_BarsStacked=Bars Stacked
-ExcelChart_Type_ColumnsClustered3D=Grupisane kolone 3D
-ExcelChart_Type_ColumnsClustered=Grupisane kolone
-ExcelChart_Type_ColumnsStacked3D=Sabijene kolone 3D
-ExcelChart_Type_ColumnsStacked=Sabijene kolone
-ExcelChart_Type_Line=Linija
-ExcelChart_Type_LineStacked=Sabijena linija
-ExcelChart_Type_Pie3D=3D pita
-ExcelChart_Type_Pie=Pita
-ExcelChart_Type_PieExploded3D=Pie Exploded 3D
-ExcelChart_Type_PieExploded=Pie exploded
-ExcelChart_Various_Averaged=prose\u010Dan
-ExcelChart_Various_Column=Kolona
-ExcelChart_Various_Frequency=U\u010Destalost
-ExcelChart_Various_SummedUp=sabrano
-ExcelChart_Various_Unknown=<Nepoznat>
-ExportDate=Datum izvoza
-ExtendedSearchAddAttributeMenu=Dodaj ograni\u010Denje...
-ExtendedSearchAddEntityPrefix=ima
-ExtendedSearchAnd=i
-ExtendedSearchEditAttributeMenu=Izmeni...
-ExtendedSearchEntitySuffix=sa
-ExtendedSearchNegateMenu=negiraj
-ExtendedSearchRemoveAttributeMenu=Ukloni
-ExtendedSearchRemoveMenu=Ukloni
-FileExistsOwerwriteQuestion=Odabrana datoteka ve\u0107 postoji. Prepisati preko nje?
-FileName=Ime datoteke
-FileNotFoundMessage=Ne mo\u017Ee se prona\u0107i datoteka.
-FileNotFoundTitle=Datoteka nije prona\u0111ena
-FilesOfType=Tip datoteke
-FormPrint=\u0160tampa
-FormSaveChangesQuestion=Da li \u017Eelite da sa\u010Duvate promene?
-FormStateLoad=U\u010Ditaj...
-FormStateStore=Sa\u010Duvaj
-FormStateStoreAs=Sa\u010Duvaj kao...
-GlobalBookmarks=Globalni bookmarks
-GlobalBookmarksAddMenu=Dodaj u &globalni bookmark
-Help=Pomo\u0107
-IOErrorInfo=Proverite datoteke i vezu.
-IOErrorText=Gre\u0161ka u komunikacijama
-IOErrorTitle=Gre\u0161ka pri \u010Ditanju/pisanju
-Info=Informacija
-Interrupted=Prekinut
-InterruptedErrorText=Proces je prekinut ru\u010Dno
-InterruptedErrorTitle=Proces je prekinut.
-JavaVMVersion=Java VM
-Language=Jezik
-LoadFormXmlFailedText=Datoteka nije kompatibilna sa ovim dijalogom
-LogicDateIsInDays=je za ta\u010Dno (dana)
-LogicDateIsInGEDays=je najranije za (dana)
-LogicDateIsInGEMonths=je najranije za (meseci)
-LogicDateIsInLEDays=je najkasnije za (dana)
-LogicDateIsInLEMonths=je najkasnije za (meseci)
-LogicDateIsInMonths=je ta\u010Dno za (meseci)
-LogicDateIsNotToday=nije danas
-LogicDateIsToday=je danas
-LogicDateTimeIsInGEHours=je najranije za (sati)
-LogicDateTimeIsInGEMinutes=je najranije za (minuta)
-LogicDateTimeIsInLEHours=je najkasnije za (sati)
-LogicDateTimeIsInLEMinutes=je najkasnije za (minuta)
-LogicDateTimeIsNotNow=nije nizak
-LogicDateTimeIsNow=je nizak
-LogicEQ=\=
-LogicEndsWith=zavr\u0161ava sa
-LogicGE=>\=
-LogicGT=>
-LogicIn=je
-LogicLE=<\=
-LogicLT=<
-LogicLike=sadr\u017Ei
-LogicNEQ=<>
-LogicNotIn=nije
-LogicNotLike=ne sadr\u017Ei
-LogicNotNull=nije prazan
-LogicNull=je prazan
-LogicStartsWith=po\u010Dinje sa
-LogicTimeIsInGEHours=je najranije za (sati)
-LogicTimeIsInGEMinutes=je najranije za (minuta)
-LogicTimeIsInHours=je ta\u010Dno za (sati)
-LogicTimeIsInLEHours=je najkasnije za (sati)
-LogicTimeIsInLEMinutes=je najkasnije za (minuta)
-LogicTimeIsInMinutes=je ta\u010Dno za (minuta)
-LogicTimeIsNotNow=nije nizak
-LogicTimeIsNow=je sada
-Login=Prijavljivanje
-LookIn=Pogledaj u
-Month=Mesec
-Name=Ime, naziv
-NetErrorInfo=Proverite ime servera, url i vezu
-NetErrorText=Server nije prona\u0111en
-NetErrorTitle=Gre\u0161ka na mre\u017Ei
-NewPassword=Nova lozinka
-No=Ne
-NoButton=&Ne
-NumberOfRows=Broj reda
-OSUser=Sisitemski korisnik
-OSVersion=Verzija sistema
-Ok=Ok
-OkButton=&Ok
-OkButtonTooltip=Sa\u010Duvaj i zatvori dijalog
-OldPassword=Stara lozinka
-Op=Operater
-Open=Otvori, otvoren
-Password=Lozinka
-PasswordsDoNotMatch=Dve lozinke se ne sla\u017Eu.
-Paste=Prepi\u0161i
-Path=Putanja
-RepeatPassword=Ponovi
-ResetButton=&Poni\u0161ti
-ResetButtonTooltip=Postavi sva polja dijalga na prazno
-Save=Sa\u010Duvaj
-SaveButton=&Sa\u010Duvaj
-SaveButtonTooltip=Sa\u010Duvaj dijalog bez zatvaranja
-SearchButton=&Pretra\u017Ei
-SearchButtonTooltip=Zatvori dijalog i po\u010Dni pretra\u017Eivanje
-SearchConstraints=Kriterijumi za pretra\u017Eivanje
-Server=Server
-SmartFindLabel=Tekst za pretra\u017Eivanje
-StatusExportDone=izvoz zavr\u0161en
-Today=danas
-TooManyRows=Veliki set podataka. Suzite koriste\u0107i panel za pretragu
-Update=A\u017Euriraj
-UserInterrupted=Prekinut od strane korisnika
-Username=Korisni\u010Dko ime
-Value=Vrednost
-Week=Nedelja
-WeekShort=CW
-WizardCancelButton=Poni\u0161ti
-WizardSuspendButton=&Zatvori
-WorkWeek=Radna nedelja
-Yes=Da
-YesButton=&Da
-and=i
-from=Odabrana datoteka ve\u0107 postoji. Prepisati preko nje?
-to=do
+AllStates=Svi, sve
+Apply=Primeni
+Attribute=Osobina
+Bookmarks=Bookmarks
+BookmarksAddMenu=&Dodaj u bookmarks
+BookmarksMainMenu=&Bookmarks
+BookmarksManageMenu=&Upravljanje bookmarks
+BookmarksStartPageMenu=&Po\u010Detni pogled
+BookmarksStartPageMenuClear=&Nema po\u010Detnog pogleda
+BookmarksStartPageMenuGoto=&Otvori po\u010Detni pogled
+BookmarksStartPageMenuSet=&Postavi trenutni pogled kao po\u010Detni
+ButtonDeselectAll=Ukini izbor svih
+ButtonSelectAll=Izaberi sve
+Calendar_earlier=Raniji
+Calendar_later=Kasnije
+Cancel=Odustani
+CancelButton=&Odustani
+CancelButtonTooltip=Zatvori dijalog bez \u010Duvanja; sa potvrdom dijaloga ako je potrebno
+ChangePassword=Izmeni lozinku
+CloseButton=&Zatvori
+CloseButtonTooltip=Zatvori dijalog bez \u010Duvanja
+Column=Kolona
+Columns=Kolone
+ComposerFieldAggregationLabel=Funkcija
+Condensed=6 kolona
+Copy=Kopiraj
+Cut=Iseci
+Day=Dan
+DefaultPasswordPolicyText=lozinka ne odgovara zadatom pravilu.
+EmailSubject=Predmet
+Error=Gre\u0161ka
+ErrorAndRetryTextDefault=Pojavila se gre\u0161ka prilikom prenosa podataka
+ErrorTextLogin=Neispravno korisni\u010Dko ime / lozinka
+ErrorTitleLogin=Prijavljivanje nije uspelo
+ExcelChart_Button_LoadDefaults=Predefinisane vrednosti
+ExcelChart_Button_LoadDefaultsHint=Poni\u0161tava ovaj dijalog u\u010Ditavanjem predefinisanih vrednosti.
+ExcelChart_Button_LoadProfile=U\u010Ditaj profil...
+ExcelChart_Button_LoadProfileHint=U\u010Ditaj pode\u0161avanja iz XML datoteke.
+ExcelChart_Button_SaveProfile=Sa\u010Duvaj profil...
+ExcelChart_Button_SaveProfileHint=\u010Cuva teku\u0107a pode\u0161avanja u XML datoteci.
+ExcelChart_Error_CreatingChartFailed=Neuspelo pravljenje dijagrama
+ExcelChart_Error_ExportingFailed=Izvoz neuspeo zbog
+ExcelChart_Error_InitializationFailed=Neuspelo iniciranje klase(a) za podr\u0161ku.
+ExcelChart_Error_LoadingProfileFailed=Neuspelo u\u010Ditavanje profila zbog
+ExcelChart_Error_LoadingTemplateFailed=Neuspelo u\u010Ditavanje modela.
+ExcelChart_Error_RetrivingOutlineDataFailed=Neuspelo preuzimanje spoljnih podataka.
+ExcelChart_Error_SavingProfileFailed=Neuspelo \u010Duvanje profila zbog
+ExcelChart_Error_WrongProfile=Profil je kreiran za drugi okvir.
+ExcelChart_Label_AutomaticMode=Automatski na\u010Din
+ExcelChart_Label_AutomaticModeHint=Sakrij Excel i sa\u010Duvaj automatski.
+ExcelChart_Label_ChartNumber=Broj dijagrama
+ExcelChart_Label_ChartType=Tip dijagrama
+ExcelChart_Label_FileName=Ime datoteke
+ExcelChart_Label_FirstRow=Prvi red
+ExcelChart_Label_Height=Visina
+ExcelChart_Label_HistogramMode=Histogram na\u010Din
+ExcelChart_Label_HistogramModeHint=The histogram mode combines identical values on the X-Axis to one.
+ExcelChart_Label_LastRow=Posledni red
+ExcelChart_Label_Offset=Pozicija
+ExcelChart_Label_SkipNullValues=Presko\u010Di vrednosti nula u histogram na\u010Dinu
+ExcelChart_Label_TemplateName=Model
+ExcelChart_Label_UseCustomFormat=Koristi sopstveni format
+ExcelChart_Label_UseCustomFormatHint=Ako je ozna\u010Deno mo\u017Eete odrediti polo\u017Eaj i veli\u010Dinu dijagrama
+ExcelChart_Label_UseExistingChart=Koristite postoje\u0107i dijagram
+ExcelChart_Label_UseExistingChartHint=Ako je ozna\u010Deno koristi se postoje\u0107i dijagram u ozna\u010Denom modelu
+ExcelChart_Label_UseSelectiveExport=Koristi selektivni izvoz
+ExcelChart_Label_UseSelectiveExportHint=Ako je ozna\u010Deno izvoze se samo ni\u017Ee navedeni redovi
+ExcelChart_Label_Width=\u0160irina
+ExcelChart_Label_WorksheetName=radni list
+ExcelChart_Label_XAxis=X-osa
+ExcelChart_Label_YAxes=Z-ose
+ExcelChart_Status_Done=Izvoz Excel dijagrama je zavr\u0161en.
+ExcelChart_Tab_Advanced=Napredni
+ExcelChart_Tab_Basic=Osnovni
+ExcelChart_Title_MainForm=Izvoz Excel dijagrama je zavr\u0161en.
+ExcelChart_Type_Area3D=Oblast 3D
+ExcelChart_Type_Area=Oblast
+ExcelChart_Type_AreaStacked3D=Sabijena 3D oblast
+ExcelChart_Type_AreaStacked=Sabijena oblast
+ExcelChart_Type_BarsClustered3D=Bars Clustered 3D
+ExcelChart_Type_BarsClustered=Bars Clustered
+ExcelChart_Type_BarsStacked3D=Bars Stacked 3D
+ExcelChart_Type_BarsStacked=Bars Stacked
+ExcelChart_Type_ColumnsClustered3D=Grupisane kolone 3D
+ExcelChart_Type_ColumnsClustered=Grupisane kolone
+ExcelChart_Type_ColumnsStacked3D=Sabijene kolone 3D
+ExcelChart_Type_ColumnsStacked=Sabijene kolone
+ExcelChart_Type_Line=Linija
+ExcelChart_Type_LineStacked=Sabijena linija
+ExcelChart_Type_Pie3D=3D pita
+ExcelChart_Type_Pie=Pita
+ExcelChart_Type_PieExploded3D=Pie Exploded 3D
+ExcelChart_Type_PieExploded=Pie exploded
+ExcelChart_Various_Averaged=prose\u010Dan
+ExcelChart_Various_Column=Kolona
+ExcelChart_Various_Frequency=U\u010Destalost
+ExcelChart_Various_SummedUp=sabrano
+ExcelChart_Various_Unknown=<Nepoznat>
+ExportDate=Datum izvoza
+ExtendedSearchAddAttributeMenu=Dodaj ograni\u010Denje...
+ExtendedSearchAddEntityPrefix=ima
+ExtendedSearchAnd=i
+ExtendedSearchEditAttributeMenu=Izmeni...
+ExtendedSearchEntitySuffix=sa
+ExtendedSearchNegateMenu=negiraj
+ExtendedSearchRemoveAttributeMenu=Ukloni
+ExtendedSearchRemoveMenu=Ukloni
+FileExistsOwerwriteQuestion=Odabrana datoteka ve\u0107 postoji. Prepisati preko nje?
+FileName=Ime datoteke
+FileNotFoundMessage=Ne mo\u017Ee se prona\u0107i datoteka.
+FileNotFoundTitle=Datoteka nije prona\u0111ena
+FilesOfType=Tip datoteke
+FormPrint=\u0160tampa
+FormSaveChangesQuestion=Da li \u017Eelite da sa\u010Duvate promene?
+FormStateLoad=U\u010Ditaj...
+FormStateStore=Sa\u010Duvaj
+FormStateStoreAs=Sa\u010Duvaj kao...
+GlobalBookmarks=Globalni bookmarks
+GlobalBookmarksAddMenu=Dodaj u &globalni bookmark
+Help=Pomo\u0107
+IOErrorInfo=Proverite datoteke i vezu.
+IOErrorText=Gre\u0161ka u komunikacijama
+IOErrorTitle=Gre\u0161ka pri \u010Ditanju/pisanju
+Info=Informacija
+Interrupted=Prekinut
+InterruptedErrorText=Proces je prekinut ru\u010Dno
+InterruptedErrorTitle=Proces je prekinut.
+JavaVMVersion=Java VM
+Language=Jezik
+LoadFormXmlFailedText=Datoteka nije kompatibilna sa ovim dijalogom
+LogicDateIsInDays=je za ta\u010Dno (dana)
+LogicDateIsInGEDays=je najranije za (dana)
+LogicDateIsInGEMonths=je najranije za (meseci)
+LogicDateIsInLEDays=je najkasnije za (dana)
+LogicDateIsInLEMonths=je najkasnije za (meseci)
+LogicDateIsInMonths=je ta\u010Dno za (meseci)
+LogicDateIsNotToday=nije danas
+LogicDateIsToday=je danas
+LogicDateTimeIsInGEHours=je najranije za (sati)
+LogicDateTimeIsInGEMinutes=je najranije za (minuta)
+LogicDateTimeIsInLEHours=je najkasnije za (sati)
+LogicDateTimeIsInLEMinutes=je najkasnije za (minuta)
+LogicDateTimeIsNotNow=nije nizak
+LogicDateTimeIsNow=je nizak
+LogicEQ=\=
+LogicEndsWith=zavr\u0161ava sa
+LogicGE=>\=
+LogicGT=>
+LogicIn=je
+LogicLE=<\=
+LogicLT=<
+LogicLike=sadr\u017Ei
+LogicNEQ=<>
+LogicNotIn=nije
+LogicNotLike=ne sadr\u017Ei
+LogicNotNull=nije prazan
+LogicNull=je prazan
+LogicStartsWith=po\u010Dinje sa
+LogicTimeIsInGEHours=je najranije za (sati)
+LogicTimeIsInGEMinutes=je najranije za (minuta)
+LogicTimeIsInHours=je ta\u010Dno za (sati)
+LogicTimeIsInLEHours=je najkasnije za (sati)
+LogicTimeIsInLEMinutes=je najkasnije za (minuta)
+LogicTimeIsInMinutes=je ta\u010Dno za (minuta)
+LogicTimeIsNotNow=nije nizak
+LogicTimeIsNow=je sada
+Login=Prijavljivanje
+LookIn=Pogledaj u
+Month=Mesec
+Name=Ime, naziv
+NetErrorInfo=Proverite ime servera, url i vezu
+NetErrorText=Server nije prona\u0111en
+NetErrorTitle=Gre\u0161ka na mre\u017Ei
+NewPassword=Nova lozinka
+No=Ne
+NoButton=&Ne
+NumberOfRows=Broj reda
+OSUser=Sisitemski korisnik
+OSVersion=Verzija sistema
+Ok=Ok
+OkButton=&Ok
+OkButtonTooltip=Sa\u010Duvaj i zatvori dijalog
+OldPassword=Stara lozinka
+Op=Operater
+Open=Otvori, otvoren
+Password=Lozinka
+PasswordsDoNotMatch=Dve lozinke se ne sla\u017Eu.
+Paste=Prepi\u0161i
+Path=Putanja
+RepeatPassword=Ponovi
+ResetButton=&Poni\u0161ti
+ResetButtonTooltip=Postavi sva polja dijalga na prazno
+Save=Sa\u010Duvaj
+SaveButton=&Sa\u010Duvaj
+SaveButtonTooltip=Sa\u010Duvaj dijalog bez zatvaranja
+SearchButton=&Pretra\u017Ei
+SearchButtonTooltip=Zatvori dijalog i po\u010Dni pretra\u017Eivanje
+SearchConstraints=Kriterijumi za pretra\u017Eivanje
+Server=Server
+SmartFindLabel=Tekst za pretra\u017Eivanje
+StatusExportDone=izvoz zavr\u0161en
+Today=danas
+TooManyRows=Veliki set podataka. Suzite koriste\u0107i panel za pretragu
+Update=A\u017Euriraj
+UserInterrupted=Prekinut od strane korisnika
+Username=Korisni\u010Dko ime
+Value=Vrednost
+Week=Nedelja
+WeekShort=CW
+WizardCancelButton=Poni\u0161ti
+WizardSuspendButton=&Zatvori
+WorkWeek=Radna nedelja
+Yes=Da
+YesButton=&Da
+and=i
+from=Odabrana datoteka ve\u0107 postoji. Prepisati preko nje?
+to=do
diff --git a/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_tr.properties b/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_tr.properties
index 8d66f67936..049fd6a88a 100644
--- a/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_tr.properties
+++ b/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_tr.properties
@@ -1,224 +1,224 @@
-AllStates=T\u00FCm
-Apply=Uygula
-Attribute=\u00D6znitelik
-Bookmarks=Ayra\u00E7
-BookmarksAddMenu=&Ayra\u00E7lara ekle...
-BookmarksMainMenu=&Ayra\u00E7lar
-BookmarksManageMenu=&Ayra\u00E7lar\u0131 y\u00F6net...
-BookmarksStartPageMenu=&Ba\u015Flang\u0131\u00E7 G\u00F6r\u00FCn\u00FCm\u00FC
-BookmarksStartPageMenuClear=&Ba\u015Flang\u0131\u00E7 G\u00F6r\u00FCn\u00FCm\u00FC Yok
-BookmarksStartPageMenuGoto=&Ba\u015Flang\u0131\u00E7 G\u00F6r\u00FCn\u00FCm\u00FC A\u00E7
-BookmarksStartPageMenuSet=&G\u00FCncel G\u00F6r\u00FCn\u00FCm\u00FC Ba\u015Flang\u0131\u00E7 G\u00F6r\u00FCn\u00FCm\u00FC Olarak Ayarla
-ButtonDeselectAll=T\u00FCm se\u00E7imleri kald\u0131r
-ButtonSelectAll=T\u00FCm\u00FCn\u00FC se\u00E7
-Calendar_earlier=Daha erken
-Calendar_later=Sonra
-Cancel=\u0130ptal
-CancelButton=&\u0130ptal
-CancelButtonTooltip=\u0130leti\u015Fim kutusunu kaydetmeden kapat;e\u011Fer gerekliyse ileti\u015Fim onay\u0131 ile
-ChangePassword=\u015Eifre
-CloseButton=&Kapat
-CloseButtonTooltip=Kaydetmeden ileti\u015Fimi kapat
-Column=Kolon
-Columns=Kolonlar
-ComposerFieldAggregationLabel=Fonksiyon
-Condensed=Kolonlar 6
-Copy=Kopyala
-Cut=Kes
-Day=G\u00FCn
-DefaultPasswordPolicyText=\u015Eifreniz istenen gereklilikleri kar\u015F\u0131lamamaktad\u0131r Kural\:\n- en az 8 karakter\n- en az bir rakam (0-9)\n- en az bir noktalama i\u015Fareti (\!|@|\#|$|%|^|&|*|(|)|_|+|||~|-|
-EmailFrom=From
-EmailSubject=Konu
-EmailTo=..'na
-Error=Hata
-ErrorAndRetryTextDefault=Veri aktar\u0131m\u0131 s\u0131ras\u0131nda hata olu\u015Ftu
-ErrorTextLogin=Ge\u00E7ersiz kullan\u0131c\u0131 ad\u0131/\u015Fifre
-ErrorTitleLogin=Oturum a\u00E7ma ba\u015Far\u0131s\u0131z
-ExcelChart_Button_LoadDefaults=Varsay\u0131lanlar
-ExcelChart_Button_LoadDefaultsHint=Varsay\u0131lan de\u011Ferlerin y\u00FCklenmesiyle ileti\u015Fimi siler.
-ExcelChart_Button_LoadProfile=Profil y\u00FCkle...
-ExcelChart_Button_LoadProfileHint=XML dosyas\u0131ndan ayarlar\u0131 y\u00FCkler.
-ExcelChart_Button_SaveProfile=Profil kaydet...
-ExcelChart_Button_SaveProfileHint=Mevcut ayarlar\u0131 XML dosyas\u0131 olarak kaydeder.
-ExcelChart_Error_CreatingChartFailed=grafik olu\u015Fturma ba\u015Far\u0131s\u0131z.
-ExcelChart_Error_ExportingFailed=Export ba\u015Far\u0131s\u0131z \u00E7\u00FCnk\u00FC
-ExcelChart_Error_InitializationFailed=destek s\u0131n\u0131f(lar\u0131)n\u0131n ba\u015Flang\u0131\u00E7 durumuna getirilmesi ba\u015Far\u0131s\u0131z.
-ExcelChart_Error_LoadingProfileFailed=Profilin y\u00FCklenmesi ba\u015Far\u0131s\u0131z \u00E7\u00FCnk\u00FC
-ExcelChart_Error_LoadingTemplateFailed=\u015Fablon y\u00FCklemesi ba\u015Far\u0131s\u0131z
-ExcelChart_Error_RetrivingOutlineDataFailed=taslak veri eri\u015Fimi ba\u015Far\u0131s\u0131z
-ExcelChart_Error_SavingProfileFailed=profilin kaydedilmesi ba\u015Far\u0131s\u0131z
-ExcelChart_Error_WrongProfile=profili di\u011Fer taslak i\u00E7in yarat\u0131ld\u0131.
-ExcelChart_Label_AutomaticMode=Otomatik mod
-ExcelChart_Label_AutomaticModeHint=Excel'i gizle ve otomatik kaydet
-ExcelChart_Label_ChartNumber=Grafik numaras\u0131
-ExcelChart_Label_ChartType=Grafik tipi
-ExcelChart_Label_FileName=Dosyaad\u0131
-ExcelChart_Label_FirstRow=\u0130lk dizi
-ExcelChart_Label_Height=Boy
-ExcelChart_Label_HistogramMode=Histogram modu
-ExcelChart_Label_HistogramModeHint=histogram modu X-ekseninden bire \u00F6zde\u015F de\u011Ferleri birle\u015Ftirir
-ExcelChart_Label_LastRow=Son dizi
-ExcelChart_Label_Offset=Pozisyon
-ExcelChart_Label_SkipNullValues=histogram modunda s\u0131f\u0131r de\u011Ferleri atla
-ExcelChart_Label_SkipNullValuesHint=E\u011Fer X-ekseninde s\u0131f\u0131r de\u011Ferleri kontrol ederse ihmal edilecek, aksi halde <Unknown> a birle\u015Ftirelecek
-ExcelChart_Label_TemplateName=\u015Eablon
-ExcelChart_Label_UseCustomFormat=Al\u0131\u015F\u0131lm\u0131\u015F format\u0131 kullan
-ExcelChart_Label_UseCustomFormatHint=If checked you can indicate the chart's position and size.
-ExcelChart_Label_UseExistingChart=Mevcut grafi\u011Fi kullan
-ExcelChart_Label_UseExistingChartHint=If checked the existing chart in the indicated template is used.
-ExcelChart_Label_UseSelectiveExport=Se\u00E7ili export kullan
-ExcelChart_Label_UseSelectiveExportHint=If checked only the rows indicated below are exported.
-ExcelChart_Label_Width=Geni\u015Flik
-ExcelChart_Label_WorksheetName=\u00C7al\u0131\u015Fma Sayfas\u0131
-ExcelChart_Label_XAxis=X-Ekseni
-ExcelChart_Label_YAxes=Y-Ekseni
-ExcelChart_Status_Done=Excel Grafik Export yap\u0131ld\u0131.
-ExcelChart_Tab_Advanced=Geli\u015Fmi\u015F
-ExcelChart_Tab_Basic=Temel
-ExcelChart_Title_MainForm=Excel Grafik Export
-ExcelChart_Type_Area3D=Alan 3D
-ExcelChart_Type_Area=Alan
-ExcelChart_Type_AreaStacked3D=Area Stacked 3D
-ExcelChart_Type_AreaStacked=Area Stacked
-ExcelChart_Type_BarsClustered3D=Bars Clustered 3D
-ExcelChart_Type_BarsClustered=Bars Clustered
-ExcelChart_Type_BarsStacked3D=Bars Stacked 3D
-ExcelChart_Type_BarsStacked=Bars Stacked
-ExcelChart_Type_ColumnsClustered3D=Columns Clustered 3D
-ExcelChart_Type_ColumnsClustered=Columns Clustered
-ExcelChart_Type_ColumnsStacked3D=Columns Stacked 3D
-ExcelChart_Type_ColumnsStacked=Columns Stacked
-ExcelChart_Type_Line=Line
-ExcelChart_Type_LineStacked=Line Stacked
-ExcelChart_Type_Pie3D=Pie 3D
-ExcelChart_Type_Pie=Pie
-ExcelChart_Type_PieExploded3D=Pie Exploded 3D
-ExcelChart_Type_PieExploded=Pie exploded
-ExcelChart_Various_Averaged=averaged
-ExcelChart_Various_Column=Column
-ExcelChart_Various_Frequency=Frequency
-ExcelChart_Various_SummedUp=summed up
-ExcelChart_Various_Unknown=<Unknown>
-ExportDate=Export tarihi
-ExtendedSearchAddAttributeMenu=S\u0131n\u0131rlama Ekle...
-ExtendedSearchAddEntityPrefix=has
-ExtendedSearchAnd=ve
-ExtendedSearchEditAttributeMenu=D\u00FCzenle...
-ExtendedSearchEntitySuffix=ile
-ExtendedSearchNegateMenu=Red
-ExtendedSearchRemoveAttributeMenu=Kald\u0131r
-ExtendedSearchRemoveMenu=Kald\u0131r
-FileExistsOwerwriteQuestion=Se\u00E7ilen dosya zaten mevcut.\u00DCzerine yazmak ister misiniz?
-FileName=Dosya Ad\u0131
-FileNotFoundMessage=Dosya bulunamad\u0131
-FileNotFoundTitle=Dosya bulunamad\u0131
-FilesOfType=Dosya Tipi
-FormPrint=Yazd\u0131r
-FormSaveChangesQuestion=De\u011Fi\u015Fiklikleri kaydetmek istiyor musunuz?
-FormStateLoad=Y\u00FCkle...
-FormStateStore=Kaydet
-FormStateStoreAs=Farkl\u0131 Kaydet...
-GlobalBookmarks=Global Bookmarks
-GlobalBookmarksAddMenu=Add to &global bookmarks
-Help=Yard\u0131m
-IOErrorInfo=L\u00FCtfen dosyalar\u0131 ve ba\u011Flant\u0131y\u0131 kontrol ediniz
-IOErrorText=Ba\u011Flant\u0131 Hatas\u0131
-IOErrorTitle=Okuma / Yazma hatas\u0131
-Info=Bilgi
-Interrupted=Kesilen
-InterruptedErrorText=S\u00FCre\u00E7 manuel olarak iptal edildi
-InterruptedErrorTitle=S\u00FCre\u00E7 engellendi
-JavaVMVersion=Java VM
-Language=Dil
-LoadFormXmlFailedText=Bu dosya bu ileti\u015Fim ile uyumlu de\u011Fil
-LogicDateIsInDays=is in exactly (days)
-LogicDateIsInGEDays=is earliest in (days)
-LogicDateIsInGEMonths=is earliest in (months)
-LogicDateIsInLEDays=is latest in (days)
-LogicDateIsInLEMonths=is latest in (months)
-LogicDateIsInLastDays=son n g\u00FCnde
-LogicDateIsInLastMonths=son n ayda
-LogicDateIsInMonths=is in exactly (months)
-LogicDateIsInNextDays=sonraki n g\u00FCnde
-LogicDateIsInNextMonths=sonraki n ayda
-LogicDateIsNotToday=is not today
-LogicDateIsToday=is today
-LogicDateTimeIsInGEHours=is earliest in (hours)
-LogicDateTimeIsInGEMinutes=is earliest in (minutes)
-LogicDateTimeIsInLEHours=is latest in (hours)
-LogicDateTimeIsInLEMinutes=is latest in (minutes)
-LogicDateTimeIsNotNow=is not now
-LogicDateTimeIsNow=is now
-LogicEQ=\=
-LogicEndsWith=ile biter
-LogicGE=>\=
-LogicGT=>
-LogicIn=Is
-LogicLE=<\=
-LogicLT=<
-LogicLike=Kapsam
-LogicNEQ=<>
-LogicNotIn=is not
-LogicNotLike=i\u00E7ermiyor
-LogicNotNull=bo\u015F de\u011Fil
-LogicNull=bo\u015F
-LogicStartsWith=ile Ba\u015Fla
-LogicTimeIsInGEHours=is earliest in (hours)
-LogicTimeIsInGEMinutes=is earliest in (minutes)
-LogicTimeIsInHours=is in exactly (hours)
-LogicTimeIsInLEHours=is latest in (hours)
-LogicTimeIsInLEMinutes=is latest in (minutes)
-LogicTimeIsInMinutes=is in exactly (minutes)
-LogicTimeIsNotNow=is not now
-LogicTimeIsNow=is now
-Login=Oturum
-LookIn=\u0130\u00E7ine bak
-Month=Ay
-Name=Ad
-NetErrorInfo=L\u00FCtfen sunucu ad\u0131n\u0131,URL ve ba\u011Flant\u0131y\u0131 kontrol ediniz
-NetErrorText=Sunucu bulunamad\u0131
-NetErrorTitle=A\u011F hatas\u0131
-NewPassword=Yeni \u015Eifre
-No=Hay\u0131r
-NoButton=&Hay\u0131r
-NumberOfRows=Kay\u0131tlar
-OSUser=Sistem Kullan\u0131c\u0131s\u0131
-OSVersion=Sistem Version
-Ok=Tamam
-OkButton=&Tamam
-OkButtonTooltip=Kaydet ve kapat
-OldPassword=Eski \u015Fifre
-Op=Operat\u00F6r
-Open=A\u00E7
-Password=\u015Eifre
-PasswordsDoNotMatch=\u0130ki \u015Fifre uyu\u015Fmuyor
-Paste=Yap\u0131\u015Ft\u0131r
-Path=Path
-RepeatPassword=Tekrar
-ResetButton=&Sil
-ResetButtonTooltip=T\u00FCm ileti\u015Fim alanlar\u0131n\u0131 bo\u015F de\u011Ferler olarak ayarla
-Save=Kaydet
-SaveButton=&Save
-SaveButtonTooltip=Kapatmadan ileti\u015Fimi kaydet
-SearchButton=&Ara
-SearchButtonTooltip=\u0130leti\u015Fimi kapat ve aramay\u0131 ba\u015Flat
-SearchConstraints=S\u0131n\u0131rlama Ara
-Server=Sunucu
-SmartFindLabel=Metin Ara
-StatusExportDone=Export tamamland\u0131
-Today=bug\u00FCn
-TooManyRows=Geni\u015F veri k\u00FCmesi.L\u00FCtfen arama panelini kullanarak daralt\u0131n\u0131z
-Update=G\u00FCncelle
-UserInterrupted=Kullan\u0131c\u0131 taraf\u0131ndan iptal edildi.
-Username=Kullan\u0131c\u0131 Ad\u0131
-Value=De\u011Fer
-Week=Hafta
-WeekShort=CW
-WizardCancelButton=Iptal
-WizardSuspendButton=&Kapat
-WorkWeek=\u00C7al\u0131\u015Fma Haftas\u0131
-Yes=Evet
-YesButton=&Evet
-and=ve
-from=from
-to=to
+AllStates=T\u00FCm
+Apply=Uygula
+Attribute=\u00D6znitelik
+Bookmarks=Ayra\u00E7
+BookmarksAddMenu=&Ayra\u00E7lara ekle...
+BookmarksMainMenu=&Ayra\u00E7lar
+BookmarksManageMenu=&Ayra\u00E7lar\u0131 y\u00F6net...
+BookmarksStartPageMenu=&Ba\u015Flang\u0131\u00E7 G\u00F6r\u00FCn\u00FCm\u00FC
+BookmarksStartPageMenuClear=&Ba\u015Flang\u0131\u00E7 G\u00F6r\u00FCn\u00FCm\u00FC Yok
+BookmarksStartPageMenuGoto=&Ba\u015Flang\u0131\u00E7 G\u00F6r\u00FCn\u00FCm\u00FC A\u00E7
+BookmarksStartPageMenuSet=&G\u00FCncel G\u00F6r\u00FCn\u00FCm\u00FC Ba\u015Flang\u0131\u00E7 G\u00F6r\u00FCn\u00FCm\u00FC Olarak Ayarla
+ButtonDeselectAll=T\u00FCm se\u00E7imleri kald\u0131r
+ButtonSelectAll=T\u00FCm\u00FCn\u00FC se\u00E7
+Calendar_earlier=Daha erken
+Calendar_later=Sonra
+Cancel=\u0130ptal
+CancelButton=&\u0130ptal
+CancelButtonTooltip=\u0130leti\u015Fim kutusunu kaydetmeden kapat;e\u011Fer gerekliyse ileti\u015Fim onay\u0131 ile
+ChangePassword=\u015Eifre
+CloseButton=&Kapat
+CloseButtonTooltip=Kaydetmeden ileti\u015Fimi kapat
+Column=Kolon
+Columns=Kolonlar
+ComposerFieldAggregationLabel=Fonksiyon
+Condensed=Kolonlar 6
+Copy=Kopyala
+Cut=Kes
+Day=G\u00FCn
+DefaultPasswordPolicyText=\u015Eifreniz istenen gereklilikleri kar\u015F\u0131lamamaktad\u0131r Kural\:\n- en az 8 karakter\n- en az bir rakam (0-9)\n- en az bir noktalama i\u015Fareti (\!|@|\#|$|%|^|&|*|(|)|_|+|||~|-|
+EmailFrom=From
+EmailSubject=Konu
+EmailTo=..'na
+Error=Hata
+ErrorAndRetryTextDefault=Veri aktar\u0131m\u0131 s\u0131ras\u0131nda hata olu\u015Ftu
+ErrorTextLogin=Ge\u00E7ersiz kullan\u0131c\u0131 ad\u0131/\u015Fifre
+ErrorTitleLogin=Oturum a\u00E7ma ba\u015Far\u0131s\u0131z
+ExcelChart_Button_LoadDefaults=Varsay\u0131lanlar
+ExcelChart_Button_LoadDefaultsHint=Varsay\u0131lan de\u011Ferlerin y\u00FCklenmesiyle ileti\u015Fimi siler.
+ExcelChart_Button_LoadProfile=Profil y\u00FCkle...
+ExcelChart_Button_LoadProfileHint=XML dosyas\u0131ndan ayarlar\u0131 y\u00FCkler.
+ExcelChart_Button_SaveProfile=Profil kaydet...
+ExcelChart_Button_SaveProfileHint=Mevcut ayarlar\u0131 XML dosyas\u0131 olarak kaydeder.
+ExcelChart_Error_CreatingChartFailed=grafik olu\u015Fturma ba\u015Far\u0131s\u0131z.
+ExcelChart_Error_ExportingFailed=Export ba\u015Far\u0131s\u0131z \u00E7\u00FCnk\u00FC
+ExcelChart_Error_InitializationFailed=destek s\u0131n\u0131f(lar\u0131)n\u0131n ba\u015Flang\u0131\u00E7 durumuna getirilmesi ba\u015Far\u0131s\u0131z.
+ExcelChart_Error_LoadingProfileFailed=Profilin y\u00FCklenmesi ba\u015Far\u0131s\u0131z \u00E7\u00FCnk\u00FC
+ExcelChart_Error_LoadingTemplateFailed=\u015Fablon y\u00FCklemesi ba\u015Far\u0131s\u0131z
+ExcelChart_Error_RetrivingOutlineDataFailed=taslak veri eri\u015Fimi ba\u015Far\u0131s\u0131z
+ExcelChart_Error_SavingProfileFailed=profilin kaydedilmesi ba\u015Far\u0131s\u0131z
+ExcelChart_Error_WrongProfile=profili di\u011Fer taslak i\u00E7in yarat\u0131ld\u0131.
+ExcelChart_Label_AutomaticMode=Otomatik mod
+ExcelChart_Label_AutomaticModeHint=Excel'i gizle ve otomatik kaydet
+ExcelChart_Label_ChartNumber=Grafik numaras\u0131
+ExcelChart_Label_ChartType=Grafik tipi
+ExcelChart_Label_FileName=Dosyaad\u0131
+ExcelChart_Label_FirstRow=\u0130lk dizi
+ExcelChart_Label_Height=Boy
+ExcelChart_Label_HistogramMode=Histogram modu
+ExcelChart_Label_HistogramModeHint=histogram modu X-ekseninden bire \u00F6zde\u015F de\u011Ferleri birle\u015Ftirir
+ExcelChart_Label_LastRow=Son dizi
+ExcelChart_Label_Offset=Pozisyon
+ExcelChart_Label_SkipNullValues=histogram modunda s\u0131f\u0131r de\u011Ferleri atla
+ExcelChart_Label_SkipNullValuesHint=E\u011Fer X-ekseninde s\u0131f\u0131r de\u011Ferleri kontrol ederse ihmal edilecek, aksi halde <Unknown> a birle\u015Ftirelecek
+ExcelChart_Label_TemplateName=\u015Eablon
+ExcelChart_Label_UseCustomFormat=Al\u0131\u015F\u0131lm\u0131\u015F format\u0131 kullan
+ExcelChart_Label_UseCustomFormatHint=If checked you can indicate the chart's position and size.
+ExcelChart_Label_UseExistingChart=Mevcut grafi\u011Fi kullan
+ExcelChart_Label_UseExistingChartHint=If checked the existing chart in the indicated template is used.
+ExcelChart_Label_UseSelectiveExport=Se\u00E7ili export kullan
+ExcelChart_Label_UseSelectiveExportHint=If checked only the rows indicated below are exported.
+ExcelChart_Label_Width=Geni\u015Flik
+ExcelChart_Label_WorksheetName=\u00C7al\u0131\u015Fma Sayfas\u0131
+ExcelChart_Label_XAxis=X-Ekseni
+ExcelChart_Label_YAxes=Y-Ekseni
+ExcelChart_Status_Done=Excel Grafik Export yap\u0131ld\u0131.
+ExcelChart_Tab_Advanced=Geli\u015Fmi\u015F
+ExcelChart_Tab_Basic=Temel
+ExcelChart_Title_MainForm=Excel Grafik Export
+ExcelChart_Type_Area3D=Alan 3D
+ExcelChart_Type_Area=Alan
+ExcelChart_Type_AreaStacked3D=Area Stacked 3D
+ExcelChart_Type_AreaStacked=Area Stacked
+ExcelChart_Type_BarsClustered3D=Bars Clustered 3D
+ExcelChart_Type_BarsClustered=Bars Clustered
+ExcelChart_Type_BarsStacked3D=Bars Stacked 3D
+ExcelChart_Type_BarsStacked=Bars Stacked
+ExcelChart_Type_ColumnsClustered3D=Columns Clustered 3D
+ExcelChart_Type_ColumnsClustered=Columns Clustered
+ExcelChart_Type_ColumnsStacked3D=Columns Stacked 3D
+ExcelChart_Type_ColumnsStacked=Columns Stacked
+ExcelChart_Type_Line=Line
+ExcelChart_Type_LineStacked=Line Stacked
+ExcelChart_Type_Pie3D=Pie 3D
+ExcelChart_Type_Pie=Pie
+ExcelChart_Type_PieExploded3D=Pie Exploded 3D
+ExcelChart_Type_PieExploded=Pie exploded
+ExcelChart_Various_Averaged=averaged
+ExcelChart_Various_Column=Column
+ExcelChart_Various_Frequency=Frequency
+ExcelChart_Various_SummedUp=summed up
+ExcelChart_Various_Unknown=<Unknown>
+ExportDate=Export tarihi
+ExtendedSearchAddAttributeMenu=S\u0131n\u0131rlama Ekle...
+ExtendedSearchAddEntityPrefix=has
+ExtendedSearchAnd=ve
+ExtendedSearchEditAttributeMenu=D\u00FCzenle...
+ExtendedSearchEntitySuffix=ile
+ExtendedSearchNegateMenu=Red
+ExtendedSearchRemoveAttributeMenu=Kald\u0131r
+ExtendedSearchRemoveMenu=Kald\u0131r
+FileExistsOwerwriteQuestion=Se\u00E7ilen dosya zaten mevcut.\u00DCzerine yazmak ister misiniz?
+FileName=Dosya Ad\u0131
+FileNotFoundMessage=Dosya bulunamad\u0131
+FileNotFoundTitle=Dosya bulunamad\u0131
+FilesOfType=Dosya Tipi
+FormPrint=Yazd\u0131r
+FormSaveChangesQuestion=De\u011Fi\u015Fiklikleri kaydetmek istiyor musunuz?
+FormStateLoad=Y\u00FCkle...
+FormStateStore=Kaydet
+FormStateStoreAs=Farkl\u0131 Kaydet...
+GlobalBookmarks=Global Bookmarks
+GlobalBookmarksAddMenu=Add to &global bookmarks
+Help=Yard\u0131m
+IOErrorInfo=L\u00FCtfen dosyalar\u0131 ve ba\u011Flant\u0131y\u0131 kontrol ediniz
+IOErrorText=Ba\u011Flant\u0131 Hatas\u0131
+IOErrorTitle=Okuma / Yazma hatas\u0131
+Info=Bilgi
+Interrupted=Kesilen
+InterruptedErrorText=S\u00FCre\u00E7 manuel olarak iptal edildi
+InterruptedErrorTitle=S\u00FCre\u00E7 engellendi
+JavaVMVersion=Java VM
+Language=Dil
+LoadFormXmlFailedText=Bu dosya bu ileti\u015Fim ile uyumlu de\u011Fil
+LogicDateIsInDays=is in exactly (days)
+LogicDateIsInGEDays=is earliest in (days)
+LogicDateIsInGEMonths=is earliest in (months)
+LogicDateIsInLEDays=is latest in (days)
+LogicDateIsInLEMonths=is latest in (months)
+LogicDateIsInLastDays=son n g\u00FCnde
+LogicDateIsInLastMonths=son n ayda
+LogicDateIsInMonths=is in exactly (months)
+LogicDateIsInNextDays=sonraki n g\u00FCnde
+LogicDateIsInNextMonths=sonraki n ayda
+LogicDateIsNotToday=is not today
+LogicDateIsToday=is today
+LogicDateTimeIsInGEHours=is earliest in (hours)
+LogicDateTimeIsInGEMinutes=is earliest in (minutes)
+LogicDateTimeIsInLEHours=is latest in (hours)
+LogicDateTimeIsInLEMinutes=is latest in (minutes)
+LogicDateTimeIsNotNow=is not now
+LogicDateTimeIsNow=is now
+LogicEQ=\=
+LogicEndsWith=ile biter
+LogicGE=>\=
+LogicGT=>
+LogicIn=Is
+LogicLE=<\=
+LogicLT=<
+LogicLike=Kapsam
+LogicNEQ=<>
+LogicNotIn=is not
+LogicNotLike=i\u00E7ermiyor
+LogicNotNull=bo\u015F de\u011Fil
+LogicNull=bo\u015F
+LogicStartsWith=ile Ba\u015Fla
+LogicTimeIsInGEHours=is earliest in (hours)
+LogicTimeIsInGEMinutes=is earliest in (minutes)
+LogicTimeIsInHours=is in exactly (hours)
+LogicTimeIsInLEHours=is latest in (hours)
+LogicTimeIsInLEMinutes=is latest in (minutes)
+LogicTimeIsInMinutes=is in exactly (minutes)
+LogicTimeIsNotNow=is not now
+LogicTimeIsNow=is now
+Login=Oturum
+LookIn=\u0130\u00E7ine bak
+Month=Ay
+Name=Ad
+NetErrorInfo=L\u00FCtfen sunucu ad\u0131n\u0131,URL ve ba\u011Flant\u0131y\u0131 kontrol ediniz
+NetErrorText=Sunucu bulunamad\u0131
+NetErrorTitle=A\u011F hatas\u0131
+NewPassword=Yeni \u015Eifre
+No=Hay\u0131r
+NoButton=&Hay\u0131r
+NumberOfRows=Kay\u0131tlar
+OSUser=Sistem Kullan\u0131c\u0131s\u0131
+OSVersion=Sistem Version
+Ok=Tamam
+OkButton=&Tamam
+OkButtonTooltip=Kaydet ve kapat
+OldPassword=Eski \u015Fifre
+Op=Operat\u00F6r
+Open=A\u00E7
+Password=\u015Eifre
+PasswordsDoNotMatch=\u0130ki \u015Fifre uyu\u015Fmuyor
+Paste=Yap\u0131\u015Ft\u0131r
+Path=Path
+RepeatPassword=Tekrar
+ResetButton=&Sil
+ResetButtonTooltip=T\u00FCm ileti\u015Fim alanlar\u0131n\u0131 bo\u015F de\u011Ferler olarak ayarla
+Save=Kaydet
+SaveButton=&Save
+SaveButtonTooltip=Kapatmadan ileti\u015Fimi kaydet
+SearchButton=&Ara
+SearchButtonTooltip=\u0130leti\u015Fimi kapat ve aramay\u0131 ba\u015Flat
+SearchConstraints=S\u0131n\u0131rlama Ara
+Server=Sunucu
+SmartFindLabel=Metin Ara
+StatusExportDone=Export tamamland\u0131
+Today=bug\u00FCn
+TooManyRows=Geni\u015F veri k\u00FCmesi.L\u00FCtfen arama panelini kullanarak daralt\u0131n\u0131z
+Update=G\u00FCncelle
+UserInterrupted=Kullan\u0131c\u0131 taraf\u0131ndan iptal edildi.
+Username=Kullan\u0131c\u0131 Ad\u0131
+Value=De\u011Fer
+Week=Hafta
+WeekShort=CW
+WizardCancelButton=Iptal
+WizardSuspendButton=&Kapat
+WorkWeek=\u00C7al\u0131\u015Fma Haftas\u0131
+Yes=Evet
+YesButton=&Evet
+and=ve
+from=from
+to=to
diff --git a/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_zh.properties b/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_zh.properties
index 815bca1436..30d0badd13 100644
--- a/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_zh.properties
+++ b/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_zh.properties
@@ -1,220 +1,220 @@
-AllStates=\u5168\u90E8
-Apply=\u5E94\u7528
-Attribute=\u5C5E\u6027
-Bookmarks=\u4E66\u7B7E
-BookmarksAddMenu=&\u589E\u52A0\u5230\u4E66\u7B7E...
-BookmarksMainMenu=&\u4E66\u7B7E
-BookmarksManageMenu=&\u7BA1\u7406\u4E66\u7B7E...
-BookmarksStartPageMenu=&\u542F\u52A8\u7A97\u53E3
-BookmarksStartPageMenuClear=&\u65E0\u542F\u52A8\u7A97\u53E3
-BookmarksStartPageMenuGoto=&\u6253\u5F00\u542F\u52A8\u7A97\u53E3
-BookmarksStartPageMenuSet=&\u628A\u76EE\u524D\u7A97\u53E3\u8BBE\u7F6E\u4E3A\u542F\u52A8\u7A97\u53E3
-ButtonDeselectAll=\u5168\u90E8\u4E0D\u9009
-ButtonSelectAll=\u5168\u9009
-Calendar_earlier=\u4E4B\u524D
-Calendar_later=\u7A0D\u540E
-Cancel=\u53D6\u6D88
-CancelButton=&\u53D6\u6D88
-CancelButtonTooltip=\u5173\u95ED\u7A97\u53E3\u65E0\u9700\u4FDD\u5B58;\u5982\u9700\u8981\u8BF7\u786E\u8BA4\u5BF9\u8BDD\u7A97\u53E3\u3002
-ChangePassword=\u66F4\u6539\u5BC6\u7801
-CloseButton=&\u5173\u95ED
-CloseButtonTooltip=\u5173\u95ED\u5BF9\u8BDD\u7A97\u53E3\u65E0\u9700\u4FDD\u5B58\u3002
-Column=\u5217
-Columns=\u5217
-ComposerFieldAggregationLabel=\u804C\u80FD
-Condensed=6 \u5217
-Copy=\u590D\u5236
-Cut=\u526A\u5207
-Day=\u5929
-DefaultPasswordPolicyText=\u5BC6\u7801\u4E0D\u7B26\u5408\u8981\u6C42 \u81F3\u5C11\u516B\u4F4D;\u81F3\u5C11\u542B\u4E00\u4E2A\u6570\u5B57;\u81F3\u5C11\u4E00\u4E2A\u975E\u6807\u51C6\u5B57\u7B26(\!|@|\#|$|%|^|&|*|(|)|_|+|||~|-|
-EmailFrom=\u6765\u81EA
-EmailSubject=\u4E3B\u9898
-EmailTo=\u81F3
-Error=\u9519\u8BEF
-ErrorAndRetryTextDefault=\u6570\u636E\u4F20\u8F93\u8FC7\u7A0B\u4E2D\u51FA\u73B0\u4E00\u4E2A\u9519\u8BEF\u3002
-ErrorTextLogin=\u65E0\u6548\u7528\u6237/\u5BC6\u7801
-ErrorTitleLogin=\u767B\u5F55\u5931\u8D25
-ExcelChart_Button_LoadDefaults=\u9ED8\u8BA4
-ExcelChart_Button_LoadDefaultsHint=\u5BFC\u5165\u9ED8\u8BA4\u503C\u91CD\u8BBE\u5BF9\u8BDD
-ExcelChart_Button_LoadProfile=\u4E0A\u8F7D\u6587\u6863
-ExcelChart_Button_LoadProfileHint=\u4ECEXML\u6587\u4EF6\u4E0A\u8F7D\u8BBE\u7F6E
-ExcelChart_Button_SaveProfile=\u4FDD\u5B58\u6587\u6863
-ExcelChart_Button_SaveProfileHint=\u4FDD\u5B58\u5F53\u524D\u8BBE\u7F6E\u81F3XML\u6587\u4EF6
-ExcelChart_Error_CreatingChartFailed=\u521B\u5EFA\u6587\u6863\u5931\u8D25
-ExcelChart_Error_ExportingFailed=\u5BFC\u51FA\u5931\u8D25\u7F18\u7531
-ExcelChart_Error_InitializationFailed=\u652F\u6301\u7C7B\u6BD4\u521D\u59CB\u5316\u5931\u8D25
-ExcelChart_Error_LoadingProfileFailed=\u4E0A\u4F20\u6587\u6863\u5931\u8D25\u7F18\u7531
-ExcelChart_Error_LoadingTemplateFailed=\u4E0A\u4F20\u683C\u5F0F\u5931\u8D25
-ExcelChart_Error_RetrivingOutlineDataFailed=\u63A5\u53D7\u6570\u636E\u5931\u8D25
-ExcelChart_Error_SavingProfileFailed=\u4FDD\u5B58\u6587\u6863\u5931\u8D25\u7F18\u7531
-ExcelChart_Error_WrongProfile=\u6587\u6863\u521B\u5EFA\u4E3A\u53E6\u4E00\u5927\u7EB2
-ExcelChart_Label_AutomaticMode=\u81EA\u52A8\u6A21\u5F0F
-ExcelChart_Label_AutomaticModeHint=\u9690\u85CFEXCEL\u5E76\u81EA\u52A8\u4FDD\u5B58
-ExcelChart_Label_ChartNumber=\u5B57\u7B26\u7F16\u7801
-ExcelChart_Label_ChartType=\u5B57\u7B26\u7C7B\u578B
-ExcelChart_Label_FileName=\u6587\u4EF6\u540D
-ExcelChart_Label_FirstRow=\u9996\u884C
-ExcelChart_Label_Height=\u9AD8\u5EA6
-ExcelChart_Label_HistogramMode=\u67F1\u72B6\u56FE\u6A21\u5F0F
-ExcelChart_Label_HistogramModeHint=The histogram mode combines identical values on the X-Axis to one.
-ExcelChart_Label_LastRow=\u672B\u884C
-ExcelChart_Label_Offset=\u4F4D\u7F6E
-ExcelChart_Label_SkipNullValues=\u8DF3\u8FC7\u7A7A\u503C
-ExcelChart_Label_SkipNullValuesHint=If checked null values on the X-Axis are ignored, otherwise they are combined to <Unknown>.
-ExcelChart_Label_TemplateName=\u6A21\u677F
-ExcelChart_Label_UseCustomFormat=\u4F7F\u7528\u5BA2\u6237\u683C\u5F0F
-ExcelChart_Label_UseCustomFormatHint=\u9009\u4E2D\u540E\u53EF\u6307\u793A\u5B57\u7B26\u4F4D\u7F6E\u4E0E\u5C3A\u5BF8
-ExcelChart_Label_UseExistingChart=\u4F7F\u7528\u5DF2\u6709\u5B57\u7B26
-ExcelChart_Label_UseExistingChartHint=If checked the existing chart in the indicated template is used.
-ExcelChart_Label_UseSelectiveExport=\u4F7F\u7528\u9009\u4E2D\u7684\u5BFC\u51FA
-ExcelChart_Label_UseSelectiveExportHint=\u9009\u4E2D\u540E\u4EC5\u4EE5\u4E0B\u672A\u6307\u5B9A\u884C\u88AB\u5BFC\u51FA
-ExcelChart_Label_Width=\u5BBD\u5EA6
-ExcelChart_Label_WorksheetName=\u5DE5\u4F5C\u8868
-ExcelChart_Label_XAxis=X\u8F74
-ExcelChart_Label_YAxes=Y\u8F74
-ExcelChart_Status_Done=EXCEL\u5BFC\u51FA\u5B8C\u6210
-ExcelChart_Tab_Advanced=\u9AD8\u7EA7
-ExcelChart_Tab_Basic=\u57FA\u672C
-ExcelChart_Title_MainForm=EXCEL\u5BFC\u51FA
-ExcelChart_Type_Area3D=3D\u533A
-ExcelChart_Type_Area=\u533A\u57DF
-ExcelChart_Type_AreaStacked3D=3D\u5806\u6808\u533A
-ExcelChart_Type_AreaStacked=\u5806\u6808\u533A
-ExcelChart_Type_BarsClustered3D=Bars Clustered 3D
-ExcelChart_Type_BarsClustered=Bars Clustered
-ExcelChart_Type_BarsStacked3D=Bars Stacked 3D
-ExcelChart_Type_BarsStacked=Bars Stacked
-ExcelChart_Type_ColumnsClustered3D=Columns Clustered 3D
-ExcelChart_Type_ColumnsClustered=Columns Clustered
-ExcelChart_Type_ColumnsStacked3D=Columns Stacked 3D
-ExcelChart_Type_ColumnsStacked=Columns Stacked
-ExcelChart_Type_Line=\u884C
-ExcelChart_Type_LineStacked=Line Stacked
-ExcelChart_Type_Pie3D=Pie 3D
-ExcelChart_Type_Pie=Pie
-ExcelChart_Type_PieExploded3D=Pie Exploded 3D
-ExcelChart_Type_PieExploded=Pie exploded
-ExcelChart_Various_Averaged=\u5E73\u5747
-ExcelChart_Various_Column=\u5217
-ExcelChart_Various_Frequency=\u9891\u7387
-ExcelChart_Various_SummedUp=\u6C47\u603B
-ExcelChart_Various_Unknown=\u672A\u77E5
-ExportDate=\u5BFC\u51FA\u6570\u636E
-ExtendedSearchAddAttributeMenu=\u589E\u52A0\u7EA6\u675F
-ExtendedSearchAddEntityPrefix=\u6709
-ExtendedSearchAnd=\u5E76
-ExtendedSearchEditAttributeMenu=\u7F16\u8F91...
-ExtendedSearchEntitySuffix=\u5E26
-ExtendedSearchNegateMenu=\u5426
-ExtendedSearchRemoveAttributeMenu=\u6E05\u9664
-ExtendedSearchRemoveMenu=\u6E05\u9664
-FileExistsOwerwriteQuestion=\u6240\u9009\u6587\u4EF6\u5DF2\u5B58\u5728\u3002\u662F\u5426\u8986\u76D6\uFF1F
-FileName=\u6587\u4EF6\u540D
-FileNotFoundMessage=\u65E0\u6CD5\u67E5\u627E\u6587\u4EF6\uFF1A
-FileNotFoundTitle=\u627E\u4E0D\u5230\u6587\u4EF6
-FilesOfType=\u6587\u4EF6\u7C7B\u578B
-FormPrint=\u6253\u5370
-FormSaveChangesQuestion=\u662F\u5426\u4FDD\u5B58\u6240\u4F5C\u66F4\u6539?
-FormStateLoad=\u4E0B\u8F7D...
-FormStateStore=\u4FDD\u5B58
-FormStateStoreAs=\u53E6\u5B58\u4E3A...
-GlobalBookmarks=\u5168\u7403\u4E66\u7B7E
-GlobalBookmarksAddMenu=\u589E\u52A0\u81F3\u5168\u7403\u4E66\u7B7E
-Help=\u5E2E\u52A9
-IOErrorInfo=\u8BF7\u68C0\u67E5\u6587\u4EF6\u548C\u8FDE\u63A5\u3002
-IOErrorText=\u901A\u4FE1\u9519\u8BEF\u3002
-IOErrorTitle=\u8BFB/\u5199\u9519\u8BEF\u3002
-Info=\u4FE1\u606F
-Interrupted=\u4E2D\u6B62
-InterruptedErrorText=\u8FDB\u7A0B\u88AB\u624B\u5DE5\u53D6\u6D88
-InterruptedErrorTitle=\u8FDB\u7A0B\u5DF2\u53D6\u6D88
-JavaVMVersion=Java VM
-Language=\u8BED\u8A00
-LoadFormXmlFailedText=\u6587\u4EF6\u4E0E\u8BE5\u5BF9\u8BDD\u7A97\u53E3\u4E0D\u517C\u5BB9\u3002
-LogicDateIsInDays=\u4E0E\u8BBE\u5B9A\u4E00\u81F4\uFF08\u65E5\uFF09
-LogicDateIsInGEDays=\u65E9\u4E8E\u8BBE\u5B9A\uFF08\u65E5\uFF09
-LogicDateIsInGEMonths=\u65E9\u4E8E\u8BBE\u5B9A\uFF08\u6708\uFF09
-LogicDateIsInLEDays=\u8FDF\u4E8E\u8BBE\u5B9A\uFF08\u65E5\uFF09
-LogicDateIsInLEMonths=\u8FDF\u4E8E\u8BBE\u5B9A\uFF08\u6708\uFF09
-LogicDateIsInMonths=\u4E0E\u8BBE\u5B9A\u4E00\u81F4\uFF08\u6708\uFF09
-LogicDateIsNotToday=\u975E\u5F53\u65E5
-LogicDateIsToday=\u5F53\u65E5
-LogicDateTimeIsInGEHours=\u65E9\u4E8E\u8BBE\u5B9A\uFF08\u5C0F\u65F6\uFF09
-LogicDateTimeIsInGEMinutes=\u65E9\u4E8E\u8BBE\u5B9A\uFF08\u5206\u949F\uFF09
-LogicDateTimeIsInLEHours=\u8FDF\u4E8E\u8BBE\u5B9A\uFF08\u5C0F\u65F6\uFF09
-LogicDateTimeIsInLEMinutes=\u8FDF\u4E8E\u8BBE\u5B9A\uFF08\u5206\u949F\uFF09
-LogicDateTimeIsNotNow=\u975E\u73B0\u5728
-LogicDateTimeIsNow=\u73B0\u5728
-LogicEQ=\=
-LogicEndsWith=\u7ED3\u675F
-LogicGE=>\=
-LogicGT=>
-LogicIn=\u662F
-LogicLE=<\=
-LogicLT=<
-LogicLike=\u5305\u542B
-LogicNEQ=<>
-LogicNotIn=\u4E0D\u662F
-LogicNotLike=\u4E0D\u5305\u542B
-LogicNotNull=\u4E0D\u662F\u7A7A\u767D
-LogicNull=\u662F\u7A7A\u767D
-LogicStartsWith=\u59CB\u4E8E
-LogicTimeIsInGEHours=\u65E9\u4E8E\u8BBE\u5B9A\uFF08\u5C0F\u65F6\uFF09
-LogicTimeIsInGEMinutes=\u65E9\u4E8E\u8BBE\u5B9A\uFF08\u5206\u949F\uFF09
-LogicTimeIsInHours=\u8FDF\u4E8E\u8BBE\u5B9A\uFF08\u5C0F\u65F6\uFF09
-LogicTimeIsInLEHours=\u8FDF\u4E8E\u8BBE\u5B9A\uFF08\u5206\u949F\uFF09
-LogicTimeIsInLEMinutes=\u4E0E\u8BBE\u5B9A\u4E00\u81F4\uFF08\u5C0F\u65F6\uFF09
-LogicTimeIsInMinutes=\u4E0E\u8BBE\u5B9A\u4E00\u81F4\uFF08\u5206\u949F\uFF09
-LogicTimeIsNotNow=\u975E\u73B0\u5728
-LogicTimeIsNow=\u5F53\u524D
-Login=\u767B\u5F55
-LookIn=\u89C2\u5BDF
-Month=\u6708
-Name=\u540D\u5B57
-NetErrorInfo=\u8BF7\u68C0\u67E5\u670D\u52A1\u5668\u540D\u79F0, URL \u548C\u8FDE\u63A5\u3002
-NetErrorText=\u65E0\u6CD5\u627E\u5230\u670D\u52A1\u5668.
-NetErrorTitle=\u7F51\u7EDC\u9519\u8BEF
-NewPassword=\u65B0\u5BC6\u7801
-No=\u65E0
-NoButton=&\u65E0
-NumberOfRows=\u884C\u7EDF\u8BA1
-OSUser=\u7CFB\u7EDF\u7528\u6237
-OSVersion=\u7CFB\u7EDF\u7248\u672C
-Ok=Ok
-OkButton=&Ok
-OkButtonTooltip=\u590D\u5236\u5E76\u5173\u95ED\u5BF9\u8BDD
-OldPassword=\u65E7\u5BC6\u7801
-Op=\u64CD\u4F5C\u5458
-Open=\u6253\u5F00
-Password=\u5BC6\u7801
-PasswordsDoNotMatch=\u4E24\u4E2A\u5BC6\u7801\u4E0D\u5339\u914D
-Paste=\u7C98\u8D34
-Path=\u8DEF\u5F84
-RepeatPassword=\u91CD\u590D
-ResetButton=&\u91CD\u8BBE
-ResetButtonTooltip=\u8BBE\u5B9A\u6240\u6709\u5BF9\u8BDD\u7A97\u53E3\u4E3A\u7A7A\u767D\u3002
-Save=\u4FDD\u5B58
-SaveButton=&\u4FDD\u5B58
-SaveButtonTooltip=\u4FDD\u5B58\u5BF9\u8BDD\u4E0D\u5173\u95ED\u7A97\u53E3\u3002
-SearchButton=&\u641C\u7D22
-SearchButtonTooltip=\u5173\u95ED\u5BF9\u8BDD\u7A97\u53E3\uFF0C\u5F00\u59CB\u641C\u7D22\u3002
-SearchConstraints=\u641C\u7D22\u6761\u4EF6
-Server=\u670D\u52A1\u5668
-SmartFindLabel=\u641C\u7D22\u6587\u672C
-StatusExportDone=\u5B8C\u5168\u8F93\u51FA
-Today=\u4ECA\u5929
-TooManyRows=\u6570\u636E\u96C6\u8FC7\u5927\u3002\u8BF7\u7F29\u5C0F\u641C\u7D22\u8303\u56F4\u3002
-Update=\u66F4\u65B0
-UserInterrupted=\u5DF2\u88AB\u7528\u6237\u53D6\u6D88\u3002
-Username=\u7528\u6237\u540D
-Value=\u6570\u503C
-Week=\u5468
-WeekShort=CW
-WizardCancelButton=\u53D6\u6D88
-WizardSuspendButton=&\u5173\u95ED
-WorkWeek=\u5DE5\u4F5C\u5468
-Yes=\u662F
-YesButton=&\u662F
-and=\u5E76
-from=\uFEFF\u4ECE
-to=\u5230
+AllStates=\u5168\u90E8
+Apply=\u5E94\u7528
+Attribute=\u5C5E\u6027
+Bookmarks=\u4E66\u7B7E
+BookmarksAddMenu=&\u589E\u52A0\u5230\u4E66\u7B7E...
+BookmarksMainMenu=&\u4E66\u7B7E
+BookmarksManageMenu=&\u7BA1\u7406\u4E66\u7B7E...
+BookmarksStartPageMenu=&\u542F\u52A8\u7A97\u53E3
+BookmarksStartPageMenuClear=&\u65E0\u542F\u52A8\u7A97\u53E3
+BookmarksStartPageMenuGoto=&\u6253\u5F00\u542F\u52A8\u7A97\u53E3
+BookmarksStartPageMenuSet=&\u628A\u76EE\u524D\u7A97\u53E3\u8BBE\u7F6E\u4E3A\u542F\u52A8\u7A97\u53E3
+ButtonDeselectAll=\u5168\u90E8\u4E0D\u9009
+ButtonSelectAll=\u5168\u9009
+Calendar_earlier=\u4E4B\u524D
+Calendar_later=\u7A0D\u540E
+Cancel=\u53D6\u6D88
+CancelButton=&\u53D6\u6D88
+CancelButtonTooltip=\u5173\u95ED\u7A97\u53E3\u65E0\u9700\u4FDD\u5B58;\u5982\u9700\u8981\u8BF7\u786E\u8BA4\u5BF9\u8BDD\u7A97\u53E3\u3002
+ChangePassword=\u66F4\u6539\u5BC6\u7801
+CloseButton=&\u5173\u95ED
+CloseButtonTooltip=\u5173\u95ED\u5BF9\u8BDD\u7A97\u53E3\u65E0\u9700\u4FDD\u5B58\u3002
+Column=\u5217
+Columns=\u5217
+ComposerFieldAggregationLabel=\u804C\u80FD
+Condensed=6 \u5217
+Copy=\u590D\u5236
+Cut=\u526A\u5207
+Day=\u5929
+DefaultPasswordPolicyText=\u5BC6\u7801\u4E0D\u7B26\u5408\u8981\u6C42 \u81F3\u5C11\u516B\u4F4D;\u81F3\u5C11\u542B\u4E00\u4E2A\u6570\u5B57;\u81F3\u5C11\u4E00\u4E2A\u975E\u6807\u51C6\u5B57\u7B26(\!|@|\#|$|%|^|&|*|(|)|_|+|||~|-|
+EmailFrom=\u6765\u81EA
+EmailSubject=\u4E3B\u9898
+EmailTo=\u81F3
+Error=\u9519\u8BEF
+ErrorAndRetryTextDefault=\u6570\u636E\u4F20\u8F93\u8FC7\u7A0B\u4E2D\u51FA\u73B0\u4E00\u4E2A\u9519\u8BEF\u3002
+ErrorTextLogin=\u65E0\u6548\u7528\u6237/\u5BC6\u7801
+ErrorTitleLogin=\u767B\u5F55\u5931\u8D25
+ExcelChart_Button_LoadDefaults=\u9ED8\u8BA4
+ExcelChart_Button_LoadDefaultsHint=\u5BFC\u5165\u9ED8\u8BA4\u503C\u91CD\u8BBE\u5BF9\u8BDD
+ExcelChart_Button_LoadProfile=\u4E0A\u8F7D\u6587\u6863
+ExcelChart_Button_LoadProfileHint=\u4ECEXML\u6587\u4EF6\u4E0A\u8F7D\u8BBE\u7F6E
+ExcelChart_Button_SaveProfile=\u4FDD\u5B58\u6587\u6863
+ExcelChart_Button_SaveProfileHint=\u4FDD\u5B58\u5F53\u524D\u8BBE\u7F6E\u81F3XML\u6587\u4EF6
+ExcelChart_Error_CreatingChartFailed=\u521B\u5EFA\u6587\u6863\u5931\u8D25
+ExcelChart_Error_ExportingFailed=\u5BFC\u51FA\u5931\u8D25\u7F18\u7531
+ExcelChart_Error_InitializationFailed=\u652F\u6301\u7C7B\u6BD4\u521D\u59CB\u5316\u5931\u8D25
+ExcelChart_Error_LoadingProfileFailed=\u4E0A\u4F20\u6587\u6863\u5931\u8D25\u7F18\u7531
+ExcelChart_Error_LoadingTemplateFailed=\u4E0A\u4F20\u683C\u5F0F\u5931\u8D25
+ExcelChart_Error_RetrivingOutlineDataFailed=\u63A5\u53D7\u6570\u636E\u5931\u8D25
+ExcelChart_Error_SavingProfileFailed=\u4FDD\u5B58\u6587\u6863\u5931\u8D25\u7F18\u7531
+ExcelChart_Error_WrongProfile=\u6587\u6863\u521B\u5EFA\u4E3A\u53E6\u4E00\u5927\u7EB2
+ExcelChart_Label_AutomaticMode=\u81EA\u52A8\u6A21\u5F0F
+ExcelChart_Label_AutomaticModeHint=\u9690\u85CFEXCEL\u5E76\u81EA\u52A8\u4FDD\u5B58
+ExcelChart_Label_ChartNumber=\u5B57\u7B26\u7F16\u7801
+ExcelChart_Label_ChartType=\u5B57\u7B26\u7C7B\u578B
+ExcelChart_Label_FileName=\u6587\u4EF6\u540D
+ExcelChart_Label_FirstRow=\u9996\u884C
+ExcelChart_Label_Height=\u9AD8\u5EA6
+ExcelChart_Label_HistogramMode=\u67F1\u72B6\u56FE\u6A21\u5F0F
+ExcelChart_Label_HistogramModeHint=The histogram mode combines identical values on the X-Axis to one.
+ExcelChart_Label_LastRow=\u672B\u884C
+ExcelChart_Label_Offset=\u4F4D\u7F6E
+ExcelChart_Label_SkipNullValues=\u8DF3\u8FC7\u7A7A\u503C
+ExcelChart_Label_SkipNullValuesHint=If checked null values on the X-Axis are ignored, otherwise they are combined to <Unknown>.
+ExcelChart_Label_TemplateName=\u6A21\u677F
+ExcelChart_Label_UseCustomFormat=\u4F7F\u7528\u5BA2\u6237\u683C\u5F0F
+ExcelChart_Label_UseCustomFormatHint=\u9009\u4E2D\u540E\u53EF\u6307\u793A\u5B57\u7B26\u4F4D\u7F6E\u4E0E\u5C3A\u5BF8
+ExcelChart_Label_UseExistingChart=\u4F7F\u7528\u5DF2\u6709\u5B57\u7B26
+ExcelChart_Label_UseExistingChartHint=If checked the existing chart in the indicated template is used.
+ExcelChart_Label_UseSelectiveExport=\u4F7F\u7528\u9009\u4E2D\u7684\u5BFC\u51FA
+ExcelChart_Label_UseSelectiveExportHint=\u9009\u4E2D\u540E\u4EC5\u4EE5\u4E0B\u672A\u6307\u5B9A\u884C\u88AB\u5BFC\u51FA
+ExcelChart_Label_Width=\u5BBD\u5EA6
+ExcelChart_Label_WorksheetName=\u5DE5\u4F5C\u8868
+ExcelChart_Label_XAxis=X\u8F74
+ExcelChart_Label_YAxes=Y\u8F74
+ExcelChart_Status_Done=EXCEL\u5BFC\u51FA\u5B8C\u6210
+ExcelChart_Tab_Advanced=\u9AD8\u7EA7
+ExcelChart_Tab_Basic=\u57FA\u672C
+ExcelChart_Title_MainForm=EXCEL\u5BFC\u51FA
+ExcelChart_Type_Area3D=3D\u533A
+ExcelChart_Type_Area=\u533A\u57DF
+ExcelChart_Type_AreaStacked3D=3D\u5806\u6808\u533A
+ExcelChart_Type_AreaStacked=\u5806\u6808\u533A
+ExcelChart_Type_BarsClustered3D=Bars Clustered 3D
+ExcelChart_Type_BarsClustered=Bars Clustered
+ExcelChart_Type_BarsStacked3D=Bars Stacked 3D
+ExcelChart_Type_BarsStacked=Bars Stacked
+ExcelChart_Type_ColumnsClustered3D=Columns Clustered 3D
+ExcelChart_Type_ColumnsClustered=Columns Clustered
+ExcelChart_Type_ColumnsStacked3D=Columns Stacked 3D
+ExcelChart_Type_ColumnsStacked=Columns Stacked
+ExcelChart_Type_Line=\u884C
+ExcelChart_Type_LineStacked=Line Stacked
+ExcelChart_Type_Pie3D=Pie 3D
+ExcelChart_Type_Pie=Pie
+ExcelChart_Type_PieExploded3D=Pie Exploded 3D
+ExcelChart_Type_PieExploded=Pie exploded
+ExcelChart_Various_Averaged=\u5E73\u5747
+ExcelChart_Various_Column=\u5217
+ExcelChart_Various_Frequency=\u9891\u7387
+ExcelChart_Various_SummedUp=\u6C47\u603B
+ExcelChart_Various_Unknown=\u672A\u77E5
+ExportDate=\u5BFC\u51FA\u6570\u636E
+ExtendedSearchAddAttributeMenu=\u589E\u52A0\u7EA6\u675F
+ExtendedSearchAddEntityPrefix=\u6709
+ExtendedSearchAnd=\u5E76
+ExtendedSearchEditAttributeMenu=\u7F16\u8F91...
+ExtendedSearchEntitySuffix=\u5E26
+ExtendedSearchNegateMenu=\u5426
+ExtendedSearchRemoveAttributeMenu=\u6E05\u9664
+ExtendedSearchRemoveMenu=\u6E05\u9664
+FileExistsOwerwriteQuestion=\u6240\u9009\u6587\u4EF6\u5DF2\u5B58\u5728\u3002\u662F\u5426\u8986\u76D6\uFF1F
+FileName=\u6587\u4EF6\u540D
+FileNotFoundMessage=\u65E0\u6CD5\u67E5\u627E\u6587\u4EF6\uFF1A
+FileNotFoundTitle=\u627E\u4E0D\u5230\u6587\u4EF6
+FilesOfType=\u6587\u4EF6\u7C7B\u578B
+FormPrint=\u6253\u5370
+FormSaveChangesQuestion=\u662F\u5426\u4FDD\u5B58\u6240\u4F5C\u66F4\u6539?
+FormStateLoad=\u4E0B\u8F7D...
+FormStateStore=\u4FDD\u5B58
+FormStateStoreAs=\u53E6\u5B58\u4E3A...
+GlobalBookmarks=\u5168\u7403\u4E66\u7B7E
+GlobalBookmarksAddMenu=\u589E\u52A0\u81F3\u5168\u7403\u4E66\u7B7E
+Help=\u5E2E\u52A9
+IOErrorInfo=\u8BF7\u68C0\u67E5\u6587\u4EF6\u548C\u8FDE\u63A5\u3002
+IOErrorText=\u901A\u4FE1\u9519\u8BEF\u3002
+IOErrorTitle=\u8BFB/\u5199\u9519\u8BEF\u3002
+Info=\u4FE1\u606F
+Interrupted=\u4E2D\u6B62
+InterruptedErrorText=\u8FDB\u7A0B\u88AB\u624B\u5DE5\u53D6\u6D88
+InterruptedErrorTitle=\u8FDB\u7A0B\u5DF2\u53D6\u6D88
+JavaVMVersion=Java VM
+Language=\u8BED\u8A00
+LoadFormXmlFailedText=\u6587\u4EF6\u4E0E\u8BE5\u5BF9\u8BDD\u7A97\u53E3\u4E0D\u517C\u5BB9\u3002
+LogicDateIsInDays=\u4E0E\u8BBE\u5B9A\u4E00\u81F4\uFF08\u65E5\uFF09
+LogicDateIsInGEDays=\u65E9\u4E8E\u8BBE\u5B9A\uFF08\u65E5\uFF09
+LogicDateIsInGEMonths=\u65E9\u4E8E\u8BBE\u5B9A\uFF08\u6708\uFF09
+LogicDateIsInLEDays=\u8FDF\u4E8E\u8BBE\u5B9A\uFF08\u65E5\uFF09
+LogicDateIsInLEMonths=\u8FDF\u4E8E\u8BBE\u5B9A\uFF08\u6708\uFF09
+LogicDateIsInMonths=\u4E0E\u8BBE\u5B9A\u4E00\u81F4\uFF08\u6708\uFF09
+LogicDateIsNotToday=\u975E\u5F53\u65E5
+LogicDateIsToday=\u5F53\u65E5
+LogicDateTimeIsInGEHours=\u65E9\u4E8E\u8BBE\u5B9A\uFF08\u5C0F\u65F6\uFF09
+LogicDateTimeIsInGEMinutes=\u65E9\u4E8E\u8BBE\u5B9A\uFF08\u5206\u949F\uFF09
+LogicDateTimeIsInLEHours=\u8FDF\u4E8E\u8BBE\u5B9A\uFF08\u5C0F\u65F6\uFF09
+LogicDateTimeIsInLEMinutes=\u8FDF\u4E8E\u8BBE\u5B9A\uFF08\u5206\u949F\uFF09
+LogicDateTimeIsNotNow=\u975E\u73B0\u5728
+LogicDateTimeIsNow=\u73B0\u5728
+LogicEQ=\=
+LogicEndsWith=\u7ED3\u675F
+LogicGE=>\=
+LogicGT=>
+LogicIn=\u662F
+LogicLE=<\=
+LogicLT=<
+LogicLike=\u5305\u542B
+LogicNEQ=<>
+LogicNotIn=\u4E0D\u662F
+LogicNotLike=\u4E0D\u5305\u542B
+LogicNotNull=\u4E0D\u662F\u7A7A\u767D
+LogicNull=\u662F\u7A7A\u767D
+LogicStartsWith=\u59CB\u4E8E
+LogicTimeIsInGEHours=\u65E9\u4E8E\u8BBE\u5B9A\uFF08\u5C0F\u65F6\uFF09
+LogicTimeIsInGEMinutes=\u65E9\u4E8E\u8BBE\u5B9A\uFF08\u5206\u949F\uFF09
+LogicTimeIsInHours=\u8FDF\u4E8E\u8BBE\u5B9A\uFF08\u5C0F\u65F6\uFF09
+LogicTimeIsInLEHours=\u8FDF\u4E8E\u8BBE\u5B9A\uFF08\u5206\u949F\uFF09
+LogicTimeIsInLEMinutes=\u4E0E\u8BBE\u5B9A\u4E00\u81F4\uFF08\u5C0F\u65F6\uFF09
+LogicTimeIsInMinutes=\u4E0E\u8BBE\u5B9A\u4E00\u81F4\uFF08\u5206\u949F\uFF09
+LogicTimeIsNotNow=\u975E\u73B0\u5728
+LogicTimeIsNow=\u5F53\u524D
+Login=\u767B\u5F55
+LookIn=\u89C2\u5BDF
+Month=\u6708
+Name=\u540D\u5B57
+NetErrorInfo=\u8BF7\u68C0\u67E5\u670D\u52A1\u5668\u540D\u79F0, URL \u548C\u8FDE\u63A5\u3002
+NetErrorText=\u65E0\u6CD5\u627E\u5230\u670D\u52A1\u5668.
+NetErrorTitle=\u7F51\u7EDC\u9519\u8BEF
+NewPassword=\u65B0\u5BC6\u7801
+No=\u65E0
+NoButton=&\u65E0
+NumberOfRows=\u884C\u7EDF\u8BA1
+OSUser=\u7CFB\u7EDF\u7528\u6237
+OSVersion=\u7CFB\u7EDF\u7248\u672C
+Ok=Ok
+OkButton=&Ok
+OkButtonTooltip=\u590D\u5236\u5E76\u5173\u95ED\u5BF9\u8BDD
+OldPassword=\u65E7\u5BC6\u7801
+Op=\u64CD\u4F5C\u5458
+Open=\u6253\u5F00
+Password=\u5BC6\u7801
+PasswordsDoNotMatch=\u4E24\u4E2A\u5BC6\u7801\u4E0D\u5339\u914D
+Paste=\u7C98\u8D34
+Path=\u8DEF\u5F84
+RepeatPassword=\u91CD\u590D
+ResetButton=&\u91CD\u8BBE
+ResetButtonTooltip=\u8BBE\u5B9A\u6240\u6709\u5BF9\u8BDD\u7A97\u53E3\u4E3A\u7A7A\u767D\u3002
+Save=\u4FDD\u5B58
+SaveButton=&\u4FDD\u5B58
+SaveButtonTooltip=\u4FDD\u5B58\u5BF9\u8BDD\u4E0D\u5173\u95ED\u7A97\u53E3\u3002
+SearchButton=&\u641C\u7D22
+SearchButtonTooltip=\u5173\u95ED\u5BF9\u8BDD\u7A97\u53E3\uFF0C\u5F00\u59CB\u641C\u7D22\u3002
+SearchConstraints=\u641C\u7D22\u6761\u4EF6
+Server=\u670D\u52A1\u5668
+SmartFindLabel=\u641C\u7D22\u6587\u672C
+StatusExportDone=\u5B8C\u5168\u8F93\u51FA
+Today=\u4ECA\u5929
+TooManyRows=\u6570\u636E\u96C6\u8FC7\u5927\u3002\u8BF7\u7F29\u5C0F\u641C\u7D22\u8303\u56F4\u3002
+Update=\u66F4\u65B0
+UserInterrupted=\u5DF2\u88AB\u7528\u6237\u53D6\u6D88\u3002
+Username=\u7528\u6237\u540D
+Value=\u6570\u503C
+Week=\u5468
+WeekShort=CW
+WizardCancelButton=\u53D6\u6D88
+WizardSuspendButton=&\u5173\u95ED
+WorkWeek=\u5DE5\u4F5C\u5468
+Yes=\u662F
+YesButton=&\u662F
+and=\u5E76
+from=\uFEFF\u4ECE
+to=\u5230
diff --git a/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_zh_TW.properties b/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_zh_TW.properties
index abcd60d5ab..5330ed0f44 100644
--- a/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_zh_TW.properties
+++ b/org.eclipse.scout.rt.shared/resources/texts/ScoutTexts_zh_TW.properties
@@ -1,224 +1,224 @@
-AllStates=\u5168\u90E8
-Apply=\u7533\u8ACB
-Attribute=\u5C6C\u6027
-Bookmarks=\u66F8\u7C64
-BookmarksAddMenu=&\u52A0\u5165\u66F8\u7C64
-BookmarksMainMenu=&\u66F8\u7C64\u4E3B\u9801
-BookmarksManageMenu=&\u66F8\u7C64\u7BA1\u7406\u4E3B\u9801
-BookmarksStartPageMenu=&\u958B\u59CB\u8996\u7A97
-BookmarksStartPageMenuClear=&\u6C92\u6709\u555F\u52D5\u6AA2\u8996
-BookmarksStartPageMenuGoto=&\u958B\u555F\u555F\u52D5\u6AA2\u8996
-BookmarksStartPageMenuSet=&\u8A2D\u70BA\u4E3B\u756B\u9762
-ButtonDeselectAll=Deselect all
-ButtonSelectAll=Select all
-Calendar_earlier=\u65E9\u5148
-Calendar_later=\u4EE5\u5F8C
-Cancel=\u53D6\u6D88
-CancelButton=&\u53D6\u6D88\u7D10
-CancelButtonTooltip=\u53D6\u6D88\u4E0D\u5132\u5B58
-ChangePassword=\u5BC6\u78BC\u6539\u8B8A
-CloseButton=&\u7D50\u675F\u6309\u9215
-CloseButtonTooltip=\u7D50\u675F\u5C0D\u8A71\u4E0D\u5132\u5B58
-Column=\u6B04
-Columns=\u6B04
-ComposerFieldAggregationLabel=\u8077\u80FD
-Condensed=6 \u6B04
-Copy=\u8907\u88FD
-Cut=Cut
-Day=\u65E5\u671F
-DefaultPasswordPolicyText=The password does not comply with the given policy\n\nPolicy\:\n- at least 8 characters\n- at least one number (0-9)\n- at least one non standard character (\!|@|\#|$|%|^|&|*|(|)|_|+|||~|-|\n- not used in the past\n- your username can't be a part of the password
-EmailFrom=\u7531
-EmailSubject=\u4E3B\u984C
-EmailTo=To
-Error=\u932F\u8AA4
-ErrorAndRetryTextDefault=\u8CC7\u6599\u50B3\u8F38\u6642\u767C\u751F\u932F\u8AA4
-ErrorTextLogin=\u7121\u6548\u4F7F\u7528\u8005/\u5BC6\u78BC
-ErrorTitleLogin=\u767B\u5165\u5931\u6557
-ExcelChart_Button_LoadDefaults=Defaults
-ExcelChart_Button_LoadDefaultsHint=Resets this dialog by loading the default values.
-ExcelChart_Button_LoadProfile=Load profile...
-ExcelChart_Button_LoadProfileHint=Loads settings from an XML file.
-ExcelChart_Button_SaveProfile=\u5132\u5B58\u6587\u4EF6...
-ExcelChart_Button_SaveProfileHint=Saves the current settings in an XML file.
-ExcelChart_Error_CreatingChartFailed=creating chart failed.
-ExcelChart_Error_ExportingFailed=Export failed because
-ExcelChart_Error_InitializationFailed=initialization of the support class(es) failed.
-ExcelChart_Error_LoadingProfileFailed=\u6587\u4EF6\u8F09\u5165\u932F\u8AA4 \u7531\u65BC..
-ExcelChart_Error_LoadingTemplateFailed=loading template failed.
-ExcelChart_Error_RetrivingOutlineDataFailed=retriving outline data failed.
-ExcelChart_Error_SavingProfileFailed=Saving profile failed because
-ExcelChart_Error_WrongProfile=the profile was created for another outline.
-ExcelChart_Label_AutomaticMode=Automatic mode
-ExcelChart_Label_AutomaticModeHint=\u96B1\u85CFExcel\u4E26\u81EA\u52D5\u5132\u5B58
-ExcelChart_Label_ChartNumber=Chart number
-ExcelChart_Label_ChartType=Chart type
-ExcelChart_Label_FileName=Filename
-ExcelChart_Label_FirstRow=First row
-ExcelChart_Label_Height=Height
-ExcelChart_Label_HistogramMode=Histogram mode
-ExcelChart_Label_HistogramModeHint=The histogram mode combines identical values on the X-Axis to one.
-ExcelChart_Label_LastRow=Last row
-ExcelChart_Label_Offset=Position
-ExcelChart_Label_SkipNullValues=Skip null values in histogram mode
-ExcelChart_Label_SkipNullValuesHint=If checked null values on the X-Axis are ignored, otherwise they are combined to <Unknown>.
-ExcelChart_Label_TemplateName=Template
-ExcelChart_Label_UseCustomFormat=Use custom format
-ExcelChart_Label_UseCustomFormatHint=If checked you can indicate the chart's position and size.
-ExcelChart_Label_UseExistingChart=Use existing chart
-ExcelChart_Label_UseExistingChartHint=If checked the existing chart in the indicated template is used.
-ExcelChart_Label_UseSelectiveExport=Use selective export
-ExcelChart_Label_UseSelectiveExportHint=If checked only the rows indicated below are exported.
-ExcelChart_Label_Width=Width
-ExcelChart_Label_WorksheetName=Worksheet
-ExcelChart_Label_XAxis=X-Axis
-ExcelChart_Label_YAxes=Y-Axes
-ExcelChart_Status_Done=Excel Chart Export is done.
-ExcelChart_Tab_Advanced=Advanced
-ExcelChart_Tab_Basic=Basic
-ExcelChart_Title_MainForm=Excel Chart Export
-ExcelChart_Type_Area3D=Area 3D
-ExcelChart_Type_Area=Area
-ExcelChart_Type_AreaStacked3D=Area Stacked 3D
-ExcelChart_Type_AreaStacked=Area Stacked
-ExcelChart_Type_BarsClustered3D=Bars Clustered 3D
-ExcelChart_Type_BarsClustered=Bars Clustered
-ExcelChart_Type_BarsStacked3D=Bars Stacked 3D
-ExcelChart_Type_BarsStacked=Bars Stacked
-ExcelChart_Type_ColumnsClustered3D=Columns Clustered 3D
-ExcelChart_Type_ColumnsClustered=Columns Clustered
-ExcelChart_Type_ColumnsStacked3D=Columns Stacked 3D
-ExcelChart_Type_ColumnsStacked=Columns Stacked
-ExcelChart_Type_Line=Line
-ExcelChart_Type_LineStacked=Line Stacked
-ExcelChart_Type_Pie3D=Pie 3D
-ExcelChart_Type_Pie=Pie
-ExcelChart_Type_PieExploded3D=Pie Exploded 3D
-ExcelChart_Type_PieExploded=Pie exploded
-ExcelChart_Various_Averaged=averaged
-ExcelChart_Various_Column=\u884C
-ExcelChart_Various_Frequency=Frequency
-ExcelChart_Various_SummedUp=summed up
-ExcelChart_Various_Unknown=<Unknown>
-ExportDate=Export date
-ExtendedSearchAddAttributeMenu=\u52A0\u5165\u5E38\u6578
-ExtendedSearchAddEntityPrefix=\u6709
-ExtendedSearchAnd=\u548C
-ExtendedSearchEditAttributeMenu=\u7DE8\u8F2F
-ExtendedSearchEntitySuffix=\u7528
-ExtendedSearchNegateMenu=\u7121\u6548
-ExtendedSearchRemoveAttributeMenu=\u79FB\u9664
-ExtendedSearchRemoveMenu=\u79FB\u9664
-FileExistsOwerwriteQuestion=\u9078\u64C7\u7684\u6A94\u6848\u5DF2\u7D93\u5B58\u5728,\u8981\u8986\u84CB\u55CE?
-FileName=\u6A94\u6848\u540D\u7A31
-FileNotFoundMessage=\u70BA\u7121\u6CD5\u767C\u73FE\u6A94\u6848
-FileNotFoundTitle=\u6A94\u6848\u4E0D\u5B58\u5728
-FilesOfType=\u6A94\u6848\u985E\u578B
-FormPrint=\u5217\u5370
-FormSaveChangesQuestion=\u8981\u5132\u5B58\u6539\u8B8A\u55CE
-FormStateLoad=\u4E0B\u8F09\u8CC7\u6599
-FormStateStore=\u5132\u5B58
-FormStateStoreAs=\u5132\u5B58\u70BA
-GlobalBookmarks=Global Bookmarks
-GlobalBookmarksAddMenu=Add to &global bookmarks
-Help=\u5E6B\u52A9
-IOErrorInfo=\u8ACB\u6AA2\u67E5\u6A94\u6848\u8207\u9023\u7DDA
-IOErrorText=\u901A\u8A0A\u932F\u8AA4
-IOErrorTitle=\u8B80/\u5BEB\u932F\u8AA4
-Info=\u8CC7\u8A0A
-Interrupted=\u4E2D\u65B7
-InterruptedErrorText=\u8655\u7406\u7A0B\u5E8F\u5DF2\u7D93\u624B\u52D5\u53D6\u6D88
-InterruptedErrorTitle=\u7A0B\u5E8F\u88AB\u53D6\u6D88
-JavaVMVersion=Java VM
-Language=\u8A9E\u8A00
-LoadFormXmlFailedText=\u6A94\u6848\u8207\u5C0D\u8A71\u4E0D\u76F8\u5BB9
-LogicDateIsInDays=is in exactly (days)
-LogicDateIsInGEDays=is earliest in (days)
-LogicDateIsInGEMonths=is earliest in (months)
-LogicDateIsInLEDays=is latest in (days)
-LogicDateIsInLEMonths=is latest in (months)
-LogicDateIsInLastDays=\u5728\u904E\u53BB\u5E7E\u5929
-LogicDateIsInLastMonths=was in last n Months
-LogicDateIsInMonths=\u662F\u5728\u6B63\u78BA\u7684 (\u6708\u4EFD)
-LogicDateIsInNextDays=was in next n days
-LogicDateIsInNextMonths=was in next n Months
-LogicDateIsNotToday=is not today
-LogicDateIsToday=is today
-LogicDateTimeIsInGEHours=is earliest in (hours)
-LogicDateTimeIsInGEMinutes=is earliest in (minutes)
-LogicDateTimeIsInLEHours=is latest in (hours)
-LogicDateTimeIsInLEMinutes=is latest in (minutes)
-LogicDateTimeIsNotNow=is not now
-LogicDateTimeIsNow=is now
-LogicEQ=\=
-LogicEndsWith=Ends with
-LogicGE=>\=
-LogicGT=>
-LogicIn=Is
-LogicLE=<\=
-LogicLT=<
-LogicLike=\u5305\u62EC
-LogicNEQ=<>
-LogicNotIn=\u4E0D\u662F
-LogicNotLike=\u4E0D\u5305\u62EC
-LogicNotNull=\u4E0D\u7A7A\u767D
-LogicNull=\u7A7A\u767D
-LogicStartsWith=\u4EE5..\u958B\u59CB
-LogicTimeIsInGEHours=is earliest in (hours)
-LogicTimeIsInGEMinutes=is earliest in (minutes)
-LogicTimeIsInHours=is in exactly (hours)
-LogicTimeIsInLEHours=is latest in (hours)
-LogicTimeIsInLEMinutes=is latest in (minutes)
-LogicTimeIsInMinutes=\u662F\u6B63\u78BA\u7684(\u5206\u9418)
-LogicTimeIsNotNow=is not now
-LogicTimeIsNow=is now
-Login=Login
-LookIn=Look in
-Month=\u6708
-Name=\u540D\u5B57
-NetErrorInfo=\u8ACB\u78BA\u8A8D\u4F3A\u670D\u5668\u540D\u7A31,\u7DB2\u5740\u548C\u9023\u7DDA
-NetErrorText=\u627E\u4E0D\u5230\u4F3A\u670D\u5668
-NetErrorTitle=\u7DB2\u8DEF\u932F\u8AA4
-NewPassword=\u65B0\u5BC6\u78BC
-No=\u4E0D
-NoButton=&No
-NumberOfRows=\u8A08\u7B97\u5217\u6578
-OSUser=System User
-OSVersion=System Version
-Ok=Ok
-OkButton=&Ok
-OkButtonTooltip=\u5132\u5B58\u4E26\u4E14\u7D50\u675F\u5C0D\u8A71
-OldPassword=\u820A\u5BC6\u78BC
-Op=Operator
-Open=\u6253\u958B
-Password=\u5BC6\u78BC
-PasswordsDoNotMatch=\u5169\u500B\u5BC6\u78BC\u4E0D\u76F8\u7B26
-Paste=Paste
-Path=\u8DEF\u5F91
-RepeatPassword=\u91CD\u8907
-ResetButton=&Reset
-ResetButtonTooltip=\u8A2D\u5B9A\u6240\u6709\u5C0D\u8A71\u6B04\u4F4D\u70BA\u7A7A\u767D
-Save=\u5132\u5B58
-SaveButton=&\u5132\u5B58
-SaveButtonTooltip=\u5132\u5B58\u5C0D\u8A71\u4E14\u4E0D\u95DC\u9589
-SearchButton=&\u627E\u5C0B
-SearchButtonTooltip=\u7D50\u675F\u5C0D\u8A71\u958B\u59CB\u627E\u5C0B
-SearchConstraints=\u627E\u5C0B\u5E38\u6578
-Server=\u4F3A\u670D\u5668
-SmartFindLabel=\u627E\u5C0B\u5167\u6587
-StatusExportDone=\u532F\u51FA\u5B8C\u6210
-Today=today
-TooManyRows=\u8CC7\u6599\u592A\u5927\u8ACB\u9650\u5236\u641C\u5C0B\u7BC4\u570D
-Update=\u66F4\u65B0
-UserInterrupted=\u88AB\u4F7F\u7528\u8005\u53D6\u6D88
-Username=\u4F7F\u7528\u8005\u59D3\u540D
-Value=\u6578\u503C
-Week=\u9031
-WeekShort=CW
-WizardCancelButton=\u53D6\u6D88
-WizardSuspendButton=&\u95DC\u9589
-WorkWeek=\u5DE5\u4F5C\u9031
-Yes=\u662F
-YesButton=&\u662F
-and=\u548C
-from=\u5F9E
-to=\u81F3
+AllStates=\u5168\u90E8
+Apply=\u7533\u8ACB
+Attribute=\u5C6C\u6027
+Bookmarks=\u66F8\u7C64
+BookmarksAddMenu=&\u52A0\u5165\u66F8\u7C64
+BookmarksMainMenu=&\u66F8\u7C64\u4E3B\u9801
+BookmarksManageMenu=&\u66F8\u7C64\u7BA1\u7406\u4E3B\u9801
+BookmarksStartPageMenu=&\u958B\u59CB\u8996\u7A97
+BookmarksStartPageMenuClear=&\u6C92\u6709\u555F\u52D5\u6AA2\u8996
+BookmarksStartPageMenuGoto=&\u958B\u555F\u555F\u52D5\u6AA2\u8996
+BookmarksStartPageMenuSet=&\u8A2D\u70BA\u4E3B\u756B\u9762
+ButtonDeselectAll=Deselect all
+ButtonSelectAll=Select all
+Calendar_earlier=\u65E9\u5148
+Calendar_later=\u4EE5\u5F8C
+Cancel=\u53D6\u6D88
+CancelButton=&\u53D6\u6D88\u7D10
+CancelButtonTooltip=\u53D6\u6D88\u4E0D\u5132\u5B58
+ChangePassword=\u5BC6\u78BC\u6539\u8B8A
+CloseButton=&\u7D50\u675F\u6309\u9215
+CloseButtonTooltip=\u7D50\u675F\u5C0D\u8A71\u4E0D\u5132\u5B58
+Column=\u6B04
+Columns=\u6B04
+ComposerFieldAggregationLabel=\u8077\u80FD
+Condensed=6 \u6B04
+Copy=\u8907\u88FD
+Cut=Cut
+Day=\u65E5\u671F
+DefaultPasswordPolicyText=The password does not comply with the given policy\n\nPolicy\:\n- at least 8 characters\n- at least one number (0-9)\n- at least one non standard character (\!|@|\#|$|%|^|&|*|(|)|_|+|||~|-|\n- not used in the past\n- your username can't be a part of the password
+EmailFrom=\u7531
+EmailSubject=\u4E3B\u984C
+EmailTo=To
+Error=\u932F\u8AA4
+ErrorAndRetryTextDefault=\u8CC7\u6599\u50B3\u8F38\u6642\u767C\u751F\u932F\u8AA4
+ErrorTextLogin=\u7121\u6548\u4F7F\u7528\u8005/\u5BC6\u78BC
+ErrorTitleLogin=\u767B\u5165\u5931\u6557
+ExcelChart_Button_LoadDefaults=Defaults
+ExcelChart_Button_LoadDefaultsHint=Resets this dialog by loading the default values.
+ExcelChart_Button_LoadProfile=Load profile...
+ExcelChart_Button_LoadProfileHint=Loads settings from an XML file.
+ExcelChart_Button_SaveProfile=\u5132\u5B58\u6587\u4EF6...
+ExcelChart_Button_SaveProfileHint=Saves the current settings in an XML file.
+ExcelChart_Error_CreatingChartFailed=creating chart failed.
+ExcelChart_Error_ExportingFailed=Export failed because
+ExcelChart_Error_InitializationFailed=initialization of the support class(es) failed.
+ExcelChart_Error_LoadingProfileFailed=\u6587\u4EF6\u8F09\u5165\u932F\u8AA4 \u7531\u65BC..
+ExcelChart_Error_LoadingTemplateFailed=loading template failed.
+ExcelChart_Error_RetrivingOutlineDataFailed=retriving outline data failed.
+ExcelChart_Error_SavingProfileFailed=Saving profile failed because
+ExcelChart_Error_WrongProfile=the profile was created for another outline.
+ExcelChart_Label_AutomaticMode=Automatic mode
+ExcelChart_Label_AutomaticModeHint=\u96B1\u85CFExcel\u4E26\u81EA\u52D5\u5132\u5B58
+ExcelChart_Label_ChartNumber=Chart number
+ExcelChart_Label_ChartType=Chart type
+ExcelChart_Label_FileName=Filename
+ExcelChart_Label_FirstRow=First row
+ExcelChart_Label_Height=Height
+ExcelChart_Label_HistogramMode=Histogram mode
+ExcelChart_Label_HistogramModeHint=The histogram mode combines identical values on the X-Axis to one.
+ExcelChart_Label_LastRow=Last row
+ExcelChart_Label_Offset=Position
+ExcelChart_Label_SkipNullValues=Skip null values in histogram mode
+ExcelChart_Label_SkipNullValuesHint=If checked null values on the X-Axis are ignored, otherwise they are combined to <Unknown>.
+ExcelChart_Label_TemplateName=Template
+ExcelChart_Label_UseCustomFormat=Use custom format
+ExcelChart_Label_UseCustomFormatHint=If checked you can indicate the chart's position and size.
+ExcelChart_Label_UseExistingChart=Use existing chart
+ExcelChart_Label_UseExistingChartHint=If checked the existing chart in the indicated template is used.
+ExcelChart_Label_UseSelectiveExport=Use selective export
+ExcelChart_Label_UseSelectiveExportHint=If checked only the rows indicated below are exported.
+ExcelChart_Label_Width=Width
+ExcelChart_Label_WorksheetName=Worksheet
+ExcelChart_Label_XAxis=X-Axis
+ExcelChart_Label_YAxes=Y-Axes
+ExcelChart_Status_Done=Excel Chart Export is done.
+ExcelChart_Tab_Advanced=Advanced
+ExcelChart_Tab_Basic=Basic
+ExcelChart_Title_MainForm=Excel Chart Export
+ExcelChart_Type_Area3D=Area 3D
+ExcelChart_Type_Area=Area
+ExcelChart_Type_AreaStacked3D=Area Stacked 3D
+ExcelChart_Type_AreaStacked=Area Stacked
+ExcelChart_Type_BarsClustered3D=Bars Clustered 3D
+ExcelChart_Type_BarsClustered=Bars Clustered
+ExcelChart_Type_BarsStacked3D=Bars Stacked 3D
+ExcelChart_Type_BarsStacked=Bars Stacked
+ExcelChart_Type_ColumnsClustered3D=Columns Clustered 3D
+ExcelChart_Type_ColumnsClustered=Columns Clustered
+ExcelChart_Type_ColumnsStacked3D=Columns Stacked 3D
+ExcelChart_Type_ColumnsStacked=Columns Stacked
+ExcelChart_Type_Line=Line
+ExcelChart_Type_LineStacked=Line Stacked
+ExcelChart_Type_Pie3D=Pie 3D
+ExcelChart_Type_Pie=Pie
+ExcelChart_Type_PieExploded3D=Pie Exploded 3D
+ExcelChart_Type_PieExploded=Pie exploded
+ExcelChart_Various_Averaged=averaged
+ExcelChart_Various_Column=\u884C
+ExcelChart_Various_Frequency=Frequency
+ExcelChart_Various_SummedUp=summed up
+ExcelChart_Various_Unknown=<Unknown>
+ExportDate=Export date
+ExtendedSearchAddAttributeMenu=\u52A0\u5165\u5E38\u6578
+ExtendedSearchAddEntityPrefix=\u6709
+ExtendedSearchAnd=\u548C
+ExtendedSearchEditAttributeMenu=\u7DE8\u8F2F
+ExtendedSearchEntitySuffix=\u7528
+ExtendedSearchNegateMenu=\u7121\u6548
+ExtendedSearchRemoveAttributeMenu=\u79FB\u9664
+ExtendedSearchRemoveMenu=\u79FB\u9664
+FileExistsOwerwriteQuestion=\u9078\u64C7\u7684\u6A94\u6848\u5DF2\u7D93\u5B58\u5728,\u8981\u8986\u84CB\u55CE?
+FileName=\u6A94\u6848\u540D\u7A31
+FileNotFoundMessage=\u70BA\u7121\u6CD5\u767C\u73FE\u6A94\u6848
+FileNotFoundTitle=\u6A94\u6848\u4E0D\u5B58\u5728
+FilesOfType=\u6A94\u6848\u985E\u578B
+FormPrint=\u5217\u5370
+FormSaveChangesQuestion=\u8981\u5132\u5B58\u6539\u8B8A\u55CE
+FormStateLoad=\u4E0B\u8F09\u8CC7\u6599
+FormStateStore=\u5132\u5B58
+FormStateStoreAs=\u5132\u5B58\u70BA
+GlobalBookmarks=Global Bookmarks
+GlobalBookmarksAddMenu=Add to &global bookmarks
+Help=\u5E6B\u52A9
+IOErrorInfo=\u8ACB\u6AA2\u67E5\u6A94\u6848\u8207\u9023\u7DDA
+IOErrorText=\u901A\u8A0A\u932F\u8AA4
+IOErrorTitle=\u8B80/\u5BEB\u932F\u8AA4
+Info=\u8CC7\u8A0A
+Interrupted=\u4E2D\u65B7
+InterruptedErrorText=\u8655\u7406\u7A0B\u5E8F\u5DF2\u7D93\u624B\u52D5\u53D6\u6D88
+InterruptedErrorTitle=\u7A0B\u5E8F\u88AB\u53D6\u6D88
+JavaVMVersion=Java VM
+Language=\u8A9E\u8A00
+LoadFormXmlFailedText=\u6A94\u6848\u8207\u5C0D\u8A71\u4E0D\u76F8\u5BB9
+LogicDateIsInDays=is in exactly (days)
+LogicDateIsInGEDays=is earliest in (days)
+LogicDateIsInGEMonths=is earliest in (months)
+LogicDateIsInLEDays=is latest in (days)
+LogicDateIsInLEMonths=is latest in (months)
+LogicDateIsInLastDays=\u5728\u904E\u53BB\u5E7E\u5929
+LogicDateIsInLastMonths=was in last n Months
+LogicDateIsInMonths=\u662F\u5728\u6B63\u78BA\u7684 (\u6708\u4EFD)
+LogicDateIsInNextDays=was in next n days
+LogicDateIsInNextMonths=was in next n Months
+LogicDateIsNotToday=is not today
+LogicDateIsToday=is today
+LogicDateTimeIsInGEHours=is earliest in (hours)
+LogicDateTimeIsInGEMinutes=is earliest in (minutes)
+LogicDateTimeIsInLEHours=is latest in (hours)
+LogicDateTimeIsInLEMinutes=is latest in (minutes)
+LogicDateTimeIsNotNow=is not now
+LogicDateTimeIsNow=is now
+LogicEQ=\=
+LogicEndsWith=Ends with
+LogicGE=>\=
+LogicGT=>
+LogicIn=Is
+LogicLE=<\=
+LogicLT=<
+LogicLike=\u5305\u62EC
+LogicNEQ=<>
+LogicNotIn=\u4E0D\u662F
+LogicNotLike=\u4E0D\u5305\u62EC
+LogicNotNull=\u4E0D\u7A7A\u767D
+LogicNull=\u7A7A\u767D
+LogicStartsWith=\u4EE5..\u958B\u59CB
+LogicTimeIsInGEHours=is earliest in (hours)
+LogicTimeIsInGEMinutes=is earliest in (minutes)
+LogicTimeIsInHours=is in exactly (hours)
+LogicTimeIsInLEHours=is latest in (hours)
+LogicTimeIsInLEMinutes=is latest in (minutes)
+LogicTimeIsInMinutes=\u662F\u6B63\u78BA\u7684(\u5206\u9418)
+LogicTimeIsNotNow=is not now
+LogicTimeIsNow=is now
+Login=Login
+LookIn=Look in
+Month=\u6708
+Name=\u540D\u5B57
+NetErrorInfo=\u8ACB\u78BA\u8A8D\u4F3A\u670D\u5668\u540D\u7A31,\u7DB2\u5740\u548C\u9023\u7DDA
+NetErrorText=\u627E\u4E0D\u5230\u4F3A\u670D\u5668
+NetErrorTitle=\u7DB2\u8DEF\u932F\u8AA4
+NewPassword=\u65B0\u5BC6\u78BC
+No=\u4E0D
+NoButton=&No
+NumberOfRows=\u8A08\u7B97\u5217\u6578
+OSUser=System User
+OSVersion=System Version
+Ok=Ok
+OkButton=&Ok
+OkButtonTooltip=\u5132\u5B58\u4E26\u4E14\u7D50\u675F\u5C0D\u8A71
+OldPassword=\u820A\u5BC6\u78BC
+Op=Operator
+Open=\u6253\u958B
+Password=\u5BC6\u78BC
+PasswordsDoNotMatch=\u5169\u500B\u5BC6\u78BC\u4E0D\u76F8\u7B26
+Paste=Paste
+Path=\u8DEF\u5F91
+RepeatPassword=\u91CD\u8907
+ResetButton=&Reset
+ResetButtonTooltip=\u8A2D\u5B9A\u6240\u6709\u5C0D\u8A71\u6B04\u4F4D\u70BA\u7A7A\u767D
+Save=\u5132\u5B58
+SaveButton=&\u5132\u5B58
+SaveButtonTooltip=\u5132\u5B58\u5C0D\u8A71\u4E14\u4E0D\u95DC\u9589
+SearchButton=&\u627E\u5C0B
+SearchButtonTooltip=\u7D50\u675F\u5C0D\u8A71\u958B\u59CB\u627E\u5C0B
+SearchConstraints=\u627E\u5C0B\u5E38\u6578
+Server=\u4F3A\u670D\u5668
+SmartFindLabel=\u627E\u5C0B\u5167\u6587
+StatusExportDone=\u532F\u51FA\u5B8C\u6210
+Today=today
+TooManyRows=\u8CC7\u6599\u592A\u5927\u8ACB\u9650\u5236\u641C\u5C0B\u7BC4\u570D
+Update=\u66F4\u65B0
+UserInterrupted=\u88AB\u4F7F\u7528\u8005\u53D6\u6D88
+Username=\u4F7F\u7528\u8005\u59D3\u540D
+Value=\u6578\u503C
+Week=\u9031
+WeekShort=CW
+WizardCancelButton=\u53D6\u6D88
+WizardSuspendButton=&\u95DC\u9589
+WorkWeek=\u5DE5\u4F5C\u9031
+Yes=\u662F
+YesButton=&\u662F
+and=\u548C
+from=\u5F9E
+to=\u81F3
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/AbstractIcons.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/AbstractIcons.java
index 6577f47922..e4d6afb5e5 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/AbstractIcons.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/AbstractIcons.java
@@ -1,66 +1,66 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared;
-
-import java.io.Serializable;
-
-public abstract class AbstractIcons implements Serializable {
- private static final long serialVersionUID = 1L;
-
- protected AbstractIcons() {
- }
-
- /**
- * marker icon for 'no icon'
- */
- public static final String Null = "null";
-
- /**
- * marker icon for an empty (transparent white) icon
- */
- public static final String ApplicationLogo = "application_logo_large";
- public static final String Empty = "empty";
- public static final String Bookmark = "bookmark";
- public static final String ComposerFieldAggregation = "composerfield_aggregation";
- public static final String ComposerFieldAttribute = "composerfield_attribute";
- public static final String ComposerFieldEitherOrNode = "composerfield_eitheror";
- public static final String ComposerFieldEntity = "composerfield_entity";
- public static final String ComposerFieldRoot = "composerfield_root";
- public static final String DateFieldDate = "datefield_date";
- public static final String DateFieldTime = "datefield_time";
- public static final String FileChooserFieldFile = "filechooserfield_file";
- /**
- * Use {@link AbstractIcons#TreeNode} instead due to icon semantic
- */
- @Deprecated
- public static final String Folder = AbstractIcons.TreeNode;
- /**
- * Use {@link AbstractIcons#TreeNodeOpen} instead due to icon semantic
- */
- @Deprecated
- public static final String FolderOpen = AbstractIcons.TreeNodeOpen;
- public static final String Gears = "gears";
- public static final String NavigationCurrent = "navigation_current";
- public static final String SmartFieldBrowse = "smartfield_browse";
- public static final String StatusError = "status_error";
- public static final String StatusInfo = "status_info";
- public static final String StatusWarning = "status_warning";
- public static final String TableColumnFilterActive = "table_column_filter_active";
- public static final String TableCustomColumn = "table_custom_column";
- public static final String TableSortAsc = "table_sort_asc";
- public static final String TableSortDesc = "table_sort_desc";
- public static final String TreeNode = "tree_node";
- public static final String TreeNodeOpen = "tree_node_open";
- public static final String WizardBackButton = "wizard_back";
- public static final String WizardBullet = "wizard_bullet";
- public static final String WizardNextButton = "wizard_next";
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared;
+
+import java.io.Serializable;
+
+public abstract class AbstractIcons implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ protected AbstractIcons() {
+ }
+
+ /**
+ * marker icon for 'no icon'
+ */
+ public static final String Null = "null";
+
+ /**
+ * marker icon for an empty (transparent white) icon
+ */
+ public static final String ApplicationLogo = "application_logo_large";
+ public static final String Empty = "empty";
+ public static final String Bookmark = "bookmark";
+ public static final String ComposerFieldAggregation = "composerfield_aggregation";
+ public static final String ComposerFieldAttribute = "composerfield_attribute";
+ public static final String ComposerFieldEitherOrNode = "composerfield_eitheror";
+ public static final String ComposerFieldEntity = "composerfield_entity";
+ public static final String ComposerFieldRoot = "composerfield_root";
+ public static final String DateFieldDate = "datefield_date";
+ public static final String DateFieldTime = "datefield_time";
+ public static final String FileChooserFieldFile = "filechooserfield_file";
+ /**
+ * Use {@link AbstractIcons#TreeNode} instead due to icon semantic
+ */
+ @Deprecated
+ public static final String Folder = AbstractIcons.TreeNode;
+ /**
+ * Use {@link AbstractIcons#TreeNodeOpen} instead due to icon semantic
+ */
+ @Deprecated
+ public static final String FolderOpen = AbstractIcons.TreeNodeOpen;
+ public static final String Gears = "gears";
+ public static final String NavigationCurrent = "navigation_current";
+ public static final String SmartFieldBrowse = "smartfield_browse";
+ public static final String StatusError = "status_error";
+ public static final String StatusInfo = "status_info";
+ public static final String StatusWarning = "status_warning";
+ public static final String TableColumnFilterActive = "table_column_filter_active";
+ public static final String TableCustomColumn = "table_custom_column";
+ public static final String TableSortAsc = "table_sort_asc";
+ public static final String TableSortDesc = "table_sort_desc";
+ public static final String TreeNode = "tree_node";
+ public static final String TreeNodeOpen = "tree_node_open";
+ public static final String WizardBackButton = "wizard_back";
+ public static final String WizardBullet = "wizard_bullet";
+ public static final String WizardNextButton = "wizard_next";
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/Activator.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/Activator.java
index 1bf86a758f..da71a7ed1c 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/Activator.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/Activator.java
@@ -1,45 +1,45 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared;
-
-import org.eclipse.core.runtime.Plugin;
-import org.osgi.framework.BundleContext;
-
-public class Activator extends Plugin {
- public static final String PLUGIN_ID = "org.eclipse.scout.rt.shared";
- private static Activator plugin;
-
- public static Activator getDefault() {
- return plugin;
- }
-
- /*
- * (non-Javadoc)
- * @see
- * org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
- */
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- // TestService.main(null);
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+public class Activator extends Plugin {
+ public static final String PLUGIN_ID = "org.eclipse.scout.rt.shared";
+ private static Activator plugin;
+
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
+ * org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ // TestService.main(null);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/ContextMap.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/ContextMap.java
index 3135bb7206..9432865cb4 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/ContextMap.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/ContextMap.java
@@ -1,75 +1,75 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared;
-
-import java.util.TreeMap;
-
-import org.eclipse.scout.commons.StringUtility;
-
-/**
- * @since 11.06.2008
- */
-public class ContextMap extends TreeMap<String, Object> {
- private static final long serialVersionUID = 1L;
-
- // Needed for get to be compatible with TreeMap<String, Long>.get
- public Long get(String key) {
- return (Long) super.get(key);
- }
-
- // Whenever we need an object not of type Long, we need to explicitly pass the
- // desired class
- @SuppressWarnings("unchecked")
- public <T> T get(String key, Class<T> cls) {
- return (T) super.get(key);
- }
-
- public ContextMap copy() {
- ContextMap cm = new ContextMap();
- cm.putAll(this);
- return cm;
- }
-
- @Override
- public Object put(String key, Object value) {
- if (value == null) {
- return value;
- }
- else if (value instanceof String) {
- if (StringUtility.hasText((String) value)) {
- super.put(key, value);
- }
- else if (!super.containsKey(key)) {
- // put an empty String only, if the value had not been set yet
- super.put(key, value);
- }
- }
- else if (value instanceof Long) {
- if ((Long) value != 0L) {
- super.put(key, value);
- }
- else if (!super.containsKey(key)) {
- // put a numeric "0" only, if the value had not been set yet
- super.put(key, value);
- }
- }
- else {
- super.put(key, value);
- }
- return value;
- }
-
- public ContextMap copyPut(String key, Object value) {
- ContextMap cm = copy();
- cm.put(key, value);
- return cm;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared;
+
+import java.util.TreeMap;
+
+import org.eclipse.scout.commons.StringUtility;
+
+/**
+ * @since 11.06.2008
+ */
+public class ContextMap extends TreeMap<String, Object> {
+ private static final long serialVersionUID = 1L;
+
+ // Needed for get to be compatible with TreeMap<String, Long>.get
+ public Long get(String key) {
+ return (Long) super.get(key);
+ }
+
+ // Whenever we need an object not of type Long, we need to explicitly pass the
+ // desired class
+ @SuppressWarnings("unchecked")
+ public <T> T get(String key, Class<T> cls) {
+ return (T) super.get(key);
+ }
+
+ public ContextMap copy() {
+ ContextMap cm = new ContextMap();
+ cm.putAll(this);
+ return cm;
+ }
+
+ @Override
+ public Object put(String key, Object value) {
+ if (value == null) {
+ return value;
+ }
+ else if (value instanceof String) {
+ if (StringUtility.hasText((String) value)) {
+ super.put(key, value);
+ }
+ else if (!super.containsKey(key)) {
+ // put an empty String only, if the value had not been set yet
+ super.put(key, value);
+ }
+ }
+ else if (value instanceof Long) {
+ if ((Long) value != 0L) {
+ super.put(key, value);
+ }
+ else if (!super.containsKey(key)) {
+ // put a numeric "0" only, if the value had not been set yet
+ super.put(key, value);
+ }
+ }
+ else {
+ super.put(key, value);
+ }
+ return value;
+ }
+
+ public ContextMap copyPut(String key, Object value) {
+ ContextMap cm = copy();
+ cm.put(key, value);
+ return cm;
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/ISession.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/ISession.java
index c5561e81c2..d0d9fd881d 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/ISession.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/ISession.java
@@ -1,67 +1,67 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared;
-
-import java.util.Locale;
-import java.util.Map;
-
-import org.eclipse.scout.commons.annotations.FormData;
-import org.eclipse.scout.rt.shared.ui.UserAgent;
-import org.osgi.framework.Bundle;
-
-/**
- * @since 3.8.0
- */
-public interface ISession {
-
- Bundle getBundle();
-
- /**
- * Shared context variable containing the authenticated userId in lowercase
- */
- @FormData
- String getUserId();
-
- /**
- * @returns the reference to the immutable shared variable map
- */
- Map<String, Object> getSharedVariableMap();
-
- /**
- * Returns true if the session has been loaded and is running.
- */
- boolean isActive();
-
- ScoutTexts getTexts();
-
- /**
- * @return Returns the session's locale.
- */
- Locale getLocale();
-
- /**
- * Sets the session's locale used for formatting values and for translating texts.
- */
- void setLocale(Locale l);
-
- UserAgent getUserAgent();
-
- void setUserAgent(UserAgent userAgent);
-
- /**
- * Used to force immediate (in-thread) execution of jobs.
- */
- boolean isSingleThreadSession();
-
- Object getData(String key);
-
- void setData(String key, Object value);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared;
+
+import java.util.Locale;
+import java.util.Map;
+
+import org.eclipse.scout.commons.annotations.FormData;
+import org.eclipse.scout.rt.shared.ui.UserAgent;
+import org.osgi.framework.Bundle;
+
+/**
+ * @since 3.8.0
+ */
+public interface ISession {
+
+ Bundle getBundle();
+
+ /**
+ * Shared context variable containing the authenticated userId in lowercase
+ */
+ @FormData
+ String getUserId();
+
+ /**
+ * @returns the reference to the immutable shared variable map
+ */
+ Map<String, Object> getSharedVariableMap();
+
+ /**
+ * Returns true if the session has been loaded and is running.
+ */
+ boolean isActive();
+
+ ScoutTexts getTexts();
+
+ /**
+ * @return Returns the session's locale.
+ */
+ Locale getLocale();
+
+ /**
+ * Sets the session's locale used for formatting values and for translating texts.
+ */
+ void setLocale(Locale l);
+
+ UserAgent getUserAgent();
+
+ void setUserAgent(UserAgent userAgent);
+
+ /**
+ * Used to force immediate (in-thread) execution of jobs.
+ */
+ boolean isSingleThreadSession();
+
+ Object getData(String key);
+
+ void setData(String key, Object value);
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/OfficialVersion.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/OfficialVersion.java
index 34518e18c8..ea5c8efcd8 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/OfficialVersion.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/OfficialVersion.java
@@ -1,26 +1,26 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared;
-
-import java.util.Calendar;
-
-public final class OfficialVersion {
-
- private OfficialVersion() {
- }
-
- public static final String VERSION = "3.5.2";
-
- public static final String COPYRIGHT = "Scout " + VERSION + ", &copy; BSI Business Systems Integration AG " + 2001 + "," + Calendar.getInstance().get(Calendar.YEAR) + " EPL";
-
- public static String customCopyrightText;
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared;
+
+import java.util.Calendar;
+
+public final class OfficialVersion {
+
+ private OfficialVersion() {
+ }
+
+ public static final String VERSION = "3.5.2";
+
+ public static final String COPYRIGHT = "Scout " + VERSION + ", &copy; BSI Business Systems Integration AG " + 2001 + "," + Calendar.getInstance().get(Calendar.YEAR) + " EPL";
+
+ public static String customCopyrightText;
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/OfflineState.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/OfflineState.java
index 39914659f9..2c4b16a1a2 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/OfflineState.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/OfflineState.java
@@ -1,64 +1,64 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared;
-
-import org.eclipse.scout.service.IService;
-
-/**
- * Indicates whether the osgi is running in offline mode or online mode
- * <p>
- * see {@link IService} for description of this indicator class
- */
-public final class OfflineState {
- private static boolean defaultValue = false;
- private static final ThreadLocal<Boolean> THREAD_LOCAL = new ThreadLocal<Boolean>();
-
- private OfflineState() {
- }
-
- public static boolean isOfflineDefault() {
- return defaultValue;
- }
-
- public static boolean isOnlineDefault() {
- return !isOfflineDefault();
- }
-
- /**
- * Sets the default state. Thread-specific values {@link #setOfflineInCurrentThread()} are not changed by this method.
- */
- public static void setOfflineDefault(boolean b) {
- defaultValue = b;
- }
-
- public static boolean isOfflineInCurrentThread() {
- Boolean var = THREAD_LOCAL.get();
- if (var != null) {
- return var.booleanValue();
- }
- else {
- return isOfflineDefault();
- }
- }
-
- public static boolean isOnlineInCurrentThread() {
- return !isOfflineInCurrentThread();
- }
-
- /**
- * @param b
- * true, false, null null clears the thread-specific value and uses
- * the default of {@link #isOfflineDefault()}
- */
- public static void setOfflineInCurrentThread(Boolean b) {
- THREAD_LOCAL.set(b);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared;
+
+import org.eclipse.scout.service.IService;
+
+/**
+ * Indicates whether the osgi is running in offline mode or online mode
+ * <p>
+ * see {@link IService} for description of this indicator class
+ */
+public final class OfflineState {
+ private static boolean defaultValue = false;
+ private static final ThreadLocal<Boolean> THREAD_LOCAL = new ThreadLocal<Boolean>();
+
+ private OfflineState() {
+ }
+
+ public static boolean isOfflineDefault() {
+ return defaultValue;
+ }
+
+ public static boolean isOnlineDefault() {
+ return !isOfflineDefault();
+ }
+
+ /**
+ * Sets the default state. Thread-specific values {@link #setOfflineInCurrentThread()} are not changed by this method.
+ */
+ public static void setOfflineDefault(boolean b) {
+ defaultValue = b;
+ }
+
+ public static boolean isOfflineInCurrentThread() {
+ Boolean var = THREAD_LOCAL.get();
+ if (var != null) {
+ return var.booleanValue();
+ }
+ else {
+ return isOfflineDefault();
+ }
+ }
+
+ public static boolean isOnlineInCurrentThread() {
+ return !isOfflineInCurrentThread();
+ }
+
+ /**
+ * @param b
+ * true, false, null null clears the thread-specific value and uses
+ * the default of {@link #isOfflineDefault()}
+ */
+ public static void setOfflineInCurrentThread(Boolean b) {
+ THREAD_LOCAL.set(b);
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/ScoutTexts.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/ScoutTexts.java
index 7b2291ead2..455be5884e 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/ScoutTexts.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/ScoutTexts.java
@@ -1,104 +1,104 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared;
-
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-
-import org.eclipse.core.runtime.QualifiedName;
-import org.eclipse.scout.rt.shared.services.common.text.ITextProviderService;
-import org.eclipse.scout.service.SERVICES;
-
-/**
- * This is the base class for translations access in scout applications.<br>
- * It provides prioritized access to all text services available to the scope.
- *
- * @see IClientSession#getNlsTexts()
- * @see IServerSession#getNlsTexts()
- * @see ClientJob
- * @see ServerJob
- * @see ITextProviderService
- */
-public class ScoutTexts {
-
- /**
- * Jop property name tha can be used when Texts should be used in associated contexts such as swt display, rwt display
- * etc.
- */
- public static final QualifiedName JOB_PROPERTY_NAME = new QualifiedName(ScoutTexts.class.getName(), "ref");
-
- private static final ScoutTexts defaultInstance = new ScoutTexts();
-
- private final ITextProviderService[] m_textProviders;
-
- public ScoutTexts() {
- this(SERVICES.getServices(ITextProviderService.class));
- }
-
- public ScoutTexts(ITextProviderService[] textProviders) {
- m_textProviders = textProviders;
- }
-
- public static String get(String key, String... messageArguments) {
- return getInstance().getText(key, messageArguments);
- }
-
- public static String get(Locale locale, String key, String... messageArguments) {
- return getInstance().getText(locale, key, messageArguments);
- }
-
- /**
- * Queries {@link TextsThreadLocal#get()}. If this one is null, then the default
- * instance is used as global default. That way applications can override scout texts in their
- * application sessions, without interfering with other scout applications in the same osgi/eclipse runtime.
- *
- * @return the <code>ScoutTexts</code> instance to use in current scope.
- */
- public static ScoutTexts getInstance() {
- ScoutTexts t = TextsThreadLocal.get();
- if (t == null) {
- t = defaultInstance;
- }
- return t;
- }
-
- public final String getText(String key, String... messageArguments) {
- return getText(null, key, messageArguments);
- }
-
- public final String getText(Locale locale, String key, String... messageArguments) {
- return getTextInternal(locale, key, messageArguments);
- }
-
- public Map<String, String> getTextMap(Locale locale) {
- HashMap<String, String> map = new HashMap<String, String>();
- ITextProviderService[] providers = getTextProviders();
- for (int i = providers.length - 1; i >= 0; i--) {
- map.putAll(providers[i].getTextMap(locale));
- }
- return map;
- }
-
- protected ITextProviderService[] getTextProviders() {
- return m_textProviders;
- }
-
- protected String getTextInternal(Locale locale, String key, String... messageArguments) {
- for (ITextProviderService provider : getTextProviders()) {
- String result = provider.getText(locale, key, messageArguments);
- if (result != null) {
- return result;
- }
- }
- return "{undefined text " + key + "}";
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared;
+
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+
+import org.eclipse.core.runtime.QualifiedName;
+import org.eclipse.scout.rt.shared.services.common.text.ITextProviderService;
+import org.eclipse.scout.service.SERVICES;
+
+/**
+ * This is the base class for translations access in scout applications.<br>
+ * It provides prioritized access to all text services available to the scope.
+ *
+ * @see IClientSession#getNlsTexts()
+ * @see IServerSession#getNlsTexts()
+ * @see ClientJob
+ * @see ServerJob
+ * @see ITextProviderService
+ */
+public class ScoutTexts {
+
+ /**
+ * Jop property name tha can be used when Texts should be used in associated contexts such as swt display, rwt display
+ * etc.
+ */
+ public static final QualifiedName JOB_PROPERTY_NAME = new QualifiedName(ScoutTexts.class.getName(), "ref");
+
+ private static final ScoutTexts defaultInstance = new ScoutTexts();
+
+ private final ITextProviderService[] m_textProviders;
+
+ public ScoutTexts() {
+ this(SERVICES.getServices(ITextProviderService.class));
+ }
+
+ public ScoutTexts(ITextProviderService[] textProviders) {
+ m_textProviders = textProviders;
+ }
+
+ public static String get(String key, String... messageArguments) {
+ return getInstance().getText(key, messageArguments);
+ }
+
+ public static String get(Locale locale, String key, String... messageArguments) {
+ return getInstance().getText(locale, key, messageArguments);
+ }
+
+ /**
+ * Queries {@link TextsThreadLocal#get()}. If this one is null, then the default
+ * instance is used as global default. That way applications can override scout texts in their
+ * application sessions, without interfering with other scout applications in the same osgi/eclipse runtime.
+ *
+ * @return the <code>ScoutTexts</code> instance to use in current scope.
+ */
+ public static ScoutTexts getInstance() {
+ ScoutTexts t = TextsThreadLocal.get();
+ if (t == null) {
+ t = defaultInstance;
+ }
+ return t;
+ }
+
+ public final String getText(String key, String... messageArguments) {
+ return getText(null, key, messageArguments);
+ }
+
+ public final String getText(Locale locale, String key, String... messageArguments) {
+ return getTextInternal(locale, key, messageArguments);
+ }
+
+ public Map<String, String> getTextMap(Locale locale) {
+ HashMap<String, String> map = new HashMap<String, String>();
+ ITextProviderService[] providers = getTextProviders();
+ for (int i = providers.length - 1; i >= 0; i--) {
+ map.putAll(providers[i].getTextMap(locale));
+ }
+ return map;
+ }
+
+ protected ITextProviderService[] getTextProviders() {
+ return m_textProviders;
+ }
+
+ protected String getTextInternal(Locale locale, String key, String... messageArguments) {
+ for (ITextProviderService provider : getTextProviders()) {
+ String result = provider.getText(locale, key, messageArguments);
+ if (result != null) {
+ return result;
+ }
+ }
+ return "{undefined text " + key + "}";
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/TEXTS.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/TEXTS.java
index 54733f0ed6..37e7d14a4c 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/TEXTS.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/TEXTS.java
@@ -1,79 +1,79 @@
-package org.eclipse.scout.rt.shared;
-
-import java.util.Locale;
-
-import org.eclipse.scout.commons.LocaleThreadLocal;
-import org.eclipse.scout.commons.nls.NlsUtility;
-
-public class TEXTS {
-
- /**
- * Gets the translation for the given key and the default locale.<br>
- * The default locale is defined as the locale set on the current thread or <code>Locale.getLocale()</code> if the
- * thread locale is null.
- *
- * @param key
- * The nls text key
- * @return The translation.
- * @see ScoutTexts
- * @see NlsUtility
- * @see LocaleThreadLocal
- * @see Locale
- */
- public static String get(String key) {
- return ScoutTexts.getInstance().getText(key);
- }
-
- /**
- * Gets the translation for the given key and the default locale.<br>
- * The default locale is defined as the locale set on the current thread or <code>Locale.getLocale()</code> if the
- * thread locale is null.<br>
- * The translation might contain variables like {0},{1},{2},... In that case, they are replaced with the given
- * argument list.<br>
- * Examples: <br>
- * <ul>
- * <li>TEXTS.get("MissingFile1"); with MissingFile1="The File could not be found."</li>
- * <li>TEXTS.get("MissingFile2", fileName); with MissingFile2="The File {0} could not be found."</li>
- * <li>TEXTS.get("MissingFile3", fileName, dir); with MissingFile3="The File {0} in Folder {1} could not be found."</li>
- * </ul>
- *
- * @param key
- * The nls text key
- * @param messageArguments
- * The arguments (can be null) to replace in the returned text.
- * @return
- * @see ScoutTexts
- * @see NlsUtility
- * @see LocaleThreadLocal
- * @see Locale
- */
- public static String get(String key, String... messageArguments) {
- return ScoutTexts.getInstance().getText(key, messageArguments);
- }
-
- /**
- * Gets the translation for the given key and locale.<br>
- * The translation might contain variables like {0},{1},{2},... In that case, they are replaced with the given
- * argument list.<br>
- * Examples: <br>
- * <ul>
- * <li>TEXTS.get(locale, "MissingFile1"); with MissingFile1="The File could not be found."</li>
- * <li>TEXTS.get(locale, "MissingFile2", fileName); with MissingFile2="The File {0} could not be found."</li>
- * <li>TEXTS.get(locale, "MissingFile3", fileName, dir); with
- * MissingFile3="The File {0} in Folder {1} could not be found."</li>
- * </ul>
- *
- * @param locale
- * The locale of the text
- * @param key
- * The nls text key
- * @param messageArguments
- * The arguments (can be null) to replace in the returned text.
- * @return
- * @see ScoutTexts
- * @see Locale
- */
- public static String get(Locale locale, String key, String... messageArguments) {
- return ScoutTexts.getInstance().getText(locale, key, messageArguments);
- }
-}
+package org.eclipse.scout.rt.shared;
+
+import java.util.Locale;
+
+import org.eclipse.scout.commons.LocaleThreadLocal;
+import org.eclipse.scout.commons.nls.NlsUtility;
+
+public class TEXTS {
+
+ /**
+ * Gets the translation for the given key and the default locale.<br>
+ * The default locale is defined as the locale set on the current thread or <code>Locale.getLocale()</code> if the
+ * thread locale is null.
+ *
+ * @param key
+ * The nls text key
+ * @return The translation.
+ * @see ScoutTexts
+ * @see NlsUtility
+ * @see LocaleThreadLocal
+ * @see Locale
+ */
+ public static String get(String key) {
+ return ScoutTexts.getInstance().getText(key);
+ }
+
+ /**
+ * Gets the translation for the given key and the default locale.<br>
+ * The default locale is defined as the locale set on the current thread or <code>Locale.getLocale()</code> if the
+ * thread locale is null.<br>
+ * The translation might contain variables like {0},{1},{2},... In that case, they are replaced with the given
+ * argument list.<br>
+ * Examples: <br>
+ * <ul>
+ * <li>TEXTS.get("MissingFile1"); with MissingFile1="The File could not be found."</li>
+ * <li>TEXTS.get("MissingFile2", fileName); with MissingFile2="The File {0} could not be found."</li>
+ * <li>TEXTS.get("MissingFile3", fileName, dir); with MissingFile3="The File {0} in Folder {1} could not be found."</li>
+ * </ul>
+ *
+ * @param key
+ * The nls text key
+ * @param messageArguments
+ * The arguments (can be null) to replace in the returned text.
+ * @return
+ * @see ScoutTexts
+ * @see NlsUtility
+ * @see LocaleThreadLocal
+ * @see Locale
+ */
+ public static String get(String key, String... messageArguments) {
+ return ScoutTexts.getInstance().getText(key, messageArguments);
+ }
+
+ /**
+ * Gets the translation for the given key and locale.<br>
+ * The translation might contain variables like {0},{1},{2},... In that case, they are replaced with the given
+ * argument list.<br>
+ * Examples: <br>
+ * <ul>
+ * <li>TEXTS.get(locale, "MissingFile1"); with MissingFile1="The File could not be found."</li>
+ * <li>TEXTS.get(locale, "MissingFile2", fileName); with MissingFile2="The File {0} could not be found."</li>
+ * <li>TEXTS.get(locale, "MissingFile3", fileName, dir); with
+ * MissingFile3="The File {0} in Folder {1} could not be found."</li>
+ * </ul>
+ *
+ * @param locale
+ * The locale of the text
+ * @param key
+ * The nls text key
+ * @param messageArguments
+ * The arguments (can be null) to replace in the returned text.
+ * @return
+ * @see ScoutTexts
+ * @see Locale
+ */
+ public static String get(Locale locale, String key, String... messageArguments) {
+ return ScoutTexts.getInstance().getText(locale, key, messageArguments);
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/TextsThreadLocal.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/TextsThreadLocal.java
index 3ea3e47d01..f7bf30ae48 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/TextsThreadLocal.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/TextsThreadLocal.java
@@ -1,30 +1,30 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared;
-
-/**
- * This class represents the nls texts set for the current thread
- */
-public class TextsThreadLocal {
- private static ThreadLocal<ScoutTexts> textsThreadLocal = new ThreadLocal<ScoutTexts>();
-
- private TextsThreadLocal() {
- }
-
- public static ScoutTexts get() {
- return textsThreadLocal.get();
- }
-
- public static void set(ScoutTexts t) {
- textsThreadLocal.set(t);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared;
+
+/**
+ * This class represents the nls texts set for the current thread
+ */
+public class TextsThreadLocal {
+ private static ThreadLocal<ScoutTexts> textsThreadLocal = new ThreadLocal<ScoutTexts>();
+
+ private TextsThreadLocal() {
+ }
+
+ public static ScoutTexts get() {
+ return textsThreadLocal.get();
+ }
+
+ public static void set(ScoutTexts t) {
+ textsThreadLocal.set(t);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/TierState.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/TierState.java
index 92ab150474..9298abb880 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/TierState.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/TierState.java
@@ -1,78 +1,78 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.scout.service.IService;
-
-/**
- * Indicates whether the osgi is running in back-end, front-end or undetermined
- * <p>
- * see {@link IService} for description of this indicator
- * <p>
- * When scout.osgi.tier is not set, the default value is automatically determined.
- * <ul>
- * <li>exists(org.eclipse.scout.rt.ui.swing) or exists(org.eclipse.scout.rt.ui.swt) -&gt; FrontEnd</li>
- * <li>exists(org.eclipse.scout.rt.client) and not exists(org.eclipse.scout.rt.server) -&gt; FrontEnd</li>
- * <li>not exists(org.eclipse.scout.rt.ui.swing) and not exists(org.eclipse.scout.rt.ui.swt) and not
- * exists(org.eclipse.scout.rt.client) and exists(org.eclipse.scout.rt.server)-&gt; BackEnd</li>
- * <li>all other cases -&gt; Undefined</li>
- * </ul>
- */
-public final class TierState {
- private static final Tier VALUE;
-
- static {
- String s;
- if (Activator.getDefault() != null) {
- s = Activator.getDefault().getBundle().getBundleContext().getProperty("scout.osgi.tier");
- }
- else {
- s = System.getProperty("scout.osgi.tier");
- }
- if ("frontend".equals(s)) {
- VALUE = Tier.FrontEnd;
- }
- else if ("backend".equals(s)) {
- VALUE = Tier.BackEnd;
- }
- else {
- //auto detect
- boolean hasClient = Platform.getBundle("org.eclipse.scout.rt.client") != null;
- boolean hasServer = Platform.getBundle("org.eclipse.scout.rt.server") != null;
- boolean hasSwing = Platform.getBundle("org.eclipse.scout.rt.ui.swing") != null;
- boolean hasSwt = Platform.getBundle("org.eclipse.scout.rt.ui.swt") != null;
- if (hasSwing || hasSwt) {
- VALUE = Tier.FrontEnd;
- }
- else if (hasClient && !hasServer) {
- VALUE = Tier.FrontEnd;
- }
- else if (hasServer && !hasClient && !hasSwing && !hasSwt) {
- VALUE = Tier.BackEnd;
- }
- else {
- VALUE = Tier.Undefined;
- }
- }
- }
-
- public static enum Tier {
- FrontEnd, BackEnd, Undefined
- }
-
- private TierState() {
- }
-
- public static Tier get() {
- return VALUE;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.scout.service.IService;
+
+/**
+ * Indicates whether the osgi is running in back-end, front-end or undetermined
+ * <p>
+ * see {@link IService} for description of this indicator
+ * <p>
+ * When scout.osgi.tier is not set, the default value is automatically determined.
+ * <ul>
+ * <li>exists(org.eclipse.scout.rt.ui.swing) or exists(org.eclipse.scout.rt.ui.swt) -&gt; FrontEnd</li>
+ * <li>exists(org.eclipse.scout.rt.client) and not exists(org.eclipse.scout.rt.server) -&gt; FrontEnd</li>
+ * <li>not exists(org.eclipse.scout.rt.ui.swing) and not exists(org.eclipse.scout.rt.ui.swt) and not
+ * exists(org.eclipse.scout.rt.client) and exists(org.eclipse.scout.rt.server)-&gt; BackEnd</li>
+ * <li>all other cases -&gt; Undefined</li>
+ * </ul>
+ */
+public final class TierState {
+ private static final Tier VALUE;
+
+ static {
+ String s;
+ if (Activator.getDefault() != null) {
+ s = Activator.getDefault().getBundle().getBundleContext().getProperty("scout.osgi.tier");
+ }
+ else {
+ s = System.getProperty("scout.osgi.tier");
+ }
+ if ("frontend".equals(s)) {
+ VALUE = Tier.FrontEnd;
+ }
+ else if ("backend".equals(s)) {
+ VALUE = Tier.BackEnd;
+ }
+ else {
+ //auto detect
+ boolean hasClient = Platform.getBundle("org.eclipse.scout.rt.client") != null;
+ boolean hasServer = Platform.getBundle("org.eclipse.scout.rt.server") != null;
+ boolean hasSwing = Platform.getBundle("org.eclipse.scout.rt.ui.swing") != null;
+ boolean hasSwt = Platform.getBundle("org.eclipse.scout.rt.ui.swt") != null;
+ if (hasSwing || hasSwt) {
+ VALUE = Tier.FrontEnd;
+ }
+ else if (hasClient && !hasServer) {
+ VALUE = Tier.FrontEnd;
+ }
+ else if (hasServer && !hasClient && !hasSwing && !hasSwt) {
+ VALUE = Tier.BackEnd;
+ }
+ else {
+ VALUE = Tier.Undefined;
+ }
+ }
+ }
+
+ public static enum Tier {
+ FrontEnd, BackEnd, Undefined
+ }
+
+ private TierState() {
+ }
+
+ public static Tier get() {
+ return VALUE;
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/WebClientState.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/WebClientState.java
index e0a578775b..a56db3adb8 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/WebClientState.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/WebClientState.java
@@ -1,75 +1,75 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared;
-
-import org.eclipse.scout.rt.shared.ui.UserAgentUtility;
-
-/**
- * Indicates whether the client is a web-client or a rich-standalone-client
- * <p>
- *
- * @deprecated Use {@link UserAgentUtility} instead.
- */
-@Deprecated
-public final class WebClientState {
- private static boolean defaultValue = false;
- private static final ThreadLocal<Boolean> THREAD_LOCAL = new ThreadLocal<Boolean>();
-
- private WebClientState() {
- }
-
- public static boolean isWebClientDefault() {
- return defaultValue;
- }
-
- public static boolean isRichClientDefault() {
- return !isWebClientDefault();
- }
-
- /**
- * Sets the default state. Thread-specific values {@link #setWebClientInCurrentThread()} are not changed by this
- * method.
- */
- public static void setWebClientDefault(boolean b) {
- defaultValue = b;
- }
-
- public static boolean isWebClientInCurrentThread() {
- Boolean var = THREAD_LOCAL.get();
- if (var != null) {
- return var.booleanValue();
- }
- else {
- return isWebClientDefault();
- }
- }
-
- public static boolean isRichClientInCurrentThread() {
- return !isWebClientInCurrentThread();
- }
-
- /**
- * @param b
- * true, false, null <br>
- * null clears the thread-specific value and uses
- * the default of {@link #isWebClientDefault()}
- */
- public static void setWebClientInCurrentThread(Boolean b) {
- THREAD_LOCAL.set(b);
- }
-
- public static String getFontSizeUnit() {
- if (isWebClientInCurrentThread()) {
- return "px";
- }
- return "pt";
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared;
+
+import org.eclipse.scout.rt.shared.ui.UserAgentUtility;
+
+/**
+ * Indicates whether the client is a web-client or a rich-standalone-client
+ * <p>
+ *
+ * @deprecated Use {@link UserAgentUtility} instead.
+ */
+@Deprecated
+public final class WebClientState {
+ private static boolean defaultValue = false;
+ private static final ThreadLocal<Boolean> THREAD_LOCAL = new ThreadLocal<Boolean>();
+
+ private WebClientState() {
+ }
+
+ public static boolean isWebClientDefault() {
+ return defaultValue;
+ }
+
+ public static boolean isRichClientDefault() {
+ return !isWebClientDefault();
+ }
+
+ /**
+ * Sets the default state. Thread-specific values {@link #setWebClientInCurrentThread()} are not changed by this
+ * method.
+ */
+ public static void setWebClientDefault(boolean b) {
+ defaultValue = b;
+ }
+
+ public static boolean isWebClientInCurrentThread() {
+ Boolean var = THREAD_LOCAL.get();
+ if (var != null) {
+ return var.booleanValue();
+ }
+ else {
+ return isWebClientDefault();
+ }
+ }
+
+ public static boolean isRichClientInCurrentThread() {
+ return !isWebClientInCurrentThread();
+ }
+
+ /**
+ * @param b
+ * true, false, null <br>
+ * null clears the thread-specific value and uses
+ * the default of {@link #isWebClientDefault()}
+ */
+ public static void setWebClientInCurrentThread(Boolean b) {
+ THREAD_LOCAL.set(b);
+ }
+
+ public static String getFontSizeUnit() {
+ if (isWebClientInCurrentThread()) {
+ return "px";
+ }
+ return "pt";
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/basic/AffineTransformSpec.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/basic/AffineTransformSpec.java
index e750dd5e43..fe878405a0 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/basic/AffineTransformSpec.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/basic/AffineTransformSpec.java
@@ -1,44 +1,44 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.data.basic;
-
-import java.io.Serializable;
-
-public class AffineTransformSpec implements Serializable {
- private static final long serialVersionUID = 1L;
-
- public double dx = 0;
- public double dy = 0;
- public double sx = 1;
- public double sy = 1;
- public double angle = 0;
-
- public AffineTransformSpec() {
- }
-
- public AffineTransformSpec(double dx, double dy, double sx, double sy, double angle) {
- this.dx = dx;
- this.dy = dy;
- this.sx = sx;
- this.sy = sy;
- this.angle = angle;
- }
-
- public AffineTransformSpec(AffineTransformSpec o) {
- if (o != null) {
- this.dx = o.dx;
- this.dy = o.dy;
- this.sx = o.sx;
- this.sy = o.sy;
- this.angle = o.angle;
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.data.basic;
+
+import java.io.Serializable;
+
+public class AffineTransformSpec implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ public double dx = 0;
+ public double dy = 0;
+ public double sx = 1;
+ public double sy = 1;
+ public double angle = 0;
+
+ public AffineTransformSpec() {
+ }
+
+ public AffineTransformSpec(double dx, double dy, double sx, double sy, double angle) {
+ this.dx = dx;
+ this.dy = dy;
+ this.sx = sx;
+ this.sy = sy;
+ this.angle = angle;
+ }
+
+ public AffineTransformSpec(AffineTransformSpec o) {
+ if (o != null) {
+ this.dx = o.dx;
+ this.dy = o.dy;
+ this.sx = o.sx;
+ this.sy = o.sy;
+ this.angle = o.angle;
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/basic/BoundsSpec.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/basic/BoundsSpec.java
index 00e74bd9d9..876d0294e9 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/basic/BoundsSpec.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/basic/BoundsSpec.java
@@ -1,31 +1,31 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.data.basic;
-
-public class BoundsSpec implements java.io.Serializable {
- private static final long serialVersionUID = 1L;
-
- public int x;
- public int y;
- public int width;
- public int height;
-
- public BoundsSpec() {
-
- }
-
- public BoundsSpec(int x, int y, int width, int height) {
- this.x = x;
- this.y = y;
- this.width = width;
- this.height = height;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.data.basic;
+
+public class BoundsSpec implements java.io.Serializable {
+ private static final long serialVersionUID = 1L;
+
+ public int x;
+ public int y;
+ public int width;
+ public int height;
+
+ public BoundsSpec() {
+
+ }
+
+ public BoundsSpec(int x, int y, int width, int height) {
+ this.x = x;
+ this.y = y;
+ this.width = width;
+ this.height = height;
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/basic/FontSpec.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/basic/FontSpec.java
index e294e4ff9e..79b1ee3341 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/basic/FontSpec.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/basic/FontSpec.java
@@ -1,159 +1,159 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.data.basic;
-
-import java.util.StringTokenizer;
-
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-
-public class FontSpec implements java.io.Serializable {
- private static final long serialVersionUID = 1L;
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(FontSpec.class);
- public static final int STYLE_PLAIN = 0x00;
- public static final int STYLE_BOLD = 0x01;
- public static final int STYLE_ITALIC = 0x02;
-
- private final String m_name;
- private final int m_style;
- private final int m_size;
-
- public FontSpec(String name, int style, int size) {
- m_name = name;
- m_style = style;
- m_size = size;
- }
-
- public String toPattern() {
- return getName() + (isPlain() ? "-PLAIN" : "") + (isBold() ? "-BOLD" : "") + (isItalic() ? "-ITALIC" : "") + "-" + getSize();
- }
-
- public String getName() {
- return m_name;
- }
-
- public int getStyle() {
- return m_style;
- }
-
- public boolean isPlain() {
- return m_style == STYLE_PLAIN;
- }
-
- public boolean isBold() {
- return (m_style & STYLE_BOLD) != 0;
- }
-
- public boolean isItalic() {
- return (m_style & STYLE_ITALIC) != 0;
- }
-
- public int getSize() {
- return m_size;
- }
-
- // derivatives
- public FontSpec getPlainCopy() {
- return new FontSpec(m_name, STYLE_PLAIN, m_size);
- }
-
- public FontSpec getBoldCopy() {
- return new FontSpec(m_name, m_style | STYLE_BOLD, m_size);
- }
-
- public FontSpec getItalicCopy() {
- return new FontSpec(m_name, m_style | STYLE_ITALIC, m_size);
- }
-
- /**
- * Sample: Dialog-PLAIN-12
- */
- public static FontSpec parse(String pattern) {
- if (pattern == null || pattern.length() == 0) {
- return null;
- }
- else {
- String newName = null;
- int newStyle = STYLE_PLAIN;
- int newSize = 0;
-
- StringTokenizer tok = new StringTokenizer(pattern, " -_,/.;");
- while (tok.hasMoreTokens()) {
- String s = tok.nextToken().toUpperCase();
- // styles
- if (s.equals("PLAIN")) {
- // nop
- }
- else if (s.equals("BOLD")) {
- newStyle = newStyle | STYLE_BOLD;
- }
- else if (s.equals("ITALIC")) {
- newStyle = newStyle | STYLE_ITALIC;
- }
- else {
- // size or name
- try {
- // size
- newSize = Integer.parseInt(s);
- }
- catch (NumberFormatException nfe) {
- // name
- newName = s;
- }
- }
- }
- //if name is "null" set it to null
- if (newName != null && newName.equalsIgnoreCase("null")) {
- newName = null;
- }
- return new FontSpec(newName, newStyle, newSize);
- }
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((m_name == null) ? 0 : m_name.hashCode());
- result = prime * result + m_size;
- result = prime * result + m_style;
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- FontSpec other = (FontSpec) obj;
- if (m_name == null) {
- if (other.m_name != null) {
- return false;
- }
- }
- else if (!m_name.equals(other.m_name)) {
- return false;
- }
- if (m_size != other.m_size) {
- return false;
- }
- if (m_style != other.m_style) {
- return false;
- }
- return true;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.data.basic;
+
+import java.util.StringTokenizer;
+
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+
+public class FontSpec implements java.io.Serializable {
+ private static final long serialVersionUID = 1L;
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(FontSpec.class);
+ public static final int STYLE_PLAIN = 0x00;
+ public static final int STYLE_BOLD = 0x01;
+ public static final int STYLE_ITALIC = 0x02;
+
+ private final String m_name;
+ private final int m_style;
+ private final int m_size;
+
+ public FontSpec(String name, int style, int size) {
+ m_name = name;
+ m_style = style;
+ m_size = size;
+ }
+
+ public String toPattern() {
+ return getName() + (isPlain() ? "-PLAIN" : "") + (isBold() ? "-BOLD" : "") + (isItalic() ? "-ITALIC" : "") + "-" + getSize();
+ }
+
+ public String getName() {
+ return m_name;
+ }
+
+ public int getStyle() {
+ return m_style;
+ }
+
+ public boolean isPlain() {
+ return m_style == STYLE_PLAIN;
+ }
+
+ public boolean isBold() {
+ return (m_style & STYLE_BOLD) != 0;
+ }
+
+ public boolean isItalic() {
+ return (m_style & STYLE_ITALIC) != 0;
+ }
+
+ public int getSize() {
+ return m_size;
+ }
+
+ // derivatives
+ public FontSpec getPlainCopy() {
+ return new FontSpec(m_name, STYLE_PLAIN, m_size);
+ }
+
+ public FontSpec getBoldCopy() {
+ return new FontSpec(m_name, m_style | STYLE_BOLD, m_size);
+ }
+
+ public FontSpec getItalicCopy() {
+ return new FontSpec(m_name, m_style | STYLE_ITALIC, m_size);
+ }
+
+ /**
+ * Sample: Dialog-PLAIN-12
+ */
+ public static FontSpec parse(String pattern) {
+ if (pattern == null || pattern.length() == 0) {
+ return null;
+ }
+ else {
+ String newName = null;
+ int newStyle = STYLE_PLAIN;
+ int newSize = 0;
+
+ StringTokenizer tok = new StringTokenizer(pattern, " -_,/.;");
+ while (tok.hasMoreTokens()) {
+ String s = tok.nextToken().toUpperCase();
+ // styles
+ if (s.equals("PLAIN")) {
+ // nop
+ }
+ else if (s.equals("BOLD")) {
+ newStyle = newStyle | STYLE_BOLD;
+ }
+ else if (s.equals("ITALIC")) {
+ newStyle = newStyle | STYLE_ITALIC;
+ }
+ else {
+ // size or name
+ try {
+ // size
+ newSize = Integer.parseInt(s);
+ }
+ catch (NumberFormatException nfe) {
+ // name
+ newName = s;
+ }
+ }
+ }
+ //if name is "null" set it to null
+ if (newName != null && newName.equalsIgnoreCase("null")) {
+ newName = null;
+ }
+ return new FontSpec(newName, newStyle, newSize);
+ }
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((m_name == null) ? 0 : m_name.hashCode());
+ result = prime * result + m_size;
+ result = prime * result + m_style;
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ FontSpec other = (FontSpec) obj;
+ if (m_name == null) {
+ if (other.m_name != null) {
+ return false;
+ }
+ }
+ else if (!m_name.equals(other.m_name)) {
+ return false;
+ }
+ if (m_size != other.m_size) {
+ return false;
+ }
+ if (m_style != other.m_style) {
+ return false;
+ }
+ return true;
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/basic/MemoryOptimizedObject.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/basic/MemoryOptimizedObject.java
index 1f75e39393..1db0e46216 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/basic/MemoryOptimizedObject.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/basic/MemoryOptimizedObject.java
@@ -1,102 +1,102 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.data.basic;
-
-import java.io.Serializable;
-
-import org.eclipse.scout.commons.CompareUtility;
-
-public class MemoryOptimizedObject implements Serializable {
- private static final long serialVersionUID = 1L;
-
- private short m_bits;
- private Object[] m_data;
-
- public MemoryOptimizedObject() {
- m_data = new Object[0];
- }
-
- protected synchronized boolean setValueInternal(int bitPos, Object newValue) {
- int index = getIndexFor(bitPos);
- if (index >= 0) {
- Object oldValue = m_data[index];
- if (newValue != null) {
- // replace existing object
- m_data[index] = newValue;
- }
- else {
- // remove object
- Object[] newData = new Object[m_data.length - 1];
- for (int i = 0; i < index; i++) {
- newData[i] = m_data[i];
- }
- for (int i = index; i < newData.length; i++) {
- newData[i] = m_data[i + 1];
- }
- m_data = newData;
- m_bits = (short) (m_bits - (1 << bitPos));
- }
- return !CompareUtility.equals(oldValue, newValue);
- }
- else {
- if (newValue != null) {
- // add object
- int setCountBefore = 0;
- for (int i = 0; i < bitPos; i++) {
- if ((m_bits & (1 << i)) != 0) {
- setCountBefore++;
- }
- }
- index = setCountBefore;
- Object[] newData = new Object[m_data.length + 1];
- for (int i = 0; i < index; i++) {
- newData[i] = m_data[i];
- }
- newData[index] = newValue;
- for (int i = index + 1; i < newData.length; i++) {
- newData[i] = m_data[i - 1];
- }
- m_data = newData;
- m_bits = (short) (m_bits | (1 << bitPos));
- return true;
- }
- else {
- // object is still null
- return false;
- }
- }
- }
-
- protected synchronized Object getValueInternal(int bitPos) {
- int index = getIndexFor(bitPos);
- if (index >= 0) {
- return m_data[index];
- }
- else {
- return null;
- }
- }
-
- private int getIndexFor(int bitPos) {
- if ((m_bits & (1 << bitPos)) != 0) {
- int setCount = 0;
- for (int i = 0; i <= bitPos; i++) {
- if ((m_bits & (1 << i)) != 0) {
- setCount++;
- }
- }
- return setCount - 1;
- }
- else {
- return -1;
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.data.basic;
+
+import java.io.Serializable;
+
+import org.eclipse.scout.commons.CompareUtility;
+
+public class MemoryOptimizedObject implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private short m_bits;
+ private Object[] m_data;
+
+ public MemoryOptimizedObject() {
+ m_data = new Object[0];
+ }
+
+ protected synchronized boolean setValueInternal(int bitPos, Object newValue) {
+ int index = getIndexFor(bitPos);
+ if (index >= 0) {
+ Object oldValue = m_data[index];
+ if (newValue != null) {
+ // replace existing object
+ m_data[index] = newValue;
+ }
+ else {
+ // remove object
+ Object[] newData = new Object[m_data.length - 1];
+ for (int i = 0; i < index; i++) {
+ newData[i] = m_data[i];
+ }
+ for (int i = index; i < newData.length; i++) {
+ newData[i] = m_data[i + 1];
+ }
+ m_data = newData;
+ m_bits = (short) (m_bits - (1 << bitPos));
+ }
+ return !CompareUtility.equals(oldValue, newValue);
+ }
+ else {
+ if (newValue != null) {
+ // add object
+ int setCountBefore = 0;
+ for (int i = 0; i < bitPos; i++) {
+ if ((m_bits & (1 << i)) != 0) {
+ setCountBefore++;
+ }
+ }
+ index = setCountBefore;
+ Object[] newData = new Object[m_data.length + 1];
+ for (int i = 0; i < index; i++) {
+ newData[i] = m_data[i];
+ }
+ newData[index] = newValue;
+ for (int i = index + 1; i < newData.length; i++) {
+ newData[i] = m_data[i - 1];
+ }
+ m_data = newData;
+ m_bits = (short) (m_bits | (1 << bitPos));
+ return true;
+ }
+ else {
+ // object is still null
+ return false;
+ }
+ }
+ }
+
+ protected synchronized Object getValueInternal(int bitPos) {
+ int index = getIndexFor(bitPos);
+ if (index >= 0) {
+ return m_data[index];
+ }
+ else {
+ return null;
+ }
+ }
+
+ private int getIndexFor(int bitPos) {
+ if ((m_bits & (1 << bitPos)) != 0) {
+ int setCount = 0;
+ for (int i = 0; i <= bitPos; i++) {
+ if ((m_bits & (1 << i)) != 0) {
+ setCount++;
+ }
+ }
+ return setCount - 1;
+ }
+ else {
+ return -1;
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/basic/table/SortSpec.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/basic/table/SortSpec.java
index 9c15ed6ed0..662167c648 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/basic/table/SortSpec.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/basic/table/SortSpec.java
@@ -1,82 +1,82 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.data.basic.table;
-
-import java.io.Serializable;
-
-public class SortSpec implements Serializable {
- private static final long serialVersionUID = 0L;
-
- private int[] m_columns;
- private boolean[] m_ascending;
-
- public SortSpec(int columnIndex, boolean ascending) {
- m_columns = new int[]{columnIndex};
- m_ascending = new boolean[]{ascending};
- }
-
- public SortSpec(int columnIndex1, boolean ascending1, int columnIndex2, boolean ascending2) {
- m_columns = new int[]{columnIndex1, columnIndex2};
- m_ascending = new boolean[]{ascending1, ascending2};
- }
-
- public SortSpec(int[] columnIndexes, boolean[] ascending) {
- m_columns = columnIndexes;
- m_ascending = ascending;
- }
-
- /**
- * @return sort column count
- */
- public int size() {
- return m_columns.length;
- }
-
- /**
- * @return the index of the i-th sort column
- */
- public int getColumnIndex(int i) {
- return m_columns[i];
- }
-
- /**
- * @return the ascending flag of the i-th sort column
- */
- public boolean isColumnAscending(int i) {
- return m_ascending[i];
- }
-
- /**
- * @return true if the column with index columnIndex is a sort column
- */
- public boolean isSortColumn(int columnIndex) {
- for (int i : m_columns) {
- if (i == columnIndex) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * @return the order of the sort column in the list of sort columns (starting
- * with 0)
- */
- public int getSortColumnOrder(int columnIndex) {
- for (int i = 0; i < m_columns.length; i++) {
- if (m_columns[i] == columnIndex) {
- return i;
- }
- }
- return -1;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.data.basic.table;
+
+import java.io.Serializable;
+
+public class SortSpec implements Serializable {
+ private static final long serialVersionUID = 0L;
+
+ private int[] m_columns;
+ private boolean[] m_ascending;
+
+ public SortSpec(int columnIndex, boolean ascending) {
+ m_columns = new int[]{columnIndex};
+ m_ascending = new boolean[]{ascending};
+ }
+
+ public SortSpec(int columnIndex1, boolean ascending1, int columnIndex2, boolean ascending2) {
+ m_columns = new int[]{columnIndex1, columnIndex2};
+ m_ascending = new boolean[]{ascending1, ascending2};
+ }
+
+ public SortSpec(int[] columnIndexes, boolean[] ascending) {
+ m_columns = columnIndexes;
+ m_ascending = ascending;
+ }
+
+ /**
+ * @return sort column count
+ */
+ public int size() {
+ return m_columns.length;
+ }
+
+ /**
+ * @return the index of the i-th sort column
+ */
+ public int getColumnIndex(int i) {
+ return m_columns[i];
+ }
+
+ /**
+ * @return the ascending flag of the i-th sort column
+ */
+ public boolean isColumnAscending(int i) {
+ return m_ascending[i];
+ }
+
+ /**
+ * @return true if the column with index columnIndex is a sort column
+ */
+ public boolean isSortColumn(int columnIndex) {
+ for (int i : m_columns) {
+ if (i == columnIndex) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @return the order of the sort column in the list of sort columns (starting
+ * with 0)
+ */
+ public int getSortColumnOrder(int columnIndex) {
+ for (int i = 0; i < m_columns.length; i++) {
+ if (m_columns[i] == columnIndex) {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/AbstractFormData.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/AbstractFormData.java
index ffdb21f780..f36f864eaa 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/AbstractFormData.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/AbstractFormData.java
@@ -1,346 +1,346 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.data.form;
-
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.TreeMap;
-
-import org.eclipse.scout.commons.ClassIdentifier;
-import org.eclipse.scout.commons.CloneUtility;
-import org.eclipse.scout.commons.ConfigurationUtility;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.shared.data.form.fields.AbstractFormFieldData;
-import org.eclipse.scout.rt.shared.data.form.properties.AbstractPropertyData;
-
-public abstract class AbstractFormData implements Serializable, Cloneable {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractFormData.class);
- private static final long serialVersionUID = 1L;
-
- private Map<Class<? extends AbstractPropertyData>, AbstractPropertyData> m_propertyMap;
- private Map<Class<? extends AbstractFormFieldData>, AbstractFormFieldData> m_fieldMap;
-
- public AbstractFormData() {
- initConfig();
- }
-
- private Class<? extends AbstractPropertyData>[] getConfiguredPropertyDatas() {
- Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
- return ConfigurationUtility.filterClasses(dca, AbstractPropertyData.class);
- }
-
- private Class<? extends AbstractFormFieldData>[] getConfiguredFieldDatas() {
- Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
- return ConfigurationUtility.filterClasses(dca, AbstractFormFieldData.class);
- }
-
- protected void initConfig() {
- // add properties
- m_propertyMap = new HashMap<Class<? extends AbstractPropertyData>, AbstractPropertyData>();
- Class<? extends AbstractPropertyData>[] propArray = getConfiguredPropertyDatas();
- for (int i = 0; i < propArray.length; i++) {
- AbstractPropertyData p;
- try {
- p = ConfigurationUtility.newInnerInstance(this, propArray[i]);
- m_propertyMap.put(p.getClass(), p);
- }// end try
- catch (Exception e) {
- LOG.warn(null, e);
- }
- }// end for
- // add fields
- m_fieldMap = new HashMap<Class<? extends AbstractFormFieldData>, AbstractFormFieldData>();
- Class<? extends AbstractFormFieldData>[] fieldArray = getConfiguredFieldDatas();
- for (int i = 0; i < fieldArray.length; i++) {
- AbstractFormFieldData f;
- try {
- f = ConfigurationUtility.newInnerInstance(this, fieldArray[i]);
- m_fieldMap.put(f.getClass(), f);
- }// end try
- catch (Exception e) {
- LOG.warn(null, e);
- }
- }// end for
- }
-
- public AbstractPropertyData getPropertyById(String id) {
- for (AbstractPropertyData p : m_propertyMap.values()) {
- if (p.getPropertyId().equalsIgnoreCase(id)) {
- return p;
- }
- }
- return null;
- }
-
- @SuppressWarnings("unchecked")
- public <T extends AbstractPropertyData> T getPropertyByClass(Class<T> c) {
- return (T) m_propertyMap.get(c);
- }
-
- public <T extends AbstractPropertyData> void setPropertyByClass(Class<T> c, T v) {
- if (v == null) {
- m_propertyMap.remove(c);
- }
- else {
- m_propertyMap.put(c, v);
- }
- }
-
- public AbstractPropertyData[] getAllProperties() {
- return m_propertyMap != null ? m_propertyMap.values().toArray(new AbstractPropertyData[m_propertyMap.size()]) : new AbstractPropertyData[0];
- }
-
- public AbstractFormFieldData getFieldById(String id) {
- String fieldDataId = FormDataUtility.getFieldDataId(id);
- for (AbstractFormFieldData f : m_fieldMap.values()) {
- if (f.getFieldId().equals(fieldDataId)) {
- return f;
- }
- }
- return null;
- }
-
- @SuppressWarnings("unchecked")
- public <T extends AbstractFormFieldData> T getFieldByClass(Class<T> c) {
- return (T) m_fieldMap.get(c);
- }
-
- public <T extends AbstractFormFieldData> void setFieldByClass(Class<T> c, T v) {
- if (v == null) {
- m_fieldMap.remove(c);
- }
- else {
- m_fieldMap.put(c, v);
- }
- }
-
- /**
- * @return all fields of the form data itself, not including fields in
- * external field templates
- */
- public AbstractFormFieldData[] getFields() {
- return m_fieldMap.values().toArray(new AbstractFormFieldData[m_fieldMap.size()]);
- }
-
- /**
- * @return all fields of the form data and all its external template field
- * datas in a map with qualified ids<br>
- * The array of returned fields is the result of a top-down
- * breath-first tree traversal
- * <p>
- * Example:
- *
- * <pre>
- * A
- * U
- * E
- * F
- * V
- * B
- * X
- * Y
- * </pre>
- *
- * would be returned as A B U V X Y E F
- */
- public Map<Integer, Map<String/* qualified field id */, AbstractFormFieldData>> getAllFieldsRec() {
- TreeMap<Integer, Map<String, AbstractFormFieldData>> breathFirstMap = new TreeMap<Integer, Map<String, AbstractFormFieldData>>();
- for (AbstractFormFieldData child : getFields()) {
- collectAllFieldsRec(child, breathFirstMap, 0, "");
- }
- return breathFirstMap;
- }
-
- private void collectAllFieldsRec(AbstractFormFieldData field, Map<Integer/* level */, Map<String/* qualified field id */, AbstractFormFieldData>> breathFirstMap, int level, String prefix) {
- Map<String/* qualified field id */, AbstractFormFieldData> subMap = breathFirstMap.get(level);
- if (subMap == null) {
- subMap = new HashMap<String/* qualified field id */, AbstractFormFieldData>();
- breathFirstMap.put(level, subMap);
- }
- subMap.put(prefix + field.getFieldId(), field);
- for (AbstractFormFieldData child : field.getFields()) {
- collectAllFieldsRec(child, breathFirstMap, level + 1, prefix + field.getFieldId() + "/");
- }
- }
-
- /**
- * Searches the given form field data in this form data as well as in all externally referenced template
- * field data.
- *
- * @param breathFirstMap
- * The breath-first search map as returned by {@link AbstractFormData#getAllFieldsRec()}. If
- * <code>null</code>, a new map is created.
- * @param valueTypeIdentifier
- * The class identifier to be searched in the form data.
- * @return Returns the form data's {@link AbstractFormFieldData} of the given valueType or <code>null</code>, if it
- * does not exist.
- * @throws ProcessingException
- */
- public AbstractFormFieldData findFieldByClass(Map<Integer, Map<String, AbstractFormFieldData>> breathFirstMap, ClassIdentifier valueTypeIdentifier) throws ProcessingException {
- if (breathFirstMap == null) {
- breathFirstMap = getAllFieldsRec();
- }
- AbstractFormFieldData candidate = null;
- for (Map<String, AbstractFormFieldData> subMap : breathFirstMap.values()) {
- for (Entry<String, AbstractFormFieldData> entry : subMap.entrySet()) {
- AbstractFormFieldData fd = entry.getValue();
- String fieldId = entry.getKey();
- if (matchesAllParts(valueTypeIdentifier, fieldId, fd)) {
- if (candidate != null) {
- throw new ProcessingException("Found more than one field for class: [" + fd.getClass() + "]");
- }
- candidate = fd;
- }
- }
- }
- return candidate;
- }
-
- /**
- * @return all properties of the form data and all its external template field
- * data in a map with qualified ids<br>
- * The array of returned fields is the result of a top-down
- * breath-first tree traversal
- * <p>
- * Example:
- *
- * <pre>
- * A (p1, p4)
- * U
- * E (p3)
- * F
- * V
- * B
- * X (p2)
- * Y
- * </pre>
- *
- * would be returned as p1, p4, p2, p3
- */
- public Map<Integer, Map<String/* qualified property id */, AbstractPropertyData<?>>> getAllPropertiesRec() {
- TreeMap<Integer, Map<String, AbstractPropertyData<?>>> breathFirstMap = new TreeMap<Integer, Map<String, AbstractPropertyData<?>>>();
- HashMap<String, AbstractPropertyData<?>> rootMap = new HashMap<String/* qualified field id */, AbstractPropertyData<?>>();
- breathFirstMap.put(0, rootMap);
- for (AbstractPropertyData<?> prop : getAllProperties()) {
- rootMap.put(prop.getClass().getSimpleName(), prop);
- }
- for (AbstractFormFieldData child : getFields()) {
- collectAllPropertiesRec(child, breathFirstMap, 1, child.getFieldId() + "/");
- }
- return breathFirstMap;
- }
-
- private void collectAllPropertiesRec(AbstractFormFieldData field, Map<Integer/* level */, Map<String/* qualified field id */, AbstractPropertyData<?>>> breathFirstMap, int level, String prefix) {
- Map<String/* qualified field id */, AbstractPropertyData<?>> subMap = breathFirstMap.get(level);
- if (subMap == null) {
- subMap = new HashMap<String/* qualified field id */, AbstractPropertyData<?>>();
- breathFirstMap.put(level, subMap);
- }
- for (AbstractPropertyData<?> prop : field.getAllProperties()) {
- subMap.put(prefix + prop.getClass().getSimpleName(), prop);
- }
- for (AbstractFormFieldData child : field.getFields()) {
- collectAllPropertiesRec(child, breathFirstMap, level + 1, prefix + child.getFieldId() + "/");
- }
- }
-
- /**
- * Searches the given property data in this form data as well as in all externally referenced template
- * field data.
- *
- * @param breathFirstMap
- * The breath-first search map as returned by {@link AbstractFormData#getAllPropertiesRec()}. If
- * <code>null</code>, a new map is created.
- * @param valueType
- * The type to be searched in the form data.
- * @return Returns the form data's {@link AbstractPropertyData} of the given valueType or <code>null</code>, if it
- * does not exist.
- * @throws ProcessingException
- */
- public AbstractPropertyData<?> findPropertyByClass(Map<Integer, Map<String, AbstractPropertyData<?>>> breathFirstMap, ClassIdentifier valueTypeClassIdentifier) throws ProcessingException {
- if (breathFirstMap == null) {
- breathFirstMap = getAllPropertiesRec();
- }
- AbstractPropertyData<?> candidate = null;
- for (Map<String, AbstractPropertyData<?>> subMap : breathFirstMap.values()) {
- for (Map.Entry<String, AbstractPropertyData<?>> entry : subMap.entrySet()) {
- String propertyId = entry.getKey();
- AbstractPropertyData<?> pd = entry.getValue();
- if (matchesAllParts(valueTypeClassIdentifier, propertyId, pd)) {
- if (candidate != null) {
- throw new ProcessingException("Found more than one property for class: [" + pd.getClass() + "]");
- }
- candidate = pd;
- }
- }
- }
- return candidate;
- }
-
- @Override
- public Object clone() {
- try {
- return CloneUtility.createDeepCopyBySerializing(this);
- }
- catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- /**
- * Checks whether the given fully qualified fieldId matches all parts of the given class identifier.
- * The last segment is checked against the given objects's type.
- *
- * @param valueTypeIdentifier
- * @param fullyQualifiedFieldId
- * The fully qualified fieldId.
- * @param obj
- * The object representing the last segment.
- * @return Returns <code>true</code> if all segments of the given class identifier are part of the fully qualified
- * field id. <code>false</code> otherwise.
- */
- private boolean matchesAllParts(ClassIdentifier valueTypeIdentifier, String fullyQualifiedFieldId, Object obj) {
- // check last segment by class
- if (obj == null || obj.getClass() != valueTypeIdentifier.getLastSegment()) {
- return false;
- }
- // check other segments by id
- Class<?>[] classes = valueTypeIdentifier.getClasses();
- String[] fieldIdParts = fullyQualifiedFieldId.split("[/]");
- int i = classes.length - 2;
- int j = fieldIdParts.length - 2;
- while (i >= 0 && j >= 0) {
- String fieldId = classes[i].getName();
- int i1 = Math.max(fieldId.lastIndexOf('$'), fieldId.lastIndexOf('.'));
- fieldId = fieldId.substring(i1 + 1);
- if (fieldIdParts[j].equals(fieldId)) {
- i--;
- }
- j--;
- }
- return i < 0;
- }
-
- /*
- * In subclasses of this class the configurator will add setters/getters for
- * properties that are declared in the form
- */
-
- /*
- * In subclasses of this class the configurator will add getters for inner
- * form field data types
- */
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.data.form;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.TreeMap;
+
+import org.eclipse.scout.commons.ClassIdentifier;
+import org.eclipse.scout.commons.CloneUtility;
+import org.eclipse.scout.commons.ConfigurationUtility;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.shared.data.form.fields.AbstractFormFieldData;
+import org.eclipse.scout.rt.shared.data.form.properties.AbstractPropertyData;
+
+public abstract class AbstractFormData implements Serializable, Cloneable {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractFormData.class);
+ private static final long serialVersionUID = 1L;
+
+ private Map<Class<? extends AbstractPropertyData>, AbstractPropertyData> m_propertyMap;
+ private Map<Class<? extends AbstractFormFieldData>, AbstractFormFieldData> m_fieldMap;
+
+ public AbstractFormData() {
+ initConfig();
+ }
+
+ private Class<? extends AbstractPropertyData>[] getConfiguredPropertyDatas() {
+ Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
+ return ConfigurationUtility.filterClasses(dca, AbstractPropertyData.class);
+ }
+
+ private Class<? extends AbstractFormFieldData>[] getConfiguredFieldDatas() {
+ Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
+ return ConfigurationUtility.filterClasses(dca, AbstractFormFieldData.class);
+ }
+
+ protected void initConfig() {
+ // add properties
+ m_propertyMap = new HashMap<Class<? extends AbstractPropertyData>, AbstractPropertyData>();
+ Class<? extends AbstractPropertyData>[] propArray = getConfiguredPropertyDatas();
+ for (int i = 0; i < propArray.length; i++) {
+ AbstractPropertyData p;
+ try {
+ p = ConfigurationUtility.newInnerInstance(this, propArray[i]);
+ m_propertyMap.put(p.getClass(), p);
+ }// end try
+ catch (Exception e) {
+ LOG.warn(null, e);
+ }
+ }// end for
+ // add fields
+ m_fieldMap = new HashMap<Class<? extends AbstractFormFieldData>, AbstractFormFieldData>();
+ Class<? extends AbstractFormFieldData>[] fieldArray = getConfiguredFieldDatas();
+ for (int i = 0; i < fieldArray.length; i++) {
+ AbstractFormFieldData f;
+ try {
+ f = ConfigurationUtility.newInnerInstance(this, fieldArray[i]);
+ m_fieldMap.put(f.getClass(), f);
+ }// end try
+ catch (Exception e) {
+ LOG.warn(null, e);
+ }
+ }// end for
+ }
+
+ public AbstractPropertyData getPropertyById(String id) {
+ for (AbstractPropertyData p : m_propertyMap.values()) {
+ if (p.getPropertyId().equalsIgnoreCase(id)) {
+ return p;
+ }
+ }
+ return null;
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T extends AbstractPropertyData> T getPropertyByClass(Class<T> c) {
+ return (T) m_propertyMap.get(c);
+ }
+
+ public <T extends AbstractPropertyData> void setPropertyByClass(Class<T> c, T v) {
+ if (v == null) {
+ m_propertyMap.remove(c);
+ }
+ else {
+ m_propertyMap.put(c, v);
+ }
+ }
+
+ public AbstractPropertyData[] getAllProperties() {
+ return m_propertyMap != null ? m_propertyMap.values().toArray(new AbstractPropertyData[m_propertyMap.size()]) : new AbstractPropertyData[0];
+ }
+
+ public AbstractFormFieldData getFieldById(String id) {
+ String fieldDataId = FormDataUtility.getFieldDataId(id);
+ for (AbstractFormFieldData f : m_fieldMap.values()) {
+ if (f.getFieldId().equals(fieldDataId)) {
+ return f;
+ }
+ }
+ return null;
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T extends AbstractFormFieldData> T getFieldByClass(Class<T> c) {
+ return (T) m_fieldMap.get(c);
+ }
+
+ public <T extends AbstractFormFieldData> void setFieldByClass(Class<T> c, T v) {
+ if (v == null) {
+ m_fieldMap.remove(c);
+ }
+ else {
+ m_fieldMap.put(c, v);
+ }
+ }
+
+ /**
+ * @return all fields of the form data itself, not including fields in
+ * external field templates
+ */
+ public AbstractFormFieldData[] getFields() {
+ return m_fieldMap.values().toArray(new AbstractFormFieldData[m_fieldMap.size()]);
+ }
+
+ /**
+ * @return all fields of the form data and all its external template field
+ * datas in a map with qualified ids<br>
+ * The array of returned fields is the result of a top-down
+ * breath-first tree traversal
+ * <p>
+ * Example:
+ *
+ * <pre>
+ * A
+ * U
+ * E
+ * F
+ * V
+ * B
+ * X
+ * Y
+ * </pre>
+ *
+ * would be returned as A B U V X Y E F
+ */
+ public Map<Integer, Map<String/* qualified field id */, AbstractFormFieldData>> getAllFieldsRec() {
+ TreeMap<Integer, Map<String, AbstractFormFieldData>> breathFirstMap = new TreeMap<Integer, Map<String, AbstractFormFieldData>>();
+ for (AbstractFormFieldData child : getFields()) {
+ collectAllFieldsRec(child, breathFirstMap, 0, "");
+ }
+ return breathFirstMap;
+ }
+
+ private void collectAllFieldsRec(AbstractFormFieldData field, Map<Integer/* level */, Map<String/* qualified field id */, AbstractFormFieldData>> breathFirstMap, int level, String prefix) {
+ Map<String/* qualified field id */, AbstractFormFieldData> subMap = breathFirstMap.get(level);
+ if (subMap == null) {
+ subMap = new HashMap<String/* qualified field id */, AbstractFormFieldData>();
+ breathFirstMap.put(level, subMap);
+ }
+ subMap.put(prefix + field.getFieldId(), field);
+ for (AbstractFormFieldData child : field.getFields()) {
+ collectAllFieldsRec(child, breathFirstMap, level + 1, prefix + field.getFieldId() + "/");
+ }
+ }
+
+ /**
+ * Searches the given form field data in this form data as well as in all externally referenced template
+ * field data.
+ *
+ * @param breathFirstMap
+ * The breath-first search map as returned by {@link AbstractFormData#getAllFieldsRec()}. If
+ * <code>null</code>, a new map is created.
+ * @param valueTypeIdentifier
+ * The class identifier to be searched in the form data.
+ * @return Returns the form data's {@link AbstractFormFieldData} of the given valueType or <code>null</code>, if it
+ * does not exist.
+ * @throws ProcessingException
+ */
+ public AbstractFormFieldData findFieldByClass(Map<Integer, Map<String, AbstractFormFieldData>> breathFirstMap, ClassIdentifier valueTypeIdentifier) throws ProcessingException {
+ if (breathFirstMap == null) {
+ breathFirstMap = getAllFieldsRec();
+ }
+ AbstractFormFieldData candidate = null;
+ for (Map<String, AbstractFormFieldData> subMap : breathFirstMap.values()) {
+ for (Entry<String, AbstractFormFieldData> entry : subMap.entrySet()) {
+ AbstractFormFieldData fd = entry.getValue();
+ String fieldId = entry.getKey();
+ if (matchesAllParts(valueTypeIdentifier, fieldId, fd)) {
+ if (candidate != null) {
+ throw new ProcessingException("Found more than one field for class: [" + fd.getClass() + "]");
+ }
+ candidate = fd;
+ }
+ }
+ }
+ return candidate;
+ }
+
+ /**
+ * @return all properties of the form data and all its external template field
+ * data in a map with qualified ids<br>
+ * The array of returned fields is the result of a top-down
+ * breath-first tree traversal
+ * <p>
+ * Example:
+ *
+ * <pre>
+ * A (p1, p4)
+ * U
+ * E (p3)
+ * F
+ * V
+ * B
+ * X (p2)
+ * Y
+ * </pre>
+ *
+ * would be returned as p1, p4, p2, p3
+ */
+ public Map<Integer, Map<String/* qualified property id */, AbstractPropertyData<?>>> getAllPropertiesRec() {
+ TreeMap<Integer, Map<String, AbstractPropertyData<?>>> breathFirstMap = new TreeMap<Integer, Map<String, AbstractPropertyData<?>>>();
+ HashMap<String, AbstractPropertyData<?>> rootMap = new HashMap<String/* qualified field id */, AbstractPropertyData<?>>();
+ breathFirstMap.put(0, rootMap);
+ for (AbstractPropertyData<?> prop : getAllProperties()) {
+ rootMap.put(prop.getClass().getSimpleName(), prop);
+ }
+ for (AbstractFormFieldData child : getFields()) {
+ collectAllPropertiesRec(child, breathFirstMap, 1, child.getFieldId() + "/");
+ }
+ return breathFirstMap;
+ }
+
+ private void collectAllPropertiesRec(AbstractFormFieldData field, Map<Integer/* level */, Map<String/* qualified field id */, AbstractPropertyData<?>>> breathFirstMap, int level, String prefix) {
+ Map<String/* qualified field id */, AbstractPropertyData<?>> subMap = breathFirstMap.get(level);
+ if (subMap == null) {
+ subMap = new HashMap<String/* qualified field id */, AbstractPropertyData<?>>();
+ breathFirstMap.put(level, subMap);
+ }
+ for (AbstractPropertyData<?> prop : field.getAllProperties()) {
+ subMap.put(prefix + prop.getClass().getSimpleName(), prop);
+ }
+ for (AbstractFormFieldData child : field.getFields()) {
+ collectAllPropertiesRec(child, breathFirstMap, level + 1, prefix + child.getFieldId() + "/");
+ }
+ }
+
+ /**
+ * Searches the given property data in this form data as well as in all externally referenced template
+ * field data.
+ *
+ * @param breathFirstMap
+ * The breath-first search map as returned by {@link AbstractFormData#getAllPropertiesRec()}. If
+ * <code>null</code>, a new map is created.
+ * @param valueType
+ * The type to be searched in the form data.
+ * @return Returns the form data's {@link AbstractPropertyData} of the given valueType or <code>null</code>, if it
+ * does not exist.
+ * @throws ProcessingException
+ */
+ public AbstractPropertyData<?> findPropertyByClass(Map<Integer, Map<String, AbstractPropertyData<?>>> breathFirstMap, ClassIdentifier valueTypeClassIdentifier) throws ProcessingException {
+ if (breathFirstMap == null) {
+ breathFirstMap = getAllPropertiesRec();
+ }
+ AbstractPropertyData<?> candidate = null;
+ for (Map<String, AbstractPropertyData<?>> subMap : breathFirstMap.values()) {
+ for (Map.Entry<String, AbstractPropertyData<?>> entry : subMap.entrySet()) {
+ String propertyId = entry.getKey();
+ AbstractPropertyData<?> pd = entry.getValue();
+ if (matchesAllParts(valueTypeClassIdentifier, propertyId, pd)) {
+ if (candidate != null) {
+ throw new ProcessingException("Found more than one property for class: [" + pd.getClass() + "]");
+ }
+ candidate = pd;
+ }
+ }
+ }
+ return candidate;
+ }
+
+ @Override
+ public Object clone() {
+ try {
+ return CloneUtility.createDeepCopyBySerializing(this);
+ }
+ catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * Checks whether the given fully qualified fieldId matches all parts of the given class identifier.
+ * The last segment is checked against the given objects's type.
+ *
+ * @param valueTypeIdentifier
+ * @param fullyQualifiedFieldId
+ * The fully qualified fieldId.
+ * @param obj
+ * The object representing the last segment.
+ * @return Returns <code>true</code> if all segments of the given class identifier are part of the fully qualified
+ * field id. <code>false</code> otherwise.
+ */
+ private boolean matchesAllParts(ClassIdentifier valueTypeIdentifier, String fullyQualifiedFieldId, Object obj) {
+ // check last segment by class
+ if (obj == null || obj.getClass() != valueTypeIdentifier.getLastSegment()) {
+ return false;
+ }
+ // check other segments by id
+ Class<?>[] classes = valueTypeIdentifier.getClasses();
+ String[] fieldIdParts = fullyQualifiedFieldId.split("[/]");
+ int i = classes.length - 2;
+ int j = fieldIdParts.length - 2;
+ while (i >= 0 && j >= 0) {
+ String fieldId = classes[i].getName();
+ int i1 = Math.max(fieldId.lastIndexOf('$'), fieldId.lastIndexOf('.'));
+ fieldId = fieldId.substring(i1 + 1);
+ if (fieldIdParts[j].equals(fieldId)) {
+ i--;
+ }
+ j--;
+ }
+ return i < 0;
+ }
+
+ /*
+ * In subclasses of this class the configurator will add setters/getters for
+ * properties that are declared in the form
+ */
+
+ /*
+ * In subclasses of this class the configurator will add getters for inner
+ * form field data types
+ */
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/FormDataUtility.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/FormDataUtility.java
index 1350e26668..20cd99d1f0 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/FormDataUtility.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/FormDataUtility.java
@@ -1,44 +1,44 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.data.form;
-
-import org.eclipse.scout.commons.StringUtility;
-
-/**
- * @since 3.8.0
- */
-public final class FormDataUtility {
-
- private FormDataUtility() {
- }
-
- /**
- * Computes the field data ID for a given form field ID.
- * <p/>
- * <b>Note:</b> This method behaves exactly the same as the generate FormData operation in Scout SDK.
- *
- * @return Returns the corresponding field data ID for the given form field ID. The result is <code>null</code> if the
- * field ID is <code>null</code> or if it contains white spaces only.
- */
- public static String getFieldDataId(String formFieldId) {
- String s = StringUtility.trim(formFieldId);
- if (StringUtility.isNullOrEmpty(s)) {
- return null;
- }
- if (s.endsWith("Field")) {
- return s.replaceAll("Field$", "");
- }
- if (s.endsWith("Button")) {
- return s.replaceAll("Button$", "");
- }
- return s;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.data.form;
+
+import org.eclipse.scout.commons.StringUtility;
+
+/**
+ * @since 3.8.0
+ */
+public final class FormDataUtility {
+
+ private FormDataUtility() {
+ }
+
+ /**
+ * Computes the field data ID for a given form field ID.
+ * <p/>
+ * <b>Note:</b> This method behaves exactly the same as the generate FormData operation in Scout SDK.
+ *
+ * @return Returns the corresponding field data ID for the given form field ID. The result is <code>null</code> if the
+ * field ID is <code>null</code> or if it contains white spaces only.
+ */
+ public static String getFieldDataId(String formFieldId) {
+ String s = StringUtility.trim(formFieldId);
+ if (StringUtility.isNullOrEmpty(s)) {
+ return null;
+ }
+ if (s.endsWith("Field")) {
+ return s.replaceAll("Field$", "");
+ }
+ if (s.endsWith("Button")) {
+ return s.replaceAll("Button$", "");
+ }
+ return s;
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/ValidationRule.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/ValidationRule.java
index 91fef05e77..22132bfa83 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/ValidationRule.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/ValidationRule.java
@@ -1,199 +1,199 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.data.form;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import java.util.regex.Pattern;
-
-import org.eclipse.scout.commons.annotations.FormData;
-import org.eclipse.scout.rt.shared.data.form.fields.AbstractFormFieldData;
-import org.eclipse.scout.rt.shared.services.common.code.ICodeType;
-import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
-import org.eclipse.scout.rt.shared.validate.InputValidation;
-import org.eclipse.scout.rt.shared.validate.OutputValidation;
-import org.eclipse.scout.rt.shared.validate.ValidationUtility;
-
-/**
- * Method annotation on a client form field used in scout sdk in order to generate the validation rule map on the
- * FormData.
- * <p>
- * Scout SDK writes the value of every annotated method into the static map "validationRules" of the corresponding
- * FormFielData.
- * <p>
- * This annotation is only processed when a form data is autmatically managed by the scout sdk using the
- * {@link FormData} annotation.
- * <p>
- * Example for the form data field generated for a string field inside a form
- *
- * <pre>
- * public class LastNameField extends AbstractStringField{
- * ...
- *
- * protected boolean getConfiguredMandatory(){
- * return true;
- * }
- *
- * protected Integer getConfiguredMaxLength(){
- * return 60;
- * }
- * }
- * </pre>
- *
- * <pre>
- * public class LastName extends AbstractValueFieldData&lt;String&gt;{
- * ...
- * public static final HashMap&lt;String,Object&gt; validationRules=new HashMap&lt;String,Object&gt;();
- * static{
- * validationRules.put("mandatory",true);
- * validationRules.put("maxLength",60);
- * }
- * }
- * </pre>
- *
- * The two rule "put" lines were generated by the sdk due to the {@link ValidationRule} annotations on AbstractFormField
- * and AbstractStringField
- * <p>
- * The scout server (runtime) checks all inbound and outbound form datas and form fields according to their
- * validationRules defined in the shared FormData classes (central validation concept).
- * <p>
- * Custom validation rule names can freely be used (it's a String or a string constant).
- * <p>
- * Validation is implemented by either (a) overriding ServiceTunnelServlet#runServerJobTransactionWithDelegate with an
- * own DefaultTransactionDelegate subclass) that overrides the filterInput() method or (b) annotating service operation
- * methods with {@link InputValidation} and (optionally) {@link OutputValidation}.
- * <p>
- * When the sdk fails to create a rule for an annotated (directly or implicit by superclass) method to the created form
- * data it adds a javadoc entry specifying the fully qualified source method name and the keyword
- * "not processed ValidationRule" that can be searched in the source code or in the task list as upper case xxx.
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.METHOD})
-public @interface ValidationRule {
- /**
- * the name of the rule, either any of the ValidationRule constants or a custom constant
- */
- String value();
-
- /**
- * When setting this annotation property, the scout sdk will not generate the validation rule value based on the
- * method return value but
- * use exactly this string as generated source code.
- * <p>
- * Example:
- *
- * <pre>
- * @ValidationRule(value=ValidationRule.CODE_TYPE, generatedSourceCode="com.myproject.shared.services.code.StatusCodeType.class")
- * Class <? extends {@link ICodeType}> getConfiguredCodeType(){
- * return ClientSpecificStatusCodeType.class;
- * }
- * </pre>
- */
- String generatedSourceCode() default "";
-
- /**
- * When setting skip to true, the scout sdk will not generate code for this validation rule at all.
- * Example:
- *
- * <pre>
- * @ValidationRule(value=ValidationRule.CODE_TYPE, skip=true)
- * Class <? extends {@link ICodeType}> getConfiguredCodeType(){
- * return ClientSpecificStatusCodeType.class;
- * }
- * </pre>
- */
- boolean skip() default false;
-
- /**
- * rule value type is {@link Boolean}
- * <p>
- * default rule packaged with scout
- */
- String MANDATORY = "mandatory";
- /**
- * rule value type is {@link Number}
- * <p>
- * default rule packaged with scout
- */
- String MIN_VALUE = "minValue";
- /**
- * rule value type is {@link Number}
- * <p>
- * default rule packaged with scout
- */
- String MAX_VALUE = "maxValue";
- /**
- * rule value type is {@link Integer}
- * <p>
- * default rule packaged with scout
- */
- String MIN_LENGTH = "minLength";
- /**
- * rule value type is {@link Integer}
- * <p>
- * default rule packaged with scout
- */
- String MAX_LENGTH = "maxLength";
- /**
- * rule value type is {@link Class}
- * <p>
- * default rule packaged with scout
- */
- String CODE_TYPE = "codeType";
- /**
- * rule value type is {@link Class}
- * <p>
- * default rule packaged with scout
- */
- String LOOKUP_CALL = "lookupCall";
- /**
- * rule value type is {@link String}
- * <p>
- * Server checks if the string value (if not null) matches the regex Use {@link #generatedSourceCode()} attribute to
- * specify explicit regex. The regex is case insensitive {@link Pattern#CASE_INSENSITIVE} and scans full-text over
- * multiple lines {@link Pattern#DOTALL}.
- * <p>
- * see {@link ValidationUtility#checkValueMatchesRegex(String, Object, Object)}
- * <p>
- * default rule packaged with scout
- */
- String REGEX = "regex";
- /**
- * rule value type is Class<? extends {@link AbstractFormFieldData}> that is translated by the sdk from its
- * corresponding form field type
- * <p>
- * The master field of this field, often used as part of {@link LookupCall#setMaster(Object)} using the value
- * <p>
- * default rule packaged with scout
- */
- String MASTER_VALUE_FIELD = "masterValueField";
- /**
- * rule value type is {@link Boolean}
- * <p>
- * If the master field is required and null and this field is not null, this is a fault
- * <p>
- * default rule packaged with scout
- */
- String MASTER_VALUE_REQUIRED = "masterValueRequired";
- /**
- * rule value type is {@link Boolean}
- * <p>
- * If rule value is true, 0 (zero) is treated null, thus no code type or lookup call validation occurs for value 0
- * (same treatment as for null) and a mandatory field providing 0 as value will be rejected. In opposite, a rule value
- * of false will cause the code type / lookup call validation to be executed and the mandatory field check will accept
- * an input value of 0.
- * </p>
- * default rule packaged with scout
- */
- String ZERO_NULL_EQUALITY = "zeroNullEquality";
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.data.form;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.util.regex.Pattern;
+
+import org.eclipse.scout.commons.annotations.FormData;
+import org.eclipse.scout.rt.shared.data.form.fields.AbstractFormFieldData;
+import org.eclipse.scout.rt.shared.services.common.code.ICodeType;
+import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
+import org.eclipse.scout.rt.shared.validate.InputValidation;
+import org.eclipse.scout.rt.shared.validate.OutputValidation;
+import org.eclipse.scout.rt.shared.validate.ValidationUtility;
+
+/**
+ * Method annotation on a client form field used in scout sdk in order to generate the validation rule map on the
+ * FormData.
+ * <p>
+ * Scout SDK writes the value of every annotated method into the static map "validationRules" of the corresponding
+ * FormFielData.
+ * <p>
+ * This annotation is only processed when a form data is autmatically managed by the scout sdk using the
+ * {@link FormData} annotation.
+ * <p>
+ * Example for the form data field generated for a string field inside a form
+ *
+ * <pre>
+ * public class LastNameField extends AbstractStringField{
+ * ...
+ *
+ * protected boolean getConfiguredMandatory(){
+ * return true;
+ * }
+ *
+ * protected Integer getConfiguredMaxLength(){
+ * return 60;
+ * }
+ * }
+ * </pre>
+ *
+ * <pre>
+ * public class LastName extends AbstractValueFieldData&lt;String&gt;{
+ * ...
+ * public static final HashMap&lt;String,Object&gt; validationRules=new HashMap&lt;String,Object&gt;();
+ * static{
+ * validationRules.put("mandatory",true);
+ * validationRules.put("maxLength",60);
+ * }
+ * }
+ * </pre>
+ *
+ * The two rule "put" lines were generated by the sdk due to the {@link ValidationRule} annotations on AbstractFormField
+ * and AbstractStringField
+ * <p>
+ * The scout server (runtime) checks all inbound and outbound form datas and form fields according to their
+ * validationRules defined in the shared FormData classes (central validation concept).
+ * <p>
+ * Custom validation rule names can freely be used (it's a String or a string constant).
+ * <p>
+ * Validation is implemented by either (a) overriding ServiceTunnelServlet#runServerJobTransactionWithDelegate with an
+ * own DefaultTransactionDelegate subclass) that overrides the filterInput() method or (b) annotating service operation
+ * methods with {@link InputValidation} and (optionally) {@link OutputValidation}.
+ * <p>
+ * When the sdk fails to create a rule for an annotated (directly or implicit by superclass) method to the created form
+ * data it adds a javadoc entry specifying the fully qualified source method name and the keyword
+ * "not processed ValidationRule" that can be searched in the source code or in the task list as upper case xxx.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.METHOD})
+public @interface ValidationRule {
+ /**
+ * the name of the rule, either any of the ValidationRule constants or a custom constant
+ */
+ String value();
+
+ /**
+ * When setting this annotation property, the scout sdk will not generate the validation rule value based on the
+ * method return value but
+ * use exactly this string as generated source code.
+ * <p>
+ * Example:
+ *
+ * <pre>
+ * @ValidationRule(value=ValidationRule.CODE_TYPE, generatedSourceCode="com.myproject.shared.services.code.StatusCodeType.class")
+ * Class <? extends {@link ICodeType}> getConfiguredCodeType(){
+ * return ClientSpecificStatusCodeType.class;
+ * }
+ * </pre>
+ */
+ String generatedSourceCode() default "";
+
+ /**
+ * When setting skip to true, the scout sdk will not generate code for this validation rule at all.
+ * Example:
+ *
+ * <pre>
+ * @ValidationRule(value=ValidationRule.CODE_TYPE, skip=true)
+ * Class <? extends {@link ICodeType}> getConfiguredCodeType(){
+ * return ClientSpecificStatusCodeType.class;
+ * }
+ * </pre>
+ */
+ boolean skip() default false;
+
+ /**
+ * rule value type is {@link Boolean}
+ * <p>
+ * default rule packaged with scout
+ */
+ String MANDATORY = "mandatory";
+ /**
+ * rule value type is {@link Number}
+ * <p>
+ * default rule packaged with scout
+ */
+ String MIN_VALUE = "minValue";
+ /**
+ * rule value type is {@link Number}
+ * <p>
+ * default rule packaged with scout
+ */
+ String MAX_VALUE = "maxValue";
+ /**
+ * rule value type is {@link Integer}
+ * <p>
+ * default rule packaged with scout
+ */
+ String MIN_LENGTH = "minLength";
+ /**
+ * rule value type is {@link Integer}
+ * <p>
+ * default rule packaged with scout
+ */
+ String MAX_LENGTH = "maxLength";
+ /**
+ * rule value type is {@link Class}
+ * <p>
+ * default rule packaged with scout
+ */
+ String CODE_TYPE = "codeType";
+ /**
+ * rule value type is {@link Class}
+ * <p>
+ * default rule packaged with scout
+ */
+ String LOOKUP_CALL = "lookupCall";
+ /**
+ * rule value type is {@link String}
+ * <p>
+ * Server checks if the string value (if not null) matches the regex Use {@link #generatedSourceCode()} attribute to
+ * specify explicit regex. The regex is case insensitive {@link Pattern#CASE_INSENSITIVE} and scans full-text over
+ * multiple lines {@link Pattern#DOTALL}.
+ * <p>
+ * see {@link ValidationUtility#checkValueMatchesRegex(String, Object, Object)}
+ * <p>
+ * default rule packaged with scout
+ */
+ String REGEX = "regex";
+ /**
+ * rule value type is Class<? extends {@link AbstractFormFieldData}> that is translated by the sdk from its
+ * corresponding form field type
+ * <p>
+ * The master field of this field, often used as part of {@link LookupCall#setMaster(Object)} using the value
+ * <p>
+ * default rule packaged with scout
+ */
+ String MASTER_VALUE_FIELD = "masterValueField";
+ /**
+ * rule value type is {@link Boolean}
+ * <p>
+ * If the master field is required and null and this field is not null, this is a fault
+ * <p>
+ * default rule packaged with scout
+ */
+ String MASTER_VALUE_REQUIRED = "masterValueRequired";
+ /**
+ * rule value type is {@link Boolean}
+ * <p>
+ * If rule value is true, 0 (zero) is treated null, thus no code type or lookup call validation occurs for value 0
+ * (same treatment as for null) and a mandatory field providing 0 as value will be rejected. In opposite, a rule value
+ * of false will cause the code type / lookup call validation to be executed and the mandatory field check will accept
+ * an input value of 0.
+ * </p>
+ * default rule packaged with scout
+ */
+ String ZERO_NULL_EQUALITY = "zeroNullEquality";
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/fields/AbstractFormFieldData.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/fields/AbstractFormFieldData.java
index 32de9cb6a7..4a098a190e 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/fields/AbstractFormFieldData.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/fields/AbstractFormFieldData.java
@@ -1,170 +1,170 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.data.form.fields;
-
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.scout.commons.ConfigurationUtility;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.shared.data.form.FormDataUtility;
-import org.eclipse.scout.rt.shared.data.form.properties.AbstractPropertyData;
-
-public abstract class AbstractFormFieldData implements Serializable {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractFormFieldData.class);
- private static final long serialVersionUID = 1L;
-
- private Map<Class<? extends AbstractPropertyData>, AbstractPropertyData> m_propertyMap;
- private Map<Class<? extends AbstractFormFieldData>, AbstractFormFieldData> m_fieldMap;
- private boolean m_valueSet;
-
- public AbstractFormFieldData() {
- initConfig();
- }
-
- private Class<? extends AbstractPropertyData>[] getConfiguredPropertyDatas() {
- Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
- return ConfigurationUtility.filterClasses(dca, AbstractPropertyData.class);
- }
-
- private Class<? extends AbstractFormFieldData>[] getConfiguredFieldDatas() {
- Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
- return ConfigurationUtility.filterClasses(dca, AbstractFormFieldData.class);
- }
-
- protected void initConfig() {
- // add properties
- m_propertyMap = new HashMap<Class<? extends AbstractPropertyData>, AbstractPropertyData>();
- Class<? extends AbstractPropertyData>[] propArray = getConfiguredPropertyDatas();
- for (int i = 0; i < propArray.length; i++) {
- AbstractPropertyData p;
- try {
- p = ConfigurationUtility.newInnerInstance(this, propArray[i]);
- m_propertyMap.put(p.getClass(), p);
- }// end try
- catch (Exception e) {
- LOG.warn(null, e);
- }
- }// end for
- // add fields
- HashMap<Class<? extends AbstractFormFieldData>, AbstractFormFieldData> map = new HashMap<Class<? extends AbstractFormFieldData>, AbstractFormFieldData>();
- Class<? extends AbstractFormFieldData>[] fieldArray = getConfiguredFieldDatas();
- for (int i = 0; i < fieldArray.length; i++) {
- AbstractFormFieldData f;
- try {
- f = ConfigurationUtility.newInnerInstance(this, fieldArray[i]);
- map.put(f.getClass(), f);
- }// end try
- catch (Exception e) {
- LOG.warn(null, e);
- }
- }// end for
- if (map.size() > 0) {
- m_fieldMap = map;
- }
- }
-
- public Map<String/*rule name*/, Object/*rule value*/> getValidationRules() {
- HashMap<String, Object> ruleMap = new HashMap<String, Object>();
- initValidationRules(ruleMap);
- return ruleMap;
- }
-
- protected void initValidationRules(Map<String/*rule name*/, Object/*rule value*/> ruleMap) {
- }
-
- public String getFieldId() {
- String s = getClass().getName();
- int i = Math.max(s.lastIndexOf('$'), s.lastIndexOf('.'));
- s = s.substring(i + 1);
- return s;
- }
-
- public boolean isValueSet() {
- return m_valueSet;
- }
-
- public void setValueSet(boolean b) {
- m_valueSet = b;
- }
-
- public AbstractPropertyData getPropertyById(String id) {
- for (AbstractPropertyData p : m_propertyMap.values()) {
- if (p.getPropertyId().equalsIgnoreCase(id)) {
- return p;
- }
- }
- return null;
- }
-
- @SuppressWarnings("unchecked")
- public <T extends AbstractPropertyData> T getPropertyByClass(Class<T> c) {
- return (T) m_propertyMap.get(c);
- }
-
- public <T extends AbstractPropertyData> void setPropertyByClass(Class<T> c, T v) {
- if (v == null) {
- m_propertyMap.remove(c);
- }
- else {
- m_propertyMap.put(c, v);
- }
- }
-
- public AbstractPropertyData[] getAllProperties() {
- return m_propertyMap != null ? m_propertyMap.values().toArray(new AbstractPropertyData[m_propertyMap.size()]) : new AbstractPropertyData[0];
- }
-
- public AbstractFormFieldData getFieldById(String id) {
- String fieldDataId = FormDataUtility.getFieldDataId(id);
- if (m_fieldMap == null) {
- return null;
- }
- for (AbstractFormFieldData f : m_fieldMap.values()) {
- if (f.getFieldId().equals(fieldDataId)) {
- return f;
- }
- }
- return null;
- }
-
- @SuppressWarnings("unchecked")
- public <T extends AbstractFormFieldData> T getFieldByClass(Class<T> c) {
- if (m_fieldMap == null) {
- return null;
- }
- return (T) m_fieldMap.get(c);
- }
-
- public <T extends AbstractFormFieldData> void setFieldByClass(Class<T> c, T v) {
- if (v == null) {
- if (m_fieldMap != null) {
- m_fieldMap.remove(c);
- }
- }
- else {
- if (m_fieldMap == null) {
- m_fieldMap = new HashMap<Class<? extends AbstractFormFieldData>, AbstractFormFieldData>();
- }
- m_fieldMap.put(c, v);
- }
- }
-
- public AbstractFormFieldData[] getFields() {
- if (m_fieldMap == null) {
- return new AbstractFormFieldData[0];
- }
- return m_fieldMap.values().toArray(new AbstractFormFieldData[m_fieldMap.size()]);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.data.form.fields;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.scout.commons.ConfigurationUtility;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.shared.data.form.FormDataUtility;
+import org.eclipse.scout.rt.shared.data.form.properties.AbstractPropertyData;
+
+public abstract class AbstractFormFieldData implements Serializable {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractFormFieldData.class);
+ private static final long serialVersionUID = 1L;
+
+ private Map<Class<? extends AbstractPropertyData>, AbstractPropertyData> m_propertyMap;
+ private Map<Class<? extends AbstractFormFieldData>, AbstractFormFieldData> m_fieldMap;
+ private boolean m_valueSet;
+
+ public AbstractFormFieldData() {
+ initConfig();
+ }
+
+ private Class<? extends AbstractPropertyData>[] getConfiguredPropertyDatas() {
+ Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
+ return ConfigurationUtility.filterClasses(dca, AbstractPropertyData.class);
+ }
+
+ private Class<? extends AbstractFormFieldData>[] getConfiguredFieldDatas() {
+ Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
+ return ConfigurationUtility.filterClasses(dca, AbstractFormFieldData.class);
+ }
+
+ protected void initConfig() {
+ // add properties
+ m_propertyMap = new HashMap<Class<? extends AbstractPropertyData>, AbstractPropertyData>();
+ Class<? extends AbstractPropertyData>[] propArray = getConfiguredPropertyDatas();
+ for (int i = 0; i < propArray.length; i++) {
+ AbstractPropertyData p;
+ try {
+ p = ConfigurationUtility.newInnerInstance(this, propArray[i]);
+ m_propertyMap.put(p.getClass(), p);
+ }// end try
+ catch (Exception e) {
+ LOG.warn(null, e);
+ }
+ }// end for
+ // add fields
+ HashMap<Class<? extends AbstractFormFieldData>, AbstractFormFieldData> map = new HashMap<Class<? extends AbstractFormFieldData>, AbstractFormFieldData>();
+ Class<? extends AbstractFormFieldData>[] fieldArray = getConfiguredFieldDatas();
+ for (int i = 0; i < fieldArray.length; i++) {
+ AbstractFormFieldData f;
+ try {
+ f = ConfigurationUtility.newInnerInstance(this, fieldArray[i]);
+ map.put(f.getClass(), f);
+ }// end try
+ catch (Exception e) {
+ LOG.warn(null, e);
+ }
+ }// end for
+ if (map.size() > 0) {
+ m_fieldMap = map;
+ }
+ }
+
+ public Map<String/*rule name*/, Object/*rule value*/> getValidationRules() {
+ HashMap<String, Object> ruleMap = new HashMap<String, Object>();
+ initValidationRules(ruleMap);
+ return ruleMap;
+ }
+
+ protected void initValidationRules(Map<String/*rule name*/, Object/*rule value*/> ruleMap) {
+ }
+
+ public String getFieldId() {
+ String s = getClass().getName();
+ int i = Math.max(s.lastIndexOf('$'), s.lastIndexOf('.'));
+ s = s.substring(i + 1);
+ return s;
+ }
+
+ public boolean isValueSet() {
+ return m_valueSet;
+ }
+
+ public void setValueSet(boolean b) {
+ m_valueSet = b;
+ }
+
+ public AbstractPropertyData getPropertyById(String id) {
+ for (AbstractPropertyData p : m_propertyMap.values()) {
+ if (p.getPropertyId().equalsIgnoreCase(id)) {
+ return p;
+ }
+ }
+ return null;
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T extends AbstractPropertyData> T getPropertyByClass(Class<T> c) {
+ return (T) m_propertyMap.get(c);
+ }
+
+ public <T extends AbstractPropertyData> void setPropertyByClass(Class<T> c, T v) {
+ if (v == null) {
+ m_propertyMap.remove(c);
+ }
+ else {
+ m_propertyMap.put(c, v);
+ }
+ }
+
+ public AbstractPropertyData[] getAllProperties() {
+ return m_propertyMap != null ? m_propertyMap.values().toArray(new AbstractPropertyData[m_propertyMap.size()]) : new AbstractPropertyData[0];
+ }
+
+ public AbstractFormFieldData getFieldById(String id) {
+ String fieldDataId = FormDataUtility.getFieldDataId(id);
+ if (m_fieldMap == null) {
+ return null;
+ }
+ for (AbstractFormFieldData f : m_fieldMap.values()) {
+ if (f.getFieldId().equals(fieldDataId)) {
+ return f;
+ }
+ }
+ return null;
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T extends AbstractFormFieldData> T getFieldByClass(Class<T> c) {
+ if (m_fieldMap == null) {
+ return null;
+ }
+ return (T) m_fieldMap.get(c);
+ }
+
+ public <T extends AbstractFormFieldData> void setFieldByClass(Class<T> c, T v) {
+ if (v == null) {
+ if (m_fieldMap != null) {
+ m_fieldMap.remove(c);
+ }
+ }
+ else {
+ if (m_fieldMap == null) {
+ m_fieldMap = new HashMap<Class<? extends AbstractFormFieldData>, AbstractFormFieldData>();
+ }
+ m_fieldMap.put(c, v);
+ }
+ }
+
+ public AbstractFormFieldData[] getFields() {
+ if (m_fieldMap == null) {
+ return new AbstractFormFieldData[0];
+ }
+ return m_fieldMap.values().toArray(new AbstractFormFieldData[m_fieldMap.size()]);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/fields/AbstractUTCFieldData.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/fields/AbstractUTCFieldData.java
index 1a3c52d3cd..6cf91b192a 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/fields/AbstractUTCFieldData.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/fields/AbstractUTCFieldData.java
@@ -1,20 +1,20 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.data.form.fields;
-
-import org.eclipse.scout.commons.UTCDate;
-
-public abstract class AbstractUTCFieldData extends AbstractValueFieldData<UTCDate> {
- private static final long serialVersionUID = 1L;
-
- public AbstractUTCFieldData() {
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.data.form.fields;
+
+import org.eclipse.scout.commons.UTCDate;
+
+public abstract class AbstractUTCFieldData extends AbstractValueFieldData<UTCDate> {
+ private static final long serialVersionUID = 1L;
+
+ public AbstractUTCFieldData() {
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/fields/AbstractValueFieldData.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/fields/AbstractValueFieldData.java
index 260c9eefba..42bb367379 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/fields/AbstractValueFieldData.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/fields/AbstractValueFieldData.java
@@ -1,63 +1,63 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.data.form.fields;
-
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.Serializable;
-
-import org.eclipse.scout.commons.TypeCastUtility;
-import org.eclipse.scout.commons.holders.IHolder;
-
-public abstract class AbstractValueFieldData<T> extends AbstractFormFieldData implements IHolder<T>, Serializable {
- private static final long serialVersionUID = 1L;
-
- private T m_value;
-
- public AbstractValueFieldData() {
- super();
- }
-
- @Override
- public T getValue() {
- return m_value;
- }
-
- @Override
- public void setValue(T o) {
- m_value = o;
- setValueSet(true);
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public Class<T> getHolderType() {
- return TypeCastUtility.getGenericsParameterClass(getClass(), IHolder.class);
- }
-
- /**
- * readObject is implemented to validate potential security attacks that invalidated the value type
- */
- private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException {
- s.defaultReadObject();
- //verify if valueSet and the type of the value are valid and consistent
- if (!isValueSet()) {
- m_value = null;
- }
- if (m_value == null) {
- return;
- }
- if (!getHolderType().isAssignableFrom(m_value.getClass())) {
- throw new SecurityException("value is of inconsistent type; potential value corruption attack");
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.data.form.fields;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.Serializable;
+
+import org.eclipse.scout.commons.TypeCastUtility;
+import org.eclipse.scout.commons.holders.IHolder;
+
+public abstract class AbstractValueFieldData<T> extends AbstractFormFieldData implements IHolder<T>, Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private T m_value;
+
+ public AbstractValueFieldData() {
+ super();
+ }
+
+ @Override
+ public T getValue() {
+ return m_value;
+ }
+
+ @Override
+ public void setValue(T o) {
+ m_value = o;
+ setValueSet(true);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Class<T> getHolderType() {
+ return TypeCastUtility.getGenericsParameterClass(getClass(), IHolder.class);
+ }
+
+ /**
+ * readObject is implemented to validate potential security attacks that invalidated the value type
+ */
+ private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException {
+ s.defaultReadObject();
+ //verify if valueSet and the type of the value are valid and consistent
+ if (!isValueSet()) {
+ m_value = null;
+ }
+ if (m_value == null) {
+ return;
+ }
+ if (!getHolderType().isAssignableFrom(m_value.getClass())) {
+ throw new SecurityException("value is of inconsistent type; potential value corruption attack");
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/fields/composer/AbstractComposerData.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/fields/composer/AbstractComposerData.java
index 04421c3e7e..44db657016 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/fields/composer/AbstractComposerData.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/fields/composer/AbstractComposerData.java
@@ -1,27 +1,27 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.data.form.fields.composer;
-
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.shared.data.form.fields.treefield.AbstractTreeFieldData;
-
-/**
- * Data representation for a composer tree field
- */
-public abstract class AbstractComposerData extends AbstractTreeFieldData {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractComposerData.class);
- private static final long serialVersionUID = 1L;
-
- public AbstractComposerData() {
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.data.form.fields.composer;
+
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.shared.data.form.fields.treefield.AbstractTreeFieldData;
+
+/**
+ * Data representation for a composer tree field
+ */
+public abstract class AbstractComposerData extends AbstractTreeFieldData {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractComposerData.class);
+ private static final long serialVersionUID = 1L;
+
+ public AbstractComposerData() {
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/fields/composer/ComposerAttributeNodeData.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/fields/composer/ComposerAttributeNodeData.java
index 5122223550..489f0b9b82 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/fields/composer/ComposerAttributeNodeData.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/fields/composer/ComposerAttributeNodeData.java
@@ -1,73 +1,73 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.data.form.fields.composer;
-
-import org.eclipse.scout.rt.shared.data.form.fields.treefield.TreeNodeData;
-import org.eclipse.scout.rt.shared.data.model.DataModelConstants;
-
-/**
- * Data representation for a composer attribute value instance in a {@link AbstractComposerData}
- */
-public class ComposerAttributeNodeData extends TreeNodeData implements DataModelConstants {
- private static final long serialVersionUID = 1L;
-
- private String m_attributeExternalId;
- private int m_operator;
- private Integer m_aggregationType;
- private boolean m_negated = false;
-
- public ComposerAttributeNodeData() {
- }
-
- public String getAttributeExternalId() {
- return m_attributeExternalId;
- }
-
- public void setAttributeExternalId(String attributeExternalId) {
- m_attributeExternalId = attributeExternalId;
- }
-
- /**
- * any of the {@link ComposerConstants}.OPERATOR_* values
- */
- public int getOperator() {
- return m_operator;
- }
-
- /**
- * any of the {@link ComposerConstants}.OPERATOR_* values
- */
- public void setOperator(int operation) {
- m_operator = operation;
- }
-
- /**
- * any of the {@link ComposerConstants}.AGGREGATION_* values
- */
- public Integer getAggregationType() {
- return m_aggregationType;
- }
-
- /**
- * any of the {@link ComposerConstants}.AGGREGATION_* values
- */
- public void setAggregationType(Integer aggregationType) {
- m_aggregationType = aggregationType;
- }
-
- public boolean isNegative() {
- return m_negated;
- }
-
- public void setNegative(boolean b) {
- m_negated = b;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.data.form.fields.composer;
+
+import org.eclipse.scout.rt.shared.data.form.fields.treefield.TreeNodeData;
+import org.eclipse.scout.rt.shared.data.model.DataModelConstants;
+
+/**
+ * Data representation for a composer attribute value instance in a {@link AbstractComposerData}
+ */
+public class ComposerAttributeNodeData extends TreeNodeData implements DataModelConstants {
+ private static final long serialVersionUID = 1L;
+
+ private String m_attributeExternalId;
+ private int m_operator;
+ private Integer m_aggregationType;
+ private boolean m_negated = false;
+
+ public ComposerAttributeNodeData() {
+ }
+
+ public String getAttributeExternalId() {
+ return m_attributeExternalId;
+ }
+
+ public void setAttributeExternalId(String attributeExternalId) {
+ m_attributeExternalId = attributeExternalId;
+ }
+
+ /**
+ * any of the {@link ComposerConstants}.OPERATOR_* values
+ */
+ public int getOperator() {
+ return m_operator;
+ }
+
+ /**
+ * any of the {@link ComposerConstants}.OPERATOR_* values
+ */
+ public void setOperator(int operation) {
+ m_operator = operation;
+ }
+
+ /**
+ * any of the {@link ComposerConstants}.AGGREGATION_* values
+ */
+ public Integer getAggregationType() {
+ return m_aggregationType;
+ }
+
+ /**
+ * any of the {@link ComposerConstants}.AGGREGATION_* values
+ */
+ public void setAggregationType(Integer aggregationType) {
+ m_aggregationType = aggregationType;
+ }
+
+ public boolean isNegative() {
+ return m_negated;
+ }
+
+ public void setNegative(boolean b) {
+ m_negated = b;
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/fields/composer/ComposerConstants.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/fields/composer/ComposerConstants.java
index f883598263..9104077ceb 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/fields/composer/ComposerConstants.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/fields/composer/ComposerConstants.java
@@ -1,21 +1,21 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.data.form.fields.composer;
-
-import org.eclipse.scout.rt.shared.data.model.DataModelConstants;
-
-/**
- * @deprecated use {@link DataModelConstants}
- */
-@Deprecated
-public interface ComposerConstants extends DataModelConstants {
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.data.form.fields.composer;
+
+import org.eclipse.scout.rt.shared.data.model.DataModelConstants;
+
+/**
+ * @deprecated use {@link DataModelConstants}
+ */
+@Deprecated
+public interface ComposerConstants extends DataModelConstants {
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/fields/composer/ComposerEitherOrNodeData.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/fields/composer/ComposerEitherOrNodeData.java
index 37946b9f9e..951937c8d6 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/fields/composer/ComposerEitherOrNodeData.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/fields/composer/ComposerEitherOrNodeData.java
@@ -1,42 +1,42 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.data.form.fields.composer;
-
-import org.eclipse.scout.rt.shared.data.form.fields.treefield.TreeNodeData;
-
-/**
- * Data representation for a composer either/or value instance in a {@link AbstractComposerData}
- */
-public class ComposerEitherOrNodeData extends TreeNodeData {
- private static final long serialVersionUID = 1L;
-
- private boolean m_beginOfEitherOr;
- private boolean m_negated = false;
-
- public ComposerEitherOrNodeData() {
- }
-
- public boolean isBeginOfEitherOr() {
- return m_beginOfEitherOr;
- }
-
- public void setBeginOfEitherOr(boolean beginOfEitherOr) {
- m_beginOfEitherOr = beginOfEitherOr;
- }
-
- public boolean isNegative() {
- return m_negated;
- }
-
- public void setNegative(boolean b) {
- m_negated = b;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.data.form.fields.composer;
+
+import org.eclipse.scout.rt.shared.data.form.fields.treefield.TreeNodeData;
+
+/**
+ * Data representation for a composer either/or value instance in a {@link AbstractComposerData}
+ */
+public class ComposerEitherOrNodeData extends TreeNodeData {
+ private static final long serialVersionUID = 1L;
+
+ private boolean m_beginOfEitherOr;
+ private boolean m_negated = false;
+
+ public ComposerEitherOrNodeData() {
+ }
+
+ public boolean isBeginOfEitherOr() {
+ return m_beginOfEitherOr;
+ }
+
+ public void setBeginOfEitherOr(boolean beginOfEitherOr) {
+ m_beginOfEitherOr = beginOfEitherOr;
+ }
+
+ public boolean isNegative() {
+ return m_negated;
+ }
+
+ public void setNegative(boolean b) {
+ m_negated = b;
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/fields/composer/ComposerEntityNodeData.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/fields/composer/ComposerEntityNodeData.java
index 5680c7e0e8..da11228f8a 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/fields/composer/ComposerEntityNodeData.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/fields/composer/ComposerEntityNodeData.java
@@ -1,70 +1,70 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.data.form.fields.composer;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.scout.rt.shared.data.form.fields.treefield.TreeNodeData;
-
-/**
- * Data representation for a composer entity value instance in a {@link AbstractComposerData}
- */
-public class ComposerEntityNodeData extends TreeNodeData {
- private static final long serialVersionUID = 1L;
-
- private String m_entityExternalId;
- private boolean m_negated = false;
- private String m_alias;
-
- public ComposerEntityNodeData() {
- }
-
- public String getEntityExternalId() {
- return m_entityExternalId;
- }
-
- public void setEntityExternalId(String entityExternalId) {
- m_entityExternalId = entityExternalId;
- }
-
- /**
- * @return all attributes contained in the subtree of this entity that are part of this entity
- * <p>
- * This includes all direct attributes and all attributes under either/or nodes.
- * <p>
- * This excludes all other child entities and their attributes.
- */
- public List<ComposerAttributeNodeData> getContainingAttributeNodes() {
- List<ComposerAttributeNodeData> list = new ArrayList<ComposerAttributeNodeData>();
- visitContainingAttributeNodesRec(this, list);
- return list;
- }
-
- private void visitContainingAttributeNodesRec(TreeNodeData node, List<ComposerAttributeNodeData> list) {
- for (TreeNodeData child : node.getChildNodes()) {
- if (child instanceof ComposerAttributeNodeData) {
- list.add((ComposerAttributeNodeData) child);
- }
- else if (child instanceof ComposerEitherOrNodeData) {
- visitContainingAttributeNodesRec(child, list);
- }
- }
- }
-
- public boolean isNegative() {
- return m_negated;
- }
-
- public void setNegative(boolean b) {
- m_negated = b;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.data.form.fields.composer;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.scout.rt.shared.data.form.fields.treefield.TreeNodeData;
+
+/**
+ * Data representation for a composer entity value instance in a {@link AbstractComposerData}
+ */
+public class ComposerEntityNodeData extends TreeNodeData {
+ private static final long serialVersionUID = 1L;
+
+ private String m_entityExternalId;
+ private boolean m_negated = false;
+ private String m_alias;
+
+ public ComposerEntityNodeData() {
+ }
+
+ public String getEntityExternalId() {
+ return m_entityExternalId;
+ }
+
+ public void setEntityExternalId(String entityExternalId) {
+ m_entityExternalId = entityExternalId;
+ }
+
+ /**
+ * @return all attributes contained in the subtree of this entity that are part of this entity
+ * <p>
+ * This includes all direct attributes and all attributes under either/or nodes.
+ * <p>
+ * This excludes all other child entities and their attributes.
+ */
+ public List<ComposerAttributeNodeData> getContainingAttributeNodes() {
+ List<ComposerAttributeNodeData> list = new ArrayList<ComposerAttributeNodeData>();
+ visitContainingAttributeNodesRec(this, list);
+ return list;
+ }
+
+ private void visitContainingAttributeNodesRec(TreeNodeData node, List<ComposerAttributeNodeData> list) {
+ for (TreeNodeData child : node.getChildNodes()) {
+ if (child instanceof ComposerAttributeNodeData) {
+ list.add((ComposerAttributeNodeData) child);
+ }
+ else if (child instanceof ComposerEitherOrNodeData) {
+ visitContainingAttributeNodesRec(child, list);
+ }
+ }
+ }
+
+ public boolean isNegative() {
+ return m_negated;
+ }
+
+ public void setNegative(boolean b) {
+ m_negated = b;
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/fields/tablefield/AbstractTableFieldData.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/fields/tablefield/AbstractTableFieldData.java
index cc27f05210..74fd13e88e 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/fields/tablefield/AbstractTableFieldData.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/fields/tablefield/AbstractTableFieldData.java
@@ -1,144 +1,144 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.data.form.fields.tablefield;
-
-import java.util.ArrayList;
-
-import org.eclipse.scout.commons.holders.ITableHolder;
-import org.eclipse.scout.rt.shared.data.form.fields.AbstractFormFieldData;
-
-public abstract class AbstractTableFieldData extends AbstractFormFieldData implements ITableHolder {
- private static final long serialVersionUID = 1L;
-
- private ArrayList<Object[]> m_rowList = new ArrayList<Object[]>();
-
- public AbstractTableFieldData() {
- }
-
- @Override
- protected void initConfig() {
- super.initConfig();
- }
-
- @Override
- public int getRowCount() {
- return m_rowList.size();
- }
-
- @Override
- public int getColumnCount() {
- return 0;
- }
-
- /**
- * Configurator will add column-named getters and setters for value access<br>
- * for example getCity(), getZip(), ...
- */
-
- /**
- * The configurator will delegate this getter to one of the above getters
- */
- @Override
- public Object getValueAt(int row, int column) {
- return null;
- }
-
- protected Object getValueInternal(int row, int column) {
- Object[] a = m_rowList.get(row);
- return a[column];
- }
-
- /**
- * The configurator will delegate this setter to one of the above setters
- */
- @Override
- public void setValueAt(int row, int column, Object value) {
- }
-
- protected void setValueInternal(int row, int column, Object value) {
- Object[] a = m_rowList.get(row);
- a[column] = value;
- setValueSet(true);
- }
-
- @Override
- public int getRowState(int row) {
- Number n = (Number) getValueInternal(row, getColumnCount());
- if (n != null) {
- return n.intValue();
- }
- else {
- return STATUS_NON_CHANGED;
- }
- }
-
- @Override
- public void setRowState(int row, int state) {
- setValueInternal(row, getColumnCount(), new Integer(state));
- }
-
- /**
- * sets all rows in the table data to a new state
- */
- public void setRowStates(int state) {
- for (int r = 0, n = getRowCount(); r < n; r++) {
- setRowState(r, state);
- }
- }
-
- @Override
- public int/* newIndex */addRow() {
- return addRow(STATUS_NON_CHANGED);
- }
-
- public int/* newIndex */addRow(int rowState) {
- return addRow(null, rowState);
- }
-
- public int/* newIndex */addRow(Object[] values) {
- return addRow(values, STATUS_NON_CHANGED);
- }
-
- public int/* newIndex */addRow(Object[] values, int rowState) {
- m_rowList.add(new Object[getColumnCount() + 1]);// +1 for status
- int newRowIndex = m_rowList.size() - 1;
- if (values != null) {
- for (int i = 0; i < values.length; i++) {
- setValueAt(newRowIndex, i, values[i]);
- }
- }
- setRowState(newRowIndex, rowState);
- setValueSet(true);
- return newRowIndex;
- }
-
- @Override
- public void ensureSize(int size) {
- while (m_rowList.size() < size) {
- addRow();
- }
- while (m_rowList.size() > size) {
- removeRow(m_rowList.size() - 1);
- }
- setValueSet(true);
- }
-
- public void removeRow(int index) {
- m_rowList.remove(index);
- setValueSet(true);
- }
-
- public void clearRows() {
- m_rowList.clear();
- setValueSet(true);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.data.form.fields.tablefield;
+
+import java.util.ArrayList;
+
+import org.eclipse.scout.commons.holders.ITableHolder;
+import org.eclipse.scout.rt.shared.data.form.fields.AbstractFormFieldData;
+
+public abstract class AbstractTableFieldData extends AbstractFormFieldData implements ITableHolder {
+ private static final long serialVersionUID = 1L;
+
+ private ArrayList<Object[]> m_rowList = new ArrayList<Object[]>();
+
+ public AbstractTableFieldData() {
+ }
+
+ @Override
+ protected void initConfig() {
+ super.initConfig();
+ }
+
+ @Override
+ public int getRowCount() {
+ return m_rowList.size();
+ }
+
+ @Override
+ public int getColumnCount() {
+ return 0;
+ }
+
+ /**
+ * Configurator will add column-named getters and setters for value access<br>
+ * for example getCity(), getZip(), ...
+ */
+
+ /**
+ * The configurator will delegate this getter to one of the above getters
+ */
+ @Override
+ public Object getValueAt(int row, int column) {
+ return null;
+ }
+
+ protected Object getValueInternal(int row, int column) {
+ Object[] a = m_rowList.get(row);
+ return a[column];
+ }
+
+ /**
+ * The configurator will delegate this setter to one of the above setters
+ */
+ @Override
+ public void setValueAt(int row, int column, Object value) {
+ }
+
+ protected void setValueInternal(int row, int column, Object value) {
+ Object[] a = m_rowList.get(row);
+ a[column] = value;
+ setValueSet(true);
+ }
+
+ @Override
+ public int getRowState(int row) {
+ Number n = (Number) getValueInternal(row, getColumnCount());
+ if (n != null) {
+ return n.intValue();
+ }
+ else {
+ return STATUS_NON_CHANGED;
+ }
+ }
+
+ @Override
+ public void setRowState(int row, int state) {
+ setValueInternal(row, getColumnCount(), new Integer(state));
+ }
+
+ /**
+ * sets all rows in the table data to a new state
+ */
+ public void setRowStates(int state) {
+ for (int r = 0, n = getRowCount(); r < n; r++) {
+ setRowState(r, state);
+ }
+ }
+
+ @Override
+ public int/* newIndex */addRow() {
+ return addRow(STATUS_NON_CHANGED);
+ }
+
+ public int/* newIndex */addRow(int rowState) {
+ return addRow(null, rowState);
+ }
+
+ public int/* newIndex */addRow(Object[] values) {
+ return addRow(values, STATUS_NON_CHANGED);
+ }
+
+ public int/* newIndex */addRow(Object[] values, int rowState) {
+ m_rowList.add(new Object[getColumnCount() + 1]);// +1 for status
+ int newRowIndex = m_rowList.size() - 1;
+ if (values != null) {
+ for (int i = 0; i < values.length; i++) {
+ setValueAt(newRowIndex, i, values[i]);
+ }
+ }
+ setRowState(newRowIndex, rowState);
+ setValueSet(true);
+ return newRowIndex;
+ }
+
+ @Override
+ public void ensureSize(int size) {
+ while (m_rowList.size() < size) {
+ addRow();
+ }
+ while (m_rowList.size() > size) {
+ removeRow(m_rowList.size() - 1);
+ }
+ setValueSet(true);
+ }
+
+ public void removeRow(int index) {
+ m_rowList.remove(index);
+ setValueSet(true);
+ }
+
+ public void clearRows() {
+ m_rowList.clear();
+ setValueSet(true);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/fields/treefield/AbstractTreeFieldData.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/fields/treefield/AbstractTreeFieldData.java
index f7d2fe14bc..92fe86d204 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/fields/treefield/AbstractTreeFieldData.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/fields/treefield/AbstractTreeFieldData.java
@@ -1,44 +1,44 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.data.form.fields.treefield;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.scout.rt.shared.data.form.fields.AbstractFormFieldData;
-
-public abstract class AbstractTreeFieldData extends AbstractFormFieldData {
- private static final long serialVersionUID = 1L;
-
- private ArrayList<TreeNodeData> m_rootList = new ArrayList<TreeNodeData>();
-
- public AbstractTreeFieldData() {
- }
-
- @Override
- protected void initConfig() {
- super.initConfig();
- }
-
- public int getRootCount() {
- return m_rootList.size();
- }
-
- public List<TreeNodeData> getRoots() {
- return m_rootList;
- }
-
- public void setRoots(List<TreeNodeData> rootList) {
- m_rootList = rootList != null ? new ArrayList<TreeNodeData>(rootList) : new ArrayList<TreeNodeData>(0);
- setValueSet(true);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.data.form.fields.treefield;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.scout.rt.shared.data.form.fields.AbstractFormFieldData;
+
+public abstract class AbstractTreeFieldData extends AbstractFormFieldData {
+ private static final long serialVersionUID = 1L;
+
+ private ArrayList<TreeNodeData> m_rootList = new ArrayList<TreeNodeData>();
+
+ public AbstractTreeFieldData() {
+ }
+
+ @Override
+ protected void initConfig() {
+ super.initConfig();
+ }
+
+ public int getRootCount() {
+ return m_rootList.size();
+ }
+
+ public List<TreeNodeData> getRoots() {
+ return m_rootList;
+ }
+
+ public void setRoots(List<TreeNodeData> rootList) {
+ m_rootList = rootList != null ? new ArrayList<TreeNodeData>(rootList) : new ArrayList<TreeNodeData>(0);
+ setValueSet(true);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/fields/treefield/TreeNodeData.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/fields/treefield/TreeNodeData.java
index 2734cd7542..899395985b 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/fields/treefield/TreeNodeData.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/fields/treefield/TreeNodeData.java
@@ -1,86 +1,86 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.data.form.fields.treefield;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Transfer object representing a node in a tree, used with a {@link AbstractTreeFieldData}
- */
-public class TreeNodeData implements Serializable, Cloneable {
- private static final long serialVersionUID = 1L;
-
- private TreeNodeData m_parentNode;
- private List<TreeNodeData> m_childNodes;
- private Object[] m_values;
- private String[] m_texts;
-
- public TreeNodeData() {
- m_childNodes = new ArrayList<TreeNodeData>(2);
- }
-
- @Override
- public Object clone() {
- try {
- TreeNodeData copy = (TreeNodeData) super.clone();
- if (this.m_childNodes != null) {
- copy.m_childNodes = new ArrayList<TreeNodeData>(this.m_childNodes.size());
- for (TreeNodeData n : this.m_childNodes) {
- copy.m_childNodes.add((TreeNodeData) n.clone());
- }
- }
- return copy;
- }
- catch (CloneNotSupportedException e) {
- throw new RuntimeException(e);
- }
- }
-
- public TreeNodeData getParentNode() {
- return m_parentNode;
- }
-
- public void setParentNode(TreeNodeData parentNode) {
- m_parentNode = parentNode;
- }
-
- public List<TreeNodeData> getChildNodes() {
- return m_childNodes;
- }
-
- public void setChildNodes(List<TreeNodeData> childNodes) {
- m_childNodes = childNodes;
- if (m_childNodes != null) {
- for (TreeNodeData n : m_childNodes) {
- n.setParentNode(this);
- }
- }
- }
-
- public Object[] getValues() {
- return m_values;
- }
-
- public void setValues(Object[] a) {
- m_values = a;
- }
-
- public String[] getTexts() {
- return m_texts;
- }
-
- public void setTexts(String[] a) {
- m_texts = a;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.data.form.fields.treefield;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Transfer object representing a node in a tree, used with a {@link AbstractTreeFieldData}
+ */
+public class TreeNodeData implements Serializable, Cloneable {
+ private static final long serialVersionUID = 1L;
+
+ private TreeNodeData m_parentNode;
+ private List<TreeNodeData> m_childNodes;
+ private Object[] m_values;
+ private String[] m_texts;
+
+ public TreeNodeData() {
+ m_childNodes = new ArrayList<TreeNodeData>(2);
+ }
+
+ @Override
+ public Object clone() {
+ try {
+ TreeNodeData copy = (TreeNodeData) super.clone();
+ if (this.m_childNodes != null) {
+ copy.m_childNodes = new ArrayList<TreeNodeData>(this.m_childNodes.size());
+ for (TreeNodeData n : this.m_childNodes) {
+ copy.m_childNodes.add((TreeNodeData) n.clone());
+ }
+ }
+ return copy;
+ }
+ catch (CloneNotSupportedException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public TreeNodeData getParentNode() {
+ return m_parentNode;
+ }
+
+ public void setParentNode(TreeNodeData parentNode) {
+ m_parentNode = parentNode;
+ }
+
+ public List<TreeNodeData> getChildNodes() {
+ return m_childNodes;
+ }
+
+ public void setChildNodes(List<TreeNodeData> childNodes) {
+ m_childNodes = childNodes;
+ if (m_childNodes != null) {
+ for (TreeNodeData n : m_childNodes) {
+ n.setParentNode(this);
+ }
+ }
+ }
+
+ public Object[] getValues() {
+ return m_values;
+ }
+
+ public void setValues(Object[] a) {
+ m_values = a;
+ }
+
+ public String[] getTexts() {
+ return m_texts;
+ }
+
+ public void setTexts(String[] a) {
+ m_texts = a;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/properties/AbstractPropertyData.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/properties/AbstractPropertyData.java
index e021df8c41..03c7491b21 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/properties/AbstractPropertyData.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/form/properties/AbstractPropertyData.java
@@ -1,80 +1,80 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.data.form.properties;
-
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.Serializable;
-
-import org.eclipse.scout.commons.TypeCastUtility;
-import org.eclipse.scout.commons.holders.IHolder;
-
-public abstract class AbstractPropertyData<T> implements IHolder<T>, Serializable {
- private static final long serialVersionUID = 1L;
-
- private T m_value;
- private boolean m_valueSet;
-
- public AbstractPropertyData() {
- super();
- }
-
- @Override
- public T getValue() {
- return m_value;
- }
-
- @Override
- public void setValue(T o) {
- m_value = o;
- setValueSet(true);
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public Class<T> getHolderType() {
- return TypeCastUtility.getGenericsParameterClass(getClass(), IHolder.class);
- }
-
- public boolean isValueSet() {
- return m_valueSet;
- }
-
- public void setValueSet(boolean b) {
- m_valueSet = b;
- }
-
- public String getPropertyId() {
- String s = getClass().getSimpleName();
- if (s.endsWith("Property")) {
- s = s.replaceAll("Property$", "");
- }
- return s;
- }
-
- /**
- * readObject is implemented to validate potential security attacks that invalidated the value type
- */
- private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException {
- s.defaultReadObject();
- //verify if valueSet and the type of the value are valid and consistent
- if (!m_valueSet) {
- m_value = null;
- }
- if (m_value == null) {
- return;
- }
- if (!getHolderType().isAssignableFrom(m_value.getClass())) {
- throw new SecurityException("value is of inconsistent type; potential value corruption attack");
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.data.form.properties;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.Serializable;
+
+import org.eclipse.scout.commons.TypeCastUtility;
+import org.eclipse.scout.commons.holders.IHolder;
+
+public abstract class AbstractPropertyData<T> implements IHolder<T>, Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private T m_value;
+ private boolean m_valueSet;
+
+ public AbstractPropertyData() {
+ super();
+ }
+
+ @Override
+ public T getValue() {
+ return m_value;
+ }
+
+ @Override
+ public void setValue(T o) {
+ m_value = o;
+ setValueSet(true);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Class<T> getHolderType() {
+ return TypeCastUtility.getGenericsParameterClass(getClass(), IHolder.class);
+ }
+
+ public boolean isValueSet() {
+ return m_valueSet;
+ }
+
+ public void setValueSet(boolean b) {
+ m_valueSet = b;
+ }
+
+ public String getPropertyId() {
+ String s = getClass().getSimpleName();
+ if (s.endsWith("Property")) {
+ s = s.replaceAll("Property$", "");
+ }
+ return s;
+ }
+
+ /**
+ * readObject is implemented to validate potential security attacks that invalidated the value type
+ */
+ private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException {
+ s.defaultReadObject();
+ //verify if valueSet and the type of the value are valid and consistent
+ if (!m_valueSet) {
+ m_value = null;
+ }
+ if (m_value == null) {
+ return;
+ }
+ if (!getHolderType().isAssignableFrom(m_value.getClass())) {
+ throw new SecurityException("value is of inconsistent type; potential value corruption attack");
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/AbstractDataModel.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/AbstractDataModel.java
index 383bafe595..a709dd8bff 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/AbstractDataModel.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/AbstractDataModel.java
@@ -1,146 +1,146 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.data.model;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.HashMap;
-
-import org.eclipse.scout.commons.ConfigurationUtility;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-
-public abstract class AbstractDataModel implements IDataModel, Serializable {
- private static final long serialVersionUID = 1L;
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractDataModel.class);
-
- private boolean m_calledInitializer;
- private IDataModelAttribute[] m_attributes;
- private IDataModelEntity[] m_entities;
-
- public AbstractDataModel() {
- this(true);
- }
-
- public AbstractDataModel(boolean callInitializer) {
- super();
- if (callInitializer) {
- callInitializer();
- }
- }
-
- protected void callInitializer() {
- if (!m_calledInitializer) {
- m_calledInitializer = true;
- initConfig();
- }
- }
-
- protected IDataModelAttribute[] createAttributes() {
- ArrayList<IDataModelAttribute> attributes = new ArrayList<IDataModelAttribute>();
- Class[] all = ConfigurationUtility.getDeclaredPublicClasses(getClass());
- for (Class<? extends IDataModelAttribute> c : ConfigurationUtility.sortFilteredClassesByOrderAnnotation(all, IDataModelAttribute.class)) {
- try {
- IDataModelAttribute a = ConfigurationUtility.newInnerInstance(this, c);
- attributes.add(a);
- }
- catch (Exception e) {
- LOG.warn(null, e);
- }
- }
- return attributes.toArray(new IDataModelAttribute[attributes.size()]);
- }
-
- protected IDataModelEntity[] createEntities() {
- ArrayList<IDataModelEntity> entities = new ArrayList<IDataModelEntity>();
- Class[] all = ConfigurationUtility.getDeclaredPublicClasses(getClass());
- for (Class<? extends IDataModelEntity> c : ConfigurationUtility.sortFilteredClassesByOrderAnnotation(all, IDataModelEntity.class)) {
- try {
- IDataModelEntity e = ConfigurationUtility.newInnerInstance(this, c);
- entities.add(e);
- }
- catch (Exception e) {
- LOG.warn(null, e);
- }
- }
- return entities.toArray(new IDataModelEntity[entities.size()]);
- }
-
- @SuppressWarnings("deprecation")
- protected void initConfig() {
- // attributes
- m_attributes = createAttributes();
- for (IDataModelAttribute a : m_attributes) {
- a.setParentEntity(null);
- }
- // entities
- m_entities = createEntities();
- HashMap<Class<? extends IDataModelEntity>, IDataModelEntity> instanceMap = new HashMap<Class<? extends IDataModelEntity>, IDataModelEntity>();
- for (IDataModelEntity e : m_entities) {
- e.setParentEntity(null);
- instanceMap.put(e.getClass(), e);
- }
- for (IDataModelEntity e : m_entities) {
- e.initializeChildEntities(instanceMap);
- }
- }
-
- @Override
- public void init() {
- //init tree structure
- for (IDataModelEntity e : getEntities()) {
- try {
- e.initEntity();
- }
- catch (Throwable t) {
- LOG.error("entity " + e, t);
- }
- }
- for (IDataModelAttribute a : getAttributes()) {
- try {
- a.initAttribute();
- }
- catch (Throwable t) {
- LOG.error("attribute " + a, t);
- }
- }
- }
-
- @Override
- public IDataModelAttribute[] getAttributes() {
- return m_attributes;
- }
-
- @Override
- public IDataModelEntity[] getEntities() {
- return m_entities;
- }
-
- @Override
- public IDataModelAttribute getAttribute(Class<? extends IDataModelAttribute> attributeClazz) {
- for (IDataModelAttribute attribute : m_attributes) {
- if (attribute.getClass() == attributeClazz) {
- return attribute;
- }
- }
- return null;
- }
-
- @Override
- public IDataModelEntity getEntity(Class<? extends IDataModelEntity> entityClazz) {
- for (IDataModelEntity entity : m_entities) {
- if (entity.getClass() == entityClazz) {
- return entity;
- }
- }
- return null;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.data.model;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import org.eclipse.scout.commons.ConfigurationUtility;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+
+public abstract class AbstractDataModel implements IDataModel, Serializable {
+ private static final long serialVersionUID = 1L;
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractDataModel.class);
+
+ private boolean m_calledInitializer;
+ private IDataModelAttribute[] m_attributes;
+ private IDataModelEntity[] m_entities;
+
+ public AbstractDataModel() {
+ this(true);
+ }
+
+ public AbstractDataModel(boolean callInitializer) {
+ super();
+ if (callInitializer) {
+ callInitializer();
+ }
+ }
+
+ protected void callInitializer() {
+ if (!m_calledInitializer) {
+ m_calledInitializer = true;
+ initConfig();
+ }
+ }
+
+ protected IDataModelAttribute[] createAttributes() {
+ ArrayList<IDataModelAttribute> attributes = new ArrayList<IDataModelAttribute>();
+ Class[] all = ConfigurationUtility.getDeclaredPublicClasses(getClass());
+ for (Class<? extends IDataModelAttribute> c : ConfigurationUtility.sortFilteredClassesByOrderAnnotation(all, IDataModelAttribute.class)) {
+ try {
+ IDataModelAttribute a = ConfigurationUtility.newInnerInstance(this, c);
+ attributes.add(a);
+ }
+ catch (Exception e) {
+ LOG.warn(null, e);
+ }
+ }
+ return attributes.toArray(new IDataModelAttribute[attributes.size()]);
+ }
+
+ protected IDataModelEntity[] createEntities() {
+ ArrayList<IDataModelEntity> entities = new ArrayList<IDataModelEntity>();
+ Class[] all = ConfigurationUtility.getDeclaredPublicClasses(getClass());
+ for (Class<? extends IDataModelEntity> c : ConfigurationUtility.sortFilteredClassesByOrderAnnotation(all, IDataModelEntity.class)) {
+ try {
+ IDataModelEntity e = ConfigurationUtility.newInnerInstance(this, c);
+ entities.add(e);
+ }
+ catch (Exception e) {
+ LOG.warn(null, e);
+ }
+ }
+ return entities.toArray(new IDataModelEntity[entities.size()]);
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void initConfig() {
+ // attributes
+ m_attributes = createAttributes();
+ for (IDataModelAttribute a : m_attributes) {
+ a.setParentEntity(null);
+ }
+ // entities
+ m_entities = createEntities();
+ HashMap<Class<? extends IDataModelEntity>, IDataModelEntity> instanceMap = new HashMap<Class<? extends IDataModelEntity>, IDataModelEntity>();
+ for (IDataModelEntity e : m_entities) {
+ e.setParentEntity(null);
+ instanceMap.put(e.getClass(), e);
+ }
+ for (IDataModelEntity e : m_entities) {
+ e.initializeChildEntities(instanceMap);
+ }
+ }
+
+ @Override
+ public void init() {
+ //init tree structure
+ for (IDataModelEntity e : getEntities()) {
+ try {
+ e.initEntity();
+ }
+ catch (Throwable t) {
+ LOG.error("entity " + e, t);
+ }
+ }
+ for (IDataModelAttribute a : getAttributes()) {
+ try {
+ a.initAttribute();
+ }
+ catch (Throwable t) {
+ LOG.error("attribute " + a, t);
+ }
+ }
+ }
+
+ @Override
+ public IDataModelAttribute[] getAttributes() {
+ return m_attributes;
+ }
+
+ @Override
+ public IDataModelEntity[] getEntities() {
+ return m_entities;
+ }
+
+ @Override
+ public IDataModelAttribute getAttribute(Class<? extends IDataModelAttribute> attributeClazz) {
+ for (IDataModelAttribute attribute : m_attributes) {
+ if (attribute.getClass() == attributeClazz) {
+ return attribute;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public IDataModelEntity getEntity(Class<? extends IDataModelEntity> entityClazz) {
+ for (IDataModelEntity entity : m_entities) {
+ if (entity.getClass() == entityClazz) {
+ return entity;
+ }
+ }
+ return null;
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/AbstractDataModelAttribute.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/AbstractDataModelAttribute.java
index 15180d2291..0fd5611a15 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/AbstractDataModelAttribute.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/AbstractDataModelAttribute.java
@@ -1,679 +1,679 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.data.model;
-
-import java.io.Serializable;
-import java.security.Permission;
-import java.text.DateFormat;
-import java.text.DecimalFormat;
-import java.text.NumberFormat;
-import java.util.Date;
-import java.util.Map;
-
-import org.eclipse.scout.commons.LocaleThreadLocal;
-import org.eclipse.scout.commons.TypeCastUtility;
-import org.eclipse.scout.commons.annotations.ConfigOperation;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.beans.AbstractPropertyObserver;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.shared.services.common.code.ICodeType;
-import org.eclipse.scout.rt.shared.services.common.security.IAccessControlService;
-import org.eclipse.scout.rt.shared.services.lookup.ICodeLookupCallFactoryService;
-import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
-import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
-import org.eclipse.scout.service.SERVICES;
-
-@SuppressWarnings("deprecation")
-public abstract class AbstractDataModelAttribute extends AbstractPropertyObserver implements IDataModelAttribute, DataModelConstants, Serializable {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractDataModelAttribute.class);
- private static final long serialVersionUID = 1L;
-
- private String m_id;
- private String m_text;
- private int m_type;
- private IDataModelAttributeOp[] m_operators;
- private int[] m_aggregationTypes;
- private String m_iconId;
- private boolean m_allowNullOperator;
- private boolean m_allowNotOperator;
- private boolean m_aggregationEnabled;
- private Class<? extends ICodeType> m_codeTypeClass;
- private LookupCall m_lookupCall;
- private Permission m_visiblePermission;
- private boolean m_visibleGranted;
- private boolean m_visibleProperty;
- private boolean m_visible;
- private boolean m_activeFilterEnabled;
- private IDataModelEntity m_parentEntity;
-
- public AbstractDataModelAttribute() {
- this(true);
- }
-
- /**
- * @param callInitConfig
- * true if {@link #callInitConfig()} should automcatically be invoked, false if the subclass invokes
- * {@link #callInitConfig()} itself
- */
- public AbstractDataModelAttribute(boolean callInitConfig) {
- if (callInitConfig) {
- callInitConfig();
- }
- }
-
- protected void callInitConfig() {
- initConfig();
- }
-
- /*
- * Configuration
- */
-
- @ConfigProperty(ConfigProperty.ICON_ID)
- @Order(10)
- @ConfigPropertyValue("null")
- protected String getConfiguredIconId() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.TEXT)
- @Order(20)
- @ConfigPropertyValue("null")
- protected String getConfiguredText() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.LOOKUP_CALL)
- @Order(30)
- @ConfigPropertyValue("null")
- protected Class<? extends LookupCall> getConfiguredLookupCall() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.CODE_TYPE)
- @Order(40)
- @ConfigPropertyValue("null")
- protected Class<? extends ICodeType> getConfiguredCodeType() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.COMPOSER_ATTRIBUTE_TYPE)
- @Order(70)
- @ConfigPropertyValue("TYPE_STRING")
- protected int getConfiguredType() {
- return TYPE_STRING;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(90)
- @ConfigPropertyValue("true")
- protected boolean getConfiguredNullOperatorEnabled() {
- return true;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(100)
- @ConfigPropertyValue("true")
- protected boolean getConfiguredNotOperatorEnabled() {
- return true;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(105)
- @ConfigPropertyValue("true")
- protected boolean getConfiguredAggregationEnabled() {
- return true;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(110)
- @ConfigPropertyValue("true")
- protected boolean getConfiguredVisible() {
- return true;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(120)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredActiveFilterEnabled() {
- return false;
- }
-
- @ConfigOperation
- @Order(10)
- protected void execInitAttribute() throws ProcessingException {
-
- }
-
- @ConfigOperation
- @Order(20)
- protected void execPrepareLookup(LookupCall call) throws ProcessingException {
- }
-
- @Override
- public Map<String, String> getMetaDataOfAttribute() {
- return null;
- }
-
- protected void initConfig() {
- m_visibleGranted = true;
- setNotOperatorEnabled(getConfiguredNotOperatorEnabled());
- setNullOperatorEnabled(getConfiguredNullOperatorEnabled());
- setAggregationEnabled(getConfiguredAggregationEnabled());
- setIconId(getConfiguredIconId());
- setText(getConfiguredText());
- setType(getConfiguredType());
- setVisible(getConfiguredVisible());
- setActiveFilterEnabled(getConfiguredActiveFilterEnabled());
-
- // code type
- if (getConfiguredCodeType() != null) {
- setCodeTypeClass(getConfiguredCodeType());
- }
- // lazy lookup decorator
- Class<? extends LookupCall> lsCls = getConfiguredLookupCall();
- if (lsCls != null) {
- LookupCall call;
- try {
- call = lsCls.newInstance();
- setLookupCall(call);
- }
- catch (Exception e) {
- LOG.warn(null, e);
- }
- }
- injectOperators();
- injectAggregationTypes();
- }
-
- /*
- * Runtime
- */
-
- protected void injectOperators() {
- new DataModelAttributeInjector().injectOperators(this);
- }
-
- protected void injectAggregationTypes() {
- new DataModelAttributeInjector().injectAggregationTypes(this);
- }
-
- @Override
- public final void initAttribute() throws ProcessingException {
- execInitAttribute();
- }
-
- @Override
- public void prepareLookup(LookupCall call) throws ProcessingException {
- execPrepareLookup(call);
- }
-
- @Override
- public String getText() {
- return m_text;
- }
-
- @Override
- public void setText(String s) {
- m_text = s;
- }
-
- @Override
- public int getType() {
- return m_type;
- }
-
- @Override
- public void setType(int i) {
- m_type = i;
- }
-
- @Override
- public String getIconId() {
- return m_iconId;
- }
-
- @Override
- public void setIconId(String s) {
- m_iconId = s;
- }
-
- @Override
- public IDataModelAttributeOp[] getOperators() {
- return m_operators;
- }
-
- @Override
- public void setOperators(IDataModelAttributeOp[] ops) {
- m_operators = ops;
- }
-
- @Override
- public int[] getAggregationTypes() {
- return m_aggregationTypes != null ? m_aggregationTypes : new int[0];
- }
-
- @Override
- public void setAggregationTypes(int[] aggregationTypes) {
- m_aggregationTypes = aggregationTypes;
- }
-
- @Override
- public boolean containsAggregationType(int agType) {
- if (m_aggregationTypes == null) {
- return false;
- }
- for (int i : m_aggregationTypes) {
- if (i == agType) {
- return true;
- }
- }
- return false;
- }
-
- @Override
- public boolean isNullOperatorEnabled() {
- return m_allowNullOperator;
- }
-
- @Override
- public void setNullOperatorEnabled(boolean b) {
- m_allowNullOperator = b;
- }
-
- @Override
- public boolean isAggregationEnabled() {
- return m_aggregationEnabled;
- }
-
- @Override
- public void setAggregationEnabled(boolean aggregationEnabled) {
- m_aggregationEnabled = aggregationEnabled;
- if (m_aggregationTypes != null) {
- injectAggregationTypes();
- }
- }
-
- @Override
- public boolean isNotOperatorEnabled() {
- return m_allowNotOperator;
- }
-
- @Override
- public void setNotOperatorEnabled(boolean b) {
- m_allowNotOperator = b;
- }
-
- @Override
- public Class<? extends ICodeType> getCodeTypeClass() {
- return m_codeTypeClass;
- }
-
- @Override
- public void setCodeTypeClass(Class<? extends ICodeType> codeTypeClass) {
- m_codeTypeClass = codeTypeClass;
- // create lookup service call
- m_lookupCall = null;
- if (m_codeTypeClass != null) {
- m_lookupCall = SERVICES.getService(ICodeLookupCallFactoryService.class).newInstance(m_codeTypeClass);
- }
- }
-
- @Override
- public LookupCall getLookupCall() {
- return m_lookupCall;
- }
-
- @Override
- public void setLookupCall(LookupCall call) {
- m_lookupCall = call;
- }
-
- @Override
- public Permission getVisiblePermission() {
- return m_visiblePermission;
- }
-
- @Override
- public void setVisiblePermission(Permission p) {
- m_visiblePermission = p;
- boolean b;
- if (p != null) {
- b = SERVICES.getService(IAccessControlService.class).checkPermission(p);
- }
- else {
- b = true;
- }
- setVisibleGranted(b);
- }
-
- @Override
- public boolean isVisibleGranted() {
- return m_visibleGranted;
- }
-
- @Override
- public void setVisibleGranted(boolean b) {
- m_visibleGranted = b;
- calculateVisible();
- }
-
- @Override
- public boolean isVisible() {
- return m_visible;
- }
-
- @Override
- public void setVisible(boolean b) {
- m_visibleProperty = b;
- calculateVisible();
- }
-
- @Override
- public void setActiveFilterEnabled(boolean active) {
- m_activeFilterEnabled = active;
- }
-
- @Override
- public boolean isActiveFilterEnabled() {
- return m_activeFilterEnabled;
- }
-
- @Override
- public IDataModelEntity getParentEntity() {
- return m_parentEntity;
- }
-
- @Override
- public void setParentEntity(IDataModelEntity parent) {
- m_parentEntity = parent;
- }
-
- /**
- * no access control for system buttons CANCEL and CLOSE
- */
- private void calculateVisible() {
- // access control
- m_visible = m_visibleGranted && m_visibleProperty;
- }
-
- @Override
- public boolean isMultiValued() {
- switch (getType()) {
- case DataModelConstants.TYPE_CODE_LIST:
- case DataModelConstants.TYPE_CODE_TREE:
- case DataModelConstants.TYPE_NUMBER_LIST:
- case DataModelConstants.TYPE_NUMBER_TREE: {
- return true;
- }
- }
- return false;
- }
-
- @Override
- public String formatValue(Object rawValue) {
- if (rawValue == null) {
- return formatNullValue();
- }
-
- switch (getType()) {
- case IDataModelAttribute.TYPE_CODE_LIST:
- case IDataModelAttribute.TYPE_CODE_TREE:
- case IDataModelAttribute.TYPE_NUMBER_LIST:
- case IDataModelAttribute.TYPE_NUMBER_TREE:
- case IDataModelAttribute.TYPE_SMART:
- return formatSmart(rawValue, getCodeTypeClass(), getLookupCall());
- case IDataModelAttribute.TYPE_DATE:
- return formatDate(rawValue, true, false);
- case IDataModelAttribute.TYPE_DATE_TIME:
- return formatDate(rawValue, true, true);
- case IDataModelAttribute.TYPE_TIME:
- return formatDate(rawValue, false, true);
- case IDataModelAttribute.TYPE_INTEGER:
- return formatInteger(rawValue, true);
- case IDataModelAttribute.TYPE_LONG:
- return formatLong(rawValue, true);
- case IDataModelAttribute.TYPE_DOUBLE:
- return formatDouble(rawValue, true, false);
- case IDataModelAttribute.TYPE_PLAIN_INTEGER:
- return formatInteger(rawValue, false);
- case IDataModelAttribute.TYPE_PLAIN_LONG:
- return formatLong(rawValue, false);
- case IDataModelAttribute.TYPE_PLAIN_DOUBLE:
- return formatDouble(rawValue, false, false);
- case IDataModelAttribute.TYPE_PERCENT:
- return formatDouble(rawValue, true, true);
- case IDataModelAttribute.TYPE_STRING:
- case IDataModelAttribute.TYPE_FULL_TEXT:
- return formatString(rawValue);
- default:
- return formatObject(rawValue);
- }
- }
-
- /**
- * Method is called in case the raw value is null.
- * This method may be overridden by subclass in order to provide a different formatted value for null values.
- *
- * @return null
- */
- protected String formatNullValue() {
- return null;
- }
-
- /**
- * Formats the raw value for the following attribute types:
- * <ul>
- * <li>{@link DataModelConstants#TYPE_DATE}</li>
- * <li>{@link DataModelConstants#TYPE_DATE_TIME}</li>
- * <li>{@link DataModelConstants#TYPE_TIME}</li>
- * </ul>
- *
- * @param rawValue
- * Raw value to format
- * @param hasDate
- * True if the formatted value should show the date.
- * @param hasTime
- * True if the formatted value should show the time.
- * @return Formatted value: raw value casted to Date, date format according to date & time specification
- */
- protected String formatDate(Object rawValue, boolean hasDate, boolean hasTime) {
- Date value = TypeCastUtility.castValue(rawValue, Date.class);
-
- DateFormat df = null;
- if (hasDate && !hasTime) {
- df = DateFormat.getDateInstance(DateFormat.MEDIUM, LocaleThreadLocal.get());
- }
- else if (!hasDate && hasTime) {
- df = DateFormat.getTimeInstance(DateFormat.SHORT, LocaleThreadLocal.get());
- }
- else {
- df = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, LocaleThreadLocal.get());
- }
- df.setLenient(true);
-
- return df.format(value);
- }
-
- /**
- * Formats the raw value for the following attribute types:
- * <ul>
- * <li>{@link DataModelConstants#TYPE_DOUBLE}</li>
- * <li>{@link DataModelConstants#TYPE_PLAIN_DOUBLE}</li>
- * <li>{@link DataModelConstants#TYPE_PERCENT}</li>
- * </ul>
- *
- * @param rawValue
- * Raw value to format
- * @param groupingUsed
- * True if grouping should be used for formatting
- * @param percent
- * True if a percent number format should be used for formatting
- * @return Formatted value: raw value casted to Double, number format with 2 fraction digits
- */
- protected String formatDouble(Object rawValue, boolean groupingUsed, boolean percent) {
- Double value = TypeCastUtility.castValue(rawValue, Double.class);
-
- NumberFormat fmt = null;
- if (percent) {
- fmt = NumberFormat.getPercentInstance(LocaleThreadLocal.get());
- }
- else {
- fmt = NumberFormat.getNumberInstance(LocaleThreadLocal.get());
- }
-
- if (fmt instanceof DecimalFormat) {
- ((DecimalFormat) fmt).setMultiplier(1);
- }
-
- fmt.setMinimumFractionDigits(2);
- fmt.setMaximumFractionDigits(2);
- fmt.setGroupingUsed(groupingUsed);
-
- return fmt.format(value);
- }
-
- /**
- * Formats the raw value for the following attribute types:
- * <ul>
- * <li>{@link DataModelConstants#TYPE_INTEGER}</li>
- * <li>{@link DataModelConstants#TYPE_PLAIN_INTEGER}</li>
- * </ul>
- *
- * @param rawValue
- * Raw value to format
- * @param groupingUsed
- * True if grouping should be used for formatting
- * @return Formatted value: raw value casted to Integer, number format with no fraction digits
- */
- protected String formatInteger(Object rawValue, boolean groupingUsed) {
- Integer value = TypeCastUtility.castValue(rawValue, Integer.class);
-
- NumberFormat fmt = NumberFormat.getNumberInstance(LocaleThreadLocal.get());
- fmt.setMinimumFractionDigits(0);
- fmt.setMaximumFractionDigits(0);
- fmt.setGroupingUsed(groupingUsed);
- return fmt.format(value);
- }
-
- /**
- * Formats the raw value for the following attribute types:
- * <ul>
- * <li>{@link DataModelConstants#TYPE_LONG}</li>
- * <li>{@link DataModelConstants#TYPE_PLAIN_LONG}</li>
- * </ul>
- *
- * @param rawValue
- * Raw value to format
- * @param groupingUsed
- * True if grouping should be used for formatting
- * @return Formatted value: raw value casted to Long, number format with no fraction digits
- */
- protected String formatLong(Object rawValue, boolean groupingUsed) {
- Long value = TypeCastUtility.castValue(rawValue, Long.class);
-
- NumberFormat fmt = NumberFormat.getNumberInstance(LocaleThreadLocal.get());
- fmt.setMinimumFractionDigits(0);
- fmt.setMaximumFractionDigits(0);
- fmt.setGroupingUsed(groupingUsed);
- return fmt.format(value);
- }
-
- /**
- * Formats the raw value for the following attribute types:
- * <ul>
- * <li>{@link DataModelConstants#TYPE_CODE_LIST}</li>
- * <li>{@link DataModelConstants#TYPE_CODE_TREE}</li>
- * <li>{@link DataModelConstants#TYPE_NUMBER_LIST}</li>
- * <li>{@link DataModelConstants#TYPE_NUMBER_TREE}</li>
- * <li>{@link DataModelConstants#TYPE_SMART}</li>
- * </ul>
- * If whether code type class nor lookup call is set, the return value will be null.
- * The method does not throw an exception. In case of failure, the return value is the empty string.
- *
- * @param rawValue
- * Raw value to format
- * @param codeTypeClass
- * Code type class
- * @param lookupCall
- * Lookup call (not used if code type class is set)
- * @return Formatted value: key is resolved by code type / lookup call
- */
- protected String formatSmart(Object rawValue, Class<? extends ICodeType> codeTypeClass, LookupCall lookupCall) {
- if (codeTypeClass == null && lookupCall == null) {
- return null;
- }
-
- LookupCall call;
- if (codeTypeClass != null) {
- call = SERVICES.getService(ICodeLookupCallFactoryService.class).newInstance(codeTypeClass);
- }
- else {
- call = (LookupCall) lookupCall.clone();
- }
-
- call.setKey(rawValue);
- call.setText(null);
- call.setAll(null);
- call.setRec(null);
-
- try {
- LookupRow[] result = call.getDataByKey();
- if (result.length == 1) {
- return result[0].getText();
- }
- else if (result.length > 1) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0; i < result.length; i++) {
- if (i > 0) {
- sb.append(", ");
- }
- sb.append(result[i].getText());
- }
- return sb.toString();
- }
- }
- catch (ProcessingException e) {
- LOG.warn("Execution of lookup call failed", e);
- }
- return "";
- }
-
- /**
- * Formats the raw value for the following attribute types and in case the type did not match any known types.
- * <ul>
- * <li>{@link DataModelConstants#TYPE_STRING}</li>
- * <li>{@link DataModelConstants#TYPE_FULL_TEXT}</li>
- * </ul>
- *
- * @param rawValue
- * Raw value to format
- * @return Formatted value: raw value is casted to String
- */
- protected String formatString(Object rawValue) {
- return TypeCastUtility.castValue(rawValue, String.class);
- }
-
- /**
- * Formats the raw value for unknown attribute types
- *
- * @param rawValue
- * Raw value to format
- * @return Formatted value: raw value is casted to String
- */
- protected String formatObject(Object rawValue) {
- return rawValue.toString();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.data.model;
+
+import java.io.Serializable;
+import java.security.Permission;
+import java.text.DateFormat;
+import java.text.DecimalFormat;
+import java.text.NumberFormat;
+import java.util.Date;
+import java.util.Map;
+
+import org.eclipse.scout.commons.LocaleThreadLocal;
+import org.eclipse.scout.commons.TypeCastUtility;
+import org.eclipse.scout.commons.annotations.ConfigOperation;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.beans.AbstractPropertyObserver;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.shared.services.common.code.ICodeType;
+import org.eclipse.scout.rt.shared.services.common.security.IAccessControlService;
+import org.eclipse.scout.rt.shared.services.lookup.ICodeLookupCallFactoryService;
+import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
+import org.eclipse.scout.rt.shared.services.lookup.LookupRow;
+import org.eclipse.scout.service.SERVICES;
+
+@SuppressWarnings("deprecation")
+public abstract class AbstractDataModelAttribute extends AbstractPropertyObserver implements IDataModelAttribute, DataModelConstants, Serializable {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractDataModelAttribute.class);
+ private static final long serialVersionUID = 1L;
+
+ private String m_id;
+ private String m_text;
+ private int m_type;
+ private IDataModelAttributeOp[] m_operators;
+ private int[] m_aggregationTypes;
+ private String m_iconId;
+ private boolean m_allowNullOperator;
+ private boolean m_allowNotOperator;
+ private boolean m_aggregationEnabled;
+ private Class<? extends ICodeType> m_codeTypeClass;
+ private LookupCall m_lookupCall;
+ private Permission m_visiblePermission;
+ private boolean m_visibleGranted;
+ private boolean m_visibleProperty;
+ private boolean m_visible;
+ private boolean m_activeFilterEnabled;
+ private IDataModelEntity m_parentEntity;
+
+ public AbstractDataModelAttribute() {
+ this(true);
+ }
+
+ /**
+ * @param callInitConfig
+ * true if {@link #callInitConfig()} should automcatically be invoked, false if the subclass invokes
+ * {@link #callInitConfig()} itself
+ */
+ public AbstractDataModelAttribute(boolean callInitConfig) {
+ if (callInitConfig) {
+ callInitConfig();
+ }
+ }
+
+ protected void callInitConfig() {
+ initConfig();
+ }
+
+ /*
+ * Configuration
+ */
+
+ @ConfigProperty(ConfigProperty.ICON_ID)
+ @Order(10)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredIconId() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.TEXT)
+ @Order(20)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredText() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.LOOKUP_CALL)
+ @Order(30)
+ @ConfigPropertyValue("null")
+ protected Class<? extends LookupCall> getConfiguredLookupCall() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.CODE_TYPE)
+ @Order(40)
+ @ConfigPropertyValue("null")
+ protected Class<? extends ICodeType> getConfiguredCodeType() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.COMPOSER_ATTRIBUTE_TYPE)
+ @Order(70)
+ @ConfigPropertyValue("TYPE_STRING")
+ protected int getConfiguredType() {
+ return TYPE_STRING;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(90)
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredNullOperatorEnabled() {
+ return true;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(100)
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredNotOperatorEnabled() {
+ return true;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(105)
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredAggregationEnabled() {
+ return true;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(110)
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredVisible() {
+ return true;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(120)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredActiveFilterEnabled() {
+ return false;
+ }
+
+ @ConfigOperation
+ @Order(10)
+ protected void execInitAttribute() throws ProcessingException {
+
+ }
+
+ @ConfigOperation
+ @Order(20)
+ protected void execPrepareLookup(LookupCall call) throws ProcessingException {
+ }
+
+ @Override
+ public Map<String, String> getMetaDataOfAttribute() {
+ return null;
+ }
+
+ protected void initConfig() {
+ m_visibleGranted = true;
+ setNotOperatorEnabled(getConfiguredNotOperatorEnabled());
+ setNullOperatorEnabled(getConfiguredNullOperatorEnabled());
+ setAggregationEnabled(getConfiguredAggregationEnabled());
+ setIconId(getConfiguredIconId());
+ setText(getConfiguredText());
+ setType(getConfiguredType());
+ setVisible(getConfiguredVisible());
+ setActiveFilterEnabled(getConfiguredActiveFilterEnabled());
+
+ // code type
+ if (getConfiguredCodeType() != null) {
+ setCodeTypeClass(getConfiguredCodeType());
+ }
+ // lazy lookup decorator
+ Class<? extends LookupCall> lsCls = getConfiguredLookupCall();
+ if (lsCls != null) {
+ LookupCall call;
+ try {
+ call = lsCls.newInstance();
+ setLookupCall(call);
+ }
+ catch (Exception e) {
+ LOG.warn(null, e);
+ }
+ }
+ injectOperators();
+ injectAggregationTypes();
+ }
+
+ /*
+ * Runtime
+ */
+
+ protected void injectOperators() {
+ new DataModelAttributeInjector().injectOperators(this);
+ }
+
+ protected void injectAggregationTypes() {
+ new DataModelAttributeInjector().injectAggregationTypes(this);
+ }
+
+ @Override
+ public final void initAttribute() throws ProcessingException {
+ execInitAttribute();
+ }
+
+ @Override
+ public void prepareLookup(LookupCall call) throws ProcessingException {
+ execPrepareLookup(call);
+ }
+
+ @Override
+ public String getText() {
+ return m_text;
+ }
+
+ @Override
+ public void setText(String s) {
+ m_text = s;
+ }
+
+ @Override
+ public int getType() {
+ return m_type;
+ }
+
+ @Override
+ public void setType(int i) {
+ m_type = i;
+ }
+
+ @Override
+ public String getIconId() {
+ return m_iconId;
+ }
+
+ @Override
+ public void setIconId(String s) {
+ m_iconId = s;
+ }
+
+ @Override
+ public IDataModelAttributeOp[] getOperators() {
+ return m_operators;
+ }
+
+ @Override
+ public void setOperators(IDataModelAttributeOp[] ops) {
+ m_operators = ops;
+ }
+
+ @Override
+ public int[] getAggregationTypes() {
+ return m_aggregationTypes != null ? m_aggregationTypes : new int[0];
+ }
+
+ @Override
+ public void setAggregationTypes(int[] aggregationTypes) {
+ m_aggregationTypes = aggregationTypes;
+ }
+
+ @Override
+ public boolean containsAggregationType(int agType) {
+ if (m_aggregationTypes == null) {
+ return false;
+ }
+ for (int i : m_aggregationTypes) {
+ if (i == agType) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public boolean isNullOperatorEnabled() {
+ return m_allowNullOperator;
+ }
+
+ @Override
+ public void setNullOperatorEnabled(boolean b) {
+ m_allowNullOperator = b;
+ }
+
+ @Override
+ public boolean isAggregationEnabled() {
+ return m_aggregationEnabled;
+ }
+
+ @Override
+ public void setAggregationEnabled(boolean aggregationEnabled) {
+ m_aggregationEnabled = aggregationEnabled;
+ if (m_aggregationTypes != null) {
+ injectAggregationTypes();
+ }
+ }
+
+ @Override
+ public boolean isNotOperatorEnabled() {
+ return m_allowNotOperator;
+ }
+
+ @Override
+ public void setNotOperatorEnabled(boolean b) {
+ m_allowNotOperator = b;
+ }
+
+ @Override
+ public Class<? extends ICodeType> getCodeTypeClass() {
+ return m_codeTypeClass;
+ }
+
+ @Override
+ public void setCodeTypeClass(Class<? extends ICodeType> codeTypeClass) {
+ m_codeTypeClass = codeTypeClass;
+ // create lookup service call
+ m_lookupCall = null;
+ if (m_codeTypeClass != null) {
+ m_lookupCall = SERVICES.getService(ICodeLookupCallFactoryService.class).newInstance(m_codeTypeClass);
+ }
+ }
+
+ @Override
+ public LookupCall getLookupCall() {
+ return m_lookupCall;
+ }
+
+ @Override
+ public void setLookupCall(LookupCall call) {
+ m_lookupCall = call;
+ }
+
+ @Override
+ public Permission getVisiblePermission() {
+ return m_visiblePermission;
+ }
+
+ @Override
+ public void setVisiblePermission(Permission p) {
+ m_visiblePermission = p;
+ boolean b;
+ if (p != null) {
+ b = SERVICES.getService(IAccessControlService.class).checkPermission(p);
+ }
+ else {
+ b = true;
+ }
+ setVisibleGranted(b);
+ }
+
+ @Override
+ public boolean isVisibleGranted() {
+ return m_visibleGranted;
+ }
+
+ @Override
+ public void setVisibleGranted(boolean b) {
+ m_visibleGranted = b;
+ calculateVisible();
+ }
+
+ @Override
+ public boolean isVisible() {
+ return m_visible;
+ }
+
+ @Override
+ public void setVisible(boolean b) {
+ m_visibleProperty = b;
+ calculateVisible();
+ }
+
+ @Override
+ public void setActiveFilterEnabled(boolean active) {
+ m_activeFilterEnabled = active;
+ }
+
+ @Override
+ public boolean isActiveFilterEnabled() {
+ return m_activeFilterEnabled;
+ }
+
+ @Override
+ public IDataModelEntity getParentEntity() {
+ return m_parentEntity;
+ }
+
+ @Override
+ public void setParentEntity(IDataModelEntity parent) {
+ m_parentEntity = parent;
+ }
+
+ /**
+ * no access control for system buttons CANCEL and CLOSE
+ */
+ private void calculateVisible() {
+ // access control
+ m_visible = m_visibleGranted && m_visibleProperty;
+ }
+
+ @Override
+ public boolean isMultiValued() {
+ switch (getType()) {
+ case DataModelConstants.TYPE_CODE_LIST:
+ case DataModelConstants.TYPE_CODE_TREE:
+ case DataModelConstants.TYPE_NUMBER_LIST:
+ case DataModelConstants.TYPE_NUMBER_TREE: {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public String formatValue(Object rawValue) {
+ if (rawValue == null) {
+ return formatNullValue();
+ }
+
+ switch (getType()) {
+ case IDataModelAttribute.TYPE_CODE_LIST:
+ case IDataModelAttribute.TYPE_CODE_TREE:
+ case IDataModelAttribute.TYPE_NUMBER_LIST:
+ case IDataModelAttribute.TYPE_NUMBER_TREE:
+ case IDataModelAttribute.TYPE_SMART:
+ return formatSmart(rawValue, getCodeTypeClass(), getLookupCall());
+ case IDataModelAttribute.TYPE_DATE:
+ return formatDate(rawValue, true, false);
+ case IDataModelAttribute.TYPE_DATE_TIME:
+ return formatDate(rawValue, true, true);
+ case IDataModelAttribute.TYPE_TIME:
+ return formatDate(rawValue, false, true);
+ case IDataModelAttribute.TYPE_INTEGER:
+ return formatInteger(rawValue, true);
+ case IDataModelAttribute.TYPE_LONG:
+ return formatLong(rawValue, true);
+ case IDataModelAttribute.TYPE_DOUBLE:
+ return formatDouble(rawValue, true, false);
+ case IDataModelAttribute.TYPE_PLAIN_INTEGER:
+ return formatInteger(rawValue, false);
+ case IDataModelAttribute.TYPE_PLAIN_LONG:
+ return formatLong(rawValue, false);
+ case IDataModelAttribute.TYPE_PLAIN_DOUBLE:
+ return formatDouble(rawValue, false, false);
+ case IDataModelAttribute.TYPE_PERCENT:
+ return formatDouble(rawValue, true, true);
+ case IDataModelAttribute.TYPE_STRING:
+ case IDataModelAttribute.TYPE_FULL_TEXT:
+ return formatString(rawValue);
+ default:
+ return formatObject(rawValue);
+ }
+ }
+
+ /**
+ * Method is called in case the raw value is null.
+ * This method may be overridden by subclass in order to provide a different formatted value for null values.
+ *
+ * @return null
+ */
+ protected String formatNullValue() {
+ return null;
+ }
+
+ /**
+ * Formats the raw value for the following attribute types:
+ * <ul>
+ * <li>{@link DataModelConstants#TYPE_DATE}</li>
+ * <li>{@link DataModelConstants#TYPE_DATE_TIME}</li>
+ * <li>{@link DataModelConstants#TYPE_TIME}</li>
+ * </ul>
+ *
+ * @param rawValue
+ * Raw value to format
+ * @param hasDate
+ * True if the formatted value should show the date.
+ * @param hasTime
+ * True if the formatted value should show the time.
+ * @return Formatted value: raw value casted to Date, date format according to date & time specification
+ */
+ protected String formatDate(Object rawValue, boolean hasDate, boolean hasTime) {
+ Date value = TypeCastUtility.castValue(rawValue, Date.class);
+
+ DateFormat df = null;
+ if (hasDate && !hasTime) {
+ df = DateFormat.getDateInstance(DateFormat.MEDIUM, LocaleThreadLocal.get());
+ }
+ else if (!hasDate && hasTime) {
+ df = DateFormat.getTimeInstance(DateFormat.SHORT, LocaleThreadLocal.get());
+ }
+ else {
+ df = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, LocaleThreadLocal.get());
+ }
+ df.setLenient(true);
+
+ return df.format(value);
+ }
+
+ /**
+ * Formats the raw value for the following attribute types:
+ * <ul>
+ * <li>{@link DataModelConstants#TYPE_DOUBLE}</li>
+ * <li>{@link DataModelConstants#TYPE_PLAIN_DOUBLE}</li>
+ * <li>{@link DataModelConstants#TYPE_PERCENT}</li>
+ * </ul>
+ *
+ * @param rawValue
+ * Raw value to format
+ * @param groupingUsed
+ * True if grouping should be used for formatting
+ * @param percent
+ * True if a percent number format should be used for formatting
+ * @return Formatted value: raw value casted to Double, number format with 2 fraction digits
+ */
+ protected String formatDouble(Object rawValue, boolean groupingUsed, boolean percent) {
+ Double value = TypeCastUtility.castValue(rawValue, Double.class);
+
+ NumberFormat fmt = null;
+ if (percent) {
+ fmt = NumberFormat.getPercentInstance(LocaleThreadLocal.get());
+ }
+ else {
+ fmt = NumberFormat.getNumberInstance(LocaleThreadLocal.get());
+ }
+
+ if (fmt instanceof DecimalFormat) {
+ ((DecimalFormat) fmt).setMultiplier(1);
+ }
+
+ fmt.setMinimumFractionDigits(2);
+ fmt.setMaximumFractionDigits(2);
+ fmt.setGroupingUsed(groupingUsed);
+
+ return fmt.format(value);
+ }
+
+ /**
+ * Formats the raw value for the following attribute types:
+ * <ul>
+ * <li>{@link DataModelConstants#TYPE_INTEGER}</li>
+ * <li>{@link DataModelConstants#TYPE_PLAIN_INTEGER}</li>
+ * </ul>
+ *
+ * @param rawValue
+ * Raw value to format
+ * @param groupingUsed
+ * True if grouping should be used for formatting
+ * @return Formatted value: raw value casted to Integer, number format with no fraction digits
+ */
+ protected String formatInteger(Object rawValue, boolean groupingUsed) {
+ Integer value = TypeCastUtility.castValue(rawValue, Integer.class);
+
+ NumberFormat fmt = NumberFormat.getNumberInstance(LocaleThreadLocal.get());
+ fmt.setMinimumFractionDigits(0);
+ fmt.setMaximumFractionDigits(0);
+ fmt.setGroupingUsed(groupingUsed);
+ return fmt.format(value);
+ }
+
+ /**
+ * Formats the raw value for the following attribute types:
+ * <ul>
+ * <li>{@link DataModelConstants#TYPE_LONG}</li>
+ * <li>{@link DataModelConstants#TYPE_PLAIN_LONG}</li>
+ * </ul>
+ *
+ * @param rawValue
+ * Raw value to format
+ * @param groupingUsed
+ * True if grouping should be used for formatting
+ * @return Formatted value: raw value casted to Long, number format with no fraction digits
+ */
+ protected String formatLong(Object rawValue, boolean groupingUsed) {
+ Long value = TypeCastUtility.castValue(rawValue, Long.class);
+
+ NumberFormat fmt = NumberFormat.getNumberInstance(LocaleThreadLocal.get());
+ fmt.setMinimumFractionDigits(0);
+ fmt.setMaximumFractionDigits(0);
+ fmt.setGroupingUsed(groupingUsed);
+ return fmt.format(value);
+ }
+
+ /**
+ * Formats the raw value for the following attribute types:
+ * <ul>
+ * <li>{@link DataModelConstants#TYPE_CODE_LIST}</li>
+ * <li>{@link DataModelConstants#TYPE_CODE_TREE}</li>
+ * <li>{@link DataModelConstants#TYPE_NUMBER_LIST}</li>
+ * <li>{@link DataModelConstants#TYPE_NUMBER_TREE}</li>
+ * <li>{@link DataModelConstants#TYPE_SMART}</li>
+ * </ul>
+ * If whether code type class nor lookup call is set, the return value will be null.
+ * The method does not throw an exception. In case of failure, the return value is the empty string.
+ *
+ * @param rawValue
+ * Raw value to format
+ * @param codeTypeClass
+ * Code type class
+ * @param lookupCall
+ * Lookup call (not used if code type class is set)
+ * @return Formatted value: key is resolved by code type / lookup call
+ */
+ protected String formatSmart(Object rawValue, Class<? extends ICodeType> codeTypeClass, LookupCall lookupCall) {
+ if (codeTypeClass == null && lookupCall == null) {
+ return null;
+ }
+
+ LookupCall call;
+ if (codeTypeClass != null) {
+ call = SERVICES.getService(ICodeLookupCallFactoryService.class).newInstance(codeTypeClass);
+ }
+ else {
+ call = (LookupCall) lookupCall.clone();
+ }
+
+ call.setKey(rawValue);
+ call.setText(null);
+ call.setAll(null);
+ call.setRec(null);
+
+ try {
+ LookupRow[] result = call.getDataByKey();
+ if (result.length == 1) {
+ return result[0].getText();
+ }
+ else if (result.length > 1) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < result.length; i++) {
+ if (i > 0) {
+ sb.append(", ");
+ }
+ sb.append(result[i].getText());
+ }
+ return sb.toString();
+ }
+ }
+ catch (ProcessingException e) {
+ LOG.warn("Execution of lookup call failed", e);
+ }
+ return "";
+ }
+
+ /**
+ * Formats the raw value for the following attribute types and in case the type did not match any known types.
+ * <ul>
+ * <li>{@link DataModelConstants#TYPE_STRING}</li>
+ * <li>{@link DataModelConstants#TYPE_FULL_TEXT}</li>
+ * </ul>
+ *
+ * @param rawValue
+ * Raw value to format
+ * @return Formatted value: raw value is casted to String
+ */
+ protected String formatString(Object rawValue) {
+ return TypeCastUtility.castValue(rawValue, String.class);
+ }
+
+ /**
+ * Formats the raw value for unknown attribute types
+ *
+ * @param rawValue
+ * Raw value to format
+ * @return Formatted value: raw value is casted to String
+ */
+ protected String formatObject(Object rawValue) {
+ return rawValue.toString();
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/AbstractDataModelEntity.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/AbstractDataModelEntity.java
index 0846db12f8..861c114dce 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/AbstractDataModelEntity.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/AbstractDataModelEntity.java
@@ -1,363 +1,363 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.data.model;
-
-import java.io.Serializable;
-import java.security.Permission;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.scout.commons.ConfigurationUtility;
-import org.eclipse.scout.commons.annotations.ConfigOperation;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.beans.AbstractPropertyObserver;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.shared.services.common.security.IAccessControlService;
-import org.eclipse.scout.service.SERVICES;
-
-@SuppressWarnings("deprecation")
-public abstract class AbstractDataModelEntity extends AbstractPropertyObserver implements IDataModelEntity, Serializable {
- private static final long serialVersionUID = 1L;
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractDataModelEntity.class);
-
- private String m_id;
- private Permission m_visiblePermission;
- private boolean m_visibleGranted;
- private boolean m_visibleProperty;
- private boolean m_visible;
- private boolean m_oneToMany;
- private String m_text;
- private String m_iconId;
- private ArrayList<IDataModelAttribute> m_attributes;
- private ArrayList<IDataModelEntity> m_entities;
- private IDataModelEntity m_parentEntity;
- private boolean m_initializedChildEntities;
- private boolean m_initialized;
-
- public AbstractDataModelEntity() {
- this(true);
- }
-
- /**
- * @param callInitConfig
- * true if {@link #callInitConfig()} should automcatically be invoked, false if the subclass invokes
- * {@link #callInitConfig()} itself
- */
- public AbstractDataModelEntity(boolean callInitConfig) {
- m_attributes = new ArrayList<IDataModelAttribute>();
- m_entities = new ArrayList<IDataModelEntity>();
- if (callInitConfig) {
- callInitConfig();
- }
- }
-
- protected void callInitConfig() {
- initConfig();
- }
-
- /*
- * Configuration
- */
-
- @ConfigProperty(ConfigProperty.TEXT)
- @Order(20)
- @ConfigPropertyValue("null")
- protected String getConfiguredText() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.ICON_ID)
- @Order(10)
- @ConfigPropertyValue("null")
- protected String getConfiguredIconId() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(50)
- @ConfigPropertyValue("true")
- protected boolean getConfiguredVisible() {
- return true;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(50)
- @ConfigPropertyValue("true")
- protected boolean getConfiguredOneToMany() {
- return true;
- }
-
- /**
- * Initialize this entity.
- */
- @ConfigOperation
- @Order(10)
- protected void execInitEntity() throws ProcessingException {
- }
-
- private Class<? extends IDataModelAttribute>[] getConfiguredAttributes() {
- Class[] c = ConfigurationUtility.getDeclaredPublicClasses(getClass());
- return ConfigurationUtility.sortFilteredClassesByOrderAnnotation(c, IDataModelAttribute.class);
- }
-
- private Class<? extends IDataModelEntity>[] getConfiguredEntities() {
- Class[] c = ConfigurationUtility.getDeclaredPublicClasses(getClass());
- return ConfigurationUtility.sortFilteredClassesByOrderAnnotation(c, IDataModelEntity.class);
- }
-
- protected void initConfig() {
- m_visibleGranted = true;
- setText(getConfiguredText());
- setIconId(getConfiguredIconId());
- setVisible(getConfiguredVisible());
- setOneToMany(getConfiguredOneToMany());
- ArrayList<IDataModelAttribute> attributes = new ArrayList<IDataModelAttribute>();
- for (Class<? extends IDataModelAttribute> c : getConfiguredAttributes()) {
- try {
- IDataModelAttribute a = ConfigurationUtility.newInnerInstance(this, c);
- attributes.add(a);
- }
- catch (Exception e) {
- LOG.warn(null, e);
- }
- }
- injectAttributesInternal(attributes);
- m_attributes = new ArrayList<IDataModelAttribute>();
- m_attributes.addAll(attributes);
- for (IDataModelAttribute a : m_attributes) {
- a.setParentEntity(this);
- }
- //lazy create entities at point when setParentEntity is set, this is necessary to avoid cyclic loops
- m_entities = new ArrayList<IDataModelEntity>();
- }
-
- @Override
- public Map<String, String> getMetaDataOfEntity() {
- return null;
- }
-
- /*
- * Runtime
- */
-
- @Override
- public final void initEntity() throws ProcessingException {
- if (m_initialized) {
- return;
- }
-
- try {
- execInitEntity();
- }
- catch (Throwable t) {
- LOG.error("entity " + this, t);
- }
- for (IDataModelAttribute a : getAttributes()) {
- try {
- a.initAttribute();
- }
- catch (Throwable t) {
- LOG.error("attribute " + this + "/" + a, t);
- }
- }
- m_initialized = true;
- for (IDataModelEntity e : getEntities()) {
- try {
- e.initEntity();
- }
- catch (Throwable t) {
- LOG.error("entity " + this + "/" + e, t);
- }
- }
- }
-
- @Override
- public Permission getVisiblePermission() {
- return m_visiblePermission;
- }
-
- @Override
- public void setVisiblePermission(Permission p) {
- m_visiblePermission = p;
- boolean b;
- if (p != null) {
- b = SERVICES.getService(IAccessControlService.class).checkPermission(p);
- }
- else {
- b = true;
- }
- setVisibleGranted(b);
- }
-
- @Override
- public boolean isVisibleGranted() {
- return m_visibleGranted;
- }
-
- @Override
- public void setVisibleGranted(boolean b) {
- m_visibleGranted = b;
- calculateVisible();
- }
-
- @Override
- public boolean isVisible() {
- return m_visible;
- }
-
- @Override
- public void setVisible(boolean b) {
- m_visibleProperty = b;
- calculateVisible();
- }
-
- @Override
- public boolean isOneToMany() {
- return m_oneToMany;
- }
-
- @Override
- public void setOneToMany(boolean b) {
- m_oneToMany = b;
- }
-
- /**
- * no access control for system buttons CANCEL and CLOSE
- */
- private void calculateVisible() {
- // access control
- m_visible = m_visibleGranted && m_visibleProperty;
- }
-
- @Override
- public String getIconId() {
- return m_iconId;
- }
-
- @Override
- public void setIconId(String s) {
- m_iconId = s;
- }
-
- @Override
- public String getText() {
- return m_text;
- }
-
- @Override
- public void setText(String s) {
- m_text = s;
- }
-
- @Override
- public IDataModelAttribute[] getAttributes() {
- return m_attributes.toArray(new IDataModelAttribute[0]);
- }
-
- @Override
- public IDataModelEntity[] getEntities() {
- return m_entities.toArray(new IDataModelEntity[0]);
- }
-
- @Override
- public IDataModelAttribute getAttribute(Class<? extends IDataModelAttribute> attributeClazz) {
- for (IDataModelAttribute attribute : m_attributes) {
- if (attribute.getClass() == attributeClazz) {
- return attribute;
- }
- }
- return null;
- }
-
- @Override
- public IDataModelEntity getEntity(Class<? extends IDataModelEntity> entityClazz) {
- for (IDataModelEntity entity : m_entities) {
- if (entity.getClass() == entityClazz) {
- return entity;
- }
- }
- return null;
- }
-
- @Override
- public IDataModelEntity getParentEntity() {
- return m_parentEntity;
- }
-
- @Override
- public void setParentEntity(IDataModelEntity parent) {
- m_parentEntity = parent;
- }
-
- @Override
- public void initializeChildEntities(Map<Class<? extends IDataModelEntity>, IDataModelEntity> instanceMap) {
- if (!m_initializedChildEntities) {
- m_initializedChildEntities = true;
- ArrayList<IDataModelEntity> newConfiguredInstances = new ArrayList<IDataModelEntity>();
- ArrayList<IDataModelEntity> entities = new ArrayList<IDataModelEntity>();
- for (Class<? extends IDataModelEntity> c : getConfiguredEntities()) {
- try {
- //check if a parent is of same type, in that case use reference
- IDataModelEntity e = instanceMap.get(c);
- if (e == null) {
- e = ConfigurationUtility.newInnerInstance(this, c);
- newConfiguredInstances.add(e);
- instanceMap.put(c, e);
- }
- entities.add(e);
- }
- catch (Exception ex) {
- LOG.warn(null, ex);
- }
- }
- injectEntitiesInternal(entities);
- m_entities.clear();
- m_entities.addAll(entities);
- for (IDataModelEntity e : m_entities) {
- if (e.getParentEntity() != this) {
- e.setParentEntity(this);
- }
- }
- for (IDataModelEntity e : m_entities) {
- if (newConfiguredInstances.contains(e) || !instanceMap.containsKey(e.getClass())) {
- e.initializeChildEntities(instanceMap);
- }
- }
- }
- }
-
- /**
- * do not use this internal method<br>
- * Used add/remove attributes
- *
- * @param attributeList
- * live and mutable list of configured attributes
- */
- protected void injectAttributesInternal(List<IDataModelAttribute> attributeList) {
- }
-
- /**
- * do not use this internal method<br>
- * Used add/remove entities
- * <p>
- * Note that {@link #initializeChildEntities(Map)} is also called on injected entities
- *
- * @param entityList
- * live and mutable list of configured attributes
- */
- protected void injectEntitiesInternal(List<IDataModelEntity> entityList) {
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.data.model;
+
+import java.io.Serializable;
+import java.security.Permission;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.scout.commons.ConfigurationUtility;
+import org.eclipse.scout.commons.annotations.ConfigOperation;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.beans.AbstractPropertyObserver;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.shared.services.common.security.IAccessControlService;
+import org.eclipse.scout.service.SERVICES;
+
+@SuppressWarnings("deprecation")
+public abstract class AbstractDataModelEntity extends AbstractPropertyObserver implements IDataModelEntity, Serializable {
+ private static final long serialVersionUID = 1L;
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractDataModelEntity.class);
+
+ private String m_id;
+ private Permission m_visiblePermission;
+ private boolean m_visibleGranted;
+ private boolean m_visibleProperty;
+ private boolean m_visible;
+ private boolean m_oneToMany;
+ private String m_text;
+ private String m_iconId;
+ private ArrayList<IDataModelAttribute> m_attributes;
+ private ArrayList<IDataModelEntity> m_entities;
+ private IDataModelEntity m_parentEntity;
+ private boolean m_initializedChildEntities;
+ private boolean m_initialized;
+
+ public AbstractDataModelEntity() {
+ this(true);
+ }
+
+ /**
+ * @param callInitConfig
+ * true if {@link #callInitConfig()} should automcatically be invoked, false if the subclass invokes
+ * {@link #callInitConfig()} itself
+ */
+ public AbstractDataModelEntity(boolean callInitConfig) {
+ m_attributes = new ArrayList<IDataModelAttribute>();
+ m_entities = new ArrayList<IDataModelEntity>();
+ if (callInitConfig) {
+ callInitConfig();
+ }
+ }
+
+ protected void callInitConfig() {
+ initConfig();
+ }
+
+ /*
+ * Configuration
+ */
+
+ @ConfigProperty(ConfigProperty.TEXT)
+ @Order(20)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredText() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.ICON_ID)
+ @Order(10)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredIconId() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(50)
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredVisible() {
+ return true;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(50)
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredOneToMany() {
+ return true;
+ }
+
+ /**
+ * Initialize this entity.
+ */
+ @ConfigOperation
+ @Order(10)
+ protected void execInitEntity() throws ProcessingException {
+ }
+
+ private Class<? extends IDataModelAttribute>[] getConfiguredAttributes() {
+ Class[] c = ConfigurationUtility.getDeclaredPublicClasses(getClass());
+ return ConfigurationUtility.sortFilteredClassesByOrderAnnotation(c, IDataModelAttribute.class);
+ }
+
+ private Class<? extends IDataModelEntity>[] getConfiguredEntities() {
+ Class[] c = ConfigurationUtility.getDeclaredPublicClasses(getClass());
+ return ConfigurationUtility.sortFilteredClassesByOrderAnnotation(c, IDataModelEntity.class);
+ }
+
+ protected void initConfig() {
+ m_visibleGranted = true;
+ setText(getConfiguredText());
+ setIconId(getConfiguredIconId());
+ setVisible(getConfiguredVisible());
+ setOneToMany(getConfiguredOneToMany());
+ ArrayList<IDataModelAttribute> attributes = new ArrayList<IDataModelAttribute>();
+ for (Class<? extends IDataModelAttribute> c : getConfiguredAttributes()) {
+ try {
+ IDataModelAttribute a = ConfigurationUtility.newInnerInstance(this, c);
+ attributes.add(a);
+ }
+ catch (Exception e) {
+ LOG.warn(null, e);
+ }
+ }
+ injectAttributesInternal(attributes);
+ m_attributes = new ArrayList<IDataModelAttribute>();
+ m_attributes.addAll(attributes);
+ for (IDataModelAttribute a : m_attributes) {
+ a.setParentEntity(this);
+ }
+ //lazy create entities at point when setParentEntity is set, this is necessary to avoid cyclic loops
+ m_entities = new ArrayList<IDataModelEntity>();
+ }
+
+ @Override
+ public Map<String, String> getMetaDataOfEntity() {
+ return null;
+ }
+
+ /*
+ * Runtime
+ */
+
+ @Override
+ public final void initEntity() throws ProcessingException {
+ if (m_initialized) {
+ return;
+ }
+
+ try {
+ execInitEntity();
+ }
+ catch (Throwable t) {
+ LOG.error("entity " + this, t);
+ }
+ for (IDataModelAttribute a : getAttributes()) {
+ try {
+ a.initAttribute();
+ }
+ catch (Throwable t) {
+ LOG.error("attribute " + this + "/" + a, t);
+ }
+ }
+ m_initialized = true;
+ for (IDataModelEntity e : getEntities()) {
+ try {
+ e.initEntity();
+ }
+ catch (Throwable t) {
+ LOG.error("entity " + this + "/" + e, t);
+ }
+ }
+ }
+
+ @Override
+ public Permission getVisiblePermission() {
+ return m_visiblePermission;
+ }
+
+ @Override
+ public void setVisiblePermission(Permission p) {
+ m_visiblePermission = p;
+ boolean b;
+ if (p != null) {
+ b = SERVICES.getService(IAccessControlService.class).checkPermission(p);
+ }
+ else {
+ b = true;
+ }
+ setVisibleGranted(b);
+ }
+
+ @Override
+ public boolean isVisibleGranted() {
+ return m_visibleGranted;
+ }
+
+ @Override
+ public void setVisibleGranted(boolean b) {
+ m_visibleGranted = b;
+ calculateVisible();
+ }
+
+ @Override
+ public boolean isVisible() {
+ return m_visible;
+ }
+
+ @Override
+ public void setVisible(boolean b) {
+ m_visibleProperty = b;
+ calculateVisible();
+ }
+
+ @Override
+ public boolean isOneToMany() {
+ return m_oneToMany;
+ }
+
+ @Override
+ public void setOneToMany(boolean b) {
+ m_oneToMany = b;
+ }
+
+ /**
+ * no access control for system buttons CANCEL and CLOSE
+ */
+ private void calculateVisible() {
+ // access control
+ m_visible = m_visibleGranted && m_visibleProperty;
+ }
+
+ @Override
+ public String getIconId() {
+ return m_iconId;
+ }
+
+ @Override
+ public void setIconId(String s) {
+ m_iconId = s;
+ }
+
+ @Override
+ public String getText() {
+ return m_text;
+ }
+
+ @Override
+ public void setText(String s) {
+ m_text = s;
+ }
+
+ @Override
+ public IDataModelAttribute[] getAttributes() {
+ return m_attributes.toArray(new IDataModelAttribute[0]);
+ }
+
+ @Override
+ public IDataModelEntity[] getEntities() {
+ return m_entities.toArray(new IDataModelEntity[0]);
+ }
+
+ @Override
+ public IDataModelAttribute getAttribute(Class<? extends IDataModelAttribute> attributeClazz) {
+ for (IDataModelAttribute attribute : m_attributes) {
+ if (attribute.getClass() == attributeClazz) {
+ return attribute;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public IDataModelEntity getEntity(Class<? extends IDataModelEntity> entityClazz) {
+ for (IDataModelEntity entity : m_entities) {
+ if (entity.getClass() == entityClazz) {
+ return entity;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public IDataModelEntity getParentEntity() {
+ return m_parentEntity;
+ }
+
+ @Override
+ public void setParentEntity(IDataModelEntity parent) {
+ m_parentEntity = parent;
+ }
+
+ @Override
+ public void initializeChildEntities(Map<Class<? extends IDataModelEntity>, IDataModelEntity> instanceMap) {
+ if (!m_initializedChildEntities) {
+ m_initializedChildEntities = true;
+ ArrayList<IDataModelEntity> newConfiguredInstances = new ArrayList<IDataModelEntity>();
+ ArrayList<IDataModelEntity> entities = new ArrayList<IDataModelEntity>();
+ for (Class<? extends IDataModelEntity> c : getConfiguredEntities()) {
+ try {
+ //check if a parent is of same type, in that case use reference
+ IDataModelEntity e = instanceMap.get(c);
+ if (e == null) {
+ e = ConfigurationUtility.newInnerInstance(this, c);
+ newConfiguredInstances.add(e);
+ instanceMap.put(c, e);
+ }
+ entities.add(e);
+ }
+ catch (Exception ex) {
+ LOG.warn(null, ex);
+ }
+ }
+ injectEntitiesInternal(entities);
+ m_entities.clear();
+ m_entities.addAll(entities);
+ for (IDataModelEntity e : m_entities) {
+ if (e.getParentEntity() != this) {
+ e.setParentEntity(this);
+ }
+ }
+ for (IDataModelEntity e : m_entities) {
+ if (newConfiguredInstances.contains(e) || !instanceMap.containsKey(e.getClass())) {
+ e.initializeChildEntities(instanceMap);
+ }
+ }
+ }
+ }
+
+ /**
+ * do not use this internal method<br>
+ * Used add/remove attributes
+ *
+ * @param attributeList
+ * live and mutable list of configured attributes
+ */
+ protected void injectAttributesInternal(List<IDataModelAttribute> attributeList) {
+ }
+
+ /**
+ * do not use this internal method<br>
+ * Used add/remove entities
+ * <p>
+ * Note that {@link #initializeChildEntities(Map)} is also called on injected entities
+ *
+ * @param entityList
+ * live and mutable list of configured attributes
+ */
+ protected void injectEntitiesInternal(List<IDataModelEntity> entityList) {
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/AttributePath.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/AttributePath.java
index 92536e18de..0653a2dd41 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/AttributePath.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/AttributePath.java
@@ -1,77 +1,77 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.data.model;
-
-import java.util.List;
-
-/**
- * This path represents the forward path from the data model root to an attribute
- * <p>
- * Since the data model is a graph (with potential cycles) the physical instantiation of the datamodel is performed by
- * creating all graph nodes once with single parent linkage. Therefore when holding a {@link IDataModelAttribute} or
- * {@link IDataModelEntity} the forward path to this object from the {@link IDataModel} root is ambiguous. This class
- * solves that problem by containing the complete path.
- *
- * @since 3.8
- */
-public final class AttributePath {
- private final EntityPath m_entityPath;
- private final IDataModelAttribute m_attribute;
-
- public AttributePath(List<IDataModelEntity> entityPath, IDataModelAttribute attribute) {
- this(entityPath != null && entityPath.size() > 0 ? new EntityPath(entityPath) : null, attribute);
- }
-
- public AttributePath(EntityPath entityPath, IDataModelAttribute attribute) {
- if (entityPath == null || entityPath.size() == 0) {
- m_entityPath = EntityPath.EMPTY;
- }
- else {
- m_entityPath = entityPath;
- }
- m_attribute = attribute;
- }
-
- /**
- * @return the entity path of the attribute or {@link EntityPath#EMPTY}
- * <p>
- * Never returns null.
- */
- public EntityPath getEntityPath() {
- return m_entityPath;
- }
-
- public IDataModelAttribute getAttribute() {
- return m_attribute;
- }
-
- @Override
- public int hashCode() {
- return m_entityPath.hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == this) {
- return true;
- }
- if (!(obj instanceof AttributePath)) {
- return false;
- }
- AttributePath other = (AttributePath) obj;
- return this.m_entityPath.equals(other.m_entityPath) && this.m_attribute == other.m_attribute;
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName() + "[" + m_entityPath.toString() + "#" + m_attribute.getClass().getSimpleName() + "(" + m_attribute.getText() + ")]";
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.data.model;
+
+import java.util.List;
+
+/**
+ * This path represents the forward path from the data model root to an attribute
+ * <p>
+ * Since the data model is a graph (with potential cycles) the physical instantiation of the datamodel is performed by
+ * creating all graph nodes once with single parent linkage. Therefore when holding a {@link IDataModelAttribute} or
+ * {@link IDataModelEntity} the forward path to this object from the {@link IDataModel} root is ambiguous. This class
+ * solves that problem by containing the complete path.
+ *
+ * @since 3.8
+ */
+public final class AttributePath {
+ private final EntityPath m_entityPath;
+ private final IDataModelAttribute m_attribute;
+
+ public AttributePath(List<IDataModelEntity> entityPath, IDataModelAttribute attribute) {
+ this(entityPath != null && entityPath.size() > 0 ? new EntityPath(entityPath) : null, attribute);
+ }
+
+ public AttributePath(EntityPath entityPath, IDataModelAttribute attribute) {
+ if (entityPath == null || entityPath.size() == 0) {
+ m_entityPath = EntityPath.EMPTY;
+ }
+ else {
+ m_entityPath = entityPath;
+ }
+ m_attribute = attribute;
+ }
+
+ /**
+ * @return the entity path of the attribute or {@link EntityPath#EMPTY}
+ * <p>
+ * Never returns null.
+ */
+ public EntityPath getEntityPath() {
+ return m_entityPath;
+ }
+
+ public IDataModelAttribute getAttribute() {
+ return m_attribute;
+ }
+
+ @Override
+ public int hashCode() {
+ return m_entityPath.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof AttributePath)) {
+ return false;
+ }
+ AttributePath other = (AttributePath) obj;
+ return this.m_entityPath.equals(other.m_entityPath) && this.m_attribute == other.m_attribute;
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + "[" + m_entityPath.toString() + "#" + m_attribute.getClass().getSimpleName() + "(" + m_attribute.getText() + ")]";
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/DataModelAttributeInjector.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/DataModelAttributeInjector.java
index db76dee136..f0a1c45237 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/DataModelAttributeInjector.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/DataModelAttributeInjector.java
@@ -1,262 +1,262 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.data.model;
-
-import java.util.ArrayList;
-
-public class DataModelAttributeInjector implements DataModelConstants {
-
- public void injectOperators(IDataModelAttribute attribute) {
- ArrayList<IDataModelAttributeOp> opList = new ArrayList<IDataModelAttributeOp>();
- switch (attribute.getType()) {
- case IDataModelAttribute.TYPE_SMART: {
- opList.add(DataModelAttributeOp.create(OPERATOR_EQ));
- if (attribute.isNotOperatorEnabled()) {
- opList.add(DataModelAttributeOp.create(OPERATOR_NEQ));
- }
- if (attribute.isNullOperatorEnabled()) {
- opList.add(DataModelAttributeOp.create(OPERATOR_NUMBER_NULL));
- }
- if (attribute.isNotOperatorEnabled() && attribute.isNullOperatorEnabled()) {
- opList.add(DataModelAttributeOp.create(OPERATOR_NUMBER_NOT_NULL));
- }
- break;
- }
- case IDataModelAttribute.TYPE_CODE_LIST:
- case IDataModelAttribute.TYPE_CODE_TREE:
- case IDataModelAttribute.TYPE_NUMBER_LIST:
- case IDataModelAttribute.TYPE_NUMBER_TREE: {
- opList.add(DataModelAttributeOp.create(OPERATOR_IN));
- if (attribute.isNotOperatorEnabled()) {
- opList.add(DataModelAttributeOp.create(OPERATOR_NOT_IN));
- }
- if (attribute.isNullOperatorEnabled()) {
- opList.add(DataModelAttributeOp.create(OPERATOR_NUMBER_NULL));
- }
- if (attribute.isNotOperatorEnabled() && attribute.isNullOperatorEnabled()) {
- opList.add(DataModelAttributeOp.create(OPERATOR_NUMBER_NOT_NULL));
- }
- break;
- }
- case IDataModelAttribute.TYPE_TIME: {
- opList.add(DataModelAttributeOp.create(OPERATOR_EQ));
- if (attribute.isNotOperatorEnabled()) {
- opList.add(DataModelAttributeOp.create(OPERATOR_NEQ));
- }
- opList.add(DataModelAttributeOp.create(OPERATOR_BETWEEN));
- opList.add(DataModelAttributeOp.create(OPERATOR_LT));
- opList.add(DataModelAttributeOp.create(OPERATOR_LE));
- opList.add(DataModelAttributeOp.create(OPERATOR_GT));
- opList.add(DataModelAttributeOp.create(OPERATOR_GE));
- if (attribute.isNullOperatorEnabled()) {
- opList.add(DataModelAttributeOp.create(OPERATOR_NULL));
- }
- if (attribute.isNotOperatorEnabled() && attribute.isNullOperatorEnabled()) {
- opList.add(DataModelAttributeOp.create(OPERATOR_NOT_NULL));
- }
- opList.add(DataModelAttributeOp.create(OPERATOR_TIME_IS_IN_GE_HOURS));
- opList.add(DataModelAttributeOp.create(OPERATOR_TIME_IS_IN_GE_MINUTES));
- opList.add(DataModelAttributeOp.create(OPERATOR_TIME_IS_IN_HOURS));
- // opList.add(DataModelAttributeOp.create(OPERATOR_Time_Is_In_Minutes,AGGREGATION_NONE));
- opList.add(DataModelAttributeOp.create(OPERATOR_TIME_IS_IN_LE_HOURS));
- opList.add(DataModelAttributeOp.create(OPERATOR_TIME_IS_IN_LE_MINUTES));
- opList.add(DataModelAttributeOp.create(OPERATOR_TIME_IS_NOW));
- break;
- }
- case IDataModelAttribute.TYPE_DATE: {
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_EQ));
- if (attribute.isNotOperatorEnabled()) {
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_NEQ));
- }
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_BETWEEN));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_LT));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_LE));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_GT));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_GE));
- if (attribute.isNullOperatorEnabled()) {
- opList.add(DataModelAttributeOp.create(OPERATOR_NULL));
- }
- if (attribute.isNotOperatorEnabled() && attribute.isNullOperatorEnabled()) {
- opList.add(DataModelAttributeOp.create(OPERATOR_NOT_NULL));
- }
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_TODAY));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_LAST_DAYS));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_LAST_MONTHS));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_NEXT_DAYS));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_NEXT_MONTHS));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_DAYS));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_MONTHS));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_LE_DAYS));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_LE_MONTHS));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_GE_DAYS));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_GE_MONTHS));
- if (attribute.isNotOperatorEnabled()) {
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_NOT_TODAY));
- }
- break;
- }
- case IDataModelAttribute.TYPE_DATE_TIME: {
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_TIME_EQ));
- if (attribute.isNotOperatorEnabled()) {
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_TIME_NEQ));
- }
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_TIME_BETWEEN));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_TIME_LT));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_TIME_LE));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_TIME_GT));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_TIME_GE));
- if (attribute.isNullOperatorEnabled()) {
- opList.add(DataModelAttributeOp.create(OPERATOR_NULL));
- }
- if (attribute.isNotOperatorEnabled() && attribute.isNullOperatorEnabled()) {
- opList.add(DataModelAttributeOp.create(OPERATOR_NOT_NULL));
- }
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_TIME_IS_NOW));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_TODAY));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_LAST_DAYS));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_LAST_MONTHS));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_NEXT_DAYS));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_NEXT_MONTHS));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_DAYS));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_MONTHS));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_TIME_IS_IN_LE_MINUTES));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_TIME_IS_IN_LE_HOURS));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_LE_DAYS));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_LE_MONTHS));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_TIME_IS_IN_GE_MINUTES));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_TIME_IS_IN_GE_HOURS));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_GE_DAYS));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_GE_MONTHS));
- if (attribute.isNotOperatorEnabled()) {
- // opList.add(DataModelAttributeOp.create(OPERATOR_Date_TimeIs_NotNow,AGGREGATION_NONE));
- opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_NOT_TODAY));
- }
- break;
- }
- case IDataModelAttribute.TYPE_INTEGER:
- case IDataModelAttribute.TYPE_LONG:
- case IDataModelAttribute.TYPE_DOUBLE:
- case IDataModelAttribute.TYPE_PLAIN_INTEGER:
- case IDataModelAttribute.TYPE_PLAIN_LONG:
- case IDataModelAttribute.TYPE_PLAIN_DOUBLE:
- case IDataModelAttribute.TYPE_PERCENT: {
- opList.add(DataModelAttributeOp.create(OPERATOR_EQ));
- if (attribute.isNotOperatorEnabled()) {
- opList.add(DataModelAttributeOp.create(OPERATOR_NEQ));
- }
- opList.add(DataModelAttributeOp.create(OPERATOR_BETWEEN));
- opList.add(DataModelAttributeOp.create(OPERATOR_LT));
- opList.add(DataModelAttributeOp.create(OPERATOR_LE));
- opList.add(DataModelAttributeOp.create(OPERATOR_GT));
- opList.add(DataModelAttributeOp.create(OPERATOR_GE));
- if (attribute.isNullOperatorEnabled()) {
- opList.add(DataModelAttributeOp.create(OPERATOR_NULL));
- }
- if (attribute.isNotOperatorEnabled() && attribute.isNullOperatorEnabled()) {
- opList.add(DataModelAttributeOp.create(OPERATOR_NOT_NULL));
- }
- break;
- }
- case IDataModelAttribute.TYPE_AGGREGATE_COUNT: {
- opList.add(DataModelAttributeOp.create(OPERATOR_EQ));
- if (attribute.isNotOperatorEnabled()) {
- opList.add(DataModelAttributeOp.create(OPERATOR_NEQ));
- }
- opList.add(DataModelAttributeOp.create(OPERATOR_BETWEEN));
- opList.add(DataModelAttributeOp.create(OPERATOR_LT));
- opList.add(DataModelAttributeOp.create(OPERATOR_LE));
- opList.add(DataModelAttributeOp.create(OPERATOR_GT));
- opList.add(DataModelAttributeOp.create(OPERATOR_GE));
- break;
- }
- case IDataModelAttribute.TYPE_STRING: {
- opList.add(DataModelAttributeOp.create(OPERATOR_LIKE));
- if (attribute.isNotOperatorEnabled()) {
- opList.add(DataModelAttributeOp.create(OPERATOR_NEQ));
- }
- opList.add(DataModelAttributeOp.create(OPERATOR_CONTAINS));
- if (attribute.isNotOperatorEnabled()) {
- opList.add(DataModelAttributeOp.create(OPERATOR_NOT_CONTAINS));
- }
- opList.add(DataModelAttributeOp.create(OPERATOR_STARTS_WITH));
- if (attribute.isNotOperatorEnabled()) {
- opList.add(DataModelAttributeOp.create(OPERATOR_NOT_STARTS_WITH));
- }
- opList.add(DataModelAttributeOp.create(OPERATOR_ENDS_WITH));
- if (attribute.isNotOperatorEnabled()) {
- opList.add(DataModelAttributeOp.create(OPERATOR_NOT_ENDS_WITH));
- }
- if (attribute.isNullOperatorEnabled()) {
- opList.add(DataModelAttributeOp.create(OPERATOR_NULL));
- }
- if (attribute.isNotOperatorEnabled() && attribute.isNullOperatorEnabled()) {
- opList.add(DataModelAttributeOp.create(OPERATOR_NOT_NULL));
- }
- break;
- }
- case IDataModelAttribute.TYPE_FULL_TEXT: {
- opList.add(DataModelAttributeOp.create(OPERATOR_CONTAINS));
- if (attribute.isNotOperatorEnabled()) {
- opList.add(DataModelAttributeOp.create(OPERATOR_NOT_CONTAINS));
- }
- if (attribute.isNullOperatorEnabled()) {
- opList.add(DataModelAttributeOp.create(OPERATOR_NULL));
- }
- if (attribute.isNotOperatorEnabled() && attribute.isNullOperatorEnabled()) {
- opList.add(DataModelAttributeOp.create(OPERATOR_NOT_NULL));
- }
- break;
- }
- }
- //
- attribute.setOperators(opList.toArray(new IDataModelAttributeOp[opList.size()]));
- }
-
- public void injectAggregationTypes(IDataModelAttribute attribute) {
- ArrayList<Integer> agList = new ArrayList<Integer>();
- if (attribute.isAggregationEnabled()) {
- switch (attribute.getType()) {
- case IDataModelAttribute.TYPE_DATE:
- case IDataModelAttribute.TYPE_TIME:
- case IDataModelAttribute.TYPE_DATE_TIME: {
- agList.add(AGGREGATION_MIN);
- agList.add(AGGREGATION_MAX);
- agList.add(AGGREGATION_MEDIAN);
- break;
- }
- case IDataModelAttribute.TYPE_INTEGER:
- case IDataModelAttribute.TYPE_LONG:
- case IDataModelAttribute.TYPE_DOUBLE:
- case IDataModelAttribute.TYPE_PLAIN_INTEGER:
- case IDataModelAttribute.TYPE_PLAIN_LONG:
- case IDataModelAttribute.TYPE_PLAIN_DOUBLE:
- case IDataModelAttribute.TYPE_PERCENT: {
- agList.add(AGGREGATION_SUM);
- agList.add(AGGREGATION_MIN);
- agList.add(AGGREGATION_MAX);
- agList.add(AGGREGATION_AVG);
- agList.add(AGGREGATION_MEDIAN);
- break;
- }
- case IDataModelAttribute.TYPE_AGGREGATE_COUNT: {
- agList.add(AGGREGATION_COUNT);
- break;
- }
- }
- }
- //
- int[] a = new int[agList.size()];
- for (int i = 0; i < a.length; i++) {
- a[i] = agList.get(i);
- }
- attribute.setAggregationTypes(a);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.data.model;
+
+import java.util.ArrayList;
+
+public class DataModelAttributeInjector implements DataModelConstants {
+
+ public void injectOperators(IDataModelAttribute attribute) {
+ ArrayList<IDataModelAttributeOp> opList = new ArrayList<IDataModelAttributeOp>();
+ switch (attribute.getType()) {
+ case IDataModelAttribute.TYPE_SMART: {
+ opList.add(DataModelAttributeOp.create(OPERATOR_EQ));
+ if (attribute.isNotOperatorEnabled()) {
+ opList.add(DataModelAttributeOp.create(OPERATOR_NEQ));
+ }
+ if (attribute.isNullOperatorEnabled()) {
+ opList.add(DataModelAttributeOp.create(OPERATOR_NUMBER_NULL));
+ }
+ if (attribute.isNotOperatorEnabled() && attribute.isNullOperatorEnabled()) {
+ opList.add(DataModelAttributeOp.create(OPERATOR_NUMBER_NOT_NULL));
+ }
+ break;
+ }
+ case IDataModelAttribute.TYPE_CODE_LIST:
+ case IDataModelAttribute.TYPE_CODE_TREE:
+ case IDataModelAttribute.TYPE_NUMBER_LIST:
+ case IDataModelAttribute.TYPE_NUMBER_TREE: {
+ opList.add(DataModelAttributeOp.create(OPERATOR_IN));
+ if (attribute.isNotOperatorEnabled()) {
+ opList.add(DataModelAttributeOp.create(OPERATOR_NOT_IN));
+ }
+ if (attribute.isNullOperatorEnabled()) {
+ opList.add(DataModelAttributeOp.create(OPERATOR_NUMBER_NULL));
+ }
+ if (attribute.isNotOperatorEnabled() && attribute.isNullOperatorEnabled()) {
+ opList.add(DataModelAttributeOp.create(OPERATOR_NUMBER_NOT_NULL));
+ }
+ break;
+ }
+ case IDataModelAttribute.TYPE_TIME: {
+ opList.add(DataModelAttributeOp.create(OPERATOR_EQ));
+ if (attribute.isNotOperatorEnabled()) {
+ opList.add(DataModelAttributeOp.create(OPERATOR_NEQ));
+ }
+ opList.add(DataModelAttributeOp.create(OPERATOR_BETWEEN));
+ opList.add(DataModelAttributeOp.create(OPERATOR_LT));
+ opList.add(DataModelAttributeOp.create(OPERATOR_LE));
+ opList.add(DataModelAttributeOp.create(OPERATOR_GT));
+ opList.add(DataModelAttributeOp.create(OPERATOR_GE));
+ if (attribute.isNullOperatorEnabled()) {
+ opList.add(DataModelAttributeOp.create(OPERATOR_NULL));
+ }
+ if (attribute.isNotOperatorEnabled() && attribute.isNullOperatorEnabled()) {
+ opList.add(DataModelAttributeOp.create(OPERATOR_NOT_NULL));
+ }
+ opList.add(DataModelAttributeOp.create(OPERATOR_TIME_IS_IN_GE_HOURS));
+ opList.add(DataModelAttributeOp.create(OPERATOR_TIME_IS_IN_GE_MINUTES));
+ opList.add(DataModelAttributeOp.create(OPERATOR_TIME_IS_IN_HOURS));
+ // opList.add(DataModelAttributeOp.create(OPERATOR_Time_Is_In_Minutes,AGGREGATION_NONE));
+ opList.add(DataModelAttributeOp.create(OPERATOR_TIME_IS_IN_LE_HOURS));
+ opList.add(DataModelAttributeOp.create(OPERATOR_TIME_IS_IN_LE_MINUTES));
+ opList.add(DataModelAttributeOp.create(OPERATOR_TIME_IS_NOW));
+ break;
+ }
+ case IDataModelAttribute.TYPE_DATE: {
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_EQ));
+ if (attribute.isNotOperatorEnabled()) {
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_NEQ));
+ }
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_BETWEEN));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_LT));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_LE));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_GT));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_GE));
+ if (attribute.isNullOperatorEnabled()) {
+ opList.add(DataModelAttributeOp.create(OPERATOR_NULL));
+ }
+ if (attribute.isNotOperatorEnabled() && attribute.isNullOperatorEnabled()) {
+ opList.add(DataModelAttributeOp.create(OPERATOR_NOT_NULL));
+ }
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_TODAY));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_LAST_DAYS));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_LAST_MONTHS));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_NEXT_DAYS));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_NEXT_MONTHS));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_DAYS));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_MONTHS));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_LE_DAYS));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_LE_MONTHS));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_GE_DAYS));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_GE_MONTHS));
+ if (attribute.isNotOperatorEnabled()) {
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_NOT_TODAY));
+ }
+ break;
+ }
+ case IDataModelAttribute.TYPE_DATE_TIME: {
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_TIME_EQ));
+ if (attribute.isNotOperatorEnabled()) {
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_TIME_NEQ));
+ }
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_TIME_BETWEEN));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_TIME_LT));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_TIME_LE));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_TIME_GT));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_TIME_GE));
+ if (attribute.isNullOperatorEnabled()) {
+ opList.add(DataModelAttributeOp.create(OPERATOR_NULL));
+ }
+ if (attribute.isNotOperatorEnabled() && attribute.isNullOperatorEnabled()) {
+ opList.add(DataModelAttributeOp.create(OPERATOR_NOT_NULL));
+ }
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_TIME_IS_NOW));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_TODAY));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_LAST_DAYS));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_LAST_MONTHS));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_NEXT_DAYS));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_NEXT_MONTHS));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_DAYS));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_MONTHS));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_TIME_IS_IN_LE_MINUTES));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_TIME_IS_IN_LE_HOURS));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_LE_DAYS));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_LE_MONTHS));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_TIME_IS_IN_GE_MINUTES));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_TIME_IS_IN_GE_HOURS));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_GE_DAYS));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_IN_GE_MONTHS));
+ if (attribute.isNotOperatorEnabled()) {
+ // opList.add(DataModelAttributeOp.create(OPERATOR_Date_TimeIs_NotNow,AGGREGATION_NONE));
+ opList.add(DataModelAttributeOp.create(OPERATOR_DATE_IS_NOT_TODAY));
+ }
+ break;
+ }
+ case IDataModelAttribute.TYPE_INTEGER:
+ case IDataModelAttribute.TYPE_LONG:
+ case IDataModelAttribute.TYPE_DOUBLE:
+ case IDataModelAttribute.TYPE_PLAIN_INTEGER:
+ case IDataModelAttribute.TYPE_PLAIN_LONG:
+ case IDataModelAttribute.TYPE_PLAIN_DOUBLE:
+ case IDataModelAttribute.TYPE_PERCENT: {
+ opList.add(DataModelAttributeOp.create(OPERATOR_EQ));
+ if (attribute.isNotOperatorEnabled()) {
+ opList.add(DataModelAttributeOp.create(OPERATOR_NEQ));
+ }
+ opList.add(DataModelAttributeOp.create(OPERATOR_BETWEEN));
+ opList.add(DataModelAttributeOp.create(OPERATOR_LT));
+ opList.add(DataModelAttributeOp.create(OPERATOR_LE));
+ opList.add(DataModelAttributeOp.create(OPERATOR_GT));
+ opList.add(DataModelAttributeOp.create(OPERATOR_GE));
+ if (attribute.isNullOperatorEnabled()) {
+ opList.add(DataModelAttributeOp.create(OPERATOR_NULL));
+ }
+ if (attribute.isNotOperatorEnabled() && attribute.isNullOperatorEnabled()) {
+ opList.add(DataModelAttributeOp.create(OPERATOR_NOT_NULL));
+ }
+ break;
+ }
+ case IDataModelAttribute.TYPE_AGGREGATE_COUNT: {
+ opList.add(DataModelAttributeOp.create(OPERATOR_EQ));
+ if (attribute.isNotOperatorEnabled()) {
+ opList.add(DataModelAttributeOp.create(OPERATOR_NEQ));
+ }
+ opList.add(DataModelAttributeOp.create(OPERATOR_BETWEEN));
+ opList.add(DataModelAttributeOp.create(OPERATOR_LT));
+ opList.add(DataModelAttributeOp.create(OPERATOR_LE));
+ opList.add(DataModelAttributeOp.create(OPERATOR_GT));
+ opList.add(DataModelAttributeOp.create(OPERATOR_GE));
+ break;
+ }
+ case IDataModelAttribute.TYPE_STRING: {
+ opList.add(DataModelAttributeOp.create(OPERATOR_LIKE));
+ if (attribute.isNotOperatorEnabled()) {
+ opList.add(DataModelAttributeOp.create(OPERATOR_NEQ));
+ }
+ opList.add(DataModelAttributeOp.create(OPERATOR_CONTAINS));
+ if (attribute.isNotOperatorEnabled()) {
+ opList.add(DataModelAttributeOp.create(OPERATOR_NOT_CONTAINS));
+ }
+ opList.add(DataModelAttributeOp.create(OPERATOR_STARTS_WITH));
+ if (attribute.isNotOperatorEnabled()) {
+ opList.add(DataModelAttributeOp.create(OPERATOR_NOT_STARTS_WITH));
+ }
+ opList.add(DataModelAttributeOp.create(OPERATOR_ENDS_WITH));
+ if (attribute.isNotOperatorEnabled()) {
+ opList.add(DataModelAttributeOp.create(OPERATOR_NOT_ENDS_WITH));
+ }
+ if (attribute.isNullOperatorEnabled()) {
+ opList.add(DataModelAttributeOp.create(OPERATOR_NULL));
+ }
+ if (attribute.isNotOperatorEnabled() && attribute.isNullOperatorEnabled()) {
+ opList.add(DataModelAttributeOp.create(OPERATOR_NOT_NULL));
+ }
+ break;
+ }
+ case IDataModelAttribute.TYPE_FULL_TEXT: {
+ opList.add(DataModelAttributeOp.create(OPERATOR_CONTAINS));
+ if (attribute.isNotOperatorEnabled()) {
+ opList.add(DataModelAttributeOp.create(OPERATOR_NOT_CONTAINS));
+ }
+ if (attribute.isNullOperatorEnabled()) {
+ opList.add(DataModelAttributeOp.create(OPERATOR_NULL));
+ }
+ if (attribute.isNotOperatorEnabled() && attribute.isNullOperatorEnabled()) {
+ opList.add(DataModelAttributeOp.create(OPERATOR_NOT_NULL));
+ }
+ break;
+ }
+ }
+ //
+ attribute.setOperators(opList.toArray(new IDataModelAttributeOp[opList.size()]));
+ }
+
+ public void injectAggregationTypes(IDataModelAttribute attribute) {
+ ArrayList<Integer> agList = new ArrayList<Integer>();
+ if (attribute.isAggregationEnabled()) {
+ switch (attribute.getType()) {
+ case IDataModelAttribute.TYPE_DATE:
+ case IDataModelAttribute.TYPE_TIME:
+ case IDataModelAttribute.TYPE_DATE_TIME: {
+ agList.add(AGGREGATION_MIN);
+ agList.add(AGGREGATION_MAX);
+ agList.add(AGGREGATION_MEDIAN);
+ break;
+ }
+ case IDataModelAttribute.TYPE_INTEGER:
+ case IDataModelAttribute.TYPE_LONG:
+ case IDataModelAttribute.TYPE_DOUBLE:
+ case IDataModelAttribute.TYPE_PLAIN_INTEGER:
+ case IDataModelAttribute.TYPE_PLAIN_LONG:
+ case IDataModelAttribute.TYPE_PLAIN_DOUBLE:
+ case IDataModelAttribute.TYPE_PERCENT: {
+ agList.add(AGGREGATION_SUM);
+ agList.add(AGGREGATION_MIN);
+ agList.add(AGGREGATION_MAX);
+ agList.add(AGGREGATION_AVG);
+ agList.add(AGGREGATION_MEDIAN);
+ break;
+ }
+ case IDataModelAttribute.TYPE_AGGREGATE_COUNT: {
+ agList.add(AGGREGATION_COUNT);
+ break;
+ }
+ }
+ }
+ //
+ int[] a = new int[agList.size()];
+ for (int i = 0; i < a.length; i++) {
+ a[i] = agList.get(i);
+ }
+ attribute.setAggregationTypes(a);
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/DataModelAttributeOp.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/DataModelAttributeOp.java
index 370374d48f..73d7324865 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/DataModelAttributeOp.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/DataModelAttributeOp.java
@@ -1,1379 +1,1379 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.data.model;
-
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-
-public final class DataModelAttributeOp implements DataModelConstants {
-
- private DataModelAttributeOp() {
- }
-
- /**
- * @return a new {@link IDataModelAttributeOp} for a {@link DataModelConstants#OPERATOR_*}
- */
- public static IDataModelAttributeOp create(int operator) {
- switch (operator) {
- case OPERATOR_BETWEEN:
- return new Between(OPERATOR_BETWEEN);
- case OPERATOR_DATE_BETWEEN:
- return new Between(OPERATOR_DATE_BETWEEN);
- case OPERATOR_DATE_TIME_BETWEEN:
- return new Between(OPERATOR_DATE_TIME_BETWEEN);
- case OPERATOR_NEQ:
- return new NEQ(OPERATOR_NEQ);
- case OPERATOR_DATE_NEQ:
- return new NEQ(OPERATOR_DATE_NEQ);
- case OPERATOR_DATE_TIME_NEQ:
- return new NEQ(OPERATOR_DATE_TIME_NEQ);
- case OPERATOR_LT:
- return new LT(OPERATOR_LT);
- case OPERATOR_DATE_LT:
- return new LT(OPERATOR_DATE_LT);
- case OPERATOR_DATE_TIME_LT:
- return new LT(OPERATOR_DATE_TIME_LT);
- case OPERATOR_LE:
- return new LE(OPERATOR_LE);
- case OPERATOR_DATE_LE:
- return new LE(OPERATOR_DATE_LE);
- case OPERATOR_DATE_TIME_LE:
- return new LE(OPERATOR_DATE_TIME_LE);
- case OPERATOR_EQ:
- return new EQ(OPERATOR_EQ);
- case OPERATOR_DATE_EQ:
- return new EQ(OPERATOR_DATE_EQ);
- case OPERATOR_DATE_TIME_EQ:
- return new EQ(OPERATOR_DATE_TIME_EQ);
- case OPERATOR_GT:
- return new GT(OPERATOR_GT);
- case OPERATOR_DATE_GT:
- return new GT(OPERATOR_DATE_GT);
- case OPERATOR_DATE_TIME_GT:
- return new GT(OPERATOR_DATE_TIME_GT);
- case OPERATOR_GE:
- return new GE(OPERATOR_GE);
- case OPERATOR_DATE_GE:
- return new GE(OPERATOR_DATE_GE);
- case OPERATOR_DATE_TIME_GE:
- return new GE(OPERATOR_DATE_TIME_GE);
- case OPERATOR_DATE_IS_IN_DAYS:
- return new DateIsInDays(OPERATOR_DATE_IS_IN_DAYS);
- case OPERATOR_DATE_IS_IN_GE_DAYS:
- return new DateIsInGEDays(OPERATOR_DATE_IS_IN_GE_DAYS);
- case OPERATOR_DATE_IS_IN_GE_MONTHS:
- return new DateIsInGEMonths(OPERATOR_DATE_IS_IN_GE_MONTHS);
- case OPERATOR_DATE_IS_IN_LE_DAYS:
- return new DateIsInLEDays(OPERATOR_DATE_IS_IN_LE_DAYS);
- case OPERATOR_DATE_IS_IN_LE_MONTHS:
- return new DateIsInLEMonths(OPERATOR_DATE_IS_IN_LE_MONTHS);
- case OPERATOR_DATE_IS_IN_LAST_DAYS:
- return new DateIsInLastDays(OPERATOR_DATE_IS_IN_LAST_DAYS);
- case OPERATOR_DATE_IS_IN_LAST_MONTHS:
- return new DateIsInLastMonths(OPERATOR_DATE_IS_IN_LAST_MONTHS);
- case OPERATOR_DATE_IS_IN_MONTHS:
- return new DateIsInMonths(OPERATOR_DATE_IS_IN_MONTHS);
- case OPERATOR_DATE_IS_IN_NEXT_DAYS:
- return new DateIsInNextDays(OPERATOR_DATE_IS_IN_NEXT_DAYS);
- case OPERATOR_DATE_IS_IN_NEXT_MONTHS:
- return new DateIsInNextMonths(OPERATOR_DATE_IS_IN_NEXT_MONTHS);
- case OPERATOR_DATE_IS_NOT_TODAY:
- return new DateIsNotToday(OPERATOR_DATE_IS_NOT_TODAY);
- case OPERATOR_DATE_IS_TODAY:
- return new DateIsToday(OPERATOR_DATE_IS_TODAY);
- case OPERATOR_DATE_TIME_IS_IN_GE_HOURS:
- return new DateTimeIsInGEHours(OPERATOR_DATE_TIME_IS_IN_GE_HOURS);
- case OPERATOR_DATE_TIME_IS_IN_GE_MINUTES:
- return new DateTimeIsInGEMinutes(OPERATOR_DATE_TIME_IS_IN_GE_MINUTES);
- case OPERATOR_DATE_TIME_IS_IN_LE_HOURS:
- return new DateTimeIsInLEHours(OPERATOR_DATE_TIME_IS_IN_LE_HOURS);
- case OPERATOR_DATE_TIME_IS_IN_LE_MINUTES:
- return new DateTimeIsInLEMinutes(OPERATOR_DATE_TIME_IS_IN_LE_MINUTES);
- case OPERATOR_DATE_TIME_IS_NOT_NOW:
- return new DateTimeIsNotNow(OPERATOR_DATE_TIME_IS_NOT_NOW);
- case OPERATOR_DATE_TIME_IS_NOW:
- return new DateTimeIsNow(OPERATOR_DATE_TIME_IS_NOW);
- case OPERATOR_ENDS_WITH:
- return new EndsWith(OPERATOR_ENDS_WITH);
- case OPERATOR_NOT_ENDS_WITH:
- return new NotEndsWith(OPERATOR_NOT_ENDS_WITH);
- case OPERATOR_IN:
- return new In(OPERATOR_IN);
- case OPERATOR_CONTAINS:
- return new Contains(OPERATOR_CONTAINS);
- case OPERATOR_LIKE:
- return new Like(OPERATOR_LIKE);
- case OPERATOR_NOT_IN:
- return new NotIn(OPERATOR_NOT_IN);
- case OPERATOR_NOT_CONTAINS:
- return new NotContains(OPERATOR_NOT_CONTAINS);
- case OPERATOR_NOT_NULL:
- return new NotNull(OPERATOR_NOT_NULL);
- case OPERATOR_NUMBER_NOT_NULL:
- return new NumberNotNull(OPERATOR_NUMBER_NOT_NULL);
- case OPERATOR_NULL:
- return new Null(OPERATOR_NULL);
- case OPERATOR_NUMBER_NULL:
- return new NumberNull(OPERATOR_NUMBER_NULL);
- case OPERATOR_STARTS_WITH:
- return new StartsWith(OPERATOR_STARTS_WITH);
- case OPERATOR_NOT_STARTS_WITH:
- return new NotStartsWith(OPERATOR_NOT_STARTS_WITH);
- case OPERATOR_TIME_IS_IN_GE_HOURS:
- return new TimeIsInGEHours(OPERATOR_TIME_IS_IN_GE_HOURS);
- case OPERATOR_TIME_IS_IN_GE_MINUTES:
- return new TimeIsInGEMinutes(OPERATOR_TIME_IS_IN_GE_MINUTES);
- case OPERATOR_TIME_IS_IN_HOURS:
- return new TimeIsInHours(OPERATOR_TIME_IS_IN_HOURS);
- case OPERATOR_TIME_IS_IN_LE_HOURS:
- return new TimeIsInLEHours(OPERATOR_TIME_IS_IN_LE_HOURS);
- case OPERATOR_TIME_IS_IN_LE_MINUTES:
- return new TimeIsInLEMinutes(OPERATOR_TIME_IS_IN_LE_MINUTES);
- case OPERATOR_TIME_IS_IN_MINUTES:
- return new TimeIsInMinutes(OPERATOR_TIME_IS_IN_MINUTES);
- case OPERATOR_TIME_IS_NOW:
- return new TimeIsNow(OPERATOR_TIME_IS_NOW);
- case OPERATOR_TIME_IS_NOT_NOW:
- return new TimeIsNotNow(OPERATOR_TIME_IS_NOT_NOW);
- }
- return null;
- }
-
- private abstract static class AbstractDataModelOp implements IDataModelAttributeOp, DataModelConstants {
- private final int m_operator;
-
- AbstractDataModelOp(int operator) {
- m_operator = operator;
- }
-
- @Override
- public final int getOperator() {
- return m_operator;
- }
-
- @Override
- public String getShortText() {
- return getText();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == null) {
- return false;
- }
- return (this.getClass() == obj.getClass() && this.m_operator == ((AbstractDataModelOp) obj).m_operator);
- }
-
- @Override
- public int hashCode() {
- return this.getClass().hashCode();
- }
-
- public static String buildText(Integer aggregationType, String attributeText, String opText, String... valueTexts) {
- String text1 = null;
- if (valueTexts != null && valueTexts.length > 0) {
- text1 = valueTexts[0];
- }
- String text2 = null;
- if (valueTexts != null && valueTexts.length > 1) {
- text2 = valueTexts[1];
- }
- StringBuilder b = new StringBuilder();
- if (aggregationType != null) {
- switch (aggregationType.intValue()) {
- case AGGREGATION_AVG: {
- b.append(ScoutTexts.get("ComposerFieldAggregationAvg", attributeText));
- break;
- }
- case AGGREGATION_COUNT: {
- b.append(ScoutTexts.get("ComposerFieldAggregationCount", attributeText));
- break;
- }
- case AGGREGATION_MAX: {
- b.append(ScoutTexts.get("ComposerFieldAggregationMax", attributeText));
- break;
- }
- case AGGREGATION_MEDIAN: {
- b.append(ScoutTexts.get("ComposerFieldAggregationMedian", attributeText));
- break;
- }
- case AGGREGATION_MIN: {
- b.append(ScoutTexts.get("ComposerFieldAggregationMin", attributeText));
- break;
- }
- case AGGREGATION_SUM: {
- b.append(ScoutTexts.get("ComposerFieldAggregationSum", attributeText));
- break;
- }
- default: {
- b.append(attributeText);
- break;
- }
- }
- }
- else {
- b.append(attributeText);
- }
- String verboseValue;
- if (opText.indexOf("{0}") >= 0) {
- verboseValue = opText;
- if (verboseValue.indexOf("{0}") >= 0 && text1 != null) {
- verboseValue = verboseValue.replace("{0}", text1);
- }
- if (verboseValue.indexOf("{1}") >= 0 && text2 != null) {
- verboseValue = verboseValue.replace("{1}", text2);
- }
- }
- else {
- verboseValue = opText;
- if (text1 != null) {
- verboseValue += " " + text1;
- }
- if (text2 != null) {
- verboseValue += " " + text2;
- }
- }
- b.append(" ");
- b.append(verboseValue);
- return b.toString();
- }
- }
-
- private static class NEQ extends AbstractDataModelOp {
-
- /**
- * @param aggregationType
- */
- NEQ(int operator) {
- super(operator);
- }
-
- @Override
- public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
- return buildText(aggregationType, attributeText, getText(), valueTexts);
- }
-
- @Override
- public String getText() {
- return ScoutTexts.get("LogicNEQ");
- }
-
- @Override
- public int getType() {
- return IDataModelAttribute.TYPE_INHERITED;
- }
- }
-
- private static class LT extends AbstractDataModelOp {
-
- /**
- * @param aggregationType
- */
- LT(int operator) {
- super(operator);
- }
-
- @Override
- public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
- return buildText(aggregationType, attributeText, getText(), valueTexts);
- }
-
- @Override
- public String getText() {
- return ScoutTexts.get("LogicLT");
- }
-
- @Override
- public int getType() {
- return IDataModelAttribute.TYPE_INHERITED;
- }
- }
-
- private static class LE extends AbstractDataModelOp {
-
- /**
- * @param aggregationType
- */
- LE(int operator) {
- super(operator);
- }
-
- @Override
- public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
- return buildText(aggregationType, attributeText, getText(), valueTexts);
- }
-
- @Override
- public String getText() {
- return ScoutTexts.get("LogicLE");
- }
-
- @Override
- public int getType() {
- return IDataModelAttribute.TYPE_INHERITED;
- }
- }
-
- private static class EQ extends AbstractDataModelOp {
-
- /**
- * @param aggregationType
- */
- EQ(int operator) {
- super(operator);
- }
-
- @Override
- public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
- return buildText(aggregationType, attributeText, getText(), valueTexts);
- }
-
- @Override
- public String getText() {
- return ScoutTexts.get("LogicEQ");
- }
-
- @Override
- public int getType() {
- return IDataModelAttribute.TYPE_INHERITED;
- }
- }
-
- private static class GT extends AbstractDataModelOp {
-
- /**
- * @param aggregationType
- */
- GT(int operator) {
- super(operator);
- }
-
- @Override
- public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
- return buildText(aggregationType, attributeText, getText(), valueTexts);
- }
-
- @Override
- public String getText() {
- return ScoutTexts.get("LogicGT");
- }
-
- @Override
- public int getType() {
- return IDataModelAttribute.TYPE_INHERITED;
- }
- }
-
- private static class GE extends AbstractDataModelOp {
-
- /**
- * @param aggregationType
- */
- GE(int operator) {
- super(operator);
- }
-
- @Override
- public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
- return buildText(aggregationType, attributeText, getText(), valueTexts);
- }
-
- @Override
- public String getText() {
- return ScoutTexts.get("LogicGE");
- }
-
- @Override
- public int getType() {
- return IDataModelAttribute.TYPE_INHERITED;
- }
- }
-
- private static class DateIsInDays extends AbstractDataModelOp {
- /**
- * @param aggregationType
- */
- DateIsInDays(int operator) {
- super(operator);
- }
-
- @Override
- public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
- return buildText(aggregationType, attributeText, getText(), valueTexts);
- }
-
- @Override
- public String getText() {
- return ScoutTexts.get("LogicDateIsInDays");
- }
-
- @Override
- public int getType() {
- return IDataModelAttribute.TYPE_INTEGER;
- }
- }
-
- private static class DateIsInGEDays extends AbstractDataModelOp {
- /**
- * @param aggregationType
- */
- DateIsInGEDays(int operator) {
- super(operator);
- }
-
- @Override
- public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
- return buildText(aggregationType, attributeText, getText(), valueTexts);
- }
-
- @Override
- public String getText() {
- return ScoutTexts.get("LogicDateIsInGEDays");
- }
-
- @Override
- public int getType() {
- return IDataModelAttribute.TYPE_INTEGER;
- }
- }
-
- private static class DateIsInGEMonths extends AbstractDataModelOp {
- /**
- * @param aggregationType
- */
- DateIsInGEMonths(int operator) {
- super(operator);
- }
-
- @Override
- public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
- return buildText(aggregationType, attributeText, getText(), valueTexts);
- }
-
- @Override
- public String getText() {
- return ScoutTexts.get("LogicDateIsInGEMonths");
- }
-
- @Override
- public int getType() {
- return IDataModelAttribute.TYPE_INTEGER;
- }
- }
-
- private static class DateIsInLEDays extends AbstractDataModelOp {
- /**
- * @param aggregationType
- */
- DateIsInLEDays(int operator) {
- super(operator);
- }
-
- @Override
- public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
- return buildText(aggregationType, attributeText, getText(), valueTexts);
- }
-
- @Override
- public String getText() {
- return ScoutTexts.get("LogicDateIsInLEDays");
- }
-
- @Override
- public int getType() {
- return IDataModelAttribute.TYPE_INTEGER;
- }
- }
-
- private static class DateIsInLEMonths extends AbstractDataModelOp {
- /**
- * @param aggregationType
- */
- DateIsInLEMonths(int operator) {
- super(operator);
- }
-
- @Override
- public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
- return buildText(aggregationType, attributeText, getText(), valueTexts);
- }
-
- @Override
- public String getText() {
- return ScoutTexts.get("LogicDateIsInLEMonths");
- }
-
- @Override
- public int getType() {
- return IDataModelAttribute.TYPE_INTEGER;
- }
- }
-
- private static class DateIsInLastDays extends AbstractDataModelOp {
- /**
- * @param aggregationType
- */
- DateIsInLastDays(int operator) {
- super(operator);
- }
-
- @Override
- public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
- return buildText(aggregationType, attributeText, getText(), valueTexts);
- }
-
- @Override
- public String getText() {
- return ScoutTexts.get("LogicDateIsInLastDays");
- }
-
- @Override
- public int getType() {
- return IDataModelAttribute.TYPE_INTEGER;
- }
- }
-
- private static class DateIsInLastMonths extends AbstractDataModelOp {
- /**
- * @param aggregationType
- */
- DateIsInLastMonths(int operator) {
- super(operator);
- }
-
- @Override
- public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
- return buildText(aggregationType, attributeText, getText(), valueTexts);
- }
-
- @Override
- public String getText() {
- return ScoutTexts.get("LogicDateIsInLastMonths");
- }
-
- @Override
- public int getType() {
- return IDataModelAttribute.TYPE_INTEGER;
- }
- }
-
- private static class DateIsInMonths extends AbstractDataModelOp {
- /**
- * @param aggregationType
- */
- DateIsInMonths(int operator) {
- super(operator);
- }
-
- @Override
- public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
- return buildText(aggregationType, attributeText, getText(), valueTexts);
- }
-
- @Override
- public String getText() {
- return ScoutTexts.get("LogicDateIsInMonths");
- }
-
- @Override
- public int getType() {
- return IDataModelAttribute.TYPE_INTEGER;
- }
- }
-
- private static class DateIsInNextDays extends AbstractDataModelOp {
- /**
- * @param aggregationType
- */
- DateIsInNextDays(int operator) {
- super(operator);
- }
-
- @Override
- public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
- return buildText(aggregationType, attributeText, getText(), valueTexts);
- }
-
- @Override
- public String getText() {
- return ScoutTexts.get("LogicDateIsInNextDays");
- }
-
- @Override
- public int getType() {
- return IDataModelAttribute.TYPE_INTEGER;
- }
- }
-
- private static class DateIsInNextMonths extends AbstractDataModelOp {
- /**
- * @param aggregationType
- */
- DateIsInNextMonths(int operator) {
- super(operator);
- }
-
- @Override
- public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
- return buildText(aggregationType, attributeText, getText(), valueTexts);
- }
-
- @Override
- public String getText() {
- return ScoutTexts.get("LogicDateIsInNextMonths");
- }
-
- @Override
- public int getType() {
- return IDataModelAttribute.TYPE_INTEGER;
- }
- }
-
- private static class DateIsNotToday extends AbstractDataModelOp {
- /**
- * @param aggregationType
- */
- DateIsNotToday(int operator) {
- super(operator);
- }
-
- @Override
- public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
- return buildText(aggregationType, attributeText, ScoutTexts.get("LogicDateIsNotToday"));
- }
-
- @Override
- public String getText() {
- return ScoutTexts.get("LogicDateIsNotToday");
- }
-
- @Override
- public int getType() {
- return IDataModelAttribute.TYPE_NONE;
- }
- }
-
- private static class DateIsToday extends AbstractDataModelOp {
- /**
- * @param aggregationType
- */
- DateIsToday(int operator) {
- super(operator);
- }
-
- @Override
- public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
- return buildText(aggregationType, attributeText, ScoutTexts.get("LogicDateIsToday"));
- }
-
- @Override
- public String getText() {
- return ScoutTexts.get("LogicDateIsToday");
- }
-
- @Override
- public int getType() {
- return IDataModelAttribute.TYPE_NONE;
- }
- }
-
- private static class DateTimeIsInGEHours extends AbstractDataModelOp {
- /**
- * @param aggregationType
- */
- DateTimeIsInGEHours(int operator) {
- super(operator);
- }
-
- @Override
- public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
- return buildText(aggregationType, attributeText, getText(), valueTexts);
- }
-
- @Override
- public String getText() {
- return ScoutTexts.get("LogicDateTimeIsInGEHours");
- }
-
- @Override
- public int getType() {
- return IDataModelAttribute.TYPE_INTEGER;
- }
- }
-
- private static class DateTimeIsInGEMinutes extends AbstractDataModelOp {
- /**
- * @param aggregationType
- */
- DateTimeIsInGEMinutes(int operator) {
- super(operator);
- }
-
- @Override
- public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
- return buildText(aggregationType, attributeText, getText(), valueTexts);
- }
-
- @Override
- public String getText() {
- return ScoutTexts.get("LogicDateTimeIsInGEMinutes");
- }
-
- @Override
- public int getType() {
- return IDataModelAttribute.TYPE_INTEGER;
- }
- }
-
- private static class DateTimeIsInLEHours extends AbstractDataModelOp {
- /**
- * @param aggregationType
- */
- DateTimeIsInLEHours(int operator) {
- super(operator);
- }
-
- @Override
- public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
- return buildText(aggregationType, attributeText, getText(), valueTexts);
- }
-
- @Override
- public String getText() {
- return ScoutTexts.get("LogicDateTimeIsInLEHours");
- }
-
- @Override
- public int getType() {
- return IDataModelAttribute.TYPE_INTEGER;
- }
- }
-
- private static class DateTimeIsInLEMinutes extends AbstractDataModelOp {
- /**
- * @param aggregationType
- */
- DateTimeIsInLEMinutes(int operator) {
- super(operator);
- }
-
- @Override
- public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
- return buildText(aggregationType, attributeText, getText(), valueTexts);
- }
-
- @Override
- public String getText() {
- return ScoutTexts.get("LogicDateTimeIsInLEMinutes");
- }
-
- @Override
- public int getType() {
- return IDataModelAttribute.TYPE_INTEGER;
- }
- }
-
- private static class DateTimeIsNotNow extends AbstractDataModelOp {
- /**
- * @param aggregationType
- */
- DateTimeIsNotNow(int operator) {
- super(operator);
- }
-
- @Override
- public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
- return buildText(aggregationType, attributeText, ScoutTexts.get("LogicDateTimeIsNotNow"));
- }
-
- @Override
- public String getText() {
- return ScoutTexts.get("LogicDateTimeIsNotNow");
- }
-
- @Override
- public int getType() {
- return IDataModelAttribute.TYPE_NONE;
- }
- }
-
- private static class DateTimeIsNow extends AbstractDataModelOp {
- /**
- * @param aggregationType
- */
- DateTimeIsNow(int operator) {
- super(operator);
- }
-
- @Override
- public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
- return buildText(aggregationType, attributeText, ScoutTexts.get("LogicDateTimeIsNow"));
- }
-
- @Override
- public String getText() {
- return ScoutTexts.get("LogicDateTimeIsNow");
- }
-
- @Override
- public int getType() {
- return IDataModelAttribute.TYPE_NONE;
- }
- }
-
- private static class EndsWith extends AbstractDataModelOp {
- /**
- * @param aggregationType
- */
- EndsWith(int operator) {
- super(operator);
- }
-
- @Override
- public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
- return buildText(aggregationType, attributeText, getText(), valueTexts);
- }
-
- @Override
- public String getText() {
- return ScoutTexts.get("LogicEndsWith");
- }
-
- @Override
- public int getType() {
- return IDataModelAttribute.TYPE_INHERITED;
- }
- }
-
- private static class NotEndsWith extends AbstractDataModelOp {
- /**
- * @param aggregationType
- */
- NotEndsWith(int operator) {
- super(operator);
- }
-
- @Override
- public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
- return buildText(aggregationType, attributeText, getText(), valueTexts);
- }
-
- @Override
- public String getText() {
- return ScoutTexts.get("LogicNotEndsWith");
- }
-
- @Override
- public int getType() {
- return IDataModelAttribute.TYPE_INHERITED;
- }
- }
-
- private static class In extends AbstractDataModelOp {
- /**
- * @param aggregationType
- */
- In(int operator) {
- super(operator);
- }
-
- @Override
- public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
- return buildText(aggregationType, attributeText, getText(), valueTexts);
- }
-
- @Override
- public String getText() {
- return ScoutTexts.get("LogicIn");
- }
-
- @Override
- public int getType() {
- return IDataModelAttribute.TYPE_INHERITED;
- }
- }
-
- private static class Contains extends AbstractDataModelOp {
- /**
- * @param aggregationType
- */
- Contains(int operator) {
- super(operator);
- }
-
- @Override
- public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
- return buildText(aggregationType, attributeText, getText(), valueTexts);
- }
-
- @Override
- public String getText() {
- return ScoutTexts.get("LogicLike");
- }
-
- @Override
- public int getType() {
- return IDataModelAttribute.TYPE_INHERITED;
- }
- }
-
- private static class NotIn extends AbstractDataModelOp {
- /**
- * @param aggregationType
- */
- NotIn(int operator) {
- super(operator);
- }
-
- @Override
- public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
- return buildText(aggregationType, attributeText, getText(), valueTexts);
- }
-
- @Override
- public String getText() {
- return ScoutTexts.get("LogicNotIn");
- }
-
- @Override
- public int getType() {
- return IDataModelAttribute.TYPE_INHERITED;
- }
- }
-
- private static class NotContains extends AbstractDataModelOp {
- /**
- * @param aggregationType
- */
- NotContains(int operator) {
- super(operator);
- }
-
- @Override
- public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
- return buildText(aggregationType, attributeText, getText(), valueTexts);
- }
-
- @Override
- public String getText() {
- return ScoutTexts.get("LogicNotLike");
- }
-
- @Override
- public int getType() {
- return IDataModelAttribute.TYPE_INHERITED;
- }
- }
-
- private static class NotNull extends AbstractDataModelOp {
- /**
- * @param aggregationType
- */
- NotNull(int operator) {
- super(operator);
- }
-
- @Override
- public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
- return buildText(aggregationType, attributeText, ScoutTexts.get("LogicNotNull"));
- }
-
- @Override
- public String getText() {
- return ScoutTexts.get("LogicNotNull");
- }
-
- @Override
- public int getType() {
- return IDataModelAttribute.TYPE_NONE;
- }
- }
-
- /**
- * nvl(x,0)<>0
- */
- private static class NumberNotNull extends AbstractDataModelOp {
- /**
- * @param aggregationType
- */
- NumberNotNull(int operator) {
- super(operator);
- }
-
- @Override
- public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
- return buildText(aggregationType, attributeText, ScoutTexts.get("LogicNotNull"));
- }
-
- @Override
- public String getText() {
- return ScoutTexts.get("LogicNotNull");
- }
-
- @Override
- public int getType() {
- return IDataModelAttribute.TYPE_NONE;
- }
- }
-
- private static class Null extends AbstractDataModelOp {
- /**
- * @param aggregationType
- */
- Null(int operator) {
- super(operator);
- }
-
- @Override
- public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
- return buildText(aggregationType, attributeText, ScoutTexts.get("LogicNull"));
- }
-
- @Override
- public String getText() {
- return ScoutTexts.get("LogicNull");
- }
-
- @Override
- public int getType() {
- return IDataModelAttribute.TYPE_NONE;
- }
- }
-
- /**
- * nvl(x,0)==0
- */
- private static class NumberNull extends AbstractDataModelOp {
- /**
- * @param aggregationType
- */
- NumberNull(int operator) {
- super(operator);
- }
-
- @Override
- public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
- return buildText(aggregationType, attributeText, ScoutTexts.get("LogicNull"));
- }
-
- @Override
- public String getText() {
- return ScoutTexts.get("LogicNull");
- }
-
- @Override
- public int getType() {
- return IDataModelAttribute.TYPE_NONE;
- }
- }
-
- private static class StartsWith extends AbstractDataModelOp {
- /**
- * @param aggregationType
- */
- StartsWith(int operator) {
- super(operator);
- }
-
- @Override
- public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
- return buildText(aggregationType, attributeText, getText(), valueTexts);
- }
-
- @Override
- public String getText() {
- return ScoutTexts.get("LogicStartsWith");
- }
-
- @Override
- public int getType() {
- return IDataModelAttribute.TYPE_INHERITED;
- }
- }
-
- private static class NotStartsWith extends AbstractDataModelOp {
- /**
- * @param aggregationType
- */
- NotStartsWith(int operator) {
- super(operator);
- }
-
- @Override
- public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
- return buildText(aggregationType, attributeText, getText(), valueTexts);
- }
-
- @Override
- public String getText() {
- return ScoutTexts.get("LogicNotStartsWith");
- }
-
- @Override
- public int getType() {
- return IDataModelAttribute.TYPE_INHERITED;
- }
- }
-
- private static class TimeIsInGEHours extends AbstractDataModelOp {
- /**
- * @param aggregationType
- */
- TimeIsInGEHours(int operator) {
- super(operator);
- }
-
- @Override
- public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
- return buildText(aggregationType, attributeText, getText(), valueTexts);
- }
-
- @Override
- public String getText() {
- return ScoutTexts.get("LogicTimeIsInGEHours");
- }
-
- @Override
- public int getType() {
- return IDataModelAttribute.TYPE_INTEGER;
- }
- }
-
- private static class TimeIsInGEMinutes extends AbstractDataModelOp {
- /**
- * @param aggregationType
- */
- TimeIsInGEMinutes(int operator) {
- super(operator);
- }
-
- @Override
- public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
- return buildText(aggregationType, attributeText, getText(), valueTexts);
- }
-
- @Override
- public String getText() {
- return ScoutTexts.get("LogicTimeIsInGEMinutes");
- }
-
- @Override
- public int getType() {
- return IDataModelAttribute.TYPE_INTEGER;
- }
- }
-
- private static class TimeIsInHours extends AbstractDataModelOp {
- /**
- * @param aggregationType
- */
- TimeIsInHours(int operator) {
- super(operator);
- }
-
- @Override
- public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
- return buildText(aggregationType, attributeText, getText(), valueTexts);
- }
-
- @Override
- public String getText() {
- return ScoutTexts.get("LogicTimeIsInHours");
- }
-
- @Override
- public int getType() {
- return IDataModelAttribute.TYPE_INTEGER;
- }
- }
-
- private static class TimeIsInLEHours extends AbstractDataModelOp {
- /**
- * @param aggregationType
- */
- TimeIsInLEHours(int operator) {
- super(operator);
- }
-
- @Override
- public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
- return buildText(aggregationType, attributeText, getText(), valueTexts);
- }
-
- @Override
- public String getText() {
- return ScoutTexts.get("LogicTimeIsInLEHours");
- }
-
- @Override
- public int getType() {
- return IDataModelAttribute.TYPE_INTEGER;
- }
- }
-
- private static class TimeIsInLEMinutes extends AbstractDataModelOp {
- /**
- * @param aggregationType
- */
- TimeIsInLEMinutes(int operator) {
- super(operator);
- }
-
- @Override
- public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
- return buildText(aggregationType, attributeText, getText(), valueTexts);
- }
-
- @Override
- public String getText() {
- return ScoutTexts.get("LogicTimeIsInLEMinutes");
- }
-
- @Override
- public int getType() {
- return IDataModelAttribute.TYPE_INTEGER;
- }
- }
-
- private static class TimeIsInMinutes extends AbstractDataModelOp {
- /**
- * @param aggregationType
- */
- TimeIsInMinutes(int operator) {
- super(operator);
- }
-
- @Override
- public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
- return buildText(aggregationType, attributeText, getText(), valueTexts);
- }
-
- @Override
- public String getText() {
- return ScoutTexts.get("LogicTimeIsInMinutes");
- }
-
- @Override
- public int getType() {
- return IDataModelAttribute.TYPE_INTEGER;
- }
- }
-
- private static class TimeIsNow extends AbstractDataModelOp {
- /**
- * @param aggregationType
- */
- TimeIsNow(int operator) {
- super(operator);
- }
-
- @Override
- public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
- return buildText(aggregationType, attributeText, ScoutTexts.get("LogicTimeIsNow"));
- }
-
- @Override
- public String getText() {
- return ScoutTexts.get("LogicTimeIsNow");
- }
-
- @Override
- public int getType() {
- return IDataModelAttribute.TYPE_NONE;
- }
- }
-
- private static class TimeIsNotNow extends AbstractDataModelOp {
- /**
- * @param aggregationType
- */
- TimeIsNotNow(int operator) {
- super(operator);
- }
-
- @Override
- public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
- return buildText(aggregationType, attributeText, ScoutTexts.get("LogicTimeIsNotNow"));
- }
-
- @Override
- public String getText() {
- return ScoutTexts.get("LogicTimeIsNotNow");
- }
-
- @Override
- public int getType() {
- return IDataModelAttribute.TYPE_NONE;
- }
- }
-
- private static class Between extends AbstractDataModelOp {
-
- /**
- * @param aggregationType
- */
- Between(int operator) {
- super(operator);
- }
-
- @Override
- public String getShortText() {
- return ScoutTexts.get("LogicBetweenShort");
- }
-
- @Override
- public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
- if (StringUtility.isNullOrEmpty(valueTexts[0])) {
- return buildText(aggregationType, attributeText, ScoutTexts.get("LogicLE"), valueTexts[1]);
- }
- else if (StringUtility.isNullOrEmpty(valueTexts[1])) {
- return buildText(aggregationType, attributeText, ScoutTexts.get("LogicGE"), valueTexts[0]);
- }
- else {
- return buildText(aggregationType, attributeText, getText(), valueTexts);
- }
- }
-
- @Override
- public String getText() {
- return ScoutTexts.get("LogicBetween");
- }
-
- @Override
- public int getType() {
- return IDataModelAttribute.TYPE_INHERITED;
- }
- }
-
- private static class Like extends AbstractDataModelOp {
- /**
- * @param aggregationType
- */
- Like(int operator) {
- super(operator);
- }
-
- @Override
- public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
- return buildText(aggregationType, attributeText, getText(), valueTexts);
- }
-
- @Override
- public String getText() {
- return ScoutTexts.get("LogicEQ");
- }
-
- @Override
- public int getType() {
- return IDataModelAttribute.TYPE_STRING;
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.data.model;
+
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+
+public final class DataModelAttributeOp implements DataModelConstants {
+
+ private DataModelAttributeOp() {
+ }
+
+ /**
+ * @return a new {@link IDataModelAttributeOp} for a {@link DataModelConstants#OPERATOR_*}
+ */
+ public static IDataModelAttributeOp create(int operator) {
+ switch (operator) {
+ case OPERATOR_BETWEEN:
+ return new Between(OPERATOR_BETWEEN);
+ case OPERATOR_DATE_BETWEEN:
+ return new Between(OPERATOR_DATE_BETWEEN);
+ case OPERATOR_DATE_TIME_BETWEEN:
+ return new Between(OPERATOR_DATE_TIME_BETWEEN);
+ case OPERATOR_NEQ:
+ return new NEQ(OPERATOR_NEQ);
+ case OPERATOR_DATE_NEQ:
+ return new NEQ(OPERATOR_DATE_NEQ);
+ case OPERATOR_DATE_TIME_NEQ:
+ return new NEQ(OPERATOR_DATE_TIME_NEQ);
+ case OPERATOR_LT:
+ return new LT(OPERATOR_LT);
+ case OPERATOR_DATE_LT:
+ return new LT(OPERATOR_DATE_LT);
+ case OPERATOR_DATE_TIME_LT:
+ return new LT(OPERATOR_DATE_TIME_LT);
+ case OPERATOR_LE:
+ return new LE(OPERATOR_LE);
+ case OPERATOR_DATE_LE:
+ return new LE(OPERATOR_DATE_LE);
+ case OPERATOR_DATE_TIME_LE:
+ return new LE(OPERATOR_DATE_TIME_LE);
+ case OPERATOR_EQ:
+ return new EQ(OPERATOR_EQ);
+ case OPERATOR_DATE_EQ:
+ return new EQ(OPERATOR_DATE_EQ);
+ case OPERATOR_DATE_TIME_EQ:
+ return new EQ(OPERATOR_DATE_TIME_EQ);
+ case OPERATOR_GT:
+ return new GT(OPERATOR_GT);
+ case OPERATOR_DATE_GT:
+ return new GT(OPERATOR_DATE_GT);
+ case OPERATOR_DATE_TIME_GT:
+ return new GT(OPERATOR_DATE_TIME_GT);
+ case OPERATOR_GE:
+ return new GE(OPERATOR_GE);
+ case OPERATOR_DATE_GE:
+ return new GE(OPERATOR_DATE_GE);
+ case OPERATOR_DATE_TIME_GE:
+ return new GE(OPERATOR_DATE_TIME_GE);
+ case OPERATOR_DATE_IS_IN_DAYS:
+ return new DateIsInDays(OPERATOR_DATE_IS_IN_DAYS);
+ case OPERATOR_DATE_IS_IN_GE_DAYS:
+ return new DateIsInGEDays(OPERATOR_DATE_IS_IN_GE_DAYS);
+ case OPERATOR_DATE_IS_IN_GE_MONTHS:
+ return new DateIsInGEMonths(OPERATOR_DATE_IS_IN_GE_MONTHS);
+ case OPERATOR_DATE_IS_IN_LE_DAYS:
+ return new DateIsInLEDays(OPERATOR_DATE_IS_IN_LE_DAYS);
+ case OPERATOR_DATE_IS_IN_LE_MONTHS:
+ return new DateIsInLEMonths(OPERATOR_DATE_IS_IN_LE_MONTHS);
+ case OPERATOR_DATE_IS_IN_LAST_DAYS:
+ return new DateIsInLastDays(OPERATOR_DATE_IS_IN_LAST_DAYS);
+ case OPERATOR_DATE_IS_IN_LAST_MONTHS:
+ return new DateIsInLastMonths(OPERATOR_DATE_IS_IN_LAST_MONTHS);
+ case OPERATOR_DATE_IS_IN_MONTHS:
+ return new DateIsInMonths(OPERATOR_DATE_IS_IN_MONTHS);
+ case OPERATOR_DATE_IS_IN_NEXT_DAYS:
+ return new DateIsInNextDays(OPERATOR_DATE_IS_IN_NEXT_DAYS);
+ case OPERATOR_DATE_IS_IN_NEXT_MONTHS:
+ return new DateIsInNextMonths(OPERATOR_DATE_IS_IN_NEXT_MONTHS);
+ case OPERATOR_DATE_IS_NOT_TODAY:
+ return new DateIsNotToday(OPERATOR_DATE_IS_NOT_TODAY);
+ case OPERATOR_DATE_IS_TODAY:
+ return new DateIsToday(OPERATOR_DATE_IS_TODAY);
+ case OPERATOR_DATE_TIME_IS_IN_GE_HOURS:
+ return new DateTimeIsInGEHours(OPERATOR_DATE_TIME_IS_IN_GE_HOURS);
+ case OPERATOR_DATE_TIME_IS_IN_GE_MINUTES:
+ return new DateTimeIsInGEMinutes(OPERATOR_DATE_TIME_IS_IN_GE_MINUTES);
+ case OPERATOR_DATE_TIME_IS_IN_LE_HOURS:
+ return new DateTimeIsInLEHours(OPERATOR_DATE_TIME_IS_IN_LE_HOURS);
+ case OPERATOR_DATE_TIME_IS_IN_LE_MINUTES:
+ return new DateTimeIsInLEMinutes(OPERATOR_DATE_TIME_IS_IN_LE_MINUTES);
+ case OPERATOR_DATE_TIME_IS_NOT_NOW:
+ return new DateTimeIsNotNow(OPERATOR_DATE_TIME_IS_NOT_NOW);
+ case OPERATOR_DATE_TIME_IS_NOW:
+ return new DateTimeIsNow(OPERATOR_DATE_TIME_IS_NOW);
+ case OPERATOR_ENDS_WITH:
+ return new EndsWith(OPERATOR_ENDS_WITH);
+ case OPERATOR_NOT_ENDS_WITH:
+ return new NotEndsWith(OPERATOR_NOT_ENDS_WITH);
+ case OPERATOR_IN:
+ return new In(OPERATOR_IN);
+ case OPERATOR_CONTAINS:
+ return new Contains(OPERATOR_CONTAINS);
+ case OPERATOR_LIKE:
+ return new Like(OPERATOR_LIKE);
+ case OPERATOR_NOT_IN:
+ return new NotIn(OPERATOR_NOT_IN);
+ case OPERATOR_NOT_CONTAINS:
+ return new NotContains(OPERATOR_NOT_CONTAINS);
+ case OPERATOR_NOT_NULL:
+ return new NotNull(OPERATOR_NOT_NULL);
+ case OPERATOR_NUMBER_NOT_NULL:
+ return new NumberNotNull(OPERATOR_NUMBER_NOT_NULL);
+ case OPERATOR_NULL:
+ return new Null(OPERATOR_NULL);
+ case OPERATOR_NUMBER_NULL:
+ return new NumberNull(OPERATOR_NUMBER_NULL);
+ case OPERATOR_STARTS_WITH:
+ return new StartsWith(OPERATOR_STARTS_WITH);
+ case OPERATOR_NOT_STARTS_WITH:
+ return new NotStartsWith(OPERATOR_NOT_STARTS_WITH);
+ case OPERATOR_TIME_IS_IN_GE_HOURS:
+ return new TimeIsInGEHours(OPERATOR_TIME_IS_IN_GE_HOURS);
+ case OPERATOR_TIME_IS_IN_GE_MINUTES:
+ return new TimeIsInGEMinutes(OPERATOR_TIME_IS_IN_GE_MINUTES);
+ case OPERATOR_TIME_IS_IN_HOURS:
+ return new TimeIsInHours(OPERATOR_TIME_IS_IN_HOURS);
+ case OPERATOR_TIME_IS_IN_LE_HOURS:
+ return new TimeIsInLEHours(OPERATOR_TIME_IS_IN_LE_HOURS);
+ case OPERATOR_TIME_IS_IN_LE_MINUTES:
+ return new TimeIsInLEMinutes(OPERATOR_TIME_IS_IN_LE_MINUTES);
+ case OPERATOR_TIME_IS_IN_MINUTES:
+ return new TimeIsInMinutes(OPERATOR_TIME_IS_IN_MINUTES);
+ case OPERATOR_TIME_IS_NOW:
+ return new TimeIsNow(OPERATOR_TIME_IS_NOW);
+ case OPERATOR_TIME_IS_NOT_NOW:
+ return new TimeIsNotNow(OPERATOR_TIME_IS_NOT_NOW);
+ }
+ return null;
+ }
+
+ private abstract static class AbstractDataModelOp implements IDataModelAttributeOp, DataModelConstants {
+ private final int m_operator;
+
+ AbstractDataModelOp(int operator) {
+ m_operator = operator;
+ }
+
+ @Override
+ public final int getOperator() {
+ return m_operator;
+ }
+
+ @Override
+ public String getShortText() {
+ return getText();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == null) {
+ return false;
+ }
+ return (this.getClass() == obj.getClass() && this.m_operator == ((AbstractDataModelOp) obj).m_operator);
+ }
+
+ @Override
+ public int hashCode() {
+ return this.getClass().hashCode();
+ }
+
+ public static String buildText(Integer aggregationType, String attributeText, String opText, String... valueTexts) {
+ String text1 = null;
+ if (valueTexts != null && valueTexts.length > 0) {
+ text1 = valueTexts[0];
+ }
+ String text2 = null;
+ if (valueTexts != null && valueTexts.length > 1) {
+ text2 = valueTexts[1];
+ }
+ StringBuilder b = new StringBuilder();
+ if (aggregationType != null) {
+ switch (aggregationType.intValue()) {
+ case AGGREGATION_AVG: {
+ b.append(ScoutTexts.get("ComposerFieldAggregationAvg", attributeText));
+ break;
+ }
+ case AGGREGATION_COUNT: {
+ b.append(ScoutTexts.get("ComposerFieldAggregationCount", attributeText));
+ break;
+ }
+ case AGGREGATION_MAX: {
+ b.append(ScoutTexts.get("ComposerFieldAggregationMax", attributeText));
+ break;
+ }
+ case AGGREGATION_MEDIAN: {
+ b.append(ScoutTexts.get("ComposerFieldAggregationMedian", attributeText));
+ break;
+ }
+ case AGGREGATION_MIN: {
+ b.append(ScoutTexts.get("ComposerFieldAggregationMin", attributeText));
+ break;
+ }
+ case AGGREGATION_SUM: {
+ b.append(ScoutTexts.get("ComposerFieldAggregationSum", attributeText));
+ break;
+ }
+ default: {
+ b.append(attributeText);
+ break;
+ }
+ }
+ }
+ else {
+ b.append(attributeText);
+ }
+ String verboseValue;
+ if (opText.indexOf("{0}") >= 0) {
+ verboseValue = opText;
+ if (verboseValue.indexOf("{0}") >= 0 && text1 != null) {
+ verboseValue = verboseValue.replace("{0}", text1);
+ }
+ if (verboseValue.indexOf("{1}") >= 0 && text2 != null) {
+ verboseValue = verboseValue.replace("{1}", text2);
+ }
+ }
+ else {
+ verboseValue = opText;
+ if (text1 != null) {
+ verboseValue += " " + text1;
+ }
+ if (text2 != null) {
+ verboseValue += " " + text2;
+ }
+ }
+ b.append(" ");
+ b.append(verboseValue);
+ return b.toString();
+ }
+ }
+
+ private static class NEQ extends AbstractDataModelOp {
+
+ /**
+ * @param aggregationType
+ */
+ NEQ(int operator) {
+ super(operator);
+ }
+
+ @Override
+ public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
+ return buildText(aggregationType, attributeText, getText(), valueTexts);
+ }
+
+ @Override
+ public String getText() {
+ return ScoutTexts.get("LogicNEQ");
+ }
+
+ @Override
+ public int getType() {
+ return IDataModelAttribute.TYPE_INHERITED;
+ }
+ }
+
+ private static class LT extends AbstractDataModelOp {
+
+ /**
+ * @param aggregationType
+ */
+ LT(int operator) {
+ super(operator);
+ }
+
+ @Override
+ public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
+ return buildText(aggregationType, attributeText, getText(), valueTexts);
+ }
+
+ @Override
+ public String getText() {
+ return ScoutTexts.get("LogicLT");
+ }
+
+ @Override
+ public int getType() {
+ return IDataModelAttribute.TYPE_INHERITED;
+ }
+ }
+
+ private static class LE extends AbstractDataModelOp {
+
+ /**
+ * @param aggregationType
+ */
+ LE(int operator) {
+ super(operator);
+ }
+
+ @Override
+ public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
+ return buildText(aggregationType, attributeText, getText(), valueTexts);
+ }
+
+ @Override
+ public String getText() {
+ return ScoutTexts.get("LogicLE");
+ }
+
+ @Override
+ public int getType() {
+ return IDataModelAttribute.TYPE_INHERITED;
+ }
+ }
+
+ private static class EQ extends AbstractDataModelOp {
+
+ /**
+ * @param aggregationType
+ */
+ EQ(int operator) {
+ super(operator);
+ }
+
+ @Override
+ public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
+ return buildText(aggregationType, attributeText, getText(), valueTexts);
+ }
+
+ @Override
+ public String getText() {
+ return ScoutTexts.get("LogicEQ");
+ }
+
+ @Override
+ public int getType() {
+ return IDataModelAttribute.TYPE_INHERITED;
+ }
+ }
+
+ private static class GT extends AbstractDataModelOp {
+
+ /**
+ * @param aggregationType
+ */
+ GT(int operator) {
+ super(operator);
+ }
+
+ @Override
+ public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
+ return buildText(aggregationType, attributeText, getText(), valueTexts);
+ }
+
+ @Override
+ public String getText() {
+ return ScoutTexts.get("LogicGT");
+ }
+
+ @Override
+ public int getType() {
+ return IDataModelAttribute.TYPE_INHERITED;
+ }
+ }
+
+ private static class GE extends AbstractDataModelOp {
+
+ /**
+ * @param aggregationType
+ */
+ GE(int operator) {
+ super(operator);
+ }
+
+ @Override
+ public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
+ return buildText(aggregationType, attributeText, getText(), valueTexts);
+ }
+
+ @Override
+ public String getText() {
+ return ScoutTexts.get("LogicGE");
+ }
+
+ @Override
+ public int getType() {
+ return IDataModelAttribute.TYPE_INHERITED;
+ }
+ }
+
+ private static class DateIsInDays extends AbstractDataModelOp {
+ /**
+ * @param aggregationType
+ */
+ DateIsInDays(int operator) {
+ super(operator);
+ }
+
+ @Override
+ public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
+ return buildText(aggregationType, attributeText, getText(), valueTexts);
+ }
+
+ @Override
+ public String getText() {
+ return ScoutTexts.get("LogicDateIsInDays");
+ }
+
+ @Override
+ public int getType() {
+ return IDataModelAttribute.TYPE_INTEGER;
+ }
+ }
+
+ private static class DateIsInGEDays extends AbstractDataModelOp {
+ /**
+ * @param aggregationType
+ */
+ DateIsInGEDays(int operator) {
+ super(operator);
+ }
+
+ @Override
+ public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
+ return buildText(aggregationType, attributeText, getText(), valueTexts);
+ }
+
+ @Override
+ public String getText() {
+ return ScoutTexts.get("LogicDateIsInGEDays");
+ }
+
+ @Override
+ public int getType() {
+ return IDataModelAttribute.TYPE_INTEGER;
+ }
+ }
+
+ private static class DateIsInGEMonths extends AbstractDataModelOp {
+ /**
+ * @param aggregationType
+ */
+ DateIsInGEMonths(int operator) {
+ super(operator);
+ }
+
+ @Override
+ public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
+ return buildText(aggregationType, attributeText, getText(), valueTexts);
+ }
+
+ @Override
+ public String getText() {
+ return ScoutTexts.get("LogicDateIsInGEMonths");
+ }
+
+ @Override
+ public int getType() {
+ return IDataModelAttribute.TYPE_INTEGER;
+ }
+ }
+
+ private static class DateIsInLEDays extends AbstractDataModelOp {
+ /**
+ * @param aggregationType
+ */
+ DateIsInLEDays(int operator) {
+ super(operator);
+ }
+
+ @Override
+ public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
+ return buildText(aggregationType, attributeText, getText(), valueTexts);
+ }
+
+ @Override
+ public String getText() {
+ return ScoutTexts.get("LogicDateIsInLEDays");
+ }
+
+ @Override
+ public int getType() {
+ return IDataModelAttribute.TYPE_INTEGER;
+ }
+ }
+
+ private static class DateIsInLEMonths extends AbstractDataModelOp {
+ /**
+ * @param aggregationType
+ */
+ DateIsInLEMonths(int operator) {
+ super(operator);
+ }
+
+ @Override
+ public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
+ return buildText(aggregationType, attributeText, getText(), valueTexts);
+ }
+
+ @Override
+ public String getText() {
+ return ScoutTexts.get("LogicDateIsInLEMonths");
+ }
+
+ @Override
+ public int getType() {
+ return IDataModelAttribute.TYPE_INTEGER;
+ }
+ }
+
+ private static class DateIsInLastDays extends AbstractDataModelOp {
+ /**
+ * @param aggregationType
+ */
+ DateIsInLastDays(int operator) {
+ super(operator);
+ }
+
+ @Override
+ public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
+ return buildText(aggregationType, attributeText, getText(), valueTexts);
+ }
+
+ @Override
+ public String getText() {
+ return ScoutTexts.get("LogicDateIsInLastDays");
+ }
+
+ @Override
+ public int getType() {
+ return IDataModelAttribute.TYPE_INTEGER;
+ }
+ }
+
+ private static class DateIsInLastMonths extends AbstractDataModelOp {
+ /**
+ * @param aggregationType
+ */
+ DateIsInLastMonths(int operator) {
+ super(operator);
+ }
+
+ @Override
+ public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
+ return buildText(aggregationType, attributeText, getText(), valueTexts);
+ }
+
+ @Override
+ public String getText() {
+ return ScoutTexts.get("LogicDateIsInLastMonths");
+ }
+
+ @Override
+ public int getType() {
+ return IDataModelAttribute.TYPE_INTEGER;
+ }
+ }
+
+ private static class DateIsInMonths extends AbstractDataModelOp {
+ /**
+ * @param aggregationType
+ */
+ DateIsInMonths(int operator) {
+ super(operator);
+ }
+
+ @Override
+ public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
+ return buildText(aggregationType, attributeText, getText(), valueTexts);
+ }
+
+ @Override
+ public String getText() {
+ return ScoutTexts.get("LogicDateIsInMonths");
+ }
+
+ @Override
+ public int getType() {
+ return IDataModelAttribute.TYPE_INTEGER;
+ }
+ }
+
+ private static class DateIsInNextDays extends AbstractDataModelOp {
+ /**
+ * @param aggregationType
+ */
+ DateIsInNextDays(int operator) {
+ super(operator);
+ }
+
+ @Override
+ public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
+ return buildText(aggregationType, attributeText, getText(), valueTexts);
+ }
+
+ @Override
+ public String getText() {
+ return ScoutTexts.get("LogicDateIsInNextDays");
+ }
+
+ @Override
+ public int getType() {
+ return IDataModelAttribute.TYPE_INTEGER;
+ }
+ }
+
+ private static class DateIsInNextMonths extends AbstractDataModelOp {
+ /**
+ * @param aggregationType
+ */
+ DateIsInNextMonths(int operator) {
+ super(operator);
+ }
+
+ @Override
+ public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
+ return buildText(aggregationType, attributeText, getText(), valueTexts);
+ }
+
+ @Override
+ public String getText() {
+ return ScoutTexts.get("LogicDateIsInNextMonths");
+ }
+
+ @Override
+ public int getType() {
+ return IDataModelAttribute.TYPE_INTEGER;
+ }
+ }
+
+ private static class DateIsNotToday extends AbstractDataModelOp {
+ /**
+ * @param aggregationType
+ */
+ DateIsNotToday(int operator) {
+ super(operator);
+ }
+
+ @Override
+ public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
+ return buildText(aggregationType, attributeText, ScoutTexts.get("LogicDateIsNotToday"));
+ }
+
+ @Override
+ public String getText() {
+ return ScoutTexts.get("LogicDateIsNotToday");
+ }
+
+ @Override
+ public int getType() {
+ return IDataModelAttribute.TYPE_NONE;
+ }
+ }
+
+ private static class DateIsToday extends AbstractDataModelOp {
+ /**
+ * @param aggregationType
+ */
+ DateIsToday(int operator) {
+ super(operator);
+ }
+
+ @Override
+ public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
+ return buildText(aggregationType, attributeText, ScoutTexts.get("LogicDateIsToday"));
+ }
+
+ @Override
+ public String getText() {
+ return ScoutTexts.get("LogicDateIsToday");
+ }
+
+ @Override
+ public int getType() {
+ return IDataModelAttribute.TYPE_NONE;
+ }
+ }
+
+ private static class DateTimeIsInGEHours extends AbstractDataModelOp {
+ /**
+ * @param aggregationType
+ */
+ DateTimeIsInGEHours(int operator) {
+ super(operator);
+ }
+
+ @Override
+ public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
+ return buildText(aggregationType, attributeText, getText(), valueTexts);
+ }
+
+ @Override
+ public String getText() {
+ return ScoutTexts.get("LogicDateTimeIsInGEHours");
+ }
+
+ @Override
+ public int getType() {
+ return IDataModelAttribute.TYPE_INTEGER;
+ }
+ }
+
+ private static class DateTimeIsInGEMinutes extends AbstractDataModelOp {
+ /**
+ * @param aggregationType
+ */
+ DateTimeIsInGEMinutes(int operator) {
+ super(operator);
+ }
+
+ @Override
+ public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
+ return buildText(aggregationType, attributeText, getText(), valueTexts);
+ }
+
+ @Override
+ public String getText() {
+ return ScoutTexts.get("LogicDateTimeIsInGEMinutes");
+ }
+
+ @Override
+ public int getType() {
+ return IDataModelAttribute.TYPE_INTEGER;
+ }
+ }
+
+ private static class DateTimeIsInLEHours extends AbstractDataModelOp {
+ /**
+ * @param aggregationType
+ */
+ DateTimeIsInLEHours(int operator) {
+ super(operator);
+ }
+
+ @Override
+ public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
+ return buildText(aggregationType, attributeText, getText(), valueTexts);
+ }
+
+ @Override
+ public String getText() {
+ return ScoutTexts.get("LogicDateTimeIsInLEHours");
+ }
+
+ @Override
+ public int getType() {
+ return IDataModelAttribute.TYPE_INTEGER;
+ }
+ }
+
+ private static class DateTimeIsInLEMinutes extends AbstractDataModelOp {
+ /**
+ * @param aggregationType
+ */
+ DateTimeIsInLEMinutes(int operator) {
+ super(operator);
+ }
+
+ @Override
+ public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
+ return buildText(aggregationType, attributeText, getText(), valueTexts);
+ }
+
+ @Override
+ public String getText() {
+ return ScoutTexts.get("LogicDateTimeIsInLEMinutes");
+ }
+
+ @Override
+ public int getType() {
+ return IDataModelAttribute.TYPE_INTEGER;
+ }
+ }
+
+ private static class DateTimeIsNotNow extends AbstractDataModelOp {
+ /**
+ * @param aggregationType
+ */
+ DateTimeIsNotNow(int operator) {
+ super(operator);
+ }
+
+ @Override
+ public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
+ return buildText(aggregationType, attributeText, ScoutTexts.get("LogicDateTimeIsNotNow"));
+ }
+
+ @Override
+ public String getText() {
+ return ScoutTexts.get("LogicDateTimeIsNotNow");
+ }
+
+ @Override
+ public int getType() {
+ return IDataModelAttribute.TYPE_NONE;
+ }
+ }
+
+ private static class DateTimeIsNow extends AbstractDataModelOp {
+ /**
+ * @param aggregationType
+ */
+ DateTimeIsNow(int operator) {
+ super(operator);
+ }
+
+ @Override
+ public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
+ return buildText(aggregationType, attributeText, ScoutTexts.get("LogicDateTimeIsNow"));
+ }
+
+ @Override
+ public String getText() {
+ return ScoutTexts.get("LogicDateTimeIsNow");
+ }
+
+ @Override
+ public int getType() {
+ return IDataModelAttribute.TYPE_NONE;
+ }
+ }
+
+ private static class EndsWith extends AbstractDataModelOp {
+ /**
+ * @param aggregationType
+ */
+ EndsWith(int operator) {
+ super(operator);
+ }
+
+ @Override
+ public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
+ return buildText(aggregationType, attributeText, getText(), valueTexts);
+ }
+
+ @Override
+ public String getText() {
+ return ScoutTexts.get("LogicEndsWith");
+ }
+
+ @Override
+ public int getType() {
+ return IDataModelAttribute.TYPE_INHERITED;
+ }
+ }
+
+ private static class NotEndsWith extends AbstractDataModelOp {
+ /**
+ * @param aggregationType
+ */
+ NotEndsWith(int operator) {
+ super(operator);
+ }
+
+ @Override
+ public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
+ return buildText(aggregationType, attributeText, getText(), valueTexts);
+ }
+
+ @Override
+ public String getText() {
+ return ScoutTexts.get("LogicNotEndsWith");
+ }
+
+ @Override
+ public int getType() {
+ return IDataModelAttribute.TYPE_INHERITED;
+ }
+ }
+
+ private static class In extends AbstractDataModelOp {
+ /**
+ * @param aggregationType
+ */
+ In(int operator) {
+ super(operator);
+ }
+
+ @Override
+ public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
+ return buildText(aggregationType, attributeText, getText(), valueTexts);
+ }
+
+ @Override
+ public String getText() {
+ return ScoutTexts.get("LogicIn");
+ }
+
+ @Override
+ public int getType() {
+ return IDataModelAttribute.TYPE_INHERITED;
+ }
+ }
+
+ private static class Contains extends AbstractDataModelOp {
+ /**
+ * @param aggregationType
+ */
+ Contains(int operator) {
+ super(operator);
+ }
+
+ @Override
+ public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
+ return buildText(aggregationType, attributeText, getText(), valueTexts);
+ }
+
+ @Override
+ public String getText() {
+ return ScoutTexts.get("LogicLike");
+ }
+
+ @Override
+ public int getType() {
+ return IDataModelAttribute.TYPE_INHERITED;
+ }
+ }
+
+ private static class NotIn extends AbstractDataModelOp {
+ /**
+ * @param aggregationType
+ */
+ NotIn(int operator) {
+ super(operator);
+ }
+
+ @Override
+ public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
+ return buildText(aggregationType, attributeText, getText(), valueTexts);
+ }
+
+ @Override
+ public String getText() {
+ return ScoutTexts.get("LogicNotIn");
+ }
+
+ @Override
+ public int getType() {
+ return IDataModelAttribute.TYPE_INHERITED;
+ }
+ }
+
+ private static class NotContains extends AbstractDataModelOp {
+ /**
+ * @param aggregationType
+ */
+ NotContains(int operator) {
+ super(operator);
+ }
+
+ @Override
+ public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
+ return buildText(aggregationType, attributeText, getText(), valueTexts);
+ }
+
+ @Override
+ public String getText() {
+ return ScoutTexts.get("LogicNotLike");
+ }
+
+ @Override
+ public int getType() {
+ return IDataModelAttribute.TYPE_INHERITED;
+ }
+ }
+
+ private static class NotNull extends AbstractDataModelOp {
+ /**
+ * @param aggregationType
+ */
+ NotNull(int operator) {
+ super(operator);
+ }
+
+ @Override
+ public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
+ return buildText(aggregationType, attributeText, ScoutTexts.get("LogicNotNull"));
+ }
+
+ @Override
+ public String getText() {
+ return ScoutTexts.get("LogicNotNull");
+ }
+
+ @Override
+ public int getType() {
+ return IDataModelAttribute.TYPE_NONE;
+ }
+ }
+
+ /**
+ * nvl(x,0)<>0
+ */
+ private static class NumberNotNull extends AbstractDataModelOp {
+ /**
+ * @param aggregationType
+ */
+ NumberNotNull(int operator) {
+ super(operator);
+ }
+
+ @Override
+ public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
+ return buildText(aggregationType, attributeText, ScoutTexts.get("LogicNotNull"));
+ }
+
+ @Override
+ public String getText() {
+ return ScoutTexts.get("LogicNotNull");
+ }
+
+ @Override
+ public int getType() {
+ return IDataModelAttribute.TYPE_NONE;
+ }
+ }
+
+ private static class Null extends AbstractDataModelOp {
+ /**
+ * @param aggregationType
+ */
+ Null(int operator) {
+ super(operator);
+ }
+
+ @Override
+ public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
+ return buildText(aggregationType, attributeText, ScoutTexts.get("LogicNull"));
+ }
+
+ @Override
+ public String getText() {
+ return ScoutTexts.get("LogicNull");
+ }
+
+ @Override
+ public int getType() {
+ return IDataModelAttribute.TYPE_NONE;
+ }
+ }
+
+ /**
+ * nvl(x,0)==0
+ */
+ private static class NumberNull extends AbstractDataModelOp {
+ /**
+ * @param aggregationType
+ */
+ NumberNull(int operator) {
+ super(operator);
+ }
+
+ @Override
+ public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
+ return buildText(aggregationType, attributeText, ScoutTexts.get("LogicNull"));
+ }
+
+ @Override
+ public String getText() {
+ return ScoutTexts.get("LogicNull");
+ }
+
+ @Override
+ public int getType() {
+ return IDataModelAttribute.TYPE_NONE;
+ }
+ }
+
+ private static class StartsWith extends AbstractDataModelOp {
+ /**
+ * @param aggregationType
+ */
+ StartsWith(int operator) {
+ super(operator);
+ }
+
+ @Override
+ public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
+ return buildText(aggregationType, attributeText, getText(), valueTexts);
+ }
+
+ @Override
+ public String getText() {
+ return ScoutTexts.get("LogicStartsWith");
+ }
+
+ @Override
+ public int getType() {
+ return IDataModelAttribute.TYPE_INHERITED;
+ }
+ }
+
+ private static class NotStartsWith extends AbstractDataModelOp {
+ /**
+ * @param aggregationType
+ */
+ NotStartsWith(int operator) {
+ super(operator);
+ }
+
+ @Override
+ public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
+ return buildText(aggregationType, attributeText, getText(), valueTexts);
+ }
+
+ @Override
+ public String getText() {
+ return ScoutTexts.get("LogicNotStartsWith");
+ }
+
+ @Override
+ public int getType() {
+ return IDataModelAttribute.TYPE_INHERITED;
+ }
+ }
+
+ private static class TimeIsInGEHours extends AbstractDataModelOp {
+ /**
+ * @param aggregationType
+ */
+ TimeIsInGEHours(int operator) {
+ super(operator);
+ }
+
+ @Override
+ public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
+ return buildText(aggregationType, attributeText, getText(), valueTexts);
+ }
+
+ @Override
+ public String getText() {
+ return ScoutTexts.get("LogicTimeIsInGEHours");
+ }
+
+ @Override
+ public int getType() {
+ return IDataModelAttribute.TYPE_INTEGER;
+ }
+ }
+
+ private static class TimeIsInGEMinutes extends AbstractDataModelOp {
+ /**
+ * @param aggregationType
+ */
+ TimeIsInGEMinutes(int operator) {
+ super(operator);
+ }
+
+ @Override
+ public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
+ return buildText(aggregationType, attributeText, getText(), valueTexts);
+ }
+
+ @Override
+ public String getText() {
+ return ScoutTexts.get("LogicTimeIsInGEMinutes");
+ }
+
+ @Override
+ public int getType() {
+ return IDataModelAttribute.TYPE_INTEGER;
+ }
+ }
+
+ private static class TimeIsInHours extends AbstractDataModelOp {
+ /**
+ * @param aggregationType
+ */
+ TimeIsInHours(int operator) {
+ super(operator);
+ }
+
+ @Override
+ public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
+ return buildText(aggregationType, attributeText, getText(), valueTexts);
+ }
+
+ @Override
+ public String getText() {
+ return ScoutTexts.get("LogicTimeIsInHours");
+ }
+
+ @Override
+ public int getType() {
+ return IDataModelAttribute.TYPE_INTEGER;
+ }
+ }
+
+ private static class TimeIsInLEHours extends AbstractDataModelOp {
+ /**
+ * @param aggregationType
+ */
+ TimeIsInLEHours(int operator) {
+ super(operator);
+ }
+
+ @Override
+ public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
+ return buildText(aggregationType, attributeText, getText(), valueTexts);
+ }
+
+ @Override
+ public String getText() {
+ return ScoutTexts.get("LogicTimeIsInLEHours");
+ }
+
+ @Override
+ public int getType() {
+ return IDataModelAttribute.TYPE_INTEGER;
+ }
+ }
+
+ private static class TimeIsInLEMinutes extends AbstractDataModelOp {
+ /**
+ * @param aggregationType
+ */
+ TimeIsInLEMinutes(int operator) {
+ super(operator);
+ }
+
+ @Override
+ public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
+ return buildText(aggregationType, attributeText, getText(), valueTexts);
+ }
+
+ @Override
+ public String getText() {
+ return ScoutTexts.get("LogicTimeIsInLEMinutes");
+ }
+
+ @Override
+ public int getType() {
+ return IDataModelAttribute.TYPE_INTEGER;
+ }
+ }
+
+ private static class TimeIsInMinutes extends AbstractDataModelOp {
+ /**
+ * @param aggregationType
+ */
+ TimeIsInMinutes(int operator) {
+ super(operator);
+ }
+
+ @Override
+ public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
+ return buildText(aggregationType, attributeText, getText(), valueTexts);
+ }
+
+ @Override
+ public String getText() {
+ return ScoutTexts.get("LogicTimeIsInMinutes");
+ }
+
+ @Override
+ public int getType() {
+ return IDataModelAttribute.TYPE_INTEGER;
+ }
+ }
+
+ private static class TimeIsNow extends AbstractDataModelOp {
+ /**
+ * @param aggregationType
+ */
+ TimeIsNow(int operator) {
+ super(operator);
+ }
+
+ @Override
+ public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
+ return buildText(aggregationType, attributeText, ScoutTexts.get("LogicTimeIsNow"));
+ }
+
+ @Override
+ public String getText() {
+ return ScoutTexts.get("LogicTimeIsNow");
+ }
+
+ @Override
+ public int getType() {
+ return IDataModelAttribute.TYPE_NONE;
+ }
+ }
+
+ private static class TimeIsNotNow extends AbstractDataModelOp {
+ /**
+ * @param aggregationType
+ */
+ TimeIsNotNow(int operator) {
+ super(operator);
+ }
+
+ @Override
+ public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
+ return buildText(aggregationType, attributeText, ScoutTexts.get("LogicTimeIsNotNow"));
+ }
+
+ @Override
+ public String getText() {
+ return ScoutTexts.get("LogicTimeIsNotNow");
+ }
+
+ @Override
+ public int getType() {
+ return IDataModelAttribute.TYPE_NONE;
+ }
+ }
+
+ private static class Between extends AbstractDataModelOp {
+
+ /**
+ * @param aggregationType
+ */
+ Between(int operator) {
+ super(operator);
+ }
+
+ @Override
+ public String getShortText() {
+ return ScoutTexts.get("LogicBetweenShort");
+ }
+
+ @Override
+ public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
+ if (StringUtility.isNullOrEmpty(valueTexts[0])) {
+ return buildText(aggregationType, attributeText, ScoutTexts.get("LogicLE"), valueTexts[1]);
+ }
+ else if (StringUtility.isNullOrEmpty(valueTexts[1])) {
+ return buildText(aggregationType, attributeText, ScoutTexts.get("LogicGE"), valueTexts[0]);
+ }
+ else {
+ return buildText(aggregationType, attributeText, getText(), valueTexts);
+ }
+ }
+
+ @Override
+ public String getText() {
+ return ScoutTexts.get("LogicBetween");
+ }
+
+ @Override
+ public int getType() {
+ return IDataModelAttribute.TYPE_INHERITED;
+ }
+ }
+
+ private static class Like extends AbstractDataModelOp {
+ /**
+ * @param aggregationType
+ */
+ Like(int operator) {
+ super(operator);
+ }
+
+ @Override
+ public String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts) {
+ return buildText(aggregationType, attributeText, getText(), valueTexts);
+ }
+
+ @Override
+ public String getText() {
+ return ScoutTexts.get("LogicEQ");
+ }
+
+ @Override
+ public int getType() {
+ return IDataModelAttribute.TYPE_STRING;
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/DataModelConstants.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/DataModelConstants.java
index 6df02bdf9c..ea2ab7a952 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/DataModelConstants.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/DataModelConstants.java
@@ -1,679 +1,679 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.data.model;
-
-/**
- *
- */
-public interface DataModelConstants {
- /**
- * internal type for operators that inherit type of attribute (default)
- */
- int TYPE_INHERITED = -1;
-
- /**
- * type for operators that need no value, such as IS NULL or IS NOT NULL
- */
- int TYPE_NONE = 0;
-
- int TYPE_CODE_LIST = 1;
- int TYPE_CODE_TREE = 2;
- int TYPE_NUMBER_LIST = 3;
- int TYPE_NUMBER_TREE = 4;
- int TYPE_DATE = 5;
- int TYPE_TIME = 6;
- int TYPE_DATE_TIME = 7;
- int TYPE_INTEGER = 8;
- int TYPE_LONG = 9;
- int TYPE_DOUBLE = 10;
- int TYPE_PLAIN_INTEGER = 11;
- int TYPE_PLAIN_LONG = 12;
- int TYPE_PLAIN_DOUBLE = 13;
- int TYPE_PERCENT = 14;
- int TYPE_STRING = 15;
- int TYPE_SMART = 16;
- /**
- * Attribute used to create a count(Entity) on the enclosing entity.
- */
- int TYPE_AGGREGATE_COUNT = 17;
- /**
- * Attribute used for full text searches
- */
- int TYPE_FULL_TEXT = 18;
-
- /**
- * marker operator that does nothing, no "attribute" "op" "value" pattern is used but simply "attribute"
- */
- int OPERATOR_NONE = 0;
- /**
- * <p>
- * Is a string contained in another string?
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createContains(String, String)}
- * </p>
- */
- int OPERATOR_CONTAINS = 1;
- /**
- * <p>
- * Is a date between now and a number of days from today on?
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateIsInDays(String, String)}
- * </p>
- */
- int OPERATOR_DATE_IS_IN_DAYS = 2;
- /**
- * <p>
- * Is a date more or equal days in the future as a value given?
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateIsInGEDays(String, String)}
- * </p>
- */
- int OPERATOR_DATE_IS_IN_GE_DAYS = 3;
- /**
- * <p>
- * Is a date more or equal months in the future as a value given?
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateIsInGEMonths(String, String)}
- * </p>
- */
- int OPERATOR_DATE_IS_IN_GE_MONTHS = 4;
- /**
- * <p>
- * Is a date less or equal days in the future as the value given?
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateIsInLEDays(String, String)}
- * </p>
- */
- int OPERATOR_DATE_IS_IN_LE_DAYS = 5;
- /**
- * <p>
- * Is a date less or equal months in the future as a value given?
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateIsInLEMonths(String, String)}
- * </p>
- */
- int OPERATOR_DATE_IS_IN_LE_MONTHS = 6;
- /**
- * <p>
- * Is a date in the past no more days in the past than a value given?
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateIsInLastDays(String, String)}
- * </p>
- */
- int OPERATOR_DATE_IS_IN_LAST_DAYS = 7;
- /**
- * <p>
- * Is a date in the past no more months in the past than a value given?
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateIsInLastMonths(String, String)}
- * </p>
- */
- int OPERATOR_DATE_IS_IN_LAST_MONTHS = 8;
- /**
- * <p>
- * Is a date exactly the number of months in the future as specified by value.
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateIsInMonths(String, String)}
- * </p>
- */
- int OPERATOR_DATE_IS_IN_MONTHS = 9;
- /**
- * <p>
- * Is a date in the number of next days as specified by a value?
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateIsInNextDays(String, String)}
- * </p>
- */
- int OPERATOR_DATE_IS_IN_NEXT_DAYS = 10;
- /**
- * <p>
- * Is a date in the number of next months as specified by a value?
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateIsInNextMonths(String, String)}
- * </p>
- */
- int OPERATOR_DATE_IS_IN_NEXT_MONTHS = 11;
- /**
- * <p>
- * Is a date not today?
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateIsNotToday(String)}
- * </p>
- */
- int OPERATOR_DATE_IS_NOT_TODAY = 12;
- /**
- * <p>
- * Is a date today?
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateIsToday(String)}
- * </p>
- */
- int OPERATOR_DATE_IS_TODAY = 13;
- /**
- * <p>
- * Is a date with time more or equal hours in the future as specified by a value?
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateTimeIsInGEHours(String, String)}
- * </p>
- */
- int OPERATOR_DATE_TIME_IS_IN_GE_HOURS = 14;
- /**
- * <p>
- * Is a date with time more or equal minutes in the future as specified by a value?
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateTimeIsInGEMinutes(String, String)}
- * </p>
- */
- int OPERATOR_DATE_TIME_IS_IN_GE_MINUTES = 15;
- /**
- * <p>
- * Is a date with time less or equal hours in the future as specified by a value?
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateTimeIsInLEHours(String, String)}
- * </p>
- */
- int OPERATOR_DATE_TIME_IS_IN_LE_HOURS = 16;
- /**
- * <p>
- * Is a date with time less or equal minutes in the future as specified by a value?
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateTimeIsInLEMinutes(String, String)}
- * </p>
- */
- int OPERATOR_DATE_TIME_IS_IN_LE_MINUTES = 17;
- /**
- * <p>
- * Is a date with time not now?
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateTimeIsNotNow(String)}
- * </p>
- */
- int OPERATOR_DATE_TIME_IS_NOT_NOW = 18;
- /**
- * <p>
- * Is a date with time now?
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateTimeIsNow(String)}
- * </p>
- */
- int OPERATOR_DATE_TIME_IS_NOW = 19;
- /**
- * <p>
- * Is a value equal to another value?
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createEQ(String, String)}
- * </p>
- */
- int OPERATOR_EQ = 20;
- /**
- * <p>
- * Is a date equal to another date?
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateEQ(String, String)}
- * </p>
- */
- int OPERATOR_DATE_EQ = 49;
- /**
- * <p>
- * Is a date with time equal to another date with time?
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateTimeEQ(String, String)}
- * </p>
- */
- int OPERATOR_DATE_TIME_EQ = 50;
- /**
- * <p>
- * Does the end of a string match another string?
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createEndsWith(String, String)}
- * </p>
- */
- int OPERATOR_ENDS_WITH = 21;
- /**
- * <p>
- * Is a value greater or equal to another value?
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createGE(String, String)}
- * </p>
- */
- int OPERATOR_GE = 22;
- /**
- * <p>
- * Is a date greater or equal to another date?
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateGE(String, String)}
- * </p>
- */
- int OPERATOR_DATE_GE = 51;
- /**
- * <p>
- * Is a date with time greater or equal to another date with time?
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateTimeGE(String, String)}
- * </p>
- */
- int OPERATOR_DATE_TIME_GE = 52;
- /**
- * <p>
- * Is a value greater than another value?
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createGT(String, String)}
- * </p>
- */
- int OPERATOR_GT = 23;
- /**
- * <p>
- * Is a date greater than another date?
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateGT(String, String)}
- * </p>
- */
- int OPERATOR_DATE_GT = 53;
- /**
- * <p>
- * Is a date with time greater than another date with time?
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateTimeGT(String, String)}
- * </p>
- */
- int OPERATOR_DATE_TIME_GT = 54;
- /**
- * <p>
- * Is a value contained in a set of other values?
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createIn(String, String)}
- * </p>
- */
- int OPERATOR_IN = 24;
- /**
- * <p>
- * Is a value less or equal to another value?
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createLE(String, String)}
- * </p>
- */
- int OPERATOR_LE = 25;
- /**
- * <p>
- * Is a date less or equal to another date?
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateLE(String, String)}
- * </p>
- */
- int OPERATOR_DATE_LE = 55;
- /**
- * <p>
- * Is a date with time less or equal to another date with time ?
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateTimeLE(String, String)}
- * </p>
- */
- int OPERATOR_DATE_TIME_LE = 56;
- /**
- * <p>
- * Is a value less than another value?
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createLT(String, String)}
- * </p>
- */
- int OPERATOR_LT = 26;
- /**
- * <p>
- * Is a date less than another date?
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateLT(String, String)}
- * </p>
- */
- int OPERATOR_DATE_LT = 57;
- /**
- * <p>
- * Is a date with time less than another date with time ?
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateTimeLT(String, String)}
- * </p>
- */
- int OPERATOR_DATE_TIME_LT = 58;
- /**
- * <p>
- * Is a value not equal to another value?
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createNEQ(String, String)}
- * </p>
- */
- int OPERATOR_NEQ = 27;
- /**
- * <p>
- * Is a date not equal to another date?
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateNEQ(String, String)}
- * </p>
- */
- int OPERATOR_DATE_NEQ = 59;
- /**
- * <p>
- * Is a date with time not equal to another date with time ?
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateTimeNEQ(String, String)}
- * </p>
- */
- int OPERATOR_DATE_TIME_NEQ = 60;
- /**
- * <p>
- * Does a string <b>not</b> contain another string?
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createNotContains(String, String)}
- * </p>
- */
- int OPERATOR_NOT_CONTAINS = 28;
- /**
- * <p>
- * Does the end of a string <b>not</b> match another string?
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createNotEndsWith(String, String)}
- * </p>
- */
- int OPERATOR_NOT_ENDS_WITH = 29;
- /**
- * <p>
- * Is a value not contained in a set of values?
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createNotIn(String, String)}
- * </p>
- */
- int OPERATOR_NOT_IN = 30;
- /**
- * <p>
- * Is a value not <code>null</code>?
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createNotNull(String)}
- * </p>
- */
- int OPERATOR_NOT_NULL = 31;
- /**
- * <p>
- * Does the beginning of a string <b>not</b> match another string?
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createNotStartsWith(String, String)}
- * </p>
- */
- int OPERATOR_NOT_STARTS_WITH = 32;
- /**
- * <p>
- * Is a value <code>null</code>?
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createNull(String)}
- * </p>
- */
- int OPERATOR_NULL = 33;
- /**
- * <p>
- * Is a value not <code>null</code> and not 0? (<code>null</code> and 0 treated equally)
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createNumberNotNull(String)}
- * </p>
- */
- int OPERATOR_NUMBER_NOT_NULL = 34;
- /**
- * <p>
- * Is a value <code>null</code> or 0? (<code>null</code> and 0 treated equally)
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createNumberNull(String)}
- * </p>
- */
- int OPERATOR_NUMBER_NULL = 35;
- /**
- * <p>
- * Does the beginning of a string match another string?
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createStartsWith(String, String)}
- * </p>
- */
- int OPERATOR_STARTS_WITH = 36;
- /**
- * <p>
- * Is a time value (a float, 1 = one day) larger or equal to a time as many hours in the future as specified by a
- * value?
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createTimeIsInGEHours(String, String)}
- * </p>
- */
- int OPERATOR_TIME_IS_IN_GE_HOURS = 37;
- /**
- * <p>
- * Is a time value (a float, 1 = one day) larger or equal to a time as many minutes in the future as specified by a
- * value?
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createTimeIsInGEMinutes(String, String)}
- * </p>
- */
- int OPERATOR_TIME_IS_IN_GE_MINUTES = 38;
- /**
- * <p>
- * Is a time value (a float, 1 = one day) less or equal hours in the future as a value specified?
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createTimeIsInHours(String, String)}
- * </p>
- */
- int OPERATOR_TIME_IS_IN_HOURS = 39;
- /**
- * <p>
- * Is a time value (a float, 1 = one day) less or equal to a time as many hours in the future as specified by a value?
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createTimeIsInLEHours(String, String)}
- * </p>
- */
- int OPERATOR_TIME_IS_IN_LE_HOURS = 40;
- /**
- * <p>
- * Is a time value (a float, 1 = one day) less or equal to a time as many minutes in the future as specified by a
- * value?
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createTimeIsInLEMinutes(String, String)}
- * </p>
- */
- int OPERATOR_TIME_IS_IN_LE_MINUTES = 41;
- /**
- * <p>
- * Is a time value (a float, 1 = one day) a number of minutes in the future equal to a value?
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createTimeIsInMinutes(String, String)}
- * </p>
- */
- int OPERATOR_TIME_IS_IN_MINUTES = 42;
- /**
- * <p>
- * Is a time value (a float, 1 = one day) not equal to the current time?
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createTimeIsNotNow(String)}
- * </p>
- */
- int OPERATOR_TIME_IS_NOT_NOW = 43;
- /**
- * <p>
- * Is a time value (a float, 1 = one day) equal to the current time?
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createTimeIsNow(String)}
- * </p>
- */
- int OPERATOR_TIME_IS_NOW = 44;
- /**
- * <p>
- * Is a value between two other values (including those values)?
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createBetween(String, String, String)} or
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createLE(String, String)} and
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createGE(String, String)} if only one
- * parameter is set.
- * </p>
- */
- int OPERATOR_BETWEEN = 45;
- /**
- * <p>
- * Is a date between two other dates (including those dates)?
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateBetween(String, String, String)}
- * or {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateLE(String, String)} and
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateGE(String, String)} if only one
- * parameter is set.
- * </p>
- */
- int OPERATOR_DATE_BETWEEN = 47;
- /**
- * <p>
- * Is a date with time between two other dates with time (including those date with times)?
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateTimeBetween(String, String, String)}
- * or {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateTimeLE(String, String)} and
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateTimeGE(String, String)} if only
- * one parameter is set.
- * </p>
- */
- int OPERATOR_DATE_TIME_BETWEEN = 48;
- /**
- * <p>
- * Is a string like another string?
- * </p>
- * <p>
- * When using the SqlService, this corresponds to
- * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createLike(String, String)}
- * </p>
- */
- int OPERATOR_LIKE = 46;
- //max is 60
-
- int AGGREGATION_NONE = 0;
- int AGGREGATION_COUNT = 1;
- int AGGREGATION_SUM = 2;
- int AGGREGATION_MIN = 3;
- int AGGREGATION_MAX = 4;
- int AGGREGATION_AVG = 5;
- int AGGREGATION_MEDIAN = 6;
- //max is 6
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.data.model;
+
+/**
+ *
+ */
+public interface DataModelConstants {
+ /**
+ * internal type for operators that inherit type of attribute (default)
+ */
+ int TYPE_INHERITED = -1;
+
+ /**
+ * type for operators that need no value, such as IS NULL or IS NOT NULL
+ */
+ int TYPE_NONE = 0;
+
+ int TYPE_CODE_LIST = 1;
+ int TYPE_CODE_TREE = 2;
+ int TYPE_NUMBER_LIST = 3;
+ int TYPE_NUMBER_TREE = 4;
+ int TYPE_DATE = 5;
+ int TYPE_TIME = 6;
+ int TYPE_DATE_TIME = 7;
+ int TYPE_INTEGER = 8;
+ int TYPE_LONG = 9;
+ int TYPE_DOUBLE = 10;
+ int TYPE_PLAIN_INTEGER = 11;
+ int TYPE_PLAIN_LONG = 12;
+ int TYPE_PLAIN_DOUBLE = 13;
+ int TYPE_PERCENT = 14;
+ int TYPE_STRING = 15;
+ int TYPE_SMART = 16;
+ /**
+ * Attribute used to create a count(Entity) on the enclosing entity.
+ */
+ int TYPE_AGGREGATE_COUNT = 17;
+ /**
+ * Attribute used for full text searches
+ */
+ int TYPE_FULL_TEXT = 18;
+
+ /**
+ * marker operator that does nothing, no "attribute" "op" "value" pattern is used but simply "attribute"
+ */
+ int OPERATOR_NONE = 0;
+ /**
+ * <p>
+ * Is a string contained in another string?
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createContains(String, String)}
+ * </p>
+ */
+ int OPERATOR_CONTAINS = 1;
+ /**
+ * <p>
+ * Is a date between now and a number of days from today on?
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateIsInDays(String, String)}
+ * </p>
+ */
+ int OPERATOR_DATE_IS_IN_DAYS = 2;
+ /**
+ * <p>
+ * Is a date more or equal days in the future as a value given?
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateIsInGEDays(String, String)}
+ * </p>
+ */
+ int OPERATOR_DATE_IS_IN_GE_DAYS = 3;
+ /**
+ * <p>
+ * Is a date more or equal months in the future as a value given?
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateIsInGEMonths(String, String)}
+ * </p>
+ */
+ int OPERATOR_DATE_IS_IN_GE_MONTHS = 4;
+ /**
+ * <p>
+ * Is a date less or equal days in the future as the value given?
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateIsInLEDays(String, String)}
+ * </p>
+ */
+ int OPERATOR_DATE_IS_IN_LE_DAYS = 5;
+ /**
+ * <p>
+ * Is a date less or equal months in the future as a value given?
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateIsInLEMonths(String, String)}
+ * </p>
+ */
+ int OPERATOR_DATE_IS_IN_LE_MONTHS = 6;
+ /**
+ * <p>
+ * Is a date in the past no more days in the past than a value given?
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateIsInLastDays(String, String)}
+ * </p>
+ */
+ int OPERATOR_DATE_IS_IN_LAST_DAYS = 7;
+ /**
+ * <p>
+ * Is a date in the past no more months in the past than a value given?
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateIsInLastMonths(String, String)}
+ * </p>
+ */
+ int OPERATOR_DATE_IS_IN_LAST_MONTHS = 8;
+ /**
+ * <p>
+ * Is a date exactly the number of months in the future as specified by value.
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateIsInMonths(String, String)}
+ * </p>
+ */
+ int OPERATOR_DATE_IS_IN_MONTHS = 9;
+ /**
+ * <p>
+ * Is a date in the number of next days as specified by a value?
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateIsInNextDays(String, String)}
+ * </p>
+ */
+ int OPERATOR_DATE_IS_IN_NEXT_DAYS = 10;
+ /**
+ * <p>
+ * Is a date in the number of next months as specified by a value?
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateIsInNextMonths(String, String)}
+ * </p>
+ */
+ int OPERATOR_DATE_IS_IN_NEXT_MONTHS = 11;
+ /**
+ * <p>
+ * Is a date not today?
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateIsNotToday(String)}
+ * </p>
+ */
+ int OPERATOR_DATE_IS_NOT_TODAY = 12;
+ /**
+ * <p>
+ * Is a date today?
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateIsToday(String)}
+ * </p>
+ */
+ int OPERATOR_DATE_IS_TODAY = 13;
+ /**
+ * <p>
+ * Is a date with time more or equal hours in the future as specified by a value?
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateTimeIsInGEHours(String, String)}
+ * </p>
+ */
+ int OPERATOR_DATE_TIME_IS_IN_GE_HOURS = 14;
+ /**
+ * <p>
+ * Is a date with time more or equal minutes in the future as specified by a value?
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateTimeIsInGEMinutes(String, String)}
+ * </p>
+ */
+ int OPERATOR_DATE_TIME_IS_IN_GE_MINUTES = 15;
+ /**
+ * <p>
+ * Is a date with time less or equal hours in the future as specified by a value?
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateTimeIsInLEHours(String, String)}
+ * </p>
+ */
+ int OPERATOR_DATE_TIME_IS_IN_LE_HOURS = 16;
+ /**
+ * <p>
+ * Is a date with time less or equal minutes in the future as specified by a value?
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateTimeIsInLEMinutes(String, String)}
+ * </p>
+ */
+ int OPERATOR_DATE_TIME_IS_IN_LE_MINUTES = 17;
+ /**
+ * <p>
+ * Is a date with time not now?
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateTimeIsNotNow(String)}
+ * </p>
+ */
+ int OPERATOR_DATE_TIME_IS_NOT_NOW = 18;
+ /**
+ * <p>
+ * Is a date with time now?
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateTimeIsNow(String)}
+ * </p>
+ */
+ int OPERATOR_DATE_TIME_IS_NOW = 19;
+ /**
+ * <p>
+ * Is a value equal to another value?
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createEQ(String, String)}
+ * </p>
+ */
+ int OPERATOR_EQ = 20;
+ /**
+ * <p>
+ * Is a date equal to another date?
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateEQ(String, String)}
+ * </p>
+ */
+ int OPERATOR_DATE_EQ = 49;
+ /**
+ * <p>
+ * Is a date with time equal to another date with time?
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateTimeEQ(String, String)}
+ * </p>
+ */
+ int OPERATOR_DATE_TIME_EQ = 50;
+ /**
+ * <p>
+ * Does the end of a string match another string?
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createEndsWith(String, String)}
+ * </p>
+ */
+ int OPERATOR_ENDS_WITH = 21;
+ /**
+ * <p>
+ * Is a value greater or equal to another value?
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createGE(String, String)}
+ * </p>
+ */
+ int OPERATOR_GE = 22;
+ /**
+ * <p>
+ * Is a date greater or equal to another date?
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateGE(String, String)}
+ * </p>
+ */
+ int OPERATOR_DATE_GE = 51;
+ /**
+ * <p>
+ * Is a date with time greater or equal to another date with time?
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateTimeGE(String, String)}
+ * </p>
+ */
+ int OPERATOR_DATE_TIME_GE = 52;
+ /**
+ * <p>
+ * Is a value greater than another value?
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createGT(String, String)}
+ * </p>
+ */
+ int OPERATOR_GT = 23;
+ /**
+ * <p>
+ * Is a date greater than another date?
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateGT(String, String)}
+ * </p>
+ */
+ int OPERATOR_DATE_GT = 53;
+ /**
+ * <p>
+ * Is a date with time greater than another date with time?
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateTimeGT(String, String)}
+ * </p>
+ */
+ int OPERATOR_DATE_TIME_GT = 54;
+ /**
+ * <p>
+ * Is a value contained in a set of other values?
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createIn(String, String)}
+ * </p>
+ */
+ int OPERATOR_IN = 24;
+ /**
+ * <p>
+ * Is a value less or equal to another value?
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createLE(String, String)}
+ * </p>
+ */
+ int OPERATOR_LE = 25;
+ /**
+ * <p>
+ * Is a date less or equal to another date?
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateLE(String, String)}
+ * </p>
+ */
+ int OPERATOR_DATE_LE = 55;
+ /**
+ * <p>
+ * Is a date with time less or equal to another date with time ?
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateTimeLE(String, String)}
+ * </p>
+ */
+ int OPERATOR_DATE_TIME_LE = 56;
+ /**
+ * <p>
+ * Is a value less than another value?
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createLT(String, String)}
+ * </p>
+ */
+ int OPERATOR_LT = 26;
+ /**
+ * <p>
+ * Is a date less than another date?
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateLT(String, String)}
+ * </p>
+ */
+ int OPERATOR_DATE_LT = 57;
+ /**
+ * <p>
+ * Is a date with time less than another date with time ?
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateTimeLT(String, String)}
+ * </p>
+ */
+ int OPERATOR_DATE_TIME_LT = 58;
+ /**
+ * <p>
+ * Is a value not equal to another value?
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createNEQ(String, String)}
+ * </p>
+ */
+ int OPERATOR_NEQ = 27;
+ /**
+ * <p>
+ * Is a date not equal to another date?
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateNEQ(String, String)}
+ * </p>
+ */
+ int OPERATOR_DATE_NEQ = 59;
+ /**
+ * <p>
+ * Is a date with time not equal to another date with time ?
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateTimeNEQ(String, String)}
+ * </p>
+ */
+ int OPERATOR_DATE_TIME_NEQ = 60;
+ /**
+ * <p>
+ * Does a string <b>not</b> contain another string?
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createNotContains(String, String)}
+ * </p>
+ */
+ int OPERATOR_NOT_CONTAINS = 28;
+ /**
+ * <p>
+ * Does the end of a string <b>not</b> match another string?
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createNotEndsWith(String, String)}
+ * </p>
+ */
+ int OPERATOR_NOT_ENDS_WITH = 29;
+ /**
+ * <p>
+ * Is a value not contained in a set of values?
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createNotIn(String, String)}
+ * </p>
+ */
+ int OPERATOR_NOT_IN = 30;
+ /**
+ * <p>
+ * Is a value not <code>null</code>?
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createNotNull(String)}
+ * </p>
+ */
+ int OPERATOR_NOT_NULL = 31;
+ /**
+ * <p>
+ * Does the beginning of a string <b>not</b> match another string?
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createNotStartsWith(String, String)}
+ * </p>
+ */
+ int OPERATOR_NOT_STARTS_WITH = 32;
+ /**
+ * <p>
+ * Is a value <code>null</code>?
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createNull(String)}
+ * </p>
+ */
+ int OPERATOR_NULL = 33;
+ /**
+ * <p>
+ * Is a value not <code>null</code> and not 0? (<code>null</code> and 0 treated equally)
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createNumberNotNull(String)}
+ * </p>
+ */
+ int OPERATOR_NUMBER_NOT_NULL = 34;
+ /**
+ * <p>
+ * Is a value <code>null</code> or 0? (<code>null</code> and 0 treated equally)
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createNumberNull(String)}
+ * </p>
+ */
+ int OPERATOR_NUMBER_NULL = 35;
+ /**
+ * <p>
+ * Does the beginning of a string match another string?
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createStartsWith(String, String)}
+ * </p>
+ */
+ int OPERATOR_STARTS_WITH = 36;
+ /**
+ * <p>
+ * Is a time value (a float, 1 = one day) larger or equal to a time as many hours in the future as specified by a
+ * value?
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createTimeIsInGEHours(String, String)}
+ * </p>
+ */
+ int OPERATOR_TIME_IS_IN_GE_HOURS = 37;
+ /**
+ * <p>
+ * Is a time value (a float, 1 = one day) larger or equal to a time as many minutes in the future as specified by a
+ * value?
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createTimeIsInGEMinutes(String, String)}
+ * </p>
+ */
+ int OPERATOR_TIME_IS_IN_GE_MINUTES = 38;
+ /**
+ * <p>
+ * Is a time value (a float, 1 = one day) less or equal hours in the future as a value specified?
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createTimeIsInHours(String, String)}
+ * </p>
+ */
+ int OPERATOR_TIME_IS_IN_HOURS = 39;
+ /**
+ * <p>
+ * Is a time value (a float, 1 = one day) less or equal to a time as many hours in the future as specified by a value?
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createTimeIsInLEHours(String, String)}
+ * </p>
+ */
+ int OPERATOR_TIME_IS_IN_LE_HOURS = 40;
+ /**
+ * <p>
+ * Is a time value (a float, 1 = one day) less or equal to a time as many minutes in the future as specified by a
+ * value?
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createTimeIsInLEMinutes(String, String)}
+ * </p>
+ */
+ int OPERATOR_TIME_IS_IN_LE_MINUTES = 41;
+ /**
+ * <p>
+ * Is a time value (a float, 1 = one day) a number of minutes in the future equal to a value?
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createTimeIsInMinutes(String, String)}
+ * </p>
+ */
+ int OPERATOR_TIME_IS_IN_MINUTES = 42;
+ /**
+ * <p>
+ * Is a time value (a float, 1 = one day) not equal to the current time?
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createTimeIsNotNow(String)}
+ * </p>
+ */
+ int OPERATOR_TIME_IS_NOT_NOW = 43;
+ /**
+ * <p>
+ * Is a time value (a float, 1 = one day) equal to the current time?
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createTimeIsNow(String)}
+ * </p>
+ */
+ int OPERATOR_TIME_IS_NOW = 44;
+ /**
+ * <p>
+ * Is a value between two other values (including those values)?
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createBetween(String, String, String)} or
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createLE(String, String)} and
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createGE(String, String)} if only one
+ * parameter is set.
+ * </p>
+ */
+ int OPERATOR_BETWEEN = 45;
+ /**
+ * <p>
+ * Is a date between two other dates (including those dates)?
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateBetween(String, String, String)}
+ * or {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateLE(String, String)} and
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateGE(String, String)} if only one
+ * parameter is set.
+ * </p>
+ */
+ int OPERATOR_DATE_BETWEEN = 47;
+ /**
+ * <p>
+ * Is a date with time between two other dates with time (including those date with times)?
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateTimeBetween(String, String, String)}
+ * or {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateTimeLE(String, String)} and
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createDateTimeGE(String, String)} if only
+ * one parameter is set.
+ * </p>
+ */
+ int OPERATOR_DATE_TIME_BETWEEN = 48;
+ /**
+ * <p>
+ * Is a string like another string?
+ * </p>
+ * <p>
+ * When using the SqlService, this corresponds to
+ * {@link org.eclipse.scout.rt.server.services.common.jdbc.style.ISqlStyle#createLike(String, String)}
+ * </p>
+ */
+ int OPERATOR_LIKE = 46;
+ //max is 60
+
+ int AGGREGATION_NONE = 0;
+ int AGGREGATION_COUNT = 1;
+ int AGGREGATION_SUM = 2;
+ int AGGREGATION_MIN = 3;
+ int AGGREGATION_MAX = 4;
+ int AGGREGATION_AVG = 5;
+ int AGGREGATION_MEDIAN = 6;
+ //max is 6
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/DataModelUtility.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/DataModelUtility.java
index 650b871f59..b147d63ce7 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/DataModelUtility.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/DataModelUtility.java
@@ -1,506 +1,506 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.data.model;
-
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-
-/**
- * Transform entities and attributes from and to shared data objects and external ids (using folder and meta syntax:
- * foo/bar/name or foo/bar/name;key1=value1;key2=value2)
- * <p>
- * The external id is used to identify an entity, attribute or inner entity, attribute when using xml storages,
- * bookmarks, server calls.
- * <p>
- * see {@link AbstractDataModelAttributeData}, {@link AbstractDataModelEntityData},
- * {@link IDataModel#getMetaDataOfAttribute(IDataModelAttribute)},
- * {@link IDataModel#getMetaDataOfAttributeData(AbstractDataModelAttributeData, Object[])}
- */
-public final class DataModelUtility {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(DataModelUtility.class);
-
- private DataModelUtility() {
- }
-
- /**
- * using group 2,3,5
- */
- private static final Pattern PAT_EXTERNAL_ID = Pattern.compile("((.+)/)?([^/;]+)(;(.+))?");
- private static final Pattern PAT_SEMI_COLON = Pattern.compile("[;]");
- private static final Pattern PAT_NVPAIR = Pattern.compile("([^=]+)=(.*)");
-
- /**
- * @return the external id (foo/bar/foo) for an entity using {@link Class#getSimpleName()} and
- * {@link IDataModelEntity#getMetaDataOfEntity()}
- * @since 3.8.0
- */
- public static String entityPathToExternalId(IDataModel f, EntityPath entityPath) {
- if (entityPath == null || entityPath.size() == 0) {
- return "";
- }
- StringBuilder buf = new StringBuilder();
- for (IDataModelEntity e : entityPath.elements()) {
- if (buf.length() > 0) {
- buf.append("/");
- }
- buf.append(e.getClass().getSimpleName());
- buf.append(exportMetaData(e.getMetaDataOfEntity()));
- }
- String externalId = buf.toString();
- if (LOG.isInfoEnabled()) {
- EntityPath verify = externalIdToEntityPath(f, externalId);
- if (verify == null) {
- LOG.info("entity externalId " + externalId + " resolves to null");
- }
- else if (!verify.equals(entityPath)) {
- LOG.info("entity externalId " + externalId + " is not valid for " + entityPath);
- }
- }
- return externalId;
- }
-
- /**
- * Computes the given attribute's external id along the given path of entities.
- *
- * @return the external id (foo/bar/foo) for an attribute using {@link Class#getSimpleName()} and
- * {@link IDataModelEntity#getMetaDataOfEntity()}, {@link IDataModelAttribute#getMetaDataOfAttribute()}
- * @since 3.8.0
- */
- public static String attributePathToExternalId(IDataModel f, AttributePath attributePath) {
- if (attributePath == null) {
- return "";
- }
- StringBuilder buf = new StringBuilder();
- buf.append(entityPathToExternalId(f, attributePath.getEntityPath()));
- if (buf.length() > 0) {
- buf.append("/");
- }
- IDataModelAttribute a = attributePath.getAttribute();
- buf.append(a.getClass().getSimpleName());
- buf.append(exportMetaData(a.getMetaDataOfAttribute()));
- String externalId = buf.toString();
- if (LOG.isInfoEnabled()) {
- AttributePath verify = externalIdToAttributePath(f, externalId);
- if (verify == null) {
- LOG.info("attribute externalId " + externalId + " resolves to null");
- }
- else if (!verify.equals(attributePath)) {
- LOG.info("attribute externalId " + externalId + " is not valid for " + attributePath);
- }
- }
- return externalId;
- }
-
- /**
- * Returns the path of entities starting by the root, which is described by the external ID.
- *
- * @param f
- * the data model
- * @param externalId
- * string representation of an entity
- * @return
- * @since 3.8.0
- */
- public static EntityPath externalIdToEntityPath(IDataModel f, String externalId) {
- if (externalId == null || externalId.length() == 0) {
- return EntityPath.EMPTY;
- }
- return resolveEntityPathRec(f, externalId, EntityPath.EMPTY);
- }
-
- /**
- * @return the attribute for an external id (foo/bar/foo) using
- * {@link IDataModel#getMetaDataOfAttribute(IDataModelAttribute)}
- * @since 3.8.0
- */
- public static AttributePath externalIdToAttributePath(IDataModel f, String externalId) {
- if (externalId == null || externalId.length() == 0) {
- return null;
- }
- return resolveAttributePath(f, externalId);
- }
-
- /**
- * Recursively resolves the path of entities described by the given external Id.
- *
- * @return the list of all entities starting from the root entity.
- * @param parentEntity
- * is the entity on which to start resolving or null to start on top of the entity/attribute tree
- * @since 3.8.0
- */
- private static EntityPath resolveEntityPathRec(IDataModel f, String externalId, EntityPath inputPath) {
- Matcher m = PAT_EXTERNAL_ID.matcher(externalId);
- if (!m.matches()) {
- throw new IllegalArgumentException("externalId is invalid: " + externalId);
- }
- String folderName = m.group(2);
- String elemName = m.group(3);
- Map<String, String> meta = importMetaData(m.group(5));
- EntityPath resolvedPath;
- if (folderName != null) {
- resolvedPath = resolveEntityPathRec(f, folderName, inputPath);
- if (resolvedPath == null) {
- return null;
- }
- }
- else {
- resolvedPath = inputPath;
- }
- IDataModelEntity parentEntity = resolvedPath.lastElement();
- IDataModelEntity e;
- if (parentEntity != null) {
- e = findEntity(parentEntity.getEntities(), elemName, meta);
- }
- else {
- e = findEntity(f.getEntities(), elemName, meta);
- }
- if (e == null) {
- if (LOG.isInfoEnabled()) {
- LOG.info("entity externalId " + externalId + " resolves to null");
- }
- return null;
- }
- return resolvedPath.addToEnd(e);
- }
-
- private static AttributePath resolveAttributePath(IDataModel f, String externalId) {
- Matcher m = PAT_EXTERNAL_ID.matcher(externalId);
- if (!m.matches()) {
- throw new IllegalArgumentException("externalId is invalid: " + externalId);
- }
- String folderName = m.group(2);
- String elemName = m.group(3);
- Map<String, String> meta = importMetaData(m.group(5));
- EntityPath entityPath;
- if (folderName != null) {
- entityPath = resolveEntityPathRec(f, folderName, EntityPath.EMPTY);
- if (entityPath == null) {
- return null;
- }
- }
- else {
- entityPath = EntityPath.EMPTY;
- }
- IDataModelEntity parentEntity = entityPath.lastElement();
- IDataModelAttribute a;
- if (parentEntity != null) {
- a = findAttribute(parentEntity.getAttributes(), elemName, meta);
- }
- else {
- a = findAttribute(f.getAttributes(), elemName, meta);
- }
- if (a == null) {
- if (LOG.isInfoEnabled()) {
- LOG.info("attribute externalId " + externalId + " resolves to null");
- }
- return null;
- }
- return entityPath.addToEnd(a);
- }
-
- /**
- * @return the entity for an external id part (no '/' characters) using
- * {@link IDataModel#getMetaDataOfAttribute(IDataModelAttribute)}
- */
- public static IDataModelEntity findEntity(IDataModelEntity[] array, String simpleName, Map<String, String> metaData) {
- if (array != null) {
- for (IDataModelEntity e : array) {
- if (e.getClass().getSimpleName().equals(simpleName)) {
- if (CompareUtility.equals(e.getMetaDataOfEntity(), metaData)) {
- return e;
- }
- }
- }
- }
- return null;
- }
-
- /**
- * @return the attribute for an external id part (no '/' characters) using
- * {@link IDataModel#getMetaDataOfAttribute(IDataModelAttribute)}
- */
- public static IDataModelAttribute findAttribute(IDataModelAttribute[] array, String simpleName, Map<String, String> metaData) {
- if (array != null) {
- for (IDataModelAttribute a : array) {
- if (a.getClass().getSimpleName().equals(simpleName)) {
- if (CompareUtility.equals(a.getMetaDataOfAttribute(), metaData)) {
- return a;
- }
- }
- }
- }
- return null;
- }
-
- /**
- * import a string of the form ;key=value;key=value;... to a map
- * <p>
- * when no name/value pairs or null string is imported as null
- * <p>
- * empty values are imported as null
- */
- public static Map<String, String> importMetaData(String s) {
- if (s == null) {
- return null;
- }
- Map<String, String> map = new HashMap<String, String>(1);
- for (String e : PAT_SEMI_COLON.split(s)) {
- Matcher m = PAT_NVPAIR.matcher(e);
- if (m.matches()) {
- map.put(m.group(1), m.group(2));
- }
- }
- return map.size() > 0 ? map : null;
- }
-
- /**
- * export a map to a string of the form ;key=value;key=value;...
- * <p>
- * a null or empty map is exported as empty string ""
- * <p>
- * null values are exported as empty strings
- */
- public static String exportMetaData(Map<String, String> map) {
- if (map == null || map.size() == 0) {
- return "";
- }
- StringBuffer buf = new StringBuffer(16);
- for (Map.Entry<String, String> e : map.entrySet()) {
- buf.append(";");
- buf.append(e.getKey());
- buf.append('=');
- if (e.getValue() != null) {
- buf.append(e.getValue());
- }
- }
- return buf.toString();
- }
-
- /**
- * Sorts the given array of data model entities by their display names.
- *
- * @param array
- * @return Returns the the sorted array of entities.
- * @since 3.8.0
- */
- public static IDataModelEntity[] sortEntities(IDataModelEntity[] array) {
- if (array == null) {
- return null;
- }
- Arrays.sort(array, new Comparator<IDataModelEntity>() {
- @Override
- public int compare(IDataModelEntity o1, IDataModelEntity o2) {
- if (o1 == null && o2 == null) {
- return 0;
- }
- if (o1 == null) {
- return -1;
- }
- if (o2 == null) {
- return 1;
- }
- return StringUtility.compareIgnoreCase(o1.getText(), o2.getText());
- }
- });
- return array;
- }
-
- /**
- * Sorts the given array of data model attributes by their display name. Those having
- * {@link IDataModelAttribute#getType()} == {@link DataModelConstants#TYPE_AGGREGATE_COUNT} are moved to the head.
- *
- * @param array
- * @return Returns the sorted array of attributes.
- * @since 3.8.0
- */
- public static IDataModelAttribute[] sortAttributes(IDataModelAttribute[] array) {
- if (array == null) {
- return null;
- }
- Arrays.sort(array, new Comparator<IDataModelAttribute>() {
- @Override
- public int compare(IDataModelAttribute o1, IDataModelAttribute o2) {
- if (o1 == null && o2 == null) {
- return 0;
- }
- if (o1 == null) {
- return -1;
- }
- if (o2 == null) {
- return 1;
- }
- if (o1.getType() == DataModelConstants.TYPE_AGGREGATE_COUNT && o2.getType() != DataModelConstants.TYPE_AGGREGATE_COUNT) {
- return -1;
- }
- if (o2.getType() == DataModelConstants.TYPE_AGGREGATE_COUNT && o1.getType() != DataModelConstants.TYPE_AGGREGATE_COUNT) {
- return 1;
- }
- return StringUtility.compareIgnoreCase(o1.getText(), o2.getText());
- }
- });
- return array;
- }
-
- /*
- * deprecated methods as of 3.8
- */
-
- /**
- * @deprecated use {@link #entityPathToExternalId(IDataModel, EntityPath)} instead
- */
- @SuppressWarnings("deprecation")
- @Deprecated
- public static String entityToExternalId(IDataModelEntity e) {
- //loop detection (for example CompanyCompanyEntity)
- IDataModelEntity t = e.getParentEntity();
- for (int i = 0; i < 5 && t != null; i++) {
- if (t == e) {
- return null;
- }
- t = t.getParentEntity();
- }
- if (e.getParentEntity() != null) {
- return entityToExternalId(e.getParentEntity()) + "/" + e.getClass().getSimpleName() + exportMetaData(e.getMetaDataOfEntity());
- }
- else {
- return e.getClass().getSimpleName() + exportMetaData(e.getMetaDataOfEntity());
- }
- }
-
- /**
- * @deprecated use {@link #attributePathToExternalId(IDataModel, AttributePath)} instead
- */
- @SuppressWarnings("deprecation")
- @Deprecated
- public static String attributeToExternalId(IDataModelAttribute a) {
- if (a.getParentEntity() != null) {
- return entityToExternalId(a.getParentEntity()) + "/" + a.getClass().getSimpleName() + exportMetaData(a.getMetaDataOfAttribute());
- }
- else {
- return a.getClass().getSimpleName() + exportMetaData(a.getMetaDataOfAttribute());
- }
- }
-
- /**
- * @deprecated use {@link #externalIdToEntityPath(IDataModel, String)} instead
- */
- @Deprecated
- public static IDataModelEntity externalIdToEntity(IDataModel f, String externalId, IDataModelEntity parentEntity) {
- if (externalId == null) {
- return null;
- }
- Matcher m = PAT_EXTERNAL_ID.matcher(externalId);
- if (!m.matches()) {
- throw new IllegalArgumentException("externalId is invalid: " + externalId);
- }
- String folderName = m.group(2);
- String elemName = m.group(3);
- Map<String, String> meta = importMetaData(m.group(5));
- if (folderName != null) {
- parentEntity = externalIdToEntity(f, folderName, parentEntity);
- if (parentEntity == null) {
- return null;
- }
- }
- if (parentEntity != null) {
- return findEntity(parentEntity.getEntities(), elemName, meta);
- }
- else {
- return findEntity(f.getEntities(), elemName, meta);
- }
- }
-
- /**
- * @deprecated use {@link #externalIdToAttributePath(IDataModel, String)} instead
- */
- @Deprecated
- public static IDataModelAttribute externalIdToAttribute(IDataModel f, String externalId, IDataModelEntity parentEntity) {
- if (externalId == null) {
- return null;
- }
- Matcher m = PAT_EXTERNAL_ID.matcher(externalId);
- if (!m.matches()) {
- throw new IllegalArgumentException("externalId is invalid: " + externalId);
- }
- String folderName = m.group(2);
- String elemName = m.group(3);
- Map<String, String> meta = importMetaData(m.group(5));
- if (folderName != null) {
- parentEntity = externalIdToEntity(f, folderName, parentEntity);
- if (parentEntity == null) {
- return null;
- }
- }
- if (parentEntity != null) {
- return findAttribute(parentEntity.getAttributes(), elemName, meta);
- }
- else {
- return findAttribute(f.getAttributes(), elemName, meta);
- }
- }
-
- /**
- * @deprecated use {@link #findEntity(IDataModelEntity[], String, Map)} instead
- */
- @Deprecated
- public static IDataModelEntity findEntity(IDataModelEntity[] array, String simpleName) {
- return findEntity(array, simpleName, null);
- }
-
- /**
- * @deprecated use {@link #attributePathToExternalId(IDataModel, AttributePath)} instead
- */
- @Deprecated
- public static String attributeToExternalId(IDataModelAttribute a, IDataModelEntity... entityPath) {
- String id = a.getClass().getSimpleName() + exportMetaData(a.getMetaDataOfAttribute());
- for (int i = entityPath.length - 1; i >= 0; i--) {
- IDataModelEntity e = entityPath[i];
- id = e.getClass().getSimpleName() + "/" + id;
- }
- return id;
- }
-
- /**
- * @deprecated use {@link #externalIdToEntityPath(IDataModel, String)} instead
- */
- @Deprecated
- public static IDataModelEntity[] externalIdToEntityPath(IDataModel f, String externalId, IDataModelEntity parentEntity) {
- EntityPath ePath = null;
- try {
- //try attribute
- AttributePath aPath = externalIdToAttributePath(f, externalId);
- if (aPath != null) {
- ePath = aPath.getEntityPath();
- }
- }
- catch (Throwable t) {
- //nop
- }
- if (ePath == null) {
- //try entity
- ePath = externalIdToEntityPath(f, externalId);
- }
- if (ePath != null) {
- return ePath.elements().toArray(new IDataModelEntity[ePath.size()]);
- }
- return new IDataModelEntity[0];
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.data.model;
+
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+
+/**
+ * Transform entities and attributes from and to shared data objects and external ids (using folder and meta syntax:
+ * foo/bar/name or foo/bar/name;key1=value1;key2=value2)
+ * <p>
+ * The external id is used to identify an entity, attribute or inner entity, attribute when using xml storages,
+ * bookmarks, server calls.
+ * <p>
+ * see {@link AbstractDataModelAttributeData}, {@link AbstractDataModelEntityData},
+ * {@link IDataModel#getMetaDataOfAttribute(IDataModelAttribute)},
+ * {@link IDataModel#getMetaDataOfAttributeData(AbstractDataModelAttributeData, Object[])}
+ */
+public final class DataModelUtility {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(DataModelUtility.class);
+
+ private DataModelUtility() {
+ }
+
+ /**
+ * using group 2,3,5
+ */
+ private static final Pattern PAT_EXTERNAL_ID = Pattern.compile("((.+)/)?([^/;]+)(;(.+))?");
+ private static final Pattern PAT_SEMI_COLON = Pattern.compile("[;]");
+ private static final Pattern PAT_NVPAIR = Pattern.compile("([^=]+)=(.*)");
+
+ /**
+ * @return the external id (foo/bar/foo) for an entity using {@link Class#getSimpleName()} and
+ * {@link IDataModelEntity#getMetaDataOfEntity()}
+ * @since 3.8.0
+ */
+ public static String entityPathToExternalId(IDataModel f, EntityPath entityPath) {
+ if (entityPath == null || entityPath.size() == 0) {
+ return "";
+ }
+ StringBuilder buf = new StringBuilder();
+ for (IDataModelEntity e : entityPath.elements()) {
+ if (buf.length() > 0) {
+ buf.append("/");
+ }
+ buf.append(e.getClass().getSimpleName());
+ buf.append(exportMetaData(e.getMetaDataOfEntity()));
+ }
+ String externalId = buf.toString();
+ if (LOG.isInfoEnabled()) {
+ EntityPath verify = externalIdToEntityPath(f, externalId);
+ if (verify == null) {
+ LOG.info("entity externalId " + externalId + " resolves to null");
+ }
+ else if (!verify.equals(entityPath)) {
+ LOG.info("entity externalId " + externalId + " is not valid for " + entityPath);
+ }
+ }
+ return externalId;
+ }
+
+ /**
+ * Computes the given attribute's external id along the given path of entities.
+ *
+ * @return the external id (foo/bar/foo) for an attribute using {@link Class#getSimpleName()} and
+ * {@link IDataModelEntity#getMetaDataOfEntity()}, {@link IDataModelAttribute#getMetaDataOfAttribute()}
+ * @since 3.8.0
+ */
+ public static String attributePathToExternalId(IDataModel f, AttributePath attributePath) {
+ if (attributePath == null) {
+ return "";
+ }
+ StringBuilder buf = new StringBuilder();
+ buf.append(entityPathToExternalId(f, attributePath.getEntityPath()));
+ if (buf.length() > 0) {
+ buf.append("/");
+ }
+ IDataModelAttribute a = attributePath.getAttribute();
+ buf.append(a.getClass().getSimpleName());
+ buf.append(exportMetaData(a.getMetaDataOfAttribute()));
+ String externalId = buf.toString();
+ if (LOG.isInfoEnabled()) {
+ AttributePath verify = externalIdToAttributePath(f, externalId);
+ if (verify == null) {
+ LOG.info("attribute externalId " + externalId + " resolves to null");
+ }
+ else if (!verify.equals(attributePath)) {
+ LOG.info("attribute externalId " + externalId + " is not valid for " + attributePath);
+ }
+ }
+ return externalId;
+ }
+
+ /**
+ * Returns the path of entities starting by the root, which is described by the external ID.
+ *
+ * @param f
+ * the data model
+ * @param externalId
+ * string representation of an entity
+ * @return
+ * @since 3.8.0
+ */
+ public static EntityPath externalIdToEntityPath(IDataModel f, String externalId) {
+ if (externalId == null || externalId.length() == 0) {
+ return EntityPath.EMPTY;
+ }
+ return resolveEntityPathRec(f, externalId, EntityPath.EMPTY);
+ }
+
+ /**
+ * @return the attribute for an external id (foo/bar/foo) using
+ * {@link IDataModel#getMetaDataOfAttribute(IDataModelAttribute)}
+ * @since 3.8.0
+ */
+ public static AttributePath externalIdToAttributePath(IDataModel f, String externalId) {
+ if (externalId == null || externalId.length() == 0) {
+ return null;
+ }
+ return resolveAttributePath(f, externalId);
+ }
+
+ /**
+ * Recursively resolves the path of entities described by the given external Id.
+ *
+ * @return the list of all entities starting from the root entity.
+ * @param parentEntity
+ * is the entity on which to start resolving or null to start on top of the entity/attribute tree
+ * @since 3.8.0
+ */
+ private static EntityPath resolveEntityPathRec(IDataModel f, String externalId, EntityPath inputPath) {
+ Matcher m = PAT_EXTERNAL_ID.matcher(externalId);
+ if (!m.matches()) {
+ throw new IllegalArgumentException("externalId is invalid: " + externalId);
+ }
+ String folderName = m.group(2);
+ String elemName = m.group(3);
+ Map<String, String> meta = importMetaData(m.group(5));
+ EntityPath resolvedPath;
+ if (folderName != null) {
+ resolvedPath = resolveEntityPathRec(f, folderName, inputPath);
+ if (resolvedPath == null) {
+ return null;
+ }
+ }
+ else {
+ resolvedPath = inputPath;
+ }
+ IDataModelEntity parentEntity = resolvedPath.lastElement();
+ IDataModelEntity e;
+ if (parentEntity != null) {
+ e = findEntity(parentEntity.getEntities(), elemName, meta);
+ }
+ else {
+ e = findEntity(f.getEntities(), elemName, meta);
+ }
+ if (e == null) {
+ if (LOG.isInfoEnabled()) {
+ LOG.info("entity externalId " + externalId + " resolves to null");
+ }
+ return null;
+ }
+ return resolvedPath.addToEnd(e);
+ }
+
+ private static AttributePath resolveAttributePath(IDataModel f, String externalId) {
+ Matcher m = PAT_EXTERNAL_ID.matcher(externalId);
+ if (!m.matches()) {
+ throw new IllegalArgumentException("externalId is invalid: " + externalId);
+ }
+ String folderName = m.group(2);
+ String elemName = m.group(3);
+ Map<String, String> meta = importMetaData(m.group(5));
+ EntityPath entityPath;
+ if (folderName != null) {
+ entityPath = resolveEntityPathRec(f, folderName, EntityPath.EMPTY);
+ if (entityPath == null) {
+ return null;
+ }
+ }
+ else {
+ entityPath = EntityPath.EMPTY;
+ }
+ IDataModelEntity parentEntity = entityPath.lastElement();
+ IDataModelAttribute a;
+ if (parentEntity != null) {
+ a = findAttribute(parentEntity.getAttributes(), elemName, meta);
+ }
+ else {
+ a = findAttribute(f.getAttributes(), elemName, meta);
+ }
+ if (a == null) {
+ if (LOG.isInfoEnabled()) {
+ LOG.info("attribute externalId " + externalId + " resolves to null");
+ }
+ return null;
+ }
+ return entityPath.addToEnd(a);
+ }
+
+ /**
+ * @return the entity for an external id part (no '/' characters) using
+ * {@link IDataModel#getMetaDataOfAttribute(IDataModelAttribute)}
+ */
+ public static IDataModelEntity findEntity(IDataModelEntity[] array, String simpleName, Map<String, String> metaData) {
+ if (array != null) {
+ for (IDataModelEntity e : array) {
+ if (e.getClass().getSimpleName().equals(simpleName)) {
+ if (CompareUtility.equals(e.getMetaDataOfEntity(), metaData)) {
+ return e;
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @return the attribute for an external id part (no '/' characters) using
+ * {@link IDataModel#getMetaDataOfAttribute(IDataModelAttribute)}
+ */
+ public static IDataModelAttribute findAttribute(IDataModelAttribute[] array, String simpleName, Map<String, String> metaData) {
+ if (array != null) {
+ for (IDataModelAttribute a : array) {
+ if (a.getClass().getSimpleName().equals(simpleName)) {
+ if (CompareUtility.equals(a.getMetaDataOfAttribute(), metaData)) {
+ return a;
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * import a string of the form ;key=value;key=value;... to a map
+ * <p>
+ * when no name/value pairs or null string is imported as null
+ * <p>
+ * empty values are imported as null
+ */
+ public static Map<String, String> importMetaData(String s) {
+ if (s == null) {
+ return null;
+ }
+ Map<String, String> map = new HashMap<String, String>(1);
+ for (String e : PAT_SEMI_COLON.split(s)) {
+ Matcher m = PAT_NVPAIR.matcher(e);
+ if (m.matches()) {
+ map.put(m.group(1), m.group(2));
+ }
+ }
+ return map.size() > 0 ? map : null;
+ }
+
+ /**
+ * export a map to a string of the form ;key=value;key=value;...
+ * <p>
+ * a null or empty map is exported as empty string ""
+ * <p>
+ * null values are exported as empty strings
+ */
+ public static String exportMetaData(Map<String, String> map) {
+ if (map == null || map.size() == 0) {
+ return "";
+ }
+ StringBuffer buf = new StringBuffer(16);
+ for (Map.Entry<String, String> e : map.entrySet()) {
+ buf.append(";");
+ buf.append(e.getKey());
+ buf.append('=');
+ if (e.getValue() != null) {
+ buf.append(e.getValue());
+ }
+ }
+ return buf.toString();
+ }
+
+ /**
+ * Sorts the given array of data model entities by their display names.
+ *
+ * @param array
+ * @return Returns the the sorted array of entities.
+ * @since 3.8.0
+ */
+ public static IDataModelEntity[] sortEntities(IDataModelEntity[] array) {
+ if (array == null) {
+ return null;
+ }
+ Arrays.sort(array, new Comparator<IDataModelEntity>() {
+ @Override
+ public int compare(IDataModelEntity o1, IDataModelEntity o2) {
+ if (o1 == null && o2 == null) {
+ return 0;
+ }
+ if (o1 == null) {
+ return -1;
+ }
+ if (o2 == null) {
+ return 1;
+ }
+ return StringUtility.compareIgnoreCase(o1.getText(), o2.getText());
+ }
+ });
+ return array;
+ }
+
+ /**
+ * Sorts the given array of data model attributes by their display name. Those having
+ * {@link IDataModelAttribute#getType()} == {@link DataModelConstants#TYPE_AGGREGATE_COUNT} are moved to the head.
+ *
+ * @param array
+ * @return Returns the sorted array of attributes.
+ * @since 3.8.0
+ */
+ public static IDataModelAttribute[] sortAttributes(IDataModelAttribute[] array) {
+ if (array == null) {
+ return null;
+ }
+ Arrays.sort(array, new Comparator<IDataModelAttribute>() {
+ @Override
+ public int compare(IDataModelAttribute o1, IDataModelAttribute o2) {
+ if (o1 == null && o2 == null) {
+ return 0;
+ }
+ if (o1 == null) {
+ return -1;
+ }
+ if (o2 == null) {
+ return 1;
+ }
+ if (o1.getType() == DataModelConstants.TYPE_AGGREGATE_COUNT && o2.getType() != DataModelConstants.TYPE_AGGREGATE_COUNT) {
+ return -1;
+ }
+ if (o2.getType() == DataModelConstants.TYPE_AGGREGATE_COUNT && o1.getType() != DataModelConstants.TYPE_AGGREGATE_COUNT) {
+ return 1;
+ }
+ return StringUtility.compareIgnoreCase(o1.getText(), o2.getText());
+ }
+ });
+ return array;
+ }
+
+ /*
+ * deprecated methods as of 3.8
+ */
+
+ /**
+ * @deprecated use {@link #entityPathToExternalId(IDataModel, EntityPath)} instead
+ */
+ @SuppressWarnings("deprecation")
+ @Deprecated
+ public static String entityToExternalId(IDataModelEntity e) {
+ //loop detection (for example CompanyCompanyEntity)
+ IDataModelEntity t = e.getParentEntity();
+ for (int i = 0; i < 5 && t != null; i++) {
+ if (t == e) {
+ return null;
+ }
+ t = t.getParentEntity();
+ }
+ if (e.getParentEntity() != null) {
+ return entityToExternalId(e.getParentEntity()) + "/" + e.getClass().getSimpleName() + exportMetaData(e.getMetaDataOfEntity());
+ }
+ else {
+ return e.getClass().getSimpleName() + exportMetaData(e.getMetaDataOfEntity());
+ }
+ }
+
+ /**
+ * @deprecated use {@link #attributePathToExternalId(IDataModel, AttributePath)} instead
+ */
+ @SuppressWarnings("deprecation")
+ @Deprecated
+ public static String attributeToExternalId(IDataModelAttribute a) {
+ if (a.getParentEntity() != null) {
+ return entityToExternalId(a.getParentEntity()) + "/" + a.getClass().getSimpleName() + exportMetaData(a.getMetaDataOfAttribute());
+ }
+ else {
+ return a.getClass().getSimpleName() + exportMetaData(a.getMetaDataOfAttribute());
+ }
+ }
+
+ /**
+ * @deprecated use {@link #externalIdToEntityPath(IDataModel, String)} instead
+ */
+ @Deprecated
+ public static IDataModelEntity externalIdToEntity(IDataModel f, String externalId, IDataModelEntity parentEntity) {
+ if (externalId == null) {
+ return null;
+ }
+ Matcher m = PAT_EXTERNAL_ID.matcher(externalId);
+ if (!m.matches()) {
+ throw new IllegalArgumentException("externalId is invalid: " + externalId);
+ }
+ String folderName = m.group(2);
+ String elemName = m.group(3);
+ Map<String, String> meta = importMetaData(m.group(5));
+ if (folderName != null) {
+ parentEntity = externalIdToEntity(f, folderName, parentEntity);
+ if (parentEntity == null) {
+ return null;
+ }
+ }
+ if (parentEntity != null) {
+ return findEntity(parentEntity.getEntities(), elemName, meta);
+ }
+ else {
+ return findEntity(f.getEntities(), elemName, meta);
+ }
+ }
+
+ /**
+ * @deprecated use {@link #externalIdToAttributePath(IDataModel, String)} instead
+ */
+ @Deprecated
+ public static IDataModelAttribute externalIdToAttribute(IDataModel f, String externalId, IDataModelEntity parentEntity) {
+ if (externalId == null) {
+ return null;
+ }
+ Matcher m = PAT_EXTERNAL_ID.matcher(externalId);
+ if (!m.matches()) {
+ throw new IllegalArgumentException("externalId is invalid: " + externalId);
+ }
+ String folderName = m.group(2);
+ String elemName = m.group(3);
+ Map<String, String> meta = importMetaData(m.group(5));
+ if (folderName != null) {
+ parentEntity = externalIdToEntity(f, folderName, parentEntity);
+ if (parentEntity == null) {
+ return null;
+ }
+ }
+ if (parentEntity != null) {
+ return findAttribute(parentEntity.getAttributes(), elemName, meta);
+ }
+ else {
+ return findAttribute(f.getAttributes(), elemName, meta);
+ }
+ }
+
+ /**
+ * @deprecated use {@link #findEntity(IDataModelEntity[], String, Map)} instead
+ */
+ @Deprecated
+ public static IDataModelEntity findEntity(IDataModelEntity[] array, String simpleName) {
+ return findEntity(array, simpleName, null);
+ }
+
+ /**
+ * @deprecated use {@link #attributePathToExternalId(IDataModel, AttributePath)} instead
+ */
+ @Deprecated
+ public static String attributeToExternalId(IDataModelAttribute a, IDataModelEntity... entityPath) {
+ String id = a.getClass().getSimpleName() + exportMetaData(a.getMetaDataOfAttribute());
+ for (int i = entityPath.length - 1; i >= 0; i--) {
+ IDataModelEntity e = entityPath[i];
+ id = e.getClass().getSimpleName() + "/" + id;
+ }
+ return id;
+ }
+
+ /**
+ * @deprecated use {@link #externalIdToEntityPath(IDataModel, String)} instead
+ */
+ @Deprecated
+ public static IDataModelEntity[] externalIdToEntityPath(IDataModel f, String externalId, IDataModelEntity parentEntity) {
+ EntityPath ePath = null;
+ try {
+ //try attribute
+ AttributePath aPath = externalIdToAttributePath(f, externalId);
+ if (aPath != null) {
+ ePath = aPath.getEntityPath();
+ }
+ }
+ catch (Throwable t) {
+ //nop
+ }
+ if (ePath == null) {
+ //try entity
+ ePath = externalIdToEntityPath(f, externalId);
+ }
+ if (ePath != null) {
+ return ePath.elements().toArray(new IDataModelEntity[ePath.size()]);
+ }
+ return new IDataModelEntity[0];
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/EntityPath.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/EntityPath.java
index d1bbbc0db5..7c66cfb632 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/EntityPath.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/EntityPath.java
@@ -1,219 +1,219 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.data.model;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * This path represents the forward path from the data model root to an entity
- * <p>
- * Since the data model is a graph (with potential cycles) the physical instantiation of the datamodel is performed by
- * creating all graph nodes once with single parent linkage. Therefore when holding a {@link IDataModelAttribute} or
- * {@link IDataModelEntity} the forward path to this object from the {@link IDataModel} root is ambiguous. This class
- * solves that problem by containing the complete path.
- *
- * @since 3.8
- */
-public final class EntityPath {
- public static final EntityPath EMPTY = new EntityPath();
-
- private final List<IDataModelEntity> m_entityPath;
- private final int m_hashCode;
-
- public EntityPath() {
- this(null);
- }
-
- public EntityPath(List<IDataModelEntity> entityPath) {
- this(entityPath, true);
- }
-
- /**
- * @param entityPath
- * @param useCopyOfList
- * if true then the entityPath list is assumed to be mutable and a copy of it is taken.
- */
- public EntityPath(List<IDataModelEntity> entityPath, boolean useCopyOfList) {
- if (entityPath == null || entityPath.size() == 0) {
- m_entityPath = Collections.emptyList();
- }
- else {
- if (useCopyOfList) {
- m_entityPath = Collections.unmodifiableList(new ArrayList<IDataModelEntity>(entityPath));
- }
- else {
- m_entityPath = Collections.unmodifiableList(entityPath);
- }
- }
- m_hashCode = m_entityPath.hashCode();
- }
-
- /**
- * @return the path of elements from root to last
- */
- public List<IDataModelEntity> elements() {
- return m_entityPath;
- }
-
- /**
- * convenience to get first element
- */
- public IDataModelEntity firstElement() {
- return m_entityPath.size() > 0 ? m_entityPath.get(0) : null;
- }
-
- /**
- * convenience to get last element
- */
- public IDataModelEntity lastElement() {
- return m_entityPath.size() > 0 ? m_entityPath.get(m_entityPath.size() - 1) : null;
- }
-
- public int size() {
- return m_entityPath.size();
- }
-
- public IDataModelEntity get(int index) {
- return m_entityPath.get(index);
- }
-
- /**
- * @return true if {@link #size()} is 0
- */
- public boolean isEmpty() {
- return this == EMPTY || size() == 0;
- }
-
- /**
- * @return a new path without the last component
- */
- public EntityPath parent() {
- if (size() <= 1) {
- return EMPTY;
- }
- return new EntityPath(m_entityPath.subList(0, m_entityPath.size() - 1), false);
- }
-
- /**
- * @return a new path containing the elements between from (inclusive) and to (exclusive)
- */
- public EntityPath subPath(int fromIndex, int toIndex) {
- if (size() <= 0) {
- return EMPTY;
- }
- return new EntityPath(m_entityPath.subList(fromIndex, toIndex), false);
- }
-
- /**
- * @return a new path by inserting the component at the front
- */
- public EntityPath addToFront(IDataModelEntity e) {
- if (e == null) {
- return this;
- }
- ArrayList<IDataModelEntity> newList = new ArrayList<IDataModelEntity>(size() + 1);
- newList.add(e);
- newList.addAll(m_entityPath);
- return new EntityPath(newList, false);
- }
-
- /**
- * @return a new path by appending the component at the end
- */
- public EntityPath addToEnd(IDataModelEntity e) {
- if (e == null) {
- return this;
- }
- ArrayList<IDataModelEntity> newList = new ArrayList<IDataModelEntity>(size() + 1);
- newList.addAll(m_entityPath);
- newList.add(e);
- return new EntityPath(newList, false);
- }
-
- /**
- * @return a new path by inserting the component at the front
- */
- public EntityPath addToFront(EntityPath p) {
- if (p == null || p.size() == 0) {
- return this;
- }
- ArrayList<IDataModelEntity> newList = new ArrayList<IDataModelEntity>(size() + 1);
- newList.addAll(p.m_entityPath);
- newList.addAll(this.m_entityPath);
- return new EntityPath(newList, false);
- }
-
- /**
- * @return a new path by appending the component at the end
- */
- public EntityPath addToEnd(EntityPath p) {
- if (p == null || p.size() == 0) {
- return this;
- }
- ArrayList<IDataModelEntity> newList = new ArrayList<IDataModelEntity>(size() + 1);
- newList.addAll(this.m_entityPath);
- newList.addAll(p.m_entityPath);
- return new EntityPath(newList, false);
- }
-
- /**
- * @return a new path by appending the component at the end
- */
- public AttributePath addToEnd(IDataModelAttribute a) {
- if (a == null) {
- throw new IllegalArgumentException("attribute is null");
- }
- return new AttributePath(this, a);
- }
-
- @Override
- public int hashCode() {
- return m_hashCode;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == this) {
- return true;
- }
- if (!(obj instanceof EntityPath)) {
- return false;
- }
- EntityPath other = (EntityPath) obj;
- return this.m_entityPath.equals(other.m_entityPath);
- }
-
- @Override
- public String toString() {
- StringBuilder buf = new StringBuilder();
- buf.append(getClass().getSimpleName());
- buf.append("[");
- if (isEmpty()) {
- buf.append("<EMPTY>");
- }
- else {
- int index = 0;
- for (IDataModelEntity e : m_entityPath) {
- if (index > 0) {
- buf.append(".");
- }
- buf.append(e.getClass().getSimpleName());
- buf.append("(" + e.getText() + ")");
- index++;
- }
- }
- buf.append("]");
- return buf.toString();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.data.model;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * This path represents the forward path from the data model root to an entity
+ * <p>
+ * Since the data model is a graph (with potential cycles) the physical instantiation of the datamodel is performed by
+ * creating all graph nodes once with single parent linkage. Therefore when holding a {@link IDataModelAttribute} or
+ * {@link IDataModelEntity} the forward path to this object from the {@link IDataModel} root is ambiguous. This class
+ * solves that problem by containing the complete path.
+ *
+ * @since 3.8
+ */
+public final class EntityPath {
+ public static final EntityPath EMPTY = new EntityPath();
+
+ private final List<IDataModelEntity> m_entityPath;
+ private final int m_hashCode;
+
+ public EntityPath() {
+ this(null);
+ }
+
+ public EntityPath(List<IDataModelEntity> entityPath) {
+ this(entityPath, true);
+ }
+
+ /**
+ * @param entityPath
+ * @param useCopyOfList
+ * if true then the entityPath list is assumed to be mutable and a copy of it is taken.
+ */
+ public EntityPath(List<IDataModelEntity> entityPath, boolean useCopyOfList) {
+ if (entityPath == null || entityPath.size() == 0) {
+ m_entityPath = Collections.emptyList();
+ }
+ else {
+ if (useCopyOfList) {
+ m_entityPath = Collections.unmodifiableList(new ArrayList<IDataModelEntity>(entityPath));
+ }
+ else {
+ m_entityPath = Collections.unmodifiableList(entityPath);
+ }
+ }
+ m_hashCode = m_entityPath.hashCode();
+ }
+
+ /**
+ * @return the path of elements from root to last
+ */
+ public List<IDataModelEntity> elements() {
+ return m_entityPath;
+ }
+
+ /**
+ * convenience to get first element
+ */
+ public IDataModelEntity firstElement() {
+ return m_entityPath.size() > 0 ? m_entityPath.get(0) : null;
+ }
+
+ /**
+ * convenience to get last element
+ */
+ public IDataModelEntity lastElement() {
+ return m_entityPath.size() > 0 ? m_entityPath.get(m_entityPath.size() - 1) : null;
+ }
+
+ public int size() {
+ return m_entityPath.size();
+ }
+
+ public IDataModelEntity get(int index) {
+ return m_entityPath.get(index);
+ }
+
+ /**
+ * @return true if {@link #size()} is 0
+ */
+ public boolean isEmpty() {
+ return this == EMPTY || size() == 0;
+ }
+
+ /**
+ * @return a new path without the last component
+ */
+ public EntityPath parent() {
+ if (size() <= 1) {
+ return EMPTY;
+ }
+ return new EntityPath(m_entityPath.subList(0, m_entityPath.size() - 1), false);
+ }
+
+ /**
+ * @return a new path containing the elements between from (inclusive) and to (exclusive)
+ */
+ public EntityPath subPath(int fromIndex, int toIndex) {
+ if (size() <= 0) {
+ return EMPTY;
+ }
+ return new EntityPath(m_entityPath.subList(fromIndex, toIndex), false);
+ }
+
+ /**
+ * @return a new path by inserting the component at the front
+ */
+ public EntityPath addToFront(IDataModelEntity e) {
+ if (e == null) {
+ return this;
+ }
+ ArrayList<IDataModelEntity> newList = new ArrayList<IDataModelEntity>(size() + 1);
+ newList.add(e);
+ newList.addAll(m_entityPath);
+ return new EntityPath(newList, false);
+ }
+
+ /**
+ * @return a new path by appending the component at the end
+ */
+ public EntityPath addToEnd(IDataModelEntity e) {
+ if (e == null) {
+ return this;
+ }
+ ArrayList<IDataModelEntity> newList = new ArrayList<IDataModelEntity>(size() + 1);
+ newList.addAll(m_entityPath);
+ newList.add(e);
+ return new EntityPath(newList, false);
+ }
+
+ /**
+ * @return a new path by inserting the component at the front
+ */
+ public EntityPath addToFront(EntityPath p) {
+ if (p == null || p.size() == 0) {
+ return this;
+ }
+ ArrayList<IDataModelEntity> newList = new ArrayList<IDataModelEntity>(size() + 1);
+ newList.addAll(p.m_entityPath);
+ newList.addAll(this.m_entityPath);
+ return new EntityPath(newList, false);
+ }
+
+ /**
+ * @return a new path by appending the component at the end
+ */
+ public EntityPath addToEnd(EntityPath p) {
+ if (p == null || p.size() == 0) {
+ return this;
+ }
+ ArrayList<IDataModelEntity> newList = new ArrayList<IDataModelEntity>(size() + 1);
+ newList.addAll(this.m_entityPath);
+ newList.addAll(p.m_entityPath);
+ return new EntityPath(newList, false);
+ }
+
+ /**
+ * @return a new path by appending the component at the end
+ */
+ public AttributePath addToEnd(IDataModelAttribute a) {
+ if (a == null) {
+ throw new IllegalArgumentException("attribute is null");
+ }
+ return new AttributePath(this, a);
+ }
+
+ @Override
+ public int hashCode() {
+ return m_hashCode;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof EntityPath)) {
+ return false;
+ }
+ EntityPath other = (EntityPath) obj;
+ return this.m_entityPath.equals(other.m_entityPath);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder buf = new StringBuilder();
+ buf.append(getClass().getSimpleName());
+ buf.append("[");
+ if (isEmpty()) {
+ buf.append("<EMPTY>");
+ }
+ else {
+ int index = 0;
+ for (IDataModelEntity e : m_entityPath) {
+ if (index > 0) {
+ buf.append(".");
+ }
+ buf.append(e.getClass().getSimpleName());
+ buf.append("(" + e.getText() + ")");
+ index++;
+ }
+ }
+ buf.append("]");
+ return buf.toString();
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/IDataModel.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/IDataModel.java
index 6a178c0203..6ecd8a8565 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/IDataModel.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/IDataModel.java
@@ -1,27 +1,27 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.data.model;
-
-public interface IDataModel {
-
- /**
- * call init before using the data model structure
- */
- void init();
-
- IDataModelAttribute[] getAttributes();
-
- IDataModelAttribute getAttribute(Class<? extends IDataModelAttribute> attributeClazz);
-
- IDataModelEntity[] getEntities();
-
- IDataModelEntity getEntity(Class<? extends IDataModelEntity> entityClazz);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.data.model;
+
+public interface IDataModel {
+
+ /**
+ * call init before using the data model structure
+ */
+ void init();
+
+ IDataModelAttribute[] getAttributes();
+
+ IDataModelAttribute getAttribute(Class<? extends IDataModelAttribute> attributeClazz);
+
+ IDataModelEntity[] getEntities();
+
+ IDataModelEntity getEntity(Class<? extends IDataModelEntity> entityClazz);
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/IDataModelAttribute.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/IDataModelAttribute.java
index 45cebe2fa5..cde74927f2 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/IDataModelAttribute.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/IDataModelAttribute.java
@@ -1,155 +1,155 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.data.model;
-
-import java.security.Permission;
-import java.util.Map;
-
-import org.eclipse.scout.commons.beans.IPropertyObserver;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.shared.services.common.code.ICodeType;
-import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
-
-public interface IDataModelAttribute extends IPropertyObserver, DataModelConstants {
-
- void initAttribute() throws ProcessingException;
-
- /**
- * For {@link #TYPE_CODE_LIST}, {@link #TYPE_CODE_TREE}, {@link #TYPE_NUMBER_LIST}, {@link #TYPE_NUMBER_TREE} and
- * {@link #TYPE_SMART} only. Delegate of the callback {@link AbstractListBox#execPrepareLookup(LookupCall)} and
- * {@link AbstractTreeBox#execPrepareLookup(LookupCall, org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode)}
- */
- void prepareLookup(LookupCall call) throws ProcessingException;
-
- String getText();
-
- void setText(String s);
-
- /**
- * @return the type of field to display to select a value for this attribute
- * see the TYPE_* values
- */
- int getType();
-
- void setType(int type);
-
- IDataModelAttributeOp[] getOperators();
-
- void setOperators(IDataModelAttributeOp[] ops);
-
- /**
- * @return array of {@link DataModelConstants#AGGREGATION_*}
- */
- int[] getAggregationTypes();
-
- /**
- * @param aggregationTypes
- * array of {@link DataModelConstants#AGGREGATION_*}
- */
- void setAggregationTypes(int[] aggregationTypes);
-
- boolean containsAggregationType(int agType);
-
- String getIconId();
-
- void setIconId(String s);
-
- boolean isNullOperatorEnabled();
-
- void setNullOperatorEnabled(boolean b);
-
- boolean isNotOperatorEnabled();
-
- void setNotOperatorEnabled(boolean b);
-
- boolean isAggregationEnabled();
-
- void setAggregationEnabled(boolean aggregationEnabled);
-
- Class<? extends ICodeType> getCodeTypeClass();
-
- void setCodeTypeClass(Class<? extends ICodeType> codeTypeClass);
-
- LookupCall getLookupCall();
-
- void setLookupCall(LookupCall call);
-
- Permission getVisiblePermission();
-
- void setVisiblePermission(Permission p);
-
- boolean isVisibleGranted();
-
- void setVisibleGranted(boolean b);
-
- boolean isVisible();
-
- void setVisible(boolean b);
-
- boolean isActiveFilterEnabled();
-
- void setActiveFilterEnabled(boolean active);
-
- /**
- * Client code should not call this method, it is used internally to set up a {@link IDataModel} structure
- *
- * @deprecated will be renamed to setParentEntityInternal and set to package private
- */
- @Deprecated
- IDataModelEntity getParentEntity();
-
- /**
- * Client code should not call this method, it is used internally to set up a {@link IDataModel} structure
- *
- * @deprecated will be renamed to setParentEntityInternal and set to package private
- */
- @Deprecated
- void setParentEntity(IDataModelEntity parent);
-
- /**
- * @return meta data for the attribute, default returns null
- * <p>
- * This method is useful and should be overridden when dynamic attributes are used, where multiple attributes
- * of the same type (Class) occur in the same {@link IDataModel}. This meta map contains the distinguishing
- * map of these multiple instances.
- * <p>
- * If the map is not filled or null, the comparison is only based on the type ({@link #getClass()})
- * <p>
- * see {@link DataModelUtility}
- */
- Map<String, String> getMetaDataOfAttribute();
-
- /**
- * Describes whether this attribute holds a multi-value content. The default implementation derives the result from
- * {@link #getType()}. The following types are considered multi-valued:
- * <ul>
- * <li>{@link DataModelConstants#TYPE_CODE_LIST}</li>
- * <li>{@link DataModelConstants#TYPE_CODE_TREE}</li>
- * <li>{@link DataModelConstants#TYPE_NUMBER_LIST}</li>
- * <li>{@link DataModelConstants#TYPE_NUMBER_TREE}</li>
- * </ul>
- * <p>
- * A multi valued attribute behaves same as {@link IDataModelEntity#isOneToMany()}
- *
- * @return Returns <code>true</code> if this attribute holds multiple values. <code>false</code> otherwise.
- * @since 3.8.0
- */
- boolean isMultiValued();
-
- /**
- * Formats the provided raw value according to the defined attribute type.
- *
- * @param rawValue
- * Raw value to format.
- * @return Formatted value
- */
- String formatValue(Object rawValue);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.data.model;
+
+import java.security.Permission;
+import java.util.Map;
+
+import org.eclipse.scout.commons.beans.IPropertyObserver;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.shared.services.common.code.ICodeType;
+import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
+
+public interface IDataModelAttribute extends IPropertyObserver, DataModelConstants {
+
+ void initAttribute() throws ProcessingException;
+
+ /**
+ * For {@link #TYPE_CODE_LIST}, {@link #TYPE_CODE_TREE}, {@link #TYPE_NUMBER_LIST}, {@link #TYPE_NUMBER_TREE} and
+ * {@link #TYPE_SMART} only. Delegate of the callback {@link AbstractListBox#execPrepareLookup(LookupCall)} and
+ * {@link AbstractTreeBox#execPrepareLookup(LookupCall, org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode)}
+ */
+ void prepareLookup(LookupCall call) throws ProcessingException;
+
+ String getText();
+
+ void setText(String s);
+
+ /**
+ * @return the type of field to display to select a value for this attribute
+ * see the TYPE_* values
+ */
+ int getType();
+
+ void setType(int type);
+
+ IDataModelAttributeOp[] getOperators();
+
+ void setOperators(IDataModelAttributeOp[] ops);
+
+ /**
+ * @return array of {@link DataModelConstants#AGGREGATION_*}
+ */
+ int[] getAggregationTypes();
+
+ /**
+ * @param aggregationTypes
+ * array of {@link DataModelConstants#AGGREGATION_*}
+ */
+ void setAggregationTypes(int[] aggregationTypes);
+
+ boolean containsAggregationType(int agType);
+
+ String getIconId();
+
+ void setIconId(String s);
+
+ boolean isNullOperatorEnabled();
+
+ void setNullOperatorEnabled(boolean b);
+
+ boolean isNotOperatorEnabled();
+
+ void setNotOperatorEnabled(boolean b);
+
+ boolean isAggregationEnabled();
+
+ void setAggregationEnabled(boolean aggregationEnabled);
+
+ Class<? extends ICodeType> getCodeTypeClass();
+
+ void setCodeTypeClass(Class<? extends ICodeType> codeTypeClass);
+
+ LookupCall getLookupCall();
+
+ void setLookupCall(LookupCall call);
+
+ Permission getVisiblePermission();
+
+ void setVisiblePermission(Permission p);
+
+ boolean isVisibleGranted();
+
+ void setVisibleGranted(boolean b);
+
+ boolean isVisible();
+
+ void setVisible(boolean b);
+
+ boolean isActiveFilterEnabled();
+
+ void setActiveFilterEnabled(boolean active);
+
+ /**
+ * Client code should not call this method, it is used internally to set up a {@link IDataModel} structure
+ *
+ * @deprecated will be renamed to setParentEntityInternal and set to package private
+ */
+ @Deprecated
+ IDataModelEntity getParentEntity();
+
+ /**
+ * Client code should not call this method, it is used internally to set up a {@link IDataModel} structure
+ *
+ * @deprecated will be renamed to setParentEntityInternal and set to package private
+ */
+ @Deprecated
+ void setParentEntity(IDataModelEntity parent);
+
+ /**
+ * @return meta data for the attribute, default returns null
+ * <p>
+ * This method is useful and should be overridden when dynamic attributes are used, where multiple attributes
+ * of the same type (Class) occur in the same {@link IDataModel}. This meta map contains the distinguishing
+ * map of these multiple instances.
+ * <p>
+ * If the map is not filled or null, the comparison is only based on the type ({@link #getClass()})
+ * <p>
+ * see {@link DataModelUtility}
+ */
+ Map<String, String> getMetaDataOfAttribute();
+
+ /**
+ * Describes whether this attribute holds a multi-value content. The default implementation derives the result from
+ * {@link #getType()}. The following types are considered multi-valued:
+ * <ul>
+ * <li>{@link DataModelConstants#TYPE_CODE_LIST}</li>
+ * <li>{@link DataModelConstants#TYPE_CODE_TREE}</li>
+ * <li>{@link DataModelConstants#TYPE_NUMBER_LIST}</li>
+ * <li>{@link DataModelConstants#TYPE_NUMBER_TREE}</li>
+ * </ul>
+ * <p>
+ * A multi valued attribute behaves same as {@link IDataModelEntity#isOneToMany()}
+ *
+ * @return Returns <code>true</code> if this attribute holds multiple values. <code>false</code> otherwise.
+ * @since 3.8.0
+ */
+ boolean isMultiValued();
+
+ /**
+ * Formats the provided raw value according to the defined attribute type.
+ *
+ * @param rawValue
+ * Raw value to format.
+ * @return Formatted value
+ */
+ String formatValue(Object rawValue);
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/IDataModelAttributeOp.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/IDataModelAttributeOp.java
index 618b2263c2..abc29aa31c 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/IDataModelAttributeOp.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/IDataModelAttributeOp.java
@@ -1,39 +1,39 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.data.model;
-
-public interface IDataModelAttributeOp {
-
- String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts);
-
- /**
- * example: "is bewteen {0} and {1}"
- */
- String getText();
-
- /**
- * example: "bewteen"
- */
- String getShortText();
-
- /**
- * @return the field type to display to select a value for usiong this operation, use
- * {@link IComposerAttribute#TYPE_INHERITED} when the type of the attribute should be used
- * see {@link IComposerAttribute}.TYPE_* values
- */
- int getType();
-
- /**
- * @return the unique operator type
- * see {@link ComposerConstants#OPERATOR_*} values
- */
- int getOperator();
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.data.model;
+
+public interface IDataModelAttributeOp {
+
+ String createVerboseText(Integer aggregationType, String attributeText, String[] valueTexts);
+
+ /**
+ * example: "is bewteen {0} and {1}"
+ */
+ String getText();
+
+ /**
+ * example: "bewteen"
+ */
+ String getShortText();
+
+ /**
+ * @return the field type to display to select a value for usiong this operation, use
+ * {@link IComposerAttribute#TYPE_INHERITED} when the type of the attribute should be used
+ * see {@link IComposerAttribute}.TYPE_* values
+ */
+ int getType();
+
+ /**
+ * @return the unique operator type
+ * see {@link ComposerConstants#OPERATOR_*} values
+ */
+ int getOperator();
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/IDataModelEntity.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/IDataModelEntity.java
index 416dff98bf..86f1cdcb2c 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/IDataModelEntity.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/data/model/IDataModelEntity.java
@@ -1,117 +1,117 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.data.model;
-
-import java.security.Permission;
-import java.util.Map;
-
-import org.eclipse.scout.commons.beans.IPropertyObserver;
-import org.eclipse.scout.commons.exception.ProcessingException;
-
-public interface IDataModelEntity extends IPropertyObserver {
-
- /**
- * @return meta data for the attribute, default returns null
- * <p>
- * This method is useful and should be overridden when dynamic attributes are used, where multiple attributes
- * of the same type (Class) occur in the same {@link IDataModel}. This meta map contains the distinguishing
- * map of these multiple instances.
- * <p>
- * If the map is not filled or null, the comparison is only based on the type ({@link #getClass()})
- * <p>
- * see {@link DataModelUtility}
- */
- Map<String, String> getMetaDataOfEntity();
-
- /**
- * Initialize this entity.
- */
- void initEntity() throws ProcessingException;
-
- String getIconId();
-
- void setIconId(String s);
-
- String getText();
-
- void setText(String s);
-
- IDataModelAttribute[] getAttributes();
-
- public IDataModelAttribute getAttribute(Class<? extends IDataModelAttribute> attributeClazz);
-
- IDataModelEntity[] getEntities();
-
- IDataModelEntity getEntity(Class<? extends IDataModelEntity> entityClazz);
-
- /**
- * Client code should not call this method, it is used internally to set up a {@link IDataModel} structure
- *
- * @deprecated will be renamed to setParentEntityInternal and set to package private
- */
- @Deprecated
- IDataModelEntity getParentEntity();
-
- /**
- * Client code should not call this method, it is used internally to set up a {@link IDataModel} structure
- *
- * @deprecated will be renamed to setParentEntityInternal and set to package private
- */
- @Deprecated
- void setParentEntity(IDataModelEntity parent);
-
- /**
- * In order to avoid loop cycles, this initializer is called by the composer field to load the child entity graph,
- * that may have cycles
- *
- * @param instanceMap
- * map containing all previously created entities, there should be only one entity per type
- */
- void initializeChildEntities(Map<Class<? extends IDataModelEntity>, IDataModelEntity> instanceMap);
-
- Permission getVisiblePermission();
-
- void setVisiblePermission(Permission p);
-
- boolean isVisibleGranted();
-
- void setVisibleGranted(boolean b);
-
- boolean isVisible();
-
- void setVisible(boolean b);
-
- /**
- * Controls the multiplicity of this entity in the context of its parent entity. The result is <code>true</code>, if
- * this entity can occur multiple times within its parent's context. Default is <code>true</code>.
- * <p/>
- * <b>Example:</b>A person has a mother, a father and an arbitrary number of friends. Let's assume the
- * <em>PersonEntity</em> contains a <em>PersonMotherEntity</em>, a <em>PersonFatherEntity</em> and a
- * <em>PersonFriendEntity</em>. Both, the mother and father entities' {@link IDataModelEntity#isOneToMany()} return
- * <code>false</code>. However the one of the friend entity return <code>true</code>.
- *
- * @return Returns <code>true</code> (default) if this entity can occur multiple times in the context of its parent
- * entity. Otherwise the entity is considered many-to-one, i.e. this entity can occur at most one time within
- * the context of its parent entity.
- * @since 3.8.0
- */
- boolean isOneToMany();
-
- /**
- * Controls the multiplicity of this entity in the context of its parent entity.
- *
- * @param b
- * <code>true</code> if this entity is referenced at most one time by its parent entity.
- * @see #isOneToMany()
- * @since 3.8.0
- */
- void setOneToMany(boolean b);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.data.model;
+
+import java.security.Permission;
+import java.util.Map;
+
+import org.eclipse.scout.commons.beans.IPropertyObserver;
+import org.eclipse.scout.commons.exception.ProcessingException;
+
+public interface IDataModelEntity extends IPropertyObserver {
+
+ /**
+ * @return meta data for the attribute, default returns null
+ * <p>
+ * This method is useful and should be overridden when dynamic attributes are used, where multiple attributes
+ * of the same type (Class) occur in the same {@link IDataModel}. This meta map contains the distinguishing
+ * map of these multiple instances.
+ * <p>
+ * If the map is not filled or null, the comparison is only based on the type ({@link #getClass()})
+ * <p>
+ * see {@link DataModelUtility}
+ */
+ Map<String, String> getMetaDataOfEntity();
+
+ /**
+ * Initialize this entity.
+ */
+ void initEntity() throws ProcessingException;
+
+ String getIconId();
+
+ void setIconId(String s);
+
+ String getText();
+
+ void setText(String s);
+
+ IDataModelAttribute[] getAttributes();
+
+ public IDataModelAttribute getAttribute(Class<? extends IDataModelAttribute> attributeClazz);
+
+ IDataModelEntity[] getEntities();
+
+ IDataModelEntity getEntity(Class<? extends IDataModelEntity> entityClazz);
+
+ /**
+ * Client code should not call this method, it is used internally to set up a {@link IDataModel} structure
+ *
+ * @deprecated will be renamed to setParentEntityInternal and set to package private
+ */
+ @Deprecated
+ IDataModelEntity getParentEntity();
+
+ /**
+ * Client code should not call this method, it is used internally to set up a {@link IDataModel} structure
+ *
+ * @deprecated will be renamed to setParentEntityInternal and set to package private
+ */
+ @Deprecated
+ void setParentEntity(IDataModelEntity parent);
+
+ /**
+ * In order to avoid loop cycles, this initializer is called by the composer field to load the child entity graph,
+ * that may have cycles
+ *
+ * @param instanceMap
+ * map containing all previously created entities, there should be only one entity per type
+ */
+ void initializeChildEntities(Map<Class<? extends IDataModelEntity>, IDataModelEntity> instanceMap);
+
+ Permission getVisiblePermission();
+
+ void setVisiblePermission(Permission p);
+
+ boolean isVisibleGranted();
+
+ void setVisibleGranted(boolean b);
+
+ boolean isVisible();
+
+ void setVisible(boolean b);
+
+ /**
+ * Controls the multiplicity of this entity in the context of its parent entity. The result is <code>true</code>, if
+ * this entity can occur multiple times within its parent's context. Default is <code>true</code>.
+ * <p/>
+ * <b>Example:</b>A person has a mother, a father and an arbitrary number of friends. Let's assume the
+ * <em>PersonEntity</em> contains a <em>PersonMotherEntity</em>, a <em>PersonFatherEntity</em> and a
+ * <em>PersonFriendEntity</em>. Both, the mother and father entities' {@link IDataModelEntity#isOneToMany()} return
+ * <code>false</code>. However the one of the friend entity return <code>true</code>.
+ *
+ * @return Returns <code>true</code> (default) if this entity can occur multiple times in the context of its parent
+ * entity. Otherwise the entity is considered many-to-one, i.e. this entity can occur at most one time within
+ * the context of its parent entity.
+ * @since 3.8.0
+ */
+ boolean isOneToMany();
+
+ /**
+ * Controls the multiplicity of this entity in the context of its parent entity.
+ *
+ * @param b
+ * <code>true</code> if this entity is referenced at most one time by its parent entity.
+ * @see #isOneToMany()
+ * @since 3.8.0
+ */
+ void setOneToMany(boolean b);
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/BasicHierarchyPermission.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/BasicHierarchyPermission.java
index 8876c7cf04..4414fef4b6 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/BasicHierarchyPermission.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/BasicHierarchyPermission.java
@@ -1,209 +1,209 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.security;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-import java.security.BasicPermission;
-import java.security.Permission;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.TreeSet;
-
-import org.eclipse.scout.commons.TypeCastUtility;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.shared.services.common.security.IAccessControlService;
-import org.eclipse.scout.service.SERVICES;
-
-public abstract class BasicHierarchyPermission extends BasicPermission {
- private static final long serialVersionUID = 1L;
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(BasicHierarchyPermission.class);
-
- public static final int LEVEL_UNDEFINED = -1;
- public static final int LEVEL_NONE = 0;
- public static final int LEVEL_ALL = 100;
- private static long cacheTimeout = 60000L;
-
- public static long getCacheTimeoutMillis() {
- return cacheTimeout;
- }
-
- public static void setCacheTimeoutMillis(long t) {
- cacheTimeout = t;
- }
-
- private boolean m_readOnly;
- private int m_level;
- // cache
- private List<Integer> m_validLevels;
-
- public BasicHierarchyPermission(String name) {
- this(name, LEVEL_UNDEFINED);
- }
-
- public BasicHierarchyPermission(String name, int level) {
- super(name);
- buildLevelCache();
- setLevel(level);
- }
-
- @SuppressWarnings("boxing")
- private void buildLevelCache() {
- TreeSet<Integer> set = new TreeSet<Integer>();
- Field[] f = getClass().getFields();
- for (int i = 0; i < f.length; i++) {
- int flags = f[i].getModifiers();
- if (Modifier.isStatic(flags) && Modifier.isFinal(flags) && f[i].getName().startsWith("LEVEL_")) {
- try {
- int value = f[i].getInt(null);
- if (set.contains(value)) {
- throw new IllegalArgumentException("level " + f[i].getName() + " has the same value (" + value + ") as another level");
- }
- set.add(value);
- }
- catch (Exception e) {
- throw new IllegalArgumentException("could not build internal level cache", e);
- }
- }
- }
- m_validLevels = new ArrayList<Integer>(set);
- }
-
- /**
- * array of available levels, starting with the lowest, ending with the
- * highest
- */
- public final List<Integer> getValidLevels() {
- return Collections.unmodifiableList(m_validLevels);
- }
-
- public final int getLevel() {
- return m_level;
- }
-
- @SuppressWarnings("boxing")
- public final void setLevel(int level) {
- if (m_readOnly) {
- throw new SecurityException("Permission is read-only");
- }
- if (!m_validLevels.contains(level)) {
- throw new IllegalArgumentException("invalid level: " + level);
- }
- m_level = level;
- }
-
- public final void setReadOnly() {
- m_readOnly = true;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof BasicHierarchyPermission) {
- BasicHierarchyPermission other = (BasicHierarchyPermission) obj;
- if (this.m_level == other.m_level) {
- if (super.equals(obj)) {
- return true;
- }
- }
- }
- return false;
- }
-
- @Override
- public int hashCode() {
- return super.hashCode() ^ m_level;
- }
-
- protected String getConfiguredId() {
- return null;
- }
-
- /**
- * when p.level has value {@link #LEVEL_UNDEFINED} and also {@link #calculateLevel(int)} returns #
- * {@link #LEVEL_UNDEFINED} then set
- * p.level to the maximum of its level
- */
- @Override
- public boolean implies(Permission p) {
- if (this.getClass().isAssignableFrom(p.getClass())) {
- BasicHierarchyPermission other = (BasicHierarchyPermission) p;
- if (super.implies(p)) {
- switch (this.m_level) {
- case LEVEL_ALL: {
- return true;
- }
- case LEVEL_UNDEFINED: {
- LOG.warn("The level of a " + this.getClass().getSimpleName() + " in the permission collection should not have the level LEVEL_UNDEFINED");
- return false;
- }
- case LEVEL_NONE: {
- return false;
- }
- default: {
- if (other.m_level == LEVEL_UNDEFINED) {
- if (checkLevel(other, this.m_level)) {
- return true;
- }
- }
- else {
- return this.m_level >= other.m_level;
- }
- }
- }
- }
- }
- return false;
- }
-
- @SuppressWarnings("boxing")
- private boolean checkLevel(BasicHierarchyPermission other, int level) {
- // check if we are in the backend
- if (SERVICES.getService(IAccessControlService.class).isProxyService()) {
- throw new FineGrainedAccessCheckRequiredException();
- }
- try {
- boolean b = other.execCheckLevel(level);
- return b;
- }
- catch (ProcessingException e) {
- throw new SecurityException(e);
- }
- }
-
- /**
- * Only called in the backend. Frontend uses proxy cache. Called by {@link #implies(Permission)} when level has value
- * #LEVEL_UNDEFINED
- *
- * @param requiredLevel
- * default implementation calls {@link #execCheckLevelData(int)} and
- * returns true if data yields rows and first rows first value is 1
- */
- @SuppressWarnings("boxing")
- protected boolean execCheckLevel(int requiredLevel) throws ProcessingException {
- Object[][] data = execCheckLevelData(requiredLevel);
- return data != null && data.length > 0 && TypeCastUtility.castValue(data[0][0], Boolean.class);
- }
-
- /**
- * called by {@link #implies(Permission)} via execCheckLevel when level has
- * value #LEVEL_UNDEFINED
- *
- * @param requiredLevel
- * @return data with data[0][0]=1 as true
- */
- protected Object[][] execCheckLevelData(int requiredLevel) throws ProcessingException {
- return null;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.security;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.security.BasicPermission;
+import java.security.Permission;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.TreeSet;
+
+import org.eclipse.scout.commons.TypeCastUtility;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.shared.services.common.security.IAccessControlService;
+import org.eclipse.scout.service.SERVICES;
+
+public abstract class BasicHierarchyPermission extends BasicPermission {
+ private static final long serialVersionUID = 1L;
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(BasicHierarchyPermission.class);
+
+ public static final int LEVEL_UNDEFINED = -1;
+ public static final int LEVEL_NONE = 0;
+ public static final int LEVEL_ALL = 100;
+ private static long cacheTimeout = 60000L;
+
+ public static long getCacheTimeoutMillis() {
+ return cacheTimeout;
+ }
+
+ public static void setCacheTimeoutMillis(long t) {
+ cacheTimeout = t;
+ }
+
+ private boolean m_readOnly;
+ private int m_level;
+ // cache
+ private List<Integer> m_validLevels;
+
+ public BasicHierarchyPermission(String name) {
+ this(name, LEVEL_UNDEFINED);
+ }
+
+ public BasicHierarchyPermission(String name, int level) {
+ super(name);
+ buildLevelCache();
+ setLevel(level);
+ }
+
+ @SuppressWarnings("boxing")
+ private void buildLevelCache() {
+ TreeSet<Integer> set = new TreeSet<Integer>();
+ Field[] f = getClass().getFields();
+ for (int i = 0; i < f.length; i++) {
+ int flags = f[i].getModifiers();
+ if (Modifier.isStatic(flags) && Modifier.isFinal(flags) && f[i].getName().startsWith("LEVEL_")) {
+ try {
+ int value = f[i].getInt(null);
+ if (set.contains(value)) {
+ throw new IllegalArgumentException("level " + f[i].getName() + " has the same value (" + value + ") as another level");
+ }
+ set.add(value);
+ }
+ catch (Exception e) {
+ throw new IllegalArgumentException("could not build internal level cache", e);
+ }
+ }
+ }
+ m_validLevels = new ArrayList<Integer>(set);
+ }
+
+ /**
+ * array of available levels, starting with the lowest, ending with the
+ * highest
+ */
+ public final List<Integer> getValidLevels() {
+ return Collections.unmodifiableList(m_validLevels);
+ }
+
+ public final int getLevel() {
+ return m_level;
+ }
+
+ @SuppressWarnings("boxing")
+ public final void setLevel(int level) {
+ if (m_readOnly) {
+ throw new SecurityException("Permission is read-only");
+ }
+ if (!m_validLevels.contains(level)) {
+ throw new IllegalArgumentException("invalid level: " + level);
+ }
+ m_level = level;
+ }
+
+ public final void setReadOnly() {
+ m_readOnly = true;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof BasicHierarchyPermission) {
+ BasicHierarchyPermission other = (BasicHierarchyPermission) obj;
+ if (this.m_level == other.m_level) {
+ if (super.equals(obj)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return super.hashCode() ^ m_level;
+ }
+
+ protected String getConfiguredId() {
+ return null;
+ }
+
+ /**
+ * when p.level has value {@link #LEVEL_UNDEFINED} and also {@link #calculateLevel(int)} returns #
+ * {@link #LEVEL_UNDEFINED} then set
+ * p.level to the maximum of its level
+ */
+ @Override
+ public boolean implies(Permission p) {
+ if (this.getClass().isAssignableFrom(p.getClass())) {
+ BasicHierarchyPermission other = (BasicHierarchyPermission) p;
+ if (super.implies(p)) {
+ switch (this.m_level) {
+ case LEVEL_ALL: {
+ return true;
+ }
+ case LEVEL_UNDEFINED: {
+ LOG.warn("The level of a " + this.getClass().getSimpleName() + " in the permission collection should not have the level LEVEL_UNDEFINED");
+ return false;
+ }
+ case LEVEL_NONE: {
+ return false;
+ }
+ default: {
+ if (other.m_level == LEVEL_UNDEFINED) {
+ if (checkLevel(other, this.m_level)) {
+ return true;
+ }
+ }
+ else {
+ return this.m_level >= other.m_level;
+ }
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ @SuppressWarnings("boxing")
+ private boolean checkLevel(BasicHierarchyPermission other, int level) {
+ // check if we are in the backend
+ if (SERVICES.getService(IAccessControlService.class).isProxyService()) {
+ throw new FineGrainedAccessCheckRequiredException();
+ }
+ try {
+ boolean b = other.execCheckLevel(level);
+ return b;
+ }
+ catch (ProcessingException e) {
+ throw new SecurityException(e);
+ }
+ }
+
+ /**
+ * Only called in the backend. Frontend uses proxy cache. Called by {@link #implies(Permission)} when level has value
+ * #LEVEL_UNDEFINED
+ *
+ * @param requiredLevel
+ * default implementation calls {@link #execCheckLevelData(int)} and
+ * returns true if data yields rows and first rows first value is 1
+ */
+ @SuppressWarnings("boxing")
+ protected boolean execCheckLevel(int requiredLevel) throws ProcessingException {
+ Object[][] data = execCheckLevelData(requiredLevel);
+ return data != null && data.length > 0 && TypeCastUtility.castValue(data[0][0], Boolean.class);
+ }
+
+ /**
+ * called by {@link #implies(Permission)} via execCheckLevel when level has
+ * value #LEVEL_UNDEFINED
+ *
+ * @param requiredLevel
+ * @return data with data[0][0]=1 as true
+ */
+ protected Object[][] execCheckLevelData(int requiredLevel) throws ProcessingException {
+ return null;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/CopyToClipboardPermission.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/CopyToClipboardPermission.java
index 52871a78a5..3aff746c3a 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/CopyToClipboardPermission.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/CopyToClipboardPermission.java
@@ -1,21 +1,21 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.security;
-
-import java.security.BasicPermission;
-
-public class CopyToClipboardPermission extends BasicPermission {
- private static final long serialVersionUID = 1L;
-
- public CopyToClipboardPermission() {
- super("clipboard.copy");
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.security;
+
+import java.security.BasicPermission;
+
+public class CopyToClipboardPermission extends BasicPermission {
+ private static final long serialVersionUID = 1L;
+
+ public CopyToClipboardPermission() {
+ super("clipboard.copy");
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/CreateCustomColumnPermission.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/CreateCustomColumnPermission.java
index c0ff723acd..26050a3247 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/CreateCustomColumnPermission.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/CreateCustomColumnPermission.java
@@ -1,21 +1,21 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.security;
-
-import java.security.BasicPermission;
-
-public class CreateCustomColumnPermission extends BasicPermission {
- private static final long serialVersionUID = 1L;
-
- public CreateCustomColumnPermission() {
- super("custom.column.create");
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.security;
+
+import java.security.BasicPermission;
+
+public class CreateCustomColumnPermission extends BasicPermission {
+ private static final long serialVersionUID = 1L;
+
+ public CreateCustomColumnPermission() {
+ super("custom.column.create");
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/CreateGlobalBookmarkPermission.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/CreateGlobalBookmarkPermission.java
index fbff4c7b20..d107351688 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/CreateGlobalBookmarkPermission.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/CreateGlobalBookmarkPermission.java
@@ -1,22 +1,22 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.security;
-
-import java.security.BasicPermission;
-
-public class CreateGlobalBookmarkPermission extends BasicPermission {
- private static final long serialVersionUID = 1L;
-
- public CreateGlobalBookmarkPermission() {
- super("bookmark.global.create");
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.security;
+
+import java.security.BasicPermission;
+
+public class CreateGlobalBookmarkPermission extends BasicPermission {
+ private static final long serialVersionUID = 1L;
+
+ public CreateGlobalBookmarkPermission() {
+ super("bookmark.global.create");
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/CreateUserBookmarkPermission.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/CreateUserBookmarkPermission.java
index a335482c6e..d6b5a6d257 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/CreateUserBookmarkPermission.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/CreateUserBookmarkPermission.java
@@ -1,22 +1,22 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.security;
-
-import java.security.BasicPermission;
-
-public class CreateUserBookmarkPermission extends BasicPermission {
- private static final long serialVersionUID = 1L;
-
- public CreateUserBookmarkPermission() {
- super("bookmark.user.create");
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.security;
+
+import java.security.BasicPermission;
+
+public class CreateUserBookmarkPermission extends BasicPermission {
+ private static final long serialVersionUID = 1L;
+
+ public CreateUserBookmarkPermission() {
+ super("bookmark.user.create");
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/DeleteCustomColumnPermission.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/DeleteCustomColumnPermission.java
index 907a32d03f..8f8b9c1cfc 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/DeleteCustomColumnPermission.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/DeleteCustomColumnPermission.java
@@ -1,21 +1,21 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.security;
-
-import java.security.BasicPermission;
-
-public class DeleteCustomColumnPermission extends BasicPermission {
- private static final long serialVersionUID = 1L;
-
- public DeleteCustomColumnPermission() {
- super("custom.column.delete");
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.security;
+
+import java.security.BasicPermission;
+
+public class DeleteCustomColumnPermission extends BasicPermission {
+ private static final long serialVersionUID = 1L;
+
+ public DeleteCustomColumnPermission() {
+ super("custom.column.delete");
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/DeleteGlobalBookmarkPermission.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/DeleteGlobalBookmarkPermission.java
index 6a31fed004..1b13411d30 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/DeleteGlobalBookmarkPermission.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/DeleteGlobalBookmarkPermission.java
@@ -1,22 +1,22 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.security;
-
-import java.security.BasicPermission;
-
-public class DeleteGlobalBookmarkPermission extends BasicPermission {
- private static final long serialVersionUID = 1L;
-
- public DeleteGlobalBookmarkPermission() {
- super("bookmark.global.delete");
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.security;
+
+import java.security.BasicPermission;
+
+public class DeleteGlobalBookmarkPermission extends BasicPermission {
+ private static final long serialVersionUID = 1L;
+
+ public DeleteGlobalBookmarkPermission() {
+ super("bookmark.global.delete");
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/DeleteUserBookmarkPermission.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/DeleteUserBookmarkPermission.java
index d948c389c2..d01f594f4b 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/DeleteUserBookmarkPermission.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/DeleteUserBookmarkPermission.java
@@ -1,22 +1,22 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.security;
-
-import java.security.BasicPermission;
-
-public class DeleteUserBookmarkPermission extends BasicPermission {
- private static final long serialVersionUID = 1L;
-
- public DeleteUserBookmarkPermission() {
- super("bookmark.user.delete");
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.security;
+
+import java.security.BasicPermission;
+
+public class DeleteUserBookmarkPermission extends BasicPermission {
+ private static final long serialVersionUID = 1L;
+
+ public DeleteUserBookmarkPermission() {
+ super("bookmark.user.delete");
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/FineGrainedAccessCheckRequiredException.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/FineGrainedAccessCheckRequiredException.java
index add8f329d6..5d23b22a77 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/FineGrainedAccessCheckRequiredException.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/FineGrainedAccessCheckRequiredException.java
@@ -1,26 +1,26 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.security;
-
-/**
- * This exception is thrown by {@link BasicHierarchyPermission#implies(java.security.Permission)} when
- * fine-grained access has to be calculated (on backend) but the permission
- * check is done in the frontend (by a service proxy) The
- * {@link org.eclipse.scout.rt.shared.services.common.security.bsiag.service.ac.IAccessControlService} proxy will then
- * delegate the check to the backend
- */
-public class FineGrainedAccessCheckRequiredException extends SecurityException {
- private static final long serialVersionUID = 1L;
-
- public FineGrainedAccessCheckRequiredException() {
- super("fine-grained access-control must be calculated on backend");
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.security;
+
+/**
+ * This exception is thrown by {@link BasicHierarchyPermission#implies(java.security.Permission)} when
+ * fine-grained access has to be calculated (on backend) but the permission
+ * check is done in the frontend (by a service proxy) The
+ * {@link org.eclipse.scout.rt.shared.services.common.security.bsiag.service.ac.IAccessControlService} proxy will then
+ * delegate the check to the backend
+ */
+public class FineGrainedAccessCheckRequiredException extends SecurityException {
+ private static final long serialVersionUID = 1L;
+
+ public FineGrainedAccessCheckRequiredException() {
+ super("fine-grained access-control must be calculated on backend");
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/NoAccessPermission.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/NoAccessPermission.java
index e09fcd2cac..1f59f5783c 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/NoAccessPermission.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/NoAccessPermission.java
@@ -1,30 +1,30 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.security;
-
-import java.security.BasicPermission;
-import java.security.Permission;
-
-/**
- * permission grants nothing
- */
-public class NoAccessPermission extends BasicPermission {
- private static final long serialVersionUID = 1L;
-
- public NoAccessPermission() {
- super("DENIED", null);
- }
-
- @Override
- public boolean implies(Permission p) {
- return false;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.security;
+
+import java.security.BasicPermission;
+import java.security.Permission;
+
+/**
+ * permission grants nothing
+ */
+public class NoAccessPermission extends BasicPermission {
+ private static final long serialVersionUID = 1L;
+
+ public NoAccessPermission() {
+ super("DENIED", null);
+ }
+
+ @Override
+ public boolean implies(Permission p) {
+ return false;
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/PublishUserBookmarkPermission.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/PublishUserBookmarkPermission.java
index b0e0799509..ce0410577d 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/PublishUserBookmarkPermission.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/PublishUserBookmarkPermission.java
@@ -1,22 +1,22 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.security;
-
-import java.security.BasicPermission;
-
-public class PublishUserBookmarkPermission extends BasicPermission {
- private static final long serialVersionUID = 1L;
-
- public PublishUserBookmarkPermission() {
- super("bookmark.user.publish");
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.security;
+
+import java.security.BasicPermission;
+
+public class PublishUserBookmarkPermission extends BasicPermission {
+ private static final long serialVersionUID = 1L;
+
+ public PublishUserBookmarkPermission() {
+ super("bookmark.user.publish");
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/ReadGlobalBookmarkPermission.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/ReadGlobalBookmarkPermission.java
index 967764feaa..b0662c4574 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/ReadGlobalBookmarkPermission.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/ReadGlobalBookmarkPermission.java
@@ -1,22 +1,22 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.security;
-
-import java.security.BasicPermission;
-
-public class ReadGlobalBookmarkPermission extends BasicPermission {
- private static final long serialVersionUID = 1L;
-
- public ReadGlobalBookmarkPermission() {
- super("bookmark.global.read");
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.security;
+
+import java.security.BasicPermission;
+
+public class ReadGlobalBookmarkPermission extends BasicPermission {
+ private static final long serialVersionUID = 1L;
+
+ public ReadGlobalBookmarkPermission() {
+ super("bookmark.global.read");
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/ReadUserBookmarkPermission.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/ReadUserBookmarkPermission.java
index 0d54bfe205..d36e1f16ac 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/ReadUserBookmarkPermission.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/ReadUserBookmarkPermission.java
@@ -1,22 +1,22 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.security;
-
-import java.security.BasicPermission;
-
-public class ReadUserBookmarkPermission extends BasicPermission {
- private static final long serialVersionUID = 1L;
-
- public ReadUserBookmarkPermission() {
- super("bookmark.user.read");
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.security;
+
+import java.security.BasicPermission;
+
+public class ReadUserBookmarkPermission extends BasicPermission {
+ private static final long serialVersionUID = 1L;
+
+ public ReadUserBookmarkPermission() {
+ super("bookmark.user.read");
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/RemoteServiceAccessPermission.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/RemoteServiceAccessPermission.java
index 6eb0019a8a..9d1b37793d 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/RemoteServiceAccessPermission.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/RemoteServiceAccessPermission.java
@@ -1,67 +1,67 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.security;
-
-import java.security.Permission;
-import java.util.regex.Pattern;
-
-/**
- * Permission to grant remote access to a service interface from gui to server.
- * <p>
- * Checked at central access control location in scout server's BusinessOperationDispatcher.
- * <p>
- * Use this permission together with the application specific AccessControlService.
- */
-public class RemoteServiceAccessPermission extends Permission {
- private static final long serialVersionUID = 1L;
-
- private transient Pattern m_pattern;
-
- /**
- * Permission granting access to remote service call
- * <p>
- * pattern may contain multiple * as wildcards
- */
- public RemoteServiceAccessPermission(String interfaceTypeName, String methodName) {
- super(interfaceTypeName.replace("$", ".") + "#" + methodName);
- }
-
- @Override
- public boolean implies(Permission p) {
- if ((p == null) || (p.getClass() != getClass())) {
- return false;
- }
- if (m_pattern == null) {
- m_pattern = Pattern.compile(this.getName().replace(".", "[.]").replace("*", ".*"));
- }
- RemoteServiceAccessPermission other = (RemoteServiceAccessPermission) p;
- return m_pattern.matcher(other.getName()).matches();
- }
-
- @Override
- public int hashCode() {
- return getName().hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (!(obj instanceof RemoteServiceAccessPermission)) {
- return false;
- }
- return ((RemoteServiceAccessPermission) obj).getName().equals(this.getName());
- }
-
- @Override
- public String getActions() {
- return null;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.security;
+
+import java.security.Permission;
+import java.util.regex.Pattern;
+
+/**
+ * Permission to grant remote access to a service interface from gui to server.
+ * <p>
+ * Checked at central access control location in scout server's BusinessOperationDispatcher.
+ * <p>
+ * Use this permission together with the application specific AccessControlService.
+ */
+public class RemoteServiceAccessPermission extends Permission {
+ private static final long serialVersionUID = 1L;
+
+ private transient Pattern m_pattern;
+
+ /**
+ * Permission granting access to remote service call
+ * <p>
+ * pattern may contain multiple * as wildcards
+ */
+ public RemoteServiceAccessPermission(String interfaceTypeName, String methodName) {
+ super(interfaceTypeName.replace("$", ".") + "#" + methodName);
+ }
+
+ @Override
+ public boolean implies(Permission p) {
+ if ((p == null) || (p.getClass() != getClass())) {
+ return false;
+ }
+ if (m_pattern == null) {
+ m_pattern = Pattern.compile(this.getName().replace(".", "[.]").replace("*", ".*"));
+ }
+ RemoteServiceAccessPermission other = (RemoteServiceAccessPermission) p;
+ return m_pattern.matcher(other.getName()).matches();
+ }
+
+ @Override
+ public int hashCode() {
+ return getName().hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (!(obj instanceof RemoteServiceAccessPermission)) {
+ return false;
+ }
+ return ((RemoteServiceAccessPermission) obj).getName().equals(this.getName());
+ }
+
+ @Override
+ public String getActions() {
+ return null;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/ServicePermission.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/ServicePermission.java
index 2d46eb8ebc..cc8fe222de 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/ServicePermission.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/ServicePermission.java
@@ -1,30 +1,30 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.security;
-
-import java.security.BasicPermission;
-
-/**
- * @deprecated never used
- */
-@Deprecated
-public class ServicePermission extends BasicPermission {
- private static final long serialVersionUID = 1L;
-
- public ServicePermission(Class<?> interfaceClass, String operation) {
- this(interfaceClass.getName(), operation);
- }
-
- public ServicePermission(String interfaceClassName, String operation) {
- super(interfaceClassName.replace('$', '.') + "." + operation);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.security;
+
+import java.security.BasicPermission;
+
+/**
+ * @deprecated never used
+ */
+@Deprecated
+public class ServicePermission extends BasicPermission {
+ private static final long serialVersionUID = 1L;
+
+ public ServicePermission(Class<?> interfaceClass, String operation) {
+ this(interfaceClass.getName(), operation);
+ }
+
+ public ServicePermission(String interfaceClassName, String operation) {
+ super(interfaceClassName.replace('$', '.') + "." + operation);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/UpdateCustomColumnPermission.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/UpdateCustomColumnPermission.java
index 27e1cc04f6..b08f728b1d 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/UpdateCustomColumnPermission.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/UpdateCustomColumnPermission.java
@@ -1,21 +1,21 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.security;
-
-import java.security.BasicPermission;
-
-public class UpdateCustomColumnPermission extends BasicPermission {
- private static final long serialVersionUID = 1L;
-
- public UpdateCustomColumnPermission() {
- super("custom.column.update");
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.security;
+
+import java.security.BasicPermission;
+
+public class UpdateCustomColumnPermission extends BasicPermission {
+ private static final long serialVersionUID = 1L;
+
+ public UpdateCustomColumnPermission() {
+ super("custom.column.update");
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/UpdateGlobalBookmarkPermission.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/UpdateGlobalBookmarkPermission.java
index 3d26401a7d..d33eb1af6d 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/UpdateGlobalBookmarkPermission.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/UpdateGlobalBookmarkPermission.java
@@ -1,22 +1,22 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.security;
-
-import java.security.BasicPermission;
-
-public class UpdateGlobalBookmarkPermission extends BasicPermission {
- private static final long serialVersionUID = 1L;
-
- public UpdateGlobalBookmarkPermission() {
- super("bookmark.global.update");
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.security;
+
+import java.security.BasicPermission;
+
+public class UpdateGlobalBookmarkPermission extends BasicPermission {
+ private static final long serialVersionUID = 1L;
+
+ public UpdateGlobalBookmarkPermission() {
+ super("bookmark.global.update");
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/UpdateServiceConfigurationPermission.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/UpdateServiceConfigurationPermission.java
index b96c89bc3f..69821ca2d2 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/UpdateServiceConfigurationPermission.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/UpdateServiceConfigurationPermission.java
@@ -1,22 +1,22 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.security;
-
-import java.security.BasicPermission;
-
-public class UpdateServiceConfigurationPermission extends BasicPermission {
- private static final long serialVersionUID = 1L;
-
- public UpdateServiceConfigurationPermission() {
- super("services.config.update");
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.security;
+
+import java.security.BasicPermission;
+
+public class UpdateServiceConfigurationPermission extends BasicPermission {
+ private static final long serialVersionUID = 1L;
+
+ public UpdateServiceConfigurationPermission() {
+ super("services.config.update");
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/UpdateUserBookmarkPermission.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/UpdateUserBookmarkPermission.java
index 721d4081ae..d8a6c9cd33 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/UpdateUserBookmarkPermission.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/security/UpdateUserBookmarkPermission.java
@@ -1,22 +1,22 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.security;
-
-import java.security.BasicPermission;
-
-public class UpdateUserBookmarkPermission extends BasicPermission {
- private static final long serialVersionUID = 1L;
-
- public UpdateUserBookmarkPermission() {
- super("bookmark.user.update");
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.security;
+
+import java.security.BasicPermission;
+
+public class UpdateUserBookmarkPermission extends BasicPermission {
+ private static final long serialVersionUID = 1L;
+
+ public UpdateUserBookmarkPermission() {
+ super("bookmark.user.update");
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/bookmark/AbstractPageState.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/bookmark/AbstractPageState.java
index 51d5a7ab5b..16567104c9 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/bookmark/AbstractPageState.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/bookmark/AbstractPageState.java
@@ -1,68 +1,68 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.bookmark;
-
-import java.io.Serializable;
-
-public abstract class AbstractPageState implements Serializable, Cloneable {
- private static final long serialVersionUID = 1L;
-
- private String m_bookmarkIdentifier;
- private String m_pageClassName;
- private String m_label;
- // since 03.07.2009
- private Boolean m_expanded;
-
- protected AbstractPageState() {
- }
-
- protected AbstractPageState(AbstractPageState state) {
- this.m_pageClassName = state.m_pageClassName;
- this.m_bookmarkIdentifier = state.m_bookmarkIdentifier;
- this.m_label = state.m_label;
- }
-
- public String getPageClassName() {
- return m_pageClassName;
- }
-
- public void setPageClassName(String s) {
- m_pageClassName = s;
- }
-
- public String getBookmarkIdentifier() {
- return m_bookmarkIdentifier;
- }
-
- public void setBookmarkIdentifier(String id) {
- m_bookmarkIdentifier = id;
- }
-
- public String getLabel() {
- return m_label;
- }
-
- public void setLabel(String s) {
- m_label = s;
- }
-
- public Boolean isExpanded() {
- return m_expanded;
- }
-
- public void setExpanded(Boolean b) {
- m_expanded = b;
- }
-
- @Override
- public abstract Object clone();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.bookmark;
+
+import java.io.Serializable;
+
+public abstract class AbstractPageState implements Serializable, Cloneable {
+ private static final long serialVersionUID = 1L;
+
+ private String m_bookmarkIdentifier;
+ private String m_pageClassName;
+ private String m_label;
+ // since 03.07.2009
+ private Boolean m_expanded;
+
+ protected AbstractPageState() {
+ }
+
+ protected AbstractPageState(AbstractPageState state) {
+ this.m_pageClassName = state.m_pageClassName;
+ this.m_bookmarkIdentifier = state.m_bookmarkIdentifier;
+ this.m_label = state.m_label;
+ }
+
+ public String getPageClassName() {
+ return m_pageClassName;
+ }
+
+ public void setPageClassName(String s) {
+ m_pageClassName = s;
+ }
+
+ public String getBookmarkIdentifier() {
+ return m_bookmarkIdentifier;
+ }
+
+ public void setBookmarkIdentifier(String id) {
+ m_bookmarkIdentifier = id;
+ }
+
+ public String getLabel() {
+ return m_label;
+ }
+
+ public void setLabel(String s) {
+ m_label = s;
+ }
+
+ public Boolean isExpanded() {
+ return m_expanded;
+ }
+
+ public void setExpanded(Boolean b) {
+ m_expanded = b;
+ }
+
+ @Override
+ public abstract Object clone();
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/bookmark/Bookmark.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/bookmark/Bookmark.java
index 7644f5d604..5c135fff40 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/bookmark/Bookmark.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/bookmark/Bookmark.java
@@ -1,265 +1,265 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.bookmark;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.zip.CRC32;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-
-public class Bookmark implements Serializable, Cloneable {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(Bookmark.class);
- private static final long serialVersionUID = 1L;
-
- /*
- * values for attribute "kind" (these values should not be refactored, since
- * they are also used in databases)
- */
- public static final int USER_BOOKMARK = 1;
- public static final int GLOBAL_BOOKMARK = 2;
-
- public static final String SPOOL_FOLDER_NAME = "[SPOOL]";
- public static final String INBOX_FOLDER_NAME = "[INBOX]";
-
- private long m_id;
- private int m_kind;
- private boolean m_new;
- private String m_title;
- private String m_text;
- private String m_keyStroke;
- private String m_outlineClassName;
- private List<AbstractPageState> m_path;
- private String m_iconId;
- /*
- * cache of serialized object
- */
- private transient byte[] m_serializedData;
-
- public Bookmark() {
- }
-
- public Bookmark(Bookmark bm) {
- importData(bm);
- }
-
- private void importData(Bookmark bm) {
- this.m_kind = bm.m_kind;
- this.m_title = bm.m_title;
- this.m_text = bm.m_text;
- this.m_iconId = bm.m_iconId;
- this.m_keyStroke = bm.m_keyStroke;
- this.m_outlineClassName = bm.m_outlineClassName;
- if (bm.m_path != null) {
- this.m_path = new ArrayList<AbstractPageState>();
- for (AbstractPageState state : bm.m_path) {
- this.m_path.add((AbstractPageState) state.clone());
- }
- }
- m_serializedData = null;
- }
-
- public String getIconId() {
- return m_iconId;
- }
-
- public void setIconId(String iconid) {
- m_iconId = iconid;
- m_serializedData = null;
- }
-
- public long getId() {
- return m_id;
- }
-
- public void setId(long id) {
- m_id = id;
- }
-
- public int getKind() {
- return m_kind;
- }
-
- public void setKind(int kind) {
- switch (kind) {
- case USER_BOOKMARK:
- case GLOBAL_BOOKMARK: {
- break;
- }
- default: {
- throw new IllegalArgumentException("invalid kind: " + kind);
- }
- }
- m_kind = kind;
- m_serializedData = null;
- }
-
- public String getTitle() {
- return m_title;
- }
-
- public void setTitle(String s) {
- m_title = s;
- m_serializedData = null;
- }
-
- public String getText() {
- return m_text;
- }
-
- public void setText(String s) {
- m_text = s;
- m_serializedData = null;
- }
-
- public String getKeyStroke() {
- return m_keyStroke;
- }
-
- public void setKeyStroke(String s) {
- m_keyStroke = s;
- m_serializedData = null;
- }
-
- public boolean isNew() {
- return m_new;
- }
-
- public void setNew(boolean bookmarkIsUnread) {
- m_new = bookmarkIsUnread;
- }
-
- public String getOutlineClassName() {
- return m_outlineClassName;
- }
-
- public void setOutlineClassName(String s) {
- m_outlineClassName = s;
- m_serializedData = null;
- }
-
- public List<AbstractPageState> getPath() {
- if (m_path == null) {
- return Collections.emptyList();
- }
- else {
- return Collections.unmodifiableList(m_path);
- }
- }
-
- public void addPathElement(AbstractPageState state) {
- if (m_path == null) {
- m_path = new ArrayList<AbstractPageState>();
- }
- m_path.add(state);
- m_serializedData = null;
- }
-
- public byte[] getSerializedData() throws ProcessingException {
- if (m_serializedData == null) {
- ObjectOutputStream oout = null;
- try {
- ByteArrayOutputStream bout = new ByteArrayOutputStream();
- oout = new ObjectOutputStream(bout);
- oout.writeObject(this);
- oout.close();
- oout = null;
- m_serializedData = bout.toByteArray();
- }
- catch (IOException e) {
- throw new ProcessingException("title: " + getTitle(), e);
- }
- finally {
- if (oout != null) {
- try {
- oout.close();
- }
- catch (Throwable t) {
- }
- }
- }
- }
- return m_serializedData;
- }
-
- public void setSerializedData(byte[] data) throws ProcessingException {
- ObjectInputStream oin = null;
- try {
- ByteArrayInputStream bin = new ByteArrayInputStream(data);
- oin = new ObjectInputStream(bin);
- Bookmark bm = (Bookmark) oin.readObject();
- importData(bm);
- }
- catch (IOException e) {
- throw new ProcessingException("title: " + getTitle(), e);
- }
- catch (ClassNotFoundException e) {
- throw new ProcessingException("title: " + getTitle(), e);
- }
- finally {
- if (oin != null) {
- try {
- oin.close();
- }
- catch (Throwable t) {
- }
- }
- }
- m_serializedData = data;
- }
-
- @Override
- public Object clone() {
- return new Bookmark(this);
- }
-
- private long getCRC() {
- CRC32 crc = new CRC32();
- try {
- byte[] a = getSerializedData();
- if (a != null) {
- crc.update(a);
- }
- }
- catch (ProcessingException e) {
- LOG.warn(null, e);
- }
- return crc.getValue();
- }
-
- @Override
- public int hashCode() {
- return 0;
- }
-
- @Override
- public boolean equals(Object o) {
- if (o instanceof Bookmark) {
- Bookmark other = (Bookmark) o;
- return this.getCRC() == other.getCRC();
- }
- return false;
- }
-
- @Override
- public String toString() {
- return "Bookmark[title=" + getTitle() + ", id=" + getId() + ", kind=" + (getKind() == Bookmark.GLOBAL_BOOKMARK ? "Global" : "User") + "]";
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.bookmark;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.zip.CRC32;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+
+public class Bookmark implements Serializable, Cloneable {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(Bookmark.class);
+ private static final long serialVersionUID = 1L;
+
+ /*
+ * values for attribute "kind" (these values should not be refactored, since
+ * they are also used in databases)
+ */
+ public static final int USER_BOOKMARK = 1;
+ public static final int GLOBAL_BOOKMARK = 2;
+
+ public static final String SPOOL_FOLDER_NAME = "[SPOOL]";
+ public static final String INBOX_FOLDER_NAME = "[INBOX]";
+
+ private long m_id;
+ private int m_kind;
+ private boolean m_new;
+ private String m_title;
+ private String m_text;
+ private String m_keyStroke;
+ private String m_outlineClassName;
+ private List<AbstractPageState> m_path;
+ private String m_iconId;
+ /*
+ * cache of serialized object
+ */
+ private transient byte[] m_serializedData;
+
+ public Bookmark() {
+ }
+
+ public Bookmark(Bookmark bm) {
+ importData(bm);
+ }
+
+ private void importData(Bookmark bm) {
+ this.m_kind = bm.m_kind;
+ this.m_title = bm.m_title;
+ this.m_text = bm.m_text;
+ this.m_iconId = bm.m_iconId;
+ this.m_keyStroke = bm.m_keyStroke;
+ this.m_outlineClassName = bm.m_outlineClassName;
+ if (bm.m_path != null) {
+ this.m_path = new ArrayList<AbstractPageState>();
+ for (AbstractPageState state : bm.m_path) {
+ this.m_path.add((AbstractPageState) state.clone());
+ }
+ }
+ m_serializedData = null;
+ }
+
+ public String getIconId() {
+ return m_iconId;
+ }
+
+ public void setIconId(String iconid) {
+ m_iconId = iconid;
+ m_serializedData = null;
+ }
+
+ public long getId() {
+ return m_id;
+ }
+
+ public void setId(long id) {
+ m_id = id;
+ }
+
+ public int getKind() {
+ return m_kind;
+ }
+
+ public void setKind(int kind) {
+ switch (kind) {
+ case USER_BOOKMARK:
+ case GLOBAL_BOOKMARK: {
+ break;
+ }
+ default: {
+ throw new IllegalArgumentException("invalid kind: " + kind);
+ }
+ }
+ m_kind = kind;
+ m_serializedData = null;
+ }
+
+ public String getTitle() {
+ return m_title;
+ }
+
+ public void setTitle(String s) {
+ m_title = s;
+ m_serializedData = null;
+ }
+
+ public String getText() {
+ return m_text;
+ }
+
+ public void setText(String s) {
+ m_text = s;
+ m_serializedData = null;
+ }
+
+ public String getKeyStroke() {
+ return m_keyStroke;
+ }
+
+ public void setKeyStroke(String s) {
+ m_keyStroke = s;
+ m_serializedData = null;
+ }
+
+ public boolean isNew() {
+ return m_new;
+ }
+
+ public void setNew(boolean bookmarkIsUnread) {
+ m_new = bookmarkIsUnread;
+ }
+
+ public String getOutlineClassName() {
+ return m_outlineClassName;
+ }
+
+ public void setOutlineClassName(String s) {
+ m_outlineClassName = s;
+ m_serializedData = null;
+ }
+
+ public List<AbstractPageState> getPath() {
+ if (m_path == null) {
+ return Collections.emptyList();
+ }
+ else {
+ return Collections.unmodifiableList(m_path);
+ }
+ }
+
+ public void addPathElement(AbstractPageState state) {
+ if (m_path == null) {
+ m_path = new ArrayList<AbstractPageState>();
+ }
+ m_path.add(state);
+ m_serializedData = null;
+ }
+
+ public byte[] getSerializedData() throws ProcessingException {
+ if (m_serializedData == null) {
+ ObjectOutputStream oout = null;
+ try {
+ ByteArrayOutputStream bout = new ByteArrayOutputStream();
+ oout = new ObjectOutputStream(bout);
+ oout.writeObject(this);
+ oout.close();
+ oout = null;
+ m_serializedData = bout.toByteArray();
+ }
+ catch (IOException e) {
+ throw new ProcessingException("title: " + getTitle(), e);
+ }
+ finally {
+ if (oout != null) {
+ try {
+ oout.close();
+ }
+ catch (Throwable t) {
+ }
+ }
+ }
+ }
+ return m_serializedData;
+ }
+
+ public void setSerializedData(byte[] data) throws ProcessingException {
+ ObjectInputStream oin = null;
+ try {
+ ByteArrayInputStream bin = new ByteArrayInputStream(data);
+ oin = new ObjectInputStream(bin);
+ Bookmark bm = (Bookmark) oin.readObject();
+ importData(bm);
+ }
+ catch (IOException e) {
+ throw new ProcessingException("title: " + getTitle(), e);
+ }
+ catch (ClassNotFoundException e) {
+ throw new ProcessingException("title: " + getTitle(), e);
+ }
+ finally {
+ if (oin != null) {
+ try {
+ oin.close();
+ }
+ catch (Throwable t) {
+ }
+ }
+ }
+ m_serializedData = data;
+ }
+
+ @Override
+ public Object clone() {
+ return new Bookmark(this);
+ }
+
+ private long getCRC() {
+ CRC32 crc = new CRC32();
+ try {
+ byte[] a = getSerializedData();
+ if (a != null) {
+ crc.update(a);
+ }
+ }
+ catch (ProcessingException e) {
+ LOG.warn(null, e);
+ }
+ return crc.getValue();
+ }
+
+ @Override
+ public int hashCode() {
+ return 0;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o instanceof Bookmark) {
+ Bookmark other = (Bookmark) o;
+ return this.getCRC() == other.getCRC();
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return "Bookmark[title=" + getTitle() + ", id=" + getId() + ", kind=" + (getKind() == Bookmark.GLOBAL_BOOKMARK ? "Global" : "User") + "]";
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/bookmark/BookmarkChangedClientNotification.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/bookmark/BookmarkChangedClientNotification.java
index db26307784..d56f4bdd48 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/bookmark/BookmarkChangedClientNotification.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/bookmark/BookmarkChangedClientNotification.java
@@ -1,26 +1,26 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.bookmark;
-
-import org.eclipse.scout.rt.shared.services.common.clientnotification.AbstractClientNotification;
-import org.eclipse.scout.rt.shared.services.common.clientnotification.IClientNotification;
-
-/**
- *
- */
-public class BookmarkChangedClientNotification extends AbstractClientNotification {
- private static final long serialVersionUID = 1L;
-
- @Override
- public boolean coalesce(IClientNotification existingNotification) {
- return true;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.bookmark;
+
+import org.eclipse.scout.rt.shared.services.common.clientnotification.AbstractClientNotification;
+import org.eclipse.scout.rt.shared.services.common.clientnotification.IClientNotification;
+
+/**
+ *
+ */
+public class BookmarkChangedClientNotification extends AbstractClientNotification {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public boolean coalesce(IClientNotification existingNotification) {
+ return true;
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/bookmark/BookmarkData.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/bookmark/BookmarkData.java
index 9a5731ef1c..bdb79f9dd5 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/bookmark/BookmarkData.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/bookmark/BookmarkData.java
@@ -1,71 +1,71 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.bookmark;
-
-import java.io.Serializable;
-
-import org.eclipse.scout.rt.shared.ScoutTexts;
-
-public class BookmarkData implements Serializable, Cloneable {
- private static final long serialVersionUID = 1L;
-
- private BookmarkFolder m_globalBookmarks;
- private BookmarkFolder m_userBookmarks;
-
- public BookmarkData() {
- m_globalBookmarks = new BookmarkFolder();
- m_globalBookmarks.setTitle(ScoutTexts.get("GlobalBookmarks"));
- m_userBookmarks = new BookmarkFolder();
- m_userBookmarks.setTitle(ScoutTexts.get("Bookmarks"));
- }
-
- /**
- * @return the life folder, changes are immediately reflected on the member list
- */
- public BookmarkFolder getGlobalBookmarks() {
- return m_globalBookmarks;
- }
-
- public void setGlobalBookmarks(BookmarkFolder globalBookmarks) {
- m_globalBookmarks = globalBookmarks;
- if (m_globalBookmarks.getTitle() == null) {
- m_globalBookmarks.setTitle(ScoutTexts.get("GlobalBookmarks"));
- }
- }
-
- /**
- * @return the life folder, changes are immediately reflected on the member list
- */
- public BookmarkFolder getUserBookmarks() {
- return m_userBookmarks;
- }
-
- public void setUserBookmarks(BookmarkFolder userBookmarks) {
- m_userBookmarks = userBookmarks;
- if (m_userBookmarks.getTitle() == null) {
- m_userBookmarks.setTitle(ScoutTexts.get("Bookmarks"));
- }
- }
-
- @Override
- public Object clone() {
- try {
- BookmarkData f = (BookmarkData) super.clone();
- //make deep copy of folders
- f.m_globalBookmarks = (BookmarkFolder) m_globalBookmarks.clone();
- f.m_userBookmarks = (BookmarkFolder) m_userBookmarks.clone();
- return f;
- }
- catch (CloneNotSupportedException e) {
- throw new UnsupportedOperationException(e);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.bookmark;
+
+import java.io.Serializable;
+
+import org.eclipse.scout.rt.shared.ScoutTexts;
+
+public class BookmarkData implements Serializable, Cloneable {
+ private static final long serialVersionUID = 1L;
+
+ private BookmarkFolder m_globalBookmarks;
+ private BookmarkFolder m_userBookmarks;
+
+ public BookmarkData() {
+ m_globalBookmarks = new BookmarkFolder();
+ m_globalBookmarks.setTitle(ScoutTexts.get("GlobalBookmarks"));
+ m_userBookmarks = new BookmarkFolder();
+ m_userBookmarks.setTitle(ScoutTexts.get("Bookmarks"));
+ }
+
+ /**
+ * @return the life folder, changes are immediately reflected on the member list
+ */
+ public BookmarkFolder getGlobalBookmarks() {
+ return m_globalBookmarks;
+ }
+
+ public void setGlobalBookmarks(BookmarkFolder globalBookmarks) {
+ m_globalBookmarks = globalBookmarks;
+ if (m_globalBookmarks.getTitle() == null) {
+ m_globalBookmarks.setTitle(ScoutTexts.get("GlobalBookmarks"));
+ }
+ }
+
+ /**
+ * @return the life folder, changes are immediately reflected on the member list
+ */
+ public BookmarkFolder getUserBookmarks() {
+ return m_userBookmarks;
+ }
+
+ public void setUserBookmarks(BookmarkFolder userBookmarks) {
+ m_userBookmarks = userBookmarks;
+ if (m_userBookmarks.getTitle() == null) {
+ m_userBookmarks.setTitle(ScoutTexts.get("Bookmarks"));
+ }
+ }
+
+ @Override
+ public Object clone() {
+ try {
+ BookmarkData f = (BookmarkData) super.clone();
+ //make deep copy of folders
+ f.m_globalBookmarks = (BookmarkFolder) m_globalBookmarks.clone();
+ f.m_userBookmarks = (BookmarkFolder) m_userBookmarks.clone();
+ return f;
+ }
+ catch (CloneNotSupportedException e) {
+ throw new UnsupportedOperationException(e);
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/bookmark/BookmarkFolder.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/bookmark/BookmarkFolder.java
index ed19670c9b..f296c36c58 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/bookmark/BookmarkFolder.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/bookmark/BookmarkFolder.java
@@ -1,234 +1,234 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.bookmark;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.scout.commons.CompareUtility;
-
-public class BookmarkFolder implements Serializable, Cloneable {
- private static final long serialVersionUID = 1L;
-
- private long m_id;
- private String m_title;
- private String m_iconId;
- private List<BookmarkFolder> m_folders;
- private List<Bookmark> m_bookmarks;
- private Bookmark m_startupBookmark;
-
- public BookmarkFolder() {
- m_folders = new ArrayList<BookmarkFolder>();
- m_bookmarks = new ArrayList<Bookmark>();
- }
-
- public long getId() {
- return m_id;
- }
-
- public void setId(long id) {
- m_id = id;
- }
-
- public String getIconId() {
- return m_iconId;
- }
-
- public void setIconId(String iconid) {
- m_iconId = iconid;
- }
-
- public String getTitle() {
- return m_title;
- }
-
- public void setTitle(String s) {
- m_title = s;
- }
-
- public Bookmark getStartupBookmark() {
- return m_startupBookmark;
- }
-
- public void setStartupBookmark(Bookmark startupBookmark) {
- m_startupBookmark = startupBookmark;
- }
-
- /**
- * Convenience method to add bookmarks from a folder (folder tree)
- * <p>
- * Folders are searched by folder name.
- * <p>
- * Missing folders are created.
- * <p>
- * The bookmarks are added by reference (byReference=true) or use {@link Bookmark#clone()} to create a deep copy
- * (byReference=false).
- */
- public void addBookmarks(BookmarkFolder folder, boolean replaceDuplicates, boolean byReference) {
- if (folder == null) {
- return;
- }
- else {
- for (Bookmark b : folder.getBookmarks()) {
- if (!byReference) {
- b = (Bookmark) b.clone();
- }
- if (replaceDuplicates) {
- Bookmark existingBm = getBookmark(b.getTitle());
- if (existingBm != null) {
- getBookmarks().remove(existingBm);
- }
- }
- getBookmarks().add(b);
- }
- for (BookmarkFolder subFolder : folder.getFolders()) {
- BookmarkFolder existingFolder = getFolder(subFolder.getTitle());
- if (existingFolder == null) {
- if (byReference) {
- existingFolder = subFolder;
- getFolders().add(existingFolder);
- }
- else {
- existingFolder = (BookmarkFolder) subFolder.clone();
- getFolders().add(existingFolder);
- }
- }
- else {
- //recursively add
- existingFolder.addBookmarks(subFolder, replaceDuplicates, byReference);
- }
- }
- }
- }
-
- /**
- * @return the life list of all folders, changes are immediately reflected on the member list
- */
- public List<BookmarkFolder> getFolders() {
- return m_folders;
- }
-
- /**
- * @return the life list of all bookmarks, changes are immediately reflected on the member list
- */
- public List<Bookmark> getBookmarks() {
- return m_bookmarks;
- }
-
- /**
- * @return the first bookmark with the specific title
- */
- public Bookmark getBookmark(String title) {
- for (Bookmark b : getBookmarks()) {
- if (CompareUtility.equals(b.getTitle(), title)) {
- return b;
- }
- }
- return null;
- }
-
- /**
- * @return the first folder with the specific title
- */
- public BookmarkFolder getFolder(String title) {
- for (BookmarkFolder f : getFolders()) {
- if (CompareUtility.equals(f.getTitle(), title)) {
- return f;
- }
- }
- return null;
- }
-
- @Override
- public Object clone() {
- try {
- BookmarkFolder f = (BookmarkFolder) super.clone();
- //make deep copy of lists
- f.m_folders = new ArrayList<BookmarkFolder>();
- for (BookmarkFolder x : this.m_folders) {
- f.m_folders.add((BookmarkFolder) x.clone());
- }
- f.m_bookmarks = new ArrayList<Bookmark>();
- for (Bookmark x : this.m_bookmarks) {
- f.m_bookmarks.add((Bookmark) x.clone());
- }
- return f;
- }
- catch (CloneNotSupportedException e) {
- throw new UnsupportedOperationException(e);
- }
- }
-
- /**
- * visit all bookmarks in this folder and all its sub-folders
- */
- public boolean visit(IBookmarkVisitor v) {
- ArrayList<BookmarkFolder> path = new ArrayList<BookmarkFolder>();
- return visitInternal(v, path);
- }
-
- boolean visitInternal(IBookmarkVisitor v, List<BookmarkFolder> path) {
- boolean result = true;
- try {
- path.add(this);
- //
- result = v.visitFolder(path);
- if (!result) {
- return result;
- }
- for (Bookmark b : new ArrayList<Bookmark>(getBookmarks())) {
- result = v.visitBookmark(path, b);
- if (!result) {
- return result;
- }
- }
- for (BookmarkFolder f : new ArrayList<BookmarkFolder>(getFolders())) {
- result = f.visitInternal(v, path);
- if (!result) {
- return result;
- }
- }
- return result;
- }
- finally {
- path.remove(this);
- }
- }
-
- @Override
- public int hashCode() {
- return 0;
- }
-
- /**
- * Equality is only calculated with regard to the folder. The contained folders and bookmarks are not considered.
- */
- @Override
- public boolean equals(Object o) {
- if (o instanceof BookmarkFolder) {
- BookmarkFolder other = (BookmarkFolder) o;
- if (this.m_id == other.m_id) {
- if (CompareUtility.equals(this.m_title, other.m_title)) {
- if (CompareUtility.equals(this.m_iconId, other.m_iconId)) {
- return true;
- }
- }
- }
- }
- return false;
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName() + " title=" + getTitle() + ", id=" + getId() + "]";
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.bookmark;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.scout.commons.CompareUtility;
+
+public class BookmarkFolder implements Serializable, Cloneable {
+ private static final long serialVersionUID = 1L;
+
+ private long m_id;
+ private String m_title;
+ private String m_iconId;
+ private List<BookmarkFolder> m_folders;
+ private List<Bookmark> m_bookmarks;
+ private Bookmark m_startupBookmark;
+
+ public BookmarkFolder() {
+ m_folders = new ArrayList<BookmarkFolder>();
+ m_bookmarks = new ArrayList<Bookmark>();
+ }
+
+ public long getId() {
+ return m_id;
+ }
+
+ public void setId(long id) {
+ m_id = id;
+ }
+
+ public String getIconId() {
+ return m_iconId;
+ }
+
+ public void setIconId(String iconid) {
+ m_iconId = iconid;
+ }
+
+ public String getTitle() {
+ return m_title;
+ }
+
+ public void setTitle(String s) {
+ m_title = s;
+ }
+
+ public Bookmark getStartupBookmark() {
+ return m_startupBookmark;
+ }
+
+ public void setStartupBookmark(Bookmark startupBookmark) {
+ m_startupBookmark = startupBookmark;
+ }
+
+ /**
+ * Convenience method to add bookmarks from a folder (folder tree)
+ * <p>
+ * Folders are searched by folder name.
+ * <p>
+ * Missing folders are created.
+ * <p>
+ * The bookmarks are added by reference (byReference=true) or use {@link Bookmark#clone()} to create a deep copy
+ * (byReference=false).
+ */
+ public void addBookmarks(BookmarkFolder folder, boolean replaceDuplicates, boolean byReference) {
+ if (folder == null) {
+ return;
+ }
+ else {
+ for (Bookmark b : folder.getBookmarks()) {
+ if (!byReference) {
+ b = (Bookmark) b.clone();
+ }
+ if (replaceDuplicates) {
+ Bookmark existingBm = getBookmark(b.getTitle());
+ if (existingBm != null) {
+ getBookmarks().remove(existingBm);
+ }
+ }
+ getBookmarks().add(b);
+ }
+ for (BookmarkFolder subFolder : folder.getFolders()) {
+ BookmarkFolder existingFolder = getFolder(subFolder.getTitle());
+ if (existingFolder == null) {
+ if (byReference) {
+ existingFolder = subFolder;
+ getFolders().add(existingFolder);
+ }
+ else {
+ existingFolder = (BookmarkFolder) subFolder.clone();
+ getFolders().add(existingFolder);
+ }
+ }
+ else {
+ //recursively add
+ existingFolder.addBookmarks(subFolder, replaceDuplicates, byReference);
+ }
+ }
+ }
+ }
+
+ /**
+ * @return the life list of all folders, changes are immediately reflected on the member list
+ */
+ public List<BookmarkFolder> getFolders() {
+ return m_folders;
+ }
+
+ /**
+ * @return the life list of all bookmarks, changes are immediately reflected on the member list
+ */
+ public List<Bookmark> getBookmarks() {
+ return m_bookmarks;
+ }
+
+ /**
+ * @return the first bookmark with the specific title
+ */
+ public Bookmark getBookmark(String title) {
+ for (Bookmark b : getBookmarks()) {
+ if (CompareUtility.equals(b.getTitle(), title)) {
+ return b;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @return the first folder with the specific title
+ */
+ public BookmarkFolder getFolder(String title) {
+ for (BookmarkFolder f : getFolders()) {
+ if (CompareUtility.equals(f.getTitle(), title)) {
+ return f;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public Object clone() {
+ try {
+ BookmarkFolder f = (BookmarkFolder) super.clone();
+ //make deep copy of lists
+ f.m_folders = new ArrayList<BookmarkFolder>();
+ for (BookmarkFolder x : this.m_folders) {
+ f.m_folders.add((BookmarkFolder) x.clone());
+ }
+ f.m_bookmarks = new ArrayList<Bookmark>();
+ for (Bookmark x : this.m_bookmarks) {
+ f.m_bookmarks.add((Bookmark) x.clone());
+ }
+ return f;
+ }
+ catch (CloneNotSupportedException e) {
+ throw new UnsupportedOperationException(e);
+ }
+ }
+
+ /**
+ * visit all bookmarks in this folder and all its sub-folders
+ */
+ public boolean visit(IBookmarkVisitor v) {
+ ArrayList<BookmarkFolder> path = new ArrayList<BookmarkFolder>();
+ return visitInternal(v, path);
+ }
+
+ boolean visitInternal(IBookmarkVisitor v, List<BookmarkFolder> path) {
+ boolean result = true;
+ try {
+ path.add(this);
+ //
+ result = v.visitFolder(path);
+ if (!result) {
+ return result;
+ }
+ for (Bookmark b : new ArrayList<Bookmark>(getBookmarks())) {
+ result = v.visitBookmark(path, b);
+ if (!result) {
+ return result;
+ }
+ }
+ for (BookmarkFolder f : new ArrayList<BookmarkFolder>(getFolders())) {
+ result = f.visitInternal(v, path);
+ if (!result) {
+ return result;
+ }
+ }
+ return result;
+ }
+ finally {
+ path.remove(this);
+ }
+ }
+
+ @Override
+ public int hashCode() {
+ return 0;
+ }
+
+ /**
+ * Equality is only calculated with regard to the folder. The contained folders and bookmarks are not considered.
+ */
+ @Override
+ public boolean equals(Object o) {
+ if (o instanceof BookmarkFolder) {
+ BookmarkFolder other = (BookmarkFolder) o;
+ if (this.m_id == other.m_id) {
+ if (CompareUtility.equals(this.m_title, other.m_title)) {
+ if (CompareUtility.equals(this.m_iconId, other.m_iconId)) {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + " title=" + getTitle() + ", id=" + getId() + "]";
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/bookmark/IBookmarkStorageService.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/bookmark/IBookmarkStorageService.java
index 56fb0c181c..a3fb842c77 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/bookmark/IBookmarkStorageService.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/bookmark/IBookmarkStorageService.java
@@ -1,56 +1,56 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.bookmark;
-
-import java.util.Map;
-
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.shared.security.PublishUserBookmarkPermission;
-import org.eclipse.scout.rt.shared.validate.InputValidation;
-import org.eclipse.scout.rt.shared.validate.IValidationStrategy;
-import org.eclipse.scout.service.IService;
-
-@Priority(-3)
-@InputValidation(IValidationStrategy.PROCESS.class)
-public interface IBookmarkStorageService extends IService {
-
- /**
- * insert, update or delete bookmarks of the current user (subject) AND global bookmarks <br>
- * check the property {@link Bookmark#getKind()} for switching
- *
- * @return the new complete set of bookmarks with (eventually) updated ids
- */
- BookmarkData storeBookmarkData(BookmarkData data) throws ProcessingException;
-
- /**
- * @return all bookmarks of the current user (subject) AND global bookmarks <br>
- * check the property {@link Bookmark#getKind()} for switching
- */
- BookmarkData getBookmarkData() throws ProcessingException;
-
- /**
- * copy the bookmarks contained in the folder to the {@value #INBOX_FOLDER_NAME} folder of the users
- * {@link BookmarkData#getUserBookmarks()}, {@link PublishUserBookmarkPermission}
- * <p>
- * Bookmarks are published to the {@link Bookmark#SPOOL_FOLDER_NAME} folder. Once the bookmarks are retrieved by the
- * user, that folder is copied into {@link Bookmark#INBOX_FOLDER_NAME} and the spool folder is cleared.
- *
- * @param publishFolder
- * @param targetGroup
- * is a map that contains for example userId=scott or something like ou=eclipse.org,
- * department=dev
- * It is up to the implementation to define and handle the target group parameter
- */
- @InputValidation(IValidationStrategy.NO_CHECK.class)
- void publishBookmarkData(BookmarkFolder publishFolder, Map<String, Object> targetGroup) throws ProcessingException;
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.bookmark;
+
+import java.util.Map;
+
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.shared.security.PublishUserBookmarkPermission;
+import org.eclipse.scout.rt.shared.validate.InputValidation;
+import org.eclipse.scout.rt.shared.validate.IValidationStrategy;
+import org.eclipse.scout.service.IService;
+
+@Priority(-3)
+@InputValidation(IValidationStrategy.PROCESS.class)
+public interface IBookmarkStorageService extends IService {
+
+ /**
+ * insert, update or delete bookmarks of the current user (subject) AND global bookmarks <br>
+ * check the property {@link Bookmark#getKind()} for switching
+ *
+ * @return the new complete set of bookmarks with (eventually) updated ids
+ */
+ BookmarkData storeBookmarkData(BookmarkData data) throws ProcessingException;
+
+ /**
+ * @return all bookmarks of the current user (subject) AND global bookmarks <br>
+ * check the property {@link Bookmark#getKind()} for switching
+ */
+ BookmarkData getBookmarkData() throws ProcessingException;
+
+ /**
+ * copy the bookmarks contained in the folder to the {@value #INBOX_FOLDER_NAME} folder of the users
+ * {@link BookmarkData#getUserBookmarks()}, {@link PublishUserBookmarkPermission}
+ * <p>
+ * Bookmarks are published to the {@link Bookmark#SPOOL_FOLDER_NAME} folder. Once the bookmarks are retrieved by the
+ * user, that folder is copied into {@link Bookmark#INBOX_FOLDER_NAME} and the spool folder is cleared.
+ *
+ * @param publishFolder
+ * @param targetGroup
+ * is a map that contains for example userId=scott or something like ou=eclipse.org,
+ * department=dev
+ * It is up to the implementation to define and handle the target group parameter
+ */
+ @InputValidation(IValidationStrategy.NO_CHECK.class)
+ void publishBookmarkData(BookmarkFolder publishFolder, Map<String, Object> targetGroup) throws ProcessingException;
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/bookmark/IBookmarkVisitor.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/bookmark/IBookmarkVisitor.java
index 3f97775888..6c2bbaebe1 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/bookmark/IBookmarkVisitor.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/bookmark/IBookmarkVisitor.java
@@ -1,28 +1,28 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.bookmark;
-
-import java.util.List;
-
-/**
- * Visitor to visit all bookmarks recursively inside a folder.
- */
-public interface IBookmarkVisitor {
- /**
- * @return true to continue visiting, false to cancel
- */
- boolean visitFolder(List<BookmarkFolder> path);
-
- /**
- * @return true to continue visiting, false to cancel
- */
- boolean visitBookmark(List<BookmarkFolder> path, Bookmark b);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.bookmark;
+
+import java.util.List;
+
+/**
+ * Visitor to visit all bookmarks recursively inside a folder.
+ */
+public interface IBookmarkVisitor {
+ /**
+ * @return true to continue visiting, false to cancel
+ */
+ boolean visitFolder(List<BookmarkFolder> path);
+
+ /**
+ * @return true to continue visiting, false to cancel
+ */
+ boolean visitBookmark(List<BookmarkFolder> path, Bookmark b);
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/bookmark/NodePageState.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/bookmark/NodePageState.java
index 1c70c2c6cb..41a80d7a31 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/bookmark/NodePageState.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/bookmark/NodePageState.java
@@ -1,30 +1,30 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.bookmark;
-
-import java.io.Serializable;
-
-public class NodePageState extends AbstractPageState implements Serializable, Cloneable {
- private static final long serialVersionUID = 1L;
-
- public NodePageState() {
- }
-
- protected NodePageState(NodePageState state) {
- super(state);
- }
-
- @Override
- public Object clone() {
- return new NodePageState(this);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.bookmark;
+
+import java.io.Serializable;
+
+public class NodePageState extends AbstractPageState implements Serializable, Cloneable {
+ private static final long serialVersionUID = 1L;
+
+ public NodePageState() {
+ }
+
+ protected NodePageState(NodePageState state) {
+ super(state);
+ }
+
+ @Override
+ public Object clone() {
+ return new NodePageState(this);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/bookmark/TableColumnState.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/bookmark/TableColumnState.java
index 5cbbb28410..4f57974b1f 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/bookmark/TableColumnState.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/bookmark/TableColumnState.java
@@ -1,100 +1,100 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.bookmark;
-
-import java.io.Serializable;
-
-public class TableColumnState implements Serializable, Cloneable {
- private static final long serialVersionUID = 1L;
-
- private String m_className;
- private int m_width;
- private int m_sortOrder = -1;
- private boolean m_sortAscending;
- private Boolean m_displayable;
- private Boolean m_visible;
- private byte[] m_columnFilterData;
-
- public TableColumnState() {
- }
-
- protected TableColumnState(TableColumnState state) {
- this.m_className = state.m_className;
- this.m_width = state.m_width;
- this.m_sortOrder = state.m_sortOrder;
- this.m_sortAscending = state.m_sortAscending;
- this.m_displayable = state.m_displayable;
- this.m_visible = state.m_visible;
- this.m_columnFilterData = state.m_columnFilterData;
- }
-
- public String getClassName() {
- return m_className;
- }
-
- public void setColumnClassName(String name) {
- m_className = name;
- }
-
- public int getWidth() {
- return m_width;
- }
-
- public void setWidth(int i) {
- m_width = i;
- }
-
- public int getSortOrder() {
- return m_sortOrder;
- }
-
- public void setSortOrder(int i) {
- m_sortOrder = i;
- }
-
- public boolean isSortAscending() {
- return m_sortAscending;
- }
-
- public void setSortAscending(boolean b) {
- m_sortAscending = b;
- }
-
- public Boolean getDisplayable() {
- return m_displayable;
- }
-
- public void setDisplayable(Boolean displayable) {
- m_displayable = displayable;
- }
-
- public Boolean getVisible() {
- return m_visible;
- }
-
- public void setVisible(Boolean visible) {
- m_visible = visible;
- }
-
- @Override
- public Object clone() {
- return new TableColumnState(this);
- }
-
- public byte[] getColumnFilterData() {
- return m_columnFilterData;
- }
-
- public void setColumnFilterData(byte[] columnFilterData) {
- m_columnFilterData = columnFilterData;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.bookmark;
+
+import java.io.Serializable;
+
+public class TableColumnState implements Serializable, Cloneable {
+ private static final long serialVersionUID = 1L;
+
+ private String m_className;
+ private int m_width;
+ private int m_sortOrder = -1;
+ private boolean m_sortAscending;
+ private Boolean m_displayable;
+ private Boolean m_visible;
+ private byte[] m_columnFilterData;
+
+ public TableColumnState() {
+ }
+
+ protected TableColumnState(TableColumnState state) {
+ this.m_className = state.m_className;
+ this.m_width = state.m_width;
+ this.m_sortOrder = state.m_sortOrder;
+ this.m_sortAscending = state.m_sortAscending;
+ this.m_displayable = state.m_displayable;
+ this.m_visible = state.m_visible;
+ this.m_columnFilterData = state.m_columnFilterData;
+ }
+
+ public String getClassName() {
+ return m_className;
+ }
+
+ public void setColumnClassName(String name) {
+ m_className = name;
+ }
+
+ public int getWidth() {
+ return m_width;
+ }
+
+ public void setWidth(int i) {
+ m_width = i;
+ }
+
+ public int getSortOrder() {
+ return m_sortOrder;
+ }
+
+ public void setSortOrder(int i) {
+ m_sortOrder = i;
+ }
+
+ public boolean isSortAscending() {
+ return m_sortAscending;
+ }
+
+ public void setSortAscending(boolean b) {
+ m_sortAscending = b;
+ }
+
+ public Boolean getDisplayable() {
+ return m_displayable;
+ }
+
+ public void setDisplayable(Boolean displayable) {
+ m_displayable = displayable;
+ }
+
+ public Boolean getVisible() {
+ return m_visible;
+ }
+
+ public void setVisible(Boolean visible) {
+ m_visible = visible;
+ }
+
+ @Override
+ public Object clone() {
+ return new TableColumnState(this);
+ }
+
+ public byte[] getColumnFilterData() {
+ return m_columnFilterData;
+ }
+
+ public void setColumnFilterData(byte[] columnFilterData) {
+ m_columnFilterData = columnFilterData;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/bookmark/TablePageState.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/bookmark/TablePageState.java
index 40806321fe..92395f6346 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/bookmark/TablePageState.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/bookmark/TablePageState.java
@@ -1,185 +1,185 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.bookmark;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.scout.commons.CompositeObject;
-
-public class TablePageState extends AbstractPageState implements Serializable, Cloneable {
- private static final long serialVersionUID = 1L;
-
- private CompositeObject m_expandedChildPrimaryKey;
- private List<CompositeObject> m_selectedChildrenPrimaryKeys;
- private String m_searchFormState;
- private boolean m_searchFilterComplete;
- private String m_searchFilterState;
- private byte[] m_tableCustomizerData;
- /**
- * legacy, replaced by m_availableColumns
- */
- private List<TableColumnState> m_visibleColumns;
- /**
- * available columns at point in time when bookmark was created
- */
- private List<TableColumnState> m_availableColumns;
-
- public TablePageState() {
- }
-
- protected TablePageState(TablePageState state) {
- super(state);
- if (state.m_selectedChildrenPrimaryKeys != null) {
- this.m_selectedChildrenPrimaryKeys = new ArrayList<CompositeObject>(state.m_selectedChildrenPrimaryKeys);
- }
- this.m_expandedChildPrimaryKey = state.m_expandedChildPrimaryKey;
- this.m_searchFormState = state.m_searchFormState;
- this.m_searchFilterState = state.m_searchFilterState;
- this.m_searchFilterComplete = state.m_searchFilterComplete;
- this.m_tableCustomizerData = state.m_tableCustomizerData;
- if (state.m_visibleColumns != null) {
- this.m_visibleColumns = new ArrayList<TableColumnState>();
- for (TableColumnState col : state.m_visibleColumns) {
- this.m_visibleColumns.add(new TableColumnState(col));
- }
- }
- if (state.m_availableColumns != null) {
- this.m_availableColumns = new ArrayList<TableColumnState>();
- for (TableColumnState col : state.m_availableColumns) {
- this.m_availableColumns.add(new TableColumnState(col));
- }
- }
- }
-
- public List<CompositeObject> getSelectedChildrenPrimaryKeys() {
- if (m_selectedChildrenPrimaryKeys == null) {
- return Collections.emptyList();
- }
- else {
- return Collections.unmodifiableList(m_selectedChildrenPrimaryKeys);
- }
- }
-
- public void setSelectedChildrenPrimaryKeys(List<CompositeObject> list) {
- if (list == null) {
- m_selectedChildrenPrimaryKeys = null;
- }
- else {
- m_selectedChildrenPrimaryKeys = new ArrayList<CompositeObject>(list);
- }
- }
-
- public CompositeObject getExpandedChildPrimaryKey() {
- return m_expandedChildPrimaryKey;
- }
-
- public void setExpandedChildPrimaryKey(CompositeObject pk) {
- m_expandedChildPrimaryKey = pk;
- }
-
- /**
- * @return xml of form content {@link org.eclipse.scout.rt.client.ui.form.IForm#setXML(String)}
- */
- public String getSearchFormState() {
- return m_searchFormState;
- }
-
- /**
- * set xml of form content {@link org.eclipse.scout.rt.client.ui.form.IForm#setXML(String)}
- */
- public void setSearchFormState(String xml) {
- m_searchFormState = xml;
- }
-
- public boolean isSearchFilterComplete() {
- return m_searchFilterComplete;
- }
-
- /**
- * @return CRC of serialized search filter data
- */
- public String getSearchFilterState() {
- return m_searchFilterState;
- }
-
- /**
- * @param complete
- * if search was completed (i.e. is valid and can be run)
- * @param state
- * CRC of serialized search filter data
- */
- public void setSearchFilterState(boolean complete, String state) {
- m_searchFilterComplete = complete;
- m_searchFilterState = state;
- }
-
- /**
- * @deprecated use {@link #getAvailableColumns()} and filter by visible property
- */
- @SuppressWarnings("unchecked")
- @Deprecated
- public List<TableColumnState> getVisibleColumns() {
- return Collections.unmodifiableList(m_visibleColumns != null ? m_visibleColumns : Collections.EMPTY_LIST);
- }
-
- /**
- * @deprecated use {@link #setAvailableColumns()} and set all available columns (with sort index, dispayable, visible
- * and width property), not just the visible ones
- */
- @Deprecated
- public void setVisibleColumns(List<TableColumnState> cols) {
- if (cols == null) {
- m_visibleColumns = null;
- }
- else {
- m_visibleColumns = new ArrayList<TableColumnState>(cols);
- }
- }
-
- @SuppressWarnings("unchecked")
- public List<TableColumnState> getAvailableColumns() {
- return Collections.unmodifiableList(m_availableColumns != null ? m_availableColumns : Collections.EMPTY_LIST);
- }
-
- public void setAvailableColumns(List<TableColumnState> cols) {
- m_visibleColumns = null;
- if (cols == null) {
- m_availableColumns = null;
- }
- else {
- m_availableColumns = new ArrayList<TableColumnState>(cols);
- }
- }
-
- /**
- * @return serialized TableCustomizer data
- */
- public byte[] getTableCustomizerData() {
- return m_tableCustomizerData;
- }
-
- /**
- * @param tableCustomizer
- * serialized TableCustomizer data for persistent storage with bookmark
- */
- public void setTableCustomizerData(byte[] tableCustomizer) {
- m_tableCustomizerData = tableCustomizer;
- }
-
- @Override
- public Object clone() {
- return new TablePageState(this);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.bookmark;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.scout.commons.CompositeObject;
+
+public class TablePageState extends AbstractPageState implements Serializable, Cloneable {
+ private static final long serialVersionUID = 1L;
+
+ private CompositeObject m_expandedChildPrimaryKey;
+ private List<CompositeObject> m_selectedChildrenPrimaryKeys;
+ private String m_searchFormState;
+ private boolean m_searchFilterComplete;
+ private String m_searchFilterState;
+ private byte[] m_tableCustomizerData;
+ /**
+ * legacy, replaced by m_availableColumns
+ */
+ private List<TableColumnState> m_visibleColumns;
+ /**
+ * available columns at point in time when bookmark was created
+ */
+ private List<TableColumnState> m_availableColumns;
+
+ public TablePageState() {
+ }
+
+ protected TablePageState(TablePageState state) {
+ super(state);
+ if (state.m_selectedChildrenPrimaryKeys != null) {
+ this.m_selectedChildrenPrimaryKeys = new ArrayList<CompositeObject>(state.m_selectedChildrenPrimaryKeys);
+ }
+ this.m_expandedChildPrimaryKey = state.m_expandedChildPrimaryKey;
+ this.m_searchFormState = state.m_searchFormState;
+ this.m_searchFilterState = state.m_searchFilterState;
+ this.m_searchFilterComplete = state.m_searchFilterComplete;
+ this.m_tableCustomizerData = state.m_tableCustomizerData;
+ if (state.m_visibleColumns != null) {
+ this.m_visibleColumns = new ArrayList<TableColumnState>();
+ for (TableColumnState col : state.m_visibleColumns) {
+ this.m_visibleColumns.add(new TableColumnState(col));
+ }
+ }
+ if (state.m_availableColumns != null) {
+ this.m_availableColumns = new ArrayList<TableColumnState>();
+ for (TableColumnState col : state.m_availableColumns) {
+ this.m_availableColumns.add(new TableColumnState(col));
+ }
+ }
+ }
+
+ public List<CompositeObject> getSelectedChildrenPrimaryKeys() {
+ if (m_selectedChildrenPrimaryKeys == null) {
+ return Collections.emptyList();
+ }
+ else {
+ return Collections.unmodifiableList(m_selectedChildrenPrimaryKeys);
+ }
+ }
+
+ public void setSelectedChildrenPrimaryKeys(List<CompositeObject> list) {
+ if (list == null) {
+ m_selectedChildrenPrimaryKeys = null;
+ }
+ else {
+ m_selectedChildrenPrimaryKeys = new ArrayList<CompositeObject>(list);
+ }
+ }
+
+ public CompositeObject getExpandedChildPrimaryKey() {
+ return m_expandedChildPrimaryKey;
+ }
+
+ public void setExpandedChildPrimaryKey(CompositeObject pk) {
+ m_expandedChildPrimaryKey = pk;
+ }
+
+ /**
+ * @return xml of form content {@link org.eclipse.scout.rt.client.ui.form.IForm#setXML(String)}
+ */
+ public String getSearchFormState() {
+ return m_searchFormState;
+ }
+
+ /**
+ * set xml of form content {@link org.eclipse.scout.rt.client.ui.form.IForm#setXML(String)}
+ */
+ public void setSearchFormState(String xml) {
+ m_searchFormState = xml;
+ }
+
+ public boolean isSearchFilterComplete() {
+ return m_searchFilterComplete;
+ }
+
+ /**
+ * @return CRC of serialized search filter data
+ */
+ public String getSearchFilterState() {
+ return m_searchFilterState;
+ }
+
+ /**
+ * @param complete
+ * if search was completed (i.e. is valid and can be run)
+ * @param state
+ * CRC of serialized search filter data
+ */
+ public void setSearchFilterState(boolean complete, String state) {
+ m_searchFilterComplete = complete;
+ m_searchFilterState = state;
+ }
+
+ /**
+ * @deprecated use {@link #getAvailableColumns()} and filter by visible property
+ */
+ @SuppressWarnings("unchecked")
+ @Deprecated
+ public List<TableColumnState> getVisibleColumns() {
+ return Collections.unmodifiableList(m_visibleColumns != null ? m_visibleColumns : Collections.EMPTY_LIST);
+ }
+
+ /**
+ * @deprecated use {@link #setAvailableColumns()} and set all available columns (with sort index, dispayable, visible
+ * and width property), not just the visible ones
+ */
+ @Deprecated
+ public void setVisibleColumns(List<TableColumnState> cols) {
+ if (cols == null) {
+ m_visibleColumns = null;
+ }
+ else {
+ m_visibleColumns = new ArrayList<TableColumnState>(cols);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public List<TableColumnState> getAvailableColumns() {
+ return Collections.unmodifiableList(m_availableColumns != null ? m_availableColumns : Collections.EMPTY_LIST);
+ }
+
+ public void setAvailableColumns(List<TableColumnState> cols) {
+ m_visibleColumns = null;
+ if (cols == null) {
+ m_availableColumns = null;
+ }
+ else {
+ m_availableColumns = new ArrayList<TableColumnState>(cols);
+ }
+ }
+
+ /**
+ * @return serialized TableCustomizer data
+ */
+ public byte[] getTableCustomizerData() {
+ return m_tableCustomizerData;
+ }
+
+ /**
+ * @param tableCustomizer
+ * serialized TableCustomizer data for persistent storage with bookmark
+ */
+ public void setTableCustomizerData(byte[] tableCustomizer) {
+ m_tableCustomizerData = tableCustomizer;
+ }
+
+ @Override
+ public Object clone() {
+ return new TablePageState(this);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/AbstractCalendarItem.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/AbstractCalendarItem.java
index 5f9250a78c..0321349ee5 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/AbstractCalendarItem.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/AbstractCalendarItem.java
@@ -1,177 +1,177 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.calendar;
-
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.HashMap;
-import java.util.Map;
-
-public abstract class AbstractCalendarItem implements ICalendarItem, java.io.Serializable {
- private static final long serialVersionUID = 1L;
-
- public static final DateFormat getDumpDateFormat() {
- return new SimpleDateFormat("dd.MM.yy HH:mm:ss");
- }
-
- public static final DateFormat getExchangeableDateFormat() {
- return new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
- }
-
- private boolean m_exists = true;
- private long m_lastModified;
- private long m_id;
- private String m_owner;
- private String m_subject;
- private String m_body;
- private String m_color;
- private RecurrencePattern m_recurrencyPattern;
-
- public AbstractCalendarItem() {
- }
-
- public AbstractCalendarItem(long id) {
- m_id = id;
- }
-
- public ICalendarItem copy() {
- Class<? extends ICalendarItem> c = getClass();
- try {
- AbstractCalendarItem a = (AbstractCalendarItem) c.newInstance();
- a.m_exists = this.m_exists;
- a.m_lastModified = this.m_lastModified;
- a.m_id = this.m_id;
- a.m_owner = this.m_owner;
- a.m_subject = this.m_subject;
- a.m_body = this.m_body;
- a.m_color = this.m_color;
- a.m_recurrencyPattern = this.m_recurrencyPattern;
- return a;
- }
- catch (Exception e) {
- throw new IllegalArgumentException(e);
- }
- }
-
- @Override
- public String getColor() {
- return m_color;
- }
-
- @Override
- public void setColor(String hex) {
- m_color = hex;
- }
-
- @Override
- public boolean exists() {
- return m_exists;
- }
-
- @Override
- public void delete() {
- m_exists = false;
- }
-
- @Override
- public long getLastModified() {
- return m_lastModified;
- }
-
- @Override
- public void setLastModified(long b) {
- m_lastModified = b;
- }
-
- @Override
- public long getId() {
- return m_id;
- }
-
- @Override
- public void setId(long newId) {
- m_id = newId;
- }
-
- @Override
- public String getOwner() {
- return m_owner;
- }
-
- @Override
- public void setOwner(String a) {
- m_owner = a;
- }
-
- @Override
- public String getSubject() {
- return m_subject;
- }
-
- @Override
- public void setSubject(String a) {
- m_subject = a;
- }
-
- @Override
- public String getBody() {
- return m_body;
- }
-
- @Override
- public void setBody(String a) {
- m_body = a;
- }
-
- @Override
- public RecurrencePattern getRecurrencePattern() {
- return m_recurrencyPattern;
- }
-
- @Override
- public void setRecurrencePattern(RecurrencePattern p) {
- m_recurrencyPattern = p;
- }
-
- protected void dumpState(Map<String, Object> attributes) {
- attributes.put("exists", m_exists);
- attributes.put("lastModified", getDumpDateFormat().format(m_lastModified));
- attributes.put("id", m_id);
- attributes.put("owner", m_owner);
- attributes.put("subject", m_subject);
- if (m_body != null) {
- attributes.put("body", m_body.replace('\n', ' ').replace('\r', ' ').substring(0, Math.min(200, m_body.length())));
- }
- attributes.put("recurrencyPattern", m_recurrencyPattern);
- }
-
- @Override
- public String toString() {
- StringBuilder b = new StringBuilder();
- b.append(getClass().getSimpleName());
- b.append("[");
- HashMap<String, Object> attributes = new HashMap<String, Object>();
- dumpState(attributes);
- int count = 0;
- for (Map.Entry<String, Object> e : attributes.entrySet()) {
- if (e.getValue() != null) {
- if (count > 0) {
- b.append(", ");
- }
- b.append(e.getKey() + "=" + e.getValue());
- count++;
- }
- }
- b.append("]");
- return b.toString();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.calendar;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.HashMap;
+import java.util.Map;
+
+public abstract class AbstractCalendarItem implements ICalendarItem, java.io.Serializable {
+ private static final long serialVersionUID = 1L;
+
+ public static final DateFormat getDumpDateFormat() {
+ return new SimpleDateFormat("dd.MM.yy HH:mm:ss");
+ }
+
+ public static final DateFormat getExchangeableDateFormat() {
+ return new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
+ }
+
+ private boolean m_exists = true;
+ private long m_lastModified;
+ private long m_id;
+ private String m_owner;
+ private String m_subject;
+ private String m_body;
+ private String m_color;
+ private RecurrencePattern m_recurrencyPattern;
+
+ public AbstractCalendarItem() {
+ }
+
+ public AbstractCalendarItem(long id) {
+ m_id = id;
+ }
+
+ public ICalendarItem copy() {
+ Class<? extends ICalendarItem> c = getClass();
+ try {
+ AbstractCalendarItem a = (AbstractCalendarItem) c.newInstance();
+ a.m_exists = this.m_exists;
+ a.m_lastModified = this.m_lastModified;
+ a.m_id = this.m_id;
+ a.m_owner = this.m_owner;
+ a.m_subject = this.m_subject;
+ a.m_body = this.m_body;
+ a.m_color = this.m_color;
+ a.m_recurrencyPattern = this.m_recurrencyPattern;
+ return a;
+ }
+ catch (Exception e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ @Override
+ public String getColor() {
+ return m_color;
+ }
+
+ @Override
+ public void setColor(String hex) {
+ m_color = hex;
+ }
+
+ @Override
+ public boolean exists() {
+ return m_exists;
+ }
+
+ @Override
+ public void delete() {
+ m_exists = false;
+ }
+
+ @Override
+ public long getLastModified() {
+ return m_lastModified;
+ }
+
+ @Override
+ public void setLastModified(long b) {
+ m_lastModified = b;
+ }
+
+ @Override
+ public long getId() {
+ return m_id;
+ }
+
+ @Override
+ public void setId(long newId) {
+ m_id = newId;
+ }
+
+ @Override
+ public String getOwner() {
+ return m_owner;
+ }
+
+ @Override
+ public void setOwner(String a) {
+ m_owner = a;
+ }
+
+ @Override
+ public String getSubject() {
+ return m_subject;
+ }
+
+ @Override
+ public void setSubject(String a) {
+ m_subject = a;
+ }
+
+ @Override
+ public String getBody() {
+ return m_body;
+ }
+
+ @Override
+ public void setBody(String a) {
+ m_body = a;
+ }
+
+ @Override
+ public RecurrencePattern getRecurrencePattern() {
+ return m_recurrencyPattern;
+ }
+
+ @Override
+ public void setRecurrencePattern(RecurrencePattern p) {
+ m_recurrencyPattern = p;
+ }
+
+ protected void dumpState(Map<String, Object> attributes) {
+ attributes.put("exists", m_exists);
+ attributes.put("lastModified", getDumpDateFormat().format(m_lastModified));
+ attributes.put("id", m_id);
+ attributes.put("owner", m_owner);
+ attributes.put("subject", m_subject);
+ if (m_body != null) {
+ attributes.put("body", m_body.replace('\n', ' ').replace('\r', ' ').substring(0, Math.min(200, m_body.length())));
+ }
+ attributes.put("recurrencyPattern", m_recurrencyPattern);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder b = new StringBuilder();
+ b.append(getClass().getSimpleName());
+ b.append("[");
+ HashMap<String, Object> attributes = new HashMap<String, Object>();
+ dumpState(attributes);
+ int count = 0;
+ for (Map.Entry<String, Object> e : attributes.entrySet()) {
+ if (e.getValue() != null) {
+ if (count > 0) {
+ b.append(", ");
+ }
+ b.append(e.getKey() + "=" + e.getValue());
+ count++;
+ }
+ }
+ b.append("]");
+ return b.toString();
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/CalendarAppointment.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/CalendarAppointment.java
index b5d18ab465..d50ec38005 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/CalendarAppointment.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/CalendarAppointment.java
@@ -1,232 +1,232 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.calendar;
-
-import java.io.Serializable;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.Map;
-
-import org.eclipse.scout.commons.DateUtility;
-import org.eclipse.scout.commons.TypeCastUtility;
-
-public class CalendarAppointment extends AbstractCalendarItem implements ICalendarAppointment, Serializable {
- private static final long serialVersionUID = 1L;
- //
- private Long m_personId;
- private Date m_start;
- private Date m_end;
- private boolean m_fullDay;
- private String m_location;
- private int m_busyStatus;
- private HashSet<String> m_recipientEmail = new HashSet<String>();
- private Serializable m_externalKey;
-
- public CalendarAppointment() {
- super();
- }
-
- /**
- * @param id
- * @param personId
- * @param startDate
- * @param endDate
- * @param fullDay
- * @param subject
- * @param body
- * @param color
- */
- public CalendarAppointment(long id, Long personId, Date startDate, Date endDate, boolean fullDay, String subject, String body, String color) {
- setId(id);
- setPersonId(personId);
- setStart(startDate);
- setEnd(endDate);
- setFullDay(fullDay);
- setSubject(subject);
- setBody(body);
- setColor(color);
- }
-
- /**
- * @param id
- * @param personId
- * @param startDate
- * @param endDate
- * @param fullDay
- * @param subject
- * @param body
- * @param color
- */
- public CalendarAppointment(Object[] data) {
- if (data != null) {
- for (int i = 0; i < data.length; i++) {
- if (data[i] != null) {
- switch (i) {
- case 0: {
- setId(((Number) data[i]).longValue());
- break;
- }
- case 1: {
- setPersonId(((Number) data[i]).longValue());
- break;
- }
- case 2: {
- setStart((Date) data[i]);
- break;
- }
- case 3: {
- setEnd((Date) data[i]);
- break;
- }
- case 4: {
- setFullDay(TypeCastUtility.castValue(data[i], Boolean.class));
- break;
- }
- case 5: {
- setSubject((String) data[i]);
- break;
- }
- case 6: {
- setBody((String) data[i]);
- break;
- }
- case 7: {
- setColor((String) data[i]);
- break;
- }
- }
- }
- }
- }
- }
-
- @Override
- public boolean isIntersecting(Date minDate, Date maxDate) {
- return DateUtility.intersects(m_start, m_end, minDate, maxDate);
- }
-
- @Override
- public Long getPersonId() {
- return m_personId;
- }
-
- @Override
- public void setPersonId(Long n) {
- m_personId = n;
- }
-
- @Override
- public Date getStart() {
- return m_start;
- }
-
- @Override
- public void setStart(Date a) {
- m_start = a;
- }
-
- @Override
- public Date getEnd() {
- return m_end;
- }
-
- @Override
- public void setEnd(Date a) {
- m_end = a;
- }
-
- @Override
- public boolean isFullDay() {
- return m_fullDay;
- }
-
- @Override
- public void setFullDay(boolean a) {
- m_fullDay = a;
- }
-
- @Override
- public String getLocation() {
- return m_location;
- }
-
- @Override
- public void setLocation(String a) {
- m_location = a;
- }
-
- @Override
- public int getBusyStatus() {
- return m_busyStatus;
- }
-
- @Override
- public void setBusyStatus(int a) {
- m_busyStatus = a;
- }
-
- @Override
- public String[] getRecipientEmail() {
- return m_recipientEmail.toArray(new String[m_recipientEmail.size()]);
- }
-
- public void addRecipientEmail(String recipientEmail) {
- m_recipientEmail.add(recipientEmail);
- }
-
- @Override
- public void removeRecipientEmail(String recipientEmail) {
- m_recipientEmail.remove(recipientEmail);
- }
-
- @Override
- public void removeAllRecipientEmail() {
- m_recipientEmail.clear();
- }
-
- @Override
- public ICalendarItem copy() {
- CalendarAppointment a = (CalendarAppointment) super.copy();
- a.m_personId = this.m_personId;
- a.m_start = this.m_start;
- a.m_end = this.m_end;
- a.m_fullDay = this.m_fullDay;
- a.m_location = this.m_location;
- a.m_busyStatus = this.m_busyStatus;
- return a;
- }
-
- @Override
- protected void dumpState(Map<String, Object> attributes) {
- super.dumpState(attributes);
- if (m_start != null) {
- attributes.put("start", getDumpDateFormat().format(m_start));
- }
- if (m_end != null) {
- attributes.put("end", getDumpDateFormat().format(m_end));
- }
- attributes.put("fullDay", m_fullDay);
- attributes.put("location", m_location);
- attributes.put("busyStatus", m_busyStatus);
- attributes.put("recipientEmail", m_recipientEmail);
- }
-
- @Override
- public Serializable getExternalKey() {
- return m_externalKey;
- }
-
- @Override
- public void setExternalKey(Serializable externalKey) {
- m_externalKey = externalKey;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.calendar;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Map;
+
+import org.eclipse.scout.commons.DateUtility;
+import org.eclipse.scout.commons.TypeCastUtility;
+
+public class CalendarAppointment extends AbstractCalendarItem implements ICalendarAppointment, Serializable {
+ private static final long serialVersionUID = 1L;
+ //
+ private Long m_personId;
+ private Date m_start;
+ private Date m_end;
+ private boolean m_fullDay;
+ private String m_location;
+ private int m_busyStatus;
+ private HashSet<String> m_recipientEmail = new HashSet<String>();
+ private Serializable m_externalKey;
+
+ public CalendarAppointment() {
+ super();
+ }
+
+ /**
+ * @param id
+ * @param personId
+ * @param startDate
+ * @param endDate
+ * @param fullDay
+ * @param subject
+ * @param body
+ * @param color
+ */
+ public CalendarAppointment(long id, Long personId, Date startDate, Date endDate, boolean fullDay, String subject, String body, String color) {
+ setId(id);
+ setPersonId(personId);
+ setStart(startDate);
+ setEnd(endDate);
+ setFullDay(fullDay);
+ setSubject(subject);
+ setBody(body);
+ setColor(color);
+ }
+
+ /**
+ * @param id
+ * @param personId
+ * @param startDate
+ * @param endDate
+ * @param fullDay
+ * @param subject
+ * @param body
+ * @param color
+ */
+ public CalendarAppointment(Object[] data) {
+ if (data != null) {
+ for (int i = 0; i < data.length; i++) {
+ if (data[i] != null) {
+ switch (i) {
+ case 0: {
+ setId(((Number) data[i]).longValue());
+ break;
+ }
+ case 1: {
+ setPersonId(((Number) data[i]).longValue());
+ break;
+ }
+ case 2: {
+ setStart((Date) data[i]);
+ break;
+ }
+ case 3: {
+ setEnd((Date) data[i]);
+ break;
+ }
+ case 4: {
+ setFullDay(TypeCastUtility.castValue(data[i], Boolean.class));
+ break;
+ }
+ case 5: {
+ setSubject((String) data[i]);
+ break;
+ }
+ case 6: {
+ setBody((String) data[i]);
+ break;
+ }
+ case 7: {
+ setColor((String) data[i]);
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ public boolean isIntersecting(Date minDate, Date maxDate) {
+ return DateUtility.intersects(m_start, m_end, minDate, maxDate);
+ }
+
+ @Override
+ public Long getPersonId() {
+ return m_personId;
+ }
+
+ @Override
+ public void setPersonId(Long n) {
+ m_personId = n;
+ }
+
+ @Override
+ public Date getStart() {
+ return m_start;
+ }
+
+ @Override
+ public void setStart(Date a) {
+ m_start = a;
+ }
+
+ @Override
+ public Date getEnd() {
+ return m_end;
+ }
+
+ @Override
+ public void setEnd(Date a) {
+ m_end = a;
+ }
+
+ @Override
+ public boolean isFullDay() {
+ return m_fullDay;
+ }
+
+ @Override
+ public void setFullDay(boolean a) {
+ m_fullDay = a;
+ }
+
+ @Override
+ public String getLocation() {
+ return m_location;
+ }
+
+ @Override
+ public void setLocation(String a) {
+ m_location = a;
+ }
+
+ @Override
+ public int getBusyStatus() {
+ return m_busyStatus;
+ }
+
+ @Override
+ public void setBusyStatus(int a) {
+ m_busyStatus = a;
+ }
+
+ @Override
+ public String[] getRecipientEmail() {
+ return m_recipientEmail.toArray(new String[m_recipientEmail.size()]);
+ }
+
+ public void addRecipientEmail(String recipientEmail) {
+ m_recipientEmail.add(recipientEmail);
+ }
+
+ @Override
+ public void removeRecipientEmail(String recipientEmail) {
+ m_recipientEmail.remove(recipientEmail);
+ }
+
+ @Override
+ public void removeAllRecipientEmail() {
+ m_recipientEmail.clear();
+ }
+
+ @Override
+ public ICalendarItem copy() {
+ CalendarAppointment a = (CalendarAppointment) super.copy();
+ a.m_personId = this.m_personId;
+ a.m_start = this.m_start;
+ a.m_end = this.m_end;
+ a.m_fullDay = this.m_fullDay;
+ a.m_location = this.m_location;
+ a.m_busyStatus = this.m_busyStatus;
+ return a;
+ }
+
+ @Override
+ protected void dumpState(Map<String, Object> attributes) {
+ super.dumpState(attributes);
+ if (m_start != null) {
+ attributes.put("start", getDumpDateFormat().format(m_start));
+ }
+ if (m_end != null) {
+ attributes.put("end", getDumpDateFormat().format(m_end));
+ }
+ attributes.put("fullDay", m_fullDay);
+ attributes.put("location", m_location);
+ attributes.put("busyStatus", m_busyStatus);
+ attributes.put("recipientEmail", m_recipientEmail);
+ }
+
+ @Override
+ public Serializable getExternalKey() {
+ return m_externalKey;
+ }
+
+ @Override
+ public void setExternalKey(Serializable externalKey) {
+ m_externalKey = externalKey;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/CalendarTask.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/CalendarTask.java
index 450229ef81..08a5a5f8d7 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/CalendarTask.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/CalendarTask.java
@@ -1,176 +1,176 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.calendar;
-
-import java.util.Date;
-import java.util.Map;
-
-import org.eclipse.scout.commons.DateUtility;
-
-public class CalendarTask extends AbstractCalendarItem implements ICalendarTask, java.io.Serializable {
- private static final long serialVersionUID = 0L;
-
- private Long m_responsibleId;
- private Date m_start;
- private Date m_due;
- private Date m_complete;
-
- public CalendarTask() {
- super();
- }
-
- /**
- * @param id
- * @param responsibleId
- * @param startDate
- * @param dueDate
- * @param completeDate
- * @param subject
- * @param body
- * @param color
- */
- public CalendarTask(long id, Long responsibleId, Date startDate, Date dueDate, Date completeDate, String subject, String body, String color) {
- setId(id);
- setResponsibleId(id);
- setStart(startDate);
- setDue(dueDate);
- setComplete(completeDate);
- setSubject(subject);
- setBody(body);
- setColor(color);
- }
-
- /**
- * @param id
- * @param responsibleId
- * @param startDate
- * @param dueDate
- * @param completeDate
- * @param subject
- * @param body
- * @param color
- */
- public CalendarTask(Object[] data) {
- if (data != null) {
- for (int i = 0; i < data.length; i++) {
- if (data[i] != null) {
- switch (i) {
- case 0: {
- setId(((Number) data[i]).longValue());
- break;
- }
- case 1: {
- setResponsibleId(((Number) data[i]).longValue());
- break;
- }
- case 2: {
- setStart((Date) data[i]);
- break;
- }
- case 3: {
- setDue((Date) data[i]);
- break;
- }
- case 4: {
- setComplete((Date) data[i]);
- break;
- }
- case 5: {
- setSubject((String) data[i]);
- break;
- }
- case 6: {
- setBody((String) data[i]);
- break;
- }
- case 7: {
- setColor((String) data[i]);
- break;
- }
- }
- }
- }
- }
- }
-
- @Override
- public boolean isIntersecting(Date minDate, Date maxDate) {
- Date d = m_due;
- if (d == null) {
- d = m_complete;
- }
- return DateUtility.intersects(m_start, d, minDate, maxDate);
- }
-
- @Override
- public Long getResponsibleId() {
- return m_responsibleId;
- }
-
- @Override
- public void setResponsibleId(Long n) {
- m_responsibleId = n;
- }
-
- @Override
- public Date getStart() {
- return m_start;
- }
-
- @Override
- public void setStart(Date a) {
- m_start = a;
- }
-
- @Override
- public Date getDue() {
- return m_due;
- }
-
- @Override
- public void setDue(Date a) {
- m_due = a;
- }
-
- @Override
- public Date getComplete() {
- return m_complete;
- }
-
- @Override
- public void setComplete(Date a) {
- m_complete = a;
- }
-
- @Override
- public ICalendarItem copy() {
- CalendarTask t = (CalendarTask) super.copy();
- t.m_responsibleId = this.m_responsibleId;
- t.m_start = this.m_start;
- t.m_due = this.m_due;
- t.m_complete = this.m_complete;
- return t;
- }
-
- @Override
- protected void dumpState(Map<String, Object> attributes) {
- super.dumpState(attributes);
- if (m_start != null) {
- attributes.put("start", getDumpDateFormat().format(m_start));
- }
- if (m_due != null) {
- attributes.put("due", getDumpDateFormat().format(m_due));
- }
- if (m_complete != null) {
- attributes.put("complete", getDumpDateFormat().format(m_complete));
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.calendar;
+
+import java.util.Date;
+import java.util.Map;
+
+import org.eclipse.scout.commons.DateUtility;
+
+public class CalendarTask extends AbstractCalendarItem implements ICalendarTask, java.io.Serializable {
+ private static final long serialVersionUID = 0L;
+
+ private Long m_responsibleId;
+ private Date m_start;
+ private Date m_due;
+ private Date m_complete;
+
+ public CalendarTask() {
+ super();
+ }
+
+ /**
+ * @param id
+ * @param responsibleId
+ * @param startDate
+ * @param dueDate
+ * @param completeDate
+ * @param subject
+ * @param body
+ * @param color
+ */
+ public CalendarTask(long id, Long responsibleId, Date startDate, Date dueDate, Date completeDate, String subject, String body, String color) {
+ setId(id);
+ setResponsibleId(id);
+ setStart(startDate);
+ setDue(dueDate);
+ setComplete(completeDate);
+ setSubject(subject);
+ setBody(body);
+ setColor(color);
+ }
+
+ /**
+ * @param id
+ * @param responsibleId
+ * @param startDate
+ * @param dueDate
+ * @param completeDate
+ * @param subject
+ * @param body
+ * @param color
+ */
+ public CalendarTask(Object[] data) {
+ if (data != null) {
+ for (int i = 0; i < data.length; i++) {
+ if (data[i] != null) {
+ switch (i) {
+ case 0: {
+ setId(((Number) data[i]).longValue());
+ break;
+ }
+ case 1: {
+ setResponsibleId(((Number) data[i]).longValue());
+ break;
+ }
+ case 2: {
+ setStart((Date) data[i]);
+ break;
+ }
+ case 3: {
+ setDue((Date) data[i]);
+ break;
+ }
+ case 4: {
+ setComplete((Date) data[i]);
+ break;
+ }
+ case 5: {
+ setSubject((String) data[i]);
+ break;
+ }
+ case 6: {
+ setBody((String) data[i]);
+ break;
+ }
+ case 7: {
+ setColor((String) data[i]);
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ public boolean isIntersecting(Date minDate, Date maxDate) {
+ Date d = m_due;
+ if (d == null) {
+ d = m_complete;
+ }
+ return DateUtility.intersects(m_start, d, minDate, maxDate);
+ }
+
+ @Override
+ public Long getResponsibleId() {
+ return m_responsibleId;
+ }
+
+ @Override
+ public void setResponsibleId(Long n) {
+ m_responsibleId = n;
+ }
+
+ @Override
+ public Date getStart() {
+ return m_start;
+ }
+
+ @Override
+ public void setStart(Date a) {
+ m_start = a;
+ }
+
+ @Override
+ public Date getDue() {
+ return m_due;
+ }
+
+ @Override
+ public void setDue(Date a) {
+ m_due = a;
+ }
+
+ @Override
+ public Date getComplete() {
+ return m_complete;
+ }
+
+ @Override
+ public void setComplete(Date a) {
+ m_complete = a;
+ }
+
+ @Override
+ public ICalendarItem copy() {
+ CalendarTask t = (CalendarTask) super.copy();
+ t.m_responsibleId = this.m_responsibleId;
+ t.m_start = this.m_start;
+ t.m_due = this.m_due;
+ t.m_complete = this.m_complete;
+ return t;
+ }
+
+ @Override
+ protected void dumpState(Map<String, Object> attributes) {
+ super.dumpState(attributes);
+ if (m_start != null) {
+ attributes.put("start", getDumpDateFormat().format(m_start));
+ }
+ if (m_due != null) {
+ attributes.put("due", getDumpDateFormat().format(m_due));
+ }
+ if (m_complete != null) {
+ attributes.put("complete", getDumpDateFormat().format(m_complete));
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/HolidayCalendarItemParser.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/HolidayCalendarItemParser.java
index 2ccd95e975..102f595cdf 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/HolidayCalendarItemParser.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/HolidayCalendarItemParser.java
@@ -1,269 +1,269 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.calendar;
-
-import java.io.InputStream;
-import java.net.URL;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Locale;
-import java.util.Map;
-
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.commons.xmlparser.SimpleXmlElement;
-
-/**
- * Default implementation of a calendar service delivering holiday items <br>
- * Produces data using XML resource file XML records can be recurring (with year
- * 0000) and/or single entries (with specific year)
- *
- * <pre>
- * @code <holidays>
- * <!--1st april every year-->
- * <holiday date="01.04.0000" color="RRGGBB" text_de="..." tooltip_de="..." text_en="..." tooltip_en="..."/>
- * <!--1st april only in 2005-->
- * <holiday date="01.04.2006" color="RRGGBB" text_de="..." tooltip_de="..." text_en="..." tooltip_en="..."/>
- * <!--every 3rd monday in april-->
- * <holiday date="01.04.0000" weekday="Monday" instance="3" color="RRGGBB" text_de="..." tooltip_de="..." text_en="..." tooltip_en="..."/>
- * <!--every last monday in april-->
- * <holiday date="01.04.0000" weekday="Monday" instance="last" color="RRGGBB" text_de="..." tooltip_de="..." text_en="..." tooltip_en="..."/>
- * <!--second sunday after easter-->
- * <holiday id="easter" date="01.04.0000" weekday="Sunday" instance="2" color="RRGGBB" text_de="Easter" tooltip_de="..." text_en="..." tooltip_en="..."/>
- * <holiday id="pfingsten" relativeTo="easter" weekday="Sunday" instance="2" color="RRGGBB" text_de="..." tooltip_de="..." text_en="..." tooltip_en="..."/>
- * </holidays>
- * }
- * </pre>
- */
-@Priority(-1)
-public class HolidayCalendarItemParser {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(HolidayCalendarItemParser.class);
- private static final String HOLIDAYS = "holidays";
- private static final String HOLIDAY = "holiday";
- private static final String DATE = "date";
- private static final String WEEKDAY = "weekday";
- private static final String INSTANCE = "instance";
- private static final String COLOR = "color";
- private static final String TEXT = "text";
- private static final String TOOLTIP = "tooltip";
- private static final String ID = "id";
- private static final String RELATIVE_TO = "relativeTo";
-
- private SimpleDateFormat m_dateFormat = new SimpleDateFormat("dd.MM.yyyy");
- private SimpleXmlElement m_xml;
-
- public HolidayCalendarItemParser(URL xmlResource) throws ProcessingException {
- m_xml = new SimpleXmlElement();
- if (xmlResource != null) {
- try {
- m_xml.parseStream(xmlResource.openStream());
- }
- catch (Throwable t) {
- throw new ProcessingException("loading " + xmlResource, t);
- }
- }
- }
-
- public HolidayCalendarItemParser(InputStream xmlResource, String displayFileName) throws ProcessingException {
- m_xml = new SimpleXmlElement();
- if (xmlResource != null) {
- try {
- m_xml.parseStream(xmlResource);
- }
- catch (Throwable t) {
- throw new ProcessingException("loading " + displayFileName, t);
- }
- }
- }
-
- public ICalendarItem[] getItems(Locale loc, Date minDate, Date maxDate) throws ProcessingException {
- ArrayList<HolidayItem> itemList = new ArrayList<HolidayItem>();
- int startYear, endYear;
- Calendar cal = Calendar.getInstance();
- cal.setTime(minDate);
- startYear = cal.get(Calendar.YEAR);
- cal.setTime(maxDate);
- endYear = cal.get(Calendar.YEAR);
- // load all holidays of the given years
- for (int year = startYear; year <= endYear; year++) {
- addHolidays(loc, year, itemList);
- }
- // remove all the holidays lying before minDate or after maxDate
- Iterator<HolidayItem> iter = itemList.iterator();
- while (iter.hasNext()) {
- HolidayItem item = iter.next();
- if (minDate.after(item.getStart()) || maxDate.before(item.getStart())) {
- iter.remove();
- }
- }
- return itemList.toArray(new HolidayItem[itemList.size()]);
- }
-
- private void addHolidays(Locale loc, int year, Collection<HolidayItem> newList) {
- HashMap<String/* id */, HolidayItem> holidayMap = new HashMap<String, HolidayItem>();
- // prepare locale patterns
- String[] locPatterns = new String[]{
- loc.getCountry() + "_" + loc.getLanguage() + "_" + loc.getVariant(),
- loc.getCountry() + "_" + loc.getLanguage(),
- loc.getLanguage(),
- };
- long index = 1;
- for (Iterator holidayIt = m_xml.getChildren(HOLIDAY).iterator(); holidayIt.hasNext();) {
- SimpleXmlElement holidayElem = (SimpleXmlElement) holidayIt.next();
- try {
- Date d = evaluateHolidayDate(holidayElem, holidayMap, year);
- if (d != null) {
- // find correct text
- String text = getAttributeByLocale(holidayElem, locPatterns, TEXT);
- String tooltip = getAttributeByLocale(holidayElem, locPatterns, TOOLTIP);
- //
- String itemId = holidayElem.getStringAttribute(ID, null);
- if (itemId == null) {
- itemId = "" + index;
- }
- HolidayItem item = new HolidayItem();
- item.setStart(d);
- item.setSubject(text);
- item.setBody(tooltip);
- item.setColor(holidayElem.getStringAttribute(COLOR));
- index++;
- holidayMap.put(itemId, item);
- }
- }
- catch (Exception e) {
- LOG.warn("item " + holidayElem.toString(), e);
- }
- }
- newList.addAll(holidayMap.values());
- }
-
- private Date evaluateHolidayDate(SimpleXmlElement holidayElem, Map<String, HolidayItem> holidayMap, int year) throws ParseException {
- String datePattern = holidayElem.getStringAttribute(DATE);
- String weekdayPattern = holidayElem.getStringAttribute(WEEKDAY);
- String instancePattern = holidayElem.getStringAttribute(INSTANCE);
- String relativeToId = holidayElem.getStringAttribute(RELATIVE_TO, null);
- //
- int weekday = -1;
- if (weekdayPattern != null) {
- if (weekdayPattern.equalsIgnoreCase("MONDAY")) {
- weekday = Calendar.MONDAY;
- }
- else if (weekdayPattern.equalsIgnoreCase("TUESDAY")) {
- weekday = Calendar.TUESDAY;
- }
- else if (weekdayPattern.equalsIgnoreCase("WEDNESDAY")) {
- weekday = Calendar.WEDNESDAY;
- }
- else if (weekdayPattern.equalsIgnoreCase("THURSDAY")) {
- weekday = Calendar.THURSDAY;
- }
- else if (weekdayPattern.equalsIgnoreCase("FRIDAY")) {
- weekday = Calendar.FRIDAY;
- }
- else if (weekdayPattern.equalsIgnoreCase("SATURDAY")) {
- weekday = Calendar.SATURDAY;
- }
- else if (weekdayPattern.equalsIgnoreCase("SUNDAY")) {
- weekday = Calendar.SUNDAY;
- }
- }
- int instance = 0;
- if (instancePattern != null) {
- if (instancePattern.equalsIgnoreCase("FIRST")) {
- instance = 1;
- }
- else if (instancePattern.equalsIgnoreCase("LAST")) {
- instance = -1;
- }
- else {
- instance = Integer.parseInt(instancePattern);
- }
- }
- Date startDate = null;
- if (relativeToId != null) {
- HolidayItem relItem = holidayMap.get(relativeToId);
- if (relItem != null) {
- startDate = relItem.getStart();
- }
- }
- if (startDate == null) {
- if (datePattern == null) {
- // not existing
- return null;
- }
- else if (datePattern.endsWith("0000")) {
- // wildcard ok
- startDate = m_dateFormat.parse(datePattern.substring(0, datePattern.length() - 4) + year);
- }
- else if (datePattern.endsWith("" + year)) {
- // correct year
- startDate = m_dateFormat.parse(datePattern);
- }
- else {
- // not matching year
- return null;
- }
- }
- Calendar cal = Calendar.getInstance();
- cal.setTime(startDate);
- //
- if (weekday >= 0 && instance != 0) {
- if (instance > 0) {
- // 1st, second, ...
- int n = instance;
- while (n > 0) {
- if (cal.get(Calendar.DAY_OF_WEEK) == weekday) {
- n--;
- if (n == 0) {
- break;
- }
- }
- cal.add(Calendar.DATE, 1);
- }
- }
- else {
- // last, secondlast, ...
- int n = -instance;
- while (n > 0) {
- if (cal.get(Calendar.DAY_OF_WEEK) == weekday) {
- n--;
- if (n == 0) {
- break;
- }
- }
- cal.add(Calendar.DATE, -1);
- }
- }
- }
- startDate = cal.getTime();
- return startDate;
- }
-
- private String getAttributeByLocale(SimpleXmlElement e, String[] locPatterns, String attributeNamePrefix) {
- String s = null;
- for (int i = 0; i < locPatterns.length; i++) {
- s = e.getStringAttribute(attributeNamePrefix + "_" + locPatterns[i], null);
- if (s != null) {
- break;
- }
- }
- return s;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.calendar;
+
+import java.io.InputStream;
+import java.net.URL;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.Map;
+
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.commons.xmlparser.SimpleXmlElement;
+
+/**
+ * Default implementation of a calendar service delivering holiday items <br>
+ * Produces data using XML resource file XML records can be recurring (with year
+ * 0000) and/or single entries (with specific year)
+ *
+ * <pre>
+ * @code <holidays>
+ * <!--1st april every year-->
+ * <holiday date="01.04.0000" color="RRGGBB" text_de="..." tooltip_de="..." text_en="..." tooltip_en="..."/>
+ * <!--1st april only in 2005-->
+ * <holiday date="01.04.2006" color="RRGGBB" text_de="..." tooltip_de="..." text_en="..." tooltip_en="..."/>
+ * <!--every 3rd monday in april-->
+ * <holiday date="01.04.0000" weekday="Monday" instance="3" color="RRGGBB" text_de="..." tooltip_de="..." text_en="..." tooltip_en="..."/>
+ * <!--every last monday in april-->
+ * <holiday date="01.04.0000" weekday="Monday" instance="last" color="RRGGBB" text_de="..." tooltip_de="..." text_en="..." tooltip_en="..."/>
+ * <!--second sunday after easter-->
+ * <holiday id="easter" date="01.04.0000" weekday="Sunday" instance="2" color="RRGGBB" text_de="Easter" tooltip_de="..." text_en="..." tooltip_en="..."/>
+ * <holiday id="pfingsten" relativeTo="easter" weekday="Sunday" instance="2" color="RRGGBB" text_de="..." tooltip_de="..." text_en="..." tooltip_en="..."/>
+ * </holidays>
+ * }
+ * </pre>
+ */
+@Priority(-1)
+public class HolidayCalendarItemParser {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(HolidayCalendarItemParser.class);
+ private static final String HOLIDAYS = "holidays";
+ private static final String HOLIDAY = "holiday";
+ private static final String DATE = "date";
+ private static final String WEEKDAY = "weekday";
+ private static final String INSTANCE = "instance";
+ private static final String COLOR = "color";
+ private static final String TEXT = "text";
+ private static final String TOOLTIP = "tooltip";
+ private static final String ID = "id";
+ private static final String RELATIVE_TO = "relativeTo";
+
+ private SimpleDateFormat m_dateFormat = new SimpleDateFormat("dd.MM.yyyy");
+ private SimpleXmlElement m_xml;
+
+ public HolidayCalendarItemParser(URL xmlResource) throws ProcessingException {
+ m_xml = new SimpleXmlElement();
+ if (xmlResource != null) {
+ try {
+ m_xml.parseStream(xmlResource.openStream());
+ }
+ catch (Throwable t) {
+ throw new ProcessingException("loading " + xmlResource, t);
+ }
+ }
+ }
+
+ public HolidayCalendarItemParser(InputStream xmlResource, String displayFileName) throws ProcessingException {
+ m_xml = new SimpleXmlElement();
+ if (xmlResource != null) {
+ try {
+ m_xml.parseStream(xmlResource);
+ }
+ catch (Throwable t) {
+ throw new ProcessingException("loading " + displayFileName, t);
+ }
+ }
+ }
+
+ public ICalendarItem[] getItems(Locale loc, Date minDate, Date maxDate) throws ProcessingException {
+ ArrayList<HolidayItem> itemList = new ArrayList<HolidayItem>();
+ int startYear, endYear;
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(minDate);
+ startYear = cal.get(Calendar.YEAR);
+ cal.setTime(maxDate);
+ endYear = cal.get(Calendar.YEAR);
+ // load all holidays of the given years
+ for (int year = startYear; year <= endYear; year++) {
+ addHolidays(loc, year, itemList);
+ }
+ // remove all the holidays lying before minDate or after maxDate
+ Iterator<HolidayItem> iter = itemList.iterator();
+ while (iter.hasNext()) {
+ HolidayItem item = iter.next();
+ if (minDate.after(item.getStart()) || maxDate.before(item.getStart())) {
+ iter.remove();
+ }
+ }
+ return itemList.toArray(new HolidayItem[itemList.size()]);
+ }
+
+ private void addHolidays(Locale loc, int year, Collection<HolidayItem> newList) {
+ HashMap<String/* id */, HolidayItem> holidayMap = new HashMap<String, HolidayItem>();
+ // prepare locale patterns
+ String[] locPatterns = new String[]{
+ loc.getCountry() + "_" + loc.getLanguage() + "_" + loc.getVariant(),
+ loc.getCountry() + "_" + loc.getLanguage(),
+ loc.getLanguage(),
+ };
+ long index = 1;
+ for (Iterator holidayIt = m_xml.getChildren(HOLIDAY).iterator(); holidayIt.hasNext();) {
+ SimpleXmlElement holidayElem = (SimpleXmlElement) holidayIt.next();
+ try {
+ Date d = evaluateHolidayDate(holidayElem, holidayMap, year);
+ if (d != null) {
+ // find correct text
+ String text = getAttributeByLocale(holidayElem, locPatterns, TEXT);
+ String tooltip = getAttributeByLocale(holidayElem, locPatterns, TOOLTIP);
+ //
+ String itemId = holidayElem.getStringAttribute(ID, null);
+ if (itemId == null) {
+ itemId = "" + index;
+ }
+ HolidayItem item = new HolidayItem();
+ item.setStart(d);
+ item.setSubject(text);
+ item.setBody(tooltip);
+ item.setColor(holidayElem.getStringAttribute(COLOR));
+ index++;
+ holidayMap.put(itemId, item);
+ }
+ }
+ catch (Exception e) {
+ LOG.warn("item " + holidayElem.toString(), e);
+ }
+ }
+ newList.addAll(holidayMap.values());
+ }
+
+ private Date evaluateHolidayDate(SimpleXmlElement holidayElem, Map<String, HolidayItem> holidayMap, int year) throws ParseException {
+ String datePattern = holidayElem.getStringAttribute(DATE);
+ String weekdayPattern = holidayElem.getStringAttribute(WEEKDAY);
+ String instancePattern = holidayElem.getStringAttribute(INSTANCE);
+ String relativeToId = holidayElem.getStringAttribute(RELATIVE_TO, null);
+ //
+ int weekday = -1;
+ if (weekdayPattern != null) {
+ if (weekdayPattern.equalsIgnoreCase("MONDAY")) {
+ weekday = Calendar.MONDAY;
+ }
+ else if (weekdayPattern.equalsIgnoreCase("TUESDAY")) {
+ weekday = Calendar.TUESDAY;
+ }
+ else if (weekdayPattern.equalsIgnoreCase("WEDNESDAY")) {
+ weekday = Calendar.WEDNESDAY;
+ }
+ else if (weekdayPattern.equalsIgnoreCase("THURSDAY")) {
+ weekday = Calendar.THURSDAY;
+ }
+ else if (weekdayPattern.equalsIgnoreCase("FRIDAY")) {
+ weekday = Calendar.FRIDAY;
+ }
+ else if (weekdayPattern.equalsIgnoreCase("SATURDAY")) {
+ weekday = Calendar.SATURDAY;
+ }
+ else if (weekdayPattern.equalsIgnoreCase("SUNDAY")) {
+ weekday = Calendar.SUNDAY;
+ }
+ }
+ int instance = 0;
+ if (instancePattern != null) {
+ if (instancePattern.equalsIgnoreCase("FIRST")) {
+ instance = 1;
+ }
+ else if (instancePattern.equalsIgnoreCase("LAST")) {
+ instance = -1;
+ }
+ else {
+ instance = Integer.parseInt(instancePattern);
+ }
+ }
+ Date startDate = null;
+ if (relativeToId != null) {
+ HolidayItem relItem = holidayMap.get(relativeToId);
+ if (relItem != null) {
+ startDate = relItem.getStart();
+ }
+ }
+ if (startDate == null) {
+ if (datePattern == null) {
+ // not existing
+ return null;
+ }
+ else if (datePattern.endsWith("0000")) {
+ // wildcard ok
+ startDate = m_dateFormat.parse(datePattern.substring(0, datePattern.length() - 4) + year);
+ }
+ else if (datePattern.endsWith("" + year)) {
+ // correct year
+ startDate = m_dateFormat.parse(datePattern);
+ }
+ else {
+ // not matching year
+ return null;
+ }
+ }
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(startDate);
+ //
+ if (weekday >= 0 && instance != 0) {
+ if (instance > 0) {
+ // 1st, second, ...
+ int n = instance;
+ while (n > 0) {
+ if (cal.get(Calendar.DAY_OF_WEEK) == weekday) {
+ n--;
+ if (n == 0) {
+ break;
+ }
+ }
+ cal.add(Calendar.DATE, 1);
+ }
+ }
+ else {
+ // last, secondlast, ...
+ int n = -instance;
+ while (n > 0) {
+ if (cal.get(Calendar.DAY_OF_WEEK) == weekday) {
+ n--;
+ if (n == 0) {
+ break;
+ }
+ }
+ cal.add(Calendar.DATE, -1);
+ }
+ }
+ }
+ startDate = cal.getTime();
+ return startDate;
+ }
+
+ private String getAttributeByLocale(SimpleXmlElement e, String[] locPatterns, String attributeNamePrefix) {
+ String s = null;
+ for (int i = 0; i < locPatterns.length; i++) {
+ s = e.getStringAttribute(attributeNamePrefix + "_" + locPatterns[i], null);
+ if (s != null) {
+ break;
+ }
+ }
+ return s;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/HolidayItem.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/HolidayItem.java
index 838c1d975b..7c9d7ad253 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/HolidayItem.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/HolidayItem.java
@@ -1,25 +1,25 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.calendar;
-
-import java.io.Serializable;
-
-/**
- * This class represents a full-day holiday calendar item
- */
-public class HolidayItem extends CalendarTask implements Serializable {
- private static final long serialVersionUID = 1L;
-
- public HolidayItem() {
- super();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.calendar;
+
+import java.io.Serializable;
+
+/**
+ * This class represents a full-day holiday calendar item
+ */
+public class HolidayItem extends CalendarTask implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ public HolidayItem() {
+ super();
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/ICalendarAppointment.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/ICalendarAppointment.java
index 5d8465ccaa..fb477c4284 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/ICalendarAppointment.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/ICalendarAppointment.java
@@ -1,57 +1,57 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.calendar;
-
-import java.io.Serializable;
-import java.util.Date;
-
-public interface ICalendarAppointment extends ICalendarItem {
-
- int STATUS_FREE = 0;
- int STATUS_TENTATIVE = 1;
- int STATUS_BUSY = 2;
- int STATUS_OUTOFOFFICE = 3;
-
- Long getPersonId();
-
- void setPersonId(Long n);
-
- Date getStart();
-
- void setStart(Date a);
-
- Date getEnd();
-
- void setEnd(Date a);
-
- boolean isFullDay();
-
- void setFullDay(boolean a);
-
- String getLocation();
-
- void setLocation(String a);
-
- int getBusyStatus();
-
- void setBusyStatus(int a);
-
- String[] getRecipientEmail();
-
- void removeRecipientEmail(String recipientEmail);
-
- void removeAllRecipientEmail();
-
- Serializable getExternalKey();
-
- void setExternalKey(Serializable externalKey);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.calendar;
+
+import java.io.Serializable;
+import java.util.Date;
+
+public interface ICalendarAppointment extends ICalendarItem {
+
+ int STATUS_FREE = 0;
+ int STATUS_TENTATIVE = 1;
+ int STATUS_BUSY = 2;
+ int STATUS_OUTOFOFFICE = 3;
+
+ Long getPersonId();
+
+ void setPersonId(Long n);
+
+ Date getStart();
+
+ void setStart(Date a);
+
+ Date getEnd();
+
+ void setEnd(Date a);
+
+ boolean isFullDay();
+
+ void setFullDay(boolean a);
+
+ String getLocation();
+
+ void setLocation(String a);
+
+ int getBusyStatus();
+
+ void setBusyStatus(int a);
+
+ String[] getRecipientEmail();
+
+ void removeRecipientEmail(String recipientEmail);
+
+ void removeAllRecipientEmail();
+
+ Serializable getExternalKey();
+
+ void setExternalKey(Serializable externalKey);
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/ICalendarItem.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/ICalendarItem.java
index 455dcbf404..75cb3a0c95 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/ICalendarItem.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/ICalendarItem.java
@@ -1,70 +1,70 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.calendar;
-
-import java.util.Date;
-
-public interface ICalendarItem {
-
- boolean exists();
-
- /**
- * mark item as deleted <br>
- * Note: this will not physically delete the item, just set the marker
- */
- void delete();
-
- long getLastModified();
-
- void setLastModified(long b);
-
- String getColor();
-
- void setColor(String hex);
-
- /**
- * @return true iff this item covers or intersects the range [minDate,maxDate]
- */
- boolean isIntersecting(Date minDate, Date maxDate);
-
- /**
- * @return the internal id
- */
- long getId();
-
- /**
- * set the internal id
- */
- void setId(long id);
-
- String getSubject();
-
- void setSubject(String a);
-
- String getBody();
-
- void setBody(String a);
-
- /**
- * @return the user id that is the primary owner of this item
- */
- String getOwner();
-
- /**
- * set the user id that is the primary owner of this item
- */
- void setOwner(String a);
-
- RecurrencePattern getRecurrencePattern();
-
- void setRecurrencePattern(RecurrencePattern p);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.calendar;
+
+import java.util.Date;
+
+public interface ICalendarItem {
+
+ boolean exists();
+
+ /**
+ * mark item as deleted <br>
+ * Note: this will not physically delete the item, just set the marker
+ */
+ void delete();
+
+ long getLastModified();
+
+ void setLastModified(long b);
+
+ String getColor();
+
+ void setColor(String hex);
+
+ /**
+ * @return true iff this item covers or intersects the range [minDate,maxDate]
+ */
+ boolean isIntersecting(Date minDate, Date maxDate);
+
+ /**
+ * @return the internal id
+ */
+ long getId();
+
+ /**
+ * set the internal id
+ */
+ void setId(long id);
+
+ String getSubject();
+
+ void setSubject(String a);
+
+ String getBody();
+
+ void setBody(String a);
+
+ /**
+ * @return the user id that is the primary owner of this item
+ */
+ String getOwner();
+
+ /**
+ * set the user id that is the primary owner of this item
+ */
+ void setOwner(String a);
+
+ RecurrencePattern getRecurrencePattern();
+
+ void setRecurrencePattern(RecurrencePattern p);
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/ICalendarService.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/ICalendarService.java
index f40c3b17df..ecc119278d 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/ICalendarService.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/ICalendarService.java
@@ -1,34 +1,34 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.calendar;
-
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.service.IService;
-
-/**
- * This interface is simply a marker interface for grouping calendar realated
- * data services in BSI CASE
- * <p>
- * BSI CASE will add the following example operations to the service interface / implementation
- *
- * <pre>
- * ICalendarItem[] getItems(Date minDate, Date maxDate) throws ProcessingException;
- *
- * void storeItems(ICalendarItem[] items, boolean delta) throws ProcessingException;
- * </pre>
- *
- * However, these operations are simply a basic sample and implementations might have more actual parameters to the
- * method
- */
-@Priority(-3)
-public interface ICalendarService extends IService {
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.calendar;
+
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.service.IService;
+
+/**
+ * This interface is simply a marker interface for grouping calendar realated
+ * data services in BSI CASE
+ * <p>
+ * BSI CASE will add the following example operations to the service interface / implementation
+ *
+ * <pre>
+ * ICalendarItem[] getItems(Date minDate, Date maxDate) throws ProcessingException;
+ *
+ * void storeItems(ICalendarItem[] items, boolean delta) throws ProcessingException;
+ * </pre>
+ *
+ * However, these operations are simply a basic sample and implementations might have more actual parameters to the
+ * method
+ */
+@Priority(-3)
+public interface ICalendarService extends IService {
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/ICalendarTask.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/ICalendarTask.java
index 5e0eb2090f..466c902e55 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/ICalendarTask.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/ICalendarTask.java
@@ -1,33 +1,33 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.calendar;
-
-import java.util.Date;
-
-public interface ICalendarTask extends ICalendarItem {
-
- Long getResponsibleId();
-
- void setResponsibleId(Long n);
-
- Date getStart();
-
- void setStart(Date a);
-
- Date getDue();
-
- void setDue(Date a);
-
- Date getComplete();
-
- void setComplete(Date a);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.calendar;
+
+import java.util.Date;
+
+public interface ICalendarTask extends ICalendarItem {
+
+ Long getResponsibleId();
+
+ void setResponsibleId(Long n);
+
+ Date getStart();
+
+ void setStart(Date a);
+
+ Date getDue();
+
+ void setDue(Date a);
+
+ Date getComplete();
+
+ void setComplete(Date a);
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/IHolidayCalendarService.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/IHolidayCalendarService.java
index 8f36f22db6..34192345dd 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/IHolidayCalendarService.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/IHolidayCalendarService.java
@@ -1,31 +1,31 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.calendar;
-
-import java.util.Date;
-
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.shared.services.common.file.RemoteFile;
-
-@Priority(-3)
-public interface IHolidayCalendarService extends ICalendarService {
-
- /**
- * default value: calendar/holidays.xml
- */
- ICalendarItem[] getItems(RemoteFile f, Date minDate, Date maxDate) throws ProcessingException;
-
- /*
- * Not needed void storeItems(ICalendarItem[] items, boolean delta) throws
- * ProcessingException;
- */
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.calendar;
+
+import java.util.Date;
+
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.shared.services.common.file.RemoteFile;
+
+@Priority(-3)
+public interface IHolidayCalendarService extends ICalendarService {
+
+ /**
+ * default value: calendar/holidays.xml
+ */
+ ICalendarItem[] getItems(RemoteFile f, Date minDate, Date maxDate) throws ProcessingException;
+
+ /*
+ * Not needed void storeItems(ICalendarItem[] items, boolean delta) throws
+ * ProcessingException;
+ */
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/RecurrenceException.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/RecurrenceException.java
index b0db3c2040..2cf825e8ee 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/RecurrenceException.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/RecurrenceException.java
@@ -1,53 +1,53 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.calendar;
-
-import java.util.Date;
-
-public class RecurrenceException implements java.io.Serializable {
- private static final long serialVersionUID = 1L;
- //
- private ICalendarItem m_item;
- private Date m_originalStartDate;
- private boolean m_exists = true;
-
- public RecurrenceException() {
- }
-
- public ICalendarItem getItem() {
- return m_item;
- }
-
- public void setItem(ICalendarItem i) {
- m_item = i;
- }
-
- public Date getOriginalStartDate() {
- return m_originalStartDate;
- }
-
- public void setOriginalStartDate(Date d) {
- m_originalStartDate = d;
- }
-
- public boolean exists() {
- return m_exists;
- }
-
- /**
- * mark item as deleted <br>
- * Note: this will not physically delete the item, just set the marker
- */
- public void delete() {
- m_exists = false;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.calendar;
+
+import java.util.Date;
+
+public class RecurrenceException implements java.io.Serializable {
+ private static final long serialVersionUID = 1L;
+ //
+ private ICalendarItem m_item;
+ private Date m_originalStartDate;
+ private boolean m_exists = true;
+
+ public RecurrenceException() {
+ }
+
+ public ICalendarItem getItem() {
+ return m_item;
+ }
+
+ public void setItem(ICalendarItem i) {
+ m_item = i;
+ }
+
+ public Date getOriginalStartDate() {
+ return m_originalStartDate;
+ }
+
+ public void setOriginalStartDate(Date d) {
+ m_originalStartDate = d;
+ }
+
+ public boolean exists() {
+ return m_exists;
+ }
+
+ /**
+ * mark item as deleted <br>
+ * Note: this will not physically delete the item, just set the marker
+ */
+ public void delete() {
+ m_exists = false;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/RecurrencePattern.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/RecurrencePattern.java
index 6332b1671e..944fab548d 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/RecurrencePattern.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/calendar/RecurrencePattern.java
@@ -1,672 +1,672 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.calendar;
-
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.GregorianCalendar;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.TreeSet;
-
-public class RecurrencePattern implements java.io.Serializable {
- private static final long serialVersionUID = 1L;
- //
- public static final int TYPE_DAILY = 119535;
- public static final int TYPE_WEEKLY = 119536;
- public static final int TYPE_MONTHLY = 119537;
- public static final int TYPE_MONTHLY_SPEC = 119538;
- public static final int TYPE_YEARLY = 119539;
- public static final int TYPE_YEARLY_SPEC = 119540;
- //
- public static final int INST_FIRST = 119530;
- public static final int INST_SECOND = 119531;
- public static final int INST_THIRD = 119532;
- public static final int INST_FOURTH = 119533;
- public static final int INST_LAST = 119534;
- public static final int INST_NONE = 0;
- //
- /**
- * same as {@value Calendar#SUNDAY}
- */
- public static final int MASK_SUN = 1;
- /**
- * same as {@value Calendar#MONDAY}
- */
- public static final int MASK_MON = 2;
- /**
- * same as {@value Calendar#TUESDAY}
- */
- public static final int MASK_TUE = 4;
- /**
- * same as {@value Calendar#WEDNESDAY}
- */
- public static final int MASK_WED = 8;
- /**
- * same as {@value Calendar#THURSDAY}
- */
- public static final int MASK_THU = 16;
- /**
- * same as {@value Calendar#FRIDAY}
- */
- public static final int MASK_FRI = 32;
- /**
- * same as {@value Calendar#SATURDAY}
- */
- public static final int MASK_SAT = 64;
-
- private long m_lastModified;
- private boolean m_regenerate;
- private int m_startTimeMinutes;
- private int m_endTimeMinutes;
- private int m_durationMinutes;
- private Date m_firstDate;
- private Date m_lastDate;
- private int m_occurrences;
- private boolean m_noEndDate;
- private int m_type;
- private int m_interval;
- private int m_instance;
- private int m_dayOfWeekBits;
- /**
- * value startw with 1
- */
- private int m_dayOfMonth;
- /**
- * value startw with 1
- */
- private int m_monthOfYear;
- private ArrayList<RecurrenceException> m_recurrenceExceptions = new ArrayList<RecurrenceException>();
-
- public RecurrencePattern() {
- }
-
- public long getLastModified() {
- return m_lastModified;
- }
-
- public void setLastModified(long b) {
- m_lastModified = b;
- }
-
- public void setRegenerate(boolean v) {
- m_regenerate = v;
- }
-
- public boolean isRegenerate() {
- return m_regenerate;
- }
-
- public void setStartTimeMinutes(int v) {
- m_startTimeMinutes = v;
- }
-
- public int getStartTimeMinutes() {
- return m_startTimeMinutes;
- }
-
- public void setEndTimeMinutes(int v) {
- m_endTimeMinutes = v;
- }
-
- public int getEndTimeMinutes() {
- return m_endTimeMinutes;
- }
-
- public void setStartTimeAsDate(Date d) {
- if (d != null) {
- Calendar c = Calendar.getInstance();
- c.setTime(d);
- m_startTimeMinutes = c.get(Calendar.HOUR_OF_DAY) * 60 + c.get(Calendar.MINUTE);
- }
- }
-
- public Date getStartTimeAsDate() {
- Calendar c = Calendar.getInstance();
- c.set(2000, 1, 1, m_startTimeMinutes / 60, m_startTimeMinutes % 60, 0);
- return c.getTime();
- }
-
- public void setEndTimeAsDate(Date d) {
- if (d != null) {
- Calendar c = Calendar.getInstance();
- c.setTime(d);
- m_endTimeMinutes = c.get(Calendar.HOUR_OF_DAY) * 60 + c.get(Calendar.MINUTE);
- }
- }
-
- public Date getEndTimeAsDate() {
- Calendar c = Calendar.getInstance();
- c.set(2000, 1, 1, m_endTimeMinutes / 60, m_endTimeMinutes % 60, 0);
- return c.getTime();
- }
-
- public void setDurationMinutes(int v) {
- if (v > 0x10000000) {
- v = 0;
- }
- m_durationMinutes = v;
- }
-
- public int getDurationMinutes() {
- return m_durationMinutes;
- }
-
- public void setFirstDate(Date v) {
- m_firstDate = v;
- }
-
- public Date getFirstDate() {
- return m_firstDate;
- }
-
- public void setLastDate(Date v) {
- m_lastDate = v;
- }
-
- public Date getLastDate() {
- return m_lastDate;
- }
-
- public void setOccurrences(int v) {
- m_occurrences = v;
- }
-
- public int getOccurrences() {
- return m_occurrences;
- }
-
- public void setNoEndDate(boolean v) {
- m_noEndDate = v;
- }
-
- public boolean getNoEndDate() {
- return m_noEndDate;
- }
-
- public void setType(int v) {
- if (v < TYPE_DAILY || v > TYPE_YEARLY_SPEC) {
- throw new IllegalArgumentException("type (" + v + ") must be in [TYPE_DAILY,TYPE_YEARLY_SPEC]");
- }
- m_type = v;
- }
-
- public int getType() {
- return m_type;
- }
-
- public void setInterval(int v) {
- m_interval = v;
- }
-
- public int getInterval() {
- return m_interval;
- }
-
- public void setInstance(int v) {
- if (v != 0 && (v < INST_FIRST || v > INST_LAST)) {
- throw new IllegalArgumentException("instance (" + v + ") must be in [INST_FIRST,INST_LAST]");
- }
- m_instance = v;
- }
-
- public int getInstance() {
- return m_instance;
- }
-
- public void setDayOfWeek(int bits) {
- m_dayOfWeekBits = bits;
- }
-
- public int getDayOfWeek() {
- return m_dayOfWeekBits;
- }
-
- /**
- * value startw with 1
- */
- public void setDayOfMonth(int v) {
- m_dayOfMonth = v;
- }
-
- /**
- * value startw with 1
- */
- public int getDayOfMonth() {
- return m_dayOfMonth;
- }
-
- /**
- * value startw with 1
- */
- public void setMonthOfYear(int v) {
- m_monthOfYear = v;
- }
-
- /**
- * value startw with 1
- */
- public int getMonthOfYear() {
- return m_monthOfYear;
- }
-
- public List<RecurrenceException> getRecurrenceExceptions() {
- return m_recurrenceExceptions;
- }
-
- public void addRecurrenceException(RecurrenceException ex) {
- m_recurrenceExceptions.add(ex);
- }
-
- /**
- * Recurrence series provider
- */
- public Set<Date> createStartDates(Date startDate, Date endDate) {
- if (m_firstDate != null && m_firstDate.after(startDate)) {
- startDate = m_firstDate;
- }
- if (m_lastDate != null && m_lastDate.before(endDate)) {
- endDate = m_lastDate;
- }
- // startDate has time=00:00:00
- startDate = applyTime(startDate, 0, 0, 0);
- // endDate has time=23:59:59
- endDate = applyTime(endDate, 23, 59, 59);
- // build first date/time
- int min = getStartTimeMinutes() % (24 * 60);
- GregorianCalendar startRecCal = new GregorianCalendar();
- startRecCal.setTime(applyTime(m_firstDate, min / 60, min % 60, 0));
- TreeSet<Date> list = new TreeSet<Date>();
- if (m_interval <= 0) {
- m_interval = 1;
- }
- switch (getType()) {
- case TYPE_DAILY: {
- createDailyStartDates(startRecCal, startDate, endDate, list);
- break;
- }
- case TYPE_WEEKLY: {
- createWeeklyStartDates(startRecCal, startDate, endDate, list);
- break;
- }
- case TYPE_MONTHLY: {
- createMonthlyStartDates(startRecCal, startDate, endDate, list);
- break;
- }
- case TYPE_MONTHLY_SPEC: {
- createMonthlySpecStartDates(startRecCal, startDate, endDate, list);
- break;
- }
- case TYPE_YEARLY: {
- createYearlyStartDates(startRecCal, startDate, endDate, list);
- break;
- }
- case TYPE_YEARLY_SPEC: {
- createYearlySpecStartDates(startRecCal, startDate, endDate, list);
- break;
- }
- }
- // remove exceptions
- for (Iterator<RecurrenceException> it = m_recurrenceExceptions.iterator(); it.hasNext();) {
- RecurrenceException recEx = it.next();
- Calendar cal = Calendar.getInstance();
- cal.setTime(recEx.getOriginalStartDate());
- cal.set(Calendar.HOUR, 0);
- cal.set(Calendar.HOUR_OF_DAY, min / 60);
- cal.set(Calendar.MINUTE, min % 60);
- cal.set(Calendar.SECOND, 0);
- cal.set(Calendar.MILLISECOND, 0);
- list.remove(cal.getTime());
- }
- return list;
- }
-
- private void createDailyStartDates(Calendar cal, Date startDate, Date endDate, Set<Date> list) {
- // uses: occurrences,interval(only if lastdate set)
- // loop from beginning of series (not beginning of interval!)
- Date d = cal.getTime();
- int count = 0;// of occurences
- while (d.compareTo(endDate) <= 0) {
- // valid
- count++;
- // add, if in requested interval
- if (d.compareTo(startDate) >= 0) {
- list.add(d);
- }
- // next
- cal.add(Calendar.DATE, m_interval);
- d = cal.getTime();
- /**
- * @rn sle, 05.07.2006,
- * @since Build 204 Bugfix to ensure value 'occurrences' is realy true
- * reported by MBR, ORS / SSC, BAP PK
- */
- if (m_noEndDate == false) {
- if (m_lastDate == null) {
- if (count >= m_occurrences) {
- break;
- }
- }
- }
- }
- }
-
- private boolean isInWeekMask(int bitMask, Calendar cal) {
- return (bitMask & (1 << (cal.get(Calendar.DAY_OF_WEEK) - 1))) != 0;
- }
-
- private void createWeeklyStartDates(Calendar cal, Date startDate, Date endDate, Set<Date> list) {
- // uses: occurrences,interval(only if lastdate set),dayOfWeekBits
- // loop from beginning of series (not beginning of interval!)
- Date d = cal.getTime();
- int count = 0;// of occurences
- while (d.compareTo(endDate) <= 0) {
- // check weekdays
- Calendar weekCal = Calendar.getInstance();
- weekCal.setTime(d);
- for (int i = 0; i < 7; i++) {
- if (isInWeekMask(m_dayOfWeekBits, weekCal)) {
- // valid
- Date dWeek = weekCal.getTime();
- count++;
- // add, if in requested interval
- if (dWeek.compareTo(startDate) >= 0) {
- list.add(dWeek);
- }
- /**
- * @rn sle, 05.07.2006,
- * @since Build 204 Bugfix to ensure value 'occurrences' is realy true
- * reported by MBR, ORS / SSC, BAP PK
- */
- if (m_noEndDate == false) {
- if (m_lastDate == null) {
- if (count >= m_occurrences) {
- break;
- }
- }
- }
- }
- // next weekday
- weekCal.add(Calendar.DATE, 1);
- }
- // next
- cal.add(Calendar.WEEK_OF_YEAR, m_interval);
- d = cal.getTime();
- /**
- * @rn sle, 05.07.2006,
- * @since Build 204 Bugfix to ensure value 'occurrences' is realy true
- * reported by MBR, ORS / SSC, BAP PK
- */
- if (m_noEndDate == false) {
- if (m_lastDate == null) {
- if (count >= m_occurrences) {
- break;
- }
- }
- }
- }
- }
-
- private void createMonthlyStartDates(Calendar cal, Date startDate, Date endDate, Set<Date> list) {
- // uses: occurrences,interval(only if lastdate set),dayOfMonth
- // loop from beginning of series (not beginning of interval!)
- Date d = cal.getTime();
- int count = 0;// of occurences
- while (d.compareTo(endDate) <= 0) {
- // check dayOfMonth
- Calendar monthCal = Calendar.getInstance();
- monthCal.setTime(d);
- // shift day back if necessary (31,30,29)
- int dayOfCurrentMonth = m_dayOfMonth;
- if (dayOfCurrentMonth > monthCal.getActualMaximum(Calendar.DAY_OF_MONTH)) {
- dayOfCurrentMonth = monthCal.getActualMaximum(Calendar.DAY_OF_MONTH);
- }
- for (int i = 0; i < 31; i++) {
- if (monthCal.get(Calendar.DAY_OF_MONTH) == dayOfCurrentMonth) {
- // valid
- Date dMonth = monthCal.getTime();
- count++;
- // add, if in requested interval
- if (dMonth.compareTo(startDate) >= 0) {
- list.add(dMonth);
- }
- break;
- }
- // next monthday
- monthCal.add(Calendar.DAY_OF_MONTH, 1);
- }
- // next
- cal.add(Calendar.MONTH, m_interval);
- d = cal.getTime();
- /**
- * @rn sle, 05.07.2006,
- * @since Build 204 Bugfix to ensure value 'occurrences' is realy true
- * reported by MBR, ORS / SSC, BAP PK
- */
- if (m_noEndDate == false) {
- if (m_lastDate == null) {
- if (count >= m_occurrences) {
- break;
- }
- }
- }
- }
- }
-
- private void createMonthlySpecStartDates(Calendar cal, Date startDate, Date endDate, Set<Date> list) {
- // uses: occurrences,interval(only if lastdate set),instance,dayOfWeekBits
- // loop from beginning of series (not beginning of interval!)
- Date d = cal.getTime();
- int count = 0;// of occurences
- int inst = 0;
- switch (m_instance) {
- case INST_FIRST:
- inst = 1;
- break;
- case INST_SECOND:
- inst = 2;
- break;
- case INST_THIRD:
- inst = 3;
- break;
- case INST_FOURTH:
- inst = 4;
- break;
- case INST_LAST:
- inst = 1000000;
- break;
- }
- while (d.compareTo(endDate) <= 0) {
- // check dayOfMonth
- Calendar monthCal = Calendar.getInstance();
- monthCal.setTime(d);
- int instCount = 0;
- Date lastValid = null;
- for (int i = 1, ni = monthCal.getActualMaximum(Calendar.DAY_OF_MONTH); i <= ni; i++) {
- monthCal.set(Calendar.DATE, i);
- if (isInWeekMask(m_dayOfWeekBits, monthCal)) {
- lastValid = monthCal.getTime();
- instCount++;
- if (instCount == inst) {
- break;
- }
- }
- }
- if (lastValid != null && lastValid.compareTo(m_firstDate) >= 0) {
- // valid
- // Date dMonth=monthCal.getTime();
- count++;
- // add, if in requested interval
- if (lastValid.compareTo(startDate) >= 0) {
- list.add(lastValid);
- }
- }
- // next
- cal.add(Calendar.MONTH, m_interval);
- d = cal.getTime();
- /**
- * @rn sle, 05.07.2006,
- * @since Build 204 Bugfix to ensure value 'occurrences' is realy true
- * reported by MBR, ORS / SSC, BAP PK
- */
- if (m_noEndDate == false) {
- if (m_lastDate == null) {
- if (count >= m_occurrences) {
- break;
- }
- }
- }
- }
- }
-
- private void createYearlyStartDates(Calendar cal, Date startDate, Date endDate, Set<Date> list) {
- // uses: occurrences,interval(only if lastdate set),dayOfMonth,monthOfYear
- // loop from beginning of series (not beginning of interval!)
- Date d = cal.getTime();
- int count = 0;// of occurences
- while (d.compareTo(endDate) <= 0) {
- // check monthOfYear
- Calendar monthCal = Calendar.getInstance();
- monthCal.setTime(d);
- monthCal.set(Calendar.DAY_OF_MONTH, 1);
- monthCal.set(Calendar.MONTH, m_monthOfYear - 1);
- monthCal.set(Calendar.DAY_OF_MONTH, m_dayOfMonth);
- if (monthCal.getTime().compareTo(m_firstDate) >= 0) {
- // valid
- Date dMonth = monthCal.getTime();
- count++;
- // add, if in requested interval
- if (dMonth.compareTo(startDate) >= 0) {
- list.add(dMonth);
- }
- }
- // next
- cal.add(Calendar.YEAR, m_interval);
- d = cal.getTime();
- /**
- * @rn sle, 05.07.2006,
- * @since Build 204 Bugfix to ensure value 'occurrences' is realy true
- * reported by MBR, ORS / SSC, BAP PK
- */
- if (m_noEndDate == false) {
- if (m_lastDate == null) {
- if (count >= m_occurrences) {
- break;
- }
- }
- }
- }
- }
-
- private void createYearlySpecStartDates(Calendar cal, Date startDate, Date endDate, Set<Date> list) {
- // uses: occurrences,interval(only if lastdate
- // set),instance,dayOfWeekBits,monthOfYear
- // loop from beginning of series (not beginning of interval!)
- Date d = cal.getTime();
- int count = 0;// of occurences
- int inst = 0;
- switch (m_instance) {
- case INST_FIRST:
- inst = 1;
- break;
- case INST_SECOND:
- inst = 2;
- break;
- case INST_THIRD:
- inst = 3;
- break;
- case INST_FOURTH:
- inst = 4;
- break;
- case INST_LAST:
- inst = 100000;
- break;
- }
- while (d.compareTo(endDate) <= 0) {
- // check monthOfYear
- Calendar monthCal = Calendar.getInstance();
- monthCal.setTime(d);
- monthCal.set(Calendar.DAY_OF_MONTH, 1);
- monthCal.set(Calendar.MONTH, m_monthOfYear - 1);
- int instCount = 0;
- Date lastValid = null;
- for (int i = 1, ni = monthCal.getActualMaximum(Calendar.DAY_OF_MONTH); i <= ni; i++) {
- monthCal.set(Calendar.DATE, i);
- if (isInWeekMask(m_dayOfWeekBits, monthCal)) {
- lastValid = monthCal.getTime();
- instCount++;
- if (instCount == inst) {
- break;
- }
- }
- }
- if (lastValid != null && lastValid.compareTo(m_firstDate) >= 0) {
- // valid
- count++;
- // add, if in requested interval
- if (lastValid.compareTo(startDate) >= 0) {
- list.add(lastValid);
- }
- }
- // next
- cal.add(Calendar.YEAR, m_interval);
- d = cal.getTime();
- /**
- * @rn sle, 05.07.2006,
- * @since Build 204 Bugfix to ensure value 'occurrences' is realy true
- * reported by MBR, ORS / SSC, BAP PK
- */
- if (m_noEndDate == false) {
- if (m_lastDate == null) {
- if (count >= m_occurrences) {
- break;
- }
- }
- }
- }
- }
-
- public static Date applyTime(Date d, int hour, int minute, int second) {
- if (d != null) {
- Calendar cal = Calendar.getInstance();
- cal.setTime(d);
- cal.set(Calendar.HOUR, 0);
- cal.set(Calendar.HOUR_OF_DAY, hour);
- cal.set(Calendar.MINUTE, minute);
- cal.set(Calendar.SECOND, second);
- cal.set(Calendar.MILLISECOND, 0);
- d = cal.getTime();
- }
- return d;
- }
-
- @Override
- public String toString() {
- StringBuffer buf = new StringBuffer("Pattern[");
- buf.append("startTimeMinutes=" + m_startTimeMinutes + ",");
- buf.append("endTimeMinutes=" + m_endTimeMinutes + ",");
- buf.append("durationMinutes=" + m_durationMinutes + ",");
- buf.append("firstDate=" + m_firstDate + ",");
- buf.append("lastDate=" + m_lastDate + ",");
- buf.append("occurrences=" + m_occurrences + ",");
- buf.append("type=" + m_type + ",");
- buf.append("interval=" + m_interval + ",");
- buf.append("instance=" + m_instance + ",");
- buf.append("dayOfWeekBits=" + Integer.toBinaryString(m_dayOfWeekBits) + ",");
- buf.append("dayOfMonth=" + m_dayOfMonth + ",");
- buf.append("regenerate=" + m_regenerate + ",");
- buf.append("]");
- return buf.toString();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.calendar;
+
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
+
+public class RecurrencePattern implements java.io.Serializable {
+ private static final long serialVersionUID = 1L;
+ //
+ public static final int TYPE_DAILY = 119535;
+ public static final int TYPE_WEEKLY = 119536;
+ public static final int TYPE_MONTHLY = 119537;
+ public static final int TYPE_MONTHLY_SPEC = 119538;
+ public static final int TYPE_YEARLY = 119539;
+ public static final int TYPE_YEARLY_SPEC = 119540;
+ //
+ public static final int INST_FIRST = 119530;
+ public static final int INST_SECOND = 119531;
+ public static final int INST_THIRD = 119532;
+ public static final int INST_FOURTH = 119533;
+ public static final int INST_LAST = 119534;
+ public static final int INST_NONE = 0;
+ //
+ /**
+ * same as {@value Calendar#SUNDAY}
+ */
+ public static final int MASK_SUN = 1;
+ /**
+ * same as {@value Calendar#MONDAY}
+ */
+ public static final int MASK_MON = 2;
+ /**
+ * same as {@value Calendar#TUESDAY}
+ */
+ public static final int MASK_TUE = 4;
+ /**
+ * same as {@value Calendar#WEDNESDAY}
+ */
+ public static final int MASK_WED = 8;
+ /**
+ * same as {@value Calendar#THURSDAY}
+ */
+ public static final int MASK_THU = 16;
+ /**
+ * same as {@value Calendar#FRIDAY}
+ */
+ public static final int MASK_FRI = 32;
+ /**
+ * same as {@value Calendar#SATURDAY}
+ */
+ public static final int MASK_SAT = 64;
+
+ private long m_lastModified;
+ private boolean m_regenerate;
+ private int m_startTimeMinutes;
+ private int m_endTimeMinutes;
+ private int m_durationMinutes;
+ private Date m_firstDate;
+ private Date m_lastDate;
+ private int m_occurrences;
+ private boolean m_noEndDate;
+ private int m_type;
+ private int m_interval;
+ private int m_instance;
+ private int m_dayOfWeekBits;
+ /**
+ * value startw with 1
+ */
+ private int m_dayOfMonth;
+ /**
+ * value startw with 1
+ */
+ private int m_monthOfYear;
+ private ArrayList<RecurrenceException> m_recurrenceExceptions = new ArrayList<RecurrenceException>();
+
+ public RecurrencePattern() {
+ }
+
+ public long getLastModified() {
+ return m_lastModified;
+ }
+
+ public void setLastModified(long b) {
+ m_lastModified = b;
+ }
+
+ public void setRegenerate(boolean v) {
+ m_regenerate = v;
+ }
+
+ public boolean isRegenerate() {
+ return m_regenerate;
+ }
+
+ public void setStartTimeMinutes(int v) {
+ m_startTimeMinutes = v;
+ }
+
+ public int getStartTimeMinutes() {
+ return m_startTimeMinutes;
+ }
+
+ public void setEndTimeMinutes(int v) {
+ m_endTimeMinutes = v;
+ }
+
+ public int getEndTimeMinutes() {
+ return m_endTimeMinutes;
+ }
+
+ public void setStartTimeAsDate(Date d) {
+ if (d != null) {
+ Calendar c = Calendar.getInstance();
+ c.setTime(d);
+ m_startTimeMinutes = c.get(Calendar.HOUR_OF_DAY) * 60 + c.get(Calendar.MINUTE);
+ }
+ }
+
+ public Date getStartTimeAsDate() {
+ Calendar c = Calendar.getInstance();
+ c.set(2000, 1, 1, m_startTimeMinutes / 60, m_startTimeMinutes % 60, 0);
+ return c.getTime();
+ }
+
+ public void setEndTimeAsDate(Date d) {
+ if (d != null) {
+ Calendar c = Calendar.getInstance();
+ c.setTime(d);
+ m_endTimeMinutes = c.get(Calendar.HOUR_OF_DAY) * 60 + c.get(Calendar.MINUTE);
+ }
+ }
+
+ public Date getEndTimeAsDate() {
+ Calendar c = Calendar.getInstance();
+ c.set(2000, 1, 1, m_endTimeMinutes / 60, m_endTimeMinutes % 60, 0);
+ return c.getTime();
+ }
+
+ public void setDurationMinutes(int v) {
+ if (v > 0x10000000) {
+ v = 0;
+ }
+ m_durationMinutes = v;
+ }
+
+ public int getDurationMinutes() {
+ return m_durationMinutes;
+ }
+
+ public void setFirstDate(Date v) {
+ m_firstDate = v;
+ }
+
+ public Date getFirstDate() {
+ return m_firstDate;
+ }
+
+ public void setLastDate(Date v) {
+ m_lastDate = v;
+ }
+
+ public Date getLastDate() {
+ return m_lastDate;
+ }
+
+ public void setOccurrences(int v) {
+ m_occurrences = v;
+ }
+
+ public int getOccurrences() {
+ return m_occurrences;
+ }
+
+ public void setNoEndDate(boolean v) {
+ m_noEndDate = v;
+ }
+
+ public boolean getNoEndDate() {
+ return m_noEndDate;
+ }
+
+ public void setType(int v) {
+ if (v < TYPE_DAILY || v > TYPE_YEARLY_SPEC) {
+ throw new IllegalArgumentException("type (" + v + ") must be in [TYPE_DAILY,TYPE_YEARLY_SPEC]");
+ }
+ m_type = v;
+ }
+
+ public int getType() {
+ return m_type;
+ }
+
+ public void setInterval(int v) {
+ m_interval = v;
+ }
+
+ public int getInterval() {
+ return m_interval;
+ }
+
+ public void setInstance(int v) {
+ if (v != 0 && (v < INST_FIRST || v > INST_LAST)) {
+ throw new IllegalArgumentException("instance (" + v + ") must be in [INST_FIRST,INST_LAST]");
+ }
+ m_instance = v;
+ }
+
+ public int getInstance() {
+ return m_instance;
+ }
+
+ public void setDayOfWeek(int bits) {
+ m_dayOfWeekBits = bits;
+ }
+
+ public int getDayOfWeek() {
+ return m_dayOfWeekBits;
+ }
+
+ /**
+ * value startw with 1
+ */
+ public void setDayOfMonth(int v) {
+ m_dayOfMonth = v;
+ }
+
+ /**
+ * value startw with 1
+ */
+ public int getDayOfMonth() {
+ return m_dayOfMonth;
+ }
+
+ /**
+ * value startw with 1
+ */
+ public void setMonthOfYear(int v) {
+ m_monthOfYear = v;
+ }
+
+ /**
+ * value startw with 1
+ */
+ public int getMonthOfYear() {
+ return m_monthOfYear;
+ }
+
+ public List<RecurrenceException> getRecurrenceExceptions() {
+ return m_recurrenceExceptions;
+ }
+
+ public void addRecurrenceException(RecurrenceException ex) {
+ m_recurrenceExceptions.add(ex);
+ }
+
+ /**
+ * Recurrence series provider
+ */
+ public Set<Date> createStartDates(Date startDate, Date endDate) {
+ if (m_firstDate != null && m_firstDate.after(startDate)) {
+ startDate = m_firstDate;
+ }
+ if (m_lastDate != null && m_lastDate.before(endDate)) {
+ endDate = m_lastDate;
+ }
+ // startDate has time=00:00:00
+ startDate = applyTime(startDate, 0, 0, 0);
+ // endDate has time=23:59:59
+ endDate = applyTime(endDate, 23, 59, 59);
+ // build first date/time
+ int min = getStartTimeMinutes() % (24 * 60);
+ GregorianCalendar startRecCal = new GregorianCalendar();
+ startRecCal.setTime(applyTime(m_firstDate, min / 60, min % 60, 0));
+ TreeSet<Date> list = new TreeSet<Date>();
+ if (m_interval <= 0) {
+ m_interval = 1;
+ }
+ switch (getType()) {
+ case TYPE_DAILY: {
+ createDailyStartDates(startRecCal, startDate, endDate, list);
+ break;
+ }
+ case TYPE_WEEKLY: {
+ createWeeklyStartDates(startRecCal, startDate, endDate, list);
+ break;
+ }
+ case TYPE_MONTHLY: {
+ createMonthlyStartDates(startRecCal, startDate, endDate, list);
+ break;
+ }
+ case TYPE_MONTHLY_SPEC: {
+ createMonthlySpecStartDates(startRecCal, startDate, endDate, list);
+ break;
+ }
+ case TYPE_YEARLY: {
+ createYearlyStartDates(startRecCal, startDate, endDate, list);
+ break;
+ }
+ case TYPE_YEARLY_SPEC: {
+ createYearlySpecStartDates(startRecCal, startDate, endDate, list);
+ break;
+ }
+ }
+ // remove exceptions
+ for (Iterator<RecurrenceException> it = m_recurrenceExceptions.iterator(); it.hasNext();) {
+ RecurrenceException recEx = it.next();
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(recEx.getOriginalStartDate());
+ cal.set(Calendar.HOUR, 0);
+ cal.set(Calendar.HOUR_OF_DAY, min / 60);
+ cal.set(Calendar.MINUTE, min % 60);
+ cal.set(Calendar.SECOND, 0);
+ cal.set(Calendar.MILLISECOND, 0);
+ list.remove(cal.getTime());
+ }
+ return list;
+ }
+
+ private void createDailyStartDates(Calendar cal, Date startDate, Date endDate, Set<Date> list) {
+ // uses: occurrences,interval(only if lastdate set)
+ // loop from beginning of series (not beginning of interval!)
+ Date d = cal.getTime();
+ int count = 0;// of occurences
+ while (d.compareTo(endDate) <= 0) {
+ // valid
+ count++;
+ // add, if in requested interval
+ if (d.compareTo(startDate) >= 0) {
+ list.add(d);
+ }
+ // next
+ cal.add(Calendar.DATE, m_interval);
+ d = cal.getTime();
+ /**
+ * @rn sle, 05.07.2006,
+ * @since Build 204 Bugfix to ensure value 'occurrences' is realy true
+ * reported by MBR, ORS / SSC, BAP PK
+ */
+ if (m_noEndDate == false) {
+ if (m_lastDate == null) {
+ if (count >= m_occurrences) {
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ private boolean isInWeekMask(int bitMask, Calendar cal) {
+ return (bitMask & (1 << (cal.get(Calendar.DAY_OF_WEEK) - 1))) != 0;
+ }
+
+ private void createWeeklyStartDates(Calendar cal, Date startDate, Date endDate, Set<Date> list) {
+ // uses: occurrences,interval(only if lastdate set),dayOfWeekBits
+ // loop from beginning of series (not beginning of interval!)
+ Date d = cal.getTime();
+ int count = 0;// of occurences
+ while (d.compareTo(endDate) <= 0) {
+ // check weekdays
+ Calendar weekCal = Calendar.getInstance();
+ weekCal.setTime(d);
+ for (int i = 0; i < 7; i++) {
+ if (isInWeekMask(m_dayOfWeekBits, weekCal)) {
+ // valid
+ Date dWeek = weekCal.getTime();
+ count++;
+ // add, if in requested interval
+ if (dWeek.compareTo(startDate) >= 0) {
+ list.add(dWeek);
+ }
+ /**
+ * @rn sle, 05.07.2006,
+ * @since Build 204 Bugfix to ensure value 'occurrences' is realy true
+ * reported by MBR, ORS / SSC, BAP PK
+ */
+ if (m_noEndDate == false) {
+ if (m_lastDate == null) {
+ if (count >= m_occurrences) {
+ break;
+ }
+ }
+ }
+ }
+ // next weekday
+ weekCal.add(Calendar.DATE, 1);
+ }
+ // next
+ cal.add(Calendar.WEEK_OF_YEAR, m_interval);
+ d = cal.getTime();
+ /**
+ * @rn sle, 05.07.2006,
+ * @since Build 204 Bugfix to ensure value 'occurrences' is realy true
+ * reported by MBR, ORS / SSC, BAP PK
+ */
+ if (m_noEndDate == false) {
+ if (m_lastDate == null) {
+ if (count >= m_occurrences) {
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ private void createMonthlyStartDates(Calendar cal, Date startDate, Date endDate, Set<Date> list) {
+ // uses: occurrences,interval(only if lastdate set),dayOfMonth
+ // loop from beginning of series (not beginning of interval!)
+ Date d = cal.getTime();
+ int count = 0;// of occurences
+ while (d.compareTo(endDate) <= 0) {
+ // check dayOfMonth
+ Calendar monthCal = Calendar.getInstance();
+ monthCal.setTime(d);
+ // shift day back if necessary (31,30,29)
+ int dayOfCurrentMonth = m_dayOfMonth;
+ if (dayOfCurrentMonth > monthCal.getActualMaximum(Calendar.DAY_OF_MONTH)) {
+ dayOfCurrentMonth = monthCal.getActualMaximum(Calendar.DAY_OF_MONTH);
+ }
+ for (int i = 0; i < 31; i++) {
+ if (monthCal.get(Calendar.DAY_OF_MONTH) == dayOfCurrentMonth) {
+ // valid
+ Date dMonth = monthCal.getTime();
+ count++;
+ // add, if in requested interval
+ if (dMonth.compareTo(startDate) >= 0) {
+ list.add(dMonth);
+ }
+ break;
+ }
+ // next monthday
+ monthCal.add(Calendar.DAY_OF_MONTH, 1);
+ }
+ // next
+ cal.add(Calendar.MONTH, m_interval);
+ d = cal.getTime();
+ /**
+ * @rn sle, 05.07.2006,
+ * @since Build 204 Bugfix to ensure value 'occurrences' is realy true
+ * reported by MBR, ORS / SSC, BAP PK
+ */
+ if (m_noEndDate == false) {
+ if (m_lastDate == null) {
+ if (count >= m_occurrences) {
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ private void createMonthlySpecStartDates(Calendar cal, Date startDate, Date endDate, Set<Date> list) {
+ // uses: occurrences,interval(only if lastdate set),instance,dayOfWeekBits
+ // loop from beginning of series (not beginning of interval!)
+ Date d = cal.getTime();
+ int count = 0;// of occurences
+ int inst = 0;
+ switch (m_instance) {
+ case INST_FIRST:
+ inst = 1;
+ break;
+ case INST_SECOND:
+ inst = 2;
+ break;
+ case INST_THIRD:
+ inst = 3;
+ break;
+ case INST_FOURTH:
+ inst = 4;
+ break;
+ case INST_LAST:
+ inst = 1000000;
+ break;
+ }
+ while (d.compareTo(endDate) <= 0) {
+ // check dayOfMonth
+ Calendar monthCal = Calendar.getInstance();
+ monthCal.setTime(d);
+ int instCount = 0;
+ Date lastValid = null;
+ for (int i = 1, ni = monthCal.getActualMaximum(Calendar.DAY_OF_MONTH); i <= ni; i++) {
+ monthCal.set(Calendar.DATE, i);
+ if (isInWeekMask(m_dayOfWeekBits, monthCal)) {
+ lastValid = monthCal.getTime();
+ instCount++;
+ if (instCount == inst) {
+ break;
+ }
+ }
+ }
+ if (lastValid != null && lastValid.compareTo(m_firstDate) >= 0) {
+ // valid
+ // Date dMonth=monthCal.getTime();
+ count++;
+ // add, if in requested interval
+ if (lastValid.compareTo(startDate) >= 0) {
+ list.add(lastValid);
+ }
+ }
+ // next
+ cal.add(Calendar.MONTH, m_interval);
+ d = cal.getTime();
+ /**
+ * @rn sle, 05.07.2006,
+ * @since Build 204 Bugfix to ensure value 'occurrences' is realy true
+ * reported by MBR, ORS / SSC, BAP PK
+ */
+ if (m_noEndDate == false) {
+ if (m_lastDate == null) {
+ if (count >= m_occurrences) {
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ private void createYearlyStartDates(Calendar cal, Date startDate, Date endDate, Set<Date> list) {
+ // uses: occurrences,interval(only if lastdate set),dayOfMonth,monthOfYear
+ // loop from beginning of series (not beginning of interval!)
+ Date d = cal.getTime();
+ int count = 0;// of occurences
+ while (d.compareTo(endDate) <= 0) {
+ // check monthOfYear
+ Calendar monthCal = Calendar.getInstance();
+ monthCal.setTime(d);
+ monthCal.set(Calendar.DAY_OF_MONTH, 1);
+ monthCal.set(Calendar.MONTH, m_monthOfYear - 1);
+ monthCal.set(Calendar.DAY_OF_MONTH, m_dayOfMonth);
+ if (monthCal.getTime().compareTo(m_firstDate) >= 0) {
+ // valid
+ Date dMonth = monthCal.getTime();
+ count++;
+ // add, if in requested interval
+ if (dMonth.compareTo(startDate) >= 0) {
+ list.add(dMonth);
+ }
+ }
+ // next
+ cal.add(Calendar.YEAR, m_interval);
+ d = cal.getTime();
+ /**
+ * @rn sle, 05.07.2006,
+ * @since Build 204 Bugfix to ensure value 'occurrences' is realy true
+ * reported by MBR, ORS / SSC, BAP PK
+ */
+ if (m_noEndDate == false) {
+ if (m_lastDate == null) {
+ if (count >= m_occurrences) {
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ private void createYearlySpecStartDates(Calendar cal, Date startDate, Date endDate, Set<Date> list) {
+ // uses: occurrences,interval(only if lastdate
+ // set),instance,dayOfWeekBits,monthOfYear
+ // loop from beginning of series (not beginning of interval!)
+ Date d = cal.getTime();
+ int count = 0;// of occurences
+ int inst = 0;
+ switch (m_instance) {
+ case INST_FIRST:
+ inst = 1;
+ break;
+ case INST_SECOND:
+ inst = 2;
+ break;
+ case INST_THIRD:
+ inst = 3;
+ break;
+ case INST_FOURTH:
+ inst = 4;
+ break;
+ case INST_LAST:
+ inst = 100000;
+ break;
+ }
+ while (d.compareTo(endDate) <= 0) {
+ // check monthOfYear
+ Calendar monthCal = Calendar.getInstance();
+ monthCal.setTime(d);
+ monthCal.set(Calendar.DAY_OF_MONTH, 1);
+ monthCal.set(Calendar.MONTH, m_monthOfYear - 1);
+ int instCount = 0;
+ Date lastValid = null;
+ for (int i = 1, ni = monthCal.getActualMaximum(Calendar.DAY_OF_MONTH); i <= ni; i++) {
+ monthCal.set(Calendar.DATE, i);
+ if (isInWeekMask(m_dayOfWeekBits, monthCal)) {
+ lastValid = monthCal.getTime();
+ instCount++;
+ if (instCount == inst) {
+ break;
+ }
+ }
+ }
+ if (lastValid != null && lastValid.compareTo(m_firstDate) >= 0) {
+ // valid
+ count++;
+ // add, if in requested interval
+ if (lastValid.compareTo(startDate) >= 0) {
+ list.add(lastValid);
+ }
+ }
+ // next
+ cal.add(Calendar.YEAR, m_interval);
+ d = cal.getTime();
+ /**
+ * @rn sle, 05.07.2006,
+ * @since Build 204 Bugfix to ensure value 'occurrences' is realy true
+ * reported by MBR, ORS / SSC, BAP PK
+ */
+ if (m_noEndDate == false) {
+ if (m_lastDate == null) {
+ if (count >= m_occurrences) {
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ public static Date applyTime(Date d, int hour, int minute, int second) {
+ if (d != null) {
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(d);
+ cal.set(Calendar.HOUR, 0);
+ cal.set(Calendar.HOUR_OF_DAY, hour);
+ cal.set(Calendar.MINUTE, minute);
+ cal.set(Calendar.SECOND, second);
+ cal.set(Calendar.MILLISECOND, 0);
+ d = cal.getTime();
+ }
+ return d;
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer buf = new StringBuffer("Pattern[");
+ buf.append("startTimeMinutes=" + m_startTimeMinutes + ",");
+ buf.append("endTimeMinutes=" + m_endTimeMinutes + ",");
+ buf.append("durationMinutes=" + m_durationMinutes + ",");
+ buf.append("firstDate=" + m_firstDate + ",");
+ buf.append("lastDate=" + m_lastDate + ",");
+ buf.append("occurrences=" + m_occurrences + ",");
+ buf.append("type=" + m_type + ",");
+ buf.append("interval=" + m_interval + ",");
+ buf.append("instance=" + m_instance + ",");
+ buf.append("dayOfWeekBits=" + Integer.toBinaryString(m_dayOfWeekBits) + ",");
+ buf.append("dayOfMonth=" + m_dayOfMonth + ",");
+ buf.append("regenerate=" + m_regenerate + ",");
+ buf.append("]");
+ return buf.toString();
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/clientnotification/AbstractClientNotification.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/clientnotification/AbstractClientNotification.java
index 0309fa4626..5467e878a4 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/clientnotification/AbstractClientNotification.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/clientnotification/AbstractClientNotification.java
@@ -1,40 +1,40 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.clientnotification;
-
-public abstract class AbstractClientNotification implements IClientNotification {
- private static final long serialVersionUID = 1L;
- private int m_node;
-
- @Override
- public int getOriginNode() {
- return m_node;
- }
-
- @Override
- public void setOriginNode(int node) {
- m_node = node;
- }
-
- /**
- * backward legacy, this method is removed in the next release
- *
- * @deprecated use IClientNotificationConsumerListener on the ClientNotificationConsumerService
- */
- @Deprecated
- public final void run() throws Throwable {
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.clientnotification;
+
+public abstract class AbstractClientNotification implements IClientNotification {
+ private static final long serialVersionUID = 1L;
+ private int m_node;
+
+ @Override
+ public int getOriginNode() {
+ return m_node;
+ }
+
+ @Override
+ public void setOriginNode(int node) {
+ m_node = node;
+ }
+
+ /**
+ * backward legacy, this method is removed in the next release
+ *
+ * @deprecated use IClientNotificationConsumerListener on the ClientNotificationConsumerService
+ */
+ @Deprecated
+ public final void run() throws Throwable {
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName();
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/clientnotification/IClientNotification.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/clientnotification/IClientNotification.java
index 0db078e13f..28e556ed08 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/clientnotification/IClientNotification.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/clientnotification/IClientNotification.java
@@ -1,59 +1,59 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.clientnotification;
-
-import java.io.Serializable;
-
-/**
- * Client notifications are used to trigger events from the server to the client
- * (reverse HTTP) <br>
- * These notifications are collected on the server side in a {@link ClientNotificationQueue} /
- * {@link J2eeClientNotificationQueue} and
- * fetched by the {@link ClientNotificationConsumer} using {@link IClientNotificationService} with intelligent polling
- * Note that client
- * notifications must be serializable because they are transferred between
- * server and client. <br>
- * All client notifications must therefore be defined in "shared" plugins known
- * by server and client.
- * <p>
- * Examples:
- * <code>AccessControlChangedNotification, SharedContextChangedNotification, CodeTypeChangedNotification</code>
- */
-public interface IClientNotification extends Serializable {
-
- /**
- * Merge with other notifications of the same type Same type means
- * n1.getClass()==n2.getClass()
- *
- * @return true if existingNotification was coalesced and therefore is
- * consumed. The existingNotification is then removed from the queue.
- */
- boolean coalesce(IClientNotification existingNotification);
-
- /**
- * Gets the node where the notification is orignially fired. This is for
- * cluster environment.
- *
- * @return node (the property com.bsiag.crm.server#nodeId is one of
- * com.bsiag.crm.server#nodeId1...com.bsiag.crm.server#nodeIdn)
- */
- int getOriginNode();
-
- /**
- * Sets the node where the notification is orignially fired. This is for
- * cluster environment.
- *
- * @param node
- * (the property com.bsiag.crm.server#nodeId is one of
- * com.bsiag.crm.server#nodeId1...com.bsiag.crm.server#nodeIdn)
- */
- void setOriginNode(int node);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.clientnotification;
+
+import java.io.Serializable;
+
+/**
+ * Client notifications are used to trigger events from the server to the client
+ * (reverse HTTP) <br>
+ * These notifications are collected on the server side in a {@link ClientNotificationQueue} /
+ * {@link J2eeClientNotificationQueue} and
+ * fetched by the {@link ClientNotificationConsumer} using {@link IClientNotificationService} with intelligent polling
+ * Note that client
+ * notifications must be serializable because they are transferred between
+ * server and client. <br>
+ * All client notifications must therefore be defined in "shared" plugins known
+ * by server and client.
+ * <p>
+ * Examples:
+ * <code>AccessControlChangedNotification, SharedContextChangedNotification, CodeTypeChangedNotification</code>
+ */
+public interface IClientNotification extends Serializable {
+
+ /**
+ * Merge with other notifications of the same type Same type means
+ * n1.getClass()==n2.getClass()
+ *
+ * @return true if existingNotification was coalesced and therefore is
+ * consumed. The existingNotification is then removed from the queue.
+ */
+ boolean coalesce(IClientNotification existingNotification);
+
+ /**
+ * Gets the node where the notification is orignially fired. This is for
+ * cluster environment.
+ *
+ * @return node (the property com.bsiag.crm.server#nodeId is one of
+ * com.bsiag.crm.server#nodeId1...com.bsiag.crm.server#nodeIdn)
+ */
+ int getOriginNode();
+
+ /**
+ * Sets the node where the notification is orignially fired. This is for
+ * cluster environment.
+ *
+ * @param node
+ * (the property com.bsiag.crm.server#nodeId is one of
+ * com.bsiag.crm.server#nodeId1...com.bsiag.crm.server#nodeIdn)
+ */
+ void setOriginNode(int node);
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/code/AbstractCode.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/code/AbstractCode.java
index 7e16f86f32..a9f7296473 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/code/AbstractCode.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/code/AbstractCode.java
@@ -1,392 +1,392 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.code;
-
-import java.io.ObjectStreamException;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-
-import org.eclipse.scout.commons.ConfigurationUtility;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.shared.data.basic.FontSpec;
-
-public abstract class AbstractCode<T> implements ICode<T>, Serializable {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractCode.class);
- private static final long serialVersionUID = 1L;
-
- private transient ICodeType m_codeType;
- private CodeRow m_row;
- private transient ICode m_parentCode;
- private transient HashMap<Object, ICode> m_codeMap = null;
- private ArrayList<ICode> m_codeList = null;
-
- /**
- * Dynamic
- */
- public AbstractCode(CodeRow row) {
- m_row = row;
- }
-
- /**
- * Configured
- */
- public AbstractCode() {
- initConfig();
- }
-
- @ConfigProperty(ConfigProperty.TEXT)
- @Order(50)
- @ConfigPropertyValue("null")
- protected String getConfiguredText() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(60)
- @ConfigPropertyValue("true")
- protected boolean getConfiguredActive() {
- return true;
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(65)
- @ConfigPropertyValue("true")
- protected boolean getConfiguredEnabled() {
- return true;
- }
-
- @ConfigProperty(ConfigProperty.ICON_ID)
- @Order(40)
- @ConfigPropertyValue("null")
- protected String getConfiguredIconId() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.TEXT)
- @Order(70)
- @ConfigPropertyValue("null")
- protected String getConfiguredTooltipText() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.STRING)
- @Order(20)
- @ConfigPropertyValue("null")
- protected String getConfiguredBackgroundColor() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.STRING)
- @Order(10)
- @ConfigPropertyValue("null")
- protected String getConfiguredForegroundColor() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.STRING)
- @Order(30)
- @ConfigPropertyValue("null")
- protected String getConfiguredFont() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.DOUBLE)
- @Order(80)
- @ConfigPropertyValue("null")
- protected Double getConfiguredValue() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.STRING)
- @Order(80)
- @ConfigPropertyValue("null")
- protected String getConfiguredExtKey() {
- return null;
- }
-
- private Class<? extends ICode>[] getConfiguredCodes() {
- Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
- return ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, ICode.class);
- }
-
- protected void initConfig() {
- m_row = interceptCodeRow(new CodeRow(
- getId(),
- getConfiguredText(),
- getConfiguredIconId(),
- getConfiguredTooltipText() != null ? getConfiguredTooltipText() : null,
- (getConfiguredBackgroundColor()),
- (getConfiguredForegroundColor()),
- FontSpec.parse(getConfiguredFont()),
- getConfiguredEnabled(),
- null,
- getConfiguredActive(),
- getConfiguredExtKey(),
- getConfiguredValue(),
- 0
- ));
- // add configured child codes
- Class<? extends ICode>[] a = getConfiguredCodes();
- if (a != null) {
- for (int i = 0; i < a.length; i++) {
- try {
- ICode code = ConfigurationUtility.newInnerInstance(this, a[i]);
- addChildCodeInternal(code);
- }
- catch (Exception e) {
- LOG.warn(null, e);
- }
- }
- }
- }
-
- /**
- * This interception method is called from the {@link #initConfig()} method just on construction of the code object.
- * <p>
- * Override this method to change that code row used by this code or to return a different code row than the default.
- * <p>
- * The defaukt does nothing and returns the argument row.
- */
- protected CodeRow interceptCodeRow(CodeRow row) {
- return row;
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public T getId() {
- return (T) m_row.getKey();
- }
-
- @Override
- public String getText() {
- return m_row.getText();
- }
-
- @Override
- public boolean isActive() {
- return m_row.isActive();
- }
-
- /**
- * Do only call this method during creation and setup of a code / code type.
- * <p>
- * Never call it afterwards, this may lead to conflicting situations when {@link ICode}s are in use and references.
- */
- public void setActiveInternal(boolean b) {
- m_row.setActive(b);
- }
-
- @Override
- public boolean isEnabled() {
- return m_row.isEnabled();
- }
-
- /**
- * Do only call this method during creation and setup of a code / code type.
- * <p>
- * Never call it afterwards, this may lead to conflicting situations when {@link ICode}s are in use and references.
- */
- public void setEnabledInternal(boolean b) {
- m_row.setEnabled(b);
- }
-
- @Override
- public String getIconId() {
- String id = m_row.getIconId();
- if (id == null && m_codeType != null) {
- id = m_codeType.getIconId();
- }
- return id;
- }
-
- @Override
- public String getTooltipText() {
- return m_row.getTooltip();
- }
-
- @Override
- public String getBackgroundColor() {
- return m_row.getBackgroundColor();
- }
-
- @Override
- public String getForegroundColor() {
- return m_row.getForegroundColor();
- }
-
- @Override
- public FontSpec getFont() {
- return m_row.getFont();
- }
-
- @Override
- public ICode getParentCode() {
- return m_parentCode;
- }
-
- @Override
- public long getPartitionId() {
- return m_row.getPartitionId();
- }
-
- @Override
- public String getExtKey() {
- return m_row.getExtKey();
- }
-
- @Override
- public Number getValue() {
- return m_row.getValue();
- }
-
- @Override
- public ICode[] getChildCodes() {
- return getChildCodes(true);
- }
-
- @Override
- public ICode[] getChildCodes(boolean activeOnly) {
- if (m_codeList == null) {
- return new ICode[0];
- }
- ArrayList<ICode> list = new ArrayList<ICode>(m_codeList);
- if (activeOnly) {
- for (Iterator it = list.iterator(); it.hasNext();) {
- ICode code = (ICode) it.next();
- if (!code.isActive()) {
- it.remove();
- }
- }
- }
- return list.toArray(new ICode[0]);
- }
-
- @Override
- public ICode getChildCode(Object id) {
- ICode c = null;
- if (m_codeMap != null) {
- c = m_codeMap.get(id);
- }
- if (c == null) {
- if (m_codeList == null) {
- return null;
- }
- for (Iterator it = m_codeList.iterator(); it.hasNext();) {
- ICode childCode = (ICode) it.next();
- c = childCode.getChildCode(id);
- if (c != null) {
- return c;
- }
- }
- }
- return c;
- }
-
- @Override
- public ICode getChildCodeByExtKey(Object extKey) {
- if (m_codeList == null) {
- return null;
- }
- ICode c = null;
- for (Iterator<ICode> it = m_codeList.iterator(); it.hasNext();) {
- ICode childCode = it.next();
- if (extKey.equals(childCode.getExtKey())) {
- c = childCode;
- }
- else {
- c = childCode.getChildCodeByExtKey(extKey);
- }
- if (c != null) {
- return c;
- }
- }
- return c;
- }
-
- @Override
- public ICodeType getCodeType() {
- return m_codeType;
- }
-
- @Override
- public void addChildCodeInternal(ICode code) {
- code.setCodeTypeInternal(m_codeType);
- code.setParentCodeInternal(this);
- if (m_codeMap == null) {
- m_codeMap = new HashMap<Object, ICode>();
- }
- m_codeMap.put(code.getId(), code);
- if (m_codeList == null) {
- m_codeList = new ArrayList<ICode>();
- }
- m_codeList.add(code);
- }
-
- @Override
- public void setParentCodeInternal(ICode c) {
- m_parentCode = c;
- }
-
- @Override
- public void setCodeTypeInternal(ICodeType type) {
- m_codeType = type;
- if (m_codeList != null) {
- for (ICode c : m_codeList) {
- c.setCodeTypeInternal(type);
- }
- }
- }
-
- @Override
- public String toString() {
- return "Code[id=" + getId() + ", text='" + getText() + "' " + (isActive() ? "active" : "inactive") + "]";
- }
-
- @Override
- public boolean visit(ICodeVisitor visitor, int level, boolean activeOnly) {
- ICode[] a = getChildCodes(activeOnly);
- for (int i = 0; i < a.length; i++) {
- ICode code = a[i];
- if (!visitor.visit(code, level)) {
- return false;
- }
- if (!code.visit(visitor, level + 1, activeOnly)) {
- return false;
- }
- }
- return true;
- }
-
- protected Object readResolve() throws ObjectStreamException {
- m_codeMap = new HashMap<Object, ICode>();
- if (m_codeList == null) {
- m_codeList = new ArrayList<ICode>();
- }
- else {
- for (ICode<?> c : m_codeList) {
- m_codeMap.put(c.getId(), c);
- c.setParentCodeInternal(this);
- }
- }
- return this;
- }
-
- @Override
- public CodeRow toCodeRow() {
- return new CodeRow(m_row);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.code;
+
+import java.io.ObjectStreamException;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.eclipse.scout.commons.ConfigurationUtility;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.shared.data.basic.FontSpec;
+
+public abstract class AbstractCode<T> implements ICode<T>, Serializable {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractCode.class);
+ private static final long serialVersionUID = 1L;
+
+ private transient ICodeType m_codeType;
+ private CodeRow m_row;
+ private transient ICode m_parentCode;
+ private transient HashMap<Object, ICode> m_codeMap = null;
+ private ArrayList<ICode> m_codeList = null;
+
+ /**
+ * Dynamic
+ */
+ public AbstractCode(CodeRow row) {
+ m_row = row;
+ }
+
+ /**
+ * Configured
+ */
+ public AbstractCode() {
+ initConfig();
+ }
+
+ @ConfigProperty(ConfigProperty.TEXT)
+ @Order(50)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredText() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(60)
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredActive() {
+ return true;
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(65)
+ @ConfigPropertyValue("true")
+ protected boolean getConfiguredEnabled() {
+ return true;
+ }
+
+ @ConfigProperty(ConfigProperty.ICON_ID)
+ @Order(40)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredIconId() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.TEXT)
+ @Order(70)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredTooltipText() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.STRING)
+ @Order(20)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredBackgroundColor() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.STRING)
+ @Order(10)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredForegroundColor() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.STRING)
+ @Order(30)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredFont() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.DOUBLE)
+ @Order(80)
+ @ConfigPropertyValue("null")
+ protected Double getConfiguredValue() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.STRING)
+ @Order(80)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredExtKey() {
+ return null;
+ }
+
+ private Class<? extends ICode>[] getConfiguredCodes() {
+ Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
+ return ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, ICode.class);
+ }
+
+ protected void initConfig() {
+ m_row = interceptCodeRow(new CodeRow(
+ getId(),
+ getConfiguredText(),
+ getConfiguredIconId(),
+ getConfiguredTooltipText() != null ? getConfiguredTooltipText() : null,
+ (getConfiguredBackgroundColor()),
+ (getConfiguredForegroundColor()),
+ FontSpec.parse(getConfiguredFont()),
+ getConfiguredEnabled(),
+ null,
+ getConfiguredActive(),
+ getConfiguredExtKey(),
+ getConfiguredValue(),
+ 0
+ ));
+ // add configured child codes
+ Class<? extends ICode>[] a = getConfiguredCodes();
+ if (a != null) {
+ for (int i = 0; i < a.length; i++) {
+ try {
+ ICode code = ConfigurationUtility.newInnerInstance(this, a[i]);
+ addChildCodeInternal(code);
+ }
+ catch (Exception e) {
+ LOG.warn(null, e);
+ }
+ }
+ }
+ }
+
+ /**
+ * This interception method is called from the {@link #initConfig()} method just on construction of the code object.
+ * <p>
+ * Override this method to change that code row used by this code or to return a different code row than the default.
+ * <p>
+ * The defaukt does nothing and returns the argument row.
+ */
+ protected CodeRow interceptCodeRow(CodeRow row) {
+ return row;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public T getId() {
+ return (T) m_row.getKey();
+ }
+
+ @Override
+ public String getText() {
+ return m_row.getText();
+ }
+
+ @Override
+ public boolean isActive() {
+ return m_row.isActive();
+ }
+
+ /**
+ * Do only call this method during creation and setup of a code / code type.
+ * <p>
+ * Never call it afterwards, this may lead to conflicting situations when {@link ICode}s are in use and references.
+ */
+ public void setActiveInternal(boolean b) {
+ m_row.setActive(b);
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return m_row.isEnabled();
+ }
+
+ /**
+ * Do only call this method during creation and setup of a code / code type.
+ * <p>
+ * Never call it afterwards, this may lead to conflicting situations when {@link ICode}s are in use and references.
+ */
+ public void setEnabledInternal(boolean b) {
+ m_row.setEnabled(b);
+ }
+
+ @Override
+ public String getIconId() {
+ String id = m_row.getIconId();
+ if (id == null && m_codeType != null) {
+ id = m_codeType.getIconId();
+ }
+ return id;
+ }
+
+ @Override
+ public String getTooltipText() {
+ return m_row.getTooltip();
+ }
+
+ @Override
+ public String getBackgroundColor() {
+ return m_row.getBackgroundColor();
+ }
+
+ @Override
+ public String getForegroundColor() {
+ return m_row.getForegroundColor();
+ }
+
+ @Override
+ public FontSpec getFont() {
+ return m_row.getFont();
+ }
+
+ @Override
+ public ICode getParentCode() {
+ return m_parentCode;
+ }
+
+ @Override
+ public long getPartitionId() {
+ return m_row.getPartitionId();
+ }
+
+ @Override
+ public String getExtKey() {
+ return m_row.getExtKey();
+ }
+
+ @Override
+ public Number getValue() {
+ return m_row.getValue();
+ }
+
+ @Override
+ public ICode[] getChildCodes() {
+ return getChildCodes(true);
+ }
+
+ @Override
+ public ICode[] getChildCodes(boolean activeOnly) {
+ if (m_codeList == null) {
+ return new ICode[0];
+ }
+ ArrayList<ICode> list = new ArrayList<ICode>(m_codeList);
+ if (activeOnly) {
+ for (Iterator it = list.iterator(); it.hasNext();) {
+ ICode code = (ICode) it.next();
+ if (!code.isActive()) {
+ it.remove();
+ }
+ }
+ }
+ return list.toArray(new ICode[0]);
+ }
+
+ @Override
+ public ICode getChildCode(Object id) {
+ ICode c = null;
+ if (m_codeMap != null) {
+ c = m_codeMap.get(id);
+ }
+ if (c == null) {
+ if (m_codeList == null) {
+ return null;
+ }
+ for (Iterator it = m_codeList.iterator(); it.hasNext();) {
+ ICode childCode = (ICode) it.next();
+ c = childCode.getChildCode(id);
+ if (c != null) {
+ return c;
+ }
+ }
+ }
+ return c;
+ }
+
+ @Override
+ public ICode getChildCodeByExtKey(Object extKey) {
+ if (m_codeList == null) {
+ return null;
+ }
+ ICode c = null;
+ for (Iterator<ICode> it = m_codeList.iterator(); it.hasNext();) {
+ ICode childCode = it.next();
+ if (extKey.equals(childCode.getExtKey())) {
+ c = childCode;
+ }
+ else {
+ c = childCode.getChildCodeByExtKey(extKey);
+ }
+ if (c != null) {
+ return c;
+ }
+ }
+ return c;
+ }
+
+ @Override
+ public ICodeType getCodeType() {
+ return m_codeType;
+ }
+
+ @Override
+ public void addChildCodeInternal(ICode code) {
+ code.setCodeTypeInternal(m_codeType);
+ code.setParentCodeInternal(this);
+ if (m_codeMap == null) {
+ m_codeMap = new HashMap<Object, ICode>();
+ }
+ m_codeMap.put(code.getId(), code);
+ if (m_codeList == null) {
+ m_codeList = new ArrayList<ICode>();
+ }
+ m_codeList.add(code);
+ }
+
+ @Override
+ public void setParentCodeInternal(ICode c) {
+ m_parentCode = c;
+ }
+
+ @Override
+ public void setCodeTypeInternal(ICodeType type) {
+ m_codeType = type;
+ if (m_codeList != null) {
+ for (ICode c : m_codeList) {
+ c.setCodeTypeInternal(type);
+ }
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "Code[id=" + getId() + ", text='" + getText() + "' " + (isActive() ? "active" : "inactive") + "]";
+ }
+
+ @Override
+ public boolean visit(ICodeVisitor visitor, int level, boolean activeOnly) {
+ ICode[] a = getChildCodes(activeOnly);
+ for (int i = 0; i < a.length; i++) {
+ ICode code = a[i];
+ if (!visitor.visit(code, level)) {
+ return false;
+ }
+ if (!code.visit(visitor, level + 1, activeOnly)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ protected Object readResolve() throws ObjectStreamException {
+ m_codeMap = new HashMap<Object, ICode>();
+ if (m_codeList == null) {
+ m_codeList = new ArrayList<ICode>();
+ }
+ else {
+ for (ICode<?> c : m_codeList) {
+ m_codeMap.put(c.getId(), c);
+ c.setParentCodeInternal(this);
+ }
+ }
+ return this;
+ }
+
+ @Override
+ public CodeRow toCodeRow() {
+ return new CodeRow(m_row);
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/code/AbstractCodeType.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/code/AbstractCodeType.java
index b7f63c07a1..f399cf8c3a 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/code/AbstractCodeType.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/code/AbstractCodeType.java
@@ -1,522 +1,522 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.code;
-
-import java.io.ObjectStreamException;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.commons.ConfigurationUtility;
-import org.eclipse.scout.commons.MatrixUtility;
-import org.eclipse.scout.commons.annotations.ConfigOperation;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.holders.IntegerHolder;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.shared.ScoutTexts;
-import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
-import org.eclipse.scout.service.SERVICES;
-
-public abstract class AbstractCodeType<T> implements ICodeType<T>, Serializable {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractCodeType.class);
- private static final long serialVersionUID = 1L;
-
- private String m_text;
- private String m_iconId;
- private boolean m_hierarchy;
- private int m_maxLevel;
- private transient HashMap<Object, ICode> m_rootCodeMap = new HashMap<Object, ICode>();
- private ArrayList<ICode> m_rootCodeList = new ArrayList<ICode>();
-
- public AbstractCodeType() {
- initConfig();
- }
-
- public AbstractCodeType(String label, boolean hierarchy) {
- m_text = label;
- m_hierarchy = hierarchy;
- }
-
- private Class<? extends ICode>[] getConfiguredCodes() {
- Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
- return ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, ICode.class);
- }
-
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @Order(20)
- @ConfigPropertyValue("false")
- protected boolean getConfiguredIsHierarchy() {
- return false;
- }
-
- @ConfigProperty(ConfigProperty.INTEGER)
- @Order(30)
- @ConfigPropertyValue("Integer.MAX_VALUE")
- protected int getConfiguredMaxLevel() {
- return Integer.MAX_VALUE;
- }
-
- @ConfigProperty(ConfigProperty.TEXT)
- @Order(40)
- @ConfigPropertyValue("null")
- protected String getConfiguredText() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.ICON_ID)
- @Order(10)
- @ConfigPropertyValue("null")
- protected String getConfiguredIconId() {
- return null;
- }
-
- @ConfigProperty(ConfigProperty.DOC)
- @Order(110)
- @ConfigPropertyValue("null")
- protected String getConfiguredDoc() {
- return null;
- }
-
- /**
- * This method is called on server side to create basic code set
- */
- @ConfigOperation
- @Order(1)
- protected List<ICode<?>> execCreateCodes() throws ProcessingException {
- Class<? extends ICode>[] a = getConfiguredCodes();
- if (a == null || a.length == 0) {
- return Collections.emptyList();
- }
- ArrayList<ICode<?>> list = new ArrayList<ICode<?>>(a.length);
- for (int i = 0; i < a.length; i++) {
- try {
- ICode code = ConfigurationUtility.newInnerInstance(this, a[i]);
- list.add(code);
- }
- catch (Exception e) {
- LOG.warn(null, e);
- }
- }
- return list;
- }
-
- /**
- * This method is called on server side to create a specific code for a code row. This method is called when loading
- * codes, in particular by
- *
- * @return a {@link ICode} to accept that row, return null to ignore that row
- */
- @ConfigOperation
- @Order(2)
- protected ICode<?> execCreateCode(CodeRow newRow) throws ProcessingException {
- ICode<?> code = new MutableCode(newRow);
- return code;
- }
-
- /**
- * This method is called on server side to load additional dynamic codes to the {@link #execCreateCodes()} list<br>
- * Sample for sql call:
- *
- * <pre>
- * String sql =
- * &quot;SELECT key,text,iconId,tooltipText,backgroundColor,foregroundColor,font,active,parentKey,extKey,calcValue,enabled,partitionId &quot; +
- * &quot;FROM TABLE &quot; +
- * &quot;WHERE ...&quot;;
- * Object[][] data = SERVICES.getService(ISqlService.class).select(sql, new Object[]{});
- * return createCodeRowArray(data);
- * </pre>
- */
- @ConfigOperation
- @Order(10)
- protected CodeRow[] execLoadCodes() throws ProcessingException {
- return null;
- }
-
- /**
- * When there are configured codes (inner classes) that are overwritten by {@link #execLoadCodes()} then this method
- * is
- * called to give a chance to merge attributes of the old configured code to the new dynamic code.
- * <p>
- * The default merges the following properties from the old code to the new iff they are null on the new code.
- * <ul>
- * <li>backgroundColor</li>
- * <li>font</li>
- * <li>foregroundColor</li>
- * <li>iconId</li>
- * <li>extKey</li>
- * <li>value</li>
- * </ul>
- * <p>
- *
- * @param oldCode
- * is the old (configured) code that is dumped after this call
- * @param newCode
- * is the new code that replaces the old code
- */
- @ConfigOperation
- @Order(20)
- protected void execOverwriteCode(CodeRow oldCode, CodeRow newCode) throws ProcessingException {
- if (newCode.getBackgroundColor() == null) {
- newCode.setBackgroundColor(oldCode.getBackgroundColor());
- }
- if (newCode.getFont() == null) {
- newCode.setFont(oldCode.getFont());
- }
- if (newCode.getForegroundColor() == null) {
- newCode.setForegroundColor(oldCode.getForegroundColor());
- }
- if (newCode.getIconId() == null) {
- newCode.setIconId(oldCode.getIconId());
- }
- if (newCode.getExtKey() == null) {
- newCode.setExtKey(oldCode.getExtKey());
- }
- if (newCode.getValue() == null) {
- newCode.setValue(oldCode.getValue());
- }
- }
-
- protected void initConfig() {
- m_text = getConfiguredText();
- m_iconId = getConfiguredIconId();
- m_hierarchy = getConfiguredIsHierarchy();
- m_maxLevel = getConfiguredMaxLevel();
- try {
- loadCodes();
- }
- catch (ProcessingException e) {
- e.addContextMessage(ScoutTexts.get("CodeTypeInit") + " " + m_text);
- SERVICES.getService(IExceptionHandlerService.class).handleException(e);
- }
- }
-
- /**
- * Convenience function to sort data for later call to {@link #createCodeRowArray(Object[][])} <br>
- * The sort indices are 0-based.
- */
- public static void sortData(Object[][] data, int... sortColumns) {
- MatrixUtility.sort(data, sortColumns);
- }
-
- /**
- * see {@link #createCodeRowArray(Object[][], int)}
- */
- public static CodeRow[] createCodeRowArray(Object[][] data) {
- return createCodeRowArray(data, data != null && data.length > 0 ? data[0].length : 0);
- }
-
- /**
- * Convenience function to transform Object[][] data into CodeRow[]
- *
- * @param data
- * The Object[][] must contain rows with the elements in the
- * following order: <br>
- * Object key <br>
- * String text <br>
- * String iconId <br>
- * String tooltipText <br>
- * String backgroundColor <br>
- * String foregroundColor <br>
- * String font <br>
- * Long active (0 or 1) <br>
- * Object parentKey <br>
- * String extKey <br>
- * Double calcValue <br>
- * Long enabled (0 or 1) <br>
- * Long partitionId
- * @param maxColumnIndex
- * the maximum column index to be used to create the code rows, all
- * column indexes >= columnCount are ignored
- */
- public static CodeRow[] createCodeRowArray(Object[][] data, int maxColumnIndex) {
- if (data == null || data.length == 0) {
- return new CodeRow[0];
- }
- else {
- CodeRow[] a = new CodeRow[data.length];
- for (int i = 0; i < data.length; i++) {
- a[i] = new CodeRow(data[i], maxColumnIndex);
- }
- return a;
- }
- }
-
- /**
- * default implementations add a field:
- *
- * <pre>
- * public static final long ID=123;
- * and create a getter:
- * public T getId(){ return ID; }
- * </pre>
- */
- @Override
- public abstract T getId();
-
- @Override
- public String getText() {
- return m_text;
- }
-
- @Override
- public String getIconId() {
- return m_iconId;
- }
-
- @Override
- public boolean isHierarchy() {
- return m_hierarchy;
- }
-
- @Override
- public int getMaxLevel() {
- return m_maxLevel;
- }
-
- @Override
- public ICode getCode(Object id) {
- ICode c = m_rootCodeMap.get(id);
- if (c == null) {
- for (Iterator<ICode> it = m_rootCodeList.iterator(); it.hasNext();) {
- ICode childCode = it.next();
- c = childCode.getChildCode(id);
- if (c != null) {
- return c;
- }
- }
- }
- return c;
- }
-
- @Override
- public ICode getCodeByExtKey(Object extKey) {
- ICode c = null;
- for (Iterator<ICode> it = m_rootCodeList.iterator(); it.hasNext();) {
- ICode childCode = it.next();
- if (extKey.equals(childCode.getExtKey())) {
- c = childCode;
- }
- else {
- c = childCode.getChildCodeByExtKey(extKey);
- }
- if (c != null) {
- return c;
- }
- }
- return c;
- }
-
- @Override
- public int getCodeIndex(final Object id) {
- final IntegerHolder result = new IntegerHolder(-1);
- ICodeVisitor v = new ICodeVisitor() {
- private int index = 0;
-
- @Override
- public boolean visit(ICode code, int treeLevel) {
- if (CompareUtility.equals(code.getId(), id)) {
- result.setValue(index);
- }
- else {
- index++;
- }
- return result.getValue() < 0;
- }
- };
- visit(v, false);
- return result.getValue();
- }
-
- @Override
- public int getCodeIndex(final ICode c) {
- final IntegerHolder result = new IntegerHolder(-1);
- ICodeVisitor v = new ICodeVisitor() {
- private int index = 0;
-
- @Override
- public boolean visit(ICode code, int treeLevel) {
- if (code == c) {
- result.setValue(index);
- }
- else {
- index++;
- }
- return result.getValue() < 0;
- }
- };
- visit(v, false);
- return result.getValue();
- }
-
- @Override
- public ICode[] getCodes() {
- return getCodes(true);
- }
-
- @Override
- public ICode[] getCodes(boolean activeOnly) {
- ArrayList<ICode> list = new ArrayList<ICode>(m_rootCodeList);
- if (activeOnly) {
- for (Iterator<ICode> it = list.iterator(); it.hasNext();) {
- ICode code = it.next();
- if (!code.isActive()) {
- it.remove();
- }
- }
- }
- return list.toArray(new ICode[0]);
- }
-
- private void loadCodes() throws ProcessingException {
- m_rootCodeMap = new HashMap<Object, ICode>();
- m_rootCodeList = new ArrayList<ICode>();
- //
- // 1a create unconnected codes and assign to type
- ArrayList<ICode> allCodesOrdered = new ArrayList<ICode>();
- HashMap<ICode, ICode> codeToParentCodeMap = new HashMap<ICode, ICode>();
- HashMap<Object, ICode> idToCodeMap = new HashMap<Object, ICode>();
- // 1a add configured codes
- List<ICode<?>> createdList = execCreateCodes();
- if (createdList != null) {
- for (ICode code : createdList) {
- allCodesOrdered.add(code);
- idToCodeMap.put(code.getId(), code);
- codeToParentCodeMap.put(code, null);
- }
- }
- // 1b add dynamic codes
- CodeRow[] result = execLoadCodes();
- if (result != null && result.length > 0) {
- HashMap<ICode, Object> codeToParentIdMap = new HashMap<ICode, Object>();
- // create unconnected codes and assign to type
- for (int i = 0; i < result.length; i++) {
- CodeRow newRow = result[i];
- ICode existingCode = idToCodeMap.get(newRow.getKey());
- if (existingCode != null) {
- // There is already a static code with same id.
- execOverwriteCode(existingCode.toCodeRow(), newRow);
- }
- ICode newCode = execCreateCode(newRow);
- if (newCode != null) {
- if (existingCode != null) {
- // remove old (and then re-add) to preserve dynamic ordering.
- allCodesOrdered.remove(existingCode);
- idToCodeMap.remove(existingCode.getId());
- codeToParentCodeMap.remove(existingCode);
- }
- //add new
- allCodesOrdered.add(newCode);
- idToCodeMap.put(newCode.getId(), newCode);
- Object parentId = newRow.getParentKey();
- codeToParentIdMap.put(newCode, parentId);
- }
- else if (existingCode != null) {
- // remove old (and then re-add) to preserve dynamic ordering.
- allCodesOrdered.remove(existingCode);
- allCodesOrdered.add(existingCode);
- }
- }
- for (Iterator<Map.Entry<ICode, Object>> it = codeToParentIdMap.entrySet().iterator(); it.hasNext();) {
- Map.Entry<ICode, Object> e = it.next();
- AbstractCode code = (AbstractCode) e.getKey();
- Object parentId = e.getValue();
- AbstractCode parentCode = null;
- if (parentId != null) {
- parentCode = (AbstractCode) idToCodeMap.get(parentId);
- if (parentCode == null) {
- LOG.warn("parent code for " + code + " not found: id=" + parentId);
- }
- }
- codeToParentCodeMap.put(code, parentCode);
- }
- }
- // 2 interconnect codes and types to structure
- for (ICode code : allCodesOrdered) {
- ICode parentCode = codeToParentCodeMap.get(code);
- if (parentCode != null) {
- parentCode.addChildCodeInternal(code);
- }
- else {
- this.addChildCodeInternal(code);
- }
- }
- //3 mark all chidren of inactive codes also as inactive
- visit(new ICodeVisitor() {
- @Override
- public boolean visit(ICode code, int treeLevel) {
- if (code.getParentCode() != null) {
- if (!code.getParentCode().isActive() && code.isActive()) {
- if (code instanceof AbstractCode<?>) {
- ((AbstractCode<?>) code).setActiveInternal(false);
- }
- }
- }
- return true;
- }
- }, false);
- }
-
- private void addChildCodeInternal(ICode code) {
- code.setCodeTypeInternal(this);
- code.setParentCodeInternal(null);
- m_rootCodeMap.put(code.getId(), code);
- m_rootCodeList.add(code);
- }
-
- @Override
- public String toString() {
- return "CodeType[id=" + getId() + ", label=" + getText() + "]";
- }
-
- @Override
- public boolean visit(ICodeVisitor visitor) {
- return visit(visitor, true);
- }
-
- @Override
- public boolean visit(ICodeVisitor visitor, boolean activeOnly) {
- ICode[] a = getCodes(activeOnly);
- for (int i = 0; i < a.length; i++) {
- ICode code = a[i];
- if (!visitor.visit(code, 0)) {
- return false;
- }
- if (!code.visit(visitor, 1, activeOnly)) {
- return false;
- }
- }
- return true;
- }
-
- protected Object readResolve() throws ObjectStreamException {
- m_rootCodeMap = new HashMap<Object, ICode>();
- if (m_rootCodeList == null) {
- m_rootCodeList = new ArrayList<ICode>();
- }
- else {
- for (ICode<?> code : m_rootCodeList) {
- m_rootCodeMap.put(code.getId(), code);
- code.setParentCodeInternal(null);
- code.setCodeTypeInternal(this);
- }
- }
- return this;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.code;
+
+import java.io.ObjectStreamException;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.commons.ConfigurationUtility;
+import org.eclipse.scout.commons.MatrixUtility;
+import org.eclipse.scout.commons.annotations.ConfigOperation;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.holders.IntegerHolder;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.shared.ScoutTexts;
+import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
+import org.eclipse.scout.service.SERVICES;
+
+public abstract class AbstractCodeType<T> implements ICodeType<T>, Serializable {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractCodeType.class);
+ private static final long serialVersionUID = 1L;
+
+ private String m_text;
+ private String m_iconId;
+ private boolean m_hierarchy;
+ private int m_maxLevel;
+ private transient HashMap<Object, ICode> m_rootCodeMap = new HashMap<Object, ICode>();
+ private ArrayList<ICode> m_rootCodeList = new ArrayList<ICode>();
+
+ public AbstractCodeType() {
+ initConfig();
+ }
+
+ public AbstractCodeType(String label, boolean hierarchy) {
+ m_text = label;
+ m_hierarchy = hierarchy;
+ }
+
+ private Class<? extends ICode>[] getConfiguredCodes() {
+ Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
+ return ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, ICode.class);
+ }
+
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @Order(20)
+ @ConfigPropertyValue("false")
+ protected boolean getConfiguredIsHierarchy() {
+ return false;
+ }
+
+ @ConfigProperty(ConfigProperty.INTEGER)
+ @Order(30)
+ @ConfigPropertyValue("Integer.MAX_VALUE")
+ protected int getConfiguredMaxLevel() {
+ return Integer.MAX_VALUE;
+ }
+
+ @ConfigProperty(ConfigProperty.TEXT)
+ @Order(40)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredText() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.ICON_ID)
+ @Order(10)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredIconId() {
+ return null;
+ }
+
+ @ConfigProperty(ConfigProperty.DOC)
+ @Order(110)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredDoc() {
+ return null;
+ }
+
+ /**
+ * This method is called on server side to create basic code set
+ */
+ @ConfigOperation
+ @Order(1)
+ protected List<ICode<?>> execCreateCodes() throws ProcessingException {
+ Class<? extends ICode>[] a = getConfiguredCodes();
+ if (a == null || a.length == 0) {
+ return Collections.emptyList();
+ }
+ ArrayList<ICode<?>> list = new ArrayList<ICode<?>>(a.length);
+ for (int i = 0; i < a.length; i++) {
+ try {
+ ICode code = ConfigurationUtility.newInnerInstance(this, a[i]);
+ list.add(code);
+ }
+ catch (Exception e) {
+ LOG.warn(null, e);
+ }
+ }
+ return list;
+ }
+
+ /**
+ * This method is called on server side to create a specific code for a code row. This method is called when loading
+ * codes, in particular by
+ *
+ * @return a {@link ICode} to accept that row, return null to ignore that row
+ */
+ @ConfigOperation
+ @Order(2)
+ protected ICode<?> execCreateCode(CodeRow newRow) throws ProcessingException {
+ ICode<?> code = new MutableCode(newRow);
+ return code;
+ }
+
+ /**
+ * This method is called on server side to load additional dynamic codes to the {@link #execCreateCodes()} list<br>
+ * Sample for sql call:
+ *
+ * <pre>
+ * String sql =
+ * &quot;SELECT key,text,iconId,tooltipText,backgroundColor,foregroundColor,font,active,parentKey,extKey,calcValue,enabled,partitionId &quot; +
+ * &quot;FROM TABLE &quot; +
+ * &quot;WHERE ...&quot;;
+ * Object[][] data = SERVICES.getService(ISqlService.class).select(sql, new Object[]{});
+ * return createCodeRowArray(data);
+ * </pre>
+ */
+ @ConfigOperation
+ @Order(10)
+ protected CodeRow[] execLoadCodes() throws ProcessingException {
+ return null;
+ }
+
+ /**
+ * When there are configured codes (inner classes) that are overwritten by {@link #execLoadCodes()} then this method
+ * is
+ * called to give a chance to merge attributes of the old configured code to the new dynamic code.
+ * <p>
+ * The default merges the following properties from the old code to the new iff they are null on the new code.
+ * <ul>
+ * <li>backgroundColor</li>
+ * <li>font</li>
+ * <li>foregroundColor</li>
+ * <li>iconId</li>
+ * <li>extKey</li>
+ * <li>value</li>
+ * </ul>
+ * <p>
+ *
+ * @param oldCode
+ * is the old (configured) code that is dumped after this call
+ * @param newCode
+ * is the new code that replaces the old code
+ */
+ @ConfigOperation
+ @Order(20)
+ protected void execOverwriteCode(CodeRow oldCode, CodeRow newCode) throws ProcessingException {
+ if (newCode.getBackgroundColor() == null) {
+ newCode.setBackgroundColor(oldCode.getBackgroundColor());
+ }
+ if (newCode.getFont() == null) {
+ newCode.setFont(oldCode.getFont());
+ }
+ if (newCode.getForegroundColor() == null) {
+ newCode.setForegroundColor(oldCode.getForegroundColor());
+ }
+ if (newCode.getIconId() == null) {
+ newCode.setIconId(oldCode.getIconId());
+ }
+ if (newCode.getExtKey() == null) {
+ newCode.setExtKey(oldCode.getExtKey());
+ }
+ if (newCode.getValue() == null) {
+ newCode.setValue(oldCode.getValue());
+ }
+ }
+
+ protected void initConfig() {
+ m_text = getConfiguredText();
+ m_iconId = getConfiguredIconId();
+ m_hierarchy = getConfiguredIsHierarchy();
+ m_maxLevel = getConfiguredMaxLevel();
+ try {
+ loadCodes();
+ }
+ catch (ProcessingException e) {
+ e.addContextMessage(ScoutTexts.get("CodeTypeInit") + " " + m_text);
+ SERVICES.getService(IExceptionHandlerService.class).handleException(e);
+ }
+ }
+
+ /**
+ * Convenience function to sort data for later call to {@link #createCodeRowArray(Object[][])} <br>
+ * The sort indices are 0-based.
+ */
+ public static void sortData(Object[][] data, int... sortColumns) {
+ MatrixUtility.sort(data, sortColumns);
+ }
+
+ /**
+ * see {@link #createCodeRowArray(Object[][], int)}
+ */
+ public static CodeRow[] createCodeRowArray(Object[][] data) {
+ return createCodeRowArray(data, data != null && data.length > 0 ? data[0].length : 0);
+ }
+
+ /**
+ * Convenience function to transform Object[][] data into CodeRow[]
+ *
+ * @param data
+ * The Object[][] must contain rows with the elements in the
+ * following order: <br>
+ * Object key <br>
+ * String text <br>
+ * String iconId <br>
+ * String tooltipText <br>
+ * String backgroundColor <br>
+ * String foregroundColor <br>
+ * String font <br>
+ * Long active (0 or 1) <br>
+ * Object parentKey <br>
+ * String extKey <br>
+ * Double calcValue <br>
+ * Long enabled (0 or 1) <br>
+ * Long partitionId
+ * @param maxColumnIndex
+ * the maximum column index to be used to create the code rows, all
+ * column indexes >= columnCount are ignored
+ */
+ public static CodeRow[] createCodeRowArray(Object[][] data, int maxColumnIndex) {
+ if (data == null || data.length == 0) {
+ return new CodeRow[0];
+ }
+ else {
+ CodeRow[] a = new CodeRow[data.length];
+ for (int i = 0; i < data.length; i++) {
+ a[i] = new CodeRow(data[i], maxColumnIndex);
+ }
+ return a;
+ }
+ }
+
+ /**
+ * default implementations add a field:
+ *
+ * <pre>
+ * public static final long ID=123;
+ * and create a getter:
+ * public T getId(){ return ID; }
+ * </pre>
+ */
+ @Override
+ public abstract T getId();
+
+ @Override
+ public String getText() {
+ return m_text;
+ }
+
+ @Override
+ public String getIconId() {
+ return m_iconId;
+ }
+
+ @Override
+ public boolean isHierarchy() {
+ return m_hierarchy;
+ }
+
+ @Override
+ public int getMaxLevel() {
+ return m_maxLevel;
+ }
+
+ @Override
+ public ICode getCode(Object id) {
+ ICode c = m_rootCodeMap.get(id);
+ if (c == null) {
+ for (Iterator<ICode> it = m_rootCodeList.iterator(); it.hasNext();) {
+ ICode childCode = it.next();
+ c = childCode.getChildCode(id);
+ if (c != null) {
+ return c;
+ }
+ }
+ }
+ return c;
+ }
+
+ @Override
+ public ICode getCodeByExtKey(Object extKey) {
+ ICode c = null;
+ for (Iterator<ICode> it = m_rootCodeList.iterator(); it.hasNext();) {
+ ICode childCode = it.next();
+ if (extKey.equals(childCode.getExtKey())) {
+ c = childCode;
+ }
+ else {
+ c = childCode.getChildCodeByExtKey(extKey);
+ }
+ if (c != null) {
+ return c;
+ }
+ }
+ return c;
+ }
+
+ @Override
+ public int getCodeIndex(final Object id) {
+ final IntegerHolder result = new IntegerHolder(-1);
+ ICodeVisitor v = new ICodeVisitor() {
+ private int index = 0;
+
+ @Override
+ public boolean visit(ICode code, int treeLevel) {
+ if (CompareUtility.equals(code.getId(), id)) {
+ result.setValue(index);
+ }
+ else {
+ index++;
+ }
+ return result.getValue() < 0;
+ }
+ };
+ visit(v, false);
+ return result.getValue();
+ }
+
+ @Override
+ public int getCodeIndex(final ICode c) {
+ final IntegerHolder result = new IntegerHolder(-1);
+ ICodeVisitor v = new ICodeVisitor() {
+ private int index = 0;
+
+ @Override
+ public boolean visit(ICode code, int treeLevel) {
+ if (code == c) {
+ result.setValue(index);
+ }
+ else {
+ index++;
+ }
+ return result.getValue() < 0;
+ }
+ };
+ visit(v, false);
+ return result.getValue();
+ }
+
+ @Override
+ public ICode[] getCodes() {
+ return getCodes(true);
+ }
+
+ @Override
+ public ICode[] getCodes(boolean activeOnly) {
+ ArrayList<ICode> list = new ArrayList<ICode>(m_rootCodeList);
+ if (activeOnly) {
+ for (Iterator<ICode> it = list.iterator(); it.hasNext();) {
+ ICode code = it.next();
+ if (!code.isActive()) {
+ it.remove();
+ }
+ }
+ }
+ return list.toArray(new ICode[0]);
+ }
+
+ private void loadCodes() throws ProcessingException {
+ m_rootCodeMap = new HashMap<Object, ICode>();
+ m_rootCodeList = new ArrayList<ICode>();
+ //
+ // 1a create unconnected codes and assign to type
+ ArrayList<ICode> allCodesOrdered = new ArrayList<ICode>();
+ HashMap<ICode, ICode> codeToParentCodeMap = new HashMap<ICode, ICode>();
+ HashMap<Object, ICode> idToCodeMap = new HashMap<Object, ICode>();
+ // 1a add configured codes
+ List<ICode<?>> createdList = execCreateCodes();
+ if (createdList != null) {
+ for (ICode code : createdList) {
+ allCodesOrdered.add(code);
+ idToCodeMap.put(code.getId(), code);
+ codeToParentCodeMap.put(code, null);
+ }
+ }
+ // 1b add dynamic codes
+ CodeRow[] result = execLoadCodes();
+ if (result != null && result.length > 0) {
+ HashMap<ICode, Object> codeToParentIdMap = new HashMap<ICode, Object>();
+ // create unconnected codes and assign to type
+ for (int i = 0; i < result.length; i++) {
+ CodeRow newRow = result[i];
+ ICode existingCode = idToCodeMap.get(newRow.getKey());
+ if (existingCode != null) {
+ // There is already a static code with same id.
+ execOverwriteCode(existingCode.toCodeRow(), newRow);
+ }
+ ICode newCode = execCreateCode(newRow);
+ if (newCode != null) {
+ if (existingCode != null) {
+ // remove old (and then re-add) to preserve dynamic ordering.
+ allCodesOrdered.remove(existingCode);
+ idToCodeMap.remove(existingCode.getId());
+ codeToParentCodeMap.remove(existingCode);
+ }
+ //add new
+ allCodesOrdered.add(newCode);
+ idToCodeMap.put(newCode.getId(), newCode);
+ Object parentId = newRow.getParentKey();
+ codeToParentIdMap.put(newCode, parentId);
+ }
+ else if (existingCode != null) {
+ // remove old (and then re-add) to preserve dynamic ordering.
+ allCodesOrdered.remove(existingCode);
+ allCodesOrdered.add(existingCode);
+ }
+ }
+ for (Iterator<Map.Entry<ICode, Object>> it = codeToParentIdMap.entrySet().iterator(); it.hasNext();) {
+ Map.Entry<ICode, Object> e = it.next();
+ AbstractCode code = (AbstractCode) e.getKey();
+ Object parentId = e.getValue();
+ AbstractCode parentCode = null;
+ if (parentId != null) {
+ parentCode = (AbstractCode) idToCodeMap.get(parentId);
+ if (parentCode == null) {
+ LOG.warn("parent code for " + code + " not found: id=" + parentId);
+ }
+ }
+ codeToParentCodeMap.put(code, parentCode);
+ }
+ }
+ // 2 interconnect codes and types to structure
+ for (ICode code : allCodesOrdered) {
+ ICode parentCode = codeToParentCodeMap.get(code);
+ if (parentCode != null) {
+ parentCode.addChildCodeInternal(code);
+ }
+ else {
+ this.addChildCodeInternal(code);
+ }
+ }
+ //3 mark all chidren of inactive codes also as inactive
+ visit(new ICodeVisitor() {
+ @Override
+ public boolean visit(ICode code, int treeLevel) {
+ if (code.getParentCode() != null) {
+ if (!code.getParentCode().isActive() && code.isActive()) {
+ if (code instanceof AbstractCode<?>) {
+ ((AbstractCode<?>) code).setActiveInternal(false);
+ }
+ }
+ }
+ return true;
+ }
+ }, false);
+ }
+
+ private void addChildCodeInternal(ICode code) {
+ code.setCodeTypeInternal(this);
+ code.setParentCodeInternal(null);
+ m_rootCodeMap.put(code.getId(), code);
+ m_rootCodeList.add(code);
+ }
+
+ @Override
+ public String toString() {
+ return "CodeType[id=" + getId() + ", label=" + getText() + "]";
+ }
+
+ @Override
+ public boolean visit(ICodeVisitor visitor) {
+ return visit(visitor, true);
+ }
+
+ @Override
+ public boolean visit(ICodeVisitor visitor, boolean activeOnly) {
+ ICode[] a = getCodes(activeOnly);
+ for (int i = 0; i < a.length; i++) {
+ ICode code = a[i];
+ if (!visitor.visit(code, 0)) {
+ return false;
+ }
+ if (!code.visit(visitor, 1, activeOnly)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ protected Object readResolve() throws ObjectStreamException {
+ m_rootCodeMap = new HashMap<Object, ICode>();
+ if (m_rootCodeList == null) {
+ m_rootCodeList = new ArrayList<ICode>();
+ }
+ else {
+ for (ICode<?> code : m_rootCodeList) {
+ m_rootCodeMap.put(code.getId(), code);
+ code.setParentCodeInternal(null);
+ code.setCodeTypeInternal(this);
+ }
+ }
+ return this;
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/code/CODES.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/code/CODES.java
index 426522d75c..569684ffa1 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/code/CODES.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/code/CODES.java
@@ -1,66 +1,66 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.code;
-
-import org.eclipse.scout.service.SERVICES;
-
-/**
- * Convenience accessor for service ICodeService
- */
-public final class CODES {
-
- private CODES() {
- }
-
- public static <T extends ICodeType> T getCodeType(Class<T> type) {
- return SERVICES.getService(ICodeService.class).getCodeType(type);
- }
-
- /**
- * @param id
- * @return
- * Note that this method does not load code types, but only searches code types already loaded into the code
- * service using {@link #getAllCodeTypes(String)}, {@link #getCodeType(Class)} etc.
- */
- public static ICodeType findCodeTypeById(Object id) {
- return SERVICES.getService(ICodeService.class).findCodeTypeById(id);
- }
-
- /**
- * @param id
- * @return
- * Note that this method does not load code types, but only searches code types already loaded into the code
- * service using {@link #getAllCodeTypes(String)}, {@link #getCodeType(Class)} etc.
- */
- public static ICodeType findCodeTypeById(Long partitionId, Object id) {
- return SERVICES.getService(ICodeService.class).findCodeTypeById(partitionId, id);
- }
-
- public static ICodeType[] getCodeTypes(Class... types) {
- return SERVICES.getService(ICodeService.class).getCodeTypes(types);
- }
-
- public static <T extends ICode> T getCode(Class<T> type) {
- return SERVICES.getService(ICodeService.class).getCode(type);
- }
-
- public static <T extends ICodeType> T reloadCodeType(Class<T> type) {
- return SERVICES.getService(ICodeService.class).reloadCodeType(type);
- }
-
- public static ICodeType[] reloadCodeTypes(Class... types) {
- return SERVICES.getService(ICodeService.class).reloadCodeTypes(types);
- }
-
- public static ICodeType[] getAllCodeTypes(String classPrefix) {
- return SERVICES.getService(ICodeService.class).getAllCodeTypes(classPrefix);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.code;
+
+import org.eclipse.scout.service.SERVICES;
+
+/**
+ * Convenience accessor for service ICodeService
+ */
+public final class CODES {
+
+ private CODES() {
+ }
+
+ public static <T extends ICodeType> T getCodeType(Class<T> type) {
+ return SERVICES.getService(ICodeService.class).getCodeType(type);
+ }
+
+ /**
+ * @param id
+ * @return
+ * Note that this method does not load code types, but only searches code types already loaded into the code
+ * service using {@link #getAllCodeTypes(String)}, {@link #getCodeType(Class)} etc.
+ */
+ public static ICodeType findCodeTypeById(Object id) {
+ return SERVICES.getService(ICodeService.class).findCodeTypeById(id);
+ }
+
+ /**
+ * @param id
+ * @return
+ * Note that this method does not load code types, but only searches code types already loaded into the code
+ * service using {@link #getAllCodeTypes(String)}, {@link #getCodeType(Class)} etc.
+ */
+ public static ICodeType findCodeTypeById(Long partitionId, Object id) {
+ return SERVICES.getService(ICodeService.class).findCodeTypeById(partitionId, id);
+ }
+
+ public static ICodeType[] getCodeTypes(Class... types) {
+ return SERVICES.getService(ICodeService.class).getCodeTypes(types);
+ }
+
+ public static <T extends ICode> T getCode(Class<T> type) {
+ return SERVICES.getService(ICodeService.class).getCode(type);
+ }
+
+ public static <T extends ICodeType> T reloadCodeType(Class<T> type) {
+ return SERVICES.getService(ICodeService.class).reloadCodeType(type);
+ }
+
+ public static ICodeType[] reloadCodeTypes(Class... types) {
+ return SERVICES.getService(ICodeService.class).reloadCodeTypes(types);
+ }
+
+ public static ICodeType[] getAllCodeTypes(String classPrefix) {
+ return SERVICES.getService(ICodeService.class).getAllCodeTypes(classPrefix);
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/code/CodeRow.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/code/CodeRow.java
index 1e50a4f653..ca35a2e952 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/code/CodeRow.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/code/CodeRow.java
@@ -1,272 +1,272 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.code;
-
-import java.io.Serializable;
-
-import org.eclipse.scout.commons.TypeCastUtility;
-import org.eclipse.scout.rt.shared.data.basic.FontSpec;
-
-public class CodeRow implements Serializable {
- private static final long serialVersionUID = 0L;
-
- private Object m_key;
- private String m_text;
- private String m_iconId;
- private String m_tooltip;
- private String m_backgroundColor;
- private String m_foregroundColor;
- private FontSpec m_font;
- private boolean m_active = true;
- private boolean m_enabled = true;
- private transient Object m_parentKey;
- private String m_extKey;
- private Number m_value;
- private long m_partitionId;
-
- public CodeRow(Object[] cells) {
- this(cells, cells.length - 1);
- }
-
- /**
- * Cell array containing the following values
- * <p>
- * [0] Long key <br>
- * [1] String text <br>
- * [2] String iconId <br>
- * [3] String tooltipText <br>
- * [4] String backgroundColor <br>
- * [5] String foregroundColor <br>
- * [6] String font <br>
- * [7] Long active (0 or 1) <br>
- * [8] Long parentKey <br>
- * [9] String extKey <br>
- * [10] Number value <br>
- * [11] Long enabled (0 or 1) <br>
- * [12] Long partitionId
- */
- public CodeRow(Object[] cells, int maxColumnIndex) {
- if (cells != null) {
- for (int index = 0; index < cells.length && index <= maxColumnIndex; index++) {
- if (cells[index] != null) {
- switch (index) {
- case 0: {
- m_key = cells[index];
- break;
- }
- case 1: {
- m_text = cells[index].toString();
- break;
- }
- case 2: {
- m_iconId = cells[index].toString();
- break;
- }
- case 3: {
- m_tooltip = cells[index].toString();
- break;
- }
- case 4: {
- m_backgroundColor = cells[index].toString();
- break;
- }
- case 5: {
- m_foregroundColor = cells[index].toString();
- break;
- }
- case 6: {
- m_font = FontSpec.parse(cells[index].toString());
- break;
- }
- case 7: {
- Boolean b = TypeCastUtility.castValue(cells[index], Boolean.class);
- m_active = b.booleanValue();
- break;
- }
- case 8: {
- Object o = cells[index];
- if ((o instanceof Number) && ((Number) o).longValue() == 0) {
- o = null;
- }
- m_parentKey = o;
- break;
- }
- case 9: {
- m_extKey = cells[index].toString();
- break;
- }
- case 10: {
- Object o = cells[index];
- if (o instanceof Number) {
- m_value = (Number) o;
- }
- break;
- }
- case 11: {
- Boolean b = TypeCastUtility.castValue(cells[index], Boolean.class);
- m_enabled = b.booleanValue();
- break;
- }
- case 12: {
- m_partitionId = ((Number) cells[index]).longValue();
- break;
- }
- }
- }
- }
- }
- }
-
- public CodeRow(CodeRow t) {
- this(
- t.getKey(),
- t.getText(),
- t.getIconId(),
- t.getTooltip(),
- t.getBackgroundColor(),
- t.getForegroundColor(),
- t.getFont(),
- t.isEnabled(),
- t.getParentKey(),
- t.isActive(),
- t.getExtKey(),
- t.getValue(),
- t.getPartitionId());
- }
-
- public CodeRow(Object key, String text) {
- m_key = key;
- m_text = text;
- }
-
- public CodeRow(Object key, String text, String iconId, String tooltip, String backgroundColor, String foregroundColor, FontSpec font, boolean enabled, Object parentKey, boolean active, String extKey, Number value, long partitionId) {
- m_key = key;
- m_text = text;
- m_iconId = iconId;
- m_tooltip = tooltip;
- m_backgroundColor = backgroundColor;
- m_foregroundColor = foregroundColor;
- m_font = font;
- m_active = active;
- m_enabled = enabled;
- m_parentKey = parentKey;
- m_extKey = extKey;
- m_value = value;
- m_partitionId = partitionId;
- }
-
- /*
- * typed member access
- */
- public Object getKey() {
- return m_key;
- }
-
- public void setKey(Object key) {
- m_key = key;
- }
-
- public String getText() {
- return m_text;
- }
-
- public void setText(String text) {
- m_text = text;
- }
-
- public String getIconId() {
- return m_iconId;
- }
-
- public void setIconId(String iconId) {
- m_iconId = iconId;
- }
-
- public String getTooltip() {
- return m_tooltip;
- }
-
- public void setTooltip(String tooltip) {
- m_tooltip = tooltip;
- }
-
- public String getForegroundColor() {
- return m_foregroundColor;
- }
-
- public void setForegroundColor(String foregroundColor) {
- m_foregroundColor = foregroundColor;
- }
-
- public String getBackgroundColor() {
- return m_backgroundColor;
- }
-
- public void setBackgroundColor(String backgroundColor) {
- m_backgroundColor = backgroundColor;
- }
-
- public FontSpec getFont() {
- return m_font;
- }
-
- public void setFont(FontSpec font) {
- m_font = font;
- }
-
- public boolean isActive() {
- return m_active;
- }
-
- public void setActive(boolean b) {
- m_active = b;
- }
-
- public boolean isEnabled() {
- return m_enabled;
- }
-
- public void setEnabled(boolean b) {
- m_enabled = b;
- }
-
- public Object getParentKey() {
- return m_parentKey;
- }
-
- public void setParentKey(Object parentKey) {
- m_parentKey = parentKey;
- }
-
- public String getExtKey() {
- return m_extKey;
- }
-
- public void setExtKey(String extKey) {
- m_extKey = extKey;
- }
-
- public Number getValue() {
- return m_value;
- }
-
- public void setValue(Number value) {
- m_value = value;
- }
-
- public long getPartitionId() {
- return m_partitionId;
- }
-
- public void setPartitionId(long partitionId) {
- m_partitionId = partitionId;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.code;
+
+import java.io.Serializable;
+
+import org.eclipse.scout.commons.TypeCastUtility;
+import org.eclipse.scout.rt.shared.data.basic.FontSpec;
+
+public class CodeRow implements Serializable {
+ private static final long serialVersionUID = 0L;
+
+ private Object m_key;
+ private String m_text;
+ private String m_iconId;
+ private String m_tooltip;
+ private String m_backgroundColor;
+ private String m_foregroundColor;
+ private FontSpec m_font;
+ private boolean m_active = true;
+ private boolean m_enabled = true;
+ private transient Object m_parentKey;
+ private String m_extKey;
+ private Number m_value;
+ private long m_partitionId;
+
+ public CodeRow(Object[] cells) {
+ this(cells, cells.length - 1);
+ }
+
+ /**
+ * Cell array containing the following values
+ * <p>
+ * [0] Long key <br>
+ * [1] String text <br>
+ * [2] String iconId <br>
+ * [3] String tooltipText <br>
+ * [4] String backgroundColor <br>
+ * [5] String foregroundColor <br>
+ * [6] String font <br>
+ * [7] Long active (0 or 1) <br>
+ * [8] Long parentKey <br>
+ * [9] String extKey <br>
+ * [10] Number value <br>
+ * [11] Long enabled (0 or 1) <br>
+ * [12] Long partitionId
+ */
+ public CodeRow(Object[] cells, int maxColumnIndex) {
+ if (cells != null) {
+ for (int index = 0; index < cells.length && index <= maxColumnIndex; index++) {
+ if (cells[index] != null) {
+ switch (index) {
+ case 0: {
+ m_key = cells[index];
+ break;
+ }
+ case 1: {
+ m_text = cells[index].toString();
+ break;
+ }
+ case 2: {
+ m_iconId = cells[index].toString();
+ break;
+ }
+ case 3: {
+ m_tooltip = cells[index].toString();
+ break;
+ }
+ case 4: {
+ m_backgroundColor = cells[index].toString();
+ break;
+ }
+ case 5: {
+ m_foregroundColor = cells[index].toString();
+ break;
+ }
+ case 6: {
+ m_font = FontSpec.parse(cells[index].toString());
+ break;
+ }
+ case 7: {
+ Boolean b = TypeCastUtility.castValue(cells[index], Boolean.class);
+ m_active = b.booleanValue();
+ break;
+ }
+ case 8: {
+ Object o = cells[index];
+ if ((o instanceof Number) && ((Number) o).longValue() == 0) {
+ o = null;
+ }
+ m_parentKey = o;
+ break;
+ }
+ case 9: {
+ m_extKey = cells[index].toString();
+ break;
+ }
+ case 10: {
+ Object o = cells[index];
+ if (o instanceof Number) {
+ m_value = (Number) o;
+ }
+ break;
+ }
+ case 11: {
+ Boolean b = TypeCastUtility.castValue(cells[index], Boolean.class);
+ m_enabled = b.booleanValue();
+ break;
+ }
+ case 12: {
+ m_partitionId = ((Number) cells[index]).longValue();
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ public CodeRow(CodeRow t) {
+ this(
+ t.getKey(),
+ t.getText(),
+ t.getIconId(),
+ t.getTooltip(),
+ t.getBackgroundColor(),
+ t.getForegroundColor(),
+ t.getFont(),
+ t.isEnabled(),
+ t.getParentKey(),
+ t.isActive(),
+ t.getExtKey(),
+ t.getValue(),
+ t.getPartitionId());
+ }
+
+ public CodeRow(Object key, String text) {
+ m_key = key;
+ m_text = text;
+ }
+
+ public CodeRow(Object key, String text, String iconId, String tooltip, String backgroundColor, String foregroundColor, FontSpec font, boolean enabled, Object parentKey, boolean active, String extKey, Number value, long partitionId) {
+ m_key = key;
+ m_text = text;
+ m_iconId = iconId;
+ m_tooltip = tooltip;
+ m_backgroundColor = backgroundColor;
+ m_foregroundColor = foregroundColor;
+ m_font = font;
+ m_active = active;
+ m_enabled = enabled;
+ m_parentKey = parentKey;
+ m_extKey = extKey;
+ m_value = value;
+ m_partitionId = partitionId;
+ }
+
+ /*
+ * typed member access
+ */
+ public Object getKey() {
+ return m_key;
+ }
+
+ public void setKey(Object key) {
+ m_key = key;
+ }
+
+ public String getText() {
+ return m_text;
+ }
+
+ public void setText(String text) {
+ m_text = text;
+ }
+
+ public String getIconId() {
+ return m_iconId;
+ }
+
+ public void setIconId(String iconId) {
+ m_iconId = iconId;
+ }
+
+ public String getTooltip() {
+ return m_tooltip;
+ }
+
+ public void setTooltip(String tooltip) {
+ m_tooltip = tooltip;
+ }
+
+ public String getForegroundColor() {
+ return m_foregroundColor;
+ }
+
+ public void setForegroundColor(String foregroundColor) {
+ m_foregroundColor = foregroundColor;
+ }
+
+ public String getBackgroundColor() {
+ return m_backgroundColor;
+ }
+
+ public void setBackgroundColor(String backgroundColor) {
+ m_backgroundColor = backgroundColor;
+ }
+
+ public FontSpec getFont() {
+ return m_font;
+ }
+
+ public void setFont(FontSpec font) {
+ m_font = font;
+ }
+
+ public boolean isActive() {
+ return m_active;
+ }
+
+ public void setActive(boolean b) {
+ m_active = b;
+ }
+
+ public boolean isEnabled() {
+ return m_enabled;
+ }
+
+ public void setEnabled(boolean b) {
+ m_enabled = b;
+ }
+
+ public Object getParentKey() {
+ return m_parentKey;
+ }
+
+ public void setParentKey(Object parentKey) {
+ m_parentKey = parentKey;
+ }
+
+ public String getExtKey() {
+ return m_extKey;
+ }
+
+ public void setExtKey(String extKey) {
+ m_extKey = extKey;
+ }
+
+ public Number getValue() {
+ return m_value;
+ }
+
+ public void setValue(Number value) {
+ m_value = value;
+ }
+
+ public long getPartitionId() {
+ return m_partitionId;
+ }
+
+ public void setPartitionId(long partitionId) {
+ m_partitionId = partitionId;
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/code/CodeTypeChangedNotification.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/code/CodeTypeChangedNotification.java
index 49db653576..802327e6f0 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/code/CodeTypeChangedNotification.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/code/CodeTypeChangedNotification.java
@@ -1,64 +1,64 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.code;
-
-import java.io.Serializable;
-import java.util.Arrays;
-import java.util.HashSet;
-
-import org.eclipse.scout.rt.shared.services.common.clientnotification.AbstractClientNotification;
-import org.eclipse.scout.rt.shared.services.common.clientnotification.IClientNotification;
-
-/**
- * Notification is sent from server to client to notify that the code type has
- * changed and the client should clear its cache
- */
-public class CodeTypeChangedNotification extends AbstractClientNotification {
- private static final long serialVersionUID = 1L;
- private Class<? extends Serializable>[] m_codeTypes;
-
- public CodeTypeChangedNotification(Class<? extends Serializable>[] codeTypes) {
- m_codeTypes = codeTypes;
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public boolean coalesce(IClientNotification existingNotification) {
- CodeTypeChangedNotification n = (CodeTypeChangedNotification) existingNotification;
- HashSet<Class<? extends Serializable>> set = new HashSet<Class<? extends Serializable>>();
- set.addAll(Arrays.asList(this.m_codeTypes));
- set.addAll(Arrays.asList(n.m_codeTypes));
- m_codeTypes = set.toArray(new Class[set.size()]);
- if (this.getOriginNode() != existingNotification.getOriginNode()) {
- this.setOriginNode(0);
- }
- return true;
- }
-
- public Class<? extends Serializable>[] getCodeTypes() {
- return m_codeTypes;
- }
-
- @Override
- public String toString() {
- StringBuffer b = new StringBuffer(getClass().getSimpleName());
- b.append("[");
- for (int i = 0; i < m_codeTypes.length; i++) {
- if (i > 0) {
- b.append(", ");
- }
- b.append(m_codeTypes[i].getSimpleName());
- }
- b.append("]");
- return b.toString();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.code;
+
+import java.io.Serializable;
+import java.util.Arrays;
+import java.util.HashSet;
+
+import org.eclipse.scout.rt.shared.services.common.clientnotification.AbstractClientNotification;
+import org.eclipse.scout.rt.shared.services.common.clientnotification.IClientNotification;
+
+/**
+ * Notification is sent from server to client to notify that the code type has
+ * changed and the client should clear its cache
+ */
+public class CodeTypeChangedNotification extends AbstractClientNotification {
+ private static final long serialVersionUID = 1L;
+ private Class<? extends Serializable>[] m_codeTypes;
+
+ public CodeTypeChangedNotification(Class<? extends Serializable>[] codeTypes) {
+ m_codeTypes = codeTypes;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public boolean coalesce(IClientNotification existingNotification) {
+ CodeTypeChangedNotification n = (CodeTypeChangedNotification) existingNotification;
+ HashSet<Class<? extends Serializable>> set = new HashSet<Class<? extends Serializable>>();
+ set.addAll(Arrays.asList(this.m_codeTypes));
+ set.addAll(Arrays.asList(n.m_codeTypes));
+ m_codeTypes = set.toArray(new Class[set.size()]);
+ if (this.getOriginNode() != existingNotification.getOriginNode()) {
+ this.setOriginNode(0);
+ }
+ return true;
+ }
+
+ public Class<? extends Serializable>[] getCodeTypes() {
+ return m_codeTypes;
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer b = new StringBuffer(getClass().getSimpleName());
+ b.append("[");
+ for (int i = 0; i < m_codeTypes.length; i++) {
+ if (i > 0) {
+ b.append(", ");
+ }
+ b.append(m_codeTypes[i].getSimpleName());
+ }
+ b.append("]");
+ return b.toString();
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/code/ICode.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/code/ICode.java
index 6caabb8e98..a7a1d6a97b 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/code/ICode.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/code/ICode.java
@@ -1,89 +1,89 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.code;
-
-import org.eclipse.scout.rt.shared.data.basic.FontSpec;
-
-public interface ICode<T> {
-
- /**
- * The id represented by this code, this is <b>not</b> the same as {@link #getValue()}
- */
- T getId();
-
- ICode getParentCode();
-
- /**
- * do not use this internal method
- */
- void setParentCodeInternal(ICode c);
-
- ICode[] getChildCodes();
-
- ICode[] getChildCodes(boolean activeOnly);
-
- ICode getChildCode(Object codeId);
-
- ICode getChildCodeByExtKey(Object extKey);
-
- /**
- * do not use this internal method
- */
- void addChildCodeInternal(ICode code);
-
- ICodeType getCodeType();
-
- /**
- * do not use this internal method
- */
- void setCodeTypeInternal(ICodeType type);
-
- String getText();
-
- boolean isActive();
-
- boolean isEnabled();
-
- String getIconId();
-
- String getTooltipText();
-
- String getBackgroundColor();
-
- String getForegroundColor();
-
- FontSpec getFont();
-
- /**
- * Used for primary key mappings to external systems
- */
- String getExtKey();
-
- /**
- * The value represented by this code, this is <b>not</b> the same as {@link #getId()}
- */
- Number getValue();
-
- /**
- * see {@link ICodeType}
- */
- long getPartitionId();
-
- /**
- * Visit all codes in the subtree of this code <b>excluding</b> this code.
- */
- boolean visit(ICodeVisitor visitor, int level, boolean activeOnly);
-
- /**
- * @return a value copy of the code state in form a {@link CodeRow}
- */
- CodeRow toCodeRow();
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.code;
+
+import org.eclipse.scout.rt.shared.data.basic.FontSpec;
+
+public interface ICode<T> {
+
+ /**
+ * The id represented by this code, this is <b>not</b> the same as {@link #getValue()}
+ */
+ T getId();
+
+ ICode getParentCode();
+
+ /**
+ * do not use this internal method
+ */
+ void setParentCodeInternal(ICode c);
+
+ ICode[] getChildCodes();
+
+ ICode[] getChildCodes(boolean activeOnly);
+
+ ICode getChildCode(Object codeId);
+
+ ICode getChildCodeByExtKey(Object extKey);
+
+ /**
+ * do not use this internal method
+ */
+ void addChildCodeInternal(ICode code);
+
+ ICodeType getCodeType();
+
+ /**
+ * do not use this internal method
+ */
+ void setCodeTypeInternal(ICodeType type);
+
+ String getText();
+
+ boolean isActive();
+
+ boolean isEnabled();
+
+ String getIconId();
+
+ String getTooltipText();
+
+ String getBackgroundColor();
+
+ String getForegroundColor();
+
+ FontSpec getFont();
+
+ /**
+ * Used for primary key mappings to external systems
+ */
+ String getExtKey();
+
+ /**
+ * The value represented by this code, this is <b>not</b> the same as {@link #getId()}
+ */
+ Number getValue();
+
+ /**
+ * see {@link ICodeType}
+ */
+ long getPartitionId();
+
+ /**
+ * Visit all codes in the subtree of this code <b>excluding</b> this code.
+ */
+ boolean visit(ICodeVisitor visitor, int level, boolean activeOnly);
+
+ /**
+ * @return a value copy of the code state in form a {@link CodeRow}
+ */
+ CodeRow toCodeRow();
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/code/ICodeService.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/code/ICodeService.java
index fdaaadb755..48921612f6 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/code/ICodeService.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/code/ICodeService.java
@@ -1,73 +1,73 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.code;
-
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.commons.osgi.BundleClassDescriptor;
-import org.eclipse.scout.rt.shared.servicetunnel.RemoteServiceAccessDenied;
-import org.eclipse.scout.rt.shared.validate.InputValidation;
-import org.eclipse.scout.rt.shared.validate.IValidationStrategy;
-import org.eclipse.scout.service.IService;
-
-@Priority(-3)
-@InputValidation(IValidationStrategy.PROCESS.class)
-public interface ICodeService extends IService {
-
- <T extends ICodeType> T getCodeType(Class<T> type);
-
- <T extends ICodeType> T getCodeType(Long partitionId, Class<T> type);
-
- /**
- * @param id
- * @return the type found or null
- * Note that this method does not load code types, but only searches code types already loaded into the code
- * service using {@link #getAllCodeTypes(String)}, {@link #getCodeType(Class)} etc.
- */
- ICodeType findCodeTypeById(Object id);
-
- /**
- * @param partitionId
- * @param id
- * @return the type found or null
- * Note that this method does not load code types, but only searches code types already loaded into the code
- * service using {@link #getAllCodeTypes(String)}, {@link #getCodeType(Class)} etc.
- */
- ICodeType findCodeTypeById(Long partitionId, Object id);
-
- ICodeType[] getCodeTypes(Class... types);
-
- ICodeType[] getCodeTypes(Long partitionId, Class... types);
-
- <T extends ICode> T getCode(Class<T> type);
-
- <T extends ICode> T getCode(Long partitionId, Class<T> type);
-
- /**
- * reload code type
- */
- <T extends ICodeType> T reloadCodeType(Class<T> type);
-
- /**
- * reload code types
- */
- ICodeType[] reloadCodeTypes(Class... types);
-
- /**
- * @return all codetype classes from bundles with classPrefix
- */
- BundleClassDescriptor[] getAllCodeTypeClasses(String classPrefix);
-
- @RemoteServiceAccessDenied
- ICodeType[] getAllCodeTypes(String classPrefix);
-
- @RemoteServiceAccessDenied
- ICodeType[] getAllCodeTypes(String classPrefix, Long partitionId);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.code;
+
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.commons.osgi.BundleClassDescriptor;
+import org.eclipse.scout.rt.shared.servicetunnel.RemoteServiceAccessDenied;
+import org.eclipse.scout.rt.shared.validate.InputValidation;
+import org.eclipse.scout.rt.shared.validate.IValidationStrategy;
+import org.eclipse.scout.service.IService;
+
+@Priority(-3)
+@InputValidation(IValidationStrategy.PROCESS.class)
+public interface ICodeService extends IService {
+
+ <T extends ICodeType> T getCodeType(Class<T> type);
+
+ <T extends ICodeType> T getCodeType(Long partitionId, Class<T> type);
+
+ /**
+ * @param id
+ * @return the type found or null
+ * Note that this method does not load code types, but only searches code types already loaded into the code
+ * service using {@link #getAllCodeTypes(String)}, {@link #getCodeType(Class)} etc.
+ */
+ ICodeType findCodeTypeById(Object id);
+
+ /**
+ * @param partitionId
+ * @param id
+ * @return the type found or null
+ * Note that this method does not load code types, but only searches code types already loaded into the code
+ * service using {@link #getAllCodeTypes(String)}, {@link #getCodeType(Class)} etc.
+ */
+ ICodeType findCodeTypeById(Long partitionId, Object id);
+
+ ICodeType[] getCodeTypes(Class... types);
+
+ ICodeType[] getCodeTypes(Long partitionId, Class... types);
+
+ <T extends ICode> T getCode(Class<T> type);
+
+ <T extends ICode> T getCode(Long partitionId, Class<T> type);
+
+ /**
+ * reload code type
+ */
+ <T extends ICodeType> T reloadCodeType(Class<T> type);
+
+ /**
+ * reload code types
+ */
+ ICodeType[] reloadCodeTypes(Class... types);
+
+ /**
+ * @return all codetype classes from bundles with classPrefix
+ */
+ BundleClassDescriptor[] getAllCodeTypeClasses(String classPrefix);
+
+ @RemoteServiceAccessDenied
+ ICodeType[] getAllCodeTypes(String classPrefix);
+
+ @RemoteServiceAccessDenied
+ ICodeType[] getAllCodeTypes(String classPrefix, Long partitionId);
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/code/ICodeType.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/code/ICodeType.java
index 69aa7c81e6..1fc1f983e4 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/code/ICodeType.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/code/ICodeType.java
@@ -1,82 +1,82 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.code;
-
-/**
- * Code types are dynamic enumerations used in front- and back-end. <br>
- * A code type may (must not) contain codes divided into different partitions
- * (german: Mandanten) using the partitionId. <br>
- * If partitions are used, a context contains to a certain partition and
- * receives only his codes.
- */
-public interface ICodeType<T> {
-
- /**
- * property into ISharedContextService's Map to get default partitionId of
- * current Subject / User
- */
- String PROP_PARTITION_ID = "partitionId";
-
- T getId();
-
- boolean isHierarchy();
-
- int getMaxLevel();
-
- String getText();
-
- String getIconId();
-
- /**
- * all active top-level (root) codes
- */
- ICode[] getCodes();
-
- /**
- * all top-level (root) codes
- */
- ICode[] getCodes(boolean activeOnly);
-
- /**
- * find the code with this id
- */
- ICode getCode(Object id);
-
- /**
- * find the code with this external reference
- */
- ICode getCodeByExtKey(Object extKey);
-
- /**
- * @return the index (starting at 0) of this code, -1 when not found <br>
- * When the code type is a tree, the top-down-left-right traversal
- * index is used
- */
- int getCodeIndex(final Object id);
-
- /**
- * @return the index (starting at 0) of this code, -1 when not found <br>
- * When the code type is a tree, the top-down-left-right traversal
- * index is used
- */
- int getCodeIndex(final ICode c);
-
- /**
- * visits per default only the active codes
- *
- * @param visitor
- * @return
- */
- boolean visit(ICodeVisitor visitor);
-
- boolean visit(ICodeVisitor visitor, boolean activeOnly);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.code;
+
+/**
+ * Code types are dynamic enumerations used in front- and back-end. <br>
+ * A code type may (must not) contain codes divided into different partitions
+ * (german: Mandanten) using the partitionId. <br>
+ * If partitions are used, a context contains to a certain partition and
+ * receives only his codes.
+ */
+public interface ICodeType<T> {
+
+ /**
+ * property into ISharedContextService's Map to get default partitionId of
+ * current Subject / User
+ */
+ String PROP_PARTITION_ID = "partitionId";
+
+ T getId();
+
+ boolean isHierarchy();
+
+ int getMaxLevel();
+
+ String getText();
+
+ String getIconId();
+
+ /**
+ * all active top-level (root) codes
+ */
+ ICode[] getCodes();
+
+ /**
+ * all top-level (root) codes
+ */
+ ICode[] getCodes(boolean activeOnly);
+
+ /**
+ * find the code with this id
+ */
+ ICode getCode(Object id);
+
+ /**
+ * find the code with this external reference
+ */
+ ICode getCodeByExtKey(Object extKey);
+
+ /**
+ * @return the index (starting at 0) of this code, -1 when not found <br>
+ * When the code type is a tree, the top-down-left-right traversal
+ * index is used
+ */
+ int getCodeIndex(final Object id);
+
+ /**
+ * @return the index (starting at 0) of this code, -1 when not found <br>
+ * When the code type is a tree, the top-down-left-right traversal
+ * index is used
+ */
+ int getCodeIndex(final ICode c);
+
+ /**
+ * visits per default only the active codes
+ *
+ * @param visitor
+ * @return
+ */
+ boolean visit(ICodeVisitor visitor);
+
+ boolean visit(ICodeVisitor visitor, boolean activeOnly);
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/code/ICodeVisitor.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/code/ICodeVisitor.java
index 69085cc0c6..b14d8a6aa5 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/code/ICodeVisitor.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/code/ICodeVisitor.java
@@ -1,20 +1,20 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.code;
-
-public interface ICodeVisitor {
-
- /**
- * @return true=continue visiting, false=end visiting
- */
- boolean visit(ICode code, int treeLevel);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.code;
+
+public interface ICodeVisitor {
+
+ /**
+ * @return true=continue visiting, false=end visiting
+ */
+ boolean visit(ICode code, int treeLevel);
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/code/MutableCode.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/code/MutableCode.java
index c7e9d17566..f44341bf98 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/code/MutableCode.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/code/MutableCode.java
@@ -1,19 +1,19 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.code;
-
-public class MutableCode<T> extends AbstractCode<T> {
- private static final long serialVersionUID = 1L;
-
- public MutableCode(CodeRow row) {
- super(row);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.code;
+
+public class MutableCode<T> extends AbstractCode<T> {
+ private static final long serialVersionUID = 1L;
+
+ public MutableCode(CodeRow row) {
+ super(row);
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/context/SharedContextChangedNotification.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/context/SharedContextChangedNotification.java
index 1a355f2da3..f032e81c43 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/context/SharedContextChangedNotification.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/context/SharedContextChangedNotification.java
@@ -1,42 +1,42 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.context;
-
-import org.eclipse.scout.rt.shared.services.common.clientnotification.AbstractClientNotification;
-import org.eclipse.scout.rt.shared.services.common.clientnotification.IClientNotification;
-
-public class SharedContextChangedNotification extends AbstractClientNotification {
- private static final long serialVersionUID = 1L;
-
- private SharedVariableMap m_sharedVariableMap;
-
- public SharedContextChangedNotification(SharedVariableMap sharedVariableMap) {
- m_sharedVariableMap = sharedVariableMap;
- }
-
- @Override
- public boolean coalesce(IClientNotification existingNotification) {
- return true;
- }
-
- public SharedVariableMap getSharedVariableMap() {
- return m_sharedVariableMap;
- }
-
- @Override
- public String toString() {
- StringBuffer b = new StringBuffer(getClass().getSimpleName());
- b.append("[");
- b.append("]");
- return b.toString();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.context;
+
+import org.eclipse.scout.rt.shared.services.common.clientnotification.AbstractClientNotification;
+import org.eclipse.scout.rt.shared.services.common.clientnotification.IClientNotification;
+
+public class SharedContextChangedNotification extends AbstractClientNotification {
+ private static final long serialVersionUID = 1L;
+
+ private SharedVariableMap m_sharedVariableMap;
+
+ public SharedContextChangedNotification(SharedVariableMap sharedVariableMap) {
+ m_sharedVariableMap = sharedVariableMap;
+ }
+
+ @Override
+ public boolean coalesce(IClientNotification existingNotification) {
+ return true;
+ }
+
+ public SharedVariableMap getSharedVariableMap() {
+ return m_sharedVariableMap;
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer b = new StringBuffer(getClass().getSimpleName());
+ b.append("[");
+ b.append("]");
+ return b.toString();
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/context/SharedVariableMap.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/context/SharedVariableMap.java
index c3443bb142..473456c3b6 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/context/SharedVariableMap.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/context/SharedVariableMap.java
@@ -1,166 +1,166 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.context;
-
-import java.beans.PropertyChangeListener;
-import java.io.Serializable;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.scout.commons.beans.BasicPropertySupport;
-
-/**
- * Property observer fires property "values" of data type Map<String,Object>
- */
-public class SharedVariableMap implements Serializable, Map<String, Object> {
- private static final long serialVersionUID = 1L;
-
- private int m_version;
- private HashMap<String, Object> m_variables;
- private transient BasicPropertySupport m_propertySupport;
-
- public SharedVariableMap() {
- m_version = 0;
- m_variables = new HashMap<String, Object>();
- m_propertySupport = new BasicPropertySupport(this);
- }
-
- public SharedVariableMap(SharedVariableMap map) {
- m_version = map.m_version;
- m_variables = new HashMap<String, Object>(map.m_variables);
- }
-
- public void addPropertyChangeListener(PropertyChangeListener listener) {
- m_propertySupport.addPropertyChangeListener(listener);
- }
-
- public void removePropertyChangeListener(PropertyChangeListener listener) {
- m_propertySupport.removePropertyChangeListener(listener);
- }
-
- /**
- * Update values of this variable map with the new one if version of new map
- * is newer <br>
- * Does not fire a change event
- */
- public void updateInternal(SharedVariableMap newMap) {
- if (newMap.getVersion() != getVersion()) {
- m_variables = new HashMap<String, Object>(newMap.m_variables);
- m_version = newMap.getVersion();
- }
- }
-
- /**
- * @return the version seq of the map state. This version number is changed every time the variable map changes.
- * Note that even a different number means that the version changed, it must not be higher, just different.
- * <p>
- * see https://bugs.eclipse.org/bugs/show_bug.cgi?id=358344
- */
- public int getVersion() {
- return m_version;
- }
-
- private void mapChanged() {
- m_version++;
- if (m_propertySupport != null) {
- m_propertySupport.firePropertyChange("values", null, new HashMap<String, Object>(m_variables));
- }
- }
-
- /*
- * Map implementation
- */
- /**
- * Fires a change event
- */
- @Override
- public void clear() {
- m_variables.clear();
- mapChanged();
- }
-
- @Override
- public boolean containsKey(Object key) {
- return m_variables.containsKey(key);
- }
-
- @Override
- public boolean containsValue(Object value) {
- return m_variables.containsValue(value);
- }
-
- @Override
- public Set<java.util.Map.Entry<String, Object>> entrySet() {
- return Collections.unmodifiableSet(m_variables.entrySet());
- }
-
- @Override
- public Object get(Object key) {
- return m_variables.get(key);
- }
-
- @Override
- public boolean isEmpty() {
- return m_variables.isEmpty();
- }
-
- @Override
- public Set<String> keySet() {
- return Collections.unmodifiableSet(m_variables.keySet());
- }
-
- /**
- * Fires a change event
- */
- @Override
- public Object put(String key, Object value) {
- Object o = m_variables.put(key, value);
- mapChanged();
- return o;
- }
-
- /**
- * Fires a change event
- */
- @Override
- public void putAll(Map<? extends String, ? extends Object> m) {
- m_variables.putAll(m);
- mapChanged();
- }
-
- /**
- * Fires a change event
- */
- @Override
- public Object remove(Object key) {
- Object o = m_variables.remove(key);
- mapChanged();
- return o;
- }
-
- @Override
- public int size() {
- return m_variables.size();
- }
-
- @Override
- public Collection<Object> values() {
- return Collections.unmodifiableCollection(m_variables.values());
- }
-
- @Override
- public String toString() {
- return m_variables.toString();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.context;
+
+import java.beans.PropertyChangeListener;
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.scout.commons.beans.BasicPropertySupport;
+
+/**
+ * Property observer fires property "values" of data type Map<String,Object>
+ */
+public class SharedVariableMap implements Serializable, Map<String, Object> {
+ private static final long serialVersionUID = 1L;
+
+ private int m_version;
+ private HashMap<String, Object> m_variables;
+ private transient BasicPropertySupport m_propertySupport;
+
+ public SharedVariableMap() {
+ m_version = 0;
+ m_variables = new HashMap<String, Object>();
+ m_propertySupport = new BasicPropertySupport(this);
+ }
+
+ public SharedVariableMap(SharedVariableMap map) {
+ m_version = map.m_version;
+ m_variables = new HashMap<String, Object>(map.m_variables);
+ }
+
+ public void addPropertyChangeListener(PropertyChangeListener listener) {
+ m_propertySupport.addPropertyChangeListener(listener);
+ }
+
+ public void removePropertyChangeListener(PropertyChangeListener listener) {
+ m_propertySupport.removePropertyChangeListener(listener);
+ }
+
+ /**
+ * Update values of this variable map with the new one if version of new map
+ * is newer <br>
+ * Does not fire a change event
+ */
+ public void updateInternal(SharedVariableMap newMap) {
+ if (newMap.getVersion() != getVersion()) {
+ m_variables = new HashMap<String, Object>(newMap.m_variables);
+ m_version = newMap.getVersion();
+ }
+ }
+
+ /**
+ * @return the version seq of the map state. This version number is changed every time the variable map changes.
+ * Note that even a different number means that the version changed, it must not be higher, just different.
+ * <p>
+ * see https://bugs.eclipse.org/bugs/show_bug.cgi?id=358344
+ */
+ public int getVersion() {
+ return m_version;
+ }
+
+ private void mapChanged() {
+ m_version++;
+ if (m_propertySupport != null) {
+ m_propertySupport.firePropertyChange("values", null, new HashMap<String, Object>(m_variables));
+ }
+ }
+
+ /*
+ * Map implementation
+ */
+ /**
+ * Fires a change event
+ */
+ @Override
+ public void clear() {
+ m_variables.clear();
+ mapChanged();
+ }
+
+ @Override
+ public boolean containsKey(Object key) {
+ return m_variables.containsKey(key);
+ }
+
+ @Override
+ public boolean containsValue(Object value) {
+ return m_variables.containsValue(value);
+ }
+
+ @Override
+ public Set<java.util.Map.Entry<String, Object>> entrySet() {
+ return Collections.unmodifiableSet(m_variables.entrySet());
+ }
+
+ @Override
+ public Object get(Object key) {
+ return m_variables.get(key);
+ }
+
+ @Override
+ public boolean isEmpty() {
+ return m_variables.isEmpty();
+ }
+
+ @Override
+ public Set<String> keySet() {
+ return Collections.unmodifiableSet(m_variables.keySet());
+ }
+
+ /**
+ * Fires a change event
+ */
+ @Override
+ public Object put(String key, Object value) {
+ Object o = m_variables.put(key, value);
+ mapChanged();
+ return o;
+ }
+
+ /**
+ * Fires a change event
+ */
+ @Override
+ public void putAll(Map<? extends String, ? extends Object> m) {
+ m_variables.putAll(m);
+ mapChanged();
+ }
+
+ /**
+ * Fires a change event
+ */
+ @Override
+ public Object remove(Object key) {
+ Object o = m_variables.remove(key);
+ mapChanged();
+ return o;
+ }
+
+ @Override
+ public int size() {
+ return m_variables.size();
+ }
+
+ @Override
+ public Collection<Object> values() {
+ return Collections.unmodifiableCollection(m_variables.values());
+ }
+
+ @Override
+ public String toString() {
+ return m_variables.toString();
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/exceptionhandler/IExceptionHandlerService.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/exceptionhandler/IExceptionHandlerService.java
index 297d8d6fbf..62462da0a9 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/exceptionhandler/IExceptionHandlerService.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/exceptionhandler/IExceptionHandlerService.java
@@ -1,25 +1,25 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.exceptionhandler;
-
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.shared.validate.InputValidation;
-import org.eclipse.scout.rt.shared.validate.IValidationStrategy;
-import org.eclipse.scout.service.IService;
-
-@Priority(-3)
-@InputValidation(IValidationStrategy.PROCESS.class)
-public interface IExceptionHandlerService extends IService {
-
- void handleException(ProcessingException t);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.exceptionhandler;
+
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.shared.validate.InputValidation;
+import org.eclipse.scout.rt.shared.validate.IValidationStrategy;
+import org.eclipse.scout.service.IService;
+
+@Priority(-3)
+@InputValidation(IValidationStrategy.PROCESS.class)
+public interface IExceptionHandlerService extends IService {
+
+ void handleException(ProcessingException t);
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/exceptionhandler/LogExceptionHandlerService.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/exceptionhandler/LogExceptionHandlerService.java
index 5a5f83799b..609204ef64 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/exceptionhandler/LogExceptionHandlerService.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/exceptionhandler/LogExceptionHandlerService.java
@@ -1,80 +1,80 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.exceptionhandler;
-
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.commons.exception.IProcessingStatus;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.exception.VetoException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.service.AbstractService;
-
-@Priority(-2)
-public class LogExceptionHandlerService extends AbstractService implements IExceptionHandlerService {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(LogExceptionHandlerService.class);
-
- public LogExceptionHandlerService() {
- }
-
- @Override
- public void handleException(ProcessingException pe) {
- if (pe.isInterruption()) {
- return;
- }
- IProcessingStatus s = pe.getStatus();
- int logLevel = IScoutLogger.LEVEL_ERROR;
- if (pe instanceof VetoException) {
- logLevel = IScoutLogger.LEVEL_INFO;
- }
- else {
- switch (s.getSeverity()) {
- case IProcessingStatus.INFO: {
- logLevel = IScoutLogger.LEVEL_INFO;
- break;
- }
- case IProcessingStatus.WARNING: {
- logLevel = IScoutLogger.LEVEL_WARN;
- break;
- }
- case IProcessingStatus.ERROR: {
- logLevel = IScoutLogger.LEVEL_ERROR;
- break;
- }
- case IProcessingStatus.FATAL: {
- logLevel = IScoutLogger.LEVEL_ERROR;
- break;
- }
- }
- }
- differentiatedLog(LogExceptionHandlerService.class.getName(), logLevel, s.toString(), pe);
- }
-
- void differentiatedLog(String fqcn, int level, String m, Throwable t) {
- switch (level) {
- case IScoutLogger.LEVEL_TRACE:
- LOG.trace(m, t);
- break;
- case IScoutLogger.LEVEL_DEBUG:
- LOG.debug(m, t);
- break;
- case IScoutLogger.LEVEL_INFO:
- LOG.info(m, t);
- break;
- case IScoutLogger.LEVEL_WARN:
- LOG.warn(m, t);
- break;
- case IScoutLogger.LEVEL_ERROR:
- LOG.error(m, t);
- break;
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.exceptionhandler;
+
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.commons.exception.IProcessingStatus;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.exception.VetoException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.service.AbstractService;
+
+@Priority(-2)
+public class LogExceptionHandlerService extends AbstractService implements IExceptionHandlerService {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(LogExceptionHandlerService.class);
+
+ public LogExceptionHandlerService() {
+ }
+
+ @Override
+ public void handleException(ProcessingException pe) {
+ if (pe.isInterruption()) {
+ return;
+ }
+ IProcessingStatus s = pe.getStatus();
+ int logLevel = IScoutLogger.LEVEL_ERROR;
+ if (pe instanceof VetoException) {
+ logLevel = IScoutLogger.LEVEL_INFO;
+ }
+ else {
+ switch (s.getSeverity()) {
+ case IProcessingStatus.INFO: {
+ logLevel = IScoutLogger.LEVEL_INFO;
+ break;
+ }
+ case IProcessingStatus.WARNING: {
+ logLevel = IScoutLogger.LEVEL_WARN;
+ break;
+ }
+ case IProcessingStatus.ERROR: {
+ logLevel = IScoutLogger.LEVEL_ERROR;
+ break;
+ }
+ case IProcessingStatus.FATAL: {
+ logLevel = IScoutLogger.LEVEL_ERROR;
+ break;
+ }
+ }
+ }
+ differentiatedLog(LogExceptionHandlerService.class.getName(), logLevel, s.toString(), pe);
+ }
+
+ void differentiatedLog(String fqcn, int level, String m, Throwable t) {
+ switch (level) {
+ case IScoutLogger.LEVEL_TRACE:
+ LOG.trace(m, t);
+ break;
+ case IScoutLogger.LEVEL_DEBUG:
+ LOG.debug(m, t);
+ break;
+ case IScoutLogger.LEVEL_INFO:
+ LOG.info(m, t);
+ break;
+ case IScoutLogger.LEVEL_WARN:
+ LOG.warn(m, t);
+ break;
+ case IScoutLogger.LEVEL_ERROR:
+ LOG.error(m, t);
+ break;
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/file/CompressedOutputStream.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/file/CompressedOutputStream.java
index c200a54387..fbf7dfe8f8 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/file/CompressedOutputStream.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/file/CompressedOutputStream.java
@@ -1,75 +1,75 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.file;
-
-/**
- * @version 3.x
- */
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.zip.CRC32;
-import java.util.zip.Deflater;
-import java.util.zip.DeflaterOutputStream;
-
-public class CompressedOutputStream extends OutputStream {
- private RemoteFile m_remoteFile;
- private ByteArrayOutputStream m_buffer;
- private Deflater m_deflater;
- private DeflaterOutputStream m_deflaterOutputStream;
- private CRC32 m_crc32;
-
- public CompressedOutputStream(RemoteFile f) {
- m_remoteFile = f;
- m_buffer = new ByteArrayOutputStream();
- m_deflater = new Deflater(Deflater.BEST_COMPRESSION);
- m_deflaterOutputStream = new DeflaterOutputStream(m_buffer, m_deflater); // schreibt
- // die
- // komprimierten
- // Daten
- // in
- // den
- // Stream
- // m_buffer
- m_crc32 = new CRC32();
- }
-
- @Override
- public void close() throws IOException {
- flush();
- m_deflater.finish();
- m_deflaterOutputStream.finish();
- m_deflater.end();
- m_deflaterOutputStream.close();
- m_buffer.close();
- m_remoteFile.setCompressedData(m_buffer.toByteArray(), m_crc32.getValue());
- }
-
- @Override
- public void flush() throws IOException {
- m_deflaterOutputStream.flush();
- m_buffer.flush();
- }
-
- @Override
- public void write(int b) throws IOException {
- m_crc32.update(b);
- m_deflaterOutputStream.write(b);
- }
-
- @Override
- public void write(byte[] buf, int off, int len) throws IOException {
- // wandle bytes in String um mit richtiger codierung/charset
- m_crc32.update(buf, off, len);
- m_deflaterOutputStream.write(buf, off, len);
- flush();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.file;
+
+/**
+ * @version 3.x
+ */
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.zip.CRC32;
+import java.util.zip.Deflater;
+import java.util.zip.DeflaterOutputStream;
+
+public class CompressedOutputStream extends OutputStream {
+ private RemoteFile m_remoteFile;
+ private ByteArrayOutputStream m_buffer;
+ private Deflater m_deflater;
+ private DeflaterOutputStream m_deflaterOutputStream;
+ private CRC32 m_crc32;
+
+ public CompressedOutputStream(RemoteFile f) {
+ m_remoteFile = f;
+ m_buffer = new ByteArrayOutputStream();
+ m_deflater = new Deflater(Deflater.BEST_COMPRESSION);
+ m_deflaterOutputStream = new DeflaterOutputStream(m_buffer, m_deflater); // schreibt
+ // die
+ // komprimierten
+ // Daten
+ // in
+ // den
+ // Stream
+ // m_buffer
+ m_crc32 = new CRC32();
+ }
+
+ @Override
+ public void close() throws IOException {
+ flush();
+ m_deflater.finish();
+ m_deflaterOutputStream.finish();
+ m_deflater.end();
+ m_deflaterOutputStream.close();
+ m_buffer.close();
+ m_remoteFile.setCompressedData(m_buffer.toByteArray(), m_crc32.getValue());
+ }
+
+ @Override
+ public void flush() throws IOException {
+ m_deflaterOutputStream.flush();
+ m_buffer.flush();
+ }
+
+ @Override
+ public void write(int b) throws IOException {
+ m_crc32.update(b);
+ m_deflaterOutputStream.write(b);
+ }
+
+ @Override
+ public void write(byte[] buf, int off, int len) throws IOException {
+ // wandle bytes in String um mit richtiger codierung/charset
+ m_crc32.update(buf, off, len);
+ m_deflaterOutputStream.write(buf, off, len);
+ flush();
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/file/CompressedWriter.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/file/CompressedWriter.java
index 6be0f4f816..35c5289c69 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/file/CompressedWriter.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/file/CompressedWriter.java
@@ -1,82 +1,82 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.file;
-
-/**
- * @version 3.x
- */
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.Writer;
-import java.util.zip.CRC32;
-import java.util.zip.Deflater;
-import java.util.zip.DeflaterOutputStream;
-
-public class CompressedWriter extends Writer {
- private static final String DEFAULT_CHARSETNAME = "UTF-8";
- private RemoteFile m_remoteFile;
- private ByteArrayOutputStream m_buffer;
- private Deflater m_deflater;
- private DeflaterOutputStream m_deflaterOutputStream;
- private CRC32 m_crc32;
- private String m_charsetName = DEFAULT_CHARSETNAME;
-
- public CompressedWriter(RemoteFile f) {
- this(f, DEFAULT_CHARSETNAME);
- }
-
- public CompressedWriter(RemoteFile f, String charsetName) {
- m_remoteFile = f;
- m_charsetName = charsetName;
- m_buffer = new ByteArrayOutputStream();
- m_deflater = new Deflater(Deflater.BEST_COMPRESSION);
- m_deflaterOutputStream = new DeflaterOutputStream(m_buffer, m_deflater);
- m_crc32 = new CRC32();
- }
-
- @Override
- public void close() throws IOException {
- flush();
- m_deflater.finish();
- m_deflaterOutputStream.finish();
- m_deflaterOutputStream.close();
- m_deflater.end();
- m_buffer.close();
- m_remoteFile.setCompressedData(m_buffer.toByteArray(), m_crc32.getValue());
- }
-
- @Override
- public void flush() throws IOException {
- m_deflaterOutputStream.flush();
- m_buffer.flush();
- }
-
- @Override
- // written chars (to m_buffer) encoded in Charset.defaultCharset()
- public void write(char[] cbuf, int off, int len) throws IOException { // schreibt
- // chars
- // nach
- // m_buffer
- // (in
- // remote_file)
- try {
- String str = new String(cbuf, off, len);
- byte[] b = str.getBytes(m_charsetName);
- m_crc32.update(b, 0, b.length);
- m_deflaterOutputStream.write(b, 0, b.length);
- flush();
- }
- catch (Exception e) {
- throw new IOException(e.getMessage());
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.file;
+
+/**
+ * @version 3.x
+ */
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.Writer;
+import java.util.zip.CRC32;
+import java.util.zip.Deflater;
+import java.util.zip.DeflaterOutputStream;
+
+public class CompressedWriter extends Writer {
+ private static final String DEFAULT_CHARSETNAME = "UTF-8";
+ private RemoteFile m_remoteFile;
+ private ByteArrayOutputStream m_buffer;
+ private Deflater m_deflater;
+ private DeflaterOutputStream m_deflaterOutputStream;
+ private CRC32 m_crc32;
+ private String m_charsetName = DEFAULT_CHARSETNAME;
+
+ public CompressedWriter(RemoteFile f) {
+ this(f, DEFAULT_CHARSETNAME);
+ }
+
+ public CompressedWriter(RemoteFile f, String charsetName) {
+ m_remoteFile = f;
+ m_charsetName = charsetName;
+ m_buffer = new ByteArrayOutputStream();
+ m_deflater = new Deflater(Deflater.BEST_COMPRESSION);
+ m_deflaterOutputStream = new DeflaterOutputStream(m_buffer, m_deflater);
+ m_crc32 = new CRC32();
+ }
+
+ @Override
+ public void close() throws IOException {
+ flush();
+ m_deflater.finish();
+ m_deflaterOutputStream.finish();
+ m_deflaterOutputStream.close();
+ m_deflater.end();
+ m_buffer.close();
+ m_remoteFile.setCompressedData(m_buffer.toByteArray(), m_crc32.getValue());
+ }
+
+ @Override
+ public void flush() throws IOException {
+ m_deflaterOutputStream.flush();
+ m_buffer.flush();
+ }
+
+ @Override
+ // written chars (to m_buffer) encoded in Charset.defaultCharset()
+ public void write(char[] cbuf, int off, int len) throws IOException { // schreibt
+ // chars
+ // nach
+ // m_buffer
+ // (in
+ // remote_file)
+ try {
+ String str = new String(cbuf, off, len);
+ byte[] b = str.getBytes(m_charsetName);
+ m_crc32.update(b, 0, b.length);
+ m_deflaterOutputStream.write(b, 0, b.length);
+ flush();
+ }
+ catch (Exception e) {
+ throw new IOException(e.getMessage());
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/file/DecompressedInputStream.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/file/DecompressedInputStream.java
index 9ce16a0c45..d84f2de193 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/file/DecompressedInputStream.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/file/DecompressedInputStream.java
@@ -1,54 +1,54 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.file;
-
-/**
- * @version 3.x
- */
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.zip.Inflater;
-import java.util.zip.InflaterInputStream;
-
-public class DecompressedInputStream extends InputStream {
- private RemoteFile m_remoteFile;
- private ByteArrayInputStream m_buffer;
- private Inflater m_inflater;
- private InflaterInputStream m_inflaterInputStream;
-
- public DecompressedInputStream(RemoteFile f) throws IOException {
- if (f.getCompressedData() == null) {
- throw new IOException("" + f + " has no content");
- }
- m_remoteFile = f;
- m_buffer = new ByteArrayInputStream(m_remoteFile.getCompressedData());
- m_inflater = new Inflater();
- m_inflaterInputStream = new InflaterInputStream(m_buffer, m_inflater);
- }
-
- @Override
- public void close() throws IOException {
- m_inflaterInputStream.close();
- m_inflater.end();
- m_buffer.close();
- }
-
- @Override
- public int read() throws IOException {
- return m_inflaterInputStream.read();
- }
-
- @Override
- public int read(byte[] buf, int off, int len) throws IOException {
- return m_inflaterInputStream.read(buf, off, len);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.file;
+
+/**
+ * @version 3.x
+ */
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.zip.Inflater;
+import java.util.zip.InflaterInputStream;
+
+public class DecompressedInputStream extends InputStream {
+ private RemoteFile m_remoteFile;
+ private ByteArrayInputStream m_buffer;
+ private Inflater m_inflater;
+ private InflaterInputStream m_inflaterInputStream;
+
+ public DecompressedInputStream(RemoteFile f) throws IOException {
+ if (f.getCompressedData() == null) {
+ throw new IOException("" + f + " has no content");
+ }
+ m_remoteFile = f;
+ m_buffer = new ByteArrayInputStream(m_remoteFile.getCompressedData());
+ m_inflater = new Inflater();
+ m_inflaterInputStream = new InflaterInputStream(m_buffer, m_inflater);
+ }
+
+ @Override
+ public void close() throws IOException {
+ m_inflaterInputStream.close();
+ m_inflater.end();
+ m_buffer.close();
+ }
+
+ @Override
+ public int read() throws IOException {
+ return m_inflaterInputStream.read();
+ }
+
+ @Override
+ public int read(byte[] buf, int off, int len) throws IOException {
+ return m_inflaterInputStream.read(buf, off, len);
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/file/DecompressedReader.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/file/DecompressedReader.java
index b75acc5473..23d1863583 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/file/DecompressedReader.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/file/DecompressedReader.java
@@ -1,63 +1,63 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.file;
-
-/**
- * @version 3.x
- */
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.io.UnsupportedEncodingException;
-import java.util.zip.Inflater;
-import java.util.zip.InflaterInputStream;
-
-public class DecompressedReader extends Reader {
- private RemoteFile m_remoteFile;
- private ByteArrayInputStream m_buffer;
- private Inflater m_inflater;
- private InflaterInputStream m_inflaterInputStream;
- private InputStreamReader m_inputReader;
-
- public DecompressedReader(RemoteFile f) {
- this(f, "UTF-8");
- }
-
- public DecompressedReader(RemoteFile f, String charsetName) {
- m_remoteFile = f;
- m_buffer = new ByteArrayInputStream(m_remoteFile.getCompressedData()); // enthält
- // komprimierte
- // daten
- m_inflater = new Inflater();
- m_inflaterInputStream = new InflaterInputStream(m_buffer, m_inflater);
- try {
- m_inputReader = new InputStreamReader(m_inflaterInputStream, charsetName);
- }
- catch (UnsupportedEncodingException e) {
- m_inputReader = new InputStreamReader(m_inflaterInputStream);
- }
- }
-
- @Override
- public void close() throws IOException {
- m_inputReader.close();
- m_inflaterInputStream.close();
- m_inflater.end();
- m_buffer.close();
- }
-
- @Override
- public int read(char[] cbuf, int off, int len) throws IOException {
- return m_inputReader.read(cbuf, off, len);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.file;
+
+/**
+ * @version 3.x
+ */
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.io.UnsupportedEncodingException;
+import java.util.zip.Inflater;
+import java.util.zip.InflaterInputStream;
+
+public class DecompressedReader extends Reader {
+ private RemoteFile m_remoteFile;
+ private ByteArrayInputStream m_buffer;
+ private Inflater m_inflater;
+ private InflaterInputStream m_inflaterInputStream;
+ private InputStreamReader m_inputReader;
+
+ public DecompressedReader(RemoteFile f) {
+ this(f, "UTF-8");
+ }
+
+ public DecompressedReader(RemoteFile f, String charsetName) {
+ m_remoteFile = f;
+ m_buffer = new ByteArrayInputStream(m_remoteFile.getCompressedData()); // enthält
+ // komprimierte
+ // daten
+ m_inflater = new Inflater();
+ m_inflaterInputStream = new InflaterInputStream(m_buffer, m_inflater);
+ try {
+ m_inputReader = new InputStreamReader(m_inflaterInputStream, charsetName);
+ }
+ catch (UnsupportedEncodingException e) {
+ m_inputReader = new InputStreamReader(m_inflaterInputStream);
+ }
+ }
+
+ @Override
+ public void close() throws IOException {
+ m_inputReader.close();
+ m_inflaterInputStream.close();
+ m_inflater.end();
+ m_buffer.close();
+ }
+
+ @Override
+ public int read(char[] cbuf, int off, int len) throws IOException {
+ return m_inputReader.read(cbuf, off, len);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/file/IRemoteFileService.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/file/IRemoteFileService.java
index 61ad34cde1..995cb3b7fa 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/file/IRemoteFileService.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/file/IRemoteFileService.java
@@ -1,78 +1,78 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.file;
-
-import java.io.FilenameFilter;
-import java.io.OutputStream;
-
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.shared.servicetunnel.RemoteServiceAccessDenied;
-import org.eclipse.scout.rt.shared.validate.IValidationStrategy;
-import org.eclipse.scout.rt.shared.validate.InputValidation;
-import org.eclipse.scout.service.IService;
-
-@Priority(-3)
-@InputValidation(IValidationStrategy.PROCESS.class)
-public interface IRemoteFileService extends IService {
-
- /**
- * @return RemoteFile when spec.getLastModified() is different than on server,
- * null otherwise <br>
- * If the realFile.lastModified is <= spec.lastModified then no
- * content is returned assuming that the caller already has the
- * content. <br>
- * spec normally doesn't contain any content
- * <p>
- * Example with no path: path=null, name="template.dot" <br>
- * Example with relative path: path="templates/word", name="template.dot" <br>
- * Example with absolute jndi path: path="/WEB-INF/resources/templates/word", name="template.dot" <br>
- * Example with absolute filesystem path: path="C:/TEMP/resources/templates/word", name="template.dot" <br>
- */
- RemoteFile getRemoteFile(RemoteFile spec) throws ProcessingException;
-
- /**
- * @return RemoteFile of specified file block. Use this method to get a large
- * file from server to client. <br>
- * The flag hasMoreParts indicates if there are more parts to follow.
- */
- RemoteFile getRemoteFilePart(RemoteFile spec, long blockNumber) throws ProcessingException;
-
- /**
- * Same as {@link #getRemoteFile(RemoteFile)} with the difference that no
- * content is read and returned.
- */
- RemoteFile getRemoteFileHeader(RemoteFile spec) throws ProcessingException;
-
- @RemoteServiceAccessDenied
- void putRemoteFile(RemoteFile spec) throws ProcessingException;
-
- /**
- * @return all files specified in foldePath and filter including
- * existingFileInfoOnClient <br>
- * Note: existing files that have not changed, are returned without
- * content <br>
- * spec normally doesn't contain any content
- */
- RemoteFile[] getRemoteFiles(String folderPath, FilenameFilter filter, RemoteFile[] existingFileInfoOnClient) throws ProcessingException;
-
- /**
- * The file is not returned but immediately streamed from the original
- * location to the destination. <br>
- * The destination is not closed after write.
- * <p>
- * Throws an exception if the file does not exist.
- *
- * @see #getRemoteFile(RemoteFile)
- */
- void streamRemoteFile(RemoteFile spec, OutputStream out) throws ProcessingException;
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.file;
+
+import java.io.FilenameFilter;
+import java.io.OutputStream;
+
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.shared.servicetunnel.RemoteServiceAccessDenied;
+import org.eclipse.scout.rt.shared.validate.IValidationStrategy;
+import org.eclipse.scout.rt.shared.validate.InputValidation;
+import org.eclipse.scout.service.IService;
+
+@Priority(-3)
+@InputValidation(IValidationStrategy.PROCESS.class)
+public interface IRemoteFileService extends IService {
+
+ /**
+ * @return RemoteFile when spec.getLastModified() is different than on server,
+ * null otherwise <br>
+ * If the realFile.lastModified is <= spec.lastModified then no
+ * content is returned assuming that the caller already has the
+ * content. <br>
+ * spec normally doesn't contain any content
+ * <p>
+ * Example with no path: path=null, name="template.dot" <br>
+ * Example with relative path: path="templates/word", name="template.dot" <br>
+ * Example with absolute jndi path: path="/WEB-INF/resources/templates/word", name="template.dot" <br>
+ * Example with absolute filesystem path: path="C:/TEMP/resources/templates/word", name="template.dot" <br>
+ */
+ RemoteFile getRemoteFile(RemoteFile spec) throws ProcessingException;
+
+ /**
+ * @return RemoteFile of specified file block. Use this method to get a large
+ * file from server to client. <br>
+ * The flag hasMoreParts indicates if there are more parts to follow.
+ */
+ RemoteFile getRemoteFilePart(RemoteFile spec, long blockNumber) throws ProcessingException;
+
+ /**
+ * Same as {@link #getRemoteFile(RemoteFile)} with the difference that no
+ * content is read and returned.
+ */
+ RemoteFile getRemoteFileHeader(RemoteFile spec) throws ProcessingException;
+
+ @RemoteServiceAccessDenied
+ void putRemoteFile(RemoteFile spec) throws ProcessingException;
+
+ /**
+ * @return all files specified in foldePath and filter including
+ * existingFileInfoOnClient <br>
+ * Note: existing files that have not changed, are returned without
+ * content <br>
+ * spec normally doesn't contain any content
+ */
+ RemoteFile[] getRemoteFiles(String folderPath, FilenameFilter filter, RemoteFile[] existingFileInfoOnClient) throws ProcessingException;
+
+ /**
+ * The file is not returned but immediately streamed from the original
+ * location to the destination. <br>
+ * The destination is not closed after write.
+ * <p>
+ * Throws an exception if the file does not exist.
+ *
+ * @see #getRemoteFile(RemoteFile)
+ */
+ void streamRemoteFile(RemoteFile spec, OutputStream out) throws ProcessingException;
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/file/RemoteFile.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/file/RemoteFile.java
index c865f3e14a..ccc2c1f4e6 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/file/RemoteFile.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/file/RemoteFile.java
@@ -1,624 +1,624 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.file;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.Reader;
-import java.io.Serializable;
-import java.io.Writer;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.HashMap;
-import java.util.Locale;
-
-import org.eclipse.scout.commons.FileUtility;
-import org.eclipse.scout.commons.LocaleThreadLocal;
-
-/**
- * file path with / as delimiter
- */
-// content encoded in utf-8 and then compressed!!!
-
-public class RemoteFile implements Serializable {
- public static final long DEFAULT_MAX_BLOCK_SIZE = 20000000; // 20MB
- private static final String DEFAULT_CHARSETNAME = "UTF-8";
- private static final long serialVersionUID = 1L;
- private String m_dir;
- private String m_name;
- private String m_contentType;
- private int m_contentLength = -1;
- private int m_partStartPosition = -1;
- private long m_lastModified = -1;
- private Locale m_locale;
- private boolean m_exists;
- private long m_crc = -1;
- private byte[] m_compressedData;
- private String m_charsetName = DEFAULT_CHARSETNAME;
-
- // for ISerializable
- private RemoteFile() {
- }
-
- public RemoteFile(URL url, boolean ignoreFolders) {
- this(url, ignoreFolders, DEFAULT_CHARSETNAME);
- }
-
- public RemoteFile(URL url, boolean ignoreFolders, String charsetName) {
- if (charsetName != null) {
- m_charsetName = charsetName;
- }
- if (url != null) {
- String path = url.getPath();
- int lastPart = path.lastIndexOf('/');
- if (lastPart >= 0) {
- m_dir = path.substring(0, lastPart + 1);
- m_name = path.substring(lastPart + 1);
- }
- else {
- m_name = path;
- }
- if (ignoreFolders) {
- m_dir = null;
- }
- m_locale = LocaleThreadLocal.get();
- // data
- URLConnection conn;
- try {
- conn = url.openConnection();
- m_lastModified = conn.getLastModified();
- m_contentType = conn.getContentType();
- m_contentLength = conn.getContentLength();
- readData(conn.getInputStream());
- m_exists = true;
- }
- catch (IOException e) {
- m_exists = false;
- }
- }
- else {
- m_exists = false;
- }
- }
-
- public RemoteFile(String dir, String name, Locale locale, long lastModified) {
- this(dir, name, locale, lastModified, DEFAULT_CHARSETNAME);
- }
-
- public RemoteFile(String dir, String name, Locale locale, long lastModified, String charsetName) {
- if (charsetName != null) {
- m_charsetName = charsetName;
- }
- if (dir != null && dir.trim().length() > 0) {
- dir = dir.replace('\\', '/').trim();
- if (!dir.endsWith("/")) {
- dir = dir + "/";
- }
- m_dir = dir;
- }
- m_name = name;
- m_lastModified = lastModified;
- m_locale = locale;
- }
-
- public RemoteFile(String dir, String name, long lastModified) {
- this(dir, name, lastModified, DEFAULT_CHARSETNAME);
- }
-
- public RemoteFile(String dir, String name, long lastModified, String charsetName) {
- this(dir, name, null, lastModified, charsetName);
- }
-
- public RemoteFile(String path, long lastModified) {
- this(path, lastModified, DEFAULT_CHARSETNAME);
- }
-
- public RemoteFile(String path, long lastModified, String charsetName) {
- if (charsetName != null) {
- m_charsetName = charsetName;
- }
- int i = path.replace('\\', '/').lastIndexOf('/');
- if (i >= 0) {
- m_dir = path.substring(0, i);
- m_name = path.substring(i);
- }
- else {
- m_dir = null;
- m_name = path;
- }
- m_lastModified = lastModified;
- }
-
- /**
- * @return directory only ending with / or null
- */
- public String getDirectory() {
- return m_dir;
- }
-
- /**
- * @return name only
- */
- public String getName() {
- return m_name;
- }
-
- /**
- * @return directory/name
- */
- public String getPath() {
- StringBuilder b = new StringBuilder();
- if (m_dir != null) {
- b.append(m_dir);
- }
- b.append(m_name);
- return b.toString();
- }
-
- public Locale getLocale() {
- return m_locale;
- }
-
- public long getLastModified() {
- return m_lastModified;
- }
-
- public void setLastModified(long l) {
- m_lastModified = l;
- }
-
- public boolean exists() {
- return m_exists;
- }
-
- public void setExists(boolean exists) {
- m_exists = exists;
- }
-
- public String getCharsetName() {
- return m_charsetName;
- }
-
- public void setCharsetName(String charsetName) {
- if (charsetName != null) {
- m_charsetName = charsetName;
- }
- }
-
- public long getCRC() {
- return m_crc;
- }
-
- /**
- * @return true if this is a large file that could not be transfered in one
- * block. Use RemoteFileService.getRemoteFilePart(spec,1) to get the
- * next block of the large server file.
- */
- public boolean hasMoreParts() {
- return getContentLength() == RemoteFile.DEFAULT_MAX_BLOCK_SIZE;
- }
-
- public int getPartStartPosition() {
- return m_partStartPosition;
- }
-
- public void setPartStartPosition(int position) {
- m_partStartPosition = position;
- }
-
- public int getContentLength() {
- return m_contentLength;
- }
-
- public void setContentLength(int len) {
- m_contentLength = len;
- }
-
- protected byte[] getCompressedData() {
- return m_compressedData;
- }
-
- protected void setCompressedData(byte[] compressedData, long crc) {
- m_compressedData = compressedData;
- m_crc = crc;
- }
-
- public String getContentType() {
- return m_contentType;
- }
-
- public void setContentType(String contentType) {
- m_contentType = contentType;
- }
-
- public boolean hasContent() {
- return m_compressedData != null;
- }
-
- public Writer getCompressedWriter() throws IOException {
- return new CompressedWriter(this, m_charsetName);
- }
-
- public Reader getDecompressedReader() throws IOException {
- return new DecompressedReader(this, m_charsetName);
- }
-
- public OutputStream getCompressedOutputStream() throws IOException {
- return new CompressedOutputStream(this);
- }
-
- public InputStream getDecompressedInputStream() throws IOException {
- return new DecompressedInputStream(this);
- }
-
- public long/* crc */writeData(File f) throws IOException {
- return writeData(new FileOutputStream(f));
- }
-
- public long/* crc */writeData(Writer w) throws IOException {
- Reader in = null;
- BufferedWriter out = null;
- try {
- in = getDecompressedReader();
- out = new BufferedWriter(w);
- char[] b = new char[102400];
- int len;
- while ((len = in.read(b)) > 0) {
- out.write(b, 0, len);
- }
- out.flush();
- }
- finally {
- if (out != null) {
- out.close();
- }
- if (in != null) {
- in.close();
- }
- }
- return getCRC();
- }
-
- public long/* crc */writeData(OutputStream os) throws IOException {
- InputStream in = null;
- BufferedOutputStream out = null;
- try {
- in = getDecompressedInputStream();
- out = new BufferedOutputStream(os);
- byte[] b = new byte[102400];
- int len;
- while ((len = in.read(b)) > 0) {
- out.write(b, 0, len);
- }
- out.flush();
- }
- finally {
- if (out != null) {
- out.close();
- }
- if (in != null) {
- in.close();
- }
- }
- return getCRC();
- }
-
- public long/* crc */readData(File f) throws IOException {
- return readData(new FileInputStream(f));
- }
-
- public long/* crc */readData(Reader r) throws IOException {
- Writer out = null;
- BufferedReader in = null;
- try {
- in = new BufferedReader(r);
- out = getCompressedWriter();
- char[] b = new char[102400];
- int len;
- while ((len = in.read(b)) > 0) {
- out.write(b, 0, len);
- }
- out.flush();
- m_exists = true;
- }
- finally {
- if (out != null) {
- out.close();
- }
- if (in != null) {
- in.close();
- }
- }
- return getCRC();
- }
-
- public long/* crc */readData(InputStream is) throws IOException {
- return readData(is, 0, -1);
- }
-
- public long/* crc */readData(InputStream is, long startPosition, long maxReadSize) throws IOException {
- OutputStream out = null;
- BufferedInputStream in = null;
- setPartStartPosition((int) startPosition);
- long readSize = 0;
- try {
- is.skip(startPosition);
- in = new BufferedInputStream(is);
- out = getCompressedOutputStream();
- int bufferSize = 102400;
- byte[] b = new byte[bufferSize];
- int len;
- int maxBufferBoundary;
- while ((readSize < maxReadSize || maxReadSize == -1) && (len = in.read(b)) > 0) {
- maxBufferBoundary = len;
- if (maxReadSize > -1 && readSize + len > maxReadSize) {
- maxBufferBoundary = (int) (maxReadSize - readSize);
- }
- if (maxBufferBoundary < len) {
- len = maxBufferBoundary;
- }
- out.write(b, 0, len);
- readSize += len;
- }
- out.flush();
- m_exists = true;
- }
- finally {
- if (out != null) {
- out.close();
- }
- if (in != null) {
- in.close();
- }
- }
- return getCRC();
- }
-
- public byte[] extractData() throws IOException {
- ByteArrayOutputStream bos = new ByteArrayOutputStream(m_compressedData.length * 3);
- writeData(bos);
- return bos.toByteArray();
- }
-
- /**
- * If the remote file is a zip archive, unpack its content to the directory
- * see {@link #readZipContentFromDirectory(File)}
- */
- public void writeZipContentToDirectory(File directory) throws IOException {
- directory.mkdirs();
- File tmp = File.createTempFile("tmp", ".zip");
- writeData(tmp);
- FileUtility.extractArchive(tmp, directory);
- }
-
- /**
- * Read all files from the directory and pack them as zip, so this remote file represents a zip archive
- * see {@link #writeZipContentToDirectory(File)}
- */
- public void readZipContentFromDirectory(File directory) throws IOException {
- File tmp = File.createTempFile("tmp", ".zip");
- FileUtility.compressArchive(directory, tmp);
- readData(tmp);
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName() + "[dir=" + m_dir + ", name=" + m_name + ", lastModified=" + m_lastModified + "]";
- }
-
- /**
- * @ince 2.7
- */
- public void setContentTypeByExtension(String ext) {
- setContentType(getContentTypeForExtension(ext));
- }
-
- /**
- * Static extension to mimetype mapper
- *
- * @since 2.7
- */
- private static final HashMap<String, String> FILE_EXTENSION_TO_MIME_TYPE_MAP;
- static {
- FILE_EXTENSION_TO_MIME_TYPE_MAP = new HashMap<String, String>();
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("ai", "application/postscript");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("aif", "audio/x-aiff");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("aifc", "audio/x-aiff");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("aiff", "audio/x-aiff");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("asc", "text/plain");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("au", "audio/basic");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("avi", "video/x-msvideo");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("bcpio", "application/x-bcpio");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("bin", "application/octet-stream");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("c", "text/plain");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("cc", "text/plain");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("ccad", "application/clariscad");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("cdf", "application/x-netcdf");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("class", "application/octet-stream");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("cpio", "application/x-cpio");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("cpt", "application/mac-compactpro");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("csh", "application/x-csh");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("css", "text/css");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("dcr", "application/x-director");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("dir", "application/x-director");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("dms", "application/octet-stream");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("doc", "application/msword");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("dotx", "application/vnd.openxmlformats-officedocument.wordprocessingml.template");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("drw", "application/drafting");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("dvi", "application/x-dvi");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("dwg", "application/acad");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("dxf", "application/dxf");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("dxr", "application/x-director");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("eps", "application/postscript");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("etx", "text/x-setext");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("exe", "application/octet-stream");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("ez", "application/andrew-inset");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("f", "text/plain");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("f90", "text/plain");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("fli", "video/x-fli");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("gif", "image/gif");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("gtar", "application/x-gtar");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("gz", "application/x-gzip");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("h", "text/plain");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("hdf", "application/x-hdf");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("hh", "text/plain");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("hqx", "application/mac-binhex40");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("htm", "text/html");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("html", "text/html");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("ice", "x-conference/x-cooltalk");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("ief", "image/ief");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("iges", "model/iges");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("igs", "model/iges");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("ips", "application/x-ipscript");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("ipx", "application/x-ipix");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("jpe", "image/jpeg");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("jpeg", "image/jpeg");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("jpg", "image/jpeg");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("js", "application/x-javascript");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("kar", "audio/midi");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("latex", "application/x-latex");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("lha", "application/octet-stream");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("lsp", "application/x-lisp");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("lzh", "application/octet-stream");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("m", "text/plain");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("man", "application/x-troff-man");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("me", "application/x-troff-me");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("mesh", "model/mesh");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("mid", "audio/midi");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("midi", "audio/midi");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("mif", "application/vnd.mif");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("mime", "www/mime");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("mov", "video/quicktime");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("movie", "video/x-sgi-movie");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("mp2", "audio/mpeg");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("mp3", "audio/mpeg");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("mpe", "video/mpeg");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("mpeg", "video/mpeg");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("mpg", "video/mpeg");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("mpga", "audio/mpeg");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("ms", "application/x-troff-ms");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("msh", "model/mesh");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("msi", "application/x-msi");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("nc", "application/x-netcdf");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("oda", "application/oda");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("pbm", "image/x-portable-bitmap");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("pdb", "chemical/x-pdb");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("pdf", "application/pdf");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("pgm", "image/x-portable-graymap");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("pgn", "application/x-chess-pgn");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("png", "image/png");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("pnm", "image/x-portable-anymap");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("pot", "application/mspowerpoint");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("potx", "application/vnd.openxmlformats-officedocument.presentationml.template");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("ppm", "image/x-portable-pixmap");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("pps", "application/mspowerpoint");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("ppsx", "application/vnd.openxmlformats-officedocument.presentationml.slideshow");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("ppt", "application/mspowerpoint");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("ppz", "application/mspowerpoint");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("pre", "application/x-freelance");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("prt", "application/pro_eng");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("ps", "application/postscript");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("qt", "video/quicktime");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("ra", "audio/x-realaudio");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("ram", "audio/x-pn-realaudio");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("ras", "image/cmu-raster");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("rgb", "image/x-rgb");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("rm", "audio/x-pn-realaudio");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("roff", "application/x-troff");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("rpm", "audio/x-pn-realaudio-plugin");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("rtf", "text/rtf");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("rtx", "text/richtext");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("scm", "application/x-lotusscreencam");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("set", "application/set");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("sgm", "text/sgml");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("sgml", "text/sgml");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("sh", "application/x-sh");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("shar", "application/x-shar");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("silo", "model/mesh");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("sit", "application/x-stuffit");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("skd", "application/x-koan");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("skm", "application/x-koan");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("skp", "application/x-koan");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("skt", "application/x-koan");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("sldx", "application/vnd.openxmlformats-officedocument.presentationml.slide");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("smi", "application/smil");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("smil", "application/smil");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("snd", "audio/basic");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("sol", "application/solids");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("spl", "application/x-futuresplash");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("src", "application/x-wais-source");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("step", "application/STEP");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("stl", "application/SLA");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("stp", "application/STEP");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("sv4cpio", "application/x-sv4cpio");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("sv4crc", "application/x-sv4crc");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("swf", "application/x-shockwave-flash");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("t", "application/x-troff");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("tar", "application/x-tar");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("tcl", "application/x-tcl");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("tex", "application/x-tex");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("texi", "application/x-texinfo");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("texinfo", "application/x-texinfo");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("tif", "image/tiff");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("tiff", "image/tiff");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("tr", "application/x-troff");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("tsi", "audio/TSP-audio");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("tsp", "application/dsptype");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("tsv", "text/tab-separated-values");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("txt", "text/plain");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("unv", "application/i-deas");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("ustar", "application/x-ustar");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("vcd", "application/x-cdlink");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("vda", "application/vda");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("viv", "video/vnd.vivo");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("vivo", "video/vnd.vivo");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("vrml", "model/vrml");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("wav", "audio/x-wav");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("wrl", "model/vrml");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("xbm", "image/x-xbitmap");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("xlam", "application/vnd.ms-excel.addin.macroEnabled.12");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("xlc", "application/vnd.ms-excel");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("xll", "application/vnd.ms-excel");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("xlm", "application/vnd.ms-excel");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("xls", "application/vnd.ms-excel");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("xlsb", "application/vnd.ms-excel.sheet.binary.macroEnabled.12");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("xltx", "application/vnd.openxmlformats-officedocument.spreadsheetml.template");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("xlw", "application/vnd.ms-excel");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("xml", "text/xml");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("xpm", "image/x-xpixmap");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("xwd", "image/x-xwindowdump");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("xyz", "chemical/x-pdb");
- FILE_EXTENSION_TO_MIME_TYPE_MAP.put("zip", "application/zip");
- }
-
- /**
- * @since 2.7
- */
- public static String getContentTypeForExtension(String ext) {
- if (ext.startsWith(".")) {
- ext = ext.substring(1);
- }
- ext = ext.toLowerCase();
- return FILE_EXTENSION_TO_MIME_TYPE_MAP.get(ext);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.file;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.io.Serializable;
+import java.io.Writer;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.HashMap;
+import java.util.Locale;
+
+import org.eclipse.scout.commons.FileUtility;
+import org.eclipse.scout.commons.LocaleThreadLocal;
+
+/**
+ * file path with / as delimiter
+ */
+// content encoded in utf-8 and then compressed!!!
+
+public class RemoteFile implements Serializable {
+ public static final long DEFAULT_MAX_BLOCK_SIZE = 20000000; // 20MB
+ private static final String DEFAULT_CHARSETNAME = "UTF-8";
+ private static final long serialVersionUID = 1L;
+ private String m_dir;
+ private String m_name;
+ private String m_contentType;
+ private int m_contentLength = -1;
+ private int m_partStartPosition = -1;
+ private long m_lastModified = -1;
+ private Locale m_locale;
+ private boolean m_exists;
+ private long m_crc = -1;
+ private byte[] m_compressedData;
+ private String m_charsetName = DEFAULT_CHARSETNAME;
+
+ // for ISerializable
+ private RemoteFile() {
+ }
+
+ public RemoteFile(URL url, boolean ignoreFolders) {
+ this(url, ignoreFolders, DEFAULT_CHARSETNAME);
+ }
+
+ public RemoteFile(URL url, boolean ignoreFolders, String charsetName) {
+ if (charsetName != null) {
+ m_charsetName = charsetName;
+ }
+ if (url != null) {
+ String path = url.getPath();
+ int lastPart = path.lastIndexOf('/');
+ if (lastPart >= 0) {
+ m_dir = path.substring(0, lastPart + 1);
+ m_name = path.substring(lastPart + 1);
+ }
+ else {
+ m_name = path;
+ }
+ if (ignoreFolders) {
+ m_dir = null;
+ }
+ m_locale = LocaleThreadLocal.get();
+ // data
+ URLConnection conn;
+ try {
+ conn = url.openConnection();
+ m_lastModified = conn.getLastModified();
+ m_contentType = conn.getContentType();
+ m_contentLength = conn.getContentLength();
+ readData(conn.getInputStream());
+ m_exists = true;
+ }
+ catch (IOException e) {
+ m_exists = false;
+ }
+ }
+ else {
+ m_exists = false;
+ }
+ }
+
+ public RemoteFile(String dir, String name, Locale locale, long lastModified) {
+ this(dir, name, locale, lastModified, DEFAULT_CHARSETNAME);
+ }
+
+ public RemoteFile(String dir, String name, Locale locale, long lastModified, String charsetName) {
+ if (charsetName != null) {
+ m_charsetName = charsetName;
+ }
+ if (dir != null && dir.trim().length() > 0) {
+ dir = dir.replace('\\', '/').trim();
+ if (!dir.endsWith("/")) {
+ dir = dir + "/";
+ }
+ m_dir = dir;
+ }
+ m_name = name;
+ m_lastModified = lastModified;
+ m_locale = locale;
+ }
+
+ public RemoteFile(String dir, String name, long lastModified) {
+ this(dir, name, lastModified, DEFAULT_CHARSETNAME);
+ }
+
+ public RemoteFile(String dir, String name, long lastModified, String charsetName) {
+ this(dir, name, null, lastModified, charsetName);
+ }
+
+ public RemoteFile(String path, long lastModified) {
+ this(path, lastModified, DEFAULT_CHARSETNAME);
+ }
+
+ public RemoteFile(String path, long lastModified, String charsetName) {
+ if (charsetName != null) {
+ m_charsetName = charsetName;
+ }
+ int i = path.replace('\\', '/').lastIndexOf('/');
+ if (i >= 0) {
+ m_dir = path.substring(0, i);
+ m_name = path.substring(i);
+ }
+ else {
+ m_dir = null;
+ m_name = path;
+ }
+ m_lastModified = lastModified;
+ }
+
+ /**
+ * @return directory only ending with / or null
+ */
+ public String getDirectory() {
+ return m_dir;
+ }
+
+ /**
+ * @return name only
+ */
+ public String getName() {
+ return m_name;
+ }
+
+ /**
+ * @return directory/name
+ */
+ public String getPath() {
+ StringBuilder b = new StringBuilder();
+ if (m_dir != null) {
+ b.append(m_dir);
+ }
+ b.append(m_name);
+ return b.toString();
+ }
+
+ public Locale getLocale() {
+ return m_locale;
+ }
+
+ public long getLastModified() {
+ return m_lastModified;
+ }
+
+ public void setLastModified(long l) {
+ m_lastModified = l;
+ }
+
+ public boolean exists() {
+ return m_exists;
+ }
+
+ public void setExists(boolean exists) {
+ m_exists = exists;
+ }
+
+ public String getCharsetName() {
+ return m_charsetName;
+ }
+
+ public void setCharsetName(String charsetName) {
+ if (charsetName != null) {
+ m_charsetName = charsetName;
+ }
+ }
+
+ public long getCRC() {
+ return m_crc;
+ }
+
+ /**
+ * @return true if this is a large file that could not be transfered in one
+ * block. Use RemoteFileService.getRemoteFilePart(spec,1) to get the
+ * next block of the large server file.
+ */
+ public boolean hasMoreParts() {
+ return getContentLength() == RemoteFile.DEFAULT_MAX_BLOCK_SIZE;
+ }
+
+ public int getPartStartPosition() {
+ return m_partStartPosition;
+ }
+
+ public void setPartStartPosition(int position) {
+ m_partStartPosition = position;
+ }
+
+ public int getContentLength() {
+ return m_contentLength;
+ }
+
+ public void setContentLength(int len) {
+ m_contentLength = len;
+ }
+
+ protected byte[] getCompressedData() {
+ return m_compressedData;
+ }
+
+ protected void setCompressedData(byte[] compressedData, long crc) {
+ m_compressedData = compressedData;
+ m_crc = crc;
+ }
+
+ public String getContentType() {
+ return m_contentType;
+ }
+
+ public void setContentType(String contentType) {
+ m_contentType = contentType;
+ }
+
+ public boolean hasContent() {
+ return m_compressedData != null;
+ }
+
+ public Writer getCompressedWriter() throws IOException {
+ return new CompressedWriter(this, m_charsetName);
+ }
+
+ public Reader getDecompressedReader() throws IOException {
+ return new DecompressedReader(this, m_charsetName);
+ }
+
+ public OutputStream getCompressedOutputStream() throws IOException {
+ return new CompressedOutputStream(this);
+ }
+
+ public InputStream getDecompressedInputStream() throws IOException {
+ return new DecompressedInputStream(this);
+ }
+
+ public long/* crc */writeData(File f) throws IOException {
+ return writeData(new FileOutputStream(f));
+ }
+
+ public long/* crc */writeData(Writer w) throws IOException {
+ Reader in = null;
+ BufferedWriter out = null;
+ try {
+ in = getDecompressedReader();
+ out = new BufferedWriter(w);
+ char[] b = new char[102400];
+ int len;
+ while ((len = in.read(b)) > 0) {
+ out.write(b, 0, len);
+ }
+ out.flush();
+ }
+ finally {
+ if (out != null) {
+ out.close();
+ }
+ if (in != null) {
+ in.close();
+ }
+ }
+ return getCRC();
+ }
+
+ public long/* crc */writeData(OutputStream os) throws IOException {
+ InputStream in = null;
+ BufferedOutputStream out = null;
+ try {
+ in = getDecompressedInputStream();
+ out = new BufferedOutputStream(os);
+ byte[] b = new byte[102400];
+ int len;
+ while ((len = in.read(b)) > 0) {
+ out.write(b, 0, len);
+ }
+ out.flush();
+ }
+ finally {
+ if (out != null) {
+ out.close();
+ }
+ if (in != null) {
+ in.close();
+ }
+ }
+ return getCRC();
+ }
+
+ public long/* crc */readData(File f) throws IOException {
+ return readData(new FileInputStream(f));
+ }
+
+ public long/* crc */readData(Reader r) throws IOException {
+ Writer out = null;
+ BufferedReader in = null;
+ try {
+ in = new BufferedReader(r);
+ out = getCompressedWriter();
+ char[] b = new char[102400];
+ int len;
+ while ((len = in.read(b)) > 0) {
+ out.write(b, 0, len);
+ }
+ out.flush();
+ m_exists = true;
+ }
+ finally {
+ if (out != null) {
+ out.close();
+ }
+ if (in != null) {
+ in.close();
+ }
+ }
+ return getCRC();
+ }
+
+ public long/* crc */readData(InputStream is) throws IOException {
+ return readData(is, 0, -1);
+ }
+
+ public long/* crc */readData(InputStream is, long startPosition, long maxReadSize) throws IOException {
+ OutputStream out = null;
+ BufferedInputStream in = null;
+ setPartStartPosition((int) startPosition);
+ long readSize = 0;
+ try {
+ is.skip(startPosition);
+ in = new BufferedInputStream(is);
+ out = getCompressedOutputStream();
+ int bufferSize = 102400;
+ byte[] b = new byte[bufferSize];
+ int len;
+ int maxBufferBoundary;
+ while ((readSize < maxReadSize || maxReadSize == -1) && (len = in.read(b)) > 0) {
+ maxBufferBoundary = len;
+ if (maxReadSize > -1 && readSize + len > maxReadSize) {
+ maxBufferBoundary = (int) (maxReadSize - readSize);
+ }
+ if (maxBufferBoundary < len) {
+ len = maxBufferBoundary;
+ }
+ out.write(b, 0, len);
+ readSize += len;
+ }
+ out.flush();
+ m_exists = true;
+ }
+ finally {
+ if (out != null) {
+ out.close();
+ }
+ if (in != null) {
+ in.close();
+ }
+ }
+ return getCRC();
+ }
+
+ public byte[] extractData() throws IOException {
+ ByteArrayOutputStream bos = new ByteArrayOutputStream(m_compressedData.length * 3);
+ writeData(bos);
+ return bos.toByteArray();
+ }
+
+ /**
+ * If the remote file is a zip archive, unpack its content to the directory
+ * see {@link #readZipContentFromDirectory(File)}
+ */
+ public void writeZipContentToDirectory(File directory) throws IOException {
+ directory.mkdirs();
+ File tmp = File.createTempFile("tmp", ".zip");
+ writeData(tmp);
+ FileUtility.extractArchive(tmp, directory);
+ }
+
+ /**
+ * Read all files from the directory and pack them as zip, so this remote file represents a zip archive
+ * see {@link #writeZipContentToDirectory(File)}
+ */
+ public void readZipContentFromDirectory(File directory) throws IOException {
+ File tmp = File.createTempFile("tmp", ".zip");
+ FileUtility.compressArchive(directory, tmp);
+ readData(tmp);
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + "[dir=" + m_dir + ", name=" + m_name + ", lastModified=" + m_lastModified + "]";
+ }
+
+ /**
+ * @ince 2.7
+ */
+ public void setContentTypeByExtension(String ext) {
+ setContentType(getContentTypeForExtension(ext));
+ }
+
+ /**
+ * Static extension to mimetype mapper
+ *
+ * @since 2.7
+ */
+ private static final HashMap<String, String> FILE_EXTENSION_TO_MIME_TYPE_MAP;
+ static {
+ FILE_EXTENSION_TO_MIME_TYPE_MAP = new HashMap<String, String>();
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("ai", "application/postscript");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("aif", "audio/x-aiff");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("aifc", "audio/x-aiff");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("aiff", "audio/x-aiff");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("asc", "text/plain");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("au", "audio/basic");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("avi", "video/x-msvideo");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("bcpio", "application/x-bcpio");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("bin", "application/octet-stream");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("c", "text/plain");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("cc", "text/plain");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("ccad", "application/clariscad");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("cdf", "application/x-netcdf");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("class", "application/octet-stream");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("cpio", "application/x-cpio");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("cpt", "application/mac-compactpro");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("csh", "application/x-csh");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("css", "text/css");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("dcr", "application/x-director");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("dir", "application/x-director");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("dms", "application/octet-stream");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("doc", "application/msword");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("dotx", "application/vnd.openxmlformats-officedocument.wordprocessingml.template");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("drw", "application/drafting");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("dvi", "application/x-dvi");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("dwg", "application/acad");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("dxf", "application/dxf");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("dxr", "application/x-director");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("eps", "application/postscript");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("etx", "text/x-setext");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("exe", "application/octet-stream");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("ez", "application/andrew-inset");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("f", "text/plain");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("f90", "text/plain");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("fli", "video/x-fli");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("gif", "image/gif");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("gtar", "application/x-gtar");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("gz", "application/x-gzip");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("h", "text/plain");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("hdf", "application/x-hdf");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("hh", "text/plain");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("hqx", "application/mac-binhex40");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("htm", "text/html");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("html", "text/html");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("ice", "x-conference/x-cooltalk");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("ief", "image/ief");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("iges", "model/iges");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("igs", "model/iges");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("ips", "application/x-ipscript");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("ipx", "application/x-ipix");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("jpe", "image/jpeg");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("jpeg", "image/jpeg");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("jpg", "image/jpeg");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("js", "application/x-javascript");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("kar", "audio/midi");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("latex", "application/x-latex");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("lha", "application/octet-stream");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("lsp", "application/x-lisp");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("lzh", "application/octet-stream");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("m", "text/plain");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("man", "application/x-troff-man");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("me", "application/x-troff-me");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("mesh", "model/mesh");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("mid", "audio/midi");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("midi", "audio/midi");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("mif", "application/vnd.mif");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("mime", "www/mime");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("mov", "video/quicktime");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("movie", "video/x-sgi-movie");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("mp2", "audio/mpeg");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("mp3", "audio/mpeg");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("mpe", "video/mpeg");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("mpeg", "video/mpeg");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("mpg", "video/mpeg");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("mpga", "audio/mpeg");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("ms", "application/x-troff-ms");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("msh", "model/mesh");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("msi", "application/x-msi");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("nc", "application/x-netcdf");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("oda", "application/oda");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("pbm", "image/x-portable-bitmap");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("pdb", "chemical/x-pdb");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("pdf", "application/pdf");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("pgm", "image/x-portable-graymap");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("pgn", "application/x-chess-pgn");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("png", "image/png");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("pnm", "image/x-portable-anymap");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("pot", "application/mspowerpoint");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("potx", "application/vnd.openxmlformats-officedocument.presentationml.template");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("ppm", "image/x-portable-pixmap");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("pps", "application/mspowerpoint");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("ppsx", "application/vnd.openxmlformats-officedocument.presentationml.slideshow");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("ppt", "application/mspowerpoint");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("ppz", "application/mspowerpoint");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("pre", "application/x-freelance");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("prt", "application/pro_eng");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("ps", "application/postscript");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("qt", "video/quicktime");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("ra", "audio/x-realaudio");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("ram", "audio/x-pn-realaudio");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("ras", "image/cmu-raster");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("rgb", "image/x-rgb");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("rm", "audio/x-pn-realaudio");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("roff", "application/x-troff");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("rpm", "audio/x-pn-realaudio-plugin");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("rtf", "text/rtf");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("rtx", "text/richtext");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("scm", "application/x-lotusscreencam");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("set", "application/set");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("sgm", "text/sgml");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("sgml", "text/sgml");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("sh", "application/x-sh");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("shar", "application/x-shar");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("silo", "model/mesh");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("sit", "application/x-stuffit");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("skd", "application/x-koan");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("skm", "application/x-koan");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("skp", "application/x-koan");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("skt", "application/x-koan");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("sldx", "application/vnd.openxmlformats-officedocument.presentationml.slide");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("smi", "application/smil");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("smil", "application/smil");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("snd", "audio/basic");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("sol", "application/solids");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("spl", "application/x-futuresplash");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("src", "application/x-wais-source");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("step", "application/STEP");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("stl", "application/SLA");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("stp", "application/STEP");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("sv4cpio", "application/x-sv4cpio");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("sv4crc", "application/x-sv4crc");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("swf", "application/x-shockwave-flash");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("t", "application/x-troff");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("tar", "application/x-tar");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("tcl", "application/x-tcl");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("tex", "application/x-tex");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("texi", "application/x-texinfo");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("texinfo", "application/x-texinfo");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("tif", "image/tiff");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("tiff", "image/tiff");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("tr", "application/x-troff");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("tsi", "audio/TSP-audio");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("tsp", "application/dsptype");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("tsv", "text/tab-separated-values");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("txt", "text/plain");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("unv", "application/i-deas");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("ustar", "application/x-ustar");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("vcd", "application/x-cdlink");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("vda", "application/vda");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("viv", "video/vnd.vivo");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("vivo", "video/vnd.vivo");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("vrml", "model/vrml");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("wav", "audio/x-wav");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("wrl", "model/vrml");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("xbm", "image/x-xbitmap");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("xlam", "application/vnd.ms-excel.addin.macroEnabled.12");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("xlc", "application/vnd.ms-excel");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("xll", "application/vnd.ms-excel");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("xlm", "application/vnd.ms-excel");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("xls", "application/vnd.ms-excel");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("xlsb", "application/vnd.ms-excel.sheet.binary.macroEnabled.12");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("xltx", "application/vnd.openxmlformats-officedocument.spreadsheetml.template");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("xlw", "application/vnd.ms-excel");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("xml", "text/xml");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("xpm", "image/x-xpixmap");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("xwd", "image/x-xwindowdump");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("xyz", "chemical/x-pdb");
+ FILE_EXTENSION_TO_MIME_TYPE_MAP.put("zip", "application/zip");
+ }
+
+ /**
+ * @since 2.7
+ */
+ public static String getContentTypeForExtension(String ext) {
+ if (ext.startsWith(".")) {
+ ext = ext.substring(1);
+ }
+ ext = ext.toLowerCase();
+ return FILE_EXTENSION_TO_MIME_TYPE_MAP.get(ext);
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/jdbc/ILegacySqlQueryService.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/jdbc/ILegacySqlQueryService.java
index e2c4d7b64c..7e99401bd6 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/jdbc/ILegacySqlQueryService.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/jdbc/ILegacySqlQueryService.java
@@ -1,38 +1,38 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.jdbc;
-
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.shared.validate.InputValidation;
-import org.eclipse.scout.rt.shared.validate.IValidationStrategy;
-import org.eclipse.scout.service.IService;
-
-/**
- * deprecated, do not use anymore
- * deprecation marker is set in next release
- */
-@Priority(-3)
-@InputValidation(IValidationStrategy.PROCESS.class)
-public interface ILegacySqlQueryService extends IService {
-
- String createPlainText(String s, Object... bindBases) throws ProcessingException;
-
- Object[][] select(String s, Object... bindBases) throws ProcessingException;
-
- Object[][] selectLimited(String s, int maxRowCount, Object... bindBases) throws ProcessingException;
-
- void selectInto(String s, Object... bindBases) throws ProcessingException;
-
- void selectIntoLimited(String s, int maxRowCount, Object... bindBases) throws ProcessingException;
-
- LegacySearchFilter.WhereToken resolveSpecialConstraint(Object specialConstraint) throws ProcessingException;
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.jdbc;
+
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.shared.validate.InputValidation;
+import org.eclipse.scout.rt.shared.validate.IValidationStrategy;
+import org.eclipse.scout.service.IService;
+
+/**
+ * deprecated, do not use anymore
+ * deprecation marker is set in next release
+ */
+@Priority(-3)
+@InputValidation(IValidationStrategy.PROCESS.class)
+public interface ILegacySqlQueryService extends IService {
+
+ String createPlainText(String s, Object... bindBases) throws ProcessingException;
+
+ Object[][] select(String s, Object... bindBases) throws ProcessingException;
+
+ Object[][] selectLimited(String s, int maxRowCount, Object... bindBases) throws ProcessingException;
+
+ void selectInto(String s, Object... bindBases) throws ProcessingException;
+
+ void selectIntoLimited(String s, int maxRowCount, Object... bindBases) throws ProcessingException;
+
+ LegacySearchFilter.WhereToken resolveSpecialConstraint(Object specialConstraint) throws ProcessingException;
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/jdbc/LegacySearchFilter.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/jdbc/LegacySearchFilter.java
index 9ecd9e2a8e..296cab1110 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/jdbc/LegacySearchFilter.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/jdbc/LegacySearchFilter.java
@@ -1,273 +1,273 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.jdbc;
-
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.holders.NVPair;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.service.SERVICES;
-
-public class LegacySearchFilter extends SearchFilter implements Cloneable {
- private static final long serialVersionUID = 0L;
-
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(LegacySearchFilter.class);
-
- private int m_sBindSeq;
- private HashMap<String, Object> m_binds = new HashMap<String, Object>();
- private StringBuffer m_where = new StringBuffer("");
-
- public LegacySearchFilter() {
- }
-
- /**
- * @return live map of all binds changes to this map are immediately reflected
- * inside the instance
- */
- public Map<String, Object> getBindMap() {
- return m_binds;
- }
-
- public void addBind(String name, Object value) {
- if (name != null) {
- m_binds.put(name, value);
- }
- }
-
- public void addSpecialWhereToken(Object o) throws ProcessingException {
- WhereToken tok = SERVICES.getService(ILegacySqlQueryService.class).resolveSpecialConstraint(o);
- if (tok.getBinds() != null) {
- m_binds.putAll(tok.getBinds());
- }
- addWhereToken(tok.getText(), tok.getS());
- }
-
- /**
- * clear all existing filter elements and add only this one same as {@link #clear()} followed by
- * {@link #addWhere(String,NVPair...)}
- */
- public void setWhere(String sql, NVPair... customBinds) {
- clear();
- addWhere(sql, customBinds);
- }
-
- /**
- * clear all existing filter elements and add only this one same as {@link #clear()} followed by
- * {@link #addWhereToken(String)}
- */
- public void setWhereToken(String sql) {
- clear();
- addWhereToken(sql);
- }
-
- /**
- * clear all existing filter elements and add only this one same as {@link #clear()} followed by
- * {@link #addWhereToken(String,Object)}
- */
- public void setWhereToken(String sql, Object valueForS) {
- clear();
- addWhereToken(sql, valueForS);
- }
-
- /**
- * add sql part the ADD keyword is added (pre-pended) automatically
- */
- public void addWhereToken(String sql) {
- if (sql != null) {
- m_where.append(" AND ");
- addWhere(sql);
- }
- }
-
- /**
- * generates a random generic bind name useful for custom replacements of S
- * values
- */
- public String getNextGenericBindName() {
- String bindName = "__" + m_sBindSeq;
- m_sBindSeq++;
- return bindName;
- }
-
- /**
- * add sql part with bind references to :S and #S# the ADD keyword is added
- * (pre-pended) automatically
- */
- public void addWhereToken(String sql, Object valueForS) {
- if (sql != null) {
- // create generic bind for S
- String bindName = "__" + m_sBindSeq;
- m_sBindSeq++;
- sql = sql.replaceAll(":S([^a-zA-Z0-9_])", ":" + bindName + "$1");
- sql = sql.replaceAll(":S$", ":" + bindName);
- sql = sql.replaceAll("#S#", "#" + bindName + "#");
- //
- m_where.append(" AND ");
- addWhere(sql, new NVPair(bindName, valueForS));
- }
- }
-
- /**
- * add sql part with custom binds the ADD keyword is NOT added (pre-pended)
- * automatically
- */
- public void addWhere(String sql, NVPair... customBinds) {
- if (sql != null) {
- m_where.append(sql);
- for (NVPair p : customBinds) {
- m_binds.put(p.getName(), p.getValue());
- }
- }
- }
-
- @Override
- public void clear() {
- super.clear();
- m_where.setLength(0);
- m_binds.clear();
- }
-
- public String getWhere() {
- return m_where.toString();
- }
-
- public String getWherePlain() throws ProcessingException {
- return SERVICES.getService(ILegacySqlQueryService.class).createPlainText(getWhere(), getBindMap());
- }
-
- @Override
- public Object clone() {
- LegacySearchFilter f = (LegacySearchFilter) super.clone();
- f.m_sBindSeq = m_sBindSeq;
- f.m_binds = new HashMap<String, Object>(m_binds);
- f.m_where = new StringBuffer(m_where);
- return f;
- }
-
- @Override
- public String toString() {
- StringBuffer buf = new StringBuffer();
- buf.append("SearchFilter[");
- if (m_where != null && m_where.length() > 0) {
- buf.append(m_where);
- buf.append(" ");
- }
- if (m_binds != null && m_binds.size() > 0) {
- buf.append(m_binds);
- }
- buf.append("]");
- return buf.toString();
- }
-
- public static class StringLikeConstraint implements Serializable {
- private static final long serialVersionUID = 1L;
-
- private String m_term;
- private String m_value;
-
- public StringLikeConstraint(String term, String value) {
- m_term = term;
- m_value = value;
- }
-
- public String getTerm() {
- return m_term;
- }
-
- public String getValue() {
- return m_value;
- }
- }
-
- public static class ComposerConstraint implements Serializable {
- private static final long serialVersionUID = 1L;
-
- private String m_term;
- private Map<String, ComposerAttributeRef> m_attributeRefMap;
-
- public ComposerConstraint(String term, Map<String, ComposerAttributeRef> attributeRefMap) {
- m_term = term;
- m_attributeRefMap = attributeRefMap;
- }
-
- public String getTerm() {
- return m_term;
- }
-
- public Map<String, ComposerAttributeRef> getAttributeRefMap() {
- return m_attributeRefMap;
- }
-
- }
-
- public static class ComposerAttributeRef implements Serializable {
- private static final long serialVersionUID = 1L;
-
- private int m_op;
- private String m_attribute;
- private String m_bindName;
- private Object m_value;
-
- public ComposerAttributeRef(int op, String attribute, String bindName, Object value) {
- m_op = op;
- m_attribute = attribute;
- m_bindName = bindName;
- m_value = value;
- }
-
- public int getOp() {
- return m_op;
- }
-
- public String getAttribute() {
- return m_attribute;
- }
-
- public String getBindName() {
- return m_bindName;
- }
-
- public Object getValue() {
- return m_value;
- }
- }
-
- public static class WhereToken implements Serializable {
- private static final long serialVersionUID = 1L;
-
- private String m_text;
- private Object m_s;
- private Map<String, Object> m_binds;
-
- public WhereToken(String text, Object s, Map<String, Object> binds) {
- m_text = text;
- m_s = s;
- m_binds = binds;
- }
-
- public String getText() {
- return m_text;
- }
-
- public Object getS() {
- return m_s;
- }
-
- public Map<String, Object> getBinds() {
- return m_binds;
- }
-
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.jdbc;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.holders.NVPair;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.service.SERVICES;
+
+public class LegacySearchFilter extends SearchFilter implements Cloneable {
+ private static final long serialVersionUID = 0L;
+
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(LegacySearchFilter.class);
+
+ private int m_sBindSeq;
+ private HashMap<String, Object> m_binds = new HashMap<String, Object>();
+ private StringBuffer m_where = new StringBuffer("");
+
+ public LegacySearchFilter() {
+ }
+
+ /**
+ * @return live map of all binds changes to this map are immediately reflected
+ * inside the instance
+ */
+ public Map<String, Object> getBindMap() {
+ return m_binds;
+ }
+
+ public void addBind(String name, Object value) {
+ if (name != null) {
+ m_binds.put(name, value);
+ }
+ }
+
+ public void addSpecialWhereToken(Object o) throws ProcessingException {
+ WhereToken tok = SERVICES.getService(ILegacySqlQueryService.class).resolveSpecialConstraint(o);
+ if (tok.getBinds() != null) {
+ m_binds.putAll(tok.getBinds());
+ }
+ addWhereToken(tok.getText(), tok.getS());
+ }
+
+ /**
+ * clear all existing filter elements and add only this one same as {@link #clear()} followed by
+ * {@link #addWhere(String,NVPair...)}
+ */
+ public void setWhere(String sql, NVPair... customBinds) {
+ clear();
+ addWhere(sql, customBinds);
+ }
+
+ /**
+ * clear all existing filter elements and add only this one same as {@link #clear()} followed by
+ * {@link #addWhereToken(String)}
+ */
+ public void setWhereToken(String sql) {
+ clear();
+ addWhereToken(sql);
+ }
+
+ /**
+ * clear all existing filter elements and add only this one same as {@link #clear()} followed by
+ * {@link #addWhereToken(String,Object)}
+ */
+ public void setWhereToken(String sql, Object valueForS) {
+ clear();
+ addWhereToken(sql, valueForS);
+ }
+
+ /**
+ * add sql part the ADD keyword is added (pre-pended) automatically
+ */
+ public void addWhereToken(String sql) {
+ if (sql != null) {
+ m_where.append(" AND ");
+ addWhere(sql);
+ }
+ }
+
+ /**
+ * generates a random generic bind name useful for custom replacements of S
+ * values
+ */
+ public String getNextGenericBindName() {
+ String bindName = "__" + m_sBindSeq;
+ m_sBindSeq++;
+ return bindName;
+ }
+
+ /**
+ * add sql part with bind references to :S and #S# the ADD keyword is added
+ * (pre-pended) automatically
+ */
+ public void addWhereToken(String sql, Object valueForS) {
+ if (sql != null) {
+ // create generic bind for S
+ String bindName = "__" + m_sBindSeq;
+ m_sBindSeq++;
+ sql = sql.replaceAll(":S([^a-zA-Z0-9_])", ":" + bindName + "$1");
+ sql = sql.replaceAll(":S$", ":" + bindName);
+ sql = sql.replaceAll("#S#", "#" + bindName + "#");
+ //
+ m_where.append(" AND ");
+ addWhere(sql, new NVPair(bindName, valueForS));
+ }
+ }
+
+ /**
+ * add sql part with custom binds the ADD keyword is NOT added (pre-pended)
+ * automatically
+ */
+ public void addWhere(String sql, NVPair... customBinds) {
+ if (sql != null) {
+ m_where.append(sql);
+ for (NVPair p : customBinds) {
+ m_binds.put(p.getName(), p.getValue());
+ }
+ }
+ }
+
+ @Override
+ public void clear() {
+ super.clear();
+ m_where.setLength(0);
+ m_binds.clear();
+ }
+
+ public String getWhere() {
+ return m_where.toString();
+ }
+
+ public String getWherePlain() throws ProcessingException {
+ return SERVICES.getService(ILegacySqlQueryService.class).createPlainText(getWhere(), getBindMap());
+ }
+
+ @Override
+ public Object clone() {
+ LegacySearchFilter f = (LegacySearchFilter) super.clone();
+ f.m_sBindSeq = m_sBindSeq;
+ f.m_binds = new HashMap<String, Object>(m_binds);
+ f.m_where = new StringBuffer(m_where);
+ return f;
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer buf = new StringBuffer();
+ buf.append("SearchFilter[");
+ if (m_where != null && m_where.length() > 0) {
+ buf.append(m_where);
+ buf.append(" ");
+ }
+ if (m_binds != null && m_binds.size() > 0) {
+ buf.append(m_binds);
+ }
+ buf.append("]");
+ return buf.toString();
+ }
+
+ public static class StringLikeConstraint implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private String m_term;
+ private String m_value;
+
+ public StringLikeConstraint(String term, String value) {
+ m_term = term;
+ m_value = value;
+ }
+
+ public String getTerm() {
+ return m_term;
+ }
+
+ public String getValue() {
+ return m_value;
+ }
+ }
+
+ public static class ComposerConstraint implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private String m_term;
+ private Map<String, ComposerAttributeRef> m_attributeRefMap;
+
+ public ComposerConstraint(String term, Map<String, ComposerAttributeRef> attributeRefMap) {
+ m_term = term;
+ m_attributeRefMap = attributeRefMap;
+ }
+
+ public String getTerm() {
+ return m_term;
+ }
+
+ public Map<String, ComposerAttributeRef> getAttributeRefMap() {
+ return m_attributeRefMap;
+ }
+
+ }
+
+ public static class ComposerAttributeRef implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private int m_op;
+ private String m_attribute;
+ private String m_bindName;
+ private Object m_value;
+
+ public ComposerAttributeRef(int op, String attribute, String bindName, Object value) {
+ m_op = op;
+ m_attribute = attribute;
+ m_bindName = bindName;
+ m_value = value;
+ }
+
+ public int getOp() {
+ return m_op;
+ }
+
+ public String getAttribute() {
+ return m_attribute;
+ }
+
+ public String getBindName() {
+ return m_bindName;
+ }
+
+ public Object getValue() {
+ return m_value;
+ }
+ }
+
+ public static class WhereToken implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private String m_text;
+ private Object m_s;
+ private Map<String, Object> m_binds;
+
+ public WhereToken(String text, Object s, Map<String, Object> binds) {
+ m_text = text;
+ m_s = s;
+ m_binds = binds;
+ }
+
+ public String getText() {
+ return m_text;
+ }
+
+ public Object getS() {
+ return m_s;
+ }
+
+ public Map<String, Object> getBinds() {
+ return m_binds;
+ }
+
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/jdbc/LegacySearchUtility.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/jdbc/LegacySearchUtility.java
index 2fcaadf3d8..987432bcf2 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/jdbc/LegacySearchUtility.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/jdbc/LegacySearchUtility.java
@@ -1,113 +1,113 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.jdbc;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.holders.NVPair;
-
-public final class LegacySearchUtility {
-
- private LegacySearchUtility() {
- }
-
- public static Map<String, Object> getBindMap(SearchFilter filter) {
- if (filter instanceof LegacySearchFilter) {
- return ((LegacySearchFilter) filter).getBindMap();
- }
- else {
- return new HashMap<String, Object>();
- }
- }
-
- public static void addBind(SearchFilter filter, String name, Object value) {
- if (filter instanceof LegacySearchFilter) {
- ((LegacySearchFilter) filter).addBind(name, value);
- }
- else {
- throw new IllegalArgumentException("expected a filter of " + LegacySearchFilter.class + "; got " + (filter != null ? filter.getClass() : null));
- }
- }
-
- public static void setWhere(SearchFilter filter, String sql, NVPair... customBinds) {
- if (filter instanceof LegacySearchFilter) {
- ((LegacySearchFilter) filter).setWhere(sql, customBinds);
- }
- else {
- throw new IllegalArgumentException("expected a filter of " + LegacySearchFilter.class + "; got " + (filter != null ? filter.getClass() : null));
- }
- }
-
- public static void setWhereToken(SearchFilter filter, String sql) {
- if (filter instanceof LegacySearchFilter) {
- ((LegacySearchFilter) filter).setWhereToken(sql);
- }
- else {
- throw new IllegalArgumentException("expected a filter of " + LegacySearchFilter.class + "; got " + (filter != null ? filter.getClass() : null));
- }
- }
-
- public static void setWhereToken(SearchFilter filter, String sql, Object valueForS) {
- if (filter instanceof LegacySearchFilter) {
- ((LegacySearchFilter) filter).setWhereToken(sql, valueForS);
- }
- else {
- throw new IllegalArgumentException("expected a filter of " + LegacySearchFilter.class + "; got " + (filter != null ? filter.getClass() : null));
- }
- }
-
- public static void addWhereToken(SearchFilter filter, String sql) {
- if (filter instanceof LegacySearchFilter) {
- ((LegacySearchFilter) filter).addWhereToken(sql);
- }
- else {
- throw new IllegalArgumentException("expected a filter of " + LegacySearchFilter.class + "; got " + (filter != null ? filter.getClass() : null));
- }
- }
-
- public static void addWhereToken(SearchFilter filter, String sql, Object valueForS) {
- if (filter instanceof LegacySearchFilter) {
- ((LegacySearchFilter) filter).addWhereToken(sql, valueForS);
- }
- else {
- throw new IllegalArgumentException("expected a filter of " + LegacySearchFilter.class + "; got " + (filter != null ? filter.getClass() : null));
- }
- }
-
- public static void addWhere(SearchFilter filter, String sql, NVPair... customBinds) {
- if (filter instanceof LegacySearchFilter) {
- ((LegacySearchFilter) filter).addWhere(sql, customBinds);
- }
- else {
- throw new IllegalArgumentException("expected a filter of " + LegacySearchFilter.class + "; got " + (filter != null ? filter.getClass() : null));
- }
- }
-
- public static String getWhere(SearchFilter filter) {
- if (filter instanceof LegacySearchFilter) {
- return ((LegacySearchFilter) filter).getWhere();
- }
- else {
- return "";
- }
- }
-
- public static String getWherePlain(SearchFilter filter) throws ProcessingException {
- if (filter instanceof LegacySearchFilter) {
- return ((LegacySearchFilter) filter).getWherePlain();
- }
- else {
- return "";
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.jdbc;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.holders.NVPair;
+
+public final class LegacySearchUtility {
+
+ private LegacySearchUtility() {
+ }
+
+ public static Map<String, Object> getBindMap(SearchFilter filter) {
+ if (filter instanceof LegacySearchFilter) {
+ return ((LegacySearchFilter) filter).getBindMap();
+ }
+ else {
+ return new HashMap<String, Object>();
+ }
+ }
+
+ public static void addBind(SearchFilter filter, String name, Object value) {
+ if (filter instanceof LegacySearchFilter) {
+ ((LegacySearchFilter) filter).addBind(name, value);
+ }
+ else {
+ throw new IllegalArgumentException("expected a filter of " + LegacySearchFilter.class + "; got " + (filter != null ? filter.getClass() : null));
+ }
+ }
+
+ public static void setWhere(SearchFilter filter, String sql, NVPair... customBinds) {
+ if (filter instanceof LegacySearchFilter) {
+ ((LegacySearchFilter) filter).setWhere(sql, customBinds);
+ }
+ else {
+ throw new IllegalArgumentException("expected a filter of " + LegacySearchFilter.class + "; got " + (filter != null ? filter.getClass() : null));
+ }
+ }
+
+ public static void setWhereToken(SearchFilter filter, String sql) {
+ if (filter instanceof LegacySearchFilter) {
+ ((LegacySearchFilter) filter).setWhereToken(sql);
+ }
+ else {
+ throw new IllegalArgumentException("expected a filter of " + LegacySearchFilter.class + "; got " + (filter != null ? filter.getClass() : null));
+ }
+ }
+
+ public static void setWhereToken(SearchFilter filter, String sql, Object valueForS) {
+ if (filter instanceof LegacySearchFilter) {
+ ((LegacySearchFilter) filter).setWhereToken(sql, valueForS);
+ }
+ else {
+ throw new IllegalArgumentException("expected a filter of " + LegacySearchFilter.class + "; got " + (filter != null ? filter.getClass() : null));
+ }
+ }
+
+ public static void addWhereToken(SearchFilter filter, String sql) {
+ if (filter instanceof LegacySearchFilter) {
+ ((LegacySearchFilter) filter).addWhereToken(sql);
+ }
+ else {
+ throw new IllegalArgumentException("expected a filter of " + LegacySearchFilter.class + "; got " + (filter != null ? filter.getClass() : null));
+ }
+ }
+
+ public static void addWhereToken(SearchFilter filter, String sql, Object valueForS) {
+ if (filter instanceof LegacySearchFilter) {
+ ((LegacySearchFilter) filter).addWhereToken(sql, valueForS);
+ }
+ else {
+ throw new IllegalArgumentException("expected a filter of " + LegacySearchFilter.class + "; got " + (filter != null ? filter.getClass() : null));
+ }
+ }
+
+ public static void addWhere(SearchFilter filter, String sql, NVPair... customBinds) {
+ if (filter instanceof LegacySearchFilter) {
+ ((LegacySearchFilter) filter).addWhere(sql, customBinds);
+ }
+ else {
+ throw new IllegalArgumentException("expected a filter of " + LegacySearchFilter.class + "; got " + (filter != null ? filter.getClass() : null));
+ }
+ }
+
+ public static String getWhere(SearchFilter filter) {
+ if (filter instanceof LegacySearchFilter) {
+ return ((LegacySearchFilter) filter).getWhere();
+ }
+ else {
+ return "";
+ }
+ }
+
+ public static String getWherePlain(SearchFilter filter) throws ProcessingException {
+ if (filter instanceof LegacySearchFilter) {
+ return ((LegacySearchFilter) filter).getWherePlain();
+ }
+ else {
+ return "";
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/jdbc/SearchFilter.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/jdbc/SearchFilter.java
index f55cce2f79..b93b44620e 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/jdbc/SearchFilter.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/jdbc/SearchFilter.java
@@ -1,115 +1,115 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.jdbc;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Arrays;
-
-import org.eclipse.scout.rt.shared.data.form.AbstractFormData;
-
-/**
- * Search model that contains a form data, verbose search texts and a valid status
- */
-public class SearchFilter implements Serializable, Cloneable {
- private static final long serialVersionUID = 0L;
-
- private boolean m_completed;
- private AbstractFormData m_formData;
- private ArrayList<String> m_displayTexts = new ArrayList<String>();
-
- public SearchFilter() {
- }
-
- /**
- * @return live map of all binds changes to this map are immediately reflected
- * inside the instance
- */
- public AbstractFormData getFormData() {
- return m_formData;
- }
-
- public void setFormData(AbstractFormData formData) {
- m_formData = formData;
- }
-
- public void addDisplayText(String s) {
- m_displayTexts.add(s);
- }
-
- /**
- * clear all elements in the filter
- */
- public void clear() {
- m_completed = false;
- m_displayTexts.clear();
- m_formData = null;
- }
-
- public String[] getDisplayTexts() {
- return m_displayTexts.toArray(new String[0]);
- }
-
- public void setDisplayTexts(String[] displayTexts) {
- if (displayTexts == null) {
- displayTexts = new String[0];
- }
- m_displayTexts = new ArrayList<String>(Arrays.asList(displayTexts));
- }
-
- public String getDisplayTextsPlain() {
- StringBuffer buf = new StringBuffer();
- for (String s : getDisplayTexts()) {
- if (s != null) {
- buf.append(s.trim());
- buf.append("\n");
- }
- }
- return buf.toString().trim();
- }
-
- public boolean isCompleted() {
- return m_completed;
- }
-
- public void setCompleted(boolean b) {
- m_completed = b;
- }
-
- @Override
- public Object clone() {
- SearchFilter f;
- try {
- f = (SearchFilter) super.clone();
- }
- catch (CloneNotSupportedException e) {
- throw new RuntimeException(e);
- }
- f.m_completed = m_completed;
- if (m_formData != null) {
- f.m_formData = (AbstractFormData) m_formData.clone();
- }
- f.m_displayTexts = new ArrayList<String>(m_displayTexts);
- return f;
- }
-
- @Override
- public String toString() {
- StringBuffer buf = new StringBuffer();
- buf.append(getClass().getSimpleName());
- buf.append("[");
- if (m_formData != null) {
- buf.append(m_formData.toString());
- }
- buf.append("]");
- return buf.toString();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.jdbc;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Arrays;
+
+import org.eclipse.scout.rt.shared.data.form.AbstractFormData;
+
+/**
+ * Search model that contains a form data, verbose search texts and a valid status
+ */
+public class SearchFilter implements Serializable, Cloneable {
+ private static final long serialVersionUID = 0L;
+
+ private boolean m_completed;
+ private AbstractFormData m_formData;
+ private ArrayList<String> m_displayTexts = new ArrayList<String>();
+
+ public SearchFilter() {
+ }
+
+ /**
+ * @return live map of all binds changes to this map are immediately reflected
+ * inside the instance
+ */
+ public AbstractFormData getFormData() {
+ return m_formData;
+ }
+
+ public void setFormData(AbstractFormData formData) {
+ m_formData = formData;
+ }
+
+ public void addDisplayText(String s) {
+ m_displayTexts.add(s);
+ }
+
+ /**
+ * clear all elements in the filter
+ */
+ public void clear() {
+ m_completed = false;
+ m_displayTexts.clear();
+ m_formData = null;
+ }
+
+ public String[] getDisplayTexts() {
+ return m_displayTexts.toArray(new String[0]);
+ }
+
+ public void setDisplayTexts(String[] displayTexts) {
+ if (displayTexts == null) {
+ displayTexts = new String[0];
+ }
+ m_displayTexts = new ArrayList<String>(Arrays.asList(displayTexts));
+ }
+
+ public String getDisplayTextsPlain() {
+ StringBuffer buf = new StringBuffer();
+ for (String s : getDisplayTexts()) {
+ if (s != null) {
+ buf.append(s.trim());
+ buf.append("\n");
+ }
+ }
+ return buf.toString().trim();
+ }
+
+ public boolean isCompleted() {
+ return m_completed;
+ }
+
+ public void setCompleted(boolean b) {
+ m_completed = b;
+ }
+
+ @Override
+ public Object clone() {
+ SearchFilter f;
+ try {
+ f = (SearchFilter) super.clone();
+ }
+ catch (CloneNotSupportedException e) {
+ throw new RuntimeException(e);
+ }
+ f.m_completed = m_completed;
+ if (m_formData != null) {
+ f.m_formData = (AbstractFormData) m_formData.clone();
+ }
+ f.m_displayTexts = new ArrayList<String>(m_displayTexts);
+ return f;
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer buf = new StringBuffer();
+ buf.append(getClass().getSimpleName());
+ buf.append("[");
+ if (m_formData != null) {
+ buf.append(m_formData.toString());
+ }
+ buf.append("]");
+ return buf.toString();
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/jdbc/TokenBasedSearchFilter.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/jdbc/TokenBasedSearchFilter.java
index f2b1eeae8a..fb551703c4 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/jdbc/TokenBasedSearchFilter.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/jdbc/TokenBasedSearchFilter.java
@@ -1,211 +1,211 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.jdbc;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-
-/**
- * Use the {@link TokenBasedSearchFilterService} on the client side to use this class
- */
-public class TokenBasedSearchFilter extends SearchFilter implements Cloneable {
- private static final long serialVersionUID = 0L;
-
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(TokenBasedSearchFilter.class);
-
- private ArrayList<ValueToken> m_valueTokens;
- private ArrayList<WildcardStringToken> m_wildcardStringTokens;
- private ArrayList<AndNodeToken> m_treeTokens;
-
- public TokenBasedSearchFilter() {
- m_valueTokens = new ArrayList<ValueToken>(1);
- m_wildcardStringTokens = new ArrayList<WildcardStringToken>(1);
- m_treeTokens = new ArrayList<AndNodeToken>(1);
- }
-
- public void addToken(Integer tokenId, Object... values) {
- if (tokenId == null) {
- return;
- }
- m_valueTokens.add(new ValueToken(tokenId, values));
- }
-
- public void addWildcardStringToken(Integer tokenId, String value) {
- if (tokenId == null) {
- return;
- }
- m_wildcardStringTokens.add(new WildcardStringToken(tokenId, value));
- }
-
- public void addTreeToken(AndNodeToken root) {
- if (root == null || root.getChildren().size() == 0) {
- return;
- }
- m_treeTokens.add(root);
- }
-
- public List<ValueToken> getValueTokens() {
- return Collections.unmodifiableList(m_valueTokens);
- }
-
- public List<WildcardStringToken> getWildcardStringTokens() {
- return Collections.unmodifiableList(m_wildcardStringTokens);
- }
-
- public List<AndNodeToken> getTreeTokens() {
- return Collections.unmodifiableList(m_treeTokens);
- }
-
- @Override
- public void clear() {
- super.clear();
- m_valueTokens.clear();
- m_wildcardStringTokens.clear();
- m_treeTokens.clear();
- }
-
- @Override
- public Object clone() {
- TokenBasedSearchFilter f = (TokenBasedSearchFilter) super.clone();
- f.m_valueTokens = new ArrayList<ValueToken>(this.m_valueTokens);
- f.m_wildcardStringTokens = new ArrayList<WildcardStringToken>(this.m_wildcardStringTokens);
- f.m_treeTokens = new ArrayList<AndNodeToken>(this.m_treeTokens);
- return f;
- }
-
- public static class ValueToken implements Serializable {
- private static final long serialVersionUID = 1L;
-
- private final int m_tokenId;
- private final Object[] m_values;
-
- public ValueToken(int tokenId, Object[] values) {
- m_tokenId = tokenId;
- m_values = values;
- }
-
- public int getTokenId() {
- return m_tokenId;
- }
-
- public Object[] getValues() {
- return m_values;
- }
- }
-
- public static class WildcardStringToken implements Serializable {
- private static final long serialVersionUID = 1L;
-
- private final int m_tokenId;
- private final String m_value;
-
- public WildcardStringToken(int tokenId, String value) {
- m_tokenId = tokenId;
- m_value = value;
- }
-
- public int getTokenId() {
- return m_tokenId;
- }
-
- public String getValue() {
- return m_value;
- }
- }
-
- public static class TreeNodeToken implements Serializable {
- private static final long serialVersionUID = 1L;
-
- private final List<TreeNodeToken> m_children = new ArrayList<TreeNodeToken>(1);
- private boolean m_negative;
-
- public TreeNodeToken() {
- }
-
- public void addChild(TreeNodeToken child) {
- if (child != null) {
- m_children.add(child);
- }
- }
-
- public List<TreeNodeToken> getChildren() {
- return Collections.unmodifiableList(m_children);
- }
-
- public boolean isNegative() {
- return m_negative;
- }
-
- public void setNegative(boolean negative) {
- m_negative = negative;
- }
- }
-
- public static class AndNodeToken extends TreeNodeToken implements Serializable {
- private static final long serialVersionUID = 1L;
-
- public AndNodeToken() {
- }
- }
-
- public static class OrNodeToken extends TreeNodeToken implements Serializable {
- private static final long serialVersionUID = 1L;
-
- public OrNodeToken() {
- }
- }
-
- public static class AttributeNodeToken extends TreeNodeToken implements Serializable {
- private static final long serialVersionUID = 1L;
-
- private final int m_tokenId;
- private final int m_op;
- private final Object[] m_values;
-
- public AttributeNodeToken(int tokenId, int op, Object[] values) {
- m_tokenId = tokenId;
- m_op = op;
- m_values = values;
- }
-
- public int getTokenId() {
- return m_tokenId;
- }
-
- public int getOp() {
- return m_op;
- }
-
- public Object[] getValues() {
- return m_values;
- }
- }
-
- public static class EntityNodeToken extends TreeNodeToken implements Serializable {
- private static final long serialVersionUID = 1L;
-
- private final int m_tokenId;
-
- public EntityNodeToken(int tokenId) {
- m_tokenId = tokenId;
- }
-
- public int getTokenId() {
- return m_tokenId;
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.jdbc;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+
+/**
+ * Use the {@link TokenBasedSearchFilterService} on the client side to use this class
+ */
+public class TokenBasedSearchFilter extends SearchFilter implements Cloneable {
+ private static final long serialVersionUID = 0L;
+
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(TokenBasedSearchFilter.class);
+
+ private ArrayList<ValueToken> m_valueTokens;
+ private ArrayList<WildcardStringToken> m_wildcardStringTokens;
+ private ArrayList<AndNodeToken> m_treeTokens;
+
+ public TokenBasedSearchFilter() {
+ m_valueTokens = new ArrayList<ValueToken>(1);
+ m_wildcardStringTokens = new ArrayList<WildcardStringToken>(1);
+ m_treeTokens = new ArrayList<AndNodeToken>(1);
+ }
+
+ public void addToken(Integer tokenId, Object... values) {
+ if (tokenId == null) {
+ return;
+ }
+ m_valueTokens.add(new ValueToken(tokenId, values));
+ }
+
+ public void addWildcardStringToken(Integer tokenId, String value) {
+ if (tokenId == null) {
+ return;
+ }
+ m_wildcardStringTokens.add(new WildcardStringToken(tokenId, value));
+ }
+
+ public void addTreeToken(AndNodeToken root) {
+ if (root == null || root.getChildren().size() == 0) {
+ return;
+ }
+ m_treeTokens.add(root);
+ }
+
+ public List<ValueToken> getValueTokens() {
+ return Collections.unmodifiableList(m_valueTokens);
+ }
+
+ public List<WildcardStringToken> getWildcardStringTokens() {
+ return Collections.unmodifiableList(m_wildcardStringTokens);
+ }
+
+ public List<AndNodeToken> getTreeTokens() {
+ return Collections.unmodifiableList(m_treeTokens);
+ }
+
+ @Override
+ public void clear() {
+ super.clear();
+ m_valueTokens.clear();
+ m_wildcardStringTokens.clear();
+ m_treeTokens.clear();
+ }
+
+ @Override
+ public Object clone() {
+ TokenBasedSearchFilter f = (TokenBasedSearchFilter) super.clone();
+ f.m_valueTokens = new ArrayList<ValueToken>(this.m_valueTokens);
+ f.m_wildcardStringTokens = new ArrayList<WildcardStringToken>(this.m_wildcardStringTokens);
+ f.m_treeTokens = new ArrayList<AndNodeToken>(this.m_treeTokens);
+ return f;
+ }
+
+ public static class ValueToken implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private final int m_tokenId;
+ private final Object[] m_values;
+
+ public ValueToken(int tokenId, Object[] values) {
+ m_tokenId = tokenId;
+ m_values = values;
+ }
+
+ public int getTokenId() {
+ return m_tokenId;
+ }
+
+ public Object[] getValues() {
+ return m_values;
+ }
+ }
+
+ public static class WildcardStringToken implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private final int m_tokenId;
+ private final String m_value;
+
+ public WildcardStringToken(int tokenId, String value) {
+ m_tokenId = tokenId;
+ m_value = value;
+ }
+
+ public int getTokenId() {
+ return m_tokenId;
+ }
+
+ public String getValue() {
+ return m_value;
+ }
+ }
+
+ public static class TreeNodeToken implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private final List<TreeNodeToken> m_children = new ArrayList<TreeNodeToken>(1);
+ private boolean m_negative;
+
+ public TreeNodeToken() {
+ }
+
+ public void addChild(TreeNodeToken child) {
+ if (child != null) {
+ m_children.add(child);
+ }
+ }
+
+ public List<TreeNodeToken> getChildren() {
+ return Collections.unmodifiableList(m_children);
+ }
+
+ public boolean isNegative() {
+ return m_negative;
+ }
+
+ public void setNegative(boolean negative) {
+ m_negative = negative;
+ }
+ }
+
+ public static class AndNodeToken extends TreeNodeToken implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ public AndNodeToken() {
+ }
+ }
+
+ public static class OrNodeToken extends TreeNodeToken implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ public OrNodeToken() {
+ }
+ }
+
+ public static class AttributeNodeToken extends TreeNodeToken implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private final int m_tokenId;
+ private final int m_op;
+ private final Object[] m_values;
+
+ public AttributeNodeToken(int tokenId, int op, Object[] values) {
+ m_tokenId = tokenId;
+ m_op = op;
+ m_values = values;
+ }
+
+ public int getTokenId() {
+ return m_tokenId;
+ }
+
+ public int getOp() {
+ return m_op;
+ }
+
+ public Object[] getValues() {
+ return m_values;
+ }
+ }
+
+ public static class EntityNodeToken extends TreeNodeToken implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private final int m_tokenId;
+
+ public EntityNodeToken(int tokenId) {
+ m_tokenId = tokenId;
+ }
+
+ public int getTokenId() {
+ return m_tokenId;
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/offline/IOfflineDispatcherService.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/offline/IOfflineDispatcherService.java
index 363e7b0c18..d14a9666a4 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/offline/IOfflineDispatcherService.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/offline/IOfflineDispatcherService.java
@@ -1,37 +1,37 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.offline;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelRequest;
-import org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelResponse;
-import org.eclipse.scout.rt.shared.validate.InputValidation;
-import org.eclipse.scout.rt.shared.validate.IValidationStrategy;
-import org.eclipse.scout.service.IService;
-
-/**
- * This service is representing a local server on the frontend used to process
- * server logic similiar to the backend in transactions and with xa support. <br>
- * Normally an implementation of this service such as OfflineDispatcherService
- * is registered in the ...server.offline plugin's plugin.xml in the
- * org.eclipse.scout.services extension.
- */
-@Priority(-3)
-@InputValidation(IValidationStrategy.PROCESS.class)
-public interface IOfflineDispatcherService extends IService {
-
- String getServerSessionClass();
-
- void setServerSessionClass(String className);
-
- ServiceTunnelResponse dispatch(final ServiceTunnelRequest request, final IProgressMonitor monitor);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.offline;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelRequest;
+import org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelResponse;
+import org.eclipse.scout.rt.shared.validate.InputValidation;
+import org.eclipse.scout.rt.shared.validate.IValidationStrategy;
+import org.eclipse.scout.service.IService;
+
+/**
+ * This service is representing a local server on the frontend used to process
+ * server logic similiar to the backend in transactions and with xa support. <br>
+ * Normally an implementation of this service such as OfflineDispatcherService
+ * is registered in the ...server.offline plugin's plugin.xml in the
+ * org.eclipse.scout.services extension.
+ */
+@Priority(-3)
+@InputValidation(IValidationStrategy.PROCESS.class)
+public interface IOfflineDispatcherService extends IService {
+
+ String getServerSessionClass();
+
+ void setServerSessionClass(String className);
+
+ ServiceTunnelResponse dispatch(final ServiceTunnelRequest request, final IProgressMonitor monitor);
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/ping/IPingService.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/ping/IPingService.java
index 4e4d4d9710..c0246a1c12 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/ping/IPingService.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/ping/IPingService.java
@@ -1,24 +1,24 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.ping;
-
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.rt.shared.validate.InputValidation;
-import org.eclipse.scout.rt.shared.validate.IValidationStrategy;
-import org.eclipse.scout.service.IService;
-
-@Priority(-3)
-@InputValidation(IValidationStrategy.PROCESS.class)
-public interface IPingService extends IService {
-
- String ping(String s);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.ping;
+
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.rt.shared.validate.InputValidation;
+import org.eclipse.scout.rt.shared.validate.IValidationStrategy;
+import org.eclipse.scout.service.IService;
+
+@Priority(-3)
+@InputValidation(IValidationStrategy.PROCESS.class)
+public interface IPingService extends IService {
+
+ String ping(String s);
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/prefs/IUserPreferencesStorageService.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/prefs/IUserPreferencesStorageService.java
index 17bfe7b616..e10138ac89 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/prefs/IUserPreferencesStorageService.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/prefs/IUserPreferencesStorageService.java
@@ -1,33 +1,33 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.prefs;
-
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.rt.shared.validate.IValidationStrategy;
-import org.eclipse.scout.rt.shared.validate.InputValidation;
-import org.eclipse.scout.service.IService;
-import org.osgi.service.prefs.Preferences;
-
-/**
- *
- */
-@Priority(-3)
-@InputValidation(IValidationStrategy.PROCESS.class)
-public interface IUserPreferencesStorageService extends IService {
-
- /**
- * Loads UI Preferences (Windows, Column widths, Table Customizers, ...) from persistent data store.
- * Method is called on any UI change.
- *
- * @return preferences data
- */
- Preferences loadPreferences();
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.prefs;
+
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.rt.shared.validate.IValidationStrategy;
+import org.eclipse.scout.rt.shared.validate.InputValidation;
+import org.eclipse.scout.service.IService;
+import org.osgi.service.prefs.Preferences;
+
+/**
+ *
+ */
+@Priority(-3)
+@InputValidation(IValidationStrategy.PROCESS.class)
+public interface IUserPreferencesStorageService extends IService {
+
+ /**
+ * Loads UI Preferences (Windows, Column widths, Table Customizers, ...) from persistent data store.
+ * Method is called on any UI change.
+ *
+ * @return preferences data
+ */
+ Preferences loadPreferences();
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/processing/IServerProcessingCancelService.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/processing/IServerProcessingCancelService.java
index 3bdd815986..f8f42e8587 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/processing/IServerProcessingCancelService.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/processing/IServerProcessingCancelService.java
@@ -1,31 +1,31 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.processing;
-
-import org.eclipse.scout.rt.shared.validate.IValidationStrategy;
-import org.eclipse.scout.rt.shared.validate.InputValidation;
-import org.eclipse.scout.service.IService;
-
-public interface IServerProcessingCancelService extends IService {
-
- /**
- * Cancel only specific backend job transaction of the same server session
- * <p>
- * Whenever a ClientJob - that is doing a backend call - is cancelled, this is detected by the
- * InternalHttpServiceTunnel.tunnelOnline and calls {@link IServerProcessingCancelService#cancel(long)}. The
- * server-side ServerProcessingCancelService calls ActiveTransactionRegistry.cancel
- * <p>
- *
- * @return true if cancel was successful and transaction was in fact cancelled, false otherwise
- */
- @InputValidation(IValidationStrategy.NO_CHECK.class)
- boolean cancel(long requestSequence);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.processing;
+
+import org.eclipse.scout.rt.shared.validate.IValidationStrategy;
+import org.eclipse.scout.rt.shared.validate.InputValidation;
+import org.eclipse.scout.service.IService;
+
+public interface IServerProcessingCancelService extends IService {
+
+ /**
+ * Cancel only specific backend job transaction of the same server session
+ * <p>
+ * Whenever a ClientJob - that is doing a backend call - is cancelled, this is detected by the
+ * InternalHttpServiceTunnel.tunnelOnline and calls {@link IServerProcessingCancelService#cancel(long)}. The
+ * server-side ServerProcessingCancelService calls ActiveTransactionRegistry.cancel
+ * <p>
+ *
+ * @return true if cancel was successful and transaction was in fact cancelled, false otherwise
+ */
+ @InputValidation(IValidationStrategy.NO_CHECK.class)
+ boolean cancel(long requestSequence);
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/pwd/IPasswordManagementService.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/pwd/IPasswordManagementService.java
index f9972fdb3c..08369c8fe1 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/pwd/IPasswordManagementService.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/pwd/IPasswordManagementService.java
@@ -1,58 +1,58 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.pwd;
-
-import java.util.Date;
-
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.shared.validate.InputValidation;
-import org.eclipse.scout.rt.shared.validate.IValidationStrategy;
-import org.eclipse.scout.service.IService;
-
-/**
- * Common definition of a password management service that may be used by
- * projects to manage a private set of users in an application.
- * <p>
- * However, the use of external existing user administration for single-sign-in and password management is highly
- * recommended. <br>
- * This common definition solely is used when no on-site solution is available.
- * <p>
- * In order to use, register it in the extension "org.eclipse.scout.rt.client.serviceProxy"
- */
-@Priority(-3)
-@InputValidation(IValidationStrategy.PROCESS.class)
-public interface IPasswordManagementService extends IService {
-
- /**
- * @return a localized text that describes the policy to the user (may contain
- * new lines)
- */
- String getPasswordPolicyText();
-
- /**
- * @return when the password of the user will expire
- */
- Date getPasswordExpirationDate(String userId);
-
- /**
- * change the password of a user
- */
- void changePassword(String userId, String oldPassword, String newPassword) throws ProcessingException;
-
- /**
- * reset the password of a user <br>
- * In the implementation make sure to use sufficient permission rights to
- * enable this method.
- */
- void resetPassword(String userId, String newPassword) throws ProcessingException;
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.pwd;
+
+import java.util.Date;
+
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.shared.validate.InputValidation;
+import org.eclipse.scout.rt.shared.validate.IValidationStrategy;
+import org.eclipse.scout.service.IService;
+
+/**
+ * Common definition of a password management service that may be used by
+ * projects to manage a private set of users in an application.
+ * <p>
+ * However, the use of external existing user administration for single-sign-in and password management is highly
+ * recommended. <br>
+ * This common definition solely is used when no on-site solution is available.
+ * <p>
+ * In order to use, register it in the extension "org.eclipse.scout.rt.client.serviceProxy"
+ */
+@Priority(-3)
+@InputValidation(IValidationStrategy.PROCESS.class)
+public interface IPasswordManagementService extends IService {
+
+ /**
+ * @return a localized text that describes the policy to the user (may contain
+ * new lines)
+ */
+ String getPasswordPolicyText();
+
+ /**
+ * @return when the password of the user will expire
+ */
+ Date getPasswordExpirationDate(String userId);
+
+ /**
+ * change the password of a user
+ */
+ void changePassword(String userId, String oldPassword, String newPassword) throws ProcessingException;
+
+ /**
+ * reset the password of a user <br>
+ * In the implementation make sure to use sufficient permission rights to
+ * enable this method.
+ */
+ void resetPassword(String userId, String newPassword) throws ProcessingException;
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/security/ACCESS.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/security/ACCESS.java
index 4ba0b933e7..59a313c951 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/security/ACCESS.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/security/ACCESS.java
@@ -1,72 +1,72 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.security;
-
-import java.security.Permission;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.shared.security.ServicePermission;
-import org.eclipse.scout.service.SERVICES;
-import org.eclipse.scout.service.ServiceUtility;
-
-/**
- * Title: BSI Products Description: BSI CASE generated code Copyright: Copyright
- * (c) 2001,2007 BSI AG
- *
- * @version 3.x
- */
-
-@SuppressWarnings("deprecation")
-public final class ACCESS {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(ACCESS.class);
-
- private ACCESS() {
- }
-
- /**
- * Conveniencefunction to check if the resource is accessible with that level
- * example: ACCESS.check(new
- * CompanyReadPermission(CompanyReadPermission.OWNED)) -> true
- */
- public static boolean check(Permission p) {
- return SERVICES.getService(IAccessControlService.class).checkPermission(p);
- }
-
- /**
- * Conveniencefunction to get the level of access on the resource example:
- * ACCESS.getLevel(new CompanyReadPermission()) -> CompanyReadPermission.ALL
- */
- public static int getLevel(Permission p) {
- return SERVICES.getService(IAccessControlService.class).getPermissionLevel(p);
- }
-
- /**
- * @deprecated never used
- */
- @Deprecated
- public static void checkService(Object service, String operation) throws ProcessingException {
- IAccessControlService acs = SERVICES.getService(IAccessControlService.class);
- if (acs != null) {
- Class c = service.getClass();
- for (Class i : ServiceUtility.getInterfacesHierarchy(c, Object.class)) {
- if (Object.class.isAssignableFrom(i)) {
- if (acs.checkPermission(new ServicePermission(i, operation))) {
- return;
- }
- }
- }
- throw new ProcessingException("service: " + service + ", operation: " + operation, new SecurityException("access denied"));
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.security;
+
+import java.security.Permission;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.shared.security.ServicePermission;
+import org.eclipse.scout.service.SERVICES;
+import org.eclipse.scout.service.ServiceUtility;
+
+/**
+ * Title: BSI Products Description: BSI CASE generated code Copyright: Copyright
+ * (c) 2001,2007 BSI AG
+ *
+ * @version 3.x
+ */
+
+@SuppressWarnings("deprecation")
+public final class ACCESS {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(ACCESS.class);
+
+ private ACCESS() {
+ }
+
+ /**
+ * Conveniencefunction to check if the resource is accessible with that level
+ * example: ACCESS.check(new
+ * CompanyReadPermission(CompanyReadPermission.OWNED)) -> true
+ */
+ public static boolean check(Permission p) {
+ return SERVICES.getService(IAccessControlService.class).checkPermission(p);
+ }
+
+ /**
+ * Conveniencefunction to get the level of access on the resource example:
+ * ACCESS.getLevel(new CompanyReadPermission()) -> CompanyReadPermission.ALL
+ */
+ public static int getLevel(Permission p) {
+ return SERVICES.getService(IAccessControlService.class).getPermissionLevel(p);
+ }
+
+ /**
+ * @deprecated never used
+ */
+ @Deprecated
+ public static void checkService(Object service, String operation) throws ProcessingException {
+ IAccessControlService acs = SERVICES.getService(IAccessControlService.class);
+ if (acs != null) {
+ Class c = service.getClass();
+ for (Class i : ServiceUtility.getInterfacesHierarchy(c, Object.class)) {
+ if (Object.class.isAssignableFrom(i)) {
+ if (acs.checkPermission(new ServicePermission(i, operation))) {
+ return;
+ }
+ }
+ }
+ throw new ProcessingException("service: " + service + ", operation: " + operation, new SecurityException("access denied"));
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/security/AccessControlChangedNotification.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/security/AccessControlChangedNotification.java
index a39aced7fc..cce84da112 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/security/AccessControlChangedNotification.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/security/AccessControlChangedNotification.java
@@ -1,40 +1,40 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.security;
-
-import java.security.Permissions;
-
-import org.eclipse.scout.rt.shared.services.common.clientnotification.AbstractClientNotification;
-import org.eclipse.scout.rt.shared.services.common.clientnotification.IClientNotification;
-
-/**
- * Notification is sent from server to client to notify that the permission set
- * has changed
- */
-public class AccessControlChangedNotification extends AbstractClientNotification {
- private static final long serialVersionUID = 1L;
-
- private Permissions m_permissions;
-
- public AccessControlChangedNotification(Permissions permissions) {
- m_permissions = permissions;
- }
-
- public Permissions getPermissions() {
- return m_permissions;
- }
-
- @Override
- public boolean coalesce(IClientNotification existingNotification) {
- return true;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.security;
+
+import java.security.Permissions;
+
+import org.eclipse.scout.rt.shared.services.common.clientnotification.AbstractClientNotification;
+import org.eclipse.scout.rt.shared.services.common.clientnotification.IClientNotification;
+
+/**
+ * Notification is sent from server to client to notify that the permission set
+ * has changed
+ */
+public class AccessControlChangedNotification extends AbstractClientNotification {
+ private static final long serialVersionUID = 1L;
+
+ private Permissions m_permissions;
+
+ public AccessControlChangedNotification(Permissions permissions) {
+ m_permissions = permissions;
+ }
+
+ public Permissions getPermissions() {
+ return m_permissions;
+ }
+
+ @Override
+ public boolean coalesce(IClientNotification existingNotification) {
+ return true;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/security/AccessControlUtility.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/security/AccessControlUtility.java
index 647e35cc59..07f1cd6c1f 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/security/AccessControlUtility.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/security/AccessControlUtility.java
@@ -1,105 +1,105 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.security;
-
-import java.security.Permission;
-import java.security.Permissions;
-import java.util.HashMap;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.scout.commons.TypeCastUtility;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.commons.osgi.BundleClassDescriptor;
-import org.eclipse.scout.rt.shared.security.BasicHierarchyPermission;
-import org.eclipse.scout.service.SERVICES;
-import org.osgi.framework.Bundle;
-
-/**
- *
- */
-public final class AccessControlUtility {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AccessControlUtility.class);
-
- private AccessControlUtility() {
- }
-
- /**
- * Convenience to create permissions using a raw data matrix containing rows, columns
- *
- * @param matrix
- * is expected to contain the columns PERMISSION_CLASS (String),
- * PERMISSION_LEVEL (Integer)
- * @param classLoaderBundle
- * bundle used to load the permission classes.
- * @deprecated this method does not work if permission classes are defined in different bundles. Use
- * {@link AccessControlUtility#createPermissions(Object[][])} instead.
- */
- @Deprecated
- public static Permissions createPermissions(Object[][] permissionData, Bundle classLoaderBundle) {
- return createPermissions(permissionData);
- }
-
- /**
- * Convenience to create permissions using a raw data matrix containing rows, columns
- *
- * @param matrix
- * is expected to contain the columns PERMISSION_CLASS (String),
- * PERMISSION_LEVEL (Integer)
- */
- public static Permissions createPermissions(Object[][] permissionData) {
- HashMap<String, BundleClassDescriptor> permissionNameToBundleClassDesc;
- permissionNameToBundleClassDesc = new HashMap<String, BundleClassDescriptor>();
- IPermissionService psvc = SERVICES.getService(IPermissionService.class);
- if (psvc != null) {
- for (BundleClassDescriptor d : psvc.getAllPermissionClasses()) {
- permissionNameToBundleClassDesc.put(d.getSimpleClassName(), d);
- permissionNameToBundleClassDesc.put(d.getClassName(), d);
- }
- }
- //
- Permissions permSet = new Permissions();
- for (Object[] permissionRow : permissionData) {
- String name = "" + permissionRow[0];
- /*
- * Legacy migration com.bsiag.scout.shared.security.X ->
- * org.eclipse.scout.rt.shared.security.X
- */
- name = name.replace("com.bsiag.scout.shared.security.", "org.eclipse.scout.rt.shared.security.");
- int level = TypeCastUtility.castValue(permissionRow[1], Integer.class);
- try {
- BundleClassDescriptor desc = permissionNameToBundleClassDesc.get(name);
- if (desc == null) {
- LOG.warn("Unknown permission with name: " + permissionRow[0]);
- continue;
- }
- Bundle bundle = Platform.getBundle(desc.getBundleSymbolicName());
- Class c = bundle.loadClass(desc.getClassName());
- Permission p = (Permission) c.newInstance();
- if (p instanceof BasicHierarchyPermission) {
- ((BasicHierarchyPermission) p).setLevel(level);
- ((BasicHierarchyPermission) p).setReadOnly();
- }
- permSet.add(p);
- }
- catch (ClassNotFoundException e) {
- LOG.warn("Unknown permission with name: " + permissionRow[0]);
- }
- catch (InstantiationException e) {
- LOG.warn("Unable to load user-permission: " + permissionRow[0]);
- }
- catch (IllegalAccessException e) {
- LOG.warn("Unable to access user-permission: " + permissionRow[0]);
- }
- }
- return permSet;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.security;
+
+import java.security.Permission;
+import java.security.Permissions;
+import java.util.HashMap;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.scout.commons.TypeCastUtility;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.commons.osgi.BundleClassDescriptor;
+import org.eclipse.scout.rt.shared.security.BasicHierarchyPermission;
+import org.eclipse.scout.service.SERVICES;
+import org.osgi.framework.Bundle;
+
+/**
+ *
+ */
+public final class AccessControlUtility {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AccessControlUtility.class);
+
+ private AccessControlUtility() {
+ }
+
+ /**
+ * Convenience to create permissions using a raw data matrix containing rows, columns
+ *
+ * @param matrix
+ * is expected to contain the columns PERMISSION_CLASS (String),
+ * PERMISSION_LEVEL (Integer)
+ * @param classLoaderBundle
+ * bundle used to load the permission classes.
+ * @deprecated this method does not work if permission classes are defined in different bundles. Use
+ * {@link AccessControlUtility#createPermissions(Object[][])} instead.
+ */
+ @Deprecated
+ public static Permissions createPermissions(Object[][] permissionData, Bundle classLoaderBundle) {
+ return createPermissions(permissionData);
+ }
+
+ /**
+ * Convenience to create permissions using a raw data matrix containing rows, columns
+ *
+ * @param matrix
+ * is expected to contain the columns PERMISSION_CLASS (String),
+ * PERMISSION_LEVEL (Integer)
+ */
+ public static Permissions createPermissions(Object[][] permissionData) {
+ HashMap<String, BundleClassDescriptor> permissionNameToBundleClassDesc;
+ permissionNameToBundleClassDesc = new HashMap<String, BundleClassDescriptor>();
+ IPermissionService psvc = SERVICES.getService(IPermissionService.class);
+ if (psvc != null) {
+ for (BundleClassDescriptor d : psvc.getAllPermissionClasses()) {
+ permissionNameToBundleClassDesc.put(d.getSimpleClassName(), d);
+ permissionNameToBundleClassDesc.put(d.getClassName(), d);
+ }
+ }
+ //
+ Permissions permSet = new Permissions();
+ for (Object[] permissionRow : permissionData) {
+ String name = "" + permissionRow[0];
+ /*
+ * Legacy migration com.bsiag.scout.shared.security.X ->
+ * org.eclipse.scout.rt.shared.security.X
+ */
+ name = name.replace("com.bsiag.scout.shared.security.", "org.eclipse.scout.rt.shared.security.");
+ int level = TypeCastUtility.castValue(permissionRow[1], Integer.class);
+ try {
+ BundleClassDescriptor desc = permissionNameToBundleClassDesc.get(name);
+ if (desc == null) {
+ LOG.warn("Unknown permission with name: " + permissionRow[0]);
+ continue;
+ }
+ Bundle bundle = Platform.getBundle(desc.getBundleSymbolicName());
+ Class c = bundle.loadClass(desc.getClassName());
+ Permission p = (Permission) c.newInstance();
+ if (p instanceof BasicHierarchyPermission) {
+ ((BasicHierarchyPermission) p).setLevel(level);
+ ((BasicHierarchyPermission) p).setReadOnly();
+ }
+ permSet.add(p);
+ }
+ catch (ClassNotFoundException e) {
+ LOG.warn("Unknown permission with name: " + permissionRow[0]);
+ }
+ catch (InstantiationException e) {
+ LOG.warn("Unable to load user-permission: " + permissionRow[0]);
+ }
+ catch (IllegalAccessException e) {
+ LOG.warn("Unable to access user-permission: " + permissionRow[0]);
+ }
+ }
+ return permSet;
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/security/IAccessControlService.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/security/IAccessControlService.java
index f97d9cb12f..950b02c99c 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/security/IAccessControlService.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/security/IAccessControlService.java
@@ -1,84 +1,84 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.security;
-
-import java.lang.reflect.Method;
-import java.security.Permission;
-import java.security.Permissions;
-
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.rt.shared.security.BasicHierarchyPermission;
-import org.eclipse.scout.rt.shared.servicetunnel.RemoteServiceAccessDenied;
-import org.eclipse.scout.rt.shared.validate.InputValidation;
-import org.eclipse.scout.rt.shared.validate.IValidationStrategy;
-import org.eclipse.scout.service.IService;
-
-/**
- * Access control facility.
- * The default implementation in org.eclipse.scout.rt.shared.services.common.security.AccessControlService has service
- * ranking low (-1)
- * and caches permissions per user principal for maximum performance when using stateless request/response patterns as
- * in webservice environments.
- */
-@Priority(-3)
-@InputValidation(IValidationStrategy.PROCESS.class)
-public interface IAccessControlService extends IService {
-
- String getUserIdOfCurrentSubject();
-
- boolean checkPermission(Permission p);
-
- int getPermissionLevel(Permission p);
-
- /**
- * only use this method to transfer permissions, don't use it for access
- * control or adding permissions see also {@link #checkPermission(Permission)} and
- * {@link #getPermissionLevel(BasicHierarchyPermission)}
- */
- Permissions getPermissions();
-
- /**
- * @return true if this service is a proxy to the real access control service
- * This property is queried by {@link com.bsiag.security.BasicHierarchyPermission} to decide
- * whether fine-grained access control can be calculated right away
- * (no proxy) or must be delegated to the real access control service
- * in the backend
- */
- boolean isProxyService();
-
- /**
- * Clear all caches. This can be useful when some permissions and/or user-role mappings have changed.
- */
- @RemoteServiceAccessDenied
- void clearCache();
-
- /**
- * @deprecated Use {@link #clearCacheOfUserIds(String...)} instead
- */
- @Deprecated
- @RemoteServiceAccessDenied
- void clearCacheOfPrincipals(String... userIds);
-
- /**
- * Clear cache of specified userIds.<br>
- * This can be useful when some permissions and/or user-role mappings have
- * changed.
- * This method is lenient.
- */
- @RemoteServiceAccessDenied
- void clearCacheOfUserIds(String... userIds);
-
- /**
- * @deprecated
- */
- @Deprecated
- boolean checkServiceTunnelAccess(Class serviceInterfaceClass, Method method, Object[] args);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.security;
+
+import java.lang.reflect.Method;
+import java.security.Permission;
+import java.security.Permissions;
+
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.rt.shared.security.BasicHierarchyPermission;
+import org.eclipse.scout.rt.shared.servicetunnel.RemoteServiceAccessDenied;
+import org.eclipse.scout.rt.shared.validate.InputValidation;
+import org.eclipse.scout.rt.shared.validate.IValidationStrategy;
+import org.eclipse.scout.service.IService;
+
+/**
+ * Access control facility.
+ * The default implementation in org.eclipse.scout.rt.shared.services.common.security.AccessControlService has service
+ * ranking low (-1)
+ * and caches permissions per user principal for maximum performance when using stateless request/response patterns as
+ * in webservice environments.
+ */
+@Priority(-3)
+@InputValidation(IValidationStrategy.PROCESS.class)
+public interface IAccessControlService extends IService {
+
+ String getUserIdOfCurrentSubject();
+
+ boolean checkPermission(Permission p);
+
+ int getPermissionLevel(Permission p);
+
+ /**
+ * only use this method to transfer permissions, don't use it for access
+ * control or adding permissions see also {@link #checkPermission(Permission)} and
+ * {@link #getPermissionLevel(BasicHierarchyPermission)}
+ */
+ Permissions getPermissions();
+
+ /**
+ * @return true if this service is a proxy to the real access control service
+ * This property is queried by {@link com.bsiag.security.BasicHierarchyPermission} to decide
+ * whether fine-grained access control can be calculated right away
+ * (no proxy) or must be delegated to the real access control service
+ * in the backend
+ */
+ boolean isProxyService();
+
+ /**
+ * Clear all caches. This can be useful when some permissions and/or user-role mappings have changed.
+ */
+ @RemoteServiceAccessDenied
+ void clearCache();
+
+ /**
+ * @deprecated Use {@link #clearCacheOfUserIds(String...)} instead
+ */
+ @Deprecated
+ @RemoteServiceAccessDenied
+ void clearCacheOfPrincipals(String... userIds);
+
+ /**
+ * Clear cache of specified userIds.<br>
+ * This can be useful when some permissions and/or user-role mappings have
+ * changed.
+ * This method is lenient.
+ */
+ @RemoteServiceAccessDenied
+ void clearCacheOfUserIds(String... userIds);
+
+ /**
+ * @deprecated
+ */
+ @Deprecated
+ boolean checkServiceTunnelAccess(Class serviceInterfaceClass, Method method, Object[] args);
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/security/ILogoutService.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/security/ILogoutService.java
index 8caa078f9c..10e86ab0ca 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/security/ILogoutService.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/security/ILogoutService.java
@@ -1,31 +1,31 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.security;
-
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.rt.shared.validate.InputValidation;
-import org.eclipse.scout.rt.shared.validate.IValidationStrategy;
-import org.eclipse.scout.service.IService;
-
-/**
- * Support service to explicitly close a session and release cached sessions, resources, and credentials
- */
-@Priority(-3)
-@InputValidation(IValidationStrategy.PROCESS.class)
-public interface ILogoutService extends IService {
-
- /**
- * calling this remote service on the server causes the session to be closed and resources to be cleaned, a new
- * session and new login will be needed to continue working
- */
- void logout();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.security;
+
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.rt.shared.validate.InputValidation;
+import org.eclipse.scout.rt.shared.validate.IValidationStrategy;
+import org.eclipse.scout.service.IService;
+
+/**
+ * Support service to explicitly close a session and release cached sessions, resources, and credentials
+ */
+@Priority(-3)
+@InputValidation(IValidationStrategy.PROCESS.class)
+public interface ILogoutService extends IService {
+
+ /**
+ * calling this remote service on the server causes the session to be closed and resources to be cleaned, a new
+ * session and new login will be needed to continue working
+ */
+ void logout();
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/security/IPermissionService.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/security/IPermissionService.java
index b11b89dcd3..c5f7df63d2 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/security/IPermissionService.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/security/IPermissionService.java
@@ -1,29 +1,29 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.security;
-
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.commons.osgi.BundleClassDescriptor;
-import org.eclipse.scout.service.IService;
-
-/**
- * Support service for querying all Permission types available in any Plug-Ins class set.
- */
-@Priority(-3)
-public interface IPermissionService extends IService {
-
- /**
- * @return Returns all permissions of any loaded bundle. The actual strategy to find these permissions is up to the
- * implementation.
- */
- BundleClassDescriptor[] getAllPermissionClasses();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.security;
+
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.commons.osgi.BundleClassDescriptor;
+import org.eclipse.scout.service.IService;
+
+/**
+ * Support service for querying all Permission types available in any Plug-Ins class set.
+ */
+@Priority(-3)
+public interface IPermissionService extends IService {
+
+ /**
+ * @return Returns all permissions of any loaded bundle. The actual strategy to find these permissions is up to the
+ * implementation.
+ */
+ BundleClassDescriptor[] getAllPermissionClasses();
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/security/ResetAccessControlChangedNotification.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/security/ResetAccessControlChangedNotification.java
index 26ee7bf94d..6f407ba34c 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/security/ResetAccessControlChangedNotification.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/security/ResetAccessControlChangedNotification.java
@@ -1,30 +1,30 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.security;
-
-import org.eclipse.scout.rt.shared.services.common.clientnotification.AbstractClientNotification;
-import org.eclipse.scout.rt.shared.services.common.clientnotification.IClientNotification;
-
-/**
- * Notification is sent from server to client to notify that the code type has
- * changed and the client should clear its cache
- */
-public class ResetAccessControlChangedNotification extends AbstractClientNotification {
- private static final long serialVersionUID = 1L;
-
- public ResetAccessControlChangedNotification() {
- }
-
- @Override
- public boolean coalesce(IClientNotification existingNotification) {
- return true;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.security;
+
+import org.eclipse.scout.rt.shared.services.common.clientnotification.AbstractClientNotification;
+import org.eclipse.scout.rt.shared.services.common.clientnotification.IClientNotification;
+
+/**
+ * Notification is sent from server to client to notify that the code type has
+ * changed and the client should clear its cache
+ */
+public class ResetAccessControlChangedNotification extends AbstractClientNotification {
+ private static final long serialVersionUID = 1L;
+
+ public ResetAccessControlChangedNotification() {
+ }
+
+ @Override
+ public boolean coalesce(IClientNotification existingNotification) {
+ return true;
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/session/IJobRunnable.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/session/IJobRunnable.java
index b61b1d9ddf..4fa071729d 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/session/IJobRunnable.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/session/IJobRunnable.java
@@ -1,32 +1,32 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.session;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.jobs.Job;
-
-/**
- * Interface for runnables that are executed within an eclipse {@link Job}.
- *
- * @since 3.8.1
- */
-public interface IJobRunnable {
-
- /**
- * Method executed within a job.
- *
- * @param monitor
- * the progress monitor
- * @return Returns the job's result.
- */
- IStatus run(IProgressMonitor monitor);
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.session;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.jobs.Job;
+
+/**
+ * Interface for runnables that are executed within an eclipse {@link Job}.
+ *
+ * @since 3.8.1
+ */
+public interface IJobRunnable {
+
+ /**
+ * Method executed within a job.
+ *
+ * @param monitor
+ * the progress monitor
+ * @return Returns the job's result.
+ */
+ IStatus run(IProgressMonitor monitor);
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/session/ISessionService.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/session/ISessionService.java
index 67d4d11980..fbdb3847af 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/session/ISessionService.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/session/ISessionService.java
@@ -1,52 +1,52 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.session;
-
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.commons.job.JobEx;
-import org.eclipse.scout.rt.shared.ISession;
-import org.eclipse.scout.service.IService2;
-
-/**
- * @since 3.8.0
- */
-@Priority(-3)
-public interface ISessionService extends IService2 {
-
- /**
- * Returns the session which is assigned to the current client respectively server job.
- * <p>
- * It's recommended to use this service only if you don't have direct access to the session. Rather use
- * ClientJob.getCurrentSession() respectively ServerJob.getCurrentSession().
- * </p>
- */
- ISession getCurrentSession();
-
- /**
- * @see ISessionService#createAsyncJob(String, IJobRunnable)
- * @since 3.8.1
- */
- JobEx createAsyncJob(IJobRunnable runnable);
-
- /**
- * Creates a new asynchronous job that executes the given runnable. The job is attached to the current environment's
- * {@link ISession} and implementors are required to use an appropriate {@link JobEx} extension (i.e. ClientAsyncJob
- * or ServerJob).
- *
- * @param name
- * the job's name or <code>null</code>.
- * @param runnable
- * the runnable to execute within the created job.
- * @return Returns a new {@link JobEx} implementation that executes the given runnable asynchronously.
- * @since 3.8.1
- */
- JobEx createAsyncJob(String name, IJobRunnable runnable);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.session;
+
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.commons.job.JobEx;
+import org.eclipse.scout.rt.shared.ISession;
+import org.eclipse.scout.service.IService2;
+
+/**
+ * @since 3.8.0
+ */
+@Priority(-3)
+public interface ISessionService extends IService2 {
+
+ /**
+ * Returns the session which is assigned to the current client respectively server job.
+ * <p>
+ * It's recommended to use this service only if you don't have direct access to the session. Rather use
+ * ClientJob.getCurrentSession() respectively ServerJob.getCurrentSession().
+ * </p>
+ */
+ ISession getCurrentSession();
+
+ /**
+ * @see ISessionService#createAsyncJob(String, IJobRunnable)
+ * @since 3.8.1
+ */
+ JobEx createAsyncJob(IJobRunnable runnable);
+
+ /**
+ * Creates a new asynchronous job that executes the given runnable. The job is attached to the current environment's
+ * {@link ISession} and implementors are required to use an appropriate {@link JobEx} extension (i.e. ClientAsyncJob
+ * or ServerJob).
+ *
+ * @param name
+ * the job's name or <code>null</code>.
+ * @param runnable
+ * the runnable to execute within the created job.
+ * @return Returns a new {@link JobEx} implementation that executes the given runnable asynchronously.
+ * @since 3.8.1
+ */
+ JobEx createAsyncJob(String name, IJobRunnable runnable);
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/shell/IShellService.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/shell/IShellService.java
index d37ee4cba1..7f033e3550 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/shell/IShellService.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/shell/IShellService.java
@@ -1,34 +1,34 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.shell;
-
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.shared.validate.InputValidation;
-import org.eclipse.scout.rt.shared.validate.IValidationStrategy;
-import org.eclipse.scout.service.IService;
-
-/**
- * Currently known implementations are {@link org.eclipse.scout.rt.shared.win32.x86.service.internal.WindowsService} and
- * {@link org.eclipse.scout.rt.client.services.common.shell.DefaultShellService}
- */
-@Priority(-3)
-@InputValidation(IValidationStrategy.PROCESS.class)
-public interface IShellService extends IService {
-
- /**
- * Open the resource at the specified path with the typical application
- * Examples: open URLs in the browser, word documents in Word, mail addresses
- * in the E-Mail client, etc.
- */
- void shellOpen(String path) throws ProcessingException;
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.shell;
+
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.shared.validate.InputValidation;
+import org.eclipse.scout.rt.shared.validate.IValidationStrategy;
+import org.eclipse.scout.service.IService;
+
+/**
+ * Currently known implementations are {@link org.eclipse.scout.rt.shared.win32.x86.service.internal.WindowsService} and
+ * {@link org.eclipse.scout.rt.client.services.common.shell.DefaultShellService}
+ */
+@Priority(-3)
+@InputValidation(IValidationStrategy.PROCESS.class)
+public interface IShellService extends IService {
+
+ /**
+ * Open the resource at the specified path with the typical application
+ * Examples: open URLs in the browser, word documents in Word, mail addresses
+ * in the E-Mail client, etc.
+ */
+ void shellOpen(String path) throws ProcessingException;
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/test/AbstractTest.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/test/AbstractTest.java
index 0ff9b82c6e..694f1ea4d9 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/test/AbstractTest.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/test/AbstractTest.java
@@ -1,275 +1,275 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.test;
-
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.IProcessingStatus;
-import org.eclipse.scout.service.AbstractService;
-
-/**
- * Abstract test implementation. <br>
- * Implements the abstract methods and add a test status (or even multiple ones)
- * using one of the create..Status(String) methods and {@link #addStatus(TestStatus)} <br>
- * <p>
- * Normally the following methods are implemented in sublcasses <br>
- * {@link #getConfiguredProduct()} <br>
- * {@link #getConfiguredTitle()} default value is the class simple name without suffixes "UnitTest" and "Test" <br>
- * {@link #getConfiguredSubTitle()} default value is null <br>
- * {@link #run()}
- * <p>
- * Normally the following methods are called from within {@link #run()} <br>
- * {@link #addOkStatus(String)} <br>
- * {@link #addWarningStatus(String, Throwable)} <br>
- * {@link #addErrorStatus(String, Throwable)} <br>
- * {@link #addFatalStatus(String, Throwable)}
- * <p>
- * Often also the following methods are called from within {@link #run()} <br>
- * {@link #startTiming()} <br>
- * {@link #stopTiming()}
- * <p>
- * In tests which contain multiple stati also the following methods are normally called to have different test titles
- * per status <br>
- * {@link #setSubTitle(String)} </pre>
- */
-public abstract class AbstractTest extends AbstractService implements ITest {
- private ITestContext m_ctx;
- private String m_product;
- private String m_title;
- private String m_subTitle;
- private long m_startTime = -1;
- private long m_endTime = -1;
-
- public AbstractTest() {
- initConfig();
- }
-
- @Order(10)
- @ConfigProperty(ConfigProperty.STRING)
- @ConfigPropertyValue("null")
- protected String getConfiguredProduct() {
- return null;
- }
-
- @Order(10)
- @ConfigProperty(ConfigProperty.STRING)
- @ConfigPropertyValue("null")
- protected String getConfiguredTitle() {
- return null;
- }
-
- @Order(10)
- @ConfigProperty(ConfigProperty.STRING)
- @ConfigPropertyValue("null")
- protected String getConfiguredSubTitle() {
- return null;
- }
-
- protected void initConfig() {
- setProduct(getConfiguredProduct());
- setTitle(getConfiguredTitle());
- setSubTitle(getConfiguredSubTitle());
- if (getTitle() == null || getTitle().length() == 0) {
- String s = getClass().getSimpleName();
- s = s.replaceAll("UnitTest$", "");
- s = s.replaceAll("Test$", "");
- setTitle(s);
- }
- }
-
- @Override
- public void setTestContext(ITestContext ctx) {
- m_ctx = ctx;
- }
-
- public ITestContext getTestContext() {
- return m_ctx;
- }
-
- protected final void startTiming() {
- m_startTime = System.currentTimeMillis();
- }
-
- /**
- * stop the current timer and return the delta
- *
- * @return {@link #getLastTiming()}
- */
- protected final long stopTiming() {
- m_endTime = System.currentTimeMillis();
- return getLastTiming();
- }
-
- protected final long getLastTiming() {
- if (m_startTime > 0 && m_endTime >= m_startTime) {
- return m_endTime - m_startTime;
- }
- else {
- return -1;
- }
- }
-
- /**
- * @return a new instance of a test status with product, domain, title and
- * duration set based on this test's state and with severity {@value IProcessingStatus#INFO}
- */
- protected TestStatus createStatus() {
- TestStatus s = new TestStatus(getProduct(), getTitle(), getSubTitle());
- return s;
- }
-
- protected final void addOkStatus() {
- addOkStatus(null);
- }
-
- /**
- * Add a new instance of a test status with product, domain, title and
- * duration set based on this test's state and with severity {@value IProcessingStatus#INFO}
- *
- * @param message
- * may be null
- */
- protected final void addOkStatus(String message) {
- TestStatus s = createStatus();
- s.setSeverity(TestStatus.INFO);
- s.setDuration(getLastTiming());
- if (message != null) {
- s.setMessage(message);
- }
- addStatus(s);
- }
-
- protected final void addWarningStatus(String message) {
- addWarningStatus(message, null);
- }
-
- protected final void addWarningStatus(Throwable t) {
- addWarningStatus(null, t);
- }
-
- /**
- * Add a new instance of a test status with product, domain, title and
- * duration set based on this test's state and with severity {@value IProcessingStatus#WARNING}
- *
- * @param message
- * may be null
- * @param t
- * may be null
- */
- protected final void addWarningStatus(String message, Throwable t) {
- TestStatus s = createStatus();
- s.setSeverity(TestStatus.WARNING);
- s.setDuration(getLastTiming());
- if (message != null) {
- s.setMessage(message);
- }
- if (t != null) {
- s.setException(t);
- }
- addStatus(s);
- }
-
- protected final void addErrorStatus(String message) {
- addErrorStatus(message, null);
- }
-
- protected final void addErrorStatus(Throwable t) {
- addErrorStatus(null, t);
- }
-
- /**
- * Add a new instance of a test status with product, domain, title and
- * duration set based on this test's state and with severity {@value IProcessingStatus#ERROR}
- *
- * @param message
- * may be null
- * @param t
- * may be null
- */
- protected final void addErrorStatus(String message, Throwable t) {
- TestStatus s = createStatus();
- s.setSeverity(TestStatus.ERROR);
- s.setDuration(getLastTiming());
- if (message != null) {
- s.setMessage(message);
- }
- if (t != null) {
- s.setException(t);
- }
- addStatus(s);
- }
-
- /**
- * Add a new instance of a test status with product, domain, title and
- * duration set based on this test's state and with severity {@value IProcessingStatus#FATAL}
- *
- * @param message
- * may be null
- * @param t
- * may be null
- */
- protected final void addFatalStatus(String message, Throwable t) {
- TestStatus s = createStatus();
- s.setSeverity(TestStatus.FATAL);
- s.setDuration(getLastTiming());
- if (message != null) {
- s.setMessage(message);
- }
- if (t != null) {
- s.setException(t);
- }
- addStatus(s);
- }
-
- protected final void addStatus(TestStatus status) {
- m_ctx.addStatus(status);
- }
-
- @Override
- public final String getProduct() {
- return m_product;
- }
-
- public final void setProduct(String s) {
- m_product = s;
- }
-
- @Override
- public final String getTitle() {
- return m_title;
- }
-
- public final void setTitle(String s) {
- m_title = s;
- }
-
- @Override
- public final String getSubTitle() {
- return m_subTitle;
- }
-
- public final void setSubTitle(String s) {
- m_subTitle = s;
- }
-
- @Override
- public void setUp() throws Throwable {
- }
-
- @Override
- public abstract void run() throws Throwable;
-
- @Override
- public void tearDown() throws Throwable {
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.test;
+
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.IProcessingStatus;
+import org.eclipse.scout.service.AbstractService;
+
+/**
+ * Abstract test implementation. <br>
+ * Implements the abstract methods and add a test status (or even multiple ones)
+ * using one of the create..Status(String) methods and {@link #addStatus(TestStatus)} <br>
+ * <p>
+ * Normally the following methods are implemented in sublcasses <br>
+ * {@link #getConfiguredProduct()} <br>
+ * {@link #getConfiguredTitle()} default value is the class simple name without suffixes "UnitTest" and "Test" <br>
+ * {@link #getConfiguredSubTitle()} default value is null <br>
+ * {@link #run()}
+ * <p>
+ * Normally the following methods are called from within {@link #run()} <br>
+ * {@link #addOkStatus(String)} <br>
+ * {@link #addWarningStatus(String, Throwable)} <br>
+ * {@link #addErrorStatus(String, Throwable)} <br>
+ * {@link #addFatalStatus(String, Throwable)}
+ * <p>
+ * Often also the following methods are called from within {@link #run()} <br>
+ * {@link #startTiming()} <br>
+ * {@link #stopTiming()}
+ * <p>
+ * In tests which contain multiple stati also the following methods are normally called to have different test titles
+ * per status <br>
+ * {@link #setSubTitle(String)} </pre>
+ */
+public abstract class AbstractTest extends AbstractService implements ITest {
+ private ITestContext m_ctx;
+ private String m_product;
+ private String m_title;
+ private String m_subTitle;
+ private long m_startTime = -1;
+ private long m_endTime = -1;
+
+ public AbstractTest() {
+ initConfig();
+ }
+
+ @Order(10)
+ @ConfigProperty(ConfigProperty.STRING)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredProduct() {
+ return null;
+ }
+
+ @Order(10)
+ @ConfigProperty(ConfigProperty.STRING)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredTitle() {
+ return null;
+ }
+
+ @Order(10)
+ @ConfigProperty(ConfigProperty.STRING)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredSubTitle() {
+ return null;
+ }
+
+ protected void initConfig() {
+ setProduct(getConfiguredProduct());
+ setTitle(getConfiguredTitle());
+ setSubTitle(getConfiguredSubTitle());
+ if (getTitle() == null || getTitle().length() == 0) {
+ String s = getClass().getSimpleName();
+ s = s.replaceAll("UnitTest$", "");
+ s = s.replaceAll("Test$", "");
+ setTitle(s);
+ }
+ }
+
+ @Override
+ public void setTestContext(ITestContext ctx) {
+ m_ctx = ctx;
+ }
+
+ public ITestContext getTestContext() {
+ return m_ctx;
+ }
+
+ protected final void startTiming() {
+ m_startTime = System.currentTimeMillis();
+ }
+
+ /**
+ * stop the current timer and return the delta
+ *
+ * @return {@link #getLastTiming()}
+ */
+ protected final long stopTiming() {
+ m_endTime = System.currentTimeMillis();
+ return getLastTiming();
+ }
+
+ protected final long getLastTiming() {
+ if (m_startTime > 0 && m_endTime >= m_startTime) {
+ return m_endTime - m_startTime;
+ }
+ else {
+ return -1;
+ }
+ }
+
+ /**
+ * @return a new instance of a test status with product, domain, title and
+ * duration set based on this test's state and with severity {@value IProcessingStatus#INFO}
+ */
+ protected TestStatus createStatus() {
+ TestStatus s = new TestStatus(getProduct(), getTitle(), getSubTitle());
+ return s;
+ }
+
+ protected final void addOkStatus() {
+ addOkStatus(null);
+ }
+
+ /**
+ * Add a new instance of a test status with product, domain, title and
+ * duration set based on this test's state and with severity {@value IProcessingStatus#INFO}
+ *
+ * @param message
+ * may be null
+ */
+ protected final void addOkStatus(String message) {
+ TestStatus s = createStatus();
+ s.setSeverity(TestStatus.INFO);
+ s.setDuration(getLastTiming());
+ if (message != null) {
+ s.setMessage(message);
+ }
+ addStatus(s);
+ }
+
+ protected final void addWarningStatus(String message) {
+ addWarningStatus(message, null);
+ }
+
+ protected final void addWarningStatus(Throwable t) {
+ addWarningStatus(null, t);
+ }
+
+ /**
+ * Add a new instance of a test status with product, domain, title and
+ * duration set based on this test's state and with severity {@value IProcessingStatus#WARNING}
+ *
+ * @param message
+ * may be null
+ * @param t
+ * may be null
+ */
+ protected final void addWarningStatus(String message, Throwable t) {
+ TestStatus s = createStatus();
+ s.setSeverity(TestStatus.WARNING);
+ s.setDuration(getLastTiming());
+ if (message != null) {
+ s.setMessage(message);
+ }
+ if (t != null) {
+ s.setException(t);
+ }
+ addStatus(s);
+ }
+
+ protected final void addErrorStatus(String message) {
+ addErrorStatus(message, null);
+ }
+
+ protected final void addErrorStatus(Throwable t) {
+ addErrorStatus(null, t);
+ }
+
+ /**
+ * Add a new instance of a test status with product, domain, title and
+ * duration set based on this test's state and with severity {@value IProcessingStatus#ERROR}
+ *
+ * @param message
+ * may be null
+ * @param t
+ * may be null
+ */
+ protected final void addErrorStatus(String message, Throwable t) {
+ TestStatus s = createStatus();
+ s.setSeverity(TestStatus.ERROR);
+ s.setDuration(getLastTiming());
+ if (message != null) {
+ s.setMessage(message);
+ }
+ if (t != null) {
+ s.setException(t);
+ }
+ addStatus(s);
+ }
+
+ /**
+ * Add a new instance of a test status with product, domain, title and
+ * duration set based on this test's state and with severity {@value IProcessingStatus#FATAL}
+ *
+ * @param message
+ * may be null
+ * @param t
+ * may be null
+ */
+ protected final void addFatalStatus(String message, Throwable t) {
+ TestStatus s = createStatus();
+ s.setSeverity(TestStatus.FATAL);
+ s.setDuration(getLastTiming());
+ if (message != null) {
+ s.setMessage(message);
+ }
+ if (t != null) {
+ s.setException(t);
+ }
+ addStatus(s);
+ }
+
+ protected final void addStatus(TestStatus status) {
+ m_ctx.addStatus(status);
+ }
+
+ @Override
+ public final String getProduct() {
+ return m_product;
+ }
+
+ public final void setProduct(String s) {
+ m_product = s;
+ }
+
+ @Override
+ public final String getTitle() {
+ return m_title;
+ }
+
+ public final void setTitle(String s) {
+ m_title = s;
+ }
+
+ @Override
+ public final String getSubTitle() {
+ return m_subTitle;
+ }
+
+ public final void setSubTitle(String s) {
+ m_subTitle = s;
+ }
+
+ @Override
+ public void setUp() throws Throwable {
+ }
+
+ @Override
+ public abstract void run() throws Throwable;
+
+ @Override
+ public void tearDown() throws Throwable {
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/test/BasicTestContext.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/test/BasicTestContext.java
index 3c7056be9f..abc5b7709f 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/test/BasicTestContext.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/test/BasicTestContext.java
@@ -1,56 +1,56 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.test;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.scout.commons.exception.IProcessingStatus;
-
-public class BasicTestContext implements ITestContext {
- private ArrayList<TestStatus> m_list;
- private int[] m_severityCount;
-
- public BasicTestContext() {
- }
-
- @Override
- public void begin() {
- m_list = new ArrayList<TestStatus>();
- m_severityCount = new int[IProcessingStatus.FATAL + 1];
- }
-
- @Override
- public void end() {
- }
-
- @Override
- public void addStatus(TestStatus s) {
- m_list.add(s);
- m_severityCount[s.getSeverity()]++;
- }
-
- /**
- * @return the life list with all test stati
- */
- @Override
- public List<TestStatus> getStatusList() {
- return m_list;
- }
-
- /**
- * @return the severity count for the severity
- */
- public int getSeverityCount(int severity) {
- return m_severityCount[severity];
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.scout.commons.exception.IProcessingStatus;
+
+public class BasicTestContext implements ITestContext {
+ private ArrayList<TestStatus> m_list;
+ private int[] m_severityCount;
+
+ public BasicTestContext() {
+ }
+
+ @Override
+ public void begin() {
+ m_list = new ArrayList<TestStatus>();
+ m_severityCount = new int[IProcessingStatus.FATAL + 1];
+ }
+
+ @Override
+ public void end() {
+ }
+
+ @Override
+ public void addStatus(TestStatus s) {
+ m_list.add(s);
+ m_severityCount[s.getSeverity()]++;
+ }
+
+ /**
+ * @return the life list with all test stati
+ */
+ @Override
+ public List<TestStatus> getStatusList() {
+ return m_list;
+ }
+
+ /**
+ * @return the severity count for the severity
+ */
+ public int getSeverityCount(int severity) {
+ return m_severityCount[severity];
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/test/HudsonTestContext.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/test/HudsonTestContext.java
index 3c6265580a..b4532424bb 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/test/HudsonTestContext.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/test/HudsonTestContext.java
@@ -1,29 +1,29 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.test;
-
-public class HudsonTestContext extends BasicTestContext {
-
- public HudsonTestContext() {
- }
-
- // XXX create a hudson-readable junit xml result file
- @Override
- public void end() {
- super.end();
- System.out.println("TEST RESULTS");
- for (TestStatus s : getStatusList()) {
- System.out.println(" " + s.getProduct() + "\t" + s.getTitle() + "\t" + s.getSubTitle() + "\t" + TestStatus.getSeverityAsText(s.getSeverity()));
- }
- System.out.format("Summary: %d sucessful tests, %d errors, %d warnings\n", getSeverityCount(TestStatus.INFO), getSeverityCount(TestStatus.WARNING), getSeverityCount(TestStatus.ERROR) + getSeverityCount(TestStatus.FATAL));
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.test;
+
+public class HudsonTestContext extends BasicTestContext {
+
+ public HudsonTestContext() {
+ }
+
+ // XXX create a hudson-readable junit xml result file
+ @Override
+ public void end() {
+ super.end();
+ System.out.println("TEST RESULTS");
+ for (TestStatus s : getStatusList()) {
+ System.out.println(" " + s.getProduct() + "\t" + s.getTitle() + "\t" + s.getSubTitle() + "\t" + TestStatus.getSeverityAsText(s.getSeverity()));
+ }
+ System.out.format("Summary: %d sucessful tests, %d errors, %d warnings\n", getSeverityCount(TestStatus.INFO), getSeverityCount(TestStatus.WARNING), getSeverityCount(TestStatus.ERROR) + getSeverityCount(TestStatus.FATAL));
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/test/ITest.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/test/ITest.java
index 777cedaa58..f5631deff3 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/test/ITest.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/test/ITest.java
@@ -1,55 +1,55 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.test;
-
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.service.IService;
-
-/**
- * <h1>Integration test service</h1> A test gets a test context {@link #setTestContext(ITestContext)} and is
- * launched by calling {@link #run()}
- * <p>
- * Normally a name of a test contains the three parts: product, title, subTitle <br>
- * Examples:
- * <p>
- * <code>BSI CRM . LookupServices . TicketPhaseLookupService.getByTest</code> <br>
- * <code>Marco Polo . ProcessServices . PersonProcess.load</code>
- */
-@Priority(-3)
-public interface ITest extends IService {
-
- String getProduct();
-
- String getTitle();
-
- String getSubTitle();
-
- /**
- * called before the test is run and before {@link #setUp()}
- */
- void setTestContext(ITestContext ctx);
-
- /**
- * called before the test is run
- */
- void setUp() throws Throwable;
-
- /**
- * implement in subclass
- */
- void run() throws Throwable;
-
- /**
- * called after the test was run
- */
- void tearDown() throws Throwable;
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.test;
+
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.service.IService;
+
+/**
+ * <h1>Integration test service</h1> A test gets a test context {@link #setTestContext(ITestContext)} and is
+ * launched by calling {@link #run()}
+ * <p>
+ * Normally a name of a test contains the three parts: product, title, subTitle <br>
+ * Examples:
+ * <p>
+ * <code>BSI CRM . LookupServices . TicketPhaseLookupService.getByTest</code> <br>
+ * <code>Marco Polo . ProcessServices . PersonProcess.load</code>
+ */
+@Priority(-3)
+public interface ITest extends IService {
+
+ String getProduct();
+
+ String getTitle();
+
+ String getSubTitle();
+
+ /**
+ * called before the test is run and before {@link #setUp()}
+ */
+ void setTestContext(ITestContext ctx);
+
+ /**
+ * called before the test is run
+ */
+ void setUp() throws Throwable;
+
+ /**
+ * implement in subclass
+ */
+ void run() throws Throwable;
+
+ /**
+ * called after the test was run
+ */
+ void tearDown() throws Throwable;
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/test/ITestContext.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/test/ITestContext.java
index 01a3cd4f4b..96974f0b32 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/test/ITestContext.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/test/ITestContext.java
@@ -1,40 +1,40 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.test;
-
-import java.util.List;
-
-/**
- * Context used to run a series of tests using {@link TestUtility#runTests(ITestContext, java.util.Collection)}
- */
-public interface ITestContext {
-
- /**
- * Called by the test framework before the first test is running
- */
- void begin();
-
- /**
- * Called by the test framework after the last test was run
- */
- void end();
-
- /**
- * each {@link ITest} can add multiple status to the test context
- */
- void addStatus(TestStatus e);
-
- /**
- * @return the life list with all test status of all {@link ITest}
- */
- List<TestStatus> getStatusList();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.test;
+
+import java.util.List;
+
+/**
+ * Context used to run a series of tests using {@link TestUtility#runTests(ITestContext, java.util.Collection)}
+ */
+public interface ITestContext {
+
+ /**
+ * Called by the test framework before the first test is running
+ */
+ void begin();
+
+ /**
+ * Called by the test framework after the last test was run
+ */
+ void end();
+
+ /**
+ * each {@link ITest} can add multiple status to the test context
+ */
+ void addStatus(TestStatus e);
+
+ /**
+ * @return the life list with all test status of all {@link ITest}
+ */
+ List<TestStatus> getStatusList();
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/test/TestStatus.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/test/TestStatus.java
index e4e0739c5c..0954502d1d 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/test/TestStatus.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/test/TestStatus.java
@@ -1,85 +1,85 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.test;
-
-import org.eclipse.scout.commons.exception.IProcessingStatus;
-import org.eclipse.scout.commons.exception.ProcessingStatus;
-
-/**
- * {@link IProcessingStatus} object with additional properties "product" and
- * "subTitle" and "duration". <br>
- * The property "subTitle" is the test optional sub title. <br>
- * The property "severity" is the test result. <br>
- * The property "message" is the (optional) test result message. <br>
- * <p>
- * see {@link ITest} for details
- */
-public class TestStatus extends ProcessingStatus {
- private static final long serialVersionUID = 1L;
-
- private String m_product;
- private String m_subTitle;
- private long m_duration = -1;
-
- public TestStatus(String product, String title, String subTitle) {
- super("", INFO);
- setProduct(product);
- setTitle(title);
- setSubTitle(subTitle);
- }
-
- public String getProduct() {
- return m_product;
- }
-
- public void setProduct(String s) {
- m_product = s;
- }
-
- public String getSubTitle() {
- return m_subTitle;
- }
-
- public void setSubTitle(String s) {
- m_subTitle = s;
- }
-
- public long getDuration() {
- return m_duration;
- }
-
- public void setDuration(long d) {
- m_duration = d;
- }
-
- @Override
- public void setMessage(String message) {
- super.setMessage(message != null ? message : "");
- }
-
- public static String getSeverityAsText(int severity) {
- if (severity == TestStatus.INFO) {
- return "OK";
- }
- else if (severity == TestStatus.WARNING) {
- return "WARNING";
- }
- else if (severity == TestStatus.ERROR) {
- return "ERROR";
- }
- else if (severity == TestStatus.FATAL) {
- return "FATAL";
- }
- else {
- return "UNKNOWN[" + severity + "]";
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.test;
+
+import org.eclipse.scout.commons.exception.IProcessingStatus;
+import org.eclipse.scout.commons.exception.ProcessingStatus;
+
+/**
+ * {@link IProcessingStatus} object with additional properties "product" and
+ * "subTitle" and "duration". <br>
+ * The property "subTitle" is the test optional sub title. <br>
+ * The property "severity" is the test result. <br>
+ * The property "message" is the (optional) test result message. <br>
+ * <p>
+ * see {@link ITest} for details
+ */
+public class TestStatus extends ProcessingStatus {
+ private static final long serialVersionUID = 1L;
+
+ private String m_product;
+ private String m_subTitle;
+ private long m_duration = -1;
+
+ public TestStatus(String product, String title, String subTitle) {
+ super("", INFO);
+ setProduct(product);
+ setTitle(title);
+ setSubTitle(subTitle);
+ }
+
+ public String getProduct() {
+ return m_product;
+ }
+
+ public void setProduct(String s) {
+ m_product = s;
+ }
+
+ public String getSubTitle() {
+ return m_subTitle;
+ }
+
+ public void setSubTitle(String s) {
+ m_subTitle = s;
+ }
+
+ public long getDuration() {
+ return m_duration;
+ }
+
+ public void setDuration(long d) {
+ m_duration = d;
+ }
+
+ @Override
+ public void setMessage(String message) {
+ super.setMessage(message != null ? message : "");
+ }
+
+ public static String getSeverityAsText(int severity) {
+ if (severity == TestStatus.INFO) {
+ return "OK";
+ }
+ else if (severity == TestStatus.WARNING) {
+ return "WARNING";
+ }
+ else if (severity == TestStatus.ERROR) {
+ return "ERROR";
+ }
+ else if (severity == TestStatus.FATAL) {
+ return "FATAL";
+ }
+ else {
+ return "UNKNOWN[" + severity + "]";
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/test/TestUtility.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/test/TestUtility.java
index a1391aa99f..902d08e36c 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/test/TestUtility.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/test/TestUtility.java
@@ -1,70 +1,70 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.test;
-
-import java.util.Collection;
-
-public final class TestUtility {
- private TestUtility() {
- }
-
- public static void runTests(ITestContext ctx, Collection<ITest> tests) {
- runTests(ctx, tests.toArray(new ITest[tests.size()]));
- }
-
- public static void runTests(ITestContext ctx, ITest[] tests) {
- ctx.begin();
- for (ITest t : tests) {
- try {
- t.setTestContext(ctx);
- try {
- t.setUp();
- try {
- t.run();
- }
- catch (Throwable t2) {
- TestStatus s = new TestStatus(t.getProduct(), t.getTitle(), t.getSubTitle());
- s.setMessage("run failed");
- s.setException(t2);
- s.setSeverity(TestStatus.ERROR);
- ctx.addStatus(s);
- }
- }
- catch (Throwable t1) {
- // setUp failed
- TestStatus s = new TestStatus(t.getProduct(), t.getTitle(), t.getSubTitle());
- s.setMessage("setUp failed");
- s.setSeverity(TestStatus.FATAL);
- s.setException(t1);
- ctx.addStatus(s);
- }
- finally {
- try {
- t.tearDown();
- }
- catch (Throwable t3) {
- // setUp failed
- TestStatus s = new TestStatus(t.getProduct(), t.getTitle(), t.getSubTitle());
- s.setMessage("tearDown failed");
- s.setSeverity(TestStatus.FATAL);
- s.setException(t3);
- ctx.addStatus(s);
- }
- }
- }
- finally {
- t.setTestContext(null);
- }
- }
- ctx.end();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.test;
+
+import java.util.Collection;
+
+public final class TestUtility {
+ private TestUtility() {
+ }
+
+ public static void runTests(ITestContext ctx, Collection<ITest> tests) {
+ runTests(ctx, tests.toArray(new ITest[tests.size()]));
+ }
+
+ public static void runTests(ITestContext ctx, ITest[] tests) {
+ ctx.begin();
+ for (ITest t : tests) {
+ try {
+ t.setTestContext(ctx);
+ try {
+ t.setUp();
+ try {
+ t.run();
+ }
+ catch (Throwable t2) {
+ TestStatus s = new TestStatus(t.getProduct(), t.getTitle(), t.getSubTitle());
+ s.setMessage("run failed");
+ s.setException(t2);
+ s.setSeverity(TestStatus.ERROR);
+ ctx.addStatus(s);
+ }
+ }
+ catch (Throwable t1) {
+ // setUp failed
+ TestStatus s = new TestStatus(t.getProduct(), t.getTitle(), t.getSubTitle());
+ s.setMessage("setUp failed");
+ s.setSeverity(TestStatus.FATAL);
+ s.setException(t1);
+ ctx.addStatus(s);
+ }
+ finally {
+ try {
+ t.tearDown();
+ }
+ catch (Throwable t3) {
+ // setUp failed
+ TestStatus s = new TestStatus(t.getProduct(), t.getTitle(), t.getSubTitle());
+ s.setMessage("tearDown failed");
+ s.setSeverity(TestStatus.FATAL);
+ s.setException(t3);
+ ctx.addStatus(s);
+ }
+ }
+ }
+ finally {
+ t.setTestContext(null);
+ }
+ }
+ ctx.end();
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/text/AbstractDynamicNlsDocumentationTextProviderService.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/text/AbstractDynamicNlsDocumentationTextProviderService.java
index aa2fdb902d..dcfac568f2 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/text/AbstractDynamicNlsDocumentationTextProviderService.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/text/AbstractDynamicNlsDocumentationTextProviderService.java
@@ -1,8 +1,8 @@
-package org.eclipse.scout.rt.shared.services.common.text;
-
-/**
- * Abstract implementation for documentation text provider services.
- */
-public abstract class AbstractDynamicNlsDocumentationTextProviderService extends AbstractDynamicNlsTextProviderService implements IDocumentationTextProviderService {
-
-}
+package org.eclipse.scout.rt.shared.services.common.text;
+
+/**
+ * Abstract implementation for documentation text provider services.
+ */
+public abstract class AbstractDynamicNlsDocumentationTextProviderService extends AbstractDynamicNlsTextProviderService implements IDocumentationTextProviderService {
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/text/AbstractDynamicNlsTextProviderService.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/text/AbstractDynamicNlsTextProviderService.java
index 7339769f0a..6cde3a3904 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/text/AbstractDynamicNlsTextProviderService.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/text/AbstractDynamicNlsTextProviderService.java
@@ -1,53 +1,53 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.text;
-
-import java.util.Locale;
-import java.util.Map;
-
-import org.eclipse.scout.commons.nls.DynamicNls;
-import org.eclipse.scout.service.AbstractService;
-import org.osgi.framework.ServiceRegistration;
-
-public abstract class AbstractDynamicNlsTextProviderService extends AbstractService implements ITextProviderService {
-
- /**
- * Gets the base name where the <code>DynamicNls</code> instance searches for .properties files.<br>
- * Examples:<br>
- * <ul>
- * <li>"resources.texts.Texts": searches in &lt;plugin of your class&gt;/resources/texts/Texts&lt;language
- * suffix&gt;.properties</li>
- * <li>"translations.Docs": searches in &lt;plugin of your class&gt;/translations/Docs&lt;language
- * suffix&gt;.properties</li>
- * </ul>
- *
- * @return A <code>String</code> containing the base name.
- * @see DynamicNls
- */
- protected abstract String getDynamicNlsBaseName();
-
- protected DynamicNls instance = new DynamicNls();
-
- @Override
- public void initializeService(ServiceRegistration registration) {
- instance.registerResourceBundle(getDynamicNlsBaseName(), getClass());
- }
-
- @Override
- public String getText(Locale locale, String key, String... messageArguments) {
- return instance.getText(locale, key, messageArguments);
- }
-
- @Override
- public Map<String, String> getTextMap(Locale locale) {
- return instance.getTextMap(locale);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.text;
+
+import java.util.Locale;
+import java.util.Map;
+
+import org.eclipse.scout.commons.nls.DynamicNls;
+import org.eclipse.scout.service.AbstractService;
+import org.osgi.framework.ServiceRegistration;
+
+public abstract class AbstractDynamicNlsTextProviderService extends AbstractService implements ITextProviderService {
+
+ /**
+ * Gets the base name where the <code>DynamicNls</code> instance searches for .properties files.<br>
+ * Examples:<br>
+ * <ul>
+ * <li>"resources.texts.Texts": searches in &lt;plugin of your class&gt;/resources/texts/Texts&lt;language
+ * suffix&gt;.properties</li>
+ * <li>"translations.Docs": searches in &lt;plugin of your class&gt;/translations/Docs&lt;language
+ * suffix&gt;.properties</li>
+ * </ul>
+ *
+ * @return A <code>String</code> containing the base name.
+ * @see DynamicNls
+ */
+ protected abstract String getDynamicNlsBaseName();
+
+ protected DynamicNls instance = new DynamicNls();
+
+ @Override
+ public void initializeService(ServiceRegistration registration) {
+ instance.registerResourceBundle(getDynamicNlsBaseName(), getClass());
+ }
+
+ @Override
+ public String getText(Locale locale, String key, String... messageArguments) {
+ return instance.getText(locale, key, messageArguments);
+ }
+
+ @Override
+ public Map<String, String> getTextMap(Locale locale) {
+ return instance.getTextMap(locale);
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/text/IDocumentationTextProviderService.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/text/IDocumentationTextProviderService.java
index 7f470c683e..b45fcae604 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/text/IDocumentationTextProviderService.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/text/IDocumentationTextProviderService.java
@@ -1,20 +1,20 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.text;
-
-/**
- * Marker interface for Text provider services that are used in the <code>getConfiguredDoc</code> methods only.
- *
- * @see AbstractForm
- */
-public interface IDocumentationTextProviderService extends ITextProviderService {
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.text;
+
+/**
+ * Marker interface for Text provider services that are used in the <code>getConfiguredDoc</code> methods only.
+ *
+ * @see AbstractForm
+ */
+public interface IDocumentationTextProviderService extends ITextProviderService {
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/text/ITextProviderService.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/text/ITextProviderService.java
index 88a3b1c29b..31e65ed006 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/text/ITextProviderService.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/text/ITextProviderService.java
@@ -1,52 +1,52 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.text;
-
-import java.util.Locale;
-import java.util.Map;
-
-import org.eclipse.scout.service.IService2;
-
-/**
- * Interface for Scout Text Providers.
- */
-public interface ITextProviderService extends IService2 {
- /**
- * Gets the text for the given key and language.<br>
- * if there are parameters in the translation, they are replaced with the given list.
- *
- * @param locale
- * The locale of the text
- * @param key
- * The nls text key
- * @param messageArguments
- * The arguments (can be null) to replace in the returned text.<br>
- * The translation of the text might contain variables like {0},{1},{2},...<br>
- * Examples: <br>
- * <ul>
- * <li>getText("MissingFile1"); with MissingFile1="The File could not be found."</li>
- * <li>getText("MissingFile2", fileName); with MissingFile2="The File {0} could not be found."</li>
- * <li>getText("MissingFile3", fileName, dir); with MissingFile3="The File {0} in Folder {1} could not be
- * found."</li>
- * </ul>
- * @return
- */
- public String getText(Locale locale, String key, String... messageArguments);
-
- /**
- * returns all key/text pairs defined for the given locale.
- *
- * @param locale
- * The locale for which the map should be returned (not all locales might have all keys).
- * @return A <code>java.util.Map</code> containing the key/text pairs.
- */
- public Map<String, String> getTextMap(Locale locale);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.text;
+
+import java.util.Locale;
+import java.util.Map;
+
+import org.eclipse.scout.service.IService2;
+
+/**
+ * Interface for Scout Text Providers.
+ */
+public interface ITextProviderService extends IService2 {
+ /**
+ * Gets the text for the given key and language.<br>
+ * if there are parameters in the translation, they are replaced with the given list.
+ *
+ * @param locale
+ * The locale of the text
+ * @param key
+ * The nls text key
+ * @param messageArguments
+ * The arguments (can be null) to replace in the returned text.<br>
+ * The translation of the text might contain variables like {0},{1},{2},...<br>
+ * Examples: <br>
+ * <ul>
+ * <li>getText("MissingFile1"); with MissingFile1="The File could not be found."</li>
+ * <li>getText("MissingFile2", fileName); with MissingFile2="The File {0} could not be found."</li>
+ * <li>getText("MissingFile3", fileName, dir); with MissingFile3="The File {0} in Folder {1} could not be
+ * found."</li>
+ * </ul>
+ * @return
+ */
+ public String getText(Locale locale, String key, String... messageArguments);
+
+ /**
+ * returns all key/text pairs defined for the given locale.
+ *
+ * @param locale
+ * The locale for which the map should be returned (not all locales might have all keys).
+ * @return A <code>java.util.Map</code> containing the key/text pairs.
+ */
+ public Map<String, String> getTextMap(Locale locale);
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/text/ScoutTextProviderService.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/text/ScoutTextProviderService.java
index 59b435fac2..b085eee886 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/text/ScoutTextProviderService.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/text/ScoutTextProviderService.java
@@ -1,24 +1,24 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.text;
-
-import org.eclipse.scout.commons.annotations.Priority;
-
-/**
- *
- */
-@Priority(-100.0f)
-public class ScoutTextProviderService extends AbstractDynamicNlsTextProviderService {
- @Override
- protected String getDynamicNlsBaseName() {
- return "resources.texts.ScoutTexts";//$NON-NLS-1$
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.text;
+
+import org.eclipse.scout.commons.annotations.Priority;
+
+/**
+ *
+ */
+@Priority(-100.0f)
+public class ScoutTextProviderService extends AbstractDynamicNlsTextProviderService {
+ @Override
+ protected String getDynamicNlsBaseName() {
+ return "resources.texts.ScoutTexts";//$NON-NLS-1$
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/useractivity/IUserActivityProvider.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/useractivity/IUserActivityProvider.java
index 61f681b22f..77c7b9a385 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/useractivity/IUserActivityProvider.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/useractivity/IUserActivityProvider.java
@@ -1,35 +1,35 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.useractivity;
-
-import java.beans.PropertyChangeListener;
-
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.commons.beans.IPropertyObserver;
-import org.eclipse.scout.service.IService;
-
-/**
- * The implementation of this provider is os specific and provided as a fragment
- * or os specific plugin. The implementation is registered as service
- */
-@Priority(-3)
-public interface IUserActivityProvider extends IService, IPropertyObserver {
- /**
- * property name used in {@link PropertyChangeListener}
- */
- String PROP_ACTIVE = "active";
-
- /**
- * @return true if the user is active in any way (mouse, keyboard, other)
- */
- boolean isActive();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.useractivity;
+
+import java.beans.PropertyChangeListener;
+
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.commons.beans.IPropertyObserver;
+import org.eclipse.scout.service.IService;
+
+/**
+ * The implementation of this provider is os specific and provided as a fragment
+ * or os specific plugin. The implementation is registered as service
+ */
+@Priority(-3)
+public interface IUserActivityProvider extends IService, IPropertyObserver {
+ /**
+ * property name used in {@link PropertyChangeListener}
+ */
+ String PROP_ACTIVE = "active";
+
+ /**
+ * @return true if the user is active in any way (mouse, keyboard, other)
+ */
+ boolean isActive();
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/useractivity/IUserActivityStateService.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/useractivity/IUserActivityStateService.java
index c27c577987..a2fe8a81b2 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/useractivity/IUserActivityStateService.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/useractivity/IUserActivityStateService.java
@@ -1,36 +1,36 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.useractivity;
-
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.service.IService;
-
-/**
- * Register this service as a scout server service (as a per-user-session
- * service)
- */
-@Priority(-3)
-public interface IUserActivityStateService extends IService {
- int STATUS_OFFLINE = 1;
- int STATUS_ONLINE = 2;
- int STATUS_IDLE = 3;
-
- /**
- * Change the status of the current user (user session holding this service)
- */
- void setStatus(int status) throws ProcessingException;
-
- /**
- * get the state of all known users
- */
- UserStatusMap getUserStatusMap() throws ProcessingException;
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.useractivity;
+
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.service.IService;
+
+/**
+ * Register this service as a scout server service (as a per-user-session
+ * service)
+ */
+@Priority(-3)
+public interface IUserActivityStateService extends IService {
+ int STATUS_OFFLINE = 1;
+ int STATUS_ONLINE = 2;
+ int STATUS_IDLE = 3;
+
+ /**
+ * Change the status of the current user (user session holding this service)
+ */
+ void setStatus(int status) throws ProcessingException;
+
+ /**
+ * get the state of all known users
+ */
+ UserStatusMap getUserStatusMap() throws ProcessingException;
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/useractivity/UserActivityClientNotification.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/useractivity/UserActivityClientNotification.java
index f7c693806f..ef2d9a0ede 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/useractivity/UserActivityClientNotification.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/useractivity/UserActivityClientNotification.java
@@ -1,34 +1,34 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.useractivity;
-
-import org.eclipse.scout.rt.shared.services.common.clientnotification.AbstractClientNotification;
-import org.eclipse.scout.rt.shared.services.common.clientnotification.IClientNotification;
-
-public class UserActivityClientNotification extends AbstractClientNotification {
-
- private static final long serialVersionUID = 1L;
- private final UserStatusMap m_map;
-
- public UserActivityClientNotification(UserStatusMap map) {
- m_map = map;
- }
-
- @Override
- public boolean coalesce(IClientNotification existingNotification) {
- return existingNotification.getClass() == getClass();
- }
-
- public UserStatusMap getUserStatusMap() {
- return m_map;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.useractivity;
+
+import org.eclipse.scout.rt.shared.services.common.clientnotification.AbstractClientNotification;
+import org.eclipse.scout.rt.shared.services.common.clientnotification.IClientNotification;
+
+public class UserActivityClientNotification extends AbstractClientNotification {
+
+ private static final long serialVersionUID = 1L;
+ private final UserStatusMap m_map;
+
+ public UserActivityClientNotification(UserStatusMap map) {
+ m_map = map;
+ }
+
+ @Override
+ public boolean coalesce(IClientNotification existingNotification) {
+ return existingNotification.getClass() == getClass();
+ }
+
+ public UserStatusMap getUserStatusMap() {
+ return m_map;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/useractivity/UserStatusMap.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/useractivity/UserStatusMap.java
index e2f6ed6dce..103fa03f06 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/useractivity/UserStatusMap.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/useractivity/UserStatusMap.java
@@ -1,38 +1,38 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.useractivity;
-
-import java.io.Serializable;
-import java.util.Map;
-
-public class UserStatusMap implements Serializable {
- private static final long serialVersionUID = 1L;
-
- protected Map<Long, Integer> /* userId, Status */m_users;
-
- public UserStatusMap(Map<Long, Integer> users) {
- m_users = users;
- }
-
- public Map<Long, Integer> getMap() {
- return m_users;
- }
-
- public int getStatus(long userId) {
- int status = IUserActivityStateService.STATUS_OFFLINE;
- Integer s = m_users.get(userId);
- if (s != null) {
- status = s.intValue();
- }
- return status;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.useractivity;
+
+import java.io.Serializable;
+import java.util.Map;
+
+public class UserStatusMap implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ protected Map<Long, Integer> /* userId, Status */m_users;
+
+ public UserStatusMap(Map<Long, Integer> users) {
+ m_users = users;
+ }
+
+ public Map<Long, Integer> getMap() {
+ return m_users;
+ }
+
+ public int getStatus(long userId) {
+ int status = IUserActivityStateService.STATUS_OFFLINE;
+ Integer s = m_users.get(userId);
+ if (s != null) {
+ status = s.intValue();
+ }
+ return status;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/workflow/AbstractWorkflowData.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/workflow/AbstractWorkflowData.java
index 5041f056a5..2404a4d378 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/workflow/AbstractWorkflowData.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/workflow/AbstractWorkflowData.java
@@ -1,344 +1,344 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.workflow;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-
-import org.eclipse.scout.commons.CollectionUtility;
-import org.eclipse.scout.commons.ConfigurationUtility;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-
-/**
- * Data model container for a server side {@link IWorkflowService}. <br>
- * By default all inner types of type {@link AbstractWorkflowStepData} of this
- * class are added as the initial set of workflow state datas.
- */
-public abstract class AbstractWorkflowData implements Serializable {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractWorkflowData.class);
- private static final long serialVersionUID = 1L;
-
- /*
- * The following fields are used by the workflow framework
- */
- private String m_definitionText;
- private boolean m_definitionActive;
- private String m_definitionServiceClass;
- private Date m_finishDate;
- private List<AbstractWorkflowStepData> m_stepList;
- private int m_currentStepIndex;
-
- /*
- * The following fields are not diretcly used by the workflow framework
- */
- private long m_definitionNr;
- private long m_workflowNr;
- private int m_statusUid;
- private Date m_creationDate;
- private long m_creationUserNr;
- private String m_comment;
-
- public AbstractWorkflowData() {
- m_definitionActive = true;
- m_stepList = new ArrayList<AbstractWorkflowStepData>(0);
- m_currentStepIndex = 0;
- initConfig();
- }
-
- private Class<? extends AbstractWorkflowStepData>[] getConfiguredStepDatas() {
- Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
- return ConfigurationUtility.filterClasses(dca, AbstractWorkflowStepData.class);
- }
-
- protected void initConfig() {
- Class<? extends AbstractWorkflowStepData>[] stepArray = getConfiguredStepDatas();
- for (int i = 0; i < stepArray.length; i++) {
- AbstractWorkflowStepData f;
- try {
- f = ConfigurationUtility.newInnerInstance(this, stepArray[i]);
- m_stepList.add(f);
- }// end try
- catch (Exception e) {
- LOG.warn(null, e);
- }
- }// end for
- }
-
- /*
- * definiton
- */
-
- public long getDefinitionNr() {
- return m_definitionNr;
- }
-
- public void setDefinitionNr(long l) {
- m_definitionNr = l;
- }
-
- public String getDefinitionText() {
- return m_definitionText;
- }
-
- public void setDefinitionText(String s) {
- m_definitionText = s;
- }
-
- public boolean isDefinitionActive() {
- return m_definitionActive;
- }
-
- public void setDefinitionActive(boolean b) {
- m_definitionActive = b;
- }
-
- public String getDefinitionServiceClass() {
- return m_definitionServiceClass;
- }
-
- public void setDefinitionServiceClass(String s) {
- m_definitionServiceClass = s;
- }
-
- /*
- * instance
- */
-
- public long getWorkflowNr() {
- return m_workflowNr;
- }
-
- public void setWorkflowNr(long l) {
- m_workflowNr = l;
- }
-
- public Date getCreationDate() {
- return m_creationDate;
- }
-
- public void setCreationDate(Date d) {
- m_creationDate = d;
- }
-
- public long getCreationUserNr() {
- return m_creationUserNr;
- }
-
- public void setCreationUserNr(long l) {
- m_creationUserNr = l;
- }
-
- public int getStatusUid() {
- return m_statusUid;
- }
-
- public void setStatusUid(int l) {
- m_statusUid = l;
- }
-
- public String getComment() {
- return m_comment;
- }
-
- public void setComment(String s) {
- m_comment = s;
- }
-
- public boolean isFinished() {
- return m_finishDate != null;
- }
-
- public Date getFinishDate() {
- return m_finishDate;
- }
-
- public void setFinishDate(Date d) {
- m_finishDate = d;
- }
-
- /**
- * add an additional step data to this data model
- */
- public void addStepData(AbstractWorkflowStepData d) {
- if (d != null) {
- m_stepList.add(d);
- }
- }
-
- public AbstractWorkflowStepData[] getStepDataList() {
- AbstractWorkflowStepData[] copyUnmodifiableList = CollectionUtility.toArray(m_stepList, AbstractWorkflowStepData.class);
- return copyUnmodifiableList;
- }
-
- public void setStepDataList(Collection<AbstractWorkflowStepData> c) {
- if (c != null && c.size() > 0) {
- m_stepList = CollectionUtility.copyList(c);
- }
- else {
- m_stepList.clear();
- }
- }
-
- /**
- * @return first found step data of desired type Note that the data model
- * might contain multiple instances of the same type
- */
- @SuppressWarnings("unchecked")
- public <T extends AbstractWorkflowStepData> T findStepData(Class<T> workflowStepClass) {
- for (AbstractWorkflowStepData step : m_stepList) {
- if (step.getClass().equals(workflowStepClass)) {
- return (T) step;
- }
- }
- return null;
- }
-
- public AbstractWorkflowStepData findStepData(Long stepDefinitionNr) {
- if (stepDefinitionNr == null) {
- return null;
- }
- for (AbstractWorkflowStepData step : m_stepList) {
- if (step.getDefinitionNr() == stepDefinitionNr) {
- return step;
- }
- }
- return null;
- }
-
- public int findStepDataIndex(AbstractWorkflowStepData stepData) {
- if (stepData != null) {
- for (int i = 0; i < m_stepList.size(); i++) {
- if (m_stepList.get(i) == stepData) {
- return i;
- }
- }
- }
- return -1;
- }
-
- public int findStepDataIndex(Long stepDefinitionNr) {
- if (stepDefinitionNr != null) {
- for (int i = 0; i < m_stepList.size(); i++) {
- if (m_stepList.get(i).getDefinitionNr() == stepDefinitionNr) {
- return i;
- }
- }
- }
- return -1;
- }
-
- public int getCurrentStepDataIndex() {
- return m_currentStepIndex;
- }
-
- public void setCurrentStepData(AbstractWorkflowStepData stepData) {
- setCurrentStepDataIndex(findStepDataIndex(stepData));
- }
-
- public void setCurrentStepDataIndex(int index) {
- if (index < 0) {
- index = 0;
- }
- if (index >= m_stepList.size()) {
- index = m_stepList.size();
- }
- m_currentStepIndex = index;
- }
-
- /**
- * advance the step index to the next step in the step list (working steps)
- */
- public void advanceStepDataIndex() {
- m_currentStepIndex++;
- }
-
- /**
- * @return the step at the current step index
- */
- public AbstractWorkflowStepData getCurrentStepData() {
- if (m_currentStepIndex < m_stepList.size()) {
- return m_stepList.get(m_currentStepIndex);
- }
- else {
- return null;
- }
- }
-
- /**
- * @return all steps after the current step index
- */
- public List<AbstractWorkflowStepData> getExpectedFuture() {
- int a = m_currentStepIndex;
- int b = m_stepList.size() - 1;
- if (a <= b && b < m_stepList.size()) {
- return Collections.unmodifiableList(m_stepList.subList(a, b + 1));
- }
- else {
- return Collections.emptyList();
- }
- }
-
- /**
- * @return all steps before the current step index
- */
- public List<AbstractWorkflowStepData> getHistory() {
- int a = 0;
- int b = m_currentStepIndex;
- if (a <= b && b < m_stepList.size()) {
- return Collections.unmodifiableList(m_stepList.subList(a, b + 1));
- }
- else {
- return Collections.emptyList();
- }
- }
-
- public AbstractWorkflowStepData getPreviousStepData() {
- if (m_currentStepIndex - 1 >= 0 && m_currentStepIndex - 1 < m_stepList.size()) {
- return m_stepList.get(m_currentStepIndex - 1);
- }
- else {
- return null;
- }
- }
-
- public AbstractWorkflowStepData getNextStepData() {
- if (m_currentStepIndex + 1 >= 0 && m_currentStepIndex + 1 < m_stepList.size()) {
- return m_stepList.get(m_currentStepIndex + 1);
- }
- else {
- return null;
- }
- }
-
- public AbstractWorkflowStepData getFirstStepData() {
- if (m_stepList.size() > 0) {
- return m_stepList.get(0);
- }
- else {
- return null;
- }
- }
-
- public AbstractWorkflowStepData getLastStepData() {
- if (m_stepList.size() > 0) {
- return m_stepList.get(m_stepList.size() - 1);
- }
- else {
- return null;
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.workflow;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+
+import org.eclipse.scout.commons.CollectionUtility;
+import org.eclipse.scout.commons.ConfigurationUtility;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+
+/**
+ * Data model container for a server side {@link IWorkflowService}. <br>
+ * By default all inner types of type {@link AbstractWorkflowStepData} of this
+ * class are added as the initial set of workflow state datas.
+ */
+public abstract class AbstractWorkflowData implements Serializable {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractWorkflowData.class);
+ private static final long serialVersionUID = 1L;
+
+ /*
+ * The following fields are used by the workflow framework
+ */
+ private String m_definitionText;
+ private boolean m_definitionActive;
+ private String m_definitionServiceClass;
+ private Date m_finishDate;
+ private List<AbstractWorkflowStepData> m_stepList;
+ private int m_currentStepIndex;
+
+ /*
+ * The following fields are not diretcly used by the workflow framework
+ */
+ private long m_definitionNr;
+ private long m_workflowNr;
+ private int m_statusUid;
+ private Date m_creationDate;
+ private long m_creationUserNr;
+ private String m_comment;
+
+ public AbstractWorkflowData() {
+ m_definitionActive = true;
+ m_stepList = new ArrayList<AbstractWorkflowStepData>(0);
+ m_currentStepIndex = 0;
+ initConfig();
+ }
+
+ private Class<? extends AbstractWorkflowStepData>[] getConfiguredStepDatas() {
+ Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
+ return ConfigurationUtility.filterClasses(dca, AbstractWorkflowStepData.class);
+ }
+
+ protected void initConfig() {
+ Class<? extends AbstractWorkflowStepData>[] stepArray = getConfiguredStepDatas();
+ for (int i = 0; i < stepArray.length; i++) {
+ AbstractWorkflowStepData f;
+ try {
+ f = ConfigurationUtility.newInnerInstance(this, stepArray[i]);
+ m_stepList.add(f);
+ }// end try
+ catch (Exception e) {
+ LOG.warn(null, e);
+ }
+ }// end for
+ }
+
+ /*
+ * definiton
+ */
+
+ public long getDefinitionNr() {
+ return m_definitionNr;
+ }
+
+ public void setDefinitionNr(long l) {
+ m_definitionNr = l;
+ }
+
+ public String getDefinitionText() {
+ return m_definitionText;
+ }
+
+ public void setDefinitionText(String s) {
+ m_definitionText = s;
+ }
+
+ public boolean isDefinitionActive() {
+ return m_definitionActive;
+ }
+
+ public void setDefinitionActive(boolean b) {
+ m_definitionActive = b;
+ }
+
+ public String getDefinitionServiceClass() {
+ return m_definitionServiceClass;
+ }
+
+ public void setDefinitionServiceClass(String s) {
+ m_definitionServiceClass = s;
+ }
+
+ /*
+ * instance
+ */
+
+ public long getWorkflowNr() {
+ return m_workflowNr;
+ }
+
+ public void setWorkflowNr(long l) {
+ m_workflowNr = l;
+ }
+
+ public Date getCreationDate() {
+ return m_creationDate;
+ }
+
+ public void setCreationDate(Date d) {
+ m_creationDate = d;
+ }
+
+ public long getCreationUserNr() {
+ return m_creationUserNr;
+ }
+
+ public void setCreationUserNr(long l) {
+ m_creationUserNr = l;
+ }
+
+ public int getStatusUid() {
+ return m_statusUid;
+ }
+
+ public void setStatusUid(int l) {
+ m_statusUid = l;
+ }
+
+ public String getComment() {
+ return m_comment;
+ }
+
+ public void setComment(String s) {
+ m_comment = s;
+ }
+
+ public boolean isFinished() {
+ return m_finishDate != null;
+ }
+
+ public Date getFinishDate() {
+ return m_finishDate;
+ }
+
+ public void setFinishDate(Date d) {
+ m_finishDate = d;
+ }
+
+ /**
+ * add an additional step data to this data model
+ */
+ public void addStepData(AbstractWorkflowStepData d) {
+ if (d != null) {
+ m_stepList.add(d);
+ }
+ }
+
+ public AbstractWorkflowStepData[] getStepDataList() {
+ AbstractWorkflowStepData[] copyUnmodifiableList = CollectionUtility.toArray(m_stepList, AbstractWorkflowStepData.class);
+ return copyUnmodifiableList;
+ }
+
+ public void setStepDataList(Collection<AbstractWorkflowStepData> c) {
+ if (c != null && c.size() > 0) {
+ m_stepList = CollectionUtility.copyList(c);
+ }
+ else {
+ m_stepList.clear();
+ }
+ }
+
+ /**
+ * @return first found step data of desired type Note that the data model
+ * might contain multiple instances of the same type
+ */
+ @SuppressWarnings("unchecked")
+ public <T extends AbstractWorkflowStepData> T findStepData(Class<T> workflowStepClass) {
+ for (AbstractWorkflowStepData step : m_stepList) {
+ if (step.getClass().equals(workflowStepClass)) {
+ return (T) step;
+ }
+ }
+ return null;
+ }
+
+ public AbstractWorkflowStepData findStepData(Long stepDefinitionNr) {
+ if (stepDefinitionNr == null) {
+ return null;
+ }
+ for (AbstractWorkflowStepData step : m_stepList) {
+ if (step.getDefinitionNr() == stepDefinitionNr) {
+ return step;
+ }
+ }
+ return null;
+ }
+
+ public int findStepDataIndex(AbstractWorkflowStepData stepData) {
+ if (stepData != null) {
+ for (int i = 0; i < m_stepList.size(); i++) {
+ if (m_stepList.get(i) == stepData) {
+ return i;
+ }
+ }
+ }
+ return -1;
+ }
+
+ public int findStepDataIndex(Long stepDefinitionNr) {
+ if (stepDefinitionNr != null) {
+ for (int i = 0; i < m_stepList.size(); i++) {
+ if (m_stepList.get(i).getDefinitionNr() == stepDefinitionNr) {
+ return i;
+ }
+ }
+ }
+ return -1;
+ }
+
+ public int getCurrentStepDataIndex() {
+ return m_currentStepIndex;
+ }
+
+ public void setCurrentStepData(AbstractWorkflowStepData stepData) {
+ setCurrentStepDataIndex(findStepDataIndex(stepData));
+ }
+
+ public void setCurrentStepDataIndex(int index) {
+ if (index < 0) {
+ index = 0;
+ }
+ if (index >= m_stepList.size()) {
+ index = m_stepList.size();
+ }
+ m_currentStepIndex = index;
+ }
+
+ /**
+ * advance the step index to the next step in the step list (working steps)
+ */
+ public void advanceStepDataIndex() {
+ m_currentStepIndex++;
+ }
+
+ /**
+ * @return the step at the current step index
+ */
+ public AbstractWorkflowStepData getCurrentStepData() {
+ if (m_currentStepIndex < m_stepList.size()) {
+ return m_stepList.get(m_currentStepIndex);
+ }
+ else {
+ return null;
+ }
+ }
+
+ /**
+ * @return all steps after the current step index
+ */
+ public List<AbstractWorkflowStepData> getExpectedFuture() {
+ int a = m_currentStepIndex;
+ int b = m_stepList.size() - 1;
+ if (a <= b && b < m_stepList.size()) {
+ return Collections.unmodifiableList(m_stepList.subList(a, b + 1));
+ }
+ else {
+ return Collections.emptyList();
+ }
+ }
+
+ /**
+ * @return all steps before the current step index
+ */
+ public List<AbstractWorkflowStepData> getHistory() {
+ int a = 0;
+ int b = m_currentStepIndex;
+ if (a <= b && b < m_stepList.size()) {
+ return Collections.unmodifiableList(m_stepList.subList(a, b + 1));
+ }
+ else {
+ return Collections.emptyList();
+ }
+ }
+
+ public AbstractWorkflowStepData getPreviousStepData() {
+ if (m_currentStepIndex - 1 >= 0 && m_currentStepIndex - 1 < m_stepList.size()) {
+ return m_stepList.get(m_currentStepIndex - 1);
+ }
+ else {
+ return null;
+ }
+ }
+
+ public AbstractWorkflowStepData getNextStepData() {
+ if (m_currentStepIndex + 1 >= 0 && m_currentStepIndex + 1 < m_stepList.size()) {
+ return m_stepList.get(m_currentStepIndex + 1);
+ }
+ else {
+ return null;
+ }
+ }
+
+ public AbstractWorkflowStepData getFirstStepData() {
+ if (m_stepList.size() > 0) {
+ return m_stepList.get(0);
+ }
+ else {
+ return null;
+ }
+ }
+
+ public AbstractWorkflowStepData getLastStepData() {
+ if (m_stepList.size() > 0) {
+ return m_stepList.get(m_stepList.size() - 1);
+ }
+ else {
+ return null;
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/workflow/AbstractWorkflowStepData.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/workflow/AbstractWorkflowStepData.java
index f807216dd9..4482e56aac 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/workflow/AbstractWorkflowStepData.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/workflow/AbstractWorkflowStepData.java
@@ -1,172 +1,172 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.workflow;
-
-import java.io.Serializable;
-import java.util.Collection;
-import java.util.Date;
-import java.util.List;
-
-import org.eclipse.scout.commons.CollectionUtility;
-
-public abstract class AbstractWorkflowStepData implements Serializable {
- private static final long serialVersionUID = 1L;
-
- /*
- * The following fields are used by the workflow framework
- */
- private long m_definitionNr;
- private String m_definitionText;
- private boolean m_definitionActive = true;
-
- private boolean m_suspendPossible;
- private boolean m_cancelPossible;
- private boolean m_finishPossible;
-
- private Date m_completionDate;
- private String m_comment;
-
- /*
- * The following fields are not diretcly used by the workflow framework
- */
- private long m_responsibleUserNr;
- private Date m_startDate;
- private Date m_dueDate;
- private long m_completionUserNr;
-
- private long m_stepNr;
- private List<String> m_documents;
-
- public long getDefinitionNr() {
- return m_definitionNr;
- }
-
- public void setDefinitionNr(long l) {
- m_definitionNr = l;
- }
-
- public String getDefinitionText() {
- return m_definitionText;
- }
-
- public void setDefinitionText(String s) {
- m_definitionText = s;
- }
-
- public boolean isDefinitionActive() {
- return m_definitionActive;
- }
-
- public void setDefinitionActive(boolean b) {
- m_definitionActive = b;
- }
-
- public long getStepNr() {
- return m_stepNr;
- }
-
- public void setStepNr(long l) {
- m_stepNr = l;
- }
-
- public long getResponsibleUserNr() {
- return m_responsibleUserNr;
- }
-
- public void setResponsibleUserNr(long l) {
- m_responsibleUserNr = l;
- }
-
- public Date getStartDate() {
- return m_startDate;
- }
-
- public void setStartDate(Date startDate) {
- m_startDate = startDate;
- }
-
- public Date getDueDate() {
- return m_dueDate;
- }
-
- public void setDueDate(Date d) {
- m_dueDate = d;
- }
-
- /**
- * @return true if the step is completed and the workflow may continue with
- * the next step
- */
- public boolean isCompleted() {
- return m_completionDate != null;
- }
-
- public Date getCompletionDate() {
- return m_completionDate;
- }
-
- public void setCompletionDate(Date d) {
- m_completionDate = d;
- }
-
- public long getCompletionUserNr() {
- return m_completionUserNr;
- }
-
- public void setCompletionUserNr(long l) {
- m_completionUserNr = l;
- }
-
- public String getComment() {
- return m_comment;
- }
-
- public void setComment(String s) {
- m_comment = s;
- }
-
- public void addDocument(String s) {
- m_documents = CollectionUtility.appendList(m_documents, s);
- }
-
- public List<String> getDocuments() {
- return m_documents;
- }
-
- public void setDocuments(Collection<String> d) {
- m_documents = CollectionUtility.copyList(d);
- }
-
- public boolean isSuspendPossible() {
- return m_suspendPossible;
- }
-
- public void setSuspendPossible(boolean b) {
- m_suspendPossible = b;
- }
-
- public boolean isCancelPossible() {
- return m_cancelPossible;
- }
-
- public void setCancelPossible(boolean b) {
- m_cancelPossible = b;
- }
-
- public boolean isFinishPossible() {
- return m_finishPossible;
- }
-
- public void setFinishPossible(boolean b) {
- m_finishPossible = b;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.workflow;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+
+import org.eclipse.scout.commons.CollectionUtility;
+
+public abstract class AbstractWorkflowStepData implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ /*
+ * The following fields are used by the workflow framework
+ */
+ private long m_definitionNr;
+ private String m_definitionText;
+ private boolean m_definitionActive = true;
+
+ private boolean m_suspendPossible;
+ private boolean m_cancelPossible;
+ private boolean m_finishPossible;
+
+ private Date m_completionDate;
+ private String m_comment;
+
+ /*
+ * The following fields are not diretcly used by the workflow framework
+ */
+ private long m_responsibleUserNr;
+ private Date m_startDate;
+ private Date m_dueDate;
+ private long m_completionUserNr;
+
+ private long m_stepNr;
+ private List<String> m_documents;
+
+ public long getDefinitionNr() {
+ return m_definitionNr;
+ }
+
+ public void setDefinitionNr(long l) {
+ m_definitionNr = l;
+ }
+
+ public String getDefinitionText() {
+ return m_definitionText;
+ }
+
+ public void setDefinitionText(String s) {
+ m_definitionText = s;
+ }
+
+ public boolean isDefinitionActive() {
+ return m_definitionActive;
+ }
+
+ public void setDefinitionActive(boolean b) {
+ m_definitionActive = b;
+ }
+
+ public long getStepNr() {
+ return m_stepNr;
+ }
+
+ public void setStepNr(long l) {
+ m_stepNr = l;
+ }
+
+ public long getResponsibleUserNr() {
+ return m_responsibleUserNr;
+ }
+
+ public void setResponsibleUserNr(long l) {
+ m_responsibleUserNr = l;
+ }
+
+ public Date getStartDate() {
+ return m_startDate;
+ }
+
+ public void setStartDate(Date startDate) {
+ m_startDate = startDate;
+ }
+
+ public Date getDueDate() {
+ return m_dueDate;
+ }
+
+ public void setDueDate(Date d) {
+ m_dueDate = d;
+ }
+
+ /**
+ * @return true if the step is completed and the workflow may continue with
+ * the next step
+ */
+ public boolean isCompleted() {
+ return m_completionDate != null;
+ }
+
+ public Date getCompletionDate() {
+ return m_completionDate;
+ }
+
+ public void setCompletionDate(Date d) {
+ m_completionDate = d;
+ }
+
+ public long getCompletionUserNr() {
+ return m_completionUserNr;
+ }
+
+ public void setCompletionUserNr(long l) {
+ m_completionUserNr = l;
+ }
+
+ public String getComment() {
+ return m_comment;
+ }
+
+ public void setComment(String s) {
+ m_comment = s;
+ }
+
+ public void addDocument(String s) {
+ m_documents = CollectionUtility.appendList(m_documents, s);
+ }
+
+ public List<String> getDocuments() {
+ return m_documents;
+ }
+
+ public void setDocuments(Collection<String> d) {
+ m_documents = CollectionUtility.copyList(d);
+ }
+
+ public boolean isSuspendPossible() {
+ return m_suspendPossible;
+ }
+
+ public void setSuspendPossible(boolean b) {
+ m_suspendPossible = b;
+ }
+
+ public boolean isCancelPossible() {
+ return m_cancelPossible;
+ }
+
+ public void setCancelPossible(boolean b) {
+ m_cancelPossible = b;
+ }
+
+ public boolean isFinishPossible() {
+ return m_finishPossible;
+ }
+
+ public void setFinishPossible(boolean b) {
+ m_finishPossible = b;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/workflow/IWorkflowProviderService.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/workflow/IWorkflowProviderService.java
index 39d588980f..1c1499251a 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/workflow/IWorkflowProviderService.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/common/workflow/IWorkflowProviderService.java
@@ -1,96 +1,96 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.common.workflow;
-
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.shared.services.common.jdbc.SearchFilter;
-import org.eclipse.scout.rt.shared.validate.InputValidation;
-import org.eclipse.scout.rt.shared.validate.IValidationStrategy;
-import org.eclipse.scout.service.IService;
-
-/**
- * This is the central handler for workflows and delegates to the appropriate
- * IWorkflowService on the server Clients call a proxy on this interface that
- * delegates to the backend. <br>
- * Servers create subclasses of AbstractWorkflowService, resp. implement
- * IWorkflowService to contribute their workflows
- * <p>
- * This interface is not intended to be implemented by third party
- */
-@Priority(-3)
-@InputValidation(IValidationStrategy.PROCESS.class)
-public interface IWorkflowProviderService extends IService {
-
- /**
- * @param filter
- * Standard sql searchFilter
- * @return specs for all available workflow types that can be used in {@link #create(T)} and {@link #resume(Long)}
- */
- @InputValidation(IValidationStrategy.QUERY.class)
- AbstractWorkflowData[] getAvailableWorkflowTypes(SearchFilter filter) throws ProcessingException;
-
- /**
- * @param filter
- * Standard sql searchFilter
- * @return filtered workflows accessible in the current user session
- */
- @InputValidation(IValidationStrategy.QUERY.class)
- AbstractWorkflowData[] getFilteredWorkflows(SearchFilter filter) throws ProcessingException;
-
- /**
- * Create and start a new workflow based on the specification <br>
- * Normally either {@link T#getDefinitionNr()} is set to identify the workflow
- * type or the data type itself uniquely identifies the workflow type
- *
- * @return new workflow or null in case workflow starts asynchronously
- */
- <T extends AbstractWorkflowData> T create(T spec) throws ProcessingException;
-
- /**
- * Resume an already existing workflow based on the specification <br>
- * At least {@link T#getWorkflowNr()} must be set to identify the existing
- * workflow
- *
- * @return resumed workflow or null in case workflow resumes asynchronously
- */
- <T extends AbstractWorkflowData> T resume(T spec) throws ProcessingException;
-
- /**
- * Make state transition in workflow, that means that the next step is marked
- * as the new current step <br>
- * Detailed: If the current step is not yet completed, it is kept as current
- * step, otherwise the next step is activated
- *
- * @return workflow in new state
- */
- <T extends AbstractWorkflowData> T makeStateTransition(T data) throws ProcessingException;
-
- /**
- * Store the workflow data and all its step datas
- */
- <T extends AbstractWorkflowData> T store(T data) throws ProcessingException;
-
- /**
- * Finish and finalize workflow
- *
- * @return workflow in finished state
- */
- <T extends AbstractWorkflowData> T finish(T data) throws ProcessingException;
-
- /**
- * Discard and finalize workflow
- *
- * @return workflow in discarded state
- */
- <T extends AbstractWorkflowData> T discard(T data) throws ProcessingException;
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.common.workflow;
+
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.shared.services.common.jdbc.SearchFilter;
+import org.eclipse.scout.rt.shared.validate.InputValidation;
+import org.eclipse.scout.rt.shared.validate.IValidationStrategy;
+import org.eclipse.scout.service.IService;
+
+/**
+ * This is the central handler for workflows and delegates to the appropriate
+ * IWorkflowService on the server Clients call a proxy on this interface that
+ * delegates to the backend. <br>
+ * Servers create subclasses of AbstractWorkflowService, resp. implement
+ * IWorkflowService to contribute their workflows
+ * <p>
+ * This interface is not intended to be implemented by third party
+ */
+@Priority(-3)
+@InputValidation(IValidationStrategy.PROCESS.class)
+public interface IWorkflowProviderService extends IService {
+
+ /**
+ * @param filter
+ * Standard sql searchFilter
+ * @return specs for all available workflow types that can be used in {@link #create(T)} and {@link #resume(Long)}
+ */
+ @InputValidation(IValidationStrategy.QUERY.class)
+ AbstractWorkflowData[] getAvailableWorkflowTypes(SearchFilter filter) throws ProcessingException;
+
+ /**
+ * @param filter
+ * Standard sql searchFilter
+ * @return filtered workflows accessible in the current user session
+ */
+ @InputValidation(IValidationStrategy.QUERY.class)
+ AbstractWorkflowData[] getFilteredWorkflows(SearchFilter filter) throws ProcessingException;
+
+ /**
+ * Create and start a new workflow based on the specification <br>
+ * Normally either {@link T#getDefinitionNr()} is set to identify the workflow
+ * type or the data type itself uniquely identifies the workflow type
+ *
+ * @return new workflow or null in case workflow starts asynchronously
+ */
+ <T extends AbstractWorkflowData> T create(T spec) throws ProcessingException;
+
+ /**
+ * Resume an already existing workflow based on the specification <br>
+ * At least {@link T#getWorkflowNr()} must be set to identify the existing
+ * workflow
+ *
+ * @return resumed workflow or null in case workflow resumes asynchronously
+ */
+ <T extends AbstractWorkflowData> T resume(T spec) throws ProcessingException;
+
+ /**
+ * Make state transition in workflow, that means that the next step is marked
+ * as the new current step <br>
+ * Detailed: If the current step is not yet completed, it is kept as current
+ * step, otherwise the next step is activated
+ *
+ * @return workflow in new state
+ */
+ <T extends AbstractWorkflowData> T makeStateTransition(T data) throws ProcessingException;
+
+ /**
+ * Store the workflow data and all its step datas
+ */
+ <T extends AbstractWorkflowData> T store(T data) throws ProcessingException;
+
+ /**
+ * Finish and finalize workflow
+ *
+ * @return workflow in finished state
+ */
+ <T extends AbstractWorkflowData> T finish(T data) throws ProcessingException;
+
+ /**
+ * Discard and finalize workflow
+ *
+ * @return workflow in discarded state
+ */
+ <T extends AbstractWorkflowData> T discard(T data) throws ProcessingException;
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/AbstractCodeTypeLookupCall.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/AbstractCodeTypeLookupCall.java
index 354c4d1f36..c2806b232c 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/AbstractCodeTypeLookupCall.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/AbstractCodeTypeLookupCall.java
@@ -1,65 +1,65 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.lookup;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.shared.services.common.code.CODES;
-import org.eclipse.scout.rt.shared.services.common.code.ICodeType;
-
-public class AbstractCodeTypeLookupCall extends LocalLookupCall {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractCodeTypeLookupCall.class);
- private static final long serialVersionUID = 1L;
-
- private String m_bundlePrefix;
-
- /**
- * @return the bundlePrefix
- */
- public String getBundlePrefix() {
- return m_bundlePrefix;
- }
-
- /**
- * @param bundlePrefix
- * the bundlePrefix to set
- */
- public void setBundlePrefix(String bundlePrefix) {
- m_bundlePrefix = bundlePrefix;
- }
-
- @Override
- protected List<LookupRow> execCreateLookupRows() throws ProcessingException {
- ICodeType[] codeTypes = CODES.getAllCodeTypes(m_bundlePrefix);
- List<LookupRow> result = new ArrayList<LookupRow>();
- for (ICodeType type : codeTypes) {
- result.add(new LookupRow(type.getId(), type.getText()));
- }
-
- return result;
- }
-
- @Override
- public LookupRow[] getDataByKey() throws ProcessingException {
- ICodeType codeType = CODES.findCodeTypeById(getKey());
- if (codeType != null) {
- LookupRow[] result = new LookupRow[1];
- result[0] = new LookupRow(codeType.getId(), codeType.getText());
- return result;
-
- }
- return null;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.lookup;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.shared.services.common.code.CODES;
+import org.eclipse.scout.rt.shared.services.common.code.ICodeType;
+
+public class AbstractCodeTypeLookupCall extends LocalLookupCall {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractCodeTypeLookupCall.class);
+ private static final long serialVersionUID = 1L;
+
+ private String m_bundlePrefix;
+
+ /**
+ * @return the bundlePrefix
+ */
+ public String getBundlePrefix() {
+ return m_bundlePrefix;
+ }
+
+ /**
+ * @param bundlePrefix
+ * the bundlePrefix to set
+ */
+ public void setBundlePrefix(String bundlePrefix) {
+ m_bundlePrefix = bundlePrefix;
+ }
+
+ @Override
+ protected List<LookupRow> execCreateLookupRows() throws ProcessingException {
+ ICodeType[] codeTypes = CODES.getAllCodeTypes(m_bundlePrefix);
+ List<LookupRow> result = new ArrayList<LookupRow>();
+ for (ICodeType type : codeTypes) {
+ result.add(new LookupRow(type.getId(), type.getText()));
+ }
+
+ return result;
+ }
+
+ @Override
+ public LookupRow[] getDataByKey() throws ProcessingException {
+ ICodeType codeType = CODES.findCodeTypeById(getKey());
+ if (codeType != null) {
+ LookupRow[] result = new LookupRow[1];
+ result[0] = new LookupRow(codeType.getId(), codeType.getText());
+ return result;
+
+ }
+ return null;
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/BatchLookupCall.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/BatchLookupCall.java
index 9c8c332539..76b892ff71 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/BatchLookupCall.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/BatchLookupCall.java
@@ -1,41 +1,41 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.lookup;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Arrays;
-
-public class BatchLookupCall implements Serializable {
- private static final long serialVersionUID = 0L;
-
- private ArrayList<LookupCall> m_calls;
-
- public BatchLookupCall() {
- m_calls = new ArrayList<LookupCall>();
- }
-
- public BatchLookupCall(LookupCall[] calls) {
- m_calls = new ArrayList<LookupCall>(Arrays.asList(calls));
- }
-
- public void addLookupCall(LookupCall call) {
- m_calls.add(call);
- }
-
- public boolean isEmpty() {
- return m_calls.isEmpty();
- }
-
- public LookupCall[] getCallBatch() {
- return m_calls.toArray(new LookupCall[m_calls.size()]);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.lookup;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Arrays;
+
+public class BatchLookupCall implements Serializable {
+ private static final long serialVersionUID = 0L;
+
+ private ArrayList<LookupCall> m_calls;
+
+ public BatchLookupCall() {
+ m_calls = new ArrayList<LookupCall>();
+ }
+
+ public BatchLookupCall(LookupCall[] calls) {
+ m_calls = new ArrayList<LookupCall>(Arrays.asList(calls));
+ }
+
+ public void addLookupCall(LookupCall call) {
+ m_calls.add(call);
+ }
+
+ public boolean isEmpty() {
+ return m_calls.isEmpty();
+ }
+
+ public LookupCall[] getCallBatch() {
+ return m_calls.toArray(new LookupCall[m_calls.size()]);
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/BatchLookupNormalizer.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/BatchLookupNormalizer.java
index e8467d4e37..95838f9e0c 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/BatchLookupNormalizer.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/BatchLookupNormalizer.java
@@ -1,110 +1,110 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.lookup;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-
-/**
- * Normalize batch lookup calls.
- * see {@link #normalize(LookupCall[])}
- * <p>
- * Instances of this type are intended to be used on one-time per-call basis.
- * <p>
- * Typical code is
- *
- * <pre>
- * LookupCall[] callArray=...;
- * BatchLookupNormalizer normalizer=new BatchLookupNormalizer();
- * LookupCall[] normArray=normalizer.normalizeCalls(callArray);
- * LookupRow[][] normResultArray=SERVICES.getService(IBatchLookupService.class).getBatchByKey(normArray);
- * LookupRow[][] resultArray=normalizer.denormalizeResults(normResultArray);
- * </pre>
- */
-public class BatchLookupNormalizer {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(BatchLookupNormalizer.class);
-
- private int m_originalLength;
- private int[] m_forwardMapping;
- private LookupCall[] m_normalizedCalls;
-
- public BatchLookupNormalizer() {
- }
-
- /**
- * When two {@link LookupCall}s are {@link Object#equals(Object)} then the first one iq used, subsequent ones
- * reference the first ones directly.
- *
- * @return the reduced array only containing distinct calls with respect to {@link LookupCall#equals(Object)}
- */
- public LookupCall[] normalizeCalls(LookupCall[] calls) throws ProcessingException {
- m_originalLength = 0;
- m_forwardMapping = null;
- m_normalizedCalls = null;
- if (calls == null || calls.length == 0) {
- return new LookupCall[0];
- }
- m_originalLength = calls.length;
- m_forwardMapping = new int[m_originalLength];
- HashMap<LookupCall, Integer> normMap = new HashMap<LookupCall, Integer>();
- ArrayList<LookupCall> normList = new ArrayList<LookupCall>(m_originalLength / 2);
- int normIndex = 0;
- for (int i = 0; i < m_originalLength; i++) {
- LookupCall call = calls[i];
- if (call == null) {
- m_forwardMapping[i] = -1;
- continue;
- }
- if (!BatchLookupResultCache.isCacheable(call.getClass())) {
- m_forwardMapping[i] = normIndex;
- normList.add(call);
- normIndex++;
- continue;
- }
- Integer existingIndex = normMap.get(call);
- if (existingIndex != null) {
- m_forwardMapping[i] = existingIndex.intValue();
- continue;
- }
- m_forwardMapping[i] = normIndex;
- normList.add(call);
- normMap.put(call, normIndex);
- normIndex++;
- }
- normMap = null;//gc
- m_normalizedCalls = normList.toArray(new LookupCall[normList.size()]);
- return m_normalizedCalls;
- }
-
- /**
- * @return the results for the original array containing direct references to the shared results.
- */
- public LookupRow[][] denormalizeResults(LookupRow[][] normalizedResults) throws ProcessingException {
- if (m_originalLength == 0 || normalizedResults == null) {
- return new LookupRow[0][];
- }
- if (normalizedResults.length != m_normalizedCalls.length) {
- throw new IllegalArgumentException("normalized result array must have length " + m_normalizedCalls.length + " (" + normalizedResults.length + ")");
- }
- LookupRow[][] result = new LookupRow[m_originalLength][];
- for (int i = 0; i < m_originalLength; i++) {
- int mapIndex = m_forwardMapping[i];
- if (mapIndex >= 0) {
- result[i] = normalizedResults[mapIndex];
- }
- }
- return result;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.lookup;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+
+/**
+ * Normalize batch lookup calls.
+ * see {@link #normalize(LookupCall[])}
+ * <p>
+ * Instances of this type are intended to be used on one-time per-call basis.
+ * <p>
+ * Typical code is
+ *
+ * <pre>
+ * LookupCall[] callArray=...;
+ * BatchLookupNormalizer normalizer=new BatchLookupNormalizer();
+ * LookupCall[] normArray=normalizer.normalizeCalls(callArray);
+ * LookupRow[][] normResultArray=SERVICES.getService(IBatchLookupService.class).getBatchByKey(normArray);
+ * LookupRow[][] resultArray=normalizer.denormalizeResults(normResultArray);
+ * </pre>
+ */
+public class BatchLookupNormalizer {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(BatchLookupNormalizer.class);
+
+ private int m_originalLength;
+ private int[] m_forwardMapping;
+ private LookupCall[] m_normalizedCalls;
+
+ public BatchLookupNormalizer() {
+ }
+
+ /**
+ * When two {@link LookupCall}s are {@link Object#equals(Object)} then the first one iq used, subsequent ones
+ * reference the first ones directly.
+ *
+ * @return the reduced array only containing distinct calls with respect to {@link LookupCall#equals(Object)}
+ */
+ public LookupCall[] normalizeCalls(LookupCall[] calls) throws ProcessingException {
+ m_originalLength = 0;
+ m_forwardMapping = null;
+ m_normalizedCalls = null;
+ if (calls == null || calls.length == 0) {
+ return new LookupCall[0];
+ }
+ m_originalLength = calls.length;
+ m_forwardMapping = new int[m_originalLength];
+ HashMap<LookupCall, Integer> normMap = new HashMap<LookupCall, Integer>();
+ ArrayList<LookupCall> normList = new ArrayList<LookupCall>(m_originalLength / 2);
+ int normIndex = 0;
+ for (int i = 0; i < m_originalLength; i++) {
+ LookupCall call = calls[i];
+ if (call == null) {
+ m_forwardMapping[i] = -1;
+ continue;
+ }
+ if (!BatchLookupResultCache.isCacheable(call.getClass())) {
+ m_forwardMapping[i] = normIndex;
+ normList.add(call);
+ normIndex++;
+ continue;
+ }
+ Integer existingIndex = normMap.get(call);
+ if (existingIndex != null) {
+ m_forwardMapping[i] = existingIndex.intValue();
+ continue;
+ }
+ m_forwardMapping[i] = normIndex;
+ normList.add(call);
+ normMap.put(call, normIndex);
+ normIndex++;
+ }
+ normMap = null;//gc
+ m_normalizedCalls = normList.toArray(new LookupCall[normList.size()]);
+ return m_normalizedCalls;
+ }
+
+ /**
+ * @return the results for the original array containing direct references to the shared results.
+ */
+ public LookupRow[][] denormalizeResults(LookupRow[][] normalizedResults) throws ProcessingException {
+ if (m_originalLength == 0 || normalizedResults == null) {
+ return new LookupRow[0][];
+ }
+ if (normalizedResults.length != m_normalizedCalls.length) {
+ throw new IllegalArgumentException("normalized result array must have length " + m_normalizedCalls.length + " (" + normalizedResults.length + ")");
+ }
+ LookupRow[][] result = new LookupRow[m_originalLength][];
+ for (int i = 0; i < m_originalLength; i++) {
+ int mapIndex = m_forwardMapping[i];
+ if (mapIndex >= 0) {
+ result[i] = normalizedResults[mapIndex];
+ }
+ }
+ return result;
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/BatchLookupResultCache.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/BatchLookupResultCache.java
index 00d01a01e9..5b1ff4cfa1 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/BatchLookupResultCache.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/BatchLookupResultCache.java
@@ -1,170 +1,170 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.lookup;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-import java.util.HashMap;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-
-/**
- * Cache used to optimize performance on {@link BatchLookupCall}s with {@link IBatchLookupService}.
- * <p>
- * Cache should only be used per operation, do not use it as a class member.
- */
-public class BatchLookupResultCache {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(BatchLookupResultCache.class);
- private static final Object globalCacheableLock = new Object();
- private static final HashMap<Class<? extends LookupCall>, Boolean> globalCacheable = new HashMap<Class<? extends LookupCall>, Boolean>();
-
- private HashMap<LookupCall, LookupRow[]> m_cache = new HashMap<LookupCall, LookupRow[]>();
-
- public BatchLookupResultCache() {
- }
-
- /**
- * reset the result cache
- */
- public void reset() {
- m_cache.clear();
- }
-
- /**
- * @return the same as {@link LookupCall#getDataByKey()} but use the cache to lookup already fetched results
- */
- public LookupRow[] getDataByKey(LookupCall call) throws ProcessingException {
- if (call == null || call.getKey() == null) {
- return LookupRow.EMPTY_ARRAY;
- }
- LookupRow[] result = getCachedResult(call);
- if (result == null) {
- result = call.getDataByKey();
- putCachedResult(call, result);
- }
- return result;
- }
-
- /**
- * @return the same as {@link LookupCall#getDataByText()} but use the cache to lookup already fetched results
- */
- public LookupRow[] getDataByText(LookupCall call) throws ProcessingException {
- LookupRow[] result = getCachedResult(call);
- if (result == null) {
- result = call.getDataByText();
- putCachedResult(call, result);
- }
- return result;
- }
-
- /**
- * @return the same as {@link LookupCall#getDataByAll()} but use the cache to lookup already fetched results
- */
- public LookupRow[] getDataByAll(LookupCall call) throws ProcessingException {
- LookupRow[] result = getCachedResult(call);
- if (result == null) {
- result = call.getDataByAll();
- putCachedResult(call, result);
- }
- return result;
- }
-
- /**
- * @return the same as {@link LookupCall#getDataByRec()} but use the cache to lookup already fetched results
- */
- public LookupRow[] getDataByRec(LookupCall call) throws ProcessingException {
- LookupRow[] result = getCachedResult(call);
- if (result == null) {
- result = call.getDataByRec();
- putCachedResult(call, result);
- }
- return result;
- }
-
- /**
- * @return a previous result based on {@link LookupCall#equals(Object)}
- */
- public LookupRow[] getCachedResult(LookupCall call) {
- if (call == null || !isCacheable(call.getClass())) {
- return null;
- }
- return m_cache.get(call);
- }
-
- /**
- * put a result and associate it with {@link LookupCall#equals(Object)}
- */
- public void putCachedResult(LookupCall call, LookupRow[] result) {
- if (call == null || result == null || !isCacheable(call.getClass())) {
- return;
- }
- m_cache.put(call, result);
- }
-
- /**
- * checks if the {@link LookupCall} class overrides the equals method and remembers the decision
- */
- public static boolean isCacheable(Class<? extends LookupCall> clazz) {
- if (clazz == null) {
- return false;
- }
- synchronized (globalCacheableLock) {
- Boolean b = globalCacheable.get(clazz);
- if (b == null) {
- b = verifyLookupCallBeanQuality(clazz);
- globalCacheable.put(clazz, b);
- }
- return b.booleanValue();
- }
- }
-
- /**
- * In order to use caching of results on local lookup calls, it is crucial that the javabean concepts are valid,
- * especially hashCode and equals.
- * <p>
- * Scout tries to help developers to find problems related to this issue and write a warning in development mode on
- * all local lookup call subclasses that do not overwrite hashCode and equals and contain additional members.
- */
- private static boolean verifyLookupCallBeanQuality(Class<? extends LookupCall> clazz) {
- if (clazz == LocalLookupCall.class) {
- return true;
- }
- if (clazz == LookupCall.class) {
- return true;
- }
- Class<?> t = clazz;
- while (t != null && t != LookupCall.class) {
- //check for fields
- for (Field f : t.getDeclaredFields()) {
- if (f.isSynthetic() || f.isEnumConstant()) {
- continue;
- }
- if ((f.getModifiers() & (Modifier.STATIC)) != 0) {
- continue;
- }
- try {
- t.getDeclaredMethod("equals", Object.class);
- //found
- }
- catch (Throwable ex) {
- //not found
- LOG.warn("" + clazz + " subclasses LookupCall with an additional member field '" + t.getSimpleName() + "." + f.getName() + "' and should therefore override the 'boolean equals(Object obj)' and 'int hashCode()' methods");
- return false;
- }
- }
- t = t.getSuperclass();
- }
- return true;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.lookup;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.util.HashMap;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+
+/**
+ * Cache used to optimize performance on {@link BatchLookupCall}s with {@link IBatchLookupService}.
+ * <p>
+ * Cache should only be used per operation, do not use it as a class member.
+ */
+public class BatchLookupResultCache {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(BatchLookupResultCache.class);
+ private static final Object globalCacheableLock = new Object();
+ private static final HashMap<Class<? extends LookupCall>, Boolean> globalCacheable = new HashMap<Class<? extends LookupCall>, Boolean>();
+
+ private HashMap<LookupCall, LookupRow[]> m_cache = new HashMap<LookupCall, LookupRow[]>();
+
+ public BatchLookupResultCache() {
+ }
+
+ /**
+ * reset the result cache
+ */
+ public void reset() {
+ m_cache.clear();
+ }
+
+ /**
+ * @return the same as {@link LookupCall#getDataByKey()} but use the cache to lookup already fetched results
+ */
+ public LookupRow[] getDataByKey(LookupCall call) throws ProcessingException {
+ if (call == null || call.getKey() == null) {
+ return LookupRow.EMPTY_ARRAY;
+ }
+ LookupRow[] result = getCachedResult(call);
+ if (result == null) {
+ result = call.getDataByKey();
+ putCachedResult(call, result);
+ }
+ return result;
+ }
+
+ /**
+ * @return the same as {@link LookupCall#getDataByText()} but use the cache to lookup already fetched results
+ */
+ public LookupRow[] getDataByText(LookupCall call) throws ProcessingException {
+ LookupRow[] result = getCachedResult(call);
+ if (result == null) {
+ result = call.getDataByText();
+ putCachedResult(call, result);
+ }
+ return result;
+ }
+
+ /**
+ * @return the same as {@link LookupCall#getDataByAll()} but use the cache to lookup already fetched results
+ */
+ public LookupRow[] getDataByAll(LookupCall call) throws ProcessingException {
+ LookupRow[] result = getCachedResult(call);
+ if (result == null) {
+ result = call.getDataByAll();
+ putCachedResult(call, result);
+ }
+ return result;
+ }
+
+ /**
+ * @return the same as {@link LookupCall#getDataByRec()} but use the cache to lookup already fetched results
+ */
+ public LookupRow[] getDataByRec(LookupCall call) throws ProcessingException {
+ LookupRow[] result = getCachedResult(call);
+ if (result == null) {
+ result = call.getDataByRec();
+ putCachedResult(call, result);
+ }
+ return result;
+ }
+
+ /**
+ * @return a previous result based on {@link LookupCall#equals(Object)}
+ */
+ public LookupRow[] getCachedResult(LookupCall call) {
+ if (call == null || !isCacheable(call.getClass())) {
+ return null;
+ }
+ return m_cache.get(call);
+ }
+
+ /**
+ * put a result and associate it with {@link LookupCall#equals(Object)}
+ */
+ public void putCachedResult(LookupCall call, LookupRow[] result) {
+ if (call == null || result == null || !isCacheable(call.getClass())) {
+ return;
+ }
+ m_cache.put(call, result);
+ }
+
+ /**
+ * checks if the {@link LookupCall} class overrides the equals method and remembers the decision
+ */
+ public static boolean isCacheable(Class<? extends LookupCall> clazz) {
+ if (clazz == null) {
+ return false;
+ }
+ synchronized (globalCacheableLock) {
+ Boolean b = globalCacheable.get(clazz);
+ if (b == null) {
+ b = verifyLookupCallBeanQuality(clazz);
+ globalCacheable.put(clazz, b);
+ }
+ return b.booleanValue();
+ }
+ }
+
+ /**
+ * In order to use caching of results on local lookup calls, it is crucial that the javabean concepts are valid,
+ * especially hashCode and equals.
+ * <p>
+ * Scout tries to help developers to find problems related to this issue and write a warning in development mode on
+ * all local lookup call subclasses that do not overwrite hashCode and equals and contain additional members.
+ */
+ private static boolean verifyLookupCallBeanQuality(Class<? extends LookupCall> clazz) {
+ if (clazz == LocalLookupCall.class) {
+ return true;
+ }
+ if (clazz == LookupCall.class) {
+ return true;
+ }
+ Class<?> t = clazz;
+ while (t != null && t != LookupCall.class) {
+ //check for fields
+ for (Field f : t.getDeclaredFields()) {
+ if (f.isSynthetic() || f.isEnumConstant()) {
+ continue;
+ }
+ if ((f.getModifiers() & (Modifier.STATIC)) != 0) {
+ continue;
+ }
+ try {
+ t.getDeclaredMethod("equals", Object.class);
+ //found
+ }
+ catch (Throwable ex) {
+ //not found
+ LOG.warn("" + clazz + " subclasses LookupCall with an additional member field '" + t.getSimpleName() + "." + f.getName() + "' and should therefore override the 'boolean equals(Object obj)' and 'int hashCode()' methods");
+ return false;
+ }
+ }
+ t = t.getSuperclass();
+ }
+ return true;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/CodeLookupCall.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/CodeLookupCall.java
index 3024917e39..4e291315fe 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/CodeLookupCall.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/CodeLookupCall.java
@@ -1,308 +1,308 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.lookup;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-import java.util.regex.Pattern;
-
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.shared.services.common.code.CODES;
-import org.eclipse.scout.rt.shared.services.common.code.ICode;
-import org.eclipse.scout.rt.shared.services.common.code.ICodeType;
-import org.eclipse.scout.rt.shared.services.common.code.ICodeVisitor;
-import org.eclipse.scout.service.SERVICES;
-
-/**
- * @see LookupCall
- */
-public class CodeLookupCall extends LocalLookupCall implements Serializable {
- private static final long serialVersionUID = 0L;
-
- /**
- * Helper method to create a lookup call from a codetype using the {@link ICodeLookupCallFactoryService}.
- */
- public static CodeLookupCall newInstanceByService(Class<? extends ICodeType> codeTypeClass) {
- return SERVICES.getService(ICodeLookupCallFactoryService.class).newInstance(codeTypeClass);
- }
-
- private Class<? extends ICodeType> m_codeTypeClass;
- private ICodeLookupCallVisitor m_filter;
- private Comparator<LookupRow> m_sortComparator;
-
- public CodeLookupCall(Class<? extends ICodeType> codeTypeClass) {
- m_codeTypeClass = codeTypeClass;
- }
-
- public Comparator<LookupRow> getSortComparator() {
- return m_sortComparator;
- }
-
- public void setSortComparator(Comparator<LookupRow> comp) {
- m_sortComparator = comp;
- }
-
- @Override
- public int hashCode() {
- return super.hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (!super.equals(obj)) {
- return false;
- }
- CodeLookupCall other = (CodeLookupCall) obj;
- if (this.m_codeTypeClass != other.m_codeTypeClass) {
- return false;
- }
- if (this.m_filter != other.m_filter) {
- return false;
- }
- return true;
- }
-
- public Class<? extends ICodeType> getCodeTypeClass() {
- return m_codeTypeClass;
- }
-
- public void setFilter(ICodeLookupCallVisitor filter) {
- m_filter = filter;
- }
-
- public ICodeLookupCallVisitor getFilter() {
- return m_filter;
- }
-
- /**
- * Implementation that creates lookup rows from codes.
- * <p>
- * By default calls {@link #execCreateLookupRowFromCode(ICode)}
- */
- protected LookupRow[] execCreateLookupRowsFromCodes(List<? extends ICode<?>> codes) {
- LookupRow[] a = new LookupRow[codes.size()];
- for (int i = 0; i < a.length; i++) {
- a[i] = execCreateLookupRowFromCode(codes.get(i));
- }
- return a;
- }
-
- /**
- * Implementation that creates lookup rows from codes.
- * <p>
- * By default calls {@link #createLookupRow(ICode)}
- */
- protected LookupRow execCreateLookupRowFromCode(ICode<?> code) {
- return createLookupRow(code);
- }
-
- /**
- * Default implementation to create lookup rows from codes.
- * <p>
- * Called by {@link #execCreateLookupRowsFromCodes(List)}.
- */
- public static LookupRow[] createLookupRowArray(List<? extends ICode> codes) {
- LookupRow[] a = new LookupRow[codes.size()];
- for (int i = 0; i < a.length; i++) {
- a[i] = createLookupRow(codes.get(i));
- }
- return a;
- }
-
- /**
- * Default implementation to create a lookup row from a code.
- * <p>
- * Called by {@link #createLookupRowArray(List)}.
- */
- public static LookupRow createLookupRow(ICode<?> c) {
- Object parentId = null;
- if (c.getParentCode() != null) {
- parentId = c.getParentCode().getId();
- }
- return new LookupRow(c.getId(), c.getText(), c.getIconId(), c.getTooltipText(), c.getBackgroundColor(), c.getForegroundColor(), c.getFont(), c.isEnabled(), parentId, c.isActive());
- }
-
- public static Pattern getSearchPattern(String s) {
- if (s == null) {
- s = "";
- }
- s = s.toLowerCase();
- if (!s.endsWith("*")) {
- s = s + "*";
- }
- return Pattern.compile(StringUtility.toRegExPattern(s), Pattern.DOTALL);
- }
-
- /**
- * Complete override using code data
- */
- @Override
- public LookupRow[] getDataByKey() throws ProcessingException {
- ArrayList<ICode<?>> list = new ArrayList<ICode<?>>(1);
- ICode c = resolveCodeByKey();
- if (c != null) {
- list.add(c);
- }
- return execCreateLookupRowsFromCodes(list);
- }
-
- /**
- * Complete override using code data
- */
- @Override
- public LookupRow[] getDataByText() throws ProcessingException {
- final Pattern pat = getSearchPattern(getText());
- AbstractLookupRowCollector v = new AbstractLookupRowCollector() {
- @Override
- public boolean visit(ICode code, int treeLevel) {
- if (m_filter != null && !m_filter.visit(CodeLookupCall.this, code, treeLevel)) {
- return true;
- }
- if (getActive().isUndefined() || getActive().getBooleanValue() == code.isActive()) {
- LookupRow row = execCreateLookupRowFromCode(code);
- if (row != null && row.getText() != null && pat.matcher(row.getText().toLowerCase()).matches()) {
- add(row);
- }
- }
- return true;
- }
- };
- resolveCodes(v);
- List<LookupRow> result = v.getLookupRows();
- if (result.size() > 1) {
- Comparator<LookupRow> comparator = getSortComparator();
- if (comparator != null) {
- Collections.sort(result, comparator);
- }
- }
- return result.toArray(new LookupRow[result.size()]);
- }
-
- /**
- * Complete override using code data
- */
- @Override
- public LookupRow[] getDataByAll() throws ProcessingException {
- final Pattern pat = getSearchPattern(getAll());
- AbstractLookupRowCollector v = new AbstractLookupRowCollector() {
- @Override
- public boolean visit(ICode code, int treeLevel) {
- if (m_filter != null && !m_filter.visit(CodeLookupCall.this, code, treeLevel)) {
- return true;
- }
- if (getActive().isUndefined() || getActive().getBooleanValue() == code.isActive()) {
- LookupRow row = execCreateLookupRowFromCode(code);
- if (row != null && row.getText() != null && pat.matcher(row.getText().toLowerCase()).matches()) {
- add(row);
- }
- }
- return true;
- }
- };
- resolveCodes(v);
- List<LookupRow> result = v.getLookupRows();
- if (result.size() > 1) {
- Comparator<LookupRow> comparator = getSortComparator();
- if (comparator != null) {
- Collections.sort(result, comparator);
- }
- }
- return result.toArray(new LookupRow[result.size()]);
- }
-
- /**
- * Complete override using code data
- */
- @Override
- public LookupRow[] getDataByRec() throws ProcessingException {
- Object recValue = getRec();
- if ((recValue instanceof Number) && ((Number) recValue).longValue() == 0) {
- recValue = null;
- }
- final Object key = recValue;
- AbstractLookupRowCollector v = new AbstractLookupRowCollector() {
- @Override
- public boolean visit(ICode code, int treeLevel) {
- if (m_filter != null && !m_filter.visit(CodeLookupCall.this, code, treeLevel)) {
- return true;
- }
- ICode parentCode = code.getParentCode();
- if (getActive().isUndefined() || getActive().getBooleanValue() == code.isActive()) {
- if (((parentCode == null && key == null) || (parentCode != null && parentCode.getId() != null && parentCode.getId().equals(key)))) {
- LookupRow row = execCreateLookupRowFromCode(code);
- if (row != null) {
- add(row);
- }
- }
- }
- return true;
- }
- };
- resolveCodes(v);
- List<LookupRow> result = v.getLookupRows();
- if (result.size() > 1) {
- Comparator<LookupRow> comparator = getSortComparator();
- if (comparator != null) {
- Collections.sort(result, comparator);
- }
- }
- return result.toArray(new LookupRow[result.size()]);
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=388242
- * <p>
- *
- * @return the result of this lookup call into a single code or null.
- * @since 3.8.1
- */
- protected ICode<?> resolveCodeByKey() throws ProcessingException {
- Object key = getKey();
- ICodeType t = CODES.getCodeType(m_codeTypeClass);
- if (t == null) {
- return null;
- }
- return t.getCode(key);
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=388242
- * <p>
- *
- * @return the result of this lookup call into multiple codes matching the filter.
- * @since 3.8.1
- */
- protected void resolveCodes(ICodeVisitor v) throws ProcessingException {
- ICodeType t = CODES.getCodeType(m_codeTypeClass);
- if (t != null) {
- t.visit(v, false);
- }
- }
-
- private static abstract class AbstractLookupRowCollector implements ICodeVisitor {
- private ArrayList<LookupRow> m_list = new ArrayList<LookupRow>();
-
- public AbstractLookupRowCollector() {
- }
-
- public void add(LookupRow row) {
- m_list.add(row);
- }
-
- public List<LookupRow> getLookupRows() {
- return m_list;
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.lookup;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.regex.Pattern;
+
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.shared.services.common.code.CODES;
+import org.eclipse.scout.rt.shared.services.common.code.ICode;
+import org.eclipse.scout.rt.shared.services.common.code.ICodeType;
+import org.eclipse.scout.rt.shared.services.common.code.ICodeVisitor;
+import org.eclipse.scout.service.SERVICES;
+
+/**
+ * @see LookupCall
+ */
+public class CodeLookupCall extends LocalLookupCall implements Serializable {
+ private static final long serialVersionUID = 0L;
+
+ /**
+ * Helper method to create a lookup call from a codetype using the {@link ICodeLookupCallFactoryService}.
+ */
+ public static CodeLookupCall newInstanceByService(Class<? extends ICodeType> codeTypeClass) {
+ return SERVICES.getService(ICodeLookupCallFactoryService.class).newInstance(codeTypeClass);
+ }
+
+ private Class<? extends ICodeType> m_codeTypeClass;
+ private ICodeLookupCallVisitor m_filter;
+ private Comparator<LookupRow> m_sortComparator;
+
+ public CodeLookupCall(Class<? extends ICodeType> codeTypeClass) {
+ m_codeTypeClass = codeTypeClass;
+ }
+
+ public Comparator<LookupRow> getSortComparator() {
+ return m_sortComparator;
+ }
+
+ public void setSortComparator(Comparator<LookupRow> comp) {
+ m_sortComparator = comp;
+ }
+
+ @Override
+ public int hashCode() {
+ return super.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (!super.equals(obj)) {
+ return false;
+ }
+ CodeLookupCall other = (CodeLookupCall) obj;
+ if (this.m_codeTypeClass != other.m_codeTypeClass) {
+ return false;
+ }
+ if (this.m_filter != other.m_filter) {
+ return false;
+ }
+ return true;
+ }
+
+ public Class<? extends ICodeType> getCodeTypeClass() {
+ return m_codeTypeClass;
+ }
+
+ public void setFilter(ICodeLookupCallVisitor filter) {
+ m_filter = filter;
+ }
+
+ public ICodeLookupCallVisitor getFilter() {
+ return m_filter;
+ }
+
+ /**
+ * Implementation that creates lookup rows from codes.
+ * <p>
+ * By default calls {@link #execCreateLookupRowFromCode(ICode)}
+ */
+ protected LookupRow[] execCreateLookupRowsFromCodes(List<? extends ICode<?>> codes) {
+ LookupRow[] a = new LookupRow[codes.size()];
+ for (int i = 0; i < a.length; i++) {
+ a[i] = execCreateLookupRowFromCode(codes.get(i));
+ }
+ return a;
+ }
+
+ /**
+ * Implementation that creates lookup rows from codes.
+ * <p>
+ * By default calls {@link #createLookupRow(ICode)}
+ */
+ protected LookupRow execCreateLookupRowFromCode(ICode<?> code) {
+ return createLookupRow(code);
+ }
+
+ /**
+ * Default implementation to create lookup rows from codes.
+ * <p>
+ * Called by {@link #execCreateLookupRowsFromCodes(List)}.
+ */
+ public static LookupRow[] createLookupRowArray(List<? extends ICode> codes) {
+ LookupRow[] a = new LookupRow[codes.size()];
+ for (int i = 0; i < a.length; i++) {
+ a[i] = createLookupRow(codes.get(i));
+ }
+ return a;
+ }
+
+ /**
+ * Default implementation to create a lookup row from a code.
+ * <p>
+ * Called by {@link #createLookupRowArray(List)}.
+ */
+ public static LookupRow createLookupRow(ICode<?> c) {
+ Object parentId = null;
+ if (c.getParentCode() != null) {
+ parentId = c.getParentCode().getId();
+ }
+ return new LookupRow(c.getId(), c.getText(), c.getIconId(), c.getTooltipText(), c.getBackgroundColor(), c.getForegroundColor(), c.getFont(), c.isEnabled(), parentId, c.isActive());
+ }
+
+ public static Pattern getSearchPattern(String s) {
+ if (s == null) {
+ s = "";
+ }
+ s = s.toLowerCase();
+ if (!s.endsWith("*")) {
+ s = s + "*";
+ }
+ return Pattern.compile(StringUtility.toRegExPattern(s), Pattern.DOTALL);
+ }
+
+ /**
+ * Complete override using code data
+ */
+ @Override
+ public LookupRow[] getDataByKey() throws ProcessingException {
+ ArrayList<ICode<?>> list = new ArrayList<ICode<?>>(1);
+ ICode c = resolveCodeByKey();
+ if (c != null) {
+ list.add(c);
+ }
+ return execCreateLookupRowsFromCodes(list);
+ }
+
+ /**
+ * Complete override using code data
+ */
+ @Override
+ public LookupRow[] getDataByText() throws ProcessingException {
+ final Pattern pat = getSearchPattern(getText());
+ AbstractLookupRowCollector v = new AbstractLookupRowCollector() {
+ @Override
+ public boolean visit(ICode code, int treeLevel) {
+ if (m_filter != null && !m_filter.visit(CodeLookupCall.this, code, treeLevel)) {
+ return true;
+ }
+ if (getActive().isUndefined() || getActive().getBooleanValue() == code.isActive()) {
+ LookupRow row = execCreateLookupRowFromCode(code);
+ if (row != null && row.getText() != null && pat.matcher(row.getText().toLowerCase()).matches()) {
+ add(row);
+ }
+ }
+ return true;
+ }
+ };
+ resolveCodes(v);
+ List<LookupRow> result = v.getLookupRows();
+ if (result.size() > 1) {
+ Comparator<LookupRow> comparator = getSortComparator();
+ if (comparator != null) {
+ Collections.sort(result, comparator);
+ }
+ }
+ return result.toArray(new LookupRow[result.size()]);
+ }
+
+ /**
+ * Complete override using code data
+ */
+ @Override
+ public LookupRow[] getDataByAll() throws ProcessingException {
+ final Pattern pat = getSearchPattern(getAll());
+ AbstractLookupRowCollector v = new AbstractLookupRowCollector() {
+ @Override
+ public boolean visit(ICode code, int treeLevel) {
+ if (m_filter != null && !m_filter.visit(CodeLookupCall.this, code, treeLevel)) {
+ return true;
+ }
+ if (getActive().isUndefined() || getActive().getBooleanValue() == code.isActive()) {
+ LookupRow row = execCreateLookupRowFromCode(code);
+ if (row != null && row.getText() != null && pat.matcher(row.getText().toLowerCase()).matches()) {
+ add(row);
+ }
+ }
+ return true;
+ }
+ };
+ resolveCodes(v);
+ List<LookupRow> result = v.getLookupRows();
+ if (result.size() > 1) {
+ Comparator<LookupRow> comparator = getSortComparator();
+ if (comparator != null) {
+ Collections.sort(result, comparator);
+ }
+ }
+ return result.toArray(new LookupRow[result.size()]);
+ }
+
+ /**
+ * Complete override using code data
+ */
+ @Override
+ public LookupRow[] getDataByRec() throws ProcessingException {
+ Object recValue = getRec();
+ if ((recValue instanceof Number) && ((Number) recValue).longValue() == 0) {
+ recValue = null;
+ }
+ final Object key = recValue;
+ AbstractLookupRowCollector v = new AbstractLookupRowCollector() {
+ @Override
+ public boolean visit(ICode code, int treeLevel) {
+ if (m_filter != null && !m_filter.visit(CodeLookupCall.this, code, treeLevel)) {
+ return true;
+ }
+ ICode parentCode = code.getParentCode();
+ if (getActive().isUndefined() || getActive().getBooleanValue() == code.isActive()) {
+ if (((parentCode == null && key == null) || (parentCode != null && parentCode.getId() != null && parentCode.getId().equals(key)))) {
+ LookupRow row = execCreateLookupRowFromCode(code);
+ if (row != null) {
+ add(row);
+ }
+ }
+ }
+ return true;
+ }
+ };
+ resolveCodes(v);
+ List<LookupRow> result = v.getLookupRows();
+ if (result.size() > 1) {
+ Comparator<LookupRow> comparator = getSortComparator();
+ if (comparator != null) {
+ Collections.sort(result, comparator);
+ }
+ }
+ return result.toArray(new LookupRow[result.size()]);
+ }
+
+ /**
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=388242
+ * <p>
+ *
+ * @return the result of this lookup call into a single code or null.
+ * @since 3.8.1
+ */
+ protected ICode<?> resolveCodeByKey() throws ProcessingException {
+ Object key = getKey();
+ ICodeType t = CODES.getCodeType(m_codeTypeClass);
+ if (t == null) {
+ return null;
+ }
+ return t.getCode(key);
+ }
+
+ /**
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=388242
+ * <p>
+ *
+ * @return the result of this lookup call into multiple codes matching the filter.
+ * @since 3.8.1
+ */
+ protected void resolveCodes(ICodeVisitor v) throws ProcessingException {
+ ICodeType t = CODES.getCodeType(m_codeTypeClass);
+ if (t != null) {
+ t.visit(v, false);
+ }
+ }
+
+ private static abstract class AbstractLookupRowCollector implements ICodeVisitor {
+ private ArrayList<LookupRow> m_list = new ArrayList<LookupRow>();
+
+ public AbstractLookupRowCollector() {
+ }
+
+ public void add(LookupRow row) {
+ m_list.add(row);
+ }
+
+ public List<LookupRow> getLookupRows() {
+ return m_list;
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/DefaultCodeLookupCallFactoryService.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/DefaultCodeLookupCallFactoryService.java
index c6e10d9dc7..e1d86108ce 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/DefaultCodeLookupCallFactoryService.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/DefaultCodeLookupCallFactoryService.java
@@ -1,28 +1,28 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.lookup;
-
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.rt.shared.services.common.code.ICodeType;
-import org.eclipse.scout.service.AbstractService;
-
-/**
- * @since 3.8.1
- */
-@Priority(-1)
-public class DefaultCodeLookupCallFactoryService extends AbstractService implements ICodeLookupCallFactoryService {
-
- @Override
- public CodeLookupCall newInstance(Class<? extends ICodeType> codeTypeClass) {
- return new CodeLookupCall(codeTypeClass);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.lookup;
+
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.rt.shared.services.common.code.ICodeType;
+import org.eclipse.scout.service.AbstractService;
+
+/**
+ * @since 3.8.1
+ */
+@Priority(-1)
+public class DefaultCodeLookupCallFactoryService extends AbstractService implements ICodeLookupCallFactoryService {
+
+ @Override
+ public CodeLookupCall newInstance(Class<? extends ICodeType> codeTypeClass) {
+ return new CodeLookupCall(codeTypeClass);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/IBatchLookupService.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/IBatchLookupService.java
index 77e4294ece..99931a690a 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/IBatchLookupService.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/IBatchLookupService.java
@@ -1,43 +1,43 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.lookup;
-
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.service.IService;
-
-@Priority(-3)
-public interface IBatchLookupService extends IService {
-
- /**
- * Lookup by performing a "key" filter and activating the {@code<key>} tags<br>
- * Batch processing
- */
- LookupRow[][] getBatchDataByKey(BatchLookupCall call) throws ProcessingException;
-
- /**
- * Lookup by performing a "text" filter and activating the {@code<text>} tags<br>
- * Batch processing
- */
- LookupRow[][] getBatchDataByText(BatchLookupCall call) throws ProcessingException;
-
- /**
- * Lookup by performing a "all" filter and activating the {@code<all>} tags<br>
- * Batch processing
- */
- LookupRow[][] getBatchDataByAll(BatchLookupCall call) throws ProcessingException;
-
- /**
- * Lookup by performing a "recursion" filter and activating the {@code<rec>} tags<br>
- * Batch processing
- */
- LookupRow[][] getBatchDataByRec(BatchLookupCall call) throws ProcessingException;
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.lookup;
+
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.service.IService;
+
+@Priority(-3)
+public interface IBatchLookupService extends IService {
+
+ /**
+ * Lookup by performing a "key" filter and activating the {@code<key>} tags<br>
+ * Batch processing
+ */
+ LookupRow[][] getBatchDataByKey(BatchLookupCall call) throws ProcessingException;
+
+ /**
+ * Lookup by performing a "text" filter and activating the {@code<text>} tags<br>
+ * Batch processing
+ */
+ LookupRow[][] getBatchDataByText(BatchLookupCall call) throws ProcessingException;
+
+ /**
+ * Lookup by performing a "all" filter and activating the {@code<all>} tags<br>
+ * Batch processing
+ */
+ LookupRow[][] getBatchDataByAll(BatchLookupCall call) throws ProcessingException;
+
+ /**
+ * Lookup by performing a "recursion" filter and activating the {@code<rec>} tags<br>
+ * Batch processing
+ */
+ LookupRow[][] getBatchDataByRec(BatchLookupCall call) throws ProcessingException;
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/ICodeLookupCallFactoryService.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/ICodeLookupCallFactoryService.java
index f0471297cd..340902c77c 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/ICodeLookupCallFactoryService.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/ICodeLookupCallFactoryService.java
@@ -1,31 +1,31 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.lookup;
-
-import org.eclipse.scout.rt.shared.services.common.code.ICodeType;
-import org.eclipse.scout.service.IService;
-
-/**
- * This service creates a lookup call for a code type.
- * It can be used to create custom {@link CodeLookupCall} instances.
- * <p>
- * Known callers are {@link ISmartField}, {@link IListBox}, {@link ITreeBox}, {@link IRadioButtonGroup},
- * {@link ISmartColumn}
- * <p>
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=388242
- *
- * @since 3.8.1
- */
-public interface ICodeLookupCallFactoryService extends IService {
-
- CodeLookupCall newInstance(Class<? extends ICodeType> codeTypeClass);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.lookup;
+
+import org.eclipse.scout.rt.shared.services.common.code.ICodeType;
+import org.eclipse.scout.service.IService;
+
+/**
+ * This service creates a lookup call for a code type.
+ * It can be used to create custom {@link CodeLookupCall} instances.
+ * <p>
+ * Known callers are {@link ISmartField}, {@link IListBox}, {@link ITreeBox}, {@link IRadioButtonGroup},
+ * {@link ISmartColumn}
+ * <p>
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=388242
+ *
+ * @since 3.8.1
+ */
+public interface ICodeLookupCallFactoryService extends IService {
+
+ CodeLookupCall newInstance(Class<? extends ICodeType> codeTypeClass);
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/ICodeLookupCallVisitor.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/ICodeLookupCallVisitor.java
index d2a373cafc..c7ac233f67 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/ICodeLookupCallVisitor.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/ICodeLookupCallVisitor.java
@@ -1,22 +1,22 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.lookup;
-
-import org.eclipse.scout.rt.shared.services.common.code.ICode;
-
-public interface ICodeLookupCallVisitor {
-
- /**
- * @return true=continue visiting, false=end visiting
- */
- boolean visit(CodeLookupCall call, ICode code, int treeLevel);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.lookup;
+
+import org.eclipse.scout.rt.shared.services.common.code.ICode;
+
+public interface ICodeLookupCallVisitor {
+
+ /**
+ * @return true=continue visiting, false=end visiting
+ */
+ boolean visit(CodeLookupCall call, ICode code, int treeLevel);
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/ILookupCallFetcher.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/ILookupCallFetcher.java
index b08c92e1f5..5d7adf193b 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/ILookupCallFetcher.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/ILookupCallFetcher.java
@@ -1,37 +1,37 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.lookup;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-
-/**
- * Asynchronous LookupCall fetcher.<br>
- * Used to get lookup data from a backend service using a background thread.
- * <p>
- * It calls for example {@link LookupCall#getDataByTextInBackground(ILookupCallFetcher)} in the normal model thread and
- * passes his callback as an argument. The framework is then loading the data in the background.<br>
- * Once data is loaded, the callback method {@link ILookupCallFetcher#dataFetched(LookupRow[], ProcessingException)} is
- * called back with either failed==null which signals successful processing or failed!=null which signals a failure.
- */
-public interface ILookupCallFetcher {
-
- /**
- * This method may be called in a background thread out of the scout session
- * context
- *
- * @param rows
- * that were fetched from the data provider
- * @param failed
- * null if ok, not null if any error occured during fetch
- */
- void dataFetched(LookupRow[] rows, ProcessingException failed);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.lookup;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+
+/**
+ * Asynchronous LookupCall fetcher.<br>
+ * Used to get lookup data from a backend service using a background thread.
+ * <p>
+ * It calls for example {@link LookupCall#getDataByTextInBackground(ILookupCallFetcher)} in the normal model thread and
+ * passes his callback as an argument. The framework is then loading the data in the background.<br>
+ * Once data is loaded, the callback method {@link ILookupCallFetcher#dataFetched(LookupRow[], ProcessingException)} is
+ * called back with either failed==null which signals successful processing or failed!=null which signals a failure.
+ */
+public interface ILookupCallFetcher {
+
+ /**
+ * This method may be called in a background thread out of the scout session
+ * context
+ *
+ * @param rows
+ * that were fetched from the data provider
+ * @param failed
+ * null if ok, not null if any error occured during fetch
+ */
+ void dataFetched(LookupRow[] rows, ProcessingException failed);
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/ILookupService.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/ILookupService.java
index 19fb5ea55e..ddffa365a4 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/ILookupService.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/ILookupService.java
@@ -1,39 +1,39 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.lookup;
-
-import org.eclipse.scout.commons.annotations.Priority;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.service.IService;
-
-@Priority(-3)
-public interface ILookupService extends IService {
-
- /**
- * Lookup by performing a "key" filter and activating the <key> tags
- */
- LookupRow[] getDataByKey(LookupCall call) throws ProcessingException;
-
- /**
- * Lookup by performing a "text" filter and activating the <text> tags
- */
- LookupRow[] getDataByText(LookupCall call) throws ProcessingException;
-
- /**
- * Lookup by performing a "all" filter and activating the <all> tags
- */
- LookupRow[] getDataByAll(LookupCall call) throws ProcessingException;
-
- /**
- * Lookup by performing a "recursion" filter and activating the <rec> tags
- */
- LookupRow[] getDataByRec(LookupCall call) throws ProcessingException;
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.lookup;
+
+import org.eclipse.scout.commons.annotations.Priority;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.service.IService;
+
+@Priority(-3)
+public interface ILookupService extends IService {
+
+ /**
+ * Lookup by performing a "key" filter and activating the <key> tags
+ */
+ LookupRow[] getDataByKey(LookupCall call) throws ProcessingException;
+
+ /**
+ * Lookup by performing a "text" filter and activating the <text> tags
+ */
+ LookupRow[] getDataByText(LookupCall call) throws ProcessingException;
+
+ /**
+ * Lookup by performing a "all" filter and activating the <all> tags
+ */
+ LookupRow[] getDataByAll(LookupCall call) throws ProcessingException;
+
+ /**
+ * Lookup by performing a "recursion" filter and activating the <rec> tags
+ */
+ LookupRow[] getDataByRec(LookupCall call) throws ProcessingException;
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/LocalLookupCall.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/LocalLookupCall.java
index 5e4cd16016..81d1bd1b2f 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/LocalLookupCall.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/LocalLookupCall.java
@@ -1,145 +1,145 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.lookup;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.regex.Pattern;
-
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.annotations.ConfigOperation;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-
-/**
- * LookupCall for cases where no backend service exists.<br>
- * Data is directly provided by {@link #execCreateLookupRows()}
- * <p>
- * Does not implements serializable, since this special subclass is not intended to be exchanged between gui and server.
- *
- * @see LookupCall
- */
-public class LocalLookupCall extends LookupCall {
- private static final long serialVersionUID = 0L;
-
- public LocalLookupCall() {
- }
-
- @Override
- public boolean equals(Object obj) {
- return super.equals(obj);
- }
-
- @Override
- public int hashCode() {
- return super.hashCode();
- }
-
- @ConfigOperation
- @Order(30)
- protected List<LookupRow> execCreateLookupRows() throws ProcessingException {
- return null;
- }
-
- /**
- * @param humanReadbleFilterPattern
- * is not a regex and may contain *,%,? as wildcards for searching
- * override this method for custom filter pattern creation
- */
- protected Pattern createSearchPattern(String humanReadbleFilterPattern) {
- return createLowerCaseSearchPattern(humanReadbleFilterPattern);
- }
-
- /**
- * alias for {@link StringUtility#toRegEx(String, int)}
- */
- public static Pattern createLowerCaseSearchPattern(String s) {
- return StringUtility.toRegEx(s, Pattern.DOTALL | Pattern.CASE_INSENSITIVE);
- }
-
- @Override
- protected final Class<? extends ILookupService> getConfiguredService() {
- return null;
- }
-
- /**
- * Complete override using local data
- */
- @Override
- public LookupRow[] getDataByKey() throws ProcessingException {
- if (getKey() == null) {
- return LookupRow.EMPTY_ARRAY;
- }
- Object key = getKey();
- ArrayList<LookupRow> list = new ArrayList<LookupRow>();
- for (LookupRow row : execCreateLookupRows()) {
- if (key.equals(row.getKey())) {
- list.add(row);
- }
- }
- return list.toArray(new LookupRow[list.size()]);
- }
-
- /**
- * Complete override using local data
- */
- @Override
- public LookupRow[] getDataByText() throws ProcessingException {
- ArrayList<LookupRow> list = new ArrayList<LookupRow>();
- Pattern p = createSearchPattern(getText());
- for (LookupRow row : execCreateLookupRows()) {
- if (row.getText() != null && p.matcher(row.getText().toLowerCase()).matches()) {
- list.add(row);
- }
- }
- return list.toArray(new LookupRow[list.size()]);
- }
-
- /**
- * Complete override using local data
- */
- @Override
- public LookupRow[] getDataByAll() throws ProcessingException {
- ArrayList<LookupRow> list = new ArrayList<LookupRow>();
- Pattern p = createSearchPattern(getAll());
- for (LookupRow row : execCreateLookupRows()) {
- if (row.getText() != null && p.matcher(row.getText().toLowerCase()).matches()) {
- list.add(row);
- }
- }
- return list.toArray(new LookupRow[list.size()]);
- }
-
- /**
- * Complete override using local data
- */
- @Override
- public LookupRow[] getDataByRec() throws ProcessingException {
- ArrayList<LookupRow> list = new ArrayList<LookupRow>();
- Object parentKey = getRec();
- if (parentKey == null) {
- for (LookupRow row : execCreateLookupRows()) {
- if (row.getParentKey() == null) {
- list.add(row);
- }
- }
- }
- else {
- for (LookupRow row : execCreateLookupRows()) {
- if (parentKey.equals(row.getParentKey())) {
- list.add(row);
- }
- }
- }
- return list.toArray(new LookupRow[list.size()]);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.lookup;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Pattern;
+
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.annotations.ConfigOperation;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+
+/**
+ * LookupCall for cases where no backend service exists.<br>
+ * Data is directly provided by {@link #execCreateLookupRows()}
+ * <p>
+ * Does not implements serializable, since this special subclass is not intended to be exchanged between gui and server.
+ *
+ * @see LookupCall
+ */
+public class LocalLookupCall extends LookupCall {
+ private static final long serialVersionUID = 0L;
+
+ public LocalLookupCall() {
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ return super.equals(obj);
+ }
+
+ @Override
+ public int hashCode() {
+ return super.hashCode();
+ }
+
+ @ConfigOperation
+ @Order(30)
+ protected List<LookupRow> execCreateLookupRows() throws ProcessingException {
+ return null;
+ }
+
+ /**
+ * @param humanReadbleFilterPattern
+ * is not a regex and may contain *,%,? as wildcards for searching
+ * override this method for custom filter pattern creation
+ */
+ protected Pattern createSearchPattern(String humanReadbleFilterPattern) {
+ return createLowerCaseSearchPattern(humanReadbleFilterPattern);
+ }
+
+ /**
+ * alias for {@link StringUtility#toRegEx(String, int)}
+ */
+ public static Pattern createLowerCaseSearchPattern(String s) {
+ return StringUtility.toRegEx(s, Pattern.DOTALL | Pattern.CASE_INSENSITIVE);
+ }
+
+ @Override
+ protected final Class<? extends ILookupService> getConfiguredService() {
+ return null;
+ }
+
+ /**
+ * Complete override using local data
+ */
+ @Override
+ public LookupRow[] getDataByKey() throws ProcessingException {
+ if (getKey() == null) {
+ return LookupRow.EMPTY_ARRAY;
+ }
+ Object key = getKey();
+ ArrayList<LookupRow> list = new ArrayList<LookupRow>();
+ for (LookupRow row : execCreateLookupRows()) {
+ if (key.equals(row.getKey())) {
+ list.add(row);
+ }
+ }
+ return list.toArray(new LookupRow[list.size()]);
+ }
+
+ /**
+ * Complete override using local data
+ */
+ @Override
+ public LookupRow[] getDataByText() throws ProcessingException {
+ ArrayList<LookupRow> list = new ArrayList<LookupRow>();
+ Pattern p = createSearchPattern(getText());
+ for (LookupRow row : execCreateLookupRows()) {
+ if (row.getText() != null && p.matcher(row.getText().toLowerCase()).matches()) {
+ list.add(row);
+ }
+ }
+ return list.toArray(new LookupRow[list.size()]);
+ }
+
+ /**
+ * Complete override using local data
+ */
+ @Override
+ public LookupRow[] getDataByAll() throws ProcessingException {
+ ArrayList<LookupRow> list = new ArrayList<LookupRow>();
+ Pattern p = createSearchPattern(getAll());
+ for (LookupRow row : execCreateLookupRows()) {
+ if (row.getText() != null && p.matcher(row.getText().toLowerCase()).matches()) {
+ list.add(row);
+ }
+ }
+ return list.toArray(new LookupRow[list.size()]);
+ }
+
+ /**
+ * Complete override using local data
+ */
+ @Override
+ public LookupRow[] getDataByRec() throws ProcessingException {
+ ArrayList<LookupRow> list = new ArrayList<LookupRow>();
+ Object parentKey = getRec();
+ if (parentKey == null) {
+ for (LookupRow row : execCreateLookupRows()) {
+ if (row.getParentKey() == null) {
+ list.add(row);
+ }
+ }
+ }
+ else {
+ for (LookupRow row : execCreateLookupRows()) {
+ if (parentKey.equals(row.getParentKey())) {
+ list.add(row);
+ }
+ }
+ }
+ return list.toArray(new LookupRow[list.size()]);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/LookupCall.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/LookupCall.java
index 3075399155..3a6f744ffe 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/LookupCall.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/LookupCall.java
@@ -1,547 +1,547 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.lookup;
-
-import java.io.Serializable;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.scout.commons.TriState;
-import org.eclipse.scout.commons.annotations.ConfigProperty;
-import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.job.JobEx;
-import org.eclipse.scout.rt.shared.services.common.session.IJobRunnable;
-import org.eclipse.scout.rt.shared.services.common.session.ISessionService;
-import org.eclipse.scout.rt.shared.validate.annotations.MaxLength;
-import org.eclipse.scout.service.SERVICES;
-
-/**
- * There are 2 variants to use lookup values <br>
- * a) with a service that yields data (external data, large amount, on database) <br>
- * b) with data directly generated in the call itself (local data, small amount,
- * in memory)
- * <p>
- * When using (a) the configured property getConfiguredService is non-null <br>
- * When using (b) the method execCreateLookupRows() is non-empty. The subclass CodeLookupCall is implementing this
- * method <br>
- * by using data from a code type (enum).
- * <p>
- * The following three examples illustrate these cases
- * <p>
- * 1. External data on backend <br>
- * Service interface: ICompanyLookupService <br>
- * Service implementation: CompanyLookupService <br>
- * LookupCall: subclass of LookupCall, for example CompanyLookupCall using ICompanyLookupService
- * <p>
- * 2. CodeType (enum) <br>
- * Service interface: --- <br>
- * Service implementation: --- <br>
- * LookupCall: CodeLookupCall(ICodeType enumType), for example new CodeLookupCall(projectStatusCodeType)
- * <p>
- * 3. Local data <br>
- * Service interface: --- <br>
- * Service implementation: --- <br>
- * LookupCall: subclass of LocalLookupCall() with implementation of method
- * {@link LocalLookupCall#execCreateLookupRows()}
- */
-public class LookupCall implements Cloneable, Serializable {
- private static final long serialVersionUID = 0L;
-
- private Object m_key;
- @MaxLength(2000)
- private String m_text;
- private String m_all;
- private Object m_rec;
- private Object m_master;
- private TriState m_active;
- private int m_maxRowCount;
- private transient ILookupService m_serviceCached;
-
- public LookupCall() {
- m_serviceCached = createLookupService();
- m_active = TriState.UNDEFINED;
- }
-
- /**
- * Configurator will add get/set for properties
- */
-
- /**
- * Configurator is implementing this method
- */
- @ConfigProperty(ConfigProperty.LOOKUP_SERVICE)
- @ConfigPropertyValue("null")
- @Order(10)
- protected Class<? extends ILookupService> getConfiguredService() {
- return null;
- }
-
- /**
- * @return true if a master value is required for lookups by {@link #getDataByText()} and {@link #getDataByAll()}
- */
- @ConfigProperty(ConfigProperty.BOOLEAN)
- @ConfigPropertyValue("false")
- @Order(20)
- protected boolean getConfiguredMasterRequired() {
- return false;
- }
-
- @ConfigProperty(ConfigProperty.DOC)
- @Order(30)
- @ConfigPropertyValue("null")
- protected String getConfiguredDoc() {
- return null;
- }
-
- public ILookupService getLookupService() {
- if (m_serviceCached == null) {
- m_serviceCached = createLookupService();
- }
- return m_serviceCached;
- }
-
- private ILookupService createLookupService() {
- ILookupService s = null;
- if (getConfiguredService() != null) {
- s = SERVICES.getService(getConfiguredService());
- if (s == null) {
- throw new IllegalArgumentException("service " + getConfiguredService().getName() + " is either not registered in the clientProxy extension in the plugin.xml or this constructor is called outside the model thread");
- }
- }
- return s;
- }
-
- public Object getKey() {
- return m_key;
- }
-
- public long getKeyAsLong() {
- Object o = getKey();
- if (o instanceof Number) {
- return ((Number) o).longValue();
- }
- else {
- return 0;
- }
- }
-
- public void setKey(Object key) {
- m_key = key;
- }
-
- public String getText() {
- return m_text;
- }
-
- public void setText(String s) {
- m_text = s;
- }
-
- public String getAll() {
- return m_all;
- }
-
- public void setAll(String s) {
- m_all = s;
- }
-
- public Object getRec() {
- return m_rec;
- }
-
- public long getRecAsLong() {
- Object o = getRec();
- if (o instanceof Number) {
- return ((Number) o).longValue();
- }
- else {
- return 0;
- }
- }
-
- public void setRec(Object parent) {
- m_rec = parent;
- }
-
- /**
- * @return {@link TriState#TRUE} if only active rows should be fetched, {@link TriState#FALSE} if only incative rows
- * should be fetched and {@link TriState#UNDEFINED} if active and inactive rows should be
- * fetched
- */
- public TriState getActive() {
- return m_active;
- }
-
- /**
- * see {@link #getActive()}
- */
- public void setActive(TriState s) {
- if (s == null) {
- s = TriState.UNDEFINED;
- }
- m_active = s;
- }
-
- public Object getMaster() {
- return m_master;
- }
-
- public long getMasterAsLong() {
- Object o = getMaster();
- if (o instanceof Number) {
- return ((Number) o).longValue();
- }
- else {
- return 0;
- }
- }
-
- public void setMaster(Object master) {
- m_master = master;
- }
-
- public int getMaxRowCount() {
- return m_maxRowCount;
- }
-
- public void setMaxRowCount(int n) {
- m_maxRowCount = n;
- }
-
- @Override
- public Object clone() {
- LookupCall c = null;
- try {
- c = (LookupCall) super.clone();
- }
- catch (CloneNotSupportedException e) {
- }
- return c;
- }
-
- @Override
- public int hashCode() {
- return (m_key != null ? m_key.hashCode() : 0) ^ (m_text != null ? m_text.hashCode() : 0) ^ (m_all != null ? m_all.hashCode() : 0);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == null) {
- return false;
- }
- if (obj == this) {
- return true;
- }
- if (obj.getClass() != this.getClass()) {
- return false;
- }
- LookupCall other = (LookupCall) obj;
- if (this.m_serviceCached != null && other.m_serviceCached != null && this.m_serviceCached != other.m_serviceCached) {
- return false;
- }
- if (!(this.m_key == other.m_key || (this.m_key != null && this.m_key.equals(other.m_key)))) {
- return false;
- }
- if (!(this.m_text == other.m_text || (this.m_text != null && this.m_text.equals(other.m_text)))) {
- return false;
- }
- if (!(this.m_all == other.m_all || (this.m_all != null && this.m_all.equals(other.m_all)))) {
- return false;
- }
- if (!(this.m_rec == other.m_rec || (this.m_rec != null && this.m_rec.equals(other.m_rec)))) {
- return false;
- }
- if (!(this.m_master == other.m_master || (this.m_master != null && this.m_master.equals(other.m_master)))) {
- return false;
- }
- if (!(this.m_active == other.m_active || (this.m_active != null && this.m_active.equals(other.m_active)))) {
- return false;
- }
- if (this.m_maxRowCount != other.m_maxRowCount) {
- return false;
- }
- return true;
- }
-
- /**
- * Lookup by performing a "key" filter and activating the <key> tags
- * <p>
- * When getConfiguredService is set then delegate call to service, otherwise returns an empty array
- */
- public LookupRow[] getDataByKey() throws ProcessingException {
- if (getKey() == null) {
- return LookupRow.EMPTY_ARRAY;
- }
- if (getLookupService() != null) {
- return getLookupService().getDataByKey(this);
- }
- return LookupRow.EMPTY_ARRAY;
- }
-
- /**
- * Same as {@link #getDataByKey()} but in background.<br>
- * see {@link ILookupCallFetcher}<br>
- * {@link ILookupCallFetcher#dataFetched(LookupRow[], ProcessingException)} is
- * called in the background thread
- * <p>
- * Note: background call is only done when lookup call is not a {@link LocalLookupCall}
- *
- * @return the created async job if applicable or null
- */
- public JobEx getDataByKeyInBackground(final ILookupCallFetcher caller) {
- if (!(LookupCall.this instanceof LocalLookupCall)) {
- JobEx job = createAsyncJob(getClass().getSimpleName() + ".getDataByKeyInBackground",
- new IJobRunnable() {
- @Override
- public IStatus run(IProgressMonitor monitor) {
- try {
- LookupRow[] rows = getDataByKey();
- if (!JobEx.isCurrentJobCanceled()) {
- caller.dataFetched(rows, null);
- }
- }
- catch (ProcessingException e) {
- if (!e.isInterruption() && !JobEx.isCurrentJobCanceled()) {
- caller.dataFetched(null, e);
- }
- }
- return Status.OK_STATUS;
- }
- });
- job.setSystem(true);
- job.schedule();
- return job;
- }
- else {
- try {
- caller.dataFetched(getDataByKey(), null);
- }
- catch (ProcessingException e) {
- caller.dataFetched(null, e);
- }
- return null;
- }
- }
-
- /**
- * Lookup by performing a "text" filter and activating the <text> tags
- * <p>
- * When getConfiguredService is set then delegate call to service, otherwise return null
- */
- public LookupRow[] getDataByText() throws ProcessingException {
- boolean masterValid = ((!getConfiguredMasterRequired()) || getMaster() != null);
- if (masterValid && getLookupService() != null) {
- return getLookupService().getDataByText(this);
- }
- else {
- return LookupRow.EMPTY_ARRAY;
- }
- }
-
- /**
- * Same as {@link #getDataByText()} but in background.<br>
- * see {@link ILookupCallFetcher}<br>
- * {@link ILookupCallFetcher#dataFetched(LookupRow[], ProcessingException)} is
- * called in the background thread
- * <p>
- * Note: background call is only done when lookup call is not a {@link LocalLookupCall}
- *
- * @return the created async job if applicable or null
- */
- public JobEx getDataByTextInBackground(final ILookupCallFetcher caller) {
- if (!(LookupCall.this instanceof LocalLookupCall)) {
- JobEx job = createAsyncJob(getClass().getSimpleName() + ".getDataByTextInBackground", new IJobRunnable() {
- @Override
- public IStatus run(IProgressMonitor monitor) {
- try {
- LookupRow[] rows = getDataByText();
- if (!JobEx.isCurrentJobCanceled()) {
- caller.dataFetched(rows, null);
- }
- }
- catch (ProcessingException e) {
- if (!e.isInterruption() && !JobEx.isCurrentJobCanceled()) {
- caller.dataFetched(null, e);
- }
- }
- return Status.OK_STATUS;
- }
- });
- job.setSystem(true);
- job.schedule();
- return job;
- }
- else {
- try {
- caller.dataFetched(getDataByText(), null);
- }
- catch (ProcessingException e) {
- caller.dataFetched(null, e);
- }
- return null;
- }
- }
-
- /**
- * Lookup by performing a "all" filter and activating the <all> tags
- * <p>
- * When getConfiguredService is set then delegate call to service, otherwise return null
- */
- public LookupRow[] getDataByAll() throws ProcessingException {
- boolean masterValid = ((!getConfiguredMasterRequired()) || getMaster() != null);
- if (masterValid && getLookupService() != null) {
- return getLookupService().getDataByAll(this);
- }
- else {
- return LookupRow.EMPTY_ARRAY;
- }
- }
-
- /**
- * Same as {@link #getDataByAll()} but in background.<br>
- * see {@link ILookupCallFetcher}<br>
- * {@link ILookupCallFetcher#dataFetched(LookupRow[], ProcessingException)} is
- * called in the background thread
- * <p>
- * Note: background call is only done when lookup call is not a {@link LocalLookupCall}
- *
- * @return the created async job if applicable or null
- */
- public JobEx getDataByAllInBackground(final ILookupCallFetcher caller) {
- if (!(LookupCall.this instanceof LocalLookupCall)) {
- JobEx job = createAsyncJob(getClass().getSimpleName() + ".getDataByAllInBackground",
- new IJobRunnable() {
- @Override
- public IStatus run(IProgressMonitor monitor) {
- try {
- LookupRow[] rows = getDataByAll();
- if (!JobEx.isCurrentJobCanceled()) {
- caller.dataFetched(rows, null);
- }
- }
- catch (ProcessingException e) {
- if (!e.isInterruption() && !JobEx.isCurrentJobCanceled()) {
- caller.dataFetched(null, e);
- }
- }
- return Status.OK_STATUS;
- }
- });
- job.setSystem(true);
- job.schedule();
- return job;
- }
- else {
- try {
- caller.dataFetched(getDataByAll(), null);
- }
- catch (ProcessingException e) {
- caller.dataFetched(null, e);
- }
- return null;
- }
- }
-
- /**
- * Lookup by performing a "recursion" filter and activating the <rec> tags
- * <p>
- * When getConfiguredService is set then delegate call to service, otherwise return null
- */
- public LookupRow[] getDataByRec() throws ProcessingException {
- if (getLookupService() != null) {
- return getLookupService().getDataByRec(this);
- }
- else {
- return LookupRow.EMPTY_ARRAY;
- }
- }
-
- /**
- * Same as {@link #getDataByRec()} but in background.<br>
- * see {@link ILookupCallFetcher}<br>
- * {@link ILookupCallFetcher#dataFetched(LookupRow[], ProcessingException)} is
- * called in the background thread
- * <p>
- * Note: background call is only done when lookup call is not a {@link LocalLookupCall}
- *
- * @return the created async job if applicable or null
- */
- public JobEx getDataByRecInBackground(final ILookupCallFetcher caller) {
- if (!(LookupCall.this instanceof LocalLookupCall)) {
- JobEx job = createAsyncJob(getClass().getSimpleName() + ".getDataByRecInBackground",
- new IJobRunnable() {
- @Override
- public IStatus run(IProgressMonitor monitor) {
- try {
- LookupRow[] rows = getDataByRec();
- if (!JobEx.isCurrentJobCanceled()) {
- caller.dataFetched(rows, null);
- }
- }
- catch (ProcessingException e) {
- if (!e.isInterruption() && !JobEx.isCurrentJobCanceled()) {
- caller.dataFetched(null, e);
- }
- }
- return Status.OK_STATUS;
- }
- });
- job.setSystem(true);
- job.schedule();
- return job;
- }
- else {
- try {
- caller.dataFetched(getDataByRec(), null);
- }
- catch (ProcessingException e) {
- caller.dataFetched(null, e);
- }
- return null;
- }
- }
-
- private JobEx createAsyncJob(String name, IJobRunnable runnable) {
- ISessionService service = SERVICES.getService(ISessionService.class);
- if (service == null) {
- return null;
- }
- return service.createAsyncJob(name, runnable);
- }
-
- @Override
- public String toString() {
- StringBuffer b = new StringBuffer(getClass().getSimpleName() + "[");
- if (m_key != null) {
- b.append("key=" + m_key + " ");
- }
- if (m_text != null) {
- b.append("text=" + m_text + " ");
- }
- if (m_all != null) {
- b.append("all=" + m_all + " ");
- }
- if (m_rec != null) {
- b.append("rec=" + m_rec + " ");
- }
- if (m_master != null) {
- b.append("master=" + m_master + " ");
- }
- if (m_maxRowCount > 0) {
- b.append("maxRowCount=" + m_maxRowCount + " ");
- }
- b.append("]");
- return b.toString();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.lookup;
+
+import java.io.Serializable;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.scout.commons.TriState;
+import org.eclipse.scout.commons.annotations.ConfigProperty;
+import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.job.JobEx;
+import org.eclipse.scout.rt.shared.services.common.session.IJobRunnable;
+import org.eclipse.scout.rt.shared.services.common.session.ISessionService;
+import org.eclipse.scout.rt.shared.validate.annotations.MaxLength;
+import org.eclipse.scout.service.SERVICES;
+
+/**
+ * There are 2 variants to use lookup values <br>
+ * a) with a service that yields data (external data, large amount, on database) <br>
+ * b) with data directly generated in the call itself (local data, small amount,
+ * in memory)
+ * <p>
+ * When using (a) the configured property getConfiguredService is non-null <br>
+ * When using (b) the method execCreateLookupRows() is non-empty. The subclass CodeLookupCall is implementing this
+ * method <br>
+ * by using data from a code type (enum).
+ * <p>
+ * The following three examples illustrate these cases
+ * <p>
+ * 1. External data on backend <br>
+ * Service interface: ICompanyLookupService <br>
+ * Service implementation: CompanyLookupService <br>
+ * LookupCall: subclass of LookupCall, for example CompanyLookupCall using ICompanyLookupService
+ * <p>
+ * 2. CodeType (enum) <br>
+ * Service interface: --- <br>
+ * Service implementation: --- <br>
+ * LookupCall: CodeLookupCall(ICodeType enumType), for example new CodeLookupCall(projectStatusCodeType)
+ * <p>
+ * 3. Local data <br>
+ * Service interface: --- <br>
+ * Service implementation: --- <br>
+ * LookupCall: subclass of LocalLookupCall() with implementation of method
+ * {@link LocalLookupCall#execCreateLookupRows()}
+ */
+public class LookupCall implements Cloneable, Serializable {
+ private static final long serialVersionUID = 0L;
+
+ private Object m_key;
+ @MaxLength(2000)
+ private String m_text;
+ private String m_all;
+ private Object m_rec;
+ private Object m_master;
+ private TriState m_active;
+ private int m_maxRowCount;
+ private transient ILookupService m_serviceCached;
+
+ public LookupCall() {
+ m_serviceCached = createLookupService();
+ m_active = TriState.UNDEFINED;
+ }
+
+ /**
+ * Configurator will add get/set for properties
+ */
+
+ /**
+ * Configurator is implementing this method
+ */
+ @ConfigProperty(ConfigProperty.LOOKUP_SERVICE)
+ @ConfigPropertyValue("null")
+ @Order(10)
+ protected Class<? extends ILookupService> getConfiguredService() {
+ return null;
+ }
+
+ /**
+ * @return true if a master value is required for lookups by {@link #getDataByText()} and {@link #getDataByAll()}
+ */
+ @ConfigProperty(ConfigProperty.BOOLEAN)
+ @ConfigPropertyValue("false")
+ @Order(20)
+ protected boolean getConfiguredMasterRequired() {
+ return false;
+ }
+
+ @ConfigProperty(ConfigProperty.DOC)
+ @Order(30)
+ @ConfigPropertyValue("null")
+ protected String getConfiguredDoc() {
+ return null;
+ }
+
+ public ILookupService getLookupService() {
+ if (m_serviceCached == null) {
+ m_serviceCached = createLookupService();
+ }
+ return m_serviceCached;
+ }
+
+ private ILookupService createLookupService() {
+ ILookupService s = null;
+ if (getConfiguredService() != null) {
+ s = SERVICES.getService(getConfiguredService());
+ if (s == null) {
+ throw new IllegalArgumentException("service " + getConfiguredService().getName() + " is either not registered in the clientProxy extension in the plugin.xml or this constructor is called outside the model thread");
+ }
+ }
+ return s;
+ }
+
+ public Object getKey() {
+ return m_key;
+ }
+
+ public long getKeyAsLong() {
+ Object o = getKey();
+ if (o instanceof Number) {
+ return ((Number) o).longValue();
+ }
+ else {
+ return 0;
+ }
+ }
+
+ public void setKey(Object key) {
+ m_key = key;
+ }
+
+ public String getText() {
+ return m_text;
+ }
+
+ public void setText(String s) {
+ m_text = s;
+ }
+
+ public String getAll() {
+ return m_all;
+ }
+
+ public void setAll(String s) {
+ m_all = s;
+ }
+
+ public Object getRec() {
+ return m_rec;
+ }
+
+ public long getRecAsLong() {
+ Object o = getRec();
+ if (o instanceof Number) {
+ return ((Number) o).longValue();
+ }
+ else {
+ return 0;
+ }
+ }
+
+ public void setRec(Object parent) {
+ m_rec = parent;
+ }
+
+ /**
+ * @return {@link TriState#TRUE} if only active rows should be fetched, {@link TriState#FALSE} if only incative rows
+ * should be fetched and {@link TriState#UNDEFINED} if active and inactive rows should be
+ * fetched
+ */
+ public TriState getActive() {
+ return m_active;
+ }
+
+ /**
+ * see {@link #getActive()}
+ */
+ public void setActive(TriState s) {
+ if (s == null) {
+ s = TriState.UNDEFINED;
+ }
+ m_active = s;
+ }
+
+ public Object getMaster() {
+ return m_master;
+ }
+
+ public long getMasterAsLong() {
+ Object o = getMaster();
+ if (o instanceof Number) {
+ return ((Number) o).longValue();
+ }
+ else {
+ return 0;
+ }
+ }
+
+ public void setMaster(Object master) {
+ m_master = master;
+ }
+
+ public int getMaxRowCount() {
+ return m_maxRowCount;
+ }
+
+ public void setMaxRowCount(int n) {
+ m_maxRowCount = n;
+ }
+
+ @Override
+ public Object clone() {
+ LookupCall c = null;
+ try {
+ c = (LookupCall) super.clone();
+ }
+ catch (CloneNotSupportedException e) {
+ }
+ return c;
+ }
+
+ @Override
+ public int hashCode() {
+ return (m_key != null ? m_key.hashCode() : 0) ^ (m_text != null ? m_text.hashCode() : 0) ^ (m_all != null ? m_all.hashCode() : 0);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == null) {
+ return false;
+ }
+ if (obj == this) {
+ return true;
+ }
+ if (obj.getClass() != this.getClass()) {
+ return false;
+ }
+ LookupCall other = (LookupCall) obj;
+ if (this.m_serviceCached != null && other.m_serviceCached != null && this.m_serviceCached != other.m_serviceCached) {
+ return false;
+ }
+ if (!(this.m_key == other.m_key || (this.m_key != null && this.m_key.equals(other.m_key)))) {
+ return false;
+ }
+ if (!(this.m_text == other.m_text || (this.m_text != null && this.m_text.equals(other.m_text)))) {
+ return false;
+ }
+ if (!(this.m_all == other.m_all || (this.m_all != null && this.m_all.equals(other.m_all)))) {
+ return false;
+ }
+ if (!(this.m_rec == other.m_rec || (this.m_rec != null && this.m_rec.equals(other.m_rec)))) {
+ return false;
+ }
+ if (!(this.m_master == other.m_master || (this.m_master != null && this.m_master.equals(other.m_master)))) {
+ return false;
+ }
+ if (!(this.m_active == other.m_active || (this.m_active != null && this.m_active.equals(other.m_active)))) {
+ return false;
+ }
+ if (this.m_maxRowCount != other.m_maxRowCount) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Lookup by performing a "key" filter and activating the <key> tags
+ * <p>
+ * When getConfiguredService is set then delegate call to service, otherwise returns an empty array
+ */
+ public LookupRow[] getDataByKey() throws ProcessingException {
+ if (getKey() == null) {
+ return LookupRow.EMPTY_ARRAY;
+ }
+ if (getLookupService() != null) {
+ return getLookupService().getDataByKey(this);
+ }
+ return LookupRow.EMPTY_ARRAY;
+ }
+
+ /**
+ * Same as {@link #getDataByKey()} but in background.<br>
+ * see {@link ILookupCallFetcher}<br>
+ * {@link ILookupCallFetcher#dataFetched(LookupRow[], ProcessingException)} is
+ * called in the background thread
+ * <p>
+ * Note: background call is only done when lookup call is not a {@link LocalLookupCall}
+ *
+ * @return the created async job if applicable or null
+ */
+ public JobEx getDataByKeyInBackground(final ILookupCallFetcher caller) {
+ if (!(LookupCall.this instanceof LocalLookupCall)) {
+ JobEx job = createAsyncJob(getClass().getSimpleName() + ".getDataByKeyInBackground",
+ new IJobRunnable() {
+ @Override
+ public IStatus run(IProgressMonitor monitor) {
+ try {
+ LookupRow[] rows = getDataByKey();
+ if (!JobEx.isCurrentJobCanceled()) {
+ caller.dataFetched(rows, null);
+ }
+ }
+ catch (ProcessingException e) {
+ if (!e.isInterruption() && !JobEx.isCurrentJobCanceled()) {
+ caller.dataFetched(null, e);
+ }
+ }
+ return Status.OK_STATUS;
+ }
+ });
+ job.setSystem(true);
+ job.schedule();
+ return job;
+ }
+ else {
+ try {
+ caller.dataFetched(getDataByKey(), null);
+ }
+ catch (ProcessingException e) {
+ caller.dataFetched(null, e);
+ }
+ return null;
+ }
+ }
+
+ /**
+ * Lookup by performing a "text" filter and activating the <text> tags
+ * <p>
+ * When getConfiguredService is set then delegate call to service, otherwise return null
+ */
+ public LookupRow[] getDataByText() throws ProcessingException {
+ boolean masterValid = ((!getConfiguredMasterRequired()) || getMaster() != null);
+ if (masterValid && getLookupService() != null) {
+ return getLookupService().getDataByText(this);
+ }
+ else {
+ return LookupRow.EMPTY_ARRAY;
+ }
+ }
+
+ /**
+ * Same as {@link #getDataByText()} but in background.<br>
+ * see {@link ILookupCallFetcher}<br>
+ * {@link ILookupCallFetcher#dataFetched(LookupRow[], ProcessingException)} is
+ * called in the background thread
+ * <p>
+ * Note: background call is only done when lookup call is not a {@link LocalLookupCall}
+ *
+ * @return the created async job if applicable or null
+ */
+ public JobEx getDataByTextInBackground(final ILookupCallFetcher caller) {
+ if (!(LookupCall.this instanceof LocalLookupCall)) {
+ JobEx job = createAsyncJob(getClass().getSimpleName() + ".getDataByTextInBackground", new IJobRunnable() {
+ @Override
+ public IStatus run(IProgressMonitor monitor) {
+ try {
+ LookupRow[] rows = getDataByText();
+ if (!JobEx.isCurrentJobCanceled()) {
+ caller.dataFetched(rows, null);
+ }
+ }
+ catch (ProcessingException e) {
+ if (!e.isInterruption() && !JobEx.isCurrentJobCanceled()) {
+ caller.dataFetched(null, e);
+ }
+ }
+ return Status.OK_STATUS;
+ }
+ });
+ job.setSystem(true);
+ job.schedule();
+ return job;
+ }
+ else {
+ try {
+ caller.dataFetched(getDataByText(), null);
+ }
+ catch (ProcessingException e) {
+ caller.dataFetched(null, e);
+ }
+ return null;
+ }
+ }
+
+ /**
+ * Lookup by performing a "all" filter and activating the <all> tags
+ * <p>
+ * When getConfiguredService is set then delegate call to service, otherwise return null
+ */
+ public LookupRow[] getDataByAll() throws ProcessingException {
+ boolean masterValid = ((!getConfiguredMasterRequired()) || getMaster() != null);
+ if (masterValid && getLookupService() != null) {
+ return getLookupService().getDataByAll(this);
+ }
+ else {
+ return LookupRow.EMPTY_ARRAY;
+ }
+ }
+
+ /**
+ * Same as {@link #getDataByAll()} but in background.<br>
+ * see {@link ILookupCallFetcher}<br>
+ * {@link ILookupCallFetcher#dataFetched(LookupRow[], ProcessingException)} is
+ * called in the background thread
+ * <p>
+ * Note: background call is only done when lookup call is not a {@link LocalLookupCall}
+ *
+ * @return the created async job if applicable or null
+ */
+ public JobEx getDataByAllInBackground(final ILookupCallFetcher caller) {
+ if (!(LookupCall.this instanceof LocalLookupCall)) {
+ JobEx job = createAsyncJob(getClass().getSimpleName() + ".getDataByAllInBackground",
+ new IJobRunnable() {
+ @Override
+ public IStatus run(IProgressMonitor monitor) {
+ try {
+ LookupRow[] rows = getDataByAll();
+ if (!JobEx.isCurrentJobCanceled()) {
+ caller.dataFetched(rows, null);
+ }
+ }
+ catch (ProcessingException e) {
+ if (!e.isInterruption() && !JobEx.isCurrentJobCanceled()) {
+ caller.dataFetched(null, e);
+ }
+ }
+ return Status.OK_STATUS;
+ }
+ });
+ job.setSystem(true);
+ job.schedule();
+ return job;
+ }
+ else {
+ try {
+ caller.dataFetched(getDataByAll(), null);
+ }
+ catch (ProcessingException e) {
+ caller.dataFetched(null, e);
+ }
+ return null;
+ }
+ }
+
+ /**
+ * Lookup by performing a "recursion" filter and activating the <rec> tags
+ * <p>
+ * When getConfiguredService is set then delegate call to service, otherwise return null
+ */
+ public LookupRow[] getDataByRec() throws ProcessingException {
+ if (getLookupService() != null) {
+ return getLookupService().getDataByRec(this);
+ }
+ else {
+ return LookupRow.EMPTY_ARRAY;
+ }
+ }
+
+ /**
+ * Same as {@link #getDataByRec()} but in background.<br>
+ * see {@link ILookupCallFetcher}<br>
+ * {@link ILookupCallFetcher#dataFetched(LookupRow[], ProcessingException)} is
+ * called in the background thread
+ * <p>
+ * Note: background call is only done when lookup call is not a {@link LocalLookupCall}
+ *
+ * @return the created async job if applicable or null
+ */
+ public JobEx getDataByRecInBackground(final ILookupCallFetcher caller) {
+ if (!(LookupCall.this instanceof LocalLookupCall)) {
+ JobEx job = createAsyncJob(getClass().getSimpleName() + ".getDataByRecInBackground",
+ new IJobRunnable() {
+ @Override
+ public IStatus run(IProgressMonitor monitor) {
+ try {
+ LookupRow[] rows = getDataByRec();
+ if (!JobEx.isCurrentJobCanceled()) {
+ caller.dataFetched(rows, null);
+ }
+ }
+ catch (ProcessingException e) {
+ if (!e.isInterruption() && !JobEx.isCurrentJobCanceled()) {
+ caller.dataFetched(null, e);
+ }
+ }
+ return Status.OK_STATUS;
+ }
+ });
+ job.setSystem(true);
+ job.schedule();
+ return job;
+ }
+ else {
+ try {
+ caller.dataFetched(getDataByRec(), null);
+ }
+ catch (ProcessingException e) {
+ caller.dataFetched(null, e);
+ }
+ return null;
+ }
+ }
+
+ private JobEx createAsyncJob(String name, IJobRunnable runnable) {
+ ISessionService service = SERVICES.getService(ISessionService.class);
+ if (service == null) {
+ return null;
+ }
+ return service.createAsyncJob(name, runnable);
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer b = new StringBuffer(getClass().getSimpleName() + "[");
+ if (m_key != null) {
+ b.append("key=" + m_key + " ");
+ }
+ if (m_text != null) {
+ b.append("text=" + m_text + " ");
+ }
+ if (m_all != null) {
+ b.append("all=" + m_all + " ");
+ }
+ if (m_rec != null) {
+ b.append("rec=" + m_rec + " ");
+ }
+ if (m_master != null) {
+ b.append("master=" + m_master + " ");
+ }
+ if (m_maxRowCount > 0) {
+ b.append("maxRowCount=" + m_maxRowCount + " ");
+ }
+ b.append("]");
+ return b.toString();
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/LookupRow.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/LookupRow.java
index e9f07701b4..28cd2c4b0f 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/LookupRow.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/services/lookup/LookupRow.java
@@ -1,291 +1,291 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.services.lookup;
-
-import java.io.Serializable;
-
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.TriState;
-import org.eclipse.scout.rt.shared.data.basic.FontSpec;
-import org.eclipse.scout.rt.shared.data.basic.MemoryOptimizedObject;
-
-public class LookupRow extends MemoryOptimizedObject implements Serializable {
- private static final long serialVersionUID = 0L;
-
- public static final LookupRow[] EMPTY_ARRAY = new LookupRow[0];
-
- public static final int KEY_BIT = 1;
- public static final int TEXT_BIT = 2;
- public static final int ICON_ID_BIT = 3;
- public static final int TOOLTIP_BIT = 4;
- public static final int BACKGROUD_COLOR_BIT = 5;
- public static final int FOREGROUD_COLOR_BIT = 6;
- public static final int FONT_BIT = 7;
- public static final int ENABLED_BIT = 8;
- public static final int PARENT_KEY_BIT = 9;
- public static final int ACTIVE_BIT = 10;
-
- public LookupRow(Object key, String text) {
- this(key, text, null);
- }
-
- public LookupRow(Object key, String text, String iconId) {
- this(key, text, iconId, null);
- }
-
- public LookupRow(Object key, String text, String iconId, String tooltip) {
- this(key, text, iconId, tooltip, null);
- }
-
- public LookupRow(Object key, String text, String iconId, String tooltip, String backgroundColor) {
- this(key, text, iconId, tooltip, backgroundColor, null);
- }
-
- public LookupRow(Object key, String text, String iconId, String tooltip, String backgroundColor, String foregroundColor) {
- this(key, text, iconId, tooltip, backgroundColor, foregroundColor, null);
- }
-
- public LookupRow(Object key, String text, String iconId, String tooltip, String backgroundColor, String foregroundColor, FontSpec font) {
- this(key, text, iconId, tooltip, backgroundColor, foregroundColor, font, true);
- }
-
- public LookupRow(Object key, String text, String iconId, String tooltip, String backgroundColor, String foregroundColor, FontSpec font, boolean enabled) {
- this(key, text, iconId, tooltip, backgroundColor, foregroundColor, font, enabled, null);
- }
-
- public LookupRow(Object key, String text, String iconId, String tooltip, String backgroundColor, String foregroundColor, FontSpec font, boolean enabled, Object parentKey) {
- this(key, text, iconId, tooltip, backgroundColor, foregroundColor, font, enabled, parentKey, true);
- }
-
- public LookupRow(Object key, String text, String iconId, String tooltip, String backgroundColor, String foregroundColor, FontSpec font, boolean enabled, Object parentKey, boolean active) {
- setKey(key);
- setText(text);
- setIconId(iconId);
- setTooltipText(tooltip);
- setBackgroundColor(backgroundColor);
- setForegroundColor(foregroundColor);
- setFont(font);
- setEnabled(enabled);
- setParentKey(parentKey);
- setActive(active);
- }
-
- /**
- * Cell array containing the following values <br>
- * Object key <br>
- * String text <br>
- * String iconId <br>
- * String tooltip <br>
- * String background color <br>
- * String foreground color <br>
- * String font <br>
- * Boolean enabled <br>
- * Object parentKey used in hierarchical structures to point to the parents
- * primary key <br>
- * Boolean active (0,1) see {@link TriState#parseTriState(Object)}
- */
- public LookupRow(Object[] cells) {
- this(cells, (cells == null ? 0 : cells.length));
- }
-
- public LookupRow(Object[] cells, int maxColumnIndex) {
- if (cells != null) {
- int keyIndex = 0, textIndex = 1, iconIndex = 2, ttIndex = 3, bgIndex = 4, fgIndex = 5, fontIndex = 6, enabledIndex = 7, parentKeyIndex = 8, activeIndex = 9;
- //
- if (cells.length > keyIndex && keyIndex <= maxColumnIndex && cells[keyIndex] != null) {
- setKey(cells[keyIndex]);
- }
- if (cells.length > textIndex && textIndex <= maxColumnIndex && cells[textIndex] != null) {
- if (cells[textIndex] != null) {
- setText(cells[textIndex].toString());
- }
- else {
- setText(null);
- }
- }
- if (cells.length > iconIndex && iconIndex <= maxColumnIndex && cells[iconIndex] != null) {
- if (cells[iconIndex] != null) {
- setIconId(cells[iconIndex].toString());
- }
- else {
- setIconId(null);
- }
- }
- if (cells.length > ttIndex && ttIndex <= maxColumnIndex && cells[ttIndex] != null) {
- if (cells[ttIndex] != null) {
- setTooltipText(cells[ttIndex].toString());
- }
- else {
- setTooltipText(null);
- }
- }
- if (cells.length > bgIndex && bgIndex <= maxColumnIndex && cells[bgIndex] != null) {
- if (cells.length > ttIndex && ttIndex <= maxColumnIndex && cells[ttIndex] != null) {
- if (cells[bgIndex] != null) {
- setBackgroundColor(cells[bgIndex].toString());
- }
- else {
- setBackgroundColor(null);
- }
- }
- }
- if (cells.length > fgIndex && fgIndex <= maxColumnIndex && cells[fgIndex] != null) {
- if (cells.length > ttIndex && ttIndex <= maxColumnIndex && cells[ttIndex] != null) {
- if (cells[fgIndex] != null) {
- setForegroundColor(cells[fgIndex].toString());
- }
- else {
- setForegroundColor(null);
- }
- }
- }
- if (cells.length > fontIndex && fontIndex <= maxColumnIndex && cells[fontIndex] != null) {
- if (cells[fontIndex] != null) {
- setFont(FontSpec.parse(cells[fontIndex].toString()));
- }
- else {
- setFont(null);
- }
- }
- if (cells.length > enabledIndex && enabledIndex <= maxColumnIndex && cells[enabledIndex] != null) {
- if (cells[enabledIndex] instanceof Boolean) {
- setEnabled((Boolean) cells[enabledIndex]);
- }
- else if (cells[enabledIndex] instanceof Number) {
- setEnabled(Boolean.valueOf(((Number) cells[enabledIndex]).intValue() != 0));
- }
- }
- if (cells.length > parentKeyIndex && parentKeyIndex <= maxColumnIndex && cells[parentKeyIndex] != null) {
- setParentKey(cells[parentKeyIndex]);
- }
- if (cells.length > activeIndex && activeIndex <= maxColumnIndex && cells[activeIndex] != null) {
- if (cells[activeIndex] instanceof Boolean) {
- setActive((Boolean) cells[activeIndex]);
- }
- else if (cells[activeIndex] instanceof Number) {
- setActive(Boolean.valueOf(((Number) cells[activeIndex]).intValue() != 0));
- }
- }
- }
- }
-
- public Object getKey() {
- return getValueInternal(KEY_BIT);
- }
-
- public void setKey(Object key) {
- setValueInternal(KEY_BIT, key);
- }
-
- public Object getParentKey() {
- return getValueInternal(PARENT_KEY_BIT);
- }
-
- public void setParentKey(Object parentKey) {
- setValueInternal(PARENT_KEY_BIT, parentKey);
- }
-
- public String getText() {
- char[] c = (char[]) getValueInternal(TEXT_BIT);
- return c != null ? new String(c) : null;
- }
-
- public void setText(String text) {
- setValueInternal(TEXT_BIT, text != null ? text.toCharArray() : null);
- }
-
- public String getIconId() {
- return (String) getValueInternal(ICON_ID_BIT);
- }
-
- public void setIconId(String iconId) {
- setValueInternal(ICON_ID_BIT, StringUtility.intern(iconId));
- }
-
- public String getTooltipText() {
- char[] c = (char[]) getValueInternal(TOOLTIP_BIT);
- return c != null ? new String(c) : null;
- }
-
- public void setTooltipText(String tooltip) {
- setValueInternal(TOOLTIP_BIT, tooltip != null ? tooltip.toCharArray() : null);
- }
-
- public String getForegroundColor() {
- return (String) getValueInternal(FOREGROUD_COLOR_BIT);
- }
-
- public void setForegroundColor(String foregroundColor) {
- setValueInternal(FOREGROUD_COLOR_BIT, StringUtility.intern(foregroundColor));
- }
-
- public String getBackgroundColor() {
- return (String) getValueInternal(BACKGROUD_COLOR_BIT);
- }
-
- public void setBackgroundColor(String backgroundColor) {
- setValueInternal(BACKGROUD_COLOR_BIT, StringUtility.intern(backgroundColor));
- }
-
- public FontSpec getFont() {
- String s = (String) getValueInternal(FONT_BIT);
- return s != null ? FontSpec.parse(s) : null;
- }
-
- public void setFont(FontSpec font) {
- setValueInternal(FONT_BIT, font != null ? StringUtility.intern(font.toPattern()) : null);
- }
-
- public boolean isEnabled() {
- if (getValueInternal(ENABLED_BIT) == null) {
- return true;
- }
- return (Boolean) getValueInternal(ENABLED_BIT);
- }
-
- public void setEnabled(boolean enabled) {
- setValueInternal(ENABLED_BIT, enabled ? null : Boolean.FALSE);
- }
-
- public boolean isActive() {
- if (getValueInternal(ACTIVE_BIT) == null) {
- return true;
- }
- return (Boolean) getValueInternal(ACTIVE_BIT);
- }
-
- public void setActive(boolean active) {
- setValueInternal(ACTIVE_BIT, active ? null : Boolean.FALSE);
- }
-
- /**
- * Convenience helper for transforming Object[][] data into CodeRow[] <br>
- * The Object[][] must contain rows with the elements in the following order: <br>
- * see {@link #LookupRow(Object[])}
- */
- public static LookupRow[] createLookupRowArray(Object[][] data) {
- if (data == null || data.length == 0) {
- return LookupRow.EMPTY_ARRAY;
- }
- else {
- LookupRow[] a = new LookupRow[data.length];
- for (int i = 0; i < data.length; i++) {
- a[i] = new LookupRow(data[i]);
- }
- return a;
- }
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName() + "[" + getKey() + ", " + getText() + "]";
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.services.lookup;
+
+import java.io.Serializable;
+
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.TriState;
+import org.eclipse.scout.rt.shared.data.basic.FontSpec;
+import org.eclipse.scout.rt.shared.data.basic.MemoryOptimizedObject;
+
+public class LookupRow extends MemoryOptimizedObject implements Serializable {
+ private static final long serialVersionUID = 0L;
+
+ public static final LookupRow[] EMPTY_ARRAY = new LookupRow[0];
+
+ public static final int KEY_BIT = 1;
+ public static final int TEXT_BIT = 2;
+ public static final int ICON_ID_BIT = 3;
+ public static final int TOOLTIP_BIT = 4;
+ public static final int BACKGROUD_COLOR_BIT = 5;
+ public static final int FOREGROUD_COLOR_BIT = 6;
+ public static final int FONT_BIT = 7;
+ public static final int ENABLED_BIT = 8;
+ public static final int PARENT_KEY_BIT = 9;
+ public static final int ACTIVE_BIT = 10;
+
+ public LookupRow(Object key, String text) {
+ this(key, text, null);
+ }
+
+ public LookupRow(Object key, String text, String iconId) {
+ this(key, text, iconId, null);
+ }
+
+ public LookupRow(Object key, String text, String iconId, String tooltip) {
+ this(key, text, iconId, tooltip, null);
+ }
+
+ public LookupRow(Object key, String text, String iconId, String tooltip, String backgroundColor) {
+ this(key, text, iconId, tooltip, backgroundColor, null);
+ }
+
+ public LookupRow(Object key, String text, String iconId, String tooltip, String backgroundColor, String foregroundColor) {
+ this(key, text, iconId, tooltip, backgroundColor, foregroundColor, null);
+ }
+
+ public LookupRow(Object key, String text, String iconId, String tooltip, String backgroundColor, String foregroundColor, FontSpec font) {
+ this(key, text, iconId, tooltip, backgroundColor, foregroundColor, font, true);
+ }
+
+ public LookupRow(Object key, String text, String iconId, String tooltip, String backgroundColor, String foregroundColor, FontSpec font, boolean enabled) {
+ this(key, text, iconId, tooltip, backgroundColor, foregroundColor, font, enabled, null);
+ }
+
+ public LookupRow(Object key, String text, String iconId, String tooltip, String backgroundColor, String foregroundColor, FontSpec font, boolean enabled, Object parentKey) {
+ this(key, text, iconId, tooltip, backgroundColor, foregroundColor, font, enabled, parentKey, true);
+ }
+
+ public LookupRow(Object key, String text, String iconId, String tooltip, String backgroundColor, String foregroundColor, FontSpec font, boolean enabled, Object parentKey, boolean active) {
+ setKey(key);
+ setText(text);
+ setIconId(iconId);
+ setTooltipText(tooltip);
+ setBackgroundColor(backgroundColor);
+ setForegroundColor(foregroundColor);
+ setFont(font);
+ setEnabled(enabled);
+ setParentKey(parentKey);
+ setActive(active);
+ }
+
+ /**
+ * Cell array containing the following values <br>
+ * Object key <br>
+ * String text <br>
+ * String iconId <br>
+ * String tooltip <br>
+ * String background color <br>
+ * String foreground color <br>
+ * String font <br>
+ * Boolean enabled <br>
+ * Object parentKey used in hierarchical structures to point to the parents
+ * primary key <br>
+ * Boolean active (0,1) see {@link TriState#parseTriState(Object)}
+ */
+ public LookupRow(Object[] cells) {
+ this(cells, (cells == null ? 0 : cells.length));
+ }
+
+ public LookupRow(Object[] cells, int maxColumnIndex) {
+ if (cells != null) {
+ int keyIndex = 0, textIndex = 1, iconIndex = 2, ttIndex = 3, bgIndex = 4, fgIndex = 5, fontIndex = 6, enabledIndex = 7, parentKeyIndex = 8, activeIndex = 9;
+ //
+ if (cells.length > keyIndex && keyIndex <= maxColumnIndex && cells[keyIndex] != null) {
+ setKey(cells[keyIndex]);
+ }
+ if (cells.length > textIndex && textIndex <= maxColumnIndex && cells[textIndex] != null) {
+ if (cells[textIndex] != null) {
+ setText(cells[textIndex].toString());
+ }
+ else {
+ setText(null);
+ }
+ }
+ if (cells.length > iconIndex && iconIndex <= maxColumnIndex && cells[iconIndex] != null) {
+ if (cells[iconIndex] != null) {
+ setIconId(cells[iconIndex].toString());
+ }
+ else {
+ setIconId(null);
+ }
+ }
+ if (cells.length > ttIndex && ttIndex <= maxColumnIndex && cells[ttIndex] != null) {
+ if (cells[ttIndex] != null) {
+ setTooltipText(cells[ttIndex].toString());
+ }
+ else {
+ setTooltipText(null);
+ }
+ }
+ if (cells.length > bgIndex && bgIndex <= maxColumnIndex && cells[bgIndex] != null) {
+ if (cells.length > ttIndex && ttIndex <= maxColumnIndex && cells[ttIndex] != null) {
+ if (cells[bgIndex] != null) {
+ setBackgroundColor(cells[bgIndex].toString());
+ }
+ else {
+ setBackgroundColor(null);
+ }
+ }
+ }
+ if (cells.length > fgIndex && fgIndex <= maxColumnIndex && cells[fgIndex] != null) {
+ if (cells.length > ttIndex && ttIndex <= maxColumnIndex && cells[ttIndex] != null) {
+ if (cells[fgIndex] != null) {
+ setForegroundColor(cells[fgIndex].toString());
+ }
+ else {
+ setForegroundColor(null);
+ }
+ }
+ }
+ if (cells.length > fontIndex && fontIndex <= maxColumnIndex && cells[fontIndex] != null) {
+ if (cells[fontIndex] != null) {
+ setFont(FontSpec.parse(cells[fontIndex].toString()));
+ }
+ else {
+ setFont(null);
+ }
+ }
+ if (cells.length > enabledIndex && enabledIndex <= maxColumnIndex && cells[enabledIndex] != null) {
+ if (cells[enabledIndex] instanceof Boolean) {
+ setEnabled((Boolean) cells[enabledIndex]);
+ }
+ else if (cells[enabledIndex] instanceof Number) {
+ setEnabled(Boolean.valueOf(((Number) cells[enabledIndex]).intValue() != 0));
+ }
+ }
+ if (cells.length > parentKeyIndex && parentKeyIndex <= maxColumnIndex && cells[parentKeyIndex] != null) {
+ setParentKey(cells[parentKeyIndex]);
+ }
+ if (cells.length > activeIndex && activeIndex <= maxColumnIndex && cells[activeIndex] != null) {
+ if (cells[activeIndex] instanceof Boolean) {
+ setActive((Boolean) cells[activeIndex]);
+ }
+ else if (cells[activeIndex] instanceof Number) {
+ setActive(Boolean.valueOf(((Number) cells[activeIndex]).intValue() != 0));
+ }
+ }
+ }
+ }
+
+ public Object getKey() {
+ return getValueInternal(KEY_BIT);
+ }
+
+ public void setKey(Object key) {
+ setValueInternal(KEY_BIT, key);
+ }
+
+ public Object getParentKey() {
+ return getValueInternal(PARENT_KEY_BIT);
+ }
+
+ public void setParentKey(Object parentKey) {
+ setValueInternal(PARENT_KEY_BIT, parentKey);
+ }
+
+ public String getText() {
+ char[] c = (char[]) getValueInternal(TEXT_BIT);
+ return c != null ? new String(c) : null;
+ }
+
+ public void setText(String text) {
+ setValueInternal(TEXT_BIT, text != null ? text.toCharArray() : null);
+ }
+
+ public String getIconId() {
+ return (String) getValueInternal(ICON_ID_BIT);
+ }
+
+ public void setIconId(String iconId) {
+ setValueInternal(ICON_ID_BIT, StringUtility.intern(iconId));
+ }
+
+ public String getTooltipText() {
+ char[] c = (char[]) getValueInternal(TOOLTIP_BIT);
+ return c != null ? new String(c) : null;
+ }
+
+ public void setTooltipText(String tooltip) {
+ setValueInternal(TOOLTIP_BIT, tooltip != null ? tooltip.toCharArray() : null);
+ }
+
+ public String getForegroundColor() {
+ return (String) getValueInternal(FOREGROUD_COLOR_BIT);
+ }
+
+ public void setForegroundColor(String foregroundColor) {
+ setValueInternal(FOREGROUD_COLOR_BIT, StringUtility.intern(foregroundColor));
+ }
+
+ public String getBackgroundColor() {
+ return (String) getValueInternal(BACKGROUD_COLOR_BIT);
+ }
+
+ public void setBackgroundColor(String backgroundColor) {
+ setValueInternal(BACKGROUD_COLOR_BIT, StringUtility.intern(backgroundColor));
+ }
+
+ public FontSpec getFont() {
+ String s = (String) getValueInternal(FONT_BIT);
+ return s != null ? FontSpec.parse(s) : null;
+ }
+
+ public void setFont(FontSpec font) {
+ setValueInternal(FONT_BIT, font != null ? StringUtility.intern(font.toPattern()) : null);
+ }
+
+ public boolean isEnabled() {
+ if (getValueInternal(ENABLED_BIT) == null) {
+ return true;
+ }
+ return (Boolean) getValueInternal(ENABLED_BIT);
+ }
+
+ public void setEnabled(boolean enabled) {
+ setValueInternal(ENABLED_BIT, enabled ? null : Boolean.FALSE);
+ }
+
+ public boolean isActive() {
+ if (getValueInternal(ACTIVE_BIT) == null) {
+ return true;
+ }
+ return (Boolean) getValueInternal(ACTIVE_BIT);
+ }
+
+ public void setActive(boolean active) {
+ setValueInternal(ACTIVE_BIT, active ? null : Boolean.FALSE);
+ }
+
+ /**
+ * Convenience helper for transforming Object[][] data into CodeRow[] <br>
+ * The Object[][] must contain rows with the elements in the following order: <br>
+ * see {@link #LookupRow(Object[])}
+ */
+ public static LookupRow[] createLookupRowArray(Object[][] data) {
+ if (data == null || data.length == 0) {
+ return LookupRow.EMPTY_ARRAY;
+ }
+ else {
+ LookupRow[] a = new LookupRow[data.length];
+ for (int i = 0; i < data.length; i++) {
+ a[i] = new LookupRow(data[i]);
+ }
+ return a;
+ }
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + "[" + getKey() + ", " + getText() + "]";
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/DebugInputStream.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/DebugInputStream.java
index edab4c6e97..59d535224c 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/DebugInputStream.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/DebugInputStream.java
@@ -1,89 +1,89 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.servicetunnel;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.UnsupportedEncodingException;
-
-/**
- * Serialization override<br>
- * used partly to make Date's timezone independent using StaticDate class
- */
-public class DebugInputStream extends InputStream {
- private InputStream m_in;
- private ByteArrayOutputStream m_debugOut;
- private int m_lastReadCharacter;
- private Throwable m_lastThrownException;
-
- public DebugInputStream(InputStream in) throws IOException {
- m_in = in;
- m_debugOut = new ByteArrayOutputStream();
- }
-
- public String getContent(String encoding) throws UnsupportedEncodingException {
- return new String(m_debugOut.toByteArray(), encoding);
- }
-
- @Override
- public int available() throws IOException {
- return m_in.available();
- }
-
- @Override
- public void close() throws IOException {
- m_in.close();
- m_debugOut.close();
- }
-
- @Override
- public synchronized void mark(int readlimit) {
- m_in.mark(readlimit);
- }
-
- @Override
- public boolean markSupported() {
- return m_in.markSupported();
- }
-
- @Override
- public int read() throws IOException {
- try {
- m_lastReadCharacter = m_in.read();
- m_debugOut.write((char) m_lastReadCharacter);
- return m_lastReadCharacter;
- }
- catch (IOException ioe) {
- m_lastThrownException = ioe;
- throw ioe;
- }
- }
-
- @Override
- public synchronized void reset() throws IOException {
- m_in.reset();
- }
-
- @Override
- public long skip(long n) throws IOException {
- return m_in.skip(n);
- }
-
- public int getLastReadCharacter() {
- return m_lastReadCharacter;
- }
-
- public Throwable getLastThrownException() {
- return m_lastThrownException;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.servicetunnel;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+
+/**
+ * Serialization override<br>
+ * used partly to make Date's timezone independent using StaticDate class
+ */
+public class DebugInputStream extends InputStream {
+ private InputStream m_in;
+ private ByteArrayOutputStream m_debugOut;
+ private int m_lastReadCharacter;
+ private Throwable m_lastThrownException;
+
+ public DebugInputStream(InputStream in) throws IOException {
+ m_in = in;
+ m_debugOut = new ByteArrayOutputStream();
+ }
+
+ public String getContent(String encoding) throws UnsupportedEncodingException {
+ return new String(m_debugOut.toByteArray(), encoding);
+ }
+
+ @Override
+ public int available() throws IOException {
+ return m_in.available();
+ }
+
+ @Override
+ public void close() throws IOException {
+ m_in.close();
+ m_debugOut.close();
+ }
+
+ @Override
+ public synchronized void mark(int readlimit) {
+ m_in.mark(readlimit);
+ }
+
+ @Override
+ public boolean markSupported() {
+ return m_in.markSupported();
+ }
+
+ @Override
+ public int read() throws IOException {
+ try {
+ m_lastReadCharacter = m_in.read();
+ m_debugOut.write((char) m_lastReadCharacter);
+ return m_lastReadCharacter;
+ }
+ catch (IOException ioe) {
+ m_lastThrownException = ioe;
+ throw ioe;
+ }
+ }
+
+ @Override
+ public synchronized void reset() throws IOException {
+ m_in.reset();
+ }
+
+ @Override
+ public long skip(long n) throws IOException {
+ return m_in.skip(n);
+ }
+
+ public int getLastReadCharacter() {
+ return m_lastReadCharacter;
+ }
+
+ public Throwable getLastThrownException() {
+ return m_lastThrownException;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/DebugOutputStream.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/DebugOutputStream.java
index ad9ab77ef5..dfabd00fa1 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/DebugOutputStream.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/DebugOutputStream.java
@@ -1,68 +1,68 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.servicetunnel;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
-
-/**
- * Serialization override<br>
- * used partly to make Date's timezone independent using StaticDate class
- */
-public class DebugOutputStream extends OutputStream {
- private OutputStream m_out;
- private ByteArrayOutputStream m_debugOut;
- private int m_lastWrittenCharacter;
- private Throwable m_lastThrownException;
-
- public DebugOutputStream(OutputStream out) throws IOException {
- m_out = out;
- m_debugOut = new ByteArrayOutputStream();
- }
-
- public String getContent(String encoding) throws UnsupportedEncodingException {
- return new String(m_debugOut.toByteArray(), encoding);
- }
-
- @Override
- public void write(int b) throws IOException {
- m_lastWrittenCharacter = b;
- try {
- m_out.write(m_lastWrittenCharacter);
- // debug
- m_debugOut.write((char) m_lastWrittenCharacter);
- }
- catch (IOException ioe) {
- m_lastThrownException = ioe;
- }
- }
-
- @Override
- public void flush() throws IOException {
- m_out.flush();
- }
-
- @Override
- public void close() throws IOException {
- m_out.close();
- m_debugOut.close();
- }
-
- public int getLastWrittenCharacter() {
- return m_lastWrittenCharacter;
- }
-
- public Throwable getLastThrownException() {
- return m_lastThrownException;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.servicetunnel;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
+
+/**
+ * Serialization override<br>
+ * used partly to make Date's timezone independent using StaticDate class
+ */
+public class DebugOutputStream extends OutputStream {
+ private OutputStream m_out;
+ private ByteArrayOutputStream m_debugOut;
+ private int m_lastWrittenCharacter;
+ private Throwable m_lastThrownException;
+
+ public DebugOutputStream(OutputStream out) throws IOException {
+ m_out = out;
+ m_debugOut = new ByteArrayOutputStream();
+ }
+
+ public String getContent(String encoding) throws UnsupportedEncodingException {
+ return new String(m_debugOut.toByteArray(), encoding);
+ }
+
+ @Override
+ public void write(int b) throws IOException {
+ m_lastWrittenCharacter = b;
+ try {
+ m_out.write(m_lastWrittenCharacter);
+ // debug
+ m_debugOut.write((char) m_lastWrittenCharacter);
+ }
+ catch (IOException ioe) {
+ m_lastThrownException = ioe;
+ }
+ }
+
+ @Override
+ public void flush() throws IOException {
+ m_out.flush();
+ }
+
+ @Override
+ public void close() throws IOException {
+ m_out.close();
+ m_debugOut.close();
+ }
+
+ public int getLastWrittenCharacter() {
+ return m_lastWrittenCharacter;
+ }
+
+ public Throwable getLastThrownException() {
+ return m_lastThrownException;
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/DefaultServiceTunnelContentHandler.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/DefaultServiceTunnelContentHandler.java
index 6ab001f3eb..9a6767991b 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/DefaultServiceTunnelContentHandler.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/DefaultServiceTunnelContentHandler.java
@@ -1,500 +1,500 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.servicetunnel;
-
-import java.io.BufferedReader;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.Reader;
-import java.io.UnsupportedEncodingException;
-import java.net.InetAddress;
-import java.security.Principal;
-import java.util.ArrayList;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import java.util.zip.Deflater;
-import java.util.zip.DeflaterOutputStream;
-import java.util.zip.Inflater;
-import java.util.zip.InflaterInputStream;
-
-import javax.security.auth.Subject;
-
-import org.eclipse.scout.commons.Base64Utility;
-import org.eclipse.scout.commons.EncryptionUtility;
-import org.eclipse.scout.commons.EventListenerList;
-import org.eclipse.scout.commons.SoapHandlingUtility;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.shared.Activator;
-import org.osgi.framework.Bundle;
-
-/**
- * Creates SOAP envelopes for {@link ServiceTunnelRequest} and {@link ServiceTunnelResponse} objects.<br>
- * Use config.ini property org.eclipse.scout.rt.shared.servicetunnel.debug=true
- * to activate debug info
- * <p>
- * This fast hi-speed encoder/decoder ignores xml structure and reads content of first &lt;data&gt; tag directly.
- * <p>
- * Example request:
- *
- * <pre>
- * @code
- * <?xml version="1.0" encoding="UTF-8"?>
- * <soapenv:Envelope soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
- * <soapenv:Body>
- * <request version="3.0.0" format="de_CH" language="de_CH" service="org.eclipse.scout.rt.shared.services.common.ping.IPingService" operation="ping"/>
- * <data>...</data>
- * <info ts="20080715114301917" origin="192.168.1.105">For maximum performance, data is reduced, compressed and base64 encoded.</info>
- * </soapenv:Body>
- * </soapenv:Envelope>
- * }
- * </pre>
- *
- * Example response (success):
- *
- * <pre>
- * @code
- * <?xml version="1.0" encoding="UTF-8"?>
- * <soapenv:Envelope soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
- * <soapenv:Body>
- * <response status="OK" type="String"/>
- * <data>...</data>
- * <info ts="20080715114301917" origin="192.168.3.2">For maximum performance, data is reduced, compressed and base64 encoded.</info>
- * </soapenv:Body>
- * </soapenv:Envelope>
- * }
- * </pre>
- *
- * Example response (error):
- *
- * <pre>
- * @code
- * <?xml version="1.0" encoding="UTF-8"?>
- * <soapenv:Envelope soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
- * <soapenv:Body>
- * <response status="ERROR">
- * <exception type="SecurityException">Access denied</exception>
- * </response>
- * <data>...</data>
- * <info ts="20080715114301917" origin="192.168.3.2">For maximum performance, data is reduced, compressed and base64 encoded.</info>
- * </soapenv:Body>
- * </soapenv:Envelope>
- * }
- * </pre>
- *
- * In order to enable/disable content compression, use the system property or config.ini property:
- * <code>org.eclipse.scout.serviceTunnel.compress=true</code>
- * <p>
- * If the client side sets this property to true, all client data is sent to the server with compressed data (false
- * accordingly).<br>
- * If the client side does not set this property at all, data is sent to server in the same mode as it is received from
- * the server.<br>
- * Same is valid for the server side.
- * <p>
- * The default is true.
- * <p>
- * To enable debug output only for this class, use logger specific parameters. When using the "simple" scout log manager
- * you may add the following property to the config.ini or as a system property:
- * <code>scout.log.level.org.eclipse.scout.rt.shared.servicetunnel.DefaultServiceTunnelContentHandler=4</code>
- * <p>
- */
-public class DefaultServiceTunnelContentHandler implements IServiceTunnelContentHandler {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(DefaultServiceTunnelContentHandler.class);
- private static final Pattern BEGIN_DATA_TAG = Pattern.compile("[<]([a-zA-Z0-9]+:)?data\\s*>");
- private static final Pattern END_DATA_TAG = Pattern.compile("[<][/]([a-zA-Z0-9]+:)?data\\s*>");
- private static final Pattern COMPRESSED_ATTRIBUTE = Pattern.compile("compressed\\s*=\\s*\"(true|false)\"");
-
- private static Boolean COMPRESS;
-
- static {
- String compressText = null;
- if (Activator.getDefault() != null) {
- compressText = Activator.getDefault().getBundle().getBundleContext().getProperty("org.eclipse.scout.serviceTunnel.compress");
- }
- if ("true".equals(compressText)) {
- COMPRESS = true;
- }
- else if ("false".equals(compressText)) {
- COMPRESS = false;
- }
- else {
- COMPRESS = null;
- }
- }
-
- private Bundle[] m_bundleList;
- private String m_originAddress;
- private Boolean m_sendCompressed;
- private Boolean m_receivedCompressed;
- private final EventListenerList m_listeners;
-
- public DefaultServiceTunnelContentHandler() {
- m_listeners = new EventListenerList();
- }
-
- @Override
- public void initialize(Bundle[] classResolveBundles, ClassLoader rawClassLoader) {
- m_bundleList = classResolveBundles;
- try {
- m_originAddress = InetAddress.getLocalHost().getHostAddress();
- }
- catch (Throwable t) {
- // nop
- }
- m_sendCompressed = COMPRESS;
- }
-
- @Override
- public void writeRequest(OutputStream out, ServiceTunnelRequest msg) throws Exception {
- // build soap message without sax (hi-speed)
- boolean compressed = isUseCompression();
- StringBuilder buf = new StringBuilder();
- String wsse = createWsSecurityElement(msg);
- if (wsse == null) {
- wsse = "";
- }
- buf.append("<soapenv:Envelope soapenv:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:wsse=\"http://schemas.xmlsoap.org/ws/2002/04/secext\">\n");
- buf.append("<soapenv:Header>");
- buf.append(wsse);
- buf.append("</soapenv:Header>\n");
- buf.append("<soapenv:Body>\n");
- buf.append(" <request version=\"");
- buf.append(msg.getVersion());
- buf.append("\" compressed=\"");
- buf.append(compressed);
- buf.append("\" locale=\"");
- buf.append(msg.getLocale().toString());
- buf.append("\" service=\"");
- buf.append(msg.getServiceInterfaceClassName());
- buf.append("\" operation=\"");
- buf.append(msg.getOperation());
- buf.append("\"/>\n");
- buf.append(" <data>");
- long y = System.nanoTime();
- setData(buf, msg, compressed);
- y = System.nanoTime() - y;
- if (LOG.isDebugEnabled()) {
- LOG.debug("message encoding took " + y + " nanoseconds");
- }
- buf.append("</data>\n");
- buf.append(" <info");
- buf.append(" origin=\"" + m_originAddress + "\"");
- buf.append("/>\n");
- buf.append("</soapenv:Body>");
- buf.append("</soapenv:Envelope>");
- //
- if (LOG.isDebugEnabled()) {
- out = new DebugOutputStream(out);
- }
- try {
- out.write(buf.toString().getBytes("UTF-8"));
- }
- finally {
- if (LOG.isDebugEnabled()) {
- String sentData = ((DebugOutputStream) out).getContent("UTF-8");
- int lastWrittenCharacter = ((DebugOutputStream) out).getLastWrittenCharacter();
- Throwable lastThrownException = ((DebugOutputStream) out).getLastThrownException();
- LOG.debug("lastWrittenCharacter=" + lastWrittenCharacter + ",lastThrownException=" + lastThrownException + ", sentData: " + sentData);
- }
- }
- }
-
- @Override
- public void writeResponse(OutputStream out, ServiceTunnelResponse msg) throws Exception {
- // build soap message without sax (hi-speed)
- boolean compressed = isUseCompression();
- StringBuilder buf = new StringBuilder();
- buf.append("<soapenv:Envelope soapenv:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">\n");
- buf.append("<soapenv:Body>\n");
- if (msg.getException() == null) {
- buf.append(" <response status=\"OK\"");
- Object x = msg.getData();
- if (x != null) {
- buf.append(" type=\"" + x.getClass().getSimpleName() + "\"");
- }
- else {
- buf.append(" type=\"\"");
- }
- buf.append(" compressed=\"" + compressed + "\"");
- buf.append("/>\n");
- }
- else {
- buf.append(" <response status=\"ERROR\"");
- buf.append(" compressed=\"" + compressed + "\"");
- buf.append(">\n");
- buf.append(" <exception type=\"" + msg.getException().getClass().getSimpleName() + "\">");
- buf.append(msg.getException().getMessage());
- buf.append("</exception>\n");
- buf.append(" </response>\n");
- }
- buf.append(" <data>");
- long y = System.nanoTime();
- setData(buf, msg, compressed);
- y = System.nanoTime() - y;
- if (LOG.isDebugEnabled()) {
- LOG.debug("message encoding took " + y + " nanoseconds");
- }
- buf.append("</data>\n");
- buf.append(" <info");
- buf.append(" origin=\"" + m_originAddress + "\"");
- buf.append("/>\n");
- buf.append("</soapenv:Body>");
- buf.append("</soapenv:Envelope>");
- //
- if (LOG.isDebugEnabled()) {
- out = new DebugOutputStream(out);
- }
- try {
- out.write(buf.toString().getBytes("UTF-8"));
- }
- finally {
- if (LOG.isDebugEnabled()) {
- String sentData = ((DebugOutputStream) out).getContent("UTF-8");
- int lastWrittenCharacter = ((DebugOutputStream) out).getLastWrittenCharacter();
- Throwable lastThrownException = ((DebugOutputStream) out).getLastThrownException();
- LOG.debug("lastWrittenCharacter=" + lastWrittenCharacter + ",lastThrownException=" + lastThrownException + ", sentData: " + sentData);
- }
- }
- }
-
- protected void setData(StringBuilder buf, Object msg, boolean compressed) throws IOException {
- Deflater deflater = null;
- ServiceTunnelOutputStream serialout = null;
- try {
- // build serialized data
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- if (compressed) {
- deflater = new Deflater(Deflater.BEST_SPEED);
- DeflaterOutputStream deflaterStream = new DeflaterOutputStream(bos, deflater);
- serialout = new ServiceTunnelOutputStream(deflaterStream);
- serialout.writeObject(msg);
- serialout.flush();
- deflaterStream.finish();
- serialout.close();
- serialout = null;
- }
- else {
- serialout = new ServiceTunnelOutputStream(bos);
- serialout.writeObject(msg);
- serialout.flush();
- serialout.close();
- serialout = null;
- }
- String base64Data = StringUtility.wrapText(Base64Utility.encode(bos.toByteArray()), 10000);
- buf.append(base64Data);
- }
- finally {
- if (serialout != null) {
- try {
- serialout.close();
- }
- catch (Throwable fatal) {
- }
- }
- if (deflater != null) {
- try {
- deflater.end();
- }
- catch (Throwable fatal) {
- }
- }
- }
- }
-
- @Override
- public ServiceTunnelRequest readRequest(InputStream in) throws Exception {
- return (ServiceTunnelRequest) read(in);
- }
-
- @Override
- public ServiceTunnelResponse readResponse(InputStream in) throws Exception {
- return (ServiceTunnelResponse) read(in);
- }
-
- protected Object/* msg */read(InputStream in) throws Exception {
- if (LOG.isDebugEnabled()) {
- in = new DebugInputStream(in);
- }
- String dataPart = null;
- boolean compressed = true;
- try {
- Reader r = new BufferedReader(new InputStreamReader(in, "UTF-8"));
- StringBuilder buf = new StringBuilder();
- int ch;
- while ((ch = r.read()) >= 0) {
- buf.append((char) ch);
- }
- String xml = buf.toString();
- buf.setLength(0);
- //get the 'compressed' attribute
- Matcher mc = COMPRESSED_ATTRIBUTE.matcher(xml);
- if (mc.find()) {
- compressed = mc.group(1).equals("true");
- m_receivedCompressed = compressed;
- }
- // simply get the content of <ns:data>{?}</ns:data> or <data>{?}</data>
- Matcher m1 = BEGIN_DATA_TAG.matcher(xml);
- Matcher m2 = END_DATA_TAG.matcher(xml);
- int lastMatchingIndex = 0;
- if (m1.find() && m2.find(m1.start())) {
- do { // we want to be sure that we match the last </data> tag of the
- // message
- lastMatchingIndex = m2.start();
- }
- while (m2.find());
- dataPart = xml.substring(m1.end(), lastMatchingIndex);
- }
- else {
- throw new IOException("missing a data tag");
- }
- }
- finally {
- if (LOG.isDebugEnabled()) {
- String receivedData = ((DebugInputStream) in).getContent("UTF-8");
- int lastReadCharacter = ((DebugInputStream) in).getLastReadCharacter();
- Throwable lastThrownException = ((DebugInputStream) in).getLastThrownException();
- LOG.debug("lastReadCharacter=" + lastReadCharacter + ",lastThrownException=" + lastThrownException + ", receivedData:\n" + receivedData);
- }
- }
- long y = System.nanoTime();
- Object res = getData(dataPart, compressed);
- y = System.nanoTime() - y;
- if (LOG.isDebugEnabled()) {
- LOG.debug("message decoding took " + y + " nanoseconds");
- }
- return res;
- }
-
- protected Object getData(String dataPart, boolean compressed) throws IOException, ClassNotFoundException {
- Inflater inflater = null;
- ServiceTunnelInputStream serialin = null;
- try {
- String base64Data = dataPart.replaceAll("[\\n\\r]", "");
- // decode serial data
- if (compressed) {
- inflater = new Inflater();
- InflaterInputStream inflaterStream = new InflaterInputStream(new ByteArrayInputStream(Base64Utility.decode(base64Data)), inflater);
- serialin = new ServiceTunnelInputStream(inflaterStream, m_bundleList);
- return serialin.readObject();
- }
- else {
- InputStream in = new ByteArrayInputStream(Base64Utility.decode(base64Data));
- serialin = new ServiceTunnelInputStream(in, m_bundleList);
- return serialin.readObject();
- }
- }
- finally {
- if (serialin != null) {
- try {
- serialin.close();
- }
- catch (Throwable fatal) {
- }
- }
- if (inflater != null) {
- try {
- inflater.end();
- }
- catch (Throwable fatal) {
- }
- }
- }
- }
-
- protected boolean isUseCompression() {
- if (m_sendCompressed != null) {
- return m_sendCompressed;
- }
- if (m_receivedCompressed != null) {
- return m_receivedCompressed;
- }
- return true;
- }
-
- /**
- * @return the wsse:Security tag. The subject may be null and may contain no principals
- * <p>
- * Example WS-Security element for user/pass
- *
- * <pre>
- * <wsse:Security soapenv:mustUnderstand="1">
- * <wsse:UsernameToken>
- * <wsse:Username>user</wsse:Username>
- * <wsse:Password Type="http://scout.eclipse.org/security#Base64">ertwtrwet3465t4</wsse:Password>
- * </wsse:UsernameToken>
- * </wsse:Security>
- * </pre>
- * <p>
- * The default calls
- * {@link DefaultServiceTunnelContentHandler#createDefaultWsSecurityElement(ServiceTunnelRequest)}
- */
- protected String createWsSecurityElement(ServiceTunnelRequest req) {
- return DefaultServiceTunnelContentHandler.createDefaultWsSecurityElement(req);
- }
-
- private static final byte[] tripleDesKey;
- static {
- String key = Activator.getDefault().getBundle().getBundleContext().getProperty("scout.ajax.token.key");
- if (key == null) {
- tripleDesKey = null;
- }
- else {
- tripleDesKey = new byte[24];
- byte[] keyBytes;
- try {
- keyBytes = key.getBytes("UTF-8");
- System.arraycopy(keyBytes, 0, tripleDesKey, 0, Math.min(keyBytes.length, tripleDesKey.length));
- }
- catch (UnsupportedEncodingException e) {
- LOG.error("reading property 'scout.ajax.token.key'", e);
- }
- }
- }
-
- /**
- * @return a soap wsse username token. The username is the principal name of the first pricnipal,
- * the password is the triple-des encoding of "${timestamp}:${username}" using the config.ini parameter
- * <code>scout.ajax.token.key</code>
- */
- public static final String createDefaultWsSecurityElement(ServiceTunnelRequest req) {
- if (tripleDesKey == null) {
- return null;
- }
- Subject subject = req.getClientSubject();
- if (subject == null || subject.getPrincipals().size() == 0) {
- return null;
- }
- ArrayList<Principal> list = new ArrayList<Principal>(subject.getPrincipals());
- String user = (list.size() > 0 ? list.get(0).getName() : null);
- String pass = (list.size() > 1 ? list.get(1).getName() : null);
- if (user == null) {
- user = "";
- }
- if (pass == null) {
- pass = "";
- }
- String msg = "" + System.currentTimeMillis() + ":" + user;
- try {
- byte[] token;
- token = EncryptionUtility.encrypt(msg.getBytes("UTF-8"), tripleDesKey);
- return SoapHandlingUtility.createWsSecurityUserNameToken(user, token);
- }
- catch (UnsupportedEncodingException e) {
- LOG.error("utf-8 decode failed", e);
- }
- return null;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.servicetunnel;
+
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.io.UnsupportedEncodingException;
+import java.net.InetAddress;
+import java.security.Principal;
+import java.util.ArrayList;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.zip.Deflater;
+import java.util.zip.DeflaterOutputStream;
+import java.util.zip.Inflater;
+import java.util.zip.InflaterInputStream;
+
+import javax.security.auth.Subject;
+
+import org.eclipse.scout.commons.Base64Utility;
+import org.eclipse.scout.commons.EncryptionUtility;
+import org.eclipse.scout.commons.EventListenerList;
+import org.eclipse.scout.commons.SoapHandlingUtility;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.shared.Activator;
+import org.osgi.framework.Bundle;
+
+/**
+ * Creates SOAP envelopes for {@link ServiceTunnelRequest} and {@link ServiceTunnelResponse} objects.<br>
+ * Use config.ini property org.eclipse.scout.rt.shared.servicetunnel.debug=true
+ * to activate debug info
+ * <p>
+ * This fast hi-speed encoder/decoder ignores xml structure and reads content of first &lt;data&gt; tag directly.
+ * <p>
+ * Example request:
+ *
+ * <pre>
+ * @code
+ * <?xml version="1.0" encoding="UTF-8"?>
+ * <soapenv:Envelope soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
+ * <soapenv:Body>
+ * <request version="3.0.0" format="de_CH" language="de_CH" service="org.eclipse.scout.rt.shared.services.common.ping.IPingService" operation="ping"/>
+ * <data>...</data>
+ * <info ts="20080715114301917" origin="192.168.1.105">For maximum performance, data is reduced, compressed and base64 encoded.</info>
+ * </soapenv:Body>
+ * </soapenv:Envelope>
+ * }
+ * </pre>
+ *
+ * Example response (success):
+ *
+ * <pre>
+ * @code
+ * <?xml version="1.0" encoding="UTF-8"?>
+ * <soapenv:Envelope soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
+ * <soapenv:Body>
+ * <response status="OK" type="String"/>
+ * <data>...</data>
+ * <info ts="20080715114301917" origin="192.168.3.2">For maximum performance, data is reduced, compressed and base64 encoded.</info>
+ * </soapenv:Body>
+ * </soapenv:Envelope>
+ * }
+ * </pre>
+ *
+ * Example response (error):
+ *
+ * <pre>
+ * @code
+ * <?xml version="1.0" encoding="UTF-8"?>
+ * <soapenv:Envelope soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
+ * <soapenv:Body>
+ * <response status="ERROR">
+ * <exception type="SecurityException">Access denied</exception>
+ * </response>
+ * <data>...</data>
+ * <info ts="20080715114301917" origin="192.168.3.2">For maximum performance, data is reduced, compressed and base64 encoded.</info>
+ * </soapenv:Body>
+ * </soapenv:Envelope>
+ * }
+ * </pre>
+ *
+ * In order to enable/disable content compression, use the system property or config.ini property:
+ * <code>org.eclipse.scout.serviceTunnel.compress=true</code>
+ * <p>
+ * If the client side sets this property to true, all client data is sent to the server with compressed data (false
+ * accordingly).<br>
+ * If the client side does not set this property at all, data is sent to server in the same mode as it is received from
+ * the server.<br>
+ * Same is valid for the server side.
+ * <p>
+ * The default is true.
+ * <p>
+ * To enable debug output only for this class, use logger specific parameters. When using the "simple" scout log manager
+ * you may add the following property to the config.ini or as a system property:
+ * <code>scout.log.level.org.eclipse.scout.rt.shared.servicetunnel.DefaultServiceTunnelContentHandler=4</code>
+ * <p>
+ */
+public class DefaultServiceTunnelContentHandler implements IServiceTunnelContentHandler {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(DefaultServiceTunnelContentHandler.class);
+ private static final Pattern BEGIN_DATA_TAG = Pattern.compile("[<]([a-zA-Z0-9]+:)?data\\s*>");
+ private static final Pattern END_DATA_TAG = Pattern.compile("[<][/]([a-zA-Z0-9]+:)?data\\s*>");
+ private static final Pattern COMPRESSED_ATTRIBUTE = Pattern.compile("compressed\\s*=\\s*\"(true|false)\"");
+
+ private static Boolean COMPRESS;
+
+ static {
+ String compressText = null;
+ if (Activator.getDefault() != null) {
+ compressText = Activator.getDefault().getBundle().getBundleContext().getProperty("org.eclipse.scout.serviceTunnel.compress");
+ }
+ if ("true".equals(compressText)) {
+ COMPRESS = true;
+ }
+ else if ("false".equals(compressText)) {
+ COMPRESS = false;
+ }
+ else {
+ COMPRESS = null;
+ }
+ }
+
+ private Bundle[] m_bundleList;
+ private String m_originAddress;
+ private Boolean m_sendCompressed;
+ private Boolean m_receivedCompressed;
+ private final EventListenerList m_listeners;
+
+ public DefaultServiceTunnelContentHandler() {
+ m_listeners = new EventListenerList();
+ }
+
+ @Override
+ public void initialize(Bundle[] classResolveBundles, ClassLoader rawClassLoader) {
+ m_bundleList = classResolveBundles;
+ try {
+ m_originAddress = InetAddress.getLocalHost().getHostAddress();
+ }
+ catch (Throwable t) {
+ // nop
+ }
+ m_sendCompressed = COMPRESS;
+ }
+
+ @Override
+ public void writeRequest(OutputStream out, ServiceTunnelRequest msg) throws Exception {
+ // build soap message without sax (hi-speed)
+ boolean compressed = isUseCompression();
+ StringBuilder buf = new StringBuilder();
+ String wsse = createWsSecurityElement(msg);
+ if (wsse == null) {
+ wsse = "";
+ }
+ buf.append("<soapenv:Envelope soapenv:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:wsse=\"http://schemas.xmlsoap.org/ws/2002/04/secext\">\n");
+ buf.append("<soapenv:Header>");
+ buf.append(wsse);
+ buf.append("</soapenv:Header>\n");
+ buf.append("<soapenv:Body>\n");
+ buf.append(" <request version=\"");
+ buf.append(msg.getVersion());
+ buf.append("\" compressed=\"");
+ buf.append(compressed);
+ buf.append("\" locale=\"");
+ buf.append(msg.getLocale().toString());
+ buf.append("\" service=\"");
+ buf.append(msg.getServiceInterfaceClassName());
+ buf.append("\" operation=\"");
+ buf.append(msg.getOperation());
+ buf.append("\"/>\n");
+ buf.append(" <data>");
+ long y = System.nanoTime();
+ setData(buf, msg, compressed);
+ y = System.nanoTime() - y;
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("message encoding took " + y + " nanoseconds");
+ }
+ buf.append("</data>\n");
+ buf.append(" <info");
+ buf.append(" origin=\"" + m_originAddress + "\"");
+ buf.append("/>\n");
+ buf.append("</soapenv:Body>");
+ buf.append("</soapenv:Envelope>");
+ //
+ if (LOG.isDebugEnabled()) {
+ out = new DebugOutputStream(out);
+ }
+ try {
+ out.write(buf.toString().getBytes("UTF-8"));
+ }
+ finally {
+ if (LOG.isDebugEnabled()) {
+ String sentData = ((DebugOutputStream) out).getContent("UTF-8");
+ int lastWrittenCharacter = ((DebugOutputStream) out).getLastWrittenCharacter();
+ Throwable lastThrownException = ((DebugOutputStream) out).getLastThrownException();
+ LOG.debug("lastWrittenCharacter=" + lastWrittenCharacter + ",lastThrownException=" + lastThrownException + ", sentData: " + sentData);
+ }
+ }
+ }
+
+ @Override
+ public void writeResponse(OutputStream out, ServiceTunnelResponse msg) throws Exception {
+ // build soap message without sax (hi-speed)
+ boolean compressed = isUseCompression();
+ StringBuilder buf = new StringBuilder();
+ buf.append("<soapenv:Envelope soapenv:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">\n");
+ buf.append("<soapenv:Body>\n");
+ if (msg.getException() == null) {
+ buf.append(" <response status=\"OK\"");
+ Object x = msg.getData();
+ if (x != null) {
+ buf.append(" type=\"" + x.getClass().getSimpleName() + "\"");
+ }
+ else {
+ buf.append(" type=\"\"");
+ }
+ buf.append(" compressed=\"" + compressed + "\"");
+ buf.append("/>\n");
+ }
+ else {
+ buf.append(" <response status=\"ERROR\"");
+ buf.append(" compressed=\"" + compressed + "\"");
+ buf.append(">\n");
+ buf.append(" <exception type=\"" + msg.getException().getClass().getSimpleName() + "\">");
+ buf.append(msg.getException().getMessage());
+ buf.append("</exception>\n");
+ buf.append(" </response>\n");
+ }
+ buf.append(" <data>");
+ long y = System.nanoTime();
+ setData(buf, msg, compressed);
+ y = System.nanoTime() - y;
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("message encoding took " + y + " nanoseconds");
+ }
+ buf.append("</data>\n");
+ buf.append(" <info");
+ buf.append(" origin=\"" + m_originAddress + "\"");
+ buf.append("/>\n");
+ buf.append("</soapenv:Body>");
+ buf.append("</soapenv:Envelope>");
+ //
+ if (LOG.isDebugEnabled()) {
+ out = new DebugOutputStream(out);
+ }
+ try {
+ out.write(buf.toString().getBytes("UTF-8"));
+ }
+ finally {
+ if (LOG.isDebugEnabled()) {
+ String sentData = ((DebugOutputStream) out).getContent("UTF-8");
+ int lastWrittenCharacter = ((DebugOutputStream) out).getLastWrittenCharacter();
+ Throwable lastThrownException = ((DebugOutputStream) out).getLastThrownException();
+ LOG.debug("lastWrittenCharacter=" + lastWrittenCharacter + ",lastThrownException=" + lastThrownException + ", sentData: " + sentData);
+ }
+ }
+ }
+
+ protected void setData(StringBuilder buf, Object msg, boolean compressed) throws IOException {
+ Deflater deflater = null;
+ ServiceTunnelOutputStream serialout = null;
+ try {
+ // build serialized data
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ if (compressed) {
+ deflater = new Deflater(Deflater.BEST_SPEED);
+ DeflaterOutputStream deflaterStream = new DeflaterOutputStream(bos, deflater);
+ serialout = new ServiceTunnelOutputStream(deflaterStream);
+ serialout.writeObject(msg);
+ serialout.flush();
+ deflaterStream.finish();
+ serialout.close();
+ serialout = null;
+ }
+ else {
+ serialout = new ServiceTunnelOutputStream(bos);
+ serialout.writeObject(msg);
+ serialout.flush();
+ serialout.close();
+ serialout = null;
+ }
+ String base64Data = StringUtility.wrapText(Base64Utility.encode(bos.toByteArray()), 10000);
+ buf.append(base64Data);
+ }
+ finally {
+ if (serialout != null) {
+ try {
+ serialout.close();
+ }
+ catch (Throwable fatal) {
+ }
+ }
+ if (deflater != null) {
+ try {
+ deflater.end();
+ }
+ catch (Throwable fatal) {
+ }
+ }
+ }
+ }
+
+ @Override
+ public ServiceTunnelRequest readRequest(InputStream in) throws Exception {
+ return (ServiceTunnelRequest) read(in);
+ }
+
+ @Override
+ public ServiceTunnelResponse readResponse(InputStream in) throws Exception {
+ return (ServiceTunnelResponse) read(in);
+ }
+
+ protected Object/* msg */read(InputStream in) throws Exception {
+ if (LOG.isDebugEnabled()) {
+ in = new DebugInputStream(in);
+ }
+ String dataPart = null;
+ boolean compressed = true;
+ try {
+ Reader r = new BufferedReader(new InputStreamReader(in, "UTF-8"));
+ StringBuilder buf = new StringBuilder();
+ int ch;
+ while ((ch = r.read()) >= 0) {
+ buf.append((char) ch);
+ }
+ String xml = buf.toString();
+ buf.setLength(0);
+ //get the 'compressed' attribute
+ Matcher mc = COMPRESSED_ATTRIBUTE.matcher(xml);
+ if (mc.find()) {
+ compressed = mc.group(1).equals("true");
+ m_receivedCompressed = compressed;
+ }
+ // simply get the content of <ns:data>{?}</ns:data> or <data>{?}</data>
+ Matcher m1 = BEGIN_DATA_TAG.matcher(xml);
+ Matcher m2 = END_DATA_TAG.matcher(xml);
+ int lastMatchingIndex = 0;
+ if (m1.find() && m2.find(m1.start())) {
+ do { // we want to be sure that we match the last </data> tag of the
+ // message
+ lastMatchingIndex = m2.start();
+ }
+ while (m2.find());
+ dataPart = xml.substring(m1.end(), lastMatchingIndex);
+ }
+ else {
+ throw new IOException("missing a data tag");
+ }
+ }
+ finally {
+ if (LOG.isDebugEnabled()) {
+ String receivedData = ((DebugInputStream) in).getContent("UTF-8");
+ int lastReadCharacter = ((DebugInputStream) in).getLastReadCharacter();
+ Throwable lastThrownException = ((DebugInputStream) in).getLastThrownException();
+ LOG.debug("lastReadCharacter=" + lastReadCharacter + ",lastThrownException=" + lastThrownException + ", receivedData:\n" + receivedData);
+ }
+ }
+ long y = System.nanoTime();
+ Object res = getData(dataPart, compressed);
+ y = System.nanoTime() - y;
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("message decoding took " + y + " nanoseconds");
+ }
+ return res;
+ }
+
+ protected Object getData(String dataPart, boolean compressed) throws IOException, ClassNotFoundException {
+ Inflater inflater = null;
+ ServiceTunnelInputStream serialin = null;
+ try {
+ String base64Data = dataPart.replaceAll("[\\n\\r]", "");
+ // decode serial data
+ if (compressed) {
+ inflater = new Inflater();
+ InflaterInputStream inflaterStream = new InflaterInputStream(new ByteArrayInputStream(Base64Utility.decode(base64Data)), inflater);
+ serialin = new ServiceTunnelInputStream(inflaterStream, m_bundleList);
+ return serialin.readObject();
+ }
+ else {
+ InputStream in = new ByteArrayInputStream(Base64Utility.decode(base64Data));
+ serialin = new ServiceTunnelInputStream(in, m_bundleList);
+ return serialin.readObject();
+ }
+ }
+ finally {
+ if (serialin != null) {
+ try {
+ serialin.close();
+ }
+ catch (Throwable fatal) {
+ }
+ }
+ if (inflater != null) {
+ try {
+ inflater.end();
+ }
+ catch (Throwable fatal) {
+ }
+ }
+ }
+ }
+
+ protected boolean isUseCompression() {
+ if (m_sendCompressed != null) {
+ return m_sendCompressed;
+ }
+ if (m_receivedCompressed != null) {
+ return m_receivedCompressed;
+ }
+ return true;
+ }
+
+ /**
+ * @return the wsse:Security tag. The subject may be null and may contain no principals
+ * <p>
+ * Example WS-Security element for user/pass
+ *
+ * <pre>
+ * <wsse:Security soapenv:mustUnderstand="1">
+ * <wsse:UsernameToken>
+ * <wsse:Username>user</wsse:Username>
+ * <wsse:Password Type="http://scout.eclipse.org/security#Base64">ertwtrwet3465t4</wsse:Password>
+ * </wsse:UsernameToken>
+ * </wsse:Security>
+ * </pre>
+ * <p>
+ * The default calls
+ * {@link DefaultServiceTunnelContentHandler#createDefaultWsSecurityElement(ServiceTunnelRequest)}
+ */
+ protected String createWsSecurityElement(ServiceTunnelRequest req) {
+ return DefaultServiceTunnelContentHandler.createDefaultWsSecurityElement(req);
+ }
+
+ private static final byte[] tripleDesKey;
+ static {
+ String key = Activator.getDefault().getBundle().getBundleContext().getProperty("scout.ajax.token.key");
+ if (key == null) {
+ tripleDesKey = null;
+ }
+ else {
+ tripleDesKey = new byte[24];
+ byte[] keyBytes;
+ try {
+ keyBytes = key.getBytes("UTF-8");
+ System.arraycopy(keyBytes, 0, tripleDesKey, 0, Math.min(keyBytes.length, tripleDesKey.length));
+ }
+ catch (UnsupportedEncodingException e) {
+ LOG.error("reading property 'scout.ajax.token.key'", e);
+ }
+ }
+ }
+
+ /**
+ * @return a soap wsse username token. The username is the principal name of the first pricnipal,
+ * the password is the triple-des encoding of "${timestamp}:${username}" using the config.ini parameter
+ * <code>scout.ajax.token.key</code>
+ */
+ public static final String createDefaultWsSecurityElement(ServiceTunnelRequest req) {
+ if (tripleDesKey == null) {
+ return null;
+ }
+ Subject subject = req.getClientSubject();
+ if (subject == null || subject.getPrincipals().size() == 0) {
+ return null;
+ }
+ ArrayList<Principal> list = new ArrayList<Principal>(subject.getPrincipals());
+ String user = (list.size() > 0 ? list.get(0).getName() : null);
+ String pass = (list.size() > 1 ? list.get(1).getName() : null);
+ if (user == null) {
+ user = "";
+ }
+ if (pass == null) {
+ pass = "";
+ }
+ String msg = "" + System.currentTimeMillis() + ":" + user;
+ try {
+ byte[] token;
+ token = EncryptionUtility.encrypt(msg.getBytes("UTF-8"), tripleDesKey);
+ return SoapHandlingUtility.createWsSecurityUserNameToken(user, token);
+ }
+ catch (UnsupportedEncodingException e) {
+ LOG.error("utf-8 decode failed", e);
+ }
+ return null;
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/HttpException.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/HttpException.java
index ba60a0216b..19f0c63573 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/HttpException.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/HttpException.java
@@ -1,81 +1,81 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.servicetunnel;
-
-public class HttpException extends Exception {
- private static final long serialVersionUID = 1L;
-
- private int m_statusCode;
-
- public static String getNameFor(int statusCode) {
- switch (statusCode) {
- case 400:
- return "BAD_REQUEST";
- case 401:
- return "UNAUTHORIZED";
- case 402:
- return "PAYMENT_REQUIRED";
- case 403:
- return "FORBIDDEN";
- case 404:
- return "NOT_FOUND";
- case 405:
- return "METHOD_NOT_ALLOWED";
- case 406:
- return "NOT_ACCEPTABLE";
- case 407:
- return "PROXY_AUTHENTICATION_REQUIRED";
- case 408:
- return "REQUEST_TIMEOUT";
- case 409:
- return "CONFLICT";
- case 410:
- return "GONE";
- case 411:
- return "LENGTH_REQUIRED";
- case 412:
- return "PRECONDITION_FAILED";
- case 413:
- return "REQUEST_ENTITY_TOO_LARGE";
- case 414:
- return "REQUEST_URI_TOO_LONG";
- case 415:
- return "UNSUPPORTED_MEDIA_TYPE";
- case 416:
- return "REQUESTED_RANGE_NOT_SATISFIABLE";
- case 417:
- return "EXPECTATION_FAILED";
- case 500:
- return "INTERNAL_SERVER_ERROR";
- case 501:
- return "NOT_IMPLEMENTED";
- case 502:
- return "BAD_GATEWAY";
- case 503:
- return "SERVICE_UNAVAILABLE";
- case 504:
- return "GATEWAY_TIMEOUT";
- case 505:
- return "HTTP_VERSION_NOT_SUPPORTED";
- default:
- return "?";
- }
- }
-
- public HttpException(int statusCode) {
- super("" + statusCode + " - " + getNameFor(statusCode));
- m_statusCode = statusCode;
- }
-
- public int getStatusCode() {
- return m_statusCode;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.servicetunnel;
+
+public class HttpException extends Exception {
+ private static final long serialVersionUID = 1L;
+
+ private int m_statusCode;
+
+ public static String getNameFor(int statusCode) {
+ switch (statusCode) {
+ case 400:
+ return "BAD_REQUEST";
+ case 401:
+ return "UNAUTHORIZED";
+ case 402:
+ return "PAYMENT_REQUIRED";
+ case 403:
+ return "FORBIDDEN";
+ case 404:
+ return "NOT_FOUND";
+ case 405:
+ return "METHOD_NOT_ALLOWED";
+ case 406:
+ return "NOT_ACCEPTABLE";
+ case 407:
+ return "PROXY_AUTHENTICATION_REQUIRED";
+ case 408:
+ return "REQUEST_TIMEOUT";
+ case 409:
+ return "CONFLICT";
+ case 410:
+ return "GONE";
+ case 411:
+ return "LENGTH_REQUIRED";
+ case 412:
+ return "PRECONDITION_FAILED";
+ case 413:
+ return "REQUEST_ENTITY_TOO_LARGE";
+ case 414:
+ return "REQUEST_URI_TOO_LONG";
+ case 415:
+ return "UNSUPPORTED_MEDIA_TYPE";
+ case 416:
+ return "REQUESTED_RANGE_NOT_SATISFIABLE";
+ case 417:
+ return "EXPECTATION_FAILED";
+ case 500:
+ return "INTERNAL_SERVER_ERROR";
+ case 501:
+ return "NOT_IMPLEMENTED";
+ case 502:
+ return "BAD_GATEWAY";
+ case 503:
+ return "SERVICE_UNAVAILABLE";
+ case 504:
+ return "GATEWAY_TIMEOUT";
+ case 505:
+ return "HTTP_VERSION_NOT_SUPPORTED";
+ default:
+ return "?";
+ }
+ }
+
+ public HttpException(int statusCode) {
+ super("" + statusCode + " - " + getNameFor(statusCode));
+ m_statusCode = statusCode;
+ }
+
+ public int getStatusCode() {
+ return m_statusCode;
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/IServiceTunnelContentHandler.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/IServiceTunnelContentHandler.java
index dab77cf9f6..c2232237b3 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/IServiceTunnelContentHandler.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/IServiceTunnelContentHandler.java
@@ -1,41 +1,41 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.servicetunnel;
-
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import org.eclipse.scout.commons.osgi.BundleInspector;
-import org.osgi.framework.Bundle;
-
-/**
- * This is the content handler that defines the format in which data is
- * exchanged through a service tunnel.
- * <p>
- * Most implementations also implement {@link IServiceTunnelContentObserver}
- */
-public interface IServiceTunnelContentHandler {
-
- /**
- * @param classresolveBundles
- * is often created using {@link BundleInspector#getOrderedBundleList(String...)}
- */
- void initialize(Bundle[] classResolveBundles, ClassLoader rawClassLoader);
-
- void writeRequest(OutputStream out, ServiceTunnelRequest msg) throws Exception;
-
- ServiceTunnelRequest readRequest(InputStream in) throws Exception;
-
- void writeResponse(OutputStream out, ServiceTunnelResponse msg) throws Exception;
-
- ServiceTunnelResponse readResponse(InputStream in) throws Exception;
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.servicetunnel;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import org.eclipse.scout.commons.osgi.BundleInspector;
+import org.osgi.framework.Bundle;
+
+/**
+ * This is the content handler that defines the format in which data is
+ * exchanged through a service tunnel.
+ * <p>
+ * Most implementations also implement {@link IServiceTunnelContentObserver}
+ */
+public interface IServiceTunnelContentHandler {
+
+ /**
+ * @param classresolveBundles
+ * is often created using {@link BundleInspector#getOrderedBundleList(String...)}
+ */
+ void initialize(Bundle[] classResolveBundles, ClassLoader rawClassLoader);
+
+ void writeRequest(OutputStream out, ServiceTunnelRequest msg) throws Exception;
+
+ ServiceTunnelRequest readRequest(InputStream in) throws Exception;
+
+ void writeResponse(OutputStream out, ServiceTunnelResponse msg) throws Exception;
+
+ ServiceTunnelResponse readResponse(InputStream in) throws Exception;
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/LenientPermissionWrapper.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/LenientPermissionWrapper.java
index 871b8dd953..81cca03a0d 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/LenientPermissionWrapper.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/LenientPermissionWrapper.java
@@ -1,91 +1,91 @@
-package org.eclipse.scout.rt.shared.servicetunnel;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.ObjectStreamClass;
-import java.io.Serializable;
-import java.security.Permission;
-import java.security.Permissions;
-
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.commons.osgi.BundleObjectInputStream;
-
-/**
- * Wrapper for {@link Permissions} that is serialize safe.
- * This is useful to transfer permission collections that may contain permissions not known by the consumer.
- * This wrapper simply ignores those.
- */
-public class LenientPermissionWrapper implements Serializable {
- private static final long serialVersionUID = 1L;
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(LenientPermissionWrapper.class);
-
- /*
- * do NOT change this field name, it is used as text in readObject and writeObject
- */
- private Permission m_permission;
- /*
- * do NOT change this field name, it is used as text in readObject and writeObject
- */
- private String m_className;
-
- public LenientPermissionWrapper(Permission p) {
- m_permission = p;
- m_className = p.getClass().getName();
- }
-
- public Permission getPermission() {
- return m_permission;
- }
-
- /**
- * @serialData Default fields.
- */
- private void writeObject(ObjectOutputStream out) throws IOException {
- //no call to defaultWriteObject
- ByteArrayOutputStream bout = new ByteArrayOutputStream();
- ObjectOutputStream localOut = new ObjectOutputStream(bout);
- try {
- localOut.writeObject(m_permission);
- }
- finally {
- localOut.close();
- }
- byte[] data = bout.toByteArray();
- //
- ObjectOutputStream.PutField pfields = out.putFields();
- pfields.put("m_className", m_className);
- pfields.put("m_permission", data);
- out.writeFields();
- }
-
- private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
- //no call to defaultReadObject
- try {
- ObjectInputStream.GetField gfields = in.readFields();
- m_className = (String) gfields.get("m_className", (String) null);
- byte[] data = (byte[]) gfields.get("m_permission", (byte[]) null);
- //
- final BundleObjectInputStream bundleIn = (in instanceof BundleObjectInputStream ? (BundleObjectInputStream) in : null);
- ObjectInputStream localIn = new ObjectInputStream(new ByteArrayInputStream(data)) {
- @Override
- protected Class<?> resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException {
- return bundleIn != null ? bundleIn.resolveClass(desc) : Class.forName(desc.getName());
- }
- };
- try {
- m_permission = (Permission) localIn.readObject();
- }
- finally {
- localIn.close();
- }
- }
- catch (Throwable t) {
- LOG.warn("cannot deserialize permission", t);
- }
- }
-
-}
+package org.eclipse.scout.rt.shared.servicetunnel;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.ObjectStreamClass;
+import java.io.Serializable;
+import java.security.Permission;
+import java.security.Permissions;
+
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.commons.osgi.BundleObjectInputStream;
+
+/**
+ * Wrapper for {@link Permissions} that is serialize safe.
+ * This is useful to transfer permission collections that may contain permissions not known by the consumer.
+ * This wrapper simply ignores those.
+ */
+public class LenientPermissionWrapper implements Serializable {
+ private static final long serialVersionUID = 1L;
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(LenientPermissionWrapper.class);
+
+ /*
+ * do NOT change this field name, it is used as text in readObject and writeObject
+ */
+ private Permission m_permission;
+ /*
+ * do NOT change this field name, it is used as text in readObject and writeObject
+ */
+ private String m_className;
+
+ public LenientPermissionWrapper(Permission p) {
+ m_permission = p;
+ m_className = p.getClass().getName();
+ }
+
+ public Permission getPermission() {
+ return m_permission;
+ }
+
+ /**
+ * @serialData Default fields.
+ */
+ private void writeObject(ObjectOutputStream out) throws IOException {
+ //no call to defaultWriteObject
+ ByteArrayOutputStream bout = new ByteArrayOutputStream();
+ ObjectOutputStream localOut = new ObjectOutputStream(bout);
+ try {
+ localOut.writeObject(m_permission);
+ }
+ finally {
+ localOut.close();
+ }
+ byte[] data = bout.toByteArray();
+ //
+ ObjectOutputStream.PutField pfields = out.putFields();
+ pfields.put("m_className", m_className);
+ pfields.put("m_permission", data);
+ out.writeFields();
+ }
+
+ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ //no call to defaultReadObject
+ try {
+ ObjectInputStream.GetField gfields = in.readFields();
+ m_className = (String) gfields.get("m_className", (String) null);
+ byte[] data = (byte[]) gfields.get("m_permission", (byte[]) null);
+ //
+ final BundleObjectInputStream bundleIn = (in instanceof BundleObjectInputStream ? (BundleObjectInputStream) in : null);
+ ObjectInputStream localIn = new ObjectInputStream(new ByteArrayInputStream(data)) {
+ @Override
+ protected Class<?> resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException {
+ return bundleIn != null ? bundleIn.resolveClass(desc) : Class.forName(desc.getName());
+ }
+ };
+ try {
+ m_permission = (Permission) localIn.readObject();
+ }
+ finally {
+ localIn.close();
+ }
+ }
+ catch (Throwable t) {
+ LOG.warn("cannot deserialize permission", t);
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/LenientPermissionsWrapper.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/LenientPermissionsWrapper.java
index 96b4c99324..4a65961b4a 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/LenientPermissionsWrapper.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/LenientPermissionsWrapper.java
@@ -1,72 +1,72 @@
-package org.eclipse.scout.rt.shared.servicetunnel;
-
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.Serializable;
-import java.security.Permission;
-import java.security.Permissions;
-import java.util.ArrayList;
-import java.util.Enumeration;
-
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-
-/**
- * Wrapper for {@link Permissions} that is serialize safe.
- * This is useful to transfer permission collections that may contain permissions not known by the consumer.
- * This wrapper simply ignores those.
- */
-public class LenientPermissionsWrapper implements Serializable {
- private static final long serialVersionUID = 1L;
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(LenientPermissionsWrapper.class);
-
- /*
- * do NOT change this field name, it is used as text in readObject and writeObject
- */
- private Permissions m_permissions;
-
- public LenientPermissionsWrapper(Permissions p) {
- m_permissions = p;
- }
-
- public Permissions getPermissions() {
- return m_permissions;
- }
-
- /**
- * @serialData Default fields.
- */
- private void writeObject(ObjectOutputStream out) throws IOException {
- //no call to defaultWriteObject
- ObjectOutputStream.PutField pfields = out.putFields();
- ArrayList<LenientPermissionWrapper> list = null;
- if (m_permissions != null) {
- list = new ArrayList<LenientPermissionWrapper>();
- for (Enumeration<Permission> en = m_permissions.elements(); en.hasMoreElements();) {
- Permission perm = en.nextElement();
- if (perm != null) {
- list.add(new LenientPermissionWrapper(perm));
- }
- }
- }
- pfields.put("m_permissions", list);
- out.writeFields();
- }
-
- @SuppressWarnings("unchecked")
- private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
- //no call to defaultReadObject
- m_permissions = new Permissions();
- ObjectInputStream.GetField gfields = in.readFields();
- ArrayList<LenientPermissionWrapper> list = (ArrayList<LenientPermissionWrapper>) gfields.get("m_permissions", (ArrayList<LenientPermissionWrapper>) null);
- if (list != null) {
- for (LenientPermissionWrapper w : list) {
- if (w.getPermission() != null) {
- m_permissions.add(w.getPermission());
- }
- }
- }
- }
-
-}
+package org.eclipse.scout.rt.shared.servicetunnel;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.security.Permission;
+import java.security.Permissions;
+import java.util.ArrayList;
+import java.util.Enumeration;
+
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+
+/**
+ * Wrapper for {@link Permissions} that is serialize safe.
+ * This is useful to transfer permission collections that may contain permissions not known by the consumer.
+ * This wrapper simply ignores those.
+ */
+public class LenientPermissionsWrapper implements Serializable {
+ private static final long serialVersionUID = 1L;
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(LenientPermissionsWrapper.class);
+
+ /*
+ * do NOT change this field name, it is used as text in readObject and writeObject
+ */
+ private Permissions m_permissions;
+
+ public LenientPermissionsWrapper(Permissions p) {
+ m_permissions = p;
+ }
+
+ public Permissions getPermissions() {
+ return m_permissions;
+ }
+
+ /**
+ * @serialData Default fields.
+ */
+ private void writeObject(ObjectOutputStream out) throws IOException {
+ //no call to defaultWriteObject
+ ObjectOutputStream.PutField pfields = out.putFields();
+ ArrayList<LenientPermissionWrapper> list = null;
+ if (m_permissions != null) {
+ list = new ArrayList<LenientPermissionWrapper>();
+ for (Enumeration<Permission> en = m_permissions.elements(); en.hasMoreElements();) {
+ Permission perm = en.nextElement();
+ if (perm != null) {
+ list.add(new LenientPermissionWrapper(perm));
+ }
+ }
+ }
+ pfields.put("m_permissions", list);
+ out.writeFields();
+ }
+
+ @SuppressWarnings("unchecked")
+ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ //no call to defaultReadObject
+ m_permissions = new Permissions();
+ ObjectInputStream.GetField gfields = in.readFields();
+ ArrayList<LenientPermissionWrapper> list = (ArrayList<LenientPermissionWrapper>) gfields.get("m_permissions", (ArrayList<LenientPermissionWrapper>) null);
+ if (list != null) {
+ for (LenientPermissionWrapper w : list) {
+ if (w.getPermission() != null) {
+ m_permissions.add(w.getPermission());
+ }
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/RemoteServiceAccessDenied.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/RemoteServiceAccessDenied.java
index 9f439d0f6a..cc6f0b6a05 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/RemoteServiceAccessDenied.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/RemoteServiceAccessDenied.java
@@ -1,32 +1,32 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.servicetunnel;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import org.eclipse.scout.rt.shared.security.RemoteServiceAccessPermission;
-
-/**
- * By default remote service access is denied.
- * <p>
- * In some cases it is useful to grant remote access to a service with the exception of one or two methods. Then this
- * annotation is used.
- * <p>
- * This annotation finally disables access to the method (all methods if placed on the type level) and ignores any
- * present {@link RemoteServiceAccessPermission}s.
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.METHOD, ElementType.TYPE})
-public @interface RemoteServiceAccessDenied {
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.servicetunnel;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.eclipse.scout.rt.shared.security.RemoteServiceAccessPermission;
+
+/**
+ * By default remote service access is denied.
+ * <p>
+ * In some cases it is useful to grant remote access to a service with the exception of one or two methods. Then this
+ * annotation is used.
+ * <p>
+ * This annotation finally disables access to the method (all methods if placed on the type level) and ignores any
+ * present {@link RemoteServiceAccessPermission}s.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.METHOD, ElementType.TYPE})
+public @interface RemoteServiceAccessDenied {
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/ServiceTunnelAccessDenied.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/ServiceTunnelAccessDenied.java
index 3da6c9dcbb..3650408434 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/ServiceTunnelAccessDenied.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/ServiceTunnelAccessDenied.java
@@ -1,25 +1,25 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.servicetunnel;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * @deprecated use {@link RemoteServiceAccessDenied}
- */
-@Deprecated
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.METHOD, ElementType.TYPE})
-public @interface ServiceTunnelAccessDenied {
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.servicetunnel;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * @deprecated use {@link RemoteServiceAccessDenied}
+ */
+@Deprecated
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.METHOD, ElementType.TYPE})
+public @interface ServiceTunnelAccessDenied {
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/ServiceTunnelInputStream.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/ServiceTunnelInputStream.java
index ff97f601b7..23f4ba61fe 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/ServiceTunnelInputStream.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/ServiceTunnelInputStream.java
@@ -1,40 +1,40 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.servicetunnel;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import org.eclipse.scout.commons.osgi.BundleObjectInputStream;
-import org.osgi.framework.Bundle;
-
-/**
- * Serialization override<br>
- * used to make Date's timezone independent using StaticDate class
- * and lazy (convenient) permissions loading using {@link LenientPermissionsWrapper}
- */
-public class ServiceTunnelInputStream extends BundleObjectInputStream {
-
- public ServiceTunnelInputStream(InputStream in, Bundle[] bundleList) throws IOException {
- super(in, bundleList);
- }
-
- @Override
- protected Object resolveObject(Object obj) throws IOException {
- if (obj instanceof StaticDate) {
- return ((StaticDate) obj).getDate();
- }
- if (obj instanceof LenientPermissionsWrapper) {
- return ((LenientPermissionsWrapper) obj).getPermissions();
- }
- return super.resolveObject(obj);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.servicetunnel;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.eclipse.scout.commons.osgi.BundleObjectInputStream;
+import org.osgi.framework.Bundle;
+
+/**
+ * Serialization override<br>
+ * used to make Date's timezone independent using StaticDate class
+ * and lazy (convenient) permissions loading using {@link LenientPermissionsWrapper}
+ */
+public class ServiceTunnelInputStream extends BundleObjectInputStream {
+
+ public ServiceTunnelInputStream(InputStream in, Bundle[] bundleList) throws IOException {
+ super(in, bundleList);
+ }
+
+ @Override
+ protected Object resolveObject(Object obj) throws IOException {
+ if (obj instanceof StaticDate) {
+ return ((StaticDate) obj).getDate();
+ }
+ if (obj instanceof LenientPermissionsWrapper) {
+ return ((LenientPermissionsWrapper) obj).getPermissions();
+ }
+ return super.resolveObject(obj);
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/ServiceTunnelOutputStream.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/ServiceTunnelOutputStream.java
index c9b0a94d94..35d04e6459 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/ServiceTunnelOutputStream.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/ServiceTunnelOutputStream.java
@@ -1,45 +1,45 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.servicetunnel;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.security.Permissions;
-import java.util.Date;
-
-import org.eclipse.scout.commons.UTCDate;
-import org.eclipse.scout.commons.osgi.BundleObjectOutputStream;
-
-/**
- * Serialization override<br>
- * used partly to make Date's timezone independent using StaticDate class
- * <p>
- * {@link UTCDate}s are not converted and pass unchanged.
- * <p>
- * converts {@link Permissions} to {@link LenientPermissionsWrapper}
- */
-public class ServiceTunnelOutputStream extends BundleObjectOutputStream {
-
- public ServiceTunnelOutputStream(OutputStream out) throws IOException {
- super(out);
- }
-
- @Override
- protected Object replaceObject(Object obj) throws IOException {
- if (obj instanceof Date && !(obj instanceof UTCDate)) {
- return new StaticDate((Date) obj);
- }
- if (obj != null && obj.getClass() == Permissions.class) {
- return new LenientPermissionsWrapper((Permissions) obj);
- }
- return super.replaceObject(obj);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.servicetunnel;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.security.Permissions;
+import java.util.Date;
+
+import org.eclipse.scout.commons.UTCDate;
+import org.eclipse.scout.commons.osgi.BundleObjectOutputStream;
+
+/**
+ * Serialization override<br>
+ * used partly to make Date's timezone independent using StaticDate class
+ * <p>
+ * {@link UTCDate}s are not converted and pass unchanged.
+ * <p>
+ * converts {@link Permissions} to {@link LenientPermissionsWrapper}
+ */
+public class ServiceTunnelOutputStream extends BundleObjectOutputStream {
+
+ public ServiceTunnelOutputStream(OutputStream out) throws IOException {
+ super(out);
+ }
+
+ @Override
+ protected Object replaceObject(Object obj) throws IOException {
+ if (obj instanceof Date && !(obj instanceof UTCDate)) {
+ return new StaticDate((Date) obj);
+ }
+ if (obj != null && obj.getClass() == Permissions.class) {
+ return new LenientPermissionsWrapper((Permissions) obj);
+ }
+ return super.replaceObject(obj);
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/ServiceTunnelRequest.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/ServiceTunnelRequest.java
index 1cdc40b710..4e8278741c 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/ServiceTunnelRequest.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/ServiceTunnelRequest.java
@@ -1,206 +1,206 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.servicetunnel;
-
-import java.io.Serializable;
-import java.lang.reflect.Method;
-import java.util.Locale;
-import java.util.concurrent.atomic.AtomicLong;
-
-import javax.security.auth.Subject;
-
-import org.eclipse.scout.commons.LocaleThreadLocal;
-import org.eclipse.scout.commons.VerboseUtility;
-import org.eclipse.scout.rt.shared.services.common.processing.IServerProcessingCancelService;
-import org.eclipse.scout.rt.shared.ui.UserAgent;
-
-public class ServiceTunnelRequest implements Serializable {
- private static final long serialVersionUID = 0L;
- private static final AtomicLong requestSequenceGenerator = new AtomicLong();
-
- private String m_serviceInterfaceClassName;
- private String m_operation;
- private Class[] m_parameterTypes;
- private Object[] m_args;
- private Locale m_locale;
- private String m_userAgent;
- private String m_version;
- private Object m_metaData;
- /**
- * @since 3.8
- */
- private final long m_requestSequence = requestSequenceGenerator.incrementAndGet();
- /**
- * @since 3.8
- */
- private String m_virtualSessionId;
- /**
- * @since 3.8
- */
- private transient Subject m_clientSubject;
-
- // for serialization
- private ServiceTunnelRequest() {
- }
-
- public ServiceTunnelRequest(String version, Class serviceInterfaceClass, Method operation, Object[] args) {
- this(version, serviceInterfaceClass.getName(), operation.getName(), operation.getParameterTypes(), args);
- }
-
- public ServiceTunnelRequest(String version, String serviceInterfaceName, String op, Class[] parameterTypes, Object[] args) {
- m_version = version;
- m_serviceInterfaceClassName = serviceInterfaceName;
- m_operation = op;
- m_parameterTypes = parameterTypes;
- m_args = args;
- if (m_args == null) {
- m_args = new Object[0];
- }
- m_locale = LocaleThreadLocal.get();
- }
-
- /**
- * @return the request sequence for this session
- * <p>
- * The sequence can be used to find and manipulate transactions of the same session. Such a scenario is used
- * when cancelling "old" lookup requests using {@link IServerProcessingCancelService#cancel(long)}
- */
- public long getRequestSequence() {
- return m_requestSequence;
- }
-
- public String getServiceInterfaceClassName() {
- return m_serviceInterfaceClassName;
- }
-
- public String getVersion() {
- return m_version;
- }
-
- public String getOperation() {
- return m_operation;
- }
-
- public Class[] getParameterTypes() {
- return m_parameterTypes;
- }
-
- public Object[] getArgs() {
- return m_args;
- }
-
- public Locale getLocale() {
- return m_locale;
- }
-
- public Object getMetaData() {
- return m_metaData;
- }
-
- public void setMetaData(Object o) {
- m_metaData = o;
- }
-
- /**
- * The subject under which the request is done
- * <p>
- * Client only method. The member is transient and will be null on the server.
- */
- public Subject getClientSubject() {
- return m_clientSubject;
- }
-
- /**
- * The subject under which the request is done
- * <p>
- * Client only method. The member is transient and will be null on the server.
- */
- public void setClientSubject(Subject requestSubject) {
- m_clientSubject = requestSubject;
- }
-
- /**
- * The web (ajax) session under which the request is done
- */
- public String getVirtualSessionId() {
- return m_virtualSessionId;
- }
-
- /**
- * The web (ajax) session under which the request is done
- */
- public void setVirtualSessionId(String virtualSessionId) {
- m_virtualSessionId = virtualSessionId;
- }
-
- /**
- * Represents the user interface on client side.<br/>
- * To parse an identifier use {@link UserAgent#createByIdentifier(String)}
- */
- public String getUserAgent() {
- return m_userAgent;
- }
-
- /**
- * Represents the user interface on client side.<br/>
- * To create an identifier use {@link UserAgent#createIdentifier()}.
- */
- public void setUserAgent(String userAgent) {
- m_userAgent = userAgent;
- }
-
- @Override
- public String toString() {
- StringBuffer buf = new StringBuffer();
- buf.append("Service call " + m_serviceInterfaceClassName + "." + m_operation);
- if (m_args != null && m_args.length > 0) {
- for (int i = 0; i < m_args.length; i++) {
- buf.append("\n");
- buf.append("arg[" + i + "]=" + VerboseUtility.dumpObject(m_args[i]));
- }
- }
- return buf.toString();
- }
-
- /**
- * @return a single string with all package parts reduced to their first character,
- * except the last package fragment. All is concatenated together with _ instead of '.' and the method name is
- * appended with '__'
- * <p>
- * Example for IPingService is "oesrssc_ping_IPingService__ping"
- */
- public static String toSoapOperation(String className, String methodName) {
- if (className == null || methodName == null) {
- return null;
- }
- int i = className.lastIndexOf('.');
- if (i < 0) {
- return className + "__" + methodName;
- }
- String simpleName = className.substring(i + 1);
- String packageName = className.substring(0, i);
- i = packageName.lastIndexOf('.');
- if (i < 0) {
- return packageName + "_" + simpleName + "__" + methodName;
- }
- StringBuilder buf = new StringBuilder();
- for (String s : packageName.substring(0, i).split("[.]")) {
- buf.append(s.charAt(0));
- }
- buf.append("_");
- buf.append(packageName.substring(i + 1));
- buf.append("_");
- buf.append(simpleName);
- buf.append("__");
- buf.append(methodName);
- return buf.toString();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.servicetunnel;
+
+import java.io.Serializable;
+import java.lang.reflect.Method;
+import java.util.Locale;
+import java.util.concurrent.atomic.AtomicLong;
+
+import javax.security.auth.Subject;
+
+import org.eclipse.scout.commons.LocaleThreadLocal;
+import org.eclipse.scout.commons.VerboseUtility;
+import org.eclipse.scout.rt.shared.services.common.processing.IServerProcessingCancelService;
+import org.eclipse.scout.rt.shared.ui.UserAgent;
+
+public class ServiceTunnelRequest implements Serializable {
+ private static final long serialVersionUID = 0L;
+ private static final AtomicLong requestSequenceGenerator = new AtomicLong();
+
+ private String m_serviceInterfaceClassName;
+ private String m_operation;
+ private Class[] m_parameterTypes;
+ private Object[] m_args;
+ private Locale m_locale;
+ private String m_userAgent;
+ private String m_version;
+ private Object m_metaData;
+ /**
+ * @since 3.8
+ */
+ private final long m_requestSequence = requestSequenceGenerator.incrementAndGet();
+ /**
+ * @since 3.8
+ */
+ private String m_virtualSessionId;
+ /**
+ * @since 3.8
+ */
+ private transient Subject m_clientSubject;
+
+ // for serialization
+ private ServiceTunnelRequest() {
+ }
+
+ public ServiceTunnelRequest(String version, Class serviceInterfaceClass, Method operation, Object[] args) {
+ this(version, serviceInterfaceClass.getName(), operation.getName(), operation.getParameterTypes(), args);
+ }
+
+ public ServiceTunnelRequest(String version, String serviceInterfaceName, String op, Class[] parameterTypes, Object[] args) {
+ m_version = version;
+ m_serviceInterfaceClassName = serviceInterfaceName;
+ m_operation = op;
+ m_parameterTypes = parameterTypes;
+ m_args = args;
+ if (m_args == null) {
+ m_args = new Object[0];
+ }
+ m_locale = LocaleThreadLocal.get();
+ }
+
+ /**
+ * @return the request sequence for this session
+ * <p>
+ * The sequence can be used to find and manipulate transactions of the same session. Such a scenario is used
+ * when cancelling "old" lookup requests using {@link IServerProcessingCancelService#cancel(long)}
+ */
+ public long getRequestSequence() {
+ return m_requestSequence;
+ }
+
+ public String getServiceInterfaceClassName() {
+ return m_serviceInterfaceClassName;
+ }
+
+ public String getVersion() {
+ return m_version;
+ }
+
+ public String getOperation() {
+ return m_operation;
+ }
+
+ public Class[] getParameterTypes() {
+ return m_parameterTypes;
+ }
+
+ public Object[] getArgs() {
+ return m_args;
+ }
+
+ public Locale getLocale() {
+ return m_locale;
+ }
+
+ public Object getMetaData() {
+ return m_metaData;
+ }
+
+ public void setMetaData(Object o) {
+ m_metaData = o;
+ }
+
+ /**
+ * The subject under which the request is done
+ * <p>
+ * Client only method. The member is transient and will be null on the server.
+ */
+ public Subject getClientSubject() {
+ return m_clientSubject;
+ }
+
+ /**
+ * The subject under which the request is done
+ * <p>
+ * Client only method. The member is transient and will be null on the server.
+ */
+ public void setClientSubject(Subject requestSubject) {
+ m_clientSubject = requestSubject;
+ }
+
+ /**
+ * The web (ajax) session under which the request is done
+ */
+ public String getVirtualSessionId() {
+ return m_virtualSessionId;
+ }
+
+ /**
+ * The web (ajax) session under which the request is done
+ */
+ public void setVirtualSessionId(String virtualSessionId) {
+ m_virtualSessionId = virtualSessionId;
+ }
+
+ /**
+ * Represents the user interface on client side.<br/>
+ * To parse an identifier use {@link UserAgent#createByIdentifier(String)}
+ */
+ public String getUserAgent() {
+ return m_userAgent;
+ }
+
+ /**
+ * Represents the user interface on client side.<br/>
+ * To create an identifier use {@link UserAgent#createIdentifier()}.
+ */
+ public void setUserAgent(String userAgent) {
+ m_userAgent = userAgent;
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer buf = new StringBuffer();
+ buf.append("Service call " + m_serviceInterfaceClassName + "." + m_operation);
+ if (m_args != null && m_args.length > 0) {
+ for (int i = 0; i < m_args.length; i++) {
+ buf.append("\n");
+ buf.append("arg[" + i + "]=" + VerboseUtility.dumpObject(m_args[i]));
+ }
+ }
+ return buf.toString();
+ }
+
+ /**
+ * @return a single string with all package parts reduced to their first character,
+ * except the last package fragment. All is concatenated together with _ instead of '.' and the method name is
+ * appended with '__'
+ * <p>
+ * Example for IPingService is "oesrssc_ping_IPingService__ping"
+ */
+ public static String toSoapOperation(String className, String methodName) {
+ if (className == null || methodName == null) {
+ return null;
+ }
+ int i = className.lastIndexOf('.');
+ if (i < 0) {
+ return className + "__" + methodName;
+ }
+ String simpleName = className.substring(i + 1);
+ String packageName = className.substring(0, i);
+ i = packageName.lastIndexOf('.');
+ if (i < 0) {
+ return packageName + "_" + simpleName + "__" + methodName;
+ }
+ StringBuilder buf = new StringBuilder();
+ for (String s : packageName.substring(0, i).split("[.]")) {
+ buf.append(s.charAt(0));
+ }
+ buf.append("_");
+ buf.append(packageName.substring(i + 1));
+ buf.append("_");
+ buf.append(simpleName);
+ buf.append("__");
+ buf.append(methodName);
+ return buf.toString();
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/ServiceTunnelResponse.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/ServiceTunnelResponse.java
index 5cf0c2bd6c..f5c4390b32 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/ServiceTunnelResponse.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/ServiceTunnelResponse.java
@@ -1,111 +1,111 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.servicetunnel;
-
-import java.util.Arrays;
-
-import org.eclipse.scout.rt.shared.services.common.clientnotification.IClientNotification;
-
-public class ServiceTunnelResponse implements java.io.Serializable {
- private static final long serialVersionUID = 0L;
-
- private transient int m_httpCode;
- private transient String m_soapOperation;
- private Object m_data;
- private Object[] m_outVars = new Object[0];
- private Throwable m_exception;
- private IClientNotification[] m_clientNotifications;
- private Object m_metaData;
- // added in 3.1.17
- private Long m_processingDuration;
-
- // for scout serialization
- public ServiceTunnelResponse() {
- }
-
- public ServiceTunnelResponse(Object data, Object[] outVars, Throwable t) {
- this(0, data, outVars, t);
- }
-
- public ServiceTunnelResponse(int httpCode, Object data, Object[] outVars, Throwable t) {
- m_httpCode = httpCode;
- m_data = data;
- if (outVars != null) {
- m_outVars = outVars;
- }
- m_exception = t;
- }
-
- public String getSoapOperation() {
- return m_soapOperation;
- }
-
- public void setSoapOperation(String soapOperation) {
- m_soapOperation = soapOperation;
- }
-
- /**
- * @return 0 if code is unknown or >0 if code is known
- */
- public int getHttpCode() {
- return m_httpCode;
- }
-
- public Object getData() {
- return m_data;
- }
-
- public Object[] getOutVars() {
- return m_outVars;
- }
-
- public Throwable getException() {
- return m_exception;
- }
-
- public IClientNotification[] getClientNotifications() {
- return m_clientNotifications;
- }
-
- public void setClientNotifications(IClientNotification[] a) {
- m_clientNotifications = a;
- }
-
- public Object getMetaData() {
- return m_metaData;
- }
-
- public void setMetaData(Object o) {
- m_metaData = o;
- }
-
- public Long getProcessingDuration() {
- return m_processingDuration;
- }
-
- public void setProcessingDuration(Long millis) {
- m_processingDuration = millis;
- }
-
- @Override
- public String toString() {
- StringBuffer buf = new StringBuffer();
- buf.append("Response[data=" + m_data + ", vars=" + Arrays.asList(m_outVars) + ", exception=" + m_exception + "]");
- return buf.toString();
- }
-
- /*
- * //Activate for Null-Proxy-Test only private void
- * readObject(ObjectInputStream in) throws IOException,
- * ClassNotFoundException{ //don't call defaultReadObject() }
- */
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.servicetunnel;
+
+import java.util.Arrays;
+
+import org.eclipse.scout.rt.shared.services.common.clientnotification.IClientNotification;
+
+public class ServiceTunnelResponse implements java.io.Serializable {
+ private static final long serialVersionUID = 0L;
+
+ private transient int m_httpCode;
+ private transient String m_soapOperation;
+ private Object m_data;
+ private Object[] m_outVars = new Object[0];
+ private Throwable m_exception;
+ private IClientNotification[] m_clientNotifications;
+ private Object m_metaData;
+ // added in 3.1.17
+ private Long m_processingDuration;
+
+ // for scout serialization
+ public ServiceTunnelResponse() {
+ }
+
+ public ServiceTunnelResponse(Object data, Object[] outVars, Throwable t) {
+ this(0, data, outVars, t);
+ }
+
+ public ServiceTunnelResponse(int httpCode, Object data, Object[] outVars, Throwable t) {
+ m_httpCode = httpCode;
+ m_data = data;
+ if (outVars != null) {
+ m_outVars = outVars;
+ }
+ m_exception = t;
+ }
+
+ public String getSoapOperation() {
+ return m_soapOperation;
+ }
+
+ public void setSoapOperation(String soapOperation) {
+ m_soapOperation = soapOperation;
+ }
+
+ /**
+ * @return 0 if code is unknown or >0 if code is known
+ */
+ public int getHttpCode() {
+ return m_httpCode;
+ }
+
+ public Object getData() {
+ return m_data;
+ }
+
+ public Object[] getOutVars() {
+ return m_outVars;
+ }
+
+ public Throwable getException() {
+ return m_exception;
+ }
+
+ public IClientNotification[] getClientNotifications() {
+ return m_clientNotifications;
+ }
+
+ public void setClientNotifications(IClientNotification[] a) {
+ m_clientNotifications = a;
+ }
+
+ public Object getMetaData() {
+ return m_metaData;
+ }
+
+ public void setMetaData(Object o) {
+ m_metaData = o;
+ }
+
+ public Long getProcessingDuration() {
+ return m_processingDuration;
+ }
+
+ public void setProcessingDuration(Long millis) {
+ m_processingDuration = millis;
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer buf = new StringBuffer();
+ buf.append("Response[data=" + m_data + ", vars=" + Arrays.asList(m_outVars) + ", exception=" + m_exception + "]");
+ return buf.toString();
+ }
+
+ /*
+ * //Activate for Null-Proxy-Test only private void
+ * readObject(ObjectInputStream in) throws IOException,
+ * ClassNotFoundException{ //don't call defaultReadObject() }
+ */
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/StaticDate.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/StaticDate.java
index d50864c6b5..3657f5e168 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/StaticDate.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/StaticDate.java
@@ -1,73 +1,73 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.servicetunnel;
-
-import java.util.Calendar;
-import java.util.Date;
-import java.util.GregorianCalendar;
-
-/**
- * Static date representation as string, independent of TimeZone and daylight
- * saving
- * <p>
- * {@link ServiceTunnelInputStream} / {@link ServiceTunnelOutputStream}
- */
-public class StaticDate implements java.io.Serializable {
- private static final long serialVersionUID = -3278051886953717195L;
-
- private long m_textAsLong;
-
- public StaticDate(Date d) {
- Calendar cal = new GregorianCalendar();
- cal.setTime(d);
- long l = 0;
- l = cal.get(Calendar.YEAR);
- l = l * 100 + cal.get(Calendar.MONTH);
- l = l * 100 + cal.get(Calendar.DATE);
- l = l * 100 + cal.get(Calendar.HOUR_OF_DAY);
- l = l * 100 + cal.get(Calendar.MINUTE);
- l = l * 100 + cal.get(Calendar.SECOND);
- l = l * 1000 + cal.get(Calendar.MILLISECOND);
- m_textAsLong = l;
- }
-
- public Date getDate() {
- try {
- Calendar cal = new GregorianCalendar();
- long l = m_textAsLong;
- cal.set(Calendar.MILLISECOND, (int) (l % 1000));
- l = l / 1000;
- cal.set(Calendar.SECOND, (int) (l % 100));
- l = l / 100;
- cal.set(Calendar.MINUTE, (int) (l % 100));
- l = l / 100;
- cal.set(Calendar.HOUR_OF_DAY, (int) (l % 100));
- l = l / 100;
- cal.set(Calendar.DATE, (int) (l % 100));
- l = l / 100;
- cal.set(Calendar.MONTH, (int) (l % 100));
- l = l / 100;
- cal.set(Calendar.YEAR, (int) (l));
- return cal.getTime();
- }
- catch (Exception e) {
- throw new RuntimeException("parsing " + m_textAsLong, e);
- }
- }
-
- @Override
- public String toString() {
- /*
- * return "StaticDate[millis="+l+"]";
- */
- return "StaticDate[" + m_textAsLong + "]";
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.servicetunnel;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+
+/**
+ * Static date representation as string, independent of TimeZone and daylight
+ * saving
+ * <p>
+ * {@link ServiceTunnelInputStream} / {@link ServiceTunnelOutputStream}
+ */
+public class StaticDate implements java.io.Serializable {
+ private static final long serialVersionUID = -3278051886953717195L;
+
+ private long m_textAsLong;
+
+ public StaticDate(Date d) {
+ Calendar cal = new GregorianCalendar();
+ cal.setTime(d);
+ long l = 0;
+ l = cal.get(Calendar.YEAR);
+ l = l * 100 + cal.get(Calendar.MONTH);
+ l = l * 100 + cal.get(Calendar.DATE);
+ l = l * 100 + cal.get(Calendar.HOUR_OF_DAY);
+ l = l * 100 + cal.get(Calendar.MINUTE);
+ l = l * 100 + cal.get(Calendar.SECOND);
+ l = l * 1000 + cal.get(Calendar.MILLISECOND);
+ m_textAsLong = l;
+ }
+
+ public Date getDate() {
+ try {
+ Calendar cal = new GregorianCalendar();
+ long l = m_textAsLong;
+ cal.set(Calendar.MILLISECOND, (int) (l % 1000));
+ l = l / 1000;
+ cal.set(Calendar.SECOND, (int) (l % 100));
+ l = l / 100;
+ cal.set(Calendar.MINUTE, (int) (l % 100));
+ l = l / 100;
+ cal.set(Calendar.HOUR_OF_DAY, (int) (l % 100));
+ l = l / 100;
+ cal.set(Calendar.DATE, (int) (l % 100));
+ l = l / 100;
+ cal.set(Calendar.MONTH, (int) (l % 100));
+ l = l / 100;
+ cal.set(Calendar.YEAR, (int) (l));
+ return cal.getTime();
+ }
+ catch (Exception e) {
+ throw new RuntimeException("parsing " + m_textAsLong, e);
+ }
+ }
+
+ @Override
+ public String toString() {
+ /*
+ * return "StaticDate[millis="+l+"]";
+ */
+ return "StaticDate[" + m_textAsLong + "]";
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/VersionMismatchException.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/VersionMismatchException.java
index 33e76e97f4..a951f77a4b 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/VersionMismatchException.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/servicetunnel/VersionMismatchException.java
@@ -1,43 +1,43 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.servicetunnel;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-
-public class VersionMismatchException extends ProcessingException {
- private static final long serialVersionUID = 1L;
-
- private String m_oldVersion;
- private String m_newVersion;
-
- /**
- * Empty constructor is used to support auto-webservice publishing with java
- * bean support
- */
- public VersionMismatchException() {
- super();
- }
-
- public VersionMismatchException(String vOld, String vNew) {
- super("Version mismatch: got " + vOld + " required " + vNew);
- m_oldVersion = vOld;
- m_newVersion = vNew;
- }
-
- public String getOldVersion() {
- return m_oldVersion;
- }
-
- public String getNewVersion() {
- return m_newVersion;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.servicetunnel;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+
+public class VersionMismatchException extends ProcessingException {
+ private static final long serialVersionUID = 1L;
+
+ private String m_oldVersion;
+ private String m_newVersion;
+
+ /**
+ * Empty constructor is used to support auto-webservice publishing with java
+ * bean support
+ */
+ public VersionMismatchException() {
+ super();
+ }
+
+ public VersionMismatchException(String vOld, String vNew) {
+ super("Version mismatch: got " + vOld + " required " + vNew);
+ m_oldVersion = vOld;
+ m_newVersion = vNew;
+ }
+
+ public String getOldVersion() {
+ return m_oldVersion;
+ }
+
+ public String getNewVersion() {
+ return m_newVersion;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/ui/DefaultUserAgentParser.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/ui/DefaultUserAgentParser.java
index 283968c8f4..bfcb4990ed 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/ui/DefaultUserAgentParser.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/ui/DefaultUserAgentParser.java
@@ -1,69 +1,69 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.ui;
-
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-
-/**
- * This default parser is able to create a string representation (identifier) of {@link UserAgent} in the form of
- * uiLayer|uiDeviceType|uiDeviceId. It is also able to parse such a identifier and create a {@link UserAgent}.
- * <p>
- * Examples of identifiers:
- * <ul>
- * <li>SWING|DESKTOP|Windows7</li>
- * <li>RAP|MOBILE|Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.162
- * Safari/535.19</li
- * </ul>
- * </p>
- *
- * @since 3.8.0
- */
-public class DefaultUserAgentParser implements IUserAgentParser {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(DefaultUserAgentParser.class);
-
- public static String DELIMITER = "|";
-
- @Override
- public UserAgent parseIdentifier(String userAgent) {
- String[] tokens = StringUtility.tokenize(userAgent, DELIMITER.charAt(0));
- if (tokens.length != 3) {
- LOG.warn("UserAgentIdentifier could not be parsed. Invalid number of tokens. UserAgent: " + userAgent);
- return UserAgent.createDefault();
- }
-
- try {
- IUiLayer uiLayer = UiLayer.createByIdentifier(tokens[0]);
- IUiDeviceType uiDeviceType = UiDeviceType.createByIdentifier(tokens[1]);
- String uiDeviceId = tokens[2];
-
- return UserAgent.create(uiLayer, uiDeviceType, uiDeviceId);
- }
- catch (Throwable t) {
- LOG.warn("UserAgentIdentifier could not be parsed. Exception occured while parsing. UserAgent: " + userAgent, t);
- return UserAgent.createDefault();
- }
- }
-
- @Override
- public String createIdentifier(UserAgent userAgent) {
- String uiDeviceId = userAgent.getUiDeviceId();
- if (uiDeviceId.contains(DELIMITER)) {
- uiDeviceId = uiDeviceId.replaceAll(DELIMITER, "_");
-
- LOG.warn("Character which is used as delimiter has been found in uiDeviceId. Replaced with '_'. Old uiDeviceId: " + userAgent.getUiDeviceId() + ". New uiDeviceId: " + uiDeviceId);
- userAgent.setUiDeviceId(uiDeviceId);
- }
- return StringUtility.concatenateTokens(userAgent.getUiLayer().getIdentifier(), DELIMITER + "", userAgent.getUiDeviceType().getIdentifier(), DELIMITER + "", uiDeviceId);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.ui;
+
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+
+/**
+ * This default parser is able to create a string representation (identifier) of {@link UserAgent} in the form of
+ * uiLayer|uiDeviceType|uiDeviceId. It is also able to parse such a identifier and create a {@link UserAgent}.
+ * <p>
+ * Examples of identifiers:
+ * <ul>
+ * <li>SWING|DESKTOP|Windows7</li>
+ * <li>RAP|MOBILE|Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.162
+ * Safari/535.19</li
+ * </ul>
+ * </p>
+ *
+ * @since 3.8.0
+ */
+public class DefaultUserAgentParser implements IUserAgentParser {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(DefaultUserAgentParser.class);
+
+ public static String DELIMITER = "|";
+
+ @Override
+ public UserAgent parseIdentifier(String userAgent) {
+ String[] tokens = StringUtility.tokenize(userAgent, DELIMITER.charAt(0));
+ if (tokens.length != 3) {
+ LOG.warn("UserAgentIdentifier could not be parsed. Invalid number of tokens. UserAgent: " + userAgent);
+ return UserAgent.createDefault();
+ }
+
+ try {
+ IUiLayer uiLayer = UiLayer.createByIdentifier(tokens[0]);
+ IUiDeviceType uiDeviceType = UiDeviceType.createByIdentifier(tokens[1]);
+ String uiDeviceId = tokens[2];
+
+ return UserAgent.create(uiLayer, uiDeviceType, uiDeviceId);
+ }
+ catch (Throwable t) {
+ LOG.warn("UserAgentIdentifier could not be parsed. Exception occured while parsing. UserAgent: " + userAgent, t);
+ return UserAgent.createDefault();
+ }
+ }
+
+ @Override
+ public String createIdentifier(UserAgent userAgent) {
+ String uiDeviceId = userAgent.getUiDeviceId();
+ if (uiDeviceId.contains(DELIMITER)) {
+ uiDeviceId = uiDeviceId.replaceAll(DELIMITER, "_");
+
+ LOG.warn("Character which is used as delimiter has been found in uiDeviceId. Replaced with '_'. Old uiDeviceId: " + userAgent.getUiDeviceId() + ". New uiDeviceId: " + uiDeviceId);
+ userAgent.setUiDeviceId(uiDeviceId);
+ }
+ return StringUtility.concatenateTokens(userAgent.getUiLayer().getIdentifier(), DELIMITER + "", userAgent.getUiDeviceType().getIdentifier(), DELIMITER + "", uiDeviceId);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/ui/IUiDeviceType.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/ui/IUiDeviceType.java
index b3384690c3..1910c6c225 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/ui/IUiDeviceType.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/ui/IUiDeviceType.java
@@ -1,20 +1,20 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.ui;
-
-/**
- * @since 3.8.0
- */
-public interface IUiDeviceType {
- boolean isTouchDevice();
-
- String getIdentifier();
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.ui;
+
+/**
+ * @since 3.8.0
+ */
+public interface IUiDeviceType {
+ boolean isTouchDevice();
+
+ String getIdentifier();
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/ui/IUiLayer.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/ui/IUiLayer.java
index e8dd5729a1..6224c6f920 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/ui/IUiLayer.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/ui/IUiLayer.java
@@ -1,20 +1,20 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.ui;
-
-/**
- * @since 3.8.0
- */
-public interface IUiLayer {
- String getIdentifier();
-
- boolean isWebUi();
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.ui;
+
+/**
+ * @since 3.8.0
+ */
+public interface IUiLayer {
+ String getIdentifier();
+
+ boolean isWebUi();
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/ui/IUserAgentParser.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/ui/IUserAgentParser.java
index 6447692839..d66447b7e7 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/ui/IUserAgentParser.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/ui/IUserAgentParser.java
@@ -1,24 +1,24 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.ui;
-
-/**
- * Is able to create a string representation (identifier) of {@link UserAgent}. It is also able to parse a identifier
- * and create a {@link UserAgent}.
- *
- * @since 3.8.0
- */
-public interface IUserAgentParser {
-
- UserAgent parseIdentifier(String userAgent);
-
- String createIdentifier(UserAgent userAgent);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.ui;
+
+/**
+ * Is able to create a string representation (identifier) of {@link UserAgent}. It is also able to parse a identifier
+ * and create a {@link UserAgent}.
+ *
+ * @since 3.8.0
+ */
+public interface IUserAgentParser {
+
+ UserAgent parseIdentifier(String userAgent);
+
+ String createIdentifier(UserAgent userAgent);
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/ui/UiDeviceType.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/ui/UiDeviceType.java
index e7c8f899e9..f27077611a 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/ui/UiDeviceType.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/ui/UiDeviceType.java
@@ -1,46 +1,46 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.ui;
-
-/**
- * @since 3.8.0
- */
-public enum UiDeviceType implements IUiDeviceType {
- DESKTOP,
- TABLET(true),
- MOBILE(true),
- UNKNOWN;
-
- boolean m_touchDevice;
-
- private UiDeviceType(boolean touchDevice) {
- m_touchDevice = touchDevice;
- }
-
- private UiDeviceType() {
- this(false);
- }
-
- @Override
- public boolean isTouchDevice() {
- return m_touchDevice;
- }
-
- @Override
- public String getIdentifier() {
- return name();
- }
-
- public static IUiDeviceType createByIdentifier(String identifier) {
- return valueOf(identifier);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.ui;
+
+/**
+ * @since 3.8.0
+ */
+public enum UiDeviceType implements IUiDeviceType {
+ DESKTOP,
+ TABLET(true),
+ MOBILE(true),
+ UNKNOWN;
+
+ boolean m_touchDevice;
+
+ private UiDeviceType(boolean touchDevice) {
+ m_touchDevice = touchDevice;
+ }
+
+ private UiDeviceType() {
+ this(false);
+ }
+
+ @Override
+ public boolean isTouchDevice() {
+ return m_touchDevice;
+ }
+
+ @Override
+ public String getIdentifier() {
+ return name();
+ }
+
+ public static IUiDeviceType createByIdentifier(String identifier) {
+ return valueOf(identifier);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/ui/UiLayer.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/ui/UiLayer.java
index 811b7011ee..2170f77d11 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/ui/UiLayer.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/ui/UiLayer.java
@@ -1,50 +1,50 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.ui;
-
-/**
- * @since 3.8.0
- */
-public enum UiLayer implements IUiLayer {
-
- SWT,
- SWING,
- RAP(true),
- WICKET(true),
- JSP(true),
- JSF(true),
- UNKNOWN;
-
- boolean m_webUi;
-
- private UiLayer(boolean webUi) {
- m_webUi = webUi;
- }
-
- private UiLayer() {
- this(false);
- }
-
- @Override
- public boolean isWebUi() {
- return m_webUi;
- }
-
- @Override
- public String getIdentifier() {
- return name();
- }
-
- public static IUiLayer createByIdentifier(String identifier) {
- return valueOf(identifier);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.ui;
+
+/**
+ * @since 3.8.0
+ */
+public enum UiLayer implements IUiLayer {
+
+ SWT,
+ SWING,
+ RAP(true),
+ WICKET(true),
+ JSP(true),
+ JSF(true),
+ UNKNOWN;
+
+ boolean m_webUi;
+
+ private UiLayer(boolean webUi) {
+ m_webUi = webUi;
+ }
+
+ private UiLayer() {
+ this(false);
+ }
+
+ @Override
+ public boolean isWebUi() {
+ return m_webUi;
+ }
+
+ @Override
+ public String getIdentifier() {
+ return name();
+ }
+
+ public static IUiLayer createByIdentifier(String identifier) {
+ return valueOf(identifier);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/ui/UserAgent.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/ui/UserAgent.java
index 0d69dd6497..756537ba1b 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/ui/UserAgent.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/ui/UserAgent.java
@@ -1,124 +1,124 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.ui;
-
-import org.eclipse.scout.rt.shared.Activator;
-
-/**
- * Holds information about the kind of user interface used on the client side like {@link IUiLayer} and
- * {@link IUiDeviceType}. <br/>
- * There is also a device id ({@link UserAgent#getUiDeviceId()} which holds even more
- * information about the used device. As default it only provides information about the underlying operation system. In
- * case of a web based ui {@link IUiLayer#isWebUi()} it provides the original user agent string containing information
- * about the browser.
- * <p>
- * In order to export the user agent data as string you can use {@link #createIdentifier()} which uses
- * {@link DefaultUserAgentParser}. If you would like to export it in a custom format just create a custom
- * {@link IUserAgentParser} and call {@link #createIdentifier(IUserAgentParser)}.
- * </p>
- *
- * @since 3.8.0
- */
-public final class UserAgent {
-
- private String m_uiDeviceId;
- private IUiLayer m_uiLayer;
- private IUiDeviceType m_uiDeviceType;
-
- private UserAgent(IUiLayer uiLayer, IUiDeviceType uiDeviceType, String uiDeviceId) {
- if (uiLayer == null || uiDeviceType == null || uiDeviceId == null) {
- throw new IllegalArgumentException("Arguments must not be null.");
- }
-
- m_uiLayer = uiLayer;
- m_uiDeviceType = uiDeviceType;
- m_uiDeviceId = uiDeviceId;
- }
-
- public IUiDeviceType getUiDeviceType() {
- return m_uiDeviceType;
- }
-
- public IUiLayer getUiLayer() {
- return m_uiLayer;
- }
-
- public String getUiDeviceId() {
- return m_uiDeviceId;
- }
-
- public void setUiDeviceId(String uiDeviceId) {
- m_uiDeviceId = uiDeviceId;
- }
-
- @Override
- public boolean equals(Object other) {
- if (other == this) {
- return true;
- }
-
- if (other == null || other.getClass() != getClass()) {
- return false;
- }
-
- UserAgent otherUserAgent = (UserAgent) other;
- boolean equal = otherUserAgent.getUiDeviceType().equals(getUiDeviceType());
- equal &= otherUserAgent.getUiLayer().equals(getUiLayer());
- equal &= otherUserAgent.getUiDeviceId().equals(getUiDeviceId());
-
- return equal;
- }
-
- @Override
- public int hashCode() {
- int hash = 17 + getUiLayer().hashCode();
- hash = hash * 17 + getUiDeviceType().hashCode();
- hash = hash * 17 + getUiDeviceId().hashCode();
-
- return hash;
- }
-
- @Override
- public String toString() {
- return createIdentifier();
- }
-
- public String createIdentifier() {
- return createIdentifier(new DefaultUserAgentParser());
- }
-
- public String createIdentifier(IUserAgentParser parser) {
- return parser.createIdentifier(this);
- }
-
- public static UserAgent create(IUiLayer uiLayer, IUiDeviceType uiDeviceType) {
- String osName = Activator.getDefault().getBundle().getBundleContext().getProperty("org.osgi.framework.os.name");
-
- return new UserAgent(uiLayer, uiDeviceType, osName);
- }
-
- public static UserAgent create(IUiLayer uiLayer, IUiDeviceType uiDeviceType, String uiDeviceId) {
- return new UserAgent(uiLayer, uiDeviceType, uiDeviceId);
- }
-
- public static UserAgent createDefault() {
- return create(UiLayer.UNKNOWN, UiDeviceType.UNKNOWN);
- }
-
- public static UserAgent createByIdentifier(IUserAgentParser parser, String userAgent) {
- return parser.parseIdentifier(userAgent);
- }
-
- public static UserAgent createByIdentifier(String userAgent) {
- return createByIdentifier(new DefaultUserAgentParser(), userAgent);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.ui;
+
+import org.eclipse.scout.rt.shared.Activator;
+
+/**
+ * Holds information about the kind of user interface used on the client side like {@link IUiLayer} and
+ * {@link IUiDeviceType}. <br/>
+ * There is also a device id ({@link UserAgent#getUiDeviceId()} which holds even more
+ * information about the used device. As default it only provides information about the underlying operation system. In
+ * case of a web based ui {@link IUiLayer#isWebUi()} it provides the original user agent string containing information
+ * about the browser.
+ * <p>
+ * In order to export the user agent data as string you can use {@link #createIdentifier()} which uses
+ * {@link DefaultUserAgentParser}. If you would like to export it in a custom format just create a custom
+ * {@link IUserAgentParser} and call {@link #createIdentifier(IUserAgentParser)}.
+ * </p>
+ *
+ * @since 3.8.0
+ */
+public final class UserAgent {
+
+ private String m_uiDeviceId;
+ private IUiLayer m_uiLayer;
+ private IUiDeviceType m_uiDeviceType;
+
+ private UserAgent(IUiLayer uiLayer, IUiDeviceType uiDeviceType, String uiDeviceId) {
+ if (uiLayer == null || uiDeviceType == null || uiDeviceId == null) {
+ throw new IllegalArgumentException("Arguments must not be null.");
+ }
+
+ m_uiLayer = uiLayer;
+ m_uiDeviceType = uiDeviceType;
+ m_uiDeviceId = uiDeviceId;
+ }
+
+ public IUiDeviceType getUiDeviceType() {
+ return m_uiDeviceType;
+ }
+
+ public IUiLayer getUiLayer() {
+ return m_uiLayer;
+ }
+
+ public String getUiDeviceId() {
+ return m_uiDeviceId;
+ }
+
+ public void setUiDeviceId(String uiDeviceId) {
+ m_uiDeviceId = uiDeviceId;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == this) {
+ return true;
+ }
+
+ if (other == null || other.getClass() != getClass()) {
+ return false;
+ }
+
+ UserAgent otherUserAgent = (UserAgent) other;
+ boolean equal = otherUserAgent.getUiDeviceType().equals(getUiDeviceType());
+ equal &= otherUserAgent.getUiLayer().equals(getUiLayer());
+ equal &= otherUserAgent.getUiDeviceId().equals(getUiDeviceId());
+
+ return equal;
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 17 + getUiLayer().hashCode();
+ hash = hash * 17 + getUiDeviceType().hashCode();
+ hash = hash * 17 + getUiDeviceId().hashCode();
+
+ return hash;
+ }
+
+ @Override
+ public String toString() {
+ return createIdentifier();
+ }
+
+ public String createIdentifier() {
+ return createIdentifier(new DefaultUserAgentParser());
+ }
+
+ public String createIdentifier(IUserAgentParser parser) {
+ return parser.createIdentifier(this);
+ }
+
+ public static UserAgent create(IUiLayer uiLayer, IUiDeviceType uiDeviceType) {
+ String osName = Activator.getDefault().getBundle().getBundleContext().getProperty("org.osgi.framework.os.name");
+
+ return new UserAgent(uiLayer, uiDeviceType, osName);
+ }
+
+ public static UserAgent create(IUiLayer uiLayer, IUiDeviceType uiDeviceType, String uiDeviceId) {
+ return new UserAgent(uiLayer, uiDeviceType, uiDeviceId);
+ }
+
+ public static UserAgent createDefault() {
+ return create(UiLayer.UNKNOWN, UiDeviceType.UNKNOWN);
+ }
+
+ public static UserAgent createByIdentifier(IUserAgentParser parser, String userAgent) {
+ return parser.parseIdentifier(userAgent);
+ }
+
+ public static UserAgent createByIdentifier(String userAgent) {
+ return createByIdentifier(new DefaultUserAgentParser(), userAgent);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/DefaultValidator.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/DefaultValidator.java
index 1f66d2f3ec..33b68eca9b 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/DefaultValidator.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/DefaultValidator.java
@@ -1,432 +1,432 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.validate;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Array;
-import java.lang.reflect.Method;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.shared.data.form.AbstractFormData;
-import org.eclipse.scout.rt.shared.data.form.ValidationRule;
-import org.eclipse.scout.rt.shared.data.form.fields.AbstractFormFieldData;
-import org.eclipse.scout.rt.shared.data.form.fields.AbstractValueFieldData;
-import org.eclipse.scout.rt.shared.services.common.code.CODES;
-import org.eclipse.scout.rt.shared.services.common.code.ICodeType;
-import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
-import org.eclipse.scout.rt.shared.validate.annotations.CodeValue;
-import org.eclipse.scout.rt.shared.validate.annotations.LookupValue;
-import org.eclipse.scout.rt.shared.validate.annotations.Mandatory;
-import org.eclipse.scout.rt.shared.validate.annotations.MaxLength;
-import org.eclipse.scout.rt.shared.validate.annotations.MaxValue;
-import org.eclipse.scout.rt.shared.validate.annotations.MinLength;
-import org.eclipse.scout.rt.shared.validate.annotations.MinValue;
-import org.eclipse.scout.rt.shared.validate.annotations.RegexMatch;
-import org.eclipse.scout.rt.shared.validate.annotations.Treat0AsNull;
-import org.eclipse.scout.rt.shared.validate.annotations.ValidateAnnotationMarker;
-import org.eclipse.scout.rt.shared.validate.checks.CodeValueCheck;
-import org.eclipse.scout.rt.shared.validate.checks.LookupValueCheck;
-import org.eclipse.scout.rt.shared.validate.checks.MandatoryCheck;
-import org.eclipse.scout.rt.shared.validate.checks.MasterValueRequiredCheck;
-import org.eclipse.scout.rt.shared.validate.checks.MaxLengthCheck;
-import org.eclipse.scout.rt.shared.validate.checks.MaxLengthGenericCheck;
-import org.eclipse.scout.rt.shared.validate.checks.MaxValueCheck;
-import org.eclipse.scout.rt.shared.validate.checks.MinLengthCheck;
-import org.eclipse.scout.rt.shared.validate.checks.MinValueCheck;
-import org.eclipse.scout.rt.shared.validate.checks.RegexMatchCheck;
-
-/**
- * Does input/output validation of arbitrary serializable data.
- * <p>
- * This default traverses all objects of the arguments map in the complete data structure by writing the object to a
- * void stream.
- * <p>
- * This default delegates {@link AbstractFormData} to a {@link DefaultFormDataValidator} and does nothing otherwise.
- * <p>
- * Default maxLength is checked in {@link #checkMaxLenghtDefault(Object)}
- */
-public class DefaultValidator extends ValidationUtility.ValidateTreeVisitor implements IValidator {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(DefaultValidator.class);
- private static final Map<String, Object> NO_RULE_MAP = new HashMap<String, Object>();
-
- private IValidationStrategy m_validationStrategy;
- private ValidateCheckSet m_defaultCheckSet;
- private HashSet<String/*id*/> m_consumedChecks = new HashSet<String/*id*/>();
-
- public DefaultValidator(IValidationStrategy validationStrategy) {
- m_validationStrategy = validationStrategy;
- m_defaultCheckSet = new ValidateCheckSet();
- }
-
- @Override
- public void validateMethodCall(Method m, Object[] parameters) throws Exception {
- if (parameters == null || parameters.length == 0) {
- return;
- }
- initDefaultChecks(m_defaultCheckSet);
- if (m_defaultCheckSet.isEmpty()) {
- m_defaultCheckSet = null;
- }
- Collection<Annotation>[] parameterAnnotations = collectParameterAnnotations(m);
- for (int i = 0; i < parameters.length; i++) {
- start(parameters[i], parameterAnnotations[i]);
- }
- }
-
- @Override
- public void validateParameter(Object parameter, Collection<Annotation> parameterAnnotations) throws Exception {
- initDefaultChecks(m_defaultCheckSet);
- if (m_defaultCheckSet.isEmpty()) {
- m_defaultCheckSet = null;
- }
- start(parameter, parameterAnnotations);
- }
-
- protected void initDefaultChecks(ValidateCheckSet checkSet) {
- checkSet.addCheck(new MaxLengthGenericCheck(250, 64000000, 64000000, 10000));
- }
-
- /**
- * Collect list of annotations for each parameter based on the method declaration and all its super class method
- * declarations.
- * <p>
- * See {@link ValidationUtility#getParameterAnnotations(Method)} for more details
- */
- protected Collection<Annotation>[] collectParameterAnnotations(Method m) {
- return ValidationUtility.getParameterAnnotations(m);
- }
-
- /*
- * Annotation based validation
- */
-
- protected ValidateCheckSet validateObjectByAnnotations(Collection<Annotation> annotationList, Object obj) throws Exception {
- if (isTreat0AsNullFromAnnotations(annotationList)) {
- obj = ValidationUtility.treat0AsNull(obj);
- }
- //default node: retrieve checks by annotations
- ValidateCheckSet localSet = new ValidateCheckSet();
- ValidateCheckSet subtreeSet = new ValidateCheckSet();
- addChecksFromAnnotations(localSet, subtreeSet, annotationList, obj);
- //do checks
- m_consumedChecks.clear();
- if (localSet != null) {
- localSet.applyChecks(m_validationStrategy, obj, m_consumedChecks);
- }
- if (subtreeSet != null) {
- subtreeSet.applyChecks(m_validationStrategy, obj, m_consumedChecks);
- }
- if (m_defaultCheckSet != null) {
- m_defaultCheckSet.applyChecks(m_validationStrategy, obj, m_consumedChecks);
- }
- return subtreeSet;
- }
-
- protected boolean isTreat0AsNullFromAnnotations(Collection<Annotation> annotationList) {
- if (annotationList.size() == 0) {
- return false;
- }
- for (Annotation a : annotationList) {
- if (a.annotationType() == Treat0AsNull.class) {
- return ((Treat0AsNull) a).value();
- }
- }
- return false;
- }
-
- /**
- * @param annotations
- * are all annotations with a {@link ValidateAnnotationMarker}
- */
- protected void addChecksFromAnnotations(ValidateCheckSet localSet, ValidateCheckSet subtreeSet, Collection<Annotation> annotationList, Object value) {
- if (annotationList.size() == 0) {
- return;
- }
- for (Annotation a : annotationList) {
- try {
- addCheckFromAnnotation(localSet, subtreeSet, a, value);
- }
- catch (Throwable t) {
- LOG.error("failed creating check implementation for " + a, t);
- }
- }
- }
-
- /**
- * override this method to support for more check annotations (annotations marked with
- * {@link ValidateAnnotationMarker}
- */
- protected void addCheckFromAnnotation(ValidateCheckSet localSet, ValidateCheckSet subtreeSet, Annotation a, Object value) throws Exception {
- if (a.annotationType() == CodeValue.class) {
- CodeValue x = (CodeValue) a;
- if (value == null || (value.getClass().isArray() && Array.getLength(value) == 0)) {
- return;
- }
- (x.subtree() ? subtreeSet : localSet).addCheck(new CodeValueCheck(CODES.getCodeType(x.value())));
- }
- else if (a.annotationType() == LookupValue.class) {
- LookupValue x = (LookupValue) a;
- if (value == null || (value.getClass().isArray() && Array.getLength(value) == 0)) {
- return;
- }
- (x.subtree() ? subtreeSet : localSet).addCheck(new LookupValueCheck(x.value().newInstance()));
- }
- else if (a.annotationType() == Mandatory.class) {
- Mandatory x = (Mandatory) a;
- (x.subtree() ? subtreeSet : localSet).addCheck(new MandatoryCheck(x.value()));
- }
- else if (a.annotationType() == MinLength.class) {
- MinLength x = (MinLength) a;
- (x.subtree() ? subtreeSet : localSet).addCheck(new MinLengthCheck(x.value()));
- }
- else if (a.annotationType() == MaxLength.class) {
- MaxLength x = (MaxLength) a;
- (x.subtree() ? subtreeSet : localSet).addCheck(new MaxLengthCheck(x.value()));
- }
- else if (a.annotationType() == MinValue.class) {
- if (value == null) {
- return;
- }
- MinValue x = (MinValue) a;
- (x.subtree() ? subtreeSet : localSet).addCheck(new MinValueCheck(x.value()));
- }
- else if (a.annotationType() == MaxValue.class) {
- if (value == null) {
- return;
- }
- MaxValue x = (MaxValue) a;
- (x.subtree() ? subtreeSet : localSet).addCheck(new MaxValueCheck(x.value()));
- }
- else if (a.annotationType() == RegexMatch.class) {
- if (value == null) {
- return;
- }
- RegexMatch x = (RegexMatch) a;
- (x.subtree() ? subtreeSet : localSet).addCheck(new RegexMatchCheck(x.value()));
- }
- }
-
- /*
- * FormData validation rule based validation
- */
- protected void validateFormDataFields(AbstractFormData formData) throws Exception {
- for (Map<String, AbstractFormFieldData> map : formData.getAllFieldsRec().values()) {
- for (AbstractFormFieldData field : map.values()) {
- if (!field.isValueSet()) {
- continue;
- }
- Map<String, Object> ruleMap = field.getValidationRules();
- if (ruleMap.size() == 0) {
- continue;
- }
- //
- Object fieldValue = null;
- if (field instanceof AbstractValueFieldData<?>) {
- fieldValue = ((AbstractValueFieldData<?>) field).getValue();
- }
- //pre-mark the fieldValue object so the validation tree traversal will skip it when it continues
- markObject(fieldValue);
- validateFormDataFieldByValidationRules(formData, ruleMap, field.getClass().getSimpleName(), fieldValue);
- }
- }
- }
-
- protected void validateFormDataFieldByValidationRules(AbstractFormData formData, Map<String, Object> ruleMap, String fieldName, Object obj) throws Exception {
- FormDataCheckContext ctx = new FormDataCheckContext();
- ctx.formData = formData;
- ctx.ruleMap = ruleMap;
- ctx.fieldName = fieldName;
- if (isTreat0AsNullFromValidationRules(ctx)) {
- obj = ValidationUtility.treat0AsNull(obj);
- }
- //default node: retrieve checks by annotations
- ValidateCheckSet localCheckSet = new ValidateCheckSet();
- addChecksFromValidationRules(localCheckSet, ctx, obj);
- //do checks
- m_consumedChecks.clear();
- if (localCheckSet != null) {
- localCheckSet.applyChecks(m_validationStrategy, obj, m_consumedChecks);
- }
- if (m_defaultCheckSet != null) {
- m_defaultCheckSet.applyChecks(m_validationStrategy, obj, m_consumedChecks);
- }
- }
-
- protected boolean isTreat0AsNullFromValidationRules(FormDataCheckContext ctx) {
- return Boolean.TRUE.equals(ctx.ruleMap.get(ValidationRule.ZERO_NULL_EQUALITY));
- }
-
- protected void addChecksFromValidationRules(ValidateCheckSet set, FormDataCheckContext ctx, Object value) {
- if (ctx.ruleMap == null || ctx.ruleMap.size() == 0) {
- return;
- }
- for (Map.Entry<String, Object> e : ctx.ruleMap.entrySet()) {
- if (e.getKey() == null) {
- continue;
- }
- ctx.ruleName = e.getKey();
- ctx.ruleValue = e.getValue();
- try {
- addCheckFromValidationRule(set, ctx, value);
- }
- catch (Throwable t) {
- LOG.error("failed creating check implementation for " + ctx.ruleName + "=" + ctx.ruleValue, t);
- }
- }
- return;
- }
-
- /**
- * override this method to support for more checks
- */
- protected void addCheckFromValidationRule(ValidateCheckSet set, FormDataCheckContext ctx, Object value) throws Exception {//NO_CHECKSTYLE
- String key = ctx.ruleName;
- if (key.equals(ValidationRule.CODE_TYPE)) {
- if (value == null || (value.getClass().isArray() && Array.getLength(value) == 0)) {
- return;
- }
- set.addCheck(new CodeValueCheck(createCodeTypeByValidationRules(ctx)));
- }
- else if (key.equals(ValidationRule.LOOKUP_CALL)) {
- if (value == null || (value.getClass().isArray() && Array.getLength(value) == 0)) {
- return;
- }
- set.addCheck(new LookupValueCheck(createLookupCallByValidationRules(ctx)));
- }
- else if (key.equals(ValidationRule.MANDATORY)) {
- if (!Boolean.TRUE.equals(ctx.ruleValue)) {
- return;
- }
- set.addCheck(new MandatoryCheck(true));
- }
- else if (key.equals(ValidationRule.MIN_LENGTH)) {
- set.addCheck(new MinLengthCheck(((Number) ctx.ruleValue).intValue()));
- }
- else if (key.equals(ValidationRule.MAX_LENGTH)) {
- set.addCheck(new MaxLengthCheck(((Number) ctx.ruleValue).intValue()));
- }
- else if (key.equals(ValidationRule.MIN_VALUE)) {
- if (value == null) {
- return;
- }
- set.addCheck(new MinValueCheck(ctx.ruleValue));
- }
- else if (key.equals(ValidationRule.MAX_VALUE)) {
- if (value == null) {
- return;
- }
- set.addCheck(new MaxValueCheck(ctx.ruleValue));
- }
- else if (key.equals(ValidationRule.REGEX)) {
- if (value == null) {
- return;
- }
- set.addCheck(new RegexMatchCheck((String) ctx.ruleValue));
- }
- else if (key.equals(ValidationRule.MASTER_VALUE_REQUIRED)) {
- //if slave value is null, no rule applies
- if (value == null || (value.getClass().isArray() && Array.getLength(value) == 0)) {
- return;
- }
- //slave is set and not null
- //is a master value necessary?
- if (!Boolean.TRUE.equals(ctx.ruleMap.get(ValidationRule.MASTER_VALUE_REQUIRED))) {
- return;
- }
- set.addCheck(new MasterValueRequiredCheck(ctx));
- }
- }
-
- protected ICodeType<?> createCodeTypeByValidationRules(FormDataCheckContext ctx) throws Exception {
- @SuppressWarnings("unchecked")
- Class<? extends ICodeType<?>> cls = (Class<? extends ICodeType<?>>) ctx.ruleValue;
- ICodeType<?> codeType = CODES.getCodeType(cls);
- if (codeType == null) {
- throw new ProcessingException(ctx.fieldName + " codeType " + cls.getSimpleName() + " does not exist");
- }
- return codeType;
- }
-
- @SuppressWarnings("unchecked")
- protected LookupCall createLookupCallByValidationRules(FormDataCheckContext ctx) throws Exception {
- Class<? extends LookupCall> cls = (Class<? extends LookupCall>) ctx.ruleValue;
- LookupCall call;
- try {
- call = cls.newInstance();
- }
- catch (Throwable t) {
- throw new ProcessingException(ctx.fieldName + " can not verify " + cls.getSimpleName());
- }
- //does a master value exist?
- if (ctx.ruleMap.containsKey(ValidationRule.MASTER_VALUE_FIELD)) {
- Class<? extends AbstractValueFieldData<?>> masterFieldClass = (Class<? extends AbstractValueFieldData<?>>) ctx.ruleMap.get(ValidationRule.MASTER_VALUE_FIELD);
- if (masterFieldClass == null) {
- throw new ProcessingException(ctx.fieldName + " missing master field");
- }
- AbstractValueFieldData<?> masterField = ctx.formData.getFieldByClass(masterFieldClass);
- if (masterField == null) {
- throw new ProcessingException(ctx.fieldName + " missing master field " + masterFieldClass.getSimpleName());
- }
- call.setMaster(masterField.getValue());
- }
- return call;
- }
-
- /*
- * tree walker
- */
-
- @Override
- protected void visitObject(Object obj, Collection<Annotation> annotationList) throws Exception {
- ValidateCheckSet additionalSubtreeSet = null;
- if (obj instanceof AbstractFormData) {
- //special node: form data fields
- validateFormDataFields((AbstractFormData) obj);
- }
- else {
- //default node
- additionalSubtreeSet = validateObjectByAnnotations(annotationList, obj);
- if (additionalSubtreeSet.isEmpty()) {
- additionalSubtreeSet = null;
- }
- }
- //subtree
- if (additionalSubtreeSet != null) {
- ValidateCheckSet oldSet = m_defaultCheckSet;
- try {
- m_defaultCheckSet = additionalSubtreeSet;
- additionalSubtreeSet.setParent(oldSet);
- //
- visitSubTree(obj);
- }
- finally {
- m_defaultCheckSet = oldSet;
- }
- }
- else {
- visitSubTree(obj);
- }
- }
-
- public static class FormDataCheckContext {
- public AbstractFormData formData;
- public String fieldName;
- public Map<String, Object> ruleMap;
- public String ruleName;
- public Object ruleValue;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.validate;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Array;
+import java.lang.reflect.Method;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.shared.data.form.AbstractFormData;
+import org.eclipse.scout.rt.shared.data.form.ValidationRule;
+import org.eclipse.scout.rt.shared.data.form.fields.AbstractFormFieldData;
+import org.eclipse.scout.rt.shared.data.form.fields.AbstractValueFieldData;
+import org.eclipse.scout.rt.shared.services.common.code.CODES;
+import org.eclipse.scout.rt.shared.services.common.code.ICodeType;
+import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
+import org.eclipse.scout.rt.shared.validate.annotations.CodeValue;
+import org.eclipse.scout.rt.shared.validate.annotations.LookupValue;
+import org.eclipse.scout.rt.shared.validate.annotations.Mandatory;
+import org.eclipse.scout.rt.shared.validate.annotations.MaxLength;
+import org.eclipse.scout.rt.shared.validate.annotations.MaxValue;
+import org.eclipse.scout.rt.shared.validate.annotations.MinLength;
+import org.eclipse.scout.rt.shared.validate.annotations.MinValue;
+import org.eclipse.scout.rt.shared.validate.annotations.RegexMatch;
+import org.eclipse.scout.rt.shared.validate.annotations.Treat0AsNull;
+import org.eclipse.scout.rt.shared.validate.annotations.ValidateAnnotationMarker;
+import org.eclipse.scout.rt.shared.validate.checks.CodeValueCheck;
+import org.eclipse.scout.rt.shared.validate.checks.LookupValueCheck;
+import org.eclipse.scout.rt.shared.validate.checks.MandatoryCheck;
+import org.eclipse.scout.rt.shared.validate.checks.MasterValueRequiredCheck;
+import org.eclipse.scout.rt.shared.validate.checks.MaxLengthCheck;
+import org.eclipse.scout.rt.shared.validate.checks.MaxLengthGenericCheck;
+import org.eclipse.scout.rt.shared.validate.checks.MaxValueCheck;
+import org.eclipse.scout.rt.shared.validate.checks.MinLengthCheck;
+import org.eclipse.scout.rt.shared.validate.checks.MinValueCheck;
+import org.eclipse.scout.rt.shared.validate.checks.RegexMatchCheck;
+
+/**
+ * Does input/output validation of arbitrary serializable data.
+ * <p>
+ * This default traverses all objects of the arguments map in the complete data structure by writing the object to a
+ * void stream.
+ * <p>
+ * This default delegates {@link AbstractFormData} to a {@link DefaultFormDataValidator} and does nothing otherwise.
+ * <p>
+ * Default maxLength is checked in {@link #checkMaxLenghtDefault(Object)}
+ */
+public class DefaultValidator extends ValidationUtility.ValidateTreeVisitor implements IValidator {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(DefaultValidator.class);
+ private static final Map<String, Object> NO_RULE_MAP = new HashMap<String, Object>();
+
+ private IValidationStrategy m_validationStrategy;
+ private ValidateCheckSet m_defaultCheckSet;
+ private HashSet<String/*id*/> m_consumedChecks = new HashSet<String/*id*/>();
+
+ public DefaultValidator(IValidationStrategy validationStrategy) {
+ m_validationStrategy = validationStrategy;
+ m_defaultCheckSet = new ValidateCheckSet();
+ }
+
+ @Override
+ public void validateMethodCall(Method m, Object[] parameters) throws Exception {
+ if (parameters == null || parameters.length == 0) {
+ return;
+ }
+ initDefaultChecks(m_defaultCheckSet);
+ if (m_defaultCheckSet.isEmpty()) {
+ m_defaultCheckSet = null;
+ }
+ Collection<Annotation>[] parameterAnnotations = collectParameterAnnotations(m);
+ for (int i = 0; i < parameters.length; i++) {
+ start(parameters[i], parameterAnnotations[i]);
+ }
+ }
+
+ @Override
+ public void validateParameter(Object parameter, Collection<Annotation> parameterAnnotations) throws Exception {
+ initDefaultChecks(m_defaultCheckSet);
+ if (m_defaultCheckSet.isEmpty()) {
+ m_defaultCheckSet = null;
+ }
+ start(parameter, parameterAnnotations);
+ }
+
+ protected void initDefaultChecks(ValidateCheckSet checkSet) {
+ checkSet.addCheck(new MaxLengthGenericCheck(250, 64000000, 64000000, 10000));
+ }
+
+ /**
+ * Collect list of annotations for each parameter based on the method declaration and all its super class method
+ * declarations.
+ * <p>
+ * See {@link ValidationUtility#getParameterAnnotations(Method)} for more details
+ */
+ protected Collection<Annotation>[] collectParameterAnnotations(Method m) {
+ return ValidationUtility.getParameterAnnotations(m);
+ }
+
+ /*
+ * Annotation based validation
+ */
+
+ protected ValidateCheckSet validateObjectByAnnotations(Collection<Annotation> annotationList, Object obj) throws Exception {
+ if (isTreat0AsNullFromAnnotations(annotationList)) {
+ obj = ValidationUtility.treat0AsNull(obj);
+ }
+ //default node: retrieve checks by annotations
+ ValidateCheckSet localSet = new ValidateCheckSet();
+ ValidateCheckSet subtreeSet = new ValidateCheckSet();
+ addChecksFromAnnotations(localSet, subtreeSet, annotationList, obj);
+ //do checks
+ m_consumedChecks.clear();
+ if (localSet != null) {
+ localSet.applyChecks(m_validationStrategy, obj, m_consumedChecks);
+ }
+ if (subtreeSet != null) {
+ subtreeSet.applyChecks(m_validationStrategy, obj, m_consumedChecks);
+ }
+ if (m_defaultCheckSet != null) {
+ m_defaultCheckSet.applyChecks(m_validationStrategy, obj, m_consumedChecks);
+ }
+ return subtreeSet;
+ }
+
+ protected boolean isTreat0AsNullFromAnnotations(Collection<Annotation> annotationList) {
+ if (annotationList.size() == 0) {
+ return false;
+ }
+ for (Annotation a : annotationList) {
+ if (a.annotationType() == Treat0AsNull.class) {
+ return ((Treat0AsNull) a).value();
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @param annotations
+ * are all annotations with a {@link ValidateAnnotationMarker}
+ */
+ protected void addChecksFromAnnotations(ValidateCheckSet localSet, ValidateCheckSet subtreeSet, Collection<Annotation> annotationList, Object value) {
+ if (annotationList.size() == 0) {
+ return;
+ }
+ for (Annotation a : annotationList) {
+ try {
+ addCheckFromAnnotation(localSet, subtreeSet, a, value);
+ }
+ catch (Throwable t) {
+ LOG.error("failed creating check implementation for " + a, t);
+ }
+ }
+ }
+
+ /**
+ * override this method to support for more check annotations (annotations marked with
+ * {@link ValidateAnnotationMarker}
+ */
+ protected void addCheckFromAnnotation(ValidateCheckSet localSet, ValidateCheckSet subtreeSet, Annotation a, Object value) throws Exception {
+ if (a.annotationType() == CodeValue.class) {
+ CodeValue x = (CodeValue) a;
+ if (value == null || (value.getClass().isArray() && Array.getLength(value) == 0)) {
+ return;
+ }
+ (x.subtree() ? subtreeSet : localSet).addCheck(new CodeValueCheck(CODES.getCodeType(x.value())));
+ }
+ else if (a.annotationType() == LookupValue.class) {
+ LookupValue x = (LookupValue) a;
+ if (value == null || (value.getClass().isArray() && Array.getLength(value) == 0)) {
+ return;
+ }
+ (x.subtree() ? subtreeSet : localSet).addCheck(new LookupValueCheck(x.value().newInstance()));
+ }
+ else if (a.annotationType() == Mandatory.class) {
+ Mandatory x = (Mandatory) a;
+ (x.subtree() ? subtreeSet : localSet).addCheck(new MandatoryCheck(x.value()));
+ }
+ else if (a.annotationType() == MinLength.class) {
+ MinLength x = (MinLength) a;
+ (x.subtree() ? subtreeSet : localSet).addCheck(new MinLengthCheck(x.value()));
+ }
+ else if (a.annotationType() == MaxLength.class) {
+ MaxLength x = (MaxLength) a;
+ (x.subtree() ? subtreeSet : localSet).addCheck(new MaxLengthCheck(x.value()));
+ }
+ else if (a.annotationType() == MinValue.class) {
+ if (value == null) {
+ return;
+ }
+ MinValue x = (MinValue) a;
+ (x.subtree() ? subtreeSet : localSet).addCheck(new MinValueCheck(x.value()));
+ }
+ else if (a.annotationType() == MaxValue.class) {
+ if (value == null) {
+ return;
+ }
+ MaxValue x = (MaxValue) a;
+ (x.subtree() ? subtreeSet : localSet).addCheck(new MaxValueCheck(x.value()));
+ }
+ else if (a.annotationType() == RegexMatch.class) {
+ if (value == null) {
+ return;
+ }
+ RegexMatch x = (RegexMatch) a;
+ (x.subtree() ? subtreeSet : localSet).addCheck(new RegexMatchCheck(x.value()));
+ }
+ }
+
+ /*
+ * FormData validation rule based validation
+ */
+ protected void validateFormDataFields(AbstractFormData formData) throws Exception {
+ for (Map<String, AbstractFormFieldData> map : formData.getAllFieldsRec().values()) {
+ for (AbstractFormFieldData field : map.values()) {
+ if (!field.isValueSet()) {
+ continue;
+ }
+ Map<String, Object> ruleMap = field.getValidationRules();
+ if (ruleMap.size() == 0) {
+ continue;
+ }
+ //
+ Object fieldValue = null;
+ if (field instanceof AbstractValueFieldData<?>) {
+ fieldValue = ((AbstractValueFieldData<?>) field).getValue();
+ }
+ //pre-mark the fieldValue object so the validation tree traversal will skip it when it continues
+ markObject(fieldValue);
+ validateFormDataFieldByValidationRules(formData, ruleMap, field.getClass().getSimpleName(), fieldValue);
+ }
+ }
+ }
+
+ protected void validateFormDataFieldByValidationRules(AbstractFormData formData, Map<String, Object> ruleMap, String fieldName, Object obj) throws Exception {
+ FormDataCheckContext ctx = new FormDataCheckContext();
+ ctx.formData = formData;
+ ctx.ruleMap = ruleMap;
+ ctx.fieldName = fieldName;
+ if (isTreat0AsNullFromValidationRules(ctx)) {
+ obj = ValidationUtility.treat0AsNull(obj);
+ }
+ //default node: retrieve checks by annotations
+ ValidateCheckSet localCheckSet = new ValidateCheckSet();
+ addChecksFromValidationRules(localCheckSet, ctx, obj);
+ //do checks
+ m_consumedChecks.clear();
+ if (localCheckSet != null) {
+ localCheckSet.applyChecks(m_validationStrategy, obj, m_consumedChecks);
+ }
+ if (m_defaultCheckSet != null) {
+ m_defaultCheckSet.applyChecks(m_validationStrategy, obj, m_consumedChecks);
+ }
+ }
+
+ protected boolean isTreat0AsNullFromValidationRules(FormDataCheckContext ctx) {
+ return Boolean.TRUE.equals(ctx.ruleMap.get(ValidationRule.ZERO_NULL_EQUALITY));
+ }
+
+ protected void addChecksFromValidationRules(ValidateCheckSet set, FormDataCheckContext ctx, Object value) {
+ if (ctx.ruleMap == null || ctx.ruleMap.size() == 0) {
+ return;
+ }
+ for (Map.Entry<String, Object> e : ctx.ruleMap.entrySet()) {
+ if (e.getKey() == null) {
+ continue;
+ }
+ ctx.ruleName = e.getKey();
+ ctx.ruleValue = e.getValue();
+ try {
+ addCheckFromValidationRule(set, ctx, value);
+ }
+ catch (Throwable t) {
+ LOG.error("failed creating check implementation for " + ctx.ruleName + "=" + ctx.ruleValue, t);
+ }
+ }
+ return;
+ }
+
+ /**
+ * override this method to support for more checks
+ */
+ protected void addCheckFromValidationRule(ValidateCheckSet set, FormDataCheckContext ctx, Object value) throws Exception {//NO_CHECKSTYLE
+ String key = ctx.ruleName;
+ if (key.equals(ValidationRule.CODE_TYPE)) {
+ if (value == null || (value.getClass().isArray() && Array.getLength(value) == 0)) {
+ return;
+ }
+ set.addCheck(new CodeValueCheck(createCodeTypeByValidationRules(ctx)));
+ }
+ else if (key.equals(ValidationRule.LOOKUP_CALL)) {
+ if (value == null || (value.getClass().isArray() && Array.getLength(value) == 0)) {
+ return;
+ }
+ set.addCheck(new LookupValueCheck(createLookupCallByValidationRules(ctx)));
+ }
+ else if (key.equals(ValidationRule.MANDATORY)) {
+ if (!Boolean.TRUE.equals(ctx.ruleValue)) {
+ return;
+ }
+ set.addCheck(new MandatoryCheck(true));
+ }
+ else if (key.equals(ValidationRule.MIN_LENGTH)) {
+ set.addCheck(new MinLengthCheck(((Number) ctx.ruleValue).intValue()));
+ }
+ else if (key.equals(ValidationRule.MAX_LENGTH)) {
+ set.addCheck(new MaxLengthCheck(((Number) ctx.ruleValue).intValue()));
+ }
+ else if (key.equals(ValidationRule.MIN_VALUE)) {
+ if (value == null) {
+ return;
+ }
+ set.addCheck(new MinValueCheck(ctx.ruleValue));
+ }
+ else if (key.equals(ValidationRule.MAX_VALUE)) {
+ if (value == null) {
+ return;
+ }
+ set.addCheck(new MaxValueCheck(ctx.ruleValue));
+ }
+ else if (key.equals(ValidationRule.REGEX)) {
+ if (value == null) {
+ return;
+ }
+ set.addCheck(new RegexMatchCheck((String) ctx.ruleValue));
+ }
+ else if (key.equals(ValidationRule.MASTER_VALUE_REQUIRED)) {
+ //if slave value is null, no rule applies
+ if (value == null || (value.getClass().isArray() && Array.getLength(value) == 0)) {
+ return;
+ }
+ //slave is set and not null
+ //is a master value necessary?
+ if (!Boolean.TRUE.equals(ctx.ruleMap.get(ValidationRule.MASTER_VALUE_REQUIRED))) {
+ return;
+ }
+ set.addCheck(new MasterValueRequiredCheck(ctx));
+ }
+ }
+
+ protected ICodeType<?> createCodeTypeByValidationRules(FormDataCheckContext ctx) throws Exception {
+ @SuppressWarnings("unchecked")
+ Class<? extends ICodeType<?>> cls = (Class<? extends ICodeType<?>>) ctx.ruleValue;
+ ICodeType<?> codeType = CODES.getCodeType(cls);
+ if (codeType == null) {
+ throw new ProcessingException(ctx.fieldName + " codeType " + cls.getSimpleName() + " does not exist");
+ }
+ return codeType;
+ }
+
+ @SuppressWarnings("unchecked")
+ protected LookupCall createLookupCallByValidationRules(FormDataCheckContext ctx) throws Exception {
+ Class<? extends LookupCall> cls = (Class<? extends LookupCall>) ctx.ruleValue;
+ LookupCall call;
+ try {
+ call = cls.newInstance();
+ }
+ catch (Throwable t) {
+ throw new ProcessingException(ctx.fieldName + " can not verify " + cls.getSimpleName());
+ }
+ //does a master value exist?
+ if (ctx.ruleMap.containsKey(ValidationRule.MASTER_VALUE_FIELD)) {
+ Class<? extends AbstractValueFieldData<?>> masterFieldClass = (Class<? extends AbstractValueFieldData<?>>) ctx.ruleMap.get(ValidationRule.MASTER_VALUE_FIELD);
+ if (masterFieldClass == null) {
+ throw new ProcessingException(ctx.fieldName + " missing master field");
+ }
+ AbstractValueFieldData<?> masterField = ctx.formData.getFieldByClass(masterFieldClass);
+ if (masterField == null) {
+ throw new ProcessingException(ctx.fieldName + " missing master field " + masterFieldClass.getSimpleName());
+ }
+ call.setMaster(masterField.getValue());
+ }
+ return call;
+ }
+
+ /*
+ * tree walker
+ */
+
+ @Override
+ protected void visitObject(Object obj, Collection<Annotation> annotationList) throws Exception {
+ ValidateCheckSet additionalSubtreeSet = null;
+ if (obj instanceof AbstractFormData) {
+ //special node: form data fields
+ validateFormDataFields((AbstractFormData) obj);
+ }
+ else {
+ //default node
+ additionalSubtreeSet = validateObjectByAnnotations(annotationList, obj);
+ if (additionalSubtreeSet.isEmpty()) {
+ additionalSubtreeSet = null;
+ }
+ }
+ //subtree
+ if (additionalSubtreeSet != null) {
+ ValidateCheckSet oldSet = m_defaultCheckSet;
+ try {
+ m_defaultCheckSet = additionalSubtreeSet;
+ additionalSubtreeSet.setParent(oldSet);
+ //
+ visitSubTree(obj);
+ }
+ finally {
+ m_defaultCheckSet = oldSet;
+ }
+ }
+ else {
+ visitSubTree(obj);
+ }
+ }
+
+ public static class FormDataCheckContext {
+ public AbstractFormData formData;
+ public String fieldName;
+ public Map<String, Object> ruleMap;
+ public String ruleName;
+ public Object ruleValue;
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/IValidationStrategy.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/IValidationStrategy.java
index d5f9dab78b..298ccbdc17 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/IValidationStrategy.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/IValidationStrategy.java
@@ -1,76 +1,76 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.validate;
-
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.scout.rt.shared.validate.checks.CodeValueCheck;
-import org.eclipse.scout.rt.shared.validate.checks.IValidateCheck;
-import org.eclipse.scout.rt.shared.validate.checks.LookupValueCheck;
-import org.eclipse.scout.rt.shared.validate.checks.MaxLengthCheck;
-import org.eclipse.scout.rt.shared.validate.checks.RegexMatchCheck;
-
-/**
- * The {@link DefaultValidator} in the
- * DefaultTransactionDelegate
- * reads this annotation in order to perform central input/output validation.
- */
-public interface IValidationStrategy {
-
- /**
- * @return true if the check is part of the validation strategy
- */
- boolean accept(IValidateCheck check);
-
- /**
- * Perform no checks on arguments of the annotated method.
- * Use this annotation on a service if you check the arguments yourself.
- * <p>
- * see {@link ValidationUtility}
- */
- public static class NO_CHECK implements IValidationStrategy {
- @Override
- public boolean accept(IValidateCheck check) {
- return false;
- }
- }
-
- /**
- * Only perform max length checks on the arguments of the annotated method
- */
- public static class QUERY implements IValidationStrategy {
- private Set<String> m_accept = new HashSet<String>(Arrays.asList(new String[]{
- MaxLengthCheck.ID,
- CodeValueCheck.ID,
- LookupValueCheck.ID,
- RegexMatchCheck.ID
- }));
-
- @Override
- public boolean accept(IValidateCheck check) {
- return m_accept.contains(check.getCheckId());
- }
- }
-
- /**
- * Perform all checks on the arguments of the annotated method
- */
- public static class PROCESS implements IValidationStrategy {
-
- @Override
- public boolean accept(IValidateCheck check) {
- return true;
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.validate;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.scout.rt.shared.validate.checks.CodeValueCheck;
+import org.eclipse.scout.rt.shared.validate.checks.IValidateCheck;
+import org.eclipse.scout.rt.shared.validate.checks.LookupValueCheck;
+import org.eclipse.scout.rt.shared.validate.checks.MaxLengthCheck;
+import org.eclipse.scout.rt.shared.validate.checks.RegexMatchCheck;
+
+/**
+ * The {@link DefaultValidator} in the
+ * DefaultTransactionDelegate
+ * reads this annotation in order to perform central input/output validation.
+ */
+public interface IValidationStrategy {
+
+ /**
+ * @return true if the check is part of the validation strategy
+ */
+ boolean accept(IValidateCheck check);
+
+ /**
+ * Perform no checks on arguments of the annotated method.
+ * Use this annotation on a service if you check the arguments yourself.
+ * <p>
+ * see {@link ValidationUtility}
+ */
+ public static class NO_CHECK implements IValidationStrategy {
+ @Override
+ public boolean accept(IValidateCheck check) {
+ return false;
+ }
+ }
+
+ /**
+ * Only perform max length checks on the arguments of the annotated method
+ */
+ public static class QUERY implements IValidationStrategy {
+ private Set<String> m_accept = new HashSet<String>(Arrays.asList(new String[]{
+ MaxLengthCheck.ID,
+ CodeValueCheck.ID,
+ LookupValueCheck.ID,
+ RegexMatchCheck.ID
+ }));
+
+ @Override
+ public boolean accept(IValidateCheck check) {
+ return m_accept.contains(check.getCheckId());
+ }
+ }
+
+ /**
+ * Perform all checks on the arguments of the annotated method
+ */
+ public static class PROCESS implements IValidationStrategy {
+
+ @Override
+ public boolean accept(IValidateCheck check) {
+ return true;
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/IValidator.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/IValidator.java
index 0f1e588537..027fd2efba 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/IValidator.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/IValidator.java
@@ -1,32 +1,32 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.validate;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
-import java.util.Collection;
-
-/**
- * Does input/output validation of arbitrary data.
- */
-public interface IValidator {
-
- /**
- * validate the object and its complete substructure tree
- */
- void validateParameter(Object parameter, Collection<Annotation> parameterAnnotations) throws Exception;
-
- /**
- * validate the objects and the complete substructure tree based on the parameter annotations of the method (and its
- * super methods)
- */
- void validateMethodCall(Method m, Object[] parameters) throws Exception;
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.validate;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.util.Collection;
+
+/**
+ * Does input/output validation of arbitrary data.
+ */
+public interface IValidator {
+
+ /**
+ * validate the object and its complete substructure tree
+ */
+ void validateParameter(Object parameter, Collection<Annotation> parameterAnnotations) throws Exception;
+
+ /**
+ * validate the objects and the complete substructure tree based on the parameter annotations of the method (and its
+ * super methods)
+ */
+ void validateMethodCall(Method m, Object[] parameters) throws Exception;
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/InputValidation.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/InputValidation.java
index f14237f37e..e6813b1931 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/InputValidation.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/InputValidation.java
@@ -1,33 +1,33 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.validate;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Use any of the {@link IValidationStrategy} values or a custom value
- * <p>
- * Method annotation on server service methods. This annotation is read by the DefaultValidator in the
- * DefaultTransactionDelegate to perform central input validation.
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.TYPE, ElementType.METHOD})
-public @interface InputValidation {
-
- /**
- * Any of the {@link IValidationStrategy} values or a custom strategy
- */
- Class<? extends IValidationStrategy> value();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.validate;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Use any of the {@link IValidationStrategy} values or a custom value
+ * <p>
+ * Method annotation on server service methods. This annotation is read by the DefaultValidator in the
+ * DefaultTransactionDelegate to perform central input validation.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.TYPE, ElementType.METHOD})
+public @interface InputValidation {
+
+ /**
+ * Any of the {@link IValidationStrategy} values or a custom strategy
+ */
+ Class<? extends IValidationStrategy> value();
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/OutputValidation.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/OutputValidation.java
index 8c43bc67ae..8a144a2c3e 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/OutputValidation.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/OutputValidation.java
@@ -1,33 +1,33 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.validate;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Use any of the {@link IValidationStrategy} values or a custom value
- * <p>
- * Method annotation on server service methods. This annotation is read by the DefaultValidator in the
- * DefaultTransactionDelegate to perform central output validation.
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.TYPE, ElementType.METHOD})
-public @interface OutputValidation {
-
- /**
- * Any of the {@link IValidationStrategy} values or a custom strategy
- */
- Class<? extends IValidationStrategy> value();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.validate;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Use any of the {@link IValidationStrategy} values or a custom value
+ * <p>
+ * Method annotation on server service methods. This annotation is read by the DefaultValidator in the
+ * DefaultTransactionDelegate to perform central output validation.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.TYPE, ElementType.METHOD})
+public @interface OutputValidation {
+
+ /**
+ * Any of the {@link IValidationStrategy} values or a custom strategy
+ */
+ Class<? extends IValidationStrategy> value();
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/ValidateCheckSet.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/ValidateCheckSet.java
index 8ba8135f6b..e31ffb554d 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/ValidateCheckSet.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/ValidateCheckSet.java
@@ -1,80 +1,80 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.validate;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.ListIterator;
-
-import org.eclipse.scout.rt.shared.validate.checks.IValidateCheck;
-
-/**
- * Container for checks on specific object and subtree
- * <p>
- * Checks are applied iff no excplicit checks are found. The checks are evaluated from right to left (last added checks
- * before first added checks). When a check with the same id has already been run (accepted), all others with same class
- * are ignored.
- */
-public class ValidateCheckSet {
- private final List<IValidateCheck> m_checks;
- private ValidateCheckSet m_parent;
-
- public ValidateCheckSet() {
- m_checks = new ArrayList<IValidateCheck>();
- }
-
- public ValidateCheckSet getParent() {
- return m_parent;
- }
-
- public void setParent(ValidateCheckSet parent) {
- m_parent = parent;
- }
-
- public boolean isEmpty() {
- return m_checks.isEmpty();
- }
-
- public void addCheck(IValidateCheck check) {
- if (check != null) {
- m_checks.add(check);
- }
- }
-
- public void applyChecks(IValidationStrategy strategy, Object obj, HashSet<String> consumedChecks) throws Exception {
- if (isEmpty() && m_parent == null) {
- return;
- }
- for (ListIterator<IValidateCheck> it = m_checks.listIterator(m_checks.size()); it.hasPrevious();) {
- IValidateCheck check = it.previous();
- String id = check.getCheckId();
- if (consumedChecks.contains(id)) {
- continue;
- }
- if (!strategy.accept(check)) {
- continue;
- }
- if (check.accept(obj)) {
- consumedChecks.add(id);
- check.check(obj);
- }
- }
- if (m_parent != null) {
- m_parent.applyChecks(strategy, obj, consumedChecks);
- }
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName() + m_checks + ", parent=" + m_parent;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.validate;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.ListIterator;
+
+import org.eclipse.scout.rt.shared.validate.checks.IValidateCheck;
+
+/**
+ * Container for checks on specific object and subtree
+ * <p>
+ * Checks are applied iff no excplicit checks are found. The checks are evaluated from right to left (last added checks
+ * before first added checks). When a check with the same id has already been run (accepted), all others with same class
+ * are ignored.
+ */
+public class ValidateCheckSet {
+ private final List<IValidateCheck> m_checks;
+ private ValidateCheckSet m_parent;
+
+ public ValidateCheckSet() {
+ m_checks = new ArrayList<IValidateCheck>();
+ }
+
+ public ValidateCheckSet getParent() {
+ return m_parent;
+ }
+
+ public void setParent(ValidateCheckSet parent) {
+ m_parent = parent;
+ }
+
+ public boolean isEmpty() {
+ return m_checks.isEmpty();
+ }
+
+ public void addCheck(IValidateCheck check) {
+ if (check != null) {
+ m_checks.add(check);
+ }
+ }
+
+ public void applyChecks(IValidationStrategy strategy, Object obj, HashSet<String> consumedChecks) throws Exception {
+ if (isEmpty() && m_parent == null) {
+ return;
+ }
+ for (ListIterator<IValidateCheck> it = m_checks.listIterator(m_checks.size()); it.hasPrevious();) {
+ IValidateCheck check = it.previous();
+ String id = check.getCheckId();
+ if (consumedChecks.contains(id)) {
+ continue;
+ }
+ if (!strategy.accept(check)) {
+ continue;
+ }
+ if (check.accept(obj)) {
+ consumedChecks.add(id);
+ check.check(obj);
+ }
+ }
+ if (m_parent != null) {
+ m_parent.applyChecks(strategy, obj, consumedChecks);
+ }
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + m_checks + ", parent=" + m_parent;
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/ValidationUtility.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/ValidationUtility.java
index 2dc42d2173..4f11c946fc 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/ValidationUtility.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/ValidationUtility.java
@@ -1,617 +1,617 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.validate;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Array;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.regex.Pattern;
-
-import org.eclipse.scout.commons.TypeCastUtility;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.shared.services.common.code.ICodeType;
-import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
-import org.eclipse.scout.rt.shared.validate.annotations.FieldReference;
-import org.eclipse.scout.rt.shared.validate.annotations.ValidateAnnotationMarker;
-
-/**
- * Does basic input value validation on form data fields.
- */
-public final class ValidationUtility {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(ValidationUtility.class);
-
- @SuppressWarnings("unchecked")
- public static final Collection<Annotation> NO_ANNOTATIONS = Collections.unmodifiableList(Collections.EMPTY_LIST);
-
- private ValidationUtility() {
- }
-
- /**
- * @return null iff value is numeric and 0, otherwise teh original value
- */
- public static Object treat0AsNull(Object value) {
- if (value != null) {
- // equality is provided and a value is set
- // if provided value corresponds to 0, provided null to the check method (reject validation)
- if (value instanceof Number) {
- if (((Number) value).longValue() == 0L) {
- return null;
- }
- }
- }
- return value;
- }
-
- /**
- * check if value is an array
- */
- public static void checkArray(Object array) throws ProcessingException {
- if (array == null || !array.getClass().isArray()) {
- throw new ProcessingException("value is no array");
- }
- }
-
- public static void checkMandatoryValue(Object value) throws ProcessingException {
- if (value == null) {
- throw new ProcessingException("value is required");
- }
- }
-
- public static void checkMandatoryArray(Object array) throws ProcessingException {
- checkArray(array);
- if (Array.getLength(array) == 0) {
- throw new ProcessingException("value is required");
- }
- }
-
- public static void checkMinLength(Object value, Object minLength) throws ProcessingException {
- if (value == null || minLength == null) {
- return;
- }
- int min = ((Number) minLength).intValue();
- if (value instanceof String) {
- if (((String) value).length() < min) {
- throw new ProcessingException("value is too short");
- }
- }
- else if (value.getClass().isArray()) {
- if (Array.getLength(value) < min) {
- throw new ProcessingException("value is too short");
- }
- }
- else if (value instanceof Collection<?>) {
- if (((Collection<?>) value).size() < min) {
- throw new ProcessingException("value is too short");
- }
- }
- else if (value instanceof Map<?, ?>) {
- if (((Map<?, ?>) value).size() < min) {
- throw new ProcessingException("value is too short");
- }
- }
- else {
- if (value.toString().length() < min) {
- throw new ProcessingException("value is too short");
- }
- }
- }
-
- public static void checkMaxLength(Object value, Object maxLength) throws ProcessingException {
- if (value == null || maxLength == null) {
- return;
- }
- int max = ((Number) maxLength).intValue();
- if (value instanceof String) {
- if (((String) value).length() > max) {
- throw new ProcessingException("value is too long");
- }
- }
- else if (value.getClass().isArray()) {
- if (Array.getLength(value) > max) {
- throw new ProcessingException("value is too long");
- }
- }
- else if (value instanceof Collection<?>) {
- if (((Collection<?>) value).size() > max) {
- throw new ProcessingException("value is too long");
- }
- }
- else if (value instanceof Map<?, ?>) {
- if (((Map<?, ?>) value).size() > max) {
- throw new ProcessingException("value is too long");
- }
- }
- else {
- if (value.toString().length() > max) {
- throw new ProcessingException("value is too long");
- }
- }
- }
-
- @SuppressWarnings("unchecked")
- public static void checkMinValue(Object value, Object minValue) throws ProcessingException {
- if (value == null || minValue == null) {
- return;
- }
- minValue = TypeCastUtility.castValue(minValue, value.getClass());
- if (((Comparable) value).compareTo(minValue) < 0) {
- throw new ProcessingException("value is too small");
- }
- }
-
- @SuppressWarnings("unchecked")
- public static void checkMaxValue(Object value, Object maxValue) throws ProcessingException {
- if (value == null || maxValue == null) {
- return;
- }
- maxValue = TypeCastUtility.castValue(maxValue, value.getClass());
- if (((Comparable) value).compareTo(maxValue) > 0) {
- throw new ProcessingException("value is too large");
- }
- }
-
- public static void checkCodeTypeValue(Object codeKey, ICodeType<?> codeType) throws ProcessingException {
- if (codeKey == null || codeType == null) {
- return;
- }
- if (codeType.getCode(codeKey) == null) {
- throw new ProcessingException("value " + codeKey + " is illegal for " + codeType.getClass().getSimpleName());
- }
- }
-
- public static void checkCodeTypeArray(Object codeKeyArray, ICodeType<?> codeType) throws ProcessingException {
- if (codeKeyArray == null || codeType == null) {
- return;
- }
- checkArray(codeKeyArray);
- int len = Array.getLength(codeKeyArray);
- if (len == 0) {
- return;
- }
- for (int i = 0; i < len; i++) {
- Object codeKey = Array.get(codeKeyArray, i);
- if (codeType.getCode(codeKey) == null) {
- throw new ProcessingException("value " + codeKey + " is illegal for " + codeType.getClass().getSimpleName());
- }
- }
- }
-
- public static void checkLookupCallValue(Object lookupKey, LookupCall call) throws ProcessingException {
- if (lookupKey == null || call == null) {
- return;
- }
- call.setKey(lookupKey);
- if (call.getDataByKey().length == 0) {
- throw new ProcessingException("value " + lookupKey + " is illegal for " + call.getClass().getSimpleName());
- }
- }
-
- public static void checkLookupCallArray(Object lookupKeyArray, LookupCall call) throws ProcessingException {
- if (lookupKeyArray == null || call == null) {
- return;
- }
- checkArray(lookupKeyArray);
- int len = Array.getLength(lookupKeyArray);
- if (len == 0) {
- return;
- }
- for (int i = 0; i < len; i++) {
- Object lookupKey = Array.get(lookupKeyArray, i);
- call.setKey(lookupKey);
- if (call.getDataByKey().length == 0) {
- throw new ProcessingException("value " + lookupKey + " is illegal for " + call.getClass().getSimpleName());
- }
- }
- }
-
- /**
- * Checks if the string value (if not null) matches the regex.
- * If the regex is a string, the pattern created uses case insensitive {@link Pattern#CASE_INSENSITIVE} and
- * full-text-scan {@link Pattern#DOTALL}.
- *
- * @param value
- * @param regex
- */
- public static void checkRegexMatchValue(Object value, Pattern regex) throws ProcessingException {
- if (value == null || regex == null) {
- return;
- }
- if (!(value instanceof String)) {
- throw new ProcessingException("value value is no string");
- }
- //
- if (!regex.matcher((String) value).matches()) {
- throw new ProcessingException("value is not valid");
- }
- }
-
- /**
- * see {@link #checkRegexMatchValue(Object, Pattern)}
- */
- public static void checkRegexMatchArray(Object arrayOfStrings, Pattern regex) throws ProcessingException {
- if (arrayOfStrings == null || regex == null) {
- return;
- }
- checkArray(arrayOfStrings);
- int len = Array.getLength(arrayOfStrings);
- if (len == 0) {
- return;
- }
- for (int i = 0; i < len; i++) {
- Object value = Array.get(arrayOfStrings, i);
- if (!(value instanceof String)) {
- throw new ProcessingException("value value is no string");
- }
- if (!regex.matcher((String) value).matches()) {
- throw new ProcessingException("value is not valid");
- }
- }
- }
-
- private static final HashMap<Class<?>, ClassMetaData> classMetaDataCache = new HashMap<Class<?>, ValidationUtility.ClassMetaData>();
- private static final ClassMetaData NO_CLASS_META_DATA = new ClassMetaData();
-
- /**
- * Collect list of annotations for each parameter based on the method declaration and all its super class method
- * declarations.
- * <p>
- * Since java knows multiple inheritance with interfaces and even loops, there is no deterministic way of collecting
- * annotations for a method. The default implementation collects the validation annotations in the order as
- * illustrated in the following example with the method "hello" that is overridden in every possible level.
- *
- * <pre>
- * interface I1a {
- * void hello(@MaxLength(1) String s);
- * }
- *
- * interface I1b {
- * void hello(@MaxLength(2) String s);
- * }
- *
- * interface I1c {
- * void hello(@MaxLength(3) String s);
- * }
- *
- * class A1 implements I1a, I1b, I1c {
- * void hello(@MaxLength(4) String s) {
- * }
- * }
- *
- * interface I2a extends I1a {
- * void hello(@MaxLength(5) String s);
- * }
- *
- * interface I2b extends I1a {
- * void hello(@MaxLength(6) String s);
- * }
- *
- * interface I2c extends I1a {
- * void hello(@MaxLength(7) String s);
- * }
- *
- * class A2 extends A1 implements I2a, I2b, I2c {
- * void hello(@MaxLength(8) String s) {
- * }
- * }
- * </pre>
- *
- * The order of annotation traversal for A2.hello is A2, I2a, I2b, I2c, A1, I1a, I1b, I1c. This leads to using the
- * validation MaxLength(8).
- * <p>
- * The basic traversal ruls is
- * <ul>
- * <li>declaring class C of method</li>
- * <li>direct (first level) of implemented interfaces of C</li>
- * <li>super class of C</li>
- * <li>recursive up the superclass hierarchy</li>
- * </ul>
- */
- @SuppressWarnings("unchecked")
- public static Collection<Annotation>[] getParameterAnnotations(Method m) {
- MethodMetaData meta = getMethodMetaData(m);
- if (meta == NO_METHOD_META_DATA) {
- return new Collection[0];
- }
- //create a safe copy
- Collection<Annotation>[] copy = new Collection[meta.paramAnnotationList.length];
- System.arraycopy(meta.paramAnnotationList, 0, copy, 0, copy.length);
- return copy;
- }
-
- /**
- * cache for Class->ClassMetaData
- */
- @SuppressWarnings("unchecked")
- private static synchronized ClassMetaData getClassMetaData(Class<?> c) {
- ClassMetaData meta = classMetaDataCache.get(c);
- if (meta != null) {
- return meta;
- }
- HashMap<Field, List<Annotation>> fieldMap = new HashMap<Field, List<Annotation>>();
- HashMap<String, List<Annotation>> phantomFieldMap = new HashMap<String, List<Annotation>>();
- Class<?> tmp = c;
- while (tmp != null && tmp != Object.class) {
- Field[] fields = tmp.getDeclaredFields();
- if (fields != null && fields.length > 0) {
- for (Field field : fields) {
- FieldReference refAnnotation = field.getAnnotation(FieldReference.class);
- if ((refAnnotation != null) || (!field.isSynthetic() && (field.getModifiers() & Modifier.STATIC) == 0)) {
- ArrayList<Annotation> aList = new ArrayList<Annotation>();
- Annotation[] aArray = field.getAnnotations();
- if (aArray != null) {
- for (Annotation a : aArray) {
- if (a.annotationType().getAnnotation(ValidateAnnotationMarker.class) != null) {
- aList.add(a);
- }
- }
- }
- if (refAnnotation != null) {
- String fname = field.getAnnotation(FieldReference.class).value();
- phantomFieldMap.put(fname, aList);
- }
- else {
- fieldMap.put(field, aList);
- }
- }
- }
- }
- //next
- tmp = tmp.getSuperclass();
- }
- if (phantomFieldMap.size() > 0) {
- for (Map.Entry<Field, List<Annotation>> entry : fieldMap.entrySet()) {
- List<Annotation> aList = phantomFieldMap.get(entry.getKey().getName());
- if (aList != null) {
- entry.getValue().addAll(aList);
- }
- }
- //warn for missing phantom fields
- for (Field f : fieldMap.keySet()) {
- phantomFieldMap.remove(f.getName());
- }
- for (String fname : phantomFieldMap.keySet()) {
- LOG.warn("The phantom field " + c.getName() + "#" + fname + " points to @FieldReference(" + fname + ") that does not exist");
- }
- }
- if (fieldMap.size() == 0) {
- meta = NO_CLASS_META_DATA;
- }
- else {
- meta = new ClassMetaData();
- meta.fields = new Field[fieldMap.size()];
- meta.fieldAnnotationList = new Collection[fieldMap.size()];
- int index = 0;
- for (Map.Entry<Field, List<Annotation>> entry : fieldMap.entrySet()) {
- meta.fields[index] = entry.getKey();
- Collection<Annotation> value = entry.getValue();
- if (value.size() == 0) {
- meta.fieldAnnotationList[index] = NO_ANNOTATIONS;
- }
- else {
- //make collection safe
- meta.fieldAnnotationList[index] = Collections.unmodifiableCollection(value);
- }
- //next index
- index++;
- }
- }
- classMetaDataCache.put(c, meta);
- return meta;
- }
-
- private static final HashMap<Method, MethodMetaData> methodMetaDataCache = new HashMap<Method, MethodMetaData>();
- private static final MethodMetaData NO_METHOD_META_DATA = new MethodMetaData();
-
- /**
- * cache for Method->MethodMetaData
- */
- @SuppressWarnings("unchecked")
- private static synchronized MethodMetaData getMethodMetaData(Method m) {
- MethodMetaData meta = methodMetaDataCache.get(m);
- if (meta != null) {
- return meta;
- }
- String name = m.getName();
- Class<?>[] types = m.getParameterTypes();
- if (types == null || types.length == 0) {
- methodMetaDataCache.put(m, NO_METHOD_META_DATA);
- return NO_METHOD_META_DATA;
- }
- int paramCount = types.length;
- Class<?> c = m.getDeclaringClass();
- ArrayList<Annotation[][]> stack = new ArrayList<Annotation[][]>();
- while (c != null && c != Object.class) {
- //check class
- try {
- stack.add(c.getMethod(name, types).getParameterAnnotations());
- }
- catch (Throwable t) {
- //method not found
- }
- //check direct declared interfaces
- Class<?>[] ifs = c.getInterfaces();
- if (ifs != null && ifs.length > 0) {
- for (Class<?> i : ifs) {
- try {
- stack.add(i.getMethod(name, types).getParameterAnnotations());
- }
- catch (Throwable t) {
- //method not found
- }
- }
- }
- //super class
- c = c.getSuperclass();
- }
- ArrayList<Annotation>[] annListPerParam = new ArrayList[paramCount];
- for (int p = 0; p < paramCount; p++) {
- annListPerParam[p] = new ArrayList<Annotation>(0);
- }
- for (int s = stack.size() - 1; s >= 0; s--) {
- Annotation[][] elem = stack.get(s);
- if (elem == null) {
- continue;
- }
- for (int p = 0; p < paramCount; p++) {
- for (Annotation a : elem[p]) {
- if (a.annotationType().getAnnotation(ValidateAnnotationMarker.class) != null) {
- annListPerParam[p].add(a);
- }
- }
- }
- }
- //create safe collections
- meta = new MethodMetaData();
- meta.paramAnnotationList = new Collection[paramCount];
- for (int p = 0; p < paramCount; p++) {
- meta.paramAnnotationList[p] = Collections.unmodifiableCollection(annListPerParam[p]);
- }
- methodMetaDataCache.put(m, meta);
- return meta;
- }
-
- /**
- * Traverse all objects in the subtree and call {@link #visitObject(Object, Annotation[])} on every traversed Object
- * in the
- * hierarchy. For fields the annotations are collected (including annotations placed on types with reference to the
- * field).
- * <p>
- * Override {@link #visitObject(Object, Annotation[])} for custom handling.
- */
- public static abstract class ValidateTreeVisitor {
- private HashMap<Field, Annotation[]> m_fieldToAnnotationsCache;
- private HashSet<Object> m_markedSet;
-
- public ValidateTreeVisitor() {
- m_fieldToAnnotationsCache = new HashMap<Field, Annotation[]>();
- }
-
- public void start(Object obj, Collection<Annotation> annotations) throws Exception {
- m_markedSet = new HashSet<Object>();
- processNode(obj, annotations == null ? NO_ANNOTATIONS : annotations);
- m_markedSet = null;
- }
-
- /**
- * Visit an object in the composite object tree.
- * If you want the visitor to continue and visit the subtree of this object, then call visitSubTree(), otherwiese
- * simply return to not visit the subtree under this Object.
- * <p>
- * Override this method for custom handling
- */
- protected void visitObject(Object obj, Collection<Annotation> annotationList) throws Exception {
- visitSubTree(obj);
- }
-
- /**
- * mark object so it is not visited again. objects passed to {@link #visitObject(Object)} are already marked.
- */
- protected void markObject(Object obj) throws Exception {
- m_markedSet.add(obj);
- }
-
- /**
- * visit the complete subtree under the object (not including the object).
- * <p>
- * Normally this method is not overridden.
- */
- protected void visitSubTree(Object obj) throws Exception {
- processSubTree(obj);
- }
-
- private void processNode(Object obj, Collection<Annotation> annotationList) throws Exception {
- if (obj == null && annotationList.size() == 0) {
- return;
- }
- if (obj != null) {
- if (m_markedSet.contains(obj)) {
- return;
- }
- markObject(obj);
- }
- visitObject(obj, annotationList);
- }
-
- private void processSubTree(Object obj) throws Exception {
- if (obj == null) {
- return;
- }
- Class<?> c = obj.getClass();
- //filter leaf nodes
- if (c == null) {
- return;
- }
- if (c.isPrimitive() || c == Byte.class || c == Short.class || c == Integer.class || c == Long.class || c == Float.class || c == Double.class || c == Character.class || c == Boolean.class || c == String.class) {
- return;
- }
- if (obj instanceof Type) {
- return;
- }
- //visit children
- if (c.isArray()) {
- int len = Array.getLength(obj);
- for (int i = 0; i < len; i++) {
- processNode(Array.get(obj, i), NO_ANNOTATIONS);
- }
- return;
- }
- if (obj instanceof Collection) {
- for (Object elem : (Collection) obj) {
- processNode(elem, NO_ANNOTATIONS);
- }
- return;
- }
- if (obj instanceof Map) {
- for (Map.Entry<?, ?> entry : ((Map<?, ?>) obj).entrySet()) {
- processNode(entry.getKey(), NO_ANNOTATIONS);
- processNode(entry.getValue(), NO_ANNOTATIONS);
- }
- return;
- }
- ClassMetaData meta = getClassMetaData(c);
- if (meta != NO_CLASS_META_DATA) {
- for (int i = 0; i < meta.fields.length; i++) {
- Field field = meta.fields[i];
- field.setAccessible(true);
- Object childObj = field.get(obj);
- //filter value
- if (childObj instanceof CharSequence) {
- childObj = ((CharSequence) childObj).toString();
- }
- //handle
- Collection<Annotation> ann = meta.fieldAnnotationList[i];
- processNode(childObj, ann != null ? ann : NO_ANNOTATIONS);
- }
- }
- }
- }
-
- private static class ClassMetaData {
- Field[] fields;
- Collection<Annotation>[] fieldAnnotationList;
- }
-
- private static class MethodMetaData {
- Collection<Annotation>[] paramAnnotationList;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.validate;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Array;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Pattern;
+
+import org.eclipse.scout.commons.TypeCastUtility;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.shared.services.common.code.ICodeType;
+import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
+import org.eclipse.scout.rt.shared.validate.annotations.FieldReference;
+import org.eclipse.scout.rt.shared.validate.annotations.ValidateAnnotationMarker;
+
+/**
+ * Does basic input value validation on form data fields.
+ */
+public final class ValidationUtility {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(ValidationUtility.class);
+
+ @SuppressWarnings("unchecked")
+ public static final Collection<Annotation> NO_ANNOTATIONS = Collections.unmodifiableList(Collections.EMPTY_LIST);
+
+ private ValidationUtility() {
+ }
+
+ /**
+ * @return null iff value is numeric and 0, otherwise teh original value
+ */
+ public static Object treat0AsNull(Object value) {
+ if (value != null) {
+ // equality is provided and a value is set
+ // if provided value corresponds to 0, provided null to the check method (reject validation)
+ if (value instanceof Number) {
+ if (((Number) value).longValue() == 0L) {
+ return null;
+ }
+ }
+ }
+ return value;
+ }
+
+ /**
+ * check if value is an array
+ */
+ public static void checkArray(Object array) throws ProcessingException {
+ if (array == null || !array.getClass().isArray()) {
+ throw new ProcessingException("value is no array");
+ }
+ }
+
+ public static void checkMandatoryValue(Object value) throws ProcessingException {
+ if (value == null) {
+ throw new ProcessingException("value is required");
+ }
+ }
+
+ public static void checkMandatoryArray(Object array) throws ProcessingException {
+ checkArray(array);
+ if (Array.getLength(array) == 0) {
+ throw new ProcessingException("value is required");
+ }
+ }
+
+ public static void checkMinLength(Object value, Object minLength) throws ProcessingException {
+ if (value == null || minLength == null) {
+ return;
+ }
+ int min = ((Number) minLength).intValue();
+ if (value instanceof String) {
+ if (((String) value).length() < min) {
+ throw new ProcessingException("value is too short");
+ }
+ }
+ else if (value.getClass().isArray()) {
+ if (Array.getLength(value) < min) {
+ throw new ProcessingException("value is too short");
+ }
+ }
+ else if (value instanceof Collection<?>) {
+ if (((Collection<?>) value).size() < min) {
+ throw new ProcessingException("value is too short");
+ }
+ }
+ else if (value instanceof Map<?, ?>) {
+ if (((Map<?, ?>) value).size() < min) {
+ throw new ProcessingException("value is too short");
+ }
+ }
+ else {
+ if (value.toString().length() < min) {
+ throw new ProcessingException("value is too short");
+ }
+ }
+ }
+
+ public static void checkMaxLength(Object value, Object maxLength) throws ProcessingException {
+ if (value == null || maxLength == null) {
+ return;
+ }
+ int max = ((Number) maxLength).intValue();
+ if (value instanceof String) {
+ if (((String) value).length() > max) {
+ throw new ProcessingException("value is too long");
+ }
+ }
+ else if (value.getClass().isArray()) {
+ if (Array.getLength(value) > max) {
+ throw new ProcessingException("value is too long");
+ }
+ }
+ else if (value instanceof Collection<?>) {
+ if (((Collection<?>) value).size() > max) {
+ throw new ProcessingException("value is too long");
+ }
+ }
+ else if (value instanceof Map<?, ?>) {
+ if (((Map<?, ?>) value).size() > max) {
+ throw new ProcessingException("value is too long");
+ }
+ }
+ else {
+ if (value.toString().length() > max) {
+ throw new ProcessingException("value is too long");
+ }
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public static void checkMinValue(Object value, Object minValue) throws ProcessingException {
+ if (value == null || minValue == null) {
+ return;
+ }
+ minValue = TypeCastUtility.castValue(minValue, value.getClass());
+ if (((Comparable) value).compareTo(minValue) < 0) {
+ throw new ProcessingException("value is too small");
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public static void checkMaxValue(Object value, Object maxValue) throws ProcessingException {
+ if (value == null || maxValue == null) {
+ return;
+ }
+ maxValue = TypeCastUtility.castValue(maxValue, value.getClass());
+ if (((Comparable) value).compareTo(maxValue) > 0) {
+ throw new ProcessingException("value is too large");
+ }
+ }
+
+ public static void checkCodeTypeValue(Object codeKey, ICodeType<?> codeType) throws ProcessingException {
+ if (codeKey == null || codeType == null) {
+ return;
+ }
+ if (codeType.getCode(codeKey) == null) {
+ throw new ProcessingException("value " + codeKey + " is illegal for " + codeType.getClass().getSimpleName());
+ }
+ }
+
+ public static void checkCodeTypeArray(Object codeKeyArray, ICodeType<?> codeType) throws ProcessingException {
+ if (codeKeyArray == null || codeType == null) {
+ return;
+ }
+ checkArray(codeKeyArray);
+ int len = Array.getLength(codeKeyArray);
+ if (len == 0) {
+ return;
+ }
+ for (int i = 0; i < len; i++) {
+ Object codeKey = Array.get(codeKeyArray, i);
+ if (codeType.getCode(codeKey) == null) {
+ throw new ProcessingException("value " + codeKey + " is illegal for " + codeType.getClass().getSimpleName());
+ }
+ }
+ }
+
+ public static void checkLookupCallValue(Object lookupKey, LookupCall call) throws ProcessingException {
+ if (lookupKey == null || call == null) {
+ return;
+ }
+ call.setKey(lookupKey);
+ if (call.getDataByKey().length == 0) {
+ throw new ProcessingException("value " + lookupKey + " is illegal for " + call.getClass().getSimpleName());
+ }
+ }
+
+ public static void checkLookupCallArray(Object lookupKeyArray, LookupCall call) throws ProcessingException {
+ if (lookupKeyArray == null || call == null) {
+ return;
+ }
+ checkArray(lookupKeyArray);
+ int len = Array.getLength(lookupKeyArray);
+ if (len == 0) {
+ return;
+ }
+ for (int i = 0; i < len; i++) {
+ Object lookupKey = Array.get(lookupKeyArray, i);
+ call.setKey(lookupKey);
+ if (call.getDataByKey().length == 0) {
+ throw new ProcessingException("value " + lookupKey + " is illegal for " + call.getClass().getSimpleName());
+ }
+ }
+ }
+
+ /**
+ * Checks if the string value (if not null) matches the regex.
+ * If the regex is a string, the pattern created uses case insensitive {@link Pattern#CASE_INSENSITIVE} and
+ * full-text-scan {@link Pattern#DOTALL}.
+ *
+ * @param value
+ * @param regex
+ */
+ public static void checkRegexMatchValue(Object value, Pattern regex) throws ProcessingException {
+ if (value == null || regex == null) {
+ return;
+ }
+ if (!(value instanceof String)) {
+ throw new ProcessingException("value value is no string");
+ }
+ //
+ if (!regex.matcher((String) value).matches()) {
+ throw new ProcessingException("value is not valid");
+ }
+ }
+
+ /**
+ * see {@link #checkRegexMatchValue(Object, Pattern)}
+ */
+ public static void checkRegexMatchArray(Object arrayOfStrings, Pattern regex) throws ProcessingException {
+ if (arrayOfStrings == null || regex == null) {
+ return;
+ }
+ checkArray(arrayOfStrings);
+ int len = Array.getLength(arrayOfStrings);
+ if (len == 0) {
+ return;
+ }
+ for (int i = 0; i < len; i++) {
+ Object value = Array.get(arrayOfStrings, i);
+ if (!(value instanceof String)) {
+ throw new ProcessingException("value value is no string");
+ }
+ if (!regex.matcher((String) value).matches()) {
+ throw new ProcessingException("value is not valid");
+ }
+ }
+ }
+
+ private static final HashMap<Class<?>, ClassMetaData> classMetaDataCache = new HashMap<Class<?>, ValidationUtility.ClassMetaData>();
+ private static final ClassMetaData NO_CLASS_META_DATA = new ClassMetaData();
+
+ /**
+ * Collect list of annotations for each parameter based on the method declaration and all its super class method
+ * declarations.
+ * <p>
+ * Since java knows multiple inheritance with interfaces and even loops, there is no deterministic way of collecting
+ * annotations for a method. The default implementation collects the validation annotations in the order as
+ * illustrated in the following example with the method "hello" that is overridden in every possible level.
+ *
+ * <pre>
+ * interface I1a {
+ * void hello(@MaxLength(1) String s);
+ * }
+ *
+ * interface I1b {
+ * void hello(@MaxLength(2) String s);
+ * }
+ *
+ * interface I1c {
+ * void hello(@MaxLength(3) String s);
+ * }
+ *
+ * class A1 implements I1a, I1b, I1c {
+ * void hello(@MaxLength(4) String s) {
+ * }
+ * }
+ *
+ * interface I2a extends I1a {
+ * void hello(@MaxLength(5) String s);
+ * }
+ *
+ * interface I2b extends I1a {
+ * void hello(@MaxLength(6) String s);
+ * }
+ *
+ * interface I2c extends I1a {
+ * void hello(@MaxLength(7) String s);
+ * }
+ *
+ * class A2 extends A1 implements I2a, I2b, I2c {
+ * void hello(@MaxLength(8) String s) {
+ * }
+ * }
+ * </pre>
+ *
+ * The order of annotation traversal for A2.hello is A2, I2a, I2b, I2c, A1, I1a, I1b, I1c. This leads to using the
+ * validation MaxLength(8).
+ * <p>
+ * The basic traversal ruls is
+ * <ul>
+ * <li>declaring class C of method</li>
+ * <li>direct (first level) of implemented interfaces of C</li>
+ * <li>super class of C</li>
+ * <li>recursive up the superclass hierarchy</li>
+ * </ul>
+ */
+ @SuppressWarnings("unchecked")
+ public static Collection<Annotation>[] getParameterAnnotations(Method m) {
+ MethodMetaData meta = getMethodMetaData(m);
+ if (meta == NO_METHOD_META_DATA) {
+ return new Collection[0];
+ }
+ //create a safe copy
+ Collection<Annotation>[] copy = new Collection[meta.paramAnnotationList.length];
+ System.arraycopy(meta.paramAnnotationList, 0, copy, 0, copy.length);
+ return copy;
+ }
+
+ /**
+ * cache for Class->ClassMetaData
+ */
+ @SuppressWarnings("unchecked")
+ private static synchronized ClassMetaData getClassMetaData(Class<?> c) {
+ ClassMetaData meta = classMetaDataCache.get(c);
+ if (meta != null) {
+ return meta;
+ }
+ HashMap<Field, List<Annotation>> fieldMap = new HashMap<Field, List<Annotation>>();
+ HashMap<String, List<Annotation>> phantomFieldMap = new HashMap<String, List<Annotation>>();
+ Class<?> tmp = c;
+ while (tmp != null && tmp != Object.class) {
+ Field[] fields = tmp.getDeclaredFields();
+ if (fields != null && fields.length > 0) {
+ for (Field field : fields) {
+ FieldReference refAnnotation = field.getAnnotation(FieldReference.class);
+ if ((refAnnotation != null) || (!field.isSynthetic() && (field.getModifiers() & Modifier.STATIC) == 0)) {
+ ArrayList<Annotation> aList = new ArrayList<Annotation>();
+ Annotation[] aArray = field.getAnnotations();
+ if (aArray != null) {
+ for (Annotation a : aArray) {
+ if (a.annotationType().getAnnotation(ValidateAnnotationMarker.class) != null) {
+ aList.add(a);
+ }
+ }
+ }
+ if (refAnnotation != null) {
+ String fname = field.getAnnotation(FieldReference.class).value();
+ phantomFieldMap.put(fname, aList);
+ }
+ else {
+ fieldMap.put(field, aList);
+ }
+ }
+ }
+ }
+ //next
+ tmp = tmp.getSuperclass();
+ }
+ if (phantomFieldMap.size() > 0) {
+ for (Map.Entry<Field, List<Annotation>> entry : fieldMap.entrySet()) {
+ List<Annotation> aList = phantomFieldMap.get(entry.getKey().getName());
+ if (aList != null) {
+ entry.getValue().addAll(aList);
+ }
+ }
+ //warn for missing phantom fields
+ for (Field f : fieldMap.keySet()) {
+ phantomFieldMap.remove(f.getName());
+ }
+ for (String fname : phantomFieldMap.keySet()) {
+ LOG.warn("The phantom field " + c.getName() + "#" + fname + " points to @FieldReference(" + fname + ") that does not exist");
+ }
+ }
+ if (fieldMap.size() == 0) {
+ meta = NO_CLASS_META_DATA;
+ }
+ else {
+ meta = new ClassMetaData();
+ meta.fields = new Field[fieldMap.size()];
+ meta.fieldAnnotationList = new Collection[fieldMap.size()];
+ int index = 0;
+ for (Map.Entry<Field, List<Annotation>> entry : fieldMap.entrySet()) {
+ meta.fields[index] = entry.getKey();
+ Collection<Annotation> value = entry.getValue();
+ if (value.size() == 0) {
+ meta.fieldAnnotationList[index] = NO_ANNOTATIONS;
+ }
+ else {
+ //make collection safe
+ meta.fieldAnnotationList[index] = Collections.unmodifiableCollection(value);
+ }
+ //next index
+ index++;
+ }
+ }
+ classMetaDataCache.put(c, meta);
+ return meta;
+ }
+
+ private static final HashMap<Method, MethodMetaData> methodMetaDataCache = new HashMap<Method, MethodMetaData>();
+ private static final MethodMetaData NO_METHOD_META_DATA = new MethodMetaData();
+
+ /**
+ * cache for Method->MethodMetaData
+ */
+ @SuppressWarnings("unchecked")
+ private static synchronized MethodMetaData getMethodMetaData(Method m) {
+ MethodMetaData meta = methodMetaDataCache.get(m);
+ if (meta != null) {
+ return meta;
+ }
+ String name = m.getName();
+ Class<?>[] types = m.getParameterTypes();
+ if (types == null || types.length == 0) {
+ methodMetaDataCache.put(m, NO_METHOD_META_DATA);
+ return NO_METHOD_META_DATA;
+ }
+ int paramCount = types.length;
+ Class<?> c = m.getDeclaringClass();
+ ArrayList<Annotation[][]> stack = new ArrayList<Annotation[][]>();
+ while (c != null && c != Object.class) {
+ //check class
+ try {
+ stack.add(c.getMethod(name, types).getParameterAnnotations());
+ }
+ catch (Throwable t) {
+ //method not found
+ }
+ //check direct declared interfaces
+ Class<?>[] ifs = c.getInterfaces();
+ if (ifs != null && ifs.length > 0) {
+ for (Class<?> i : ifs) {
+ try {
+ stack.add(i.getMethod(name, types).getParameterAnnotations());
+ }
+ catch (Throwable t) {
+ //method not found
+ }
+ }
+ }
+ //super class
+ c = c.getSuperclass();
+ }
+ ArrayList<Annotation>[] annListPerParam = new ArrayList[paramCount];
+ for (int p = 0; p < paramCount; p++) {
+ annListPerParam[p] = new ArrayList<Annotation>(0);
+ }
+ for (int s = stack.size() - 1; s >= 0; s--) {
+ Annotation[][] elem = stack.get(s);
+ if (elem == null) {
+ continue;
+ }
+ for (int p = 0; p < paramCount; p++) {
+ for (Annotation a : elem[p]) {
+ if (a.annotationType().getAnnotation(ValidateAnnotationMarker.class) != null) {
+ annListPerParam[p].add(a);
+ }
+ }
+ }
+ }
+ //create safe collections
+ meta = new MethodMetaData();
+ meta.paramAnnotationList = new Collection[paramCount];
+ for (int p = 0; p < paramCount; p++) {
+ meta.paramAnnotationList[p] = Collections.unmodifiableCollection(annListPerParam[p]);
+ }
+ methodMetaDataCache.put(m, meta);
+ return meta;
+ }
+
+ /**
+ * Traverse all objects in the subtree and call {@link #visitObject(Object, Annotation[])} on every traversed Object
+ * in the
+ * hierarchy. For fields the annotations are collected (including annotations placed on types with reference to the
+ * field).
+ * <p>
+ * Override {@link #visitObject(Object, Annotation[])} for custom handling.
+ */
+ public static abstract class ValidateTreeVisitor {
+ private HashMap<Field, Annotation[]> m_fieldToAnnotationsCache;
+ private HashSet<Object> m_markedSet;
+
+ public ValidateTreeVisitor() {
+ m_fieldToAnnotationsCache = new HashMap<Field, Annotation[]>();
+ }
+
+ public void start(Object obj, Collection<Annotation> annotations) throws Exception {
+ m_markedSet = new HashSet<Object>();
+ processNode(obj, annotations == null ? NO_ANNOTATIONS : annotations);
+ m_markedSet = null;
+ }
+
+ /**
+ * Visit an object in the composite object tree.
+ * If you want the visitor to continue and visit the subtree of this object, then call visitSubTree(), otherwiese
+ * simply return to not visit the subtree under this Object.
+ * <p>
+ * Override this method for custom handling
+ */
+ protected void visitObject(Object obj, Collection<Annotation> annotationList) throws Exception {
+ visitSubTree(obj);
+ }
+
+ /**
+ * mark object so it is not visited again. objects passed to {@link #visitObject(Object)} are already marked.
+ */
+ protected void markObject(Object obj) throws Exception {
+ m_markedSet.add(obj);
+ }
+
+ /**
+ * visit the complete subtree under the object (not including the object).
+ * <p>
+ * Normally this method is not overridden.
+ */
+ protected void visitSubTree(Object obj) throws Exception {
+ processSubTree(obj);
+ }
+
+ private void processNode(Object obj, Collection<Annotation> annotationList) throws Exception {
+ if (obj == null && annotationList.size() == 0) {
+ return;
+ }
+ if (obj != null) {
+ if (m_markedSet.contains(obj)) {
+ return;
+ }
+ markObject(obj);
+ }
+ visitObject(obj, annotationList);
+ }
+
+ private void processSubTree(Object obj) throws Exception {
+ if (obj == null) {
+ return;
+ }
+ Class<?> c = obj.getClass();
+ //filter leaf nodes
+ if (c == null) {
+ return;
+ }
+ if (c.isPrimitive() || c == Byte.class || c == Short.class || c == Integer.class || c == Long.class || c == Float.class || c == Double.class || c == Character.class || c == Boolean.class || c == String.class) {
+ return;
+ }
+ if (obj instanceof Type) {
+ return;
+ }
+ //visit children
+ if (c.isArray()) {
+ int len = Array.getLength(obj);
+ for (int i = 0; i < len; i++) {
+ processNode(Array.get(obj, i), NO_ANNOTATIONS);
+ }
+ return;
+ }
+ if (obj instanceof Collection) {
+ for (Object elem : (Collection) obj) {
+ processNode(elem, NO_ANNOTATIONS);
+ }
+ return;
+ }
+ if (obj instanceof Map) {
+ for (Map.Entry<?, ?> entry : ((Map<?, ?>) obj).entrySet()) {
+ processNode(entry.getKey(), NO_ANNOTATIONS);
+ processNode(entry.getValue(), NO_ANNOTATIONS);
+ }
+ return;
+ }
+ ClassMetaData meta = getClassMetaData(c);
+ if (meta != NO_CLASS_META_DATA) {
+ for (int i = 0; i < meta.fields.length; i++) {
+ Field field = meta.fields[i];
+ field.setAccessible(true);
+ Object childObj = field.get(obj);
+ //filter value
+ if (childObj instanceof CharSequence) {
+ childObj = ((CharSequence) childObj).toString();
+ }
+ //handle
+ Collection<Annotation> ann = meta.fieldAnnotationList[i];
+ processNode(childObj, ann != null ? ann : NO_ANNOTATIONS);
+ }
+ }
+ }
+ }
+
+ private static class ClassMetaData {
+ Field[] fields;
+ Collection<Annotation>[] fieldAnnotationList;
+ }
+
+ private static class MethodMetaData {
+ Collection<Annotation>[] paramAnnotationList;
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/annotations/CodeValue.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/annotations/CodeValue.java
index 56a2225d23..cd5c29e73a 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/annotations/CodeValue.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/annotations/CodeValue.java
@@ -1,41 +1,41 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.validate.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import org.eclipse.scout.rt.shared.services.common.code.ICodeType;
-
-/**
- * value or array (each element) must be part of a code type enum
- * <p>
- * In order to treat 0 as null, use the {@link Treat0AsNull} annotation.
- * <p>
- * In order to annotate a field where you have no access (super class) you may consider using {@link FieldReference} on
- * a placeholder field.
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.FIELD, ElementType.PARAMETER})
-@ValidateAnnotationMarker
-public @interface CodeValue {
-
- Class<? extends ICodeType> value();
-
- /**
- * subtree=false is the default, the check is applied to the parameter or field only.
- * <p>
- * subtree=true causes the check to be applied to all objects in the subtree of this objects (deep structure) as well.
- */
- boolean subtree() default false;
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.validate.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.eclipse.scout.rt.shared.services.common.code.ICodeType;
+
+/**
+ * value or array (each element) must be part of a code type enum
+ * <p>
+ * In order to treat 0 as null, use the {@link Treat0AsNull} annotation.
+ * <p>
+ * In order to annotate a field where you have no access (super class) you may consider using {@link FieldReference} on
+ * a placeholder field.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.FIELD, ElementType.PARAMETER})
+@ValidateAnnotationMarker
+public @interface CodeValue {
+
+ Class<? extends ICodeType> value();
+
+ /**
+ * subtree=false is the default, the check is applied to the parameter or field only.
+ * <p>
+ * subtree=true causes the check to be applied to all objects in the subtree of this objects (deep structure) as well.
+ */
+ boolean subtree() default false;
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/annotations/FieldReference.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/annotations/FieldReference.java
index f1c7e08616..497397089d 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/annotations/FieldReference.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/annotations/FieldReference.java
@@ -1,41 +1,41 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.validate.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * In order to annotate fields that are not accessible (for example in subclassed types) this annotation can be placed
- * on a phantom field
- * together with validations. These validations are then applied to the referenced field instead.
- * <p>
- * Example:
- *
- * <pre>
- * class A {
- * private String m_name;
- * }
- *
- * class B extends A {
- * &#064;MaxLength(5000000)
- * &#064;FieldReference(&quot;m_name&quot;)
- * private static final int M_NAME_REF = 0;
- * }
- * </pre>
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.FIELD})
-public @interface FieldReference {
- String value();
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.validate.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * In order to annotate fields that are not accessible (for example in subclassed types) this annotation can be placed
+ * on a phantom field
+ * together with validations. These validations are then applied to the referenced field instead.
+ * <p>
+ * Example:
+ *
+ * <pre>
+ * class A {
+ * private String m_name;
+ * }
+ *
+ * class B extends A {
+ * &#064;MaxLength(5000000)
+ * &#064;FieldReference(&quot;m_name&quot;)
+ * private static final int M_NAME_REF = 0;
+ * }
+ * </pre>
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.FIELD})
+public @interface FieldReference {
+ String value();
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/annotations/LookupValue.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/annotations/LookupValue.java
index 98cde82e56..4a64a0d776 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/annotations/LookupValue.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/annotations/LookupValue.java
@@ -1,41 +1,41 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.validate.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
-
-/**
- * value or array (each element) must be part of a lookup call enum
- * <p>
- * In order to treat 0 as null, use the {@link Treat0AsNull} annotation.
- * <p>
- * In order to annotate a field where you have no access (super class) you may consider using {@link FieldReference} on
- * a placeholder field.
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.FIELD, ElementType.PARAMETER})
-@ValidateAnnotationMarker
-public @interface LookupValue {
-
- Class<? extends LookupCall> value();
-
- /**
- * subtree=false is the default, the check is applied to the parameter or field only.
- * <p>
- * subtree=true causes the check to be applied to all objects in the subtree of this objects (deep structure) as well.
- */
- boolean subtree() default false;
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.validate.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
+
+/**
+ * value or array (each element) must be part of a lookup call enum
+ * <p>
+ * In order to treat 0 as null, use the {@link Treat0AsNull} annotation.
+ * <p>
+ * In order to annotate a field where you have no access (super class) you may consider using {@link FieldReference} on
+ * a placeholder field.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.FIELD, ElementType.PARAMETER})
+@ValidateAnnotationMarker
+public @interface LookupValue {
+
+ Class<? extends LookupCall> value();
+
+ /**
+ * subtree=false is the default, the check is applied to the parameter or field only.
+ * <p>
+ * subtree=true causes the check to be applied to all objects in the subtree of this objects (deep structure) as well.
+ */
+ boolean subtree() default false;
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/annotations/Mandatory.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/annotations/Mandatory.java
index 1b610a8331..3665b18e6f 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/annotations/Mandatory.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/annotations/Mandatory.java
@@ -1,39 +1,39 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.validate.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * value or array is mandatory / required
- * <p>
- * In order to treat 0 as null, use the {@link Treat0AsNull} annotation.
- * <p>
- * In order to annotate a field where you have no access (super class) you may consider using {@link FieldReference} on
- * a placeholder field.
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.FIELD, ElementType.PARAMETER})
-@ValidateAnnotationMarker
-public @interface Mandatory {
-
- boolean value() default true;
-
- /**
- * subtree=false is the default, the check is applied to the parameter or field only.
- * <p>
- * subtree=true causes the check to be applied to all objects in the subtree of this objects (deep structure) as well.
- */
- boolean subtree() default false;
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.validate.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * value or array is mandatory / required
+ * <p>
+ * In order to treat 0 as null, use the {@link Treat0AsNull} annotation.
+ * <p>
+ * In order to annotate a field where you have no access (super class) you may consider using {@link FieldReference} on
+ * a placeholder field.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.FIELD, ElementType.PARAMETER})
+@ValidateAnnotationMarker
+public @interface Mandatory {
+
+ boolean value() default true;
+
+ /**
+ * subtree=false is the default, the check is applied to the parameter or field only.
+ * <p>
+ * subtree=true causes the check to be applied to all objects in the subtree of this objects (deep structure) as well.
+ */
+ boolean subtree() default false;
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/annotations/MaxLength.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/annotations/MaxLength.java
index a3f56a792b..e0aa3aa67c 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/annotations/MaxLength.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/annotations/MaxLength.java
@@ -1,36 +1,36 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.validate.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * maximum length for strings, char[], byte[], arrays
- * <p>
- * In order to annotate a field where you have no access (super class) you may consider using {@link FieldReference} on
- * a placeholder field.
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.FIELD, ElementType.PARAMETER})
-@ValidateAnnotationMarker
-public @interface MaxLength {
- int value();
-
- /**
- * subtree=false is the default, the check is applied to the parameter or field only.
- * <p>
- * subtree=true causes the check to be applied to all objects in the subtree of this objects (deep structure) as well.
- */
- boolean subtree() default false;
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.validate.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * maximum length for strings, char[], byte[], arrays
+ * <p>
+ * In order to annotate a field where you have no access (super class) you may consider using {@link FieldReference} on
+ * a placeholder field.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.FIELD, ElementType.PARAMETER})
+@ValidateAnnotationMarker
+public @interface MaxLength {
+ int value();
+
+ /**
+ * subtree=false is the default, the check is applied to the parameter or field only.
+ * <p>
+ * subtree=true causes the check to be applied to all objects in the subtree of this objects (deep structure) as well.
+ */
+ boolean subtree() default false;
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/annotations/MaxValue.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/annotations/MaxValue.java
index 031514adba..91fab4d2a2 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/annotations/MaxValue.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/annotations/MaxValue.java
@@ -1,37 +1,37 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.validate.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * maximum value
- * <p>
- * In order to annotate a field where you have no access (super class) you may consider using {@link FieldReference} on
- * a placeholder field.
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.FIELD, ElementType.PARAMETER})
-@ValidateAnnotationMarker
-public @interface MaxValue {
-
- double value();
-
- /**
- * subtree=false is the default, the check is applied to the parameter or field only.
- * <p>
- * subtree=true causes the check to be applied to all objects in the subtree of this objects (deep structure) as well.
- */
- boolean subtree() default false;
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.validate.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * maximum value
+ * <p>
+ * In order to annotate a field where you have no access (super class) you may consider using {@link FieldReference} on
+ * a placeholder field.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.FIELD, ElementType.PARAMETER})
+@ValidateAnnotationMarker
+public @interface MaxValue {
+
+ double value();
+
+ /**
+ * subtree=false is the default, the check is applied to the parameter or field only.
+ * <p>
+ * subtree=true causes the check to be applied to all objects in the subtree of this objects (deep structure) as well.
+ */
+ boolean subtree() default false;
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/annotations/MinLength.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/annotations/MinLength.java
index 57952224d8..0a5f3a0e9d 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/annotations/MinLength.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/annotations/MinLength.java
@@ -1,36 +1,36 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.validate.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * minimum length for strings, char[], byte[], arrays
- * <p>
- * In order to annotate a field where you have no access (super class) you may consider using {@link FieldReference} on
- * a placeholder field.
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.FIELD, ElementType.PARAMETER})
-@ValidateAnnotationMarker
-public @interface MinLength {
- int value();
-
- /**
- * subtree=false is the default, the check is applied to the parameter or field only.
- * <p>
- * subtree=true causes the check to be applied to all objects in the subtree of this objects (deep structure) as well.
- */
- boolean subtree() default false;
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.validate.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * minimum length for strings, char[], byte[], arrays
+ * <p>
+ * In order to annotate a field where you have no access (super class) you may consider using {@link FieldReference} on
+ * a placeholder field.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.FIELD, ElementType.PARAMETER})
+@ValidateAnnotationMarker
+public @interface MinLength {
+ int value();
+
+ /**
+ * subtree=false is the default, the check is applied to the parameter or field only.
+ * <p>
+ * subtree=true causes the check to be applied to all objects in the subtree of this objects (deep structure) as well.
+ */
+ boolean subtree() default false;
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/annotations/MinValue.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/annotations/MinValue.java
index 2caef74ac1..a70cf5a013 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/annotations/MinValue.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/annotations/MinValue.java
@@ -1,37 +1,37 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.validate.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * minimum value
- * <p>
- * In order to annotate a field where you have no access (super class) you may consider using {@link FieldReference} on
- * a placeholder field.
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.FIELD, ElementType.PARAMETER})
-@ValidateAnnotationMarker
-public @interface MinValue {
-
- double value();
-
- /**
- * subtree=false is the default, the check is applied to the parameter or field only.
- * <p>
- * subtree=true causes the check to be applied to all objects in the subtree of this objects (deep structure) as well.
- */
- boolean subtree() default false;
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.validate.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * minimum value
+ * <p>
+ * In order to annotate a field where you have no access (super class) you may consider using {@link FieldReference} on
+ * a placeholder field.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.FIELD, ElementType.PARAMETER})
+@ValidateAnnotationMarker
+public @interface MinValue {
+
+ double value();
+
+ /**
+ * subtree=false is the default, the check is applied to the parameter or field only.
+ * <p>
+ * subtree=true causes the check to be applied to all objects in the subtree of this objects (deep structure) as well.
+ */
+ boolean subtree() default false;
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/annotations/RegexMatch.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/annotations/RegexMatch.java
index 62d292309d..6827666094 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/annotations/RegexMatch.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/annotations/RegexMatch.java
@@ -1,39 +1,39 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.validate.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * string or string array (each element) must match regular expression
- * <p>
- * The created pattern uses case insensitive {@link Pattern#CASE_INSENSITIVE} and full-text-scan {@link Pattern#DOTALL}.
- * <p>
- * In order to annotate a field where you have no access (super class) you may consider using {@link FieldReference} on
- * a placeholder field.
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.FIELD, ElementType.PARAMETER})
-@ValidateAnnotationMarker
-public @interface RegexMatch {
-
- String value();
-
- /**
- * subtree=false is the default, the check is applied to the parameter or field only.
- * <p>
- * subtree=true causes the check to be applied to all objects in the subtree of this objects (deep structure) as well.
- */
- boolean subtree() default false;
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.validate.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * string or string array (each element) must match regular expression
+ * <p>
+ * The created pattern uses case insensitive {@link Pattern#CASE_INSENSITIVE} and full-text-scan {@link Pattern#DOTALL}.
+ * <p>
+ * In order to annotate a field where you have no access (super class) you may consider using {@link FieldReference} on
+ * a placeholder field.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.FIELD, ElementType.PARAMETER})
+@ValidateAnnotationMarker
+public @interface RegexMatch {
+
+ String value();
+
+ /**
+ * subtree=false is the default, the check is applied to the parameter or field only.
+ * <p>
+ * subtree=true causes the check to be applied to all objects in the subtree of this objects (deep structure) as well.
+ */
+ boolean subtree() default false;
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/annotations/Treat0AsNull.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/annotations/Treat0AsNull.java
index a577fcdc83..2ed1ee6675 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/annotations/Treat0AsNull.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/annotations/Treat0AsNull.java
@@ -1,26 +1,26 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.validate.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * The value - if numeric 0 - should be treated as null for validation
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.FIELD, ElementType.PARAMETER})
-@ValidateAnnotationMarker
-public @interface Treat0AsNull {
- boolean value() default true;
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.validate.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * The value - if numeric 0 - should be treated as null for validation
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.FIELD, ElementType.PARAMETER})
+@ValidateAnnotationMarker
+public @interface Treat0AsNull {
+ boolean value() default true;
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/annotations/ValidateAnnotationMarker.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/annotations/ValidateAnnotationMarker.java
index ed630821b7..643154593e 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/annotations/ValidateAnnotationMarker.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/annotations/ValidateAnnotationMarker.java
@@ -1,24 +1,24 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.validate.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Marker that an annotation is a validate annotation
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.ANNOTATION_TYPE})
-public @interface ValidateAnnotationMarker {
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.validate.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Marker that an annotation is a validate annotation
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.ANNOTATION_TYPE})
+public @interface ValidateAnnotationMarker {
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/checks/CodeValueCheck.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/checks/CodeValueCheck.java
index a3135532ed..8f59216c3a 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/checks/CodeValueCheck.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/checks/CodeValueCheck.java
@@ -1,53 +1,53 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.validate.checks;
-
-import org.eclipse.scout.rt.shared.services.common.code.ICodeType;
-import org.eclipse.scout.rt.shared.validate.ValidationUtility;
-import org.eclipse.scout.rt.shared.validate.annotations.CodeValue;
-
-/**
- * Check implementation of {@link CodeValue} annotation for method parameter or field.
- */
-public class CodeValueCheck implements IValidateCheck {
- public static final String ID = "codeValue";
-
- private ICodeType<?> m_codeType;
-
- public CodeValueCheck(ICodeType<?> codeType) {
- m_codeType = codeType;
- }
-
- @Override
- public String getCheckId() {
- return ID;
- }
-
- @Override
- public boolean accept(Object obj) {
- return obj != null;
- }
-
- @Override
- public void check(Object obj) throws Exception {
- if (obj.getClass().isArray()) {
- ValidationUtility.checkCodeTypeArray(obj, m_codeType);
- }
- else {
- ValidationUtility.checkCodeTypeValue(obj, m_codeType);
- }
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName() + " " + m_codeType.getClass().getSimpleName();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.validate.checks;
+
+import org.eclipse.scout.rt.shared.services.common.code.ICodeType;
+import org.eclipse.scout.rt.shared.validate.ValidationUtility;
+import org.eclipse.scout.rt.shared.validate.annotations.CodeValue;
+
+/**
+ * Check implementation of {@link CodeValue} annotation for method parameter or field.
+ */
+public class CodeValueCheck implements IValidateCheck {
+ public static final String ID = "codeValue";
+
+ private ICodeType<?> m_codeType;
+
+ public CodeValueCheck(ICodeType<?> codeType) {
+ m_codeType = codeType;
+ }
+
+ @Override
+ public String getCheckId() {
+ return ID;
+ }
+
+ @Override
+ public boolean accept(Object obj) {
+ return obj != null;
+ }
+
+ @Override
+ public void check(Object obj) throws Exception {
+ if (obj.getClass().isArray()) {
+ ValidationUtility.checkCodeTypeArray(obj, m_codeType);
+ }
+ else {
+ ValidationUtility.checkCodeTypeValue(obj, m_codeType);
+ }
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + " " + m_codeType.getClass().getSimpleName();
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/checks/IValidateCheck.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/checks/IValidateCheck.java
index f345f1036b..d3e92a59a4 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/checks/IValidateCheck.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/checks/IValidateCheck.java
@@ -1,36 +1,36 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.validate.checks;
-
-import org.eclipse.scout.rt.shared.validate.ValidateCheckSet;
-
-/**
- * A specific check that is performed by a validator
- */
-public interface IValidateCheck {
-
- /**
- * @return the check id. When multiple checks with the same id exist in a {@link ValidateCheckSet} then the latest
- * added (and accepted) is applied, the others are ignored.
- */
- String getCheckId();
-
- /**
- * @return true if the check can handle the object, resp. is appropriate for the object
- */
- boolean accept(Object obj);
-
- /**
- * @throws Exception
- * if the validation fails
- */
- void check(Object obj) throws Exception;
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.validate.checks;
+
+import org.eclipse.scout.rt.shared.validate.ValidateCheckSet;
+
+/**
+ * A specific check that is performed by a validator
+ */
+public interface IValidateCheck {
+
+ /**
+ * @return the check id. When multiple checks with the same id exist in a {@link ValidateCheckSet} then the latest
+ * added (and accepted) is applied, the others are ignored.
+ */
+ String getCheckId();
+
+ /**
+ * @return true if the check can handle the object, resp. is appropriate for the object
+ */
+ boolean accept(Object obj);
+
+ /**
+ * @throws Exception
+ * if the validation fails
+ */
+ void check(Object obj) throws Exception;
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/checks/LookupValueCheck.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/checks/LookupValueCheck.java
index e1f6a825b9..7ce1b00e76 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/checks/LookupValueCheck.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/checks/LookupValueCheck.java
@@ -1,54 +1,54 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.validate.checks;
-
-import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
-import org.eclipse.scout.rt.shared.validate.ValidationUtility;
-import org.eclipse.scout.rt.shared.validate.annotations.LookupValue;
-
-/**
- * Check implementation of {@link LookupValue} annotation for method parameter or field.
- */
-public class LookupValueCheck implements IValidateCheck {
- public static final String ID = "lookupValue";
-
- private LookupCall m_lookupCall;
-
- public LookupValueCheck(LookupCall lookupCall) {
- m_lookupCall = lookupCall;
- }
-
- @Override
- public String getCheckId() {
- return ID;
- }
-
- @Override
- public boolean accept(Object obj) {
- return obj != null;
- }
-
- @Override
- public void check(Object obj) throws Exception {
- if (obj.getClass().isArray()) {
- ValidationUtility.checkLookupCallArray(obj, m_lookupCall);
- }
- else {
- ValidationUtility.checkLookupCallValue(obj, m_lookupCall);
- }
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName() + " " + m_lookupCall.getClass().getSimpleName();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.validate.checks;
+
+import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
+import org.eclipse.scout.rt.shared.validate.ValidationUtility;
+import org.eclipse.scout.rt.shared.validate.annotations.LookupValue;
+
+/**
+ * Check implementation of {@link LookupValue} annotation for method parameter or field.
+ */
+public class LookupValueCheck implements IValidateCheck {
+ public static final String ID = "lookupValue";
+
+ private LookupCall m_lookupCall;
+
+ public LookupValueCheck(LookupCall lookupCall) {
+ m_lookupCall = lookupCall;
+ }
+
+ @Override
+ public String getCheckId() {
+ return ID;
+ }
+
+ @Override
+ public boolean accept(Object obj) {
+ return obj != null;
+ }
+
+ @Override
+ public void check(Object obj) throws Exception {
+ if (obj.getClass().isArray()) {
+ ValidationUtility.checkLookupCallArray(obj, m_lookupCall);
+ }
+ else {
+ ValidationUtility.checkLookupCallValue(obj, m_lookupCall);
+ }
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + " " + m_lookupCall.getClass().getSimpleName();
+ }
+
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/checks/MandatoryCheck.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/checks/MandatoryCheck.java
index 64f6e21a4f..abe6f7ea7b 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/checks/MandatoryCheck.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/checks/MandatoryCheck.java
@@ -1,55 +1,55 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.validate.checks;
-
-import org.eclipse.scout.rt.shared.validate.ValidationUtility;
-import org.eclipse.scout.rt.shared.validate.annotations.Mandatory;
-
-/**
- * Check implementation of {@link Mandatory} annotation for method parameter or field.
- */
-public class MandatoryCheck implements IValidateCheck {
- public static final String ID = "mandatory";
-
- private final boolean m_value;
-
- public MandatoryCheck(boolean value) {
- m_value = value;
- }
-
- @Override
- public String getCheckId() {
- return ID;
- }
-
- @Override
- public boolean accept(Object obj) {
- return true;
- }
-
- @Override
- public void check(Object obj) throws Exception {
- if (!m_value) {
- return;
- }
- if (obj != null && obj.getClass().isArray()) {
- ValidationUtility.checkMandatoryArray(obj);
- }
- else {
- ValidationUtility.checkMandatoryValue(obj);
- }
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName() + " " + m_value;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.validate.checks;
+
+import org.eclipse.scout.rt.shared.validate.ValidationUtility;
+import org.eclipse.scout.rt.shared.validate.annotations.Mandatory;
+
+/**
+ * Check implementation of {@link Mandatory} annotation for method parameter or field.
+ */
+public class MandatoryCheck implements IValidateCheck {
+ public static final String ID = "mandatory";
+
+ private final boolean m_value;
+
+ public MandatoryCheck(boolean value) {
+ m_value = value;
+ }
+
+ @Override
+ public String getCheckId() {
+ return ID;
+ }
+
+ @Override
+ public boolean accept(Object obj) {
+ return true;
+ }
+
+ @Override
+ public void check(Object obj) throws Exception {
+ if (!m_value) {
+ return;
+ }
+ if (obj != null && obj.getClass().isArray()) {
+ ValidationUtility.checkMandatoryArray(obj);
+ }
+ else {
+ ValidationUtility.checkMandatoryValue(obj);
+ }
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + " " + m_value;
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/checks/MasterValueRequiredCheck.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/checks/MasterValueRequiredCheck.java
index 75233a5fa6..8ef6e06615 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/checks/MasterValueRequiredCheck.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/checks/MasterValueRequiredCheck.java
@@ -1,64 +1,64 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.validate.checks;
-
-import java.lang.reflect.Array;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.shared.data.form.ValidationRule;
-import org.eclipse.scout.rt.shared.data.form.fields.AbstractValueFieldData;
-import org.eclipse.scout.rt.shared.validate.DefaultValidator.FormDataCheckContext;
-
-/**
- * Check implementation to verify that a master exists
- */
-public class MasterValueRequiredCheck implements IValidateCheck {
- public static final String ID = "masterValueRequired";
-
- private FormDataCheckContext m_ctx;
-
- public MasterValueRequiredCheck(FormDataCheckContext ctx) {
- m_ctx = ctx;
- }
-
- @Override
- public String getCheckId() {
- return ID;
- }
-
- @Override
- public boolean accept(Object obj) {
- return true;
- }
-
- @Override
- public void check(Object s) throws Exception {
- @SuppressWarnings("unchecked")
- Class<? extends AbstractValueFieldData<?>> masterFieldClass = (Class<? extends AbstractValueFieldData<?>>) m_ctx.ruleMap.get(ValidationRule.MASTER_VALUE_FIELD);
- if (masterFieldClass == null) {
- throw new ProcessingException(m_ctx.fieldName + " missing master field");
- }
- AbstractValueFieldData<?> masterField = m_ctx.formData.getFieldByClass(masterFieldClass);
- if (masterField == null) {
- throw new ProcessingException(m_ctx.fieldName + " missing master field " + masterFieldClass.getSimpleName());
- }
- Object masterValue = masterField.getValue();
- //if master value is null, then fail
- if (masterValue == null || (masterValue.getClass().isArray() && Array.getLength(masterValue) == 0)) {
- throw new ProcessingException(m_ctx.fieldName + " slave is set but master is null: " + masterFieldClass.getSimpleName() + " -> " + m_ctx.fieldName);
- }
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName() + " " + m_ctx.fieldName;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.validate.checks;
+
+import java.lang.reflect.Array;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.shared.data.form.ValidationRule;
+import org.eclipse.scout.rt.shared.data.form.fields.AbstractValueFieldData;
+import org.eclipse.scout.rt.shared.validate.DefaultValidator.FormDataCheckContext;
+
+/**
+ * Check implementation to verify that a master exists
+ */
+public class MasterValueRequiredCheck implements IValidateCheck {
+ public static final String ID = "masterValueRequired";
+
+ private FormDataCheckContext m_ctx;
+
+ public MasterValueRequiredCheck(FormDataCheckContext ctx) {
+ m_ctx = ctx;
+ }
+
+ @Override
+ public String getCheckId() {
+ return ID;
+ }
+
+ @Override
+ public boolean accept(Object obj) {
+ return true;
+ }
+
+ @Override
+ public void check(Object s) throws Exception {
+ @SuppressWarnings("unchecked")
+ Class<? extends AbstractValueFieldData<?>> masterFieldClass = (Class<? extends AbstractValueFieldData<?>>) m_ctx.ruleMap.get(ValidationRule.MASTER_VALUE_FIELD);
+ if (masterFieldClass == null) {
+ throw new ProcessingException(m_ctx.fieldName + " missing master field");
+ }
+ AbstractValueFieldData<?> masterField = m_ctx.formData.getFieldByClass(masterFieldClass);
+ if (masterField == null) {
+ throw new ProcessingException(m_ctx.fieldName + " missing master field " + masterFieldClass.getSimpleName());
+ }
+ Object masterValue = masterField.getValue();
+ //if master value is null, then fail
+ if (masterValue == null || (masterValue.getClass().isArray() && Array.getLength(masterValue) == 0)) {
+ throw new ProcessingException(m_ctx.fieldName + " slave is set but master is null: " + masterFieldClass.getSimpleName() + " -> " + m_ctx.fieldName);
+ }
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + " " + m_ctx.fieldName;
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/checks/MaxLengthCheck.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/checks/MaxLengthCheck.java
index 82187b3cfa..326e1f935b 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/checks/MaxLengthCheck.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/checks/MaxLengthCheck.java
@@ -1,63 +1,63 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.validate.checks;
-
-import java.util.Collection;
-import java.util.Map;
-
-import org.eclipse.scout.rt.shared.validate.ValidationUtility;
-import org.eclipse.scout.rt.shared.validate.annotations.MaxLength;
-
-/**
- * Check implementation of {@link MaxLength} annotation for method parameter or field.
- */
-public class MaxLengthCheck implements IValidateCheck {
- public static final String ID = "maxLength";
-
- private int m_maxLength;
-
- public MaxLengthCheck(int maxLength) {
- m_maxLength = maxLength;
- }
-
- @Override
- public String getCheckId() {
- return ID;
- }
-
- @Override
- public boolean accept(Object obj) {
- if (obj == null) {
- return false;
- }
- Class<?> c = obj.getClass();
- if (c.isArray()) {
- return true;
- }
- if (obj instanceof Collection || obj instanceof Map) {
- return true;
- }
- if (obj instanceof String) {
- return true;
- }
- return false;
- }
-
- @Override
- public void check(Object s) throws Exception {
- ValidationUtility.checkMaxLength(s, m_maxLength);
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName() + " " + m_maxLength;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.validate.checks;
+
+import java.util.Collection;
+import java.util.Map;
+
+import org.eclipse.scout.rt.shared.validate.ValidationUtility;
+import org.eclipse.scout.rt.shared.validate.annotations.MaxLength;
+
+/**
+ * Check implementation of {@link MaxLength} annotation for method parameter or field.
+ */
+public class MaxLengthCheck implements IValidateCheck {
+ public static final String ID = "maxLength";
+
+ private int m_maxLength;
+
+ public MaxLengthCheck(int maxLength) {
+ m_maxLength = maxLength;
+ }
+
+ @Override
+ public String getCheckId() {
+ return ID;
+ }
+
+ @Override
+ public boolean accept(Object obj) {
+ if (obj == null) {
+ return false;
+ }
+ Class<?> c = obj.getClass();
+ if (c.isArray()) {
+ return true;
+ }
+ if (obj instanceof Collection || obj instanceof Map) {
+ return true;
+ }
+ if (obj instanceof String) {
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public void check(Object s) throws Exception {
+ ValidationUtility.checkMaxLength(s, m_maxLength);
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + " " + m_maxLength;
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/checks/MaxLengthGenericCheck.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/checks/MaxLengthGenericCheck.java
index 9dce369b7a..6991dc0d5d 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/checks/MaxLengthGenericCheck.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/checks/MaxLengthGenericCheck.java
@@ -1,78 +1,78 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.validate.checks;
-
-import java.util.Collection;
-import java.util.Map;
-
-import org.eclipse.scout.rt.shared.validate.ValidationUtility;
-import org.eclipse.scout.rt.shared.validate.annotations.MaxLength;
-
-/**
- * Generic check implementation of {@link MaxLength} annotation for method parameter or field.
- */
-public class MaxLengthGenericCheck implements IValidateCheck {
- private int m_maxLengthString;
- private int m_maxLengthCharArray;
- private int m_maxLengthByteArray;
- private int m_maxLengthOtherArray;
-
- public MaxLengthGenericCheck(int maxLengthString, int maxLengthCharArray, int maxLengthByteArray, int maxLengthOtherArray) {
- m_maxLengthString = maxLengthString;
- m_maxLengthCharArray = maxLengthCharArray;
- m_maxLengthByteArray = maxLengthByteArray;
- m_maxLengthOtherArray = maxLengthOtherArray;
- }
-
- @Override
- public String getCheckId() {
- return MaxLengthCheck.ID;
- }
-
- @Override
- public boolean accept(Object obj) {
- if (obj == null) {
- return false;
- }
- Class<?> c = obj.getClass();
- if (c.isArray()) {
- return true;
- }
- if (obj instanceof Collection || obj instanceof Map) {
- return true;
- }
- if (obj instanceof String) {
- return true;
- }
- return false;
- }
-
- @Override
- public void check(Object s) throws Exception {
- if (s instanceof String) {
- ValidationUtility.checkMaxLength(s, m_maxLengthString);
- }
- else if (s.getClass() == char[].class) {
- ValidationUtility.checkMaxLength(s, m_maxLengthCharArray);
- }
- else if (s.getClass() == byte[].class) {
- ValidationUtility.checkMaxLength(s, m_maxLengthByteArray);
- }
- else {
- ValidationUtility.checkMaxLength(s, m_maxLengthOtherArray);
- }
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName() + " string " + m_maxLengthString + ", char[] " + m_maxLengthCharArray + ", byte[] " + m_maxLengthByteArray + ", array " + m_maxLengthOtherArray;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.validate.checks;
+
+import java.util.Collection;
+import java.util.Map;
+
+import org.eclipse.scout.rt.shared.validate.ValidationUtility;
+import org.eclipse.scout.rt.shared.validate.annotations.MaxLength;
+
+/**
+ * Generic check implementation of {@link MaxLength} annotation for method parameter or field.
+ */
+public class MaxLengthGenericCheck implements IValidateCheck {
+ private int m_maxLengthString;
+ private int m_maxLengthCharArray;
+ private int m_maxLengthByteArray;
+ private int m_maxLengthOtherArray;
+
+ public MaxLengthGenericCheck(int maxLengthString, int maxLengthCharArray, int maxLengthByteArray, int maxLengthOtherArray) {
+ m_maxLengthString = maxLengthString;
+ m_maxLengthCharArray = maxLengthCharArray;
+ m_maxLengthByteArray = maxLengthByteArray;
+ m_maxLengthOtherArray = maxLengthOtherArray;
+ }
+
+ @Override
+ public String getCheckId() {
+ return MaxLengthCheck.ID;
+ }
+
+ @Override
+ public boolean accept(Object obj) {
+ if (obj == null) {
+ return false;
+ }
+ Class<?> c = obj.getClass();
+ if (c.isArray()) {
+ return true;
+ }
+ if (obj instanceof Collection || obj instanceof Map) {
+ return true;
+ }
+ if (obj instanceof String) {
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public void check(Object s) throws Exception {
+ if (s instanceof String) {
+ ValidationUtility.checkMaxLength(s, m_maxLengthString);
+ }
+ else if (s.getClass() == char[].class) {
+ ValidationUtility.checkMaxLength(s, m_maxLengthCharArray);
+ }
+ else if (s.getClass() == byte[].class) {
+ ValidationUtility.checkMaxLength(s, m_maxLengthByteArray);
+ }
+ else {
+ ValidationUtility.checkMaxLength(s, m_maxLengthOtherArray);
+ }
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + " string " + m_maxLengthString + ", char[] " + m_maxLengthCharArray + ", byte[] " + m_maxLengthByteArray + ", array " + m_maxLengthOtherArray;
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/checks/MaxValueCheck.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/checks/MaxValueCheck.java
index 762b1586b9..e16e97edee 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/checks/MaxValueCheck.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/checks/MaxValueCheck.java
@@ -1,50 +1,50 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.validate.checks;
-
-import org.eclipse.scout.rt.shared.validate.ValidationUtility;
-import org.eclipse.scout.rt.shared.validate.annotations.MaxValue;
-
-/**
- * Check implementation of {@link MaxValue} annotation for method parameter or field.
- */
-public class MaxValueCheck implements IValidateCheck {
- public static final String ID = "maxValue";
-
- private Object m_maxValue;
-
- public MaxValueCheck(Object maxValue) {
- m_maxValue = maxValue;
- }
-
- @Override
- public String getCheckId() {
- return ID;
- }
-
- @Override
- public boolean accept(Object obj) {
- if (obj instanceof Comparable<?>) {
- return true;
- }
- return false;
- }
-
- @Override
- public void check(Object s) throws Exception {
- ValidationUtility.checkMaxValue(s, m_maxValue);
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName() + " " + m_maxValue;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.validate.checks;
+
+import org.eclipse.scout.rt.shared.validate.ValidationUtility;
+import org.eclipse.scout.rt.shared.validate.annotations.MaxValue;
+
+/**
+ * Check implementation of {@link MaxValue} annotation for method parameter or field.
+ */
+public class MaxValueCheck implements IValidateCheck {
+ public static final String ID = "maxValue";
+
+ private Object m_maxValue;
+
+ public MaxValueCheck(Object maxValue) {
+ m_maxValue = maxValue;
+ }
+
+ @Override
+ public String getCheckId() {
+ return ID;
+ }
+
+ @Override
+ public boolean accept(Object obj) {
+ if (obj instanceof Comparable<?>) {
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public void check(Object s) throws Exception {
+ ValidationUtility.checkMaxValue(s, m_maxValue);
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + " " + m_maxValue;
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/checks/MinLengthCheck.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/checks/MinLengthCheck.java
index 742af89605..c3a7854718 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/checks/MinLengthCheck.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/checks/MinLengthCheck.java
@@ -1,63 +1,63 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.validate.checks;
-
-import java.util.Collection;
-import java.util.Map;
-
-import org.eclipse.scout.rt.shared.validate.ValidationUtility;
-import org.eclipse.scout.rt.shared.validate.annotations.MinLength;
-
-/**
- * Check implementation of {@link MinLength} annotation for method parameter or field.
- */
-public class MinLengthCheck implements IValidateCheck {
- public static final String ID = "minLength";
-
- private int m_minLength;
-
- public MinLengthCheck(int minLength) {
- m_minLength = minLength;
- }
-
- @Override
- public String getCheckId() {
- return ID;
- }
-
- @Override
- public boolean accept(Object obj) {
- if (obj == null) {
- return false;
- }
- Class<?> c = obj.getClass();
- if (c.isArray()) {
- return true;
- }
- if (obj instanceof Collection || obj instanceof Map) {
- return true;
- }
- if (obj instanceof String) {
- return true;
- }
- return false;
- }
-
- @Override
- public void check(Object s) throws Exception {
- ValidationUtility.checkMinLength(s, m_minLength);
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName() + " " + m_minLength;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.validate.checks;
+
+import java.util.Collection;
+import java.util.Map;
+
+import org.eclipse.scout.rt.shared.validate.ValidationUtility;
+import org.eclipse.scout.rt.shared.validate.annotations.MinLength;
+
+/**
+ * Check implementation of {@link MinLength} annotation for method parameter or field.
+ */
+public class MinLengthCheck implements IValidateCheck {
+ public static final String ID = "minLength";
+
+ private int m_minLength;
+
+ public MinLengthCheck(int minLength) {
+ m_minLength = minLength;
+ }
+
+ @Override
+ public String getCheckId() {
+ return ID;
+ }
+
+ @Override
+ public boolean accept(Object obj) {
+ if (obj == null) {
+ return false;
+ }
+ Class<?> c = obj.getClass();
+ if (c.isArray()) {
+ return true;
+ }
+ if (obj instanceof Collection || obj instanceof Map) {
+ return true;
+ }
+ if (obj instanceof String) {
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public void check(Object s) throws Exception {
+ ValidationUtility.checkMinLength(s, m_minLength);
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + " " + m_minLength;
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/checks/MinValueCheck.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/checks/MinValueCheck.java
index 61c043394a..a4656aafe5 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/checks/MinValueCheck.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/checks/MinValueCheck.java
@@ -1,50 +1,50 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.validate.checks;
-
-import org.eclipse.scout.rt.shared.validate.ValidationUtility;
-import org.eclipse.scout.rt.shared.validate.annotations.MinValue;
-
-/**
- * Check implementation of {@link MinValue} annotation for method parameter or field.
- */
-public class MinValueCheck implements IValidateCheck {
- public static final String ID = "minValue";
-
- private Object m_minValue;
-
- public MinValueCheck(Object minValue) {
- m_minValue = minValue;
- }
-
- @Override
- public String getCheckId() {
- return ID;
- }
-
- @Override
- public boolean accept(Object obj) {
- if (obj instanceof Comparable<?>) {
- return true;
- }
- return false;
- }
-
- @Override
- public void check(Object s) throws Exception {
- ValidationUtility.checkMinValue(s, m_minValue);
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName() + " " + m_minValue;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.validate.checks;
+
+import org.eclipse.scout.rt.shared.validate.ValidationUtility;
+import org.eclipse.scout.rt.shared.validate.annotations.MinValue;
+
+/**
+ * Check implementation of {@link MinValue} annotation for method parameter or field.
+ */
+public class MinValueCheck implements IValidateCheck {
+ public static final String ID = "minValue";
+
+ private Object m_minValue;
+
+ public MinValueCheck(Object minValue) {
+ m_minValue = minValue;
+ }
+
+ @Override
+ public String getCheckId() {
+ return ID;
+ }
+
+ @Override
+ public boolean accept(Object obj) {
+ if (obj instanceof Comparable<?>) {
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public void check(Object s) throws Exception {
+ ValidationUtility.checkMinValue(s, m_minValue);
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + " " + m_minValue;
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/checks/RegexMatchCheck.java b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/checks/RegexMatchCheck.java
index 3f490ed78d..7177a14b1d 100644
--- a/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/checks/RegexMatchCheck.java
+++ b/org.eclipse.scout.rt.shared/src/org/eclipse/scout/rt/shared/validate/checks/RegexMatchCheck.java
@@ -1,67 +1,67 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.shared.validate.checks;
-
-import java.util.regex.Pattern;
-
-import org.eclipse.scout.rt.shared.validate.ValidationUtility;
-import org.eclipse.scout.rt.shared.validate.annotations.RegexMatch;
-
-/**
- * Check implementation of {@link RegexMatch} annotation for method parameter or field.
- */
-public class RegexMatchCheck implements IValidateCheck {
- public static final String ID = "regexMatch";
-
- private Pattern m_pat;
-
- public RegexMatchCheck(String pattern) {
- this(Pattern.compile(pattern, Pattern.DOTALL | Pattern.CASE_INSENSITIVE));
- }
-
- public RegexMatchCheck(Pattern pat) {
- m_pat = pat;
- }
-
- @Override
- public String getCheckId() {
- return ID;
- }
-
- @Override
- public boolean accept(Object obj) {
- if (obj == null) {
- return false;
- }
- if (obj instanceof String) {
- return true;
- }
- if (obj.getClass() == String[].class) {
- return true;
- }
- return false;
- }
-
- @Override
- public void check(Object obj) throws Exception {
- if (obj.getClass().isArray()) {
- ValidationUtility.checkRegexMatchArray(obj, m_pat);
- }
- else {
- ValidationUtility.checkRegexMatchValue(obj, m_pat);
- }
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName() + " " + m_pat.pattern();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.shared.validate.checks;
+
+import java.util.regex.Pattern;
+
+import org.eclipse.scout.rt.shared.validate.ValidationUtility;
+import org.eclipse.scout.rt.shared.validate.annotations.RegexMatch;
+
+/**
+ * Check implementation of {@link RegexMatch} annotation for method parameter or field.
+ */
+public class RegexMatchCheck implements IValidateCheck {
+ public static final String ID = "regexMatch";
+
+ private Pattern m_pat;
+
+ public RegexMatchCheck(String pattern) {
+ this(Pattern.compile(pattern, Pattern.DOTALL | Pattern.CASE_INSENSITIVE));
+ }
+
+ public RegexMatchCheck(Pattern pat) {
+ m_pat = pat;
+ }
+
+ @Override
+ public String getCheckId() {
+ return ID;
+ }
+
+ @Override
+ public boolean accept(Object obj) {
+ if (obj == null) {
+ return false;
+ }
+ if (obj instanceof String) {
+ return true;
+ }
+ if (obj.getClass() == String[].class) {
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public void check(Object obj) throws Exception {
+ if (obj.getClass().isArray()) {
+ ValidationUtility.checkRegexMatchArray(obj, m_pat);
+ }
+ else {
+ ValidationUtility.checkRegexMatchValue(obj, m_pat);
+ }
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + " " + m_pat.pattern();
+ }
+}
diff --git a/org.eclipse.scout.rt.shared/translation.nls b/org.eclipse.scout.rt.shared/translation.nls
index 8b931fc4b0..a8eddfd6e1 100644
--- a/org.eclipse.scout.rt.shared/translation.nls
+++ b/org.eclipse.scout.rt.shared/translation.nls
@@ -1,6 +1,6 @@
-##################################################
-# This file is maintained by the nls editor #
-# To ensure a properly working nls support of #
-# keep this file untouched directly. #
-##################################################
-Nls-Class=org.eclipse.scout.rt.shared.services.common.text.ScoutTextProviderService
+##################################################
+# This file is maintained by the nls editor #
+# To ensure a properly working nls support of #
+# keep this file untouched directly. #
+##################################################
+Nls-Class=org.eclipse.scout.rt.shared.services.common.text.ScoutTextProviderService
diff --git a/org.eclipse.scout.rt.testing.client/.settings/org.eclipse.pde.core.prefs b/org.eclipse.scout.rt.testing.client/.settings/org.eclipse.pde.core.prefs
index baef13dd8c..a3a50fc8da 100644
--- a/org.eclipse.scout.rt.testing.client/.settings/org.eclipse.pde.core.prefs
+++ b/org.eclipse.scout.rt.testing.client/.settings/org.eclipse.pde.core.prefs
@@ -1,3 +1,3 @@
-#Mon Jul 11 16:16:00 CEST 2011
-eclipse.preferences.version=1
-pluginProject.extensions=true
+#Mon Jul 11 16:16:00 CEST 2011
+eclipse.preferences.version=1
+pluginProject.extensions=true
diff --git a/org.eclipse.scout.rt.testing.client/Release Notes.txt b/org.eclipse.scout.rt.testing.client/Release Notes.txt
index 6b4608dd0e..afb2d3e10d 100644
--- a/org.eclipse.scout.rt.testing.client/Release Notes.txt
+++ b/org.eclipse.scout.rt.testing.client/Release Notes.txt
@@ -1,21 +1,21 @@
-09.08.2011
-Bugzilla ticket: 350389, improve Scout RT testing support
-BSI ticket: 103'068
-Replaced ClientSessionClass annotation by a more powerful ClientTest annotation that has the following features:
-o annotation can be applied on class-level as well as on a test case level (method).
-o @BeforeClass and @AfterClass methods are executed in the same session defined on class-level
-o @Before, @Test and @After are executed per test method in the same session defined on class-level
- or in a separate session if the @Test method is also annotated with @ClientTest
-o Sessions are shared as long as they are not marked with @ClientTest(foreceNewSession = true)
-o Tests can be executed as different users. Controlled by @ClientTest(runAs = "principal")
-o The IClientSession class can be provided by the annotation @ClientTest(clientSessionClass = MyClientSession.class)
- or by setting the default value ScoutClientTestRunner.setDefaultClientSessionClass(MyClientSession.class). The value
- provided by the @ClientTest annotation is used if both are provided.
-o An existing or new IClientSession is provided by an implementation of IClientSessionProvider. The default provider is
- DefaultTestClientSessionProvider and is set on ScoutClientTestRunner.setDefaultClientSessionProvider(). It can be
- overridden using the @ClientTest(clientSessionProvider = MyClientSessionProvider.class) annotation.
-
-Migration:
-o remove all @ClientSessionClass annotations
-o set the project's client session class in the client test applications (headless and different GUI strategies)
- ScoutClientTestRunner.setDefaultClientSessionClass(ClientSession.class);
+09.08.2011
+Bugzilla ticket: 350389, improve Scout RT testing support
+BSI ticket: 103'068
+Replaced ClientSessionClass annotation by a more powerful ClientTest annotation that has the following features:
+o annotation can be applied on class-level as well as on a test case level (method).
+o @BeforeClass and @AfterClass methods are executed in the same session defined on class-level
+o @Before, @Test and @After are executed per test method in the same session defined on class-level
+ or in a separate session if the @Test method is also annotated with @ClientTest
+o Sessions are shared as long as they are not marked with @ClientTest(foreceNewSession = true)
+o Tests can be executed as different users. Controlled by @ClientTest(runAs = "principal")
+o The IClientSession class can be provided by the annotation @ClientTest(clientSessionClass = MyClientSession.class)
+ or by setting the default value ScoutClientTestRunner.setDefaultClientSessionClass(MyClientSession.class). The value
+ provided by the @ClientTest annotation is used if both are provided.
+o An existing or new IClientSession is provided by an implementation of IClientSessionProvider. The default provider is
+ DefaultTestClientSessionProvider and is set on ScoutClientTestRunner.setDefaultClientSessionProvider(). It can be
+ overridden using the @ClientTest(clientSessionProvider = MyClientSessionProvider.class) annotation.
+
+Migration:
+o remove all @ClientSessionClass annotations
+o set the project's client session class in the client test applications (headless and different GUI strategies)
+ ScoutClientTestRunner.setDefaultClientSessionClass(ClientSession.class);
diff --git a/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/AbstractTestWithGuiScript.java b/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/AbstractTestWithGuiScript.java
index 5c2b59b815..1dd81b38d9 100644
--- a/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/AbstractTestWithGuiScript.java
+++ b/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/AbstractTestWithGuiScript.java
@@ -1,205 +1,205 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.testing.client;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.scout.commons.job.JobEx;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ClientRule;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.client.services.common.session.IClientSessionRegistryService;
-import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
-import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.client.ui.form.outline.DefaultOutlineTableForm;
-import org.eclipse.scout.rt.client.ui.form.outline.DefaultOutlineTreeForm;
-import org.eclipse.scout.rt.client.ui.messagebox.IMessageBox;
-import org.eclipse.scout.rt.testing.shared.ScoutAssert;
-import org.eclipse.scout.service.SERVICES;
-import org.junit.Test;
-
-/**
- * Subclasses of this type should NOT add the annotations {@link ClientSessionClass} but implement the methods
- * <ul>
- * <li>{@link #getSessionClass()}</li>
- * <li>{@link #runModel()}</li>
- * <li>{@link #runGui(IGuiMock, IClientSession)}</li>
- * </ul>
- */
-public abstract class AbstractTestWithGuiScript {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractTestWithGuiScript.class);
-
- private boolean m_testActive;
-
- protected IClientSession clientSession;
-
- protected abstract Class<? extends IClientSession> getSessionClass();
-
- /**
- * Override this method
- * <p>
- * This method runs in the ui thread.
- */
- protected void runGui(IGuiMock gui) throws Throwable {
- }
-
- /**
- * Override this method
- * <p>
- * This method runs as the model "thread" using sync {@link ClientRule}s
- */
- protected void runModel() throws Throwable {
- }
-
- /**
- * Override this method
- * <p>
- * This method runs as the model "thread" using sync {@link ClientRule}s
- */
- protected void disposeModel() throws Throwable {
- }
-
- protected void resetSession() throws Throwable {
- IDesktop desktop = clientSession.getDesktop();
- desktop.setAvailableOutlines(null);
- desktop.setOutline((IOutline) null);
- for (IMessageBox m : desktop.getMessageBoxStack()) {
- try {
- m.getUIFacade().setResultFromUI(IMessageBox.CANCEL_OPTION);
- }
- catch (Throwable t) {
- LOG.warn("closing messagebox " + m.getClass(), t);
- }
- }
- for (IForm f : desktop.getDialogStack()) {
- try {
- f.doClose();
- }
- catch (Throwable t) {
- LOG.warn("closing dialog " + f.getClass(), t);
- }
- }
- for (IForm f : desktop.getViewStack()) {
- if (f instanceof DefaultOutlineTreeForm) {
- //leave it
- }
- else if (f instanceof DefaultOutlineTableForm) {
- //leave it
- }
- else {
- try {
- f.doClose();
- }
- catch (Throwable t) {
- LOG.warn("closing view " + f.getClass(), t);
- }
- }
- }
- }
-
- /**
- * This is the hardwired controller of the ui test.
- * <p>
- * First it schedules a new Job that calls {@link #runGui()}<br>
- * Then is calls {@link #runModel()} <br>
- * When the gui script has finished or failed it schedules back a model job that calls {@link #disposeModel()}
- *
- * @throws Throwable
- */
- @Test
- public final void test() throws Throwable {
- IGuiMockService guiMockService = SERVICES.getService(IGuiMockService.class);
- if (guiMockService == null) {
- return;
- }
- clientSession = SERVICES.getService(IClientSessionRegistryService.class).newClientSession(getSessionClass(), guiMockService.initUserAgent());
- final IGuiMock gui = guiMockService.createMock(clientSession);
- gui.beforeTest();
- try {
- //
- final ClientSyncJob runModelJob = new ClientSyncJob("Run", clientSession) {
- @Override
- protected void runVoid(IProgressMonitor m) throws Throwable {
- resetSession();
- runModel();
- }
- };
- runModelJob.setUser(false);
- runModelJob.setSystem(true);
- //
- final ClientSyncJob disposeModelJob = new ClientSyncJob("Dispose", clientSession) {
- @Override
- protected void runVoid(IProgressMonitor m) throws Throwable {
- try {
- disposeModel();
- }
- finally {
- resetSession();
- }
- }
- };
- disposeModelJob.setUser(false);
- disposeModelJob.setSystem(true);
- //
- JobEx guiScriptJob = new JobEx("Gui Script") {
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- try {
- gui.waitForIdle();
- runGui(gui);
- return Status.OK_STATUS;
- }
- catch (Throwable t) {
- return new Status(Status.WARNING, AbstractTestWithGuiScript.this.getClass().getName(), t.getMessage(), t);
- }
- }
- };
- guiScriptJob.setUser(false);
- guiScriptJob.setSystem(true);
- //
- try {
- m_testActive = true;
- runModelJob.schedule();
- while (!runModelJob.isWaitFor() && runModelJob.getState() != Job.NONE) {
- runModelJob.join(100);
- }
- guiScriptJob.schedule();
- guiScriptJob.join();
- }
- finally {
- m_testActive = false;
- disposeModelJob.schedule();
- disposeModelJob.join();
- }
- runModelJob.join();
- ScoutAssert.jobSuccessfullyCompleted(runModelJob);
- ScoutAssert.jobSuccessfullyCompleted(guiScriptJob);
- ScoutAssert.jobSuccessfullyCompleted(disposeModelJob);
- }
- finally {
- gui.afterTest();
- }
- }
-
- /**
- * Use this method inside {@link #runModel()} to check if the gui script (and the test) is still running or was
- * cancelled.
- */
- public boolean isTestActive() {
- return m_testActive;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.testing.client;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.scout.commons.job.JobEx;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ClientRule;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.client.services.common.session.IClientSessionRegistryService;
+import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
+import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.client.ui.form.outline.DefaultOutlineTableForm;
+import org.eclipse.scout.rt.client.ui.form.outline.DefaultOutlineTreeForm;
+import org.eclipse.scout.rt.client.ui.messagebox.IMessageBox;
+import org.eclipse.scout.rt.testing.shared.ScoutAssert;
+import org.eclipse.scout.service.SERVICES;
+import org.junit.Test;
+
+/**
+ * Subclasses of this type should NOT add the annotations {@link ClientSessionClass} but implement the methods
+ * <ul>
+ * <li>{@link #getSessionClass()}</li>
+ * <li>{@link #runModel()}</li>
+ * <li>{@link #runGui(IGuiMock, IClientSession)}</li>
+ * </ul>
+ */
+public abstract class AbstractTestWithGuiScript {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractTestWithGuiScript.class);
+
+ private boolean m_testActive;
+
+ protected IClientSession clientSession;
+
+ protected abstract Class<? extends IClientSession> getSessionClass();
+
+ /**
+ * Override this method
+ * <p>
+ * This method runs in the ui thread.
+ */
+ protected void runGui(IGuiMock gui) throws Throwable {
+ }
+
+ /**
+ * Override this method
+ * <p>
+ * This method runs as the model "thread" using sync {@link ClientRule}s
+ */
+ protected void runModel() throws Throwable {
+ }
+
+ /**
+ * Override this method
+ * <p>
+ * This method runs as the model "thread" using sync {@link ClientRule}s
+ */
+ protected void disposeModel() throws Throwable {
+ }
+
+ protected void resetSession() throws Throwable {
+ IDesktop desktop = clientSession.getDesktop();
+ desktop.setAvailableOutlines(null);
+ desktop.setOutline((IOutline) null);
+ for (IMessageBox m : desktop.getMessageBoxStack()) {
+ try {
+ m.getUIFacade().setResultFromUI(IMessageBox.CANCEL_OPTION);
+ }
+ catch (Throwable t) {
+ LOG.warn("closing messagebox " + m.getClass(), t);
+ }
+ }
+ for (IForm f : desktop.getDialogStack()) {
+ try {
+ f.doClose();
+ }
+ catch (Throwable t) {
+ LOG.warn("closing dialog " + f.getClass(), t);
+ }
+ }
+ for (IForm f : desktop.getViewStack()) {
+ if (f instanceof DefaultOutlineTreeForm) {
+ //leave it
+ }
+ else if (f instanceof DefaultOutlineTableForm) {
+ //leave it
+ }
+ else {
+ try {
+ f.doClose();
+ }
+ catch (Throwable t) {
+ LOG.warn("closing view " + f.getClass(), t);
+ }
+ }
+ }
+ }
+
+ /**
+ * This is the hardwired controller of the ui test.
+ * <p>
+ * First it schedules a new Job that calls {@link #runGui()}<br>
+ * Then is calls {@link #runModel()} <br>
+ * When the gui script has finished or failed it schedules back a model job that calls {@link #disposeModel()}
+ *
+ * @throws Throwable
+ */
+ @Test
+ public final void test() throws Throwable {
+ IGuiMockService guiMockService = SERVICES.getService(IGuiMockService.class);
+ if (guiMockService == null) {
+ return;
+ }
+ clientSession = SERVICES.getService(IClientSessionRegistryService.class).newClientSession(getSessionClass(), guiMockService.initUserAgent());
+ final IGuiMock gui = guiMockService.createMock(clientSession);
+ gui.beforeTest();
+ try {
+ //
+ final ClientSyncJob runModelJob = new ClientSyncJob("Run", clientSession) {
+ @Override
+ protected void runVoid(IProgressMonitor m) throws Throwable {
+ resetSession();
+ runModel();
+ }
+ };
+ runModelJob.setUser(false);
+ runModelJob.setSystem(true);
+ //
+ final ClientSyncJob disposeModelJob = new ClientSyncJob("Dispose", clientSession) {
+ @Override
+ protected void runVoid(IProgressMonitor m) throws Throwable {
+ try {
+ disposeModel();
+ }
+ finally {
+ resetSession();
+ }
+ }
+ };
+ disposeModelJob.setUser(false);
+ disposeModelJob.setSystem(true);
+ //
+ JobEx guiScriptJob = new JobEx("Gui Script") {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ gui.waitForIdle();
+ runGui(gui);
+ return Status.OK_STATUS;
+ }
+ catch (Throwable t) {
+ return new Status(Status.WARNING, AbstractTestWithGuiScript.this.getClass().getName(), t.getMessage(), t);
+ }
+ }
+ };
+ guiScriptJob.setUser(false);
+ guiScriptJob.setSystem(true);
+ //
+ try {
+ m_testActive = true;
+ runModelJob.schedule();
+ while (!runModelJob.isWaitFor() && runModelJob.getState() != Job.NONE) {
+ runModelJob.join(100);
+ }
+ guiScriptJob.schedule();
+ guiScriptJob.join();
+ }
+ finally {
+ m_testActive = false;
+ disposeModelJob.schedule();
+ disposeModelJob.join();
+ }
+ runModelJob.join();
+ ScoutAssert.jobSuccessfullyCompleted(runModelJob);
+ ScoutAssert.jobSuccessfullyCompleted(guiScriptJob);
+ ScoutAssert.jobSuccessfullyCompleted(disposeModelJob);
+ }
+ finally {
+ gui.afterTest();
+ }
+ }
+
+ /**
+ * Use this method inside {@link #runModel()} to check if the gui script (and the test) is still running or was
+ * cancelled.
+ */
+ public boolean isTestActive() {
+ return m_testActive;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/Activator.java b/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/Activator.java
index 48d64898d0..6f511242c1 100644
--- a/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/Activator.java
+++ b/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/Activator.java
@@ -1,62 +1,62 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.testing.client;
-
-import org.eclipse.core.runtime.Plugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends Plugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.scout.testing.client";
-
- // The shared instance
- private static Activator plugin;
-
- /**
- * The constructor
- */
- public Activator() {
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
- */
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.testing.client;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.scout.testing.client";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/DefaultTestClientSessionProvider.java b/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/DefaultTestClientSessionProvider.java
index 3cc7567742..d27da79a9d 100644
--- a/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/DefaultTestClientSessionProvider.java
+++ b/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/DefaultTestClientSessionProvider.java
@@ -1,149 +1,149 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.testing.client;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.client.ui.desktop.AbstractDesktop;
-import org.eclipse.scout.rt.client.ui.desktop.DesktopEvent;
-import org.eclipse.scout.rt.client.ui.desktop.DesktopListener;
-import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
-import org.eclipse.scout.rt.client.ui.messagebox.IMessageBox;
-import org.eclipse.scout.rt.shared.ui.UserAgent;
-import org.eclipse.scout.rt.testing.shared.TestingUtility;
-import org.eclipse.scout.testing.client.servicetunnel.http.MultiClientAuthenticator;
-import org.osgi.framework.Bundle;
-
-/**
- * Default implementation of {@link ITestClientSessionProvider}.
- */
-public class DefaultTestClientSessionProvider implements ITestClientSessionProvider {
-
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(DefaultTestClientSessionProvider.class);
-
- private static final Map<String, IClientSession> m_cache = new HashMap<String, IClientSession>();
- private static final Object m_cacheLock = new Object();
-
- @Override
- @SuppressWarnings("unchecked")
- public <T extends IClientSession> T getOrCreateClientSession(Class<T> clazz, final String runAs, boolean createNew) {
- String symbolicName = clazz.getPackage().getName();
- Bundle bundleLocator = null;
- while (symbolicName != null) {
- bundleLocator = Platform.getBundle(symbolicName);
- int i = symbolicName.lastIndexOf('.');
- if (bundleLocator != null || i < 0) {
- break;
- }
- symbolicName = symbolicName.substring(0, i);
- }
- final Bundle bundle = Platform.getBundle(symbolicName);
- if (bundle != null) {
- synchronized (m_cacheLock) {
- String cacheKey = createSessionCacheKey(clazz, bundle, runAs);
- IClientSession clientSession = m_cache.get(cacheKey);
- if (clientSession == null || !clientSession.isActive() || createNew) {
- try {
- clientSession = clazz.newInstance();
- m_cache.put(cacheKey, clientSession);
- clientSession.setUserAgent(UserAgent.createDefault());
- ClientSyncJob job = new ClientSyncJob("Session startup", clientSession) {
- @Override
- protected void runVoid(IProgressMonitor monitor) throws Throwable {
- beforeStartSession(getClientSession(), runAs);
- getCurrentSession().startSession(bundle);
- simulateDesktopOpened(getClientSession());
- afterStartSession(getClientSession(), runAs);
- }
- };
- job.schedule();
- job.join();
- job.throwOnError();
- }
- catch (Throwable t) {
- LOG.error("could not load session for " + symbolicName, t);
- }
- }
- return (T) clientSession;
- }
- }
- return null;
- }
-
- /**
- * Creates a cache key for the given session class, its hosting bundle and the name of the user the session is created
- * for.
- *
- * @param sessionClass
- * @param providingBundleSymbolicName
- * @param runAs
- * @return
- */
- protected String createSessionCacheKey(Class<? extends IClientSession> sessionClass, Bundle providingBundle, String runAs) {
- return StringUtility.join("-", providingBundle.getSymbolicName(), runAs);
- }
-
- /**
- * Performs custom operations before the client session is started. This default implementation assigns the current
- * session on the {@link MultiClientAuthenticator}, so that a possibly arising HTTP BASIC authentication can be
- * performed. Additionally, all message boxes are automatically canceled.
- *
- * @param clientSession
- * @param runAs
- * @see MultiClientAuthenticator
- */
- protected void beforeStartSession(IClientSession clientSession, String runAs) {
- MultiClientAuthenticator.assignSessionToUser(clientSession, runAs);
- TestingUtility.clearHttpAuthenticationCache();
- // auto-cancel all message boxes
- clientSession.getVirtualDesktop().addDesktopListener(new DesktopListener() {
- @Override
- public void desktopChanged(DesktopEvent e) {
- switch (e.getType()) {
- case DesktopEvent.TYPE_MESSAGE_BOX_ADDED:
- e.getMessageBox().getUIFacade().setResultFromUI(IMessageBox.CANCEL_OPTION);
- break;
- }
- }
- });
- }
-
- /**
- * Performs custom operations after the client session has been started.
- *
- * @param clientSession
- * @param runAs
- */
- protected void afterStartSession(IClientSession clientSession, String runAs) {
- }
-
- /**
- * Simulates that the desktop has been opened. The method works also if the desktop has already been opened or if the
- * Scout client does not have a desktop at all.
- *
- * @param clientSession
- */
- protected void simulateDesktopOpened(IClientSession clientSession) {
- IDesktop desktop = clientSession.getDesktop();
- if (desktop != null && !desktop.isOpened() && desktop instanceof AbstractDesktop) {
- desktop.getUIFacade().fireGuiAttached();
- desktop.getUIFacade().fireDesktopOpenedFromUI();
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.testing.client;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.client.ui.desktop.AbstractDesktop;
+import org.eclipse.scout.rt.client.ui.desktop.DesktopEvent;
+import org.eclipse.scout.rt.client.ui.desktop.DesktopListener;
+import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
+import org.eclipse.scout.rt.client.ui.messagebox.IMessageBox;
+import org.eclipse.scout.rt.shared.ui.UserAgent;
+import org.eclipse.scout.rt.testing.shared.TestingUtility;
+import org.eclipse.scout.testing.client.servicetunnel.http.MultiClientAuthenticator;
+import org.osgi.framework.Bundle;
+
+/**
+ * Default implementation of {@link ITestClientSessionProvider}.
+ */
+public class DefaultTestClientSessionProvider implements ITestClientSessionProvider {
+
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(DefaultTestClientSessionProvider.class);
+
+ private static final Map<String, IClientSession> m_cache = new HashMap<String, IClientSession>();
+ private static final Object m_cacheLock = new Object();
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public <T extends IClientSession> T getOrCreateClientSession(Class<T> clazz, final String runAs, boolean createNew) {
+ String symbolicName = clazz.getPackage().getName();
+ Bundle bundleLocator = null;
+ while (symbolicName != null) {
+ bundleLocator = Platform.getBundle(symbolicName);
+ int i = symbolicName.lastIndexOf('.');
+ if (bundleLocator != null || i < 0) {
+ break;
+ }
+ symbolicName = symbolicName.substring(0, i);
+ }
+ final Bundle bundle = Platform.getBundle(symbolicName);
+ if (bundle != null) {
+ synchronized (m_cacheLock) {
+ String cacheKey = createSessionCacheKey(clazz, bundle, runAs);
+ IClientSession clientSession = m_cache.get(cacheKey);
+ if (clientSession == null || !clientSession.isActive() || createNew) {
+ try {
+ clientSession = clazz.newInstance();
+ m_cache.put(cacheKey, clientSession);
+ clientSession.setUserAgent(UserAgent.createDefault());
+ ClientSyncJob job = new ClientSyncJob("Session startup", clientSession) {
+ @Override
+ protected void runVoid(IProgressMonitor monitor) throws Throwable {
+ beforeStartSession(getClientSession(), runAs);
+ getCurrentSession().startSession(bundle);
+ simulateDesktopOpened(getClientSession());
+ afterStartSession(getClientSession(), runAs);
+ }
+ };
+ job.schedule();
+ job.join();
+ job.throwOnError();
+ }
+ catch (Throwable t) {
+ LOG.error("could not load session for " + symbolicName, t);
+ }
+ }
+ return (T) clientSession;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Creates a cache key for the given session class, its hosting bundle and the name of the user the session is created
+ * for.
+ *
+ * @param sessionClass
+ * @param providingBundleSymbolicName
+ * @param runAs
+ * @return
+ */
+ protected String createSessionCacheKey(Class<? extends IClientSession> sessionClass, Bundle providingBundle, String runAs) {
+ return StringUtility.join("-", providingBundle.getSymbolicName(), runAs);
+ }
+
+ /**
+ * Performs custom operations before the client session is started. This default implementation assigns the current
+ * session on the {@link MultiClientAuthenticator}, so that a possibly arising HTTP BASIC authentication can be
+ * performed. Additionally, all message boxes are automatically canceled.
+ *
+ * @param clientSession
+ * @param runAs
+ * @see MultiClientAuthenticator
+ */
+ protected void beforeStartSession(IClientSession clientSession, String runAs) {
+ MultiClientAuthenticator.assignSessionToUser(clientSession, runAs);
+ TestingUtility.clearHttpAuthenticationCache();
+ // auto-cancel all message boxes
+ clientSession.getVirtualDesktop().addDesktopListener(new DesktopListener() {
+ @Override
+ public void desktopChanged(DesktopEvent e) {
+ switch (e.getType()) {
+ case DesktopEvent.TYPE_MESSAGE_BOX_ADDED:
+ e.getMessageBox().getUIFacade().setResultFromUI(IMessageBox.CANCEL_OPTION);
+ break;
+ }
+ }
+ });
+ }
+
+ /**
+ * Performs custom operations after the client session has been started.
+ *
+ * @param clientSession
+ * @param runAs
+ */
+ protected void afterStartSession(IClientSession clientSession, String runAs) {
+ }
+
+ /**
+ * Simulates that the desktop has been opened. The method works also if the desktop has already been opened or if the
+ * Scout client does not have a desktop at all.
+ *
+ * @param clientSession
+ */
+ protected void simulateDesktopOpened(IClientSession clientSession) {
+ IDesktop desktop = clientSession.getDesktop();
+ if (desktop != null && !desktop.isOpened() && desktop instanceof AbstractDesktop) {
+ desktop.getUIFacade().fireGuiAttached();
+ desktop.getUIFacade().fireDesktopOpenedFromUI();
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/IGuiMock.java b/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/IGuiMock.java
index 573c85f732..f71f4553ee 100644
--- a/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/IGuiMock.java
+++ b/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/IGuiMock.java
@@ -1,331 +1,331 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.testing.client;
-
-import java.util.List;
-import java.util.Set;
-
-/**
- * This interface is used to support gui testing with an abstraction layer.
- * <p>
- * Therefore swt and swing gui tests can be programmed just once in the client and run with both guis.
- * <p>
- * The term "window" is used for frames, dialogs, swt views, swt editors, swing internal frames.
- * <p>
- * The config.ini property "IGuiMock.treeNodeToExpandIconGap" defines the gap between a tree node and its
- * expand/collapse icon and is used in {@link #gotoTreeExpandIcon(int, String)}
- */
-public interface IGuiMock {
- long WAIT_TIMEOUT = 10000L;
-
- enum GuiStrategy {
- Swt,
- Swing,
- Vaadin,
- Rap
- }
-
- enum Key {
- Shift,
- Control,
- Alt,
- Delete,
- Backspace,
- Enter,
- Esc,
- Tab,
- ContextMenu,
- Up,
- Down,
- Left,
- Right,
- Windows,
- F1,
- F2,
- F3,
- F4,
- F5,
- F6,
- F7,
- F8,
- F9,
- F10,
- F11,
- F12,
- Home,
- End,
- PageUp,
- PageDown,
- NumPad0,
- NumPad1,
- NumPad2,
- NumPad3,
- NumPad4,
- NumPad5,
- NumPad6,
- NumPad7,
- NumPad8,
- NumPad9,
- NumPadMultiply,
- NumPadAdd,
- NumPadSubtract,
- NumPadDecimal,
- NumPadDivide,
- NumPadSeparator,
- }
-
- enum FieldType {
- Label,
- Text,
- Checkbox,
- RadioButton,
- Table,
- Tree,
- PushButton,
- ScrollButton,
- DropdownButton,
- }
-
- public class WindowState {
- /**
- * coordinates on screen
- */
- public int x;
- /**
- * coordinates on screen
- */
- public int y;
- public int width;
- public int height;
- }
-
- public class FieldState {
- public FieldType type;
- public String scoutName;
- /**
- * coordinates on screen
- */
- public int x;
- /**
- * coordinates on screen
- */
- public int y;
- public int width;
- public int height;
- public boolean focus;
- public String text;
- }
-
- void initializeMock();
-
- void shutdownMock();
-
- void beforeTest();
-
- void afterTest();
-
- GuiStrategy getStrategy();
-
- int getSleepDelay();
-
- void setSleepDelay(int ms);
-
- /**
- * sleep for some time
- */
- void sleep();
-
- /**
- * sleep for some time
- */
- void sleep(int ms);
-
- boolean isWindowActive(String title);
-
- boolean isWindowOpen(String title);
-
- /**
- * Waits until gui and model are idle
- */
- void waitForIdle();
-
- /**
- * This only waits for the window to open, NOT to be active.
- * <p>
- * Normally {@link #waitForActiveWindow(String)} is used.
- */
- void waitForOpenWindow(String title);
-
- void waitForActiveWindow(String title);
-
- void activateWindow(String title);
-
- /**
- * @return the field state of the visible and accessible field at the index
- */
- FieldState getFieldState(FieldType type, int index);
-
- /**
- * @return the field state of the visible and accessible field that represents a scout model with that (class) name
- */
- FieldState getScoutFieldState(String name);
-
- FieldState getScoutFieldContainerState(String name);
-
- /**
- * @return all fields af that type (all fileds if type is null)
- */
- List<FieldState> getFieldStates(FieldType type);
-
- /**
- * @return the state of the current focused /clicked field (textfield, button)
- */
- FieldState getFocusFieldState();
-
- /**
- * Set mouse to absolute point on screen
- */
- void gotoPoint(int x, int y);
-
- /**
- * Move mouse from current location to a delta position on screen
- */
- void move(int deltaX, int deltaY);
-
- /**
- * Click left mouse button
- */
- void clickLeft();
-
- /**
- * Click right mouse button
- */
- void clickRight();
-
- /**
- * Press left mouse button (without releasing it)
- */
- void pressLeft();
-
- /**
- * Release left mouse button (must be called after {@link IGuiMock#pressLeft()}
- */
- public void releaseLeft();
-
- /**
- * Drag the mouse
- */
- void drag(int x1, int y1, int x2, int y2);
-
- void dragWindowRightBorder(WindowState windowState, int pixelToMoveOnX);
-
- void pressKey(Key key);
-
- void releaseKey(Key key);
-
- void typeKey(Key key);
-
- void typeText(final String text);
-
- void paste(final String text);
-
- /**
- * Convenience for clicking on a button with a label
- */
- void clickOnPushButton(String text);
-
- /**
- * place the mouse over the center of a field
- * <p>
- * The index is searched in the active window (popup, dialog, frame)
- */
- void gotoField(FieldType type, int index);
-
- /**
- * place the mouse over the center of a field that represents a scout model with that (class) name
- */
- void gotoScoutField(String name);
-
- /**
- * place the mouse over the center of a table cell
- * <p>
- * The index is searched in the active window (popup, dialog, frame)
- */
- void gotoTable(int tableIndex, int rowIndex, int columnIndex);
-
- /**
- * place the mouse over the center of a table header cell
- * <p>
- * The index is searched in the active window (popup, dialog, frame)
- */
- void gotoTableHeader(int tableIndex, int columnIndex);
-
- /**
- * place the mouse over the center of a tree node
- * <p>
- * The index is searched in the active window (popup, dialog, frame)
- */
- void gotoTree(int treeIndex, String nodeText);
-
- /**
- * place the mouse over the expand/collapse area of a tree node
- * <p>
- * The index is searched in the active window (popup, dialog, frame)
- */
- void gotoTreeExpandIcon(int treeIndex, String nodeText);
-
- /**
- * Assumes that a context menu is showing and clicks on the popup menu with the name
- * <p>
- * If multiple names are given this is meant as sub-menus
- */
- void contextMenu(String... names);
-
- /**
- * @return the list of cells in the original order
- */
- List<String> getTableCells(int tableIndex, int columnIndex);
-
- /**
- * @return the list of nodes in the original order
- */
- List<String> getTreeNodes(int treeIndex);
-
- /**
- * @return the sorted set of texts of selected cells
- */
- Set<String> getSelectedTableCells(int tableIndex, int columnIndex);
-
- /**
- * @return the sorted set of texts of selected nodes
- */
- Set<String> getSelectedTreeNodes(int treeIndex);
-
- /**
- * Works only if checked Row is visible
- *
- * @return the sorted set of texts of checked cells
- */
- Set<String> getCheckedTableCells(int tableIndex, int columnIndex);
-
- /**
- * @return the sorted set of texts of checked nodes
- */
-// Set<String> getCheckedTreeNodes(int treeIndex);XXX
-
- /**
- */
- WindowState getWindowState(String title);
-
- String getClipboardText();
-
- Object internal0(Object o);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.testing.client;
+
+import java.util.List;
+import java.util.Set;
+
+/**
+ * This interface is used to support gui testing with an abstraction layer.
+ * <p>
+ * Therefore swt and swing gui tests can be programmed just once in the client and run with both guis.
+ * <p>
+ * The term "window" is used for frames, dialogs, swt views, swt editors, swing internal frames.
+ * <p>
+ * The config.ini property "IGuiMock.treeNodeToExpandIconGap" defines the gap between a tree node and its
+ * expand/collapse icon and is used in {@link #gotoTreeExpandIcon(int, String)}
+ */
+public interface IGuiMock {
+ long WAIT_TIMEOUT = 10000L;
+
+ enum GuiStrategy {
+ Swt,
+ Swing,
+ Vaadin,
+ Rap
+ }
+
+ enum Key {
+ Shift,
+ Control,
+ Alt,
+ Delete,
+ Backspace,
+ Enter,
+ Esc,
+ Tab,
+ ContextMenu,
+ Up,
+ Down,
+ Left,
+ Right,
+ Windows,
+ F1,
+ F2,
+ F3,
+ F4,
+ F5,
+ F6,
+ F7,
+ F8,
+ F9,
+ F10,
+ F11,
+ F12,
+ Home,
+ End,
+ PageUp,
+ PageDown,
+ NumPad0,
+ NumPad1,
+ NumPad2,
+ NumPad3,
+ NumPad4,
+ NumPad5,
+ NumPad6,
+ NumPad7,
+ NumPad8,
+ NumPad9,
+ NumPadMultiply,
+ NumPadAdd,
+ NumPadSubtract,
+ NumPadDecimal,
+ NumPadDivide,
+ NumPadSeparator,
+ }
+
+ enum FieldType {
+ Label,
+ Text,
+ Checkbox,
+ RadioButton,
+ Table,
+ Tree,
+ PushButton,
+ ScrollButton,
+ DropdownButton,
+ }
+
+ public class WindowState {
+ /**
+ * coordinates on screen
+ */
+ public int x;
+ /**
+ * coordinates on screen
+ */
+ public int y;
+ public int width;
+ public int height;
+ }
+
+ public class FieldState {
+ public FieldType type;
+ public String scoutName;
+ /**
+ * coordinates on screen
+ */
+ public int x;
+ /**
+ * coordinates on screen
+ */
+ public int y;
+ public int width;
+ public int height;
+ public boolean focus;
+ public String text;
+ }
+
+ void initializeMock();
+
+ void shutdownMock();
+
+ void beforeTest();
+
+ void afterTest();
+
+ GuiStrategy getStrategy();
+
+ int getSleepDelay();
+
+ void setSleepDelay(int ms);
+
+ /**
+ * sleep for some time
+ */
+ void sleep();
+
+ /**
+ * sleep for some time
+ */
+ void sleep(int ms);
+
+ boolean isWindowActive(String title);
+
+ boolean isWindowOpen(String title);
+
+ /**
+ * Waits until gui and model are idle
+ */
+ void waitForIdle();
+
+ /**
+ * This only waits for the window to open, NOT to be active.
+ * <p>
+ * Normally {@link #waitForActiveWindow(String)} is used.
+ */
+ void waitForOpenWindow(String title);
+
+ void waitForActiveWindow(String title);
+
+ void activateWindow(String title);
+
+ /**
+ * @return the field state of the visible and accessible field at the index
+ */
+ FieldState getFieldState(FieldType type, int index);
+
+ /**
+ * @return the field state of the visible and accessible field that represents a scout model with that (class) name
+ */
+ FieldState getScoutFieldState(String name);
+
+ FieldState getScoutFieldContainerState(String name);
+
+ /**
+ * @return all fields af that type (all fileds if type is null)
+ */
+ List<FieldState> getFieldStates(FieldType type);
+
+ /**
+ * @return the state of the current focused /clicked field (textfield, button)
+ */
+ FieldState getFocusFieldState();
+
+ /**
+ * Set mouse to absolute point on screen
+ */
+ void gotoPoint(int x, int y);
+
+ /**
+ * Move mouse from current location to a delta position on screen
+ */
+ void move(int deltaX, int deltaY);
+
+ /**
+ * Click left mouse button
+ */
+ void clickLeft();
+
+ /**
+ * Click right mouse button
+ */
+ void clickRight();
+
+ /**
+ * Press left mouse button (without releasing it)
+ */
+ void pressLeft();
+
+ /**
+ * Release left mouse button (must be called after {@link IGuiMock#pressLeft()}
+ */
+ public void releaseLeft();
+
+ /**
+ * Drag the mouse
+ */
+ void drag(int x1, int y1, int x2, int y2);
+
+ void dragWindowRightBorder(WindowState windowState, int pixelToMoveOnX);
+
+ void pressKey(Key key);
+
+ void releaseKey(Key key);
+
+ void typeKey(Key key);
+
+ void typeText(final String text);
+
+ void paste(final String text);
+
+ /**
+ * Convenience for clicking on a button with a label
+ */
+ void clickOnPushButton(String text);
+
+ /**
+ * place the mouse over the center of a field
+ * <p>
+ * The index is searched in the active window (popup, dialog, frame)
+ */
+ void gotoField(FieldType type, int index);
+
+ /**
+ * place the mouse over the center of a field that represents a scout model with that (class) name
+ */
+ void gotoScoutField(String name);
+
+ /**
+ * place the mouse over the center of a table cell
+ * <p>
+ * The index is searched in the active window (popup, dialog, frame)
+ */
+ void gotoTable(int tableIndex, int rowIndex, int columnIndex);
+
+ /**
+ * place the mouse over the center of a table header cell
+ * <p>
+ * The index is searched in the active window (popup, dialog, frame)
+ */
+ void gotoTableHeader(int tableIndex, int columnIndex);
+
+ /**
+ * place the mouse over the center of a tree node
+ * <p>
+ * The index is searched in the active window (popup, dialog, frame)
+ */
+ void gotoTree(int treeIndex, String nodeText);
+
+ /**
+ * place the mouse over the expand/collapse area of a tree node
+ * <p>
+ * The index is searched in the active window (popup, dialog, frame)
+ */
+ void gotoTreeExpandIcon(int treeIndex, String nodeText);
+
+ /**
+ * Assumes that a context menu is showing and clicks on the popup menu with the name
+ * <p>
+ * If multiple names are given this is meant as sub-menus
+ */
+ void contextMenu(String... names);
+
+ /**
+ * @return the list of cells in the original order
+ */
+ List<String> getTableCells(int tableIndex, int columnIndex);
+
+ /**
+ * @return the list of nodes in the original order
+ */
+ List<String> getTreeNodes(int treeIndex);
+
+ /**
+ * @return the sorted set of texts of selected cells
+ */
+ Set<String> getSelectedTableCells(int tableIndex, int columnIndex);
+
+ /**
+ * @return the sorted set of texts of selected nodes
+ */
+ Set<String> getSelectedTreeNodes(int treeIndex);
+
+ /**
+ * Works only if checked Row is visible
+ *
+ * @return the sorted set of texts of checked cells
+ */
+ Set<String> getCheckedTableCells(int tableIndex, int columnIndex);
+
+ /**
+ * @return the sorted set of texts of checked nodes
+ */
+// Set<String> getCheckedTreeNodes(int treeIndex);XXX
+
+ /**
+ */
+ WindowState getWindowState(String title);
+
+ String getClipboardText();
+
+ Object internal0(Object o);
+}
diff --git a/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/IGuiMockService.java b/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/IGuiMockService.java
index a22da553b4..6ec6071438 100644
--- a/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/IGuiMockService.java
+++ b/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/IGuiMockService.java
@@ -1,28 +1,28 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.testing.client;
-
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.shared.ui.UserAgent;
-import org.eclipse.scout.service.IService2;
-
-/**
- * This interface is used to support gui testing with an abstraction layer.
- * <p>
- * Therefore swt and swing gui tests can be programmed just once in the client and run with both guis.
- */
-public interface IGuiMockService extends IService2 {
-
- UserAgent initUserAgent();
-
- IGuiMock createMock(IClientSession session);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.testing.client;
+
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.shared.ui.UserAgent;
+import org.eclipse.scout.service.IService2;
+
+/**
+ * This interface is used to support gui testing with an abstraction layer.
+ * <p>
+ * Therefore swt and swing gui tests can be programmed just once in the client and run with both guis.
+ */
+public interface IGuiMockService extends IService2 {
+
+ UserAgent initUserAgent();
+
+ IGuiMock createMock(IClientSession session);
+
+}
diff --git a/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/ITestClientSessionProvider.java b/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/ITestClientSessionProvider.java
index c53fea2e2e..604c1a3f3c 100644
--- a/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/ITestClientSessionProvider.java
+++ b/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/ITestClientSessionProvider.java
@@ -1,37 +1,37 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.testing.client;
-
-import org.eclipse.scout.rt.client.IClientSession;
-
-/**
- * Provides {@link IClientSession} for Scout tests and allows to create more than one instance of the same
- * session type (e.g. for different users).
- */
-public interface ITestClientSessionProvider {
-
- /**
- * Returns an already existing client session of the given type and for the given user or creates a new one.
- *
- * @param <T>
- * type of the resulting client session.
- * @param clazz
- * requested client session.
- * @param user
- * name of the user the session belongs to or is created for.
- * @param forceNewSession
- * controls whether a new session is created even if there already exists one of the given type and for the
- * given user. <code>true</code> for creating a new session, <code>false</code> for reusing an already
- * existing session.
- * @return
- */
- <T extends IClientSession> T getOrCreateClientSession(Class<T> clazz, String user, boolean forceNewSession);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.testing.client;
+
+import org.eclipse.scout.rt.client.IClientSession;
+
+/**
+ * Provides {@link IClientSession} for Scout tests and allows to create more than one instance of the same
+ * session type (e.g. for different users).
+ */
+public interface ITestClientSessionProvider {
+
+ /**
+ * Returns an already existing client session of the given type and for the given user or creates a new one.
+ *
+ * @param <T>
+ * type of the resulting client session.
+ * @param clazz
+ * requested client session.
+ * @param user
+ * name of the user the session belongs to or is created for.
+ * @param forceNewSession
+ * controls whether a new session is created even if there already exists one of the given type and for the
+ * given user. <code>true</code> for creating a new session, <code>false</code> for reusing an already
+ * existing session.
+ * @return
+ */
+ <T extends IClientSession> T getOrCreateClientSession(Class<T> clazz, String user, boolean forceNewSession);
+}
diff --git a/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/ScoutClientAssert.java b/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/ScoutClientAssert.java
index be2ab88471..64d06cf592 100644
--- a/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/ScoutClientAssert.java
+++ b/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/ScoutClientAssert.java
@@ -1,288 +1,288 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.testing.client;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Iterator;
-
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.client.ui.form.IFormFieldVisitor;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.listbox.AbstractListBox;
-import org.eclipse.scout.rt.client.ui.form.fields.listbox.AbstractListBox.DefaultListBoxTable;
-import org.junit.Assert;
-
-/**
- * Convenience assertion class for Scout clients.
- */
-public final class ScoutClientAssert {
-
- private ScoutClientAssert() {
- }
-
- public static void assertContainsKeysStrictly(AbstractListBox<?> listbox, Object... keys) {
- assertContainsKeys(true, listbox, keys);
- }
-
- public static void assertContainsKeys(AbstractListBox<?> listbox, Object... keys) {
- assertContainsKeys(false, listbox, keys);
- }
-
- private static void assertContainsKeys(boolean strict, AbstractListBox<?> listbox, Object... keys) {
- // TODO abr check row visibility
- HashSet<Object> expectedKeys = new HashSet<Object>(Arrays.asList(keys));
- HashSet<Object> unexpectedKeys = new HashSet<Object>();
- Object[] listBoxKeys = ((DefaultListBoxTable) listbox.getTable()).getKeyColumn().getValues();
- for (Object key : listBoxKeys) {
- boolean expected = expectedKeys.remove(key);
- if (strict && !expected) {
- unexpectedKeys.add(key);
- }
- }
- if (!expectedKeys.isEmpty() || !unexpectedKeys.isEmpty()) {
- StringBuilder builder = new StringBuilder();
- builder.append("Listbox entries:");
- if (!expectedKeys.isEmpty()) {
- builder.append("\n\tmissing entries: ");
- builder.append(StringUtility.collectionToString(expectedKeys));
- }
- if (!unexpectedKeys.isEmpty()) {
- builder.append("\n\tunexpected entries: ");
- builder.append(StringUtility.collectionToString(unexpectedKeys));
- }
- Assert.fail(builder.toString());
- }
- }
-
- public static void assertValid(IFormField field) {
- Assert.assertNotNull(field);
- Assert.assertNull(field.getFieldId() + " is expected valid", field.getErrorStatus());
- }
-
- public static void assertInvalid(IFormField field) {
- Assert.assertNotNull(field);
- Assert.assertNotNull(field.getFieldId() + " is expected invalid", field.getErrorStatus());
- }
-
- public static void assertVisible(IFormField field) {
- Assert.assertNotNull(field);
- Assert.assertTrue(field.getFieldId() + " is expected visible", field.isVisible());
- }
-
- public static void assertInvisible(IFormField field) {
- Assert.assertNotNull(field);
- Assert.assertFalse(field.getFieldId() + " is expected invisible", field.isVisible());
- }
-
- public static void assertEnabled(IFormField field) {
- Assert.assertNotNull(field);
- Assert.assertTrue(field.getFieldId() + " is expected enabled", field.isEnabled());
- }
-
- public static void assertDisabled(IFormField field) {
- Assert.assertNotNull(field);
- Assert.assertFalse(field.getFieldId() + " is expected disabled", field.isEnabled());
- }
-
- public static void assertMandatory(IFormField field) {
- Assert.assertNotNull(field);
- Assert.assertTrue(field.getFieldId() + " is expected mandatory", field.isMandatory());
- }
-
- public static void assertNonMandatory(IFormField field) {
- Assert.assertNotNull(field);
- Assert.assertFalse(field.getFieldId() + " is expected non-mandatory", field.isMandatory());
- }
-
- public static void assertView(boolean visible, boolean enabled, boolean mandatory, IFormField field) {
- Assert.assertNotNull(field);
- if ((field.isVisible() != visible) || (field.isEnabled() != enabled) || (field.isMandatory() != mandatory)) {
- StringBuilder builder = new StringBuilder();
- builder.append(field.getFieldId());
- builder.append(" is expected ");
- builder.append(visible ? "visible" : "invisible");
- builder.append(", ");
- builder.append(enabled ? "enabled" : "disabled");
- builder.append(", ");
- builder.append(mandatory ? "mandatory" : "non-mandatory");
- builder.append(" but was ");
- builder.append(field.isVisible() ? "visible" : "invisible");
- builder.append(", ");
- builder.append(field.isEnabled() ? "enabled" : "disabled");
- builder.append(", ");
- builder.append(field.isMandatory() ? "mandatory" : "non-mandatory");
- Assert.fail(builder.toString());
- }
- }
-
- public static void assertVisibleStrictly(IForm form, IFormField... fields) {
- assertView(ViewKind.VISIBILE, true, form, fields);
- }
-
- public static void assertInvisibleStrictly(IForm form, IFormField... fields) {
- assertView(ViewKind.INVISIBILE, true, form, fields);
- }
-
- public static void assertEnabledStrictly(IForm form, IFormField... fields) {
- assertView(ViewKind.ENABLED, true, form, fields);
- }
-
- public static void assertDisabledStrictly(IForm form, IFormField... fields) {
- assertView(ViewKind.DISABLED, true, form, fields);
- }
-
- public static void assertMandatoryStrictly(IForm form, IFormField... fields) {
- assertView(ViewKind.MANDATORY, true, form, fields);
- }
-
- public static void assertNonMandatoryStrictly(IForm form, IFormField... fields) {
- assertView(ViewKind.NONMANDATORY, true, form, fields);
- }
-
- public static void assertVisible(IForm form, IFormField... fields) {
- assertView(ViewKind.VISIBILE, false, form, fields);
- }
-
- public static void assertInvisible(IForm form, IFormField... fields) {
- assertView(ViewKind.INVISIBILE, false, form, fields);
- }
-
- public static void assertEnabled(IForm form, IFormField... fields) {
- assertView(ViewKind.ENABLED, false, form, fields);
- }
-
- public static void assertDisabled(IForm form, IFormField... fields) {
- assertView(ViewKind.DISABLED, false, form, fields);
- }
-
- public static void assertMandatory(IForm form, IFormField... fields) {
- assertView(ViewKind.MANDATORY, false, form, fields);
- }
-
- public static void assertNonMandatory(IForm form, IFormField... fields) {
- assertView(ViewKind.NONMANDATORY, false, form, fields);
- }
-
- private enum ViewKind {
- VISIBILE("Visible", "visible", "invisible") {
- @Override
- public boolean testField(IFormField field) {
- return field.isVisible();
- }
- },
- INVISIBILE("Invisible", "invisible", "visible") {
- @Override
- public boolean testField(IFormField field) {
- return !field.isVisible();
- }
- },
- ENABLED("Enabled", "enabled", "disabled") {
- @Override
- public boolean testField(IFormField field) {
- return field.isEnabled();
- }
- },
- DISABLED("Disabled", "disabled", "enabled") {
- @Override
- public boolean testField(IFormField field) {
- return !field.isEnabled();
- }
- },
- MANDATORY("Mandatory", "mandatory", "non-mandatory") {
- @Override
- public boolean testField(IFormField field) {
- return field.isMandatory();
- }
- },
- NONMANDATORY("Non-mandatory", "non-mandatory", "mandatory") {
- @Override
- public boolean testField(IFormField field) {
- return !field.isMandatory();
- }
- };
-
- private final String m_name;
- private final String m_positive;
- private final String m_negative;
-
- private ViewKind(String name, String positive, String negative) {
- m_name = name;
- m_positive = positive;
- m_negative = negative;
- }
-
- public abstract boolean testField(IFormField field);
-
- public String getName() {
- return m_name;
- }
-
- public String getPositive() {
- return m_positive;
- }
-
- public String getNegative() {
- return m_negative;
- }
- }
-
- private static void assertView(final ViewKind viewKind, final boolean strict, IForm form, IFormField... fields) {
- Assert.assertNotNull(form);
- Assert.assertNotNull(fields);
- final HashSet<IFormField> expectedFields = new HashSet<IFormField>(Arrays.asList(fields));
- final ArrayList<IFormField> unexpectedFields = new ArrayList<IFormField>();
- form.visitFields(new IFormFieldVisitor() {
- @Override
- public boolean visitField(IFormField field, int level, int fieldIndex) {
- if (viewKind.testField(field)) {
- boolean expected = expectedFields.remove(field);
- if (strict && !expected) {
- unexpectedFields.add(field);
- }
- }
- return true;
- }
- });
- if (!expectedFields.isEmpty() || !unexpectedFields.isEmpty()) {
- StringBuilder builder = new StringBuilder();
- builder.append(viewKind.getName());
- builder.append(" fields:");
- if (!expectedFields.isEmpty()) {
- builder.append("\n\texpected ").append(viewKind.getPositive()).append(" but ").append(viewKind.getNegative()).append(": ");
- builder.append(formatFieldNames(expectedFields));
- }
- if (!unexpectedFields.isEmpty()) {
- builder.append("\n\texpected ").append(viewKind.getNegative()).append(" but ").append(viewKind.getPositive()).append(": ");
- builder.append(formatFieldNames(unexpectedFields));
- }
- Assert.fail(builder.toString());
- }
- }
-
- private static String formatFieldNames(Collection<IFormField> fields) {
- StringBuilder builder = new StringBuilder();
- boolean first = true;
- for (Iterator<IFormField> it = fields.iterator(); it.hasNext();) {
- if (!first) {
- builder.append(", ");
- }
- else {
- first = false;
- }
- builder.append(it.next().getFieldId());
- }
- return builder.toString();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.testing.client;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.client.ui.form.IFormFieldVisitor;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.listbox.AbstractListBox;
+import org.eclipse.scout.rt.client.ui.form.fields.listbox.AbstractListBox.DefaultListBoxTable;
+import org.junit.Assert;
+
+/**
+ * Convenience assertion class for Scout clients.
+ */
+public final class ScoutClientAssert {
+
+ private ScoutClientAssert() {
+ }
+
+ public static void assertContainsKeysStrictly(AbstractListBox<?> listbox, Object... keys) {
+ assertContainsKeys(true, listbox, keys);
+ }
+
+ public static void assertContainsKeys(AbstractListBox<?> listbox, Object... keys) {
+ assertContainsKeys(false, listbox, keys);
+ }
+
+ private static void assertContainsKeys(boolean strict, AbstractListBox<?> listbox, Object... keys) {
+ // TODO abr check row visibility
+ HashSet<Object> expectedKeys = new HashSet<Object>(Arrays.asList(keys));
+ HashSet<Object> unexpectedKeys = new HashSet<Object>();
+ Object[] listBoxKeys = ((DefaultListBoxTable) listbox.getTable()).getKeyColumn().getValues();
+ for (Object key : listBoxKeys) {
+ boolean expected = expectedKeys.remove(key);
+ if (strict && !expected) {
+ unexpectedKeys.add(key);
+ }
+ }
+ if (!expectedKeys.isEmpty() || !unexpectedKeys.isEmpty()) {
+ StringBuilder builder = new StringBuilder();
+ builder.append("Listbox entries:");
+ if (!expectedKeys.isEmpty()) {
+ builder.append("\n\tmissing entries: ");
+ builder.append(StringUtility.collectionToString(expectedKeys));
+ }
+ if (!unexpectedKeys.isEmpty()) {
+ builder.append("\n\tunexpected entries: ");
+ builder.append(StringUtility.collectionToString(unexpectedKeys));
+ }
+ Assert.fail(builder.toString());
+ }
+ }
+
+ public static void assertValid(IFormField field) {
+ Assert.assertNotNull(field);
+ Assert.assertNull(field.getFieldId() + " is expected valid", field.getErrorStatus());
+ }
+
+ public static void assertInvalid(IFormField field) {
+ Assert.assertNotNull(field);
+ Assert.assertNotNull(field.getFieldId() + " is expected invalid", field.getErrorStatus());
+ }
+
+ public static void assertVisible(IFormField field) {
+ Assert.assertNotNull(field);
+ Assert.assertTrue(field.getFieldId() + " is expected visible", field.isVisible());
+ }
+
+ public static void assertInvisible(IFormField field) {
+ Assert.assertNotNull(field);
+ Assert.assertFalse(field.getFieldId() + " is expected invisible", field.isVisible());
+ }
+
+ public static void assertEnabled(IFormField field) {
+ Assert.assertNotNull(field);
+ Assert.assertTrue(field.getFieldId() + " is expected enabled", field.isEnabled());
+ }
+
+ public static void assertDisabled(IFormField field) {
+ Assert.assertNotNull(field);
+ Assert.assertFalse(field.getFieldId() + " is expected disabled", field.isEnabled());
+ }
+
+ public static void assertMandatory(IFormField field) {
+ Assert.assertNotNull(field);
+ Assert.assertTrue(field.getFieldId() + " is expected mandatory", field.isMandatory());
+ }
+
+ public static void assertNonMandatory(IFormField field) {
+ Assert.assertNotNull(field);
+ Assert.assertFalse(field.getFieldId() + " is expected non-mandatory", field.isMandatory());
+ }
+
+ public static void assertView(boolean visible, boolean enabled, boolean mandatory, IFormField field) {
+ Assert.assertNotNull(field);
+ if ((field.isVisible() != visible) || (field.isEnabled() != enabled) || (field.isMandatory() != mandatory)) {
+ StringBuilder builder = new StringBuilder();
+ builder.append(field.getFieldId());
+ builder.append(" is expected ");
+ builder.append(visible ? "visible" : "invisible");
+ builder.append(", ");
+ builder.append(enabled ? "enabled" : "disabled");
+ builder.append(", ");
+ builder.append(mandatory ? "mandatory" : "non-mandatory");
+ builder.append(" but was ");
+ builder.append(field.isVisible() ? "visible" : "invisible");
+ builder.append(", ");
+ builder.append(field.isEnabled() ? "enabled" : "disabled");
+ builder.append(", ");
+ builder.append(field.isMandatory() ? "mandatory" : "non-mandatory");
+ Assert.fail(builder.toString());
+ }
+ }
+
+ public static void assertVisibleStrictly(IForm form, IFormField... fields) {
+ assertView(ViewKind.VISIBILE, true, form, fields);
+ }
+
+ public static void assertInvisibleStrictly(IForm form, IFormField... fields) {
+ assertView(ViewKind.INVISIBILE, true, form, fields);
+ }
+
+ public static void assertEnabledStrictly(IForm form, IFormField... fields) {
+ assertView(ViewKind.ENABLED, true, form, fields);
+ }
+
+ public static void assertDisabledStrictly(IForm form, IFormField... fields) {
+ assertView(ViewKind.DISABLED, true, form, fields);
+ }
+
+ public static void assertMandatoryStrictly(IForm form, IFormField... fields) {
+ assertView(ViewKind.MANDATORY, true, form, fields);
+ }
+
+ public static void assertNonMandatoryStrictly(IForm form, IFormField... fields) {
+ assertView(ViewKind.NONMANDATORY, true, form, fields);
+ }
+
+ public static void assertVisible(IForm form, IFormField... fields) {
+ assertView(ViewKind.VISIBILE, false, form, fields);
+ }
+
+ public static void assertInvisible(IForm form, IFormField... fields) {
+ assertView(ViewKind.INVISIBILE, false, form, fields);
+ }
+
+ public static void assertEnabled(IForm form, IFormField... fields) {
+ assertView(ViewKind.ENABLED, false, form, fields);
+ }
+
+ public static void assertDisabled(IForm form, IFormField... fields) {
+ assertView(ViewKind.DISABLED, false, form, fields);
+ }
+
+ public static void assertMandatory(IForm form, IFormField... fields) {
+ assertView(ViewKind.MANDATORY, false, form, fields);
+ }
+
+ public static void assertNonMandatory(IForm form, IFormField... fields) {
+ assertView(ViewKind.NONMANDATORY, false, form, fields);
+ }
+
+ private enum ViewKind {
+ VISIBILE("Visible", "visible", "invisible") {
+ @Override
+ public boolean testField(IFormField field) {
+ return field.isVisible();
+ }
+ },
+ INVISIBILE("Invisible", "invisible", "visible") {
+ @Override
+ public boolean testField(IFormField field) {
+ return !field.isVisible();
+ }
+ },
+ ENABLED("Enabled", "enabled", "disabled") {
+ @Override
+ public boolean testField(IFormField field) {
+ return field.isEnabled();
+ }
+ },
+ DISABLED("Disabled", "disabled", "enabled") {
+ @Override
+ public boolean testField(IFormField field) {
+ return !field.isEnabled();
+ }
+ },
+ MANDATORY("Mandatory", "mandatory", "non-mandatory") {
+ @Override
+ public boolean testField(IFormField field) {
+ return field.isMandatory();
+ }
+ },
+ NONMANDATORY("Non-mandatory", "non-mandatory", "mandatory") {
+ @Override
+ public boolean testField(IFormField field) {
+ return !field.isMandatory();
+ }
+ };
+
+ private final String m_name;
+ private final String m_positive;
+ private final String m_negative;
+
+ private ViewKind(String name, String positive, String negative) {
+ m_name = name;
+ m_positive = positive;
+ m_negative = negative;
+ }
+
+ public abstract boolean testField(IFormField field);
+
+ public String getName() {
+ return m_name;
+ }
+
+ public String getPositive() {
+ return m_positive;
+ }
+
+ public String getNegative() {
+ return m_negative;
+ }
+ }
+
+ private static void assertView(final ViewKind viewKind, final boolean strict, IForm form, IFormField... fields) {
+ Assert.assertNotNull(form);
+ Assert.assertNotNull(fields);
+ final HashSet<IFormField> expectedFields = new HashSet<IFormField>(Arrays.asList(fields));
+ final ArrayList<IFormField> unexpectedFields = new ArrayList<IFormField>();
+ form.visitFields(new IFormFieldVisitor() {
+ @Override
+ public boolean visitField(IFormField field, int level, int fieldIndex) {
+ if (viewKind.testField(field)) {
+ boolean expected = expectedFields.remove(field);
+ if (strict && !expected) {
+ unexpectedFields.add(field);
+ }
+ }
+ return true;
+ }
+ });
+ if (!expectedFields.isEmpty() || !unexpectedFields.isEmpty()) {
+ StringBuilder builder = new StringBuilder();
+ builder.append(viewKind.getName());
+ builder.append(" fields:");
+ if (!expectedFields.isEmpty()) {
+ builder.append("\n\texpected ").append(viewKind.getPositive()).append(" but ").append(viewKind.getNegative()).append(": ");
+ builder.append(formatFieldNames(expectedFields));
+ }
+ if (!unexpectedFields.isEmpty()) {
+ builder.append("\n\texpected ").append(viewKind.getNegative()).append(" but ").append(viewKind.getPositive()).append(": ");
+ builder.append(formatFieldNames(unexpectedFields));
+ }
+ Assert.fail(builder.toString());
+ }
+ }
+
+ private static String formatFieldNames(Collection<IFormField> fields) {
+ StringBuilder builder = new StringBuilder();
+ boolean first = true;
+ for (Iterator<IFormField> it = fields.iterator(); it.hasNext();) {
+ if (!first) {
+ builder.append(", ");
+ }
+ else {
+ first = false;
+ }
+ builder.append(it.next().getFieldId());
+ }
+ return builder.toString();
+ }
+}
diff --git a/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/TestingClientSessionRegistryService.java b/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/TestingClientSessionRegistryService.java
index d4c611ebe9..a26d4ad197 100644
--- a/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/TestingClientSessionRegistryService.java
+++ b/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/TestingClientSessionRegistryService.java
@@ -1,131 +1,131 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.testing.client;
-
-import java.util.HashMap;
-import java.util.List;
-
-import javax.security.auth.Subject;
-
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.client.services.common.session.IClientSessionRegistryService;
-import org.eclipse.scout.rt.shared.ui.UserAgent;
-import org.eclipse.scout.rt.testing.shared.TestingUtility;
-import org.eclipse.scout.service.AbstractService;
-import org.eclipse.scout.service.SERVICES;
-import org.osgi.framework.ServiceRegistration;
-
-/**
- * The TestingClientSessionRegistryService is intended to be used within the context of automatic GUI tests.
- * It delegates method calls to a given concrete implementation of IClientSessionRegistryService passed on the
- * constructor. Additionally, the TestingClientSessionRegistryService caches all created client sessions that
- * are needed for GUI tests to reuse the already initialized client session.
- * <p>
- * To use the TestingClientSessionRegistryService, it has to be registered by calling the method
- * {@link #registerTestingClientSessionRegistryService}. For Swing and SWT GUI tests, this is done when the
- * SwingApplication or SwtApplication respectively gets started. In case of RAP GUI tests, this service is registered
- * when the JUnitRAPJob is scheduled. The service is unregistered with
- * {@link #unregisterTestingClientSessionRegistryService} when the Application or the JUnitJob terminates
- *
- * @since 3.8.1
- */
-public class TestingClientSessionRegistryService extends AbstractService implements IClientSessionRegistryService {
-
- private final HashMap<String, IClientSession> m_cache = new HashMap<String, IClientSession>();
- private final Object m_cacheLock = new Object();
-
- private final IClientSessionRegistryService m_delegate;
-
- private List<ServiceRegistration> m_serviceRegistrations;
-
- public TestingClientSessionRegistryService(IClientSessionRegistryService delegate) {
- m_delegate = delegate;
- }
-
- public static TestingClientSessionRegistryService registerTestingClientSessionRegistryService() {
- IClientSessionRegistryService delegateClientSessionRegistryService = SERVICES.getService(IClientSessionRegistryService.class);
- TestingClientSessionRegistryService testingClientSessionRegistryService = new TestingClientSessionRegistryService(delegateClientSessionRegistryService);
- List<ServiceRegistration> regs = TestingUtility.registerServices(Activator.getDefault().getBundle(), 1000, testingClientSessionRegistryService);
- testingClientSessionRegistryService.setServiceRegistrations(regs);
- return testingClientSessionRegistryService;
- }
-
- public static void unregisterTestingClientSessionRegistryService(TestingClientSessionRegistryService service) {
- if (service == null || service.getServiceRegistrations() == null) {
- return;
- }
- TestingUtility.unregisterServices(service.getServiceRegistrations());
- }
-
- public List<ServiceRegistration> getServiceRegistrations() {
- return m_serviceRegistrations;
- }
-
- public void setServiceRegistrations(List<ServiceRegistration> serviceRegistrations) {
- m_serviceRegistrations = serviceRegistrations;
- }
-
- public IClientSessionRegistryService getDelegateService() {
- return m_delegate;
- }
-
- /**
- * {@inheritDoc} Returns an already cached client session if available. Otherwise, a new ClientSession object
- * is created and put into the cache.
- */
- @Override
- public <T extends IClientSession> T newClientSession(Class<T> clazz, UserAgent userAgent) {
- synchronized (m_cacheLock) {
- @SuppressWarnings("unchecked")
- T clientSession = (T) m_cache.get(clazz.getName());
- if (clientSession != null) {
- return clientSession;
- }
- clientSession = m_delegate.newClientSession(clazz, userAgent);
- m_cache.put(clazz.getName(), clientSession);
- return clientSession;
- }
- }
-
- /**
- * {@inheritDoc} Returns an already cached client session if available. Otherwise, a new ClientSession object
- * is created and put into the cache.
- */
- @Override
- public <T extends IClientSession> T newClientSession(Class<T> clazz, Subject subject, String virtualSessionId, UserAgent userAgent) {
- synchronized (m_cacheLock) {
- @SuppressWarnings("unchecked")
- T clientSession = (T) m_cache.get(clazz.getName());
- if (clientSession != null) {
- return clientSession;
- }
- clientSession = m_delegate.newClientSession(clazz, subject, virtualSessionId, userAgent);
- m_cache.put(clazz.getName(), clientSession);
- return clientSession;
- }
-
- }
-
- @Override
- @Deprecated
- @SuppressWarnings("deprecation")
- public <T extends IClientSession> T getClientSession(Class<T> clazz) {
- return m_delegate.getClientSession(clazz);
- }
-
- @Override
- @Deprecated
- @SuppressWarnings("deprecation")
- public <T extends IClientSession> T newClientSession(Class<T> clazz, Subject subject, String virtualSessionId) {
- return m_delegate.newClientSession(clazz, subject, virtualSessionId);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.testing.client;
+
+import java.util.HashMap;
+import java.util.List;
+
+import javax.security.auth.Subject;
+
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.client.services.common.session.IClientSessionRegistryService;
+import org.eclipse.scout.rt.shared.ui.UserAgent;
+import org.eclipse.scout.rt.testing.shared.TestingUtility;
+import org.eclipse.scout.service.AbstractService;
+import org.eclipse.scout.service.SERVICES;
+import org.osgi.framework.ServiceRegistration;
+
+/**
+ * The TestingClientSessionRegistryService is intended to be used within the context of automatic GUI tests.
+ * It delegates method calls to a given concrete implementation of IClientSessionRegistryService passed on the
+ * constructor. Additionally, the TestingClientSessionRegistryService caches all created client sessions that
+ * are needed for GUI tests to reuse the already initialized client session.
+ * <p>
+ * To use the TestingClientSessionRegistryService, it has to be registered by calling the method
+ * {@link #registerTestingClientSessionRegistryService}. For Swing and SWT GUI tests, this is done when the
+ * SwingApplication or SwtApplication respectively gets started. In case of RAP GUI tests, this service is registered
+ * when the JUnitRAPJob is scheduled. The service is unregistered with
+ * {@link #unregisterTestingClientSessionRegistryService} when the Application or the JUnitJob terminates
+ *
+ * @since 3.8.1
+ */
+public class TestingClientSessionRegistryService extends AbstractService implements IClientSessionRegistryService {
+
+ private final HashMap<String, IClientSession> m_cache = new HashMap<String, IClientSession>();
+ private final Object m_cacheLock = new Object();
+
+ private final IClientSessionRegistryService m_delegate;
+
+ private List<ServiceRegistration> m_serviceRegistrations;
+
+ public TestingClientSessionRegistryService(IClientSessionRegistryService delegate) {
+ m_delegate = delegate;
+ }
+
+ public static TestingClientSessionRegistryService registerTestingClientSessionRegistryService() {
+ IClientSessionRegistryService delegateClientSessionRegistryService = SERVICES.getService(IClientSessionRegistryService.class);
+ TestingClientSessionRegistryService testingClientSessionRegistryService = new TestingClientSessionRegistryService(delegateClientSessionRegistryService);
+ List<ServiceRegistration> regs = TestingUtility.registerServices(Activator.getDefault().getBundle(), 1000, testingClientSessionRegistryService);
+ testingClientSessionRegistryService.setServiceRegistrations(regs);
+ return testingClientSessionRegistryService;
+ }
+
+ public static void unregisterTestingClientSessionRegistryService(TestingClientSessionRegistryService service) {
+ if (service == null || service.getServiceRegistrations() == null) {
+ return;
+ }
+ TestingUtility.unregisterServices(service.getServiceRegistrations());
+ }
+
+ public List<ServiceRegistration> getServiceRegistrations() {
+ return m_serviceRegistrations;
+ }
+
+ public void setServiceRegistrations(List<ServiceRegistration> serviceRegistrations) {
+ m_serviceRegistrations = serviceRegistrations;
+ }
+
+ public IClientSessionRegistryService getDelegateService() {
+ return m_delegate;
+ }
+
+ /**
+ * {@inheritDoc} Returns an already cached client session if available. Otherwise, a new ClientSession object
+ * is created and put into the cache.
+ */
+ @Override
+ public <T extends IClientSession> T newClientSession(Class<T> clazz, UserAgent userAgent) {
+ synchronized (m_cacheLock) {
+ @SuppressWarnings("unchecked")
+ T clientSession = (T) m_cache.get(clazz.getName());
+ if (clientSession != null) {
+ return clientSession;
+ }
+ clientSession = m_delegate.newClientSession(clazz, userAgent);
+ m_cache.put(clazz.getName(), clientSession);
+ return clientSession;
+ }
+ }
+
+ /**
+ * {@inheritDoc} Returns an already cached client session if available. Otherwise, a new ClientSession object
+ * is created and put into the cache.
+ */
+ @Override
+ public <T extends IClientSession> T newClientSession(Class<T> clazz, Subject subject, String virtualSessionId, UserAgent userAgent) {
+ synchronized (m_cacheLock) {
+ @SuppressWarnings("unchecked")
+ T clientSession = (T) m_cache.get(clazz.getName());
+ if (clientSession != null) {
+ return clientSession;
+ }
+ clientSession = m_delegate.newClientSession(clazz, subject, virtualSessionId, userAgent);
+ m_cache.put(clazz.getName(), clientSession);
+ return clientSession;
+ }
+
+ }
+
+ @Override
+ @Deprecated
+ @SuppressWarnings("deprecation")
+ public <T extends IClientSession> T getClientSession(Class<T> clazz) {
+ return m_delegate.getClientSession(clazz);
+ }
+
+ @Override
+ @Deprecated
+ @SuppressWarnings("deprecation")
+ public <T extends IClientSession> T newClientSession(Class<T> clazz, Subject subject, String virtualSessionId) {
+ return m_delegate.newClientSession(clazz, subject, virtualSessionId);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/form/DynamicCancelButton.java b/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/form/DynamicCancelButton.java
index eea91cde95..74b435fd02 100644
--- a/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/form/DynamicCancelButton.java
+++ b/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/form/DynamicCancelButton.java
@@ -1,30 +1,30 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.testing.client.form;
-
-import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractCancelButton;
-
-/**
- * Dynamic field to build an ad-hoc application for testing
- */
-public class DynamicCancelButton extends AbstractCancelButton {
-
- public DynamicCancelButton() {
- super();
- setCustomProperty("id", "cancel");
- }
-
- @Override
- public String getFieldId() {
- return (String) getCustomProperty("id");
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.testing.client.form;
+
+import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractCancelButton;
+
+/**
+ * Dynamic field to build an ad-hoc application for testing
+ */
+public class DynamicCancelButton extends AbstractCancelButton {
+
+ public DynamicCancelButton() {
+ super();
+ setCustomProperty("id", "cancel");
+ }
+
+ @Override
+ public String getFieldId() {
+ return (String) getCustomProperty("id");
+ }
+
+}
diff --git a/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/form/DynamicForm.java b/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/form/DynamicForm.java
index a5b27fdacc..e71af07784 100644
--- a/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/form/DynamicForm.java
+++ b/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/form/DynamicForm.java
@@ -1,45 +1,45 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.testing.client.form;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.form.AbstractForm;
-import org.eclipse.scout.rt.client.ui.form.IFormHandler;
-import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox;
-
-/**
- * Dynamic form to build an ad-hoc application for testing
- */
-public class DynamicForm extends AbstractForm {
- private IGroupBox m_mainBox;
-
- public DynamicForm(String title, IGroupBox mainBox) throws ProcessingException {
- super(false);
- m_mainBox = mainBox;
- callInitializer();
- setTitle(title);
- }
-
- @Override
- public IGroupBox getRootGroupBox() {
- return m_mainBox;
- }
-
- public IButton getButton(String id) {
- return (IButton) getFieldById(id);
- }
-
- public void start(IFormHandler handler) throws ProcessingException {
- startInternal(handler);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.testing.client.form;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.form.AbstractForm;
+import org.eclipse.scout.rt.client.ui.form.IFormHandler;
+import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox;
+
+/**
+ * Dynamic form to build an ad-hoc application for testing
+ */
+public class DynamicForm extends AbstractForm {
+ private IGroupBox m_mainBox;
+
+ public DynamicForm(String title, IGroupBox mainBox) throws ProcessingException {
+ super(false);
+ m_mainBox = mainBox;
+ callInitializer();
+ setTitle(title);
+ }
+
+ @Override
+ public IGroupBox getRootGroupBox() {
+ return m_mainBox;
+ }
+
+ public IButton getButton(String id) {
+ return (IButton) getFieldById(id);
+ }
+
+ public void start(IFormHandler handler) throws ProcessingException {
+ startInternal(handler);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/form/DynamicGroupBox.java b/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/form/DynamicGroupBox.java
index b20c80b74c..9ec3df81c7 100644
--- a/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/form/DynamicGroupBox.java
+++ b/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/form/DynamicGroupBox.java
@@ -1,41 +1,41 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.testing.client.form;
-
-import java.util.List;
-
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
-
-/**
- * Dynamic group box to build an ad-hoc application for testing
- */
-public class DynamicGroupBox extends AbstractGroupBox {
- private IFormField[] m_injectedFields;
-
- public DynamicGroupBox(IFormField... fields) {
- super(false);
- m_injectedFields = fields;
- callInitializer();
- }
-
- /**
- * This is the place to inject fields dynamically
- */
- @Override
- protected void injectFieldsInternal(List<IFormField> fieldList) {
- if (m_injectedFields != null) {
- for (IFormField f : m_injectedFields) {
- fieldList.add(f);
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.testing.client.form;
+
+import java.util.List;
+
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
+
+/**
+ * Dynamic group box to build an ad-hoc application for testing
+ */
+public class DynamicGroupBox extends AbstractGroupBox {
+ private IFormField[] m_injectedFields;
+
+ public DynamicGroupBox(IFormField... fields) {
+ super(false);
+ m_injectedFields = fields;
+ callInitializer();
+ }
+
+ /**
+ * This is the place to inject fields dynamically
+ */
+ @Override
+ protected void injectFieldsInternal(List<IFormField> fieldList) {
+ if (m_injectedFields != null) {
+ for (IFormField f : m_injectedFields) {
+ fieldList.add(f);
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/form/DynamicOkButton.java b/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/form/DynamicOkButton.java
index c4b43d00b4..bc093e7237 100644
--- a/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/form/DynamicOkButton.java
+++ b/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/form/DynamicOkButton.java
@@ -1,30 +1,30 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.testing.client.form;
-
-import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractOkButton;
-
-/**
- * Dynamic field to build an ad-hoc application for testing
- */
-public class DynamicOkButton extends AbstractOkButton {
-
- public DynamicOkButton() {
- super();
- setCustomProperty("id", "ok");
- }
-
- @Override
- public String getFieldId() {
- return (String) getCustomProperty("id");
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.testing.client.form;
+
+import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractOkButton;
+
+/**
+ * Dynamic field to build an ad-hoc application for testing
+ */
+public class DynamicOkButton extends AbstractOkButton {
+
+ public DynamicOkButton() {
+ super();
+ setCustomProperty("id", "ok");
+ }
+
+ @Override
+ public String getFieldId() {
+ return (String) getCustomProperty("id");
+ }
+
+}
diff --git a/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/form/DynamicStringField.java b/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/form/DynamicStringField.java
index 706c609f59..5919329865 100644
--- a/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/form/DynamicStringField.java
+++ b/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/form/DynamicStringField.java
@@ -1,31 +1,31 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.testing.client.form;
-
-import org.eclipse.scout.rt.client.ui.form.fields.stringfield.AbstractStringField;
-
-/**
- * Dynamic field to build an ad-hoc application for testing
- */
-public class DynamicStringField extends AbstractStringField {
-
- public DynamicStringField(String id, String label) {
- super();
- setCustomProperty("id", id);
- setLabel(label);
- }
-
- @Override
- public String getFieldId() {
- return (String) getCustomProperty("id");
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.testing.client.form;
+
+import org.eclipse.scout.rt.client.ui.form.fields.stringfield.AbstractStringField;
+
+/**
+ * Dynamic field to build an ad-hoc application for testing
+ */
+public class DynamicStringField extends AbstractStringField {
+
+ public DynamicStringField(String id, String label) {
+ super();
+ setCustomProperty("id", id);
+ setLabel(label);
+ }
+
+ @Override
+ public String getFieldId() {
+ return (String) getCustomProperty("id");
+ }
+
+}
diff --git a/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/form/FormHandler.java b/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/form/FormHandler.java
index 4fa54925db..5ffa2e0ccc 100644
--- a/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/form/FormHandler.java
+++ b/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/form/FormHandler.java
@@ -1,19 +1,19 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.testing.client.form;
-
-import org.eclipse.scout.rt.client.ui.form.AbstractFormHandler;
-
-/**
- *
- */
-public class FormHandler extends AbstractFormHandler {
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.testing.client.form;
+
+import org.eclipse.scout.rt.client.ui.form.AbstractFormHandler;
+
+/**
+ *
+ */
+public class FormHandler extends AbstractFormHandler {
+}
diff --git a/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/legacy/AbstractClientJUnitTest.java b/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/legacy/AbstractClientJUnitTest.java
index 3f381c4d65..144bd3b9cc 100644
--- a/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/legacy/AbstractClientJUnitTest.java
+++ b/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/legacy/AbstractClientJUnitTest.java
@@ -1,187 +1,187 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.testing.client.legacy;
-
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.client.services.common.test.ClientTestUtility;
-import org.eclipse.scout.rt.shared.services.common.test.AbstractTest;
-import org.eclipse.scout.rt.shared.services.common.test.ITest;
-import org.eclipse.scout.rt.shared.services.common.test.TestStatus;
-import org.junit.runner.Description;
-import org.junit.runner.JUnitCore;
-import org.junit.runner.Result;
-import org.junit.runner.notification.Failure;
-import org.junit.runner.notification.RunListener;
-
-/**
- * Base class for JUnit based client tests. The class can be used with
- * the existing ITest/TestUtility framework of Scout. However, it is possible
- * to use the features of JUnit such as annotations to mark test/set up/tear down
- * methods and assertions.
- */
-public abstract class AbstractClientJUnitTest extends AbstractTest implements ITest {
-
- @Override
- protected String getConfiguredSubTitle() {
- return "JUnitTest";
- }
-
- @Override
- protected String getConfiguredTitle() {
- return this.getClass().getSimpleName().replaceAll("(JUnit)?Test\\$", "");
- }
-
- @Override
- public final void setUp() throws Throwable {
- }
-
- @Override
- public final void tearDown() throws Throwable {
- }
-
- @Override
- public final void run() throws Throwable {
- JUnitCore core = new JUnitCore();
- core.addListener(new CustomListener(this));
- core.run(this.getClass()); //It is possible to get the Result r
- }
-
- @Override
- protected void initConfig() {
- super.initConfig();
- if (getProduct() == null) {
- IClientSession session = ClientTestUtility.getClientSession();
- if (session != null) {
- setProduct(session.getBundle().getSymbolicName());
- }
- }
- }
-
- private class CustomListener extends RunListener {
- protected AbstractClientJUnitTest m_test;
- protected boolean m_hasFailed = false;
-
- /**
- * Initialize with <code>test</code>
- *
- * @param test
- * The test used to handle failed tests.
- */
- public CustomListener(AbstractClientJUnitTest test) {
- this.m_test = test;
- }
-
- /**
- * Called before any tests have been run.
- *
- * @param description
- * describes the tests to be run
- */
- @Override
- public void testRunStarted(Description description) throws Exception {
- }
-
- /**
- * Called when all tests have finished
- *
- * @param result
- * the summary of the test run, including all the tests that failed
- */
-
- @Override
- public void testRunFinished(Result result) throws Exception {
- }
-
- /**
- * Called when an atomic test is about to be started.
- *
- * @param description
- * the description of the test that is about to be run
- * (generally a class and method name)
- */
- @Override
- public void testStarted(Description description) throws Exception {
- m_test.startTiming();
- m_hasFailed = false;
- }
-
- /**
- * Called when an atomic test has finished, whether the test succeeds or fails.
- *
- * @param description
- * the description of the test that just ran
- */
- @Override
- public void testFinished(Description description) throws Exception {
- if (!m_hasFailed) {
- long duration = m_test.stopTiming();
-
- TestStatus s = new TestStatus(description.getDisplayName().replaceAll("^.+\\(", "").replaceAll("\\).*$", ""), description.getDisplayName().replaceAll("\\(.+\\)$", ""), "");
- s.setSeverity(TestStatus.INFO);
- s.setDuration(duration);
- m_test.getTestContext().addStatus(s);
- }
- }
-
- /**
- * Called when an atomic test fails.
- *
- * @param failure
- * describes the test that failed and the exception that was thrown
- */
- @Override
- public void testFailure(Failure failure) throws Exception {
- long duration = m_test.stopTiming();
-
- m_hasFailed = true;
- TestStatus s = new TestStatus(failure.getTestHeader().replaceAll("^.+\\(", "").replaceAll("\\).*$", ""), failure.getTestHeader().replaceAll("\\(.+\\)$", ""), failure.getMessage());
- s.setSeverity(TestStatus.FATAL);
- s.setDuration(duration);
- s.setException(failure.getException());
- m_test.getTestContext().addStatus(s);
- }
-
- /**
- * Called when an atomic test flags that it assumes a condition that is
- * false
- *
- * @param failure
- * describes the test that failed and the AssumptionViolatedException that was thrown
- */
- @Override
- public void testAssumptionFailure(Failure failure) {
- long duration = m_test.stopTiming();
-
- m_hasFailed = true;
- TestStatus s = new TestStatus(failure.getTestHeader().replaceAll("^.+\\(", "").replaceAll("\\).*$", ""), failure.getTestHeader().replaceAll("\\(.+\\)$", ""), failure.getMessage());
- s.setSeverity(TestStatus.ERROR);
- s.setDuration(duration);
- s.setException(failure.getException());
-
- m_test.getTestContext().addStatus(s);
- }
-
- /**
- * Called when a test will not be run, generally because a test method is annotated
- * with {@link org.junit.Ignore}.
- *
- * @param description
- * describes the test that will not be run
- */
- @Override
- public void testIgnored(Description description) throws Exception {
- TestStatus s = new TestStatus(description.getDisplayName().replaceAll("^.+\\(", "").replaceAll("\\).*$", ""), description.getDisplayName().replaceAll("\\(.+\\)$", ""), "The test is ignored.");
- s.setSeverity(TestStatus.WARNING);
- s.setDuration(0);
- m_test.getTestContext().addStatus(s);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.testing.client.legacy;
+
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.client.services.common.test.ClientTestUtility;
+import org.eclipse.scout.rt.shared.services.common.test.AbstractTest;
+import org.eclipse.scout.rt.shared.services.common.test.ITest;
+import org.eclipse.scout.rt.shared.services.common.test.TestStatus;
+import org.junit.runner.Description;
+import org.junit.runner.JUnitCore;
+import org.junit.runner.Result;
+import org.junit.runner.notification.Failure;
+import org.junit.runner.notification.RunListener;
+
+/**
+ * Base class for JUnit based client tests. The class can be used with
+ * the existing ITest/TestUtility framework of Scout. However, it is possible
+ * to use the features of JUnit such as annotations to mark test/set up/tear down
+ * methods and assertions.
+ */
+public abstract class AbstractClientJUnitTest extends AbstractTest implements ITest {
+
+ @Override
+ protected String getConfiguredSubTitle() {
+ return "JUnitTest";
+ }
+
+ @Override
+ protected String getConfiguredTitle() {
+ return this.getClass().getSimpleName().replaceAll("(JUnit)?Test\\$", "");
+ }
+
+ @Override
+ public final void setUp() throws Throwable {
+ }
+
+ @Override
+ public final void tearDown() throws Throwable {
+ }
+
+ @Override
+ public final void run() throws Throwable {
+ JUnitCore core = new JUnitCore();
+ core.addListener(new CustomListener(this));
+ core.run(this.getClass()); //It is possible to get the Result r
+ }
+
+ @Override
+ protected void initConfig() {
+ super.initConfig();
+ if (getProduct() == null) {
+ IClientSession session = ClientTestUtility.getClientSession();
+ if (session != null) {
+ setProduct(session.getBundle().getSymbolicName());
+ }
+ }
+ }
+
+ private class CustomListener extends RunListener {
+ protected AbstractClientJUnitTest m_test;
+ protected boolean m_hasFailed = false;
+
+ /**
+ * Initialize with <code>test</code>
+ *
+ * @param test
+ * The test used to handle failed tests.
+ */
+ public CustomListener(AbstractClientJUnitTest test) {
+ this.m_test = test;
+ }
+
+ /**
+ * Called before any tests have been run.
+ *
+ * @param description
+ * describes the tests to be run
+ */
+ @Override
+ public void testRunStarted(Description description) throws Exception {
+ }
+
+ /**
+ * Called when all tests have finished
+ *
+ * @param result
+ * the summary of the test run, including all the tests that failed
+ */
+
+ @Override
+ public void testRunFinished(Result result) throws Exception {
+ }
+
+ /**
+ * Called when an atomic test is about to be started.
+ *
+ * @param description
+ * the description of the test that is about to be run
+ * (generally a class and method name)
+ */
+ @Override
+ public void testStarted(Description description) throws Exception {
+ m_test.startTiming();
+ m_hasFailed = false;
+ }
+
+ /**
+ * Called when an atomic test has finished, whether the test succeeds or fails.
+ *
+ * @param description
+ * the description of the test that just ran
+ */
+ @Override
+ public void testFinished(Description description) throws Exception {
+ if (!m_hasFailed) {
+ long duration = m_test.stopTiming();
+
+ TestStatus s = new TestStatus(description.getDisplayName().replaceAll("^.+\\(", "").replaceAll("\\).*$", ""), description.getDisplayName().replaceAll("\\(.+\\)$", ""), "");
+ s.setSeverity(TestStatus.INFO);
+ s.setDuration(duration);
+ m_test.getTestContext().addStatus(s);
+ }
+ }
+
+ /**
+ * Called when an atomic test fails.
+ *
+ * @param failure
+ * describes the test that failed and the exception that was thrown
+ */
+ @Override
+ public void testFailure(Failure failure) throws Exception {
+ long duration = m_test.stopTiming();
+
+ m_hasFailed = true;
+ TestStatus s = new TestStatus(failure.getTestHeader().replaceAll("^.+\\(", "").replaceAll("\\).*$", ""), failure.getTestHeader().replaceAll("\\(.+\\)$", ""), failure.getMessage());
+ s.setSeverity(TestStatus.FATAL);
+ s.setDuration(duration);
+ s.setException(failure.getException());
+ m_test.getTestContext().addStatus(s);
+ }
+
+ /**
+ * Called when an atomic test flags that it assumes a condition that is
+ * false
+ *
+ * @param failure
+ * describes the test that failed and the AssumptionViolatedException that was thrown
+ */
+ @Override
+ public void testAssumptionFailure(Failure failure) {
+ long duration = m_test.stopTiming();
+
+ m_hasFailed = true;
+ TestStatus s = new TestStatus(failure.getTestHeader().replaceAll("^.+\\(", "").replaceAll("\\).*$", ""), failure.getTestHeader().replaceAll("\\(.+\\)$", ""), failure.getMessage());
+ s.setSeverity(TestStatus.ERROR);
+ s.setDuration(duration);
+ s.setException(failure.getException());
+
+ m_test.getTestContext().addStatus(s);
+ }
+
+ /**
+ * Called when a test will not be run, generally because a test method is annotated
+ * with {@link org.junit.Ignore}.
+ *
+ * @param description
+ * describes the test that will not be run
+ */
+ @Override
+ public void testIgnored(Description description) throws Exception {
+ TestStatus s = new TestStatus(description.getDisplayName().replaceAll("^.+\\(", "").replaceAll("\\).*$", ""), description.getDisplayName().replaceAll("\\(.+\\)$", ""), "The test is ignored.");
+ s.setSeverity(TestStatus.WARNING);
+ s.setDuration(0);
+ m_test.getTestContext().addStatus(s);
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/robot/JavaRobot.java b/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/robot/JavaRobot.java
index b8a4906d1b..7052adbd92 100644
--- a/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/robot/JavaRobot.java
+++ b/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/robot/JavaRobot.java
@@ -1,259 +1,259 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.testing.client.robot;
-
-import java.awt.AWTException;
-import java.awt.Robot;
-import java.awt.Toolkit;
-import java.awt.datatransfer.Clipboard;
-import java.awt.datatransfer.StringSelection;
-import java.awt.datatransfer.Transferable;
-import java.awt.event.KeyEvent;
-import java.awt.event.MouseEvent;
-
-import org.eclipse.scout.testing.client.IGuiMock;
-
-/**
- * Wrapper around {@link Robot} with high level api.
- */
-public class JavaRobot {
- private Robot m_robot;
- private int m_x;
- private int m_y;
-
- public JavaRobot() {
- try {
- m_robot = new Robot();
- m_robot.setAutoDelay(10);
- m_robot.setAutoWaitForIdle(false);
- }
- catch (AWTException e) {
- throw new RuntimeException(e);
- }
- }
-
- public int getAutoDelay() {
- return m_robot.getAutoDelay();
- }
-
- public void setAutoDelay(int ms) {
- m_robot.setAutoDelay(ms);
- }
-
- public void sleep(int ms) {
- try {
- Thread.sleep(ms);
- }
- catch (InterruptedException ite) {
- ite.printStackTrace();
- }
- }
-
- public void moveTo(int x, int y) {
- this.m_x = x;
- this.m_y = y;
- m_robot.mouseMove(x, y);
- }
-
- public void moveDelta(int dx, int dy) {
- this.m_x += dx;
- this.m_y += dy;
- m_robot.mouseMove(m_x, m_y);
- }
-
- public void pressLeft() {
- m_robot.mousePress(MouseEvent.BUTTON1_MASK);
- }
-
- public void releaseLeft() {
- m_robot.mouseRelease(MouseEvent.BUTTON1_MASK);
- }
-
- public void clickLeft() {
- m_robot.mousePress(MouseEvent.BUTTON1_MASK);
- m_robot.mouseRelease(MouseEvent.BUTTON1_MASK);
- }
-
- public void pressRight() {
- m_robot.mousePress(MouseEvent.BUTTON3_MASK);
- }
-
- public void releaseRight() {
- m_robot.mouseRelease(MouseEvent.BUTTON3_MASK);
- }
-
- public void clickRight() {
- m_robot.mousePress(MouseEvent.BUTTON3_MASK);
- m_robot.mouseRelease(MouseEvent.BUTTON3_MASK);
- }
-
- public void pressKey(IGuiMock.Key key) {
- m_robot.keyPress(toKeyCode(key));
- }
-
- public void releaseKey(IGuiMock.Key key) {
- m_robot.keyRelease(toKeyCode(key));
- }
-
- public void typeKey(IGuiMock.Key key) {
- m_robot.keyPress(toKeyCode(key));
- m_robot.keyRelease(toKeyCode(key));
- }
-
- public void typeText(String s) {
- if (s == null || s.length() == 0) {
- return;
- }
- for (char c : s.toCharArray()) {
- boolean shift = Character.isUpperCase(c);
- char upperChar = Character.toUpperCase(c);
- if ((upperChar == ' ') || (upperChar >= 'A' && upperChar <= 'Z') || (upperChar >= '0' && upperChar <= '9')) {
- try {
- if (shift) {
- m_robot.keyPress(KeyEvent.VK_SHIFT);
- }
- //
- m_robot.keyPress((int) upperChar);
- m_robot.keyRelease((int) upperChar);
- }
- finally {
- if (shift) {
- m_robot.keyRelease(KeyEvent.VK_SHIFT);
- }
- }
- }
- else {
- pressSpecialKey(c);
- }
- }
- }
-
- private void pressSpecialKey(char ch) {
- Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
- Transferable oldContent = clipboard.getContents(null);
- try {
- StringSelection selection = new StringSelection("" + ch);
- clipboard.setContents(selection, null);
- try {
- //press paste (ctrl-V)
- m_robot.keyPress(KeyEvent.VK_CONTROL);
- m_robot.keyPress(KeyEvent.VK_V);
- m_robot.keyRelease(KeyEvent.VK_V);
- m_robot.keyRelease(KeyEvent.VK_CONTROL);
- }
- catch (Throwable ex) {
- //alternatively press Paste key
- m_robot.keyPress(KeyEvent.VK_PASTE);
- m_robot.keyRelease(KeyEvent.VK_PASTE);
- }
- }
- finally {
- clipboard.setContents(oldContent, null);
- }
- }
-
- protected int toKeyCode(IGuiMock.Key key) {
- switch (key) {
- case Shift:
- return KeyEvent.VK_SHIFT;
- case Control:
- return KeyEvent.VK_CONTROL;
- case Alt:
- return KeyEvent.VK_ALT;
- case Delete:
- return KeyEvent.VK_DELETE;
- case Backspace:
- return KeyEvent.VK_BACK_SPACE;
- case Enter:
- return KeyEvent.VK_ENTER;
- case Esc:
- return KeyEvent.VK_ESCAPE;
- case Tab:
- return KeyEvent.VK_TAB;
- case ContextMenu:
- return KeyEvent.VK_CONTEXT_MENU;
- case Up:
- return KeyEvent.VK_UP;
- case Down:
- return KeyEvent.VK_DOWN;
- case Left:
- return KeyEvent.VK_LEFT;
- case Right:
- return KeyEvent.VK_RIGHT;
- case Windows:
- return KeyEvent.VK_WINDOWS;
- case F1:
- return KeyEvent.VK_F1;
- case F2:
- return KeyEvent.VK_F2;
- case F3:
- return KeyEvent.VK_F3;
- case F4:
- return KeyEvent.VK_F4;
- case F5:
- return KeyEvent.VK_F5;
- case F6:
- return KeyEvent.VK_F6;
- case F7:
- return KeyEvent.VK_F7;
- case F8:
- return KeyEvent.VK_F8;
- case F9:
- return KeyEvent.VK_F9;
- case F10:
- return KeyEvent.VK_F10;
- case F11:
- return KeyEvent.VK_F11;
- case F12:
- return KeyEvent.VK_F12;
- case Home:
- return KeyEvent.VK_HOME;
- case End:
- return KeyEvent.VK_END;
- case PageUp:
- return KeyEvent.VK_PAGE_UP;
- case PageDown:
- return KeyEvent.VK_PAGE_DOWN;
- case NumPad0:
- return KeyEvent.VK_NUMPAD0;
- case NumPad1:
- return KeyEvent.VK_NUMPAD1;
- case NumPad2:
- return KeyEvent.VK_NUMPAD2;
- case NumPad3:
- return KeyEvent.VK_NUMPAD3;
- case NumPad4:
- return KeyEvent.VK_NUMPAD4;
- case NumPad5:
- return KeyEvent.VK_NUMPAD5;
- case NumPad6:
- return KeyEvent.VK_NUMPAD6;
- case NumPad7:
- return KeyEvent.VK_NUMPAD7;
- case NumPad8:
- return KeyEvent.VK_NUMPAD8;
- case NumPadMultiply:
- return KeyEvent.VK_MULTIPLY;
- case NumPadDivide:
- return KeyEvent.VK_DIVIDE;
- case NumPadAdd:
- return KeyEvent.VK_ADD;
- case NumPadSubtract:
- return KeyEvent.VK_SUBTRACT;
- case NumPadDecimal:
- return KeyEvent.VK_DECIMAL;
- case NumPadSeparator:
- return KeyEvent.VK_SEPARATOR;
- default:
- throw new IllegalArgumentException("Unknown keyboard key: " + key);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.testing.client.robot;
+
+import java.awt.AWTException;
+import java.awt.Robot;
+import java.awt.Toolkit;
+import java.awt.datatransfer.Clipboard;
+import java.awt.datatransfer.StringSelection;
+import java.awt.datatransfer.Transferable;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseEvent;
+
+import org.eclipse.scout.testing.client.IGuiMock;
+
+/**
+ * Wrapper around {@link Robot} with high level api.
+ */
+public class JavaRobot {
+ private Robot m_robot;
+ private int m_x;
+ private int m_y;
+
+ public JavaRobot() {
+ try {
+ m_robot = new Robot();
+ m_robot.setAutoDelay(10);
+ m_robot.setAutoWaitForIdle(false);
+ }
+ catch (AWTException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public int getAutoDelay() {
+ return m_robot.getAutoDelay();
+ }
+
+ public void setAutoDelay(int ms) {
+ m_robot.setAutoDelay(ms);
+ }
+
+ public void sleep(int ms) {
+ try {
+ Thread.sleep(ms);
+ }
+ catch (InterruptedException ite) {
+ ite.printStackTrace();
+ }
+ }
+
+ public void moveTo(int x, int y) {
+ this.m_x = x;
+ this.m_y = y;
+ m_robot.mouseMove(x, y);
+ }
+
+ public void moveDelta(int dx, int dy) {
+ this.m_x += dx;
+ this.m_y += dy;
+ m_robot.mouseMove(m_x, m_y);
+ }
+
+ public void pressLeft() {
+ m_robot.mousePress(MouseEvent.BUTTON1_MASK);
+ }
+
+ public void releaseLeft() {
+ m_robot.mouseRelease(MouseEvent.BUTTON1_MASK);
+ }
+
+ public void clickLeft() {
+ m_robot.mousePress(MouseEvent.BUTTON1_MASK);
+ m_robot.mouseRelease(MouseEvent.BUTTON1_MASK);
+ }
+
+ public void pressRight() {
+ m_robot.mousePress(MouseEvent.BUTTON3_MASK);
+ }
+
+ public void releaseRight() {
+ m_robot.mouseRelease(MouseEvent.BUTTON3_MASK);
+ }
+
+ public void clickRight() {
+ m_robot.mousePress(MouseEvent.BUTTON3_MASK);
+ m_robot.mouseRelease(MouseEvent.BUTTON3_MASK);
+ }
+
+ public void pressKey(IGuiMock.Key key) {
+ m_robot.keyPress(toKeyCode(key));
+ }
+
+ public void releaseKey(IGuiMock.Key key) {
+ m_robot.keyRelease(toKeyCode(key));
+ }
+
+ public void typeKey(IGuiMock.Key key) {
+ m_robot.keyPress(toKeyCode(key));
+ m_robot.keyRelease(toKeyCode(key));
+ }
+
+ public void typeText(String s) {
+ if (s == null || s.length() == 0) {
+ return;
+ }
+ for (char c : s.toCharArray()) {
+ boolean shift = Character.isUpperCase(c);
+ char upperChar = Character.toUpperCase(c);
+ if ((upperChar == ' ') || (upperChar >= 'A' && upperChar <= 'Z') || (upperChar >= '0' && upperChar <= '9')) {
+ try {
+ if (shift) {
+ m_robot.keyPress(KeyEvent.VK_SHIFT);
+ }
+ //
+ m_robot.keyPress((int) upperChar);
+ m_robot.keyRelease((int) upperChar);
+ }
+ finally {
+ if (shift) {
+ m_robot.keyRelease(KeyEvent.VK_SHIFT);
+ }
+ }
+ }
+ else {
+ pressSpecialKey(c);
+ }
+ }
+ }
+
+ private void pressSpecialKey(char ch) {
+ Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
+ Transferable oldContent = clipboard.getContents(null);
+ try {
+ StringSelection selection = new StringSelection("" + ch);
+ clipboard.setContents(selection, null);
+ try {
+ //press paste (ctrl-V)
+ m_robot.keyPress(KeyEvent.VK_CONTROL);
+ m_robot.keyPress(KeyEvent.VK_V);
+ m_robot.keyRelease(KeyEvent.VK_V);
+ m_robot.keyRelease(KeyEvent.VK_CONTROL);
+ }
+ catch (Throwable ex) {
+ //alternatively press Paste key
+ m_robot.keyPress(KeyEvent.VK_PASTE);
+ m_robot.keyRelease(KeyEvent.VK_PASTE);
+ }
+ }
+ finally {
+ clipboard.setContents(oldContent, null);
+ }
+ }
+
+ protected int toKeyCode(IGuiMock.Key key) {
+ switch (key) {
+ case Shift:
+ return KeyEvent.VK_SHIFT;
+ case Control:
+ return KeyEvent.VK_CONTROL;
+ case Alt:
+ return KeyEvent.VK_ALT;
+ case Delete:
+ return KeyEvent.VK_DELETE;
+ case Backspace:
+ return KeyEvent.VK_BACK_SPACE;
+ case Enter:
+ return KeyEvent.VK_ENTER;
+ case Esc:
+ return KeyEvent.VK_ESCAPE;
+ case Tab:
+ return KeyEvent.VK_TAB;
+ case ContextMenu:
+ return KeyEvent.VK_CONTEXT_MENU;
+ case Up:
+ return KeyEvent.VK_UP;
+ case Down:
+ return KeyEvent.VK_DOWN;
+ case Left:
+ return KeyEvent.VK_LEFT;
+ case Right:
+ return KeyEvent.VK_RIGHT;
+ case Windows:
+ return KeyEvent.VK_WINDOWS;
+ case F1:
+ return KeyEvent.VK_F1;
+ case F2:
+ return KeyEvent.VK_F2;
+ case F3:
+ return KeyEvent.VK_F3;
+ case F4:
+ return KeyEvent.VK_F4;
+ case F5:
+ return KeyEvent.VK_F5;
+ case F6:
+ return KeyEvent.VK_F6;
+ case F7:
+ return KeyEvent.VK_F7;
+ case F8:
+ return KeyEvent.VK_F8;
+ case F9:
+ return KeyEvent.VK_F9;
+ case F10:
+ return KeyEvent.VK_F10;
+ case F11:
+ return KeyEvent.VK_F11;
+ case F12:
+ return KeyEvent.VK_F12;
+ case Home:
+ return KeyEvent.VK_HOME;
+ case End:
+ return KeyEvent.VK_END;
+ case PageUp:
+ return KeyEvent.VK_PAGE_UP;
+ case PageDown:
+ return KeyEvent.VK_PAGE_DOWN;
+ case NumPad0:
+ return KeyEvent.VK_NUMPAD0;
+ case NumPad1:
+ return KeyEvent.VK_NUMPAD1;
+ case NumPad2:
+ return KeyEvent.VK_NUMPAD2;
+ case NumPad3:
+ return KeyEvent.VK_NUMPAD3;
+ case NumPad4:
+ return KeyEvent.VK_NUMPAD4;
+ case NumPad5:
+ return KeyEvent.VK_NUMPAD5;
+ case NumPad6:
+ return KeyEvent.VK_NUMPAD6;
+ case NumPad7:
+ return KeyEvent.VK_NUMPAD7;
+ case NumPad8:
+ return KeyEvent.VK_NUMPAD8;
+ case NumPadMultiply:
+ return KeyEvent.VK_MULTIPLY;
+ case NumPadDivide:
+ return KeyEvent.VK_DIVIDE;
+ case NumPadAdd:
+ return KeyEvent.VK_ADD;
+ case NumPadSubtract:
+ return KeyEvent.VK_SUBTRACT;
+ case NumPadDecimal:
+ return KeyEvent.VK_DECIMAL;
+ case NumPadSeparator:
+ return KeyEvent.VK_SEPARATOR;
+ default:
+ throw new IllegalArgumentException("Unknown keyboard key: " + key);
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/runner/ScoutClientJobWrapperStatement.java b/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/runner/ScoutClientJobWrapperStatement.java
index 5cb4fe0159..2a32726cfa 100644
--- a/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/runner/ScoutClientJobWrapperStatement.java
+++ b/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/runner/ScoutClientJobWrapperStatement.java
@@ -1,69 +1,69 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.testing.client.runner;
-
-import java.util.List;
-
-import org.eclipse.scout.rt.client.ClientJob;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.testing.shared.Activator;
-import org.eclipse.scout.rt.testing.shared.ScoutAssert;
-import org.eclipse.scout.rt.testing.shared.TestingUtility;
-import org.eclipse.scout.rt.testing.shared.services.common.exceptionhandler.WrappingProcessingRuntimeExceptionHandlerService;
-import org.junit.runners.model.Statement;
-import org.osgi.framework.ServiceRegistration;
-
-/**
- * JUnit statements that runs the JUnit test within a Scout client session.
- */
-public class ScoutClientJobWrapperStatement extends Statement {
-
- private final IClientSession m_clientSession;
- private final Statement m_statement;
-
- public ScoutClientJobWrapperStatement(IClientSession clientSession, Statement statement) {
- m_clientSession = clientSession;
- m_statement = statement;
- }
-
- @Override
- public void evaluate() throws Throwable {
- if (ClientJob.getCurrentSession() != null) {
- doEvaluate();
- }
- else {
- ClientSyncJob job = new ClientSyncJob("JUnit Client Job Runner", m_clientSession) {
- @Override
- protected void runVoid(org.eclipse.core.runtime.IProgressMonitor monitor) throws Throwable {
- doEvaluate();
- }
- };
- job.schedule();
- job.join();
- ScoutAssert.jobSuccessfullyCompleted(job);
- }
- }
-
- private void doEvaluate() throws Throwable {
- List<ServiceRegistration> serviceReg = null;
- try {
- WrappingProcessingRuntimeExceptionHandlerService handler = new WrappingProcessingRuntimeExceptionHandlerService();
- serviceReg = TestingUtility.registerServices(Activator.getDefault().getBundle(), 1000, handler);
- m_statement.evaluate();
- }
- finally {
- if (serviceReg != null) {
- TestingUtility.unregisterServices(serviceReg);
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.testing.client.runner;
+
+import java.util.List;
+
+import org.eclipse.scout.rt.client.ClientJob;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.testing.shared.Activator;
+import org.eclipse.scout.rt.testing.shared.ScoutAssert;
+import org.eclipse.scout.rt.testing.shared.TestingUtility;
+import org.eclipse.scout.rt.testing.shared.services.common.exceptionhandler.WrappingProcessingRuntimeExceptionHandlerService;
+import org.junit.runners.model.Statement;
+import org.osgi.framework.ServiceRegistration;
+
+/**
+ * JUnit statements that runs the JUnit test within a Scout client session.
+ */
+public class ScoutClientJobWrapperStatement extends Statement {
+
+ private final IClientSession m_clientSession;
+ private final Statement m_statement;
+
+ public ScoutClientJobWrapperStatement(IClientSession clientSession, Statement statement) {
+ m_clientSession = clientSession;
+ m_statement = statement;
+ }
+
+ @Override
+ public void evaluate() throws Throwable {
+ if (ClientJob.getCurrentSession() != null) {
+ doEvaluate();
+ }
+ else {
+ ClientSyncJob job = new ClientSyncJob("JUnit Client Job Runner", m_clientSession) {
+ @Override
+ protected void runVoid(org.eclipse.core.runtime.IProgressMonitor monitor) throws Throwable {
+ doEvaluate();
+ }
+ };
+ job.schedule();
+ job.join();
+ ScoutAssert.jobSuccessfullyCompleted(job);
+ }
+ }
+
+ private void doEvaluate() throws Throwable {
+ List<ServiceRegistration> serviceReg = null;
+ try {
+ WrappingProcessingRuntimeExceptionHandlerService handler = new WrappingProcessingRuntimeExceptionHandlerService();
+ serviceReg = TestingUtility.registerServices(Activator.getDefault().getBundle(), 1000, handler);
+ m_statement.evaluate();
+ }
+ finally {
+ if (serviceReg != null) {
+ TestingUtility.unregisterServices(serviceReg);
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/runner/ScoutClientTestRunner.java b/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/runner/ScoutClientTestRunner.java
index bc04a50bbb..22c440cb2c 100644
--- a/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/runner/ScoutClientTestRunner.java
+++ b/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/runner/ScoutClientTestRunner.java
@@ -1,241 +1,241 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.testing.client.runner;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.testing.shared.services.common.exceptionhandler.ProcessingRuntimeExceptionUnwrappingStatement;
-import org.eclipse.scout.testing.client.DefaultTestClientSessionProvider;
-import org.eclipse.scout.testing.client.ITestClientSessionProvider;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.runners.BlockJUnit4ClassRunner;
-import org.junit.runners.model.FrameworkMethod;
-import org.junit.runners.model.InitializationError;
-import org.junit.runners.model.Statement;
-
-/**
- * JUnit test runner that runs the annotated test class within a Scout client job. Test cases executed by this runner
- * may be configured with a {@link ClientTest} annotation.
- */
-public class ScoutClientTestRunner extends BlockJUnit4ClassRunner {
-
- private static ITestClientSessionProvider s_defaultClientSessionProvider = new DefaultTestClientSessionProvider();
- private static Class<? extends IClientSession> s_defaultClientSessionClass;
-
- private final IClientSession m_clientSession;
-
- @Retention(RetentionPolicy.RUNTIME)
- @Target({ElementType.TYPE, ElementType.METHOD})
- public @interface ClientTest {
-
- public Class<? extends IClientSession> clientSessionClass() default IClientSession.class;
-
- public Class<? extends ITestClientSessionProvider> sessionProvider() default NullTestClientSessionProvider.class;
-
- public String runAs() default "";
-
- public boolean forceNewSession() default false;
- }
-
- /**
- * Null-provider used as default value in the {@link ClientTest} annotation (since annotation values must not be
- * <code>null</code>).
- */
- public static interface NullTestClientSessionProvider extends ITestClientSessionProvider {
- }
-
- /**
- * @param klass
- * @throws InitializationError
- */
- public ScoutClientTestRunner(Class<?> klass) throws InitializationError {
- super(klass);
- try {
- m_clientSession = getOrCreateClientSession(klass.getAnnotation(ClientTest.class), null);
- }
- catch (InitializationError e) {
- throw e;
- }
- catch (Exception e) {
- List<Throwable> errors = new ArrayList<Throwable>();
- errors.add(e);
- throw new InitializationError(errors);
- }
- }
-
- public static ITestClientSessionProvider getDefaultClientSessionProvider() {
- return s_defaultClientSessionProvider;
- }
-
- public static void setDefaultClientSessionProvider(ITestClientSessionProvider defaultClientSessionProvider) {
- s_defaultClientSessionProvider = defaultClientSessionProvider;
- }
-
- public static Class<? extends IClientSession> getDefaultClientSessionClass() {
- return s_defaultClientSessionClass;
- }
-
- public static void setDefaultClientSessionClass(Class<? extends IClientSession> defaultClientSessionClass) {
- s_defaultClientSessionClass = defaultClientSessionClass;
- }
-
- /**
- * @return Returns the default client session class used by this test runner. Defaults to
- * {@link #getDefaultClientSessionClass()}. Subclasses may override this method to provide another default
- * value.
- */
- protected Class<? extends IClientSession> defaultClientSessionClass() {
- return getDefaultClientSessionClass();
- }
-
- /**
- * @return Returns the default client session provider used by this test runner. Defaults to
- * {@link #getDefaultClientSessionProvider()}. Subclasses may override this method to provide another default
- * value.
- */
- protected ITestClientSessionProvider defaultClientSessionProvider() {
- return getDefaultClientSessionProvider();
- }
-
- @Override
- protected Statement withBeforeClasses(Statement statement) {
- // run all methods annotated with @BeforeClass in a separate ServerSession
- List<FrameworkMethod> befores = getTestClass().getAnnotatedMethods(BeforeClass.class);
- return befores.isEmpty() ? statement : new RunBeforesInSeparateScoutClientSession(m_clientSession, statement, befores, null);
- }
-
- @Override
- protected Statement withAfterClasses(Statement statement) {
- // run all methods annotated with @AfterClass in a separate ServerSession
- List<FrameworkMethod> afters = getTestClass().getAnnotatedMethods(AfterClass.class);
- return afters.isEmpty() ? statement : new RunAftersInSeparateScoutClientSession(m_clientSession, statement, afters, null);
- }
-
- @Override
- protected Statement methodBlock(FrameworkMethod method) {
- IClientSession clientSession = m_clientSession;
- ClientTest methodLevelClientTest = method.getAnnotation(ClientTest.class);
- if (methodLevelClientTest != null) {
- try {
- ClientTest classLevelClientTest = getTestClass().getJavaClass().getAnnotation(ClientTest.class);
- clientSession = getOrCreateClientSession(classLevelClientTest, methodLevelClientTest);
- }
- catch (final Throwable e) {
- return new Statement() {
- @Override
- public void evaluate() throws Throwable {
- throw e;
- }
- };
- }
- }
- // run each test method in a separate ClientSession
- return new ScoutClientJobWrapperStatement(clientSession, super.methodBlock(method));
- }
-
- @Override
- @SuppressWarnings("deprecation")
- protected Statement possiblyExpectingExceptions(FrameworkMethod method, Object test, Statement next) {
- // unpack wrapped ProcessingExceptions and rethrow them
- return super.possiblyExpectingExceptions(method, test, new ProcessingRuntimeExceptionUnwrappingStatement(next));
- }
-
- protected IClientSession getOrCreateClientSession(ClientTest classLevelClientTest, ClientTest methodLevelClientTest) throws Exception {
- // process default values
- Class<? extends IClientSession> clientSessionClass = defaultClientSessionClass();
- ITestClientSessionProvider sessionProvider = defaultClientSessionProvider();
- String runAs = null;
- boolean forceNewSession = false;
-
- // process class-level client test configuration
- if (classLevelClientTest != null) {
- clientSessionClass = extractClientSessionClass(classLevelClientTest, clientSessionClass);
- sessionProvider = extractSessionProvider(classLevelClientTest, sessionProvider);
- runAs = extractRunAs(classLevelClientTest, runAs);
- forceNewSession = extractForceNewSession(classLevelClientTest, forceNewSession);
- }
-
- // process method-level client test configuration
- if (methodLevelClientTest != null) {
- clientSessionClass = extractClientSessionClass(methodLevelClientTest, clientSessionClass);
- sessionProvider = extractSessionProvider(methodLevelClientTest, sessionProvider);
- runAs = extractRunAs(methodLevelClientTest, runAs);
- forceNewSession = extractForceNewSession(methodLevelClientTest, forceNewSession);
- }
-
- // sanity check
- if (clientSessionClass == null) {
- throw new InitializationError("Client session class is not set. Either set the default client session using '"
- + ScoutClientTestRunner.class.getSimpleName()
- + ".setDefaultClientSessionClass' or annotate your test class and/or method with '"
- + ClientTest.class.getSimpleName() + "'");
- }
-
- // return existing or create new client session
- return sessionProvider.getOrCreateClientSession(clientSessionClass, runAs, forceNewSession);
- }
-
- /**
- * @param clientTest
- * @return
- */
- protected Class<? extends IClientSession> extractClientSessionClass(ClientTest clientTest, Class<? extends IClientSession> defaultValue) {
- if (clientTest == null || clientTest.clientSessionClass() == null || clientTest.clientSessionClass() == IClientSession.class) {
- return defaultValue;
- }
- return clientTest.clientSessionClass();
- }
-
- /**
- * @param clientTest
- * @return
- */
- protected ITestClientSessionProvider extractSessionProvider(ClientTest clientTest, ITestClientSessionProvider defaultValue) throws Exception {
- if (clientTest == null || clientTest.sessionProvider() == null || clientTest.sessionProvider() == NullTestClientSessionProvider.class) {
- return defaultValue;
- }
- return clientTest.sessionProvider().newInstance();
- }
-
- /**
- * @param clientTest
- * @return
- */
- protected String extractRunAs(ClientTest clientTest, String defaultValue) {
- String runAs = defaultValue;
- if (clientTest != null && clientTest.runAs() != null) {
- String s = clientTest.runAs().trim();
- if (s.length() > 0) {
- runAs = s;
- }
- }
- return runAs;
- }
-
- /**
- * @param clientTest
- * @return
- */
- protected boolean extractForceNewSession(ClientTest clientTest, boolean defaultValue) {
- boolean forceCreateNewSession = defaultValue;
- if (clientTest != null) {
- forceCreateNewSession = clientTest.forceNewSession();
- }
- return forceCreateNewSession;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.testing.client.runner;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.testing.shared.services.common.exceptionhandler.ProcessingRuntimeExceptionUnwrappingStatement;
+import org.eclipse.scout.testing.client.DefaultTestClientSessionProvider;
+import org.eclipse.scout.testing.client.ITestClientSessionProvider;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.runners.BlockJUnit4ClassRunner;
+import org.junit.runners.model.FrameworkMethod;
+import org.junit.runners.model.InitializationError;
+import org.junit.runners.model.Statement;
+
+/**
+ * JUnit test runner that runs the annotated test class within a Scout client job. Test cases executed by this runner
+ * may be configured with a {@link ClientTest} annotation.
+ */
+public class ScoutClientTestRunner extends BlockJUnit4ClassRunner {
+
+ private static ITestClientSessionProvider s_defaultClientSessionProvider = new DefaultTestClientSessionProvider();
+ private static Class<? extends IClientSession> s_defaultClientSessionClass;
+
+ private final IClientSession m_clientSession;
+
+ @Retention(RetentionPolicy.RUNTIME)
+ @Target({ElementType.TYPE, ElementType.METHOD})
+ public @interface ClientTest {
+
+ public Class<? extends IClientSession> clientSessionClass() default IClientSession.class;
+
+ public Class<? extends ITestClientSessionProvider> sessionProvider() default NullTestClientSessionProvider.class;
+
+ public String runAs() default "";
+
+ public boolean forceNewSession() default false;
+ }
+
+ /**
+ * Null-provider used as default value in the {@link ClientTest} annotation (since annotation values must not be
+ * <code>null</code>).
+ */
+ public static interface NullTestClientSessionProvider extends ITestClientSessionProvider {
+ }
+
+ /**
+ * @param klass
+ * @throws InitializationError
+ */
+ public ScoutClientTestRunner(Class<?> klass) throws InitializationError {
+ super(klass);
+ try {
+ m_clientSession = getOrCreateClientSession(klass.getAnnotation(ClientTest.class), null);
+ }
+ catch (InitializationError e) {
+ throw e;
+ }
+ catch (Exception e) {
+ List<Throwable> errors = new ArrayList<Throwable>();
+ errors.add(e);
+ throw new InitializationError(errors);
+ }
+ }
+
+ public static ITestClientSessionProvider getDefaultClientSessionProvider() {
+ return s_defaultClientSessionProvider;
+ }
+
+ public static void setDefaultClientSessionProvider(ITestClientSessionProvider defaultClientSessionProvider) {
+ s_defaultClientSessionProvider = defaultClientSessionProvider;
+ }
+
+ public static Class<? extends IClientSession> getDefaultClientSessionClass() {
+ return s_defaultClientSessionClass;
+ }
+
+ public static void setDefaultClientSessionClass(Class<? extends IClientSession> defaultClientSessionClass) {
+ s_defaultClientSessionClass = defaultClientSessionClass;
+ }
+
+ /**
+ * @return Returns the default client session class used by this test runner. Defaults to
+ * {@link #getDefaultClientSessionClass()}. Subclasses may override this method to provide another default
+ * value.
+ */
+ protected Class<? extends IClientSession> defaultClientSessionClass() {
+ return getDefaultClientSessionClass();
+ }
+
+ /**
+ * @return Returns the default client session provider used by this test runner. Defaults to
+ * {@link #getDefaultClientSessionProvider()}. Subclasses may override this method to provide another default
+ * value.
+ */
+ protected ITestClientSessionProvider defaultClientSessionProvider() {
+ return getDefaultClientSessionProvider();
+ }
+
+ @Override
+ protected Statement withBeforeClasses(Statement statement) {
+ // run all methods annotated with @BeforeClass in a separate ServerSession
+ List<FrameworkMethod> befores = getTestClass().getAnnotatedMethods(BeforeClass.class);
+ return befores.isEmpty() ? statement : new RunBeforesInSeparateScoutClientSession(m_clientSession, statement, befores, null);
+ }
+
+ @Override
+ protected Statement withAfterClasses(Statement statement) {
+ // run all methods annotated with @AfterClass in a separate ServerSession
+ List<FrameworkMethod> afters = getTestClass().getAnnotatedMethods(AfterClass.class);
+ return afters.isEmpty() ? statement : new RunAftersInSeparateScoutClientSession(m_clientSession, statement, afters, null);
+ }
+
+ @Override
+ protected Statement methodBlock(FrameworkMethod method) {
+ IClientSession clientSession = m_clientSession;
+ ClientTest methodLevelClientTest = method.getAnnotation(ClientTest.class);
+ if (methodLevelClientTest != null) {
+ try {
+ ClientTest classLevelClientTest = getTestClass().getJavaClass().getAnnotation(ClientTest.class);
+ clientSession = getOrCreateClientSession(classLevelClientTest, methodLevelClientTest);
+ }
+ catch (final Throwable e) {
+ return new Statement() {
+ @Override
+ public void evaluate() throws Throwable {
+ throw e;
+ }
+ };
+ }
+ }
+ // run each test method in a separate ClientSession
+ return new ScoutClientJobWrapperStatement(clientSession, super.methodBlock(method));
+ }
+
+ @Override
+ @SuppressWarnings("deprecation")
+ protected Statement possiblyExpectingExceptions(FrameworkMethod method, Object test, Statement next) {
+ // unpack wrapped ProcessingExceptions and rethrow them
+ return super.possiblyExpectingExceptions(method, test, new ProcessingRuntimeExceptionUnwrappingStatement(next));
+ }
+
+ protected IClientSession getOrCreateClientSession(ClientTest classLevelClientTest, ClientTest methodLevelClientTest) throws Exception {
+ // process default values
+ Class<? extends IClientSession> clientSessionClass = defaultClientSessionClass();
+ ITestClientSessionProvider sessionProvider = defaultClientSessionProvider();
+ String runAs = null;
+ boolean forceNewSession = false;
+
+ // process class-level client test configuration
+ if (classLevelClientTest != null) {
+ clientSessionClass = extractClientSessionClass(classLevelClientTest, clientSessionClass);
+ sessionProvider = extractSessionProvider(classLevelClientTest, sessionProvider);
+ runAs = extractRunAs(classLevelClientTest, runAs);
+ forceNewSession = extractForceNewSession(classLevelClientTest, forceNewSession);
+ }
+
+ // process method-level client test configuration
+ if (methodLevelClientTest != null) {
+ clientSessionClass = extractClientSessionClass(methodLevelClientTest, clientSessionClass);
+ sessionProvider = extractSessionProvider(methodLevelClientTest, sessionProvider);
+ runAs = extractRunAs(methodLevelClientTest, runAs);
+ forceNewSession = extractForceNewSession(methodLevelClientTest, forceNewSession);
+ }
+
+ // sanity check
+ if (clientSessionClass == null) {
+ throw new InitializationError("Client session class is not set. Either set the default client session using '"
+ + ScoutClientTestRunner.class.getSimpleName()
+ + ".setDefaultClientSessionClass' or annotate your test class and/or method with '"
+ + ClientTest.class.getSimpleName() + "'");
+ }
+
+ // return existing or create new client session
+ return sessionProvider.getOrCreateClientSession(clientSessionClass, runAs, forceNewSession);
+ }
+
+ /**
+ * @param clientTest
+ * @return
+ */
+ protected Class<? extends IClientSession> extractClientSessionClass(ClientTest clientTest, Class<? extends IClientSession> defaultValue) {
+ if (clientTest == null || clientTest.clientSessionClass() == null || clientTest.clientSessionClass() == IClientSession.class) {
+ return defaultValue;
+ }
+ return clientTest.clientSessionClass();
+ }
+
+ /**
+ * @param clientTest
+ * @return
+ */
+ protected ITestClientSessionProvider extractSessionProvider(ClientTest clientTest, ITestClientSessionProvider defaultValue) throws Exception {
+ if (clientTest == null || clientTest.sessionProvider() == null || clientTest.sessionProvider() == NullTestClientSessionProvider.class) {
+ return defaultValue;
+ }
+ return clientTest.sessionProvider().newInstance();
+ }
+
+ /**
+ * @param clientTest
+ * @return
+ */
+ protected String extractRunAs(ClientTest clientTest, String defaultValue) {
+ String runAs = defaultValue;
+ if (clientTest != null && clientTest.runAs() != null) {
+ String s = clientTest.runAs().trim();
+ if (s.length() > 0) {
+ runAs = s;
+ }
+ }
+ return runAs;
+ }
+
+ /**
+ * @param clientTest
+ * @return
+ */
+ protected boolean extractForceNewSession(ClientTest clientTest, boolean defaultValue) {
+ boolean forceCreateNewSession = defaultValue;
+ if (clientTest != null) {
+ forceCreateNewSession = clientTest.forceNewSession();
+ }
+ return forceCreateNewSession;
+ }
+}
diff --git a/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/servicetunnel/http/MultiClientAuthenticator.java b/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/servicetunnel/http/MultiClientAuthenticator.java
index 0e01bb5338..f738f2f12f 100644
--- a/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/servicetunnel/http/MultiClientAuthenticator.java
+++ b/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/servicetunnel/http/MultiClientAuthenticator.java
@@ -1,86 +1,86 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.testing.client.servicetunnel.http;
-
-import java.net.Authenticator;
-import java.net.PasswordAuthentication;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.WeakHashMap;
-
-import org.eclipse.scout.rt.client.ClientJob;
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.client.IClientSessionProvider;
-
-/**
- * Authenticator implementation used for testing. It holds a session-to-user and a user-to-password mapping. This class
- * expectes that the HTTP connection to the server is done within a Job implementing {@link IClientSessionProvider}.
- * <p>
- * <b>Note</b>: the authenticator must be set as default authenticator:
- *
- * <pre>
- * Authenticator.setDefault(new MultiClientAuthenticator());
- * // set user-to-password mapping
- * MultiClientAuthenticator.addUser(&quot;alice&quot;, &quot;alice&quot;);
- * MultiClientAuthenticator.addUser(&quot;bob&quot;, &quot;bob&quot;);
- * // default user if no client session mapping is available
- * MultiClientAuthenticator.setDefaultUser(&quot;alice&quot;);
- * </pre>
- */
-public class MultiClientAuthenticator extends Authenticator {
-
- private static final Map<String, String> USER_PASSWORDS = new HashMap<String, String>();
- private static final Map<IClientSession, String> LOGIN_INFOS = new WeakHashMap<IClientSession, String>();
- private static String s_defaultUser;
-
- /**
- * Sets the default user if there is no session-to-user mapping available for the current session.
- *
- * @param username
- */
- public static void setDefaultUser(String username) {
- s_defaultUser = username;
- }
-
- /**
- * Adds a user along with its password.
- *
- * @param username
- * @param password
- */
- public static void addUser(String username, String password) {
- USER_PASSWORDS.put(username, password);
- }
-
- /**
- * Assigns the given session with a user.
- *
- * @param clientSession
- * @param username
- */
- public static void assignSessionToUser(IClientSession clientSession, String username) {
- LOGIN_INFOS.put(clientSession, username);
- }
-
- @Override
- protected PasswordAuthentication getPasswordAuthentication() {
- IClientSession currentSession = ClientJob.getCurrentSession();
- String user = LOGIN_INFOS.get(currentSession);
- if (user == null) {
- user = s_defaultUser;
- }
- if (user == null) {
- return null;
- }
- String password = USER_PASSWORDS.get(user);
- return new PasswordAuthentication(user, password == null ? null : password.toCharArray());
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.testing.client.servicetunnel.http;
+
+import java.net.Authenticator;
+import java.net.PasswordAuthentication;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.WeakHashMap;
+
+import org.eclipse.scout.rt.client.ClientJob;
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.client.IClientSessionProvider;
+
+/**
+ * Authenticator implementation used for testing. It holds a session-to-user and a user-to-password mapping. This class
+ * expectes that the HTTP connection to the server is done within a Job implementing {@link IClientSessionProvider}.
+ * <p>
+ * <b>Note</b>: the authenticator must be set as default authenticator:
+ *
+ * <pre>
+ * Authenticator.setDefault(new MultiClientAuthenticator());
+ * // set user-to-password mapping
+ * MultiClientAuthenticator.addUser(&quot;alice&quot;, &quot;alice&quot;);
+ * MultiClientAuthenticator.addUser(&quot;bob&quot;, &quot;bob&quot;);
+ * // default user if no client session mapping is available
+ * MultiClientAuthenticator.setDefaultUser(&quot;alice&quot;);
+ * </pre>
+ */
+public class MultiClientAuthenticator extends Authenticator {
+
+ private static final Map<String, String> USER_PASSWORDS = new HashMap<String, String>();
+ private static final Map<IClientSession, String> LOGIN_INFOS = new WeakHashMap<IClientSession, String>();
+ private static String s_defaultUser;
+
+ /**
+ * Sets the default user if there is no session-to-user mapping available for the current session.
+ *
+ * @param username
+ */
+ public static void setDefaultUser(String username) {
+ s_defaultUser = username;
+ }
+
+ /**
+ * Adds a user along with its password.
+ *
+ * @param username
+ * @param password
+ */
+ public static void addUser(String username, String password) {
+ USER_PASSWORDS.put(username, password);
+ }
+
+ /**
+ * Assigns the given session with a user.
+ *
+ * @param clientSession
+ * @param username
+ */
+ public static void assignSessionToUser(IClientSession clientSession, String username) {
+ LOGIN_INFOS.put(clientSession, username);
+ }
+
+ @Override
+ protected PasswordAuthentication getPasswordAuthentication() {
+ IClientSession currentSession = ClientJob.getCurrentSession();
+ String user = LOGIN_INFOS.get(currentSession);
+ if (user == null) {
+ user = s_defaultUser;
+ }
+ if (user == null) {
+ return null;
+ }
+ String password = USER_PASSWORDS.get(user);
+ return new PasswordAuthentication(user, password == null ? null : password.toCharArray());
+ }
+}
diff --git a/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/servicetunnel/http/MultiClientSessionCookieStore.java b/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/servicetunnel/http/MultiClientSessionCookieStore.java
index 285e0da55e..c8d07ba6f4 100644
--- a/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/servicetunnel/http/MultiClientSessionCookieStore.java
+++ b/org.eclipse.scout.rt.testing.client/src/org/eclipse/scout/testing/client/servicetunnel/http/MultiClientSessionCookieStore.java
@@ -1,79 +1,79 @@
-package org.eclipse.scout.testing.client.servicetunnel.http;
-
-import java.net.CookieManager;
-import java.net.CookieStore;
-import java.net.HttpCookie;
-import java.net.URI;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.scout.rt.client.ClientJob;
-import org.eclipse.scout.rt.client.IClientSession;
-
-/**
- * HTTP cookie store implementation that distinguishes between different {@link IClientSession} connecting concurrently
- * to the same backend (i.e. same URL).
- */
-public class MultiClientSessionCookieStore implements CookieStore {
-
- private final Object m_cookieStoreLock = new Object();
- private final Map<IClientSession, CookieStore> m_cookieStores;
- private final CookieStore m_defaultCookieStore;
-
- public MultiClientSessionCookieStore() {
- m_cookieStores = new HashMap<IClientSession, CookieStore>();
- m_defaultCookieStore = new CookieManager().getCookieStore();
- }
-
- @Override
- public void add(URI uri, HttpCookie cookie) {
- getDelegate().add(uri, cookie);
- }
-
- @Override
- public List<HttpCookie> get(URI uri) {
- return getDelegate().get(uri);
- }
-
- @Override
- public List<HttpCookie> getCookies() {
- return getDelegate().getCookies();
- }
-
- @Override
- public List<URI> getURIs() {
- return getDelegate().getURIs();
- }
-
- @Override
- public boolean remove(URI uri, HttpCookie cookie) {
- return getDelegate().remove(uri, cookie);
- }
-
- @Override
- public boolean removeAll() {
- return getDelegate().removeAll();
- }
-
- private CookieStore getDelegate() {
- IClientSession currentSession = ClientJob.getCurrentSession();
- if (currentSession == null) {
- return m_defaultCookieStore;
- }
- synchronized (m_cookieStoreLock) {
- CookieStore cookieStore = m_cookieStores.get(currentSession);
- if (cookieStore == null) {
- cookieStore = new CookieManager().getCookieStore();
- m_cookieStores.put(currentSession, cookieStore);
- }
- return cookieStore;
- }
- }
-
- public void sessionStopped(IClientSession clientSession) {
- synchronized (m_cookieStoreLock) {
- m_cookieStores.remove(clientSession);
- }
- }
-}
+package org.eclipse.scout.testing.client.servicetunnel.http;
+
+import java.net.CookieManager;
+import java.net.CookieStore;
+import java.net.HttpCookie;
+import java.net.URI;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.scout.rt.client.ClientJob;
+import org.eclipse.scout.rt.client.IClientSession;
+
+/**
+ * HTTP cookie store implementation that distinguishes between different {@link IClientSession} connecting concurrently
+ * to the same backend (i.e. same URL).
+ */
+public class MultiClientSessionCookieStore implements CookieStore {
+
+ private final Object m_cookieStoreLock = new Object();
+ private final Map<IClientSession, CookieStore> m_cookieStores;
+ private final CookieStore m_defaultCookieStore;
+
+ public MultiClientSessionCookieStore() {
+ m_cookieStores = new HashMap<IClientSession, CookieStore>();
+ m_defaultCookieStore = new CookieManager().getCookieStore();
+ }
+
+ @Override
+ public void add(URI uri, HttpCookie cookie) {
+ getDelegate().add(uri, cookie);
+ }
+
+ @Override
+ public List<HttpCookie> get(URI uri) {
+ return getDelegate().get(uri);
+ }
+
+ @Override
+ public List<HttpCookie> getCookies() {
+ return getDelegate().getCookies();
+ }
+
+ @Override
+ public List<URI> getURIs() {
+ return getDelegate().getURIs();
+ }
+
+ @Override
+ public boolean remove(URI uri, HttpCookie cookie) {
+ return getDelegate().remove(uri, cookie);
+ }
+
+ @Override
+ public boolean removeAll() {
+ return getDelegate().removeAll();
+ }
+
+ private CookieStore getDelegate() {
+ IClientSession currentSession = ClientJob.getCurrentSession();
+ if (currentSession == null) {
+ return m_defaultCookieStore;
+ }
+ synchronized (m_cookieStoreLock) {
+ CookieStore cookieStore = m_cookieStores.get(currentSession);
+ if (cookieStore == null) {
+ cookieStore = new CookieManager().getCookieStore();
+ m_cookieStores.put(currentSession, cookieStore);
+ }
+ return cookieStore;
+ }
+ }
+
+ public void sessionStopped(IClientSession clientSession) {
+ synchronized (m_cookieStoreLock) {
+ m_cookieStores.remove(clientSession);
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.testing.server/.settings/org.eclipse.pde.core.prefs b/org.eclipse.scout.rt.testing.server/.settings/org.eclipse.pde.core.prefs
index baef13dd8c..a3a50fc8da 100644
--- a/org.eclipse.scout.rt.testing.server/.settings/org.eclipse.pde.core.prefs
+++ b/org.eclipse.scout.rt.testing.server/.settings/org.eclipse.pde.core.prefs
@@ -1,3 +1,3 @@
-#Mon Jul 11 16:16:00 CEST 2011
-eclipse.preferences.version=1
-pluginProject.extensions=true
+#Mon Jul 11 16:16:00 CEST 2011
+eclipse.preferences.version=1
+pluginProject.extensions=true
diff --git a/org.eclipse.scout.rt.testing.server/Release Notes.txt b/org.eclipse.scout.rt.testing.server/Release Notes.txt
index cf3f06bc72..77e9457be1 100644
--- a/org.eclipse.scout.rt.testing.server/Release Notes.txt
+++ b/org.eclipse.scout.rt.testing.server/Release Notes.txt
@@ -1,22 +1,22 @@
-09.08.2011
-Bugzilla ticket: 350389, improve Scout RT testing support
-BSI ticket: 103'068
-Replaced ServerSessionClass and PrincipalName annotations by a more powerful ServerTest annotation that has the following features:
-o annotation can be applied on class-level as well as on a test case level (method).
-o @BeforeClass and @AfterClass methods are executed in the same session defined on class-level
-o @Before, @Test and @After are executed per test method in the same session defined on class-level
- or in a separate session if the @Test method is also annotated with @ServerTest
-o Tests can be executed as different users. Controlled by @ServerTest(runAs = "principal")
-o The IServerSession class can be provided by the @ServerTest(serverSessionClass = MyServerSession.class) annotation
- or by setting the default value ScoutServerTestRunner.setDefaultServerSessionClass(MyServerSession.class). The value
- provided by the @ServerTest annotation is used if both are provided.
-o An existing or new IServerSession is provided by an implementation of IServerSessionProvider. The default provider is
- DefaultTestServerSessionProvider and is set on ScoutServerTestRunner.setDefaultServerSessionProvider(). It can be
- overridden using the @ServerTest(serverSessionProvider = MyServerSessionProvider.class) annotation.
-
-Migration:
-o remove all @ServerSessionClass annotations
-o remove all @PrincipalName annotations
-o set the project's server session class in the server test application
- ScoutServerTestRunner.setDefaultServerSessionClass(ServerSession.class);
- ScoutServerTestRunner.setDefaultPrincipalName("defaultPrincipal");
+09.08.2011
+Bugzilla ticket: 350389, improve Scout RT testing support
+BSI ticket: 103'068
+Replaced ServerSessionClass and PrincipalName annotations by a more powerful ServerTest annotation that has the following features:
+o annotation can be applied on class-level as well as on a test case level (method).
+o @BeforeClass and @AfterClass methods are executed in the same session defined on class-level
+o @Before, @Test and @After are executed per test method in the same session defined on class-level
+ or in a separate session if the @Test method is also annotated with @ServerTest
+o Tests can be executed as different users. Controlled by @ServerTest(runAs = "principal")
+o The IServerSession class can be provided by the @ServerTest(serverSessionClass = MyServerSession.class) annotation
+ or by setting the default value ScoutServerTestRunner.setDefaultServerSessionClass(MyServerSession.class). The value
+ provided by the @ServerTest annotation is used if both are provided.
+o An existing or new IServerSession is provided by an implementation of IServerSessionProvider. The default provider is
+ DefaultTestServerSessionProvider and is set on ScoutServerTestRunner.setDefaultServerSessionProvider(). It can be
+ overridden using the @ServerTest(serverSessionProvider = MyServerSessionProvider.class) annotation.
+
+Migration:
+o remove all @ServerSessionClass annotations
+o remove all @PrincipalName annotations
+o set the project's server session class in the server test application
+ ScoutServerTestRunner.setDefaultServerSessionClass(ServerSession.class);
+ ScoutServerTestRunner.setDefaultPrincipalName("defaultPrincipal");
diff --git a/org.eclipse.scout.rt.testing.server/src/org/eclipse/scout/rt/testing/server/Activator.java b/org.eclipse.scout.rt.testing.server/src/org/eclipse/scout/rt/testing/server/Activator.java
index 54599c714a..03d5830941 100644
--- a/org.eclipse.scout.rt.testing.server/src/org/eclipse/scout/rt/testing/server/Activator.java
+++ b/org.eclipse.scout.rt.testing.server/src/org/eclipse/scout/rt/testing/server/Activator.java
@@ -1,62 +1,62 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.testing.server;
-
-import org.eclipse.core.runtime.Plugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends Plugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.scout.rt.testing.server";
-
- // The shared instance
- private static Activator plugin;
-
- /**
- * The constructor
- */
- public Activator() {
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
- */
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.testing.server;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.scout.rt.testing.server";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.testing.server/src/org/eclipse/scout/rt/testing/server/DefaultTestServerSessionProvider.java b/org.eclipse.scout.rt.testing.server/src/org/eclipse/scout/rt/testing/server/DefaultTestServerSessionProvider.java
index badc80fd6c..885d693def 100644
--- a/org.eclipse.scout.rt.testing.server/src/org/eclipse/scout/rt/testing/server/DefaultTestServerSessionProvider.java
+++ b/org.eclipse.scout.rt.testing.server/src/org/eclipse/scout/rt/testing/server/DefaultTestServerSessionProvider.java
@@ -1,80 +1,80 @@
-package org.eclipse.scout.rt.testing.server;
-
-import javax.security.auth.Subject;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.commons.security.SimplePrincipal;
-import org.eclipse.scout.rt.server.IServerSession;
-import org.eclipse.scout.rt.server.ServerJob;
-import org.eclipse.scout.rt.server.ThreadContext;
-import org.eclipse.scout.rt.shared.ui.UserAgent;
-import org.osgi.framework.Bundle;
-
-/**
- * Default implementation of {@link ITestServerSessionProvider}.
- */
-public class DefaultTestServerSessionProvider implements ITestServerSessionProvider {
-
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(DefaultTestServerSessionProvider.class);
-
- @Override
- @SuppressWarnings("unchecked")
- public <T extends IServerSession> T createServerSession(Class<T> clazz, final Subject subject) throws ProcessingException {
- IServerSession serverSession;
- try {
- serverSession = clazz.newInstance();
- }
- catch (Throwable t) {
- throw new ProcessingException("create instance of " + clazz, t);
- }
- serverSession.setUserAgent(UserAgent.createDefault());
- ServerJob initJob = new ServerJob("new " + clazz.getSimpleName(), serverSession, subject) {
- @Override
- protected IStatus runTransaction(IProgressMonitor monitor) throws Exception {
- // load session
- IServerSession serverSessionInside = ThreadContext.getServerSession();
- String symbolicName = serverSessionInside.getClass().getPackage().getName();
- Bundle bundle = Platform.getBundle(symbolicName);
- beforeStartSession(serverSessionInside, subject);
- serverSessionInside.loadSession(bundle);
- afterStartSession(serverSessionInside, subject);
- return Status.OK_STATUS;
- }
- };
- initJob.runNow(new NullProgressMonitor());
- initJob.throwOnError();
- return (T) serverSession;
- }
-
- @Override
- public Subject login(String runAs) {
- Subject subject = new Subject();
- subject.getPrincipals().add(new SimplePrincipal(runAs));
- return subject;
- }
-
- /**
- * Performs custom operations before the server session is started.
- *
- * @param serverSession
- * @param subject
- */
- protected void beforeStartSession(IServerSession serverSession, Subject subject) {
- }
-
- /**
- * Performs custom operations after the server session has been started.
- *
- * @param serverSession
- * @param subject
- */
- protected void afterStartSession(IServerSession serverSession, Subject subject) {
- }
-}
+package org.eclipse.scout.rt.testing.server;
+
+import javax.security.auth.Subject;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.commons.security.SimplePrincipal;
+import org.eclipse.scout.rt.server.IServerSession;
+import org.eclipse.scout.rt.server.ServerJob;
+import org.eclipse.scout.rt.server.ThreadContext;
+import org.eclipse.scout.rt.shared.ui.UserAgent;
+import org.osgi.framework.Bundle;
+
+/**
+ * Default implementation of {@link ITestServerSessionProvider}.
+ */
+public class DefaultTestServerSessionProvider implements ITestServerSessionProvider {
+
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(DefaultTestServerSessionProvider.class);
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public <T extends IServerSession> T createServerSession(Class<T> clazz, final Subject subject) throws ProcessingException {
+ IServerSession serverSession;
+ try {
+ serverSession = clazz.newInstance();
+ }
+ catch (Throwable t) {
+ throw new ProcessingException("create instance of " + clazz, t);
+ }
+ serverSession.setUserAgent(UserAgent.createDefault());
+ ServerJob initJob = new ServerJob("new " + clazz.getSimpleName(), serverSession, subject) {
+ @Override
+ protected IStatus runTransaction(IProgressMonitor monitor) throws Exception {
+ // load session
+ IServerSession serverSessionInside = ThreadContext.getServerSession();
+ String symbolicName = serverSessionInside.getClass().getPackage().getName();
+ Bundle bundle = Platform.getBundle(symbolicName);
+ beforeStartSession(serverSessionInside, subject);
+ serverSessionInside.loadSession(bundle);
+ afterStartSession(serverSessionInside, subject);
+ return Status.OK_STATUS;
+ }
+ };
+ initJob.runNow(new NullProgressMonitor());
+ initJob.throwOnError();
+ return (T) serverSession;
+ }
+
+ @Override
+ public Subject login(String runAs) {
+ Subject subject = new Subject();
+ subject.getPrincipals().add(new SimplePrincipal(runAs));
+ return subject;
+ }
+
+ /**
+ * Performs custom operations before the server session is started.
+ *
+ * @param serverSession
+ * @param subject
+ */
+ protected void beforeStartSession(IServerSession serverSession, Subject subject) {
+ }
+
+ /**
+ * Performs custom operations after the server session has been started.
+ *
+ * @param serverSession
+ * @param subject
+ */
+ protected void afterStartSession(IServerSession serverSession, Subject subject) {
+ }
+}
diff --git a/org.eclipse.scout.rt.testing.server/src/org/eclipse/scout/rt/testing/server/ITestServerSessionProvider.java b/org.eclipse.scout.rt.testing.server/src/org/eclipse/scout/rt/testing/server/ITestServerSessionProvider.java
index c79f7ed127..1e5ee6e2af 100644
--- a/org.eclipse.scout.rt.testing.server/src/org/eclipse/scout/rt/testing/server/ITestServerSessionProvider.java
+++ b/org.eclipse.scout.rt.testing.server/src/org/eclipse/scout/rt/testing/server/ITestServerSessionProvider.java
@@ -1,35 +1,35 @@
-package org.eclipse.scout.rt.testing.server;
-
-import javax.security.auth.Subject;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.server.IServerSession;
-
-/**
- * Provides {@link IServerSession} for Scout tests and allows to create more than one instance of the same
- * session type (e.g. for different users).
- */
-public interface ITestServerSessionProvider {
-
- /**
- * Performs a login for the given user.
- *
- * @param runAs
- * @return
- */
- Subject login(String runAs);
-
- /**
- * Creates a new server session.
- *
- * @param <T>
- * type of the resulting server session.
- * @param clazz
- * requested server session.
- * @param user
- * name of the user the session belongs to or is created for.
- * @return
- * @throws ProcessingException
- */
- <T extends IServerSession> T createServerSession(Class<T> clazz, Subject subject) throws ProcessingException;
-}
+package org.eclipse.scout.rt.testing.server;
+
+import javax.security.auth.Subject;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.server.IServerSession;
+
+/**
+ * Provides {@link IServerSession} for Scout tests and allows to create more than one instance of the same
+ * session type (e.g. for different users).
+ */
+public interface ITestServerSessionProvider {
+
+ /**
+ * Performs a login for the given user.
+ *
+ * @param runAs
+ * @return
+ */
+ Subject login(String runAs);
+
+ /**
+ * Creates a new server session.
+ *
+ * @param <T>
+ * type of the resulting server session.
+ * @param clazz
+ * requested server session.
+ * @param user
+ * name of the user the session belongs to or is created for.
+ * @return
+ * @throws ProcessingException
+ */
+ <T extends IServerSession> T createServerSession(Class<T> clazz, Subject subject) throws ProcessingException;
+}
diff --git a/org.eclipse.scout.rt.testing.server/src/org/eclipse/scout/rt/testing/server/JUnitServerJob.java b/org.eclipse.scout.rt.testing.server/src/org/eclipse/scout/rt/testing/server/JUnitServerJob.java
index fc019dc0ee..c901381edc 100644
--- a/org.eclipse.scout.rt.testing.server/src/org/eclipse/scout/rt/testing/server/JUnitServerJob.java
+++ b/org.eclipse.scout.rt.testing.server/src/org/eclipse/scout/rt/testing/server/JUnitServerJob.java
@@ -1,43 +1,43 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.testing.server;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.scout.rt.testing.shared.ScoutJUnitPluginTestExecutor;
-
-/**
- * Runs all @Test annotated methods in all classes and then exit
- * <p>
- * Normally this is called from within a server application in the start method <code><pre>
- * public Object start(IApplicationContext context) throws Exception {
- * logger.info("server initialized");
- * //
- * new JUnitServerJob().schedule();
- * return EXIT_OK;
- * }
- * </pre></code>
- */
-public class JUnitServerJob extends Job {
- public JUnitServerJob() {
- super("JUnit Server Job");
- }
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- ScoutJUnitPluginTestExecutor scoutJUnitPluginTestExecutor = new ScoutJUnitPluginTestExecutor();
- final int code = scoutJUnitPluginTestExecutor.runAllTests();
- System.exit(code);
- return Status.OK_STATUS;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.testing.server;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.scout.rt.testing.shared.ScoutJUnitPluginTestExecutor;
+
+/**
+ * Runs all @Test annotated methods in all classes and then exit
+ * <p>
+ * Normally this is called from within a server application in the start method <code><pre>
+ * public Object start(IApplicationContext context) throws Exception {
+ * logger.info("server initialized");
+ * //
+ * new JUnitServerJob().schedule();
+ * return EXIT_OK;
+ * }
+ * </pre></code>
+ */
+public class JUnitServerJob extends Job {
+ public JUnitServerJob() {
+ super("JUnit Server Job");
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ ScoutJUnitPluginTestExecutor scoutJUnitPluginTestExecutor = new ScoutJUnitPluginTestExecutor();
+ final int code = scoutJUnitPluginTestExecutor.runAllTests();
+ System.exit(code);
+ return Status.OK_STATUS;
+ }
+}
diff --git a/org.eclipse.scout.rt.testing.server/src/org/eclipse/scout/rt/testing/server/runner/ScoutServerJobWrapperStatement.java b/org.eclipse.scout.rt.testing.server/src/org/eclipse/scout/rt/testing/server/runner/ScoutServerJobWrapperStatement.java
index 3e2abc65ab..9830e8e9fb 100644
--- a/org.eclipse.scout.rt.testing.server/src/org/eclipse/scout/rt/testing/server/runner/ScoutServerJobWrapperStatement.java
+++ b/org.eclipse.scout.rt.testing.server/src/org/eclipse/scout/rt/testing/server/runner/ScoutServerJobWrapperStatement.java
@@ -1,87 +1,87 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.testing.server.runner;
-
-import java.util.List;
-
-import javax.security.auth.Subject;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.scout.rt.server.IServerSession;
-import org.eclipse.scout.rt.server.ServerJob;
-import org.eclipse.scout.rt.testing.shared.Activator;
-import org.eclipse.scout.rt.testing.shared.ScoutAssert;
-import org.eclipse.scout.rt.testing.shared.TestingUtility;
-import org.eclipse.scout.rt.testing.shared.services.common.exceptionhandler.WrappingProcessingRuntimeExceptionHandlerService;
-import org.junit.runners.model.Statement;
-import org.osgi.framework.ServiceRegistration;
-
-/**
- * JUnit statements that runs the JUnit test within a Scout server session.
- */
-public class ScoutServerJobWrapperStatement extends Statement {
-
- private final IServerSession m_serverSession;
- private final Subject m_subject;
- private final Statement m_statement;
-
- public ScoutServerJobWrapperStatement(IServerSession serverSession, Subject subject, Statement statement) {
- m_serverSession = serverSession;
- m_subject = subject;
- m_statement = statement;
- }
-
- @Override
- public void evaluate() throws Throwable {
- if (ServerJob.getCurrentSession() != null) {
- doEvaluate();
- }
- else {
- ServerJob job = new ServerJob("JUnit Server Job Runner", m_serverSession, m_subject) {
- @Override
- protected IStatus runTransaction(IProgressMonitor monitor) throws Exception {
- doEvaluate();
- return Status.OK_STATUS;
- }
- };
- job.schedule();
- job.join();
- ScoutAssert.jobSuccessfullyCompleted(job);
- }
- }
-
- private void doEvaluate() throws Exception {
- List<ServiceRegistration> serviceReg = null;
- try {
- WrappingProcessingRuntimeExceptionHandlerService handler = new WrappingProcessingRuntimeExceptionHandlerService();
- serviceReg = TestingUtility.registerServices(Activator.getDefault().getBundle(), 1000, handler);
- try {
- m_statement.evaluate();
- }
- catch (Exception e) {
- throw e;
- }
- catch (Error e) {
- throw e;
- }
- catch (Throwable e) {
- throw new Exception(e);
- }
- }
- finally {
- if (serviceReg != null) {
- TestingUtility.unregisterServices(serviceReg);
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.testing.server.runner;
+
+import java.util.List;
+
+import javax.security.auth.Subject;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.scout.rt.server.IServerSession;
+import org.eclipse.scout.rt.server.ServerJob;
+import org.eclipse.scout.rt.testing.shared.Activator;
+import org.eclipse.scout.rt.testing.shared.ScoutAssert;
+import org.eclipse.scout.rt.testing.shared.TestingUtility;
+import org.eclipse.scout.rt.testing.shared.services.common.exceptionhandler.WrappingProcessingRuntimeExceptionHandlerService;
+import org.junit.runners.model.Statement;
+import org.osgi.framework.ServiceRegistration;
+
+/**
+ * JUnit statements that runs the JUnit test within a Scout server session.
+ */
+public class ScoutServerJobWrapperStatement extends Statement {
+
+ private final IServerSession m_serverSession;
+ private final Subject m_subject;
+ private final Statement m_statement;
+
+ public ScoutServerJobWrapperStatement(IServerSession serverSession, Subject subject, Statement statement) {
+ m_serverSession = serverSession;
+ m_subject = subject;
+ m_statement = statement;
+ }
+
+ @Override
+ public void evaluate() throws Throwable {
+ if (ServerJob.getCurrentSession() != null) {
+ doEvaluate();
+ }
+ else {
+ ServerJob job = new ServerJob("JUnit Server Job Runner", m_serverSession, m_subject) {
+ @Override
+ protected IStatus runTransaction(IProgressMonitor monitor) throws Exception {
+ doEvaluate();
+ return Status.OK_STATUS;
+ }
+ };
+ job.schedule();
+ job.join();
+ ScoutAssert.jobSuccessfullyCompleted(job);
+ }
+ }
+
+ private void doEvaluate() throws Exception {
+ List<ServiceRegistration> serviceReg = null;
+ try {
+ WrappingProcessingRuntimeExceptionHandlerService handler = new WrappingProcessingRuntimeExceptionHandlerService();
+ serviceReg = TestingUtility.registerServices(Activator.getDefault().getBundle(), 1000, handler);
+ try {
+ m_statement.evaluate();
+ }
+ catch (Exception e) {
+ throw e;
+ }
+ catch (Error e) {
+ throw e;
+ }
+ catch (Throwable e) {
+ throw new Exception(e);
+ }
+ }
+ finally {
+ if (serviceReg != null) {
+ TestingUtility.unregisterServices(serviceReg);
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.testing.server/src/org/eclipse/scout/rt/testing/server/runner/ScoutServerTestRunner.java b/org.eclipse.scout.rt.testing.server/src/org/eclipse/scout/rt/testing/server/runner/ScoutServerTestRunner.java
index 635040433a..7bcdd3af2f 100644
--- a/org.eclipse.scout.rt.testing.server/src/org/eclipse/scout/rt/testing/server/runner/ScoutServerTestRunner.java
+++ b/org.eclipse.scout.rt.testing.server/src/org/eclipse/scout/rt/testing/server/runner/ScoutServerTestRunner.java
@@ -1,297 +1,297 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.testing.server.runner;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.security.auth.Subject;
-
-import org.eclipse.scout.rt.server.IServerSession;
-import org.eclipse.scout.rt.testing.server.DefaultTestServerSessionProvider;
-import org.eclipse.scout.rt.testing.server.ITestServerSessionProvider;
-import org.eclipse.scout.rt.testing.shared.services.common.exceptionhandler.ProcessingRuntimeExceptionUnwrappingStatement;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.runners.BlockJUnit4ClassRunner;
-import org.junit.runners.model.FrameworkMethod;
-import org.junit.runners.model.InitializationError;
-import org.junit.runners.model.Statement;
-
-/**
- * JUnit test runner that runs the annotated test class within a Scout server job. Test cases executed by this runner
- * may be configured with {@link ServerTest} annotation.
- * <p/>
- * <h3>Sessions and Transactions</h3> The different methods of a test class driven by this runner are invoked in
- * different Scout server sessions and therefore in different Scout transactions (because a Scout transaction is
- * attached to one particular Scout session)>
- * <table border="1">
- * <tr>
- * <th>Element</th>
- * <th>Description</th>
- * </tr>
- * <tr>
- * <td><b>@BeforeClass</b></td>
- * <td>all methods annotated with {@link BeforeClass} are invoked in the very same Scout server session. Therefore they
- * share the same Scout transaction.</td>
- * </tr>
- * <tr>
- * <td><b>@Before, @Test, @After</b></td>
- * <td>each test case is invoked in a separate Scout server session and therefore in a separate Scout transaction. A
- * particular test cas consists of the following methods:
- * <ul>
- * <li>all methdos annotated with {@link Before}</li>
- * <li>the test case itself annotated with {@link Test}</li>
- * <li>all methdos annotated with {@link After}</li>
- * </ul>
- * </td>
- * </tr>
- * <tr>
- * <td><b>@AfterClass</b></td>
- * <td>all methods annotated with {@link AfterClass} are invoked in the very same Scout server session. Therefore they
- * share the same Scout transaction.</td>
- * </tr>
- * </table>
- */
-public class ScoutServerTestRunner extends BlockJUnit4ClassRunner {
-
- private static Class<? extends IServerSession> s_defaultServerSessionClass;
- private static String s_defaultPrincipalName;
- private static ITestServerSessionProvider s_defaultServerSessionProvider = new DefaultTestServerSessionProvider();
-
- private LoginInfo m_loginInfo;
-
- @Retention(RetentionPolicy.RUNTIME)
- @Target({ElementType.TYPE, ElementType.METHOD})
- public @interface ServerTest {
-
- public Class<? extends IServerSession> serverSessionClass() default IServerSession.class;
-
- public Class<? extends ITestServerSessionProvider> sessionProvider() default NullTestServerSessionProvider.class;
-
- public String runAs() default "";
- }
-
- /**
- * Null-provider used as default value in the {@link ServerTest} annotation (since annotation values must not be
- * <code>null</code>).
- */
- public static interface NullTestServerSessionProvider extends ITestServerSessionProvider {
- }
-
- /**
- * @param klass
- * @throws InitializationError
- */
- public ScoutServerTestRunner(Class<?> klass) throws InitializationError {
- super(klass);
- try {
- m_loginInfo = getOrCreateServerSession(klass.getAnnotation(ServerTest.class), null);
- }
- catch (InitializationError e) {
- throw e;
- }
- catch (Exception e) {
- List<Throwable> errors = new ArrayList<Throwable>();
- errors.add(e);
- throw new InitializationError(errors);
- }
- }
-
- public static Class<? extends IServerSession> getDefaultServerSessionClass() {
- return s_defaultServerSessionClass;
- }
-
- public static void setDefaultServerSessionClass(Class<? extends IServerSession> defaultServerSessionClass) {
- s_defaultServerSessionClass = defaultServerSessionClass;
- }
-
- public static ITestServerSessionProvider getDefaultServerSessionProvider() {
- return s_defaultServerSessionProvider;
- }
-
- public static void setDefaultServerSessionProvider(ITestServerSessionProvider defaultServerSessionProvider) {
- s_defaultServerSessionProvider = defaultServerSessionProvider;
- }
-
- public static String getDefaultPrincipalName() {
- return s_defaultPrincipalName;
- }
-
- public static void setDefaultPrincipalName(String defaultPrincipalName) {
- s_defaultPrincipalName = defaultPrincipalName;
- }
-
- /**
- * @return Returns the default server session class used by this test runner. Defaults to
- * {@link #getDefaultServerSessionClass()}. Subclasses may override this method to provide another default
- * value.
- */
- protected Class<? extends IServerSession> defaultServerSessionClass() {
- return getDefaultServerSessionClass();
- }
-
- /**
- * @return Returns the default server session provider used by this test runner. Defaults to
- * {@link #getDefaultServerSessionProvider()}. Subclasses may override this method to provide another default
- * value.
- */
- protected ITestServerSessionProvider defaultServerSessionProvider() {
- return getDefaultServerSessionProvider();
- }
-
- /**
- * @return Returns the default principal name used by this test runner. Defaults to {@link #getDefaultPrincipalName()}
- * Subclasses may override this method to provide another default value.
- */
- protected String defaultPrincipalName() {
- return getDefaultPrincipalName();
- }
-
- @Override
- protected Statement withBeforeClasses(Statement statement) {
- // run all methods annotated with @BeforeClass in a separate ServerSession
- List<FrameworkMethod> befores = getTestClass().getAnnotatedMethods(BeforeClass.class);
- return befores.isEmpty() ? statement : new RunBeforesInSeparateScoutServerSession(m_loginInfo.getServerSession(), m_loginInfo.getSubject(), statement, befores, null);
- }
-
- @Override
- protected Statement withAfterClasses(Statement statement) {
- // run all methods annotated with @AfterClass in a separate ServerSession
- List<FrameworkMethod> afters = getTestClass().getAnnotatedMethods(AfterClass.class);
- return afters.isEmpty() ? statement : new RunAftersInSeparateScoutServerSession(m_loginInfo.getServerSession(), m_loginInfo.getSubject(), statement, afters, null);
- }
-
- @Override
- protected Statement methodBlock(FrameworkMethod method) {
- LoginInfo loginInfo = m_loginInfo;
- ServerTest methodLevelClientTest = method.getAnnotation(ServerTest.class);
- if (methodLevelClientTest != null) {
- try {
- ServerTest classLevelClientTest = getTestClass().getJavaClass().getAnnotation(ServerTest.class);
- loginInfo = getOrCreateServerSession(classLevelClientTest, methodLevelClientTest);
- }
- catch (final Throwable e) {
- return new Statement() {
- @Override
- public void evaluate() throws Throwable {
- throw e;
- }
- };
- }
- }
-
- // run each test method in a separate ServerSession
- return new ScoutServerJobWrapperStatement(loginInfo.getServerSession(), loginInfo.getSubject(), super.methodBlock(method));
- }
-
- @Override
- @SuppressWarnings("deprecation")
- protected Statement possiblyExpectingExceptions(FrameworkMethod method, Object test, Statement next) {
- // unpack wrapped ProcessingExceptions and rethrow them
- return super.possiblyExpectingExceptions(method, test, new ProcessingRuntimeExceptionUnwrappingStatement(next));
- }
-
- protected LoginInfo getOrCreateServerSession(ServerTest classLevelServerTest, ServerTest methodLevelServerTest) throws Exception {
- // process default values
- Class<? extends IServerSession> serverSessionClass = defaultServerSessionClass();
- ITestServerSessionProvider sessionProvider = defaultServerSessionProvider();
- String runAs = defaultPrincipalName();
-
- // process class-level server test configuration
- if (classLevelServerTest != null) {
- serverSessionClass = extractSessionClass(classLevelServerTest, serverSessionClass);
- sessionProvider = extractSessionProvider(classLevelServerTest, sessionProvider);
- runAs = extractRunAs(classLevelServerTest, runAs);
- }
-
- // process method-level server test configuration
- if (methodLevelServerTest != null) {
- serverSessionClass = extractSessionClass(methodLevelServerTest, serverSessionClass);
- sessionProvider = extractSessionProvider(methodLevelServerTest, sessionProvider);
- runAs = extractRunAs(methodLevelServerTest, runAs);
- }
-
- // sanity check
- if (serverSessionClass == null) {
- throw new InitializationError("Server session class is not set. Either set the default server session using '"
- + ScoutServerTestRunner.class.getSimpleName()
- + ".setDefaultServerSessionClass' or annotate your test class and/or method with '"
- + ServerTest.class.getSimpleName() + "'");
- }
-
- // return existing or create new server session
- Subject subject = sessionProvider.login(runAs);
- IServerSession serverSession = sessionProvider.createServerSession(serverSessionClass, subject);
- return new LoginInfo(subject, serverSession);
- }
-
- /**
- * @param serverTest
- * @return
- */
- protected Class<? extends IServerSession> extractSessionClass(ServerTest serverTest, Class<? extends IServerSession> defaultValue) {
- if (serverTest == null || serverTest.serverSessionClass() == null || serverTest.serverSessionClass() == IServerSession.class) {
- return defaultValue;
- }
- return serverTest.serverSessionClass();
- }
-
- /**
- * @param serverTest
- * @return
- */
- protected ITestServerSessionProvider extractSessionProvider(ServerTest serverTest, ITestServerSessionProvider defaultValue) throws Exception {
- if (serverTest == null || serverTest.sessionProvider() == null || serverTest.sessionProvider() == NullTestServerSessionProvider.class) {
- return defaultValue;
- }
- return serverTest.sessionProvider().newInstance();
- }
-
- /**
- * @param serverTest
- * @return
- */
- protected String extractRunAs(ServerTest serverTest, String defaultValue) {
- String runAs = defaultValue;
- if (serverTest != null && serverTest.runAs() != null) {
- String s = serverTest.runAs().trim();
- if (s.length() > 0) {
- runAs = s;
- }
- }
- return runAs;
- }
-
- public static class LoginInfo {
- private final Subject m_subject;
- private final IServerSession m_serverSession;
-
- public LoginInfo(Subject subject, IServerSession serverSession) {
- m_serverSession = serverSession;
- m_subject = subject;
- }
-
- public Subject getSubject() {
- return m_subject;
- }
-
- public IServerSession getServerSession() {
- return m_serverSession;
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.testing.server.runner;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.security.auth.Subject;
+
+import org.eclipse.scout.rt.server.IServerSession;
+import org.eclipse.scout.rt.testing.server.DefaultTestServerSessionProvider;
+import org.eclipse.scout.rt.testing.server.ITestServerSessionProvider;
+import org.eclipse.scout.rt.testing.shared.services.common.exceptionhandler.ProcessingRuntimeExceptionUnwrappingStatement;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.runners.BlockJUnit4ClassRunner;
+import org.junit.runners.model.FrameworkMethod;
+import org.junit.runners.model.InitializationError;
+import org.junit.runners.model.Statement;
+
+/**
+ * JUnit test runner that runs the annotated test class within a Scout server job. Test cases executed by this runner
+ * may be configured with {@link ServerTest} annotation.
+ * <p/>
+ * <h3>Sessions and Transactions</h3> The different methods of a test class driven by this runner are invoked in
+ * different Scout server sessions and therefore in different Scout transactions (because a Scout transaction is
+ * attached to one particular Scout session)>
+ * <table border="1">
+ * <tr>
+ * <th>Element</th>
+ * <th>Description</th>
+ * </tr>
+ * <tr>
+ * <td><b>@BeforeClass</b></td>
+ * <td>all methods annotated with {@link BeforeClass} are invoked in the very same Scout server session. Therefore they
+ * share the same Scout transaction.</td>
+ * </tr>
+ * <tr>
+ * <td><b>@Before, @Test, @After</b></td>
+ * <td>each test case is invoked in a separate Scout server session and therefore in a separate Scout transaction. A
+ * particular test cas consists of the following methods:
+ * <ul>
+ * <li>all methdos annotated with {@link Before}</li>
+ * <li>the test case itself annotated with {@link Test}</li>
+ * <li>all methdos annotated with {@link After}</li>
+ * </ul>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td><b>@AfterClass</b></td>
+ * <td>all methods annotated with {@link AfterClass} are invoked in the very same Scout server session. Therefore they
+ * share the same Scout transaction.</td>
+ * </tr>
+ * </table>
+ */
+public class ScoutServerTestRunner extends BlockJUnit4ClassRunner {
+
+ private static Class<? extends IServerSession> s_defaultServerSessionClass;
+ private static String s_defaultPrincipalName;
+ private static ITestServerSessionProvider s_defaultServerSessionProvider = new DefaultTestServerSessionProvider();
+
+ private LoginInfo m_loginInfo;
+
+ @Retention(RetentionPolicy.RUNTIME)
+ @Target({ElementType.TYPE, ElementType.METHOD})
+ public @interface ServerTest {
+
+ public Class<? extends IServerSession> serverSessionClass() default IServerSession.class;
+
+ public Class<? extends ITestServerSessionProvider> sessionProvider() default NullTestServerSessionProvider.class;
+
+ public String runAs() default "";
+ }
+
+ /**
+ * Null-provider used as default value in the {@link ServerTest} annotation (since annotation values must not be
+ * <code>null</code>).
+ */
+ public static interface NullTestServerSessionProvider extends ITestServerSessionProvider {
+ }
+
+ /**
+ * @param klass
+ * @throws InitializationError
+ */
+ public ScoutServerTestRunner(Class<?> klass) throws InitializationError {
+ super(klass);
+ try {
+ m_loginInfo = getOrCreateServerSession(klass.getAnnotation(ServerTest.class), null);
+ }
+ catch (InitializationError e) {
+ throw e;
+ }
+ catch (Exception e) {
+ List<Throwable> errors = new ArrayList<Throwable>();
+ errors.add(e);
+ throw new InitializationError(errors);
+ }
+ }
+
+ public static Class<? extends IServerSession> getDefaultServerSessionClass() {
+ return s_defaultServerSessionClass;
+ }
+
+ public static void setDefaultServerSessionClass(Class<? extends IServerSession> defaultServerSessionClass) {
+ s_defaultServerSessionClass = defaultServerSessionClass;
+ }
+
+ public static ITestServerSessionProvider getDefaultServerSessionProvider() {
+ return s_defaultServerSessionProvider;
+ }
+
+ public static void setDefaultServerSessionProvider(ITestServerSessionProvider defaultServerSessionProvider) {
+ s_defaultServerSessionProvider = defaultServerSessionProvider;
+ }
+
+ public static String getDefaultPrincipalName() {
+ return s_defaultPrincipalName;
+ }
+
+ public static void setDefaultPrincipalName(String defaultPrincipalName) {
+ s_defaultPrincipalName = defaultPrincipalName;
+ }
+
+ /**
+ * @return Returns the default server session class used by this test runner. Defaults to
+ * {@link #getDefaultServerSessionClass()}. Subclasses may override this method to provide another default
+ * value.
+ */
+ protected Class<? extends IServerSession> defaultServerSessionClass() {
+ return getDefaultServerSessionClass();
+ }
+
+ /**
+ * @return Returns the default server session provider used by this test runner. Defaults to
+ * {@link #getDefaultServerSessionProvider()}. Subclasses may override this method to provide another default
+ * value.
+ */
+ protected ITestServerSessionProvider defaultServerSessionProvider() {
+ return getDefaultServerSessionProvider();
+ }
+
+ /**
+ * @return Returns the default principal name used by this test runner. Defaults to {@link #getDefaultPrincipalName()}
+ * Subclasses may override this method to provide another default value.
+ */
+ protected String defaultPrincipalName() {
+ return getDefaultPrincipalName();
+ }
+
+ @Override
+ protected Statement withBeforeClasses(Statement statement) {
+ // run all methods annotated with @BeforeClass in a separate ServerSession
+ List<FrameworkMethod> befores = getTestClass().getAnnotatedMethods(BeforeClass.class);
+ return befores.isEmpty() ? statement : new RunBeforesInSeparateScoutServerSession(m_loginInfo.getServerSession(), m_loginInfo.getSubject(), statement, befores, null);
+ }
+
+ @Override
+ protected Statement withAfterClasses(Statement statement) {
+ // run all methods annotated with @AfterClass in a separate ServerSession
+ List<FrameworkMethod> afters = getTestClass().getAnnotatedMethods(AfterClass.class);
+ return afters.isEmpty() ? statement : new RunAftersInSeparateScoutServerSession(m_loginInfo.getServerSession(), m_loginInfo.getSubject(), statement, afters, null);
+ }
+
+ @Override
+ protected Statement methodBlock(FrameworkMethod method) {
+ LoginInfo loginInfo = m_loginInfo;
+ ServerTest methodLevelClientTest = method.getAnnotation(ServerTest.class);
+ if (methodLevelClientTest != null) {
+ try {
+ ServerTest classLevelClientTest = getTestClass().getJavaClass().getAnnotation(ServerTest.class);
+ loginInfo = getOrCreateServerSession(classLevelClientTest, methodLevelClientTest);
+ }
+ catch (final Throwable e) {
+ return new Statement() {
+ @Override
+ public void evaluate() throws Throwable {
+ throw e;
+ }
+ };
+ }
+ }
+
+ // run each test method in a separate ServerSession
+ return new ScoutServerJobWrapperStatement(loginInfo.getServerSession(), loginInfo.getSubject(), super.methodBlock(method));
+ }
+
+ @Override
+ @SuppressWarnings("deprecation")
+ protected Statement possiblyExpectingExceptions(FrameworkMethod method, Object test, Statement next) {
+ // unpack wrapped ProcessingExceptions and rethrow them
+ return super.possiblyExpectingExceptions(method, test, new ProcessingRuntimeExceptionUnwrappingStatement(next));
+ }
+
+ protected LoginInfo getOrCreateServerSession(ServerTest classLevelServerTest, ServerTest methodLevelServerTest) throws Exception {
+ // process default values
+ Class<? extends IServerSession> serverSessionClass = defaultServerSessionClass();
+ ITestServerSessionProvider sessionProvider = defaultServerSessionProvider();
+ String runAs = defaultPrincipalName();
+
+ // process class-level server test configuration
+ if (classLevelServerTest != null) {
+ serverSessionClass = extractSessionClass(classLevelServerTest, serverSessionClass);
+ sessionProvider = extractSessionProvider(classLevelServerTest, sessionProvider);
+ runAs = extractRunAs(classLevelServerTest, runAs);
+ }
+
+ // process method-level server test configuration
+ if (methodLevelServerTest != null) {
+ serverSessionClass = extractSessionClass(methodLevelServerTest, serverSessionClass);
+ sessionProvider = extractSessionProvider(methodLevelServerTest, sessionProvider);
+ runAs = extractRunAs(methodLevelServerTest, runAs);
+ }
+
+ // sanity check
+ if (serverSessionClass == null) {
+ throw new InitializationError("Server session class is not set. Either set the default server session using '"
+ + ScoutServerTestRunner.class.getSimpleName()
+ + ".setDefaultServerSessionClass' or annotate your test class and/or method with '"
+ + ServerTest.class.getSimpleName() + "'");
+ }
+
+ // return existing or create new server session
+ Subject subject = sessionProvider.login(runAs);
+ IServerSession serverSession = sessionProvider.createServerSession(serverSessionClass, subject);
+ return new LoginInfo(subject, serverSession);
+ }
+
+ /**
+ * @param serverTest
+ * @return
+ */
+ protected Class<? extends IServerSession> extractSessionClass(ServerTest serverTest, Class<? extends IServerSession> defaultValue) {
+ if (serverTest == null || serverTest.serverSessionClass() == null || serverTest.serverSessionClass() == IServerSession.class) {
+ return defaultValue;
+ }
+ return serverTest.serverSessionClass();
+ }
+
+ /**
+ * @param serverTest
+ * @return
+ */
+ protected ITestServerSessionProvider extractSessionProvider(ServerTest serverTest, ITestServerSessionProvider defaultValue) throws Exception {
+ if (serverTest == null || serverTest.sessionProvider() == null || serverTest.sessionProvider() == NullTestServerSessionProvider.class) {
+ return defaultValue;
+ }
+ return serverTest.sessionProvider().newInstance();
+ }
+
+ /**
+ * @param serverTest
+ * @return
+ */
+ protected String extractRunAs(ServerTest serverTest, String defaultValue) {
+ String runAs = defaultValue;
+ if (serverTest != null && serverTest.runAs() != null) {
+ String s = serverTest.runAs().trim();
+ if (s.length() > 0) {
+ runAs = s;
+ }
+ }
+ return runAs;
+ }
+
+ public static class LoginInfo {
+ private final Subject m_subject;
+ private final IServerSession m_serverSession;
+
+ public LoginInfo(Subject subject, IServerSession serverSession) {
+ m_serverSession = serverSession;
+ m_subject = subject;
+ }
+
+ public Subject getSubject() {
+ return m_subject;
+ }
+
+ public IServerSession getServerSession() {
+ return m_serverSession;
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.testing.shared/.settings/org.eclipse.pde.core.prefs b/org.eclipse.scout.rt.testing.shared/.settings/org.eclipse.pde.core.prefs
index baef13dd8c..a3a50fc8da 100644
--- a/org.eclipse.scout.rt.testing.shared/.settings/org.eclipse.pde.core.prefs
+++ b/org.eclipse.scout.rt.testing.shared/.settings/org.eclipse.pde.core.prefs
@@ -1,3 +1,3 @@
-#Mon Jul 11 16:16:00 CEST 2011
-eclipse.preferences.version=1
-pluginProject.extensions=true
+#Mon Jul 11 16:16:00 CEST 2011
+eclipse.preferences.version=1
+pluginProject.extensions=true
diff --git a/org.eclipse.scout.rt.testing.shared/Release Notes.txt b/org.eclipse.scout.rt.testing.shared/Release Notes.txt
index cc8b992476..e8f2635f52 100644
--- a/org.eclipse.scout.rt.testing.shared/Release Notes.txt
+++ b/org.eclipse.scout.rt.testing.shared/Release Notes.txt
@@ -1,12 +1,12 @@
-29.06.2011 abr
-Bug 350389: improve Scout RT testing support
-o added support for specifying bundle and classes inclusion and exclusion filters, respectively
- bundleNameIncludeFilter
- bundleNameExcludeFilter
- classNameIncludeFilter
- classNameExcludeFilter
- All four properties support wildcard expressions (supports * and ?) as well as regular expressions. The latter must start with 'regex:'.
-o added property failOnError: exit code > 0 if true and a failure or error occurred. Exit code is always 0 if false.
-o added property haltOnFailure: test execution stops on first failure or error if set to true. Otherwise all tests are executed.
-Migration:
-Now failOnError and haltOnFailure both default to false. Was true before.
+29.06.2011 abr
+Bug 350389: improve Scout RT testing support
+o added support for specifying bundle and classes inclusion and exclusion filters, respectively
+ bundleNameIncludeFilter
+ bundleNameExcludeFilter
+ classNameIncludeFilter
+ classNameExcludeFilter
+ All four properties support wildcard expressions (supports * and ?) as well as regular expressions. The latter must start with 'regex:'.
+o added property failOnError: exit code > 0 if true and a failure or error occurred. Exit code is always 0 if false.
+o added property haltOnFailure: test execution stops on first failure or error if set to true. Otherwise all tests are executed.
+Migration:
+Now failOnError and haltOnFailure both default to false. Was true before.
diff --git a/org.eclipse.scout.rt.testing.shared/plugin.xml b/org.eclipse.scout.rt.testing.shared/plugin.xml
index 6b1c526fd1..5203d64ba7 100644
--- a/org.eclipse.scout.rt.testing.shared/plugin.xml
+++ b/org.eclipse.scout.rt.testing.shared/plugin.xml
@@ -1,17 +1,17 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<plugin>
- <extension
- id="app"
- point="org.eclipse.core.runtime.applications">
- <application
- cardinality="singleton-global"
- thread="main"
- visible="true">
- <run
- class="org.eclipse.scout.rt.testing.shared.ScoutJUnitPluginTestApplication">
- </run>
- </application>
- </extension>
-
-</plugin>
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ id="app"
+ point="org.eclipse.core.runtime.applications">
+ <application
+ cardinality="singleton-global"
+ thread="main"
+ visible="true">
+ <run
+ class="org.eclipse.scout.rt.testing.shared.ScoutJUnitPluginTestApplication">
+ </run>
+ </application>
+ </extension>
+
+</plugin>
diff --git a/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/Activator.java b/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/Activator.java
index 269129192a..48b2219988 100644
--- a/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/Activator.java
+++ b/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/Activator.java
@@ -1,62 +1,62 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.testing.shared;
-
-import org.eclipse.core.runtime.Plugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends Plugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.scout.rt.testing.shared";
-
- // The shared instance
- private static Activator plugin;
-
- /**
- * The constructor
- */
- public Activator() {
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
- */
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.testing.shared;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.scout.rt.testing.shared";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/DevTestMarker.java b/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/DevTestMarker.java
index 63c77a7f46..1eacd807d4 100644
--- a/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/DevTestMarker.java
+++ b/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/DevTestMarker.java
@@ -1,31 +1,31 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.testing.shared;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import org.eclipse.core.runtime.Platform;
-import org.junit.Test;
-
-/**
- * This marker annotation is used in development mode {@link Platform#inDevelopmentMode()} to annotate a single test
- * that is to be run alone.
- * <p>
- * This is useful when writing a new test case and the test case is to be debugged or test-run. In development mode only
- * the {@link Test} marked with DevTestMarker is run when using {@link ScoutJUnitPluginTestExecutor}
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.TYPE)
-public @interface DevTestMarker {
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.testing.shared;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.eclipse.core.runtime.Platform;
+import org.junit.Test;
+
+/**
+ * This marker annotation is used in development mode {@link Platform#inDevelopmentMode()} to annotate a single test
+ * that is to be run alone.
+ * <p>
+ * This is useful when writing a new test case and the test case is to be debugged or test-run. In development mode only
+ * the {@link Test} marked with DevTestMarker is run when using {@link ScoutJUnitPluginTestExecutor}
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+public @interface DevTestMarker {
+}
diff --git a/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/JUnitTestClassBrowser.java b/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/JUnitTestClassBrowser.java
index d0e5d161d2..f3ce359565 100644
--- a/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/JUnitTestClassBrowser.java
+++ b/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/JUnitTestClassBrowser.java
@@ -1,300 +1,300 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.testing.shared;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.regex.Pattern;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.scout.commons.osgi.BundleInspector;
-import org.eclipse.scout.commons.runtime.BundleBrowser;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.osgi.framework.Bundle;
-
-/**
- * Collects JUnit Test classes. By default the the following rules are used:
- * <ol>
- * <li>A JUnit test is expected to be the outer most class in a java file (i.e. inner classes are not scanned)</li>
- * <li>By default all bundles scanned for tests (can be changed by specifying inclusion and exclusion regular expression
- * patterns or by overriding {@link #acceptBundle(Bundle)})</li>
- * <li>By default JUnit test classes must contain <em>Test</em> in their class names (can be changed by specifying
- * inclusion and exclusion regular expression patterns or by overriding {@link #acceptClassName(Bundle, String)}).</li>
- * <li>JUnit test classes must have a class-level annotation <code>@RunWith</code> or at least one method that is
- * annotated with <code>@Test</code> (can be changed by overriding {@link #acceptClass(Bundle, Class)})</li>
- * </ol>
- * <p>
- */
-public class JUnitTestClassBrowser {
-
- private static final String REGEX_MARKER = "regex:";
- private static final Pattern[] DEFAULT_CLASS_NAME_INCLUDE_PATTERNS = new Pattern[]{Pattern.compile(".*Test.*")};
-
- private Pattern[] m_bundleNameIncludePatterns;
- private Pattern[] m_bundleNameExcludePatterns;
- private Pattern[] m_classNameIncludePatterns;
- private Pattern[] m_classNameExcludePatterns;
-
- public JUnitTestClassBrowser() {
- setClassNameIncludePatterns(DEFAULT_CLASS_NAME_INCLUDE_PATTERNS);
- }
-
- public Pattern[] getBundleNameIncludePatterns() {
- return m_bundleNameIncludePatterns;
- }
-
- public void setBundleNameIncludePatterns(Pattern[] bundleNameIncludePatterns) {
- m_bundleNameIncludePatterns = bundleNameIncludePatterns;
- }
-
- public Pattern[] getBundleNameExcludePatterns() {
- return m_bundleNameExcludePatterns;
- }
-
- public void setBundleNameExcludePatterns(Pattern[] bundleNameExcludePatterns) {
- m_bundleNameExcludePatterns = bundleNameExcludePatterns;
- }
-
- public Pattern[] getClassNameIncludePatterns() {
- return m_classNameIncludePatterns;
- }
-
- public void setClassNameIncludePatterns(Pattern[] classNameIncludePatterns) {
- if (classNameIncludePatterns == null || classNameIncludePatterns.length == 0) {
- m_classNameIncludePatterns = DEFAULT_CLASS_NAME_INCLUDE_PATTERNS;
- }
- else {
- m_classNameIncludePatterns = classNameIncludePatterns;
- }
- }
-
- public Pattern[] getClassNameExcludePatterns() {
- return m_classNameExcludePatterns;
- }
-
- public void setClassNameExcludePatterns(Pattern[] classNameExcludePatterns) {
- m_classNameExcludePatterns = classNameExcludePatterns;
- }
-
- /**
- * @return Returns a list of all classes accepted by the following three filter methods:
- * <ol>
- * <li>{@link #acceptBundle(Bundle)}</li>
- * <li>{@link #acceptClassName(Bundle, String)}</li>
- * <li>{@link #acceptClass(Bundle, Class)}</li>
- * </ol>
- */
- public List<Class<?>> collectAllJUnitTestClasses() {
- boolean dev = Platform.inDevelopmentMode();
- if (dev) {
- System.out.println("In -dev mode: only the test(s) marked with @DevTestMarker are run as a convenience (all tests if no such annotation is found)");
- }
- List<Class<?>> junitTestClasses = new ArrayList<Class<?>>();
- List<Class<?>> devClasses = new ArrayList<Class<?>>();
- for (Bundle bundle : Activator.getDefault().getBundle().getBundleContext().getBundles()) {
- // check if bundle is searched for tests
- if (!acceptBundle(bundle)) {
- continue;
- }
-
- String[] classNames;
- try {
- BundleBrowser bundleBrowser = new BundleBrowser(bundle.getSymbolicName(), "");
- classNames = bundleBrowser.getClasses(false, true);
- }
- catch (Exception e1) {
- System.err.println(e1);
- continue;
- }
- // filter
- for (String className : classNames) {
- // fast pre-check
- if (!acceptClassName(bundle, className)) {
- continue;
- }
- try {
- Class<?> c = BundleInspector.getHostBundle(bundle).loadClass(className);
- if (acceptClass(bundle, c)) {
- // add it
- if (dev && c.getAnnotation(DevTestMarker.class) != null) {
- devClasses.add(c);
- }
- junitTestClasses.add(c);
- }
- }
- catch (Throwable t) {
- // nop
- }
- }
- }
- if (!devClasses.isEmpty()) {
- return devClasses;
- }
- return junitTestClasses;
- }
-
- /**
- * The default implementation checks that the given bundle's name is included in the list of bundle name include
- * patterns and that its name is not excluded by the bundle name exclude patterns.
- *
- * @return Returns <code>true</code> if the given bundle meets the requirements to be scanned for JUnit tests.
- * <code>false</code> otherwise.
- * @see #setBundleNameIncludePatterns(Pattern[])
- * @see #setBundleNameExcludePatterns(Pattern[])
- */
- protected boolean acceptBundle(Bundle bundle) {
- return !Platform.isFragment(bundle)
- && accept(bundle.getSymbolicName(), getBundleNameIncludePatterns(), getBundleNameExcludePatterns());
- }
-
- /**
- * The default implementation checks that the given class's name is included in the list of class name include
- * patterns and that its name is not excluded by the class name exclude patterns.
- *
- * @param bundle
- * The class's hosting bundle
- * @param className
- * @return Returns <code>true</code> if the given class name meets the requirements to be scanned for JUnit tests.
- * <code>false</code> otherwise.
- * @see #setClassNameIncludePatterns(Pattern[])
- * @see #setClassNameExcludePatterns(Pattern[])
- */
- protected boolean acceptClassName(Bundle bundle, String className) {
- return accept(className, getClassNameIncludePatterns(), getClassNameExcludePatterns());
- }
-
- /**
- * This default implementation checks that the given class is not abstract and that it has either a {@link RunWith}
- * class-level annotation or at least one of its methods is annotated with {@link Test}.
- *
- * @param bundle
- * The class's hosting bundle
- * @param c
- * @return Returns <code>true</code> if the class hosts a JUnit test methods. <code>false</code> otherwise.
- */
- protected boolean acceptClass(Bundle bundle, Class<?> c) {
- if ((c.getModifiers() & Modifier.ABSTRACT) != 0) {
- return false;
- }
-
- if (junit.framework.Test.class.isAssignableFrom(c)) {
- // JUnit 3 support
- return true;
- }
- if (c.getAnnotation(RunWith.class) != null) {
- // class-level check is ok
- return true;
- }
- else {
- // look for annotated Test methods
- Method[] methods = c.getMethods();
- if (methods != null) {
- for (Method m : methods) {
- if (m.getAnnotation(Test.class) != null) {
- return true;
- }
- }
- }
- }
- return false;
- }
-
- /**
- * Checks if the given string is included in the list of include patterns and that it is not excluded by the list of
- * exclude patterns. If the include or exclude pattern list is null or empty, the string is assumed to be included and
- * not excluded, respectively.
- *
- * @param s
- * @param includePatterns
- * @param excludePatterns
- * @return
- */
- public static boolean accept(String s, Pattern[] includePatterns, Pattern[] excludePatterns) {
- if (s == null) {
- return false;
- }
- boolean included = true;
- boolean excluded = false;
- if (includePatterns != null) {
- included = false;
- for (Pattern p : includePatterns) {
- if (p.matcher(s).matches()) {
- included = true;
- break;
- }
- }
- }
- if (included && excludePatterns != null) {
- for (Pattern p : excludePatterns) {
- if (p.matcher(s).matches()) {
- excluded = true;
- break;
- }
- }
- }
- return included && !excluded;
- }
-
- /**
- * Parses a comma-separated list of filter patterns. A filter pattern is either a wildcard pattern or a regular
- * expression. Latter must be prefixed by <em>regex:</em>
- *
- * @param filter
- * @return
- */
- public static Pattern[] parseFilterPatterns(String filter) {
- if (filter == null) {
- return null;
- }
- List<Pattern> patterns = new ArrayList<Pattern>();
- for (String f : filter.split(",")) {
- f = f.trim();
- if (f.length() > 0) {
- try {
- f = toRegexPattern(f);
- Pattern pattern = Pattern.compile(f);
- patterns.add(pattern);
- }
- catch (Exception e) {
- System.err.println("invalid bundle filter pattern: " + e);
- }
- }
- }
- if (patterns.isEmpty()) {
- return null;
- }
- return patterns.toArray(new Pattern[patterns.size()]);
- }
-
- /**
- * Transforms the given string into a regular expression pattern. The string is assumed to be a wildcard pattern or
- * already a regular expression pattern. The latter must be prefixed by <em>regex:</em>.
- *
- * @param s
- * @return
- */
- public static String toRegexPattern(String s) {
- if (s == null) {
- return null;
- }
- String pattern = s.trim();
- if (pattern.startsWith(REGEX_MARKER)) {
- return pattern.substring(REGEX_MARKER.length());
- }
- pattern = pattern.replaceAll("[.]", "\\\\.");
- pattern = pattern.replaceAll("[*]", ".*");
- pattern = pattern.replaceAll("[?]", ".");
- return pattern;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.testing.shared;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Pattern;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.scout.commons.osgi.BundleInspector;
+import org.eclipse.scout.commons.runtime.BundleBrowser;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.osgi.framework.Bundle;
+
+/**
+ * Collects JUnit Test classes. By default the the following rules are used:
+ * <ol>
+ * <li>A JUnit test is expected to be the outer most class in a java file (i.e. inner classes are not scanned)</li>
+ * <li>By default all bundles scanned for tests (can be changed by specifying inclusion and exclusion regular expression
+ * patterns or by overriding {@link #acceptBundle(Bundle)})</li>
+ * <li>By default JUnit test classes must contain <em>Test</em> in their class names (can be changed by specifying
+ * inclusion and exclusion regular expression patterns or by overriding {@link #acceptClassName(Bundle, String)}).</li>
+ * <li>JUnit test classes must have a class-level annotation <code>@RunWith</code> or at least one method that is
+ * annotated with <code>@Test</code> (can be changed by overriding {@link #acceptClass(Bundle, Class)})</li>
+ * </ol>
+ * <p>
+ */
+public class JUnitTestClassBrowser {
+
+ private static final String REGEX_MARKER = "regex:";
+ private static final Pattern[] DEFAULT_CLASS_NAME_INCLUDE_PATTERNS = new Pattern[]{Pattern.compile(".*Test.*")};
+
+ private Pattern[] m_bundleNameIncludePatterns;
+ private Pattern[] m_bundleNameExcludePatterns;
+ private Pattern[] m_classNameIncludePatterns;
+ private Pattern[] m_classNameExcludePatterns;
+
+ public JUnitTestClassBrowser() {
+ setClassNameIncludePatterns(DEFAULT_CLASS_NAME_INCLUDE_PATTERNS);
+ }
+
+ public Pattern[] getBundleNameIncludePatterns() {
+ return m_bundleNameIncludePatterns;
+ }
+
+ public void setBundleNameIncludePatterns(Pattern[] bundleNameIncludePatterns) {
+ m_bundleNameIncludePatterns = bundleNameIncludePatterns;
+ }
+
+ public Pattern[] getBundleNameExcludePatterns() {
+ return m_bundleNameExcludePatterns;
+ }
+
+ public void setBundleNameExcludePatterns(Pattern[] bundleNameExcludePatterns) {
+ m_bundleNameExcludePatterns = bundleNameExcludePatterns;
+ }
+
+ public Pattern[] getClassNameIncludePatterns() {
+ return m_classNameIncludePatterns;
+ }
+
+ public void setClassNameIncludePatterns(Pattern[] classNameIncludePatterns) {
+ if (classNameIncludePatterns == null || classNameIncludePatterns.length == 0) {
+ m_classNameIncludePatterns = DEFAULT_CLASS_NAME_INCLUDE_PATTERNS;
+ }
+ else {
+ m_classNameIncludePatterns = classNameIncludePatterns;
+ }
+ }
+
+ public Pattern[] getClassNameExcludePatterns() {
+ return m_classNameExcludePatterns;
+ }
+
+ public void setClassNameExcludePatterns(Pattern[] classNameExcludePatterns) {
+ m_classNameExcludePatterns = classNameExcludePatterns;
+ }
+
+ /**
+ * @return Returns a list of all classes accepted by the following three filter methods:
+ * <ol>
+ * <li>{@link #acceptBundle(Bundle)}</li>
+ * <li>{@link #acceptClassName(Bundle, String)}</li>
+ * <li>{@link #acceptClass(Bundle, Class)}</li>
+ * </ol>
+ */
+ public List<Class<?>> collectAllJUnitTestClasses() {
+ boolean dev = Platform.inDevelopmentMode();
+ if (dev) {
+ System.out.println("In -dev mode: only the test(s) marked with @DevTestMarker are run as a convenience (all tests if no such annotation is found)");
+ }
+ List<Class<?>> junitTestClasses = new ArrayList<Class<?>>();
+ List<Class<?>> devClasses = new ArrayList<Class<?>>();
+ for (Bundle bundle : Activator.getDefault().getBundle().getBundleContext().getBundles()) {
+ // check if bundle is searched for tests
+ if (!acceptBundle(bundle)) {
+ continue;
+ }
+
+ String[] classNames;
+ try {
+ BundleBrowser bundleBrowser = new BundleBrowser(bundle.getSymbolicName(), "");
+ classNames = bundleBrowser.getClasses(false, true);
+ }
+ catch (Exception e1) {
+ System.err.println(e1);
+ continue;
+ }
+ // filter
+ for (String className : classNames) {
+ // fast pre-check
+ if (!acceptClassName(bundle, className)) {
+ continue;
+ }
+ try {
+ Class<?> c = BundleInspector.getHostBundle(bundle).loadClass(className);
+ if (acceptClass(bundle, c)) {
+ // add it
+ if (dev && c.getAnnotation(DevTestMarker.class) != null) {
+ devClasses.add(c);
+ }
+ junitTestClasses.add(c);
+ }
+ }
+ catch (Throwable t) {
+ // nop
+ }
+ }
+ }
+ if (!devClasses.isEmpty()) {
+ return devClasses;
+ }
+ return junitTestClasses;
+ }
+
+ /**
+ * The default implementation checks that the given bundle's name is included in the list of bundle name include
+ * patterns and that its name is not excluded by the bundle name exclude patterns.
+ *
+ * @return Returns <code>true</code> if the given bundle meets the requirements to be scanned for JUnit tests.
+ * <code>false</code> otherwise.
+ * @see #setBundleNameIncludePatterns(Pattern[])
+ * @see #setBundleNameExcludePatterns(Pattern[])
+ */
+ protected boolean acceptBundle(Bundle bundle) {
+ return !Platform.isFragment(bundle)
+ && accept(bundle.getSymbolicName(), getBundleNameIncludePatterns(), getBundleNameExcludePatterns());
+ }
+
+ /**
+ * The default implementation checks that the given class's name is included in the list of class name include
+ * patterns and that its name is not excluded by the class name exclude patterns.
+ *
+ * @param bundle
+ * The class's hosting bundle
+ * @param className
+ * @return Returns <code>true</code> if the given class name meets the requirements to be scanned for JUnit tests.
+ * <code>false</code> otherwise.
+ * @see #setClassNameIncludePatterns(Pattern[])
+ * @see #setClassNameExcludePatterns(Pattern[])
+ */
+ protected boolean acceptClassName(Bundle bundle, String className) {
+ return accept(className, getClassNameIncludePatterns(), getClassNameExcludePatterns());
+ }
+
+ /**
+ * This default implementation checks that the given class is not abstract and that it has either a {@link RunWith}
+ * class-level annotation or at least one of its methods is annotated with {@link Test}.
+ *
+ * @param bundle
+ * The class's hosting bundle
+ * @param c
+ * @return Returns <code>true</code> if the class hosts a JUnit test methods. <code>false</code> otherwise.
+ */
+ protected boolean acceptClass(Bundle bundle, Class<?> c) {
+ if ((c.getModifiers() & Modifier.ABSTRACT) != 0) {
+ return false;
+ }
+
+ if (junit.framework.Test.class.isAssignableFrom(c)) {
+ // JUnit 3 support
+ return true;
+ }
+ if (c.getAnnotation(RunWith.class) != null) {
+ // class-level check is ok
+ return true;
+ }
+ else {
+ // look for annotated Test methods
+ Method[] methods = c.getMethods();
+ if (methods != null) {
+ for (Method m : methods) {
+ if (m.getAnnotation(Test.class) != null) {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Checks if the given string is included in the list of include patterns and that it is not excluded by the list of
+ * exclude patterns. If the include or exclude pattern list is null or empty, the string is assumed to be included and
+ * not excluded, respectively.
+ *
+ * @param s
+ * @param includePatterns
+ * @param excludePatterns
+ * @return
+ */
+ public static boolean accept(String s, Pattern[] includePatterns, Pattern[] excludePatterns) {
+ if (s == null) {
+ return false;
+ }
+ boolean included = true;
+ boolean excluded = false;
+ if (includePatterns != null) {
+ included = false;
+ for (Pattern p : includePatterns) {
+ if (p.matcher(s).matches()) {
+ included = true;
+ break;
+ }
+ }
+ }
+ if (included && excludePatterns != null) {
+ for (Pattern p : excludePatterns) {
+ if (p.matcher(s).matches()) {
+ excluded = true;
+ break;
+ }
+ }
+ }
+ return included && !excluded;
+ }
+
+ /**
+ * Parses a comma-separated list of filter patterns. A filter pattern is either a wildcard pattern or a regular
+ * expression. Latter must be prefixed by <em>regex:</em>
+ *
+ * @param filter
+ * @return
+ */
+ public static Pattern[] parseFilterPatterns(String filter) {
+ if (filter == null) {
+ return null;
+ }
+ List<Pattern> patterns = new ArrayList<Pattern>();
+ for (String f : filter.split(",")) {
+ f = f.trim();
+ if (f.length() > 0) {
+ try {
+ f = toRegexPattern(f);
+ Pattern pattern = Pattern.compile(f);
+ patterns.add(pattern);
+ }
+ catch (Exception e) {
+ System.err.println("invalid bundle filter pattern: " + e);
+ }
+ }
+ }
+ if (patterns.isEmpty()) {
+ return null;
+ }
+ return patterns.toArray(new Pattern[patterns.size()]);
+ }
+
+ /**
+ * Transforms the given string into a regular expression pattern. The string is assumed to be a wildcard pattern or
+ * already a regular expression pattern. The latter must be prefixed by <em>regex:</em>.
+ *
+ * @param s
+ * @return
+ */
+ public static String toRegexPattern(String s) {
+ if (s == null) {
+ return null;
+ }
+ String pattern = s.trim();
+ if (pattern.startsWith(REGEX_MARKER)) {
+ return pattern.substring(REGEX_MARKER.length());
+ }
+ pattern = pattern.replaceAll("[.]", "\\\\.");
+ pattern = pattern.replaceAll("[*]", ".*");
+ pattern = pattern.replaceAll("[?]", ".");
+ return pattern;
+ }
+}
diff --git a/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/OsUtility.java b/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/OsUtility.java
index 67ddb48457..a96bda0aaf 100644
--- a/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/OsUtility.java
+++ b/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/OsUtility.java
@@ -1,41 +1,41 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.testing.shared;
-
-/**
- * Utility class to check for the underlying Operating System name.
- * Currently, only the latest Windows versions are implemented.
- */
-public class OsUtility {
-
- private static final String WIN_7 = "windows 7";
- private static final String WIN_VISTA = "windows vista";
- private static final String WIN_XP = "windows xp";
-
- private OsUtility() {
- }
-
- private static String getOsName() {
- return System.getProperty("os.name").toLowerCase();
- }
-
- public static boolean isWindows7() {
- return WIN_7.equals(getOsName());
- }
-
- public static boolean isWindowsVista() {
- return WIN_VISTA.equals(getOsName());
- }
-
- public static boolean isWindowsXP() {
- return WIN_XP.equals(getOsName());
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.testing.shared;
+
+/**
+ * Utility class to check for the underlying Operating System name.
+ * Currently, only the latest Windows versions are implemented.
+ */
+public class OsUtility {
+
+ private static final String WIN_7 = "windows 7";
+ private static final String WIN_VISTA = "windows vista";
+ private static final String WIN_XP = "windows xp";
+
+ private OsUtility() {
+ }
+
+ private static String getOsName() {
+ return System.getProperty("os.name").toLowerCase();
+ }
+
+ public static boolean isWindows7() {
+ return WIN_7.equals(getOsName());
+ }
+
+ public static boolean isWindowsVista() {
+ return WIN_VISTA.equals(getOsName());
+ }
+
+ public static boolean isWindowsXP() {
+ return WIN_XP.equals(getOsName());
+ }
+}
diff --git a/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/ScoutAssert.java b/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/ScoutAssert.java
index af55f05482..6f6ae0d4ae 100644
--- a/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/ScoutAssert.java
+++ b/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/ScoutAssert.java
@@ -1,103 +1,103 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.testing.shared;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashSet;
-
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.job.JobEx;
-import org.junit.Assert;
-
-public final class ScoutAssert {
-
- private ScoutAssert() {
- }
-
- public static <T> void assertSetEquals(T[] expected, Collection<T> actual) {
- assertSetEquals(new ArrayList<T>(Arrays.asList(expected)), actual);
- }
-
- public static <T> void assertSetEquals(Collection<T> expected, Collection<T> actual) {
- if (actual == null) {
- Assert.fail(format("sets are not equal", expected, actual));
- }
- if (!new HashSet<T>(expected).equals(new HashSet<T>(actual))) {
- Assert.fail(format("sets are not equal", expected, actual));
- }
- }
-
- public static <T> void assertListEquals(T[] expected, Collection<T> actual) {
- assertListEquals(new ArrayList<T>(Arrays.asList(expected)), actual);
- }
-
- public static <T> void assertListEquals(Collection<T> expected, Collection<T> actual) {
- if (actual == null) {
- Assert.fail(format("lists are not equal", expected, actual));
- }
- if (!new ArrayList<T>(expected).equals(new ArrayList<T>(actual))) {
- Assert.fail(format("lists are not equal", expected, actual));
- }
- }
-
- public static void assertOrder(Object[] expected, Object[] actual) {
- assertOrder(null, expected, actual);
- }
-
- @SuppressWarnings("null")
- public static void assertOrder(String message, Object[] expected, Object[] actual) {
- if (expected == null && actual == null) {
- return;
- }
- if (expected == null || actual == null) {
- Assert.fail();
- }
- int actualIndex = 0;
- expectedLoop: for (Object expectedElement : expected) {
- for (int j = actualIndex; j < actual.length; j++) {
- if (expectedElement.equals(actual[j])) {
- actualIndex = j + 1;
- continue expectedLoop;
- }
- }
- Assert.fail(format(message, expected, actual));
- }
- }
-
- private static String format(String message, Object expected, Object actual) {
- String s = "";
- if (message != null) {
- s = message + " ";
- }
- return s + "expected:<" + expected + "> but was:<" + actual + ">";
- }
-
- public static void jobSuccessfullyCompleted(JobEx job) throws Throwable {
- Assert.assertEquals(job.getState(), Job.NONE);
- try {
- job.throwOnError();
- }
- catch (ProcessingException e) {
- // unpack original exception if required
- if (job.getResult() != null) {
- Throwable originalException = job.getResult().getException();
- if (originalException != null && originalException != e) {
- throw originalException;
- }
- }
- throw e;
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.testing.shared;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.job.JobEx;
+import org.junit.Assert;
+
+public final class ScoutAssert {
+
+ private ScoutAssert() {
+ }
+
+ public static <T> void assertSetEquals(T[] expected, Collection<T> actual) {
+ assertSetEquals(new ArrayList<T>(Arrays.asList(expected)), actual);
+ }
+
+ public static <T> void assertSetEquals(Collection<T> expected, Collection<T> actual) {
+ if (actual == null) {
+ Assert.fail(format("sets are not equal", expected, actual));
+ }
+ if (!new HashSet<T>(expected).equals(new HashSet<T>(actual))) {
+ Assert.fail(format("sets are not equal", expected, actual));
+ }
+ }
+
+ public static <T> void assertListEquals(T[] expected, Collection<T> actual) {
+ assertListEquals(new ArrayList<T>(Arrays.asList(expected)), actual);
+ }
+
+ public static <T> void assertListEquals(Collection<T> expected, Collection<T> actual) {
+ if (actual == null) {
+ Assert.fail(format("lists are not equal", expected, actual));
+ }
+ if (!new ArrayList<T>(expected).equals(new ArrayList<T>(actual))) {
+ Assert.fail(format("lists are not equal", expected, actual));
+ }
+ }
+
+ public static void assertOrder(Object[] expected, Object[] actual) {
+ assertOrder(null, expected, actual);
+ }
+
+ @SuppressWarnings("null")
+ public static void assertOrder(String message, Object[] expected, Object[] actual) {
+ if (expected == null && actual == null) {
+ return;
+ }
+ if (expected == null || actual == null) {
+ Assert.fail();
+ }
+ int actualIndex = 0;
+ expectedLoop: for (Object expectedElement : expected) {
+ for (int j = actualIndex; j < actual.length; j++) {
+ if (expectedElement.equals(actual[j])) {
+ actualIndex = j + 1;
+ continue expectedLoop;
+ }
+ }
+ Assert.fail(format(message, expected, actual));
+ }
+ }
+
+ private static String format(String message, Object expected, Object actual) {
+ String s = "";
+ if (message != null) {
+ s = message + " ";
+ }
+ return s + "expected:<" + expected + "> but was:<" + actual + ">";
+ }
+
+ public static void jobSuccessfullyCompleted(JobEx job) throws Throwable {
+ Assert.assertEquals(job.getState(), Job.NONE);
+ try {
+ job.throwOnError();
+ }
+ catch (ProcessingException e) {
+ // unpack original exception if required
+ if (job.getResult() != null) {
+ Throwable originalException = job.getResult().getException();
+ if (originalException != null && originalException != e) {
+ throw originalException;
+ }
+ }
+ throw e;
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/ScoutJUnitPluginTestApplication.java b/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/ScoutJUnitPluginTestApplication.java
index b196e2b86d..5e701ee46e 100644
--- a/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/ScoutJUnitPluginTestApplication.java
+++ b/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/ScoutJUnitPluginTestApplication.java
@@ -1,29 +1,29 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.testing.shared;
-
-import org.eclipse.equinox.app.IApplication;
-import org.eclipse.equinox.app.IApplicationContext;
-
-public class ScoutJUnitPluginTestApplication implements IApplication {
-
- @Override
- public Object start(IApplicationContext context) throws Exception {
- ScoutJUnitPluginTestExecutor scoutJUnitPluginTestExecutor = new ScoutJUnitPluginTestExecutor();
- int exitCode = scoutJUnitPluginTestExecutor.runAllTests();
- return exitCode;
- }
-
- @Override
- public void stop() {
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.testing.shared;
+
+import org.eclipse.equinox.app.IApplication;
+import org.eclipse.equinox.app.IApplicationContext;
+
+public class ScoutJUnitPluginTestApplication implements IApplication {
+
+ @Override
+ public Object start(IApplicationContext context) throws Exception {
+ ScoutJUnitPluginTestExecutor scoutJUnitPluginTestExecutor = new ScoutJUnitPluginTestExecutor();
+ int exitCode = scoutJUnitPluginTestExecutor.runAllTests();
+ return exitCode;
+ }
+
+ @Override
+ public void stop() {
+ }
+
+}
diff --git a/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/ScoutJUnitPluginTestExecutor.java b/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/ScoutJUnitPluginTestExecutor.java
index ca176f88fb..9b40f4c46a 100644
--- a/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/ScoutJUnitPluginTestExecutor.java
+++ b/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/ScoutJUnitPluginTestExecutor.java
@@ -1,375 +1,375 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.testing.shared;
-
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.PrintStream;
-import java.util.Properties;
-import java.util.regex.Pattern;
-
-import junit.framework.JUnit4TestAdapter;
-import junit.framework.TestResult;
-
-import org.apache.tools.ant.taskdefs.optional.junit.JUnitResultFormatter;
-import org.apache.tools.ant.taskdefs.optional.junit.JUnitTest;
-import org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.equinox.app.IApplication;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.TypeCastUtility;
-import org.eclipse.scout.commons.prefs.UserScope;
-import org.eclipse.scout.commons.runtime.BundleBrowser;
-
-/**
- * Runner for JUnit Plug-in tests.
- * <p>
- * <b>Note:</b>This class is similar to Eclipse's test framework. It is however built on top of JUnit4 and runs with
- * Eclipse version 3.5 and above. Additionally it does not require a test suite that lists all tests to be executed but
- * collects them using Scout's {@link BundleBrowser}.
- */
-public class ScoutJUnitPluginTestExecutor {
- private static final String DUMMY_TESTSUITE_NAME = "FRAMEWORK.INIT";
-
- public static final String JUNIT_REPORTS_DIR_ARG_NAME = "junitReportsDir";
- public static final String FAIL_ON_ERROR_ARG_NAME = "failOnError";
- public static final String HALT_ON_FAILURE_ARG_NAME = "haltOnFailure";
- public static final String BUNDLE_NAME_INCLUDE_FILTER_ARG_NAME = "bundleNameIncludeFilter";
- public static final String BUNDLE_NAME_EXCLUDE_FILTER_ARG_NAME = "bundleNameExcludeFilter";
- public static final String CLASS_NAME_INCLUDE_FILTER_ARG_NAME = "classNameIncludeFilter";
- public static final String CLASS_NAME_EXCLUDE_FILTER_ARG_NAME = "classNameExcludeFilter";
-
- public static final Integer EXIT_CODE_OK = IApplication.EXIT_OK;
- public static final Integer EXIT_CODE_TESTS_FAILED = 1;
- public static final Integer EXIT_CODE_ERRORS_OCCURRED = 2;
-
- private final String m_reportsDir;
- private final boolean m_failOnError;
- private final boolean m_haltOnFailure;
- private final Pattern[] m_bundleNameIncludePatterns;
- private final Pattern[] m_bundleNameExcludePatterns;
- private final Pattern[] m_classNameIncludePatterns;
- private final Pattern[] m_classNameExcludePatterns;
- private final String m_launchingProductId;
-
- public ScoutJUnitPluginTestExecutor() {
- this(getReportsDirConfigParameter(), getFailOnErrorConfigParameter(), getHaltOnFailureConfigParameter(),
- getBundleNameIncludePatternsConfigParameter(), getBundleNameExcludePatternsConfigParameter(),
- getClassNameIncludePatternsConfigParameter(), getClassNameExcludePatternsConfigParameter());
- }
-
- public ScoutJUnitPluginTestExecutor(String reportsDir, boolean failOnError, boolean haltOnFailure,
- Pattern[] bundleNameIncludePatterns, Pattern[] bundleNameExcludePatterns,
- Pattern[] classNameIncludePatterns, Pattern[] classNameExcludePatterns) {
-
- m_failOnError = failOnError;
- m_haltOnFailure = haltOnFailure;
- m_bundleNameIncludePatterns = bundleNameIncludePatterns;
- m_bundleNameExcludePatterns = bundleNameExcludePatterns;
- m_classNameIncludePatterns = classNameIncludePatterns;
- m_classNameExcludePatterns = classNameExcludePatterns;
-
- if (reportsDir == null) {
- if (Platform.inDevelopmentMode()) {
- String s = System.getenv("APPDATA");
- if (s == null) {
- s = System.getProperty("user.home");
- }
- reportsDir = s + File.separator + "junit-james";
- System.out.println("In -dev mode: " + JUNIT_REPORTS_DIR_ARG_NAME + " defaults to " + reportsDir);
- }
- else {
- throw new IllegalArgumentException(JUNIT_REPORTS_DIR_ARG_NAME + " must not be null; check if argument '" + JUNIT_REPORTS_DIR_ARG_NAME + "' is set");
- }
- }
-
- m_reportsDir = reportsDir;
- checkAndCreateReportsDir(m_reportsDir);
- String productId = null;
- if (Platform.getProduct() != null) {
- productId = Platform.getProduct().getId();
- }
- m_launchingProductId = productId;
- }
-
- /**
- * Returns the configuration value for the given parameter that is either configured as
- * command line argument or as system property.
- *
- * @param parameterName
- * @return
- */
- private static String getConfigParameter(String parameterName) {
- String commandLineArgumentName = "-" + parameterName + "=";
- for (String arg : Platform.getCommandLineArgs()) {
- if (arg != null && arg.startsWith(commandLineArgumentName)) {
- return arg.substring(commandLineArgumentName.length());
- }
- }
- return System.getProperty(parameterName);
- }
-
- /**
- * Returns the directory where JUnit reports are written to. This default implementation uses the following sources:
- * <ol>
- * <li>Plaltform's command line argument <code>-junitReportsDir=&lt;dir&gt;</code> (e.g.
- * <code>-reportsDir=C:\temp\junitreports</code>)</li>
- * <li>System property with name <code>reportsDir</code> (e.g. <code>-DjunitReportsDir=C:\temp\junitreports</code>)</li>
- * </ol>
- *
- * @param context
- * @return
- */
- private static String getReportsDirConfigParameter() {
- return getConfigParameter(JUNIT_REPORTS_DIR_ARG_NAME);
- }
-
- private static void checkAndCreateReportsDir(String reportsDir) {
- File repDir = new File(reportsDir);
- if (repDir.exists() && repDir.isFile()) {
- throw new IllegalArgumentException("the given reports directory already exists and it is a file");
- }
- repDir.mkdirs();
- }
-
- /**
- * @return Returns an array with the configured bundle name patterns to include.
- * @see JUnitTestClassBrowser#parseFilterPatterns(String)
- */
- private static Pattern[] getBundleNameIncludePatternsConfigParameter() {
- return JUnitTestClassBrowser.parseFilterPatterns(getConfigParameter(BUNDLE_NAME_INCLUDE_FILTER_ARG_NAME));
- }
-
- /**
- * @return Returns an array with the configured bundle name patterns to exclude.
- * @see JUnitTestClassBrowser#parseFilterPatterns(String)
- */
- private static Pattern[] getBundleNameExcludePatternsConfigParameter() {
- return JUnitTestClassBrowser.parseFilterPatterns(getConfigParameter(BUNDLE_NAME_EXCLUDE_FILTER_ARG_NAME));
- }
-
- /**
- * @return Returns an array with the configured class name patterns to include.
- * @see JUnitTestClassBrowser#parseFilterPatterns(String)
- */
- private static Pattern[] getClassNameIncludePatternsConfigParameter() {
- return JUnitTestClassBrowser.parseFilterPatterns(getConfigParameter(CLASS_NAME_INCLUDE_FILTER_ARG_NAME));
- }
-
- /**
- * @return Returns an array with the configured class name patterns to exclude.
- * @see JUnitTestClassBrowser#parseFilterPatterns(String)
- */
- private static Pattern[] getClassNameExcludePatternsConfigParameter() {
- return JUnitTestClassBrowser.parseFilterPatterns(getConfigParameter(CLASS_NAME_EXCLUDE_FILTER_ARG_NAME));
- }
-
- private static boolean getFailOnErrorConfigParameter() {
- return TypeCastUtility.castValue(getConfigParameter(FAIL_ON_ERROR_ARG_NAME), boolean.class);
- }
-
- private static boolean getHaltOnFailureConfigParameter() {
- return TypeCastUtility.castValue(getConfigParameter(HALT_ON_FAILURE_ARG_NAME), boolean.class);
- }
-
- public boolean isFailOnError() {
- return m_failOnError;
- }
-
- public boolean isHaltOnFailure() {
- return m_haltOnFailure;
- }
-
- public String getReportsDir() {
- return m_reportsDir;
- }
-
- public int runAllTests() {
- int exitCode = EXIT_CODE_OK;
- try {
- JUnitTestClassBrowser browser = new JUnitTestClassBrowser();
- browser.setBundleNameIncludePatterns(m_bundleNameIncludePatterns);
- browser.setBundleNameExcludePatterns(m_bundleNameExcludePatterns);
- browser.setClassNameIncludePatterns(m_classNameIncludePatterns);
- browser.setClassNameExcludePatterns(m_classNameExcludePatterns);
- for (Class<?> test : browser.collectAllJUnitTestClasses()) {
- int testResultCode = runTest(test);
- exitCode = Math.max(exitCode, testResultCode);
- if (isHaltOnFailure() && exitCode != EXIT_CODE_OK) {
- break;
- }
- }
- }
- catch (Throwable t) {
- try {
- // create a dummy test suite so that the Exception is reported in the test results
- JUnitResultFormatter formatter = createJUnitResultFormatter(DUMMY_TESTSUITE_NAME);
- JUnitTest dummyTest = new JUnitTest(DUMMY_TESTSUITE_NAME);
- formatter.startTestSuite(dummyTest);
- formatter.addError(null, t);
- formatter.endTestSuite(dummyTest);
- }
- catch (FileNotFoundException e) {
- System.err.println(e);
- }
- exitCode = EXIT_CODE_ERRORS_OCCURRED;
- }
- if (isFailOnError()) {
- return exitCode;
- }
- return EXIT_CODE_OK;
- }
-
- public int runTest(Class<?> testClass) throws FileNotFoundException {
- int result = EXIT_CODE_OK;
-
- //clear preference cache of client
- try {
- new UserScope().getNode("org.eclipse.scout.rt.client").clear();
- }
- catch (Throwable t) {
- t.printStackTrace();
- }
-
- PrintStream sysOut = null;
- PrintStream sysErr = null;
- PrintStream oldSysOut = System.out;
- PrintStream oldSysErr = System.err;
-
- if (Platform.inDevelopmentMode()) {
- System.out.println(getFileNameFor(testClass.getName()));
- }
-
- try {
- // redirect sysout and syserr
- ByteArrayOutputStream outStrm = new ByteArrayOutputStream();
- sysOut = new PrintStream(outStrm);
- ByteArrayOutputStream errStrm = new ByteArrayOutputStream();
- sysErr = new PrintStream(errStrm);
- if (!Platform.inDevelopmentMode()) {
- System.setOut(sysOut);
- System.setErr(sysErr);
- }
-
- // create Ant JUnitTest that executes the test case
- JUnitTest junitTest = createJUnitTest(testClass.getName());
- JUnitResultFormatter formatter = createJUnitResultFormatter(testClass.getName());
-
- // run the test
- long start = System.currentTimeMillis();
- formatter.startTestSuite(junitTest);
-
- TestResult testResult = new TestResult();
- testResult.addListener(formatter);
- try {
- new JUnit4TestAdapter(testClass).run(testResult);
- }
- catch (Throwable t) {
- formatter.addError(null, t);
- result = EXIT_CODE_ERRORS_OCCURRED;
- }
- finally {
- formatter.setSystemOutput(new String(outStrm.toByteArray()));
- formatter.setSystemError(new String(errStrm.toByteArray()));
- junitTest.setCounts(testResult.runCount(), testResult.failureCount(), testResult.errorCount());
- junitTest.setRunTime(System.currentTimeMillis() - start);
- formatter.endTestSuite(junitTest);
- if (result == EXIT_CODE_OK) {
- if (testResult.errorCount() > 0) {
- result = EXIT_CODE_ERRORS_OCCURRED;
- }
- else if (testResult.failureCount() > 0) {
- result = EXIT_CODE_TESTS_FAILED;
- }
- }
- }
- }
- finally {
- if (sysOut != null) {
- sysOut.close();
- sysOut = null;
- }
- if (sysErr != null) {
- sysErr.close();
- sysErr = null;
- }
- System.setOut(oldSysOut);
- System.setErr(oldSysErr);
- }
- if (Platform.inDevelopmentMode()) {
- dumpResult(new File(getReportsDir() + File.separator + getFileNameFor(testClass.getName())), result);
- }
- return result;
- }
-
- /**
- * Creates a new Ant {@link JUnitTest} used to execute the test and for reporting its outcome.
- *
- * @param testName
- * @return
- */
- private JUnitTest createJUnitTest(String testName) {
- JUnitTest junitTest = new JUnitTest(StringUtility.join("-", m_launchingProductId, testName));
- Properties props = new Properties();
- props.putAll(System.getProperties());
- junitTest.setProperties(props);
- return junitTest;
- }
-
- /**
- * Creates a {@link XMLJUnitResultFormatter} that writes its output to a file in the reports directory.
- *
- * @param testName
- * @return
- * @throws FileNotFoundException
- */
- private XMLJUnitResultFormatter createJUnitResultFormatter(String testName) throws FileNotFoundException {
- XMLJUnitResultFormatter formatter = new XMLJUnitResultFormatter();
- formatter.setOutput(new FileOutputStream(getReportsDir() + File.separator + getFileNameFor(testName)));
- return formatter;
- }
-
- private String getFileNameFor(String testName) throws FileNotFoundException {
- if (m_launchingProductId != null) {
- return "TEST-" + m_launchingProductId + "-" + testName + ".xml";
- }
- else {
- return "TEST-" + testName + ".xml";
- }
- }
-
- private void dumpResult(File f, int exitCode) {
- if (f.isFile()) {
- if (exitCode == EXIT_CODE_OK) {
- //nop
- }
- else {
- System.out.println("FAILED " + f.getName());
- try {
- FileInputStream in = new FileInputStream(f);
- byte[] buf = new byte[(int) f.length()];
- in.read(buf);
- in.close();
- System.out.println(new String(buf, 0, buf.length));
- }
- catch (Throwable t) {
- System.out.println("ERROR: " + t);
- }
- if (isHaltOnFailure()) {
- System.exit(exitCode);
- }
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.testing.shared;
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.PrintStream;
+import java.util.Properties;
+import java.util.regex.Pattern;
+
+import junit.framework.JUnit4TestAdapter;
+import junit.framework.TestResult;
+
+import org.apache.tools.ant.taskdefs.optional.junit.JUnitResultFormatter;
+import org.apache.tools.ant.taskdefs.optional.junit.JUnitTest;
+import org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.equinox.app.IApplication;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.TypeCastUtility;
+import org.eclipse.scout.commons.prefs.UserScope;
+import org.eclipse.scout.commons.runtime.BundleBrowser;
+
+/**
+ * Runner for JUnit Plug-in tests.
+ * <p>
+ * <b>Note:</b>This class is similar to Eclipse's test framework. It is however built on top of JUnit4 and runs with
+ * Eclipse version 3.5 and above. Additionally it does not require a test suite that lists all tests to be executed but
+ * collects them using Scout's {@link BundleBrowser}.
+ */
+public class ScoutJUnitPluginTestExecutor {
+ private static final String DUMMY_TESTSUITE_NAME = "FRAMEWORK.INIT";
+
+ public static final String JUNIT_REPORTS_DIR_ARG_NAME = "junitReportsDir";
+ public static final String FAIL_ON_ERROR_ARG_NAME = "failOnError";
+ public static final String HALT_ON_FAILURE_ARG_NAME = "haltOnFailure";
+ public static final String BUNDLE_NAME_INCLUDE_FILTER_ARG_NAME = "bundleNameIncludeFilter";
+ public static final String BUNDLE_NAME_EXCLUDE_FILTER_ARG_NAME = "bundleNameExcludeFilter";
+ public static final String CLASS_NAME_INCLUDE_FILTER_ARG_NAME = "classNameIncludeFilter";
+ public static final String CLASS_NAME_EXCLUDE_FILTER_ARG_NAME = "classNameExcludeFilter";
+
+ public static final Integer EXIT_CODE_OK = IApplication.EXIT_OK;
+ public static final Integer EXIT_CODE_TESTS_FAILED = 1;
+ public static final Integer EXIT_CODE_ERRORS_OCCURRED = 2;
+
+ private final String m_reportsDir;
+ private final boolean m_failOnError;
+ private final boolean m_haltOnFailure;
+ private final Pattern[] m_bundleNameIncludePatterns;
+ private final Pattern[] m_bundleNameExcludePatterns;
+ private final Pattern[] m_classNameIncludePatterns;
+ private final Pattern[] m_classNameExcludePatterns;
+ private final String m_launchingProductId;
+
+ public ScoutJUnitPluginTestExecutor() {
+ this(getReportsDirConfigParameter(), getFailOnErrorConfigParameter(), getHaltOnFailureConfigParameter(),
+ getBundleNameIncludePatternsConfigParameter(), getBundleNameExcludePatternsConfigParameter(),
+ getClassNameIncludePatternsConfigParameter(), getClassNameExcludePatternsConfigParameter());
+ }
+
+ public ScoutJUnitPluginTestExecutor(String reportsDir, boolean failOnError, boolean haltOnFailure,
+ Pattern[] bundleNameIncludePatterns, Pattern[] bundleNameExcludePatterns,
+ Pattern[] classNameIncludePatterns, Pattern[] classNameExcludePatterns) {
+
+ m_failOnError = failOnError;
+ m_haltOnFailure = haltOnFailure;
+ m_bundleNameIncludePatterns = bundleNameIncludePatterns;
+ m_bundleNameExcludePatterns = bundleNameExcludePatterns;
+ m_classNameIncludePatterns = classNameIncludePatterns;
+ m_classNameExcludePatterns = classNameExcludePatterns;
+
+ if (reportsDir == null) {
+ if (Platform.inDevelopmentMode()) {
+ String s = System.getenv("APPDATA");
+ if (s == null) {
+ s = System.getProperty("user.home");
+ }
+ reportsDir = s + File.separator + "junit-james";
+ System.out.println("In -dev mode: " + JUNIT_REPORTS_DIR_ARG_NAME + " defaults to " + reportsDir);
+ }
+ else {
+ throw new IllegalArgumentException(JUNIT_REPORTS_DIR_ARG_NAME + " must not be null; check if argument '" + JUNIT_REPORTS_DIR_ARG_NAME + "' is set");
+ }
+ }
+
+ m_reportsDir = reportsDir;
+ checkAndCreateReportsDir(m_reportsDir);
+ String productId = null;
+ if (Platform.getProduct() != null) {
+ productId = Platform.getProduct().getId();
+ }
+ m_launchingProductId = productId;
+ }
+
+ /**
+ * Returns the configuration value for the given parameter that is either configured as
+ * command line argument or as system property.
+ *
+ * @param parameterName
+ * @return
+ */
+ private static String getConfigParameter(String parameterName) {
+ String commandLineArgumentName = "-" + parameterName + "=";
+ for (String arg : Platform.getCommandLineArgs()) {
+ if (arg != null && arg.startsWith(commandLineArgumentName)) {
+ return arg.substring(commandLineArgumentName.length());
+ }
+ }
+ return System.getProperty(parameterName);
+ }
+
+ /**
+ * Returns the directory where JUnit reports are written to. This default implementation uses the following sources:
+ * <ol>
+ * <li>Plaltform's command line argument <code>-junitReportsDir=&lt;dir&gt;</code> (e.g.
+ * <code>-reportsDir=C:\temp\junitreports</code>)</li>
+ * <li>System property with name <code>reportsDir</code> (e.g. <code>-DjunitReportsDir=C:\temp\junitreports</code>)</li>
+ * </ol>
+ *
+ * @param context
+ * @return
+ */
+ private static String getReportsDirConfigParameter() {
+ return getConfigParameter(JUNIT_REPORTS_DIR_ARG_NAME);
+ }
+
+ private static void checkAndCreateReportsDir(String reportsDir) {
+ File repDir = new File(reportsDir);
+ if (repDir.exists() && repDir.isFile()) {
+ throw new IllegalArgumentException("the given reports directory already exists and it is a file");
+ }
+ repDir.mkdirs();
+ }
+
+ /**
+ * @return Returns an array with the configured bundle name patterns to include.
+ * @see JUnitTestClassBrowser#parseFilterPatterns(String)
+ */
+ private static Pattern[] getBundleNameIncludePatternsConfigParameter() {
+ return JUnitTestClassBrowser.parseFilterPatterns(getConfigParameter(BUNDLE_NAME_INCLUDE_FILTER_ARG_NAME));
+ }
+
+ /**
+ * @return Returns an array with the configured bundle name patterns to exclude.
+ * @see JUnitTestClassBrowser#parseFilterPatterns(String)
+ */
+ private static Pattern[] getBundleNameExcludePatternsConfigParameter() {
+ return JUnitTestClassBrowser.parseFilterPatterns(getConfigParameter(BUNDLE_NAME_EXCLUDE_FILTER_ARG_NAME));
+ }
+
+ /**
+ * @return Returns an array with the configured class name patterns to include.
+ * @see JUnitTestClassBrowser#parseFilterPatterns(String)
+ */
+ private static Pattern[] getClassNameIncludePatternsConfigParameter() {
+ return JUnitTestClassBrowser.parseFilterPatterns(getConfigParameter(CLASS_NAME_INCLUDE_FILTER_ARG_NAME));
+ }
+
+ /**
+ * @return Returns an array with the configured class name patterns to exclude.
+ * @see JUnitTestClassBrowser#parseFilterPatterns(String)
+ */
+ private static Pattern[] getClassNameExcludePatternsConfigParameter() {
+ return JUnitTestClassBrowser.parseFilterPatterns(getConfigParameter(CLASS_NAME_EXCLUDE_FILTER_ARG_NAME));
+ }
+
+ private static boolean getFailOnErrorConfigParameter() {
+ return TypeCastUtility.castValue(getConfigParameter(FAIL_ON_ERROR_ARG_NAME), boolean.class);
+ }
+
+ private static boolean getHaltOnFailureConfigParameter() {
+ return TypeCastUtility.castValue(getConfigParameter(HALT_ON_FAILURE_ARG_NAME), boolean.class);
+ }
+
+ public boolean isFailOnError() {
+ return m_failOnError;
+ }
+
+ public boolean isHaltOnFailure() {
+ return m_haltOnFailure;
+ }
+
+ public String getReportsDir() {
+ return m_reportsDir;
+ }
+
+ public int runAllTests() {
+ int exitCode = EXIT_CODE_OK;
+ try {
+ JUnitTestClassBrowser browser = new JUnitTestClassBrowser();
+ browser.setBundleNameIncludePatterns(m_bundleNameIncludePatterns);
+ browser.setBundleNameExcludePatterns(m_bundleNameExcludePatterns);
+ browser.setClassNameIncludePatterns(m_classNameIncludePatterns);
+ browser.setClassNameExcludePatterns(m_classNameExcludePatterns);
+ for (Class<?> test : browser.collectAllJUnitTestClasses()) {
+ int testResultCode = runTest(test);
+ exitCode = Math.max(exitCode, testResultCode);
+ if (isHaltOnFailure() && exitCode != EXIT_CODE_OK) {
+ break;
+ }
+ }
+ }
+ catch (Throwable t) {
+ try {
+ // create a dummy test suite so that the Exception is reported in the test results
+ JUnitResultFormatter formatter = createJUnitResultFormatter(DUMMY_TESTSUITE_NAME);
+ JUnitTest dummyTest = new JUnitTest(DUMMY_TESTSUITE_NAME);
+ formatter.startTestSuite(dummyTest);
+ formatter.addError(null, t);
+ formatter.endTestSuite(dummyTest);
+ }
+ catch (FileNotFoundException e) {
+ System.err.println(e);
+ }
+ exitCode = EXIT_CODE_ERRORS_OCCURRED;
+ }
+ if (isFailOnError()) {
+ return exitCode;
+ }
+ return EXIT_CODE_OK;
+ }
+
+ public int runTest(Class<?> testClass) throws FileNotFoundException {
+ int result = EXIT_CODE_OK;
+
+ //clear preference cache of client
+ try {
+ new UserScope().getNode("org.eclipse.scout.rt.client").clear();
+ }
+ catch (Throwable t) {
+ t.printStackTrace();
+ }
+
+ PrintStream sysOut = null;
+ PrintStream sysErr = null;
+ PrintStream oldSysOut = System.out;
+ PrintStream oldSysErr = System.err;
+
+ if (Platform.inDevelopmentMode()) {
+ System.out.println(getFileNameFor(testClass.getName()));
+ }
+
+ try {
+ // redirect sysout and syserr
+ ByteArrayOutputStream outStrm = new ByteArrayOutputStream();
+ sysOut = new PrintStream(outStrm);
+ ByteArrayOutputStream errStrm = new ByteArrayOutputStream();
+ sysErr = new PrintStream(errStrm);
+ if (!Platform.inDevelopmentMode()) {
+ System.setOut(sysOut);
+ System.setErr(sysErr);
+ }
+
+ // create Ant JUnitTest that executes the test case
+ JUnitTest junitTest = createJUnitTest(testClass.getName());
+ JUnitResultFormatter formatter = createJUnitResultFormatter(testClass.getName());
+
+ // run the test
+ long start = System.currentTimeMillis();
+ formatter.startTestSuite(junitTest);
+
+ TestResult testResult = new TestResult();
+ testResult.addListener(formatter);
+ try {
+ new JUnit4TestAdapter(testClass).run(testResult);
+ }
+ catch (Throwable t) {
+ formatter.addError(null, t);
+ result = EXIT_CODE_ERRORS_OCCURRED;
+ }
+ finally {
+ formatter.setSystemOutput(new String(outStrm.toByteArray()));
+ formatter.setSystemError(new String(errStrm.toByteArray()));
+ junitTest.setCounts(testResult.runCount(), testResult.failureCount(), testResult.errorCount());
+ junitTest.setRunTime(System.currentTimeMillis() - start);
+ formatter.endTestSuite(junitTest);
+ if (result == EXIT_CODE_OK) {
+ if (testResult.errorCount() > 0) {
+ result = EXIT_CODE_ERRORS_OCCURRED;
+ }
+ else if (testResult.failureCount() > 0) {
+ result = EXIT_CODE_TESTS_FAILED;
+ }
+ }
+ }
+ }
+ finally {
+ if (sysOut != null) {
+ sysOut.close();
+ sysOut = null;
+ }
+ if (sysErr != null) {
+ sysErr.close();
+ sysErr = null;
+ }
+ System.setOut(oldSysOut);
+ System.setErr(oldSysErr);
+ }
+ if (Platform.inDevelopmentMode()) {
+ dumpResult(new File(getReportsDir() + File.separator + getFileNameFor(testClass.getName())), result);
+ }
+ return result;
+ }
+
+ /**
+ * Creates a new Ant {@link JUnitTest} used to execute the test and for reporting its outcome.
+ *
+ * @param testName
+ * @return
+ */
+ private JUnitTest createJUnitTest(String testName) {
+ JUnitTest junitTest = new JUnitTest(StringUtility.join("-", m_launchingProductId, testName));
+ Properties props = new Properties();
+ props.putAll(System.getProperties());
+ junitTest.setProperties(props);
+ return junitTest;
+ }
+
+ /**
+ * Creates a {@link XMLJUnitResultFormatter} that writes its output to a file in the reports directory.
+ *
+ * @param testName
+ * @return
+ * @throws FileNotFoundException
+ */
+ private XMLJUnitResultFormatter createJUnitResultFormatter(String testName) throws FileNotFoundException {
+ XMLJUnitResultFormatter formatter = new XMLJUnitResultFormatter();
+ formatter.setOutput(new FileOutputStream(getReportsDir() + File.separator + getFileNameFor(testName)));
+ return formatter;
+ }
+
+ private String getFileNameFor(String testName) throws FileNotFoundException {
+ if (m_launchingProductId != null) {
+ return "TEST-" + m_launchingProductId + "-" + testName + ".xml";
+ }
+ else {
+ return "TEST-" + testName + ".xml";
+ }
+ }
+
+ private void dumpResult(File f, int exitCode) {
+ if (f.isFile()) {
+ if (exitCode == EXIT_CODE_OK) {
+ //nop
+ }
+ else {
+ System.out.println("FAILED " + f.getName());
+ try {
+ FileInputStream in = new FileInputStream(f);
+ byte[] buf = new byte[(int) f.length()];
+ in.read(buf);
+ in.close();
+ System.out.println(new String(buf, 0, buf.length));
+ }
+ catch (Throwable t) {
+ System.out.println("ERROR: " + t);
+ }
+ if (isHaltOnFailure()) {
+ System.exit(exitCode);
+ }
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/TestingUtility.java b/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/TestingUtility.java
index 058080c0e9..8c8a2d0989 100644
--- a/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/TestingUtility.java
+++ b/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/TestingUtility.java
@@ -1,133 +1,133 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.testing.shared;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Proxy;
-import java.util.ArrayList;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.scout.service.IService;
-import org.eclipse.scout.service.IService2;
-import org.eclipse.scout.service.ServiceUtility;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.Constants;
-import org.osgi.framework.ServiceRegistration;
-
-/**
- *
- */
-public final class TestingUtility {
-
- private TestingUtility() {
- }
-
- /**
- * Wait until the condition returns a non-null result or timeout is reached.
- * <p>
- * When timeout is reached an exception is thrown.
- */
- public static <T> T waitUntil(long timeout, WaitCondition<T> w) throws Throwable {
- long ts = System.currentTimeMillis() + timeout;
- T t = w.run();
- while ((t == null) && System.currentTimeMillis() < ts) {
- Thread.sleep(40);
- t = w.run();
- }
- if (t != null) {
- return t;
- }
- else {
- throw new InterruptedException("timeout reached");
- }
- }
-
- /**
- * Registers a service on behalf of the given bundle context and returns a map with the created service registration
- * objects.
- *
- * @param bundleContext
- * @param ranking
- * @param services
- * @return
- */
- public static List<ServiceRegistration> registerServices(Bundle bundle, int ranking, Object... services) {
- ArrayList<ServiceRegistration> result = new ArrayList<ServiceRegistration>();
- Hashtable<String, Object> initParams = new Hashtable<String, Object>();
- initParams.put(Constants.SERVICE_RANKING, ranking);
- for (Object service : services) {
- ServiceRegistration reg = bundle.getBundleContext().registerService(computeServiceNames(service), service, initParams);
- result.add(reg);
- if (Proxy.isProxyClass(service.getClass())) {
- //nop
- }
- else if (service instanceof IService2) {
- ((IService2) service).initializeService(reg);
- }
- else if (service instanceof IService) {
- ((IService) service).initializeService();
- }
- }
- return result;
- }
-
- private static String[] computeServiceNames(Object service) {
- ArrayList<String> serviceNames = new ArrayList<String>();
- Class<?> implClass = service.getClass();
- while (implClass != null && implClass != Object.class) {
- serviceNames.add(implClass.getName());
- implClass = implClass.getSuperclass();
- }
- for (Class<?> c : ServiceUtility.getInterfacesHierarchy(service.getClass(), Object.class)) {
- serviceNames.add(c.getName());
- }
- return serviceNames.toArray(new String[serviceNames.size()]);
- }
-
- /**
- * Unregisters the given services.
- *
- * @param dynamicServices
- */
- public static void unregisterServices(List<ServiceRegistration> registrationList) {
- if (registrationList == null) {
- return;
- }
- for (ServiceRegistration reg : registrationList) {
- reg.unregister();
- }
- }
-
- /**
- * Clears Java's HTTP authentication cache.
- *
- * @return Returns <code>true</code> if the operation was successful, otherwise <code>false</code>.
- */
- public static boolean clearHttpAuthenticationCache() {
- boolean successful = true;
- try {
- Class<?> c = Class.forName("sun.net.www.protocol.http.AuthCacheValue");
- Field cacheField = c.getDeclaredField("cache");
- cacheField.setAccessible(true);
- Object cache = cacheField.get(null);
- Field hashtableField = cache.getClass().getDeclaredField("hashtable");
- hashtableField.setAccessible(true);
- Map<?, ?> map = (Map<?, ?>) hashtableField.get(cache);
- map.clear();
- }
- catch (Throwable t) {
- successful = false;
- }
- return successful;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.testing.shared;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Proxy;
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.scout.service.IService;
+import org.eclipse.scout.service.IService2;
+import org.eclipse.scout.service.ServiceUtility;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceRegistration;
+
+/**
+ *
+ */
+public final class TestingUtility {
+
+ private TestingUtility() {
+ }
+
+ /**
+ * Wait until the condition returns a non-null result or timeout is reached.
+ * <p>
+ * When timeout is reached an exception is thrown.
+ */
+ public static <T> T waitUntil(long timeout, WaitCondition<T> w) throws Throwable {
+ long ts = System.currentTimeMillis() + timeout;
+ T t = w.run();
+ while ((t == null) && System.currentTimeMillis() < ts) {
+ Thread.sleep(40);
+ t = w.run();
+ }
+ if (t != null) {
+ return t;
+ }
+ else {
+ throw new InterruptedException("timeout reached");
+ }
+ }
+
+ /**
+ * Registers a service on behalf of the given bundle context and returns a map with the created service registration
+ * objects.
+ *
+ * @param bundleContext
+ * @param ranking
+ * @param services
+ * @return
+ */
+ public static List<ServiceRegistration> registerServices(Bundle bundle, int ranking, Object... services) {
+ ArrayList<ServiceRegistration> result = new ArrayList<ServiceRegistration>();
+ Hashtable<String, Object> initParams = new Hashtable<String, Object>();
+ initParams.put(Constants.SERVICE_RANKING, ranking);
+ for (Object service : services) {
+ ServiceRegistration reg = bundle.getBundleContext().registerService(computeServiceNames(service), service, initParams);
+ result.add(reg);
+ if (Proxy.isProxyClass(service.getClass())) {
+ //nop
+ }
+ else if (service instanceof IService2) {
+ ((IService2) service).initializeService(reg);
+ }
+ else if (service instanceof IService) {
+ ((IService) service).initializeService();
+ }
+ }
+ return result;
+ }
+
+ private static String[] computeServiceNames(Object service) {
+ ArrayList<String> serviceNames = new ArrayList<String>();
+ Class<?> implClass = service.getClass();
+ while (implClass != null && implClass != Object.class) {
+ serviceNames.add(implClass.getName());
+ implClass = implClass.getSuperclass();
+ }
+ for (Class<?> c : ServiceUtility.getInterfacesHierarchy(service.getClass(), Object.class)) {
+ serviceNames.add(c.getName());
+ }
+ return serviceNames.toArray(new String[serviceNames.size()]);
+ }
+
+ /**
+ * Unregisters the given services.
+ *
+ * @param dynamicServices
+ */
+ public static void unregisterServices(List<ServiceRegistration> registrationList) {
+ if (registrationList == null) {
+ return;
+ }
+ for (ServiceRegistration reg : registrationList) {
+ reg.unregister();
+ }
+ }
+
+ /**
+ * Clears Java's HTTP authentication cache.
+ *
+ * @return Returns <code>true</code> if the operation was successful, otherwise <code>false</code>.
+ */
+ public static boolean clearHttpAuthenticationCache() {
+ boolean successful = true;
+ try {
+ Class<?> c = Class.forName("sun.net.www.protocol.http.AuthCacheValue");
+ Field cacheField = c.getDeclaredField("cache");
+ cacheField.setAccessible(true);
+ Object cache = cacheField.get(null);
+ Field hashtableField = cache.getClass().getDeclaredField("hashtable");
+ hashtableField.setAccessible(true);
+ Map<?, ?> map = (Map<?, ?>) hashtableField.get(cache);
+ map.clear();
+ }
+ catch (Throwable t) {
+ successful = false;
+ }
+ return successful;
+ }
+}
diff --git a/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/WaitCondition.java b/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/WaitCondition.java
index a52b796d63..4369d50ddc 100644
--- a/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/WaitCondition.java
+++ b/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/WaitCondition.java
@@ -1,21 +1,21 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.testing.shared;
-
-/**
- *
- */
-public interface WaitCondition<T> {
- /**
- * @return non-null to exit wait, null to continue waiting
- */
- T run() throws Throwable;
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.testing.shared;
+
+/**
+ *
+ */
+public interface WaitCondition<T> {
+ /**
+ * @return non-null to exit wait, null to continue waiting
+ */
+ T run() throws Throwable;
+}
diff --git a/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/runner/AbstractRunAftersInSeparateScoutSession.java b/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/runner/AbstractRunAftersInSeparateScoutSession.java
index 215b83f081..69fc2c8d98 100644
--- a/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/runner/AbstractRunAftersInSeparateScoutSession.java
+++ b/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/runner/AbstractRunAftersInSeparateScoutSession.java
@@ -1,91 +1,91 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.testing.shared.runner;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.junit.AfterClass;
-import org.junit.internal.runners.model.MultipleFailureException;
-import org.junit.runners.model.FrameworkMethod;
-import org.junit.runners.model.Statement;
-
-/**
- * Invokes all methods of a test class annotated with {@link AfterClass} in a separate Scout session and therefore in a
- * separate Scout transaction.
- */
-@SuppressWarnings("restriction")
-public abstract class AbstractRunAftersInSeparateScoutSession extends Statement {
- private final Statement m_statement;
- private final Object m_target;
- private final List<FrameworkMethod> m_afters;
-
- public AbstractRunAftersInSeparateScoutSession(Statement statement, List<FrameworkMethod> afters, Object target) {
- m_statement = statement;
- m_afters = afters;
- m_target = target;
- }
-
- @Override
- public void evaluate() throws Throwable {
- List<Throwable> exceptions = new ArrayList<Throwable>();
- try {
- m_statement.evaluate();
- }
- catch (Throwable e) {
- exceptions.add(e);
- }
- try {
- evaluateAftersInScoutSession();
- }
- catch (MultipleFailureException e) {
- exceptions.addAll(e.getFailures());
- }
- catch (Throwable t) {
- exceptions.add(t);
- }
- throwOnExceptions(exceptions);
- }
-
- /**
- * Implementors are required to call the {@link #evaluateAfters()}.
- *
- * @throws Throwable
- */
- protected abstract void evaluateAftersInScoutSession() throws Throwable;
-
- /**
- * Invokes every method annotated with {@link AfterClass} being part of a particular test class.
- *
- * @throws Throwable
- */
- protected void evaluateAfters() throws Throwable {
- List<Throwable> exceptions = new ArrayList<Throwable>();
- for (FrameworkMethod after : m_afters) {
- try {
- after.invokeExplosively(m_target);
- }
- catch (Throwable e) {
- exceptions.add(e);
- }
- }
- throwOnExceptions(exceptions);
- }
-
- private static void throwOnExceptions(List<Throwable> errors) throws Throwable, MultipleFailureException {
- if (!errors.isEmpty()) {
- if (errors.size() == 1) {
- throw errors.get(0);
- }
- throw new MultipleFailureException(errors);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.testing.shared.runner;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.AfterClass;
+import org.junit.internal.runners.model.MultipleFailureException;
+import org.junit.runners.model.FrameworkMethod;
+import org.junit.runners.model.Statement;
+
+/**
+ * Invokes all methods of a test class annotated with {@link AfterClass} in a separate Scout session and therefore in a
+ * separate Scout transaction.
+ */
+@SuppressWarnings("restriction")
+public abstract class AbstractRunAftersInSeparateScoutSession extends Statement {
+ private final Statement m_statement;
+ private final Object m_target;
+ private final List<FrameworkMethod> m_afters;
+
+ public AbstractRunAftersInSeparateScoutSession(Statement statement, List<FrameworkMethod> afters, Object target) {
+ m_statement = statement;
+ m_afters = afters;
+ m_target = target;
+ }
+
+ @Override
+ public void evaluate() throws Throwable {
+ List<Throwable> exceptions = new ArrayList<Throwable>();
+ try {
+ m_statement.evaluate();
+ }
+ catch (Throwable e) {
+ exceptions.add(e);
+ }
+ try {
+ evaluateAftersInScoutSession();
+ }
+ catch (MultipleFailureException e) {
+ exceptions.addAll(e.getFailures());
+ }
+ catch (Throwable t) {
+ exceptions.add(t);
+ }
+ throwOnExceptions(exceptions);
+ }
+
+ /**
+ * Implementors are required to call the {@link #evaluateAfters()}.
+ *
+ * @throws Throwable
+ */
+ protected abstract void evaluateAftersInScoutSession() throws Throwable;
+
+ /**
+ * Invokes every method annotated with {@link AfterClass} being part of a particular test class.
+ *
+ * @throws Throwable
+ */
+ protected void evaluateAfters() throws Throwable {
+ List<Throwable> exceptions = new ArrayList<Throwable>();
+ for (FrameworkMethod after : m_afters) {
+ try {
+ after.invokeExplosively(m_target);
+ }
+ catch (Throwable e) {
+ exceptions.add(e);
+ }
+ }
+ throwOnExceptions(exceptions);
+ }
+
+ private static void throwOnExceptions(List<Throwable> errors) throws Throwable, MultipleFailureException {
+ if (!errors.isEmpty()) {
+ if (errors.size() == 1) {
+ throw errors.get(0);
+ }
+ throw new MultipleFailureException(errors);
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/runner/AbstractRunBeforesInSeparateScoutSession.java b/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/runner/AbstractRunBeforesInSeparateScoutSession.java
index 8c8fdb0820..8da0289b32 100644
--- a/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/runner/AbstractRunBeforesInSeparateScoutSession.java
+++ b/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/runner/AbstractRunBeforesInSeparateScoutSession.java
@@ -1,57 +1,57 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.testing.shared.runner;
-
-import java.util.List;
-
-import org.junit.BeforeClass;
-import org.junit.runners.model.FrameworkMethod;
-import org.junit.runners.model.Statement;
-
-/**
- * Invokes all methods of a test class annotated with {@link BeforeClass} in a separate Scout session and therefore in
- * a separate Scout transaction.
- */
-public abstract class AbstractRunBeforesInSeparateScoutSession extends Statement {
- private final Statement m_statement;
- private final Object m_target;
- private final List<FrameworkMethod> m_befores;
-
- public AbstractRunBeforesInSeparateScoutSession(Statement statement, List<FrameworkMethod> befores, Object target) {
- m_statement = statement;
- m_befores = befores;
- m_target = target;
- }
-
- @Override
- public void evaluate() throws Throwable {
- evaluateBeforesInScoutSession();
- m_statement.evaluate();
- }
-
- /**
- * Implementors are required to call the {@link #evaluateBefores()}.
- *
- * @throws Throwable
- */
- protected abstract void evaluateBeforesInScoutSession() throws Throwable;
-
- /**
- * Invokes every method annotated with {@link BeforeClass} being part of a particular test class.
- *
- * @throws Throwable
- */
- protected void evaluateBefores() throws Throwable {
- for (FrameworkMethod before : m_befores) {
- before.invokeExplosively(m_target);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.testing.shared.runner;
+
+import java.util.List;
+
+import org.junit.BeforeClass;
+import org.junit.runners.model.FrameworkMethod;
+import org.junit.runners.model.Statement;
+
+/**
+ * Invokes all methods of a test class annotated with {@link BeforeClass} in a separate Scout session and therefore in
+ * a separate Scout transaction.
+ */
+public abstract class AbstractRunBeforesInSeparateScoutSession extends Statement {
+ private final Statement m_statement;
+ private final Object m_target;
+ private final List<FrameworkMethod> m_befores;
+
+ public AbstractRunBeforesInSeparateScoutSession(Statement statement, List<FrameworkMethod> befores, Object target) {
+ m_statement = statement;
+ m_befores = befores;
+ m_target = target;
+ }
+
+ @Override
+ public void evaluate() throws Throwable {
+ evaluateBeforesInScoutSession();
+ m_statement.evaluate();
+ }
+
+ /**
+ * Implementors are required to call the {@link #evaluateBefores()}.
+ *
+ * @throws Throwable
+ */
+ protected abstract void evaluateBeforesInScoutSession() throws Throwable;
+
+ /**
+ * Invokes every method annotated with {@link BeforeClass} being part of a particular test class.
+ *
+ * @throws Throwable
+ */
+ protected void evaluateBefores() throws Throwable {
+ for (FrameworkMethod before : m_befores) {
+ before.invokeExplosively(m_target);
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/services/common/code/TestingCodeService.java b/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/services/common/code/TestingCodeService.java
index 68e654fd7c..c9ad71da18 100644
--- a/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/services/common/code/TestingCodeService.java
+++ b/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/services/common/code/TestingCodeService.java
@@ -1,222 +1,222 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.testing.shared.services.common.code;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.commons.holders.Holder;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.commons.osgi.BundleClassDescriptor;
-import org.eclipse.scout.rt.shared.services.common.code.ICode;
-import org.eclipse.scout.rt.shared.services.common.code.ICodeService;
-import org.eclipse.scout.rt.shared.services.common.code.ICodeType;
-import org.eclipse.scout.rt.shared.services.common.code.ICodeVisitor;
-import org.eclipse.scout.service.AbstractService;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.FrameworkUtil;
-
-/**
- * Dynamic code service for testing purposes. Arbitrary code types can be registered dynamically. Consumers must
- * register and remove the service themselves.
- * <p/>
- * <b>Example</b>:
- *
- * <pre>
- * List<ServiceRegistration> reg = TestingUtility.registerServices(Activator.getDefault().getBundle(), 1000, new TestingCodeService(new MyCodeType()));
- * CODES.getCodeType(MyCodeType.class);
- * [...]
- * SERVICES.getService(TestingCodeService.class).addCodeTypes(new OtherCodeType());
- * [..]
- * TestingUtility.unregisterServices(reg);
- * </pre>
- *
- * @since 3.8.0
- */
-public class TestingCodeService extends AbstractService implements ICodeService {
-
- private final static IScoutLogger LOG = ScoutLogManager.getLogger(TestingCodeService.class);
-
- private final Map<Class<? extends ICodeType>, ICodeType<?>> m_codeTypes;
- private final Object m_codeTypeMapLock;
-
- public TestingCodeService(ICodeType<?>... codeTypes) {
- m_codeTypes = new HashMap<Class<? extends ICodeType>, ICodeType<?>>();
- m_codeTypeMapLock = new Object();
- addCodeTypes(codeTypes);
- }
-
- public void addCodeTypes(ICodeType<?>... codeTypes) {
- synchronized (m_codeTypeMapLock) {
- for (ICodeType<?> ct : codeTypes) {
- if (ct != null) {
- m_codeTypes.put(ct.getClass(), ct);
- }
- }
- }
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public <T extends ICodeType> T getCodeType(Class<T> type) {
- synchronized (m_codeTypeMapLock) {
- return (T) m_codeTypes.get(type);
- }
- }
-
- @Override
- public <T extends ICodeType> T getCodeType(Long partitionId, Class<T> type) {
- synchronized (m_codeTypeMapLock) {
- return getCodeType(type);
- }
- }
-
- @Override
- public ICodeType findCodeTypeById(Object id) {
- synchronized (m_codeTypeMapLock) {
- for (ICodeType<?> ct : m_codeTypes.values()) {
- if (CompareUtility.equals(ct.getId(), id)) {
- return ct;
- }
- }
- return null;
- }
- }
-
- @Override
- public ICodeType findCodeTypeById(Long partitionId, Object id) {
- synchronized (m_codeTypeMapLock) {
- return findCodeTypeById(id);
- }
- }
-
- @Override
- public ICodeType[] getCodeTypes(Class... types) {
- synchronized (m_codeTypeMapLock) {
- List<ICodeType> result = new ArrayList<ICodeType>();
- for (Class type : types) {
- @SuppressWarnings("unchecked")
- ICodeType ct = getCodeType(type);
- if (ct != null) {
- result.add(ct);
- }
- }
- return result.toArray(new ICodeType[result.size()]);
- }
- }
-
- @Override
- public ICodeType[] getCodeTypes(Long partitionId, Class... types) {
- synchronized (m_codeTypeMapLock) {
- return getCodeTypes(types);
- }
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public <T extends ICode> T getCode(final Class<T> type) {
- synchronized (m_codeTypeMapLock) {
- if (type == null) {
- return null;
- }
- Class declaringCodeTypeClass = null;
- if (type.getDeclaringClass() != null) {
- // code is inner type of code type or another code
- Class c = type.getDeclaringClass();
- while (c != null && !(ICodeType.class.isAssignableFrom(c))) {
- c = c.getDeclaringClass();
- }
- declaringCodeTypeClass = c;
- }
- if (declaringCodeTypeClass == null) {
- try {
- declaringCodeTypeClass = type.newInstance().getCodeType().getClass();
- }
- catch (Throwable t) {
- LOG.error("find code " + type, t);
- }
- }
- ICodeType codeType = getCodeType(declaringCodeTypeClass);
- final Holder<ICode> codeHolder = new Holder<ICode>(ICode.class);
- ICodeVisitor v = new ICodeVisitor() {
- @Override
- public boolean visit(ICode code, int treeLevel) {
- if (code.getClass() == type) {
- codeHolder.setValue(code);
- return false;
- }
- return true;
- }
- };
- codeType.visit(v);
- return (T) codeHolder.getValue();
- }
- }
-
- @Override
- public <T extends ICode> T getCode(Long partitionId, Class<T> type) {
- synchronized (m_codeTypeMapLock) {
- return getCode(type);
- }
- }
-
- @Override
- public <T extends ICodeType> T reloadCodeType(Class<T> type) {
- synchronized (m_codeTypeMapLock) {
- LOG.warn("reloading code types is not supported by this testing ICodeService");
- return getCodeType(type);
- }
- }
-
- @Override
- public ICodeType[] reloadCodeTypes(Class... types) {
- synchronized (m_codeTypeMapLock) {
- LOG.warn("reloading code types is not supported by this testing ICodeService");
- return getCodeTypes(types);
- }
- }
-
- @Override
- public BundleClassDescriptor[] getAllCodeTypeClasses(String classPrefix) {
- synchronized (m_codeTypeMapLock) {
- List<BundleClassDescriptor> result = new ArrayList<BundleClassDescriptor>();
- for (Class<? extends ICodeType> type : m_codeTypes.keySet()) {
- Bundle bundle = FrameworkUtil.getBundle(type);
- result.add(new BundleClassDescriptor(bundle.getSymbolicName(), type.getName()));
- }
- return result.toArray(new BundleClassDescriptor[result.size()]);
- }
- }
-
- @Override
- public ICodeType[] getAllCodeTypes(String classPrefix) {
- synchronized (m_codeTypeMapLock) {
- List<ICodeType> result = new ArrayList<ICodeType>();
- for (ICodeType ct : m_codeTypes.values()) {
- if (ct.getClass().getName().startsWith(classPrefix)) {
- result.add(ct);
- }
- }
- return result.toArray(new ICodeType[result.size()]);
- }
- }
-
- @Override
- public ICodeType[] getAllCodeTypes(String classPrefix, Long partitionId) {
- synchronized (m_codeTypeMapLock) {
- return getAllCodeTypes(classPrefix);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.testing.shared.services.common.code;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.commons.holders.Holder;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.commons.osgi.BundleClassDescriptor;
+import org.eclipse.scout.rt.shared.services.common.code.ICode;
+import org.eclipse.scout.rt.shared.services.common.code.ICodeService;
+import org.eclipse.scout.rt.shared.services.common.code.ICodeType;
+import org.eclipse.scout.rt.shared.services.common.code.ICodeVisitor;
+import org.eclipse.scout.service.AbstractService;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.FrameworkUtil;
+
+/**
+ * Dynamic code service for testing purposes. Arbitrary code types can be registered dynamically. Consumers must
+ * register and remove the service themselves.
+ * <p/>
+ * <b>Example</b>:
+ *
+ * <pre>
+ * List<ServiceRegistration> reg = TestingUtility.registerServices(Activator.getDefault().getBundle(), 1000, new TestingCodeService(new MyCodeType()));
+ * CODES.getCodeType(MyCodeType.class);
+ * [...]
+ * SERVICES.getService(TestingCodeService.class).addCodeTypes(new OtherCodeType());
+ * [..]
+ * TestingUtility.unregisterServices(reg);
+ * </pre>
+ *
+ * @since 3.8.0
+ */
+public class TestingCodeService extends AbstractService implements ICodeService {
+
+ private final static IScoutLogger LOG = ScoutLogManager.getLogger(TestingCodeService.class);
+
+ private final Map<Class<? extends ICodeType>, ICodeType<?>> m_codeTypes;
+ private final Object m_codeTypeMapLock;
+
+ public TestingCodeService(ICodeType<?>... codeTypes) {
+ m_codeTypes = new HashMap<Class<? extends ICodeType>, ICodeType<?>>();
+ m_codeTypeMapLock = new Object();
+ addCodeTypes(codeTypes);
+ }
+
+ public void addCodeTypes(ICodeType<?>... codeTypes) {
+ synchronized (m_codeTypeMapLock) {
+ for (ICodeType<?> ct : codeTypes) {
+ if (ct != null) {
+ m_codeTypes.put(ct.getClass(), ct);
+ }
+ }
+ }
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public <T extends ICodeType> T getCodeType(Class<T> type) {
+ synchronized (m_codeTypeMapLock) {
+ return (T) m_codeTypes.get(type);
+ }
+ }
+
+ @Override
+ public <T extends ICodeType> T getCodeType(Long partitionId, Class<T> type) {
+ synchronized (m_codeTypeMapLock) {
+ return getCodeType(type);
+ }
+ }
+
+ @Override
+ public ICodeType findCodeTypeById(Object id) {
+ synchronized (m_codeTypeMapLock) {
+ for (ICodeType<?> ct : m_codeTypes.values()) {
+ if (CompareUtility.equals(ct.getId(), id)) {
+ return ct;
+ }
+ }
+ return null;
+ }
+ }
+
+ @Override
+ public ICodeType findCodeTypeById(Long partitionId, Object id) {
+ synchronized (m_codeTypeMapLock) {
+ return findCodeTypeById(id);
+ }
+ }
+
+ @Override
+ public ICodeType[] getCodeTypes(Class... types) {
+ synchronized (m_codeTypeMapLock) {
+ List<ICodeType> result = new ArrayList<ICodeType>();
+ for (Class type : types) {
+ @SuppressWarnings("unchecked")
+ ICodeType ct = getCodeType(type);
+ if (ct != null) {
+ result.add(ct);
+ }
+ }
+ return result.toArray(new ICodeType[result.size()]);
+ }
+ }
+
+ @Override
+ public ICodeType[] getCodeTypes(Long partitionId, Class... types) {
+ synchronized (m_codeTypeMapLock) {
+ return getCodeTypes(types);
+ }
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public <T extends ICode> T getCode(final Class<T> type) {
+ synchronized (m_codeTypeMapLock) {
+ if (type == null) {
+ return null;
+ }
+ Class declaringCodeTypeClass = null;
+ if (type.getDeclaringClass() != null) {
+ // code is inner type of code type or another code
+ Class c = type.getDeclaringClass();
+ while (c != null && !(ICodeType.class.isAssignableFrom(c))) {
+ c = c.getDeclaringClass();
+ }
+ declaringCodeTypeClass = c;
+ }
+ if (declaringCodeTypeClass == null) {
+ try {
+ declaringCodeTypeClass = type.newInstance().getCodeType().getClass();
+ }
+ catch (Throwable t) {
+ LOG.error("find code " + type, t);
+ }
+ }
+ ICodeType codeType = getCodeType(declaringCodeTypeClass);
+ final Holder<ICode> codeHolder = new Holder<ICode>(ICode.class);
+ ICodeVisitor v = new ICodeVisitor() {
+ @Override
+ public boolean visit(ICode code, int treeLevel) {
+ if (code.getClass() == type) {
+ codeHolder.setValue(code);
+ return false;
+ }
+ return true;
+ }
+ };
+ codeType.visit(v);
+ return (T) codeHolder.getValue();
+ }
+ }
+
+ @Override
+ public <T extends ICode> T getCode(Long partitionId, Class<T> type) {
+ synchronized (m_codeTypeMapLock) {
+ return getCode(type);
+ }
+ }
+
+ @Override
+ public <T extends ICodeType> T reloadCodeType(Class<T> type) {
+ synchronized (m_codeTypeMapLock) {
+ LOG.warn("reloading code types is not supported by this testing ICodeService");
+ return getCodeType(type);
+ }
+ }
+
+ @Override
+ public ICodeType[] reloadCodeTypes(Class... types) {
+ synchronized (m_codeTypeMapLock) {
+ LOG.warn("reloading code types is not supported by this testing ICodeService");
+ return getCodeTypes(types);
+ }
+ }
+
+ @Override
+ public BundleClassDescriptor[] getAllCodeTypeClasses(String classPrefix) {
+ synchronized (m_codeTypeMapLock) {
+ List<BundleClassDescriptor> result = new ArrayList<BundleClassDescriptor>();
+ for (Class<? extends ICodeType> type : m_codeTypes.keySet()) {
+ Bundle bundle = FrameworkUtil.getBundle(type);
+ result.add(new BundleClassDescriptor(bundle.getSymbolicName(), type.getName()));
+ }
+ return result.toArray(new BundleClassDescriptor[result.size()]);
+ }
+ }
+
+ @Override
+ public ICodeType[] getAllCodeTypes(String classPrefix) {
+ synchronized (m_codeTypeMapLock) {
+ List<ICodeType> result = new ArrayList<ICodeType>();
+ for (ICodeType ct : m_codeTypes.values()) {
+ if (ct.getClass().getName().startsWith(classPrefix)) {
+ result.add(ct);
+ }
+ }
+ return result.toArray(new ICodeType[result.size()]);
+ }
+ }
+
+ @Override
+ public ICodeType[] getAllCodeTypes(String classPrefix, Long partitionId) {
+ synchronized (m_codeTypeMapLock) {
+ return getAllCodeTypes(classPrefix);
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/services/common/exceptionhandler/ProcessingRuntimeExceptionUnwrappingStatement.java b/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/services/common/exceptionhandler/ProcessingRuntimeExceptionUnwrappingStatement.java
index d72fb2a553..211488c9c8 100644
--- a/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/services/common/exceptionhandler/ProcessingRuntimeExceptionUnwrappingStatement.java
+++ b/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/services/common/exceptionhandler/ProcessingRuntimeExceptionUnwrappingStatement.java
@@ -1,38 +1,38 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.testing.shared.services.common.exceptionhandler;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.junit.runners.model.Statement;
-
-/**
- * JUnit Statement that unpacks a wrapped {@link ProcessingException}.
- *
- * @see WrappingProcessingRuntimeExceptionHandlerService
- */
-public class ProcessingRuntimeExceptionUnwrappingStatement extends Statement {
-
- private final Statement m_delegate;
-
- public ProcessingRuntimeExceptionUnwrappingStatement(Statement delegate) {
- m_delegate = delegate;
- }
-
- @Override
- public void evaluate() throws Throwable {
- try {
- m_delegate.evaluate();
- }
- catch (WrappedProcessingRuntimeException e) {
- throw e.getCause();
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.testing.shared.services.common.exceptionhandler;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.junit.runners.model.Statement;
+
+/**
+ * JUnit Statement that unpacks a wrapped {@link ProcessingException}.
+ *
+ * @see WrappingProcessingRuntimeExceptionHandlerService
+ */
+public class ProcessingRuntimeExceptionUnwrappingStatement extends Statement {
+
+ private final Statement m_delegate;
+
+ public ProcessingRuntimeExceptionUnwrappingStatement(Statement delegate) {
+ m_delegate = delegate;
+ }
+
+ @Override
+ public void evaluate() throws Throwable {
+ try {
+ m_delegate.evaluate();
+ }
+ catch (WrappedProcessingRuntimeException e) {
+ throw e.getCause();
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/services/common/exceptionhandler/WrappedProcessingRuntimeException.java b/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/services/common/exceptionhandler/WrappedProcessingRuntimeException.java
index cc68a81344..01a1e7b4f5 100644
--- a/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/services/common/exceptionhandler/WrappedProcessingRuntimeException.java
+++ b/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/services/common/exceptionhandler/WrappedProcessingRuntimeException.java
@@ -1,27 +1,27 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.testing.shared.services.common.exceptionhandler;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-
-/**
- * {@link RuntimeException}-wrapper for a {@link ProcessingException}.
- *
- * @see WrappingProcessingRuntimeExceptionHandlerService
- */
-public class WrappedProcessingRuntimeException extends RuntimeException {
-
- private static final long serialVersionUID = 1L;
-
- public WrappedProcessingRuntimeException(ProcessingException cause) {
- super(cause);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.testing.shared.services.common.exceptionhandler;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+
+/**
+ * {@link RuntimeException}-wrapper for a {@link ProcessingException}.
+ *
+ * @see WrappingProcessingRuntimeExceptionHandlerService
+ */
+public class WrappedProcessingRuntimeException extends RuntimeException {
+
+ private static final long serialVersionUID = 1L;
+
+ public WrappedProcessingRuntimeException(ProcessingException cause) {
+ super(cause);
+ }
+}
diff --git a/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/services/common/exceptionhandler/WrappingProcessingRuntimeExceptionHandlerService.java b/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/services/common/exceptionhandler/WrappingProcessingRuntimeExceptionHandlerService.java
index 2ca1017419..5e7fa1fb78 100644
--- a/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/services/common/exceptionhandler/WrappingProcessingRuntimeExceptionHandlerService.java
+++ b/org.eclipse.scout.rt.testing.shared/src/org/eclipse/scout/rt/testing/shared/services/common/exceptionhandler/WrappingProcessingRuntimeExceptionHandlerService.java
@@ -1,28 +1,28 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.testing.shared.services.common.exceptionhandler;
-
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
-import org.eclipse.scout.service.AbstractService;
-
-/**
- * Exception handler service used in JUnit test environments. It exceptions are wrapped into a
- * {@link WrappedProcessingRuntimeException}, rethrown and unpacked by the JUnit statement
- * {@link ProcessingRuntimeExceptionUnwrappingStatement}.
- */
-public class WrappingProcessingRuntimeExceptionHandlerService extends AbstractService implements IExceptionHandlerService {
-
- @Override
- public void handleException(ProcessingException t) {
- throw new WrappedProcessingRuntimeException(t);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.testing.shared.services.common.exceptionhandler;
+
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.shared.services.common.exceptionhandler.IExceptionHandlerService;
+import org.eclipse.scout.service.AbstractService;
+
+/**
+ * Exception handler service used in JUnit test environments. It exceptions are wrapped into a
+ * {@link WrappedProcessingRuntimeException}, rethrown and unpacked by the JUnit statement
+ * {@link ProcessingRuntimeExceptionUnwrappingStatement}.
+ */
+public class WrappingProcessingRuntimeExceptionHandlerService extends AbstractService implements IExceptionHandlerService {
+
+ @Override
+ public void handleException(ProcessingException t) {
+ throw new WrappedProcessingRuntimeException(t);
+ }
+}
diff --git a/org.eclipse.scout.rt.testing.ui.rap/.settings/org.eclipse.pde.core.prefs b/org.eclipse.scout.rt.testing.ui.rap/.settings/org.eclipse.pde.core.prefs
index 94ebd7c994..19430adcc9 100644
--- a/org.eclipse.scout.rt.testing.ui.rap/.settings/org.eclipse.pde.core.prefs
+++ b/org.eclipse.scout.rt.testing.ui.rap/.settings/org.eclipse.pde.core.prefs
@@ -1,3 +1,3 @@
-#Mon Mar 26 13:45:31 CEST 2007
-eclipse.preferences.version=1
-pluginProject.extensions=true
+#Mon Mar 26 13:45:31 CEST 2007
+eclipse.preferences.version=1
+pluginProject.extensions=true
diff --git a/org.eclipse.scout.rt.testing.ui.rap/plugin.xml b/org.eclipse.scout.rt.testing.ui.rap/plugin.xml
index 1556fd3f31..baf875882e 100644
--- a/org.eclipse.scout.rt.testing.ui.rap/plugin.xml
+++ b/org.eclipse.scout.rt.testing.ui.rap/plugin.xml
@@ -1,27 +1,27 @@
-<?xml version="1.0" encoding="UTF-8"?> <!--
- Copyright (c) 2011 BSI Business Systems Integration AG.
- All rights reserved. This program and the accompanying materials
- are made available under the terms of the Eclipse Public License v1.0
- which accompanies this distribution, and is available at
- http://www.eclipse.org/legal/epl-v10.html
-
- Contributors:
- BSI Business Systems Integration AG - initial API and implementation
- -->
+<?xml version="1.0" encoding="UTF-8"?> <!--
+ Copyright (c) 2011 BSI Business Systems Integration AG.
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+ BSI Business Systems Integration AG - initial API and implementation
+ -->
-<plugin>
- <extension
- point="org.eclipse.scout.service.services">
- <service
- class="org.eclipse.scout.rt.testing.ui.rap.RapMockService"
- createImmediately="false">
- </service>
- <service
- class="org.eclipse.scout.rt.client.services.common.icon.IconProviderService"
- createImmediately="false"
- factory="org.eclipse.scout.rt.client.services.ClientServiceFactory"
- ranking="-90">
- </service>
- </extension>
-
-</plugin>
+<plugin>
+ <extension
+ point="org.eclipse.scout.service.services">
+ <service
+ class="org.eclipse.scout.rt.testing.ui.rap.RapMockService"
+ createImmediately="false">
+ </service>
+ <service
+ class="org.eclipse.scout.rt.client.services.common.icon.IconProviderService"
+ createImmediately="false"
+ factory="org.eclipse.scout.rt.client.services.ClientServiceFactory"
+ ranking="-90">
+ </service>
+ </extension>
+
+</plugin>
diff --git a/org.eclipse.scout.rt.testing.ui.rap/src/org/eclipse/scout/rt/testing/ui/rap/Activator.java b/org.eclipse.scout.rt.testing.ui.rap/src/org/eclipse/scout/rt/testing/ui/rap/Activator.java
index 7ff4056651..1dc7ff34cc 100644
--- a/org.eclipse.scout.rt.testing.ui.rap/src/org/eclipse/scout/rt/testing/ui/rap/Activator.java
+++ b/org.eclipse.scout.rt.testing.ui.rap/src/org/eclipse/scout/rt/testing/ui/rap/Activator.java
@@ -1,62 +1,62 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.testing.ui.rap;
-
-import org.eclipse.core.runtime.Plugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends Plugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.scout.rt.testing.ui.swt";
-
- // The shared instance
- private static Activator plugin;
-
- /**
- * The constructor
- */
- public Activator() {
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
- */
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.testing.ui.rap;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.scout.rt.testing.ui.swt";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.testing.ui.rap/src/org/eclipse/scout/rt/testing/ui/rap/JUnitRAPJob.java b/org.eclipse.scout.rt.testing.ui.rap/src/org/eclipse/scout/rt/testing/ui/rap/JUnitRAPJob.java
index d39c798eab..c456a79ad5 100644
--- a/org.eclipse.scout.rt.testing.ui.rap/src/org/eclipse/scout/rt/testing/ui/rap/JUnitRAPJob.java
+++ b/org.eclipse.scout.rt.testing.ui.rap/src/org/eclipse/scout/rt/testing/ui/rap/JUnitRAPJob.java
@@ -1,59 +1,59 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.testing.ui.rap;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.testing.shared.ScoutJUnitPluginTestExecutor;
-import org.eclipse.scout.service.SERVICES;
-import org.eclipse.scout.testing.client.IGuiMockService;
-import org.eclipse.scout.testing.client.TestingClientSessionRegistryService;
-
-/**
- * Runs all @Test annotated methods in all classes and then exit
- * <p>
- * Normally this is called from within the implementing bundle activator in the start method <code><pre>
- * public void start(BundleContext context) throws Exception {
- * super.start(context);
- * plugin = this;
- * new JUnitRAPJob(ClientSession.class).schedule(200);
- * }
- * </pre></code>
- */
-public class JUnitRAPJob extends Job {
- private final Class<? extends IClientSession> m_clientSessionClass;
-
- public JUnitRAPJob(Class<? extends IClientSession> clientSessionClass) {
- super("JUnit RAP Job");
- setSystem(true);
- m_clientSessionClass = clientSessionClass;
- }
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- TestingClientSessionRegistryService testingClientSessionRegistryService = null;
- try {
- testingClientSessionRegistryService = TestingClientSessionRegistryService.registerTestingClientSessionRegistryService();
- //
- ScoutJUnitPluginTestExecutor scoutJUnitPluginTestExecutor = new ScoutJUnitPluginTestExecutor();
- final int code = scoutJUnitPluginTestExecutor.runAllTests();
- ((RapMockService) SERVICES.getService(IGuiMockService.class)).disposeServices();
- System.exit(code);
- return Status.OK_STATUS;
- }
- finally {
- TestingClientSessionRegistryService.unregisterTestingClientSessionRegistryService(testingClientSessionRegistryService);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.testing.ui.rap;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.testing.shared.ScoutJUnitPluginTestExecutor;
+import org.eclipse.scout.service.SERVICES;
+import org.eclipse.scout.testing.client.IGuiMockService;
+import org.eclipse.scout.testing.client.TestingClientSessionRegistryService;
+
+/**
+ * Runs all @Test annotated methods in all classes and then exit
+ * <p>
+ * Normally this is called from within the implementing bundle activator in the start method <code><pre>
+ * public void start(BundleContext context) throws Exception {
+ * super.start(context);
+ * plugin = this;
+ * new JUnitRAPJob(ClientSession.class).schedule(200);
+ * }
+ * </pre></code>
+ */
+public class JUnitRAPJob extends Job {
+ private final Class<? extends IClientSession> m_clientSessionClass;
+
+ public JUnitRAPJob(Class<? extends IClientSession> clientSessionClass) {
+ super("JUnit RAP Job");
+ setSystem(true);
+ m_clientSessionClass = clientSessionClass;
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ TestingClientSessionRegistryService testingClientSessionRegistryService = null;
+ try {
+ testingClientSessionRegistryService = TestingClientSessionRegistryService.registerTestingClientSessionRegistryService();
+ //
+ ScoutJUnitPluginTestExecutor scoutJUnitPluginTestExecutor = new ScoutJUnitPluginTestExecutor();
+ final int code = scoutJUnitPluginTestExecutor.runAllTests();
+ ((RapMockService) SERVICES.getService(IGuiMockService.class)).disposeServices();
+ System.exit(code);
+ return Status.OK_STATUS;
+ }
+ finally {
+ TestingClientSessionRegistryService.unregisterTestingClientSessionRegistryService(testingClientSessionRegistryService);
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.testing.ui.rap/src/org/eclipse/scout/rt/testing/ui/rap/RAPSelenium.java b/org.eclipse.scout.rt.testing.ui.rap/src/org/eclipse/scout/rt/testing/ui/rap/RAPSelenium.java
index abdcd304c4..e90c449e69 100644
--- a/org.eclipse.scout.rt.testing.ui.rap/src/org/eclipse/scout/rt/testing/ui/rap/RAPSelenium.java
+++ b/org.eclipse.scout.rt.testing.ui.rap/src/org/eclipse/scout/rt/testing/ui/rap/RAPSelenium.java
@@ -1,53 +1,53 @@
-package org.eclipse.scout.rt.testing.ui.rap;
-
-import org.openqa.selenium.WebDriver;
-import org.openqa.selenium.WebDriverBackedSelenium;
-
-public class RAPSelenium extends WebDriverBackedSelenium {
-
- public RAPSelenium(WebDriver baseDriver, String baseUrl) {
- super(baseDriver, baseUrl);
-// JavascriptLibrary javascriptLibrary = new JavascriptLibrary();
-// ElementFinder elementFinder = new ElementFinder(javascriptLibrary);
-// AlertOverride alertOverride = new AlertOverride();
-// ((WebDriverCommandProcessor) commandProcessor).addMethod("qxClickAt", new QxClickAt(alertOverride, elementFinder));
- }
-
-// @Override
-// public void click(String locator) {
-// commandProcessor.doCommand("qxClickAt", new String[]{"id=" + locator,});
-// }
-//
-// @Override
-// public String getText(String locator) {
-// return super.getText("id=" + locator);
-// }
-
- public void waitForElementPresent(String locator) {
- for (int second = 0;; second++) {
- if (second >= 60) System.out.println("timeout");
- try {
-// if (isElementPresent("id=" + locator)) break;
- if (isElementPresent(locator)) break;
- }
- catch (Exception e) {
- }
- try {
- Thread.sleep(1000);
- }
- catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
- }
-
- public void clickAndWait(String locator) {
- click(locator);
- try {
- Thread.sleep(1 * 1000);
- }
- catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-}
+package org.eclipse.scout.rt.testing.ui.rap;
+
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebDriverBackedSelenium;
+
+public class RAPSelenium extends WebDriverBackedSelenium {
+
+ public RAPSelenium(WebDriver baseDriver, String baseUrl) {
+ super(baseDriver, baseUrl);
+// JavascriptLibrary javascriptLibrary = new JavascriptLibrary();
+// ElementFinder elementFinder = new ElementFinder(javascriptLibrary);
+// AlertOverride alertOverride = new AlertOverride();
+// ((WebDriverCommandProcessor) commandProcessor).addMethod("qxClickAt", new QxClickAt(alertOverride, elementFinder));
+ }
+
+// @Override
+// public void click(String locator) {
+// commandProcessor.doCommand("qxClickAt", new String[]{"id=" + locator,});
+// }
+//
+// @Override
+// public String getText(String locator) {
+// return super.getText("id=" + locator);
+// }
+
+ public void waitForElementPresent(String locator) {
+ for (int second = 0;; second++) {
+ if (second >= 60) System.out.println("timeout");
+ try {
+// if (isElementPresent("id=" + locator)) break;
+ if (isElementPresent(locator)) break;
+ }
+ catch (Exception e) {
+ }
+ try {
+ Thread.sleep(1000);
+ }
+ catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public void clickAndWait(String locator) {
+ click(locator);
+ try {
+ Thread.sleep(1 * 1000);
+ }
+ catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.testing.ui.rap/src/org/eclipse/scout/rt/testing/ui/rap/RapMock.java b/org.eclipse.scout.rt.testing.ui.rap/src/org/eclipse/scout/rt/testing/ui/rap/RapMock.java
index e129cc5a6f..9ec5f61076 100644
--- a/org.eclipse.scout.rt.testing.ui.rap/src/org/eclipse/scout/rt/testing/ui/rap/RapMock.java
+++ b/org.eclipse.scout.rt.testing.ui.rap/src/org/eclipse/scout/rt/testing/ui/rap/RapMock.java
@@ -1,1395 +1,1395 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.testing.ui.rap;
-
-import java.awt.event.KeyEvent;
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-import java.util.TreeSet;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.atomic.AtomicReference;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.jobs.IJobChangeEvent;
-import org.eclipse.core.runtime.jobs.JobChangeAdapter;
-import org.eclipse.rwt.lifecycle.WidgetUtil;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.beans.IPropertyObserver;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.testing.shared.TestingUtility;
-import org.eclipse.scout.rt.testing.shared.WaitCondition;
-import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
-import org.eclipse.scout.rt.ui.rap.basic.IRwtScoutComposite;
-import org.eclipse.scout.rt.ui.rap.basic.RwtScoutComposite;
-import org.eclipse.scout.rt.ui.rap.ext.IDropDownButtonForPatch;
-import org.eclipse.scout.rt.ui.rap.ext.custom.StyledText;
-import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
-import org.eclipse.scout.testing.client.IGuiMock;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CTabItem;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.swt.widgets.Scrollable;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeItem;
-import org.openqa.selenium.Keys;
-import org.openqa.selenium.WebDriver;
-import org.openqa.selenium.WebElement;
-import org.openqa.selenium.chrome.ChromeDriverService;
-import org.openqa.selenium.firefox.FirefoxDriver;
-import org.openqa.selenium.firefox.FirefoxProfile;
-import org.openqa.selenium.interactions.Actions;
-import org.openqa.selenium.internal.seleniumemulation.ElementFinder;
-import org.openqa.selenium.internal.seleniumemulation.JavascriptLibrary;
-import org.openqa.selenium.remote.DesiredCapabilities;
-import org.openqa.selenium.remote.RemoteWebDriver;
-import org.openqa.selenium.remote.service.DriverService;
-
-/**
- *
- */
-public class RapMock implements IGuiMock {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(RapMock.class);
-
- static interface MockRunnable<T> extends WaitCondition<T> {
- }
-
- private static DriverService m_service = null;
- private WebDriver m_driver;
- private RAPSelenium m_bot;
- private IClientSession m_session;
- private int m_sleepDelay = 40;
-
- private final ElementFinder m_elementFinder = new ElementFinder(new JavascriptLibrary());
- private String m_currentWidgetId = "";
- private WebElement m_currentElement = null;
- private boolean m_modifierPressed = false;
- private Actions m_actionBuilder = null;
- private List<CharSequence> m_keyList = new ArrayList<CharSequence>();
-
- private static boolean useChrome = false;
- private static boolean useFirefox = !useChrome;
- private static boolean useFirebug = false && useFirefox;
-
- public void setClientSession(IClientSession session) {
- m_session = session;
- }
-
- @Override
- public void initializeMock() {
- if (useChrome) {
- m_service = new ChromeDriverService.Builder()
- .usingDriverExecutable(new File("e:/Downloads/java/chromedriver.exe"))
- .usingAnyFreePort()
- .build();
- }
- try {
- if (m_service != null) {
- m_service.start();
- }
- }
- catch (IOException e) {
- throw new IllegalStateException("ChromeDriverService could not be started.", e);
- }
- }
-
- @Override
- public void shutdownMock() {
- if (m_service != null) {
- m_service.stop();
- }
- }
-
- @Override
- public void beforeTest() {
- if (m_service != null) {
- if (useChrome) {
- DesiredCapabilities chrome = DesiredCapabilities.chrome();
- m_driver = new RemoteWebDriver(m_service.getUrl(), chrome);
- }
- }
- else {
- if (useFirefox) {
- System.setProperty("webdriver.firefox.bin", "C:/FirefoxPortableTest_11/App/Firefox/firefox.exe");
- FirefoxProfile firefoxProfile = new FirefoxProfile();
- if (useFirebug) {
- try {
- firefoxProfile.addExtension(new File("E:/Downloads/java/firebug-1.9.2-fx.xpi"));
- firefoxProfile.setPreference("extensions.firebug.currentVersion", "1.9.2"); // Avoid startup screen
-
- firefoxProfile.addExtension(new File("E:/Downloads/java/firepath-0.9.7-fx.xpi"));
- }
- catch (IOException e) {
- throw new IllegalStateException("Could not add/find firefox extensions.", e);
- }
- }
-
- m_driver = new FirefoxDriver(firefoxProfile);
-// m_driver = new FirefoxDriver(new FirefoxProfile(new File("C:/Temp/webdriver-profile")));
- }
- }
- if (m_driver == null) {
- throw new NullPointerException("no driver instantiated!");
- }
- m_bot = new RAPSelenium(m_driver, "http://localhost:8081");
- m_actionBuilder = new Actions(m_bot.getWrappedDriver());
-
- m_bot.open("http://localhost:8081/rap");
- m_bot.waitForElementPresent("w2");
- }
-
- @Override
- public void afterTest() {
- m_driver.quit();
- }
-
- @Override
- public GuiStrategy getStrategy() {
- return GuiStrategy.Rap;
- }
-
- public void setCurrentWidgetId(String currentWidgetId) {
- m_currentWidgetId = currentWidgetId;
-
- m_currentElement = m_elementFinder.findElement(m_bot.getWrappedDriver(), currentWidgetId);
- }
-
- public String getCurrentWidgetId_() {
- return m_currentWidgetId;
- }
-
- public WebElement getCurrentElement() {
- return m_currentElement;
- }
-
- @Override
- public void waitForIdle() {
- if (getDisplay().getThread() == Thread.currentThread()) {
- return;
- }
- //
- for (int pass = 0; pass < 1; pass++) {
- //wait until gui queue is empty
- syncExec(new MockRunnable<Object>() {
- @Override
- public Object run() throws Throwable {
- return null;
- }
- });
- //wait until model queue is empty
- ClientSyncJob idleJob = new ClientSyncJob("Check for idle", m_session) {
- @Override
- protected void runVoid(IProgressMonitor m) throws Throwable {
- }
- };
- idleJob.setSystem(true);
-
- final CountDownLatch idleJobScheduledSignal = new CountDownLatch(1);
- JobChangeAdapter listener = new JobChangeAdapter() {
- @Override
- public void done(IJobChangeEvent event) {
- idleJobScheduledSignal.countDown();
- }
- };
-
- try {
- idleJob.addJobChangeListener(listener);
- idleJob.schedule();
- try {
- idleJobScheduledSignal.await();
- }
- catch (InterruptedException e) {
- throw new IllegalStateException("Interrupted");
- }
- }
- finally {
- idleJob.removeJobChangeListener(listener);
- }
- }
- }
-
- @Override
- public void waitForActiveWindow(final String title) {
- waitUntil(new WaitCondition<Object>() {
- @Override
- public Object run() {
- if (isWindowActive(title)) return true;
- else return null;
- }
- });
- waitForIdle();
- }
-
- @Override
- public void waitForOpenWindow(final String title) {
- waitUntil(new WaitCondition<Object>() {
- @Override
- public Object run() {
- if (isWindowOpen(title)) return true;
- else return null;
- }
- });
- waitForIdle();
- }
-
- @Override
- public int getSleepDelay() {
- return m_sleepDelay;
- }
-
- @Override
- public void setSleepDelay(int sleepDelay) {
- m_sleepDelay = sleepDelay;
- }
-
- @Override
- public void sleep() {
- sleep(getSleepDelay());
- }
-
- @Override
- public void sleep(int millis) {
- //only sleep when NOT in gui thread
- if (getDisplay().getThread() == Thread.currentThread()) {
- return;
- }
- //
- try {
- Thread.sleep(millis);
- }
- catch (InterruptedException e) {
- //nop
- }
- waitForIdle();
- }
-
- @Override
- public boolean isWindowActive(final String title) {
- return syncExec(new MockRunnable<Boolean>() {
- @Override
- public Boolean run() throws Throwable {
- CTabItem view = findWorkbenchView(title);
- if (view != null && view.getParent().getSelection() == view) return true;
- Shell shell = findShell(title);
- if (shell != null && shell == getActiveShell()) return true;
- return false;
- }
- });
- }
-
- @Override
- public boolean isWindowOpen(final String title) {
- return syncExec(new MockRunnable<Boolean>() {
- @Override
- public Boolean run() throws Throwable {
- CTabItem view = findWorkbenchView(title);
- if (view != null) return true;
- Shell shell = findShell(title);
- if (shell != null) return true;
- return false;
- }
- });
- }
-
- @Override
- public void activateWindow(final String title) {
- waitForOpenWindow(title);
- syncExec(new MockRunnable<Object>() {
- @Override
- public Object run() throws Throwable {
- CTabItem view = findWorkbenchView(title);
- if (view != null) {
- view.getParent().setSelection(view);
- return null;
- }
- Shell shell = findShell(title);
- if (shell != null) {
- shell.setActive();
- return null;
- }
- throw new IllegalStateException("There is no view with title " + title);
- }
- });
- waitForIdle();
- }
-
- @Override
- public FieldState getFieldState(FieldType type, int index) {
- final Control c = waitForIndexedField(type, index);
- return syncExec(new MockRunnable<FieldState>() {
- @Override
- public FieldState run() throws Throwable {
- return getFieldStateInternal(c);
- }
- });
- }
-
- @Override
- public FieldState getScoutFieldState(String name) {
- final Control c = waitForScoutField(name);
- return syncExec(new MockRunnable<FieldState>() {
- @Override
- public FieldState run() throws Throwable {
- return getFieldStateInternal(c);
- }
- });
- }
-
- @Override
- public FieldState getScoutFieldContainerState(String name) {
- final Control c = waitForScoutField(name);
- return syncExec(new MockRunnable<FieldState>() {
- @Override
- public FieldState run() throws Throwable {
- IRwtScoutComposite swtScoutComposite = RwtScoutComposite.getCompositeOnWidget(c);
- if (swtScoutComposite == null) {
- return null;
- }
-
- return getFieldStateInternal(swtScoutComposite.getUiContainer());
- }
- });
- }
-
- @Override
- public List<FieldState> getFieldStates(final FieldType type) {
- return syncExec(new MockRunnable<List<FieldState>>() {
- @Override
- public List<FieldState> run() throws Throwable {
- List<FieldState> list = new ArrayList<FieldState>();
- for (Control c : RwtUtility.findChildComponents(getActiveShell(), Control.class)) {
- if (type == null && getFieldTypeOf(c) != null) {
- list.add(getFieldStateInternal(c));
- }
- else if (type != null && getFieldTypeOf(c) == type) {
- list.add(getFieldStateInternal(c));
- }
- }
- return list;
- }
- });
- }
-
- @Override
- public FieldState getFocusFieldState() {
- return syncExec(new MockRunnable<FieldState>() {
- @Override
- public FieldState run() throws Throwable {
- Control c = getDisplay().getFocusControl();
- if (c == null) {
- throw new IllegalStateException("There is no focus owner");
- }
- return getFieldStateInternal(c);
- }
- });
- }
-
- @Override
- public void clickOnPushButton(String text) {
- final Control c = waitForPushButtonWithLabel(text);
- syncExec(new MockRunnable<Object>() {
- @Override
- public Object run() throws Throwable {
- Point p = c.toDisplay(5, 5);
- gotoPoint(p.x, p.y);
- clickLeft();
- return null;
- }
- });
- waitForIdle();
- }
-
- @Override
- public void gotoField(FieldType type, int index) {
- Control c = waitForIndexedField(type, index);
- setCurrentWidgetId(WidgetUtil.getAdapter(c).getId());
- if (FieldType.Text.equals(type)) {
- setCurrentWidgetId(new StringBuffer("//*[@id=\"").append(getCurrentWidgetId_()).append("\"]/input").toString());
- }
- }
-
- @Override
- public void gotoScoutField(String name) {
- final Control c = waitForScoutField(name);
- setCurrentWidgetId(WidgetUtil.getAdapter(c).getId());
- if (c instanceof Text) {
- setCurrentWidgetId(new StringBuffer("//*[@id=\"").append(getCurrentWidgetId_()).append("\"]/input").toString());
- }
- }
-
- @Override
- public void gotoTable(int tableIndex, final int rowIndex, final int columnIndex) {
- final Table table = (Table) waitForIndexedField(FieldType.Table, tableIndex);
- syncExec(new MockRunnable<Object>() {
- @Override
- public Object run() throws Throwable {
- setCurrentWidgetId(WidgetUtil.getAdapter(table).getId());
- StringBuffer xpathWidgetId = new StringBuffer("//*[@id=\"").append(getCurrentWidgetId_()).append("\"]/div[1]/div[").append(rowIndex + table.getColumnCount()).append("]/div");
- if (columnIndex > 0) {
- xpathWidgetId.append("[").append(columnIndex).append("]");
- }
- setCurrentWidgetId(xpathWidgetId.toString());
- return null;
- }
- });
- }
-
- @Override
- public void gotoTableHeader(int tableIndex, final int columnIndex) {
- final Table table = (Table) waitForIndexedField(FieldType.Table, tableIndex);
- syncExec(new MockRunnable<Object>() {
- @SuppressWarnings("null")
- @Override
- public Object run() throws Throwable {
- int curIndex = -1;
- int accumulatedWidth = 0;
- Rectangle cellBounds = null;
- for (int i : table.getColumnOrder()) {
- TableColumn col = table.getColumn(i);
- //first column is dummy column
- if (i > 0) {
- curIndex++;
- if (curIndex == columnIndex) {
- cellBounds = new Rectangle(accumulatedWidth, 0, col.getWidth(), table.getHeaderHeight());
- break;
- }
- }
- accumulatedWidth += col.getWidth();
- }
- cellBounds.x -= table.getHorizontalBar().getSelection();
- Point p = table.toDisplay(cellBounds.x + (cellBounds.width / 2), cellBounds.y + (cellBounds.height / 2));
- gotoPoint(p.x, p.y);
- return null;
- }
- });
- }
-
- @Override
- public void gotoTree(int treeIndex, final String nodeText) {
- final Tree tree = (Tree) waitForIndexedField(FieldType.Tree, treeIndex);
- syncExec(new MockRunnable<Object>() {
- @Override
- public Object run() throws Throwable {
- setCurrentWidgetId(WidgetUtil.getAdapter(tree).getId());
- TreeItem[] items = tree.getItems();
- for (int i = 0; i < items.length; i++) {
- if (nodeText.equals(items[i].getText())) {
- StringBuffer xpathWidgetId = new StringBuffer("//*[@id=\"").append(getCurrentWidgetId_()).append("\"]/div[1]/div[").append(i + 1).append("]/div[2]");
- setCurrentWidgetId(xpathWidgetId.toString());
- break;
- }
- }
- return null;
- }
- });
- }
-
- @Override
- public void contextMenu(final String... names) {
- //move to menu
- for (int i = 0; i < names.length; i++) {
- String label = names[i];
- final boolean lastItem = i == names.length - 1;
- final MenuItem m = waitForMenuItem(label);
- syncExec(new MockRunnable<Boolean>() {
- @Override
- public Boolean run() throws Throwable {
- //toggle
- if ((m.getStyle() & (SWT.CHECK | SWT.RADIO)) != 0) {
- m.setSelection(!m.getSelection());
- }
- //fire selection
- Event event = new Event();
- event.display = getDisplay();
- event.time = (int) System.currentTimeMillis();
- event.type = SWT.Selection;
- event.widget = m;
- m.notifyListeners(event.type, event);
- if (lastItem) {
- //nop
- }
- return null;
- }
- });
- waitForIdle();
- }
- }
-
- @Override
- public List<String> getTableCells(int tableIndex, final int columnIndex) {
- final Table table = (Table) waitForIndexedField(FieldType.Table, tableIndex);
- return syncExec(new MockRunnable<List<String>>() {
- @Override
- public List<String> run() throws Throwable {
- ArrayList<String> list = new ArrayList<String>();
- for (TableItem row : table.getItems()) {
- //first column is dummy column
- list.add(row.getText(columnIndex + 1));
- }
- return list;
- }
- });
- }
-
- @Override
- public List<String> getTreeNodes(final int treeIndex) {
- final Tree tree = (Tree) waitForIndexedField(FieldType.Tree, treeIndex);
- return syncExec(new MockRunnable<List<String>>() {
- @Override
- public List<String> run() throws Throwable {
- ArrayList<String> list = new ArrayList<String>();
- addTreeItemsRec(tree.getItems(), list);
- return list;
- }
- });
- }
-
- @Override
- public Set<String> getSelectedTableCells(int tableIndex, final int columnIndex) {
- final Table table = (Table) waitForIndexedField(FieldType.Table, tableIndex);
- return syncExec(new MockRunnable<Set<String>>() {
- @Override
- public Set<String> run() throws Throwable {
- TreeSet<String> set = new TreeSet<String>();
- TableItem[] sel = table.getSelection();
- if (sel != null) {
- for (TableItem row : sel) {
- //first column is dummy column
- set.add(row.getText(columnIndex + 1));
- }
- }
- return set;
- }
- });
- }
-
- @Override
- public Set<String> getSelectedTreeNodes(int treeIndex) {
- final Tree tree = (Tree) waitForIndexedField(FieldType.Tree, treeIndex);
- return syncExec(new MockRunnable<Set<String>>() {
- @Override
- public Set<String> run() throws Throwable {
- TreeSet<String> set = new TreeSet<String>();
- TreeItem[] sel = tree.getSelection();
- if (sel != null) {
- for (TreeItem row : sel) {
- set.add(row.getText(0));
- }
- }
- return set;
- }
- });
- }
-
- @Override
- public Set<String> getCheckedTableCells(int tableIndex, final int columnIndex) {
- final Table table = (Table) waitForIndexedField(FieldType.Table, tableIndex);
- return syncExec(new MockRunnable<Set<String>>() {
- @Override
- public Set<String> run() throws Throwable {
- TreeSet<String> check = new TreeSet<String>();
- for (int i = 0; i < table.getItemCount(); i++) {
- TableItem item = table.getItem(i);
- if (item.getData() instanceof ITableRow) {
- ITableRow row = (ITableRow) item.getData();
- if (row.isChecked()) {
- check.add(item.getText(columnIndex + 1));
- }
- }
- }
- return check;
- }
- });
- }
-
- @Override
- public void gotoPoint(int x, int y) {
- final Control c = waitForLocatedField(x, y);
- setCurrentWidgetId(WidgetUtil.getAdapter(c).getId());
- }
-
- @Override
- public void move(int deltaX, int deltaY) {
- //XXX RAP
- throw new UnsupportedOperationException("not implemented");
- }
-
- @Override
- public void clickLeft() {
- m_bot.clickAndWait(getCurrentWidgetId_());
- syncExec(new MockRunnable<Object>() {
- @Override
- public Object run() throws Throwable {
- Control focusControl = Display.getCurrent().getFocusControl();
- setCurrentWidgetId(WidgetUtil.getAdapter(focusControl).getId());
- return null;
- }
- });
- }
-
- @Override
- public void clickRight() {
- m_actionBuilder.contextClick(getCurrentElement());
- m_actionBuilder.perform();
- waitForIdle();
- }
-
- @Override
- public void drag(int x1, int y1, int x2, int y2) {
- //XXX RAP
- throw new UnsupportedOperationException("not implemented");
- /*
- gotoPoint(x1, y1);
- m_bot.pressLeft();
- gotoPoint(x2, y2);
- m_bot.releaseLeft();
- waitForIdle();
- */
- }
-
- @Override
- public void dragWindowRightBorder(WindowState windowState, int pixelToMoveOnX) {
- int borderSize = 4;
-
- int xPos = windowState.x + windowState.width + borderSize;
- int yPos = windowState.y + windowState.height / 2;
- drag(xPos, yPos, xPos + pixelToMoveOnX, yPos);
- }
-
- @Override
- public void typeText(final String text) {
- if (m_modifierPressed) {
- m_actionBuilder.sendKeys(text.toUpperCase());
-// m_bot.typeKeys(getCurrentWidgetId(), text);
-// m_keyList.add(text);
- }
- else {
- m_actionBuilder.sendKeys(text).perform();
- waitForIdle();
- }
- }
-
- @Override
- public void paste(String text) {
- //XXX RAP
- throw new UnsupportedOperationException("not implemented");
- /*
- Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(text), null);
- //press paste (ctrl-V)
- m_bot.pressKey(Key.Control);
- m_bot.typeText("v");
- m_bot.releaseKey(Key.Control);
- */
- }
-
- @Override
- public void pressKey(Key key) {
- switch (key) {
- case Shift:
- m_actionBuilder.keyDown(Keys.SHIFT);
- m_modifierPressed = true;
- break;
- case Control:
- m_actionBuilder.keyDown(Keys.CONTROL);
-// m_bot.controlKeyDown();
-// m_bot.keyDownNative("17");
-// m_keyList.add(Keys.CONTROL);
- m_modifierPressed = true;
- break;
- case Alt:
- m_actionBuilder.keyDown(Keys.ALT);
- m_modifierPressed = true;
- break;
- case Windows:
- m_actionBuilder.keyDown(Keys.META);
- m_modifierPressed = true;
- break;
- default:
- m_actionBuilder.sendKeys(toSeleniumKey(key).toString());
- m_actionBuilder.perform();
-// m_bot.keyDown(m_currentWidgetId, toSeleniumKey(key));
- waitForIdle();
- break;
- }
- }
-
- @Override
- public void releaseKey(Key key) {
- switch (key) {
- case Shift:
- m_actionBuilder.keyUp(Keys.SHIFT);
- m_modifierPressed = false;
- break;
- case Control:
- m_actionBuilder.keyUp(Keys.CONTROL);
-// m_bot.controlKeyUp();
-// m_bot.keyUpNative("17");
-// getCurrentElement().sendKeys(m_keyList.toArray(new CharSequence[m_keyList.size()]));
-// m_keyList.clear();
-
-// getCurrentElement().sendKeys(Keys.CONTROL, "a");
- m_modifierPressed = false;
- break;
- case Alt:
- m_actionBuilder.keyUp(Keys.ALT);
- m_modifierPressed = false;
- break;
- case Windows:
- m_actionBuilder.keyUp(Keys.META);
- m_modifierPressed = false;
- break;
- default:
- m_actionBuilder.keyUp(toSeleniumKey(key));
-// m_bot.keyUp(m_currentWidgetId, toSeleniumKey(key));
- break;
- }
- m_actionBuilder.perform();
- waitForIdle();
- }
-
- @Override
- public void typeKey(Key key) {
- if (m_modifierPressed) {
- m_actionBuilder.sendKeys(toSeleniumKey(key)).perform();
- }
- else {
- m_actionBuilder.sendKeys(getCurrentElement(), toSeleniumKey(key)).perform();
-// m_bot.keyPress(toSeleniumKey(key).toString());
- }
- waitForIdle();
- }
-
- @Override
- public WindowState getWindowState(final String title) {
- return syncExec(new MockRunnable<WindowState>() {
- @Override
- public WindowState run() throws Throwable {
- checkActiveShell();
- CTabItem view = findWorkbenchView(title);
- if (view != null) {
- WindowState state = new WindowState();
- Point p = view.getParent().toDisplay(0, 0);
- Point s = view.getParent().getSize();
- state.x = p.x;
- state.y = p.y;
- state.width = s.x;
- state.height = s.y;
- return state;
- }
- Shell shell = findShell(title);
- if (shell != null) {
- Rectangle r = shell.getBounds();
- WindowState state = new WindowState();
- state.x = r.x;
- state.y = r.y;
- state.width = r.width;
- state.height = r.height;
- return state;
- }
- throw new IllegalStateException("Window " + title + " not found");
- }
- });
- }
-
- @Override
- public String getClipboardText() {
- waitForIdle();
- return syncExec(new MockRunnable<String>() {
- @Override
- public String run() throws Throwable {
- //XXX RAP
-// Clipboard b = new Clipboard(getDisplay());
-// return (String) b.getContents(TextTransfer.getInstance());
- return "";
- }
- });
- }
-
- @Override
- public Object internal0(final Object o) {
- return syncExec(new MockRunnable<String>() {
- @Override
- public String run() throws Throwable {
- return null;
- }
- });
- }
-
- protected void checkActiveShell() {
- if (getActiveShell() == null) {
- throw new IllegalStateException("There is no active shell");
- }
- }
-
- protected FieldState getFieldStateInternal(Control c) {
- FieldState state = new FieldState();
- //type
- state.type = getFieldTypeOf(c);
- //scout name
- IPropertyObserver scoutObject = RwtScoutComposite.getScoutModelOnWidget(c);
- state.scoutName = (scoutObject != null ? scoutObject.getClass().getName() : null);
- //focus
- state.focus = (c == getDisplay().getFocusControl());
- //bounds
- Point p = c.toDisplay(0, 0);
- state.x = p.x;
- state.y = p.y;
- state.width = c.getBounds().width;
- state.height = c.getBounds().height;
- //text
- if (c instanceof Label) {
- state.text = ((Label) c).getText();
- }
- if (c instanceof Text) {
- state.text = ((Text) c).getText();
- }
- if (c instanceof StyledText) {
- state.text = ((StyledText) c).getText();
- }
- if (c instanceof Button) {
- state.text = ((Button) c).getText();
- }
- return state;
- }
-
- protected FieldType getFieldTypeOf(Control c) {
- if (c.isDisposed()) return null;
- if (!c.isVisible()) return null;
- //
- if (c instanceof Label) return FieldType.Label;
- if (c instanceof Text) return FieldType.Text;
- if (c instanceof StyledText) return FieldType.Text;
- if (c instanceof Table) return FieldType.Table;
- if (c instanceof Tree) return FieldType.Tree;
- if (c instanceof IDropDownButtonForPatch) return FieldType.DropdownButton;
- if (c instanceof Button) {
- int style = c.getStyle();
- if ((style & SWT.CHECK) != 0) return FieldType.Checkbox;
- else if ((style & SWT.RADIO) != 0) return FieldType.RadioButton;
- else if (c.getParent() instanceof Scrollable) return FieldType.ScrollButton;
- else return FieldType.PushButton;
- }
- return null;
- }
-
- protected String getScoutNameOf(Control c) {
- IPropertyObserver scoutObject = RwtScoutComposite.getScoutModelOnWidget(c);
- if (scoutObject != null) {
- return scoutObject.getClass().getName();
- }
- return null;
- }
-
- protected Display getDisplay() {
- IRwtEnvironment env = (IRwtEnvironment) m_session.getData(IRwtEnvironment.ENVIRONMENT_KEY);
- return env.getDisplay();
- }
-
- protected Shell getActiveShell() {
- return getDisplay().getActiveShell();
- }
-
- protected String cleanButtonLabel(String s) {
- return StringUtility.removeMnemonic(s);
- }
-
- protected TreeItem findTreeItemRec(TreeItem[] items, String nodeText) {
- if (items == null) return null;
- //
- for (TreeItem item : items) {
- if (nodeText.equals(item.getText())) {
- return item;
- }
- TreeItem found = findTreeItemRec(item.getItems(), nodeText);
- if (found != null) {
- return found;
- }
- }
- return null;
- }
-
- protected void addTreeItemsRec(TreeItem[] items, List<String> list) {
- if (items == null) return;
- //
- for (TreeItem item : items) {
- list.add(item.getText(0));
- addTreeItemsRec(item.getItems(), list);
- }
- }
-
- protected List<Composite> enumerateParentContainers() {
- return syncExec(new MockRunnable<ArrayList<Composite>>() {
- @Override
- public ArrayList<Composite> run() throws Throwable {
- ArrayList<Composite> list = new ArrayList<Composite>();
- for (Shell shell : getDisplay().getShells()) {
- if (shell.isVisible()) {
- list.add(shell);
- }
- }
- return list;
- }
- });
- }
-
- protected Shell findShell(final String title) {
- for (Shell shell : getDisplay().getShells()) {
- if (title.equals(shell.getText())) {
- return shell;
- }
- }
- return null;
- }
-
- protected CTabItem findWorkbenchView(final String title) {
- //XXX RAP
-// Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();XXX RAP
-// if (shell != null) {
-// for (CTabFolder f : SwtUtility.findChildComponents(shell, CTabFolder.class)) {
-// if (f.getItemCount() > 0) {
-// for (CTabItem item : f.getItems()) {
-// if (item.isShowing()) {
-// if (title.equals(cleanButtonLabel(item.getText()))) {
-// return item;
-// }
-// }
-// }
-// }
-// }
-// }
- return null;
- }
-
- protected Control waitForPushButtonWithLabel(final String label) {
- return waitUntil(new WaitCondition<Control>() {
- @Override
- public Control run() {
- return syncExec(new MockRunnable<Control>() {
- @Override
- public Control run() throws Throwable {
- for (Shell shell : getDisplay().getShells()) {
- Composite parent = shell;
- for (Control o : RwtUtility.findChildComponents(parent, Control.class)) {
- if (o instanceof Button) {
- if (cleanButtonLabel(label).equals(cleanButtonLabel(((Button) o).getText()))) return o;
- }
- }
- }
- return null;
- }
- });
- }
- });
- }
-
- protected Control waitForScoutField(final String name) {
- return waitUntil(new WaitCondition<Control>() {
- @Override
- public Control run() {
- return syncExec(new MockRunnable<Control>() {
- @Override
- public Control run() throws Throwable {
- Control lastSecondaryCandidate = null;
- for (Composite parent : enumerateParentContainers()) {
- for (Control c : RwtUtility.findChildComponents(parent, Control.class)) {
- String s = getScoutNameOf(c);
- if (s != null && ("." + s).endsWith("." + name)) {
- lastSecondaryCandidate = c;
- if (getFieldTypeOf(c) != null) {
- //primary match
- return c;
- }
- }
- }
- }
- return lastSecondaryCandidate;
- }
- });
- }
- });
- }
-
- protected Control waitForIndexedField(final FieldType type, final int fieldIndex) {
- return waitUntil(new WaitCondition<Control>() {
- @Override
- public Control run() {
- return syncExec(new MockRunnable<Control>() {
- @Override
- public Control run() throws Throwable {
- List<Composite> parents = enumerateParentContainers();
- for (Composite parent : parents) {
- int index = 0;
- for (Control c : RwtUtility.findChildComponents(parent, Control.class)) {
- if (getFieldTypeOf(c) == type) {
- if (index == fieldIndex) {
- return c;
- }
- index++;
- }
- }
- }
- return null;
- }
- });
- }
- });
- }
-
- protected Control waitForLocatedField(final int x, final int y) {
- return waitUntil(new WaitCondition<Control>() {
- @Override
- public Control run() {
- return syncExec(new MockRunnable<Control>() {
- @Override
- public Control run() throws Throwable {
- List<Composite> parents = enumerateParentContainers();
- for (Composite parent : parents) {
- for (Control c : RwtUtility.findChildComponents(parent, Control.class, Composite.class)) {
- Rectangle map = getDisplay().map(c, null, c.getBounds());
- if (map.contains(x, y)) {
- return c;
- }
- }
- }
- return null;
- }
- });
- }
- });
- }
-
- protected MenuItem waitForMenuItem(final String name) {
- return waitUntil(new WaitCondition<MenuItem>() {
- @Override
- public MenuItem run() {
- return syncExec(new MockRunnable<MenuItem>() {
- @Override
- public MenuItem run() throws Throwable {
- String label = cleanButtonLabel(name);
- //focus control
- Control focusControl = getDisplay().getFocusControl();
- if (focusControl != null) {
- Menu m = focusControl.getMenu();
- if (m != null) {
- for (MenuItem item : m.getItems()) {
- if (label.equals(cleanButtonLabel(item.getText()))) {
- return item;
- }
- }
- }
- }
- //other controls
- for (Composite parent : enumerateParentContainers()) {
- for (Control c : RwtUtility.findChildComponents(parent, Control.class)) {
- Menu m = c.getMenu();
- if (m != null) {
- for (MenuItem item : m.getItems()) {
- if (label.equals(cleanButtonLabel(item.getText()))) {
- return item;
- }
- }
- }
- }
- }
- //main menu
- for (Shell shell : getDisplay().getShells()) {
- Menu m = shell.getMenuBar();
- if (m != null) {
- for (MenuItem item : m.getItems()) {
- if (label.equals(cleanButtonLabel(item.getText()))) {
- return item;
- }
- }
- }
- }
- return null;
- }
- });
- }
- });
-
- }
-
- protected <T> T syncExec(final MockRunnable<T> r) {
- if (getDisplay().getThread() != Thread.currentThread()) {
- final AtomicReference<T> ret = new AtomicReference<T>();
- final AtomicReference<Throwable> ex = new AtomicReference<Throwable>();
- try {
- getDisplay().syncExec(new Runnable() {
- @Override
- public void run() {
- try {
- ret.set(syncExec(r));
- }
- catch (Throwable t) {
- ex.set(t);
- }
- }
- });
- if (ex.get() != null) {
- throw ex.get();
- }
- return ret.get();
- }
- catch (Throwable t) {
- throw new RuntimeException(t);
- }
- }
- //
- try {
- return r.run();
- }
- catch (Throwable t) {
- throw new RuntimeException(t);
- }
- }
-
- protected <T> T waitUntil(final WaitCondition<T> w) {
- try {
- return TestingUtility.waitUntil(WAIT_TIMEOUT, w);
- }
- catch (Throwable t) {
- throw new RuntimeException(t);
- }
- finally {
- waitForIdle();
- }
- }
-
- @Override
- public void pressLeft() {
- throw new UnsupportedOperationException("not implemented");
- }
-
- @Override
- public void releaseLeft() {
- throw new UnsupportedOperationException("not implemented");
- }
-
- @Override
- public void gotoTreeExpandIcon(int treeIndex, String nodeText) {
- throw new UnsupportedOperationException("not implemented");
- }
-
- protected Keys toSeleniumKey(Key key) {
- switch (key) {
- case Shift:
- return Keys.SHIFT;
- case Control:
- return Keys.CONTROL;
- case Alt:
- return Keys.ALT;
- case Delete:
- return Keys.DELETE;
- case Backspace:
- return Keys.BACK_SPACE;
- case Enter:
- return Keys.ENTER;
- case Esc:
- return Keys.ESCAPE;
- case Tab:
- return Keys.TAB;
- case ContextMenu:
- throw new IllegalArgumentException("Unknown keyboard key: " + key);
- case Up:
- return Keys.UP;
- case Down:
- return Keys.DOWN;
- case Left:
- return Keys.LEFT;
- case Right:
- return Keys.RIGHT;
- case Windows:
- return Keys.META;
- case F1:
- return Keys.F1;
- case F2:
- return Keys.F2;
- case F3:
- return Keys.F3;
- case F4:
- return Keys.F4;
- case F5:
- return Keys.F5;
- case F6:
- return Keys.F6;
- case F7:
- return Keys.F7;
- case F8:
- return Keys.F8;
- case F9:
- return Keys.F9;
- case F10:
- return Keys.F10;
- case F11:
- return Keys.F11;
- case F12:
- return Keys.F12;
- case Home:
- return Keys.HOME;
- case End:
- return Keys.END;
- case PageUp:
- return Keys.PAGE_UP;
- case PageDown:
- return Keys.PAGE_DOWN;
- case NumPad0:
- return Keys.NUMPAD0;
- case NumPad1:
- return Keys.NUMPAD1;
- case NumPad2:
- return Keys.NUMPAD2;
- case NumPad3:
- return Keys.NUMPAD3;
- case NumPad4:
- return Keys.NUMPAD4;
- case NumPad5:
- return Keys.NUMPAD5;
- case NumPad6:
- return Keys.NUMPAD6;
- case NumPad7:
- return Keys.NUMPAD7;
- case NumPad8:
- return Keys.NUMPAD8;
- case NumPadMultiply:
- return Keys.MULTIPLY;
- case NumPadDivide:
- return Keys.DIVIDE;
- case NumPadAdd:
- return Keys.ADD;
- case NumPadSubtract:
- return Keys.SUBTRACT;
- case NumPadDecimal:
- return Keys.DECIMAL;
- case NumPadSeparator:
- return Keys.SEPARATOR;
- default:
- throw new IllegalArgumentException("Unknown keyboard key: " + key);
- }
- }
-
- protected int toKeyCode(IGuiMock.Key key) {
- switch (key) {
- case Shift:
- return KeyEvent.VK_SHIFT;
- case Control:
- return KeyEvent.VK_CONTROL;
- case Alt:
- return KeyEvent.VK_ALT;
- case Delete:
- return KeyEvent.VK_DELETE;
- case Backspace:
- return KeyEvent.VK_BACK_SPACE;
- case Enter:
- return KeyEvent.VK_ENTER;
- case Esc:
- return KeyEvent.VK_ESCAPE;
- case Tab:
- return KeyEvent.VK_TAB;
- case ContextMenu:
- return KeyEvent.VK_CONTEXT_MENU;
- case Up:
- return KeyEvent.VK_UP;
- case Down:
- return KeyEvent.VK_DOWN;
- case Left:
- return KeyEvent.VK_LEFT;
- case Right:
- return KeyEvent.VK_RIGHT;
- case Windows:
- return KeyEvent.VK_WINDOWS;
- case F1:
- return KeyEvent.VK_F1;
- case F2:
- return KeyEvent.VK_F2;
- case F3:
- return KeyEvent.VK_F3;
- case F4:
- return KeyEvent.VK_F4;
- case F5:
- return KeyEvent.VK_F5;
- case F6:
- return KeyEvent.VK_F6;
- case F7:
- return KeyEvent.VK_F7;
- case F8:
- return KeyEvent.VK_F8;
- case F9:
- return KeyEvent.VK_F9;
- case F10:
- return KeyEvent.VK_F10;
- case F11:
- return KeyEvent.VK_F11;
- case F12:
- return KeyEvent.VK_F12;
- case Home:
- return KeyEvent.VK_HOME;
- case End:
- return KeyEvent.VK_END;
- case PageUp:
- return KeyEvent.VK_PAGE_UP;
- case PageDown:
- return KeyEvent.VK_PAGE_DOWN;
- case NumPad0:
- return KeyEvent.VK_NUMPAD0;
- case NumPad1:
- return KeyEvent.VK_NUMPAD1;
- case NumPad2:
- return KeyEvent.VK_NUMPAD2;
- case NumPad3:
- return KeyEvent.VK_NUMPAD3;
- case NumPad4:
- return KeyEvent.VK_NUMPAD4;
- case NumPad5:
- return KeyEvent.VK_NUMPAD5;
- case NumPad6:
- return KeyEvent.VK_NUMPAD6;
- case NumPad7:
- return KeyEvent.VK_NUMPAD7;
- case NumPad8:
- return KeyEvent.VK_NUMPAD8;
- case NumPadMultiply:
- return KeyEvent.VK_MULTIPLY;
- case NumPadDivide:
- return KeyEvent.VK_DIVIDE;
- case NumPadAdd:
- return KeyEvent.VK_ADD;
- case NumPadSubtract:
- return KeyEvent.VK_SUBTRACT;
- case NumPadDecimal:
- return KeyEvent.VK_DECIMAL;
- case NumPadSeparator:
- return KeyEvent.VK_SEPARATOR;
- default:
- throw new IllegalArgumentException("Unknown keyboard key: " + key);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.testing.ui.rap;
+
+import java.awt.event.KeyEvent;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.core.runtime.jobs.JobChangeAdapter;
+import org.eclipse.rwt.lifecycle.WidgetUtil;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.beans.IPropertyObserver;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.testing.shared.TestingUtility;
+import org.eclipse.scout.rt.testing.shared.WaitCondition;
+import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
+import org.eclipse.scout.rt.ui.rap.basic.IRwtScoutComposite;
+import org.eclipse.scout.rt.ui.rap.basic.RwtScoutComposite;
+import org.eclipse.scout.rt.ui.rap.ext.IDropDownButtonForPatch;
+import org.eclipse.scout.rt.ui.rap.ext.custom.StyledText;
+import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
+import org.eclipse.scout.testing.client.IGuiMock;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CTabItem;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swt.widgets.Scrollable;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
+import org.openqa.selenium.Keys;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.chrome.ChromeDriverService;
+import org.openqa.selenium.firefox.FirefoxDriver;
+import org.openqa.selenium.firefox.FirefoxProfile;
+import org.openqa.selenium.interactions.Actions;
+import org.openqa.selenium.internal.seleniumemulation.ElementFinder;
+import org.openqa.selenium.internal.seleniumemulation.JavascriptLibrary;
+import org.openqa.selenium.remote.DesiredCapabilities;
+import org.openqa.selenium.remote.RemoteWebDriver;
+import org.openqa.selenium.remote.service.DriverService;
+
+/**
+ *
+ */
+public class RapMock implements IGuiMock {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(RapMock.class);
+
+ static interface MockRunnable<T> extends WaitCondition<T> {
+ }
+
+ private static DriverService m_service = null;
+ private WebDriver m_driver;
+ private RAPSelenium m_bot;
+ private IClientSession m_session;
+ private int m_sleepDelay = 40;
+
+ private final ElementFinder m_elementFinder = new ElementFinder(new JavascriptLibrary());
+ private String m_currentWidgetId = "";
+ private WebElement m_currentElement = null;
+ private boolean m_modifierPressed = false;
+ private Actions m_actionBuilder = null;
+ private List<CharSequence> m_keyList = new ArrayList<CharSequence>();
+
+ private static boolean useChrome = false;
+ private static boolean useFirefox = !useChrome;
+ private static boolean useFirebug = false && useFirefox;
+
+ public void setClientSession(IClientSession session) {
+ m_session = session;
+ }
+
+ @Override
+ public void initializeMock() {
+ if (useChrome) {
+ m_service = new ChromeDriverService.Builder()
+ .usingDriverExecutable(new File("e:/Downloads/java/chromedriver.exe"))
+ .usingAnyFreePort()
+ .build();
+ }
+ try {
+ if (m_service != null) {
+ m_service.start();
+ }
+ }
+ catch (IOException e) {
+ throw new IllegalStateException("ChromeDriverService could not be started.", e);
+ }
+ }
+
+ @Override
+ public void shutdownMock() {
+ if (m_service != null) {
+ m_service.stop();
+ }
+ }
+
+ @Override
+ public void beforeTest() {
+ if (m_service != null) {
+ if (useChrome) {
+ DesiredCapabilities chrome = DesiredCapabilities.chrome();
+ m_driver = new RemoteWebDriver(m_service.getUrl(), chrome);
+ }
+ }
+ else {
+ if (useFirefox) {
+ System.setProperty("webdriver.firefox.bin", "C:/FirefoxPortableTest_11/App/Firefox/firefox.exe");
+ FirefoxProfile firefoxProfile = new FirefoxProfile();
+ if (useFirebug) {
+ try {
+ firefoxProfile.addExtension(new File("E:/Downloads/java/firebug-1.9.2-fx.xpi"));
+ firefoxProfile.setPreference("extensions.firebug.currentVersion", "1.9.2"); // Avoid startup screen
+
+ firefoxProfile.addExtension(new File("E:/Downloads/java/firepath-0.9.7-fx.xpi"));
+ }
+ catch (IOException e) {
+ throw new IllegalStateException("Could not add/find firefox extensions.", e);
+ }
+ }
+
+ m_driver = new FirefoxDriver(firefoxProfile);
+// m_driver = new FirefoxDriver(new FirefoxProfile(new File("C:/Temp/webdriver-profile")));
+ }
+ }
+ if (m_driver == null) {
+ throw new NullPointerException("no driver instantiated!");
+ }
+ m_bot = new RAPSelenium(m_driver, "http://localhost:8081");
+ m_actionBuilder = new Actions(m_bot.getWrappedDriver());
+
+ m_bot.open("http://localhost:8081/rap");
+ m_bot.waitForElementPresent("w2");
+ }
+
+ @Override
+ public void afterTest() {
+ m_driver.quit();
+ }
+
+ @Override
+ public GuiStrategy getStrategy() {
+ return GuiStrategy.Rap;
+ }
+
+ public void setCurrentWidgetId(String currentWidgetId) {
+ m_currentWidgetId = currentWidgetId;
+
+ m_currentElement = m_elementFinder.findElement(m_bot.getWrappedDriver(), currentWidgetId);
+ }
+
+ public String getCurrentWidgetId_() {
+ return m_currentWidgetId;
+ }
+
+ public WebElement getCurrentElement() {
+ return m_currentElement;
+ }
+
+ @Override
+ public void waitForIdle() {
+ if (getDisplay().getThread() == Thread.currentThread()) {
+ return;
+ }
+ //
+ for (int pass = 0; pass < 1; pass++) {
+ //wait until gui queue is empty
+ syncExec(new MockRunnable<Object>() {
+ @Override
+ public Object run() throws Throwable {
+ return null;
+ }
+ });
+ //wait until model queue is empty
+ ClientSyncJob idleJob = new ClientSyncJob("Check for idle", m_session) {
+ @Override
+ protected void runVoid(IProgressMonitor m) throws Throwable {
+ }
+ };
+ idleJob.setSystem(true);
+
+ final CountDownLatch idleJobScheduledSignal = new CountDownLatch(1);
+ JobChangeAdapter listener = new JobChangeAdapter() {
+ @Override
+ public void done(IJobChangeEvent event) {
+ idleJobScheduledSignal.countDown();
+ }
+ };
+
+ try {
+ idleJob.addJobChangeListener(listener);
+ idleJob.schedule();
+ try {
+ idleJobScheduledSignal.await();
+ }
+ catch (InterruptedException e) {
+ throw new IllegalStateException("Interrupted");
+ }
+ }
+ finally {
+ idleJob.removeJobChangeListener(listener);
+ }
+ }
+ }
+
+ @Override
+ public void waitForActiveWindow(final String title) {
+ waitUntil(new WaitCondition<Object>() {
+ @Override
+ public Object run() {
+ if (isWindowActive(title)) return true;
+ else return null;
+ }
+ });
+ waitForIdle();
+ }
+
+ @Override
+ public void waitForOpenWindow(final String title) {
+ waitUntil(new WaitCondition<Object>() {
+ @Override
+ public Object run() {
+ if (isWindowOpen(title)) return true;
+ else return null;
+ }
+ });
+ waitForIdle();
+ }
+
+ @Override
+ public int getSleepDelay() {
+ return m_sleepDelay;
+ }
+
+ @Override
+ public void setSleepDelay(int sleepDelay) {
+ m_sleepDelay = sleepDelay;
+ }
+
+ @Override
+ public void sleep() {
+ sleep(getSleepDelay());
+ }
+
+ @Override
+ public void sleep(int millis) {
+ //only sleep when NOT in gui thread
+ if (getDisplay().getThread() == Thread.currentThread()) {
+ return;
+ }
+ //
+ try {
+ Thread.sleep(millis);
+ }
+ catch (InterruptedException e) {
+ //nop
+ }
+ waitForIdle();
+ }
+
+ @Override
+ public boolean isWindowActive(final String title) {
+ return syncExec(new MockRunnable<Boolean>() {
+ @Override
+ public Boolean run() throws Throwable {
+ CTabItem view = findWorkbenchView(title);
+ if (view != null && view.getParent().getSelection() == view) return true;
+ Shell shell = findShell(title);
+ if (shell != null && shell == getActiveShell()) return true;
+ return false;
+ }
+ });
+ }
+
+ @Override
+ public boolean isWindowOpen(final String title) {
+ return syncExec(new MockRunnable<Boolean>() {
+ @Override
+ public Boolean run() throws Throwable {
+ CTabItem view = findWorkbenchView(title);
+ if (view != null) return true;
+ Shell shell = findShell(title);
+ if (shell != null) return true;
+ return false;
+ }
+ });
+ }
+
+ @Override
+ public void activateWindow(final String title) {
+ waitForOpenWindow(title);
+ syncExec(new MockRunnable<Object>() {
+ @Override
+ public Object run() throws Throwable {
+ CTabItem view = findWorkbenchView(title);
+ if (view != null) {
+ view.getParent().setSelection(view);
+ return null;
+ }
+ Shell shell = findShell(title);
+ if (shell != null) {
+ shell.setActive();
+ return null;
+ }
+ throw new IllegalStateException("There is no view with title " + title);
+ }
+ });
+ waitForIdle();
+ }
+
+ @Override
+ public FieldState getFieldState(FieldType type, int index) {
+ final Control c = waitForIndexedField(type, index);
+ return syncExec(new MockRunnable<FieldState>() {
+ @Override
+ public FieldState run() throws Throwable {
+ return getFieldStateInternal(c);
+ }
+ });
+ }
+
+ @Override
+ public FieldState getScoutFieldState(String name) {
+ final Control c = waitForScoutField(name);
+ return syncExec(new MockRunnable<FieldState>() {
+ @Override
+ public FieldState run() throws Throwable {
+ return getFieldStateInternal(c);
+ }
+ });
+ }
+
+ @Override
+ public FieldState getScoutFieldContainerState(String name) {
+ final Control c = waitForScoutField(name);
+ return syncExec(new MockRunnable<FieldState>() {
+ @Override
+ public FieldState run() throws Throwable {
+ IRwtScoutComposite swtScoutComposite = RwtScoutComposite.getCompositeOnWidget(c);
+ if (swtScoutComposite == null) {
+ return null;
+ }
+
+ return getFieldStateInternal(swtScoutComposite.getUiContainer());
+ }
+ });
+ }
+
+ @Override
+ public List<FieldState> getFieldStates(final FieldType type) {
+ return syncExec(new MockRunnable<List<FieldState>>() {
+ @Override
+ public List<FieldState> run() throws Throwable {
+ List<FieldState> list = new ArrayList<FieldState>();
+ for (Control c : RwtUtility.findChildComponents(getActiveShell(), Control.class)) {
+ if (type == null && getFieldTypeOf(c) != null) {
+ list.add(getFieldStateInternal(c));
+ }
+ else if (type != null && getFieldTypeOf(c) == type) {
+ list.add(getFieldStateInternal(c));
+ }
+ }
+ return list;
+ }
+ });
+ }
+
+ @Override
+ public FieldState getFocusFieldState() {
+ return syncExec(new MockRunnable<FieldState>() {
+ @Override
+ public FieldState run() throws Throwable {
+ Control c = getDisplay().getFocusControl();
+ if (c == null) {
+ throw new IllegalStateException("There is no focus owner");
+ }
+ return getFieldStateInternal(c);
+ }
+ });
+ }
+
+ @Override
+ public void clickOnPushButton(String text) {
+ final Control c = waitForPushButtonWithLabel(text);
+ syncExec(new MockRunnable<Object>() {
+ @Override
+ public Object run() throws Throwable {
+ Point p = c.toDisplay(5, 5);
+ gotoPoint(p.x, p.y);
+ clickLeft();
+ return null;
+ }
+ });
+ waitForIdle();
+ }
+
+ @Override
+ public void gotoField(FieldType type, int index) {
+ Control c = waitForIndexedField(type, index);
+ setCurrentWidgetId(WidgetUtil.getAdapter(c).getId());
+ if (FieldType.Text.equals(type)) {
+ setCurrentWidgetId(new StringBuffer("//*[@id=\"").append(getCurrentWidgetId_()).append("\"]/input").toString());
+ }
+ }
+
+ @Override
+ public void gotoScoutField(String name) {
+ final Control c = waitForScoutField(name);
+ setCurrentWidgetId(WidgetUtil.getAdapter(c).getId());
+ if (c instanceof Text) {
+ setCurrentWidgetId(new StringBuffer("//*[@id=\"").append(getCurrentWidgetId_()).append("\"]/input").toString());
+ }
+ }
+
+ @Override
+ public void gotoTable(int tableIndex, final int rowIndex, final int columnIndex) {
+ final Table table = (Table) waitForIndexedField(FieldType.Table, tableIndex);
+ syncExec(new MockRunnable<Object>() {
+ @Override
+ public Object run() throws Throwable {
+ setCurrentWidgetId(WidgetUtil.getAdapter(table).getId());
+ StringBuffer xpathWidgetId = new StringBuffer("//*[@id=\"").append(getCurrentWidgetId_()).append("\"]/div[1]/div[").append(rowIndex + table.getColumnCount()).append("]/div");
+ if (columnIndex > 0) {
+ xpathWidgetId.append("[").append(columnIndex).append("]");
+ }
+ setCurrentWidgetId(xpathWidgetId.toString());
+ return null;
+ }
+ });
+ }
+
+ @Override
+ public void gotoTableHeader(int tableIndex, final int columnIndex) {
+ final Table table = (Table) waitForIndexedField(FieldType.Table, tableIndex);
+ syncExec(new MockRunnable<Object>() {
+ @SuppressWarnings("null")
+ @Override
+ public Object run() throws Throwable {
+ int curIndex = -1;
+ int accumulatedWidth = 0;
+ Rectangle cellBounds = null;
+ for (int i : table.getColumnOrder()) {
+ TableColumn col = table.getColumn(i);
+ //first column is dummy column
+ if (i > 0) {
+ curIndex++;
+ if (curIndex == columnIndex) {
+ cellBounds = new Rectangle(accumulatedWidth, 0, col.getWidth(), table.getHeaderHeight());
+ break;
+ }
+ }
+ accumulatedWidth += col.getWidth();
+ }
+ cellBounds.x -= table.getHorizontalBar().getSelection();
+ Point p = table.toDisplay(cellBounds.x + (cellBounds.width / 2), cellBounds.y + (cellBounds.height / 2));
+ gotoPoint(p.x, p.y);
+ return null;
+ }
+ });
+ }
+
+ @Override
+ public void gotoTree(int treeIndex, final String nodeText) {
+ final Tree tree = (Tree) waitForIndexedField(FieldType.Tree, treeIndex);
+ syncExec(new MockRunnable<Object>() {
+ @Override
+ public Object run() throws Throwable {
+ setCurrentWidgetId(WidgetUtil.getAdapter(tree).getId());
+ TreeItem[] items = tree.getItems();
+ for (int i = 0; i < items.length; i++) {
+ if (nodeText.equals(items[i].getText())) {
+ StringBuffer xpathWidgetId = new StringBuffer("//*[@id=\"").append(getCurrentWidgetId_()).append("\"]/div[1]/div[").append(i + 1).append("]/div[2]");
+ setCurrentWidgetId(xpathWidgetId.toString());
+ break;
+ }
+ }
+ return null;
+ }
+ });
+ }
+
+ @Override
+ public void contextMenu(final String... names) {
+ //move to menu
+ for (int i = 0; i < names.length; i++) {
+ String label = names[i];
+ final boolean lastItem = i == names.length - 1;
+ final MenuItem m = waitForMenuItem(label);
+ syncExec(new MockRunnable<Boolean>() {
+ @Override
+ public Boolean run() throws Throwable {
+ //toggle
+ if ((m.getStyle() & (SWT.CHECK | SWT.RADIO)) != 0) {
+ m.setSelection(!m.getSelection());
+ }
+ //fire selection
+ Event event = new Event();
+ event.display = getDisplay();
+ event.time = (int) System.currentTimeMillis();
+ event.type = SWT.Selection;
+ event.widget = m;
+ m.notifyListeners(event.type, event);
+ if (lastItem) {
+ //nop
+ }
+ return null;
+ }
+ });
+ waitForIdle();
+ }
+ }
+
+ @Override
+ public List<String> getTableCells(int tableIndex, final int columnIndex) {
+ final Table table = (Table) waitForIndexedField(FieldType.Table, tableIndex);
+ return syncExec(new MockRunnable<List<String>>() {
+ @Override
+ public List<String> run() throws Throwable {
+ ArrayList<String> list = new ArrayList<String>();
+ for (TableItem row : table.getItems()) {
+ //first column is dummy column
+ list.add(row.getText(columnIndex + 1));
+ }
+ return list;
+ }
+ });
+ }
+
+ @Override
+ public List<String> getTreeNodes(final int treeIndex) {
+ final Tree tree = (Tree) waitForIndexedField(FieldType.Tree, treeIndex);
+ return syncExec(new MockRunnable<List<String>>() {
+ @Override
+ public List<String> run() throws Throwable {
+ ArrayList<String> list = new ArrayList<String>();
+ addTreeItemsRec(tree.getItems(), list);
+ return list;
+ }
+ });
+ }
+
+ @Override
+ public Set<String> getSelectedTableCells(int tableIndex, final int columnIndex) {
+ final Table table = (Table) waitForIndexedField(FieldType.Table, tableIndex);
+ return syncExec(new MockRunnable<Set<String>>() {
+ @Override
+ public Set<String> run() throws Throwable {
+ TreeSet<String> set = new TreeSet<String>();
+ TableItem[] sel = table.getSelection();
+ if (sel != null) {
+ for (TableItem row : sel) {
+ //first column is dummy column
+ set.add(row.getText(columnIndex + 1));
+ }
+ }
+ return set;
+ }
+ });
+ }
+
+ @Override
+ public Set<String> getSelectedTreeNodes(int treeIndex) {
+ final Tree tree = (Tree) waitForIndexedField(FieldType.Tree, treeIndex);
+ return syncExec(new MockRunnable<Set<String>>() {
+ @Override
+ public Set<String> run() throws Throwable {
+ TreeSet<String> set = new TreeSet<String>();
+ TreeItem[] sel = tree.getSelection();
+ if (sel != null) {
+ for (TreeItem row : sel) {
+ set.add(row.getText(0));
+ }
+ }
+ return set;
+ }
+ });
+ }
+
+ @Override
+ public Set<String> getCheckedTableCells(int tableIndex, final int columnIndex) {
+ final Table table = (Table) waitForIndexedField(FieldType.Table, tableIndex);
+ return syncExec(new MockRunnable<Set<String>>() {
+ @Override
+ public Set<String> run() throws Throwable {
+ TreeSet<String> check = new TreeSet<String>();
+ for (int i = 0; i < table.getItemCount(); i++) {
+ TableItem item = table.getItem(i);
+ if (item.getData() instanceof ITableRow) {
+ ITableRow row = (ITableRow) item.getData();
+ if (row.isChecked()) {
+ check.add(item.getText(columnIndex + 1));
+ }
+ }
+ }
+ return check;
+ }
+ });
+ }
+
+ @Override
+ public void gotoPoint(int x, int y) {
+ final Control c = waitForLocatedField(x, y);
+ setCurrentWidgetId(WidgetUtil.getAdapter(c).getId());
+ }
+
+ @Override
+ public void move(int deltaX, int deltaY) {
+ //XXX RAP
+ throw new UnsupportedOperationException("not implemented");
+ }
+
+ @Override
+ public void clickLeft() {
+ m_bot.clickAndWait(getCurrentWidgetId_());
+ syncExec(new MockRunnable<Object>() {
+ @Override
+ public Object run() throws Throwable {
+ Control focusControl = Display.getCurrent().getFocusControl();
+ setCurrentWidgetId(WidgetUtil.getAdapter(focusControl).getId());
+ return null;
+ }
+ });
+ }
+
+ @Override
+ public void clickRight() {
+ m_actionBuilder.contextClick(getCurrentElement());
+ m_actionBuilder.perform();
+ waitForIdle();
+ }
+
+ @Override
+ public void drag(int x1, int y1, int x2, int y2) {
+ //XXX RAP
+ throw new UnsupportedOperationException("not implemented");
+ /*
+ gotoPoint(x1, y1);
+ m_bot.pressLeft();
+ gotoPoint(x2, y2);
+ m_bot.releaseLeft();
+ waitForIdle();
+ */
+ }
+
+ @Override
+ public void dragWindowRightBorder(WindowState windowState, int pixelToMoveOnX) {
+ int borderSize = 4;
+
+ int xPos = windowState.x + windowState.width + borderSize;
+ int yPos = windowState.y + windowState.height / 2;
+ drag(xPos, yPos, xPos + pixelToMoveOnX, yPos);
+ }
+
+ @Override
+ public void typeText(final String text) {
+ if (m_modifierPressed) {
+ m_actionBuilder.sendKeys(text.toUpperCase());
+// m_bot.typeKeys(getCurrentWidgetId(), text);
+// m_keyList.add(text);
+ }
+ else {
+ m_actionBuilder.sendKeys(text).perform();
+ waitForIdle();
+ }
+ }
+
+ @Override
+ public void paste(String text) {
+ //XXX RAP
+ throw new UnsupportedOperationException("not implemented");
+ /*
+ Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(text), null);
+ //press paste (ctrl-V)
+ m_bot.pressKey(Key.Control);
+ m_bot.typeText("v");
+ m_bot.releaseKey(Key.Control);
+ */
+ }
+
+ @Override
+ public void pressKey(Key key) {
+ switch (key) {
+ case Shift:
+ m_actionBuilder.keyDown(Keys.SHIFT);
+ m_modifierPressed = true;
+ break;
+ case Control:
+ m_actionBuilder.keyDown(Keys.CONTROL);
+// m_bot.controlKeyDown();
+// m_bot.keyDownNative("17");
+// m_keyList.add(Keys.CONTROL);
+ m_modifierPressed = true;
+ break;
+ case Alt:
+ m_actionBuilder.keyDown(Keys.ALT);
+ m_modifierPressed = true;
+ break;
+ case Windows:
+ m_actionBuilder.keyDown(Keys.META);
+ m_modifierPressed = true;
+ break;
+ default:
+ m_actionBuilder.sendKeys(toSeleniumKey(key).toString());
+ m_actionBuilder.perform();
+// m_bot.keyDown(m_currentWidgetId, toSeleniumKey(key));
+ waitForIdle();
+ break;
+ }
+ }
+
+ @Override
+ public void releaseKey(Key key) {
+ switch (key) {
+ case Shift:
+ m_actionBuilder.keyUp(Keys.SHIFT);
+ m_modifierPressed = false;
+ break;
+ case Control:
+ m_actionBuilder.keyUp(Keys.CONTROL);
+// m_bot.controlKeyUp();
+// m_bot.keyUpNative("17");
+// getCurrentElement().sendKeys(m_keyList.toArray(new CharSequence[m_keyList.size()]));
+// m_keyList.clear();
+
+// getCurrentElement().sendKeys(Keys.CONTROL, "a");
+ m_modifierPressed = false;
+ break;
+ case Alt:
+ m_actionBuilder.keyUp(Keys.ALT);
+ m_modifierPressed = false;
+ break;
+ case Windows:
+ m_actionBuilder.keyUp(Keys.META);
+ m_modifierPressed = false;
+ break;
+ default:
+ m_actionBuilder.keyUp(toSeleniumKey(key));
+// m_bot.keyUp(m_currentWidgetId, toSeleniumKey(key));
+ break;
+ }
+ m_actionBuilder.perform();
+ waitForIdle();
+ }
+
+ @Override
+ public void typeKey(Key key) {
+ if (m_modifierPressed) {
+ m_actionBuilder.sendKeys(toSeleniumKey(key)).perform();
+ }
+ else {
+ m_actionBuilder.sendKeys(getCurrentElement(), toSeleniumKey(key)).perform();
+// m_bot.keyPress(toSeleniumKey(key).toString());
+ }
+ waitForIdle();
+ }
+
+ @Override
+ public WindowState getWindowState(final String title) {
+ return syncExec(new MockRunnable<WindowState>() {
+ @Override
+ public WindowState run() throws Throwable {
+ checkActiveShell();
+ CTabItem view = findWorkbenchView(title);
+ if (view != null) {
+ WindowState state = new WindowState();
+ Point p = view.getParent().toDisplay(0, 0);
+ Point s = view.getParent().getSize();
+ state.x = p.x;
+ state.y = p.y;
+ state.width = s.x;
+ state.height = s.y;
+ return state;
+ }
+ Shell shell = findShell(title);
+ if (shell != null) {
+ Rectangle r = shell.getBounds();
+ WindowState state = new WindowState();
+ state.x = r.x;
+ state.y = r.y;
+ state.width = r.width;
+ state.height = r.height;
+ return state;
+ }
+ throw new IllegalStateException("Window " + title + " not found");
+ }
+ });
+ }
+
+ @Override
+ public String getClipboardText() {
+ waitForIdle();
+ return syncExec(new MockRunnable<String>() {
+ @Override
+ public String run() throws Throwable {
+ //XXX RAP
+// Clipboard b = new Clipboard(getDisplay());
+// return (String) b.getContents(TextTransfer.getInstance());
+ return "";
+ }
+ });
+ }
+
+ @Override
+ public Object internal0(final Object o) {
+ return syncExec(new MockRunnable<String>() {
+ @Override
+ public String run() throws Throwable {
+ return null;
+ }
+ });
+ }
+
+ protected void checkActiveShell() {
+ if (getActiveShell() == null) {
+ throw new IllegalStateException("There is no active shell");
+ }
+ }
+
+ protected FieldState getFieldStateInternal(Control c) {
+ FieldState state = new FieldState();
+ //type
+ state.type = getFieldTypeOf(c);
+ //scout name
+ IPropertyObserver scoutObject = RwtScoutComposite.getScoutModelOnWidget(c);
+ state.scoutName = (scoutObject != null ? scoutObject.getClass().getName() : null);
+ //focus
+ state.focus = (c == getDisplay().getFocusControl());
+ //bounds
+ Point p = c.toDisplay(0, 0);
+ state.x = p.x;
+ state.y = p.y;
+ state.width = c.getBounds().width;
+ state.height = c.getBounds().height;
+ //text
+ if (c instanceof Label) {
+ state.text = ((Label) c).getText();
+ }
+ if (c instanceof Text) {
+ state.text = ((Text) c).getText();
+ }
+ if (c instanceof StyledText) {
+ state.text = ((StyledText) c).getText();
+ }
+ if (c instanceof Button) {
+ state.text = ((Button) c).getText();
+ }
+ return state;
+ }
+
+ protected FieldType getFieldTypeOf(Control c) {
+ if (c.isDisposed()) return null;
+ if (!c.isVisible()) return null;
+ //
+ if (c instanceof Label) return FieldType.Label;
+ if (c instanceof Text) return FieldType.Text;
+ if (c instanceof StyledText) return FieldType.Text;
+ if (c instanceof Table) return FieldType.Table;
+ if (c instanceof Tree) return FieldType.Tree;
+ if (c instanceof IDropDownButtonForPatch) return FieldType.DropdownButton;
+ if (c instanceof Button) {
+ int style = c.getStyle();
+ if ((style & SWT.CHECK) != 0) return FieldType.Checkbox;
+ else if ((style & SWT.RADIO) != 0) return FieldType.RadioButton;
+ else if (c.getParent() instanceof Scrollable) return FieldType.ScrollButton;
+ else return FieldType.PushButton;
+ }
+ return null;
+ }
+
+ protected String getScoutNameOf(Control c) {
+ IPropertyObserver scoutObject = RwtScoutComposite.getScoutModelOnWidget(c);
+ if (scoutObject != null) {
+ return scoutObject.getClass().getName();
+ }
+ return null;
+ }
+
+ protected Display getDisplay() {
+ IRwtEnvironment env = (IRwtEnvironment) m_session.getData(IRwtEnvironment.ENVIRONMENT_KEY);
+ return env.getDisplay();
+ }
+
+ protected Shell getActiveShell() {
+ return getDisplay().getActiveShell();
+ }
+
+ protected String cleanButtonLabel(String s) {
+ return StringUtility.removeMnemonic(s);
+ }
+
+ protected TreeItem findTreeItemRec(TreeItem[] items, String nodeText) {
+ if (items == null) return null;
+ //
+ for (TreeItem item : items) {
+ if (nodeText.equals(item.getText())) {
+ return item;
+ }
+ TreeItem found = findTreeItemRec(item.getItems(), nodeText);
+ if (found != null) {
+ return found;
+ }
+ }
+ return null;
+ }
+
+ protected void addTreeItemsRec(TreeItem[] items, List<String> list) {
+ if (items == null) return;
+ //
+ for (TreeItem item : items) {
+ list.add(item.getText(0));
+ addTreeItemsRec(item.getItems(), list);
+ }
+ }
+
+ protected List<Composite> enumerateParentContainers() {
+ return syncExec(new MockRunnable<ArrayList<Composite>>() {
+ @Override
+ public ArrayList<Composite> run() throws Throwable {
+ ArrayList<Composite> list = new ArrayList<Composite>();
+ for (Shell shell : getDisplay().getShells()) {
+ if (shell.isVisible()) {
+ list.add(shell);
+ }
+ }
+ return list;
+ }
+ });
+ }
+
+ protected Shell findShell(final String title) {
+ for (Shell shell : getDisplay().getShells()) {
+ if (title.equals(shell.getText())) {
+ return shell;
+ }
+ }
+ return null;
+ }
+
+ protected CTabItem findWorkbenchView(final String title) {
+ //XXX RAP
+// Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();XXX RAP
+// if (shell != null) {
+// for (CTabFolder f : SwtUtility.findChildComponents(shell, CTabFolder.class)) {
+// if (f.getItemCount() > 0) {
+// for (CTabItem item : f.getItems()) {
+// if (item.isShowing()) {
+// if (title.equals(cleanButtonLabel(item.getText()))) {
+// return item;
+// }
+// }
+// }
+// }
+// }
+// }
+ return null;
+ }
+
+ protected Control waitForPushButtonWithLabel(final String label) {
+ return waitUntil(new WaitCondition<Control>() {
+ @Override
+ public Control run() {
+ return syncExec(new MockRunnable<Control>() {
+ @Override
+ public Control run() throws Throwable {
+ for (Shell shell : getDisplay().getShells()) {
+ Composite parent = shell;
+ for (Control o : RwtUtility.findChildComponents(parent, Control.class)) {
+ if (o instanceof Button) {
+ if (cleanButtonLabel(label).equals(cleanButtonLabel(((Button) o).getText()))) return o;
+ }
+ }
+ }
+ return null;
+ }
+ });
+ }
+ });
+ }
+
+ protected Control waitForScoutField(final String name) {
+ return waitUntil(new WaitCondition<Control>() {
+ @Override
+ public Control run() {
+ return syncExec(new MockRunnable<Control>() {
+ @Override
+ public Control run() throws Throwable {
+ Control lastSecondaryCandidate = null;
+ for (Composite parent : enumerateParentContainers()) {
+ for (Control c : RwtUtility.findChildComponents(parent, Control.class)) {
+ String s = getScoutNameOf(c);
+ if (s != null && ("." + s).endsWith("." + name)) {
+ lastSecondaryCandidate = c;
+ if (getFieldTypeOf(c) != null) {
+ //primary match
+ return c;
+ }
+ }
+ }
+ }
+ return lastSecondaryCandidate;
+ }
+ });
+ }
+ });
+ }
+
+ protected Control waitForIndexedField(final FieldType type, final int fieldIndex) {
+ return waitUntil(new WaitCondition<Control>() {
+ @Override
+ public Control run() {
+ return syncExec(new MockRunnable<Control>() {
+ @Override
+ public Control run() throws Throwable {
+ List<Composite> parents = enumerateParentContainers();
+ for (Composite parent : parents) {
+ int index = 0;
+ for (Control c : RwtUtility.findChildComponents(parent, Control.class)) {
+ if (getFieldTypeOf(c) == type) {
+ if (index == fieldIndex) {
+ return c;
+ }
+ index++;
+ }
+ }
+ }
+ return null;
+ }
+ });
+ }
+ });
+ }
+
+ protected Control waitForLocatedField(final int x, final int y) {
+ return waitUntil(new WaitCondition<Control>() {
+ @Override
+ public Control run() {
+ return syncExec(new MockRunnable<Control>() {
+ @Override
+ public Control run() throws Throwable {
+ List<Composite> parents = enumerateParentContainers();
+ for (Composite parent : parents) {
+ for (Control c : RwtUtility.findChildComponents(parent, Control.class, Composite.class)) {
+ Rectangle map = getDisplay().map(c, null, c.getBounds());
+ if (map.contains(x, y)) {
+ return c;
+ }
+ }
+ }
+ return null;
+ }
+ });
+ }
+ });
+ }
+
+ protected MenuItem waitForMenuItem(final String name) {
+ return waitUntil(new WaitCondition<MenuItem>() {
+ @Override
+ public MenuItem run() {
+ return syncExec(new MockRunnable<MenuItem>() {
+ @Override
+ public MenuItem run() throws Throwable {
+ String label = cleanButtonLabel(name);
+ //focus control
+ Control focusControl = getDisplay().getFocusControl();
+ if (focusControl != null) {
+ Menu m = focusControl.getMenu();
+ if (m != null) {
+ for (MenuItem item : m.getItems()) {
+ if (label.equals(cleanButtonLabel(item.getText()))) {
+ return item;
+ }
+ }
+ }
+ }
+ //other controls
+ for (Composite parent : enumerateParentContainers()) {
+ for (Control c : RwtUtility.findChildComponents(parent, Control.class)) {
+ Menu m = c.getMenu();
+ if (m != null) {
+ for (MenuItem item : m.getItems()) {
+ if (label.equals(cleanButtonLabel(item.getText()))) {
+ return item;
+ }
+ }
+ }
+ }
+ }
+ //main menu
+ for (Shell shell : getDisplay().getShells()) {
+ Menu m = shell.getMenuBar();
+ if (m != null) {
+ for (MenuItem item : m.getItems()) {
+ if (label.equals(cleanButtonLabel(item.getText()))) {
+ return item;
+ }
+ }
+ }
+ }
+ return null;
+ }
+ });
+ }
+ });
+
+ }
+
+ protected <T> T syncExec(final MockRunnable<T> r) {
+ if (getDisplay().getThread() != Thread.currentThread()) {
+ final AtomicReference<T> ret = new AtomicReference<T>();
+ final AtomicReference<Throwable> ex = new AtomicReference<Throwable>();
+ try {
+ getDisplay().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ ret.set(syncExec(r));
+ }
+ catch (Throwable t) {
+ ex.set(t);
+ }
+ }
+ });
+ if (ex.get() != null) {
+ throw ex.get();
+ }
+ return ret.get();
+ }
+ catch (Throwable t) {
+ throw new RuntimeException(t);
+ }
+ }
+ //
+ try {
+ return r.run();
+ }
+ catch (Throwable t) {
+ throw new RuntimeException(t);
+ }
+ }
+
+ protected <T> T waitUntil(final WaitCondition<T> w) {
+ try {
+ return TestingUtility.waitUntil(WAIT_TIMEOUT, w);
+ }
+ catch (Throwable t) {
+ throw new RuntimeException(t);
+ }
+ finally {
+ waitForIdle();
+ }
+ }
+
+ @Override
+ public void pressLeft() {
+ throw new UnsupportedOperationException("not implemented");
+ }
+
+ @Override
+ public void releaseLeft() {
+ throw new UnsupportedOperationException("not implemented");
+ }
+
+ @Override
+ public void gotoTreeExpandIcon(int treeIndex, String nodeText) {
+ throw new UnsupportedOperationException("not implemented");
+ }
+
+ protected Keys toSeleniumKey(Key key) {
+ switch (key) {
+ case Shift:
+ return Keys.SHIFT;
+ case Control:
+ return Keys.CONTROL;
+ case Alt:
+ return Keys.ALT;
+ case Delete:
+ return Keys.DELETE;
+ case Backspace:
+ return Keys.BACK_SPACE;
+ case Enter:
+ return Keys.ENTER;
+ case Esc:
+ return Keys.ESCAPE;
+ case Tab:
+ return Keys.TAB;
+ case ContextMenu:
+ throw new IllegalArgumentException("Unknown keyboard key: " + key);
+ case Up:
+ return Keys.UP;
+ case Down:
+ return Keys.DOWN;
+ case Left:
+ return Keys.LEFT;
+ case Right:
+ return Keys.RIGHT;
+ case Windows:
+ return Keys.META;
+ case F1:
+ return Keys.F1;
+ case F2:
+ return Keys.F2;
+ case F3:
+ return Keys.F3;
+ case F4:
+ return Keys.F4;
+ case F5:
+ return Keys.F5;
+ case F6:
+ return Keys.F6;
+ case F7:
+ return Keys.F7;
+ case F8:
+ return Keys.F8;
+ case F9:
+ return Keys.F9;
+ case F10:
+ return Keys.F10;
+ case F11:
+ return Keys.F11;
+ case F12:
+ return Keys.F12;
+ case Home:
+ return Keys.HOME;
+ case End:
+ return Keys.END;
+ case PageUp:
+ return Keys.PAGE_UP;
+ case PageDown:
+ return Keys.PAGE_DOWN;
+ case NumPad0:
+ return Keys.NUMPAD0;
+ case NumPad1:
+ return Keys.NUMPAD1;
+ case NumPad2:
+ return Keys.NUMPAD2;
+ case NumPad3:
+ return Keys.NUMPAD3;
+ case NumPad4:
+ return Keys.NUMPAD4;
+ case NumPad5:
+ return Keys.NUMPAD5;
+ case NumPad6:
+ return Keys.NUMPAD6;
+ case NumPad7:
+ return Keys.NUMPAD7;
+ case NumPad8:
+ return Keys.NUMPAD8;
+ case NumPadMultiply:
+ return Keys.MULTIPLY;
+ case NumPadDivide:
+ return Keys.DIVIDE;
+ case NumPadAdd:
+ return Keys.ADD;
+ case NumPadSubtract:
+ return Keys.SUBTRACT;
+ case NumPadDecimal:
+ return Keys.DECIMAL;
+ case NumPadSeparator:
+ return Keys.SEPARATOR;
+ default:
+ throw new IllegalArgumentException("Unknown keyboard key: " + key);
+ }
+ }
+
+ protected int toKeyCode(IGuiMock.Key key) {
+ switch (key) {
+ case Shift:
+ return KeyEvent.VK_SHIFT;
+ case Control:
+ return KeyEvent.VK_CONTROL;
+ case Alt:
+ return KeyEvent.VK_ALT;
+ case Delete:
+ return KeyEvent.VK_DELETE;
+ case Backspace:
+ return KeyEvent.VK_BACK_SPACE;
+ case Enter:
+ return KeyEvent.VK_ENTER;
+ case Esc:
+ return KeyEvent.VK_ESCAPE;
+ case Tab:
+ return KeyEvent.VK_TAB;
+ case ContextMenu:
+ return KeyEvent.VK_CONTEXT_MENU;
+ case Up:
+ return KeyEvent.VK_UP;
+ case Down:
+ return KeyEvent.VK_DOWN;
+ case Left:
+ return KeyEvent.VK_LEFT;
+ case Right:
+ return KeyEvent.VK_RIGHT;
+ case Windows:
+ return KeyEvent.VK_WINDOWS;
+ case F1:
+ return KeyEvent.VK_F1;
+ case F2:
+ return KeyEvent.VK_F2;
+ case F3:
+ return KeyEvent.VK_F3;
+ case F4:
+ return KeyEvent.VK_F4;
+ case F5:
+ return KeyEvent.VK_F5;
+ case F6:
+ return KeyEvent.VK_F6;
+ case F7:
+ return KeyEvent.VK_F7;
+ case F8:
+ return KeyEvent.VK_F8;
+ case F9:
+ return KeyEvent.VK_F9;
+ case F10:
+ return KeyEvent.VK_F10;
+ case F11:
+ return KeyEvent.VK_F11;
+ case F12:
+ return KeyEvent.VK_F12;
+ case Home:
+ return KeyEvent.VK_HOME;
+ case End:
+ return KeyEvent.VK_END;
+ case PageUp:
+ return KeyEvent.VK_PAGE_UP;
+ case PageDown:
+ return KeyEvent.VK_PAGE_DOWN;
+ case NumPad0:
+ return KeyEvent.VK_NUMPAD0;
+ case NumPad1:
+ return KeyEvent.VK_NUMPAD1;
+ case NumPad2:
+ return KeyEvent.VK_NUMPAD2;
+ case NumPad3:
+ return KeyEvent.VK_NUMPAD3;
+ case NumPad4:
+ return KeyEvent.VK_NUMPAD4;
+ case NumPad5:
+ return KeyEvent.VK_NUMPAD5;
+ case NumPad6:
+ return KeyEvent.VK_NUMPAD6;
+ case NumPad7:
+ return KeyEvent.VK_NUMPAD7;
+ case NumPad8:
+ return KeyEvent.VK_NUMPAD8;
+ case NumPadMultiply:
+ return KeyEvent.VK_MULTIPLY;
+ case NumPadDivide:
+ return KeyEvent.VK_DIVIDE;
+ case NumPadAdd:
+ return KeyEvent.VK_ADD;
+ case NumPadSubtract:
+ return KeyEvent.VK_SUBTRACT;
+ case NumPadDecimal:
+ return KeyEvent.VK_DECIMAL;
+ case NumPadSeparator:
+ return KeyEvent.VK_SEPARATOR;
+ default:
+ throw new IllegalArgumentException("Unknown keyboard key: " + key);
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.testing.ui.rap/src/org/eclipse/scout/rt/testing/ui/rap/RapMockService.java b/org.eclipse.scout.rt.testing.ui.rap/src/org/eclipse/scout/rt/testing/ui/rap/RapMockService.java
index 840ed8240e..ff30e3c1de 100644
--- a/org.eclipse.scout.rt.testing.ui.rap/src/org/eclipse/scout/rt/testing/ui/rap/RapMockService.java
+++ b/org.eclipse.scout.rt.testing.ui.rap/src/org/eclipse/scout/rt/testing/ui/rap/RapMockService.java
@@ -1,52 +1,52 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.testing.ui.rap;
-
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.shared.ui.UiDeviceType;
-import org.eclipse.scout.rt.shared.ui.UiLayer;
-import org.eclipse.scout.rt.shared.ui.UserAgent;
-import org.eclipse.scout.service.AbstractService;
-import org.eclipse.scout.testing.client.IGuiMock;
-import org.eclipse.scout.testing.client.IGuiMockService;
-
-/**
- * Uses Selenium
- */
-public class RapMockService extends AbstractService implements IGuiMockService {
-
- private final static RapMock s_rapMock = new RapMock();
-
- public RapMockService() {
- s_rapMock.initializeMock();
- }
-
- @Override
- public UserAgent initUserAgent() {
- return UserAgent.create(UiLayer.RAP, UiDeviceType.DESKTOP);
- }
-
- @Override
- public IGuiMock createMock(IClientSession session) {
- s_rapMock.setClientSession(session);
- return s_rapMock;
- }
-
- @Override
- public void disposeServices() {
- try {
- s_rapMock.shutdownMock();
- }
- finally {
- super.disposeServices();
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.testing.ui.rap;
+
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.shared.ui.UiDeviceType;
+import org.eclipse.scout.rt.shared.ui.UiLayer;
+import org.eclipse.scout.rt.shared.ui.UserAgent;
+import org.eclipse.scout.service.AbstractService;
+import org.eclipse.scout.testing.client.IGuiMock;
+import org.eclipse.scout.testing.client.IGuiMockService;
+
+/**
+ * Uses Selenium
+ */
+public class RapMockService extends AbstractService implements IGuiMockService {
+
+ private final static RapMock s_rapMock = new RapMock();
+
+ public RapMockService() {
+ s_rapMock.initializeMock();
+ }
+
+ @Override
+ public UserAgent initUserAgent() {
+ return UserAgent.create(UiLayer.RAP, UiDeviceType.DESKTOP);
+ }
+
+ @Override
+ public IGuiMock createMock(IClientSession session) {
+ s_rapMock.setClientSession(session);
+ return s_rapMock;
+ }
+
+ @Override
+ public void disposeServices() {
+ try {
+ s_rapMock.shutdownMock();
+ }
+ finally {
+ super.disposeServices();
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.testing.ui.swing/.settings/org.eclipse.pde.core.prefs b/org.eclipse.scout.rt.testing.ui.swing/.settings/org.eclipse.pde.core.prefs
index baef13dd8c..a3a50fc8da 100644
--- a/org.eclipse.scout.rt.testing.ui.swing/.settings/org.eclipse.pde.core.prefs
+++ b/org.eclipse.scout.rt.testing.ui.swing/.settings/org.eclipse.pde.core.prefs
@@ -1,3 +1,3 @@
-#Mon Jul 11 16:16:00 CEST 2011
-eclipse.preferences.version=1
-pluginProject.extensions=true
+#Mon Jul 11 16:16:00 CEST 2011
+eclipse.preferences.version=1
+pluginProject.extensions=true
diff --git a/org.eclipse.scout.rt.testing.ui.swing/plugin.xml b/org.eclipse.scout.rt.testing.ui.swing/plugin.xml
index 9fb0bff95b..9a89617c75 100644
--- a/org.eclipse.scout.rt.testing.ui.swing/plugin.xml
+++ b/org.eclipse.scout.rt.testing.ui.swing/plugin.xml
@@ -1,18 +1,18 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<plugin>
- <extension
- point="org.eclipse.scout.service.services">
- <service
- class="org.eclipse.scout.rt.testing.ui.swing.SwingMockService"
- createImmediately="false">
- </service>
- <service
- class="org.eclipse.scout.rt.client.services.common.icon.IconProviderService"
- createImmediately="false"
- factory="org.eclipse.scout.rt.client.services.ClientServiceFactory"
- ranking="-90">
- </service>
- </extension>
-
-</plugin>
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.scout.service.services">
+ <service
+ class="org.eclipse.scout.rt.testing.ui.swing.SwingMockService"
+ createImmediately="false">
+ </service>
+ <service
+ class="org.eclipse.scout.rt.client.services.common.icon.IconProviderService"
+ createImmediately="false"
+ factory="org.eclipse.scout.rt.client.services.ClientServiceFactory"
+ ranking="-90">
+ </service>
+ </extension>
+
+</plugin>
diff --git a/org.eclipse.scout.rt.testing.ui.swing/src/org/eclipse/scout/rt/testing/ui/swing/Activator.java b/org.eclipse.scout.rt.testing.ui.swing/src/org/eclipse/scout/rt/testing/ui/swing/Activator.java
index 98c17a6bcd..727463b56d 100644
--- a/org.eclipse.scout.rt.testing.ui.swing/src/org/eclipse/scout/rt/testing/ui/swing/Activator.java
+++ b/org.eclipse.scout.rt.testing.ui.swing/src/org/eclipse/scout/rt/testing/ui/swing/Activator.java
@@ -1,62 +1,62 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.testing.ui.swing;
-
-import org.eclipse.core.runtime.Plugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends Plugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.scout.rt.testing.ui.swing";
-
- // The shared instance
- private static Activator plugin;
-
- /**
- * The constructor
- */
- public Activator() {
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
- */
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.testing.ui.swing;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.scout.rt.testing.ui.swing";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.testing.ui.swing/src/org/eclipse/scout/rt/testing/ui/swing/JUnitSwingJob.java b/org.eclipse.scout.rt.testing.ui.swing/src/org/eclipse/scout/rt/testing/ui/swing/JUnitSwingJob.java
index 3de6ceb954..be6527fb1d 100644
--- a/org.eclipse.scout.rt.testing.ui.swing/src/org/eclipse/scout/rt/testing/ui/swing/JUnitSwingJob.java
+++ b/org.eclipse.scout.rt.testing.ui.swing/src/org/eclipse/scout/rt/testing/ui/swing/JUnitSwingJob.java
@@ -1,85 +1,85 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.testing.ui.swing;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.client.services.common.session.IClientSessionRegistryService;
-import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
-import org.eclipse.scout.rt.shared.ui.UiDeviceType;
-import org.eclipse.scout.rt.shared.ui.UiLayer;
-import org.eclipse.scout.rt.shared.ui.UserAgent;
-import org.eclipse.scout.rt.testing.shared.ScoutJUnitPluginTestExecutor;
-import org.eclipse.scout.rt.testing.shared.TestingUtility;
-import org.eclipse.scout.rt.testing.shared.WaitCondition;
-import org.eclipse.scout.service.SERVICES;
-import org.eclipse.scout.testing.client.IGuiMock;
-
-/**
- * Runs all @Test annotated methods in all classes and then exit
- * <p>
- * Normally this is called from within a swing application in the start method <code><pre>
- * public Object start(IApplicationContext context) throws Exception {
- * new JUnitSwingJob(ClientSession.class).schedule(2000);
- * //
- * ...
- * }
- * </pre></code>
- */
-public class JUnitSwingJob extends Job {
- private final Class<? extends IClientSession> m_clientSessionClass;
-
- public JUnitSwingJob(Class<? extends IClientSession> clientSessionClass) {
- super("JUnit Swing Job");
- setSystem(true);
- m_clientSessionClass = clientSessionClass;
- }
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- //wait until the application is showing
- try {
- TestingUtility.waitUntil(IGuiMock.WAIT_TIMEOUT, new WaitCondition<Object>() {
- @Override
- public Object run() {
- try {
- IClientSession session = SERVICES.getService(IClientSessionRegistryService.class).newClientSession(m_clientSessionClass, UserAgent.create(UiLayer.SWING, UiDeviceType.DESKTOP));
- if (session != null) {
- IDesktop desktop = session.getDesktop();
- if (desktop != null) {
- if (desktop.isGuiAvailable() && desktop.isOpened()) {
- return true;//non-null
- }
- }
- }
- }
- catch (Throwable t) {
- t.printStackTrace();
- System.exit(0);
- }
- return null;
- }
- });
- }
- catch (Throwable t) {
- System.err.println("Timeout waiting for SwingApplication to start: " + t);
- System.exit(0);
- }
- //
- ScoutJUnitPluginTestExecutor scoutJUnitPluginTestExecutor = new ScoutJUnitPluginTestExecutor();
- final int code = scoutJUnitPluginTestExecutor.runAllTests();
- System.exit(code);
- return Status.OK_STATUS;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.testing.ui.swing;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.client.services.common.session.IClientSessionRegistryService;
+import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
+import org.eclipse.scout.rt.shared.ui.UiDeviceType;
+import org.eclipse.scout.rt.shared.ui.UiLayer;
+import org.eclipse.scout.rt.shared.ui.UserAgent;
+import org.eclipse.scout.rt.testing.shared.ScoutJUnitPluginTestExecutor;
+import org.eclipse.scout.rt.testing.shared.TestingUtility;
+import org.eclipse.scout.rt.testing.shared.WaitCondition;
+import org.eclipse.scout.service.SERVICES;
+import org.eclipse.scout.testing.client.IGuiMock;
+
+/**
+ * Runs all @Test annotated methods in all classes and then exit
+ * <p>
+ * Normally this is called from within a swing application in the start method <code><pre>
+ * public Object start(IApplicationContext context) throws Exception {
+ * new JUnitSwingJob(ClientSession.class).schedule(2000);
+ * //
+ * ...
+ * }
+ * </pre></code>
+ */
+public class JUnitSwingJob extends Job {
+ private final Class<? extends IClientSession> m_clientSessionClass;
+
+ public JUnitSwingJob(Class<? extends IClientSession> clientSessionClass) {
+ super("JUnit Swing Job");
+ setSystem(true);
+ m_clientSessionClass = clientSessionClass;
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ //wait until the application is showing
+ try {
+ TestingUtility.waitUntil(IGuiMock.WAIT_TIMEOUT, new WaitCondition<Object>() {
+ @Override
+ public Object run() {
+ try {
+ IClientSession session = SERVICES.getService(IClientSessionRegistryService.class).newClientSession(m_clientSessionClass, UserAgent.create(UiLayer.SWING, UiDeviceType.DESKTOP));
+ if (session != null) {
+ IDesktop desktop = session.getDesktop();
+ if (desktop != null) {
+ if (desktop.isGuiAvailable() && desktop.isOpened()) {
+ return true;//non-null
+ }
+ }
+ }
+ }
+ catch (Throwable t) {
+ t.printStackTrace();
+ System.exit(0);
+ }
+ return null;
+ }
+ });
+ }
+ catch (Throwable t) {
+ System.err.println("Timeout waiting for SwingApplication to start: " + t);
+ System.exit(0);
+ }
+ //
+ ScoutJUnitPluginTestExecutor scoutJUnitPluginTestExecutor = new ScoutJUnitPluginTestExecutor();
+ final int code = scoutJUnitPluginTestExecutor.runAllTests();
+ System.exit(code);
+ return Status.OK_STATUS;
+ }
+}
diff --git a/org.eclipse.scout.rt.testing.ui.swing/src/org/eclipse/scout/rt/testing/ui/swing/SwingMock.java b/org.eclipse.scout.rt.testing.ui.swing/src/org/eclipse/scout/rt/testing/ui/swing/SwingMock.java
index 9003c7f654..b940b71617 100644
--- a/org.eclipse.scout.rt.testing.ui.swing/src/org/eclipse/scout/rt/testing/ui/swing/SwingMock.java
+++ b/org.eclipse.scout.rt.testing.ui.swing/src/org/eclipse/scout/rt/testing/ui/swing/SwingMock.java
@@ -1,1165 +1,1165 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.testing.ui.swing;
-
-import java.awt.Component;
-import java.awt.Container;
-import java.awt.Dialog;
-import java.awt.Frame;
-import java.awt.KeyboardFocusManager;
-import java.awt.Point;
-import java.awt.Rectangle;
-import java.awt.Robot;
-import java.awt.Toolkit;
-import java.awt.Window;
-import java.awt.datatransfer.StringSelection;
-import java.awt.datatransfer.Transferable;
-import java.awt.event.KeyEvent;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-import java.util.TreeSet;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.atomic.AtomicReference;
-
-import javax.swing.AbstractButton;
-import javax.swing.Icon;
-import javax.swing.JCheckBox;
-import javax.swing.JComponent;
-import javax.swing.JInternalFrame;
-import javax.swing.JLabel;
-import javax.swing.JLayeredPane;
-import javax.swing.JRadioButton;
-import javax.swing.JScrollBar;
-import javax.swing.JTable;
-import javax.swing.JTree;
-import javax.swing.JWindow;
-import javax.swing.RootPaneContainer;
-import javax.swing.SwingUtilities;
-import javax.swing.text.JTextComponent;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.jobs.IJobChangeEvent;
-import org.eclipse.core.runtime.jobs.JobChangeAdapter;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.beans.IPropertyObserver;
-import org.eclipse.scout.commons.dnd.TextTransferObject;
-import org.eclipse.scout.commons.dnd.TransferObject;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.testing.shared.TestingUtility;
-import org.eclipse.scout.rt.testing.shared.WaitCondition;
-import org.eclipse.scout.rt.ui.swing.SwingUtility;
-import org.eclipse.scout.rt.ui.swing.basic.ISwingScoutComposite;
-import org.eclipse.scout.rt.ui.swing.basic.SwingScoutComposite;
-import org.eclipse.scout.rt.ui.swing.icons.CheckboxIcon;
-import org.eclipse.scout.testing.client.IGuiMock;
-import org.eclipse.scout.testing.client.robot.JavaRobot;
-
-/**
- * Uses {@link Robot}
- */
-public class SwingMock implements IGuiMock {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(SwingMock.class);
-
- static interface MockRunnable<T> {
- T run() throws Throwable;
- }
-
- private final IClientSession m_session;
- private final JavaRobot m_bot;
- private int m_treeNodeToExpandIconGap;
-
- public SwingMock(IClientSession session) {
- m_session = session;
- m_bot = new JavaRobot();
- }
-
- @Override
- public void initializeMock() {
- }
-
- @Override
- public void shutdownMock() {
- }
-
- @Override
- public void beforeTest() {
- }
-
- @Override
- public void afterTest() {
- }
-
- @Override
- public GuiStrategy getStrategy() {
- return GuiStrategy.Swing;
- }
-
- public int getTreeNodeToExpandIconGap() {
- if (m_treeNodeToExpandIconGap <= 0) {
- String s = Activator.getDefault().getBundle().getBundleContext().getProperty("IGuiMock.treeNodeToExpandIconGap");
- if (s == null) {
- LOG.warn("Missing config.ini property 'IGuiMock.treeNodeToExpandIconGap'; using default value of 4");
- s = "4";
- }
- m_treeNodeToExpandIconGap = Integer.parseInt(s);
- }
- return m_treeNodeToExpandIconGap;
- }
-
- public void setTreeNodeToExpandIconGap(int treeNodeToExpandIconGap) {
- m_treeNodeToExpandIconGap = treeNodeToExpandIconGap;
- }
-
- @Override
- public void waitForIdle() {
- if (SwingUtilities.isEventDispatchThread()) {
- return;
- }
- //
- for (int pass = 0; pass < 2; pass++) {
- m_bot.sleep(80);
- //wait until gui queue is empty
- syncExec(new MockRunnable<Object>() {
- @Override
- public Object run() throws Throwable {
- return null;
- }
- });
- //wait until model queue is empty
- ClientSyncJob idleJob = new ClientSyncJob("Check for idle", m_session) {
- @Override
- protected void runVoid(IProgressMonitor m) throws Throwable {
- }
- };
- idleJob.setSystem(true);
-
- final CountDownLatch idleJobScheduledSignal = new CountDownLatch(1);
- JobChangeAdapter listener = new JobChangeAdapter() {
- @Override
- public void done(IJobChangeEvent event) {
- idleJobScheduledSignal.countDown();
- }
- };
-
- try {
- idleJob.addJobChangeListener(listener);
- idleJob.schedule();
- try {
- idleJobScheduledSignal.await();
- }
- catch (InterruptedException e) {
- throw new IllegalStateException("Interrupted");
- }
- }
- finally {
- idleJob.removeJobChangeListener(listener);
- }
- }
- }
-
- @Override
- public void waitForActiveWindow(final String title) {
- waitUntil(new WaitCondition<Object>() {
- @Override
- public Object run() {
- if (isWindowActive(title)) {
- return true;
- }
- else {
- return null;
- }
- }
- });
- waitForIdle();
- }
-
- @Override
- public void waitForOpenWindow(final String title) {
- waitUntil(new WaitCondition<Object>() {
- @Override
- public Object run() {
- if (isWindowOpen(title)) {
- return true;
- }
- else {
- return null;
- }
- }
- });
- waitForIdle();
- }
-
- @Override
- public int getSleepDelay() {
- return m_bot.getAutoDelay();
- }
-
- @Override
- public void setSleepDelay(int sleepDelay) {
- m_bot.setAutoDelay(sleepDelay);
- }
-
- @Override
- public void sleep() {
- sleep(getSleepDelay());
- }
-
- @Override
- public void sleep(int millis) {
- //only sleep when NOT in gui thread
- if (SwingUtilities.isEventDispatchThread()) {
- return;
- }
- m_bot.sleep(millis);
- waitForIdle();
- }
-
- @Override
- public boolean isWindowActive(final String title) {
- return syncExec(new MockRunnable<Boolean>() {
- @Override
- public Boolean run() throws Throwable {
- for (Window w : findWindows(title)) {
- if (w.isActive()) {
- return true;
- }
- }
- JInternalFrame f = findInternalFrame(title);
- if (f != null) {
- return f.isSelected();
- }
- return false;
- }
- });
- }
-
- @Override
- public boolean isWindowOpen(final String title) {
- return syncExec(new MockRunnable<Boolean>() {
- @Override
- public Boolean run() throws Throwable {
- for (Window w : findWindows(title)) {
- if (w.isVisible()) {
- return true;
- }
- }
- JInternalFrame f = findInternalFrame(title);
- if (f != null) {
- return f.isVisible();
- }
- return false;
- }
- });
- }
-
- @Override
- public void activateWindow(final String title) {
- waitForOpenWindow(title);
- syncExec(new MockRunnable<Object>() {
- @Override
- public Object run() throws Throwable {
- Window w = findWindow(title);
- if (w != null) {
- w.requestFocusInWindow();
- return null;
- }
- JInternalFrame f = findInternalFrame(title);
- if (f != null) {
- f.requestFocusInWindow();
- f.setSelected(true);
- return null;
- }
- throw new IllegalStateException("There is no view with title " + title);
- }
- });
- waitForIdle();
- }
-
- @Override
- public void clickOnPushButton(String text) {
- final JComponent c = waitForPushButtonWithLabel(text);
- syncExec(new MockRunnable<Object>() {
- @Override
- public Object run() throws Throwable {
- Point p = c.getLocationOnScreen();
- gotoPoint(p.x + c.getWidth() / 2, p.y + c.getHeight() / 2);
- clickLeft();
- return null;
- }
- });
- waitForIdle();
- }
-
- @Override
- public void gotoField(FieldType type, int fieldIndex) {
- final JComponent c = waitForIndexedField(type, fieldIndex);
- syncExec(new MockRunnable<Object>() {
- @Override
- public Object run() throws Throwable {
- Point p = c.getLocationOnScreen();
- gotoPoint(p.x + c.getWidth() / 2, p.y + c.getHeight() / 2);
- return null;
- }
- });
- }
-
- @Override
- public void gotoScoutField(String name) {
- final JComponent c = waitForScoutField(name);
- syncExec(new MockRunnable<Object>() {
- @Override
- public Object run() throws Throwable {
- Point p = c.getLocationOnScreen();
- gotoPoint(p.x + c.getWidth() / 2, p.y + c.getHeight() / 2);
- return null;
- }
- });
- }
-
- @Override
- public void gotoTable(int tableIndex, final int rowIndex, final int columnIndex) {
- final JTable table = (JTable) waitForIndexedField(FieldType.Table, tableIndex);
- syncExec(new MockRunnable<Object>() {
- @Override
- public Object run() throws Throwable {
- Rectangle r = getTableCellBounds(table, rowIndex, columnIndex);
- if (!table.getVisibleRect().contains(r.x + r.width / 2, r.y + r.height / 2)) {
- throw new IllegalStateException("table cell " + rowIndex + "," + columnIndex + " is not visible on screen");
- }
- Point p = table.getLocationOnScreen();
- gotoPoint(p.x + r.x + r.width / 2, p.y + r.y + r.height / 2);
- return null;
- }
- });
- }
-
- @Override
- public void gotoTableHeader(int tableIndex, final int columnIndex) {
- final JTable table = (JTable) waitForIndexedField(FieldType.Table, tableIndex);
- syncExec(new MockRunnable<Object>() {
- @Override
- public Object run() throws Throwable {
- Rectangle r = getTableHeaderCellBounds(table, columnIndex);
- Point p = table.getTableHeader().getLocationOnScreen();
- gotoPoint(p.x + r.x + r.width / 2, p.y + r.y + r.height / 2);
- return null;
- }
- });
- }
-
- @Override
- public void gotoTree(int treeIndex, final String nodeText) {
- final JTree tree = (JTree) waitForIndexedField(FieldType.Tree, treeIndex);
- syncExec(new MockRunnable<Object>() {
- @Override
- public Object run() throws Throwable {
- Rectangle r = getTreeRowBounds(tree, getTreeRowIndex(tree, nodeText));
- if (!tree.getVisibleRect().contains(r.x + r.width / 2, r.y + r.height / 2)) {
- throw new IllegalStateException("tree node " + nodeText + " is not visible on screen");
- }
- Point p = tree.getLocationOnScreen();
- gotoPoint(p.x + r.x + r.width / 2, p.y + r.y + r.height / 2);
- return null;
- }
- });
- }
-
- @Override
- public void gotoTreeExpandIcon(int treeIndex, final String nodeText) {
- final JTree tree = (JTree) waitForIndexedField(FieldType.Tree, treeIndex);
- syncExec(new MockRunnable<Object>() {
- @Override
- public Object run() throws Throwable {
- Rectangle r = getTreeRowBounds(tree, getTreeRowIndex(tree, nodeText));
- if (!tree.getVisibleRect().contains(r.x + r.width / 2, r.y + r.height / 2)) {
- throw new IllegalStateException("tree node " + nodeText + " is not visible on screen");
- }
- Point p = tree.getLocationOnScreen();
- gotoPoint(p.x + r.x - getTreeNodeToExpandIconGap() - 2, p.y + r.y + r.height / 2);
- return null;
- }
- });
- }
-
- @Override
- public void contextMenu(final String... names) {
- //move to menu
- for (int i = 0; i < names.length; i++) {
- String label = names[i];
- final boolean lastItem = i == names.length - 1;
- final Component m = waitForContextMenu(label);
- syncExec(new MockRunnable<Boolean>() {
- @Override
- public Boolean run() throws Throwable {
- Point p = m.getLocationOnScreen();
- gotoPoint(p.x + m.getWidth() / 2, p.y + m.getHeight() / 2);
- if (lastItem) {
- //click on last menu
- clickLeft();
- }
- return null;
- }
- });
- waitForIdle();
- }
- }
-
- @Override
- public List<String> getTableCells(int tableIndex, final int columnIndex) {
- final JTable table = (JTable) waitForIndexedField(FieldType.Table, tableIndex);
- return syncExec(new MockRunnable<List<String>>() {
- @Override
- public List<String> run() throws Throwable {
- ArrayList<String> list = new ArrayList<String>();
- for (int row = 0; row < table.getRowCount(); row++) {
- list.add(getTableCellText(table, row, columnIndex));
- }
- return list;
- }
- });
- }
-
- @Override
- public List<String> getTreeNodes(int treeIndex) {
- final JTree tree = (JTree) waitForIndexedField(FieldType.Tree, treeIndex);
- return syncExec(new MockRunnable<List<String>>() {
- @Override
- public List<String> run() throws Throwable {
- ArrayList<String> list = new ArrayList<String>();
- for (int row = 0; row < tree.getRowCount(); row++) {
- list.add(getTreeRowText(tree, row));
- }
- return list;
- }
- });
- }
-
- @Override
- public Set<String> getSelectedTableCells(int tableIndex, final int columnIndex) {
- final JTable table = (JTable) waitForIndexedField(FieldType.Table, tableIndex);
- return syncExec(new MockRunnable<Set<String>>() {
- @Override
- public Set<String> run() throws Throwable {
- TreeSet<String> set = new TreeSet<String>();
- int[] sel = table.getSelectedRows();
- if (sel != null) {
- for (int row : sel) {
- set.add(getTableCellText(table, row, columnIndex));
- }
- }
- return set;
- }
- });
- }
-
- /**
- * Works only if checked Row is visible
- */
- @Override
- public Set<String> getCheckedTableCells(int tableIndex, final int columnIndex) {
- final JTable table = (JTable) waitForIndexedField(FieldType.Table, tableIndex);
- return syncExec(new MockRunnable<Set<String>>() {
- @Override
- public Set<String> run() throws Throwable {
- TreeSet<String> check = new TreeSet<String>();
- for (int i = 0; i < table.getRowCount(); i++) {
- Icon icon = getTableCellIcon(table, i);
- if (icon instanceof CheckboxIcon) {
- if (((CheckboxIcon) icon).isSelecetd()) {
- check.add(getTableCellText(table, i, columnIndex));
- }
- }
- }
- return check;
- }
- });
- }
-
- @Override
- public Set<String> getSelectedTreeNodes(int treeIndex) {
- final JTree tree = (JTree) waitForIndexedField(FieldType.Tree, treeIndex);
- return syncExec(new MockRunnable<Set<String>>() {
- @Override
- public Set<String> run() throws Throwable {
- TreeSet<String> set = new TreeSet<String>();
- int[] sel = tree.getSelectionRows();
- if (sel != null) {
- for (int row : sel) {
- set.add(getTreeRowText(tree, row));
- }
- }
- return set;
- }
- });
- }
-
- @Override
- public FieldState getFocusFieldState() {
- return syncExec(new MockRunnable<FieldState>() {
- @Override
- public FieldState run() throws Throwable {
- checkActiveWindow();
- Component c = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
- if (c == null) {
- throw new IllegalStateException("There is no focus owner");
- }
- if (!(c instanceof JComponent)) {
- throw new IllegalStateException("Focus owner is not a swing field");
- }
- return getFieldStateInternal((JComponent) c);
- }
- });
- }
-
- @Override
- public FieldState getFieldState(FieldType type, int index) {
- final JComponent c = waitForIndexedField(type, index);
- return syncExec(new MockRunnable<FieldState>() {
- @Override
- public FieldState run() throws Throwable {
- return getFieldStateInternal(c);
- }
- });
- }
-
- @Override
- public FieldState getScoutFieldState(String name) {
- final JComponent c = waitForScoutField(name);
- return syncExec(new MockRunnable<FieldState>() {
- @Override
- public FieldState run() throws Throwable {
- return getFieldStateInternal(c);
- }
- });
- }
-
- @Override
- public FieldState getScoutFieldContainerState(String name) {
- final JComponent c = waitForScoutField(name);
- return syncExec(new MockRunnable<FieldState>() {
- @Override
- public FieldState run() throws Throwable {
- ISwingScoutComposite swingScoutComposite = SwingScoutComposite.getCompositeOnWidget(c);
- if (swingScoutComposite == null) {
- return null;
- }
-
- return getFieldStateInternal(swingScoutComposite.getSwingContainer());
- }
- });
- }
-
- @Override
- public List<FieldState> getFieldStates(final FieldType type) {
- return syncExec(new MockRunnable<List<FieldState>>() {
- @Override
- public List<FieldState> run() throws Throwable {
- checkActiveWindow();
- List<FieldState> list = new ArrayList<FieldState>();
- for (Component parent : enumerateParentContainers()) {
- for (JComponent c : SwingUtility.findChildComponents(parent, JComponent.class)) {
- if (type == null && getFieldTypeOf(c) != null) {
- list.add(getFieldStateInternal(c));
- }
- else if (type != null && getFieldTypeOf(c) == type) {
- list.add(getFieldStateInternal(c));
- }
- }
- }
- return list;
- }
- });
- }
-
- @Override
- public void gotoPoint(int x, int y) {
- m_bot.moveTo(x, y);
- }
-
- @Override
- public void move(int deltaX, int deltaY) {
- m_bot.moveDelta(deltaX, deltaY);
- }
-
- @Override
- public void clickLeft() {
- m_bot.clickLeft();
- waitForIdle();
- }
-
- @Override
- public void clickRight() {
- m_bot.clickRight();
- waitForIdle();
- }
-
- @Override
- public void pressLeft() {
- m_bot.pressLeft();
- }
-
- @Override
- public void releaseLeft() {
- m_bot.releaseLeft();
- waitForIdle();
- }
-
- @Override
- public void drag(int x1, int y1, int x2, int y2) {
- gotoPoint(x1, y1);
- m_bot.pressLeft();
- gotoPoint(x2, y2);
- m_bot.releaseLeft();
- waitForIdle();
- }
-
- @Override
- public void dragWindowRightBorder(WindowState windowState, int pixelToMoveOnX) {
- int borderSize = 2;
-
- int xPos = windowState.x + windowState.width + borderSize;
- int yPos = windowState.y + windowState.height / 2;
- drag(xPos, yPos, xPos + pixelToMoveOnX, yPos);
- }
-
- @Override
- public void typeText(final String text) {
- m_bot.typeText(text);
- waitForIdle();
- }
-
- @Override
- public void pressKey(Key key) {
- m_bot.pressKey(key);
- waitForIdle();
- }
-
- @Override
- public void paste(final String text) {
- Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(text), null);
- //press paste (ctrl-V)
- m_bot.pressKey(Key.Control);
- m_bot.typeText("v");
- m_bot.releaseKey(Key.Control);
- }
-
- @Override
- public void releaseKey(Key key) {
- m_bot.releaseKey(key);
- waitForIdle();
- }
-
- @Override
- public void typeKey(Key key) {
- m_bot.typeKey(key);
- waitForIdle();
- }
-
- @Override
- public WindowState getWindowState(final String title) {
- return syncExec(new MockRunnable<WindowState>() {
- @Override
- public WindowState run() throws Throwable {
- checkActiveWindow();
- JInternalFrame part = findInternalFrame(title);
- if (part != null) {
- Rectangle r = part.getBounds();
- WindowState state = new WindowState();
- Point p = part.getLocationOnScreen();
- state.x = p.x;
- state.y = p.y;
- state.width = r.width;
- state.height = r.height;
- return state;
- }
- Window w = findWindow(title);
- if (w != null) {
- Rectangle r = w.getBounds();
- WindowState state = new WindowState();
- Point p = w.getLocationOnScreen();
- state.x = p.x;
- state.y = p.y;
- state.width = r.width;
- state.height = r.height;
- return state;
- }
- throw new IllegalStateException("Window " + title + " not found");
- }
- });
- }
-
- @Override
- public String getClipboardText() {
- waitForIdle();
- Transferable t = Toolkit.getDefaultToolkit().getSystemClipboard().getContents(null);
- TransferObject o = SwingUtility.createScoutTransferable(t);
- if (o != null && o.isText()) {
- return ((TextTransferObject) o).getPlainText();
- }
- return null;
- }
-
- @Override
- public Object internal0(final Object o) {
- return null;
- }
-
- protected FieldState getFieldStateInternal(Container c) {
- FieldState state = new FieldState();
- //type
- state.type = getFieldTypeOf(c);
- //scout name
- state.scoutName = getScoutNameOf(c);
- //focus
- state.focus = c.isFocusOwner();
- //bounds
- Point p = c.getLocationOnScreen();
- state.x = p.x;
- state.y = p.y;
- state.width = c.getWidth();
- state.height = c.getHeight();
- //text
- if (c instanceof JLabel) {
- state.text = ((JLabel) c).getText();
- }
- if (c instanceof JTextComponent) {
- state.text = ((JTextComponent) c).getText();
- }
- if (c instanceof AbstractButton) {
- state.text = ((AbstractButton) c).getText();
- }
- return state;
- }
-
- protected int getTreeRowIndex(JTree tree, String nodeText) {
- for (int i = 0; i < tree.getRowCount(); i++) {
- Component tmp = tree.getCellRenderer().getTreeCellRendererComponent(tree, tree.getPathForRow(i).getLastPathComponent(), false, false, false, i, false);
- if (tmp instanceof JLabel) {
- JLabel label = (JLabel) tmp;
- if (nodeText.equals(label.getText())) {
- return i;
- }
- }
- }
- return -1;
- }
-
- protected String getTreeRowText(JTree tree, int rowIndex) {
- if (rowIndex < 0 || rowIndex > tree.getRowCount()) {
- throw new IllegalStateException("Tree has " + tree.getRowCount() + " rows (accessing " + rowIndex + ")");
- }
- Component tmp = tree.getCellRenderer().getTreeCellRendererComponent(tree, tree.getPathForRow(rowIndex).getLastPathComponent(), false, false, false, rowIndex, false);
- if (tmp instanceof JLabel) {
- JLabel label = (JLabel) tmp;
- return label.getText();
- }
- return null;
- }
-
- protected Rectangle getTreeRowBounds(JTree tree, int rowIndex) {
- if (rowIndex < 0 || rowIndex > tree.getRowCount()) {
- throw new IllegalStateException("Tree has " + tree.getRowCount() + " rows (accessing " + rowIndex + ")");
- }
- return tree.getPathBounds(tree.getPathForRow(rowIndex));
- }
-
- protected String getTableCellText(JTable table, int rowIndex, int columnIndex) {
- if (rowIndex < 0 || rowIndex > table.getRowCount()) {
- throw new IllegalStateException("Table has " + table.getRowCount() + " rows (accessing " + rowIndex + ")");
- }
- if (columnIndex < 0 || columnIndex > table.getColumnCount()) {
- throw new IllegalStateException("Table has " + table.getColumnCount() + " columns (accessing " + columnIndex + ")");
- }
- Component label = table.prepareRenderer(table.getCellRenderer(rowIndex, columnIndex), rowIndex, columnIndex);
- if (label instanceof JLabel) {
- return ((JLabel) label).getText();
- }
- return null;
- }
-
- protected Icon getTableCellIcon(JTable table, int rowIndex) {
- if (rowIndex < 0 || rowIndex > table.getRowCount()) {
- throw new IllegalStateException("Table has " + table.getRowCount() + " rows (accessing " + rowIndex + ")");
- }
- Component label = table.prepareRenderer(table.getCellRenderer(rowIndex, 0), rowIndex, 0);
- if (label instanceof JLabel) {
- return ((JLabel) label).getIcon();
- }
- return null;
- }
-
- protected Rectangle getTableCellBounds(JTable table, int rowIndex, int columnIndex) {
- if (rowIndex < 0 || rowIndex > table.getRowCount()) {
- throw new IllegalStateException("Table has " + table.getRowCount() + " rows (accessing " + rowIndex + ")");
- }
- if (columnIndex < 0 || columnIndex > table.getColumnCount()) {
- throw new IllegalStateException("Table has " + table.getColumnCount() + " columns (accessing " + columnIndex + ")");
- }
- return table.getCellRect(rowIndex, columnIndex, true);
- }
-
- protected Rectangle getTableHeaderCellBounds(JTable table, int columnIndex) {
- if (columnIndex < 0 || columnIndex > table.getColumnCount()) {
- throw new IllegalStateException("Table has " + table.getColumnCount() + " columns (accessing " + columnIndex + ")");
- }
- return table.getTableHeader().getHeaderRect(columnIndex);
- }
-
- protected void checkActiveWindow() {
- if (getActiveWindow() == null) {
- throw new IllegalStateException("There is no active view");
- }
- }
-
- protected Window getActiveWindow() {
- Window w = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
- return w;
- }
-
- protected String cleanButtonLabel(String s) {
- return StringUtility.removeMnemonic(s);
- }
-
- protected Window findWindow(String title) {
- for (Window w : Window.getWindows()) {
- if (w.isVisible()) {
- if (w instanceof Dialog && title.equals(((Dialog) w).getTitle())) {
- return w;
- }
- else if (w instanceof Frame && title.equals(((Frame) w).getTitle())) {
- return w;
- }
- }
- }
- return null;
- }
-
- protected List<Window> findWindows(String title) {
- ArrayList<Window> list = new ArrayList<Window>();
- for (Window w : Window.getWindows()) {
- if (w.isVisible()) {
- if (w instanceof Dialog && title.equals(((Dialog) w).getTitle())) {
- list.add(w);
- }
- else if (w instanceof Frame && title.equals(((Frame) w).getTitle())) {
- list.add(w);
- }
- }
- }
- return list;
- }
-
- protected JInternalFrame findInternalFrame(String title) {
- for (Window w : JWindow.getWindows()) {
- for (JInternalFrame i : SwingUtility.findChildComponents(w, JInternalFrame.class)) {
- if (i.isVisible()) {
- if (title.equals(i.getTitle())) {
- return i;
- }
- }
- }
- }
- return null;
- }
-
- //wait for window containing this button
- protected Component waitForContextMenu(final String text) {
- return waitUntil(new WaitCondition<Component>() {
- @Override
- public Component run() {
- return syncExec(new MockRunnable<Component>() {
- @Override
- public Component run() throws Throwable {
- String label = cleanButtonLabel(text);
- //find lightweight popup
- Window activeWindow = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
- Component popupContainer = null;
- if (popupContainer == null) {
- if (activeWindow instanceof RootPaneContainer) {
- Component[] a = ((RootPaneContainer) activeWindow).getLayeredPane().getComponentsInLayer(JLayeredPane.POPUP_LAYER);
- if (a.length > 0) {
- popupContainer = a[0];
- }
- }
- }
- //find heavyweight popup
- if (popupContainer == null) {
- for (Window w : activeWindow.getOwnedWindows()) {
- if (w.getClass().getName().equals("javax.swing.Popup$HeavyWeightWindow")) {
- if (w instanceof RootPaneContainer) {
- popupContainer = ((RootPaneContainer) w).getContentPane();
- }
- else {
- popupContainer = w;
- }
- break;
- }
- }
- }
- if (popupContainer != null) {
- for (AbstractButton b : SwingUtility.findChildComponents(popupContainer, AbstractButton.class)) {
- if (label.equals(b.getText())) {
- return b;
- }
- }
- }
- return null;
- }
- });
- }
- });
- }
-
- protected JComponent waitForPushButtonWithLabel(final String label) {
- return waitUntil(new WaitCondition<JComponent>() {
- @Override
- public JComponent run() {
- return syncExec(new MockRunnable<JComponent>() {
- @Override
- public JComponent run() throws Throwable {
- for (Component parent : enumerateParentContainers()) {
- for (Component o : SwingUtility.findChildComponents(parent, Component.class)) {
- if (o instanceof AbstractButton) {
- if (cleanButtonLabel(label).equals(cleanButtonLabel(((AbstractButton) o).getText()))) {
- return (AbstractButton) o;
- }
- }
- }
- }
- return null;
- }
- });
- }
- });
- }
-
- protected JComponent waitForIndexedField(final FieldType type, final int fieldIndex) {
- return waitUntil(new WaitCondition<JComponent>() {
- @Override
- public JComponent run() {
- return syncExec(new MockRunnable<JComponent>() {
- @Override
- public JComponent run() throws Throwable {
- for (Component parent : enumerateParentContainers()) {
- int index = 0;
- for (JComponent c : SwingUtility.findChildComponents(parent, JComponent.class)) {
- if (getFieldTypeOf(c) == type) {
- if (index == fieldIndex) {
- return c;
- }
- index++;
- }
- }
- }
- return null;
- }
- });
- }
- });
- }
-
- protected JComponent waitForScoutField(final String name) {
- return waitUntil(new WaitCondition<JComponent>() {
- @Override
- public JComponent run() {
- return syncExec(new MockRunnable<JComponent>() {
- @Override
- public JComponent run() throws Throwable {
- JComponent lastSecondaryCandidate = null;
- for (Component parent : enumerateParentContainers()) {
- for (JComponent c : SwingUtility.findChildComponents(parent, JComponent.class)) {
- String s = getScoutNameOf(c);
- if (s != null && ("." + s).endsWith("." + name)) {
- lastSecondaryCandidate = c;
- if (getFieldTypeOf(c) != null) {
- //primary match
- return c;
- }
- }
- }
- }
- return lastSecondaryCandidate;
- }
- });
- }
- });
- }
-
- protected List<Component> enumerateParentContainers() {
- ArrayList<Component> parents = new ArrayList<Component>();
- //find leightweight popup
- Window activeWindow = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
- if (activeWindow instanceof RootPaneContainer) {
- Component[] a = ((RootPaneContainer) activeWindow).getLayeredPane().getComponentsInLayer(JLayeredPane.POPUP_LAYER);
- if (a.length > 0) {
- parents.add(a[0]);
- }
- }
- //find heavyweight popup
- for (Window w : activeWindow.getOwnedWindows()) {
- if (w.getClass().getName().equals("javax.swing.Popup$HeavyWeightWindow")) {
- if (w.isShowing()) {
- if (w instanceof RootPaneContainer) {
- parents.add(((RootPaneContainer) w).getContentPane());
- }
- else {
- parents.add(w);
- }
- }
- break;
- }
- }
- for (Window w : JWindow.getWindows()) {
- if (w.isShowing()) {
- if (w instanceof RootPaneContainer) {
- parents.add(((RootPaneContainer) w).getContentPane());
- }
- else {
- parents.add(w);
- }
- }
- }
- return parents;
- }
-
- protected FieldType getFieldTypeOf(Container c) {
- if (c == null) {
- return null;
- }
- if (!c.isShowing()) {
- return null;
- }
-
- if (c instanceof JComponent && ((JComponent) c).getVisibleRect().isEmpty()) {
- return null;
- }
- //
- if (c instanceof JLabel) {
- return FieldType.Label;
- }
- if (c instanceof JTextComponent) {
- return FieldType.Text;
- }
- if (c instanceof JCheckBox) {
- return FieldType.Checkbox;
- }
- if (c instanceof JRadioButton) {
- return FieldType.RadioButton;
- }
- if (c instanceof JTable) {
- return FieldType.Table;
- }
- if (c instanceof JTree) {
- return FieldType.Tree;
- }
- if (c instanceof AbstractButton) {
- if (SwingUtilities.getAncestorOfClass(JScrollBar.class, c) != null) {
- return FieldType.ScrollButton;
- }
- else {
- return FieldType.PushButton;
- }
- }
- return null;
- }
-
- protected String getScoutNameOf(Container c) {
- IPropertyObserver scoutObject = SwingScoutComposite.getScoutModelOnWidget(c);
- if (scoutObject != null) {
- return scoutObject.getClass().getName();
- }
- return null;
- }
-
- protected int toKeyCode(Key key) {
- switch (key) {
- case Shift:
- return KeyEvent.VK_SHIFT;
- case Control:
- return KeyEvent.VK_CONTROL;
- case Alt:
- return KeyEvent.VK_ALT;
- case Delete:
- return KeyEvent.VK_DELETE;
- case Backspace:
- return KeyEvent.VK_BACK_SPACE;
- case Enter:
- return KeyEvent.VK_ENTER;
- case Esc:
- return KeyEvent.VK_ESCAPE;
- case Tab:
- return KeyEvent.VK_TAB;
- case ContextMenu:
- return KeyEvent.VK_CONTEXT_MENU;
- case Up:
- return KeyEvent.VK_UP;
- case Down:
- return KeyEvent.VK_DOWN;
- case Left:
- return KeyEvent.VK_LEFT;
- case Right:
- return KeyEvent.VK_RIGHT;
- default:
- throw new IllegalArgumentException("Unknown keyboard key: " + key);
- }
- }
-
- protected <T> T syncExec(final MockRunnable<T> r) {
- final AtomicReference<T> ret = new AtomicReference<T>();
- if (!SwingUtilities.isEventDispatchThread()) {
- final AtomicReference<Throwable> ex = new AtomicReference<Throwable>();
- try {
- SwingUtilities.invokeAndWait(new Runnable() {
- @Override
- public void run() {
- try {
- ret.set(syncExec(r));
- }
- catch (Throwable t) {
- ex.set(t);
- }
- }
- });
- if (ex.get() != null) {
- throw ex.get();
- }
- return ret.get();
- }
- catch (Throwable t) {
- throw new RuntimeException(t);
- }
- }
- //
- try {
- return r.run();
- }
- catch (Throwable t) {
- throw new RuntimeException(t);
- }
- }
-
- protected <T> T waitUntil(final WaitCondition<T> w) {
- try {
- return TestingUtility.waitUntil(WAIT_TIMEOUT, w);
- }
- catch (Throwable t) {
- throw new RuntimeException(t);
- }
- finally {
- waitForIdle();
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.testing.ui.swing;
+
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Dialog;
+import java.awt.Frame;
+import java.awt.KeyboardFocusManager;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.Robot;
+import java.awt.Toolkit;
+import java.awt.Window;
+import java.awt.datatransfer.StringSelection;
+import java.awt.datatransfer.Transferable;
+import java.awt.event.KeyEvent;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.atomic.AtomicReference;
+
+import javax.swing.AbstractButton;
+import javax.swing.Icon;
+import javax.swing.JCheckBox;
+import javax.swing.JComponent;
+import javax.swing.JInternalFrame;
+import javax.swing.JLabel;
+import javax.swing.JLayeredPane;
+import javax.swing.JRadioButton;
+import javax.swing.JScrollBar;
+import javax.swing.JTable;
+import javax.swing.JTree;
+import javax.swing.JWindow;
+import javax.swing.RootPaneContainer;
+import javax.swing.SwingUtilities;
+import javax.swing.text.JTextComponent;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.core.runtime.jobs.JobChangeAdapter;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.beans.IPropertyObserver;
+import org.eclipse.scout.commons.dnd.TextTransferObject;
+import org.eclipse.scout.commons.dnd.TransferObject;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.testing.shared.TestingUtility;
+import org.eclipse.scout.rt.testing.shared.WaitCondition;
+import org.eclipse.scout.rt.ui.swing.SwingUtility;
+import org.eclipse.scout.rt.ui.swing.basic.ISwingScoutComposite;
+import org.eclipse.scout.rt.ui.swing.basic.SwingScoutComposite;
+import org.eclipse.scout.rt.ui.swing.icons.CheckboxIcon;
+import org.eclipse.scout.testing.client.IGuiMock;
+import org.eclipse.scout.testing.client.robot.JavaRobot;
+
+/**
+ * Uses {@link Robot}
+ */
+public class SwingMock implements IGuiMock {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(SwingMock.class);
+
+ static interface MockRunnable<T> {
+ T run() throws Throwable;
+ }
+
+ private final IClientSession m_session;
+ private final JavaRobot m_bot;
+ private int m_treeNodeToExpandIconGap;
+
+ public SwingMock(IClientSession session) {
+ m_session = session;
+ m_bot = new JavaRobot();
+ }
+
+ @Override
+ public void initializeMock() {
+ }
+
+ @Override
+ public void shutdownMock() {
+ }
+
+ @Override
+ public void beforeTest() {
+ }
+
+ @Override
+ public void afterTest() {
+ }
+
+ @Override
+ public GuiStrategy getStrategy() {
+ return GuiStrategy.Swing;
+ }
+
+ public int getTreeNodeToExpandIconGap() {
+ if (m_treeNodeToExpandIconGap <= 0) {
+ String s = Activator.getDefault().getBundle().getBundleContext().getProperty("IGuiMock.treeNodeToExpandIconGap");
+ if (s == null) {
+ LOG.warn("Missing config.ini property 'IGuiMock.treeNodeToExpandIconGap'; using default value of 4");
+ s = "4";
+ }
+ m_treeNodeToExpandIconGap = Integer.parseInt(s);
+ }
+ return m_treeNodeToExpandIconGap;
+ }
+
+ public void setTreeNodeToExpandIconGap(int treeNodeToExpandIconGap) {
+ m_treeNodeToExpandIconGap = treeNodeToExpandIconGap;
+ }
+
+ @Override
+ public void waitForIdle() {
+ if (SwingUtilities.isEventDispatchThread()) {
+ return;
+ }
+ //
+ for (int pass = 0; pass < 2; pass++) {
+ m_bot.sleep(80);
+ //wait until gui queue is empty
+ syncExec(new MockRunnable<Object>() {
+ @Override
+ public Object run() throws Throwable {
+ return null;
+ }
+ });
+ //wait until model queue is empty
+ ClientSyncJob idleJob = new ClientSyncJob("Check for idle", m_session) {
+ @Override
+ protected void runVoid(IProgressMonitor m) throws Throwable {
+ }
+ };
+ idleJob.setSystem(true);
+
+ final CountDownLatch idleJobScheduledSignal = new CountDownLatch(1);
+ JobChangeAdapter listener = new JobChangeAdapter() {
+ @Override
+ public void done(IJobChangeEvent event) {
+ idleJobScheduledSignal.countDown();
+ }
+ };
+
+ try {
+ idleJob.addJobChangeListener(listener);
+ idleJob.schedule();
+ try {
+ idleJobScheduledSignal.await();
+ }
+ catch (InterruptedException e) {
+ throw new IllegalStateException("Interrupted");
+ }
+ }
+ finally {
+ idleJob.removeJobChangeListener(listener);
+ }
+ }
+ }
+
+ @Override
+ public void waitForActiveWindow(final String title) {
+ waitUntil(new WaitCondition<Object>() {
+ @Override
+ public Object run() {
+ if (isWindowActive(title)) {
+ return true;
+ }
+ else {
+ return null;
+ }
+ }
+ });
+ waitForIdle();
+ }
+
+ @Override
+ public void waitForOpenWindow(final String title) {
+ waitUntil(new WaitCondition<Object>() {
+ @Override
+ public Object run() {
+ if (isWindowOpen(title)) {
+ return true;
+ }
+ else {
+ return null;
+ }
+ }
+ });
+ waitForIdle();
+ }
+
+ @Override
+ public int getSleepDelay() {
+ return m_bot.getAutoDelay();
+ }
+
+ @Override
+ public void setSleepDelay(int sleepDelay) {
+ m_bot.setAutoDelay(sleepDelay);
+ }
+
+ @Override
+ public void sleep() {
+ sleep(getSleepDelay());
+ }
+
+ @Override
+ public void sleep(int millis) {
+ //only sleep when NOT in gui thread
+ if (SwingUtilities.isEventDispatchThread()) {
+ return;
+ }
+ m_bot.sleep(millis);
+ waitForIdle();
+ }
+
+ @Override
+ public boolean isWindowActive(final String title) {
+ return syncExec(new MockRunnable<Boolean>() {
+ @Override
+ public Boolean run() throws Throwable {
+ for (Window w : findWindows(title)) {
+ if (w.isActive()) {
+ return true;
+ }
+ }
+ JInternalFrame f = findInternalFrame(title);
+ if (f != null) {
+ return f.isSelected();
+ }
+ return false;
+ }
+ });
+ }
+
+ @Override
+ public boolean isWindowOpen(final String title) {
+ return syncExec(new MockRunnable<Boolean>() {
+ @Override
+ public Boolean run() throws Throwable {
+ for (Window w : findWindows(title)) {
+ if (w.isVisible()) {
+ return true;
+ }
+ }
+ JInternalFrame f = findInternalFrame(title);
+ if (f != null) {
+ return f.isVisible();
+ }
+ return false;
+ }
+ });
+ }
+
+ @Override
+ public void activateWindow(final String title) {
+ waitForOpenWindow(title);
+ syncExec(new MockRunnable<Object>() {
+ @Override
+ public Object run() throws Throwable {
+ Window w = findWindow(title);
+ if (w != null) {
+ w.requestFocusInWindow();
+ return null;
+ }
+ JInternalFrame f = findInternalFrame(title);
+ if (f != null) {
+ f.requestFocusInWindow();
+ f.setSelected(true);
+ return null;
+ }
+ throw new IllegalStateException("There is no view with title " + title);
+ }
+ });
+ waitForIdle();
+ }
+
+ @Override
+ public void clickOnPushButton(String text) {
+ final JComponent c = waitForPushButtonWithLabel(text);
+ syncExec(new MockRunnable<Object>() {
+ @Override
+ public Object run() throws Throwable {
+ Point p = c.getLocationOnScreen();
+ gotoPoint(p.x + c.getWidth() / 2, p.y + c.getHeight() / 2);
+ clickLeft();
+ return null;
+ }
+ });
+ waitForIdle();
+ }
+
+ @Override
+ public void gotoField(FieldType type, int fieldIndex) {
+ final JComponent c = waitForIndexedField(type, fieldIndex);
+ syncExec(new MockRunnable<Object>() {
+ @Override
+ public Object run() throws Throwable {
+ Point p = c.getLocationOnScreen();
+ gotoPoint(p.x + c.getWidth() / 2, p.y + c.getHeight() / 2);
+ return null;
+ }
+ });
+ }
+
+ @Override
+ public void gotoScoutField(String name) {
+ final JComponent c = waitForScoutField(name);
+ syncExec(new MockRunnable<Object>() {
+ @Override
+ public Object run() throws Throwable {
+ Point p = c.getLocationOnScreen();
+ gotoPoint(p.x + c.getWidth() / 2, p.y + c.getHeight() / 2);
+ return null;
+ }
+ });
+ }
+
+ @Override
+ public void gotoTable(int tableIndex, final int rowIndex, final int columnIndex) {
+ final JTable table = (JTable) waitForIndexedField(FieldType.Table, tableIndex);
+ syncExec(new MockRunnable<Object>() {
+ @Override
+ public Object run() throws Throwable {
+ Rectangle r = getTableCellBounds(table, rowIndex, columnIndex);
+ if (!table.getVisibleRect().contains(r.x + r.width / 2, r.y + r.height / 2)) {
+ throw new IllegalStateException("table cell " + rowIndex + "," + columnIndex + " is not visible on screen");
+ }
+ Point p = table.getLocationOnScreen();
+ gotoPoint(p.x + r.x + r.width / 2, p.y + r.y + r.height / 2);
+ return null;
+ }
+ });
+ }
+
+ @Override
+ public void gotoTableHeader(int tableIndex, final int columnIndex) {
+ final JTable table = (JTable) waitForIndexedField(FieldType.Table, tableIndex);
+ syncExec(new MockRunnable<Object>() {
+ @Override
+ public Object run() throws Throwable {
+ Rectangle r = getTableHeaderCellBounds(table, columnIndex);
+ Point p = table.getTableHeader().getLocationOnScreen();
+ gotoPoint(p.x + r.x + r.width / 2, p.y + r.y + r.height / 2);
+ return null;
+ }
+ });
+ }
+
+ @Override
+ public void gotoTree(int treeIndex, final String nodeText) {
+ final JTree tree = (JTree) waitForIndexedField(FieldType.Tree, treeIndex);
+ syncExec(new MockRunnable<Object>() {
+ @Override
+ public Object run() throws Throwable {
+ Rectangle r = getTreeRowBounds(tree, getTreeRowIndex(tree, nodeText));
+ if (!tree.getVisibleRect().contains(r.x + r.width / 2, r.y + r.height / 2)) {
+ throw new IllegalStateException("tree node " + nodeText + " is not visible on screen");
+ }
+ Point p = tree.getLocationOnScreen();
+ gotoPoint(p.x + r.x + r.width / 2, p.y + r.y + r.height / 2);
+ return null;
+ }
+ });
+ }
+
+ @Override
+ public void gotoTreeExpandIcon(int treeIndex, final String nodeText) {
+ final JTree tree = (JTree) waitForIndexedField(FieldType.Tree, treeIndex);
+ syncExec(new MockRunnable<Object>() {
+ @Override
+ public Object run() throws Throwable {
+ Rectangle r = getTreeRowBounds(tree, getTreeRowIndex(tree, nodeText));
+ if (!tree.getVisibleRect().contains(r.x + r.width / 2, r.y + r.height / 2)) {
+ throw new IllegalStateException("tree node " + nodeText + " is not visible on screen");
+ }
+ Point p = tree.getLocationOnScreen();
+ gotoPoint(p.x + r.x - getTreeNodeToExpandIconGap() - 2, p.y + r.y + r.height / 2);
+ return null;
+ }
+ });
+ }
+
+ @Override
+ public void contextMenu(final String... names) {
+ //move to menu
+ for (int i = 0; i < names.length; i++) {
+ String label = names[i];
+ final boolean lastItem = i == names.length - 1;
+ final Component m = waitForContextMenu(label);
+ syncExec(new MockRunnable<Boolean>() {
+ @Override
+ public Boolean run() throws Throwable {
+ Point p = m.getLocationOnScreen();
+ gotoPoint(p.x + m.getWidth() / 2, p.y + m.getHeight() / 2);
+ if (lastItem) {
+ //click on last menu
+ clickLeft();
+ }
+ return null;
+ }
+ });
+ waitForIdle();
+ }
+ }
+
+ @Override
+ public List<String> getTableCells(int tableIndex, final int columnIndex) {
+ final JTable table = (JTable) waitForIndexedField(FieldType.Table, tableIndex);
+ return syncExec(new MockRunnable<List<String>>() {
+ @Override
+ public List<String> run() throws Throwable {
+ ArrayList<String> list = new ArrayList<String>();
+ for (int row = 0; row < table.getRowCount(); row++) {
+ list.add(getTableCellText(table, row, columnIndex));
+ }
+ return list;
+ }
+ });
+ }
+
+ @Override
+ public List<String> getTreeNodes(int treeIndex) {
+ final JTree tree = (JTree) waitForIndexedField(FieldType.Tree, treeIndex);
+ return syncExec(new MockRunnable<List<String>>() {
+ @Override
+ public List<String> run() throws Throwable {
+ ArrayList<String> list = new ArrayList<String>();
+ for (int row = 0; row < tree.getRowCount(); row++) {
+ list.add(getTreeRowText(tree, row));
+ }
+ return list;
+ }
+ });
+ }
+
+ @Override
+ public Set<String> getSelectedTableCells(int tableIndex, final int columnIndex) {
+ final JTable table = (JTable) waitForIndexedField(FieldType.Table, tableIndex);
+ return syncExec(new MockRunnable<Set<String>>() {
+ @Override
+ public Set<String> run() throws Throwable {
+ TreeSet<String> set = new TreeSet<String>();
+ int[] sel = table.getSelectedRows();
+ if (sel != null) {
+ for (int row : sel) {
+ set.add(getTableCellText(table, row, columnIndex));
+ }
+ }
+ return set;
+ }
+ });
+ }
+
+ /**
+ * Works only if checked Row is visible
+ */
+ @Override
+ public Set<String> getCheckedTableCells(int tableIndex, final int columnIndex) {
+ final JTable table = (JTable) waitForIndexedField(FieldType.Table, tableIndex);
+ return syncExec(new MockRunnable<Set<String>>() {
+ @Override
+ public Set<String> run() throws Throwable {
+ TreeSet<String> check = new TreeSet<String>();
+ for (int i = 0; i < table.getRowCount(); i++) {
+ Icon icon = getTableCellIcon(table, i);
+ if (icon instanceof CheckboxIcon) {
+ if (((CheckboxIcon) icon).isSelecetd()) {
+ check.add(getTableCellText(table, i, columnIndex));
+ }
+ }
+ }
+ return check;
+ }
+ });
+ }
+
+ @Override
+ public Set<String> getSelectedTreeNodes(int treeIndex) {
+ final JTree tree = (JTree) waitForIndexedField(FieldType.Tree, treeIndex);
+ return syncExec(new MockRunnable<Set<String>>() {
+ @Override
+ public Set<String> run() throws Throwable {
+ TreeSet<String> set = new TreeSet<String>();
+ int[] sel = tree.getSelectionRows();
+ if (sel != null) {
+ for (int row : sel) {
+ set.add(getTreeRowText(tree, row));
+ }
+ }
+ return set;
+ }
+ });
+ }
+
+ @Override
+ public FieldState getFocusFieldState() {
+ return syncExec(new MockRunnable<FieldState>() {
+ @Override
+ public FieldState run() throws Throwable {
+ checkActiveWindow();
+ Component c = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
+ if (c == null) {
+ throw new IllegalStateException("There is no focus owner");
+ }
+ if (!(c instanceof JComponent)) {
+ throw new IllegalStateException("Focus owner is not a swing field");
+ }
+ return getFieldStateInternal((JComponent) c);
+ }
+ });
+ }
+
+ @Override
+ public FieldState getFieldState(FieldType type, int index) {
+ final JComponent c = waitForIndexedField(type, index);
+ return syncExec(new MockRunnable<FieldState>() {
+ @Override
+ public FieldState run() throws Throwable {
+ return getFieldStateInternal(c);
+ }
+ });
+ }
+
+ @Override
+ public FieldState getScoutFieldState(String name) {
+ final JComponent c = waitForScoutField(name);
+ return syncExec(new MockRunnable<FieldState>() {
+ @Override
+ public FieldState run() throws Throwable {
+ return getFieldStateInternal(c);
+ }
+ });
+ }
+
+ @Override
+ public FieldState getScoutFieldContainerState(String name) {
+ final JComponent c = waitForScoutField(name);
+ return syncExec(new MockRunnable<FieldState>() {
+ @Override
+ public FieldState run() throws Throwable {
+ ISwingScoutComposite swingScoutComposite = SwingScoutComposite.getCompositeOnWidget(c);
+ if (swingScoutComposite == null) {
+ return null;
+ }
+
+ return getFieldStateInternal(swingScoutComposite.getSwingContainer());
+ }
+ });
+ }
+
+ @Override
+ public List<FieldState> getFieldStates(final FieldType type) {
+ return syncExec(new MockRunnable<List<FieldState>>() {
+ @Override
+ public List<FieldState> run() throws Throwable {
+ checkActiveWindow();
+ List<FieldState> list = new ArrayList<FieldState>();
+ for (Component parent : enumerateParentContainers()) {
+ for (JComponent c : SwingUtility.findChildComponents(parent, JComponent.class)) {
+ if (type == null && getFieldTypeOf(c) != null) {
+ list.add(getFieldStateInternal(c));
+ }
+ else if (type != null && getFieldTypeOf(c) == type) {
+ list.add(getFieldStateInternal(c));
+ }
+ }
+ }
+ return list;
+ }
+ });
+ }
+
+ @Override
+ public void gotoPoint(int x, int y) {
+ m_bot.moveTo(x, y);
+ }
+
+ @Override
+ public void move(int deltaX, int deltaY) {
+ m_bot.moveDelta(deltaX, deltaY);
+ }
+
+ @Override
+ public void clickLeft() {
+ m_bot.clickLeft();
+ waitForIdle();
+ }
+
+ @Override
+ public void clickRight() {
+ m_bot.clickRight();
+ waitForIdle();
+ }
+
+ @Override
+ public void pressLeft() {
+ m_bot.pressLeft();
+ }
+
+ @Override
+ public void releaseLeft() {
+ m_bot.releaseLeft();
+ waitForIdle();
+ }
+
+ @Override
+ public void drag(int x1, int y1, int x2, int y2) {
+ gotoPoint(x1, y1);
+ m_bot.pressLeft();
+ gotoPoint(x2, y2);
+ m_bot.releaseLeft();
+ waitForIdle();
+ }
+
+ @Override
+ public void dragWindowRightBorder(WindowState windowState, int pixelToMoveOnX) {
+ int borderSize = 2;
+
+ int xPos = windowState.x + windowState.width + borderSize;
+ int yPos = windowState.y + windowState.height / 2;
+ drag(xPos, yPos, xPos + pixelToMoveOnX, yPos);
+ }
+
+ @Override
+ public void typeText(final String text) {
+ m_bot.typeText(text);
+ waitForIdle();
+ }
+
+ @Override
+ public void pressKey(Key key) {
+ m_bot.pressKey(key);
+ waitForIdle();
+ }
+
+ @Override
+ public void paste(final String text) {
+ Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(text), null);
+ //press paste (ctrl-V)
+ m_bot.pressKey(Key.Control);
+ m_bot.typeText("v");
+ m_bot.releaseKey(Key.Control);
+ }
+
+ @Override
+ public void releaseKey(Key key) {
+ m_bot.releaseKey(key);
+ waitForIdle();
+ }
+
+ @Override
+ public void typeKey(Key key) {
+ m_bot.typeKey(key);
+ waitForIdle();
+ }
+
+ @Override
+ public WindowState getWindowState(final String title) {
+ return syncExec(new MockRunnable<WindowState>() {
+ @Override
+ public WindowState run() throws Throwable {
+ checkActiveWindow();
+ JInternalFrame part = findInternalFrame(title);
+ if (part != null) {
+ Rectangle r = part.getBounds();
+ WindowState state = new WindowState();
+ Point p = part.getLocationOnScreen();
+ state.x = p.x;
+ state.y = p.y;
+ state.width = r.width;
+ state.height = r.height;
+ return state;
+ }
+ Window w = findWindow(title);
+ if (w != null) {
+ Rectangle r = w.getBounds();
+ WindowState state = new WindowState();
+ Point p = w.getLocationOnScreen();
+ state.x = p.x;
+ state.y = p.y;
+ state.width = r.width;
+ state.height = r.height;
+ return state;
+ }
+ throw new IllegalStateException("Window " + title + " not found");
+ }
+ });
+ }
+
+ @Override
+ public String getClipboardText() {
+ waitForIdle();
+ Transferable t = Toolkit.getDefaultToolkit().getSystemClipboard().getContents(null);
+ TransferObject o = SwingUtility.createScoutTransferable(t);
+ if (o != null && o.isText()) {
+ return ((TextTransferObject) o).getPlainText();
+ }
+ return null;
+ }
+
+ @Override
+ public Object internal0(final Object o) {
+ return null;
+ }
+
+ protected FieldState getFieldStateInternal(Container c) {
+ FieldState state = new FieldState();
+ //type
+ state.type = getFieldTypeOf(c);
+ //scout name
+ state.scoutName = getScoutNameOf(c);
+ //focus
+ state.focus = c.isFocusOwner();
+ //bounds
+ Point p = c.getLocationOnScreen();
+ state.x = p.x;
+ state.y = p.y;
+ state.width = c.getWidth();
+ state.height = c.getHeight();
+ //text
+ if (c instanceof JLabel) {
+ state.text = ((JLabel) c).getText();
+ }
+ if (c instanceof JTextComponent) {
+ state.text = ((JTextComponent) c).getText();
+ }
+ if (c instanceof AbstractButton) {
+ state.text = ((AbstractButton) c).getText();
+ }
+ return state;
+ }
+
+ protected int getTreeRowIndex(JTree tree, String nodeText) {
+ for (int i = 0; i < tree.getRowCount(); i++) {
+ Component tmp = tree.getCellRenderer().getTreeCellRendererComponent(tree, tree.getPathForRow(i).getLastPathComponent(), false, false, false, i, false);
+ if (tmp instanceof JLabel) {
+ JLabel label = (JLabel) tmp;
+ if (nodeText.equals(label.getText())) {
+ return i;
+ }
+ }
+ }
+ return -1;
+ }
+
+ protected String getTreeRowText(JTree tree, int rowIndex) {
+ if (rowIndex < 0 || rowIndex > tree.getRowCount()) {
+ throw new IllegalStateException("Tree has " + tree.getRowCount() + " rows (accessing " + rowIndex + ")");
+ }
+ Component tmp = tree.getCellRenderer().getTreeCellRendererComponent(tree, tree.getPathForRow(rowIndex).getLastPathComponent(), false, false, false, rowIndex, false);
+ if (tmp instanceof JLabel) {
+ JLabel label = (JLabel) tmp;
+ return label.getText();
+ }
+ return null;
+ }
+
+ protected Rectangle getTreeRowBounds(JTree tree, int rowIndex) {
+ if (rowIndex < 0 || rowIndex > tree.getRowCount()) {
+ throw new IllegalStateException("Tree has " + tree.getRowCount() + " rows (accessing " + rowIndex + ")");
+ }
+ return tree.getPathBounds(tree.getPathForRow(rowIndex));
+ }
+
+ protected String getTableCellText(JTable table, int rowIndex, int columnIndex) {
+ if (rowIndex < 0 || rowIndex > table.getRowCount()) {
+ throw new IllegalStateException("Table has " + table.getRowCount() + " rows (accessing " + rowIndex + ")");
+ }
+ if (columnIndex < 0 || columnIndex > table.getColumnCount()) {
+ throw new IllegalStateException("Table has " + table.getColumnCount() + " columns (accessing " + columnIndex + ")");
+ }
+ Component label = table.prepareRenderer(table.getCellRenderer(rowIndex, columnIndex), rowIndex, columnIndex);
+ if (label instanceof JLabel) {
+ return ((JLabel) label).getText();
+ }
+ return null;
+ }
+
+ protected Icon getTableCellIcon(JTable table, int rowIndex) {
+ if (rowIndex < 0 || rowIndex > table.getRowCount()) {
+ throw new IllegalStateException("Table has " + table.getRowCount() + " rows (accessing " + rowIndex + ")");
+ }
+ Component label = table.prepareRenderer(table.getCellRenderer(rowIndex, 0), rowIndex, 0);
+ if (label instanceof JLabel) {
+ return ((JLabel) label).getIcon();
+ }
+ return null;
+ }
+
+ protected Rectangle getTableCellBounds(JTable table, int rowIndex, int columnIndex) {
+ if (rowIndex < 0 || rowIndex > table.getRowCount()) {
+ throw new IllegalStateException("Table has " + table.getRowCount() + " rows (accessing " + rowIndex + ")");
+ }
+ if (columnIndex < 0 || columnIndex > table.getColumnCount()) {
+ throw new IllegalStateException("Table has " + table.getColumnCount() + " columns (accessing " + columnIndex + ")");
+ }
+ return table.getCellRect(rowIndex, columnIndex, true);
+ }
+
+ protected Rectangle getTableHeaderCellBounds(JTable table, int columnIndex) {
+ if (columnIndex < 0 || columnIndex > table.getColumnCount()) {
+ throw new IllegalStateException("Table has " + table.getColumnCount() + " columns (accessing " + columnIndex + ")");
+ }
+ return table.getTableHeader().getHeaderRect(columnIndex);
+ }
+
+ protected void checkActiveWindow() {
+ if (getActiveWindow() == null) {
+ throw new IllegalStateException("There is no active view");
+ }
+ }
+
+ protected Window getActiveWindow() {
+ Window w = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
+ return w;
+ }
+
+ protected String cleanButtonLabel(String s) {
+ return StringUtility.removeMnemonic(s);
+ }
+
+ protected Window findWindow(String title) {
+ for (Window w : Window.getWindows()) {
+ if (w.isVisible()) {
+ if (w instanceof Dialog && title.equals(((Dialog) w).getTitle())) {
+ return w;
+ }
+ else if (w instanceof Frame && title.equals(((Frame) w).getTitle())) {
+ return w;
+ }
+ }
+ }
+ return null;
+ }
+
+ protected List<Window> findWindows(String title) {
+ ArrayList<Window> list = new ArrayList<Window>();
+ for (Window w : Window.getWindows()) {
+ if (w.isVisible()) {
+ if (w instanceof Dialog && title.equals(((Dialog) w).getTitle())) {
+ list.add(w);
+ }
+ else if (w instanceof Frame && title.equals(((Frame) w).getTitle())) {
+ list.add(w);
+ }
+ }
+ }
+ return list;
+ }
+
+ protected JInternalFrame findInternalFrame(String title) {
+ for (Window w : JWindow.getWindows()) {
+ for (JInternalFrame i : SwingUtility.findChildComponents(w, JInternalFrame.class)) {
+ if (i.isVisible()) {
+ if (title.equals(i.getTitle())) {
+ return i;
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ //wait for window containing this button
+ protected Component waitForContextMenu(final String text) {
+ return waitUntil(new WaitCondition<Component>() {
+ @Override
+ public Component run() {
+ return syncExec(new MockRunnable<Component>() {
+ @Override
+ public Component run() throws Throwable {
+ String label = cleanButtonLabel(text);
+ //find lightweight popup
+ Window activeWindow = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
+ Component popupContainer = null;
+ if (popupContainer == null) {
+ if (activeWindow instanceof RootPaneContainer) {
+ Component[] a = ((RootPaneContainer) activeWindow).getLayeredPane().getComponentsInLayer(JLayeredPane.POPUP_LAYER);
+ if (a.length > 0) {
+ popupContainer = a[0];
+ }
+ }
+ }
+ //find heavyweight popup
+ if (popupContainer == null) {
+ for (Window w : activeWindow.getOwnedWindows()) {
+ if (w.getClass().getName().equals("javax.swing.Popup$HeavyWeightWindow")) {
+ if (w instanceof RootPaneContainer) {
+ popupContainer = ((RootPaneContainer) w).getContentPane();
+ }
+ else {
+ popupContainer = w;
+ }
+ break;
+ }
+ }
+ }
+ if (popupContainer != null) {
+ for (AbstractButton b : SwingUtility.findChildComponents(popupContainer, AbstractButton.class)) {
+ if (label.equals(b.getText())) {
+ return b;
+ }
+ }
+ }
+ return null;
+ }
+ });
+ }
+ });
+ }
+
+ protected JComponent waitForPushButtonWithLabel(final String label) {
+ return waitUntil(new WaitCondition<JComponent>() {
+ @Override
+ public JComponent run() {
+ return syncExec(new MockRunnable<JComponent>() {
+ @Override
+ public JComponent run() throws Throwable {
+ for (Component parent : enumerateParentContainers()) {
+ for (Component o : SwingUtility.findChildComponents(parent, Component.class)) {
+ if (o instanceof AbstractButton) {
+ if (cleanButtonLabel(label).equals(cleanButtonLabel(((AbstractButton) o).getText()))) {
+ return (AbstractButton) o;
+ }
+ }
+ }
+ }
+ return null;
+ }
+ });
+ }
+ });
+ }
+
+ protected JComponent waitForIndexedField(final FieldType type, final int fieldIndex) {
+ return waitUntil(new WaitCondition<JComponent>() {
+ @Override
+ public JComponent run() {
+ return syncExec(new MockRunnable<JComponent>() {
+ @Override
+ public JComponent run() throws Throwable {
+ for (Component parent : enumerateParentContainers()) {
+ int index = 0;
+ for (JComponent c : SwingUtility.findChildComponents(parent, JComponent.class)) {
+ if (getFieldTypeOf(c) == type) {
+ if (index == fieldIndex) {
+ return c;
+ }
+ index++;
+ }
+ }
+ }
+ return null;
+ }
+ });
+ }
+ });
+ }
+
+ protected JComponent waitForScoutField(final String name) {
+ return waitUntil(new WaitCondition<JComponent>() {
+ @Override
+ public JComponent run() {
+ return syncExec(new MockRunnable<JComponent>() {
+ @Override
+ public JComponent run() throws Throwable {
+ JComponent lastSecondaryCandidate = null;
+ for (Component parent : enumerateParentContainers()) {
+ for (JComponent c : SwingUtility.findChildComponents(parent, JComponent.class)) {
+ String s = getScoutNameOf(c);
+ if (s != null && ("." + s).endsWith("." + name)) {
+ lastSecondaryCandidate = c;
+ if (getFieldTypeOf(c) != null) {
+ //primary match
+ return c;
+ }
+ }
+ }
+ }
+ return lastSecondaryCandidate;
+ }
+ });
+ }
+ });
+ }
+
+ protected List<Component> enumerateParentContainers() {
+ ArrayList<Component> parents = new ArrayList<Component>();
+ //find leightweight popup
+ Window activeWindow = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
+ if (activeWindow instanceof RootPaneContainer) {
+ Component[] a = ((RootPaneContainer) activeWindow).getLayeredPane().getComponentsInLayer(JLayeredPane.POPUP_LAYER);
+ if (a.length > 0) {
+ parents.add(a[0]);
+ }
+ }
+ //find heavyweight popup
+ for (Window w : activeWindow.getOwnedWindows()) {
+ if (w.getClass().getName().equals("javax.swing.Popup$HeavyWeightWindow")) {
+ if (w.isShowing()) {
+ if (w instanceof RootPaneContainer) {
+ parents.add(((RootPaneContainer) w).getContentPane());
+ }
+ else {
+ parents.add(w);
+ }
+ }
+ break;
+ }
+ }
+ for (Window w : JWindow.getWindows()) {
+ if (w.isShowing()) {
+ if (w instanceof RootPaneContainer) {
+ parents.add(((RootPaneContainer) w).getContentPane());
+ }
+ else {
+ parents.add(w);
+ }
+ }
+ }
+ return parents;
+ }
+
+ protected FieldType getFieldTypeOf(Container c) {
+ if (c == null) {
+ return null;
+ }
+ if (!c.isShowing()) {
+ return null;
+ }
+
+ if (c instanceof JComponent && ((JComponent) c).getVisibleRect().isEmpty()) {
+ return null;
+ }
+ //
+ if (c instanceof JLabel) {
+ return FieldType.Label;
+ }
+ if (c instanceof JTextComponent) {
+ return FieldType.Text;
+ }
+ if (c instanceof JCheckBox) {
+ return FieldType.Checkbox;
+ }
+ if (c instanceof JRadioButton) {
+ return FieldType.RadioButton;
+ }
+ if (c instanceof JTable) {
+ return FieldType.Table;
+ }
+ if (c instanceof JTree) {
+ return FieldType.Tree;
+ }
+ if (c instanceof AbstractButton) {
+ if (SwingUtilities.getAncestorOfClass(JScrollBar.class, c) != null) {
+ return FieldType.ScrollButton;
+ }
+ else {
+ return FieldType.PushButton;
+ }
+ }
+ return null;
+ }
+
+ protected String getScoutNameOf(Container c) {
+ IPropertyObserver scoutObject = SwingScoutComposite.getScoutModelOnWidget(c);
+ if (scoutObject != null) {
+ return scoutObject.getClass().getName();
+ }
+ return null;
+ }
+
+ protected int toKeyCode(Key key) {
+ switch (key) {
+ case Shift:
+ return KeyEvent.VK_SHIFT;
+ case Control:
+ return KeyEvent.VK_CONTROL;
+ case Alt:
+ return KeyEvent.VK_ALT;
+ case Delete:
+ return KeyEvent.VK_DELETE;
+ case Backspace:
+ return KeyEvent.VK_BACK_SPACE;
+ case Enter:
+ return KeyEvent.VK_ENTER;
+ case Esc:
+ return KeyEvent.VK_ESCAPE;
+ case Tab:
+ return KeyEvent.VK_TAB;
+ case ContextMenu:
+ return KeyEvent.VK_CONTEXT_MENU;
+ case Up:
+ return KeyEvent.VK_UP;
+ case Down:
+ return KeyEvent.VK_DOWN;
+ case Left:
+ return KeyEvent.VK_LEFT;
+ case Right:
+ return KeyEvent.VK_RIGHT;
+ default:
+ throw new IllegalArgumentException("Unknown keyboard key: " + key);
+ }
+ }
+
+ protected <T> T syncExec(final MockRunnable<T> r) {
+ final AtomicReference<T> ret = new AtomicReference<T>();
+ if (!SwingUtilities.isEventDispatchThread()) {
+ final AtomicReference<Throwable> ex = new AtomicReference<Throwable>();
+ try {
+ SwingUtilities.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ ret.set(syncExec(r));
+ }
+ catch (Throwable t) {
+ ex.set(t);
+ }
+ }
+ });
+ if (ex.get() != null) {
+ throw ex.get();
+ }
+ return ret.get();
+ }
+ catch (Throwable t) {
+ throw new RuntimeException(t);
+ }
+ }
+ //
+ try {
+ return r.run();
+ }
+ catch (Throwable t) {
+ throw new RuntimeException(t);
+ }
+ }
+
+ protected <T> T waitUntil(final WaitCondition<T> w) {
+ try {
+ return TestingUtility.waitUntil(WAIT_TIMEOUT, w);
+ }
+ catch (Throwable t) {
+ throw new RuntimeException(t);
+ }
+ finally {
+ waitForIdle();
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.testing.ui.swing/src/org/eclipse/scout/rt/testing/ui/swing/SwingMockService.java b/org.eclipse.scout.rt.testing.ui.swing/src/org/eclipse/scout/rt/testing/ui/swing/SwingMockService.java
index 09435fd2fe..00cdb35fc2 100644
--- a/org.eclipse.scout.rt.testing.ui.swing/src/org/eclipse/scout/rt/testing/ui/swing/SwingMockService.java
+++ b/org.eclipse.scout.rt.testing.ui.swing/src/org/eclipse/scout/rt/testing/ui/swing/SwingMockService.java
@@ -1,38 +1,38 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.testing.ui.swing;
-
-import java.awt.Robot;
-
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.shared.ui.UiDeviceType;
-import org.eclipse.scout.rt.shared.ui.UiLayer;
-import org.eclipse.scout.rt.shared.ui.UserAgent;
-import org.eclipse.scout.service.AbstractService;
-import org.eclipse.scout.testing.client.IGuiMock;
-import org.eclipse.scout.testing.client.IGuiMockService;
-
-/**
- * Uses {@link Robot}
- */
-public class SwingMockService extends AbstractService implements IGuiMockService {
-
- @Override
- public UserAgent initUserAgent() {
- return UserAgent.create(UiLayer.SWING, UiDeviceType.DESKTOP);
- }
-
- @Override
- public IGuiMock createMock(IClientSession session) {
- return new SwingMock(session);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.testing.ui.swing;
+
+import java.awt.Robot;
+
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.shared.ui.UiDeviceType;
+import org.eclipse.scout.rt.shared.ui.UiLayer;
+import org.eclipse.scout.rt.shared.ui.UserAgent;
+import org.eclipse.scout.service.AbstractService;
+import org.eclipse.scout.testing.client.IGuiMock;
+import org.eclipse.scout.testing.client.IGuiMockService;
+
+/**
+ * Uses {@link Robot}
+ */
+public class SwingMockService extends AbstractService implements IGuiMockService {
+
+ @Override
+ public UserAgent initUserAgent() {
+ return UserAgent.create(UiLayer.SWING, UiDeviceType.DESKTOP);
+ }
+
+ @Override
+ public IGuiMock createMock(IClientSession session) {
+ return new SwingMock(session);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.testing.ui.swt/.settings/org.eclipse.pde.core.prefs b/org.eclipse.scout.rt.testing.ui.swt/.settings/org.eclipse.pde.core.prefs
index baef13dd8c..a3a50fc8da 100644
--- a/org.eclipse.scout.rt.testing.ui.swt/.settings/org.eclipse.pde.core.prefs
+++ b/org.eclipse.scout.rt.testing.ui.swt/.settings/org.eclipse.pde.core.prefs
@@ -1,3 +1,3 @@
-#Mon Jul 11 16:16:00 CEST 2011
-eclipse.preferences.version=1
-pluginProject.extensions=true
+#Mon Jul 11 16:16:00 CEST 2011
+eclipse.preferences.version=1
+pluginProject.extensions=true
diff --git a/org.eclipse.scout.rt.testing.ui.swt/plugin.xml b/org.eclipse.scout.rt.testing.ui.swt/plugin.xml
index 9d02c890d1..6c109a21e2 100644
--- a/org.eclipse.scout.rt.testing.ui.swt/plugin.xml
+++ b/org.eclipse.scout.rt.testing.ui.swt/plugin.xml
@@ -1,12 +1,12 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<plugin>
- <extension
- point="org.eclipse.scout.service.services">
- <service
- class="org.eclipse.scout.rt.testing.ui.swt.SwtMockService"
- createImmediately="false">
- </service>
- </extension>
-
-</plugin>
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.scout.service.services">
+ <service
+ class="org.eclipse.scout.rt.testing.ui.swt.SwtMockService"
+ createImmediately="false">
+ </service>
+ </extension>
+
+</plugin>
diff --git a/org.eclipse.scout.rt.testing.ui.swt/src/org/eclipse/scout/rt/testing/ui/swt/Activator.java b/org.eclipse.scout.rt.testing.ui.swt/src/org/eclipse/scout/rt/testing/ui/swt/Activator.java
index 2a6fd2526b..391d24922c 100644
--- a/org.eclipse.scout.rt.testing.ui.swt/src/org/eclipse/scout/rt/testing/ui/swt/Activator.java
+++ b/org.eclipse.scout.rt.testing.ui.swt/src/org/eclipse/scout/rt/testing/ui/swt/Activator.java
@@ -1,62 +1,62 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.testing.ui.swt;
-
-import org.eclipse.core.runtime.Plugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends Plugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.scout.rt.testing.ui.swt";
-
- // The shared instance
- private static Activator plugin;
-
- /**
- * The constructor
- */
- public Activator() {
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
- */
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.testing.ui.swt;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.scout.rt.testing.ui.swt";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.testing.ui.swt/src/org/eclipse/scout/rt/testing/ui/swt/JUnitSWTJob.java b/org.eclipse.scout.rt.testing.ui.swt/src/org/eclipse/scout/rt/testing/ui/swt/JUnitSWTJob.java
index 3a8e0272ec..4269c60363 100644
--- a/org.eclipse.scout.rt.testing.ui.swt/src/org/eclipse/scout/rt/testing/ui/swt/JUnitSWTJob.java
+++ b/org.eclipse.scout.rt.testing.ui.swt/src/org/eclipse/scout/rt/testing/ui/swt/JUnitSWTJob.java
@@ -1,90 +1,90 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.testing.ui.swt;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
-import org.eclipse.scout.rt.testing.shared.ScoutJUnitPluginTestExecutor;
-import org.eclipse.scout.rt.testing.shared.TestingUtility;
-import org.eclipse.scout.rt.testing.shared.WaitCondition;
-import org.eclipse.scout.rt.ui.swt.ISwtEnvironment;
-import org.eclipse.scout.testing.client.IGuiMock;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Runs all @Test annotated methods in all classes and then exit
- * <p>
- * Normally this is called from within a swing application in the start method <code><pre>
- * public Object start(IApplicationContext context) throws Exception {
- * new JUnitSwingJob(Activator.getDefault().getEnvironment()).schedule(2000);
- * //
- * ...
- * }
- * </pre></code>
- */
-public class JUnitSWTJob extends Job {
- private final ISwtEnvironment m_environment;
-
- public JUnitSWTJob(ISwtEnvironment environment) {
- super("JUnit SWT Runner");
- setSystem(true);
- m_environment = environment;
- }
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- //wait until the application is showing
- try {
- TestingUtility.waitUntil(IGuiMock.WAIT_TIMEOUT, new WaitCondition<Object>() {
- @Override
- public Object run() {
- try {
- if (PlatformUI.isWorkbenchRunning()) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- m_environment.ensureInitialized();
- }
- });
- IClientSession session = m_environment.getClientSession();
- if (session != null) {
- IDesktop desktop = session.getDesktop();
- if (desktop != null) {
- if (desktop.isGuiAvailable() && desktop.isOpened()) {
- return true;//not null
- }
- }
- }
- }
- }
- catch (Throwable t) {
- t.printStackTrace();
- System.exit(0);
- }
- return null;
- }
- });
- }
- catch (Throwable t) {
- System.err.println("Timeout waiting for SWTApplication to start: " + t);
- System.exit(0);
- }
- //
- ScoutJUnitPluginTestExecutor scoutJUnitPluginTestExecutor = new ScoutJUnitPluginTestExecutor();
- final int code = scoutJUnitPluginTestExecutor.runAllTests();
- System.exit(code);
- return Status.OK_STATUS;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.testing.ui.swt;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
+import org.eclipse.scout.rt.testing.shared.ScoutJUnitPluginTestExecutor;
+import org.eclipse.scout.rt.testing.shared.TestingUtility;
+import org.eclipse.scout.rt.testing.shared.WaitCondition;
+import org.eclipse.scout.rt.ui.swt.ISwtEnvironment;
+import org.eclipse.scout.testing.client.IGuiMock;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * Runs all @Test annotated methods in all classes and then exit
+ * <p>
+ * Normally this is called from within a swing application in the start method <code><pre>
+ * public Object start(IApplicationContext context) throws Exception {
+ * new JUnitSwingJob(Activator.getDefault().getEnvironment()).schedule(2000);
+ * //
+ * ...
+ * }
+ * </pre></code>
+ */
+public class JUnitSWTJob extends Job {
+ private final ISwtEnvironment m_environment;
+
+ public JUnitSWTJob(ISwtEnvironment environment) {
+ super("JUnit SWT Runner");
+ setSystem(true);
+ m_environment = environment;
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ //wait until the application is showing
+ try {
+ TestingUtility.waitUntil(IGuiMock.WAIT_TIMEOUT, new WaitCondition<Object>() {
+ @Override
+ public Object run() {
+ try {
+ if (PlatformUI.isWorkbenchRunning()) {
+ PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ m_environment.ensureInitialized();
+ }
+ });
+ IClientSession session = m_environment.getClientSession();
+ if (session != null) {
+ IDesktop desktop = session.getDesktop();
+ if (desktop != null) {
+ if (desktop.isGuiAvailable() && desktop.isOpened()) {
+ return true;//not null
+ }
+ }
+ }
+ }
+ }
+ catch (Throwable t) {
+ t.printStackTrace();
+ System.exit(0);
+ }
+ return null;
+ }
+ });
+ }
+ catch (Throwable t) {
+ System.err.println("Timeout waiting for SWTApplication to start: " + t);
+ System.exit(0);
+ }
+ //
+ ScoutJUnitPluginTestExecutor scoutJUnitPluginTestExecutor = new ScoutJUnitPluginTestExecutor();
+ final int code = scoutJUnitPluginTestExecutor.runAllTests();
+ System.exit(code);
+ return Status.OK_STATUS;
+ }
+}
diff --git a/org.eclipse.scout.rt.testing.ui.swt/src/org/eclipse/scout/rt/testing/ui/swt/SwtMock.java b/org.eclipse.scout.rt.testing.ui.swt/src/org/eclipse/scout/rt/testing/ui/swt/SwtMock.java
index 972557321a..3b36f66d13 100644
--- a/org.eclipse.scout.rt.testing.ui.swt/src/org/eclipse/scout/rt/testing/ui/swt/SwtMock.java
+++ b/org.eclipse.scout.rt.testing.ui.swt/src/org/eclipse/scout/rt/testing/ui/swt/SwtMock.java
@@ -1,1132 +1,1132 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.testing.ui.swt;
-
-import java.awt.Robot;
-import java.awt.Toolkit;
-import java.awt.datatransfer.StringSelection;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-import java.util.TreeSet;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.atomic.AtomicReference;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.jobs.IJobChangeEvent;
-import org.eclipse.core.runtime.jobs.JobChangeAdapter;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.beans.IPropertyObserver;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.testing.shared.OsUtility;
-import org.eclipse.scout.rt.testing.shared.TestingUtility;
-import org.eclipse.scout.rt.testing.shared.WaitCondition;
-import org.eclipse.scout.rt.ui.swt.basic.ISwtScoutComposite;
-import org.eclipse.scout.rt.ui.swt.basic.SwtScoutComposite;
-import org.eclipse.scout.rt.ui.swt.ext.DropDownButton;
-import org.eclipse.scout.rt.ui.swt.util.SwtUtility;
-import org.eclipse.scout.testing.client.IGuiMock;
-import org.eclipse.scout.testing.client.robot.JavaRobot;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CTabFolder;
-import org.eclipse.swt.custom.CTabItem;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.dnd.Clipboard;
-import org.eclipse.swt.dnd.TextTransfer;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.swt.widgets.Scrollable;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Uses awt {@link Robot} and not SWTBot since SWTBot is not really a gui emulator.
- */
-public class SwtMock implements IGuiMock {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(SwtMock.class);
-
- static interface MockRunnable<T> extends WaitCondition<T> {
- }
-
- private final IClientSession m_session;
- private final JavaRobot m_bot;
- private int m_treeNodeToExpandIconGap;
-
- public SwtMock(IClientSession session) {
- m_session = session;
- m_bot = new JavaRobot();
- }
-
- @Override
- public void initializeMock() {
- }
-
- @Override
- public void shutdownMock() {
- }
-
- @Override
- public void beforeTest() {
- }
-
- @Override
- public void afterTest() {
- }
-
- @Override
- public GuiStrategy getStrategy() {
- return GuiStrategy.Swt;
- }
-
- public int getTreeNodeToExpandIconGap() {
- if (m_treeNodeToExpandIconGap <= 0) {
- String s = Activator.getDefault().getBundle().getBundleContext().getProperty("IGuiMock.treeNodeToExpandIconGap");
- if (s == null) {
- LOG.warn("Missing config.ini property 'IGuiMock.treeNodeToExpandIconGap'; using default value of 4");
- s = "4";
- }
- m_treeNodeToExpandIconGap = Integer.parseInt(s);
- }
- return m_treeNodeToExpandIconGap;
- }
-
- public void setTreeNodeToExpandIconGap(int treeNodeToExpandIconGap) {
- m_treeNodeToExpandIconGap = treeNodeToExpandIconGap;
- }
-
- @Override
- public void waitForIdle() {
- if (getDisplay().getThread() == Thread.currentThread()) {
- return;
- }
- //
- for (int pass = 0; pass < 2; pass++) {
- m_bot.sleep(80);
- //wait until gui queue is empty
- syncExec(new MockRunnable<Object>() {
- @Override
- public Object run() throws Throwable {
- return null;
- }
- });
- //wait until model queue is empty
- ClientSyncJob idleJob = new ClientSyncJob("Check for idle", m_session) {
- @Override
- protected void runVoid(IProgressMonitor m) throws Throwable {
- }
- };
- idleJob.setSystem(true);
-
- final CountDownLatch idleJobScheduledSignal = new CountDownLatch(1);
- JobChangeAdapter listener = new JobChangeAdapter() {
- @Override
- public void done(IJobChangeEvent event) {
- idleJobScheduledSignal.countDown();
- }
- };
-
- try {
- idleJob.addJobChangeListener(listener);
- idleJob.schedule();
- try {
- idleJobScheduledSignal.await();
- }
- catch (InterruptedException e) {
- throw new IllegalStateException("Interrupted");
- }
- }
- finally {
- idleJob.removeJobChangeListener(listener);
- }
- }
- }
-
- @Override
- public void waitForActiveWindow(final String title) {
- waitUntil(new WaitCondition<Object>() {
- @Override
- public Object run() {
- if (isWindowActive(title)) {
- return true;
- }
- else {
- return null;
- }
- }
- });
- waitForIdle();
- }
-
- @Override
- public void waitForOpenWindow(final String title) {
- waitUntil(new WaitCondition<Object>() {
- @Override
- public Object run() {
- if (isWindowOpen(title)) {
- return true;
- }
- else {
- return null;
- }
- }
- });
- waitForIdle();
- }
-
- @Override
- public int getSleepDelay() {
- return m_bot.getAutoDelay();
- }
-
- @Override
- public void setSleepDelay(int sleepDelay) {
- m_bot.setAutoDelay(sleepDelay);
- }
-
- @Override
- public void sleep() {
- sleep(getSleepDelay());
- }
-
- @Override
- public void sleep(int millis) {
- //only sleep when NOT in gui thread
- if (getDisplay().getThread() == Thread.currentThread()) {
- return;
- }
- //
- m_bot.sleep(millis);
- waitForIdle();
- }
-
- @Override
- public boolean isWindowActive(final String title) {
- return syncExec(new MockRunnable<Boolean>() {
- @Override
- public Boolean run() throws Throwable {
- CTabItem view = findWorkbenchView(title);
- if (view != null && view.getParent().getSelection() == view) {
- return true;
- }
- Shell shell = findShell(title);
- if (shell != null && shell == getActiveShell()) {
- return true;
- }
- return false;
- }
- });
- }
-
- @Override
- public boolean isWindowOpen(final String title) {
- return syncExec(new MockRunnable<Boolean>() {
- @Override
- public Boolean run() throws Throwable {
- CTabItem view = findWorkbenchView(title);
- if (view != null) {
- return true;
- }
- Shell shell = findShell(title);
- if (shell != null) {
- return true;
- }
- return false;
- }
- });
- }
-
- @Override
- public void activateWindow(final String title) {
- waitForOpenWindow(title);
- syncExec(new MockRunnable<Object>() {
- @Override
- public Object run() throws Throwable {
- CTabItem view = findWorkbenchView(title);
- if (view != null) {
- view.getParent().setSelection(view);
- return null;
- }
- Shell shell = findShell(title);
- if (shell != null) {
- shell.setActive();
- return null;
- }
- throw new IllegalStateException("There is no view with title " + title);
- }
- });
- waitForIdle();
- }
-
- @Override
- public FieldState getFieldState(FieldType type, int index) {
- final Control c = waitForIndexedField(type, index);
- return syncExec(new MockRunnable<FieldState>() {
- @Override
- public FieldState run() throws Throwable {
- return getFieldStateInternal(c);
- }
- });
- }
-
- @Override
- public FieldState getScoutFieldState(String name) {
- final Control c = waitForScoutField(name);
- return syncExec(new MockRunnable<FieldState>() {
- @Override
- public FieldState run() throws Throwable {
- return getFieldStateInternal(c);
- }
- });
- }
-
- @Override
- public FieldState getScoutFieldContainerState(String name) {
- final Control c = waitForScoutField(name);
- return syncExec(new MockRunnable<FieldState>() {
- @Override
- public FieldState run() throws Throwable {
- ISwtScoutComposite swtScoutComposite = SwtScoutComposite.getCompositeOnWidget(c);
- if (swtScoutComposite == null) {
- return null;
- }
-
- return getFieldStateInternal(swtScoutComposite.getSwtContainer());
- }
- });
- }
-
- @Override
- public List<FieldState> getFieldStates(final FieldType type) {
- return syncExec(new MockRunnable<List<FieldState>>() {
- @Override
- public List<FieldState> run() throws Throwable {
- List<FieldState> list = new ArrayList<FieldState>();
- for (Control c : SwtUtility.findChildComponents(getActiveShell(), Control.class)) {
- if (type == null && getFieldTypeOf(c) != null) {
- list.add(getFieldStateInternal(c));
- }
- else if (type != null && getFieldTypeOf(c) == type) {
- list.add(getFieldStateInternal(c));
- }
- }
- return list;
- }
- });
- }
-
- @Override
- public FieldState getFocusFieldState() {
- return syncExec(new MockRunnable<FieldState>() {
- @Override
- public FieldState run() throws Throwable {
- Control c = getDisplay().getFocusControl();
- if (c == null) {
- throw new IllegalStateException("There is no focus owner");
- }
- return getFieldStateInternal(c);
- }
- });
- }
-
- @Override
- public void clickOnPushButton(String text) {
- final Control c = waitForPushButtonWithLabel(text);
- syncExec(new MockRunnable<Object>() {
- @Override
- public Object run() throws Throwable {
- Point p = c.toDisplay(5, 5);
- gotoPoint(p.x, p.y);
- clickLeft();
- return null;
- }
- });
- waitForIdle();
- }
-
- @Override
- public void gotoField(FieldType type, int index) {
- final Control c = waitForIndexedField(type, index);
- syncExec(new MockRunnable<Object>() {
- @Override
- public Object run() throws Throwable {
- Point p = c.toDisplay(c.getSize().x / 2, c.getSize().y / 2);
- gotoPoint(p.x, p.y);
- return null;
- }
- });
- }
-
- @Override
- public void gotoScoutField(String name) {
- final Control c = waitForScoutField(name);
- syncExec(new MockRunnable<Object>() {
- @Override
- public Object run() throws Throwable {
- Point p = c.toDisplay(c.getSize().x / 2, c.getSize().y / 2);
- gotoPoint(p.x, p.y);
- return null;
- }
- });
- }
-
- @Override
- public void gotoTable(int tableIndex, final int rowIndex, final int columnIndex) {
- final Table table = (Table) waitForIndexedField(FieldType.Table, tableIndex);
- syncExec(new MockRunnable<Object>() {
- @Override
- public Object run() throws Throwable {
- TableItem item = table.getItem(rowIndex);
- //first column is dummy column
- Rectangle cellBounds = item.getBounds(columnIndex + 1);
- if (!table.getClientArea().contains(cellBounds.x + cellBounds.width / 2, cellBounds.y + cellBounds.height / 2)) {
- throw new IllegalStateException("table cell " + rowIndex + "," + columnIndex + " is not visible on screen");
- }
- Point p = table.toDisplay(cellBounds.x + (cellBounds.width / 2), cellBounds.y + (cellBounds.height / 2));
- gotoPoint(p.x, p.y);
- return null;
- }
- });
- }
-
- @Override
- public void gotoTableHeader(int tableIndex, final int columnIndex) {
- final Table table = (Table) waitForIndexedField(FieldType.Table, tableIndex);
- syncExec(new MockRunnable<Object>() {
- @SuppressWarnings("null")
- @Override
- public Object run() throws Throwable {
- int curIndex = -1;
- int accumulatedWidth = 0;
- Rectangle cellBounds = null;
- for (int i : table.getColumnOrder()) {
- TableColumn col = table.getColumn(i);
- //first column is dummy column
- if (i > 0) {
- curIndex++;
- if (curIndex == columnIndex) {
- cellBounds = new Rectangle(accumulatedWidth, 0, col.getWidth(), table.getHeaderHeight());
- break;
- }
- }
- accumulatedWidth += col.getWidth();
- }
- cellBounds.x -= table.getHorizontalBar().getSelection();
- Point p = table.toDisplay(cellBounds.x + (cellBounds.width / 2), cellBounds.y + (cellBounds.height / 2));
- gotoPoint(p.x, p.y);
- return null;
- }
- });
- }
-
- @Override
- public void gotoTree(int treeIndex, final String nodeText) {
- final Tree tree = (Tree) waitForIndexedField(FieldType.Tree, treeIndex);
- syncExec(new MockRunnable<Object>() {
- @Override
- public Object run() throws Throwable {
- TreeItem item = findTreeItemRec(tree.getItems(), nodeText);
- if (item == null) {
- throw new IllegalStateException("Cannot find tree item '" + nodeText + "'");
- }
- Rectangle cellBounds = item.getBounds(0);
- if (!tree.getClientArea().contains(cellBounds.x + cellBounds.width / 2, cellBounds.y + cellBounds.height / 2)) {
- throw new IllegalStateException("tree node " + nodeText + " is not visible on screen");
- }
- Point p = tree.toDisplay(cellBounds.x + (cellBounds.width / 2), cellBounds.y + (cellBounds.height / 2));
- gotoPoint(p.x, p.y);
- return null;
- }
- });
- }
-
- @Override
- public void gotoTreeExpandIcon(int treeIndex, final String nodeText) {
- final Tree tree = (Tree) waitForIndexedField(FieldType.Tree, treeIndex);
- syncExec(new MockRunnable<Object>() {
- @Override
- public Object run() throws Throwable {
- TreeItem item = findTreeItemRec(tree.getItems(), nodeText);
- if (item == null) {
- throw new IllegalStateException("Cannot find tree item '" + nodeText + "'");
- }
- Rectangle cellBounds = item.getBounds(0);
- if (!tree.getClientArea().contains(cellBounds.x + cellBounds.width / 2, cellBounds.y + cellBounds.height / 2)) {
- throw new IllegalStateException("tree node " + nodeText + " is not visible on screen");
- }
- Point p = tree.toDisplay(cellBounds.x - getTreeNodeToExpandIconGap() - 2, cellBounds.y + (cellBounds.height / 2));
- gotoPoint(p.x, p.y);
- return null;
- }
- });
- }
-
- @Override
- public void contextMenu(final String... names) {
- final ArrayList<Integer> indexOfList = new ArrayList<Integer>();
- final MenuItem mi = waitForMenuItem(names[0]);
- syncExec(new MockRunnable<Boolean>() {
- @Override
- public Boolean run() throws Throwable {
- indexOfList.add(accessibleMenuIndex(mi));
- MenuItem parentMenuItem = mi;
- for (int i = 1; i < names.length; i++) {
- String label = cleanButtonLabel(names[i]);
- MenuItem subItem = null;
- for (MenuItem item : parentMenuItem.getMenu().getItems()) {
- if (label.equals(cleanButtonLabel(item.getText()))) {
- subItem = item;
- break;
- }
- }
- if (subItem == null) {
- throw new IllegalStateException("cannot find submenu " + names[i]);
- }
- indexOfList.add(accessibleMenuIndex(subItem));
- parentMenuItem = subItem;
- }
- return null;
- }
- });
- //do keyboard actions to navigate to menu, finish up with enter key
- for (int i = 0; i < indexOfList.size(); i++) {
- if (i > 0) {
- typeKey(Key.Right);
- }
- int repeat = indexOfList.get(i);
- //top level is not pre-selected on first item
- if (i == 0) {
- repeat++;
- }
- while (repeat > 0) {
- repeat--;
- typeKey(Key.Down);
- }
- }
- typeKey(Key.Enter);
- waitForIdle();
- }
-
- /**
- * @return the menu index in the parent menu of all enabled and visible menu items
- */
- protected int accessibleMenuIndex(MenuItem mi) {
- Menu m = mi.getParent();
- int index = 0;
- for (MenuItem x : m.getItems()) {
- if (x == mi) {
- break;
- }
- if ((x.getStyle() & SWT.SEPARATOR) != 0) {
- continue;
- }
- if (x.isEnabled()) {
- index++;
- }
- }
- return index;
- }
-
- @Override
- public List<String> getTableCells(int tableIndex, final int columnIndex) {
- final Table table = (Table) waitForIndexedField(FieldType.Table, tableIndex);
- return syncExec(new MockRunnable<List<String>>() {
- @Override
- public List<String> run() throws Throwable {
- ArrayList<String> list = new ArrayList<String>();
- for (TableItem row : table.getItems()) {
- //first column is dummy column
- list.add(row.getText(columnIndex + 1));
- }
- return list;
- }
- });
- }
-
- @Override
- public List<String> getTreeNodes(final int treeIndex) {
- final Tree tree = (Tree) waitForIndexedField(FieldType.Tree, treeIndex);
- return syncExec(new MockRunnable<List<String>>() {
- @Override
- public List<String> run() throws Throwable {
- ArrayList<String> list = new ArrayList<String>();
- addTreeItemsRec(tree.getItems(), list);
- return list;
- }
- });
- }
-
- @Override
- public Set<String> getSelectedTableCells(int tableIndex, final int columnIndex) {
- final Table table = (Table) waitForIndexedField(FieldType.Table, tableIndex);
- return syncExec(new MockRunnable<Set<String>>() {
- @Override
- public Set<String> run() throws Throwable {
- TreeSet<String> set = new TreeSet<String>();
- TableItem[] sel = table.getSelection();
- if (sel != null) {
- for (TableItem row : sel) {
- //first column is dummy column
- set.add(row.getText(columnIndex + 1));
- }
- }
- return set;
- }
- });
- }
-
- @Override
- public Set<String> getSelectedTreeNodes(int treeIndex) {
- final Tree tree = (Tree) waitForIndexedField(FieldType.Tree, treeIndex);
- return syncExec(new MockRunnable<Set<String>>() {
- @Override
- public Set<String> run() throws Throwable {
- TreeSet<String> set = new TreeSet<String>();
- TreeItem[] sel = tree.getSelection();
- if (sel != null) {
- for (TreeItem row : sel) {
- set.add(row.getText(0));
- }
- }
- return set;
- }
- });
- }
-
- @Override
- public Set<String> getCheckedTableCells(int tableIndex, final int columnIndex) {
- final Table table = (Table) waitForIndexedField(FieldType.Table, tableIndex);
- return syncExec(new MockRunnable<Set<String>>() {
- @Override
- public Set<String> run() throws Throwable {
- TreeSet<String> check = new TreeSet<String>();
- for (int i = 0; i < table.getItemCount(); i++) {
- TableItem item = table.getItem(i);
- if (item.getData() instanceof ITableRow) {
- ITableRow row = (ITableRow) item.getData();
- if (row.isChecked()) {
- check.add(item.getText(columnIndex + 1));
- }
- }
- }
- return check;
- }
- });
- }
-
- @Override
- public void gotoPoint(int x, int y) {
- m_bot.moveTo(x, y);
- }
-
- @Override
- public void move(int deltaX, int deltaY) {
- m_bot.moveDelta(deltaX, deltaY);
- }
-
- @Override
- public void clickLeft() {
- m_bot.clickLeft();
- waitForIdle();
- }
-
- @Override
- public void clickRight() {
- m_bot.clickRight();
- waitForIdle();
- }
-
- @Override
- public void pressLeft() {
- m_bot.pressLeft();
- }
-
- @Override
- public void releaseLeft() {
- m_bot.releaseLeft();
- waitForIdle();
- }
-
- @Override
- public void drag(int x1, int y1, int x2, int y2) {
- gotoPoint(x1, y1);
- m_bot.pressLeft();
- gotoPoint(x2, y2);
- m_bot.releaseLeft();
- waitForIdle();
- }
-
- @Override
- public void dragWindowRightBorder(WindowState windowState, int pixelToMoveOnX) {
- int borderSize = (OsUtility.isWindows7() ? 5 : 4);
-
- int xPos = windowState.x + windowState.width + borderSize;
- int yPos = windowState.y + windowState.height / 2;
- drag(xPos, yPos, xPos + pixelToMoveOnX, yPos);
- }
-
- @Override
- public void typeText(final String text) {
- m_bot.typeText(text);
- waitForIdle();
- }
-
- @Override
- public void paste(String text) {
- Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(text), null);
- //press paste (ctrl-V)
- m_bot.pressKey(Key.Control);
- m_bot.typeText("v");
- m_bot.releaseKey(Key.Control);
- }
-
- @Override
- public void pressKey(Key key) {
- m_bot.pressKey(key);
- waitForIdle();
- }
-
- @Override
- public void releaseKey(Key key) {
- m_bot.releaseKey(key);
- waitForIdle();
- }
-
- @Override
- public void typeKey(Key key) {
- m_bot.typeKey(key);
- waitForIdle();
- }
-
- @Override
- public WindowState getWindowState(final String title) {
- return syncExec(new MockRunnable<WindowState>() {
- @Override
- public WindowState run() throws Throwable {
- checkActiveShell();
- CTabItem view = findWorkbenchView(title);
- if (view != null) {
- WindowState state = new WindowState();
- Point p = view.getParent().toDisplay(0, 0);
- Point s = view.getParent().getSize();
- state.x = p.x;
- state.y = p.y;
- state.width = s.x;
- state.height = s.y;
- return state;
- }
- Shell shell = findShell(title);
- if (shell != null) {
- Rectangle r = shell.getBounds();
- WindowState state = new WindowState();
- state.x = r.x;
- state.y = r.y;
- state.width = r.width;
- state.height = r.height;
- return state;
- }
- throw new IllegalStateException("Window " + title + " not found");
- }
- });
- }
-
- @Override
- public String getClipboardText() {
- waitForIdle();
- return syncExec(new MockRunnable<String>() {
- @Override
- public String run() throws Throwable {
- Clipboard b = new Clipboard(getDisplay());
- return (String) b.getContents(TextTransfer.getInstance());
- }
- });
- }
-
- @Override
- public Object internal0(final Object o) {
- return syncExec(new MockRunnable<String>() {
- @Override
- public String run() throws Throwable {
- return null;
- }
- });
- }
-
- protected void checkActiveShell() {
- if (getActiveShell() == null) {
- throw new IllegalStateException("There is no active shell");
- }
- }
-
- protected FieldState getFieldStateInternal(Control c) {
- FieldState state = new FieldState();
- //type
- state.type = getFieldTypeOf(c);
- //scout name
- IPropertyObserver scoutObject = SwtScoutComposite.getScoutModelOnWidget(c);
- state.scoutName = (scoutObject != null ? scoutObject.getClass().getName() : null);
- //focus
- state.focus = (c == getDisplay().getFocusControl());
- //bounds
- Point p = c.toDisplay(0, 0);
- state.x = p.x;
- state.y = p.y;
- state.width = c.getBounds().width;
- state.height = c.getBounds().height;
- //text
- if (c instanceof Label) {
- state.text = ((Label) c).getText();
- }
- if (c instanceof Text) {
- state.text = ((Text) c).getText();
- }
- if (c instanceof StyledText) {
- state.text = ((StyledText) c).getText();
- }
- if (c instanceof Button) {
- state.text = ((Button) c).getText();
- }
- return state;
- }
-
- protected FieldType getFieldTypeOf(Control c) {
- if (c.isDisposed()) {
- return null;
- }
- if (!c.isVisible()) {
- return null;
- }
- //
- if (c instanceof Label) {
- return FieldType.Label;
- }
- if (c instanceof Text) {
- return FieldType.Text;
- }
- if (c instanceof StyledText) {
- return FieldType.Text;
- }
- if (c instanceof Table) {
- return FieldType.Table;
- }
- if (c instanceof Tree) {
- return FieldType.Tree;
- }
- if (c instanceof DropDownButton) {
- return FieldType.DropdownButton;
- }
- if (c instanceof Button) {
- int style = c.getStyle();
- if ((style & SWT.CHECK) != 0) {
- return FieldType.Checkbox;
- }
- else if ((style & SWT.RADIO) != 0) {
- return FieldType.RadioButton;
- }
- else if (c.getParent() instanceof Scrollable) {
- return FieldType.ScrollButton;
- }
- else {
- return FieldType.PushButton;
- }
- }
- return null;
- }
-
- protected String getScoutNameOf(Control c) {
- IPropertyObserver scoutObject = SwtScoutComposite.getScoutModelOnWidget(c);
- if (scoutObject != null) {
- return scoutObject.getClass().getName();
- }
- return null;
- }
-
- protected Display getDisplay() {
- if (PlatformUI.isWorkbenchRunning()) {
- return PlatformUI.getWorkbench().getDisplay();
- }
- else {
- //there is no workbench available
- return null;
- }
- }
-
- protected Shell getActiveShell() {
- return getDisplay().getActiveShell();
- }
-
- protected String cleanButtonLabel(String s) {
- return StringUtility.removeMnemonic(s);
- }
-
- protected TreeItem findTreeItemRec(TreeItem[] items, String nodeText) {
- if (items == null) {
- return null;
- }
- //
- for (TreeItem item : items) {
- if (nodeText.equals(item.getText())) {
- return item;
- }
- TreeItem found = findTreeItemRec(item.getItems(), nodeText);
- if (found != null) {
- return found;
- }
- }
- return null;
- }
-
- protected void addTreeItemsRec(TreeItem[] items, List<String> list) {
- if (items == null) {
- return;
- }
- //
- for (TreeItem item : items) {
- list.add(item.getText(0));
- if (item.getExpanded()) {
- addTreeItemsRec(item.getItems(), list);
- }
- }
- }
-
- protected List<Composite> enumerateParentContainers() {
- return syncExec(new MockRunnable<ArrayList<Composite>>() {
- @Override
- public ArrayList<Composite> run() throws Throwable {
- ArrayList<Composite> list = new ArrayList<Composite>();
- for (Shell shell : getDisplay().getShells()) {
- if (shell.isVisible()) {
- list.add(shell);
- }
- }
- return list;
- }
- });
- }
-
- protected Shell findShell(final String title) {
- for (Shell shell : getDisplay().getShells()) {
- if (title.equals(shell.getText())) {
- return shell;
- }
- }
- return null;
- }
-
- protected CTabItem findWorkbenchView(final String title) {
- Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
- if (shell != null) {
- for (CTabFolder f : SwtUtility.findChildComponents(shell, CTabFolder.class)) {
- if (f.getItemCount() > 0) {
- for (CTabItem item : f.getItems()) {
- if (item.isShowing()) {
- if (title.equals(cleanButtonLabel(item.getText()))) {
- return item;
- }
- }
- }
- }
- }
- }
- return null;
- }
-
- protected Control waitForPushButtonWithLabel(final String label) {
- return waitUntil(new WaitCondition<Control>() {
- @Override
- public Control run() {
- return syncExec(new MockRunnable<Control>() {
- @Override
- public Control run() throws Throwable {
- for (Shell shell : getDisplay().getShells()) {
- Composite parent = shell;
- for (Control o : SwtUtility.findChildComponents(parent, Control.class)) {
- if (o instanceof Button) {
- if (cleanButtonLabel(label).equals(cleanButtonLabel(((Button) o).getText()))) {
- return o;
- }
- }
- }
- }
- return null;
- }
- });
- }
- });
- }
-
- protected Control waitForScoutField(final String name) {
- return waitUntil(new WaitCondition<Control>() {
- @Override
- public Control run() {
- return syncExec(new MockRunnable<Control>() {
- @Override
- public Control run() throws Throwable {
- Control lastSecondaryCandidate = null;
- for (Composite parent : enumerateParentContainers()) {
- for (Control c : SwtUtility.findChildComponents(parent, Control.class)) {
- String s = getScoutNameOf(c);
- if (s != null && ("." + s).endsWith("." + name)) {
- lastSecondaryCandidate = c;
- if (getFieldTypeOf(c) != null) {
- //primary match
- return c;
- }
- }
- }
- }
- return lastSecondaryCandidate;
- }
- });
- }
- });
- }
-
- protected Control waitForIndexedField(final FieldType type, final int fieldIndex) {
- return waitUntil(new WaitCondition<Control>() {
- @Override
- public Control run() {
- return syncExec(new MockRunnable<Control>() {
- @Override
- public Control run() throws Throwable {
- List<Composite> parents = enumerateParentContainers();
- for (Composite parent : parents) {
- int index = 0;
- for (Control c : SwtUtility.findChildComponents(parent, Control.class)) {
- if (getFieldTypeOf(c) == type) {
- if (index == fieldIndex) {
- return c;
- }
- index++;
- }
- }
- }
- return null;
- }
- });
- }
- });
- }
-
- protected MenuItem waitForMenuItem(final String name) {
- return waitUntil(new WaitCondition<MenuItem>() {
- @Override
- public MenuItem run() {
- return syncExec(new MockRunnable<MenuItem>() {
- @Override
- public MenuItem run() throws Throwable {
- String label = cleanButtonLabel(name);
- //focus control
- Control focusControl = getDisplay().getFocusControl();
- if (focusControl != null) {
- Menu m = focusControl.getMenu();
- if (m != null) {
- for (MenuItem item : m.getItems()) {
- if (label.equals(cleanButtonLabel(item.getText()))) {
- return item;
- }
- }
- }
- }
- //other controls
- for (Composite parent : enumerateParentContainers()) {
- for (Control c : SwtUtility.findChildComponents(parent, Control.class)) {
- Menu m = c.getMenu();
- if (m != null) {
- for (MenuItem item : m.getItems()) {
- if (label.equals(cleanButtonLabel(item.getText()))) {
- return item;
- }
- }
- }
- }
- }
- //main menu
- for (Shell shell : getDisplay().getShells()) {
- Menu m = shell.getMenuBar();
- if (m != null) {
- for (MenuItem item : m.getItems()) {
- if (label.equals(cleanButtonLabel(item.getText()))) {
- return item;
- }
- }
- }
- }
- return null;
- }
- });
- }
- });
-
- }
-
- protected <T> T syncExec(final MockRunnable<T> r) {
- if (getDisplay().getThread() != Thread.currentThread()) {
- final AtomicReference<T> ret = new AtomicReference<T>();
- final AtomicReference<Throwable> ex = new AtomicReference<Throwable>();
- try {
- getDisplay().syncExec(new Runnable() {
- @Override
- public void run() {
- try {
- ret.set(syncExec(r));
- }
- catch (Throwable t) {
- ex.set(t);
- }
- }
- });
- if (ex.get() != null) {
- throw ex.get();
- }
- return ret.get();
- }
- catch (Throwable t) {
- throw new RuntimeException(t);
- }
- }
- //
- try {
- return r.run();
- }
- catch (Throwable t) {
- throw new RuntimeException(t);
- }
- }
-
- protected <T> T waitUntil(final WaitCondition<T> w) {
- try {
- return TestingUtility.waitUntil(WAIT_TIMEOUT, w);
- }
- catch (Throwable t) {
- throw new RuntimeException(t);
- }
- finally {
- waitForIdle();
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.testing.ui.swt;
+
+import java.awt.Robot;
+import java.awt.Toolkit;
+import java.awt.datatransfer.StringSelection;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.core.runtime.jobs.JobChangeAdapter;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.beans.IPropertyObserver;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.testing.shared.OsUtility;
+import org.eclipse.scout.rt.testing.shared.TestingUtility;
+import org.eclipse.scout.rt.testing.shared.WaitCondition;
+import org.eclipse.scout.rt.ui.swt.basic.ISwtScoutComposite;
+import org.eclipse.scout.rt.ui.swt.basic.SwtScoutComposite;
+import org.eclipse.scout.rt.ui.swt.ext.DropDownButton;
+import org.eclipse.scout.rt.ui.swt.util.SwtUtility;
+import org.eclipse.scout.testing.client.IGuiMock;
+import org.eclipse.scout.testing.client.robot.JavaRobot;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CTabFolder;
+import org.eclipse.swt.custom.CTabItem;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.dnd.Clipboard;
+import org.eclipse.swt.dnd.TextTransfer;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swt.widgets.Scrollable;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * Uses awt {@link Robot} and not SWTBot since SWTBot is not really a gui emulator.
+ */
+public class SwtMock implements IGuiMock {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(SwtMock.class);
+
+ static interface MockRunnable<T> extends WaitCondition<T> {
+ }
+
+ private final IClientSession m_session;
+ private final JavaRobot m_bot;
+ private int m_treeNodeToExpandIconGap;
+
+ public SwtMock(IClientSession session) {
+ m_session = session;
+ m_bot = new JavaRobot();
+ }
+
+ @Override
+ public void initializeMock() {
+ }
+
+ @Override
+ public void shutdownMock() {
+ }
+
+ @Override
+ public void beforeTest() {
+ }
+
+ @Override
+ public void afterTest() {
+ }
+
+ @Override
+ public GuiStrategy getStrategy() {
+ return GuiStrategy.Swt;
+ }
+
+ public int getTreeNodeToExpandIconGap() {
+ if (m_treeNodeToExpandIconGap <= 0) {
+ String s = Activator.getDefault().getBundle().getBundleContext().getProperty("IGuiMock.treeNodeToExpandIconGap");
+ if (s == null) {
+ LOG.warn("Missing config.ini property 'IGuiMock.treeNodeToExpandIconGap'; using default value of 4");
+ s = "4";
+ }
+ m_treeNodeToExpandIconGap = Integer.parseInt(s);
+ }
+ return m_treeNodeToExpandIconGap;
+ }
+
+ public void setTreeNodeToExpandIconGap(int treeNodeToExpandIconGap) {
+ m_treeNodeToExpandIconGap = treeNodeToExpandIconGap;
+ }
+
+ @Override
+ public void waitForIdle() {
+ if (getDisplay().getThread() == Thread.currentThread()) {
+ return;
+ }
+ //
+ for (int pass = 0; pass < 2; pass++) {
+ m_bot.sleep(80);
+ //wait until gui queue is empty
+ syncExec(new MockRunnable<Object>() {
+ @Override
+ public Object run() throws Throwable {
+ return null;
+ }
+ });
+ //wait until model queue is empty
+ ClientSyncJob idleJob = new ClientSyncJob("Check for idle", m_session) {
+ @Override
+ protected void runVoid(IProgressMonitor m) throws Throwable {
+ }
+ };
+ idleJob.setSystem(true);
+
+ final CountDownLatch idleJobScheduledSignal = new CountDownLatch(1);
+ JobChangeAdapter listener = new JobChangeAdapter() {
+ @Override
+ public void done(IJobChangeEvent event) {
+ idleJobScheduledSignal.countDown();
+ }
+ };
+
+ try {
+ idleJob.addJobChangeListener(listener);
+ idleJob.schedule();
+ try {
+ idleJobScheduledSignal.await();
+ }
+ catch (InterruptedException e) {
+ throw new IllegalStateException("Interrupted");
+ }
+ }
+ finally {
+ idleJob.removeJobChangeListener(listener);
+ }
+ }
+ }
+
+ @Override
+ public void waitForActiveWindow(final String title) {
+ waitUntil(new WaitCondition<Object>() {
+ @Override
+ public Object run() {
+ if (isWindowActive(title)) {
+ return true;
+ }
+ else {
+ return null;
+ }
+ }
+ });
+ waitForIdle();
+ }
+
+ @Override
+ public void waitForOpenWindow(final String title) {
+ waitUntil(new WaitCondition<Object>() {
+ @Override
+ public Object run() {
+ if (isWindowOpen(title)) {
+ return true;
+ }
+ else {
+ return null;
+ }
+ }
+ });
+ waitForIdle();
+ }
+
+ @Override
+ public int getSleepDelay() {
+ return m_bot.getAutoDelay();
+ }
+
+ @Override
+ public void setSleepDelay(int sleepDelay) {
+ m_bot.setAutoDelay(sleepDelay);
+ }
+
+ @Override
+ public void sleep() {
+ sleep(getSleepDelay());
+ }
+
+ @Override
+ public void sleep(int millis) {
+ //only sleep when NOT in gui thread
+ if (getDisplay().getThread() == Thread.currentThread()) {
+ return;
+ }
+ //
+ m_bot.sleep(millis);
+ waitForIdle();
+ }
+
+ @Override
+ public boolean isWindowActive(final String title) {
+ return syncExec(new MockRunnable<Boolean>() {
+ @Override
+ public Boolean run() throws Throwable {
+ CTabItem view = findWorkbenchView(title);
+ if (view != null && view.getParent().getSelection() == view) {
+ return true;
+ }
+ Shell shell = findShell(title);
+ if (shell != null && shell == getActiveShell()) {
+ return true;
+ }
+ return false;
+ }
+ });
+ }
+
+ @Override
+ public boolean isWindowOpen(final String title) {
+ return syncExec(new MockRunnable<Boolean>() {
+ @Override
+ public Boolean run() throws Throwable {
+ CTabItem view = findWorkbenchView(title);
+ if (view != null) {
+ return true;
+ }
+ Shell shell = findShell(title);
+ if (shell != null) {
+ return true;
+ }
+ return false;
+ }
+ });
+ }
+
+ @Override
+ public void activateWindow(final String title) {
+ waitForOpenWindow(title);
+ syncExec(new MockRunnable<Object>() {
+ @Override
+ public Object run() throws Throwable {
+ CTabItem view = findWorkbenchView(title);
+ if (view != null) {
+ view.getParent().setSelection(view);
+ return null;
+ }
+ Shell shell = findShell(title);
+ if (shell != null) {
+ shell.setActive();
+ return null;
+ }
+ throw new IllegalStateException("There is no view with title " + title);
+ }
+ });
+ waitForIdle();
+ }
+
+ @Override
+ public FieldState getFieldState(FieldType type, int index) {
+ final Control c = waitForIndexedField(type, index);
+ return syncExec(new MockRunnable<FieldState>() {
+ @Override
+ public FieldState run() throws Throwable {
+ return getFieldStateInternal(c);
+ }
+ });
+ }
+
+ @Override
+ public FieldState getScoutFieldState(String name) {
+ final Control c = waitForScoutField(name);
+ return syncExec(new MockRunnable<FieldState>() {
+ @Override
+ public FieldState run() throws Throwable {
+ return getFieldStateInternal(c);
+ }
+ });
+ }
+
+ @Override
+ public FieldState getScoutFieldContainerState(String name) {
+ final Control c = waitForScoutField(name);
+ return syncExec(new MockRunnable<FieldState>() {
+ @Override
+ public FieldState run() throws Throwable {
+ ISwtScoutComposite swtScoutComposite = SwtScoutComposite.getCompositeOnWidget(c);
+ if (swtScoutComposite == null) {
+ return null;
+ }
+
+ return getFieldStateInternal(swtScoutComposite.getSwtContainer());
+ }
+ });
+ }
+
+ @Override
+ public List<FieldState> getFieldStates(final FieldType type) {
+ return syncExec(new MockRunnable<List<FieldState>>() {
+ @Override
+ public List<FieldState> run() throws Throwable {
+ List<FieldState> list = new ArrayList<FieldState>();
+ for (Control c : SwtUtility.findChildComponents(getActiveShell(), Control.class)) {
+ if (type == null && getFieldTypeOf(c) != null) {
+ list.add(getFieldStateInternal(c));
+ }
+ else if (type != null && getFieldTypeOf(c) == type) {
+ list.add(getFieldStateInternal(c));
+ }
+ }
+ return list;
+ }
+ });
+ }
+
+ @Override
+ public FieldState getFocusFieldState() {
+ return syncExec(new MockRunnable<FieldState>() {
+ @Override
+ public FieldState run() throws Throwable {
+ Control c = getDisplay().getFocusControl();
+ if (c == null) {
+ throw new IllegalStateException("There is no focus owner");
+ }
+ return getFieldStateInternal(c);
+ }
+ });
+ }
+
+ @Override
+ public void clickOnPushButton(String text) {
+ final Control c = waitForPushButtonWithLabel(text);
+ syncExec(new MockRunnable<Object>() {
+ @Override
+ public Object run() throws Throwable {
+ Point p = c.toDisplay(5, 5);
+ gotoPoint(p.x, p.y);
+ clickLeft();
+ return null;
+ }
+ });
+ waitForIdle();
+ }
+
+ @Override
+ public void gotoField(FieldType type, int index) {
+ final Control c = waitForIndexedField(type, index);
+ syncExec(new MockRunnable<Object>() {
+ @Override
+ public Object run() throws Throwable {
+ Point p = c.toDisplay(c.getSize().x / 2, c.getSize().y / 2);
+ gotoPoint(p.x, p.y);
+ return null;
+ }
+ });
+ }
+
+ @Override
+ public void gotoScoutField(String name) {
+ final Control c = waitForScoutField(name);
+ syncExec(new MockRunnable<Object>() {
+ @Override
+ public Object run() throws Throwable {
+ Point p = c.toDisplay(c.getSize().x / 2, c.getSize().y / 2);
+ gotoPoint(p.x, p.y);
+ return null;
+ }
+ });
+ }
+
+ @Override
+ public void gotoTable(int tableIndex, final int rowIndex, final int columnIndex) {
+ final Table table = (Table) waitForIndexedField(FieldType.Table, tableIndex);
+ syncExec(new MockRunnable<Object>() {
+ @Override
+ public Object run() throws Throwable {
+ TableItem item = table.getItem(rowIndex);
+ //first column is dummy column
+ Rectangle cellBounds = item.getBounds(columnIndex + 1);
+ if (!table.getClientArea().contains(cellBounds.x + cellBounds.width / 2, cellBounds.y + cellBounds.height / 2)) {
+ throw new IllegalStateException("table cell " + rowIndex + "," + columnIndex + " is not visible on screen");
+ }
+ Point p = table.toDisplay(cellBounds.x + (cellBounds.width / 2), cellBounds.y + (cellBounds.height / 2));
+ gotoPoint(p.x, p.y);
+ return null;
+ }
+ });
+ }
+
+ @Override
+ public void gotoTableHeader(int tableIndex, final int columnIndex) {
+ final Table table = (Table) waitForIndexedField(FieldType.Table, tableIndex);
+ syncExec(new MockRunnable<Object>() {
+ @SuppressWarnings("null")
+ @Override
+ public Object run() throws Throwable {
+ int curIndex = -1;
+ int accumulatedWidth = 0;
+ Rectangle cellBounds = null;
+ for (int i : table.getColumnOrder()) {
+ TableColumn col = table.getColumn(i);
+ //first column is dummy column
+ if (i > 0) {
+ curIndex++;
+ if (curIndex == columnIndex) {
+ cellBounds = new Rectangle(accumulatedWidth, 0, col.getWidth(), table.getHeaderHeight());
+ break;
+ }
+ }
+ accumulatedWidth += col.getWidth();
+ }
+ cellBounds.x -= table.getHorizontalBar().getSelection();
+ Point p = table.toDisplay(cellBounds.x + (cellBounds.width / 2), cellBounds.y + (cellBounds.height / 2));
+ gotoPoint(p.x, p.y);
+ return null;
+ }
+ });
+ }
+
+ @Override
+ public void gotoTree(int treeIndex, final String nodeText) {
+ final Tree tree = (Tree) waitForIndexedField(FieldType.Tree, treeIndex);
+ syncExec(new MockRunnable<Object>() {
+ @Override
+ public Object run() throws Throwable {
+ TreeItem item = findTreeItemRec(tree.getItems(), nodeText);
+ if (item == null) {
+ throw new IllegalStateException("Cannot find tree item '" + nodeText + "'");
+ }
+ Rectangle cellBounds = item.getBounds(0);
+ if (!tree.getClientArea().contains(cellBounds.x + cellBounds.width / 2, cellBounds.y + cellBounds.height / 2)) {
+ throw new IllegalStateException("tree node " + nodeText + " is not visible on screen");
+ }
+ Point p = tree.toDisplay(cellBounds.x + (cellBounds.width / 2), cellBounds.y + (cellBounds.height / 2));
+ gotoPoint(p.x, p.y);
+ return null;
+ }
+ });
+ }
+
+ @Override
+ public void gotoTreeExpandIcon(int treeIndex, final String nodeText) {
+ final Tree tree = (Tree) waitForIndexedField(FieldType.Tree, treeIndex);
+ syncExec(new MockRunnable<Object>() {
+ @Override
+ public Object run() throws Throwable {
+ TreeItem item = findTreeItemRec(tree.getItems(), nodeText);
+ if (item == null) {
+ throw new IllegalStateException("Cannot find tree item '" + nodeText + "'");
+ }
+ Rectangle cellBounds = item.getBounds(0);
+ if (!tree.getClientArea().contains(cellBounds.x + cellBounds.width / 2, cellBounds.y + cellBounds.height / 2)) {
+ throw new IllegalStateException("tree node " + nodeText + " is not visible on screen");
+ }
+ Point p = tree.toDisplay(cellBounds.x - getTreeNodeToExpandIconGap() - 2, cellBounds.y + (cellBounds.height / 2));
+ gotoPoint(p.x, p.y);
+ return null;
+ }
+ });
+ }
+
+ @Override
+ public void contextMenu(final String... names) {
+ final ArrayList<Integer> indexOfList = new ArrayList<Integer>();
+ final MenuItem mi = waitForMenuItem(names[0]);
+ syncExec(new MockRunnable<Boolean>() {
+ @Override
+ public Boolean run() throws Throwable {
+ indexOfList.add(accessibleMenuIndex(mi));
+ MenuItem parentMenuItem = mi;
+ for (int i = 1; i < names.length; i++) {
+ String label = cleanButtonLabel(names[i]);
+ MenuItem subItem = null;
+ for (MenuItem item : parentMenuItem.getMenu().getItems()) {
+ if (label.equals(cleanButtonLabel(item.getText()))) {
+ subItem = item;
+ break;
+ }
+ }
+ if (subItem == null) {
+ throw new IllegalStateException("cannot find submenu " + names[i]);
+ }
+ indexOfList.add(accessibleMenuIndex(subItem));
+ parentMenuItem = subItem;
+ }
+ return null;
+ }
+ });
+ //do keyboard actions to navigate to menu, finish up with enter key
+ for (int i = 0; i < indexOfList.size(); i++) {
+ if (i > 0) {
+ typeKey(Key.Right);
+ }
+ int repeat = indexOfList.get(i);
+ //top level is not pre-selected on first item
+ if (i == 0) {
+ repeat++;
+ }
+ while (repeat > 0) {
+ repeat--;
+ typeKey(Key.Down);
+ }
+ }
+ typeKey(Key.Enter);
+ waitForIdle();
+ }
+
+ /**
+ * @return the menu index in the parent menu of all enabled and visible menu items
+ */
+ protected int accessibleMenuIndex(MenuItem mi) {
+ Menu m = mi.getParent();
+ int index = 0;
+ for (MenuItem x : m.getItems()) {
+ if (x == mi) {
+ break;
+ }
+ if ((x.getStyle() & SWT.SEPARATOR) != 0) {
+ continue;
+ }
+ if (x.isEnabled()) {
+ index++;
+ }
+ }
+ return index;
+ }
+
+ @Override
+ public List<String> getTableCells(int tableIndex, final int columnIndex) {
+ final Table table = (Table) waitForIndexedField(FieldType.Table, tableIndex);
+ return syncExec(new MockRunnable<List<String>>() {
+ @Override
+ public List<String> run() throws Throwable {
+ ArrayList<String> list = new ArrayList<String>();
+ for (TableItem row : table.getItems()) {
+ //first column is dummy column
+ list.add(row.getText(columnIndex + 1));
+ }
+ return list;
+ }
+ });
+ }
+
+ @Override
+ public List<String> getTreeNodes(final int treeIndex) {
+ final Tree tree = (Tree) waitForIndexedField(FieldType.Tree, treeIndex);
+ return syncExec(new MockRunnable<List<String>>() {
+ @Override
+ public List<String> run() throws Throwable {
+ ArrayList<String> list = new ArrayList<String>();
+ addTreeItemsRec(tree.getItems(), list);
+ return list;
+ }
+ });
+ }
+
+ @Override
+ public Set<String> getSelectedTableCells(int tableIndex, final int columnIndex) {
+ final Table table = (Table) waitForIndexedField(FieldType.Table, tableIndex);
+ return syncExec(new MockRunnable<Set<String>>() {
+ @Override
+ public Set<String> run() throws Throwable {
+ TreeSet<String> set = new TreeSet<String>();
+ TableItem[] sel = table.getSelection();
+ if (sel != null) {
+ for (TableItem row : sel) {
+ //first column is dummy column
+ set.add(row.getText(columnIndex + 1));
+ }
+ }
+ return set;
+ }
+ });
+ }
+
+ @Override
+ public Set<String> getSelectedTreeNodes(int treeIndex) {
+ final Tree tree = (Tree) waitForIndexedField(FieldType.Tree, treeIndex);
+ return syncExec(new MockRunnable<Set<String>>() {
+ @Override
+ public Set<String> run() throws Throwable {
+ TreeSet<String> set = new TreeSet<String>();
+ TreeItem[] sel = tree.getSelection();
+ if (sel != null) {
+ for (TreeItem row : sel) {
+ set.add(row.getText(0));
+ }
+ }
+ return set;
+ }
+ });
+ }
+
+ @Override
+ public Set<String> getCheckedTableCells(int tableIndex, final int columnIndex) {
+ final Table table = (Table) waitForIndexedField(FieldType.Table, tableIndex);
+ return syncExec(new MockRunnable<Set<String>>() {
+ @Override
+ public Set<String> run() throws Throwable {
+ TreeSet<String> check = new TreeSet<String>();
+ for (int i = 0; i < table.getItemCount(); i++) {
+ TableItem item = table.getItem(i);
+ if (item.getData() instanceof ITableRow) {
+ ITableRow row = (ITableRow) item.getData();
+ if (row.isChecked()) {
+ check.add(item.getText(columnIndex + 1));
+ }
+ }
+ }
+ return check;
+ }
+ });
+ }
+
+ @Override
+ public void gotoPoint(int x, int y) {
+ m_bot.moveTo(x, y);
+ }
+
+ @Override
+ public void move(int deltaX, int deltaY) {
+ m_bot.moveDelta(deltaX, deltaY);
+ }
+
+ @Override
+ public void clickLeft() {
+ m_bot.clickLeft();
+ waitForIdle();
+ }
+
+ @Override
+ public void clickRight() {
+ m_bot.clickRight();
+ waitForIdle();
+ }
+
+ @Override
+ public void pressLeft() {
+ m_bot.pressLeft();
+ }
+
+ @Override
+ public void releaseLeft() {
+ m_bot.releaseLeft();
+ waitForIdle();
+ }
+
+ @Override
+ public void drag(int x1, int y1, int x2, int y2) {
+ gotoPoint(x1, y1);
+ m_bot.pressLeft();
+ gotoPoint(x2, y2);
+ m_bot.releaseLeft();
+ waitForIdle();
+ }
+
+ @Override
+ public void dragWindowRightBorder(WindowState windowState, int pixelToMoveOnX) {
+ int borderSize = (OsUtility.isWindows7() ? 5 : 4);
+
+ int xPos = windowState.x + windowState.width + borderSize;
+ int yPos = windowState.y + windowState.height / 2;
+ drag(xPos, yPos, xPos + pixelToMoveOnX, yPos);
+ }
+
+ @Override
+ public void typeText(final String text) {
+ m_bot.typeText(text);
+ waitForIdle();
+ }
+
+ @Override
+ public void paste(String text) {
+ Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(text), null);
+ //press paste (ctrl-V)
+ m_bot.pressKey(Key.Control);
+ m_bot.typeText("v");
+ m_bot.releaseKey(Key.Control);
+ }
+
+ @Override
+ public void pressKey(Key key) {
+ m_bot.pressKey(key);
+ waitForIdle();
+ }
+
+ @Override
+ public void releaseKey(Key key) {
+ m_bot.releaseKey(key);
+ waitForIdle();
+ }
+
+ @Override
+ public void typeKey(Key key) {
+ m_bot.typeKey(key);
+ waitForIdle();
+ }
+
+ @Override
+ public WindowState getWindowState(final String title) {
+ return syncExec(new MockRunnable<WindowState>() {
+ @Override
+ public WindowState run() throws Throwable {
+ checkActiveShell();
+ CTabItem view = findWorkbenchView(title);
+ if (view != null) {
+ WindowState state = new WindowState();
+ Point p = view.getParent().toDisplay(0, 0);
+ Point s = view.getParent().getSize();
+ state.x = p.x;
+ state.y = p.y;
+ state.width = s.x;
+ state.height = s.y;
+ return state;
+ }
+ Shell shell = findShell(title);
+ if (shell != null) {
+ Rectangle r = shell.getBounds();
+ WindowState state = new WindowState();
+ state.x = r.x;
+ state.y = r.y;
+ state.width = r.width;
+ state.height = r.height;
+ return state;
+ }
+ throw new IllegalStateException("Window " + title + " not found");
+ }
+ });
+ }
+
+ @Override
+ public String getClipboardText() {
+ waitForIdle();
+ return syncExec(new MockRunnable<String>() {
+ @Override
+ public String run() throws Throwable {
+ Clipboard b = new Clipboard(getDisplay());
+ return (String) b.getContents(TextTransfer.getInstance());
+ }
+ });
+ }
+
+ @Override
+ public Object internal0(final Object o) {
+ return syncExec(new MockRunnable<String>() {
+ @Override
+ public String run() throws Throwable {
+ return null;
+ }
+ });
+ }
+
+ protected void checkActiveShell() {
+ if (getActiveShell() == null) {
+ throw new IllegalStateException("There is no active shell");
+ }
+ }
+
+ protected FieldState getFieldStateInternal(Control c) {
+ FieldState state = new FieldState();
+ //type
+ state.type = getFieldTypeOf(c);
+ //scout name
+ IPropertyObserver scoutObject = SwtScoutComposite.getScoutModelOnWidget(c);
+ state.scoutName = (scoutObject != null ? scoutObject.getClass().getName() : null);
+ //focus
+ state.focus = (c == getDisplay().getFocusControl());
+ //bounds
+ Point p = c.toDisplay(0, 0);
+ state.x = p.x;
+ state.y = p.y;
+ state.width = c.getBounds().width;
+ state.height = c.getBounds().height;
+ //text
+ if (c instanceof Label) {
+ state.text = ((Label) c).getText();
+ }
+ if (c instanceof Text) {
+ state.text = ((Text) c).getText();
+ }
+ if (c instanceof StyledText) {
+ state.text = ((StyledText) c).getText();
+ }
+ if (c instanceof Button) {
+ state.text = ((Button) c).getText();
+ }
+ return state;
+ }
+
+ protected FieldType getFieldTypeOf(Control c) {
+ if (c.isDisposed()) {
+ return null;
+ }
+ if (!c.isVisible()) {
+ return null;
+ }
+ //
+ if (c instanceof Label) {
+ return FieldType.Label;
+ }
+ if (c instanceof Text) {
+ return FieldType.Text;
+ }
+ if (c instanceof StyledText) {
+ return FieldType.Text;
+ }
+ if (c instanceof Table) {
+ return FieldType.Table;
+ }
+ if (c instanceof Tree) {
+ return FieldType.Tree;
+ }
+ if (c instanceof DropDownButton) {
+ return FieldType.DropdownButton;
+ }
+ if (c instanceof Button) {
+ int style = c.getStyle();
+ if ((style & SWT.CHECK) != 0) {
+ return FieldType.Checkbox;
+ }
+ else if ((style & SWT.RADIO) != 0) {
+ return FieldType.RadioButton;
+ }
+ else if (c.getParent() instanceof Scrollable) {
+ return FieldType.ScrollButton;
+ }
+ else {
+ return FieldType.PushButton;
+ }
+ }
+ return null;
+ }
+
+ protected String getScoutNameOf(Control c) {
+ IPropertyObserver scoutObject = SwtScoutComposite.getScoutModelOnWidget(c);
+ if (scoutObject != null) {
+ return scoutObject.getClass().getName();
+ }
+ return null;
+ }
+
+ protected Display getDisplay() {
+ if (PlatformUI.isWorkbenchRunning()) {
+ return PlatformUI.getWorkbench().getDisplay();
+ }
+ else {
+ //there is no workbench available
+ return null;
+ }
+ }
+
+ protected Shell getActiveShell() {
+ return getDisplay().getActiveShell();
+ }
+
+ protected String cleanButtonLabel(String s) {
+ return StringUtility.removeMnemonic(s);
+ }
+
+ protected TreeItem findTreeItemRec(TreeItem[] items, String nodeText) {
+ if (items == null) {
+ return null;
+ }
+ //
+ for (TreeItem item : items) {
+ if (nodeText.equals(item.getText())) {
+ return item;
+ }
+ TreeItem found = findTreeItemRec(item.getItems(), nodeText);
+ if (found != null) {
+ return found;
+ }
+ }
+ return null;
+ }
+
+ protected void addTreeItemsRec(TreeItem[] items, List<String> list) {
+ if (items == null) {
+ return;
+ }
+ //
+ for (TreeItem item : items) {
+ list.add(item.getText(0));
+ if (item.getExpanded()) {
+ addTreeItemsRec(item.getItems(), list);
+ }
+ }
+ }
+
+ protected List<Composite> enumerateParentContainers() {
+ return syncExec(new MockRunnable<ArrayList<Composite>>() {
+ @Override
+ public ArrayList<Composite> run() throws Throwable {
+ ArrayList<Composite> list = new ArrayList<Composite>();
+ for (Shell shell : getDisplay().getShells()) {
+ if (shell.isVisible()) {
+ list.add(shell);
+ }
+ }
+ return list;
+ }
+ });
+ }
+
+ protected Shell findShell(final String title) {
+ for (Shell shell : getDisplay().getShells()) {
+ if (title.equals(shell.getText())) {
+ return shell;
+ }
+ }
+ return null;
+ }
+
+ protected CTabItem findWorkbenchView(final String title) {
+ Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+ if (shell != null) {
+ for (CTabFolder f : SwtUtility.findChildComponents(shell, CTabFolder.class)) {
+ if (f.getItemCount() > 0) {
+ for (CTabItem item : f.getItems()) {
+ if (item.isShowing()) {
+ if (title.equals(cleanButtonLabel(item.getText()))) {
+ return item;
+ }
+ }
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ protected Control waitForPushButtonWithLabel(final String label) {
+ return waitUntil(new WaitCondition<Control>() {
+ @Override
+ public Control run() {
+ return syncExec(new MockRunnable<Control>() {
+ @Override
+ public Control run() throws Throwable {
+ for (Shell shell : getDisplay().getShells()) {
+ Composite parent = shell;
+ for (Control o : SwtUtility.findChildComponents(parent, Control.class)) {
+ if (o instanceof Button) {
+ if (cleanButtonLabel(label).equals(cleanButtonLabel(((Button) o).getText()))) {
+ return o;
+ }
+ }
+ }
+ }
+ return null;
+ }
+ });
+ }
+ });
+ }
+
+ protected Control waitForScoutField(final String name) {
+ return waitUntil(new WaitCondition<Control>() {
+ @Override
+ public Control run() {
+ return syncExec(new MockRunnable<Control>() {
+ @Override
+ public Control run() throws Throwable {
+ Control lastSecondaryCandidate = null;
+ for (Composite parent : enumerateParentContainers()) {
+ for (Control c : SwtUtility.findChildComponents(parent, Control.class)) {
+ String s = getScoutNameOf(c);
+ if (s != null && ("." + s).endsWith("." + name)) {
+ lastSecondaryCandidate = c;
+ if (getFieldTypeOf(c) != null) {
+ //primary match
+ return c;
+ }
+ }
+ }
+ }
+ return lastSecondaryCandidate;
+ }
+ });
+ }
+ });
+ }
+
+ protected Control waitForIndexedField(final FieldType type, final int fieldIndex) {
+ return waitUntil(new WaitCondition<Control>() {
+ @Override
+ public Control run() {
+ return syncExec(new MockRunnable<Control>() {
+ @Override
+ public Control run() throws Throwable {
+ List<Composite> parents = enumerateParentContainers();
+ for (Composite parent : parents) {
+ int index = 0;
+ for (Control c : SwtUtility.findChildComponents(parent, Control.class)) {
+ if (getFieldTypeOf(c) == type) {
+ if (index == fieldIndex) {
+ return c;
+ }
+ index++;
+ }
+ }
+ }
+ return null;
+ }
+ });
+ }
+ });
+ }
+
+ protected MenuItem waitForMenuItem(final String name) {
+ return waitUntil(new WaitCondition<MenuItem>() {
+ @Override
+ public MenuItem run() {
+ return syncExec(new MockRunnable<MenuItem>() {
+ @Override
+ public MenuItem run() throws Throwable {
+ String label = cleanButtonLabel(name);
+ //focus control
+ Control focusControl = getDisplay().getFocusControl();
+ if (focusControl != null) {
+ Menu m = focusControl.getMenu();
+ if (m != null) {
+ for (MenuItem item : m.getItems()) {
+ if (label.equals(cleanButtonLabel(item.getText()))) {
+ return item;
+ }
+ }
+ }
+ }
+ //other controls
+ for (Composite parent : enumerateParentContainers()) {
+ for (Control c : SwtUtility.findChildComponents(parent, Control.class)) {
+ Menu m = c.getMenu();
+ if (m != null) {
+ for (MenuItem item : m.getItems()) {
+ if (label.equals(cleanButtonLabel(item.getText()))) {
+ return item;
+ }
+ }
+ }
+ }
+ }
+ //main menu
+ for (Shell shell : getDisplay().getShells()) {
+ Menu m = shell.getMenuBar();
+ if (m != null) {
+ for (MenuItem item : m.getItems()) {
+ if (label.equals(cleanButtonLabel(item.getText()))) {
+ return item;
+ }
+ }
+ }
+ }
+ return null;
+ }
+ });
+ }
+ });
+
+ }
+
+ protected <T> T syncExec(final MockRunnable<T> r) {
+ if (getDisplay().getThread() != Thread.currentThread()) {
+ final AtomicReference<T> ret = new AtomicReference<T>();
+ final AtomicReference<Throwable> ex = new AtomicReference<Throwable>();
+ try {
+ getDisplay().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ ret.set(syncExec(r));
+ }
+ catch (Throwable t) {
+ ex.set(t);
+ }
+ }
+ });
+ if (ex.get() != null) {
+ throw ex.get();
+ }
+ return ret.get();
+ }
+ catch (Throwable t) {
+ throw new RuntimeException(t);
+ }
+ }
+ //
+ try {
+ return r.run();
+ }
+ catch (Throwable t) {
+ throw new RuntimeException(t);
+ }
+ }
+
+ protected <T> T waitUntil(final WaitCondition<T> w) {
+ try {
+ return TestingUtility.waitUntil(WAIT_TIMEOUT, w);
+ }
+ catch (Throwable t) {
+ throw new RuntimeException(t);
+ }
+ finally {
+ waitForIdle();
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.testing.ui.swt/src/org/eclipse/scout/rt/testing/ui/swt/SwtMockService.java b/org.eclipse.scout.rt.testing.ui.swt/src/org/eclipse/scout/rt/testing/ui/swt/SwtMockService.java
index 656815673a..737558a5b9 100644
--- a/org.eclipse.scout.rt.testing.ui.swt/src/org/eclipse/scout/rt/testing/ui/swt/SwtMockService.java
+++ b/org.eclipse.scout.rt.testing.ui.swt/src/org/eclipse/scout/rt/testing/ui/swt/SwtMockService.java
@@ -1,35 +1,35 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.testing.ui.swt;
-
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.shared.ui.UiDeviceType;
-import org.eclipse.scout.rt.shared.ui.UiLayer;
-import org.eclipse.scout.rt.shared.ui.UserAgent;
-import org.eclipse.scout.service.AbstractService;
-import org.eclipse.scout.testing.client.IGuiMock;
-import org.eclipse.scout.testing.client.IGuiMockService;
-
-/**
- * Uses SwtBot
- */
-public class SwtMockService extends AbstractService implements IGuiMockService {
-
- @Override
- public UserAgent initUserAgent() {
- return UserAgent.create(UiLayer.SWT, UiDeviceType.DESKTOP);
- }
-
- @Override
- public IGuiMock createMock(IClientSession session) {
- return new SwtMock(session);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.testing.ui.swt;
+
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.shared.ui.UiDeviceType;
+import org.eclipse.scout.rt.shared.ui.UiLayer;
+import org.eclipse.scout.rt.shared.ui.UserAgent;
+import org.eclipse.scout.service.AbstractService;
+import org.eclipse.scout.testing.client.IGuiMock;
+import org.eclipse.scout.testing.client.IGuiMockService;
+
+/**
+ * Uses SwtBot
+ */
+public class SwtMockService extends AbstractService implements IGuiMockService {
+
+ @Override
+ public UserAgent initUserAgent() {
+ return UserAgent.create(UiLayer.SWT, UiDeviceType.DESKTOP);
+ }
+
+ @Override
+ public IGuiMock createMock(IClientSession session) {
+ return new SwtMock(session);
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap.mobile/.settings/org.eclipse.pde.core.prefs b/org.eclipse.scout.rt.ui.rap.mobile/.settings/org.eclipse.pde.core.prefs
index baef13dd8c..a3a50fc8da 100644
--- a/org.eclipse.scout.rt.ui.rap.mobile/.settings/org.eclipse.pde.core.prefs
+++ b/org.eclipse.scout.rt.ui.rap.mobile/.settings/org.eclipse.pde.core.prefs
@@ -1,3 +1,3 @@
-#Mon Jul 11 16:16:00 CEST 2011
-eclipse.preferences.version=1
-pluginProject.extensions=true
+#Mon Jul 11 16:16:00 CEST 2011
+eclipse.preferences.version=1
+pluginProject.extensions=true
diff --git a/org.eclipse.scout.rt.ui.rap.mobile/plugin.xml b/org.eclipse.scout.rt.ui.rap.mobile/plugin.xml
index 868009a9ad..f9e8b923ee 100644
--- a/org.eclipse.scout.rt.ui.rap.mobile/plugin.xml
+++ b/org.eclipse.scout.rt.ui.rap.mobile/plugin.xml
@@ -1,119 +1,119 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?> <!--
- Copyright (c) 2011 BSI Business Systems Integration AG.
- All rights reserved. This program and the accompanying materials
- are made available under the terms of the Eclipse Public License v1.0
- which accompanies this distribution, and is available at
- http://www.eclipse.org/legal/epl-v10.html
-
- Contributors:
- BSI Business Systems Integration AG - initial API and implementation
- -->
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?> <!--
+ Copyright (c) 2011 BSI Business Systems Integration AG.
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
-<plugin>
-
-
-
- <extension
- point="org.eclipse.scout.service.services">
- <service
- class="org.eclipse.scout.rt.client.services.common.icon.IconProviderService"
- createImmediately="false"
- factory="org.eclipse.scout.rt.client.services.ClientServiceFactory"
- ranking="-80">
- </service>
- </extension>
- <extension
- point="org.eclipse.scout.rt.ui.rap.formfields">
- <formField
- active="true"
- modelClass="org.eclipse.scout.rt.client.ui.form.fields.tablefield.ITableField"
- name="Mobile table field"
- scope="global">
- <factory
- class="org.eclipse.scout.rt.ui.rap.mobile.form.fields.tablefield.MobileTableFieldFactory">
- </factory>
- </formField>
- <formField
- active="true"
- modelClass="org.eclipse.scout.rt.client.ui.form.fields.treefield.ITreeField"
- name="Mobile tree field"
- scope="global">
- <factory
- class="org.eclipse.scout.rt.ui.rap.mobile.form.fields.treefield.MobileTreeFieldFactory">
- </factory>
- </formField>
- <formField
- active="true"
- modelClass="org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox"
- name="Mobile group box"
- scope="global">
- <factory
- class="org.eclipse.scout.rt.ui.rap.mobile.form.fields.groupbox.MobileGroupBoxFieldFactory">
- </factory>
- </formField>
- <formField
- active="true"
- modelClass="org.eclipse.scout.rt.client.ui.form.fields.smartfield.ISmartField"
- name="Mobile smart field"
- scope="global">
- <factory
- class="org.eclipse.scout.rt.ui.rap.mobile.form.fields.smartfield.MobileSmartFieldFactory">
- </factory>
- </formField>
- <formField
- active="true"
- modelClass="org.eclipse.scout.rt.client.ui.form.fields.datefield.IDateField"
- name="Mobile date field"
- scope="global">
- <factory
- class="org.eclipse.scout.rt.ui.rap.mobile.form.fields.datefield.MobileDateFieldFactory">
- </factory>
- </formField>
- <formField
- active="true"
- modelClass="org.eclipse.scout.rt.client.ui.form.fields.tabbox.ITabBox"
- name="Mobile tab box"
- scope="global">
- <factory
- class="org.eclipse.scout.rt.ui.rap.mobile.form.fields.tabbox.MobileTabBoxFactory">
- </factory>
- </formField>
- </extension>
- <extension
- point="org.eclipse.scout.rt.ui.rap.lookAndFeel">
- <properties
- deviceType="touch"
- scope="default">
- <property
- name="logicalGridLayout.rowHeight"
- value="28">
- </property>
- <property
- name="processButton.height"
- value="28">
- </property>
- <property
- name="table.row.height"
- value="28">
- </property>
- <property
- name="tree.node.height"
- value="28">
- </property>
- <property
- name="dndSupport.enabled"
- value="false">
- </property>
- <property
- name="formfield.selectAllOnFocus.enabled"
- value="false">
- </property>
- <property
- name="browserHistory.enabled"
- value="false">
- </property>
- </properties>
- </extension>
-
-</plugin>
+ Contributors:
+ BSI Business Systems Integration AG - initial API and implementation
+ -->
+
+<plugin>
+
+
+
+ <extension
+ point="org.eclipse.scout.service.services">
+ <service
+ class="org.eclipse.scout.rt.client.services.common.icon.IconProviderService"
+ createImmediately="false"
+ factory="org.eclipse.scout.rt.client.services.ClientServiceFactory"
+ ranking="-80">
+ </service>
+ </extension>
+ <extension
+ point="org.eclipse.scout.rt.ui.rap.formfields">
+ <formField
+ active="true"
+ modelClass="org.eclipse.scout.rt.client.ui.form.fields.tablefield.ITableField"
+ name="Mobile table field"
+ scope="global">
+ <factory
+ class="org.eclipse.scout.rt.ui.rap.mobile.form.fields.tablefield.MobileTableFieldFactory">
+ </factory>
+ </formField>
+ <formField
+ active="true"
+ modelClass="org.eclipse.scout.rt.client.ui.form.fields.treefield.ITreeField"
+ name="Mobile tree field"
+ scope="global">
+ <factory
+ class="org.eclipse.scout.rt.ui.rap.mobile.form.fields.treefield.MobileTreeFieldFactory">
+ </factory>
+ </formField>
+ <formField
+ active="true"
+ modelClass="org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox"
+ name="Mobile group box"
+ scope="global">
+ <factory
+ class="org.eclipse.scout.rt.ui.rap.mobile.form.fields.groupbox.MobileGroupBoxFieldFactory">
+ </factory>
+ </formField>
+ <formField
+ active="true"
+ modelClass="org.eclipse.scout.rt.client.ui.form.fields.smartfield.ISmartField"
+ name="Mobile smart field"
+ scope="global">
+ <factory
+ class="org.eclipse.scout.rt.ui.rap.mobile.form.fields.smartfield.MobileSmartFieldFactory">
+ </factory>
+ </formField>
+ <formField
+ active="true"
+ modelClass="org.eclipse.scout.rt.client.ui.form.fields.datefield.IDateField"
+ name="Mobile date field"
+ scope="global">
+ <factory
+ class="org.eclipse.scout.rt.ui.rap.mobile.form.fields.datefield.MobileDateFieldFactory">
+ </factory>
+ </formField>
+ <formField
+ active="true"
+ modelClass="org.eclipse.scout.rt.client.ui.form.fields.tabbox.ITabBox"
+ name="Mobile tab box"
+ scope="global">
+ <factory
+ class="org.eclipse.scout.rt.ui.rap.mobile.form.fields.tabbox.MobileTabBoxFactory">
+ </factory>
+ </formField>
+ </extension>
+ <extension
+ point="org.eclipse.scout.rt.ui.rap.lookAndFeel">
+ <properties
+ deviceType="touch"
+ scope="default">
+ <property
+ name="logicalGridLayout.rowHeight"
+ value="28">
+ </property>
+ <property
+ name="processButton.height"
+ value="28">
+ </property>
+ <property
+ name="table.row.height"
+ value="28">
+ </property>
+ <property
+ name="tree.node.height"
+ value="28">
+ </property>
+ <property
+ name="dndSupport.enabled"
+ value="false">
+ </property>
+ <property
+ name="formfield.selectAllOnFocus.enabled"
+ value="false">
+ </property>
+ <property
+ name="browserHistory.enabled"
+ value="false">
+ </property>
+ </properties>
+ </extension>
+
+</plugin>
diff --git a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/Activator.java b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/Activator.java
index 1d60667e73..2bbad370cf 100644
--- a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/Activator.java
+++ b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/Activator.java
@@ -1,43 +1,43 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.mobile;
-
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends AbstractUIPlugin {
-
- public static final String PLUGIN_ID = "org.eclipse.scout.rt.ui.rap.mobile";
-
- private static Activator m_plugin;
-
- public Activator() {
- }
-
- public static Activator getDefault() {
- return m_plugin;
- }
-
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- m_plugin = this;
- }
-
- @Override
- public void stop(BundleContext context) throws Exception {
- m_plugin = null;
- super.stop(context);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.mobile;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ public static final String PLUGIN_ID = "org.eclipse.scout.rt.ui.rap.mobile";
+
+ private static Activator m_plugin;
+
+ public Activator() {
+ }
+
+ public static Activator getDefault() {
+ return m_plugin;
+ }
+
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ m_plugin = this;
+ }
+
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ m_plugin = null;
+ super.stop(context);
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/MobileFormToolkit.java b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/MobileFormToolkit.java
index 8ca36d853b..3c31a29c82 100644
--- a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/MobileFormToolkit.java
+++ b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/MobileFormToolkit.java
@@ -1,35 +1,35 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.mobile;
-
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-
-public class MobileFormToolkit extends FormToolkit {
-
- public MobileFormToolkit(Display display) {
- super(display);
- }
-
- /**
- * The default method in FormToolkit registers a mouse down listener on the composite which sets the focus on the
- * first field. This is annoying on touchscrens therefore it's removed.
- */
- @Override
- public void adapt(Composite composite) {
- composite.setBackground(getColors().getBackground());
- if (composite.getParent() != null) {
- composite.setMenu(composite.getParent().getMenu());
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.mobile;
+
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+public class MobileFormToolkit extends FormToolkit {
+
+ public MobileFormToolkit(Display display) {
+ super(display);
+ }
+
+ /**
+ * The default method in FormToolkit registers a mouse down listener on the composite which sets the focus on the
+ * first field. This is annoying on touchscrens therefore it's removed.
+ */
+ @Override
+ public void adapt(Composite composite) {
+ composite.setBackground(getColors().getBackground());
+ if (composite.getParent() != null) {
+ composite.setMenu(composite.getParent().getMenu());
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/MobileScoutFormToolkit.java b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/MobileScoutFormToolkit.java
index 8c42219c14..4a5d92acef 100644
--- a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/MobileScoutFormToolkit.java
+++ b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/MobileScoutFormToolkit.java
@@ -1,70 +1,70 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.mobile;
-
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
-import org.eclipse.scout.rt.ui.rap.mobile.action.ActionButtonBar;
-import org.eclipse.scout.rt.ui.rap.util.ScoutFormToolkit;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.forms.widgets.Form;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-
-/**
- * @since 3.9.0
- */
-public class MobileScoutFormToolkit extends ScoutFormToolkit {
-
- public MobileScoutFormToolkit(FormToolkit kit) {
- super(kit);
- }
-
- @Override
- public Form createForm(Composite parent) {
- Form f = super.createForm(parent);
- decorateFormHeading(f);
- return f;
- }
-
- /**
- * Creates a {@link ActionButtonBar}.
- * <p>
- * On mobile devices it additionally removes the tooltips because
- * <ul>
- * <li>displaying a tooltip is buggy with rap (it appears often on simple touch down events but should actually only
- * on long pressed ones)</li>
- * <li>displaying a tooltip is not common on mobile devices</li>
- * </ul>
- */
- public ActionButtonBar createActionButtonBar(Composite parent, IMenu[] menus, int style) {
- if (menus != null) {
- for (IMenu menu : menus) {
- menu.setTooltipText(null);
- }
- }
-
- return new ActionButtonBar(parent, getUiEnvironment(), menus, style);
- }
-
- /**
- * @see #createActionButtonBar(Composite, IMenu[], int)
- */
- public ActionButtonBar createActionButtonBar(Composite parent, IMenu[] menus) {
- return createActionButtonBar(parent, menus, SWT.NONE);
- }
-
- protected IRwtEnvironment getUiEnvironment() {
- return (IRwtEnvironment) Display.getCurrent().getData(IRwtEnvironment.class.getName());
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.mobile;
+
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
+import org.eclipse.scout.rt.ui.rap.mobile.action.ActionButtonBar;
+import org.eclipse.scout.rt.ui.rap.util.ScoutFormToolkit;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.forms.widgets.Form;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+/**
+ * @since 3.9.0
+ */
+public class MobileScoutFormToolkit extends ScoutFormToolkit {
+
+ public MobileScoutFormToolkit(FormToolkit kit) {
+ super(kit);
+ }
+
+ @Override
+ public Form createForm(Composite parent) {
+ Form f = super.createForm(parent);
+ decorateFormHeading(f);
+ return f;
+ }
+
+ /**
+ * Creates a {@link ActionButtonBar}.
+ * <p>
+ * On mobile devices it additionally removes the tooltips because
+ * <ul>
+ * <li>displaying a tooltip is buggy with rap (it appears often on simple touch down events but should actually only
+ * on long pressed ones)</li>
+ * <li>displaying a tooltip is not common on mobile devices</li>
+ * </ul>
+ */
+ public ActionButtonBar createActionButtonBar(Composite parent, IMenu[] menus, int style) {
+ if (menus != null) {
+ for (IMenu menu : menus) {
+ menu.setTooltipText(null);
+ }
+ }
+
+ return new ActionButtonBar(parent, getUiEnvironment(), menus, style);
+ }
+
+ /**
+ * @see #createActionButtonBar(Composite, IMenu[], int)
+ */
+ public ActionButtonBar createActionButtonBar(Composite parent, IMenu[] menus) {
+ return createActionButtonBar(parent, menus, SWT.NONE);
+ }
+
+ protected IRwtEnvironment getUiEnvironment() {
+ return (IRwtEnvironment) Display.getCurrent().getData(IRwtEnvironment.class.getName());
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/action/AbstractRwtScoutActionBar.java b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/action/AbstractRwtScoutActionBar.java
index 1eb07629d3..bfeee35042 100644
--- a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/action/AbstractRwtScoutActionBar.java
+++ b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/action/AbstractRwtScoutActionBar.java
@@ -1,325 +1,325 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.mobile.action;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.rwt.lifecycle.WidgetUtil;
-import org.eclipse.scout.commons.beans.IPropertyObserver;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.ui.rap.basic.RwtScoutComposite;
-import org.eclipse.scout.rt.ui.rap.mobile.MobileScoutFormToolkit;
-import org.eclipse.scout.rt.ui.rap.util.RwtLayoutUtility;
-import org.eclipse.scout.rt.ui.rap.util.ScoutFormToolkit;
-import org.eclipse.scout.rt.ui.rap.window.desktop.IRwtScoutActionBar;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CLabel;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * @since 3.9.0
- */
-public abstract class AbstractRwtScoutActionBar<T extends IPropertyObserver> extends RwtScoutComposite<T> implements IRwtScoutActionBar<T> {
- private static final String VARIANT_ACTION_BAR_CONTAINER = "actionBarContainer";
-
- private Composite m_leftContainer;
- private ActionButtonBar m_leftButtonBar;
- private Composite m_centerContainer;
- private Composite m_rightContainer;
- private ActionButtonBar m_rightButtonBar;
-
- private boolean m_alwaysVisible = false;
- private Integer m_heightHint;
- private int m_menuOpeningDirection = SWT.DOWN;
- private int m_rightActionBarOrientation = SWT.LEFT_TO_RIGHT;
- private CLabel m_titleField;
-
- @Override
- protected void initializeUi(Composite parent) {
- Composite container = getUiEnvironment().getFormToolkit().createComposite(parent);
- container.setData(WidgetUtil.CUSTOM_VARIANT, getActionBarContainerVariant());
- setUiContainer(container);
-
- createContent();
- }
-
- protected void createContent() {
- m_leftContainer = createLeftContainer(getUiContainer());
- m_centerContainer = createCenterContainer(getUiContainer());
- m_rightContainer = createRightContainer(getUiContainer());
-
- initLayout(getUiContainer());
- computeContainerVisibility();
- }
-
- private void computeContainerVisibility() {
- if (m_leftContainer == null || m_centerContainer == null || m_rightContainer == null) {
- getUiContainer().setVisible(false);
- return;
- }
-
- boolean makeInvisible = !isAlwaysVisible() && !hasContentOnLeftContainer() && !hasContentOnCenterContainer() && !hasContentOnRightContainer();
- getUiContainer().setVisible(!makeInvisible);
- }
-
- protected void initLayout(Composite container) {
- GridLayout containerLayout = RwtLayoutUtility.createGridLayoutNoSpacing(3, false);
- container.setLayout(containerLayout);
-
- {
- GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, true);
- m_leftContainer.setLayoutData(gridData);
- }
-
- {
- GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, true);
- m_centerContainer.setLayoutData(gridData);
- }
-
- {
- GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, true);
- m_rightContainer.setLayoutData(gridData);
- }
-
- adjustGridDataBasedOnTitle();
- }
-
- protected String getActionBarContainerVariant() {
- return VARIANT_ACTION_BAR_CONTAINER;
- }
-
- protected Composite createLeftContainer(Composite parent) {
- m_leftButtonBar = createLeftActionButtonBar(parent, m_leftButtonBar);
-
- return m_leftButtonBar;
- }
-
- protected boolean hasContentOnLeftContainer() {
- if (m_leftButtonBar == null) {
- return false;
- }
-
- return m_leftButtonBar.hasButtons();
- }
-
- protected ActionButtonBar createLeftActionButtonBar(Composite parent, ActionButtonBar existingButtonBar) {
- List<IMenu> menuList = new LinkedList<IMenu>();
- collectMenusForLeftButtonBar(menuList);
-
- ActionButtonBar leftButtonBar = createActionButtonBar(parent, existingButtonBar, menuList, SWT.LEFT | getMenuOpeningDirection());
- adaptLeftButtonBar(leftButtonBar);
-
- return leftButtonBar;
- }
-
- protected void adaptLeftButtonBar(ActionButtonBar buttonBar) {
- }
-
- protected Composite createCenterContainer(Composite parent) {
- return createCenterTitleBar(parent, m_centerContainer);
- }
-
- protected boolean hasContentOnCenterContainer() {
- return getTitle() != null;
- }
-
- protected Composite createCenterTitleBar(Composite parent, Composite existingTitleBar) {
- Composite centerTitleBar = createTitleBar(parent, existingTitleBar);
- adaptCenterTitleBar(centerTitleBar);
-
- return centerTitleBar;
- }
-
- protected void adaptCenterTitleBar(Composite buttonBar) {
- }
-
- protected Composite createRightContainer(Composite parent) {
- m_rightButtonBar = createRightActionButtonBar(parent, m_rightButtonBar);
-
- return m_rightButtonBar;
- }
-
- protected ActionButtonBar createRightActionButtonBar(Composite parent, ActionButtonBar existingButtonBar) {
- List<IMenu> menuList = new LinkedList<IMenu>();
- collectMenusForRightButtonBar(menuList);
-
- ActionButtonBar rightButtonBar = createActionButtonBar(parent, existingButtonBar, menuList, SWT.RIGHT | getMenuOpeningDirection() | getRightActionBarOrientation());
- adaptRightButtonBar(rightButtonBar);
-
- return rightButtonBar;
- }
-
- protected boolean hasContentOnRightContainer() {
- if (m_rightButtonBar == null) {
- return false;
- }
-
- return m_rightButtonBar.hasButtons();
- }
-
- protected void adaptRightButtonBar(ActionButtonBar buttonBar) {
- }
-
- private Composite createTitleBar(Composite parent, Composite existingTitleBar) {
- if (existingTitleBar != null) {
- existingTitleBar.dispose();
- existingTitleBar = null;
- }
-
- return createTitleBar(parent);
- }
-
- protected Composite createTitleBar(Composite parent) {
- m_titleField = getUiEnvironment().getFormToolkit().createCLabel(parent, null, SWT.CENTER);
- m_titleField.setData(WidgetUtil.CUSTOM_VARIANT, getActionBarContainerVariant());
-
- return m_titleField;
- }
-
- private ActionButtonBar createActionButtonBar(Composite parent, ActionButtonBar existingButtonBar, List<IMenu> menuList, int style) {
- if (existingButtonBar != null) {
- existingButtonBar.dispose();
- existingButtonBar = null;
- }
-
- return createActionButtonBar(parent, menuList, style);
- }
-
- protected ActionButtonBar createActionButtonBar(Composite parent, List<IMenu> menus, int style) {
- ScoutFormToolkit formToolkit = getUiEnvironment().getFormToolkit();
- //TODO check for MobileScoutFormToolkit can be removed as soon as ActionButtonBar is moved to core plugin
- if (formToolkit instanceof MobileScoutFormToolkit) {
- IMenu[] menuArray = cleanMenus(menus);
- return ((MobileScoutFormToolkit) formToolkit).createActionButtonBar(parent, menuArray, style);
- }
-
- return null;
- }
-
- /**
- * Removes duplicate menus from the list.
- */
- protected IMenu[] cleanMenus(List<IMenu> menus) {
- List<IMenu> cleanedMenus = new LinkedList<IMenu>();
-
- for (IMenu menu : menus) {
- if (!cleanedMenus.contains(menu)) {
- cleanedMenus.add(menu);
- }
- }
-
- return cleanedMenus.toArray(new IMenu[cleanedMenus.size()]);
- }
-
- public void rebuildContentFromScout() {
- if (isUiDisposed()) {
- return;
- }
-
- Runnable job = new Runnable() {
- @Override
- public void run() {
- if (isUiDisposed()) {
- return;
- }
-
- createContent();
- getUiContainer().getParent().layout(true, true);
- }
- };
- getUiEnvironment().invokeUiLater(job);
- }
-
- protected void setTitle(String title) {
- if (title == null) {
- return;
- }
-
- if (getTitleField() != null) {
- getTitleField().setText(title);
- }
-
- adjustGridDataBasedOnTitle();
- }
-
- /**
- * If there is a title, the center part grabs the excess horizontal space, the other parts NOT. This makes sure the
- * title always uses as much space as possible. This means action button piling is not possible anymore if a title is
- * set.
- * <p>
- * If no title is set the center part will be excluded and the left and the right part grab the excess horizontal
- * space.
- */
- protected void adjustGridDataBasedOnTitle() {
- boolean hasTitle = getTitle() != null;
-
- ((GridData) m_leftContainer.getLayoutData()).grabExcessHorizontalSpace = !hasTitle;
- ((GridData) m_centerContainer.getLayoutData()).exclude = !hasTitle;
- ((GridData) m_rightContainer.getLayoutData()).grabExcessHorizontalSpace = !hasTitle;
- }
-
- public String getTitle() {
- if (getTitleField() == null) {
- return null;
- }
-
- return getTitleField().getText();
- }
-
- public boolean isAlwaysVisible() {
- return m_alwaysVisible;
- }
-
- public void setAlwaysVisible(boolean alwaysVisible) {
- m_alwaysVisible = alwaysVisible;
- }
-
- @Override
- public Integer getHeightHint() {
- return m_heightHint;
- }
-
- @Override
- public void setHeightHint(Integer heightHint) {
- m_heightHint = heightHint;
- }
-
- public int getMenuOpeningDirection() {
- return m_menuOpeningDirection;
- }
-
- public void setMenuOpeningDirection(int menuOpeningDirection) {
- m_menuOpeningDirection = menuOpeningDirection;
- }
-
- public int getRightActionBarOrientation() {
- return m_rightActionBarOrientation;
- }
-
- public void setRightActionBarOrientation(int orientation) {
- m_rightActionBarOrientation = orientation;
- }
-
- public CLabel getTitleField() {
- return m_titleField;
- }
-
- protected void collectMenusForLeftButtonBar(List<IMenu> menuList) {
-
- }
-
- protected void collectMenusForRightButtonBar(List<IMenu> menuList) {
-
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.mobile.action;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.rwt.lifecycle.WidgetUtil;
+import org.eclipse.scout.commons.beans.IPropertyObserver;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.ui.rap.basic.RwtScoutComposite;
+import org.eclipse.scout.rt.ui.rap.mobile.MobileScoutFormToolkit;
+import org.eclipse.scout.rt.ui.rap.util.RwtLayoutUtility;
+import org.eclipse.scout.rt.ui.rap.util.ScoutFormToolkit;
+import org.eclipse.scout.rt.ui.rap.window.desktop.IRwtScoutActionBar;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * @since 3.9.0
+ */
+public abstract class AbstractRwtScoutActionBar<T extends IPropertyObserver> extends RwtScoutComposite<T> implements IRwtScoutActionBar<T> {
+ private static final String VARIANT_ACTION_BAR_CONTAINER = "actionBarContainer";
+
+ private Composite m_leftContainer;
+ private ActionButtonBar m_leftButtonBar;
+ private Composite m_centerContainer;
+ private Composite m_rightContainer;
+ private ActionButtonBar m_rightButtonBar;
+
+ private boolean m_alwaysVisible = false;
+ private Integer m_heightHint;
+ private int m_menuOpeningDirection = SWT.DOWN;
+ private int m_rightActionBarOrientation = SWT.LEFT_TO_RIGHT;
+ private CLabel m_titleField;
+
+ @Override
+ protected void initializeUi(Composite parent) {
+ Composite container = getUiEnvironment().getFormToolkit().createComposite(parent);
+ container.setData(WidgetUtil.CUSTOM_VARIANT, getActionBarContainerVariant());
+ setUiContainer(container);
+
+ createContent();
+ }
+
+ protected void createContent() {
+ m_leftContainer = createLeftContainer(getUiContainer());
+ m_centerContainer = createCenterContainer(getUiContainer());
+ m_rightContainer = createRightContainer(getUiContainer());
+
+ initLayout(getUiContainer());
+ computeContainerVisibility();
+ }
+
+ private void computeContainerVisibility() {
+ if (m_leftContainer == null || m_centerContainer == null || m_rightContainer == null) {
+ getUiContainer().setVisible(false);
+ return;
+ }
+
+ boolean makeInvisible = !isAlwaysVisible() && !hasContentOnLeftContainer() && !hasContentOnCenterContainer() && !hasContentOnRightContainer();
+ getUiContainer().setVisible(!makeInvisible);
+ }
+
+ protected void initLayout(Composite container) {
+ GridLayout containerLayout = RwtLayoutUtility.createGridLayoutNoSpacing(3, false);
+ container.setLayout(containerLayout);
+
+ {
+ GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, true);
+ m_leftContainer.setLayoutData(gridData);
+ }
+
+ {
+ GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, true);
+ m_centerContainer.setLayoutData(gridData);
+ }
+
+ {
+ GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, true);
+ m_rightContainer.setLayoutData(gridData);
+ }
+
+ adjustGridDataBasedOnTitle();
+ }
+
+ protected String getActionBarContainerVariant() {
+ return VARIANT_ACTION_BAR_CONTAINER;
+ }
+
+ protected Composite createLeftContainer(Composite parent) {
+ m_leftButtonBar = createLeftActionButtonBar(parent, m_leftButtonBar);
+
+ return m_leftButtonBar;
+ }
+
+ protected boolean hasContentOnLeftContainer() {
+ if (m_leftButtonBar == null) {
+ return false;
+ }
+
+ return m_leftButtonBar.hasButtons();
+ }
+
+ protected ActionButtonBar createLeftActionButtonBar(Composite parent, ActionButtonBar existingButtonBar) {
+ List<IMenu> menuList = new LinkedList<IMenu>();
+ collectMenusForLeftButtonBar(menuList);
+
+ ActionButtonBar leftButtonBar = createActionButtonBar(parent, existingButtonBar, menuList, SWT.LEFT | getMenuOpeningDirection());
+ adaptLeftButtonBar(leftButtonBar);
+
+ return leftButtonBar;
+ }
+
+ protected void adaptLeftButtonBar(ActionButtonBar buttonBar) {
+ }
+
+ protected Composite createCenterContainer(Composite parent) {
+ return createCenterTitleBar(parent, m_centerContainer);
+ }
+
+ protected boolean hasContentOnCenterContainer() {
+ return getTitle() != null;
+ }
+
+ protected Composite createCenterTitleBar(Composite parent, Composite existingTitleBar) {
+ Composite centerTitleBar = createTitleBar(parent, existingTitleBar);
+ adaptCenterTitleBar(centerTitleBar);
+
+ return centerTitleBar;
+ }
+
+ protected void adaptCenterTitleBar(Composite buttonBar) {
+ }
+
+ protected Composite createRightContainer(Composite parent) {
+ m_rightButtonBar = createRightActionButtonBar(parent, m_rightButtonBar);
+
+ return m_rightButtonBar;
+ }
+
+ protected ActionButtonBar createRightActionButtonBar(Composite parent, ActionButtonBar existingButtonBar) {
+ List<IMenu> menuList = new LinkedList<IMenu>();
+ collectMenusForRightButtonBar(menuList);
+
+ ActionButtonBar rightButtonBar = createActionButtonBar(parent, existingButtonBar, menuList, SWT.RIGHT | getMenuOpeningDirection() | getRightActionBarOrientation());
+ adaptRightButtonBar(rightButtonBar);
+
+ return rightButtonBar;
+ }
+
+ protected boolean hasContentOnRightContainer() {
+ if (m_rightButtonBar == null) {
+ return false;
+ }
+
+ return m_rightButtonBar.hasButtons();
+ }
+
+ protected void adaptRightButtonBar(ActionButtonBar buttonBar) {
+ }
+
+ private Composite createTitleBar(Composite parent, Composite existingTitleBar) {
+ if (existingTitleBar != null) {
+ existingTitleBar.dispose();
+ existingTitleBar = null;
+ }
+
+ return createTitleBar(parent);
+ }
+
+ protected Composite createTitleBar(Composite parent) {
+ m_titleField = getUiEnvironment().getFormToolkit().createCLabel(parent, null, SWT.CENTER);
+ m_titleField.setData(WidgetUtil.CUSTOM_VARIANT, getActionBarContainerVariant());
+
+ return m_titleField;
+ }
+
+ private ActionButtonBar createActionButtonBar(Composite parent, ActionButtonBar existingButtonBar, List<IMenu> menuList, int style) {
+ if (existingButtonBar != null) {
+ existingButtonBar.dispose();
+ existingButtonBar = null;
+ }
+
+ return createActionButtonBar(parent, menuList, style);
+ }
+
+ protected ActionButtonBar createActionButtonBar(Composite parent, List<IMenu> menus, int style) {
+ ScoutFormToolkit formToolkit = getUiEnvironment().getFormToolkit();
+ //TODO check for MobileScoutFormToolkit can be removed as soon as ActionButtonBar is moved to core plugin
+ if (formToolkit instanceof MobileScoutFormToolkit) {
+ IMenu[] menuArray = cleanMenus(menus);
+ return ((MobileScoutFormToolkit) formToolkit).createActionButtonBar(parent, menuArray, style);
+ }
+
+ return null;
+ }
+
+ /**
+ * Removes duplicate menus from the list.
+ */
+ protected IMenu[] cleanMenus(List<IMenu> menus) {
+ List<IMenu> cleanedMenus = new LinkedList<IMenu>();
+
+ for (IMenu menu : menus) {
+ if (!cleanedMenus.contains(menu)) {
+ cleanedMenus.add(menu);
+ }
+ }
+
+ return cleanedMenus.toArray(new IMenu[cleanedMenus.size()]);
+ }
+
+ public void rebuildContentFromScout() {
+ if (isUiDisposed()) {
+ return;
+ }
+
+ Runnable job = new Runnable() {
+ @Override
+ public void run() {
+ if (isUiDisposed()) {
+ return;
+ }
+
+ createContent();
+ getUiContainer().getParent().layout(true, true);
+ }
+ };
+ getUiEnvironment().invokeUiLater(job);
+ }
+
+ protected void setTitle(String title) {
+ if (title == null) {
+ return;
+ }
+
+ if (getTitleField() != null) {
+ getTitleField().setText(title);
+ }
+
+ adjustGridDataBasedOnTitle();
+ }
+
+ /**
+ * If there is a title, the center part grabs the excess horizontal space, the other parts NOT. This makes sure the
+ * title always uses as much space as possible. This means action button piling is not possible anymore if a title is
+ * set.
+ * <p>
+ * If no title is set the center part will be excluded and the left and the right part grab the excess horizontal
+ * space.
+ */
+ protected void adjustGridDataBasedOnTitle() {
+ boolean hasTitle = getTitle() != null;
+
+ ((GridData) m_leftContainer.getLayoutData()).grabExcessHorizontalSpace = !hasTitle;
+ ((GridData) m_centerContainer.getLayoutData()).exclude = !hasTitle;
+ ((GridData) m_rightContainer.getLayoutData()).grabExcessHorizontalSpace = !hasTitle;
+ }
+
+ public String getTitle() {
+ if (getTitleField() == null) {
+ return null;
+ }
+
+ return getTitleField().getText();
+ }
+
+ public boolean isAlwaysVisible() {
+ return m_alwaysVisible;
+ }
+
+ public void setAlwaysVisible(boolean alwaysVisible) {
+ m_alwaysVisible = alwaysVisible;
+ }
+
+ @Override
+ public Integer getHeightHint() {
+ return m_heightHint;
+ }
+
+ @Override
+ public void setHeightHint(Integer heightHint) {
+ m_heightHint = heightHint;
+ }
+
+ public int getMenuOpeningDirection() {
+ return m_menuOpeningDirection;
+ }
+
+ public void setMenuOpeningDirection(int menuOpeningDirection) {
+ m_menuOpeningDirection = menuOpeningDirection;
+ }
+
+ public int getRightActionBarOrientation() {
+ return m_rightActionBarOrientation;
+ }
+
+ public void setRightActionBarOrientation(int orientation) {
+ m_rightActionBarOrientation = orientation;
+ }
+
+ public CLabel getTitleField() {
+ return m_titleField;
+ }
+
+ protected void collectMenusForLeftButtonBar(List<IMenu> menuList) {
+
+ }
+
+ protected void collectMenusForRightButtonBar(List<IMenu> menuList) {
+
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/action/ActionButtonBar.java b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/action/ActionButtonBar.java
index 56e1ead05d..bd93165b18 100644
--- a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/action/ActionButtonBar.java
+++ b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/action/ActionButtonBar.java
@@ -1,580 +1,580 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.mobile.action;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.rwt.lifecycle.WidgetUtil;
-import org.eclipse.scout.rt.client.mobile.Icons;
-import org.eclipse.scout.rt.client.ui.action.IAction;
-import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
-import org.eclipse.scout.rt.ui.rap.RwtMenuUtility;
-import org.eclipse.scout.rt.ui.rap.util.RwtLayoutUtility;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.layout.RowLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * @since 3.9.0
- */
-public class ActionButtonBar extends Composite {
- public static final int ORIENTATION_LEFT_TO_RIGHT = SWT.LEFT_TO_RIGHT;
- public static final int ORIENTATION_RIGHT_TO_LEFT = 1 << 26;
-
- private static final long serialVersionUID = 1L;
- private static final String VARIANT_ACTION_BAR = "actionBar";
- private static final int BUTTON_SPACING = 6;
-
- private IMenu[] m_menus;
- private List<IMenu> m_displayedMenus;
- private IRwtEnvironment m_uiEnvironment;
- private Job m_handleButtonPilingJob;
-
- private Composite m_buttonBar;
- private int m_style;
- private boolean m_pilingEnabled;
- private int m_minNumberOfAlwaysVisibleButtons;
- private int m_maxNumberOfAlwaysVisibleButtons;
- private P_ScoutPropertyChangeListener m_scoutPropertyChangeListener;
-
- public ActionButtonBar(Composite parent, IRwtEnvironment uiEnvironment, IMenu[] menus) {
- this(parent, uiEnvironment, menus, SWT.DEFAULT);
- }
-
- /**
- * @param style
- * Style flag to set the horizontalAlignment of the action bar. <br/>
- * Accepted values: {@link SWT#LEFT}, {@link SWT#CENTER}, {@link SWT#RIGHT}
- */
- public ActionButtonBar(Composite parent, IRwtEnvironment uiEnvironment, IMenu[] menus, int style) {
- super(parent, SWT.NONE);
-
- m_menus = menus;
- m_uiEnvironment = uiEnvironment;
- if (style == SWT.DEFAULT) {
- style = SWT.LEFT;
- }
- m_style = style;
-
- m_pilingEnabled = true;
- m_minNumberOfAlwaysVisibleButtons = 0;
- m_maxNumberOfAlwaysVisibleButtons = Integer.MAX_VALUE;
-
- m_displayedMenus = new LinkedList<IMenu>();
- m_displayedMenus.addAll(Arrays.asList(m_menus));
-
- if (menus != null && menus.length > 0) {
- // attaching the listeners must happen before creating the buttons to avoid events getting lost
- attachScoutPropertyChangeListener();
- }
-
- createButtonBar();
-
- if (menus != null && menus.length > 0) {
- addListener(SWT.Resize, new P_ResizeListener());
- scheduleHandleButtonPilingInUiThread();
- }
-
- initLayout(this);
- }
-
- private void attachScoutPropertyChangeListener() {
- if (m_menus == null || m_menus.length == 0) {
- return;
- }
-
- if (m_scoutPropertyChangeListener != null) {
- return;
- }
-
- m_scoutPropertyChangeListener = new P_ScoutPropertyChangeListener();
-
- for (IMenu menu : m_menus) {
- menu.addPropertyChangeListener(m_scoutPropertyChangeListener);
- }
-
- addDisposeListener(new DisposeListener() {
-
- private static final long serialVersionUID = 1L;
-
- @Override
- public void widgetDisposed(DisposeEvent event) {
- detachScoutPropertyChangeListener();
- }
-
- });
- }
-
- private void detachScoutPropertyChangeListener() {
- if (m_menus == null || m_menus.length == 0) {
- return;
- }
-
- if (m_scoutPropertyChangeListener == null) {
- return;
- }
-
- for (IMenu menu : m_menus) {
- menu.removePropertyChangeListener(m_scoutPropertyChangeListener);
- }
-
- m_scoutPropertyChangeListener = null;
- }
-
- private void initLayout(Composite composite) {
- GridLayout gridLayout = RwtLayoutUtility.createGridLayoutNoSpacing(1, true);
- composite.setLayout(gridLayout);
- }
-
- private void rebuildButtonBar() {
- if (m_buttonBar != null) {
- m_buttonBar.dispose();
- }
-
- createButtonBar();
-
- getParent().layout(true, true);
- }
-
- private void createButtonBar() {
- m_buttonBar = createButtonBar(this, m_displayedMenus);
- }
-
- private Composite createButtonBar(Composite parent, List<IMenu> actions) {
- Composite buttonBar = getUiEnvironment().getFormToolkit().createComposite(parent);
- buttonBar.setData(WidgetUtil.CUSTOM_VARIANT, VARIANT_ACTION_BAR);
- initButtonBarLayout(buttonBar);
-
- createButtons(buttonBar, actions);
-
- return buttonBar;
- }
-
- public int getActionsOrientation() {
- if ((m_style & ORIENTATION_RIGHT_TO_LEFT) != 0) {
- return ORIENTATION_RIGHT_TO_LEFT;
- }
-
- return ORIENTATION_LEFT_TO_RIGHT;
- }
-
- private void initButtonBarLayout(Composite buttonBar) {
- RowLayout layout = new RowLayout(SWT.HORIZONTAL);
- layout.marginBottom = 5;
- layout.marginTop = 5;
- layout.marginLeft = 5;
- layout.marginRight = 5;
- layout.spacing = BUTTON_SPACING;
- layout.wrap = false;
- buttonBar.setLayout(layout);
-
- int horizontalAlignment = getHorizontalAlignment();
- buttonBar.setLayoutData(new GridData(horizontalAlignment, SWT.CENTER, true, true));
- }
-
- private int getHorizontalAlignment() {
- if ((m_style & SWT.LEFT) != 0) {
- return SWT.LEFT;
- }
- else if ((m_style & SWT.CENTER) != 0) {
- return SWT.CENTER;
- }
- else if ((m_style & SWT.RIGHT) != 0) {
- return SWT.RIGHT;
- }
-
- return SWT.DEFAULT;
- }
-
- private void createButtons(Composite buttonBar, List<IMenu> actions) {
- if (actions.size() == 0 || !isAnyActionVisible(actions)) {
- return;
- }
-
- if (getActionsOrientation() == ORIENTATION_RIGHT_TO_LEFT) {
- actions = reverseActions(actions);
- }
-
- for (IMenu menu : actions) {
- createButton(buttonBar, menu);
- }
- }
-
- private List<IMenu> reverseActions(List<IMenu> actions) {
- List<IMenu> reversedMenuList = new LinkedList<IMenu>(actions);
- Collections.reverse(reversedMenuList);
-
- return reversedMenuList;
- }
-
- protected void createButton(Composite parent, IAction action) {
- if (action == null) {
- return;
- }
- if (action.isSeparator()) {
- return;
- }
- if (!action.isVisible()) {
- return;
- }
- if (RwtMenuUtility.hasChildActions(action) && !RwtMenuUtility.hasVisibleChildActions(action)) {
- return;
- }
-
- IRwtScoutActionButton button = new RwtScoutActionButton();
- button.setMenuOpeningDirection(getMenuOpeningDirection());
- button.createUiField(parent, action, getUiEnvironment());
- }
-
- protected int getMenuOpeningDirection() {
- if ((m_style & SWT.UP) != 0) {
- return SWT.UP;
- }
-
- return SWT.DOWN;
- }
-
- public void handleButtonPiling() {
- if (isButtonBarTooSmall(m_buttonBar) || getNumberOfDisplayedButtons() > m_maxNumberOfAlwaysVisibleButtons) {
- pileButtons();
- }
- else {
- breakPileButtonsApart();
- }
- }
-
- private void scheduleHandleButtonPilingInUiThread() {
- if (m_buttonBar == null || m_buttonBar.isDisposed()) {
- return;
- }
-
- getUiEnvironment().getDisplay().asyncExec(new Runnable() {
-
- @Override
- public void run() {
- if (m_buttonBar == null || m_buttonBar.isDisposed()) {
- return;
- }
-
- handleButtonPiling();
- }
-
- });
- }
-
- private void breakPileButtonsApart() {
- boolean brokeApart = false;
-
- do {
- brokeApart = breakPileButtonApart();
- }
- while (brokeApart);
- }
-
- private void pileButtons() {
- boolean stackingSuccessful = false;
-
- do {
- stackingSuccessful = createPileButton();
- }
- while (stackingSuccessful && (isButtonBarTooSmall(m_buttonBar) || getNumberOfDisplayedButtons() > m_maxNumberOfAlwaysVisibleButtons));
- }
-
- private boolean isButtonBarTooSmall(Composite buttonBar) {
- Rectangle actualSize = buttonBar.getBounds();
- Point preferredSize = buttonBar.computeSize(SWT.DEFAULT, actualSize.height, false);
-
- if (actualSize.width < preferredSize.x) {
- return true;
- }
-
- return false;
- }
-
- protected boolean breakPileButtonApart() {
- if (m_displayedMenus == null || m_displayedMenus.size() == 0) {
- return false;
- }
-
- if (getNumberOfDisplayedButtons() >= m_maxNumberOfAlwaysVisibleButtons) {
- return false;
- }
-
- List<IMenu> displayedMenusCopy = new LinkedList<IMenu>();
- displayedMenusCopy.addAll(m_displayedMenus);
-
- IMenu lastDisplayedMenu = displayedMenusCopy.remove(displayedMenusCopy.size() - 1);
- if (!(lastDisplayedMenu instanceof PileMenu)) {
- return false;
- }
-
- PileMenu pileMenu = (PileMenu) lastDisplayedMenu;
-
- List<IMenu> currentPileMenus = pileMenu.getChildActions();
- IMenu firstMenu = currentPileMenus.remove(0);
- displayedMenusCopy.add(firstMenu);
-
- if (currentPileMenus.size() > 0) {
- PileMenu newPileMenu = createPileMenu(currentPileMenus);
- displayedMenusCopy.add(newPileMenu);
- }
-
- if (isEnoughSpaceToBreakApart(displayedMenusCopy)) {
- m_displayedMenus = displayedMenusCopy;
- rebuildButtonBar();
- return true;
- }
-
- return false;
- }
-
- /**
- * Creates and layouts an invisible composite to compute if there is enough space to fully display the buttons for the
- * given actions.
- */
- private boolean isEnoughSpaceToBreakApart(List<IMenu> menusToDisplay) {
- Shell shell = new Shell();
- try {
- shell.setSize(getBounds().width, getBounds().height);
- initLayout(shell);
-
- Composite buttonBar = createButtonBar(shell, menusToDisplay);
-
- shell.layout();
-
- return (!isButtonBarTooSmall(buttonBar));
- }
- finally {
- shell.dispose();
- }
- }
-
- private PileMenu createPileMenu(List<IMenu> childActions) {
- PileMenu pileMenu = new PileMenu();
- pileMenu.setChildActions(childActions);
- if (getMenuOpeningDirection() == SWT.UP) {
- pileMenu.setIconId(Icons.MoreActionsUp);
- }
- else {
- pileMenu.setIconId(Icons.MoreActionsDown);
- }
-
- return pileMenu;
- }
-
- protected boolean createPileButton() {
- if (!isPilingAllowed()) {
- return false;
- }
-
- List<IMenu> newPiledActions = new LinkedList<IMenu>();
- IMenu lastMenu = m_displayedMenus.remove(m_displayedMenus.size() - 1);
- if (lastMenu instanceof PileMenu) {
- if (m_displayedMenus.size() > getMinNumberOfAlwaysVisibleButtons()) {
- IMenu secondLastMenu = m_displayedMenus.remove(m_displayedMenus.size() - 1);
- newPiledActions.add(secondLastMenu);
- }
- //add every existing piled actions to the new list
- newPiledActions.addAll(lastMenu.getChildActions());
- }
- else {
- newPiledActions.add(lastMenu);
- }
-
- IMenu pileMenu = createPileMenu(newPiledActions);
- m_displayedMenus.add(pileMenu);
-
- rebuildButtonBar();
-
- return true;
- }
-
- private boolean isPilingAllowed() {
- if (!isPilingEnabled()) {
- return false;
- }
-
- if (m_displayedMenus.size() == 0) {
- return false;
- }
-
- if (getNumberOfDisplayedButtons() <= getMinNumberOfAlwaysVisibleButtons()) {
- return false;
- }
-
- return true;
- }
-
- /**
- * @return The number of currently displayed buttons. Pile buttons and separators are not counted.
- */
- private int getNumberOfDisplayedButtons() {
- int size = 0;
- for (IAction action : m_displayedMenus) {
- if (!action.isSeparator() && !(action instanceof PileMenu)) {
- size++;
- }
- }
-
- return size;
- }
-
- private class PileMenu extends AbstractMenu {
-
- }
-
- public int getMinNumberOfAlwaysVisibleButtons() {
- return m_minNumberOfAlwaysVisibleButtons;
- }
-
- public void setMinNumberOfAlwaysVisibleButtons(int minNumberOfAlwaysVisibleButtons) {
- m_minNumberOfAlwaysVisibleButtons = minNumberOfAlwaysVisibleButtons;
- }
-
- public void setMaxNumberOfAlwaysVisibleButtons(int maxNumberOfAlwaysVisibleButtons) {
- m_maxNumberOfAlwaysVisibleButtons = maxNumberOfAlwaysVisibleButtons;
- }
-
- public int getMaxNumberOfAlwaysVisibleButtons() {
- return m_maxNumberOfAlwaysVisibleButtons;
- }
-
- public void setPilingEnabled(boolean pilingEnabled) {
- m_pilingEnabled = pilingEnabled;
- }
-
- public boolean isPilingEnabled() {
- return m_pilingEnabled;
- }
-
- public IRwtEnvironment getUiEnvironment() {
- return m_uiEnvironment;
- }
-
- public IMenu[] getMenus() {
- return m_menus;
- }
-
- public boolean hasButtons() {
- return getMenus() != null && getMenus().length > 0;
- }
-
- public boolean isEqualMenuList(List<IMenu> menuList) {
- if (getMenus() == null || menuList == null) {
- return false;
- }
-
- return menuList.equals(Arrays.asList(getMenus()));
- }
-
- public boolean isAnyActionVisible(List<IMenu> menuList) {
- if (menuList == null) {
- return false;
- }
-
- for (IMenu menu : menuList) {
- if (menu.isVisible()) {
- return true;
- }
- }
-
- return false;
- }
-
- private void setActionVisibleFromScout(IAction action, boolean visible) {
- rebuildButtonBar();
- }
-
- private void handleScoutPropertyChange(final PropertyChangeEvent evt) {
- if (IAction.PROP_VISIBLE.equals(evt.getPropertyName())) {
- IAction action = (IAction) evt.getSource();
- setActionVisibleFromScout(action, (Boolean) evt.getNewValue());
- }
- }
-
- private class P_ScoutPropertyChangeListener implements PropertyChangeListener {
-
- @Override
- public void propertyChange(final PropertyChangeEvent evt) {
- Runnable t = new Runnable() {
- @Override
- public void run() {
- if (isDisposed()) {
- return;
- }
-
- handleScoutPropertyChange(evt);
- }
- };
- getUiEnvironment().invokeUiLater(t);
- }
-
- }
-
- private class P_ResizeListener implements Listener {
-
- private static final long serialVersionUID = 1L;
-
- @Override
- public void handleEvent(Event event) {
- if (event.type == SWT.Resize) {
- buttonBarResized();
- }
- }
-
- private void buttonBarResized() {
- if (m_buttonBar == null || m_buttonBar.isDisposed()) {
- return;
- }
-
- if (m_handleButtonPilingJob != null) {
- m_handleButtonPilingJob.cancel();
- }
-
- m_handleButtonPilingJob = new Job("Handling button piling") {
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- scheduleHandleButtonPilingInUiThread();
-
- return Status.OK_STATUS;
- }
-
- };
-
- // Pile handling is executed delayed to avoid flickering during resize and to avoid too many attempts to compute the necessity of the piling.
- m_handleButtonPilingJob.setSystem(true);
- m_handleButtonPilingJob.schedule(200);
- }
-
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.mobile.action;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.rwt.lifecycle.WidgetUtil;
+import org.eclipse.scout.rt.client.mobile.Icons;
+import org.eclipse.scout.rt.client.ui.action.IAction;
+import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
+import org.eclipse.scout.rt.ui.rap.RwtMenuUtility;
+import org.eclipse.scout.rt.ui.rap.util.RwtLayoutUtility;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.layout.RowLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * @since 3.9.0
+ */
+public class ActionButtonBar extends Composite {
+ public static final int ORIENTATION_LEFT_TO_RIGHT = SWT.LEFT_TO_RIGHT;
+ public static final int ORIENTATION_RIGHT_TO_LEFT = 1 << 26;
+
+ private static final long serialVersionUID = 1L;
+ private static final String VARIANT_ACTION_BAR = "actionBar";
+ private static final int BUTTON_SPACING = 6;
+
+ private IMenu[] m_menus;
+ private List<IMenu> m_displayedMenus;
+ private IRwtEnvironment m_uiEnvironment;
+ private Job m_handleButtonPilingJob;
+
+ private Composite m_buttonBar;
+ private int m_style;
+ private boolean m_pilingEnabled;
+ private int m_minNumberOfAlwaysVisibleButtons;
+ private int m_maxNumberOfAlwaysVisibleButtons;
+ private P_ScoutPropertyChangeListener m_scoutPropertyChangeListener;
+
+ public ActionButtonBar(Composite parent, IRwtEnvironment uiEnvironment, IMenu[] menus) {
+ this(parent, uiEnvironment, menus, SWT.DEFAULT);
+ }
+
+ /**
+ * @param style
+ * Style flag to set the horizontalAlignment of the action bar. <br/>
+ * Accepted values: {@link SWT#LEFT}, {@link SWT#CENTER}, {@link SWT#RIGHT}
+ */
+ public ActionButtonBar(Composite parent, IRwtEnvironment uiEnvironment, IMenu[] menus, int style) {
+ super(parent, SWT.NONE);
+
+ m_menus = menus;
+ m_uiEnvironment = uiEnvironment;
+ if (style == SWT.DEFAULT) {
+ style = SWT.LEFT;
+ }
+ m_style = style;
+
+ m_pilingEnabled = true;
+ m_minNumberOfAlwaysVisibleButtons = 0;
+ m_maxNumberOfAlwaysVisibleButtons = Integer.MAX_VALUE;
+
+ m_displayedMenus = new LinkedList<IMenu>();
+ m_displayedMenus.addAll(Arrays.asList(m_menus));
+
+ if (menus != null && menus.length > 0) {
+ // attaching the listeners must happen before creating the buttons to avoid events getting lost
+ attachScoutPropertyChangeListener();
+ }
+
+ createButtonBar();
+
+ if (menus != null && menus.length > 0) {
+ addListener(SWT.Resize, new P_ResizeListener());
+ scheduleHandleButtonPilingInUiThread();
+ }
+
+ initLayout(this);
+ }
+
+ private void attachScoutPropertyChangeListener() {
+ if (m_menus == null || m_menus.length == 0) {
+ return;
+ }
+
+ if (m_scoutPropertyChangeListener != null) {
+ return;
+ }
+
+ m_scoutPropertyChangeListener = new P_ScoutPropertyChangeListener();
+
+ for (IMenu menu : m_menus) {
+ menu.addPropertyChangeListener(m_scoutPropertyChangeListener);
+ }
+
+ addDisposeListener(new DisposeListener() {
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void widgetDisposed(DisposeEvent event) {
+ detachScoutPropertyChangeListener();
+ }
+
+ });
+ }
+
+ private void detachScoutPropertyChangeListener() {
+ if (m_menus == null || m_menus.length == 0) {
+ return;
+ }
+
+ if (m_scoutPropertyChangeListener == null) {
+ return;
+ }
+
+ for (IMenu menu : m_menus) {
+ menu.removePropertyChangeListener(m_scoutPropertyChangeListener);
+ }
+
+ m_scoutPropertyChangeListener = null;
+ }
+
+ private void initLayout(Composite composite) {
+ GridLayout gridLayout = RwtLayoutUtility.createGridLayoutNoSpacing(1, true);
+ composite.setLayout(gridLayout);
+ }
+
+ private void rebuildButtonBar() {
+ if (m_buttonBar != null) {
+ m_buttonBar.dispose();
+ }
+
+ createButtonBar();
+
+ getParent().layout(true, true);
+ }
+
+ private void createButtonBar() {
+ m_buttonBar = createButtonBar(this, m_displayedMenus);
+ }
+
+ private Composite createButtonBar(Composite parent, List<IMenu> actions) {
+ Composite buttonBar = getUiEnvironment().getFormToolkit().createComposite(parent);
+ buttonBar.setData(WidgetUtil.CUSTOM_VARIANT, VARIANT_ACTION_BAR);
+ initButtonBarLayout(buttonBar);
+
+ createButtons(buttonBar, actions);
+
+ return buttonBar;
+ }
+
+ public int getActionsOrientation() {
+ if ((m_style & ORIENTATION_RIGHT_TO_LEFT) != 0) {
+ return ORIENTATION_RIGHT_TO_LEFT;
+ }
+
+ return ORIENTATION_LEFT_TO_RIGHT;
+ }
+
+ private void initButtonBarLayout(Composite buttonBar) {
+ RowLayout layout = new RowLayout(SWT.HORIZONTAL);
+ layout.marginBottom = 5;
+ layout.marginTop = 5;
+ layout.marginLeft = 5;
+ layout.marginRight = 5;
+ layout.spacing = BUTTON_SPACING;
+ layout.wrap = false;
+ buttonBar.setLayout(layout);
+
+ int horizontalAlignment = getHorizontalAlignment();
+ buttonBar.setLayoutData(new GridData(horizontalAlignment, SWT.CENTER, true, true));
+ }
+
+ private int getHorizontalAlignment() {
+ if ((m_style & SWT.LEFT) != 0) {
+ return SWT.LEFT;
+ }
+ else if ((m_style & SWT.CENTER) != 0) {
+ return SWT.CENTER;
+ }
+ else if ((m_style & SWT.RIGHT) != 0) {
+ return SWT.RIGHT;
+ }
+
+ return SWT.DEFAULT;
+ }
+
+ private void createButtons(Composite buttonBar, List<IMenu> actions) {
+ if (actions.size() == 0 || !isAnyActionVisible(actions)) {
+ return;
+ }
+
+ if (getActionsOrientation() == ORIENTATION_RIGHT_TO_LEFT) {
+ actions = reverseActions(actions);
+ }
+
+ for (IMenu menu : actions) {
+ createButton(buttonBar, menu);
+ }
+ }
+
+ private List<IMenu> reverseActions(List<IMenu> actions) {
+ List<IMenu> reversedMenuList = new LinkedList<IMenu>(actions);
+ Collections.reverse(reversedMenuList);
+
+ return reversedMenuList;
+ }
+
+ protected void createButton(Composite parent, IAction action) {
+ if (action == null) {
+ return;
+ }
+ if (action.isSeparator()) {
+ return;
+ }
+ if (!action.isVisible()) {
+ return;
+ }
+ if (RwtMenuUtility.hasChildActions(action) && !RwtMenuUtility.hasVisibleChildActions(action)) {
+ return;
+ }
+
+ IRwtScoutActionButton button = new RwtScoutActionButton();
+ button.setMenuOpeningDirection(getMenuOpeningDirection());
+ button.createUiField(parent, action, getUiEnvironment());
+ }
+
+ protected int getMenuOpeningDirection() {
+ if ((m_style & SWT.UP) != 0) {
+ return SWT.UP;
+ }
+
+ return SWT.DOWN;
+ }
+
+ public void handleButtonPiling() {
+ if (isButtonBarTooSmall(m_buttonBar) || getNumberOfDisplayedButtons() > m_maxNumberOfAlwaysVisibleButtons) {
+ pileButtons();
+ }
+ else {
+ breakPileButtonsApart();
+ }
+ }
+
+ private void scheduleHandleButtonPilingInUiThread() {
+ if (m_buttonBar == null || m_buttonBar.isDisposed()) {
+ return;
+ }
+
+ getUiEnvironment().getDisplay().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ if (m_buttonBar == null || m_buttonBar.isDisposed()) {
+ return;
+ }
+
+ handleButtonPiling();
+ }
+
+ });
+ }
+
+ private void breakPileButtonsApart() {
+ boolean brokeApart = false;
+
+ do {
+ brokeApart = breakPileButtonApart();
+ }
+ while (brokeApart);
+ }
+
+ private void pileButtons() {
+ boolean stackingSuccessful = false;
+
+ do {
+ stackingSuccessful = createPileButton();
+ }
+ while (stackingSuccessful && (isButtonBarTooSmall(m_buttonBar) || getNumberOfDisplayedButtons() > m_maxNumberOfAlwaysVisibleButtons));
+ }
+
+ private boolean isButtonBarTooSmall(Composite buttonBar) {
+ Rectangle actualSize = buttonBar.getBounds();
+ Point preferredSize = buttonBar.computeSize(SWT.DEFAULT, actualSize.height, false);
+
+ if (actualSize.width < preferredSize.x) {
+ return true;
+ }
+
+ return false;
+ }
+
+ protected boolean breakPileButtonApart() {
+ if (m_displayedMenus == null || m_displayedMenus.size() == 0) {
+ return false;
+ }
+
+ if (getNumberOfDisplayedButtons() >= m_maxNumberOfAlwaysVisibleButtons) {
+ return false;
+ }
+
+ List<IMenu> displayedMenusCopy = new LinkedList<IMenu>();
+ displayedMenusCopy.addAll(m_displayedMenus);
+
+ IMenu lastDisplayedMenu = displayedMenusCopy.remove(displayedMenusCopy.size() - 1);
+ if (!(lastDisplayedMenu instanceof PileMenu)) {
+ return false;
+ }
+
+ PileMenu pileMenu = (PileMenu) lastDisplayedMenu;
+
+ List<IMenu> currentPileMenus = pileMenu.getChildActions();
+ IMenu firstMenu = currentPileMenus.remove(0);
+ displayedMenusCopy.add(firstMenu);
+
+ if (currentPileMenus.size() > 0) {
+ PileMenu newPileMenu = createPileMenu(currentPileMenus);
+ displayedMenusCopy.add(newPileMenu);
+ }
+
+ if (isEnoughSpaceToBreakApart(displayedMenusCopy)) {
+ m_displayedMenus = displayedMenusCopy;
+ rebuildButtonBar();
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Creates and layouts an invisible composite to compute if there is enough space to fully display the buttons for the
+ * given actions.
+ */
+ private boolean isEnoughSpaceToBreakApart(List<IMenu> menusToDisplay) {
+ Shell shell = new Shell();
+ try {
+ shell.setSize(getBounds().width, getBounds().height);
+ initLayout(shell);
+
+ Composite buttonBar = createButtonBar(shell, menusToDisplay);
+
+ shell.layout();
+
+ return (!isButtonBarTooSmall(buttonBar));
+ }
+ finally {
+ shell.dispose();
+ }
+ }
+
+ private PileMenu createPileMenu(List<IMenu> childActions) {
+ PileMenu pileMenu = new PileMenu();
+ pileMenu.setChildActions(childActions);
+ if (getMenuOpeningDirection() == SWT.UP) {
+ pileMenu.setIconId(Icons.MoreActionsUp);
+ }
+ else {
+ pileMenu.setIconId(Icons.MoreActionsDown);
+ }
+
+ return pileMenu;
+ }
+
+ protected boolean createPileButton() {
+ if (!isPilingAllowed()) {
+ return false;
+ }
+
+ List<IMenu> newPiledActions = new LinkedList<IMenu>();
+ IMenu lastMenu = m_displayedMenus.remove(m_displayedMenus.size() - 1);
+ if (lastMenu instanceof PileMenu) {
+ if (m_displayedMenus.size() > getMinNumberOfAlwaysVisibleButtons()) {
+ IMenu secondLastMenu = m_displayedMenus.remove(m_displayedMenus.size() - 1);
+ newPiledActions.add(secondLastMenu);
+ }
+ //add every existing piled actions to the new list
+ newPiledActions.addAll(lastMenu.getChildActions());
+ }
+ else {
+ newPiledActions.add(lastMenu);
+ }
+
+ IMenu pileMenu = createPileMenu(newPiledActions);
+ m_displayedMenus.add(pileMenu);
+
+ rebuildButtonBar();
+
+ return true;
+ }
+
+ private boolean isPilingAllowed() {
+ if (!isPilingEnabled()) {
+ return false;
+ }
+
+ if (m_displayedMenus.size() == 0) {
+ return false;
+ }
+
+ if (getNumberOfDisplayedButtons() <= getMinNumberOfAlwaysVisibleButtons()) {
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * @return The number of currently displayed buttons. Pile buttons and separators are not counted.
+ */
+ private int getNumberOfDisplayedButtons() {
+ int size = 0;
+ for (IAction action : m_displayedMenus) {
+ if (!action.isSeparator() && !(action instanceof PileMenu)) {
+ size++;
+ }
+ }
+
+ return size;
+ }
+
+ private class PileMenu extends AbstractMenu {
+
+ }
+
+ public int getMinNumberOfAlwaysVisibleButtons() {
+ return m_minNumberOfAlwaysVisibleButtons;
+ }
+
+ public void setMinNumberOfAlwaysVisibleButtons(int minNumberOfAlwaysVisibleButtons) {
+ m_minNumberOfAlwaysVisibleButtons = minNumberOfAlwaysVisibleButtons;
+ }
+
+ public void setMaxNumberOfAlwaysVisibleButtons(int maxNumberOfAlwaysVisibleButtons) {
+ m_maxNumberOfAlwaysVisibleButtons = maxNumberOfAlwaysVisibleButtons;
+ }
+
+ public int getMaxNumberOfAlwaysVisibleButtons() {
+ return m_maxNumberOfAlwaysVisibleButtons;
+ }
+
+ public void setPilingEnabled(boolean pilingEnabled) {
+ m_pilingEnabled = pilingEnabled;
+ }
+
+ public boolean isPilingEnabled() {
+ return m_pilingEnabled;
+ }
+
+ public IRwtEnvironment getUiEnvironment() {
+ return m_uiEnvironment;
+ }
+
+ public IMenu[] getMenus() {
+ return m_menus;
+ }
+
+ public boolean hasButtons() {
+ return getMenus() != null && getMenus().length > 0;
+ }
+
+ public boolean isEqualMenuList(List<IMenu> menuList) {
+ if (getMenus() == null || menuList == null) {
+ return false;
+ }
+
+ return menuList.equals(Arrays.asList(getMenus()));
+ }
+
+ public boolean isAnyActionVisible(List<IMenu> menuList) {
+ if (menuList == null) {
+ return false;
+ }
+
+ for (IMenu menu : menuList) {
+ if (menu.isVisible()) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ private void setActionVisibleFromScout(IAction action, boolean visible) {
+ rebuildButtonBar();
+ }
+
+ private void handleScoutPropertyChange(final PropertyChangeEvent evt) {
+ if (IAction.PROP_VISIBLE.equals(evt.getPropertyName())) {
+ IAction action = (IAction) evt.getSource();
+ setActionVisibleFromScout(action, (Boolean) evt.getNewValue());
+ }
+ }
+
+ private class P_ScoutPropertyChangeListener implements PropertyChangeListener {
+
+ @Override
+ public void propertyChange(final PropertyChangeEvent evt) {
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ if (isDisposed()) {
+ return;
+ }
+
+ handleScoutPropertyChange(evt);
+ }
+ };
+ getUiEnvironment().invokeUiLater(t);
+ }
+
+ }
+
+ private class P_ResizeListener implements Listener {
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void handleEvent(Event event) {
+ if (event.type == SWT.Resize) {
+ buttonBarResized();
+ }
+ }
+
+ private void buttonBarResized() {
+ if (m_buttonBar == null || m_buttonBar.isDisposed()) {
+ return;
+ }
+
+ if (m_handleButtonPilingJob != null) {
+ m_handleButtonPilingJob.cancel();
+ }
+
+ m_handleButtonPilingJob = new Job("Handling button piling") {
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ scheduleHandleButtonPilingInUiThread();
+
+ return Status.OK_STATUS;
+ }
+
+ };
+
+ // Pile handling is executed delayed to avoid flickering during resize and to avoid too many attempts to compute the necessity of the piling.
+ m_handleButtonPilingJob.setSystem(true);
+ m_handleButtonPilingJob.schedule(200);
+ }
+
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/action/IRwtScoutActionButton.java b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/action/IRwtScoutActionButton.java
index d16b57b940..58fcfc05b4 100644
--- a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/action/IRwtScoutActionButton.java
+++ b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/action/IRwtScoutActionButton.java
@@ -1,33 +1,33 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.mobile.action;
-
-import org.eclipse.scout.rt.client.ui.action.IAction;
-import org.eclipse.scout.rt.ui.rap.basic.IRwtScoutComposite;
-import org.eclipse.swt.SWT;
-
-/**
- * @since 3.9.0
- */
-public interface IRwtScoutActionButton extends IRwtScoutComposite<IAction> {
-
- /**
- * Returns either{@link SWT#DOWN} or {@link SWT#UP}.
- */
- public int getMenuOpeningDirection();
-
- /**
- * Accepts {@link SWT#DOWN} or {@link SWT#UP}.<br/>
- * Default is {@link SWT#DOWN}
- */
- public void setMenuOpeningDirection(int menuOpeningDirection);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.mobile.action;
+
+import org.eclipse.scout.rt.client.ui.action.IAction;
+import org.eclipse.scout.rt.ui.rap.basic.IRwtScoutComposite;
+import org.eclipse.swt.SWT;
+
+/**
+ * @since 3.9.0
+ */
+public interface IRwtScoutActionButton extends IRwtScoutComposite<IAction> {
+
+ /**
+ * Returns either{@link SWT#DOWN} or {@link SWT#UP}.
+ */
+ public int getMenuOpeningDirection();
+
+ /**
+ * Accepts {@link SWT#DOWN} or {@link SWT#UP}.<br/>
+ * Default is {@link SWT#DOWN}
+ */
+ public void setMenuOpeningDirection(int menuOpeningDirection);
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/action/RwtScoutActionButton.java b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/action/RwtScoutActionButton.java
index 9d59f301f8..d5a73db48f 100644
--- a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/action/RwtScoutActionButton.java
+++ b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/action/RwtScoutActionButton.java
@@ -1,384 +1,384 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.mobile.action;
-
-import java.util.List;
-
-import org.eclipse.scout.commons.OptimisticLock;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.action.IAction;
-import org.eclipse.scout.rt.client.ui.action.tree.IActionNode;
-import org.eclipse.scout.rt.client.ui.form.fields.button.ButtonListener;
-import org.eclipse.scout.rt.ui.rap.LogicalGridData;
-import org.eclipse.scout.rt.ui.rap.LogicalGridLayout;
-import org.eclipse.scout.rt.ui.rap.RwtMenuUtility;
-import org.eclipse.scout.rt.ui.rap.basic.RwtScoutComposite;
-import org.eclipse.scout.rt.ui.rap.ext.MenuAdapterEx;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.MenuAdapter;
-import org.eclipse.swt.events.MenuEvent;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-
-/**
- * @since 3.9.0
- */
-public class RwtScoutActionButton extends RwtScoutComposite<IAction> implements IRwtScoutActionButton {
- private static IScoutLogger LOG = ScoutLogManager.getLogger(RwtScoutActionButton.class);
-
- private ButtonListener m_scoutButtonListener;
- private OptimisticLock m_selectionLock;
- //ticket 86811: avoid double-action in queue
- private boolean m_handleActionPending;
- private boolean m_selectionAlreadyRemoved;
- private int m_menuOpeningDirection = SWT.DOWN;
- private Menu m_contextMenu;
- private boolean m_ellipsisRemovalEnabled;
-
- public RwtScoutActionButton() {
- m_selectionLock = new OptimisticLock();
- m_ellipsisRemovalEnabled = true;
- }
-
- @Override
- protected void initializeUi(Composite parent) {
- Composite container = getUiEnvironment().getFormToolkit().createComposite(parent);
-
- int style = createButtonStyle();
- Button uiButton = getUiEnvironment().getFormToolkit().createButton(container, "", style);
- uiButton.addSelectionListener(new P_RwtSelectionListener());
-
- if (hasChildActions()) {
- m_contextMenu = new Menu(uiButton.getShell(), SWT.POP_UP);
- m_contextMenu.addMenuListener(new P_ContextMenuListener());
- uiButton.setMenu(m_contextMenu);
- }
-
- initLayout(container, uiButton);
-
- setUiField(uiButton);
- setUiContainer(container);
- }
-
- protected void initLayout(Composite container, Button uiButton) {
- container.setLayout(new LogicalGridLayout(0, 0));
-
- LogicalGridData data = new LogicalGridData();
- data.useUiWidth = true;
- data.useUiHeight = false; // make button as height as logical grid row height
- uiButton.setLayoutData(data);
- }
-
- protected int createButtonStyle() {
- int style = SWT.CENTER;
- if (hasChildActions()) {
- style |= SWT.TOGGLE;
- }
- else {
- style |= SWT.PUSH;
- }
-
- return style;
- }
-
- @Override
- protected void attachScout() {
- super.attachScout();
- IAction action = getScoutObject();
- setIconIdFromScout(action.getIconId());
- setTextFromScout(action.getText());
- setTooltipTextFromScout(action.getTooltipText());
- setEnabledFromScout(action.isEnabled());
- }
-
- @Override
- protected void detachScout() {
- super.detachScout();
- }
-
- @Override
- public Button getUiField() {
- return (Button) super.getUiField();
- }
-
- protected void setIconIdFromScout(String iconId) {
- if (iconId == null) {
- return;
- }
-
- Image icon = getUiEnvironment().getIcon(iconId);
- Button button = getUiField();
- button.setImage(icon);
- }
-
- protected void setTextFromScout(String text) {
- if (text == null) {
- text = "";
- }
-
- if (isEllipsisRemovalEnabled()) {
- text = removeEllipsis(text);
- }
-
- Button button = getUiField();
- button.setText(text);
- }
-
- /**
- * Removes the ellipsis at the end of the text to save space which can be essential on small screens.
- */
- protected String removeEllipsis(String text) {
- if (!StringUtility.hasText(text)) {
- return text;
- }
-
- if (text.endsWith("...")) {
- text = text.substring(0, text.length() - 3);
- }
-
- return text;
- }
-
- protected void setTooltipTextFromScout(String tooltipText) {
- getUiField().setToolTipText(tooltipText);
- }
-
- protected void setEnabledFromScout(boolean enabled) {
- getUiField().setEnabled(enabled);
- }
-
- public void setEllipsisRemovalEnabled(boolean ellipsisRemovalEnabled) {
- m_ellipsisRemovalEnabled = ellipsisRemovalEnabled;
- }
-
- public boolean isEllipsisRemovalEnabled() {
- return m_ellipsisRemovalEnabled;
- }
-
- protected void handleUiSelection() {
- if (hasChildActions()) {
- handleUiPopupMenu();
- }
- else {
- handleUiAction();
- }
- }
-
- protected void handleUiAction() {
- if (m_handleActionPending) {
- return;
- }
-
- m_handleActionPending = true;
- Runnable t = new Runnable() {
- @Override
- public void run() {
- try {
- getScoutObject().getUIFacade().fireActionFromUI();
- }
- finally {
- m_handleActionPending = false;
- }
- }
- };
- getUiEnvironment().invokeScoutLater(t, 0);
- }
-
- protected void handleUiPopupMenu() {
- Menu menu = getUiField().getMenu();
- if (menu == null) {
- return;
- }
-
- //Toggling the selection should open or close the menu.
- if (!getUiField().getSelection()) {
- return;
- }
-
- menu.addMenuListener(new MenuAdapter() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void menuHidden(MenuEvent e) {
- try {
- //Remove selection if menu hides (toggle state must reflect the menu state (open or close))
- //Note: Keyboard events (ESC, Space) are not considered at the moment because it's optimized for mobile.
- //If this class should be available for web client in the future keyboard handling should be considered to properly support toggling.
- if (!getUiField().isFocusControl()) {
- getUiField().setSelection(false);
- }
- }
- finally {
- ((Menu) e.getSource()).removeMenuListener(this);
- }
- }
- });
-
- showMenu(menu);
- }
-
- private void showMenu(Menu menu) {
- Point menuPosition = null;
-
- if (getMenuOpeningDirection() == SWT.UP) {
- menuPosition = computeMenuPositionForTop();
- }
- else {
- menuPosition = computeMenuPositionForBottom();
- }
-
- menu.setLocation(menuPosition);
- menu.setVisible(true);
- }
-
- private Point computeMenuPositionForTop() {
- Rectangle buttonBounds = getUiField().getBounds();
- int menuLocationX = buttonBounds.x;
- int menuLocationY = buttonBounds.y - estimateMenuHeight();
- return getUiField().getParent().toDisplay(menuLocationX, menuLocationY);
- }
-
- private Point computeMenuPositionForBottom() {
- Rectangle buttonBounds = getUiField().getBounds();
- int menuLocationX = buttonBounds.x;
- int menuLocationY = buttonBounds.y + buttonBounds.height;
- return getUiField().getParent().toDisplay(menuLocationX, menuLocationY);
- }
-
- /**
- * Estimates the menu height based on the actions to be displayed. If the font or padding properties changes
- * (scout.css) it breaks.
- */
- private int estimateMenuHeight() {
- List<? extends IActionNode> actions = RwtMenuUtility.cleanup(getChildActions());
- if (actions == null || actions.size() == 0) {
- return 0;
- }
-
- int height = 0;
- int itemNum = 0;
- for (IActionNode<?> actionNode : actions) {
- if (actionNode.isSeparator()) {
- if (itemNum != 0 && itemNum != actions.size() - 1 && !actions.get(itemNum - 1).isSeparator()) {
- height += 4 + 7; // separator padding and height
- }
- }
- else {
- height += 14 + 15; // menu item padding and height
- }
- itemNum++;
- }
- if (height > 0) {
- height += 8 + 4; // menu padding and border width
- }
-
- return height;
- }
-
- public boolean hasChildActions() {
- return RwtMenuUtility.hasChildActions(getScoutObject());
- }
-
- private List<? extends IActionNode> getChildActions() {
- return RwtMenuUtility.getChildActions(getScoutObject());
- }
-
- @Override
- public int getMenuOpeningDirection() {
- return m_menuOpeningDirection;
- }
-
- @Override
- public void setMenuOpeningDirection(int menuOpeningDirection) {
- if (menuOpeningDirection != SWT.TOP) {
- menuOpeningDirection = SWT.DOWN;
- }
-
- m_menuOpeningDirection = menuOpeningDirection;
- }
-
- /**
- * in rwt thread
- */
- @Override
- protected void handleScoutPropertyChange(String name, Object newValue) {
- super.handleScoutPropertyChange(name, newValue);
-
- if (IAction.PROP_ICON_ID.equals(name)) {
- setIconIdFromScout((String) newValue);
- }
- else if (IAction.PROP_TEXT.equals(name)) {
- setTextFromScout((String) newValue);
- }
- else if (IAction.PROP_TOOLTIP_TEXT.equals(name)) {
- setTextFromScout((String) newValue);
- }
- else if (IAction.PROP_ENABLED.equals(name)) {
- setEnabledFromScout(((Boolean) newValue).booleanValue());
- }
-
- }
-
- private class P_RwtSelectionListener extends SelectionAdapter {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- handleUiSelection();
- }
-
- }
-
- private class P_ContextMenuListener extends MenuAdapterEx {
- private static final long serialVersionUID = 1L;
-
- public P_ContextMenuListener() {
- super(getUiField(), getUiField());
- }
-
- @Override
- protected Menu getContextMenu() {
- return m_contextMenu;
- }
-
- @Override
- protected void setContextMenu(Menu contextMenu) {
- m_contextMenu = contextMenu;
- }
-
- @Override
- public void menuShown(MenuEvent e) {
- if (m_contextMenu != null) {
- for (MenuItem item : m_contextMenu.getItems()) {
- disposeMenuItem(item);
- }
- }
-
- List<? extends IActionNode> actions = getChildActions();
- if (actions == null) {
- return;
- }
-
- RwtMenuUtility.fillContextMenu(actions, getUiEnvironment(), m_contextMenu);
- }
-
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.mobile.action;
+
+import java.util.List;
+
+import org.eclipse.scout.commons.OptimisticLock;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.action.IAction;
+import org.eclipse.scout.rt.client.ui.action.tree.IActionNode;
+import org.eclipse.scout.rt.client.ui.form.fields.button.ButtonListener;
+import org.eclipse.scout.rt.ui.rap.LogicalGridData;
+import org.eclipse.scout.rt.ui.rap.LogicalGridLayout;
+import org.eclipse.scout.rt.ui.rap.RwtMenuUtility;
+import org.eclipse.scout.rt.ui.rap.basic.RwtScoutComposite;
+import org.eclipse.scout.rt.ui.rap.ext.MenuAdapterEx;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MenuAdapter;
+import org.eclipse.swt.events.MenuEvent;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+
+/**
+ * @since 3.9.0
+ */
+public class RwtScoutActionButton extends RwtScoutComposite<IAction> implements IRwtScoutActionButton {
+ private static IScoutLogger LOG = ScoutLogManager.getLogger(RwtScoutActionButton.class);
+
+ private ButtonListener m_scoutButtonListener;
+ private OptimisticLock m_selectionLock;
+ //ticket 86811: avoid double-action in queue
+ private boolean m_handleActionPending;
+ private boolean m_selectionAlreadyRemoved;
+ private int m_menuOpeningDirection = SWT.DOWN;
+ private Menu m_contextMenu;
+ private boolean m_ellipsisRemovalEnabled;
+
+ public RwtScoutActionButton() {
+ m_selectionLock = new OptimisticLock();
+ m_ellipsisRemovalEnabled = true;
+ }
+
+ @Override
+ protected void initializeUi(Composite parent) {
+ Composite container = getUiEnvironment().getFormToolkit().createComposite(parent);
+
+ int style = createButtonStyle();
+ Button uiButton = getUiEnvironment().getFormToolkit().createButton(container, "", style);
+ uiButton.addSelectionListener(new P_RwtSelectionListener());
+
+ if (hasChildActions()) {
+ m_contextMenu = new Menu(uiButton.getShell(), SWT.POP_UP);
+ m_contextMenu.addMenuListener(new P_ContextMenuListener());
+ uiButton.setMenu(m_contextMenu);
+ }
+
+ initLayout(container, uiButton);
+
+ setUiField(uiButton);
+ setUiContainer(container);
+ }
+
+ protected void initLayout(Composite container, Button uiButton) {
+ container.setLayout(new LogicalGridLayout(0, 0));
+
+ LogicalGridData data = new LogicalGridData();
+ data.useUiWidth = true;
+ data.useUiHeight = false; // make button as height as logical grid row height
+ uiButton.setLayoutData(data);
+ }
+
+ protected int createButtonStyle() {
+ int style = SWT.CENTER;
+ if (hasChildActions()) {
+ style |= SWT.TOGGLE;
+ }
+ else {
+ style |= SWT.PUSH;
+ }
+
+ return style;
+ }
+
+ @Override
+ protected void attachScout() {
+ super.attachScout();
+ IAction action = getScoutObject();
+ setIconIdFromScout(action.getIconId());
+ setTextFromScout(action.getText());
+ setTooltipTextFromScout(action.getTooltipText());
+ setEnabledFromScout(action.isEnabled());
+ }
+
+ @Override
+ protected void detachScout() {
+ super.detachScout();
+ }
+
+ @Override
+ public Button getUiField() {
+ return (Button) super.getUiField();
+ }
+
+ protected void setIconIdFromScout(String iconId) {
+ if (iconId == null) {
+ return;
+ }
+
+ Image icon = getUiEnvironment().getIcon(iconId);
+ Button button = getUiField();
+ button.setImage(icon);
+ }
+
+ protected void setTextFromScout(String text) {
+ if (text == null) {
+ text = "";
+ }
+
+ if (isEllipsisRemovalEnabled()) {
+ text = removeEllipsis(text);
+ }
+
+ Button button = getUiField();
+ button.setText(text);
+ }
+
+ /**
+ * Removes the ellipsis at the end of the text to save space which can be essential on small screens.
+ */
+ protected String removeEllipsis(String text) {
+ if (!StringUtility.hasText(text)) {
+ return text;
+ }
+
+ if (text.endsWith("...")) {
+ text = text.substring(0, text.length() - 3);
+ }
+
+ return text;
+ }
+
+ protected void setTooltipTextFromScout(String tooltipText) {
+ getUiField().setToolTipText(tooltipText);
+ }
+
+ protected void setEnabledFromScout(boolean enabled) {
+ getUiField().setEnabled(enabled);
+ }
+
+ public void setEllipsisRemovalEnabled(boolean ellipsisRemovalEnabled) {
+ m_ellipsisRemovalEnabled = ellipsisRemovalEnabled;
+ }
+
+ public boolean isEllipsisRemovalEnabled() {
+ return m_ellipsisRemovalEnabled;
+ }
+
+ protected void handleUiSelection() {
+ if (hasChildActions()) {
+ handleUiPopupMenu();
+ }
+ else {
+ handleUiAction();
+ }
+ }
+
+ protected void handleUiAction() {
+ if (m_handleActionPending) {
+ return;
+ }
+
+ m_handleActionPending = true;
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ try {
+ getScoutObject().getUIFacade().fireActionFromUI();
+ }
+ finally {
+ m_handleActionPending = false;
+ }
+ }
+ };
+ getUiEnvironment().invokeScoutLater(t, 0);
+ }
+
+ protected void handleUiPopupMenu() {
+ Menu menu = getUiField().getMenu();
+ if (menu == null) {
+ return;
+ }
+
+ //Toggling the selection should open or close the menu.
+ if (!getUiField().getSelection()) {
+ return;
+ }
+
+ menu.addMenuListener(new MenuAdapter() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void menuHidden(MenuEvent e) {
+ try {
+ //Remove selection if menu hides (toggle state must reflect the menu state (open or close))
+ //Note: Keyboard events (ESC, Space) are not considered at the moment because it's optimized for mobile.
+ //If this class should be available for web client in the future keyboard handling should be considered to properly support toggling.
+ if (!getUiField().isFocusControl()) {
+ getUiField().setSelection(false);
+ }
+ }
+ finally {
+ ((Menu) e.getSource()).removeMenuListener(this);
+ }
+ }
+ });
+
+ showMenu(menu);
+ }
+
+ private void showMenu(Menu menu) {
+ Point menuPosition = null;
+
+ if (getMenuOpeningDirection() == SWT.UP) {
+ menuPosition = computeMenuPositionForTop();
+ }
+ else {
+ menuPosition = computeMenuPositionForBottom();
+ }
+
+ menu.setLocation(menuPosition);
+ menu.setVisible(true);
+ }
+
+ private Point computeMenuPositionForTop() {
+ Rectangle buttonBounds = getUiField().getBounds();
+ int menuLocationX = buttonBounds.x;
+ int menuLocationY = buttonBounds.y - estimateMenuHeight();
+ return getUiField().getParent().toDisplay(menuLocationX, menuLocationY);
+ }
+
+ private Point computeMenuPositionForBottom() {
+ Rectangle buttonBounds = getUiField().getBounds();
+ int menuLocationX = buttonBounds.x;
+ int menuLocationY = buttonBounds.y + buttonBounds.height;
+ return getUiField().getParent().toDisplay(menuLocationX, menuLocationY);
+ }
+
+ /**
+ * Estimates the menu height based on the actions to be displayed. If the font or padding properties changes
+ * (scout.css) it breaks.
+ */
+ private int estimateMenuHeight() {
+ List<? extends IActionNode> actions = RwtMenuUtility.cleanup(getChildActions());
+ if (actions == null || actions.size() == 0) {
+ return 0;
+ }
+
+ int height = 0;
+ int itemNum = 0;
+ for (IActionNode<?> actionNode : actions) {
+ if (actionNode.isSeparator()) {
+ if (itemNum != 0 && itemNum != actions.size() - 1 && !actions.get(itemNum - 1).isSeparator()) {
+ height += 4 + 7; // separator padding and height
+ }
+ }
+ else {
+ height += 14 + 15; // menu item padding and height
+ }
+ itemNum++;
+ }
+ if (height > 0) {
+ height += 8 + 4; // menu padding and border width
+ }
+
+ return height;
+ }
+
+ public boolean hasChildActions() {
+ return RwtMenuUtility.hasChildActions(getScoutObject());
+ }
+
+ private List<? extends IActionNode> getChildActions() {
+ return RwtMenuUtility.getChildActions(getScoutObject());
+ }
+
+ @Override
+ public int getMenuOpeningDirection() {
+ return m_menuOpeningDirection;
+ }
+
+ @Override
+ public void setMenuOpeningDirection(int menuOpeningDirection) {
+ if (menuOpeningDirection != SWT.TOP) {
+ menuOpeningDirection = SWT.DOWN;
+ }
+
+ m_menuOpeningDirection = menuOpeningDirection;
+ }
+
+ /**
+ * in rwt thread
+ */
+ @Override
+ protected void handleScoutPropertyChange(String name, Object newValue) {
+ super.handleScoutPropertyChange(name, newValue);
+
+ if (IAction.PROP_ICON_ID.equals(name)) {
+ setIconIdFromScout((String) newValue);
+ }
+ else if (IAction.PROP_TEXT.equals(name)) {
+ setTextFromScout((String) newValue);
+ }
+ else if (IAction.PROP_TOOLTIP_TEXT.equals(name)) {
+ setTextFromScout((String) newValue);
+ }
+ else if (IAction.PROP_ENABLED.equals(name)) {
+ setEnabledFromScout(((Boolean) newValue).booleanValue());
+ }
+
+ }
+
+ private class P_RwtSelectionListener extends SelectionAdapter {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ handleUiSelection();
+ }
+
+ }
+
+ private class P_ContextMenuListener extends MenuAdapterEx {
+ private static final long serialVersionUID = 1L;
+
+ public P_ContextMenuListener() {
+ super(getUiField(), getUiField());
+ }
+
+ @Override
+ protected Menu getContextMenu() {
+ return m_contextMenu;
+ }
+
+ @Override
+ protected void setContextMenu(Menu contextMenu) {
+ m_contextMenu = contextMenu;
+ }
+
+ @Override
+ public void menuShown(MenuEvent e) {
+ if (m_contextMenu != null) {
+ for (MenuItem item : m_contextMenu.getItems()) {
+ disposeMenuItem(item);
+ }
+ }
+
+ List<? extends IActionNode> actions = getChildActions();
+ if (actions == null) {
+ return;
+ }
+
+ RwtMenuUtility.fillContextMenu(actions, getUiEnvironment(), m_contextMenu);
+ }
+
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/busy/BusyBlockDialog.java b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/busy/BusyBlockDialog.java
index c54882e389..9c17adeb9a 100644
--- a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/busy/BusyBlockDialog.java
+++ b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/busy/BusyBlockDialog.java
@@ -1,122 +1,122 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.mobile.busy;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.rwt.lifecycle.WidgetUtil;
-import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
-import org.eclipse.scout.rt.ui.rap.util.RwtLayoutUtility;
-import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * Dialog which shows a waiting message and a button to abort waiting.
- *
- * @since 3.9.0
- */
-public class BusyBlockDialog extends Dialog {
- private static final long serialVersionUID = 1L;
- private static final String DIALOG_VARIANT = "busy-dialog";
-
- private IRwtEnvironment m_uiEnvironment;
- private IProgressMonitor m_progressMonitor;
- private Label m_messageLabel;
-
- public BusyBlockDialog(Shell parentShell, IRwtEnvironment uiEnvironment, IProgressMonitor progressMonitor) {
- super(parentShell);
- m_uiEnvironment = uiEnvironment;
- m_progressMonitor = progressMonitor;
- setShellStyle(SWT.APPLICATION_MODAL);
- setBlockOnOpen(false);
- }
-
- protected String getDialogVariant() {
- return DIALOG_VARIANT;
- }
-
- @Override
- protected Control createDialogArea(Composite parent) {
- getShell().setData(WidgetUtil.CUSTOM_VARIANT, getDialogVariant());
-
- Composite container = getUiEnvironment().getFormToolkit().createComposite(parent);
- container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- container.setData(WidgetUtil.CUSTOM_VARIANT, getDialogVariant());
-
- GridLayout dialogAreaLayout = RwtLayoutUtility.createGridLayoutNoSpacing(1, false);
- dialogAreaLayout.marginTop = 12;
- dialogAreaLayout.marginBottom = 8;
- dialogAreaLayout.marginWidth = 12;
- container.setLayout(dialogAreaLayout);
-
- m_messageLabel = getUiEnvironment().getFormToolkit().createLabel(container, RwtUtility.getNlsText(Display.getCurrent(), "MobileBusyBlockingMessage"), SWT.WRAP | SWT.CENTER);
- GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
- m_messageLabel.setLayoutData(gridData);
- m_messageLabel.setData(WidgetUtil.CUSTOM_VARIANT, getDialogVariant());
- return container;
- }
-
- @Override
- protected Control createButtonBar(Composite parent) {
- Composite buttonArea = getUiEnvironment().getFormToolkit().createComposite(parent);
- buttonArea.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
-
- GridLayout layout = RwtLayoutUtility.createGridLayoutNoSpacing(1, false);
- layout.marginHeight = 8;
- buttonArea.setLayout(layout);
-
- Button cancelButton = createButton(buttonArea, RwtUtility.getNlsText(Display.getCurrent(), "MobileBusyBlockingAbort"), null);
- cancelButton.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, true));
-
- return buttonArea;
- }
-
- protected Button createButton(Composite parent, String text, String iconId) {
- Button b = getUiEnvironment().getFormToolkit().createButton(parent, text, SWT.PUSH);
- if (iconId != null) {
- b.setImage(getUiEnvironment().getIcon(iconId));
- }
- b.addSelectionListener(new P_RwtButtonListener());
- return b;
- }
-
- private IRwtEnvironment getUiEnvironment() {
- return m_uiEnvironment;
- }
-
- private void handleUiButtonSelection() {
- m_progressMonitor.setCanceled(true);
- }
-
- private class P_RwtButtonListener extends SelectionAdapter {
- private static final long serialVersionUID = 1L;
-
- public P_RwtButtonListener() {
- }
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- handleUiButtonSelection();
- }
-
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.mobile.busy;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.rwt.lifecycle.WidgetUtil;
+import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
+import org.eclipse.scout.rt.ui.rap.util.RwtLayoutUtility;
+import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * Dialog which shows a waiting message and a button to abort waiting.
+ *
+ * @since 3.9.0
+ */
+public class BusyBlockDialog extends Dialog {
+ private static final long serialVersionUID = 1L;
+ private static final String DIALOG_VARIANT = "busy-dialog";
+
+ private IRwtEnvironment m_uiEnvironment;
+ private IProgressMonitor m_progressMonitor;
+ private Label m_messageLabel;
+
+ public BusyBlockDialog(Shell parentShell, IRwtEnvironment uiEnvironment, IProgressMonitor progressMonitor) {
+ super(parentShell);
+ m_uiEnvironment = uiEnvironment;
+ m_progressMonitor = progressMonitor;
+ setShellStyle(SWT.APPLICATION_MODAL);
+ setBlockOnOpen(false);
+ }
+
+ protected String getDialogVariant() {
+ return DIALOG_VARIANT;
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ getShell().setData(WidgetUtil.CUSTOM_VARIANT, getDialogVariant());
+
+ Composite container = getUiEnvironment().getFormToolkit().createComposite(parent);
+ container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ container.setData(WidgetUtil.CUSTOM_VARIANT, getDialogVariant());
+
+ GridLayout dialogAreaLayout = RwtLayoutUtility.createGridLayoutNoSpacing(1, false);
+ dialogAreaLayout.marginTop = 12;
+ dialogAreaLayout.marginBottom = 8;
+ dialogAreaLayout.marginWidth = 12;
+ container.setLayout(dialogAreaLayout);
+
+ m_messageLabel = getUiEnvironment().getFormToolkit().createLabel(container, RwtUtility.getNlsText(Display.getCurrent(), "MobileBusyBlockingMessage"), SWT.WRAP | SWT.CENTER);
+ GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
+ m_messageLabel.setLayoutData(gridData);
+ m_messageLabel.setData(WidgetUtil.CUSTOM_VARIANT, getDialogVariant());
+ return container;
+ }
+
+ @Override
+ protected Control createButtonBar(Composite parent) {
+ Composite buttonArea = getUiEnvironment().getFormToolkit().createComposite(parent);
+ buttonArea.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
+
+ GridLayout layout = RwtLayoutUtility.createGridLayoutNoSpacing(1, false);
+ layout.marginHeight = 8;
+ buttonArea.setLayout(layout);
+
+ Button cancelButton = createButton(buttonArea, RwtUtility.getNlsText(Display.getCurrent(), "MobileBusyBlockingAbort"), null);
+ cancelButton.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, true));
+
+ return buttonArea;
+ }
+
+ protected Button createButton(Composite parent, String text, String iconId) {
+ Button b = getUiEnvironment().getFormToolkit().createButton(parent, text, SWT.PUSH);
+ if (iconId != null) {
+ b.setImage(getUiEnvironment().getIcon(iconId));
+ }
+ b.addSelectionListener(new P_RwtButtonListener());
+ return b;
+ }
+
+ private IRwtEnvironment getUiEnvironment() {
+ return m_uiEnvironment;
+ }
+
+ private void handleUiButtonSelection() {
+ m_progressMonitor.setCanceled(true);
+ }
+
+ private class P_RwtButtonListener extends SelectionAdapter {
+ private static final long serialVersionUID = 1L;
+
+ public P_RwtButtonListener() {
+ }
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ handleUiButtonSelection();
+ }
+
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/busy/BusyBlockDialogJob.java b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/busy/BusyBlockDialogJob.java
index 2dddd12ab5..4e451ff3b7 100644
--- a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/busy/BusyBlockDialogJob.java
+++ b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/busy/BusyBlockDialogJob.java
@@ -1,75 +1,75 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.mobile.busy;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.scout.commons.holders.Holder;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.busy.BusyJob;
-import org.eclipse.scout.rt.ui.rap.busy.RwtBusyHandler;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-
-public class BusyBlockDialogJob extends BusyJob {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(BusyBlockDialogJob.class);
-
- public BusyBlockDialogJob(String name, RwtBusyHandler handler) {
- super(name, handler);
- setSystem(true);
- }
-
- @Override
- protected RwtBusyHandler getBusyHandler() {
- return (RwtBusyHandler) super.getBusyHandler();
- }
-
- @Override
- protected void runBusy(IProgressMonitor monitor) {
- //nop
- }
-
- @Override
- protected void runBlocking(final IProgressMonitor monitor) {
- final Display display = getBusyHandler().getDisplay();
- final Holder<BusyBlockDialog> dialogHolder = new Holder<BusyBlockDialog>(BusyBlockDialog.class);
- try {
- display.syncExec(new Runnable() {
- @Override
- public void run() {
- Shell parentShell = getBusyHandler().getUiEnvironment().getParentShellIgnoringPopups(SWT.SYSTEM_MODAL | SWT.APPLICATION_MODAL | SWT.MODELESS);
- if (parentShell == null || parentShell.isDisposed()) {
- return;
- }
- BusyBlockDialog dialog = new BusyBlockDialog(parentShell, getBusyHandler().getUiEnvironment(), monitor);
- dialog.open();
- dialogHolder.setValue(dialog);
- }
- });
- //
- BusyBlockDialogJob.super.runBlocking(monitor);
- //
- }
- finally {
- display.asyncExec(new Runnable() {
- @Override
- public void run() {
- BusyBlockDialog dialog = dialogHolder.getValue();
- if (dialog != null) {
- dialog.close();
- }
- }
- });
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.mobile.busy;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.scout.commons.holders.Holder;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.busy.BusyJob;
+import org.eclipse.scout.rt.ui.rap.busy.RwtBusyHandler;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+public class BusyBlockDialogJob extends BusyJob {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(BusyBlockDialogJob.class);
+
+ public BusyBlockDialogJob(String name, RwtBusyHandler handler) {
+ super(name, handler);
+ setSystem(true);
+ }
+
+ @Override
+ protected RwtBusyHandler getBusyHandler() {
+ return (RwtBusyHandler) super.getBusyHandler();
+ }
+
+ @Override
+ protected void runBusy(IProgressMonitor monitor) {
+ //nop
+ }
+
+ @Override
+ protected void runBlocking(final IProgressMonitor monitor) {
+ final Display display = getBusyHandler().getDisplay();
+ final Holder<BusyBlockDialog> dialogHolder = new Holder<BusyBlockDialog>(BusyBlockDialog.class);
+ try {
+ display.syncExec(new Runnable() {
+ @Override
+ public void run() {
+ Shell parentShell = getBusyHandler().getUiEnvironment().getParentShellIgnoringPopups(SWT.SYSTEM_MODAL | SWT.APPLICATION_MODAL | SWT.MODELESS);
+ if (parentShell == null || parentShell.isDisposed()) {
+ return;
+ }
+ BusyBlockDialog dialog = new BusyBlockDialog(parentShell, getBusyHandler().getUiEnvironment(), monitor);
+ dialog.open();
+ dialogHolder.setValue(dialog);
+ }
+ });
+ //
+ BusyBlockDialogJob.super.runBlocking(monitor);
+ //
+ }
+ finally {
+ display.asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ BusyBlockDialog dialog = dialogHolder.getValue();
+ if (dialog != null) {
+ dialog.close();
+ }
+ }
+ });
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/busy/MobileWaitForBlockingJob.java b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/busy/MobileWaitForBlockingJob.java
index 9a0ba105e6..7d5c2e50bd 100644
--- a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/busy/MobileWaitForBlockingJob.java
+++ b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/busy/MobileWaitForBlockingJob.java
@@ -1,29 +1,29 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.mobile.busy;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.scout.rt.ui.rap.busy.RwtBusyHandler;
-import org.eclipse.scout.rt.ui.rap.busy.WaitForBlockingJob;
-
-public class MobileWaitForBlockingJob extends WaitForBlockingJob {
-
- public MobileWaitForBlockingJob(String name, RwtBusyHandler handler) {
- super(name, handler);
- }
-
- @Override
- protected void runBlocking(IProgressMonitor monitor) {
- //schedule blocking job
- new BusyBlockDialogJob(getName(), getBusyHandler()).schedule();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.mobile.busy;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.scout.rt.ui.rap.busy.RwtBusyHandler;
+import org.eclipse.scout.rt.ui.rap.busy.WaitForBlockingJob;
+
+public class MobileWaitForBlockingJob extends WaitForBlockingJob {
+
+ public MobileWaitForBlockingJob(String name, RwtBusyHandler handler) {
+ super(name, handler);
+ }
+
+ @Override
+ protected void runBlocking(IProgressMonitor monitor) {
+ //schedule blocking job
+ new BusyBlockDialogJob(getName(), getBusyHandler()).schedule();
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/busy/RwtMobileBusyHandler.java b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/busy/RwtMobileBusyHandler.java
index 364b78c085..f30439f6c3 100644
--- a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/busy/RwtMobileBusyHandler.java
+++ b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/busy/RwtMobileBusyHandler.java
@@ -1,36 +1,36 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.mobile.busy;
-
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.shared.TEXTS;
-import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
-import org.eclipse.scout.rt.ui.rap.busy.RwtBusyHandler;
-
-/**
- * Displays a waiting dialog on blocking instead of the blocking header.
- *
- * @see {@link BusyBlockDialog}
- * @since 3.9.0
- */
-public class RwtMobileBusyHandler extends RwtBusyHandler {
-
- public RwtMobileBusyHandler(IClientSession session, IRwtEnvironment env) {
- super(session, env);
- }
-
- @Override
- protected void runBusy(Job job) {
- new MobileWaitForBlockingJob(TEXTS.get("BusyJob"), this).schedule();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.mobile.busy;
+
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.shared.TEXTS;
+import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
+import org.eclipse.scout.rt.ui.rap.busy.RwtBusyHandler;
+
+/**
+ * Displays a waiting dialog on blocking instead of the blocking header.
+ *
+ * @see {@link BusyBlockDialog}
+ * @since 3.9.0
+ */
+public class RwtMobileBusyHandler extends RwtBusyHandler {
+
+ public RwtMobileBusyHandler(IClientSession session, IRwtEnvironment env) {
+ super(session, env);
+ }
+
+ @Override
+ protected void runBusy(Job job) {
+ new MobileWaitForBlockingJob(TEXTS.get("BusyJob"), this).schedule();
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/AbstractRwtScoutFormHeader.java b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/AbstractRwtScoutFormHeader.java
index 0172cdd522..a539366ec9 100644
--- a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/AbstractRwtScoutFormHeader.java
+++ b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/AbstractRwtScoutFormHeader.java
@@ -1,103 +1,103 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.mobile.form;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.scout.commons.job.JobEx;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.mobile.ui.form.AbstractMobileForm;
-import org.eclipse.scout.rt.client.mobile.ui.form.FormHeaderActionFetcher;
-import org.eclipse.scout.rt.client.mobile.ui.form.IActionFetcher;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.ui.rap.mobile.action.AbstractRwtScoutActionBar;
-import org.eclipse.scout.rt.ui.rap.mobile.action.ActionButtonBar;
-import org.eclipse.scout.rt.ui.rap.window.desktop.IRwtScoutFormHeader;
-
-/**
- * @since 3.9.0
- */
-public class AbstractRwtScoutFormHeader extends AbstractRwtScoutActionBar<IForm> implements IRwtScoutFormHeader {
- private static IScoutLogger LOG = ScoutLogManager.getLogger(AbstractRwtScoutFormHeader.class);
- private static final String VARIANT_FORM_HEADER = "mobileFormHeader";
-
- @Override
- protected String getActionBarContainerVariant() {
- return VARIANT_FORM_HEADER;
- }
-
- @Override
- public boolean isAlwaysVisible() {
- return true;
- }
-
- @Override
- protected void attachScout() {
- super.attachScout();
-
- setTitle(getScoutObject().getTitle());
- }
-
- @Override
- protected void adaptLeftButtonBar(ActionButtonBar buttonBar) {
- buttonBar.setPilingEnabled(false);
- }
-
- @Override
- protected void adaptRightButtonBar(ActionButtonBar buttonBar) {
- buttonBar.setMinNumberOfAlwaysVisibleButtons(1);
- buttonBar.setMaxNumberOfAlwaysVisibleButtons(1);
- }
-
- @Override
- protected void handleScoutPropertyChange(String name, Object newValue) {
- super.handleScoutPropertyChange(name, newValue);
-
- if (name.equals(IForm.PROP_TITLE)) {
- setTitle((String) newValue);
- }
- }
-
- public List<IMenu> fetchActions() {
- final List<IMenu> actionList = new LinkedList<IMenu>();
- Runnable t = new Runnable() {
- @Override
- public void run() {
- //Don't fetch actions if the form has already been removed from the desktop.
- if (!getScoutObject().isShowing()) {
- return;
- }
-
- IActionFetcher actionFetcher = AbstractMobileForm.getHeaderActionFetcher(getScoutObject());
- if (actionFetcher == null) {
- actionFetcher = new FormHeaderActionFetcher(getScoutObject());
- }
- List<IMenu> actions = actionFetcher.fetch();
- if (actions != null) {
- actionList.addAll(actions);
- }
- }
- };
-
- JobEx job = getUiEnvironment().invokeScoutLater(t, 5000);
- try {
- job.join(2000);
- }
- catch (InterruptedException ex) {
- LOG.warn("Exception occured while collecting menus.", ex);
- }
-
- return actionList;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.mobile.form;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.scout.commons.job.JobEx;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.mobile.ui.form.AbstractMobileForm;
+import org.eclipse.scout.rt.client.mobile.ui.form.FormHeaderActionFetcher;
+import org.eclipse.scout.rt.client.mobile.ui.form.IActionFetcher;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.ui.rap.mobile.action.AbstractRwtScoutActionBar;
+import org.eclipse.scout.rt.ui.rap.mobile.action.ActionButtonBar;
+import org.eclipse.scout.rt.ui.rap.window.desktop.IRwtScoutFormHeader;
+
+/**
+ * @since 3.9.0
+ */
+public class AbstractRwtScoutFormHeader extends AbstractRwtScoutActionBar<IForm> implements IRwtScoutFormHeader {
+ private static IScoutLogger LOG = ScoutLogManager.getLogger(AbstractRwtScoutFormHeader.class);
+ private static final String VARIANT_FORM_HEADER = "mobileFormHeader";
+
+ @Override
+ protected String getActionBarContainerVariant() {
+ return VARIANT_FORM_HEADER;
+ }
+
+ @Override
+ public boolean isAlwaysVisible() {
+ return true;
+ }
+
+ @Override
+ protected void attachScout() {
+ super.attachScout();
+
+ setTitle(getScoutObject().getTitle());
+ }
+
+ @Override
+ protected void adaptLeftButtonBar(ActionButtonBar buttonBar) {
+ buttonBar.setPilingEnabled(false);
+ }
+
+ @Override
+ protected void adaptRightButtonBar(ActionButtonBar buttonBar) {
+ buttonBar.setMinNumberOfAlwaysVisibleButtons(1);
+ buttonBar.setMaxNumberOfAlwaysVisibleButtons(1);
+ }
+
+ @Override
+ protected void handleScoutPropertyChange(String name, Object newValue) {
+ super.handleScoutPropertyChange(name, newValue);
+
+ if (name.equals(IForm.PROP_TITLE)) {
+ setTitle((String) newValue);
+ }
+ }
+
+ public List<IMenu> fetchActions() {
+ final List<IMenu> actionList = new LinkedList<IMenu>();
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ //Don't fetch actions if the form has already been removed from the desktop.
+ if (!getScoutObject().isShowing()) {
+ return;
+ }
+
+ IActionFetcher actionFetcher = AbstractMobileForm.getHeaderActionFetcher(getScoutObject());
+ if (actionFetcher == null) {
+ actionFetcher = new FormHeaderActionFetcher(getScoutObject());
+ }
+ List<IMenu> actions = actionFetcher.fetch();
+ if (actions != null) {
+ actionList.addAll(actions);
+ }
+ }
+ };
+
+ JobEx job = getUiEnvironment().invokeScoutLater(t, 5000);
+ try {
+ job.join(2000);
+ }
+ catch (InterruptedException ex) {
+ LOG.warn("Exception occured while collecting menus.", ex);
+ }
+
+ return actionList;
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/RwtScoutMobileForm.java b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/RwtScoutMobileForm.java
index dd82d08a80..ec53181011 100644
--- a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/RwtScoutMobileForm.java
+++ b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/RwtScoutMobileForm.java
@@ -1,27 +1,27 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.mobile.form;
-
-import org.eclipse.scout.rt.ui.rap.form.RwtScoutForm;
-
-/**
- * @since 3.9.0
- */
-public class RwtScoutMobileForm extends RwtScoutForm {
-
- @Override
- public void setInitialFocus() {
- // If a textfield gets the focus the keyboard pops up.
- // This does not seem to work when opening a form, at least with iOS. The focus is set but no keyboard is shown.
- // But a keyboard popup on the form opening isn't the wanted behaviour anyway. So that's why this function does nothing.
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.mobile.form;
+
+import org.eclipse.scout.rt.ui.rap.form.RwtScoutForm;
+
+/**
+ * @since 3.9.0
+ */
+public class RwtScoutMobileForm extends RwtScoutForm {
+
+ @Override
+ public void setInitialFocus() {
+ // If a textfield gets the focus the keyboard pops up.
+ // This does not seem to work when opening a form, at least with iOS. The focus is set but no keyboard is shown.
+ // But a keyboard popup on the form opening isn't the wanted behaviour anyway. So that's why this function does nothing.
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/RwtScoutMobileFormFooter.java b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/RwtScoutMobileFormFooter.java
index 53b3baa676..75d32fa950 100644
--- a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/RwtScoutMobileFormFooter.java
+++ b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/RwtScoutMobileFormFooter.java
@@ -1,111 +1,111 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.mobile.form;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.scout.commons.job.JobEx;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.mobile.ui.form.AbstractMobileAction;
-import org.eclipse.scout.rt.client.mobile.ui.form.AbstractMobileForm;
-import org.eclipse.scout.rt.client.mobile.ui.form.FormFooterActionFetcher;
-import org.eclipse.scout.rt.client.mobile.ui.form.IActionFetcher;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.ui.rap.mobile.action.AbstractRwtScoutActionBar;
-import org.eclipse.scout.rt.ui.rap.window.desktop.IRwtScoutFormFooter;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * @since 3.9.0
- */
-public class RwtScoutMobileFormFooter extends AbstractRwtScoutActionBar<IForm> implements IRwtScoutFormFooter {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(RwtScoutMobileFormFooter.class);
- private static final String VARIANT_FORM_FOOTER = "mobileFormFooter";
-
- private List<IMenu> m_actions;
-
- @Override
- protected void initializeUi(Composite parent) {
- setMenuOpeningDirection(SWT.UP);
- m_actions = fetchActions();
-
- super.initializeUi(parent);
- }
-
- @Override
- protected String getActionBarContainerVariant() {
- return VARIANT_FORM_FOOTER;
- }
-
- @Override
- protected void collectMenusForLeftButtonBar(final List<IMenu> menuList) {
- if (m_actions == null) {
- return;
-
- }
-
- for (IMenu action : m_actions) {
- if (AbstractMobileAction.getHorizontalAlignment(action) < 0) {
- menuList.add(action);
- }
- }
- }
-
- @Override
- protected void collectMenusForRightButtonBar(List<IMenu> menuList) {
- if (m_actions == null) {
- return;
-
- }
-
- for (IMenu action : m_actions) {
- if (AbstractMobileAction.getHorizontalAlignment(action) > 0) {
- menuList.add(action);
- }
- }
- }
-
- public List<IMenu> fetchActions() {
- final List<IMenu> actionList = new LinkedList<IMenu>();
- Runnable t = new Runnable() {
- @Override
- public void run() {
- //Don't fetch actions if the form has already been removed from the desktop.
- if (!getScoutObject().isShowing()) {
- return;
- }
-
- IActionFetcher actionFetcher = AbstractMobileForm.getFooterActionFetcher(getScoutObject());
- if (actionFetcher == null) {
- actionFetcher = new FormFooterActionFetcher(getScoutObject());
- }
- List<IMenu> actions = actionFetcher.fetch();
- if (actions != null) {
- actionList.addAll(actions);
- }
- }
- };
-
- JobEx job = getUiEnvironment().invokeScoutLater(t, 5000);
- try {
- job.join(2000);
- }
- catch (InterruptedException ex) {
- LOG.warn("Exception occured while collecting menus.", ex);
- }
-
- return actionList;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.mobile.form;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.scout.commons.job.JobEx;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.mobile.ui.form.AbstractMobileAction;
+import org.eclipse.scout.rt.client.mobile.ui.form.AbstractMobileForm;
+import org.eclipse.scout.rt.client.mobile.ui.form.FormFooterActionFetcher;
+import org.eclipse.scout.rt.client.mobile.ui.form.IActionFetcher;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.ui.rap.mobile.action.AbstractRwtScoutActionBar;
+import org.eclipse.scout.rt.ui.rap.window.desktop.IRwtScoutFormFooter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * @since 3.9.0
+ */
+public class RwtScoutMobileFormFooter extends AbstractRwtScoutActionBar<IForm> implements IRwtScoutFormFooter {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(RwtScoutMobileFormFooter.class);
+ private static final String VARIANT_FORM_FOOTER = "mobileFormFooter";
+
+ private List<IMenu> m_actions;
+
+ @Override
+ protected void initializeUi(Composite parent) {
+ setMenuOpeningDirection(SWT.UP);
+ m_actions = fetchActions();
+
+ super.initializeUi(parent);
+ }
+
+ @Override
+ protected String getActionBarContainerVariant() {
+ return VARIANT_FORM_FOOTER;
+ }
+
+ @Override
+ protected void collectMenusForLeftButtonBar(final List<IMenu> menuList) {
+ if (m_actions == null) {
+ return;
+
+ }
+
+ for (IMenu action : m_actions) {
+ if (AbstractMobileAction.getHorizontalAlignment(action) < 0) {
+ menuList.add(action);
+ }
+ }
+ }
+
+ @Override
+ protected void collectMenusForRightButtonBar(List<IMenu> menuList) {
+ if (m_actions == null) {
+ return;
+
+ }
+
+ for (IMenu action : m_actions) {
+ if (AbstractMobileAction.getHorizontalAlignment(action) > 0) {
+ menuList.add(action);
+ }
+ }
+ }
+
+ public List<IMenu> fetchActions() {
+ final List<IMenu> actionList = new LinkedList<IMenu>();
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ //Don't fetch actions if the form has already been removed from the desktop.
+ if (!getScoutObject().isShowing()) {
+ return;
+ }
+
+ IActionFetcher actionFetcher = AbstractMobileForm.getFooterActionFetcher(getScoutObject());
+ if (actionFetcher == null) {
+ actionFetcher = new FormFooterActionFetcher(getScoutObject());
+ }
+ List<IMenu> actions = actionFetcher.fetch();
+ if (actions != null) {
+ actionList.addAll(actions);
+ }
+ }
+ };
+
+ JobEx job = getUiEnvironment().invokeScoutLater(t, 5000);
+ try {
+ job.join(2000);
+ }
+ catch (InterruptedException ex) {
+ LOG.warn("Exception occured while collecting menus.", ex);
+ }
+
+ return actionList;
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/RwtScoutMobileFormHeader.java b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/RwtScoutMobileFormHeader.java
index 3cb559bc63..52a4b792e1 100644
--- a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/RwtScoutMobileFormHeader.java
+++ b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/RwtScoutMobileFormHeader.java
@@ -1,134 +1,134 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.mobile.form;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.scout.commons.holders.BooleanHolder;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.mobile.transformation.IDeviceTransformationService;
-import org.eclipse.scout.rt.client.mobile.ui.form.AbstractMobileAction;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.ui.rap.mobile.action.ActionButtonBar;
-import org.eclipse.scout.service.SERVICES;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * @since 3.9.0
- */
-public class RwtScoutMobileFormHeader extends AbstractRwtScoutFormHeader {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(RwtScoutMobileFormHeader.class);
-
- private List<IMenu> m_actions;
-
- @Override
- protected void initializeUi(Composite parent) {
- setRightActionBarOrientation(ActionButtonBar.ORIENTATION_RIGHT_TO_LEFT);
-
- m_actions = fetchActions();
-
- super.initializeUi(parent);
- }
-
- @Override
- protected void collectMenusForLeftButtonBar(final List<IMenu> menuList) {
- List<IMenu> collectedMenus = new LinkedList<IMenu>(menuList);
- if (m_actions != null) {
- for (IMenu action : m_actions) {
- if (AbstractMobileAction.getHorizontalAlignment(action) < 0) {
- collectedMenus.add(action);
- }
- }
- }
-
- final List<IMenu> menuListToAdapt = new LinkedList<IMenu>(menuList);
- menuListToAdapt.addAll(collectedMenus);
- final BooleanHolder filled = new BooleanHolder(false);
- ClientSyncJob job = new ClientSyncJob("Adapting form header left menus", getUiEnvironment().getClientSession()) {
- @Override
- protected void runVoid(IProgressMonitor monitor) throws Throwable {
- SERVICES.getService(IDeviceTransformationService.class).getDeviceTransformer().adaptFormHeaderLeftActions(getScoutObject(), menuListToAdapt);
-
- synchronized (RwtScoutMobileFormHeader.this) {
- if (!filled.getValue()) {
- menuList.addAll(menuListToAdapt);
- filled.setValue(true);
- }
- }
- }
- };
- job.schedule();
- try {
- job.join(5000);
- }
- catch (InterruptedException e) {
- LOG.warn("Failed to adapt form header left menus.", e);
- }
-
- synchronized (RwtScoutMobileFormHeader.this) {
- if (!filled.getValue()) {
- LOG.warn("Failed to adapt form header left menus, timeout reached.");
- menuList.addAll(collectedMenus);
- filled.setValue(true);
- }
- }
-
- }
-
- @Override
- protected void collectMenusForRightButtonBar(final List<IMenu> menuList) {
- List<IMenu> collectedMenus = new LinkedList<IMenu>(menuList);
- if (m_actions != null) {
- for (IMenu action : m_actions) {
- if (AbstractMobileAction.getHorizontalAlignment(action) > 0) {
- collectedMenus.add(action);
- }
- }
-
- }
-
- final List<IMenu> menuListToAdapt = new LinkedList<IMenu>(menuList);
- menuListToAdapt.addAll(collectedMenus);
- final BooleanHolder filled = new BooleanHolder(false);
- ClientSyncJob job = new ClientSyncJob("Adapting form header left menus", getUiEnvironment().getClientSession()) {
- @Override
- protected void runVoid(IProgressMonitor monitor) throws Throwable {
- SERVICES.getService(IDeviceTransformationService.class).getDeviceTransformer().adaptFormHeaderRightActions(getScoutObject(), menuListToAdapt);
-
- synchronized (RwtScoutMobileFormHeader.this) {
- if (!filled.getValue()) {
- menuList.addAll(menuListToAdapt);
- filled.setValue(true);
- }
- }
- }
- };
- job.schedule();
- try {
- job.join(5000);
- }
- catch (InterruptedException e) {
- LOG.warn("Failed to adapt form header right menus.", e);
- }
-
- synchronized (RwtScoutMobileFormHeader.this) {
- if (!filled.getValue()) {
- LOG.warn("Failed to adapt form header right menus, timeout reached.");
- menuList.addAll(collectedMenus);
- filled.setValue(true);
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.mobile.form;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.scout.commons.holders.BooleanHolder;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.mobile.transformation.IDeviceTransformationService;
+import org.eclipse.scout.rt.client.mobile.ui.form.AbstractMobileAction;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.ui.rap.mobile.action.ActionButtonBar;
+import org.eclipse.scout.service.SERVICES;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * @since 3.9.0
+ */
+public class RwtScoutMobileFormHeader extends AbstractRwtScoutFormHeader {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(RwtScoutMobileFormHeader.class);
+
+ private List<IMenu> m_actions;
+
+ @Override
+ protected void initializeUi(Composite parent) {
+ setRightActionBarOrientation(ActionButtonBar.ORIENTATION_RIGHT_TO_LEFT);
+
+ m_actions = fetchActions();
+
+ super.initializeUi(parent);
+ }
+
+ @Override
+ protected void collectMenusForLeftButtonBar(final List<IMenu> menuList) {
+ List<IMenu> collectedMenus = new LinkedList<IMenu>(menuList);
+ if (m_actions != null) {
+ for (IMenu action : m_actions) {
+ if (AbstractMobileAction.getHorizontalAlignment(action) < 0) {
+ collectedMenus.add(action);
+ }
+ }
+ }
+
+ final List<IMenu> menuListToAdapt = new LinkedList<IMenu>(menuList);
+ menuListToAdapt.addAll(collectedMenus);
+ final BooleanHolder filled = new BooleanHolder(false);
+ ClientSyncJob job = new ClientSyncJob("Adapting form header left menus", getUiEnvironment().getClientSession()) {
+ @Override
+ protected void runVoid(IProgressMonitor monitor) throws Throwable {
+ SERVICES.getService(IDeviceTransformationService.class).getDeviceTransformer().adaptFormHeaderLeftActions(getScoutObject(), menuListToAdapt);
+
+ synchronized (RwtScoutMobileFormHeader.this) {
+ if (!filled.getValue()) {
+ menuList.addAll(menuListToAdapt);
+ filled.setValue(true);
+ }
+ }
+ }
+ };
+ job.schedule();
+ try {
+ job.join(5000);
+ }
+ catch (InterruptedException e) {
+ LOG.warn("Failed to adapt form header left menus.", e);
+ }
+
+ synchronized (RwtScoutMobileFormHeader.this) {
+ if (!filled.getValue()) {
+ LOG.warn("Failed to adapt form header left menus, timeout reached.");
+ menuList.addAll(collectedMenus);
+ filled.setValue(true);
+ }
+ }
+
+ }
+
+ @Override
+ protected void collectMenusForRightButtonBar(final List<IMenu> menuList) {
+ List<IMenu> collectedMenus = new LinkedList<IMenu>(menuList);
+ if (m_actions != null) {
+ for (IMenu action : m_actions) {
+ if (AbstractMobileAction.getHorizontalAlignment(action) > 0) {
+ collectedMenus.add(action);
+ }
+ }
+
+ }
+
+ final List<IMenu> menuListToAdapt = new LinkedList<IMenu>(menuList);
+ menuListToAdapt.addAll(collectedMenus);
+ final BooleanHolder filled = new BooleanHolder(false);
+ ClientSyncJob job = new ClientSyncJob("Adapting form header left menus", getUiEnvironment().getClientSession()) {
+ @Override
+ protected void runVoid(IProgressMonitor monitor) throws Throwable {
+ SERVICES.getService(IDeviceTransformationService.class).getDeviceTransformer().adaptFormHeaderRightActions(getScoutObject(), menuListToAdapt);
+
+ synchronized (RwtScoutMobileFormHeader.this) {
+ if (!filled.getValue()) {
+ menuList.addAll(menuListToAdapt);
+ filled.setValue(true);
+ }
+ }
+ }
+ };
+ job.schedule();
+ try {
+ job.join(5000);
+ }
+ catch (InterruptedException e) {
+ LOG.warn("Failed to adapt form header right menus.", e);
+ }
+
+ synchronized (RwtScoutMobileFormHeader.this) {
+ if (!filled.getValue()) {
+ LOG.warn("Failed to adapt form header right menus, timeout reached.");
+ menuList.addAll(collectedMenus);
+ filled.setValue(true);
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/RwtScoutMobileOutlineFormHeader.java b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/RwtScoutMobileOutlineFormHeader.java
index 646f4f2a36..df3fb883d5 100644
--- a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/RwtScoutMobileOutlineFormHeader.java
+++ b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/RwtScoutMobileOutlineFormHeader.java
@@ -1,67 +1,67 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.mobile.form;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
-import org.eclipse.scout.rt.ui.rap.util.RwtLayoutUtility;
-import org.eclipse.scout.rt.ui.rap.window.desktop.toolbar.RwtScoutToolButtonBar;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * @since 3.9.0
- */
-public class RwtScoutMobileOutlineFormHeader extends AbstractRwtScoutFormHeader {
- private RwtScoutToolButtonBar m_uiToolButtonBar;
-
- @Override
- protected void collectMenusForLeftButtonBar(List<IMenu> menuList) {
- IMenu[] desktopMenus = getDesktopMenus();
- if (desktopMenus != null) {
- menuList.addAll(Arrays.asList(desktopMenus));
- }
- }
-
- @Override
- protected void setTitle(String title) {
- // No title because there is not enough space
- }
-
- @Override
- protected Composite createRightContainer(Composite parent) {
- Composite container = getUiEnvironment().getFormToolkit().createComposite(parent);
- GridLayout gridLayout = RwtLayoutUtility.createGridLayoutNoSpacing(1, false);
- container.setLayout(gridLayout);
-
- m_uiToolButtonBar = new RwtScoutMobileToolButtonBar();
- m_uiToolButtonBar.createUiField(container, getDesktop(), getUiEnvironment());
-
- GridData gridData = new GridData(SWT.RIGHT, SWT.CENTER, true, true);
- m_uiToolButtonBar.getUiContainer().setLayoutData(gridData);
-
- return container;
- }
-
- protected IDesktop getDesktop() {
- return getUiEnvironment().getClientSession().getDesktop();
- }
-
- private IMenu[] getDesktopMenus() {
- return getDesktop().getMenus();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.mobile.form;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
+import org.eclipse.scout.rt.ui.rap.util.RwtLayoutUtility;
+import org.eclipse.scout.rt.ui.rap.window.desktop.toolbar.RwtScoutToolButtonBar;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * @since 3.9.0
+ */
+public class RwtScoutMobileOutlineFormHeader extends AbstractRwtScoutFormHeader {
+ private RwtScoutToolButtonBar m_uiToolButtonBar;
+
+ @Override
+ protected void collectMenusForLeftButtonBar(List<IMenu> menuList) {
+ IMenu[] desktopMenus = getDesktopMenus();
+ if (desktopMenus != null) {
+ menuList.addAll(Arrays.asList(desktopMenus));
+ }
+ }
+
+ @Override
+ protected void setTitle(String title) {
+ // No title because there is not enough space
+ }
+
+ @Override
+ protected Composite createRightContainer(Composite parent) {
+ Composite container = getUiEnvironment().getFormToolkit().createComposite(parent);
+ GridLayout gridLayout = RwtLayoutUtility.createGridLayoutNoSpacing(1, false);
+ container.setLayout(gridLayout);
+
+ m_uiToolButtonBar = new RwtScoutMobileToolButtonBar();
+ m_uiToolButtonBar.createUiField(container, getDesktop(), getUiEnvironment());
+
+ GridData gridData = new GridData(SWT.RIGHT, SWT.CENTER, true, true);
+ m_uiToolButtonBar.getUiContainer().setLayoutData(gridData);
+
+ return container;
+ }
+
+ protected IDesktop getDesktop() {
+ return getUiEnvironment().getClientSession().getDesktop();
+ }
+
+ private IMenu[] getDesktopMenus() {
+ return getDesktop().getMenus();
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/RwtScoutMobileToolButtonBar.java b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/RwtScoutMobileToolButtonBar.java
index 604a75712a..5a088d30d4 100644
--- a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/RwtScoutMobileToolButtonBar.java
+++ b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/RwtScoutMobileToolButtonBar.java
@@ -1,29 +1,29 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.mobile.form;
-
-import org.eclipse.scout.rt.ui.rap.window.desktop.toolbar.RwtScoutToolButtonBar;
-
-/**
- * @since 3.9.0
- */
-public class RwtScoutMobileToolButtonBar extends RwtScoutToolButtonBar {
-
- @Override
- public boolean isShowingCollapseButtonEnabled() {
- return false;
- }
-
- @Override
- public boolean isShowingLabelEnabled() {
- return false;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.mobile.form;
+
+import org.eclipse.scout.rt.ui.rap.window.desktop.toolbar.RwtScoutToolButtonBar;
+
+/**
+ * @since 3.9.0
+ */
+public class RwtScoutMobileToolButtonBar extends RwtScoutToolButtonBar {
+
+ @Override
+ public boolean isShowingCollapseButtonEnabled() {
+ return false;
+ }
+
+ @Override
+ public boolean isShowingLabelEnabled() {
+ return false;
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/datefield/MobileDateFieldFactory.java b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/datefield/MobileDateFieldFactory.java
index 6fe9eb046d..4b71f2b575 100644
--- a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/datefield/MobileDateFieldFactory.java
+++ b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/datefield/MobileDateFieldFactory.java
@@ -1,55 +1,55 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.mobile.form.fields.datefield;
-
-import org.eclipse.scout.rt.client.ui.form.fields.datefield.IDateField;
-import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
-import org.eclipse.scout.rt.ui.rap.form.fields.datefield.DateFieldFactory;
-import org.eclipse.scout.rt.ui.rap.form.fields.datefield.IRwtScoutDateField;
-import org.eclipse.scout.rt.ui.rap.form.fields.datefield.IRwtScoutTimeField;
-import org.eclipse.scout.rt.ui.rap.form.fields.datefield.RwtScoutDateField;
-import org.eclipse.scout.rt.ui.rap.form.fields.datefield.RwtScoutDateTimeCompositeField;
-import org.eclipse.scout.rt.ui.rap.form.fields.datefield.RwtScoutTimeField;
-import org.eclipse.scout.rt.ui.rap.util.DeviceUtility;
-
-public class MobileDateFieldFactory extends DateFieldFactory {
-
- @Override
- protected IRwtScoutFormField<IDateField> createRwtScoutDateTimeField() {
- if (DeviceUtility.isMobileOrTabletDevice()) {
- return new RwtScoutMobileDateTimeCompositeField();
- }
- else {
- return new RwtScoutDateTimeCompositeField();
- }
- }
-
- @Override
- protected IRwtScoutDateField createRwtScoutDateField() {
- if (DeviceUtility.isMobileOrTabletDevice()) {
- return new RwtScoutMobileDateField();
- }
- else {
- return new RwtScoutDateField();
- }
- }
-
- @Override
- protected IRwtScoutTimeField createRwtScoutTimeField() {
- if (DeviceUtility.isMobileOrTabletDevice()) {
- return new RwtScoutMobileTimeField();
- }
- else {
- return new RwtScoutTimeField();
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.mobile.form.fields.datefield;
+
+import org.eclipse.scout.rt.client.ui.form.fields.datefield.IDateField;
+import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
+import org.eclipse.scout.rt.ui.rap.form.fields.datefield.DateFieldFactory;
+import org.eclipse.scout.rt.ui.rap.form.fields.datefield.IRwtScoutDateField;
+import org.eclipse.scout.rt.ui.rap.form.fields.datefield.IRwtScoutTimeField;
+import org.eclipse.scout.rt.ui.rap.form.fields.datefield.RwtScoutDateField;
+import org.eclipse.scout.rt.ui.rap.form.fields.datefield.RwtScoutDateTimeCompositeField;
+import org.eclipse.scout.rt.ui.rap.form.fields.datefield.RwtScoutTimeField;
+import org.eclipse.scout.rt.ui.rap.util.DeviceUtility;
+
+public class MobileDateFieldFactory extends DateFieldFactory {
+
+ @Override
+ protected IRwtScoutFormField<IDateField> createRwtScoutDateTimeField() {
+ if (DeviceUtility.isMobileOrTabletDevice()) {
+ return new RwtScoutMobileDateTimeCompositeField();
+ }
+ else {
+ return new RwtScoutDateTimeCompositeField();
+ }
+ }
+
+ @Override
+ protected IRwtScoutDateField createRwtScoutDateField() {
+ if (DeviceUtility.isMobileOrTabletDevice()) {
+ return new RwtScoutMobileDateField();
+ }
+ else {
+ return new RwtScoutDateField();
+ }
+ }
+
+ @Override
+ protected IRwtScoutTimeField createRwtScoutTimeField() {
+ if (DeviceUtility.isMobileOrTabletDevice()) {
+ return new RwtScoutMobileTimeField();
+ }
+ else {
+ return new RwtScoutTimeField();
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/datefield/RwtScoutMobileDateField.java b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/datefield/RwtScoutMobileDateField.java
index 7868191b13..6cf2712d89 100644
--- a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/datefield/RwtScoutMobileDateField.java
+++ b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/datefield/RwtScoutMobileDateField.java
@@ -1,45 +1,45 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.mobile.form.fields.datefield;
-
-import java.util.Date;
-
-import org.eclipse.scout.rt.ui.rap.form.fields.datefield.RwtScoutDateField;
-import org.eclipse.scout.rt.ui.rap.form.fields.datefield.chooser.DateChooserDialog;
-import org.eclipse.scout.rt.ui.rap.mobile.form.fields.datefield.chooser.MobileDateChooserDialog;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * @since 3.9.0
- */
-public class RwtScoutMobileDateField extends RwtScoutDateField {
-
- @Override
- protected DateChooserDialog createDateChooserDialog(Shell parentShell, Date currentDate) {
- return new MobileDateChooserDialog(parentShell, currentDate);
- }
-
- @Override
- protected void setEnabledFromScout(boolean b) {
- super.setEnabledFromScout(b);
-
- // Disable field to avoid the appearance of the keyboard. Choosing a date is only possible with the date picker popup.
- getUiField().setEnabled(false);
- }
-
- @Override
- protected void handleUiFocusLostOnDatePickerPopup(FocusEvent event) {
- // Since the popup hides the ui field it is not necessary to reset the focus
- // It's also not necessary to close the popup on focus lost because the it can be closed with the "x" at the title bar.
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.mobile.form.fields.datefield;
+
+import java.util.Date;
+
+import org.eclipse.scout.rt.ui.rap.form.fields.datefield.RwtScoutDateField;
+import org.eclipse.scout.rt.ui.rap.form.fields.datefield.chooser.DateChooserDialog;
+import org.eclipse.scout.rt.ui.rap.mobile.form.fields.datefield.chooser.MobileDateChooserDialog;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * @since 3.9.0
+ */
+public class RwtScoutMobileDateField extends RwtScoutDateField {
+
+ @Override
+ protected DateChooserDialog createDateChooserDialog(Shell parentShell, Date currentDate) {
+ return new MobileDateChooserDialog(parentShell, currentDate);
+ }
+
+ @Override
+ protected void setEnabledFromScout(boolean b) {
+ super.setEnabledFromScout(b);
+
+ // Disable field to avoid the appearance of the keyboard. Choosing a date is only possible with the date picker popup.
+ getUiField().setEnabled(false);
+ }
+
+ @Override
+ protected void handleUiFocusLostOnDatePickerPopup(FocusEvent event) {
+ // Since the popup hides the ui field it is not necessary to reset the focus
+ // It's also not necessary to close the popup on focus lost because the it can be closed with the "x" at the title bar.
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/datefield/RwtScoutMobileDateTimeCompositeField.java b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/datefield/RwtScoutMobileDateTimeCompositeField.java
index 8d34423a6b..7158496f39 100644
--- a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/datefield/RwtScoutMobileDateTimeCompositeField.java
+++ b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/datefield/RwtScoutMobileDateTimeCompositeField.java
@@ -1,32 +1,32 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.mobile.form.fields.datefield;
-
-import org.eclipse.scout.rt.ui.rap.form.fields.datefield.RwtScoutDateField;
-import org.eclipse.scout.rt.ui.rap.form.fields.datefield.RwtScoutDateTimeCompositeField;
-import org.eclipse.scout.rt.ui.rap.form.fields.datefield.RwtScoutTimeField;
-
-/**
- * @since 3.9.0
- */
-public class RwtScoutMobileDateTimeCompositeField extends RwtScoutDateTimeCompositeField {
-
- @Override
- protected RwtScoutDateField createRwtScoutDateField() {
- return new RwtScoutMobileDateField();
- }
-
- @Override
- protected RwtScoutTimeField createRwtScoutTimeField() {
- return new RwtScoutMobileTimeField();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.mobile.form.fields.datefield;
+
+import org.eclipse.scout.rt.ui.rap.form.fields.datefield.RwtScoutDateField;
+import org.eclipse.scout.rt.ui.rap.form.fields.datefield.RwtScoutDateTimeCompositeField;
+import org.eclipse.scout.rt.ui.rap.form.fields.datefield.RwtScoutTimeField;
+
+/**
+ * @since 3.9.0
+ */
+public class RwtScoutMobileDateTimeCompositeField extends RwtScoutDateTimeCompositeField {
+
+ @Override
+ protected RwtScoutDateField createRwtScoutDateField() {
+ return new RwtScoutMobileDateField();
+ }
+
+ @Override
+ protected RwtScoutTimeField createRwtScoutTimeField() {
+ return new RwtScoutMobileTimeField();
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/datefield/RwtScoutMobileTimeField.java b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/datefield/RwtScoutMobileTimeField.java
index c8ef09e73c..8a873b1287 100644
--- a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/datefield/RwtScoutMobileTimeField.java
+++ b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/datefield/RwtScoutMobileTimeField.java
@@ -1,45 +1,45 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.mobile.form.fields.datefield;
-
-import java.util.Date;
-
-import org.eclipse.scout.rt.ui.rap.form.fields.datefield.RwtScoutTimeField;
-import org.eclipse.scout.rt.ui.rap.form.fields.datefield.chooser.TimeChooserDialog;
-import org.eclipse.scout.rt.ui.rap.mobile.form.fields.datefield.chooser.MobileTimeChooserDialog;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * @since 3.9.0
- */
-public class RwtScoutMobileTimeField extends RwtScoutTimeField {
-
- @Override
- protected TimeChooserDialog createTimeChooserDialog(Shell parentShell, Date currentTime) {
- return new MobileTimeChooserDialog(parentShell, currentTime);
- }
-
- @Override
- protected void setEnabledFromScout(boolean b) {
- super.setEnabledFromScout(b);
-
- // Disable field to avoid the appearance of the keyboard. Choosing a date is only possible with the date picker popup.
- getUiField().setEnabled(false);
- }
-
- @Override
- protected void handleUiFocusLostOnDatePickerPopup(FocusEvent event) {
- // Since the popup hides the ui field it is not necessary to reset the focus
- // It's also not necessary to close the popup on focus lost because the it can be closed with the "x" at the title bar.
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.mobile.form.fields.datefield;
+
+import java.util.Date;
+
+import org.eclipse.scout.rt.ui.rap.form.fields.datefield.RwtScoutTimeField;
+import org.eclipse.scout.rt.ui.rap.form.fields.datefield.chooser.TimeChooserDialog;
+import org.eclipse.scout.rt.ui.rap.mobile.form.fields.datefield.chooser.MobileTimeChooserDialog;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * @since 3.9.0
+ */
+public class RwtScoutMobileTimeField extends RwtScoutTimeField {
+
+ @Override
+ protected TimeChooserDialog createTimeChooserDialog(Shell parentShell, Date currentTime) {
+ return new MobileTimeChooserDialog(parentShell, currentTime);
+ }
+
+ @Override
+ protected void setEnabledFromScout(boolean b) {
+ super.setEnabledFromScout(b);
+
+ // Disable field to avoid the appearance of the keyboard. Choosing a date is only possible with the date picker popup.
+ getUiField().setEnabled(false);
+ }
+
+ @Override
+ protected void handleUiFocusLostOnDatePickerPopup(FocusEvent event) {
+ // Since the popup hides the ui field it is not necessary to reset the focus
+ // It's also not necessary to close the popup on focus lost because the it can be closed with the "x" at the title bar.
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/datefield/chooser/MobileDateChooserDialog.java b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/datefield/chooser/MobileDateChooserDialog.java
index ace4608d49..3c3b7d8839 100644
--- a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/datefield/chooser/MobileDateChooserDialog.java
+++ b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/datefield/chooser/MobileDateChooserDialog.java
@@ -1,76 +1,76 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.mobile.form.fields.datefield.chooser;
-
-import java.util.Date;
-
-import org.eclipse.scout.rt.ui.rap.form.fields.datefield.chooser.DateChooserDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * @since 3.9.0
- */
-public class MobileDateChooserDialog extends DateChooserDialog {
- private static final int DATE_CELL_WIDTH = 38;
- private static final int DATE_CELL_HEIGHT = 33;
- private static final int CONTROL_BUTTON_WIDTH = 30;
- private static final int CONTROL_BUTTON_HEIGHT = 30;
-
- private static final long serialVersionUID = 1L;
-
- public MobileDateChooserDialog(Shell parentShell, Date date) {
- super(parentShell, date);
- }
-
- @Override
- protected int getShellStyle() {
- return SWT.APPLICATION_MODAL | SWT.CLOSE;
- }
-
- /**
- * Position the popup in the center of the parent shell
- */
- @Override
- protected Point getLocation(Control field) {
- Rectangle parentShellBounds = getParentShell().getBounds();
- Point dialogSize = getShell().getSize();
-
- int x = parentShellBounds.x + (parentShellBounds.width - dialogSize.x) / 2;
- int y = parentShellBounds.y + (parentShellBounds.height - dialogSize.y) / 2;
-
- return new Point(x, y);
- }
-
- @Override
- protected int getDateCellHeight() {
- return DATE_CELL_HEIGHT;
- }
-
- @Override
- protected int getDateCellWidth() {
- return DATE_CELL_WIDTH;
- }
-
- @Override
- protected int getControlButtonHeight() {
- return CONTROL_BUTTON_HEIGHT;
- }
-
- @Override
- protected int getControlButtonWidth() {
- return CONTROL_BUTTON_WIDTH;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.mobile.form.fields.datefield.chooser;
+
+import java.util.Date;
+
+import org.eclipse.scout.rt.ui.rap.form.fields.datefield.chooser.DateChooserDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * @since 3.9.0
+ */
+public class MobileDateChooserDialog extends DateChooserDialog {
+ private static final int DATE_CELL_WIDTH = 38;
+ private static final int DATE_CELL_HEIGHT = 33;
+ private static final int CONTROL_BUTTON_WIDTH = 30;
+ private static final int CONTROL_BUTTON_HEIGHT = 30;
+
+ private static final long serialVersionUID = 1L;
+
+ public MobileDateChooserDialog(Shell parentShell, Date date) {
+ super(parentShell, date);
+ }
+
+ @Override
+ protected int getShellStyle() {
+ return SWT.APPLICATION_MODAL | SWT.CLOSE;
+ }
+
+ /**
+ * Position the popup in the center of the parent shell
+ */
+ @Override
+ protected Point getLocation(Control field) {
+ Rectangle parentShellBounds = getParentShell().getBounds();
+ Point dialogSize = getShell().getSize();
+
+ int x = parentShellBounds.x + (parentShellBounds.width - dialogSize.x) / 2;
+ int y = parentShellBounds.y + (parentShellBounds.height - dialogSize.y) / 2;
+
+ return new Point(x, y);
+ }
+
+ @Override
+ protected int getDateCellHeight() {
+ return DATE_CELL_HEIGHT;
+ }
+
+ @Override
+ protected int getDateCellWidth() {
+ return DATE_CELL_WIDTH;
+ }
+
+ @Override
+ protected int getControlButtonHeight() {
+ return CONTROL_BUTTON_HEIGHT;
+ }
+
+ @Override
+ protected int getControlButtonWidth() {
+ return CONTROL_BUTTON_WIDTH;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/datefield/chooser/MobileTimeChooser.java b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/datefield/chooser/MobileTimeChooser.java
index 4443d788cd..d08bbc7562 100644
--- a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/datefield/chooser/MobileTimeChooser.java
+++ b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/datefield/chooser/MobileTimeChooser.java
@@ -1,31 +1,31 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.mobile.form.fields.datefield.chooser;
-
-import org.eclipse.scout.rt.ui.rap.form.fields.datefield.chooser.TimeChooser;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * @since 3.9.0
- */
-public class MobileTimeChooser extends TimeChooser {
- private static final int TABLE_CELL_HEIGHT = 30;
-
- public MobileTimeChooser(Composite parent) {
- super(parent);
- }
-
- @Override
- protected int getTableCellHeight() {
- return TABLE_CELL_HEIGHT;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.mobile.form.fields.datefield.chooser;
+
+import org.eclipse.scout.rt.ui.rap.form.fields.datefield.chooser.TimeChooser;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * @since 3.9.0
+ */
+public class MobileTimeChooser extends TimeChooser {
+ private static final int TABLE_CELL_HEIGHT = 30;
+
+ public MobileTimeChooser(Composite parent) {
+ super(parent);
+ }
+
+ @Override
+ protected int getTableCellHeight() {
+ return TABLE_CELL_HEIGHT;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/datefield/chooser/MobileTimeChooserDialog.java b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/datefield/chooser/MobileTimeChooserDialog.java
index b4a39815c8..e3f6425993 100644
--- a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/datefield/chooser/MobileTimeChooserDialog.java
+++ b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/datefield/chooser/MobileTimeChooserDialog.java
@@ -1,59 +1,59 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.mobile.form.fields.datefield.chooser;
-
-import java.util.Date;
-
-import org.eclipse.scout.rt.ui.rap.form.fields.datefield.chooser.TimeChooser;
-import org.eclipse.scout.rt.ui.rap.form.fields.datefield.chooser.TimeChooserDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * @since 3.9.0
- */
-public class MobileTimeChooserDialog extends TimeChooserDialog {
-
- private static final long serialVersionUID = 1L;
-
- public MobileTimeChooserDialog(Shell parentShell, Date date) {
- super(parentShell, date);
- }
-
- @Override
- protected int getShellStyle() {
- return SWT.APPLICATION_MODAL | SWT.CLOSE;
- }
-
- /**
- * Position the popup in the center of the parent shell
- */
- @Override
- protected Point getLocation(Control field) {
- Rectangle parentShellBounds = getParentShell().getBounds();
- Point dialogSize = getShell().getSize();
-
- int x = parentShellBounds.x + (parentShellBounds.width - dialogSize.x) / 2;
- int y = parentShellBounds.y + (parentShellBounds.height - dialogSize.y) / 2;
-
- return new Point(x, y);
- }
-
- @Override
- protected TimeChooser createTimeChooser(Composite parent) {
- return new MobileTimeChooser(parent);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.mobile.form.fields.datefield.chooser;
+
+import java.util.Date;
+
+import org.eclipse.scout.rt.ui.rap.form.fields.datefield.chooser.TimeChooser;
+import org.eclipse.scout.rt.ui.rap.form.fields.datefield.chooser.TimeChooserDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * @since 3.9.0
+ */
+public class MobileTimeChooserDialog extends TimeChooserDialog {
+
+ private static final long serialVersionUID = 1L;
+
+ public MobileTimeChooserDialog(Shell parentShell, Date date) {
+ super(parentShell, date);
+ }
+
+ @Override
+ protected int getShellStyle() {
+ return SWT.APPLICATION_MODAL | SWT.CLOSE;
+ }
+
+ /**
+ * Position the popup in the center of the parent shell
+ */
+ @Override
+ protected Point getLocation(Control field) {
+ Rectangle parentShellBounds = getParentShell().getBounds();
+ Point dialogSize = getShell().getSize();
+
+ int x = parentShellBounds.x + (parentShellBounds.width - dialogSize.x) / 2;
+ int y = parentShellBounds.y + (parentShellBounds.height - dialogSize.y) / 2;
+
+ return new Point(x, y);
+ }
+
+ @Override
+ protected TimeChooser createTimeChooser(Composite parent) {
+ return new MobileTimeChooser(parent);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/groupbox/MobileGroupBoxFieldFactory.java b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/groupbox/MobileGroupBoxFieldFactory.java
index 0737ed0a11..a25e2b429a 100644
--- a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/groupbox/MobileGroupBoxFieldFactory.java
+++ b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/groupbox/MobileGroupBoxFieldFactory.java
@@ -1,45 +1,45 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.mobile.form.fields.groupbox;
-
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox;
-import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
-import org.eclipse.scout.rt.ui.rap.extension.IFormFieldFactory;
-import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
-import org.eclipse.scout.rt.ui.rap.form.fields.groupbox.IRwtScoutGroupBox;
-import org.eclipse.scout.rt.ui.rap.form.fields.groupbox.RwtScoutGroupBox;
-import org.eclipse.scout.rt.ui.rap.util.DeviceUtility;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * @since 3.9.0
- */
-public class MobileGroupBoxFieldFactory implements IFormFieldFactory {
-
- @Override
- public IRwtScoutFormField<?> createUiFormField(Composite parent, IFormField model, IRwtEnvironment uiEnvironment) {
- IRwtScoutGroupBox field;
-
- if (DeviceUtility.isMobileOrTabletDevice()) {
- field = new RwtScoutMobileGroupBox();
- }
- else {
- field = new RwtScoutGroupBox();
- }
-
- IGroupBox groupBox = (IGroupBox) model;
- field.createUiField(parent, groupBox, uiEnvironment);
-
- return field;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.mobile.form.fields.groupbox;
+
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox;
+import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
+import org.eclipse.scout.rt.ui.rap.extension.IFormFieldFactory;
+import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
+import org.eclipse.scout.rt.ui.rap.form.fields.groupbox.IRwtScoutGroupBox;
+import org.eclipse.scout.rt.ui.rap.form.fields.groupbox.RwtScoutGroupBox;
+import org.eclipse.scout.rt.ui.rap.util.DeviceUtility;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * @since 3.9.0
+ */
+public class MobileGroupBoxFieldFactory implements IFormFieldFactory {
+
+ @Override
+ public IRwtScoutFormField<?> createUiFormField(Composite parent, IFormField model, IRwtEnvironment uiEnvironment) {
+ IRwtScoutGroupBox field;
+
+ if (DeviceUtility.isMobileOrTabletDevice()) {
+ field = new RwtScoutMobileGroupBox();
+ }
+ else {
+ field = new RwtScoutGroupBox();
+ }
+
+ IGroupBox groupBox = (IGroupBox) model;
+ field.createUiField(parent, groupBox, uiEnvironment);
+
+ return field;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/groupbox/RwtScoutMobileGroupBox.java b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/groupbox/RwtScoutMobileGroupBox.java
index d13146cce3..d7c2f5fdee 100644
--- a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/groupbox/RwtScoutMobileGroupBox.java
+++ b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/groupbox/RwtScoutMobileGroupBox.java
@@ -1,30 +1,30 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.mobile.form.fields.groupbox;
-
-import org.eclipse.scout.rt.ui.rap.form.fields.groupbox.RwtScoutGroupBox;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * @since 3.9.0
- */
-public class RwtScoutMobileGroupBox extends RwtScoutGroupBox {
-
- @Override
- protected Composite createButtonbar(Composite parent) {
- if (getScoutObject().getForm().getRootGroupBox() == getScoutObject()) {
- //Button bar of the main box must not be visible
- return null;
- }
-
- return super.createButtonbar(parent);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.mobile.form.fields.groupbox;
+
+import org.eclipse.scout.rt.ui.rap.form.fields.groupbox.RwtScoutGroupBox;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * @since 3.9.0
+ */
+public class RwtScoutMobileGroupBox extends RwtScoutGroupBox {
+
+ @Override
+ protected Composite createButtonbar(Composite parent) {
+ if (getScoutObject().getForm().getRootGroupBox() == getScoutObject()) {
+ //Button bar of the main box must not be visible
+ return null;
+ }
+
+ return super.createButtonbar(parent);
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/smartfield/MobileSmartFieldFactory.java b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/smartfield/MobileSmartFieldFactory.java
index 9916ddf602..7e2b06082a 100644
--- a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/smartfield/MobileSmartFieldFactory.java
+++ b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/smartfield/MobileSmartFieldFactory.java
@@ -1,45 +1,45 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.mobile.form.fields.smartfield;
-
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.smartfield.ISmartField;
-import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
-import org.eclipse.scout.rt.ui.rap.extension.IFormFieldFactory;
-import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
-import org.eclipse.scout.rt.ui.rap.form.fields.smartfield.IRwtScoutSmartField;
-import org.eclipse.scout.rt.ui.rap.form.fields.smartfield.RwtScoutSmartField;
-import org.eclipse.scout.rt.ui.rap.util.DeviceUtility;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * @since 3.9.0
- */
-public class MobileSmartFieldFactory implements IFormFieldFactory {
-
- @Override
- public IRwtScoutFormField<?> createUiFormField(Composite parent, IFormField model, IRwtEnvironment uiEnvironment) {
- IRwtScoutSmartField field;
-
- if (DeviceUtility.isMobileOrTabletDevice()) {
- field = new RwtScoutMobileSmartField();
- }
- else {
- field = new RwtScoutSmartField();
- }
-
- ISmartField<?> formField = (ISmartField) model;
- field.createUiField(parent, formField, uiEnvironment);
-
- return field;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.mobile.form.fields.smartfield;
+
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.smartfield.ISmartField;
+import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
+import org.eclipse.scout.rt.ui.rap.extension.IFormFieldFactory;
+import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
+import org.eclipse.scout.rt.ui.rap.form.fields.smartfield.IRwtScoutSmartField;
+import org.eclipse.scout.rt.ui.rap.form.fields.smartfield.RwtScoutSmartField;
+import org.eclipse.scout.rt.ui.rap.util.DeviceUtility;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * @since 3.9.0
+ */
+public class MobileSmartFieldFactory implements IFormFieldFactory {
+
+ @Override
+ public IRwtScoutFormField<?> createUiFormField(Composite parent, IFormField model, IRwtEnvironment uiEnvironment) {
+ IRwtScoutSmartField field;
+
+ if (DeviceUtility.isMobileOrTabletDevice()) {
+ field = new RwtScoutMobileSmartField();
+ }
+ else {
+ field = new RwtScoutSmartField();
+ }
+
+ ISmartField<?> formField = (ISmartField) model;
+ field.createUiField(parent, formField, uiEnvironment);
+
+ return field;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/smartfield/RwtScoutMobileSmartField.java b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/smartfield/RwtScoutMobileSmartField.java
index 7889ac47d4..b8793775bd 100644
--- a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/smartfield/RwtScoutMobileSmartField.java
+++ b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/smartfield/RwtScoutMobileSmartField.java
@@ -1,170 +1,170 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.mobile.form.fields.smartfield;
-
-import org.eclipse.rwt.lifecycle.WidgetUtil;
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.mobile.ui.form.fields.smartfield.MobileSmartFieldProposalFormProvider;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.smartfield.ISmartField;
-import org.eclipse.scout.rt.ui.rap.LogicalGridLayout;
-import org.eclipse.scout.rt.ui.rap.ext.StatusLabelEx;
-import org.eclipse.scout.rt.ui.rap.ext.StyledTextEx;
-import org.eclipse.scout.rt.ui.rap.ext.custom.StyledText;
-import org.eclipse.scout.rt.ui.rap.form.fields.LogicalGridDataBuilder;
-import org.eclipse.scout.rt.ui.rap.form.fields.RwtScoutValueFieldComposite;
-import org.eclipse.scout.rt.ui.rap.form.fields.smartfield.IRwtScoutSmartField;
-import org.eclipse.scout.rt.ui.rap.util.RwtLayoutUtility;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-
-public class RwtScoutMobileSmartField extends RwtScoutValueFieldComposite<ISmartField<?>> implements IRwtScoutSmartField {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(RwtScoutMobileSmartField.class);
-
- private Composite m_browseIconContainer;
- private Composite m_smartContainer;
-
- public RwtScoutMobileSmartField() {
- }
-
- @Override
- protected void initializeUi(Composite parent) {
- Composite container = getUiEnvironment().getFormToolkit().createComposite(parent);
- StatusLabelEx label = getUiEnvironment().getFormToolkit().createStatusLabel(container, getScoutObject());
-
- m_smartContainer = getUiEnvironment().getFormToolkit().createComposite(container, SWT.BORDER);
- m_smartContainer.setData(WidgetUtil.CUSTOM_VARIANT, getSmartfieldVariant());
-
- StyledText textField = new StyledTextEx(m_smartContainer, SWT.SINGLE);
- getUiEnvironment().getFormToolkit().adapt(textField, false, false);
-
- // correction to look like a normal text
- textField.setData(WidgetUtil.CUSTOM_VARIANT, getSmartfieldVariant());
-
- m_browseIconContainer = getUiEnvironment().getFormToolkit().createComposite(m_smartContainer);
-
- setUiContainer(container);
- setUiLabel(label);
- setUiField(textField);
-
- // layout
- container.setLayout(new LogicalGridLayout(1, 0));
-
- // m_browseIconContainer and m_browseIconContainer are only necessary to position the icon at the right of the field
- // If Bug 361799 gets fixed this could be replaced by background-position and background-repeat
- m_smartContainer.setLayoutData(LogicalGridDataBuilder.createField(((IFormField) getScoutObject()).getGridData()));
- m_smartContainer.setLayout(RwtLayoutUtility.createGridLayoutNoSpacing(2, false));
-
- GridData textLayoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
- textField.setLayoutData(textLayoutData);
-
- GridData buttonLayoutData = new GridData(SWT.CENTER, SWT.CENTER, false, false);
- buttonLayoutData.heightHint = 20;
- buttonLayoutData.widthHint = 20;
- m_browseIconContainer.setLayoutData(buttonLayoutData);
-
- textField.addMouseListener(new P_FieldSelectionListener());
- m_browseIconContainer.addMouseListener(new P_FieldSelectionListener());
- m_smartContainer.addMouseListener(new P_FieldSelectionListener());
- }
-
- protected String getSmartfieldVariant() {
- return VARIANT_SMARTFIELD;
- }
-
- protected String getSmartfieldDisabledVariant() {
- return VARIANT_SMARTFIELD_DISABLED;
- }
-
- @Override
- public StyledText getUiField() {
- return (StyledText) super.getUiField();
- }
-
- @Override
- protected void attachScout() {
- super.attachScout();
-
- setIconIdFromScout(getScoutObject().getIconId());
- getScoutObject().setProposalFormProvider(new MobileSmartFieldProposalFormProvider());
- }
-
- @Override
- protected void setDisplayTextFromScout(String s) {
- if (!CompareUtility.equals(s, getUiField().getText())) {
- if (s == null) {
- s = "";
- }
- StyledText field = getUiField();
- field.setText(s);
- }
- }
-
- @Override
- protected void setEnabledFromScout(boolean b) {
- super.setEnabledFromScout(b);
-
- getUiField().setEnabled(false);
-
- if (b) {
- m_smartContainer.setData(WidgetUtil.CUSTOM_VARIANT, getSmartfieldVariant());
- }
- else {
- m_smartContainer.setData(WidgetUtil.CUSTOM_VARIANT, getSmartfieldDisabledVariant());
- }
- }
-
- protected void setIconIdFromScout(String s) {
- m_browseIconContainer.setData(WidgetUtil.CUSTOM_VARIANT, s);
- }
-
- @Override
- protected void setBackgroundFromScout(String scoutColor) {
- setBackgroundFromScout(scoutColor, m_smartContainer);
- }
-
- @Override
- protected void handleScoutPropertyChange(String name, Object newValue) {
- super.handleScoutPropertyChange(name, newValue);
- if (name.equals(ISmartField.PROP_ICON_ID)) {
- setIconIdFromScout((String) newValue);
- }
- }
-
- protected void requestProposalSupportFromUi(final String text, final boolean selectCurrentValue) {
- Runnable t = new Runnable() {
- @Override
- public void run() {
- getScoutObject().getUIFacade().openProposalFromUI(text, selectCurrentValue);
- }
- };
- getUiEnvironment().invokeScoutLater(t, 0);
- }
-
- private class P_FieldSelectionListener extends MouseAdapter {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void mouseUp(MouseEvent e) {
- if (!getScoutObject().isEnabled()) {
- return;
- }
-
- requestProposalSupportFromUi(ISmartField.BROWSE_ALL_TEXT, true);
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.mobile.form.fields.smartfield;
+
+import org.eclipse.rwt.lifecycle.WidgetUtil;
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.mobile.ui.form.fields.smartfield.MobileSmartFieldProposalFormProvider;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.smartfield.ISmartField;
+import org.eclipse.scout.rt.ui.rap.LogicalGridLayout;
+import org.eclipse.scout.rt.ui.rap.ext.StatusLabelEx;
+import org.eclipse.scout.rt.ui.rap.ext.StyledTextEx;
+import org.eclipse.scout.rt.ui.rap.ext.custom.StyledText;
+import org.eclipse.scout.rt.ui.rap.form.fields.LogicalGridDataBuilder;
+import org.eclipse.scout.rt.ui.rap.form.fields.RwtScoutValueFieldComposite;
+import org.eclipse.scout.rt.ui.rap.form.fields.smartfield.IRwtScoutSmartField;
+import org.eclipse.scout.rt.ui.rap.util.RwtLayoutUtility;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+
+public class RwtScoutMobileSmartField extends RwtScoutValueFieldComposite<ISmartField<?>> implements IRwtScoutSmartField {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(RwtScoutMobileSmartField.class);
+
+ private Composite m_browseIconContainer;
+ private Composite m_smartContainer;
+
+ public RwtScoutMobileSmartField() {
+ }
+
+ @Override
+ protected void initializeUi(Composite parent) {
+ Composite container = getUiEnvironment().getFormToolkit().createComposite(parent);
+ StatusLabelEx label = getUiEnvironment().getFormToolkit().createStatusLabel(container, getScoutObject());
+
+ m_smartContainer = getUiEnvironment().getFormToolkit().createComposite(container, SWT.BORDER);
+ m_smartContainer.setData(WidgetUtil.CUSTOM_VARIANT, getSmartfieldVariant());
+
+ StyledText textField = new StyledTextEx(m_smartContainer, SWT.SINGLE);
+ getUiEnvironment().getFormToolkit().adapt(textField, false, false);
+
+ // correction to look like a normal text
+ textField.setData(WidgetUtil.CUSTOM_VARIANT, getSmartfieldVariant());
+
+ m_browseIconContainer = getUiEnvironment().getFormToolkit().createComposite(m_smartContainer);
+
+ setUiContainer(container);
+ setUiLabel(label);
+ setUiField(textField);
+
+ // layout
+ container.setLayout(new LogicalGridLayout(1, 0));
+
+ // m_browseIconContainer and m_browseIconContainer are only necessary to position the icon at the right of the field
+ // If Bug 361799 gets fixed this could be replaced by background-position and background-repeat
+ m_smartContainer.setLayoutData(LogicalGridDataBuilder.createField(((IFormField) getScoutObject()).getGridData()));
+ m_smartContainer.setLayout(RwtLayoutUtility.createGridLayoutNoSpacing(2, false));
+
+ GridData textLayoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
+ textField.setLayoutData(textLayoutData);
+
+ GridData buttonLayoutData = new GridData(SWT.CENTER, SWT.CENTER, false, false);
+ buttonLayoutData.heightHint = 20;
+ buttonLayoutData.widthHint = 20;
+ m_browseIconContainer.setLayoutData(buttonLayoutData);
+
+ textField.addMouseListener(new P_FieldSelectionListener());
+ m_browseIconContainer.addMouseListener(new P_FieldSelectionListener());
+ m_smartContainer.addMouseListener(new P_FieldSelectionListener());
+ }
+
+ protected String getSmartfieldVariant() {
+ return VARIANT_SMARTFIELD;
+ }
+
+ protected String getSmartfieldDisabledVariant() {
+ return VARIANT_SMARTFIELD_DISABLED;
+ }
+
+ @Override
+ public StyledText getUiField() {
+ return (StyledText) super.getUiField();
+ }
+
+ @Override
+ protected void attachScout() {
+ super.attachScout();
+
+ setIconIdFromScout(getScoutObject().getIconId());
+ getScoutObject().setProposalFormProvider(new MobileSmartFieldProposalFormProvider());
+ }
+
+ @Override
+ protected void setDisplayTextFromScout(String s) {
+ if (!CompareUtility.equals(s, getUiField().getText())) {
+ if (s == null) {
+ s = "";
+ }
+ StyledText field = getUiField();
+ field.setText(s);
+ }
+ }
+
+ @Override
+ protected void setEnabledFromScout(boolean b) {
+ super.setEnabledFromScout(b);
+
+ getUiField().setEnabled(false);
+
+ if (b) {
+ m_smartContainer.setData(WidgetUtil.CUSTOM_VARIANT, getSmartfieldVariant());
+ }
+ else {
+ m_smartContainer.setData(WidgetUtil.CUSTOM_VARIANT, getSmartfieldDisabledVariant());
+ }
+ }
+
+ protected void setIconIdFromScout(String s) {
+ m_browseIconContainer.setData(WidgetUtil.CUSTOM_VARIANT, s);
+ }
+
+ @Override
+ protected void setBackgroundFromScout(String scoutColor) {
+ setBackgroundFromScout(scoutColor, m_smartContainer);
+ }
+
+ @Override
+ protected void handleScoutPropertyChange(String name, Object newValue) {
+ super.handleScoutPropertyChange(name, newValue);
+ if (name.equals(ISmartField.PROP_ICON_ID)) {
+ setIconIdFromScout((String) newValue);
+ }
+ }
+
+ protected void requestProposalSupportFromUi(final String text, final boolean selectCurrentValue) {
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ getScoutObject().getUIFacade().openProposalFromUI(text, selectCurrentValue);
+ }
+ };
+ getUiEnvironment().invokeScoutLater(t, 0);
+ }
+
+ private class P_FieldSelectionListener extends MouseAdapter {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void mouseUp(MouseEvent e) {
+ if (!getScoutObject().isEnabled()) {
+ return;
+ }
+
+ requestProposalSupportFromUi(ISmartField.BROWSE_ALL_TEXT, true);
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/tabbox/MobileTabBoxFactory.java b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/tabbox/MobileTabBoxFactory.java
index 4648eadec9..90c11906e8 100644
--- a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/tabbox/MobileTabBoxFactory.java
+++ b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/tabbox/MobileTabBoxFactory.java
@@ -1,78 +1,78 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.mobile.form.fields.tabbox;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.scout.commons.holders.BooleanHolder;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.mobile.transformation.IDeviceTransformationService;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.tabbox.ITabBox;
-import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
-import org.eclipse.scout.rt.ui.rap.extension.IFormFieldFactory;
-import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
-import org.eclipse.scout.rt.ui.rap.form.fields.tabbox.IRwtScoutTabBox;
-import org.eclipse.scout.rt.ui.rap.form.fields.tabbox.RwtScoutTabBox;
-import org.eclipse.scout.rt.ui.rap.util.DeviceUtility;
-import org.eclipse.scout.service.SERVICES;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * @since 3.9.0
- */
-public class MobileTabBoxFactory implements IFormFieldFactory {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(MobileTabBoxFactory.class);
-
- private IRwtEnvironment m_uiEnvironment;
-
- @Override
- public IRwtScoutFormField<?> createUiFormField(Composite parent, IFormField model, IRwtEnvironment uiEnvironment) {
- m_uiEnvironment = uiEnvironment;
- IRwtScoutTabBox field;
- ITabBox formField = (ITabBox) model;
-
- if (DeviceUtility.isMobileOrTabletDevice() && acceptMobileTabBoxTransformation(formField)) {
- field = new RwtScoutMobileTabBox();
- }
- else {
- field = new RwtScoutTabBox();
- }
-
- field.createUiField(parent, formField, uiEnvironment);
-
- return field;
- }
-
- private boolean acceptMobileTabBoxTransformation(final ITabBox tabBox) {
- final BooleanHolder accepted = new BooleanHolder(false);
- ClientSyncJob job = new ClientSyncJob("Getting permission to create mobile tabbox.", m_uiEnvironment.getClientSession()) {
-
- @Override
- protected void runVoid(IProgressMonitor monitor) throws Throwable {
- accepted.setValue(SERVICES.getService(IDeviceTransformationService.class).getDeviceTransformer().acceptMobileTabBoxTransformation(tabBox));
- }
-
- };
- job.schedule();
- try {
- job.join(5000);
- }
- catch (InterruptedException e) {
- LOG.warn("Failed to getting permission to create mobile tabbox.", e);
- }
-
- return accepted.getValue();
-
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.mobile.form.fields.tabbox;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.scout.commons.holders.BooleanHolder;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.mobile.transformation.IDeviceTransformationService;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.tabbox.ITabBox;
+import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
+import org.eclipse.scout.rt.ui.rap.extension.IFormFieldFactory;
+import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
+import org.eclipse.scout.rt.ui.rap.form.fields.tabbox.IRwtScoutTabBox;
+import org.eclipse.scout.rt.ui.rap.form.fields.tabbox.RwtScoutTabBox;
+import org.eclipse.scout.rt.ui.rap.util.DeviceUtility;
+import org.eclipse.scout.service.SERVICES;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * @since 3.9.0
+ */
+public class MobileTabBoxFactory implements IFormFieldFactory {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(MobileTabBoxFactory.class);
+
+ private IRwtEnvironment m_uiEnvironment;
+
+ @Override
+ public IRwtScoutFormField<?> createUiFormField(Composite parent, IFormField model, IRwtEnvironment uiEnvironment) {
+ m_uiEnvironment = uiEnvironment;
+ IRwtScoutTabBox field;
+ ITabBox formField = (ITabBox) model;
+
+ if (DeviceUtility.isMobileOrTabletDevice() && acceptMobileTabBoxTransformation(formField)) {
+ field = new RwtScoutMobileTabBox();
+ }
+ else {
+ field = new RwtScoutTabBox();
+ }
+
+ field.createUiField(parent, formField, uiEnvironment);
+
+ return field;
+ }
+
+ private boolean acceptMobileTabBoxTransformation(final ITabBox tabBox) {
+ final BooleanHolder accepted = new BooleanHolder(false);
+ ClientSyncJob job = new ClientSyncJob("Getting permission to create mobile tabbox.", m_uiEnvironment.getClientSession()) {
+
+ @Override
+ protected void runVoid(IProgressMonitor monitor) throws Throwable {
+ accepted.setValue(SERVICES.getService(IDeviceTransformationService.class).getDeviceTransformer().acceptMobileTabBoxTransformation(tabBox));
+ }
+
+ };
+ job.schedule();
+ try {
+ job.join(5000);
+ }
+ catch (InterruptedException e) {
+ LOG.warn("Failed to getting permission to create mobile tabbox.", e);
+ }
+
+ return accepted.getValue();
+
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/tabbox/RwtScoutMobileTabBox.java b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/tabbox/RwtScoutMobileTabBox.java
index d17d37ac1a..a56c89e3de 100644
--- a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/tabbox/RwtScoutMobileTabBox.java
+++ b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/tabbox/RwtScoutMobileTabBox.java
@@ -1,73 +1,73 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.mobile.form.fields.tabbox;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.scout.commons.holders.Holder;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.mobile.ui.form.fields.tabbox.TabBoxGroupBox;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox;
-import org.eclipse.scout.rt.client.ui.form.fields.tabbox.ITabBox;
-import org.eclipse.scout.rt.ui.rap.LogicalGridLayout;
-import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
-import org.eclipse.scout.rt.ui.rap.form.fields.RwtScoutFieldComposite;
-import org.eclipse.scout.rt.ui.rap.form.fields.tabbox.IRwtScoutTabBox;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-
-public class RwtScoutMobileTabBox extends RwtScoutFieldComposite<ITabBox> implements IRwtScoutTabBox {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(RwtScoutMobileTabBox.class);
-
- @Override
- protected void initializeUi(Composite parent) {
- Composite container = getUiEnvironment().getFormToolkit().createComposite(parent, SWT.TOP);
- container.setLayout(new LogicalGridLayout(0, 0));
-
- IGroupBox groupBox = wrapTabBox();
- IRwtScoutFormField group = getUiEnvironment().createFormField(container, groupBox);
-
- setUiLabel(null);
- setUiField(group.getUiContainer());
- setUiContainer(container);
- }
-
- private IGroupBox wrapTabBox() {
- final Holder<IGroupBox> holder = new Holder<IGroupBox>(IGroupBox.class);
-
- ClientSyncJob job = new ClientSyncJob("", getUiEnvironment().getClientSession()) {
- @Override
- protected void runVoid(IProgressMonitor monitor) throws Throwable {
- TabBoxGroupBox groupBox = new TabBoxGroupBox(getScoutObject());
- groupBox.initField();
-
- holder.setValue(groupBox);
- }
- };
-
- job.schedule();
- try {
- job.join();
- }
- catch (InterruptedException e) {
- LOG.error("TabBox wrapping interrupted. ", e);
- }
-
- return holder.getValue();
- }
-
- @Override
- protected void setEnabledFromScout(boolean b) {
- // void here
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.mobile.form.fields.tabbox;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.scout.commons.holders.Holder;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.mobile.ui.form.fields.tabbox.TabBoxGroupBox;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox;
+import org.eclipse.scout.rt.client.ui.form.fields.tabbox.ITabBox;
+import org.eclipse.scout.rt.ui.rap.LogicalGridLayout;
+import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
+import org.eclipse.scout.rt.ui.rap.form.fields.RwtScoutFieldComposite;
+import org.eclipse.scout.rt.ui.rap.form.fields.tabbox.IRwtScoutTabBox;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+
+public class RwtScoutMobileTabBox extends RwtScoutFieldComposite<ITabBox> implements IRwtScoutTabBox {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(RwtScoutMobileTabBox.class);
+
+ @Override
+ protected void initializeUi(Composite parent) {
+ Composite container = getUiEnvironment().getFormToolkit().createComposite(parent, SWT.TOP);
+ container.setLayout(new LogicalGridLayout(0, 0));
+
+ IGroupBox groupBox = wrapTabBox();
+ IRwtScoutFormField group = getUiEnvironment().createFormField(container, groupBox);
+
+ setUiLabel(null);
+ setUiField(group.getUiContainer());
+ setUiContainer(container);
+ }
+
+ private IGroupBox wrapTabBox() {
+ final Holder<IGroupBox> holder = new Holder<IGroupBox>(IGroupBox.class);
+
+ ClientSyncJob job = new ClientSyncJob("", getUiEnvironment().getClientSession()) {
+ @Override
+ protected void runVoid(IProgressMonitor monitor) throws Throwable {
+ TabBoxGroupBox groupBox = new TabBoxGroupBox(getScoutObject());
+ groupBox.initField();
+
+ holder.setValue(groupBox);
+ }
+ };
+
+ job.schedule();
+ try {
+ job.join();
+ }
+ catch (InterruptedException e) {
+ LOG.error("TabBox wrapping interrupted. ", e);
+ }
+
+ return holder.getValue();
+ }
+
+ @Override
+ protected void setEnabledFromScout(boolean b) {
+ // void here
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/tablefield/IRwtScoutList.java b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/tablefield/IRwtScoutList.java
index 63ddcd230d..138b431918 100644
--- a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/tablefield/IRwtScoutList.java
+++ b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/tablefield/IRwtScoutList.java
@@ -1,21 +1,21 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.mobile.form.fields.tablefield;
-
-import org.eclipse.jface.viewers.ListViewer;
-import org.eclipse.scout.rt.ui.rap.basic.table.IRwtScoutTable;
-
-public interface IRwtScoutList extends IRwtScoutTable {
-
- @Override
- ListViewer getUiTableViewer();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.mobile.form.fields.tablefield;
+
+import org.eclipse.jface.viewers.ListViewer;
+import org.eclipse.scout.rt.ui.rap.basic.table.IRwtScoutTable;
+
+public interface IRwtScoutList extends IRwtScoutTable {
+
+ @Override
+ ListViewer getUiTableViewer();
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/tablefield/IRwtScoutListModel.java b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/tablefield/IRwtScoutListModel.java
index 079dcc4e4d..e61d4faf35 100644
--- a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/tablefield/IRwtScoutListModel.java
+++ b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/tablefield/IRwtScoutListModel.java
@@ -1,26 +1,26 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.mobile.form.fields.tablefield;
-
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.scout.rt.ui.rap.basic.table.RwtScoutTableEvent;
-
-public interface IRwtScoutListModel extends IStructuredContentProvider, ILabelProvider {
-
- void setMultiline(boolean multiline);
-
- boolean isMultiline();
-
- void consumeTableModelEvent(RwtScoutTableEvent uiTableEvent);
-
- IRwtScoutList getRwtScoutList();
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.mobile.form.fields.tablefield;
+
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.scout.rt.ui.rap.basic.table.RwtScoutTableEvent;
+
+public interface IRwtScoutListModel extends IStructuredContentProvider, ILabelProvider {
+
+ void setMultiline(boolean multiline);
+
+ boolean isMultiline();
+
+ void consumeTableModelEvent(RwtScoutTableEvent uiTableEvent);
+
+ IRwtScoutList getRwtScoutList();
+}
diff --git a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/tablefield/ListEx.java b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/tablefield/ListEx.java
index 74841796e7..6bca648739 100644
--- a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/tablefield/ListEx.java
+++ b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/tablefield/ListEx.java
@@ -1,49 +1,49 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.mobile.form.fields.tablefield;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.List;
-
-public class ListEx extends List {
-
- private static final long serialVersionUID = 1L;
-
- public ListEx(Composite parent, int style) {
- super(parent, style);
- }
-
- @SuppressWarnings("null")
- public String getItem(Point point) {
- checkWidget();
- if (point == null) {
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
- }
- String result = null;
- Rectangle itemArea = getClientArea();
- if (itemArea.contains(point)) {
- int itemHeight = getItemHeight();
- int index = (point.y / itemHeight) - 1;
- if (point.y % itemHeight != 0) {
- index++;
- }
- index += getTopIndex();
- if (index >= 0 && index < getItemCount()) {
- result = getItem(index);
- }
- }
- return result;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.mobile.form.fields.tablefield;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.List;
+
+public class ListEx extends List {
+
+ private static final long serialVersionUID = 1L;
+
+ public ListEx(Composite parent, int style) {
+ super(parent, style);
+ }
+
+ @SuppressWarnings("null")
+ public String getItem(Point point) {
+ checkWidget();
+ if (point == null) {
+ SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ }
+ String result = null;
+ Rectangle itemArea = getClientArea();
+ if (itemArea.contains(point)) {
+ int itemHeight = getItemHeight();
+ int index = (point.y / itemHeight) - 1;
+ if (point.y % itemHeight != 0) {
+ index++;
+ }
+ index += getTopIndex();
+ if (index >= 0 && index < getItemCount()) {
+ result = getItem(index);
+ }
+ }
+ return result;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/tablefield/MobileTableFieldFactory.java b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/tablefield/MobileTableFieldFactory.java
index 019843f7fe..1a081e81ae 100644
--- a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/tablefield/MobileTableFieldFactory.java
+++ b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/tablefield/MobileTableFieldFactory.java
@@ -1,45 +1,45 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.mobile.form.fields.tablefield;
-
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.tablefield.ITableField;
-import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
-import org.eclipse.scout.rt.ui.rap.extension.IFormFieldFactory;
-import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
-import org.eclipse.scout.rt.ui.rap.form.fields.tablefield.IRwtScoutTableField;
-import org.eclipse.scout.rt.ui.rap.form.fields.tablefield.RwtScoutTableField;
-import org.eclipse.scout.rt.ui.rap.util.DeviceUtility;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * @since 3.9.0
- */
-public class MobileTableFieldFactory implements IFormFieldFactory {
-
- @Override
- public IRwtScoutFormField<?> createUiFormField(Composite parent, IFormField model, IRwtEnvironment uiEnvironment) {
- IRwtScoutTableField field;
-
- if (DeviceUtility.isMobileOrTabletDevice()) {
- field = new RwtScoutMobileTableField();
- }
- else {
- field = new RwtScoutTableField();
- }
-
- ITableField<?> tableField = (ITableField) model;
- field.createUiField(parent, tableField, uiEnvironment);
-
- return field;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.mobile.form.fields.tablefield;
+
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.tablefield.ITableField;
+import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
+import org.eclipse.scout.rt.ui.rap.extension.IFormFieldFactory;
+import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
+import org.eclipse.scout.rt.ui.rap.form.fields.tablefield.IRwtScoutTableField;
+import org.eclipse.scout.rt.ui.rap.form.fields.tablefield.RwtScoutTableField;
+import org.eclipse.scout.rt.ui.rap.util.DeviceUtility;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * @since 3.9.0
+ */
+public class MobileTableFieldFactory implements IFormFieldFactory {
+
+ @Override
+ public IRwtScoutFormField<?> createUiFormField(Composite parent, IFormField model, IRwtEnvironment uiEnvironment) {
+ IRwtScoutTableField field;
+
+ if (DeviceUtility.isMobileOrTabletDevice()) {
+ field = new RwtScoutMobileTableField();
+ }
+ else {
+ field = new RwtScoutTableField();
+ }
+
+ ITableField<?> tableField = (ITableField) model;
+ field.createUiField(parent, tableField, uiEnvironment);
+
+ return field;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/tablefield/RwtMobileTableStatus.java b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/tablefield/RwtMobileTableStatus.java
index aa8d1a7b4a..06dffeec54 100644
--- a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/tablefield/RwtMobileTableStatus.java
+++ b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/tablefield/RwtMobileTableStatus.java
@@ -1,42 +1,42 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.mobile.form.fields.tablefield;
-
-import org.eclipse.scout.rt.client.mobile.ui.form.outline.IMainPageForm;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.client.ui.form.fields.tablefield.ITableField;
-import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
-import org.eclipse.scout.rt.ui.rap.form.fields.tablefield.RwtTableStatus;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-
-public class RwtMobileTableStatus extends RwtTableStatus {
-
- public RwtMobileTableStatus(Composite parent, IRwtEnvironment uiEnvironment, ITableField<?> model) {
- super(parent, uiEnvironment, model);
- }
-
- @Override
- protected String getVariant(ITableField<?> table) {
- IForm form = table.getForm();
- if (form instanceof IMainPageForm) {
- return VARIANT_OUTLINE_TABLE_STATUS;
- }
-
- return super.getVariant(table);
- }
-
- @Override
- protected int getLabelHorizontalAlignment() {
- return SWT.CENTER;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.mobile.form.fields.tablefield;
+
+import org.eclipse.scout.rt.client.mobile.ui.form.outline.IMainPageForm;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.client.ui.form.fields.tablefield.ITableField;
+import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
+import org.eclipse.scout.rt.ui.rap.form.fields.tablefield.RwtTableStatus;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+
+public class RwtMobileTableStatus extends RwtTableStatus {
+
+ public RwtMobileTableStatus(Composite parent, IRwtEnvironment uiEnvironment, ITableField<?> model) {
+ super(parent, uiEnvironment, model);
+ }
+
+ @Override
+ protected String getVariant(ITableField<?> table) {
+ IForm form = table.getForm();
+ if (form instanceof IMainPageForm) {
+ return VARIANT_OUTLINE_TABLE_STATUS;
+ }
+
+ return super.getVariant(table);
+ }
+
+ @Override
+ protected int getLabelHorizontalAlignment() {
+ return SWT.CENTER;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/tablefield/RwtScoutList.java b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/tablefield/RwtScoutList.java
index ca194e5ac0..f9a52ac669 100644
--- a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/tablefield/RwtScoutList.java
+++ b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/tablefield/RwtScoutList.java
@@ -1,611 +1,611 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.mobile.form.fields.tablefield;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.TreeSet;
-
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ListViewer;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.rwt.RWT;
-import org.eclipse.rwt.lifecycle.WidgetUtil;
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.rt.client.ui.IEventHistory;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.client.ui.basic.table.RowIndexComparator;
-import org.eclipse.scout.rt.client.ui.basic.table.TableEvent;
-import org.eclipse.scout.rt.client.ui.basic.table.TableListener;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-import org.eclipse.scout.rt.ui.rap.basic.RwtScoutComposite;
-import org.eclipse.scout.rt.ui.rap.basic.table.RwtScoutTable;
-import org.eclipse.scout.rt.ui.rap.basic.table.RwtScoutTableEvent;
-import org.eclipse.scout.rt.ui.rap.keystroke.RwtKeyStroke;
-import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
-import org.eclipse.scout.rt.ui.rap.util.UiRedrawHandler;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.HyperlinkEvent;
-import org.eclipse.swt.events.HyperlinkListener;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.internal.widgets.MarkupValidator;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.TableItem;
-
-/**
- * List with basic functionalities which processes a {@link ITable} but only the first column.<br/>
- * Compared to {@link RwtScoutTable} there are a lot of missing features:
- * <ul>
- * <li>It's not possible to display images, nor changing the font or color as jface list does not support it</li>
- * <li>There is no keyboard navigation support</li>
- * <li>There is no drag and drop support</li>
- * <li>There are no header menus nor context menus displayed</li>
- * <li>It cannot handle a lot of rows.</li>
- * </ul>
- * One essential difference to the table widget is that scrolling works better. On tables scrolling is done row by row
- * as only the displayed rows are rendered. On a list widget every row is rendered at beginning which makes scrolling
- * smoother. That's why it is the preferred widget on touch devices.
- */
-@SuppressWarnings("restriction")
-public class RwtScoutList extends RwtScoutComposite<ITable> implements IRwtScoutList {
- private P_ScoutTableListener m_scoutTableListener;
- private UiRedrawHandler m_redrawHandler;
- private ListViewer m_uiViewer;
- private String m_variant = "";
-
- public RwtScoutList() {
- }
-
- public RwtScoutList(String variant) {
- m_variant = variant;
- }
-
- @Override
- protected void initializeUi(Composite parent) {
- m_redrawHandler = new UiRedrawHandler(parent);
- int style;
- if (getScoutObject() != null && getScoutObject().isMultiSelect()) {
- style = SWT.MULTI;
- }
- else {
- style = SWT.SINGLE;
- }
- style |= SWT.V_SCROLL;
- ListEx list = new ListEx(parent, style);
-
- if (StringUtility.hasText(m_variant)) {
- list.setData(WidgetUtil.CUSTOM_VARIANT, m_variant);
- }
- list.setData(RWT.MARKUP_ENABLED, Boolean.TRUE);
- list.setData(MarkupValidator.MARKUP_VALIDATION_DISABLED, Boolean.TRUE);
-
- ListViewer viewer = new ListViewer(list);
- viewer.setUseHashlookup(true);
- setUiTableViewer(viewer);
- setUiField(list);
-
- RwtScoutListModel listModel = createUiListModel();
- listModel.setMultiline(getScoutObject().isMultilineText());
- viewer.setContentProvider(listModel);
- viewer.setLabelProvider(listModel);
- viewer.setInput(listModel);
-
- // ui listeners
- viewer.addSelectionChangedListener(new P_RwtSelectionListener());
- P_RwtTableListener rwtTableListener = new P_RwtTableListener();
- list.addListener(SWT.MouseUp, rwtTableListener);
- list.addListener(SWT.MouseDoubleClick, rwtTableListener);
-
- //HyperlinkListener is not part of the official rap api so this line might generate compile errors
- //See https://bugs.eclipse.org/bugs/show_bug.cgi?id=347436
- list.addHyperlinkListener(new P_RwtHyperlinkListener());
-
- getUiEnvironment().addKeyStroke(list, new RwtKeyStroke((int) ' ') {
-
- @Override
- public void handleUiAction(Event e) {
- handleUiToggleAcction(e);
- }
- }, false);
-
- }
-
- @Override
- public boolean isUiDisposed() {
- return getUiField() == null || getUiField().isDisposed();
- }
-
- protected RwtScoutListModel createUiListModel() {
- return new RwtScoutListModel(getScoutObject(), this);
- }
-
- @Override
- protected void attachScout() {
- super.attachScout();
-
- if (getScoutObject() == null) {
- return;
- }
-
- if (m_scoutTableListener == null) {
- m_scoutTableListener = new P_ScoutTableListener();
- getScoutObject().addUITableListener(m_scoutTableListener);
- }
- setHeaderVisibleFromScout(getScoutObject().isHeaderVisible());
- setSelectionFromScout(getScoutObject().getSelectedRows());
- setRowHeightFromScout();
-
- //handle events from recent history
- final IEventHistory<TableEvent> h = getScoutObject().getEventHistory();
- if (h != null) {
- getUiEnvironment().getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- for (TableEvent e : h.getRecentEvents()) {
- handleScoutTableEventInUi(e);
- }
- }
- });
- }
- }
-
- @Override
- protected void detachScout() {
- super.detachScout();
-
- if (getScoutObject() == null) {
- return;
- }
-
- if (m_scoutTableListener != null) {
- getScoutObject().removeTableListener(m_scoutTableListener);
- m_scoutTableListener = null;
- }
- }
-
- @Override
- public ListEx getUiField() {
- return (ListEx) super.getUiField();
- }
-
- @Override
- public ListViewer getUiTableViewer() {
- return m_uiViewer;
- }
-
- public void setUiTableViewer(ListViewer uiViewer) {
- m_uiViewer = uiViewer;
- }
-
- public ITableRow getUiSelectedRow() {
- ITableRow[] rows = getUiSelectedRows();
- if (rows.length > 0) {
- return rows[0];
- }
- return null;
- }
-
- public ITableRow[] getUiSelectedRows() {
- StructuredSelection uiSelection = (StructuredSelection) getUiTableViewer().getSelection();
- TreeSet<ITableRow> sortedRows = new TreeSet<ITableRow>(new RowIndexComparator());
- if (uiSelection != null && !uiSelection.isEmpty()) {
- for (Object o : uiSelection.toArray()) {
- ITableRow row = (ITableRow) o;
- sortedRows.add(row);
- }
- }
- return sortedRows.toArray(new ITableRow[sortedRows.size()]);
- }
-
- protected void setRowHeightFromScout() {
- int h = getScoutObject().getRowHeightHint();
- if (h <= 0 && getScoutObject().isMultilineText()) {
- h = 40; // Enough for 2 lines fully visible (further lines are cut off) --> cannot be dynamic at the moment, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=346768
- }
- if (h >= 0) {
- getUiField().setData(RWT.CUSTOM_ITEM_HEIGHT, h);
- }
- if (isCreated()) {
- getUiTableViewer().refresh();
- }
- }
-
- /**
- * scout property observer
- */
- @Override
- protected void handleScoutPropertyChange(String propName, Object newValue) {
- if (propName.equals(ITable.PROP_HEADER_VISIBLE)) {
- setHeaderVisibleFromScout(((Boolean) newValue).booleanValue());
- }
- else if (propName.equals(ITable.PROP_ROW_HEIGHT_HINT)) {
- setRowHeightFromScout();
- }
- else if (propName.equals(ITable.PROP_SCROLL_TO_SELECTION)) {
- updateScrollToSelectionFromScout();
- }
- }
-
- /**
- * scout table observer
- */
- protected boolean isHandleScoutTableEvent(TableEvent[] a) {
- for (TableEvent element : a) {
- switch (element.getType()) {
- case TableEvent.TYPE_REQUEST_FOCUS:
- case TableEvent.TYPE_REQUEST_FOCUS_IN_CELL:
- case TableEvent.TYPE_ROWS_INSERTED:
- case TableEvent.TYPE_ROWS_UPDATED:
- case TableEvent.TYPE_ROWS_DELETED:
- case TableEvent.TYPE_ALL_ROWS_DELETED:
- case TableEvent.TYPE_ROW_ORDER_CHANGED:
- case TableEvent.TYPE_ROW_FILTER_CHANGED:
- case TableEvent.TYPE_COLUMN_ORDER_CHANGED:
- case TableEvent.TYPE_COLUMN_HEADERS_UPDATED:
- case TableEvent.TYPE_COLUMN_STRUCTURE_CHANGED:
- case TableEvent.TYPE_ROWS_SELECTED:
- case TableEvent.TYPE_SCROLL_TO_SELECTION: {
- return true;
- }
- }
- }
- return false;
- }
-
- protected void handleScoutTableEventInUi(TableEvent e) {
- if (isUiDisposed()) {
- return;
- }
- RwtScoutTableEvent uiTableEvent = null;
- /*
- * check the scout observer to filter all events that are used here
- * @see isHandleScoutTableEvent()
- */
- switch (e.getType()) {
- case TableEvent.TYPE_REQUEST_FOCUS: {
- getUiField().setFocus();
- break;
- }
- case TableEvent.TYPE_SCROLL_TO_SELECTION: {
- scrollToSelection();
- break;
- }
- case TableEvent.TYPE_ROWS_INSERTED:
- case TableEvent.TYPE_ROWS_UPDATED:
- case TableEvent.TYPE_ROWS_DELETED:
- case TableEvent.TYPE_ALL_ROWS_DELETED:
- case TableEvent.TYPE_ROW_FILTER_CHANGED:
- case TableEvent.TYPE_ROW_ORDER_CHANGED: {
- uiTableEvent = new RwtScoutTableEvent();
- break;
- }
- case TableEvent.TYPE_ROWS_SELECTED: {
- setSelectionFromScout(e.getRows());
- break;
- }
- }
- //
- if (uiTableEvent != null) {
- ((RwtScoutListModel) getUiTableViewer().getContentProvider()).consumeTableModelEvent(uiTableEvent);
- getUiTableViewer().refresh();
- }
- // refresh selection, indexes might have changed
- switch (e.getType()) {
- case TableEvent.TYPE_ROW_FILTER_CHANGED:
- setSelectionFromScout(e.getTable().getSelectedRows());
- break;
- case TableEvent.TYPE_ROWS_INSERTED:
- case TableEvent.TYPE_ROWS_UPDATED:
- case TableEvent.TYPE_ROWS_DELETED:
- case TableEvent.TYPE_ALL_ROWS_DELETED:
- case TableEvent.TYPE_ROW_ORDER_CHANGED: {
- setSelectionFromScout(e.getTable().getSelectedRows());
- break;
- }
- }
- }
-
- protected void setHeaderVisibleFromScout(boolean headerVisible) {
- //FIXME CGU create header to allow sorting
-// getUiField().setHeaderVisible(headerVisible);
- }
-
- @Override
- public void setEnabledFromScout(boolean enabledFromScout) {
- getUiField().setEnabled(enabledFromScout);
- }
-
- protected void setSelectionFromScout(ITableRow[] selectedRows) {
- if (getUiField().isDisposed()) {
- return;
- }
- ITableRow[] uiSelection = getUiSelectedRows();
- if (CompareUtility.equals(uiSelection, selectedRows)) {
- // no change
- return;
- }
- else {
- if (selectedRows == null) {
- selectedRows = new ITableRow[0];
- }
- getUiTableViewer().setSelection(new StructuredSelection(selectedRows), true);
- updateScrollToSelectionFromScout();
- }
- }
-
- private void updateScrollToSelectionFromScout() {
- if (getScoutObject().isScrollToSelection()) {
- scrollToSelection();
- }
- }
-
- protected void scrollToSelection() {
- if (getUiField() != null && !getUiField().isDisposed()) {
- getUiField().showSelection();
- }
- }
-
- protected void setContextColumnFromUi() {
- if (getScoutObject() == null) {
- return;
- }
-
- // notify Scout
- final IColumn finalCol = getScoutObject().getColumnSet().getVisibleColumn(0);
- Runnable t = new Runnable() {
- @Override
- public void run() {
- getScoutObject().getUIFacade().setContextColumnFromUI(finalCol);
- }
- };
- getUiEnvironment().invokeScoutLater(t, 0);
- // end notify
- }
-
- private int getVisualCellIndex(TableItem tableItem, int columnIndex) {
- int visualCellIndex = columnIndex;
- final int[] columnOrder = tableItem.getParent().getColumnOrder();
- for (int element : columnOrder) {
- if (element == columnIndex) {
- visualCellIndex = columnIndex;
- }
- }
- return visualCellIndex;
- }
-
- protected void setSelectionFromUi(final StructuredSelection selection) {
- if (getUpdateUiFromScoutLock().isAcquired()) {
- return;
- }
- //
- if (getScoutObject() != null) {
- // notify Scout
- Runnable t = new Runnable() {
- @Override
- public void run() {
- try {
- addIgnoredScoutEvent(TableEvent.class, "" + TableEvent.TYPE_ROWS_SELECTED);
- //
- getScoutObject().getUIFacade().setSelectedRowsFromUI(RwtUtility.getItemsOfSelection(ITableRow.class, selection));
- }
- finally {
- removeIgnoredScoutEvent(TableEvent.class, "" + TableEvent.TYPE_ROWS_SELECTED);
- }
- }
- };
- getUiEnvironment().invokeScoutLater(t, 0);
- // end notify
- }
- }
-
- protected void handleUiRowClick(final ITableRow row) {
- if (getScoutObject() != null) {
- if (row != null) {
- // notify Scout
- Runnable t = new Runnable() {
- @Override
- public void run() {
- getScoutObject().getUIFacade().fireRowClickFromUI(row);
- }
- };
- getUiEnvironment().invokeScoutLater(t, 0);
- // end notify
- }
- }
- }
-
- protected void handleUiRowAction(final ITableRow row) {
- if (getScoutObject() != null) {
- if (!getScoutObject().isCheckable() && row != null) {
- // notify Scout
- Runnable t = new Runnable() {
- @Override
- public void run() {
- getScoutObject().getUIFacade().fireRowActionFromUI(row);
- }
- };
- getUiEnvironment().invokeScoutLater(t, 0);
- // end notify
- }
- }
- }
-
- protected void handleUiHyperlinkAction(String urlText) {
- if (getScoutObject() != null) {
- final URL url;
- try {
- url = new URL(urlText);
- }
- catch (MalformedURLException e) {
- //nop
- return;
- }
- // notify Scout
- Runnable t = new Runnable() {
- @Override
- public void run() {
- ITable table = getScoutObject();
- table.getUIFacade().fireHyperlinkActionFromUI(table.getSelectedRow(), table.getContextColumn(), url);
- }
- };
- getUiEnvironment().invokeScoutLater(t, 0);
- // end notify
- }
- }
-
- protected void handleUiToggleAcction(Event e) {
- if (e.doit && getScoutObject().isCheckable()) {
- if (e.stateMask == 0) {
- switch (e.keyCode) {
- case ' ':
- ITableRow[] selectedRows = RwtUtility.getItemsOfSelection(ITableRow.class, (StructuredSelection) getUiTableViewer().getSelection());
- if (selectedRows != null && selectedRows.length > 0) {
- handleUiRowClick(selectedRows[0]);
- }
- e.doit = false;
- break;
- }
- }
- }
- }
-
- private class P_ScoutTableListener implements TableListener {
- @Override
- public void tableChanged(final TableEvent e) {
- if (isHandleScoutTableEvent(new TableEvent[]{e})) {
- if (isIgnoredScoutEvent(TableEvent.class, "" + e.getType())) {
- return;
- }
- Runnable t = new Runnable() {
- @Override
- public void run() {
- try {
- getUpdateUiFromScoutLock().acquire();
- //
- handleScoutTableEventInUi(e);
- }
- finally {
- getUpdateUiFromScoutLock().release();
- }
- }
- };
- getUiEnvironment().invokeUiLater(t);
- }
- }
-
- @Override
- public void tableChangedBatch(final TableEvent[] a) {
- if (isHandleScoutTableEvent(a)) {
- final ArrayList<TableEvent> filteredList = new ArrayList<TableEvent>();
- for (int i = 0; i < a.length; i++) {
- if (!isIgnoredScoutEvent(TableEvent.class, "" + a[i].getType())) {
- filteredList.add(a[i]);
- }
- }
- if (filteredList.size() == 0) {
- return;
- }
- Runnable t = new Runnable() {
- @Override
- public void run() {
- if (isUiDisposed()) {
- return;
- }
- m_redrawHandler.pushControlChanging();
- try {
- try {
- getUpdateUiFromScoutLock().acquire();
- //
- for (TableEvent element : filteredList) {
- handleScoutTableEventInUi(element);
- }
- }
- finally {
- getUpdateUiFromScoutLock().release();
- }
- }
- finally {
- m_redrawHandler.popControlChanging();
- }
- }
- };
- getUiEnvironment().invokeUiLater(t);
- }
- }
- }
-
- private class P_RwtTableListener implements Listener {
- private static final long serialVersionUID = 1L;
-
- private Boolean m_doubleClicked = Boolean.FALSE;
-
- @Override
- public void handleEvent(Event event) {
- switch (event.type) {
- case SWT.MouseUp: {
- setContextColumnFromUi();
-
- synchronized (m_doubleClicked) {
- if (m_doubleClicked == Boolean.TRUE) {
- m_doubleClicked = Boolean.FALSE;
- break;
- }
- }
- Point eventPosition = new Point(event.x, event.y);
- if (getUiField().getItem(eventPosition) == null) {
- getUiTableViewer().setSelection(null);
- setSelectionFromUi(new StructuredSelection());
- }
- else {
- StructuredSelection selection = (StructuredSelection) getUiTableViewer().getSelection();
- if (selection != null && selection.size() == 1) {
- handleUiRowClick((ITableRow) selection.getFirstElement());
- }
- }
- break;
- }
- case SWT.MouseDoubleClick: {
- synchronized (m_doubleClicked) {
- m_doubleClicked = Boolean.TRUE;
- }
- StructuredSelection selection = (StructuredSelection) getUiTableViewer().getSelection();
- if (selection != null && selection.size() == 1) {
- handleUiRowAction((ITableRow) selection.getFirstElement());
- }
- break;
- }
- }
- }
- }
-
- public class P_RwtSelectionListener implements ISelectionChangedListener {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- setSelectionFromUi((StructuredSelection) event.getSelection());
- }
- }
-
- public class P_RwtHyperlinkListener implements HyperlinkListener {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void activated(HyperlinkEvent event) {
- handleUiHyperlinkAction(event.url);
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.mobile.form.fields.tablefield;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.TreeSet;
+
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ListViewer;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.rwt.RWT;
+import org.eclipse.rwt.lifecycle.WidgetUtil;
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.rt.client.ui.IEventHistory;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.client.ui.basic.table.RowIndexComparator;
+import org.eclipse.scout.rt.client.ui.basic.table.TableEvent;
+import org.eclipse.scout.rt.client.ui.basic.table.TableListener;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+import org.eclipse.scout.rt.ui.rap.basic.RwtScoutComposite;
+import org.eclipse.scout.rt.ui.rap.basic.table.RwtScoutTable;
+import org.eclipse.scout.rt.ui.rap.basic.table.RwtScoutTableEvent;
+import org.eclipse.scout.rt.ui.rap.keystroke.RwtKeyStroke;
+import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
+import org.eclipse.scout.rt.ui.rap.util.UiRedrawHandler;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.HyperlinkEvent;
+import org.eclipse.swt.events.HyperlinkListener;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.internal.widgets.MarkupValidator;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.TableItem;
+
+/**
+ * List with basic functionalities which processes a {@link ITable} but only the first column.<br/>
+ * Compared to {@link RwtScoutTable} there are a lot of missing features:
+ * <ul>
+ * <li>It's not possible to display images, nor changing the font or color as jface list does not support it</li>
+ * <li>There is no keyboard navigation support</li>
+ * <li>There is no drag and drop support</li>
+ * <li>There are no header menus nor context menus displayed</li>
+ * <li>It cannot handle a lot of rows.</li>
+ * </ul>
+ * One essential difference to the table widget is that scrolling works better. On tables scrolling is done row by row
+ * as only the displayed rows are rendered. On a list widget every row is rendered at beginning which makes scrolling
+ * smoother. That's why it is the preferred widget on touch devices.
+ */
+@SuppressWarnings("restriction")
+public class RwtScoutList extends RwtScoutComposite<ITable> implements IRwtScoutList {
+ private P_ScoutTableListener m_scoutTableListener;
+ private UiRedrawHandler m_redrawHandler;
+ private ListViewer m_uiViewer;
+ private String m_variant = "";
+
+ public RwtScoutList() {
+ }
+
+ public RwtScoutList(String variant) {
+ m_variant = variant;
+ }
+
+ @Override
+ protected void initializeUi(Composite parent) {
+ m_redrawHandler = new UiRedrawHandler(parent);
+ int style;
+ if (getScoutObject() != null && getScoutObject().isMultiSelect()) {
+ style = SWT.MULTI;
+ }
+ else {
+ style = SWT.SINGLE;
+ }
+ style |= SWT.V_SCROLL;
+ ListEx list = new ListEx(parent, style);
+
+ if (StringUtility.hasText(m_variant)) {
+ list.setData(WidgetUtil.CUSTOM_VARIANT, m_variant);
+ }
+ list.setData(RWT.MARKUP_ENABLED, Boolean.TRUE);
+ list.setData(MarkupValidator.MARKUP_VALIDATION_DISABLED, Boolean.TRUE);
+
+ ListViewer viewer = new ListViewer(list);
+ viewer.setUseHashlookup(true);
+ setUiTableViewer(viewer);
+ setUiField(list);
+
+ RwtScoutListModel listModel = createUiListModel();
+ listModel.setMultiline(getScoutObject().isMultilineText());
+ viewer.setContentProvider(listModel);
+ viewer.setLabelProvider(listModel);
+ viewer.setInput(listModel);
+
+ // ui listeners
+ viewer.addSelectionChangedListener(new P_RwtSelectionListener());
+ P_RwtTableListener rwtTableListener = new P_RwtTableListener();
+ list.addListener(SWT.MouseUp, rwtTableListener);
+ list.addListener(SWT.MouseDoubleClick, rwtTableListener);
+
+ //HyperlinkListener is not part of the official rap api so this line might generate compile errors
+ //See https://bugs.eclipse.org/bugs/show_bug.cgi?id=347436
+ list.addHyperlinkListener(new P_RwtHyperlinkListener());
+
+ getUiEnvironment().addKeyStroke(list, new RwtKeyStroke((int) ' ') {
+
+ @Override
+ public void handleUiAction(Event e) {
+ handleUiToggleAcction(e);
+ }
+ }, false);
+
+ }
+
+ @Override
+ public boolean isUiDisposed() {
+ return getUiField() == null || getUiField().isDisposed();
+ }
+
+ protected RwtScoutListModel createUiListModel() {
+ return new RwtScoutListModel(getScoutObject(), this);
+ }
+
+ @Override
+ protected void attachScout() {
+ super.attachScout();
+
+ if (getScoutObject() == null) {
+ return;
+ }
+
+ if (m_scoutTableListener == null) {
+ m_scoutTableListener = new P_ScoutTableListener();
+ getScoutObject().addUITableListener(m_scoutTableListener);
+ }
+ setHeaderVisibleFromScout(getScoutObject().isHeaderVisible());
+ setSelectionFromScout(getScoutObject().getSelectedRows());
+ setRowHeightFromScout();
+
+ //handle events from recent history
+ final IEventHistory<TableEvent> h = getScoutObject().getEventHistory();
+ if (h != null) {
+ getUiEnvironment().getDisplay().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ for (TableEvent e : h.getRecentEvents()) {
+ handleScoutTableEventInUi(e);
+ }
+ }
+ });
+ }
+ }
+
+ @Override
+ protected void detachScout() {
+ super.detachScout();
+
+ if (getScoutObject() == null) {
+ return;
+ }
+
+ if (m_scoutTableListener != null) {
+ getScoutObject().removeTableListener(m_scoutTableListener);
+ m_scoutTableListener = null;
+ }
+ }
+
+ @Override
+ public ListEx getUiField() {
+ return (ListEx) super.getUiField();
+ }
+
+ @Override
+ public ListViewer getUiTableViewer() {
+ return m_uiViewer;
+ }
+
+ public void setUiTableViewer(ListViewer uiViewer) {
+ m_uiViewer = uiViewer;
+ }
+
+ public ITableRow getUiSelectedRow() {
+ ITableRow[] rows = getUiSelectedRows();
+ if (rows.length > 0) {
+ return rows[0];
+ }
+ return null;
+ }
+
+ public ITableRow[] getUiSelectedRows() {
+ StructuredSelection uiSelection = (StructuredSelection) getUiTableViewer().getSelection();
+ TreeSet<ITableRow> sortedRows = new TreeSet<ITableRow>(new RowIndexComparator());
+ if (uiSelection != null && !uiSelection.isEmpty()) {
+ for (Object o : uiSelection.toArray()) {
+ ITableRow row = (ITableRow) o;
+ sortedRows.add(row);
+ }
+ }
+ return sortedRows.toArray(new ITableRow[sortedRows.size()]);
+ }
+
+ protected void setRowHeightFromScout() {
+ int h = getScoutObject().getRowHeightHint();
+ if (h <= 0 && getScoutObject().isMultilineText()) {
+ h = 40; // Enough for 2 lines fully visible (further lines are cut off) --> cannot be dynamic at the moment, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=346768
+ }
+ if (h >= 0) {
+ getUiField().setData(RWT.CUSTOM_ITEM_HEIGHT, h);
+ }
+ if (isCreated()) {
+ getUiTableViewer().refresh();
+ }
+ }
+
+ /**
+ * scout property observer
+ */
+ @Override
+ protected void handleScoutPropertyChange(String propName, Object newValue) {
+ if (propName.equals(ITable.PROP_HEADER_VISIBLE)) {
+ setHeaderVisibleFromScout(((Boolean) newValue).booleanValue());
+ }
+ else if (propName.equals(ITable.PROP_ROW_HEIGHT_HINT)) {
+ setRowHeightFromScout();
+ }
+ else if (propName.equals(ITable.PROP_SCROLL_TO_SELECTION)) {
+ updateScrollToSelectionFromScout();
+ }
+ }
+
+ /**
+ * scout table observer
+ */
+ protected boolean isHandleScoutTableEvent(TableEvent[] a) {
+ for (TableEvent element : a) {
+ switch (element.getType()) {
+ case TableEvent.TYPE_REQUEST_FOCUS:
+ case TableEvent.TYPE_REQUEST_FOCUS_IN_CELL:
+ case TableEvent.TYPE_ROWS_INSERTED:
+ case TableEvent.TYPE_ROWS_UPDATED:
+ case TableEvent.TYPE_ROWS_DELETED:
+ case TableEvent.TYPE_ALL_ROWS_DELETED:
+ case TableEvent.TYPE_ROW_ORDER_CHANGED:
+ case TableEvent.TYPE_ROW_FILTER_CHANGED:
+ case TableEvent.TYPE_COLUMN_ORDER_CHANGED:
+ case TableEvent.TYPE_COLUMN_HEADERS_UPDATED:
+ case TableEvent.TYPE_COLUMN_STRUCTURE_CHANGED:
+ case TableEvent.TYPE_ROWS_SELECTED:
+ case TableEvent.TYPE_SCROLL_TO_SELECTION: {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ protected void handleScoutTableEventInUi(TableEvent e) {
+ if (isUiDisposed()) {
+ return;
+ }
+ RwtScoutTableEvent uiTableEvent = null;
+ /*
+ * check the scout observer to filter all events that are used here
+ * @see isHandleScoutTableEvent()
+ */
+ switch (e.getType()) {
+ case TableEvent.TYPE_REQUEST_FOCUS: {
+ getUiField().setFocus();
+ break;
+ }
+ case TableEvent.TYPE_SCROLL_TO_SELECTION: {
+ scrollToSelection();
+ break;
+ }
+ case TableEvent.TYPE_ROWS_INSERTED:
+ case TableEvent.TYPE_ROWS_UPDATED:
+ case TableEvent.TYPE_ROWS_DELETED:
+ case TableEvent.TYPE_ALL_ROWS_DELETED:
+ case TableEvent.TYPE_ROW_FILTER_CHANGED:
+ case TableEvent.TYPE_ROW_ORDER_CHANGED: {
+ uiTableEvent = new RwtScoutTableEvent();
+ break;
+ }
+ case TableEvent.TYPE_ROWS_SELECTED: {
+ setSelectionFromScout(e.getRows());
+ break;
+ }
+ }
+ //
+ if (uiTableEvent != null) {
+ ((RwtScoutListModel) getUiTableViewer().getContentProvider()).consumeTableModelEvent(uiTableEvent);
+ getUiTableViewer().refresh();
+ }
+ // refresh selection, indexes might have changed
+ switch (e.getType()) {
+ case TableEvent.TYPE_ROW_FILTER_CHANGED:
+ setSelectionFromScout(e.getTable().getSelectedRows());
+ break;
+ case TableEvent.TYPE_ROWS_INSERTED:
+ case TableEvent.TYPE_ROWS_UPDATED:
+ case TableEvent.TYPE_ROWS_DELETED:
+ case TableEvent.TYPE_ALL_ROWS_DELETED:
+ case TableEvent.TYPE_ROW_ORDER_CHANGED: {
+ setSelectionFromScout(e.getTable().getSelectedRows());
+ break;
+ }
+ }
+ }
+
+ protected void setHeaderVisibleFromScout(boolean headerVisible) {
+ //FIXME CGU create header to allow sorting
+// getUiField().setHeaderVisible(headerVisible);
+ }
+
+ @Override
+ public void setEnabledFromScout(boolean enabledFromScout) {
+ getUiField().setEnabled(enabledFromScout);
+ }
+
+ protected void setSelectionFromScout(ITableRow[] selectedRows) {
+ if (getUiField().isDisposed()) {
+ return;
+ }
+ ITableRow[] uiSelection = getUiSelectedRows();
+ if (CompareUtility.equals(uiSelection, selectedRows)) {
+ // no change
+ return;
+ }
+ else {
+ if (selectedRows == null) {
+ selectedRows = new ITableRow[0];
+ }
+ getUiTableViewer().setSelection(new StructuredSelection(selectedRows), true);
+ updateScrollToSelectionFromScout();
+ }
+ }
+
+ private void updateScrollToSelectionFromScout() {
+ if (getScoutObject().isScrollToSelection()) {
+ scrollToSelection();
+ }
+ }
+
+ protected void scrollToSelection() {
+ if (getUiField() != null && !getUiField().isDisposed()) {
+ getUiField().showSelection();
+ }
+ }
+
+ protected void setContextColumnFromUi() {
+ if (getScoutObject() == null) {
+ return;
+ }
+
+ // notify Scout
+ final IColumn finalCol = getScoutObject().getColumnSet().getVisibleColumn(0);
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ getScoutObject().getUIFacade().setContextColumnFromUI(finalCol);
+ }
+ };
+ getUiEnvironment().invokeScoutLater(t, 0);
+ // end notify
+ }
+
+ private int getVisualCellIndex(TableItem tableItem, int columnIndex) {
+ int visualCellIndex = columnIndex;
+ final int[] columnOrder = tableItem.getParent().getColumnOrder();
+ for (int element : columnOrder) {
+ if (element == columnIndex) {
+ visualCellIndex = columnIndex;
+ }
+ }
+ return visualCellIndex;
+ }
+
+ protected void setSelectionFromUi(final StructuredSelection selection) {
+ if (getUpdateUiFromScoutLock().isAcquired()) {
+ return;
+ }
+ //
+ if (getScoutObject() != null) {
+ // notify Scout
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ try {
+ addIgnoredScoutEvent(TableEvent.class, "" + TableEvent.TYPE_ROWS_SELECTED);
+ //
+ getScoutObject().getUIFacade().setSelectedRowsFromUI(RwtUtility.getItemsOfSelection(ITableRow.class, selection));
+ }
+ finally {
+ removeIgnoredScoutEvent(TableEvent.class, "" + TableEvent.TYPE_ROWS_SELECTED);
+ }
+ }
+ };
+ getUiEnvironment().invokeScoutLater(t, 0);
+ // end notify
+ }
+ }
+
+ protected void handleUiRowClick(final ITableRow row) {
+ if (getScoutObject() != null) {
+ if (row != null) {
+ // notify Scout
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ getScoutObject().getUIFacade().fireRowClickFromUI(row);
+ }
+ };
+ getUiEnvironment().invokeScoutLater(t, 0);
+ // end notify
+ }
+ }
+ }
+
+ protected void handleUiRowAction(final ITableRow row) {
+ if (getScoutObject() != null) {
+ if (!getScoutObject().isCheckable() && row != null) {
+ // notify Scout
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ getScoutObject().getUIFacade().fireRowActionFromUI(row);
+ }
+ };
+ getUiEnvironment().invokeScoutLater(t, 0);
+ // end notify
+ }
+ }
+ }
+
+ protected void handleUiHyperlinkAction(String urlText) {
+ if (getScoutObject() != null) {
+ final URL url;
+ try {
+ url = new URL(urlText);
+ }
+ catch (MalformedURLException e) {
+ //nop
+ return;
+ }
+ // notify Scout
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ ITable table = getScoutObject();
+ table.getUIFacade().fireHyperlinkActionFromUI(table.getSelectedRow(), table.getContextColumn(), url);
+ }
+ };
+ getUiEnvironment().invokeScoutLater(t, 0);
+ // end notify
+ }
+ }
+
+ protected void handleUiToggleAcction(Event e) {
+ if (e.doit && getScoutObject().isCheckable()) {
+ if (e.stateMask == 0) {
+ switch (e.keyCode) {
+ case ' ':
+ ITableRow[] selectedRows = RwtUtility.getItemsOfSelection(ITableRow.class, (StructuredSelection) getUiTableViewer().getSelection());
+ if (selectedRows != null && selectedRows.length > 0) {
+ handleUiRowClick(selectedRows[0]);
+ }
+ e.doit = false;
+ break;
+ }
+ }
+ }
+ }
+
+ private class P_ScoutTableListener implements TableListener {
+ @Override
+ public void tableChanged(final TableEvent e) {
+ if (isHandleScoutTableEvent(new TableEvent[]{e})) {
+ if (isIgnoredScoutEvent(TableEvent.class, "" + e.getType())) {
+ return;
+ }
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ try {
+ getUpdateUiFromScoutLock().acquire();
+ //
+ handleScoutTableEventInUi(e);
+ }
+ finally {
+ getUpdateUiFromScoutLock().release();
+ }
+ }
+ };
+ getUiEnvironment().invokeUiLater(t);
+ }
+ }
+
+ @Override
+ public void tableChangedBatch(final TableEvent[] a) {
+ if (isHandleScoutTableEvent(a)) {
+ final ArrayList<TableEvent> filteredList = new ArrayList<TableEvent>();
+ for (int i = 0; i < a.length; i++) {
+ if (!isIgnoredScoutEvent(TableEvent.class, "" + a[i].getType())) {
+ filteredList.add(a[i]);
+ }
+ }
+ if (filteredList.size() == 0) {
+ return;
+ }
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ if (isUiDisposed()) {
+ return;
+ }
+ m_redrawHandler.pushControlChanging();
+ try {
+ try {
+ getUpdateUiFromScoutLock().acquire();
+ //
+ for (TableEvent element : filteredList) {
+ handleScoutTableEventInUi(element);
+ }
+ }
+ finally {
+ getUpdateUiFromScoutLock().release();
+ }
+ }
+ finally {
+ m_redrawHandler.popControlChanging();
+ }
+ }
+ };
+ getUiEnvironment().invokeUiLater(t);
+ }
+ }
+ }
+
+ private class P_RwtTableListener implements Listener {
+ private static final long serialVersionUID = 1L;
+
+ private Boolean m_doubleClicked = Boolean.FALSE;
+
+ @Override
+ public void handleEvent(Event event) {
+ switch (event.type) {
+ case SWT.MouseUp: {
+ setContextColumnFromUi();
+
+ synchronized (m_doubleClicked) {
+ if (m_doubleClicked == Boolean.TRUE) {
+ m_doubleClicked = Boolean.FALSE;
+ break;
+ }
+ }
+ Point eventPosition = new Point(event.x, event.y);
+ if (getUiField().getItem(eventPosition) == null) {
+ getUiTableViewer().setSelection(null);
+ setSelectionFromUi(new StructuredSelection());
+ }
+ else {
+ StructuredSelection selection = (StructuredSelection) getUiTableViewer().getSelection();
+ if (selection != null && selection.size() == 1) {
+ handleUiRowClick((ITableRow) selection.getFirstElement());
+ }
+ }
+ break;
+ }
+ case SWT.MouseDoubleClick: {
+ synchronized (m_doubleClicked) {
+ m_doubleClicked = Boolean.TRUE;
+ }
+ StructuredSelection selection = (StructuredSelection) getUiTableViewer().getSelection();
+ if (selection != null && selection.size() == 1) {
+ handleUiRowAction((ITableRow) selection.getFirstElement());
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ public class P_RwtSelectionListener implements ISelectionChangedListener {
+ @Override
+ public void selectionChanged(SelectionChangedEvent event) {
+ setSelectionFromUi((StructuredSelection) event.getSelection());
+ }
+ }
+
+ public class P_RwtHyperlinkListener implements HyperlinkListener {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void activated(HyperlinkEvent event) {
+ handleUiHyperlinkAction(event.url);
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/tablefield/RwtScoutListModel.java b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/tablefield/RwtScoutListModel.java
index 550cad8b7b..06d6b0a955 100644
--- a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/tablefield/RwtScoutListModel.java
+++ b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/tablefield/RwtScoutListModel.java
@@ -1,191 +1,191 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.mobile.form.fields.tablefield;
-
-import java.util.HashMap;
-
-import org.eclipse.core.runtime.ListenerList;
-import org.eclipse.jface.util.SafeRunnable;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.LabelProviderChangedEvent;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.rt.client.ui.basic.cell.ICell;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-import org.eclipse.scout.rt.ui.rap.basic.table.RwtScoutTableEvent;
-import org.eclipse.scout.rt.ui.rap.util.HtmlTextUtility;
-import org.eclipse.swt.graphics.Image;
-
-public class RwtScoutListModel implements IRwtScoutListModel {
- private static final long serialVersionUID = 1L;
-
- private transient ListenerList listenerList = null;
- private final ITable m_scoutTable;
- private HashMap<ITableRow, HashMap<IColumn<?>, ICell>> m_cachedCells;
- private final RwtScoutList m_uiList;
- private boolean m_multiline;
-
- public RwtScoutListModel(ITable scoutTable, RwtScoutList uiTable) {
- m_scoutTable = scoutTable;
- m_uiList = uiTable;
- rebuildCache();
- }
-
- @Override
- public void setMultiline(boolean multiline) {
- m_multiline = multiline;
- }
-
- @Override
- public boolean isMultiline() {
- return m_multiline;
- }
-
- @Override
- public Object[] getElements(Object inputElement) {
- if (m_scoutTable != null) {
- return m_scoutTable.getFilteredRows();
- }
- else {
- return new Object[0];
- }
- }
-
- @Override
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- @Override
- public void addListener(ILabelProviderListener listener) {
- if (listenerList == null) {
- listenerList = new ListenerList(ListenerList.IDENTITY);
- }
- listenerList.add(listener);
- }
-
- @Override
- public void removeListener(ILabelProviderListener listener) {
- if (listenerList != null) {
- listenerList.remove(listener);
- if (listenerList.isEmpty()) {
- listenerList = null;
- }
- }
- }
-
- private Object[] getListeners() {
- final ListenerList list = listenerList;
- if (list == null) {
- return new Object[0];
- }
-
- return list.getListeners();
- }
-
- @Override
- public void dispose() {
- if (listenerList != null) {
- listenerList.clear();
- }
- }
-
- protected void fireLabelProviderChanged(final LabelProviderChangedEvent event) {
- Object[] listeners = getListeners();
- for (int i = 0; i < listeners.length; ++i) {
- final ILabelProviderListener l = (ILabelProviderListener) listeners[i];
- SafeRunnable.run(new SafeRunnable() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void run() {
- l.labelProviderChanged(event);
- }
- });
- }
- }
-
- @Override
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
-
- @Override
- public void consumeTableModelEvent(RwtScoutTableEvent uiTableEvent) {
- rebuildCache();
- }
-
- protected ICell getCell(Object row) {
- IColumn<?> column = m_scoutTable.getColumnSet().getVisibleColumns()[0];
- if (column != null) {
- if (m_cachedCells.get(row) == null) {
- rebuildCache();
- }
- return m_cachedCells.get(row).get(column);
- }
- else {
- return null;
- }
- }
-
- private void rebuildCache() {
- m_cachedCells = new HashMap<ITableRow, HashMap<IColumn<?>, ICell>>();
- if (m_scoutTable != null) {
- for (ITableRow scoutRow : m_scoutTable.getRows()) {
- HashMap<IColumn<?>, ICell> cells = new HashMap<IColumn<?>, ICell>();
- for (IColumn<?> col : m_scoutTable.getColumnSet().getVisibleColumns()) {
- cells.put(col, m_scoutTable.getCell(scoutRow, col));
- }
- m_cachedCells.put(scoutRow, cells);
- }
- }
- }
-
- @Override
- public RwtScoutList getRwtScoutList() {
- return m_uiList;
- }
-
- @Override
- public Image getImage(Object element) {
- //Has no effect on ListViewer
- return null;
- }
-
- @Override
- public String getText(Object element) {
- ICell cell = getCell(element);
- if (cell == null) {
- return "";
- }
-
- String text = cell.getText();
- if (text == null) {
- text = "";
- }
- if (HtmlTextUtility.isTextWithHtmlMarkup(text)) {
- text = m_uiList.getUiEnvironment().adaptHtmlCell(m_uiList, text);
- text = m_uiList.getUiEnvironment().convertLinksWithLocalUrlsInHtmlCell(m_uiList, text);
- }
- else if (text.indexOf("\n") >= 0) {
- if (isMultiline()) {
- //transform to html
- text = "<html>" + HtmlTextUtility.transformPlainTextToHtml(text) + "</html>";
- text = m_uiList.getUiEnvironment().adaptHtmlCell(m_uiList, text);
- }
- else {
- text = StringUtility.replace(text, "\n", " ");
- }
- }
- return text;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.mobile.form.fields.tablefield;
+
+import java.util.HashMap;
+
+import org.eclipse.core.runtime.ListenerList;
+import org.eclipse.jface.util.SafeRunnable;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.LabelProviderChangedEvent;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.rt.client.ui.basic.cell.ICell;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+import org.eclipse.scout.rt.ui.rap.basic.table.RwtScoutTableEvent;
+import org.eclipse.scout.rt.ui.rap.util.HtmlTextUtility;
+import org.eclipse.swt.graphics.Image;
+
+public class RwtScoutListModel implements IRwtScoutListModel {
+ private static final long serialVersionUID = 1L;
+
+ private transient ListenerList listenerList = null;
+ private final ITable m_scoutTable;
+ private HashMap<ITableRow, HashMap<IColumn<?>, ICell>> m_cachedCells;
+ private final RwtScoutList m_uiList;
+ private boolean m_multiline;
+
+ public RwtScoutListModel(ITable scoutTable, RwtScoutList uiTable) {
+ m_scoutTable = scoutTable;
+ m_uiList = uiTable;
+ rebuildCache();
+ }
+
+ @Override
+ public void setMultiline(boolean multiline) {
+ m_multiline = multiline;
+ }
+
+ @Override
+ public boolean isMultiline() {
+ return m_multiline;
+ }
+
+ @Override
+ public Object[] getElements(Object inputElement) {
+ if (m_scoutTable != null) {
+ return m_scoutTable.getFilteredRows();
+ }
+ else {
+ return new Object[0];
+ }
+ }
+
+ @Override
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+
+ @Override
+ public void addListener(ILabelProviderListener listener) {
+ if (listenerList == null) {
+ listenerList = new ListenerList(ListenerList.IDENTITY);
+ }
+ listenerList.add(listener);
+ }
+
+ @Override
+ public void removeListener(ILabelProviderListener listener) {
+ if (listenerList != null) {
+ listenerList.remove(listener);
+ if (listenerList.isEmpty()) {
+ listenerList = null;
+ }
+ }
+ }
+
+ private Object[] getListeners() {
+ final ListenerList list = listenerList;
+ if (list == null) {
+ return new Object[0];
+ }
+
+ return list.getListeners();
+ }
+
+ @Override
+ public void dispose() {
+ if (listenerList != null) {
+ listenerList.clear();
+ }
+ }
+
+ protected void fireLabelProviderChanged(final LabelProviderChangedEvent event) {
+ Object[] listeners = getListeners();
+ for (int i = 0; i < listeners.length; ++i) {
+ final ILabelProviderListener l = (ILabelProviderListener) listeners[i];
+ SafeRunnable.run(new SafeRunnable() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void run() {
+ l.labelProviderChanged(event);
+ }
+ });
+ }
+ }
+
+ @Override
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+
+ @Override
+ public void consumeTableModelEvent(RwtScoutTableEvent uiTableEvent) {
+ rebuildCache();
+ }
+
+ protected ICell getCell(Object row) {
+ IColumn<?> column = m_scoutTable.getColumnSet().getVisibleColumns()[0];
+ if (column != null) {
+ if (m_cachedCells.get(row) == null) {
+ rebuildCache();
+ }
+ return m_cachedCells.get(row).get(column);
+ }
+ else {
+ return null;
+ }
+ }
+
+ private void rebuildCache() {
+ m_cachedCells = new HashMap<ITableRow, HashMap<IColumn<?>, ICell>>();
+ if (m_scoutTable != null) {
+ for (ITableRow scoutRow : m_scoutTable.getRows()) {
+ HashMap<IColumn<?>, ICell> cells = new HashMap<IColumn<?>, ICell>();
+ for (IColumn<?> col : m_scoutTable.getColumnSet().getVisibleColumns()) {
+ cells.put(col, m_scoutTable.getCell(scoutRow, col));
+ }
+ m_cachedCells.put(scoutRow, cells);
+ }
+ }
+ }
+
+ @Override
+ public RwtScoutList getRwtScoutList() {
+ return m_uiList;
+ }
+
+ @Override
+ public Image getImage(Object element) {
+ //Has no effect on ListViewer
+ return null;
+ }
+
+ @Override
+ public String getText(Object element) {
+ ICell cell = getCell(element);
+ if (cell == null) {
+ return "";
+ }
+
+ String text = cell.getText();
+ if (text == null) {
+ text = "";
+ }
+ if (HtmlTextUtility.isTextWithHtmlMarkup(text)) {
+ text = m_uiList.getUiEnvironment().adaptHtmlCell(m_uiList, text);
+ text = m_uiList.getUiEnvironment().convertLinksWithLocalUrlsInHtmlCell(m_uiList, text);
+ }
+ else if (text.indexOf("\n") >= 0) {
+ if (isMultiline()) {
+ //transform to html
+ text = "<html>" + HtmlTextUtility.transformPlainTextToHtml(text) + "</html>";
+ text = m_uiList.getUiEnvironment().adaptHtmlCell(m_uiList, text);
+ }
+ else {
+ text = StringUtility.replace(text, "\n", " ");
+ }
+ }
+ return text;
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/tablefield/RwtScoutMobileTableField.java b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/tablefield/RwtScoutMobileTableField.java
index a6fb5f5459..c66ab33ecc 100644
--- a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/tablefield/RwtScoutMobileTableField.java
+++ b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/tablefield/RwtScoutMobileTableField.java
@@ -1,173 +1,173 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.mobile.form.fields.tablefield;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.scout.commons.holders.Holder;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.mobile.ui.basic.table.MobileTable;
-import org.eclipse.scout.rt.client.mobile.ui.form.fields.table.IMobileTableField;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox;
-import org.eclipse.scout.rt.ui.rap.basic.table.IRwtScoutTable;
-import org.eclipse.scout.rt.ui.rap.form.fields.tablefield.IRwtTableStatus;
-import org.eclipse.scout.rt.ui.rap.form.fields.tablefield.RwtScoutTableField;
-import org.eclipse.scout.rt.ui.rap.window.desktop.IRwtScoutActionBar;
-
-/**
- * @since 3.9.0
- */
-public class RwtScoutMobileTableField extends RwtScoutTableField {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(RwtScoutMobileTableField.class);
-
- private MobileTable m_mobileTable;
- private boolean m_columnTransformationEnabled;
-
- public RwtScoutMobileTableField() {
- this(true);
- }
-
- public RwtScoutMobileTableField(boolean columnTransformationEnabled) {
- m_columnTransformationEnabled = columnTransformationEnabled;
- }
-
- @Override
- protected IRwtScoutTable createRwtScoutTable() {
- return new RwtScoutList();
- }
-
- @Override
- protected void setTableFromScout(ITable table) {
- if (!m_columnTransformationEnabled) {
- super.setTableFromScout(table);
- return;
- }
-
- disposeMobileTable();
-
- if (table == null) {
- super.setTableFromScout(table);
- return;
- }
- else {
- m_mobileTable = wrapTable(table);
- super.setTableFromScout(m_mobileTable);
- }
- }
-
- private MobileTable wrapTable(final ITable table) {
- final Holder<MobileTable> holder = new Holder<MobileTable>(MobileTable.class);
-
- ClientSyncJob job = new ClientSyncJob("", getUiEnvironment().getClientSession()) {
- @Override
- protected void runVoid(IProgressMonitor monitor) throws Throwable {
- MobileTable wrapperTable = new MobileTable(table);
- try {
- wrapperTable.setTableChanging(true);
- wrapperTable.setTableRowFormDisplayHint(getScoutObject().getForm().getDisplayHint());
- wrapperTable.setTableRowFormDisplayViewId(getScoutObject().getForm().getDisplayViewId());
- wrapperTable.initTable();
- }
- finally {
- wrapperTable.setTableChanging(false);
- }
- holder.setValue(wrapperTable);
- }
- };
- job.schedule();
-
- try {
- //TODO CGU: this freezes the gui if initializing of the table takes a while. Async table creation possible?
- job.join();
- }
- catch (InterruptedException e) {
- LOG.error("Table wrapping interrupted. ", e);
- }
-
- return holder.getValue();
- }
-
- @Override
- protected IRwtScoutActionBar createRwtScoutActionBar() {
- boolean actionBarVisible = true;
- if (getScoutObject() instanceof IMobileTableField) {
- actionBarVisible = ((IMobileTableField) getScoutObject()).isActionBarVisible();
- }
-
- if (actionBarVisible) {
- RwtScoutTableActionBar actionBar = new RwtScoutTableActionBar();
- actionBar.createUiField(getUiContainer(), getScoutObject(), getUiEnvironment());
- return actionBar;
- }
-
- return null;
- }
-
- @Override
- protected void detachScout() {
- disposeMobileTable();
-
- super.detachScout();
- }
-
- private void disposeMobileTable() {
- if (m_mobileTable == null) {
- return;
- }
-
- Runnable job = new Runnable() {
-
- @Override
- public void run() {
- if (m_mobileTable == null) {
- return;
- }
-
- m_mobileTable.dispose();
- m_mobileTable = null;
- }
-
- };
-
- getUiEnvironment().invokeScoutLater(job, 0);
- }
-
- /**
- * Returns true if the table is directly embedded into the field. In other words: Returns true if there is no parent
- * groupbox with a visible border.
- */
- @Override
- protected boolean dontCreateTableContainer() {
- if (getScoutObject() == null) {
- return false;
- }
-
- return !isAnyBorderVisible(getScoutObject().getParentGroupBox());
- }
-
- private boolean isAnyBorderVisible(IGroupBox groupBox) {
- while (groupBox != null) {
- if (groupBox.isBorderVisible()) {
- return true;
- }
- groupBox = groupBox.getParentGroupBox();
- }
-
- return false;
- }
-
- @Override
- protected IRwtTableStatus createRwtTableStatus() {
- return new RwtMobileTableStatus(getUiContainer(), getUiEnvironment(), getScoutObject());
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.mobile.form.fields.tablefield;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.scout.commons.holders.Holder;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.mobile.ui.basic.table.MobileTable;
+import org.eclipse.scout.rt.client.mobile.ui.form.fields.table.IMobileTableField;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox;
+import org.eclipse.scout.rt.ui.rap.basic.table.IRwtScoutTable;
+import org.eclipse.scout.rt.ui.rap.form.fields.tablefield.IRwtTableStatus;
+import org.eclipse.scout.rt.ui.rap.form.fields.tablefield.RwtScoutTableField;
+import org.eclipse.scout.rt.ui.rap.window.desktop.IRwtScoutActionBar;
+
+/**
+ * @since 3.9.0
+ */
+public class RwtScoutMobileTableField extends RwtScoutTableField {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(RwtScoutMobileTableField.class);
+
+ private MobileTable m_mobileTable;
+ private boolean m_columnTransformationEnabled;
+
+ public RwtScoutMobileTableField() {
+ this(true);
+ }
+
+ public RwtScoutMobileTableField(boolean columnTransformationEnabled) {
+ m_columnTransformationEnabled = columnTransformationEnabled;
+ }
+
+ @Override
+ protected IRwtScoutTable createRwtScoutTable() {
+ return new RwtScoutList();
+ }
+
+ @Override
+ protected void setTableFromScout(ITable table) {
+ if (!m_columnTransformationEnabled) {
+ super.setTableFromScout(table);
+ return;
+ }
+
+ disposeMobileTable();
+
+ if (table == null) {
+ super.setTableFromScout(table);
+ return;
+ }
+ else {
+ m_mobileTable = wrapTable(table);
+ super.setTableFromScout(m_mobileTable);
+ }
+ }
+
+ private MobileTable wrapTable(final ITable table) {
+ final Holder<MobileTable> holder = new Holder<MobileTable>(MobileTable.class);
+
+ ClientSyncJob job = new ClientSyncJob("", getUiEnvironment().getClientSession()) {
+ @Override
+ protected void runVoid(IProgressMonitor monitor) throws Throwable {
+ MobileTable wrapperTable = new MobileTable(table);
+ try {
+ wrapperTable.setTableChanging(true);
+ wrapperTable.setTableRowFormDisplayHint(getScoutObject().getForm().getDisplayHint());
+ wrapperTable.setTableRowFormDisplayViewId(getScoutObject().getForm().getDisplayViewId());
+ wrapperTable.initTable();
+ }
+ finally {
+ wrapperTable.setTableChanging(false);
+ }
+ holder.setValue(wrapperTable);
+ }
+ };
+ job.schedule();
+
+ try {
+ //TODO CGU: this freezes the gui if initializing of the table takes a while. Async table creation possible?
+ job.join();
+ }
+ catch (InterruptedException e) {
+ LOG.error("Table wrapping interrupted. ", e);
+ }
+
+ return holder.getValue();
+ }
+
+ @Override
+ protected IRwtScoutActionBar createRwtScoutActionBar() {
+ boolean actionBarVisible = true;
+ if (getScoutObject() instanceof IMobileTableField) {
+ actionBarVisible = ((IMobileTableField) getScoutObject()).isActionBarVisible();
+ }
+
+ if (actionBarVisible) {
+ RwtScoutTableActionBar actionBar = new RwtScoutTableActionBar();
+ actionBar.createUiField(getUiContainer(), getScoutObject(), getUiEnvironment());
+ return actionBar;
+ }
+
+ return null;
+ }
+
+ @Override
+ protected void detachScout() {
+ disposeMobileTable();
+
+ super.detachScout();
+ }
+
+ private void disposeMobileTable() {
+ if (m_mobileTable == null) {
+ return;
+ }
+
+ Runnable job = new Runnable() {
+
+ @Override
+ public void run() {
+ if (m_mobileTable == null) {
+ return;
+ }
+
+ m_mobileTable.dispose();
+ m_mobileTable = null;
+ }
+
+ };
+
+ getUiEnvironment().invokeScoutLater(job, 0);
+ }
+
+ /**
+ * Returns true if the table is directly embedded into the field. In other words: Returns true if there is no parent
+ * groupbox with a visible border.
+ */
+ @Override
+ protected boolean dontCreateTableContainer() {
+ if (getScoutObject() == null) {
+ return false;
+ }
+
+ return !isAnyBorderVisible(getScoutObject().getParentGroupBox());
+ }
+
+ private boolean isAnyBorderVisible(IGroupBox groupBox) {
+ while (groupBox != null) {
+ if (groupBox.isBorderVisible()) {
+ return true;
+ }
+ groupBox = groupBox.getParentGroupBox();
+ }
+
+ return false;
+ }
+
+ @Override
+ protected IRwtTableStatus createRwtTableStatus() {
+ return new RwtMobileTableStatus(getUiContainer(), getUiEnvironment(), getScoutObject());
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/tablefield/RwtScoutTableActionBar.java b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/tablefield/RwtScoutTableActionBar.java
index bd7d367465..bc160a19d9 100644
--- a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/tablefield/RwtScoutTableActionBar.java
+++ b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/tablefield/RwtScoutTableActionBar.java
@@ -1,170 +1,170 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.mobile.form.fields.tablefield;
-
-import java.util.Arrays;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.scout.rt.client.mobile.ui.action.ActionButtonBarUtility;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.basic.table.TableAdapter;
-import org.eclipse.scout.rt.client.ui.basic.table.TableEvent;
-import org.eclipse.scout.rt.client.ui.form.fields.smartfield.ISmartFieldProposalForm;
-import org.eclipse.scout.rt.client.ui.form.fields.tablefield.ITableField;
-import org.eclipse.scout.rt.ui.rap.LogicalGridData;
-import org.eclipse.scout.rt.ui.rap.RwtMenuUtility;
-import org.eclipse.scout.rt.ui.rap.form.fields.LogicalGridDataBuilder;
-import org.eclipse.scout.rt.ui.rap.mobile.action.AbstractRwtScoutActionBar;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * @since 3.9.0
- */
-public class RwtScoutTableActionBar extends AbstractRwtScoutActionBar<ITableField<? extends ITable>> {
- private static final String VARIANT_SMART_FIELD_ACTION_BAR = "smartFieldActionBar";
- private P_TableRowSelectionListener m_rowSelectionListener;
- private ITable m_table;
-
- public RwtScoutTableActionBar() {
- setMenuOpeningDirection(SWT.UP);
- }
-
- @Override
- protected void initLayout(Composite container) {
- super.initLayout(container);
-
- int tableStatusGridH = 1;
- LogicalGridData tableGridData = LogicalGridDataBuilder.createField(getScoutObject().getGridData());
- LogicalGridData gd = new LogicalGridData();
- gd.gridx = tableGridData.gridx;
- gd.gridy = tableGridData.gridy + tableGridData.gridh + tableStatusGridH;
- gd.gridw = tableGridData.gridw;
- gd.topInset = 0;
- gd.gridh = 1;
- if (getHeightHint() != null) {
- gd.heightHint = getHeightHint();
- }
- else {
- gd.useUiHeight = true;
- }
- gd.weightx = tableGridData.weightx;
- gd.weighty = 0.0;
- gd.fillHorizontal = true;
- container.setLayoutData(gd);
- }
-
- @Override
- protected String getActionBarContainerVariant() {
- if (getScoutObject().getForm() instanceof ISmartFieldProposalForm) {
- return VARIANT_SMART_FIELD_ACTION_BAR;
- }
-
- return super.getActionBarContainerVariant();
- }
-
- @Override
- protected void collectMenusForLeftButtonBar(List<IMenu> menuList) {
- ITable table = getScoutObject().getTable();
- if (table == null) {
- return;
- }
-
- IMenu[] emptySpaceMenus = RwtMenuUtility.collectEmptySpaceMenus(table, getUiEnvironment());
- if (emptySpaceMenus != null) {
- menuList.addAll(Arrays.asList(emptySpaceMenus));
- }
-
- if (table.getSelectedRowCount() > 0) {
- IMenu[] rowMenus = RwtMenuUtility.collectRowMenus(table, getUiEnvironment());
- if (rowMenus != null) {
- List<IMenu> rowMenuList = new LinkedList<IMenu>(Arrays.asList(rowMenus));
-
- ActionButtonBarUtility.distributeRowActions(menuList, emptySpaceMenus, rowMenuList);
-
- //Add remaining row menus
- menuList.addAll(rowMenuList);
- }
- }
- }
-
- @Override
- protected void collectMenusForRightButtonBar(List<IMenu> menuList) {
-
- }
-
- @Override
- protected void attachScout() {
- super.attachScout();
-
- m_table = getScoutObject().getTable();
-
- addRowSelectionListener(m_table);
- }
-
- @Override
- protected void detachScout() {
- super.detachScout();
-
- removeRowSelectionListener(m_table);
-
- m_table = null;
- }
-
- private void addRowSelectionListener(ITable table) {
- if (m_rowSelectionListener != null || table == null) {
- return;
- }
-
- m_rowSelectionListener = new P_TableRowSelectionListener();
- table.addTableListener(m_rowSelectionListener);
- }
-
- private void removeRowSelectionListener(ITable table) {
- if (m_rowSelectionListener == null || table == null) {
- return;
- }
-
- table.removeTableListener(m_rowSelectionListener);
- m_rowSelectionListener = null;
- }
-
- @Override
- protected void handleScoutPropertyChange(String name, Object newValue) {
- super.handleScoutPropertyChange(name, newValue);
-
- if (name.equals(ITableField.PROP_TABLE)) {
- removeRowSelectionListener(m_table);
-
- m_table = (ITable) newValue;
-
- addRowSelectionListener(m_table);
- }
- }
-
- private class P_TableRowSelectionListener extends TableAdapter {
-
- @Override
- public void tableChanged(TableEvent e) {
- if (e.getType() == TableEvent.TYPE_ROWS_SELECTED) {
- rowSelected();
- }
- }
-
- private void rowSelected() {
- rebuildContentFromScout();
- }
-
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.mobile.form.fields.tablefield;
+
+import java.util.Arrays;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.scout.rt.client.mobile.ui.action.ActionButtonBarUtility;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.basic.table.TableAdapter;
+import org.eclipse.scout.rt.client.ui.basic.table.TableEvent;
+import org.eclipse.scout.rt.client.ui.form.fields.smartfield.ISmartFieldProposalForm;
+import org.eclipse.scout.rt.client.ui.form.fields.tablefield.ITableField;
+import org.eclipse.scout.rt.ui.rap.LogicalGridData;
+import org.eclipse.scout.rt.ui.rap.RwtMenuUtility;
+import org.eclipse.scout.rt.ui.rap.form.fields.LogicalGridDataBuilder;
+import org.eclipse.scout.rt.ui.rap.mobile.action.AbstractRwtScoutActionBar;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * @since 3.9.0
+ */
+public class RwtScoutTableActionBar extends AbstractRwtScoutActionBar<ITableField<? extends ITable>> {
+ private static final String VARIANT_SMART_FIELD_ACTION_BAR = "smartFieldActionBar";
+ private P_TableRowSelectionListener m_rowSelectionListener;
+ private ITable m_table;
+
+ public RwtScoutTableActionBar() {
+ setMenuOpeningDirection(SWT.UP);
+ }
+
+ @Override
+ protected void initLayout(Composite container) {
+ super.initLayout(container);
+
+ int tableStatusGridH = 1;
+ LogicalGridData tableGridData = LogicalGridDataBuilder.createField(getScoutObject().getGridData());
+ LogicalGridData gd = new LogicalGridData();
+ gd.gridx = tableGridData.gridx;
+ gd.gridy = tableGridData.gridy + tableGridData.gridh + tableStatusGridH;
+ gd.gridw = tableGridData.gridw;
+ gd.topInset = 0;
+ gd.gridh = 1;
+ if (getHeightHint() != null) {
+ gd.heightHint = getHeightHint();
+ }
+ else {
+ gd.useUiHeight = true;
+ }
+ gd.weightx = tableGridData.weightx;
+ gd.weighty = 0.0;
+ gd.fillHorizontal = true;
+ container.setLayoutData(gd);
+ }
+
+ @Override
+ protected String getActionBarContainerVariant() {
+ if (getScoutObject().getForm() instanceof ISmartFieldProposalForm) {
+ return VARIANT_SMART_FIELD_ACTION_BAR;
+ }
+
+ return super.getActionBarContainerVariant();
+ }
+
+ @Override
+ protected void collectMenusForLeftButtonBar(List<IMenu> menuList) {
+ ITable table = getScoutObject().getTable();
+ if (table == null) {
+ return;
+ }
+
+ IMenu[] emptySpaceMenus = RwtMenuUtility.collectEmptySpaceMenus(table, getUiEnvironment());
+ if (emptySpaceMenus != null) {
+ menuList.addAll(Arrays.asList(emptySpaceMenus));
+ }
+
+ if (table.getSelectedRowCount() > 0) {
+ IMenu[] rowMenus = RwtMenuUtility.collectRowMenus(table, getUiEnvironment());
+ if (rowMenus != null) {
+ List<IMenu> rowMenuList = new LinkedList<IMenu>(Arrays.asList(rowMenus));
+
+ ActionButtonBarUtility.distributeRowActions(menuList, emptySpaceMenus, rowMenuList);
+
+ //Add remaining row menus
+ menuList.addAll(rowMenuList);
+ }
+ }
+ }
+
+ @Override
+ protected void collectMenusForRightButtonBar(List<IMenu> menuList) {
+
+ }
+
+ @Override
+ protected void attachScout() {
+ super.attachScout();
+
+ m_table = getScoutObject().getTable();
+
+ addRowSelectionListener(m_table);
+ }
+
+ @Override
+ protected void detachScout() {
+ super.detachScout();
+
+ removeRowSelectionListener(m_table);
+
+ m_table = null;
+ }
+
+ private void addRowSelectionListener(ITable table) {
+ if (m_rowSelectionListener != null || table == null) {
+ return;
+ }
+
+ m_rowSelectionListener = new P_TableRowSelectionListener();
+ table.addTableListener(m_rowSelectionListener);
+ }
+
+ private void removeRowSelectionListener(ITable table) {
+ if (m_rowSelectionListener == null || table == null) {
+ return;
+ }
+
+ table.removeTableListener(m_rowSelectionListener);
+ m_rowSelectionListener = null;
+ }
+
+ @Override
+ protected void handleScoutPropertyChange(String name, Object newValue) {
+ super.handleScoutPropertyChange(name, newValue);
+
+ if (name.equals(ITableField.PROP_TABLE)) {
+ removeRowSelectionListener(m_table);
+
+ m_table = (ITable) newValue;
+
+ addRowSelectionListener(m_table);
+ }
+ }
+
+ private class P_TableRowSelectionListener extends TableAdapter {
+
+ @Override
+ public void tableChanged(TableEvent e) {
+ if (e.getType() == TableEvent.TYPE_ROWS_SELECTED) {
+ rowSelected();
+ }
+ }
+
+ private void rowSelected() {
+ rebuildContentFromScout();
+ }
+
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/treefield/MobileTreeFieldFactory.java b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/treefield/MobileTreeFieldFactory.java
index bf8a394bcb..19c5645bfd 100644
--- a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/treefield/MobileTreeFieldFactory.java
+++ b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/treefield/MobileTreeFieldFactory.java
@@ -1,45 +1,45 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.mobile.form.fields.treefield;
-
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.treefield.ITreeField;
-import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
-import org.eclipse.scout.rt.ui.rap.extension.IFormFieldFactory;
-import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
-import org.eclipse.scout.rt.ui.rap.form.fields.treefield.IRwtScoutTreeField;
-import org.eclipse.scout.rt.ui.rap.form.fields.treefield.RwtScoutTreeField;
-import org.eclipse.scout.rt.ui.rap.util.DeviceUtility;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * @since 3.9.0
- */
-public class MobileTreeFieldFactory implements IFormFieldFactory {
-
- @Override
- public IRwtScoutFormField<?> createUiFormField(Composite parent, IFormField model, IRwtEnvironment uiEnvironment) {
- IRwtScoutTreeField field;
-
- if (DeviceUtility.isMobileOrTabletDevice()) {
- field = new RwtScoutMobileTreeField();
- }
- else {
- field = new RwtScoutTreeField();
- }
-
- ITreeField treeField = (ITreeField) model;
- field.createUiField(parent, treeField, uiEnvironment);
-
- return field;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.mobile.form.fields.treefield;
+
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.treefield.ITreeField;
+import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
+import org.eclipse.scout.rt.ui.rap.extension.IFormFieldFactory;
+import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
+import org.eclipse.scout.rt.ui.rap.form.fields.treefield.IRwtScoutTreeField;
+import org.eclipse.scout.rt.ui.rap.form.fields.treefield.RwtScoutTreeField;
+import org.eclipse.scout.rt.ui.rap.util.DeviceUtility;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * @since 3.9.0
+ */
+public class MobileTreeFieldFactory implements IFormFieldFactory {
+
+ @Override
+ public IRwtScoutFormField<?> createUiFormField(Composite parent, IFormField model, IRwtEnvironment uiEnvironment) {
+ IRwtScoutTreeField field;
+
+ if (DeviceUtility.isMobileOrTabletDevice()) {
+ field = new RwtScoutMobileTreeField();
+ }
+ else {
+ field = new RwtScoutTreeField();
+ }
+
+ ITreeField treeField = (ITreeField) model;
+ field.createUiField(parent, treeField, uiEnvironment);
+
+ return field;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/treefield/RwtScoutMobileTreeField.java b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/treefield/RwtScoutMobileTreeField.java
index 620d8540cf..44968babb2 100644
--- a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/treefield/RwtScoutMobileTreeField.java
+++ b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/treefield/RwtScoutMobileTreeField.java
@@ -1,27 +1,27 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.mobile.form.fields.treefield;
-
-import org.eclipse.scout.rt.ui.rap.form.fields.treefield.RwtScoutTreeField;
-import org.eclipse.scout.rt.ui.rap.window.desktop.IRwtScoutActionBar;
-
-/**
- * @since 3.9.0
- */
-public class RwtScoutMobileTreeField extends RwtScoutTreeField {
-
- @Override
- protected IRwtScoutActionBar createRwtScoutActionBar() {
- RwtScoutTreeActionBar actionBar = new RwtScoutTreeActionBar();
- actionBar.createUiField(getUiContainer(), getScoutObject(), getUiEnvironment());
- return actionBar;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.mobile.form.fields.treefield;
+
+import org.eclipse.scout.rt.ui.rap.form.fields.treefield.RwtScoutTreeField;
+import org.eclipse.scout.rt.ui.rap.window.desktop.IRwtScoutActionBar;
+
+/**
+ * @since 3.9.0
+ */
+public class RwtScoutMobileTreeField extends RwtScoutTreeField {
+
+ @Override
+ protected IRwtScoutActionBar createRwtScoutActionBar() {
+ RwtScoutTreeActionBar actionBar = new RwtScoutTreeActionBar();
+ actionBar.createUiField(getUiContainer(), getScoutObject(), getUiEnvironment());
+ return actionBar;
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/treefield/RwtScoutTreeActionBar.java b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/treefield/RwtScoutTreeActionBar.java
index ee41cc9385..2846c8e423 100644
--- a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/treefield/RwtScoutTreeActionBar.java
+++ b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/form/fields/treefield/RwtScoutTreeActionBar.java
@@ -1,154 +1,154 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.mobile.form.fields.treefield;
-
-import java.util.Arrays;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.scout.rt.client.mobile.ui.action.ActionButtonBarUtility;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITree;
-import org.eclipse.scout.rt.client.ui.basic.tree.TreeAdapter;
-import org.eclipse.scout.rt.client.ui.basic.tree.TreeEvent;
-import org.eclipse.scout.rt.client.ui.form.fields.treefield.ITreeField;
-import org.eclipse.scout.rt.ui.rap.LogicalGridData;
-import org.eclipse.scout.rt.ui.rap.RwtMenuUtility;
-import org.eclipse.scout.rt.ui.rap.form.fields.LogicalGridDataBuilder;
-import org.eclipse.scout.rt.ui.rap.mobile.action.AbstractRwtScoutActionBar;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * @since 3.9.0
- */
-public class RwtScoutTreeActionBar extends AbstractRwtScoutActionBar<ITreeField> {
- private P_TreeNodeSelectionListener m_nodeSelectionListener;
- private ITree m_tree;
-
- public RwtScoutTreeActionBar() {
- setMenuOpeningDirection(SWT.UP);
- }
-
- @Override
- protected void initLayout(Composite container) {
- super.initLayout(container);
-
- LogicalGridData tableGridData = LogicalGridDataBuilder.createField(getScoutObject().getGridData());
- LogicalGridData gd = new LogicalGridData();
- gd.gridx = tableGridData.gridx;
- gd.gridy = tableGridData.gridy + tableGridData.gridh;
- gd.gridw = tableGridData.gridw;
- gd.topInset = 0;
- gd.gridh = 1;
- if (getHeightHint() != null) {
- gd.heightHint = getHeightHint();
- }
- else {
- gd.useUiHeight = true;
- }
- gd.weightx = tableGridData.weightx;
- gd.weighty = 0.0;
- gd.fillHorizontal = true;
- container.setLayoutData(gd);
- }
-
- @Override
- protected void collectMenusForLeftButtonBar(List<IMenu> menuList) {
- ITree tree = getScoutObject().getTree();
- if (tree == null) {
- return;
- }
-
- IMenu[] emptySpaceMenus = RwtMenuUtility.collectEmptySpaceMenus(tree, getUiEnvironment());
- if (emptySpaceMenus != null) {
- menuList.addAll(Arrays.asList(emptySpaceMenus));
- }
-
- IMenu[] rowMenus = RwtMenuUtility.collectNodeMenus(tree, getUiEnvironment());
- if (rowMenus != null) {
- List<IMenu> rowMenuList = new LinkedList<IMenu>(Arrays.asList(rowMenus));
-
- ActionButtonBarUtility.distributeRowActions(menuList, emptySpaceMenus, rowMenuList);
-
- //Add remaining row menus
- menuList.addAll(rowMenuList);
- }
- }
-
- @Override
- protected void collectMenusForRightButtonBar(List<IMenu> menuList) {
- }
-
- @Override
- protected void attachScout() {
- super.attachScout();
-
- m_tree = getScoutObject().getTree();
-
- addRowSelectionListener(m_tree);
- }
-
- @Override
- protected void detachScout() {
- super.detachScout();
-
- removeRowSelectionListener(m_tree);
-
- m_tree = null;
- }
-
- private void addRowSelectionListener(ITree tree) {
- if (m_nodeSelectionListener != null || tree == null) {
- return;
- }
-
- m_nodeSelectionListener = new P_TreeNodeSelectionListener();
- tree.addTreeListener(m_nodeSelectionListener);
- }
-
- private void removeRowSelectionListener(ITree tree) {
- if (m_nodeSelectionListener == null || tree == null) {
- return;
- }
-
- tree.removeTreeListener(m_nodeSelectionListener);
- m_nodeSelectionListener = null;
- }
-
- @Override
- protected void handleScoutPropertyChange(String name, Object newValue) {
- super.handleScoutPropertyChange(name, newValue);
- if (name.equals(ITreeField.PROP_TREE)) {
- removeRowSelectionListener(m_tree);
-
- m_tree = (ITree) newValue;
-
- addRowSelectionListener(m_tree);
- }
- }
-
- private class P_TreeNodeSelectionListener extends TreeAdapter {
-
- @Override
- public void treeChanged(TreeEvent e) {
- if (e.getType() == TreeEvent.TYPE_NODES_SELECTED) {
- rowSelected();
- }
- }
-
- private void rowSelected() {
- rebuildContentFromScout();
- }
-
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.mobile.form.fields.treefield;
+
+import java.util.Arrays;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.scout.rt.client.mobile.ui.action.ActionButtonBarUtility;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITree;
+import org.eclipse.scout.rt.client.ui.basic.tree.TreeAdapter;
+import org.eclipse.scout.rt.client.ui.basic.tree.TreeEvent;
+import org.eclipse.scout.rt.client.ui.form.fields.treefield.ITreeField;
+import org.eclipse.scout.rt.ui.rap.LogicalGridData;
+import org.eclipse.scout.rt.ui.rap.RwtMenuUtility;
+import org.eclipse.scout.rt.ui.rap.form.fields.LogicalGridDataBuilder;
+import org.eclipse.scout.rt.ui.rap.mobile.action.AbstractRwtScoutActionBar;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * @since 3.9.0
+ */
+public class RwtScoutTreeActionBar extends AbstractRwtScoutActionBar<ITreeField> {
+ private P_TreeNodeSelectionListener m_nodeSelectionListener;
+ private ITree m_tree;
+
+ public RwtScoutTreeActionBar() {
+ setMenuOpeningDirection(SWT.UP);
+ }
+
+ @Override
+ protected void initLayout(Composite container) {
+ super.initLayout(container);
+
+ LogicalGridData tableGridData = LogicalGridDataBuilder.createField(getScoutObject().getGridData());
+ LogicalGridData gd = new LogicalGridData();
+ gd.gridx = tableGridData.gridx;
+ gd.gridy = tableGridData.gridy + tableGridData.gridh;
+ gd.gridw = tableGridData.gridw;
+ gd.topInset = 0;
+ gd.gridh = 1;
+ if (getHeightHint() != null) {
+ gd.heightHint = getHeightHint();
+ }
+ else {
+ gd.useUiHeight = true;
+ }
+ gd.weightx = tableGridData.weightx;
+ gd.weighty = 0.0;
+ gd.fillHorizontal = true;
+ container.setLayoutData(gd);
+ }
+
+ @Override
+ protected void collectMenusForLeftButtonBar(List<IMenu> menuList) {
+ ITree tree = getScoutObject().getTree();
+ if (tree == null) {
+ return;
+ }
+
+ IMenu[] emptySpaceMenus = RwtMenuUtility.collectEmptySpaceMenus(tree, getUiEnvironment());
+ if (emptySpaceMenus != null) {
+ menuList.addAll(Arrays.asList(emptySpaceMenus));
+ }
+
+ IMenu[] rowMenus = RwtMenuUtility.collectNodeMenus(tree, getUiEnvironment());
+ if (rowMenus != null) {
+ List<IMenu> rowMenuList = new LinkedList<IMenu>(Arrays.asList(rowMenus));
+
+ ActionButtonBarUtility.distributeRowActions(menuList, emptySpaceMenus, rowMenuList);
+
+ //Add remaining row menus
+ menuList.addAll(rowMenuList);
+ }
+ }
+
+ @Override
+ protected void collectMenusForRightButtonBar(List<IMenu> menuList) {
+ }
+
+ @Override
+ protected void attachScout() {
+ super.attachScout();
+
+ m_tree = getScoutObject().getTree();
+
+ addRowSelectionListener(m_tree);
+ }
+
+ @Override
+ protected void detachScout() {
+ super.detachScout();
+
+ removeRowSelectionListener(m_tree);
+
+ m_tree = null;
+ }
+
+ private void addRowSelectionListener(ITree tree) {
+ if (m_nodeSelectionListener != null || tree == null) {
+ return;
+ }
+
+ m_nodeSelectionListener = new P_TreeNodeSelectionListener();
+ tree.addTreeListener(m_nodeSelectionListener);
+ }
+
+ private void removeRowSelectionListener(ITree tree) {
+ if (m_nodeSelectionListener == null || tree == null) {
+ return;
+ }
+
+ tree.removeTreeListener(m_nodeSelectionListener);
+ m_nodeSelectionListener = null;
+ }
+
+ @Override
+ protected void handleScoutPropertyChange(String name, Object newValue) {
+ super.handleScoutPropertyChange(name, newValue);
+ if (name.equals(ITreeField.PROP_TREE)) {
+ removeRowSelectionListener(m_tree);
+
+ m_tree = (ITree) newValue;
+
+ addRowSelectionListener(m_tree);
+ }
+ }
+
+ private class P_TreeNodeSelectionListener extends TreeAdapter {
+
+ @Override
+ public void treeChanged(TreeEvent e) {
+ if (e.getType() == TreeEvent.TYPE_NODES_SELECTED) {
+ rowSelected();
+ }
+ }
+
+ private void rowSelected() {
+ rebuildContentFromScout();
+ }
+
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/window/MobileBrowserWindowHandler.java b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/window/MobileBrowserWindowHandler.java
index fb6272bceb..b3d8ea4248 100644
--- a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/window/MobileBrowserWindowHandler.java
+++ b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/window/MobileBrowserWindowHandler.java
@@ -1,43 +1,43 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.mobile.window;
-
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.rt.ui.rap.window.BrowserWindowHandler;
-
-/**
- * @since 3.9.0
- */
-public class MobileBrowserWindowHandler extends BrowserWindowHandler {
-
- @Override
- public void openLink(String link) {
- if (link == null) {
- return;
- }
-
- if (isMapsLink(link)) {
- //Open the link in the same browser window to open the maps app. Otherwise the popup gets blocked without notice.
- openLinkInSameBrowserWindow(link);
- }
- else {
- super.openLink(link);
- }
- }
-
- public boolean isMapsLink(String link) {
- if ((StringUtility.find(link, "http://maps.google.com") >= 0) || (StringUtility.find(link, "https://maps.google.com") >= 0)) {
- return true;
- }
-
- return false;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.mobile.window;
+
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.rt.ui.rap.window.BrowserWindowHandler;
+
+/**
+ * @since 3.9.0
+ */
+public class MobileBrowserWindowHandler extends BrowserWindowHandler {
+
+ @Override
+ public void openLink(String link) {
+ if (link == null) {
+ return;
+ }
+
+ if (isMapsLink(link)) {
+ //Open the link in the same browser window to open the maps app. Otherwise the popup gets blocked without notice.
+ openLinkInSameBrowserWindow(link);
+ }
+ else {
+ super.openLink(link);
+ }
+ }
+
+ public boolean isMapsLink(String link) {
+ if ((StringUtility.find(link, "http://maps.google.com") >= 0) || (StringUtility.find(link, "https://maps.google.com") >= 0)) {
+ return true;
+ }
+
+ return false;
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/window/desktop/FormBasedDesktopFormBoundsProvider.java b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/window/desktop/FormBasedDesktopFormBoundsProvider.java
index 4794896bf2..34211ead6f 100644
--- a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/window/desktop/FormBasedDesktopFormBoundsProvider.java
+++ b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/window/desktop/FormBasedDesktopFormBoundsProvider.java
@@ -1,62 +1,62 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.mobile.window.desktop;
-
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.client.ui.form.fields.GridData;
-import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
-import org.eclipse.scout.rt.ui.rap.window.IFormBoundsProvider;
-import org.eclipse.swt.graphics.Rectangle;
-
-/**
- * Reads the width and height specified in the {@link GridData} of the main group box ({@link IForm#getRootGroupBox()}).
- * If nothing is specified null will be returned.
- * <p>
- * The bounds are not cached.
- *
- * @since 3.9.0
- */
-public class FormBasedDesktopFormBoundsProvider implements IFormBoundsProvider {
- private final IForm m_form;
- private IRwtEnvironment m_uiEnvironment;
-
- public FormBasedDesktopFormBoundsProvider(IForm form, IRwtEnvironment uiEnvironment) {
- m_form = form;
- m_uiEnvironment = uiEnvironment;
- }
-
- @Override
- public Rectangle getBounds() {
- int maxWidth = -1;
- int maxHeight = -1;
-
- GridData gridData = m_form.getRootGroupBox().getGridData();
- if (gridData.widthInPixel > 0) {
- maxWidth = gridData.widthInPixel;
- }
- if (gridData.heightInPixel > 0) {
- maxHeight = gridData.heightInPixel;
- }
-
- if (maxWidth == -1 && maxHeight == -1) {
- return null;
- }
- else {
- return new Rectangle(-1, -1, maxWidth, maxHeight);
- }
- }
-
- @Override
- public void storeBounds(Rectangle bounds) {
- // nop
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.mobile.window.desktop;
+
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.client.ui.form.fields.GridData;
+import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
+import org.eclipse.scout.rt.ui.rap.window.IFormBoundsProvider;
+import org.eclipse.swt.graphics.Rectangle;
+
+/**
+ * Reads the width and height specified in the {@link GridData} of the main group box ({@link IForm#getRootGroupBox()}).
+ * If nothing is specified null will be returned.
+ * <p>
+ * The bounds are not cached.
+ *
+ * @since 3.9.0
+ */
+public class FormBasedDesktopFormBoundsProvider implements IFormBoundsProvider {
+ private final IForm m_form;
+ private IRwtEnvironment m_uiEnvironment;
+
+ public FormBasedDesktopFormBoundsProvider(IForm form, IRwtEnvironment uiEnvironment) {
+ m_form = form;
+ m_uiEnvironment = uiEnvironment;
+ }
+
+ @Override
+ public Rectangle getBounds() {
+ int maxWidth = -1;
+ int maxHeight = -1;
+
+ GridData gridData = m_form.getRootGroupBox().getGridData();
+ if (gridData.widthInPixel > 0) {
+ maxWidth = gridData.widthInPixel;
+ }
+ if (gridData.heightInPixel > 0) {
+ maxHeight = gridData.heightInPixel;
+ }
+
+ if (maxWidth == -1 && maxHeight == -1) {
+ return null;
+ }
+ else {
+ return new Rectangle(-1, -1, maxWidth, maxHeight);
+ }
+ }
+
+ @Override
+ public void storeBounds(Rectangle bounds) {
+ // nop
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/window/desktop/MobileViewArea.java b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/window/desktop/MobileViewArea.java
index 49a209bfcb..63f065b4ff 100644
--- a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/window/desktop/MobileViewArea.java
+++ b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/window/desktop/MobileViewArea.java
@@ -1,77 +1,77 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.mobile.window.desktop;
-
-import java.util.List;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.scout.commons.holders.BooleanHolder;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.mobile.transformation.IDeviceTransformationService;
-import org.eclipse.scout.rt.ui.rap.window.desktop.RwtScoutViewStack;
-import org.eclipse.scout.rt.ui.rap.window.desktop.viewarea.ViewArea;
-import org.eclipse.scout.service.SERVICES;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Sash;
-
-/**
- * @since 3.9.0
- */
-public class MobileViewArea extends ViewArea {
-
- private static final long serialVersionUID = 1L;
-
- public MobileViewArea(Composite parent) {
- super(parent);
- }
-
- @Override
- protected RwtScoutViewStack createRwtScoutViewStack(Composite parent) {
- return new RwtScoutMobileViewStack(parent, getUiEnvironment(), this);
- }
-
- @Override
- protected Sash createSash(Composite parent, int style) {
- SimpleSash simpleSash = new SimpleSash(parent, style);
- return simpleSash;
- }
-
- @Override
- protected int getSashWidth() {
- return 1;
- }
-
- @Override
- protected boolean acceptViewId(final String viewId) {
- final BooleanHolder accepted = new BooleanHolder(true);
-
- ClientSyncJob job = new ClientSyncJob("Adapting form header left menus", getUiEnvironment().getClientSession()) {
-
- @Override
- protected void runVoid(IProgressMonitor monitor) throws Throwable {
- IDeviceTransformationService service = SERVICES.getService(IDeviceTransformationService.class);
- if (service != null && service.getDeviceTransformer() != null) {
- List<String> acceptedViewIds = service.getDeviceTransformer().getAcceptedViewIds();
-
- //Accept all if null is returned.
- if (acceptedViewIds != null) {
- accepted.setValue(acceptedViewIds.contains(viewId));
- }
- }
- }
-
- };
- job.runNow(new NullProgressMonitor());
-
- return accepted.getValue();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.mobile.window.desktop;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.scout.commons.holders.BooleanHolder;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.mobile.transformation.IDeviceTransformationService;
+import org.eclipse.scout.rt.ui.rap.window.desktop.RwtScoutViewStack;
+import org.eclipse.scout.rt.ui.rap.window.desktop.viewarea.ViewArea;
+import org.eclipse.scout.service.SERVICES;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Sash;
+
+/**
+ * @since 3.9.0
+ */
+public class MobileViewArea extends ViewArea {
+
+ private static final long serialVersionUID = 1L;
+
+ public MobileViewArea(Composite parent) {
+ super(parent);
+ }
+
+ @Override
+ protected RwtScoutViewStack createRwtScoutViewStack(Composite parent) {
+ return new RwtScoutMobileViewStack(parent, getUiEnvironment(), this);
+ }
+
+ @Override
+ protected Sash createSash(Composite parent, int style) {
+ SimpleSash simpleSash = new SimpleSash(parent, style);
+ return simpleSash;
+ }
+
+ @Override
+ protected int getSashWidth() {
+ return 1;
+ }
+
+ @Override
+ protected boolean acceptViewId(final String viewId) {
+ final BooleanHolder accepted = new BooleanHolder(true);
+
+ ClientSyncJob job = new ClientSyncJob("Adapting form header left menus", getUiEnvironment().getClientSession()) {
+
+ @Override
+ protected void runVoid(IProgressMonitor monitor) throws Throwable {
+ IDeviceTransformationService service = SERVICES.getService(IDeviceTransformationService.class);
+ if (service != null && service.getDeviceTransformer() != null) {
+ List<String> acceptedViewIds = service.getDeviceTransformer().getAcceptedViewIds();
+
+ //Accept all if null is returned.
+ if (acceptedViewIds != null) {
+ accepted.setValue(acceptedViewIds.contains(viewId));
+ }
+ }
+ }
+
+ };
+ job.runNow(new NullProgressMonitor());
+
+ return accepted.getValue();
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/window/desktop/RwtScoutMobileDesktop.java b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/window/desktop/RwtScoutMobileDesktop.java
index f94f0c6f54..77ba87971d 100644
--- a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/window/desktop/RwtScoutMobileDesktop.java
+++ b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/window/desktop/RwtScoutMobileDesktop.java
@@ -1,36 +1,36 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.mobile.window.desktop;
-
-import org.eclipse.scout.rt.ui.rap.window.desktop.RwtScoutDesktop;
-import org.eclipse.scout.rt.ui.rap.window.desktop.viewarea.ViewArea;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-/**
- * @since 3.9.0
- */
-public class RwtScoutMobileDesktop extends RwtScoutDesktop {
-
- /**
- * On mobile devices every form has a form header, the outline form too, so no global toolbar is necessary because the
- * forms take care of that.
- */
- @Override
- protected Control createToolBar(Composite parent) {
- return null;
- }
-
- @Override
- protected ViewArea createViewArea(Composite parent) {
- return new MobileViewArea(parent);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.mobile.window.desktop;
+
+import org.eclipse.scout.rt.ui.rap.window.desktop.RwtScoutDesktop;
+import org.eclipse.scout.rt.ui.rap.window.desktop.viewarea.ViewArea;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+/**
+ * @since 3.9.0
+ */
+public class RwtScoutMobileDesktop extends RwtScoutDesktop {
+
+ /**
+ * On mobile devices every form has a form header, the outline form too, so no global toolbar is necessary because the
+ * forms take care of that.
+ */
+ @Override
+ protected Control createToolBar(Composite parent) {
+ return null;
+ }
+
+ @Override
+ protected ViewArea createViewArea(Composite parent) {
+ return new MobileViewArea(parent);
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/window/desktop/RwtScoutMobileDesktopForm.java b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/window/desktop/RwtScoutMobileDesktopForm.java
index 703474a5a6..2e40474166 100644
--- a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/window/desktop/RwtScoutMobileDesktopForm.java
+++ b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/window/desktop/RwtScoutMobileDesktopForm.java
@@ -1,27 +1,27 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.mobile.window.desktop;
-
-import org.eclipse.scout.rt.ui.rap.window.desktop.RwtScoutDesktopForm;
-
-/**
- * @since 3.9.0
- */
-public class RwtScoutMobileDesktopForm extends RwtScoutDesktopForm {
-
- @Override
- public boolean isEclipseFormUsed() {
- //Eclipse forms are too heavyweight and may even crash chrome on android.
- //Since the mobile forms don't use any feature of the eclipse forms there is no need to create them.
- return false;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.mobile.window.desktop;
+
+import org.eclipse.scout.rt.ui.rap.window.desktop.RwtScoutDesktopForm;
+
+/**
+ * @since 3.9.0
+ */
+public class RwtScoutMobileDesktopForm extends RwtScoutDesktopForm {
+
+ @Override
+ public boolean isEclipseFormUsed() {
+ //Eclipse forms are too heavyweight and may even crash chrome on android.
+ //Since the mobile forms don't use any feature of the eclipse forms there is no need to create them.
+ return false;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/window/desktop/RwtScoutMobileViewStack.java b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/window/desktop/RwtScoutMobileViewStack.java
index a0aab54ad8..430c8df5aa 100644
--- a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/window/desktop/RwtScoutMobileViewStack.java
+++ b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/window/desktop/RwtScoutMobileViewStack.java
@@ -1,61 +1,61 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.mobile.window.desktop;
-
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
-import org.eclipse.scout.rt.ui.rap.window.IFormBoundsProvider;
-import org.eclipse.scout.rt.ui.rap.window.desktop.IViewArea;
-import org.eclipse.scout.rt.ui.rap.window.desktop.RwtScoutDesktopForm;
-import org.eclipse.scout.rt.ui.rap.window.desktop.RwtScoutViewStack;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * @since 3.9.0
- */
-public class RwtScoutMobileViewStack extends RwtScoutViewStack {
- private static final long serialVersionUID = 1L;
- private IViewArea m_viewArea;
-
- public RwtScoutMobileViewStack(Composite parent, IRwtEnvironment uiEnvironment, IViewArea viewArea) {
- super(parent, uiEnvironment);
-
- m_viewArea = viewArea;
- }
-
- @Override
- protected boolean isTabBarCreationEnabled() {
- return false;
- }
-
- @Override
- protected RwtScoutDesktopForm createRwtScoutDesktopForm() {
- return new RwtScoutMobileDesktopForm();
- }
-
- @Override
- protected IFormBoundsProvider createFormBoundsProvider(IForm scoutForm, IRwtEnvironment uiEnvironment) {
- return new FormBasedDesktopFormBoundsProvider(scoutForm, uiEnvironment);
- }
-
- @Override
- protected void setPartVisibleImpl(IForm form) {
- super.setPartVisibleImpl(form);
-
- //Make sure the preferred size is updated if the visible part changes.
- if (form != null && form.isCacheBounds()) {
- initPreferredSize(getFormBoundsProviders().get(form));
- m_viewArea.updateSashPositionForViewStack(this);
- m_viewArea.layout();
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.mobile.window.desktop;
+
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
+import org.eclipse.scout.rt.ui.rap.window.IFormBoundsProvider;
+import org.eclipse.scout.rt.ui.rap.window.desktop.IViewArea;
+import org.eclipse.scout.rt.ui.rap.window.desktop.RwtScoutDesktopForm;
+import org.eclipse.scout.rt.ui.rap.window.desktop.RwtScoutViewStack;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * @since 3.9.0
+ */
+public class RwtScoutMobileViewStack extends RwtScoutViewStack {
+ private static final long serialVersionUID = 1L;
+ private IViewArea m_viewArea;
+
+ public RwtScoutMobileViewStack(Composite parent, IRwtEnvironment uiEnvironment, IViewArea viewArea) {
+ super(parent, uiEnvironment);
+
+ m_viewArea = viewArea;
+ }
+
+ @Override
+ protected boolean isTabBarCreationEnabled() {
+ return false;
+ }
+
+ @Override
+ protected RwtScoutDesktopForm createRwtScoutDesktopForm() {
+ return new RwtScoutMobileDesktopForm();
+ }
+
+ @Override
+ protected IFormBoundsProvider createFormBoundsProvider(IForm scoutForm, IRwtEnvironment uiEnvironment) {
+ return new FormBasedDesktopFormBoundsProvider(scoutForm, uiEnvironment);
+ }
+
+ @Override
+ protected void setPartVisibleImpl(IForm form) {
+ super.setPartVisibleImpl(form);
+
+ //Make sure the preferred size is updated if the visible part changes.
+ if (form != null && form.isCacheBounds()) {
+ initPreferredSize(getFormBoundsProviders().get(form));
+ m_viewArea.updateSashPositionForViewStack(this);
+ m_viewArea.layout();
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/window/desktop/SimpleSash.java b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/window/desktop/SimpleSash.java
index d1925d2490..cdbc6f606c 100644
--- a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/window/desktop/SimpleSash.java
+++ b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/window/desktop/SimpleSash.java
@@ -1,41 +1,41 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.mobile.window.desktop;
-
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Sash;
-
-/**
- * A sash with no functionality.
- *
- * @since 3.9.0
- */
-public class SimpleSash extends Sash {
- private static final long serialVersionUID = 1L;
-
- public SimpleSash(Composite parent, int style) {
- super(parent, style);
-
- setEnabled(false);
- }
-
- @Override
- public void addSelectionListener(SelectionListener listener) {
- // nop
- }
-
- @Override
- public void removeSelectionListener(SelectionListener listener) {
- // nop
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.mobile.window.desktop;
+
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Sash;
+
+/**
+ * A sash with no functionality.
+ *
+ * @since 3.9.0
+ */
+public class SimpleSash extends Sash {
+ private static final long serialVersionUID = 1L;
+
+ public SimpleSash(Composite parent, int style) {
+ super(parent, style);
+
+ setEnabled(false);
+ }
+
+ @Override
+ public void addSelectionListener(SelectionListener listener) {
+ // nop
+ }
+
+ @Override
+ public void removeSelectionListener(SelectionListener listener) {
+ // nop
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/window/dialog/FixedSizeDialogBoundsProvider.java b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/window/dialog/FixedSizeDialogBoundsProvider.java
index 9523013193..6e98e9ec6d 100644
--- a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/window/dialog/FixedSizeDialogBoundsProvider.java
+++ b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/window/dialog/FixedSizeDialogBoundsProvider.java
@@ -1,63 +1,63 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.mobile.window.dialog;
-
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
-import org.eclipse.scout.rt.ui.rap.window.IFormBoundsProvider;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Display;
-
-/**
- * Positions the form in the middle of the screen and makes it as height as the screen.
- * <p>
- * As default the height is set to the height of the display which means the dialog is as height as the screen.<br>
- * The width is set to a fix value which is {@link #DIALOG_WIDTH} but only if it does not exceed the width of the
- * screen.
- * <p>
- * The bounds are not cached.
- *
- * @since 3.9.0
- */
-public class FixedSizeDialogBoundsProvider implements IFormBoundsProvider {
- public static final int DIALOG_WIDTH = 700;
-
- private final IForm m_form;
- private int m_maxWidth = DIALOG_WIDTH;
- private int m_maxHeight = Integer.MAX_VALUE;
- private IRwtEnvironment m_uiEnvironment;
-
- public FixedSizeDialogBoundsProvider(IForm form, IRwtEnvironment uiEnvironment) {
- m_form = form;
- m_uiEnvironment = uiEnvironment;
- }
-
- @Override
- public Rectangle getBounds() {
- int maxWidth = m_maxWidth;
- int maxHeight = m_maxHeight;
-
- Rectangle displayBounds = Display.getCurrent().getBounds();
-
- int height = Math.min(maxHeight, displayBounds.height);
- int width = Math.min(maxWidth, displayBounds.width);
- int x = (displayBounds.width / 2) - (width / 2);
- int y = 0;
-
- return new Rectangle(x, y, width, height);
- }
-
- @Override
- public void storeBounds(Rectangle bounds) {
- // nop
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.mobile.window.dialog;
+
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
+import org.eclipse.scout.rt.ui.rap.window.IFormBoundsProvider;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * Positions the form in the middle of the screen and makes it as height as the screen.
+ * <p>
+ * As default the height is set to the height of the display which means the dialog is as height as the screen.<br>
+ * The width is set to a fix value which is {@link #DIALOG_WIDTH} but only if it does not exceed the width of the
+ * screen.
+ * <p>
+ * The bounds are not cached.
+ *
+ * @since 3.9.0
+ */
+public class FixedSizeDialogBoundsProvider implements IFormBoundsProvider {
+ public static final int DIALOG_WIDTH = 700;
+
+ private final IForm m_form;
+ private int m_maxWidth = DIALOG_WIDTH;
+ private int m_maxHeight = Integer.MAX_VALUE;
+ private IRwtEnvironment m_uiEnvironment;
+
+ public FixedSizeDialogBoundsProvider(IForm form, IRwtEnvironment uiEnvironment) {
+ m_form = form;
+ m_uiEnvironment = uiEnvironment;
+ }
+
+ @Override
+ public Rectangle getBounds() {
+ int maxWidth = m_maxWidth;
+ int maxHeight = m_maxHeight;
+
+ Rectangle displayBounds = Display.getCurrent().getBounds();
+
+ int height = Math.min(maxHeight, displayBounds.height);
+ int width = Math.min(maxWidth, displayBounds.width);
+ int x = (displayBounds.width / 2) - (width / 2);
+ int y = 0;
+
+ return new Rectangle(x, y, width, height);
+ }
+
+ @Override
+ public void storeBounds(Rectangle bounds) {
+ // nop
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/window/dialog/RwtScoutMobileDialog.java b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/window/dialog/RwtScoutMobileDialog.java
index ccca70b487..f9fce64ab3 100644
--- a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/window/dialog/RwtScoutMobileDialog.java
+++ b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/window/dialog/RwtScoutMobileDialog.java
@@ -1,90 +1,90 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.mobile.window.dialog;
-
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
-import org.eclipse.scout.rt.ui.rap.IRwtStandaloneEnvironment;
-import org.eclipse.scout.rt.ui.rap.window.IFormBoundsProvider;
-import org.eclipse.scout.rt.ui.rap.window.dialog.RwtScoutDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * @since 3.9.0
- */
-public class RwtScoutMobileDialog extends RwtScoutDialog {
- private P_ResizeListener m_resizeListener;
-
- @Override
- protected IRwtStandaloneEnvironment getUiEnvironment() {
- return (IRwtStandaloneEnvironment) super.getUiEnvironment();
- }
-
- @Override
- public boolean isEclipseFormUsed() {
- //Eclipse forms are too heavyweight and may even crash chrome on android.
- //Since the mobile forms don't use any feature of the eclipse forms there is no need to create them.
- return false;
- }
-
- @Override
- public void createPart(IForm scoutForm, Shell parentShell, int style, IRwtEnvironment uiEnvironment) {
- scoutForm.setCacheBounds(true);
-
- super.createPart(scoutForm, parentShell, style, uiEnvironment);
-
- m_resizeListener = new P_ResizeListener();
- getUiEnvironment().getUiDesktop().getUiContainer().addListener(SWT.Resize, m_resizeListener);
- }
-
- @Override
- protected void closePartImpl() {
- super.closePartImpl();
-
- getUiEnvironment().getUiDesktop().getUiContainer().removeListener(SWT.Resize, m_resizeListener);
- }
-
- @Override
- protected IFormBoundsProvider createFormBoundsProvider(IForm scoutForm, IRwtEnvironment uiEnvironment) {
- return new FixedSizeDialogBoundsProvider(scoutForm, uiEnvironment);
- }
-
- /**
- * Adjusts the size of the dialog if the screen gets resized (e.g. on device rotation).
- */
- private class P_ResizeListener implements Listener {
-
- private static final long serialVersionUID = 1L;
-
- @Override
- public void handleEvent(Event event) {
- if (getUiDialog().getShell().isDisposed()) {
- return;
- }
-
- Rectangle bounds = getBoundsProvider().getBounds();
- if (bounds != null) {
- if (bounds.x >= 0 || bounds.y >= 0) {
- getUiDialog().getShell().setLocation(new Point(bounds.x, bounds.y));
- }
- if (bounds.width >= 0 || bounds.height >= 0) {
- getUiDialog().getShell().setSize(new Point(bounds.width, bounds.height));
- }
- }
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.mobile.window.dialog;
+
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
+import org.eclipse.scout.rt.ui.rap.IRwtStandaloneEnvironment;
+import org.eclipse.scout.rt.ui.rap.window.IFormBoundsProvider;
+import org.eclipse.scout.rt.ui.rap.window.dialog.RwtScoutDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * @since 3.9.0
+ */
+public class RwtScoutMobileDialog extends RwtScoutDialog {
+ private P_ResizeListener m_resizeListener;
+
+ @Override
+ protected IRwtStandaloneEnvironment getUiEnvironment() {
+ return (IRwtStandaloneEnvironment) super.getUiEnvironment();
+ }
+
+ @Override
+ public boolean isEclipseFormUsed() {
+ //Eclipse forms are too heavyweight and may even crash chrome on android.
+ //Since the mobile forms don't use any feature of the eclipse forms there is no need to create them.
+ return false;
+ }
+
+ @Override
+ public void createPart(IForm scoutForm, Shell parentShell, int style, IRwtEnvironment uiEnvironment) {
+ scoutForm.setCacheBounds(true);
+
+ super.createPart(scoutForm, parentShell, style, uiEnvironment);
+
+ m_resizeListener = new P_ResizeListener();
+ getUiEnvironment().getUiDesktop().getUiContainer().addListener(SWT.Resize, m_resizeListener);
+ }
+
+ @Override
+ protected void closePartImpl() {
+ super.closePartImpl();
+
+ getUiEnvironment().getUiDesktop().getUiContainer().removeListener(SWT.Resize, m_resizeListener);
+ }
+
+ @Override
+ protected IFormBoundsProvider createFormBoundsProvider(IForm scoutForm, IRwtEnvironment uiEnvironment) {
+ return new FixedSizeDialogBoundsProvider(scoutForm, uiEnvironment);
+ }
+
+ /**
+ * Adjusts the size of the dialog if the screen gets resized (e.g. on device rotation).
+ */
+ private class P_ResizeListener implements Listener {
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void handleEvent(Event event) {
+ if (getUiDialog().getShell().isDisposed()) {
+ return;
+ }
+
+ Rectangle bounds = getBoundsProvider().getBounds();
+ if (bounds != null) {
+ if (bounds.x >= 0 || bounds.y >= 0) {
+ getUiDialog().getShell().setLocation(new Point(bounds.x, bounds.y));
+ }
+ if (bounds.width >= 0 || bounds.height >= 0) {
+ getUiDialog().getShell().setSize(new Point(bounds.width, bounds.height));
+ }
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap.theme.rayo.mobile/.settings/org.eclipse.pde.core.prefs b/org.eclipse.scout.rt.ui.rap.theme.rayo.mobile/.settings/org.eclipse.pde.core.prefs
index 94ebd7c994..19430adcc9 100644
--- a/org.eclipse.scout.rt.ui.rap.theme.rayo.mobile/.settings/org.eclipse.pde.core.prefs
+++ b/org.eclipse.scout.rt.ui.rap.theme.rayo.mobile/.settings/org.eclipse.pde.core.prefs
@@ -1,3 +1,3 @@
-#Mon Mar 26 13:45:31 CEST 2007
-eclipse.preferences.version=1
-pluginProject.extensions=true
+#Mon Mar 26 13:45:31 CEST 2007
+eclipse.preferences.version=1
+pluginProject.extensions=true
diff --git a/org.eclipse.scout.rt.ui.rap.theme.rayo.mobile/fragment.xml b/org.eclipse.scout.rt.ui.rap.theme.rayo.mobile/fragment.xml
index 1051b41cc3..e402c852ae 100644
--- a/org.eclipse.scout.rt.ui.rap.theme.rayo.mobile/fragment.xml
+++ b/org.eclipse.scout.rt.ui.rap.theme.rayo.mobile/fragment.xml
@@ -1,12 +1,12 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<fragment>
- <extension
- point="org.eclipse.rap.ui.themes">
- <theme
- file="theme/scout.mobile.css"
- id="org.eclipse.scout.rt.ui.rap.mobile.theme"
- name="Scout Mobile Theme">
- </theme>
- </extension>
-</fragment>
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<fragment>
+ <extension
+ point="org.eclipse.rap.ui.themes">
+ <theme
+ file="theme/scout.mobile.css"
+ id="org.eclipse.scout.rt.ui.rap.mobile.theme"
+ name="Scout Mobile Theme">
+ </theme>
+ </extension>
+</fragment>
diff --git a/org.eclipse.scout.rt.ui.rap.theme.rayo/.settings/org.eclipse.pde.core.prefs b/org.eclipse.scout.rt.ui.rap.theme.rayo/.settings/org.eclipse.pde.core.prefs
index 94ebd7c994..19430adcc9 100644
--- a/org.eclipse.scout.rt.ui.rap.theme.rayo/.settings/org.eclipse.pde.core.prefs
+++ b/org.eclipse.scout.rt.ui.rap.theme.rayo/.settings/org.eclipse.pde.core.prefs
@@ -1,3 +1,3 @@
-#Mon Mar 26 13:45:31 CEST 2007
-eclipse.preferences.version=1
-pluginProject.extensions=true
+#Mon Mar 26 13:45:31 CEST 2007
+eclipse.preferences.version=1
+pluginProject.extensions=true
diff --git a/org.eclipse.scout.rt.ui.rap.theme.rayo/plugin.xml b/org.eclipse.scout.rt.ui.rap.theme.rayo/plugin.xml
index 9f44546edd..9e3c215249 100644
--- a/org.eclipse.scout.rt.ui.rap.theme.rayo/plugin.xml
+++ b/org.eclipse.scout.rt.ui.rap.theme.rayo/plugin.xml
@@ -1,12 +1,12 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<plugin>
- <extension
- point="org.eclipse.rap.ui.themes">
- <theme
- file="theme/scout.css"
- id="org.eclipse.scout.rt.ui.rap.theme"
- name="Scout Theme">
- </theme>
- </extension>
-</plugin>
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.rap.ui.themes">
+ <theme
+ file="theme/scout.css"
+ id="org.eclipse.scout.rt.ui.rap.theme"
+ name="Scout Theme">
+ </theme>
+ </extension>
+</plugin>
diff --git a/org.eclipse.scout.rt.ui.rap.theme.rayo/src/org/eclipse/scout/rt/ui/rap/rayo/Activator.java b/org.eclipse.scout.rt.ui.rap.theme.rayo/src/org/eclipse/scout/rt/ui/rap/rayo/Activator.java
index d29e62b7d7..e57803a098 100644
--- a/org.eclipse.scout.rt.ui.rap.theme.rayo/src/org/eclipse/scout/rt/ui/rap/rayo/Activator.java
+++ b/org.eclipse.scout.rt.ui.rap.theme.rayo/src/org/eclipse/scout/rt/ui/rap/rayo/Activator.java
@@ -1,43 +1,43 @@
-/*******************************************************************************
- * Copyright (c) 2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.rayo;
-
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends AbstractUIPlugin {
-
- public static final String PLUGIN_ID = "org.eclipse.scout.rt.ui.rap.rayo"; //$NON-NLS-1$
-
- private static Activator m_plugin;
-
- public Activator() {
- }
-
- public static Activator getDefault() {
- return m_plugin;
- }
-
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- m_plugin = this;
- }
-
- @Override
- public void stop(BundleContext context) throws Exception {
- m_plugin = null;
- super.stop(context);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.rayo;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ public static final String PLUGIN_ID = "org.eclipse.scout.rt.ui.rap.rayo"; //$NON-NLS-1$
+
+ private static Activator m_plugin;
+
+ public Activator() {
+ }
+
+ public static Activator getDefault() {
+ return m_plugin;
+ }
+
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ m_plugin = this;
+ }
+
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ m_plugin = null;
+ super.stop(context);
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap.workbench/.settings/org.eclipse.pde.core.prefs b/org.eclipse.scout.rt.ui.rap.workbench/.settings/org.eclipse.pde.core.prefs
index 94ebd7c994..19430adcc9 100644
--- a/org.eclipse.scout.rt.ui.rap.workbench/.settings/org.eclipse.pde.core.prefs
+++ b/org.eclipse.scout.rt.ui.rap.workbench/.settings/org.eclipse.pde.core.prefs
@@ -1,3 +1,3 @@
-#Mon Mar 26 13:45:31 CEST 2007
-eclipse.preferences.version=1
-pluginProject.extensions=true
+#Mon Mar 26 13:45:31 CEST 2007
+eclipse.preferences.version=1
+pluginProject.extensions=true
diff --git a/org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/AbstractRwtWorkbenchEnvironment.java b/org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/AbstractRwtWorkbenchEnvironment.java
index 51bc494521..212d0530e4 100644
--- a/org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/AbstractRwtWorkbenchEnvironment.java
+++ b/org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/AbstractRwtWorkbenchEnvironment.java
@@ -1,555 +1,555 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.workbench;
-
-import java.security.AccessController;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.TreeMap;
-
-import javax.security.auth.Subject;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.commons.CompositeLong;
-import org.eclipse.scout.commons.OptimisticLock;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ClientAsyncJob;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.client.ui.desktop.DesktopEvent;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.client.ui.wizard.IWizard;
-import org.eclipse.scout.rt.ui.rap.AbstractRwtEnvironment;
-import org.eclipse.scout.rt.ui.rap.basic.WidgetPrinter;
-import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
-import org.eclipse.scout.rt.ui.rap.workbench.window.editor.AbstractScoutEditorPart;
-import org.eclipse.scout.rt.ui.rap.workbench.window.editor.ScoutFormEditorInput;
-import org.eclipse.scout.rt.ui.rap.workbench.window.view.AbstractScoutView;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IPerspectiveDescriptor;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IViewReference;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PerspectiveAdapter;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.views.IViewDescriptor;
-import org.osgi.framework.Bundle;
-
-/**
- * <h3>TestWorkbenchRwtEnvironment</h3> ...
- *
- * @author Andreas Hoegger
- * @since 1.0.8 31.03.2011
- */
-public abstract class AbstractRwtWorkbenchEnvironment extends AbstractRwtEnvironment implements IRwtWorkbenchEnvironment {
- private static IScoutLogger LOG = ScoutLogManager.getLogger(AbstractRwtWorkbenchEnvironment.class);
-
- private Display m_display;
- private HashMap<String, String> m_scoutPartIdToUiPartId;
- private Map<String, List<IForm>> m_openLaterMap = new HashMap<String, List<IForm>>();
- private OptimisticLock m_activateViewLock;
- private P_PerspectiveListener m_perspectiveListener;
- private final String m_perspectiveId;
-
- public AbstractRwtWorkbenchEnvironment(Bundle applicationBundle, Class<? extends IClientSession> clientSessionClazz, String perspectiveId) {
- super(applicationBundle, clientSessionClazz);
- m_perspectiveId = perspectiveId;
- m_scoutPartIdToUiPartId = new HashMap<String, String>();
- m_activateViewLock = new OptimisticLock();
- }
-
- protected void attachUiListeners() {
- if (m_perspectiveListener == null) {
- m_perspectiveListener = new P_PerspectiveListener();
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().addPerspectiveListener(m_perspectiveListener);
- }
- }
-
- protected void detachUiListeners() {
- if (m_perspectiveListener != null && PlatformUI.getWorkbench().getActiveWorkbenchWindow() != null) {
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().removePerspectiveListener(m_perspectiveListener);
- m_perspectiveListener = null;
- }
- }
-
- @Override
- public boolean acquireActivateViewLock() {
- return m_activateViewLock.acquire();
- }
-
- public boolean isActivateViewLockAcquired() {
- return m_activateViewLock.isAcquired();
- }
-
- @Override
- public void releaseActivateViewLock() {
- m_activateViewLock.release();
- }
-
- @Override
- protected synchronized void init() throws CoreException {
- if (getSubject() == null) {
- Subject subject = Subject.getSubject(AccessController.getContext());
- if (subject == null) {
- throw new SecurityException("/rap request is not authenticated with a Subject");
- }
- setSubject(subject);
- }
- // workbench must exist
- if (PlatformUI.getWorkbench().getActiveWorkbenchWindow() == null) {
- throw new IllegalStateException("workbench must be active");
- }
- // close views that were opened due to workbench caching the latest layout
- // of views
- for (IWorkbenchWindow workbenchWindow : PlatformUI.getWorkbench().getWorkbenchWindows()) {
- for (IWorkbenchPage workbenchPage : workbenchWindow.getPages()) {
- for (IViewReference viewReference : workbenchPage.getViewReferences()) {
- if (m_scoutPartIdToUiPartId.containsValue(viewReference.getId())) {
- if (workbenchPage.isPartVisible(viewReference.getPart(false))) {
- workbenchPage.hideView(viewReference);
- }
- }
- }
- }
- }
-// PlatformUI.getWorkbench().addWorkbenchListener(new IWorkbenchListener() {
-// @Override
-// public boolean preShutdown(IWorkbench workbench, boolean forced) {
-// return true;
-// }
-//
-// @Override
-// public void postShutdown(IWorkbench workbench) {
-// Runnable t = new Runnable() {
-// @Override
-// public void run() {
-// getScoutDesktop().getUIFacade().fireGuiDetached();
-// getScoutDesktop().getUIFacade().fireDesktopClosingFromUI();
-// }
-// };
-// JobEx job = invokeScoutLater(t, 0);
-//// try {
-//// job.join(600000);
-//// }
-//// catch (InterruptedException e) {
-//// //nop
-//// }
-// }
-// });
- super.init();
- attachUiListeners();
- }
-
- @Override
- protected void stopScout() throws CoreException {
- super.stopScout();
- detachUiListeners();
- }
-
- @Override
- public void showFormPart(IForm form) {
- if (form == null) {
- return;
- }
- String scoutViewId = form.getDisplayViewId();
- String uiViewId = getUiPartIdForScoutPartId(scoutViewId);
- if (uiViewId == null) {
- LOG.warn("no view defined for scoutViewId: " + form.getDisplayViewId());
- return;
- }
- IViewPart existingView = findViewPart(uiViewId);
-
- String formPerspectiveId = form.getPerspectiveId();
- if (formPerspectiveId == null) {
- formPerspectiveId = "";
- }
- IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- //open form if formPerspectiveId is empty
- // OR if currentPerspectiveId equals perspecitveId set on form
- if (StringUtility.hasText(formPerspectiveId)
- && existingView == null
- && activePage != null
- && CompareUtility.notEquals(activePage.getPerspective().getId(), formPerspectiveId)) {
-
- synchronized (m_openLaterMap) {
- if (!m_openLaterMap.containsKey(formPerspectiveId) || !m_openLaterMap.get(formPerspectiveId).contains(form)) {
- if (m_openLaterMap.get(formPerspectiveId) == null) {
- m_openLaterMap.put(formPerspectiveId, new ArrayList<IForm>());
- }
- m_openLaterMap.get(formPerspectiveId).add(form);
- }
- }
- return;
- }
- if (IForm.EDITOR_ID.equals(form.getDisplayViewId()) || IWizard.EDITOR_ID.equals(form.getDisplayViewId())) {
- if (activePage != null) {
- ScoutFormEditorInput editorInput = new ScoutFormEditorInput(form, this);
- AbstractScoutEditorPart editor = getEditorPart(editorInput, uiViewId);
- putPart(form, editor);
- }
- }
- else {
- AbstractScoutView view = getViewPart(uiViewId);
- view.showForm(form);
- putPart(form, view);
- }
-
- }
-
- @Override
- public Display getDisplay() {
- if (m_display == null) {
- m_display = Display.getDefault();
- if (m_display == null) {
- m_display = new Display();
- }
- }
- return m_display;
- }
-
- /**
- * @param scoutPartLocation
- * the location id defined in {@link IForm} or additional.
- * @param uiPartId
- * the id of the {@link IViewPart} registered in the plugin.xml as a
- * view extension.
- */
- public void registerPart(String scoutPartLocation, String uiPartId) {
- m_scoutPartIdToUiPartId.put(scoutPartLocation, uiPartId);
- }
-
- public void unregisterPart(String scoutPartLocation) {
- m_scoutPartIdToUiPartId.remove(scoutPartLocation);
- }
-
- public final String[] getAllPartIds() {
- HashSet<String> partIds = new HashSet<String>(m_scoutPartIdToUiPartId.values());
- return partIds.toArray(new String[partIds.size()]);
- }
-
- public final String getUiPartIdForScoutPartId(String scoutPartLocation) {
- return m_scoutPartIdToUiPartId.get(scoutPartLocation);
- }
-
- public final String getScoutPartIdForUiPartId(String partId) {
- if (partId == null) {
- return "";
- }
- for (Entry<String, String> entry : m_scoutPartIdToUiPartId.entrySet()) {
- if (entry.getValue().equals(partId)) {
- return entry.getKey();
- }
- }
- return "";
- }
-
- public IViewPart findViewPart(String viewId) {
- if (viewId != null) {
- IViewDescriptor viewRef = PlatformUI.getWorkbench().getViewRegistry().find(viewId);
- if (viewRef != null && !viewRef.getAllowMultiple()) {
- return PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(viewId);
- }
- }
- return null;
- }
-
- public AbstractScoutEditorPart getEditorPart(IEditorInput editorInput, String editorId) {
- if (editorInput != null && editorId != null) {
- try {
- IEditorPart editor = null;
- editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findEditor(editorInput);
-
- if (editor == null) {
- editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(editorInput, editorId);
- }
- if (!(editor instanceof AbstractScoutEditorPart)) {
- LOG.warn("editors used in scout's enviromnent must be extensions of AbstractScoutEditorPart");
- }
- else {
- return (AbstractScoutEditorPart) editor;
- }
- }
- catch (PartInitException e) {
- LOG.error("could not inizialize editor", e);
- }
- }
- return null;
- }
-
- public AbstractScoutView getViewPart(String viewId) {
- if (viewId != null) {
- String secondaryId = null;
- IViewDescriptor viewRef = PlatformUI.getWorkbench().getViewRegistry().find(viewId);
- if (viewRef.getAllowMultiple()) {
- secondaryId = "" + System.currentTimeMillis();
- }
- try {
- IViewPart view = null;
- if (secondaryId == null) {
- view = findViewPart(viewId);
-
- if (view == null) {
- view = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(viewId);
- }
- }
- else {
- view = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(viewId, secondaryId, IWorkbenchPage.VIEW_ACTIVATE);
- }
- if (!(view instanceof AbstractScoutView)) {
- LOG.warn("views used in scout's enviromnent must be extensions of AbstractScoutView");
- }
- else {
- return (AbstractScoutView) view;
- }
- }
- catch (PartInitException e) {
- LOG.error("could not inizialize view", e);
- }
- }
- return null;
- }
-
- @Override
- protected void fireGuiDetachedFromUIInternal() {
- super.fireGuiDetachedFromUIInternal();
- getDisplay().asyncExec(new P_HideScoutViews());
- }
-
- @Override
- public Shell getParentShellIgnoringPopups(int modalities) {
- Shell shell = Display.getCurrent().getActiveShell();
- if (shell == null) {
- if (PlatformUI.getWorkbench().getActiveWorkbenchWindow() != null) {
- shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
- }
- }
- if (shell != null) {
- while (RwtUtility.isPopupShell(shell) && shell.getParent() instanceof Shell) {
- shell = (Shell) shell.getParent();
- }
- }
- // traverse complete tree
- if (shell == null) {
- TreeMap<CompositeLong, Shell> map = new TreeMap<CompositeLong, Shell>();
- for (IWorkbenchWindow w : PlatformUI.getWorkbench().getWorkbenchWindows()) {
- RwtUtility.visitShellTreeRec(w.getShell(), modalities, 0, map);
- }
- if (map.size() > 0) {
- shell = map.get(map.firstKey());
- }
- }
-
- if (shell != null && shell.getData() instanceof ProgressMonitorDialog) {
- // do also ignore the ProgressMonitorDialog, otherwise there will be some strange behaviors
- // when displaying a shell on top of the ProgressMonitorDialog-shell (f.e. when the
- // ProgressMonitorDialog-shell disappears)
- shell = (Shell) shell.getParent();
- }
- return shell;
- }
-
- private class P_HideScoutViews implements Runnable {
- @Override
- public void run() {
- IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- if (activePage != null) {
- for (IViewReference viewReference : activePage.getViewReferences()) {
- IViewPart view = viewReference.getView(false);
- if (view != null && view instanceof AbstractScoutView) {
- if (((AbstractScoutView) view).getScoutObject() == null) {
- activePage.hideView(viewReference);
- }
- }
- else if (m_scoutPartIdToUiPartId.containsValue(viewReference.getId())) {
- activePage.hideView(viewReference);
- }
- }
- }
- }
- }
-
- private class P_PerspectiveListener extends PerspectiveAdapter {
- @Override
- public void perspectiveActivated(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
- String perspectiveId = perspective.getId();
- if (handlePerspectiveOpened(perspectiveId)) {
- handlePerspectiveActivated(perspectiveId);
- }
- }
-
- @Override
- public void perspectiveDeactivated(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
- // global keystrokes are bound to a perspective so it is necessary to disable the global keystrokes
- if (m_perspectiveId.equals(perspective.getId())) {
- getKeyStrokeManager().setGlobalKeyStrokesActivated(false);
- }
- }
-
- @Override
- public void perspectiveClosed(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
- handlePerspectiveClosed(perspective.getId());
- }
-
- @Override
- public void perspectiveChanged(IWorkbenchPage page, IPerspectiveDescriptor perspective, String changeId) {
- String perspectiveId = perspective.getId();
- //If perspective is resetted make sure that scout views are open
- if (IWorkbenchPage.CHANGE_RESET.equals(changeId)) {
- handlePerspectiveClosed(perspectiveId);
- }
- else if (IWorkbenchPage.CHANGE_RESET_COMPLETE.equals(changeId)) {
- if (handlePerspectiveOpened(perspectiveId)) {
- handlePerspectiveActivated(perspectiveId);
- }
- }
- }
- }
-
- private synchronized boolean handlePerspectiveOpened(String perspectiveId) {
- if (m_perspectiveId.equals(perspectiveId)) {
- //make sure that the desktop is only started once
- if (!isStartDesktopCalled()) {
- final P_PerspecitveOpenedJob j = new P_PerspecitveOpenedJob(getDesktopOpenedTaskText(), getClientSession());
- j.schedule();
- setStartDesktopCalled(true);
- }
- getKeyStrokeManager().setGlobalKeyStrokesActivated(true);
- return isStartDesktopCalled();
- }
- return false;
- }
-
- private synchronized boolean handlePerspectiveActivated(String perspectiveId) {
- if (m_openLaterMap.containsKey(perspectiveId)) {
- List<IForm> list;
- synchronized (m_openLaterMap) {
- list = m_openLaterMap.remove(perspectiveId);
- }
- for (IForm form : list) {
- showFormPart(form);
- }
- setActivateDesktopCalled(CompareUtility.notEquals(m_perspectiveId, perspectiveId));
- }
-
- if (m_perspectiveId.equals(perspectiveId) && isStartDesktopCalled()) {
- //make sure that the desktop is only started once
- if (!isActivateDesktopCalled()) {
- final P_PerspectiveActivatedJob j = new P_PerspectiveActivatedJob(getDesktopOpenedTaskText(), getClientSession());
- j.schedule();
- setActivateDesktopCalled(true);
- }
- getKeyStrokeManager().setGlobalKeyStrokesActivated(true);
- return isActivateDesktopCalled();
- }
- return false;
- }
-
- private synchronized boolean handlePerspectiveClosed(String perspectiveId) {
- boolean called = false;
-
- // make sure that the desktop is only started once
- if (m_perspectiveId.equals(perspectiveId)) {
- final P_PerspectiveClosedJob j = new P_PerspectiveClosedJob(getDesktopClosedTaskText(), getClientSession());
- j.schedule();
- called = true;
- setStartDesktopCalled(false);
- setActivateDesktopCalled(false);
-
- //global keystrokes are bound to a perspective so it is necessary to disable the global keystrokes
- getKeyStrokeManager().setGlobalKeyStrokesActivated(false);
- }
- return called;
- }
-
- @Override
- protected void handleScoutPrintInRwt(DesktopEvent e) {
- WidgetPrinter wp = new WidgetPrinter(getParentShellIgnoringPopups(SWT.SYSTEM_MODAL | SWT.APPLICATION_MODAL | SWT.MODELESS));
- try {
- wp.print(e.getPrintDevice(), e.getPrintParameters());
- }
- catch (Throwable ex) {
- LOG.error(null, ex);
- }
- }
-
- private final class P_PerspecitveOpenedJob extends ClientAsyncJob {
- public P_PerspecitveOpenedJob(String name, IClientSession session) {
- super(name, session);
- }
-
- @Override
- protected void runVoid(IProgressMonitor monitor) throws Throwable {
- getDisplay().syncExec(new Runnable() {
- @Override
- public void run() {
- applyScoutState();
- }
- });
- ClientSyncJob clienSyncJob = new ClientSyncJob(getDesktopOpenedTaskText(), getClientSession()) {
- @Override
- protected void runVoid(IProgressMonitor syncMonitor) throws Throwable {
- fireGuiAttachedFromUIInternal();
- }
- };
- clienSyncJob.schedule();
- }
- }
-
- private final class P_PerspectiveActivatedJob extends ClientAsyncJob {
- public P_PerspectiveActivatedJob(String name, IClientSession session) {
- super(name, session);
- }
-
- @Override
- protected void runVoid(IProgressMonitor monitor) throws Throwable {
- ClientSyncJob clienSyncJob = new ClientSyncJob(getDesktopOpenedTaskText(), getClientSession()) {
- @Override
- protected void runVoid(IProgressMonitor syncMonitor) throws Throwable {
- fireDesktopActivatedFromUIInternal();
- }
- };
- clienSyncJob.schedule();
- }
- }
-
- private final class P_PerspectiveClosedJob extends ClientAsyncJob {
- public P_PerspectiveClosedJob(String name, IClientSession session) {
- super(name, session);
- }
-
- @Override
- protected void runVoid(IProgressMonitor monitor) throws Throwable {
- ClientSyncJob clienSyncJob = new ClientSyncJob(getDesktopOpenedTaskText(), getClientSession()) {
- @Override
- protected void runVoid(IProgressMonitor syncMonitor) throws Throwable {
- fireGuiDetachedFromUIInternal();
- }
- };
- clienSyncJob.schedule();
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.workbench;
+
+import java.security.AccessController;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.TreeMap;
+
+import javax.security.auth.Subject;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.commons.CompositeLong;
+import org.eclipse.scout.commons.OptimisticLock;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ClientAsyncJob;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.client.ui.desktop.DesktopEvent;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.client.ui.wizard.IWizard;
+import org.eclipse.scout.rt.ui.rap.AbstractRwtEnvironment;
+import org.eclipse.scout.rt.ui.rap.basic.WidgetPrinter;
+import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
+import org.eclipse.scout.rt.ui.rap.workbench.window.editor.AbstractScoutEditorPart;
+import org.eclipse.scout.rt.ui.rap.workbench.window.editor.ScoutFormEditorInput;
+import org.eclipse.scout.rt.ui.rap.workbench.window.view.AbstractScoutView;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IPerspectiveDescriptor;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IViewReference;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PerspectiveAdapter;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.views.IViewDescriptor;
+import org.osgi.framework.Bundle;
+
+/**
+ * <h3>TestWorkbenchRwtEnvironment</h3> ...
+ *
+ * @author Andreas Hoegger
+ * @since 1.0.8 31.03.2011
+ */
+public abstract class AbstractRwtWorkbenchEnvironment extends AbstractRwtEnvironment implements IRwtWorkbenchEnvironment {
+ private static IScoutLogger LOG = ScoutLogManager.getLogger(AbstractRwtWorkbenchEnvironment.class);
+
+ private Display m_display;
+ private HashMap<String, String> m_scoutPartIdToUiPartId;
+ private Map<String, List<IForm>> m_openLaterMap = new HashMap<String, List<IForm>>();
+ private OptimisticLock m_activateViewLock;
+ private P_PerspectiveListener m_perspectiveListener;
+ private final String m_perspectiveId;
+
+ public AbstractRwtWorkbenchEnvironment(Bundle applicationBundle, Class<? extends IClientSession> clientSessionClazz, String perspectiveId) {
+ super(applicationBundle, clientSessionClazz);
+ m_perspectiveId = perspectiveId;
+ m_scoutPartIdToUiPartId = new HashMap<String, String>();
+ m_activateViewLock = new OptimisticLock();
+ }
+
+ protected void attachUiListeners() {
+ if (m_perspectiveListener == null) {
+ m_perspectiveListener = new P_PerspectiveListener();
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().addPerspectiveListener(m_perspectiveListener);
+ }
+ }
+
+ protected void detachUiListeners() {
+ if (m_perspectiveListener != null && PlatformUI.getWorkbench().getActiveWorkbenchWindow() != null) {
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().removePerspectiveListener(m_perspectiveListener);
+ m_perspectiveListener = null;
+ }
+ }
+
+ @Override
+ public boolean acquireActivateViewLock() {
+ return m_activateViewLock.acquire();
+ }
+
+ public boolean isActivateViewLockAcquired() {
+ return m_activateViewLock.isAcquired();
+ }
+
+ @Override
+ public void releaseActivateViewLock() {
+ m_activateViewLock.release();
+ }
+
+ @Override
+ protected synchronized void init() throws CoreException {
+ if (getSubject() == null) {
+ Subject subject = Subject.getSubject(AccessController.getContext());
+ if (subject == null) {
+ throw new SecurityException("/rap request is not authenticated with a Subject");
+ }
+ setSubject(subject);
+ }
+ // workbench must exist
+ if (PlatformUI.getWorkbench().getActiveWorkbenchWindow() == null) {
+ throw new IllegalStateException("workbench must be active");
+ }
+ // close views that were opened due to workbench caching the latest layout
+ // of views
+ for (IWorkbenchWindow workbenchWindow : PlatformUI.getWorkbench().getWorkbenchWindows()) {
+ for (IWorkbenchPage workbenchPage : workbenchWindow.getPages()) {
+ for (IViewReference viewReference : workbenchPage.getViewReferences()) {
+ if (m_scoutPartIdToUiPartId.containsValue(viewReference.getId())) {
+ if (workbenchPage.isPartVisible(viewReference.getPart(false))) {
+ workbenchPage.hideView(viewReference);
+ }
+ }
+ }
+ }
+ }
+// PlatformUI.getWorkbench().addWorkbenchListener(new IWorkbenchListener() {
+// @Override
+// public boolean preShutdown(IWorkbench workbench, boolean forced) {
+// return true;
+// }
+//
+// @Override
+// public void postShutdown(IWorkbench workbench) {
+// Runnable t = new Runnable() {
+// @Override
+// public void run() {
+// getScoutDesktop().getUIFacade().fireGuiDetached();
+// getScoutDesktop().getUIFacade().fireDesktopClosingFromUI();
+// }
+// };
+// JobEx job = invokeScoutLater(t, 0);
+//// try {
+//// job.join(600000);
+//// }
+//// catch (InterruptedException e) {
+//// //nop
+//// }
+// }
+// });
+ super.init();
+ attachUiListeners();
+ }
+
+ @Override
+ protected void stopScout() throws CoreException {
+ super.stopScout();
+ detachUiListeners();
+ }
+
+ @Override
+ public void showFormPart(IForm form) {
+ if (form == null) {
+ return;
+ }
+ String scoutViewId = form.getDisplayViewId();
+ String uiViewId = getUiPartIdForScoutPartId(scoutViewId);
+ if (uiViewId == null) {
+ LOG.warn("no view defined for scoutViewId: " + form.getDisplayViewId());
+ return;
+ }
+ IViewPart existingView = findViewPart(uiViewId);
+
+ String formPerspectiveId = form.getPerspectiveId();
+ if (formPerspectiveId == null) {
+ formPerspectiveId = "";
+ }
+ IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ //open form if formPerspectiveId is empty
+ // OR if currentPerspectiveId equals perspecitveId set on form
+ if (StringUtility.hasText(formPerspectiveId)
+ && existingView == null
+ && activePage != null
+ && CompareUtility.notEquals(activePage.getPerspective().getId(), formPerspectiveId)) {
+
+ synchronized (m_openLaterMap) {
+ if (!m_openLaterMap.containsKey(formPerspectiveId) || !m_openLaterMap.get(formPerspectiveId).contains(form)) {
+ if (m_openLaterMap.get(formPerspectiveId) == null) {
+ m_openLaterMap.put(formPerspectiveId, new ArrayList<IForm>());
+ }
+ m_openLaterMap.get(formPerspectiveId).add(form);
+ }
+ }
+ return;
+ }
+ if (IForm.EDITOR_ID.equals(form.getDisplayViewId()) || IWizard.EDITOR_ID.equals(form.getDisplayViewId())) {
+ if (activePage != null) {
+ ScoutFormEditorInput editorInput = new ScoutFormEditorInput(form, this);
+ AbstractScoutEditorPart editor = getEditorPart(editorInput, uiViewId);
+ putPart(form, editor);
+ }
+ }
+ else {
+ AbstractScoutView view = getViewPart(uiViewId);
+ view.showForm(form);
+ putPart(form, view);
+ }
+
+ }
+
+ @Override
+ public Display getDisplay() {
+ if (m_display == null) {
+ m_display = Display.getDefault();
+ if (m_display == null) {
+ m_display = new Display();
+ }
+ }
+ return m_display;
+ }
+
+ /**
+ * @param scoutPartLocation
+ * the location id defined in {@link IForm} or additional.
+ * @param uiPartId
+ * the id of the {@link IViewPart} registered in the plugin.xml as a
+ * view extension.
+ */
+ public void registerPart(String scoutPartLocation, String uiPartId) {
+ m_scoutPartIdToUiPartId.put(scoutPartLocation, uiPartId);
+ }
+
+ public void unregisterPart(String scoutPartLocation) {
+ m_scoutPartIdToUiPartId.remove(scoutPartLocation);
+ }
+
+ public final String[] getAllPartIds() {
+ HashSet<String> partIds = new HashSet<String>(m_scoutPartIdToUiPartId.values());
+ return partIds.toArray(new String[partIds.size()]);
+ }
+
+ public final String getUiPartIdForScoutPartId(String scoutPartLocation) {
+ return m_scoutPartIdToUiPartId.get(scoutPartLocation);
+ }
+
+ public final String getScoutPartIdForUiPartId(String partId) {
+ if (partId == null) {
+ return "";
+ }
+ for (Entry<String, String> entry : m_scoutPartIdToUiPartId.entrySet()) {
+ if (entry.getValue().equals(partId)) {
+ return entry.getKey();
+ }
+ }
+ return "";
+ }
+
+ public IViewPart findViewPart(String viewId) {
+ if (viewId != null) {
+ IViewDescriptor viewRef = PlatformUI.getWorkbench().getViewRegistry().find(viewId);
+ if (viewRef != null && !viewRef.getAllowMultiple()) {
+ return PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(viewId);
+ }
+ }
+ return null;
+ }
+
+ public AbstractScoutEditorPart getEditorPart(IEditorInput editorInput, String editorId) {
+ if (editorInput != null && editorId != null) {
+ try {
+ IEditorPart editor = null;
+ editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findEditor(editorInput);
+
+ if (editor == null) {
+ editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(editorInput, editorId);
+ }
+ if (!(editor instanceof AbstractScoutEditorPart)) {
+ LOG.warn("editors used in scout's enviromnent must be extensions of AbstractScoutEditorPart");
+ }
+ else {
+ return (AbstractScoutEditorPart) editor;
+ }
+ }
+ catch (PartInitException e) {
+ LOG.error("could not inizialize editor", e);
+ }
+ }
+ return null;
+ }
+
+ public AbstractScoutView getViewPart(String viewId) {
+ if (viewId != null) {
+ String secondaryId = null;
+ IViewDescriptor viewRef = PlatformUI.getWorkbench().getViewRegistry().find(viewId);
+ if (viewRef.getAllowMultiple()) {
+ secondaryId = "" + System.currentTimeMillis();
+ }
+ try {
+ IViewPart view = null;
+ if (secondaryId == null) {
+ view = findViewPart(viewId);
+
+ if (view == null) {
+ view = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(viewId);
+ }
+ }
+ else {
+ view = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(viewId, secondaryId, IWorkbenchPage.VIEW_ACTIVATE);
+ }
+ if (!(view instanceof AbstractScoutView)) {
+ LOG.warn("views used in scout's enviromnent must be extensions of AbstractScoutView");
+ }
+ else {
+ return (AbstractScoutView) view;
+ }
+ }
+ catch (PartInitException e) {
+ LOG.error("could not inizialize view", e);
+ }
+ }
+ return null;
+ }
+
+ @Override
+ protected void fireGuiDetachedFromUIInternal() {
+ super.fireGuiDetachedFromUIInternal();
+ getDisplay().asyncExec(new P_HideScoutViews());
+ }
+
+ @Override
+ public Shell getParentShellIgnoringPopups(int modalities) {
+ Shell shell = Display.getCurrent().getActiveShell();
+ if (shell == null) {
+ if (PlatformUI.getWorkbench().getActiveWorkbenchWindow() != null) {
+ shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+ }
+ }
+ if (shell != null) {
+ while (RwtUtility.isPopupShell(shell) && shell.getParent() instanceof Shell) {
+ shell = (Shell) shell.getParent();
+ }
+ }
+ // traverse complete tree
+ if (shell == null) {
+ TreeMap<CompositeLong, Shell> map = new TreeMap<CompositeLong, Shell>();
+ for (IWorkbenchWindow w : PlatformUI.getWorkbench().getWorkbenchWindows()) {
+ RwtUtility.visitShellTreeRec(w.getShell(), modalities, 0, map);
+ }
+ if (map.size() > 0) {
+ shell = map.get(map.firstKey());
+ }
+ }
+
+ if (shell != null && shell.getData() instanceof ProgressMonitorDialog) {
+ // do also ignore the ProgressMonitorDialog, otherwise there will be some strange behaviors
+ // when displaying a shell on top of the ProgressMonitorDialog-shell (f.e. when the
+ // ProgressMonitorDialog-shell disappears)
+ shell = (Shell) shell.getParent();
+ }
+ return shell;
+ }
+
+ private class P_HideScoutViews implements Runnable {
+ @Override
+ public void run() {
+ IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ if (activePage != null) {
+ for (IViewReference viewReference : activePage.getViewReferences()) {
+ IViewPart view = viewReference.getView(false);
+ if (view != null && view instanceof AbstractScoutView) {
+ if (((AbstractScoutView) view).getScoutObject() == null) {
+ activePage.hideView(viewReference);
+ }
+ }
+ else if (m_scoutPartIdToUiPartId.containsValue(viewReference.getId())) {
+ activePage.hideView(viewReference);
+ }
+ }
+ }
+ }
+ }
+
+ private class P_PerspectiveListener extends PerspectiveAdapter {
+ @Override
+ public void perspectiveActivated(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
+ String perspectiveId = perspective.getId();
+ if (handlePerspectiveOpened(perspectiveId)) {
+ handlePerspectiveActivated(perspectiveId);
+ }
+ }
+
+ @Override
+ public void perspectiveDeactivated(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
+ // global keystrokes are bound to a perspective so it is necessary to disable the global keystrokes
+ if (m_perspectiveId.equals(perspective.getId())) {
+ getKeyStrokeManager().setGlobalKeyStrokesActivated(false);
+ }
+ }
+
+ @Override
+ public void perspectiveClosed(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
+ handlePerspectiveClosed(perspective.getId());
+ }
+
+ @Override
+ public void perspectiveChanged(IWorkbenchPage page, IPerspectiveDescriptor perspective, String changeId) {
+ String perspectiveId = perspective.getId();
+ //If perspective is resetted make sure that scout views are open
+ if (IWorkbenchPage.CHANGE_RESET.equals(changeId)) {
+ handlePerspectiveClosed(perspectiveId);
+ }
+ else if (IWorkbenchPage.CHANGE_RESET_COMPLETE.equals(changeId)) {
+ if (handlePerspectiveOpened(perspectiveId)) {
+ handlePerspectiveActivated(perspectiveId);
+ }
+ }
+ }
+ }
+
+ private synchronized boolean handlePerspectiveOpened(String perspectiveId) {
+ if (m_perspectiveId.equals(perspectiveId)) {
+ //make sure that the desktop is only started once
+ if (!isStartDesktopCalled()) {
+ final P_PerspecitveOpenedJob j = new P_PerspecitveOpenedJob(getDesktopOpenedTaskText(), getClientSession());
+ j.schedule();
+ setStartDesktopCalled(true);
+ }
+ getKeyStrokeManager().setGlobalKeyStrokesActivated(true);
+ return isStartDesktopCalled();
+ }
+ return false;
+ }
+
+ private synchronized boolean handlePerspectiveActivated(String perspectiveId) {
+ if (m_openLaterMap.containsKey(perspectiveId)) {
+ List<IForm> list;
+ synchronized (m_openLaterMap) {
+ list = m_openLaterMap.remove(perspectiveId);
+ }
+ for (IForm form : list) {
+ showFormPart(form);
+ }
+ setActivateDesktopCalled(CompareUtility.notEquals(m_perspectiveId, perspectiveId));
+ }
+
+ if (m_perspectiveId.equals(perspectiveId) && isStartDesktopCalled()) {
+ //make sure that the desktop is only started once
+ if (!isActivateDesktopCalled()) {
+ final P_PerspectiveActivatedJob j = new P_PerspectiveActivatedJob(getDesktopOpenedTaskText(), getClientSession());
+ j.schedule();
+ setActivateDesktopCalled(true);
+ }
+ getKeyStrokeManager().setGlobalKeyStrokesActivated(true);
+ return isActivateDesktopCalled();
+ }
+ return false;
+ }
+
+ private synchronized boolean handlePerspectiveClosed(String perspectiveId) {
+ boolean called = false;
+
+ // make sure that the desktop is only started once
+ if (m_perspectiveId.equals(perspectiveId)) {
+ final P_PerspectiveClosedJob j = new P_PerspectiveClosedJob(getDesktopClosedTaskText(), getClientSession());
+ j.schedule();
+ called = true;
+ setStartDesktopCalled(false);
+ setActivateDesktopCalled(false);
+
+ //global keystrokes are bound to a perspective so it is necessary to disable the global keystrokes
+ getKeyStrokeManager().setGlobalKeyStrokesActivated(false);
+ }
+ return called;
+ }
+
+ @Override
+ protected void handleScoutPrintInRwt(DesktopEvent e) {
+ WidgetPrinter wp = new WidgetPrinter(getParentShellIgnoringPopups(SWT.SYSTEM_MODAL | SWT.APPLICATION_MODAL | SWT.MODELESS));
+ try {
+ wp.print(e.getPrintDevice(), e.getPrintParameters());
+ }
+ catch (Throwable ex) {
+ LOG.error(null, ex);
+ }
+ }
+
+ private final class P_PerspecitveOpenedJob extends ClientAsyncJob {
+ public P_PerspecitveOpenedJob(String name, IClientSession session) {
+ super(name, session);
+ }
+
+ @Override
+ protected void runVoid(IProgressMonitor monitor) throws Throwable {
+ getDisplay().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ applyScoutState();
+ }
+ });
+ ClientSyncJob clienSyncJob = new ClientSyncJob(getDesktopOpenedTaskText(), getClientSession()) {
+ @Override
+ protected void runVoid(IProgressMonitor syncMonitor) throws Throwable {
+ fireGuiAttachedFromUIInternal();
+ }
+ };
+ clienSyncJob.schedule();
+ }
+ }
+
+ private final class P_PerspectiveActivatedJob extends ClientAsyncJob {
+ public P_PerspectiveActivatedJob(String name, IClientSession session) {
+ super(name, session);
+ }
+
+ @Override
+ protected void runVoid(IProgressMonitor monitor) throws Throwable {
+ ClientSyncJob clienSyncJob = new ClientSyncJob(getDesktopOpenedTaskText(), getClientSession()) {
+ @Override
+ protected void runVoid(IProgressMonitor syncMonitor) throws Throwable {
+ fireDesktopActivatedFromUIInternal();
+ }
+ };
+ clienSyncJob.schedule();
+ }
+ }
+
+ private final class P_PerspectiveClosedJob extends ClientAsyncJob {
+ public P_PerspectiveClosedJob(String name, IClientSession session) {
+ super(name, session);
+ }
+
+ @Override
+ protected void runVoid(IProgressMonitor monitor) throws Throwable {
+ ClientSyncJob clienSyncJob = new ClientSyncJob(getDesktopOpenedTaskText(), getClientSession()) {
+ @Override
+ protected void runVoid(IProgressMonitor syncMonitor) throws Throwable {
+ fireGuiDetachedFromUIInternal();
+ }
+ };
+ clienSyncJob.schedule();
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/AbstractWorkbenchEntryPoint.java b/org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/AbstractWorkbenchEntryPoint.java
index 7749a83e00..1d31674aed 100644
--- a/org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/AbstractWorkbenchEntryPoint.java
+++ b/org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/AbstractWorkbenchEntryPoint.java
@@ -1,36 +1,36 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.workbench;
-
-import org.eclipse.rwt.lifecycle.IEntryPoint;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.application.WorkbenchAdvisor;
-
-/**
- * <h3>AbstractWorkbenchEntryPoint</h3> ...
- *
- * @author Andreas Hoegger
- * @since 1.0.8 31.03.2011
- */
-public abstract class AbstractWorkbenchEntryPoint implements IEntryPoint {
-
- @Override
- public int createUI() {
- Display display = PlatformUI.createDisplay();
- int result = PlatformUI.createAndRunWorkbench(display, createWorkbenchAdvisor());
- display.dispose();
- return result;
- }
-
- protected abstract WorkbenchAdvisor createWorkbenchAdvisor();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.workbench;
+
+import org.eclipse.rwt.lifecycle.IEntryPoint;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.application.WorkbenchAdvisor;
+
+/**
+ * <h3>AbstractWorkbenchEntryPoint</h3> ...
+ *
+ * @author Andreas Hoegger
+ * @since 1.0.8 31.03.2011
+ */
+public abstract class AbstractWorkbenchEntryPoint implements IEntryPoint {
+
+ @Override
+ public int createUI() {
+ Display display = PlatformUI.createDisplay();
+ int result = PlatformUI.createAndRunWorkbench(display, createWorkbenchAdvisor());
+ display.dispose();
+ return result;
+ }
+
+ protected abstract WorkbenchAdvisor createWorkbenchAdvisor();
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/Activator.java b/org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/Activator.java
index c6da63af14..828e93d536 100644
--- a/org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/Activator.java
+++ b/org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/Activator.java
@@ -1,43 +1,43 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.workbench;
-
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends AbstractUIPlugin {
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.scout.rt.ui.rap.workbench"; //$NON-NLS-1$
-
- private static Activator plugin;
-
- public Activator() {
- }
-
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- @Override
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- public static Activator getDefault() {
- return plugin;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.workbench;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.scout.rt.ui.rap.workbench"; //$NON-NLS-1$
+
+ private static Activator plugin;
+
+ public Activator() {
+ }
+
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ public static Activator getDefault() {
+ return plugin;
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/IRwtWorkbenchEnvironment.java b/org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/IRwtWorkbenchEnvironment.java
index af01cd7f02..ab8aacf3cd 100644
--- a/org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/IRwtWorkbenchEnvironment.java
+++ b/org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/IRwtWorkbenchEnvironment.java
@@ -1,27 +1,27 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.workbench;
-
-import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
-
-/**
- * <h3>IRwtWorkbenchEnvironment</h3> ...
- *
- * @author Andreas Hoegger
- * @since 1.0.8 01.04.2011
- */
-public interface IRwtWorkbenchEnvironment extends IRwtEnvironment {
-
- boolean acquireActivateViewLock();
-
- void releaseActivateViewLock();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.workbench;
+
+import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
+
+/**
+ * <h3>IRwtWorkbenchEnvironment</h3> ...
+ *
+ * @author Andreas Hoegger
+ * @since 1.0.8 01.04.2011
+ */
+public interface IRwtWorkbenchEnvironment extends IRwtEnvironment {
+
+ boolean acquireActivateViewLock();
+
+ void releaseActivateViewLock();
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/ScoutApplicationStartup.java b/org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/ScoutApplicationStartup.java
index 591b2fa971..7f724cc03d 100644
--- a/org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/ScoutApplicationStartup.java
+++ b/org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/ScoutApplicationStartup.java
@@ -1,122 +1,122 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.workbench;
-
-import java.security.PrivilegedAction;
-
-import javax.security.auth.Subject;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.commons.security.SimplePrincipal;
-import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
-import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
-import org.eclipse.scout.rt.ui.rap.workbench.util.listener.WindowListener;
-import org.eclipse.ui.IPerspectiveDescriptor;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PerspectiveAdapter;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.progress.UIJob;
-
-public class ScoutApplicationStartup {
- private static IScoutLogger LOG = ScoutLogManager.getLogger(ScoutApplicationStartup.class);
-
- private final IRwtEnvironment m_uiEnvironment;
-
- public ScoutApplicationStartup(IRwtEnvironment uiEnvironment) {
- m_uiEnvironment = uiEnvironment;
- }
-
- public void startup() {
- final IWorkbench workbench = PlatformUI.getWorkbench();
- workbench.getDisplay().asyncExec(new P_HandleInitWorkbench());
- }
-
- protected String getInitWorkbenchTaskText() {
- return RwtUtility.getNlsText(m_uiEnvironment.getDisplay(), "ScoutStarting");
- }
-
- private class P_HandleInitWorkbench implements Runnable {
- @Override
- public void run() {
- IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (activeWorkbenchWindow != null) {
- IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
- if (activePage == null || activePage.getPerspective() == null) {
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().addPerspectiveListener(new P_PerspectiveListener());
- }
- else {
- handlePerspectiveOpened();
- }
- }
-
- //If the window is not active on startup no active workbenchWindow is found
- else {
- PlatformUI.getWorkbench().addWindowListener(new WindowListener() {
- @Override
- public void windowActivated(IWorkbenchWindow window) {
- PlatformUI.getWorkbench().removeWindowListener(this);
- //check if still no perspective open
- if (window.getActivePage() == null || window.getActivePage().getPerspective() == null) {
- window.addPerspectiveListener(new P_PerspectiveListener());
- }
- else {
- handlePerspectiveOpened();
- }
- }
- });
- }
- }
- }
-
- private synchronized void handlePerspectiveOpened() {
- final P_InitWorkbenchJob j = new P_InitWorkbenchJob(getInitWorkbenchTaskText());
- j.schedule(10);
- }
-
- //
-
- private class P_PerspectiveListener extends PerspectiveAdapter {
- @Override
- public void perspectiveOpened(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
- page.getWorkbenchWindow().removePerspectiveListener(P_PerspectiveListener.this);
-
- handlePerspectiveOpened();
- }
- }
-
- private final class P_InitWorkbenchJob extends UIJob {
- public P_InitWorkbenchJob(String name) {
- super(name);
- }
-
- @Override
- public IStatus runInUIThread(IProgressMonitor monitor) {
- monitor.beginTask(getInitWorkbenchTaskText(), IProgressMonitor.UNKNOWN);
- Subject subject = new Subject();
- subject.getPrincipals().add(new SimplePrincipal(System.getProperty("user.name")));
- Subject.doAs(subject, new PrivilegedAction<Object>() {
- @Override
- public Object run() {
- m_uiEnvironment.ensureInitialized();
- return null;
- }
- });
- monitor.done();
- return Status.OK_STATUS;
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.workbench;
+
+import java.security.PrivilegedAction;
+
+import javax.security.auth.Subject;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.commons.security.SimplePrincipal;
+import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
+import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
+import org.eclipse.scout.rt.ui.rap.workbench.util.listener.WindowListener;
+import org.eclipse.ui.IPerspectiveDescriptor;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PerspectiveAdapter;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.progress.UIJob;
+
+public class ScoutApplicationStartup {
+ private static IScoutLogger LOG = ScoutLogManager.getLogger(ScoutApplicationStartup.class);
+
+ private final IRwtEnvironment m_uiEnvironment;
+
+ public ScoutApplicationStartup(IRwtEnvironment uiEnvironment) {
+ m_uiEnvironment = uiEnvironment;
+ }
+
+ public void startup() {
+ final IWorkbench workbench = PlatformUI.getWorkbench();
+ workbench.getDisplay().asyncExec(new P_HandleInitWorkbench());
+ }
+
+ protected String getInitWorkbenchTaskText() {
+ return RwtUtility.getNlsText(m_uiEnvironment.getDisplay(), "ScoutStarting");
+ }
+
+ private class P_HandleInitWorkbench implements Runnable {
+ @Override
+ public void run() {
+ IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ if (activeWorkbenchWindow != null) {
+ IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
+ if (activePage == null || activePage.getPerspective() == null) {
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().addPerspectiveListener(new P_PerspectiveListener());
+ }
+ else {
+ handlePerspectiveOpened();
+ }
+ }
+
+ //If the window is not active on startup no active workbenchWindow is found
+ else {
+ PlatformUI.getWorkbench().addWindowListener(new WindowListener() {
+ @Override
+ public void windowActivated(IWorkbenchWindow window) {
+ PlatformUI.getWorkbench().removeWindowListener(this);
+ //check if still no perspective open
+ if (window.getActivePage() == null || window.getActivePage().getPerspective() == null) {
+ window.addPerspectiveListener(new P_PerspectiveListener());
+ }
+ else {
+ handlePerspectiveOpened();
+ }
+ }
+ });
+ }
+ }
+ }
+
+ private synchronized void handlePerspectiveOpened() {
+ final P_InitWorkbenchJob j = new P_InitWorkbenchJob(getInitWorkbenchTaskText());
+ j.schedule(10);
+ }
+
+ //
+
+ private class P_PerspectiveListener extends PerspectiveAdapter {
+ @Override
+ public void perspectiveOpened(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
+ page.getWorkbenchWindow().removePerspectiveListener(P_PerspectiveListener.this);
+
+ handlePerspectiveOpened();
+ }
+ }
+
+ private final class P_InitWorkbenchJob extends UIJob {
+ public P_InitWorkbenchJob(String name) {
+ super(name);
+ }
+
+ @Override
+ public IStatus runInUIThread(IProgressMonitor monitor) {
+ monitor.beginTask(getInitWorkbenchTaskText(), IProgressMonitor.UNKNOWN);
+ Subject subject = new Subject();
+ subject.getPrincipals().add(new SimplePrincipal(System.getProperty("user.name")));
+ Subject.doAs(subject, new PrivilegedAction<Object>() {
+ @Override
+ public Object run() {
+ m_uiEnvironment.ensureInitialized();
+ return null;
+ }
+ });
+ monitor.done();
+ return Status.OK_STATUS;
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/util/listener/DndAdapter.java b/org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/util/listener/DndAdapter.java
index 91720365b3..470ae5cfc6 100644
--- a/org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/util/listener/DndAdapter.java
+++ b/org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/util/listener/DndAdapter.java
@@ -1,62 +1,62 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.workbench.util.listener;
-
-import org.eclipse.swt.dnd.DragSourceEvent;
-import org.eclipse.swt.dnd.DragSourceListener;
-import org.eclipse.swt.dnd.DropTargetEvent;
-import org.eclipse.swt.dnd.DropTargetListener;
-
-/**
- * <h3>DndAdapter</h3>
- *
- * @since 1.0.9 15.07.2008
- */
-public abstract class DndAdapter implements DragSourceListener, DropTargetListener {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void dragFinished(DragSourceEvent event) {
- }
-
- @Override
- public void dragSetData(DragSourceEvent event) {
- }
-
- @Override
- public void dragStart(DragSourceEvent event) {
- }
-
- @Override
- public void dragEnter(DropTargetEvent event) {
- }
-
- @Override
- public void dragLeave(DropTargetEvent event) {
- }
-
- @Override
- public void dragOperationChanged(DropTargetEvent event) {
- }
-
- @Override
- public void dragOver(DropTargetEvent event) {
- }
-
- @Override
- public void drop(DropTargetEvent event) {
- }
-
- @Override
- public void dropAccept(DropTargetEvent event) {
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.workbench.util.listener;
+
+import org.eclipse.swt.dnd.DragSourceEvent;
+import org.eclipse.swt.dnd.DragSourceListener;
+import org.eclipse.swt.dnd.DropTargetEvent;
+import org.eclipse.swt.dnd.DropTargetListener;
+
+/**
+ * <h3>DndAdapter</h3>
+ *
+ * @since 1.0.9 15.07.2008
+ */
+public abstract class DndAdapter implements DragSourceListener, DropTargetListener {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void dragFinished(DragSourceEvent event) {
+ }
+
+ @Override
+ public void dragSetData(DragSourceEvent event) {
+ }
+
+ @Override
+ public void dragStart(DragSourceEvent event) {
+ }
+
+ @Override
+ public void dragEnter(DropTargetEvent event) {
+ }
+
+ @Override
+ public void dragLeave(DropTargetEvent event) {
+ }
+
+ @Override
+ public void dragOperationChanged(DropTargetEvent event) {
+ }
+
+ @Override
+ public void dragOver(DropTargetEvent event) {
+ }
+
+ @Override
+ public void drop(DropTargetEvent event) {
+ }
+
+ @Override
+ public void dropAccept(DropTargetEvent event) {
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/util/listener/PartListener.java b/org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/util/listener/PartListener.java
index bc1d73757e..797ba22cd5 100644
--- a/org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/util/listener/PartListener.java
+++ b/org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/util/listener/PartListener.java
@@ -1,52 +1,52 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.workbench.util.listener;
-
-import java.util.EventListener;
-
-import org.eclipse.ui.IPartListener2;
-import org.eclipse.ui.IWorkbenchPartReference;
-
-public abstract class PartListener implements IPartListener2, EventListener {
-
- @Override
- public void partActivated(IWorkbenchPartReference partRef) {
- }
-
- @Override
- public void partBroughtToTop(IWorkbenchPartReference partRef) {
- }
-
- @Override
- public void partClosed(IWorkbenchPartReference partRef) {
- }
-
- @Override
- public void partDeactivated(IWorkbenchPartReference partRef) {
- }
-
- @Override
- public void partHidden(IWorkbenchPartReference partRef) {
- }
-
- @Override
- public void partInputChanged(IWorkbenchPartReference partRef) {
- }
-
- @Override
- public void partOpened(IWorkbenchPartReference partRef) {
- }
-
- @Override
- public void partVisible(IWorkbenchPartReference partRef) {
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.workbench.util.listener;
+
+import java.util.EventListener;
+
+import org.eclipse.ui.IPartListener2;
+import org.eclipse.ui.IWorkbenchPartReference;
+
+public abstract class PartListener implements IPartListener2, EventListener {
+
+ @Override
+ public void partActivated(IWorkbenchPartReference partRef) {
+ }
+
+ @Override
+ public void partBroughtToTop(IWorkbenchPartReference partRef) {
+ }
+
+ @Override
+ public void partClosed(IWorkbenchPartReference partRef) {
+ }
+
+ @Override
+ public void partDeactivated(IWorkbenchPartReference partRef) {
+ }
+
+ @Override
+ public void partHidden(IWorkbenchPartReference partRef) {
+ }
+
+ @Override
+ public void partInputChanged(IWorkbenchPartReference partRef) {
+ }
+
+ @Override
+ public void partOpened(IWorkbenchPartReference partRef) {
+ }
+
+ @Override
+ public void partVisible(IWorkbenchPartReference partRef) {
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/util/listener/WindowListener.java b/org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/util/listener/WindowListener.java
index 3dd6ddf7af..bbbb732bac 100644
--- a/org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/util/listener/WindowListener.java
+++ b/org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/util/listener/WindowListener.java
@@ -1,36 +1,36 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.workbench.util.listener;
-
-import java.util.EventListener;
-
-import org.eclipse.ui.IWindowListener;
-import org.eclipse.ui.IWorkbenchWindow;
-
-public class WindowListener implements IWindowListener, EventListener {
-
- @Override
- public void windowActivated(IWorkbenchWindow window) {
- }
-
- @Override
- public void windowClosed(IWorkbenchWindow window) {
- }
-
- @Override
- public void windowDeactivated(IWorkbenchWindow window) {
- }
-
- @Override
- public void windowOpened(IWorkbenchWindow window) {
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.workbench.util.listener;
+
+import java.util.EventListener;
+
+import org.eclipse.ui.IWindowListener;
+import org.eclipse.ui.IWorkbenchWindow;
+
+public class WindowListener implements IWindowListener, EventListener {
+
+ @Override
+ public void windowActivated(IWorkbenchWindow window) {
+ }
+
+ @Override
+ public void windowClosed(IWorkbenchWindow window) {
+ }
+
+ @Override
+ public void windowDeactivated(IWorkbenchWindow window) {
+ }
+
+ @Override
+ public void windowOpened(IWorkbenchWindow window) {
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/window/editor/AbstractScoutEditorPart.java b/org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/window/editor/AbstractScoutEditorPart.java
index 2c88e2fd26..86b0c2aa34 100644
--- a/org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/window/editor/AbstractScoutEditorPart.java
+++ b/org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/window/editor/AbstractScoutEditorPart.java
@@ -1,461 +1,461 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.workbench.window.editor;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.scout.commons.OptimisticLock;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.ui.form.FormEvent;
-import org.eclipse.scout.rt.client.ui.form.FormListener;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
-import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
-import org.eclipse.scout.rt.ui.rap.form.IRwtScoutForm;
-import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
-import org.eclipse.scout.rt.ui.rap.util.ScoutFormToolkit;
-import org.eclipse.scout.rt.ui.rap.window.IRwtScoutPart;
-import org.eclipse.scout.rt.ui.rap.workbench.util.listener.PartListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.ISaveablePart2;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchPartReference;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.forms.widgets.Form;
-import org.eclipse.ui.part.EditorPart;
-import org.eclipse.ui.presentations.IPresentablePart;
-
-public abstract class AbstractScoutEditorPart extends EditorPart implements IRwtScoutPart, ISaveablePart2 {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractScoutEditorPart.class);
- public static final String EDITOR_ID = AbstractScoutEditorPart.class.getName();
-
- private final IRwtEnvironment m_uiEnvironment = createUiEnvironment();
-
- private Form m_rootForm;
- private Composite m_rootArea;
- private P_EditorListener m_editorListener;
- private OptimisticLock m_closeLock;
- private OptimisticLock m_closeFromModel = new OptimisticLock();
-
- private PropertyChangeListener m_formPropertyListener;
- private OptimisticLock m_layoutLock;
-
- public AbstractScoutEditorPart() {
- m_layoutLock = new OptimisticLock();
- m_closeLock = new OptimisticLock();
- m_formPropertyListener = new P_ScoutPropertyChangeListener();
- }
-
- @Override
- public void setBusy(boolean b) {
- //nop
- }
-
- protected void attachScout() {
- IForm form = getScoutObject();
- setTitleFromScout(form.getTitle());
- setImageFromScout(form.getIconId());
- setMaximizeEnabledFromScout(form.isMaximizeEnabled());
- setMaximizedFromScout(form.isMaximized());
- setMinimizeEnabledFromScout(form.isMinimizeEnabled());
- setMinimizedFromScout(form.isMinimized());
- boolean closable = false;
- for (IFormField f : form.getAllFields()) {
- if (f.isEnabled() && f.isVisible() && (f instanceof IButton)) {
- switch (((IButton) f).getSystemType()) {
- case IButton.SYSTEM_TYPE_CLOSE:
- case IButton.SYSTEM_TYPE_CANCEL: {
- closable = true;
- break;
- }
- }
- }
- if (closable) {
- break;
- }
- }
- setCloseEnabledFromScout(closable);
- // listeners
- form.addPropertyChangeListener(m_formPropertyListener);
- if (m_editorListener == null) {
- m_editorListener = new P_EditorListener();
- }
- getSite().getPage().addPartListener(m_editorListener);
- }
-
- protected void detachScout() {
- if (getScoutObject() != null) {
- // listeners
- getScoutObject().removePropertyChangeListener(m_formPropertyListener);
- }
- }
-
- @Override
- public void showPart() {
- // void
- }
-
- @Override
- public void closePart() {
- try {
- m_closeFromModel.acquire();
- if (m_closeLock.acquire()) {
- try {
- getSite().getPage().closeEditor(this, false);
- }
- catch (Exception e) {
- LOG.error("could not close editor '" + getEditorSite().getId() + "'.", e);
- }
- }
- }
- finally {
- m_closeLock.release();
- m_closeFromModel.release();
- }
- }
-
- @Override
- public void dispose() {
- detachScout();
- getSite().getPage().removePartListener(m_editorListener);
- super.dispose();
- }
-
- protected void setImageFromScout(String iconId) {
- Image img = getUiEnvironment().getIcon(iconId);
- setTitleImage(img);
- String sub = getScoutObject().getSubTitle();
- if (sub != null) {
- getUiForm().setImage(img);
- }
- else {
- getUiForm().setImage(null);
- }
- }
-
- protected void setTitleFromScout(String title) {
- IForm f = getScoutObject();
- //
- String s = f.getBasicTitle();
- setPartName(StringUtility.removeNewLines(s != null ? s : ""));
- //
- s = f.getSubTitle();
- if (s != null) {
- getUiForm().setText(RwtUtility.escapeMnemonics(StringUtility.removeNewLines(s != null ? s : "")));
- }
- else {
- getUiForm().setText(null);
- }
- }
-
- protected void setMaximizeEnabledFromScout(boolean maximizable) {
- // must be done by instantiating
- }
-
- protected void setMaximizedFromScout(boolean maximized) {
-
- }
-
- protected void setMinimizeEnabledFromScout(boolean minized) {
- // must be done by instantiating
- }
-
- protected void setMinimizedFromScout(boolean minimized) {
-
- }
-
- private void setSaveNeededFromScout() {
- firePropertyChange(IPresentablePart.PROP_DIRTY);
- }
-
- protected void setCloseEnabledFromScout(boolean closebale) {
- // void
- }
-
- /**
- * IRwtScoutEditor
- * <p>
- * Client code must NOT call this method but rather the public method {@link #getUiEnvironment()}
- */
- protected abstract IRwtEnvironment createUiEnvironment();
-
- public final IRwtEnvironment getUiEnvironment() {
- return m_uiEnvironment;
- }
-
- @Override
- public void createPartControl(Composite parent) {
- ScoutFormToolkit toolkit = getUiEnvironment().getFormToolkit();
- m_rootForm = toolkit.createForm(parent);
- m_rootArea = m_rootForm.getBody();
- GridLayout gridLayout = new GridLayout();
- gridLayout.horizontalSpacing = 0;
- gridLayout.marginHeight = 2;
- gridLayout.marginWidth = 2;
- gridLayout.verticalSpacing = 0;
- m_rootArea.setLayout(gridLayout);
-
- // create form
- try {
- m_layoutLock.acquire();
- m_rootArea.setRedraw(false);
- IRwtScoutForm form = getUiEnvironment().createForm(m_rootArea, getScoutObject());
- GridData d = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL);
- form.getUiContainer().setLayoutData(d);
- attachScout();
- }
- finally {
- m_layoutLock.release();
- m_rootArea.setRedraw(true);
- }
- }
-
- /**
- * EditorPart
- */
- @Override
- public void init(IEditorSite site, IEditorInput input) throws PartInitException {
- if (input instanceof ScoutFormEditorInput) {
- setSite(site);
- setInput(input);
- }
- else {
- throw new PartInitException("Input must be from instance ScoutFormEditorInput");
- }
- }
-
- @Override
- public IForm getScoutObject() {
- return ((ScoutFormEditorInput) getEditorInput()).getScoutObject();
- }
-
- @Override
- public Form getUiForm() {
- return getRootForm();
- }
-
- @Override
- public Composite getUiContainer() {
- return getUiForm();
- }
-
- protected Form getRootForm() {
- return m_rootForm;
- }
-
- @Override
- public int promptToSaveOnClose() {
- if (getScoutObject() == null) {
- return ISaveablePart2.NO;
- }
- if (m_closeFromModel.isReleased()) {
- new ClientSyncJob("Prompt to save", getUiEnvironment().getClientSession()) {
- @Override
- protected void runVoid(IProgressMonitor monitor) throws Throwable {
- // sle 07.08.09: Ticket 79445: Removed closeLock in
- // promtToSaveOnClose. We give the responsibility of closing to the
- // model. UI is not closing by himself.
- getScoutObject().getUIFacade().fireFormClosingFromUI();
- }
- }.schedule();
- return ISaveablePart2.CANCEL;
- }
- return ISaveablePart2.YES;
- }
-
- @Override
- public void doSave(IProgressMonitor monitor) {
- // nop
- }
-
- @Override
- public void doSaveAs() {
- // nop
- }
-
- @Override
- public boolean isDirty() {
- if (getScoutObject() != null && getScoutObject().isAskIfNeedSave()) {
- return getScoutObject().isSaveNeeded();
- }
- else {
- return false;
- }
- }
-
- @Override
- public boolean isSaveAsAllowed() {
- return false;
- }
-
- @Override
- public boolean isSaveOnCloseNeeded() {
- // ensure the traversal is done to write eventually changes to model
- Control focusControl = m_rootArea.getDisplay().getFocusControl();
- if (focusControl != null && !focusControl.isDisposed()) {
- //XXX rap focusControl.traverse(SWT.TRAVERSE_TAB_NEXT);
- }
- return isDirty();
- }
-
- @Override
- public void setFocus() {
- m_rootArea.setFocus();
- }
-
- protected void handlePartActivatedFromUI() {
- if (getUiEnvironment().isInitialized()) {
- Runnable job = new Runnable() {
- @Override
- public void run() {
- if (getScoutObject() != null) {
- getScoutObject().getUIFacade().fireFormActivatedFromUI();
- }
- }
- };
- getUiEnvironment().invokeScoutLater(job, 0);
- }
- }
-
- protected void handleClosedFromUI() {
- Runnable job = new Runnable() {
- @Override
- public void run() {
- try {
- if (m_closeLock.acquire()) {
- if (getScoutObject() != null) {
- getScoutObject().getUIFacade().fireFormKilledFromUI();
- }
- }
- }
- finally {
- m_closeLock.release();
- }
- }
- };
- getUiEnvironment().invokeScoutLater(job, 0);
- }
-
- @Override
- public void activate() {
- getSite().getPage().activate(getSite().getPart());
- }
-
- @Override
- public boolean isActive() {
- IWorkbenchWindow w = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (w == null) {
- return false;
- }
- IWorkbenchPage activePage = w.getActivePage();
- if (activePage == null) {
- return false;
- }
- return (activePage == getSite().getPage()) && (activePage.getActivePart() == this);
- }
-
- @Override
- public boolean isVisible() {
- return getSite().getPage().isPartVisible(getSite().getPart());
- }
-
- @Override
- public boolean setStatusLineMessage(Image image, String message) {
- getEditorSite().getActionBars().getStatusLineManager().setMessage(image, message);
- return true;
- }
-
- protected void handleScoutPropertyChange(String name, Object newValue) {
- if (name.equals(IForm.PROP_TITLE)) {
- setTitleFromScout((String) newValue);
- }
- else if (name.equals(IForm.PROP_ICON_ID)) {
- setImageFromScout((String) newValue);
- }
- else if (name.equals(IForm.PROP_MINIMIZE_ENABLED)) {
- setMinimizeEnabledFromScout(((Boolean) newValue).booleanValue());
- }
- else if (name.equals(IForm.PROP_MAXIMIZE_ENABLED)) {
- setMaximizeEnabledFromScout(((Boolean) newValue).booleanValue());
- }
- else if (name.equals(IForm.PROP_MINIMIZED)) {
- setMinimizedFromScout(((Boolean) newValue).booleanValue());
- }
- else if (name.equals(IForm.PROP_MAXIMIZED)) {
- setMaximizedFromScout(((Boolean) newValue).booleanValue());
- }
- else if (name.equals(IForm.PROP_SAVE_NEEDED)) {
- setSaveNeededFromScout();
- }
- }
-
- private class P_ScoutPropertyChangeListener implements PropertyChangeListener {
- @Override
- public void propertyChange(final PropertyChangeEvent e) {
- Runnable t = new Runnable() {
- @Override
- public void run() {
- handleScoutPropertyChange(e.getPropertyName(), e.getNewValue());
- }
- };
- getUiEnvironment().invokeUiLater(t);
- }
- }// end private class
-
- private class P_FormListener implements FormListener {
- @Override
- public void formChanged(FormEvent e) throws ProcessingException {
- if (e.getType() == FormEvent.TYPE_CLOSED) {
- Runnable t = new Runnable() {
- @Override
- public void run() {
- closePart();
- }
- };
- getUiEnvironment().invokeUiLater(t);
- }
- }
- }
-
- private class P_EditorListener extends PartListener {
- @Override
- public void partClosed(IWorkbenchPartReference partRef) {
- IWorkbenchPart part = partRef.getPart(false);
- if (part != null && part.equals(getEditorSite().getPart())) {
- handleClosedFromUI();
- }
- }
-
- @Override
- public void partActivated(IWorkbenchPartReference partRef) {
- if (partRef.getPart(false).equals(getEditorSite().getPart())) {
- handlePartActivatedFromUI();
-
- }
- }
- } // end class P_EditorListener
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.workbench.window.editor;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.scout.commons.OptimisticLock;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.ui.form.FormEvent;
+import org.eclipse.scout.rt.client.ui.form.FormListener;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
+import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
+import org.eclipse.scout.rt.ui.rap.form.IRwtScoutForm;
+import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
+import org.eclipse.scout.rt.ui.rap.util.ScoutFormToolkit;
+import org.eclipse.scout.rt.ui.rap.window.IRwtScoutPart;
+import org.eclipse.scout.rt.ui.rap.workbench.util.listener.PartListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.ISaveablePart2;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchPartReference;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.forms.widgets.Form;
+import org.eclipse.ui.part.EditorPart;
+import org.eclipse.ui.presentations.IPresentablePart;
+
+public abstract class AbstractScoutEditorPart extends EditorPart implements IRwtScoutPart, ISaveablePart2 {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractScoutEditorPart.class);
+ public static final String EDITOR_ID = AbstractScoutEditorPart.class.getName();
+
+ private final IRwtEnvironment m_uiEnvironment = createUiEnvironment();
+
+ private Form m_rootForm;
+ private Composite m_rootArea;
+ private P_EditorListener m_editorListener;
+ private OptimisticLock m_closeLock;
+ private OptimisticLock m_closeFromModel = new OptimisticLock();
+
+ private PropertyChangeListener m_formPropertyListener;
+ private OptimisticLock m_layoutLock;
+
+ public AbstractScoutEditorPart() {
+ m_layoutLock = new OptimisticLock();
+ m_closeLock = new OptimisticLock();
+ m_formPropertyListener = new P_ScoutPropertyChangeListener();
+ }
+
+ @Override
+ public void setBusy(boolean b) {
+ //nop
+ }
+
+ protected void attachScout() {
+ IForm form = getScoutObject();
+ setTitleFromScout(form.getTitle());
+ setImageFromScout(form.getIconId());
+ setMaximizeEnabledFromScout(form.isMaximizeEnabled());
+ setMaximizedFromScout(form.isMaximized());
+ setMinimizeEnabledFromScout(form.isMinimizeEnabled());
+ setMinimizedFromScout(form.isMinimized());
+ boolean closable = false;
+ for (IFormField f : form.getAllFields()) {
+ if (f.isEnabled() && f.isVisible() && (f instanceof IButton)) {
+ switch (((IButton) f).getSystemType()) {
+ case IButton.SYSTEM_TYPE_CLOSE:
+ case IButton.SYSTEM_TYPE_CANCEL: {
+ closable = true;
+ break;
+ }
+ }
+ }
+ if (closable) {
+ break;
+ }
+ }
+ setCloseEnabledFromScout(closable);
+ // listeners
+ form.addPropertyChangeListener(m_formPropertyListener);
+ if (m_editorListener == null) {
+ m_editorListener = new P_EditorListener();
+ }
+ getSite().getPage().addPartListener(m_editorListener);
+ }
+
+ protected void detachScout() {
+ if (getScoutObject() != null) {
+ // listeners
+ getScoutObject().removePropertyChangeListener(m_formPropertyListener);
+ }
+ }
+
+ @Override
+ public void showPart() {
+ // void
+ }
+
+ @Override
+ public void closePart() {
+ try {
+ m_closeFromModel.acquire();
+ if (m_closeLock.acquire()) {
+ try {
+ getSite().getPage().closeEditor(this, false);
+ }
+ catch (Exception e) {
+ LOG.error("could not close editor '" + getEditorSite().getId() + "'.", e);
+ }
+ }
+ }
+ finally {
+ m_closeLock.release();
+ m_closeFromModel.release();
+ }
+ }
+
+ @Override
+ public void dispose() {
+ detachScout();
+ getSite().getPage().removePartListener(m_editorListener);
+ super.dispose();
+ }
+
+ protected void setImageFromScout(String iconId) {
+ Image img = getUiEnvironment().getIcon(iconId);
+ setTitleImage(img);
+ String sub = getScoutObject().getSubTitle();
+ if (sub != null) {
+ getUiForm().setImage(img);
+ }
+ else {
+ getUiForm().setImage(null);
+ }
+ }
+
+ protected void setTitleFromScout(String title) {
+ IForm f = getScoutObject();
+ //
+ String s = f.getBasicTitle();
+ setPartName(StringUtility.removeNewLines(s != null ? s : ""));
+ //
+ s = f.getSubTitle();
+ if (s != null) {
+ getUiForm().setText(RwtUtility.escapeMnemonics(StringUtility.removeNewLines(s != null ? s : "")));
+ }
+ else {
+ getUiForm().setText(null);
+ }
+ }
+
+ protected void setMaximizeEnabledFromScout(boolean maximizable) {
+ // must be done by instantiating
+ }
+
+ protected void setMaximizedFromScout(boolean maximized) {
+
+ }
+
+ protected void setMinimizeEnabledFromScout(boolean minized) {
+ // must be done by instantiating
+ }
+
+ protected void setMinimizedFromScout(boolean minimized) {
+
+ }
+
+ private void setSaveNeededFromScout() {
+ firePropertyChange(IPresentablePart.PROP_DIRTY);
+ }
+
+ protected void setCloseEnabledFromScout(boolean closebale) {
+ // void
+ }
+
+ /**
+ * IRwtScoutEditor
+ * <p>
+ * Client code must NOT call this method but rather the public method {@link #getUiEnvironment()}
+ */
+ protected abstract IRwtEnvironment createUiEnvironment();
+
+ public final IRwtEnvironment getUiEnvironment() {
+ return m_uiEnvironment;
+ }
+
+ @Override
+ public void createPartControl(Composite parent) {
+ ScoutFormToolkit toolkit = getUiEnvironment().getFormToolkit();
+ m_rootForm = toolkit.createForm(parent);
+ m_rootArea = m_rootForm.getBody();
+ GridLayout gridLayout = new GridLayout();
+ gridLayout.horizontalSpacing = 0;
+ gridLayout.marginHeight = 2;
+ gridLayout.marginWidth = 2;
+ gridLayout.verticalSpacing = 0;
+ m_rootArea.setLayout(gridLayout);
+
+ // create form
+ try {
+ m_layoutLock.acquire();
+ m_rootArea.setRedraw(false);
+ IRwtScoutForm form = getUiEnvironment().createForm(m_rootArea, getScoutObject());
+ GridData d = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL);
+ form.getUiContainer().setLayoutData(d);
+ attachScout();
+ }
+ finally {
+ m_layoutLock.release();
+ m_rootArea.setRedraw(true);
+ }
+ }
+
+ /**
+ * EditorPart
+ */
+ @Override
+ public void init(IEditorSite site, IEditorInput input) throws PartInitException {
+ if (input instanceof ScoutFormEditorInput) {
+ setSite(site);
+ setInput(input);
+ }
+ else {
+ throw new PartInitException("Input must be from instance ScoutFormEditorInput");
+ }
+ }
+
+ @Override
+ public IForm getScoutObject() {
+ return ((ScoutFormEditorInput) getEditorInput()).getScoutObject();
+ }
+
+ @Override
+ public Form getUiForm() {
+ return getRootForm();
+ }
+
+ @Override
+ public Composite getUiContainer() {
+ return getUiForm();
+ }
+
+ protected Form getRootForm() {
+ return m_rootForm;
+ }
+
+ @Override
+ public int promptToSaveOnClose() {
+ if (getScoutObject() == null) {
+ return ISaveablePart2.NO;
+ }
+ if (m_closeFromModel.isReleased()) {
+ new ClientSyncJob("Prompt to save", getUiEnvironment().getClientSession()) {
+ @Override
+ protected void runVoid(IProgressMonitor monitor) throws Throwable {
+ // sle 07.08.09: Ticket 79445: Removed closeLock in
+ // promtToSaveOnClose. We give the responsibility of closing to the
+ // model. UI is not closing by himself.
+ getScoutObject().getUIFacade().fireFormClosingFromUI();
+ }
+ }.schedule();
+ return ISaveablePart2.CANCEL;
+ }
+ return ISaveablePart2.YES;
+ }
+
+ @Override
+ public void doSave(IProgressMonitor monitor) {
+ // nop
+ }
+
+ @Override
+ public void doSaveAs() {
+ // nop
+ }
+
+ @Override
+ public boolean isDirty() {
+ if (getScoutObject() != null && getScoutObject().isAskIfNeedSave()) {
+ return getScoutObject().isSaveNeeded();
+ }
+ else {
+ return false;
+ }
+ }
+
+ @Override
+ public boolean isSaveAsAllowed() {
+ return false;
+ }
+
+ @Override
+ public boolean isSaveOnCloseNeeded() {
+ // ensure the traversal is done to write eventually changes to model
+ Control focusControl = m_rootArea.getDisplay().getFocusControl();
+ if (focusControl != null && !focusControl.isDisposed()) {
+ //XXX rap focusControl.traverse(SWT.TRAVERSE_TAB_NEXT);
+ }
+ return isDirty();
+ }
+
+ @Override
+ public void setFocus() {
+ m_rootArea.setFocus();
+ }
+
+ protected void handlePartActivatedFromUI() {
+ if (getUiEnvironment().isInitialized()) {
+ Runnable job = new Runnable() {
+ @Override
+ public void run() {
+ if (getScoutObject() != null) {
+ getScoutObject().getUIFacade().fireFormActivatedFromUI();
+ }
+ }
+ };
+ getUiEnvironment().invokeScoutLater(job, 0);
+ }
+ }
+
+ protected void handleClosedFromUI() {
+ Runnable job = new Runnable() {
+ @Override
+ public void run() {
+ try {
+ if (m_closeLock.acquire()) {
+ if (getScoutObject() != null) {
+ getScoutObject().getUIFacade().fireFormKilledFromUI();
+ }
+ }
+ }
+ finally {
+ m_closeLock.release();
+ }
+ }
+ };
+ getUiEnvironment().invokeScoutLater(job, 0);
+ }
+
+ @Override
+ public void activate() {
+ getSite().getPage().activate(getSite().getPart());
+ }
+
+ @Override
+ public boolean isActive() {
+ IWorkbenchWindow w = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ if (w == null) {
+ return false;
+ }
+ IWorkbenchPage activePage = w.getActivePage();
+ if (activePage == null) {
+ return false;
+ }
+ return (activePage == getSite().getPage()) && (activePage.getActivePart() == this);
+ }
+
+ @Override
+ public boolean isVisible() {
+ return getSite().getPage().isPartVisible(getSite().getPart());
+ }
+
+ @Override
+ public boolean setStatusLineMessage(Image image, String message) {
+ getEditorSite().getActionBars().getStatusLineManager().setMessage(image, message);
+ return true;
+ }
+
+ protected void handleScoutPropertyChange(String name, Object newValue) {
+ if (name.equals(IForm.PROP_TITLE)) {
+ setTitleFromScout((String) newValue);
+ }
+ else if (name.equals(IForm.PROP_ICON_ID)) {
+ setImageFromScout((String) newValue);
+ }
+ else if (name.equals(IForm.PROP_MINIMIZE_ENABLED)) {
+ setMinimizeEnabledFromScout(((Boolean) newValue).booleanValue());
+ }
+ else if (name.equals(IForm.PROP_MAXIMIZE_ENABLED)) {
+ setMaximizeEnabledFromScout(((Boolean) newValue).booleanValue());
+ }
+ else if (name.equals(IForm.PROP_MINIMIZED)) {
+ setMinimizedFromScout(((Boolean) newValue).booleanValue());
+ }
+ else if (name.equals(IForm.PROP_MAXIMIZED)) {
+ setMaximizedFromScout(((Boolean) newValue).booleanValue());
+ }
+ else if (name.equals(IForm.PROP_SAVE_NEEDED)) {
+ setSaveNeededFromScout();
+ }
+ }
+
+ private class P_ScoutPropertyChangeListener implements PropertyChangeListener {
+ @Override
+ public void propertyChange(final PropertyChangeEvent e) {
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ handleScoutPropertyChange(e.getPropertyName(), e.getNewValue());
+ }
+ };
+ getUiEnvironment().invokeUiLater(t);
+ }
+ }// end private class
+
+ private class P_FormListener implements FormListener {
+ @Override
+ public void formChanged(FormEvent e) throws ProcessingException {
+ if (e.getType() == FormEvent.TYPE_CLOSED) {
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ closePart();
+ }
+ };
+ getUiEnvironment().invokeUiLater(t);
+ }
+ }
+ }
+
+ private class P_EditorListener extends PartListener {
+ @Override
+ public void partClosed(IWorkbenchPartReference partRef) {
+ IWorkbenchPart part = partRef.getPart(false);
+ if (part != null && part.equals(getEditorSite().getPart())) {
+ handleClosedFromUI();
+ }
+ }
+
+ @Override
+ public void partActivated(IWorkbenchPartReference partRef) {
+ if (partRef.getPart(false).equals(getEditorSite().getPart())) {
+ handlePartActivatedFromUI();
+
+ }
+ }
+ } // end class P_EditorListener
+}
diff --git a/org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/window/editor/ScoutEditorMatchingStrategy.java b/org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/window/editor/ScoutEditorMatchingStrategy.java
index e9d6f248aa..9267233ce2 100644
--- a/org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/window/editor/ScoutEditorMatchingStrategy.java
+++ b/org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/window/editor/ScoutEditorMatchingStrategy.java
@@ -1,35 +1,35 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.workbench.window.editor;
-
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorMatchingStrategy;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IEditorReference;
-
-public class ScoutEditorMatchingStrategy implements IEditorMatchingStrategy {
- @Override
- public boolean matches(IEditorReference editorRef, IEditorInput input) {
- if (!(editorRef.getEditor(false) instanceof AbstractScoutEditorPart)) {
- return false;
- }
- if (!(input instanceof ScoutFormEditorInput)) {
- return false;
- }
- final IEditorPart part = (IEditorPart) editorRef.getPart(false);
- if (part != null) {
- final IEditorInput editorInput = part.getEditorInput();
- return editorInput.equals(input);
- }
- return false;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.workbench.window.editor;
+
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorMatchingStrategy;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IEditorReference;
+
+public class ScoutEditorMatchingStrategy implements IEditorMatchingStrategy {
+ @Override
+ public boolean matches(IEditorReference editorRef, IEditorInput input) {
+ if (!(editorRef.getEditor(false) instanceof AbstractScoutEditorPart)) {
+ return false;
+ }
+ if (!(input instanceof ScoutFormEditorInput)) {
+ return false;
+ }
+ final IEditorPart part = (IEditorPart) editorRef.getPart(false);
+ if (part != null) {
+ final IEditorInput editorInput = part.getEditorInput();
+ return editorInput.equals(input);
+ }
+ return false;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/window/editor/ScoutFormEditorInput.java b/org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/window/editor/ScoutFormEditorInput.java
index 1a1206da08..09d9501b65 100644
--- a/org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/window/editor/ScoutFormEditorInput.java
+++ b/org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/window/editor/ScoutFormEditorInput.java
@@ -1,105 +1,105 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.workbench.window.editor;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IPersistableElement;
-
-public class ScoutFormEditorInput implements IEditorInput {
-
- private final IRwtEnvironment m_uiEnvironment;
- private final IForm m_scoutObject;
-
- public ScoutFormEditorInput(IForm scoutObject, IRwtEnvironment uiEnvironment) {
- m_scoutObject = scoutObject;
- m_uiEnvironment = uiEnvironment;
- }
-
- private IRwtEnvironment getUiEnvironment() {
- return m_uiEnvironment;
- }
-
- public IForm getScoutObject() {
- return m_scoutObject;
- }
-
- @Override
- public boolean exists() {
- return true;
- }
-
- @Override
- public ImageDescriptor getImageDescriptor() {
- final Image icon = getUiEnvironment().getIcon(getScoutObject().getIconId());
- return ImageDescriptor.createFromImage(icon);
- }
-
- @Override
- public String getName() {
- return StringUtility.nvl(getScoutObject().getTitle(), "");
- }
-
- @Override
- public IPersistableElement getPersistable() {
- return null;
- }
-
- @Override
- public String getToolTipText() {
- return StringUtility.nvl(getScoutObject().getSubTitle(), "");
- }
-
- @Override
- public Object getAdapter(Class adapter) {
- return null;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (!(obj instanceof ScoutFormEditorInput)) {
- return false;
- }
- ScoutFormEditorInput other = (ScoutFormEditorInput) obj;
- IForm form = this.getScoutObject();
- IForm otherForm = other.getScoutObject();
- if (form.getClass().getName().equals(otherForm.getClass().getName())
- && form.getHandler().isOpenExclusive() && otherForm.getHandler().isOpenExclusive()) {
- try {
- Object key = form.computeExclusiveKey();
- Object otherKey = otherForm.computeExclusiveKey();
- if (key == null || otherKey == null) {
- return false;
- }
- return key.equals(otherKey);
- }
- catch (ProcessingException e) {
- return false;
- }
- }
- return form.equals(otherForm);
- }
-
- @Override
- public int hashCode() {
- int hash = 0;
- hash = hash * 37 + getScoutObject().hashCode();
- return hash;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.workbench.window.editor;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IPersistableElement;
+
+public class ScoutFormEditorInput implements IEditorInput {
+
+ private final IRwtEnvironment m_uiEnvironment;
+ private final IForm m_scoutObject;
+
+ public ScoutFormEditorInput(IForm scoutObject, IRwtEnvironment uiEnvironment) {
+ m_scoutObject = scoutObject;
+ m_uiEnvironment = uiEnvironment;
+ }
+
+ private IRwtEnvironment getUiEnvironment() {
+ return m_uiEnvironment;
+ }
+
+ public IForm getScoutObject() {
+ return m_scoutObject;
+ }
+
+ @Override
+ public boolean exists() {
+ return true;
+ }
+
+ @Override
+ public ImageDescriptor getImageDescriptor() {
+ final Image icon = getUiEnvironment().getIcon(getScoutObject().getIconId());
+ return ImageDescriptor.createFromImage(icon);
+ }
+
+ @Override
+ public String getName() {
+ return StringUtility.nvl(getScoutObject().getTitle(), "");
+ }
+
+ @Override
+ public IPersistableElement getPersistable() {
+ return null;
+ }
+
+ @Override
+ public String getToolTipText() {
+ return StringUtility.nvl(getScoutObject().getSubTitle(), "");
+ }
+
+ @Override
+ public Object getAdapter(Class adapter) {
+ return null;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!(obj instanceof ScoutFormEditorInput)) {
+ return false;
+ }
+ ScoutFormEditorInput other = (ScoutFormEditorInput) obj;
+ IForm form = this.getScoutObject();
+ IForm otherForm = other.getScoutObject();
+ if (form.getClass().getName().equals(otherForm.getClass().getName())
+ && form.getHandler().isOpenExclusive() && otherForm.getHandler().isOpenExclusive()) {
+ try {
+ Object key = form.computeExclusiveKey();
+ Object otherKey = otherForm.computeExclusiveKey();
+ if (key == null || otherKey == null) {
+ return false;
+ }
+ return key.equals(otherKey);
+ }
+ catch (ProcessingException e) {
+ return false;
+ }
+ }
+ return form.equals(otherForm);
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 0;
+ hash = hash * 37 + getScoutObject().hashCode();
+ return hash;
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/window/view/AbstractScoutView.java b/org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/window/view/AbstractScoutView.java
index af3e1a896d..488624c6ff 100644
--- a/org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/window/view/AbstractScoutView.java
+++ b/org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/window/view/AbstractScoutView.java
@@ -1,477 +1,477 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.workbench.window.view;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.scout.commons.OptimisticLock;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
-import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
-import org.eclipse.scout.rt.ui.rap.util.ScoutFormToolkit;
-import org.eclipse.scout.rt.ui.rap.window.IRwtScoutPart;
-import org.eclipse.scout.rt.ui.rap.workbench.IRwtWorkbenchEnvironment;
-import org.eclipse.scout.rt.ui.rap.workbench.util.listener.PartListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.ISaveablePart2;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPartReference;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.forms.widgets.Form;
-import org.eclipse.ui.part.ViewPart;
-
-/**
- * <h3>AbstractScoutView</h3> ...
- *
- * @since 1.0.9 03.07.2008
- */
-public abstract class AbstractScoutView extends ViewPart implements IRwtScoutPart, ISaveablePart2 {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractScoutView.class);
- // public static enum ViewState{OPEN, CLOSING_UI, CLOSING_MODEL, CLOSED}
-
- private IRwtWorkbenchEnvironment m_uiEnvironment;
-
- private P_ViewListener m_viewListener;
- private OptimisticLock m_closeLock;
- private OptimisticLock m_closeFromModel = new OptimisticLock();
- // private ViewState m_viewState;
- private OptimisticLock m_layoutLock = new OptimisticLock();
-
- private Form m_rootForm;
- private Composite m_rootArea;
-
- private IForm m_scoutForm;
-
- private PropertyChangeListener m_formPropertyListener;
-
- public AbstractScoutView() {
- m_formPropertyListener = new P_ScoutPropertyChangeListener();
- m_closeLock = new OptimisticLock();
- }
-
- @Override
- public void setBusy(boolean b) {
- //nop
- }
-
- protected void attatchListeners() {
- if (m_viewListener == null) {
- m_viewListener = new P_ViewListener();
- }
- getSite().getPage().addPartListener(m_viewListener);
- }
-
- protected void detachListeners() {
- if (m_viewListener != null) {
- getSite().getPage().removePartListener(m_viewListener);
- }
- }
-
- @Override
- public void dispose() {
- detachListeners();
- super.dispose();
- }
-
- @Override
- public void showPart() {
- // void here
- }
-
- public void showForm(IForm scoutForm) {
- if (m_scoutForm != null) {
- LOG.warn("The view 'ID=" + getViewSite().getId() + "' is already open. The form '" + scoutForm.getTitle() + " (" + scoutForm.getClass().getName() + ")' can not be opened!");
- detachScout(m_scoutForm);
- m_scoutForm = null;
- }
- m_scoutForm = scoutForm;
- try {
- m_layoutLock.acquire();
- getUiContentPane().setRedraw(false);
- getUiEnvironment().createForm(getUiContentPane(), scoutForm);
- attachScout(m_scoutForm);
- }
- finally {
- m_layoutLock.release();
- getUiContentPane().setRedraw(true);
- getUiContentPane().layout(true, true);
- }
- }
-
- @Override
- public void closePart() {
- try {
- m_closeFromModel.acquire();
- if (m_closeLock.acquire()) {
- try {
- getSite().getPage().hideView(AbstractScoutView.this);
- }
- catch (Exception e) {
- LOG.error("could not close view '" + getViewSite().getId() + "'.", e);
- }
- }
- if (m_scoutForm != null) {
- detachScout(m_scoutForm);
- m_scoutForm = null;
- }
- }
- finally {
- m_closeLock.release();
- m_closeFromModel.release();
- }
- }
-
- @Override
- public IForm getScoutObject() {
- return m_scoutForm;
- }
-
- protected void attachScout(IForm form) {
- setTitleFromScout(form.getTitle());
- setImageFromScout(form.getIconId());
- setMaximizeEnabledFromScout(form.isMaximizeEnabled());
- setMaximizedFromScout(form.isMaximized());
- setMinimizeEnabledFromScout(form.isMinimizeEnabled());
- setMinimizedFromScout(form.isMinimized());
- boolean closable = false;
- for (IFormField f : form.getAllFields()) {
- if (f.isEnabled() && f.isVisible() && f instanceof IButton) {
- switch (((IButton) f).getSystemType()) {
- case IButton.SYSTEM_TYPE_CLOSE:
- case IButton.SYSTEM_TYPE_CANCEL: {
- closable = true;
- break;
- }
- }
- }
- if (closable) {
- break;
- }
- }
- setCloseEnabledFromScout(closable);
- // listeners
- form.addPropertyChangeListener(m_formPropertyListener);
- }
-
- protected void detachScout(IForm form) {
- // listeners
- form.removePropertyChangeListener(m_formPropertyListener);
- }
-
- protected void setImageFromScout(String iconId) {
- IForm form = getScoutObject();
- if (form == null) {
- return;
- }
-
- Image img = getUiEnvironment().getIcon(iconId);
- setTitleImage(img);
-
- String subTitle = form.getSubTitle();
- if (subTitle != null) {
- getUiForm().setImage(img);
- }
- else {
- getUiForm().setImage(null);
- }
-
- }
-
- protected void setTitleFromScout(String title) {
- IForm form = getScoutObject();
- if (form == null) {
- return;
- }
-
- String basicTitle = form.getBasicTitle();
- setPartName(StringUtility.removeNewLines(basicTitle != null ? basicTitle : ""));
-
- String subTitle = form.getSubTitle();
- if (subTitle != null) {
- getUiForm().setText(RwtUtility.escapeMnemonics(StringUtility.removeNewLines(subTitle != null ? subTitle : "")));
- }
- else {
- getUiForm().setText(null);
- }
- }
-
- protected void setMaximizeEnabledFromScout(boolean maximizable) {
- // must be done by instantiating
- }
-
- protected void setMaximizedFromScout(boolean maximized) {
- IWorkbenchPartReference ref = getSite().getPage().getReference(getSite().getPart());
- try {
- if (maximized) {
- getSite().getPage().setPartState(ref, IWorkbenchPage.STATE_MAXIMIZED);
- }
- else {
- getSite().getPage().setPartState(ref, IWorkbenchPage.STATE_RESTORED);
- }
- }
- catch (Exception e) {
- // void
- }
- }
-
- protected void setMinimizeEnabledFromScout(boolean minized) {
- // must be done by instantiating
- }
-
- protected void setMinimizedFromScout(boolean minimized) {
- // IWorkbenchPartReference ref =
- // getSite().getPage().getReference(getSite().getPart());
- // try {
- // if (maximized) {
- // getSite().getPage().setPartState(ref, IWorkbenchPage.STATE_MAXIMIZED);
- // } else {
- // getSite().getPage().setPartState(ref, IWorkbenchPage.STATE_RESTORED);
- // }
- // } catch (Exception e) {
- // // void
- // }
- }
-
- protected void setCloseEnabledFromScout(boolean closebale) {
- // void
- }
-
- @Override
- public void createPartControl(Composite parent) {
- ScoutFormToolkit toolkit = getUiEnvironment().getFormToolkit();
- m_rootForm = toolkit.createForm(parent);
- m_rootArea = m_rootForm.getBody();
- m_rootArea.setLayout(new ViewStackLayout());
- attatchListeners();
- }
-
- @Override
- public Form getUiForm() {
- return getRootForm();
- }
-
- @Override
- public Composite getUiContainer() {
- return getUiForm();
- }
-
- protected Form getRootForm() {
- return m_rootForm;
- }
-
- protected Composite getRootArea() {
- return m_rootArea;
- }
-
- @Override
- public void setFocus() {
- m_rootArea.setFocus();
- }
-
- public Composite getUiContentPane() {
- return m_rootArea;
- }
-
- /**
- * must be implemented by the concrete view to provide an environment
- * <p>
- * Client code must NOT call this method but rather the public method {@link #getUiEnvironment()}
- */
- protected abstract IRwtWorkbenchEnvironment getUiEnvironmentInternal();
-
- protected IRwtWorkbenchEnvironment getUiEnvironment() {
- if (m_uiEnvironment == null) {
- m_uiEnvironment = getUiEnvironmentInternal();
- }
- return m_uiEnvironment;
- }
-
- @Override
- public boolean isVisible() {
- return getSite().getPage().isPartVisible(getSite().getPart());
- }
-
- @Override
- public void activate() {
- if (getSite().getPage().getViewStack(this) != null) {
- getSite().getPage().activate(getSite().getPart());
- }
- }
-
- @Override
- public boolean isActive() {
- IWorkbenchWindow w = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (w == null) {
- return false;
- }
- IWorkbenchPage activePage = w.getActivePage();
- if (activePage == null) {
- return false;
- }
- return (activePage == getSite().getPage()) && (activePage.getActivePart() == this);
- }
-
- @Override
- public boolean setStatusLineMessage(Image image, String message) {
- getViewSite().getActionBars().getStatusLineManager().setMessage(image, message);
- return true;
- }
-
- protected void firePartActivatedFromUI() {
- Runnable job = new Runnable() {
- @Override
- public void run() {
- if (m_scoutForm != null) {
- getUiEnvironment().acquireActivateViewLock();
- try {
- m_scoutForm.getUIFacade().fireFormActivatedFromUI();
- }
- finally {
- getUiEnvironment().releaseActivateViewLock();
- }
- }
- }
- };
- getUiEnvironment().invokeScoutLater(job, 0);
- }
-
- private class P_ViewListener extends PartListener {
- @Override
- public void partActivated(IWorkbenchPartReference partRef) {
- if (partRef.getPart(false).equals(getViewSite().getPart())) {
- if (getUiEnvironment().isInitialized()) {
- firePartActivatedFromUI();
- }
- }
- }
-
- @Override
- public void partClosed(IWorkbenchPartReference partRef) {
- if (getViewSite().getPart().equals(partRef.getPart(false))) {
- try {
- if (m_closeLock.acquire()) {
- Runnable job = new Runnable() {
- @Override
- public void run() {
- if (m_scoutForm != null) {
- m_scoutForm.getUIFacade().fireFormKilledFromUI();
- }
- }
- };
- if (getUiEnvironment().isInitialized()) {
- getUiEnvironment().invokeScoutLater(job, 0);
- }
- }
- }
- finally {
- m_closeLock.release();
- }
- }
- }
- }
-
- @Override
- public int promptToSaveOnClose() {
- if (m_scoutForm == null) {
- return ISaveablePart2.NO;
- }
- if (m_closeFromModel.isReleased()) {
- new ClientSyncJob("Prompt to save", getUiEnvironment().getClientSession()) {
- @Override
- protected void runVoid(IProgressMonitor monitor) throws Throwable {
- if (m_scoutForm != null) {
- m_scoutForm.getUIFacade().fireFormClosingFromUI();
- }
- }
- }.schedule();
- return ISaveablePart2.CANCEL;
- }
- return ISaveablePart2.YES;
- }
-
- @Override
- public void doSave(IProgressMonitor monitor) {
- }
-
- @Override
- public void doSaveAs() {
- }
-
- @Override
- public boolean isDirty() {
- if (m_scoutForm != null && m_scoutForm.isAskIfNeedSave()) {
- boolean saveNeeded = m_scoutForm.isSaveNeeded();
- return saveNeeded;
- }
- else {
- return false;
- }
- }
-
- @Override
- public boolean isSaveAsAllowed() {
- return false;
- }
-
- @Override
- public boolean isSaveOnCloseNeeded() {
- Control focusControl = m_rootArea.getDisplay().getFocusControl();
- if (focusControl != null && !focusControl.isDisposed()) {
- //XXX rap focusControl.traverse(SWT.TRAVERSE_TAB_NEXT);
- }
- return isDirty();
- }
-
- protected void handleScoutPropertyChange(String name, Object newValue) {
- if (name.equals(IForm.PROP_TITLE)) {
- setTitleFromScout((String) newValue);
- }
- else if (name.equals(IForm.PROP_ICON_ID)) {
- setImageFromScout((String) newValue);
- }
- else if (name.equals(IForm.PROP_MINIMIZE_ENABLED)) {
- setMinimizeEnabledFromScout(((Boolean) newValue).booleanValue());
- }
- else if (name.equals(IForm.PROP_MAXIMIZE_ENABLED)) {
- setMaximizeEnabledFromScout(((Boolean) newValue).booleanValue());
- }
- else if (name.equals(IForm.PROP_MINIMIZED)) {
- setMinimizedFromScout(((Boolean) newValue).booleanValue());
- }
- else if (name.equals(IForm.PROP_MAXIMIZED)) {
- setMaximizedFromScout(((Boolean) newValue).booleanValue());
- }
- }
-
- private class P_ScoutPropertyChangeListener implements PropertyChangeListener {
- @Override
- public void propertyChange(final PropertyChangeEvent e) {
- Runnable t = new Runnable() {
- @Override
- public void run() {
- handleScoutPropertyChange(e.getPropertyName(), e.getNewValue());
- }
- };
- getUiEnvironment().invokeUiLater(t);
- }
- }// end private class
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.workbench.window.view;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.scout.commons.OptimisticLock;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
+import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
+import org.eclipse.scout.rt.ui.rap.util.ScoutFormToolkit;
+import org.eclipse.scout.rt.ui.rap.window.IRwtScoutPart;
+import org.eclipse.scout.rt.ui.rap.workbench.IRwtWorkbenchEnvironment;
+import org.eclipse.scout.rt.ui.rap.workbench.util.listener.PartListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.ISaveablePart2;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPartReference;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.forms.widgets.Form;
+import org.eclipse.ui.part.ViewPart;
+
+/**
+ * <h3>AbstractScoutView</h3> ...
+ *
+ * @since 1.0.9 03.07.2008
+ */
+public abstract class AbstractScoutView extends ViewPart implements IRwtScoutPart, ISaveablePart2 {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractScoutView.class);
+ // public static enum ViewState{OPEN, CLOSING_UI, CLOSING_MODEL, CLOSED}
+
+ private IRwtWorkbenchEnvironment m_uiEnvironment;
+
+ private P_ViewListener m_viewListener;
+ private OptimisticLock m_closeLock;
+ private OptimisticLock m_closeFromModel = new OptimisticLock();
+ // private ViewState m_viewState;
+ private OptimisticLock m_layoutLock = new OptimisticLock();
+
+ private Form m_rootForm;
+ private Composite m_rootArea;
+
+ private IForm m_scoutForm;
+
+ private PropertyChangeListener m_formPropertyListener;
+
+ public AbstractScoutView() {
+ m_formPropertyListener = new P_ScoutPropertyChangeListener();
+ m_closeLock = new OptimisticLock();
+ }
+
+ @Override
+ public void setBusy(boolean b) {
+ //nop
+ }
+
+ protected void attatchListeners() {
+ if (m_viewListener == null) {
+ m_viewListener = new P_ViewListener();
+ }
+ getSite().getPage().addPartListener(m_viewListener);
+ }
+
+ protected void detachListeners() {
+ if (m_viewListener != null) {
+ getSite().getPage().removePartListener(m_viewListener);
+ }
+ }
+
+ @Override
+ public void dispose() {
+ detachListeners();
+ super.dispose();
+ }
+
+ @Override
+ public void showPart() {
+ // void here
+ }
+
+ public void showForm(IForm scoutForm) {
+ if (m_scoutForm != null) {
+ LOG.warn("The view 'ID=" + getViewSite().getId() + "' is already open. The form '" + scoutForm.getTitle() + " (" + scoutForm.getClass().getName() + ")' can not be opened!");
+ detachScout(m_scoutForm);
+ m_scoutForm = null;
+ }
+ m_scoutForm = scoutForm;
+ try {
+ m_layoutLock.acquire();
+ getUiContentPane().setRedraw(false);
+ getUiEnvironment().createForm(getUiContentPane(), scoutForm);
+ attachScout(m_scoutForm);
+ }
+ finally {
+ m_layoutLock.release();
+ getUiContentPane().setRedraw(true);
+ getUiContentPane().layout(true, true);
+ }
+ }
+
+ @Override
+ public void closePart() {
+ try {
+ m_closeFromModel.acquire();
+ if (m_closeLock.acquire()) {
+ try {
+ getSite().getPage().hideView(AbstractScoutView.this);
+ }
+ catch (Exception e) {
+ LOG.error("could not close view '" + getViewSite().getId() + "'.", e);
+ }
+ }
+ if (m_scoutForm != null) {
+ detachScout(m_scoutForm);
+ m_scoutForm = null;
+ }
+ }
+ finally {
+ m_closeLock.release();
+ m_closeFromModel.release();
+ }
+ }
+
+ @Override
+ public IForm getScoutObject() {
+ return m_scoutForm;
+ }
+
+ protected void attachScout(IForm form) {
+ setTitleFromScout(form.getTitle());
+ setImageFromScout(form.getIconId());
+ setMaximizeEnabledFromScout(form.isMaximizeEnabled());
+ setMaximizedFromScout(form.isMaximized());
+ setMinimizeEnabledFromScout(form.isMinimizeEnabled());
+ setMinimizedFromScout(form.isMinimized());
+ boolean closable = false;
+ for (IFormField f : form.getAllFields()) {
+ if (f.isEnabled() && f.isVisible() && f instanceof IButton) {
+ switch (((IButton) f).getSystemType()) {
+ case IButton.SYSTEM_TYPE_CLOSE:
+ case IButton.SYSTEM_TYPE_CANCEL: {
+ closable = true;
+ break;
+ }
+ }
+ }
+ if (closable) {
+ break;
+ }
+ }
+ setCloseEnabledFromScout(closable);
+ // listeners
+ form.addPropertyChangeListener(m_formPropertyListener);
+ }
+
+ protected void detachScout(IForm form) {
+ // listeners
+ form.removePropertyChangeListener(m_formPropertyListener);
+ }
+
+ protected void setImageFromScout(String iconId) {
+ IForm form = getScoutObject();
+ if (form == null) {
+ return;
+ }
+
+ Image img = getUiEnvironment().getIcon(iconId);
+ setTitleImage(img);
+
+ String subTitle = form.getSubTitle();
+ if (subTitle != null) {
+ getUiForm().setImage(img);
+ }
+ else {
+ getUiForm().setImage(null);
+ }
+
+ }
+
+ protected void setTitleFromScout(String title) {
+ IForm form = getScoutObject();
+ if (form == null) {
+ return;
+ }
+
+ String basicTitle = form.getBasicTitle();
+ setPartName(StringUtility.removeNewLines(basicTitle != null ? basicTitle : ""));
+
+ String subTitle = form.getSubTitle();
+ if (subTitle != null) {
+ getUiForm().setText(RwtUtility.escapeMnemonics(StringUtility.removeNewLines(subTitle != null ? subTitle : "")));
+ }
+ else {
+ getUiForm().setText(null);
+ }
+ }
+
+ protected void setMaximizeEnabledFromScout(boolean maximizable) {
+ // must be done by instantiating
+ }
+
+ protected void setMaximizedFromScout(boolean maximized) {
+ IWorkbenchPartReference ref = getSite().getPage().getReference(getSite().getPart());
+ try {
+ if (maximized) {
+ getSite().getPage().setPartState(ref, IWorkbenchPage.STATE_MAXIMIZED);
+ }
+ else {
+ getSite().getPage().setPartState(ref, IWorkbenchPage.STATE_RESTORED);
+ }
+ }
+ catch (Exception e) {
+ // void
+ }
+ }
+
+ protected void setMinimizeEnabledFromScout(boolean minized) {
+ // must be done by instantiating
+ }
+
+ protected void setMinimizedFromScout(boolean minimized) {
+ // IWorkbenchPartReference ref =
+ // getSite().getPage().getReference(getSite().getPart());
+ // try {
+ // if (maximized) {
+ // getSite().getPage().setPartState(ref, IWorkbenchPage.STATE_MAXIMIZED);
+ // } else {
+ // getSite().getPage().setPartState(ref, IWorkbenchPage.STATE_RESTORED);
+ // }
+ // } catch (Exception e) {
+ // // void
+ // }
+ }
+
+ protected void setCloseEnabledFromScout(boolean closebale) {
+ // void
+ }
+
+ @Override
+ public void createPartControl(Composite parent) {
+ ScoutFormToolkit toolkit = getUiEnvironment().getFormToolkit();
+ m_rootForm = toolkit.createForm(parent);
+ m_rootArea = m_rootForm.getBody();
+ m_rootArea.setLayout(new ViewStackLayout());
+ attatchListeners();
+ }
+
+ @Override
+ public Form getUiForm() {
+ return getRootForm();
+ }
+
+ @Override
+ public Composite getUiContainer() {
+ return getUiForm();
+ }
+
+ protected Form getRootForm() {
+ return m_rootForm;
+ }
+
+ protected Composite getRootArea() {
+ return m_rootArea;
+ }
+
+ @Override
+ public void setFocus() {
+ m_rootArea.setFocus();
+ }
+
+ public Composite getUiContentPane() {
+ return m_rootArea;
+ }
+
+ /**
+ * must be implemented by the concrete view to provide an environment
+ * <p>
+ * Client code must NOT call this method but rather the public method {@link #getUiEnvironment()}
+ */
+ protected abstract IRwtWorkbenchEnvironment getUiEnvironmentInternal();
+
+ protected IRwtWorkbenchEnvironment getUiEnvironment() {
+ if (m_uiEnvironment == null) {
+ m_uiEnvironment = getUiEnvironmentInternal();
+ }
+ return m_uiEnvironment;
+ }
+
+ @Override
+ public boolean isVisible() {
+ return getSite().getPage().isPartVisible(getSite().getPart());
+ }
+
+ @Override
+ public void activate() {
+ if (getSite().getPage().getViewStack(this) != null) {
+ getSite().getPage().activate(getSite().getPart());
+ }
+ }
+
+ @Override
+ public boolean isActive() {
+ IWorkbenchWindow w = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ if (w == null) {
+ return false;
+ }
+ IWorkbenchPage activePage = w.getActivePage();
+ if (activePage == null) {
+ return false;
+ }
+ return (activePage == getSite().getPage()) && (activePage.getActivePart() == this);
+ }
+
+ @Override
+ public boolean setStatusLineMessage(Image image, String message) {
+ getViewSite().getActionBars().getStatusLineManager().setMessage(image, message);
+ return true;
+ }
+
+ protected void firePartActivatedFromUI() {
+ Runnable job = new Runnable() {
+ @Override
+ public void run() {
+ if (m_scoutForm != null) {
+ getUiEnvironment().acquireActivateViewLock();
+ try {
+ m_scoutForm.getUIFacade().fireFormActivatedFromUI();
+ }
+ finally {
+ getUiEnvironment().releaseActivateViewLock();
+ }
+ }
+ }
+ };
+ getUiEnvironment().invokeScoutLater(job, 0);
+ }
+
+ private class P_ViewListener extends PartListener {
+ @Override
+ public void partActivated(IWorkbenchPartReference partRef) {
+ if (partRef.getPart(false).equals(getViewSite().getPart())) {
+ if (getUiEnvironment().isInitialized()) {
+ firePartActivatedFromUI();
+ }
+ }
+ }
+
+ @Override
+ public void partClosed(IWorkbenchPartReference partRef) {
+ if (getViewSite().getPart().equals(partRef.getPart(false))) {
+ try {
+ if (m_closeLock.acquire()) {
+ Runnable job = new Runnable() {
+ @Override
+ public void run() {
+ if (m_scoutForm != null) {
+ m_scoutForm.getUIFacade().fireFormKilledFromUI();
+ }
+ }
+ };
+ if (getUiEnvironment().isInitialized()) {
+ getUiEnvironment().invokeScoutLater(job, 0);
+ }
+ }
+ }
+ finally {
+ m_closeLock.release();
+ }
+ }
+ }
+ }
+
+ @Override
+ public int promptToSaveOnClose() {
+ if (m_scoutForm == null) {
+ return ISaveablePart2.NO;
+ }
+ if (m_closeFromModel.isReleased()) {
+ new ClientSyncJob("Prompt to save", getUiEnvironment().getClientSession()) {
+ @Override
+ protected void runVoid(IProgressMonitor monitor) throws Throwable {
+ if (m_scoutForm != null) {
+ m_scoutForm.getUIFacade().fireFormClosingFromUI();
+ }
+ }
+ }.schedule();
+ return ISaveablePart2.CANCEL;
+ }
+ return ISaveablePart2.YES;
+ }
+
+ @Override
+ public void doSave(IProgressMonitor monitor) {
+ }
+
+ @Override
+ public void doSaveAs() {
+ }
+
+ @Override
+ public boolean isDirty() {
+ if (m_scoutForm != null && m_scoutForm.isAskIfNeedSave()) {
+ boolean saveNeeded = m_scoutForm.isSaveNeeded();
+ return saveNeeded;
+ }
+ else {
+ return false;
+ }
+ }
+
+ @Override
+ public boolean isSaveAsAllowed() {
+ return false;
+ }
+
+ @Override
+ public boolean isSaveOnCloseNeeded() {
+ Control focusControl = m_rootArea.getDisplay().getFocusControl();
+ if (focusControl != null && !focusControl.isDisposed()) {
+ //XXX rap focusControl.traverse(SWT.TRAVERSE_TAB_NEXT);
+ }
+ return isDirty();
+ }
+
+ protected void handleScoutPropertyChange(String name, Object newValue) {
+ if (name.equals(IForm.PROP_TITLE)) {
+ setTitleFromScout((String) newValue);
+ }
+ else if (name.equals(IForm.PROP_ICON_ID)) {
+ setImageFromScout((String) newValue);
+ }
+ else if (name.equals(IForm.PROP_MINIMIZE_ENABLED)) {
+ setMinimizeEnabledFromScout(((Boolean) newValue).booleanValue());
+ }
+ else if (name.equals(IForm.PROP_MAXIMIZE_ENABLED)) {
+ setMaximizeEnabledFromScout(((Boolean) newValue).booleanValue());
+ }
+ else if (name.equals(IForm.PROP_MINIMIZED)) {
+ setMinimizedFromScout(((Boolean) newValue).booleanValue());
+ }
+ else if (name.equals(IForm.PROP_MAXIMIZED)) {
+ setMaximizedFromScout(((Boolean) newValue).booleanValue());
+ }
+ }
+
+ private class P_ScoutPropertyChangeListener implements PropertyChangeListener {
+ @Override
+ public void propertyChange(final PropertyChangeEvent e) {
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ handleScoutPropertyChange(e.getPropertyName(), e.getNewValue());
+ }
+ };
+ getUiEnvironment().invokeUiLater(t);
+ }
+ }// end private class
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/window/view/ViewStackLayout.java b/org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/window/view/ViewStackLayout.java
index 7311743a87..c815d51003 100644
--- a/org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/window/view/ViewStackLayout.java
+++ b/org.eclipse.scout.rt.ui.rap.workbench/src/org/eclipse/scout/rt/ui/rap/workbench/window/view/ViewStackLayout.java
@@ -1,86 +1,86 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.workbench.window.view;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Layout;
-import org.eclipse.ui.forms.widgets.ILayoutExtension;
-
-public class ViewStackLayout extends Layout implements ILayoutExtension {
- private static final long serialVersionUID = 1L;
-
- public ViewStackLayout() {
- }
-
- @Override
- public int computeMinimumWidth(Composite parent, boolean changed) {
- Control lastChild = getLastChild(parent);
- if (lastChild != null) {
- if (lastChild instanceof Composite) {
- Layout cLayout = ((Composite) lastChild).getLayout();
- if (cLayout instanceof ILayoutExtension) {
- return ((ILayoutExtension) cLayout).computeMinimumWidth((Composite) lastChild, changed);
- }
- }
- }
- return computeSize(parent, 0, SWT.DEFAULT, changed).x;
- }
-
- @Override
- public int computeMaximumWidth(Composite parent, boolean changed) {
- Control lastChild = getLastChild(parent);
- if (lastChild != null) {
- if (lastChild instanceof Composite) {
- Layout cLayout = ((Composite) lastChild).getLayout();
- if (cLayout instanceof ILayoutExtension) {
- return ((ILayoutExtension) cLayout).computeMinimumWidth((Composite) lastChild, changed);
- }
- }
- }
- return computeSize(parent, 1240000, SWT.DEFAULT, changed).y;
- }
-
- @Override
- protected Point computeSize(Composite composite, int hint, int hint2, boolean flushCache) {
- Control lastChild = getLastChild(composite);
- if (lastChild != null) {
- return lastChild.computeSize(hint, hint2, flushCache);
- }
- return new Point(0, 0);
- }
-
- @Override
- protected void layout(Composite composite, boolean flushCache) {
- Rectangle clientArea = composite.getClientArea();
- Control[] children = composite.getChildren();
- for (int i = 0; i < children.length; i++) {
- if (i == children.length - 1) {
- children[i].setBounds(clientArea);
- }
- else {
- children[i].setBounds(0, 0, 0, 0);
- }
- }
- }
-
- private Control getLastChild(Composite composite) {
- Control[] children = composite.getChildren();
- if (children.length > 0) {
- return children[children.length - 1];
- }
- return null;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.workbench.window.view;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Layout;
+import org.eclipse.ui.forms.widgets.ILayoutExtension;
+
+public class ViewStackLayout extends Layout implements ILayoutExtension {
+ private static final long serialVersionUID = 1L;
+
+ public ViewStackLayout() {
+ }
+
+ @Override
+ public int computeMinimumWidth(Composite parent, boolean changed) {
+ Control lastChild = getLastChild(parent);
+ if (lastChild != null) {
+ if (lastChild instanceof Composite) {
+ Layout cLayout = ((Composite) lastChild).getLayout();
+ if (cLayout instanceof ILayoutExtension) {
+ return ((ILayoutExtension) cLayout).computeMinimumWidth((Composite) lastChild, changed);
+ }
+ }
+ }
+ return computeSize(parent, 0, SWT.DEFAULT, changed).x;
+ }
+
+ @Override
+ public int computeMaximumWidth(Composite parent, boolean changed) {
+ Control lastChild = getLastChild(parent);
+ if (lastChild != null) {
+ if (lastChild instanceof Composite) {
+ Layout cLayout = ((Composite) lastChild).getLayout();
+ if (cLayout instanceof ILayoutExtension) {
+ return ((ILayoutExtension) cLayout).computeMinimumWidth((Composite) lastChild, changed);
+ }
+ }
+ }
+ return computeSize(parent, 1240000, SWT.DEFAULT, changed).y;
+ }
+
+ @Override
+ protected Point computeSize(Composite composite, int hint, int hint2, boolean flushCache) {
+ Control lastChild = getLastChild(composite);
+ if (lastChild != null) {
+ return lastChild.computeSize(hint, hint2, flushCache);
+ }
+ return new Point(0, 0);
+ }
+
+ @Override
+ protected void layout(Composite composite, boolean flushCache) {
+ Rectangle clientArea = composite.getClientArea();
+ Control[] children = composite.getChildren();
+ for (int i = 0; i < children.length; i++) {
+ if (i == children.length - 1) {
+ children[i].setBounds(clientArea);
+ }
+ else {
+ children[i].setBounds(0, 0, 0, 0);
+ }
+ }
+ }
+
+ private Control getLastChild(Composite composite) {
+ Control[] children = composite.getChildren();
+ if (children.length > 0) {
+ return children[children.length - 1];
+ }
+ return null;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/.settings/org.eclipse.pde.core.prefs b/org.eclipse.scout.rt.ui.rap/.settings/org.eclipse.pde.core.prefs
index 94ebd7c994..19430adcc9 100644
--- a/org.eclipse.scout.rt.ui.rap/.settings/org.eclipse.pde.core.prefs
+++ b/org.eclipse.scout.rt.ui.rap/.settings/org.eclipse.pde.core.prefs
@@ -1,3 +1,3 @@
-#Mon Mar 26 13:45:31 CEST 2007
-eclipse.preferences.version=1
-pluginProject.extensions=true
+#Mon Mar 26 13:45:31 CEST 2007
+eclipse.preferences.version=1
+pluginProject.extensions=true
diff --git a/org.eclipse.scout.rt.ui.rap/Release Notes.txt b/org.eclipse.scout.rt.ui.rap/Release Notes.txt
index 84d432c70f..90a21996e6 100644
--- a/org.eclipse.scout.rt.ui.rap/Release Notes.txt
+++ b/org.eclipse.scout.rt.ui.rap/Release Notes.txt
@@ -1,58 +1,58 @@
-24.08.2011 imo
-bsi ticket 102089, bug 355669
-Problem:
-When a listbox or treebox is checkable=true then it shows checkmarks as icons.
-However if the listbox also has an icon defined either directly on the listbox
-or via its data provider (codetype/lookupcall), then this icon is not shown.
-Solution:
-In this (rare) case both icons are displayed as a composite icon.
-Migration:
-None
-
-25.08.2011 dwi
-BSI ticket #105'026
-Problem:
-Default font specific issues in HTML cleanup which is applied to the HTML text prior being provided to AbstractHtmlField:
- - Application specific default font settings should always be applied to body style definition if not specified yet
- - default font size unit on SWT should be pt instead of px
- - precedence of font-families should be supported in default font settings
-Solution:
-- Changed HTMLUtility#cleanupHtml(..) to ensure default font settings to be contained in CSS style definition
-- changed default font size unit in AbstractSwtEnvironment#createDefaultFontSettings(Control) to pt
-Plug-Ins changed:
-- org.eclipse.scout.commons
-- org.eclipse.scout.rt.ui.swt
-- org.eclipse.scout.rt.ui.swing
-- org.eclipse.scout.rt.ui.rap
-Migration:
-None
-
-21.12.2011 sle
-Problem:
-The Flag enabledAsReadOnly was introduced ca. two years ago. The "true" case is
-today standard, also in all other ui reprecentations. As the naming is not
-realy clear the idea came up, to remove this flag alltogether. All internal
-projects are ok with this.
-Solution:
-Removed extension point element “enableBehaviour”.
-Plug-Ins changed: org.eclipse.scout.rt.ui.rap
-Migration: Remove extension point “enableBehaviour” in projects rap-bundle.
-
-12.01.2012 imo
-Bugzilla: 364574
-New busy handling facility
-The default rwt implementation RwtBusyHandler is attached in AbstractRwtEnvironment.attachBusyHandler.
-It shows a wait cursor for 3 seconds and then blocks all views/dialog of the same IClientSession.
-
-07.02.2012 abr
-Bugzilla: 370798
-memory leak in KeyStrokeManager
-Several Scout RWT composites register key strokes on the KeyStorkeManager. A widget and all its key strokes
-are put into maps on the KeyStrokeManager. They are however not always removed when the widget is disposed.
-Hence the KeyStrokeManager keeps references and prevents the garbage collection of disposed UI and model objects.
-Migration: None
-
-08.02.2012 imo
-Added ui property to set minimum width of tool forms on right side
-IUIDecoration.getToolFormMinWidth
-
+24.08.2011 imo
+bsi ticket 102089, bug 355669
+Problem:
+When a listbox or treebox is checkable=true then it shows checkmarks as icons.
+However if the listbox also has an icon defined either directly on the listbox
+or via its data provider (codetype/lookupcall), then this icon is not shown.
+Solution:
+In this (rare) case both icons are displayed as a composite icon.
+Migration:
+None
+
+25.08.2011 dwi
+BSI ticket #105'026
+Problem:
+Default font specific issues in HTML cleanup which is applied to the HTML text prior being provided to AbstractHtmlField:
+ - Application specific default font settings should always be applied to body style definition if not specified yet
+ - default font size unit on SWT should be pt instead of px
+ - precedence of font-families should be supported in default font settings
+Solution:
+- Changed HTMLUtility#cleanupHtml(..) to ensure default font settings to be contained in CSS style definition
+- changed default font size unit in AbstractSwtEnvironment#createDefaultFontSettings(Control) to pt
+Plug-Ins changed:
+- org.eclipse.scout.commons
+- org.eclipse.scout.rt.ui.swt
+- org.eclipse.scout.rt.ui.swing
+- org.eclipse.scout.rt.ui.rap
+Migration:
+None
+
+21.12.2011 sle
+Problem:
+The Flag enabledAsReadOnly was introduced ca. two years ago. The "true" case is
+today standard, also in all other ui reprecentations. As the naming is not
+realy clear the idea came up, to remove this flag alltogether. All internal
+projects are ok with this.
+Solution:
+Removed extension point element “enableBehaviour”.
+Plug-Ins changed: org.eclipse.scout.rt.ui.rap
+Migration: Remove extension point “enableBehaviour” in projects rap-bundle.
+
+12.01.2012 imo
+Bugzilla: 364574
+New busy handling facility
+The default rwt implementation RwtBusyHandler is attached in AbstractRwtEnvironment.attachBusyHandler.
+It shows a wait cursor for 3 seconds and then blocks all views/dialog of the same IClientSession.
+
+07.02.2012 abr
+Bugzilla: 370798
+memory leak in KeyStrokeManager
+Several Scout RWT composites register key strokes on the KeyStorkeManager. A widget and all its key strokes
+are put into maps on the KeyStrokeManager. They are however not always removed when the widget is disposed.
+Hence the KeyStrokeManager keeps references and prevents the garbage collection of disposed UI and model objects.
+Migration: None
+
+08.02.2012 imo
+Added ui property to set minimum width of tool forms on right side
+IUIDecoration.getToolFormMinWidth
+
diff --git a/org.eclipse.scout.rt.ui.rap/plugin.xml b/org.eclipse.scout.rt.ui.rap/plugin.xml
index aed57889e6..f3ff23e4cc 100644
--- a/org.eclipse.scout.rt.ui.rap/plugin.xml
+++ b/org.eclipse.scout.rt.ui.rap/plugin.xml
@@ -1,393 +1,393 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<!--
- Copyright (c) 2011 BSI Business Systems Integration AG.
- All rights reserved. This program and the accompanying materials
- are made available under the terms of the Eclipse Public License v1.0
- which accompanies this distribution, and is available at
- http://www.eclipse.org/legal/epl-v10.html
-
- Contributors:
- BSI Business Systems Integration AG - initial API and implementation
- -->
-
-<plugin>
- <extension-point id="org.eclipse.scout.rt.ui.rap.formfields" name="Form Fields" schema="schema/formfields.exsd"/>
- <extension-point id="org.eclipse.scout.rt.ui.rap.lookAndFeel" name="lookAndFeel" schema="schema/lookAndFeel.exsd"/>
- <extension-point id="org.eclipse.scout.rt.ui.rap.scouticons" name="Scout Icons" schema="schema/scouticons.exsd"/>
- <extension point="org.eclipse.scout.service.services">
- <service class="org.eclipse.scout.rt.ui.rap.services.common.clipboard.RwtScoutClipboardService" />
- <service class="org.eclipse.scout.rt.ui.rap.services.common.icon.RwtBundleIconProviderService"
- createImmediately="false"
- factory="org.eclipse.scout.rt.client.services.ClientServiceFactory"
- ranking="-1000">
- </service>
- <service class="org.eclipse.scout.rt.ui.rap.services.common.patchedclass.PatchedClassService"
- createImmediately="true">
- </service>
- </extension>
-
- <extension point="org.eclipse.ui.activities">
- <activity
- name="Remove Unused Icons Manager"
- id="activity.removeUnusedIcons" />
- <activityPatternBinding
- activityId="activity.removeUnusedIcons"
- pattern="org\.eclipse\.ui\.editors/org\.eclipse\.ui\.edit\.text\.gotoLastEditPosition" />
- <activityPatternBinding
- activityId="activity.removeUnusedIcons"
- pattern="org.eclipse.ui.editors/org.eclipse.ui.edit.text.*nnotation" />
- </extension>
-
- <extension point="org.eclipse.ui.bindings">
- <scheme
- id="org.eclipse.scout.rt.ui.rap.keybindings.scheme"
- name="Scout SWT Keybindings Scheme">
- </scheme>
- </extension>
- <extension
- point="org.eclipse.scout.rt.ui.rap.formfields">
- <formField
- active="true"
- modelClass="org.eclipse.scout.rt.client.ui.form.fields.IFormField"
- name="Unknown Control"
- scope="default">
- <uiClass
- class="org.eclipse.scout.rt.ui.rap.form.fields.RwtScoutUnknownControl">
- </uiClass>
- </formField>
- <formField
- active="true"
- modelClass="org.eclipse.scout.rt.client.ui.form.fields.tabbox.ITabBox"
- name="Tab box"
- scope="default">
- <uiClass
- class="org.eclipse.scout.rt.ui.rap.form.fields.tabbox.RwtScoutTabBox">
- </uiClass>
- </formField>
- <formField
- active="true"
- modelClass="org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox"
- name="Group box"
- scope="default">
- <uiClass
- class="org.eclipse.scout.rt.ui.rap.form.fields.groupbox.RwtScoutGroupBox">
- </uiClass>
- </formField>
- <formField
- active="true"
- modelClass="org.eclipse.scout.rt.client.ui.form.fields.snapbox.ISnapBox"
- name="Snap box"
- scope="default">
- <uiClass
- class="org.eclipse.scout.rt.ui.rap.form.fields.snapbox.RwtScoutSnapBox">
- </uiClass>
- </formField>
- <formField
- active="true"
- modelClass="org.eclipse.scout.rt.client.ui.form.fields.smartfield.ISmartField"
- name="Smart field"
- scope="default">
- <uiClass
- class="org.eclipse.scout.rt.ui.rap.form.fields.smartfield.RwtScoutSmartField">
- </uiClass>
- </formField>
- <formField
- active="true"
- modelClass="org.eclipse.scout.rt.client.ui.form.fields.listbox.IListBox"
- name="List Box"
- scope="default">
- <uiClass
- class="org.eclipse.scout.rt.ui.rap.form.fields.listbox.RwtScoutListBox">
- </uiClass>
- </formField>
- <formField
- active="true"
- modelClass="org.eclipse.scout.rt.client.ui.form.fields.treebox.ITreeBox"
- name="Tree box"
- scope="default">
- <uiClass
- class="org.eclipse.scout.rt.ui.rap.form.fields.treebox.RwtScoutTreeBox">
- </uiClass>
- </formField>
- <formField
- active="true"
- modelClass="org.eclipse.scout.rt.client.ui.form.fields.datefield.IDateField"
- name="Date field"
- scope="default">
- <factory
- class="org.eclipse.scout.rt.ui.rap.form.fields.datefield.DateFieldFactory">
- </factory>
- </formField>
- <formField
- active="true"
- modelClass="org.eclipse.scout.rt.client.ui.form.fields.tablefield.ITableField"
- name="Table field"
- scope="default">
- <uiClass
- class="org.eclipse.scout.rt.ui.rap.form.fields.tablefield.RwtScoutTableField">
- </uiClass>
- </formField>
- <formField
- active="true"
- modelClass="org.eclipse.scout.rt.client.ui.form.fields.treefield.ITreeField"
- name="Tree field"
- scope="default">
- <uiClass
- class="org.eclipse.scout.rt.ui.rap.form.fields.treefield.RwtScoutTreeField">
- </uiClass>
- </formField>
- <formField
- active="true"
- modelClass="org.eclipse.scout.rt.client.ui.form.fields.booleanfield.IBooleanField"
- name="Boolean field, checkbox"
- scope="default">
- <uiClass
- class="org.eclipse.scout.rt.ui.rap.form.fields.checkbox.RwtScoutCheckbox">
- </uiClass>
- </formField>
- <formField
- active="true"
- modelClass="org.eclipse.scout.rt.client.ui.form.fields.decimalfield.IDecimalField"
- name="Decimal field"
- scope="default">
- <uiClass
- class="org.eclipse.scout.rt.ui.rap.form.fields.decimalfield.RwtScoutDecimalField">
- </uiClass>
- </formField>
- <formField
- active="true"
- modelClass="org.eclipse.scout.rt.client.ui.form.fields.labelfield.ILabelField"
- name="Label field"
- scope="default">
- <uiClass
- class="org.eclipse.scout.rt.ui.rap.form.fields.labelfield.RwtScoutLabelField">
- </uiClass>
- </formField>
- <formField
- active="true"
- modelClass="org.eclipse.scout.rt.client.ui.form.fields.numberfield.INumberField"
- name="Number field"
- scope="default">
- <uiClass
- class="org.eclipse.scout.rt.ui.rap.form.fields.numberfield.RwtScoutNumberField">
- </uiClass>
- </formField>
- <formField
- active="true"
- modelClass="org.eclipse.scout.rt.client.ui.form.fields.radiobuttongroup.IRadioButtonGroup"
- name="Radio button group"
- scope="default">
- <uiClass
- class="org.eclipse.scout.rt.ui.rap.form.radiobuttongroup.RwtScoutRadioButtonGroup">
- </uiClass>
- </formField>
- <formField
- active="true"
- modelClass="org.eclipse.scout.rt.client.ui.form.fields.sequencebox.ISequenceBox"
- name="Sequence box"
- scope="default">
- <uiClass
- class="org.eclipse.scout.rt.ui.rap.form.fields.sequencebox.RwtScoutSequenceBox">
- </uiClass>
- </formField>
- <formField
- active="true"
- modelClass="org.eclipse.scout.rt.client.ui.form.fields.splitbox.ISplitBox"
- name="Split box"
- scope="default">
- <uiClass
- class="org.eclipse.scout.rt.ui.rap.form.fields.splitbox.RwtScoutSplitBox">
- </uiClass>
- </formField>
- <formField
- active="true"
- modelClass="org.eclipse.scout.rt.client.ui.form.fields.imagebox.IImageField"
- name="Image field"
- scope="default">
- <uiClass
- class="org.eclipse.scout.rt.ui.rap.form.fields.imagebox.RwtScoutImageField">
- </uiClass>
- </formField>
- <formField
- active="true"
- modelClass="org.eclipse.scout.rt.client.ui.form.fields.wrappedform.IWrappedFormField"
- name="Wrapped form field"
- scope="default">
- <uiClass
- class="org.eclipse.scout.rt.ui.rap.form.fields.wrappedformfield.RwtScoutWrappedFormField">
- </uiClass>
- </formField>
- <formField
- active="true"
- modelClass="org.eclipse.scout.rt.client.ui.form.fields.browserfield.IBrowserField"
- name="Browser field"
- scope="default">
- <uiClass
- class="org.eclipse.scout.rt.ui.rap.form.fields.browserfield.RwtScoutBrowserField">
- </uiClass>
- </formField>
- <formField
- active="true"
- modelClass="org.eclipse.scout.rt.client.ui.form.fields.htmlfield.IHtmlField"
- name="Html field"
- scope="default">
- <uiClass
- class="org.eclipse.scout.rt.ui.rap.form.fields.htmlfield.RwtScoutHtmlField">
- </uiClass>
- </formField>
- <formField
- active="true"
- modelClass="org.eclipse.scout.rt.client.ui.form.fields.stringfield.IStringField"
- name="String field"
- scope="default">
- <uiClass
- class="org.eclipse.scout.rt.ui.rap.form.fields.stringfield.RwtScoutStringField">
- </uiClass>
- </formField>
- <formField
- active="true"
- modelClass="org.eclipse.scout.rt.client.ui.form.fields.button.IButton"
- name="Button"
- scope="default">
- <factory
- class="org.eclipse.scout.rt.ui.rap.form.fields.button.ButtonFieldFactory">
- </factory>
- </formField>
- <formField
- active="true"
- modelClass="org.eclipse.scout.rt.client.ui.form.fields.placeholder.IPlaceholderField"
- name="Placeholder"
- scope="default">
- <uiClass
- class="org.eclipse.scout.rt.ui.rap.form.fields.placeholder.RwtScoutPlaceholderField">
- </uiClass>
- </formField>
- <formField
- active="true"
- modelClass="org.eclipse.scout.rt.client.ui.form.fields.composer.IComposerField"
- name="Composer field">
- <uiClass
- class="org.eclipse.scout.rt.ui.rap.form.fields.composer.RwtScoutComposerField">
- </uiClass>
- </formField>
- </extension>
- <extension
- point="org.eclipse.scout.rt.ui.rap.lookAndFeel">
- <decorations
- scope="default">
- <mandatory>
- <labelFont>
- </labelFont>
- <starMarker
- placement="afterLabel">
- </starMarker>
- </mandatory>
- </decorations>
- <properties
- scope="default">
- <property
- name="logicalGridLayout.defaultColumnWidth"
- value="360">
- </property>
- <property
- name="logicalGridLayout.defaultPopupWidth"
- value="230">
- </property>
- <property
- name="logicalGridLayout.verticalGap"
- value="6">
- </property>
- <property
- name="logicalGridLayout.rowHeight"
- value="23">
- </property>
- <property
- name="logicalGridLayout.horizontalGap"
- value="12">
- </property>
- <property
- name="formFieldLabel.width"
- value="130">
- </property>
- <property
- name="formMainBoxBorder.visible"
- value="false">
- </property>
- <property
- name="processButton.height"
- value="23">
- </property>
- <property
- name="processButton.minWidth"
- value="80">
- </property>
- <property
- name="processButton.maxWidth"
- value="250">
- </property>
- <property
- name="color.forground.disabled"
- value="2A5A76">
- </property>
- <property
- name="formFieldLabel.alignment"
- value="left">
- </property>
- <property
- name="formfield.selectAllOnFocus.enabled"
- value="true">
- </property>
- <property
- name="dndSupport.enabled"
- value="true">
- </property>
- <property
- name="table.row.height"
- value="23">
- </property>
- <property
- name="tree.node.height"
- value="23">
- </property>
- <property
- name="browserHistory.enabled"
- value="true">
- </property>
- </properties>
- </extension>
-
- <extension
- point="org.eclipse.equinox.http.registry.filters">
- <filter
- alias="/"
- class="org.eclipse.scout.rt.ui.rap.internal.servletfilter.DelegateFilter"
- httpcontextId="org.eclipse.rap.httpcontext">
- </filter>
- </extension>
-
- <extension point="org.eclipse.scout.http.servletfilter.filters">
- <filter aliases="/" class="org.eclipse.scout.http.servletfilter.helper.DevelopmentAuthFilter" ranking="1000000">
- <init-param
- name="active"
- value="true">
- </init-param>
- </filter>
- <filter aliases="/" class="org.eclipse.scout.http.servletfilter.helper.HttpAuthJaasFilter" ranking="1000010">
- <init-param
- name="active"
- value="true">
- </init-param>
- </filter>
- <filter
- aliases="/"
- class="org.eclipse.scout.rt.ui.rap.internal.servletfilter.LogoutFilter"
- ranking="-1000000">
- <init-param
- name="active"
- value="true">
- </init-param>
- </filter>
- </extension>
-
-</plugin>
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<!--
+ Copyright (c) 2011 BSI Business Systems Integration AG.
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+ BSI Business Systems Integration AG - initial API and implementation
+ -->
+
+<plugin>
+ <extension-point id="org.eclipse.scout.rt.ui.rap.formfields" name="Form Fields" schema="schema/formfields.exsd"/>
+ <extension-point id="org.eclipse.scout.rt.ui.rap.lookAndFeel" name="lookAndFeel" schema="schema/lookAndFeel.exsd"/>
+ <extension-point id="org.eclipse.scout.rt.ui.rap.scouticons" name="Scout Icons" schema="schema/scouticons.exsd"/>
+ <extension point="org.eclipse.scout.service.services">
+ <service class="org.eclipse.scout.rt.ui.rap.services.common.clipboard.RwtScoutClipboardService" />
+ <service class="org.eclipse.scout.rt.ui.rap.services.common.icon.RwtBundleIconProviderService"
+ createImmediately="false"
+ factory="org.eclipse.scout.rt.client.services.ClientServiceFactory"
+ ranking="-1000">
+ </service>
+ <service class="org.eclipse.scout.rt.ui.rap.services.common.patchedclass.PatchedClassService"
+ createImmediately="true">
+ </service>
+ </extension>
+
+ <extension point="org.eclipse.ui.activities">
+ <activity
+ name="Remove Unused Icons Manager"
+ id="activity.removeUnusedIcons" />
+ <activityPatternBinding
+ activityId="activity.removeUnusedIcons"
+ pattern="org\.eclipse\.ui\.editors/org\.eclipse\.ui\.edit\.text\.gotoLastEditPosition" />
+ <activityPatternBinding
+ activityId="activity.removeUnusedIcons"
+ pattern="org.eclipse.ui.editors/org.eclipse.ui.edit.text.*nnotation" />
+ </extension>
+
+ <extension point="org.eclipse.ui.bindings">
+ <scheme
+ id="org.eclipse.scout.rt.ui.rap.keybindings.scheme"
+ name="Scout SWT Keybindings Scheme">
+ </scheme>
+ </extension>
+ <extension
+ point="org.eclipse.scout.rt.ui.rap.formfields">
+ <formField
+ active="true"
+ modelClass="org.eclipse.scout.rt.client.ui.form.fields.IFormField"
+ name="Unknown Control"
+ scope="default">
+ <uiClass
+ class="org.eclipse.scout.rt.ui.rap.form.fields.RwtScoutUnknownControl">
+ </uiClass>
+ </formField>
+ <formField
+ active="true"
+ modelClass="org.eclipse.scout.rt.client.ui.form.fields.tabbox.ITabBox"
+ name="Tab box"
+ scope="default">
+ <uiClass
+ class="org.eclipse.scout.rt.ui.rap.form.fields.tabbox.RwtScoutTabBox">
+ </uiClass>
+ </formField>
+ <formField
+ active="true"
+ modelClass="org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox"
+ name="Group box"
+ scope="default">
+ <uiClass
+ class="org.eclipse.scout.rt.ui.rap.form.fields.groupbox.RwtScoutGroupBox">
+ </uiClass>
+ </formField>
+ <formField
+ active="true"
+ modelClass="org.eclipse.scout.rt.client.ui.form.fields.snapbox.ISnapBox"
+ name="Snap box"
+ scope="default">
+ <uiClass
+ class="org.eclipse.scout.rt.ui.rap.form.fields.snapbox.RwtScoutSnapBox">
+ </uiClass>
+ </formField>
+ <formField
+ active="true"
+ modelClass="org.eclipse.scout.rt.client.ui.form.fields.smartfield.ISmartField"
+ name="Smart field"
+ scope="default">
+ <uiClass
+ class="org.eclipse.scout.rt.ui.rap.form.fields.smartfield.RwtScoutSmartField">
+ </uiClass>
+ </formField>
+ <formField
+ active="true"
+ modelClass="org.eclipse.scout.rt.client.ui.form.fields.listbox.IListBox"
+ name="List Box"
+ scope="default">
+ <uiClass
+ class="org.eclipse.scout.rt.ui.rap.form.fields.listbox.RwtScoutListBox">
+ </uiClass>
+ </formField>
+ <formField
+ active="true"
+ modelClass="org.eclipse.scout.rt.client.ui.form.fields.treebox.ITreeBox"
+ name="Tree box"
+ scope="default">
+ <uiClass
+ class="org.eclipse.scout.rt.ui.rap.form.fields.treebox.RwtScoutTreeBox">
+ </uiClass>
+ </formField>
+ <formField
+ active="true"
+ modelClass="org.eclipse.scout.rt.client.ui.form.fields.datefield.IDateField"
+ name="Date field"
+ scope="default">
+ <factory
+ class="org.eclipse.scout.rt.ui.rap.form.fields.datefield.DateFieldFactory">
+ </factory>
+ </formField>
+ <formField
+ active="true"
+ modelClass="org.eclipse.scout.rt.client.ui.form.fields.tablefield.ITableField"
+ name="Table field"
+ scope="default">
+ <uiClass
+ class="org.eclipse.scout.rt.ui.rap.form.fields.tablefield.RwtScoutTableField">
+ </uiClass>
+ </formField>
+ <formField
+ active="true"
+ modelClass="org.eclipse.scout.rt.client.ui.form.fields.treefield.ITreeField"
+ name="Tree field"
+ scope="default">
+ <uiClass
+ class="org.eclipse.scout.rt.ui.rap.form.fields.treefield.RwtScoutTreeField">
+ </uiClass>
+ </formField>
+ <formField
+ active="true"
+ modelClass="org.eclipse.scout.rt.client.ui.form.fields.booleanfield.IBooleanField"
+ name="Boolean field, checkbox"
+ scope="default">
+ <uiClass
+ class="org.eclipse.scout.rt.ui.rap.form.fields.checkbox.RwtScoutCheckbox">
+ </uiClass>
+ </formField>
+ <formField
+ active="true"
+ modelClass="org.eclipse.scout.rt.client.ui.form.fields.decimalfield.IDecimalField"
+ name="Decimal field"
+ scope="default">
+ <uiClass
+ class="org.eclipse.scout.rt.ui.rap.form.fields.decimalfield.RwtScoutDecimalField">
+ </uiClass>
+ </formField>
+ <formField
+ active="true"
+ modelClass="org.eclipse.scout.rt.client.ui.form.fields.labelfield.ILabelField"
+ name="Label field"
+ scope="default">
+ <uiClass
+ class="org.eclipse.scout.rt.ui.rap.form.fields.labelfield.RwtScoutLabelField">
+ </uiClass>
+ </formField>
+ <formField
+ active="true"
+ modelClass="org.eclipse.scout.rt.client.ui.form.fields.numberfield.INumberField"
+ name="Number field"
+ scope="default">
+ <uiClass
+ class="org.eclipse.scout.rt.ui.rap.form.fields.numberfield.RwtScoutNumberField">
+ </uiClass>
+ </formField>
+ <formField
+ active="true"
+ modelClass="org.eclipse.scout.rt.client.ui.form.fields.radiobuttongroup.IRadioButtonGroup"
+ name="Radio button group"
+ scope="default">
+ <uiClass
+ class="org.eclipse.scout.rt.ui.rap.form.radiobuttongroup.RwtScoutRadioButtonGroup">
+ </uiClass>
+ </formField>
+ <formField
+ active="true"
+ modelClass="org.eclipse.scout.rt.client.ui.form.fields.sequencebox.ISequenceBox"
+ name="Sequence box"
+ scope="default">
+ <uiClass
+ class="org.eclipse.scout.rt.ui.rap.form.fields.sequencebox.RwtScoutSequenceBox">
+ </uiClass>
+ </formField>
+ <formField
+ active="true"
+ modelClass="org.eclipse.scout.rt.client.ui.form.fields.splitbox.ISplitBox"
+ name="Split box"
+ scope="default">
+ <uiClass
+ class="org.eclipse.scout.rt.ui.rap.form.fields.splitbox.RwtScoutSplitBox">
+ </uiClass>
+ </formField>
+ <formField
+ active="true"
+ modelClass="org.eclipse.scout.rt.client.ui.form.fields.imagebox.IImageField"
+ name="Image field"
+ scope="default">
+ <uiClass
+ class="org.eclipse.scout.rt.ui.rap.form.fields.imagebox.RwtScoutImageField">
+ </uiClass>
+ </formField>
+ <formField
+ active="true"
+ modelClass="org.eclipse.scout.rt.client.ui.form.fields.wrappedform.IWrappedFormField"
+ name="Wrapped form field"
+ scope="default">
+ <uiClass
+ class="org.eclipse.scout.rt.ui.rap.form.fields.wrappedformfield.RwtScoutWrappedFormField">
+ </uiClass>
+ </formField>
+ <formField
+ active="true"
+ modelClass="org.eclipse.scout.rt.client.ui.form.fields.browserfield.IBrowserField"
+ name="Browser field"
+ scope="default">
+ <uiClass
+ class="org.eclipse.scout.rt.ui.rap.form.fields.browserfield.RwtScoutBrowserField">
+ </uiClass>
+ </formField>
+ <formField
+ active="true"
+ modelClass="org.eclipse.scout.rt.client.ui.form.fields.htmlfield.IHtmlField"
+ name="Html field"
+ scope="default">
+ <uiClass
+ class="org.eclipse.scout.rt.ui.rap.form.fields.htmlfield.RwtScoutHtmlField">
+ </uiClass>
+ </formField>
+ <formField
+ active="true"
+ modelClass="org.eclipse.scout.rt.client.ui.form.fields.stringfield.IStringField"
+ name="String field"
+ scope="default">
+ <uiClass
+ class="org.eclipse.scout.rt.ui.rap.form.fields.stringfield.RwtScoutStringField">
+ </uiClass>
+ </formField>
+ <formField
+ active="true"
+ modelClass="org.eclipse.scout.rt.client.ui.form.fields.button.IButton"
+ name="Button"
+ scope="default">
+ <factory
+ class="org.eclipse.scout.rt.ui.rap.form.fields.button.ButtonFieldFactory">
+ </factory>
+ </formField>
+ <formField
+ active="true"
+ modelClass="org.eclipse.scout.rt.client.ui.form.fields.placeholder.IPlaceholderField"
+ name="Placeholder"
+ scope="default">
+ <uiClass
+ class="org.eclipse.scout.rt.ui.rap.form.fields.placeholder.RwtScoutPlaceholderField">
+ </uiClass>
+ </formField>
+ <formField
+ active="true"
+ modelClass="org.eclipse.scout.rt.client.ui.form.fields.composer.IComposerField"
+ name="Composer field">
+ <uiClass
+ class="org.eclipse.scout.rt.ui.rap.form.fields.composer.RwtScoutComposerField">
+ </uiClass>
+ </formField>
+ </extension>
+ <extension
+ point="org.eclipse.scout.rt.ui.rap.lookAndFeel">
+ <decorations
+ scope="default">
+ <mandatory>
+ <labelFont>
+ </labelFont>
+ <starMarker
+ placement="afterLabel">
+ </starMarker>
+ </mandatory>
+ </decorations>
+ <properties
+ scope="default">
+ <property
+ name="logicalGridLayout.defaultColumnWidth"
+ value="360">
+ </property>
+ <property
+ name="logicalGridLayout.defaultPopupWidth"
+ value="230">
+ </property>
+ <property
+ name="logicalGridLayout.verticalGap"
+ value="6">
+ </property>
+ <property
+ name="logicalGridLayout.rowHeight"
+ value="23">
+ </property>
+ <property
+ name="logicalGridLayout.horizontalGap"
+ value="12">
+ </property>
+ <property
+ name="formFieldLabel.width"
+ value="130">
+ </property>
+ <property
+ name="formMainBoxBorder.visible"
+ value="false">
+ </property>
+ <property
+ name="processButton.height"
+ value="23">
+ </property>
+ <property
+ name="processButton.minWidth"
+ value="80">
+ </property>
+ <property
+ name="processButton.maxWidth"
+ value="250">
+ </property>
+ <property
+ name="color.forground.disabled"
+ value="2A5A76">
+ </property>
+ <property
+ name="formFieldLabel.alignment"
+ value="left">
+ </property>
+ <property
+ name="formfield.selectAllOnFocus.enabled"
+ value="true">
+ </property>
+ <property
+ name="dndSupport.enabled"
+ value="true">
+ </property>
+ <property
+ name="table.row.height"
+ value="23">
+ </property>
+ <property
+ name="tree.node.height"
+ value="23">
+ </property>
+ <property
+ name="browserHistory.enabled"
+ value="true">
+ </property>
+ </properties>
+ </extension>
+
+ <extension
+ point="org.eclipse.equinox.http.registry.filters">
+ <filter
+ alias="/"
+ class="org.eclipse.scout.rt.ui.rap.internal.servletfilter.DelegateFilter"
+ httpcontextId="org.eclipse.rap.httpcontext">
+ </filter>
+ </extension>
+
+ <extension point="org.eclipse.scout.http.servletfilter.filters">
+ <filter aliases="/" class="org.eclipse.scout.http.servletfilter.helper.DevelopmentAuthFilter" ranking="1000000">
+ <init-param
+ name="active"
+ value="true">
+ </init-param>
+ </filter>
+ <filter aliases="/" class="org.eclipse.scout.http.servletfilter.helper.HttpAuthJaasFilter" ranking="1000010">
+ <init-param
+ name="active"
+ value="true">
+ </init-param>
+ </filter>
+ <filter
+ aliases="/"
+ class="org.eclipse.scout.rt.ui.rap.internal.servletfilter.LogoutFilter"
+ ranking="-1000000">
+ <init-param
+ name="active"
+ value="true">
+ </init-param>
+ </filter>
+ </extension>
+
+</plugin>
diff --git a/org.eclipse.scout.rt.ui.rap/schema/formfields.exsd b/org.eclipse.scout.rt.ui.rap/schema/formfields.exsd
index 00156801d8..1173d04470 100644
--- a/org.eclipse.scout.rt.ui.rap/schema/formfields.exsd
+++ b/org.eclipse.scout.rt.ui.rap/schema/formfields.exsd
@@ -1,194 +1,194 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.scout.rt.ui.rap" xmlns="http://www.w3.org/2001/XMLSchema">
-<annotation>
- <appinfo>
- <meta.schema plugin="org.eclipse.scout.rt.ui.rap" id="formfields" name="Form Fields"/>
- </appinfo>
- <documentation>
- The extension bean defining a form field extension. A form field extension can have direct link to an
- ui class (Class&lt;? extends ISwtScoutFormField&gt;) or a form field factory (Class&lt;? extends IFormFieldFactory}&gt;).
- A IFormFieldFactory is used to dynamically decide about the UI implementation of a form field.
- Every extension has an attribute called scope. The scope might have one of the following values:
- &lt;ul&gt;
- &lt;li&gt;
- &lt;b&gt;default&lt;/b&gt; to indicate this extension to be the default implementation.
- Is usually used of external component providers (e.g. a PhotoShopField).
- &lt;/li&gt;
- &lt;li&gt;
- &lt;b&gt;global&lt;/b&gt; to indicate this extension to have a global scope (whole eclipse).
- Global defined extensions overwrite the default implementation.
- &lt;/li&gt;
- &lt;li&gt;
- &lt;b&gt;local&lt;/b&gt; to indicate this extension to have local scope.
- Local defined extensions overwrite the global defined implementation. Local extensions should only be declared
- in application specific plugins (e.g. com.bsiag.crm.ui.swt).
- &lt;/li&gt;
- &lt;/ul&gt;
- </documentation>
- </annotation>
-
- <element name="extension">
- <annotation>
- <appinfo>
- <meta.element />
- </appinfo>
- </annotation>
- <complexType>
- <sequence minOccurs="0" maxOccurs="unbounded">
- <element ref="formField"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- <appinfo>
- <meta.attribute translatable="true"/>
- </appinfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="formField">
- <complexType>
- <choice>
- <element ref="factory"/>
- <element ref="uiClass"/>
- </choice>
- <attribute name="name" type="string" use="required">
- <annotation>
- <documentation>
- A human readable name for the component (e.g. Smart field)
- </documentation>
- </annotation>
- </attribute>
- <attribute name="modelClass" type="string" use="required">
- <annotation>
- <documentation>
- The model class linked by this extension (Class&lt;? extends org.eclipse.scout.rt.client.ui.form.fields.IFormField&gt; or a marker interface).
- </documentation>
- <appinfo>
- <meta.attribute kind="java"/>
- </appinfo>
- </annotation>
- </attribute>
- <attribute name="active" type="boolean" use="required">
- <annotation>
- <documentation>
- False to inactivate this extension. Only active extensions will be considered to link a model class to a certain ui class.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="scope">
- <annotation>
- <documentation>
- Specifies the scope for which the extension should be valid. The following values are possible:
-&lt;ul&gt;
- &lt;li&gt;&lt;b&gt;default:&lt;/b&gt; Indicates that this extension is the default implementation. It&apos;s usually used by scout itself or external component providers (e.g. a PhotoShopField).
- &lt;/li&gt;
- &lt;li&gt;
- &lt;b&gt;global:&lt;/b&gt; Indicates that this extension has global scope (whole eclipse). Global extensions override the default implementation.
- &lt;/li&gt;
- &lt;li&gt;&lt;b&gt;local:&lt;/b&gt; Indicates that this extension has local scope. Local extensions override the global implementation. Local extensions should only be declared in application specific plugins (e.g. your.app.ui.rap).
- &lt;/li&gt;
-&lt;/ul&gt;
- </documentation>
- </annotation>
- <simpleType>
- <restriction base="string">
- <enumeration value="default">
- </enumeration>
- <enumeration value="global">
- </enumeration>
- <enumeration value="local">
- </enumeration>
- </restriction>
- </simpleType>
- </attribute>
- </complexType>
- </element>
-
- <element name="uiClass">
- <complexType>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
- The UI class linked by this extension (Class&lt;? extends org.eclipse.scout.rt.ui.rap.form.fields.ISwtScoutFormField&gt;).
- </documentation>
- <appinfo>
- <meta.attribute kind="java" basedOn=":org.eclipse.scout.rt.ui.rap.form.fields.ISwtScoutFormField"/>
- </appinfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="factory">
- <complexType>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
- The factory class linked by this extension (Class&lt;? extends org.eclipse.scout.rt.ui.rap.extension.IFormFieldFactory&gt;).
- </documentation>
- <appinfo>
- <meta.attribute kind="java" basedOn=":org.eclipse.scout.rt.ui.rap.extension.IFormFieldFactory"/>
- </appinfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appinfo>
- <meta.section type="since"/>
- </appinfo>
- <documentation>
- [Enter the first release in which this extension point appears.]
- </documentation>
- </annotation>
-
- <annotation>
- <appinfo>
- <meta.section type="examples"/>
- </appinfo>
- <documentation>
- [Enter extension point usage example here.]
- </documentation>
- </annotation>
-
- <annotation>
- <appinfo>
- <meta.section type="apiinfo"/>
- </appinfo>
- <documentation>
- [Enter API information here.]
- </documentation>
- </annotation>
-
- <annotation>
- <appinfo>
- <meta.section type="implementation"/>
- </appinfo>
- <documentation>
- [Enter information about supplied implementation of this extension point.]
- </documentation>
- </annotation>
-
-
-</schema>
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.scout.rt.ui.rap" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.scout.rt.ui.rap" id="formfields" name="Form Fields"/>
+ </appinfo>
+ <documentation>
+ The extension bean defining a form field extension. A form field extension can have direct link to an
+ ui class (Class&lt;? extends ISwtScoutFormField&gt;) or a form field factory (Class&lt;? extends IFormFieldFactory}&gt;).
+ A IFormFieldFactory is used to dynamically decide about the UI implementation of a form field.
+ Every extension has an attribute called scope. The scope might have one of the following values:
+ &lt;ul&gt;
+ &lt;li&gt;
+ &lt;b&gt;default&lt;/b&gt; to indicate this extension to be the default implementation.
+ Is usually used of external component providers (e.g. a PhotoShopField).
+ &lt;/li&gt;
+ &lt;li&gt;
+ &lt;b&gt;global&lt;/b&gt; to indicate this extension to have a global scope (whole eclipse).
+ Global defined extensions overwrite the default implementation.
+ &lt;/li&gt;
+ &lt;li&gt;
+ &lt;b&gt;local&lt;/b&gt; to indicate this extension to have local scope.
+ Local defined extensions overwrite the global defined implementation. Local extensions should only be declared
+ in application specific plugins (e.g. com.bsiag.crm.ui.swt).
+ &lt;/li&gt;
+ &lt;/ul&gt;
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence minOccurs="0" maxOccurs="unbounded">
+ <element ref="formField"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="formField">
+ <complexType>
+ <choice>
+ <element ref="factory"/>
+ <element ref="uiClass"/>
+ </choice>
+ <attribute name="name" type="string" use="required">
+ <annotation>
+ <documentation>
+ A human readable name for the component (e.g. Smart field)
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="modelClass" type="string" use="required">
+ <annotation>
+ <documentation>
+ The model class linked by this extension (Class&lt;? extends org.eclipse.scout.rt.client.ui.form.fields.IFormField&gt; or a marker interface).
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="active" type="boolean" use="required">
+ <annotation>
+ <documentation>
+ False to inactivate this extension. Only active extensions will be considered to link a model class to a certain ui class.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="scope">
+ <annotation>
+ <documentation>
+ Specifies the scope for which the extension should be valid. The following values are possible:
+&lt;ul&gt;
+ &lt;li&gt;&lt;b&gt;default:&lt;/b&gt; Indicates that this extension is the default implementation. It&apos;s usually used by scout itself or external component providers (e.g. a PhotoShopField).
+ &lt;/li&gt;
+ &lt;li&gt;
+ &lt;b&gt;global:&lt;/b&gt; Indicates that this extension has global scope (whole eclipse). Global extensions override the default implementation.
+ &lt;/li&gt;
+ &lt;li&gt;&lt;b&gt;local:&lt;/b&gt; Indicates that this extension has local scope. Local extensions override the global implementation. Local extensions should only be declared in application specific plugins (e.g. your.app.ui.rap).
+ &lt;/li&gt;
+&lt;/ul&gt;
+ </documentation>
+ </annotation>
+ <simpleType>
+ <restriction base="string">
+ <enumeration value="default">
+ </enumeration>
+ <enumeration value="global">
+ </enumeration>
+ <enumeration value="local">
+ </enumeration>
+ </restriction>
+ </simpleType>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="uiClass">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ The UI class linked by this extension (Class&lt;? extends org.eclipse.scout.rt.ui.rap.form.fields.ISwtScoutFormField&gt;).
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.scout.rt.ui.rap.form.fields.ISwtScoutFormField"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="factory">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ The factory class linked by this extension (Class&lt;? extends org.eclipse.scout.rt.ui.rap.extension.IFormFieldFactory&gt;).
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.scout.rt.ui.rap.extension.IFormFieldFactory"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/org.eclipse.scout.rt.ui.rap/schema/lookAndFeel.exsd b/org.eclipse.scout.rt.ui.rap/schema/lookAndFeel.exsd
index 973bf403d1..fc45ded1a6 100644
--- a/org.eclipse.scout.rt.ui.rap/schema/lookAndFeel.exsd
+++ b/org.eclipse.scout.rt.ui.rap/schema/lookAndFeel.exsd
@@ -1,326 +1,326 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.scout.rt.ui.rap" xmlns="http://www.w3.org/2001/XMLSchema">
-<annotation>
- <appinfo>
- <meta.schema plugin="org.eclipse.scout.rt.ui.rap" id="lookAndFeel" name="Look and feel"/>
- </appinfo>
- <documentation>
- [Enter description of this extension point.]
- </documentation>
- </annotation>
-
- <element name="extension">
- <annotation>
- <appinfo>
- <meta.element />
- </appinfo>
- </annotation>
- <complexType>
- <sequence minOccurs="0" maxOccurs="1">
- <element ref="decorations" minOccurs="0" maxOccurs="unbounded"/>
- <element ref="properties" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- <appinfo>
- <meta.attribute translatable="true"/>
- </appinfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="properties">
- <complexType>
- <sequence minOccurs="1" maxOccurs="unbounded">
- <element ref="property"/>
- </sequence>
- <attribute name="scope" use="required">
- <annotation>
- <documentation>
- Specifies the scope for which the properties should be valid. The following values are possible:
-&lt;ul&gt;
- &lt;li&gt;
- &lt;b&gt;default:&lt;/b&gt; Indicates that the properties are used as default. This scope is typcially used by scout and should not be set by the application.
- &lt;/li&gt;
- &lt;li&gt;
- &lt;b&gt;global:&lt;/b&gt; Indicates that the properties have a global scope. Properties with global scope override default properties.
- &lt;/li&gt;
-&lt;/ul&gt;
- </documentation>
- </annotation>
- <simpleType>
- <restriction base="string">
- <enumeration value="global">
- </enumeration>
- <enumeration value="default">
- </enumeration>
- </restriction>
- </simpleType>
- </attribute>
- <attribute name="deviceType" type="string">
- <annotation>
- <documentation>
- Specifies for which device types the properties should be valid.&lt;p&gt;
-
-The value can be either &lt;b&gt;desktop, tablet, mobile&lt;/b&gt; or basically any value which matches IUiDeviceType#getIdentifier(). It&apos;s also possible to use &lt;b&gt;touch&lt;/b&gt; as value which covers every device type which returns true for IUiDeviceType#isTouchDevice().&lt;p&gt;
-
-If no value is specified the properties are valid for all device types.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="property">
- <complexType>
- <attribute name="name" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- <simpleType>
- <restriction base="string">
- <enumeration value="browserHistory.enabled">
- </enumeration>
- <enumeration value="color.forground.disabled">
- </enumeration>
- <enumeration value="dialog.minWidth">
- </enumeration>
- <enumeration value="dialog.minHeight">
- </enumeration>
- <enumeration value="dndSupport.enabled">
- </enumeration>
- <enumeration value="formfield.selectAllOnFocus.enabled">
- </enumeration>
- <enumeration value="formFieldLabel.width">
- </enumeration>
- <enumeration value="formFieldLabel.alignment">
- </enumeration>
- <enumeration value="formMainBoxBorder.visible">
- </enumeration>
- <enumeration value="messageBox.minWidth">
- </enumeration>
- <enumeration value="messageBox.minHeight">
- </enumeration>
- <enumeration value="logicalGridLayout.defaultColumnWidth">
- </enumeration>
- <enumeration value="logicalGridLayout.defaultPopupWidth">
- </enumeration>
- <enumeration value="logicalGridLayout.rowHeight">
- </enumeration>
- <enumeration value="logicalGridLayout.horizontalGap">
- </enumeration>
- <enumeration value="logicalGridLayout.verticalGap">
- </enumeration>
- <enumeration value="processButton.height">
- </enumeration>
- <enumeration value="processButton.minWidth">
- </enumeration>
- <enumeration value="processButton.maxWidth">
- </enumeration>
- <enumeration value="table.row.height">
- </enumeration>
- <enumeration value="tree.node.height">
- </enumeration>
- </restriction>
- </simpleType>
- </attribute>
- <attribute name="value" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="decorations">
- <complexType>
- <sequence minOccurs="0" maxOccurs="1">
- <element ref="mandatory" minOccurs="0" maxOccurs="1"/>
- </sequence>
- <attribute name="scope" use="required">
- <annotation>
- <documentation>
- Specifies the scope for which the decorations should be valid. The following values are possible:
-&lt;ul&gt;
- &lt;li&gt;
- &lt;b&gt;default:&lt;/b&gt; Indicates that the decorations are used as default. This scope is typcially used by scout and should not be set by the application.
- &lt;/li&gt;
- &lt;li&gt;
- &lt;b&gt;global:&lt;/b&gt; Indicates that the decorations have a global scope. Decorations with global scope override default decorations.
- &lt;/li&gt;
-&lt;/ul&gt;
- </documentation>
- </annotation>
- <simpleType>
- <restriction base="string">
- <enumeration value="global">
- </enumeration>
- <enumeration value="default">
- </enumeration>
- </restriction>
- </simpleType>
- </attribute>
- <attribute name="deviceType" type="string">
- <annotation>
- <documentation>
- Specifies for which device types the decorations should be valid.&lt;p&gt;
-
-The value can be either desktop, tablet, mobile or basically any value which matches IUiDeviceType#getIdentifier(). It&apos;s also possible to use touch as value which covers every device type which returns true for IUiDeviceType#isTouchDevice().&lt;p&gt;
-
-If no value is specified the decorations are valid for all device types.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="mandatory">
- <complexType>
- <sequence minOccurs="0" maxOccurs="1">
- <element ref="fieldBackground" minOccurs="0" maxOccurs="1"/>
- <element ref="labelFont" minOccurs="0" maxOccurs="1"/>
- <element ref="labelTextColor"/>
- <element ref="starMarker" minOccurs="0" maxOccurs="1"/>
- </sequence>
- </complexType>
- </element>
-
- <element name="fieldBackground">
- <complexType>
- <attribute name="color" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="labelTextColor">
- <complexType>
- <attribute name="color" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="labelFont">
- <complexType>
- <attribute name="font" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="starMarker">
- <complexType>
- <attribute name="placement" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- <simpleType>
- <restriction base="string">
- <enumeration value="beforeLabel">
- </enumeration>
- <enumeration value="afterLabel">
- </enumeration>
- </restriction>
- </simpleType>
- </attribute>
- </complexType>
- </element>
-
- <element name="uiDeviceType">
- <complexType>
- <attribute name="enum" type="string" use="default" value="org.eclipse.scout.rt.shared.ui.UiDeviceType">
- <annotation>
- <documentation>
-
- </documentation>
- <appinfo>
- <meta.attribute kind="java" basedOn=":org.eclipse.scout.rt.shared.ui.IUiDeviceType"/>
- </appinfo>
- </annotation>
- </attribute>
- <attribute name="enumValue" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appinfo>
- <meta.section type="since"/>
- </appinfo>
- <documentation>
- [Enter the first release in which this extension point appears.]
- </documentation>
- </annotation>
-
- <annotation>
- <appinfo>
- <meta.section type="examples"/>
- </appinfo>
- <documentation>
- [Enter extension point usage example here.]
- </documentation>
- </annotation>
-
- <annotation>
- <appinfo>
- <meta.section type="apiinfo"/>
- </appinfo>
- <documentation>
- [Enter API information here.]
- </documentation>
- </annotation>
-
- <annotation>
- <appinfo>
- <meta.section type="implementation"/>
- </appinfo>
- <documentation>
- [Enter information about supplied implementation of this extension point.]
- </documentation>
- </annotation>
-
-
-</schema>
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.scout.rt.ui.rap" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.scout.rt.ui.rap" id="lookAndFeel" name="Look and feel"/>
+ </appinfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence minOccurs="0" maxOccurs="1">
+ <element ref="decorations" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="properties" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="properties">
+ <complexType>
+ <sequence minOccurs="1" maxOccurs="unbounded">
+ <element ref="property"/>
+ </sequence>
+ <attribute name="scope" use="required">
+ <annotation>
+ <documentation>
+ Specifies the scope for which the properties should be valid. The following values are possible:
+&lt;ul&gt;
+ &lt;li&gt;
+ &lt;b&gt;default:&lt;/b&gt; Indicates that the properties are used as default. This scope is typcially used by scout and should not be set by the application.
+ &lt;/li&gt;
+ &lt;li&gt;
+ &lt;b&gt;global:&lt;/b&gt; Indicates that the properties have a global scope. Properties with global scope override default properties.
+ &lt;/li&gt;
+&lt;/ul&gt;
+ </documentation>
+ </annotation>
+ <simpleType>
+ <restriction base="string">
+ <enumeration value="global">
+ </enumeration>
+ <enumeration value="default">
+ </enumeration>
+ </restriction>
+ </simpleType>
+ </attribute>
+ <attribute name="deviceType" type="string">
+ <annotation>
+ <documentation>
+ Specifies for which device types the properties should be valid.&lt;p&gt;
+
+The value can be either &lt;b&gt;desktop, tablet, mobile&lt;/b&gt; or basically any value which matches IUiDeviceType#getIdentifier(). It&apos;s also possible to use &lt;b&gt;touch&lt;/b&gt; as value which covers every device type which returns true for IUiDeviceType#isTouchDevice().&lt;p&gt;
+
+If no value is specified the properties are valid for all device types.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="property">
+ <complexType>
+ <attribute name="name" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ <simpleType>
+ <restriction base="string">
+ <enumeration value="browserHistory.enabled">
+ </enumeration>
+ <enumeration value="color.forground.disabled">
+ </enumeration>
+ <enumeration value="dialog.minWidth">
+ </enumeration>
+ <enumeration value="dialog.minHeight">
+ </enumeration>
+ <enumeration value="dndSupport.enabled">
+ </enumeration>
+ <enumeration value="formfield.selectAllOnFocus.enabled">
+ </enumeration>
+ <enumeration value="formFieldLabel.width">
+ </enumeration>
+ <enumeration value="formFieldLabel.alignment">
+ </enumeration>
+ <enumeration value="formMainBoxBorder.visible">
+ </enumeration>
+ <enumeration value="messageBox.minWidth">
+ </enumeration>
+ <enumeration value="messageBox.minHeight">
+ </enumeration>
+ <enumeration value="logicalGridLayout.defaultColumnWidth">
+ </enumeration>
+ <enumeration value="logicalGridLayout.defaultPopupWidth">
+ </enumeration>
+ <enumeration value="logicalGridLayout.rowHeight">
+ </enumeration>
+ <enumeration value="logicalGridLayout.horizontalGap">
+ </enumeration>
+ <enumeration value="logicalGridLayout.verticalGap">
+ </enumeration>
+ <enumeration value="processButton.height">
+ </enumeration>
+ <enumeration value="processButton.minWidth">
+ </enumeration>
+ <enumeration value="processButton.maxWidth">
+ </enumeration>
+ <enumeration value="table.row.height">
+ </enumeration>
+ <enumeration value="tree.node.height">
+ </enumeration>
+ </restriction>
+ </simpleType>
+ </attribute>
+ <attribute name="value" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="decorations">
+ <complexType>
+ <sequence minOccurs="0" maxOccurs="1">
+ <element ref="mandatory" minOccurs="0" maxOccurs="1"/>
+ </sequence>
+ <attribute name="scope" use="required">
+ <annotation>
+ <documentation>
+ Specifies the scope for which the decorations should be valid. The following values are possible:
+&lt;ul&gt;
+ &lt;li&gt;
+ &lt;b&gt;default:&lt;/b&gt; Indicates that the decorations are used as default. This scope is typcially used by scout and should not be set by the application.
+ &lt;/li&gt;
+ &lt;li&gt;
+ &lt;b&gt;global:&lt;/b&gt; Indicates that the decorations have a global scope. Decorations with global scope override default decorations.
+ &lt;/li&gt;
+&lt;/ul&gt;
+ </documentation>
+ </annotation>
+ <simpleType>
+ <restriction base="string">
+ <enumeration value="global">
+ </enumeration>
+ <enumeration value="default">
+ </enumeration>
+ </restriction>
+ </simpleType>
+ </attribute>
+ <attribute name="deviceType" type="string">
+ <annotation>
+ <documentation>
+ Specifies for which device types the decorations should be valid.&lt;p&gt;
+
+The value can be either desktop, tablet, mobile or basically any value which matches IUiDeviceType#getIdentifier(). It&apos;s also possible to use touch as value which covers every device type which returns true for IUiDeviceType#isTouchDevice().&lt;p&gt;
+
+If no value is specified the decorations are valid for all device types.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="mandatory">
+ <complexType>
+ <sequence minOccurs="0" maxOccurs="1">
+ <element ref="fieldBackground" minOccurs="0" maxOccurs="1"/>
+ <element ref="labelFont" minOccurs="0" maxOccurs="1"/>
+ <element ref="labelTextColor"/>
+ <element ref="starMarker" minOccurs="0" maxOccurs="1"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="fieldBackground">
+ <complexType>
+ <attribute name="color" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="labelTextColor">
+ <complexType>
+ <attribute name="color" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="labelFont">
+ <complexType>
+ <attribute name="font" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="starMarker">
+ <complexType>
+ <attribute name="placement" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ <simpleType>
+ <restriction base="string">
+ <enumeration value="beforeLabel">
+ </enumeration>
+ <enumeration value="afterLabel">
+ </enumeration>
+ </restriction>
+ </simpleType>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="uiDeviceType">
+ <complexType>
+ <attribute name="enum" type="string" use="default" value="org.eclipse.scout.rt.shared.ui.UiDeviceType">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.scout.rt.shared.ui.IUiDeviceType"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="enumValue" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/org.eclipse.scout.rt.ui.rap/schema/scouticons.exsd b/org.eclipse.scout.rt.ui.rap/schema/scouticons.exsd
index c4b7c6ce0d..fa94757fbc 100644
--- a/org.eclipse.scout.rt.ui.rap/schema/scouticons.exsd
+++ b/org.eclipse.scout.rt.ui.rap/schema/scouticons.exsd
@@ -1,212 +1,212 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.scout.rt.ui.rap" xmlns="http://www.w3.org/2001/XMLSchema">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.scout.rt.ui.rap" id="scouticons" name="Scout Icons"/>
- </appInfo>
- <documentation>
- This extension point allows to contribute icons to overwrite Scout default icons.
- </documentation>
- </annotation>
-
- <element name="extension">
- <annotation>
- <appInfo>
- <meta.element />
- </appInfo>
- </annotation>
- <complexType>
- <sequence>
- <element ref="dropdownfield_arrowdown" minOccurs="0" maxOccurs="unbounded"/>
- <element ref="status_error" minOccurs="0" maxOccurs="1"/>
- <element ref="status_info" minOccurs="0" maxOccurs="1"/>
- <element ref="status_warning" minOccurs="0" maxOccurs="1"/>
- <element ref="checkbox_yes" minOccurs="0" maxOccurs="1"/>
- <element ref="checkbox_no" minOccurs="0" maxOccurs="1"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- <appInfo>
- <meta.attribute translatable="true"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="dropdownfield_arrowdown">
- <annotation>
- <documentation>
- Icon that represents arrow in drop down button
- </documentation>
- </annotation>
- <complexType>
- <attribute name="icon" type="string" use="required">
- <annotation>
- <documentation>
- Project relative path to the icon resource
- </documentation>
- <appInfo>
- <meta.attribute kind="resource"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="status_info">
- <annotation>
- <documentation>
- Icon to represent an information
- </documentation>
- </annotation>
- <complexType>
- <attribute name="icon" type="string" use="required">
- <annotation>
- <documentation>
- Project relative path to the icon resource
- </documentation>
- <appInfo>
- <meta.attribute kind="resource"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="status_warning">
- <annotation>
- <documentation>
- Icon to represent a warning
- </documentation>
- </annotation>
- <complexType>
- <attribute name="icon" type="string" use="required">
- <annotation>
- <documentation>
- Project relative path to the icon resource
- </documentation>
- <appInfo>
- <meta.attribute kind="resource"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="status_error">
- <annotation>
- <documentation>
- Icon to represent an error
- </documentation>
- </annotation>
- <complexType>
- <attribute name="icon" type="string" use="required">
- <annotation>
- <documentation>
- Project relative path to the icon resource
- </documentation>
- <appInfo>
- <meta.attribute kind="resource"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="checkbox_yes">
- <annotation>
- <documentation>
- Icon to represent &apos;checked state true&apos; in a checkable table cell
- </documentation>
- </annotation>
- <complexType>
- <attribute name="icon" type="string" use="required">
- <annotation>
- <documentation>
- Project relative path to the icon resource
- </documentation>
- <appInfo>
- <meta.attribute kind="resource"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="checkbox_no">
- <annotation>
- <documentation>
- Icon to represent &apos;checked state false&apos; in a checkable table cell
- </documentation>
- </annotation>
- <complexType>
- <attribute name="icon" type="string" use="required">
- <annotation>
- <documentation>
- Project relative path to the icon resource
- </documentation>
- <appInfo>
- <meta.attribute kind="resource"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
- [Enter the first release in which this extension point appears.]
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- [Enter extension point usage example here.]
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiinfo"/>
- </appInfo>
- <documentation>
- [Enter API information here.]
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
- [Enter information about supplied implementation of this extension point.]
- </documentation>
- </annotation>
-
-
-</schema>
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.scout.rt.ui.rap" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.scout.rt.ui.rap" id="scouticons" name="Scout Icons"/>
+ </appInfo>
+ <documentation>
+ This extension point allows to contribute icons to overwrite Scout default icons.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="dropdownfield_arrowdown" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="status_error" minOccurs="0" maxOccurs="1"/>
+ <element ref="status_info" minOccurs="0" maxOccurs="1"/>
+ <element ref="status_warning" minOccurs="0" maxOccurs="1"/>
+ <element ref="checkbox_yes" minOccurs="0" maxOccurs="1"/>
+ <element ref="checkbox_no" minOccurs="0" maxOccurs="1"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="dropdownfield_arrowdown">
+ <annotation>
+ <documentation>
+ Icon that represents arrow in drop down button
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="icon" type="string" use="required">
+ <annotation>
+ <documentation>
+ Project relative path to the icon resource
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="resource"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="status_info">
+ <annotation>
+ <documentation>
+ Icon to represent an information
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="icon" type="string" use="required">
+ <annotation>
+ <documentation>
+ Project relative path to the icon resource
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="resource"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="status_warning">
+ <annotation>
+ <documentation>
+ Icon to represent a warning
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="icon" type="string" use="required">
+ <annotation>
+ <documentation>
+ Project relative path to the icon resource
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="resource"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="status_error">
+ <annotation>
+ <documentation>
+ Icon to represent an error
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="icon" type="string" use="required">
+ <annotation>
+ <documentation>
+ Project relative path to the icon resource
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="resource"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="checkbox_yes">
+ <annotation>
+ <documentation>
+ Icon to represent &apos;checked state true&apos; in a checkable table cell
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="icon" type="string" use="required">
+ <annotation>
+ <documentation>
+ Project relative path to the icon resource
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="resource"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="checkbox_no">
+ <annotation>
+ <documentation>
+ Icon to represent &apos;checked state false&apos; in a checkable table cell
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="icon" type="string" use="required">
+ <annotation>
+ <documentation>
+ Project relative path to the icon resource
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="resource"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiinfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/AbstractRwtEnvironment.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/AbstractRwtEnvironment.java
index e5e60920cc..5d5366c47b 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/AbstractRwtEnvironment.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/AbstractRwtEnvironment.java
@@ -1,1347 +1,1347 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Locale;
-import java.util.UUID;
-
-import javax.security.auth.Subject;
-import javax.servlet.http.HttpServletResponse;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.rwt.RWT;
-import org.eclipse.rwt.internal.widgets.JSExecutor;
-import org.eclipse.rwt.lifecycle.UICallBack;
-import org.eclipse.rwt.service.ISessionStore;
-import org.eclipse.rwt.service.SessionStoreEvent;
-import org.eclipse.rwt.service.SessionStoreListener;
-import org.eclipse.scout.commons.EventListenerList;
-import org.eclipse.scout.commons.HTMLUtility.DefaultFont;
-import org.eclipse.scout.commons.ListUtility;
-import org.eclipse.scout.commons.LocaleThreadLocal;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.exception.IProcessingStatus;
-import org.eclipse.scout.commons.holders.BooleanHolder;
-import org.eclipse.scout.commons.job.JobEx;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ClientAsyncJob;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.client.ILocaleListener;
-import org.eclipse.scout.rt.client.LocaleChangeEvent;
-import org.eclipse.scout.rt.client.busy.IBusyHandler;
-import org.eclipse.scout.rt.client.busy.IBusyManagerService;
-import org.eclipse.scout.rt.client.services.common.exceptionhandler.ErrorHandler;
-import org.eclipse.scout.rt.client.services.common.session.IClientSessionRegistryService;
-import org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke;
-import org.eclipse.scout.rt.client.ui.basic.filechooser.IFileChooser;
-import org.eclipse.scout.rt.client.ui.desktop.DesktopEvent;
-import org.eclipse.scout.rt.client.ui.desktop.DesktopListener;
-import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.messagebox.IMessageBox;
-import org.eclipse.scout.rt.shared.data.basic.FontSpec;
-import org.eclipse.scout.rt.shared.ui.UiDeviceType;
-import org.eclipse.scout.rt.shared.ui.UiLayer;
-import org.eclipse.scout.rt.shared.ui.UserAgent;
-import org.eclipse.scout.rt.ui.rap.basic.IRwtScoutComposite;
-import org.eclipse.scout.rt.ui.rap.basic.WidgetPrinter;
-import org.eclipse.scout.rt.ui.rap.busy.RwtBusyHandler;
-import org.eclipse.scout.rt.ui.rap.concurrency.RwtScoutSynchronizer;
-import org.eclipse.scout.rt.ui.rap.extension.UiDecorationExtensionPoint;
-import org.eclipse.scout.rt.ui.rap.form.IRwtScoutForm;
-import org.eclipse.scout.rt.ui.rap.form.RwtScoutForm;
-import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
-import org.eclipse.scout.rt.ui.rap.html.HtmlAdapter;
-import org.eclipse.scout.rt.ui.rap.internal.servletfilter.LogoutFilter;
-import org.eclipse.scout.rt.ui.rap.keystroke.IRwtKeyStroke;
-import org.eclipse.scout.rt.ui.rap.keystroke.KeyStrokeManager;
-import org.eclipse.scout.rt.ui.rap.util.ColorFactory;
-import org.eclipse.scout.rt.ui.rap.util.DeviceUtility;
-import org.eclipse.scout.rt.ui.rap.util.FontRegistry;
-import org.eclipse.scout.rt.ui.rap.util.RwtIconLocator;
-import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
-import org.eclipse.scout.rt.ui.rap.util.ScoutFormToolkit;
-import org.eclipse.scout.rt.ui.rap.window.BrowserWindowHandler;
-import org.eclipse.scout.rt.ui.rap.window.IRwtScoutPart;
-import org.eclipse.scout.rt.ui.rap.window.RwtScoutPartEvent;
-import org.eclipse.scout.rt.ui.rap.window.RwtScoutPartListener;
-import org.eclipse.scout.rt.ui.rap.window.desktop.IRwtScoutFormFooter;
-import org.eclipse.scout.rt.ui.rap.window.desktop.IRwtScoutFormHeader;
-import org.eclipse.scout.rt.ui.rap.window.desktop.navigation.RwtScoutNavigationSupport;
-import org.eclipse.scout.rt.ui.rap.window.dialog.RwtScoutDialog;
-import org.eclipse.scout.rt.ui.rap.window.filechooser.IRwtScoutFileChooser;
-import org.eclipse.scout.rt.ui.rap.window.filechooser.IRwtScoutFileChooserService;
-import org.eclipse.scout.rt.ui.rap.window.messagebox.RwtScoutMessageBoxDialog;
-import org.eclipse.scout.rt.ui.rap.window.popup.RwtScoutPopup;
-import org.eclipse.scout.service.SERVICES;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ShellAdapter;
-import org.eclipse.swt.events.ShellEvent;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.MessageBox;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.ToolTip;
-import org.eclipse.swt.widgets.TrayItem;
-import org.eclipse.ui.forms.widgets.Form;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.Version;
-
-@SuppressWarnings("restriction")
-public abstract class AbstractRwtEnvironment implements IRwtEnvironment {
- private static IScoutLogger LOG = ScoutLogManager.getLogger(AbstractRwtEnvironment.class);
-
- private Subject m_subject;
-
- private int m_status;
-
- private Bundle m_applicationBundle;
- private RwtScoutSynchronizer m_synchronizer;
- private SessionStoreListener m_sessionStoreListener;
- private ILocaleListener m_localeListener;
-
- private final Object m_immediateUiJobsLock = new Object();
- private final List<Runnable> m_immediateUiJobs = new ArrayList<Runnable>();
-
- private ColorFactory m_colorFactory;
- private FontRegistry m_fontRegistry;
- private RwtIconLocator m_iconLocator;
-
- private List<IRwtKeyStroke> m_desktopKeyStrokes;
- private KeyStrokeManager m_keyStrokeManager;
-
- private Control m_popupOwner;
- private Rectangle m_popupOwnerBounds;
-
- private ScoutFormToolkit m_formToolkit;
- private FormFieldFactory m_formFieldFactory;
-
- private boolean m_startDesktopCalled;
- private boolean m_activateDesktopCalled;
-
- private EventListenerList m_environmentListeners;
-
- private HashMap<IForm, IRwtScoutPart> m_openForms;
- private P_ScoutDesktopListener m_scoutDesktopListener;
- private P_ScoutDesktopPropertyListener m_desktopPropertyListener;
-
- private final Class<? extends IClientSession> m_clientSessionClazz;
- private IClientSession m_clientSession;
- private IDesktop m_desktop;
-
- private RwtScoutNavigationSupport m_historySupport;
- private LayoutValidateManager m_layoutValidateManager;
- private HtmlAdapter m_htmlAdapter;
- private IBusyHandler m_busyHandler;
-
- public AbstractRwtEnvironment(Bundle applicationBundle, Class<? extends IClientSession> clientSessionClazz) {
- m_applicationBundle = applicationBundle;
- m_clientSessionClazz = clientSessionClazz;
- m_sessionStoreListener = new P_SessionStoreListener();
- m_environmentListeners = new EventListenerList();
- m_localeListener = new P_LocaleListener();
- m_openForms = new HashMap<IForm, IRwtScoutPart>();
- m_status = RwtEnvironmentEvent.INACTIVE;
- m_desktopKeyStrokes = new ArrayList<IRwtKeyStroke>();
- m_startDesktopCalled = false;
- }
-
- protected void setSubject(Subject subject) {
- m_subject = subject;
- }
-
- public Subject getSubject() {
- return m_subject;
- }
-
- /**
- * @return the applicationBundle
- */
- public Bundle getApplicationBundle() {
- return m_applicationBundle;
- }
-
- protected IRwtScoutPart putPart(IForm form, IRwtScoutPart part) {
- return m_openForms.put(form, part);
- }
-
- protected IRwtScoutPart getPart(IForm form) {
- return m_openForms.get(form);
- }
-
- @Override
- public Collection<IRwtScoutPart> getOpenFormParts() {
- return new ArrayList<IRwtScoutPart>(m_openForms.values());
- }
-
- protected IRwtScoutPart removePart(IForm form) {
- return m_openForms.remove(form);
- }
-
- protected void stopScout() throws CoreException {
- try {
- if (m_historySupport != null) {
- m_historySupport.uninstall();
- m_historySupport = null;
- }
- if (m_desktopKeyStrokes != null) {
- for (IRwtKeyStroke uiKeyStroke : m_desktopKeyStrokes) {
- removeGlobalKeyStroke(uiKeyStroke);
- }
- m_desktopKeyStrokes.clear();
- }
- if (m_iconLocator != null) {
- m_iconLocator.dispose();
- m_iconLocator = null;
- }
- if (m_colorFactory != null) {
- m_colorFactory.dispose();
- m_colorFactory = null;
- }
- m_keyStrokeManager = null;
- if (m_fontRegistry != null) {
- m_fontRegistry.dispose();
- m_fontRegistry = null;
- }
- if (m_formToolkit != null) {
- m_formToolkit.dispose();
- m_formToolkit = null;
- }
- detachScoutListeners();
- if (m_synchronizer != null) {
- m_synchronizer = null;
- }
- if (m_busyHandler != null) {
- m_busyHandler.setEnabled(false);
- m_busyHandler = null;
- }
-
- m_status = RwtEnvironmentEvent.STOPPED;
- fireEnvironmentChanged(new RwtEnvironmentEvent(this, RwtEnvironmentEvent.STOPPED));
- }
- finally {
- if (m_status != RwtEnvironmentEvent.STOPPED) {
- m_status = RwtEnvironmentEvent.STARTED;
- fireEnvironmentChanged(new RwtEnvironmentEvent(this, RwtEnvironmentEvent.STARTED));
- }
- }
- }
-
- /**
- * @deprecated use {@link #getLogoutLocation()} instead.
- */
- @SuppressWarnings("deprecation")
- @Override
- @Deprecated
- public String getLogoutLandingUri() {
- return getLogoutLocation();
- }
-
- /**
- * @see {@link LogoutFilter}
- */
- protected String getLogoutLocation() {
- String path = RWT.getRequest().getServletPath();
-
- if (path.length() > 0 && '/' == path.charAt(0)) {
- path = path.substring(1);
- }
-
- path += "?" + LogoutFilter.LOGOUT_PARAM;
-
- return path;
- }
-
- public void logout() {
- HttpServletResponse response = RWT.getResponse();
- String logoutUri = response.encodeRedirectURL(getLogoutLandingUri());
- String browserText = MessageFormat.format("parent.window.location.href = \"{0}\";", logoutUri);
- JSExecutor.executeJS(browserText);
- }
-
- @Override
- public boolean isInitialized() {
- return m_status == RwtEnvironmentEvent.STARTED;
- }
-
- @Override
- public final void ensureInitialized() {
- if (m_status == RwtEnvironmentEvent.INACTIVE || m_status == RwtEnvironmentEvent.STOPPED) {
- try {
- init();
- }
- catch (Exception e) {
- LOG.error("could not initialize Environment", e);
- }
- }
- }
-
- protected synchronized void init() throws CoreException {
- if (m_status == RwtEnvironmentEvent.STARTING
- || m_status == RwtEnvironmentEvent.STARTED
- || m_status == RwtEnvironmentEvent.STOPPING) {
- return;
- }
- m_status = RwtEnvironmentEvent.INACTIVE;
- // must be called in display thread
- if (Thread.currentThread() != getDisplay().getThread()) {
- throw new IllegalStateException("must be called in display thread");
- }
- // workbench must exist
-// if (PlatformUI.getWorkbench().getActiveWorkbenchWindow() == null) {
-// throw new IllegalStateException("workbench must be active");
-// }
-// // close views that were opened due to workbench caching the latest layout
-// // of views
-// for (IWorkbenchWindow workbenchWindow : PlatformUI.getWorkbench().getWorkbenchWindows()) {
-// for (IWorkbenchPage workbenchPage : workbenchWindow.getPages()) {
-// for (IViewReference viewReference : workbenchPage.getViewReferences()) {
-// if (m_scoutPartIdToUiPartId.containsValue(viewReference.getId())) {
-// if (workbenchPage.isPartVisible(viewReference.getPart(false))) {
-// workbenchPage.hideView(viewReference);
-// }
-// }
-// }
-// }
-// }
- //
- try {
- m_status = RwtEnvironmentEvent.STARTING;
- fireEnvironmentChanged(new RwtEnvironmentEvent(this, m_status));
-
- if (getSubject() == null) {
- throw new SecurityException("/rap request is not authenticated with a Subject");
- }
-
- UserAgent userAgent = initUserAgent();
- DeviceUtility.setCurrentDeviceType(userAgent.getUiDeviceType());
-
- final BooleanHolder newSession = new BooleanHolder(true);
- IClientSession tempClientSession = (IClientSession) RWT.getSessionStore().getAttribute(IClientSession.class.getName());
- if (tempClientSession == null || !tempClientSession.isActive()) {
- LocaleThreadLocal.set(RwtUtility.getBrowserInfo().getLocale());
- tempClientSession = SERVICES.getService(IClientSessionRegistryService.class).newClientSession(m_clientSessionClazz, getSubject(), UUID.randomUUID().toString(), userAgent);
-
- RWT.getSessionStore().setAttribute(IClientSession.class.getName(), tempClientSession);
- RWT.getSessionStore().addSessionStoreListener(m_sessionStoreListener);
-
- // init RWT locale with the locale of the client session
- if (tempClientSession.getLocale() != null && !tempClientSession.getLocale().equals(RWT.getLocale())) {
- RWT.setLocale(tempClientSession.getLocale());
- }
- newSession.setValue(true);
- }
- else {
- newSession.setValue(false);
- }
- if (!tempClientSession.isActive()) {
- showClientSessionLoadError(tempClientSession.getLoadError());
- LOG.error("ClientSession is not active, there must be a problem with loading or starting");
- m_status = RwtEnvironmentEvent.INACTIVE;
- return;
- }
- else {
- m_clientSession = tempClientSession;
- }
- m_desktop = m_clientSession.getDesktop();
- if (m_synchronizer == null) {
- m_synchronizer = new RwtScoutSynchronizer(this);
- }
- //put the the display on the session data
- m_clientSession.setData(ENVIRONMENT_KEY, this);
-
- m_clientSession.addLocaleListener(m_localeListener);
-
- //
- RwtUtility.setNlsTextsOnDisplay(getDisplay(), m_clientSession.getTexts());
- m_iconLocator = createIconLocator();
- m_colorFactory = new ColorFactory(getDisplay());
- m_keyStrokeManager = new KeyStrokeManager(this);
- m_fontRegistry = new FontRegistry(getDisplay());
- if (UiDecorationExtensionPoint.getLookAndFeel().isBrowserHistoryEnabled()) {
- m_historySupport = new RwtScoutNavigationSupport(this);
- m_historySupport.install();
- }
- m_layoutValidateManager = new LayoutValidateManager();
- attachScoutListeners();
- // desktop keystokes
- for (IKeyStroke scoutKeyStroke : getClientSession().getDesktop().getKeyStrokes()) {
- IRwtKeyStroke[] uiStrokes = RwtUtility.getKeyStrokes(scoutKeyStroke, this);
- for (IRwtKeyStroke uiStroke : uiStrokes) {
- m_desktopKeyStrokes.add(uiStroke);
- addGlobalKeyStroke(uiStroke, false);
- }
- }
- // notify ui available
- // notify desktop that it is loaded
- UICallBack.activate(AbstractRwtEnvironment.class.getName() + AbstractRwtEnvironment.this.hashCode());
- new ClientSyncJob("Desktop opened", getClientSession()) {
- @Override
- protected void runVoid(IProgressMonitor monitor) throws Throwable {
- if (newSession.getValue()) {
- fireDesktopOpenedFromUIInternal();
- fireGuiAttachedFromUIInternal();
- }
- else {
- fireGuiAttachedFromUIInternal();
- fireDesktopActivatedFromUIInternal();
- }
- }
- }.schedule();
-
- m_status = RwtEnvironmentEvent.STARTED;
- fireEnvironmentChanged(new RwtEnvironmentEvent(this, m_status));
-
- m_busyHandler = attachBusyHandler();
- }
- finally {
- if (m_status == RwtEnvironmentEvent.STARTING) {
- m_status = RwtEnvironmentEvent.STOPPED;
- fireEnvironmentChanged(new RwtEnvironmentEvent(this, m_status));
- }
- }
- }
-
- protected UserAgent initUserAgent() {
- return UserAgent.create(UiLayer.RAP, UiDeviceType.DESKTOP, RwtUtility.getBrowserInfo().getUserAgent());
- }
-
- protected RwtBusyHandler attachBusyHandler() {
- IBusyManagerService service = SERVICES.getService(IBusyManagerService.class);
- if (service == null) {
- return null;
- }
- RwtBusyHandler handler = createBusyHandler();
- service.register(getClientSession(), handler);
- return handler;
- }
-
- protected RwtBusyHandler createBusyHandler() {
- return new RwtBusyHandler(getClientSession(), this);
- }
-
- protected void showClientSessionLoadError(Throwable error) {
- ErrorHandler handler = new ErrorHandler(error);
- MessageBox mbox = new MessageBox(getParentShellIgnoringPopups(SWT.SYSTEM_MODAL | SWT.APPLICATION_MODAL | SWT.MODELESS), SWT.OK);
- mbox.setText("" + handler.getTitle());
- mbox.setMessage(StringUtility.join("\n\n", handler.getText(), handler.getDetail()));
- mbox.open();
- }
-
- protected void fireDesktopOpenedFromUIInternal() {
- if (getScoutDesktop() != null) {
- getScoutDesktop().getUIFacade().fireDesktopOpenedFromUI();
- }
- }
-
- protected void fireGuiAttachedFromUIInternal() {
- if (getScoutDesktop() != null) {
- getScoutDesktop().getUIFacade().fireGuiAttached();
- }
- }
-
- protected void fireGuiDetachedFromUIInternal() {
- if (getScoutDesktop() != null) {
- getScoutDesktop().getUIFacade().fireGuiDetached();
- }
- }
-
- protected void fireDesktopActivatedFromUIInternal() {
- if (getScoutDesktop() != null) {
- getScoutDesktop().ensureViewStackVisible();
- }
- }
-
- @Override
- public void setClipboardText(String text) {
- //XXX rap m_clipboard.setContents(new Object[]{text}, new Transfer[]{TextTransfer.getInstance()});
- }
-
- @Override
- public final void addEnvironmentListener(IRwtEnvironmentListener listener) {
- m_environmentListeners.add(IRwtEnvironmentListener.class, listener);
- }
-
- @Override
- public final void removeEnvironmentListener(IRwtEnvironmentListener listener) {
- m_environmentListeners.remove(IRwtEnvironmentListener.class, listener);
- }
-
- private void fireEnvironmentChanged(RwtEnvironmentEvent event) {
- for (IRwtEnvironmentListener l : m_environmentListeners.getListeners(IRwtEnvironmentListener.class)) {
- l.environmentChanged(event);
- }
- }
-
- @Override
- public String adaptHtmlCell(IRwtScoutComposite<?> uiComposite, String rawHtml) {
- return getHtmlAdapter().adaptHtmlCell(uiComposite, rawHtml);
- }
-
- @Override
- public String convertLinksWithLocalUrlsInHtmlCell(IRwtScoutComposite<?> uiComposite, String rawHtml) {
- return getHtmlAdapter().convertLinksWithLocalUrlsInHtmlCell(uiComposite, rawHtml);
- }
-
- @Override
- public String styleHtmlText(IRwtScoutFormField<?> uiComposite, String rawHtml) {
- return getHtmlAdapter().styleHtmlText(uiComposite, rawHtml);
- }
-
- /**
- * @deprecated To adjust the behavior override {@link HtmlAdapter} instead. Will be removed in 3.9.0
- */
- @Deprecated
- protected DefaultFont createDefaultFontSettings(IRwtScoutFormField<?> uiComposite) {
- return getHtmlAdapter().createDefaultFontSettings(uiComposite);
- }
-
- protected HtmlAdapter createHtmlAdapter() {
- return new HtmlAdapter(this);
- }
-
- public HtmlAdapter getHtmlAdapter() {
- if (m_htmlAdapter == null) {
- m_htmlAdapter = createHtmlAdapter();
- }
-
- return m_htmlAdapter;
- }
-
- // icon handling
- @Override
- public Image getIcon(String name) {
- return m_iconLocator.getIcon(name);
- }
-
- @Override
- public ImageDescriptor getImageDescriptor(String iconId) {
- return m_iconLocator.getImageDescriptor(iconId);
- }
-
- // color handling
- @Override
- public Color getColor(String scoutColor) {
- return m_colorFactory.getColor(scoutColor);
- }
-
- @Override
- public Color getColor(RGB rgb) {
- return m_colorFactory.getColor(rgb);
- }
-
- //keyStroke handling
- private static Collection<Integer> fKeyList = Arrays.asList(new Integer[]{SWT.F1, SWT.F2, SWT.F3, SWT.F4, SWT.F5, SWT.F6, SWT.F7, SWT.F8, SWT.F9, SWT.F10, SWT.F11, SWT.F12});
-
- @Override
- public void addGlobalKeyStroke(IRwtKeyStroke stroke, boolean exclusive) {
- boolean internalExclusive = exclusive;
- //If F1-F12 is set we wan't to have this exclusive to the application, else the browser will reload the page
- if (ListUtility.containsAny(fKeyList, stroke.getKeyCode())) {
- internalExclusive = true;
- }
- m_keyStrokeManager.addGlobalKeyStroke(stroke, internalExclusive);
- }
-
- @Override
- public boolean removeGlobalKeyStroke(IRwtKeyStroke stroke) {
- return m_keyStrokeManager.removeGlobalKeyStroke(stroke);
- }
-
- @Override
- public void addKeyStroke(Control control, IRwtKeyStroke stoke, boolean exclusive) {
- m_keyStrokeManager.addKeyStroke(control, stoke, exclusive);
- }
-
- @Override
- public boolean removeKeyStroke(Control control, IRwtKeyStroke stoke) {
- if (m_keyStrokeManager == null) {
- return false;
- }
- return m_keyStrokeManager.removeKeyStroke(control, stoke);
- }
-
- @Override
- public boolean removeKeyStrokes(Control control) {
- if (m_keyStrokeManager == null) {
- return false;
- }
- return m_keyStrokeManager.removeKeyStrokes(control);
- }
-
- /**
- * @return the keyStrokeManager
- */
- protected KeyStrokeManager getKeyStrokeManager() {
- return m_keyStrokeManager;
- }
-
- // font handling
- @Override
- public Font getFont(FontSpec scoutFont, Font templateFont) {
- return m_fontRegistry.getFont(scoutFont, templateFont);
- }
-
- @Override
- public Font getFont(Font templateFont, String newName, Integer newStyle, Integer newSize) {
- return m_fontRegistry.getFont(templateFont, newName, newStyle, newSize);
- }
-
- // form toolkit handling
- @Override
- public ScoutFormToolkit getFormToolkit() {
- if (m_formToolkit == null) {
- m_formToolkit = createScoutFormToolkit(getDisplay());
- }
- return m_formToolkit;
- }
-
- // desktop handling
- @Override
- public final IDesktop getScoutDesktop() {
- return m_desktop;
- }
-
- protected void attachScoutListeners() {
- if (m_scoutDesktopListener == null) {
- m_scoutDesktopListener = new P_ScoutDesktopListener();
- getScoutDesktop().addDesktopListener(m_scoutDesktopListener);
- }
- if (m_desktopPropertyListener == null) {
- m_desktopPropertyListener = new P_ScoutDesktopPropertyListener();
- getScoutDesktop().addPropertyChangeListener(m_desktopPropertyListener);
- }
- }
-
- protected void detachScoutListeners() {
- IDesktop desktop = getScoutDesktop();
- if (desktop == null) {
- LOG.warn("Desktop is null, cannot remove listeners.");
- return;
- }
-
- if (m_scoutDesktopListener != null) {
- desktop.removeDesktopListener(m_scoutDesktopListener);
- m_scoutDesktopListener = null;
- }
- if (m_desktopPropertyListener != null) {
- desktop.removePropertyChangeListener(m_desktopPropertyListener);
- m_desktopPropertyListener = null;
- }
- }
-
- protected void applyScoutState() {
- IDesktop desktop = getScoutDesktop();
- // load state of internal frames and dialogs
- for (IForm form : desktop.getViewStack()) {
- if (form.isAutoAddRemoveOnDesktop()) {
- showFormPart(form);
- }
- }
- // dialogs
- IForm[] dialogs = desktop.getDialogStack();
- for (IForm dialog : dialogs) {
- // showDialogFromScout(dialogs[i]);
- showFormPart(dialog);
- }
- IMessageBox[] messageBoxes = desktop.getMessageBoxStack();
- for (IMessageBox messageBoxe : messageBoxes) {
- showMessageBoxFromScout(messageBoxe);
- }
- }
-
- public IFormField findFocusOwnerField() {
- Control comp = getDisplay().getFocusControl();
- while (comp != null) {
- Object o = comp.getData(IRwtScoutFormField.CLIENT_PROPERTY_SCOUT_OBJECT);
- if (o instanceof IFormField) {
- return (IFormField) o;
- }
- // next
- comp = comp.getParent();
- }
- return null;
- }
-
- @Override
- public void showFileChooserFromScout(IFileChooser fileChooser) {
- IRwtScoutFileChooserService rwtScoutFileChooserService = SERVICES.getService(IRwtScoutFileChooserService.class);
- if (rwtScoutFileChooserService == null) {
- LOG.warn("Missing bundle: org.eclipse.scout.rt.ui.rap.incubator.filechooser. Please activate it in your Scout perspective under Technologies.");
- return;
- }
- IRwtScoutFileChooser sfc = rwtScoutFileChooserService.createFileChooser(getParentShellIgnoringPopups(SWT.SYSTEM_MODAL | SWT.APPLICATION_MODAL | SWT.MODELESS), fileChooser);
- sfc.showFileChooser();
- }
-
- @Override
- public void openBrowserWindowFromScout(String path) {
- BrowserWindowHandler browserWindowHandler = createBrowserWindowHandler();
- if (browserWindowHandler == null) {
- return;
- }
-
- browserWindowHandler.openLink(path);
- }
-
- protected BrowserWindowHandler createBrowserWindowHandler() {
- return new BrowserWindowHandler();
- }
-
- @Override
- public void showMessageBoxFromScout(IMessageBox messageBox) {
- //Never show a gui to a already closed messagebox. Otherwise it stays open forever.
- //Because of the auto close mechanism of the messagebox it is possible that it's already closed (on model side).
- if (!messageBox.isOpen()) {
- return;
- }
-
- RwtScoutMessageBoxDialog box = new RwtScoutMessageBoxDialog(getParentShellIgnoringPopups(SWT.SYSTEM_MODAL | SWT.APPLICATION_MODAL | SWT.MODELESS), messageBox, this);
- box.open();
- }
-
- @Override
- public void ensureFormPartVisible(IForm form) {
- IRwtScoutPart part = getPart(form);
- if (part != null) {
- part.activate();
- }
- else {
- showFormPart(form);
- }
- }
-
- protected IRwtScoutPart createUiScoutDialog(IForm form, Shell shell, int dialogStyle) {
- RwtScoutDialog ui = new RwtScoutDialog();
- ui.createPart(form, shell, dialogStyle, this);
- return ui;
- }
-
- protected IRwtScoutPart createUiScoutPopupDialog(IForm form, Shell shell, int dialogStyle) {
- Control owner = getPopupOwner();
- if (owner == null) {
- owner = getDisplay().getFocusControl();
- }
- if (owner == null) {
- return null;
- }
- Rectangle ownerBounds = getPopupOwnerBounds();
- if (ownerBounds == null) {
- ownerBounds = owner.getBounds();
- Point pDisp = owner.toDisplay(0, 0);
- ownerBounds.x = pDisp.x;
- ownerBounds.y = pDisp.y;
- }
- RwtScoutDialog dialog = new RwtScoutDialog();
- dialog.createPart(form, shell, dialogStyle, this);
- dialog.setUiInitialLocation(new Point(ownerBounds.x, ownerBounds.y + ownerBounds.height));
- return dialog;
- }
-
- protected IRwtScoutPart createUiScoutPopupWindow(IForm f) {
- Control owner = getPopupOwner();
- if (owner == null) {
- owner = getDisplay().getFocusControl();
- }
- if (owner == null) {
- return null;
- }
- Rectangle ownerBounds = getPopupOwnerBounds();
- if (ownerBounds == null) {
- ownerBounds = owner.getBounds();
- Point pDisp = owner.toDisplay(0, 0);
- ownerBounds.x = pDisp.x;
- ownerBounds.y = pDisp.y;
- }
- final RwtScoutPopup popup = new RwtScoutPopup();
- popup.setMaxHeightHint(280);
- popup.createPart(f, owner, ownerBounds, SWT.RESIZE, this);
- popup.addRwtScoutPartListener(new RwtScoutPartListener() {
- @Override
- public void partChanged(RwtScoutPartEvent e) {
- switch (e.getType()) {
- case RwtScoutPartEvent.TYPE_CLOSED: {
- popup.closePart();
- break;
- }
- case RwtScoutPartEvent.TYPE_CLOSING: {
- popup.closePart();
- break;
- }
- }
- }
- });
- //close popup when PARENT shell is activated or closed
- owner.getShell().addShellListener(new ShellAdapter() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void shellClosed(ShellEvent e) {
- //auto-detach
- ((Shell) e.getSource()).removeShellListener(this);
- popup.closePart();
- }
-
- @Override
- public void shellActivated(ShellEvent e) {
- //auto-detach
- ((Shell) e.getSource()).removeShellListener(this);
- popup.closePart();
- }
- });
- return popup;
- }
-
- @Override
- public Control getPopupOwner() {
- return m_popupOwner;
- }
-
- @Override
- public Rectangle getPopupOwnerBounds() {
- return m_popupOwnerBounds != null ? new Rectangle(m_popupOwnerBounds.x, m_popupOwnerBounds.y, m_popupOwnerBounds.width, m_popupOwnerBounds.height) : null;
- }
-
- @Override
- public void setPopupOwner(Control owner, Rectangle ownerBounds) {
- m_popupOwner = owner;
- m_popupOwnerBounds = ownerBounds;
- }
-
- @Override
- public void showFormPart(IForm form) {
- if (form == null) {
- return;
- }
- IRwtScoutPart part = getPart(form);
- if (part != null) {
- return;
- }
- switch (form.getDisplayHint()) {
- case IForm.DISPLAY_HINT_DIALOG: {
- Shell parentShell;
- if (form.isModal()) {
- parentShell = getParentShellIgnoringPopups(SWT.SYSTEM_MODAL | SWT.APPLICATION_MODAL | SWT.MODELESS);
- }
- else {
- parentShell = getParentShellIgnoringPopups(0);
- }
- int dialogStyle = SWT.DIALOG_TRIM | SWT.RESIZE | (form.isModal() ? SWT.APPLICATION_MODAL : SWT.MODELESS | SWT.MIN);
- part = createUiScoutDialog(form, parentShell, dialogStyle);
- break;
- }
- case IForm.DISPLAY_HINT_POPUP_DIALOG: {
- Shell parentShell;
- if (form.isModal()) {
- parentShell = getParentShellIgnoringPopups(SWT.SYSTEM_MODAL | SWT.APPLICATION_MODAL | SWT.MODELESS);
- }
- else {
- parentShell = getParentShellIgnoringPopups(0);
- }
- int dialogStyle = SWT.DIALOG_TRIM | SWT.RESIZE | (form.isModal() ? SWT.APPLICATION_MODAL : SWT.MODELESS | SWT.MIN);
- part = createUiScoutPopupDialog(form, parentShell, dialogStyle);
- if (part == null) {
- LOG.error("showing popup for " + form + ", but there is neither a focus owner nor the property 'IRwtEnvironment.getPopupOwner()'");
- }
- break;
- }
- case IForm.DISPLAY_HINT_VIEW: {
- //nop
- break;
- }
- case IForm.DISPLAY_HINT_POPUP_WINDOW: {
- part = createUiScoutPopupWindow(form);
- if (part == null) {
- LOG.error("showing popup for " + form + ", but there is neither a focus owner nor the property 'IRwtEnvironment.getPopupOwner()'");
- }
- break;
- }
- }
- if (part != null) {
- try {
- putPart(form, part);
- part.showPart();
- }
- catch (Throwable t) {
- LOG.error(t.getMessage(), t);
- }
- }
- }
-
- @Override
- public void hideFormPart(IForm form) {
- if (form == null) {
- return;
- }
- IRwtScoutPart part = removePart(form);
- if (part != null) {
- part.closePart();
- }
- }
-
- protected void handleDesktopPropertyChanged(String propertyName, Object oldVal, Object newValue) {
- if (IDesktop.PROP_STATUS.equals(propertyName)) {
- setStatusFromScout();
- }
- }
-
- @SuppressWarnings("unused")
- protected void setStatusFromScout() {
- if (getScoutDesktop() == null) {
- return;
- }
-
- IProcessingStatus newValue = getScoutDesktop().getStatus();
- //when a tray item is available, use it, otherwise set status on views/dialogs
- TrayItem trayItem = null;
-// if (getTrayComposite() != null) {//XXXRAP
-// trayItem = getTrayComposite().getSwtTrayItem();
-// }
- if (trayItem != null) {
- String s = newValue != null ? newValue.getMessage() : null;
- if (newValue != null && s != null) {
- int iconId;
- switch (newValue.getSeverity()) {
- case IProcessingStatus.WARNING: {
- iconId = SWT.ICON_WARNING;
- break;
- }
- case IProcessingStatus.FATAL:
- case IProcessingStatus.ERROR: {
- iconId = SWT.ICON_ERROR;
- break;
- }
- case IProcessingStatus.CANCEL: {
- //Necessary for backward compatibility to Eclipse 3.4 needed for Lotus Notes 8.5.2
- Version frameworkVersion = new Version(Activator.getDefault().getBundle().getBundleContext().getProperty("osgi.framework.version"));
- if (frameworkVersion.getMajor() == 3
- && frameworkVersion.getMinor() <= 4) {
- iconId = SWT.ICON_INFORMATION;
- }
- else {
- iconId = 1 << 8;//SWT.ICON_CANCEL
- }
- break;
- }
- default: {
- iconId = SWT.ICON_INFORMATION;
- break;
- }
- }
- ToolTip tip = new ToolTip(getParentShellIgnoringPopups(SWT.MODELESS), SWT.BALLOON | iconId);
- tip.setMessage(s);
- trayItem.setToolTip(tip);
- tip.setVisible(true);
- }
- else {
- ToolTip tip = new ToolTip(getParentShellIgnoringPopups(SWT.MODELESS), SWT.NONE);
- trayItem.setToolTip(tip);
- tip.setVisible(true);
- }
- }
- else {
- String message = null;
- if (newValue != null) {
- message = newValue.getMessage();
- }
- setStatusLineMessage(null, message);
- }
- }
-
- public void setStatusLineMessage(Image image, String message) {
- for (IRwtScoutPart part : m_openForms.values()) {
- if (part.setStatusLineMessage(image, message)) {
- return;
- }
- }
- }
-
- private class P_ScoutDesktopPropertyListener implements PropertyChangeListener {
- @Override
- public void propertyChange(final PropertyChangeEvent evt) {
- if (!getDisplay().isDisposed()) {
- Runnable job = new Runnable() {
- @Override
- public void run() {
- handleDesktopPropertyChanged(evt.getPropertyName(), evt.getOldValue(), evt.getNewValue());
- }
- };
- invokeUiLater(job);
- }
- }
- } // end class P_ScoutDesktopPropertyListener
-
- private class P_ScoutDesktopListener implements DesktopListener {
- @Override
- public void desktopChanged(final DesktopEvent e) {
- if (getDisplay().isDisposed()) {
- return;
- }
- switch (e.getType()) {
- case DesktopEvent.TYPE_FORM_ADDED: {
- Runnable t = new Runnable() {
- @Override
- public void run() {
- showFormPart(e.getForm());
- getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- UICallBack.deactivate(AbstractRwtEnvironment.class.getName() + AbstractRwtEnvironment.this.hashCode());
- }
- });
- }
- };
- invokeUiLater(t);
- break;
- }
- case DesktopEvent.TYPE_FORM_REMOVED: {
- Runnable t = new Runnable() {
- @Override
- public void run() {
- hideFormPart(e.getForm());
- }
- };
- invokeUiLater(t);
- break;
- }
- case DesktopEvent.TYPE_FORM_ENSURE_VISIBLE: {
- Runnable t = new Runnable() {
- @Override
- public void run() {
- ensureFormPartVisible(e.getForm());
- getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- UICallBack.deactivate(AbstractRwtEnvironment.class.getName() + AbstractRwtEnvironment.this.hashCode());
- }
- });
- }
- };
- invokeUiLater(t);
- break;
- }
- case DesktopEvent.TYPE_MESSAGE_BOX_ADDED: {
- Runnable t = new Runnable() {
- @Override
- public void run() {
- showMessageBoxFromScout(e.getMessageBox());
- }
- };
- invokeUiLater(t);
- break;
- }
- case DesktopEvent.TYPE_FILE_CHOOSER_ADDED: {
- Runnable t = new Runnable() {
- @Override
- public void run() {
- showFileChooserFromScout(e.getFileChooser());
- }
- };
- invokeUiLater(t);
- break;
- }
- case DesktopEvent.TYPE_OPEN_BROWSER_WINDOW: {
- Runnable t = new Runnable() {
- @Override
- public void run() {
- openBrowserWindowFromScout(e.getPath());
- }
- };
- invokeUiLater(t);
- break;
- }
- case DesktopEvent.TYPE_DESKTOP_CLOSED: {
- Runnable t = new Runnable() {
- @Override
- public void run() {
- try {
- stopScout();
- }
- catch (CoreException ex) {
- LOG.error("desktop closed", ex);
- }
- getDisplay().asyncExec(new Runnable() {
-
- @Override
- public void run() {
- logout();
- }
- });
- }
- };
- invokeUiLater(t);
- break;
- }
- case DesktopEvent.TYPE_PRINT: {
- Runnable t = new Runnable() {
- @Override
- public void run() {
- handleScoutPrintInRwt(e);
- }
- };
- invokeUiLater(t);
- break;
- }
- case DesktopEvent.TYPE_FIND_FOCUS_OWNER: {
- final Object lock = new Object();
- Runnable t = new Runnable() {
- @Override
- public void run() {
- try {
- IFormField f = findFocusOwnerField();
- if (f != null) {
- e.setFocusedField(f);
- }
- }
- finally {
- synchronized (lock) {
- lock.notifyAll();
- }
- }
- }
- };
- synchronized (lock) {
- invokeUiLater(t);
- try {
- lock.wait(2000L);
- }
- catch (InterruptedException e1) {
- //nop
- }
- }
- break;
- }
- }
- }
- }
-
- @Override
- public void postImmediateUiJob(Runnable r) {
- synchronized (m_immediateUiJobsLock) {
- m_immediateUiJobs.add(r);
- }
- }
-
- @Override
- public void dispatchImmediateUiJobs() {
- List<Runnable> list;
- synchronized (m_immediateUiJobsLock) {
- list = new ArrayList<Runnable>(m_immediateUiJobs);
- m_immediateUiJobs.clear();
- }
- for (Runnable r : list) {
- try {
- r.run();
- }
- catch (Throwable t) {
- LOG.warn("running " + r, t);
- }
- }
- }
-
- @Override
- public JobEx invokeScoutLater(Runnable job, long cancelTimeout) {
- synchronized (m_immediateUiJobsLock) {
- m_immediateUiJobs.clear();
- }
- if (m_synchronizer != null) {
- return m_synchronizer.invokeScoutLater(job, cancelTimeout);
- }
- else {
- LOG.warn("synchronizer is null; session is closed");
- return null;
- }
- }
-
- @Override
- public void invokeUiLater(Runnable job) {
- if (m_synchronizer != null) {
- m_synchronizer.invokeUiLater(job);
- }
- else {
- LOG.warn("synchronizer is null; session is closed");
- }
- }
-
- @Override
- public IClientSession getClientSession() {
- return m_clientSession;
- }
-
- @Override
- public LayoutValidateManager getLayoutValidateManager() {
- return m_layoutValidateManager;
- }
-
- // GUI FACTORY
- protected RwtIconLocator createIconLocator() {
- return new RwtIconLocator(getClientSession().getIconLocator());
- }
-
- protected ScoutFormToolkit createScoutFormToolkit(Display display) {
- return new ScoutFormToolkit(new FormToolkit(display) {
- @Override
- public Form createForm(Composite parent) {
- Form f = super.createForm(parent);
- decorateFormHeading(f);
- return f;
- }
- });
- }
-
- @Override
- public IRwtScoutForm createForm(Composite parent, IForm scoutForm) {
- RwtScoutForm uiForm = new RwtScoutForm();
- uiForm.createUiField(parent, scoutForm, this);
- return uiForm;
- }
-
- /**
- * As default there is no form header created. <br/>
- * Subclasses can override this method to create one.
- */
- @Override
- public IRwtScoutFormHeader createFormHeader(Composite parent, IForm scoutForm) {
- return null;
- }
-
- /**
- * As default there is no form footer created. <br/>
- * Subclasses can override this method to create one.
- */
- @Override
- public IRwtScoutFormFooter createFormFooter(Composite parent, IForm scoutForm) {
- return null;
- }
-
- @Override
- public IRwtScoutFormField createFormField(Composite parent, IFormField model) {
- if (m_formFieldFactory == null) {
- m_formFieldFactory = new FormFieldFactory(getApplicationBundle());
- }
- IRwtScoutFormField<IFormField> uiField = m_formFieldFactory.createUiFormField(parent, model, this);
- return uiField;
- }
-
- @Override
- public void checkThread() {
- if (!(getDisplay().getThread() == Thread.currentThread())) {
- throw new IllegalStateException("Must be called in rwt thread");
- }
- }
-
- protected void handleScoutPrintInRwt(DesktopEvent e) {
- WidgetPrinter wp = new WidgetPrinter(getParentShellIgnoringPopups(SWT.SYSTEM_MODAL | SWT.APPLICATION_MODAL | SWT.MODELESS));
- try {
- wp.print(e.getPrintDevice(), e.getPrintParameters());
- }
- catch (Throwable ex) {
- LOG.error(null, ex);
- }
- }
-
- protected String getDesktopOpenedTaskText() {
- return RwtUtility.getNlsText(Display.getCurrent(), "ScoutStarting");
- }
-
- protected String getDesktopClosedTaskText() {
- return RwtUtility.getNlsText(Display.getCurrent(), "ScoutStoping");
- }
-
- protected boolean isStartDesktopCalled() {
- return m_startDesktopCalled;
- }
-
- protected void setStartDesktopCalled(boolean startDesktopCalled) {
- m_startDesktopCalled = startDesktopCalled;
- }
-
- protected boolean isActivateDesktopCalled() {
- return m_activateDesktopCalled;
- }
-
- protected void setActivateDesktopCalled(boolean activateDesktopCalled) {
- m_activateDesktopCalled = activateDesktopCalled;
- }
-
- private class P_LocaleListener implements ILocaleListener {
- @Override
- public void localeChanged(LocaleChangeEvent event) {
- final Locale locale = event.getLocale();
- invokeUiLater(new Runnable() {
- @Override
- public void run() {
- if (!hasSameLocale(RWT.getLocale(), locale)) {
- setLocale(locale);
- }
- }
- });
- }
-
- private void setLocale(Locale locale) {
- RWT.setLocale(locale);
- }
-
- private boolean hasSameLocale(Locale locale1, Locale locale2) {
- boolean result = false;
- if (locale1 != null && locale2 != null) {
- result = locale1.equals(locale2);
- }
- return result;
- }
- }
-
- private static final class P_SessionStoreListener implements SessionStoreListener {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void beforeDestroy(SessionStoreEvent event) {
- ISessionStore sessionStore = event.getSessionStore();
- IClientSession clientSession = (IClientSession) sessionStore.getAttribute(IClientSession.class.getName());
- if (clientSession != null) {
- if (LOG.isInfoEnabled()) {
- UserAgent userAgent = clientSession.getUserAgent();
- String msg = "Thread: {0} Session goes down...; UserAgent: {2}";
- LOG.info(msg, new Object[]{Long.valueOf(Thread.currentThread().getId()), userAgent});
- }
-
- new ClientAsyncJob("HTTP session inactivator", clientSession) {
- @Override
- protected void runVoid(IProgressMonitor monitor) throws Throwable {
- getClientSession().stopSession();
- }
- }.runNow(new NullProgressMonitor());
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.UUID;
+
+import javax.security.auth.Subject;
+import javax.servlet.http.HttpServletResponse;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.rwt.RWT;
+import org.eclipse.rwt.internal.widgets.JSExecutor;
+import org.eclipse.rwt.lifecycle.UICallBack;
+import org.eclipse.rwt.service.ISessionStore;
+import org.eclipse.rwt.service.SessionStoreEvent;
+import org.eclipse.rwt.service.SessionStoreListener;
+import org.eclipse.scout.commons.EventListenerList;
+import org.eclipse.scout.commons.HTMLUtility.DefaultFont;
+import org.eclipse.scout.commons.ListUtility;
+import org.eclipse.scout.commons.LocaleThreadLocal;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.exception.IProcessingStatus;
+import org.eclipse.scout.commons.holders.BooleanHolder;
+import org.eclipse.scout.commons.job.JobEx;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ClientAsyncJob;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.client.ILocaleListener;
+import org.eclipse.scout.rt.client.LocaleChangeEvent;
+import org.eclipse.scout.rt.client.busy.IBusyHandler;
+import org.eclipse.scout.rt.client.busy.IBusyManagerService;
+import org.eclipse.scout.rt.client.services.common.exceptionhandler.ErrorHandler;
+import org.eclipse.scout.rt.client.services.common.session.IClientSessionRegistryService;
+import org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke;
+import org.eclipse.scout.rt.client.ui.basic.filechooser.IFileChooser;
+import org.eclipse.scout.rt.client.ui.desktop.DesktopEvent;
+import org.eclipse.scout.rt.client.ui.desktop.DesktopListener;
+import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.messagebox.IMessageBox;
+import org.eclipse.scout.rt.shared.data.basic.FontSpec;
+import org.eclipse.scout.rt.shared.ui.UiDeviceType;
+import org.eclipse.scout.rt.shared.ui.UiLayer;
+import org.eclipse.scout.rt.shared.ui.UserAgent;
+import org.eclipse.scout.rt.ui.rap.basic.IRwtScoutComposite;
+import org.eclipse.scout.rt.ui.rap.basic.WidgetPrinter;
+import org.eclipse.scout.rt.ui.rap.busy.RwtBusyHandler;
+import org.eclipse.scout.rt.ui.rap.concurrency.RwtScoutSynchronizer;
+import org.eclipse.scout.rt.ui.rap.extension.UiDecorationExtensionPoint;
+import org.eclipse.scout.rt.ui.rap.form.IRwtScoutForm;
+import org.eclipse.scout.rt.ui.rap.form.RwtScoutForm;
+import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
+import org.eclipse.scout.rt.ui.rap.html.HtmlAdapter;
+import org.eclipse.scout.rt.ui.rap.internal.servletfilter.LogoutFilter;
+import org.eclipse.scout.rt.ui.rap.keystroke.IRwtKeyStroke;
+import org.eclipse.scout.rt.ui.rap.keystroke.KeyStrokeManager;
+import org.eclipse.scout.rt.ui.rap.util.ColorFactory;
+import org.eclipse.scout.rt.ui.rap.util.DeviceUtility;
+import org.eclipse.scout.rt.ui.rap.util.FontRegistry;
+import org.eclipse.scout.rt.ui.rap.util.RwtIconLocator;
+import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
+import org.eclipse.scout.rt.ui.rap.util.ScoutFormToolkit;
+import org.eclipse.scout.rt.ui.rap.window.BrowserWindowHandler;
+import org.eclipse.scout.rt.ui.rap.window.IRwtScoutPart;
+import org.eclipse.scout.rt.ui.rap.window.RwtScoutPartEvent;
+import org.eclipse.scout.rt.ui.rap.window.RwtScoutPartListener;
+import org.eclipse.scout.rt.ui.rap.window.desktop.IRwtScoutFormFooter;
+import org.eclipse.scout.rt.ui.rap.window.desktop.IRwtScoutFormHeader;
+import org.eclipse.scout.rt.ui.rap.window.desktop.navigation.RwtScoutNavigationSupport;
+import org.eclipse.scout.rt.ui.rap.window.dialog.RwtScoutDialog;
+import org.eclipse.scout.rt.ui.rap.window.filechooser.IRwtScoutFileChooser;
+import org.eclipse.scout.rt.ui.rap.window.filechooser.IRwtScoutFileChooserService;
+import org.eclipse.scout.rt.ui.rap.window.messagebox.RwtScoutMessageBoxDialog;
+import org.eclipse.scout.rt.ui.rap.window.popup.RwtScoutPopup;
+import org.eclipse.scout.service.SERVICES;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ShellAdapter;
+import org.eclipse.swt.events.ShellEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.MessageBox;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.ToolTip;
+import org.eclipse.swt.widgets.TrayItem;
+import org.eclipse.ui.forms.widgets.Form;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.Version;
+
+@SuppressWarnings("restriction")
+public abstract class AbstractRwtEnvironment implements IRwtEnvironment {
+ private static IScoutLogger LOG = ScoutLogManager.getLogger(AbstractRwtEnvironment.class);
+
+ private Subject m_subject;
+
+ private int m_status;
+
+ private Bundle m_applicationBundle;
+ private RwtScoutSynchronizer m_synchronizer;
+ private SessionStoreListener m_sessionStoreListener;
+ private ILocaleListener m_localeListener;
+
+ private final Object m_immediateUiJobsLock = new Object();
+ private final List<Runnable> m_immediateUiJobs = new ArrayList<Runnable>();
+
+ private ColorFactory m_colorFactory;
+ private FontRegistry m_fontRegistry;
+ private RwtIconLocator m_iconLocator;
+
+ private List<IRwtKeyStroke> m_desktopKeyStrokes;
+ private KeyStrokeManager m_keyStrokeManager;
+
+ private Control m_popupOwner;
+ private Rectangle m_popupOwnerBounds;
+
+ private ScoutFormToolkit m_formToolkit;
+ private FormFieldFactory m_formFieldFactory;
+
+ private boolean m_startDesktopCalled;
+ private boolean m_activateDesktopCalled;
+
+ private EventListenerList m_environmentListeners;
+
+ private HashMap<IForm, IRwtScoutPart> m_openForms;
+ private P_ScoutDesktopListener m_scoutDesktopListener;
+ private P_ScoutDesktopPropertyListener m_desktopPropertyListener;
+
+ private final Class<? extends IClientSession> m_clientSessionClazz;
+ private IClientSession m_clientSession;
+ private IDesktop m_desktop;
+
+ private RwtScoutNavigationSupport m_historySupport;
+ private LayoutValidateManager m_layoutValidateManager;
+ private HtmlAdapter m_htmlAdapter;
+ private IBusyHandler m_busyHandler;
+
+ public AbstractRwtEnvironment(Bundle applicationBundle, Class<? extends IClientSession> clientSessionClazz) {
+ m_applicationBundle = applicationBundle;
+ m_clientSessionClazz = clientSessionClazz;
+ m_sessionStoreListener = new P_SessionStoreListener();
+ m_environmentListeners = new EventListenerList();
+ m_localeListener = new P_LocaleListener();
+ m_openForms = new HashMap<IForm, IRwtScoutPart>();
+ m_status = RwtEnvironmentEvent.INACTIVE;
+ m_desktopKeyStrokes = new ArrayList<IRwtKeyStroke>();
+ m_startDesktopCalled = false;
+ }
+
+ protected void setSubject(Subject subject) {
+ m_subject = subject;
+ }
+
+ public Subject getSubject() {
+ return m_subject;
+ }
+
+ /**
+ * @return the applicationBundle
+ */
+ public Bundle getApplicationBundle() {
+ return m_applicationBundle;
+ }
+
+ protected IRwtScoutPart putPart(IForm form, IRwtScoutPart part) {
+ return m_openForms.put(form, part);
+ }
+
+ protected IRwtScoutPart getPart(IForm form) {
+ return m_openForms.get(form);
+ }
+
+ @Override
+ public Collection<IRwtScoutPart> getOpenFormParts() {
+ return new ArrayList<IRwtScoutPart>(m_openForms.values());
+ }
+
+ protected IRwtScoutPart removePart(IForm form) {
+ return m_openForms.remove(form);
+ }
+
+ protected void stopScout() throws CoreException {
+ try {
+ if (m_historySupport != null) {
+ m_historySupport.uninstall();
+ m_historySupport = null;
+ }
+ if (m_desktopKeyStrokes != null) {
+ for (IRwtKeyStroke uiKeyStroke : m_desktopKeyStrokes) {
+ removeGlobalKeyStroke(uiKeyStroke);
+ }
+ m_desktopKeyStrokes.clear();
+ }
+ if (m_iconLocator != null) {
+ m_iconLocator.dispose();
+ m_iconLocator = null;
+ }
+ if (m_colorFactory != null) {
+ m_colorFactory.dispose();
+ m_colorFactory = null;
+ }
+ m_keyStrokeManager = null;
+ if (m_fontRegistry != null) {
+ m_fontRegistry.dispose();
+ m_fontRegistry = null;
+ }
+ if (m_formToolkit != null) {
+ m_formToolkit.dispose();
+ m_formToolkit = null;
+ }
+ detachScoutListeners();
+ if (m_synchronizer != null) {
+ m_synchronizer = null;
+ }
+ if (m_busyHandler != null) {
+ m_busyHandler.setEnabled(false);
+ m_busyHandler = null;
+ }
+
+ m_status = RwtEnvironmentEvent.STOPPED;
+ fireEnvironmentChanged(new RwtEnvironmentEvent(this, RwtEnvironmentEvent.STOPPED));
+ }
+ finally {
+ if (m_status != RwtEnvironmentEvent.STOPPED) {
+ m_status = RwtEnvironmentEvent.STARTED;
+ fireEnvironmentChanged(new RwtEnvironmentEvent(this, RwtEnvironmentEvent.STARTED));
+ }
+ }
+ }
+
+ /**
+ * @deprecated use {@link #getLogoutLocation()} instead.
+ */
+ @SuppressWarnings("deprecation")
+ @Override
+ @Deprecated
+ public String getLogoutLandingUri() {
+ return getLogoutLocation();
+ }
+
+ /**
+ * @see {@link LogoutFilter}
+ */
+ protected String getLogoutLocation() {
+ String path = RWT.getRequest().getServletPath();
+
+ if (path.length() > 0 && '/' == path.charAt(0)) {
+ path = path.substring(1);
+ }
+
+ path += "?" + LogoutFilter.LOGOUT_PARAM;
+
+ return path;
+ }
+
+ public void logout() {
+ HttpServletResponse response = RWT.getResponse();
+ String logoutUri = response.encodeRedirectURL(getLogoutLandingUri());
+ String browserText = MessageFormat.format("parent.window.location.href = \"{0}\";", logoutUri);
+ JSExecutor.executeJS(browserText);
+ }
+
+ @Override
+ public boolean isInitialized() {
+ return m_status == RwtEnvironmentEvent.STARTED;
+ }
+
+ @Override
+ public final void ensureInitialized() {
+ if (m_status == RwtEnvironmentEvent.INACTIVE || m_status == RwtEnvironmentEvent.STOPPED) {
+ try {
+ init();
+ }
+ catch (Exception e) {
+ LOG.error("could not initialize Environment", e);
+ }
+ }
+ }
+
+ protected synchronized void init() throws CoreException {
+ if (m_status == RwtEnvironmentEvent.STARTING
+ || m_status == RwtEnvironmentEvent.STARTED
+ || m_status == RwtEnvironmentEvent.STOPPING) {
+ return;
+ }
+ m_status = RwtEnvironmentEvent.INACTIVE;
+ // must be called in display thread
+ if (Thread.currentThread() != getDisplay().getThread()) {
+ throw new IllegalStateException("must be called in display thread");
+ }
+ // workbench must exist
+// if (PlatformUI.getWorkbench().getActiveWorkbenchWindow() == null) {
+// throw new IllegalStateException("workbench must be active");
+// }
+// // close views that were opened due to workbench caching the latest layout
+// // of views
+// for (IWorkbenchWindow workbenchWindow : PlatformUI.getWorkbench().getWorkbenchWindows()) {
+// for (IWorkbenchPage workbenchPage : workbenchWindow.getPages()) {
+// for (IViewReference viewReference : workbenchPage.getViewReferences()) {
+// if (m_scoutPartIdToUiPartId.containsValue(viewReference.getId())) {
+// if (workbenchPage.isPartVisible(viewReference.getPart(false))) {
+// workbenchPage.hideView(viewReference);
+// }
+// }
+// }
+// }
+// }
+ //
+ try {
+ m_status = RwtEnvironmentEvent.STARTING;
+ fireEnvironmentChanged(new RwtEnvironmentEvent(this, m_status));
+
+ if (getSubject() == null) {
+ throw new SecurityException("/rap request is not authenticated with a Subject");
+ }
+
+ UserAgent userAgent = initUserAgent();
+ DeviceUtility.setCurrentDeviceType(userAgent.getUiDeviceType());
+
+ final BooleanHolder newSession = new BooleanHolder(true);
+ IClientSession tempClientSession = (IClientSession) RWT.getSessionStore().getAttribute(IClientSession.class.getName());
+ if (tempClientSession == null || !tempClientSession.isActive()) {
+ LocaleThreadLocal.set(RwtUtility.getBrowserInfo().getLocale());
+ tempClientSession = SERVICES.getService(IClientSessionRegistryService.class).newClientSession(m_clientSessionClazz, getSubject(), UUID.randomUUID().toString(), userAgent);
+
+ RWT.getSessionStore().setAttribute(IClientSession.class.getName(), tempClientSession);
+ RWT.getSessionStore().addSessionStoreListener(m_sessionStoreListener);
+
+ // init RWT locale with the locale of the client session
+ if (tempClientSession.getLocale() != null && !tempClientSession.getLocale().equals(RWT.getLocale())) {
+ RWT.setLocale(tempClientSession.getLocale());
+ }
+ newSession.setValue(true);
+ }
+ else {
+ newSession.setValue(false);
+ }
+ if (!tempClientSession.isActive()) {
+ showClientSessionLoadError(tempClientSession.getLoadError());
+ LOG.error("ClientSession is not active, there must be a problem with loading or starting");
+ m_status = RwtEnvironmentEvent.INACTIVE;
+ return;
+ }
+ else {
+ m_clientSession = tempClientSession;
+ }
+ m_desktop = m_clientSession.getDesktop();
+ if (m_synchronizer == null) {
+ m_synchronizer = new RwtScoutSynchronizer(this);
+ }
+ //put the the display on the session data
+ m_clientSession.setData(ENVIRONMENT_KEY, this);
+
+ m_clientSession.addLocaleListener(m_localeListener);
+
+ //
+ RwtUtility.setNlsTextsOnDisplay(getDisplay(), m_clientSession.getTexts());
+ m_iconLocator = createIconLocator();
+ m_colorFactory = new ColorFactory(getDisplay());
+ m_keyStrokeManager = new KeyStrokeManager(this);
+ m_fontRegistry = new FontRegistry(getDisplay());
+ if (UiDecorationExtensionPoint.getLookAndFeel().isBrowserHistoryEnabled()) {
+ m_historySupport = new RwtScoutNavigationSupport(this);
+ m_historySupport.install();
+ }
+ m_layoutValidateManager = new LayoutValidateManager();
+ attachScoutListeners();
+ // desktop keystokes
+ for (IKeyStroke scoutKeyStroke : getClientSession().getDesktop().getKeyStrokes()) {
+ IRwtKeyStroke[] uiStrokes = RwtUtility.getKeyStrokes(scoutKeyStroke, this);
+ for (IRwtKeyStroke uiStroke : uiStrokes) {
+ m_desktopKeyStrokes.add(uiStroke);
+ addGlobalKeyStroke(uiStroke, false);
+ }
+ }
+ // notify ui available
+ // notify desktop that it is loaded
+ UICallBack.activate(AbstractRwtEnvironment.class.getName() + AbstractRwtEnvironment.this.hashCode());
+ new ClientSyncJob("Desktop opened", getClientSession()) {
+ @Override
+ protected void runVoid(IProgressMonitor monitor) throws Throwable {
+ if (newSession.getValue()) {
+ fireDesktopOpenedFromUIInternal();
+ fireGuiAttachedFromUIInternal();
+ }
+ else {
+ fireGuiAttachedFromUIInternal();
+ fireDesktopActivatedFromUIInternal();
+ }
+ }
+ }.schedule();
+
+ m_status = RwtEnvironmentEvent.STARTED;
+ fireEnvironmentChanged(new RwtEnvironmentEvent(this, m_status));
+
+ m_busyHandler = attachBusyHandler();
+ }
+ finally {
+ if (m_status == RwtEnvironmentEvent.STARTING) {
+ m_status = RwtEnvironmentEvent.STOPPED;
+ fireEnvironmentChanged(new RwtEnvironmentEvent(this, m_status));
+ }
+ }
+ }
+
+ protected UserAgent initUserAgent() {
+ return UserAgent.create(UiLayer.RAP, UiDeviceType.DESKTOP, RwtUtility.getBrowserInfo().getUserAgent());
+ }
+
+ protected RwtBusyHandler attachBusyHandler() {
+ IBusyManagerService service = SERVICES.getService(IBusyManagerService.class);
+ if (service == null) {
+ return null;
+ }
+ RwtBusyHandler handler = createBusyHandler();
+ service.register(getClientSession(), handler);
+ return handler;
+ }
+
+ protected RwtBusyHandler createBusyHandler() {
+ return new RwtBusyHandler(getClientSession(), this);
+ }
+
+ protected void showClientSessionLoadError(Throwable error) {
+ ErrorHandler handler = new ErrorHandler(error);
+ MessageBox mbox = new MessageBox(getParentShellIgnoringPopups(SWT.SYSTEM_MODAL | SWT.APPLICATION_MODAL | SWT.MODELESS), SWT.OK);
+ mbox.setText("" + handler.getTitle());
+ mbox.setMessage(StringUtility.join("\n\n", handler.getText(), handler.getDetail()));
+ mbox.open();
+ }
+
+ protected void fireDesktopOpenedFromUIInternal() {
+ if (getScoutDesktop() != null) {
+ getScoutDesktop().getUIFacade().fireDesktopOpenedFromUI();
+ }
+ }
+
+ protected void fireGuiAttachedFromUIInternal() {
+ if (getScoutDesktop() != null) {
+ getScoutDesktop().getUIFacade().fireGuiAttached();
+ }
+ }
+
+ protected void fireGuiDetachedFromUIInternal() {
+ if (getScoutDesktop() != null) {
+ getScoutDesktop().getUIFacade().fireGuiDetached();
+ }
+ }
+
+ protected void fireDesktopActivatedFromUIInternal() {
+ if (getScoutDesktop() != null) {
+ getScoutDesktop().ensureViewStackVisible();
+ }
+ }
+
+ @Override
+ public void setClipboardText(String text) {
+ //XXX rap m_clipboard.setContents(new Object[]{text}, new Transfer[]{TextTransfer.getInstance()});
+ }
+
+ @Override
+ public final void addEnvironmentListener(IRwtEnvironmentListener listener) {
+ m_environmentListeners.add(IRwtEnvironmentListener.class, listener);
+ }
+
+ @Override
+ public final void removeEnvironmentListener(IRwtEnvironmentListener listener) {
+ m_environmentListeners.remove(IRwtEnvironmentListener.class, listener);
+ }
+
+ private void fireEnvironmentChanged(RwtEnvironmentEvent event) {
+ for (IRwtEnvironmentListener l : m_environmentListeners.getListeners(IRwtEnvironmentListener.class)) {
+ l.environmentChanged(event);
+ }
+ }
+
+ @Override
+ public String adaptHtmlCell(IRwtScoutComposite<?> uiComposite, String rawHtml) {
+ return getHtmlAdapter().adaptHtmlCell(uiComposite, rawHtml);
+ }
+
+ @Override
+ public String convertLinksWithLocalUrlsInHtmlCell(IRwtScoutComposite<?> uiComposite, String rawHtml) {
+ return getHtmlAdapter().convertLinksWithLocalUrlsInHtmlCell(uiComposite, rawHtml);
+ }
+
+ @Override
+ public String styleHtmlText(IRwtScoutFormField<?> uiComposite, String rawHtml) {
+ return getHtmlAdapter().styleHtmlText(uiComposite, rawHtml);
+ }
+
+ /**
+ * @deprecated To adjust the behavior override {@link HtmlAdapter} instead. Will be removed in 3.9.0
+ */
+ @Deprecated
+ protected DefaultFont createDefaultFontSettings(IRwtScoutFormField<?> uiComposite) {
+ return getHtmlAdapter().createDefaultFontSettings(uiComposite);
+ }
+
+ protected HtmlAdapter createHtmlAdapter() {
+ return new HtmlAdapter(this);
+ }
+
+ public HtmlAdapter getHtmlAdapter() {
+ if (m_htmlAdapter == null) {
+ m_htmlAdapter = createHtmlAdapter();
+ }
+
+ return m_htmlAdapter;
+ }
+
+ // icon handling
+ @Override
+ public Image getIcon(String name) {
+ return m_iconLocator.getIcon(name);
+ }
+
+ @Override
+ public ImageDescriptor getImageDescriptor(String iconId) {
+ return m_iconLocator.getImageDescriptor(iconId);
+ }
+
+ // color handling
+ @Override
+ public Color getColor(String scoutColor) {
+ return m_colorFactory.getColor(scoutColor);
+ }
+
+ @Override
+ public Color getColor(RGB rgb) {
+ return m_colorFactory.getColor(rgb);
+ }
+
+ //keyStroke handling
+ private static Collection<Integer> fKeyList = Arrays.asList(new Integer[]{SWT.F1, SWT.F2, SWT.F3, SWT.F4, SWT.F5, SWT.F6, SWT.F7, SWT.F8, SWT.F9, SWT.F10, SWT.F11, SWT.F12});
+
+ @Override
+ public void addGlobalKeyStroke(IRwtKeyStroke stroke, boolean exclusive) {
+ boolean internalExclusive = exclusive;
+ //If F1-F12 is set we wan't to have this exclusive to the application, else the browser will reload the page
+ if (ListUtility.containsAny(fKeyList, stroke.getKeyCode())) {
+ internalExclusive = true;
+ }
+ m_keyStrokeManager.addGlobalKeyStroke(stroke, internalExclusive);
+ }
+
+ @Override
+ public boolean removeGlobalKeyStroke(IRwtKeyStroke stroke) {
+ return m_keyStrokeManager.removeGlobalKeyStroke(stroke);
+ }
+
+ @Override
+ public void addKeyStroke(Control control, IRwtKeyStroke stoke, boolean exclusive) {
+ m_keyStrokeManager.addKeyStroke(control, stoke, exclusive);
+ }
+
+ @Override
+ public boolean removeKeyStroke(Control control, IRwtKeyStroke stoke) {
+ if (m_keyStrokeManager == null) {
+ return false;
+ }
+ return m_keyStrokeManager.removeKeyStroke(control, stoke);
+ }
+
+ @Override
+ public boolean removeKeyStrokes(Control control) {
+ if (m_keyStrokeManager == null) {
+ return false;
+ }
+ return m_keyStrokeManager.removeKeyStrokes(control);
+ }
+
+ /**
+ * @return the keyStrokeManager
+ */
+ protected KeyStrokeManager getKeyStrokeManager() {
+ return m_keyStrokeManager;
+ }
+
+ // font handling
+ @Override
+ public Font getFont(FontSpec scoutFont, Font templateFont) {
+ return m_fontRegistry.getFont(scoutFont, templateFont);
+ }
+
+ @Override
+ public Font getFont(Font templateFont, String newName, Integer newStyle, Integer newSize) {
+ return m_fontRegistry.getFont(templateFont, newName, newStyle, newSize);
+ }
+
+ // form toolkit handling
+ @Override
+ public ScoutFormToolkit getFormToolkit() {
+ if (m_formToolkit == null) {
+ m_formToolkit = createScoutFormToolkit(getDisplay());
+ }
+ return m_formToolkit;
+ }
+
+ // desktop handling
+ @Override
+ public final IDesktop getScoutDesktop() {
+ return m_desktop;
+ }
+
+ protected void attachScoutListeners() {
+ if (m_scoutDesktopListener == null) {
+ m_scoutDesktopListener = new P_ScoutDesktopListener();
+ getScoutDesktop().addDesktopListener(m_scoutDesktopListener);
+ }
+ if (m_desktopPropertyListener == null) {
+ m_desktopPropertyListener = new P_ScoutDesktopPropertyListener();
+ getScoutDesktop().addPropertyChangeListener(m_desktopPropertyListener);
+ }
+ }
+
+ protected void detachScoutListeners() {
+ IDesktop desktop = getScoutDesktop();
+ if (desktop == null) {
+ LOG.warn("Desktop is null, cannot remove listeners.");
+ return;
+ }
+
+ if (m_scoutDesktopListener != null) {
+ desktop.removeDesktopListener(m_scoutDesktopListener);
+ m_scoutDesktopListener = null;
+ }
+ if (m_desktopPropertyListener != null) {
+ desktop.removePropertyChangeListener(m_desktopPropertyListener);
+ m_desktopPropertyListener = null;
+ }
+ }
+
+ protected void applyScoutState() {
+ IDesktop desktop = getScoutDesktop();
+ // load state of internal frames and dialogs
+ for (IForm form : desktop.getViewStack()) {
+ if (form.isAutoAddRemoveOnDesktop()) {
+ showFormPart(form);
+ }
+ }
+ // dialogs
+ IForm[] dialogs = desktop.getDialogStack();
+ for (IForm dialog : dialogs) {
+ // showDialogFromScout(dialogs[i]);
+ showFormPart(dialog);
+ }
+ IMessageBox[] messageBoxes = desktop.getMessageBoxStack();
+ for (IMessageBox messageBoxe : messageBoxes) {
+ showMessageBoxFromScout(messageBoxe);
+ }
+ }
+
+ public IFormField findFocusOwnerField() {
+ Control comp = getDisplay().getFocusControl();
+ while (comp != null) {
+ Object o = comp.getData(IRwtScoutFormField.CLIENT_PROPERTY_SCOUT_OBJECT);
+ if (o instanceof IFormField) {
+ return (IFormField) o;
+ }
+ // next
+ comp = comp.getParent();
+ }
+ return null;
+ }
+
+ @Override
+ public void showFileChooserFromScout(IFileChooser fileChooser) {
+ IRwtScoutFileChooserService rwtScoutFileChooserService = SERVICES.getService(IRwtScoutFileChooserService.class);
+ if (rwtScoutFileChooserService == null) {
+ LOG.warn("Missing bundle: org.eclipse.scout.rt.ui.rap.incubator.filechooser. Please activate it in your Scout perspective under Technologies.");
+ return;
+ }
+ IRwtScoutFileChooser sfc = rwtScoutFileChooserService.createFileChooser(getParentShellIgnoringPopups(SWT.SYSTEM_MODAL | SWT.APPLICATION_MODAL | SWT.MODELESS), fileChooser);
+ sfc.showFileChooser();
+ }
+
+ @Override
+ public void openBrowserWindowFromScout(String path) {
+ BrowserWindowHandler browserWindowHandler = createBrowserWindowHandler();
+ if (browserWindowHandler == null) {
+ return;
+ }
+
+ browserWindowHandler.openLink(path);
+ }
+
+ protected BrowserWindowHandler createBrowserWindowHandler() {
+ return new BrowserWindowHandler();
+ }
+
+ @Override
+ public void showMessageBoxFromScout(IMessageBox messageBox) {
+ //Never show a gui to a already closed messagebox. Otherwise it stays open forever.
+ //Because of the auto close mechanism of the messagebox it is possible that it's already closed (on model side).
+ if (!messageBox.isOpen()) {
+ return;
+ }
+
+ RwtScoutMessageBoxDialog box = new RwtScoutMessageBoxDialog(getParentShellIgnoringPopups(SWT.SYSTEM_MODAL | SWT.APPLICATION_MODAL | SWT.MODELESS), messageBox, this);
+ box.open();
+ }
+
+ @Override
+ public void ensureFormPartVisible(IForm form) {
+ IRwtScoutPart part = getPart(form);
+ if (part != null) {
+ part.activate();
+ }
+ else {
+ showFormPart(form);
+ }
+ }
+
+ protected IRwtScoutPart createUiScoutDialog(IForm form, Shell shell, int dialogStyle) {
+ RwtScoutDialog ui = new RwtScoutDialog();
+ ui.createPart(form, shell, dialogStyle, this);
+ return ui;
+ }
+
+ protected IRwtScoutPart createUiScoutPopupDialog(IForm form, Shell shell, int dialogStyle) {
+ Control owner = getPopupOwner();
+ if (owner == null) {
+ owner = getDisplay().getFocusControl();
+ }
+ if (owner == null) {
+ return null;
+ }
+ Rectangle ownerBounds = getPopupOwnerBounds();
+ if (ownerBounds == null) {
+ ownerBounds = owner.getBounds();
+ Point pDisp = owner.toDisplay(0, 0);
+ ownerBounds.x = pDisp.x;
+ ownerBounds.y = pDisp.y;
+ }
+ RwtScoutDialog dialog = new RwtScoutDialog();
+ dialog.createPart(form, shell, dialogStyle, this);
+ dialog.setUiInitialLocation(new Point(ownerBounds.x, ownerBounds.y + ownerBounds.height));
+ return dialog;
+ }
+
+ protected IRwtScoutPart createUiScoutPopupWindow(IForm f) {
+ Control owner = getPopupOwner();
+ if (owner == null) {
+ owner = getDisplay().getFocusControl();
+ }
+ if (owner == null) {
+ return null;
+ }
+ Rectangle ownerBounds = getPopupOwnerBounds();
+ if (ownerBounds == null) {
+ ownerBounds = owner.getBounds();
+ Point pDisp = owner.toDisplay(0, 0);
+ ownerBounds.x = pDisp.x;
+ ownerBounds.y = pDisp.y;
+ }
+ final RwtScoutPopup popup = new RwtScoutPopup();
+ popup.setMaxHeightHint(280);
+ popup.createPart(f, owner, ownerBounds, SWT.RESIZE, this);
+ popup.addRwtScoutPartListener(new RwtScoutPartListener() {
+ @Override
+ public void partChanged(RwtScoutPartEvent e) {
+ switch (e.getType()) {
+ case RwtScoutPartEvent.TYPE_CLOSED: {
+ popup.closePart();
+ break;
+ }
+ case RwtScoutPartEvent.TYPE_CLOSING: {
+ popup.closePart();
+ break;
+ }
+ }
+ }
+ });
+ //close popup when PARENT shell is activated or closed
+ owner.getShell().addShellListener(new ShellAdapter() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void shellClosed(ShellEvent e) {
+ //auto-detach
+ ((Shell) e.getSource()).removeShellListener(this);
+ popup.closePart();
+ }
+
+ @Override
+ public void shellActivated(ShellEvent e) {
+ //auto-detach
+ ((Shell) e.getSource()).removeShellListener(this);
+ popup.closePart();
+ }
+ });
+ return popup;
+ }
+
+ @Override
+ public Control getPopupOwner() {
+ return m_popupOwner;
+ }
+
+ @Override
+ public Rectangle getPopupOwnerBounds() {
+ return m_popupOwnerBounds != null ? new Rectangle(m_popupOwnerBounds.x, m_popupOwnerBounds.y, m_popupOwnerBounds.width, m_popupOwnerBounds.height) : null;
+ }
+
+ @Override
+ public void setPopupOwner(Control owner, Rectangle ownerBounds) {
+ m_popupOwner = owner;
+ m_popupOwnerBounds = ownerBounds;
+ }
+
+ @Override
+ public void showFormPart(IForm form) {
+ if (form == null) {
+ return;
+ }
+ IRwtScoutPart part = getPart(form);
+ if (part != null) {
+ return;
+ }
+ switch (form.getDisplayHint()) {
+ case IForm.DISPLAY_HINT_DIALOG: {
+ Shell parentShell;
+ if (form.isModal()) {
+ parentShell = getParentShellIgnoringPopups(SWT.SYSTEM_MODAL | SWT.APPLICATION_MODAL | SWT.MODELESS);
+ }
+ else {
+ parentShell = getParentShellIgnoringPopups(0);
+ }
+ int dialogStyle = SWT.DIALOG_TRIM | SWT.RESIZE | (form.isModal() ? SWT.APPLICATION_MODAL : SWT.MODELESS | SWT.MIN);
+ part = createUiScoutDialog(form, parentShell, dialogStyle);
+ break;
+ }
+ case IForm.DISPLAY_HINT_POPUP_DIALOG: {
+ Shell parentShell;
+ if (form.isModal()) {
+ parentShell = getParentShellIgnoringPopups(SWT.SYSTEM_MODAL | SWT.APPLICATION_MODAL | SWT.MODELESS);
+ }
+ else {
+ parentShell = getParentShellIgnoringPopups(0);
+ }
+ int dialogStyle = SWT.DIALOG_TRIM | SWT.RESIZE | (form.isModal() ? SWT.APPLICATION_MODAL : SWT.MODELESS | SWT.MIN);
+ part = createUiScoutPopupDialog(form, parentShell, dialogStyle);
+ if (part == null) {
+ LOG.error("showing popup for " + form + ", but there is neither a focus owner nor the property 'IRwtEnvironment.getPopupOwner()'");
+ }
+ break;
+ }
+ case IForm.DISPLAY_HINT_VIEW: {
+ //nop
+ break;
+ }
+ case IForm.DISPLAY_HINT_POPUP_WINDOW: {
+ part = createUiScoutPopupWindow(form);
+ if (part == null) {
+ LOG.error("showing popup for " + form + ", but there is neither a focus owner nor the property 'IRwtEnvironment.getPopupOwner()'");
+ }
+ break;
+ }
+ }
+ if (part != null) {
+ try {
+ putPart(form, part);
+ part.showPart();
+ }
+ catch (Throwable t) {
+ LOG.error(t.getMessage(), t);
+ }
+ }
+ }
+
+ @Override
+ public void hideFormPart(IForm form) {
+ if (form == null) {
+ return;
+ }
+ IRwtScoutPart part = removePart(form);
+ if (part != null) {
+ part.closePart();
+ }
+ }
+
+ protected void handleDesktopPropertyChanged(String propertyName, Object oldVal, Object newValue) {
+ if (IDesktop.PROP_STATUS.equals(propertyName)) {
+ setStatusFromScout();
+ }
+ }
+
+ @SuppressWarnings("unused")
+ protected void setStatusFromScout() {
+ if (getScoutDesktop() == null) {
+ return;
+ }
+
+ IProcessingStatus newValue = getScoutDesktop().getStatus();
+ //when a tray item is available, use it, otherwise set status on views/dialogs
+ TrayItem trayItem = null;
+// if (getTrayComposite() != null) {//XXXRAP
+// trayItem = getTrayComposite().getSwtTrayItem();
+// }
+ if (trayItem != null) {
+ String s = newValue != null ? newValue.getMessage() : null;
+ if (newValue != null && s != null) {
+ int iconId;
+ switch (newValue.getSeverity()) {
+ case IProcessingStatus.WARNING: {
+ iconId = SWT.ICON_WARNING;
+ break;
+ }
+ case IProcessingStatus.FATAL:
+ case IProcessingStatus.ERROR: {
+ iconId = SWT.ICON_ERROR;
+ break;
+ }
+ case IProcessingStatus.CANCEL: {
+ //Necessary for backward compatibility to Eclipse 3.4 needed for Lotus Notes 8.5.2
+ Version frameworkVersion = new Version(Activator.getDefault().getBundle().getBundleContext().getProperty("osgi.framework.version"));
+ if (frameworkVersion.getMajor() == 3
+ && frameworkVersion.getMinor() <= 4) {
+ iconId = SWT.ICON_INFORMATION;
+ }
+ else {
+ iconId = 1 << 8;//SWT.ICON_CANCEL
+ }
+ break;
+ }
+ default: {
+ iconId = SWT.ICON_INFORMATION;
+ break;
+ }
+ }
+ ToolTip tip = new ToolTip(getParentShellIgnoringPopups(SWT.MODELESS), SWT.BALLOON | iconId);
+ tip.setMessage(s);
+ trayItem.setToolTip(tip);
+ tip.setVisible(true);
+ }
+ else {
+ ToolTip tip = new ToolTip(getParentShellIgnoringPopups(SWT.MODELESS), SWT.NONE);
+ trayItem.setToolTip(tip);
+ tip.setVisible(true);
+ }
+ }
+ else {
+ String message = null;
+ if (newValue != null) {
+ message = newValue.getMessage();
+ }
+ setStatusLineMessage(null, message);
+ }
+ }
+
+ public void setStatusLineMessage(Image image, String message) {
+ for (IRwtScoutPart part : m_openForms.values()) {
+ if (part.setStatusLineMessage(image, message)) {
+ return;
+ }
+ }
+ }
+
+ private class P_ScoutDesktopPropertyListener implements PropertyChangeListener {
+ @Override
+ public void propertyChange(final PropertyChangeEvent evt) {
+ if (!getDisplay().isDisposed()) {
+ Runnable job = new Runnable() {
+ @Override
+ public void run() {
+ handleDesktopPropertyChanged(evt.getPropertyName(), evt.getOldValue(), evt.getNewValue());
+ }
+ };
+ invokeUiLater(job);
+ }
+ }
+ } // end class P_ScoutDesktopPropertyListener
+
+ private class P_ScoutDesktopListener implements DesktopListener {
+ @Override
+ public void desktopChanged(final DesktopEvent e) {
+ if (getDisplay().isDisposed()) {
+ return;
+ }
+ switch (e.getType()) {
+ case DesktopEvent.TYPE_FORM_ADDED: {
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ showFormPart(e.getForm());
+ getDisplay().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ UICallBack.deactivate(AbstractRwtEnvironment.class.getName() + AbstractRwtEnvironment.this.hashCode());
+ }
+ });
+ }
+ };
+ invokeUiLater(t);
+ break;
+ }
+ case DesktopEvent.TYPE_FORM_REMOVED: {
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ hideFormPart(e.getForm());
+ }
+ };
+ invokeUiLater(t);
+ break;
+ }
+ case DesktopEvent.TYPE_FORM_ENSURE_VISIBLE: {
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ ensureFormPartVisible(e.getForm());
+ getDisplay().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ UICallBack.deactivate(AbstractRwtEnvironment.class.getName() + AbstractRwtEnvironment.this.hashCode());
+ }
+ });
+ }
+ };
+ invokeUiLater(t);
+ break;
+ }
+ case DesktopEvent.TYPE_MESSAGE_BOX_ADDED: {
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ showMessageBoxFromScout(e.getMessageBox());
+ }
+ };
+ invokeUiLater(t);
+ break;
+ }
+ case DesktopEvent.TYPE_FILE_CHOOSER_ADDED: {
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ showFileChooserFromScout(e.getFileChooser());
+ }
+ };
+ invokeUiLater(t);
+ break;
+ }
+ case DesktopEvent.TYPE_OPEN_BROWSER_WINDOW: {
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ openBrowserWindowFromScout(e.getPath());
+ }
+ };
+ invokeUiLater(t);
+ break;
+ }
+ case DesktopEvent.TYPE_DESKTOP_CLOSED: {
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ try {
+ stopScout();
+ }
+ catch (CoreException ex) {
+ LOG.error("desktop closed", ex);
+ }
+ getDisplay().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ logout();
+ }
+ });
+ }
+ };
+ invokeUiLater(t);
+ break;
+ }
+ case DesktopEvent.TYPE_PRINT: {
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ handleScoutPrintInRwt(e);
+ }
+ };
+ invokeUiLater(t);
+ break;
+ }
+ case DesktopEvent.TYPE_FIND_FOCUS_OWNER: {
+ final Object lock = new Object();
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ try {
+ IFormField f = findFocusOwnerField();
+ if (f != null) {
+ e.setFocusedField(f);
+ }
+ }
+ finally {
+ synchronized (lock) {
+ lock.notifyAll();
+ }
+ }
+ }
+ };
+ synchronized (lock) {
+ invokeUiLater(t);
+ try {
+ lock.wait(2000L);
+ }
+ catch (InterruptedException e1) {
+ //nop
+ }
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ @Override
+ public void postImmediateUiJob(Runnable r) {
+ synchronized (m_immediateUiJobsLock) {
+ m_immediateUiJobs.add(r);
+ }
+ }
+
+ @Override
+ public void dispatchImmediateUiJobs() {
+ List<Runnable> list;
+ synchronized (m_immediateUiJobsLock) {
+ list = new ArrayList<Runnable>(m_immediateUiJobs);
+ m_immediateUiJobs.clear();
+ }
+ for (Runnable r : list) {
+ try {
+ r.run();
+ }
+ catch (Throwable t) {
+ LOG.warn("running " + r, t);
+ }
+ }
+ }
+
+ @Override
+ public JobEx invokeScoutLater(Runnable job, long cancelTimeout) {
+ synchronized (m_immediateUiJobsLock) {
+ m_immediateUiJobs.clear();
+ }
+ if (m_synchronizer != null) {
+ return m_synchronizer.invokeScoutLater(job, cancelTimeout);
+ }
+ else {
+ LOG.warn("synchronizer is null; session is closed");
+ return null;
+ }
+ }
+
+ @Override
+ public void invokeUiLater(Runnable job) {
+ if (m_synchronizer != null) {
+ m_synchronizer.invokeUiLater(job);
+ }
+ else {
+ LOG.warn("synchronizer is null; session is closed");
+ }
+ }
+
+ @Override
+ public IClientSession getClientSession() {
+ return m_clientSession;
+ }
+
+ @Override
+ public LayoutValidateManager getLayoutValidateManager() {
+ return m_layoutValidateManager;
+ }
+
+ // GUI FACTORY
+ protected RwtIconLocator createIconLocator() {
+ return new RwtIconLocator(getClientSession().getIconLocator());
+ }
+
+ protected ScoutFormToolkit createScoutFormToolkit(Display display) {
+ return new ScoutFormToolkit(new FormToolkit(display) {
+ @Override
+ public Form createForm(Composite parent) {
+ Form f = super.createForm(parent);
+ decorateFormHeading(f);
+ return f;
+ }
+ });
+ }
+
+ @Override
+ public IRwtScoutForm createForm(Composite parent, IForm scoutForm) {
+ RwtScoutForm uiForm = new RwtScoutForm();
+ uiForm.createUiField(parent, scoutForm, this);
+ return uiForm;
+ }
+
+ /**
+ * As default there is no form header created. <br/>
+ * Subclasses can override this method to create one.
+ */
+ @Override
+ public IRwtScoutFormHeader createFormHeader(Composite parent, IForm scoutForm) {
+ return null;
+ }
+
+ /**
+ * As default there is no form footer created. <br/>
+ * Subclasses can override this method to create one.
+ */
+ @Override
+ public IRwtScoutFormFooter createFormFooter(Composite parent, IForm scoutForm) {
+ return null;
+ }
+
+ @Override
+ public IRwtScoutFormField createFormField(Composite parent, IFormField model) {
+ if (m_formFieldFactory == null) {
+ m_formFieldFactory = new FormFieldFactory(getApplicationBundle());
+ }
+ IRwtScoutFormField<IFormField> uiField = m_formFieldFactory.createUiFormField(parent, model, this);
+ return uiField;
+ }
+
+ @Override
+ public void checkThread() {
+ if (!(getDisplay().getThread() == Thread.currentThread())) {
+ throw new IllegalStateException("Must be called in rwt thread");
+ }
+ }
+
+ protected void handleScoutPrintInRwt(DesktopEvent e) {
+ WidgetPrinter wp = new WidgetPrinter(getParentShellIgnoringPopups(SWT.SYSTEM_MODAL | SWT.APPLICATION_MODAL | SWT.MODELESS));
+ try {
+ wp.print(e.getPrintDevice(), e.getPrintParameters());
+ }
+ catch (Throwable ex) {
+ LOG.error(null, ex);
+ }
+ }
+
+ protected String getDesktopOpenedTaskText() {
+ return RwtUtility.getNlsText(Display.getCurrent(), "ScoutStarting");
+ }
+
+ protected String getDesktopClosedTaskText() {
+ return RwtUtility.getNlsText(Display.getCurrent(), "ScoutStoping");
+ }
+
+ protected boolean isStartDesktopCalled() {
+ return m_startDesktopCalled;
+ }
+
+ protected void setStartDesktopCalled(boolean startDesktopCalled) {
+ m_startDesktopCalled = startDesktopCalled;
+ }
+
+ protected boolean isActivateDesktopCalled() {
+ return m_activateDesktopCalled;
+ }
+
+ protected void setActivateDesktopCalled(boolean activateDesktopCalled) {
+ m_activateDesktopCalled = activateDesktopCalled;
+ }
+
+ private class P_LocaleListener implements ILocaleListener {
+ @Override
+ public void localeChanged(LocaleChangeEvent event) {
+ final Locale locale = event.getLocale();
+ invokeUiLater(new Runnable() {
+ @Override
+ public void run() {
+ if (!hasSameLocale(RWT.getLocale(), locale)) {
+ setLocale(locale);
+ }
+ }
+ });
+ }
+
+ private void setLocale(Locale locale) {
+ RWT.setLocale(locale);
+ }
+
+ private boolean hasSameLocale(Locale locale1, Locale locale2) {
+ boolean result = false;
+ if (locale1 != null && locale2 != null) {
+ result = locale1.equals(locale2);
+ }
+ return result;
+ }
+ }
+
+ private static final class P_SessionStoreListener implements SessionStoreListener {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void beforeDestroy(SessionStoreEvent event) {
+ ISessionStore sessionStore = event.getSessionStore();
+ IClientSession clientSession = (IClientSession) sessionStore.getAttribute(IClientSession.class.getName());
+ if (clientSession != null) {
+ if (LOG.isInfoEnabled()) {
+ UserAgent userAgent = clientSession.getUserAgent();
+ String msg = "Thread: {0} Session goes down...; UserAgent: {2}";
+ LOG.info(msg, new Object[]{Long.valueOf(Thread.currentThread().getId()), userAgent});
+ }
+
+ new ClientAsyncJob("HTTP session inactivator", clientSession) {
+ @Override
+ protected void runVoid(IProgressMonitor monitor) throws Throwable {
+ getClientSession().stopSession();
+ }
+ }.runNow(new NullProgressMonitor());
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/AbstractStandaloneRwtEnvironment.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/AbstractStandaloneRwtEnvironment.java
index a66d2edc90..ad3fd0b3e0 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/AbstractStandaloneRwtEnvironment.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/AbstractStandaloneRwtEnvironment.java
@@ -1,301 +1,301 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap;
-
-import java.lang.reflect.Field;
-import java.security.AccessController;
-import java.util.TreeMap;
-
-import javax.security.auth.Subject;
-
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.rwt.RWT;
-import org.eclipse.rwt.lifecycle.UICallBack;
-import org.eclipse.rwt.service.SettingStoreException;
-import org.eclipse.scout.commons.CompositeLong;
-import org.eclipse.scout.commons.LocaleThreadLocal;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
-import org.eclipse.scout.rt.ui.rap.window.IRwtScoutPart;
-import org.eclipse.scout.rt.ui.rap.window.desktop.RwtScoutDesktop;
-import org.eclipse.scout.rt.ui.rap.window.desktop.nonmodalFormBar.RwtScoutFormButtonBar;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PlatformUI;
-import org.osgi.framework.Bundle;
-
-public abstract class AbstractStandaloneRwtEnvironment extends AbstractRwtEnvironment implements IRwtStandaloneEnvironment {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractStandaloneRwtEnvironment.class);
-
- private Display m_display;
- private Shell m_rootShell;
- private RwtScoutDesktop m_uiDesktop;
- private RwtScoutFormButtonBar m_uiButtonArea;
-
- public AbstractStandaloneRwtEnvironment(Bundle applicationBundle, Class<? extends IClientSession> clientSessionClazz) {
- super(applicationBundle, clientSessionClazz);
- }
-
- @Override
- public int createUI() {
- if (getSubject() == null) {
- Subject subject = Subject.getSubject(AccessController.getContext());
- if (subject == null) {
- throw new SecurityException("/rap request is not authenticated with a Subject");
- }
- setSubject(subject);
- }
- if (RwtUtility.getBrowserInfo().isDesktop()) {
- //Necessary for client notifications. Disabled on mobile devices to avoid having a constant circle of doom.
- //TODO: Make it dependent on client notification enabled state. Should actually also be enabled for mobile devices so that client notifications works.
- UICallBack.activate(getClass().getName() + getClass().hashCode());
- }
- m_display = Display.getDefault();
- if (m_display == null) {
- m_display = new Display();
- }
- m_display.setData(IRwtEnvironment.class.getName(), this);
-
- //XXX Workaround for rwt npe
- try {
- final Object wb = PlatformUI.getWorkbench();
- final Field f = wb.getClass().getDeclaredField("display");
- f.setAccessible(true);
- f.set(wb, m_display);
- m_display.addListener(SWT.Dispose, new Listener() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void handleEvent(Event event) {
- try {
- // WORKAROUND for memory leaks
- // workbench should be closed instead, but NPEs are thrown
- f.set(wb, null);
- }
- catch (Throwable t1) {
- // nop
- }
- }
- });
- }
- catch (Throwable t) {
- //nop
- }
- //XXX end Workaround for rwt npe
-
- try {
- RWT.getSettingStore().setAttribute("SessionID", RWT.getRequest().getSession().getId());
- }
- catch (SettingStoreException e) {
- //nop
- }
-
- Shell shell = new Shell(m_display, SWT.NO_TRIM);
- m_rootShell = shell;
- createApplicationContent(shell);
- createNonmodalFormButtonArea(shell);
- //layout
- GridLayout shellLayout = new GridLayout(1, true);
- shellLayout.horizontalSpacing = 0;
- shellLayout.marginHeight = 0;
- shellLayout.marginWidth = 0;
- shellLayout.verticalSpacing = 0;
- shell.setLayout(shellLayout);
- GridData desktopLayoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
- m_uiDesktop.getUiContainer().setLayoutData(desktopLayoutData);
-
- GridData nonmodalFormsLayoutData = new GridData(SWT.FILL, SWT.FILL, true, false);
- nonmodalFormsLayoutData.exclude = true;
- m_uiButtonArea.getUiContainer().setLayoutData(nonmodalFormsLayoutData);
-
- shell.setMaximized(true);
- shell.open();
- shell.layout(true, true);
- shell.addDisposeListener(new DisposeListener() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void widgetDisposed(DisposeEvent event) {
- String sessionID = RWT.getSettingStore().getAttribute("SessionID");
- if (StringUtility.isNullOrEmpty(sessionID) || !sessionID.equals(RWT.getRequest().getSession().getId())) {
- Runnable t = new Runnable() {
- @Override
- public void run() {
- getScoutDesktop().getUIFacade().fireGuiDetached();
- getScoutDesktop().getUIFacade().fireDesktopClosingFromUI();
- }
- };
- invokeScoutLater(t, 0);
- }
- }
- });
-
- while (!shell.isDisposed()) {
- if (getClientSession() != null) {
- LocaleThreadLocal.set(getClientSession().getLocale());
- }
- if (!m_display.readAndDispatch()) {
- m_display.sleep();
- }
- }
- m_display.dispose();
- m_rootShell = null;
- return 0;
- }
-
- protected void createApplicationContent(Composite parent) {
- m_uiDesktop = createUiDesktop();
- ensureInitialized();
- if (!isInitialized()) {
- throw new SecurityException("Cannot initialize application");
- }
- getKeyStrokeManager().setGlobalKeyStrokesActivated(true);
- m_uiDesktop.createUiField(parent, getScoutDesktop(), this);
- }
-
- protected void createNonmodalFormButtonArea(Composite parent) {
- m_uiButtonArea = new RwtScoutFormButtonBar();
- m_uiButtonArea.createUiField(parent, m_uiDesktop.getScoutObject(), this);
- }
-
- protected RwtScoutDesktop createUiDesktop() {
- return new RwtScoutDesktop();
- }
-
- @Override
- public RwtScoutDesktop getUiDesktop() {
- return m_uiDesktop;
- }
-
- @Override
- public Display getDisplay() {
- Display current = null;
- try {
- current = Display.getCurrent();
- }
- catch (Exception e) {
- // NOP
- }
- if (current != null && m_display != current) {
- ScoutLogManager.getLogger(AbstractStandaloneRwtEnvironment.class).error(
- "Different Display.\n" +
- "m_display: {0}\n" +
- "cur_displ: {1}",
- new Object[]{m_display, current});
- }
- Display defdisp = null;
- try {
- defdisp = Display.getDefault();
- }
- catch (Exception e) {
- // NOP
- }
- if (defdisp != null && m_display != defdisp) {
- ScoutLogManager.getLogger(AbstractStandaloneRwtEnvironment.class).error(
- "Different Display.\n" +
- "m_display: {0}\n" +
- "defdisp : {1}",
- new Object[]{m_display, defdisp});
- }
- return m_display;
- }
-
- @Override
- public void showFormPart(IForm form) {
- if (form == null) {
- return;
- }
- if (form.getDisplayHint() == IForm.DISPLAY_HINT_VIEW) {
- IRwtScoutPart part = m_uiDesktop.addForm(form);
- if (part != null) {
- putPart(form, part);
- part.showPart();
- }
- else {
- LOG.error("Form '" + form.getFormId() + "' cannot be displayed because no corresponding UI part could be found.");
- }
- }
- super.showFormPart(form);
-
- if (form.getDisplayHint() == IForm.DISPLAY_HINT_DIALOG && !form.isModal()) {
- int buttonCount = m_uiButtonArea.getFormButtonBarCount();
-
- m_uiButtonArea.addFormButton(form);
- if (buttonCount != m_uiButtonArea.getFormButtonBarCount()) {
- m_uiButtonArea.getUiContainer().setVisible(true);
- ((GridData) m_uiButtonArea.getUiContainer().getLayoutData()).exclude = false;
- m_uiButtonArea.getUiContainer().getParent().layout(true, true);
- }
- }
- }
-
- @Override
- public void hideFormPart(IForm form) {
- super.hideFormPart(form);
-
- if (form.getDisplayHint() == IForm.DISPLAY_HINT_DIALOG && !form.isModal()) {
- m_uiButtonArea.removeFormButton(form);
- if (m_uiButtonArea.getFormButtonBarCount() == 0) {
- m_uiButtonArea.getUiContainer().setVisible(false);
- ((GridData) m_uiButtonArea.getUiContainer().getLayoutData()).exclude = true;
- m_uiButtonArea.getUiContainer().getParent().layout(true, true);
- }
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Shell getParentShellIgnoringPopups(int modalities) {
- Shell shell = Display.getCurrent().getActiveShell();
- if (shell != null) {
- while (RwtUtility.isPopupShell(shell) && shell.getParent() instanceof Shell) {
- shell = (Shell) shell.getParent();
- }
- }
- // traverse available shells
- if (shell == null) {
- TreeMap<CompositeLong, Shell> map = new TreeMap<CompositeLong, Shell>();
- for (Shell s : Display.getCurrent().getShells()) {
- RwtUtility.visitShellTreeRec(s, modalities, 0, map);
- }
- if (map.size() > 0) {
- shell = map.get(map.firstKey());
- }
- }
-
- if (shell != null && shell.getData() instanceof ProgressMonitorDialog) {
- // do also ignore the ProgressMonitorDialog, otherwise there will be some strange behaviors
- // when displaying a shell on top of the ProgressMonitorDialog-shell (f.e. when the
- // ProgressMonitorDialog-shell disappears)
- shell = (Shell) shell.getParent();
- }
-
- if (shell == null) {
- shell = m_rootShell;
- }
-
- return shell;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap;
+
+import java.lang.reflect.Field;
+import java.security.AccessController;
+import java.util.TreeMap;
+
+import javax.security.auth.Subject;
+
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.rwt.RWT;
+import org.eclipse.rwt.lifecycle.UICallBack;
+import org.eclipse.rwt.service.SettingStoreException;
+import org.eclipse.scout.commons.CompositeLong;
+import org.eclipse.scout.commons.LocaleThreadLocal;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
+import org.eclipse.scout.rt.ui.rap.window.IRwtScoutPart;
+import org.eclipse.scout.rt.ui.rap.window.desktop.RwtScoutDesktop;
+import org.eclipse.scout.rt.ui.rap.window.desktop.nonmodalFormBar.RwtScoutFormButtonBar;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+import org.osgi.framework.Bundle;
+
+public abstract class AbstractStandaloneRwtEnvironment extends AbstractRwtEnvironment implements IRwtStandaloneEnvironment {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractStandaloneRwtEnvironment.class);
+
+ private Display m_display;
+ private Shell m_rootShell;
+ private RwtScoutDesktop m_uiDesktop;
+ private RwtScoutFormButtonBar m_uiButtonArea;
+
+ public AbstractStandaloneRwtEnvironment(Bundle applicationBundle, Class<? extends IClientSession> clientSessionClazz) {
+ super(applicationBundle, clientSessionClazz);
+ }
+
+ @Override
+ public int createUI() {
+ if (getSubject() == null) {
+ Subject subject = Subject.getSubject(AccessController.getContext());
+ if (subject == null) {
+ throw new SecurityException("/rap request is not authenticated with a Subject");
+ }
+ setSubject(subject);
+ }
+ if (RwtUtility.getBrowserInfo().isDesktop()) {
+ //Necessary for client notifications. Disabled on mobile devices to avoid having a constant circle of doom.
+ //TODO: Make it dependent on client notification enabled state. Should actually also be enabled for mobile devices so that client notifications works.
+ UICallBack.activate(getClass().getName() + getClass().hashCode());
+ }
+ m_display = Display.getDefault();
+ if (m_display == null) {
+ m_display = new Display();
+ }
+ m_display.setData(IRwtEnvironment.class.getName(), this);
+
+ //XXX Workaround for rwt npe
+ try {
+ final Object wb = PlatformUI.getWorkbench();
+ final Field f = wb.getClass().getDeclaredField("display");
+ f.setAccessible(true);
+ f.set(wb, m_display);
+ m_display.addListener(SWT.Dispose, new Listener() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void handleEvent(Event event) {
+ try {
+ // WORKAROUND for memory leaks
+ // workbench should be closed instead, but NPEs are thrown
+ f.set(wb, null);
+ }
+ catch (Throwable t1) {
+ // nop
+ }
+ }
+ });
+ }
+ catch (Throwable t) {
+ //nop
+ }
+ //XXX end Workaround for rwt npe
+
+ try {
+ RWT.getSettingStore().setAttribute("SessionID", RWT.getRequest().getSession().getId());
+ }
+ catch (SettingStoreException e) {
+ //nop
+ }
+
+ Shell shell = new Shell(m_display, SWT.NO_TRIM);
+ m_rootShell = shell;
+ createApplicationContent(shell);
+ createNonmodalFormButtonArea(shell);
+ //layout
+ GridLayout shellLayout = new GridLayout(1, true);
+ shellLayout.horizontalSpacing = 0;
+ shellLayout.marginHeight = 0;
+ shellLayout.marginWidth = 0;
+ shellLayout.verticalSpacing = 0;
+ shell.setLayout(shellLayout);
+ GridData desktopLayoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
+ m_uiDesktop.getUiContainer().setLayoutData(desktopLayoutData);
+
+ GridData nonmodalFormsLayoutData = new GridData(SWT.FILL, SWT.FILL, true, false);
+ nonmodalFormsLayoutData.exclude = true;
+ m_uiButtonArea.getUiContainer().setLayoutData(nonmodalFormsLayoutData);
+
+ shell.setMaximized(true);
+ shell.open();
+ shell.layout(true, true);
+ shell.addDisposeListener(new DisposeListener() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void widgetDisposed(DisposeEvent event) {
+ String sessionID = RWT.getSettingStore().getAttribute("SessionID");
+ if (StringUtility.isNullOrEmpty(sessionID) || !sessionID.equals(RWT.getRequest().getSession().getId())) {
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ getScoutDesktop().getUIFacade().fireGuiDetached();
+ getScoutDesktop().getUIFacade().fireDesktopClosingFromUI();
+ }
+ };
+ invokeScoutLater(t, 0);
+ }
+ }
+ });
+
+ while (!shell.isDisposed()) {
+ if (getClientSession() != null) {
+ LocaleThreadLocal.set(getClientSession().getLocale());
+ }
+ if (!m_display.readAndDispatch()) {
+ m_display.sleep();
+ }
+ }
+ m_display.dispose();
+ m_rootShell = null;
+ return 0;
+ }
+
+ protected void createApplicationContent(Composite parent) {
+ m_uiDesktop = createUiDesktop();
+ ensureInitialized();
+ if (!isInitialized()) {
+ throw new SecurityException("Cannot initialize application");
+ }
+ getKeyStrokeManager().setGlobalKeyStrokesActivated(true);
+ m_uiDesktop.createUiField(parent, getScoutDesktop(), this);
+ }
+
+ protected void createNonmodalFormButtonArea(Composite parent) {
+ m_uiButtonArea = new RwtScoutFormButtonBar();
+ m_uiButtonArea.createUiField(parent, m_uiDesktop.getScoutObject(), this);
+ }
+
+ protected RwtScoutDesktop createUiDesktop() {
+ return new RwtScoutDesktop();
+ }
+
+ @Override
+ public RwtScoutDesktop getUiDesktop() {
+ return m_uiDesktop;
+ }
+
+ @Override
+ public Display getDisplay() {
+ Display current = null;
+ try {
+ current = Display.getCurrent();
+ }
+ catch (Exception e) {
+ // NOP
+ }
+ if (current != null && m_display != current) {
+ ScoutLogManager.getLogger(AbstractStandaloneRwtEnvironment.class).error(
+ "Different Display.\n" +
+ "m_display: {0}\n" +
+ "cur_displ: {1}",
+ new Object[]{m_display, current});
+ }
+ Display defdisp = null;
+ try {
+ defdisp = Display.getDefault();
+ }
+ catch (Exception e) {
+ // NOP
+ }
+ if (defdisp != null && m_display != defdisp) {
+ ScoutLogManager.getLogger(AbstractStandaloneRwtEnvironment.class).error(
+ "Different Display.\n" +
+ "m_display: {0}\n" +
+ "defdisp : {1}",
+ new Object[]{m_display, defdisp});
+ }
+ return m_display;
+ }
+
+ @Override
+ public void showFormPart(IForm form) {
+ if (form == null) {
+ return;
+ }
+ if (form.getDisplayHint() == IForm.DISPLAY_HINT_VIEW) {
+ IRwtScoutPart part = m_uiDesktop.addForm(form);
+ if (part != null) {
+ putPart(form, part);
+ part.showPart();
+ }
+ else {
+ LOG.error("Form '" + form.getFormId() + "' cannot be displayed because no corresponding UI part could be found.");
+ }
+ }
+ super.showFormPart(form);
+
+ if (form.getDisplayHint() == IForm.DISPLAY_HINT_DIALOG && !form.isModal()) {
+ int buttonCount = m_uiButtonArea.getFormButtonBarCount();
+
+ m_uiButtonArea.addFormButton(form);
+ if (buttonCount != m_uiButtonArea.getFormButtonBarCount()) {
+ m_uiButtonArea.getUiContainer().setVisible(true);
+ ((GridData) m_uiButtonArea.getUiContainer().getLayoutData()).exclude = false;
+ m_uiButtonArea.getUiContainer().getParent().layout(true, true);
+ }
+ }
+ }
+
+ @Override
+ public void hideFormPart(IForm form) {
+ super.hideFormPart(form);
+
+ if (form.getDisplayHint() == IForm.DISPLAY_HINT_DIALOG && !form.isModal()) {
+ m_uiButtonArea.removeFormButton(form);
+ if (m_uiButtonArea.getFormButtonBarCount() == 0) {
+ m_uiButtonArea.getUiContainer().setVisible(false);
+ ((GridData) m_uiButtonArea.getUiContainer().getLayoutData()).exclude = true;
+ m_uiButtonArea.getUiContainer().getParent().layout(true, true);
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Shell getParentShellIgnoringPopups(int modalities) {
+ Shell shell = Display.getCurrent().getActiveShell();
+ if (shell != null) {
+ while (RwtUtility.isPopupShell(shell) && shell.getParent() instanceof Shell) {
+ shell = (Shell) shell.getParent();
+ }
+ }
+ // traverse available shells
+ if (shell == null) {
+ TreeMap<CompositeLong, Shell> map = new TreeMap<CompositeLong, Shell>();
+ for (Shell s : Display.getCurrent().getShells()) {
+ RwtUtility.visitShellTreeRec(s, modalities, 0, map);
+ }
+ if (map.size() > 0) {
+ shell = map.get(map.firstKey());
+ }
+ }
+
+ if (shell != null && shell.getData() instanceof ProgressMonitorDialog) {
+ // do also ignore the ProgressMonitorDialog, otherwise there will be some strange behaviors
+ // when displaying a shell on top of the ProgressMonitorDialog-shell (f.e. when the
+ // ProgressMonitorDialog-shell disappears)
+ shell = (Shell) shell.getParent();
+ }
+
+ if (shell == null) {
+ shell = m_rootShell;
+ }
+
+ return shell;
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/Activator.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/Activator.java
index 590362b9f6..ef9c78d852 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/Activator.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/Activator.java
@@ -1,71 +1,71 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap;
-
-import java.util.Hashtable;
-
-import org.eclipse.scout.rt.shared.WebClientState;
-import org.eclipse.scout.rt.ui.rap.login.internal.InternalNetAuthenticator;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-import org.osgi.framework.ServiceRegistration;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends AbstractUIPlugin {
-
- public static final String PLUGIN_ID = "org.eclipse.scout.rt.ui.rap";
-
- private static final String CLIENT_LOG_LEVEL = "org.eclipse.rwt.clientLogLevel";
- private static final String ALL_CLIENT_LOG_LEVEL = "ALL";
-
- private static final String CLIENT_LIBRARY_VARIANT = "org.eclipse.rwt.clientLibraryVariant";
- private static final String DEBUG_CLIENT_LIBRARY_VARIANT = "DEBUG";
-
- private static Activator m_plugin;
-
- private ServiceRegistration m_netAuthRegistration;
-
- public Activator() {
- System.setProperty(CLIENT_LOG_LEVEL, ALL_CLIENT_LOG_LEVEL);
- //[imo] js patching mode. Rebuild client.js before removing these lines of code!! - SLE client.js is patched
-// System.out.println("Debug does not use compiled client.js; Setting " + CLIENT_LIBRARY_VARIANT + "=" + DEBUG_CLIENT_LIBRARY_VARIANT);
-// System.setProperty(CLIENT_LIBRARY_VARIANT, DEBUG_CLIENT_LIBRARY_VARIANT);
- }
-
- public static Activator getDefault() {
- return m_plugin;
- }
-
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- m_plugin = this;
- // register net authenticator ui
- Hashtable<String, Object> map = new Hashtable<String, Object>();
- map.put(Constants.SERVICE_RANKING, -1);
- m_netAuthRegistration = Activator.getDefault().getBundle().getBundleContext().registerService(java.net.Authenticator.class.getName(), new InternalNetAuthenticator(), map);
- // set default webclient state
- WebClientState.setWebClientDefault(true);
- }
-
- @Override
- public void stop(BundleContext context) throws Exception {
- if (m_netAuthRegistration != null) {
- m_netAuthRegistration.unregister();
- m_netAuthRegistration = null;
- }
- m_plugin = null;
- super.stop(context);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap;
+
+import java.util.Hashtable;
+
+import org.eclipse.scout.rt.shared.WebClientState;
+import org.eclipse.scout.rt.ui.rap.login.internal.InternalNetAuthenticator;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceRegistration;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ public static final String PLUGIN_ID = "org.eclipse.scout.rt.ui.rap";
+
+ private static final String CLIENT_LOG_LEVEL = "org.eclipse.rwt.clientLogLevel";
+ private static final String ALL_CLIENT_LOG_LEVEL = "ALL";
+
+ private static final String CLIENT_LIBRARY_VARIANT = "org.eclipse.rwt.clientLibraryVariant";
+ private static final String DEBUG_CLIENT_LIBRARY_VARIANT = "DEBUG";
+
+ private static Activator m_plugin;
+
+ private ServiceRegistration m_netAuthRegistration;
+
+ public Activator() {
+ System.setProperty(CLIENT_LOG_LEVEL, ALL_CLIENT_LOG_LEVEL);
+ //[imo] js patching mode. Rebuild client.js before removing these lines of code!! - SLE client.js is patched
+// System.out.println("Debug does not use compiled client.js; Setting " + CLIENT_LIBRARY_VARIANT + "=" + DEBUG_CLIENT_LIBRARY_VARIANT);
+// System.setProperty(CLIENT_LIBRARY_VARIANT, DEBUG_CLIENT_LIBRARY_VARIANT);
+ }
+
+ public static Activator getDefault() {
+ return m_plugin;
+ }
+
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ m_plugin = this;
+ // register net authenticator ui
+ Hashtable<String, Object> map = new Hashtable<String, Object>();
+ map.put(Constants.SERVICE_RANKING, -1);
+ m_netAuthRegistration = Activator.getDefault().getBundle().getBundleContext().registerService(java.net.Authenticator.class.getName(), new InternalNetAuthenticator(), map);
+ // set default webclient state
+ WebClientState.setWebClientDefault(true);
+ }
+
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ if (m_netAuthRegistration != null) {
+ m_netAuthRegistration.unregister();
+ m_netAuthRegistration = null;
+ }
+ m_plugin = null;
+ super.stop(context);
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/DefaultValidateRoot.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/DefaultValidateRoot.java
index abd7a0d8d1..e3bfbc6479 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/DefaultValidateRoot.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/DefaultValidateRoot.java
@@ -1,34 +1,34 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap;
-
-import org.eclipse.swt.widgets.Composite;
-
-public class DefaultValidateRoot implements IValidateRoot {
- private final Composite m_root;
-
- public DefaultValidateRoot(Composite root) {
- m_root = root;
- }
-
- @Override
- public void validate() {
- if (m_root != null && !m_root.isDisposed()) {
- m_root.layout(true, true);
- }
- }
-
- @Override
- public Composite getUiComposite() {
- return m_root;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap;
+
+import org.eclipse.swt.widgets.Composite;
+
+public class DefaultValidateRoot implements IValidateRoot {
+ private final Composite m_root;
+
+ public DefaultValidateRoot(Composite root) {
+ m_root = root;
+ }
+
+ @Override
+ public void validate() {
+ if (m_root != null && !m_root.isDisposed()) {
+ m_root.layout(true, true);
+ }
+ }
+
+ @Override
+ public Composite getUiComposite() {
+ return m_root;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/FormFieldFactory.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/FormFieldFactory.java
index cdc14dcae9..ae54a6d0f4 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/FormFieldFactory.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/FormFieldFactory.java
@@ -1,224 +1,224 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap;
-
-import java.util.LinkedHashMap;
-import java.util.Map.Entry;
-import java.util.TreeMap;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.scout.commons.CompositeObject;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.ui.rap.extension.FormFieldsExtensionPoint;
-import org.eclipse.scout.rt.ui.rap.extension.IFormFieldExtension;
-import org.eclipse.scout.rt.ui.rap.extension.IFormFieldFactory;
-import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
-import org.eclipse.swt.widgets.Composite;
-import org.osgi.framework.Bundle;
-
-public class FormFieldFactory implements IFormFieldFactory {
- private static IScoutLogger LOG = ScoutLogManager.getLogger(FormFieldFactory.class);
-
- private LinkedHashMap<Class<?>, IFormFieldFactory> m_fields;
-
- /**
- * @param bundle
- * the ui.swt bundle of the requesting application (e.g.
- * com.bsiag.crm.ui.swt)
- */
- @SuppressWarnings("unchecked")
- public FormFieldFactory(Bundle requesterBundle) {
- TreeMap<CompositeObject, P_FormFieldExtension> sortedMap = new TreeMap<CompositeObject, P_FormFieldExtension>();
- for (IFormFieldExtension extension : FormFieldsExtensionPoint.getFormFieldExtensions()) {
- if (extension.isActive()) {
- Bundle loaderBundle;
- if (extension.getScope() == IFormFieldExtension.SCOPE_LOCAL) {
- loaderBundle = requesterBundle;
- }
- else {
- loaderBundle = Platform.getBundle(extension.getContibuterBundleId());
- }
- if (loaderBundle != null) {
- Class<?> modelClazz;
- Class<? extends IRwtScoutFormField> uiClazz = null;
- Class<? extends IFormFieldFactory> factoryClazz = null;
- try {
- modelClazz = loaderBundle.loadClass(extension.getModelClassName());
- if (!StringUtility.isNullOrEmpty(extension.getUiClassName())) {
- uiClazz = (Class<? extends IRwtScoutFormField>) loaderBundle.loadClass(extension.getUiClassName());
- if (!IRwtScoutFormField.class.isAssignableFrom(uiClazz)) {
- LOG.warn("extension '" + extension.getName() + "' contributed by '" + extension.getContibuterBundleId() + "' has an ui class not instanceof " + IRwtScoutFormField.class.getName() + ".");
- uiClazz = null;
- }
- }
- else if (!StringUtility.isNullOrEmpty(extension.getFactoryClassName())) {
- factoryClazz = (Class<? extends IFormFieldFactory>) loaderBundle.loadClass(extension.getFactoryClassName());
- if (!IFormFieldFactory.class.isAssignableFrom(factoryClazz)) {
- LOG.warn("extension '" + extension.getName() + "' contributed by '" + extension.getContibuterBundleId() + "' has a facotry class not instanceof " + IFormFieldFactory.class.getName() + ".");
- factoryClazz = null;
- }
- }
- IFormFieldFactory factory = null;
- if (uiClazz != null) {
- factory = new P_DirectLinkFormFieldFactory(uiClazz);
- }
- else if (factoryClazz != null) {
- try {
- factory = factoryClazz.newInstance();
- }
- catch (Exception e) {
- LOG.warn("could not create a factory instance of '" + factoryClazz.getName() + "' ", e);
- }
- }
- else {
- LOG.debug("extension '" + extension.getName() + "' contributed by '" + extension.getContibuterBundleId() + "' has neither an UiClass nor a factory defined! Skipping extension.");
- continue;
- }
- int distance = -distanceToIFormField(modelClazz, 0);
- CompositeObject key = new CompositeObject(distance, modelClazz.getName());
- if (sortedMap.containsKey(key)) {
- P_FormFieldExtension existingExt = sortedMap.get(key);
- // check scope
- if (existingExt.getFormFieldExtension().getScope() == extension.getScope()) {
- LOG.warn("The bundles '" + extension.getContibuterBundleId() + "' and '" + existingExt.getFormFieldExtension().getContibuterBundleId() + "' are both providing " + "an form field extension to '" + extension.getModelClassName() + "' with the same scope.");
- }
- else if (existingExt.getFormFieldExtension().getScope() < extension.getScope()) {
- // replace
- sortedMap.put(key, new P_FormFieldExtension(modelClazz, factory, extension));
- }
- }
- else {
- sortedMap.put(key, new P_FormFieldExtension(modelClazz, factory, extension));
- }
- }
- catch (ClassNotFoundException e) {
- LOG.debug("local extension '" + extension.getName() + "' contributed by '" + extension.getContibuterBundleId() + "' is not visible from bundle: '" + loaderBundle.getSymbolicName() + "'.");
- }
- }
-
- }
- }
-
- m_fields = new LinkedHashMap<Class<?>, IFormFieldFactory>();
- for (P_FormFieldExtension ext : sortedMap.values()) {
- m_fields.put(ext.getModelClazz(), ext.getFactory());
- }
- }
-
- private static int distanceToIFormField(Class<?> visitee, int dist) {
- if (visitee == IFormField.class) {
- return dist;
- }
- else {
- int locDist = 100000;
- Class<?> superclass = visitee.getSuperclass();
- if (superclass != null) {
- locDist = distanceToIFormField(superclass, (dist + 1));
- }
- Class[] interfaces = visitee.getInterfaces();
- if (interfaces != null) {
- for (Class<?> i : interfaces) {
- locDist = Math.min(locDist, distanceToIFormField(i, (dist + 1)));
- }
- }
- dist = locDist;
- return dist;
- }
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public IRwtScoutFormField<IFormField> createUiFormField(Composite parent, IFormField model, IRwtEnvironment uiEnvironment) {
- IRwtScoutFormField<IFormField> uiField = (IRwtScoutFormField<IFormField>) createUiFormFieldByExtension(parent, model, uiEnvironment);
- return uiField;
- }
-
- private IRwtScoutFormField<?> createUiFormFieldByExtension(Composite parent, IFormField model, IRwtEnvironment uiEnvironment) {
- IFormFieldFactory factory = null;
- for (Entry<Class<?>, IFormFieldFactory> link : m_fields.entrySet()) {
- if (link.getKey().isAssignableFrom(model.getClass())) {
- // create instance
- factory = link.getValue();
- try {
- return factory.createUiFormField(parent, model, uiEnvironment);
- }
- catch (Throwable e) {
- LOG.error("could not create form field for: [model = '" + model.getClass().getName() + "'; ui = '" + factory.toString() + "'].", e);
- }
- }
- }
- if (factory != null) {
- try {
- return factory.createUiFormField(parent, model, uiEnvironment);
- }
- catch (Throwable t) {
- t.printStackTrace();
- return null;
- }
- }
- return null;
- }
-
- private class P_DirectLinkFormFieldFactory implements IFormFieldFactory {
- private final Class<? extends IRwtScoutFormField> m_uiClazz;
-
- public P_DirectLinkFormFieldFactory(Class<? extends IRwtScoutFormField> uiClazz) {
- m_uiClazz = uiClazz;
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public IRwtScoutFormField<?> createUiFormField(Composite parent, IFormField model, IRwtEnvironment uiEnvironment) {
- try {
- IRwtScoutFormField newInstance = m_uiClazz.newInstance();
- newInstance.createUiField(parent, model, uiEnvironment);
- return newInstance;
- }
- catch (Exception e) {
- LOG.warn(null, e);
- return null;
- }
- }
-
- @Override
- public String toString() {
- return "DirectLinkFactory to: " + m_uiClazz.getName();
- }
- }// end class P_DirectLinkFormFieldFactory
-
- private class P_FormFieldExtension {
- private final Class<?> m_modelClazz;
- private final IFormFieldFactory m_factory;
- private final IFormFieldExtension m_formFieldExtension;
-
- public P_FormFieldExtension(Class<?> modelClazz, IFormFieldFactory factory, IFormFieldExtension formFieldExtension) {
- m_modelClazz = modelClazz;
- m_factory = factory;
- m_formFieldExtension = formFieldExtension;
- }
-
- public Class<?> getModelClazz() {
- return m_modelClazz;
- }
-
- public IFormFieldFactory getFactory() {
- return m_factory;
- }
-
- public IFormFieldExtension getFormFieldExtension() {
- return m_formFieldExtension;
- }
- } // end class P_FormFieldExtension
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap;
+
+import java.util.LinkedHashMap;
+import java.util.Map.Entry;
+import java.util.TreeMap;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.scout.commons.CompositeObject;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.ui.rap.extension.FormFieldsExtensionPoint;
+import org.eclipse.scout.rt.ui.rap.extension.IFormFieldExtension;
+import org.eclipse.scout.rt.ui.rap.extension.IFormFieldFactory;
+import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
+import org.eclipse.swt.widgets.Composite;
+import org.osgi.framework.Bundle;
+
+public class FormFieldFactory implements IFormFieldFactory {
+ private static IScoutLogger LOG = ScoutLogManager.getLogger(FormFieldFactory.class);
+
+ private LinkedHashMap<Class<?>, IFormFieldFactory> m_fields;
+
+ /**
+ * @param bundle
+ * the ui.swt bundle of the requesting application (e.g.
+ * com.bsiag.crm.ui.swt)
+ */
+ @SuppressWarnings("unchecked")
+ public FormFieldFactory(Bundle requesterBundle) {
+ TreeMap<CompositeObject, P_FormFieldExtension> sortedMap = new TreeMap<CompositeObject, P_FormFieldExtension>();
+ for (IFormFieldExtension extension : FormFieldsExtensionPoint.getFormFieldExtensions()) {
+ if (extension.isActive()) {
+ Bundle loaderBundle;
+ if (extension.getScope() == IFormFieldExtension.SCOPE_LOCAL) {
+ loaderBundle = requesterBundle;
+ }
+ else {
+ loaderBundle = Platform.getBundle(extension.getContibuterBundleId());
+ }
+ if (loaderBundle != null) {
+ Class<?> modelClazz;
+ Class<? extends IRwtScoutFormField> uiClazz = null;
+ Class<? extends IFormFieldFactory> factoryClazz = null;
+ try {
+ modelClazz = loaderBundle.loadClass(extension.getModelClassName());
+ if (!StringUtility.isNullOrEmpty(extension.getUiClassName())) {
+ uiClazz = (Class<? extends IRwtScoutFormField>) loaderBundle.loadClass(extension.getUiClassName());
+ if (!IRwtScoutFormField.class.isAssignableFrom(uiClazz)) {
+ LOG.warn("extension '" + extension.getName() + "' contributed by '" + extension.getContibuterBundleId() + "' has an ui class not instanceof " + IRwtScoutFormField.class.getName() + ".");
+ uiClazz = null;
+ }
+ }
+ else if (!StringUtility.isNullOrEmpty(extension.getFactoryClassName())) {
+ factoryClazz = (Class<? extends IFormFieldFactory>) loaderBundle.loadClass(extension.getFactoryClassName());
+ if (!IFormFieldFactory.class.isAssignableFrom(factoryClazz)) {
+ LOG.warn("extension '" + extension.getName() + "' contributed by '" + extension.getContibuterBundleId() + "' has a facotry class not instanceof " + IFormFieldFactory.class.getName() + ".");
+ factoryClazz = null;
+ }
+ }
+ IFormFieldFactory factory = null;
+ if (uiClazz != null) {
+ factory = new P_DirectLinkFormFieldFactory(uiClazz);
+ }
+ else if (factoryClazz != null) {
+ try {
+ factory = factoryClazz.newInstance();
+ }
+ catch (Exception e) {
+ LOG.warn("could not create a factory instance of '" + factoryClazz.getName() + "' ", e);
+ }
+ }
+ else {
+ LOG.debug("extension '" + extension.getName() + "' contributed by '" + extension.getContibuterBundleId() + "' has neither an UiClass nor a factory defined! Skipping extension.");
+ continue;
+ }
+ int distance = -distanceToIFormField(modelClazz, 0);
+ CompositeObject key = new CompositeObject(distance, modelClazz.getName());
+ if (sortedMap.containsKey(key)) {
+ P_FormFieldExtension existingExt = sortedMap.get(key);
+ // check scope
+ if (existingExt.getFormFieldExtension().getScope() == extension.getScope()) {
+ LOG.warn("The bundles '" + extension.getContibuterBundleId() + "' and '" + existingExt.getFormFieldExtension().getContibuterBundleId() + "' are both providing " + "an form field extension to '" + extension.getModelClassName() + "' with the same scope.");
+ }
+ else if (existingExt.getFormFieldExtension().getScope() < extension.getScope()) {
+ // replace
+ sortedMap.put(key, new P_FormFieldExtension(modelClazz, factory, extension));
+ }
+ }
+ else {
+ sortedMap.put(key, new P_FormFieldExtension(modelClazz, factory, extension));
+ }
+ }
+ catch (ClassNotFoundException e) {
+ LOG.debug("local extension '" + extension.getName() + "' contributed by '" + extension.getContibuterBundleId() + "' is not visible from bundle: '" + loaderBundle.getSymbolicName() + "'.");
+ }
+ }
+
+ }
+ }
+
+ m_fields = new LinkedHashMap<Class<?>, IFormFieldFactory>();
+ for (P_FormFieldExtension ext : sortedMap.values()) {
+ m_fields.put(ext.getModelClazz(), ext.getFactory());
+ }
+ }
+
+ private static int distanceToIFormField(Class<?> visitee, int dist) {
+ if (visitee == IFormField.class) {
+ return dist;
+ }
+ else {
+ int locDist = 100000;
+ Class<?> superclass = visitee.getSuperclass();
+ if (superclass != null) {
+ locDist = distanceToIFormField(superclass, (dist + 1));
+ }
+ Class[] interfaces = visitee.getInterfaces();
+ if (interfaces != null) {
+ for (Class<?> i : interfaces) {
+ locDist = Math.min(locDist, distanceToIFormField(i, (dist + 1)));
+ }
+ }
+ dist = locDist;
+ return dist;
+ }
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public IRwtScoutFormField<IFormField> createUiFormField(Composite parent, IFormField model, IRwtEnvironment uiEnvironment) {
+ IRwtScoutFormField<IFormField> uiField = (IRwtScoutFormField<IFormField>) createUiFormFieldByExtension(parent, model, uiEnvironment);
+ return uiField;
+ }
+
+ private IRwtScoutFormField<?> createUiFormFieldByExtension(Composite parent, IFormField model, IRwtEnvironment uiEnvironment) {
+ IFormFieldFactory factory = null;
+ for (Entry<Class<?>, IFormFieldFactory> link : m_fields.entrySet()) {
+ if (link.getKey().isAssignableFrom(model.getClass())) {
+ // create instance
+ factory = link.getValue();
+ try {
+ return factory.createUiFormField(parent, model, uiEnvironment);
+ }
+ catch (Throwable e) {
+ LOG.error("could not create form field for: [model = '" + model.getClass().getName() + "'; ui = '" + factory.toString() + "'].", e);
+ }
+ }
+ }
+ if (factory != null) {
+ try {
+ return factory.createUiFormField(parent, model, uiEnvironment);
+ }
+ catch (Throwable t) {
+ t.printStackTrace();
+ return null;
+ }
+ }
+ return null;
+ }
+
+ private class P_DirectLinkFormFieldFactory implements IFormFieldFactory {
+ private final Class<? extends IRwtScoutFormField> m_uiClazz;
+
+ public P_DirectLinkFormFieldFactory(Class<? extends IRwtScoutFormField> uiClazz) {
+ m_uiClazz = uiClazz;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public IRwtScoutFormField<?> createUiFormField(Composite parent, IFormField model, IRwtEnvironment uiEnvironment) {
+ try {
+ IRwtScoutFormField newInstance = m_uiClazz.newInstance();
+ newInstance.createUiField(parent, model, uiEnvironment);
+ return newInstance;
+ }
+ catch (Exception e) {
+ LOG.warn(null, e);
+ return null;
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "DirectLinkFactory to: " + m_uiClazz.getName();
+ }
+ }// end class P_DirectLinkFormFieldFactory
+
+ private class P_FormFieldExtension {
+ private final Class<?> m_modelClazz;
+ private final IFormFieldFactory m_factory;
+ private final IFormFieldExtension m_formFieldExtension;
+
+ public P_FormFieldExtension(Class<?> modelClazz, IFormFieldFactory factory, IFormFieldExtension formFieldExtension) {
+ m_modelClazz = modelClazz;
+ m_factory = factory;
+ m_formFieldExtension = formFieldExtension;
+ }
+
+ public Class<?> getModelClazz() {
+ return m_modelClazz;
+ }
+
+ public IFormFieldFactory getFactory() {
+ return m_factory;
+ }
+
+ public IFormFieldExtension getFormFieldExtension() {
+ return m_formFieldExtension;
+ }
+ } // end class P_FormFieldExtension
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ILogicalGridLayout.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ILogicalGridLayout.java
index f02aa74e84..787473838a 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ILogicalGridLayout.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ILogicalGridLayout.java
@@ -1,40 +1,40 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap;
-
-import java.io.PrintWriter;
-
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.forms.widgets.ILayoutExtension;
-
-/**
- * Dynamic layout using logical grid data {@link LogicalGridData} to arrange
- * fields. The grid data per field can be passed when adding the component to
- * the container or set as client property with name {@link LogicalGridData#CLIENT_PROPERTY_NAME}.
- */
-public interface ILogicalGridLayout extends ILayoutExtension {
- int MIN = 0;
- int PREF = 1;
- int MAX = 2;
-
- float EPS = 1E-6f;
-
- Point computeSize(Composite composite, boolean changed, int wHint, int hHint, int sizeFlag);
-
- Point computeMinimumSize(Composite parent, boolean changed);
-
- void setDebug(boolean b);
-
- void dumpLayoutInfo(Composite parent);
-
- void dumpLayoutInfo(Composite parent, PrintWriter out);
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap;
+
+import java.io.PrintWriter;
+
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.forms.widgets.ILayoutExtension;
+
+/**
+ * Dynamic layout using logical grid data {@link LogicalGridData} to arrange
+ * fields. The grid data per field can be passed when adding the component to
+ * the container or set as client property with name {@link LogicalGridData#CLIENT_PROPERTY_NAME}.
+ */
+public interface ILogicalGridLayout extends ILayoutExtension {
+ int MIN = 0;
+ int PREF = 1;
+ int MAX = 2;
+
+ float EPS = 1E-6f;
+
+ Point computeSize(Composite composite, boolean changed, int wHint, int hHint, int sizeFlag);
+
+ Point computeMinimumSize(Composite parent, boolean changed);
+
+ void setDebug(boolean b);
+
+ void dumpLayoutInfo(Composite parent);
+
+ void dumpLayoutInfo(Composite parent, PrintWriter out);
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ILogicalGridLayoutInfo.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ILogicalGridLayoutInfo.java
index f7e74dab22..11ebedc421 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ILogicalGridLayoutInfo.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ILogicalGridLayoutInfo.java
@@ -1,42 +1,42 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap;
-
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Control;
-
-public interface ILogicalGridLayoutInfo {
-
- LogicalGridData[/* component count */] getGridDatas();
-
- Control[/* component count */] getComponents();
-
- int[/* component count */] getComponentWidths();
-
- int[/* component count */] getComponentHeights();
-
- int getCols(); /* number of cells horizontally */
-
- int getRows(); /* number of cells vertically */
-
- int[/* column */][/* min,pref,max */] getWidth();
-
- int[/* row */][/* min,pref,max */] getHeight();
-
- int[/*column*/] getWidthHints();
-
- double[/* column */] geWeightX();
-
- double[/* row */] getWeightY();
-
- Rectangle[][] layoutCellBounds(Point size);
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap;
+
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Control;
+
+public interface ILogicalGridLayoutInfo {
+
+ LogicalGridData[/* component count */] getGridDatas();
+
+ Control[/* component count */] getComponents();
+
+ int[/* component count */] getComponentWidths();
+
+ int[/* component count */] getComponentHeights();
+
+ int getCols(); /* number of cells horizontally */
+
+ int getRows(); /* number of cells vertically */
+
+ int[/* column */][/* min,pref,max */] getWidth();
+
+ int[/* row */][/* min,pref,max */] getHeight();
+
+ int[/*column*/] getWidthHints();
+
+ double[/* column */] geWeightX();
+
+ double[/* row */] getWeightY();
+
+ Rectangle[][] layoutCellBounds(Point size);
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/IRwtEnvironment.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/IRwtEnvironment.java
index 4e0f2461aa..3126a9710a 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/IRwtEnvironment.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/IRwtEnvironment.java
@@ -1,236 +1,236 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap;
-
-import java.util.Collection;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.scout.commons.job.JobEx;
-import org.eclipse.scout.rt.client.ClientJob;
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.client.ui.basic.filechooser.IFileChooser;
-import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.messagebox.IMessageBox;
-import org.eclipse.scout.rt.shared.data.basic.FontSpec;
-import org.eclipse.scout.rt.shared.servicetunnel.DefaultServiceTunnelContentHandler;
-import org.eclipse.scout.rt.ui.rap.basic.IRwtScoutComposite;
-import org.eclipse.scout.rt.ui.rap.form.IRwtScoutForm;
-import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
-import org.eclipse.scout.rt.ui.rap.form.fields.RwtScoutFieldComposite;
-import org.eclipse.scout.rt.ui.rap.html.HtmlAdapter;
-import org.eclipse.scout.rt.ui.rap.keystroke.IKeyStrokeManager;
-import org.eclipse.scout.rt.ui.rap.keystroke.IRwtKeyStroke;
-import org.eclipse.scout.rt.ui.rap.util.ScoutFormToolkit;
-import org.eclipse.scout.rt.ui.rap.window.IRwtScoutPart;
-import org.eclipse.scout.rt.ui.rap.window.desktop.IRwtScoutFormFooter;
-import org.eclipse.scout.rt.ui.rap.window.desktop.IRwtScoutFormHeader;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Widget;
-
-/**
- * In order to use rap with a scout application simply setup securtity as follows:
- * <ol>
- * <li>Add a servlet security filter to the /rap client webapp to give the user a rap client Subject</li>
- * <li>Optional:
- * {@link DefaultServiceTunnelContentHandler#createDefaultWsSecurityElement(org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelRequest)}
- * creates a default ws security element for this client subject and sends it with every soap request</li>
- * <li>Add a servlet security filter to the /ajax server webapp to detect the WSSE security token and create a user
- * principal as well as a VirtualSessioIdPrincipal. A default filter is in scout server
- * DefaultVirtualSessionSecurityFilter</li>
- * </ol>
- */
-public interface IRwtEnvironment {
-
- /**
- * key for {@link IClientSession#setData(String, Object)} holding the environment
- */
- String ENVIRONMENT_KEY = "ui.environment";
-
- /**
- * @param modalities
- * combination of {@link SWT#SYSTEM_MODAL}, {@link SWT#APPLICATION_MODAL}, {@link SWT#MODELESS}
- * @return best effort to get the "current" parent shell. Never null. ticket
- * 79624
- */
- Shell getParentShellIgnoringPopups(int modalities);
-
- boolean isInitialized();
-
- /**
- * Must be called in display thread
- */
- void ensureInitialized();
-
- Image getIcon(String name);
-
- ImageDescriptor getImageDescriptor(String iconId);
-
- ScoutFormToolkit getFormToolkit();
-
- /**
- * Called from scout job/thread to post an immediate swt job into the waiting queue.
- * <p>
- * These jobs are run when calling {@link #dispatchImmediateUiJobs()}. Normally this kind of code is only used to
- * early apply visible and enabled properties in {@link RwtScoutFieldComposite#handleUiInputVerifier()} in order to
- * have before-focus-traversal visible/enabled state-update
- */
- void postImmediateUiJob(Runnable r);
-
- void dispatchImmediateUiJobs();
-
- Color getColor(String scoutColor);
-
- Color getColor(RGB rgb);
-
- /**
- * global key strokes will be executed when and only when no key stroke of the
- * control hierarchy starting at the event's source control consumed
- * (event.doit = false) the event.
- *
- * @param stroke
- * @return
- */
- void addGlobalKeyStroke(IRwtKeyStroke stroke, boolean exclusive);
-
- /**
- * global key strokes will be executed when and only when no key stroke of the
- * control hierarchy starting at the event's source control consumed
- * (event.doit = false) the event.
- *
- * @param stroke
- * @return
- */
- boolean removeGlobalKeyStroke(IRwtKeyStroke stroke);
-
- /**
- * @see IKeyStrokeManager#addKeyStroke(Widget, IRwtKeyStroke)
- */
- void addKeyStroke(Control control, IRwtKeyStroke stroke, boolean exclusive);
-
- /**
- * @see IKeyStrokeManager#removeKeyStroke(Widget, IRwtKeyStroke)
- */
- boolean removeKeyStroke(Control control, IRwtKeyStroke stroke);
-
- /**
- * @see IKeyStrokeManager#removeKeyStrokes(Widget)
- */
- boolean removeKeyStrokes(Control control);
-
- /**
- * @return a font based on templateFont with style, name and size from scoutFont (if not null).
- * The result is cached for re-use. Dispose is done automatically and must not be done by the caller
- */
- Font getFont(FontSpec scoutFont, Font templateFont);
-
- /**
- * @return a font based on templateFont with different style, name and size (if not null).
- * The result is cached for re-use. Dispose is done automatically and must not be done by the caller
- */
- Font getFont(Font templateFont, String newName, Integer newStyle, Integer newSize);
-
- IDesktop getScoutDesktop();
-
- // Gui factory
- IRwtScoutForm createForm(Composite parent, IForm scoutForm);
-
- IRwtScoutFormHeader createFormHeader(Composite parent, IForm scoutForm);
-
- IRwtScoutFormFooter createFormFooter(Composite parent, IForm scoutForm);
-
- IRwtScoutFormField createFormField(Composite parent, IFormField model);
-
- void checkThread();
-
- void ensureFormPartVisible(IForm form);
-
- void hideFormPart(IForm form);
-
- void showFormPart(IForm form);
-
- Collection<IRwtScoutPart> getOpenFormParts();
-
- void showFileChooserFromScout(IFileChooser fileChooser);
-
- /**
- * Open a browser window with some url or address.
- * <p>
- * If the address is a file path, this will trigger a file download from the browser.
- */
- void openBrowserWindowFromScout(String path);
-
- void showMessageBoxFromScout(IMessageBox messageBox);
-
- void setClipboardText(String text);
-
- /**
- * @return the popupOwner for the (next) popup that is displayed
- */
- Control getPopupOwner();
-
- /**
- * @return the popupOwnerBounds used for the (next) popup that is displayed
- */
- Rectangle getPopupOwnerBounds();
-
- void setPopupOwner(Control owner, Rectangle ownerBounds);
-
- /**
- * Convenience for {@link HtmlAdapter#adaptHtmlCell(IRwtScoutComposite, String)}.
- */
- String adaptHtmlCell(IRwtScoutComposite<?> uiComposite, String rawHtml);
-
- /**
- * Convenience for {@link HtmlAdapter#convertLinksWithLocalUrlsInHtmlCell(IRwtScoutComposite, String)}
- */
- String convertLinksWithLocalUrlsInHtmlCell(IRwtScoutComposite<?> uiComposite, String rawHtml);
-
- /**
- * Convenience for {@link HtmlAdapter#styleHtmlText(IRwtScoutFormField, String)}.
- */
- String styleHtmlText(IRwtScoutFormField<?> uiComposite, String rawHtml);
-
- @Deprecated
- String getLogoutLandingUri();
-
- Display getDisplay();
-
- IClientSession getClientSession();
-
- LayoutValidateManager getLayoutValidateManager();
-
- /**
- * calling from swt thread
- * <p>
- * The job is only run when it reaches the model within the cancelTimeout. This means if the job is delayed longer
- * than cancelTimeout millis when the model job runs it, then the job is ignored.
- *
- * @return the created and scheduled job, a {@link ClientJob}
- */
- JobEx invokeScoutLater(Runnable job, long cancelTimeout);
-
- void invokeUiLater(Runnable job);
-
- void addEnvironmentListener(IRwtEnvironmentListener listener);
-
- void removeEnvironmentListener(IRwtEnvironmentListener listener);
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap;
+
+import java.util.Collection;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.scout.commons.job.JobEx;
+import org.eclipse.scout.rt.client.ClientJob;
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.client.ui.basic.filechooser.IFileChooser;
+import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.messagebox.IMessageBox;
+import org.eclipse.scout.rt.shared.data.basic.FontSpec;
+import org.eclipse.scout.rt.shared.servicetunnel.DefaultServiceTunnelContentHandler;
+import org.eclipse.scout.rt.ui.rap.basic.IRwtScoutComposite;
+import org.eclipse.scout.rt.ui.rap.form.IRwtScoutForm;
+import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
+import org.eclipse.scout.rt.ui.rap.form.fields.RwtScoutFieldComposite;
+import org.eclipse.scout.rt.ui.rap.html.HtmlAdapter;
+import org.eclipse.scout.rt.ui.rap.keystroke.IKeyStrokeManager;
+import org.eclipse.scout.rt.ui.rap.keystroke.IRwtKeyStroke;
+import org.eclipse.scout.rt.ui.rap.util.ScoutFormToolkit;
+import org.eclipse.scout.rt.ui.rap.window.IRwtScoutPart;
+import org.eclipse.scout.rt.ui.rap.window.desktop.IRwtScoutFormFooter;
+import org.eclipse.scout.rt.ui.rap.window.desktop.IRwtScoutFormHeader;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Widget;
+
+/**
+ * In order to use rap with a scout application simply setup securtity as follows:
+ * <ol>
+ * <li>Add a servlet security filter to the /rap client webapp to give the user a rap client Subject</li>
+ * <li>Optional:
+ * {@link DefaultServiceTunnelContentHandler#createDefaultWsSecurityElement(org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelRequest)}
+ * creates a default ws security element for this client subject and sends it with every soap request</li>
+ * <li>Add a servlet security filter to the /ajax server webapp to detect the WSSE security token and create a user
+ * principal as well as a VirtualSessioIdPrincipal. A default filter is in scout server
+ * DefaultVirtualSessionSecurityFilter</li>
+ * </ol>
+ */
+public interface IRwtEnvironment {
+
+ /**
+ * key for {@link IClientSession#setData(String, Object)} holding the environment
+ */
+ String ENVIRONMENT_KEY = "ui.environment";
+
+ /**
+ * @param modalities
+ * combination of {@link SWT#SYSTEM_MODAL}, {@link SWT#APPLICATION_MODAL}, {@link SWT#MODELESS}
+ * @return best effort to get the "current" parent shell. Never null. ticket
+ * 79624
+ */
+ Shell getParentShellIgnoringPopups(int modalities);
+
+ boolean isInitialized();
+
+ /**
+ * Must be called in display thread
+ */
+ void ensureInitialized();
+
+ Image getIcon(String name);
+
+ ImageDescriptor getImageDescriptor(String iconId);
+
+ ScoutFormToolkit getFormToolkit();
+
+ /**
+ * Called from scout job/thread to post an immediate swt job into the waiting queue.
+ * <p>
+ * These jobs are run when calling {@link #dispatchImmediateUiJobs()}. Normally this kind of code is only used to
+ * early apply visible and enabled properties in {@link RwtScoutFieldComposite#handleUiInputVerifier()} in order to
+ * have before-focus-traversal visible/enabled state-update
+ */
+ void postImmediateUiJob(Runnable r);
+
+ void dispatchImmediateUiJobs();
+
+ Color getColor(String scoutColor);
+
+ Color getColor(RGB rgb);
+
+ /**
+ * global key strokes will be executed when and only when no key stroke of the
+ * control hierarchy starting at the event's source control consumed
+ * (event.doit = false) the event.
+ *
+ * @param stroke
+ * @return
+ */
+ void addGlobalKeyStroke(IRwtKeyStroke stroke, boolean exclusive);
+
+ /**
+ * global key strokes will be executed when and only when no key stroke of the
+ * control hierarchy starting at the event's source control consumed
+ * (event.doit = false) the event.
+ *
+ * @param stroke
+ * @return
+ */
+ boolean removeGlobalKeyStroke(IRwtKeyStroke stroke);
+
+ /**
+ * @see IKeyStrokeManager#addKeyStroke(Widget, IRwtKeyStroke)
+ */
+ void addKeyStroke(Control control, IRwtKeyStroke stroke, boolean exclusive);
+
+ /**
+ * @see IKeyStrokeManager#removeKeyStroke(Widget, IRwtKeyStroke)
+ */
+ boolean removeKeyStroke(Control control, IRwtKeyStroke stroke);
+
+ /**
+ * @see IKeyStrokeManager#removeKeyStrokes(Widget)
+ */
+ boolean removeKeyStrokes(Control control);
+
+ /**
+ * @return a font based on templateFont with style, name and size from scoutFont (if not null).
+ * The result is cached for re-use. Dispose is done automatically and must not be done by the caller
+ */
+ Font getFont(FontSpec scoutFont, Font templateFont);
+
+ /**
+ * @return a font based on templateFont with different style, name and size (if not null).
+ * The result is cached for re-use. Dispose is done automatically and must not be done by the caller
+ */
+ Font getFont(Font templateFont, String newName, Integer newStyle, Integer newSize);
+
+ IDesktop getScoutDesktop();
+
+ // Gui factory
+ IRwtScoutForm createForm(Composite parent, IForm scoutForm);
+
+ IRwtScoutFormHeader createFormHeader(Composite parent, IForm scoutForm);
+
+ IRwtScoutFormFooter createFormFooter(Composite parent, IForm scoutForm);
+
+ IRwtScoutFormField createFormField(Composite parent, IFormField model);
+
+ void checkThread();
+
+ void ensureFormPartVisible(IForm form);
+
+ void hideFormPart(IForm form);
+
+ void showFormPart(IForm form);
+
+ Collection<IRwtScoutPart> getOpenFormParts();
+
+ void showFileChooserFromScout(IFileChooser fileChooser);
+
+ /**
+ * Open a browser window with some url or address.
+ * <p>
+ * If the address is a file path, this will trigger a file download from the browser.
+ */
+ void openBrowserWindowFromScout(String path);
+
+ void showMessageBoxFromScout(IMessageBox messageBox);
+
+ void setClipboardText(String text);
+
+ /**
+ * @return the popupOwner for the (next) popup that is displayed
+ */
+ Control getPopupOwner();
+
+ /**
+ * @return the popupOwnerBounds used for the (next) popup that is displayed
+ */
+ Rectangle getPopupOwnerBounds();
+
+ void setPopupOwner(Control owner, Rectangle ownerBounds);
+
+ /**
+ * Convenience for {@link HtmlAdapter#adaptHtmlCell(IRwtScoutComposite, String)}.
+ */
+ String adaptHtmlCell(IRwtScoutComposite<?> uiComposite, String rawHtml);
+
+ /**
+ * Convenience for {@link HtmlAdapter#convertLinksWithLocalUrlsInHtmlCell(IRwtScoutComposite, String)}
+ */
+ String convertLinksWithLocalUrlsInHtmlCell(IRwtScoutComposite<?> uiComposite, String rawHtml);
+
+ /**
+ * Convenience for {@link HtmlAdapter#styleHtmlText(IRwtScoutFormField, String)}.
+ */
+ String styleHtmlText(IRwtScoutFormField<?> uiComposite, String rawHtml);
+
+ @Deprecated
+ String getLogoutLandingUri();
+
+ Display getDisplay();
+
+ IClientSession getClientSession();
+
+ LayoutValidateManager getLayoutValidateManager();
+
+ /**
+ * calling from swt thread
+ * <p>
+ * The job is only run when it reaches the model within the cancelTimeout. This means if the job is delayed longer
+ * than cancelTimeout millis when the model job runs it, then the job is ignored.
+ *
+ * @return the created and scheduled job, a {@link ClientJob}
+ */
+ JobEx invokeScoutLater(Runnable job, long cancelTimeout);
+
+ void invokeUiLater(Runnable job);
+
+ void addEnvironmentListener(IRwtEnvironmentListener listener);
+
+ void removeEnvironmentListener(IRwtEnvironmentListener listener);
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/IRwtEnvironmentListener.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/IRwtEnvironmentListener.java
index 3706e5f478..22713802fa 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/IRwtEnvironmentListener.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/IRwtEnvironmentListener.java
@@ -1,19 +1,19 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap;
-
-import java.util.EventListener;
-
-public interface IRwtEnvironmentListener extends EventListener {
-
- void environmentChanged(RwtEnvironmentEvent e);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap;
+
+import java.util.EventListener;
+
+public interface IRwtEnvironmentListener extends EventListener {
+
+ void environmentChanged(RwtEnvironmentEvent e);
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/IRwtStandaloneEnvironment.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/IRwtStandaloneEnvironment.java
index 6c217f4d26..27ea901d78 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/IRwtStandaloneEnvironment.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/IRwtStandaloneEnvironment.java
@@ -1,19 +1,19 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap;
-
-import org.eclipse.rwt.lifecycle.IEntryPoint;
-import org.eclipse.scout.rt.ui.rap.window.desktop.IRwtDesktop;
-
-public interface IRwtStandaloneEnvironment extends IRwtEnvironment, IEntryPoint {
-
- IRwtDesktop getUiDesktop();
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap;
+
+import org.eclipse.rwt.lifecycle.IEntryPoint;
+import org.eclipse.scout.rt.ui.rap.window.desktop.IRwtDesktop;
+
+public interface IRwtStandaloneEnvironment extends IRwtEnvironment, IEntryPoint {
+
+ IRwtDesktop getUiDesktop();
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/IValidateRoot.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/IValidateRoot.java
index 2fe3cf7123..1dca06489b 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/IValidateRoot.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/IValidateRoot.java
@@ -1,23 +1,23 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap;
-
-import org.eclipse.swt.widgets.Composite;
-
-public interface IValidateRoot {
-
- String VALIDATE_ROOT_DATA = "LayoutValidateManager.validateRoot";
-
- void validate();
-
- Composite getUiComposite();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap;
+
+import org.eclipse.swt.widgets.Composite;
+
+public interface IValidateRoot {
+
+ String VALIDATE_ROOT_DATA = "LayoutValidateManager.validateRoot";
+
+ void validate();
+
+ Composite getUiComposite();
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/LayoutValidateManager.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/LayoutValidateManager.java
index 51c023e4e4..3d6ca2bb7a 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/LayoutValidateManager.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/LayoutValidateManager.java
@@ -1,74 +1,74 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap;
-
-import java.util.LinkedList;
-
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-
-/**
- * Validate layout changes (add/remove, invisible components).
- * <p>
- * Components that act as validate roots use {@link Control#setData(VALIDATE_ROOT_DATA, ValidateRoot)}
- */
-public class LayoutValidateManager {
- private static final String RUNNABLE_DISPLAY_DATA = "LayoutValidateManager.runnable";
-
- private final LinkedList<IValidateRoot> m_dirtyList;
-
- public LayoutValidateManager() {
- m_dirtyList = new LinkedList<IValidateRoot>();
- }
-
- public void invalidate(Control c) {
- if (c == null) {
- return;
- }
- //collect all IValidateRoot on the path to root
- boolean changed = false;
- Control tmp = c;
- while (tmp != null) {
- IValidateRoot v = (IValidateRoot) tmp.getData(IValidateRoot.VALIDATE_ROOT_DATA);
- if (v != null) {
- changed = true;
- m_dirtyList.remove(v);
- m_dirtyList.add(0, v);
- }
- tmp = tmp.getParent();
- }
- if (changed) {
- //runnable per display
- Display display = c.getDisplay();
- Runnable runnable = (Runnable) display.getData(RUNNABLE_DISPLAY_DATA);
- if (runnable == null && display != null && !display.isDisposed()) {
- runnable = new P_ValidateRunnable();
- display.setData(RUNNABLE_DISPLAY_DATA, null);
- display.asyncExec(runnable);
- }
- }
- }
-
- private class P_ValidateRunnable implements Runnable {
- @Override
- public void run() {
- try {
- for (IValidateRoot v : m_dirtyList) {
- v.validate();
- }
- }
- finally {
- m_dirtyList.clear();
- Display.getCurrent().setData(RUNNABLE_DISPLAY_DATA, null);
- }
- }
- } // end class P_SizeCheckRunnable
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap;
+
+import java.util.LinkedList;
+
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * Validate layout changes (add/remove, invisible components).
+ * <p>
+ * Components that act as validate roots use {@link Control#setData(VALIDATE_ROOT_DATA, ValidateRoot)}
+ */
+public class LayoutValidateManager {
+ private static final String RUNNABLE_DISPLAY_DATA = "LayoutValidateManager.runnable";
+
+ private final LinkedList<IValidateRoot> m_dirtyList;
+
+ public LayoutValidateManager() {
+ m_dirtyList = new LinkedList<IValidateRoot>();
+ }
+
+ public void invalidate(Control c) {
+ if (c == null) {
+ return;
+ }
+ //collect all IValidateRoot on the path to root
+ boolean changed = false;
+ Control tmp = c;
+ while (tmp != null) {
+ IValidateRoot v = (IValidateRoot) tmp.getData(IValidateRoot.VALIDATE_ROOT_DATA);
+ if (v != null) {
+ changed = true;
+ m_dirtyList.remove(v);
+ m_dirtyList.add(0, v);
+ }
+ tmp = tmp.getParent();
+ }
+ if (changed) {
+ //runnable per display
+ Display display = c.getDisplay();
+ Runnable runnable = (Runnable) display.getData(RUNNABLE_DISPLAY_DATA);
+ if (runnable == null && display != null && !display.isDisposed()) {
+ runnable = new P_ValidateRunnable();
+ display.setData(RUNNABLE_DISPLAY_DATA, null);
+ display.asyncExec(runnable);
+ }
+ }
+ }
+
+ private class P_ValidateRunnable implements Runnable {
+ @Override
+ public void run() {
+ try {
+ for (IValidateRoot v : m_dirtyList) {
+ v.validate();
+ }
+ }
+ finally {
+ m_dirtyList.clear();
+ Display.getCurrent().setData(RUNNABLE_DISPLAY_DATA, null);
+ }
+ }
+ } // end class P_SizeCheckRunnable
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/LogicalGridData.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/LogicalGridData.java
index f42b1fa658..9c69e685ef 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/LogicalGridData.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/LogicalGridData.java
@@ -1,68 +1,68 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap;
-
-public class LogicalGridData {
- public static final String CLIENT_PROPERTY_NAME = LogicalGridData.class.getName();
-
- public int gridx;
- public int gridy;
- public int gridw = 1;
- public int gridh = 1;
- public double weightx;
- public double weighty;
- public boolean useUiWidth;
- public boolean useUiHeight;
- public int widthHint;
- public int heightHint;
- /**
- * -1 left 0 center 1 right
- */
- public int horizontalAlignment = -1;
- /**
- * -1 top 0 center 1 bottom
- */
- public int verticalAlignment = -1;
- public boolean fillHorizontal = true;
- public boolean fillVertical = true;
- //
- public int topInset;
-
- public LogicalGridData() {
- }
-
- public LogicalGridData(LogicalGridData template) {
- gridx = template.gridx;
- gridy = template.gridy;
- gridw = template.gridw;
- gridh = template.gridh;
- weightx = template.weightx;
- weighty = template.weighty;
- useUiWidth = template.useUiWidth;
- useUiHeight = template.useUiHeight;
- widthHint = template.widthHint;
- heightHint = template.heightHint;
- horizontalAlignment = template.horizontalAlignment;
- verticalAlignment = template.verticalAlignment;
- fillHorizontal = template.fillHorizontal;
- fillVertical = template.fillVertical;
- topInset = template.topInset;
- }
-
- public void validate() {
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName() + "[" + gridx + ", " + gridy + ", " + gridw + ", " + gridh + ", " + weightx + ", " + weighty + ", useUiWidth=" + useUiWidth + ", useUiHeight=" + useUiHeight + ", widthHint=" + widthHint + ", heightHint=" + heightHint + ", fillHorizontal=" + fillHorizontal + ", fillVertical=" + fillVertical + "]";
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap;
+
+public class LogicalGridData {
+ public static final String CLIENT_PROPERTY_NAME = LogicalGridData.class.getName();
+
+ public int gridx;
+ public int gridy;
+ public int gridw = 1;
+ public int gridh = 1;
+ public double weightx;
+ public double weighty;
+ public boolean useUiWidth;
+ public boolean useUiHeight;
+ public int widthHint;
+ public int heightHint;
+ /**
+ * -1 left 0 center 1 right
+ */
+ public int horizontalAlignment = -1;
+ /**
+ * -1 top 0 center 1 bottom
+ */
+ public int verticalAlignment = -1;
+ public boolean fillHorizontal = true;
+ public boolean fillVertical = true;
+ //
+ public int topInset;
+
+ public LogicalGridData() {
+ }
+
+ public LogicalGridData(LogicalGridData template) {
+ gridx = template.gridx;
+ gridy = template.gridy;
+ gridw = template.gridw;
+ gridh = template.gridh;
+ weightx = template.weightx;
+ weighty = template.weighty;
+ useUiWidth = template.useUiWidth;
+ useUiHeight = template.useUiHeight;
+ widthHint = template.widthHint;
+ heightHint = template.heightHint;
+ horizontalAlignment = template.horizontalAlignment;
+ verticalAlignment = template.verticalAlignment;
+ fillHorizontal = template.fillHorizontal;
+ fillVertical = template.fillVertical;
+ topInset = template.topInset;
+ }
+
+ public void validate() {
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + "[" + gridx + ", " + gridy + ", " + gridw + ", " + gridh + ", " + weightx + ", " + weighty + ", useUiWidth=" + useUiWidth + ", useUiHeight=" + useUiHeight + ", widthHint=" + widthHint + ", heightHint=" + heightHint + ", fillHorizontal=" + fillHorizontal + ", fillVertical=" + fillVertical + "]";
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/LogicalGridLayout.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/LogicalGridLayout.java
index 7f91357e0e..baec59e79b 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/LogicalGridLayout.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/LogicalGridLayout.java
@@ -1,280 +1,280 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap;
-
-import java.io.PrintWriter;
-import java.util.ArrayList;
-
-import org.eclipse.scout.commons.CompositeObject;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.ui.rap.basic.RwtScoutComposite;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Layout;
-
-/**
- * Dynamic layout using logical grid data {@link LogicalGridData} to arrange
- * fields. The grid data per field can be passed when adding the component to
- * the container or set as client property with name {@link LogicalGridData#CLIENT_PROPERTY_NAME}.
- */
-public class LogicalGridLayout extends Layout implements ILogicalGridLayout {
- private static final long serialVersionUID = 1L;
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(LogicalGridLayout.class);
-
- private boolean m_debug;
- private int m_hgap;
- private int m_vgap;
- private LogicalGridLayoutInfo m_info;
- private CompositeObject m_infoCacheKey;
-
- public LogicalGridLayout(int hgap, int vgap) {
- m_hgap = hgap;
- m_vgap = vgap;
- }
-
- @Override
- public int computeMinimumWidth(Composite parent, boolean changed) {
- return computeMinimumSize(parent, changed).x;
- }
-
- @Override
- public Point computeMinimumSize(Composite parent, boolean changed) {
- return computeSize(parent, changed, SWT.DEFAULT, SWT.DEFAULT, MIN);
- }
-
- @Override
- protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache) {
- return computeSize(composite, flushCache, wHint, hHint, PREF);
- }
-
- @Override
- public int computeMaximumWidth(Composite parent, boolean changed) {
- return computeSize(parent, changed, SWT.DEFAULT, SWT.DEFAULT, MAX).x;
- }
-
- @Override
- public Point computeSize(Composite composite, boolean changed, int wHint, int hHint, int sizeFlag) {
- if (changed) {
- m_info = null;
- }
- if (wHint <= 0) {
- wHint = SWT.DEFAULT;
- }
- validateLayout(composite, wHint, changed);
-
- Point min = new Point(0, 0);
- Point pref = new Point(0, 0);
- Point max = new Point(0, 0);
- // w
- int useCount = 0;
- for (int i = 0; i < m_info.cols; i++) {
- if (useCount > 0) {
- min.x = min.x + m_hgap;
- pref.x = pref.x + m_hgap;
- max.x = max.x + m_hgap;
- }
- min.x = min.x + m_info.width[i][MIN];
- pref.x = pref.x + m_info.width[i][PREF];
- max.x = max.x + m_info.width[i][MAX];
- useCount++;
- }
- // h
- useCount = 0;
- for (int i = 0; i < m_info.rows; i++) {
- if (useCount > 0) {
- min.y = min.y + m_vgap;
- pref.y = pref.y + m_vgap;
- max.y = max.y + m_vgap;
- }
- min.y = min.y + m_info.height[i][MIN];
- pref.y = pref.y + m_info.height[i][PREF];
- max.y = max.y + m_info.height[i][MAX];
- useCount++;
- }
- Point size = new Point(0, 0);
- switch (sizeFlag) {
- case MIN:
- size.x = min.x;
- size.y = min.y;
- break;
- case MAX:
- size.x = min.x;
- size.y = min.y;
- break;
- default:
- // adjust width
- if (wHint == SWT.DEFAULT) {
- size.x = pref.x;
- }
- else {
- size.x = wHint;
- size.x = Math.min(max.x, size.x);
- size.x = Math.max(min.x, size.x);
- }
- // adjust heigth
- if (hHint == SWT.DEFAULT) {
- size.y = pref.y;
- }
- else {
- size.y = hHint;
- size.y = Math.min(max.y, size.y);
- size.y = Math.max(min.y, size.y);
- }
- break;
- }
- return size;
- }
-
- @Override
- protected void layout(Composite parent, boolean flushCache) {
- if (flushCache) {
- m_info = null;
- }
- validateLayout(parent, parent.getSize().x, flushCache);
- Rectangle clientArea = parent.getClientArea();
- Rectangle[][] cellBounds = m_info.layoutCellBounds(clientArea);
- if (m_debug || LOG.isDebugEnabled()) {
- dumpLayoutInfo(parent);
- }
- // bounds
- int n = m_info.components.length;
- for (int i = 0; i < n; i++) {
- Control comp = m_info.components[i];
- LogicalGridData data = m_info.gridDatas[i];
- Rectangle r1 = cellBounds[data.gridy][data.gridx];
- Rectangle r2 = cellBounds[data.gridy + data.gridh - 1][data.gridx + data.gridw - 1];
- Rectangle r = r1.union(r2);
- if (data.topInset > 0) {
- r.y += data.topInset;
- r.height -= data.topInset;
- }
- if (data.fillHorizontal && data.fillVertical) {
- // ok
- }
- else {
- Point d = new Point(m_info.componentWidths[i], m_info.componentHeights[i]);
- if (!data.fillHorizontal) {
- if (d.x < r.width) {
- int delta = r.width - d.x;
- r.width = d.x;
- if (data.horizontalAlignment == 0) {
- r.x += delta / 2;
- }
- else if (data.horizontalAlignment > 0) {
- r.x += delta;
- }
- }
- }
- if (!data.fillVertical) {
- if (d.y < r.height) {
- int delta = r.height - d.y;
- if (data.heightHint == 0) {
- r.height = d.y;
- }
- else {
- r.height = data.heightHint;
- }
- if (data.verticalAlignment == 0) {
- r.y += delta / 2;
- }
- else if (data.verticalAlignment > 0) {
- r.y += delta;
- }
- }
- }
- }
- comp.setBounds(r);
- }
- }
-
- @Override
- public void setDebug(boolean b) {
- m_debug = b;
- }
-
- @Override
- public void dumpLayoutInfo(Composite parent) {
- dumpLayoutInfo(parent, new PrintWriter(System.out));
- }
-
- @Override
- public void dumpLayoutInfo(Composite parent, PrintWriter out) {
- Rectangle clientArea = parent.getClientArea();
- Rectangle[][] cellBounds = m_info.layoutCellBounds(clientArea);
- Object field = RwtScoutComposite.getScoutModelOnWidget(parent);
- String className = "undefined (PROP_SCOUT_OBJECT not set!)";
- if (field != null) {
- className = field.getClass().getSimpleName();
- }
- out.println("DUMP layout of: " + className + " compSize= " + clientArea);
- out.println(" containerBounds = " + parent.getClientArea());
- out.println(" Fields ---");
- for (int i = 0; i < m_info.components.length; i++) {
- Control c = m_info.components[i];
- LogicalGridData data = m_info.gridDatas[i];
- try {
- Rectangle r1 = cellBounds[data.gridy][data.gridx];
- Rectangle r2 = cellBounds[data.gridy + data.gridh - 1][data.gridx + data.gridw - 1];
- Rectangle r = r1.union(r2);
- String scoutObjectName = "NOT DEFINED";
- Object scoutObject = RwtScoutComposite.getScoutModelOnWidget(c);
- if (scoutObject != null) {
- scoutObjectName = scoutObject.getClass().getSimpleName();
- }
- out.println(" b=" + r + " " + scoutObjectName);
- if (scoutObject instanceof IFormField) {
- out.println(" model grid: " + ((IFormField) scoutObject).getGridData().toString());
- }
- out.println(" uiGridData: " + data.toString());
- }
- catch (ArrayIndexOutOfBoundsException e) {
- out.print("unable to print layout info of: " + data);
- e.printStackTrace();
- }
- }
- out.flush();
- }
-
- protected void validateLayout(Composite parent, int wHint, boolean flushCache) {
- if (wHint <= 0) {
- wHint = SWT.DEFAULT;
- }
- CompositeObject newKey = new CompositeObject(parent.getSize(), wHint == SWT.DEFAULT ? (m_infoCacheKey != null ? m_infoCacheKey.getComponent(1) : wHint) : wHint);
- //check cache key
- if (m_info != null) {
- if (m_infoCacheKey == null || !m_infoCacheKey.equals(newKey)) {
- m_info = null;
- m_infoCacheKey = null;
- }
- }
- if (m_info != null && m_infoCacheKey != null) {
- return;
- }
- ArrayList<Control> visibleComps = new ArrayList<Control>();
- ArrayList<LogicalGridData> visibleCons = new ArrayList<LogicalGridData>();
- for (Control comp : parent.getChildren()) {
- if (comp.getVisible() && comp.getLayoutData() instanceof LogicalGridData) {
- visibleComps.add(comp);
- LogicalGridData cons = (LogicalGridData) comp.getLayoutData();
- cons.validate();
- visibleCons.add(cons);
- }
- }
- m_info = new LogicalGridLayoutInfo(visibleComps.toArray(new Control[visibleComps.size()]), visibleCons.toArray(new LogicalGridData[visibleCons.size()]), m_hgap, m_vgap, wHint, flushCache);
- m_infoCacheKey = newKey;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap;
+
+import java.io.PrintWriter;
+import java.util.ArrayList;
+
+import org.eclipse.scout.commons.CompositeObject;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.ui.rap.basic.RwtScoutComposite;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Layout;
+
+/**
+ * Dynamic layout using logical grid data {@link LogicalGridData} to arrange
+ * fields. The grid data per field can be passed when adding the component to
+ * the container or set as client property with name {@link LogicalGridData#CLIENT_PROPERTY_NAME}.
+ */
+public class LogicalGridLayout extends Layout implements ILogicalGridLayout {
+ private static final long serialVersionUID = 1L;
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(LogicalGridLayout.class);
+
+ private boolean m_debug;
+ private int m_hgap;
+ private int m_vgap;
+ private LogicalGridLayoutInfo m_info;
+ private CompositeObject m_infoCacheKey;
+
+ public LogicalGridLayout(int hgap, int vgap) {
+ m_hgap = hgap;
+ m_vgap = vgap;
+ }
+
+ @Override
+ public int computeMinimumWidth(Composite parent, boolean changed) {
+ return computeMinimumSize(parent, changed).x;
+ }
+
+ @Override
+ public Point computeMinimumSize(Composite parent, boolean changed) {
+ return computeSize(parent, changed, SWT.DEFAULT, SWT.DEFAULT, MIN);
+ }
+
+ @Override
+ protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache) {
+ return computeSize(composite, flushCache, wHint, hHint, PREF);
+ }
+
+ @Override
+ public int computeMaximumWidth(Composite parent, boolean changed) {
+ return computeSize(parent, changed, SWT.DEFAULT, SWT.DEFAULT, MAX).x;
+ }
+
+ @Override
+ public Point computeSize(Composite composite, boolean changed, int wHint, int hHint, int sizeFlag) {
+ if (changed) {
+ m_info = null;
+ }
+ if (wHint <= 0) {
+ wHint = SWT.DEFAULT;
+ }
+ validateLayout(composite, wHint, changed);
+
+ Point min = new Point(0, 0);
+ Point pref = new Point(0, 0);
+ Point max = new Point(0, 0);
+ // w
+ int useCount = 0;
+ for (int i = 0; i < m_info.cols; i++) {
+ if (useCount > 0) {
+ min.x = min.x + m_hgap;
+ pref.x = pref.x + m_hgap;
+ max.x = max.x + m_hgap;
+ }
+ min.x = min.x + m_info.width[i][MIN];
+ pref.x = pref.x + m_info.width[i][PREF];
+ max.x = max.x + m_info.width[i][MAX];
+ useCount++;
+ }
+ // h
+ useCount = 0;
+ for (int i = 0; i < m_info.rows; i++) {
+ if (useCount > 0) {
+ min.y = min.y + m_vgap;
+ pref.y = pref.y + m_vgap;
+ max.y = max.y + m_vgap;
+ }
+ min.y = min.y + m_info.height[i][MIN];
+ pref.y = pref.y + m_info.height[i][PREF];
+ max.y = max.y + m_info.height[i][MAX];
+ useCount++;
+ }
+ Point size = new Point(0, 0);
+ switch (sizeFlag) {
+ case MIN:
+ size.x = min.x;
+ size.y = min.y;
+ break;
+ case MAX:
+ size.x = min.x;
+ size.y = min.y;
+ break;
+ default:
+ // adjust width
+ if (wHint == SWT.DEFAULT) {
+ size.x = pref.x;
+ }
+ else {
+ size.x = wHint;
+ size.x = Math.min(max.x, size.x);
+ size.x = Math.max(min.x, size.x);
+ }
+ // adjust heigth
+ if (hHint == SWT.DEFAULT) {
+ size.y = pref.y;
+ }
+ else {
+ size.y = hHint;
+ size.y = Math.min(max.y, size.y);
+ size.y = Math.max(min.y, size.y);
+ }
+ break;
+ }
+ return size;
+ }
+
+ @Override
+ protected void layout(Composite parent, boolean flushCache) {
+ if (flushCache) {
+ m_info = null;
+ }
+ validateLayout(parent, parent.getSize().x, flushCache);
+ Rectangle clientArea = parent.getClientArea();
+ Rectangle[][] cellBounds = m_info.layoutCellBounds(clientArea);
+ if (m_debug || LOG.isDebugEnabled()) {
+ dumpLayoutInfo(parent);
+ }
+ // bounds
+ int n = m_info.components.length;
+ for (int i = 0; i < n; i++) {
+ Control comp = m_info.components[i];
+ LogicalGridData data = m_info.gridDatas[i];
+ Rectangle r1 = cellBounds[data.gridy][data.gridx];
+ Rectangle r2 = cellBounds[data.gridy + data.gridh - 1][data.gridx + data.gridw - 1];
+ Rectangle r = r1.union(r2);
+ if (data.topInset > 0) {
+ r.y += data.topInset;
+ r.height -= data.topInset;
+ }
+ if (data.fillHorizontal && data.fillVertical) {
+ // ok
+ }
+ else {
+ Point d = new Point(m_info.componentWidths[i], m_info.componentHeights[i]);
+ if (!data.fillHorizontal) {
+ if (d.x < r.width) {
+ int delta = r.width - d.x;
+ r.width = d.x;
+ if (data.horizontalAlignment == 0) {
+ r.x += delta / 2;
+ }
+ else if (data.horizontalAlignment > 0) {
+ r.x += delta;
+ }
+ }
+ }
+ if (!data.fillVertical) {
+ if (d.y < r.height) {
+ int delta = r.height - d.y;
+ if (data.heightHint == 0) {
+ r.height = d.y;
+ }
+ else {
+ r.height = data.heightHint;
+ }
+ if (data.verticalAlignment == 0) {
+ r.y += delta / 2;
+ }
+ else if (data.verticalAlignment > 0) {
+ r.y += delta;
+ }
+ }
+ }
+ }
+ comp.setBounds(r);
+ }
+ }
+
+ @Override
+ public void setDebug(boolean b) {
+ m_debug = b;
+ }
+
+ @Override
+ public void dumpLayoutInfo(Composite parent) {
+ dumpLayoutInfo(parent, new PrintWriter(System.out));
+ }
+
+ @Override
+ public void dumpLayoutInfo(Composite parent, PrintWriter out) {
+ Rectangle clientArea = parent.getClientArea();
+ Rectangle[][] cellBounds = m_info.layoutCellBounds(clientArea);
+ Object field = RwtScoutComposite.getScoutModelOnWidget(parent);
+ String className = "undefined (PROP_SCOUT_OBJECT not set!)";
+ if (field != null) {
+ className = field.getClass().getSimpleName();
+ }
+ out.println("DUMP layout of: " + className + " compSize= " + clientArea);
+ out.println(" containerBounds = " + parent.getClientArea());
+ out.println(" Fields ---");
+ for (int i = 0; i < m_info.components.length; i++) {
+ Control c = m_info.components[i];
+ LogicalGridData data = m_info.gridDatas[i];
+ try {
+ Rectangle r1 = cellBounds[data.gridy][data.gridx];
+ Rectangle r2 = cellBounds[data.gridy + data.gridh - 1][data.gridx + data.gridw - 1];
+ Rectangle r = r1.union(r2);
+ String scoutObjectName = "NOT DEFINED";
+ Object scoutObject = RwtScoutComposite.getScoutModelOnWidget(c);
+ if (scoutObject != null) {
+ scoutObjectName = scoutObject.getClass().getSimpleName();
+ }
+ out.println(" b=" + r + " " + scoutObjectName);
+ if (scoutObject instanceof IFormField) {
+ out.println(" model grid: " + ((IFormField) scoutObject).getGridData().toString());
+ }
+ out.println(" uiGridData: " + data.toString());
+ }
+ catch (ArrayIndexOutOfBoundsException e) {
+ out.print("unable to print layout info of: " + data);
+ e.printStackTrace();
+ }
+ }
+ out.flush();
+ }
+
+ protected void validateLayout(Composite parent, int wHint, boolean flushCache) {
+ if (wHint <= 0) {
+ wHint = SWT.DEFAULT;
+ }
+ CompositeObject newKey = new CompositeObject(parent.getSize(), wHint == SWT.DEFAULT ? (m_infoCacheKey != null ? m_infoCacheKey.getComponent(1) : wHint) : wHint);
+ //check cache key
+ if (m_info != null) {
+ if (m_infoCacheKey == null || !m_infoCacheKey.equals(newKey)) {
+ m_info = null;
+ m_infoCacheKey = null;
+ }
+ }
+ if (m_info != null && m_infoCacheKey != null) {
+ return;
+ }
+ ArrayList<Control> visibleComps = new ArrayList<Control>();
+ ArrayList<LogicalGridData> visibleCons = new ArrayList<LogicalGridData>();
+ for (Control comp : parent.getChildren()) {
+ if (comp.getVisible() && comp.getLayoutData() instanceof LogicalGridData) {
+ visibleComps.add(comp);
+ LogicalGridData cons = (LogicalGridData) comp.getLayoutData();
+ cons.validate();
+ visibleCons.add(cons);
+ }
+ }
+ m_info = new LogicalGridLayoutInfo(visibleComps.toArray(new Control[visibleComps.size()]), visibleCons.toArray(new LogicalGridData[visibleCons.size()]), m_hgap, m_vgap, wHint, flushCache);
+ m_infoCacheKey = newKey;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/LogicalGridLayoutInfo.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/LogicalGridLayoutInfo.java
index ac64a19de3..3d30817c8b 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/LogicalGridLayoutInfo.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/LogicalGridLayoutInfo.java
@@ -1,522 +1,522 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap;
-
-import java.util.TreeSet;
-
-import org.eclipse.scout.rt.ui.rap.extension.IUiDecoration;
-import org.eclipse.scout.rt.ui.rap.extension.UiDecorationExtensionPoint;
-import org.eclipse.scout.rt.ui.rap.util.RwtLayoutUtility;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Control;
-
-class LogicalGridLayoutInfo {
- LogicalGridData[/* component count */] gridDatas;
- Control[/* component count */] components;
- int[/* component count */] componentWidths;
- int[/* component count */] componentHeights;
- private int m_hgap;
- private int m_vgap;
- private boolean m_flushCache;
- int cols; /* number of cells horizontally */
- int rows; /* number of cells vertically */
- int[/* column */][/* min,pref,max */] width;
- int[/* row */][/* min,pref,max */] height;
- int[/*column*/] widthHints;
- double[/* column */] weightX;
- double[/* row */] weightY;
-
- LogicalGridLayoutInfo(Control[] components, LogicalGridData[] cons, int hgap, int vgap, int wHint, boolean flushCache) {
- this.components = components;
- m_hgap = hgap;
- m_vgap = vgap;
- m_flushCache = flushCache;
- // create a modifiable copy of the grid datas
- this.gridDatas = new LogicalGridData[cons.length];
- for (int i = 0; i < cons.length; i++) {
- this.gridDatas[i] = new LogicalGridData(cons[i]);
- }
- if (components.length == 0) {
- this.cols = 0;
- this.rows = 0;
- this.width = new int[0][0];
- this.height = new int[0][0];
- this.weightX = new double[0];
- this.weightY = new double[0];
- return;
- }
- // eliminate unused rows and columns
- TreeSet<Integer> usedCols = new TreeSet<Integer>();
- TreeSet<Integer> usedRows = new TreeSet<Integer>();
- // ticket 86645 use member gridDatas instead of param cons
- for (LogicalGridData gd : gridDatas) {
- if (gd.gridx < 0) {
- gd.gridx = 0;
- }
- if (gd.gridy < 0) {
- gd.gridy = 0;
- }
- if (gd.gridw < 1) {
- gd.gridw = 1;
- }
- if (gd.gridh < 1) {
- gd.gridh = 1;
- }
- for (int x = gd.gridx; x < gd.gridx + gd.gridw; x++) {
- usedCols.add(x);
- }
- for (int y = gd.gridy; y < gd.gridy + gd.gridh; y++) {
- usedRows.add(y);
- }
- }
- int maxCol = usedCols.last();
- for (int x = maxCol; x >= 0; x--) {
- if (!usedCols.contains(x)) {
- // eliminate column
- // ticket 86645 use member gridDatas instead of param cons
- for (LogicalGridData gd : gridDatas) {
- if (gd.gridx > x) {
- gd.gridx--;
- }
- }
- }
- }
- int maxRow = usedRows.last();
- for (int y = maxRow; y >= 0; y--) {
- if (!usedRows.contains(y)) {
- // eliminate row
- // ticket 86645 use member gridDatas instead of param cons
- for (LogicalGridData gd : gridDatas) {
- if (gd.gridy > y) {
- // ticket 86645
- gd.gridy--;
- }
- }
- }
- }
- //
- this.componentWidths = new int[this.components.length];
- this.componentHeights = new int[this.components.length];
- this.cols = usedCols.size();
- this.rows = usedRows.size();
- this.width = new int[cols][3];
- this.height = new int[rows][3];
- this.weightX = new double[cols];
- this.weightY = new double[rows];
- initializeInfo(hgap, vgap, wHint);
- }
-
- private void initializeInfo(int hgap, int vgap, int wHint) {
- int compCount = components.length;
- //cleanup constraints
- for (int i = 0; i < compCount; i++) {
- LogicalGridData cons = gridDatas[i];
- if (cons.gridx < 0) {
- cons.gridx = 0;
- }
- if (cons.gridy < 0) {
- cons.gridy = 0;
- }
- if (cons.gridw < 1) {
- cons.gridw = 1;
- }
- if (cons.gridh < 1) {
- cons.gridh = 1;
- }
- if (cons.gridx >= cols) {
- cons.gridx = cols - 1;
- }
- if (cons.gridy >= rows) {
- cons.gridy = rows - 1;
- }
- if (cons.gridx + cons.gridw - 1 >= cols) {
- cons.gridw = cols - cons.gridx;
- }
- if (cons.gridy + cons.gridh >= rows) {
- cons.gridh = rows - cons.gridy;
- }
- }
- //layout first the widths then the heights
- //pass 1 only computes widths
- for (int i = 0; i < compCount; i++) {
- Control comp = components[i];
- LogicalGridData cons = gridDatas[i];
- if (cons.widthHint > 0) {
- componentWidths[i] = cons.widthHint;
- }
- else {
- componentWidths[i] = uiSizeInPixel(comp, SWT.DEFAULT, m_flushCache).x;
- }
- }
- initializeColumns(componentWidths, hgap);
- //pass 2 computes heights based on with hints (use pref width when hint is empty)
- if (wHint == SWT.DEFAULT) {
- widthHints = null;
- }
- else {
- widthHints = layoutSizes(wHint - Math.max(0, (cols - 1) * hgap), width, weightX);
- }
- for (int i = 0; i < compCount; i++) {
- Control comp = components[i];
- LogicalGridData cons = gridDatas[i];
- if (cons.heightHint > 0) {
- componentHeights[i] = cons.heightHint;
- }
- else {
- componentHeights[i] = uiSizeInPixel(comp, getWidthHint(cons), false).y;
- }
- }
- initializeRows(componentHeights, vgap);
- }
-
- private void initializeColumns(int[] compSize, int hgap) {
- int compCount = compSize.length;
- int[] prefWidths = new int[cols];
- boolean[] fixedWidths = new boolean[cols];
- for (int i = 0; i < compCount; i++) {
- LogicalGridData cons = gridDatas[i];
- if (cons.gridw == 1) {
- int prefw;
- if (cons.widthHint > 0) {
- prefw = cons.widthHint;
- }
- else if (cons.useUiWidth) {
- prefw = compSize[i];
- }
- else {
- prefw = logicalWidthInPixel(cons);
- }
- for (int j = cons.gridx; j < cons.gridx + cons.gridw && j < cols; j++) {
- prefWidths[j] = Math.max(prefWidths[j], prefw);
- if (cons.weightx == 0) {
- fixedWidths[j] = true;
- }
- }
- }
- }
- for (int i = 0; i < compCount; i++) {
- LogicalGridData cons = gridDatas[i];
- if (cons.gridw > 1) {
- int hSpan = cons.gridw;
- int spanWidth;
- int distWidth;
- // pref
- spanWidth = 0;
- for (int j = cons.gridx; j < cons.gridx + cons.gridw && j < cols; j++) {
- if (!fixedWidths[j]) {
- spanWidth += prefWidths[j];
- }
- }
- if (cons.widthHint > 0) {
- distWidth = cons.widthHint - spanWidth - (hSpan - 1) * hgap;
- }
- else if (cons.useUiWidth) {
- distWidth = compSize[i] - spanWidth - (hSpan - 1) * hgap;
- }
- else {
- distWidth = logicalWidthInPixel(cons) - spanWidth - (hSpan - 1) * hgap;
- }
- if (distWidth > 0) {
- int equalWidth = (distWidth + spanWidth) / hSpan;
- int remainder = (distWidth + spanWidth) % hSpan;
- int last = -1;
- for (int j = cons.gridx; j < cons.gridx + cons.gridw && j < cols; j++) {
- if (fixedWidths[j]) {
- prefWidths[last = j] = prefWidths[j];
- }
- else {
- prefWidths[last = j] = Math.max(equalWidth, prefWidths[j]);
- }
- if (cons.weightx == 0) {
- fixedWidths[j] = true;
- }
- }
- if (last > -1) {
- prefWidths[last] += remainder;
- }
- }
- }
- }
- for (int i = 0; i < cols; i++) {
- if (fixedWidths[i]) {
- width[i][LogicalGridLayout.MIN] = prefWidths[i];
- width[i][LogicalGridLayout.PREF] = prefWidths[i];
- width[i][LogicalGridLayout.MAX] = prefWidths[i];
- }
- else {
- width[i][LogicalGridLayout.MIN] = 15;// must be exactly 0!
- width[i][LogicalGridLayout.PREF] = prefWidths[i];
- width[i][LogicalGridLayout.MAX] = 10240;
- }
- }
- // averaged column weights, normalized so that sum of weights is equal to
- // 1.0
- for (int i = 0; i < cols; i++) {
- if (fixedWidths[i]) {
- weightX[i] = 0;
- }
- else {
- double weightSum = 0;
- int weightCount = 0;
- for (int k = 0; k < compCount; k++) {
- LogicalGridData cons = gridDatas[k];
- if (cons.weightx > 0 && cons.gridx <= i && i <= cons.gridx + cons.gridw - 1) {
- weightSum += cons.weightx / cons.gridw;
- weightCount++;
- }
- }
- weightX[i] = weightCount > 0 ? weightSum / weightCount : 0;
- }
- }
- double sumWeightX = 0;
- for (int i = 0; i < cols; i++) {
- sumWeightX += weightX[i];
- }
- if (sumWeightX >= 1e-6) {
- double f = 1.0 / sumWeightX;
- for (int i = 0; i < cols; i++) {
- weightX[i] = weightX[i] * f;
- }
- }
- }
-
- private void initializeRows(int[] compSize, int vgap) {
- int compCount = compSize.length;
- int[] prefHeights = new int[rows];
- boolean[] fixedHeights = new boolean[rows];
- for (int i = 0; i < compCount; i++) {
- LogicalGridData cons = gridDatas[i];
- if (cons.gridh == 1) {
- int prefh;
- if (cons.heightHint > 0) {
- prefh = cons.heightHint;
- }
- else if (cons.useUiHeight) {
- prefh = compSize[i];
- }
- else {
- prefh = logicalHeightInPixel(cons);
- }
- for (int j = cons.gridy; j < cons.gridy + cons.gridh && j < rows; j++) {
- prefHeights[j] = Math.max(prefHeights[j], prefh);
- if (cons.weighty == 0) {
- fixedHeights[j] = true;
- }
- }
- }
- }
- for (int i = 0; i < compCount; i++) {
- LogicalGridData cons = gridDatas[i];
- if (cons.gridh > 1) {
- int vspan = cons.gridh;
- int spanHeight;
- int distHeight;
- // pref
- spanHeight = 0;
- for (int j = cons.gridy; j < cons.gridy + cons.gridh && j < rows; j++) {
- spanHeight += prefHeights[j];
- }
- if (cons.heightHint > 0) {
- distHeight = cons.heightHint - spanHeight - (vspan - 1) * vgap;
- }
- else if (cons.useUiHeight) {
- distHeight = compSize[i] - spanHeight - (vspan - 1) * vgap;
- }
- else {
- distHeight = logicalHeightInPixel(cons) - spanHeight - (vspan - 1) * vgap;
- }
- if (distHeight > 0) {
- int equalHeight = (distHeight + spanHeight) / vspan;
- int remainder = (distHeight + spanHeight) % vspan;
- int last = -1;
- for (int j = cons.gridy; j < cons.gridy + cons.gridh && j < rows; j++) {
- prefHeights[last = j] = Math.max(equalHeight, prefHeights[j]);
- if (cons.weighty == 0) {
- fixedHeights[j] = true;
- }
- }
- if (last > -1) {
- prefHeights[last] += remainder;
- }
- }
- }
- }
- for (int i = 0; i < rows; i++) {
- if (fixedHeights[i]) {
- height[i][LogicalGridLayout.MIN] = prefHeights[i];
- height[i][LogicalGridLayout.PREF] = prefHeights[i];
- height[i][LogicalGridLayout.MAX] = prefHeights[i];
- }
- else {
- height[i][LogicalGridLayout.MIN] = 0;// must be exactly 0!
- height[i][LogicalGridLayout.PREF] = prefHeights[i];
- height[i][LogicalGridLayout.MAX] = 10240;
- }
- }
- // averaged row weights, normalized so that sum of weights is equal to 1.0
- for (int i = 0; i < rows; i++) {
- if (fixedHeights[i]) {
- weightY[i] = 0;
- }
- else {
- double weightSum = 0;
- int weightCount = 0;
- for (int k = 0; k < compCount; k++) {
- LogicalGridData cons = gridDatas[k];
- if (cons.weighty > 0 && cons.gridy <= i && i <= cons.gridy + cons.gridh - 1) {
- weightSum += cons.weighty / cons.gridh;
- weightCount++;
- }
- }
- weightY[i] = weightCount > 0 ? weightSum / weightCount : 0;
- }
- }
- double sumWeightY = 0;
- for (int i = 0; i < rows; i++) {
- sumWeightY += weightY[i];
- }
- if (sumWeightY >= 1e-6) {
- double f = 1.0 / sumWeightY;
- for (int i = 0; i < rows; i++) {
- weightY[i] = weightY[i] * f;
- }
- }
- }
-
- /**
- * calculate grid cells (gaps are not included in the grid cell bounds)
- */
- Rectangle[][] layoutCellBounds(Rectangle clientArea) {
- int[] w = layoutSizes(clientArea.width - Math.max(0, (cols - 1) * m_hgap), width, weightX);
- int[] h = layoutSizes(clientArea.height - Math.max(0, (rows - 1) * m_vgap), height, weightY);
- Rectangle[][] cellBounds = new Rectangle[rows][cols];
- int y = clientArea.y;
- for (int r = 0; r < cellBounds.length; r++) {
- int x = clientArea.x;
- for (int c = 0; c < cellBounds[r].length; c++) {
- cellBounds[r][c] = new Rectangle(x, y, w[c], h[r]);
- x += w[c];
- x += m_hgap;
- }
- y += h[r];
- y += m_vgap;
- }
- return cellBounds;
- }
-
- private int[] layoutSizes(int targetSize, int[][] sizes, double[] weights) {
- int[] outSizes = new int[sizes.length];
- if (targetSize <= 0) {
- return new int[sizes.length];
- }
- int sumSize = 0;
- float[] tmpWeight = new float[weights.length];
- float sumWeight = 0;
- for (int i = 0; i < sizes.length; i++) {
- outSizes[i] = sizes[i][LogicalGridLayout.PREF];
- sumSize += outSizes[i];
- tmpWeight[i] = (float) weights[i];
- /**
- * auto correction: if weight is 0 and min / max sizes are NOT equal then
- * set weight to 1; if weight<eps set it to 0
- */
- if (tmpWeight[i] < LogicalGridLayout.EPS) {
- if (sizes[i][LogicalGridLayout.MAX] > sizes[i][LogicalGridLayout.MIN]) {
- tmpWeight[i] = 1;
- }
- else {
- tmpWeight[i] = 0;
- }
- }
- sumWeight += tmpWeight[i];
- }
- // normalize weights
- if (sumWeight > 0) {
- for (int i = 0; i < tmpWeight.length; i++) {
- tmpWeight[i] = tmpWeight[i] / sumWeight;
- }
- }
- int deltaInt = targetSize - sumSize;
- // expand or shrink
- if (Math.abs(deltaInt) > 0) {
- // setup accumulators
- float[] accWeight = new float[tmpWeight.length];
- if (deltaInt > 0) {
- // expand
- boolean hasTargets = true;
- while (deltaInt > 0 && hasTargets) {
- hasTargets = false;
- for (int i = 0; i < outSizes.length && deltaInt > 0; i++) {
- if (tmpWeight[i] > 0 && outSizes[i] < sizes[i][LogicalGridLayout.MAX]) {
- hasTargets = true;
- accWeight[i] += tmpWeight[i];
- if (accWeight[i] > 0) {
- accWeight[i] -= 1;
- outSizes[i] += 1;
- deltaInt -= 1;
- }
- }
- }
- }
- }
- else {// delta<0
- // shrink
- boolean hasTargets = true;
- while (deltaInt < 0 && hasTargets) {
- hasTargets = false;
- for (int i = 0; i < outSizes.length && deltaInt < 0; i++) {
- if (tmpWeight[i] > 0 && outSizes[i] > sizes[i][LogicalGridLayout.MIN]) {
- hasTargets = true;
- accWeight[i] += tmpWeight[i];
- if (accWeight[i] > 0) {
- accWeight[i] -= 1;
- outSizes[i] -= 1;
- deltaInt += 1;
- }
- }
- }
- }
- }
- }
- return outSizes;
- }
-
- private int getWidthHint(LogicalGridData cons) {
- if (widthHints == null || cons == null) {
- return SWT.DEFAULT;
- }
- int tmp = (cons.gridw - 1) * m_hgap;
- for (int k = cons.gridx; k < cons.gridx + cons.gridw; k++) {
- if (k >= 0 && k < widthHints.length) {
- tmp += widthHints[k];
- }
- }
- return tmp;
- }
-
- private static int logicalWidthInPixel(LogicalGridData cons) {
- int gridW = cons.gridw;
- IUiDecoration deco = UiDecorationExtensionPoint.getLookAndFeel();
- return gridW * deco.getLogicalGridLayoutDefaultColumnWidth() + Math.max(0, gridW - 1) * deco.getLogicalGridLayoutHorizontalGap();
- }
-
- private static int logicalHeightInPixel(LogicalGridData cons) {
- int gridH = cons.gridh;
- IUiDecoration deco = UiDecorationExtensionPoint.getLookAndFeel();
- return gridH * deco.getLogicalGridLayoutRowHeight() + Math.max(0, gridH - 1) * deco.getLogicalGridLayoutVerticalGap();
- }
-
- private static Point uiSizeInPixel(Control c, int wHint, boolean flushCache) {
- return RwtLayoutUtility.computeSizeEx(c, wHint, SWT.DEFAULT, flushCache);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap;
+
+import java.util.TreeSet;
+
+import org.eclipse.scout.rt.ui.rap.extension.IUiDecoration;
+import org.eclipse.scout.rt.ui.rap.extension.UiDecorationExtensionPoint;
+import org.eclipse.scout.rt.ui.rap.util.RwtLayoutUtility;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Control;
+
+class LogicalGridLayoutInfo {
+ LogicalGridData[/* component count */] gridDatas;
+ Control[/* component count */] components;
+ int[/* component count */] componentWidths;
+ int[/* component count */] componentHeights;
+ private int m_hgap;
+ private int m_vgap;
+ private boolean m_flushCache;
+ int cols; /* number of cells horizontally */
+ int rows; /* number of cells vertically */
+ int[/* column */][/* min,pref,max */] width;
+ int[/* row */][/* min,pref,max */] height;
+ int[/*column*/] widthHints;
+ double[/* column */] weightX;
+ double[/* row */] weightY;
+
+ LogicalGridLayoutInfo(Control[] components, LogicalGridData[] cons, int hgap, int vgap, int wHint, boolean flushCache) {
+ this.components = components;
+ m_hgap = hgap;
+ m_vgap = vgap;
+ m_flushCache = flushCache;
+ // create a modifiable copy of the grid datas
+ this.gridDatas = new LogicalGridData[cons.length];
+ for (int i = 0; i < cons.length; i++) {
+ this.gridDatas[i] = new LogicalGridData(cons[i]);
+ }
+ if (components.length == 0) {
+ this.cols = 0;
+ this.rows = 0;
+ this.width = new int[0][0];
+ this.height = new int[0][0];
+ this.weightX = new double[0];
+ this.weightY = new double[0];
+ return;
+ }
+ // eliminate unused rows and columns
+ TreeSet<Integer> usedCols = new TreeSet<Integer>();
+ TreeSet<Integer> usedRows = new TreeSet<Integer>();
+ // ticket 86645 use member gridDatas instead of param cons
+ for (LogicalGridData gd : gridDatas) {
+ if (gd.gridx < 0) {
+ gd.gridx = 0;
+ }
+ if (gd.gridy < 0) {
+ gd.gridy = 0;
+ }
+ if (gd.gridw < 1) {
+ gd.gridw = 1;
+ }
+ if (gd.gridh < 1) {
+ gd.gridh = 1;
+ }
+ for (int x = gd.gridx; x < gd.gridx + gd.gridw; x++) {
+ usedCols.add(x);
+ }
+ for (int y = gd.gridy; y < gd.gridy + gd.gridh; y++) {
+ usedRows.add(y);
+ }
+ }
+ int maxCol = usedCols.last();
+ for (int x = maxCol; x >= 0; x--) {
+ if (!usedCols.contains(x)) {
+ // eliminate column
+ // ticket 86645 use member gridDatas instead of param cons
+ for (LogicalGridData gd : gridDatas) {
+ if (gd.gridx > x) {
+ gd.gridx--;
+ }
+ }
+ }
+ }
+ int maxRow = usedRows.last();
+ for (int y = maxRow; y >= 0; y--) {
+ if (!usedRows.contains(y)) {
+ // eliminate row
+ // ticket 86645 use member gridDatas instead of param cons
+ for (LogicalGridData gd : gridDatas) {
+ if (gd.gridy > y) {
+ // ticket 86645
+ gd.gridy--;
+ }
+ }
+ }
+ }
+ //
+ this.componentWidths = new int[this.components.length];
+ this.componentHeights = new int[this.components.length];
+ this.cols = usedCols.size();
+ this.rows = usedRows.size();
+ this.width = new int[cols][3];
+ this.height = new int[rows][3];
+ this.weightX = new double[cols];
+ this.weightY = new double[rows];
+ initializeInfo(hgap, vgap, wHint);
+ }
+
+ private void initializeInfo(int hgap, int vgap, int wHint) {
+ int compCount = components.length;
+ //cleanup constraints
+ for (int i = 0; i < compCount; i++) {
+ LogicalGridData cons = gridDatas[i];
+ if (cons.gridx < 0) {
+ cons.gridx = 0;
+ }
+ if (cons.gridy < 0) {
+ cons.gridy = 0;
+ }
+ if (cons.gridw < 1) {
+ cons.gridw = 1;
+ }
+ if (cons.gridh < 1) {
+ cons.gridh = 1;
+ }
+ if (cons.gridx >= cols) {
+ cons.gridx = cols - 1;
+ }
+ if (cons.gridy >= rows) {
+ cons.gridy = rows - 1;
+ }
+ if (cons.gridx + cons.gridw - 1 >= cols) {
+ cons.gridw = cols - cons.gridx;
+ }
+ if (cons.gridy + cons.gridh >= rows) {
+ cons.gridh = rows - cons.gridy;
+ }
+ }
+ //layout first the widths then the heights
+ //pass 1 only computes widths
+ for (int i = 0; i < compCount; i++) {
+ Control comp = components[i];
+ LogicalGridData cons = gridDatas[i];
+ if (cons.widthHint > 0) {
+ componentWidths[i] = cons.widthHint;
+ }
+ else {
+ componentWidths[i] = uiSizeInPixel(comp, SWT.DEFAULT, m_flushCache).x;
+ }
+ }
+ initializeColumns(componentWidths, hgap);
+ //pass 2 computes heights based on with hints (use pref width when hint is empty)
+ if (wHint == SWT.DEFAULT) {
+ widthHints = null;
+ }
+ else {
+ widthHints = layoutSizes(wHint - Math.max(0, (cols - 1) * hgap), width, weightX);
+ }
+ for (int i = 0; i < compCount; i++) {
+ Control comp = components[i];
+ LogicalGridData cons = gridDatas[i];
+ if (cons.heightHint > 0) {
+ componentHeights[i] = cons.heightHint;
+ }
+ else {
+ componentHeights[i] = uiSizeInPixel(comp, getWidthHint(cons), false).y;
+ }
+ }
+ initializeRows(componentHeights, vgap);
+ }
+
+ private void initializeColumns(int[] compSize, int hgap) {
+ int compCount = compSize.length;
+ int[] prefWidths = new int[cols];
+ boolean[] fixedWidths = new boolean[cols];
+ for (int i = 0; i < compCount; i++) {
+ LogicalGridData cons = gridDatas[i];
+ if (cons.gridw == 1) {
+ int prefw;
+ if (cons.widthHint > 0) {
+ prefw = cons.widthHint;
+ }
+ else if (cons.useUiWidth) {
+ prefw = compSize[i];
+ }
+ else {
+ prefw = logicalWidthInPixel(cons);
+ }
+ for (int j = cons.gridx; j < cons.gridx + cons.gridw && j < cols; j++) {
+ prefWidths[j] = Math.max(prefWidths[j], prefw);
+ if (cons.weightx == 0) {
+ fixedWidths[j] = true;
+ }
+ }
+ }
+ }
+ for (int i = 0; i < compCount; i++) {
+ LogicalGridData cons = gridDatas[i];
+ if (cons.gridw > 1) {
+ int hSpan = cons.gridw;
+ int spanWidth;
+ int distWidth;
+ // pref
+ spanWidth = 0;
+ for (int j = cons.gridx; j < cons.gridx + cons.gridw && j < cols; j++) {
+ if (!fixedWidths[j]) {
+ spanWidth += prefWidths[j];
+ }
+ }
+ if (cons.widthHint > 0) {
+ distWidth = cons.widthHint - spanWidth - (hSpan - 1) * hgap;
+ }
+ else if (cons.useUiWidth) {
+ distWidth = compSize[i] - spanWidth - (hSpan - 1) * hgap;
+ }
+ else {
+ distWidth = logicalWidthInPixel(cons) - spanWidth - (hSpan - 1) * hgap;
+ }
+ if (distWidth > 0) {
+ int equalWidth = (distWidth + spanWidth) / hSpan;
+ int remainder = (distWidth + spanWidth) % hSpan;
+ int last = -1;
+ for (int j = cons.gridx; j < cons.gridx + cons.gridw && j < cols; j++) {
+ if (fixedWidths[j]) {
+ prefWidths[last = j] = prefWidths[j];
+ }
+ else {
+ prefWidths[last = j] = Math.max(equalWidth, prefWidths[j]);
+ }
+ if (cons.weightx == 0) {
+ fixedWidths[j] = true;
+ }
+ }
+ if (last > -1) {
+ prefWidths[last] += remainder;
+ }
+ }
+ }
+ }
+ for (int i = 0; i < cols; i++) {
+ if (fixedWidths[i]) {
+ width[i][LogicalGridLayout.MIN] = prefWidths[i];
+ width[i][LogicalGridLayout.PREF] = prefWidths[i];
+ width[i][LogicalGridLayout.MAX] = prefWidths[i];
+ }
+ else {
+ width[i][LogicalGridLayout.MIN] = 15;// must be exactly 0!
+ width[i][LogicalGridLayout.PREF] = prefWidths[i];
+ width[i][LogicalGridLayout.MAX] = 10240;
+ }
+ }
+ // averaged column weights, normalized so that sum of weights is equal to
+ // 1.0
+ for (int i = 0; i < cols; i++) {
+ if (fixedWidths[i]) {
+ weightX[i] = 0;
+ }
+ else {
+ double weightSum = 0;
+ int weightCount = 0;
+ for (int k = 0; k < compCount; k++) {
+ LogicalGridData cons = gridDatas[k];
+ if (cons.weightx > 0 && cons.gridx <= i && i <= cons.gridx + cons.gridw - 1) {
+ weightSum += cons.weightx / cons.gridw;
+ weightCount++;
+ }
+ }
+ weightX[i] = weightCount > 0 ? weightSum / weightCount : 0;
+ }
+ }
+ double sumWeightX = 0;
+ for (int i = 0; i < cols; i++) {
+ sumWeightX += weightX[i];
+ }
+ if (sumWeightX >= 1e-6) {
+ double f = 1.0 / sumWeightX;
+ for (int i = 0; i < cols; i++) {
+ weightX[i] = weightX[i] * f;
+ }
+ }
+ }
+
+ private void initializeRows(int[] compSize, int vgap) {
+ int compCount = compSize.length;
+ int[] prefHeights = new int[rows];
+ boolean[] fixedHeights = new boolean[rows];
+ for (int i = 0; i < compCount; i++) {
+ LogicalGridData cons = gridDatas[i];
+ if (cons.gridh == 1) {
+ int prefh;
+ if (cons.heightHint > 0) {
+ prefh = cons.heightHint;
+ }
+ else if (cons.useUiHeight) {
+ prefh = compSize[i];
+ }
+ else {
+ prefh = logicalHeightInPixel(cons);
+ }
+ for (int j = cons.gridy; j < cons.gridy + cons.gridh && j < rows; j++) {
+ prefHeights[j] = Math.max(prefHeights[j], prefh);
+ if (cons.weighty == 0) {
+ fixedHeights[j] = true;
+ }
+ }
+ }
+ }
+ for (int i = 0; i < compCount; i++) {
+ LogicalGridData cons = gridDatas[i];
+ if (cons.gridh > 1) {
+ int vspan = cons.gridh;
+ int spanHeight;
+ int distHeight;
+ // pref
+ spanHeight = 0;
+ for (int j = cons.gridy; j < cons.gridy + cons.gridh && j < rows; j++) {
+ spanHeight += prefHeights[j];
+ }
+ if (cons.heightHint > 0) {
+ distHeight = cons.heightHint - spanHeight - (vspan - 1) * vgap;
+ }
+ else if (cons.useUiHeight) {
+ distHeight = compSize[i] - spanHeight - (vspan - 1) * vgap;
+ }
+ else {
+ distHeight = logicalHeightInPixel(cons) - spanHeight - (vspan - 1) * vgap;
+ }
+ if (distHeight > 0) {
+ int equalHeight = (distHeight + spanHeight) / vspan;
+ int remainder = (distHeight + spanHeight) % vspan;
+ int last = -1;
+ for (int j = cons.gridy; j < cons.gridy + cons.gridh && j < rows; j++) {
+ prefHeights[last = j] = Math.max(equalHeight, prefHeights[j]);
+ if (cons.weighty == 0) {
+ fixedHeights[j] = true;
+ }
+ }
+ if (last > -1) {
+ prefHeights[last] += remainder;
+ }
+ }
+ }
+ }
+ for (int i = 0; i < rows; i++) {
+ if (fixedHeights[i]) {
+ height[i][LogicalGridLayout.MIN] = prefHeights[i];
+ height[i][LogicalGridLayout.PREF] = prefHeights[i];
+ height[i][LogicalGridLayout.MAX] = prefHeights[i];
+ }
+ else {
+ height[i][LogicalGridLayout.MIN] = 0;// must be exactly 0!
+ height[i][LogicalGridLayout.PREF] = prefHeights[i];
+ height[i][LogicalGridLayout.MAX] = 10240;
+ }
+ }
+ // averaged row weights, normalized so that sum of weights is equal to 1.0
+ for (int i = 0; i < rows; i++) {
+ if (fixedHeights[i]) {
+ weightY[i] = 0;
+ }
+ else {
+ double weightSum = 0;
+ int weightCount = 0;
+ for (int k = 0; k < compCount; k++) {
+ LogicalGridData cons = gridDatas[k];
+ if (cons.weighty > 0 && cons.gridy <= i && i <= cons.gridy + cons.gridh - 1) {
+ weightSum += cons.weighty / cons.gridh;
+ weightCount++;
+ }
+ }
+ weightY[i] = weightCount > 0 ? weightSum / weightCount : 0;
+ }
+ }
+ double sumWeightY = 0;
+ for (int i = 0; i < rows; i++) {
+ sumWeightY += weightY[i];
+ }
+ if (sumWeightY >= 1e-6) {
+ double f = 1.0 / sumWeightY;
+ for (int i = 0; i < rows; i++) {
+ weightY[i] = weightY[i] * f;
+ }
+ }
+ }
+
+ /**
+ * calculate grid cells (gaps are not included in the grid cell bounds)
+ */
+ Rectangle[][] layoutCellBounds(Rectangle clientArea) {
+ int[] w = layoutSizes(clientArea.width - Math.max(0, (cols - 1) * m_hgap), width, weightX);
+ int[] h = layoutSizes(clientArea.height - Math.max(0, (rows - 1) * m_vgap), height, weightY);
+ Rectangle[][] cellBounds = new Rectangle[rows][cols];
+ int y = clientArea.y;
+ for (int r = 0; r < cellBounds.length; r++) {
+ int x = clientArea.x;
+ for (int c = 0; c < cellBounds[r].length; c++) {
+ cellBounds[r][c] = new Rectangle(x, y, w[c], h[r]);
+ x += w[c];
+ x += m_hgap;
+ }
+ y += h[r];
+ y += m_vgap;
+ }
+ return cellBounds;
+ }
+
+ private int[] layoutSizes(int targetSize, int[][] sizes, double[] weights) {
+ int[] outSizes = new int[sizes.length];
+ if (targetSize <= 0) {
+ return new int[sizes.length];
+ }
+ int sumSize = 0;
+ float[] tmpWeight = new float[weights.length];
+ float sumWeight = 0;
+ for (int i = 0; i < sizes.length; i++) {
+ outSizes[i] = sizes[i][LogicalGridLayout.PREF];
+ sumSize += outSizes[i];
+ tmpWeight[i] = (float) weights[i];
+ /**
+ * auto correction: if weight is 0 and min / max sizes are NOT equal then
+ * set weight to 1; if weight<eps set it to 0
+ */
+ if (tmpWeight[i] < LogicalGridLayout.EPS) {
+ if (sizes[i][LogicalGridLayout.MAX] > sizes[i][LogicalGridLayout.MIN]) {
+ tmpWeight[i] = 1;
+ }
+ else {
+ tmpWeight[i] = 0;
+ }
+ }
+ sumWeight += tmpWeight[i];
+ }
+ // normalize weights
+ if (sumWeight > 0) {
+ for (int i = 0; i < tmpWeight.length; i++) {
+ tmpWeight[i] = tmpWeight[i] / sumWeight;
+ }
+ }
+ int deltaInt = targetSize - sumSize;
+ // expand or shrink
+ if (Math.abs(deltaInt) > 0) {
+ // setup accumulators
+ float[] accWeight = new float[tmpWeight.length];
+ if (deltaInt > 0) {
+ // expand
+ boolean hasTargets = true;
+ while (deltaInt > 0 && hasTargets) {
+ hasTargets = false;
+ for (int i = 0; i < outSizes.length && deltaInt > 0; i++) {
+ if (tmpWeight[i] > 0 && outSizes[i] < sizes[i][LogicalGridLayout.MAX]) {
+ hasTargets = true;
+ accWeight[i] += tmpWeight[i];
+ if (accWeight[i] > 0) {
+ accWeight[i] -= 1;
+ outSizes[i] += 1;
+ deltaInt -= 1;
+ }
+ }
+ }
+ }
+ }
+ else {// delta<0
+ // shrink
+ boolean hasTargets = true;
+ while (deltaInt < 0 && hasTargets) {
+ hasTargets = false;
+ for (int i = 0; i < outSizes.length && deltaInt < 0; i++) {
+ if (tmpWeight[i] > 0 && outSizes[i] > sizes[i][LogicalGridLayout.MIN]) {
+ hasTargets = true;
+ accWeight[i] += tmpWeight[i];
+ if (accWeight[i] > 0) {
+ accWeight[i] -= 1;
+ outSizes[i] -= 1;
+ deltaInt += 1;
+ }
+ }
+ }
+ }
+ }
+ }
+ return outSizes;
+ }
+
+ private int getWidthHint(LogicalGridData cons) {
+ if (widthHints == null || cons == null) {
+ return SWT.DEFAULT;
+ }
+ int tmp = (cons.gridw - 1) * m_hgap;
+ for (int k = cons.gridx; k < cons.gridx + cons.gridw; k++) {
+ if (k >= 0 && k < widthHints.length) {
+ tmp += widthHints[k];
+ }
+ }
+ return tmp;
+ }
+
+ private static int logicalWidthInPixel(LogicalGridData cons) {
+ int gridW = cons.gridw;
+ IUiDecoration deco = UiDecorationExtensionPoint.getLookAndFeel();
+ return gridW * deco.getLogicalGridLayoutDefaultColumnWidth() + Math.max(0, gridW - 1) * deco.getLogicalGridLayoutHorizontalGap();
+ }
+
+ private static int logicalHeightInPixel(LogicalGridData cons) {
+ int gridH = cons.gridh;
+ IUiDecoration deco = UiDecorationExtensionPoint.getLookAndFeel();
+ return gridH * deco.getLogicalGridLayoutRowHeight() + Math.max(0, gridH - 1) * deco.getLogicalGridLayoutVerticalGap();
+ }
+
+ private static Point uiSizeInPixel(Control c, int wHint, boolean flushCache) {
+ return RwtLayoutUtility.computeSizeEx(c, wHint, SWT.DEFAULT, flushCache);
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/RwtApplication.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/RwtApplication.java
index f0d7beffef..0ff46a0e53 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/RwtApplication.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/RwtApplication.java
@@ -1,26 +1,26 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap;
-
-import org.eclipse.equinox.app.IApplication;
-import org.eclipse.equinox.app.IApplicationContext;
-
-public class RwtApplication implements IApplication {
-
- @Override
- public Object start(final IApplicationContext context) throws Exception {
- return EXIT_OK;
- }
-
- @Override
- public void stop() {
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap;
+
+import org.eclipse.equinox.app.IApplication;
+import org.eclipse.equinox.app.IApplicationContext;
+
+public class RwtApplication implements IApplication {
+
+ @Override
+ public Object start(final IApplicationContext context) throws Exception {
+ return EXIT_OK;
+ }
+
+ @Override
+ public void stop() {
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/RwtEnvironmentEvent.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/RwtEnvironmentEvent.java
index a49cef85bc..cc71257c51 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/RwtEnvironmentEvent.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/RwtEnvironmentEvent.java
@@ -1,43 +1,43 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap;
-
-import java.util.EventObject;
-
-/**
- * <h3>EnvironmentEvent</h3> ...
- *
- * @since 3.7.0 June 2011
- */
-public class RwtEnvironmentEvent extends EventObject {
- public static final int INACTIVE = 0x00;
- public static final int STARTING = 0x01;
- public static final int STARTED = 0x02;
- public static final int STOPPING = 0x04;
- public static final int STOPPED = 0x08;
-
- private static final long serialVersionUID = 1L;
- private final int m_type;
-
- public RwtEnvironmentEvent(IRwtEnvironment source, int type) {
- super(source);
- m_type = type;
- }
-
- @Override
- public IRwtEnvironment getSource() {
- return (IRwtEnvironment) super.getSource();
- }
-
- public int getType() {
- return m_type;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap;
+
+import java.util.EventObject;
+
+/**
+ * <h3>EnvironmentEvent</h3> ...
+ *
+ * @since 3.7.0 June 2011
+ */
+public class RwtEnvironmentEvent extends EventObject {
+ public static final int INACTIVE = 0x00;
+ public static final int STARTING = 0x01;
+ public static final int STARTED = 0x02;
+ public static final int STOPPING = 0x04;
+ public static final int STOPPED = 0x08;
+
+ private static final long serialVersionUID = 1L;
+ private final int m_type;
+
+ public RwtEnvironmentEvent(IRwtEnvironment source, int type) {
+ super(source);
+ m_type = type;
+ }
+
+ @Override
+ public IRwtEnvironment getSource() {
+ return (IRwtEnvironment) super.getSource();
+ }
+
+ public int getType() {
+ return m_type;
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/RwtIcons.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/RwtIcons.java
index 96776e1536..25d40cac66 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/RwtIcons.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/RwtIcons.java
@@ -1,20 +1,20 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap;
-
-/**
- * These are icons that are only used in the UI i.e. they appear nowhere in the model code.
- */
-public interface RwtIcons {
- String DropDownFieldArrowDown = "dropdownfield_arrowdown";
- String CheckboxYes = "checkbox_yes";
- String CheckboxNo = "checkbox_no";
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap;
+
+/**
+ * These are icons that are only used in the UI i.e. they appear nowhere in the model code.
+ */
+public interface RwtIcons {
+ String DropDownFieldArrowDown = "dropdownfield_arrowdown";
+ String CheckboxYes = "checkbox_yes";
+ String CheckboxNo = "checkbox_no";
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/RwtMenuUtility.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/RwtMenuUtility.java
index a553bb7bb0..e40ea66963 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/RwtMenuUtility.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/RwtMenuUtility.java
@@ -1,352 +1,352 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IContributionItem;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.scout.commons.job.JobEx;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.action.IAction;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.action.menu.checkbox.ICheckBoxMenu;
-import org.eclipse.scout.rt.client.ui.action.tree.IActionNode;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITree;
-import org.eclipse.scout.rt.ui.rap.action.RwtScoutAction;
-import org.eclipse.scout.rt.ui.rap.action.RwtScoutCheckboxMenu;
-import org.eclipse.scout.rt.ui.rap.action.RwtScoutMenuAction;
-import org.eclipse.scout.rt.ui.rap.action.RwtScoutMenuGroup;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-
-public final class RwtMenuUtility {
- private static IScoutLogger LOG = ScoutLogManager.getLogger(RwtMenuUtility.class);
-
- private RwtMenuUtility() {
- }
-
- public static IContributionItem[] getMenuContribution(IActionNode<?>[] scoutActionNodes, IRwtEnvironment uiEnvironment) {
- ArrayList<IContributionItem> contributionItems = new ArrayList<IContributionItem>();
- for (IActionNode<?> scoutAction : scoutActionNodes) {
- if (scoutAction.isVisible()) {
- if (scoutAction.isSeparator()) {
- if (!(contributionItems.size() > 0 && contributionItems.get(contributionItems.size() - 1).isSeparator())) {
- contributionItems.add(new Separator());
- }
- }
- else if (scoutAction.hasChildActions()) {
- IMenuManager manager = new MenuManager(scoutAction.getText(), scoutAction.getActionId());
- fillMenuManager(scoutAction.getChildActions().toArray(new IActionNode<?>[scoutAction.getChildActionCount()]), uiEnvironment, manager);
- contributionItems.add(manager);
- }
- else if (scoutAction instanceof ICheckBoxMenu) {
- contributionItems.add(new ActionContributionItem(new RwtScoutAction(scoutAction, uiEnvironment, SWT.CHECK).getUiAction()));
- }
- else {
- contributionItems.add(new ActionContributionItem(new RwtScoutAction(scoutAction, uiEnvironment).getUiAction()));
- }
- }
- }
- return contributionItems.toArray(new IContributionItem[contributionItems.size()]);
- }
-
- public static IContributionItem getMenuContributionItem(IActionNode<?> scoutAction, IRwtEnvironment uiEnvironment) {
- IContributionItem item = null;
- if (scoutAction.isVisible()) {
- if (scoutAction.isSeparator()) {
- item = new Separator();
- }
- else if (scoutAction.hasChildActions()) {
- IMenuManager manager = new MenuManager(scoutAction.getText(), scoutAction.getActionId());
- fillMenuManager(scoutAction.getChildActions().toArray(new IActionNode<?>[scoutAction.getChildActionCount()]), uiEnvironment, manager);
- item = manager;
- }
- else if (scoutAction instanceof ICheckBoxMenu) {
- item = new ActionContributionItem(new RwtScoutAction(scoutAction, uiEnvironment, SWT.CHECK).getUiAction());
- }
- else {
- item = new ActionContributionItem(new RwtScoutAction(scoutAction, uiEnvironment).getUiAction());
- }
- }
- return item;
- }
-
- private static void fillMenuManager(IActionNode<?>[] scoutActionNodes, IRwtEnvironment uiEnvironment, IMenuManager manager) {
- for (IActionNode<?> scoutAction : scoutActionNodes) {
- if (scoutAction.isVisible()) {
- if (scoutAction.isSeparator()) {
- if (manager.getItems().length > 0 && manager.getItems()[manager.getItems().length - 1].isSeparator()) {
-
- }
- else {
- manager.add(new Separator());
- }
- }
- else if (scoutAction.hasChildActions()) {
- IMenuManager childManager = new MenuManager(scoutAction.getText(), scoutAction.getActionId());
- fillMenuManager(scoutAction.getChildActions().toArray(new IActionNode<?>[scoutAction.getChildActionCount()]), uiEnvironment, childManager);
- manager.add(childManager);
- }
- else if (scoutAction instanceof ICheckBoxMenu) {
- manager.add(new ActionContributionItem(new RwtScoutAction(scoutAction, uiEnvironment, SWT.CHECK).getUiAction()));
- }
- else {
- manager.add(new ActionContributionItem(new RwtScoutAction(scoutAction, uiEnvironment).getUiAction()));
- }
- }
- }
- }
-
- public static void fillContextMenu(IMenu[] scoutMenus, IRwtEnvironment uiEnvironment, Menu menu) {
- if (scoutMenus == null || scoutMenus.length == 0) {
- menu.setVisible(false);
- return;
- }
-
- List<IActionNode> scoutActionNodes = new LinkedList<IActionNode>();
- for (IMenu scoutMenu : scoutMenus) {
- scoutActionNodes.add(scoutMenu);
- }
-
- fillContextMenu(scoutActionNodes, uiEnvironment, menu);
- }
-
- public static void fillContextMenu(List<? extends IActionNode> scoutActionNodes, IRwtEnvironment uiEnvironment, Menu menu) {
- if (scoutActionNodes == null || scoutActionNodes.size() == 0) {
- menu.setVisible(false);
- return;
- }
-
- List<IActionNode> cleanedScoutActions = cleanup(scoutActionNodes);
- for (IActionNode scoutActionNode : cleanedScoutActions) {
- fillContextMenuRec(scoutActionNode, uiEnvironment, menu);
- }
-
- }
-
- private static void fillContextMenuRec(IActionNode<?> scoutActionNode, IRwtEnvironment uiEnvironment, Menu menu) {
- if (!scoutActionNode.isVisible()) {
- return;
- }
- if (scoutActionNode.isSeparator()) {
- new MenuItem(menu, SWT.SEPARATOR);
- }
- else if (scoutActionNode instanceof ICheckBoxMenu) {
- new RwtScoutCheckboxMenu(menu, (ICheckBoxMenu) scoutActionNode, uiEnvironment);
-
- }
- else if (scoutActionNode.getChildActionCount() > 0) {
- RwtScoutMenuGroup group = new RwtScoutMenuGroup(menu, scoutActionNode, uiEnvironment);
- Menu subMenu = new Menu(menu);
- group.getUiMenuItem().setMenu(subMenu);
- List<IActionNode> childActions = cleanup(scoutActionNode.getChildActions());
- for (IActionNode<?> subAction : childActions) {
- fillContextMenuRec(subAction, uiEnvironment, subMenu);
- }
- }
- else {
- new RwtScoutMenuAction(menu, scoutActionNode, uiEnvironment);
- }
- }
-
- public static IMenu[] collectMenus(final ITree tree, final boolean emptySpaceActions, final boolean nodeActions, IRwtEnvironment uiEnvironment) {
- final List<IMenu> menuList = new LinkedList<IMenu>();
- Runnable t = new Runnable() {
- @Override
- public void run() {
- if (emptySpaceActions) {
- menuList.addAll(Arrays.asList(tree.getUIFacade().fireEmptySpacePopupFromUI()));
- }
- if (nodeActions) {
- menuList.addAll(Arrays.asList(tree.getUIFacade().fireNodePopupFromUI()));
- }
- }
- };
-
- JobEx job = uiEnvironment.invokeScoutLater(t, 5000);
- try {
- job.join(1200);
- }
- catch (InterruptedException ex) {
- LOG.warn("Exception occured while collecting menus.", ex);
- }
-
- return menuList.toArray(new IMenu[menuList.size()]);
- }
-
- public static IMenu[] collectMenus(final ITable table, final boolean emptySpaceActions, final boolean rowActions, IRwtEnvironment uiEnvironment) {
- final List<IMenu> menuList = new LinkedList<IMenu>();
- Runnable t = new Runnable() {
- @Override
- public void run() {
- if (emptySpaceActions) {
- menuList.addAll(Arrays.asList(table.getUIFacade().fireEmptySpacePopupFromUI()));
- }
- if (rowActions) {
- menuList.addAll(Arrays.asList(table.getUIFacade().fireRowPopupFromUI()));
- }
- }
- };
-
- JobEx job = uiEnvironment.invokeScoutLater(t, 5000);
- try {
- job.join(1200);
- }
- catch (InterruptedException ex) {
- LOG.warn("Exception occured while collecting menus.", ex);
- }
-
- return menuList.toArray(new IMenu[menuList.size()]);
- }
-
- public static IMenu[] collectRowMenus(final ITable table, IRwtEnvironment uiEnvironment) {
- return collectMenus(table, false, true, uiEnvironment);
- }
-
- public static IMenu[] collectEmptySpaceMenus(final ITable table, IRwtEnvironment uiEnvironment) {
- return collectMenus(table, true, false, uiEnvironment);
- }
-
- public static IMenu[] collectNodeMenus(final ITree tree, IRwtEnvironment uiEnvironment) {
- return collectMenus(tree, false, true, uiEnvironment);
- }
-
- public static IMenu[] collectEmptySpaceMenus(final ITree tree, IRwtEnvironment uiEnvironment) {
- return collectMenus(tree, true, false, uiEnvironment);
- }
-
- /**
- * Splits the menus in groups, separated by the {@link IActionNode#isSeparator()}
- */
- public static List<List<IMenu>> split(IMenu[] unseparatedMenus) {
- List<List<IMenu>> separatedMenus = new LinkedList<List<IMenu>>();
-
- List<IMenu> menus = new LinkedList<IMenu>();
- for (IMenu menu : unseparatedMenus) {
- if (menu.isSeparator()) {
- separatedMenus.add(menus);
- menus = new LinkedList<IMenu>();
- }
- else {
- menus.add(menu);
- }
- }
-
- if (!separatedMenus.contains(menus)) {
- separatedMenus.add(menus);
- }
-
- return separatedMenus;
- }
-
- /**
- * Removes invisible actions. Also removes leading and trailing separators as well as multiple consecutive separators.
- *
- * @since 3.8.1
- */
- public static List<IActionNode> cleanup(List<? extends IActionNode> scoutActionNodes) {
- if (scoutActionNodes == null) {
- return null;
- }
-
- List<IActionNode> cleanedActions = new LinkedList<IActionNode>();
- for (int i = 0; i < scoutActionNodes.size(); i++) {
- IActionNode actionNode = scoutActionNodes.get(i);
- //Ignore invisible actions
- if (!actionNode.isVisible()) {
- continue;
- }
- if (actionNode.isSeparator()) {
- //Ignore leading and trailing separators
- if (i == 0 || i == scoutActionNodes.size() - 1) {
- continue;
- }
- //Ignore multiple consecutive separators
- IAction nextVisibleAction = getFirstVisibleAction(scoutActionNodes, i + 1);
- if (nextVisibleAction == null || nextVisibleAction.isSeparator()) {
- continue;
- }
- }
-
- cleanedActions.add(actionNode);
- }
-
- return cleanedActions;
- }
-
- private static IAction getFirstVisibleAction(List<? extends IActionNode> scoutActionNodes, int startIndex) {
- if (scoutActionNodes == null) {
- return null;
- }
-
- for (int i = startIndex; i < scoutActionNodes.size(); i++) {
- IActionNode action = scoutActionNodes.get(i);
- if (action.isVisible()) {
- return action;
- }
- }
-
- return null;
- }
-
- public static boolean hasChildActions(IAction action) {
- if (!(action instanceof IActionNode<?>)) {
- return false;
- }
-
- IActionNode<? extends IActionNode> actionNode = (IActionNode<?>) action;
- return actionNode.hasChildActions();
- }
-
- public static boolean hasVisibleChildActions(IAction action) {
- if (!(action instanceof IActionNode<?>)) {
- return false;
- }
-
- IActionNode<? extends IActionNode> actionNode = (IActionNode<?>) action;
- for (IActionNode child : actionNode.getChildActions()) {
- if (child.isVisible()) {
- return true;
- }
-
- if (child.hasChildActions()) {
- if (hasVisibleChildActions(child)) {
- return true;
- }
- }
- }
-
- return false;
- }
-
- public static List<? extends IActionNode> getChildActions(IAction action) {
- if (!(action instanceof IActionNode<?>)) {
- return null;
- }
-
- IActionNode<? extends IActionNode> actionNode = (IActionNode<?>) action;
- if (!actionNode.hasChildActions()) {
- return null;
- }
-
- return actionNode.getChildActions();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.jface.action.ActionContributionItem;
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.scout.commons.job.JobEx;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.action.IAction;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.action.menu.checkbox.ICheckBoxMenu;
+import org.eclipse.scout.rt.client.ui.action.tree.IActionNode;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITree;
+import org.eclipse.scout.rt.ui.rap.action.RwtScoutAction;
+import org.eclipse.scout.rt.ui.rap.action.RwtScoutCheckboxMenu;
+import org.eclipse.scout.rt.ui.rap.action.RwtScoutMenuAction;
+import org.eclipse.scout.rt.ui.rap.action.RwtScoutMenuGroup;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+
+public final class RwtMenuUtility {
+ private static IScoutLogger LOG = ScoutLogManager.getLogger(RwtMenuUtility.class);
+
+ private RwtMenuUtility() {
+ }
+
+ public static IContributionItem[] getMenuContribution(IActionNode<?>[] scoutActionNodes, IRwtEnvironment uiEnvironment) {
+ ArrayList<IContributionItem> contributionItems = new ArrayList<IContributionItem>();
+ for (IActionNode<?> scoutAction : scoutActionNodes) {
+ if (scoutAction.isVisible()) {
+ if (scoutAction.isSeparator()) {
+ if (!(contributionItems.size() > 0 && contributionItems.get(contributionItems.size() - 1).isSeparator())) {
+ contributionItems.add(new Separator());
+ }
+ }
+ else if (scoutAction.hasChildActions()) {
+ IMenuManager manager = new MenuManager(scoutAction.getText(), scoutAction.getActionId());
+ fillMenuManager(scoutAction.getChildActions().toArray(new IActionNode<?>[scoutAction.getChildActionCount()]), uiEnvironment, manager);
+ contributionItems.add(manager);
+ }
+ else if (scoutAction instanceof ICheckBoxMenu) {
+ contributionItems.add(new ActionContributionItem(new RwtScoutAction(scoutAction, uiEnvironment, SWT.CHECK).getUiAction()));
+ }
+ else {
+ contributionItems.add(new ActionContributionItem(new RwtScoutAction(scoutAction, uiEnvironment).getUiAction()));
+ }
+ }
+ }
+ return contributionItems.toArray(new IContributionItem[contributionItems.size()]);
+ }
+
+ public static IContributionItem getMenuContributionItem(IActionNode<?> scoutAction, IRwtEnvironment uiEnvironment) {
+ IContributionItem item = null;
+ if (scoutAction.isVisible()) {
+ if (scoutAction.isSeparator()) {
+ item = new Separator();
+ }
+ else if (scoutAction.hasChildActions()) {
+ IMenuManager manager = new MenuManager(scoutAction.getText(), scoutAction.getActionId());
+ fillMenuManager(scoutAction.getChildActions().toArray(new IActionNode<?>[scoutAction.getChildActionCount()]), uiEnvironment, manager);
+ item = manager;
+ }
+ else if (scoutAction instanceof ICheckBoxMenu) {
+ item = new ActionContributionItem(new RwtScoutAction(scoutAction, uiEnvironment, SWT.CHECK).getUiAction());
+ }
+ else {
+ item = new ActionContributionItem(new RwtScoutAction(scoutAction, uiEnvironment).getUiAction());
+ }
+ }
+ return item;
+ }
+
+ private static void fillMenuManager(IActionNode<?>[] scoutActionNodes, IRwtEnvironment uiEnvironment, IMenuManager manager) {
+ for (IActionNode<?> scoutAction : scoutActionNodes) {
+ if (scoutAction.isVisible()) {
+ if (scoutAction.isSeparator()) {
+ if (manager.getItems().length > 0 && manager.getItems()[manager.getItems().length - 1].isSeparator()) {
+
+ }
+ else {
+ manager.add(new Separator());
+ }
+ }
+ else if (scoutAction.hasChildActions()) {
+ IMenuManager childManager = new MenuManager(scoutAction.getText(), scoutAction.getActionId());
+ fillMenuManager(scoutAction.getChildActions().toArray(new IActionNode<?>[scoutAction.getChildActionCount()]), uiEnvironment, childManager);
+ manager.add(childManager);
+ }
+ else if (scoutAction instanceof ICheckBoxMenu) {
+ manager.add(new ActionContributionItem(new RwtScoutAction(scoutAction, uiEnvironment, SWT.CHECK).getUiAction()));
+ }
+ else {
+ manager.add(new ActionContributionItem(new RwtScoutAction(scoutAction, uiEnvironment).getUiAction()));
+ }
+ }
+ }
+ }
+
+ public static void fillContextMenu(IMenu[] scoutMenus, IRwtEnvironment uiEnvironment, Menu menu) {
+ if (scoutMenus == null || scoutMenus.length == 0) {
+ menu.setVisible(false);
+ return;
+ }
+
+ List<IActionNode> scoutActionNodes = new LinkedList<IActionNode>();
+ for (IMenu scoutMenu : scoutMenus) {
+ scoutActionNodes.add(scoutMenu);
+ }
+
+ fillContextMenu(scoutActionNodes, uiEnvironment, menu);
+ }
+
+ public static void fillContextMenu(List<? extends IActionNode> scoutActionNodes, IRwtEnvironment uiEnvironment, Menu menu) {
+ if (scoutActionNodes == null || scoutActionNodes.size() == 0) {
+ menu.setVisible(false);
+ return;
+ }
+
+ List<IActionNode> cleanedScoutActions = cleanup(scoutActionNodes);
+ for (IActionNode scoutActionNode : cleanedScoutActions) {
+ fillContextMenuRec(scoutActionNode, uiEnvironment, menu);
+ }
+
+ }
+
+ private static void fillContextMenuRec(IActionNode<?> scoutActionNode, IRwtEnvironment uiEnvironment, Menu menu) {
+ if (!scoutActionNode.isVisible()) {
+ return;
+ }
+ if (scoutActionNode.isSeparator()) {
+ new MenuItem(menu, SWT.SEPARATOR);
+ }
+ else if (scoutActionNode instanceof ICheckBoxMenu) {
+ new RwtScoutCheckboxMenu(menu, (ICheckBoxMenu) scoutActionNode, uiEnvironment);
+
+ }
+ else if (scoutActionNode.getChildActionCount() > 0) {
+ RwtScoutMenuGroup group = new RwtScoutMenuGroup(menu, scoutActionNode, uiEnvironment);
+ Menu subMenu = new Menu(menu);
+ group.getUiMenuItem().setMenu(subMenu);
+ List<IActionNode> childActions = cleanup(scoutActionNode.getChildActions());
+ for (IActionNode<?> subAction : childActions) {
+ fillContextMenuRec(subAction, uiEnvironment, subMenu);
+ }
+ }
+ else {
+ new RwtScoutMenuAction(menu, scoutActionNode, uiEnvironment);
+ }
+ }
+
+ public static IMenu[] collectMenus(final ITree tree, final boolean emptySpaceActions, final boolean nodeActions, IRwtEnvironment uiEnvironment) {
+ final List<IMenu> menuList = new LinkedList<IMenu>();
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ if (emptySpaceActions) {
+ menuList.addAll(Arrays.asList(tree.getUIFacade().fireEmptySpacePopupFromUI()));
+ }
+ if (nodeActions) {
+ menuList.addAll(Arrays.asList(tree.getUIFacade().fireNodePopupFromUI()));
+ }
+ }
+ };
+
+ JobEx job = uiEnvironment.invokeScoutLater(t, 5000);
+ try {
+ job.join(1200);
+ }
+ catch (InterruptedException ex) {
+ LOG.warn("Exception occured while collecting menus.", ex);
+ }
+
+ return menuList.toArray(new IMenu[menuList.size()]);
+ }
+
+ public static IMenu[] collectMenus(final ITable table, final boolean emptySpaceActions, final boolean rowActions, IRwtEnvironment uiEnvironment) {
+ final List<IMenu> menuList = new LinkedList<IMenu>();
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ if (emptySpaceActions) {
+ menuList.addAll(Arrays.asList(table.getUIFacade().fireEmptySpacePopupFromUI()));
+ }
+ if (rowActions) {
+ menuList.addAll(Arrays.asList(table.getUIFacade().fireRowPopupFromUI()));
+ }
+ }
+ };
+
+ JobEx job = uiEnvironment.invokeScoutLater(t, 5000);
+ try {
+ job.join(1200);
+ }
+ catch (InterruptedException ex) {
+ LOG.warn("Exception occured while collecting menus.", ex);
+ }
+
+ return menuList.toArray(new IMenu[menuList.size()]);
+ }
+
+ public static IMenu[] collectRowMenus(final ITable table, IRwtEnvironment uiEnvironment) {
+ return collectMenus(table, false, true, uiEnvironment);
+ }
+
+ public static IMenu[] collectEmptySpaceMenus(final ITable table, IRwtEnvironment uiEnvironment) {
+ return collectMenus(table, true, false, uiEnvironment);
+ }
+
+ public static IMenu[] collectNodeMenus(final ITree tree, IRwtEnvironment uiEnvironment) {
+ return collectMenus(tree, false, true, uiEnvironment);
+ }
+
+ public static IMenu[] collectEmptySpaceMenus(final ITree tree, IRwtEnvironment uiEnvironment) {
+ return collectMenus(tree, true, false, uiEnvironment);
+ }
+
+ /**
+ * Splits the menus in groups, separated by the {@link IActionNode#isSeparator()}
+ */
+ public static List<List<IMenu>> split(IMenu[] unseparatedMenus) {
+ List<List<IMenu>> separatedMenus = new LinkedList<List<IMenu>>();
+
+ List<IMenu> menus = new LinkedList<IMenu>();
+ for (IMenu menu : unseparatedMenus) {
+ if (menu.isSeparator()) {
+ separatedMenus.add(menus);
+ menus = new LinkedList<IMenu>();
+ }
+ else {
+ menus.add(menu);
+ }
+ }
+
+ if (!separatedMenus.contains(menus)) {
+ separatedMenus.add(menus);
+ }
+
+ return separatedMenus;
+ }
+
+ /**
+ * Removes invisible actions. Also removes leading and trailing separators as well as multiple consecutive separators.
+ *
+ * @since 3.8.1
+ */
+ public static List<IActionNode> cleanup(List<? extends IActionNode> scoutActionNodes) {
+ if (scoutActionNodes == null) {
+ return null;
+ }
+
+ List<IActionNode> cleanedActions = new LinkedList<IActionNode>();
+ for (int i = 0; i < scoutActionNodes.size(); i++) {
+ IActionNode actionNode = scoutActionNodes.get(i);
+ //Ignore invisible actions
+ if (!actionNode.isVisible()) {
+ continue;
+ }
+ if (actionNode.isSeparator()) {
+ //Ignore leading and trailing separators
+ if (i == 0 || i == scoutActionNodes.size() - 1) {
+ continue;
+ }
+ //Ignore multiple consecutive separators
+ IAction nextVisibleAction = getFirstVisibleAction(scoutActionNodes, i + 1);
+ if (nextVisibleAction == null || nextVisibleAction.isSeparator()) {
+ continue;
+ }
+ }
+
+ cleanedActions.add(actionNode);
+ }
+
+ return cleanedActions;
+ }
+
+ private static IAction getFirstVisibleAction(List<? extends IActionNode> scoutActionNodes, int startIndex) {
+ if (scoutActionNodes == null) {
+ return null;
+ }
+
+ for (int i = startIndex; i < scoutActionNodes.size(); i++) {
+ IActionNode action = scoutActionNodes.get(i);
+ if (action.isVisible()) {
+ return action;
+ }
+ }
+
+ return null;
+ }
+
+ public static boolean hasChildActions(IAction action) {
+ if (!(action instanceof IActionNode<?>)) {
+ return false;
+ }
+
+ IActionNode<? extends IActionNode> actionNode = (IActionNode<?>) action;
+ return actionNode.hasChildActions();
+ }
+
+ public static boolean hasVisibleChildActions(IAction action) {
+ if (!(action instanceof IActionNode<?>)) {
+ return false;
+ }
+
+ IActionNode<? extends IActionNode> actionNode = (IActionNode<?>) action;
+ for (IActionNode child : actionNode.getChildActions()) {
+ if (child.isVisible()) {
+ return true;
+ }
+
+ if (child.hasChildActions()) {
+ if (hasVisibleChildActions(child)) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ public static List<? extends IActionNode> getChildActions(IAction action) {
+ if (!(action instanceof IActionNode<?>)) {
+ return null;
+ }
+
+ IActionNode<? extends IActionNode> actionNode = (IActionNode<?>) action;
+ if (!actionNode.hasChildActions()) {
+ return null;
+ }
+
+ return actionNode.getChildActions();
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/RwtShellValidateRoot.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/RwtShellValidateRoot.java
index 457fb08763..926b2a8743 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/RwtShellValidateRoot.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/RwtShellValidateRoot.java
@@ -1,62 +1,62 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.ui.rap;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * Responsible for resizing the height of a RWT Shell to its preferred size.
- */
-public class RwtShellValidateRoot extends DefaultValidateRoot {
-
- private final IRwtEnvironment m_env;
-
- public RwtShellValidateRoot(Shell root, IRwtEnvironment env) {
- super(root);
- if (env == null) {
- throw new IllegalArgumentException("environment cannot be null.");
- }
- m_env = env;
- }
-
- private Shell getShell() {
- return (Shell) getUiComposite();
- }
-
- protected IRwtEnvironment getEnvironment() {
- return m_env;
- }
-
- protected boolean isActive() {
- return getShell() == getEnvironment().getDisplay().getActiveShell();
- }
-
- @Override
- public void validate() {
- if (getShell() == null || getShell().isDisposed() || !getShell().isVisible() || !isActive()) {
- return;
- }
- super.validate();
- Rectangle curShellBounds = getShell().getBounds();
- Point prefSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
-
- int dhPref = 0;
- if (curShellBounds != null && prefSize != null) {
- dhPref = prefSize.y - curShellBounds.height;
- if (dhPref > 0) {
- getShell().setBounds(new Rectangle(curShellBounds.x, curShellBounds.y, curShellBounds.width, prefSize.y));
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.ui.rap;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * Responsible for resizing the height of a RWT Shell to its preferred size.
+ */
+public class RwtShellValidateRoot extends DefaultValidateRoot {
+
+ private final IRwtEnvironment m_env;
+
+ public RwtShellValidateRoot(Shell root, IRwtEnvironment env) {
+ super(root);
+ if (env == null) {
+ throw new IllegalArgumentException("environment cannot be null.");
+ }
+ m_env = env;
+ }
+
+ private Shell getShell() {
+ return (Shell) getUiComposite();
+ }
+
+ protected IRwtEnvironment getEnvironment() {
+ return m_env;
+ }
+
+ protected boolean isActive() {
+ return getShell() == getEnvironment().getDisplay().getActiveShell();
+ }
+
+ @Override
+ public void validate() {
+ if (getShell() == null || getShell().isDisposed() || !getShell().isVisible() || !isActive()) {
+ return;
+ }
+ super.validate();
+ Rectangle curShellBounds = getShell().getBounds();
+ Point prefSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
+
+ int dhPref = 0;
+ if (curShellBounds != null && prefSize != null) {
+ dhPref = prefSize.y - curShellBounds.height;
+ if (dhPref > 0) {
+ getShell().setBounds(new Rectangle(curShellBounds.x, curShellBounds.y, curShellBounds.width, prefSize.y));
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/action/AbstractRwtMenuAction.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/action/AbstractRwtMenuAction.java
index be39d072ed..72552de3ea 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/action/AbstractRwtMenuAction.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/action/AbstractRwtMenuAction.java
@@ -1,263 +1,263 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.action;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.action.IAction;
-import org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke;
-import org.eclipse.scout.rt.client.ui.action.keystroke.KeyStroke;
-import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
-import org.eclipse.scout.rt.ui.rap.keystroke.IRwtKeyStroke;
-import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-
-public class AbstractRwtMenuAction {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractRwtMenuAction.class);
-
- private final IAction m_scoutAction;
- private final IRwtEnvironment m_uiEnvironment;
-
- private boolean m_initialized;
- private boolean m_connectedToScout;
- private P_ScoutPropertyChangeListener m_scoutPropertyListener;
-
- private MenuItem m_uiMenuItem;
- private final Menu m_uiMenu;
- // cache
- private IRwtKeyStroke[] m_uiKeyStrokes;
-
- private SelectionListener m_menuSelectionListener;
-
- public AbstractRwtMenuAction(Menu uiMenu, IAction scoutAction, IRwtEnvironment uiEnvironment, boolean createInitial) {
- m_uiMenu = uiMenu;
- m_scoutAction = scoutAction;
- m_uiEnvironment = uiEnvironment;
- if (createInitial) {
- callInitializers(m_uiMenu);
- }
-
- m_uiMenu.addDisposeListener(new DisposeListener() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void widgetDisposed(DisposeEvent event) {
- disconnectFromScout();
- }
- });
- }
-
- protected final void callInitializers(Menu menu) {
- if (m_initialized) {
- return;
- }
- else {
- m_initialized = true;
- //
- initializeUi(menu);
- connectToScout();
- }
- }
-
- protected final void connectToScout() {
- if (!m_connectedToScout) {
- attachScoutListeners();
- applyScoutProperties();
- m_connectedToScout = true;
- }
- }
-
- protected final void disconnectFromScout() {
- if (m_connectedToScout) {
- detachScoutListeners();
- m_connectedToScout = false;
- }
- }
-
- protected void attachScoutListeners() {
- if (m_scoutPropertyListener == null) {
- m_scoutPropertyListener = new P_ScoutPropertyChangeListener();
- m_scoutAction.addPropertyChangeListener(m_scoutPropertyListener);
- }
- }
-
- protected void detachScoutListeners() {
- if (m_scoutPropertyListener != null) {
- m_scoutAction.removePropertyChangeListener(m_scoutPropertyListener);
- m_scoutPropertyListener = null;
- }
- }
-
- protected void applyScoutProperties() {
- IAction scoutAction = getScoutAction();
- setEnabledFromScout(scoutAction.isEnabled());
- setTextFromScout(scoutAction.getText());
- setTooltipTextFromScout(scoutAction.getTooltipText());
- // setMnemonicFromScout(scoutAction.getMnemonic());
- setIconFromScout(scoutAction.getIconId());
- updateKeyStrokeFromScout();
- }
-
- protected void setIconFromScout(String iconId) {
- if (!getUiMenuItem().isDisposed()) {
- getUiMenuItem().setImage(getUiEnvironment().getIcon(iconId));
- }
- }
-
- protected void setTooltipTextFromScout(String tooltipText) {
- if (!StringUtility.isNullOrEmpty(tooltipText)) {
- LOG.warn("unsuported method on rwt");
- }
- }
-
- protected void setTextFromScout(String text) {
- if (getUiMenuItem().isDisposed()) {
- return;
- }
-
- if (text == null) {
- text = "";
- }
-
- getUiMenuItem().setText(text);
- }
-
- protected void setEnabledFromScout(boolean enabled) {
- if (!getUiMenuItem().isDisposed()) {
- getUiMenuItem().setEnabled(enabled);
- }
- }
-
- protected void updateKeyStrokeFromScout() {
- // remove old
- if (m_uiKeyStrokes != null) {
- for (IRwtKeyStroke uiStroke : m_uiKeyStrokes) {
- getUiEnvironment().removeGlobalKeyStroke(uiStroke);
- }
- }
- m_uiKeyStrokes = null;
- if (getScoutAction().getKeyStroke() != null) {
- IKeyStroke scoutKeyStroke = new KeyStroke(getScoutAction().getKeyStroke());
- m_uiKeyStrokes = RwtUtility.getKeyStrokes(scoutKeyStroke, getUiEnvironment());
- for (IRwtKeyStroke uiStroke : m_uiKeyStrokes) {
- getUiEnvironment().addGlobalKeyStroke(uiStroke, false);
- }
- }
- }
-
- protected void initializeUi(Menu menu) {
- }
-
- public IAction getScoutAction() {
- return m_scoutAction;
- }
-
- protected IRwtEnvironment getUiEnvironment() {
- return m_uiEnvironment;
- }
-
- public MenuItem getUiMenuItem() {
- return m_uiMenuItem;
- }
-
- public void setUiMenuItem(MenuItem uiMenuItem) {
- if (m_uiMenuItem != null) {
- m_uiMenuItem.removeSelectionListener(m_menuSelectionListener);
- }
- m_uiMenuItem = uiMenuItem;
- if (m_menuSelectionListener == null) {
- m_menuSelectionListener = new P_UiMenuItemSelectionListener();
- }
-
- m_uiMenuItem.addSelectionListener(m_menuSelectionListener);
- }
-
- protected Menu getMenu() {
- return m_uiMenu;
- }
-
- private void handleUiAction() {
- Runnable t = new Runnable() {
- @Override
- public void run() {
- getScoutAction().getUIFacade().fireActionFromUI();
- }
- };
- getUiEnvironment().invokeScoutLater(t, 0);
- }
-
- private boolean isHandleScoutPropertyChange(String propertyName, Object newValue) {
- return true;
- }
-
- /**
- * in rwt thread
- */
- protected void handleScoutPropertyChange(String name, Object newValue) {
- if (name.equals(IAction.PROP_ENABLED)) {
- setEnabledFromScout(((Boolean) newValue).booleanValue());
- }
- else if (name.equals(IAction.PROP_TEXT)) {
- setTextFromScout((String) newValue);
- }
- else if (name.equals(IAction.PROP_TOOLTIP_TEXT)) {
- setTooltipTextFromScout((String) newValue);
- }
- else if (name.equals(IAction.PROP_ICON_ID)) {
- setIconFromScout((String) newValue);
- }
- else if (name.equals(IAction.PROP_KEYSTROKE)) {
- updateKeyStrokeFromScout();
- }
- }
-
- private class P_ScoutPropertyChangeListener implements PropertyChangeListener {
- @Override
- public void propertyChange(final PropertyChangeEvent e) {
- if (isHandleScoutPropertyChange(e.getPropertyName(), e.getNewValue())) {
- Runnable t = new Runnable() {
- @Override
- public void run() {
- handleScoutPropertyChange(e.getPropertyName(), e.getNewValue());
- }
-
- };
- getUiEnvironment().invokeUiLater(t);
- }
- }
-
- }// end private class
-
- private class P_UiMenuItemSelectionListener extends SelectionAdapter {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- handleUiAction();
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- // TODO Auto-generated method stub
- super.widgetDefaultSelected(e);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.action;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.action.IAction;
+import org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke;
+import org.eclipse.scout.rt.client.ui.action.keystroke.KeyStroke;
+import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
+import org.eclipse.scout.rt.ui.rap.keystroke.IRwtKeyStroke;
+import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+
+public class AbstractRwtMenuAction {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractRwtMenuAction.class);
+
+ private final IAction m_scoutAction;
+ private final IRwtEnvironment m_uiEnvironment;
+
+ private boolean m_initialized;
+ private boolean m_connectedToScout;
+ private P_ScoutPropertyChangeListener m_scoutPropertyListener;
+
+ private MenuItem m_uiMenuItem;
+ private final Menu m_uiMenu;
+ // cache
+ private IRwtKeyStroke[] m_uiKeyStrokes;
+
+ private SelectionListener m_menuSelectionListener;
+
+ public AbstractRwtMenuAction(Menu uiMenu, IAction scoutAction, IRwtEnvironment uiEnvironment, boolean createInitial) {
+ m_uiMenu = uiMenu;
+ m_scoutAction = scoutAction;
+ m_uiEnvironment = uiEnvironment;
+ if (createInitial) {
+ callInitializers(m_uiMenu);
+ }
+
+ m_uiMenu.addDisposeListener(new DisposeListener() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void widgetDisposed(DisposeEvent event) {
+ disconnectFromScout();
+ }
+ });
+ }
+
+ protected final void callInitializers(Menu menu) {
+ if (m_initialized) {
+ return;
+ }
+ else {
+ m_initialized = true;
+ //
+ initializeUi(menu);
+ connectToScout();
+ }
+ }
+
+ protected final void connectToScout() {
+ if (!m_connectedToScout) {
+ attachScoutListeners();
+ applyScoutProperties();
+ m_connectedToScout = true;
+ }
+ }
+
+ protected final void disconnectFromScout() {
+ if (m_connectedToScout) {
+ detachScoutListeners();
+ m_connectedToScout = false;
+ }
+ }
+
+ protected void attachScoutListeners() {
+ if (m_scoutPropertyListener == null) {
+ m_scoutPropertyListener = new P_ScoutPropertyChangeListener();
+ m_scoutAction.addPropertyChangeListener(m_scoutPropertyListener);
+ }
+ }
+
+ protected void detachScoutListeners() {
+ if (m_scoutPropertyListener != null) {
+ m_scoutAction.removePropertyChangeListener(m_scoutPropertyListener);
+ m_scoutPropertyListener = null;
+ }
+ }
+
+ protected void applyScoutProperties() {
+ IAction scoutAction = getScoutAction();
+ setEnabledFromScout(scoutAction.isEnabled());
+ setTextFromScout(scoutAction.getText());
+ setTooltipTextFromScout(scoutAction.getTooltipText());
+ // setMnemonicFromScout(scoutAction.getMnemonic());
+ setIconFromScout(scoutAction.getIconId());
+ updateKeyStrokeFromScout();
+ }
+
+ protected void setIconFromScout(String iconId) {
+ if (!getUiMenuItem().isDisposed()) {
+ getUiMenuItem().setImage(getUiEnvironment().getIcon(iconId));
+ }
+ }
+
+ protected void setTooltipTextFromScout(String tooltipText) {
+ if (!StringUtility.isNullOrEmpty(tooltipText)) {
+ LOG.warn("unsuported method on rwt");
+ }
+ }
+
+ protected void setTextFromScout(String text) {
+ if (getUiMenuItem().isDisposed()) {
+ return;
+ }
+
+ if (text == null) {
+ text = "";
+ }
+
+ getUiMenuItem().setText(text);
+ }
+
+ protected void setEnabledFromScout(boolean enabled) {
+ if (!getUiMenuItem().isDisposed()) {
+ getUiMenuItem().setEnabled(enabled);
+ }
+ }
+
+ protected void updateKeyStrokeFromScout() {
+ // remove old
+ if (m_uiKeyStrokes != null) {
+ for (IRwtKeyStroke uiStroke : m_uiKeyStrokes) {
+ getUiEnvironment().removeGlobalKeyStroke(uiStroke);
+ }
+ }
+ m_uiKeyStrokes = null;
+ if (getScoutAction().getKeyStroke() != null) {
+ IKeyStroke scoutKeyStroke = new KeyStroke(getScoutAction().getKeyStroke());
+ m_uiKeyStrokes = RwtUtility.getKeyStrokes(scoutKeyStroke, getUiEnvironment());
+ for (IRwtKeyStroke uiStroke : m_uiKeyStrokes) {
+ getUiEnvironment().addGlobalKeyStroke(uiStroke, false);
+ }
+ }
+ }
+
+ protected void initializeUi(Menu menu) {
+ }
+
+ public IAction getScoutAction() {
+ return m_scoutAction;
+ }
+
+ protected IRwtEnvironment getUiEnvironment() {
+ return m_uiEnvironment;
+ }
+
+ public MenuItem getUiMenuItem() {
+ return m_uiMenuItem;
+ }
+
+ public void setUiMenuItem(MenuItem uiMenuItem) {
+ if (m_uiMenuItem != null) {
+ m_uiMenuItem.removeSelectionListener(m_menuSelectionListener);
+ }
+ m_uiMenuItem = uiMenuItem;
+ if (m_menuSelectionListener == null) {
+ m_menuSelectionListener = new P_UiMenuItemSelectionListener();
+ }
+
+ m_uiMenuItem.addSelectionListener(m_menuSelectionListener);
+ }
+
+ protected Menu getMenu() {
+ return m_uiMenu;
+ }
+
+ private void handleUiAction() {
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ getScoutAction().getUIFacade().fireActionFromUI();
+ }
+ };
+ getUiEnvironment().invokeScoutLater(t, 0);
+ }
+
+ private boolean isHandleScoutPropertyChange(String propertyName, Object newValue) {
+ return true;
+ }
+
+ /**
+ * in rwt thread
+ */
+ protected void handleScoutPropertyChange(String name, Object newValue) {
+ if (name.equals(IAction.PROP_ENABLED)) {
+ setEnabledFromScout(((Boolean) newValue).booleanValue());
+ }
+ else if (name.equals(IAction.PROP_TEXT)) {
+ setTextFromScout((String) newValue);
+ }
+ else if (name.equals(IAction.PROP_TOOLTIP_TEXT)) {
+ setTooltipTextFromScout((String) newValue);
+ }
+ else if (name.equals(IAction.PROP_ICON_ID)) {
+ setIconFromScout((String) newValue);
+ }
+ else if (name.equals(IAction.PROP_KEYSTROKE)) {
+ updateKeyStrokeFromScout();
+ }
+ }
+
+ private class P_ScoutPropertyChangeListener implements PropertyChangeListener {
+ @Override
+ public void propertyChange(final PropertyChangeEvent e) {
+ if (isHandleScoutPropertyChange(e.getPropertyName(), e.getNewValue())) {
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ handleScoutPropertyChange(e.getPropertyName(), e.getNewValue());
+ }
+
+ };
+ getUiEnvironment().invokeUiLater(t);
+ }
+ }
+
+ }// end private class
+
+ private class P_UiMenuItemSelectionListener extends SelectionAdapter {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ handleUiAction();
+ }
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // TODO Auto-generated method stub
+ super.widgetDefaultSelected(e);
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/action/RwtScoutAction.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/action/RwtScoutAction.java
index 91caa43716..10fe942ac2 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/action/RwtScoutAction.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/action/RwtScoutAction.java
@@ -1,138 +1,138 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.action;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.action.IAction;
-import org.eclipse.scout.rt.client.ui.action.keystroke.KeyStroke;
-import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
-import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
-import org.eclipse.swt.SWT;
-
-/**
- * <h3>RwtScoutAction</h3> ...
- *
- * @since 3.7.0 June 2011
- */
-public class RwtScoutAction {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(RwtScoutAction.class);
-
- private static final Map<String, String> KEY_STROKE_MAP;
-
- private final IAction m_scoutAction;
- private final Action m_uiAction;
- private final IRwtEnvironment m_uiEnvironment;
-
- //ticket 86811: avoid double-action in queue
- private boolean m_handleActionPending;
-
- static {
- KEY_STROKE_MAP = new HashMap<String, String>(12);
- //build keyStroke map
- for (int i = 1; i <= 12; i++) {
- KEY_STROKE_MAP.put("SHIFT-F" + i, "Shift-F" + i);
- }
- }
-
- public RwtScoutAction(IAction scoutAction, IRwtEnvironment uiEnvironment) {
- this(scoutAction, uiEnvironment, SWT.PUSH);
- }
-
- public RwtScoutAction(IAction scoutAction, IRwtEnvironment uiEnvironment, int style) {
- m_scoutAction = scoutAction;
- m_uiEnvironment = uiEnvironment;
- m_uiAction = new P_RwtAction(style);
- // init
- String keyStroke = m_scoutAction.getKeyStroke();
- if (StringUtility.hasText(keyStroke)) {
- // '@' sign is used as delimiter for shortcut text
- m_uiAction.setText(m_scoutAction.getText() + "@" + lookupKeyStrokeText(keyStroke));
- }
- else {
- m_uiAction.setText(m_scoutAction.getText());
- }
- m_uiAction.setToolTipText(m_scoutAction.getTooltipText());
- m_uiAction.setImageDescriptor(getUiEnvironment().getImageDescriptor(m_scoutAction.getIconId()));
-
- setKeyStrokeFromScout(keyStroke);
- }
-
- protected void handleUiAction() {
- //XXX
- /*if (getScoutAction().getClass().getSimpleName().equals("ImoMenu")) {
- ImoDevDialog d = new ImoDevDialog();
- d.open();
- return;
- }*/
-
- if (!m_handleActionPending) {
- m_handleActionPending = true;
- Runnable job = new Runnable() {
- @Override
- public void run() {
- try {
- getScoutAction().getUIFacade().fireActionFromUI();
- }
- finally {
- m_handleActionPending = false;
- }
- }
- };
- getUiEnvironment().invokeScoutLater(job, 0);
- }
- }
-
- public IAction getScoutAction() {
- return m_scoutAction;
- }
-
- public Action getUiAction() {
- return m_uiAction;
- }
-
- protected IRwtEnvironment getUiEnvironment() {
- return m_uiEnvironment;
- }
-
- private class P_RwtAction extends Action {
- private static final long serialVersionUID = 1L;
-
- P_RwtAction(int style) {
- super("", style);
- }
-
- @Override
- public void run() {
- handleUiAction();
- }
- } // end P_RwtAction
-
- private void setKeyStrokeFromScout(String keyStroke) {
- if (keyStroke != null) {
- int keyCode = RwtUtility.getRwtKeyCode(new KeyStroke(keyStroke));
- int stateMask = RwtUtility.getRwtStateMask(new KeyStroke(keyStroke));
- getUiAction().setAccelerator(stateMask | keyCode);
- }
- else {
- getUiAction().setAccelerator(SWT.NONE);
- }
- }
-
- private String lookupKeyStrokeText(String keyStroke) {
- return KEY_STROKE_MAP.get(keyStroke.toUpperCase());
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.action;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.action.IAction;
+import org.eclipse.scout.rt.client.ui.action.keystroke.KeyStroke;
+import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
+import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
+import org.eclipse.swt.SWT;
+
+/**
+ * <h3>RwtScoutAction</h3> ...
+ *
+ * @since 3.7.0 June 2011
+ */
+public class RwtScoutAction {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(RwtScoutAction.class);
+
+ private static final Map<String, String> KEY_STROKE_MAP;
+
+ private final IAction m_scoutAction;
+ private final Action m_uiAction;
+ private final IRwtEnvironment m_uiEnvironment;
+
+ //ticket 86811: avoid double-action in queue
+ private boolean m_handleActionPending;
+
+ static {
+ KEY_STROKE_MAP = new HashMap<String, String>(12);
+ //build keyStroke map
+ for (int i = 1; i <= 12; i++) {
+ KEY_STROKE_MAP.put("SHIFT-F" + i, "Shift-F" + i);
+ }
+ }
+
+ public RwtScoutAction(IAction scoutAction, IRwtEnvironment uiEnvironment) {
+ this(scoutAction, uiEnvironment, SWT.PUSH);
+ }
+
+ public RwtScoutAction(IAction scoutAction, IRwtEnvironment uiEnvironment, int style) {
+ m_scoutAction = scoutAction;
+ m_uiEnvironment = uiEnvironment;
+ m_uiAction = new P_RwtAction(style);
+ // init
+ String keyStroke = m_scoutAction.getKeyStroke();
+ if (StringUtility.hasText(keyStroke)) {
+ // '@' sign is used as delimiter for shortcut text
+ m_uiAction.setText(m_scoutAction.getText() + "@" + lookupKeyStrokeText(keyStroke));
+ }
+ else {
+ m_uiAction.setText(m_scoutAction.getText());
+ }
+ m_uiAction.setToolTipText(m_scoutAction.getTooltipText());
+ m_uiAction.setImageDescriptor(getUiEnvironment().getImageDescriptor(m_scoutAction.getIconId()));
+
+ setKeyStrokeFromScout(keyStroke);
+ }
+
+ protected void handleUiAction() {
+ //XXX
+ /*if (getScoutAction().getClass().getSimpleName().equals("ImoMenu")) {
+ ImoDevDialog d = new ImoDevDialog();
+ d.open();
+ return;
+ }*/
+
+ if (!m_handleActionPending) {
+ m_handleActionPending = true;
+ Runnable job = new Runnable() {
+ @Override
+ public void run() {
+ try {
+ getScoutAction().getUIFacade().fireActionFromUI();
+ }
+ finally {
+ m_handleActionPending = false;
+ }
+ }
+ };
+ getUiEnvironment().invokeScoutLater(job, 0);
+ }
+ }
+
+ public IAction getScoutAction() {
+ return m_scoutAction;
+ }
+
+ public Action getUiAction() {
+ return m_uiAction;
+ }
+
+ protected IRwtEnvironment getUiEnvironment() {
+ return m_uiEnvironment;
+ }
+
+ private class P_RwtAction extends Action {
+ private static final long serialVersionUID = 1L;
+
+ P_RwtAction(int style) {
+ super("", style);
+ }
+
+ @Override
+ public void run() {
+ handleUiAction();
+ }
+ } // end P_RwtAction
+
+ private void setKeyStrokeFromScout(String keyStroke) {
+ if (keyStroke != null) {
+ int keyCode = RwtUtility.getRwtKeyCode(new KeyStroke(keyStroke));
+ int stateMask = RwtUtility.getRwtStateMask(new KeyStroke(keyStroke));
+ getUiAction().setAccelerator(stateMask | keyCode);
+ }
+ else {
+ getUiAction().setAccelerator(SWT.NONE);
+ }
+ }
+
+ private String lookupKeyStrokeText(String keyStroke) {
+ return KEY_STROKE_MAP.get(keyStroke.toUpperCase());
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/action/RwtScoutCheckboxMenu.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/action/RwtScoutCheckboxMenu.java
index 7fb8f408dd..5fd46daf33 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/action/RwtScoutCheckboxMenu.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/action/RwtScoutCheckboxMenu.java
@@ -1,54 +1,54 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.action;
-
-import org.eclipse.scout.rt.client.ui.action.menu.checkbox.ICheckBoxMenu;
-import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-
-public class RwtScoutCheckboxMenu extends AbstractRwtMenuAction {
-
- public RwtScoutCheckboxMenu(Menu uiMenu, ICheckBoxMenu scoutMenu, IRwtEnvironment uiEnvironment) {
- super(uiMenu, scoutMenu, uiEnvironment, true);
- }
-
- @Override
- protected void initializeUi(Menu uiMenu) {
- MenuItem item = new MenuItem(uiMenu, SWT.CHECK);
- setUiMenuItem(item);
- }
-
- @Override
- protected void applyScoutProperties() {
- super.applyScoutProperties();
- setSelectedFromScout();
- }
-
- private void setSelectedFromScout() {
- if (!getUiMenuItem().isDisposed()) {
- getUiMenuItem().setSelection(getScoutAction().isSelected());
- }
- }
-
- /**
- * in rwt thread
- */
- @Override
- protected void handleScoutPropertyChange(String name, Object newValue) {
- super.handleScoutPropertyChange(name, newValue);
- if (name.equals(ICheckBoxMenu.PROP_SELECTED)) {
- setSelectedFromScout();
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.action;
+
+import org.eclipse.scout.rt.client.ui.action.menu.checkbox.ICheckBoxMenu;
+import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+
+public class RwtScoutCheckboxMenu extends AbstractRwtMenuAction {
+
+ public RwtScoutCheckboxMenu(Menu uiMenu, ICheckBoxMenu scoutMenu, IRwtEnvironment uiEnvironment) {
+ super(uiMenu, scoutMenu, uiEnvironment, true);
+ }
+
+ @Override
+ protected void initializeUi(Menu uiMenu) {
+ MenuItem item = new MenuItem(uiMenu, SWT.CHECK);
+ setUiMenuItem(item);
+ }
+
+ @Override
+ protected void applyScoutProperties() {
+ super.applyScoutProperties();
+ setSelectedFromScout();
+ }
+
+ private void setSelectedFromScout() {
+ if (!getUiMenuItem().isDisposed()) {
+ getUiMenuItem().setSelection(getScoutAction().isSelected());
+ }
+ }
+
+ /**
+ * in rwt thread
+ */
+ @Override
+ protected void handleScoutPropertyChange(String name, Object newValue) {
+ super.handleScoutPropertyChange(name, newValue);
+ if (name.equals(ICheckBoxMenu.PROP_SELECTED)) {
+ setSelectedFromScout();
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/action/RwtScoutMenuAction.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/action/RwtScoutMenuAction.java
index 23f12de0e8..31af0f2d85 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/action/RwtScoutMenuAction.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/action/RwtScoutMenuAction.java
@@ -1,36 +1,36 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.action;
-
-import org.eclipse.scout.rt.client.ui.action.IAction;
-import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-
-/**
- * <h3>RwtScoutAction</h3> ...
- *
- * @since 3.7.0 June 2011
- */
-public class RwtScoutMenuAction extends AbstractRwtMenuAction {
-
- public RwtScoutMenuAction(Menu uiMenu, IAction action, IRwtEnvironment environment) {
- super(uiMenu, action, environment, true);
- }
-
- @Override
- protected void initializeUi(Menu uiMenu) {
- MenuItem item = new MenuItem(uiMenu, SWT.PUSH);
- setUiMenuItem(item);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.action;
+
+import org.eclipse.scout.rt.client.ui.action.IAction;
+import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+
+/**
+ * <h3>RwtScoutAction</h3> ...
+ *
+ * @since 3.7.0 June 2011
+ */
+public class RwtScoutMenuAction extends AbstractRwtMenuAction {
+
+ public RwtScoutMenuAction(Menu uiMenu, IAction action, IRwtEnvironment environment) {
+ super(uiMenu, action, environment, true);
+ }
+
+ @Override
+ protected void initializeUi(Menu uiMenu) {
+ MenuItem item = new MenuItem(uiMenu, SWT.PUSH);
+ setUiMenuItem(item);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/action/RwtScoutMenuGroup.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/action/RwtScoutMenuGroup.java
index 7f5157288b..d151cbe981 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/action/RwtScoutMenuGroup.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/action/RwtScoutMenuGroup.java
@@ -1,35 +1,35 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.action;
-
-import org.eclipse.scout.rt.client.ui.action.IAction;
-import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-
-/**
- * <h3>RwtScoutMenuGroup</h3> ...
- *
- * @since 3.7.0 June 2011
- */
-public class RwtScoutMenuGroup extends AbstractRwtMenuAction {
-
- public RwtScoutMenuGroup(Menu uiMenu, IAction scoutMenu, IRwtEnvironment uiEnvironment) {
- super(uiMenu, scoutMenu, uiEnvironment, true);
- }
-
- @Override
- protected void initializeUi(Menu uiMenu) {
- MenuItem item = new MenuItem(uiMenu, SWT.CASCADE);
- setUiMenuItem(item);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.action;
+
+import org.eclipse.scout.rt.client.ui.action.IAction;
+import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+
+/**
+ * <h3>RwtScoutMenuGroup</h3> ...
+ *
+ * @since 3.7.0 June 2011
+ */
+public class RwtScoutMenuGroup extends AbstractRwtMenuAction {
+
+ public RwtScoutMenuGroup(Menu uiMenu, IAction scoutMenu, IRwtEnvironment uiEnvironment) {
+ super(uiMenu, scoutMenu, uiEnvironment, true);
+ }
+
+ @Override
+ protected void initializeUi(Menu uiMenu) {
+ MenuItem item = new MenuItem(uiMenu, SWT.CASCADE);
+ setUiMenuItem(item);
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/AbstractOpenMenuJob.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/AbstractOpenMenuJob.java
index 5efbc16917..7a2bb5ece6 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/AbstractOpenMenuJob.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/AbstractOpenMenuJob.java
@@ -1,96 +1,96 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.basic;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.scout.commons.job.JobEx;
-import org.eclipse.scout.rt.ui.rap.util.BrowserInfo;
-import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Control;
-
-public abstract class AbstractOpenMenuJob extends JobEx {
- private Point m_eventPosition;
- private boolean m_openMenu = false;
-
- private final Control m_UiField;
- private BrowserInfo m_browserInfo = RwtUtility.getBrowserInfo();
-
- public AbstractOpenMenuJob(Control UiField) {
- super("OpenMenuJob");
- m_UiField = UiField;
- }
-
- public void startOpenJob(Point eventPosition) {
- if (m_browserInfo.isTablet()
- || m_browserInfo.isMobile()) {
- setEventPosition(eventPosition);
- setOpenMenu(true);
- schedule(500L);
- }
- }
-
- public void stopOpenJob() {
- setOpenMenu(false);
- if (Job.SLEEPING == getState()
- || Job.WAITING == getState()) {
- cancel();
- }
- }
-
- public boolean openMenuCheck() {
- return getUiField() != null
- && !getUiField().isDisposed();
- }
-
- public abstract void showMenu(Point pt);
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- if (isOpenMenu()) {
- getUiField().getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (openMenuCheck()) {
- Point pt = getUiField().toDisplay(getEventPosition());
- //Position of menu is moved 50px to the right, so it doesn't popup right under the finger
- pt.x = pt.x + 50;
- showMenu(pt);
- }
- }
- });
- }
- return Status.OK_STATUS;
- }
-
- private Control getUiField() {
- return m_UiField;
- }
-
- public void setEventPosition(Point eventPosition) {
- m_eventPosition = eventPosition;
- }
-
- public Point getEventPosition() {
- return m_eventPosition;
- }
-
- public void setOpenMenu(boolean openMenu) {
- m_openMenu = openMenu;
- }
-
- public boolean isOpenMenu() {
- return m_openMenu;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.basic;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.scout.commons.job.JobEx;
+import org.eclipse.scout.rt.ui.rap.util.BrowserInfo;
+import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Control;
+
+public abstract class AbstractOpenMenuJob extends JobEx {
+ private Point m_eventPosition;
+ private boolean m_openMenu = false;
+
+ private final Control m_UiField;
+ private BrowserInfo m_browserInfo = RwtUtility.getBrowserInfo();
+
+ public AbstractOpenMenuJob(Control UiField) {
+ super("OpenMenuJob");
+ m_UiField = UiField;
+ }
+
+ public void startOpenJob(Point eventPosition) {
+ if (m_browserInfo.isTablet()
+ || m_browserInfo.isMobile()) {
+ setEventPosition(eventPosition);
+ setOpenMenu(true);
+ schedule(500L);
+ }
+ }
+
+ public void stopOpenJob() {
+ setOpenMenu(false);
+ if (Job.SLEEPING == getState()
+ || Job.WAITING == getState()) {
+ cancel();
+ }
+ }
+
+ public boolean openMenuCheck() {
+ return getUiField() != null
+ && !getUiField().isDisposed();
+ }
+
+ public abstract void showMenu(Point pt);
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ if (isOpenMenu()) {
+ getUiField().getDisplay().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ if (openMenuCheck()) {
+ Point pt = getUiField().toDisplay(getEventPosition());
+ //Position of menu is moved 50px to the right, so it doesn't popup right under the finger
+ pt.x = pt.x + 50;
+ showMenu(pt);
+ }
+ }
+ });
+ }
+ return Status.OK_STATUS;
+ }
+
+ private Control getUiField() {
+ return m_UiField;
+ }
+
+ public void setEventPosition(Point eventPosition) {
+ m_eventPosition = eventPosition;
+ }
+
+ public Point getEventPosition() {
+ return m_eventPosition;
+ }
+
+ public void setOpenMenu(boolean openMenu) {
+ m_openMenu = openMenu;
+ }
+
+ public boolean isOpenMenu() {
+ return m_openMenu;
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/IRwtScoutComposite.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/IRwtScoutComposite.java
index ac059b9aa3..606a4246f4 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/IRwtScoutComposite.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/IRwtScoutComposite.java
@@ -1,40 +1,40 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.basic;
-
-import org.eclipse.scout.commons.beans.IPropertyObserver;
-import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-public interface IRwtScoutComposite<T extends IPropertyObserver> {
- String PROP_RWT_SCOUT_COMPOSITE = "IRwtScoutComposite";
-
- void createUiField(Composite parent, T model, IRwtEnvironment environment);
-
- boolean isCreated();
-
- boolean isUiDisposed();
-
- T getScoutObject();
-
- IRwtEnvironment getUiEnvironment();
-
- Control getUiField();
-
- Composite getUiContainer();
-
- /**
- * is not thought to override. This method is to call to dispose a composite.
- */
- void dispose();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.basic;
+
+import org.eclipse.scout.commons.beans.IPropertyObserver;
+import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+public interface IRwtScoutComposite<T extends IPropertyObserver> {
+ String PROP_RWT_SCOUT_COMPOSITE = "IRwtScoutComposite";
+
+ void createUiField(Composite parent, T model, IRwtEnvironment environment);
+
+ boolean isCreated();
+
+ boolean isUiDisposed();
+
+ T getScoutObject();
+
+ IRwtEnvironment getUiEnvironment();
+
+ Control getUiField();
+
+ Composite getUiContainer();
+
+ /**
+ * is not thought to override. This method is to call to dispose a composite.
+ */
+ void dispose();
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/IconGroup.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/IconGroup.java
index b50c23c5b1..a54625d763 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/IconGroup.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/IconGroup.java
@@ -1,113 +1,113 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.basic;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * Convenience for managing a set of decoration icons using an icon id
- */
-public class IconGroup {
-
- public static enum IconState {
- NORMAL,
- ROLLOVER,
- SELECTED,
- DISABLED
- }
-
- private final Map<IconState, Image> iconMap = new HashMap<IconState, Image>();
-
- public IconGroup() {
- }
-
-// public IconGroup(String iconId) {
-// if (iconId != null) {
-// Image normal = Activator.getIcon(iconId);
-// Image rollover = Activator.getIcon(iconId + "_mouse_over");
-// if (rollover == null) {
-// rollover = Activator.getIcon(iconId + "_rollover");
-// if (rollover == null) {
-// rollover = normal;
-// }
-// }
-// Image selected = Activator.getIcon(iconId + "_active");
-// if (selected == null) {
-// selected = Activator.getIcon(iconId + "_pressed");
-// if (selected == null) {
-// selected = Activator.getIcon(iconId + "_selected");
-// if (selected == null) {
-// selected = normal;
-// }
-// }
-// }
-// Image disabled = Activator.getIcon(iconId + "_disabled");
-// if (disabled == null) {
-// disabled = normal;
-// }
-// iconMap.put(IconState.NORMAL, normal);
-// iconMap.put(IconState.ROLLOVER, rollover);
-// iconMap.put(IconState.SELECTED, selected);
-// iconMap.put(IconState.DISABLED, disabled);
-// }
-// }
-
- public IconGroup(IRwtEnvironment env, String iconId) {
- if (iconId == null) {
- return;
- }
-
- Image normal = env.getIcon(iconId);
- Image rollover = env.getIcon(iconId + "_mouse_over");
- if (rollover == null) {
- rollover = env.getIcon(iconId + "_rollover");
- }
- Image selected = env.getIcon(iconId + "_active");
- if (selected == null) {
- selected = env.getIcon(iconId + "_pressed");
- if (selected == null) {
- selected = env.getIcon(iconId + "_selected");
- }
- }
- Image disabled = env.getIcon(iconId + "_disabled");
-
- iconMap.put(IconState.NORMAL, normal);
- if (rollover != null) {
- iconMap.put(IconState.ROLLOVER, rollover);
- }
- if (selected != null) {
- iconMap.put(IconState.SELECTED, selected);
- }
- if (disabled != null) {
- iconMap.put(IconState.DISABLED, disabled);
- }
- }
-
- public Image getIcon(IconState state) {
- Image icon = iconMap.get(state);
- if (icon == null && state != IconState.NORMAL) {
- icon = iconMap.get(IconState.NORMAL);
- }
- return icon;
- }
-
- public void setIcon(IconState state, Image icon) {
- iconMap.put(state, icon);
- }
-
- public boolean hasIcon(IconState state) {
- return iconMap.containsKey(state);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.basic;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * Convenience for managing a set of decoration icons using an icon id
+ */
+public class IconGroup {
+
+ public static enum IconState {
+ NORMAL,
+ ROLLOVER,
+ SELECTED,
+ DISABLED
+ }
+
+ private final Map<IconState, Image> iconMap = new HashMap<IconState, Image>();
+
+ public IconGroup() {
+ }
+
+// public IconGroup(String iconId) {
+// if (iconId != null) {
+// Image normal = Activator.getIcon(iconId);
+// Image rollover = Activator.getIcon(iconId + "_mouse_over");
+// if (rollover == null) {
+// rollover = Activator.getIcon(iconId + "_rollover");
+// if (rollover == null) {
+// rollover = normal;
+// }
+// }
+// Image selected = Activator.getIcon(iconId + "_active");
+// if (selected == null) {
+// selected = Activator.getIcon(iconId + "_pressed");
+// if (selected == null) {
+// selected = Activator.getIcon(iconId + "_selected");
+// if (selected == null) {
+// selected = normal;
+// }
+// }
+// }
+// Image disabled = Activator.getIcon(iconId + "_disabled");
+// if (disabled == null) {
+// disabled = normal;
+// }
+// iconMap.put(IconState.NORMAL, normal);
+// iconMap.put(IconState.ROLLOVER, rollover);
+// iconMap.put(IconState.SELECTED, selected);
+// iconMap.put(IconState.DISABLED, disabled);
+// }
+// }
+
+ public IconGroup(IRwtEnvironment env, String iconId) {
+ if (iconId == null) {
+ return;
+ }
+
+ Image normal = env.getIcon(iconId);
+ Image rollover = env.getIcon(iconId + "_mouse_over");
+ if (rollover == null) {
+ rollover = env.getIcon(iconId + "_rollover");
+ }
+ Image selected = env.getIcon(iconId + "_active");
+ if (selected == null) {
+ selected = env.getIcon(iconId + "_pressed");
+ if (selected == null) {
+ selected = env.getIcon(iconId + "_selected");
+ }
+ }
+ Image disabled = env.getIcon(iconId + "_disabled");
+
+ iconMap.put(IconState.NORMAL, normal);
+ if (rollover != null) {
+ iconMap.put(IconState.ROLLOVER, rollover);
+ }
+ if (selected != null) {
+ iconMap.put(IconState.SELECTED, selected);
+ }
+ if (disabled != null) {
+ iconMap.put(IconState.DISABLED, disabled);
+ }
+ }
+
+ public Image getIcon(IconState state) {
+ Image icon = iconMap.get(state);
+ if (icon == null && state != IconState.NORMAL) {
+ icon = iconMap.get(IconState.NORMAL);
+ }
+ return icon;
+ }
+
+ public void setIcon(IconState state, Image icon) {
+ iconMap.put(state, icon);
+ }
+
+ public boolean hasIcon(IconState state) {
+ return iconMap.containsKey(state);
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/RwtScoutComposite.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/RwtScoutComposite.java
index 3b94d201f8..7fd239397f 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/RwtScoutComposite.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/RwtScoutComposite.java
@@ -1,441 +1,441 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.basic;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.lang.ref.WeakReference;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.scout.commons.OptimisticLock;
-import org.eclipse.scout.commons.beans.IPropertyObserver;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
-import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
-import org.eclipse.scout.rt.ui.rap.form.fields.LogicalGridDataBuilder;
-import org.eclipse.scout.rt.ui.rap.keystroke.IRwtKeyStroke;
-import org.eclipse.scout.rt.ui.rap.keystroke.RwtKeyStroke;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Widget;
-
-/**
- * @since 3.8.0
- */
-public abstract class RwtScoutComposite<T extends IPropertyObserver> implements IRwtScoutComposite<T> {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(RwtScoutComposite.class);
-
- protected static final String CLIENT_PROP_INITIAL_OPAQUE = "scoutInitialOpaque";
- protected static final String CLIENT_PROP_INITIAL_FONT = "scoutInitialFont";
- protected static final String CLIENT_PROP_INITIAL_BACKGROUND = "scoutInitialBackground";
- protected static final String CLIENT_PROP_INITIAL_FOREGROUND = "scoutInitialForeground";
-
- private Composite m_uiContainer;
- private Control m_uiField;
- private final OptimisticLock m_updateUiFromScoutLock;
- private final Set<String> m_ignoredScoutEvents;
- private T m_scoutObject;
- private P_ScoutPropertyChangeListener m_scoutPropertyListener;
-
- private IRwtEnvironment m_uiEnvironment;
- private boolean m_created;
-
- public RwtScoutComposite() {
- m_updateUiFromScoutLock = new OptimisticLock();
- m_ignoredScoutEvents = new HashSet<String>();
- }
-
- public static void registerCompositeOnWidget(Widget comp, IRwtScoutComposite ui) {
- if (comp != null) {
- comp.setData(PROP_RWT_SCOUT_COMPOSITE, new WeakReference<IRwtScoutComposite>(ui));
- }
- }
-
- /**
- * @return the rwt-scout composite used by this widget or null
- */
- @SuppressWarnings("unchecked")
- public static IRwtScoutComposite getCompositeOnWidget(Widget comp) {
- if (comp instanceof Widget) {
- WeakReference<IRwtScoutComposite> ref = (WeakReference<IRwtScoutComposite>) comp.getData(PROP_RWT_SCOUT_COMPOSITE);
- return ref != null ? ref.get() : null;
- }
- else {
- return null;
- }
- }
-
- /**
- * @return the scout model used by this widget or null if this {@link Widget} has not client property with a scout
- * model
- * reference.
- */
- public static IPropertyObserver getScoutModelOnWidget(Widget comp) {
- IRwtScoutComposite ui = getCompositeOnWidget(comp);
- if (ui != null) {
- return ui.getScoutObject();
- }
- else {
- return null;
- }
- }
-
- /**
- * @return the lock used in the Rwt thread when applying scout changes
- */
- public OptimisticLock getUpdateUiFromScoutLock() {
- return m_updateUiFromScoutLock;
- }
-
- /**
- * add an event description that, when scout sends it, is ignored
- */
- public void addIgnoredScoutEvent(Class eventType, String name) {
- m_ignoredScoutEvents.add(eventType.getSimpleName() + ":" + name);
- }
-
- /**
- * remove an event description so that when scout sends it, it is processed
- */
- public void removeIgnoredScoutEvent(Class eventType, String name) {
- m_ignoredScoutEvents.remove(eventType.getSimpleName() + ":" + name);
- }
-
- /**
- * @return true if that scout event is ignored
- */
- public boolean isIgnoredScoutEvent(Class eventType, String name) {
- if (m_ignoredScoutEvents.isEmpty()) {
- return false;
- }
- boolean b = m_ignoredScoutEvents.contains(eventType.getSimpleName() + ":" + name);
- return b;
- }
-
- @Override
- public final void createUiField(Composite parent, T scoutObject, IRwtEnvironment uiEnvironment) {
- if (m_created) {
- return;
- }
- m_scoutObject = scoutObject;
- m_uiEnvironment = (IRwtEnvironment) uiEnvironment;
- //
- try {
- initializeUi(parent);
- if (getUiContainer() != null) {
- if (getCompositeOnWidget(getUiContainer()) == null) {
- registerCompositeOnWidget(getUiContainer(), this);
- }
- }
- if (getUiField() != null) {
- if (getCompositeOnWidget(getUiField()) == null) {
- registerCompositeOnWidget(getUiField(), this);
- }
- }
- try {
- getUpdateUiFromScoutLock().acquire();
- //
- attachScout();
- }
- finally {
- getUpdateUiFromScoutLock().release();
- }
- }
- catch (Exception e) {
- LOG.error("could not initialize component '" + getScoutObject().getClass().getName() + "' to '" + this.getClass().getName() + "'.", e);
- }
- finally {
- m_created = true;
- }
- }
-
- @Override
- public boolean isCreated() {
- return m_created;
- }
-
- @Override
- public Composite getUiContainer() {
- return m_uiContainer;
- }
-
- protected void setUiContainer(Composite uiContainer) {
- m_uiContainer = uiContainer;
- if (m_uiContainer != null) {
- P_RwtContainerListener listener = new P_RwtContainerListener();
- m_uiContainer.addListener(SWT.Dispose, listener);
- }
- }
-
- /**
- * override this method to init the rwt components and attach rwt listeners
- * expects to invoke {@link #setUiField(Control)} and/or {@link #setUiContainer(Composite)}
- * <p>
- * TODO imo refactor to createFieldImpl
- */
- protected void initializeUi(Composite parent) {
- }
-
- @Override
- public Control getUiField() {
- return m_uiField;
- }
-
- protected void setUiField(Control uiField) {
- m_uiField = uiField;
- if (m_uiField != null) {
- // the layout data check is used to pack a tree within a composite.
- if (getScoutObject() instanceof IFormField && m_uiField.getLayoutData() == null) {
- m_uiField.setLayoutData(LogicalGridDataBuilder.createField(((IFormField) getScoutObject()).getGridData()));
- }
-
- // on CR validate input first
- for (IRwtKeyStroke stroke : getUiKeyStrokes()) {
- getUiEnvironment().addKeyStroke(uiField, stroke, true);
- }
- P_RwtFieldListener listener = new P_RwtFieldListener();
- m_uiField.addListener(SWT.FocusIn, listener);
- m_uiField.addListener(SWT.FocusOut, listener);
- m_uiField.addListener(SWT.Traverse, listener);
- m_uiField.addListener(SWT.Dispose, listener);
- }
- }
-
- @Override
- public boolean isUiDisposed() {
- if (getUiContainer() == null) {
- // try field
- return getUiField() == null || getUiField().isDisposed();
- }
- else {
- return getUiContainer().isDisposed();
- }
- }
-
- protected IRwtKeyStroke[] getUiKeyStrokes() {
- return new IRwtKeyStroke[]{new RwtKeyStroke(SWT.CR) {
- @Override
- public void handleUiAction(Event e) {
- handleUiInputVerifier(e.doit);
- }
- }};
- }
-
- @Override
- public T getScoutObject() {
- return m_scoutObject;
- }
-
- @Override
- public final void dispose() {
- if (!m_created) {
- return;
- }
- if (getUiField() != null && !getUiField().isDisposed()) {
- getUiField().dispose();
- }
- if (getUiContainer() != null && !getUiContainer().isDisposed()) {
- getUiContainer().dispose();
- }
- disposeImpl();
- }
-
- /**
- * override this method to do additional operations when the composite is being disposed
- */
- protected void disposeImpl() {
- }
-
- /**
- * Attaches the {@link P_ScoutPropertyChangeListener} which calls {@link #handleScoutPropertyChange(String, Object)}.
- * <p>
- * Override this method to set scout model properties on ui components or to attach other model listeners. Always call
- * super.attachScout() at the very beginning to make sure the property change listener gets attached properly.
- */
- protected void attachScout() {
- if (m_scoutObject != null) {
- if (m_uiContainer != null) {
- m_uiContainer.setData(IRwtScoutFormField.CLIENT_PROPERTY_SCOUT_OBJECT, m_scoutObject);
- }
- if (m_scoutPropertyListener == null) {
- m_scoutPropertyListener = new P_ScoutPropertyChangeListener();
- m_scoutObject.addPropertyChangeListener(m_scoutPropertyListener);
- }
- }
- }
-
- /**
- * Override this method to remove listeners from scout model.
- */
- protected void detachScout() {
- if (m_scoutObject != null) {
- if (m_scoutPropertyListener != null) {
- m_scoutObject.removePropertyChangeListener(m_scoutPropertyListener);
- m_scoutPropertyListener = null;
- }
- }
- }
-
- /**
- * pre-processor for scout properties (in Scout Thread) decision whether a
- * handleScoutPropertyChange is queued to the rwt thread runs in scout thread
- */
- protected boolean isHandleScoutPropertyChange(String name, Object newValue) {
- return true;
- }
-
- /**
- * handler for scout properties (in Rwt Thread) Special: swap enabled/editable
- * on textfields because of gray background and copy/paste capability runs in
- * rwt thread
- */
- protected void handleScoutPropertyChange(String name, Object newValue) {
- }
-
- protected void handleUiFocusGained() {
- }
-
- protected void handleUiFocusLost() {
- }
-
- protected void handleUiInputVerifier(boolean doit) {
- //do nothing
- }
-
- protected void handleUiDispose() {
- if (!m_created) {
- return;
- }
- try {
- getUpdateUiFromScoutLock().acquire();
- // remove possibly registered key strokes
- getUiEnvironment().removeKeyStrokes(getUiField());
- getUiEnvironment().removeKeyStrokes(getUiContainer());
- //
- detachScout();
- }
- finally {
- m_created = false;
- getUpdateUiFromScoutLock().release();
- }
- }
-
- @Override
- public IRwtEnvironment getUiEnvironment() {
- return m_uiEnvironment;
- }
-
- private class P_RwtFieldListener implements Listener {
- private static final long serialVersionUID = 1L;
- private long m_timestamp;
-
- @Override
- public void handleEvent(Event event) {
- if (!event.doit) {
- return;
- }
- switch (event.type) {
- case SWT.Traverse:
- switch (event.keyCode) {
- case SWT.ARROW_DOWN:
- case SWT.ARROW_UP:
- case SWT.ARROW_LEFT:
- case SWT.ARROW_RIGHT:
- case SWT.HOME:
- case SWT.END:
- case SWT.PAGE_DOWN:
- case SWT.PAGE_UP:
- case SWT.ESC:
- case SWT.CR:
- return;
- }
- // guarantee the value be written back to the model
- m_timestamp = event.time;
- handleUiInputVerifier(event.doit);
- break;
- case SWT.FocusIn:
- handleUiFocusGained();
- break;
- case SWT.FocusOut:
- // filter all temporary focus events
- if (getUiField() != null && getUiField().getDisplay().getActiveShell() != null
- && getUiField().getShell() != getUiField().getDisplay().getActiveShell()) {
- return;
- }
- else {
- handleUiInputVerifier(true);
- handleUiFocusLost();
- }
- break;
- case SWT.Dispose:
- if (m_uiContainer == null) {
- // only activated when there is no container
- handleUiDispose();
- }
- break;
- default:
- break;
- }
- }
- }
-
- private class P_RwtContainerListener implements Listener {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void handleEvent(Event event) {
- switch (event.type) {
- case SWT.Dispose:
- handleUiDispose();
- break;
- }
- }
- }
-
- protected void debugHandlePropertyChanged(PropertyChangeEvent e) {
-
- }
-
- private class P_ScoutPropertyChangeListener implements PropertyChangeListener {
- @Override
- public void propertyChange(final PropertyChangeEvent e) {
- debugHandlePropertyChanged(e);
- if (isIgnoredScoutEvent(PropertyChangeEvent.class, e.getPropertyName())) {
- return;
- }
- if (isHandleScoutPropertyChange(e.getPropertyName(), e.getNewValue())
- && getUiEnvironment().getDisplay() != null && !getUiEnvironment().getDisplay().isDisposed()) {
- Runnable t = new Runnable() {
- @Override
- public void run() {
- if (!isUiDisposed()) {
- try {
- getUpdateUiFromScoutLock().acquire();
- //
- handleScoutPropertyChange(e.getPropertyName(), e.getNewValue());
- }
- finally {
- getUpdateUiFromScoutLock().release();
- }
- }
- }
- };
- getUiEnvironment().invokeUiLater(t);
- }
- }
- }// end private class
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.basic;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.lang.ref.WeakReference;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.scout.commons.OptimisticLock;
+import org.eclipse.scout.commons.beans.IPropertyObserver;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
+import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
+import org.eclipse.scout.rt.ui.rap.form.fields.LogicalGridDataBuilder;
+import org.eclipse.scout.rt.ui.rap.keystroke.IRwtKeyStroke;
+import org.eclipse.scout.rt.ui.rap.keystroke.RwtKeyStroke;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Widget;
+
+/**
+ * @since 3.8.0
+ */
+public abstract class RwtScoutComposite<T extends IPropertyObserver> implements IRwtScoutComposite<T> {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(RwtScoutComposite.class);
+
+ protected static final String CLIENT_PROP_INITIAL_OPAQUE = "scoutInitialOpaque";
+ protected static final String CLIENT_PROP_INITIAL_FONT = "scoutInitialFont";
+ protected static final String CLIENT_PROP_INITIAL_BACKGROUND = "scoutInitialBackground";
+ protected static final String CLIENT_PROP_INITIAL_FOREGROUND = "scoutInitialForeground";
+
+ private Composite m_uiContainer;
+ private Control m_uiField;
+ private final OptimisticLock m_updateUiFromScoutLock;
+ private final Set<String> m_ignoredScoutEvents;
+ private T m_scoutObject;
+ private P_ScoutPropertyChangeListener m_scoutPropertyListener;
+
+ private IRwtEnvironment m_uiEnvironment;
+ private boolean m_created;
+
+ public RwtScoutComposite() {
+ m_updateUiFromScoutLock = new OptimisticLock();
+ m_ignoredScoutEvents = new HashSet<String>();
+ }
+
+ public static void registerCompositeOnWidget(Widget comp, IRwtScoutComposite ui) {
+ if (comp != null) {
+ comp.setData(PROP_RWT_SCOUT_COMPOSITE, new WeakReference<IRwtScoutComposite>(ui));
+ }
+ }
+
+ /**
+ * @return the rwt-scout composite used by this widget or null
+ */
+ @SuppressWarnings("unchecked")
+ public static IRwtScoutComposite getCompositeOnWidget(Widget comp) {
+ if (comp instanceof Widget) {
+ WeakReference<IRwtScoutComposite> ref = (WeakReference<IRwtScoutComposite>) comp.getData(PROP_RWT_SCOUT_COMPOSITE);
+ return ref != null ? ref.get() : null;
+ }
+ else {
+ return null;
+ }
+ }
+
+ /**
+ * @return the scout model used by this widget or null if this {@link Widget} has not client property with a scout
+ * model
+ * reference.
+ */
+ public static IPropertyObserver getScoutModelOnWidget(Widget comp) {
+ IRwtScoutComposite ui = getCompositeOnWidget(comp);
+ if (ui != null) {
+ return ui.getScoutObject();
+ }
+ else {
+ return null;
+ }
+ }
+
+ /**
+ * @return the lock used in the Rwt thread when applying scout changes
+ */
+ public OptimisticLock getUpdateUiFromScoutLock() {
+ return m_updateUiFromScoutLock;
+ }
+
+ /**
+ * add an event description that, when scout sends it, is ignored
+ */
+ public void addIgnoredScoutEvent(Class eventType, String name) {
+ m_ignoredScoutEvents.add(eventType.getSimpleName() + ":" + name);
+ }
+
+ /**
+ * remove an event description so that when scout sends it, it is processed
+ */
+ public void removeIgnoredScoutEvent(Class eventType, String name) {
+ m_ignoredScoutEvents.remove(eventType.getSimpleName() + ":" + name);
+ }
+
+ /**
+ * @return true if that scout event is ignored
+ */
+ public boolean isIgnoredScoutEvent(Class eventType, String name) {
+ if (m_ignoredScoutEvents.isEmpty()) {
+ return false;
+ }
+ boolean b = m_ignoredScoutEvents.contains(eventType.getSimpleName() + ":" + name);
+ return b;
+ }
+
+ @Override
+ public final void createUiField(Composite parent, T scoutObject, IRwtEnvironment uiEnvironment) {
+ if (m_created) {
+ return;
+ }
+ m_scoutObject = scoutObject;
+ m_uiEnvironment = (IRwtEnvironment) uiEnvironment;
+ //
+ try {
+ initializeUi(parent);
+ if (getUiContainer() != null) {
+ if (getCompositeOnWidget(getUiContainer()) == null) {
+ registerCompositeOnWidget(getUiContainer(), this);
+ }
+ }
+ if (getUiField() != null) {
+ if (getCompositeOnWidget(getUiField()) == null) {
+ registerCompositeOnWidget(getUiField(), this);
+ }
+ }
+ try {
+ getUpdateUiFromScoutLock().acquire();
+ //
+ attachScout();
+ }
+ finally {
+ getUpdateUiFromScoutLock().release();
+ }
+ }
+ catch (Exception e) {
+ LOG.error("could not initialize component '" + getScoutObject().getClass().getName() + "' to '" + this.getClass().getName() + "'.", e);
+ }
+ finally {
+ m_created = true;
+ }
+ }
+
+ @Override
+ public boolean isCreated() {
+ return m_created;
+ }
+
+ @Override
+ public Composite getUiContainer() {
+ return m_uiContainer;
+ }
+
+ protected void setUiContainer(Composite uiContainer) {
+ m_uiContainer = uiContainer;
+ if (m_uiContainer != null) {
+ P_RwtContainerListener listener = new P_RwtContainerListener();
+ m_uiContainer.addListener(SWT.Dispose, listener);
+ }
+ }
+
+ /**
+ * override this method to init the rwt components and attach rwt listeners
+ * expects to invoke {@link #setUiField(Control)} and/or {@link #setUiContainer(Composite)}
+ * <p>
+ * TODO imo refactor to createFieldImpl
+ */
+ protected void initializeUi(Composite parent) {
+ }
+
+ @Override
+ public Control getUiField() {
+ return m_uiField;
+ }
+
+ protected void setUiField(Control uiField) {
+ m_uiField = uiField;
+ if (m_uiField != null) {
+ // the layout data check is used to pack a tree within a composite.
+ if (getScoutObject() instanceof IFormField && m_uiField.getLayoutData() == null) {
+ m_uiField.setLayoutData(LogicalGridDataBuilder.createField(((IFormField) getScoutObject()).getGridData()));
+ }
+
+ // on CR validate input first
+ for (IRwtKeyStroke stroke : getUiKeyStrokes()) {
+ getUiEnvironment().addKeyStroke(uiField, stroke, true);
+ }
+ P_RwtFieldListener listener = new P_RwtFieldListener();
+ m_uiField.addListener(SWT.FocusIn, listener);
+ m_uiField.addListener(SWT.FocusOut, listener);
+ m_uiField.addListener(SWT.Traverse, listener);
+ m_uiField.addListener(SWT.Dispose, listener);
+ }
+ }
+
+ @Override
+ public boolean isUiDisposed() {
+ if (getUiContainer() == null) {
+ // try field
+ return getUiField() == null || getUiField().isDisposed();
+ }
+ else {
+ return getUiContainer().isDisposed();
+ }
+ }
+
+ protected IRwtKeyStroke[] getUiKeyStrokes() {
+ return new IRwtKeyStroke[]{new RwtKeyStroke(SWT.CR) {
+ @Override
+ public void handleUiAction(Event e) {
+ handleUiInputVerifier(e.doit);
+ }
+ }};
+ }
+
+ @Override
+ public T getScoutObject() {
+ return m_scoutObject;
+ }
+
+ @Override
+ public final void dispose() {
+ if (!m_created) {
+ return;
+ }
+ if (getUiField() != null && !getUiField().isDisposed()) {
+ getUiField().dispose();
+ }
+ if (getUiContainer() != null && !getUiContainer().isDisposed()) {
+ getUiContainer().dispose();
+ }
+ disposeImpl();
+ }
+
+ /**
+ * override this method to do additional operations when the composite is being disposed
+ */
+ protected void disposeImpl() {
+ }
+
+ /**
+ * Attaches the {@link P_ScoutPropertyChangeListener} which calls {@link #handleScoutPropertyChange(String, Object)}.
+ * <p>
+ * Override this method to set scout model properties on ui components or to attach other model listeners. Always call
+ * super.attachScout() at the very beginning to make sure the property change listener gets attached properly.
+ */
+ protected void attachScout() {
+ if (m_scoutObject != null) {
+ if (m_uiContainer != null) {
+ m_uiContainer.setData(IRwtScoutFormField.CLIENT_PROPERTY_SCOUT_OBJECT, m_scoutObject);
+ }
+ if (m_scoutPropertyListener == null) {
+ m_scoutPropertyListener = new P_ScoutPropertyChangeListener();
+ m_scoutObject.addPropertyChangeListener(m_scoutPropertyListener);
+ }
+ }
+ }
+
+ /**
+ * Override this method to remove listeners from scout model.
+ */
+ protected void detachScout() {
+ if (m_scoutObject != null) {
+ if (m_scoutPropertyListener != null) {
+ m_scoutObject.removePropertyChangeListener(m_scoutPropertyListener);
+ m_scoutPropertyListener = null;
+ }
+ }
+ }
+
+ /**
+ * pre-processor for scout properties (in Scout Thread) decision whether a
+ * handleScoutPropertyChange is queued to the rwt thread runs in scout thread
+ */
+ protected boolean isHandleScoutPropertyChange(String name, Object newValue) {
+ return true;
+ }
+
+ /**
+ * handler for scout properties (in Rwt Thread) Special: swap enabled/editable
+ * on textfields because of gray background and copy/paste capability runs in
+ * rwt thread
+ */
+ protected void handleScoutPropertyChange(String name, Object newValue) {
+ }
+
+ protected void handleUiFocusGained() {
+ }
+
+ protected void handleUiFocusLost() {
+ }
+
+ protected void handleUiInputVerifier(boolean doit) {
+ //do nothing
+ }
+
+ protected void handleUiDispose() {
+ if (!m_created) {
+ return;
+ }
+ try {
+ getUpdateUiFromScoutLock().acquire();
+ // remove possibly registered key strokes
+ getUiEnvironment().removeKeyStrokes(getUiField());
+ getUiEnvironment().removeKeyStrokes(getUiContainer());
+ //
+ detachScout();
+ }
+ finally {
+ m_created = false;
+ getUpdateUiFromScoutLock().release();
+ }
+ }
+
+ @Override
+ public IRwtEnvironment getUiEnvironment() {
+ return m_uiEnvironment;
+ }
+
+ private class P_RwtFieldListener implements Listener {
+ private static final long serialVersionUID = 1L;
+ private long m_timestamp;
+
+ @Override
+ public void handleEvent(Event event) {
+ if (!event.doit) {
+ return;
+ }
+ switch (event.type) {
+ case SWT.Traverse:
+ switch (event.keyCode) {
+ case SWT.ARROW_DOWN:
+ case SWT.ARROW_UP:
+ case SWT.ARROW_LEFT:
+ case SWT.ARROW_RIGHT:
+ case SWT.HOME:
+ case SWT.END:
+ case SWT.PAGE_DOWN:
+ case SWT.PAGE_UP:
+ case SWT.ESC:
+ case SWT.CR:
+ return;
+ }
+ // guarantee the value be written back to the model
+ m_timestamp = event.time;
+ handleUiInputVerifier(event.doit);
+ break;
+ case SWT.FocusIn:
+ handleUiFocusGained();
+ break;
+ case SWT.FocusOut:
+ // filter all temporary focus events
+ if (getUiField() != null && getUiField().getDisplay().getActiveShell() != null
+ && getUiField().getShell() != getUiField().getDisplay().getActiveShell()) {
+ return;
+ }
+ else {
+ handleUiInputVerifier(true);
+ handleUiFocusLost();
+ }
+ break;
+ case SWT.Dispose:
+ if (m_uiContainer == null) {
+ // only activated when there is no container
+ handleUiDispose();
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ private class P_RwtContainerListener implements Listener {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void handleEvent(Event event) {
+ switch (event.type) {
+ case SWT.Dispose:
+ handleUiDispose();
+ break;
+ }
+ }
+ }
+
+ protected void debugHandlePropertyChanged(PropertyChangeEvent e) {
+
+ }
+
+ private class P_ScoutPropertyChangeListener implements PropertyChangeListener {
+ @Override
+ public void propertyChange(final PropertyChangeEvent e) {
+ debugHandlePropertyChanged(e);
+ if (isIgnoredScoutEvent(PropertyChangeEvent.class, e.getPropertyName())) {
+ return;
+ }
+ if (isHandleScoutPropertyChange(e.getPropertyName(), e.getNewValue())
+ && getUiEnvironment().getDisplay() != null && !getUiEnvironment().getDisplay().isDisposed()) {
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ if (!isUiDisposed()) {
+ try {
+ getUpdateUiFromScoutLock().acquire();
+ //
+ handleScoutPropertyChange(e.getPropertyName(), e.getNewValue());
+ }
+ finally {
+ getUpdateUiFromScoutLock().release();
+ }
+ }
+ }
+ };
+ getUiEnvironment().invokeUiLater(t);
+ }
+ }
+ }// end private class
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/WidgetPrinter.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/WidgetPrinter.java
index 1fd2d83464..646d09b183 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/WidgetPrinter.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/WidgetPrinter.java
@@ -1,157 +1,157 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.basic;
-
-import java.io.File;
-import java.util.Map;
-
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.form.PrintDevice;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.ImageData;
-import org.eclipse.swt.graphics.ImageLoader;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-
-public class WidgetPrinter {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(WidgetPrinter.class);
-
- private Control m_widget;
-
- private File m_printedFile;
-
- public WidgetPrinter(Control w) {
- m_widget = w;
- }
-
- public void print(PrintDevice device, Map<String, Object> parameters) throws Throwable {
- if (device == PrintDevice.File) {
- printToFile(createImage(), parameters);
- }
- else if (device == PrintDevice.Printer) {
- /*
- printToPrinter(createImage(), parameters);
- */
- }
- }
-
- public File getOutputFile() {
- return m_printedFile;
- }
-
- private void printToFile(Image image, Map<String, Object> parameters) throws Throwable {
- m_printedFile = (File) parameters.remove("file");
- if (m_printedFile == null) {
- throw new IllegalArgumentException("parameter \"file\" must not be null");
- }
- String contentType = (String) parameters.remove("contentType");
- if (contentType == null) {
- contentType = "image/jpg";
- }
- if (!contentType.startsWith("image/")) {
- throw new IllegalArgumentException("only supporting contentTypes image/*");
- }
- for (String n : parameters.keySet()) {
- LOG.warn("Unknown parameter: " + n + "=" + parameters.get(n));
- }
- //
- File tmpFile = new File(m_printedFile.getAbsolutePath() + ".tmp");
- tmpFile.getParentFile().mkdirs();
- //
- ImageLoader imageLoader = new ImageLoader();
- imageLoader.data = new ImageData[]{image.getImageData()};
- imageLoader.save(tmpFile.getAbsolutePath(), SWT.IMAGE_JPEG);
- image.dispose();
- m_printedFile.delete();
- tmpFile.renameTo(m_printedFile);
- }
-
- /*
- private void printToPrinter(Image image, Map<String, Object> parameters) throws Throwable {
- @SuppressWarnings("unused")
- String printerName = (String) parameters.remove("printerName");
- String jobName = (String) parameters.remove("jobName");
- for (String n : parameters.keySet()) {
- LOG.warn("Unknown parameter: " + n + "=" + parameters.get(n));
- }
- Shell shell = new Shell();
- PrintDialog dialog = new PrintDialog(shell, SWT.NONE);
- PrinterData pdata = dialog.open();
- if (pdata != null) {
- Printer printer = new Printer(pdata);
- try {
- if (printer.startJob(jobName != null ? jobName : "Widget Screenshot")) {
- try {
- new DefaultPrintable().print(printer, image);
- }
- finally {
- printer.endJob();
- }
- }
- }
- finally {
- printer.dispose();
- }
- }
- }
- */
-
- private Image createImage() {
- Rectangle bounds = m_widget.getBounds();
- int x = 0;
- int y = 0;
- if (m_widget instanceof Shell) {
- Rectangle ca = ((Shell) m_widget).getClientArea();
- x = (bounds.width - ca.width) / 2;
- y = (bounds.height - ca.height) - x;
- }
- GC gc = new GC(m_widget);
- Image image = new Image(m_widget.getDisplay(), bounds.width, bounds.height);
- gc.drawImage(image, -x, -y);
- gc.dispose();
- return image;
- }
-
- /*
- private class DefaultPrintable {
- public void print(Printer printer, Image image) {
- if (printer.startPage()) {
- GC gc = new GC(printer);
- try {
- System.out.println("ok");
- Rectangle clientArea = printer.getClientArea();
- Rectangle trim = printer.computeTrim(0, 0, 0, 0);
- Point dpi = printer.getDPI();
- int leftMargin = 0 * dpi.x + (-trim.x);
- int rightMargin = 0 * dpi.x + (trim.x + trim.width);
- int topMargin = 0 * dpi.y + (-trim.y);
- int bottomMargin = 0 * dpi.y + (trim.y + trim.height);
- Rectangle drawBounds = new Rectangle(leftMargin, topMargin, clientArea.width - leftMargin - rightMargin, clientArea.height - topMargin - bottomMargin);
- Rectangle widgetBounds = m_widget.getBounds();
- //
- double scaleX = 1.0 * drawBounds.width / Math.max(1, widgetBounds.width);
- double scaleY = 1.0 * drawBounds.height / Math.max(1, widgetBounds.height);
- double scaleProp = Math.min(scaleX, scaleY);
- gc.drawImage(image, 0, 0, widgetBounds.width, widgetBounds.height, drawBounds.x, drawBounds.y, (int) (widgetBounds.width * scaleProp), (int) (widgetBounds.height * scaleProp));
- }
- finally {
- gc.dispose();
- printer.endPage();
- }
- }
- }
- }
- */
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.basic;
+
+import java.io.File;
+import java.util.Map;
+
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.form.PrintDevice;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.ImageLoader;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+
+public class WidgetPrinter {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(WidgetPrinter.class);
+
+ private Control m_widget;
+
+ private File m_printedFile;
+
+ public WidgetPrinter(Control w) {
+ m_widget = w;
+ }
+
+ public void print(PrintDevice device, Map<String, Object> parameters) throws Throwable {
+ if (device == PrintDevice.File) {
+ printToFile(createImage(), parameters);
+ }
+ else if (device == PrintDevice.Printer) {
+ /*
+ printToPrinter(createImage(), parameters);
+ */
+ }
+ }
+
+ public File getOutputFile() {
+ return m_printedFile;
+ }
+
+ private void printToFile(Image image, Map<String, Object> parameters) throws Throwable {
+ m_printedFile = (File) parameters.remove("file");
+ if (m_printedFile == null) {
+ throw new IllegalArgumentException("parameter \"file\" must not be null");
+ }
+ String contentType = (String) parameters.remove("contentType");
+ if (contentType == null) {
+ contentType = "image/jpg";
+ }
+ if (!contentType.startsWith("image/")) {
+ throw new IllegalArgumentException("only supporting contentTypes image/*");
+ }
+ for (String n : parameters.keySet()) {
+ LOG.warn("Unknown parameter: " + n + "=" + parameters.get(n));
+ }
+ //
+ File tmpFile = new File(m_printedFile.getAbsolutePath() + ".tmp");
+ tmpFile.getParentFile().mkdirs();
+ //
+ ImageLoader imageLoader = new ImageLoader();
+ imageLoader.data = new ImageData[]{image.getImageData()};
+ imageLoader.save(tmpFile.getAbsolutePath(), SWT.IMAGE_JPEG);
+ image.dispose();
+ m_printedFile.delete();
+ tmpFile.renameTo(m_printedFile);
+ }
+
+ /*
+ private void printToPrinter(Image image, Map<String, Object> parameters) throws Throwable {
+ @SuppressWarnings("unused")
+ String printerName = (String) parameters.remove("printerName");
+ String jobName = (String) parameters.remove("jobName");
+ for (String n : parameters.keySet()) {
+ LOG.warn("Unknown parameter: " + n + "=" + parameters.get(n));
+ }
+ Shell shell = new Shell();
+ PrintDialog dialog = new PrintDialog(shell, SWT.NONE);
+ PrinterData pdata = dialog.open();
+ if (pdata != null) {
+ Printer printer = new Printer(pdata);
+ try {
+ if (printer.startJob(jobName != null ? jobName : "Widget Screenshot")) {
+ try {
+ new DefaultPrintable().print(printer, image);
+ }
+ finally {
+ printer.endJob();
+ }
+ }
+ }
+ finally {
+ printer.dispose();
+ }
+ }
+ }
+ */
+
+ private Image createImage() {
+ Rectangle bounds = m_widget.getBounds();
+ int x = 0;
+ int y = 0;
+ if (m_widget instanceof Shell) {
+ Rectangle ca = ((Shell) m_widget).getClientArea();
+ x = (bounds.width - ca.width) / 2;
+ y = (bounds.height - ca.height) - x;
+ }
+ GC gc = new GC(m_widget);
+ Image image = new Image(m_widget.getDisplay(), bounds.width, bounds.height);
+ gc.drawImage(image, -x, -y);
+ gc.dispose();
+ return image;
+ }
+
+ /*
+ private class DefaultPrintable {
+ public void print(Printer printer, Image image) {
+ if (printer.startPage()) {
+ GC gc = new GC(printer);
+ try {
+ System.out.println("ok");
+ Rectangle clientArea = printer.getClientArea();
+ Rectangle trim = printer.computeTrim(0, 0, 0, 0);
+ Point dpi = printer.getDPI();
+ int leftMargin = 0 * dpi.x + (-trim.x);
+ int rightMargin = 0 * dpi.x + (trim.x + trim.width);
+ int topMargin = 0 * dpi.y + (-trim.y);
+ int bottomMargin = 0 * dpi.y + (trim.y + trim.height);
+ Rectangle drawBounds = new Rectangle(leftMargin, topMargin, clientArea.width - leftMargin - rightMargin, clientArea.height - topMargin - bottomMargin);
+ Rectangle widgetBounds = m_widget.getBounds();
+ //
+ double scaleX = 1.0 * drawBounds.width / Math.max(1, widgetBounds.width);
+ double scaleY = 1.0 * drawBounds.height / Math.max(1, widgetBounds.height);
+ double scaleProp = Math.min(scaleX, scaleY);
+ gc.drawImage(image, 0, 0, widgetBounds.width, widgetBounds.height, drawBounds.x, drawBounds.y, (int) (widgetBounds.width * scaleProp), (int) (widgetBounds.height * scaleProp));
+ }
+ finally {
+ gc.dispose();
+ printer.endPage();
+ }
+ }
+ }
+ }
+ */
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/comp/CLabelEx.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/comp/CLabelEx.java
index ed59860829..52c0dc9c24 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/comp/CLabelEx.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/comp/CLabelEx.java
@@ -1,148 +1,148 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.basic.comp;
-
-import org.eclipse.rwt.internal.textsize.TextSizeUtil;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CLabel;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-
-/**
- * This class overrides the text shortening behaviour of the CLabel
- * class.Instead of replacing the center of the text with an ellipsis, this
- * class adds an ellipsis at the end of the text (or before the last word of the
- * text, if the label is part of a field range composition).
- */
-@SuppressWarnings("restriction")
-public class CLabelEx extends CLabel {
- private static final long serialVersionUID = 1L;
-
- private static final String ELLIPSIS = "...";
-
- private String m_originalText = "";
- private String m_originalTooltip;
- private Image m_originalImage;
-
- public CLabelEx(Composite parent, int style) {
- super(parent, style | SWT.NO_FOCUS);
-
- addListener(SWT.Resize, new P_ResizeListener());
- }
-
- @Override
- public void setBounds(Rectangle bounds) {
- super.setBounds(bounds);
- if (bounds.width > 0) {
- updateText(bounds.width);
- }
- }
-
- @Override
- public void setText(String text) {
- super.setText(text);
- m_originalText = text;
- }
-
- @Override
- public void setToolTipText(String tooltip) {
- super.setToolTipText(tooltip);
- m_originalTooltip = tooltip;
- }
-
- @Override
- public void setImage(Image image) {
- super.setImage(image);
- m_originalImage = image;
- }
-
- private void updateText(int labelWidth) {
- Image image = getImage();
-
- int availableWidth = Math.max(0, labelWidth - (getLeftMargin() + getRightMargin()));
- Point extent = TextSizeUtil.stringExtent(getFont(), m_originalText);
- int imageWidth = 0;
- if (image != null) {
- Rectangle r = image.getBounds();
- imageWidth = r.width;
- }
- if (extent.x > availableWidth - imageWidth) {
- super.setImage(null);
- if (extent.x > availableWidth) {
- super.setText(shortenText(null, m_originalText, availableWidth));
- super.setToolTipText(m_originalText);
- }
- else {
- super.setText(m_originalText);
- super.setToolTipText(m_originalTooltip);
- }
- }
- else {
- super.setText(m_originalText);
- super.setToolTipText(m_originalTooltip);
- super.setImage(m_originalImage);
- }
- }
-
- /**
- * Shorten the given text <code>text</code> so that its length doesn't exceed
- * the given width. The default implementation replaces characters in the
- * center of the original string with an ellipsis ("...").
- * Override if you need a different strategy.
- *
- * @param gc
- * the gc to use for text measurement
- * @param text
- * the text to shorten
- * @param width
- * the width to shorten the text to, in pixels
- * @return the shortened text
- */
- public String shortenText(Object gc, String text, int width) {
- if (text == null || width <= 0) {
- return null;
- }
-
- int ecllipsisWidth = TextSizeUtil.stringExtent(getFont(), ELLIPSIS).x;
- int charCount = text.length();
-
- // shorten string
- while (charCount >= 0) {
- String shortenedText = text.substring(0, charCount);
- int textWidth = TextSizeUtil.stringExtent(getFont(), shortenedText).x;
- if (textWidth + ecllipsisWidth < width) {
- return shortenedText + ELLIPSIS;
- }
- if (charCount == 0) {
- return "";
- }
- charCount--;
- }
-
- return null;
- }
-
- private class P_ResizeListener implements Listener {
-
- private static final long serialVersionUID = 1L;
-
- @Override
- public void handleEvent(Event event) {
- if (event.type == SWT.Resize) {
- updateText(getBounds().width);
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.basic.comp;
+
+import org.eclipse.rwt.internal.textsize.TextSizeUtil;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+
+/**
+ * This class overrides the text shortening behaviour of the CLabel
+ * class.Instead of replacing the center of the text with an ellipsis, this
+ * class adds an ellipsis at the end of the text (or before the last word of the
+ * text, if the label is part of a field range composition).
+ */
+@SuppressWarnings("restriction")
+public class CLabelEx extends CLabel {
+ private static final long serialVersionUID = 1L;
+
+ private static final String ELLIPSIS = "...";
+
+ private String m_originalText = "";
+ private String m_originalTooltip;
+ private Image m_originalImage;
+
+ public CLabelEx(Composite parent, int style) {
+ super(parent, style | SWT.NO_FOCUS);
+
+ addListener(SWT.Resize, new P_ResizeListener());
+ }
+
+ @Override
+ public void setBounds(Rectangle bounds) {
+ super.setBounds(bounds);
+ if (bounds.width > 0) {
+ updateText(bounds.width);
+ }
+ }
+
+ @Override
+ public void setText(String text) {
+ super.setText(text);
+ m_originalText = text;
+ }
+
+ @Override
+ public void setToolTipText(String tooltip) {
+ super.setToolTipText(tooltip);
+ m_originalTooltip = tooltip;
+ }
+
+ @Override
+ public void setImage(Image image) {
+ super.setImage(image);
+ m_originalImage = image;
+ }
+
+ private void updateText(int labelWidth) {
+ Image image = getImage();
+
+ int availableWidth = Math.max(0, labelWidth - (getLeftMargin() + getRightMargin()));
+ Point extent = TextSizeUtil.stringExtent(getFont(), m_originalText);
+ int imageWidth = 0;
+ if (image != null) {
+ Rectangle r = image.getBounds();
+ imageWidth = r.width;
+ }
+ if (extent.x > availableWidth - imageWidth) {
+ super.setImage(null);
+ if (extent.x > availableWidth) {
+ super.setText(shortenText(null, m_originalText, availableWidth));
+ super.setToolTipText(m_originalText);
+ }
+ else {
+ super.setText(m_originalText);
+ super.setToolTipText(m_originalTooltip);
+ }
+ }
+ else {
+ super.setText(m_originalText);
+ super.setToolTipText(m_originalTooltip);
+ super.setImage(m_originalImage);
+ }
+ }
+
+ /**
+ * Shorten the given text <code>text</code> so that its length doesn't exceed
+ * the given width. The default implementation replaces characters in the
+ * center of the original string with an ellipsis ("...").
+ * Override if you need a different strategy.
+ *
+ * @param gc
+ * the gc to use for text measurement
+ * @param text
+ * the text to shorten
+ * @param width
+ * the width to shorten the text to, in pixels
+ * @return the shortened text
+ */
+ public String shortenText(Object gc, String text, int width) {
+ if (text == null || width <= 0) {
+ return null;
+ }
+
+ int ecllipsisWidth = TextSizeUtil.stringExtent(getFont(), ELLIPSIS).x;
+ int charCount = text.length();
+
+ // shorten string
+ while (charCount >= 0) {
+ String shortenedText = text.substring(0, charCount);
+ int textWidth = TextSizeUtil.stringExtent(getFont(), shortenedText).x;
+ if (textWidth + ecllipsisWidth < width) {
+ return shortenedText + ELLIPSIS;
+ }
+ if (charCount == 0) {
+ return "";
+ }
+ charCount--;
+ }
+
+ return null;
+ }
+
+ private class P_ResizeListener implements Listener {
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void handleEvent(Event event) {
+ if (event.type == SWT.Resize) {
+ updateText(getBounds().width);
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/comp/HyperlinkEx.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/comp/HyperlinkEx.java
index 571e187bb1..21dcc94dd8 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/comp/HyperlinkEx.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/comp/HyperlinkEx.java
@@ -1,159 +1,159 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2011 IBM Corporation 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:
- * IBM Corporation - initial API and implementation
- * BSI Business Systems Integration AG - customization in this extension class
- ******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.basic.comp;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.forms.widgets.Hyperlink;
-
-/**
- * This class overrides the text shortening behaviour of the Hyperlink class.
- * Instead of replacing the center of the text with an ellipsis, this class adds
- * an ellipsis at the end of the text (or before the last word of the text, if
- * the label is part of a field range composition).
- */
-public class HyperlinkEx extends Hyperlink {
- private static final long serialVersionUID = 1L;
-
- private static final int PAINT_FLAGS = /*XXX rap SWT.DRAW_MNEMONIC | */SWT.DRAW_TAB | SWT.DRAW_TRANSPARENT | SWT.DRAW_DELIMITER;
- private static final String ELLIPSIS_TEXT = "...";
- /** the alignment. Either CENTER, RIGHT, LEFT. Default is LEFT */
- private int align = SWT.LEFT;
- /** Left and right margins */
- private static final int INDENT = 3;
-
- public HyperlinkEx(Composite parent, int style) {
- super(parent, style);
- if ((style & (SWT.CENTER | SWT.RIGHT)) == 0) {
- style |= SWT.LEFT;
- }
- if ((style & SWT.CENTER) != 0) {
- align = SWT.CENTER;
- }
- if ((style & SWT.RIGHT) != 0) {
- align = SWT.RIGHT;
- }
- if ((style & SWT.LEFT) != 0) {
- align = SWT.LEFT;
- }
- }
-
- /*XXX rap
- @SuppressWarnings("restriction")
- @Override
- protected void paintText(GC gc, Rectangle r) {
- Rectangle clientRect = getClientArea();
- gc.setFont(getFont());
- gc.setForeground(getForeground());
- if ((getStyle() & SWT.WRAP) != 0) {
- try {
- org.eclipse.ui.internal.forms.widgets.FormUtil.paintWrapText(gc, getText(), r, isUnderlined());
- }
- catch (Throwable t) {
- //nop
- }
- }
- else {
- Point textSize = computeTextSize(SWT.DEFAULT, SWT.DEFAULT);
- boolean mustShortenText = false;
- if (r.width < textSize.x) {
- mustShortenText = true;
- }
- int textW = Math.min(r.width, textSize.x);
- int textH = textSize.y;
- String text = getText();
- if (mustShortenText) {
- text = shortenText(gc, getText(), r.width);
- if (getToolTipText() == null) {
- super.setToolTipText(getText());
- }
- }
- else {
- super.setToolTipText(getToolTipText());
- }
- int posX = clientRect.x + INDENT;
- if (align == SWT.CENTER) {
- posX = (clientRect.width - textW) / 2;
- }
- if (align == SWT.RIGHT) {
- posX = clientRect.width - INDENT - textW;
- }
- int extX = posX;
- if (align == SWT.CENTER) {
- int ext = gc.textExtent(text, PAINT_FLAGS).x;
- extX = posX + Math.max(0, (r.x - ext) / 2);
- }
- if (align == SWT.RIGHT) {
- int ext = gc.textExtent(text, PAINT_FLAGS).x;
- extX = Math.max(posX, clientRect.x + clientRect.width - INDENT - ext);
- }
- gc.drawText(text, extX, r.y, true);
- if (isUnderlined()) {
- int fontDescent = gc.getFontMetrics().getDescent();
- int extY = r.y + textH - fontDescent + 1;
- gc.drawLine(extX, extY, extX + textW, extY);
- }
- }
- }
- */
- /*XXX rap
- @Override
- protected String shortenText(GC gc, String text, int linkWidth) {
- if (text == null) {
- return null;
- }
- String s = text;
- String suffix = "";
- int textWidth = gc.textExtent(ELLIPSIS_TEXT, PAINT_FLAGS).x;
- int suffixWidth = gc.textExtent(suffix, PAINT_FLAGS).x;
- int sLen = s.length();
- while (sLen >= 0) {
- String sSub = text.substring(0, sLen);
- int pos = gc.textExtent(sSub, PAINT_FLAGS).x;
- if (pos + textWidth + suffixWidth < linkWidth) {
- text = sSub + ELLIPSIS_TEXT + suffix;
- break;
- }
- sLen--;
- }
- return text;
- }
- */
-
- @Override
- public int getStyle() {
- int style = super.getStyle();
- switch (align) {
- case SWT.RIGHT:
- style |= SWT.RIGHT;
- break;
- case SWT.CENTER:
- style |= SWT.CENTER;
- break;
- case SWT.LEFT:
- style |= SWT.LEFT;
- break;
- }
- return style;
- }
-
- /**
- * Returns the alignment. The alignment style (LEFT, CENTER or RIGHT) is
- * returned.
- *
- * @return SWT.LEFT, SWT.RIGHT or SWT.CENTER
- */
- public int getAlignment() {
- // checkWidget();
- return align;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2011 IBM Corporation 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:
+ * IBM Corporation - initial API and implementation
+ * BSI Business Systems Integration AG - customization in this extension class
+ ******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.basic.comp;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.forms.widgets.Hyperlink;
+
+/**
+ * This class overrides the text shortening behaviour of the Hyperlink class.
+ * Instead of replacing the center of the text with an ellipsis, this class adds
+ * an ellipsis at the end of the text (or before the last word of the text, if
+ * the label is part of a field range composition).
+ */
+public class HyperlinkEx extends Hyperlink {
+ private static final long serialVersionUID = 1L;
+
+ private static final int PAINT_FLAGS = /*XXX rap SWT.DRAW_MNEMONIC | */SWT.DRAW_TAB | SWT.DRAW_TRANSPARENT | SWT.DRAW_DELIMITER;
+ private static final String ELLIPSIS_TEXT = "...";
+ /** the alignment. Either CENTER, RIGHT, LEFT. Default is LEFT */
+ private int align = SWT.LEFT;
+ /** Left and right margins */
+ private static final int INDENT = 3;
+
+ public HyperlinkEx(Composite parent, int style) {
+ super(parent, style);
+ if ((style & (SWT.CENTER | SWT.RIGHT)) == 0) {
+ style |= SWT.LEFT;
+ }
+ if ((style & SWT.CENTER) != 0) {
+ align = SWT.CENTER;
+ }
+ if ((style & SWT.RIGHT) != 0) {
+ align = SWT.RIGHT;
+ }
+ if ((style & SWT.LEFT) != 0) {
+ align = SWT.LEFT;
+ }
+ }
+
+ /*XXX rap
+ @SuppressWarnings("restriction")
+ @Override
+ protected void paintText(GC gc, Rectangle r) {
+ Rectangle clientRect = getClientArea();
+ gc.setFont(getFont());
+ gc.setForeground(getForeground());
+ if ((getStyle() & SWT.WRAP) != 0) {
+ try {
+ org.eclipse.ui.internal.forms.widgets.FormUtil.paintWrapText(gc, getText(), r, isUnderlined());
+ }
+ catch (Throwable t) {
+ //nop
+ }
+ }
+ else {
+ Point textSize = computeTextSize(SWT.DEFAULT, SWT.DEFAULT);
+ boolean mustShortenText = false;
+ if (r.width < textSize.x) {
+ mustShortenText = true;
+ }
+ int textW = Math.min(r.width, textSize.x);
+ int textH = textSize.y;
+ String text = getText();
+ if (mustShortenText) {
+ text = shortenText(gc, getText(), r.width);
+ if (getToolTipText() == null) {
+ super.setToolTipText(getText());
+ }
+ }
+ else {
+ super.setToolTipText(getToolTipText());
+ }
+ int posX = clientRect.x + INDENT;
+ if (align == SWT.CENTER) {
+ posX = (clientRect.width - textW) / 2;
+ }
+ if (align == SWT.RIGHT) {
+ posX = clientRect.width - INDENT - textW;
+ }
+ int extX = posX;
+ if (align == SWT.CENTER) {
+ int ext = gc.textExtent(text, PAINT_FLAGS).x;
+ extX = posX + Math.max(0, (r.x - ext) / 2);
+ }
+ if (align == SWT.RIGHT) {
+ int ext = gc.textExtent(text, PAINT_FLAGS).x;
+ extX = Math.max(posX, clientRect.x + clientRect.width - INDENT - ext);
+ }
+ gc.drawText(text, extX, r.y, true);
+ if (isUnderlined()) {
+ int fontDescent = gc.getFontMetrics().getDescent();
+ int extY = r.y + textH - fontDescent + 1;
+ gc.drawLine(extX, extY, extX + textW, extY);
+ }
+ }
+ }
+ */
+ /*XXX rap
+ @Override
+ protected String shortenText(GC gc, String text, int linkWidth) {
+ if (text == null) {
+ return null;
+ }
+ String s = text;
+ String suffix = "";
+ int textWidth = gc.textExtent(ELLIPSIS_TEXT, PAINT_FLAGS).x;
+ int suffixWidth = gc.textExtent(suffix, PAINT_FLAGS).x;
+ int sLen = s.length();
+ while (sLen >= 0) {
+ String sSub = text.substring(0, sLen);
+ int pos = gc.textExtent(sSub, PAINT_FLAGS).x;
+ if (pos + textWidth + suffixWidth < linkWidth) {
+ text = sSub + ELLIPSIS_TEXT + suffix;
+ break;
+ }
+ sLen--;
+ }
+ return text;
+ }
+ */
+
+ @Override
+ public int getStyle() {
+ int style = super.getStyle();
+ switch (align) {
+ case SWT.RIGHT:
+ style |= SWT.RIGHT;
+ break;
+ case SWT.CENTER:
+ style |= SWT.CENTER;
+ break;
+ case SWT.LEFT:
+ style |= SWT.LEFT;
+ break;
+ }
+ return style;
+ }
+
+ /**
+ * Returns the alignment. The alignment style (LEFT, CENTER or RIGHT) is
+ * returned.
+ *
+ * @return SWT.LEFT, SWT.RIGHT or SWT.CENTER
+ */
+ public int getAlignment() {
+ // checkWidget();
+ return align;
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/AbstractTableKeyboardNavigationSupport.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/AbstractTableKeyboardNavigationSupport.java
index bf6270e0b4..f46732adec 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/AbstractTableKeyboardNavigationSupport.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/AbstractTableKeyboardNavigationSupport.java
@@ -1,225 +1,225 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.basic.table;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.ui.rap.ext.table.TableEx;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.TableItem;
-
-/**
- * <h3>TableKeyBoardNavigationSupport</h3> ...
- *
- * @author Andreas Hoegger
- * @since 3.7.0 June 2011
- */
-public abstract class AbstractTableKeyboardNavigationSupport {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractTableKeyboardNavigationSupport.class);
-
- private final long m_delay;
- private long m_timeoutTimestamp;
- private String m_filterText = "";
- private Object navigationLock = new Object();
- private P_NavigationJob m_navigationJob;
-
- private final TableEx m_uiTable;
- private Listener m_uiTableListener;
- private int m_contextColumnIndex;
-
- private DisposeListener m_disposeListener = new DisposeListener() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void widgetDisposed(DisposeEvent e) {
- detachListeners();
- }
- };
-
- public AbstractTableKeyboardNavigationSupport(TableEx uiTable) {
- this(uiTable, 500L);
- }
-
- public AbstractTableKeyboardNavigationSupport(TableEx uiTable, long delay) {
- m_delay = delay;
- m_navigationJob = new P_NavigationJob();
-
- m_uiTable = uiTable;
- attachListeners();
- }
-
- public void dispose() {
- detachListeners();
- }
-
- public void resetContextColumnIndex() {
- m_contextColumnIndex = -1;
- }
-
- private void attachListeners() {
- if (m_uiTableListener == null) {
-
- m_uiTableListener = new P_TableListener();
- m_uiTable.addListener(SWT.MouseDown, m_uiTableListener);
-// sle 20120110: in webui this should be made in the client. it is to costly to go to the server with every keypress
-// m_uiTable.addListener(SWT.KeyDown, m_uiTableListener);
- }
- m_uiTable.addDisposeListener(m_disposeListener);
- }
-
- private void detachListeners() {
- if (m_uiTableListener != null) {
- if (!m_uiTable.isDisposed()) {
- m_uiTable.removeListener(SWT.MouseDown, m_uiTableListener);
-// sle 20120110: in webui this should be made in the client. it is to costly to go to the server with every keypress
-// m_uiTable.removeListener(SWT.KeyDown, m_uiTableListener);
- }
- m_uiTableListener = null;
- }
- if (!m_uiTable.isDisposed()) {
- m_uiTable.removeDisposeListener(m_disposeListener);
- }
- }
-
- public void addChar(char c) {
- synchronized (navigationLock) {
- if (Character.isLetter(c)) {
- if (System.currentTimeMillis() > m_timeoutTimestamp) {
- m_filterText = "";
- }
- String newText = "" + Character.toLowerCase(c);
- m_filterText += newText;
- if (m_navigationJob != null) {
- m_navigationJob.cancel();
- }
- else {
- m_navigationJob = new P_NavigationJob();
- }
- m_navigationJob.schedule(300L);
- m_timeoutTimestamp = System.currentTimeMillis() + m_delay;
- }
- }
- }
-
- void handleSearchPattern(final String regex) {
- m_uiTable.getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- int column = m_contextColumnIndex;
- if (column < 0) {
- for (int i = 0; i < m_uiTable.getColumnCount(); i++) {
- if (m_uiTable.getSortColumn() == m_uiTable.getColumn(i)) {
- column = i;
- break;
- }
- }
- }
- if (column < 0 && m_uiTable.getColumnCount() > 0) {
- column = 0;
- }
- if (column < 0) {
- return;
- }
- if (LOG.isInfoEnabled()) {
- LOG.info("finding regex:" + regex + " in column " + m_uiTable.getColumn(column).getText());
- }
- // loop over values and find matching one
- int startIndex = 0;
- if (m_uiTable.getSelectionIndex() < 0) {
- startIndex = 0;
- }
- else {
- startIndex = m_uiTable.getSelectionIndex() + 1;
- }
- int itemCount = m_uiTable.getItemCount();
- for (int i = 0; i < itemCount; i++) {
- TableItem tableItem = m_uiTable.getItem((startIndex + i) % itemCount);
- String itemText = tableItem.getText(column);
- if (itemText != null && itemText.toLowerCase().matches(regex)) {
- handleKeyboardNavigation(tableItem);
- break;
- }
- }
- }
- });
- }
-
- private class P_NavigationJob extends Job {
-
- public P_NavigationJob() {
- super("");
- setSystem(true);
- }
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- String pattern;
- synchronized (navigationLock) {
- if (monitor.isCanceled() || StringUtility.isNullOrEmpty(m_filterText)) {
- return Status.CANCEL_STATUS;
- }
- pattern = StringUtility.toRegExPattern(m_filterText.toLowerCase());
- pattern = pattern + ".*";
- }
- //this call must be outside lock!
- handleSearchPattern(pattern);
- return Status.OK_STATUS;
- }
- } // end class P_NavigationJob
-
- public abstract void handleKeyboardNavigation(TableItem tableItem);
-
- private class P_TableListener implements Listener {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void handleEvent(Event event) {
- if (event.doit) {
- switch (event.type) {
-// sle 20120110: in webui this should be made in the client. it is to costly to go to the server with every keypress
-// case SWT.KeyDown:
-// if ((event.stateMask == 0 || event.stateMask == SWT.SHIFT)
-// && Character.isLetter((char) event.keyCode) && (event.keyCode != SWT.KEYPAD_CR)) {//XXX RAP does not no the difference between KEYPAD_CR and CR
-// addChar(Character.toLowerCase((char) event.keyCode));
-// }
-// break;
- case SWT.MouseDown:
- Point p = new Point(event.x, event.y);
- TableItem item = m_uiTable.getItem(p);
- if (item != null) {
- for (int i = 0; i < m_uiTable.getColumnCount(); i++) {
- Rectangle rect = item.getBounds(i);
- if (rect.contains(p)) {
- m_contextColumnIndex = i;
- break;
- }
- }
- }
- break;
- default:
- break;
- }
- }
- }
- } // end class P_TableListener
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.basic.table;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.ui.rap.ext.table.TableEx;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.TableItem;
+
+/**
+ * <h3>TableKeyBoardNavigationSupport</h3> ...
+ *
+ * @author Andreas Hoegger
+ * @since 3.7.0 June 2011
+ */
+public abstract class AbstractTableKeyboardNavigationSupport {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractTableKeyboardNavigationSupport.class);
+
+ private final long m_delay;
+ private long m_timeoutTimestamp;
+ private String m_filterText = "";
+ private Object navigationLock = new Object();
+ private P_NavigationJob m_navigationJob;
+
+ private final TableEx m_uiTable;
+ private Listener m_uiTableListener;
+ private int m_contextColumnIndex;
+
+ private DisposeListener m_disposeListener = new DisposeListener() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void widgetDisposed(DisposeEvent e) {
+ detachListeners();
+ }
+ };
+
+ public AbstractTableKeyboardNavigationSupport(TableEx uiTable) {
+ this(uiTable, 500L);
+ }
+
+ public AbstractTableKeyboardNavigationSupport(TableEx uiTable, long delay) {
+ m_delay = delay;
+ m_navigationJob = new P_NavigationJob();
+
+ m_uiTable = uiTable;
+ attachListeners();
+ }
+
+ public void dispose() {
+ detachListeners();
+ }
+
+ public void resetContextColumnIndex() {
+ m_contextColumnIndex = -1;
+ }
+
+ private void attachListeners() {
+ if (m_uiTableListener == null) {
+
+ m_uiTableListener = new P_TableListener();
+ m_uiTable.addListener(SWT.MouseDown, m_uiTableListener);
+// sle 20120110: in webui this should be made in the client. it is to costly to go to the server with every keypress
+// m_uiTable.addListener(SWT.KeyDown, m_uiTableListener);
+ }
+ m_uiTable.addDisposeListener(m_disposeListener);
+ }
+
+ private void detachListeners() {
+ if (m_uiTableListener != null) {
+ if (!m_uiTable.isDisposed()) {
+ m_uiTable.removeListener(SWT.MouseDown, m_uiTableListener);
+// sle 20120110: in webui this should be made in the client. it is to costly to go to the server with every keypress
+// m_uiTable.removeListener(SWT.KeyDown, m_uiTableListener);
+ }
+ m_uiTableListener = null;
+ }
+ if (!m_uiTable.isDisposed()) {
+ m_uiTable.removeDisposeListener(m_disposeListener);
+ }
+ }
+
+ public void addChar(char c) {
+ synchronized (navigationLock) {
+ if (Character.isLetter(c)) {
+ if (System.currentTimeMillis() > m_timeoutTimestamp) {
+ m_filterText = "";
+ }
+ String newText = "" + Character.toLowerCase(c);
+ m_filterText += newText;
+ if (m_navigationJob != null) {
+ m_navigationJob.cancel();
+ }
+ else {
+ m_navigationJob = new P_NavigationJob();
+ }
+ m_navigationJob.schedule(300L);
+ m_timeoutTimestamp = System.currentTimeMillis() + m_delay;
+ }
+ }
+ }
+
+ void handleSearchPattern(final String regex) {
+ m_uiTable.getDisplay().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ int column = m_contextColumnIndex;
+ if (column < 0) {
+ for (int i = 0; i < m_uiTable.getColumnCount(); i++) {
+ if (m_uiTable.getSortColumn() == m_uiTable.getColumn(i)) {
+ column = i;
+ break;
+ }
+ }
+ }
+ if (column < 0 && m_uiTable.getColumnCount() > 0) {
+ column = 0;
+ }
+ if (column < 0) {
+ return;
+ }
+ if (LOG.isInfoEnabled()) {
+ LOG.info("finding regex:" + regex + " in column " + m_uiTable.getColumn(column).getText());
+ }
+ // loop over values and find matching one
+ int startIndex = 0;
+ if (m_uiTable.getSelectionIndex() < 0) {
+ startIndex = 0;
+ }
+ else {
+ startIndex = m_uiTable.getSelectionIndex() + 1;
+ }
+ int itemCount = m_uiTable.getItemCount();
+ for (int i = 0; i < itemCount; i++) {
+ TableItem tableItem = m_uiTable.getItem((startIndex + i) % itemCount);
+ String itemText = tableItem.getText(column);
+ if (itemText != null && itemText.toLowerCase().matches(regex)) {
+ handleKeyboardNavigation(tableItem);
+ break;
+ }
+ }
+ }
+ });
+ }
+
+ private class P_NavigationJob extends Job {
+
+ public P_NavigationJob() {
+ super("");
+ setSystem(true);
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ String pattern;
+ synchronized (navigationLock) {
+ if (monitor.isCanceled() || StringUtility.isNullOrEmpty(m_filterText)) {
+ return Status.CANCEL_STATUS;
+ }
+ pattern = StringUtility.toRegExPattern(m_filterText.toLowerCase());
+ pattern = pattern + ".*";
+ }
+ //this call must be outside lock!
+ handleSearchPattern(pattern);
+ return Status.OK_STATUS;
+ }
+ } // end class P_NavigationJob
+
+ public abstract void handleKeyboardNavigation(TableItem tableItem);
+
+ private class P_TableListener implements Listener {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void handleEvent(Event event) {
+ if (event.doit) {
+ switch (event.type) {
+// sle 20120110: in webui this should be made in the client. it is to costly to go to the server with every keypress
+// case SWT.KeyDown:
+// if ((event.stateMask == 0 || event.stateMask == SWT.SHIFT)
+// && Character.isLetter((char) event.keyCode) && (event.keyCode != SWT.KEYPAD_CR)) {//XXX RAP does not no the difference between KEYPAD_CR and CR
+// addChar(Character.toLowerCase((char) event.keyCode));
+// }
+// break;
+ case SWT.MouseDown:
+ Point p = new Point(event.x, event.y);
+ TableItem item = m_uiTable.getItem(p);
+ if (item != null) {
+ for (int i = 0; i < m_uiTable.getColumnCount(); i++) {
+ Rectangle rect = item.getBounds(i);
+ if (rect.contains(p)) {
+ m_contextColumnIndex = i;
+ break;
+ }
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ } // end class P_TableListener
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/IRwtScoutTable.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/IRwtScoutTable.java
index 92cf37fc5a..7031f1a14d 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/IRwtScoutTable.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/IRwtScoutTable.java
@@ -1,34 +1,34 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.basic.table;
-
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-import org.eclipse.scout.rt.ui.rap.basic.IRwtScoutComposite;
-import org.eclipse.swt.widgets.TableColumn;
-
-public interface IRwtScoutTable extends IRwtScoutComposite<ITable> {
- /**
- * all {@link TableColumn}s contain a {@link TableColumn#getData()} with the scout {@link IColumn}
- */
- String KEY_SCOUT_COLUMN = "scoutColumn";
-
- /**
- * Special variant for disabled table columns (as :disabled seems to by ignored by RAP).
- */
- String VARIANT_TABLE_COLUMN_DISABLED = "customDisabled";
-
- void setEnabledFromScout(boolean enabled);
-
- Viewer getUiTableViewer();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.basic.table;
+
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+import org.eclipse.scout.rt.ui.rap.basic.IRwtScoutComposite;
+import org.eclipse.swt.widgets.TableColumn;
+
+public interface IRwtScoutTable extends IRwtScoutComposite<ITable> {
+ /**
+ * all {@link TableColumn}s contain a {@link TableColumn#getData()} with the scout {@link IColumn}
+ */
+ String KEY_SCOUT_COLUMN = "scoutColumn";
+
+ /**
+ * Special variant for disabled table columns (as :disabled seems to by ignored by RAP).
+ */
+ String VARIANT_TABLE_COLUMN_DISABLED = "customDisabled";
+
+ void setEnabledFromScout(boolean enabled);
+
+ Viewer getUiTableViewer();
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/IRwtScoutTableForPatch.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/IRwtScoutTableForPatch.java
index 3d55b7762c..bf50fba972 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/IRwtScoutTableForPatch.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/IRwtScoutTableForPatch.java
@@ -1,49 +1,49 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.basic.table;
-
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
-import org.eclipse.scout.rt.ui.rap.ext.table.TableEx;
-
-/**
- * <h3>RwtScoutTable</h3> ...
- * knownIssues - multi column sorting is not supported, unable to get any key
- * mask in the selection event.
- * <p>
- * - multi line support in headers is not supported by rwt.
- * <p>
- * - multi line support in row texts is not supported so far. Might probably be done by customized table rows.
- *
- * @since 3.7.0 June 2011
- */
-public interface IRwtScoutTableForPatch extends IRwtScoutTable {
-
- TableColumnManager getUiColumnManager();
-
- void initializeUiColumns();
-
- @Override
- IRwtEnvironment getUiEnvironment();
-
- @Override
- TableEx getUiField();
-
- @Override
- TableViewer getUiTableViewer();
-
- void setUiTableViewer(TableViewer uiViewer);
-
- ITableRow getUiSelectedRow();
-
- ITableRow[] getUiSelectedRows();
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.basic.table;
+
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
+import org.eclipse.scout.rt.ui.rap.ext.table.TableEx;
+
+/**
+ * <h3>RwtScoutTable</h3> ...
+ * knownIssues - multi column sorting is not supported, unable to get any key
+ * mask in the selection event.
+ * <p>
+ * - multi line support in headers is not supported by rwt.
+ * <p>
+ * - multi line support in row texts is not supported so far. Might probably be done by customized table rows.
+ *
+ * @since 3.7.0 June 2011
+ */
+public interface IRwtScoutTableForPatch extends IRwtScoutTable {
+
+ TableColumnManager getUiColumnManager();
+
+ void initializeUiColumns();
+
+ @Override
+ IRwtEnvironment getUiEnvironment();
+
+ @Override
+ TableEx getUiField();
+
+ @Override
+ TableViewer getUiTableViewer();
+
+ void setUiTableViewer(TableViewer uiViewer);
+
+ ITableRow getUiSelectedRow();
+
+ ITableRow[] getUiSelectedRows();
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/RwtScoutTable.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/RwtScoutTable.java
index 08c7f5c044..e522aa2d15 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/RwtScoutTable.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/RwtScoutTable.java
@@ -1,1372 +1,1372 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.basic.table;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map.Entry;
-import java.util.TreeSet;
-import java.util.concurrent.atomic.AtomicReference;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.viewers.ColumnViewerToolTipSupport;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.TableViewerColumn;
-import org.eclipse.rwt.RWT;
-import org.eclipse.rwt.lifecycle.WidgetUtil;
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.beans.IPropertyObserver;
-import org.eclipse.scout.commons.dnd.TransferObject;
-import org.eclipse.scout.commons.holders.Holder;
-import org.eclipse.scout.commons.job.JobEx;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.ui.IDNDSupport;
-import org.eclipse.scout.rt.client.ui.IEventHistory;
-import org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.basic.table.IHeaderCell;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.client.ui.basic.table.RowIndexComparator;
-import org.eclipse.scout.rt.client.ui.basic.table.TableEvent;
-import org.eclipse.scout.rt.client.ui.basic.table.TableListener;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.customizer.ICustomColumn;
-import org.eclipse.scout.rt.ui.rap.RwtMenuUtility;
-import org.eclipse.scout.rt.ui.rap.basic.RwtScoutComposite;
-import org.eclipse.scout.rt.ui.rap.basic.table.celleditor.RwtScoutTableCellEditor;
-import org.eclipse.scout.rt.ui.rap.ext.MenuAdapterEx;
-import org.eclipse.scout.rt.ui.rap.ext.table.TableEx;
-import org.eclipse.scout.rt.ui.rap.ext.table.TableViewerEx;
-import org.eclipse.scout.rt.ui.rap.ext.table.util.TableRolloverSupport;
-import org.eclipse.scout.rt.ui.rap.extension.UiDecorationExtensionPoint;
-import org.eclipse.scout.rt.ui.rap.form.fields.AbstractRwtScoutDndSupport;
-import org.eclipse.scout.rt.ui.rap.keystroke.IRwtKeyStroke;
-import org.eclipse.scout.rt.ui.rap.keystroke.RwtKeyStroke;
-import org.eclipse.scout.rt.ui.rap.util.HtmlTextUtility;
-import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
-import org.eclipse.scout.rt.ui.rap.util.UiRedrawHandler;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.dnd.DropTargetEvent;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.MenuAdapter;
-import org.eclipse.swt.events.MenuDetectEvent;
-import org.eclipse.swt.events.MenuDetectListener;
-import org.eclipse.swt.events.MenuEvent;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.internal.widgets.MarkupValidator;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.TableItem;
-
-/**
- * <h3>RwtScoutTable</h3> ...
- * knownIssues - multi column sorting is not supported, unable to get any key
- * mask in the selection event.
- * <p>
- * - multi line support in headers is not supported by rwt.
- * <p>
- * - multi line support in row texts is not supported so far. Might probably be done by customized table rows.
- *
- * @since 3.7.0 June 2011
- */
-@SuppressWarnings("restriction")
-public class RwtScoutTable extends RwtScoutComposite<ITable> implements IRwtScoutTableForPatch {
- private P_ScoutTableListener m_scoutTableListener;
- private UiRedrawHandler m_redrawHandler;
-
- private Listener m_autoResizeColumnListener;
- private Listener m_columnListener = new P_TableColumnListener();
- private SelectionListener m_columnSortListener = new P_ColumnSortListener();
- private TableColumnManager m_uiColumnManager = new TableColumnManager();
- private RwtScoutTableCellEditor m_uiCellEditorComposite;
- private int[] m_uiColumnOrder;
- private Menu m_contextMenu;
- private Menu m_headerMenu;
- private TableViewer m_uiViewer;
- private IRwtKeyStroke[] m_uiKeyStrokes;
- private ClientSyncJob m_storeColumnWidthsJob;
-
- private RwtScoutColumnModel m_columnModel = null;
-
- private String m_variant = "";
-
- private AbstractTableKeyboardNavigationSupport m_keyboardNavigationSupport;
-
- public RwtScoutTable() {
- }
-
- public RwtScoutTable(String variant) {
- m_variant = variant;
- }
-
- @Override
- protected void initializeUi(Composite parent) {
- m_redrawHandler = new UiRedrawHandler(parent);
- int style;
- if (getScoutObject() != null && getScoutObject().isMultiSelect()) {
- style = SWT.MULTI;
- }
- else {
- style = SWT.SINGLE;
- }
- style |= SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION;
- TableEx table = getUiEnvironment().getFormToolkit().createTable(parent, style);
- if (StringUtility.hasText(m_variant)) {
- table.setData(WidgetUtil.CUSTOM_VARIANT, m_variant);
- }
- table.setData(RWT.MARKUP_ENABLED, Boolean.TRUE);
- table.setData(MarkupValidator.MARKUP_VALIDATION_DISABLED, Boolean.TRUE);
- table.setLinesVisible(true);
- table.setHeaderVisible(true);
- table.setTouchEnabled(RwtUtility.getBrowserInfo().isTablet() || RwtUtility.getBrowserInfo().isMobile());
- new TableRolloverSupport(table);
- table.addDisposeListener(new DisposeListener() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void widgetDisposed(DisposeEvent e) {
- if (m_headerMenu != null && !m_headerMenu.isDisposed()) {
- m_headerMenu.dispose();
- }
- if (m_contextMenu != null && !m_contextMenu.isDisposed()) {
- m_contextMenu.dispose();
- }
- }
- });
- TableViewer viewer = new TableViewerEx(table);
- ColumnViewerToolTipSupport.enableFor(viewer);
- viewer.setUseHashlookup(true);
- setUiTableViewer(viewer);
- setUiField(table);
- //cell editing support
- m_uiCellEditorComposite = new RwtScoutTableCellEditor(this);
- // header menu
- m_headerMenu = new Menu(viewer.getTable().getShell(), SWT.POP_UP);
- table.addMenuDetectListener(new P_RwtHeaderMenuDetectListener());
-
- //columns
- initializeUiColumns();
-
- RwtScoutTableModel tableModel = createUiTableModel();
- viewer.setContentProvider(tableModel);
- viewer.setInput(tableModel);
-
- // ui listeners
- viewer.addSelectionChangedListener(new P_RwtSelectionListener());
- P_RwtTableListener rwtTableListener = new P_RwtTableListener();
- table.addListener(SWT.MouseDown, rwtTableListener);
- table.addListener(SWT.MouseUp, rwtTableListener);
- table.addListener(SWT.MouseDoubleClick, rwtTableListener);
- table.addListener(SWT.MenuDetect, rwtTableListener);
- table.addListener(SWT.Resize, rwtTableListener);
- getUiEnvironment().addKeyStroke(table, new RwtKeyStroke((int) ' ') {
-
- @Override
- public void handleUiAction(Event e) {
- handleUiToggleAcction(e);
- }
- }, false);
-
- // context menu
- Menu contextMenu = new Menu(viewer.getTable().getShell(), SWT.POP_UP);
- contextMenu.addMenuListener(new P_ContextMenuListener());
- m_contextMenu = contextMenu;
- }
-
- @Override
- public boolean isUiDisposed() {
- return getUiField() == null || getUiField().isDisposed();
- }
-
- protected RwtScoutTableModel createUiTableModel() {
- return new RwtScoutTableModel(getScoutObject(), this, m_uiColumnManager);
- }
-
- protected RwtScoutColumnModel getUiColumnModel() {
- if (m_columnModel == null) {
- m_columnModel = new RwtScoutColumnModel(getScoutObject(), this, m_uiColumnManager);
- }
- return m_columnModel;
- }
-
- @Override
- public TableColumnManager getUiColumnManager() {
- return m_uiColumnManager;
- }
-
- @Override
- public void initializeUiColumns() {
- m_redrawHandler.pushControlChanging();
- try {
- for (TableColumn col : getUiField().getColumns()) {
- col.dispose();
- }
- /*
- * bug: rwt table first column can not be aligned nor an image can be set.
- * see also RwtScoutTableCellEditor
- */
- TableColumn dummyCol = new TableColumn(getUiField(), SWT.LEFT);
- dummyCol.setWidth(0);
- dummyCol.setResizable(false);
- dummyCol.setMoveable(false);
- boolean sortEnabled = false;
- IColumn<?>[] scoutColumnsOrdered;
- if (getScoutObject() != null) {
- scoutColumnsOrdered = getScoutObject().getColumnSet().getVisibleColumns();
- sortEnabled = getScoutObject().isSortEnabled();
- }
- else {
- scoutColumnsOrdered = new IColumn[0];
- }
- if (m_uiColumnManager == null) {
- m_uiColumnManager = new TableColumnManager();
- }
- m_uiColumnManager.initialize(scoutColumnsOrdered);
- boolean multilineHeaders = false;
- for (IColumn<?> scoutColumn : scoutColumnsOrdered) {
- IHeaderCell cell = scoutColumn.getHeaderCell();
- String cellText = cell.getText();
- if (cellText == null) {
- cellText = "";
- }
- boolean isHtml = HtmlTextUtility.isTextWithHtmlMarkup(cellText);
- if (!isHtml && cellText.indexOf("\n") >= 0) {
- multilineHeaders = true;
- }
- if (isHtml) {
- multilineHeaders = true;
- cellText = getUiEnvironment().adaptHtmlCell(RwtScoutTable.this, cellText);
- }
- int style = RwtUtility.getHorizontalAlignment(cell.getHorizontalAlignment());
- TableColumn rwtCol = new TableColumn(getUiField(), style);
- TableViewerColumn rwtViewerCol = new TableViewerColumn(getUiTableViewer(), rwtCol);
- rwtViewerCol.setLabelProvider(getUiColumnModel());
- rwtCol.setData(KEY_SCOUT_COLUMN, scoutColumn);
- rwtCol.setMoveable(true);
- rwtCol.setToolTipText(cell.getTooltipText());
- updateHeaderText(rwtCol, scoutColumn);
- rwtCol.setWidth(scoutColumn.getWidth());
- if (cell.isSortActive()) {
- getUiField().setSortColumn(rwtCol);
- getUiField().setSortDirection(cell.isSortAscending() ? SWT.UP : SWT.DOWN);
- }
- if (sortEnabled) {
- rwtCol.addSelectionListener(m_columnSortListener);
- }
- rwtCol.addListener(SWT.Move, m_columnListener);
- rwtCol.addListener(SWT.Resize, m_columnListener);
- }
- //multiline header settings
- if (multilineHeaders) {
- getUiField().setData("multiLineHeader", Boolean.TRUE);
- }
- m_uiColumnOrder = getUiField().getColumnOrder();
- //update cell editors
- m_uiCellEditorComposite.initializeUi();
- }
- finally {
- m_redrawHandler.popControlChanging();
- }
- }
-
- @Override
- protected void attachScout() {
- super.attachScout();
- if (getScoutObject() == null) {
- return;
- }
- if (m_scoutTableListener == null) {
- m_scoutTableListener = new P_ScoutTableListener();
- getScoutObject().addUITableListener(m_scoutTableListener);
- }
- setHeaderVisibleFromScout(getScoutObject().isHeaderVisible());
- setSelectionFromScout(getScoutObject().getSelectedRows());
- setKeyStrokeFormScout();
- setRowHeightFromScout();
- setKeyboardNavigationFromScout();
- updateAutoResizeColumnsFromScout();
- attachDndSupport();
- handleEventsFromRecentHistory();
- }
-
- private void handleEventsFromRecentHistory() {
- final IEventHistory<TableEvent> h = getScoutObject().getEventHistory();
- if (h == null) {
- return;
- }
-
- getUiEnvironment().getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- for (TableEvent e : h.getRecentEvents()) {
- handleScoutTableEventInUi(e);
- }
- }
- });
- }
-
- protected void attachDndSupport() {
- if (UiDecorationExtensionPoint.getLookAndFeel().isDndSupportEnabled()) {
- new P_DndSupport(getScoutObject(), getScoutObject(), getUiField());
- }
- }
-
- @Override
- protected void detachScout() {
- super.detachScout();
- removeAutoResizeColumnListener();
- if (getScoutObject() == null) {
- return;
- }
- if (m_scoutTableListener != null) {
- getScoutObject().removeTableListener(m_scoutTableListener);
- m_scoutTableListener = null;
- }
- }
-
- @Override
- public TableEx getUiField() {
- return (TableEx) super.getUiField();
- }
-
- @Override
- public TableViewer getUiTableViewer() {
- return m_uiViewer;
- }
-
- @Override
- public void setUiTableViewer(TableViewer uiViewer) {
- m_uiViewer = uiViewer;
- }
-
- @Override
- public ITableRow getUiSelectedRow() {
- ITableRow[] rows = getUiSelectedRows();
- if (rows.length > 0) {
- return rows[0];
- }
- return null;
- }
-
- @Override
- public ITableRow[] getUiSelectedRows() {
- StructuredSelection uiSelection = (StructuredSelection) getUiTableViewer().getSelection();
- TreeSet<ITableRow> sortedRows = new TreeSet<ITableRow>(new RowIndexComparator());
- if (uiSelection != null && !uiSelection.isEmpty()) {
- for (Object o : uiSelection.toArray()) {
- ITableRow row = (ITableRow) o;
- sortedRows.add(row);
- }
- }
- return sortedRows.toArray(new ITableRow[sortedRows.size()]);
- }
-
- protected void setKeyStrokeFormScout() {
- // remove old
- if (m_uiKeyStrokes != null) {
- for (IRwtKeyStroke rwtKeyStroke : m_uiKeyStrokes) {
- getUiEnvironment().removeKeyStroke(getUiField(), rwtKeyStroke);
- }
- }
- // add new
- ArrayList<IRwtKeyStroke> newRwtKeyStrokes = new ArrayList<IRwtKeyStroke>();
- IKeyStroke[] scoutKeyStrokes = getScoutObject().getKeyStrokes();
- for (IKeyStroke scoutKeyStroke : scoutKeyStrokes) {
- if (scoutKeyStroke.isEnabled()) {
- IRwtKeyStroke[] rwtStrokes = RwtUtility.getKeyStrokes(scoutKeyStroke, getUiEnvironment());
- for (IRwtKeyStroke rwtStroke : rwtStrokes) {
- getUiEnvironment().addKeyStroke(getUiField(), rwtStroke, false);
- newRwtKeyStrokes.add(rwtStroke);
- }
- }
- }
- m_uiKeyStrokes = newRwtKeyStrokes.toArray(new IRwtKeyStroke[newRwtKeyStrokes.size()]);
- }
-
- protected void setRowHeightFromScout() {
- int h = getScoutObject().getRowHeightHint();
- if (h >= 0) {
- getUiField().setData(RWT.CUSTOM_ITEM_HEIGHT, h);
- }
- if (isCreated()) {
- getUiTableViewer().refresh();
- }
- }
-
- protected void setKeyboardNavigationFromScout() {
- if (getScoutObject().hasKeyboardNavigation()) {
- if (m_keyboardNavigationSupport == null) {
- m_keyboardNavigationSupport = new P_KeyBoardNavigationSupport(getUiField());
- }
- }
- else {
- if (m_keyboardNavigationSupport != null) {
- m_keyboardNavigationSupport.dispose();
- m_keyboardNavigationSupport = null;
- }
- }
- }
-
- private void updateAutoResizeColumnsFromScout() {
- if (getUiField() != null && !getUiField().getParent().isDisposed()) {
- Composite parent = getUiField().getParent();
- if (getScoutObject().isAutoResizeColumns()) {
- if (m_autoResizeColumnListener == null) {
- m_autoResizeColumnListener = new P_RwtResizeListener();
- parent.addListener(SWT.Resize, m_autoResizeColumnListener);
- }
- //If the parent has already been resized no event will be fired anymore.
- //So it is necessary to request an auto resizing of the columns manually. (Bugzilla 355855)
- scheduleHandleAutoResizeColumn();
- }
- }
- else {
- removeAutoResizeColumnListener();
- }
- }
-
- private void scheduleHandleAutoResizeColumn() {
- getUiField().getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- handleAutoSizeColumns();
- }
- });
- }
-
- private void removeAutoResizeColumnListener() {
- if (m_autoResizeColumnListener == null) {
- return;
- }
-
- Composite parent = getUiField().getParent();
- parent.removeListener(SWT.Resize, m_autoResizeColumnListener);
- m_autoResizeColumnListener = null;
- }
-
- /**
- * scout property observer
- */
- @Override
- protected void handleScoutPropertyChange(String propName, Object newValue) {
- if (propName.equals(ITable.PROP_HEADER_VISIBLE)) {
- setHeaderVisibleFromScout(((Boolean) newValue).booleanValue());
- }
- else if (propName.equals(ITable.PROP_KEY_STROKES)) {
- setKeyStrokeFormScout();
- }
- else if (propName.equals(ITable.PROP_ROW_HEIGHT_HINT)) {
- setRowHeightFromScout();
- }
- else if (propName.equals(ITable.PROP_KEYBOARD_NAVIGATION)) {
- setKeyboardNavigationFromScout();
- }
- else if (propName.equals(ITable.PROP_AUTO_RESIZE_COLUMNS)) {
- updateAutoResizeColumnsFromScout();
- }
- else if (propName.equals(ITable.PROP_SCROLL_TO_SELECTION)) {
- updateScrollToSelectionFromScout();
- }
- }
-
- /**
- * scout table observer
- */
- protected boolean isHandleScoutTableEvent(TableEvent[] a) {
- for (TableEvent element : a) {
- switch (element.getType()) {
- case TableEvent.TYPE_REQUEST_FOCUS:
- case TableEvent.TYPE_REQUEST_FOCUS_IN_CELL:
- case TableEvent.TYPE_ROWS_INSERTED:
- case TableEvent.TYPE_ROWS_UPDATED:
- case TableEvent.TYPE_ROWS_DELETED:
- case TableEvent.TYPE_ALL_ROWS_DELETED:
- case TableEvent.TYPE_ROW_ORDER_CHANGED:
- case TableEvent.TYPE_ROW_FILTER_CHANGED:
- case TableEvent.TYPE_COLUMN_ORDER_CHANGED:
- case TableEvent.TYPE_COLUMN_HEADERS_UPDATED:
- case TableEvent.TYPE_COLUMN_STRUCTURE_CHANGED:
- case TableEvent.TYPE_ROWS_SELECTED:
- case TableEvent.TYPE_SCROLL_TO_SELECTION: {
- return true;
- }
- }
- }
- return false;
- }
-
- protected void handleScoutTableEventInUi(TableEvent e) {
- if (isUiDisposed()) {
- return;
- }
- RwtScoutTableEvent uiTableEvent = null;
- /*
- * check the scout observer to filter all events that are used here
- * @see isHandleScoutTableEvent()
- */
- switch (e.getType()) {
- case TableEvent.TYPE_REQUEST_FOCUS: {
- getUiField().setFocus();
- break;
- }
- case TableEvent.TYPE_REQUEST_FOCUS_IN_CELL: {
- //start editing
- int swtCol = -1;
- TableColumn[] swtColumns = getUiField().getColumns();
- for (int c = 0; c < swtColumns.length; c++) {
- if (swtColumns[c].getData(KEY_SCOUT_COLUMN) == e.getFirstColumn()) {
- swtCol = c;
- break;
- }
- }
- ITableRow scoutRow = e.getFirstRow();
- if (scoutRow != null && swtCol >= 0) {
- getUiTableViewer().editElement(scoutRow, swtCol);
- }
- break;
- }
- case TableEvent.TYPE_SCROLL_TO_SELECTION: {
- scrollToSelection();
- break;
- }
- case TableEvent.TYPE_ROWS_INSERTED:
- case TableEvent.TYPE_ROWS_UPDATED:
- case TableEvent.TYPE_ROWS_DELETED:
- case TableEvent.TYPE_ALL_ROWS_DELETED:
- case TableEvent.TYPE_ROW_FILTER_CHANGED:
- case TableEvent.TYPE_ROW_ORDER_CHANGED: {
- uiTableEvent = new RwtScoutTableEvent();
- break;
- }
- case TableEvent.TYPE_COLUMN_ORDER_CHANGED:
- break;
- case TableEvent.TYPE_COLUMN_HEADERS_UPDATED:
- headerUpdateFromScout();
- break;
- case TableEvent.TYPE_COLUMN_STRUCTURE_CHANGED: {
- // re-install columns
- initializeUiColumns();
- if (getScoutObject().isAutoResizeColumns()) {
- handleAutoSizeColumns();
- }
-
- uiTableEvent = new RwtScoutTableEvent();
- break;
- }
- case TableEvent.TYPE_ROWS_SELECTED: {
- setSelectionFromScout(e.getRows());
- break;
- }
- }
- //
- if (uiTableEvent != null) {
- getUiColumnModel().consumeColumnModelEvent(uiTableEvent);
- ((RwtScoutTableModel) getUiTableViewer().getContentProvider()).consumeTableModelEvent(uiTableEvent);
- getUiTableViewer().refresh();
- }
- // refresh selection, indexes might have changed
- switch (e.getType()) {
- case TableEvent.TYPE_ROW_FILTER_CHANGED:
- // Update column title if filter changed (mark column as filtered)
- for (TableColumn swtCol : getUiField().getColumns()) {
- updateHeaderText(swtCol);
- }
- setSelectionFromScout(e.getTable().getSelectedRows());
- break;
- case TableEvent.TYPE_ROWS_INSERTED:
- case TableEvent.TYPE_ROWS_UPDATED:
- case TableEvent.TYPE_ROWS_DELETED:
- case TableEvent.TYPE_ALL_ROWS_DELETED:
- case TableEvent.TYPE_ROW_ORDER_CHANGED: {
- setSelectionFromScout(e.getTable().getSelectedRows());
- break;
- }
- }
- }
-
- private void updateHeaderText(TableColumn swtCol) {
- if (swtCol == null) {
- return;
- }
- Object data = swtCol.getData(KEY_SCOUT_COLUMN);
- if (data instanceof IColumn<?>) {
- updateHeaderText(swtCol, (IColumn<?>) data);
- }
- }
-
- private void updateHeaderText(TableColumn swtCol, IColumn<?> scoutCol) {
- updateHeaderText(swtCol, scoutCol, false);
- }
-
- private void updateHeaderText(TableColumn swtCol, IColumn<?> scoutCol, boolean indicateSortOrder) {
- IHeaderCell cell = scoutCol.getHeaderCell();
- String text = cell.getText();
- if (text == null) {
- text = "";
- }
- if (scoutCol instanceof ICustomColumn) {
- text = "[+] " + text;
- }
- if (scoutCol.isColumnFilterActive()) {
- text = "(*) " + text;
- }
- if (indicateSortOrder) {
- if (scoutCol.isSortAscending()) {
- text = "[a-z] " + text;
- }
- else {
- text = "[z-a] " + text;
- }
- }
- swtCol.setText(text);
- }
-
- protected void setHeaderVisibleFromScout(boolean headerVisible) {
- getUiField().setHeaderVisible(headerVisible);
- }
-
- @Override
- public void setEnabledFromScout(boolean enabledFromScout) {
- getUiField().setEnabled(!enabledFromScout);
- // <Workaround>
- // Because RAP seems to ignore the default ":disabled" state,
- // we apply a custom variant to all header cells. Otherwise
- // the "normal" style would be used for disabled cells.
- for (TableColumn column : getUiField().getColumns()) {
- column.setData(WidgetUtil.CUSTOM_VARIANT, (enabledFromScout ? null : VARIANT_TABLE_COLUMN_DISABLED));
- }
- // </Workaround>
- }
-
- protected void setSelectionFromScout(ITableRow[] selectedRows) {
- if (getUiField().isDisposed()) {
- return;
- }
- ITableRow[] uiSelection = getUiSelectedRows();
- if (CompareUtility.equals(uiSelection, selectedRows)) {
- // no change
- return;
- }
- else {
- if (selectedRows == null) {
- selectedRows = new ITableRow[0];
- }
- getUiTableViewer().setSelection(new StructuredSelection(selectedRows), true);
- updateScrollToSelectionFromScout();
- }
- }
-
- private void updateScrollToSelectionFromScout() {
- if (getScoutObject().isScrollToSelection()) {
- scrollToSelection();
- }
- }
-
- protected void scrollToSelection() {
- if (getUiField() != null && !getUiField().isDisposed()) {
- getUiField().showSelection();
- }
- }
-
- protected void setContextColumnFromUi(TableColumn uiColumn) {
- if (getScoutObject() != null) {
- //try to find correct location, since TableColumn has NO x,y and is not a Control!
- Point pDisp = getUiField().toDisplay(-getUiField().getHorizontalBar().getSelection(), 0);
- for (TableColumn c : getUiField().getColumns()) {
- if (c == uiColumn) {
- break;
- }
- pDisp.x += c.getWidth();
- }
- getUiEnvironment().setPopupOwner(getUiField(), new Rectangle(pDisp.x - 2, pDisp.y, 1, getUiField().getHeaderHeight()));
- // notify Scout
- IColumn scoutColumn = null;
- if (uiColumn != null) {
- scoutColumn = (IColumn<?>) uiColumn.getData(KEY_SCOUT_COLUMN);
- }
- final IColumn finalCol = scoutColumn;
- Runnable t = new Runnable() {
- @Override
- public void run() {
- getScoutObject().getUIFacade().setContextColumnFromUI(finalCol);
- }
- };
- getUiEnvironment().invokeScoutLater(t, 0);
- // end notify
- }
- }
-
- private int getVisualCellIndex(TableItem tableItem, int columnIndex) {
- int visualCellIndex = columnIndex;
- final int[] columnOrder = tableItem.getParent().getColumnOrder();
- for (int element : columnOrder) {
- if (element == columnIndex) {
- visualCellIndex = columnIndex;
- }
- }
- return visualCellIndex;
- }
-
- protected void setSelectionFromUi(final StructuredSelection selection) {
- if (getUpdateUiFromScoutLock().isAcquired()) {
- return;
- }
- //
- if (getScoutObject() != null) {
- // notify Scout
- Runnable t = new Runnable() {
- @Override
- public void run() {
- try {
- addIgnoredScoutEvent(TableEvent.class, "" + TableEvent.TYPE_ROWS_SELECTED);
- //
- getScoutObject().getUIFacade().setSelectedRowsFromUI(RwtUtility.getItemsOfSelection(ITableRow.class, selection));
- }
- finally {
- removeIgnoredScoutEvent(TableEvent.class, "" + TableEvent.TYPE_ROWS_SELECTED);
- }
- }
- };
- getUiEnvironment().invokeScoutLater(t, 0);
- // end notify
- }
- }
-
- protected void headerUpdateFromScout() {
- // Because SWT can only indicate one sort column, we will use the first (i.e. the column
- // with the lowest sort index) user sort column that is visible for that purpose. Further
- // sort columns will be indicated by a special header text (see updateHeaderText() method).
- int minSortIndex = -1;
- TableColumn minUiSortColumn = null;
- IColumn<?> minScoutSortColumn = null;
- for (TableColumn col : getUiField().getColumns()) {
- Object data = col.getData(KEY_SCOUT_COLUMN);
- if (data instanceof IColumn<?>) {
- IColumn<?> cell = (IColumn<?>) data;
- if (cell.isSortExplicit() && (minSortIndex == -1 || cell.getSortIndex() < minSortIndex)) {
- minSortIndex = cell.getSortIndex();
- minUiSortColumn = col;
- minScoutSortColumn = cell;
- }
- }
- }
-
- if (minUiSortColumn != null && minScoutSortColumn != null) {
- getUiField().setSortColumn(minUiSortColumn);
- getUiField().setSortDirection(minScoutSortColumn.isSortAscending() ? SWT.UP : SWT.DOWN);
- }
- else {
- getUiField().setSortColumn(null);
- }
- for (TableColumn col : getUiField().getColumns()) {
- Object data = col.getData(KEY_SCOUT_COLUMN);
- if (data instanceof IColumn<?>) {
- IColumn<?> cell = (IColumn<?>) data;
- boolean indicateSortOrder = (cell.isSortExplicit() && cell != minScoutSortColumn);
- updateHeaderText(col, cell, indicateSortOrder);
- }
- }
- }
-
- protected void handleUiRowClick(final ITableRow row) {
- if (getScoutObject() != null) {
- if (row != null) {
- // notify Scout
- Runnable t = new Runnable() {
- @Override
- public void run() {
- getScoutObject().getUIFacade().fireRowClickFromUI(row);
- }
- };
- getUiEnvironment().invokeScoutLater(t, 0);
- // end notify
- }
- }
- }
-
- protected void handleUiRowAction(final ITableRow row) {
- if (getScoutObject() != null) {
- if (!getScoutObject().isCheckable() && row != null) {
- // notify Scout
- Runnable t = new Runnable() {
- @Override
- public void run() {
- getScoutObject().getUIFacade().fireRowActionFromUI(row);
- }
- };
- getUiEnvironment().invokeScoutLater(t, 0);
- // end notify
- }
- }
- }
-
- protected void handleUiHyperlinkAction(String urlText) {
- if (getScoutObject() != null) {
- final URL url;
- try {
- url = new URL(urlText);
- }
- catch (MalformedURLException e) {
- //nop
- return;
- }
- // notify Scout
- Runnable t = new Runnable() {
- @Override
- public void run() {
- ITable table = getScoutObject();
- table.getUIFacade().fireHyperlinkActionFromUI(table.getSelectedRow(), table.getContextColumn(), url);
- }
- };
- getUiEnvironment().invokeScoutLater(t, 0);
- // end notify
- }
- }
-
- /**
- * Distributes the table width to the columns considered column weights of
- * model. Empty space will be distributed weighted.
- */
- protected void handleAutoSizeColumns() {
- if (getUiField() == null || getUiField().isDisposed()) {
- return;
- }
-
- int totalWidth = getUiField().getClientArea().width;
- /* fixed in rwt
- if (getUiField().getVerticalBar() != null && getUiField().getVerticalBar().getVisible()) {
- totalWidth -= getUiField().getVerticalBar().getSize().x;
- }
- */
- if (totalWidth < 32) {
- //either not showing or not yet layouted
- return;
- }
- int totalWeight = 0;
- int actualWidth = 0;
- HashMap<TableColumn, Integer> columnWeights = new HashMap<TableColumn, Integer>();
- for (TableColumn col : getUiField().getColumns()) {
- if (col == null || col.isDisposed()) {
- continue;
- }
- actualWidth += col.getWidth();
- Object data = col.getData(RwtScoutTable.KEY_SCOUT_COLUMN);
- if (data instanceof IColumn<?>) {
- int width = ((IColumn<?>) data).getInitialWidth();
- columnWeights.put(col, width);
- totalWeight += width;
- }
- else {
- totalWidth -= col.getWidth();
- }
- }
-
- //If the columns already have the correct size there is no need to recalculate it
- if (actualWidth == totalWidth) {
- return;
- }
-
- double factor = (double) totalWidth / (double) totalWeight;
- int i = 0;
- for (Entry<TableColumn, Integer> entry : columnWeights.entrySet()) {
- if (i < columnWeights.size() - 1) {
- int width = (int) (factor * entry.getValue().intValue());
- entry.getKey().setWidth(width);
- totalWidth -= width;
- i++;
- }
- else {
- entry.getKey().setWidth(totalWidth);
- }
- }
- }
-
- protected void handleUiColumnResized(TableColumn column) {
- if (column.isDisposed()) {
- return;
- }
- if (!column.getParent().isVisible()) {
- return;
- }
- if (getUpdateUiFromScoutLock().isAcquired()) {
- return;
- }
- //
- final int width = column.getWidth();
- final IColumn<?> scoutColumn = (IColumn<?>) column.getData(KEY_SCOUT_COLUMN);
- if (scoutColumn != null) {
- if (scoutColumn.getWidth() != width) {
-
- //Cancel already scheduled resize job to protect the model from too many resize events.
- if (m_storeColumnWidthsJob != null) {
- m_storeColumnWidthsJob.cancel();
- }
-
- /*
- * imo, 04.06.2009: added swt-side optimistic lock check Method
- * autoSizeColumns indirectly calls this code by setting the width on a
- * table column if this code calls scout using synchronizer it may
- * invoke pending swt jobs while waiting, which can execute a dispose
- * form job. After that job all columns are disposed. This results in
- * WidgetDisposed exceptions on line with entry.getKey().setWidth(...)
- */
- m_storeColumnWidthsJob = new ClientSyncJob("Store column widths", getUiEnvironment().getClientSession()) {
- @Override
- protected IStatus runStatus(IProgressMonitor monitor) {
- try {
- addIgnoredScoutEvent(TableEvent.class, "" + TableEvent.TYPE_COLUMN_STRUCTURE_CHANGED);
- //
- getScoutObject().getUIFacade().setColumnWidthFromUI(scoutColumn, width);
- }
- finally {
- removeIgnoredScoutEvent(TableEvent.class, "" + TableEvent.TYPE_COLUMN_STRUCTURE_CHANGED);
- }
-
- return Status.OK_STATUS;
- }
- };
- m_storeColumnWidthsJob.schedule(400);
- }
- }
- }
-
- protected void handleUiColumnMoved() {
- if (getUpdateUiFromScoutLock().isAcquired()) {
- return;
- }
- int[] uiColumnOrder = getUiField().getColumnOrder();
- // do not allow to reorder icon and dummy column
- if (uiColumnOrder[0] != 0) {
- getUiField().setColumnOrder(m_uiColumnOrder);
- return;
- }
- // if column with icon has changed position
- if (uiColumnOrder[1] != m_uiColumnOrder[1]
- && getScoutObject().getRowCount() > 0
- && StringUtility.hasText(getScoutObject().getRow(0).getIconId())) {
- getUiTableViewer().refresh();
- }
- int[] truncatedColOrder = new int[uiColumnOrder.length - 1];
- for (int i = 0; i < truncatedColOrder.length; i++) {
- truncatedColOrder[i] = uiColumnOrder[i + 1] - 1;
- }
- final IColumn<?>[] newOrder = m_uiColumnManager.getOrderedColumns(truncatedColOrder);
- if (m_uiColumnManager.applyNewOrder(newOrder)) {
- m_uiColumnOrder = uiColumnOrder;
- // notify Scout
- Runnable t = new Runnable() {
- @Override
- public void run() {
- try {
- addIgnoredScoutEvent(TableEvent.class, "" + TableEvent.TYPE_COLUMN_ORDER_CHANGED);
- addIgnoredScoutEvent(TableEvent.class, "" + TableEvent.TYPE_COLUMN_STRUCTURE_CHANGED);
- //
- getScoutObject().getUIFacade().fireVisibleColumnsChangedFromUI(newOrder);
- }
- finally {
- removeIgnoredScoutEvent(TableEvent.class, "" + TableEvent.TYPE_COLUMN_ORDER_CHANGED);
- removeIgnoredScoutEvent(TableEvent.class, "" + TableEvent.TYPE_COLUMN_STRUCTURE_CHANGED);
- }
- }
- };
- getUiEnvironment().invokeScoutLater(t, 0);
- // end notify
- }
- }
-
- protected void handleKeyboardNavigationFromUi(TableItem item) {
- getUiField().setSelection(item);
- Event selectionEvent = new Event();
- selectionEvent.type = SWT.DefaultSelection;
- selectionEvent.widget = getUiField();
- for (Listener l : getUiField().getListeners(SWT.DefaultSelection)) {
- l.handleEvent(selectionEvent);
- }
- }
-
- protected void handleUiToggleAcction(Event e) {
- if (e.doit && getScoutObject().isCheckable()) {
- if (e.stateMask == 0) {
- switch (e.keyCode) {
- case ' ':
- ITableRow[] selectedRows = RwtUtility.getItemsOfSelection(ITableRow.class, (StructuredSelection) getUiTableViewer().getSelection());
- if (selectedRows != null && selectedRows.length > 0) {
- handleUiRowClick(selectedRows[0]);
- }
- e.doit = false;
- break;
- }
- }
- }
- }
-
- private class P_ScoutTableListener implements TableListener {
- @Override
- public void tableChanged(final TableEvent e) {
- if (isHandleScoutTableEvent(new TableEvent[]{e})) {
- if (isIgnoredScoutEvent(TableEvent.class, "" + e.getType())) {
- return;
- }
- Runnable t = new Runnable() {
- @Override
- public void run() {
- try {
- getUpdateUiFromScoutLock().acquire();
- //
- handleScoutTableEventInUi(e);
- }
- finally {
- getUpdateUiFromScoutLock().release();
- }
- }
- };
- getUiEnvironment().invokeUiLater(t);
- }
- }
-
- @Override
- public void tableChangedBatch(final TableEvent[] a) {
- if (isHandleScoutTableEvent(a)) {
- final ArrayList<TableEvent> filteredList = new ArrayList<TableEvent>();
- for (int i = 0; i < a.length; i++) {
- if (!isIgnoredScoutEvent(TableEvent.class, "" + a[i].getType())) {
- filteredList.add(a[i]);
- }
- }
- if (filteredList.size() == 0) {
- return;
- }
- Runnable t = new Runnable() {
- @Override
- public void run() {
- if (isUiDisposed()) {
- return;
- }
- m_redrawHandler.pushControlChanging();
- try {
- try {
- getUpdateUiFromScoutLock().acquire();
- //
- for (TableEvent element : filteredList) {
- handleScoutTableEventInUi(element);
- }
- }
- finally {
- getUpdateUiFromScoutLock().release();
- }
- }
- finally {
- m_redrawHandler.popControlChanging();
- }
- }
- };
- getUiEnvironment().invokeUiLater(t);
- }
- }
- }// end P_ScoutTableListener
-
- private void showMenu(Point eventPosition) {
- Point pt = getUiField().getDisplay().map(null, getUiField(), eventPosition);
- Rectangle clientArea = getUiField().getClientArea();
- boolean header = clientArea.y <= pt.y && pt.y < clientArea.y + getUiField().getHeaderHeight();
- getUiField().setMenu(header ? m_headerMenu : m_contextMenu);
- getUiField().getMenu().addMenuListener(new MenuAdapter() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void menuHidden(MenuEvent e) {
- getUiField().setMenu(null);
- ((Menu) e.getSource()).removeMenuListener(this);
- }
- });
- getUiField().getMenu().setLocation(eventPosition);
- getUiField().getMenu().setVisible(true);
- }
-
- private class P_RwtTableListener implements Listener {
- private static final long serialVersionUID = 1L;
-
- private Boolean m_doubleClicked = Boolean.FALSE;
-
- @Override
- public void handleEvent(Event event) {
- Point eventPosition = new Point(event.x, event.y);
- switch (event.type) {
- case SWT.MouseDown: {
- setContextColumnFromUi(RwtUtility.getRwtColumnAt(getUiTableViewer().getTable(), eventPosition));
- if (getUiField().getItem(eventPosition) == null) {
- getUiTableViewer().setSelection(null);
- setSelectionFromUi(new StructuredSelection());
- }
- break;
- }
- case SWT.MouseUp: {
- synchronized (m_doubleClicked) {
- if (m_doubleClicked == Boolean.TRUE) {
- m_doubleClicked = Boolean.FALSE;
- break;
- }
- }
- StructuredSelection selection = (StructuredSelection) getUiTableViewer().getSelection();
- if (selection != null && selection.size() == 1) {
- handleUiRowClick((ITableRow) selection.getFirstElement());
- }
- break;
- }
- case SWT.MouseDoubleClick: {
- synchronized (m_doubleClicked) {
- m_doubleClicked = Boolean.TRUE;
- }
- StructuredSelection selection = (StructuredSelection) getUiTableViewer().getSelection();
- if (selection != null && selection.size() == 1) {
- handleUiRowAction((ITableRow) selection.getFirstElement());
- }
- break;
- }
- case SWT.Resize: {
- //lazy column auto-fit
- if (getUiField() != null && !getUiField().isDisposed()) {
- if (getScoutObject().isAutoResizeColumns()) {
- scheduleHandleAutoResizeColumn();
- }
- updateScrollToSelectionFromScout();
- }
- break;
- }
- case SWT.MenuDetect: {
- showMenu(eventPosition);
- break;
- }
- }
- }
- }
-
- private class P_RwtResizeListener implements Listener {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void handleEvent(Event event) {
- //lazy column auto-fit
- if (getUiField() != null && !getUiField().isDisposed()) {
- if (getScoutObject().isAutoResizeColumns()) {
- scheduleHandleAutoResizeColumn();
- }
- updateScrollToSelectionFromScout();
- }
- }
- } // end class P_SwtResizeListener
-
- public class P_RwtSelectionListener implements ISelectionChangedListener {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- setSelectionFromUi((StructuredSelection) event.getSelection());
- }
- }
-
- private class P_TableColumnListener implements Listener {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void handleEvent(Event event) {
- switch (event.type) {
- case SWT.Move:
- handleUiColumnMoved();
- break;
- case SWT.Resize:
- if (event.widget instanceof TableColumn) {
- handleUiColumnResized((TableColumn) event.widget);
- }
-
- }
- }
-
- } // end class P_TableColumnMoveListener
-
- private class P_ColumnSortListener extends SelectionAdapter {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- TableColumn col = (TableColumn) e.getSource();
- setContextColumnFromUi(col);
- final IColumn<?> newColumn = (IColumn<?>) col.getData(KEY_SCOUT_COLUMN);
- final boolean ctrlKeyPressed = ((e.stateMask & SWT.CONTROL) > 0);
- if (getScoutObject() != null) {
- Runnable job = new Runnable() {
- @Override
- public void run() {
- getScoutObject().getUIFacade().fireHeaderSortFromUI(newColumn, ctrlKeyPressed);
- }
- };
- getUiEnvironment().invokeScoutLater(job, 0);
- }
- }
- } // end class P_ColumnSortListener
-
- private class P_ContextMenuListener extends MenuAdapterEx {
-
- private static final long serialVersionUID = 1L;
-
- public P_ContextMenuListener() {
- super(RwtScoutTable.this.getUiTableViewer().getTable(), RwtScoutTable.this.getUiTableViewer().getTable().getParent());
- }
-
- @Override
- protected Menu getContextMenu() {
- return m_contextMenu;
- }
-
- @Override
- protected void setContextMenu(Menu contextMenu) {
- m_contextMenu = contextMenu;
- }
-
- @Override
- public void menuShown(MenuEvent e) {
- super.menuShown(e);
-
- final boolean emptySelection = getUiTableViewer().getSelection().isEmpty();
- IMenu[] menus = RwtMenuUtility.collectMenus(getScoutObject(), emptySelection, !emptySelection, getUiEnvironment());
-
- RwtMenuUtility.fillContextMenu(menus, getUiEnvironment(), m_contextMenu);
- }
-
- } // end class P_ContextMenuListener
-
- private class P_RwtHeaderMenuDetectListener implements MenuDetectListener {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void menuDetected(MenuDetectEvent event) {
- Table table = getUiField();
- Point pTable = table.getDisplay().map(null, table, new Point(event.x, event.y));
- Rectangle clientArea = table.getClientArea();
- boolean header = clientArea.y <= pTable.y && pTable.y < clientArea.y + table.getHeaderHeight();
- if (!header) {
- return;
- }
- // clear all previous
- // Windows BUG: fires menu hide before the selection on the menu item is
- // propagated.
- if (m_headerMenu != null) {
- for (MenuItem item : m_headerMenu.getItems()) {
- disposeMenuItem(item);
- }
- }
- setContextColumnFromUi(RwtUtility.getRwtColumnAt(getUiTableViewer().getTable(), pTable));
- final AtomicReference<IMenu[]> scoutMenusRef = new AtomicReference<IMenu[]>();
- Runnable t = new Runnable() {
- @Override
- public void run() {
- IMenu[] scoutMenus = getScoutObject().getUIFacade().fireHeaderPopupFromUI();
- scoutMenusRef.set(scoutMenus);
- }
- };
- JobEx job = getUiEnvironment().invokeScoutLater(t, 1200);
- try {
- job.join(1200);
- }
- catch (InterruptedException ex) {
- //nop
- }
- // grab the actions out of the job, when the actions are providden
- // within the scheduled time the popup will be handled.
- if (scoutMenusRef.get() != null) {
- RwtMenuUtility.fillContextMenu(scoutMenusRef.get(), getUiEnvironment(), m_headerMenu);
- }
- }
-
- protected void disposeMenuItem(MenuItem item) {
- Menu menu = item.getMenu();
- if (menu != null) {
- for (MenuItem childItem : menu.getItems()) {
- disposeMenuItem(childItem);
- }
- menu.dispose();
- }
- item.dispose();
- }
- } // end class P_HeaderMenuListener
-
- private class P_DndSupport extends AbstractRwtScoutDndSupport {
- public P_DndSupport(IPropertyObserver scoutObject, IDNDSupport scoutDndSupportable, Control control) {
- super(scoutObject, scoutDndSupportable, control, RwtScoutTable.this.getUiEnvironment());
- }
-
- @Override
- protected TransferObject handleUiDragRequest() {
- final Holder<TransferObject> result = new Holder<TransferObject>(TransferObject.class, null);
- Runnable t = new Runnable() {
- @Override
- public void run() {
- TransferObject scoutTransferable = getScoutObject().getUIFacade().fireRowsDragRequestFromUI();
- result.setValue(scoutTransferable);
- }
- };
- try {
- getUiEnvironment().invokeScoutLater(t, 20000).join(20000);
- }
- catch (InterruptedException e) {
- //nop
- }
- return result.getValue();
- }
-
- @Override
- protected void handleUiDropAction(DropTargetEvent event, final TransferObject scoutTransferObject) {
- Object dropTarget = event.item != null ? event.item.getData() : null;
- final ITableRow row = dropTarget instanceof ITableRow ? (ITableRow) dropTarget : null;
- Runnable job = new Runnable() {
- @Override
- public void run() {
- getScoutObject().getUIFacade().fireRowDropActionFromUI(row, scoutTransferObject);
- }
- };
- getUiEnvironment().invokeScoutLater(job, 200);
- }
- }// end class P_DndSupport
-
- private class P_KeyBoardNavigationSupport extends AbstractTableKeyboardNavigationSupport {
- /**
- * @param table
- * @param delay
- */
- public P_KeyBoardNavigationSupport(TableEx table) {
- super(table);
- }
-
- @Override
- public void handleKeyboardNavigation(TableItem tableItem) {
- handleKeyboardNavigationFromUi(tableItem);
- }
- } // P_KeyBoardNavigationSupport
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.basic.table;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map.Entry;
+import java.util.TreeSet;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.viewers.ColumnViewerToolTipSupport;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TableViewerColumn;
+import org.eclipse.rwt.RWT;
+import org.eclipse.rwt.lifecycle.WidgetUtil;
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.beans.IPropertyObserver;
+import org.eclipse.scout.commons.dnd.TransferObject;
+import org.eclipse.scout.commons.holders.Holder;
+import org.eclipse.scout.commons.job.JobEx;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.ui.IDNDSupport;
+import org.eclipse.scout.rt.client.ui.IEventHistory;
+import org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.basic.table.IHeaderCell;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.client.ui.basic.table.RowIndexComparator;
+import org.eclipse.scout.rt.client.ui.basic.table.TableEvent;
+import org.eclipse.scout.rt.client.ui.basic.table.TableListener;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.customizer.ICustomColumn;
+import org.eclipse.scout.rt.ui.rap.RwtMenuUtility;
+import org.eclipse.scout.rt.ui.rap.basic.RwtScoutComposite;
+import org.eclipse.scout.rt.ui.rap.basic.table.celleditor.RwtScoutTableCellEditor;
+import org.eclipse.scout.rt.ui.rap.ext.MenuAdapterEx;
+import org.eclipse.scout.rt.ui.rap.ext.table.TableEx;
+import org.eclipse.scout.rt.ui.rap.ext.table.TableViewerEx;
+import org.eclipse.scout.rt.ui.rap.ext.table.util.TableRolloverSupport;
+import org.eclipse.scout.rt.ui.rap.extension.UiDecorationExtensionPoint;
+import org.eclipse.scout.rt.ui.rap.form.fields.AbstractRwtScoutDndSupport;
+import org.eclipse.scout.rt.ui.rap.keystroke.IRwtKeyStroke;
+import org.eclipse.scout.rt.ui.rap.keystroke.RwtKeyStroke;
+import org.eclipse.scout.rt.ui.rap.util.HtmlTextUtility;
+import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
+import org.eclipse.scout.rt.ui.rap.util.UiRedrawHandler;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.dnd.DropTargetEvent;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.MenuAdapter;
+import org.eclipse.swt.events.MenuDetectEvent;
+import org.eclipse.swt.events.MenuDetectListener;
+import org.eclipse.swt.events.MenuEvent;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.internal.widgets.MarkupValidator;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+
+/**
+ * <h3>RwtScoutTable</h3> ...
+ * knownIssues - multi column sorting is not supported, unable to get any key
+ * mask in the selection event.
+ * <p>
+ * - multi line support in headers is not supported by rwt.
+ * <p>
+ * - multi line support in row texts is not supported so far. Might probably be done by customized table rows.
+ *
+ * @since 3.7.0 June 2011
+ */
+@SuppressWarnings("restriction")
+public class RwtScoutTable extends RwtScoutComposite<ITable> implements IRwtScoutTableForPatch {
+ private P_ScoutTableListener m_scoutTableListener;
+ private UiRedrawHandler m_redrawHandler;
+
+ private Listener m_autoResizeColumnListener;
+ private Listener m_columnListener = new P_TableColumnListener();
+ private SelectionListener m_columnSortListener = new P_ColumnSortListener();
+ private TableColumnManager m_uiColumnManager = new TableColumnManager();
+ private RwtScoutTableCellEditor m_uiCellEditorComposite;
+ private int[] m_uiColumnOrder;
+ private Menu m_contextMenu;
+ private Menu m_headerMenu;
+ private TableViewer m_uiViewer;
+ private IRwtKeyStroke[] m_uiKeyStrokes;
+ private ClientSyncJob m_storeColumnWidthsJob;
+
+ private RwtScoutColumnModel m_columnModel = null;
+
+ private String m_variant = "";
+
+ private AbstractTableKeyboardNavigationSupport m_keyboardNavigationSupport;
+
+ public RwtScoutTable() {
+ }
+
+ public RwtScoutTable(String variant) {
+ m_variant = variant;
+ }
+
+ @Override
+ protected void initializeUi(Composite parent) {
+ m_redrawHandler = new UiRedrawHandler(parent);
+ int style;
+ if (getScoutObject() != null && getScoutObject().isMultiSelect()) {
+ style = SWT.MULTI;
+ }
+ else {
+ style = SWT.SINGLE;
+ }
+ style |= SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION;
+ TableEx table = getUiEnvironment().getFormToolkit().createTable(parent, style);
+ if (StringUtility.hasText(m_variant)) {
+ table.setData(WidgetUtil.CUSTOM_VARIANT, m_variant);
+ }
+ table.setData(RWT.MARKUP_ENABLED, Boolean.TRUE);
+ table.setData(MarkupValidator.MARKUP_VALIDATION_DISABLED, Boolean.TRUE);
+ table.setLinesVisible(true);
+ table.setHeaderVisible(true);
+ table.setTouchEnabled(RwtUtility.getBrowserInfo().isTablet() || RwtUtility.getBrowserInfo().isMobile());
+ new TableRolloverSupport(table);
+ table.addDisposeListener(new DisposeListener() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void widgetDisposed(DisposeEvent e) {
+ if (m_headerMenu != null && !m_headerMenu.isDisposed()) {
+ m_headerMenu.dispose();
+ }
+ if (m_contextMenu != null && !m_contextMenu.isDisposed()) {
+ m_contextMenu.dispose();
+ }
+ }
+ });
+ TableViewer viewer = new TableViewerEx(table);
+ ColumnViewerToolTipSupport.enableFor(viewer);
+ viewer.setUseHashlookup(true);
+ setUiTableViewer(viewer);
+ setUiField(table);
+ //cell editing support
+ m_uiCellEditorComposite = new RwtScoutTableCellEditor(this);
+ // header menu
+ m_headerMenu = new Menu(viewer.getTable().getShell(), SWT.POP_UP);
+ table.addMenuDetectListener(new P_RwtHeaderMenuDetectListener());
+
+ //columns
+ initializeUiColumns();
+
+ RwtScoutTableModel tableModel = createUiTableModel();
+ viewer.setContentProvider(tableModel);
+ viewer.setInput(tableModel);
+
+ // ui listeners
+ viewer.addSelectionChangedListener(new P_RwtSelectionListener());
+ P_RwtTableListener rwtTableListener = new P_RwtTableListener();
+ table.addListener(SWT.MouseDown, rwtTableListener);
+ table.addListener(SWT.MouseUp, rwtTableListener);
+ table.addListener(SWT.MouseDoubleClick, rwtTableListener);
+ table.addListener(SWT.MenuDetect, rwtTableListener);
+ table.addListener(SWT.Resize, rwtTableListener);
+ getUiEnvironment().addKeyStroke(table, new RwtKeyStroke((int) ' ') {
+
+ @Override
+ public void handleUiAction(Event e) {
+ handleUiToggleAcction(e);
+ }
+ }, false);
+
+ // context menu
+ Menu contextMenu = new Menu(viewer.getTable().getShell(), SWT.POP_UP);
+ contextMenu.addMenuListener(new P_ContextMenuListener());
+ m_contextMenu = contextMenu;
+ }
+
+ @Override
+ public boolean isUiDisposed() {
+ return getUiField() == null || getUiField().isDisposed();
+ }
+
+ protected RwtScoutTableModel createUiTableModel() {
+ return new RwtScoutTableModel(getScoutObject(), this, m_uiColumnManager);
+ }
+
+ protected RwtScoutColumnModel getUiColumnModel() {
+ if (m_columnModel == null) {
+ m_columnModel = new RwtScoutColumnModel(getScoutObject(), this, m_uiColumnManager);
+ }
+ return m_columnModel;
+ }
+
+ @Override
+ public TableColumnManager getUiColumnManager() {
+ return m_uiColumnManager;
+ }
+
+ @Override
+ public void initializeUiColumns() {
+ m_redrawHandler.pushControlChanging();
+ try {
+ for (TableColumn col : getUiField().getColumns()) {
+ col.dispose();
+ }
+ /*
+ * bug: rwt table first column can not be aligned nor an image can be set.
+ * see also RwtScoutTableCellEditor
+ */
+ TableColumn dummyCol = new TableColumn(getUiField(), SWT.LEFT);
+ dummyCol.setWidth(0);
+ dummyCol.setResizable(false);
+ dummyCol.setMoveable(false);
+ boolean sortEnabled = false;
+ IColumn<?>[] scoutColumnsOrdered;
+ if (getScoutObject() != null) {
+ scoutColumnsOrdered = getScoutObject().getColumnSet().getVisibleColumns();
+ sortEnabled = getScoutObject().isSortEnabled();
+ }
+ else {
+ scoutColumnsOrdered = new IColumn[0];
+ }
+ if (m_uiColumnManager == null) {
+ m_uiColumnManager = new TableColumnManager();
+ }
+ m_uiColumnManager.initialize(scoutColumnsOrdered);
+ boolean multilineHeaders = false;
+ for (IColumn<?> scoutColumn : scoutColumnsOrdered) {
+ IHeaderCell cell = scoutColumn.getHeaderCell();
+ String cellText = cell.getText();
+ if (cellText == null) {
+ cellText = "";
+ }
+ boolean isHtml = HtmlTextUtility.isTextWithHtmlMarkup(cellText);
+ if (!isHtml && cellText.indexOf("\n") >= 0) {
+ multilineHeaders = true;
+ }
+ if (isHtml) {
+ multilineHeaders = true;
+ cellText = getUiEnvironment().adaptHtmlCell(RwtScoutTable.this, cellText);
+ }
+ int style = RwtUtility.getHorizontalAlignment(cell.getHorizontalAlignment());
+ TableColumn rwtCol = new TableColumn(getUiField(), style);
+ TableViewerColumn rwtViewerCol = new TableViewerColumn(getUiTableViewer(), rwtCol);
+ rwtViewerCol.setLabelProvider(getUiColumnModel());
+ rwtCol.setData(KEY_SCOUT_COLUMN, scoutColumn);
+ rwtCol.setMoveable(true);
+ rwtCol.setToolTipText(cell.getTooltipText());
+ updateHeaderText(rwtCol, scoutColumn);
+ rwtCol.setWidth(scoutColumn.getWidth());
+ if (cell.isSortActive()) {
+ getUiField().setSortColumn(rwtCol);
+ getUiField().setSortDirection(cell.isSortAscending() ? SWT.UP : SWT.DOWN);
+ }
+ if (sortEnabled) {
+ rwtCol.addSelectionListener(m_columnSortListener);
+ }
+ rwtCol.addListener(SWT.Move, m_columnListener);
+ rwtCol.addListener(SWT.Resize, m_columnListener);
+ }
+ //multiline header settings
+ if (multilineHeaders) {
+ getUiField().setData("multiLineHeader", Boolean.TRUE);
+ }
+ m_uiColumnOrder = getUiField().getColumnOrder();
+ //update cell editors
+ m_uiCellEditorComposite.initializeUi();
+ }
+ finally {
+ m_redrawHandler.popControlChanging();
+ }
+ }
+
+ @Override
+ protected void attachScout() {
+ super.attachScout();
+ if (getScoutObject() == null) {
+ return;
+ }
+ if (m_scoutTableListener == null) {
+ m_scoutTableListener = new P_ScoutTableListener();
+ getScoutObject().addUITableListener(m_scoutTableListener);
+ }
+ setHeaderVisibleFromScout(getScoutObject().isHeaderVisible());
+ setSelectionFromScout(getScoutObject().getSelectedRows());
+ setKeyStrokeFormScout();
+ setRowHeightFromScout();
+ setKeyboardNavigationFromScout();
+ updateAutoResizeColumnsFromScout();
+ attachDndSupport();
+ handleEventsFromRecentHistory();
+ }
+
+ private void handleEventsFromRecentHistory() {
+ final IEventHistory<TableEvent> h = getScoutObject().getEventHistory();
+ if (h == null) {
+ return;
+ }
+
+ getUiEnvironment().getDisplay().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ for (TableEvent e : h.getRecentEvents()) {
+ handleScoutTableEventInUi(e);
+ }
+ }
+ });
+ }
+
+ protected void attachDndSupport() {
+ if (UiDecorationExtensionPoint.getLookAndFeel().isDndSupportEnabled()) {
+ new P_DndSupport(getScoutObject(), getScoutObject(), getUiField());
+ }
+ }
+
+ @Override
+ protected void detachScout() {
+ super.detachScout();
+ removeAutoResizeColumnListener();
+ if (getScoutObject() == null) {
+ return;
+ }
+ if (m_scoutTableListener != null) {
+ getScoutObject().removeTableListener(m_scoutTableListener);
+ m_scoutTableListener = null;
+ }
+ }
+
+ @Override
+ public TableEx getUiField() {
+ return (TableEx) super.getUiField();
+ }
+
+ @Override
+ public TableViewer getUiTableViewer() {
+ return m_uiViewer;
+ }
+
+ @Override
+ public void setUiTableViewer(TableViewer uiViewer) {
+ m_uiViewer = uiViewer;
+ }
+
+ @Override
+ public ITableRow getUiSelectedRow() {
+ ITableRow[] rows = getUiSelectedRows();
+ if (rows.length > 0) {
+ return rows[0];
+ }
+ return null;
+ }
+
+ @Override
+ public ITableRow[] getUiSelectedRows() {
+ StructuredSelection uiSelection = (StructuredSelection) getUiTableViewer().getSelection();
+ TreeSet<ITableRow> sortedRows = new TreeSet<ITableRow>(new RowIndexComparator());
+ if (uiSelection != null && !uiSelection.isEmpty()) {
+ for (Object o : uiSelection.toArray()) {
+ ITableRow row = (ITableRow) o;
+ sortedRows.add(row);
+ }
+ }
+ return sortedRows.toArray(new ITableRow[sortedRows.size()]);
+ }
+
+ protected void setKeyStrokeFormScout() {
+ // remove old
+ if (m_uiKeyStrokes != null) {
+ for (IRwtKeyStroke rwtKeyStroke : m_uiKeyStrokes) {
+ getUiEnvironment().removeKeyStroke(getUiField(), rwtKeyStroke);
+ }
+ }
+ // add new
+ ArrayList<IRwtKeyStroke> newRwtKeyStrokes = new ArrayList<IRwtKeyStroke>();
+ IKeyStroke[] scoutKeyStrokes = getScoutObject().getKeyStrokes();
+ for (IKeyStroke scoutKeyStroke : scoutKeyStrokes) {
+ if (scoutKeyStroke.isEnabled()) {
+ IRwtKeyStroke[] rwtStrokes = RwtUtility.getKeyStrokes(scoutKeyStroke, getUiEnvironment());
+ for (IRwtKeyStroke rwtStroke : rwtStrokes) {
+ getUiEnvironment().addKeyStroke(getUiField(), rwtStroke, false);
+ newRwtKeyStrokes.add(rwtStroke);
+ }
+ }
+ }
+ m_uiKeyStrokes = newRwtKeyStrokes.toArray(new IRwtKeyStroke[newRwtKeyStrokes.size()]);
+ }
+
+ protected void setRowHeightFromScout() {
+ int h = getScoutObject().getRowHeightHint();
+ if (h >= 0) {
+ getUiField().setData(RWT.CUSTOM_ITEM_HEIGHT, h);
+ }
+ if (isCreated()) {
+ getUiTableViewer().refresh();
+ }
+ }
+
+ protected void setKeyboardNavigationFromScout() {
+ if (getScoutObject().hasKeyboardNavigation()) {
+ if (m_keyboardNavigationSupport == null) {
+ m_keyboardNavigationSupport = new P_KeyBoardNavigationSupport(getUiField());
+ }
+ }
+ else {
+ if (m_keyboardNavigationSupport != null) {
+ m_keyboardNavigationSupport.dispose();
+ m_keyboardNavigationSupport = null;
+ }
+ }
+ }
+
+ private void updateAutoResizeColumnsFromScout() {
+ if (getUiField() != null && !getUiField().getParent().isDisposed()) {
+ Composite parent = getUiField().getParent();
+ if (getScoutObject().isAutoResizeColumns()) {
+ if (m_autoResizeColumnListener == null) {
+ m_autoResizeColumnListener = new P_RwtResizeListener();
+ parent.addListener(SWT.Resize, m_autoResizeColumnListener);
+ }
+ //If the parent has already been resized no event will be fired anymore.
+ //So it is necessary to request an auto resizing of the columns manually. (Bugzilla 355855)
+ scheduleHandleAutoResizeColumn();
+ }
+ }
+ else {
+ removeAutoResizeColumnListener();
+ }
+ }
+
+ private void scheduleHandleAutoResizeColumn() {
+ getUiField().getDisplay().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ handleAutoSizeColumns();
+ }
+ });
+ }
+
+ private void removeAutoResizeColumnListener() {
+ if (m_autoResizeColumnListener == null) {
+ return;
+ }
+
+ Composite parent = getUiField().getParent();
+ parent.removeListener(SWT.Resize, m_autoResizeColumnListener);
+ m_autoResizeColumnListener = null;
+ }
+
+ /**
+ * scout property observer
+ */
+ @Override
+ protected void handleScoutPropertyChange(String propName, Object newValue) {
+ if (propName.equals(ITable.PROP_HEADER_VISIBLE)) {
+ setHeaderVisibleFromScout(((Boolean) newValue).booleanValue());
+ }
+ else if (propName.equals(ITable.PROP_KEY_STROKES)) {
+ setKeyStrokeFormScout();
+ }
+ else if (propName.equals(ITable.PROP_ROW_HEIGHT_HINT)) {
+ setRowHeightFromScout();
+ }
+ else if (propName.equals(ITable.PROP_KEYBOARD_NAVIGATION)) {
+ setKeyboardNavigationFromScout();
+ }
+ else if (propName.equals(ITable.PROP_AUTO_RESIZE_COLUMNS)) {
+ updateAutoResizeColumnsFromScout();
+ }
+ else if (propName.equals(ITable.PROP_SCROLL_TO_SELECTION)) {
+ updateScrollToSelectionFromScout();
+ }
+ }
+
+ /**
+ * scout table observer
+ */
+ protected boolean isHandleScoutTableEvent(TableEvent[] a) {
+ for (TableEvent element : a) {
+ switch (element.getType()) {
+ case TableEvent.TYPE_REQUEST_FOCUS:
+ case TableEvent.TYPE_REQUEST_FOCUS_IN_CELL:
+ case TableEvent.TYPE_ROWS_INSERTED:
+ case TableEvent.TYPE_ROWS_UPDATED:
+ case TableEvent.TYPE_ROWS_DELETED:
+ case TableEvent.TYPE_ALL_ROWS_DELETED:
+ case TableEvent.TYPE_ROW_ORDER_CHANGED:
+ case TableEvent.TYPE_ROW_FILTER_CHANGED:
+ case TableEvent.TYPE_COLUMN_ORDER_CHANGED:
+ case TableEvent.TYPE_COLUMN_HEADERS_UPDATED:
+ case TableEvent.TYPE_COLUMN_STRUCTURE_CHANGED:
+ case TableEvent.TYPE_ROWS_SELECTED:
+ case TableEvent.TYPE_SCROLL_TO_SELECTION: {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ protected void handleScoutTableEventInUi(TableEvent e) {
+ if (isUiDisposed()) {
+ return;
+ }
+ RwtScoutTableEvent uiTableEvent = null;
+ /*
+ * check the scout observer to filter all events that are used here
+ * @see isHandleScoutTableEvent()
+ */
+ switch (e.getType()) {
+ case TableEvent.TYPE_REQUEST_FOCUS: {
+ getUiField().setFocus();
+ break;
+ }
+ case TableEvent.TYPE_REQUEST_FOCUS_IN_CELL: {
+ //start editing
+ int swtCol = -1;
+ TableColumn[] swtColumns = getUiField().getColumns();
+ for (int c = 0; c < swtColumns.length; c++) {
+ if (swtColumns[c].getData(KEY_SCOUT_COLUMN) == e.getFirstColumn()) {
+ swtCol = c;
+ break;
+ }
+ }
+ ITableRow scoutRow = e.getFirstRow();
+ if (scoutRow != null && swtCol >= 0) {
+ getUiTableViewer().editElement(scoutRow, swtCol);
+ }
+ break;
+ }
+ case TableEvent.TYPE_SCROLL_TO_SELECTION: {
+ scrollToSelection();
+ break;
+ }
+ case TableEvent.TYPE_ROWS_INSERTED:
+ case TableEvent.TYPE_ROWS_UPDATED:
+ case TableEvent.TYPE_ROWS_DELETED:
+ case TableEvent.TYPE_ALL_ROWS_DELETED:
+ case TableEvent.TYPE_ROW_FILTER_CHANGED:
+ case TableEvent.TYPE_ROW_ORDER_CHANGED: {
+ uiTableEvent = new RwtScoutTableEvent();
+ break;
+ }
+ case TableEvent.TYPE_COLUMN_ORDER_CHANGED:
+ break;
+ case TableEvent.TYPE_COLUMN_HEADERS_UPDATED:
+ headerUpdateFromScout();
+ break;
+ case TableEvent.TYPE_COLUMN_STRUCTURE_CHANGED: {
+ // re-install columns
+ initializeUiColumns();
+ if (getScoutObject().isAutoResizeColumns()) {
+ handleAutoSizeColumns();
+ }
+
+ uiTableEvent = new RwtScoutTableEvent();
+ break;
+ }
+ case TableEvent.TYPE_ROWS_SELECTED: {
+ setSelectionFromScout(e.getRows());
+ break;
+ }
+ }
+ //
+ if (uiTableEvent != null) {
+ getUiColumnModel().consumeColumnModelEvent(uiTableEvent);
+ ((RwtScoutTableModel) getUiTableViewer().getContentProvider()).consumeTableModelEvent(uiTableEvent);
+ getUiTableViewer().refresh();
+ }
+ // refresh selection, indexes might have changed
+ switch (e.getType()) {
+ case TableEvent.TYPE_ROW_FILTER_CHANGED:
+ // Update column title if filter changed (mark column as filtered)
+ for (TableColumn swtCol : getUiField().getColumns()) {
+ updateHeaderText(swtCol);
+ }
+ setSelectionFromScout(e.getTable().getSelectedRows());
+ break;
+ case TableEvent.TYPE_ROWS_INSERTED:
+ case TableEvent.TYPE_ROWS_UPDATED:
+ case TableEvent.TYPE_ROWS_DELETED:
+ case TableEvent.TYPE_ALL_ROWS_DELETED:
+ case TableEvent.TYPE_ROW_ORDER_CHANGED: {
+ setSelectionFromScout(e.getTable().getSelectedRows());
+ break;
+ }
+ }
+ }
+
+ private void updateHeaderText(TableColumn swtCol) {
+ if (swtCol == null) {
+ return;
+ }
+ Object data = swtCol.getData(KEY_SCOUT_COLUMN);
+ if (data instanceof IColumn<?>) {
+ updateHeaderText(swtCol, (IColumn<?>) data);
+ }
+ }
+
+ private void updateHeaderText(TableColumn swtCol, IColumn<?> scoutCol) {
+ updateHeaderText(swtCol, scoutCol, false);
+ }
+
+ private void updateHeaderText(TableColumn swtCol, IColumn<?> scoutCol, boolean indicateSortOrder) {
+ IHeaderCell cell = scoutCol.getHeaderCell();
+ String text = cell.getText();
+ if (text == null) {
+ text = "";
+ }
+ if (scoutCol instanceof ICustomColumn) {
+ text = "[+] " + text;
+ }
+ if (scoutCol.isColumnFilterActive()) {
+ text = "(*) " + text;
+ }
+ if (indicateSortOrder) {
+ if (scoutCol.isSortAscending()) {
+ text = "[a-z] " + text;
+ }
+ else {
+ text = "[z-a] " + text;
+ }
+ }
+ swtCol.setText(text);
+ }
+
+ protected void setHeaderVisibleFromScout(boolean headerVisible) {
+ getUiField().setHeaderVisible(headerVisible);
+ }
+
+ @Override
+ public void setEnabledFromScout(boolean enabledFromScout) {
+ getUiField().setEnabled(!enabledFromScout);
+ // <Workaround>
+ // Because RAP seems to ignore the default ":disabled" state,
+ // we apply a custom variant to all header cells. Otherwise
+ // the "normal" style would be used for disabled cells.
+ for (TableColumn column : getUiField().getColumns()) {
+ column.setData(WidgetUtil.CUSTOM_VARIANT, (enabledFromScout ? null : VARIANT_TABLE_COLUMN_DISABLED));
+ }
+ // </Workaround>
+ }
+
+ protected void setSelectionFromScout(ITableRow[] selectedRows) {
+ if (getUiField().isDisposed()) {
+ return;
+ }
+ ITableRow[] uiSelection = getUiSelectedRows();
+ if (CompareUtility.equals(uiSelection, selectedRows)) {
+ // no change
+ return;
+ }
+ else {
+ if (selectedRows == null) {
+ selectedRows = new ITableRow[0];
+ }
+ getUiTableViewer().setSelection(new StructuredSelection(selectedRows), true);
+ updateScrollToSelectionFromScout();
+ }
+ }
+
+ private void updateScrollToSelectionFromScout() {
+ if (getScoutObject().isScrollToSelection()) {
+ scrollToSelection();
+ }
+ }
+
+ protected void scrollToSelection() {
+ if (getUiField() != null && !getUiField().isDisposed()) {
+ getUiField().showSelection();
+ }
+ }
+
+ protected void setContextColumnFromUi(TableColumn uiColumn) {
+ if (getScoutObject() != null) {
+ //try to find correct location, since TableColumn has NO x,y and is not a Control!
+ Point pDisp = getUiField().toDisplay(-getUiField().getHorizontalBar().getSelection(), 0);
+ for (TableColumn c : getUiField().getColumns()) {
+ if (c == uiColumn) {
+ break;
+ }
+ pDisp.x += c.getWidth();
+ }
+ getUiEnvironment().setPopupOwner(getUiField(), new Rectangle(pDisp.x - 2, pDisp.y, 1, getUiField().getHeaderHeight()));
+ // notify Scout
+ IColumn scoutColumn = null;
+ if (uiColumn != null) {
+ scoutColumn = (IColumn<?>) uiColumn.getData(KEY_SCOUT_COLUMN);
+ }
+ final IColumn finalCol = scoutColumn;
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ getScoutObject().getUIFacade().setContextColumnFromUI(finalCol);
+ }
+ };
+ getUiEnvironment().invokeScoutLater(t, 0);
+ // end notify
+ }
+ }
+
+ private int getVisualCellIndex(TableItem tableItem, int columnIndex) {
+ int visualCellIndex = columnIndex;
+ final int[] columnOrder = tableItem.getParent().getColumnOrder();
+ for (int element : columnOrder) {
+ if (element == columnIndex) {
+ visualCellIndex = columnIndex;
+ }
+ }
+ return visualCellIndex;
+ }
+
+ protected void setSelectionFromUi(final StructuredSelection selection) {
+ if (getUpdateUiFromScoutLock().isAcquired()) {
+ return;
+ }
+ //
+ if (getScoutObject() != null) {
+ // notify Scout
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ try {
+ addIgnoredScoutEvent(TableEvent.class, "" + TableEvent.TYPE_ROWS_SELECTED);
+ //
+ getScoutObject().getUIFacade().setSelectedRowsFromUI(RwtUtility.getItemsOfSelection(ITableRow.class, selection));
+ }
+ finally {
+ removeIgnoredScoutEvent(TableEvent.class, "" + TableEvent.TYPE_ROWS_SELECTED);
+ }
+ }
+ };
+ getUiEnvironment().invokeScoutLater(t, 0);
+ // end notify
+ }
+ }
+
+ protected void headerUpdateFromScout() {
+ // Because SWT can only indicate one sort column, we will use the first (i.e. the column
+ // with the lowest sort index) user sort column that is visible for that purpose. Further
+ // sort columns will be indicated by a special header text (see updateHeaderText() method).
+ int minSortIndex = -1;
+ TableColumn minUiSortColumn = null;
+ IColumn<?> minScoutSortColumn = null;
+ for (TableColumn col : getUiField().getColumns()) {
+ Object data = col.getData(KEY_SCOUT_COLUMN);
+ if (data instanceof IColumn<?>) {
+ IColumn<?> cell = (IColumn<?>) data;
+ if (cell.isSortExplicit() && (minSortIndex == -1 || cell.getSortIndex() < minSortIndex)) {
+ minSortIndex = cell.getSortIndex();
+ minUiSortColumn = col;
+ minScoutSortColumn = cell;
+ }
+ }
+ }
+
+ if (minUiSortColumn != null && minScoutSortColumn != null) {
+ getUiField().setSortColumn(minUiSortColumn);
+ getUiField().setSortDirection(minScoutSortColumn.isSortAscending() ? SWT.UP : SWT.DOWN);
+ }
+ else {
+ getUiField().setSortColumn(null);
+ }
+ for (TableColumn col : getUiField().getColumns()) {
+ Object data = col.getData(KEY_SCOUT_COLUMN);
+ if (data instanceof IColumn<?>) {
+ IColumn<?> cell = (IColumn<?>) data;
+ boolean indicateSortOrder = (cell.isSortExplicit() && cell != minScoutSortColumn);
+ updateHeaderText(col, cell, indicateSortOrder);
+ }
+ }
+ }
+
+ protected void handleUiRowClick(final ITableRow row) {
+ if (getScoutObject() != null) {
+ if (row != null) {
+ // notify Scout
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ getScoutObject().getUIFacade().fireRowClickFromUI(row);
+ }
+ };
+ getUiEnvironment().invokeScoutLater(t, 0);
+ // end notify
+ }
+ }
+ }
+
+ protected void handleUiRowAction(final ITableRow row) {
+ if (getScoutObject() != null) {
+ if (!getScoutObject().isCheckable() && row != null) {
+ // notify Scout
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ getScoutObject().getUIFacade().fireRowActionFromUI(row);
+ }
+ };
+ getUiEnvironment().invokeScoutLater(t, 0);
+ // end notify
+ }
+ }
+ }
+
+ protected void handleUiHyperlinkAction(String urlText) {
+ if (getScoutObject() != null) {
+ final URL url;
+ try {
+ url = new URL(urlText);
+ }
+ catch (MalformedURLException e) {
+ //nop
+ return;
+ }
+ // notify Scout
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ ITable table = getScoutObject();
+ table.getUIFacade().fireHyperlinkActionFromUI(table.getSelectedRow(), table.getContextColumn(), url);
+ }
+ };
+ getUiEnvironment().invokeScoutLater(t, 0);
+ // end notify
+ }
+ }
+
+ /**
+ * Distributes the table width to the columns considered column weights of
+ * model. Empty space will be distributed weighted.
+ */
+ protected void handleAutoSizeColumns() {
+ if (getUiField() == null || getUiField().isDisposed()) {
+ return;
+ }
+
+ int totalWidth = getUiField().getClientArea().width;
+ /* fixed in rwt
+ if (getUiField().getVerticalBar() != null && getUiField().getVerticalBar().getVisible()) {
+ totalWidth -= getUiField().getVerticalBar().getSize().x;
+ }
+ */
+ if (totalWidth < 32) {
+ //either not showing or not yet layouted
+ return;
+ }
+ int totalWeight = 0;
+ int actualWidth = 0;
+ HashMap<TableColumn, Integer> columnWeights = new HashMap<TableColumn, Integer>();
+ for (TableColumn col : getUiField().getColumns()) {
+ if (col == null || col.isDisposed()) {
+ continue;
+ }
+ actualWidth += col.getWidth();
+ Object data = col.getData(RwtScoutTable.KEY_SCOUT_COLUMN);
+ if (data instanceof IColumn<?>) {
+ int width = ((IColumn<?>) data).getInitialWidth();
+ columnWeights.put(col, width);
+ totalWeight += width;
+ }
+ else {
+ totalWidth -= col.getWidth();
+ }
+ }
+
+ //If the columns already have the correct size there is no need to recalculate it
+ if (actualWidth == totalWidth) {
+ return;
+ }
+
+ double factor = (double) totalWidth / (double) totalWeight;
+ int i = 0;
+ for (Entry<TableColumn, Integer> entry : columnWeights.entrySet()) {
+ if (i < columnWeights.size() - 1) {
+ int width = (int) (factor * entry.getValue().intValue());
+ entry.getKey().setWidth(width);
+ totalWidth -= width;
+ i++;
+ }
+ else {
+ entry.getKey().setWidth(totalWidth);
+ }
+ }
+ }
+
+ protected void handleUiColumnResized(TableColumn column) {
+ if (column.isDisposed()) {
+ return;
+ }
+ if (!column.getParent().isVisible()) {
+ return;
+ }
+ if (getUpdateUiFromScoutLock().isAcquired()) {
+ return;
+ }
+ //
+ final int width = column.getWidth();
+ final IColumn<?> scoutColumn = (IColumn<?>) column.getData(KEY_SCOUT_COLUMN);
+ if (scoutColumn != null) {
+ if (scoutColumn.getWidth() != width) {
+
+ //Cancel already scheduled resize job to protect the model from too many resize events.
+ if (m_storeColumnWidthsJob != null) {
+ m_storeColumnWidthsJob.cancel();
+ }
+
+ /*
+ * imo, 04.06.2009: added swt-side optimistic lock check Method
+ * autoSizeColumns indirectly calls this code by setting the width on a
+ * table column if this code calls scout using synchronizer it may
+ * invoke pending swt jobs while waiting, which can execute a dispose
+ * form job. After that job all columns are disposed. This results in
+ * WidgetDisposed exceptions on line with entry.getKey().setWidth(...)
+ */
+ m_storeColumnWidthsJob = new ClientSyncJob("Store column widths", getUiEnvironment().getClientSession()) {
+ @Override
+ protected IStatus runStatus(IProgressMonitor monitor) {
+ try {
+ addIgnoredScoutEvent(TableEvent.class, "" + TableEvent.TYPE_COLUMN_STRUCTURE_CHANGED);
+ //
+ getScoutObject().getUIFacade().setColumnWidthFromUI(scoutColumn, width);
+ }
+ finally {
+ removeIgnoredScoutEvent(TableEvent.class, "" + TableEvent.TYPE_COLUMN_STRUCTURE_CHANGED);
+ }
+
+ return Status.OK_STATUS;
+ }
+ };
+ m_storeColumnWidthsJob.schedule(400);
+ }
+ }
+ }
+
+ protected void handleUiColumnMoved() {
+ if (getUpdateUiFromScoutLock().isAcquired()) {
+ return;
+ }
+ int[] uiColumnOrder = getUiField().getColumnOrder();
+ // do not allow to reorder icon and dummy column
+ if (uiColumnOrder[0] != 0) {
+ getUiField().setColumnOrder(m_uiColumnOrder);
+ return;
+ }
+ // if column with icon has changed position
+ if (uiColumnOrder[1] != m_uiColumnOrder[1]
+ && getScoutObject().getRowCount() > 0
+ && StringUtility.hasText(getScoutObject().getRow(0).getIconId())) {
+ getUiTableViewer().refresh();
+ }
+ int[] truncatedColOrder = new int[uiColumnOrder.length - 1];
+ for (int i = 0; i < truncatedColOrder.length; i++) {
+ truncatedColOrder[i] = uiColumnOrder[i + 1] - 1;
+ }
+ final IColumn<?>[] newOrder = m_uiColumnManager.getOrderedColumns(truncatedColOrder);
+ if (m_uiColumnManager.applyNewOrder(newOrder)) {
+ m_uiColumnOrder = uiColumnOrder;
+ // notify Scout
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ try {
+ addIgnoredScoutEvent(TableEvent.class, "" + TableEvent.TYPE_COLUMN_ORDER_CHANGED);
+ addIgnoredScoutEvent(TableEvent.class, "" + TableEvent.TYPE_COLUMN_STRUCTURE_CHANGED);
+ //
+ getScoutObject().getUIFacade().fireVisibleColumnsChangedFromUI(newOrder);
+ }
+ finally {
+ removeIgnoredScoutEvent(TableEvent.class, "" + TableEvent.TYPE_COLUMN_ORDER_CHANGED);
+ removeIgnoredScoutEvent(TableEvent.class, "" + TableEvent.TYPE_COLUMN_STRUCTURE_CHANGED);
+ }
+ }
+ };
+ getUiEnvironment().invokeScoutLater(t, 0);
+ // end notify
+ }
+ }
+
+ protected void handleKeyboardNavigationFromUi(TableItem item) {
+ getUiField().setSelection(item);
+ Event selectionEvent = new Event();
+ selectionEvent.type = SWT.DefaultSelection;
+ selectionEvent.widget = getUiField();
+ for (Listener l : getUiField().getListeners(SWT.DefaultSelection)) {
+ l.handleEvent(selectionEvent);
+ }
+ }
+
+ protected void handleUiToggleAcction(Event e) {
+ if (e.doit && getScoutObject().isCheckable()) {
+ if (e.stateMask == 0) {
+ switch (e.keyCode) {
+ case ' ':
+ ITableRow[] selectedRows = RwtUtility.getItemsOfSelection(ITableRow.class, (StructuredSelection) getUiTableViewer().getSelection());
+ if (selectedRows != null && selectedRows.length > 0) {
+ handleUiRowClick(selectedRows[0]);
+ }
+ e.doit = false;
+ break;
+ }
+ }
+ }
+ }
+
+ private class P_ScoutTableListener implements TableListener {
+ @Override
+ public void tableChanged(final TableEvent e) {
+ if (isHandleScoutTableEvent(new TableEvent[]{e})) {
+ if (isIgnoredScoutEvent(TableEvent.class, "" + e.getType())) {
+ return;
+ }
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ try {
+ getUpdateUiFromScoutLock().acquire();
+ //
+ handleScoutTableEventInUi(e);
+ }
+ finally {
+ getUpdateUiFromScoutLock().release();
+ }
+ }
+ };
+ getUiEnvironment().invokeUiLater(t);
+ }
+ }
+
+ @Override
+ public void tableChangedBatch(final TableEvent[] a) {
+ if (isHandleScoutTableEvent(a)) {
+ final ArrayList<TableEvent> filteredList = new ArrayList<TableEvent>();
+ for (int i = 0; i < a.length; i++) {
+ if (!isIgnoredScoutEvent(TableEvent.class, "" + a[i].getType())) {
+ filteredList.add(a[i]);
+ }
+ }
+ if (filteredList.size() == 0) {
+ return;
+ }
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ if (isUiDisposed()) {
+ return;
+ }
+ m_redrawHandler.pushControlChanging();
+ try {
+ try {
+ getUpdateUiFromScoutLock().acquire();
+ //
+ for (TableEvent element : filteredList) {
+ handleScoutTableEventInUi(element);
+ }
+ }
+ finally {
+ getUpdateUiFromScoutLock().release();
+ }
+ }
+ finally {
+ m_redrawHandler.popControlChanging();
+ }
+ }
+ };
+ getUiEnvironment().invokeUiLater(t);
+ }
+ }
+ }// end P_ScoutTableListener
+
+ private void showMenu(Point eventPosition) {
+ Point pt = getUiField().getDisplay().map(null, getUiField(), eventPosition);
+ Rectangle clientArea = getUiField().getClientArea();
+ boolean header = clientArea.y <= pt.y && pt.y < clientArea.y + getUiField().getHeaderHeight();
+ getUiField().setMenu(header ? m_headerMenu : m_contextMenu);
+ getUiField().getMenu().addMenuListener(new MenuAdapter() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void menuHidden(MenuEvent e) {
+ getUiField().setMenu(null);
+ ((Menu) e.getSource()).removeMenuListener(this);
+ }
+ });
+ getUiField().getMenu().setLocation(eventPosition);
+ getUiField().getMenu().setVisible(true);
+ }
+
+ private class P_RwtTableListener implements Listener {
+ private static final long serialVersionUID = 1L;
+
+ private Boolean m_doubleClicked = Boolean.FALSE;
+
+ @Override
+ public void handleEvent(Event event) {
+ Point eventPosition = new Point(event.x, event.y);
+ switch (event.type) {
+ case SWT.MouseDown: {
+ setContextColumnFromUi(RwtUtility.getRwtColumnAt(getUiTableViewer().getTable(), eventPosition));
+ if (getUiField().getItem(eventPosition) == null) {
+ getUiTableViewer().setSelection(null);
+ setSelectionFromUi(new StructuredSelection());
+ }
+ break;
+ }
+ case SWT.MouseUp: {
+ synchronized (m_doubleClicked) {
+ if (m_doubleClicked == Boolean.TRUE) {
+ m_doubleClicked = Boolean.FALSE;
+ break;
+ }
+ }
+ StructuredSelection selection = (StructuredSelection) getUiTableViewer().getSelection();
+ if (selection != null && selection.size() == 1) {
+ handleUiRowClick((ITableRow) selection.getFirstElement());
+ }
+ break;
+ }
+ case SWT.MouseDoubleClick: {
+ synchronized (m_doubleClicked) {
+ m_doubleClicked = Boolean.TRUE;
+ }
+ StructuredSelection selection = (StructuredSelection) getUiTableViewer().getSelection();
+ if (selection != null && selection.size() == 1) {
+ handleUiRowAction((ITableRow) selection.getFirstElement());
+ }
+ break;
+ }
+ case SWT.Resize: {
+ //lazy column auto-fit
+ if (getUiField() != null && !getUiField().isDisposed()) {
+ if (getScoutObject().isAutoResizeColumns()) {
+ scheduleHandleAutoResizeColumn();
+ }
+ updateScrollToSelectionFromScout();
+ }
+ break;
+ }
+ case SWT.MenuDetect: {
+ showMenu(eventPosition);
+ break;
+ }
+ }
+ }
+ }
+
+ private class P_RwtResizeListener implements Listener {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void handleEvent(Event event) {
+ //lazy column auto-fit
+ if (getUiField() != null && !getUiField().isDisposed()) {
+ if (getScoutObject().isAutoResizeColumns()) {
+ scheduleHandleAutoResizeColumn();
+ }
+ updateScrollToSelectionFromScout();
+ }
+ }
+ } // end class P_SwtResizeListener
+
+ public class P_RwtSelectionListener implements ISelectionChangedListener {
+ @Override
+ public void selectionChanged(SelectionChangedEvent event) {
+ setSelectionFromUi((StructuredSelection) event.getSelection());
+ }
+ }
+
+ private class P_TableColumnListener implements Listener {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void handleEvent(Event event) {
+ switch (event.type) {
+ case SWT.Move:
+ handleUiColumnMoved();
+ break;
+ case SWT.Resize:
+ if (event.widget instanceof TableColumn) {
+ handleUiColumnResized((TableColumn) event.widget);
+ }
+
+ }
+ }
+
+ } // end class P_TableColumnMoveListener
+
+ private class P_ColumnSortListener extends SelectionAdapter {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ TableColumn col = (TableColumn) e.getSource();
+ setContextColumnFromUi(col);
+ final IColumn<?> newColumn = (IColumn<?>) col.getData(KEY_SCOUT_COLUMN);
+ final boolean ctrlKeyPressed = ((e.stateMask & SWT.CONTROL) > 0);
+ if (getScoutObject() != null) {
+ Runnable job = new Runnable() {
+ @Override
+ public void run() {
+ getScoutObject().getUIFacade().fireHeaderSortFromUI(newColumn, ctrlKeyPressed);
+ }
+ };
+ getUiEnvironment().invokeScoutLater(job, 0);
+ }
+ }
+ } // end class P_ColumnSortListener
+
+ private class P_ContextMenuListener extends MenuAdapterEx {
+
+ private static final long serialVersionUID = 1L;
+
+ public P_ContextMenuListener() {
+ super(RwtScoutTable.this.getUiTableViewer().getTable(), RwtScoutTable.this.getUiTableViewer().getTable().getParent());
+ }
+
+ @Override
+ protected Menu getContextMenu() {
+ return m_contextMenu;
+ }
+
+ @Override
+ protected void setContextMenu(Menu contextMenu) {
+ m_contextMenu = contextMenu;
+ }
+
+ @Override
+ public void menuShown(MenuEvent e) {
+ super.menuShown(e);
+
+ final boolean emptySelection = getUiTableViewer().getSelection().isEmpty();
+ IMenu[] menus = RwtMenuUtility.collectMenus(getScoutObject(), emptySelection, !emptySelection, getUiEnvironment());
+
+ RwtMenuUtility.fillContextMenu(menus, getUiEnvironment(), m_contextMenu);
+ }
+
+ } // end class P_ContextMenuListener
+
+ private class P_RwtHeaderMenuDetectListener implements MenuDetectListener {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void menuDetected(MenuDetectEvent event) {
+ Table table = getUiField();
+ Point pTable = table.getDisplay().map(null, table, new Point(event.x, event.y));
+ Rectangle clientArea = table.getClientArea();
+ boolean header = clientArea.y <= pTable.y && pTable.y < clientArea.y + table.getHeaderHeight();
+ if (!header) {
+ return;
+ }
+ // clear all previous
+ // Windows BUG: fires menu hide before the selection on the menu item is
+ // propagated.
+ if (m_headerMenu != null) {
+ for (MenuItem item : m_headerMenu.getItems()) {
+ disposeMenuItem(item);
+ }
+ }
+ setContextColumnFromUi(RwtUtility.getRwtColumnAt(getUiTableViewer().getTable(), pTable));
+ final AtomicReference<IMenu[]> scoutMenusRef = new AtomicReference<IMenu[]>();
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ IMenu[] scoutMenus = getScoutObject().getUIFacade().fireHeaderPopupFromUI();
+ scoutMenusRef.set(scoutMenus);
+ }
+ };
+ JobEx job = getUiEnvironment().invokeScoutLater(t, 1200);
+ try {
+ job.join(1200);
+ }
+ catch (InterruptedException ex) {
+ //nop
+ }
+ // grab the actions out of the job, when the actions are providden
+ // within the scheduled time the popup will be handled.
+ if (scoutMenusRef.get() != null) {
+ RwtMenuUtility.fillContextMenu(scoutMenusRef.get(), getUiEnvironment(), m_headerMenu);
+ }
+ }
+
+ protected void disposeMenuItem(MenuItem item) {
+ Menu menu = item.getMenu();
+ if (menu != null) {
+ for (MenuItem childItem : menu.getItems()) {
+ disposeMenuItem(childItem);
+ }
+ menu.dispose();
+ }
+ item.dispose();
+ }
+ } // end class P_HeaderMenuListener
+
+ private class P_DndSupport extends AbstractRwtScoutDndSupport {
+ public P_DndSupport(IPropertyObserver scoutObject, IDNDSupport scoutDndSupportable, Control control) {
+ super(scoutObject, scoutDndSupportable, control, RwtScoutTable.this.getUiEnvironment());
+ }
+
+ @Override
+ protected TransferObject handleUiDragRequest() {
+ final Holder<TransferObject> result = new Holder<TransferObject>(TransferObject.class, null);
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ TransferObject scoutTransferable = getScoutObject().getUIFacade().fireRowsDragRequestFromUI();
+ result.setValue(scoutTransferable);
+ }
+ };
+ try {
+ getUiEnvironment().invokeScoutLater(t, 20000).join(20000);
+ }
+ catch (InterruptedException e) {
+ //nop
+ }
+ return result.getValue();
+ }
+
+ @Override
+ protected void handleUiDropAction(DropTargetEvent event, final TransferObject scoutTransferObject) {
+ Object dropTarget = event.item != null ? event.item.getData() : null;
+ final ITableRow row = dropTarget instanceof ITableRow ? (ITableRow) dropTarget : null;
+ Runnable job = new Runnable() {
+ @Override
+ public void run() {
+ getScoutObject().getUIFacade().fireRowDropActionFromUI(row, scoutTransferObject);
+ }
+ };
+ getUiEnvironment().invokeScoutLater(job, 200);
+ }
+ }// end class P_DndSupport
+
+ private class P_KeyBoardNavigationSupport extends AbstractTableKeyboardNavigationSupport {
+ /**
+ * @param table
+ * @param delay
+ */
+ public P_KeyBoardNavigationSupport(TableEx table) {
+ super(table);
+ }
+
+ @Override
+ public void handleKeyboardNavigation(TableItem tableItem) {
+ handleKeyboardNavigationFromUi(tableItem);
+ }
+ } // P_KeyBoardNavigationSupport
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/RwtScoutTableEvent.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/RwtScoutTableEvent.java
index 0ec925a588..d2e0a11a62 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/RwtScoutTableEvent.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/RwtScoutTableEvent.java
@@ -1,15 +1,15 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.basic.table;
-
-public class RwtScoutTableEvent {
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.basic.table;
+
+public class RwtScoutTableEvent {
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/RwtScoutTableModel.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/RwtScoutTableModel.java
index dc50c725b8..16707b200c 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/RwtScoutTableModel.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/RwtScoutTableModel.java
@@ -1,101 +1,101 @@
-/*******************************************************************************
- * Copyright (c) 2011,2012 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.basic.table;
-
-import java.util.HashMap;
-
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.ITableFontProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.scout.rt.client.ui.basic.cell.ICell;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-import org.eclipse.swt.graphics.Font;
-
-public class RwtScoutTableModel implements IStructuredContentProvider, ITableFontProvider {
- private static final long serialVersionUID = 1L;
-
- private final ITable m_scoutTable;
- private HashMap<ITableRow, HashMap<IColumn<?>, ICell>> m_cachedCells;
- private final IRwtScoutTableForPatch m_uiTable;
- private final TableColumnManager m_columnManager;
-
- public RwtScoutTableModel(ITable scoutTable, IRwtScoutTableForPatch uiTable, TableColumnManager columnManager) {
- m_scoutTable = scoutTable;
- m_uiTable = uiTable;
- m_columnManager = columnManager;
- rebuildCache();
- }
-
- @Override
- public Object[] getElements(Object inputElement) {
- if (m_scoutTable != null) {
- return m_scoutTable.getFilteredRows();
- }
- else {
- return new Object[0];
- }
- }
-
- @Override
- public Font getFont(Object element, int columnIndex) {
- if (columnIndex > 0) {
- ICell cell = getCell(element, columnIndex);
- if (cell != null) {
- return getRwtScoutTable().getUiEnvironment().getFont(cell.getFont(), getRwtScoutTable().getUiField().getFont());
- }
- }
- return null;
- }
-
- @Override
- public void dispose() {
- }
-
- @Override
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
-
- public void consumeTableModelEvent(RwtScoutTableEvent uiTableEvent) {
- rebuildCache();
- }
-
- protected ICell getCell(Object row, int colIndex) {
- IColumn<?> column = m_columnManager.getColumnByModelIndex(colIndex - 1);
- if (column != null) {
- if (m_cachedCells.get(row) == null) {
- rebuildCache();
- }
- return m_cachedCells.get(row).get(column);
- }
- else {
- return null;
- }
- }
-
- private void rebuildCache() {
- m_cachedCells = new HashMap<ITableRow, HashMap<IColumn<?>, ICell>>();
- if (m_scoutTable != null) {
- for (ITableRow scoutRow : m_scoutTable.getRows()) {
- HashMap<IColumn<?>, ICell> cells = new HashMap<IColumn<?>, ICell>();
- for (IColumn<?> col : m_scoutTable.getColumnSet().getVisibleColumns()) {
- cells.put(col, m_scoutTable.getCell(scoutRow, col));
- }
- m_cachedCells.put(scoutRow, cells);
- }
- }
- }
-
- public IRwtScoutTableForPatch getRwtScoutTable() {
- return m_uiTable;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011,2012 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.basic.table;
+
+import java.util.HashMap;
+
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.ITableFontProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.scout.rt.client.ui.basic.cell.ICell;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+import org.eclipse.swt.graphics.Font;
+
+public class RwtScoutTableModel implements IStructuredContentProvider, ITableFontProvider {
+ private static final long serialVersionUID = 1L;
+
+ private final ITable m_scoutTable;
+ private HashMap<ITableRow, HashMap<IColumn<?>, ICell>> m_cachedCells;
+ private final IRwtScoutTableForPatch m_uiTable;
+ private final TableColumnManager m_columnManager;
+
+ public RwtScoutTableModel(ITable scoutTable, IRwtScoutTableForPatch uiTable, TableColumnManager columnManager) {
+ m_scoutTable = scoutTable;
+ m_uiTable = uiTable;
+ m_columnManager = columnManager;
+ rebuildCache();
+ }
+
+ @Override
+ public Object[] getElements(Object inputElement) {
+ if (m_scoutTable != null) {
+ return m_scoutTable.getFilteredRows();
+ }
+ else {
+ return new Object[0];
+ }
+ }
+
+ @Override
+ public Font getFont(Object element, int columnIndex) {
+ if (columnIndex > 0) {
+ ICell cell = getCell(element, columnIndex);
+ if (cell != null) {
+ return getRwtScoutTable().getUiEnvironment().getFont(cell.getFont(), getRwtScoutTable().getUiField().getFont());
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public void dispose() {
+ }
+
+ @Override
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+
+ public void consumeTableModelEvent(RwtScoutTableEvent uiTableEvent) {
+ rebuildCache();
+ }
+
+ protected ICell getCell(Object row, int colIndex) {
+ IColumn<?> column = m_columnManager.getColumnByModelIndex(colIndex - 1);
+ if (column != null) {
+ if (m_cachedCells.get(row) == null) {
+ rebuildCache();
+ }
+ return m_cachedCells.get(row).get(column);
+ }
+ else {
+ return null;
+ }
+ }
+
+ private void rebuildCache() {
+ m_cachedCells = new HashMap<ITableRow, HashMap<IColumn<?>, ICell>>();
+ if (m_scoutTable != null) {
+ for (ITableRow scoutRow : m_scoutTable.getRows()) {
+ HashMap<IColumn<?>, ICell> cells = new HashMap<IColumn<?>, ICell>();
+ for (IColumn<?> col : m_scoutTable.getColumnSet().getVisibleColumns()) {
+ cells.put(col, m_scoutTable.getCell(scoutRow, col));
+ }
+ m_cachedCells.put(scoutRow, cells);
+ }
+ }
+ }
+
+ public IRwtScoutTableForPatch getRwtScoutTable() {
+ return m_uiTable;
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/RwtScoutTooltipSupport.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/RwtScoutTooltipSupport.java
index b8436e9b50..30b875a147 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/RwtScoutTooltipSupport.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/RwtScoutTooltipSupport.java
@@ -1,104 +1,104 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.basic.table;
-
-import org.eclipse.jface.viewers.ColumnViewer;
-import org.eclipse.swt.widgets.Item;
-
-public class RwtScoutTooltipSupport /*XXX rap extends DefaultToolTip */{
- private Cell m_uiCell;
- private ColumnViewer m_uiViewer;
-
- protected RwtScoutTooltipSupport(ColumnViewer uiViewer, int style, boolean manualActivation) {
- //XXX rap super(m_uiViewer.getControl(), style, manualActivation);
- this.m_uiViewer = uiViewer;
- }
-
- /*
- //XXX rap
- @Override
- protected Object getToolTipArea(Event event) {
- Table table = (Table) event.widget;
- int columns = table.getColumnCount();
- Point point = new Point(event.x, event.y);
- TableItem item = table.getItem(point);
-
- if (item != null) {
- for (int i = 0; i < columns; i++) {
- if (item.getBounds(i).contains(point)) {
- this.m_uiCell = new Cell(item, i);
- return m_uiCell;
- }
- }
- }
-
- return null;
- }
- */
-/*
- * //XXX rap
- @Override
- protected Composite createToolTipContentArea(Event event,
- Composite parent) {
- Composite comp = new Composite(parent, SWT.NONE);
- comp.setLayout(new FillLayout());
- Text b = new Text(comp, SWT.MULTI);
- b.setText(((ITableLabelProvider) m_uiViewer.getLabelProvider())
- .getColumnText(m_uiCell.getData(), m_uiCell.index));
- // b.setImage(((ITableLabelProvider) m_uiViewer.getLabelProvider())
- // .getColumnImage(m_uiCell.getData(), m_uiCell.index));
-
- return comp;
- }
-
-*/
- public static void enableFor(ColumnViewer viewer) {
- //XXX rap new RwtScoutTooltipSupport(viewer, ToolTip.NO_RECREATE, false);
- }
-
- private static class Cell {
- private Item item;
- private int index;
-
- public Cell(Item item, int index) {
- this.item = item;
- this.index = index;
- }
-
- public Object getData() {
- return item.getData();
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + index;
- result = prime * result + ((item == null) ? 0 : item.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;
- final Cell other = (Cell) obj;
- if (index != other.index) return false;
- if (item == null) {
- if (other.item != null) return false;
- }
- else if (!item.equals(other.item)) return false;
- return true;
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.basic.table;
+
+import org.eclipse.jface.viewers.ColumnViewer;
+import org.eclipse.swt.widgets.Item;
+
+public class RwtScoutTooltipSupport /*XXX rap extends DefaultToolTip */{
+ private Cell m_uiCell;
+ private ColumnViewer m_uiViewer;
+
+ protected RwtScoutTooltipSupport(ColumnViewer uiViewer, int style, boolean manualActivation) {
+ //XXX rap super(m_uiViewer.getControl(), style, manualActivation);
+ this.m_uiViewer = uiViewer;
+ }
+
+ /*
+ //XXX rap
+ @Override
+ protected Object getToolTipArea(Event event) {
+ Table table = (Table) event.widget;
+ int columns = table.getColumnCount();
+ Point point = new Point(event.x, event.y);
+ TableItem item = table.getItem(point);
+
+ if (item != null) {
+ for (int i = 0; i < columns; i++) {
+ if (item.getBounds(i).contains(point)) {
+ this.m_uiCell = new Cell(item, i);
+ return m_uiCell;
+ }
+ }
+ }
+
+ return null;
+ }
+ */
+/*
+ * //XXX rap
+ @Override
+ protected Composite createToolTipContentArea(Event event,
+ Composite parent) {
+ Composite comp = new Composite(parent, SWT.NONE);
+ comp.setLayout(new FillLayout());
+ Text b = new Text(comp, SWT.MULTI);
+ b.setText(((ITableLabelProvider) m_uiViewer.getLabelProvider())
+ .getColumnText(m_uiCell.getData(), m_uiCell.index));
+ // b.setImage(((ITableLabelProvider) m_uiViewer.getLabelProvider())
+ // .getColumnImage(m_uiCell.getData(), m_uiCell.index));
+
+ return comp;
+ }
+
+*/
+ public static void enableFor(ColumnViewer viewer) {
+ //XXX rap new RwtScoutTooltipSupport(viewer, ToolTip.NO_RECREATE, false);
+ }
+
+ private static class Cell {
+ private Item item;
+ private int index;
+
+ public Cell(Item item, int index) {
+ this.item = item;
+ this.index = index;
+ }
+
+ public Object getData() {
+ return item.getData();
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + index;
+ result = prime * result + ((item == null) ? 0 : item.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;
+ final Cell other = (Cell) obj;
+ if (index != other.index) return false;
+ if (item == null) {
+ if (other.item != null) return false;
+ }
+ else if (!item.equals(other.item)) return false;
+ return true;
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/TableColumnManager.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/TableColumnManager.java
index b38c94ec7c..ba23c1cca7 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/TableColumnManager.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/TableColumnManager.java
@@ -1,74 +1,74 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.basic.table;
-
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-
-public class TableColumnManager {
-
- private IColumn<?>[] m_initialColumns;
- private IColumn<?>[] m_currentOrder;
-
- public void initialize(IColumn<?>[] initialColumns) {
- m_initialColumns = initialColumns;
- m_currentOrder = m_initialColumns;
- }
-
- public IColumn<?>[] getOrderedColumns(int[] columnOrder) {
- IColumn<?>[] columns = new IColumn<?>[columnOrder.length];
- for (int i = 0; i < columnOrder.length; i++) {
- columns[i] = m_initialColumns[columnOrder[i]];
- }
- return columns;
- }
-
- public boolean applyNewOrder(IColumn<?>[] newOrder) {
- if (CompareUtility.equals(newOrder, m_currentOrder)) {
- return false;
- }
- else {
- m_currentOrder = newOrder;
- return true;
- }
- }
-
- /**
- * @param modelIndex
- * beginning with 0
- */
- public IColumn<?> getColumnByModelIndex(int modelIndex) {
- if (modelIndex >= 0 && modelIndex < m_initialColumns.length) {
- return m_initialColumns[modelIndex];
- }
- else {
- return null;
- }
- }
-
- /**
- * @param visualIndex
- * beginning with 1
- */
- public IColumn<?> getColumnByVisualIndex(int visualIndex) {
- if (visualIndex - 1 >= 0 && visualIndex - 1 < m_currentOrder.length) {
- return m_currentOrder[visualIndex - 1];
- }
- else {
- return null;
- }
- }
-
- public boolean isIconColumn(int columnIndex) {
- return false;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.basic.table;
+
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+
+public class TableColumnManager {
+
+ private IColumn<?>[] m_initialColumns;
+ private IColumn<?>[] m_currentOrder;
+
+ public void initialize(IColumn<?>[] initialColumns) {
+ m_initialColumns = initialColumns;
+ m_currentOrder = m_initialColumns;
+ }
+
+ public IColumn<?>[] getOrderedColumns(int[] columnOrder) {
+ IColumn<?>[] columns = new IColumn<?>[columnOrder.length];
+ for (int i = 0; i < columnOrder.length; i++) {
+ columns[i] = m_initialColumns[columnOrder[i]];
+ }
+ return columns;
+ }
+
+ public boolean applyNewOrder(IColumn<?>[] newOrder) {
+ if (CompareUtility.equals(newOrder, m_currentOrder)) {
+ return false;
+ }
+ else {
+ m_currentOrder = newOrder;
+ return true;
+ }
+ }
+
+ /**
+ * @param modelIndex
+ * beginning with 0
+ */
+ public IColumn<?> getColumnByModelIndex(int modelIndex) {
+ if (modelIndex >= 0 && modelIndex < m_initialColumns.length) {
+ return m_initialColumns[modelIndex];
+ }
+ else {
+ return null;
+ }
+ }
+
+ /**
+ * @param visualIndex
+ * beginning with 1
+ */
+ public IColumn<?> getColumnByVisualIndex(int visualIndex) {
+ if (visualIndex - 1 >= 0 && visualIndex - 1 < m_currentOrder.length) {
+ return m_currentOrder[visualIndex - 1];
+ }
+ else {
+ return null;
+ }
+ }
+
+ public boolean isIconColumn(int columnIndex) {
+ return false;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/celleditor/FormFieldPopupEvent.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/celleditor/FormFieldPopupEvent.java
index 5d375bf87d..8e281b7306 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/celleditor/FormFieldPopupEvent.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/celleditor/FormFieldPopupEvent.java
@@ -1,42 +1,42 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.basic.table.celleditor;
-
-import java.util.EventObject;
-
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-
-public class FormFieldPopupEvent extends EventObject {
-
- private static final long serialVersionUID = 1L;
-
- public static final int TYPE_OK = 1 << 0;
- public static final int TYPE_CANCEL = 1 << 1;
- public static final int TYPE_OPEN = 1 << 2;
- public static final int TYPE_FOCUS_NEXT = 1 << 3;
- public static final int TYPE_FOCUS_BACK = 1 << 4;
-
- private int m_type;
-
- public FormFieldPopupEvent(IFormField source, int type) {
- super(source);
- m_type = type;
- }
-
- public int getType() {
- return m_type;
- }
-
- @Override
- public IFormField getSource() {
- return (IFormField) super.getSource();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.basic.table.celleditor;
+
+import java.util.EventObject;
+
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+
+public class FormFieldPopupEvent extends EventObject {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final int TYPE_OK = 1 << 0;
+ public static final int TYPE_CANCEL = 1 << 1;
+ public static final int TYPE_OPEN = 1 << 2;
+ public static final int TYPE_FOCUS_NEXT = 1 << 3;
+ public static final int TYPE_FOCUS_BACK = 1 << 4;
+
+ private int m_type;
+
+ public FormFieldPopupEvent(IFormField source, int type) {
+ super(source);
+ m_type = type;
+ }
+
+ public int getType() {
+ return m_type;
+ }
+
+ @Override
+ public IFormField getSource() {
+ return (IFormField) super.getSource();
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/celleditor/IFormFieldPopupEventListener.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/celleditor/IFormFieldPopupEventListener.java
index 4db828302e..d638574ccd 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/celleditor/IFormFieldPopupEventListener.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/celleditor/IFormFieldPopupEventListener.java
@@ -1,18 +1,18 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.basic.table.celleditor;
-
-import java.util.EventListener;
-
-public interface IFormFieldPopupEventListener extends EventListener {
-
- void handleEvent(FormFieldPopupEvent event);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.basic.table.celleditor;
+
+import java.util.EventListener;
+
+public interface IFormFieldPopupEventListener extends EventListener {
+
+ void handleEvent(FormFieldPopupEvent event);
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/celleditor/RwtScoutFormFieldPopup.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/celleditor/RwtScoutFormFieldPopup.java
index ffe9f00d00..c28f2eb468 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/celleditor/RwtScoutFormFieldPopup.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/celleditor/RwtScoutFormFieldPopup.java
@@ -1,438 +1,438 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this tribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.basic.table.celleditor;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.atomic.AtomicReference;
-
-import org.eclipse.scout.commons.annotations.Order;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.action.keystroke.AbstractKeyStroke;
-import org.eclipse.scout.rt.client.ui.form.AbstractForm;
-import org.eclipse.scout.rt.client.ui.form.AbstractFormHandler;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
-import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
-import org.eclipse.scout.rt.ui.rap.basic.RwtScoutComposite;
-import org.eclipse.scout.rt.ui.rap.form.IRwtScoutForm;
-import org.eclipse.scout.rt.ui.rap.window.RwtScoutPartEvent;
-import org.eclipse.scout.rt.ui.rap.window.RwtScoutPartListener;
-import org.eclipse.scout.rt.ui.rap.window.popup.RwtScoutDropDownPopup;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ControlAdapter;
-import org.eclipse.swt.events.ControlEvent;
-import org.eclipse.swt.events.ShellAdapter;
-import org.eclipse.swt.events.ShellEvent;
-import org.eclipse.swt.events.TraverseEvent;
-import org.eclipse.swt.events.TraverseListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-
-/**
- * Wraps a {@link IFormField} to be displayed as popup cell editor
- */
-public class RwtScoutFormFieldPopup extends RwtScoutComposite<IFormField> {
- private static IScoutLogger LOG = ScoutLogManager.getLogger(RwtScoutFormFieldPopup.class);
-
- private P_RwtScoutDropDownPopup m_uiScoutPopup;
-
- private Composite m_owner;
-
- private int m_minWidth;
- private int m_prefWidth;
- private int m_minHeight;
- private int m_prefHeight;
- private int m_style;
- private RwtScoutPartListener m_popupEventListener;
-
- private List<IFormFieldPopupEventListener> m_eventListeners = new ArrayList<IFormFieldPopupEventListener>();
- private Object m_eventListenerLock = new Object();
-
- public RwtScoutFormFieldPopup(Composite owner) {
- m_owner = owner;
- m_style = SWT.NO_TRIM;
- m_popupEventListener = new P_PopupEventListener();
- }
-
- @Override
- protected void initializeUi(final Composite parent) {
- super.initializeUi(parent);
-
- // create form to hold the form field
- final AtomicReference<IForm> formRef = new AtomicReference<IForm>();
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- try {
- P_Form form = new P_Form();
- form.setAutoAddRemoveOnDesktop(false);
- form.startForm();
- formRef.set(form);
- }
- catch (Throwable t) {
- LOG.error("failed to start popup form", t);
- }
- synchronized (formRef) {
- formRef.notifyAll();
- }
- }
- };
- synchronized (formRef) {
- getUiEnvironment().invokeScoutLater(runnable, 2345);
- try {
- formRef.wait(2350);
- }
- catch (InterruptedException t) {
- //nop
- }
- }
-
- final IForm form = formRef.get();
- if (form == null) {
- LOG.error("No popup form available");
- return;
- }
-
- // create popup in reference to cell editor (owner)
- m_uiScoutPopup = new P_RwtScoutDropDownPopup();
- m_uiScoutPopup.createPart(form, m_owner, m_style, getUiEnvironment());
- m_uiScoutPopup.setPopupOnField(true);
- m_uiScoutPopup.setHeightHint(m_prefHeight);
- m_uiScoutPopup.setWidthHint(m_prefWidth);
- m_uiScoutPopup.getShell().setMinimumSize(m_minWidth, m_minHeight);
-
- // install popup listener
- m_uiScoutPopup.addRwtScoutPartListener(m_popupEventListener);
-
- // open popup
- try {
- m_uiScoutPopup.showPart();
- // install traversal keystrokes on inner form
- installTraverseKeyStrokes(m_uiScoutPopup.getUiContentPane());
- }
- catch (Throwable t) {
- LOG.error("failed to show popup form", t);
- }
-
- // add control listener to adjust popup location
- m_owner.addControlListener(new ControlAdapter() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void controlResized(ControlEvent e) {
- // invoke at next reasonable time to guarantee proper location
- getUiContainer().getDisplay().asyncExec(new Runnable() {
-
- @Override
- public void run() {
- if (m_uiScoutPopup != null) {
- m_uiScoutPopup.autoAdjustBounds();
- }
- }
-
- });
- }
- });
- setUiContainer(m_owner);
- }
-
- private class P_Form extends AbstractForm {
-
- public P_Form() throws ProcessingException {
- super();
- }
-
- @Override
- protected boolean getConfiguredModal() {
- return false;
- }
-
- @Override
- protected int getConfiguredDisplayHint() {
- return DISPLAY_HINT_VIEW;
- }
-
- @Override
- public String getDisplayViewId() {
- return IForm.VIEW_ID_CENTER;
- }
-
- @Override
- protected boolean getConfiguredAskIfNeedSave() {
- return false;
- }
-
- public void startForm() throws ProcessingException {
- startInternal(new FormHandler());
- }
-
- public MainBox getMainBox() {
- return (MainBox) getRootGroupBox();
- }
-
- @Order(10)
- public class MainBox extends AbstractGroupBox {
-
- @Override
- protected void injectFieldsInternal(List<IFormField> fieldList) {
- fieldList.add(getScoutObject());
- }
-
- @Override
- protected boolean getConfiguredBorderVisible() {
- return false;
- }
-
- @Override
- protected int getConfiguredGridColumnCount() {
- return 1;
- }
-
- @Override
- protected boolean getConfiguredGridUseUiWidth() {
- return true;
- }
-
- @Override
- protected boolean getConfiguredGridUseUiHeight() {
- return true;
- }
-
- @Order(10.0)
- public class EnterKeyStroke extends AbstractKeyStroke {
-
- @Override
- public void execAction() throws ProcessingException {
- getUiContainer().getDisplay().asyncExec(new Runnable() {
-
- @Override
- public void run() {
- closePopup(FormFieldPopupEvent.TYPE_OK);
- }
- });
- }
-
- @Override
- public String getConfiguredKeyStroke() {
- return "ctrl-enter";
- }
- }
-
- @Order(20.0)
- public class EscapeKeyStroke extends AbstractKeyStroke {
-
- @Override
- public void execAction() throws ProcessingException {
- getUiContainer().getDisplay().asyncExec(new Runnable() {
-
- @Override
- public void run() {
- closePopup(FormFieldPopupEvent.TYPE_CANCEL);
- }
- });
- }
-
- @Override
- public String getConfiguredKeyStroke() {
- return "escape";
- }
- }
- }
-
- private class FormHandler extends AbstractFormHandler {
- }
- }
-
- /**
- * Touch the field to write its UI value back to the model
- */
- public void touch() {
- if (m_uiScoutPopup != null) {
- touch(m_uiScoutPopup.getUiContentPane());
- }
- }
-
- private void touch(Control control) {
- if (control == null || control.isDisposed()) {
- return;
- }
- Event event = new Event();
- event.widget = control;
- control.notifyListeners(SWT.Traverse, event);
-
- if (control instanceof Composite) {
- Composite composite = (Composite) control;
- for (Control child : composite.getChildren()) {
- touch(child);
- }
- }
- }
-
- private void installTraverseKeyStrokes(Control control) {
- control.addTraverseListener(new TraverseListener() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void keyTraversed(TraverseEvent e) {
- switch (e.detail) {
- case SWT.TRAVERSE_TAB_NEXT: {
- e.doit = false;
- closePopup(FormFieldPopupEvent.TYPE_OK | FormFieldPopupEvent.TYPE_FOCUS_NEXT);
- break;
- }
- case SWT.TRAVERSE_TAB_PREVIOUS: {
- e.doit = false;
- closePopup(FormFieldPopupEvent.TYPE_OK | FormFieldPopupEvent.TYPE_FOCUS_BACK);
- break;
- }
- }
- }
- });
- if (control instanceof Composite) {
- Composite composite = (Composite) control;
- for (Control child : composite.getChildren()) {
- installTraverseKeyStrokes(child);
- }
- }
- }
-
- public void addEventListener(IFormFieldPopupEventListener eventListener) {
- synchronized (m_eventListenerLock) {
- m_eventListeners.add(eventListener);
- }
- }
-
- public void removeEventListener(IFormFieldPopupEventListener eventListener) {
- synchronized (m_eventListenerLock) {
- m_eventListeners.remove(eventListener);
- }
- }
-
- protected void notifyEventListeners(FormFieldPopupEvent event) {
- IFormFieldPopupEventListener[] eventListeners;
- synchronized (m_eventListenerLock) {
- eventListeners = m_eventListeners.toArray(new IFormFieldPopupEventListener[m_eventListeners.size()]);
- }
- for (IFormFieldPopupEventListener eventListener : eventListeners) {
- eventListener.handleEvent(event);
- }
- }
-
- public void closePopup(int type) {
- touch();
- m_uiScoutPopup.removeRwtScoutPartListener(m_popupEventListener);
- m_uiScoutPopup.closePart();
- m_uiScoutPopup = null;
-
- // notify listeners
- notifyEventListeners(new FormFieldPopupEvent(getScoutObject(), type));
- }
-
- public RwtScoutDropDownPopup getPopup() {
- return m_uiScoutPopup;
- }
-
- public boolean isClosed() {
- return m_uiScoutPopup == null || m_uiScoutPopup.getUiContentPane() == null || m_uiScoutPopup.getUiContentPane().isDisposed();
- }
-
- public IRwtScoutForm getInnerRwtScoutForm() {
- return m_uiScoutPopup.getRwtScoutForm();
- }
-
- public int getMinWidth() {
- return m_minWidth;
- }
-
- public void setMinWidth(int minWidth) {
- m_minWidth = minWidth;
- }
-
- public int getPrefWidth() {
- return m_prefWidth;
- }
-
- public void setPrefWidth(int prefWidth) {
- m_prefWidth = prefWidth;
- }
-
- public int getMinHeight() {
- return m_minHeight;
- }
-
- public void setMinHeight(int minHeight) {
- m_minHeight = minHeight;
- }
-
- public int getPrefHeight() {
- return m_prefHeight;
- }
-
- public void setPrefHeight(int prefHeight) {
- m_prefHeight = prefHeight;
- }
-
- public int getStyle() {
- return m_style;
- }
-
- public void setStyle(int style) {
- m_style = style;
- }
-
- private class P_PopupEventListener implements RwtScoutPartListener {
-
- @Override
- public void partChanged(RwtScoutPartEvent e) {
- if (e.getType() == RwtScoutPartEvent.TYPE_CLOSED) {
- closePopup(FormFieldPopupEvent.TYPE_OK);
- }
- }
- }
-
- private class P_RwtScoutDropDownPopup extends RwtScoutDropDownPopup {
-
- private ShellAdapter m_shellListener;
-
- public void createPart(IForm scoutForm, Composite ownerComponent, int style, IRwtEnvironment uiEnvironment) {
- super.createPart(scoutForm, ownerComponent, (Control) null, style, uiEnvironment);
- }
-
- @Override
- protected void installFocusListener() {
- if (m_shellListener == null) {
- m_shellListener = new ShellAdapter() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void shellDeactivated(ShellEvent e) {
- closePart();
- fireRwtScoutPartEvent(new RwtScoutPartEvent(P_RwtScoutDropDownPopup.this, RwtScoutPartEvent.TYPE_CLOSED));
- }
- };
- getShell().addShellListener(m_shellListener);
- }
- }
-
- @Override
- protected void uninstallFocusLostListener() {
- if (m_shellListener != null) {
- getShell().removeShellListener(m_shellListener);
- }
- m_shellListener = null;
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this tribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.basic.table.celleditor;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.eclipse.scout.commons.annotations.Order;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.action.keystroke.AbstractKeyStroke;
+import org.eclipse.scout.rt.client.ui.form.AbstractForm;
+import org.eclipse.scout.rt.client.ui.form.AbstractFormHandler;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
+import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
+import org.eclipse.scout.rt.ui.rap.basic.RwtScoutComposite;
+import org.eclipse.scout.rt.ui.rap.form.IRwtScoutForm;
+import org.eclipse.scout.rt.ui.rap.window.RwtScoutPartEvent;
+import org.eclipse.scout.rt.ui.rap.window.RwtScoutPartListener;
+import org.eclipse.scout.rt.ui.rap.window.popup.RwtScoutDropDownPopup;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ControlAdapter;
+import org.eclipse.swt.events.ControlEvent;
+import org.eclipse.swt.events.ShellAdapter;
+import org.eclipse.swt.events.ShellEvent;
+import org.eclipse.swt.events.TraverseEvent;
+import org.eclipse.swt.events.TraverseListener;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+
+/**
+ * Wraps a {@link IFormField} to be displayed as popup cell editor
+ */
+public class RwtScoutFormFieldPopup extends RwtScoutComposite<IFormField> {
+ private static IScoutLogger LOG = ScoutLogManager.getLogger(RwtScoutFormFieldPopup.class);
+
+ private P_RwtScoutDropDownPopup m_uiScoutPopup;
+
+ private Composite m_owner;
+
+ private int m_minWidth;
+ private int m_prefWidth;
+ private int m_minHeight;
+ private int m_prefHeight;
+ private int m_style;
+ private RwtScoutPartListener m_popupEventListener;
+
+ private List<IFormFieldPopupEventListener> m_eventListeners = new ArrayList<IFormFieldPopupEventListener>();
+ private Object m_eventListenerLock = new Object();
+
+ public RwtScoutFormFieldPopup(Composite owner) {
+ m_owner = owner;
+ m_style = SWT.NO_TRIM;
+ m_popupEventListener = new P_PopupEventListener();
+ }
+
+ @Override
+ protected void initializeUi(final Composite parent) {
+ super.initializeUi(parent);
+
+ // create form to hold the form field
+ final AtomicReference<IForm> formRef = new AtomicReference<IForm>();
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ try {
+ P_Form form = new P_Form();
+ form.setAutoAddRemoveOnDesktop(false);
+ form.startForm();
+ formRef.set(form);
+ }
+ catch (Throwable t) {
+ LOG.error("failed to start popup form", t);
+ }
+ synchronized (formRef) {
+ formRef.notifyAll();
+ }
+ }
+ };
+ synchronized (formRef) {
+ getUiEnvironment().invokeScoutLater(runnable, 2345);
+ try {
+ formRef.wait(2350);
+ }
+ catch (InterruptedException t) {
+ //nop
+ }
+ }
+
+ final IForm form = formRef.get();
+ if (form == null) {
+ LOG.error("No popup form available");
+ return;
+ }
+
+ // create popup in reference to cell editor (owner)
+ m_uiScoutPopup = new P_RwtScoutDropDownPopup();
+ m_uiScoutPopup.createPart(form, m_owner, m_style, getUiEnvironment());
+ m_uiScoutPopup.setPopupOnField(true);
+ m_uiScoutPopup.setHeightHint(m_prefHeight);
+ m_uiScoutPopup.setWidthHint(m_prefWidth);
+ m_uiScoutPopup.getShell().setMinimumSize(m_minWidth, m_minHeight);
+
+ // install popup listener
+ m_uiScoutPopup.addRwtScoutPartListener(m_popupEventListener);
+
+ // open popup
+ try {
+ m_uiScoutPopup.showPart();
+ // install traversal keystrokes on inner form
+ installTraverseKeyStrokes(m_uiScoutPopup.getUiContentPane());
+ }
+ catch (Throwable t) {
+ LOG.error("failed to show popup form", t);
+ }
+
+ // add control listener to adjust popup location
+ m_owner.addControlListener(new ControlAdapter() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void controlResized(ControlEvent e) {
+ // invoke at next reasonable time to guarantee proper location
+ getUiContainer().getDisplay().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ if (m_uiScoutPopup != null) {
+ m_uiScoutPopup.autoAdjustBounds();
+ }
+ }
+
+ });
+ }
+ });
+ setUiContainer(m_owner);
+ }
+
+ private class P_Form extends AbstractForm {
+
+ public P_Form() throws ProcessingException {
+ super();
+ }
+
+ @Override
+ protected boolean getConfiguredModal() {
+ return false;
+ }
+
+ @Override
+ protected int getConfiguredDisplayHint() {
+ return DISPLAY_HINT_VIEW;
+ }
+
+ @Override
+ public String getDisplayViewId() {
+ return IForm.VIEW_ID_CENTER;
+ }
+
+ @Override
+ protected boolean getConfiguredAskIfNeedSave() {
+ return false;
+ }
+
+ public void startForm() throws ProcessingException {
+ startInternal(new FormHandler());
+ }
+
+ public MainBox getMainBox() {
+ return (MainBox) getRootGroupBox();
+ }
+
+ @Order(10)
+ public class MainBox extends AbstractGroupBox {
+
+ @Override
+ protected void injectFieldsInternal(List<IFormField> fieldList) {
+ fieldList.add(getScoutObject());
+ }
+
+ @Override
+ protected boolean getConfiguredBorderVisible() {
+ return false;
+ }
+
+ @Override
+ protected int getConfiguredGridColumnCount() {
+ return 1;
+ }
+
+ @Override
+ protected boolean getConfiguredGridUseUiWidth() {
+ return true;
+ }
+
+ @Override
+ protected boolean getConfiguredGridUseUiHeight() {
+ return true;
+ }
+
+ @Order(10.0)
+ public class EnterKeyStroke extends AbstractKeyStroke {
+
+ @Override
+ public void execAction() throws ProcessingException {
+ getUiContainer().getDisplay().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ closePopup(FormFieldPopupEvent.TYPE_OK);
+ }
+ });
+ }
+
+ @Override
+ public String getConfiguredKeyStroke() {
+ return "ctrl-enter";
+ }
+ }
+
+ @Order(20.0)
+ public class EscapeKeyStroke extends AbstractKeyStroke {
+
+ @Override
+ public void execAction() throws ProcessingException {
+ getUiContainer().getDisplay().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ closePopup(FormFieldPopupEvent.TYPE_CANCEL);
+ }
+ });
+ }
+
+ @Override
+ public String getConfiguredKeyStroke() {
+ return "escape";
+ }
+ }
+ }
+
+ private class FormHandler extends AbstractFormHandler {
+ }
+ }
+
+ /**
+ * Touch the field to write its UI value back to the model
+ */
+ public void touch() {
+ if (m_uiScoutPopup != null) {
+ touch(m_uiScoutPopup.getUiContentPane());
+ }
+ }
+
+ private void touch(Control control) {
+ if (control == null || control.isDisposed()) {
+ return;
+ }
+ Event event = new Event();
+ event.widget = control;
+ control.notifyListeners(SWT.Traverse, event);
+
+ if (control instanceof Composite) {
+ Composite composite = (Composite) control;
+ for (Control child : composite.getChildren()) {
+ touch(child);
+ }
+ }
+ }
+
+ private void installTraverseKeyStrokes(Control control) {
+ control.addTraverseListener(new TraverseListener() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void keyTraversed(TraverseEvent e) {
+ switch (e.detail) {
+ case SWT.TRAVERSE_TAB_NEXT: {
+ e.doit = false;
+ closePopup(FormFieldPopupEvent.TYPE_OK | FormFieldPopupEvent.TYPE_FOCUS_NEXT);
+ break;
+ }
+ case SWT.TRAVERSE_TAB_PREVIOUS: {
+ e.doit = false;
+ closePopup(FormFieldPopupEvent.TYPE_OK | FormFieldPopupEvent.TYPE_FOCUS_BACK);
+ break;
+ }
+ }
+ }
+ });
+ if (control instanceof Composite) {
+ Composite composite = (Composite) control;
+ for (Control child : composite.getChildren()) {
+ installTraverseKeyStrokes(child);
+ }
+ }
+ }
+
+ public void addEventListener(IFormFieldPopupEventListener eventListener) {
+ synchronized (m_eventListenerLock) {
+ m_eventListeners.add(eventListener);
+ }
+ }
+
+ public void removeEventListener(IFormFieldPopupEventListener eventListener) {
+ synchronized (m_eventListenerLock) {
+ m_eventListeners.remove(eventListener);
+ }
+ }
+
+ protected void notifyEventListeners(FormFieldPopupEvent event) {
+ IFormFieldPopupEventListener[] eventListeners;
+ synchronized (m_eventListenerLock) {
+ eventListeners = m_eventListeners.toArray(new IFormFieldPopupEventListener[m_eventListeners.size()]);
+ }
+ for (IFormFieldPopupEventListener eventListener : eventListeners) {
+ eventListener.handleEvent(event);
+ }
+ }
+
+ public void closePopup(int type) {
+ touch();
+ m_uiScoutPopup.removeRwtScoutPartListener(m_popupEventListener);
+ m_uiScoutPopup.closePart();
+ m_uiScoutPopup = null;
+
+ // notify listeners
+ notifyEventListeners(new FormFieldPopupEvent(getScoutObject(), type));
+ }
+
+ public RwtScoutDropDownPopup getPopup() {
+ return m_uiScoutPopup;
+ }
+
+ public boolean isClosed() {
+ return m_uiScoutPopup == null || m_uiScoutPopup.getUiContentPane() == null || m_uiScoutPopup.getUiContentPane().isDisposed();
+ }
+
+ public IRwtScoutForm getInnerRwtScoutForm() {
+ return m_uiScoutPopup.getRwtScoutForm();
+ }
+
+ public int getMinWidth() {
+ return m_minWidth;
+ }
+
+ public void setMinWidth(int minWidth) {
+ m_minWidth = minWidth;
+ }
+
+ public int getPrefWidth() {
+ return m_prefWidth;
+ }
+
+ public void setPrefWidth(int prefWidth) {
+ m_prefWidth = prefWidth;
+ }
+
+ public int getMinHeight() {
+ return m_minHeight;
+ }
+
+ public void setMinHeight(int minHeight) {
+ m_minHeight = minHeight;
+ }
+
+ public int getPrefHeight() {
+ return m_prefHeight;
+ }
+
+ public void setPrefHeight(int prefHeight) {
+ m_prefHeight = prefHeight;
+ }
+
+ public int getStyle() {
+ return m_style;
+ }
+
+ public void setStyle(int style) {
+ m_style = style;
+ }
+
+ private class P_PopupEventListener implements RwtScoutPartListener {
+
+ @Override
+ public void partChanged(RwtScoutPartEvent e) {
+ if (e.getType() == RwtScoutPartEvent.TYPE_CLOSED) {
+ closePopup(FormFieldPopupEvent.TYPE_OK);
+ }
+ }
+ }
+
+ private class P_RwtScoutDropDownPopup extends RwtScoutDropDownPopup {
+
+ private ShellAdapter m_shellListener;
+
+ public void createPart(IForm scoutForm, Composite ownerComponent, int style, IRwtEnvironment uiEnvironment) {
+ super.createPart(scoutForm, ownerComponent, (Control) null, style, uiEnvironment);
+ }
+
+ @Override
+ protected void installFocusListener() {
+ if (m_shellListener == null) {
+ m_shellListener = new ShellAdapter() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void shellDeactivated(ShellEvent e) {
+ closePart();
+ fireRwtScoutPartEvent(new RwtScoutPartEvent(P_RwtScoutDropDownPopup.this, RwtScoutPartEvent.TYPE_CLOSED));
+ }
+ };
+ getShell().addShellListener(m_shellListener);
+ }
+ }
+
+ @Override
+ protected void uninstallFocusLostListener() {
+ if (m_shellListener != null) {
+ getShell().removeShellListener(m_shellListener);
+ }
+ m_shellListener = null;
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/celleditor/RwtScoutTableCellEditor.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/celleditor/RwtScoutTableCellEditor.java
index 33454f9916..15c1df5f52 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/celleditor/RwtScoutTableCellEditor.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/celleditor/RwtScoutTableCellEditor.java
@@ -1,800 +1,800 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.basic.table.celleditor;
-
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.atomic.AtomicReference;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantLock;
-
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.ColumnViewerEditorActivationEvent;
-import org.eclipse.jface.viewers.ColumnViewerEditorDeactivationEvent;
-import org.eclipse.jface.viewers.ICellModifier;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.ViewerCell;
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.rt.client.ui.basic.table.ITable;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.scout.rt.client.ui.basic.table.TableUtility;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IBooleanColumn;
-import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
-import org.eclipse.scout.rt.client.ui.form.fields.GridData;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.stringfield.IStringField;
-import org.eclipse.scout.rt.ui.rap.basic.IRwtScoutComposite;
-import org.eclipse.scout.rt.ui.rap.basic.table.IRwtScoutTable;
-import org.eclipse.scout.rt.ui.rap.basic.table.IRwtScoutTableForPatch;
-import org.eclipse.scout.rt.ui.rap.extension.UiDecorationExtensionPoint;
-import org.eclipse.scout.rt.ui.rap.form.IRwtScoutForm;
-import org.eclipse.scout.rt.ui.rap.form.fields.IPopupSupport;
-import org.eclipse.scout.rt.ui.rap.form.fields.IPopupSupport.IPopupSupportListener;
-import org.eclipse.scout.rt.ui.rap.keystroke.RwtKeyStroke;
-import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.TraverseEvent;
-import org.eclipse.swt.events.TraverseListener;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.Widget;
-
-/**
- * <h3>RwtScoutTableCellEditor</h3> ...
- *
- * @author imo
- * @since 3.7.0 June 2011
- */
-public class RwtScoutTableCellEditor {
- private static final String DUMMY_VALUE = "Dummy";
-
- private final IRwtScoutTableForPatch m_uiTableComposite;
- private final Listener m_rowHeightListener;
-
- private P_FocusLostListener m_focusLostListener;
-
- public RwtScoutTableCellEditor(IRwtScoutTableForPatch uiTableComposite) {
- m_focusLostListener = new P_FocusLostListener();
- m_uiTableComposite = uiTableComposite;
- m_rowHeightListener = new Listener() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void handleEvent(Event event) {
- event.height = Math.max(event.height, UiDecorationExtensionPoint.getLookAndFeel().getLogicalGridLayoutRowHeight());
- }
- };
- }
-
- //(re)install cell editors
- public void initializeUi() {
- TableViewer viewer = m_uiTableComposite.getUiTableViewer();
- String[] columnPropertyNames = new String[viewer.getTable().getColumnCount()];
- CellEditor[] oldEditors = viewer.getCellEditors();
- CellEditor[] newEditors = new CellEditor[columnPropertyNames.length];
- boolean hasEditors = false;
- for (int i = 0; i < columnPropertyNames.length; i++) {
- TableColumn rwtCol = viewer.getTable().getColumn(i);
- IColumn<?> scoutCol = (IColumn<?>) rwtCol.getData(IRwtScoutTableForPatch.KEY_SCOUT_COLUMN);
- if (scoutCol != null) {
- columnPropertyNames[i] = "" + scoutCol.getColumnIndex();
- if (scoutCol.isEditable()) {
- hasEditors = true;
- newEditors[i] = new P_RwtCellEditor(viewer.getTable());
- }
- }
- else {
- columnPropertyNames[i] = "";
- }
- }
- viewer.setCellModifier(new P_RwtCellModifier());
- viewer.setColumnProperties(columnPropertyNames);
- viewer.setCellEditors(newEditors);
- if (oldEditors != null && oldEditors.length > 0) {
- for (CellEditor editor : oldEditors) {
- if (editor != null) {
- editor.dispose();
- }
- }
- }
- //increase row height when editors are present
- if (hasEditors) {
- //TODO rap viewer.getTable().addListener(SWT.MeasureItem, m_rowHeightListener);
- }
- else {
- //TODO rap viewer.getTable().removeListener(SWT.MeasureItem, m_rowHeightListener);
- }
- }
-
- protected Control getEditorControl(Composite parent, ITableRow scoutRow, IColumn<?> scoutCol) {
- //no caching
- Control swtEditorControl = null;
- IRwtScoutComposite<? extends IFormField> editorComposite = createEditorComposite(parent, scoutRow, scoutCol);
- if (editorComposite != null) {
- decorateEditorComposite(editorComposite, scoutRow, scoutCol);
- swtEditorControl = editorComposite.getUiContainer();
- }
- return swtEditorControl;
- }
-
- @SuppressWarnings("unchecked")
- protected IRwtScoutComposite<? extends IFormField> createEditorComposite(Composite parent, final ITableRow scoutRow, final IColumn<?> scoutCol) {
- final AtomicReference<IFormField> fieldRef = new AtomicReference<IFormField>();
- if (scoutRow != null && scoutCol != null) {
- Runnable t = new Runnable() {
- @Override
- public void run() {
- fieldRef.set(m_uiTableComposite.getScoutObject().getUIFacade().prepareCellEditFromUI(scoutRow, scoutCol));
- synchronized (fieldRef) {
- fieldRef.notifyAll();
- }
- }
- };
- synchronized (fieldRef) {
- m_uiTableComposite.getUiEnvironment().invokeScoutLater(t, 2345);
- try {
- fieldRef.wait(2345);
- }
- catch (InterruptedException e) {
- //nop
- }
- }
- }
- IFormField formField = fieldRef.get();
- if (formField == null) {
- return null;
- }
-
- IRwtScoutComposite uiScoutFormField;
- if (formField instanceof IStringField && ((IStringField) formField).isMultilineText()) {
- // for fields to be presented as popup dialog
- uiScoutFormField = createEditorCompositesPopup(parent, formField, scoutRow, scoutCol);
- }
- else {
- uiScoutFormField = m_uiTableComposite.getUiEnvironment().createFormField(parent, formField);
- }
-
- // If the SWT field uses a @{Shell} to edit its value, the focus on the table gets lost while the shell is open.
- // To prevent the cell editor from being closed, the focus lost listener must be uninstalled for the time the shell is open.
- if (uiScoutFormField instanceof IPopupSupport) {
- ((IPopupSupport) uiScoutFormField).addPopupEventListener(new IPopupSupportListener() {
-
- @Override
- public void handleEvent(int eventType) {
- if (eventType == IPopupSupportListener.TYPE_OPENING) {
- getFocusLostListener().suspend();
- }
- else if (eventType == IPopupSupportListener.TYPE_CLOSED) {
- getFocusLostListener().resume();
- }
- }
- });
- }
- return uiScoutFormField;
- }
-
- protected IRwtScoutComposite<? extends IFormField> createEditorCompositesPopup(Composite parent, IFormField formField, final ITableRow scoutRow, final IColumn<?> scoutCol) {
- // uninstall focus lost listener as new shell is used for popup
- getFocusLostListener().suspend();
-
- // overwrite layout properties
- GridData gd = formField.getGridData();
- gd.h = 1;
- gd.w = IFormField.FULL_WIDTH;
- gd.weightY = 1;
- gd.weightX = 1;
- formField.setGridDataInternal(gd);
-
- TableColumn swtCol = getRwtColumn(scoutCol);
- final P_RwtCellEditor cellEditor = (P_RwtCellEditor) m_uiTableComposite.getUiTableViewer().getCellEditors()[getRwtColumnIndex(swtCol)];
-
- int prefWidth = gd.widthInPixel;
- int minWidth = swtCol.getWidth();
- int prefHeight = gd.heightInPixel;
- int minHeight = Math.max(105, m_uiTableComposite.getUiTableViewer().getTable().getItemHeight());
-
- prefHeight = Math.max(prefHeight, minHeight);
- prefWidth = Math.max(prefWidth, minWidth);
-
- // create placeholder field to represent the cell editor
- Composite cellEditorComposite = new Composite(parent, SWT.NONE);
-
- // create popup dialog to wrap the form field
- final RwtScoutFormFieldPopup formFieldDialog = new RwtScoutFormFieldPopup(cellEditorComposite);
- formFieldDialog.setPrefHeight(prefHeight);
- formFieldDialog.setPrefWidth(prefWidth);
- formFieldDialog.setMinHeight(minHeight);
- formFieldDialog.setMinWidth(minWidth);
- formFieldDialog.createUiField(parent, formField, m_uiTableComposite.getUiEnvironment());
-
- // register custom cell modifier to touch the field in order to write its value back to the model
- final ICellModifier defaultCellModifier = m_uiTableComposite.getUiTableViewer().getCellModifier();
- m_uiTableComposite.getUiTableViewer().setCellModifier(new P_RwtCellModifier() {
-
- @Override
- public void modify(Object element, String property, Object value) {
- formFieldDialog.touch();
- super.modify(element, property, value);
- }
- });
- // register custom focus delegate to request the field's focus
- final IFocusDelegate defaultFocusDelegate = cellEditor.getFocusDelegate();
- cellEditor.setFocusDelegate(new IFocusDelegate() {
-
- @Override
- public void doSetFocus() {
- IRwtScoutForm rwtScoutForm = formFieldDialog.getInnerRwtScoutForm();
- if (rwtScoutForm != null) {
- requestFocus(rwtScoutForm.getUiContainer());
- }
- }
- });
-
- // listener to receive events about the popup's state
- final IFormFieldPopupEventListener popupListener = new IFormFieldPopupEventListener() {
-
- @Override
- public void handleEvent(FormFieldPopupEvent event) {
- if ((event.getType() & FormFieldPopupEvent.TYPE_OK) > 0) {
- // save cell editor
- cellEditor.stopCellEditing();
- }
- else if ((event.getType() & FormFieldPopupEvent.TYPE_CANCEL) > 0) {
- // cancel cell editor
- cellEditor.cancelCellEditing();
- }
-
- // traversal control
- if ((event.getType() & FormFieldPopupEvent.TYPE_FOCUS_BACK) > 0) {
- enqueueEditNextTableCell(scoutRow, scoutCol, false);
- }
- else if ((event.getType() & FormFieldPopupEvent.TYPE_FOCUS_NEXT) > 0) {
- enqueueEditNextTableCell(scoutRow, scoutCol, true);
- }
- }
- };
- formFieldDialog.addEventListener(popupListener);
-
- // register listener to intercept the cell editor's events in order to properly close the popup.
- // This is crucial if the editor is deactivated programmatically or if another cell is activated.
- // In contrast to SWT, in RWT the next cell is activated prior to receiving the shell closed event.
- cellEditor.addDeactivateListener(new IDeactivateListener() {
-
- @Override
- public void canceled(ColumnViewerEditorDeactivationEvent event) {
- restoreDefault();
- closePopup(FormFieldPopupEvent.TYPE_OK);
- }
-
- @Override
- public void saved(ColumnViewerEditorDeactivationEvent event) {
- restoreDefault();
- closePopup(FormFieldPopupEvent.TYPE_CANCEL);
- }
-
- private void restoreDefault() {
- // restore default focus delegate
- cellEditor.setFocusDelegate(defaultFocusDelegate);
- // restore default cell modifier
- m_uiTableComposite.getUiTableViewer().setCellModifier(defaultCellModifier);
- // remove this listener on the cell editor
- cellEditor.removeDeactivateListener(this);
- }
-
- private void closePopup(int popupEvent) {
- if (formFieldDialog.isClosed()) {
- return;
- }
- // remove popup listener to not receive events on the dialog's state because the cell editor is already closing
- formFieldDialog.removeEventListener(popupListener);
- // close the popup
- formFieldDialog.closePopup(popupEvent);
- }
- });
-
- return formFieldDialog;
- }
-
- private TableColumn getRwtColumn(IColumn<?> scoutCol) {
- for (TableColumn swtCol : m_uiTableComposite.getUiTableViewer().getTable().getColumns()) {
- IColumn<?> candidate = (IColumn<?>) swtCol.getData(IRwtScoutTable.KEY_SCOUT_COLUMN);
- if (candidate != null && CompareUtility.equals(candidate.getColumnId(), scoutCol.getColumnId())) {
- return swtCol;
- }
- }
- return null;
- }
-
- private int getRwtColumnIndex(TableColumn swtCol) {
- Table table = m_uiTableComposite.getUiTableViewer().getTable();
- for (int i = 0; i < table.getColumnCount(); i++) {
- if (table.getColumn(i) == swtCol) {
- return i;
- }
- }
- return -1;
- }
-
- protected void decorateEditorComposite(IRwtScoutComposite<? extends IFormField> editorComposite, final ITableRow scoutRow, final IColumn<?> scoutCol) {
- }
-
- protected void saveEditorFromUi() {
- Runnable t = new Runnable() {
- @Override
- public void run() {
- m_uiTableComposite.getScoutObject().getUIFacade().completeCellEditFromUI();
- }
- };
- m_uiTableComposite.getUiEnvironment().invokeScoutLater(t, 0);
- }
-
- protected void cancelEditorFromUi() {
- Runnable t = new Runnable() {
- @Override
- public void run() {
- m_uiTableComposite.getScoutObject().getUIFacade().cancelCellEditFromUI();
- }
- };
- m_uiTableComposite.getUiEnvironment().invokeScoutLater(t, 0);
- }
-
- protected void enqueueEditNextTableCell(final ITableRow row, final IColumn<?> col, final boolean forward) {
- if (row == null || col == null) {
- return;
- }
- m_uiTableComposite.getUiEnvironment().invokeScoutLater(new Runnable() {
- @Override
- public void run() {
- if (m_uiTableComposite.getUiEnvironment() == null) {
- return;
- }
- ITable table = m_uiTableComposite.getScoutObject();
- TableUtility.editNextTableCell(table, row, col, forward, new TableUtility.ITableCellEditorFilter() {
- @Override
- public boolean accept(ITableRow rowx, IColumn<?> colx) {
- return !(colx instanceof IBooleanColumn);
- }
- });
- }
- }, 0L);
- }
-
- protected IColumn<?> getScoutColumn(String property) {
- if (property != null && property.matches("[0-9]+")) {
- int colIndex = Integer.parseInt(property);
- return m_uiTableComposite.getScoutObject().getColumnSet().getColumn(colIndex);
- }
- return null;
- }
-
- public P_FocusLostListener getFocusLostListener() {
- return m_focusLostListener;
- }
-
- private boolean requestFocus(Control control) {
- if (control == null || control.isDisposed()) {
- return false;
- }
- if (control.setFocus()) {
- return true;
- }
-
- if (control instanceof Composite) {
- for (Control child : ((Composite) control).getChildren()) {
- if (requestFocus(child)) {
- return true;
- }
- }
- }
- return false;
- }
-
- private class P_RwtCellModifier implements ICellModifier {
-
- @Override
- public void modify(Object element, String property, Object value) {
- saveEditorFromUi();
- }
-
- @Override
- public Object getValue(Object element, String property) {
- return DUMMY_VALUE;
- }
-
- @Override
- public boolean canModify(Object element, String property) {
- final ITable table = m_uiTableComposite.getScoutObject();
- final ITableRow row = (ITableRow) element;
- final IColumn<?> column = getScoutColumn(property);
- //make a safe model call
- final AtomicBoolean b = new AtomicBoolean();
- synchronized (b) {
- Runnable r = new Runnable() {
- @Override
- public void run() {
- // try first
- synchronized (b) {
- try {
- if (table != null && row != null && column != null) {
- if (column instanceof IBooleanColumn) {
- b.set(false);
- }
- else {
- b.set(table.isCellEditable(row, column));
- }
- }
- }
- catch (Throwable ex) {
- //fast access: ignore
- }
- b.notifyAll();
- }
- }
- };
- m_uiTableComposite.getUiEnvironment().invokeScoutLater(r, 2345);
- try {
- b.wait(2345);
- }
- catch (InterruptedException e) {
- //nop
- }
- }
- return b.get();
- }
- }
-
- private class P_RwtCellEditor extends CellEditor {
- private static final long serialVersionUID = 1L;
-
- private Composite m_container;
- private Object m_value;
- private ITableRow m_editScoutRow;
- private IColumn<?> m_editScoutCol;
- private IFocusDelegate m_focusDelegate;
- private ConcurrentHashMap<IDeactivateListener, Object> m_deactivateListeners;
-
- protected P_RwtCellEditor(Table parent) {
- super(parent);
- m_focusDelegate = new P_FocusDelegate();
- m_deactivateListeners = new ConcurrentHashMap<IDeactivateListener, Object>();
- }
-
- @Override
- protected Control createControl(Composite/*Table*/parent) {
- m_container = new Composite(parent, SWT.NONE) {
- private static final long serialVersionUID = 1L;
-
- /*
- * disable inner components preferred sizes
- */
- @Override
- public Point computeSize(int wHint, int hHint, boolean changed) {
- return new Point(wHint, hHint);
- }
- };
-
- //The table does only dispose table items and columns so we have to manually dispose our container.
- parent.addDisposeListener(new DisposeListener() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void widgetDisposed(DisposeEvent event) {
- m_container.dispose();
- }
-
- });
-
- m_container.setLayout(new FillLayout());
- m_uiTableComposite.getUiEnvironment().addKeyStroke(m_container, new RwtKeyStroke(SWT.ESC) {
- @Override
- public void handleUiAction(Event e) {
- e.doit = false;
- fireCancelEditor();
- }
- }, false);
- m_uiTableComposite.getUiEnvironment().addKeyStroke(m_container, new RwtKeyStroke(SWT.CR) {
- @Override
- public void handleUiAction(Event e) {
- e.doit = false;
- fireApplyEditorValue();
- deactivate();
- }
- }, false);
-
- m_container.addDisposeListener(new DisposeListener() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void widgetDisposed(DisposeEvent event) {
- m_uiTableComposite.getUiEnvironment().removeKeyStrokes(m_container);
- }
-
- });
-
- return m_container;
- }
-
- @Override
- protected void doSetFocus() {
- if (m_focusDelegate != null) {
- m_focusDelegate.doSetFocus();
- }
- }
-
- @Override
- protected Object doGetValue() {
- return m_value;
- }
-
- @Override
- protected void doSetValue(Object value) {
- m_value = value;
- }
-
- @Override
- public void activate(ColumnViewerEditorActivationEvent e) {
- getFocusLostListener().install();
- getFocusLostListener().suspend(); // is only resumed if editor gets the focus in @{link P_RwtCellEditor#doSetFocus()}. Otherwise, a focus lost event might be consumed and the editor closed
-
- m_editScoutRow = null;
- m_editScoutCol = null;
- if (e.getSource() instanceof ViewerCell) {
- ViewerCell cell = (ViewerCell) e.getSource();
- TableViewer viewer = m_uiTableComposite.getUiTableViewer();
- TableColumn rwtCol = viewer.getTable().getColumn(cell.getColumnIndex());
- IColumn<?> scoutCol = (IColumn<?>) rwtCol.getData(IRwtScoutTableForPatch.KEY_SCOUT_COLUMN);
- ITableRow scoutRow = (ITableRow) cell.getElement();
- //no edit on boolean column when mouse was clicked
- if (e.sourceEvent instanceof MouseEvent) {
- if (scoutCol instanceof IBooleanColumn) {
- return;
- }
- }
- if (scoutRow != null && scoutCol != null) {
- m_editScoutRow = scoutRow;
- m_editScoutCol = scoutCol;
- @SuppressWarnings("unused")
- Control control = getEditorControl(m_container, scoutRow, scoutCol);
- }
- m_container.layout(true, true);
- m_container.setVisible(true);
- }
- }
-
- @Override
- protected void deactivate(ColumnViewerEditorDeactivationEvent e) {
- getFocusLostListener().uninstall();
-
- // notify cell editor close listeners
- for (IDeactivateListener listener : m_deactivateListeners.keySet()) {
- if (e.eventType == ColumnViewerEditorDeactivationEvent.EDITOR_SAVED) {
- listener.saved(e);
- }
- else {
- listener.canceled(e);
- }
- }
-
- m_editScoutRow = null;
- m_editScoutCol = null;
- for (Control c : m_container.getChildren()) {
- c.dispose();
- }
- super.deactivate(e);
- if (e.eventType == ColumnViewerEditorDeactivationEvent.EDITOR_CANCELED) {
- cancelEditorFromUi();
- }
- }
-
- public void stopCellEditing() {
- fireApplyEditorValue();
- deactivate();
- }
-
- public void cancelCellEditing() {
- fireCancelEditor();
- deactivate();
- }
-
- public IFocusDelegate getFocusDelegate() {
- return m_focusDelegate;
- }
-
- public void setFocusDelegate(IFocusDelegate focusDelegate) {
- m_focusDelegate = focusDelegate;
- }
-
- public void addDeactivateListener(IDeactivateListener listener) {
- m_deactivateListeners.put(listener, new Object());
- }
-
- public void removeDeactivateListener(IDeactivateListener listener) {
- m_deactivateListeners.remove(listener);
- }
-
- private class P_FocusDelegate implements IFocusDelegate {
-
- @Override
- public void doSetFocus() {
- requestFocus(m_container);
- Control focusControl = m_container.getDisplay().getFocusControl();
- if (focusControl != null && RwtUtility.isAncestorOf(m_container, focusControl)) {
- focusControl.addTraverseListener(new TraverseListener() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void keyTraversed(TraverseEvent e) {
- switch (e.detail) {
- case SWT.TRAVERSE_ESCAPE:
- case SWT.TRAVERSE_RETURN: {
- e.doit = false;
- break;
- }
- case SWT.TRAVERSE_TAB_NEXT: {
- e.doit = false;
- ITableRow scoutRow = m_editScoutRow;
- IColumn<?> scoutCol = m_editScoutCol;
- fireApplyEditorValue();
- deactivate();
- enqueueEditNextTableCell(scoutRow, scoutCol, true);
- break;
- }
- case SWT.TRAVERSE_TAB_PREVIOUS: {
- e.doit = false;
- ITableRow scoutRow = m_editScoutRow;
- IColumn<?> scoutCol = m_editScoutCol;
- fireApplyEditorValue();
- deactivate();
- enqueueEditNextTableCell(scoutRow, scoutCol, false);
- break;
- }
- }
- }
- });
- }
- getFocusLostListener().resume(); // because listener was suspended after activation
- }
- }
- }
-
- /**
- * Hysteresis listener that commits the cell editor when the table has first received focus and then lost it. That is
- * because cell editors in SWT are not closed automatically if the table looses the focus.
- */
- private class P_FocusLostListener implements Listener {
- private static final long serialVersionUID = 1L;
-
- private final Lock m_suspendLock = new ReentrantLock();
- private AtomicInteger m_suspendCounter = new AtomicInteger();
-
- /**
- * Uninstalls this listener on the table widget
- */
- public void uninstall() {
- m_uiTableComposite.getUiEnvironment().getDisplay().removeFilter(SWT.FocusIn, this);
- m_suspendCounter.set(0);
- }
-
- /**
- * Installs this listener on the table widget
- */
- public void install() {
- m_uiTableComposite.getUiEnvironment().getDisplay().addFilter(SWT.FocusIn, this);
- m_suspendCounter.set(0);
- }
-
- /**
- * <p>
- * To resume listening for focus lost events.
- * </p>
- * <p>
- * Please note that this request is put onto a stack meaning that you have to call
- * {@link P_FocusLostListener#resume()} as many times as you called {@link P_FocusLostListener#suspend()} to resume
- * listening for focus lost events.
- * </p>
- * <p>
- * <small>Counterpart of {@link P_FocusLostListener#suspend()}.</small>
- * </p>
- */
- public void resume() {
- m_suspendLock.lock();
- try {
- if (m_suspendCounter.decrementAndGet() < 0) { // negative values are not allowed
- m_suspendCounter.set(0);
- }
- }
- finally {
- m_suspendLock.unlock();
- }
- }
-
- /**
- * <p>
- * To suspend listening for focus lost events.
- * </p>
- * <p>
- * Please note that this request is put onto a stack meaning that you have to call
- * {@link P_FocusLostListener#resume()} as many times as you called {@link P_FocusLostListener#suspend()} to resume
- * listening for focus lost events.
- * </p>
- * <p>
- * <small>Counterpart of {@link P_FocusLostListener#resume()}.</small>
- * </p>
- */
- public void suspend() {
- m_suspendLock.lock();
- try {
- m_suspendCounter.incrementAndGet();
- }
- finally {
- m_suspendLock.unlock();
- }
- }
-
- public boolean isSuspended() {
- return m_suspendCounter.get() > 0;
- }
-
- @Override
- public void handleEvent(Event event) {
- if (isSuspended()) {
- return;
- }
-
- Widget w = event.widget;
- if (w == null || !(w instanceof Control) || w.isDisposed()) {
- return;
- }
- TableViewer viewer = m_uiTableComposite.getUiTableViewer();
- if (!viewer.isCellEditorActive()) {
- return;
- }
-
- Control candidate = (Control) w;
- Control tableControl = m_uiTableComposite.getUiTableViewer().getControl();
-
- if (!RwtUtility.isAncestorOf(tableControl, candidate)) {
- for (CellEditor editor : viewer.getCellEditors()) {
- if (editor != null && editor.isActivated() && editor instanceof P_RwtCellEditor) {
- ((P_RwtCellEditor) editor).stopCellEditing();
- break;
- }
- }
- }
- }
- }
-
- /**
- * Delegate to process focus events on cell editor
- */
- private interface IFocusDelegate {
- public void doSetFocus();
- }
-
- /**
- * Listener to get notified about deactivation event
- */
- private interface IDeactivateListener {
- public void canceled(ColumnViewerEditorDeactivationEvent event);
-
- public void saved(ColumnViewerEditorDeactivationEvent event);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.basic.table.celleditor;
+
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicReference;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.ColumnViewerEditorActivationEvent;
+import org.eclipse.jface.viewers.ColumnViewerEditorDeactivationEvent;
+import org.eclipse.jface.viewers.ICellModifier;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.ViewerCell;
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.rt.client.ui.basic.table.ITable;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.scout.rt.client.ui.basic.table.TableUtility;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IBooleanColumn;
+import org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn;
+import org.eclipse.scout.rt.client.ui.form.fields.GridData;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.stringfield.IStringField;
+import org.eclipse.scout.rt.ui.rap.basic.IRwtScoutComposite;
+import org.eclipse.scout.rt.ui.rap.basic.table.IRwtScoutTable;
+import org.eclipse.scout.rt.ui.rap.basic.table.IRwtScoutTableForPatch;
+import org.eclipse.scout.rt.ui.rap.extension.UiDecorationExtensionPoint;
+import org.eclipse.scout.rt.ui.rap.form.IRwtScoutForm;
+import org.eclipse.scout.rt.ui.rap.form.fields.IPopupSupport;
+import org.eclipse.scout.rt.ui.rap.form.fields.IPopupSupport.IPopupSupportListener;
+import org.eclipse.scout.rt.ui.rap.keystroke.RwtKeyStroke;
+import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.TraverseEvent;
+import org.eclipse.swt.events.TraverseListener;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.Widget;
+
+/**
+ * <h3>RwtScoutTableCellEditor</h3> ...
+ *
+ * @author imo
+ * @since 3.7.0 June 2011
+ */
+public class RwtScoutTableCellEditor {
+ private static final String DUMMY_VALUE = "Dummy";
+
+ private final IRwtScoutTableForPatch m_uiTableComposite;
+ private final Listener m_rowHeightListener;
+
+ private P_FocusLostListener m_focusLostListener;
+
+ public RwtScoutTableCellEditor(IRwtScoutTableForPatch uiTableComposite) {
+ m_focusLostListener = new P_FocusLostListener();
+ m_uiTableComposite = uiTableComposite;
+ m_rowHeightListener = new Listener() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void handleEvent(Event event) {
+ event.height = Math.max(event.height, UiDecorationExtensionPoint.getLookAndFeel().getLogicalGridLayoutRowHeight());
+ }
+ };
+ }
+
+ //(re)install cell editors
+ public void initializeUi() {
+ TableViewer viewer = m_uiTableComposite.getUiTableViewer();
+ String[] columnPropertyNames = new String[viewer.getTable().getColumnCount()];
+ CellEditor[] oldEditors = viewer.getCellEditors();
+ CellEditor[] newEditors = new CellEditor[columnPropertyNames.length];
+ boolean hasEditors = false;
+ for (int i = 0; i < columnPropertyNames.length; i++) {
+ TableColumn rwtCol = viewer.getTable().getColumn(i);
+ IColumn<?> scoutCol = (IColumn<?>) rwtCol.getData(IRwtScoutTableForPatch.KEY_SCOUT_COLUMN);
+ if (scoutCol != null) {
+ columnPropertyNames[i] = "" + scoutCol.getColumnIndex();
+ if (scoutCol.isEditable()) {
+ hasEditors = true;
+ newEditors[i] = new P_RwtCellEditor(viewer.getTable());
+ }
+ }
+ else {
+ columnPropertyNames[i] = "";
+ }
+ }
+ viewer.setCellModifier(new P_RwtCellModifier());
+ viewer.setColumnProperties(columnPropertyNames);
+ viewer.setCellEditors(newEditors);
+ if (oldEditors != null && oldEditors.length > 0) {
+ for (CellEditor editor : oldEditors) {
+ if (editor != null) {
+ editor.dispose();
+ }
+ }
+ }
+ //increase row height when editors are present
+ if (hasEditors) {
+ //TODO rap viewer.getTable().addListener(SWT.MeasureItem, m_rowHeightListener);
+ }
+ else {
+ //TODO rap viewer.getTable().removeListener(SWT.MeasureItem, m_rowHeightListener);
+ }
+ }
+
+ protected Control getEditorControl(Composite parent, ITableRow scoutRow, IColumn<?> scoutCol) {
+ //no caching
+ Control swtEditorControl = null;
+ IRwtScoutComposite<? extends IFormField> editorComposite = createEditorComposite(parent, scoutRow, scoutCol);
+ if (editorComposite != null) {
+ decorateEditorComposite(editorComposite, scoutRow, scoutCol);
+ swtEditorControl = editorComposite.getUiContainer();
+ }
+ return swtEditorControl;
+ }
+
+ @SuppressWarnings("unchecked")
+ protected IRwtScoutComposite<? extends IFormField> createEditorComposite(Composite parent, final ITableRow scoutRow, final IColumn<?> scoutCol) {
+ final AtomicReference<IFormField> fieldRef = new AtomicReference<IFormField>();
+ if (scoutRow != null && scoutCol != null) {
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ fieldRef.set(m_uiTableComposite.getScoutObject().getUIFacade().prepareCellEditFromUI(scoutRow, scoutCol));
+ synchronized (fieldRef) {
+ fieldRef.notifyAll();
+ }
+ }
+ };
+ synchronized (fieldRef) {
+ m_uiTableComposite.getUiEnvironment().invokeScoutLater(t, 2345);
+ try {
+ fieldRef.wait(2345);
+ }
+ catch (InterruptedException e) {
+ //nop
+ }
+ }
+ }
+ IFormField formField = fieldRef.get();
+ if (formField == null) {
+ return null;
+ }
+
+ IRwtScoutComposite uiScoutFormField;
+ if (formField instanceof IStringField && ((IStringField) formField).isMultilineText()) {
+ // for fields to be presented as popup dialog
+ uiScoutFormField = createEditorCompositesPopup(parent, formField, scoutRow, scoutCol);
+ }
+ else {
+ uiScoutFormField = m_uiTableComposite.getUiEnvironment().createFormField(parent, formField);
+ }
+
+ // If the SWT field uses a @{Shell} to edit its value, the focus on the table gets lost while the shell is open.
+ // To prevent the cell editor from being closed, the focus lost listener must be uninstalled for the time the shell is open.
+ if (uiScoutFormField instanceof IPopupSupport) {
+ ((IPopupSupport) uiScoutFormField).addPopupEventListener(new IPopupSupportListener() {
+
+ @Override
+ public void handleEvent(int eventType) {
+ if (eventType == IPopupSupportListener.TYPE_OPENING) {
+ getFocusLostListener().suspend();
+ }
+ else if (eventType == IPopupSupportListener.TYPE_CLOSED) {
+ getFocusLostListener().resume();
+ }
+ }
+ });
+ }
+ return uiScoutFormField;
+ }
+
+ protected IRwtScoutComposite<? extends IFormField> createEditorCompositesPopup(Composite parent, IFormField formField, final ITableRow scoutRow, final IColumn<?> scoutCol) {
+ // uninstall focus lost listener as new shell is used for popup
+ getFocusLostListener().suspend();
+
+ // overwrite layout properties
+ GridData gd = formField.getGridData();
+ gd.h = 1;
+ gd.w = IFormField.FULL_WIDTH;
+ gd.weightY = 1;
+ gd.weightX = 1;
+ formField.setGridDataInternal(gd);
+
+ TableColumn swtCol = getRwtColumn(scoutCol);
+ final P_RwtCellEditor cellEditor = (P_RwtCellEditor) m_uiTableComposite.getUiTableViewer().getCellEditors()[getRwtColumnIndex(swtCol)];
+
+ int prefWidth = gd.widthInPixel;
+ int minWidth = swtCol.getWidth();
+ int prefHeight = gd.heightInPixel;
+ int minHeight = Math.max(105, m_uiTableComposite.getUiTableViewer().getTable().getItemHeight());
+
+ prefHeight = Math.max(prefHeight, minHeight);
+ prefWidth = Math.max(prefWidth, minWidth);
+
+ // create placeholder field to represent the cell editor
+ Composite cellEditorComposite = new Composite(parent, SWT.NONE);
+
+ // create popup dialog to wrap the form field
+ final RwtScoutFormFieldPopup formFieldDialog = new RwtScoutFormFieldPopup(cellEditorComposite);
+ formFieldDialog.setPrefHeight(prefHeight);
+ formFieldDialog.setPrefWidth(prefWidth);
+ formFieldDialog.setMinHeight(minHeight);
+ formFieldDialog.setMinWidth(minWidth);
+ formFieldDialog.createUiField(parent, formField, m_uiTableComposite.getUiEnvironment());
+
+ // register custom cell modifier to touch the field in order to write its value back to the model
+ final ICellModifier defaultCellModifier = m_uiTableComposite.getUiTableViewer().getCellModifier();
+ m_uiTableComposite.getUiTableViewer().setCellModifier(new P_RwtCellModifier() {
+
+ @Override
+ public void modify(Object element, String property, Object value) {
+ formFieldDialog.touch();
+ super.modify(element, property, value);
+ }
+ });
+ // register custom focus delegate to request the field's focus
+ final IFocusDelegate defaultFocusDelegate = cellEditor.getFocusDelegate();
+ cellEditor.setFocusDelegate(new IFocusDelegate() {
+
+ @Override
+ public void doSetFocus() {
+ IRwtScoutForm rwtScoutForm = formFieldDialog.getInnerRwtScoutForm();
+ if (rwtScoutForm != null) {
+ requestFocus(rwtScoutForm.getUiContainer());
+ }
+ }
+ });
+
+ // listener to receive events about the popup's state
+ final IFormFieldPopupEventListener popupListener = new IFormFieldPopupEventListener() {
+
+ @Override
+ public void handleEvent(FormFieldPopupEvent event) {
+ if ((event.getType() & FormFieldPopupEvent.TYPE_OK) > 0) {
+ // save cell editor
+ cellEditor.stopCellEditing();
+ }
+ else if ((event.getType() & FormFieldPopupEvent.TYPE_CANCEL) > 0) {
+ // cancel cell editor
+ cellEditor.cancelCellEditing();
+ }
+
+ // traversal control
+ if ((event.getType() & FormFieldPopupEvent.TYPE_FOCUS_BACK) > 0) {
+ enqueueEditNextTableCell(scoutRow, scoutCol, false);
+ }
+ else if ((event.getType() & FormFieldPopupEvent.TYPE_FOCUS_NEXT) > 0) {
+ enqueueEditNextTableCell(scoutRow, scoutCol, true);
+ }
+ }
+ };
+ formFieldDialog.addEventListener(popupListener);
+
+ // register listener to intercept the cell editor's events in order to properly close the popup.
+ // This is crucial if the editor is deactivated programmatically or if another cell is activated.
+ // In contrast to SWT, in RWT the next cell is activated prior to receiving the shell closed event.
+ cellEditor.addDeactivateListener(new IDeactivateListener() {
+
+ @Override
+ public void canceled(ColumnViewerEditorDeactivationEvent event) {
+ restoreDefault();
+ closePopup(FormFieldPopupEvent.TYPE_OK);
+ }
+
+ @Override
+ public void saved(ColumnViewerEditorDeactivationEvent event) {
+ restoreDefault();
+ closePopup(FormFieldPopupEvent.TYPE_CANCEL);
+ }
+
+ private void restoreDefault() {
+ // restore default focus delegate
+ cellEditor.setFocusDelegate(defaultFocusDelegate);
+ // restore default cell modifier
+ m_uiTableComposite.getUiTableViewer().setCellModifier(defaultCellModifier);
+ // remove this listener on the cell editor
+ cellEditor.removeDeactivateListener(this);
+ }
+
+ private void closePopup(int popupEvent) {
+ if (formFieldDialog.isClosed()) {
+ return;
+ }
+ // remove popup listener to not receive events on the dialog's state because the cell editor is already closing
+ formFieldDialog.removeEventListener(popupListener);
+ // close the popup
+ formFieldDialog.closePopup(popupEvent);
+ }
+ });
+
+ return formFieldDialog;
+ }
+
+ private TableColumn getRwtColumn(IColumn<?> scoutCol) {
+ for (TableColumn swtCol : m_uiTableComposite.getUiTableViewer().getTable().getColumns()) {
+ IColumn<?> candidate = (IColumn<?>) swtCol.getData(IRwtScoutTable.KEY_SCOUT_COLUMN);
+ if (candidate != null && CompareUtility.equals(candidate.getColumnId(), scoutCol.getColumnId())) {
+ return swtCol;
+ }
+ }
+ return null;
+ }
+
+ private int getRwtColumnIndex(TableColumn swtCol) {
+ Table table = m_uiTableComposite.getUiTableViewer().getTable();
+ for (int i = 0; i < table.getColumnCount(); i++) {
+ if (table.getColumn(i) == swtCol) {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+ protected void decorateEditorComposite(IRwtScoutComposite<? extends IFormField> editorComposite, final ITableRow scoutRow, final IColumn<?> scoutCol) {
+ }
+
+ protected void saveEditorFromUi() {
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ m_uiTableComposite.getScoutObject().getUIFacade().completeCellEditFromUI();
+ }
+ };
+ m_uiTableComposite.getUiEnvironment().invokeScoutLater(t, 0);
+ }
+
+ protected void cancelEditorFromUi() {
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ m_uiTableComposite.getScoutObject().getUIFacade().cancelCellEditFromUI();
+ }
+ };
+ m_uiTableComposite.getUiEnvironment().invokeScoutLater(t, 0);
+ }
+
+ protected void enqueueEditNextTableCell(final ITableRow row, final IColumn<?> col, final boolean forward) {
+ if (row == null || col == null) {
+ return;
+ }
+ m_uiTableComposite.getUiEnvironment().invokeScoutLater(new Runnable() {
+ @Override
+ public void run() {
+ if (m_uiTableComposite.getUiEnvironment() == null) {
+ return;
+ }
+ ITable table = m_uiTableComposite.getScoutObject();
+ TableUtility.editNextTableCell(table, row, col, forward, new TableUtility.ITableCellEditorFilter() {
+ @Override
+ public boolean accept(ITableRow rowx, IColumn<?> colx) {
+ return !(colx instanceof IBooleanColumn);
+ }
+ });
+ }
+ }, 0L);
+ }
+
+ protected IColumn<?> getScoutColumn(String property) {
+ if (property != null && property.matches("[0-9]+")) {
+ int colIndex = Integer.parseInt(property);
+ return m_uiTableComposite.getScoutObject().getColumnSet().getColumn(colIndex);
+ }
+ return null;
+ }
+
+ public P_FocusLostListener getFocusLostListener() {
+ return m_focusLostListener;
+ }
+
+ private boolean requestFocus(Control control) {
+ if (control == null || control.isDisposed()) {
+ return false;
+ }
+ if (control.setFocus()) {
+ return true;
+ }
+
+ if (control instanceof Composite) {
+ for (Control child : ((Composite) control).getChildren()) {
+ if (requestFocus(child)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ private class P_RwtCellModifier implements ICellModifier {
+
+ @Override
+ public void modify(Object element, String property, Object value) {
+ saveEditorFromUi();
+ }
+
+ @Override
+ public Object getValue(Object element, String property) {
+ return DUMMY_VALUE;
+ }
+
+ @Override
+ public boolean canModify(Object element, String property) {
+ final ITable table = m_uiTableComposite.getScoutObject();
+ final ITableRow row = (ITableRow) element;
+ final IColumn<?> column = getScoutColumn(property);
+ //make a safe model call
+ final AtomicBoolean b = new AtomicBoolean();
+ synchronized (b) {
+ Runnable r = new Runnable() {
+ @Override
+ public void run() {
+ // try first
+ synchronized (b) {
+ try {
+ if (table != null && row != null && column != null) {
+ if (column instanceof IBooleanColumn) {
+ b.set(false);
+ }
+ else {
+ b.set(table.isCellEditable(row, column));
+ }
+ }
+ }
+ catch (Throwable ex) {
+ //fast access: ignore
+ }
+ b.notifyAll();
+ }
+ }
+ };
+ m_uiTableComposite.getUiEnvironment().invokeScoutLater(r, 2345);
+ try {
+ b.wait(2345);
+ }
+ catch (InterruptedException e) {
+ //nop
+ }
+ }
+ return b.get();
+ }
+ }
+
+ private class P_RwtCellEditor extends CellEditor {
+ private static final long serialVersionUID = 1L;
+
+ private Composite m_container;
+ private Object m_value;
+ private ITableRow m_editScoutRow;
+ private IColumn<?> m_editScoutCol;
+ private IFocusDelegate m_focusDelegate;
+ private ConcurrentHashMap<IDeactivateListener, Object> m_deactivateListeners;
+
+ protected P_RwtCellEditor(Table parent) {
+ super(parent);
+ m_focusDelegate = new P_FocusDelegate();
+ m_deactivateListeners = new ConcurrentHashMap<IDeactivateListener, Object>();
+ }
+
+ @Override
+ protected Control createControl(Composite/*Table*/parent) {
+ m_container = new Composite(parent, SWT.NONE) {
+ private static final long serialVersionUID = 1L;
+
+ /*
+ * disable inner components preferred sizes
+ */
+ @Override
+ public Point computeSize(int wHint, int hHint, boolean changed) {
+ return new Point(wHint, hHint);
+ }
+ };
+
+ //The table does only dispose table items and columns so we have to manually dispose our container.
+ parent.addDisposeListener(new DisposeListener() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void widgetDisposed(DisposeEvent event) {
+ m_container.dispose();
+ }
+
+ });
+
+ m_container.setLayout(new FillLayout());
+ m_uiTableComposite.getUiEnvironment().addKeyStroke(m_container, new RwtKeyStroke(SWT.ESC) {
+ @Override
+ public void handleUiAction(Event e) {
+ e.doit = false;
+ fireCancelEditor();
+ }
+ }, false);
+ m_uiTableComposite.getUiEnvironment().addKeyStroke(m_container, new RwtKeyStroke(SWT.CR) {
+ @Override
+ public void handleUiAction(Event e) {
+ e.doit = false;
+ fireApplyEditorValue();
+ deactivate();
+ }
+ }, false);
+
+ m_container.addDisposeListener(new DisposeListener() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void widgetDisposed(DisposeEvent event) {
+ m_uiTableComposite.getUiEnvironment().removeKeyStrokes(m_container);
+ }
+
+ });
+
+ return m_container;
+ }
+
+ @Override
+ protected void doSetFocus() {
+ if (m_focusDelegate != null) {
+ m_focusDelegate.doSetFocus();
+ }
+ }
+
+ @Override
+ protected Object doGetValue() {
+ return m_value;
+ }
+
+ @Override
+ protected void doSetValue(Object value) {
+ m_value = value;
+ }
+
+ @Override
+ public void activate(ColumnViewerEditorActivationEvent e) {
+ getFocusLostListener().install();
+ getFocusLostListener().suspend(); // is only resumed if editor gets the focus in @{link P_RwtCellEditor#doSetFocus()}. Otherwise, a focus lost event might be consumed and the editor closed
+
+ m_editScoutRow = null;
+ m_editScoutCol = null;
+ if (e.getSource() instanceof ViewerCell) {
+ ViewerCell cell = (ViewerCell) e.getSource();
+ TableViewer viewer = m_uiTableComposite.getUiTableViewer();
+ TableColumn rwtCol = viewer.getTable().getColumn(cell.getColumnIndex());
+ IColumn<?> scoutCol = (IColumn<?>) rwtCol.getData(IRwtScoutTableForPatch.KEY_SCOUT_COLUMN);
+ ITableRow scoutRow = (ITableRow) cell.getElement();
+ //no edit on boolean column when mouse was clicked
+ if (e.sourceEvent instanceof MouseEvent) {
+ if (scoutCol instanceof IBooleanColumn) {
+ return;
+ }
+ }
+ if (scoutRow != null && scoutCol != null) {
+ m_editScoutRow = scoutRow;
+ m_editScoutCol = scoutCol;
+ @SuppressWarnings("unused")
+ Control control = getEditorControl(m_container, scoutRow, scoutCol);
+ }
+ m_container.layout(true, true);
+ m_container.setVisible(true);
+ }
+ }
+
+ @Override
+ protected void deactivate(ColumnViewerEditorDeactivationEvent e) {
+ getFocusLostListener().uninstall();
+
+ // notify cell editor close listeners
+ for (IDeactivateListener listener : m_deactivateListeners.keySet()) {
+ if (e.eventType == ColumnViewerEditorDeactivationEvent.EDITOR_SAVED) {
+ listener.saved(e);
+ }
+ else {
+ listener.canceled(e);
+ }
+ }
+
+ m_editScoutRow = null;
+ m_editScoutCol = null;
+ for (Control c : m_container.getChildren()) {
+ c.dispose();
+ }
+ super.deactivate(e);
+ if (e.eventType == ColumnViewerEditorDeactivationEvent.EDITOR_CANCELED) {
+ cancelEditorFromUi();
+ }
+ }
+
+ public void stopCellEditing() {
+ fireApplyEditorValue();
+ deactivate();
+ }
+
+ public void cancelCellEditing() {
+ fireCancelEditor();
+ deactivate();
+ }
+
+ public IFocusDelegate getFocusDelegate() {
+ return m_focusDelegate;
+ }
+
+ public void setFocusDelegate(IFocusDelegate focusDelegate) {
+ m_focusDelegate = focusDelegate;
+ }
+
+ public void addDeactivateListener(IDeactivateListener listener) {
+ m_deactivateListeners.put(listener, new Object());
+ }
+
+ public void removeDeactivateListener(IDeactivateListener listener) {
+ m_deactivateListeners.remove(listener);
+ }
+
+ private class P_FocusDelegate implements IFocusDelegate {
+
+ @Override
+ public void doSetFocus() {
+ requestFocus(m_container);
+ Control focusControl = m_container.getDisplay().getFocusControl();
+ if (focusControl != null && RwtUtility.isAncestorOf(m_container, focusControl)) {
+ focusControl.addTraverseListener(new TraverseListener() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void keyTraversed(TraverseEvent e) {
+ switch (e.detail) {
+ case SWT.TRAVERSE_ESCAPE:
+ case SWT.TRAVERSE_RETURN: {
+ e.doit = false;
+ break;
+ }
+ case SWT.TRAVERSE_TAB_NEXT: {
+ e.doit = false;
+ ITableRow scoutRow = m_editScoutRow;
+ IColumn<?> scoutCol = m_editScoutCol;
+ fireApplyEditorValue();
+ deactivate();
+ enqueueEditNextTableCell(scoutRow, scoutCol, true);
+ break;
+ }
+ case SWT.TRAVERSE_TAB_PREVIOUS: {
+ e.doit = false;
+ ITableRow scoutRow = m_editScoutRow;
+ IColumn<?> scoutCol = m_editScoutCol;
+ fireApplyEditorValue();
+ deactivate();
+ enqueueEditNextTableCell(scoutRow, scoutCol, false);
+ break;
+ }
+ }
+ }
+ });
+ }
+ getFocusLostListener().resume(); // because listener was suspended after activation
+ }
+ }
+ }
+
+ /**
+ * Hysteresis listener that commits the cell editor when the table has first received focus and then lost it. That is
+ * because cell editors in SWT are not closed automatically if the table looses the focus.
+ */
+ private class P_FocusLostListener implements Listener {
+ private static final long serialVersionUID = 1L;
+
+ private final Lock m_suspendLock = new ReentrantLock();
+ private AtomicInteger m_suspendCounter = new AtomicInteger();
+
+ /**
+ * Uninstalls this listener on the table widget
+ */
+ public void uninstall() {
+ m_uiTableComposite.getUiEnvironment().getDisplay().removeFilter(SWT.FocusIn, this);
+ m_suspendCounter.set(0);
+ }
+
+ /**
+ * Installs this listener on the table widget
+ */
+ public void install() {
+ m_uiTableComposite.getUiEnvironment().getDisplay().addFilter(SWT.FocusIn, this);
+ m_suspendCounter.set(0);
+ }
+
+ /**
+ * <p>
+ * To resume listening for focus lost events.
+ * </p>
+ * <p>
+ * Please note that this request is put onto a stack meaning that you have to call
+ * {@link P_FocusLostListener#resume()} as many times as you called {@link P_FocusLostListener#suspend()} to resume
+ * listening for focus lost events.
+ * </p>
+ * <p>
+ * <small>Counterpart of {@link P_FocusLostListener#suspend()}.</small>
+ * </p>
+ */
+ public void resume() {
+ m_suspendLock.lock();
+ try {
+ if (m_suspendCounter.decrementAndGet() < 0) { // negative values are not allowed
+ m_suspendCounter.set(0);
+ }
+ }
+ finally {
+ m_suspendLock.unlock();
+ }
+ }
+
+ /**
+ * <p>
+ * To suspend listening for focus lost events.
+ * </p>
+ * <p>
+ * Please note that this request is put onto a stack meaning that you have to call
+ * {@link P_FocusLostListener#resume()} as many times as you called {@link P_FocusLostListener#suspend()} to resume
+ * listening for focus lost events.
+ * </p>
+ * <p>
+ * <small>Counterpart of {@link P_FocusLostListener#resume()}.</small>
+ * </p>
+ */
+ public void suspend() {
+ m_suspendLock.lock();
+ try {
+ m_suspendCounter.incrementAndGet();
+ }
+ finally {
+ m_suspendLock.unlock();
+ }
+ }
+
+ public boolean isSuspended() {
+ return m_suspendCounter.get() > 0;
+ }
+
+ @Override
+ public void handleEvent(Event event) {
+ if (isSuspended()) {
+ return;
+ }
+
+ Widget w = event.widget;
+ if (w == null || !(w instanceof Control) || w.isDisposed()) {
+ return;
+ }
+ TableViewer viewer = m_uiTableComposite.getUiTableViewer();
+ if (!viewer.isCellEditorActive()) {
+ return;
+ }
+
+ Control candidate = (Control) w;
+ Control tableControl = m_uiTableComposite.getUiTableViewer().getControl();
+
+ if (!RwtUtility.isAncestorOf(tableControl, candidate)) {
+ for (CellEditor editor : viewer.getCellEditors()) {
+ if (editor != null && editor.isActivated() && editor instanceof P_RwtCellEditor) {
+ ((P_RwtCellEditor) editor).stopCellEditing();
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Delegate to process focus events on cell editor
+ */
+ private interface IFocusDelegate {
+ public void doSetFocus();
+ }
+
+ /**
+ * Listener to get notified about deactivation event
+ */
+ private interface IDeactivateListener {
+ public void canceled(ColumnViewerEditorDeactivationEvent event);
+
+ public void saved(ColumnViewerEditorDeactivationEvent event);
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/internal/SnippetForTableEditor.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/internal/SnippetForTableEditor.java
index 08becd6ace..411c623ae6 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/internal/SnippetForTableEditor.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/internal/SnippetForTableEditor.java
@@ -1,227 +1,227 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.basic.table.internal;
-
-/*
- * TableEditor example snippet: edit a cell in a table (in place, fancy)
- *
- * For a list of all SWT example snippets see
- * http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/platform-swt-home/dev.html#snippets
- */
-
-import java.util.Vector;
-
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.ColumnViewerEditorActivationEvent;
-import org.eclipse.jface.viewers.ColumnViewerEditorDeactivationEvent;
-import org.eclipse.jface.viewers.ICellModifier;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerCell;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.swt.widgets.Text;
-
-public class SnippetForTableEditor {
- final String[][] database = new String[][]{new String[]{"A1", "B1", "C1"}, new String[]{"A2", "B2", "C2"}, new String[]{"A3", "B3", "C3"}};
- final TableViewer viewer;
-
- public static void main(String[] args) {
- new SnippetForTableEditor();
- }
-
- SnippetForTableEditor() {
- Display display = new Display();
- Shell shell = new Shell(display);
- shell.setLayout(new FillLayout());
- final Table table = new Table(shell, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
- table.setLinesVisible(true);
- table.setHeaderVisible(true);
- for (int i = 0; i < 3; i++) {
- TableColumn column = new TableColumn(table, SWT.NONE);
- column.setWidth(100);
- column.setMoveable(true);
- }
- //
- viewer = new TableViewer(table);
- ContentProvider content = new ContentProvider();
- viewer.setContentProvider(content);
- viewer.setLabelProvider(content);
- //editors
- viewer.setColumnProperties(new String[]{"A", "B", "C"});
- CellEditor cellEditor = new AdHocCellEditor(viewer.getTable());
- viewer.setCellEditors(new CellEditor[]{cellEditor, null, cellEditor});
- viewer.setCellModifier(new CellModifier());
- viewer.setInput(System.currentTimeMillis());//force changed
-
- shell.pack();
- shell.open();
- while (!shell.isDisposed()) {
- if (!display.readAndDispatch()) {
- display.sleep();
- }
- }
- display.dispose();
- }
-
- class CellModifier implements ICellModifier {
- @Override
- public void modify(Object element, String property, Object value) {
- //Note: element is a TableItem, NOT the row value
- if (element instanceof TableItem) {
- TableItem item = (TableItem) element;
- String[] row = (String[]) item.getData();
- System.out.println("Modified " + property + " " + value);
- if ("A".equals(property)) {
- row[0] = (String) value;
- }
- else if ("B".equals(property)) {
- row[1] = (String) value;
- }
- else if ("C".equals(property)) {
- row[2] = (String) value;
- }
- viewer.setInput(System.currentTimeMillis());
- }
- }
-
- @Override
- public Object getValue(Object element, String property) {
- //Note: element is the row value, NOT a TableItem
- if ("A".equals(property)) {
- return ((String[]) element)[0];
- }
- else if ("B".equals(property)) {
- return ((String[]) element)[1];
- }
- else if ("C".equals(property)) {
- return ((String[]) element)[2];
- }
- return null;
- }
-
- @Override
- public boolean canModify(Object element, String property) {
- return true;
- }
- }
-
- class ContentProvider implements ITableLabelProvider, IStructuredContentProvider {
- private static final long serialVersionUID = 1L;
-
- private final Vector<ILabelProviderListener> listeners = new Vector<ILabelProviderListener>();
-
- @Override
- public Object[] getElements(Object inputElement) {
- return database;
- }
-
- @Override
- public void dispose() {
- }
-
- @Override
- public void inputChanged(Viewer viewer2, Object oldInput, Object newInput) {
- }
-
- @Override
- public Image getColumnImage(Object element, int columnIndex) {
- return null;
- }
-
- @Override
- public String getColumnText(Object element, int columnIndex) {
- return ((String[]) element)[columnIndex];
- }
-
- @Override
- public void addListener(ILabelProviderListener listener) {
- listeners.add(listener);
- }
-
- @Override
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- @Override
- public void removeListener(ILabelProviderListener listener) {
- listeners.remove(listener);
- }
- }
-
- class AdHocCellEditor extends CellEditor {
- private static final long serialVersionUID = 1L;
-
- private Composite m_container;
-
- public AdHocCellEditor(Composite parent) {
- super(parent);
- }
-
- @Override
- public void activate(ColumnViewerEditorActivationEvent e) {
- if (e.getSource() instanceof ViewerCell) {
- ViewerCell cell = (ViewerCell) e.getSource();
- System.out.println("row: " + cell.getElement() + ", col: " + cell.getColumnIndex());
- Text text = new Text(m_container, SWT.BORDER);
- text.setText("abc");
- m_container.layout(true, true);
- m_container.setVisible(true);
- }
- }
-
- @Override
- protected void deactivate(ColumnViewerEditorDeactivationEvent event) {
- for (Control c : m_container.getChildren()) {
- c.dispose();
- }
- super.deactivate(event);
- if (event.eventType == ColumnViewerEditorDeactivationEvent.EDITOR_CANCELED) {
- System.out.println("canceled");//XXX
- }
- }
-
- @Override
- protected Control createControl(Composite parent) {
- m_container = new Composite(parent, SWT.NONE);
- m_container.setLayout(new FillLayout());
- return m_container;
- }
-
- @Override
- protected Object doGetValue() {
- return "ABC";
- }
-
- @Override
- protected void doSetFocus() {
- m_container.setFocus();
- }
-
- @Override
- protected void doSetValue(Object value) {
- }
-
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.basic.table.internal;
+
+/*
+ * TableEditor example snippet: edit a cell in a table (in place, fancy)
+ *
+ * For a list of all SWT example snippets see
+ * http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/platform-swt-home/dev.html#snippets
+ */
+
+import java.util.Vector;
+
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.ColumnViewerEditorActivationEvent;
+import org.eclipse.jface.viewers.ColumnViewerEditorDeactivationEvent;
+import org.eclipse.jface.viewers.ICellModifier;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerCell;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.Text;
+
+public class SnippetForTableEditor {
+ final String[][] database = new String[][]{new String[]{"A1", "B1", "C1"}, new String[]{"A2", "B2", "C2"}, new String[]{"A3", "B3", "C3"}};
+ final TableViewer viewer;
+
+ public static void main(String[] args) {
+ new SnippetForTableEditor();
+ }
+
+ SnippetForTableEditor() {
+ Display display = new Display();
+ Shell shell = new Shell(display);
+ shell.setLayout(new FillLayout());
+ final Table table = new Table(shell, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
+ table.setLinesVisible(true);
+ table.setHeaderVisible(true);
+ for (int i = 0; i < 3; i++) {
+ TableColumn column = new TableColumn(table, SWT.NONE);
+ column.setWidth(100);
+ column.setMoveable(true);
+ }
+ //
+ viewer = new TableViewer(table);
+ ContentProvider content = new ContentProvider();
+ viewer.setContentProvider(content);
+ viewer.setLabelProvider(content);
+ //editors
+ viewer.setColumnProperties(new String[]{"A", "B", "C"});
+ CellEditor cellEditor = new AdHocCellEditor(viewer.getTable());
+ viewer.setCellEditors(new CellEditor[]{cellEditor, null, cellEditor});
+ viewer.setCellModifier(new CellModifier());
+ viewer.setInput(System.currentTimeMillis());//force changed
+
+ shell.pack();
+ shell.open();
+ while (!shell.isDisposed()) {
+ if (!display.readAndDispatch()) {
+ display.sleep();
+ }
+ }
+ display.dispose();
+ }
+
+ class CellModifier implements ICellModifier {
+ @Override
+ public void modify(Object element, String property, Object value) {
+ //Note: element is a TableItem, NOT the row value
+ if (element instanceof TableItem) {
+ TableItem item = (TableItem) element;
+ String[] row = (String[]) item.getData();
+ System.out.println("Modified " + property + " " + value);
+ if ("A".equals(property)) {
+ row[0] = (String) value;
+ }
+ else if ("B".equals(property)) {
+ row[1] = (String) value;
+ }
+ else if ("C".equals(property)) {
+ row[2] = (String) value;
+ }
+ viewer.setInput(System.currentTimeMillis());
+ }
+ }
+
+ @Override
+ public Object getValue(Object element, String property) {
+ //Note: element is the row value, NOT a TableItem
+ if ("A".equals(property)) {
+ return ((String[]) element)[0];
+ }
+ else if ("B".equals(property)) {
+ return ((String[]) element)[1];
+ }
+ else if ("C".equals(property)) {
+ return ((String[]) element)[2];
+ }
+ return null;
+ }
+
+ @Override
+ public boolean canModify(Object element, String property) {
+ return true;
+ }
+ }
+
+ class ContentProvider implements ITableLabelProvider, IStructuredContentProvider {
+ private static final long serialVersionUID = 1L;
+
+ private final Vector<ILabelProviderListener> listeners = new Vector<ILabelProviderListener>();
+
+ @Override
+ public Object[] getElements(Object inputElement) {
+ return database;
+ }
+
+ @Override
+ public void dispose() {
+ }
+
+ @Override
+ public void inputChanged(Viewer viewer2, Object oldInput, Object newInput) {
+ }
+
+ @Override
+ public Image getColumnImage(Object element, int columnIndex) {
+ return null;
+ }
+
+ @Override
+ public String getColumnText(Object element, int columnIndex) {
+ return ((String[]) element)[columnIndex];
+ }
+
+ @Override
+ public void addListener(ILabelProviderListener listener) {
+ listeners.add(listener);
+ }
+
+ @Override
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+
+ @Override
+ public void removeListener(ILabelProviderListener listener) {
+ listeners.remove(listener);
+ }
+ }
+
+ class AdHocCellEditor extends CellEditor {
+ private static final long serialVersionUID = 1L;
+
+ private Composite m_container;
+
+ public AdHocCellEditor(Composite parent) {
+ super(parent);
+ }
+
+ @Override
+ public void activate(ColumnViewerEditorActivationEvent e) {
+ if (e.getSource() instanceof ViewerCell) {
+ ViewerCell cell = (ViewerCell) e.getSource();
+ System.out.println("row: " + cell.getElement() + ", col: " + cell.getColumnIndex());
+ Text text = new Text(m_container, SWT.BORDER);
+ text.setText("abc");
+ m_container.layout(true, true);
+ m_container.setVisible(true);
+ }
+ }
+
+ @Override
+ protected void deactivate(ColumnViewerEditorDeactivationEvent event) {
+ for (Control c : m_container.getChildren()) {
+ c.dispose();
+ }
+ super.deactivate(event);
+ if (event.eventType == ColumnViewerEditorDeactivationEvent.EDITOR_CANCELED) {
+ System.out.println("canceled");//XXX
+ }
+ }
+
+ @Override
+ protected Control createControl(Composite parent) {
+ m_container = new Composite(parent, SWT.NONE);
+ m_container.setLayout(new FillLayout());
+ return m_container;
+ }
+
+ @Override
+ protected Object doGetValue() {
+ return "ABC";
+ }
+
+ @Override
+ protected void doSetFocus() {
+ m_container.setFocus();
+ }
+
+ @Override
+ protected void doSetValue(Object value) {
+ }
+
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/internal/SnippetForTableHeaderMenu.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/internal/SnippetForTableHeaderMenu.java
index 92492a87eb..57f309a103 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/internal/SnippetForTableHeaderMenu.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/table/internal/SnippetForTableHeaderMenu.java
@@ -1,154 +1,154 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.basic.table.internal;
-
-/*
- * Table example snippet: show a menu in a table header
- *
- * For a list of all SWT example snippets see
- * http://www.eclipse.org/swt/snippets/
- *
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.basic.table.internal;
+
+/*
+ * Table example snippet: show a menu in a table header
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ *
* @since 3.7.0 June 2011
- */
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.TableItem;
-
-public final class SnippetForTableHeaderMenu {
- private SnippetForTableHeaderMenu() {
- }
-
- static String[][] files = {
- {"ver.txt", "1 KB", "Text Document", "28/09/2005 9:57 AM", "admin",},
- {"Thumbs.db", "76 KB", "Data Base file", "13/03/2006 3:56 PM", "john",},
- {"daddy.bmp", "148 MB", "Bitmap", "27/10/2008 1:34 PM", "bill",},
- {"io.sys", "48 KB", "File System", "16/12/2008 6:14 AM", "admin",},
- {"Programs", "0 KB", "File Folder", "04/02/2009 12:18 PM", "anne",},
- {"test.rnd", "55 MB", "RND File", "19/02/2009 5:49 PM", "john",},
- {"arial.ttf", "94 KB", "True Type Font", "25/08/2008 1:25 PM", "john",},
- };
-
- static void createMenuItem(Menu parent, final TableColumn column) {
- final MenuItem itemName = new MenuItem(parent, SWT.CHECK);
- itemName.setText(column.getText());
- itemName.setSelection(column.getResizable());
- itemName.addListener(SWT.Selection, new Listener() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void handleEvent(Event event) {
- if (itemName.getSelection()) {
- column.setWidth(150);
- column.setResizable(true);
- }
- else {
- column.setWidth(0);
- column.setResizable(false);
- }
- }
- });
- }
-
- public static void main(String[] args) {
- final Display display = new Display();
- Shell shell = new Shell(display);
- shell.setLayout(new FillLayout());
-
- final Table table = new Table(shell, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
- table.setHeaderVisible(true);
- final Menu headerMenu = new Menu(shell, SWT.POP_UP);
- final TableColumn columnName = new TableColumn(table, SWT.NONE);
- columnName.setText("Name");
- columnName.setWidth(150);
- createMenuItem(headerMenu, columnName);
- final TableColumn columnSize = new TableColumn(table, SWT.NONE);
- columnSize.setText("Size");
- columnSize.setWidth(150);
- createMenuItem(headerMenu, columnSize);
- final TableColumn columnType = new TableColumn(table, SWT.NONE);
- columnType.setText("Type");
- columnType.setWidth(150);
- createMenuItem(headerMenu, columnType);
- final TableColumn columnDate = new TableColumn(table, SWT.NONE);
- columnDate.setText("Date");
- columnDate.setWidth(150);
- createMenuItem(headerMenu, columnDate);
- final TableColumn columnOwner = new TableColumn(table, SWT.NONE);
- columnOwner.setText("Owner");
- columnOwner.setWidth(0);
- columnOwner.setResizable(false);
- createMenuItem(headerMenu, columnOwner);
-
- for (String[] file : files) {
- TableItem item = new TableItem(table, SWT.NONE);
- item.setText(file);
- }
-
- final Menu tableMenu = new Menu(shell, SWT.POP_UP);
- MenuItem item = new MenuItem(tableMenu, SWT.PUSH);
- item.setText("Open");
- item = new MenuItem(tableMenu, SWT.PUSH);
- item.setText("Open With");
- new MenuItem(tableMenu, SWT.SEPARATOR);
- item = new MenuItem(tableMenu, SWT.PUSH);
- item.setText("Cut");
- item = new MenuItem(tableMenu, SWT.PUSH);
- item.setText("Copy");
- item = new MenuItem(tableMenu, SWT.PUSH);
- item.setText("Paste");
- new MenuItem(tableMenu, SWT.SEPARATOR);
- item = new MenuItem(tableMenu, SWT.PUSH);
- item.setText("Delete");
-
- table.addListener(SWT.MenuDetect, new Listener() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void handleEvent(Event event) {
- System.out.println("" + event.x + "," + event.y);
- Point pt = display.map(null, table, new Point(event.x, event.y));
- Rectangle clientArea = table.getClientArea();
- boolean header = clientArea.y <= pt.y && pt.y < clientArea.y + table.getHeaderHeight();
- table.setMenu(header ? headerMenu : tableMenu);
- }
- });
-
- /* IMPORTANT: Dispose the menus (only the current menu, set with setMenu(), will be automatically disposed) */
- table.addListener(SWT.Dispose, new Listener() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void handleEvent(Event event) {
- headerMenu.dispose();
- tableMenu.dispose();
- }
- });
-
- shell.open();
- while (!shell.isDisposed()) {
- if (!display.readAndDispatch()) {
- display.sleep();
- }
- }
- display.dispose();
- }
-}
+ */
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+
+public final class SnippetForTableHeaderMenu {
+ private SnippetForTableHeaderMenu() {
+ }
+
+ static String[][] files = {
+ {"ver.txt", "1 KB", "Text Document", "28/09/2005 9:57 AM", "admin",},
+ {"Thumbs.db", "76 KB", "Data Base file", "13/03/2006 3:56 PM", "john",},
+ {"daddy.bmp", "148 MB", "Bitmap", "27/10/2008 1:34 PM", "bill",},
+ {"io.sys", "48 KB", "File System", "16/12/2008 6:14 AM", "admin",},
+ {"Programs", "0 KB", "File Folder", "04/02/2009 12:18 PM", "anne",},
+ {"test.rnd", "55 MB", "RND File", "19/02/2009 5:49 PM", "john",},
+ {"arial.ttf", "94 KB", "True Type Font", "25/08/2008 1:25 PM", "john",},
+ };
+
+ static void createMenuItem(Menu parent, final TableColumn column) {
+ final MenuItem itemName = new MenuItem(parent, SWT.CHECK);
+ itemName.setText(column.getText());
+ itemName.setSelection(column.getResizable());
+ itemName.addListener(SWT.Selection, new Listener() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void handleEvent(Event event) {
+ if (itemName.getSelection()) {
+ column.setWidth(150);
+ column.setResizable(true);
+ }
+ else {
+ column.setWidth(0);
+ column.setResizable(false);
+ }
+ }
+ });
+ }
+
+ public static void main(String[] args) {
+ final Display display = new Display();
+ Shell shell = new Shell(display);
+ shell.setLayout(new FillLayout());
+
+ final Table table = new Table(shell, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
+ table.setHeaderVisible(true);
+ final Menu headerMenu = new Menu(shell, SWT.POP_UP);
+ final TableColumn columnName = new TableColumn(table, SWT.NONE);
+ columnName.setText("Name");
+ columnName.setWidth(150);
+ createMenuItem(headerMenu, columnName);
+ final TableColumn columnSize = new TableColumn(table, SWT.NONE);
+ columnSize.setText("Size");
+ columnSize.setWidth(150);
+ createMenuItem(headerMenu, columnSize);
+ final TableColumn columnType = new TableColumn(table, SWT.NONE);
+ columnType.setText("Type");
+ columnType.setWidth(150);
+ createMenuItem(headerMenu, columnType);
+ final TableColumn columnDate = new TableColumn(table, SWT.NONE);
+ columnDate.setText("Date");
+ columnDate.setWidth(150);
+ createMenuItem(headerMenu, columnDate);
+ final TableColumn columnOwner = new TableColumn(table, SWT.NONE);
+ columnOwner.setText("Owner");
+ columnOwner.setWidth(0);
+ columnOwner.setResizable(false);
+ createMenuItem(headerMenu, columnOwner);
+
+ for (String[] file : files) {
+ TableItem item = new TableItem(table, SWT.NONE);
+ item.setText(file);
+ }
+
+ final Menu tableMenu = new Menu(shell, SWT.POP_UP);
+ MenuItem item = new MenuItem(tableMenu, SWT.PUSH);
+ item.setText("Open");
+ item = new MenuItem(tableMenu, SWT.PUSH);
+ item.setText("Open With");
+ new MenuItem(tableMenu, SWT.SEPARATOR);
+ item = new MenuItem(tableMenu, SWT.PUSH);
+ item.setText("Cut");
+ item = new MenuItem(tableMenu, SWT.PUSH);
+ item.setText("Copy");
+ item = new MenuItem(tableMenu, SWT.PUSH);
+ item.setText("Paste");
+ new MenuItem(tableMenu, SWT.SEPARATOR);
+ item = new MenuItem(tableMenu, SWT.PUSH);
+ item.setText("Delete");
+
+ table.addListener(SWT.MenuDetect, new Listener() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void handleEvent(Event event) {
+ System.out.println("" + event.x + "," + event.y);
+ Point pt = display.map(null, table, new Point(event.x, event.y));
+ Rectangle clientArea = table.getClientArea();
+ boolean header = clientArea.y <= pt.y && pt.y < clientArea.y + table.getHeaderHeight();
+ table.setMenu(header ? headerMenu : tableMenu);
+ }
+ });
+
+ /* IMPORTANT: Dispose the menus (only the current menu, set with setMenu(), will be automatically disposed) */
+ table.addListener(SWT.Dispose, new Listener() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void handleEvent(Event event) {
+ headerMenu.dispose();
+ tableMenu.dispose();
+ }
+ });
+
+ shell.open();
+ while (!shell.isDisposed()) {
+ if (!display.readAndDispatch()) {
+ display.sleep();
+ }
+ }
+ display.dispose();
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/tree/IRwtScoutTree.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/tree/IRwtScoutTree.java
index b20c559f64..6a22d6564c 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/tree/IRwtScoutTree.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/tree/IRwtScoutTree.java
@@ -1,26 +1,26 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.basic.tree;
-
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITree;
-import org.eclipse.scout.rt.ui.rap.basic.IRwtScoutComposite;
-import org.eclipse.swt.widgets.Tree;
-
-public interface IRwtScoutTree extends IRwtScoutComposite<ITree> {
-
- void setEnabledFromScout(boolean enabled);
-
- @Override
- Tree getUiField();
-
- TreeViewer getUiTreeViewer();
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.basic.tree;
+
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITree;
+import org.eclipse.scout.rt.ui.rap.basic.IRwtScoutComposite;
+import org.eclipse.swt.widgets.Tree;
+
+public interface IRwtScoutTree extends IRwtScoutComposite<ITree> {
+
+ void setEnabledFromScout(boolean enabled);
+
+ @Override
+ Tree getUiField();
+
+ TreeViewer getUiTreeViewer();
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/tree/RwtScoutTree.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/tree/RwtScoutTree.java
index 85393a42ad..86e4f4de19 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/tree/RwtScoutTree.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/tree/RwtScoutTree.java
@@ -1,890 +1,890 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.basic.tree;
-
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.ITreeViewerListener;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TreeExpansionEvent;
-import org.eclipse.jface.viewers.TreePath;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.ViewerCell;
-import org.eclipse.rwt.RWT;
-import org.eclipse.rwt.lifecycle.WidgetUtil;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.beans.IPropertyObserver;
-import org.eclipse.scout.commons.dnd.TransferObject;
-import org.eclipse.scout.commons.holders.Holder;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.IDNDSupport;
-import org.eclipse.scout.rt.client.ui.IEventHistory;
-import org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITree;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
-import org.eclipse.scout.rt.client.ui.basic.tree.TreeEvent;
-import org.eclipse.scout.rt.client.ui.basic.tree.TreeListener;
-import org.eclipse.scout.rt.ui.rap.RwtMenuUtility;
-import org.eclipse.scout.rt.ui.rap.basic.RwtScoutComposite;
-import org.eclipse.scout.rt.ui.rap.ext.MenuAdapterEx;
-import org.eclipse.scout.rt.ui.rap.ext.tree.TreeEx;
-import org.eclipse.scout.rt.ui.rap.extension.UiDecorationExtensionPoint;
-import org.eclipse.scout.rt.ui.rap.form.fields.AbstractRwtScoutDndSupport;
-import org.eclipse.scout.rt.ui.rap.keystroke.IRwtKeyStroke;
-import org.eclipse.scout.rt.ui.rap.keystroke.RwtKeyStroke;
-import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.dnd.DropTargetEvent;
-import org.eclipse.swt.events.MenuAdapter;
-import org.eclipse.swt.events.MenuEvent;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.internal.widgets.MarkupValidator;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Menu;
-
-/**
- * <h3>RwtScoutTree</h3> ...
- *
- * @since 3.7.0 June 2011
- */
-@SuppressWarnings("restriction")
-public class RwtScoutTree extends RwtScoutComposite<ITree> implements IRwtScoutTree {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(RwtScoutTree.class);
-
- private P_ScoutTreeListener m_scoutTreeListener;
-
- private Menu m_contextMenu;
-
- private TreeViewer m_treeViewer;
-
- private boolean m_enabledFromScout = true;
- private IRwtKeyStroke[] m_keyStrokes;
-
- private String m_variant = "";
-
- public RwtScoutTree() {
- }
-
- public RwtScoutTree(String variant) {
- m_variant = variant;
- }
-
- @Override
- protected void initializeUi(Composite parent) {
- TreeViewer viewer = createTreeModel(parent);
- setUiTreeViewer(viewer);
- setUiField(viewer.getTree());
-
- initNodeHeight();
- initializeTreeModel();
-
- viewer.getTree().setData(RWT.MARKUP_ENABLED, Boolean.TRUE);
- viewer.getTree().setData(MarkupValidator.MARKUP_VALIDATION_DISABLED, Boolean.TRUE);
- // listeners
- viewer.addSelectionChangedListener(new P_RwtSelectionListener());
- viewer.addTreeListener(new P_RwtExpansionListener());
- viewer.addDoubleClickListener(new P_RwtDoubleClickListener());
-
- P_RwtTreeListener treeListener = new P_RwtTreeListener();
- viewer.getTree().addListener(SWT.MouseDown, treeListener);
- viewer.getTree().addListener(SWT.MouseUp, treeListener);
- viewer.getTree().addListener(SWT.KeyUp, treeListener);
-
- getUiEnvironment().addKeyStroke(viewer.getTree(), new P_RwtKeyReturnAvoidDoubleClickListener(), false);
-
- // context menu
- m_contextMenu = new Menu(viewer.getTree().getShell(), SWT.POP_UP);
- m_contextMenu.addMenuListener(new P_ContextMenuListener());
- viewer.getTree().setMenu(m_contextMenu);
- }
-
- protected TreeViewer createTreeModel(Composite parent) {
- int style = isMultiSelect() ? SWT.MULTI : SWT.SINGLE;
- style |= SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL;
- TreeEx tree = getUiEnvironment().getFormToolkit().createTree(parent, style);
- if (StringUtility.hasText(m_variant)) {
- tree.setData(WidgetUtil.CUSTOM_VARIANT, m_variant);
- }
- tree.setLayoutDeferred(true);
- // Measure item call ends up in a layout error on windows 2000
- // tree.addListener(SWT.MeasureItem, new Listener(){
- // public void handleEvent(Event event) {
- // // event.height = (int)(event.gc.getFontMetrics().getHeight() *1.5);
- // }
- // });
- TreeViewer viewer = new TreeViewer(tree);
- viewer.setUseHashlookup(true);
- return viewer;
- }
-
- @Override
- public boolean isUiDisposed() {
- return getUiField() == null || getUiField().isDisposed();
- }
-
- protected void initializeTreeModel() {
- // model
- RwtScoutTreeModel model = createTreeModel();
- getUiTreeViewer().setContentProvider(model);
- getUiTreeViewer().setLabelProvider(model);
- getUiTreeViewer().setInput(model);
- }
-
- protected RwtScoutTreeModel createTreeModel() {
- return new RwtScoutTreeModel(getScoutObject(), this, getUiTreeViewer());
- }
-
- protected boolean isMultiSelect() {
- if (getScoutObject() != null) {
- return getScoutObject().isMultiSelect();
- }
- else {
- return false;
- }
- }
-
- protected void setUiTreeViewer(TreeViewer viewer) {
- m_treeViewer = viewer;
- }
-
- @Override
- public TreeViewer getUiTreeViewer() {
- return m_treeViewer;
- }
-
- protected ITreeContentProvider getContentProvider() {
- return (ITreeContentProvider) getUiTreeViewer().getContentProvider();
- }
-
- @Override
- public TreeEx getUiField() {
- return (TreeEx) super.getUiField();
- }
-
- protected void initNodeHeight() {
- int height = UiDecorationExtensionPoint.getLookAndFeel().getTreeNodeHeight();
- if (height >= 0) {
- getUiField().setData(RWT.CUSTOM_ITEM_HEIGHT, height);
- }
- }
-
- @Override
- protected void attachScout() {
- super.attachScout();
- if (getScoutObject() == null) {
- return;
- }
- if (m_scoutTreeListener == null) {
- m_scoutTreeListener = new P_ScoutTreeListener();
- getScoutObject().addUITreeListener(m_scoutTreeListener);
- }
- if (getScoutObject().isRootNodeVisible()) {
- setExpansionFromScout(getScoutObject().getRootNode());
- }
- else {
- for (ITreeNode node : getScoutObject().getRootNode().getFilteredChildNodes()) {
- setExpansionFromScout(node);
- }
- }
- setSelectionFromScout(getScoutObject().getSelectedNodes());
- setKeyStrokeFormScout();
- setNodeHeightFromScout();
- attachDndSupport();
- handleEventsFromRecentHistory();
- }
-
- protected void attachDndSupport() {
- if (UiDecorationExtensionPoint.getLookAndFeel().isDndSupportEnabled()) {
- new P_DndSupport(getScoutObject(), getScoutObject(), getUiField());
- }
- }
-
- private void handleEventsFromRecentHistory() {
- //handle events from recent history
- final IEventHistory<TreeEvent> h = getScoutObject().getEventHistory();
- if (h == null) {
- return;
- }
-
- getUiEnvironment().getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- for (TreeEvent e : h.getRecentEvents()) {
- handleScoutTreeEventInUi(e);
- }
- }
- });
- }
-
- @Override
- protected void detachScout() {
- super.detachScout();
- if (getScoutObject() == null) {
- return;
- }
- if (m_scoutTreeListener != null) {
- getScoutObject().removeTreeListener(m_scoutTreeListener);
- m_scoutTreeListener = null;
- }
- }
-
- @Override
- public void setEnabledFromScout(boolean enabled) {
- m_enabledFromScout = enabled;
- if (getUiField() instanceof TreeEx) {
- (getUiField()).setReadOnly(!enabled);
- }
- else {
- getUiField().setEnabled(enabled);
- }
- }
-
- public boolean isEnabledFromScout() {
- return m_enabledFromScout;
- }
-
- protected void setExpansionFromScout(ITreeNode scoutNode) {
- if (scoutNode != null) {
- setExpansionFromScoutRec(scoutNode);
- }
- }
-
- private void setExpansionFromScoutRec(ITreeNode scoutNode) {
- boolean exp;
- if (scoutNode.getParentNode() == null) {
- exp = true;
- }
- else {
- exp = scoutNode.isExpanded();
- }
- ITreeNode[] filteredChildNodes = scoutNode.getFilteredChildNodes();
- boolean hasChilds = filteredChildNodes.length > 0;
- if (hasChilds && exp != getUiTreeViewer().getExpandedState(scoutNode)) {
- getUiTreeViewer().setExpandedState(scoutNode, exp);
- }
- if (exp) {
- for (ITreeNode childNode : filteredChildNodes) {
- setExpansionFromScoutRec(childNode);
- }
- }
- }
-
- protected void setSelectionFromScout(ITreeNode[] scoutNodes) {
- if (getUiField().isDisposed()) {
- return;
- }
- getUiTreeViewer().setSelection(new StructuredSelection(scoutNodes));
- updateScrollToSelectionFromScout();
- }
-
- protected void setKeyStrokeFormScout() {
- // remove old
- if (m_keyStrokes != null) {
- for (IRwtKeyStroke keyStroke : m_keyStrokes) {
- getUiEnvironment().removeKeyStroke(getUiField(), keyStroke);
- }
- }
- // add new
- ArrayList<IRwtKeyStroke> newKeyStrokes = new ArrayList<IRwtKeyStroke>();
- IKeyStroke[] scoutKeyStrokes = getScoutObject().getKeyStrokes();
- for (IKeyStroke scoutKeyStroke : scoutKeyStrokes) {
- IRwtKeyStroke[] strokes = RwtUtility.getKeyStrokes(scoutKeyStroke, getUiEnvironment());
- for (IRwtKeyStroke stroke : strokes) {
- getUiEnvironment().addKeyStroke(getUiField(), stroke, false);
- newKeyStrokes.add(stroke);
- }
- }
- m_keyStrokes = newKeyStrokes.toArray(new IRwtKeyStroke[newKeyStrokes.size()]);
- }
-
- protected void setNodeHeightFromScout() {
- int h = getScoutObject().getNodeHeightHint();
- if (h >= 0) {
- getUiField().setData(RWT.CUSTOM_ITEM_HEIGHT, h);
- }
- if (isCreated()) {
- getUiTreeViewer().refresh();
- }
- }
-
- /**
- * bsi ticket 95090: avoid multiple and excessive tree structure updates
- */
- protected void handleScoutTreeEventBatchInUi(List<TreeEvent> eventList) {
- //phase 1: collect all parent nodes that need to be refreshed and refresh once per node
- HashSet<ITreeNode> processedParentNodes = new HashSet<ITreeNode>();
- for (TreeEvent e : eventList) {
- ITreeNode parentNode = null;
- switch (e.getType()) {
- case TreeEvent.TYPE_NODES_INSERTED:
- case TreeEvent.TYPE_NODES_UPDATED:
- case TreeEvent.TYPE_NODES_DELETED:
- case TreeEvent.TYPE_CHILD_NODE_ORDER_CHANGED: {
- parentNode = e.getCommonParentNode();
- break;
- }
- case TreeEvent.TYPE_NODE_FILTER_CHANGED: {
- parentNode = getScoutObject().getRootNode();
- break;
- }
- }
- if (parentNode != null) {
- if (!processedParentNodes.contains(parentNode)) {
- processedParentNodes.add(parentNode);
- updateTreeStructureAndKeepSelection(parentNode);
- setExpansionFromScout(parentNode);
- }
- }
- }
- //phase 2: apply remaining events
- for (TreeEvent e : eventList) {
- switch (e.getType()) {
- case TreeEvent.TYPE_REQUEST_FOCUS: {
- getUiField().setFocus();
- break;
- }
- case TreeEvent.TYPE_NODE_EXPANDED:
- case TreeEvent.TYPE_NODE_COLLAPSED: {
- setExpansionFromScout(e.getNode());
- break;
- }
- case TreeEvent.TYPE_NODES_SELECTED: {
- setSelectionFromScout(e.getNodes());
- break;
- }
- case TreeEvent.TYPE_SCROLL_TO_SELECTION: {
- scrollToSelection();
- break;
- }
- }
- }
- }
-
- private void updateTreeStructureAndKeepSelection(ITreeNode node) {
- if (getUiTreeViewer() != null && getUiTreeViewer().getTree() != null && !getUiTreeViewer().getTree().isDisposed()) {
- if (node == getScoutObject().getRootNode()) {
- getUiTreeViewer().refresh();
- }
- else {
- getUiTreeViewer().refresh(node);
- }
- }
- }
-
- protected void setSelectionFromRwt(final ITreeNode[] nodes) {
- if (getUpdateUiFromScoutLock().isAcquired()) {
- return;
- }
- if (getScoutObject() != null) {
- // notify Scout
- Runnable t = new Runnable() {
- @Override
- public void run() {
- try {
- addIgnoredScoutEvent(TreeEvent.class, "" + TreeEvent.TYPE_NODES_SELECTED);
- getScoutObject().getUIFacade().setNodesSelectedFromUI(nodes);
- }
- finally {
- removeIgnoredScoutEvent(TreeEvent.class, "" + TreeEvent.TYPE_NODES_SELECTED);
- }
- }
- };
- getUiEnvironment().invokeScoutLater(t, 0);
- // end notify
- }
- }
-
- protected void updateScrollToSelectionFromScout() {
- if (getScoutObject().isScrollToSelection()) {
- scrollToSelection();
- }
- }
-
- /**
- * @rn imo, 05.03.2009, tickets #73324, #73707, #74018
- * @rn imo, 18.11.2009, ticket #83255
- */
- protected void scrollToSelection() {
- if (getUiField() != null && !getUiField().isDisposed()) {
- getUiField().showSelection();
- }
- }
-
- @Override
- protected void handleScoutPropertyChange(String name, Object newValue) {
- if (name.equals(ITree.PROP_KEY_STROKES)) {
- setKeyStrokeFormScout();
- }
- else if (name.equals(ITree.PROP_SCROLL_TO_SELECTION)) {
- updateScrollToSelectionFromScout();
- }
- else if (name.equals(ITree.PROP_NODE_HEIGHT_HINT)) {
- setNodeHeightFromScout();
- }
- super.handleScoutPropertyChange(name, newValue);
- }
-
- protected void setExpansionFromUi(final ITreeNode node, final boolean expanded) {
- if (getUpdateUiFromScoutLock().isAcquired()) {
- return;
- }
- if (getScoutObject() != null) {
- // notify Scout
- Runnable t = new Runnable() {
- @Override
- public void run() {
- if (node.isExpanded() != expanded) {
- getScoutObject().getUIFacade().setNodeExpandedFromUI(node, expanded);
- }
- }
- };
- getUiEnvironment().invokeScoutLater(t, 0);
- // end notify
- }
- }
-
- /**
- * model thread: scout table observer
- */
- protected boolean isHandleScoutTreeEvent(TreeEvent[] a) {
- for (TreeEvent element : a) {
- switch (element.getType()) {
- case TreeEvent.TYPE_REQUEST_FOCUS:
- case TreeEvent.TYPE_NODE_EXPANDED:
- case TreeEvent.TYPE_NODE_COLLAPSED:
- case TreeEvent.TYPE_NODES_INSERTED:
- case TreeEvent.TYPE_NODES_UPDATED:
- case TreeEvent.TYPE_NODES_DELETED:
- case TreeEvent.TYPE_NODE_FILTER_CHANGED:
- case TreeEvent.TYPE_NODES_SELECTED:
- case TreeEvent.TYPE_CHILD_NODE_ORDER_CHANGED:
- case TreeEvent.TYPE_SCROLL_TO_SELECTION: {
- return true;
- }
- }
- }
- return false;
- }
-
- protected void handleScoutTreeEventInUi(TreeEvent e) {
- if (isUiDisposed()) {
- return;
- }
- switch (e.getType()) {
- case TreeEvent.TYPE_NODES_INSERTED:
- case TreeEvent.TYPE_NODES_DELETED:
- case TreeEvent.TYPE_CHILD_NODE_ORDER_CHANGED: {
- updateTreeStructureAndKeepSelection(e.getCommonParentNode());
- setExpansionFromScout(e.getCommonParentNode());
- break;
- }
- case TreeEvent.TYPE_NODES_UPDATED: {
- //in case a virtual node was resolved, check if selection still valid
- ISelection oldSelection = getUiTreeViewer().getSelection();
- ISelection newSelection = new StructuredSelection(getScoutObject().getSelectedNodes());
- updateTreeStructureAndKeepSelection(e.getCommonParentNode());
- if (!newSelection.equals(oldSelection)) {
- getUiTreeViewer().setSelection(newSelection);
- }
- setExpansionFromScout(e.getCommonParentNode());
- break;
- }
- case TreeEvent.TYPE_NODE_FILTER_CHANGED: {
- updateTreeStructureAndKeepSelection(getScoutObject().getRootNode());
- setExpansionFromScout(getScoutObject().getRootNode());
- break;
- }
- case TreeEvent.TYPE_REQUEST_FOCUS: {
- getUiField().setFocus();
- break;
- }
- case TreeEvent.TYPE_NODE_EXPANDED:
- case TreeEvent.TYPE_NODE_COLLAPSED: {
- setExpansionFromScout(e.getNode());
- break;
- }
- case TreeEvent.TYPE_NODES_SELECTED: {
- setSelectionFromScout(e.getNodes());
- break;
- }
- case TreeEvent.TYPE_SCROLL_TO_SELECTION: {
- scrollToSelection();
- break;
- }
- }
- }
-
- protected void handleUiNodeClick(final ITreeNode node) {
- if (getScoutObject() != null) {
- if (node != null) {
- // notify Scout
- Runnable t = new Runnable() {
- @Override
- public void run() {
- getScoutObject().getUIFacade().fireNodeClickFromUI(node);
- }
- };
- getUiEnvironment().invokeScoutLater(t, 0);
- // end notify
- }
- }
- }
-
- protected void handleUiNodeAction(final ITreeNode node) {
- if (getScoutObject() != null) {
- // notify Scout
- Runnable t = new Runnable() {
- @Override
- public void run() {
- getScoutObject().getUIFacade().fireNodeActionFromUI(node);
- }
- };
- getUiEnvironment().invokeScoutLater(t, 400);
- // end notify
- }
- }
-
- /**
- * TODO not used yet; attach to rwt tree with styled or html cells
- */
- protected void handleUiHyperlinkAction(final ITreeNode node, final URL url) {
- if (getScoutObject() != null && node != null) {
- // notify Scout
- Runnable t = new Runnable() {
- @Override
- public void run() {
- getScoutObject().getUIFacade().fireHyperlinkActionFromUI(node, url);
- }
- };
- getUiEnvironment().invokeScoutLater(t, 0);
- // end notify
- }
- }
-
- // static convenience helpers
- public static TreePath scoutNodeToTreePath(ITreeNode scoutNode) {
- if (scoutNode == null) {
- return null;
- }
- Object[] path = getPathToRoot(scoutNode, 0);
- return new TreePath(path);
- }
-
- public static TreePath[] scoutNodesToTreePaths(ITreeNode[] scoutNodes) {
- if (scoutNodes == null) {
- return new TreePath[0];
- }
- TreePath[] paths = new TreePath[scoutNodes.length];
- for (int i = 0; i < scoutNodes.length; i++) {
- paths[i] = scoutNodeToTreePath(scoutNodes[i]);
- }
- return paths;
- }
-
- public static ITreeNode[] getPathToRoot(ITreeNode scoutNode, int depth) {
- ITreeNode[] retNodes;
- if (scoutNode == null) {
- if (depth == 0) {
- return null;
- }
- else {
- retNodes = new ITreeNode[depth];
- }
- }
- else {
- depth++;
- if (scoutNode.getParentNode() == null) {
- retNodes = new ITreeNode[depth];
- }
- else {
- retNodes = getPathToRoot(scoutNode.getParentNode(), depth);
- }
- retNodes[retNodes.length - depth] = scoutNode;
- }
- return retNodes;
- }
-
- /*
- * private inner classes
- */
- private class P_ScoutTreeListener implements TreeListener {
- @Override
- public void treeChanged(final TreeEvent e) {
- if (isHandleScoutTreeEvent(new TreeEvent[]{e})) {
- if (isIgnoredScoutEvent(TreeEvent.class, "" + e.getType())) {
- return;
- }
- Runnable t = new Runnable() {
- @Override
- public void run() {
- try {
- getUpdateUiFromScoutLock().acquire();
- //
- handleScoutTreeEventInUi(e);
- }
- finally {
- getUpdateUiFromScoutLock().release();
- }
- }
- };
- getUiEnvironment().invokeUiLater(t);
- }
- }
-
- @Override
- public void treeChangedBatch(final TreeEvent[] a) {
- if (isHandleScoutTreeEvent(a)) {
- final ArrayList<TreeEvent> filteredList = new ArrayList<TreeEvent>();
- for (TreeEvent element : a) {
- if (!isIgnoredScoutEvent(TreeEvent.class, "" + element.getType())) {
- filteredList.add(element);
- }
- }
- if (filteredList.size() == 0) {
- return;
- }
- Runnable t = new Runnable() {
- @Override
- public void run() {
- try {
- getUpdateUiFromScoutLock().acquire();
- if (!getUiField().isDisposed()) {
- getUiField().setRedraw(false);
- }
- //
- handleScoutTreeEventBatchInUi(filteredList);
- }
- finally {
- getUpdateUiFromScoutLock().release();
- if (!getUiField().isDisposed()) {
- getUiField().setRedraw(true);
- }
- }
- }
- };
- getUiEnvironment().invokeUiLater(t);
- }
- }
- }// end private class
-
- private class P_RwtSelectionListener implements ISelectionChangedListener {
- @Override
- @SuppressWarnings("unchecked")
- public void selectionChanged(SelectionChangedEvent event) {
- if (isEnabledFromScout()) {
- StructuredSelection sel = (StructuredSelection) event.getSelection();
- ITreeNode[] nodes = (ITreeNode[]) sel.toList().toArray(new ITreeNode[sel.size()]);
- setSelectionFromRwt(nodes);
- }
- }
- } // end class P_RwtSelectionListener
-
- private void showMenu(Point eventPosition) {
- getUiField().setMenu(m_contextMenu);
- getUiField().getMenu().addMenuListener(new MenuAdapter() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void menuHidden(MenuEvent e) {
- getUiField().setMenu(null);
- ((Menu) e.getSource()).removeMenuListener(this);
- }
- });
- getUiField().getMenu().setLocation(eventPosition);
- getUiField().getMenu().setVisible(true);
- }
-
- /**
- * @param event
- */
- private void handleUiDoubleClick(StructuredSelection sel) {
- @SuppressWarnings("unchecked")
- ITreeNode[] nodes = (ITreeNode[]) sel.toList().toArray(new ITreeNode[sel.size()]);
- if (nodes != null && nodes.length == 1) {
- // if not leaf expand collapse
- if (!nodes[0].isLeaf()) {
- // invert expansion
- setExpansionFromUi(nodes[0], !getUiTreeViewer().getExpandedState(nodes[0]));
- }
- else {
- handleUiNodeAction(nodes[0]);
- if (getScoutObject().isCheckable()) {
- handleUiNodeClick(nodes[0]);
- }
- }
- }
- }
-
- private class P_RwtTreeListener implements Listener {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void handleEvent(Event event) {
- switch (event.type) {
- case SWT.MouseUp: {
- ViewerCell cell = getUiTreeViewer().getCell(new Point(event.x, event.y));
- if (cell != null && cell.getElement() instanceof ITreeNode) {
- ITreeNode nodeToClick = (ITreeNode) cell.getElement();
- handleUiNodeClick(nodeToClick);
- }
- break;
- }
- case SWT.KeyUp: {
- if (getScoutObject().isCheckable()) {
- if (event.stateMask == 0) {
- switch (event.keyCode) {
- case ' ':
- StructuredSelection sel = (StructuredSelection) getUiTreeViewer().getSelection();
- @SuppressWarnings("unchecked")
- ITreeNode[] nodes = (ITreeNode[]) sel.toList().toArray(new ITreeNode[sel.size()]);
- if (nodes != null && nodes.length > 0) {
- handleUiNodeClick(nodes[0]);
- }
- event.doit = false;
- break;
- }
- }
- }
- break;
- }
- case SWT.Resize: {
- updateScrollToSelectionFromScout();
- break;
- }
- }
- }
- }
-
- private class P_RwtExpansionListener implements ITreeViewerListener {
- @Override
- public void treeCollapsed(TreeExpansionEvent event) {
- setExpansionFromUi((ITreeNode) event.getElement(), false);
- }
-
- @Override
- public void treeExpanded(TreeExpansionEvent event) {
- setExpansionFromUi((ITreeNode) event.getElement(), true);
- }
- } // end class P_RwtExpansionListener
-
- /**
- * @rn sle, 03.12.2010, ticket #97056
- */
- private class P_RwtKeyReturnAvoidDoubleClickListener extends RwtKeyStroke {
- private static final long serialVersionUID = 1L;
-
- public P_RwtKeyReturnAvoidDoubleClickListener() {
- super(SWT.CR);
- }
-
- @Override
- public void handleUiAction(Event e) {
- //to avoid the postEvent(DoubleClickEvent) from Tree.WM_CHAR(...) set e.doit to false
- e.doit = false;
- }
- } // end class P_RwtKeyReturnAvoidDoubleClickListener
-
- private class P_RwtDoubleClickListener implements IDoubleClickListener {
- @Override
- public void doubleClick(DoubleClickEvent event) {
- if (event.getSelection() instanceof StructuredSelection) {
- StructuredSelection sel = (StructuredSelection) event.getSelection();
- handleUiDoubleClick(sel);
- }
- }
- }
-
- private class P_ContextMenuListener extends MenuAdapterEx {
- private static final long serialVersionUID = 1L;
-
- public P_ContextMenuListener() {
- super(RwtScoutTree.this.getUiTreeViewer().getTree(), RwtScoutTree.this.getUiTreeViewer().getTree().getParent());
- }
-
- @Override
- protected Menu getContextMenu() {
- return m_contextMenu;
- }
-
- @Override
- protected void setContextMenu(Menu contextMenu) {
- m_contextMenu = contextMenu;
- }
-
- @Override
- public void menuShown(MenuEvent e) {
- super.menuShown(e);
-
- if (getScoutObject() == null || !isEnabledFromScout()) {
- return;
- }
-
- final boolean emptySpace = (getUiField().getContextItem() == null);
- IMenu[] menus = RwtMenuUtility.collectMenus(getScoutObject(), emptySpace, !emptySpace, getUiEnvironment());
-
- RwtMenuUtility.fillContextMenu(menus, getUiEnvironment(), m_contextMenu);
- }
-
- } // end class P_ContextMenuListener
-
- private class P_DndSupport extends AbstractRwtScoutDndSupport {
- public P_DndSupport(IPropertyObserver scoutObject, IDNDSupport scoutDndSupportable, Control control) {
- super(scoutObject, scoutDndSupportable, control, RwtScoutTree.this.getUiEnvironment());
- }
-
- @Override
- protected TransferObject handleUiDragRequest() {
- final Holder<TransferObject> result = new Holder<TransferObject>(TransferObject.class, null);
- Runnable t = new Runnable() {
- @Override
- public void run() {
- TransferObject scoutTransferable = getScoutObject().getUIFacade().fireNodesDragRequestFromUI();
- result.setValue(scoutTransferable);
- }
- };
- try {
- getUiEnvironment().invokeScoutLater(t, 20000).join(20000);
- }
- catch (InterruptedException e) {
- //nop
- }
- return result.getValue();
- }
-
- @Override
- protected void handleUiDropAction(DropTargetEvent event, final TransferObject scoutTransferObject) {
- Object dropTarget = event.item != null ? event.item.getData() : null;
- final ITreeNode node = dropTarget instanceof ITreeNode ? (ITreeNode) dropTarget : null;
- Runnable job = new Runnable() {
- @Override
- public void run() {
- getScoutObject().getUIFacade().fireNodeDropActionFromUI(node, scoutTransferObject);
- }
- };
- getUiEnvironment().invokeScoutLater(job, 200);
- }
- }// end class P_DndSupport
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.basic.tree;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.ITreeViewerListener;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreeExpansionEvent;
+import org.eclipse.jface.viewers.TreePath;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.ViewerCell;
+import org.eclipse.rwt.RWT;
+import org.eclipse.rwt.lifecycle.WidgetUtil;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.beans.IPropertyObserver;
+import org.eclipse.scout.commons.dnd.TransferObject;
+import org.eclipse.scout.commons.holders.Holder;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.IDNDSupport;
+import org.eclipse.scout.rt.client.ui.IEventHistory;
+import org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITree;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
+import org.eclipse.scout.rt.client.ui.basic.tree.TreeEvent;
+import org.eclipse.scout.rt.client.ui.basic.tree.TreeListener;
+import org.eclipse.scout.rt.ui.rap.RwtMenuUtility;
+import org.eclipse.scout.rt.ui.rap.basic.RwtScoutComposite;
+import org.eclipse.scout.rt.ui.rap.ext.MenuAdapterEx;
+import org.eclipse.scout.rt.ui.rap.ext.tree.TreeEx;
+import org.eclipse.scout.rt.ui.rap.extension.UiDecorationExtensionPoint;
+import org.eclipse.scout.rt.ui.rap.form.fields.AbstractRwtScoutDndSupport;
+import org.eclipse.scout.rt.ui.rap.keystroke.IRwtKeyStroke;
+import org.eclipse.scout.rt.ui.rap.keystroke.RwtKeyStroke;
+import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.dnd.DropTargetEvent;
+import org.eclipse.swt.events.MenuAdapter;
+import org.eclipse.swt.events.MenuEvent;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.internal.widgets.MarkupValidator;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Menu;
+
+/**
+ * <h3>RwtScoutTree</h3> ...
+ *
+ * @since 3.7.0 June 2011
+ */
+@SuppressWarnings("restriction")
+public class RwtScoutTree extends RwtScoutComposite<ITree> implements IRwtScoutTree {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(RwtScoutTree.class);
+
+ private P_ScoutTreeListener m_scoutTreeListener;
+
+ private Menu m_contextMenu;
+
+ private TreeViewer m_treeViewer;
+
+ private boolean m_enabledFromScout = true;
+ private IRwtKeyStroke[] m_keyStrokes;
+
+ private String m_variant = "";
+
+ public RwtScoutTree() {
+ }
+
+ public RwtScoutTree(String variant) {
+ m_variant = variant;
+ }
+
+ @Override
+ protected void initializeUi(Composite parent) {
+ TreeViewer viewer = createTreeModel(parent);
+ setUiTreeViewer(viewer);
+ setUiField(viewer.getTree());
+
+ initNodeHeight();
+ initializeTreeModel();
+
+ viewer.getTree().setData(RWT.MARKUP_ENABLED, Boolean.TRUE);
+ viewer.getTree().setData(MarkupValidator.MARKUP_VALIDATION_DISABLED, Boolean.TRUE);
+ // listeners
+ viewer.addSelectionChangedListener(new P_RwtSelectionListener());
+ viewer.addTreeListener(new P_RwtExpansionListener());
+ viewer.addDoubleClickListener(new P_RwtDoubleClickListener());
+
+ P_RwtTreeListener treeListener = new P_RwtTreeListener();
+ viewer.getTree().addListener(SWT.MouseDown, treeListener);
+ viewer.getTree().addListener(SWT.MouseUp, treeListener);
+ viewer.getTree().addListener(SWT.KeyUp, treeListener);
+
+ getUiEnvironment().addKeyStroke(viewer.getTree(), new P_RwtKeyReturnAvoidDoubleClickListener(), false);
+
+ // context menu
+ m_contextMenu = new Menu(viewer.getTree().getShell(), SWT.POP_UP);
+ m_contextMenu.addMenuListener(new P_ContextMenuListener());
+ viewer.getTree().setMenu(m_contextMenu);
+ }
+
+ protected TreeViewer createTreeModel(Composite parent) {
+ int style = isMultiSelect() ? SWT.MULTI : SWT.SINGLE;
+ style |= SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL;
+ TreeEx tree = getUiEnvironment().getFormToolkit().createTree(parent, style);
+ if (StringUtility.hasText(m_variant)) {
+ tree.setData(WidgetUtil.CUSTOM_VARIANT, m_variant);
+ }
+ tree.setLayoutDeferred(true);
+ // Measure item call ends up in a layout error on windows 2000
+ // tree.addListener(SWT.MeasureItem, new Listener(){
+ // public void handleEvent(Event event) {
+ // // event.height = (int)(event.gc.getFontMetrics().getHeight() *1.5);
+ // }
+ // });
+ TreeViewer viewer = new TreeViewer(tree);
+ viewer.setUseHashlookup(true);
+ return viewer;
+ }
+
+ @Override
+ public boolean isUiDisposed() {
+ return getUiField() == null || getUiField().isDisposed();
+ }
+
+ protected void initializeTreeModel() {
+ // model
+ RwtScoutTreeModel model = createTreeModel();
+ getUiTreeViewer().setContentProvider(model);
+ getUiTreeViewer().setLabelProvider(model);
+ getUiTreeViewer().setInput(model);
+ }
+
+ protected RwtScoutTreeModel createTreeModel() {
+ return new RwtScoutTreeModel(getScoutObject(), this, getUiTreeViewer());
+ }
+
+ protected boolean isMultiSelect() {
+ if (getScoutObject() != null) {
+ return getScoutObject().isMultiSelect();
+ }
+ else {
+ return false;
+ }
+ }
+
+ protected void setUiTreeViewer(TreeViewer viewer) {
+ m_treeViewer = viewer;
+ }
+
+ @Override
+ public TreeViewer getUiTreeViewer() {
+ return m_treeViewer;
+ }
+
+ protected ITreeContentProvider getContentProvider() {
+ return (ITreeContentProvider) getUiTreeViewer().getContentProvider();
+ }
+
+ @Override
+ public TreeEx getUiField() {
+ return (TreeEx) super.getUiField();
+ }
+
+ protected void initNodeHeight() {
+ int height = UiDecorationExtensionPoint.getLookAndFeel().getTreeNodeHeight();
+ if (height >= 0) {
+ getUiField().setData(RWT.CUSTOM_ITEM_HEIGHT, height);
+ }
+ }
+
+ @Override
+ protected void attachScout() {
+ super.attachScout();
+ if (getScoutObject() == null) {
+ return;
+ }
+ if (m_scoutTreeListener == null) {
+ m_scoutTreeListener = new P_ScoutTreeListener();
+ getScoutObject().addUITreeListener(m_scoutTreeListener);
+ }
+ if (getScoutObject().isRootNodeVisible()) {
+ setExpansionFromScout(getScoutObject().getRootNode());
+ }
+ else {
+ for (ITreeNode node : getScoutObject().getRootNode().getFilteredChildNodes()) {
+ setExpansionFromScout(node);
+ }
+ }
+ setSelectionFromScout(getScoutObject().getSelectedNodes());
+ setKeyStrokeFormScout();
+ setNodeHeightFromScout();
+ attachDndSupport();
+ handleEventsFromRecentHistory();
+ }
+
+ protected void attachDndSupport() {
+ if (UiDecorationExtensionPoint.getLookAndFeel().isDndSupportEnabled()) {
+ new P_DndSupport(getScoutObject(), getScoutObject(), getUiField());
+ }
+ }
+
+ private void handleEventsFromRecentHistory() {
+ //handle events from recent history
+ final IEventHistory<TreeEvent> h = getScoutObject().getEventHistory();
+ if (h == null) {
+ return;
+ }
+
+ getUiEnvironment().getDisplay().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ for (TreeEvent e : h.getRecentEvents()) {
+ handleScoutTreeEventInUi(e);
+ }
+ }
+ });
+ }
+
+ @Override
+ protected void detachScout() {
+ super.detachScout();
+ if (getScoutObject() == null) {
+ return;
+ }
+ if (m_scoutTreeListener != null) {
+ getScoutObject().removeTreeListener(m_scoutTreeListener);
+ m_scoutTreeListener = null;
+ }
+ }
+
+ @Override
+ public void setEnabledFromScout(boolean enabled) {
+ m_enabledFromScout = enabled;
+ if (getUiField() instanceof TreeEx) {
+ (getUiField()).setReadOnly(!enabled);
+ }
+ else {
+ getUiField().setEnabled(enabled);
+ }
+ }
+
+ public boolean isEnabledFromScout() {
+ return m_enabledFromScout;
+ }
+
+ protected void setExpansionFromScout(ITreeNode scoutNode) {
+ if (scoutNode != null) {
+ setExpansionFromScoutRec(scoutNode);
+ }
+ }
+
+ private void setExpansionFromScoutRec(ITreeNode scoutNode) {
+ boolean exp;
+ if (scoutNode.getParentNode() == null) {
+ exp = true;
+ }
+ else {
+ exp = scoutNode.isExpanded();
+ }
+ ITreeNode[] filteredChildNodes = scoutNode.getFilteredChildNodes();
+ boolean hasChilds = filteredChildNodes.length > 0;
+ if (hasChilds && exp != getUiTreeViewer().getExpandedState(scoutNode)) {
+ getUiTreeViewer().setExpandedState(scoutNode, exp);
+ }
+ if (exp) {
+ for (ITreeNode childNode : filteredChildNodes) {
+ setExpansionFromScoutRec(childNode);
+ }
+ }
+ }
+
+ protected void setSelectionFromScout(ITreeNode[] scoutNodes) {
+ if (getUiField().isDisposed()) {
+ return;
+ }
+ getUiTreeViewer().setSelection(new StructuredSelection(scoutNodes));
+ updateScrollToSelectionFromScout();
+ }
+
+ protected void setKeyStrokeFormScout() {
+ // remove old
+ if (m_keyStrokes != null) {
+ for (IRwtKeyStroke keyStroke : m_keyStrokes) {
+ getUiEnvironment().removeKeyStroke(getUiField(), keyStroke);
+ }
+ }
+ // add new
+ ArrayList<IRwtKeyStroke> newKeyStrokes = new ArrayList<IRwtKeyStroke>();
+ IKeyStroke[] scoutKeyStrokes = getScoutObject().getKeyStrokes();
+ for (IKeyStroke scoutKeyStroke : scoutKeyStrokes) {
+ IRwtKeyStroke[] strokes = RwtUtility.getKeyStrokes(scoutKeyStroke, getUiEnvironment());
+ for (IRwtKeyStroke stroke : strokes) {
+ getUiEnvironment().addKeyStroke(getUiField(), stroke, false);
+ newKeyStrokes.add(stroke);
+ }
+ }
+ m_keyStrokes = newKeyStrokes.toArray(new IRwtKeyStroke[newKeyStrokes.size()]);
+ }
+
+ protected void setNodeHeightFromScout() {
+ int h = getScoutObject().getNodeHeightHint();
+ if (h >= 0) {
+ getUiField().setData(RWT.CUSTOM_ITEM_HEIGHT, h);
+ }
+ if (isCreated()) {
+ getUiTreeViewer().refresh();
+ }
+ }
+
+ /**
+ * bsi ticket 95090: avoid multiple and excessive tree structure updates
+ */
+ protected void handleScoutTreeEventBatchInUi(List<TreeEvent> eventList) {
+ //phase 1: collect all parent nodes that need to be refreshed and refresh once per node
+ HashSet<ITreeNode> processedParentNodes = new HashSet<ITreeNode>();
+ for (TreeEvent e : eventList) {
+ ITreeNode parentNode = null;
+ switch (e.getType()) {
+ case TreeEvent.TYPE_NODES_INSERTED:
+ case TreeEvent.TYPE_NODES_UPDATED:
+ case TreeEvent.TYPE_NODES_DELETED:
+ case TreeEvent.TYPE_CHILD_NODE_ORDER_CHANGED: {
+ parentNode = e.getCommonParentNode();
+ break;
+ }
+ case TreeEvent.TYPE_NODE_FILTER_CHANGED: {
+ parentNode = getScoutObject().getRootNode();
+ break;
+ }
+ }
+ if (parentNode != null) {
+ if (!processedParentNodes.contains(parentNode)) {
+ processedParentNodes.add(parentNode);
+ updateTreeStructureAndKeepSelection(parentNode);
+ setExpansionFromScout(parentNode);
+ }
+ }
+ }
+ //phase 2: apply remaining events
+ for (TreeEvent e : eventList) {
+ switch (e.getType()) {
+ case TreeEvent.TYPE_REQUEST_FOCUS: {
+ getUiField().setFocus();
+ break;
+ }
+ case TreeEvent.TYPE_NODE_EXPANDED:
+ case TreeEvent.TYPE_NODE_COLLAPSED: {
+ setExpansionFromScout(e.getNode());
+ break;
+ }
+ case TreeEvent.TYPE_NODES_SELECTED: {
+ setSelectionFromScout(e.getNodes());
+ break;
+ }
+ case TreeEvent.TYPE_SCROLL_TO_SELECTION: {
+ scrollToSelection();
+ break;
+ }
+ }
+ }
+ }
+
+ private void updateTreeStructureAndKeepSelection(ITreeNode node) {
+ if (getUiTreeViewer() != null && getUiTreeViewer().getTree() != null && !getUiTreeViewer().getTree().isDisposed()) {
+ if (node == getScoutObject().getRootNode()) {
+ getUiTreeViewer().refresh();
+ }
+ else {
+ getUiTreeViewer().refresh(node);
+ }
+ }
+ }
+
+ protected void setSelectionFromRwt(final ITreeNode[] nodes) {
+ if (getUpdateUiFromScoutLock().isAcquired()) {
+ return;
+ }
+ if (getScoutObject() != null) {
+ // notify Scout
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ try {
+ addIgnoredScoutEvent(TreeEvent.class, "" + TreeEvent.TYPE_NODES_SELECTED);
+ getScoutObject().getUIFacade().setNodesSelectedFromUI(nodes);
+ }
+ finally {
+ removeIgnoredScoutEvent(TreeEvent.class, "" + TreeEvent.TYPE_NODES_SELECTED);
+ }
+ }
+ };
+ getUiEnvironment().invokeScoutLater(t, 0);
+ // end notify
+ }
+ }
+
+ protected void updateScrollToSelectionFromScout() {
+ if (getScoutObject().isScrollToSelection()) {
+ scrollToSelection();
+ }
+ }
+
+ /**
+ * @rn imo, 05.03.2009, tickets #73324, #73707, #74018
+ * @rn imo, 18.11.2009, ticket #83255
+ */
+ protected void scrollToSelection() {
+ if (getUiField() != null && !getUiField().isDisposed()) {
+ getUiField().showSelection();
+ }
+ }
+
+ @Override
+ protected void handleScoutPropertyChange(String name, Object newValue) {
+ if (name.equals(ITree.PROP_KEY_STROKES)) {
+ setKeyStrokeFormScout();
+ }
+ else if (name.equals(ITree.PROP_SCROLL_TO_SELECTION)) {
+ updateScrollToSelectionFromScout();
+ }
+ else if (name.equals(ITree.PROP_NODE_HEIGHT_HINT)) {
+ setNodeHeightFromScout();
+ }
+ super.handleScoutPropertyChange(name, newValue);
+ }
+
+ protected void setExpansionFromUi(final ITreeNode node, final boolean expanded) {
+ if (getUpdateUiFromScoutLock().isAcquired()) {
+ return;
+ }
+ if (getScoutObject() != null) {
+ // notify Scout
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ if (node.isExpanded() != expanded) {
+ getScoutObject().getUIFacade().setNodeExpandedFromUI(node, expanded);
+ }
+ }
+ };
+ getUiEnvironment().invokeScoutLater(t, 0);
+ // end notify
+ }
+ }
+
+ /**
+ * model thread: scout table observer
+ */
+ protected boolean isHandleScoutTreeEvent(TreeEvent[] a) {
+ for (TreeEvent element : a) {
+ switch (element.getType()) {
+ case TreeEvent.TYPE_REQUEST_FOCUS:
+ case TreeEvent.TYPE_NODE_EXPANDED:
+ case TreeEvent.TYPE_NODE_COLLAPSED:
+ case TreeEvent.TYPE_NODES_INSERTED:
+ case TreeEvent.TYPE_NODES_UPDATED:
+ case TreeEvent.TYPE_NODES_DELETED:
+ case TreeEvent.TYPE_NODE_FILTER_CHANGED:
+ case TreeEvent.TYPE_NODES_SELECTED:
+ case TreeEvent.TYPE_CHILD_NODE_ORDER_CHANGED:
+ case TreeEvent.TYPE_SCROLL_TO_SELECTION: {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ protected void handleScoutTreeEventInUi(TreeEvent e) {
+ if (isUiDisposed()) {
+ return;
+ }
+ switch (e.getType()) {
+ case TreeEvent.TYPE_NODES_INSERTED:
+ case TreeEvent.TYPE_NODES_DELETED:
+ case TreeEvent.TYPE_CHILD_NODE_ORDER_CHANGED: {
+ updateTreeStructureAndKeepSelection(e.getCommonParentNode());
+ setExpansionFromScout(e.getCommonParentNode());
+ break;
+ }
+ case TreeEvent.TYPE_NODES_UPDATED: {
+ //in case a virtual node was resolved, check if selection still valid
+ ISelection oldSelection = getUiTreeViewer().getSelection();
+ ISelection newSelection = new StructuredSelection(getScoutObject().getSelectedNodes());
+ updateTreeStructureAndKeepSelection(e.getCommonParentNode());
+ if (!newSelection.equals(oldSelection)) {
+ getUiTreeViewer().setSelection(newSelection);
+ }
+ setExpansionFromScout(e.getCommonParentNode());
+ break;
+ }
+ case TreeEvent.TYPE_NODE_FILTER_CHANGED: {
+ updateTreeStructureAndKeepSelection(getScoutObject().getRootNode());
+ setExpansionFromScout(getScoutObject().getRootNode());
+ break;
+ }
+ case TreeEvent.TYPE_REQUEST_FOCUS: {
+ getUiField().setFocus();
+ break;
+ }
+ case TreeEvent.TYPE_NODE_EXPANDED:
+ case TreeEvent.TYPE_NODE_COLLAPSED: {
+ setExpansionFromScout(e.getNode());
+ break;
+ }
+ case TreeEvent.TYPE_NODES_SELECTED: {
+ setSelectionFromScout(e.getNodes());
+ break;
+ }
+ case TreeEvent.TYPE_SCROLL_TO_SELECTION: {
+ scrollToSelection();
+ break;
+ }
+ }
+ }
+
+ protected void handleUiNodeClick(final ITreeNode node) {
+ if (getScoutObject() != null) {
+ if (node != null) {
+ // notify Scout
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ getScoutObject().getUIFacade().fireNodeClickFromUI(node);
+ }
+ };
+ getUiEnvironment().invokeScoutLater(t, 0);
+ // end notify
+ }
+ }
+ }
+
+ protected void handleUiNodeAction(final ITreeNode node) {
+ if (getScoutObject() != null) {
+ // notify Scout
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ getScoutObject().getUIFacade().fireNodeActionFromUI(node);
+ }
+ };
+ getUiEnvironment().invokeScoutLater(t, 400);
+ // end notify
+ }
+ }
+
+ /**
+ * TODO not used yet; attach to rwt tree with styled or html cells
+ */
+ protected void handleUiHyperlinkAction(final ITreeNode node, final URL url) {
+ if (getScoutObject() != null && node != null) {
+ // notify Scout
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ getScoutObject().getUIFacade().fireHyperlinkActionFromUI(node, url);
+ }
+ };
+ getUiEnvironment().invokeScoutLater(t, 0);
+ // end notify
+ }
+ }
+
+ // static convenience helpers
+ public static TreePath scoutNodeToTreePath(ITreeNode scoutNode) {
+ if (scoutNode == null) {
+ return null;
+ }
+ Object[] path = getPathToRoot(scoutNode, 0);
+ return new TreePath(path);
+ }
+
+ public static TreePath[] scoutNodesToTreePaths(ITreeNode[] scoutNodes) {
+ if (scoutNodes == null) {
+ return new TreePath[0];
+ }
+ TreePath[] paths = new TreePath[scoutNodes.length];
+ for (int i = 0; i < scoutNodes.length; i++) {
+ paths[i] = scoutNodeToTreePath(scoutNodes[i]);
+ }
+ return paths;
+ }
+
+ public static ITreeNode[] getPathToRoot(ITreeNode scoutNode, int depth) {
+ ITreeNode[] retNodes;
+ if (scoutNode == null) {
+ if (depth == 0) {
+ return null;
+ }
+ else {
+ retNodes = new ITreeNode[depth];
+ }
+ }
+ else {
+ depth++;
+ if (scoutNode.getParentNode() == null) {
+ retNodes = new ITreeNode[depth];
+ }
+ else {
+ retNodes = getPathToRoot(scoutNode.getParentNode(), depth);
+ }
+ retNodes[retNodes.length - depth] = scoutNode;
+ }
+ return retNodes;
+ }
+
+ /*
+ * private inner classes
+ */
+ private class P_ScoutTreeListener implements TreeListener {
+ @Override
+ public void treeChanged(final TreeEvent e) {
+ if (isHandleScoutTreeEvent(new TreeEvent[]{e})) {
+ if (isIgnoredScoutEvent(TreeEvent.class, "" + e.getType())) {
+ return;
+ }
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ try {
+ getUpdateUiFromScoutLock().acquire();
+ //
+ handleScoutTreeEventInUi(e);
+ }
+ finally {
+ getUpdateUiFromScoutLock().release();
+ }
+ }
+ };
+ getUiEnvironment().invokeUiLater(t);
+ }
+ }
+
+ @Override
+ public void treeChangedBatch(final TreeEvent[] a) {
+ if (isHandleScoutTreeEvent(a)) {
+ final ArrayList<TreeEvent> filteredList = new ArrayList<TreeEvent>();
+ for (TreeEvent element : a) {
+ if (!isIgnoredScoutEvent(TreeEvent.class, "" + element.getType())) {
+ filteredList.add(element);
+ }
+ }
+ if (filteredList.size() == 0) {
+ return;
+ }
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ try {
+ getUpdateUiFromScoutLock().acquire();
+ if (!getUiField().isDisposed()) {
+ getUiField().setRedraw(false);
+ }
+ //
+ handleScoutTreeEventBatchInUi(filteredList);
+ }
+ finally {
+ getUpdateUiFromScoutLock().release();
+ if (!getUiField().isDisposed()) {
+ getUiField().setRedraw(true);
+ }
+ }
+ }
+ };
+ getUiEnvironment().invokeUiLater(t);
+ }
+ }
+ }// end private class
+
+ private class P_RwtSelectionListener implements ISelectionChangedListener {
+ @Override
+ @SuppressWarnings("unchecked")
+ public void selectionChanged(SelectionChangedEvent event) {
+ if (isEnabledFromScout()) {
+ StructuredSelection sel = (StructuredSelection) event.getSelection();
+ ITreeNode[] nodes = (ITreeNode[]) sel.toList().toArray(new ITreeNode[sel.size()]);
+ setSelectionFromRwt(nodes);
+ }
+ }
+ } // end class P_RwtSelectionListener
+
+ private void showMenu(Point eventPosition) {
+ getUiField().setMenu(m_contextMenu);
+ getUiField().getMenu().addMenuListener(new MenuAdapter() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void menuHidden(MenuEvent e) {
+ getUiField().setMenu(null);
+ ((Menu) e.getSource()).removeMenuListener(this);
+ }
+ });
+ getUiField().getMenu().setLocation(eventPosition);
+ getUiField().getMenu().setVisible(true);
+ }
+
+ /**
+ * @param event
+ */
+ private void handleUiDoubleClick(StructuredSelection sel) {
+ @SuppressWarnings("unchecked")
+ ITreeNode[] nodes = (ITreeNode[]) sel.toList().toArray(new ITreeNode[sel.size()]);
+ if (nodes != null && nodes.length == 1) {
+ // if not leaf expand collapse
+ if (!nodes[0].isLeaf()) {
+ // invert expansion
+ setExpansionFromUi(nodes[0], !getUiTreeViewer().getExpandedState(nodes[0]));
+ }
+ else {
+ handleUiNodeAction(nodes[0]);
+ if (getScoutObject().isCheckable()) {
+ handleUiNodeClick(nodes[0]);
+ }
+ }
+ }
+ }
+
+ private class P_RwtTreeListener implements Listener {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void handleEvent(Event event) {
+ switch (event.type) {
+ case SWT.MouseUp: {
+ ViewerCell cell = getUiTreeViewer().getCell(new Point(event.x, event.y));
+ if (cell != null && cell.getElement() instanceof ITreeNode) {
+ ITreeNode nodeToClick = (ITreeNode) cell.getElement();
+ handleUiNodeClick(nodeToClick);
+ }
+ break;
+ }
+ case SWT.KeyUp: {
+ if (getScoutObject().isCheckable()) {
+ if (event.stateMask == 0) {
+ switch (event.keyCode) {
+ case ' ':
+ StructuredSelection sel = (StructuredSelection) getUiTreeViewer().getSelection();
+ @SuppressWarnings("unchecked")
+ ITreeNode[] nodes = (ITreeNode[]) sel.toList().toArray(new ITreeNode[sel.size()]);
+ if (nodes != null && nodes.length > 0) {
+ handleUiNodeClick(nodes[0]);
+ }
+ event.doit = false;
+ break;
+ }
+ }
+ }
+ break;
+ }
+ case SWT.Resize: {
+ updateScrollToSelectionFromScout();
+ break;
+ }
+ }
+ }
+ }
+
+ private class P_RwtExpansionListener implements ITreeViewerListener {
+ @Override
+ public void treeCollapsed(TreeExpansionEvent event) {
+ setExpansionFromUi((ITreeNode) event.getElement(), false);
+ }
+
+ @Override
+ public void treeExpanded(TreeExpansionEvent event) {
+ setExpansionFromUi((ITreeNode) event.getElement(), true);
+ }
+ } // end class P_RwtExpansionListener
+
+ /**
+ * @rn sle, 03.12.2010, ticket #97056
+ */
+ private class P_RwtKeyReturnAvoidDoubleClickListener extends RwtKeyStroke {
+ private static final long serialVersionUID = 1L;
+
+ public P_RwtKeyReturnAvoidDoubleClickListener() {
+ super(SWT.CR);
+ }
+
+ @Override
+ public void handleUiAction(Event e) {
+ //to avoid the postEvent(DoubleClickEvent) from Tree.WM_CHAR(...) set e.doit to false
+ e.doit = false;
+ }
+ } // end class P_RwtKeyReturnAvoidDoubleClickListener
+
+ private class P_RwtDoubleClickListener implements IDoubleClickListener {
+ @Override
+ public void doubleClick(DoubleClickEvent event) {
+ if (event.getSelection() instanceof StructuredSelection) {
+ StructuredSelection sel = (StructuredSelection) event.getSelection();
+ handleUiDoubleClick(sel);
+ }
+ }
+ }
+
+ private class P_ContextMenuListener extends MenuAdapterEx {
+ private static final long serialVersionUID = 1L;
+
+ public P_ContextMenuListener() {
+ super(RwtScoutTree.this.getUiTreeViewer().getTree(), RwtScoutTree.this.getUiTreeViewer().getTree().getParent());
+ }
+
+ @Override
+ protected Menu getContextMenu() {
+ return m_contextMenu;
+ }
+
+ @Override
+ protected void setContextMenu(Menu contextMenu) {
+ m_contextMenu = contextMenu;
+ }
+
+ @Override
+ public void menuShown(MenuEvent e) {
+ super.menuShown(e);
+
+ if (getScoutObject() == null || !isEnabledFromScout()) {
+ return;
+ }
+
+ final boolean emptySpace = (getUiField().getContextItem() == null);
+ IMenu[] menus = RwtMenuUtility.collectMenus(getScoutObject(), emptySpace, !emptySpace, getUiEnvironment());
+
+ RwtMenuUtility.fillContextMenu(menus, getUiEnvironment(), m_contextMenu);
+ }
+
+ } // end class P_ContextMenuListener
+
+ private class P_DndSupport extends AbstractRwtScoutDndSupport {
+ public P_DndSupport(IPropertyObserver scoutObject, IDNDSupport scoutDndSupportable, Control control) {
+ super(scoutObject, scoutDndSupportable, control, RwtScoutTree.this.getUiEnvironment());
+ }
+
+ @Override
+ protected TransferObject handleUiDragRequest() {
+ final Holder<TransferObject> result = new Holder<TransferObject>(TransferObject.class, null);
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ TransferObject scoutTransferable = getScoutObject().getUIFacade().fireNodesDragRequestFromUI();
+ result.setValue(scoutTransferable);
+ }
+ };
+ try {
+ getUiEnvironment().invokeScoutLater(t, 20000).join(20000);
+ }
+ catch (InterruptedException e) {
+ //nop
+ }
+ return result.getValue();
+ }
+
+ @Override
+ protected void handleUiDropAction(DropTargetEvent event, final TransferObject scoutTransferObject) {
+ Object dropTarget = event.item != null ? event.item.getData() : null;
+ final ITreeNode node = dropTarget instanceof ITreeNode ? (ITreeNode) dropTarget : null;
+ Runnable job = new Runnable() {
+ @Override
+ public void run() {
+ getScoutObject().getUIFacade().fireNodeDropActionFromUI(node, scoutTransferObject);
+ }
+ };
+ getUiEnvironment().invokeScoutLater(job, 200);
+ }
+ }// end class P_DndSupport
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/tree/RwtScoutTreeModel.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/tree/RwtScoutTreeModel.java
index ada5ac56d0..8e8c778205 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/tree/RwtScoutTreeModel.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/basic/tree/RwtScoutTreeModel.java
@@ -1,223 +1,223 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.basic.tree;
-
-import org.eclipse.jface.viewers.IColorProvider;
-import org.eclipse.jface.viewers.IFontProvider;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.rwt.RWT;
-import org.eclipse.scout.commons.NumberUtility;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.basic.cell.ICell;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITree;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
-import org.eclipse.scout.rt.ui.rap.RwtIcons;
-import org.eclipse.scout.rt.ui.rap.extension.UiDecorationExtensionPoint;
-import org.eclipse.scout.rt.ui.rap.util.HtmlTextUtility;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Tree;
-
-public class RwtScoutTreeModel extends LabelProvider implements ITreeContentProvider, IFontProvider, IColorProvider {
- private static final long serialVersionUID = 1L;
-
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(RwtScoutTreeModel.class);
-
- private final ITree m_scoutTree;
- private final IRwtScoutTree m_uiTree;
- private final TreeViewer m_treeViewer;
- private Image m_imgCheckboxTrue;
- private Image m_imgCheckboxFalse;
- private Color m_disabledForegroundColor;
- private final int m_defaultNodeHeight;
- private double[] m_htmlTableNodes = null;
-
- public RwtScoutTreeModel(ITree tree, IRwtScoutTree uiTree, TreeViewer treeViewer) {
- m_scoutTree = tree;
- m_uiTree = uiTree;
- m_treeViewer = treeViewer;
- m_imgCheckboxTrue = getUiTree().getUiEnvironment().getIcon(RwtIcons.CheckboxYes);
- m_imgCheckboxFalse = getUiTree().getUiEnvironment().getIcon(RwtIcons.CheckboxNo);
- m_disabledForegroundColor = getUiTree().getUiEnvironment().getColor(UiDecorationExtensionPoint.getLookAndFeel().getColorForegroundDisabled());
- m_defaultNodeHeight = UiDecorationExtensionPoint.getLookAndFeel().getTreeNodeHeight();
- }
-
- protected ITree getScoutTree() {
- return m_scoutTree;
- }
-
- private IRwtScoutTree getUiTree() {
- return m_uiTree;
- }
-
- @Override
- public Object[] getChildren(Object parentElement) {
- ITreeNode scoutNode = (ITreeNode) parentElement;
- return scoutNode.getFilteredChildNodes();
- }
-
- @Override
- public Object getParent(Object element) {
- ITreeNode scoutNode = (ITreeNode) element;
- return scoutNode.getParentNode();
- }
-
- @Override
- public boolean hasChildren(Object element) {
- ITreeNode scoutNode = (ITreeNode) element;
- return !scoutNode.isLeaf();
- }
-
- @Override
- public Object[] getElements(Object inputElement) {
- if (getScoutTree() != null) {
- if (getScoutTree().isRootNodeVisible()) {
- return new Object[]{getScoutTree().getRootNode()};
- }
- else {
- return getScoutTree().getRootNode().getFilteredChildNodes();
- }
- }
- else {
- return new Object[0];
- }
- }
-
- @Override
- public Image getImage(Object element) {
- ITreeNode scoutNode = (ITreeNode) element;
- if (scoutNode == null) {
- return null;
- } //check
- Image checkBoxImage = null;
- if (getScoutTree().isCheckable()) {
- if (scoutNode.isChecked()) {
- checkBoxImage = m_imgCheckboxTrue;
- }
- else {
- checkBoxImage = m_imgCheckboxFalse;
- }
- }
- //
- //deco
- String iconId = scoutNode.getCell().getIconId();
- Image decoImage = null;
- decoImage = getUiTree().getUiEnvironment().getIcon(iconId);
- //merge
- if (checkBoxImage != null && decoImage != null) {
- //TODO rap/rwt: new GC(Image) is not possible since in rwt an image does not implement Drawable.
- return checkBoxImage;
- }
- if (checkBoxImage != null) {
- return checkBoxImage;
- }
- if (decoImage != null) {
- return decoImage;
- }
- return null;
- }
-
- @Override
- public String getText(Object element) {
- ITreeNode scoutNode = (ITreeNode) element;
- if (scoutNode != null && scoutNode.getCell() != null) {
- ICell cell = scoutNode.getCell();
- String text = cell.getText();
- if (text == null) {
- text = "";
- }
-
- if (HtmlTextUtility.isTextWithHtmlMarkup(cell.getText())) {
- text = getUiTree().getUiEnvironment().adaptHtmlCell(getUiTree(), text);
- text = getUiTree().getUiEnvironment().convertLinksWithLocalUrlsInHtmlCell(getUiTree(), text);
-
- Tree tree = getUiTree().getUiField();
- if (HtmlTextUtility.isTextWithHtmlMarkup(cell.getText())) {
- if (m_htmlTableNodes == null || m_htmlTableNodes.length != getScoutTree().getRootNode().getChildNodeCount()) {
- double[] tempArray = new double[getScoutTree().getRootNode().getChildNodeCount()];
- for (int i = 0; i < tempArray.length; i++) {
- tempArray[i] = 1;
- }
- if (m_htmlTableNodes == null) {
- m_htmlTableNodes = tempArray;
- }
- else {
- getUiTree().getUiEnvironment().getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- getUiTree().getUiTreeViewer().refresh();
- }
- });
- m_htmlTableNodes = tempArray;
- }
- }
- m_htmlTableNodes[((ITreeNode) element).getChildNodeIndex()] = HtmlTextUtility.countHtmlTableRows(text);
- double medianHtmlTableRows = NumberUtility.median(m_htmlTableNodes);
- int htmlTreeNodeHeight = NumberUtility.toDouble(NumberUtility.round(medianHtmlTableRows, 1.0)).intValue() * 20;
- if (tree.getData(RWT.CUSTOM_ITEM_HEIGHT) == null
- || ((Integer) tree.getData(RWT.CUSTOM_ITEM_HEIGHT)).compareTo(htmlTreeNodeHeight) < 0) {
- tree.setData(RWT.CUSTOM_ITEM_HEIGHT, Double.valueOf(NumberUtility.max(getDefaultNodeHeight(), htmlTreeNodeHeight)).intValue());
- }
- }
- }
- else if (text.indexOf("\n") >= 0) {
- text = StringUtility.replace(text, "\n", " ");
- }
- return text;
- }
- return "";
- }
-
- protected int getDefaultNodeHeight() {
- return m_defaultNodeHeight;
- }
-
- @Override
- public Font getFont(Object element) {
- ITreeNode scoutNode = (ITreeNode) element;
- if (scoutNode.getCell().getFont() != null) {
- return getUiTree().getUiEnvironment().getFont(scoutNode.getCell().getFont(), m_treeViewer.getTree().getFont());
- }
- return null;
- }
-
- @Override
- public Color getForeground(Object element) {
- ITreeNode scoutNode = (ITreeNode) element;
- ICell scoutCell = scoutNode.getCell();
- Color col = getUiTree().getUiEnvironment().getColor(scoutCell.getForegroundColor());
- if (col == null) {
- if (!scoutCell.isEnabled()) {
- col = m_disabledForegroundColor;
- }
- }
- return col;
- }
-
- @Override
- public Color getBackground(Object element) {
- ITreeNode scoutNode = (ITreeNode) element;
- if (scoutNode.getCell().getBackgroundColor() != null) {
- return getUiTree().getUiEnvironment().getColor(scoutNode.getCell().getBackgroundColor());
- }
- return null;
- }
-
- @Override
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.basic.tree;
+
+import org.eclipse.jface.viewers.IColorProvider;
+import org.eclipse.jface.viewers.IFontProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.rwt.RWT;
+import org.eclipse.scout.commons.NumberUtility;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.basic.cell.ICell;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITree;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
+import org.eclipse.scout.rt.ui.rap.RwtIcons;
+import org.eclipse.scout.rt.ui.rap.extension.UiDecorationExtensionPoint;
+import org.eclipse.scout.rt.ui.rap.util.HtmlTextUtility;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Tree;
+
+public class RwtScoutTreeModel extends LabelProvider implements ITreeContentProvider, IFontProvider, IColorProvider {
+ private static final long serialVersionUID = 1L;
+
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(RwtScoutTreeModel.class);
+
+ private final ITree m_scoutTree;
+ private final IRwtScoutTree m_uiTree;
+ private final TreeViewer m_treeViewer;
+ private Image m_imgCheckboxTrue;
+ private Image m_imgCheckboxFalse;
+ private Color m_disabledForegroundColor;
+ private final int m_defaultNodeHeight;
+ private double[] m_htmlTableNodes = null;
+
+ public RwtScoutTreeModel(ITree tree, IRwtScoutTree uiTree, TreeViewer treeViewer) {
+ m_scoutTree = tree;
+ m_uiTree = uiTree;
+ m_treeViewer = treeViewer;
+ m_imgCheckboxTrue = getUiTree().getUiEnvironment().getIcon(RwtIcons.CheckboxYes);
+ m_imgCheckboxFalse = getUiTree().getUiEnvironment().getIcon(RwtIcons.CheckboxNo);
+ m_disabledForegroundColor = getUiTree().getUiEnvironment().getColor(UiDecorationExtensionPoint.getLookAndFeel().getColorForegroundDisabled());
+ m_defaultNodeHeight = UiDecorationExtensionPoint.getLookAndFeel().getTreeNodeHeight();
+ }
+
+ protected ITree getScoutTree() {
+ return m_scoutTree;
+ }
+
+ private IRwtScoutTree getUiTree() {
+ return m_uiTree;
+ }
+
+ @Override
+ public Object[] getChildren(Object parentElement) {
+ ITreeNode scoutNode = (ITreeNode) parentElement;
+ return scoutNode.getFilteredChildNodes();
+ }
+
+ @Override
+ public Object getParent(Object element) {
+ ITreeNode scoutNode = (ITreeNode) element;
+ return scoutNode.getParentNode();
+ }
+
+ @Override
+ public boolean hasChildren(Object element) {
+ ITreeNode scoutNode = (ITreeNode) element;
+ return !scoutNode.isLeaf();
+ }
+
+ @Override
+ public Object[] getElements(Object inputElement) {
+ if (getScoutTree() != null) {
+ if (getScoutTree().isRootNodeVisible()) {
+ return new Object[]{getScoutTree().getRootNode()};
+ }
+ else {
+ return getScoutTree().getRootNode().getFilteredChildNodes();
+ }
+ }
+ else {
+ return new Object[0];
+ }
+ }
+
+ @Override
+ public Image getImage(Object element) {
+ ITreeNode scoutNode = (ITreeNode) element;
+ if (scoutNode == null) {
+ return null;
+ } //check
+ Image checkBoxImage = null;
+ if (getScoutTree().isCheckable()) {
+ if (scoutNode.isChecked()) {
+ checkBoxImage = m_imgCheckboxTrue;
+ }
+ else {
+ checkBoxImage = m_imgCheckboxFalse;
+ }
+ }
+ //
+ //deco
+ String iconId = scoutNode.getCell().getIconId();
+ Image decoImage = null;
+ decoImage = getUiTree().getUiEnvironment().getIcon(iconId);
+ //merge
+ if (checkBoxImage != null && decoImage != null) {
+ //TODO rap/rwt: new GC(Image) is not possible since in rwt an image does not implement Drawable.
+ return checkBoxImage;
+ }
+ if (checkBoxImage != null) {
+ return checkBoxImage;
+ }
+ if (decoImage != null) {
+ return decoImage;
+ }
+ return null;
+ }
+
+ @Override
+ public String getText(Object element) {
+ ITreeNode scoutNode = (ITreeNode) element;
+ if (scoutNode != null && scoutNode.getCell() != null) {
+ ICell cell = scoutNode.getCell();
+ String text = cell.getText();
+ if (text == null) {
+ text = "";
+ }
+
+ if (HtmlTextUtility.isTextWithHtmlMarkup(cell.getText())) {
+ text = getUiTree().getUiEnvironment().adaptHtmlCell(getUiTree(), text);
+ text = getUiTree().getUiEnvironment().convertLinksWithLocalUrlsInHtmlCell(getUiTree(), text);
+
+ Tree tree = getUiTree().getUiField();
+ if (HtmlTextUtility.isTextWithHtmlMarkup(cell.getText())) {
+ if (m_htmlTableNodes == null || m_htmlTableNodes.length != getScoutTree().getRootNode().getChildNodeCount()) {
+ double[] tempArray = new double[getScoutTree().getRootNode().getChildNodeCount()];
+ for (int i = 0; i < tempArray.length; i++) {
+ tempArray[i] = 1;
+ }
+ if (m_htmlTableNodes == null) {
+ m_htmlTableNodes = tempArray;
+ }
+ else {
+ getUiTree().getUiEnvironment().getDisplay().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ getUiTree().getUiTreeViewer().refresh();
+ }
+ });
+ m_htmlTableNodes = tempArray;
+ }
+ }
+ m_htmlTableNodes[((ITreeNode) element).getChildNodeIndex()] = HtmlTextUtility.countHtmlTableRows(text);
+ double medianHtmlTableRows = NumberUtility.median(m_htmlTableNodes);
+ int htmlTreeNodeHeight = NumberUtility.toDouble(NumberUtility.round(medianHtmlTableRows, 1.0)).intValue() * 20;
+ if (tree.getData(RWT.CUSTOM_ITEM_HEIGHT) == null
+ || ((Integer) tree.getData(RWT.CUSTOM_ITEM_HEIGHT)).compareTo(htmlTreeNodeHeight) < 0) {
+ tree.setData(RWT.CUSTOM_ITEM_HEIGHT, Double.valueOf(NumberUtility.max(getDefaultNodeHeight(), htmlTreeNodeHeight)).intValue());
+ }
+ }
+ }
+ else if (text.indexOf("\n") >= 0) {
+ text = StringUtility.replace(text, "\n", " ");
+ }
+ return text;
+ }
+ return "";
+ }
+
+ protected int getDefaultNodeHeight() {
+ return m_defaultNodeHeight;
+ }
+
+ @Override
+ public Font getFont(Object element) {
+ ITreeNode scoutNode = (ITreeNode) element;
+ if (scoutNode.getCell().getFont() != null) {
+ return getUiTree().getUiEnvironment().getFont(scoutNode.getCell().getFont(), m_treeViewer.getTree().getFont());
+ }
+ return null;
+ }
+
+ @Override
+ public Color getForeground(Object element) {
+ ITreeNode scoutNode = (ITreeNode) element;
+ ICell scoutCell = scoutNode.getCell();
+ Color col = getUiTree().getUiEnvironment().getColor(scoutCell.getForegroundColor());
+ if (col == null) {
+ if (!scoutCell.isEnabled()) {
+ col = m_disabledForegroundColor;
+ }
+ }
+ return col;
+ }
+
+ @Override
+ public Color getBackground(Object element) {
+ ITreeNode scoutNode = (ITreeNode) element;
+ if (scoutNode.getCell().getBackgroundColor() != null) {
+ return getUiTree().getUiEnvironment().getColor(scoutNode.getCell().getBackgroundColor());
+ }
+ return null;
+ }
+
+ @Override
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/busy/BlockPartsJob.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/busy/BlockPartsJob.java
index 187126bcce..b0f896997d 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/busy/BlockPartsJob.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/busy/BlockPartsJob.java
@@ -1,113 +1,113 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.busy;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.client.busy.BusyJob;
-import org.eclipse.scout.rt.ui.rap.window.IRwtScoutPart;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-
-/**
- * Default RWT busy handler for a {@link IClientSession}
- *
- * @author imo
- * @since 3.8
- */
-public class BlockPartsJob extends BusyJob {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(BlockPartsJob.class);
-
- private final List<IRwtScoutPart> m_parts;
-
- public BlockPartsJob(String name, RwtBusyHandler handler, List<IRwtScoutPart> parts) {
- super(name, handler);
- setSystem(true);
- m_parts = parts;
- }
-
- @Override
- protected RwtBusyHandler getBusyHandler() {
- return (RwtBusyHandler) super.getBusyHandler();
- }
-
- @Override
- protected void runBusy(IProgressMonitor monitor) {
- //nop
- }
-
- /**
- * Show a stop button in the active form parts header section.
- * <p>
- * Do not show a wait cursor.
- */
- @Override
- protected void runBlocking(final IProgressMonitor monitor) {
- if (m_parts == null || m_parts.size() == 0) {
- return;
- }
- final ArrayList<RwtScoutPartBlockingDecorator> decoList = new ArrayList<RwtScoutPartBlockingDecorator>();
- final Display display = getBusyHandler().getDisplay();
- final Control busyControl = (Control) getBusyHandler().getUiEnvironment().getClientSession().getData(RwtBusyHandler.BUSY_CONTROL_CLIENT_SESSION_KEY);
- try {
- display.syncExec(new Runnable() {
- @Override
- public void run() {
- if (busyControl != null && !busyControl.isDisposed()) {
- busyControl.setVisible(true);
- }
- IRwtScoutPart activePart = m_parts.get(0);
- for (IRwtScoutPart p : m_parts) {
- if (p == null) {
- continue;
- }
- decoList.add(new RwtScoutPartBlockingDecorator(p, p == activePart, getBusyHandler().getUiEnvironment()));
- }
- for (RwtScoutPartBlockingDecorator deco : decoList) {
- try {
- deco.attach(monitor);
- }
- catch (Exception e1) {
- LOG.warn("attach", e1);
- }
- }
- }
- });
- //
- BlockPartsJob.super.runBlocking(monitor);
- //
- }
- finally {
- display.asyncExec(new Runnable() {
- @Override
- public void run() {
- if (busyControl != null && !busyControl.isDisposed()) {
- busyControl.setVisible(false);
- }
- for (RwtScoutPartBlockingDecorator deco : decoList) {
- try {
- deco.detach();
- }
- catch (Exception e1) {
- LOG.warn("detach", e1);
- }
- }
- }
- });
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.busy;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.client.busy.BusyJob;
+import org.eclipse.scout.rt.ui.rap.window.IRwtScoutPart;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * Default RWT busy handler for a {@link IClientSession}
+ *
+ * @author imo
+ * @since 3.8
+ */
+public class BlockPartsJob extends BusyJob {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(BlockPartsJob.class);
+
+ private final List<IRwtScoutPart> m_parts;
+
+ public BlockPartsJob(String name, RwtBusyHandler handler, List<IRwtScoutPart> parts) {
+ super(name, handler);
+ setSystem(true);
+ m_parts = parts;
+ }
+
+ @Override
+ protected RwtBusyHandler getBusyHandler() {
+ return (RwtBusyHandler) super.getBusyHandler();
+ }
+
+ @Override
+ protected void runBusy(IProgressMonitor monitor) {
+ //nop
+ }
+
+ /**
+ * Show a stop button in the active form parts header section.
+ * <p>
+ * Do not show a wait cursor.
+ */
+ @Override
+ protected void runBlocking(final IProgressMonitor monitor) {
+ if (m_parts == null || m_parts.size() == 0) {
+ return;
+ }
+ final ArrayList<RwtScoutPartBlockingDecorator> decoList = new ArrayList<RwtScoutPartBlockingDecorator>();
+ final Display display = getBusyHandler().getDisplay();
+ final Control busyControl = (Control) getBusyHandler().getUiEnvironment().getClientSession().getData(RwtBusyHandler.BUSY_CONTROL_CLIENT_SESSION_KEY);
+ try {
+ display.syncExec(new Runnable() {
+ @Override
+ public void run() {
+ if (busyControl != null && !busyControl.isDisposed()) {
+ busyControl.setVisible(true);
+ }
+ IRwtScoutPart activePart = m_parts.get(0);
+ for (IRwtScoutPart p : m_parts) {
+ if (p == null) {
+ continue;
+ }
+ decoList.add(new RwtScoutPartBlockingDecorator(p, p == activePart, getBusyHandler().getUiEnvironment()));
+ }
+ for (RwtScoutPartBlockingDecorator deco : decoList) {
+ try {
+ deco.attach(monitor);
+ }
+ catch (Exception e1) {
+ LOG.warn("attach", e1);
+ }
+ }
+ }
+ });
+ //
+ BlockPartsJob.super.runBlocking(monitor);
+ //
+ }
+ finally {
+ display.asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ if (busyControl != null && !busyControl.isDisposed()) {
+ busyControl.setVisible(false);
+ }
+ for (RwtScoutPartBlockingDecorator deco : decoList) {
+ try {
+ deco.detach();
+ }
+ catch (Exception e1) {
+ LOG.warn("detach", e1);
+ }
+ }
+ }
+ });
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/busy/RwtBusyHandler.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/busy/RwtBusyHandler.java
index eb0ccfe4fe..55892bd5f4 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/busy/RwtBusyHandler.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/busy/RwtBusyHandler.java
@@ -1,62 +1,62 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.busy;
-
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.client.busy.AbstractBusyHandler;
-import org.eclipse.scout.rt.shared.TEXTS;
-import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-
-/**
- * Default SWT busy handler for a {@link IClientSession}
- *
- * @author imo
- * @since 3.8
- */
-public class RwtBusyHandler extends AbstractBusyHandler {
-
- /**
- * Use this key to set a {@link Control} on {@link IClientSession#setData(String, Object)}.
- * <p>
- * This control is set visible/invisible when busy in on/off.
- */
- public static final String BUSY_CONTROL_CLIENT_SESSION_KEY = "RwtBusyHandler.busyControl";
-
- /**
- * This is the CSS key used to style the busy control in rwt
- */
- public static final String CUSTOM_VARIANT_CSS_NAME = "busyIndicator";
-
- private final IRwtEnvironment m_env;
- private final Display m_display;
-
- public RwtBusyHandler(IClientSession session, IRwtEnvironment env) {
- super(session);
- m_env = env;
- m_display = env.getDisplay();
- }
-
- public IRwtEnvironment getUiEnvironment() {
- return m_env;
- }
-
- public Display getDisplay() {
- return m_display;
- }
-
- @Override
- protected void runBusy(Job job) {
- new WaitForBlockingJob(TEXTS.get("BusyJob"), this).schedule();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.busy;
+
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.client.busy.AbstractBusyHandler;
+import org.eclipse.scout.rt.shared.TEXTS;
+import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * Default SWT busy handler for a {@link IClientSession}
+ *
+ * @author imo
+ * @since 3.8
+ */
+public class RwtBusyHandler extends AbstractBusyHandler {
+
+ /**
+ * Use this key to set a {@link Control} on {@link IClientSession#setData(String, Object)}.
+ * <p>
+ * This control is set visible/invisible when busy in on/off.
+ */
+ public static final String BUSY_CONTROL_CLIENT_SESSION_KEY = "RwtBusyHandler.busyControl";
+
+ /**
+ * This is the CSS key used to style the busy control in rwt
+ */
+ public static final String CUSTOM_VARIANT_CSS_NAME = "busyIndicator";
+
+ private final IRwtEnvironment m_env;
+ private final Display m_display;
+
+ public RwtBusyHandler(IClientSession session, IRwtEnvironment env) {
+ super(session);
+ m_env = env;
+ m_display = env.getDisplay();
+ }
+
+ public IRwtEnvironment getUiEnvironment() {
+ return m_env;
+ }
+
+ public Display getDisplay() {
+ return m_display;
+ }
+
+ @Override
+ protected void runBusy(Job job) {
+ new WaitForBlockingJob(TEXTS.get("BusyJob"), this).schedule();
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/busy/RwtScoutPartBlockingDecorator.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/busy/RwtScoutPartBlockingDecorator.java
index e306292664..5852da75e2 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/busy/RwtScoutPartBlockingDecorator.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/busy/RwtScoutPartBlockingDecorator.java
@@ -1,137 +1,137 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.busy;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.ContributionItem;
-import org.eclipse.jface.action.IContributionItem;
-import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
-import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
-import org.eclipse.scout.rt.ui.rap.window.IRwtScoutPart;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.ToolBar;
-import org.eclipse.swt.widgets.ToolItem;
-import org.eclipse.ui.forms.widgets.Form;
-
-/**
- * Decorates a {@link IRwtScoutPart}'s {@link IRwtScoutPart#getRwtForm()} header section with a progress bar and a
- * button
- */
-public class RwtScoutPartBlockingDecorator {
- private static final String ATTACH_MARKER_DATA = RwtScoutPartBlockingDecorator.class.getName() + "#marker";
-
- private final IRwtScoutPart m_part;
- private final boolean m_showCancelButton;
- private boolean m_attached;
- private final IRwtEnvironment m_env;
- private Control m_oldFocus;
- private IContributionItem m_cancelAction;
-
- public RwtScoutPartBlockingDecorator(IRwtScoutPart part, boolean showCancelButton, IRwtEnvironment env) {
- m_part = part;
- m_showCancelButton = showCancelButton;
- m_env = env;
- }
-
- public void attach(final IProgressMonitor monitor) {
- Form rwtForm = m_part.getUiForm();
- if (rwtForm == null || rwtForm.isDisposed()) {
- return;
- }
- if (rwtForm.getData(ATTACH_MARKER_DATA) != null) {
- return;
- }
- m_attached = true;
- rwtForm.setData(ATTACH_MARKER_DATA, true);
- //backup focus
- Control focusControl = Display.getCurrent().getFocusControl();
- if (focusControl != null) {
- if (RwtUtility.isAncestorOf(rwtForm, focusControl)) {
- m_oldFocus = focusControl;
- }
- }
- //show cancel button
- if (m_showCancelButton) {
- if (m_cancelAction != null) {
- m_cancelAction.dispose();
- }
- m_cancelAction = new ContributionItem() {
- private static final long serialVersionUID = 1L;
- private ToolItem m_item;
-
- @Override
- public void fill(ToolBar parent, int index) {
- if (m_item == null) {
- m_item = new ToolItem(parent, SWT.NONE, index);
- m_item.setText(RwtUtility.getNlsText(Display.getCurrent(), "BusyBlockingMessage"));
- m_item.setImage(m_env.getIcon("progress_stop"));
- //[swt cannot show text right of image] m_item.setText(RwtUtility.getNlsText(Display.getCurrent(), "Cancel"));
- m_item.addSelectionListener(new SelectionAdapter() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- monitor.setCanceled(true);
- ((ToolItem) e.getSource()).setEnabled(false);
- }
- });
- }
- }
-
- @Override
- public void dispose() {
- if (m_item != null) {
- m_item.dispose();
- m_item = null;
- }
- }
- };
- rwtForm.getToolBarManager().add(m_cancelAction);
- rwtForm.getToolBarManager().update(true);
- }
- rwtForm.getBody().setEnabled(false);
- rwtForm.layout(true);
- //there is a central busy spinner/ rwtForm.setBusy(true);
- }
-
- public void detach() {
- if (!m_attached) {
- return;
- }
- m_attached = false;
- Form rwtForm = m_part.getUiForm();
- if (rwtForm == null || rwtForm.isDisposed()) {
- return;
- }
- rwtForm.setData(ATTACH_MARKER_DATA, null);
- //hide cancel button
- if (m_cancelAction != null) {
- rwtForm.getToolBarManager().remove(m_cancelAction);
- m_cancelAction.dispose();
- m_cancelAction = null;
- rwtForm.getToolBarManager().update(true);
- }
- rwtForm.getBody().setEnabled(true);
- rwtForm.layout(true);
- //restore focus
- if (m_oldFocus != null && !m_oldFocus.isDisposed()) {
- if (m_part.isActive()) {
- m_oldFocus.forceFocus();
- m_oldFocus = null;
- }
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.busy;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.action.ContributionItem;
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
+import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
+import org.eclipse.scout.rt.ui.rap.window.IRwtScoutPart;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.swt.widgets.ToolItem;
+import org.eclipse.ui.forms.widgets.Form;
+
+/**
+ * Decorates a {@link IRwtScoutPart}'s {@link IRwtScoutPart#getRwtForm()} header section with a progress bar and a
+ * button
+ */
+public class RwtScoutPartBlockingDecorator {
+ private static final String ATTACH_MARKER_DATA = RwtScoutPartBlockingDecorator.class.getName() + "#marker";
+
+ private final IRwtScoutPart m_part;
+ private final boolean m_showCancelButton;
+ private boolean m_attached;
+ private final IRwtEnvironment m_env;
+ private Control m_oldFocus;
+ private IContributionItem m_cancelAction;
+
+ public RwtScoutPartBlockingDecorator(IRwtScoutPart part, boolean showCancelButton, IRwtEnvironment env) {
+ m_part = part;
+ m_showCancelButton = showCancelButton;
+ m_env = env;
+ }
+
+ public void attach(final IProgressMonitor monitor) {
+ Form rwtForm = m_part.getUiForm();
+ if (rwtForm == null || rwtForm.isDisposed()) {
+ return;
+ }
+ if (rwtForm.getData(ATTACH_MARKER_DATA) != null) {
+ return;
+ }
+ m_attached = true;
+ rwtForm.setData(ATTACH_MARKER_DATA, true);
+ //backup focus
+ Control focusControl = Display.getCurrent().getFocusControl();
+ if (focusControl != null) {
+ if (RwtUtility.isAncestorOf(rwtForm, focusControl)) {
+ m_oldFocus = focusControl;
+ }
+ }
+ //show cancel button
+ if (m_showCancelButton) {
+ if (m_cancelAction != null) {
+ m_cancelAction.dispose();
+ }
+ m_cancelAction = new ContributionItem() {
+ private static final long serialVersionUID = 1L;
+ private ToolItem m_item;
+
+ @Override
+ public void fill(ToolBar parent, int index) {
+ if (m_item == null) {
+ m_item = new ToolItem(parent, SWT.NONE, index);
+ m_item.setText(RwtUtility.getNlsText(Display.getCurrent(), "BusyBlockingMessage"));
+ m_item.setImage(m_env.getIcon("progress_stop"));
+ //[swt cannot show text right of image] m_item.setText(RwtUtility.getNlsText(Display.getCurrent(), "Cancel"));
+ m_item.addSelectionListener(new SelectionAdapter() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ monitor.setCanceled(true);
+ ((ToolItem) e.getSource()).setEnabled(false);
+ }
+ });
+ }
+ }
+
+ @Override
+ public void dispose() {
+ if (m_item != null) {
+ m_item.dispose();
+ m_item = null;
+ }
+ }
+ };
+ rwtForm.getToolBarManager().add(m_cancelAction);
+ rwtForm.getToolBarManager().update(true);
+ }
+ rwtForm.getBody().setEnabled(false);
+ rwtForm.layout(true);
+ //there is a central busy spinner/ rwtForm.setBusy(true);
+ }
+
+ public void detach() {
+ if (!m_attached) {
+ return;
+ }
+ m_attached = false;
+ Form rwtForm = m_part.getUiForm();
+ if (rwtForm == null || rwtForm.isDisposed()) {
+ return;
+ }
+ rwtForm.setData(ATTACH_MARKER_DATA, null);
+ //hide cancel button
+ if (m_cancelAction != null) {
+ rwtForm.getToolBarManager().remove(m_cancelAction);
+ m_cancelAction.dispose();
+ m_cancelAction = null;
+ rwtForm.getToolBarManager().update(true);
+ }
+ rwtForm.getBody().setEnabled(true);
+ rwtForm.layout(true);
+ //restore focus
+ if (m_oldFocus != null && !m_oldFocus.isDisposed()) {
+ if (m_part.isActive()) {
+ m_oldFocus.forceFocus();
+ m_oldFocus = null;
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/busy/WaitForBlockingJob.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/busy/WaitForBlockingJob.java
index 19dcff0a1d..6b0054c7e8 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/busy/WaitForBlockingJob.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/busy/WaitForBlockingJob.java
@@ -1,141 +1,141 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.busy;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.client.busy.BusyJob;
-import org.eclipse.scout.rt.ui.rap.window.IRwtScoutPart;
-import org.eclipse.scout.rt.ui.rap.window.dialog.RwtScoutDialog;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-
-/**
- * Default RWT busy handler for a {@link IClientSession}
- *
- * @author imo
- * @since 3.8
- */
-public class WaitForBlockingJob extends BusyJob {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(WaitForBlockingJob.class);
-
- private List<IRwtScoutPart> m_parts;
-
- public WaitForBlockingJob(String name, RwtBusyHandler handler) {
- super(name, handler);
- }
-
- @Override
- protected RwtBusyHandler getBusyHandler() {
- return (RwtBusyHandler) super.getBusyHandler();
- }
-
- /**
- * Show a wait cursor until long operation timeout
- */
- @Override
- protected void runBusy(final IProgressMonitor monitor) {
- Display display = getBusyHandler().getDisplay();
- final Control busyControl = (Control) getBusyHandler().getUiEnvironment().getClientSession().getData(RwtBusyHandler.BUSY_CONTROL_CLIENT_SESSION_KEY);
- try {
- if (display != null && !display.isDisposed()) {
- display.syncExec(new Runnable() {
- @Override
- public void run() {
- m_parts = findAffectedParts();
- if (busyControl != null && !busyControl.isDisposed()) {
- busyControl.setVisible(true);
- }
- }
- });
- }
- //
- super.runBusy(monitor);
- }
- finally {
- if (display != null && !display.isDisposed()) {
- display.asyncExec(new Runnable() {
- @Override
- public void run() {
- if (busyControl != null && !busyControl.isDisposed()) {
- busyControl.setVisible(false);
- }
- }
- });
- }
- }
- }
-
- @Override
- protected void runBlocking(IProgressMonitor monitor) {
- //schedule blocking job
- new BlockPartsJob(getName(), getBusyHandler(), m_parts).schedule();
- }
-
- /**
- * @return all affected parts in the same swt / scout environment (user session). The first part is the active part
- * and may be null.
- */
- protected List<IRwtScoutPart> findAffectedParts() {
- ArrayList<IRwtScoutPart> candidateParts = new ArrayList<IRwtScoutPart>();
- for (IRwtScoutPart part : getBusyHandler().getUiEnvironment().getOpenFormParts()) {
- if (isDialogPart(part) || isViewOrEditorPart(part)) {
- candidateParts.add(part);
- }
- }
- ArrayList<IRwtScoutPart> affectedParts = new ArrayList<IRwtScoutPart>();
- //find an active dialog, it would be the only affected item
- for (IRwtScoutPart part : candidateParts) {
- if (part.isActive() && isDialogPart(part)) {
- affectedParts.add(part);
- return affectedParts;
- }
- }
- //find a visible dialog, it would be the only affected item
- for (IRwtScoutPart part : candidateParts) {
- if (part.isActive() && isDialogPart(part)) {
- affectedParts.add(part);
- return affectedParts;
- }
- }
- //find an active view, also all other views are affected
- for (IRwtScoutPart part : candidateParts) {
- if (part.isActive() && isViewOrEditorPart(part)) {
- affectedParts.addAll(candidateParts);
- affectedParts.remove(part);
- affectedParts.add(0, part);
- return affectedParts;
- }
- }
- //all views are affected, none shows a cancel button
- affectedParts.add(null);
- affectedParts.addAll(candidateParts);
- return affectedParts;
- }
-
- public static boolean isDialogPart(IRwtScoutPart part) {
- return (part instanceof RwtScoutDialog);
- }
-
- public static boolean isViewOrEditorPart(IRwtScoutPart part) {
- return part != null && !part.getClass().getSimpleName().contains("Popup");
- }
-
- protected List<IRwtScoutPart> getParts() {
- return m_parts;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.busy;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.client.busy.BusyJob;
+import org.eclipse.scout.rt.ui.rap.window.IRwtScoutPart;
+import org.eclipse.scout.rt.ui.rap.window.dialog.RwtScoutDialog;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * Default RWT busy handler for a {@link IClientSession}
+ *
+ * @author imo
+ * @since 3.8
+ */
+public class WaitForBlockingJob extends BusyJob {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(WaitForBlockingJob.class);
+
+ private List<IRwtScoutPart> m_parts;
+
+ public WaitForBlockingJob(String name, RwtBusyHandler handler) {
+ super(name, handler);
+ }
+
+ @Override
+ protected RwtBusyHandler getBusyHandler() {
+ return (RwtBusyHandler) super.getBusyHandler();
+ }
+
+ /**
+ * Show a wait cursor until long operation timeout
+ */
+ @Override
+ protected void runBusy(final IProgressMonitor monitor) {
+ Display display = getBusyHandler().getDisplay();
+ final Control busyControl = (Control) getBusyHandler().getUiEnvironment().getClientSession().getData(RwtBusyHandler.BUSY_CONTROL_CLIENT_SESSION_KEY);
+ try {
+ if (display != null && !display.isDisposed()) {
+ display.syncExec(new Runnable() {
+ @Override
+ public void run() {
+ m_parts = findAffectedParts();
+ if (busyControl != null && !busyControl.isDisposed()) {
+ busyControl.setVisible(true);
+ }
+ }
+ });
+ }
+ //
+ super.runBusy(monitor);
+ }
+ finally {
+ if (display != null && !display.isDisposed()) {
+ display.asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ if (busyControl != null && !busyControl.isDisposed()) {
+ busyControl.setVisible(false);
+ }
+ }
+ });
+ }
+ }
+ }
+
+ @Override
+ protected void runBlocking(IProgressMonitor monitor) {
+ //schedule blocking job
+ new BlockPartsJob(getName(), getBusyHandler(), m_parts).schedule();
+ }
+
+ /**
+ * @return all affected parts in the same swt / scout environment (user session). The first part is the active part
+ * and may be null.
+ */
+ protected List<IRwtScoutPart> findAffectedParts() {
+ ArrayList<IRwtScoutPart> candidateParts = new ArrayList<IRwtScoutPart>();
+ for (IRwtScoutPart part : getBusyHandler().getUiEnvironment().getOpenFormParts()) {
+ if (isDialogPart(part) || isViewOrEditorPart(part)) {
+ candidateParts.add(part);
+ }
+ }
+ ArrayList<IRwtScoutPart> affectedParts = new ArrayList<IRwtScoutPart>();
+ //find an active dialog, it would be the only affected item
+ for (IRwtScoutPart part : candidateParts) {
+ if (part.isActive() && isDialogPart(part)) {
+ affectedParts.add(part);
+ return affectedParts;
+ }
+ }
+ //find a visible dialog, it would be the only affected item
+ for (IRwtScoutPart part : candidateParts) {
+ if (part.isActive() && isDialogPart(part)) {
+ affectedParts.add(part);
+ return affectedParts;
+ }
+ }
+ //find an active view, also all other views are affected
+ for (IRwtScoutPart part : candidateParts) {
+ if (part.isActive() && isViewOrEditorPart(part)) {
+ affectedParts.addAll(candidateParts);
+ affectedParts.remove(part);
+ affectedParts.add(0, part);
+ return affectedParts;
+ }
+ }
+ //all views are affected, none shows a cancel button
+ affectedParts.add(null);
+ affectedParts.addAll(candidateParts);
+ return affectedParts;
+ }
+
+ public static boolean isDialogPart(IRwtScoutPart part) {
+ return (part instanceof RwtScoutDialog);
+ }
+
+ public static boolean isViewOrEditorPart(IRwtScoutPart part) {
+ return part != null && !part.getClass().getSimpleName().contains("Popup");
+ }
+
+ protected List<IRwtScoutPart> getParts() {
+ return m_parts;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/concurrency/ConcurrencyQueue.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/concurrency/ConcurrencyQueue.java
index 1bf718f509..c42c15d4c3 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/concurrency/ConcurrencyQueue.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/concurrency/ConcurrencyQueue.java
@@ -1,184 +1,184 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.concurrency;
-
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-
-class ConcurrencyQueue {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(ConcurrencyQueue.class);
- private static long seqNoProvider;
-
- private long m_seqNo;
- private Object m_queueChangeLock;
- private boolean m_closed;
- private String m_name;
- private String m_infoCached;
- private Object m_listLock = new Object();
- private LinkedList<Runnable> m_list = new LinkedList<Runnable>();
- private LinkedList<Runnable> m_dispatchingList = new LinkedList<Runnable>();
-
- public ConcurrencyQueue(String name, Object queueChangeLock) {
- m_seqNo = seqNoProvider++;
- if (queueChangeLock == null) {
- queueChangeLock = new Object();
- }
- m_queueChangeLock = queueChangeLock;
- m_name = name;
- updateInternalInfo();
- }
-
- public boolean isEmpty() {
- synchronized (m_listLock) {
- return m_list.size() + m_dispatchingList.size() == 0;
- }
- }
-
- public void close() {
- m_closed = true;
- synchronized (m_listLock) {
- m_listLock.notifyAll();
- }
- synchronized (m_queueChangeLock) {
- m_queueChangeLock.notifyAll();
- }
- }
-
- public boolean isClosed() {
- return m_closed;
- }
-
- public void add(Runnable r) {
- if (r != null) {
- synchronized (m_listLock) {
- if (LOG.isDebugEnabled()) LOG.debug(m_infoCached + " add: " + r);
- m_list.add(r);
- updateInternalInfo();
- m_listLock.notifyAll();
- }
- synchronized (m_queueChangeLock) {
- m_queueChangeLock.notifyAll();
- }
- }
- }
-
- /**
- * @return true if element could be removed
- */
- public boolean remove(Runnable r) {
- if (r != null) {
- boolean ok;
- synchronized (m_listLock) {
- ok = m_list.remove(r);
- updateInternalInfo();
- m_listLock.notifyAll();
- }
- synchronized (m_queueChangeLock) {
- m_queueChangeLock.notifyAll();
- }
- return ok;
- }
- return false;
- }
-
- public boolean isPending(Runnable r) {
- if (r != null) {
- synchronized (m_listLock) {
- return m_dispatchingList.contains(r) || m_list.contains(r);
- }
- }
- return false;
- }
-
- /**
- * does not block
- */
- public boolean hasNext() {
- synchronized (m_listLock) {
- return !m_list.isEmpty();
- }
- }
-
- public List<Runnable> removeAllJobs() {
- synchronized (m_listLock) {
- ArrayList<Runnable> a = new ArrayList<Runnable>(m_list);
- m_list.clear();
- return a;
- }
- }
-
- /**
- * block at most waitTime millis
- */
- public boolean hasNext(long waitTime) {
- long deadline = System.currentTimeMillis() + waitTime;
- synchronized (m_listLock) {
- while (m_list.isEmpty()) {
- long dt = deadline - System.currentTimeMillis();
- if (dt > 0) {
- try {
- m_listLock.wait(dt);
- }
- catch (InterruptedException e) {
- }
- }
- else {
- break;
- }
- }
- return !m_list.isEmpty();
- }
- }
-
- public void dispatchNext() {
- Runnable r = null;
- synchronized (m_listLock) {
- if (!m_list.isEmpty()) {
- r = m_list.removeFirst();
- m_dispatchingList.add(r);
- }
- }
- if (r != null) {
- try {
- long startTime = System.currentTimeMillis();
- if (LOG.isDebugEnabled()) LOG.debug(m_infoCached + " dispatchStart: " + r);
- r.run();
- if (LOG.isDebugEnabled()) LOG.debug(m_infoCached + " dispatchEnd " + (System.currentTimeMillis() - startTime) + " ms: " + r);
- }
- catch (Throwable t) {
- LOG.error(null, t);
- }
- synchronized (m_listLock) {
- m_dispatchingList.remove(r);
- updateInternalInfo();
- m_listLock.notifyAll();
- }
- synchronized (m_queueChangeLock) {
- m_queueChangeLock.notifyAll();
- }
- }
- }
-
- private void updateInternalInfo() {
- int a = m_list.size();
- int b = m_dispatchingList.size();
- m_infoCached = m_name + "#" + m_seqNo + "[" + a + (b > 0 ? "+" + b : "") + " jobs]";
- }
-
- @Override
- public String toString() {
- return m_infoCached;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.concurrency;
+
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+
+class ConcurrencyQueue {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(ConcurrencyQueue.class);
+ private static long seqNoProvider;
+
+ private long m_seqNo;
+ private Object m_queueChangeLock;
+ private boolean m_closed;
+ private String m_name;
+ private String m_infoCached;
+ private Object m_listLock = new Object();
+ private LinkedList<Runnable> m_list = new LinkedList<Runnable>();
+ private LinkedList<Runnable> m_dispatchingList = new LinkedList<Runnable>();
+
+ public ConcurrencyQueue(String name, Object queueChangeLock) {
+ m_seqNo = seqNoProvider++;
+ if (queueChangeLock == null) {
+ queueChangeLock = new Object();
+ }
+ m_queueChangeLock = queueChangeLock;
+ m_name = name;
+ updateInternalInfo();
+ }
+
+ public boolean isEmpty() {
+ synchronized (m_listLock) {
+ return m_list.size() + m_dispatchingList.size() == 0;
+ }
+ }
+
+ public void close() {
+ m_closed = true;
+ synchronized (m_listLock) {
+ m_listLock.notifyAll();
+ }
+ synchronized (m_queueChangeLock) {
+ m_queueChangeLock.notifyAll();
+ }
+ }
+
+ public boolean isClosed() {
+ return m_closed;
+ }
+
+ public void add(Runnable r) {
+ if (r != null) {
+ synchronized (m_listLock) {
+ if (LOG.isDebugEnabled()) LOG.debug(m_infoCached + " add: " + r);
+ m_list.add(r);
+ updateInternalInfo();
+ m_listLock.notifyAll();
+ }
+ synchronized (m_queueChangeLock) {
+ m_queueChangeLock.notifyAll();
+ }
+ }
+ }
+
+ /**
+ * @return true if element could be removed
+ */
+ public boolean remove(Runnable r) {
+ if (r != null) {
+ boolean ok;
+ synchronized (m_listLock) {
+ ok = m_list.remove(r);
+ updateInternalInfo();
+ m_listLock.notifyAll();
+ }
+ synchronized (m_queueChangeLock) {
+ m_queueChangeLock.notifyAll();
+ }
+ return ok;
+ }
+ return false;
+ }
+
+ public boolean isPending(Runnable r) {
+ if (r != null) {
+ synchronized (m_listLock) {
+ return m_dispatchingList.contains(r) || m_list.contains(r);
+ }
+ }
+ return false;
+ }
+
+ /**
+ * does not block
+ */
+ public boolean hasNext() {
+ synchronized (m_listLock) {
+ return !m_list.isEmpty();
+ }
+ }
+
+ public List<Runnable> removeAllJobs() {
+ synchronized (m_listLock) {
+ ArrayList<Runnable> a = new ArrayList<Runnable>(m_list);
+ m_list.clear();
+ return a;
+ }
+ }
+
+ /**
+ * block at most waitTime millis
+ */
+ public boolean hasNext(long waitTime) {
+ long deadline = System.currentTimeMillis() + waitTime;
+ synchronized (m_listLock) {
+ while (m_list.isEmpty()) {
+ long dt = deadline - System.currentTimeMillis();
+ if (dt > 0) {
+ try {
+ m_listLock.wait(dt);
+ }
+ catch (InterruptedException e) {
+ }
+ }
+ else {
+ break;
+ }
+ }
+ return !m_list.isEmpty();
+ }
+ }
+
+ public void dispatchNext() {
+ Runnable r = null;
+ synchronized (m_listLock) {
+ if (!m_list.isEmpty()) {
+ r = m_list.removeFirst();
+ m_dispatchingList.add(r);
+ }
+ }
+ if (r != null) {
+ try {
+ long startTime = System.currentTimeMillis();
+ if (LOG.isDebugEnabled()) LOG.debug(m_infoCached + " dispatchStart: " + r);
+ r.run();
+ if (LOG.isDebugEnabled()) LOG.debug(m_infoCached + " dispatchEnd " + (System.currentTimeMillis() - startTime) + " ms: " + r);
+ }
+ catch (Throwable t) {
+ LOG.error(null, t);
+ }
+ synchronized (m_listLock) {
+ m_dispatchingList.remove(r);
+ updateInternalInfo();
+ m_listLock.notifyAll();
+ }
+ synchronized (m_queueChangeLock) {
+ m_queueChangeLock.notifyAll();
+ }
+ }
+ }
+
+ private void updateInternalInfo() {
+ int a = m_list.size();
+ int b = m_dispatchingList.size();
+ m_infoCached = m_name + "#" + m_seqNo + "[" + a + (b > 0 ? "+" + b : "") + " jobs]";
+ }
+
+ @Override
+ public String toString() {
+ return m_infoCached;
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/concurrency/LoopDetector.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/concurrency/LoopDetector.java
index 2acba7ccd2..2b85aafd3c 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/concurrency/LoopDetector.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/concurrency/LoopDetector.java
@@ -1,68 +1,68 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.concurrency;
-
-import java.util.LinkedList;
-
-/**
- * counts hits within a timeframe and compares count to a suspicious size
- * <p>
- * Detects based on an enter/exit hysteresis.
- */
-public class LoopDetector {
- private long m_ttl;
- private int m_detectSize;
- private int m_releaseSize;
- private boolean m_armed;
- private LinkedList<Long> m_samples;
-
- public LoopDetector(long ttlMillis, int detectSize, int releaseSize) {
- m_ttl = ttlMillis;
- m_detectSize = detectSize;
- m_releaseSize = releaseSize;
- m_samples = new LinkedList<Long>();
- }
-
- /**
- * injectable timestamp creator, can be overrwritten for unit testing
- * <p>
- * default returns {@link System#currentTimeMillis()}
- */
- protected long createTimestamp() {
- return System.currentTimeMillis();
- }
-
- public synchronized void addSample() {
- long ts = createTimestamp();
- while (m_samples.size() > 0 && m_samples.getFirst() + m_ttl < ts) {
- m_samples.removeFirst();
- }
- m_samples.add(ts);
- if (m_armed) {
- if (m_samples.size() <= m_releaseSize) {
- m_armed = false;
- }
- }
- else {
- if (m_samples.size() > m_detectSize) {
- m_armed = true;
- }
- }
- }
-
- public boolean isArmed() {
- return m_armed;
- }
-
- public int getSampleCount() {
- return m_samples.size();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.concurrency;
+
+import java.util.LinkedList;
+
+/**
+ * counts hits within a timeframe and compares count to a suspicious size
+ * <p>
+ * Detects based on an enter/exit hysteresis.
+ */
+public class LoopDetector {
+ private long m_ttl;
+ private int m_detectSize;
+ private int m_releaseSize;
+ private boolean m_armed;
+ private LinkedList<Long> m_samples;
+
+ public LoopDetector(long ttlMillis, int detectSize, int releaseSize) {
+ m_ttl = ttlMillis;
+ m_detectSize = detectSize;
+ m_releaseSize = releaseSize;
+ m_samples = new LinkedList<Long>();
+ }
+
+ /**
+ * injectable timestamp creator, can be overrwritten for unit testing
+ * <p>
+ * default returns {@link System#currentTimeMillis()}
+ */
+ protected long createTimestamp() {
+ return System.currentTimeMillis();
+ }
+
+ public synchronized void addSample() {
+ long ts = createTimestamp();
+ while (m_samples.size() > 0 && m_samples.getFirst() + m_ttl < ts) {
+ m_samples.removeFirst();
+ }
+ m_samples.add(ts);
+ if (m_armed) {
+ if (m_samples.size() <= m_releaseSize) {
+ m_armed = false;
+ }
+ }
+ else {
+ if (m_samples.size() > m_detectSize) {
+ m_armed = true;
+ }
+ }
+ }
+
+ public boolean isArmed() {
+ return m_armed;
+ }
+
+ public int getSampleCount() {
+ return m_samples.size();
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/concurrency/RwtScoutSynchronizer.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/concurrency/RwtScoutSynchronizer.java
index 98c0722d76..95ba1105d6 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/concurrency/RwtScoutSynchronizer.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/concurrency/RwtScoutSynchronizer.java
@@ -1,105 +1,105 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.concurrency;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.scout.commons.job.JobEx;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ClientSyncJob;
-import org.eclipse.scout.rt.client.IClientSession;
-import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
-import org.eclipse.swt.widgets.Display;
-
-public class RwtScoutSynchronizer {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(RwtScoutSynchronizer.class);
-
- private final IRwtEnvironment m_uiEnvironment;
- private final Display m_rwtQueue;
- //loop detection from rwt to scout
- private LoopDetector m_loopDetector;
-
- public RwtScoutSynchronizer(IRwtEnvironment uiEnvironment) {
- m_uiEnvironment = uiEnvironment;
- m_rwtQueue = m_uiEnvironment.getDisplay();
- m_loopDetector = new LoopDetector(5000L, 2500, 10);
- }
-
- private boolean isModelThread() {
- return ClientSyncJob.getCurrentSession() == m_uiEnvironment.getClientSession() && ClientSyncJob.isSyncClientJob();
- }
-
- public JobEx invokeScoutLater(final Runnable j, long cancelTimeout) {
- if (isModelThread()) {
- LOG.warn("queueing scout runnable into scout thread: " + j);
- j.run();
- return null;
- }
- else if (Thread.currentThread() != m_rwtQueue.getThread()) {
- throw new IllegalStateException("queueing scout runnable from outside rwt thread: " + j);
- }
- //
- m_loopDetector.addSample();
- if (m_loopDetector.isArmed()) {
- LOG.warn("loop detection: " + j, new Exception("Loop detected"));
- return null;
- }
- //send job
- final long deadLine = cancelTimeout > 0 ? System.currentTimeMillis() + cancelTimeout : -1;
- ClientSyncJob eclipseJob = new ClientSyncJob("Swing post::" + j, m_uiEnvironment.getClientSession()) {
- @Override
- protected void runVoid(IProgressMonitor monitor) throws Throwable {
- if (deadLine < 0 || deadLine > System.currentTimeMillis()) {
- j.run();
- }
- }
- };
- eclipseJob.schedule();
- return eclipseJob;
- }
-
- /**
- * calling from scout thread
- */
- public void invokeUiLater(Runnable j) {
- if (m_rwtQueue.isDisposed()) {
- return;
- }
- if (Thread.currentThread() == m_rwtQueue.getThread()) {
- LOG.warn("queueing rwt runnable into rwt thread: " + j);
- j.run();
- return;
- }
- else {
- IClientSession currentSession = ClientSyncJob.getCurrentSession();
- IClientSession uiClientSession = m_uiEnvironment.getClientSession();
- if (currentSession != uiClientSession) {
- String currentUserId = currentSession == null ? "" : currentSession.getUserId();
- String currentWebSessionId = currentSession == null ? "" : currentSession.getVirtualSessionId();
- String uiClientUserId = uiClientSession == null ? "" : uiClientSession.getUserId();
- String uiClientWebSessionId = uiClientSession == null ? "" : uiClientSession.getVirtualSessionId();
- LOG.error("Wrong ClientSession.\n" +
- "CurrentSession: {0}\tUserId: {2}\tWebSesionId: {3}\n" +
- "EnvironmentClientSession: {4}\tUserId: {5}\tWebSesionId: {5}",
- new Object[]{
- currentSession == null ? "" : currentSession, currentUserId, currentWebSessionId,
- uiClientSession == null ? "" : uiClientSession, uiClientUserId, uiClientWebSessionId});
- throw new IllegalStateException("queueing rwt runnable from outside scout thread: " + j);
- }
- }
- if (!isModelThread()) {
- throw new IllegalStateException("queueing rwt runnable from outside scout thread: " + j);
- }
- //
- m_rwtQueue.asyncExec(j);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.concurrency;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.scout.commons.job.JobEx;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ClientSyncJob;
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
+import org.eclipse.swt.widgets.Display;
+
+public class RwtScoutSynchronizer {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(RwtScoutSynchronizer.class);
+
+ private final IRwtEnvironment m_uiEnvironment;
+ private final Display m_rwtQueue;
+ //loop detection from rwt to scout
+ private LoopDetector m_loopDetector;
+
+ public RwtScoutSynchronizer(IRwtEnvironment uiEnvironment) {
+ m_uiEnvironment = uiEnvironment;
+ m_rwtQueue = m_uiEnvironment.getDisplay();
+ m_loopDetector = new LoopDetector(5000L, 2500, 10);
+ }
+
+ private boolean isModelThread() {
+ return ClientSyncJob.getCurrentSession() == m_uiEnvironment.getClientSession() && ClientSyncJob.isSyncClientJob();
+ }
+
+ public JobEx invokeScoutLater(final Runnable j, long cancelTimeout) {
+ if (isModelThread()) {
+ LOG.warn("queueing scout runnable into scout thread: " + j);
+ j.run();
+ return null;
+ }
+ else if (Thread.currentThread() != m_rwtQueue.getThread()) {
+ throw new IllegalStateException("queueing scout runnable from outside rwt thread: " + j);
+ }
+ //
+ m_loopDetector.addSample();
+ if (m_loopDetector.isArmed()) {
+ LOG.warn("loop detection: " + j, new Exception("Loop detected"));
+ return null;
+ }
+ //send job
+ final long deadLine = cancelTimeout > 0 ? System.currentTimeMillis() + cancelTimeout : -1;
+ ClientSyncJob eclipseJob = new ClientSyncJob("Swing post::" + j, m_uiEnvironment.getClientSession()) {
+ @Override
+ protected void runVoid(IProgressMonitor monitor) throws Throwable {
+ if (deadLine < 0 || deadLine > System.currentTimeMillis()) {
+ j.run();
+ }
+ }
+ };
+ eclipseJob.schedule();
+ return eclipseJob;
+ }
+
+ /**
+ * calling from scout thread
+ */
+ public void invokeUiLater(Runnable j) {
+ if (m_rwtQueue.isDisposed()) {
+ return;
+ }
+ if (Thread.currentThread() == m_rwtQueue.getThread()) {
+ LOG.warn("queueing rwt runnable into rwt thread: " + j);
+ j.run();
+ return;
+ }
+ else {
+ IClientSession currentSession = ClientSyncJob.getCurrentSession();
+ IClientSession uiClientSession = m_uiEnvironment.getClientSession();
+ if (currentSession != uiClientSession) {
+ String currentUserId = currentSession == null ? "" : currentSession.getUserId();
+ String currentWebSessionId = currentSession == null ? "" : currentSession.getVirtualSessionId();
+ String uiClientUserId = uiClientSession == null ? "" : uiClientSession.getUserId();
+ String uiClientWebSessionId = uiClientSession == null ? "" : uiClientSession.getVirtualSessionId();
+ LOG.error("Wrong ClientSession.\n" +
+ "CurrentSession: {0}\tUserId: {2}\tWebSesionId: {3}\n" +
+ "EnvironmentClientSession: {4}\tUserId: {5}\tWebSesionId: {5}",
+ new Object[]{
+ currentSession == null ? "" : currentSession, currentUserId, currentWebSessionId,
+ uiClientSession == null ? "" : uiClientSession, uiClientUserId, uiClientWebSessionId});
+ throw new IllegalStateException("queueing rwt runnable from outside scout thread: " + j);
+ }
+ }
+ if (!isModelThread()) {
+ throw new IllegalStateException("queueing rwt runnable from outside scout thread: " + j);
+ }
+ //
+ m_rwtQueue.asyncExec(j);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/ButtonEx.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/ButtonEx.java
index d965ec7054..ab0c8f010d 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/ButtonEx.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/ButtonEx.java
@@ -1,231 +1,231 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.ext;
-
-import java.util.ArrayList;
-
-import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Menu;
-
-/**
- * <h3>ButtonEx</h3> added the context menu to the button
- *
- * @since 3.7.0 June 2011
- */
-public class ButtonEx extends Button {
- private static final long serialVersionUID = 1L;
-
- public static final int SELECTION_ACTION = 44;
- public static final int SELECTION_MENU = 45;
-
- private boolean m_hasDropDown;
- private boolean m_dropDownEnabled;
-
- private Object m_listenerLock = new Object();
- private Listener[] m_actionSelectionListener;
- private Listener[] m_menuSelectionListener;
-
- public ButtonEx(Composite parent, int style) {
- super(parent, style);
- // dropdown
- P_DelegateSelectionListener delegateListener = new P_DelegateSelectionListener();
- if ((style & SWT.DROP_DOWN) != 0) {
- m_hasDropDown = true;
- super.addListener(SWT.MouseUp, delegateListener);
- }
- super.addListener(SWT.Selection, delegateListener);
- }
-
- private IRwtEnvironment getUiEnvironment() {
- return (IRwtEnvironment) getDisplay().getData(IRwtEnvironment.class.getName());
- }
-
- @Override
- public void addListener(int eventType, Listener listener) {
- switch (eventType) {
- case SELECTION_ACTION:
- m_actionSelectionListener = addListenerToList(listener, m_actionSelectionListener);
- break;
- case SELECTION_MENU:
- m_menuSelectionListener = addListenerToList(listener, m_menuSelectionListener);
- break;
- default:
- super.addListener(eventType, listener);
- break;
- }
- }
-
- @Override
- public void removeListener(int eventType, Listener listener) {
- switch (eventType) {
- case SELECTION_ACTION:
- m_actionSelectionListener = removeListenerFromList(listener, m_actionSelectionListener);
- break;
- case SELECTION_MENU:
- m_menuSelectionListener = removeListenerFromList(listener, m_menuSelectionListener);
- break;
- default:
- super.removeListener(eventType, listener);
- break;
- }
- }
-
- private Listener[] addListenerToList(Listener l, Listener[] arr) {
- synchronized (m_listenerLock) {
- if (arr == null) {
- arr = new Listener[1];
- arr[0] = l;
- }
- else {
- Listener[] newArr = new Listener[arr.length + 1];
- System.arraycopy(arr, 0, newArr, 0, arr.length);
- arr = newArr;
- arr[arr.length - 1] = l;
- }
- return arr;
- }
- }
-
- private Listener[] removeListenerFromList(Listener l, Listener[] arr) {
- synchronized (m_listenerLock) {
- if (arr == null) {
- return arr;
- }
- else {
- ArrayList<Listener> newList = new ArrayList<Listener>();
- for (Listener ref : arr) {
- if (!ref.equals(l)) {
- newList.add(ref);
- }
- }
- arr = newList.toArray(new Listener[newList.size()]);
- }
- return arr;
- }
- }
-
- private void fireMenuSelection(Event e) {
- int backupedType = e.type;
- try {
- e.type = SELECTION_MENU;
- synchronized (m_listenerLock) {
- if (m_menuSelectionListener != null) {
- for (Listener l : m_menuSelectionListener) {
- l.handleEvent(e);
- }
- }
- }
- }
- finally {
- e.type = backupedType;
- }
- }
-
- private void fireActionSelection(Event e) {
- if (m_actionSelectionListener != null) {
- int backupedType = e.type;
- try {
- e.type = SELECTION_ACTION;
- synchronized (m_listenerLock) {
- for (Listener l : m_actionSelectionListener) {
- l.handleEvent(e);
- }
- }
- }
- finally {
- e.type = backupedType;
- }
- }
- }
-
- public void setDropDownEnabled(boolean enabled) {
- m_dropDownEnabled = enabled;
- }
-
- public boolean isDropDownEnabled() {
- return m_dropDownEnabled;
- }
-
- @Override
- protected void checkSubclass() {
- // allow subclassing
- }
-
- protected void handleButtonSelection(Event event) {
- fireActionSelection(event);
- }
-
- protected void handlePopupSelectionEvent(Event e) {
- if (m_dropDownEnabled) {
- Menu menu = getMenu();
- if (menu != null) {
- menu.setVisible(true);
- }
- }
- fireMenuSelection(e);
- }
-
- public void handleButtonSelectionFromKeyStroke(Event event) {
- event.widget = this;
- handleButtonSelection(event);
- }
-
- private class P_DelegateSelectionListener implements Listener {
- private static final long serialVersionUID = 1L;
- private long timeLastEvent = 0L;
-
- @Override
- public void handleEvent(Event event) {
- switch (event.type) {
- case SWT.MouseUp: {
- if (timeLastEvent != 0L && timeLastEvent == event.time) {
- return;
- }
- timeLastEvent = event.time;
- switch (event.button) {
- case 1:
- // left mouse button
- if (event.x > (getBounds().width - 12)) {
- // popup
- handlePopupSelectionEvent(event);
- }
- else {
- handleButtonSelection(event);
- }
- break;
- case 3:
- // right mouse button
- // void
- break;
- default:
- break;
- }
- break;
- }
- case SWT.Selection: {
- if (timeLastEvent != 0L && timeLastEvent == event.time) {
- return;
- }
- timeLastEvent = event.time;
- handleButtonSelection(event);
- break;
- }
- default:
- break;
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.ext;
+
+import java.util.ArrayList;
+
+import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Menu;
+
+/**
+ * <h3>ButtonEx</h3> added the context menu to the button
+ *
+ * @since 3.7.0 June 2011
+ */
+public class ButtonEx extends Button {
+ private static final long serialVersionUID = 1L;
+
+ public static final int SELECTION_ACTION = 44;
+ public static final int SELECTION_MENU = 45;
+
+ private boolean m_hasDropDown;
+ private boolean m_dropDownEnabled;
+
+ private Object m_listenerLock = new Object();
+ private Listener[] m_actionSelectionListener;
+ private Listener[] m_menuSelectionListener;
+
+ public ButtonEx(Composite parent, int style) {
+ super(parent, style);
+ // dropdown
+ P_DelegateSelectionListener delegateListener = new P_DelegateSelectionListener();
+ if ((style & SWT.DROP_DOWN) != 0) {
+ m_hasDropDown = true;
+ super.addListener(SWT.MouseUp, delegateListener);
+ }
+ super.addListener(SWT.Selection, delegateListener);
+ }
+
+ private IRwtEnvironment getUiEnvironment() {
+ return (IRwtEnvironment) getDisplay().getData(IRwtEnvironment.class.getName());
+ }
+
+ @Override
+ public void addListener(int eventType, Listener listener) {
+ switch (eventType) {
+ case SELECTION_ACTION:
+ m_actionSelectionListener = addListenerToList(listener, m_actionSelectionListener);
+ break;
+ case SELECTION_MENU:
+ m_menuSelectionListener = addListenerToList(listener, m_menuSelectionListener);
+ break;
+ default:
+ super.addListener(eventType, listener);
+ break;
+ }
+ }
+
+ @Override
+ public void removeListener(int eventType, Listener listener) {
+ switch (eventType) {
+ case SELECTION_ACTION:
+ m_actionSelectionListener = removeListenerFromList(listener, m_actionSelectionListener);
+ break;
+ case SELECTION_MENU:
+ m_menuSelectionListener = removeListenerFromList(listener, m_menuSelectionListener);
+ break;
+ default:
+ super.removeListener(eventType, listener);
+ break;
+ }
+ }
+
+ private Listener[] addListenerToList(Listener l, Listener[] arr) {
+ synchronized (m_listenerLock) {
+ if (arr == null) {
+ arr = new Listener[1];
+ arr[0] = l;
+ }
+ else {
+ Listener[] newArr = new Listener[arr.length + 1];
+ System.arraycopy(arr, 0, newArr, 0, arr.length);
+ arr = newArr;
+ arr[arr.length - 1] = l;
+ }
+ return arr;
+ }
+ }
+
+ private Listener[] removeListenerFromList(Listener l, Listener[] arr) {
+ synchronized (m_listenerLock) {
+ if (arr == null) {
+ return arr;
+ }
+ else {
+ ArrayList<Listener> newList = new ArrayList<Listener>();
+ for (Listener ref : arr) {
+ if (!ref.equals(l)) {
+ newList.add(ref);
+ }
+ }
+ arr = newList.toArray(new Listener[newList.size()]);
+ }
+ return arr;
+ }
+ }
+
+ private void fireMenuSelection(Event e) {
+ int backupedType = e.type;
+ try {
+ e.type = SELECTION_MENU;
+ synchronized (m_listenerLock) {
+ if (m_menuSelectionListener != null) {
+ for (Listener l : m_menuSelectionListener) {
+ l.handleEvent(e);
+ }
+ }
+ }
+ }
+ finally {
+ e.type = backupedType;
+ }
+ }
+
+ private void fireActionSelection(Event e) {
+ if (m_actionSelectionListener != null) {
+ int backupedType = e.type;
+ try {
+ e.type = SELECTION_ACTION;
+ synchronized (m_listenerLock) {
+ for (Listener l : m_actionSelectionListener) {
+ l.handleEvent(e);
+ }
+ }
+ }
+ finally {
+ e.type = backupedType;
+ }
+ }
+ }
+
+ public void setDropDownEnabled(boolean enabled) {
+ m_dropDownEnabled = enabled;
+ }
+
+ public boolean isDropDownEnabled() {
+ return m_dropDownEnabled;
+ }
+
+ @Override
+ protected void checkSubclass() {
+ // allow subclassing
+ }
+
+ protected void handleButtonSelection(Event event) {
+ fireActionSelection(event);
+ }
+
+ protected void handlePopupSelectionEvent(Event e) {
+ if (m_dropDownEnabled) {
+ Menu menu = getMenu();
+ if (menu != null) {
+ menu.setVisible(true);
+ }
+ }
+ fireMenuSelection(e);
+ }
+
+ public void handleButtonSelectionFromKeyStroke(Event event) {
+ event.widget = this;
+ handleButtonSelection(event);
+ }
+
+ private class P_DelegateSelectionListener implements Listener {
+ private static final long serialVersionUID = 1L;
+ private long timeLastEvent = 0L;
+
+ @Override
+ public void handleEvent(Event event) {
+ switch (event.type) {
+ case SWT.MouseUp: {
+ if (timeLastEvent != 0L && timeLastEvent == event.time) {
+ return;
+ }
+ timeLastEvent = event.time;
+ switch (event.button) {
+ case 1:
+ // left mouse button
+ if (event.x > (getBounds().width - 12)) {
+ // popup
+ handlePopupSelectionEvent(event);
+ }
+ else {
+ handleButtonSelection(event);
+ }
+ break;
+ case 3:
+ // right mouse button
+ // void
+ break;
+ default:
+ break;
+ }
+ break;
+ }
+ case SWT.Selection: {
+ if (timeLastEvent != 0L && timeLastEvent == event.time) {
+ return;
+ }
+ timeLastEvent = event.time;
+ handleButtonSelection(event);
+ break;
+ }
+ default:
+ break;
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/DropDownButton.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/DropDownButton.java
index 234786e63a..05d14630ab 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/DropDownButton.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/DropDownButton.java
@@ -1,282 +1,282 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.ext;
-
-import java.util.Date;
-
-import org.eclipse.rwt.lifecycle.WidgetUtil;
-import org.eclipse.scout.commons.EventListenerList;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
-import org.eclipse.scout.rt.ui.rap.basic.AbstractOpenMenuJob;
-import org.eclipse.scout.rt.ui.rap.keystroke.RwtKeyStroke;
-import org.eclipse.scout.rt.ui.rap.util.BrowserInfo;
-import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.FocusAdapter;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-
-public class DropDownButton extends Button implements IDropDownButtonForPatch {
- private static final long serialVersionUID = 1L;
-
- private Rectangle m_buttonArea = new Rectangle(1, 1, 13, 17);
- private Rectangle m_dropDownArea = new Rectangle(14, 1, 10, 17);
- private EventListenerList m_eventListeners = new EventListenerList();
-
- private Point m_mouseDownPosition;
- private boolean m_dropdownEnabled = true;
- private boolean m_buttonEnabled = true;
-
- private String m_originalVariant = "";
-
- public DropDownButton(Composite parent, int style) {
- super(parent, style | SWT.DOUBLE_BUFFERED);
-
- addListener(SWT.Traverse, new Listener() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void handleEvent(Event e) {
- switch (e.detail) {
- /* Do tab group traversal */
- case SWT.TRAVERSE_ESCAPE:
- case SWT.TRAVERSE_RETURN:
- case SWT.TRAVERSE_TAB_NEXT:
- case SWT.TRAVERSE_TAB_PREVIOUS:
- e.doit = true;
- break;
- }
- }
- });
- getUiEnvironment().addKeyStroke(this, new P_KeyStroke(' '), false);
- getUiEnvironment().addKeyStroke(this, new P_KeyStroke(SWT.CR), false);
- getUiEnvironment().addKeyStroke(this, new P_KeyStroke(SWT.ARROW_DOWN), false);
-
- addFocusListener(new FocusAdapter() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void focusGained(FocusEvent e) {
- redraw();
- }
-
- @Override
- public void focusLost(FocusEvent e) {
- redraw();
- }
- });
- addMouseListener(new MouseAdapter() {
- private static final long serialVersionUID = 1L;
-
- private long m_mouseDownTime = 0;
- private P_OpenMenuJob m_openMenuJob = new P_OpenMenuJob(DropDownButton.this);
-
- @Override
- public void mouseDown(MouseEvent event) {
- m_mouseDownPosition = new Point(event.x, event.y);
- if (isDropdownEnabled()) {
- m_mouseDownTime = new Date().getTime();
- m_openMenuJob.startOpenJob(m_mouseDownPosition);
- }
- redraw();
- }
-
- @Override
- public void mouseUp(MouseEvent event) {
- if (event.button == 1) {
- BrowserInfo browserInfo = RwtUtility.getBrowserInfo();
- if (browserInfo.isTablet()
- || browserInfo.isMobile()) {
- long mouseUpTime = new Date().getTime();
- if (mouseUpTime - m_mouseDownTime <= 500L) {
- m_openMenuJob.stopOpenJob();
- }
- }
- handleSelectionInternal(event);
- }
- m_mouseDownPosition = null;
- redraw();
- }
- });
-
- addDisposeListener(new DisposeListener() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void widgetDisposed(DisposeEvent e) {
- // remove key strokes
- getUiEnvironment().removeKeyStrokes(DropDownButton.this);
- }
- });
- }
-
- /**
- * since tab list on parent does not work
- */
- @Override
- public boolean forceFocus() {
- if ((getStyle() & SWT.NO_FOCUS) != 0) {
- return false;
- }
- else {
- return super.forceFocus();
- }
- }
-
- protected void handleSelectionInternal(MouseEvent event) {
- Point pt = new Point(event.x, event.y);
- if (m_buttonArea.contains(pt)) {
- Event e = new Event();
- e.button = event.button;
- e.count = 1;
- e.data = event.data;
- e.display = event.display;
- e.stateMask = event.stateMask;
- e.time = event.time;
- e.widget = event.widget;
- e.x = event.x;
- e.y = event.y;
- fireSelectionEvent(new SelectionEvent(e));
- }
- else if (m_dropDownArea.contains(pt) && isDropdownEnabled()) {
- if (getMenu() != null) {
- getMenu().setLocation(toDisplay(event.x, event.y));
- getMenu().setVisible(true);
- }
- }
- }
-
- @Override
- public void fireSelectionEvent(SelectionEvent e) {
- if (isButtonEnabled()) {
- for (SelectionListener l : m_eventListeners.getListeners(SelectionListener.class)) {
- l.widgetSelected(e);
- }
- }
- }
-
- @Override
- public void addSelectionListener(SelectionListener listener) {
- m_eventListeners.add(SelectionListener.class, listener);
- }
-
- @Override
- public void removeSelectionListener(SelectionListener listener) {
- m_eventListeners.remove(SelectionListener.class, listener);
- }
-
- @Override
- public void setDropdownEnabled(boolean enabled) {
- m_dropdownEnabled = enabled;
- if (!StringUtility.hasText(m_originalVariant)) {
- m_originalVariant = (String) getData(WidgetUtil.CUSTOM_VARIANT);
- }
- String customVariant = m_dropdownEnabled ? m_originalVariant + "_menu" : m_originalVariant;
- setData(WidgetUtil.CUSTOM_VARIANT, customVariant);
- super.setEnabled(isButtonEnabled());
- redraw();
- }
-
- @Override
- public boolean isDropdownEnabled() {
- return m_dropdownEnabled;
- }
-
- @Override
- public void setButtonEnabled(boolean enabled) {
- m_buttonEnabled = enabled;
- super.setEnabled(isButtonEnabled());
- redraw();
- }
-
- @Override
- public boolean isButtonEnabled() {
- return m_buttonEnabled;
- }
-
- @Override
- public void setEnabled(boolean enabled) {
- super.setEnabled(enabled);
- m_buttonEnabled = enabled;
- m_dropdownEnabled = enabled;
- redraw();
- }
-
- @Override
- protected void checkSubclass() {
- // allow subclassing
- }
-
- private IRwtEnvironment getUiEnvironment() {
- return (IRwtEnvironment) getDisplay().getData(IRwtEnvironment.class.getName());
- }
-
- private class P_KeyStroke extends RwtKeyStroke {
- public P_KeyStroke(int keyCode) {
- super(keyCode);
- }
-
- @Override
- public void handleUiAction(Event e) {
- switch (e.keyCode) {
- case ' ':
- case SWT.CR: {
- SelectionEvent selEvent = new SelectionEvent(e);
- fireSelectionEvent(selEvent);
- break;
- }
- case SWT.ARROW_DOWN: {
- if (isDropdownEnabled() && getMenu() != null) {
- getMenu().setLocation(toDisplay(e.x, e.y));
- getMenu().setVisible(true);
- }
- break;
- }
- default:
- break;
- }
- }
- }
-
- private final class P_OpenMenuJob extends AbstractOpenMenuJob {
-
- public P_OpenMenuJob(Control UiField) {
- super(UiField);
- }
-
- @Override
- public void showMenu(Point pt) {
- getMenu().setLocation(pt);
- getMenu().setVisible(true);
- }
-
- @Override
- public boolean openMenuCheck() {
- return isDropdownEnabled()
- && !isDisposed()
- && getMenu() != null
- && !getMenu().isDisposed();
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.ext;
+
+import java.util.Date;
+
+import org.eclipse.rwt.lifecycle.WidgetUtil;
+import org.eclipse.scout.commons.EventListenerList;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
+import org.eclipse.scout.rt.ui.rap.basic.AbstractOpenMenuJob;
+import org.eclipse.scout.rt.ui.rap.keystroke.RwtKeyStroke;
+import org.eclipse.scout.rt.ui.rap.util.BrowserInfo;
+import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.FocusAdapter;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+
+public class DropDownButton extends Button implements IDropDownButtonForPatch {
+ private static final long serialVersionUID = 1L;
+
+ private Rectangle m_buttonArea = new Rectangle(1, 1, 13, 17);
+ private Rectangle m_dropDownArea = new Rectangle(14, 1, 10, 17);
+ private EventListenerList m_eventListeners = new EventListenerList();
+
+ private Point m_mouseDownPosition;
+ private boolean m_dropdownEnabled = true;
+ private boolean m_buttonEnabled = true;
+
+ private String m_originalVariant = "";
+
+ public DropDownButton(Composite parent, int style) {
+ super(parent, style | SWT.DOUBLE_BUFFERED);
+
+ addListener(SWT.Traverse, new Listener() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void handleEvent(Event e) {
+ switch (e.detail) {
+ /* Do tab group traversal */
+ case SWT.TRAVERSE_ESCAPE:
+ case SWT.TRAVERSE_RETURN:
+ case SWT.TRAVERSE_TAB_NEXT:
+ case SWT.TRAVERSE_TAB_PREVIOUS:
+ e.doit = true;
+ break;
+ }
+ }
+ });
+ getUiEnvironment().addKeyStroke(this, new P_KeyStroke(' '), false);
+ getUiEnvironment().addKeyStroke(this, new P_KeyStroke(SWT.CR), false);
+ getUiEnvironment().addKeyStroke(this, new P_KeyStroke(SWT.ARROW_DOWN), false);
+
+ addFocusListener(new FocusAdapter() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void focusGained(FocusEvent e) {
+ redraw();
+ }
+
+ @Override
+ public void focusLost(FocusEvent e) {
+ redraw();
+ }
+ });
+ addMouseListener(new MouseAdapter() {
+ private static final long serialVersionUID = 1L;
+
+ private long m_mouseDownTime = 0;
+ private P_OpenMenuJob m_openMenuJob = new P_OpenMenuJob(DropDownButton.this);
+
+ @Override
+ public void mouseDown(MouseEvent event) {
+ m_mouseDownPosition = new Point(event.x, event.y);
+ if (isDropdownEnabled()) {
+ m_mouseDownTime = new Date().getTime();
+ m_openMenuJob.startOpenJob(m_mouseDownPosition);
+ }
+ redraw();
+ }
+
+ @Override
+ public void mouseUp(MouseEvent event) {
+ if (event.button == 1) {
+ BrowserInfo browserInfo = RwtUtility.getBrowserInfo();
+ if (browserInfo.isTablet()
+ || browserInfo.isMobile()) {
+ long mouseUpTime = new Date().getTime();
+ if (mouseUpTime - m_mouseDownTime <= 500L) {
+ m_openMenuJob.stopOpenJob();
+ }
+ }
+ handleSelectionInternal(event);
+ }
+ m_mouseDownPosition = null;
+ redraw();
+ }
+ });
+
+ addDisposeListener(new DisposeListener() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void widgetDisposed(DisposeEvent e) {
+ // remove key strokes
+ getUiEnvironment().removeKeyStrokes(DropDownButton.this);
+ }
+ });
+ }
+
+ /**
+ * since tab list on parent does not work
+ */
+ @Override
+ public boolean forceFocus() {
+ if ((getStyle() & SWT.NO_FOCUS) != 0) {
+ return false;
+ }
+ else {
+ return super.forceFocus();
+ }
+ }
+
+ protected void handleSelectionInternal(MouseEvent event) {
+ Point pt = new Point(event.x, event.y);
+ if (m_buttonArea.contains(pt)) {
+ Event e = new Event();
+ e.button = event.button;
+ e.count = 1;
+ e.data = event.data;
+ e.display = event.display;
+ e.stateMask = event.stateMask;
+ e.time = event.time;
+ e.widget = event.widget;
+ e.x = event.x;
+ e.y = event.y;
+ fireSelectionEvent(new SelectionEvent(e));
+ }
+ else if (m_dropDownArea.contains(pt) && isDropdownEnabled()) {
+ if (getMenu() != null) {
+ getMenu().setLocation(toDisplay(event.x, event.y));
+ getMenu().setVisible(true);
+ }
+ }
+ }
+
+ @Override
+ public void fireSelectionEvent(SelectionEvent e) {
+ if (isButtonEnabled()) {
+ for (SelectionListener l : m_eventListeners.getListeners(SelectionListener.class)) {
+ l.widgetSelected(e);
+ }
+ }
+ }
+
+ @Override
+ public void addSelectionListener(SelectionListener listener) {
+ m_eventListeners.add(SelectionListener.class, listener);
+ }
+
+ @Override
+ public void removeSelectionListener(SelectionListener listener) {
+ m_eventListeners.remove(SelectionListener.class, listener);
+ }
+
+ @Override
+ public void setDropdownEnabled(boolean enabled) {
+ m_dropdownEnabled = enabled;
+ if (!StringUtility.hasText(m_originalVariant)) {
+ m_originalVariant = (String) getData(WidgetUtil.CUSTOM_VARIANT);
+ }
+ String customVariant = m_dropdownEnabled ? m_originalVariant + "_menu" : m_originalVariant;
+ setData(WidgetUtil.CUSTOM_VARIANT, customVariant);
+ super.setEnabled(isButtonEnabled());
+ redraw();
+ }
+
+ @Override
+ public boolean isDropdownEnabled() {
+ return m_dropdownEnabled;
+ }
+
+ @Override
+ public void setButtonEnabled(boolean enabled) {
+ m_buttonEnabled = enabled;
+ super.setEnabled(isButtonEnabled());
+ redraw();
+ }
+
+ @Override
+ public boolean isButtonEnabled() {
+ return m_buttonEnabled;
+ }
+
+ @Override
+ public void setEnabled(boolean enabled) {
+ super.setEnabled(enabled);
+ m_buttonEnabled = enabled;
+ m_dropdownEnabled = enabled;
+ redraw();
+ }
+
+ @Override
+ protected void checkSubclass() {
+ // allow subclassing
+ }
+
+ private IRwtEnvironment getUiEnvironment() {
+ return (IRwtEnvironment) getDisplay().getData(IRwtEnvironment.class.getName());
+ }
+
+ private class P_KeyStroke extends RwtKeyStroke {
+ public P_KeyStroke(int keyCode) {
+ super(keyCode);
+ }
+
+ @Override
+ public void handleUiAction(Event e) {
+ switch (e.keyCode) {
+ case ' ':
+ case SWT.CR: {
+ SelectionEvent selEvent = new SelectionEvent(e);
+ fireSelectionEvent(selEvent);
+ break;
+ }
+ case SWT.ARROW_DOWN: {
+ if (isDropdownEnabled() && getMenu() != null) {
+ getMenu().setLocation(toDisplay(e.x, e.y));
+ getMenu().setVisible(true);
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ }
+ }
+
+ private final class P_OpenMenuJob extends AbstractOpenMenuJob {
+
+ public P_OpenMenuJob(Control UiField) {
+ super(UiField);
+ }
+
+ @Override
+ public void showMenu(Point pt) {
+ getMenu().setLocation(pt);
+ getMenu().setVisible(true);
+ }
+
+ @Override
+ public boolean openMenuCheck() {
+ return isDropdownEnabled()
+ && !isDisposed()
+ && getMenu() != null
+ && !getMenu().isDisposed();
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/DropDownFileUpload.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/DropDownFileUpload.java
index e80fc5129c..97ab59f3b9 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/DropDownFileUpload.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/DropDownFileUpload.java
@@ -1,219 +1,219 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.ext;
-
-import org.eclipse.rwt.lifecycle.WidgetUtil;
-import org.eclipse.rwt.widgets.FileUpload;
-import org.eclipse.scout.commons.EventListenerList;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
-import org.eclipse.scout.rt.ui.rap.keystroke.RwtKeyStroke;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.FocusAdapter;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-
-public class DropDownFileUpload extends FileUpload implements IDropDownFileUploadForPatch {
- private static final long serialVersionUID = 1L;
-
- private Rectangle m_buttonArea = new Rectangle(1, 1, 13, 17);
- private Rectangle m_dropDownArea = new Rectangle(14, 1, 10, 17);
- private EventListenerList m_eventListeners = new EventListenerList();
-
- private boolean m_dropdownEnabled = true;
- private boolean m_buttonEnabled = true;
-
- private String m_originalVariant = "";
-
- public DropDownFileUpload(Composite parent, int style) {
- super(parent, style | SWT.DOUBLE_BUFFERED);
-
- addListener(SWT.Traverse, new Listener() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void handleEvent(Event e) {
- switch (e.detail) {
- /* Do tab group traversal */
- case SWT.TRAVERSE_ESCAPE:
- case SWT.TRAVERSE_RETURN:
- case SWT.TRAVERSE_TAB_NEXT:
- case SWT.TRAVERSE_TAB_PREVIOUS:
- e.doit = true;
- break;
- }
- }
- });
- getUiEnvironment().addKeyStroke(this, new P_KeyStroke(' '), false);
- getUiEnvironment().addKeyStroke(this, new P_KeyStroke(SWT.CR), false);
- getUiEnvironment().addKeyStroke(this, new P_KeyStroke(SWT.ARROW_DOWN), false);
-
- addFocusListener(new FocusAdapter() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void focusGained(FocusEvent e) {
- redraw();
- }
-
- @Override
- public void focusLost(FocusEvent e) {
- redraw();
- }
- });
- super.addSelectionListener(new SelectionAdapter() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- handleSelectionInternal(e);
- redraw();
- }
- });
-
- addDisposeListener(new DisposeListener() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void widgetDisposed(DisposeEvent e) {
- // remove key strokes
- getUiEnvironment().removeKeyStrokes(DropDownFileUpload.this);
- }
- });
- }
-
- /**
- * since tab list on parent does not work
- */
- @Override
- public boolean forceFocus() {
- if ((getStyle() & SWT.NO_FOCUS) != 0) {
- return false;
- }
- else {
- return super.forceFocus();
- }
- }
-
- protected void handleSelectionInternal(SelectionEvent event) {
-//FIXME there is a open bugzilla: https://bugs.eclipse.org/bugs/show_bug.cgi?id=369423
-// Point pt = new Point(event.x, event.y);
-// if (m_buttonArea.contains(pt)) {
- fireSelectionEvent(event);
-// }
-// else if (m_dropDownArea.contains(pt) && isDropdownEnabled()) {
-// if (getMenu() != null) {
-// getMenu().setLocation(toDisplay(event.x, event.y));
-// getMenu().setVisible(true);
-// }
-// }
- }
-
- @Override
- public void fireSelectionEvent(SelectionEvent e) {
- if (isButtonEnabled()) {
- for (SelectionListener l : m_eventListeners.getListeners(SelectionListener.class)) {
- l.widgetSelected(e);
- }
- }
- }
-
- @Override
- public void addSelectionListener(SelectionListener listener) {
- m_eventListeners.add(SelectionListener.class, listener);
- }
-
- @Override
- public void removeSelectionListener(SelectionListener listener) {
- m_eventListeners.remove(SelectionListener.class, listener);
- }
-
- @Override
- public void setDropdownEnabled(boolean enabled) {
- m_dropdownEnabled = enabled;
- if (!StringUtility.hasText(m_originalVariant)) {
- m_originalVariant = (String) getData(WidgetUtil.CUSTOM_VARIANT);
- }
- String customVariant = m_dropdownEnabled ? m_originalVariant + "_menu" : m_originalVariant;
- setData(WidgetUtil.CUSTOM_VARIANT, customVariant);
- super.setEnabled(isButtonEnabled());
- redraw();
- }
-
- @Override
- public boolean isDropdownEnabled() {
- return m_dropdownEnabled;
- }
-
- @Override
- public void setButtonEnabled(boolean enabled) {
- m_buttonEnabled = enabled;
- super.setEnabled(isButtonEnabled());
- redraw();
- }
-
- @Override
- public boolean isButtonEnabled() {
- return m_buttonEnabled;
- }
-
- @Override
- public void setEnabled(boolean enabled) {
- super.setEnabled(enabled);
- m_buttonEnabled = enabled;
- m_dropdownEnabled = enabled;
- redraw();
- }
-
- @Override
- protected void checkSubclass() {
- // allow subclassing
- }
-
- private IRwtEnvironment getUiEnvironment() {
- return (IRwtEnvironment) getDisplay().getData(IRwtEnvironment.class.getName());
- }
-
- private class P_KeyStroke extends RwtKeyStroke {
- public P_KeyStroke(int keyCode) {
- super(keyCode);
- }
-
- @Override
- public void handleUiAction(Event e) {
- switch (e.keyCode) {
- case ' ':
- case SWT.CR: {
- SelectionEvent selEvent = new SelectionEvent(e);
- fireSelectionEvent(selEvent);
- break;
- }
- case SWT.ARROW_DOWN: {
- if (isDropdownEnabled() && getMenu() != null) {
- getMenu().setLocation(toDisplay(e.x, e.y));
- getMenu().setVisible(true);
- }
- break;
- }
- default:
- break;
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.ext;
+
+import org.eclipse.rwt.lifecycle.WidgetUtil;
+import org.eclipse.rwt.widgets.FileUpload;
+import org.eclipse.scout.commons.EventListenerList;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
+import org.eclipse.scout.rt.ui.rap.keystroke.RwtKeyStroke;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.FocusAdapter;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+
+public class DropDownFileUpload extends FileUpload implements IDropDownFileUploadForPatch {
+ private static final long serialVersionUID = 1L;
+
+ private Rectangle m_buttonArea = new Rectangle(1, 1, 13, 17);
+ private Rectangle m_dropDownArea = new Rectangle(14, 1, 10, 17);
+ private EventListenerList m_eventListeners = new EventListenerList();
+
+ private boolean m_dropdownEnabled = true;
+ private boolean m_buttonEnabled = true;
+
+ private String m_originalVariant = "";
+
+ public DropDownFileUpload(Composite parent, int style) {
+ super(parent, style | SWT.DOUBLE_BUFFERED);
+
+ addListener(SWT.Traverse, new Listener() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void handleEvent(Event e) {
+ switch (e.detail) {
+ /* Do tab group traversal */
+ case SWT.TRAVERSE_ESCAPE:
+ case SWT.TRAVERSE_RETURN:
+ case SWT.TRAVERSE_TAB_NEXT:
+ case SWT.TRAVERSE_TAB_PREVIOUS:
+ e.doit = true;
+ break;
+ }
+ }
+ });
+ getUiEnvironment().addKeyStroke(this, new P_KeyStroke(' '), false);
+ getUiEnvironment().addKeyStroke(this, new P_KeyStroke(SWT.CR), false);
+ getUiEnvironment().addKeyStroke(this, new P_KeyStroke(SWT.ARROW_DOWN), false);
+
+ addFocusListener(new FocusAdapter() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void focusGained(FocusEvent e) {
+ redraw();
+ }
+
+ @Override
+ public void focusLost(FocusEvent e) {
+ redraw();
+ }
+ });
+ super.addSelectionListener(new SelectionAdapter() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ handleSelectionInternal(e);
+ redraw();
+ }
+ });
+
+ addDisposeListener(new DisposeListener() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void widgetDisposed(DisposeEvent e) {
+ // remove key strokes
+ getUiEnvironment().removeKeyStrokes(DropDownFileUpload.this);
+ }
+ });
+ }
+
+ /**
+ * since tab list on parent does not work
+ */
+ @Override
+ public boolean forceFocus() {
+ if ((getStyle() & SWT.NO_FOCUS) != 0) {
+ return false;
+ }
+ else {
+ return super.forceFocus();
+ }
+ }
+
+ protected void handleSelectionInternal(SelectionEvent event) {
+//FIXME there is a open bugzilla: https://bugs.eclipse.org/bugs/show_bug.cgi?id=369423
+// Point pt = new Point(event.x, event.y);
+// if (m_buttonArea.contains(pt)) {
+ fireSelectionEvent(event);
+// }
+// else if (m_dropDownArea.contains(pt) && isDropdownEnabled()) {
+// if (getMenu() != null) {
+// getMenu().setLocation(toDisplay(event.x, event.y));
+// getMenu().setVisible(true);
+// }
+// }
+ }
+
+ @Override
+ public void fireSelectionEvent(SelectionEvent e) {
+ if (isButtonEnabled()) {
+ for (SelectionListener l : m_eventListeners.getListeners(SelectionListener.class)) {
+ l.widgetSelected(e);
+ }
+ }
+ }
+
+ @Override
+ public void addSelectionListener(SelectionListener listener) {
+ m_eventListeners.add(SelectionListener.class, listener);
+ }
+
+ @Override
+ public void removeSelectionListener(SelectionListener listener) {
+ m_eventListeners.remove(SelectionListener.class, listener);
+ }
+
+ @Override
+ public void setDropdownEnabled(boolean enabled) {
+ m_dropdownEnabled = enabled;
+ if (!StringUtility.hasText(m_originalVariant)) {
+ m_originalVariant = (String) getData(WidgetUtil.CUSTOM_VARIANT);
+ }
+ String customVariant = m_dropdownEnabled ? m_originalVariant + "_menu" : m_originalVariant;
+ setData(WidgetUtil.CUSTOM_VARIANT, customVariant);
+ super.setEnabled(isButtonEnabled());
+ redraw();
+ }
+
+ @Override
+ public boolean isDropdownEnabled() {
+ return m_dropdownEnabled;
+ }
+
+ @Override
+ public void setButtonEnabled(boolean enabled) {
+ m_buttonEnabled = enabled;
+ super.setEnabled(isButtonEnabled());
+ redraw();
+ }
+
+ @Override
+ public boolean isButtonEnabled() {
+ return m_buttonEnabled;
+ }
+
+ @Override
+ public void setEnabled(boolean enabled) {
+ super.setEnabled(enabled);
+ m_buttonEnabled = enabled;
+ m_dropdownEnabled = enabled;
+ redraw();
+ }
+
+ @Override
+ protected void checkSubclass() {
+ // allow subclassing
+ }
+
+ private IRwtEnvironment getUiEnvironment() {
+ return (IRwtEnvironment) getDisplay().getData(IRwtEnvironment.class.getName());
+ }
+
+ private class P_KeyStroke extends RwtKeyStroke {
+ public P_KeyStroke(int keyCode) {
+ super(keyCode);
+ }
+
+ @Override
+ public void handleUiAction(Event e) {
+ switch (e.keyCode) {
+ case ' ':
+ case SWT.CR: {
+ SelectionEvent selEvent = new SelectionEvent(e);
+ fireSelectionEvent(selEvent);
+ break;
+ }
+ case SWT.ARROW_DOWN: {
+ if (isDropdownEnabled() && getMenu() != null) {
+ getMenu().setLocation(toDisplay(e.x, e.y));
+ getMenu().setVisible(true);
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/IDropDownButtonForPatch.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/IDropDownButtonForPatch.java
index bdfdc6acb8..20e954fade 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/IDropDownButtonForPatch.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/IDropDownButtonForPatch.java
@@ -1,75 +1,75 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.ext;
-
-import org.eclipse.swt.events.FocusListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Shell;
-
-public interface IDropDownButtonForPatch {
-
- /**
- * since tab list on parent does not work
- */
- boolean forceFocus();
-
- void fireSelectionEvent(SelectionEvent e);
-
- void addSelectionListener(SelectionListener listener);
-
- void removeSelectionListener(SelectionListener listener);
-
- void addFocusListener(FocusListener listener);
-
- Shell getShell();
-
- void setText(String text);
-
- String getText();
-
- void setImage(Image image);
-
- Image getImage();
-
- void setBackground(Color color);
-
- void setMenu(Menu menu);
-
- void setLayoutData(Object layoutData);
-
- void setData(String key, Object value);
-
- boolean isEnabled();
-
- boolean isVisible();
-
- void setDropdownEnabled(boolean enabled);
-
- boolean isDropdownEnabled();
-
- void setButtonEnabled(boolean enabled);
-
- boolean isButtonEnabled();
-
- void setEnabled(boolean enabled);
-
- Point computeSize(int hint, int hint2, boolean changed);
-
- void setBounds(Rectangle bounds);
-
- void setBounds(int x, int y, int width, int height);
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.ext;
+
+import org.eclipse.swt.events.FocusListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Shell;
+
+public interface IDropDownButtonForPatch {
+
+ /**
+ * since tab list on parent does not work
+ */
+ boolean forceFocus();
+
+ void fireSelectionEvent(SelectionEvent e);
+
+ void addSelectionListener(SelectionListener listener);
+
+ void removeSelectionListener(SelectionListener listener);
+
+ void addFocusListener(FocusListener listener);
+
+ Shell getShell();
+
+ void setText(String text);
+
+ String getText();
+
+ void setImage(Image image);
+
+ Image getImage();
+
+ void setBackground(Color color);
+
+ void setMenu(Menu menu);
+
+ void setLayoutData(Object layoutData);
+
+ void setData(String key, Object value);
+
+ boolean isEnabled();
+
+ boolean isVisible();
+
+ void setDropdownEnabled(boolean enabled);
+
+ boolean isDropdownEnabled();
+
+ void setButtonEnabled(boolean enabled);
+
+ boolean isButtonEnabled();
+
+ void setEnabled(boolean enabled);
+
+ Point computeSize(int hint, int hint2, boolean changed);
+
+ void setBounds(Rectangle bounds);
+
+ void setBounds(int x, int y, int width, int height);
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/IDropDownButtonListener.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/IDropDownButtonListener.java
index 9f94e6d628..d359c78225 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/IDropDownButtonListener.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/IDropDownButtonListener.java
@@ -1,23 +1,23 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.ext;
-
-/**
- *
- */
-public interface IDropDownButtonListener {
-
- /**
- * Fired when icon has been left clicked.
- */
- void iconClicked(Object source);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.ext;
+
+/**
+ *
+ */
+public interface IDropDownButtonListener {
+
+ /**
+ * Fired when icon has been left clicked.
+ */
+ void iconClicked(Object source);
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/IDropDownFileUploadForPatch.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/IDropDownFileUploadForPatch.java
index 3c4a5356ad..4418c3d11c 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/IDropDownFileUploadForPatch.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/IDropDownFileUploadForPatch.java
@@ -1,89 +1,89 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.ext;
-
-import org.eclipse.swt.events.FocusListener;
-import org.eclipse.swt.events.MouseListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Shell;
-
-public interface IDropDownFileUploadForPatch {
-
- /**
- * since tab list on parent does not work
- */
- boolean forceFocus();
-
- void fireSelectionEvent(SelectionEvent e);
-
- void addSelectionListener(SelectionListener listener);
-
- void removeSelectionListener(SelectionListener listener);
-
- void addFocusListener(FocusListener listener);
-
- void addMouseListener(MouseListener listener);
-
- Shell getShell();
-
- void setText(String text);
-
- String getText();
-
- void setImage(Image image);
-
- Image getImage();
-
- void setBackground(Color color);
-
- void setMenu(Menu menu);
-
- void setLayoutData(Object layoutData);
-
- void setData(String key, Object value);
-
- String getFileName();
-
- void submit(String url);
-
- Composite getParent();
-
- boolean isEnabled();
-
- boolean isVisible();
-
- void dispose();
-
- boolean isDisposed();
-
- void setDropdownEnabled(boolean enabled);
-
- boolean isDropdownEnabled();
-
- void setButtonEnabled(boolean enabled);
-
- boolean isButtonEnabled();
-
- void setEnabled(boolean enabled);
-
- Point computeSize(int hint, int hint2, boolean changed);
-
- void setBounds(Rectangle bounds);
-
- void setBounds(int x, int y, int width, int height);
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.ext;
+
+import org.eclipse.swt.events.FocusListener;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Shell;
+
+public interface IDropDownFileUploadForPatch {
+
+ /**
+ * since tab list on parent does not work
+ */
+ boolean forceFocus();
+
+ void fireSelectionEvent(SelectionEvent e);
+
+ void addSelectionListener(SelectionListener listener);
+
+ void removeSelectionListener(SelectionListener listener);
+
+ void addFocusListener(FocusListener listener);
+
+ void addMouseListener(MouseListener listener);
+
+ Shell getShell();
+
+ void setText(String text);
+
+ String getText();
+
+ void setImage(Image image);
+
+ Image getImage();
+
+ void setBackground(Color color);
+
+ void setMenu(Menu menu);
+
+ void setLayoutData(Object layoutData);
+
+ void setData(String key, Object value);
+
+ String getFileName();
+
+ void submit(String url);
+
+ Composite getParent();
+
+ boolean isEnabled();
+
+ boolean isVisible();
+
+ void dispose();
+
+ boolean isDisposed();
+
+ void setDropdownEnabled(boolean enabled);
+
+ boolean isDropdownEnabled();
+
+ void setButtonEnabled(boolean enabled);
+
+ boolean isButtonEnabled();
+
+ void setEnabled(boolean enabled);
+
+ Point computeSize(int hint, int hint2, boolean changed);
+
+ void setBounds(Rectangle bounds);
+
+ void setBounds(int x, int y, int width, int height);
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/ILabelComposite.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/ILabelComposite.java
index 773d1e392d..6a6b128af6 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/ILabelComposite.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/ILabelComposite.java
@@ -1,55 +1,55 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.ext;
-
-import org.eclipse.scout.commons.exception.IProcessingStatus;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-
-public interface ILabelComposite {
- Object getLayoutData();
-
- void setLayoutData(Object layoutData);
-
- boolean getEnabled();
-
- void setEnabled(boolean enabled);
-
- Color getForeground();
-
- void setForeground(Color color);
-
- void setLayoutWidthHint(int w);
-
- boolean setMandatory(boolean b);
-
- void setStatus(IProcessingStatus status);
-
- String getText();
-
- void setText(String text);
-
- boolean getVisible();
-
- void setVisible(boolean b);
-
- Object getData(String key);
-
- void setData(String key, Object value);
-
- Object getBackground();
-
- void setBackground(Color c);
-
- Font getFont();
-
- void setFont(Font f);
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.ext;
+
+import org.eclipse.scout.commons.exception.IProcessingStatus;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+
+public interface ILabelComposite {
+ Object getLayoutData();
+
+ void setLayoutData(Object layoutData);
+
+ boolean getEnabled();
+
+ void setEnabled(boolean enabled);
+
+ Color getForeground();
+
+ void setForeground(Color color);
+
+ void setLayoutWidthHint(int w);
+
+ boolean setMandatory(boolean b);
+
+ void setStatus(IProcessingStatus status);
+
+ String getText();
+
+ void setText(String text);
+
+ boolean getVisible();
+
+ void setVisible(boolean b);
+
+ Object getData(String key);
+
+ void setData(String key, Object value);
+
+ Object getBackground();
+
+ void setBackground(Color c);
+
+ Font getFont();
+
+ void setFont(Font f);
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/ImageViewer.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/ImageViewer.java
index 3c43bf9385..24f21e41b1 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/ImageViewer.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/ImageViewer.java
@@ -1,163 +1,163 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.ext;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.events.PaintListener;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Canvas;
-import org.eclipse.swt.widgets.Composite;
-
-public class ImageViewer extends Canvas {
- private static final long serialVersionUID = 1L;
-
- private int m_xAglin = SWT.CENTER;
- private int m_yAglin = SWT.CENTER;
- private boolean m_autoFit = false;
-
- private Image m_image;
- private Image m_scaledImage;
-
- public ImageViewer(Composite parent) {
- super(parent, SWT.NONE);
- addPaintListener(new PaintListener() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void paintControl(PaintEvent e) {
- handleUiPaintEvent(e.gc);
- }
- });
- addDisposeListener(new DisposeListener() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void widgetDisposed(DisposeEvent e) {
- freeResources();
- }
- });
- }
-
- private void freeResources() {
- if (m_scaledImage != null && !m_scaledImage.isDisposed() && m_scaledImage.getDevice() != null) {
- m_scaledImage.dispose();
- m_scaledImage = null;
- }
- }
-
- private Image scaleImage(Image img) {
- freeResources();
- if (m_autoFit && img != null) {
- Point uiFieldSize = getSize();
- if (uiFieldSize.x == 0 || uiFieldSize.y == 0) {
- return img;
- }
- Rectangle imageBounds = img.getBounds();
- double scaleFactor = (double) uiFieldSize.x / (double) imageBounds.width;
- scaleFactor = Math.min(scaleFactor, (double) uiFieldSize.y / (double) img.getBounds().height);
- m_scaledImage = new Image(getDisplay(), img.getImageData().scaledTo((int) (scaleFactor * img.getBounds().width), (int) (scaleFactor * img.getBounds().height)));
- return m_scaledImage;
- }
- return img;
- }
-
- protected void handleUiPaintEvent(GC gc) {
- Image img = getImage();
- Rectangle bounds = gc.getClipping();
- if (img != null) {
- // scale img
- if (isAutoFit()) {
- img = scaleImage(img);
- }
- Rectangle imgBounds = img.getBounds();
- int x = 0;
- if (imgBounds.width <= bounds.width) {
- switch (getAlignmentX()) {
- case SWT.CENTER:
- x = (bounds.width - imgBounds.width) / 2;
- break;
- case SWT.RIGHT:
- x = bounds.width - imgBounds.width;
- break;
- default:
- x = 0;
- break;
- }
- }
- int y = 0;
- if (imgBounds.height <= bounds.height) {
- switch (getAlignmentY()) {
- case SWT.CENTER:
- y = (bounds.height - imgBounds.height) / 2;
- break;
- case SWT.RIGHT:
- y = bounds.height - imgBounds.height;
- break;
- default:
- y = 0;
- break;
- }
- }
- // draw
- gc.drawImage(img, x, y);
- }
- }
-
- @Override
- public Point computeSize(int hint, int hint2, boolean changed) {
- Point size = super.computeSize(hint, hint2, changed);
- if (getImage() != null) {
- Rectangle imgBounds = getImage().getBounds();
- size.x = imgBounds.width;
- size.y = imgBounds.height;
- }
- return size;
- }
-
- public void setAlignmentX(int alignment) {
- m_xAglin = alignment;
- }
-
- public int getAlignmentX() {
- return m_xAglin;
- }
-
- public void setAlignmentY(int alignment) {
- m_yAglin = alignment;
- }
-
- public int getAlignmentY() {
- return m_yAglin;
- }
-
- public boolean isAutoFit() {
- return m_autoFit;
- }
-
- public void setAutoFit(boolean autoFit) {
- m_autoFit = autoFit;
- }
-
- public void setImage(Image img) {
- m_image = img;
- }
-
- public Image getImage() {
- return m_image;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.ext;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Composite;
+
+public class ImageViewer extends Canvas {
+ private static final long serialVersionUID = 1L;
+
+ private int m_xAglin = SWT.CENTER;
+ private int m_yAglin = SWT.CENTER;
+ private boolean m_autoFit = false;
+
+ private Image m_image;
+ private Image m_scaledImage;
+
+ public ImageViewer(Composite parent) {
+ super(parent, SWT.NONE);
+ addPaintListener(new PaintListener() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void paintControl(PaintEvent e) {
+ handleUiPaintEvent(e.gc);
+ }
+ });
+ addDisposeListener(new DisposeListener() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void widgetDisposed(DisposeEvent e) {
+ freeResources();
+ }
+ });
+ }
+
+ private void freeResources() {
+ if (m_scaledImage != null && !m_scaledImage.isDisposed() && m_scaledImage.getDevice() != null) {
+ m_scaledImage.dispose();
+ m_scaledImage = null;
+ }
+ }
+
+ private Image scaleImage(Image img) {
+ freeResources();
+ if (m_autoFit && img != null) {
+ Point uiFieldSize = getSize();
+ if (uiFieldSize.x == 0 || uiFieldSize.y == 0) {
+ return img;
+ }
+ Rectangle imageBounds = img.getBounds();
+ double scaleFactor = (double) uiFieldSize.x / (double) imageBounds.width;
+ scaleFactor = Math.min(scaleFactor, (double) uiFieldSize.y / (double) img.getBounds().height);
+ m_scaledImage = new Image(getDisplay(), img.getImageData().scaledTo((int) (scaleFactor * img.getBounds().width), (int) (scaleFactor * img.getBounds().height)));
+ return m_scaledImage;
+ }
+ return img;
+ }
+
+ protected void handleUiPaintEvent(GC gc) {
+ Image img = getImage();
+ Rectangle bounds = gc.getClipping();
+ if (img != null) {
+ // scale img
+ if (isAutoFit()) {
+ img = scaleImage(img);
+ }
+ Rectangle imgBounds = img.getBounds();
+ int x = 0;
+ if (imgBounds.width <= bounds.width) {
+ switch (getAlignmentX()) {
+ case SWT.CENTER:
+ x = (bounds.width - imgBounds.width) / 2;
+ break;
+ case SWT.RIGHT:
+ x = bounds.width - imgBounds.width;
+ break;
+ default:
+ x = 0;
+ break;
+ }
+ }
+ int y = 0;
+ if (imgBounds.height <= bounds.height) {
+ switch (getAlignmentY()) {
+ case SWT.CENTER:
+ y = (bounds.height - imgBounds.height) / 2;
+ break;
+ case SWT.RIGHT:
+ y = bounds.height - imgBounds.height;
+ break;
+ default:
+ y = 0;
+ break;
+ }
+ }
+ // draw
+ gc.drawImage(img, x, y);
+ }
+ }
+
+ @Override
+ public Point computeSize(int hint, int hint2, boolean changed) {
+ Point size = super.computeSize(hint, hint2, changed);
+ if (getImage() != null) {
+ Rectangle imgBounds = getImage().getBounds();
+ size.x = imgBounds.width;
+ size.y = imgBounds.height;
+ }
+ return size;
+ }
+
+ public void setAlignmentX(int alignment) {
+ m_xAglin = alignment;
+ }
+
+ public int getAlignmentX() {
+ return m_xAglin;
+ }
+
+ public void setAlignmentY(int alignment) {
+ m_yAglin = alignment;
+ }
+
+ public int getAlignmentY() {
+ return m_yAglin;
+ }
+
+ public boolean isAutoFit() {
+ return m_autoFit;
+ }
+
+ public void setAutoFit(boolean autoFit) {
+ m_autoFit = autoFit;
+ }
+
+ public void setImage(Image img) {
+ m_image = img;
+ }
+
+ public Image getImage() {
+ return m_image;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/MenuAdapterEx.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/MenuAdapterEx.java
index 46d151f1cc..02568f6da2 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/MenuAdapterEx.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/MenuAdapterEx.java
@@ -1,103 +1,103 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.ext;
-
-import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
-import org.eclipse.scout.rt.ui.rap.keystroke.RwtKeyStroke;
-import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.MenuAdapter;
-import org.eclipse.swt.events.MenuEvent;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-
-/**
- * <h3>MenuAdapterEx</h3> ...
- *
- * @author sle
- * @since 3.7.0 June 2011
- */
-public abstract class MenuAdapterEx extends MenuAdapter {
- private static final long serialVersionUID = 1L;
-
- private final Control m_menuControl;
- private final Control m_keyStrokeWidget;
-
- public MenuAdapterEx(Control menuControl, Control keyStrokeWidget) {
- m_menuControl = menuControl;
- m_keyStrokeWidget = keyStrokeWidget;
- }
-
- public Control getMenuControl() {
- return m_menuControl;
- }
-
- public Control getKeyStrokeWidget() {
- return m_keyStrokeWidget;
- }
-
- protected abstract Menu getContextMenu();
-
- protected abstract void setContextMenu(Menu contextMenu);
-
- @Override
- public void menuShown(MenuEvent e) {
- final IRwtEnvironment uiEnvironment = RwtUtility.getUiEnvironment(e.display);
- //add escape-keystroke to close the contextmenu with esc
- RwtKeyStroke keyStroke = new RwtKeyStroke(RwtUtility.scoutToRwtKey("escape")) {
-
- @Override
- public void handleUiAction(Event keyEvent) {
- if (getContextMenu() != null && !getContextMenu().isDisposed()) {
- for (MenuItem item : getContextMenu().getItems()) {
- disposeMenuItem(item);
- }
- getContextMenu().dispose();
- }
-
- if ((getContextMenu() == null || getContextMenu().isDisposed())
- && !getMenuControl().isDisposed()
- && !getMenuControl().getShell().isDisposed()) {
- setContextMenu(new Menu(getMenuControl().getShell(), SWT.POP_UP));
- getContextMenu().addMenuListener(MenuAdapterEx.this);
- getMenuControl().setMenu(getContextMenu());
- }
-
- uiEnvironment.removeKeyStroke(getKeyStrokeWidget(), this);
-
- keyEvent.doit = false;
- }
- };
- uiEnvironment.addKeyStroke(getKeyStrokeWidget(), keyStroke, true);
-
- // clear all previous
- // Windows BUG: fires menu hide before the selection on the menu item is
- // propagated.
- if (getContextMenu() != null) {
- for (MenuItem item : getContextMenu().getItems()) {
- disposeMenuItem(item);
- }
- }
- }
-
- protected void disposeMenuItem(MenuItem item) {
- Menu menu = item.getMenu();
- if (menu != null) {
- for (MenuItem childItem : menu.getItems()) {
- disposeMenuItem(childItem);
- }
- menu.dispose();
- }
- item.dispose();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.ext;
+
+import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
+import org.eclipse.scout.rt.ui.rap.keystroke.RwtKeyStroke;
+import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MenuAdapter;
+import org.eclipse.swt.events.MenuEvent;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+
+/**
+ * <h3>MenuAdapterEx</h3> ...
+ *
+ * @author sle
+ * @since 3.7.0 June 2011
+ */
+public abstract class MenuAdapterEx extends MenuAdapter {
+ private static final long serialVersionUID = 1L;
+
+ private final Control m_menuControl;
+ private final Control m_keyStrokeWidget;
+
+ public MenuAdapterEx(Control menuControl, Control keyStrokeWidget) {
+ m_menuControl = menuControl;
+ m_keyStrokeWidget = keyStrokeWidget;
+ }
+
+ public Control getMenuControl() {
+ return m_menuControl;
+ }
+
+ public Control getKeyStrokeWidget() {
+ return m_keyStrokeWidget;
+ }
+
+ protected abstract Menu getContextMenu();
+
+ protected abstract void setContextMenu(Menu contextMenu);
+
+ @Override
+ public void menuShown(MenuEvent e) {
+ final IRwtEnvironment uiEnvironment = RwtUtility.getUiEnvironment(e.display);
+ //add escape-keystroke to close the contextmenu with esc
+ RwtKeyStroke keyStroke = new RwtKeyStroke(RwtUtility.scoutToRwtKey("escape")) {
+
+ @Override
+ public void handleUiAction(Event keyEvent) {
+ if (getContextMenu() != null && !getContextMenu().isDisposed()) {
+ for (MenuItem item : getContextMenu().getItems()) {
+ disposeMenuItem(item);
+ }
+ getContextMenu().dispose();
+ }
+
+ if ((getContextMenu() == null || getContextMenu().isDisposed())
+ && !getMenuControl().isDisposed()
+ && !getMenuControl().getShell().isDisposed()) {
+ setContextMenu(new Menu(getMenuControl().getShell(), SWT.POP_UP));
+ getContextMenu().addMenuListener(MenuAdapterEx.this);
+ getMenuControl().setMenu(getContextMenu());
+ }
+
+ uiEnvironment.removeKeyStroke(getKeyStrokeWidget(), this);
+
+ keyEvent.doit = false;
+ }
+ };
+ uiEnvironment.addKeyStroke(getKeyStrokeWidget(), keyStroke, true);
+
+ // clear all previous
+ // Windows BUG: fires menu hide before the selection on the menu item is
+ // propagated.
+ if (getContextMenu() != null) {
+ for (MenuItem item : getContextMenu().getItems()) {
+ disposeMenuItem(item);
+ }
+ }
+ }
+
+ protected void disposeMenuItem(MenuItem item) {
+ Menu menu = item.getMenu();
+ if (menu != null) {
+ for (MenuItem childItem : menu.getItems()) {
+ disposeMenuItem(childItem);
+ }
+ menu.dispose();
+ }
+ item.dispose();
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/ScrolledFormEx.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/ScrolledFormEx.java
index 49524d23ea..ffbd70d3fe 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/ScrolledFormEx.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/ScrolledFormEx.java
@@ -1,56 +1,56 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.ext;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.forms.widgets.Form;
-import org.eclipse.ui.forms.widgets.SharedScrolledComposite;
-
-public class ScrolledFormEx extends SharedScrolledComposite {
- private static final long serialVersionUID = 1L;
-
- private Form m_content;
-
- public ScrolledFormEx(Composite parent, int style) {
- super(parent, style);
- setExpandHorizontal(true);
- setExpandVertical(true);
- m_content = new Form(this, SWT.NONE);
- super.setContent(m_content);
- }
-
- public Composite getBody() {
- return m_content.getBody();
- }
-
- /**
- * Returns the instance of the form owned by the scrolled form.
- *
- * @return the form instance
- */
- public Form getForm() {
- return m_content;
- }
-
- @Override
- public Point computeSize(int wHint, int hHint, boolean changed) {
- Point size = getBody().computeSize(wHint, hHint, changed);
- return size;
- }
-
- @Override
- public void reflow(boolean flushCache) {
- super.reflow(flushCache);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.ext;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.forms.widgets.Form;
+import org.eclipse.ui.forms.widgets.SharedScrolledComposite;
+
+public class ScrolledFormEx extends SharedScrolledComposite {
+ private static final long serialVersionUID = 1L;
+
+ private Form m_content;
+
+ public ScrolledFormEx(Composite parent, int style) {
+ super(parent, style);
+ setExpandHorizontal(true);
+ setExpandVertical(true);
+ m_content = new Form(this, SWT.NONE);
+ super.setContent(m_content);
+ }
+
+ public Composite getBody() {
+ return m_content.getBody();
+ }
+
+ /**
+ * Returns the instance of the form owned by the scrolled form.
+ *
+ * @return the form instance
+ */
+ public Form getForm() {
+ return m_content;
+ }
+
+ @Override
+ public Point computeSize(int wHint, int hHint, boolean changed) {
+ Point size = getBody().computeSize(wHint, hHint, changed);
+ return size;
+ }
+
+ @Override
+ public void reflow(boolean flushCache) {
+ super.reflow(flushCache);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/SectionContent.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/SectionContent.java
index 1986f7124b..7bcc5c9080 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/SectionContent.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/SectionContent.java
@@ -1,31 +1,31 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.ext;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Composite;
-
-public class SectionContent extends Composite {
- private static final long serialVersionUID = 1L;
-
- public SectionContent(Composite parent, int style) {
- super(parent, style);
- }
-
- @Override
- public Point computeSize(int hint, int hint2, boolean changed) {
- if (hint == SWT.DEFAULT && hint2 == SWT.DEFAULT) {
- hint = getParent().getClientArea().width;
- }
- return super.computeSize(hint, hint2, changed);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.ext;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Composite;
+
+public class SectionContent extends Composite {
+ private static final long serialVersionUID = 1L;
+
+ public SectionContent(Composite parent, int style) {
+ super(parent, style);
+ }
+
+ @Override
+ public Point computeSize(int hint, int hint2, boolean changed) {
+ if (hint == SWT.DEFAULT && hint2 == SWT.DEFAULT) {
+ hint = getParent().getClientArea().width;
+ }
+ return super.computeSize(hint, hint2, changed);
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/SnapButtonMaximized.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/SnapButtonMaximized.java
index 4d43613f50..6270534353 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/SnapButtonMaximized.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/SnapButtonMaximized.java
@@ -1,240 +1,240 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.ext;
-
-import org.eclipse.scout.commons.EventListenerList;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.events.PaintListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Canvas;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-
-public class SnapButtonMaximized extends Canvas {
- private static final long serialVersionUID = 1L;
-
- private String m_text;
- private Image m_image;
- private boolean m_selected;
-
- private EventListenerList m_eventListener = new EventListenerList();
- // internal
- private boolean m_mouseHover;
- private boolean m_focussed;
- private Listener m_controlListener = new P_ControlListener();
- // spacing
- private int m_gap = 5;
- private int m_insets = 2;
- private int m_borderInsets = 3;
- private int m_borderWidth = 1;
- // resources
- private Color m_borderColor;
- private Color m_selectedBackground;
-
- public SnapButtonMaximized(Composite parent, int style) {
- super(parent, style);
- addPaintListener(new P_PaintListener());
- attachListeners();
- // colors
- m_borderColor = new Color(this.getDisplay(), 52, 1, 197);
- m_selectedBackground = new Color(this.getDisplay(), 200, 212, 249);
- setCursor(getDisplay().getSystemCursor(SWT.CURSOR_HAND));
- addDisposeListener(new DisposeListener() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void widgetDisposed(DisposeEvent e) {
- freeResources();
- }
- });
- }
-
- public void freeResources() {
- detachListeners();
- if (m_borderColor != null && !m_borderColor.isDisposed() && m_borderColor.getDevice() != null) {
- m_borderColor.dispose();
- m_borderColor = null;
- }
- if (m_selectedBackground != null && !m_selectedBackground.isDisposed() && m_selectedBackground.getDevice() != null) {
- m_selectedBackground.dispose();
- m_selectedBackground = null;
- }
- }
-
- protected void attachListeners() {
- addListener(SWT.FocusIn, m_controlListener);
- addListener(SWT.FocusOut, m_controlListener);
- //XXX [rap]addListener(SWT.MouseEnter, m_controlListener);
- //XXX [rap]addListener(SWT.MouseExit, m_controlListener);
- addListener(SWT.MouseUp, m_controlListener);
- }
-
- protected void detachListeners() {
- removeListener(SWT.FocusIn, m_controlListener);
- removeListener(SWT.FocusOut, m_controlListener);
- //XXX [rap]removeListener(SWT.MouseEnter, m_controlListener);
- //XXX [rap]removeListener(SWT.MouseExit, m_controlListener);
- removeListener(SWT.MouseUp, m_controlListener);
- }
-
- public void addSelectionListener(SelectionListener listener) {
- m_eventListener.add(SelectionListener.class, listener);
- }
-
- public void removeSelectionListener(SelectionListener listener) {
- m_eventListener.remove(SelectionListener.class, listener);
- }
-
- @Override
- public void setFont(Font font) {
- super.setFont(font);
- redraw();
- }
-
- public Image getImage() {
- return m_image;
- }
-
- public void setImage(Image image) {
- m_image = image;
- redraw();
- }
-
- public String getText() {
- return m_text;
- }
-
- public void setText(String text) {
- m_text = text;
- redraw();
- }
-
- @Override
- public Point computeSize(int hint, int hint2, boolean changed) {
- int x = 0;
- int y = 0;
- if (getImage() != null) {
- Rectangle imgBounds = getImage().getBounds();
- x += imgBounds.width;
- y = Math.max(y, imgBounds.height);
- }
- if (getText() != null) {
- GC gc = null;
- try {
- gc = new GC(this);
- Point textSize = gc.stringExtent(getText());
- x += (textSize.x + m_gap);
- y = Math.max(textSize.y, y);
- }
- finally {
- if (gc != null && !gc.isDisposed() && gc.getDevice() != null) {
- gc.dispose();
- }
- }
- }
- x += (m_insets * 2 + m_borderInsets * 2 + m_borderWidth * 2);
- y += (m_insets * 2 + m_borderInsets * 2 + m_borderWidth * 2);
- return new Point(x, y);
- }
-
- private void handleUiSelecion(Event e) {
- for (SelectionListener listener : m_eventListener.getListeners(SelectionListener.class)) {
- listener.widgetSelected(new SelectionEvent(e));
- }
- }
-
- private class P_ControlListener implements Listener {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void handleEvent(Event event) {
- switch (event.type) {
- case SWT.FocusIn:
- m_focussed = true;
- break;
- case SWT.FocusOut:
- m_focussed = false;
- break;
- //XXX [rap]
- /*case SWT.MouseEnter:
- m_mouseHover = true;
- break;
- case SWT.MouseExit:
- m_mouseHover = false;
- break;
- */
- case SWT.MouseUp:
- handleUiSelecion(event);
- break;
- }
- redraw();
- }
-
- }
-
- private class P_PaintListener implements PaintListener {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void paintControl(PaintEvent e) {
- Rectangle bounds = getClientArea();
- GC gc = e.gc;
- //XXX [rap] gc.setAdvanced(true);
- int inset = m_insets;
- int borderWidth = m_borderWidth;
- if (m_mouseHover) {
- inset--;
- borderWidth++;
- }
- gc.setBackground(m_borderColor);
- gc.fillRoundRectangle(inset, inset, bounds.width - inset, bounds.height - inset, 5, 5);
- gc.setBackground(getBackground());
- if (isSelected()) {
- gc.setBackground(m_selectedBackground);
- }
- gc.fillRoundRectangle(inset + borderWidth, inset + borderWidth, bounds.width - inset - 2 * borderWidth,
- bounds.height - inset - 2 * borderWidth, 5, 5);
- bounds.x = bounds.x + inset + borderWidth + m_borderInsets;
- bounds.y = bounds.y + inset + borderWidth + m_borderInsets;
- bounds.width = bounds.width - 2 * (inset + borderWidth + m_borderInsets);
- bounds.height = bounds.height - 2 * (inset + borderWidth + m_borderInsets);
- // image
- if (getImage() != null) {
- gc.drawImage(getImage(), bounds.x, bounds.y);
- bounds.x += (getImage().getBounds().width + m_gap);
- }
- if (getText() != null) {
- gc.drawText(getText(), bounds.x, bounds.y);
- }
- }
- } // end class P_PaintListener
-
- public boolean isSelected() {
- return m_selected;
- }
-
- public void setSelected(boolean selected) {
- m_selected = selected;
- redraw();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.ext;
+
+import org.eclipse.scout.commons.EventListenerList;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+
+public class SnapButtonMaximized extends Canvas {
+ private static final long serialVersionUID = 1L;
+
+ private String m_text;
+ private Image m_image;
+ private boolean m_selected;
+
+ private EventListenerList m_eventListener = new EventListenerList();
+ // internal
+ private boolean m_mouseHover;
+ private boolean m_focussed;
+ private Listener m_controlListener = new P_ControlListener();
+ // spacing
+ private int m_gap = 5;
+ private int m_insets = 2;
+ private int m_borderInsets = 3;
+ private int m_borderWidth = 1;
+ // resources
+ private Color m_borderColor;
+ private Color m_selectedBackground;
+
+ public SnapButtonMaximized(Composite parent, int style) {
+ super(parent, style);
+ addPaintListener(new P_PaintListener());
+ attachListeners();
+ // colors
+ m_borderColor = new Color(this.getDisplay(), 52, 1, 197);
+ m_selectedBackground = new Color(this.getDisplay(), 200, 212, 249);
+ setCursor(getDisplay().getSystemCursor(SWT.CURSOR_HAND));
+ addDisposeListener(new DisposeListener() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void widgetDisposed(DisposeEvent e) {
+ freeResources();
+ }
+ });
+ }
+
+ public void freeResources() {
+ detachListeners();
+ if (m_borderColor != null && !m_borderColor.isDisposed() && m_borderColor.getDevice() != null) {
+ m_borderColor.dispose();
+ m_borderColor = null;
+ }
+ if (m_selectedBackground != null && !m_selectedBackground.isDisposed() && m_selectedBackground.getDevice() != null) {
+ m_selectedBackground.dispose();
+ m_selectedBackground = null;
+ }
+ }
+
+ protected void attachListeners() {
+ addListener(SWT.FocusIn, m_controlListener);
+ addListener(SWT.FocusOut, m_controlListener);
+ //XXX [rap]addListener(SWT.MouseEnter, m_controlListener);
+ //XXX [rap]addListener(SWT.MouseExit, m_controlListener);
+ addListener(SWT.MouseUp, m_controlListener);
+ }
+
+ protected void detachListeners() {
+ removeListener(SWT.FocusIn, m_controlListener);
+ removeListener(SWT.FocusOut, m_controlListener);
+ //XXX [rap]removeListener(SWT.MouseEnter, m_controlListener);
+ //XXX [rap]removeListener(SWT.MouseExit, m_controlListener);
+ removeListener(SWT.MouseUp, m_controlListener);
+ }
+
+ public void addSelectionListener(SelectionListener listener) {
+ m_eventListener.add(SelectionListener.class, listener);
+ }
+
+ public void removeSelectionListener(SelectionListener listener) {
+ m_eventListener.remove(SelectionListener.class, listener);
+ }
+
+ @Override
+ public void setFont(Font font) {
+ super.setFont(font);
+ redraw();
+ }
+
+ public Image getImage() {
+ return m_image;
+ }
+
+ public void setImage(Image image) {
+ m_image = image;
+ redraw();
+ }
+
+ public String getText() {
+ return m_text;
+ }
+
+ public void setText(String text) {
+ m_text = text;
+ redraw();
+ }
+
+ @Override
+ public Point computeSize(int hint, int hint2, boolean changed) {
+ int x = 0;
+ int y = 0;
+ if (getImage() != null) {
+ Rectangle imgBounds = getImage().getBounds();
+ x += imgBounds.width;
+ y = Math.max(y, imgBounds.height);
+ }
+ if (getText() != null) {
+ GC gc = null;
+ try {
+ gc = new GC(this);
+ Point textSize = gc.stringExtent(getText());
+ x += (textSize.x + m_gap);
+ y = Math.max(textSize.y, y);
+ }
+ finally {
+ if (gc != null && !gc.isDisposed() && gc.getDevice() != null) {
+ gc.dispose();
+ }
+ }
+ }
+ x += (m_insets * 2 + m_borderInsets * 2 + m_borderWidth * 2);
+ y += (m_insets * 2 + m_borderInsets * 2 + m_borderWidth * 2);
+ return new Point(x, y);
+ }
+
+ private void handleUiSelecion(Event e) {
+ for (SelectionListener listener : m_eventListener.getListeners(SelectionListener.class)) {
+ listener.widgetSelected(new SelectionEvent(e));
+ }
+ }
+
+ private class P_ControlListener implements Listener {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void handleEvent(Event event) {
+ switch (event.type) {
+ case SWT.FocusIn:
+ m_focussed = true;
+ break;
+ case SWT.FocusOut:
+ m_focussed = false;
+ break;
+ //XXX [rap]
+ /*case SWT.MouseEnter:
+ m_mouseHover = true;
+ break;
+ case SWT.MouseExit:
+ m_mouseHover = false;
+ break;
+ */
+ case SWT.MouseUp:
+ handleUiSelecion(event);
+ break;
+ }
+ redraw();
+ }
+
+ }
+
+ private class P_PaintListener implements PaintListener {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void paintControl(PaintEvent e) {
+ Rectangle bounds = getClientArea();
+ GC gc = e.gc;
+ //XXX [rap] gc.setAdvanced(true);
+ int inset = m_insets;
+ int borderWidth = m_borderWidth;
+ if (m_mouseHover) {
+ inset--;
+ borderWidth++;
+ }
+ gc.setBackground(m_borderColor);
+ gc.fillRoundRectangle(inset, inset, bounds.width - inset, bounds.height - inset, 5, 5);
+ gc.setBackground(getBackground());
+ if (isSelected()) {
+ gc.setBackground(m_selectedBackground);
+ }
+ gc.fillRoundRectangle(inset + borderWidth, inset + borderWidth, bounds.width - inset - 2 * borderWidth,
+ bounds.height - inset - 2 * borderWidth, 5, 5);
+ bounds.x = bounds.x + inset + borderWidth + m_borderInsets;
+ bounds.y = bounds.y + inset + borderWidth + m_borderInsets;
+ bounds.width = bounds.width - 2 * (inset + borderWidth + m_borderInsets);
+ bounds.height = bounds.height - 2 * (inset + borderWidth + m_borderInsets);
+ // image
+ if (getImage() != null) {
+ gc.drawImage(getImage(), bounds.x, bounds.y);
+ bounds.x += (getImage().getBounds().width + m_gap);
+ }
+ if (getText() != null) {
+ gc.drawText(getText(), bounds.x, bounds.y);
+ }
+ }
+ } // end class P_PaintListener
+
+ public boolean isSelected() {
+ return m_selected;
+ }
+
+ public void setSelected(boolean selected) {
+ m_selected = selected;
+ redraw();
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/StatusLabelEx.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/StatusLabelEx.java
index 8d686c408e..c3b8e39043 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/StatusLabelEx.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/StatusLabelEx.java
@@ -1,407 +1,407 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.ext;
-
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.exception.IProcessingStatus;
-import org.eclipse.scout.rt.client.ui.form.fields.ScoutFieldStatus;
-import org.eclipse.scout.rt.shared.AbstractIcons;
-import org.eclipse.scout.rt.shared.data.basic.FontSpec;
-import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
-import org.eclipse.scout.rt.ui.rap.LogicalGridData;
-import org.eclipse.scout.rt.ui.rap.basic.comp.CLabelEx;
-import org.eclipse.scout.rt.ui.rap.extension.ILookAndFeelDecorations;
-import org.eclipse.scout.rt.ui.rap.extension.UiDecorationExtensionPoint;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CLabel;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-
-public class StatusLabelEx extends Composite implements ILabelComposite {
- private static final long serialVersionUID = 1L;
- private static final String STAR_MARKER = "*";
- private static final String WHITE_SPACE = " ";
-
- private IProcessingStatus m_status;
- private boolean m_mandatory;
- private Control m_label;
-
- private Label m_statusLabel;
- private final Image m_infoImg;
- private final Image m_warningImg;
- private final Image m_errorImg;
-
- private String m_preMarker = "";
- private String m_postMarker = "";
- private Font m_nonMandatoryFont;
- protected Font m_mandatoryFont;
- private Color m_nonMandatoryForegroundColor;
- protected Color m_mandatoryForegroundColor;
- private String m_nonMandatoryText = "";
-
- public StatusLabelEx(Composite parent, int style) {
- super(parent, SWT.NO_FOCUS);
- m_infoImg = getUiEnvironment().getIcon(AbstractIcons.StatusInfo);
- m_warningImg = getUiEnvironment().getIcon(AbstractIcons.StatusWarning);
- m_errorImg = getUiEnvironment().getIcon(AbstractIcons.StatusError);
-
- createContent(this, style);
- createLayout();
-
- m_nonMandatoryFont = m_label.getFont();
- m_nonMandatoryForegroundColor = m_label.getForeground();
- }
-
- protected void createLayout() {
- GridLayout containerLayout = new GridLayout(2, false);
- containerLayout.horizontalSpacing = 0;
- containerLayout.marginHeight = 0;
- containerLayout.marginWidth = 0;
- containerLayout.verticalSpacing = 0;
- setLayout(containerLayout);
- }
-
- protected void createContent(Composite parent, int style) {
- m_label = new CLabelEx(parent, style | getUiEnvironment().getFormToolkit().getFormToolkit().getOrientation());
- getUiEnvironment().getFormToolkit().getFormToolkit().adapt(m_label, false, false);
-
- m_statusLabel = new Label(parent, SWT.NONE);
- getUiEnvironment().getFormToolkit().getFormToolkit().adapt(m_statusLabel, false, false);
-
- //Make sure the label composite fills the cell so that horizontal alignment of the text works well
- GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
- m_label.setLayoutData(data);
-
- data = new GridData(SWT.RIGHT, SWT.CENTER, false, false);
- data.verticalIndent = 3;
- m_statusLabel.setLayoutData(data);
- }
-
- protected IRwtEnvironment getUiEnvironment() {
- return (IRwtEnvironment) getDisplay().getData(IRwtEnvironment.class.getName());
- }
-
- /**
- * Reads the mandatory settings if not already read
- */
- protected void initMandatorySettings() {
- if (m_mandatoryFont == null) {
- FontSpec labelFontSpec = UiDecorationExtensionPoint.getLookAndFeel().getMandatoryLabelFont();
- if (labelFontSpec != null) {
- m_mandatoryFont = getUiEnvironment().getFont(labelFontSpec, getNonMandatoryFont());
- }
- }
-
- if (m_mandatoryForegroundColor == null) {
- String labelTextColor = UiDecorationExtensionPoint.getLookAndFeel().getMandatoryLabelTextColor();
- if (labelTextColor != null) {
- m_mandatoryForegroundColor = getUiEnvironment().getColor(labelTextColor);
- }
- }
-
- if (!StringUtility.hasText(m_postMarker) && !StringUtility.hasText(m_preMarker)) {
- int starPos = UiDecorationExtensionPoint.getLookAndFeel().getMandatoryStarMarkerPosition();
- if (starPos != ILookAndFeelDecorations.STAR_MARKER_NONE) {
- switch (starPos) {
- case ILookAndFeelDecorations.STAR_MARKER_AFTER_LABEL:
- m_postMarker = STAR_MARKER + WHITE_SPACE;
- break;
- case ILookAndFeelDecorations.STAR_MARKER_BEFORE_LABEL:
- m_preMarker = STAR_MARKER + WHITE_SPACE;
- break;
- }
- }
- }
-
- }
-
- @Override
- public void setLayoutWidthHint(int w) {
- Object o = getLayoutData();
- if (o instanceof LogicalGridData) {
- LogicalGridData data = (LogicalGridData) o;
- data.widthHint = w;
- }
- }
-
- /**
- * @param b
- * @return if the layout has to be updated up to the top container.
- */
- @Override
- public boolean setMandatory(boolean mandatory) {
- if (isMandatory() == mandatory) {
- return false;
- }
- m_mandatory = mandatory;
-
- if (mandatory) {
- initMandatorySettings();
- }
-
- boolean updateLayout = false;
- if (getMandatoryFont() != null) {
- updateLabelFont();
- updateLayout = true;
- }
- if (getMandatoryForegroundColor() != null) {
- updateLabelForeground();
- updateLayout = true;
- }
- if (getPreMarker() != null) {
- updateText();
- updateLayout = true;
- }
- if (getPostMarker() != null) {
- updateMandatoryStatus();
- updateLayout = true;
- }
-
- return updateLayout;
- }
-
- @Override
- public void setEnabled(boolean enabled) {
- super.setEnabled(enabled);
-
- if (enabled) {
- setForeground(null);
- }
- else {
- setForeground(getUiEnvironment().getColor(UiDecorationExtensionPoint.getLookAndFeel().getColorForegroundDisabled()));
- }
- }
-
- protected void updateMandatoryStatus() {
- if (m_status != null) {
- return;
- }
- if (isMandatory()) {
- m_statusLabel.setText(m_postMarker);
- m_statusLabel.setVisible(true);
- ((GridData) getStatusLabel().getLayoutData()).exclude = false;
- }
- else {
- m_statusLabel.setVisible(false);
- ((GridData) getStatusLabel().getLayoutData()).exclude = true;
- }
- layout(true, true);
- }
-
- protected void updateLabelForeground() {
- //Update the foreground only if the field is enabled otherwise the disabled state would not be visible
- if (isEnabled() && isMandatory()) {
- m_label.setForeground(getMandatoryForegroundColor());
- }
- else {
- m_label.setForeground(getNonMandatoryForegroundColor());
- }
- }
-
- protected void updateLabelFont() {
- if (isMandatory()) {
- m_label.setFont(getMandatoryFont());
- }
- else {
- m_label.setFont(getNonMandatoryFont());
- }
- }
-
- protected void updateText() {
- if (isMandatory()) {
- setLabelText(m_preMarker + getNonMandatoryText());
- }
- else {
- setLabelText(getNonMandatoryText());
- }
- }
-
- protected void setLabelText(String text) {
- if (m_label instanceof CLabel) {
- ((CLabel) m_label).setText(text);
- }
- }
-
- protected String getLabelText() {
- if (m_label instanceof CLabel) {
- return ((CLabel) m_label).getText();
- }
-
- return null;
- }
-
- @Override
- public void setStatus(IProcessingStatus status) {
- m_status = status;
- if (m_status == null) {
- getStatusLabel().setToolTipText("");
- getStatusLabel().setImage(null);
- getStatusLabel().setVisible(false);
- if (getStatusLabel().getLayoutData() instanceof GridData) {
- ((GridData) getStatusLabel().getLayoutData()).exclude = true;
- }
- if (isMandatory()) {
- updateMandatoryStatus();
- }
- }
- else {
- String iconId = m_status instanceof ScoutFieldStatus ? ((ScoutFieldStatus) m_status).getIconId() : null;
- if (iconId != null) {
- getStatusLabel().setImage(getUiEnvironment().getIcon(iconId));
- }
- else {
- switch (m_status.getSeverity()) {
- case IProcessingStatus.FATAL:
- case IProcessingStatus.ERROR:
- getStatusLabel().setImage(m_errorImg);
- break;
- case IProcessingStatus.WARNING:
- getStatusLabel().setImage(m_warningImg);
- break;
- default:
- getStatusLabel().setImage(m_infoImg);
- break;
- }
- }
- // tooltip
- StringBuffer buf = new StringBuffer();
- if (m_status.getTitle() != null) {
- buf.append(m_status.getTitle());
- }
- if (m_status.getMessage() != null) {
- if (buf.length() > 0) {
- buf.append("\n");
- }
- buf.append(m_status.getMessage());
- }
- getStatusLabel().setToolTipText(buf.toString());
- getStatusLabel().setVisible(true);
- if (getStatusLabel().getLayoutData() instanceof GridData) {
- ((GridData) getStatusLabel().getLayoutData()).exclude = false;
- }
- }
- layout(true, true);
- }
-
-// delegate methods
- @Override
- public String getText() {
- return getLabelText();
- }
-
- @Override
- public void setText(String text) {
- if (text == null) {
- text = "";
- }
-
- m_nonMandatoryText = text;
- updateText();
- }
-
- @Override
- public void setBackground(Color color) {
- super.setBackground(color);
-
- m_label.setBackground(color);
- }
-
- @Override
- public void setForeground(Color color) {
- super.setForeground(color);
-
- m_nonMandatoryForegroundColor = color;
- updateLabelForeground();
- }
-
- @Override
- public void setFont(Font font) {
- super.setFont(font);
-
- m_nonMandatoryFont = font;
- updateLabelFont();
- }
-
- @Override
- public Font getFont() {
- return m_label.getFont();
- }
-
- public Font getNonMandatoryFont() {
- return m_nonMandatoryFont;
- }
-
- public void setNonMandatoryFont(Font nonMandatoryFont) {
- m_nonMandatoryFont = nonMandatoryFont;
- }
-
- public Font getMandatoryFont() {
- return m_mandatoryFont;
- }
-
- public void setMandatoryFont(Font mandatoryFont) {
- m_mandatoryFont = mandatoryFont;
- }
-
- public Color getNonMandatoryForegroundColor() {
- return m_nonMandatoryForegroundColor;
- }
-
- public void setNonMandatoryForegroundColor(Color nonMandatoryForegroundColor) {
- m_nonMandatoryForegroundColor = nonMandatoryForegroundColor;
- }
-
- public Color getMandatoryForegroundColor() {
- return m_mandatoryForegroundColor;
- }
-
- public void setMandatoryForegroundColor(Color mandatoryForegroundColor) {
- m_mandatoryForegroundColor = mandatoryForegroundColor;
- }
-
- public String getPreMarker() {
- return m_preMarker;
- }
-
- public String getPostMarker() {
- return m_postMarker;
- }
-
- public Label getStatusLabel() {
- return m_statusLabel;
- }
-
- protected void setStatusLabel(Label statusLabel) {
- m_statusLabel = statusLabel;
- }
-
- public boolean isMandatory() {
- return m_mandatory;
- }
-
- public String getNonMandatoryText() {
- return m_nonMandatoryText;
- }
-
- protected void setLabel(Control label) {
- m_label = label;
- }
-
- public Control getLabel() {
- return m_label;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.ext;
+
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.exception.IProcessingStatus;
+import org.eclipse.scout.rt.client.ui.form.fields.ScoutFieldStatus;
+import org.eclipse.scout.rt.shared.AbstractIcons;
+import org.eclipse.scout.rt.shared.data.basic.FontSpec;
+import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
+import org.eclipse.scout.rt.ui.rap.LogicalGridData;
+import org.eclipse.scout.rt.ui.rap.basic.comp.CLabelEx;
+import org.eclipse.scout.rt.ui.rap.extension.ILookAndFeelDecorations;
+import org.eclipse.scout.rt.ui.rap.extension.UiDecorationExtensionPoint;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+
+public class StatusLabelEx extends Composite implements ILabelComposite {
+ private static final long serialVersionUID = 1L;
+ private static final String STAR_MARKER = "*";
+ private static final String WHITE_SPACE = " ";
+
+ private IProcessingStatus m_status;
+ private boolean m_mandatory;
+ private Control m_label;
+
+ private Label m_statusLabel;
+ private final Image m_infoImg;
+ private final Image m_warningImg;
+ private final Image m_errorImg;
+
+ private String m_preMarker = "";
+ private String m_postMarker = "";
+ private Font m_nonMandatoryFont;
+ protected Font m_mandatoryFont;
+ private Color m_nonMandatoryForegroundColor;
+ protected Color m_mandatoryForegroundColor;
+ private String m_nonMandatoryText = "";
+
+ public StatusLabelEx(Composite parent, int style) {
+ super(parent, SWT.NO_FOCUS);
+ m_infoImg = getUiEnvironment().getIcon(AbstractIcons.StatusInfo);
+ m_warningImg = getUiEnvironment().getIcon(AbstractIcons.StatusWarning);
+ m_errorImg = getUiEnvironment().getIcon(AbstractIcons.StatusError);
+
+ createContent(this, style);
+ createLayout();
+
+ m_nonMandatoryFont = m_label.getFont();
+ m_nonMandatoryForegroundColor = m_label.getForeground();
+ }
+
+ protected void createLayout() {
+ GridLayout containerLayout = new GridLayout(2, false);
+ containerLayout.horizontalSpacing = 0;
+ containerLayout.marginHeight = 0;
+ containerLayout.marginWidth = 0;
+ containerLayout.verticalSpacing = 0;
+ setLayout(containerLayout);
+ }
+
+ protected void createContent(Composite parent, int style) {
+ m_label = new CLabelEx(parent, style | getUiEnvironment().getFormToolkit().getFormToolkit().getOrientation());
+ getUiEnvironment().getFormToolkit().getFormToolkit().adapt(m_label, false, false);
+
+ m_statusLabel = new Label(parent, SWT.NONE);
+ getUiEnvironment().getFormToolkit().getFormToolkit().adapt(m_statusLabel, false, false);
+
+ //Make sure the label composite fills the cell so that horizontal alignment of the text works well
+ GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
+ m_label.setLayoutData(data);
+
+ data = new GridData(SWT.RIGHT, SWT.CENTER, false, false);
+ data.verticalIndent = 3;
+ m_statusLabel.setLayoutData(data);
+ }
+
+ protected IRwtEnvironment getUiEnvironment() {
+ return (IRwtEnvironment) getDisplay().getData(IRwtEnvironment.class.getName());
+ }
+
+ /**
+ * Reads the mandatory settings if not already read
+ */
+ protected void initMandatorySettings() {
+ if (m_mandatoryFont == null) {
+ FontSpec labelFontSpec = UiDecorationExtensionPoint.getLookAndFeel().getMandatoryLabelFont();
+ if (labelFontSpec != null) {
+ m_mandatoryFont = getUiEnvironment().getFont(labelFontSpec, getNonMandatoryFont());
+ }
+ }
+
+ if (m_mandatoryForegroundColor == null) {
+ String labelTextColor = UiDecorationExtensionPoint.getLookAndFeel().getMandatoryLabelTextColor();
+ if (labelTextColor != null) {
+ m_mandatoryForegroundColor = getUiEnvironment().getColor(labelTextColor);
+ }
+ }
+
+ if (!StringUtility.hasText(m_postMarker) && !StringUtility.hasText(m_preMarker)) {
+ int starPos = UiDecorationExtensionPoint.getLookAndFeel().getMandatoryStarMarkerPosition();
+ if (starPos != ILookAndFeelDecorations.STAR_MARKER_NONE) {
+ switch (starPos) {
+ case ILookAndFeelDecorations.STAR_MARKER_AFTER_LABEL:
+ m_postMarker = STAR_MARKER + WHITE_SPACE;
+ break;
+ case ILookAndFeelDecorations.STAR_MARKER_BEFORE_LABEL:
+ m_preMarker = STAR_MARKER + WHITE_SPACE;
+ break;
+ }
+ }
+ }
+
+ }
+
+ @Override
+ public void setLayoutWidthHint(int w) {
+ Object o = getLayoutData();
+ if (o instanceof LogicalGridData) {
+ LogicalGridData data = (LogicalGridData) o;
+ data.widthHint = w;
+ }
+ }
+
+ /**
+ * @param b
+ * @return if the layout has to be updated up to the top container.
+ */
+ @Override
+ public boolean setMandatory(boolean mandatory) {
+ if (isMandatory() == mandatory) {
+ return false;
+ }
+ m_mandatory = mandatory;
+
+ if (mandatory) {
+ initMandatorySettings();
+ }
+
+ boolean updateLayout = false;
+ if (getMandatoryFont() != null) {
+ updateLabelFont();
+ updateLayout = true;
+ }
+ if (getMandatoryForegroundColor() != null) {
+ updateLabelForeground();
+ updateLayout = true;
+ }
+ if (getPreMarker() != null) {
+ updateText();
+ updateLayout = true;
+ }
+ if (getPostMarker() != null) {
+ updateMandatoryStatus();
+ updateLayout = true;
+ }
+
+ return updateLayout;
+ }
+
+ @Override
+ public void setEnabled(boolean enabled) {
+ super.setEnabled(enabled);
+
+ if (enabled) {
+ setForeground(null);
+ }
+ else {
+ setForeground(getUiEnvironment().getColor(UiDecorationExtensionPoint.getLookAndFeel().getColorForegroundDisabled()));
+ }
+ }
+
+ protected void updateMandatoryStatus() {
+ if (m_status != null) {
+ return;
+ }
+ if (isMandatory()) {
+ m_statusLabel.setText(m_postMarker);
+ m_statusLabel.setVisible(true);
+ ((GridData) getStatusLabel().getLayoutData()).exclude = false;
+ }
+ else {
+ m_statusLabel.setVisible(false);
+ ((GridData) getStatusLabel().getLayoutData()).exclude = true;
+ }
+ layout(true, true);
+ }
+
+ protected void updateLabelForeground() {
+ //Update the foreground only if the field is enabled otherwise the disabled state would not be visible
+ if (isEnabled() && isMandatory()) {
+ m_label.setForeground(getMandatoryForegroundColor());
+ }
+ else {
+ m_label.setForeground(getNonMandatoryForegroundColor());
+ }
+ }
+
+ protected void updateLabelFont() {
+ if (isMandatory()) {
+ m_label.setFont(getMandatoryFont());
+ }
+ else {
+ m_label.setFont(getNonMandatoryFont());
+ }
+ }
+
+ protected void updateText() {
+ if (isMandatory()) {
+ setLabelText(m_preMarker + getNonMandatoryText());
+ }
+ else {
+ setLabelText(getNonMandatoryText());
+ }
+ }
+
+ protected void setLabelText(String text) {
+ if (m_label instanceof CLabel) {
+ ((CLabel) m_label).setText(text);
+ }
+ }
+
+ protected String getLabelText() {
+ if (m_label instanceof CLabel) {
+ return ((CLabel) m_label).getText();
+ }
+
+ return null;
+ }
+
+ @Override
+ public void setStatus(IProcessingStatus status) {
+ m_status = status;
+ if (m_status == null) {
+ getStatusLabel().setToolTipText("");
+ getStatusLabel().setImage(null);
+ getStatusLabel().setVisible(false);
+ if (getStatusLabel().getLayoutData() instanceof GridData) {
+ ((GridData) getStatusLabel().getLayoutData()).exclude = true;
+ }
+ if (isMandatory()) {
+ updateMandatoryStatus();
+ }
+ }
+ else {
+ String iconId = m_status instanceof ScoutFieldStatus ? ((ScoutFieldStatus) m_status).getIconId() : null;
+ if (iconId != null) {
+ getStatusLabel().setImage(getUiEnvironment().getIcon(iconId));
+ }
+ else {
+ switch (m_status.getSeverity()) {
+ case IProcessingStatus.FATAL:
+ case IProcessingStatus.ERROR:
+ getStatusLabel().setImage(m_errorImg);
+ break;
+ case IProcessingStatus.WARNING:
+ getStatusLabel().setImage(m_warningImg);
+ break;
+ default:
+ getStatusLabel().setImage(m_infoImg);
+ break;
+ }
+ }
+ // tooltip
+ StringBuffer buf = new StringBuffer();
+ if (m_status.getTitle() != null) {
+ buf.append(m_status.getTitle());
+ }
+ if (m_status.getMessage() != null) {
+ if (buf.length() > 0) {
+ buf.append("\n");
+ }
+ buf.append(m_status.getMessage());
+ }
+ getStatusLabel().setToolTipText(buf.toString());
+ getStatusLabel().setVisible(true);
+ if (getStatusLabel().getLayoutData() instanceof GridData) {
+ ((GridData) getStatusLabel().getLayoutData()).exclude = false;
+ }
+ }
+ layout(true, true);
+ }
+
+// delegate methods
+ @Override
+ public String getText() {
+ return getLabelText();
+ }
+
+ @Override
+ public void setText(String text) {
+ if (text == null) {
+ text = "";
+ }
+
+ m_nonMandatoryText = text;
+ updateText();
+ }
+
+ @Override
+ public void setBackground(Color color) {
+ super.setBackground(color);
+
+ m_label.setBackground(color);
+ }
+
+ @Override
+ public void setForeground(Color color) {
+ super.setForeground(color);
+
+ m_nonMandatoryForegroundColor = color;
+ updateLabelForeground();
+ }
+
+ @Override
+ public void setFont(Font font) {
+ super.setFont(font);
+
+ m_nonMandatoryFont = font;
+ updateLabelFont();
+ }
+
+ @Override
+ public Font getFont() {
+ return m_label.getFont();
+ }
+
+ public Font getNonMandatoryFont() {
+ return m_nonMandatoryFont;
+ }
+
+ public void setNonMandatoryFont(Font nonMandatoryFont) {
+ m_nonMandatoryFont = nonMandatoryFont;
+ }
+
+ public Font getMandatoryFont() {
+ return m_mandatoryFont;
+ }
+
+ public void setMandatoryFont(Font mandatoryFont) {
+ m_mandatoryFont = mandatoryFont;
+ }
+
+ public Color getNonMandatoryForegroundColor() {
+ return m_nonMandatoryForegroundColor;
+ }
+
+ public void setNonMandatoryForegroundColor(Color nonMandatoryForegroundColor) {
+ m_nonMandatoryForegroundColor = nonMandatoryForegroundColor;
+ }
+
+ public Color getMandatoryForegroundColor() {
+ return m_mandatoryForegroundColor;
+ }
+
+ public void setMandatoryForegroundColor(Color mandatoryForegroundColor) {
+ m_mandatoryForegroundColor = mandatoryForegroundColor;
+ }
+
+ public String getPreMarker() {
+ return m_preMarker;
+ }
+
+ public String getPostMarker() {
+ return m_postMarker;
+ }
+
+ public Label getStatusLabel() {
+ return m_statusLabel;
+ }
+
+ protected void setStatusLabel(Label statusLabel) {
+ m_statusLabel = statusLabel;
+ }
+
+ public boolean isMandatory() {
+ return m_mandatory;
+ }
+
+ public String getNonMandatoryText() {
+ return m_nonMandatoryText;
+ }
+
+ protected void setLabel(Control label) {
+ m_label = label;
+ }
+
+ public Control getLabel() {
+ return m_label;
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/StatusLabelTop.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/StatusLabelTop.java
index 4fe5b33d33..204af4a3d3 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/StatusLabelTop.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/StatusLabelTop.java
@@ -1,102 +1,102 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.ext;
-
-import org.eclipse.scout.rt.ui.rap.basic.comp.CLabelEx;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-
-/**
- * <p>
- * Contains a label to use on top of a field.
- * </p>
- * <p>
- * Compared to {@link StatusLabelEx} which uses a {@link CLabelEx} the text won't be shortened but wrapped instead (if
- * style is set to SWT.WRAP). Additionally the place of the status icon is different. It is located left to the text and
- * not at the right side.
- * </p>
- */
-public class StatusLabelTop extends StatusLabelEx {
-
- private static final long serialVersionUID = 1L;
-
- public StatusLabelTop(Composite parent, int style) {
- super(parent, style);
- }
-
- @Override
- protected void createLayout() {
- GridLayout containerLayout = new GridLayout(2, false);
- containerLayout.horizontalSpacing = 0;
- containerLayout.marginHeight = 0;
- containerLayout.marginWidth = 0;
- containerLayout.verticalSpacing = 0;
- containerLayout.marginBottom = 0;
-
- //Margin on top to clearly separate the fields
- containerLayout.marginTop = 6;
-
- setLayout(containerLayout);
- }
-
- @Override
- protected void createContent(Composite parent, int style) {
- setStatusLabel(new Label(parent, SWT.NONE));
- getUiEnvironment().getFormToolkit().getFormToolkit().adapt(getStatusLabel(), false, false);
-
- style |= SWT.WRAP;
- Label label = getUiEnvironment().getFormToolkit().createLabel(parent, "", style);
- setLabel(label);
-
- //Set the status icon to the top left corner
- GridData data = new GridData(SWT.LEFT, SWT.TOP, false, false);
- getStatusLabel().setLayoutData(data);
-
- //Make sure the label composite fills the cell so that horizontal alignment of the text works well
- data = new GridData(SWT.FILL, SWT.FILL, true, true);
- label.setLayoutData(data);
- }
-
- @Override
- protected void setLabelText(String text) {
- if (getLabel() instanceof Label) {
- ((Label) getLabel()).setText(text);
- }
- }
-
- @Override
- protected void updateText() {
- if (isMandatory()) {
- setLabelText(getPreMarker() + getNonMandatoryText() + getPostMarker());
- }
- else {
- setLabelText(getNonMandatoryText());
- }
- }
-
- @Override
- protected void updateMandatoryStatus() {
- updateText();
- }
-
- @Override
- protected String getLabelText() {
- if (getLabel() instanceof Label) {
- return ((Label) getLabel()).getText();
- }
-
- return null;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.ext;
+
+import org.eclipse.scout.rt.ui.rap.basic.comp.CLabelEx;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+
+/**
+ * <p>
+ * Contains a label to use on top of a field.
+ * </p>
+ * <p>
+ * Compared to {@link StatusLabelEx} which uses a {@link CLabelEx} the text won't be shortened but wrapped instead (if
+ * style is set to SWT.WRAP). Additionally the place of the status icon is different. It is located left to the text and
+ * not at the right side.
+ * </p>
+ */
+public class StatusLabelTop extends StatusLabelEx {
+
+ private static final long serialVersionUID = 1L;
+
+ public StatusLabelTop(Composite parent, int style) {
+ super(parent, style);
+ }
+
+ @Override
+ protected void createLayout() {
+ GridLayout containerLayout = new GridLayout(2, false);
+ containerLayout.horizontalSpacing = 0;
+ containerLayout.marginHeight = 0;
+ containerLayout.marginWidth = 0;
+ containerLayout.verticalSpacing = 0;
+ containerLayout.marginBottom = 0;
+
+ //Margin on top to clearly separate the fields
+ containerLayout.marginTop = 6;
+
+ setLayout(containerLayout);
+ }
+
+ @Override
+ protected void createContent(Composite parent, int style) {
+ setStatusLabel(new Label(parent, SWT.NONE));
+ getUiEnvironment().getFormToolkit().getFormToolkit().adapt(getStatusLabel(), false, false);
+
+ style |= SWT.WRAP;
+ Label label = getUiEnvironment().getFormToolkit().createLabel(parent, "", style);
+ setLabel(label);
+
+ //Set the status icon to the top left corner
+ GridData data = new GridData(SWT.LEFT, SWT.TOP, false, false);
+ getStatusLabel().setLayoutData(data);
+
+ //Make sure the label composite fills the cell so that horizontal alignment of the text works well
+ data = new GridData(SWT.FILL, SWT.FILL, true, true);
+ label.setLayoutData(data);
+ }
+
+ @Override
+ protected void setLabelText(String text) {
+ if (getLabel() instanceof Label) {
+ ((Label) getLabel()).setText(text);
+ }
+ }
+
+ @Override
+ protected void updateText() {
+ if (isMandatory()) {
+ setLabelText(getPreMarker() + getNonMandatoryText() + getPostMarker());
+ }
+ else {
+ setLabelText(getNonMandatoryText());
+ }
+ }
+
+ @Override
+ protected void updateMandatoryStatus() {
+ updateText();
+ }
+
+ @Override
+ protected String getLabelText() {
+ if (getLabel() instanceof Label) {
+ return ((Label) getLabel()).getText();
+ }
+
+ return null;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/StyledTextEx.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/StyledTextEx.java
index 004586f462..3c641347d8 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/StyledTextEx.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/StyledTextEx.java
@@ -1,62 +1,62 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.ext;
-
-import org.eclipse.scout.rt.ui.rap.ext.custom.StyledText;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * <h3>StyledTextEx</h3> ...
- *
- * @since 3.7.0 June 2011
- */
-/*
- * XXX hstaudacher I don't thing that we need a styled text for all the fields.
- * Your solution with the composite + text + button does work fine. Maybe we
- * can avoid using the StyledText and avoid this inheritence line
- */
-public class StyledTextEx extends StyledText {
- private static final long serialVersionUID = 1L;
-
- public StyledTextEx(Composite parent, int style) {
- super(parent, style);
- // Make sure that the menus are initially enabled
- setEnabled(true);
- }
-
- @Override
- protected void checkSubclass() {
- }
-
- @Override
- public void setEnabled(boolean enabled) {
-// super.setEnabled(enabled);
- super.setEditable(enabled);
- }
-
- @Override
- /** {@inheritDoc} */
- public void setBounds(int x, int y, int width, int height) {
- super.setBounds(x, y, width, height);
- updateVerticalScrollbarVisibility();
- }
-
- protected void updateVerticalScrollbarVisibility() {
- /*XXX
- Rectangle clientArea = getClientArea();
- Point size = computeSize(clientArea.width, SWT.DEFAULT, false);
- ScrollBar vBar = getVerticalBar();
- if (vBar != null && !vBar.isDisposed()) {
- vBar.setVisible(size.y > clientArea.height);
- }
- */
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.ext;
+
+import org.eclipse.scout.rt.ui.rap.ext.custom.StyledText;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * <h3>StyledTextEx</h3> ...
+ *
+ * @since 3.7.0 June 2011
+ */
+/*
+ * XXX hstaudacher I don't thing that we need a styled text for all the fields.
+ * Your solution with the composite + text + button does work fine. Maybe we
+ * can avoid using the StyledText and avoid this inheritence line
+ */
+public class StyledTextEx extends StyledText {
+ private static final long serialVersionUID = 1L;
+
+ public StyledTextEx(Composite parent, int style) {
+ super(parent, style);
+ // Make sure that the menus are initially enabled
+ setEnabled(true);
+ }
+
+ @Override
+ protected void checkSubclass() {
+ }
+
+ @Override
+ public void setEnabled(boolean enabled) {
+// super.setEnabled(enabled);
+ super.setEditable(enabled);
+ }
+
+ @Override
+ /** {@inheritDoc} */
+ public void setBounds(int x, int y, int width, int height) {
+ super.setBounds(x, y, width, height);
+ updateVerticalScrollbarVisibility();
+ }
+
+ protected void updateVerticalScrollbarVisibility() {
+ /*XXX
+ Rectangle clientArea = getClientArea();
+ Point size = computeSize(clientArea.width, SWT.DEFAULT, false);
+ ScrollBar vBar = getVerticalBar();
+ if (vBar != null && !vBar.isDisposed()) {
+ vBar.setVisible(size.y > clientArea.height);
+ }
+ */
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/TextEx.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/TextEx.java
index f704e08164..2739e5085a 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/TextEx.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/TextEx.java
@@ -1,57 +1,57 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.ext;
-
-import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * <h3>TextEx</h3> Added disabled copy menu
- *
- * @since 3.7.0 June 2011
- */
-public class TextEx extends Text {
- private static final long serialVersionUID = 1L;
-
- public TextEx(Composite parent, int style) {
- super(parent, style);
- }
-
- private IRwtEnvironment getUiEnvironment() {
- return (IRwtEnvironment) getDisplay().getData(IRwtEnvironment.class.getName());
- }
-
- @Override
- protected void checkSubclass() {
- // allow subclassing
- }
-
- @Override
- public boolean setFocus() {
- boolean editable = getEditable();
- if (editable) {
- editable = super.setFocus();
- }
- return editable;
- }
-
- public void setOnFieldLabel(String text) {
- checkWidget();
- if (text == null) {
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
- }
- if (text != null) {
- setText(text);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.ext;
+
+import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * <h3>TextEx</h3> Added disabled copy menu
+ *
+ * @since 3.7.0 June 2011
+ */
+public class TextEx extends Text {
+ private static final long serialVersionUID = 1L;
+
+ public TextEx(Composite parent, int style) {
+ super(parent, style);
+ }
+
+ private IRwtEnvironment getUiEnvironment() {
+ return (IRwtEnvironment) getDisplay().getData(IRwtEnvironment.class.getName());
+ }
+
+ @Override
+ protected void checkSubclass() {
+ // allow subclassing
+ }
+
+ @Override
+ public boolean setFocus() {
+ boolean editable = getEditable();
+ if (editable) {
+ editable = super.setFocus();
+ }
+ return editable;
+ }
+
+ public void setOnFieldLabel(String text) {
+ checkWidget();
+ if (text == null) {
+ SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ }
+ if (text != null) {
+ setText(text);
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/WizardStatusButton.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/WizardStatusButton.java
index 7688d946e7..55af11617d 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/WizardStatusButton.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/WizardStatusButton.java
@@ -1,296 +1,296 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.ext;
-
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.events.PaintListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Canvas;
-import org.eclipse.swt.widgets.Composite;
-
-public class WizardStatusButton extends Canvas {
- private static final long serialVersionUID = 1L;
-
- private static final String ELLIPSIS = "...";
- private Font m_textFont;
- private Font m_stepFont;
- private String m_text;
- private int m_step;
- private boolean m_selected;
- private Color m_selectedBorderColor;
- private Color m_selectedBackground;
- private Color m_selectedBackgroundGradient;
- private Color m_selectedForeground;
- private Color m_background;
- private Color m_backgroundGradient;
- private Color m_foreground;
-
- public WizardStatusButton(Composite parent, int style) {
- super(parent, style);
- initResources();
- addDisposeListener(new DisposeListener() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void widgetDisposed(DisposeEvent e) {
- freeResources();
- }
- });
- addPaintListener(new PaintListener() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void paintControl(PaintEvent e) {
- paint(e.gc);
- }
- });
- }
-
- protected void initResources() {
- m_selectedBorderColor = new Color(this.getDisplay(), 213, 216, 243);
- m_selectedBackground = new Color(this.getDisplay(), 94, 122, 194);
- m_selectedBackgroundGradient = new Color(this.getDisplay(), 213, 216,
- 243);
- m_selectedForeground = new Color(this.getDisplay(), 255, 255, 255);
- m_background = new Color(this.getDisplay(), 219, 226, 245);
- m_backgroundGradient = new Color(this.getDisplay(), 219, 226, 245);
- m_foreground = new Color(this.getDisplay(), 0, 0, 0);
- }
-
- protected void freeResources() {
- if (m_selectedBorderColor != null && !m_selectedBorderColor.isDisposed() && m_selectedBorderColor.getDevice() != null) {
- m_selectedBorderColor.dispose();
- m_selectedBorderColor = null;
- }
- if (m_selectedBackground != null && !m_selectedBackground.isDisposed() && m_selectedBackground.getDevice() != null) {
- m_selectedBackground.dispose();
- m_selectedBackground = null;
- }
- if (m_selectedBackgroundGradient != null && !m_selectedBackgroundGradient.isDisposed() && m_selectedBackgroundGradient.getDevice() != null) {
- m_selectedBackgroundGradient.dispose();
- m_selectedBackgroundGradient = null;
- }
- if (m_selectedForeground != null && !m_selectedForeground.isDisposed() && m_selectedForeground.getDevice() != null) {
- m_selectedForeground.dispose();
- m_selectedForeground = null;
- }
- if (m_background != null && !m_background.isDisposed() && m_background.getDevice() != null) {
- m_background.dispose();
- m_background = null;
- }
- if (m_backgroundGradient != null && !m_backgroundGradient.isDisposed() && m_backgroundGradient.getDevice() != null) {
- m_backgroundGradient.dispose();
- m_backgroundGradient = null;
- }
- if (m_foreground != null && !m_foreground.isDisposed() && m_foreground.getDevice() != null) {
- m_foreground.dispose();
- m_foreground = null;
- }
- }
-
- protected void paint(GC gc) {
- // gc.setAdvanced(true);
- // gc.setFillRule(SWT.FILL_WINDING);
- // gc.setInterpolation(SWT.HIGH);
-
- if (m_selected) {
- paintSelectedBackground(gc);
- gc.setForeground(m_selectedForeground);
- }
- else {
- paintBackground(gc);
- gc.setForeground(m_foreground);
- }
-
- Rectangle bounds = getBounds();
- Point imageSize = computeSize(-1, -1, false);
- gc.setFont(m_stepFont);
- Point stepSize = gc.textExtent("" + m_step);
- gc.drawText(m_step + "", (imageSize.y - stepSize.x) / 2,
- (imageSize.y - stepSize.y) / 2, true);
- gc.setFont(m_textFont);
- String text = m_text;
- if (text == null) {
- text = "";
- }
- Point textBounds = gc.textExtent(text);
- int availableSpace = bounds.width - height - 6;
- if (availableSpace < textBounds.x) {
- setToolTipText(text);
- text = shortenText(gc, text, availableSpace);
- textBounds = gc.textExtent(text);
- }
- else {
- setToolTipText(null);
- }
- gc.drawText(text, height + 3, (height - textBounds.y) / 2, true);
- }
-
- int height = 26;
- int borderWith = 2;
-
- protected void paintSelectedBackground(GC gc) {
-
- Rectangle bounds = getBounds();
- // circle right
-
- gc.setBackground(m_selectedBorderColor);
- gc.fillOval(bounds.width - height, 0, height, height);
- gc.setBackground(m_selectedBackgroundGradient);
- gc.fillOval(bounds.width - height + borderWith, borderWith, height - 2
- * borderWith, height - 2 * borderWith);
-
- // border rectangle center
- gc.setBackground(m_selectedBorderColor);
- gc.fillRectangle(height / 2, 0, bounds.width - height, height);
- gc.setBackground(m_selectedBackgroundGradient);
- gc.setForeground(m_selectedBackground);
- gc.fillGradientRectangle(height / 2 + borderWith, borderWith,
- bounds.width - height - 2 * borderWith,
- height - 2 * borderWith, false);
-
- // border circle left
- gc.setAlpha(150);
- gc.setBackground(m_selectedBorderColor);
- gc.fillOval(0, 0, height, height);
- gc.setAlpha(255);
- gc.setBackground(m_selectedBackground);
- gc.fillOval(borderWith, borderWith, height - 2 * borderWith, height - 2
- * borderWith);
- }
-
- protected void paintBackground(GC gc) {
-
- Rectangle bounds = getBounds();
- // circle right
-
- gc.setBackground(m_backgroundGradient);
- gc.fillOval(bounds.width - height, 0, height, height);
- gc.setBackground(m_backgroundGradient);
- gc.fillOval(bounds.width - height + borderWith, borderWith, height - 2
- * borderWith, height - 2 * borderWith);
-
- // border rectangle center
- gc.setBackground(m_backgroundGradient);
- gc.fillRectangle(height / 2, 0, bounds.width - height, height);
- gc.setBackground(m_backgroundGradient);
- gc.setForeground(m_background);
- gc.fillGradientRectangle(height / 2 + borderWith, borderWith,
- bounds.width - height - 2 * borderWith,
- height - 2 * borderWith, false);
-
- // border circle left
- gc.setAlpha(150);
- gc.setBackground(m_backgroundGradient);
- gc.fillOval(0, 0, height, height);
- gc.setAlpha(255);
- gc.setBackground(m_background);
- gc.fillOval(borderWith, borderWith, height - 2 * borderWith, height - 2
- * borderWith);
- }
-
- protected String shortenText(GC gc, String t, int labelWidth) {
- if (t == null) {
- return null;
- }
- String text = t;
- String rangeWord = "";
- int textWidth = gc.textExtent(ELLIPSIS).x;
- int rangeWidth = gc.textExtent(rangeWord).x;
- // initial number of characters
- int s = text.length();
- // shorten string
- while (s >= 0) {
- String s1 = t.substring(0, s);
- int l1 = gc.textExtent(s1).x;
- if (l1 + textWidth + rangeWidth < labelWidth) {
- t = s1 + ELLIPSIS + rangeWord;
- break;
- }
- s--;
- }
- return t;
- }
-
- private Point m_cachedSize = new Point(0, 0);
-
- @Override
- public Point computeSize(int wHint, int hHint, boolean changed) {
- if (true) {
- Point size = new Point(height, height);
- GC gc = null;
- try {
- gc = new GC(this);
- gc.setFont(getTextFont());
- Point stringSize = gc.stringExtent(getText());
- size.x = Math.max(wHint, stringSize.x + height + 10);
- }
- catch (Exception e) {
- if (gc != null && !gc.isDisposed() && gc.getDevice() != null) {
- gc.dispose();
- }
- }
- m_cachedSize = size;
- }
- return m_cachedSize;
- }
-
- public void setText(String text) {
- m_text = text;
- redraw();
- }
-
- public String getText() {
- return m_text;
- }
-
- public int getStep() {
- return m_step;
- }
-
- public void setStep(int step) {
- m_step = step;
- redraw();
- }
-
- public Font getTextFont() {
- return m_textFont;
- }
-
- public void setTextFont(Font textFont) {
- m_textFont = textFont;
- redraw();
- }
-
- public Font getStepFont() {
- return m_stepFont;
- }
-
- public void setStepFont(Font stepFont) {
- m_stepFont = stepFont;
- redraw();
- }
-
- public void setSelected(boolean selected) {
- m_selected = selected;
- redraw();
- }
-
- public boolean isSelected() {
- return m_selected;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.ext;
+
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Composite;
+
+public class WizardStatusButton extends Canvas {
+ private static final long serialVersionUID = 1L;
+
+ private static final String ELLIPSIS = "...";
+ private Font m_textFont;
+ private Font m_stepFont;
+ private String m_text;
+ private int m_step;
+ private boolean m_selected;
+ private Color m_selectedBorderColor;
+ private Color m_selectedBackground;
+ private Color m_selectedBackgroundGradient;
+ private Color m_selectedForeground;
+ private Color m_background;
+ private Color m_backgroundGradient;
+ private Color m_foreground;
+
+ public WizardStatusButton(Composite parent, int style) {
+ super(parent, style);
+ initResources();
+ addDisposeListener(new DisposeListener() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void widgetDisposed(DisposeEvent e) {
+ freeResources();
+ }
+ });
+ addPaintListener(new PaintListener() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void paintControl(PaintEvent e) {
+ paint(e.gc);
+ }
+ });
+ }
+
+ protected void initResources() {
+ m_selectedBorderColor = new Color(this.getDisplay(), 213, 216, 243);
+ m_selectedBackground = new Color(this.getDisplay(), 94, 122, 194);
+ m_selectedBackgroundGradient = new Color(this.getDisplay(), 213, 216,
+ 243);
+ m_selectedForeground = new Color(this.getDisplay(), 255, 255, 255);
+ m_background = new Color(this.getDisplay(), 219, 226, 245);
+ m_backgroundGradient = new Color(this.getDisplay(), 219, 226, 245);
+ m_foreground = new Color(this.getDisplay(), 0, 0, 0);
+ }
+
+ protected void freeResources() {
+ if (m_selectedBorderColor != null && !m_selectedBorderColor.isDisposed() && m_selectedBorderColor.getDevice() != null) {
+ m_selectedBorderColor.dispose();
+ m_selectedBorderColor = null;
+ }
+ if (m_selectedBackground != null && !m_selectedBackground.isDisposed() && m_selectedBackground.getDevice() != null) {
+ m_selectedBackground.dispose();
+ m_selectedBackground = null;
+ }
+ if (m_selectedBackgroundGradient != null && !m_selectedBackgroundGradient.isDisposed() && m_selectedBackgroundGradient.getDevice() != null) {
+ m_selectedBackgroundGradient.dispose();
+ m_selectedBackgroundGradient = null;
+ }
+ if (m_selectedForeground != null && !m_selectedForeground.isDisposed() && m_selectedForeground.getDevice() != null) {
+ m_selectedForeground.dispose();
+ m_selectedForeground = null;
+ }
+ if (m_background != null && !m_background.isDisposed() && m_background.getDevice() != null) {
+ m_background.dispose();
+ m_background = null;
+ }
+ if (m_backgroundGradient != null && !m_backgroundGradient.isDisposed() && m_backgroundGradient.getDevice() != null) {
+ m_backgroundGradient.dispose();
+ m_backgroundGradient = null;
+ }
+ if (m_foreground != null && !m_foreground.isDisposed() && m_foreground.getDevice() != null) {
+ m_foreground.dispose();
+ m_foreground = null;
+ }
+ }
+
+ protected void paint(GC gc) {
+ // gc.setAdvanced(true);
+ // gc.setFillRule(SWT.FILL_WINDING);
+ // gc.setInterpolation(SWT.HIGH);
+
+ if (m_selected) {
+ paintSelectedBackground(gc);
+ gc.setForeground(m_selectedForeground);
+ }
+ else {
+ paintBackground(gc);
+ gc.setForeground(m_foreground);
+ }
+
+ Rectangle bounds = getBounds();
+ Point imageSize = computeSize(-1, -1, false);
+ gc.setFont(m_stepFont);
+ Point stepSize = gc.textExtent("" + m_step);
+ gc.drawText(m_step + "", (imageSize.y - stepSize.x) / 2,
+ (imageSize.y - stepSize.y) / 2, true);
+ gc.setFont(m_textFont);
+ String text = m_text;
+ if (text == null) {
+ text = "";
+ }
+ Point textBounds = gc.textExtent(text);
+ int availableSpace = bounds.width - height - 6;
+ if (availableSpace < textBounds.x) {
+ setToolTipText(text);
+ text = shortenText(gc, text, availableSpace);
+ textBounds = gc.textExtent(text);
+ }
+ else {
+ setToolTipText(null);
+ }
+ gc.drawText(text, height + 3, (height - textBounds.y) / 2, true);
+ }
+
+ int height = 26;
+ int borderWith = 2;
+
+ protected void paintSelectedBackground(GC gc) {
+
+ Rectangle bounds = getBounds();
+ // circle right
+
+ gc.setBackground(m_selectedBorderColor);
+ gc.fillOval(bounds.width - height, 0, height, height);
+ gc.setBackground(m_selectedBackgroundGradient);
+ gc.fillOval(bounds.width - height + borderWith, borderWith, height - 2
+ * borderWith, height - 2 * borderWith);
+
+ // border rectangle center
+ gc.setBackground(m_selectedBorderColor);
+ gc.fillRectangle(height / 2, 0, bounds.width - height, height);
+ gc.setBackground(m_selectedBackgroundGradient);
+ gc.setForeground(m_selectedBackground);
+ gc.fillGradientRectangle(height / 2 + borderWith, borderWith,
+ bounds.width - height - 2 * borderWith,
+ height - 2 * borderWith, false);
+
+ // border circle left
+ gc.setAlpha(150);
+ gc.setBackground(m_selectedBorderColor);
+ gc.fillOval(0, 0, height, height);
+ gc.setAlpha(255);
+ gc.setBackground(m_selectedBackground);
+ gc.fillOval(borderWith, borderWith, height - 2 * borderWith, height - 2
+ * borderWith);
+ }
+
+ protected void paintBackground(GC gc) {
+
+ Rectangle bounds = getBounds();
+ // circle right
+
+ gc.setBackground(m_backgroundGradient);
+ gc.fillOval(bounds.width - height, 0, height, height);
+ gc.setBackground(m_backgroundGradient);
+ gc.fillOval(bounds.width - height + borderWith, borderWith, height - 2
+ * borderWith, height - 2 * borderWith);
+
+ // border rectangle center
+ gc.setBackground(m_backgroundGradient);
+ gc.fillRectangle(height / 2, 0, bounds.width - height, height);
+ gc.setBackground(m_backgroundGradient);
+ gc.setForeground(m_background);
+ gc.fillGradientRectangle(height / 2 + borderWith, borderWith,
+ bounds.width - height - 2 * borderWith,
+ height - 2 * borderWith, false);
+
+ // border circle left
+ gc.setAlpha(150);
+ gc.setBackground(m_backgroundGradient);
+ gc.fillOval(0, 0, height, height);
+ gc.setAlpha(255);
+ gc.setBackground(m_background);
+ gc.fillOval(borderWith, borderWith, height - 2 * borderWith, height - 2
+ * borderWith);
+ }
+
+ protected String shortenText(GC gc, String t, int labelWidth) {
+ if (t == null) {
+ return null;
+ }
+ String text = t;
+ String rangeWord = "";
+ int textWidth = gc.textExtent(ELLIPSIS).x;
+ int rangeWidth = gc.textExtent(rangeWord).x;
+ // initial number of characters
+ int s = text.length();
+ // shorten string
+ while (s >= 0) {
+ String s1 = t.substring(0, s);
+ int l1 = gc.textExtent(s1).x;
+ if (l1 + textWidth + rangeWidth < labelWidth) {
+ t = s1 + ELLIPSIS + rangeWord;
+ break;
+ }
+ s--;
+ }
+ return t;
+ }
+
+ private Point m_cachedSize = new Point(0, 0);
+
+ @Override
+ public Point computeSize(int wHint, int hHint, boolean changed) {
+ if (true) {
+ Point size = new Point(height, height);
+ GC gc = null;
+ try {
+ gc = new GC(this);
+ gc.setFont(getTextFont());
+ Point stringSize = gc.stringExtent(getText());
+ size.x = Math.max(wHint, stringSize.x + height + 10);
+ }
+ catch (Exception e) {
+ if (gc != null && !gc.isDisposed() && gc.getDevice() != null) {
+ gc.dispose();
+ }
+ }
+ m_cachedSize = size;
+ }
+ return m_cachedSize;
+ }
+
+ public void setText(String text) {
+ m_text = text;
+ redraw();
+ }
+
+ public String getText() {
+ return m_text;
+ }
+
+ public int getStep() {
+ return m_step;
+ }
+
+ public void setStep(int step) {
+ m_step = step;
+ redraw();
+ }
+
+ public Font getTextFont() {
+ return m_textFont;
+ }
+
+ public void setTextFont(Font textFont) {
+ m_textFont = textFont;
+ redraw();
+ }
+
+ public Font getStepFont() {
+ return m_stepFont;
+ }
+
+ public void setStepFont(Font stepFont) {
+ m_stepFont = stepFont;
+ redraw();
+ }
+
+ public void setSelected(boolean selected) {
+ m_selected = selected;
+ redraw();
+ }
+
+ public boolean isSelected() {
+ return m_selected;
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/browser/BrowserExtension.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/browser/BrowserExtension.java
index 5661808fcd..031a05861b 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/browser/BrowserExtension.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/browser/BrowserExtension.java
@@ -1,254 +1,254 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.ext.browser;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.reflect.Constructor;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.UUID;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import javax.servlet.ServletException;
-
-import org.eclipse.rwt.RWT;
-import org.eclipse.rwt.lifecycle.UICallBack;
-import org.eclipse.rwt.resources.IResourceManager;
-import org.eclipse.rwt.resources.IResourceManager.RegisterOptions;
-import org.eclipse.rwt.service.IServiceHandler;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.swt.browser.Browser;
-import org.eclipse.swt.browser.LocationEvent;
-
-/**
- * <h3>BrowserSupport</h3> adding hyperlink callback support as in normal swt to the rwt browser
- * <p>
- * Adding support for registering/unregistering (publishing) local resources.
- *
- * @author imo
- * @since 3.8.0
- */
-public class BrowserExtension {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(BrowserExtension.class);
- private static final Pattern LOCAL_URL_PATTERN = Pattern.compile("(['\"])(http://local[?/][^'\"]*)(['\"])", Pattern.CASE_INSENSITIVE | Pattern.DOTALL);
-
- private final Browser m_browser;
- private final HashMap<String, String> m_hyperlinkMap;
- private final String m_serviceHandlerId;
- private IServiceHandler m_serviceHandler;
- //
- private HashSet<String> m_tempFileNames = new HashSet<String>();
-
- public BrowserExtension(Browser b) {
- m_browser = b;
- m_hyperlinkMap = new HashMap<String, String>();
- m_serviceHandlerId = UUID.randomUUID().toString();
- }
-
- /**
- * @return the unique {@link UUID} serviceHandlerId
- */
- public String getServiceHandlerId() {
- return m_serviceHandlerId;
- }
-
- private String getUiCallbackId() {
- return getClass().getName() + "" + hashCode();
- }
-
- public void attach() {
- if (m_serviceHandler == null) {
- UICallBack.activate(getUiCallbackId());
- m_serviceHandler = new IServiceHandler() {
- @Override
- public void service() throws IOException, ServletException {
- String localUrl = m_hyperlinkMap.get(RWT.getRequest().getParameter("p"));
- if (localUrl == null) {
- return;
- }
- fireLocationChangedEvent(localUrl);
- }
- };
- RWT.getServiceManager().registerServiceHandler(m_serviceHandlerId, m_serviceHandler);
- }
- }
-
- public void detach() {
- UICallBack.deactivate(getUiCallbackId());
- clearLocalHyperlinkCache();
- clearResourceCache();
- if (m_serviceHandler != null) {
- m_serviceHandler = null;
- RWT.getServiceManager().unregisterServiceHandler(m_serviceHandlerId);
- }
- }
-
- /**
- * @return the web url of the resource valid for calls from outside
- */
- public String addResource(String name, InputStream content) {
- return addResource(name, content, null, null);
- }
-
- /**
- * Adds a text resource that is encoded with the given <code>charset</code>.
- * <p>
- * By specifying an <code>option</code> other than <code>NONE</code> the resource will be versioned and/or compressed.
- * As compressing is only intended for resources that contain JavaScript, versioning might be useful for other
- * resources as well. When versioning is enabled a version number is appended to the resources' name which is derived
- * from its content.
- * </p>
- * <p>
- *
- * @param content
- * the content of the resource to add.
- * @param charset
- * the name of the charset which was used when the resource
- * was stored. If set to <code>null</code> neither charset nor options will be set.
- * @param options
- * an enumeration which specifies whether the resource will
- * be versioned and/or compressed. If set to <code>null</code> neither charset nor options will be set.
- * @return the web url of the resource valid for calls from outside
- */
- public String addResource(String name, InputStream content, String charset, RegisterOptions options) {
- name = name.replaceAll("\\\\", "/");
- if (name == null || name.length() == 0) {
- return null;
- }
- if (!name.startsWith("/")) {
- name = "/" + name;
- }
- String uniqueName = m_serviceHandlerId + name;
- m_tempFileNames.add(uniqueName);
- IResourceManager resourceManager = RWT.getResourceManager();
- if (charset != null && options != null) {
- resourceManager.register(uniqueName, content, charset, options);
- }
- else {
- resourceManager.register(uniqueName, content);
- }
- return resourceManager.getLocation(uniqueName);
- }
-
- public void clearResourceCache() {
- IResourceManager resourceManager = RWT.getResourceManager();
- try {
- for (String name : m_tempFileNames) {
- resourceManager.unregister(name);
- }
- }
- finally {
- m_tempFileNames.clear();
- }
- }
-
- /**
- * @param html
- * replaces all http://local/... urls by a ajax callback with a {@link LocationEvent} in html text
- * @param childDepth
- * when the document is inside a iframe or thelike, then childDepth is 1, if it is in addition inside an
- * embed tag (such as svg), then childDepth is 2.
- */
- public String adaptLocalHyperlinks(String html, int childDepth) {
- String p;
- if (childDepth <= 0) {
- p = "this";
- }
- else {
- p = "parent";
- for (int i = 1; i < childDepth; i++) {
- p = "parent." + p;
- }
- }
- return rewriteLocalHyperlinks(html, p, m_serviceHandlerId, m_hyperlinkMap);
- }
-
- public void clearLocalHyperlinkCache() {
- m_hyperlinkMap.clear();
- }
-
- private void fireLocationChangedEvent(final String location) {
- m_browser.getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- try {
- Constructor<?> c = LocationEvent.class.getDeclaredConstructor(Object.class, int.class, String.class);
- c.setAccessible(true);
- //send changing
- LocationEvent event = (LocationEvent) c.newInstance(m_browser, LocationEvent.CHANGING, location);
- event.top = true;
- event.processEvent();
- //send changed
- event = (LocationEvent) c.newInstance(m_browser, LocationEvent.CHANGED, location);
- event.top = true;
- event.processEvent();
- }
- catch (Throwable t) {
- //nop
- }
- }
- });
- }
-
- /**
- * Replace all href="http://local/... references in the html file and replace by an ajax call.
- *
- * @param html
- * @param rwtServiceHandler
- * is called with the parameter "p" containing the local url key to the generatedMapping
- * @param generatedMappings
- * is being filled up with the generated mappings
- * @return the rewritten html
- */
- private static String rewriteLocalHyperlinks(String html, String ajaxParentContext, String rwtServiceHandler, Map<String /*externalKey*/, String /*url*/> generatedMappings) {
- if (html == null) {
- return html;
- }
- StringBuilder buf = new StringBuilder();
- Matcher m = LOCAL_URL_PATTERN.matcher(html);
- int nextFind = 0;
- while (m.find(nextFind)) {
- String localUrl = m.group(2);
- String externalKey = "" + generatedMappings.size();
- StringBuilder urlBuf = new StringBuilder();
- urlBuf.append("?");
- urlBuf.append(IServiceHandler.REQUEST_PARAM);
- urlBuf.append("=");
- urlBuf.append(rwtServiceHandler);
- urlBuf.append("&amp;");
- urlBuf.append("p");
- urlBuf.append("=");
- urlBuf.append(externalKey);
- String encodedURL = RWT.getResponse().encodeURL(urlBuf.toString());
- String callableURL = "javascript:a=" + ajaxParentContext + ".qx.net.HttpRequest.create();a.open('GET','" + encodedURL + "',true);a.send(null);";
- buf.append(html.substring(nextFind, m.start()));
- buf.append(m.group(1));
- buf.append(callableURL);
- buf.append(m.group(3));
- //register
- generatedMappings.put(externalKey, localUrl);
- //next
- nextFind = m.end();
- }
- if (nextFind == 0) {
- return html;
- }
- if (nextFind < html.length()) {
- buf.append(html.substring(nextFind));
- }
- return buf.toString();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.ext.browser;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Constructor;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.UUID;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.servlet.ServletException;
+
+import org.eclipse.rwt.RWT;
+import org.eclipse.rwt.lifecycle.UICallBack;
+import org.eclipse.rwt.resources.IResourceManager;
+import org.eclipse.rwt.resources.IResourceManager.RegisterOptions;
+import org.eclipse.rwt.service.IServiceHandler;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.swt.browser.Browser;
+import org.eclipse.swt.browser.LocationEvent;
+
+/**
+ * <h3>BrowserSupport</h3> adding hyperlink callback support as in normal swt to the rwt browser
+ * <p>
+ * Adding support for registering/unregistering (publishing) local resources.
+ *
+ * @author imo
+ * @since 3.8.0
+ */
+public class BrowserExtension {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(BrowserExtension.class);
+ private static final Pattern LOCAL_URL_PATTERN = Pattern.compile("(['\"])(http://local[?/][^'\"]*)(['\"])", Pattern.CASE_INSENSITIVE | Pattern.DOTALL);
+
+ private final Browser m_browser;
+ private final HashMap<String, String> m_hyperlinkMap;
+ private final String m_serviceHandlerId;
+ private IServiceHandler m_serviceHandler;
+ //
+ private HashSet<String> m_tempFileNames = new HashSet<String>();
+
+ public BrowserExtension(Browser b) {
+ m_browser = b;
+ m_hyperlinkMap = new HashMap<String, String>();
+ m_serviceHandlerId = UUID.randomUUID().toString();
+ }
+
+ /**
+ * @return the unique {@link UUID} serviceHandlerId
+ */
+ public String getServiceHandlerId() {
+ return m_serviceHandlerId;
+ }
+
+ private String getUiCallbackId() {
+ return getClass().getName() + "" + hashCode();
+ }
+
+ public void attach() {
+ if (m_serviceHandler == null) {
+ UICallBack.activate(getUiCallbackId());
+ m_serviceHandler = new IServiceHandler() {
+ @Override
+ public void service() throws IOException, ServletException {
+ String localUrl = m_hyperlinkMap.get(RWT.getRequest().getParameter("p"));
+ if (localUrl == null) {
+ return;
+ }
+ fireLocationChangedEvent(localUrl);
+ }
+ };
+ RWT.getServiceManager().registerServiceHandler(m_serviceHandlerId, m_serviceHandler);
+ }
+ }
+
+ public void detach() {
+ UICallBack.deactivate(getUiCallbackId());
+ clearLocalHyperlinkCache();
+ clearResourceCache();
+ if (m_serviceHandler != null) {
+ m_serviceHandler = null;
+ RWT.getServiceManager().unregisterServiceHandler(m_serviceHandlerId);
+ }
+ }
+
+ /**
+ * @return the web url of the resource valid for calls from outside
+ */
+ public String addResource(String name, InputStream content) {
+ return addResource(name, content, null, null);
+ }
+
+ /**
+ * Adds a text resource that is encoded with the given <code>charset</code>.
+ * <p>
+ * By specifying an <code>option</code> other than <code>NONE</code> the resource will be versioned and/or compressed.
+ * As compressing is only intended for resources that contain JavaScript, versioning might be useful for other
+ * resources as well. When versioning is enabled a version number is appended to the resources' name which is derived
+ * from its content.
+ * </p>
+ * <p>
+ *
+ * @param content
+ * the content of the resource to add.
+ * @param charset
+ * the name of the charset which was used when the resource
+ * was stored. If set to <code>null</code> neither charset nor options will be set.
+ * @param options
+ * an enumeration which specifies whether the resource will
+ * be versioned and/or compressed. If set to <code>null</code> neither charset nor options will be set.
+ * @return the web url of the resource valid for calls from outside
+ */
+ public String addResource(String name, InputStream content, String charset, RegisterOptions options) {
+ name = name.replaceAll("\\\\", "/");
+ if (name == null || name.length() == 0) {
+ return null;
+ }
+ if (!name.startsWith("/")) {
+ name = "/" + name;
+ }
+ String uniqueName = m_serviceHandlerId + name;
+ m_tempFileNames.add(uniqueName);
+ IResourceManager resourceManager = RWT.getResourceManager();
+ if (charset != null && options != null) {
+ resourceManager.register(uniqueName, content, charset, options);
+ }
+ else {
+ resourceManager.register(uniqueName, content);
+ }
+ return resourceManager.getLocation(uniqueName);
+ }
+
+ public void clearResourceCache() {
+ IResourceManager resourceManager = RWT.getResourceManager();
+ try {
+ for (String name : m_tempFileNames) {
+ resourceManager.unregister(name);
+ }
+ }
+ finally {
+ m_tempFileNames.clear();
+ }
+ }
+
+ /**
+ * @param html
+ * replaces all http://local/... urls by a ajax callback with a {@link LocationEvent} in html text
+ * @param childDepth
+ * when the document is inside a iframe or thelike, then childDepth is 1, if it is in addition inside an
+ * embed tag (such as svg), then childDepth is 2.
+ */
+ public String adaptLocalHyperlinks(String html, int childDepth) {
+ String p;
+ if (childDepth <= 0) {
+ p = "this";
+ }
+ else {
+ p = "parent";
+ for (int i = 1; i < childDepth; i++) {
+ p = "parent." + p;
+ }
+ }
+ return rewriteLocalHyperlinks(html, p, m_serviceHandlerId, m_hyperlinkMap);
+ }
+
+ public void clearLocalHyperlinkCache() {
+ m_hyperlinkMap.clear();
+ }
+
+ private void fireLocationChangedEvent(final String location) {
+ m_browser.getDisplay().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ Constructor<?> c = LocationEvent.class.getDeclaredConstructor(Object.class, int.class, String.class);
+ c.setAccessible(true);
+ //send changing
+ LocationEvent event = (LocationEvent) c.newInstance(m_browser, LocationEvent.CHANGING, location);
+ event.top = true;
+ event.processEvent();
+ //send changed
+ event = (LocationEvent) c.newInstance(m_browser, LocationEvent.CHANGED, location);
+ event.top = true;
+ event.processEvent();
+ }
+ catch (Throwable t) {
+ //nop
+ }
+ }
+ });
+ }
+
+ /**
+ * Replace all href="http://local/... references in the html file and replace by an ajax call.
+ *
+ * @param html
+ * @param rwtServiceHandler
+ * is called with the parameter "p" containing the local url key to the generatedMapping
+ * @param generatedMappings
+ * is being filled up with the generated mappings
+ * @return the rewritten html
+ */
+ private static String rewriteLocalHyperlinks(String html, String ajaxParentContext, String rwtServiceHandler, Map<String /*externalKey*/, String /*url*/> generatedMappings) {
+ if (html == null) {
+ return html;
+ }
+ StringBuilder buf = new StringBuilder();
+ Matcher m = LOCAL_URL_PATTERN.matcher(html);
+ int nextFind = 0;
+ while (m.find(nextFind)) {
+ String localUrl = m.group(2);
+ String externalKey = "" + generatedMappings.size();
+ StringBuilder urlBuf = new StringBuilder();
+ urlBuf.append("?");
+ urlBuf.append(IServiceHandler.REQUEST_PARAM);
+ urlBuf.append("=");
+ urlBuf.append(rwtServiceHandler);
+ urlBuf.append("&amp;");
+ urlBuf.append("p");
+ urlBuf.append("=");
+ urlBuf.append(externalKey);
+ String encodedURL = RWT.getResponse().encodeURL(urlBuf.toString());
+ String callableURL = "javascript:a=" + ajaxParentContext + ".qx.net.HttpRequest.create();a.open('GET','" + encodedURL + "',true);a.send(null);";
+ buf.append(html.substring(nextFind, m.start()));
+ buf.append(m.group(1));
+ buf.append(callableURL);
+ buf.append(m.group(3));
+ //register
+ generatedMappings.put(externalKey, localUrl);
+ //next
+ nextFind = m.end();
+ }
+ if (nextFind == 0) {
+ return html;
+ }
+ if (nextFind < html.length()) {
+ buf.append(html.substring(nextFind));
+ }
+ return buf.toString();
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/custom/StyledText.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/custom/StyledText.java
index 1d4bad1f62..5c949a9d80 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/custom/StyledText.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/custom/StyledText.java
@@ -1,28 +1,28 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.ext.custom;
-
-import org.eclipse.scout.rt.ui.rap.ext.TextEx;
-import org.eclipse.swt.widgets.Composite;
-
-//XXX [rap]
-public class StyledText extends TextEx {
- private static final long serialVersionUID = 1L;
-
- public StyledText(Composite parent, int style) {
- super(parent, style);
- }
-
- public void setCaretOffset(int i) {
- super.setSelection(0, 0);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.ext.custom;
+
+import org.eclipse.scout.rt.ui.rap.ext.TextEx;
+import org.eclipse.swt.widgets.Composite;
+
+//XXX [rap]
+public class StyledText extends TextEx {
+ private static final long serialVersionUID = 1L;
+
+ public StyledText(Composite parent, int style) {
+ super(parent, style);
+ }
+
+ public void setCaretOffset(int i) {
+ super.setSelection(0, 0);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/gc/AdvancedGC.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/gc/AdvancedGC.java
index 877b144cca..f511d074ad 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/gc/AdvancedGC.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/gc/AdvancedGC.java
@@ -1,137 +1,137 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.ext.gc;
-
-import java.util.Arrays;
-
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * <h3>AdvancedGC</h3> rwt does not yet support Tranform and advanced gc.
- * This helper supports for a limited set of transform functionality (no shearing).
- *
- * @author imo
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.ext.gc;
+
+import java.util.Arrays;
+
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * <h3>AdvancedGC</h3> rwt does not yet support Tranform and advanced gc.
+ * This helper supports for a limited set of transform functionality (no shearing).
+ *
+ * @author imo
* @since 3.7.0 June 2011
- */
-public class AdvancedGC {
- private GC m_gc;
- private Transform m_txRef;
- /**
- * u11, u12, u21, u22, dx, dy
- */
- private final float[] m_matrix = new float[]{1, 0, 0, 1, 0, 0};
-
- public AdvancedGC(GC gc) {
- m_gc = gc;
- }
-
- public void setTransform(Transform t) {
- m_txRef = t;
- if (m_txRef != null) {
- m_txRef.getElements(m_matrix);
- }
- else {
- Arrays.fill(m_matrix, 0f);
- m_matrix[0] = 1;
- m_matrix[3] = 1;
- }
- }
-
- public Transform getTransform() {
- return m_txRef;
- }
-
- public boolean isDisposed() {
- return m_gc.isDisposed();
- }
-
- public void dispose() {
- m_gc.dispose();
- }
-
- public void setBackground(Color c) {
- m_gc.setBackground(c);
- }
-
- public void setForeground(Color c) {
- m_gc.setForeground(c);
- }
-
- public void setFont(Font f) {
- m_gc.setFont(f);
- }
-
- public void setAlpha(int alpha) {
- m_gc.setAlpha(alpha);
- }
-
- public void drawOval(int x, int y, int w, int h) {
- m_gc.drawOval(tx(x), ty(y), tw(w), th(h));
- }
-
- public void drawRectangle(int x, int y, int w, int h) {
- m_gc.drawRectangle(tx(x), ty(y), tw(w), th(h));
- }
-
- public void drawPolygon(int[] pointArray) {
- int[] p = new int[pointArray.length];
- for (int i = 0; i < p.length; i = i + 2) {
- p[i] = tx(pointArray[i]);
- p[i + 1] = ty(pointArray[i + 1]);
- }
- m_gc.drawPolygon(p);
- }
-
- public void drawImage(Image image, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight) {
- m_gc.drawImage(image, srcX, srcY, srcWidth, srcHeight, tx(destX), ty(destY), tw(destWidth), th(destHeight));
- }
-
- public void drawString(String s, int x, int y, boolean transparent) {
- m_gc.drawString(s, tx(x), ty(y), transparent);
- }
-
- public void fillOval(int x, int y, int w, int h) {
- m_gc.fillOval(tx(x), ty(y), tw(w), th(h));
- }
-
- public void fillRectangle(int x, int y, int w, int h) {
- m_gc.fillRectangle(tx(x), ty(y), tw(w), th(h));
- }
-
- public void fillPolygon(int[] pointArray) {
- int[] p = new int[pointArray.length];
- for (int i = 0; i < p.length; i = i + 2) {
- p[i] = tx(pointArray[i]);
- p[i + 1] = ty(pointArray[i + 1]);
- }
- m_gc.fillPolygon(p);
- }
-
- private int tx(int x) {
- return (int) (m_matrix[0] * x + m_matrix[4]);
- }
-
- private int ty(int y) {
- return (int) (m_matrix[3] * y + m_matrix[5]);
- }
-
- private int tw(int w) {
- return (int) (m_matrix[0] * w);
- }
-
- private int th(int h) {
- return (int) (m_matrix[3] * h);
- }
-
-}
+ */
+public class AdvancedGC {
+ private GC m_gc;
+ private Transform m_txRef;
+ /**
+ * u11, u12, u21, u22, dx, dy
+ */
+ private final float[] m_matrix = new float[]{1, 0, 0, 1, 0, 0};
+
+ public AdvancedGC(GC gc) {
+ m_gc = gc;
+ }
+
+ public void setTransform(Transform t) {
+ m_txRef = t;
+ if (m_txRef != null) {
+ m_txRef.getElements(m_matrix);
+ }
+ else {
+ Arrays.fill(m_matrix, 0f);
+ m_matrix[0] = 1;
+ m_matrix[3] = 1;
+ }
+ }
+
+ public Transform getTransform() {
+ return m_txRef;
+ }
+
+ public boolean isDisposed() {
+ return m_gc.isDisposed();
+ }
+
+ public void dispose() {
+ m_gc.dispose();
+ }
+
+ public void setBackground(Color c) {
+ m_gc.setBackground(c);
+ }
+
+ public void setForeground(Color c) {
+ m_gc.setForeground(c);
+ }
+
+ public void setFont(Font f) {
+ m_gc.setFont(f);
+ }
+
+ public void setAlpha(int alpha) {
+ m_gc.setAlpha(alpha);
+ }
+
+ public void drawOval(int x, int y, int w, int h) {
+ m_gc.drawOval(tx(x), ty(y), tw(w), th(h));
+ }
+
+ public void drawRectangle(int x, int y, int w, int h) {
+ m_gc.drawRectangle(tx(x), ty(y), tw(w), th(h));
+ }
+
+ public void drawPolygon(int[] pointArray) {
+ int[] p = new int[pointArray.length];
+ for (int i = 0; i < p.length; i = i + 2) {
+ p[i] = tx(pointArray[i]);
+ p[i + 1] = ty(pointArray[i + 1]);
+ }
+ m_gc.drawPolygon(p);
+ }
+
+ public void drawImage(Image image, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight) {
+ m_gc.drawImage(image, srcX, srcY, srcWidth, srcHeight, tx(destX), ty(destY), tw(destWidth), th(destHeight));
+ }
+
+ public void drawString(String s, int x, int y, boolean transparent) {
+ m_gc.drawString(s, tx(x), ty(y), transparent);
+ }
+
+ public void fillOval(int x, int y, int w, int h) {
+ m_gc.fillOval(tx(x), ty(y), tw(w), th(h));
+ }
+
+ public void fillRectangle(int x, int y, int w, int h) {
+ m_gc.fillRectangle(tx(x), ty(y), tw(w), th(h));
+ }
+
+ public void fillPolygon(int[] pointArray) {
+ int[] p = new int[pointArray.length];
+ for (int i = 0; i < p.length; i = i + 2) {
+ p[i] = tx(pointArray[i]);
+ p[i + 1] = ty(pointArray[i + 1]);
+ }
+ m_gc.fillPolygon(p);
+ }
+
+ private int tx(int x) {
+ return (int) (m_matrix[0] * x + m_matrix[4]);
+ }
+
+ private int ty(int y) {
+ return (int) (m_matrix[3] * y + m_matrix[5]);
+ }
+
+ private int tw(int w) {
+ return (int) (m_matrix[0] * w);
+ }
+
+ private int th(int h) {
+ return (int) (m_matrix[3] * h);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/gc/Transform.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/gc/Transform.java
index 6b936a0f66..21409824f0 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/gc/Transform.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/gc/Transform.java
@@ -1,81 +1,81 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.ext.gc;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Device;
-
-/**
- * <h3>Transform</h3> rwt does not yet support Tranform and advanced gc.
- * This helper supports for a limited set of transform functionality (no shearing).
- * <p>
- *
- * <pre>
- * [x'] [u11 u12 | tx] [x]
- * [y'] = [u21 u22 | ty] * [y]
- * [1]
- * </pre>
- *
- * @author imo
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.ext.gc;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Device;
+
+/**
+ * <h3>Transform</h3> rwt does not yet support Tranform and advanced gc.
+ * This helper supports for a limited set of transform functionality (no shearing).
+ * <p>
+ *
+ * <pre>
+ * [x'] [u11 u12 | tx] [x]
+ * [y'] = [u21 u22 | ty] * [y]
+ * [1]
+ * </pre>
+ *
+ * @author imo
* @since 3.7.0 June 2011
- */
-public class Transform {
- /**
- * u11, u12, u21, u22, dx, dy
- */
- private final float[] m_matrix;
-
- public Transform(Device dummy) {
- m_matrix = new float[]{0, 0, 0, 0, 0, 0};
- identity();
- }
-
- public boolean isDisposed() {
- return true;
- }
-
- public void dispose() {
- }
-
- public void identity() {
- m_matrix[0] = 1;
- m_matrix[1] = 0;
- m_matrix[2] = 0;
- m_matrix[3] = 1;
- m_matrix[4] = 0;
- m_matrix[5] = 0;
- }
-
- public void scale(float scaleX, float scaleY) {
- m_matrix[0] *= scaleX;
- m_matrix[3] *= scaleY;
- }
-
- public void translate(float offsetX, float offsetY) {
- m_matrix[4] += offsetX;
- m_matrix[5] += offsetY;
- }
-
- /**
- * return the 2x3 matix to the out array in the order u11, u12, u21, u22, dx, dy
- */
- public void getElements(float[] out) {
- if (out == null) {
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
- return;
- }
- if (out.length < 6) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- return;
- }
- System.arraycopy(m_matrix, 0, out, 0, 6);
- }
-}
+ */
+public class Transform {
+ /**
+ * u11, u12, u21, u22, dx, dy
+ */
+ private final float[] m_matrix;
+
+ public Transform(Device dummy) {
+ m_matrix = new float[]{0, 0, 0, 0, 0, 0};
+ identity();
+ }
+
+ public boolean isDisposed() {
+ return true;
+ }
+
+ public void dispose() {
+ }
+
+ public void identity() {
+ m_matrix[0] = 1;
+ m_matrix[1] = 0;
+ m_matrix[2] = 0;
+ m_matrix[3] = 1;
+ m_matrix[4] = 0;
+ m_matrix[5] = 0;
+ }
+
+ public void scale(float scaleX, float scaleY) {
+ m_matrix[0] *= scaleX;
+ m_matrix[3] *= scaleY;
+ }
+
+ public void translate(float offsetX, float offsetY) {
+ m_matrix[4] += offsetX;
+ m_matrix[5] += offsetY;
+ }
+
+ /**
+ * return the 2x3 matix to the out array in the order u11, u12, u21, u22, dx, dy
+ */
+ public void getElements(float[] out) {
+ if (out == null) {
+ SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ return;
+ }
+ if (out.length < 6) {
+ SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ return;
+ }
+ System.arraycopy(m_matrix, 0, out, 0, 6);
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/tabfolder/CTabItemEx.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/tabfolder/CTabItemEx.java
index 0588eb9326..c72f70fa99 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/tabfolder/CTabItemEx.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/tabfolder/CTabItemEx.java
@@ -1,57 +1,57 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.ext.tabfolder;
-
-import org.eclipse.swt.custom.CTabFolder;
-import org.eclipse.swt.custom.CTabItem;
-
-/**
- * <h3>CTabItemEx</h3> ...
- *
- * @author Andreas Hoegger
- * @since 3.7.0 June 2011
- * XXX remove when bug 342250 is fixed.
- */
-public class CTabItemEx extends CTabItem {
- private static final long serialVersionUID = 1L;
-
- private boolean m_tabItemVisible;
-
- public CTabItemEx(CTabFolder parent, int style) {
- super(parent, style);
- }
-
- @Override
- protected void checkSubclass() {
-
- }
-
- @Override
- public boolean isShowing() {
- return m_tabItemVisible && super.isShowing();
- }
-
- /**
- * @param tabItemVisible
- * the tabItemVisible to set
- */
- public void setTabItemVisible(boolean tabItemVisible) {
- m_tabItemVisible = tabItemVisible;
- }
-
- /**
- * @return the tabItemVisible
- */
- public boolean isTabItemVisible() {
- return m_tabItemVisible;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.ext.tabfolder;
+
+import org.eclipse.swt.custom.CTabFolder;
+import org.eclipse.swt.custom.CTabItem;
+
+/**
+ * <h3>CTabItemEx</h3> ...
+ *
+ * @author Andreas Hoegger
+ * @since 3.7.0 June 2011
+ * XXX remove when bug 342250 is fixed.
+ */
+public class CTabItemEx extends CTabItem {
+ private static final long serialVersionUID = 1L;
+
+ private boolean m_tabItemVisible;
+
+ public CTabItemEx(CTabFolder parent, int style) {
+ super(parent, style);
+ }
+
+ @Override
+ protected void checkSubclass() {
+
+ }
+
+ @Override
+ public boolean isShowing() {
+ return m_tabItemVisible && super.isShowing();
+ }
+
+ /**
+ * @param tabItemVisible
+ * the tabItemVisible to set
+ */
+ public void setTabItemVisible(boolean tabItemVisible) {
+ m_tabItemVisible = tabItemVisible;
+ }
+
+ /**
+ * @return the tabItemVisible
+ */
+ public boolean isTabItemVisible() {
+ return m_tabItemVisible;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/table/TableEx.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/table/TableEx.java
index c188afd036..02e7fe78b2 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/table/TableEx.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/table/TableEx.java
@@ -1,106 +1,106 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.ext.table;
-
-import org.eclipse.rwt.internal.textsize.TextSizeUtil;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.TableItem;
-
-@SuppressWarnings("restriction")
-public class TableEx extends Table {
- private static final long serialVersionUID = 1L;
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(TableEx.class);
-
- public TableEx(Composite parent, int style) {
- super(parent, style);
- }
-
- @Override
- protected void checkSubclass() {
- }
-
- @Override
- public Point computeSize(int hint, int hint2, boolean changed) {
- /*
- * workaround since compute size on the table returns the sum of all columns
- * plus 20px.
- */
- Point size = super.computeSize(hint, hint2, changed);
- TableColumn[] columns = getColumns();
- if (columns != null) {
- int x = 0;
- for (TableColumn col : columns) {
- x += col.getWidth();
- }
- x += columns.length * getGridLineWidth();
- size.x = x;
- }
- return size;
- }
-
- public Point getPreferredContentSize(int maxRowCount) {
- Point max = new Point(0, 0);
- for (int r = 0, nr = getItemCount(); r < nr && r < maxRowCount; r++) {
- int w = 0;
- int h = 0;
- TableItem item = getItem(r);
- for (int c = 0, nc = getColumnCount(); c < nc; c++) {
- Rectangle d = item.getBounds(c);
- String text = item.getText();
- if (!StringUtility.hasText(text)) {
- if (item.getData() instanceof ITableRow) {
- text = ((ITableRow) item.getData()).getCell(c).getText();
- }
- }
- if (StringUtility.hasText(text)) {
- int textWidth = TextSizeUtil.stringExtent(item.getFont(), text).x;
- d.width = textWidth;
- }
- w += d.width;
- h = Math.max(h, d.height);
- }
- h = Math.max(h, item.getBounds().height);
- //Add some points in heigt to ensure we do not have a scrollbar (depending to the count of items)
- if (nr > 3) {
- max.y += h + 1;
- }
- else if (nr > 1) {
- max.y += h + 2;
- }
- else {
- max.y += h + 4;
- }
- max.x = Math.max(max.x, w);
- }
- return max;
- }
-
- @Override
- public void setEnabled(boolean enabled) {
- //XXX set a style instead of a fg
- if (enabled) {
- setForeground(null);
- }
- else {
- setForeground(getDisplay().getSystemColor(SWT.COLOR_GRAY));
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.ext.table;
+
+import org.eclipse.rwt.internal.textsize.TextSizeUtil;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.basic.table.ITableRow;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+
+@SuppressWarnings("restriction")
+public class TableEx extends Table {
+ private static final long serialVersionUID = 1L;
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(TableEx.class);
+
+ public TableEx(Composite parent, int style) {
+ super(parent, style);
+ }
+
+ @Override
+ protected void checkSubclass() {
+ }
+
+ @Override
+ public Point computeSize(int hint, int hint2, boolean changed) {
+ /*
+ * workaround since compute size on the table returns the sum of all columns
+ * plus 20px.
+ */
+ Point size = super.computeSize(hint, hint2, changed);
+ TableColumn[] columns = getColumns();
+ if (columns != null) {
+ int x = 0;
+ for (TableColumn col : columns) {
+ x += col.getWidth();
+ }
+ x += columns.length * getGridLineWidth();
+ size.x = x;
+ }
+ return size;
+ }
+
+ public Point getPreferredContentSize(int maxRowCount) {
+ Point max = new Point(0, 0);
+ for (int r = 0, nr = getItemCount(); r < nr && r < maxRowCount; r++) {
+ int w = 0;
+ int h = 0;
+ TableItem item = getItem(r);
+ for (int c = 0, nc = getColumnCount(); c < nc; c++) {
+ Rectangle d = item.getBounds(c);
+ String text = item.getText();
+ if (!StringUtility.hasText(text)) {
+ if (item.getData() instanceof ITableRow) {
+ text = ((ITableRow) item.getData()).getCell(c).getText();
+ }
+ }
+ if (StringUtility.hasText(text)) {
+ int textWidth = TextSizeUtil.stringExtent(item.getFont(), text).x;
+ d.width = textWidth;
+ }
+ w += d.width;
+ h = Math.max(h, d.height);
+ }
+ h = Math.max(h, item.getBounds().height);
+ //Add some points in heigt to ensure we do not have a scrollbar (depending to the count of items)
+ if (nr > 3) {
+ max.y += h + 1;
+ }
+ else if (nr > 1) {
+ max.y += h + 2;
+ }
+ else {
+ max.y += h + 4;
+ }
+ max.x = Math.max(max.x, w);
+ }
+ return max;
+ }
+
+ @Override
+ public void setEnabled(boolean enabled) {
+ //XXX set a style instead of a fg
+ if (enabled) {
+ setForeground(null);
+ }
+ else {
+ setForeground(getDisplay().getSystemColor(SWT.COLOR_GRAY));
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/table/TableViewerEx.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/table/TableViewerEx.java
index 87a7d56e3d..11b2d6cf23 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/table/TableViewerEx.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/table/TableViewerEx.java
@@ -1,57 +1,57 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.ext.table;
-
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.ViewerRow;
-import org.eclipse.rwt.lifecycle.WidgetUtil;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Table;
-
-/**
- * <h3>TableViewerEx</h3> publish the applyEditorValue method
- * <p>
- * {@inheritDoc}
- */
-public class TableViewerEx extends TableViewer {
- private static final long serialVersionUID = 1L;
-
- /**
- * {@inheritDoc}
- */
- public TableViewerEx(Composite parent) {
- super(parent);
- }
-
- /**
- * {@inheritDoc}
- */
- public TableViewerEx(Composite parent, int style) {
- super(parent, style);
- }
-
- /**
- * {@inheritDoc}
- */
- public TableViewerEx(Table table) {
- super(table);
- }
-
- @Override
- protected ViewerRow internalCreateNewRowPart(int style, int rowIndex) {
- ViewerRow viewerRow = super.internalCreateNewRowPart(style, rowIndex);
- if (getTable().getData(WidgetUtil.CUSTOM_VARIANT) != null) {
- viewerRow.getItem().setData(WidgetUtil.CUSTOM_VARIANT, getTable().getData(WidgetUtil.CUSTOM_VARIANT));
- }
- return viewerRow;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.ext.table;
+
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.ViewerRow;
+import org.eclipse.rwt.lifecycle.WidgetUtil;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Table;
+
+/**
+ * <h3>TableViewerEx</h3> publish the applyEditorValue method
+ * <p>
+ * {@inheritDoc}
+ */
+public class TableViewerEx extends TableViewer {
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * {@inheritDoc}
+ */
+ public TableViewerEx(Composite parent) {
+ super(parent);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public TableViewerEx(Composite parent, int style) {
+ super(parent, style);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public TableViewerEx(Table table) {
+ super(table);
+ }
+
+ @Override
+ protected ViewerRow internalCreateNewRowPart(int style, int rowIndex) {
+ ViewerRow viewerRow = super.internalCreateNewRowPart(style, rowIndex);
+ if (getTable().getData(WidgetUtil.CUSTOM_VARIANT) != null) {
+ viewerRow.getItem().setData(WidgetUtil.CUSTOM_VARIANT, getTable().getData(WidgetUtil.CUSTOM_VARIANT));
+ }
+ return viewerRow;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/table/util/TableCellRolloverSupport.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/table/util/TableCellRolloverSupport.java
index cb119fcc3c..bad927736a 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/table/util/TableCellRolloverSupport.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/table/util/TableCellRolloverSupport.java
@@ -1,157 +1,157 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.ext.table.util;
-
-import org.eclipse.jface.viewers.ITableColorProvider;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.MouseMoveListener;
-import org.eclipse.swt.events.MouseTrackAdapter;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableItem;
-
-/**
- * <h3>TableCellRolloverSupport</h3> ...
- *
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.ext.table.util;
+
+import org.eclipse.jface.viewers.ITableColorProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.MouseMoveListener;
+import org.eclipse.swt.events.MouseTrackAdapter;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableItem;
+
+/**
+ * <h3>TableCellRolloverSupport</h3> ...
+ *
* @since 3.7.0 June 2011
- */
-public class TableCellRolloverSupport {
- private TableItem m_mouseHoverItem;
- private int m_cursorIndex = -1;
- private int[] m_colPositions;
- private Color m_mouseHoverBackground;
- private P_RowMouseTrackListener m_trackListener = new P_RowMouseTrackListener();
- private final Table m_table;
- private final TableViewer m_viewer;
-
- public TableCellRolloverSupport(TableViewer viewer) {
- m_viewer = viewer;
- m_table = m_viewer.getTable();
- m_mouseHoverBackground = new Color(m_table.getDisplay(), 179, 195, 255);
- attachListeners();
- }
-
- protected void attachListeners() {
- //XXX rap getTable().addMouseMoveListener(m_trackListener);
- //XXX rap getTable().addMouseTrackListener(m_trackListener);
- getTable().addDisposeListener(new DisposeListener() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void widgetDisposed(DisposeEvent e) {
- dettachListeners();
- if (m_mouseHoverBackground != null && !m_mouseHoverBackground.isDisposed() && m_mouseHoverBackground.getDevice() != null) {
- m_mouseHoverBackground.dispose();
- m_mouseHoverBackground = null;
- }
- }
- });
- }
-
- protected void dettachListeners() {
- //XXX rap getTable().removeMouseMoveListener(m_trackListener);
- //XXX rap getTable().removeMouseTrackListener(m_trackListener);
- }
-
- public Table getTable() {
- return m_table;
- }
-
- public TableViewer getViewer() {
- return m_viewer;
- }
-
- private void saveColumnPositions() {
- m_colPositions = new int[getTable().getColumnCount()];
- TableItem item = getTable().getItem(0);
- for (int i = 0; i < getTable().getColumnCount(); i++) {
- m_colPositions[i] = item.getBounds(i).x + item.getBounds(i).width;
- }
- }
-
- private int getColumnIndex(int x) {
- int i = 0;
- while (i < m_colPositions.length && x > m_colPositions[i]) {
- i++;
- }
- return i;
- }
-
- private void asyncRedraw(final int x, final int y, final int width, final int height) {
- getTable().getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (getTable() != null && !getTable().isDisposed()) {
- getTable().redraw(x, y, width, height, true);
- }
- }
- });
- }
-
- private class P_RowMouseTrackListener extends MouseTrackAdapter implements MouseMoveListener {//XXX RAP SLE: no listener for MouseTrackAdapter in RAP, has to be made different. JScript-Injectjion?
-
- private static final long serialVersionUID = 1L;
-
- @Override
- public void mouseMove(org.eclipse.swt.events.MouseEvent e) {
- Point p = new Point(e.x, e.y);
- int index = getColumnIndex(e.x);
- if (getTable().getItem(p) != m_mouseHoverItem || m_cursorIndex != index) {
- TableItem item = getTable().getItem(p);
- if (item != null) {
- if (m_mouseHoverItem != null && !m_mouseHoverItem.isDisposed() && m_cursorIndex > -1) {
- m_mouseHoverItem.setBackground(m_cursorIndex, ((ITableColorProvider) m_viewer.getLabelProvider()).getBackground(m_mouseHoverItem
- .getData(), m_cursorIndex));
- m_mouseHoverItem.setForeground(m_cursorIndex, ((ITableColorProvider) m_viewer.getLabelProvider()).getForeground(m_mouseHoverItem
- .getData(), m_cursorIndex));
- Rectangle bounds = m_mouseHoverItem.getBounds(m_cursorIndex);
- asyncRedraw(bounds.x, bounds.y, bounds.width, bounds.height);
- }
- m_mouseHoverItem = item;
- m_cursorIndex = index;
- m_mouseHoverItem.setBackground(m_cursorIndex, m_mouseHoverBackground);
- m_mouseHoverItem.setForeground(m_cursorIndex, Display.getCurrent().getSystemColor(
- SWT.COLOR_LIST_FOREGROUND));
- Rectangle bounds = m_mouseHoverItem.getBounds(m_cursorIndex);
- asyncRedraw(bounds.x, bounds.y, bounds.width, bounds.height);
- }
- }
- }
-
- @Override
- public void mouseExit(org.eclipse.swt.events.MouseEvent e) {
- if (m_mouseHoverItem != null && !m_mouseHoverItem.isDisposed() && m_cursorIndex > -1) {
- m_mouseHoverItem.setBackground(m_cursorIndex, ((ITableColorProvider) getViewer().getLabelProvider()).getBackground(m_mouseHoverItem
- .getData(), m_cursorIndex));
- m_mouseHoverItem.setForeground(m_cursorIndex, ((ITableColorProvider) getViewer().getLabelProvider()).getForeground(m_mouseHoverItem
- .getData(), m_cursorIndex));
- Rectangle bounds = m_mouseHoverItem.getBounds(m_cursorIndex);
- m_mouseHoverItem = null;
- m_cursorIndex = -1;
- asyncRedraw(bounds.x, bounds.y, bounds.width, bounds.height);
- }
- }
-
- @Override
- public void mouseEnter(org.eclipse.swt.events.MouseEvent e) {
- if (m_colPositions == null) {
- saveColumnPositions();
- }
- }
- } // end class P_RowMouseTrackListener
-
-}
+ */
+public class TableCellRolloverSupport {
+ private TableItem m_mouseHoverItem;
+ private int m_cursorIndex = -1;
+ private int[] m_colPositions;
+ private Color m_mouseHoverBackground;
+ private P_RowMouseTrackListener m_trackListener = new P_RowMouseTrackListener();
+ private final Table m_table;
+ private final TableViewer m_viewer;
+
+ public TableCellRolloverSupport(TableViewer viewer) {
+ m_viewer = viewer;
+ m_table = m_viewer.getTable();
+ m_mouseHoverBackground = new Color(m_table.getDisplay(), 179, 195, 255);
+ attachListeners();
+ }
+
+ protected void attachListeners() {
+ //XXX rap getTable().addMouseMoveListener(m_trackListener);
+ //XXX rap getTable().addMouseTrackListener(m_trackListener);
+ getTable().addDisposeListener(new DisposeListener() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void widgetDisposed(DisposeEvent e) {
+ dettachListeners();
+ if (m_mouseHoverBackground != null && !m_mouseHoverBackground.isDisposed() && m_mouseHoverBackground.getDevice() != null) {
+ m_mouseHoverBackground.dispose();
+ m_mouseHoverBackground = null;
+ }
+ }
+ });
+ }
+
+ protected void dettachListeners() {
+ //XXX rap getTable().removeMouseMoveListener(m_trackListener);
+ //XXX rap getTable().removeMouseTrackListener(m_trackListener);
+ }
+
+ public Table getTable() {
+ return m_table;
+ }
+
+ public TableViewer getViewer() {
+ return m_viewer;
+ }
+
+ private void saveColumnPositions() {
+ m_colPositions = new int[getTable().getColumnCount()];
+ TableItem item = getTable().getItem(0);
+ for (int i = 0; i < getTable().getColumnCount(); i++) {
+ m_colPositions[i] = item.getBounds(i).x + item.getBounds(i).width;
+ }
+ }
+
+ private int getColumnIndex(int x) {
+ int i = 0;
+ while (i < m_colPositions.length && x > m_colPositions[i]) {
+ i++;
+ }
+ return i;
+ }
+
+ private void asyncRedraw(final int x, final int y, final int width, final int height) {
+ getTable().getDisplay().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ if (getTable() != null && !getTable().isDisposed()) {
+ getTable().redraw(x, y, width, height, true);
+ }
+ }
+ });
+ }
+
+ private class P_RowMouseTrackListener extends MouseTrackAdapter implements MouseMoveListener {//XXX RAP SLE: no listener for MouseTrackAdapter in RAP, has to be made different. JScript-Injectjion?
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void mouseMove(org.eclipse.swt.events.MouseEvent e) {
+ Point p = new Point(e.x, e.y);
+ int index = getColumnIndex(e.x);
+ if (getTable().getItem(p) != m_mouseHoverItem || m_cursorIndex != index) {
+ TableItem item = getTable().getItem(p);
+ if (item != null) {
+ if (m_mouseHoverItem != null && !m_mouseHoverItem.isDisposed() && m_cursorIndex > -1) {
+ m_mouseHoverItem.setBackground(m_cursorIndex, ((ITableColorProvider) m_viewer.getLabelProvider()).getBackground(m_mouseHoverItem
+ .getData(), m_cursorIndex));
+ m_mouseHoverItem.setForeground(m_cursorIndex, ((ITableColorProvider) m_viewer.getLabelProvider()).getForeground(m_mouseHoverItem
+ .getData(), m_cursorIndex));
+ Rectangle bounds = m_mouseHoverItem.getBounds(m_cursorIndex);
+ asyncRedraw(bounds.x, bounds.y, bounds.width, bounds.height);
+ }
+ m_mouseHoverItem = item;
+ m_cursorIndex = index;
+ m_mouseHoverItem.setBackground(m_cursorIndex, m_mouseHoverBackground);
+ m_mouseHoverItem.setForeground(m_cursorIndex, Display.getCurrent().getSystemColor(
+ SWT.COLOR_LIST_FOREGROUND));
+ Rectangle bounds = m_mouseHoverItem.getBounds(m_cursorIndex);
+ asyncRedraw(bounds.x, bounds.y, bounds.width, bounds.height);
+ }
+ }
+ }
+
+ @Override
+ public void mouseExit(org.eclipse.swt.events.MouseEvent e) {
+ if (m_mouseHoverItem != null && !m_mouseHoverItem.isDisposed() && m_cursorIndex > -1) {
+ m_mouseHoverItem.setBackground(m_cursorIndex, ((ITableColorProvider) getViewer().getLabelProvider()).getBackground(m_mouseHoverItem
+ .getData(), m_cursorIndex));
+ m_mouseHoverItem.setForeground(m_cursorIndex, ((ITableColorProvider) getViewer().getLabelProvider()).getForeground(m_mouseHoverItem
+ .getData(), m_cursorIndex));
+ Rectangle bounds = m_mouseHoverItem.getBounds(m_cursorIndex);
+ m_mouseHoverItem = null;
+ m_cursorIndex = -1;
+ asyncRedraw(bounds.x, bounds.y, bounds.width, bounds.height);
+ }
+ }
+
+ @Override
+ public void mouseEnter(org.eclipse.swt.events.MouseEvent e) {
+ if (m_colPositions == null) {
+ saveColumnPositions();
+ }
+ }
+ } // end class P_RowMouseTrackListener
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/table/util/TableRolloverSupport.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/table/util/TableRolloverSupport.java
index 4d4c8e21ae..17e1ae9b6f 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/table/util/TableRolloverSupport.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/table/util/TableRolloverSupport.java
@@ -1,105 +1,105 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.ext.table.util;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseMoveListener;
-import org.eclipse.swt.events.MouseTrackAdapter;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableItem;
-
-public class TableRolloverSupport {
-
- private final Table m_table;
- private P_MouseHoverListener m_mouseHoverListener = new P_MouseHoverListener();
-
- public TableRolloverSupport(Table table) {
- m_table = table;
- attachUiListeners();
- }
-
- public Table getTable() {
- return m_table;
- }
-
- protected void attachUiListeners() {
- //XXX rap getTable().addMouseMoveListener(m_mouseHoverListener);
- //XXX rap getTable().addMouseTrackListener(m_mouseHoverListener);
- getTable().addDisposeListener(new DisposeListener() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void widgetDisposed(DisposeEvent e) {
- detachUiListeners();
- }
- });
- }
-
- protected void detachUiListeners() {
- //XXX rap getTable().removeMouseMoveListener(m_mouseHoverListener);
- //XXX rap getTable().removeMouseTrackListener(m_mouseHoverListener);
- }
-
- private class P_MouseHoverListener extends MouseTrackAdapter implements MouseMoveListener {//XXX RAP SLE: no listener for MouseTrackAdapter in RAP, has to be made different. JScript-Injectjion?
- private static final long serialVersionUID = 1L;
- private TableItem m_mouseHoverItem;
-
- // case 1: mouse hover an item
- @Override
- public void mouseMove(MouseEvent e) {
- Table table = getTable();
- TableItem item = table.getItem(new Point(e.x, e.y));
- // another item under the mouse?
- if (item != m_mouseHoverItem && item != null) {
- // old mouse over item valid?
- if (m_mouseHoverItem != null && !m_mouseHoverItem.isDisposed()) {
- // change color and redraw old item
- m_mouseHoverItem.setBackground(null);
- final Rectangle b = m_mouseHoverItem.getBounds();
- redraw(b, table);
- }
- // store, change color and redraw new item
- m_mouseHoverItem = item;
- m_mouseHoverItem.setBackground(getTable().getDisplay().getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW));
- Rectangle b = m_mouseHoverItem.getBounds();
- redraw(b, table);
- }
- }
-
- // case 2: exit from the table
- @Override
- public void mouseExit(MouseEvent e) {
- if (m_mouseHoverItem != null && !m_mouseHoverItem.isDisposed()) {
- m_mouseHoverItem.setBackground(null);
- Rectangle b = m_mouseHoverItem.getBounds();
- redraw(b, getTable());
- }
- }
-
- // asynchronous redraw
- private void redraw(final Rectangle b, final Table table) {
- getTable().getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (table != null && !table.isDisposed()) {
- table.redraw(b.x, b.y, b.width, b.height, false);
- }
- }
- });
- }
- } // end class P_MouseHoverListener
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.ext.table.util;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseMoveListener;
+import org.eclipse.swt.events.MouseTrackAdapter;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableItem;
+
+public class TableRolloverSupport {
+
+ private final Table m_table;
+ private P_MouseHoverListener m_mouseHoverListener = new P_MouseHoverListener();
+
+ public TableRolloverSupport(Table table) {
+ m_table = table;
+ attachUiListeners();
+ }
+
+ public Table getTable() {
+ return m_table;
+ }
+
+ protected void attachUiListeners() {
+ //XXX rap getTable().addMouseMoveListener(m_mouseHoverListener);
+ //XXX rap getTable().addMouseTrackListener(m_mouseHoverListener);
+ getTable().addDisposeListener(new DisposeListener() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void widgetDisposed(DisposeEvent e) {
+ detachUiListeners();
+ }
+ });
+ }
+
+ protected void detachUiListeners() {
+ //XXX rap getTable().removeMouseMoveListener(m_mouseHoverListener);
+ //XXX rap getTable().removeMouseTrackListener(m_mouseHoverListener);
+ }
+
+ private class P_MouseHoverListener extends MouseTrackAdapter implements MouseMoveListener {//XXX RAP SLE: no listener for MouseTrackAdapter in RAP, has to be made different. JScript-Injectjion?
+ private static final long serialVersionUID = 1L;
+ private TableItem m_mouseHoverItem;
+
+ // case 1: mouse hover an item
+ @Override
+ public void mouseMove(MouseEvent e) {
+ Table table = getTable();
+ TableItem item = table.getItem(new Point(e.x, e.y));
+ // another item under the mouse?
+ if (item != m_mouseHoverItem && item != null) {
+ // old mouse over item valid?
+ if (m_mouseHoverItem != null && !m_mouseHoverItem.isDisposed()) {
+ // change color and redraw old item
+ m_mouseHoverItem.setBackground(null);
+ final Rectangle b = m_mouseHoverItem.getBounds();
+ redraw(b, table);
+ }
+ // store, change color and redraw new item
+ m_mouseHoverItem = item;
+ m_mouseHoverItem.setBackground(getTable().getDisplay().getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW));
+ Rectangle b = m_mouseHoverItem.getBounds();
+ redraw(b, table);
+ }
+ }
+
+ // case 2: exit from the table
+ @Override
+ public void mouseExit(MouseEvent e) {
+ if (m_mouseHoverItem != null && !m_mouseHoverItem.isDisposed()) {
+ m_mouseHoverItem.setBackground(null);
+ Rectangle b = m_mouseHoverItem.getBounds();
+ redraw(b, getTable());
+ }
+ }
+
+ // asynchronous redraw
+ private void redraw(final Rectangle b, final Table table) {
+ getTable().getDisplay().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ if (table != null && !table.isDisposed()) {
+ table.redraw(b.x, b.y, b.width, b.height, false);
+ }
+ }
+ });
+ }
+ } // end class P_MouseHoverListener
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/tree/TreeEx.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/tree/TreeEx.java
index 25069438b0..3c0a66fd64 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/tree/TreeEx.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/tree/TreeEx.java
@@ -1,121 +1,121 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.ext.tree;
-
-import org.eclipse.rwt.internal.textsize.TextSizeUtil;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeItem;
-
-@SuppressWarnings("restriction")
-public class TreeEx extends Tree {
- private static final long serialVersionUID = 1L;
-
- private static final String BACKUPED_MENU = "backupedMenu";
- private boolean m_readOnly = false;
- private TreeItem m_contextItem;
-
- public TreeEx(Composite parent, int style) {
- super(parent, style | SWT.FULL_SELECTION);
- addListener(SWT.MouseDown, new Listener() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void handleEvent(Event event) {
- m_contextItem = getItem(new Point(event.x, event.y));
- }
- });
- }
-
- @Override
- protected void checkSubclass() {
- // allow subclassing
- }
-
- /**
- * @return the contextItem
- */
- public TreeItem getContextItem() {
- return m_contextItem;
- }
-
- public void setReadOnly(boolean readOnly) {
- if (m_readOnly != readOnly) {
- m_readOnly = readOnly;
- if (readOnly) {
- setData(BACKUPED_MENU, getMenu());
- }
- else {
- setMenu((Menu) getData(BACKUPED_MENU));
- }
- }
- }
-
- public boolean isReadOnly() {
- return m_readOnly;
- }
-
- public Point getPreferredContentSize(int maxRowCount, TreeItem parentItem, int stage) {
- Rectangle max = new Rectangle(0, 0, 0, 0);
- int nr = getItemCount();
- if (parentItem != null) {
- nr = parentItem.getItemCount();
- }
- for (int r = 0; r < nr && r < maxRowCount; r++) {
- TreeItem item;
- if (parentItem == null) {
- item = getItem(r);
- }
- else {
- item = parentItem.getItem(r);
- }
- if (item.getItemCount() > 0) {
- Point childSize = getPreferredContentSize(maxRowCount, item, stage + 1);
- Rectangle bounds = new Rectangle(0, 0, childSize.x, childSize.y);
- max = max.union(bounds);
- }
- Rectangle bounds = item.getBounds();
-
- String text = item.getText();
- if (!StringUtility.hasText(text)) {
- if (item.getData() instanceof ITreeNode) {
- text = ((ITreeNode) item.getData()).getCell().getText();
- }
- }
- if (StringUtility.hasText(text)) {
- int textWidth = TextSizeUtil.stringExtent(item.getFont(), text).x;
- bounds.width = textWidth;
- }
- bounds.width += stage * 5;
- max = max.union(bounds);
- }
- int y = max.y + max.height;
- //Add some points in height to ensure we do not have a scrollbar where not needed (depending to the count of items)
- if (nr > 3) {
- y += 1;
- }
- else if (nr > 1) {
- y += 2;
- }
- else {
- y += 4;
- }
- return new Point(max.x + max.width, y);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.ext.tree;
+
+import org.eclipse.rwt.internal.textsize.TextSizeUtil;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
+
+@SuppressWarnings("restriction")
+public class TreeEx extends Tree {
+ private static final long serialVersionUID = 1L;
+
+ private static final String BACKUPED_MENU = "backupedMenu";
+ private boolean m_readOnly = false;
+ private TreeItem m_contextItem;
+
+ public TreeEx(Composite parent, int style) {
+ super(parent, style | SWT.FULL_SELECTION);
+ addListener(SWT.MouseDown, new Listener() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void handleEvent(Event event) {
+ m_contextItem = getItem(new Point(event.x, event.y));
+ }
+ });
+ }
+
+ @Override
+ protected void checkSubclass() {
+ // allow subclassing
+ }
+
+ /**
+ * @return the contextItem
+ */
+ public TreeItem getContextItem() {
+ return m_contextItem;
+ }
+
+ public void setReadOnly(boolean readOnly) {
+ if (m_readOnly != readOnly) {
+ m_readOnly = readOnly;
+ if (readOnly) {
+ setData(BACKUPED_MENU, getMenu());
+ }
+ else {
+ setMenu((Menu) getData(BACKUPED_MENU));
+ }
+ }
+ }
+
+ public boolean isReadOnly() {
+ return m_readOnly;
+ }
+
+ public Point getPreferredContentSize(int maxRowCount, TreeItem parentItem, int stage) {
+ Rectangle max = new Rectangle(0, 0, 0, 0);
+ int nr = getItemCount();
+ if (parentItem != null) {
+ nr = parentItem.getItemCount();
+ }
+ for (int r = 0; r < nr && r < maxRowCount; r++) {
+ TreeItem item;
+ if (parentItem == null) {
+ item = getItem(r);
+ }
+ else {
+ item = parentItem.getItem(r);
+ }
+ if (item.getItemCount() > 0) {
+ Point childSize = getPreferredContentSize(maxRowCount, item, stage + 1);
+ Rectangle bounds = new Rectangle(0, 0, childSize.x, childSize.y);
+ max = max.union(bounds);
+ }
+ Rectangle bounds = item.getBounds();
+
+ String text = item.getText();
+ if (!StringUtility.hasText(text)) {
+ if (item.getData() instanceof ITreeNode) {
+ text = ((ITreeNode) item.getData()).getCell().getText();
+ }
+ }
+ if (StringUtility.hasText(text)) {
+ int textWidth = TextSizeUtil.stringExtent(item.getFont(), text).x;
+ bounds.width = textWidth;
+ }
+ bounds.width += stage * 5;
+ max = max.union(bounds);
+ }
+ int y = max.y + max.height;
+ //Add some points in height to ensure we do not have a scrollbar where not needed (depending to the count of items)
+ if (nr > 3) {
+ y += 1;
+ }
+ else if (nr > 1) {
+ y += 2;
+ }
+ else {
+ y += 4;
+ }
+ return new Point(max.x + max.width, y);
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/util/RadioButtonGroup.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/util/RadioButtonGroup.java
index 2d96ab96fc..c590890589 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/util/RadioButtonGroup.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/ext/util/RadioButtonGroup.java
@@ -1,76 +1,76 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.ext.util;
-
-import java.util.ArrayList;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-
-/**
- * <h3>RadioButtonGroup</h3> ...
- *
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.ext.util;
+
+import java.util.ArrayList;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+
+/**
+ * <h3>RadioButtonGroup</h3> ...
+ *
* @since 3.7.0 June 2011
- */
-public class RadioButtonGroup {
- private ArrayList<Button> m_radioButtons = new ArrayList<Button>();
- private Listener m_radioBehaviourListener = new P_RadioBehaviourListener();
-
- public void addButton(Button button) {
- if (button != null) {
- synchronized (m_radioButtons) {
- m_radioButtons.add(button);
- button.addListener(SWT.Selection, m_radioBehaviourListener);
- button.addListener(SWT.Dispose, m_radioBehaviourListener);
- }
- }
- }
-
- public void removeButton(Button button) {
- if (button != null) {
- synchronized (m_radioButtons) {
- button.removeListener(SWT.Selection, m_radioBehaviourListener);
- button.removeListener(SWT.Dispose, m_radioBehaviourListener);
- m_radioButtons.remove(button);
- }
- }
- }
-
- protected void handleRadioButtonSelected(Button selectedButton) {
- Button[] buttons = new Button[0];
- synchronized (m_radioButtons) {
- buttons = m_radioButtons.toArray(new Button[m_radioButtons.size()]);
- }
- for (Button b : buttons) {
- b.setSelection(b.equals(selectedButton));
- }
- }
-
- private class P_RadioBehaviourListener implements Listener {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void handleEvent(Event event) {
- switch (event.type) {
- case SWT.Dispose:
- removeButton((Button) event.widget);
- break;
- case SWT.Selection:
- handleRadioButtonSelected((Button) event.widget);
- break;
- default:
- break;
- }
- }
- }
-}
+ */
+public class RadioButtonGroup {
+ private ArrayList<Button> m_radioButtons = new ArrayList<Button>();
+ private Listener m_radioBehaviourListener = new P_RadioBehaviourListener();
+
+ public void addButton(Button button) {
+ if (button != null) {
+ synchronized (m_radioButtons) {
+ m_radioButtons.add(button);
+ button.addListener(SWT.Selection, m_radioBehaviourListener);
+ button.addListener(SWT.Dispose, m_radioBehaviourListener);
+ }
+ }
+ }
+
+ public void removeButton(Button button) {
+ if (button != null) {
+ synchronized (m_radioButtons) {
+ button.removeListener(SWT.Selection, m_radioBehaviourListener);
+ button.removeListener(SWT.Dispose, m_radioBehaviourListener);
+ m_radioButtons.remove(button);
+ }
+ }
+ }
+
+ protected void handleRadioButtonSelected(Button selectedButton) {
+ Button[] buttons = new Button[0];
+ synchronized (m_radioButtons) {
+ buttons = m_radioButtons.toArray(new Button[m_radioButtons.size()]);
+ }
+ for (Button b : buttons) {
+ b.setSelection(b.equals(selectedButton));
+ }
+ }
+
+ private class P_RadioBehaviourListener implements Listener {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void handleEvent(Event event) {
+ switch (event.type) {
+ case SWT.Dispose:
+ removeButton((Button) event.widget);
+ break;
+ case SWT.Selection:
+ handleRadioButtonSelected((Button) event.widget);
+ break;
+ default:
+ break;
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/extension/FormFieldsExtensionPoint.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/extension/FormFieldsExtensionPoint.java
index 583910dff3..e4f06a06c4 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/extension/FormFieldsExtensionPoint.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/extension/FormFieldsExtensionPoint.java
@@ -1,83 +1,83 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.extension;
-
-import java.util.ArrayList;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.ui.rap.Activator;
-import org.eclipse.scout.rt.ui.rap.extension.internal.FormFieldExtension;
-
-/**
- * <h3>FormFieldsExtensionPoint</h3> To access all form field extension beans.
- *
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.extension;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.ui.rap.Activator;
+import org.eclipse.scout.rt.ui.rap.extension.internal.FormFieldExtension;
+
+/**
+ * <h3>FormFieldsExtensionPoint</h3> To access all form field extension beans.
+ *
* @since 3.7.0 June 2011
- */
-public final class FormFieldsExtensionPoint {
- private static IScoutLogger LOG = ScoutLogManager.getLogger(FormFieldsExtensionPoint.class);
-
- private FormFieldsExtensionPoint() {
- }
-
- public static IFormFieldExtension[] getFormFieldExtensions() {
- ArrayList<IFormFieldExtension> formFieldExtensionList = new ArrayList<IFormFieldExtension>();
- IExtensionRegistry reg = Platform.getExtensionRegistry();
- IExtensionPoint xp = reg.getExtensionPoint(Activator.PLUGIN_ID, "formfields");
- IExtension[] extensions = xp.getExtensions();
- for (IExtension extension : extensions) {
- IConfigurationElement[] elements = extension.getConfigurationElements();
- for (IConfigurationElement element : elements) {
- String name = element.getAttribute("name");
- boolean active = "true".equalsIgnoreCase(element.getAttribute("active"));
- FormFieldExtension formFieldExt = new FormFieldExtension(name);
- formFieldExt.setContibuterBundleId(extension.getContributor().getName());
- formFieldExt.setActive(active);
- formFieldExt.setScope(getScopePriority(element.getAttribute("scope")));
- formFieldExt.setModelClassName(element.getAttribute("modelClass"));
- formFieldExt.setFactoryClassName(getClassName(element.getChildren("factory"), "class"));
- formFieldExt.setUiClassName(getClassName(element.getChildren("uiClass"), "class"));
- formFieldExtensionList.add(formFieldExt);
- }
- }
- return formFieldExtensionList.toArray(new IFormFieldExtension[formFieldExtensionList.size()]);
- }
-
- private static String getClassName(IConfigurationElement[] elements, String attribute) {
- String clazzName = null;
- if (elements != null && elements.length == 1) {
- clazzName = elements[0].getAttribute(attribute);
-
- }
- return clazzName;
- }
-
- private static int getScopePriority(String scope) {
- int prio = IFormFieldExtension.SCOPE_DEFAULT;
- if (StringUtility.isNullOrEmpty(scope) || scope.equalsIgnoreCase("default")) {
- prio = IFormFieldExtension.SCOPE_DEFAULT;
- }
- else if (scope.equalsIgnoreCase("global")) {
- prio = IFormFieldExtension.SCOPE_GLOBAL;
- }
- else if (scope.equalsIgnoreCase("local")) {
- prio = IFormFieldExtension.SCOPE_LOCAL;
- }
- return prio;
- }
-
-}
+ */
+public final class FormFieldsExtensionPoint {
+ private static IScoutLogger LOG = ScoutLogManager.getLogger(FormFieldsExtensionPoint.class);
+
+ private FormFieldsExtensionPoint() {
+ }
+
+ public static IFormFieldExtension[] getFormFieldExtensions() {
+ ArrayList<IFormFieldExtension> formFieldExtensionList = new ArrayList<IFormFieldExtension>();
+ IExtensionRegistry reg = Platform.getExtensionRegistry();
+ IExtensionPoint xp = reg.getExtensionPoint(Activator.PLUGIN_ID, "formfields");
+ IExtension[] extensions = xp.getExtensions();
+ for (IExtension extension : extensions) {
+ IConfigurationElement[] elements = extension.getConfigurationElements();
+ for (IConfigurationElement element : elements) {
+ String name = element.getAttribute("name");
+ boolean active = "true".equalsIgnoreCase(element.getAttribute("active"));
+ FormFieldExtension formFieldExt = new FormFieldExtension(name);
+ formFieldExt.setContibuterBundleId(extension.getContributor().getName());
+ formFieldExt.setActive(active);
+ formFieldExt.setScope(getScopePriority(element.getAttribute("scope")));
+ formFieldExt.setModelClassName(element.getAttribute("modelClass"));
+ formFieldExt.setFactoryClassName(getClassName(element.getChildren("factory"), "class"));
+ formFieldExt.setUiClassName(getClassName(element.getChildren("uiClass"), "class"));
+ formFieldExtensionList.add(formFieldExt);
+ }
+ }
+ return formFieldExtensionList.toArray(new IFormFieldExtension[formFieldExtensionList.size()]);
+ }
+
+ private static String getClassName(IConfigurationElement[] elements, String attribute) {
+ String clazzName = null;
+ if (elements != null && elements.length == 1) {
+ clazzName = elements[0].getAttribute(attribute);
+
+ }
+ return clazzName;
+ }
+
+ private static int getScopePriority(String scope) {
+ int prio = IFormFieldExtension.SCOPE_DEFAULT;
+ if (StringUtility.isNullOrEmpty(scope) || scope.equalsIgnoreCase("default")) {
+ prio = IFormFieldExtension.SCOPE_DEFAULT;
+ }
+ else if (scope.equalsIgnoreCase("global")) {
+ prio = IFormFieldExtension.SCOPE_GLOBAL;
+ }
+ else if (scope.equalsIgnoreCase("local")) {
+ prio = IFormFieldExtension.SCOPE_LOCAL;
+ }
+ return prio;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/extension/IFormFieldExtension.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/extension/IFormFieldExtension.java
index ced989c9e7..b54c670729 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/extension/IFormFieldExtension.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/extension/IFormFieldExtension.java
@@ -1,97 +1,97 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.extension;
-
-import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
-
-/**
- * <h3>IFormFieldExtension</h3> The extension bean defining a form field
- * extension. A form field extension can have direct link to an ui class
- * (Class<? extends {@link IRwtScoutFormField}>) or a form field factory
- * (Class<? extends {@link IFormFieldFactory}>). A {@link IFormFieldFactory} is
- * used to dynamically decide about the UI implementation of a form field.</br>
- * Every extension has an attribute called scope. The scope might have one of
- * the following values:
- * <ul>
- * <li>
- * {@link IFormFieldExtension#SCOPE_DEFAULT} to indicate this extension to be the default implementation. Is usually
- * used of external component providers (e.g. a PhotoShopField).</li>
- * <li>
- * {@link IFormFieldExtension#SCOPE_GLOBAL} to indicate this extension to have a global scope (whole eclipse).
- * Global defined extensions overwrite the default implementation.</li>
- * <li>
- * {@link IFormFieldExtension#SCOPE_LOCAL} to indicate this extension to have local scope. Local defined extensions
- * overwrite the global defined implementation. Local extensions should only be declared in application specific plugins
- * (e.g. com.bsiag.crm.ui.swt).</li>
- * </ul>
- *
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.extension;
+
+import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
+
+/**
+ * <h3>IFormFieldExtension</h3> The extension bean defining a form field
+ * extension. A form field extension can have direct link to an ui class
+ * (Class<? extends {@link IRwtScoutFormField}>) or a form field factory
+ * (Class<? extends {@link IFormFieldFactory}>). A {@link IFormFieldFactory} is
+ * used to dynamically decide about the UI implementation of a form field.</br>
+ * Every extension has an attribute called scope. The scope might have one of
+ * the following values:
+ * <ul>
+ * <li>
+ * {@link IFormFieldExtension#SCOPE_DEFAULT} to indicate this extension to be the default implementation. Is usually
+ * used of external component providers (e.g. a PhotoShopField).</li>
+ * <li>
+ * {@link IFormFieldExtension#SCOPE_GLOBAL} to indicate this extension to have a global scope (whole eclipse).
+ * Global defined extensions overwrite the default implementation.</li>
+ * <li>
+ * {@link IFormFieldExtension#SCOPE_LOCAL} to indicate this extension to have local scope. Local defined extensions
+ * overwrite the global defined implementation. Local extensions should only be declared in application specific plugins
+ * (e.g. com.bsiag.crm.ui.swt).</li>
+ * </ul>
+ *
* @since 3.7.0 June 2011
- */
-public interface IFormFieldExtension {
- int SCOPE_DEFAULT = 0;
- int SCOPE_GLOBAL = 1;
- int SCOPE_LOCAL = 2;
-
- /**
- * @return a human readable name of the extension.
- */
- String getName();
-
- /**
- * <ul>
- * <li>
- * {@link IFormFieldExtension#SCOPE_DEFAULT} to indicate this extension to be the default implementation.</li>
- * <li>
- * {@link IFormFieldExtension#SCOPE_GLOBAL} to indicate this extension to have a global scope (whole eclipse).
- * Global defined extensions overwrite the default implementation.</li>
- * <li>
- * {@link IFormFieldExtension#SCOPE_LOCAL} to indicate this extension to have local scope. Local defined
- * extensions overwrite the global defined implementation. Local extensions should only be declared in application
- * specific plugins (e.g. com.bsiag.crm.ui.swt).</li>
- * </ul>
- *
- * @return one of {@link IFormFieldExtension#SCOPE_DEFAULT}, {@link IFormFieldExtension#SCOPE_GLOBAL},
- * {@link IFormFieldExtension#SCOPE_LOCAL}
- */
- int getScope();
-
- /**
- * users of this interface should type check
- *
- * @return either a marker interface class name or a class name instanceof
- * IFormField
- */
- String getModelClassName();
-
- /**
- * users of this interface should type check
- *
- * @return a class name instanceof ISwtScoutFormField
- */
- String getUiClassName();
-
- /**
- * users of this interface should type check
- *
- * @return a class name instanceof IFormFieldFactory
- */
- String getFactoryClassName();
-
- boolean isActive();
-
- /**
- * The id of the contibutor bundle.
- *
- * @return
- */
- String getContibuterBundleId();
-
-}
+ */
+public interface IFormFieldExtension {
+ int SCOPE_DEFAULT = 0;
+ int SCOPE_GLOBAL = 1;
+ int SCOPE_LOCAL = 2;
+
+ /**
+ * @return a human readable name of the extension.
+ */
+ String getName();
+
+ /**
+ * <ul>
+ * <li>
+ * {@link IFormFieldExtension#SCOPE_DEFAULT} to indicate this extension to be the default implementation.</li>
+ * <li>
+ * {@link IFormFieldExtension#SCOPE_GLOBAL} to indicate this extension to have a global scope (whole eclipse).
+ * Global defined extensions overwrite the default implementation.</li>
+ * <li>
+ * {@link IFormFieldExtension#SCOPE_LOCAL} to indicate this extension to have local scope. Local defined
+ * extensions overwrite the global defined implementation. Local extensions should only be declared in application
+ * specific plugins (e.g. com.bsiag.crm.ui.swt).</li>
+ * </ul>
+ *
+ * @return one of {@link IFormFieldExtension#SCOPE_DEFAULT}, {@link IFormFieldExtension#SCOPE_GLOBAL},
+ * {@link IFormFieldExtension#SCOPE_LOCAL}
+ */
+ int getScope();
+
+ /**
+ * users of this interface should type check
+ *
+ * @return either a marker interface class name or a class name instanceof
+ * IFormField
+ */
+ String getModelClassName();
+
+ /**
+ * users of this interface should type check
+ *
+ * @return a class name instanceof ISwtScoutFormField
+ */
+ String getUiClassName();
+
+ /**
+ * users of this interface should type check
+ *
+ * @return a class name instanceof IFormFieldFactory
+ */
+ String getFactoryClassName();
+
+ boolean isActive();
+
+ /**
+ * The id of the contibutor bundle.
+ *
+ * @return
+ */
+ String getContibuterBundleId();
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/extension/IFormFieldFactory.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/extension/IFormFieldFactory.java
index 43fe8b68dd..cec521211e 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/extension/IFormFieldFactory.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/extension/IFormFieldFactory.java
@@ -1,20 +1,20 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.extension;
-
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
-import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
-import org.eclipse.swt.widgets.Composite;
-
-public interface IFormFieldFactory {
- IRwtScoutFormField<?> createUiFormField(Composite parent, IFormField model, IRwtEnvironment uiEnvironment);
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.extension;
+
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
+import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
+import org.eclipse.swt.widgets.Composite;
+
+public interface IFormFieldFactory {
+ IRwtScoutFormField<?> createUiFormField(Composite parent, IFormField model, IRwtEnvironment uiEnvironment);
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/extension/ILookAndFeelDecorations.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/extension/ILookAndFeelDecorations.java
index fba8a385e5..e2ca0f9027 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/extension/ILookAndFeelDecorations.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/extension/ILookAndFeelDecorations.java
@@ -1,31 +1,31 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.extension;
-
-import org.eclipse.scout.rt.shared.data.basic.FontSpec;
-
-public interface ILookAndFeelDecorations {
- int STAR_MARKER_NONE = 0;
- int STAR_MARKER_BEFORE_LABEL = 1;
- int STAR_MARKER_AFTER_LABEL = 2;
-
- int getScope();
-
- String getDeviceTypeIdentifier();
-
- int getStarMarkerPosition();
-
- FontSpec getMandatoryLabelFont();
-
- String getMandatoryFieldBackgroundColor();
-
- String getMandatoryLabelTextColor();
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.extension;
+
+import org.eclipse.scout.rt.shared.data.basic.FontSpec;
+
+public interface ILookAndFeelDecorations {
+ int STAR_MARKER_NONE = 0;
+ int STAR_MARKER_BEFORE_LABEL = 1;
+ int STAR_MARKER_AFTER_LABEL = 2;
+
+ int getScope();
+
+ String getDeviceTypeIdentifier();
+
+ int getStarMarkerPosition();
+
+ FontSpec getMandatoryLabelFont();
+
+ String getMandatoryFieldBackgroundColor();
+
+ String getMandatoryLabelTextColor();
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/extension/ILookAndFeelProperties.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/extension/ILookAndFeelProperties.java
index 35fc08cb91..b7df686561 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/extension/ILookAndFeelProperties.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/extension/ILookAndFeelProperties.java
@@ -1,53 +1,53 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.extension;
-
-public interface ILookAndFeelProperties {
-
- String PROP_FORM_MAINBOX_BORDER_VISIBLE = "formMainBoxBorder.visible";
- String PROP_FORM_FIELD_LABEL_WIDTH = "formFieldLabel.width";
- String PROP_FORM_FIELD_LABEL_ALIGNMENT = "formFieldLabel.alignment";
- String PROP_LOGICAL_GRID_LAYOUT_DEFAULT_COLUMN_WIDTH = "logicalGridLayout.defaultColumnWidth";
- String PROP_LOGICAL_GRID_LAYOUT_DEFAULT_POPUP_WIDTH = "logicalGridLayout.defaultPopupWidth";
-
- String PROP_LOGICAL_GRID_LAYOUT_ROW_HEIGHT = "logicalGridLayout.rowHeight";
- String PROP_LOGICAL_GRID_LAYOUT_HORIZONTAL_GAP = "logicalGridLayout.horizontalGap";
- String PROP_LOGICAL_GRID_LAYOUT_VERTICAL_GAP = "logicalGridLayout.verticalGap";
- String PROP_FORM_FIELD_ACTIVATION_BUTTON_WIDTH = "formfield.activationButton.width";
- String PROP_FORM_FIELD_ACTIVATION_BUTTON_HEIGHT = "formfield.activationButton.height";
- String PROP_FORM_FIELD_ACTIVATION_BUTTON_WITH_MENU_WIDTH = "formfield.activationButtonWithMenu.width";
- String PROP_FORM_FIELD_SELECT_ALL_ON_FOCUS_ENABLED = "formfield.selectAllOnFocus.enabled";
- String PROP_PROCESS_BUTTON_HEIGHT = "processButton.height";
- String PROP_PROCESS_BUTTON_MIN_WIDTH = "processButton.minWidth";
- String PROP_PROCESS_BUTTON_MAX_WIDTH = "processButton.maxWidth";
- String PROP_DIALOG_MIN_WIDTH = "dialog.minWidth";
- String PROP_DIALOG_MIN_HEIGHT = "dialog.minHeight";
- String PROP_COLOR_FOREGROUND_DISABLED = "color.forground.disabled";
- String PROP_MESSAGE_BOX_MIN_WIDTH = "messageBox.minWidth";
- String PROP_MESSAGE_BOX_MIN_HEIGHT = "messageBox.minHeight";
- String PROP_DND_SUPPORT_ENABLED = "dndSupport.enabled";
- String PROP_BROWSER_HISTORY_ENABLED = "browserHistory.enabled";
- String PROP_TABLE_ROW_HEIGHT = "table.row.height";
- String PROP_TREE_NODE_HEIGHT = "tree.node.height";
-
- int getScope();
-
- String getDeviceTypeIdentifier();
-
- int getPropertyInt(String name);
-
- String getPropertyString(String name);
-
- boolean getPropertyBool(String name);
-
- boolean existsProperty(String name);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.extension;
+
+public interface ILookAndFeelProperties {
+
+ String PROP_FORM_MAINBOX_BORDER_VISIBLE = "formMainBoxBorder.visible";
+ String PROP_FORM_FIELD_LABEL_WIDTH = "formFieldLabel.width";
+ String PROP_FORM_FIELD_LABEL_ALIGNMENT = "formFieldLabel.alignment";
+ String PROP_LOGICAL_GRID_LAYOUT_DEFAULT_COLUMN_WIDTH = "logicalGridLayout.defaultColumnWidth";
+ String PROP_LOGICAL_GRID_LAYOUT_DEFAULT_POPUP_WIDTH = "logicalGridLayout.defaultPopupWidth";
+
+ String PROP_LOGICAL_GRID_LAYOUT_ROW_HEIGHT = "logicalGridLayout.rowHeight";
+ String PROP_LOGICAL_GRID_LAYOUT_HORIZONTAL_GAP = "logicalGridLayout.horizontalGap";
+ String PROP_LOGICAL_GRID_LAYOUT_VERTICAL_GAP = "logicalGridLayout.verticalGap";
+ String PROP_FORM_FIELD_ACTIVATION_BUTTON_WIDTH = "formfield.activationButton.width";
+ String PROP_FORM_FIELD_ACTIVATION_BUTTON_HEIGHT = "formfield.activationButton.height";
+ String PROP_FORM_FIELD_ACTIVATION_BUTTON_WITH_MENU_WIDTH = "formfield.activationButtonWithMenu.width";
+ String PROP_FORM_FIELD_SELECT_ALL_ON_FOCUS_ENABLED = "formfield.selectAllOnFocus.enabled";
+ String PROP_PROCESS_BUTTON_HEIGHT = "processButton.height";
+ String PROP_PROCESS_BUTTON_MIN_WIDTH = "processButton.minWidth";
+ String PROP_PROCESS_BUTTON_MAX_WIDTH = "processButton.maxWidth";
+ String PROP_DIALOG_MIN_WIDTH = "dialog.minWidth";
+ String PROP_DIALOG_MIN_HEIGHT = "dialog.minHeight";
+ String PROP_COLOR_FOREGROUND_DISABLED = "color.forground.disabled";
+ String PROP_MESSAGE_BOX_MIN_WIDTH = "messageBox.minWidth";
+ String PROP_MESSAGE_BOX_MIN_HEIGHT = "messageBox.minHeight";
+ String PROP_DND_SUPPORT_ENABLED = "dndSupport.enabled";
+ String PROP_BROWSER_HISTORY_ENABLED = "browserHistory.enabled";
+ String PROP_TABLE_ROW_HEIGHT = "table.row.height";
+ String PROP_TREE_NODE_HEIGHT = "tree.node.height";
+
+ int getScope();
+
+ String getDeviceTypeIdentifier();
+
+ int getPropertyInt(String name);
+
+ String getPropertyString(String name);
+
+ boolean getPropertyBool(String name);
+
+ boolean existsProperty(String name);
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/extension/IUiDecoration.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/extension/IUiDecoration.java
index de258f362e..26d8003120 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/extension/IUiDecoration.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/extension/IUiDecoration.java
@@ -1,72 +1,72 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.extension;
-
-import org.eclipse.scout.rt.shared.data.basic.FontSpec;
-
-public interface IUiDecoration {
-
- int getDialogMinWidth();
-
- int getDialogMinHeight();
-
- int getProcessButtonHeight();
-
- int getProcessButtonMinWidth();
-
- int getProcessButtonMaxWidth();
-
- boolean isFormMainBoxBorderVisible();
-
- int getFormFieldLabelWidth();
-
- int getFormFieldLabelAlignment();
-
- boolean isFormFieldSelectAllOnFocusEnabled();
-
- String getMandatoryFieldBackgroundColor();
-
- int getMandatoryStarMarkerPosition();
-
- String getMandatoryLabelTextColor();
-
- FontSpec getMandatoryLabelFont();
-
- int getLogicalGridLayoutDefaultColumnWidth();
-
- int getLogicalGridLayoutDefaultPopupWidth();
-
- int getLogicalGridLayoutHorizontalGap();
-
- int getLogicalGridLayoutVerticalGap();
-
- int getLogicalGridLayoutRowHeight();
-
- String getColorForegroundDisabled();
-
- int getTableRowHeight();
-
- int getTreeNodeHeight();
-
- int getMessageBoxMinHeight();
-
- int getMessageBoxMinWidth();
-
- /**
- * @return the minimum width of the right area in the desktop when using standalone rwt environment
- * default is 330px
- */
- int getToolFormMinWidth();
-
- boolean isDndSupportEnabled();
-
- boolean isBrowserHistoryEnabled();
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.extension;
+
+import org.eclipse.scout.rt.shared.data.basic.FontSpec;
+
+public interface IUiDecoration {
+
+ int getDialogMinWidth();
+
+ int getDialogMinHeight();
+
+ int getProcessButtonHeight();
+
+ int getProcessButtonMinWidth();
+
+ int getProcessButtonMaxWidth();
+
+ boolean isFormMainBoxBorderVisible();
+
+ int getFormFieldLabelWidth();
+
+ int getFormFieldLabelAlignment();
+
+ boolean isFormFieldSelectAllOnFocusEnabled();
+
+ String getMandatoryFieldBackgroundColor();
+
+ int getMandatoryStarMarkerPosition();
+
+ String getMandatoryLabelTextColor();
+
+ FontSpec getMandatoryLabelFont();
+
+ int getLogicalGridLayoutDefaultColumnWidth();
+
+ int getLogicalGridLayoutDefaultPopupWidth();
+
+ int getLogicalGridLayoutHorizontalGap();
+
+ int getLogicalGridLayoutVerticalGap();
+
+ int getLogicalGridLayoutRowHeight();
+
+ String getColorForegroundDisabled();
+
+ int getTableRowHeight();
+
+ int getTreeNodeHeight();
+
+ int getMessageBoxMinHeight();
+
+ int getMessageBoxMinWidth();
+
+ /**
+ * @return the minimum width of the right area in the desktop when using standalone rwt environment
+ * default is 330px
+ */
+ int getToolFormMinWidth();
+
+ boolean isDndSupportEnabled();
+
+ boolean isBrowserHistoryEnabled();
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/extension/UiDecorationExtensionPoint.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/extension/UiDecorationExtensionPoint.java
index 2d2cfb68fc..257bb21965 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/extension/UiDecorationExtensionPoint.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/extension/UiDecorationExtensionPoint.java
@@ -1,352 +1,352 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.extension;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.TreeMap;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.shared.data.basic.FontSpec;
-import org.eclipse.scout.rt.shared.ui.IUiDeviceType;
-import org.eclipse.scout.rt.ui.rap.Activator;
-import org.eclipse.scout.rt.ui.rap.extension.internal.LookAndFeelDecorations;
-import org.eclipse.scout.rt.ui.rap.extension.internal.LookAndFeelProperties;
-import org.eclipse.scout.rt.ui.rap.extension.internal.UiDecoration;
-import org.eclipse.scout.rt.ui.rap.util.DeviceUtility;
-import org.eclipse.swt.SWT;
-
-public final class UiDecorationExtensionPoint {
- private static IScoutLogger LOG = ScoutLogManager.getLogger(UiDecorationExtensionPoint.class);
- private static Map<IUiDeviceType, IUiDecoration> LOOK_AND_FEEL_MAP = new HashMap<IUiDeviceType, IUiDecoration>();
-
- public static final int SCOPE_DEFAULT = 1;
- public static final int SCOPE_GLOBAL = 100;
- private static final String ATTR_SCOPE = "scope";
- private static final String ATTR_DEVICE_TYPE = "deviceType";
- private static final String ATTR_DEVICE_TYPE_KEYWORD_TOUCH = "touch";
-
- private UiDecorationExtensionPoint() {
- }
-
- public static synchronized IUiDecoration getLookAndFeel() {
- IUiDeviceType currentDeviceType = DeviceUtility.getCurrentDeviceType();
- if (!LOOK_AND_FEEL_MAP.containsKey(currentDeviceType)) {
- IUiDecoration uiDecoration = loadUiDecoration(currentDeviceType);
- LOOK_AND_FEEL_MAP.put(currentDeviceType, uiDecoration);
- }
-
- return LOOK_AND_FEEL_MAP.get(currentDeviceType);
- }
-
- private static ILookAndFeelDecorations parseDecorations(IConfigurationElement decorationsElement) {
- LookAndFeelDecorations decorations = new LookAndFeelDecorations();
- decorations.setScope(getScopePriority(decorationsElement.getAttribute(ATTR_SCOPE)));
- decorations.setDeviceTypeIdentifier(decorationsElement.getAttribute(ATTR_DEVICE_TYPE));
-
- IConfigurationElement[] mandatoryElement = decorationsElement.getChildren("mandatory");
- if (mandatoryElement.length > 0) {
- // only 1 mandatory extension
- // background
- IConfigurationElement[] fieldBackground = mandatoryElement[0].getChildren("fieldBackground");
- if (fieldBackground.length > 0) {
- decorations.setMandatoryFieldBackgroundColor(fieldBackground[0].getAttribute("color"));
- }
- // label text color
- IConfigurationElement[] labelTextColor = mandatoryElement[0].getChildren("labelTextColor");
- if (labelTextColor.length > 0) {
- decorations.setMandatoryLabelTextColor(labelTextColor[0].getAttribute("color"));
- }
- // label Font
- IConfigurationElement[] labelFont = mandatoryElement[0].getChildren("labelFont");
- if (labelFont.length > 0) {
- FontSpec spec = FontSpec.parse(labelFont[0].getAttribute("font"));
- decorations.setMandatoryLabelFont(spec);
- }
- // star marker
- IConfigurationElement[] starMarker = mandatoryElement[0].getChildren("starMarker");
- if (starMarker.length > 0) {
- decorations.setStarMarkerPosition(parseStarMarkerPosition(starMarker[0].getAttribute("placement")));
- }
- }
- return decorations;
- }
-
- private static ILookAndFeelProperties parseProperties(IConfigurationElement propertiesElement) {
- LookAndFeelProperties props = new LookAndFeelProperties();
- props.setScope(getScopePriority(propertiesElement.getAttribute(ATTR_SCOPE)));
- props.setDeviceTypeIdentifier(propertiesElement.getAttribute(ATTR_DEVICE_TYPE));
-
- IConfigurationElement[] properties = propertiesElement.getChildren("property");
- for (IConfigurationElement prop : properties) {
- String propName = null, propValue = null;
- propName = prop.getAttribute("name");
- propValue = prop.getAttribute("value");
- props.setProperty(propName, propValue);
- props.setContributor(propertiesElement.getContributor().getName());
- }
- return props;
- }
-
- private static int getScopePriority(String scope) {
- int prio = SCOPE_DEFAULT;
- if (StringUtility.isNullOrEmpty(scope) || scope.equalsIgnoreCase("default")) {
- prio = SCOPE_DEFAULT;
- }
- else if (scope.equalsIgnoreCase("global")) {
- prio = SCOPE_GLOBAL;
- }
- return prio;
- }
-
- private static int parseStarMarkerPosition(String value) {
- int pos = ILookAndFeelDecorations.STAR_MARKER_NONE;
- if (StringUtility.isNullOrEmpty(value) || value.equalsIgnoreCase("afterLabel")) {
- pos = ILookAndFeelDecorations.STAR_MARKER_AFTER_LABEL;
- }
- else if (value.equalsIgnoreCase("beforeLabel")) {
- pos = ILookAndFeelDecorations.STAR_MARKER_BEFORE_LABEL;
- }
- return pos;
- }
-
- private static IUiDecoration loadUiDecoration(IUiDeviceType deviceType) {
-
- ArrayList<ILookAndFeelProperties> propertyExtensions = new ArrayList<ILookAndFeelProperties>();
- ArrayList<ILookAndFeelDecorations> decorationExtensions = new ArrayList<ILookAndFeelDecorations>();
-
- IExtensionRegistry reg = Platform.getExtensionRegistry();
- IExtensionPoint xp = reg.getExtensionPoint(Activator.PLUGIN_ID, "lookAndFeel");
- IExtension[] extensions = xp.getExtensions();
-
- for (IExtension extension : extensions) {
- IConfigurationElement[] elements = extension.getConfigurationElements();
- for (IConfigurationElement element : elements) {
- if ("properties".equals(element.getName())) {
- propertyExtensions.add(parseProperties(element));
- }
- else if ("decorations".equals(element.getName())) {
- decorationExtensions.add(parseDecorations(element));
- }
- }
- }
-
- UiDecoration uiDecoration = new UiDecoration();
- loadDecorations(uiDecoration, decorationExtensions, deviceType);
- loadProperties(uiDecoration, propertyExtensions, deviceType);
-
- return uiDecoration;
- }
-
- private static void loadProperties(UiDecoration uiDecoration, ArrayList<ILookAndFeelProperties> propertyExtensions, IUiDeviceType deviceType) {
- TreeMap<Integer, ILookAndFeelProperties> properties = new TreeMap<Integer, ILookAndFeelProperties>();
- for (ILookAndFeelProperties props : propertyExtensions) {
- int scope = props.getScope();
- String deviceTypeIdentifier = props.getDeviceTypeIdentifier();
- int priority = computePriority(scope, deviceTypeIdentifier);
-
- if (isPropsAlreadLoaded(properties, priority, deviceTypeIdentifier)) {
- LOG.warn("Multiple look and feel properties found with scope '" + scope + "' and deviceType '" + deviceTypeIdentifier + "'");
- }
- else if (matchesDeviceType(deviceType, deviceTypeIdentifier)) {
- properties.put(priority, props);
- }
- }
-
- for (ILookAndFeelProperties props : properties.values()) {
- if (props.getPropertyInt(ILookAndFeelProperties.PROP_DIALOG_MIN_HEIGHT) != 0) {
- uiDecoration.setDialogMinHeight(props.getPropertyInt(ILookAndFeelProperties.PROP_DIALOG_MIN_HEIGHT));
- }
- if (props.getPropertyInt(ILookAndFeelProperties.PROP_DIALOG_MIN_WIDTH) != 0) {
- uiDecoration.setDialogMinWidth(props.getPropertyInt(ILookAndFeelProperties.PROP_DIALOG_MIN_WIDTH));
- }
- if (props.existsProperty(ILookAndFeelProperties.PROP_FORM_MAINBOX_BORDER_VISIBLE)) {
- uiDecoration.setFormMainBoxBorderVisible(props.getPropertyBool(ILookAndFeelProperties.PROP_FORM_MAINBOX_BORDER_VISIBLE));
- }
- if (props.getPropertyInt(ILookAndFeelProperties.PROP_FORM_FIELD_LABEL_WIDTH) != 0) {
- uiDecoration.setFormFieldLabelWidth(props.getPropertyInt(ILookAndFeelProperties.PROP_FORM_FIELD_LABEL_WIDTH));
- }
- if (props.getPropertyString(ILookAndFeelProperties.PROP_FORM_FIELD_LABEL_ALIGNMENT) != null) {
- String extFormFieldAlignment = props.getPropertyString(ILookAndFeelProperties.PROP_FORM_FIELD_LABEL_ALIGNMENT);
- if ("center".equalsIgnoreCase(extFormFieldAlignment)) {
- uiDecoration.setFormFieldLabelAlignment(SWT.CENTER);
- }
- else if ("left".equalsIgnoreCase(extFormFieldAlignment)) {
- uiDecoration.setFormFieldLabelAlignment(SWT.LEFT);
- }
- else if ("right".equalsIgnoreCase(extFormFieldAlignment)) {
- uiDecoration.setFormFieldLabelAlignment(SWT.RIGHT);
- }
- else {
- LOG.warn("the value '" + extFormFieldAlignment + "' is not valid for the property '" + ILookAndFeelProperties.PROP_FORM_FIELD_LABEL_ALIGNMENT + "'. Expected values are[right,left,center]");
- }
- }
- if (props.getPropertyInt(ILookAndFeelProperties.PROP_LOGICAL_GRID_LAYOUT_DEFAULT_COLUMN_WIDTH) != 0) {
- uiDecoration.setLogicalGridLayoutDefaultColumnWidth(props.getPropertyInt(ILookAndFeelProperties.PROP_LOGICAL_GRID_LAYOUT_DEFAULT_COLUMN_WIDTH));
- }
- if (props.getPropertyInt(ILookAndFeelProperties.PROP_LOGICAL_GRID_LAYOUT_DEFAULT_POPUP_WIDTH) != 0) {
- uiDecoration.setLogicalGridLayoutDefaultPopupWidth(props.getPropertyInt(ILookAndFeelProperties.PROP_LOGICAL_GRID_LAYOUT_DEFAULT_POPUP_WIDTH));
- }
- if (props.getPropertyInt(ILookAndFeelProperties.PROP_LOGICAL_GRID_LAYOUT_HORIZONTAL_GAP) != 0) {
- uiDecoration.setLogicalGridLayoutHorizontalGap(props.getPropertyInt(ILookAndFeelProperties.PROP_LOGICAL_GRID_LAYOUT_HORIZONTAL_GAP));
- }
- if (props.getPropertyInt(ILookAndFeelProperties.PROP_LOGICAL_GRID_LAYOUT_ROW_HEIGHT) != 0) {
- uiDecoration.setLogicalGridLayoutRowHeight(props.getPropertyInt(ILookAndFeelProperties.PROP_LOGICAL_GRID_LAYOUT_ROW_HEIGHT));
- }
- if (props.getPropertyInt(ILookAndFeelProperties.PROP_LOGICAL_GRID_LAYOUT_VERTICAL_GAP) != 0) {
- uiDecoration.setLogicalGridLayoutVerticalGap(props.getPropertyInt(ILookAndFeelProperties.PROP_LOGICAL_GRID_LAYOUT_VERTICAL_GAP));
- }
- if (props.getPropertyInt(ILookAndFeelProperties.PROP_PROCESS_BUTTON_HEIGHT) != 0) {
- uiDecoration.setProcessButtonHeight(props.getPropertyInt(ILookAndFeelProperties.PROP_PROCESS_BUTTON_HEIGHT));
- }
- if (props.getPropertyInt(ILookAndFeelProperties.PROP_PROCESS_BUTTON_MAX_WIDTH) != 0) {
- uiDecoration.setProcessButtonMaxWidth(props.getPropertyInt(ILookAndFeelProperties.PROP_PROCESS_BUTTON_MAX_WIDTH));
- }
- if (props.getPropertyInt(ILookAndFeelProperties.PROP_PROCESS_BUTTON_MIN_WIDTH) != 0) {
- uiDecoration.setProcessButtonMinWidth(props.getPropertyInt(ILookAndFeelProperties.PROP_PROCESS_BUTTON_MIN_WIDTH));
- }
- if (props.getPropertyString(ILookAndFeelProperties.PROP_COLOR_FOREGROUND_DISABLED) != null) {
- uiDecoration.setColorForegroundDisabled(props.getPropertyString(ILookAndFeelProperties.PROP_COLOR_FOREGROUND_DISABLED));
- }
- if (props.getPropertyString(ILookAndFeelProperties.PROP_MESSAGE_BOX_MIN_WIDTH) != null) {
- uiDecoration.setMessageBoxMinWidth(props.getPropertyInt(ILookAndFeelProperties.PROP_MESSAGE_BOX_MIN_WIDTH));
- }
- if (props.getPropertyString(ILookAndFeelProperties.PROP_MESSAGE_BOX_MIN_HEIGHT) != null) {
- uiDecoration.setMessageBoxMinHeight(props.getPropertyInt(ILookAndFeelProperties.PROP_MESSAGE_BOX_MIN_HEIGHT));
- }
- if (props.getPropertyString(ILookAndFeelProperties.PROP_FORM_FIELD_SELECT_ALL_ON_FOCUS_ENABLED) != null) {
- uiDecoration.setFormFieldSelectAllOnFocusEnabled(props.getPropertyBool(ILookAndFeelProperties.PROP_FORM_FIELD_SELECT_ALL_ON_FOCUS_ENABLED));
- }
- if (props.getPropertyString(ILookAndFeelProperties.PROP_DND_SUPPORT_ENABLED) != null) {
- uiDecoration.setDndSupportEnabled(props.getPropertyBool(ILookAndFeelProperties.PROP_DND_SUPPORT_ENABLED));
- }
- if (props.getPropertyString(ILookAndFeelProperties.PROP_BROWSER_HISTORY_ENABLED) != null) {
- uiDecoration.setBrowserHistoryEnabled(props.getPropertyBool(ILookAndFeelProperties.PROP_BROWSER_HISTORY_ENABLED));
- }
- if (props.getPropertyString(ILookAndFeelProperties.PROP_TABLE_ROW_HEIGHT) != null) {
- uiDecoration.setTableRowHeight(props.getPropertyInt(ILookAndFeelProperties.PROP_TABLE_ROW_HEIGHT));
- }
- if (props.getPropertyString(ILookAndFeelProperties.PROP_TREE_NODE_HEIGHT) != null) {
- uiDecoration.setTreeNodeHeight(props.getPropertyInt(ILookAndFeelProperties.PROP_TREE_NODE_HEIGHT));
- }
-
- }
- }
-
- private static void loadDecorations(UiDecoration uiDecoration, ArrayList<ILookAndFeelDecorations> decorationExtensions, IUiDeviceType deviceType) {
- TreeMap<Integer, ILookAndFeelDecorations> decorations = new TreeMap<Integer, ILookAndFeelDecorations>();
- for (ILookAndFeelDecorations dec : decorationExtensions) {
- int scope = dec.getScope();
- String deviceTypeIdentifier = dec.getDeviceTypeIdentifier();
- int priority = computePriority(scope, deviceTypeIdentifier);
-
- if (isDecosAlreadLoaded(decorations, priority, deviceTypeIdentifier)) {
- LOG.warn("Multiple look and feel decorations found with scope '" + scope + "' and deviceType '" + deviceTypeIdentifier + "'.");
- }
- else if (matchesDeviceType(deviceType, deviceTypeIdentifier)) {
- decorations.put(priority, dec);
- }
- }
- if (decorations.size() > 0) {
- ILookAndFeelDecorations dec = decorations.get(decorations.lastKey());
- if (dec.getMandatoryFieldBackgroundColor() != null) {
- uiDecoration.setMandatoryFieldBackgroundColor(dec.getMandatoryFieldBackgroundColor());
- }
- if (dec.getMandatoryLabelFont() != null) {
- uiDecoration.setMandatoryLabelFont(dec.getMandatoryLabelFont());
- }
- if (dec.getMandatoryLabelTextColor() != null) {
- uiDecoration.setMandatoryLabelTextColor(dec.getMandatoryLabelTextColor());
- }
- if (dec.getStarMarkerPosition() != ILookAndFeelDecorations.STAR_MARKER_NONE) {
- uiDecoration.setMandatoryStarMarkerPosition(dec.getStarMarkerPosition());
- }
- }
- }
-
- private static boolean isPropsAlreadLoaded(TreeMap<Integer, ILookAndFeelProperties> properties, Integer priority, String deviceTypeIdentifier) {
- ILookAndFeelProperties alreadyLoadedProps = properties.get(priority);
- if (alreadyLoadedProps == null) {
- return false;
- }
- if (deviceTypeIdentifier != null && alreadyLoadedProps.getDeviceTypeIdentifier().equalsIgnoreCase(deviceTypeIdentifier)) {
- return true;
- }
-
- return true;
- }
-
- private static boolean isDecosAlreadLoaded(TreeMap<Integer, ILookAndFeelDecorations> docorations, Integer priority, String deviceTypeIdentifier) {
- ILookAndFeelDecorations alreadyLoadedDecos = docorations.get(priority);
- if (alreadyLoadedDecos == null) {
- return false;
- }
- if (deviceTypeIdentifier != null && alreadyLoadedDecos.getDeviceTypeIdentifier().equalsIgnoreCase(deviceTypeIdentifier)) {
- return true;
- }
-
- return true;
- }
-
- private static boolean matchesDeviceType(IUiDeviceType uiDeviceType, String deviceTypeIdentifier) {
- if (deviceTypeIdentifier == null) {
- return true;
- }
-
- if (uiDeviceType.getIdentifier().equalsIgnoreCase(deviceTypeIdentifier)) {
- return true;
- }
-
- if (deviceTypeIdentifier.equalsIgnoreCase(ATTR_DEVICE_TYPE_KEYWORD_TOUCH) && uiDeviceType.isTouchDevice()) {
- return true;
- }
-
- return false;
- }
-
- /**
- * Computes the priority in which the properties and decorations should be considered.<br>
- * A greater value means higher priority and overrides values with lower priority.
- * <p>
- * Basically the scope is used as priority. If a deviceTypeIdentifier is specified it gets a little higher priority
- * than scope which makes it possible to define default values for each device type. <br>
- * If the deviceTypeIdentifier is not a concrete device type but covers more than one device types, it gets lower
- * priority than a concrete device type.
- */
- private static int computePriority(int scope, String deviceTypeIdentifier) {
- if (!StringUtility.hasText(deviceTypeIdentifier)) {
- return scope;
- }
-
- if (isCombinedDeviceTypeIdentifier(deviceTypeIdentifier)) {
- return scope + 1;
- }
-
- return scope + 2;
- }
-
- private static boolean isCombinedDeviceTypeIdentifier(String deviceTypeIdentifier) {
- if (deviceTypeIdentifier == null) {
- return false;
- }
-
- return deviceTypeIdentifier.equalsIgnoreCase(ATTR_DEVICE_TYPE_KEYWORD_TOUCH);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.extension;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.shared.data.basic.FontSpec;
+import org.eclipse.scout.rt.shared.ui.IUiDeviceType;
+import org.eclipse.scout.rt.ui.rap.Activator;
+import org.eclipse.scout.rt.ui.rap.extension.internal.LookAndFeelDecorations;
+import org.eclipse.scout.rt.ui.rap.extension.internal.LookAndFeelProperties;
+import org.eclipse.scout.rt.ui.rap.extension.internal.UiDecoration;
+import org.eclipse.scout.rt.ui.rap.util.DeviceUtility;
+import org.eclipse.swt.SWT;
+
+public final class UiDecorationExtensionPoint {
+ private static IScoutLogger LOG = ScoutLogManager.getLogger(UiDecorationExtensionPoint.class);
+ private static Map<IUiDeviceType, IUiDecoration> LOOK_AND_FEEL_MAP = new HashMap<IUiDeviceType, IUiDecoration>();
+
+ public static final int SCOPE_DEFAULT = 1;
+ public static final int SCOPE_GLOBAL = 100;
+ private static final String ATTR_SCOPE = "scope";
+ private static final String ATTR_DEVICE_TYPE = "deviceType";
+ private static final String ATTR_DEVICE_TYPE_KEYWORD_TOUCH = "touch";
+
+ private UiDecorationExtensionPoint() {
+ }
+
+ public static synchronized IUiDecoration getLookAndFeel() {
+ IUiDeviceType currentDeviceType = DeviceUtility.getCurrentDeviceType();
+ if (!LOOK_AND_FEEL_MAP.containsKey(currentDeviceType)) {
+ IUiDecoration uiDecoration = loadUiDecoration(currentDeviceType);
+ LOOK_AND_FEEL_MAP.put(currentDeviceType, uiDecoration);
+ }
+
+ return LOOK_AND_FEEL_MAP.get(currentDeviceType);
+ }
+
+ private static ILookAndFeelDecorations parseDecorations(IConfigurationElement decorationsElement) {
+ LookAndFeelDecorations decorations = new LookAndFeelDecorations();
+ decorations.setScope(getScopePriority(decorationsElement.getAttribute(ATTR_SCOPE)));
+ decorations.setDeviceTypeIdentifier(decorationsElement.getAttribute(ATTR_DEVICE_TYPE));
+
+ IConfigurationElement[] mandatoryElement = decorationsElement.getChildren("mandatory");
+ if (mandatoryElement.length > 0) {
+ // only 1 mandatory extension
+ // background
+ IConfigurationElement[] fieldBackground = mandatoryElement[0].getChildren("fieldBackground");
+ if (fieldBackground.length > 0) {
+ decorations.setMandatoryFieldBackgroundColor(fieldBackground[0].getAttribute("color"));
+ }
+ // label text color
+ IConfigurationElement[] labelTextColor = mandatoryElement[0].getChildren("labelTextColor");
+ if (labelTextColor.length > 0) {
+ decorations.setMandatoryLabelTextColor(labelTextColor[0].getAttribute("color"));
+ }
+ // label Font
+ IConfigurationElement[] labelFont = mandatoryElement[0].getChildren("labelFont");
+ if (labelFont.length > 0) {
+ FontSpec spec = FontSpec.parse(labelFont[0].getAttribute("font"));
+ decorations.setMandatoryLabelFont(spec);
+ }
+ // star marker
+ IConfigurationElement[] starMarker = mandatoryElement[0].getChildren("starMarker");
+ if (starMarker.length > 0) {
+ decorations.setStarMarkerPosition(parseStarMarkerPosition(starMarker[0].getAttribute("placement")));
+ }
+ }
+ return decorations;
+ }
+
+ private static ILookAndFeelProperties parseProperties(IConfigurationElement propertiesElement) {
+ LookAndFeelProperties props = new LookAndFeelProperties();
+ props.setScope(getScopePriority(propertiesElement.getAttribute(ATTR_SCOPE)));
+ props.setDeviceTypeIdentifier(propertiesElement.getAttribute(ATTR_DEVICE_TYPE));
+
+ IConfigurationElement[] properties = propertiesElement.getChildren("property");
+ for (IConfigurationElement prop : properties) {
+ String propName = null, propValue = null;
+ propName = prop.getAttribute("name");
+ propValue = prop.getAttribute("value");
+ props.setProperty(propName, propValue);
+ props.setContributor(propertiesElement.getContributor().getName());
+ }
+ return props;
+ }
+
+ private static int getScopePriority(String scope) {
+ int prio = SCOPE_DEFAULT;
+ if (StringUtility.isNullOrEmpty(scope) || scope.equalsIgnoreCase("default")) {
+ prio = SCOPE_DEFAULT;
+ }
+ else if (scope.equalsIgnoreCase("global")) {
+ prio = SCOPE_GLOBAL;
+ }
+ return prio;
+ }
+
+ private static int parseStarMarkerPosition(String value) {
+ int pos = ILookAndFeelDecorations.STAR_MARKER_NONE;
+ if (StringUtility.isNullOrEmpty(value) || value.equalsIgnoreCase("afterLabel")) {
+ pos = ILookAndFeelDecorations.STAR_MARKER_AFTER_LABEL;
+ }
+ else if (value.equalsIgnoreCase("beforeLabel")) {
+ pos = ILookAndFeelDecorations.STAR_MARKER_BEFORE_LABEL;
+ }
+ return pos;
+ }
+
+ private static IUiDecoration loadUiDecoration(IUiDeviceType deviceType) {
+
+ ArrayList<ILookAndFeelProperties> propertyExtensions = new ArrayList<ILookAndFeelProperties>();
+ ArrayList<ILookAndFeelDecorations> decorationExtensions = new ArrayList<ILookAndFeelDecorations>();
+
+ IExtensionRegistry reg = Platform.getExtensionRegistry();
+ IExtensionPoint xp = reg.getExtensionPoint(Activator.PLUGIN_ID, "lookAndFeel");
+ IExtension[] extensions = xp.getExtensions();
+
+ for (IExtension extension : extensions) {
+ IConfigurationElement[] elements = extension.getConfigurationElements();
+ for (IConfigurationElement element : elements) {
+ if ("properties".equals(element.getName())) {
+ propertyExtensions.add(parseProperties(element));
+ }
+ else if ("decorations".equals(element.getName())) {
+ decorationExtensions.add(parseDecorations(element));
+ }
+ }
+ }
+
+ UiDecoration uiDecoration = new UiDecoration();
+ loadDecorations(uiDecoration, decorationExtensions, deviceType);
+ loadProperties(uiDecoration, propertyExtensions, deviceType);
+
+ return uiDecoration;
+ }
+
+ private static void loadProperties(UiDecoration uiDecoration, ArrayList<ILookAndFeelProperties> propertyExtensions, IUiDeviceType deviceType) {
+ TreeMap<Integer, ILookAndFeelProperties> properties = new TreeMap<Integer, ILookAndFeelProperties>();
+ for (ILookAndFeelProperties props : propertyExtensions) {
+ int scope = props.getScope();
+ String deviceTypeIdentifier = props.getDeviceTypeIdentifier();
+ int priority = computePriority(scope, deviceTypeIdentifier);
+
+ if (isPropsAlreadLoaded(properties, priority, deviceTypeIdentifier)) {
+ LOG.warn("Multiple look and feel properties found with scope '" + scope + "' and deviceType '" + deviceTypeIdentifier + "'");
+ }
+ else if (matchesDeviceType(deviceType, deviceTypeIdentifier)) {
+ properties.put(priority, props);
+ }
+ }
+
+ for (ILookAndFeelProperties props : properties.values()) {
+ if (props.getPropertyInt(ILookAndFeelProperties.PROP_DIALOG_MIN_HEIGHT) != 0) {
+ uiDecoration.setDialogMinHeight(props.getPropertyInt(ILookAndFeelProperties.PROP_DIALOG_MIN_HEIGHT));
+ }
+ if (props.getPropertyInt(ILookAndFeelProperties.PROP_DIALOG_MIN_WIDTH) != 0) {
+ uiDecoration.setDialogMinWidth(props.getPropertyInt(ILookAndFeelProperties.PROP_DIALOG_MIN_WIDTH));
+ }
+ if (props.existsProperty(ILookAndFeelProperties.PROP_FORM_MAINBOX_BORDER_VISIBLE)) {
+ uiDecoration.setFormMainBoxBorderVisible(props.getPropertyBool(ILookAndFeelProperties.PROP_FORM_MAINBOX_BORDER_VISIBLE));
+ }
+ if (props.getPropertyInt(ILookAndFeelProperties.PROP_FORM_FIELD_LABEL_WIDTH) != 0) {
+ uiDecoration.setFormFieldLabelWidth(props.getPropertyInt(ILookAndFeelProperties.PROP_FORM_FIELD_LABEL_WIDTH));
+ }
+ if (props.getPropertyString(ILookAndFeelProperties.PROP_FORM_FIELD_LABEL_ALIGNMENT) != null) {
+ String extFormFieldAlignment = props.getPropertyString(ILookAndFeelProperties.PROP_FORM_FIELD_LABEL_ALIGNMENT);
+ if ("center".equalsIgnoreCase(extFormFieldAlignment)) {
+ uiDecoration.setFormFieldLabelAlignment(SWT.CENTER);
+ }
+ else if ("left".equalsIgnoreCase(extFormFieldAlignment)) {
+ uiDecoration.setFormFieldLabelAlignment(SWT.LEFT);
+ }
+ else if ("right".equalsIgnoreCase(extFormFieldAlignment)) {
+ uiDecoration.setFormFieldLabelAlignment(SWT.RIGHT);
+ }
+ else {
+ LOG.warn("the value '" + extFormFieldAlignment + "' is not valid for the property '" + ILookAndFeelProperties.PROP_FORM_FIELD_LABEL_ALIGNMENT + "'. Expected values are[right,left,center]");
+ }
+ }
+ if (props.getPropertyInt(ILookAndFeelProperties.PROP_LOGICAL_GRID_LAYOUT_DEFAULT_COLUMN_WIDTH) != 0) {
+ uiDecoration.setLogicalGridLayoutDefaultColumnWidth(props.getPropertyInt(ILookAndFeelProperties.PROP_LOGICAL_GRID_LAYOUT_DEFAULT_COLUMN_WIDTH));
+ }
+ if (props.getPropertyInt(ILookAndFeelProperties.PROP_LOGICAL_GRID_LAYOUT_DEFAULT_POPUP_WIDTH) != 0) {
+ uiDecoration.setLogicalGridLayoutDefaultPopupWidth(props.getPropertyInt(ILookAndFeelProperties.PROP_LOGICAL_GRID_LAYOUT_DEFAULT_POPUP_WIDTH));
+ }
+ if (props.getPropertyInt(ILookAndFeelProperties.PROP_LOGICAL_GRID_LAYOUT_HORIZONTAL_GAP) != 0) {
+ uiDecoration.setLogicalGridLayoutHorizontalGap(props.getPropertyInt(ILookAndFeelProperties.PROP_LOGICAL_GRID_LAYOUT_HORIZONTAL_GAP));
+ }
+ if (props.getPropertyInt(ILookAndFeelProperties.PROP_LOGICAL_GRID_LAYOUT_ROW_HEIGHT) != 0) {
+ uiDecoration.setLogicalGridLayoutRowHeight(props.getPropertyInt(ILookAndFeelProperties.PROP_LOGICAL_GRID_LAYOUT_ROW_HEIGHT));
+ }
+ if (props.getPropertyInt(ILookAndFeelProperties.PROP_LOGICAL_GRID_LAYOUT_VERTICAL_GAP) != 0) {
+ uiDecoration.setLogicalGridLayoutVerticalGap(props.getPropertyInt(ILookAndFeelProperties.PROP_LOGICAL_GRID_LAYOUT_VERTICAL_GAP));
+ }
+ if (props.getPropertyInt(ILookAndFeelProperties.PROP_PROCESS_BUTTON_HEIGHT) != 0) {
+ uiDecoration.setProcessButtonHeight(props.getPropertyInt(ILookAndFeelProperties.PROP_PROCESS_BUTTON_HEIGHT));
+ }
+ if (props.getPropertyInt(ILookAndFeelProperties.PROP_PROCESS_BUTTON_MAX_WIDTH) != 0) {
+ uiDecoration.setProcessButtonMaxWidth(props.getPropertyInt(ILookAndFeelProperties.PROP_PROCESS_BUTTON_MAX_WIDTH));
+ }
+ if (props.getPropertyInt(ILookAndFeelProperties.PROP_PROCESS_BUTTON_MIN_WIDTH) != 0) {
+ uiDecoration.setProcessButtonMinWidth(props.getPropertyInt(ILookAndFeelProperties.PROP_PROCESS_BUTTON_MIN_WIDTH));
+ }
+ if (props.getPropertyString(ILookAndFeelProperties.PROP_COLOR_FOREGROUND_DISABLED) != null) {
+ uiDecoration.setColorForegroundDisabled(props.getPropertyString(ILookAndFeelProperties.PROP_COLOR_FOREGROUND_DISABLED));
+ }
+ if (props.getPropertyString(ILookAndFeelProperties.PROP_MESSAGE_BOX_MIN_WIDTH) != null) {
+ uiDecoration.setMessageBoxMinWidth(props.getPropertyInt(ILookAndFeelProperties.PROP_MESSAGE_BOX_MIN_WIDTH));
+ }
+ if (props.getPropertyString(ILookAndFeelProperties.PROP_MESSAGE_BOX_MIN_HEIGHT) != null) {
+ uiDecoration.setMessageBoxMinHeight(props.getPropertyInt(ILookAndFeelProperties.PROP_MESSAGE_BOX_MIN_HEIGHT));
+ }
+ if (props.getPropertyString(ILookAndFeelProperties.PROP_FORM_FIELD_SELECT_ALL_ON_FOCUS_ENABLED) != null) {
+ uiDecoration.setFormFieldSelectAllOnFocusEnabled(props.getPropertyBool(ILookAndFeelProperties.PROP_FORM_FIELD_SELECT_ALL_ON_FOCUS_ENABLED));
+ }
+ if (props.getPropertyString(ILookAndFeelProperties.PROP_DND_SUPPORT_ENABLED) != null) {
+ uiDecoration.setDndSupportEnabled(props.getPropertyBool(ILookAndFeelProperties.PROP_DND_SUPPORT_ENABLED));
+ }
+ if (props.getPropertyString(ILookAndFeelProperties.PROP_BROWSER_HISTORY_ENABLED) != null) {
+ uiDecoration.setBrowserHistoryEnabled(props.getPropertyBool(ILookAndFeelProperties.PROP_BROWSER_HISTORY_ENABLED));
+ }
+ if (props.getPropertyString(ILookAndFeelProperties.PROP_TABLE_ROW_HEIGHT) != null) {
+ uiDecoration.setTableRowHeight(props.getPropertyInt(ILookAndFeelProperties.PROP_TABLE_ROW_HEIGHT));
+ }
+ if (props.getPropertyString(ILookAndFeelProperties.PROP_TREE_NODE_HEIGHT) != null) {
+ uiDecoration.setTreeNodeHeight(props.getPropertyInt(ILookAndFeelProperties.PROP_TREE_NODE_HEIGHT));
+ }
+
+ }
+ }
+
+ private static void loadDecorations(UiDecoration uiDecoration, ArrayList<ILookAndFeelDecorations> decorationExtensions, IUiDeviceType deviceType) {
+ TreeMap<Integer, ILookAndFeelDecorations> decorations = new TreeMap<Integer, ILookAndFeelDecorations>();
+ for (ILookAndFeelDecorations dec : decorationExtensions) {
+ int scope = dec.getScope();
+ String deviceTypeIdentifier = dec.getDeviceTypeIdentifier();
+ int priority = computePriority(scope, deviceTypeIdentifier);
+
+ if (isDecosAlreadLoaded(decorations, priority, deviceTypeIdentifier)) {
+ LOG.warn("Multiple look and feel decorations found with scope '" + scope + "' and deviceType '" + deviceTypeIdentifier + "'.");
+ }
+ else if (matchesDeviceType(deviceType, deviceTypeIdentifier)) {
+ decorations.put(priority, dec);
+ }
+ }
+ if (decorations.size() > 0) {
+ ILookAndFeelDecorations dec = decorations.get(decorations.lastKey());
+ if (dec.getMandatoryFieldBackgroundColor() != null) {
+ uiDecoration.setMandatoryFieldBackgroundColor(dec.getMandatoryFieldBackgroundColor());
+ }
+ if (dec.getMandatoryLabelFont() != null) {
+ uiDecoration.setMandatoryLabelFont(dec.getMandatoryLabelFont());
+ }
+ if (dec.getMandatoryLabelTextColor() != null) {
+ uiDecoration.setMandatoryLabelTextColor(dec.getMandatoryLabelTextColor());
+ }
+ if (dec.getStarMarkerPosition() != ILookAndFeelDecorations.STAR_MARKER_NONE) {
+ uiDecoration.setMandatoryStarMarkerPosition(dec.getStarMarkerPosition());
+ }
+ }
+ }
+
+ private static boolean isPropsAlreadLoaded(TreeMap<Integer, ILookAndFeelProperties> properties, Integer priority, String deviceTypeIdentifier) {
+ ILookAndFeelProperties alreadyLoadedProps = properties.get(priority);
+ if (alreadyLoadedProps == null) {
+ return false;
+ }
+ if (deviceTypeIdentifier != null && alreadyLoadedProps.getDeviceTypeIdentifier().equalsIgnoreCase(deviceTypeIdentifier)) {
+ return true;
+ }
+
+ return true;
+ }
+
+ private static boolean isDecosAlreadLoaded(TreeMap<Integer, ILookAndFeelDecorations> docorations, Integer priority, String deviceTypeIdentifier) {
+ ILookAndFeelDecorations alreadyLoadedDecos = docorations.get(priority);
+ if (alreadyLoadedDecos == null) {
+ return false;
+ }
+ if (deviceTypeIdentifier != null && alreadyLoadedDecos.getDeviceTypeIdentifier().equalsIgnoreCase(deviceTypeIdentifier)) {
+ return true;
+ }
+
+ return true;
+ }
+
+ private static boolean matchesDeviceType(IUiDeviceType uiDeviceType, String deviceTypeIdentifier) {
+ if (deviceTypeIdentifier == null) {
+ return true;
+ }
+
+ if (uiDeviceType.getIdentifier().equalsIgnoreCase(deviceTypeIdentifier)) {
+ return true;
+ }
+
+ if (deviceTypeIdentifier.equalsIgnoreCase(ATTR_DEVICE_TYPE_KEYWORD_TOUCH) && uiDeviceType.isTouchDevice()) {
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Computes the priority in which the properties and decorations should be considered.<br>
+ * A greater value means higher priority and overrides values with lower priority.
+ * <p>
+ * Basically the scope is used as priority. If a deviceTypeIdentifier is specified it gets a little higher priority
+ * than scope which makes it possible to define default values for each device type. <br>
+ * If the deviceTypeIdentifier is not a concrete device type but covers more than one device types, it gets lower
+ * priority than a concrete device type.
+ */
+ private static int computePriority(int scope, String deviceTypeIdentifier) {
+ if (!StringUtility.hasText(deviceTypeIdentifier)) {
+ return scope;
+ }
+
+ if (isCombinedDeviceTypeIdentifier(deviceTypeIdentifier)) {
+ return scope + 1;
+ }
+
+ return scope + 2;
+ }
+
+ private static boolean isCombinedDeviceTypeIdentifier(String deviceTypeIdentifier) {
+ if (deviceTypeIdentifier == null) {
+ return false;
+ }
+
+ return deviceTypeIdentifier.equalsIgnoreCase(ATTR_DEVICE_TYPE_KEYWORD_TOUCH);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/extension/internal/FormFieldExtension.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/extension/internal/FormFieldExtension.java
index 38dc907f88..a299e251de 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/extension/internal/FormFieldExtension.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/extension/internal/FormFieldExtension.java
@@ -1,92 +1,92 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.extension.internal;
-
-import org.eclipse.scout.rt.ui.rap.extension.IFormFieldExtension;
-
-public class FormFieldExtension implements IFormFieldExtension {
-
- private String m_name;
- private boolean m_active;
- private int m_scope = SCOPE_DEFAULT;
- private String /* fully qualified name of a Class<? extends IFormField> */m_modelClassName;
- private String /* fully qualified name of a Class<? extends IRwtScoutFormField> */m_uiClassName;
- private String /* fully qualified name of a Class<? extends IFormFieldFactory> */m_factoryClassName;
- private String m_contibuterBundleId;
-
- public FormFieldExtension(String name) {
- m_name = name;
- }
-
- @Override
- public String getContibuterBundleId() {
- return m_contibuterBundleId;
- }
-
- public void setContibuterBundleId(String contibuterBundleId) {
- m_contibuterBundleId = contibuterBundleId;
- }
-
- @Override
- public String getName() {
- return m_name;
- }
-
- public void setName(String name) {
- m_name = name;
- }
-
- @Override
- public boolean isActive() {
- return m_active;
- }
-
- public void setActive(boolean active) {
- m_active = active;
- }
-
- @Override
- public int getScope() {
- return m_scope;
- }
-
- public void setScope(int scope) {
- m_scope = scope;
- }
-
- @Override
- public String getModelClassName() {
- return m_modelClassName;
- }
-
- public void setModelClassName(String modelClassName) {
- m_modelClassName = modelClassName;
- }
-
- @Override
- public String getUiClassName() {
- return m_uiClassName;
- }
-
- public void setUiClassName(String uiClassName) {
- m_uiClassName = uiClassName;
- }
-
- @Override
- public String getFactoryClassName() {
- return m_factoryClassName;
- }
-
- public void setFactoryClassName(String factoryClassName) {
- m_factoryClassName = factoryClassName;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.extension.internal;
+
+import org.eclipse.scout.rt.ui.rap.extension.IFormFieldExtension;
+
+public class FormFieldExtension implements IFormFieldExtension {
+
+ private String m_name;
+ private boolean m_active;
+ private int m_scope = SCOPE_DEFAULT;
+ private String /* fully qualified name of a Class<? extends IFormField> */m_modelClassName;
+ private String /* fully qualified name of a Class<? extends IRwtScoutFormField> */m_uiClassName;
+ private String /* fully qualified name of a Class<? extends IFormFieldFactory> */m_factoryClassName;
+ private String m_contibuterBundleId;
+
+ public FormFieldExtension(String name) {
+ m_name = name;
+ }
+
+ @Override
+ public String getContibuterBundleId() {
+ return m_contibuterBundleId;
+ }
+
+ public void setContibuterBundleId(String contibuterBundleId) {
+ m_contibuterBundleId = contibuterBundleId;
+ }
+
+ @Override
+ public String getName() {
+ return m_name;
+ }
+
+ public void setName(String name) {
+ m_name = name;
+ }
+
+ @Override
+ public boolean isActive() {
+ return m_active;
+ }
+
+ public void setActive(boolean active) {
+ m_active = active;
+ }
+
+ @Override
+ public int getScope() {
+ return m_scope;
+ }
+
+ public void setScope(int scope) {
+ m_scope = scope;
+ }
+
+ @Override
+ public String getModelClassName() {
+ return m_modelClassName;
+ }
+
+ public void setModelClassName(String modelClassName) {
+ m_modelClassName = modelClassName;
+ }
+
+ @Override
+ public String getUiClassName() {
+ return m_uiClassName;
+ }
+
+ public void setUiClassName(String uiClassName) {
+ m_uiClassName = uiClassName;
+ }
+
+ @Override
+ public String getFactoryClassName() {
+ return m_factoryClassName;
+ }
+
+ public void setFactoryClassName(String factoryClassName) {
+ m_factoryClassName = factoryClassName;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/extension/internal/LookAndFeelDecorations.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/extension/internal/LookAndFeelDecorations.java
index a942689f93..9c15d8a877 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/extension/internal/LookAndFeelDecorations.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/extension/internal/LookAndFeelDecorations.java
@@ -1,77 +1,77 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.extension.internal;
-
-import org.eclipse.scout.rt.shared.data.basic.FontSpec;
-import org.eclipse.scout.rt.ui.rap.extension.ILookAndFeelDecorations;
-
-public class LookAndFeelDecorations implements ILookAndFeelDecorations {
- private int m_scope;
- private int m_starMarkerPosition = STAR_MARKER_NONE;
- private FontSpec m_mandatoryLabelFont;
- private String m_mandatoryFieldBackgroundColor;
- private String m_mandatoryLabelTextColor;
- private String m_deviceTypeIdentifier;
-
- @Override
- public int getScope() {
- return m_scope;
- }
-
- public void setScope(int scope) {
- m_scope = scope;
- }
-
- @Override
- public String getDeviceTypeIdentifier() {
- return m_deviceTypeIdentifier;
- }
-
- public void setDeviceTypeIdentifier(String deviceTypeIdentifier) {
- m_deviceTypeIdentifier = deviceTypeIdentifier;
- }
-
- @Override
- public int getStarMarkerPosition() {
- return m_starMarkerPosition;
- }
-
- public void setStarMarkerPosition(int starMarkerPosition) {
- m_starMarkerPosition = starMarkerPosition;
- }
-
- @Override
- public FontSpec getMandatoryLabelFont() {
- return m_mandatoryLabelFont;
- }
-
- public void setMandatoryLabelFont(FontSpec mandatoryLabelFont) {
- m_mandatoryLabelFont = mandatoryLabelFont;
- }
-
- @Override
- public String getMandatoryFieldBackgroundColor() {
- return m_mandatoryFieldBackgroundColor;
- }
-
- public void setMandatoryFieldBackgroundColor(String mandatoryFieldBackgroundColor) {
- m_mandatoryFieldBackgroundColor = mandatoryFieldBackgroundColor;
- }
-
- @Override
- public String getMandatoryLabelTextColor() {
- return m_mandatoryLabelTextColor;
- }
-
- public void setMandatoryLabelTextColor(String mandatoryLabelTextColor) {
- m_mandatoryLabelTextColor = mandatoryLabelTextColor;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.extension.internal;
+
+import org.eclipse.scout.rt.shared.data.basic.FontSpec;
+import org.eclipse.scout.rt.ui.rap.extension.ILookAndFeelDecorations;
+
+public class LookAndFeelDecorations implements ILookAndFeelDecorations {
+ private int m_scope;
+ private int m_starMarkerPosition = STAR_MARKER_NONE;
+ private FontSpec m_mandatoryLabelFont;
+ private String m_mandatoryFieldBackgroundColor;
+ private String m_mandatoryLabelTextColor;
+ private String m_deviceTypeIdentifier;
+
+ @Override
+ public int getScope() {
+ return m_scope;
+ }
+
+ public void setScope(int scope) {
+ m_scope = scope;
+ }
+
+ @Override
+ public String getDeviceTypeIdentifier() {
+ return m_deviceTypeIdentifier;
+ }
+
+ public void setDeviceTypeIdentifier(String deviceTypeIdentifier) {
+ m_deviceTypeIdentifier = deviceTypeIdentifier;
+ }
+
+ @Override
+ public int getStarMarkerPosition() {
+ return m_starMarkerPosition;
+ }
+
+ public void setStarMarkerPosition(int starMarkerPosition) {
+ m_starMarkerPosition = starMarkerPosition;
+ }
+
+ @Override
+ public FontSpec getMandatoryLabelFont() {
+ return m_mandatoryLabelFont;
+ }
+
+ public void setMandatoryLabelFont(FontSpec mandatoryLabelFont) {
+ m_mandatoryLabelFont = mandatoryLabelFont;
+ }
+
+ @Override
+ public String getMandatoryFieldBackgroundColor() {
+ return m_mandatoryFieldBackgroundColor;
+ }
+
+ public void setMandatoryFieldBackgroundColor(String mandatoryFieldBackgroundColor) {
+ m_mandatoryFieldBackgroundColor = mandatoryFieldBackgroundColor;
+ }
+
+ @Override
+ public String getMandatoryLabelTextColor() {
+ return m_mandatoryLabelTextColor;
+ }
+
+ public void setMandatoryLabelTextColor(String mandatoryLabelTextColor) {
+ m_mandatoryLabelTextColor = mandatoryLabelTextColor;
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/extension/internal/LookAndFeelProperties.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/extension/internal/LookAndFeelProperties.java
index c3a5429e59..9c104549f0 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/extension/internal/LookAndFeelProperties.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/extension/internal/LookAndFeelProperties.java
@@ -1,97 +1,97 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.extension.internal;
-
-import java.util.HashMap;
-
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.ui.rap.extension.ILookAndFeelProperties;
-
-public class LookAndFeelProperties implements ILookAndFeelProperties {
- private static IScoutLogger LOG = ScoutLogManager.getLogger(LookAndFeelProperties.class);
-
- private String m_contributor;
- private int m_scope;
- private String m_deviceTypeIdentifier;
- private HashMap<String, String> m_values = new HashMap<String, String>();
-
- @Override
- public int getScope() {
- return m_scope;
- }
-
- public void setScope(int scope) {
- m_scope = scope;
- }
-
- @Override
- public String getDeviceTypeIdentifier() {
- return m_deviceTypeIdentifier;
- }
-
- public void setDeviceTypeIdentifier(String deviceTypeIdentifier) {
- m_deviceTypeIdentifier = deviceTypeIdentifier;
- }
-
- @Override
- public int getPropertyInt(String name) {
- String value = m_values.get(name);
- if (value == null) {
- return 0;
- }
-
- try {
- return Integer.parseInt(value);
- }
- catch (NumberFormatException e) {
- LOG.error("Could not parse extension look and feel of contributor '" + m_contributor + "' property name='" + name + "' value='" + value + "'");
- return 0;
- }
- }
-
- public void setPropertyString(String name, String value) {
- m_values.put(name, value);
- }
-
- public void setContributor(String contributor) {
- m_contributor = contributor;
- }
-
- public String getContributor() {
- return m_contributor;
- }
-
- @Override
- public boolean getPropertyBool(String name) {
- String value = m_values.get(name);
- if (value == null) {
- return false;
- }
-
- return Boolean.parseBoolean(value);
- }
-
- @Override
- public boolean existsProperty(String name) {
- return m_values.containsKey(name);
- }
-
- public void setProperty(String name, String value) {
- m_values.put(name, value);
- }
-
- @Override
- public String getPropertyString(String name) {
- return m_values.get(name);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.extension.internal;
+
+import java.util.HashMap;
+
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.ui.rap.extension.ILookAndFeelProperties;
+
+public class LookAndFeelProperties implements ILookAndFeelProperties {
+ private static IScoutLogger LOG = ScoutLogManager.getLogger(LookAndFeelProperties.class);
+
+ private String m_contributor;
+ private int m_scope;
+ private String m_deviceTypeIdentifier;
+ private HashMap<String, String> m_values = new HashMap<String, String>();
+
+ @Override
+ public int getScope() {
+ return m_scope;
+ }
+
+ public void setScope(int scope) {
+ m_scope = scope;
+ }
+
+ @Override
+ public String getDeviceTypeIdentifier() {
+ return m_deviceTypeIdentifier;
+ }
+
+ public void setDeviceTypeIdentifier(String deviceTypeIdentifier) {
+ m_deviceTypeIdentifier = deviceTypeIdentifier;
+ }
+
+ @Override
+ public int getPropertyInt(String name) {
+ String value = m_values.get(name);
+ if (value == null) {
+ return 0;
+ }
+
+ try {
+ return Integer.parseInt(value);
+ }
+ catch (NumberFormatException e) {
+ LOG.error("Could not parse extension look and feel of contributor '" + m_contributor + "' property name='" + name + "' value='" + value + "'");
+ return 0;
+ }
+ }
+
+ public void setPropertyString(String name, String value) {
+ m_values.put(name, value);
+ }
+
+ public void setContributor(String contributor) {
+ m_contributor = contributor;
+ }
+
+ public String getContributor() {
+ return m_contributor;
+ }
+
+ @Override
+ public boolean getPropertyBool(String name) {
+ String value = m_values.get(name);
+ if (value == null) {
+ return false;
+ }
+
+ return Boolean.parseBoolean(value);
+ }
+
+ @Override
+ public boolean existsProperty(String name) {
+ return m_values.containsKey(name);
+ }
+
+ public void setProperty(String name, String value) {
+ m_values.put(name, value);
+ }
+
+ @Override
+ public String getPropertyString(String name) {
+ return m_values.get(name);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/extension/internal/UiDecoration.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/extension/internal/UiDecoration.java
index 6a97766e4f..6e8d9cc78e 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/extension/internal/UiDecoration.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/extension/internal/UiDecoration.java
@@ -1,291 +1,291 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.extension.internal;
-
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.shared.data.basic.FontSpec;
-import org.eclipse.scout.rt.ui.rap.extension.IUiDecoration;
-import org.eclipse.swt.SWT;
-
-public class UiDecoration implements IUiDecoration {
- private static IScoutLogger LOG = ScoutLogManager.getLogger(UiDecoration.class);
-
- private String m_mandatoryFieldBackgroundColor;
- private int m_mandatoryStarMarkerPosition;
- private String m_mandatoryLabelTextColor;
- private FontSpec m_mandatoryLabelFont;
- private int m_dialogMinWidth;
- private int m_dialogMinHeight;
- private boolean m_formMainBoxBorderVisible = false;
- private int m_formFieldLabelWidth;
- private boolean m_formFieldSelectAllOnFocusEnabled;
- private int m_logicalGridLayoutDefaultColumnWidth;
- private int m_logicalGridLayoutDefaultPopupWidth;
- private int m_logicalGridLayoutHorizontalGap;
- private int m_logicalGridLayoutVerticalGap;
- private int m_logicalGridLayoutRowHeight;
- private int m_processButtonHeight;
- private int m_processButtonMinWidth;
- private int m_processButtonMaxWidth;
- private String m_colorForegroundDisabled;
- private int m_messageBoxMinWidth = 400;
- private int m_messageBoxMinHeight = 100;
- private int m_toolFormMinWidth = 330;
- private boolean m_dndSupportEnabled;
- private boolean m_browserHistoryEnabled;
- private int m_tableRowHeight = -1;
- private int m_treeNodeHeight = -1;
-
- /**
- * one of SWT.RIGHT SWT.LEFT SWT.CENTER
- */
- private int m_formFieldLabelAlignment = SWT.RIGHT;
-
- @Override
- public int getDialogMinWidth() {
- return m_dialogMinWidth;
- }
-
- public void setDialogMinWidth(int dialogMinWidth) {
- m_dialogMinWidth = dialogMinWidth;
- }
-
- @Override
- public int getDialogMinHeight() {
- return m_dialogMinHeight;
- }
-
- public void setDialogMinHeight(int dialogMinHeight) {
- m_dialogMinHeight = dialogMinHeight;
- }
-
- @Override
- public int getProcessButtonHeight() {
- return m_processButtonHeight;
- }
-
- public void setProcessButtonHeight(int processButtonHeight) {
- m_processButtonHeight = processButtonHeight;
- }
-
- @Override
- public int getProcessButtonMinWidth() {
- return m_processButtonMinWidth;
- }
-
- public void setProcessButtonMinWidth(int processButtonMinWidth) {
- m_processButtonMinWidth = processButtonMinWidth;
- }
-
- @Override
- public int getProcessButtonMaxWidth() {
- return m_processButtonMaxWidth;
- }
-
- public void setProcessButtonMaxWidth(int processButtonMaxWidth) {
- m_processButtonMaxWidth = processButtonMaxWidth;
- }
-
- @Override
- public boolean isFormMainBoxBorderVisible() {
- return m_formMainBoxBorderVisible;
- }
-
- /**
- * @param formMainBoxBorderVisible
- * the formMainBoxBorderVisible to set
- */
- public void setFormMainBoxBorderVisible(boolean formMainBoxBorderVisible) {
- m_formMainBoxBorderVisible = formMainBoxBorderVisible;
- }
-
- @Override
- public String getMandatoryFieldBackgroundColor() {
- return m_mandatoryFieldBackgroundColor;
- }
-
- public void setMandatoryFieldBackgroundColor(String mandatoryFieldBackgroundColor) {
- m_mandatoryFieldBackgroundColor = mandatoryFieldBackgroundColor;
- }
-
- @Override
- public int getMandatoryStarMarkerPosition() {
- return m_mandatoryStarMarkerPosition;
- }
-
- public void setMandatoryStarMarkerPosition(int mandatoryStarMarkerPosition) {
- m_mandatoryStarMarkerPosition = mandatoryStarMarkerPosition;
- }
-
- @Override
- public String getMandatoryLabelTextColor() {
- return m_mandatoryLabelTextColor;
- }
-
- public void setMandatoryLabelTextColor(String mandatoryLabelTextColor) {
- m_mandatoryLabelTextColor = mandatoryLabelTextColor;
- }
-
- @Override
- public FontSpec getMandatoryLabelFont() {
- return m_mandatoryLabelFont;
- }
-
- public void setMandatoryLabelFont(FontSpec mandatoryLabelFont) {
- m_mandatoryLabelFont = mandatoryLabelFont;
- }
-
- @Override
- public int getFormFieldLabelWidth() {
- return m_formFieldLabelWidth;
- }
-
- public void setFormFieldLabelWidth(int formFieldLabelWidth) {
- m_formFieldLabelWidth = formFieldLabelWidth;
- }
-
- @Override
- public int getLogicalGridLayoutDefaultColumnWidth() {
- return m_logicalGridLayoutDefaultColumnWidth;
- }
-
- public void setLogicalGridLayoutDefaultColumnWidth(int logicalGridLayoutDefaultColumnWidth) {
- m_logicalGridLayoutDefaultColumnWidth = logicalGridLayoutDefaultColumnWidth;
- }
-
- @Override
- public int getLogicalGridLayoutDefaultPopupWidth() {
- return m_logicalGridLayoutDefaultPopupWidth;
- }
-
- public void setLogicalGridLayoutDefaultPopupWidth(int logicalGridLayoutDefaultPopupWidth) {
- m_logicalGridLayoutDefaultPopupWidth = logicalGridLayoutDefaultPopupWidth;
- }
-
- @Override
- public int getLogicalGridLayoutHorizontalGap() {
- return m_logicalGridLayoutHorizontalGap;
- }
-
- public void setLogicalGridLayoutHorizontalGap(int logicalGridLayoutHorizontalGap) {
- m_logicalGridLayoutHorizontalGap = logicalGridLayoutHorizontalGap;
- }
-
- @Override
- public int getLogicalGridLayoutVerticalGap() {
- return m_logicalGridLayoutVerticalGap;
- }
-
- public void setLogicalGridLayoutVerticalGap(int logicalGridLayoutVerticalGap) {
- m_logicalGridLayoutVerticalGap = logicalGridLayoutVerticalGap;
- }
-
- @Override
- public int getLogicalGridLayoutRowHeight() {
- return m_logicalGridLayoutRowHeight;
- }
-
- public void setLogicalGridLayoutRowHeight(int logicalGridLayoutRowHeight) {
- m_logicalGridLayoutRowHeight = logicalGridLayoutRowHeight;
- }
-
- @Override
- public String getColorForegroundDisabled() {
- return m_colorForegroundDisabled;
- }
-
- public void setColorForegroundDisabled(String colorForegroundDisabled) {
- m_colorForegroundDisabled = colorForegroundDisabled;
- }
-
- @Override
- public int getFormFieldLabelAlignment() {
- return m_formFieldLabelAlignment;
- }
-
- public void setFormFieldLabelAlignment(int propertyString) {
- m_formFieldLabelAlignment = propertyString;
- }
-
- @Override
- public int getMessageBoxMinWidth() {
- return m_messageBoxMinWidth;
- }
-
- public void setMessageBoxMinWidth(int messageBoxMinWidth) {
- m_messageBoxMinWidth = messageBoxMinWidth;
- }
-
- @Override
- public int getMessageBoxMinHeight() {
- return m_messageBoxMinHeight;
- }
-
- public void setMessageBoxMinHeight(int messageBoxMinHeight) {
- m_messageBoxMinHeight = messageBoxMinHeight;
- }
-
- @Override
- public int getToolFormMinWidth() {
- return m_toolFormMinWidth;
- }
-
- public void setToolFormMinWidth(int toolFormMinWidth) {
- m_toolFormMinWidth = toolFormMinWidth;
- }
-
- @Override
- public boolean isDndSupportEnabled() {
- return m_dndSupportEnabled;
- }
-
- public void setDndSupportEnabled(boolean dndSupportEnabled) {
- m_dndSupportEnabled = dndSupportEnabled;
- }
-
- @Override
- public boolean isBrowserHistoryEnabled() {
- return m_browserHistoryEnabled;
- }
-
- public void setBrowserHistoryEnabled(boolean browserHistoryEnabled) {
- m_browserHistoryEnabled = browserHistoryEnabled;
- }
-
- @Override
- public boolean isFormFieldSelectAllOnFocusEnabled() {
- return m_formFieldSelectAllOnFocusEnabled;
- }
-
- public void setFormFieldSelectAllOnFocusEnabled(boolean formFieldSelectAllOnFocusEnabled) {
- m_formFieldSelectAllOnFocusEnabled = formFieldSelectAllOnFocusEnabled;
- }
-
- @Override
- public int getTableRowHeight() {
- return m_tableRowHeight;
- }
-
- public void setTableRowHeight(int tableRowHeight) {
- m_tableRowHeight = tableRowHeight;
- }
-
- @Override
- public int getTreeNodeHeight() {
- return m_treeNodeHeight;
- }
-
- public void setTreeNodeHeight(int treeNodeHeight) {
- m_treeNodeHeight = treeNodeHeight;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.extension.internal;
+
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.shared.data.basic.FontSpec;
+import org.eclipse.scout.rt.ui.rap.extension.IUiDecoration;
+import org.eclipse.swt.SWT;
+
+public class UiDecoration implements IUiDecoration {
+ private static IScoutLogger LOG = ScoutLogManager.getLogger(UiDecoration.class);
+
+ private String m_mandatoryFieldBackgroundColor;
+ private int m_mandatoryStarMarkerPosition;
+ private String m_mandatoryLabelTextColor;
+ private FontSpec m_mandatoryLabelFont;
+ private int m_dialogMinWidth;
+ private int m_dialogMinHeight;
+ private boolean m_formMainBoxBorderVisible = false;
+ private int m_formFieldLabelWidth;
+ private boolean m_formFieldSelectAllOnFocusEnabled;
+ private int m_logicalGridLayoutDefaultColumnWidth;
+ private int m_logicalGridLayoutDefaultPopupWidth;
+ private int m_logicalGridLayoutHorizontalGap;
+ private int m_logicalGridLayoutVerticalGap;
+ private int m_logicalGridLayoutRowHeight;
+ private int m_processButtonHeight;
+ private int m_processButtonMinWidth;
+ private int m_processButtonMaxWidth;
+ private String m_colorForegroundDisabled;
+ private int m_messageBoxMinWidth = 400;
+ private int m_messageBoxMinHeight = 100;
+ private int m_toolFormMinWidth = 330;
+ private boolean m_dndSupportEnabled;
+ private boolean m_browserHistoryEnabled;
+ private int m_tableRowHeight = -1;
+ private int m_treeNodeHeight = -1;
+
+ /**
+ * one of SWT.RIGHT SWT.LEFT SWT.CENTER
+ */
+ private int m_formFieldLabelAlignment = SWT.RIGHT;
+
+ @Override
+ public int getDialogMinWidth() {
+ return m_dialogMinWidth;
+ }
+
+ public void setDialogMinWidth(int dialogMinWidth) {
+ m_dialogMinWidth = dialogMinWidth;
+ }
+
+ @Override
+ public int getDialogMinHeight() {
+ return m_dialogMinHeight;
+ }
+
+ public void setDialogMinHeight(int dialogMinHeight) {
+ m_dialogMinHeight = dialogMinHeight;
+ }
+
+ @Override
+ public int getProcessButtonHeight() {
+ return m_processButtonHeight;
+ }
+
+ public void setProcessButtonHeight(int processButtonHeight) {
+ m_processButtonHeight = processButtonHeight;
+ }
+
+ @Override
+ public int getProcessButtonMinWidth() {
+ return m_processButtonMinWidth;
+ }
+
+ public void setProcessButtonMinWidth(int processButtonMinWidth) {
+ m_processButtonMinWidth = processButtonMinWidth;
+ }
+
+ @Override
+ public int getProcessButtonMaxWidth() {
+ return m_processButtonMaxWidth;
+ }
+
+ public void setProcessButtonMaxWidth(int processButtonMaxWidth) {
+ m_processButtonMaxWidth = processButtonMaxWidth;
+ }
+
+ @Override
+ public boolean isFormMainBoxBorderVisible() {
+ return m_formMainBoxBorderVisible;
+ }
+
+ /**
+ * @param formMainBoxBorderVisible
+ * the formMainBoxBorderVisible to set
+ */
+ public void setFormMainBoxBorderVisible(boolean formMainBoxBorderVisible) {
+ m_formMainBoxBorderVisible = formMainBoxBorderVisible;
+ }
+
+ @Override
+ public String getMandatoryFieldBackgroundColor() {
+ return m_mandatoryFieldBackgroundColor;
+ }
+
+ public void setMandatoryFieldBackgroundColor(String mandatoryFieldBackgroundColor) {
+ m_mandatoryFieldBackgroundColor = mandatoryFieldBackgroundColor;
+ }
+
+ @Override
+ public int getMandatoryStarMarkerPosition() {
+ return m_mandatoryStarMarkerPosition;
+ }
+
+ public void setMandatoryStarMarkerPosition(int mandatoryStarMarkerPosition) {
+ m_mandatoryStarMarkerPosition = mandatoryStarMarkerPosition;
+ }
+
+ @Override
+ public String getMandatoryLabelTextColor() {
+ return m_mandatoryLabelTextColor;
+ }
+
+ public void setMandatoryLabelTextColor(String mandatoryLabelTextColor) {
+ m_mandatoryLabelTextColor = mandatoryLabelTextColor;
+ }
+
+ @Override
+ public FontSpec getMandatoryLabelFont() {
+ return m_mandatoryLabelFont;
+ }
+
+ public void setMandatoryLabelFont(FontSpec mandatoryLabelFont) {
+ m_mandatoryLabelFont = mandatoryLabelFont;
+ }
+
+ @Override
+ public int getFormFieldLabelWidth() {
+ return m_formFieldLabelWidth;
+ }
+
+ public void setFormFieldLabelWidth(int formFieldLabelWidth) {
+ m_formFieldLabelWidth = formFieldLabelWidth;
+ }
+
+ @Override
+ public int getLogicalGridLayoutDefaultColumnWidth() {
+ return m_logicalGridLayoutDefaultColumnWidth;
+ }
+
+ public void setLogicalGridLayoutDefaultColumnWidth(int logicalGridLayoutDefaultColumnWidth) {
+ m_logicalGridLayoutDefaultColumnWidth = logicalGridLayoutDefaultColumnWidth;
+ }
+
+ @Override
+ public int getLogicalGridLayoutDefaultPopupWidth() {
+ return m_logicalGridLayoutDefaultPopupWidth;
+ }
+
+ public void setLogicalGridLayoutDefaultPopupWidth(int logicalGridLayoutDefaultPopupWidth) {
+ m_logicalGridLayoutDefaultPopupWidth = logicalGridLayoutDefaultPopupWidth;
+ }
+
+ @Override
+ public int getLogicalGridLayoutHorizontalGap() {
+ return m_logicalGridLayoutHorizontalGap;
+ }
+
+ public void setLogicalGridLayoutHorizontalGap(int logicalGridLayoutHorizontalGap) {
+ m_logicalGridLayoutHorizontalGap = logicalGridLayoutHorizontalGap;
+ }
+
+ @Override
+ public int getLogicalGridLayoutVerticalGap() {
+ return m_logicalGridLayoutVerticalGap;
+ }
+
+ public void setLogicalGridLayoutVerticalGap(int logicalGridLayoutVerticalGap) {
+ m_logicalGridLayoutVerticalGap = logicalGridLayoutVerticalGap;
+ }
+
+ @Override
+ public int getLogicalGridLayoutRowHeight() {
+ return m_logicalGridLayoutRowHeight;
+ }
+
+ public void setLogicalGridLayoutRowHeight(int logicalGridLayoutRowHeight) {
+ m_logicalGridLayoutRowHeight = logicalGridLayoutRowHeight;
+ }
+
+ @Override
+ public String getColorForegroundDisabled() {
+ return m_colorForegroundDisabled;
+ }
+
+ public void setColorForegroundDisabled(String colorForegroundDisabled) {
+ m_colorForegroundDisabled = colorForegroundDisabled;
+ }
+
+ @Override
+ public int getFormFieldLabelAlignment() {
+ return m_formFieldLabelAlignment;
+ }
+
+ public void setFormFieldLabelAlignment(int propertyString) {
+ m_formFieldLabelAlignment = propertyString;
+ }
+
+ @Override
+ public int getMessageBoxMinWidth() {
+ return m_messageBoxMinWidth;
+ }
+
+ public void setMessageBoxMinWidth(int messageBoxMinWidth) {
+ m_messageBoxMinWidth = messageBoxMinWidth;
+ }
+
+ @Override
+ public int getMessageBoxMinHeight() {
+ return m_messageBoxMinHeight;
+ }
+
+ public void setMessageBoxMinHeight(int messageBoxMinHeight) {
+ m_messageBoxMinHeight = messageBoxMinHeight;
+ }
+
+ @Override
+ public int getToolFormMinWidth() {
+ return m_toolFormMinWidth;
+ }
+
+ public void setToolFormMinWidth(int toolFormMinWidth) {
+ m_toolFormMinWidth = toolFormMinWidth;
+ }
+
+ @Override
+ public boolean isDndSupportEnabled() {
+ return m_dndSupportEnabled;
+ }
+
+ public void setDndSupportEnabled(boolean dndSupportEnabled) {
+ m_dndSupportEnabled = dndSupportEnabled;
+ }
+
+ @Override
+ public boolean isBrowserHistoryEnabled() {
+ return m_browserHistoryEnabled;
+ }
+
+ public void setBrowserHistoryEnabled(boolean browserHistoryEnabled) {
+ m_browserHistoryEnabled = browserHistoryEnabled;
+ }
+
+ @Override
+ public boolean isFormFieldSelectAllOnFocusEnabled() {
+ return m_formFieldSelectAllOnFocusEnabled;
+ }
+
+ public void setFormFieldSelectAllOnFocusEnabled(boolean formFieldSelectAllOnFocusEnabled) {
+ m_formFieldSelectAllOnFocusEnabled = formFieldSelectAllOnFocusEnabled;
+ }
+
+ @Override
+ public int getTableRowHeight() {
+ return m_tableRowHeight;
+ }
+
+ public void setTableRowHeight(int tableRowHeight) {
+ m_tableRowHeight = tableRowHeight;
+ }
+
+ @Override
+ public int getTreeNodeHeight() {
+ return m_treeNodeHeight;
+ }
+
+ public void setTreeNodeHeight(int treeNodeHeight) {
+ m_treeNodeHeight = treeNodeHeight;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/IRwtScoutForm.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/IRwtScoutForm.java
index ca1f6d5471..e00637a96d 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/IRwtScoutForm.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/IRwtScoutForm.java
@@ -1,23 +1,23 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.form;
-
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.ui.rap.basic.IRwtScoutComposite;
-import org.eclipse.swt.widgets.Composite;
-
-public interface IRwtScoutForm extends IRwtScoutComposite<IForm> {
-
- Composite getUiFormPane();
-
- void setInitialFocus();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.form;
+
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.ui.rap.basic.IRwtScoutComposite;
+import org.eclipse.swt.widgets.Composite;
+
+public interface IRwtScoutForm extends IRwtScoutComposite<IForm> {
+
+ Composite getUiFormPane();
+
+ void setInitialFocus();
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/RwtScoutForm.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/RwtScoutForm.java
index facd3b191e..0ab3f4e0bf 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/RwtScoutForm.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/RwtScoutForm.java
@@ -1,279 +1,279 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.form;
-
-import java.io.File;
-import java.util.WeakHashMap;
-
-import org.eclipse.rwt.lifecycle.WidgetUtil;
-import org.eclipse.scout.commons.beans.IPropertyObserver;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.IEventHistory;
-import org.eclipse.scout.rt.client.ui.form.FormEvent;
-import org.eclipse.scout.rt.client.ui.form.FormListener;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
-import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
-import org.eclipse.scout.rt.client.ui.form.fields.smartfield.ISmartFieldProposalForm;
-import org.eclipse.scout.rt.ui.rap.DefaultValidateRoot;
-import org.eclipse.scout.rt.ui.rap.IValidateRoot;
-import org.eclipse.scout.rt.ui.rap.LogicalGridLayout;
-import org.eclipse.scout.rt.ui.rap.basic.IRwtScoutComposite;
-import org.eclipse.scout.rt.ui.rap.basic.RwtScoutComposite;
-import org.eclipse.scout.rt.ui.rap.basic.WidgetPrinter;
-import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
-import org.eclipse.scout.rt.ui.rap.form.fields.RwtScoutFieldComposite;
-import org.eclipse.scout.rt.ui.rap.form.fields.RwtScoutFormFieldGridData;
-import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-
-public class RwtScoutForm extends RwtScoutComposite<IForm> implements IRwtScoutForm {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(RwtScoutForm.class);
- private static final String VARIANT_FORM = "form";
-
- private FormListener m_scoutFormListener;
- private WeakHashMap<FormEvent, Object> m_consumedScoutFormEvents = new WeakHashMap<FormEvent, Object>();
-
- @Override
- protected void initializeUi(Composite parent) {
- Composite container = getUiEnvironment().getFormToolkit().createComposite(parent);
- container.setData(WidgetUtil.CUSTOM_VARIANT, VARIANT_FORM);
-
- IRwtScoutFormField group = getUiEnvironment().createFormField(container, getScoutObject().getRootGroupBox());
- Composite field = group.getUiContainer();
- setUiContainer(container);
- setUiField(field);
-
- // use grid layout with decent min-width
- RwtScoutFormFieldGridData layoutData = new RwtScoutFormFieldGridData(getScoutObject().getRootGroupBox());
- getUiField().setLayoutData(layoutData);
- container.setLayout(new LogicalGridLayout(0, 0));
- container.setData(IValidateRoot.VALIDATE_ROOT_DATA, new DefaultValidateRoot(parent));
- }
-
- @Override
- protected void attachScout() {
- super.attachScout();
- if (getScoutObject() instanceof ISmartFieldProposalForm) {
- getUiContainer().setData(WidgetUtil.CUSTOM_VARIANT, RwtUtility.VARIANT_PROPOSAL_FORM);
- }
- if (m_scoutFormListener == null) {
- m_scoutFormListener = new P_ScoutFormListener();
- getScoutObject().addFormListener(m_scoutFormListener);
- }
- // process all pending events, except requestFocus
- IEventHistory<FormEvent> h = getScoutObject().getEventHistory();
- if (h != null) {
- for (FormEvent e : h.getRecentEvents()) {
- switch (e.getType()) {
- case FormEvent.TYPE_TO_BACK:
- case FormEvent.TYPE_TO_FRONT:
- case FormEvent.TYPE_PRINT: {
- handleScoutFormEventInUi(e);
- break;
- }
- }
- }
- }
- setInitialFocus();
- }
-
- @Override
- protected void detachScout() {
- super.detachScout();
- if (m_scoutFormListener != null) {
- getScoutObject().removeFormListener(m_scoutFormListener);
- m_scoutFormListener = null;
- }
- }
-
- @Override
- public Composite getUiFormPane() {
- return (Composite) getUiField();
- }
-
- @Override
- public IForm getScoutObject() {
- return super.getScoutObject();
- }
-
- @Override
- public void setInitialFocus() {
- IFormField modelField = null;
- //check for request focus events in history
- IEventHistory<FormEvent> h = getScoutObject().getEventHistory();
- if (h != null) {
- for (FormEvent e : h.getRecentEvents()) {
- if (e.getType() == FormEvent.TYPE_REQUEST_FOCUS) {
- modelField = e.getFormField();
- break;
- }
- }
- }
- if (modelField == null) {
- for (IFormField f : getScoutObject().getAllFields()) {
- if ((f instanceof IValueField || f instanceof IButton)
- && f.isFocusable()
- && f.isVisible()
- && f.isEnabled()) {
- modelField = f;
- break;
- }
- }
- }
- if (modelField != null) {
- handleRequestFocusFromScout(modelField, true);
- }
- }
-
- private Control findUiField(IFormField modelField) {
- if (modelField == null) {
- return null;
- }
- for (Control comp : RwtUtility.findChildComponents(getUiContainer(), Control.class)) {
- IRwtScoutComposite<?> composite = RwtScoutFieldComposite.getCompositeOnWidget(comp);
- if (composite != null && composite.getScoutObject() == modelField) {
- return composite.getUiField();
- }
- }
- return null;
- }
-
- protected void handleScoutFormEventInUi(final FormEvent e) {
- if (m_consumedScoutFormEvents.containsKey(e)) {
- return;
- }
- m_consumedScoutFormEvents.put(e, Boolean.TRUE);
- //
- switch (e.getType()) {
- case FormEvent.TYPE_PRINT: {
- handlePrintFromScout(e);
- break;
- }
- case FormEvent.TYPE_TO_FRONT: {
- Shell sh = getUiFormPane().getShell();
- if (sh.isVisible()) {
- // TODO rap not supported in swt: sh.toFront()
- }
- break;
- }
- case FormEvent.TYPE_TO_BACK: {
- Shell sh = getUiFormPane().getShell();
- if (sh.isVisible()) {
- // TODO rap not supported in swt: sh.toBack()
- }
- break;
- }
- case FormEvent.TYPE_REQUEST_FOCUS: {
- handleRequestFocusFromScout(e.getFormField(), false);
- break;
- }
- }
- }
-
- protected void handlePrintFromScout(final FormEvent e) {
- WidgetPrinter wp = null;
- try {
- if (getUiFormPane() != null) {
- if (e.getFormField() != null) {
- for (Control c : RwtUtility.findChildComponents(getUiContainer(), Control.class)) {
- IPropertyObserver scoutModel = (IPropertyObserver) c.getData(IRwtScoutFormField.CLIENT_PROPERTY_SCOUT_OBJECT);
- if (scoutModel == e.getFormField()) {
- wp = new WidgetPrinter(c);
- break;
- }
- }
- }
- if (wp == null) {
- wp = new WidgetPrinter(getUiFormPane().getShell());
- }
- }
- if (wp != null) {
- try {
- wp.print(e.getPrintDevice(), e.getPrintParameters());
- }
- catch (Throwable ex) {
- LOG.error(null, ex);
- }
- }
- }
- finally {
- File outputFile = null;
- if (wp != null) {
- outputFile = wp.getOutputFile();
- }
- final File outputFileFinal = outputFile;
- Runnable r = new Runnable() {
- @Override
- public void run() {
- getScoutObject().getUIFacade().fireFormPrintedFromUI(outputFileFinal);
- }
- };
- getUiEnvironment().invokeScoutLater(r, 0);
- }
- }
-
- protected void handleRequestFocusFromScout(IFormField modelField, boolean force) {
- if (modelField == null) {
- return;
- }
- Control comp = findUiField(modelField);
- if (comp != null && comp.getVisible()) {
- Control[] tabList = (comp instanceof Composite ? ((Composite) comp).getTabList() : null);
- if (tabList != null && tabList.length > 0) {
- comp = tabList[0];
- }
- if (comp != null && comp.getVisible()) {
- if (force) {
- comp.forceFocus();
- }
- else {
- comp.setFocus();
- }
- }
- }
- }
-
- private class P_ScoutFormListener implements FormListener {
- @Override
- public void formChanged(final FormEvent e) {
- Display display = getUiEnvironment().getDisplay();
- if (display == null) {
- return;
- }
- switch (e.getType()) {
- case FormEvent.TYPE_STRUCTURE_CHANGED: {
- break;
- }
- case FormEvent.TYPE_PRINT:
- case FormEvent.TYPE_TO_FRONT:
- case FormEvent.TYPE_TO_BACK:
- case FormEvent.TYPE_REQUEST_FOCUS: {
- Runnable t = new Runnable() {
- @Override
- public void run() {
- if (getUiFormPane() != null && !getUiFormPane().isDisposed()) {
- handleScoutFormEventInUi(e);
- }
- }
- };
- getUiEnvironment().invokeUiLater(t);
- break;
- }
- }
- }
- }// end private class
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.form;
+
+import java.io.File;
+import java.util.WeakHashMap;
+
+import org.eclipse.rwt.lifecycle.WidgetUtil;
+import org.eclipse.scout.commons.beans.IPropertyObserver;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.IEventHistory;
+import org.eclipse.scout.rt.client.ui.form.FormEvent;
+import org.eclipse.scout.rt.client.ui.form.FormListener;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
+import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
+import org.eclipse.scout.rt.client.ui.form.fields.smartfield.ISmartFieldProposalForm;
+import org.eclipse.scout.rt.ui.rap.DefaultValidateRoot;
+import org.eclipse.scout.rt.ui.rap.IValidateRoot;
+import org.eclipse.scout.rt.ui.rap.LogicalGridLayout;
+import org.eclipse.scout.rt.ui.rap.basic.IRwtScoutComposite;
+import org.eclipse.scout.rt.ui.rap.basic.RwtScoutComposite;
+import org.eclipse.scout.rt.ui.rap.basic.WidgetPrinter;
+import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
+import org.eclipse.scout.rt.ui.rap.form.fields.RwtScoutFieldComposite;
+import org.eclipse.scout.rt.ui.rap.form.fields.RwtScoutFormFieldGridData;
+import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+public class RwtScoutForm extends RwtScoutComposite<IForm> implements IRwtScoutForm {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(RwtScoutForm.class);
+ private static final String VARIANT_FORM = "form";
+
+ private FormListener m_scoutFormListener;
+ private WeakHashMap<FormEvent, Object> m_consumedScoutFormEvents = new WeakHashMap<FormEvent, Object>();
+
+ @Override
+ protected void initializeUi(Composite parent) {
+ Composite container = getUiEnvironment().getFormToolkit().createComposite(parent);
+ container.setData(WidgetUtil.CUSTOM_VARIANT, VARIANT_FORM);
+
+ IRwtScoutFormField group = getUiEnvironment().createFormField(container, getScoutObject().getRootGroupBox());
+ Composite field = group.getUiContainer();
+ setUiContainer(container);
+ setUiField(field);
+
+ // use grid layout with decent min-width
+ RwtScoutFormFieldGridData layoutData = new RwtScoutFormFieldGridData(getScoutObject().getRootGroupBox());
+ getUiField().setLayoutData(layoutData);
+ container.setLayout(new LogicalGridLayout(0, 0));
+ container.setData(IValidateRoot.VALIDATE_ROOT_DATA, new DefaultValidateRoot(parent));
+ }
+
+ @Override
+ protected void attachScout() {
+ super.attachScout();
+ if (getScoutObject() instanceof ISmartFieldProposalForm) {
+ getUiContainer().setData(WidgetUtil.CUSTOM_VARIANT, RwtUtility.VARIANT_PROPOSAL_FORM);
+ }
+ if (m_scoutFormListener == null) {
+ m_scoutFormListener = new P_ScoutFormListener();
+ getScoutObject().addFormListener(m_scoutFormListener);
+ }
+ // process all pending events, except requestFocus
+ IEventHistory<FormEvent> h = getScoutObject().getEventHistory();
+ if (h != null) {
+ for (FormEvent e : h.getRecentEvents()) {
+ switch (e.getType()) {
+ case FormEvent.TYPE_TO_BACK:
+ case FormEvent.TYPE_TO_FRONT:
+ case FormEvent.TYPE_PRINT: {
+ handleScoutFormEventInUi(e);
+ break;
+ }
+ }
+ }
+ }
+ setInitialFocus();
+ }
+
+ @Override
+ protected void detachScout() {
+ super.detachScout();
+ if (m_scoutFormListener != null) {
+ getScoutObject().removeFormListener(m_scoutFormListener);
+ m_scoutFormListener = null;
+ }
+ }
+
+ @Override
+ public Composite getUiFormPane() {
+ return (Composite) getUiField();
+ }
+
+ @Override
+ public IForm getScoutObject() {
+ return super.getScoutObject();
+ }
+
+ @Override
+ public void setInitialFocus() {
+ IFormField modelField = null;
+ //check for request focus events in history
+ IEventHistory<FormEvent> h = getScoutObject().getEventHistory();
+ if (h != null) {
+ for (FormEvent e : h.getRecentEvents()) {
+ if (e.getType() == FormEvent.TYPE_REQUEST_FOCUS) {
+ modelField = e.getFormField();
+ break;
+ }
+ }
+ }
+ if (modelField == null) {
+ for (IFormField f : getScoutObject().getAllFields()) {
+ if ((f instanceof IValueField || f instanceof IButton)
+ && f.isFocusable()
+ && f.isVisible()
+ && f.isEnabled()) {
+ modelField = f;
+ break;
+ }
+ }
+ }
+ if (modelField != null) {
+ handleRequestFocusFromScout(modelField, true);
+ }
+ }
+
+ private Control findUiField(IFormField modelField) {
+ if (modelField == null) {
+ return null;
+ }
+ for (Control comp : RwtUtility.findChildComponents(getUiContainer(), Control.class)) {
+ IRwtScoutComposite<?> composite = RwtScoutFieldComposite.getCompositeOnWidget(comp);
+ if (composite != null && composite.getScoutObject() == modelField) {
+ return composite.getUiField();
+ }
+ }
+ return null;
+ }
+
+ protected void handleScoutFormEventInUi(final FormEvent e) {
+ if (m_consumedScoutFormEvents.containsKey(e)) {
+ return;
+ }
+ m_consumedScoutFormEvents.put(e, Boolean.TRUE);
+ //
+ switch (e.getType()) {
+ case FormEvent.TYPE_PRINT: {
+ handlePrintFromScout(e);
+ break;
+ }
+ case FormEvent.TYPE_TO_FRONT: {
+ Shell sh = getUiFormPane().getShell();
+ if (sh.isVisible()) {
+ // TODO rap not supported in swt: sh.toFront()
+ }
+ break;
+ }
+ case FormEvent.TYPE_TO_BACK: {
+ Shell sh = getUiFormPane().getShell();
+ if (sh.isVisible()) {
+ // TODO rap not supported in swt: sh.toBack()
+ }
+ break;
+ }
+ case FormEvent.TYPE_REQUEST_FOCUS: {
+ handleRequestFocusFromScout(e.getFormField(), false);
+ break;
+ }
+ }
+ }
+
+ protected void handlePrintFromScout(final FormEvent e) {
+ WidgetPrinter wp = null;
+ try {
+ if (getUiFormPane() != null) {
+ if (e.getFormField() != null) {
+ for (Control c : RwtUtility.findChildComponents(getUiContainer(), Control.class)) {
+ IPropertyObserver scoutModel = (IPropertyObserver) c.getData(IRwtScoutFormField.CLIENT_PROPERTY_SCOUT_OBJECT);
+ if (scoutModel == e.getFormField()) {
+ wp = new WidgetPrinter(c);
+ break;
+ }
+ }
+ }
+ if (wp == null) {
+ wp = new WidgetPrinter(getUiFormPane().getShell());
+ }
+ }
+ if (wp != null) {
+ try {
+ wp.print(e.getPrintDevice(), e.getPrintParameters());
+ }
+ catch (Throwable ex) {
+ LOG.error(null, ex);
+ }
+ }
+ }
+ finally {
+ File outputFile = null;
+ if (wp != null) {
+ outputFile = wp.getOutputFile();
+ }
+ final File outputFileFinal = outputFile;
+ Runnable r = new Runnable() {
+ @Override
+ public void run() {
+ getScoutObject().getUIFacade().fireFormPrintedFromUI(outputFileFinal);
+ }
+ };
+ getUiEnvironment().invokeScoutLater(r, 0);
+ }
+ }
+
+ protected void handleRequestFocusFromScout(IFormField modelField, boolean force) {
+ if (modelField == null) {
+ return;
+ }
+ Control comp = findUiField(modelField);
+ if (comp != null && comp.getVisible()) {
+ Control[] tabList = (comp instanceof Composite ? ((Composite) comp).getTabList() : null);
+ if (tabList != null && tabList.length > 0) {
+ comp = tabList[0];
+ }
+ if (comp != null && comp.getVisible()) {
+ if (force) {
+ comp.forceFocus();
+ }
+ else {
+ comp.setFocus();
+ }
+ }
+ }
+ }
+
+ private class P_ScoutFormListener implements FormListener {
+ @Override
+ public void formChanged(final FormEvent e) {
+ Display display = getUiEnvironment().getDisplay();
+ if (display == null) {
+ return;
+ }
+ switch (e.getType()) {
+ case FormEvent.TYPE_STRUCTURE_CHANGED: {
+ break;
+ }
+ case FormEvent.TYPE_PRINT:
+ case FormEvent.TYPE_TO_FRONT:
+ case FormEvent.TYPE_TO_BACK:
+ case FormEvent.TYPE_REQUEST_FOCUS: {
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ if (getUiFormPane() != null && !getUiFormPane().isDisposed()) {
+ handleScoutFormEventInUi(e);
+ }
+ }
+ };
+ getUiEnvironment().invokeUiLater(t);
+ break;
+ }
+ }
+ }
+ }// end private class
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/AbstractRwtScoutDndSupport.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/AbstractRwtScoutDndSupport.java
index ef526db763..ecd6b91039 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/AbstractRwtScoutDndSupport.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/AbstractRwtScoutDndSupport.java
@@ -1,267 +1,267 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.form.fields;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.ArrayList;
-import java.util.Arrays;
-
-import org.eclipse.scout.commons.beans.IPropertyObserver;
-import org.eclipse.scout.commons.dnd.TransferObject;
-import org.eclipse.scout.rt.client.ui.IDNDSupport;
-import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
-import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.DragSource;
-import org.eclipse.swt.dnd.DragSourceAdapter;
-import org.eclipse.swt.dnd.DragSourceEvent;
-import org.eclipse.swt.dnd.DragSourceListener;
-import org.eclipse.swt.dnd.DropTarget;
-import org.eclipse.swt.dnd.DropTargetAdapter;
-import org.eclipse.swt.dnd.DropTargetEvent;
-import org.eclipse.swt.dnd.DropTargetListener;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.widgets.Control;
-
-/**
- * <h3>AbstractRwtScoutDndSupport</h3> ...
- *
- * @since 3.7.0 June 2011
- */
-public abstract class AbstractRwtScoutDndSupport implements IRwtScoutDndSupport {
-
- private final Control m_control;
- private final IPropertyObserver m_scoutObject;
- private final IDNDSupport m_scoutDndSupportable;
- private IRwtEnvironment m_uiEnvironment;
- private DropTargetListener m_dropTargetListener;
- private DragSourceListener m_dragSourceListener;
- private PropertyChangeListener m_scoutPropertyListener;
- private Transfer[] m_dragTransferTypes;
- private Transfer[] m_dropTransferTypes;
-
- public AbstractRwtScoutDndSupport(IPropertyObserver scoutObject, IDNDSupport scoutDndSupportable, Control control, IRwtEnvironment uiEnvironment) {
- m_scoutObject = scoutObject;
- m_scoutDndSupportable = scoutDndSupportable;
- m_control = control;
- m_uiEnvironment = uiEnvironment;
- attachScout();
- m_control.addDisposeListener(new DisposeListener() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void widgetDisposed(DisposeEvent e) {
- detachScout();
- }
- });
- }
-
- protected void attachScout() {
- m_scoutPropertyListener = new P_ScoutObjectPropertyListener();
- m_scoutObject.addPropertyChangeListener(m_scoutPropertyListener);
- updateDragSupportFromScout();
- updateDropSupportFromScout();
- }
-
- protected void detachScout() {
- m_scoutObject.removePropertyChangeListener(m_scoutPropertyListener);
-
- if (m_dragTransferTypes != null) {
- DragSource dragSource = (DragSource) m_control.getData(DND_DRAG_SOURCE);
- if (dragSource != null && !dragSource.isDisposed()) {
- dragSource.removeDragListener(m_dragSourceListener);
- ArrayList<Transfer> types = new ArrayList<Transfer>(Arrays.asList(dragSource.getTransfer()));
- for (Transfer t : m_dragTransferTypes) {
- types.remove(t);
- }
- if (types.size() > 0) {
- dragSource.setTransfer(types.toArray(new Transfer[types.size()]));
- }
- else {
- dragSource.dispose();
- m_control.setData(DND_DRAG_SOURCE, null);
- }
- }
- }
- if (m_dropTransferTypes != null) {
- DropTarget dropTarget = (DropTarget) m_control.getData(DND_DROP_TARGET);
- if (dropTarget != null && !dropTarget.isDisposed()) {
- dropTarget.removeDropListener(m_dropTargetListener);
- ArrayList<Transfer> types = new ArrayList<Transfer>(Arrays.asList(dropTarget.getTransfer()));
- for (Transfer t : m_dropTransferTypes) {
- types.remove(t);
- }
- if (types.size() > 0) {
- dropTarget.setTransfer(types.toArray(new Transfer[types.size()]));
- }
- else {
- dropTarget.dispose();
- m_control.setData(DND_DROP_TARGET, null);
- }
- }
- }
- }
-
- protected IRwtEnvironment getUiEnvironment() {
- return m_uiEnvironment;
- }
-
- protected abstract void handleUiDropAction(DropTargetEvent event, TransferObject scoutTransferObject);
-
- protected abstract TransferObject handleUiDragRequest();
-
- protected void updateDragSupportFromScout() {
- if (m_scoutObject == null || m_control == null || m_control.isDisposed()) {
- return;
- }
- int scoutType = m_scoutDndSupportable.getDragType();
- Transfer[] transferTypes = RwtUtility.convertScoutTransferTypes(scoutType);
- DragSource dragSource = (DragSource) m_control.getData(DND_DRAG_SOURCE);
- if (dragSource == null) {
- if (transferTypes.length > 0) {
- // create new
- dragSource = new DragSource(m_control, DND.DROP_COPY);
- }
- }
- if (dragSource != null) {
- // remove old
- ArrayList<Transfer> types = new ArrayList<Transfer>(Arrays.asList(dragSource.getTransfer()));
- if (m_dragTransferTypes != null) {
- for (Transfer t : m_dragTransferTypes) {
- types.remove(t);
- }
- m_dragTransferTypes = null;
- }
- // add new transfer types
- m_dragTransferTypes = transferTypes;
- for (Transfer t : m_dragTransferTypes) {
- types.add(t);
- }
- if (types.size() > 0) {
- dragSource.setTransfer(types.toArray(new Transfer[types.size()]));
- if (m_dragSourceListener == null) {
- m_dragSourceListener = new P_RwtDragSourceListener();
- dragSource.addDragListener(m_dragSourceListener);
- }
- }
- else {
- if (m_dragSourceListener != null) {
- dragSource.removeDragListener(m_dragSourceListener);
- m_dragSourceListener = null;
- }
- dragSource.dispose();
- }
- }
- }
-
- protected void updateDropSupportFromScout() {
- if (m_scoutObject == null || m_control == null || m_control.isDisposed()) {
- return;
- }
- int scoutType = m_scoutDndSupportable.getDropType();
- Transfer[] transferTypes = RwtUtility.convertScoutTransferTypes(scoutType);
- DropTarget dropTarget = (DropTarget) m_control.getData(DND_DROP_TARGET);
- if (dropTarget == null) {
- if (transferTypes.length > 0) {
- // create new
- dropTarget = new DropTarget(m_control, DND.DROP_MOVE | DND.DROP_COPY);
- }
- }
- if (dropTarget != null) {
- // remove old
- ArrayList<Transfer> types = new ArrayList<Transfer>(Arrays.asList(dropTarget.getTransfer()));
- if (m_dropTransferTypes != null) {
- for (Transfer t : m_dropTransferTypes) {
- types.remove(t);
- }
- m_dropTransferTypes = null;
- }
- // add new transfer types
- m_dropTransferTypes = transferTypes;
- for (Transfer t : m_dropTransferTypes) {
- types.add(t);
- }
- if (types.size() > 0) {
- dropTarget.setTransfer(types.toArray(new Transfer[types.size()]));
- if (m_dropTargetListener == null) {
- m_dropTargetListener = new P_RwtDropTargetListener();
- dropTarget.addDropListener(m_dropTargetListener);
- }
- }
- else {
- if (m_dropTargetListener != null) {
- dropTarget.removeDropListener(m_dropTargetListener);
- m_dropTargetListener = null;
- }
- dropTarget.dispose();
- }
- }
- }
-
- protected void handleScoutProperty(String name, Object newValue) {
- if (IDNDSupport.PROP_DRAG_TYPE.equals(name)) {
- updateDragSupportFromScout();
- }
- else if (IDNDSupport.PROP_DROP_TYPE.equals(name)) {
- updateDropSupportFromScout();
- }
- }
-
- private class P_RwtDropTargetListener extends DropTargetAdapter {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void dropAccept(DropTargetEvent event) {
-
- }
-
- @Override
- public void drop(DropTargetEvent event) {
- TransferObject scoutTransferable = RwtUtility.createScoutTransferable(event);
- if (scoutTransferable != null) {
- handleUiDropAction(event, scoutTransferable);
- }
- }
- } // end class P_RwtDropTargetListener
-
- private class P_RwtDragSourceListener extends DragSourceAdapter {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void dragSetData(DragSourceEvent event) {
- TransferObject scoutTransfer = handleUiDragRequest();
- if (scoutTransfer != null) {
- Object data = RwtUtility.createUiTransferable(scoutTransfer);
- if (data != null) {
- event.data = data;
- }
- }
- }
- } // end class P_RwtDragSourceListener
-
- private class P_ScoutObjectPropertyListener implements PropertyChangeListener {
- @Override
- public void propertyChange(final PropertyChangeEvent evt) {
- if (getUiEnvironment().getDisplay() != null && !getUiEnvironment().getDisplay().isDisposed()) {
- Runnable job = new Runnable() {
- @Override
- public void run() {
- handleScoutProperty(evt.getPropertyName(), evt.getNewValue());
- }
- };
- getUiEnvironment().invokeUiLater(job);
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.form.fields;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.ArrayList;
+import java.util.Arrays;
+
+import org.eclipse.scout.commons.beans.IPropertyObserver;
+import org.eclipse.scout.commons.dnd.TransferObject;
+import org.eclipse.scout.rt.client.ui.IDNDSupport;
+import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
+import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.DragSource;
+import org.eclipse.swt.dnd.DragSourceAdapter;
+import org.eclipse.swt.dnd.DragSourceEvent;
+import org.eclipse.swt.dnd.DragSourceListener;
+import org.eclipse.swt.dnd.DropTarget;
+import org.eclipse.swt.dnd.DropTargetAdapter;
+import org.eclipse.swt.dnd.DropTargetEvent;
+import org.eclipse.swt.dnd.DropTargetListener;
+import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.widgets.Control;
+
+/**
+ * <h3>AbstractRwtScoutDndSupport</h3> ...
+ *
+ * @since 3.7.0 June 2011
+ */
+public abstract class AbstractRwtScoutDndSupport implements IRwtScoutDndSupport {
+
+ private final Control m_control;
+ private final IPropertyObserver m_scoutObject;
+ private final IDNDSupport m_scoutDndSupportable;
+ private IRwtEnvironment m_uiEnvironment;
+ private DropTargetListener m_dropTargetListener;
+ private DragSourceListener m_dragSourceListener;
+ private PropertyChangeListener m_scoutPropertyListener;
+ private Transfer[] m_dragTransferTypes;
+ private Transfer[] m_dropTransferTypes;
+
+ public AbstractRwtScoutDndSupport(IPropertyObserver scoutObject, IDNDSupport scoutDndSupportable, Control control, IRwtEnvironment uiEnvironment) {
+ m_scoutObject = scoutObject;
+ m_scoutDndSupportable = scoutDndSupportable;
+ m_control = control;
+ m_uiEnvironment = uiEnvironment;
+ attachScout();
+ m_control.addDisposeListener(new DisposeListener() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void widgetDisposed(DisposeEvent e) {
+ detachScout();
+ }
+ });
+ }
+
+ protected void attachScout() {
+ m_scoutPropertyListener = new P_ScoutObjectPropertyListener();
+ m_scoutObject.addPropertyChangeListener(m_scoutPropertyListener);
+ updateDragSupportFromScout();
+ updateDropSupportFromScout();
+ }
+
+ protected void detachScout() {
+ m_scoutObject.removePropertyChangeListener(m_scoutPropertyListener);
+
+ if (m_dragTransferTypes != null) {
+ DragSource dragSource = (DragSource) m_control.getData(DND_DRAG_SOURCE);
+ if (dragSource != null && !dragSource.isDisposed()) {
+ dragSource.removeDragListener(m_dragSourceListener);
+ ArrayList<Transfer> types = new ArrayList<Transfer>(Arrays.asList(dragSource.getTransfer()));
+ for (Transfer t : m_dragTransferTypes) {
+ types.remove(t);
+ }
+ if (types.size() > 0) {
+ dragSource.setTransfer(types.toArray(new Transfer[types.size()]));
+ }
+ else {
+ dragSource.dispose();
+ m_control.setData(DND_DRAG_SOURCE, null);
+ }
+ }
+ }
+ if (m_dropTransferTypes != null) {
+ DropTarget dropTarget = (DropTarget) m_control.getData(DND_DROP_TARGET);
+ if (dropTarget != null && !dropTarget.isDisposed()) {
+ dropTarget.removeDropListener(m_dropTargetListener);
+ ArrayList<Transfer> types = new ArrayList<Transfer>(Arrays.asList(dropTarget.getTransfer()));
+ for (Transfer t : m_dropTransferTypes) {
+ types.remove(t);
+ }
+ if (types.size() > 0) {
+ dropTarget.setTransfer(types.toArray(new Transfer[types.size()]));
+ }
+ else {
+ dropTarget.dispose();
+ m_control.setData(DND_DROP_TARGET, null);
+ }
+ }
+ }
+ }
+
+ protected IRwtEnvironment getUiEnvironment() {
+ return m_uiEnvironment;
+ }
+
+ protected abstract void handleUiDropAction(DropTargetEvent event, TransferObject scoutTransferObject);
+
+ protected abstract TransferObject handleUiDragRequest();
+
+ protected void updateDragSupportFromScout() {
+ if (m_scoutObject == null || m_control == null || m_control.isDisposed()) {
+ return;
+ }
+ int scoutType = m_scoutDndSupportable.getDragType();
+ Transfer[] transferTypes = RwtUtility.convertScoutTransferTypes(scoutType);
+ DragSource dragSource = (DragSource) m_control.getData(DND_DRAG_SOURCE);
+ if (dragSource == null) {
+ if (transferTypes.length > 0) {
+ // create new
+ dragSource = new DragSource(m_control, DND.DROP_COPY);
+ }
+ }
+ if (dragSource != null) {
+ // remove old
+ ArrayList<Transfer> types = new ArrayList<Transfer>(Arrays.asList(dragSource.getTransfer()));
+ if (m_dragTransferTypes != null) {
+ for (Transfer t : m_dragTransferTypes) {
+ types.remove(t);
+ }
+ m_dragTransferTypes = null;
+ }
+ // add new transfer types
+ m_dragTransferTypes = transferTypes;
+ for (Transfer t : m_dragTransferTypes) {
+ types.add(t);
+ }
+ if (types.size() > 0) {
+ dragSource.setTransfer(types.toArray(new Transfer[types.size()]));
+ if (m_dragSourceListener == null) {
+ m_dragSourceListener = new P_RwtDragSourceListener();
+ dragSource.addDragListener(m_dragSourceListener);
+ }
+ }
+ else {
+ if (m_dragSourceListener != null) {
+ dragSource.removeDragListener(m_dragSourceListener);
+ m_dragSourceListener = null;
+ }
+ dragSource.dispose();
+ }
+ }
+ }
+
+ protected void updateDropSupportFromScout() {
+ if (m_scoutObject == null || m_control == null || m_control.isDisposed()) {
+ return;
+ }
+ int scoutType = m_scoutDndSupportable.getDropType();
+ Transfer[] transferTypes = RwtUtility.convertScoutTransferTypes(scoutType);
+ DropTarget dropTarget = (DropTarget) m_control.getData(DND_DROP_TARGET);
+ if (dropTarget == null) {
+ if (transferTypes.length > 0) {
+ // create new
+ dropTarget = new DropTarget(m_control, DND.DROP_MOVE | DND.DROP_COPY);
+ }
+ }
+ if (dropTarget != null) {
+ // remove old
+ ArrayList<Transfer> types = new ArrayList<Transfer>(Arrays.asList(dropTarget.getTransfer()));
+ if (m_dropTransferTypes != null) {
+ for (Transfer t : m_dropTransferTypes) {
+ types.remove(t);
+ }
+ m_dropTransferTypes = null;
+ }
+ // add new transfer types
+ m_dropTransferTypes = transferTypes;
+ for (Transfer t : m_dropTransferTypes) {
+ types.add(t);
+ }
+ if (types.size() > 0) {
+ dropTarget.setTransfer(types.toArray(new Transfer[types.size()]));
+ if (m_dropTargetListener == null) {
+ m_dropTargetListener = new P_RwtDropTargetListener();
+ dropTarget.addDropListener(m_dropTargetListener);
+ }
+ }
+ else {
+ if (m_dropTargetListener != null) {
+ dropTarget.removeDropListener(m_dropTargetListener);
+ m_dropTargetListener = null;
+ }
+ dropTarget.dispose();
+ }
+ }
+ }
+
+ protected void handleScoutProperty(String name, Object newValue) {
+ if (IDNDSupport.PROP_DRAG_TYPE.equals(name)) {
+ updateDragSupportFromScout();
+ }
+ else if (IDNDSupport.PROP_DROP_TYPE.equals(name)) {
+ updateDropSupportFromScout();
+ }
+ }
+
+ private class P_RwtDropTargetListener extends DropTargetAdapter {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void dropAccept(DropTargetEvent event) {
+
+ }
+
+ @Override
+ public void drop(DropTargetEvent event) {
+ TransferObject scoutTransferable = RwtUtility.createScoutTransferable(event);
+ if (scoutTransferable != null) {
+ handleUiDropAction(event, scoutTransferable);
+ }
+ }
+ } // end class P_RwtDropTargetListener
+
+ private class P_RwtDragSourceListener extends DragSourceAdapter {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void dragSetData(DragSourceEvent event) {
+ TransferObject scoutTransfer = handleUiDragRequest();
+ if (scoutTransfer != null) {
+ Object data = RwtUtility.createUiTransferable(scoutTransfer);
+ if (data != null) {
+ event.data = data;
+ }
+ }
+ }
+ } // end class P_RwtDragSourceListener
+
+ private class P_ScoutObjectPropertyListener implements PropertyChangeListener {
+ @Override
+ public void propertyChange(final PropertyChangeEvent evt) {
+ if (getUiEnvironment().getDisplay() != null && !getUiEnvironment().getDisplay().isDisposed()) {
+ Runnable job = new Runnable() {
+ @Override
+ public void run() {
+ handleScoutProperty(evt.getPropertyName(), evt.getNewValue());
+ }
+ };
+ getUiEnvironment().invokeUiLater(job);
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/IPopupSupport.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/IPopupSupport.java
index ceb0383e70..088616b273 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/IPopupSupport.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/IPopupSupport.java
@@ -1,48 +1,48 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.form.fields;
-
-import org.eclipse.scout.rt.ui.rap.basic.table.celleditor.RwtScoutTableCellEditor;
-import org.eclipse.scout.rt.ui.rap.form.fields.datefield.RwtScoutDateField;
-import org.eclipse.scout.rt.ui.rap.form.fields.datefield.RwtScoutTimeField;
-import org.eclipse.scout.rt.ui.rap.form.fields.smartfield.RwtScoutSmartField;
-
-/**
- * Fields that open popup dialogs to edit their value (e.g. {@link RwtScoutDateField}, {@link RwtScoutTimeField},
- * {@link RwtScoutSmartField}) should implement this interface. This allows listeners to be
- * notified about the popup state. Especially, this is crucial if the field is used inline within an editable table
- * to handle focus-lost events properly (see {@link RwtScoutTableCellEditor.P_FocusLostListener}).
- */
-public interface IPopupSupport {
-
- /**
- * To register a listener to receive events about the popup state
- *
- * @param listener
- */
- void addPopupEventListener(IPopupSupportListener listener);
-
- void removePopupEventListener(IPopupSupportListener listener);
-
- interface IPopupSupportListener {
-
- /**
- * the popup is opening but not yet open
- */
- public static final int TYPE_OPENING = 1 << 1;
- /**
- * the popup is closed
- */
- public static final int TYPE_CLOSED = 1 << 2;
-
- void handleEvent(int eventType);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.form.fields;
+
+import org.eclipse.scout.rt.ui.rap.basic.table.celleditor.RwtScoutTableCellEditor;
+import org.eclipse.scout.rt.ui.rap.form.fields.datefield.RwtScoutDateField;
+import org.eclipse.scout.rt.ui.rap.form.fields.datefield.RwtScoutTimeField;
+import org.eclipse.scout.rt.ui.rap.form.fields.smartfield.RwtScoutSmartField;
+
+/**
+ * Fields that open popup dialogs to edit their value (e.g. {@link RwtScoutDateField}, {@link RwtScoutTimeField},
+ * {@link RwtScoutSmartField}) should implement this interface. This allows listeners to be
+ * notified about the popup state. Especially, this is crucial if the field is used inline within an editable table
+ * to handle focus-lost events properly (see {@link RwtScoutTableCellEditor.P_FocusLostListener}).
+ */
+public interface IPopupSupport {
+
+ /**
+ * To register a listener to receive events about the popup state
+ *
+ * @param listener
+ */
+ void addPopupEventListener(IPopupSupportListener listener);
+
+ void removePopupEventListener(IPopupSupportListener listener);
+
+ interface IPopupSupportListener {
+
+ /**
+ * the popup is opening but not yet open
+ */
+ public static final int TYPE_OPENING = 1 << 1;
+ /**
+ * the popup is closed
+ */
+ public static final int TYPE_CLOSED = 1 << 2;
+
+ void handleEvent(int eventType);
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/IRwtScoutDndSupport.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/IRwtScoutDndSupport.java
index 5fddd9bc7e..0f23beab5b 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/IRwtScoutDndSupport.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/IRwtScoutDndSupport.java
@@ -1,18 +1,18 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.form.fields;
-
-public interface IRwtScoutDndSupport {
-
- String DND_DROP_TARGET = "DropTarget";
- String DND_DRAG_SOURCE = "DragSource";
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.form.fields;
+
+public interface IRwtScoutDndSupport {
+
+ String DND_DROP_TARGET = "DropTarget";
+ String DND_DRAG_SOURCE = "DragSource";
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/IRwtScoutFormField.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/IRwtScoutFormField.java
index bdb8169bfb..2880be694f 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/IRwtScoutFormField.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/IRwtScoutFormField.java
@@ -1,27 +1,27 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.form.fields;
-
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.ui.rap.basic.IRwtScoutComposite;
-import org.eclipse.scout.rt.ui.rap.ext.ILabelComposite;
-
-/**
- * <h3>IRwtScoutFormField</h3> ...
- *
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.form.fields;
+
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.ui.rap.basic.IRwtScoutComposite;
+import org.eclipse.scout.rt.ui.rap.ext.ILabelComposite;
+
+/**
+ * <h3>IRwtScoutFormField</h3> ...
+ *
* @since 3.7.0 June 2011
- */
-public interface IRwtScoutFormField<T extends IFormField> extends IRwtScoutComposite<T> {
- String CLIENT_PROPERTY_SCOUT_OBJECT = "org.eclipse.scout.rt.object";
-
- ILabelComposite getUiLabel();
-
-}
+ */
+public interface IRwtScoutFormField<T extends IFormField> extends IRwtScoutComposite<T> {
+ String CLIENT_PROPERTY_SCOUT_OBJECT = "org.eclipse.scout.rt.object";
+
+ ILabelComposite getUiLabel();
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/LogicalGridDataBuilder.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/LogicalGridDataBuilder.java
index 8231de9f95..404e6ebbeb 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/LogicalGridDataBuilder.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/LogicalGridDataBuilder.java
@@ -1,90 +1,90 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.form.fields;
-
-import org.eclipse.scout.rt.client.ui.form.fields.GridData;
-import org.eclipse.scout.rt.ui.rap.LogicalGridData;
-import org.eclipse.scout.rt.ui.rap.ext.StatusLabelEx;
-import org.eclipse.scout.rt.ui.rap.extension.UiDecorationExtensionPoint;
-
-public final class LogicalGridDataBuilder {
- /**
- * <p>
- * x-position of the field.
- * </p>
- * Position is 1 because there can be a label on the left side
- */
- public static final int FIELD_GRID_X = 1;
-
- /**
- * <p>
- * y-position of the field.
- * </p>
- * Position is 1 because there can be a label on top
- */
- public static final int FIELD_GRID_Y = 1;
-
- private LogicalGridDataBuilder() {
- }
-
- /**
- * label and status is combined in one component {@link StatusLabelEx}
- */
- public static LogicalGridData createLabel(GridData correspondingFieldData) {
- LogicalGridData data = new LogicalGridData();
- data.gridx = FIELD_GRID_X - 1;
- data.gridy = FIELD_GRID_Y;
- data.gridh = correspondingFieldData.h;
- data.weighty = 1.0;
- data.widthHint = UiDecorationExtensionPoint.getLookAndFeel().getFormFieldLabelWidth();
- data.useUiWidth = true;
- data.useUiHeight = true;
- data.fillVertical = false;
- data.topInset = 1;
- return data;
- }
-
- public static LogicalGridData createLabelOnTop(GridData correspondingFieldData) {
- LogicalGridData data = new LogicalGridData();
- data.gridx = FIELD_GRID_X;
- data.gridy = FIELD_GRID_Y - 1;
- data.weighty = 0.0;
- data.weightx = 1.0;
- data.useUiWidth = true;
- data.useUiHeight = true;
- data.fillVertical = true;
- data.fillHorizontal = true;
- return data;
- }
-
- /**
- * @param gd
- * is only used for the properties useUiWidth and useUiHeight and the
- * weights
- */
- public static LogicalGridData createField(GridData gd) {
- LogicalGridData data = new LogicalGridData();
- data.gridx = FIELD_GRID_X;
- data.gridy = FIELD_GRID_Y;
- data.weightx = 1.0;
- data.gridh = gd.h;
- if (gd.weightY == 0 || gd.weightY < 0 && gd.h <= 1) {
- data.weighty = 0;
- }
- else {
- data.weighty = 1.0;
- }
- data.useUiWidth = gd.useUiWidth;
- data.useUiHeight = gd.useUiHeight;
- return data;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.form.fields;
+
+import org.eclipse.scout.rt.client.ui.form.fields.GridData;
+import org.eclipse.scout.rt.ui.rap.LogicalGridData;
+import org.eclipse.scout.rt.ui.rap.ext.StatusLabelEx;
+import org.eclipse.scout.rt.ui.rap.extension.UiDecorationExtensionPoint;
+
+public final class LogicalGridDataBuilder {
+ /**
+ * <p>
+ * x-position of the field.
+ * </p>
+ * Position is 1 because there can be a label on the left side
+ */
+ public static final int FIELD_GRID_X = 1;
+
+ /**
+ * <p>
+ * y-position of the field.
+ * </p>
+ * Position is 1 because there can be a label on top
+ */
+ public static final int FIELD_GRID_Y = 1;
+
+ private LogicalGridDataBuilder() {
+ }
+
+ /**
+ * label and status is combined in one component {@link StatusLabelEx}
+ */
+ public static LogicalGridData createLabel(GridData correspondingFieldData) {
+ LogicalGridData data = new LogicalGridData();
+ data.gridx = FIELD_GRID_X - 1;
+ data.gridy = FIELD_GRID_Y;
+ data.gridh = correspondingFieldData.h;
+ data.weighty = 1.0;
+ data.widthHint = UiDecorationExtensionPoint.getLookAndFeel().getFormFieldLabelWidth();
+ data.useUiWidth = true;
+ data.useUiHeight = true;
+ data.fillVertical = false;
+ data.topInset = 1;
+ return data;
+ }
+
+ public static LogicalGridData createLabelOnTop(GridData correspondingFieldData) {
+ LogicalGridData data = new LogicalGridData();
+ data.gridx = FIELD_GRID_X;
+ data.gridy = FIELD_GRID_Y - 1;
+ data.weighty = 0.0;
+ data.weightx = 1.0;
+ data.useUiWidth = true;
+ data.useUiHeight = true;
+ data.fillVertical = true;
+ data.fillHorizontal = true;
+ return data;
+ }
+
+ /**
+ * @param gd
+ * is only used for the properties useUiWidth and useUiHeight and the
+ * weights
+ */
+ public static LogicalGridData createField(GridData gd) {
+ LogicalGridData data = new LogicalGridData();
+ data.gridx = FIELD_GRID_X;
+ data.gridy = FIELD_GRID_Y;
+ data.weightx = 1.0;
+ data.gridh = gd.h;
+ if (gd.weightY == 0 || gd.weightY < 0 && gd.h <= 1) {
+ data.weighty = 0;
+ }
+ else {
+ data.weighty = 1.0;
+ }
+ data.useUiWidth = gd.useUiWidth;
+ data.useUiHeight = gd.useUiHeight;
+ return data;
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/OnFieldLabelDecorator.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/OnFieldLabelDecorator.java
index 861a0e918c..5533af4f19 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/OnFieldLabelDecorator.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/OnFieldLabelDecorator.java
@@ -1,104 +1,104 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.form.fields;
-
-import org.eclipse.rwt.lifecycle.WidgetUtil;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.rt.ui.rap.ext.custom.StyledText;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.FocusListener;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Text;
-
-public class OnFieldLabelDecorator implements FocusListener {
- private static final long serialVersionUID = 1L;
-
- private String m_label;
- private String m_text;
- private boolean m_mandatory;
- private Control m_control;
- private RwtScoutFieldComposite m_rwtScoutFieldComposite;
-
- public OnFieldLabelDecorator(Control control, boolean mandatory, RwtScoutFieldComposite rwtScoutFieldComposite) {
- m_mandatory = mandatory;
- m_control = control;
- m_rwtScoutFieldComposite = rwtScoutFieldComposite;
- }
-
- public void setLabel(String s) {
- m_label = s;
-
- paintOnFieldLabel(false);
- }
-
- private Control getControl() {
- return m_control;
- }
-
- private void paintOnFieldLabel(boolean hasFocus) {
- if (getControl() instanceof StyledText && hasFocus) {
- if (getLabel().equalsIgnoreCase(((StyledText) getControl()).getText())) {
- ((StyledText) getControl()).setOnFieldLabel("");
- if (m_rwtScoutFieldComposite instanceof RwtScoutValueFieldComposite) {
- ((RwtScoutValueFieldComposite) m_rwtScoutFieldComposite).setOnFieldLabelFromScout("", "");
- }
- }
- getControl().setData(WidgetUtil.CUSTOM_VARIANT, null);
- return;
- }
- if (getControl() instanceof Text && StringUtility.length(((Text) getControl()).getText()) > 0) {
- return;
- }
- if (getControl() instanceof StyledText && StringUtility.length(((StyledText) getControl()).getText()) > 0) {
- return;
- }
- if (getControl() instanceof StyledText) {
- if (m_rwtScoutFieldComposite instanceof RwtScoutValueFieldComposite) {
- ((RwtScoutValueFieldComposite) m_rwtScoutFieldComposite).setOnFieldLabelFromScout("", getLabel());
- getControl().setData(WidgetUtil.CUSTOM_VARIANT, "onFieldLabel");
- }
- }
- }
-
- public String getLabel() {
- return m_label;
- }
-
- public void attach(Control c) {
- if (c != null && !c.isDisposed()) {
- m_control = c;
- c.addFocusListener(this);
- }
- }
-
- public void detach(Control c) {
- if (c != null && !c.isDisposed()) {
- c.removeFocusListener(this);
- }
- }
-
- @Override
- public void focusGained(FocusEvent e) {
- if (e.widget instanceof Control) {
- paintOnFieldLabel(true);
- ((Control) e.widget).redraw();
- }
- }
-
- @Override
- public void focusLost(FocusEvent e) {
- if (e.widget instanceof Control) {
- paintOnFieldLabel(false);
- ((Control) e.widget).redraw();
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.form.fields;
+
+import org.eclipse.rwt.lifecycle.WidgetUtil;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.rt.ui.rap.ext.custom.StyledText;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.FocusListener;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Text;
+
+public class OnFieldLabelDecorator implements FocusListener {
+ private static final long serialVersionUID = 1L;
+
+ private String m_label;
+ private String m_text;
+ private boolean m_mandatory;
+ private Control m_control;
+ private RwtScoutFieldComposite m_rwtScoutFieldComposite;
+
+ public OnFieldLabelDecorator(Control control, boolean mandatory, RwtScoutFieldComposite rwtScoutFieldComposite) {
+ m_mandatory = mandatory;
+ m_control = control;
+ m_rwtScoutFieldComposite = rwtScoutFieldComposite;
+ }
+
+ public void setLabel(String s) {
+ m_label = s;
+
+ paintOnFieldLabel(false);
+ }
+
+ private Control getControl() {
+ return m_control;
+ }
+
+ private void paintOnFieldLabel(boolean hasFocus) {
+ if (getControl() instanceof StyledText && hasFocus) {
+ if (getLabel().equalsIgnoreCase(((StyledText) getControl()).getText())) {
+ ((StyledText) getControl()).setOnFieldLabel("");
+ if (m_rwtScoutFieldComposite instanceof RwtScoutValueFieldComposite) {
+ ((RwtScoutValueFieldComposite) m_rwtScoutFieldComposite).setOnFieldLabelFromScout("", "");
+ }
+ }
+ getControl().setData(WidgetUtil.CUSTOM_VARIANT, null);
+ return;
+ }
+ if (getControl() instanceof Text && StringUtility.length(((Text) getControl()).getText()) > 0) {
+ return;
+ }
+ if (getControl() instanceof StyledText && StringUtility.length(((StyledText) getControl()).getText()) > 0) {
+ return;
+ }
+ if (getControl() instanceof StyledText) {
+ if (m_rwtScoutFieldComposite instanceof RwtScoutValueFieldComposite) {
+ ((RwtScoutValueFieldComposite) m_rwtScoutFieldComposite).setOnFieldLabelFromScout("", getLabel());
+ getControl().setData(WidgetUtil.CUSTOM_VARIANT, "onFieldLabel");
+ }
+ }
+ }
+
+ public String getLabel() {
+ return m_label;
+ }
+
+ public void attach(Control c) {
+ if (c != null && !c.isDisposed()) {
+ m_control = c;
+ c.addFocusListener(this);
+ }
+ }
+
+ public void detach(Control c) {
+ if (c != null && !c.isDisposed()) {
+ c.removeFocusListener(this);
+ }
+ }
+
+ @Override
+ public void focusGained(FocusEvent e) {
+ if (e.widget instanceof Control) {
+ paintOnFieldLabel(true);
+ ((Control) e.widget).redraw();
+ }
+ }
+
+ @Override
+ public void focusLost(FocusEvent e) {
+ if (e.widget instanceof Control) {
+ paintOnFieldLabel(false);
+ ((Control) e.widget).redraw();
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/RwtScoutFieldComposite.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/RwtScoutFieldComposite.java
index 33e1876720..ed9279da27 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/RwtScoutFieldComposite.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/RwtScoutFieldComposite.java
@@ -1,555 +1,555 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.form.fields;
-
-import java.util.ArrayList;
-
-import org.eclipse.scout.commons.exception.IProcessingStatus;
-import org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.sequencebox.ISequenceBox;
-import org.eclipse.scout.rt.shared.data.basic.FontSpec;
-import org.eclipse.scout.rt.ui.rap.LogicalGridData;
-import org.eclipse.scout.rt.ui.rap.basic.RwtScoutComposite;
-import org.eclipse.scout.rt.ui.rap.ext.ILabelComposite;
-import org.eclipse.scout.rt.ui.rap.extension.UiDecorationExtensionPoint;
-import org.eclipse.scout.rt.ui.rap.keystroke.IRwtKeyStroke;
-import org.eclipse.scout.rt.ui.rap.util.RwtLayoutUtility;
-import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.widgets.Control;
-
-public abstract class RwtScoutFieldComposite<T extends IFormField> extends RwtScoutComposite<T> implements IRwtScoutFormField<T> {
-
- protected static final String CLIENT_PROP_INITIAL_LABEL_FONT = "scoutInitialLabelFont";
- protected static final String CLIENT_PROP_INITIAL_LABEL_BACKGROUND = "scoutInitialLabelBackground";
- protected static final String CLIENT_PROP_INITIAL_LABEL_FOREGROUND = "scoutInitialLabelForeground";
-
- private ILabelComposite m_label;
- private IRwtKeyStroke[] m_keyStrokes;
-
- private Color m_mandatoryFieldBackgroundColor;
- private OnFieldLabelDecorator m_onFieldLabelDecorator;
-
- @Override
- public ILabelComposite getUiLabel() {
- return m_label;
- }
-
- public OnFieldLabelDecorator getOnFieldLabelDecorator() {
- return m_onFieldLabelDecorator;
- }
-
- protected void setUiLabel(ILabelComposite label) {
- m_label = label;
- if (m_label != null && label.getLayoutData() == null) {
- LogicalGridData statusLabelGridData = null;
- if (getScoutObject().getLabelPosition() == IFormField.LABEL_POSITION_TOP) {
- statusLabelGridData = LogicalGridDataBuilder.createLabelOnTop(getScoutObject().getGridData());
- }
- else {
- statusLabelGridData = LogicalGridDataBuilder.createLabel(getScoutObject().getGridData());
- }
-
- m_label.setLayoutData(statusLabelGridData);
- }
- }
-
- public Color getMandatoryFieldBackgroundColor() {
- return m_mandatoryFieldBackgroundColor;
- }
-
- protected void setErrorStatusFromScout(IProcessingStatus s) {
- if (getUiLabel() != null) {
- getUiLabel().setStatus(s);
- getUiContainer().layout(true, true);
- }
- }
-
- public void setMandatoryFieldBackgroundColor(Color mandatoryFieldBackgroundColor) {
- m_mandatoryFieldBackgroundColor = mandatoryFieldBackgroundColor;
- }
-
- @Override
- protected void attachScout() {
- super.attachScout();
- if (getScoutObject() != null) {
- setBackgroundFromScout(getScoutObject().getBackgroundColor());
- setForegroundFromScout(getScoutObject().getForegroundColor());
- setLabelBackgroundFromScout(getScoutObject().getLabelBackgroundColor());
- setLabelForegroundFromScout(getScoutObject().getLabelForegroundColor());
- setVisibleFromScout(getScoutObject().isVisible());
- setEnabledFromScout(getScoutObject().isEnabled());
- // bsh 2010-10-01: The "mandatory" state of a SequenceBoxes is always derived from the
- // inner fields. Don't use the model value (it will always be false).
- if (!(getScoutObject() instanceof ISequenceBox)) {
- setMandatoryFromScout(getScoutObject().isMandatory());
- }
- setErrorStatusFromScout(getScoutObject().getErrorStatus());
- setLabelFromScout(getScoutObject().getLabel());
- setLabelWidthInPixelFromScout();
- setLabelVisibleFromScout();
- setLabelPositionFromScout();
- setLabelHorizontalAlignmentFromScout();
- setTooltipTextFromScout(getScoutObject().getTooltipText());
- if (getScoutObject().getLabelPosition() == IFormField.LABEL_POSITION_ON_FIELD && getScoutObject().getLabel() != null && getScoutObject().getTooltipText() == null) {
- setTooltipTextFromScout(getScoutObject().getLabel());
- }
- setFontFromScout(getScoutObject().getFont());
- setLabelFontFromScout(getScoutObject().getLabelFont());
- setSaveNeededFromScout(getScoutObject().isSaveNeeded());
- setFocusableFromScout(getScoutObject().isFocusable());
- updateKeyStrokesFromScout();
- }
- }
-
- protected void setVisibleFromScout(boolean b) {
- boolean updateLayout = false;
- if (getUiContainer() != null && getUiContainer().getVisible() != b) {
- updateLayout = true;
- getUiContainer().setVisible(b);
- }
- else if (getUiField() != null && getUiField().getVisible() != b) {
- updateLayout = true;
- getUiField().setVisible(b);
- }
- if (updateLayout && isCreated()) {
- RwtLayoutUtility.invalidateLayout(getUiEnvironment(), getUiContainer());
- }
- }
-
- protected void setEnabledFromScout(boolean b) {
- boolean updateLayout = false;
- Control field = getUiField();
- if (field != null) {
- updateLayout = true;
- setFieldEnabled(field, b);
- if (b) {
- setForegroundFromScout(getScoutObject().getForegroundColor());
- }
- else {
- setForegroundFromScout(UiDecorationExtensionPoint.getLookAndFeel().getColorForegroundDisabled());
- }
- }
- if (getUiLabel() != null) {
- if (getUiLabel().getEnabled() != b) {
- updateLayout = true;
- getUiLabel().setEnabled(b);
- }
- }
- if (updateLayout && isCreated()) {
- RwtLayoutUtility.invalidateLayout(getUiEnvironment(), getUiContainer());
- }
- }
-
- /**
- * used to change enabled into read only
- *
- * @param field
- * @param enabled
- */
- protected void setFieldEnabled(Control field, boolean enabled) {
- field.setEnabled(enabled);
- }
-
- protected void setMandatoryFromScout(boolean b) {
- String fieldBackgroundColorString = UiDecorationExtensionPoint.getLookAndFeel().getMandatoryFieldBackgroundColor();
- if (fieldBackgroundColorString != null) {
- Color color = null;
- if (b) {
- color = getUiEnvironment().getColor(fieldBackgroundColorString);
- }
- else {
- color = null;
- }
- if (getMandatoryFieldBackgroundColor() != color) {
- setMandatoryFieldBackgroundColor(color);
- setBackgroundFromScout(getScoutObject().getBackgroundColor());
- }
- }
- if (getUiLabel() != null) {
- if (getUiLabel().setMandatory(b)) {
- if (isCreated()) {
- RwtLayoutUtility.invalidateLayout(getUiEnvironment(), getUiContainer());
- }
- }
-
- //In case of on field labels it is necessary to recompute the label visibility if the mandatory status changes.
- setLabelVisibleFromScout();
- }
- }
-
- protected void setLabelPositionFromScout() {
- if (getUiField() != null) {
- if (getScoutObject().getLabelPosition() == IFormField.LABEL_POSITION_ON_FIELD) {
- if (m_onFieldLabelDecorator == null) {
- m_onFieldLabelDecorator = new OnFieldLabelDecorator(getUiField(), getScoutObject().isMandatory(), this);
- m_onFieldLabelDecorator.setLabel(getScoutObject().getLabel());
- }
- m_onFieldLabelDecorator.attach(getUiField());
- }
- else {
- if (m_onFieldLabelDecorator != null) {
- m_onFieldLabelDecorator.detach(getUiField());
- }
- }
- getUiField().redraw();
- }
- setLabelVisibleFromScout();
- setLabelFromScout(getScoutObject().getLabel());
- }
-
- protected void setLabelWidthInPixelFromScout() {
- if (getUiLabel() == null) {
- return;
- }
-
- int w = getScoutObject().getLabelWidthInPixel();
- if (w > 0) {
- getUiLabel().setLayoutWidthHint(w);
- }
- else if (w == IFormField.LABEL_WIDTH_DEFAULT) {
- getUiLabel().setLayoutWidthHint(UiDecorationExtensionPoint.getLookAndFeel().getFormFieldLabelWidth());
- }
- else if (w == IFormField.LABEL_WIDTH_UI) {
- getUiLabel().setLayoutWidthHint(0);
- }
- }
-
- protected void setLabelHorizontalAlignmentFromScout() {
- // XXX not supported by swt to dynamically change style of a widget
- }
-
- protected void setLabelFromScout(String s) {
- if (m_onFieldLabelDecorator != null) {
- m_onFieldLabelDecorator.setLabel(s);
- }
- else {
- if (m_label != null && s != null) {
- m_label.setText(s);
- }
- }
- }
-
- protected void setLabelVisibleFromScout() {
- if (m_label == null) {
- return;
- }
-
- boolean visible = getScoutObject().isLabelVisible();
- if (getScoutObject().getLabelPosition() == IFormField.LABEL_POSITION_ON_FIELD) {
- //Make the label as small as possible in order to show the mandatory marker (*).
- m_label.setText(null);
- m_label.setLayoutWidthHint(0);
-
- //Unfortunately the label can't be removed completely by only setting the width hint to 0.
- //So it is necessary to make it invisible if it is really not necessary.
- if (!getScoutObject().isMandatory()) {
- visible = false;
- }
- }
- m_label.setVisible(visible);
- if (getUiContainer() != null) {
- getUiContainer().layout(true, true);
- }
- }
-
- protected void setTooltipTextFromScout(String s) {
- if (getUiField() != null) {
- getUiField().setToolTipText(s);
- }
- }
-
- protected void setBackgroundFromScout(String scoutColor) {
- setBackgroundFromScout(scoutColor, getUiField());
- }
-
- protected void setBackgroundFromScout(String scoutColor, Control field) {
- if (field == null) {
- return;
- }
-
- boolean init = false;
- if (field.getData(CLIENT_PROP_INITIAL_BACKGROUND) == null) {
- field.setData(CLIENT_PROP_INITIAL_BACKGROUND, field.getBackground());
- init = true;
- }
-
- Color color = getMandatoryFieldBackgroundColor();
- if (color != null) {
- field.setBackground(color);
- return;
- }
-
- //Do not change color if not explicitly requested by the scout model.
- if (init && scoutColor == null) {
- return;
- }
-
- Color initCol = (Color) field.getData(CLIENT_PROP_INITIAL_BACKGROUND);
- color = getUiEnvironment().getColor(scoutColor);
-
- if (color == null) {
- color = initCol;
- }
- field.setBackground(color);
- }
-
- protected void setForegroundFromScout(String scoutColor) {
- setForegroundFromScout(scoutColor, getUiField());
- }
-
- protected void setForegroundFromScout(String scoutColor, Control field) {
- if (field == null) {
- return;
- }
-
- boolean init = false;
- if (field.getData(CLIENT_PROP_INITIAL_FOREGROUND) == null) {
- field.setData(CLIENT_PROP_INITIAL_FOREGROUND, field.getForeground());
- init = true;
- }
-
- //Do not change color if not explicitly requested by the scout model.
- if (init && scoutColor == null) {
- return;
- }
-
- Color initCol = (Color) field.getData(CLIENT_PROP_INITIAL_FOREGROUND);
- Color color = getUiEnvironment().getColor(scoutColor);
- if (color == null) {
- color = initCol;
- }
- field.setForeground(color);
- }
-
- protected void setFontFromScout(FontSpec scoutFont) {
- if (getUiField() != null) {
- Control fld = getUiField();
- Font currentFont = fld.getFont();
- if (fld.getData(CLIENT_PROP_INITIAL_FONT) == null) {
- fld.setData(CLIENT_PROP_INITIAL_FONT, currentFont);
- }
- Font initFont = (Font) fld.getData(CLIENT_PROP_INITIAL_FONT);
- Font f = getUiEnvironment().getFont(scoutFont, initFont);
- if (f == null) {
- f = initFont;
- }
- if (currentFont == null || !currentFont.equals(f)) {
- // only set the new font if it is different to the current one
- fld.setFont(f);
- }
- }
- if (isCreated()) {
- RwtLayoutUtility.invalidateLayout(getUiEnvironment(), getUiContainer());
- }
- }
-
- protected void setLabelBackgroundFromScout(String scoutColor) {
- setLabelBackgroundFromScout(scoutColor, getUiLabel());
- }
-
- protected void setLabelBackgroundFromScout(String scoutColor, ILabelComposite field) {
- if (field == null) {
- return;
- }
-
- boolean init = false;
- if (field.getData(CLIENT_PROP_INITIAL_LABEL_BACKGROUND) == null) {
- field.setData(CLIENT_PROP_INITIAL_LABEL_BACKGROUND, field.getBackground());
- init = true;
- }
-
- Color color = getMandatoryFieldBackgroundColor();
- if (color != null) {
- field.setBackground(color);
- return;
- }
-
- //Do not change color if not explicitly requested by the scout model.
- if (init && scoutColor == null) {
- return;
- }
-
- Color initCol = (Color) field.getData(CLIENT_PROP_INITIAL_LABEL_BACKGROUND);
- color = getUiEnvironment().getColor(scoutColor);
-
- if (color == null) {
- color = initCol;
- }
- field.setBackground(color);
- }
-
- protected void setLabelForegroundFromScout(String scoutColor) {
- setLabelForegroundFromScout(scoutColor, getUiLabel());
- }
-
- protected void setLabelForegroundFromScout(String scoutColor, ILabelComposite field) {
- if (field == null) {
- return;
- }
-
- boolean init = false;
- if (field.getData(CLIENT_PROP_INITIAL_LABEL_FOREGROUND) == null) {
- field.setData(CLIENT_PROP_INITIAL_LABEL_FOREGROUND, field.getForeground());
- init = true;
- }
-
- //Do not change color if not explicitly requested by the scout model.
- if (init && scoutColor == null) {
- return;
- }
-
- Color initCol = (Color) field.getData(CLIENT_PROP_INITIAL_LABEL_FOREGROUND);
- Color color = getUiEnvironment().getColor(scoutColor);
- if (color == null) {
- color = initCol;
- }
- field.setForeground(color);
- }
-
- protected void setLabelFontFromScout(FontSpec scoutFont) {
- if (getUiLabel() != null) {
- ILabelComposite fld = getUiLabel();
- Font currentFont = fld.getFont();
- if (fld.getData(CLIENT_PROP_INITIAL_LABEL_FONT) == null) {
- fld.setData(CLIENT_PROP_INITIAL_LABEL_FONT, currentFont);
- }
- Font initFont = (Font) fld.getData(CLIENT_PROP_INITIAL_LABEL_FONT);
- Font f = getUiEnvironment().getFont(scoutFont, initFont);
- if (f == null) {
- f = initFont;
- }
- if (currentFont == null || !currentFont.equals(f)) {
- // only set the new font if it is different to the current one
- fld.setFont(f);
- }
- }
- if (isCreated()) {
- RwtLayoutUtility.invalidateLayout(getUiEnvironment(), getUiContainer());
- }
- }
-
- protected boolean isSelectAllOnFocusEnabled() {
- return UiDecorationExtensionPoint.getLookAndFeel().isFormFieldSelectAllOnFocusEnabled();
- }
-
- protected void setSaveNeededFromScout(boolean b) {
- }
-
- protected void setFocusableFromScout(boolean b) {
- }
-
- protected void updateEmptyFromScout() {
- }
-
- protected void updateKeyStrokesFromScout() {
- // key strokes
- Control widget = getUiContainer();
- if (widget == null) {
- widget = getUiField();
- }
- if (widget != null) {
-
- // remove old
- if (m_keyStrokes != null) {
- for (IRwtKeyStroke uiKeyStroke : m_keyStrokes) {
- getUiEnvironment().removeKeyStroke(widget, uiKeyStroke);
- }
- }
-
- ArrayList<IRwtKeyStroke> newUiKeyStrokes = new ArrayList<IRwtKeyStroke>();
- IKeyStroke[] scoutKeyStrokes = getScoutObject().getKeyStrokes();
- for (IKeyStroke scoutKeyStroke : scoutKeyStrokes) {
- IRwtKeyStroke[] uiStrokes = RwtUtility.getKeyStrokes(scoutKeyStroke, getUiEnvironment());
- for (IRwtKeyStroke uiStroke : uiStrokes) {
- getUiEnvironment().addKeyStroke(widget, uiStroke, false);
- newUiKeyStrokes.add(uiStroke);
- }
- }
- m_keyStrokes = newUiKeyStrokes.toArray(new IRwtKeyStroke[newUiKeyStrokes.size()]);
- }
- }
-
- //runs in scout job
- @Override
- protected boolean isHandleScoutPropertyChange(final String name, final Object newValue) {
- if (name.equals(IFormField.PROP_ENABLED) || name.equals(IFormField.PROP_VISIBLE)) {
- //add immediate change to rwt environment to support TAB traversal to component that changes from disabled to enabled.
- getUiEnvironment().postImmediateUiJob(new Runnable() {
- @Override
- public void run() {
- handleScoutPropertyChange(name, newValue);
- }
- });
- }
- return super.isHandleScoutPropertyChange(name, newValue);
- }
-
- //runs in gui thread
- @Override
- protected void handleScoutPropertyChange(String name, Object newValue) {
- super.handleScoutPropertyChange(name, newValue);
- if (name.equals(IFormField.PROP_ENABLED)) {
- setEnabledFromScout(((Boolean) newValue).booleanValue());
- }
- else if (name.equals(IFormField.PROP_FOCUSABLE)) {
- setFocusableFromScout(((Boolean) newValue).booleanValue());
- }
- else if (name.equals(IFormField.PROP_LABEL)) {
- setLabelFromScout((String) newValue);
- }
- else if (name.equals(IFormField.PROP_LABEL_VISIBLE)) {
- setLabelVisibleFromScout();
- }
- else if (name.equals(IFormField.PROP_TOOLTIP_TEXT)) {
- setTooltipTextFromScout((String) newValue);
- }
- else if (name.equals(IFormField.PROP_VISIBLE)) {
- setVisibleFromScout(((Boolean) newValue).booleanValue());
- }
- else if (name.equals(IFormField.PROP_MANDATORY)) {
- setMandatoryFromScout(((Boolean) newValue).booleanValue());
- }
- else if (name.equals(IFormField.PROP_ERROR_STATUS)) {
- setErrorStatusFromScout((IProcessingStatus) newValue);
- }
- else if (name.equals(IFormField.PROP_FOREGROUND_COLOR)) {
- setForegroundFromScout((String) newValue);
- }
- else if (name.equals(IFormField.PROP_BACKGROUND_COLOR)) {
- setBackgroundFromScout((String) newValue);
- }
- else if (name.equals(IFormField.PROP_FONT)) {
- setFontFromScout((FontSpec) newValue);
- }
- else if (name.equals(IFormField.PROP_LABEL_FOREGROUND_COLOR)) {
- setLabelForegroundFromScout((String) newValue);
- }
- else if (name.equals(IFormField.PROP_LABEL_BACKGROUND_COLOR)) {
- setLabelBackgroundFromScout((String) newValue);
- }
- else if (name.equals(IFormField.PROP_LABEL_FONT)) {
- setLabelFontFromScout((FontSpec) newValue);
- }
- else if (name.equals(IFormField.PROP_SAVE_NEEDED)) {
- setSaveNeededFromScout(((Boolean) newValue).booleanValue());
- }
- else if (name.equals(IFormField.PROP_EMPTY)) {
- updateEmptyFromScout();
- }
- else if (name.equals(IFormField.PROP_KEY_STROKES)) {
- updateKeyStrokesFromScout();
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.form.fields;
+
+import java.util.ArrayList;
+
+import org.eclipse.scout.commons.exception.IProcessingStatus;
+import org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.sequencebox.ISequenceBox;
+import org.eclipse.scout.rt.shared.data.basic.FontSpec;
+import org.eclipse.scout.rt.ui.rap.LogicalGridData;
+import org.eclipse.scout.rt.ui.rap.basic.RwtScoutComposite;
+import org.eclipse.scout.rt.ui.rap.ext.ILabelComposite;
+import org.eclipse.scout.rt.ui.rap.extension.UiDecorationExtensionPoint;
+import org.eclipse.scout.rt.ui.rap.keystroke.IRwtKeyStroke;
+import org.eclipse.scout.rt.ui.rap.util.RwtLayoutUtility;
+import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.widgets.Control;
+
+public abstract class RwtScoutFieldComposite<T extends IFormField> extends RwtScoutComposite<T> implements IRwtScoutFormField<T> {
+
+ protected static final String CLIENT_PROP_INITIAL_LABEL_FONT = "scoutInitialLabelFont";
+ protected static final String CLIENT_PROP_INITIAL_LABEL_BACKGROUND = "scoutInitialLabelBackground";
+ protected static final String CLIENT_PROP_INITIAL_LABEL_FOREGROUND = "scoutInitialLabelForeground";
+
+ private ILabelComposite m_label;
+ private IRwtKeyStroke[] m_keyStrokes;
+
+ private Color m_mandatoryFieldBackgroundColor;
+ private OnFieldLabelDecorator m_onFieldLabelDecorator;
+
+ @Override
+ public ILabelComposite getUiLabel() {
+ return m_label;
+ }
+
+ public OnFieldLabelDecorator getOnFieldLabelDecorator() {
+ return m_onFieldLabelDecorator;
+ }
+
+ protected void setUiLabel(ILabelComposite label) {
+ m_label = label;
+ if (m_label != null && label.getLayoutData() == null) {
+ LogicalGridData statusLabelGridData = null;
+ if (getScoutObject().getLabelPosition() == IFormField.LABEL_POSITION_TOP) {
+ statusLabelGridData = LogicalGridDataBuilder.createLabelOnTop(getScoutObject().getGridData());
+ }
+ else {
+ statusLabelGridData = LogicalGridDataBuilder.createLabel(getScoutObject().getGridData());
+ }
+
+ m_label.setLayoutData(statusLabelGridData);
+ }
+ }
+
+ public Color getMandatoryFieldBackgroundColor() {
+ return m_mandatoryFieldBackgroundColor;
+ }
+
+ protected void setErrorStatusFromScout(IProcessingStatus s) {
+ if (getUiLabel() != null) {
+ getUiLabel().setStatus(s);
+ getUiContainer().layout(true, true);
+ }
+ }
+
+ public void setMandatoryFieldBackgroundColor(Color mandatoryFieldBackgroundColor) {
+ m_mandatoryFieldBackgroundColor = mandatoryFieldBackgroundColor;
+ }
+
+ @Override
+ protected void attachScout() {
+ super.attachScout();
+ if (getScoutObject() != null) {
+ setBackgroundFromScout(getScoutObject().getBackgroundColor());
+ setForegroundFromScout(getScoutObject().getForegroundColor());
+ setLabelBackgroundFromScout(getScoutObject().getLabelBackgroundColor());
+ setLabelForegroundFromScout(getScoutObject().getLabelForegroundColor());
+ setVisibleFromScout(getScoutObject().isVisible());
+ setEnabledFromScout(getScoutObject().isEnabled());
+ // bsh 2010-10-01: The "mandatory" state of a SequenceBoxes is always derived from the
+ // inner fields. Don't use the model value (it will always be false).
+ if (!(getScoutObject() instanceof ISequenceBox)) {
+ setMandatoryFromScout(getScoutObject().isMandatory());
+ }
+ setErrorStatusFromScout(getScoutObject().getErrorStatus());
+ setLabelFromScout(getScoutObject().getLabel());
+ setLabelWidthInPixelFromScout();
+ setLabelVisibleFromScout();
+ setLabelPositionFromScout();
+ setLabelHorizontalAlignmentFromScout();
+ setTooltipTextFromScout(getScoutObject().getTooltipText());
+ if (getScoutObject().getLabelPosition() == IFormField.LABEL_POSITION_ON_FIELD && getScoutObject().getLabel() != null && getScoutObject().getTooltipText() == null) {
+ setTooltipTextFromScout(getScoutObject().getLabel());
+ }
+ setFontFromScout(getScoutObject().getFont());
+ setLabelFontFromScout(getScoutObject().getLabelFont());
+ setSaveNeededFromScout(getScoutObject().isSaveNeeded());
+ setFocusableFromScout(getScoutObject().isFocusable());
+ updateKeyStrokesFromScout();
+ }
+ }
+
+ protected void setVisibleFromScout(boolean b) {
+ boolean updateLayout = false;
+ if (getUiContainer() != null && getUiContainer().getVisible() != b) {
+ updateLayout = true;
+ getUiContainer().setVisible(b);
+ }
+ else if (getUiField() != null && getUiField().getVisible() != b) {
+ updateLayout = true;
+ getUiField().setVisible(b);
+ }
+ if (updateLayout && isCreated()) {
+ RwtLayoutUtility.invalidateLayout(getUiEnvironment(), getUiContainer());
+ }
+ }
+
+ protected void setEnabledFromScout(boolean b) {
+ boolean updateLayout = false;
+ Control field = getUiField();
+ if (field != null) {
+ updateLayout = true;
+ setFieldEnabled(field, b);
+ if (b) {
+ setForegroundFromScout(getScoutObject().getForegroundColor());
+ }
+ else {
+ setForegroundFromScout(UiDecorationExtensionPoint.getLookAndFeel().getColorForegroundDisabled());
+ }
+ }
+ if (getUiLabel() != null) {
+ if (getUiLabel().getEnabled() != b) {
+ updateLayout = true;
+ getUiLabel().setEnabled(b);
+ }
+ }
+ if (updateLayout && isCreated()) {
+ RwtLayoutUtility.invalidateLayout(getUiEnvironment(), getUiContainer());
+ }
+ }
+
+ /**
+ * used to change enabled into read only
+ *
+ * @param field
+ * @param enabled
+ */
+ protected void setFieldEnabled(Control field, boolean enabled) {
+ field.setEnabled(enabled);
+ }
+
+ protected void setMandatoryFromScout(boolean b) {
+ String fieldBackgroundColorString = UiDecorationExtensionPoint.getLookAndFeel().getMandatoryFieldBackgroundColor();
+ if (fieldBackgroundColorString != null) {
+ Color color = null;
+ if (b) {
+ color = getUiEnvironment().getColor(fieldBackgroundColorString);
+ }
+ else {
+ color = null;
+ }
+ if (getMandatoryFieldBackgroundColor() != color) {
+ setMandatoryFieldBackgroundColor(color);
+ setBackgroundFromScout(getScoutObject().getBackgroundColor());
+ }
+ }
+ if (getUiLabel() != null) {
+ if (getUiLabel().setMandatory(b)) {
+ if (isCreated()) {
+ RwtLayoutUtility.invalidateLayout(getUiEnvironment(), getUiContainer());
+ }
+ }
+
+ //In case of on field labels it is necessary to recompute the label visibility if the mandatory status changes.
+ setLabelVisibleFromScout();
+ }
+ }
+
+ protected void setLabelPositionFromScout() {
+ if (getUiField() != null) {
+ if (getScoutObject().getLabelPosition() == IFormField.LABEL_POSITION_ON_FIELD) {
+ if (m_onFieldLabelDecorator == null) {
+ m_onFieldLabelDecorator = new OnFieldLabelDecorator(getUiField(), getScoutObject().isMandatory(), this);
+ m_onFieldLabelDecorator.setLabel(getScoutObject().getLabel());
+ }
+ m_onFieldLabelDecorator.attach(getUiField());
+ }
+ else {
+ if (m_onFieldLabelDecorator != null) {
+ m_onFieldLabelDecorator.detach(getUiField());
+ }
+ }
+ getUiField().redraw();
+ }
+ setLabelVisibleFromScout();
+ setLabelFromScout(getScoutObject().getLabel());
+ }
+
+ protected void setLabelWidthInPixelFromScout() {
+ if (getUiLabel() == null) {
+ return;
+ }
+
+ int w = getScoutObject().getLabelWidthInPixel();
+ if (w > 0) {
+ getUiLabel().setLayoutWidthHint(w);
+ }
+ else if (w == IFormField.LABEL_WIDTH_DEFAULT) {
+ getUiLabel().setLayoutWidthHint(UiDecorationExtensionPoint.getLookAndFeel().getFormFieldLabelWidth());
+ }
+ else if (w == IFormField.LABEL_WIDTH_UI) {
+ getUiLabel().setLayoutWidthHint(0);
+ }
+ }
+
+ protected void setLabelHorizontalAlignmentFromScout() {
+ // XXX not supported by swt to dynamically change style of a widget
+ }
+
+ protected void setLabelFromScout(String s) {
+ if (m_onFieldLabelDecorator != null) {
+ m_onFieldLabelDecorator.setLabel(s);
+ }
+ else {
+ if (m_label != null && s != null) {
+ m_label.setText(s);
+ }
+ }
+ }
+
+ protected void setLabelVisibleFromScout() {
+ if (m_label == null) {
+ return;
+ }
+
+ boolean visible = getScoutObject().isLabelVisible();
+ if (getScoutObject().getLabelPosition() == IFormField.LABEL_POSITION_ON_FIELD) {
+ //Make the label as small as possible in order to show the mandatory marker (*).
+ m_label.setText(null);
+ m_label.setLayoutWidthHint(0);
+
+ //Unfortunately the label can't be removed completely by only setting the width hint to 0.
+ //So it is necessary to make it invisible if it is really not necessary.
+ if (!getScoutObject().isMandatory()) {
+ visible = false;
+ }
+ }
+ m_label.setVisible(visible);
+ if (getUiContainer() != null) {
+ getUiContainer().layout(true, true);
+ }
+ }
+
+ protected void setTooltipTextFromScout(String s) {
+ if (getUiField() != null) {
+ getUiField().setToolTipText(s);
+ }
+ }
+
+ protected void setBackgroundFromScout(String scoutColor) {
+ setBackgroundFromScout(scoutColor, getUiField());
+ }
+
+ protected void setBackgroundFromScout(String scoutColor, Control field) {
+ if (field == null) {
+ return;
+ }
+
+ boolean init = false;
+ if (field.getData(CLIENT_PROP_INITIAL_BACKGROUND) == null) {
+ field.setData(CLIENT_PROP_INITIAL_BACKGROUND, field.getBackground());
+ init = true;
+ }
+
+ Color color = getMandatoryFieldBackgroundColor();
+ if (color != null) {
+ field.setBackground(color);
+ return;
+ }
+
+ //Do not change color if not explicitly requested by the scout model.
+ if (init && scoutColor == null) {
+ return;
+ }
+
+ Color initCol = (Color) field.getData(CLIENT_PROP_INITIAL_BACKGROUND);
+ color = getUiEnvironment().getColor(scoutColor);
+
+ if (color == null) {
+ color = initCol;
+ }
+ field.setBackground(color);
+ }
+
+ protected void setForegroundFromScout(String scoutColor) {
+ setForegroundFromScout(scoutColor, getUiField());
+ }
+
+ protected void setForegroundFromScout(String scoutColor, Control field) {
+ if (field == null) {
+ return;
+ }
+
+ boolean init = false;
+ if (field.getData(CLIENT_PROP_INITIAL_FOREGROUND) == null) {
+ field.setData(CLIENT_PROP_INITIAL_FOREGROUND, field.getForeground());
+ init = true;
+ }
+
+ //Do not change color if not explicitly requested by the scout model.
+ if (init && scoutColor == null) {
+ return;
+ }
+
+ Color initCol = (Color) field.getData(CLIENT_PROP_INITIAL_FOREGROUND);
+ Color color = getUiEnvironment().getColor(scoutColor);
+ if (color == null) {
+ color = initCol;
+ }
+ field.setForeground(color);
+ }
+
+ protected void setFontFromScout(FontSpec scoutFont) {
+ if (getUiField() != null) {
+ Control fld = getUiField();
+ Font currentFont = fld.getFont();
+ if (fld.getData(CLIENT_PROP_INITIAL_FONT) == null) {
+ fld.setData(CLIENT_PROP_INITIAL_FONT, currentFont);
+ }
+ Font initFont = (Font) fld.getData(CLIENT_PROP_INITIAL_FONT);
+ Font f = getUiEnvironment().getFont(scoutFont, initFont);
+ if (f == null) {
+ f = initFont;
+ }
+ if (currentFont == null || !currentFont.equals(f)) {
+ // only set the new font if it is different to the current one
+ fld.setFont(f);
+ }
+ }
+ if (isCreated()) {
+ RwtLayoutUtility.invalidateLayout(getUiEnvironment(), getUiContainer());
+ }
+ }
+
+ protected void setLabelBackgroundFromScout(String scoutColor) {
+ setLabelBackgroundFromScout(scoutColor, getUiLabel());
+ }
+
+ protected void setLabelBackgroundFromScout(String scoutColor, ILabelComposite field) {
+ if (field == null) {
+ return;
+ }
+
+ boolean init = false;
+ if (field.getData(CLIENT_PROP_INITIAL_LABEL_BACKGROUND) == null) {
+ field.setData(CLIENT_PROP_INITIAL_LABEL_BACKGROUND, field.getBackground());
+ init = true;
+ }
+
+ Color color = getMandatoryFieldBackgroundColor();
+ if (color != null) {
+ field.setBackground(color);
+ return;
+ }
+
+ //Do not change color if not explicitly requested by the scout model.
+ if (init && scoutColor == null) {
+ return;
+ }
+
+ Color initCol = (Color) field.getData(CLIENT_PROP_INITIAL_LABEL_BACKGROUND);
+ color = getUiEnvironment().getColor(scoutColor);
+
+ if (color == null) {
+ color = initCol;
+ }
+ field.setBackground(color);
+ }
+
+ protected void setLabelForegroundFromScout(String scoutColor) {
+ setLabelForegroundFromScout(scoutColor, getUiLabel());
+ }
+
+ protected void setLabelForegroundFromScout(String scoutColor, ILabelComposite field) {
+ if (field == null) {
+ return;
+ }
+
+ boolean init = false;
+ if (field.getData(CLIENT_PROP_INITIAL_LABEL_FOREGROUND) == null) {
+ field.setData(CLIENT_PROP_INITIAL_LABEL_FOREGROUND, field.getForeground());
+ init = true;
+ }
+
+ //Do not change color if not explicitly requested by the scout model.
+ if (init && scoutColor == null) {
+ return;
+ }
+
+ Color initCol = (Color) field.getData(CLIENT_PROP_INITIAL_LABEL_FOREGROUND);
+ Color color = getUiEnvironment().getColor(scoutColor);
+ if (color == null) {
+ color = initCol;
+ }
+ field.setForeground(color);
+ }
+
+ protected void setLabelFontFromScout(FontSpec scoutFont) {
+ if (getUiLabel() != null) {
+ ILabelComposite fld = getUiLabel();
+ Font currentFont = fld.getFont();
+ if (fld.getData(CLIENT_PROP_INITIAL_LABEL_FONT) == null) {
+ fld.setData(CLIENT_PROP_INITIAL_LABEL_FONT, currentFont);
+ }
+ Font initFont = (Font) fld.getData(CLIENT_PROP_INITIAL_LABEL_FONT);
+ Font f = getUiEnvironment().getFont(scoutFont, initFont);
+ if (f == null) {
+ f = initFont;
+ }
+ if (currentFont == null || !currentFont.equals(f)) {
+ // only set the new font if it is different to the current one
+ fld.setFont(f);
+ }
+ }
+ if (isCreated()) {
+ RwtLayoutUtility.invalidateLayout(getUiEnvironment(), getUiContainer());
+ }
+ }
+
+ protected boolean isSelectAllOnFocusEnabled() {
+ return UiDecorationExtensionPoint.getLookAndFeel().isFormFieldSelectAllOnFocusEnabled();
+ }
+
+ protected void setSaveNeededFromScout(boolean b) {
+ }
+
+ protected void setFocusableFromScout(boolean b) {
+ }
+
+ protected void updateEmptyFromScout() {
+ }
+
+ protected void updateKeyStrokesFromScout() {
+ // key strokes
+ Control widget = getUiContainer();
+ if (widget == null) {
+ widget = getUiField();
+ }
+ if (widget != null) {
+
+ // remove old
+ if (m_keyStrokes != null) {
+ for (IRwtKeyStroke uiKeyStroke : m_keyStrokes) {
+ getUiEnvironment().removeKeyStroke(widget, uiKeyStroke);
+ }
+ }
+
+ ArrayList<IRwtKeyStroke> newUiKeyStrokes = new ArrayList<IRwtKeyStroke>();
+ IKeyStroke[] scoutKeyStrokes = getScoutObject().getKeyStrokes();
+ for (IKeyStroke scoutKeyStroke : scoutKeyStrokes) {
+ IRwtKeyStroke[] uiStrokes = RwtUtility.getKeyStrokes(scoutKeyStroke, getUiEnvironment());
+ for (IRwtKeyStroke uiStroke : uiStrokes) {
+ getUiEnvironment().addKeyStroke(widget, uiStroke, false);
+ newUiKeyStrokes.add(uiStroke);
+ }
+ }
+ m_keyStrokes = newUiKeyStrokes.toArray(new IRwtKeyStroke[newUiKeyStrokes.size()]);
+ }
+ }
+
+ //runs in scout job
+ @Override
+ protected boolean isHandleScoutPropertyChange(final String name, final Object newValue) {
+ if (name.equals(IFormField.PROP_ENABLED) || name.equals(IFormField.PROP_VISIBLE)) {
+ //add immediate change to rwt environment to support TAB traversal to component that changes from disabled to enabled.
+ getUiEnvironment().postImmediateUiJob(new Runnable() {
+ @Override
+ public void run() {
+ handleScoutPropertyChange(name, newValue);
+ }
+ });
+ }
+ return super.isHandleScoutPropertyChange(name, newValue);
+ }
+
+ //runs in gui thread
+ @Override
+ protected void handleScoutPropertyChange(String name, Object newValue) {
+ super.handleScoutPropertyChange(name, newValue);
+ if (name.equals(IFormField.PROP_ENABLED)) {
+ setEnabledFromScout(((Boolean) newValue).booleanValue());
+ }
+ else if (name.equals(IFormField.PROP_FOCUSABLE)) {
+ setFocusableFromScout(((Boolean) newValue).booleanValue());
+ }
+ else if (name.equals(IFormField.PROP_LABEL)) {
+ setLabelFromScout((String) newValue);
+ }
+ else if (name.equals(IFormField.PROP_LABEL_VISIBLE)) {
+ setLabelVisibleFromScout();
+ }
+ else if (name.equals(IFormField.PROP_TOOLTIP_TEXT)) {
+ setTooltipTextFromScout((String) newValue);
+ }
+ else if (name.equals(IFormField.PROP_VISIBLE)) {
+ setVisibleFromScout(((Boolean) newValue).booleanValue());
+ }
+ else if (name.equals(IFormField.PROP_MANDATORY)) {
+ setMandatoryFromScout(((Boolean) newValue).booleanValue());
+ }
+ else if (name.equals(IFormField.PROP_ERROR_STATUS)) {
+ setErrorStatusFromScout((IProcessingStatus) newValue);
+ }
+ else if (name.equals(IFormField.PROP_FOREGROUND_COLOR)) {
+ setForegroundFromScout((String) newValue);
+ }
+ else if (name.equals(IFormField.PROP_BACKGROUND_COLOR)) {
+ setBackgroundFromScout((String) newValue);
+ }
+ else if (name.equals(IFormField.PROP_FONT)) {
+ setFontFromScout((FontSpec) newValue);
+ }
+ else if (name.equals(IFormField.PROP_LABEL_FOREGROUND_COLOR)) {
+ setLabelForegroundFromScout((String) newValue);
+ }
+ else if (name.equals(IFormField.PROP_LABEL_BACKGROUND_COLOR)) {
+ setLabelBackgroundFromScout((String) newValue);
+ }
+ else if (name.equals(IFormField.PROP_LABEL_FONT)) {
+ setLabelFontFromScout((FontSpec) newValue);
+ }
+ else if (name.equals(IFormField.PROP_SAVE_NEEDED)) {
+ setSaveNeededFromScout(((Boolean) newValue).booleanValue());
+ }
+ else if (name.equals(IFormField.PROP_EMPTY)) {
+ updateEmptyFromScout();
+ }
+ else if (name.equals(IFormField.PROP_KEY_STROKES)) {
+ updateKeyStrokesFromScout();
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/RwtScoutFormFieldGridData.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/RwtScoutFormFieldGridData.java
index 0ee0744d52..975a50b353 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/RwtScoutFormFieldGridData.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/RwtScoutFormFieldGridData.java
@@ -1,117 +1,117 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.form.fields;
-
-import org.eclipse.scout.rt.client.ui.form.fields.GridData;
-import org.eclipse.scout.rt.client.ui.form.fields.ICompositeField;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.ui.rap.LogicalGridData;
-
-public class RwtScoutFormFieldGridData extends LogicalGridData {
- private IFormField m_scoutField;
-
- public RwtScoutFormFieldGridData(IFormField scoutField) {
- m_scoutField = scoutField;
- }
-
- @Override
- public void validate() {
- GridData data = m_scoutField.getGridData();
- // setup constraints
- RwtScoutFormFieldGridData gc = this;
- gc.gridx = data.x;
- gc.gridy = data.y;
- gc.gridw = data.w;
- gc.gridh = data.h;
- gc.weightx = data.weightX;
- gc.weighty = data.weightY;
- if (gc.weightx < 0) {
- // inherit
- gc.weightx = Math.max(1.0, gc.gridw);
- }
- if (gc.weighty < 0) {
- // inherit
- gc.weighty = inheritWeightY(m_scoutField);
- }
- gc.useUiWidth = data.useUiWidth;
-
- //When having the label on top the container of the field must not have a fix size but use the calculated ui height instead.
- if (m_scoutField.getLabelPosition() == IFormField.LABEL_POSITION_TOP) {
- gc.useUiHeight = true;
- }
- else {
- gc.useUiHeight = data.useUiHeight;
- }
-
- gc.horizontalAlignment = data.horizontalAlignment;
- gc.verticalAlignment = data.verticalAlignment;
- gc.fillHorizontal = data.fillHorizontal;
- gc.fillVertical = data.fillVertical;
- gc.widthHint = data.widthInPixel;
- gc.heightHint = data.heightInPixel;
- if (gc.weighty == 0 || gc.weighty < 0 && gc.gridh <= 1) {
- gc.fillVertical = false;
- }
- }
-
- private Double inheritWeightY(IFormField f) {
- Double d = inheritWeightYRec(f);
- if (d == null) {
- GridData data = f.getGridData();
- if (data.weightY >= 0) {
- d = data.weightY;
- }
- else {
- d = (double) (data.h >= 2 ? data.h : 0);
- }
- }
- return d;
- }
-
- private Double inheritWeightYRec(IFormField f) {
- boolean found = false;
- double sumWy = 0;
- if (f instanceof ICompositeField) {
- for (IFormField child : ((ICompositeField) f).getFields()) {
- if (child.isVisible()) {
- GridData data = child.getGridData();
- if (data.weightY < 0) {
- Double inheritWeightY = inheritWeightYRec(child);
- if (inheritWeightY != null) {
- found = true;
- sumWy += inheritWeightY;
- }
- }
- else {
- found = true;
- sumWy += data.weightY;
- }
- }
- }
- }
- else {
- sumWy = f.getGridData().h >= 2 ? f.getGridData().h : 0;
- found = true;
- }
- if (found) {
- return sumWy;
- }
- else {
- return null;
- }
- }
-
- @Override
- public String toString() {
- return m_scoutField.getLabel() + ": " + super.toString();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.form.fields;
+
+import org.eclipse.scout.rt.client.ui.form.fields.GridData;
+import org.eclipse.scout.rt.client.ui.form.fields.ICompositeField;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.ui.rap.LogicalGridData;
+
+public class RwtScoutFormFieldGridData extends LogicalGridData {
+ private IFormField m_scoutField;
+
+ public RwtScoutFormFieldGridData(IFormField scoutField) {
+ m_scoutField = scoutField;
+ }
+
+ @Override
+ public void validate() {
+ GridData data = m_scoutField.getGridData();
+ // setup constraints
+ RwtScoutFormFieldGridData gc = this;
+ gc.gridx = data.x;
+ gc.gridy = data.y;
+ gc.gridw = data.w;
+ gc.gridh = data.h;
+ gc.weightx = data.weightX;
+ gc.weighty = data.weightY;
+ if (gc.weightx < 0) {
+ // inherit
+ gc.weightx = Math.max(1.0, gc.gridw);
+ }
+ if (gc.weighty < 0) {
+ // inherit
+ gc.weighty = inheritWeightY(m_scoutField);
+ }
+ gc.useUiWidth = data.useUiWidth;
+
+ //When having the label on top the container of the field must not have a fix size but use the calculated ui height instead.
+ if (m_scoutField.getLabelPosition() == IFormField.LABEL_POSITION_TOP) {
+ gc.useUiHeight = true;
+ }
+ else {
+ gc.useUiHeight = data.useUiHeight;
+ }
+
+ gc.horizontalAlignment = data.horizontalAlignment;
+ gc.verticalAlignment = data.verticalAlignment;
+ gc.fillHorizontal = data.fillHorizontal;
+ gc.fillVertical = data.fillVertical;
+ gc.widthHint = data.widthInPixel;
+ gc.heightHint = data.heightInPixel;
+ if (gc.weighty == 0 || gc.weighty < 0 && gc.gridh <= 1) {
+ gc.fillVertical = false;
+ }
+ }
+
+ private Double inheritWeightY(IFormField f) {
+ Double d = inheritWeightYRec(f);
+ if (d == null) {
+ GridData data = f.getGridData();
+ if (data.weightY >= 0) {
+ d = data.weightY;
+ }
+ else {
+ d = (double) (data.h >= 2 ? data.h : 0);
+ }
+ }
+ return d;
+ }
+
+ private Double inheritWeightYRec(IFormField f) {
+ boolean found = false;
+ double sumWy = 0;
+ if (f instanceof ICompositeField) {
+ for (IFormField child : ((ICompositeField) f).getFields()) {
+ if (child.isVisible()) {
+ GridData data = child.getGridData();
+ if (data.weightY < 0) {
+ Double inheritWeightY = inheritWeightYRec(child);
+ if (inheritWeightY != null) {
+ found = true;
+ sumWy += inheritWeightY;
+ }
+ }
+ else {
+ found = true;
+ sumWy += data.weightY;
+ }
+ }
+ }
+ }
+ else {
+ sumWy = f.getGridData().h >= 2 ? f.getGridData().h : 0;
+ found = true;
+ }
+ if (found) {
+ return sumWy;
+ }
+ else {
+ return null;
+ }
+ }
+
+ @Override
+ public String toString() {
+ return m_scoutField.getLabel() + ": " + super.toString();
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/RwtScoutUnknownControl.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/RwtScoutUnknownControl.java
index c6ca06fae6..a5de0cda1b 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/RwtScoutUnknownControl.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/RwtScoutUnknownControl.java
@@ -1,37 +1,37 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.form.fields;
-
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.ui.rap.LogicalGridLayout;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-
-public class RwtScoutUnknownControl extends RwtScoutFieldComposite<IFormField> {
-
- private Label l;
-
- @Override
- protected void initializeUi(Composite parent) {
- Composite container = new Composite(parent, SWT.NONE);
- container.setData("ScoutObject", getScoutObject());
- l = new Label(container, SWT.NONE);
- l.setBackground(l.getDisplay().getSystemColor(SWT.COLOR_YELLOW));
- l.setText("name:" + getScoutObject().getClass().getSimpleName());
-
- setUiContainer(container);
- setUiField(l);
- // layout
- container.setLayout(new LogicalGridLayout(1, 0));
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.form.fields;
+
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.ui.rap.LogicalGridLayout;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+
+public class RwtScoutUnknownControl extends RwtScoutFieldComposite<IFormField> {
+
+ private Label l;
+
+ @Override
+ protected void initializeUi(Composite parent) {
+ Composite container = new Composite(parent, SWT.NONE);
+ container.setData("ScoutObject", getScoutObject());
+ l = new Label(container, SWT.NONE);
+ l.setBackground(l.getDisplay().getSystemColor(SWT.COLOR_YELLOW));
+ l.setText("name:" + getScoutObject().getClass().getSimpleName());
+
+ setUiContainer(container);
+ setUiField(l);
+ // layout
+ container.setLayout(new LogicalGridLayout(1, 0));
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/RwtScoutValueFieldComposite.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/RwtScoutValueFieldComposite.java
index 57d2638707..ad8bc1aec8 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/RwtScoutValueFieldComposite.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/RwtScoutValueFieldComposite.java
@@ -1,82 +1,82 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.form.fields;
-
-import org.eclipse.rwt.lifecycle.WidgetUtil;
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
-import org.eclipse.scout.rt.client.ui.form.fields.stringfield.IStringField;
-import org.eclipse.scout.rt.ui.rap.ext.TextEx;
-import org.eclipse.scout.rt.ui.rap.ext.custom.StyledText;
-import org.eclipse.swt.widgets.Control;
-
-/**
- * <h3>RwtScoutValueFieldComposite</h3> ...
- *
- * @since 3.7.0 June 2011
- * @param <T>
- */
-public abstract class RwtScoutValueFieldComposite<T extends IValueField<?>> extends RwtScoutFieldComposite<T> {
-
- @Override
- protected void attachScout() {
- super.attachScout();
- setValueFromScout();
- setDisplayTextFromScout(getScoutObject().getDisplayText());
- if (getOnFieldLabelDecorator() != null) {
- setOnFieldLabelFromScout(getScoutObject().getDisplayText(), getScoutObject().getLabel());
- }
- }
-
- protected void setValueFromScout() {
- }
-
- protected void setDisplayTextFromScout(String s) {
- }
-
- public void setOnFieldLabelFromScout(String text, String label) {
- if (text == null || text.length() == 0) {
- if (getUiField() != null && getUiField() instanceof StyledText) {
- Integer length = (Integer) getScoutObject().getCustomProperty(IStringField.PROP_MAX_LENGTH);
- if (length != null && label.length() > 0) {
- if (length < label.length()) {
- ((StyledText) getUiField()).setTextLimit(label.length());
- }
- }
- ((TextEx) getUiField()).setOnFieldLabel(label);
- getUiField().setData(WidgetUtil.CUSTOM_VARIANT, "onFieldLabel");
- }
- }
- else if (getUiField() instanceof Control) {
- Integer length = (Integer) getScoutObject().getCustomProperty(IStringField.PROP_MAX_LENGTH);
- if (length != null) {
- ((TextEx) getUiField()).setTextLimit(length);
- }
- getUiField().setData(WidgetUtil.CUSTOM_VARIANT, null);
- }
- }
-
- @Override
- protected void handleScoutPropertyChange(String name, Object newValue) {
- super.handleScoutPropertyChange(name, newValue);
- if (name.equals(IValueField.PROP_DISPLAY_TEXT)) {
- String displayText = (String) newValue;
- setDisplayTextFromScout(displayText);
- if (getOnFieldLabelDecorator() != null && StringUtility.hasText(displayText) && CompareUtility.notEquals(displayText, getScoutObject().getLabel())) {
- setOnFieldLabelFromScout(displayText, getScoutObject().getLabel());
- }
- }
- else if (name.equals(IValueField.PROP_VALUE)) {
- setValueFromScout();
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.form.fields;
+
+import org.eclipse.rwt.lifecycle.WidgetUtil;
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
+import org.eclipse.scout.rt.client.ui.form.fields.stringfield.IStringField;
+import org.eclipse.scout.rt.ui.rap.ext.TextEx;
+import org.eclipse.scout.rt.ui.rap.ext.custom.StyledText;
+import org.eclipse.swt.widgets.Control;
+
+/**
+ * <h3>RwtScoutValueFieldComposite</h3> ...
+ *
+ * @since 3.7.0 June 2011
+ * @param <T>
+ */
+public abstract class RwtScoutValueFieldComposite<T extends IValueField<?>> extends RwtScoutFieldComposite<T> {
+
+ @Override
+ protected void attachScout() {
+ super.attachScout();
+ setValueFromScout();
+ setDisplayTextFromScout(getScoutObject().getDisplayText());
+ if (getOnFieldLabelDecorator() != null) {
+ setOnFieldLabelFromScout(getScoutObject().getDisplayText(), getScoutObject().getLabel());
+ }
+ }
+
+ protected void setValueFromScout() {
+ }
+
+ protected void setDisplayTextFromScout(String s) {
+ }
+
+ public void setOnFieldLabelFromScout(String text, String label) {
+ if (text == null || text.length() == 0) {
+ if (getUiField() != null && getUiField() instanceof StyledText) {
+ Integer length = (Integer) getScoutObject().getCustomProperty(IStringField.PROP_MAX_LENGTH);
+ if (length != null && label.length() > 0) {
+ if (length < label.length()) {
+ ((StyledText) getUiField()).setTextLimit(label.length());
+ }
+ }
+ ((TextEx) getUiField()).setOnFieldLabel(label);
+ getUiField().setData(WidgetUtil.CUSTOM_VARIANT, "onFieldLabel");
+ }
+ }
+ else if (getUiField() instanceof Control) {
+ Integer length = (Integer) getScoutObject().getCustomProperty(IStringField.PROP_MAX_LENGTH);
+ if (length != null) {
+ ((TextEx) getUiField()).setTextLimit(length);
+ }
+ getUiField().setData(WidgetUtil.CUSTOM_VARIANT, null);
+ }
+ }
+
+ @Override
+ protected void handleScoutPropertyChange(String name, Object newValue) {
+ super.handleScoutPropertyChange(name, newValue);
+ if (name.equals(IValueField.PROP_DISPLAY_TEXT)) {
+ String displayText = (String) newValue;
+ setDisplayTextFromScout(displayText);
+ if (getOnFieldLabelDecorator() != null && StringUtility.hasText(displayText) && CompareUtility.notEquals(displayText, getScoutObject().getLabel())) {
+ setOnFieldLabelFromScout(displayText, getScoutObject().getLabel());
+ }
+ }
+ else if (name.equals(IValueField.PROP_VALUE)) {
+ setValueFromScout();
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/browserfield/IRwtScoutBrowserField.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/browserfield/IRwtScoutBrowserField.java
index c35227abb3..10c2aa7f3c 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/browserfield/IRwtScoutBrowserField.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/browserfield/IRwtScoutBrowserField.java
@@ -1,26 +1,26 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.form.fields.browserfield;
-
-import org.eclipse.scout.rt.client.ui.form.fields.browserfield.IBrowserField;
-import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * <h3>IRwtScoutHtmlField</h3> ...
- *
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.form.fields.browserfield;
+
+import org.eclipse.scout.rt.client.ui.form.fields.browserfield.IBrowserField;
+import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * <h3>IRwtScoutHtmlField</h3> ...
+ *
* @since 3.7.0 June 2011
- */
-public interface IRwtScoutBrowserField extends IRwtScoutFormField<IBrowserField> {
-
- @Override
- Composite getUiField();
-}
+ */
+public interface IRwtScoutBrowserField extends IRwtScoutFormField<IBrowserField> {
+
+ @Override
+ Composite getUiField();
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/browserfield/RwtScoutBrowserField.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/browserfield/RwtScoutBrowserField.java
index e11595a298..470f31abc0 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/browserfield/RwtScoutBrowserField.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/browserfield/RwtScoutBrowserField.java
@@ -1,207 +1,207 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.form.fields.browserfield;
-
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStreamReader;
-import java.util.concurrent.atomic.AtomicReference;
-
-import org.eclipse.scout.commons.IOUtility;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.form.fields.browserfield.IBrowserField;
-import org.eclipse.scout.rt.shared.services.common.file.RemoteFile;
-import org.eclipse.scout.rt.ui.rap.LogicalGridLayout;
-import org.eclipse.scout.rt.ui.rap.ext.StatusLabelEx;
-import org.eclipse.scout.rt.ui.rap.ext.browser.BrowserExtension;
-import org.eclipse.scout.rt.ui.rap.form.fields.RwtScoutValueFieldComposite;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.browser.Browser;
-import org.eclipse.swt.browser.LocationAdapter;
-import org.eclipse.swt.browser.LocationEvent;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.widgets.Composite;
-
-public class RwtScoutBrowserField extends RwtScoutValueFieldComposite<IBrowserField> implements IRwtScoutBrowserField {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(RwtScoutBrowserField.class);
-
- private String m_currentLocation;
- private BrowserExtension m_browserExtension;
-
- public RwtScoutBrowserField() {
- }
-
- @Override
- protected void initializeUi(Composite parent) {
- Composite container = getUiEnvironment().getFormToolkit().createComposite(parent);
- StatusLabelEx label = getUiEnvironment().getFormToolkit().createStatusLabel(container, getScoutObject());
-
- Browser browser = getUiEnvironment().getFormToolkit().createBrowser(container, SWT.NONE);
- m_browserExtension = new BrowserExtension(browser);
- m_browserExtension.attach();
- browser.addDisposeListener(new DisposeListener() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void widgetDisposed(DisposeEvent e) {
- m_browserExtension.detach();
- }
- });
- browser.addLocationListener(new LocationAdapter() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void changing(LocationEvent event) {
- event.doit = fireBeforeLocationChangedFromUi(event.location);
- }
-
- @Override
- public void changed(LocationEvent event) {
- fireAfterLocationChangedFromUi(event.location);
- }
- });
- //
- setUiContainer(container);
- setUiLabel(label);
- setUiField(browser);
- // layout
- getUiContainer().setLayout(new LogicalGridLayout(1, 0));
- }
-
- @Override
- public Browser getUiField() {
- return (Browser) super.getUiField();
- }
-
- @Override
- protected void handleScoutPropertyChange(String name, Object newValue) {
- super.handleScoutPropertyChange(name, newValue);
- if (IBrowserField.PROP_LOCATION.equals(name)) {
- setLocationFromScout();
- }
- }
-
- @Override
- protected void setValueFromScout() {
- setLocationFromScout();
- }
-
- protected void setLocationFromScout() {
- m_browserExtension.clearResourceCache();
- m_browserExtension.clearLocalHyperlinkCache();
- String location = getScoutObject().getLocation();
- RemoteFile r = getScoutObject().getValue();
- if (location == null && r != null && r.exists()) {
- try {
- if (r.getName().matches(".*\\.(zip|jar)")) {
- File tempDir = IOUtility.createTempDirectory("browser");
- try {
- r.writeZipContentToDirectory(tempDir);
- String simpleName = r.getName().replaceAll("\\.(zip|jar)", ".htm");
- //rewrite local urls and register resource
- int prefixLen = tempDir.getAbsolutePath().length() + 1;
- for (File f : IOUtility.listFilesInSubtree(tempDir, null)) {
- if (f.isFile()) {
- String path = f.getAbsolutePath().substring(prefixLen);
- if (path.toLowerCase().matches(".*\\.(htm|html)")) {
- String content = IOUtility.getContent(new InputStreamReader(new FileInputStream(f)));
- content = m_browserExtension.adaptLocalHyperlinks(content, 1);
- if (location == null && path.startsWith(simpleName)) {
- //this is the index.html
- location = m_browserExtension.addResource(simpleName, new ByteArrayInputStream(content.getBytes("UTF-8")));
- }
- else {
- m_browserExtension.addResource(path, new ByteArrayInputStream(content.getBytes("UTF-8")));
- }
- }
- else if (path.toLowerCase().matches(".*\\.(svg)")) {
- String content = IOUtility.getContent(new InputStreamReader(new FileInputStream(f)));
- content = m_browserExtension.adaptLocalHyperlinks(content, 1);
- m_browserExtension.addResource(path, new ByteArrayInputStream(content.getBytes("UTF-8")));
- }
- else {
- m_browserExtension.addResource(path, new FileInputStream(f));
- }
- }
- }
- }
- finally {
- if (tempDir != null) {
- IOUtility.deleteDirectory(tempDir);
- }
- }
- }
- else {
- //rewrite local urls
- String content = IOUtility.getContent(r.getDecompressedReader());
- content = m_browserExtension.adaptLocalHyperlinks(content, 1);
- location = m_browserExtension.addResource(r.getName(), new ByteArrayInputStream(content.getBytes("UTF-8")));
- }
- }
- catch (Throwable t) {
- LOG.error("preparing html content for " + r, t);
- }
- }
- m_currentLocation = location;
- if (m_currentLocation != null) {
- getUiField().setUrl(m_currentLocation);
- }
- else {
- getUiField().setText("");
- }
- }
-
- @Override
- protected void setEnabledFromScout(boolean b) {
- //nop
- }
-
- protected boolean fireBeforeLocationChangedFromUi(final String location) {
- final AtomicReference<Boolean> accept = new AtomicReference<Boolean>();
- synchronized (accept) {
- // notify Scout
- Runnable t = new Runnable() {
- @Override
- public void run() {
- synchronized (accept) {
- accept.set(getScoutObject().getUIFacade().fireBeforeLocationChangedFromUI(location));
- accept.notifyAll();
- }
- }
- };
- getUiEnvironment().invokeScoutLater(t, 0);
- // end notify
- //wait at most 10 seconds
- try {
- accept.wait(10000L);
- }
- catch (InterruptedException e) {
- //nop
- }
- }
- return accept.get() != null ? accept.get().booleanValue() : false;
- }
-
- protected void fireAfterLocationChangedFromUi(final String location) {
- // notify Scout
- Runnable t = new Runnable() {
- @Override
- public void run() {
- getScoutObject().getUIFacade().fireAfterLocationChangedFromUI(location);
- }
- };
- getUiEnvironment().invokeScoutLater(t, 0);
- // end notify
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.form.fields.browserfield;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStreamReader;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.eclipse.scout.commons.IOUtility;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.form.fields.browserfield.IBrowserField;
+import org.eclipse.scout.rt.shared.services.common.file.RemoteFile;
+import org.eclipse.scout.rt.ui.rap.LogicalGridLayout;
+import org.eclipse.scout.rt.ui.rap.ext.StatusLabelEx;
+import org.eclipse.scout.rt.ui.rap.ext.browser.BrowserExtension;
+import org.eclipse.scout.rt.ui.rap.form.fields.RwtScoutValueFieldComposite;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.browser.Browser;
+import org.eclipse.swt.browser.LocationAdapter;
+import org.eclipse.swt.browser.LocationEvent;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.widgets.Composite;
+
+public class RwtScoutBrowserField extends RwtScoutValueFieldComposite<IBrowserField> implements IRwtScoutBrowserField {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(RwtScoutBrowserField.class);
+
+ private String m_currentLocation;
+ private BrowserExtension m_browserExtension;
+
+ public RwtScoutBrowserField() {
+ }
+
+ @Override
+ protected void initializeUi(Composite parent) {
+ Composite container = getUiEnvironment().getFormToolkit().createComposite(parent);
+ StatusLabelEx label = getUiEnvironment().getFormToolkit().createStatusLabel(container, getScoutObject());
+
+ Browser browser = getUiEnvironment().getFormToolkit().createBrowser(container, SWT.NONE);
+ m_browserExtension = new BrowserExtension(browser);
+ m_browserExtension.attach();
+ browser.addDisposeListener(new DisposeListener() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void widgetDisposed(DisposeEvent e) {
+ m_browserExtension.detach();
+ }
+ });
+ browser.addLocationListener(new LocationAdapter() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void changing(LocationEvent event) {
+ event.doit = fireBeforeLocationChangedFromUi(event.location);
+ }
+
+ @Override
+ public void changed(LocationEvent event) {
+ fireAfterLocationChangedFromUi(event.location);
+ }
+ });
+ //
+ setUiContainer(container);
+ setUiLabel(label);
+ setUiField(browser);
+ // layout
+ getUiContainer().setLayout(new LogicalGridLayout(1, 0));
+ }
+
+ @Override
+ public Browser getUiField() {
+ return (Browser) super.getUiField();
+ }
+
+ @Override
+ protected void handleScoutPropertyChange(String name, Object newValue) {
+ super.handleScoutPropertyChange(name, newValue);
+ if (IBrowserField.PROP_LOCATION.equals(name)) {
+ setLocationFromScout();
+ }
+ }
+
+ @Override
+ protected void setValueFromScout() {
+ setLocationFromScout();
+ }
+
+ protected void setLocationFromScout() {
+ m_browserExtension.clearResourceCache();
+ m_browserExtension.clearLocalHyperlinkCache();
+ String location = getScoutObject().getLocation();
+ RemoteFile r = getScoutObject().getValue();
+ if (location == null && r != null && r.exists()) {
+ try {
+ if (r.getName().matches(".*\\.(zip|jar)")) {
+ File tempDir = IOUtility.createTempDirectory("browser");
+ try {
+ r.writeZipContentToDirectory(tempDir);
+ String simpleName = r.getName().replaceAll("\\.(zip|jar)", ".htm");
+ //rewrite local urls and register resource
+ int prefixLen = tempDir.getAbsolutePath().length() + 1;
+ for (File f : IOUtility.listFilesInSubtree(tempDir, null)) {
+ if (f.isFile()) {
+ String path = f.getAbsolutePath().substring(prefixLen);
+ if (path.toLowerCase().matches(".*\\.(htm|html)")) {
+ String content = IOUtility.getContent(new InputStreamReader(new FileInputStream(f)));
+ content = m_browserExtension.adaptLocalHyperlinks(content, 1);
+ if (location == null && path.startsWith(simpleName)) {
+ //this is the index.html
+ location = m_browserExtension.addResource(simpleName, new ByteArrayInputStream(content.getBytes("UTF-8")));
+ }
+ else {
+ m_browserExtension.addResource(path, new ByteArrayInputStream(content.getBytes("UTF-8")));
+ }
+ }
+ else if (path.toLowerCase().matches(".*\\.(svg)")) {
+ String content = IOUtility.getContent(new InputStreamReader(new FileInputStream(f)));
+ content = m_browserExtension.adaptLocalHyperlinks(content, 1);
+ m_browserExtension.addResource(path, new ByteArrayInputStream(content.getBytes("UTF-8")));
+ }
+ else {
+ m_browserExtension.addResource(path, new FileInputStream(f));
+ }
+ }
+ }
+ }
+ finally {
+ if (tempDir != null) {
+ IOUtility.deleteDirectory(tempDir);
+ }
+ }
+ }
+ else {
+ //rewrite local urls
+ String content = IOUtility.getContent(r.getDecompressedReader());
+ content = m_browserExtension.adaptLocalHyperlinks(content, 1);
+ location = m_browserExtension.addResource(r.getName(), new ByteArrayInputStream(content.getBytes("UTF-8")));
+ }
+ }
+ catch (Throwable t) {
+ LOG.error("preparing html content for " + r, t);
+ }
+ }
+ m_currentLocation = location;
+ if (m_currentLocation != null) {
+ getUiField().setUrl(m_currentLocation);
+ }
+ else {
+ getUiField().setText("");
+ }
+ }
+
+ @Override
+ protected void setEnabledFromScout(boolean b) {
+ //nop
+ }
+
+ protected boolean fireBeforeLocationChangedFromUi(final String location) {
+ final AtomicReference<Boolean> accept = new AtomicReference<Boolean>();
+ synchronized (accept) {
+ // notify Scout
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ synchronized (accept) {
+ accept.set(getScoutObject().getUIFacade().fireBeforeLocationChangedFromUI(location));
+ accept.notifyAll();
+ }
+ }
+ };
+ getUiEnvironment().invokeScoutLater(t, 0);
+ // end notify
+ //wait at most 10 seconds
+ try {
+ accept.wait(10000L);
+ }
+ catch (InterruptedException e) {
+ //nop
+ }
+ }
+ return accept.get() != null ? accept.get().booleanValue() : false;
+ }
+
+ protected void fireAfterLocationChangedFromUi(final String location) {
+ // notify Scout
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ getScoutObject().getUIFacade().fireAfterLocationChangedFromUI(location);
+ }
+ };
+ getUiEnvironment().invokeScoutLater(t, 0);
+ // end notify
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/button/ButtonFieldFactory.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/button/ButtonFieldFactory.java
index 0f628b20fa..3b3433bb9e 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/button/ButtonFieldFactory.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/button/ButtonFieldFactory.java
@@ -1,47 +1,47 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.form.fields.button;
-
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
-import org.eclipse.scout.rt.client.ui.form.fields.snapbox.ISnapBox;
-import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
-import org.eclipse.scout.rt.ui.rap.extension.IFormFieldFactory;
-import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
-import org.eclipse.scout.rt.ui.rap.form.fields.snapbox.button.RwtScoutSnapBoxMaximizedButton;
-import org.eclipse.swt.widgets.Composite;
-
-public class ButtonFieldFactory implements IFormFieldFactory {
-
- @Override
- public IRwtScoutFormField<?> createUiFormField(Composite parent, IFormField model, IRwtEnvironment uiEnvironment) {
- IButton button = (IButton) model;
- IRwtScoutButton field = null;
- if (button.getParentField() instanceof ISnapBox) {
- field = createRwtScoutSnapBoxMaximizedButton();
- field.createUiField(parent, button, uiEnvironment);
- }
- else {
- field = createRwtScoutButton();
- field.createUiField(parent, button, uiEnvironment);
- }
- return field;
- }
-
- protected IRwtScoutButton createRwtScoutSnapBoxMaximizedButton() {
- return new RwtScoutSnapBoxMaximizedButton();
- }
-
- protected IRwtScoutButton createRwtScoutButton() {
- return new RwtScoutButton();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.form.fields.button;
+
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
+import org.eclipse.scout.rt.client.ui.form.fields.snapbox.ISnapBox;
+import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
+import org.eclipse.scout.rt.ui.rap.extension.IFormFieldFactory;
+import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
+import org.eclipse.scout.rt.ui.rap.form.fields.snapbox.button.RwtScoutSnapBoxMaximizedButton;
+import org.eclipse.swt.widgets.Composite;
+
+public class ButtonFieldFactory implements IFormFieldFactory {
+
+ @Override
+ public IRwtScoutFormField<?> createUiFormField(Composite parent, IFormField model, IRwtEnvironment uiEnvironment) {
+ IButton button = (IButton) model;
+ IRwtScoutButton field = null;
+ if (button.getParentField() instanceof ISnapBox) {
+ field = createRwtScoutSnapBoxMaximizedButton();
+ field.createUiField(parent, button, uiEnvironment);
+ }
+ else {
+ field = createRwtScoutButton();
+ field.createUiField(parent, button, uiEnvironment);
+ }
+ return field;
+ }
+
+ protected IRwtScoutButton createRwtScoutSnapBoxMaximizedButton() {
+ return new RwtScoutSnapBoxMaximizedButton();
+ }
+
+ protected IRwtScoutButton createRwtScoutButton() {
+ return new RwtScoutButton();
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/button/IRwtScoutButton.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/button/IRwtScoutButton.java
index 02564fc1ef..6cd39d2115 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/button/IRwtScoutButton.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/button/IRwtScoutButton.java
@@ -1,26 +1,26 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.form.fields.button;
-
-import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
-import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
-import org.eclipse.swt.widgets.Control;
-
-/**
- * <h3>IRwtScoutButton</h3> ...
- *
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.form.fields.button;
+
+import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
+import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
+import org.eclipse.swt.widgets.Control;
+
+/**
+ * <h3>IRwtScoutButton</h3> ...
+ *
* @since 3.7.0 June 2011
- */
-public interface IRwtScoutButton extends IRwtScoutFormField<IButton> {
-
- @Override
- Control getUiField();
-}
+ */
+public interface IRwtScoutButton extends IRwtScoutFormField<IButton> {
+
+ @Override
+ Control getUiField();
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/button/RwtScoutButton.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/button/RwtScoutButton.java
index 277a4491d7..b8e0786e14 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/button/RwtScoutButton.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/button/RwtScoutButton.java
@@ -1,408 +1,408 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.form.fields.button;
-
-import java.util.concurrent.atomic.AtomicReference;
-
-import org.eclipse.scout.commons.OptimisticLock;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.WeakEventListener;
-import org.eclipse.scout.commons.job.JobEx;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.form.fields.button.ButtonEvent;
-import org.eclipse.scout.rt.client.ui.form.fields.button.ButtonListener;
-import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
-import org.eclipse.scout.rt.ui.rap.LogicalGridData;
-import org.eclipse.scout.rt.ui.rap.LogicalGridLayout;
-import org.eclipse.scout.rt.ui.rap.RwtMenuUtility;
-import org.eclipse.scout.rt.ui.rap.ext.ButtonEx;
-import org.eclipse.scout.rt.ui.rap.ext.MenuAdapterEx;
-import org.eclipse.scout.rt.ui.rap.extension.IUiDecoration;
-import org.eclipse.scout.rt.ui.rap.extension.UiDecorationExtensionPoint;
-import org.eclipse.scout.rt.ui.rap.form.fields.RwtScoutFieldComposite;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.MenuEvent;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.ui.forms.HyperlinkGroup;
-import org.eclipse.ui.forms.HyperlinkSettings;
-import org.eclipse.ui.forms.events.HyperlinkAdapter;
-import org.eclipse.ui.forms.events.HyperlinkEvent;
-import org.eclipse.ui.forms.widgets.Hyperlink;
-
-/**
- * <h3>RwtScoutButton</h3> ...
- *
- * @since 3.7.0 June 2011
- */
-public class RwtScoutButton extends RwtScoutFieldComposite<IButton> implements IRwtScoutButton {
- private static IScoutLogger LOG = ScoutLogManager.getLogger(RwtScoutButton.class);
-
- private ButtonListener m_scoutButtonListener;
- private OptimisticLock m_selectionLock;
- //ticket 86811: avoid double-action in queue
- private boolean m_handleActionPending;
-
- private Menu m_contextMenu;
-
- public RwtScoutButton() {
- m_selectionLock = new OptimisticLock();
- }
-
- @Override
- protected void initializeUi(Composite parent) {
- Composite container = getUiEnvironment().getFormToolkit().createComposite(parent);
- setUiContainer(container);
- ButtonEx uiFieldAsButton = null;
- Hyperlink uiFieldAsLink = null;
- switch (getScoutObject().getDisplayStyle()) {
- case IButton.DISPLAY_STYLE_RADIO: {
- ButtonEx uiButton = getUiEnvironment().getFormToolkit().createButtonEx(container, SWT.LEFT | SWT.RADIO);
- uiFieldAsButton = uiButton;
- break;
- }
- case IButton.DISPLAY_STYLE_TOGGLE: {
- ButtonEx uiButton = getUiEnvironment().getFormToolkit().createButtonEx(container, SWT.CENTER | SWT.TOGGLE);
- uiFieldAsButton = uiButton;
- break;
- }
- case IButton.DISPLAY_STYLE_LINK: {
- HyperlinkGroup linkGroup = getUiEnvironment().getFormToolkit().getHyperlinkGroup();
- linkGroup.setHyperlinkUnderlineMode(HyperlinkSettings.UNDERLINE_HOVER);
- int style = SWT.CENTER;
- Hyperlink uiLink = getUiEnvironment().getFormToolkit().createHyperlink(container, "", style);
- uiFieldAsLink = uiLink;
- break;
- }
- default: {
- int style = SWT.CENTER | SWT.PUSH;
- if (getScoutObject().hasMenus()) {
- style |= SWT.DROP_DOWN;
- }
- ButtonEx uiButton = getUiEnvironment().getFormToolkit().createButtonEx(container, style);
- uiButton.setDropDownEnabled(true);
- uiFieldAsButton = uiButton;
- }
- }
- //
- setUiLabel(null);
- if (uiFieldAsButton != null) {
- // context menu
- m_contextMenu = new Menu(uiFieldAsButton.getShell(), SWT.POP_UP);
- m_contextMenu.addMenuListener(new P_ContextMenuListener(uiFieldAsButton, uiFieldAsButton.getParent()));
- uiFieldAsButton.setMenu(m_contextMenu);
-
- // attach rwt listeners
- uiFieldAsButton.addListener(ButtonEx.SELECTION_ACTION, new P_RwtSelectionListener());
-
- setUiField(uiFieldAsButton);
-
- LogicalGridData gd = (LogicalGridData) getUiField().getLayoutData();
- adaptButtonLayoutData(gd);
- }
- else if (uiFieldAsLink != null) {
- uiFieldAsLink.addHyperlinkListener(new HyperlinkAdapter() {
- @Override
- public void linkActivated(HyperlinkEvent e) {
- handleUiAction();
- }
- });
- setUiField(uiFieldAsLink);
- getUiContainer().setTabList(new Control[]{uiFieldAsLink});
- }
- // layout
- getUiContainer().setLayout(new LogicalGridLayout(0, 0));
- }
-
- protected void adaptButtonLayoutData(LogicalGridData gd) {
- //set default button height
- if (!getScoutObject().isProcessButton() || gd.useUiHeight) {
- return;
- }
-
- gd.useUiHeight = true;
- IUiDecoration deco = UiDecorationExtensionPoint.getLookAndFeel();
- gd.heightHint = deco.getProcessButtonHeight();
- }
-
- @Override
- protected void setBackgroundFromScout(String scoutColor) {
- // XXX hstaudacher We need to override this method because when not it overrides RWT theme
- }
-
- @Override
- protected void attachScout() {
- super.attachScout();
- IButton b = getScoutObject();
- if (b.hasMenus()) {
- // XXX button menus
- }
- setIconIdFromScout(b.getIconId());
- setImageFromScout(b.getImage());
- setSelectionFromScout(b.isSelected());
- setLabelFromScout(b.getLabel());
- if (m_scoutButtonListener == null) {
- m_scoutButtonListener = new P_ScoutButtonListener();
- getScoutObject().addButtonListener(m_scoutButtonListener);
- }
- }
-
- @Override
- protected void detachScout() {
- if (m_scoutButtonListener != null) {
- getScoutObject().removeButtonListener(m_scoutButtonListener);
- m_scoutButtonListener = null;
- }
- super.detachScout();
- }
-
- @Override
- protected void setForegroundFromScout(String scoutColor) {
- if (getScoutObject().getDisplayStyle() == IButton.DISPLAY_STYLE_LINK && scoutColor == null) {
- // XXX BSH Get rid of hard-coded color value when bug 346438 is fixed
- scoutColor = "67A8CE";
- }
- super.setForegroundFromScout(scoutColor);
- }
-
- protected void setIconIdFromScout(String s) {
- if (s != null) {
- Image icon = getUiEnvironment().getIcon(s);
- Control comp = getUiField();
- if (comp instanceof Button) {
- Button b = (Button) comp;
- b.setImage(icon);
- }
- else if (comp instanceof Hyperlink) {
- }
- }
- }
-
- @Override
- protected void setLabelFromScout(String s) {
- Control comp = getUiField();
- if (comp instanceof Button) {
- Button b = (Button) comp;
- String label = s;
- b.setText(label == null ? "" : label);
- }
- else if (comp instanceof Hyperlink) {
- Hyperlink t = (Hyperlink) comp;
- String label = StringUtility.removeMnemonic(s);
- t.setText(label == null ? "" : label);
- }
- }
-
- protected void setSelectionFromScout(boolean b) {
- try {
- if (m_selectionLock.acquire()) {
- switch (getScoutObject().getDisplayStyle()) {
- case IButton.DISPLAY_STYLE_RADIO:
- case IButton.DISPLAY_STYLE_TOGGLE:
- Control comp = getUiField();
- if (comp instanceof Button) {
- Button but = (Button) comp;
- if (b != but.getSelection()) {
- but.setSelection(b);
- }
- }
- break;
- }
- }
- }
- finally {
- m_selectionLock.release();
- }
- }
-
- protected void setSelectionFromUi(final boolean b) {
- try {
- if (m_selectionLock.acquire()) {
- //notify Scout
- Runnable t = new Runnable() {
- @Override
- public void run() {
- if (getScoutObject().isSelected() != b) {
- getScoutObject().getUIFacade().setSelectedFromUI(b);
- }
- getScoutObject().getUIFacade().fireButtonClickedFromUI();
- }
- };
- getUiEnvironment().invokeScoutLater(t, 0);
- //end notify
- }
- }
- finally {
- m_selectionLock.release();
- }
- }
-
- protected void handleUiAction() {
- if (!m_handleActionPending) {
- m_handleActionPending = true;
- //notify Scout
- Runnable t = new Runnable() {
- @Override
- public void run() {
- try {
- getScoutObject().getUIFacade().fireButtonClickedFromUI();
- }
- finally {
- m_handleActionPending = false;
- }
- }
- };
- getUiEnvironment().invokeScoutLater(t, 0);
- //end notify
- }
- }
-
- protected void setImageFromScout(Object img) {
- if (img instanceof Image) {
- Control comp = getUiField();
- if (comp instanceof Button) {
- Button b = (Button) comp;
- b.setImage((Image) img);
- }
- else if (comp instanceof Hyperlink) {
- }
- }
- }
-
- protected void disarmButtonFromScout() {
- }
-
- protected void requestPopupFromScout() {
- if (m_contextMenu != null) {
- m_contextMenu.setVisible(true);
- }
- }
-
- /**
- * in rwt thread
- */
- @Override
- protected void handleScoutPropertyChange(String name, Object newValue) {
- super.handleScoutPropertyChange(name, newValue);
- if (name.equals(IButton.PROP_ICON_ID)) {
- setIconIdFromScout((String) newValue);
- }
- else if (name.equals(IButton.PROP_IMAGE)) {
- setImageFromScout(newValue);
- }
- else if (name.equals(IButton.PROP_SELECTED)) {
- setSelectionFromScout(((Boolean) newValue).booleanValue());
- }
- }
-
- private class P_RwtSelectionListener implements Listener {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void handleEvent(Event event) {
- switch (event.type) {
- case ButtonEx.SELECTION_ACTION: {
- switch (getScoutObject().getDisplayStyle()) {
- case IButton.DISPLAY_STYLE_RADIO:
- case IButton.DISPLAY_STYLE_TOGGLE: {
- setSelectionFromUi(((Button) getUiField()).getSelection());
- break;
- }
- default: {
- handleUiAction();
- break;
- }
- }
- break;
- }
- }
- }
- }// end private class
-
- private class P_ScoutButtonListener implements ButtonListener, WeakEventListener {
- @Override
- public void buttonChanged(ButtonEvent e) {
- switch (e.getType()) {
- case ButtonEvent.TYPE_DISARM: {
- getUiEnvironment().invokeUiLater(
- new Runnable() {
- @Override
- public void run() {
- disarmButtonFromScout();
- }
- });
- break;
- }
- case ButtonEvent.TYPE_REQUEST_POPUP: {
- getUiEnvironment().invokeUiLater(
- new Runnable() {
- @Override
- public void run() {
- requestPopupFromScout();
- }
- });
- break;
- }
- }
- }
- } // end class P_ScoutButtonListener
-
- private class P_ContextMenuListener extends MenuAdapterEx {
- private static final long serialVersionUID = 1L;
-
- public P_ContextMenuListener(Control menuControl, Control keyStrokeWidget) {
- super(menuControl, keyStrokeWidget);
- }
-
- @Override
- protected Menu getContextMenu() {
- return m_contextMenu;
- }
-
- @Override
- protected void setContextMenu(Menu contextMenu) {
- m_contextMenu = contextMenu;
- }
-
- @Override
- public void menuShown(MenuEvent e) {
- super.menuShown(e);
-
- final AtomicReference<IMenu[]> scoutMenusRef = new AtomicReference<IMenu[]>();
- Runnable t = new Runnable() {
- @Override
- public void run() {
- IMenu[] scoutMenus = getScoutObject().getUIFacade().fireButtonPopupFromUI();
- scoutMenusRef.set(scoutMenus);
- }
- };
- JobEx job = RwtScoutButton.this.getUiEnvironment().invokeScoutLater(t, 1200);
- try {
- job.join(1200);
- }
- catch (InterruptedException ex) {
- //nop
- }
- // grab the actions out of the job, when the actions are providden within
- // the scheduled time the popup will be handled.
- if (scoutMenusRef.get() != null) {
- RwtMenuUtility.fillContextMenu(scoutMenusRef.get(), RwtScoutButton.this.getUiEnvironment(), m_contextMenu);
- }
- }
- } // end class P_ContextMenuListener
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.form.fields.button;
+
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.eclipse.scout.commons.OptimisticLock;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.WeakEventListener;
+import org.eclipse.scout.commons.job.JobEx;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.form.fields.button.ButtonEvent;
+import org.eclipse.scout.rt.client.ui.form.fields.button.ButtonListener;
+import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
+import org.eclipse.scout.rt.ui.rap.LogicalGridData;
+import org.eclipse.scout.rt.ui.rap.LogicalGridLayout;
+import org.eclipse.scout.rt.ui.rap.RwtMenuUtility;
+import org.eclipse.scout.rt.ui.rap.ext.ButtonEx;
+import org.eclipse.scout.rt.ui.rap.ext.MenuAdapterEx;
+import org.eclipse.scout.rt.ui.rap.extension.IUiDecoration;
+import org.eclipse.scout.rt.ui.rap.extension.UiDecorationExtensionPoint;
+import org.eclipse.scout.rt.ui.rap.form.fields.RwtScoutFieldComposite;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MenuEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.ui.forms.HyperlinkGroup;
+import org.eclipse.ui.forms.HyperlinkSettings;
+import org.eclipse.ui.forms.events.HyperlinkAdapter;
+import org.eclipse.ui.forms.events.HyperlinkEvent;
+import org.eclipse.ui.forms.widgets.Hyperlink;
+
+/**
+ * <h3>RwtScoutButton</h3> ...
+ *
+ * @since 3.7.0 June 2011
+ */
+public class RwtScoutButton extends RwtScoutFieldComposite<IButton> implements IRwtScoutButton {
+ private static IScoutLogger LOG = ScoutLogManager.getLogger(RwtScoutButton.class);
+
+ private ButtonListener m_scoutButtonListener;
+ private OptimisticLock m_selectionLock;
+ //ticket 86811: avoid double-action in queue
+ private boolean m_handleActionPending;
+
+ private Menu m_contextMenu;
+
+ public RwtScoutButton() {
+ m_selectionLock = new OptimisticLock();
+ }
+
+ @Override
+ protected void initializeUi(Composite parent) {
+ Composite container = getUiEnvironment().getFormToolkit().createComposite(parent);
+ setUiContainer(container);
+ ButtonEx uiFieldAsButton = null;
+ Hyperlink uiFieldAsLink = null;
+ switch (getScoutObject().getDisplayStyle()) {
+ case IButton.DISPLAY_STYLE_RADIO: {
+ ButtonEx uiButton = getUiEnvironment().getFormToolkit().createButtonEx(container, SWT.LEFT | SWT.RADIO);
+ uiFieldAsButton = uiButton;
+ break;
+ }
+ case IButton.DISPLAY_STYLE_TOGGLE: {
+ ButtonEx uiButton = getUiEnvironment().getFormToolkit().createButtonEx(container, SWT.CENTER | SWT.TOGGLE);
+ uiFieldAsButton = uiButton;
+ break;
+ }
+ case IButton.DISPLAY_STYLE_LINK: {
+ HyperlinkGroup linkGroup = getUiEnvironment().getFormToolkit().getHyperlinkGroup();
+ linkGroup.setHyperlinkUnderlineMode(HyperlinkSettings.UNDERLINE_HOVER);
+ int style = SWT.CENTER;
+ Hyperlink uiLink = getUiEnvironment().getFormToolkit().createHyperlink(container, "", style);
+ uiFieldAsLink = uiLink;
+ break;
+ }
+ default: {
+ int style = SWT.CENTER | SWT.PUSH;
+ if (getScoutObject().hasMenus()) {
+ style |= SWT.DROP_DOWN;
+ }
+ ButtonEx uiButton = getUiEnvironment().getFormToolkit().createButtonEx(container, style);
+ uiButton.setDropDownEnabled(true);
+ uiFieldAsButton = uiButton;
+ }
+ }
+ //
+ setUiLabel(null);
+ if (uiFieldAsButton != null) {
+ // context menu
+ m_contextMenu = new Menu(uiFieldAsButton.getShell(), SWT.POP_UP);
+ m_contextMenu.addMenuListener(new P_ContextMenuListener(uiFieldAsButton, uiFieldAsButton.getParent()));
+ uiFieldAsButton.setMenu(m_contextMenu);
+
+ // attach rwt listeners
+ uiFieldAsButton.addListener(ButtonEx.SELECTION_ACTION, new P_RwtSelectionListener());
+
+ setUiField(uiFieldAsButton);
+
+ LogicalGridData gd = (LogicalGridData) getUiField().getLayoutData();
+ adaptButtonLayoutData(gd);
+ }
+ else if (uiFieldAsLink != null) {
+ uiFieldAsLink.addHyperlinkListener(new HyperlinkAdapter() {
+ @Override
+ public void linkActivated(HyperlinkEvent e) {
+ handleUiAction();
+ }
+ });
+ setUiField(uiFieldAsLink);
+ getUiContainer().setTabList(new Control[]{uiFieldAsLink});
+ }
+ // layout
+ getUiContainer().setLayout(new LogicalGridLayout(0, 0));
+ }
+
+ protected void adaptButtonLayoutData(LogicalGridData gd) {
+ //set default button height
+ if (!getScoutObject().isProcessButton() || gd.useUiHeight) {
+ return;
+ }
+
+ gd.useUiHeight = true;
+ IUiDecoration deco = UiDecorationExtensionPoint.getLookAndFeel();
+ gd.heightHint = deco.getProcessButtonHeight();
+ }
+
+ @Override
+ protected void setBackgroundFromScout(String scoutColor) {
+ // XXX hstaudacher We need to override this method because when not it overrides RWT theme
+ }
+
+ @Override
+ protected void attachScout() {
+ super.attachScout();
+ IButton b = getScoutObject();
+ if (b.hasMenus()) {
+ // XXX button menus
+ }
+ setIconIdFromScout(b.getIconId());
+ setImageFromScout(b.getImage());
+ setSelectionFromScout(b.isSelected());
+ setLabelFromScout(b.getLabel());
+ if (m_scoutButtonListener == null) {
+ m_scoutButtonListener = new P_ScoutButtonListener();
+ getScoutObject().addButtonListener(m_scoutButtonListener);
+ }
+ }
+
+ @Override
+ protected void detachScout() {
+ if (m_scoutButtonListener != null) {
+ getScoutObject().removeButtonListener(m_scoutButtonListener);
+ m_scoutButtonListener = null;
+ }
+ super.detachScout();
+ }
+
+ @Override
+ protected void setForegroundFromScout(String scoutColor) {
+ if (getScoutObject().getDisplayStyle() == IButton.DISPLAY_STYLE_LINK && scoutColor == null) {
+ // XXX BSH Get rid of hard-coded color value when bug 346438 is fixed
+ scoutColor = "67A8CE";
+ }
+ super.setForegroundFromScout(scoutColor);
+ }
+
+ protected void setIconIdFromScout(String s) {
+ if (s != null) {
+ Image icon = getUiEnvironment().getIcon(s);
+ Control comp = getUiField();
+ if (comp instanceof Button) {
+ Button b = (Button) comp;
+ b.setImage(icon);
+ }
+ else if (comp instanceof Hyperlink) {
+ }
+ }
+ }
+
+ @Override
+ protected void setLabelFromScout(String s) {
+ Control comp = getUiField();
+ if (comp instanceof Button) {
+ Button b = (Button) comp;
+ String label = s;
+ b.setText(label == null ? "" : label);
+ }
+ else if (comp instanceof Hyperlink) {
+ Hyperlink t = (Hyperlink) comp;
+ String label = StringUtility.removeMnemonic(s);
+ t.setText(label == null ? "" : label);
+ }
+ }
+
+ protected void setSelectionFromScout(boolean b) {
+ try {
+ if (m_selectionLock.acquire()) {
+ switch (getScoutObject().getDisplayStyle()) {
+ case IButton.DISPLAY_STYLE_RADIO:
+ case IButton.DISPLAY_STYLE_TOGGLE:
+ Control comp = getUiField();
+ if (comp instanceof Button) {
+ Button but = (Button) comp;
+ if (b != but.getSelection()) {
+ but.setSelection(b);
+ }
+ }
+ break;
+ }
+ }
+ }
+ finally {
+ m_selectionLock.release();
+ }
+ }
+
+ protected void setSelectionFromUi(final boolean b) {
+ try {
+ if (m_selectionLock.acquire()) {
+ //notify Scout
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ if (getScoutObject().isSelected() != b) {
+ getScoutObject().getUIFacade().setSelectedFromUI(b);
+ }
+ getScoutObject().getUIFacade().fireButtonClickedFromUI();
+ }
+ };
+ getUiEnvironment().invokeScoutLater(t, 0);
+ //end notify
+ }
+ }
+ finally {
+ m_selectionLock.release();
+ }
+ }
+
+ protected void handleUiAction() {
+ if (!m_handleActionPending) {
+ m_handleActionPending = true;
+ //notify Scout
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ try {
+ getScoutObject().getUIFacade().fireButtonClickedFromUI();
+ }
+ finally {
+ m_handleActionPending = false;
+ }
+ }
+ };
+ getUiEnvironment().invokeScoutLater(t, 0);
+ //end notify
+ }
+ }
+
+ protected void setImageFromScout(Object img) {
+ if (img instanceof Image) {
+ Control comp = getUiField();
+ if (comp instanceof Button) {
+ Button b = (Button) comp;
+ b.setImage((Image) img);
+ }
+ else if (comp instanceof Hyperlink) {
+ }
+ }
+ }
+
+ protected void disarmButtonFromScout() {
+ }
+
+ protected void requestPopupFromScout() {
+ if (m_contextMenu != null) {
+ m_contextMenu.setVisible(true);
+ }
+ }
+
+ /**
+ * in rwt thread
+ */
+ @Override
+ protected void handleScoutPropertyChange(String name, Object newValue) {
+ super.handleScoutPropertyChange(name, newValue);
+ if (name.equals(IButton.PROP_ICON_ID)) {
+ setIconIdFromScout((String) newValue);
+ }
+ else if (name.equals(IButton.PROP_IMAGE)) {
+ setImageFromScout(newValue);
+ }
+ else if (name.equals(IButton.PROP_SELECTED)) {
+ setSelectionFromScout(((Boolean) newValue).booleanValue());
+ }
+ }
+
+ private class P_RwtSelectionListener implements Listener {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void handleEvent(Event event) {
+ switch (event.type) {
+ case ButtonEx.SELECTION_ACTION: {
+ switch (getScoutObject().getDisplayStyle()) {
+ case IButton.DISPLAY_STYLE_RADIO:
+ case IButton.DISPLAY_STYLE_TOGGLE: {
+ setSelectionFromUi(((Button) getUiField()).getSelection());
+ break;
+ }
+ default: {
+ handleUiAction();
+ break;
+ }
+ }
+ break;
+ }
+ }
+ }
+ }// end private class
+
+ private class P_ScoutButtonListener implements ButtonListener, WeakEventListener {
+ @Override
+ public void buttonChanged(ButtonEvent e) {
+ switch (e.getType()) {
+ case ButtonEvent.TYPE_DISARM: {
+ getUiEnvironment().invokeUiLater(
+ new Runnable() {
+ @Override
+ public void run() {
+ disarmButtonFromScout();
+ }
+ });
+ break;
+ }
+ case ButtonEvent.TYPE_REQUEST_POPUP: {
+ getUiEnvironment().invokeUiLater(
+ new Runnable() {
+ @Override
+ public void run() {
+ requestPopupFromScout();
+ }
+ });
+ break;
+ }
+ }
+ }
+ } // end class P_ScoutButtonListener
+
+ private class P_ContextMenuListener extends MenuAdapterEx {
+ private static final long serialVersionUID = 1L;
+
+ public P_ContextMenuListener(Control menuControl, Control keyStrokeWidget) {
+ super(menuControl, keyStrokeWidget);
+ }
+
+ @Override
+ protected Menu getContextMenu() {
+ return m_contextMenu;
+ }
+
+ @Override
+ protected void setContextMenu(Menu contextMenu) {
+ m_contextMenu = contextMenu;
+ }
+
+ @Override
+ public void menuShown(MenuEvent e) {
+ super.menuShown(e);
+
+ final AtomicReference<IMenu[]> scoutMenusRef = new AtomicReference<IMenu[]>();
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ IMenu[] scoutMenus = getScoutObject().getUIFacade().fireButtonPopupFromUI();
+ scoutMenusRef.set(scoutMenus);
+ }
+ };
+ JobEx job = RwtScoutButton.this.getUiEnvironment().invokeScoutLater(t, 1200);
+ try {
+ job.join(1200);
+ }
+ catch (InterruptedException ex) {
+ //nop
+ }
+ // grab the actions out of the job, when the actions are providden within
+ // the scheduled time the popup will be handled.
+ if (scoutMenusRef.get() != null) {
+ RwtMenuUtility.fillContextMenu(scoutMenusRef.get(), RwtScoutButton.this.getUiEnvironment(), m_contextMenu);
+ }
+ }
+ } // end class P_ContextMenuListener
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/checkbox/IRwtScoutCheckbox.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/checkbox/IRwtScoutCheckbox.java
index 26c9a573b8..d0ec8d397f 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/checkbox/IRwtScoutCheckbox.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/checkbox/IRwtScoutCheckbox.java
@@ -1,29 +1,29 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.form.fields.checkbox;
-
-import org.eclipse.scout.rt.client.ui.form.fields.booleanfield.IBooleanField;
-import org.eclipse.scout.rt.ui.rap.ext.ILabelComposite;
-import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
-import org.eclipse.swt.widgets.Button;
-
-/**
- * <h3>IRwtScoutCheckbox</h3> ...
- *
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.form.fields.checkbox;
+
+import org.eclipse.scout.rt.client.ui.form.fields.booleanfield.IBooleanField;
+import org.eclipse.scout.rt.ui.rap.ext.ILabelComposite;
+import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
+import org.eclipse.swt.widgets.Button;
+
+/**
+ * <h3>IRwtScoutCheckbox</h3> ...
+ *
* @since 3.7.0 June 2011
- */
-public interface IRwtScoutCheckbox extends IRwtScoutFormField<IBooleanField> {
-
- @Override
- Button getUiField();
-
- ILabelComposite getPlaceholderLabel();
-}
+ */
+public interface IRwtScoutCheckbox extends IRwtScoutFormField<IBooleanField> {
+
+ @Override
+ Button getUiField();
+
+ ILabelComposite getPlaceholderLabel();
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/checkbox/RwtScoutCheckbox.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/checkbox/RwtScoutCheckbox.java
index dc4516392c..7dd1188561 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/checkbox/RwtScoutCheckbox.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/checkbox/RwtScoutCheckbox.java
@@ -1,196 +1,196 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.form.fields.checkbox;
-
-import org.eclipse.scout.commons.BooleanUtility;
-import org.eclipse.scout.commons.exception.IProcessingStatus;
-import org.eclipse.scout.rt.client.ui.form.fields.booleanfield.IBooleanField;
-import org.eclipse.scout.rt.ui.rap.LogicalGridData;
-import org.eclipse.scout.rt.ui.rap.LogicalGridLayout;
-import org.eclipse.scout.rt.ui.rap.ext.StatusLabelEx;
-import org.eclipse.scout.rt.ui.rap.form.fields.LogicalGridDataBuilder;
-import org.eclipse.scout.rt.ui.rap.form.fields.RwtScoutValueFieldComposite;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-
-public class RwtScoutCheckbox extends RwtScoutValueFieldComposite<IBooleanField> implements IRwtScoutCheckbox {
-
- private P_RwtButtonListener m_uiButtonListener;
- private boolean m_mandatoryCached;
- private StatusLabelEx m_labelPlaceholder;
- //ticket 86811: avoid double-action in queue
- private boolean m_handleActionPending;
-
- @Override
- protected void initializeUi(Composite parent) {
- super.initializeUi(parent);
- Composite container = getUiEnvironment().getFormToolkit().createComposite(parent);
- m_labelPlaceholder = new StatusLabelEx(container, SWT.NONE);
- getUiEnvironment().getFormToolkit().getFormToolkit().adapt(m_labelPlaceholder, false, false);
- m_labelPlaceholder.setLayoutData(LogicalGridDataBuilder.createLabel(getScoutObject().getGridData()));
-
- Button checkbox = getUiEnvironment().getFormToolkit().createButton(container, "", SWT.CHECK);
-
- LogicalGridData checkboxData = LogicalGridDataBuilder.createField(getScoutObject().getGridData());
- checkboxData.fillHorizontal = false;
- checkboxData.useUiWidth = true;
- checkboxData.weightx = 0;
- checkbox.setLayoutData(checkboxData);
-
- // This label is only used to dispatch some properties to the checkbox label (see updateLabel)
- // So it has to be invisible.
- StatusLabelEx dispatcherLabel = new StatusLabelEx(container, SWT.NONE);
- dispatcherLabel.setVisible(false);
- setUiLabel(dispatcherLabel);
-
- //
- setUiContainer(container);
- setUiField(checkbox);
-
- // layout
- container.setLayout(new LogicalGridLayout(1, 0));
- }
-
- @Override
- protected void attachScout() {
- super.attachScout();
- if (m_uiButtonListener == null) {
- m_uiButtonListener = new P_RwtButtonListener();
- }
- getUiField().addListener(SWT.Selection, m_uiButtonListener);
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.scout.rt.ui.rap.form.fields.RwtScoutValueFieldComposite#setErrorStatusFromScout(org.eclipse.scout.commons.exception.IProcessingStatus)
- */
- @Override
- protected void setErrorStatusFromScout(IProcessingStatus s) {
- // Update the status of the labelPlaceholder and not the dispatcherLabel
- m_labelPlaceholder.setStatus(s);
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.scout.rt.ui.rap.form.fields.RwtScoutFieldComposite#setMandatoryFromScout(boolean)
- */
- @Override
- protected void setMandatoryFromScout(boolean b) {
- super.setMandatoryFromScout(b);
-// if (b != m_mandatoryCached) {
-// m_mandatoryCached = b;
-// getUiLabel().setMandatory(b); // bsh 2010-10-01: inform the label - some GUIs (e.g. Rayo) might use this information
-// }
-
- updateLabel();
- }
-
- /**
- * Updates the label of the checkbox with the properties of the dispatcher label.
- * This makes sure that the mandatory appearance is reflected correctly.
- */
- protected void updateLabel() {
- if (getUiLabel() instanceof StatusLabelEx) {
- StatusLabelEx uiLabel = getUiLabel();
-
- if (uiLabel.getText() != null) {
- getUiField().setText(uiLabel.getText());
- }
-
- getUiField().setFont(uiLabel.getFont());
- getUiField().setForeground(uiLabel.getForeground());
- getUiField().setBackground(uiLabel.getBackground());
- }
- }
-
- @Override
- protected void detachScout() {
- super.detachScout();
- getUiField().removeListener(SWT.Selection, m_uiButtonListener);
- }
-
- @Override
- public Button getUiField() {
- return (Button) super.getUiField();
- }
-
- @Override
- public StatusLabelEx getUiLabel() {
- return (StatusLabelEx) super.getUiLabel();
- }
-
- @Override
- public StatusLabelEx getPlaceholderLabel() {
- return m_labelPlaceholder;
- }
-
- @Override
- protected void setLabelVisibleFromScout() {
- boolean b = getScoutObject().isLabelVisible();
- if (m_labelPlaceholder != null && b != m_labelPlaceholder.getVisible()) {
- m_labelPlaceholder.setVisible(b);
- if (getUiContainer() != null && isCreated()) {
- getUiContainer().layout(true, true);
- }
- }
- }
-
- @Override
- protected void setLabelFromScout(String s) {
- super.setLabelFromScout(s);
- updateLabel();
- }
-
- @Override
- protected void setValueFromScout() {
- getUiField().setSelection(BooleanUtility.nvl(getScoutObject() == null ? null : getScoutObject().getValue()));
- }
-
- protected void handleUiAction() {
- if (getUiField().isEnabled()) {
- final boolean b = getUiField().getSelection();
- if (!m_handleActionPending) {
- m_handleActionPending = true;
- // notify Scout
- Runnable t = new Runnable() {
- @Override
- public void run() {
- try {
- getScoutObject().getUIFacade().setSelectedFromUI(b);
- }
- finally {
- m_handleActionPending = false;
- }
- }
- };
- getUiEnvironment().invokeScoutLater(t, 0);
- // end notify
- }
- }
- }
-
- private class P_RwtButtonListener implements Listener {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void handleEvent(Event event) {
- switch (event.type) {
- case SWT.Selection:
- handleUiAction();
- break;
- }
- }
- } // end class P_RwtButtonListener
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.form.fields.checkbox;
+
+import org.eclipse.scout.commons.BooleanUtility;
+import org.eclipse.scout.commons.exception.IProcessingStatus;
+import org.eclipse.scout.rt.client.ui.form.fields.booleanfield.IBooleanField;
+import org.eclipse.scout.rt.ui.rap.LogicalGridData;
+import org.eclipse.scout.rt.ui.rap.LogicalGridLayout;
+import org.eclipse.scout.rt.ui.rap.ext.StatusLabelEx;
+import org.eclipse.scout.rt.ui.rap.form.fields.LogicalGridDataBuilder;
+import org.eclipse.scout.rt.ui.rap.form.fields.RwtScoutValueFieldComposite;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+
+public class RwtScoutCheckbox extends RwtScoutValueFieldComposite<IBooleanField> implements IRwtScoutCheckbox {
+
+ private P_RwtButtonListener m_uiButtonListener;
+ private boolean m_mandatoryCached;
+ private StatusLabelEx m_labelPlaceholder;
+ //ticket 86811: avoid double-action in queue
+ private boolean m_handleActionPending;
+
+ @Override
+ protected void initializeUi(Composite parent) {
+ super.initializeUi(parent);
+ Composite container = getUiEnvironment().getFormToolkit().createComposite(parent);
+ m_labelPlaceholder = new StatusLabelEx(container, SWT.NONE);
+ getUiEnvironment().getFormToolkit().getFormToolkit().adapt(m_labelPlaceholder, false, false);
+ m_labelPlaceholder.setLayoutData(LogicalGridDataBuilder.createLabel(getScoutObject().getGridData()));
+
+ Button checkbox = getUiEnvironment().getFormToolkit().createButton(container, "", SWT.CHECK);
+
+ LogicalGridData checkboxData = LogicalGridDataBuilder.createField(getScoutObject().getGridData());
+ checkboxData.fillHorizontal = false;
+ checkboxData.useUiWidth = true;
+ checkboxData.weightx = 0;
+ checkbox.setLayoutData(checkboxData);
+
+ // This label is only used to dispatch some properties to the checkbox label (see updateLabel)
+ // So it has to be invisible.
+ StatusLabelEx dispatcherLabel = new StatusLabelEx(container, SWT.NONE);
+ dispatcherLabel.setVisible(false);
+ setUiLabel(dispatcherLabel);
+
+ //
+ setUiContainer(container);
+ setUiField(checkbox);
+
+ // layout
+ container.setLayout(new LogicalGridLayout(1, 0));
+ }
+
+ @Override
+ protected void attachScout() {
+ super.attachScout();
+ if (m_uiButtonListener == null) {
+ m_uiButtonListener = new P_RwtButtonListener();
+ }
+ getUiField().addListener(SWT.Selection, m_uiButtonListener);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.scout.rt.ui.rap.form.fields.RwtScoutValueFieldComposite#setErrorStatusFromScout(org.eclipse.scout.commons.exception.IProcessingStatus)
+ */
+ @Override
+ protected void setErrorStatusFromScout(IProcessingStatus s) {
+ // Update the status of the labelPlaceholder and not the dispatcherLabel
+ m_labelPlaceholder.setStatus(s);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.scout.rt.ui.rap.form.fields.RwtScoutFieldComposite#setMandatoryFromScout(boolean)
+ */
+ @Override
+ protected void setMandatoryFromScout(boolean b) {
+ super.setMandatoryFromScout(b);
+// if (b != m_mandatoryCached) {
+// m_mandatoryCached = b;
+// getUiLabel().setMandatory(b); // bsh 2010-10-01: inform the label - some GUIs (e.g. Rayo) might use this information
+// }
+
+ updateLabel();
+ }
+
+ /**
+ * Updates the label of the checkbox with the properties of the dispatcher label.
+ * This makes sure that the mandatory appearance is reflected correctly.
+ */
+ protected void updateLabel() {
+ if (getUiLabel() instanceof StatusLabelEx) {
+ StatusLabelEx uiLabel = getUiLabel();
+
+ if (uiLabel.getText() != null) {
+ getUiField().setText(uiLabel.getText());
+ }
+
+ getUiField().setFont(uiLabel.getFont());
+ getUiField().setForeground(uiLabel.getForeground());
+ getUiField().setBackground(uiLabel.getBackground());
+ }
+ }
+
+ @Override
+ protected void detachScout() {
+ super.detachScout();
+ getUiField().removeListener(SWT.Selection, m_uiButtonListener);
+ }
+
+ @Override
+ public Button getUiField() {
+ return (Button) super.getUiField();
+ }
+
+ @Override
+ public StatusLabelEx getUiLabel() {
+ return (StatusLabelEx) super.getUiLabel();
+ }
+
+ @Override
+ public StatusLabelEx getPlaceholderLabel() {
+ return m_labelPlaceholder;
+ }
+
+ @Override
+ protected void setLabelVisibleFromScout() {
+ boolean b = getScoutObject().isLabelVisible();
+ if (m_labelPlaceholder != null && b != m_labelPlaceholder.getVisible()) {
+ m_labelPlaceholder.setVisible(b);
+ if (getUiContainer() != null && isCreated()) {
+ getUiContainer().layout(true, true);
+ }
+ }
+ }
+
+ @Override
+ protected void setLabelFromScout(String s) {
+ super.setLabelFromScout(s);
+ updateLabel();
+ }
+
+ @Override
+ protected void setValueFromScout() {
+ getUiField().setSelection(BooleanUtility.nvl(getScoutObject() == null ? null : getScoutObject().getValue()));
+ }
+
+ protected void handleUiAction() {
+ if (getUiField().isEnabled()) {
+ final boolean b = getUiField().getSelection();
+ if (!m_handleActionPending) {
+ m_handleActionPending = true;
+ // notify Scout
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ try {
+ getScoutObject().getUIFacade().setSelectedFromUI(b);
+ }
+ finally {
+ m_handleActionPending = false;
+ }
+ }
+ };
+ getUiEnvironment().invokeScoutLater(t, 0);
+ // end notify
+ }
+ }
+ }
+
+ private class P_RwtButtonListener implements Listener {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void handleEvent(Event event) {
+ switch (event.type) {
+ case SWT.Selection:
+ handleUiAction();
+ break;
+ }
+ }
+ } // end class P_RwtButtonListener
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/composer/IRwtScoutComposerField.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/composer/IRwtScoutComposerField.java
index f221881897..f666275a12 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/composer/IRwtScoutComposerField.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/composer/IRwtScoutComposerField.java
@@ -1,18 +1,18 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.form.fields.composer;
-
-import org.eclipse.scout.rt.client.ui.form.fields.composer.IComposerField;
-import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
-
-public interface IRwtScoutComposerField extends IRwtScoutFormField<IComposerField> {
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.form.fields.composer;
+
+import org.eclipse.scout.rt.client.ui.form.fields.composer.IComposerField;
+import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
+
+public interface IRwtScoutComposerField extends IRwtScoutFormField<IComposerField> {
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/composer/RwtScoutComposerField.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/composer/RwtScoutComposerField.java
index 8f9ceb8f58..e4c0286f07 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/composer/RwtScoutComposerField.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/composer/RwtScoutComposerField.java
@@ -1,66 +1,66 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.form.fields.composer;
-
-import org.eclipse.rwt.lifecycle.WidgetUtil;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.form.IForm;
-import org.eclipse.scout.rt.client.ui.form.fields.composer.IComposerField;
-import org.eclipse.scout.rt.ui.rap.LogicalGridData;
-import org.eclipse.scout.rt.ui.rap.LogicalGridLayout;
-import org.eclipse.scout.rt.ui.rap.basic.tree.IRwtScoutTree;
-import org.eclipse.scout.rt.ui.rap.basic.tree.RwtScoutTree;
-import org.eclipse.scout.rt.ui.rap.ext.StatusLabelEx;
-import org.eclipse.scout.rt.ui.rap.form.fields.LogicalGridDataBuilder;
-import org.eclipse.scout.rt.ui.rap.form.fields.RwtScoutFieldComposite;
-import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-
-public class RwtScoutComposerField extends RwtScoutFieldComposite<IComposerField> implements IRwtScoutComposerField {
- private static IScoutLogger LOG = ScoutLogManager.getLogger(RwtScoutComposerField.class);
-
- private IRwtScoutTree m_UiTreeComposite;
-
- @Override
- protected void initializeUi(Composite parent) {
- Composite container = getUiEnvironment().getFormToolkit().createComposite(parent);
- StatusLabelEx label = getUiEnvironment().getFormToolkit().createStatusLabel(container, getScoutObject());
-
- // XXX create tree by using extension point (formField Extension),
- // m_treeComposite = getEnvironment().createTree(container, getScoutObject().getTree()); //FIXME AHO: please finish this pending task. I disabled this line meanwhile because it doens't works. regards MHA
- m_UiTreeComposite = new RwtScoutTree();
- Composite treeContainer = new Composite(container, SWT.NONE);
- treeContainer.setLayout(new LogicalGridLayout(1, 0));
- IForm form = (getScoutObject() != null) ? getScoutObject().getForm() : null;
- if (form != null && !IForm.VIEW_ID_PAGE_TABLE.equals(form.getDisplayViewId())) {
- treeContainer.setData(WidgetUtil.CUSTOM_VARIANT, RwtUtility.VARIANT_LISTBOX);
- }
- m_UiTreeComposite.createUiField(treeContainer, getScoutObject().getTree(), getUiEnvironment());
- LogicalGridData fieldData = LogicalGridDataBuilder.createField(getScoutObject().getGridData());
- //
- setUiContainer(container);
- setUiLabel(label);
- setUiField(m_UiTreeComposite.getUiField());
- //layout
- getUiContainer().setLayout(new LogicalGridLayout(1, 0));
- //XXX from imo: basically m_treeComposite.getSwtContainer() should be used here, might be null and only then m_treeComposite.getSwtField() can be used.
- treeContainer.setLayoutData(fieldData);
- }
-
- @Override
- protected void setEnabledFromScout(boolean b) {
- if (m_UiTreeComposite instanceof RwtScoutTree) {
- ((RwtScoutTree) m_UiTreeComposite).setEnabledFromScout(b);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.form.fields.composer;
+
+import org.eclipse.rwt.lifecycle.WidgetUtil;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.client.ui.form.fields.composer.IComposerField;
+import org.eclipse.scout.rt.ui.rap.LogicalGridData;
+import org.eclipse.scout.rt.ui.rap.LogicalGridLayout;
+import org.eclipse.scout.rt.ui.rap.basic.tree.IRwtScoutTree;
+import org.eclipse.scout.rt.ui.rap.basic.tree.RwtScoutTree;
+import org.eclipse.scout.rt.ui.rap.ext.StatusLabelEx;
+import org.eclipse.scout.rt.ui.rap.form.fields.LogicalGridDataBuilder;
+import org.eclipse.scout.rt.ui.rap.form.fields.RwtScoutFieldComposite;
+import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+
+public class RwtScoutComposerField extends RwtScoutFieldComposite<IComposerField> implements IRwtScoutComposerField {
+ private static IScoutLogger LOG = ScoutLogManager.getLogger(RwtScoutComposerField.class);
+
+ private IRwtScoutTree m_UiTreeComposite;
+
+ @Override
+ protected void initializeUi(Composite parent) {
+ Composite container = getUiEnvironment().getFormToolkit().createComposite(parent);
+ StatusLabelEx label = getUiEnvironment().getFormToolkit().createStatusLabel(container, getScoutObject());
+
+ // XXX create tree by using extension point (formField Extension),
+ // m_treeComposite = getEnvironment().createTree(container, getScoutObject().getTree()); //FIXME AHO: please finish this pending task. I disabled this line meanwhile because it doens't works. regards MHA
+ m_UiTreeComposite = new RwtScoutTree();
+ Composite treeContainer = new Composite(container, SWT.NONE);
+ treeContainer.setLayout(new LogicalGridLayout(1, 0));
+ IForm form = (getScoutObject() != null) ? getScoutObject().getForm() : null;
+ if (form != null && !IForm.VIEW_ID_PAGE_TABLE.equals(form.getDisplayViewId())) {
+ treeContainer.setData(WidgetUtil.CUSTOM_VARIANT, RwtUtility.VARIANT_LISTBOX);
+ }
+ m_UiTreeComposite.createUiField(treeContainer, getScoutObject().getTree(), getUiEnvironment());
+ LogicalGridData fieldData = LogicalGridDataBuilder.createField(getScoutObject().getGridData());
+ //
+ setUiContainer(container);
+ setUiLabel(label);
+ setUiField(m_UiTreeComposite.getUiField());
+ //layout
+ getUiContainer().setLayout(new LogicalGridLayout(1, 0));
+ //XXX from imo: basically m_treeComposite.getSwtContainer() should be used here, might be null and only then m_treeComposite.getSwtField() can be used.
+ treeContainer.setLayoutData(fieldData);
+ }
+
+ @Override
+ protected void setEnabledFromScout(boolean b) {
+ if (m_UiTreeComposite instanceof RwtScoutTree) {
+ ((RwtScoutTree) m_UiTreeComposite).setEnabledFromScout(b);
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/datefield/DateFieldFactory.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/datefield/DateFieldFactory.java
index c611e236ed..5992f0bc47 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/datefield/DateFieldFactory.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/datefield/DateFieldFactory.java
@@ -1,57 +1,57 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.form.fields.datefield;
-
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.datefield.IDateField;
-import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
-import org.eclipse.scout.rt.ui.rap.extension.IFormFieldFactory;
-import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
-import org.eclipse.swt.widgets.Composite;
-
-public class DateFieldFactory implements IFormFieldFactory {
-
- @Override
- public IRwtScoutFormField<?> createUiFormField(Composite parent, IFormField field, IRwtEnvironment uiEnvironment) {
- if (!(field instanceof IDateField)) {
- return null;
- }
-
- IDateField d = (IDateField) field;
- if (d.isHasDate() && d.isHasTime()) {
- IRwtScoutFormField<IDateField> ui = createRwtScoutDateTimeField();
- ui.createUiField(parent, d, uiEnvironment);
- return ui;
- }
- else if (d.isHasDate()) {
- IRwtScoutDateField ui = createRwtScoutDateField();
- ui.createUiField(parent, d, uiEnvironment);
- return ui;
- }
- else {
- IRwtScoutTimeField ui = createRwtScoutTimeField();
- ui.createUiField(parent, d, uiEnvironment);
- return ui;
- }
- }
-
- protected IRwtScoutFormField<IDateField> createRwtScoutDateTimeField() {
- return new RwtScoutDateTimeCompositeField();
- }
-
- protected IRwtScoutDateField createRwtScoutDateField() {
- return new RwtScoutDateField();
- }
-
- protected IRwtScoutTimeField createRwtScoutTimeField() {
- return new RwtScoutTimeField();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.form.fields.datefield;
+
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.datefield.IDateField;
+import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
+import org.eclipse.scout.rt.ui.rap.extension.IFormFieldFactory;
+import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
+import org.eclipse.swt.widgets.Composite;
+
+public class DateFieldFactory implements IFormFieldFactory {
+
+ @Override
+ public IRwtScoutFormField<?> createUiFormField(Composite parent, IFormField field, IRwtEnvironment uiEnvironment) {
+ if (!(field instanceof IDateField)) {
+ return null;
+ }
+
+ IDateField d = (IDateField) field;
+ if (d.isHasDate() && d.isHasTime()) {
+ IRwtScoutFormField<IDateField> ui = createRwtScoutDateTimeField();
+ ui.createUiField(parent, d, uiEnvironment);
+ return ui;
+ }
+ else if (d.isHasDate()) {
+ IRwtScoutDateField ui = createRwtScoutDateField();
+ ui.createUiField(parent, d, uiEnvironment);
+ return ui;
+ }
+ else {
+ IRwtScoutTimeField ui = createRwtScoutTimeField();
+ ui.createUiField(parent, d, uiEnvironment);
+ return ui;
+ }
+ }
+
+ protected IRwtScoutFormField<IDateField> createRwtScoutDateTimeField() {
+ return new RwtScoutDateTimeCompositeField();
+ }
+
+ protected IRwtScoutDateField createRwtScoutDateField() {
+ return new RwtScoutDateField();
+ }
+
+ protected IRwtScoutTimeField createRwtScoutTimeField() {
+ return new RwtScoutTimeField();
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/datefield/IRwtScoutDateField.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/datefield/IRwtScoutDateField.java
index 215049fa1b..2b61d05244 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/datefield/IRwtScoutDateField.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/datefield/IRwtScoutDateField.java
@@ -1,32 +1,32 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.form.fields.datefield;
-
-import org.eclipse.scout.rt.client.ui.form.fields.datefield.IDateField;
-import org.eclipse.scout.rt.ui.rap.ext.custom.StyledText;
-import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
-import org.eclipse.swt.widgets.Button;
-
-/**
- * <h3>IRwtScoutDateField</h3> ...
- *
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.form.fields.datefield;
+
+import org.eclipse.scout.rt.client.ui.form.fields.datefield.IDateField;
+import org.eclipse.scout.rt.ui.rap.ext.custom.StyledText;
+import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
+import org.eclipse.swt.widgets.Button;
+
+/**
+ * <h3>IRwtScoutDateField</h3> ...
+ *
* @since 3.7.0 June 2011
- */
-public interface IRwtScoutDateField extends IRwtScoutFormField<IDateField> {
-
- String VARIANT_DATEFIELD = "datefield";
- String VARIANT_DATEFIELD_DISABLED = "datefield-disabled";
-
- Button getDropDownButton();
-
- @Override
- StyledText getUiField();
-}
+ */
+public interface IRwtScoutDateField extends IRwtScoutFormField<IDateField> {
+
+ String VARIANT_DATEFIELD = "datefield";
+ String VARIANT_DATEFIELD_DISABLED = "datefield-disabled";
+
+ Button getDropDownButton();
+
+ @Override
+ StyledText getUiField();
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/datefield/IRwtScoutTimeField.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/datefield/IRwtScoutTimeField.java
index e4819c0b95..900854ccea 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/datefield/IRwtScoutTimeField.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/datefield/IRwtScoutTimeField.java
@@ -1,32 +1,32 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.form.fields.datefield;
-
-import org.eclipse.scout.rt.client.ui.form.fields.datefield.IDateField;
-import org.eclipse.scout.rt.ui.rap.ext.custom.StyledText;
-import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
-import org.eclipse.swt.widgets.Button;
-
-/**
- * <h3>IRwtScoutDateField</h3> ...
- *
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.form.fields.datefield;
+
+import org.eclipse.scout.rt.client.ui.form.fields.datefield.IDateField;
+import org.eclipse.scout.rt.ui.rap.ext.custom.StyledText;
+import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
+import org.eclipse.swt.widgets.Button;
+
+/**
+ * <h3>IRwtScoutDateField</h3> ...
+ *
* @since 3.7.0 June 2011
- */
-public interface IRwtScoutTimeField extends IRwtScoutFormField<IDateField> {
-
- String VARIANT_TIMEFIELD = "timefield";
- String VARIANT_TIMEFIELD_DISABLED = "timefield-disabled";
-
- Button getDropDownButton();
-
- @Override
- StyledText getUiField();
-}
+ */
+public interface IRwtScoutTimeField extends IRwtScoutFormField<IDateField> {
+
+ String VARIANT_TIMEFIELD = "timefield";
+ String VARIANT_TIMEFIELD_DISABLED = "timefield-disabled";
+
+ Button getDropDownButton();
+
+ @Override
+ StyledText getUiField();
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/datefield/RwtScoutDateField.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/datefield/RwtScoutDateField.java
index dc6749602d..3fb27173ac 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/datefield/RwtScoutDateField.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/datefield/RwtScoutDateField.java
@@ -1,570 +1,570 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.form.fields.datefield;
-
-import java.text.DateFormat;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.rwt.lifecycle.WidgetUtil;
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.commons.holders.Holder;
-import org.eclipse.scout.commons.job.JobEx;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.datefield.IDateField;
-import org.eclipse.scout.rt.ui.rap.LogicalGridLayout;
-import org.eclipse.scout.rt.ui.rap.ext.ButtonEx;
-import org.eclipse.scout.rt.ui.rap.ext.StatusLabelEx;
-import org.eclipse.scout.rt.ui.rap.ext.StyledTextEx;
-import org.eclipse.scout.rt.ui.rap.ext.custom.StyledText;
-import org.eclipse.scout.rt.ui.rap.form.fields.IPopupSupport;
-import org.eclipse.scout.rt.ui.rap.form.fields.LogicalGridDataBuilder;
-import org.eclipse.scout.rt.ui.rap.form.fields.RwtScoutValueFieldComposite;
-import org.eclipse.scout.rt.ui.rap.form.fields.datefield.chooser.DateChooserDialog;
-import org.eclipse.scout.rt.ui.rap.internal.TextFieldEditableSupport;
-import org.eclipse.scout.rt.ui.rap.keystroke.RwtKeyStroke;
-import org.eclipse.scout.rt.ui.rap.util.RwtLayoutUtility;
-import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.FocusAdapter;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.ShellEvent;
-import org.eclipse.swt.events.ShellListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
-
-public class RwtScoutDateField extends RwtScoutValueFieldComposite<IDateField> implements IRwtScoutDateField, IPopupSupport {
-
- private Button m_dropDownButton;
- private TextFieldEditableSupport m_editableSupport;
-
- private Set<IPopupSupportListener> m_popupEventListeners;
- private Object m_popupEventListenerLock;
-
- private boolean m_ignoreLabel = false;
- private Composite m_dateContainer;
- private boolean m_dateTimeCompositeMember;
- private String m_displayTextToVerify;
- private DateChooserDialog m_dateChooserDialog = null;
- private FocusAdapter m_textFieldFocusAdapter = null;
-
- public void setIgnoreLabel(boolean ignoreLabel) {
- m_ignoreLabel = ignoreLabel;
- if (ignoreLabel) {
- getUiLabel().setVisible(false);
- }
- else {
- getUiLabel().setVisible(getScoutObject().isLabelVisible());
- }
- }
-
- public boolean isIgnoreLabel() {
- return m_ignoreLabel;
- }
-
- public boolean isDateTimeCompositeMember() {
- return m_dateTimeCompositeMember;
- }
-
- public void setDateTimeCompositeMember(boolean dateTimeCompositeMember) {
- m_dateTimeCompositeMember = dateTimeCompositeMember;
- }
-
- @Override
- protected void initializeUi(Composite parent) {
- m_popupEventListeners = new HashSet<IPopupSupportListener>();
- m_popupEventListenerLock = new Object();
-
- Composite container = getUiEnvironment().getFormToolkit().createComposite(parent);
- StatusLabelEx label = getUiEnvironment().getFormToolkit().createStatusLabel(container, getScoutObject());
-
- m_dateContainer = getUiEnvironment().getFormToolkit().createComposite(container, SWT.BORDER);
- m_dateContainer.setData(WidgetUtil.CUSTOM_VARIANT, VARIANT_DATEFIELD);
-
- StyledText textField = new StyledTextEx(m_dateContainer, SWT.SINGLE);
- getUiEnvironment().getFormToolkit().adapt(textField, false, false);
- textField.setData(WidgetUtil.CUSTOM_VARIANT, VARIANT_DATEFIELD);
-
- ButtonEx dateChooserButton = getUiEnvironment().getFormToolkit().createButtonEx(m_dateContainer, SWT.PUSH | SWT.NO_FOCUS);
- dateChooserButton.setData(WidgetUtil.CUSTOM_VARIANT, VARIANT_DATEFIELD);
- m_dateContainer.setTabList(new Control[]{textField});
- container.setTabList(new Control[]{m_dateContainer});
-
- // key strokes on container
- getUiEnvironment().addKeyStroke(container, new P_DateChooserOpenKeyStroke(), false);
-
- // key strokes on field
- getUiEnvironment().addKeyStroke(textField, new P_ShiftDayUpKeyStroke(), false);
- getUiEnvironment().addKeyStroke(textField, new P_ShiftDayDownKeyStroke(), false);
- getUiEnvironment().addKeyStroke(textField, new P_ShiftMonthUpKeyStroke(), false);
- getUiEnvironment().addKeyStroke(textField, new P_ShiftMonthDownKeyStroke(), false);
- getUiEnvironment().addKeyStroke(textField, new P_ShiftYearUpKeyStroke(), false);
- getUiEnvironment().addKeyStroke(textField, new P_ShiftYearDownKeyStroke(), false);
-
- // listener
- dateChooserButton.addListener(ButtonEx.SELECTION_ACTION, new P_RwtBrowseButtonListener());
- textField.addMouseListener(new MouseAdapter() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void mouseUp(MouseEvent e) {
- handleUiDateChooserAction();
- }
- });
- //
- setUiContainer(container);
- setUiLabel(label);
- setDropDownButton(dateChooserButton);
- setUiField(textField);
- // layout
- container.setLayout(new LogicalGridLayout(1, 0));
-
- m_dateContainer.setLayoutData(LogicalGridDataBuilder.createField(((IFormField) getScoutObject()).getGridData()));
- m_dateContainer.setLayout(RwtLayoutUtility.createGridLayoutNoSpacing(2, false));
-
- GridData textLayoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
- textField.setLayoutData(textLayoutData);
-
- GridData buttonLayoutData = new GridData(SWT.CENTER, SWT.CENTER, false, false);
- buttonLayoutData.heightHint = 20;
- buttonLayoutData.widthHint = 20;
- dateChooserButton.setLayoutData(buttonLayoutData);
- }
-
- @Override
- public Button getDropDownButton() {
- return m_dropDownButton;
- }
-
- public void setDropDownButton(ButtonEx b) {
- m_dropDownButton = b;
- }
-
- @Override
- public StyledTextEx getUiField() {
- return (StyledTextEx) super.getUiField();
- }
-
- public boolean isFocusInDatePicker() {
- if (m_dateChooserDialog == null) {
- return false;
- }
-
- Control focusControl = getUiEnvironment().getDisplay().getFocusControl();
- boolean isFocusInDatePicker = RwtUtility.isAncestorOf(m_dateChooserDialog.getShell(), focusControl);
- return isFocusInDatePicker;
- }
-
- private void installFocusListenerOnTextField() {
- if (getUiField().isDisposed()) {
- return;
- }
-
- getUiField().setFocus();
- if (m_textFieldFocusAdapter == null) {
- m_textFieldFocusAdapter = new FocusAdapter() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void focusLost(FocusEvent e) {
- handleUiFocusLostOnDatePickerPopup(e);
- }
- };
- }
- getUiField().addFocusListener(m_textFieldFocusAdapter);
- }
-
- /**
- * The event is fired only if the datepicker popup is open.
- * <p>
- * The default sets the focus on the ui field if the new focus is inside the date picker. <br/>
- * If the new focus is outside the date picker it makes sure the date picker popup will be closed.
- * </p>
- */
- protected void handleUiFocusLostOnDatePickerPopup(FocusEvent event) {
- if (isFocusInDatePicker()) {
- getUiEnvironment().getDisplay().asyncExec(new Runnable() {
-
- @Override
- public void run() {
- getUiField().setFocus();
- }
-
- });
- }
- else {
- getUiEnvironment().getDisplay().asyncExec(new Runnable() {
-
- @Override
- public void run() {
- makeSureDateChooserIsClosed();
- }
-
- });
- }
- }
-
- private void uninstallFocusListenerOnTextField() {
- if (!getUiField().isDisposed() && m_textFieldFocusAdapter != null) {
- getUiField().removeFocusListener(m_textFieldFocusAdapter);
- }
- }
-
- @Override
- protected void setEnabledFromScout(boolean b) {
- super.setEnabledFromScout(b);
- m_dropDownButton.setEnabled(b);
- if (b) {
- m_dateContainer.setData(WidgetUtil.CUSTOM_VARIANT, VARIANT_DATEFIELD);
- }
- else {
- m_dateContainer.setData(WidgetUtil.CUSTOM_VARIANT, VARIANT_DATEFIELD_DISABLED);
- }
- }
-
- @Override
- protected void setLabelVisibleFromScout() {
- if (!isIgnoreLabel()) {
- super.setLabelVisibleFromScout();
- }
- }
-
- @Override
- protected void setFieldEnabled(Control rwtField, boolean enabled) {
- if (m_editableSupport == null) {
- m_editableSupport = new TextFieldEditableSupport(getUiField());
- }
- m_editableSupport.setEditable(enabled);
- }
-
- @Override
- protected void setDisplayTextFromScout(String s) {
- IDateField f = getScoutObject();
- if (f.getErrorStatus() != null) {
- return;
- }
- if (s == null) {
- s = "";
- }
- m_displayTextToVerify = s;
- Date value = f.getValue();
- if (value == null) {
- //only date field
- getUiField().setText(m_displayTextToVerify);
- super.handleUiFocusGained();
- getUiField().setCaretOffset(0);
- return;
- }
- DateFormat format = f.getIsolatedDateFormat();
- if (format != null) {
- m_displayTextToVerify = format.format(value);
- getUiField().setText(m_displayTextToVerify);
- super.handleUiFocusGained();
- getUiField().setCaretOffset(0);
- }
- }
-
- @Override
- protected void setBackgroundFromScout(String scoutColor) {
- setBackgroundFromScout(scoutColor, m_dateContainer);
- }
-
- @Override
- protected void handleUiInputVerifier(boolean doit) {
- if (!doit) {
- return;
- }
- final String text = getUiField().getText();
- // only handle if text has changed
- if (CompareUtility.equals(text, m_displayTextToVerify) && (isDateTimeCompositeMember() || getScoutObject().getErrorStatus() == null)) {
- return;
- }
- m_displayTextToVerify = text;
- final Holder<Boolean> result = new Holder<Boolean>(Boolean.class, false);
- // notify Scout
- Runnable t = new Runnable() {
- @Override
- public void run() {
- boolean b = getScoutObject().getUIFacade().setDateTextFromUI(text);
- result.setValue(b);
- }
- };
- JobEx job = getUiEnvironment().invokeScoutLater(t, 0);
- try {
- job.join(2345);
- }
- catch (InterruptedException e) {
- //nop
- }
- getUiEnvironment().dispatchImmediateUiJobs();
- // end notify
- return;
- }
-
- @Override
- protected void handleUiFocusGained() {
- if (isSelectAllOnFocusEnabled()) {
- getUiField().setSelection(0, getUiField().getText().length());
- }
- }
-
- private void notifyPopupEventListeners(int eventType) {
- IPopupSupportListener[] listeners;
- synchronized (m_popupEventListenerLock) {
- listeners = m_popupEventListeners.toArray(new IPopupSupportListener[m_popupEventListeners.size()]);
- }
- for (IPopupSupportListener listener : listeners) {
- listener.handleEvent(eventType);
- }
- }
-
- @Override
- public void addPopupEventListener(IPopupSupportListener listener) {
- synchronized (m_popupEventListenerLock) {
- m_popupEventListeners.add(listener);
- }
- }
-
- @Override
- public void removePopupEventListener(IPopupSupportListener listener) {
- synchronized (m_popupEventListenerLock) {
- m_popupEventListeners.remove(listener);
- }
- }
-
- protected void makeSureDateChooserIsClosed() {
- if (m_dateChooserDialog != null
- && m_dateChooserDialog.getShell() != null
- && !m_dateChooserDialog.getShell().isDisposed()) {
- m_dateChooserDialog.getShell().close();
- }
-
- uninstallFocusListenerOnTextField();
- }
-
- private void handleUiDateChooserAction() {
- if (!getDropDownButton().isVisible() || !getDropDownButton().isEnabled()) {
- return;
- }
-
- Date oldDate = getScoutObject().getValue();
- if (oldDate == null) {
- oldDate = new Date();
- }
-
- notifyPopupEventListeners(IPopupSupportListener.TYPE_OPENING);
-
- makeSureDateChooserIsClosed();
- m_dateChooserDialog = createDateChooserDialog(getUiField().getShell(), oldDate);
- if (m_dateChooserDialog != null) {
-
- m_dateChooserDialog.getShell().addDisposeListener(new DisposeListener() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void widgetDisposed(DisposeEvent event) {
- getDateFromClosedDateChooserDialog();
- }
- });
-
- m_dateChooserDialog.openDateChooser(getUiField());
- installFocusListenerOnTextField();
- }
- }
-
- protected DateChooserDialog createDateChooserDialog(Shell parentShell, Date currentDate) {
- return new DateChooserDialog(parentShell, currentDate);
- }
-
- private void getDateFromClosedDateChooserDialog() {
- removeListenersFromDateChooserDialog();
- boolean setFocusToUiField = false;
- try {
- final Date newDate = m_dateChooserDialog.getReturnDate();
- if (newDate != null) {
- setFocusToUiField = true;
- // notify Scout
- Runnable t = new Runnable() {
- @Override
- public void run() {
- getScoutObject().getUIFacade().setDateFromUI(newDate);
- }
- };
- getUiEnvironment().invokeScoutLater(t, 0);
- // end notify
- }
- }
- finally {
- notifyPopupEventListeners(IPopupSupportListener.TYPE_CLOSED);
- uninstallFocusListenerOnTextField();
- if (setFocusToUiField
- && !getUiField().isDisposed()) {
- getUiField().setFocus();
- }
- }
- }
-
- private void removeListenersFromDateChooserDialog() {
- Object[] shellListeners = ShellEvent.getListeners(m_dateChooserDialog.getShell());
- for (Object object : shellListeners) {
- if (object.getClass().isInstance(this)
- || (object.getClass().getEnclosingClass() != null && object.getClass().getEnclosingClass().isInstance(this))) {
- m_dateChooserDialog.getShell().removeShellListener((ShellListener) object);
- }
- }
- Object[] disposeListeners = DisposeEvent.getListeners(m_dateChooserDialog.getShell());
- for (Object object : disposeListeners) {
- if (object.getClass().isInstance(this)
- || (object.getClass().getEnclosingClass() != null && object.getClass().getEnclosingClass().isInstance(this))) {
- m_dateChooserDialog.getShell().removeDisposeListener((DisposeListener) object);
- }
- }
- }
-
- private class P_RwtBrowseButtonListener implements Listener {
- private static final long serialVersionUID = 1L;
-
- public P_RwtBrowseButtonListener() {
- }
-
- @Override
- public void handleEvent(Event event) {
- switch (event.type) {
- case ButtonEx.SELECTION_ACTION:
- getUiField().forceFocus();
- handleUiDateChooserAction();
- break;
- default:
- break;
- }
- }
- } // end class P_RwtBrowseButtonListener
-
- private void shiftDate(final int level, final int value) {
- if (getUiField().isDisposed()) {
- return;
- }
- if (getUiField().isEnabled()
- && getUiField().getEditable()
- && getUiField().isVisible()) {
- if (level >= 0) {
- // notify Scout
- Runnable t = new Runnable() {
- @Override
- public void run() {
- getScoutObject().getUIFacade().fireDateShiftActionFromUI(level, value);
- }
- };
- getUiEnvironment().invokeScoutLater(t, 0);
- // end notify
- }
- }
- }
-
- private class P_ShiftDayUpKeyStroke extends RwtKeyStroke {
- public P_ShiftDayUpKeyStroke() {
- super(SWT.ARROW_UP);
- }
-
- @Override
- public void handleUiAction(Event e) {
- int level = 0;
- int value = 1;
- shiftDate(level, value);
- }
- }
-
- private class P_ShiftDayDownKeyStroke extends RwtKeyStroke {
- public P_ShiftDayDownKeyStroke() {
- super(SWT.ARROW_DOWN);
- }
-
- @Override
- public void handleUiAction(Event e) {
- int level = 0;
- int value = -1;
- shiftDate(level, value);
- }
- }
-
- private class P_ShiftMonthUpKeyStroke extends RwtKeyStroke {
- public P_ShiftMonthUpKeyStroke() {
- super(SWT.ARROW_UP, SWT.SHIFT);
- }
-
- @Override
- public void handleUiAction(Event e) {
- int level = 1;
- int value = 1;
- shiftDate(level, value);
- }
- }
-
- private class P_ShiftMonthDownKeyStroke extends RwtKeyStroke {
- public P_ShiftMonthDownKeyStroke() {
- super(SWT.ARROW_DOWN, SWT.SHIFT);
- }
-
- @Override
- public void handleUiAction(Event e) {
- int level = 1;
- int value = -1;
- shiftDate(level, value);
- }
- }
-
- private class P_ShiftYearUpKeyStroke extends RwtKeyStroke {
- public P_ShiftYearUpKeyStroke() {
- super(SWT.ARROW_UP, SWT.CONTROL);
- }
-
- @Override
- public void handleUiAction(Event e) {
- int level = 2;
- int value = 1;
- shiftDate(level, value);
- }
- }
-
- private class P_ShiftYearDownKeyStroke extends RwtKeyStroke {
- public P_ShiftYearDownKeyStroke() {
- super(SWT.ARROW_DOWN, SWT.CONTROL);
- }
-
- @Override
- public void handleUiAction(Event e) {
- int level = 2;
- int value = -1;
- shiftDate(level, value);
- }
- }
-
- private class P_DateChooserOpenKeyStroke extends RwtKeyStroke {
- public P_DateChooserOpenKeyStroke() {
- super(SWT.F2);
- }
-
- @Override
- public void handleUiAction(Event e) {
- handleUiDateChooserAction();
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.form.fields.datefield;
+
+import java.text.DateFormat;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.rwt.lifecycle.WidgetUtil;
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.commons.holders.Holder;
+import org.eclipse.scout.commons.job.JobEx;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.datefield.IDateField;
+import org.eclipse.scout.rt.ui.rap.LogicalGridLayout;
+import org.eclipse.scout.rt.ui.rap.ext.ButtonEx;
+import org.eclipse.scout.rt.ui.rap.ext.StatusLabelEx;
+import org.eclipse.scout.rt.ui.rap.ext.StyledTextEx;
+import org.eclipse.scout.rt.ui.rap.ext.custom.StyledText;
+import org.eclipse.scout.rt.ui.rap.form.fields.IPopupSupport;
+import org.eclipse.scout.rt.ui.rap.form.fields.LogicalGridDataBuilder;
+import org.eclipse.scout.rt.ui.rap.form.fields.RwtScoutValueFieldComposite;
+import org.eclipse.scout.rt.ui.rap.form.fields.datefield.chooser.DateChooserDialog;
+import org.eclipse.scout.rt.ui.rap.internal.TextFieldEditableSupport;
+import org.eclipse.scout.rt.ui.rap.keystroke.RwtKeyStroke;
+import org.eclipse.scout.rt.ui.rap.util.RwtLayoutUtility;
+import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.FocusAdapter;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.ShellEvent;
+import org.eclipse.swt.events.ShellListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+
+public class RwtScoutDateField extends RwtScoutValueFieldComposite<IDateField> implements IRwtScoutDateField, IPopupSupport {
+
+ private Button m_dropDownButton;
+ private TextFieldEditableSupport m_editableSupport;
+
+ private Set<IPopupSupportListener> m_popupEventListeners;
+ private Object m_popupEventListenerLock;
+
+ private boolean m_ignoreLabel = false;
+ private Composite m_dateContainer;
+ private boolean m_dateTimeCompositeMember;
+ private String m_displayTextToVerify;
+ private DateChooserDialog m_dateChooserDialog = null;
+ private FocusAdapter m_textFieldFocusAdapter = null;
+
+ public void setIgnoreLabel(boolean ignoreLabel) {
+ m_ignoreLabel = ignoreLabel;
+ if (ignoreLabel) {
+ getUiLabel().setVisible(false);
+ }
+ else {
+ getUiLabel().setVisible(getScoutObject().isLabelVisible());
+ }
+ }
+
+ public boolean isIgnoreLabel() {
+ return m_ignoreLabel;
+ }
+
+ public boolean isDateTimeCompositeMember() {
+ return m_dateTimeCompositeMember;
+ }
+
+ public void setDateTimeCompositeMember(boolean dateTimeCompositeMember) {
+ m_dateTimeCompositeMember = dateTimeCompositeMember;
+ }
+
+ @Override
+ protected void initializeUi(Composite parent) {
+ m_popupEventListeners = new HashSet<IPopupSupportListener>();
+ m_popupEventListenerLock = new Object();
+
+ Composite container = getUiEnvironment().getFormToolkit().createComposite(parent);
+ StatusLabelEx label = getUiEnvironment().getFormToolkit().createStatusLabel(container, getScoutObject());
+
+ m_dateContainer = getUiEnvironment().getFormToolkit().createComposite(container, SWT.BORDER);
+ m_dateContainer.setData(WidgetUtil.CUSTOM_VARIANT, VARIANT_DATEFIELD);
+
+ StyledText textField = new StyledTextEx(m_dateContainer, SWT.SINGLE);
+ getUiEnvironment().getFormToolkit().adapt(textField, false, false);
+ textField.setData(WidgetUtil.CUSTOM_VARIANT, VARIANT_DATEFIELD);
+
+ ButtonEx dateChooserButton = getUiEnvironment().getFormToolkit().createButtonEx(m_dateContainer, SWT.PUSH | SWT.NO_FOCUS);
+ dateChooserButton.setData(WidgetUtil.CUSTOM_VARIANT, VARIANT_DATEFIELD);
+ m_dateContainer.setTabList(new Control[]{textField});
+ container.setTabList(new Control[]{m_dateContainer});
+
+ // key strokes on container
+ getUiEnvironment().addKeyStroke(container, new P_DateChooserOpenKeyStroke(), false);
+
+ // key strokes on field
+ getUiEnvironment().addKeyStroke(textField, new P_ShiftDayUpKeyStroke(), false);
+ getUiEnvironment().addKeyStroke(textField, new P_ShiftDayDownKeyStroke(), false);
+ getUiEnvironment().addKeyStroke(textField, new P_ShiftMonthUpKeyStroke(), false);
+ getUiEnvironment().addKeyStroke(textField, new P_ShiftMonthDownKeyStroke(), false);
+ getUiEnvironment().addKeyStroke(textField, new P_ShiftYearUpKeyStroke(), false);
+ getUiEnvironment().addKeyStroke(textField, new P_ShiftYearDownKeyStroke(), false);
+
+ // listener
+ dateChooserButton.addListener(ButtonEx.SELECTION_ACTION, new P_RwtBrowseButtonListener());
+ textField.addMouseListener(new MouseAdapter() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void mouseUp(MouseEvent e) {
+ handleUiDateChooserAction();
+ }
+ });
+ //
+ setUiContainer(container);
+ setUiLabel(label);
+ setDropDownButton(dateChooserButton);
+ setUiField(textField);
+ // layout
+ container.setLayout(new LogicalGridLayout(1, 0));
+
+ m_dateContainer.setLayoutData(LogicalGridDataBuilder.createField(((IFormField) getScoutObject()).getGridData()));
+ m_dateContainer.setLayout(RwtLayoutUtility.createGridLayoutNoSpacing(2, false));
+
+ GridData textLayoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
+ textField.setLayoutData(textLayoutData);
+
+ GridData buttonLayoutData = new GridData(SWT.CENTER, SWT.CENTER, false, false);
+ buttonLayoutData.heightHint = 20;
+ buttonLayoutData.widthHint = 20;
+ dateChooserButton.setLayoutData(buttonLayoutData);
+ }
+
+ @Override
+ public Button getDropDownButton() {
+ return m_dropDownButton;
+ }
+
+ public void setDropDownButton(ButtonEx b) {
+ m_dropDownButton = b;
+ }
+
+ @Override
+ public StyledTextEx getUiField() {
+ return (StyledTextEx) super.getUiField();
+ }
+
+ public boolean isFocusInDatePicker() {
+ if (m_dateChooserDialog == null) {
+ return false;
+ }
+
+ Control focusControl = getUiEnvironment().getDisplay().getFocusControl();
+ boolean isFocusInDatePicker = RwtUtility.isAncestorOf(m_dateChooserDialog.getShell(), focusControl);
+ return isFocusInDatePicker;
+ }
+
+ private void installFocusListenerOnTextField() {
+ if (getUiField().isDisposed()) {
+ return;
+ }
+
+ getUiField().setFocus();
+ if (m_textFieldFocusAdapter == null) {
+ m_textFieldFocusAdapter = new FocusAdapter() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void focusLost(FocusEvent e) {
+ handleUiFocusLostOnDatePickerPopup(e);
+ }
+ };
+ }
+ getUiField().addFocusListener(m_textFieldFocusAdapter);
+ }
+
+ /**
+ * The event is fired only if the datepicker popup is open.
+ * <p>
+ * The default sets the focus on the ui field if the new focus is inside the date picker. <br/>
+ * If the new focus is outside the date picker it makes sure the date picker popup will be closed.
+ * </p>
+ */
+ protected void handleUiFocusLostOnDatePickerPopup(FocusEvent event) {
+ if (isFocusInDatePicker()) {
+ getUiEnvironment().getDisplay().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ getUiField().setFocus();
+ }
+
+ });
+ }
+ else {
+ getUiEnvironment().getDisplay().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ makeSureDateChooserIsClosed();
+ }
+
+ });
+ }
+ }
+
+ private void uninstallFocusListenerOnTextField() {
+ if (!getUiField().isDisposed() && m_textFieldFocusAdapter != null) {
+ getUiField().removeFocusListener(m_textFieldFocusAdapter);
+ }
+ }
+
+ @Override
+ protected void setEnabledFromScout(boolean b) {
+ super.setEnabledFromScout(b);
+ m_dropDownButton.setEnabled(b);
+ if (b) {
+ m_dateContainer.setData(WidgetUtil.CUSTOM_VARIANT, VARIANT_DATEFIELD);
+ }
+ else {
+ m_dateContainer.setData(WidgetUtil.CUSTOM_VARIANT, VARIANT_DATEFIELD_DISABLED);
+ }
+ }
+
+ @Override
+ protected void setLabelVisibleFromScout() {
+ if (!isIgnoreLabel()) {
+ super.setLabelVisibleFromScout();
+ }
+ }
+
+ @Override
+ protected void setFieldEnabled(Control rwtField, boolean enabled) {
+ if (m_editableSupport == null) {
+ m_editableSupport = new TextFieldEditableSupport(getUiField());
+ }
+ m_editableSupport.setEditable(enabled);
+ }
+
+ @Override
+ protected void setDisplayTextFromScout(String s) {
+ IDateField f = getScoutObject();
+ if (f.getErrorStatus() != null) {
+ return;
+ }
+ if (s == null) {
+ s = "";
+ }
+ m_displayTextToVerify = s;
+ Date value = f.getValue();
+ if (value == null) {
+ //only date field
+ getUiField().setText(m_displayTextToVerify);
+ super.handleUiFocusGained();
+ getUiField().setCaretOffset(0);
+ return;
+ }
+ DateFormat format = f.getIsolatedDateFormat();
+ if (format != null) {
+ m_displayTextToVerify = format.format(value);
+ getUiField().setText(m_displayTextToVerify);
+ super.handleUiFocusGained();
+ getUiField().setCaretOffset(0);
+ }
+ }
+
+ @Override
+ protected void setBackgroundFromScout(String scoutColor) {
+ setBackgroundFromScout(scoutColor, m_dateContainer);
+ }
+
+ @Override
+ protected void handleUiInputVerifier(boolean doit) {
+ if (!doit) {
+ return;
+ }
+ final String text = getUiField().getText();
+ // only handle if text has changed
+ if (CompareUtility.equals(text, m_displayTextToVerify) && (isDateTimeCompositeMember() || getScoutObject().getErrorStatus() == null)) {
+ return;
+ }
+ m_displayTextToVerify = text;
+ final Holder<Boolean> result = new Holder<Boolean>(Boolean.class, false);
+ // notify Scout
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ boolean b = getScoutObject().getUIFacade().setDateTextFromUI(text);
+ result.setValue(b);
+ }
+ };
+ JobEx job = getUiEnvironment().invokeScoutLater(t, 0);
+ try {
+ job.join(2345);
+ }
+ catch (InterruptedException e) {
+ //nop
+ }
+ getUiEnvironment().dispatchImmediateUiJobs();
+ // end notify
+ return;
+ }
+
+ @Override
+ protected void handleUiFocusGained() {
+ if (isSelectAllOnFocusEnabled()) {
+ getUiField().setSelection(0, getUiField().getText().length());
+ }
+ }
+
+ private void notifyPopupEventListeners(int eventType) {
+ IPopupSupportListener[] listeners;
+ synchronized (m_popupEventListenerLock) {
+ listeners = m_popupEventListeners.toArray(new IPopupSupportListener[m_popupEventListeners.size()]);
+ }
+ for (IPopupSupportListener listener : listeners) {
+ listener.handleEvent(eventType);
+ }
+ }
+
+ @Override
+ public void addPopupEventListener(IPopupSupportListener listener) {
+ synchronized (m_popupEventListenerLock) {
+ m_popupEventListeners.add(listener);
+ }
+ }
+
+ @Override
+ public void removePopupEventListener(IPopupSupportListener listener) {
+ synchronized (m_popupEventListenerLock) {
+ m_popupEventListeners.remove(listener);
+ }
+ }
+
+ protected void makeSureDateChooserIsClosed() {
+ if (m_dateChooserDialog != null
+ && m_dateChooserDialog.getShell() != null
+ && !m_dateChooserDialog.getShell().isDisposed()) {
+ m_dateChooserDialog.getShell().close();
+ }
+
+ uninstallFocusListenerOnTextField();
+ }
+
+ private void handleUiDateChooserAction() {
+ if (!getDropDownButton().isVisible() || !getDropDownButton().isEnabled()) {
+ return;
+ }
+
+ Date oldDate = getScoutObject().getValue();
+ if (oldDate == null) {
+ oldDate = new Date();
+ }
+
+ notifyPopupEventListeners(IPopupSupportListener.TYPE_OPENING);
+
+ makeSureDateChooserIsClosed();
+ m_dateChooserDialog = createDateChooserDialog(getUiField().getShell(), oldDate);
+ if (m_dateChooserDialog != null) {
+
+ m_dateChooserDialog.getShell().addDisposeListener(new DisposeListener() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void widgetDisposed(DisposeEvent event) {
+ getDateFromClosedDateChooserDialog();
+ }
+ });
+
+ m_dateChooserDialog.openDateChooser(getUiField());
+ installFocusListenerOnTextField();
+ }
+ }
+
+ protected DateChooserDialog createDateChooserDialog(Shell parentShell, Date currentDate) {
+ return new DateChooserDialog(parentShell, currentDate);
+ }
+
+ private void getDateFromClosedDateChooserDialog() {
+ removeListenersFromDateChooserDialog();
+ boolean setFocusToUiField = false;
+ try {
+ final Date newDate = m_dateChooserDialog.getReturnDate();
+ if (newDate != null) {
+ setFocusToUiField = true;
+ // notify Scout
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ getScoutObject().getUIFacade().setDateFromUI(newDate);
+ }
+ };
+ getUiEnvironment().invokeScoutLater(t, 0);
+ // end notify
+ }
+ }
+ finally {
+ notifyPopupEventListeners(IPopupSupportListener.TYPE_CLOSED);
+ uninstallFocusListenerOnTextField();
+ if (setFocusToUiField
+ && !getUiField().isDisposed()) {
+ getUiField().setFocus();
+ }
+ }
+ }
+
+ private void removeListenersFromDateChooserDialog() {
+ Object[] shellListeners = ShellEvent.getListeners(m_dateChooserDialog.getShell());
+ for (Object object : shellListeners) {
+ if (object.getClass().isInstance(this)
+ || (object.getClass().getEnclosingClass() != null && object.getClass().getEnclosingClass().isInstance(this))) {
+ m_dateChooserDialog.getShell().removeShellListener((ShellListener) object);
+ }
+ }
+ Object[] disposeListeners = DisposeEvent.getListeners(m_dateChooserDialog.getShell());
+ for (Object object : disposeListeners) {
+ if (object.getClass().isInstance(this)
+ || (object.getClass().getEnclosingClass() != null && object.getClass().getEnclosingClass().isInstance(this))) {
+ m_dateChooserDialog.getShell().removeDisposeListener((DisposeListener) object);
+ }
+ }
+ }
+
+ private class P_RwtBrowseButtonListener implements Listener {
+ private static final long serialVersionUID = 1L;
+
+ public P_RwtBrowseButtonListener() {
+ }
+
+ @Override
+ public void handleEvent(Event event) {
+ switch (event.type) {
+ case ButtonEx.SELECTION_ACTION:
+ getUiField().forceFocus();
+ handleUiDateChooserAction();
+ break;
+ default:
+ break;
+ }
+ }
+ } // end class P_RwtBrowseButtonListener
+
+ private void shiftDate(final int level, final int value) {
+ if (getUiField().isDisposed()) {
+ return;
+ }
+ if (getUiField().isEnabled()
+ && getUiField().getEditable()
+ && getUiField().isVisible()) {
+ if (level >= 0) {
+ // notify Scout
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ getScoutObject().getUIFacade().fireDateShiftActionFromUI(level, value);
+ }
+ };
+ getUiEnvironment().invokeScoutLater(t, 0);
+ // end notify
+ }
+ }
+ }
+
+ private class P_ShiftDayUpKeyStroke extends RwtKeyStroke {
+ public P_ShiftDayUpKeyStroke() {
+ super(SWT.ARROW_UP);
+ }
+
+ @Override
+ public void handleUiAction(Event e) {
+ int level = 0;
+ int value = 1;
+ shiftDate(level, value);
+ }
+ }
+
+ private class P_ShiftDayDownKeyStroke extends RwtKeyStroke {
+ public P_ShiftDayDownKeyStroke() {
+ super(SWT.ARROW_DOWN);
+ }
+
+ @Override
+ public void handleUiAction(Event e) {
+ int level = 0;
+ int value = -1;
+ shiftDate(level, value);
+ }
+ }
+
+ private class P_ShiftMonthUpKeyStroke extends RwtKeyStroke {
+ public P_ShiftMonthUpKeyStroke() {
+ super(SWT.ARROW_UP, SWT.SHIFT);
+ }
+
+ @Override
+ public void handleUiAction(Event e) {
+ int level = 1;
+ int value = 1;
+ shiftDate(level, value);
+ }
+ }
+
+ private class P_ShiftMonthDownKeyStroke extends RwtKeyStroke {
+ public P_ShiftMonthDownKeyStroke() {
+ super(SWT.ARROW_DOWN, SWT.SHIFT);
+ }
+
+ @Override
+ public void handleUiAction(Event e) {
+ int level = 1;
+ int value = -1;
+ shiftDate(level, value);
+ }
+ }
+
+ private class P_ShiftYearUpKeyStroke extends RwtKeyStroke {
+ public P_ShiftYearUpKeyStroke() {
+ super(SWT.ARROW_UP, SWT.CONTROL);
+ }
+
+ @Override
+ public void handleUiAction(Event e) {
+ int level = 2;
+ int value = 1;
+ shiftDate(level, value);
+ }
+ }
+
+ private class P_ShiftYearDownKeyStroke extends RwtKeyStroke {
+ public P_ShiftYearDownKeyStroke() {
+ super(SWT.ARROW_DOWN, SWT.CONTROL);
+ }
+
+ @Override
+ public void handleUiAction(Event e) {
+ int level = 2;
+ int value = -1;
+ shiftDate(level, value);
+ }
+ }
+
+ private class P_DateChooserOpenKeyStroke extends RwtKeyStroke {
+ public P_DateChooserOpenKeyStroke() {
+ super(SWT.F2);
+ }
+
+ @Override
+ public void handleUiAction(Event e) {
+ handleUiDateChooserAction();
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/datefield/RwtScoutDateTimeCompositeField.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/datefield/RwtScoutDateTimeCompositeField.java
index dbc2555fae..eb0dcb2fc0 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/datefield/RwtScoutDateTimeCompositeField.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/datefield/RwtScoutDateTimeCompositeField.java
@@ -1,127 +1,127 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.form.fields.datefield;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.form.fields.datefield.IDateField;
-import org.eclipse.scout.rt.ui.rap.LogicalGridData;
-import org.eclipse.scout.rt.ui.rap.LogicalGridLayout;
-import org.eclipse.scout.rt.ui.rap.ext.ILabelComposite;
-import org.eclipse.scout.rt.ui.rap.ext.StatusLabelEx;
-import org.eclipse.scout.rt.ui.rap.form.fields.IPopupSupport;
-import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
-import org.eclipse.scout.rt.ui.rap.form.fields.RwtScoutValueFieldComposite;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-public class RwtScoutDateTimeCompositeField extends RwtScoutValueFieldComposite<IDateField> implements IRwtScoutFormField<IDateField>, IPopupSupport {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(RwtScoutDateTimeCompositeField.class);
-
- private RwtScoutDateField m_dateField;
- private RwtScoutTimeField m_timeField;
-
- private Set<IPopupSupportListener> m_popupEventListeners;
- private Object m_popupEventListenerLock;
-
- @Override
- protected void initializeUi(Composite parent) {
- m_popupEventListeners = new HashSet<IPopupSupportListener>();
- m_popupEventListenerLock = new Object();
- Composite container = getUiEnvironment().getFormToolkit().createComposite(parent);
- StatusLabelEx label = getUiEnvironment().getFormToolkit().createStatusLabel(container, getScoutObject());
-
- Composite fieldContainer = getUiEnvironment().getFormToolkit().createComposite(container);
-
- m_dateField = createRwtScoutDateField();
- m_dateField.createUiField(fieldContainer, getScoutObject(), getUiEnvironment());
- m_dateField.getUiContainer().setLayoutData(createDateFieldGridData());
- m_dateField.setIgnoreLabel(true);
- m_dateField.setDateTimeCompositeMember(true);
- // remove label fixed width hint
- ILabelComposite childLabel = m_dateField.getUiLabel();
- if (childLabel != null && childLabel.getLayoutData() instanceof LogicalGridData) {
- ((LogicalGridData) childLabel.getLayoutData()).widthHint = 0;
- }
-
- m_timeField = createRwtScoutTimeField();
- m_timeField.createUiField(fieldContainer, getScoutObject(), getUiEnvironment());
- m_timeField.getUiContainer().setLayoutData(createTimeFieldGridData());
- m_timeField.setIgnoreLabel(true);
- m_timeField.setDateTimeCompositeMember(true);
- // remove label fixed width hint
- childLabel = m_timeField.getUiLabel();
- if (childLabel != null && childLabel.getLayoutData() instanceof LogicalGridData) {
- ((LogicalGridData) childLabel.getLayoutData()).widthHint = 0;
- }
-
- //
- setUiContainer(container);
- setUiField(fieldContainer);
- setUiLabel(label);
- // layout
- fieldContainer.setLayout(new LogicalGridLayout(6, 0));
- container.setLayout(new LogicalGridLayout(1, 0));
- }
-
- protected RwtScoutDateField createRwtScoutDateField() {
- return new RwtScoutDateField();
- }
-
- protected RwtScoutTimeField createRwtScoutTimeField() {
- return new RwtScoutTimeField();
- }
-
- @Override
- protected void setFieldEnabled(Control rwtField, boolean enabled) {
- m_dateField.setFieldEnabled(rwtField, enabled);
- m_timeField.setFieldEnabled(rwtField, enabled);
- }
-
- protected LogicalGridData createDateFieldGridData() {
- LogicalGridData data = new LogicalGridData();
- data.gridx = 1;
- data.gridy = 0;
- data.gridw = 1;
- data.gridh = 1;
- data.weightx = 1.0;
- data.weighty = 0;
- data.useUiWidth = true;
- return data;
- }
-
- protected LogicalGridData createTimeFieldGridData() {
- LogicalGridData data = new LogicalGridData();
- data.gridx = 2;
- data.gridy = 0;
- data.gridw = 1;
- data.gridh = 1;
- data.weightx = 1.0;
- data.weighty = 0;
- data.useUiWidth = true;
- return data;
- }
-
- @Override
- public void addPopupEventListener(IPopupSupportListener listener) {
- m_dateField.addPopupEventListener(listener);
- m_timeField.addPopupEventListener(listener);
- }
-
- @Override
- public void removePopupEventListener(IPopupSupportListener listener) {
- m_dateField.removePopupEventListener(listener);
- m_timeField.removePopupEventListener(listener);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.form.fields.datefield;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.form.fields.datefield.IDateField;
+import org.eclipse.scout.rt.ui.rap.LogicalGridData;
+import org.eclipse.scout.rt.ui.rap.LogicalGridLayout;
+import org.eclipse.scout.rt.ui.rap.ext.ILabelComposite;
+import org.eclipse.scout.rt.ui.rap.ext.StatusLabelEx;
+import org.eclipse.scout.rt.ui.rap.form.fields.IPopupSupport;
+import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
+import org.eclipse.scout.rt.ui.rap.form.fields.RwtScoutValueFieldComposite;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+public class RwtScoutDateTimeCompositeField extends RwtScoutValueFieldComposite<IDateField> implements IRwtScoutFormField<IDateField>, IPopupSupport {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(RwtScoutDateTimeCompositeField.class);
+
+ private RwtScoutDateField m_dateField;
+ private RwtScoutTimeField m_timeField;
+
+ private Set<IPopupSupportListener> m_popupEventListeners;
+ private Object m_popupEventListenerLock;
+
+ @Override
+ protected void initializeUi(Composite parent) {
+ m_popupEventListeners = new HashSet<IPopupSupportListener>();
+ m_popupEventListenerLock = new Object();
+ Composite container = getUiEnvironment().getFormToolkit().createComposite(parent);
+ StatusLabelEx label = getUiEnvironment().getFormToolkit().createStatusLabel(container, getScoutObject());
+
+ Composite fieldContainer = getUiEnvironment().getFormToolkit().createComposite(container);
+
+ m_dateField = createRwtScoutDateField();
+ m_dateField.createUiField(fieldContainer, getScoutObject(), getUiEnvironment());
+ m_dateField.getUiContainer().setLayoutData(createDateFieldGridData());
+ m_dateField.setIgnoreLabel(true);
+ m_dateField.setDateTimeCompositeMember(true);
+ // remove label fixed width hint
+ ILabelComposite childLabel = m_dateField.getUiLabel();
+ if (childLabel != null && childLabel.getLayoutData() instanceof LogicalGridData) {
+ ((LogicalGridData) childLabel.getLayoutData()).widthHint = 0;
+ }
+
+ m_timeField = createRwtScoutTimeField();
+ m_timeField.createUiField(fieldContainer, getScoutObject(), getUiEnvironment());
+ m_timeField.getUiContainer().setLayoutData(createTimeFieldGridData());
+ m_timeField.setIgnoreLabel(true);
+ m_timeField.setDateTimeCompositeMember(true);
+ // remove label fixed width hint
+ childLabel = m_timeField.getUiLabel();
+ if (childLabel != null && childLabel.getLayoutData() instanceof LogicalGridData) {
+ ((LogicalGridData) childLabel.getLayoutData()).widthHint = 0;
+ }
+
+ //
+ setUiContainer(container);
+ setUiField(fieldContainer);
+ setUiLabel(label);
+ // layout
+ fieldContainer.setLayout(new LogicalGridLayout(6, 0));
+ container.setLayout(new LogicalGridLayout(1, 0));
+ }
+
+ protected RwtScoutDateField createRwtScoutDateField() {
+ return new RwtScoutDateField();
+ }
+
+ protected RwtScoutTimeField createRwtScoutTimeField() {
+ return new RwtScoutTimeField();
+ }
+
+ @Override
+ protected void setFieldEnabled(Control rwtField, boolean enabled) {
+ m_dateField.setFieldEnabled(rwtField, enabled);
+ m_timeField.setFieldEnabled(rwtField, enabled);
+ }
+
+ protected LogicalGridData createDateFieldGridData() {
+ LogicalGridData data = new LogicalGridData();
+ data.gridx = 1;
+ data.gridy = 0;
+ data.gridw = 1;
+ data.gridh = 1;
+ data.weightx = 1.0;
+ data.weighty = 0;
+ data.useUiWidth = true;
+ return data;
+ }
+
+ protected LogicalGridData createTimeFieldGridData() {
+ LogicalGridData data = new LogicalGridData();
+ data.gridx = 2;
+ data.gridy = 0;
+ data.gridw = 1;
+ data.gridh = 1;
+ data.weightx = 1.0;
+ data.weighty = 0;
+ data.useUiWidth = true;
+ return data;
+ }
+
+ @Override
+ public void addPopupEventListener(IPopupSupportListener listener) {
+ m_dateField.addPopupEventListener(listener);
+ m_timeField.addPopupEventListener(listener);
+ }
+
+ @Override
+ public void removePopupEventListener(IPopupSupportListener listener) {
+ m_dateField.removePopupEventListener(listener);
+ m_timeField.removePopupEventListener(listener);
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/datefield/RwtScoutTimeField.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/datefield/RwtScoutTimeField.java
index 81dd19c32e..889e1a2b60 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/datefield/RwtScoutTimeField.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/datefield/RwtScoutTimeField.java
@@ -1,540 +1,540 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.form.fields.datefield;
-
-import java.text.DateFormat;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.rwt.lifecycle.WidgetUtil;
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.commons.holders.Holder;
-import org.eclipse.scout.commons.job.JobEx;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.datefield.IDateField;
-import org.eclipse.scout.rt.ui.rap.LogicalGridLayout;
-import org.eclipse.scout.rt.ui.rap.ext.ButtonEx;
-import org.eclipse.scout.rt.ui.rap.ext.StatusLabelEx;
-import org.eclipse.scout.rt.ui.rap.ext.StyledTextEx;
-import org.eclipse.scout.rt.ui.rap.ext.custom.StyledText;
-import org.eclipse.scout.rt.ui.rap.form.fields.IPopupSupport;
-import org.eclipse.scout.rt.ui.rap.form.fields.LogicalGridDataBuilder;
-import org.eclipse.scout.rt.ui.rap.form.fields.RwtScoutValueFieldComposite;
-import org.eclipse.scout.rt.ui.rap.form.fields.datefield.chooser.TimeChooserDialog;
-import org.eclipse.scout.rt.ui.rap.internal.TextFieldEditableSupport;
-import org.eclipse.scout.rt.ui.rap.keystroke.RwtKeyStroke;
-import org.eclipse.scout.rt.ui.rap.util.RwtLayoutUtility;
-import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.FocusAdapter;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.ShellEvent;
-import org.eclipse.swt.events.ShellListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
-
-public class RwtScoutTimeField extends RwtScoutValueFieldComposite<IDateField> implements IRwtScoutTimeField, IPopupSupport {
-
- private Button m_dropDownButton;
- private TextFieldEditableSupport m_editableSupport;
-
- private Set<IPopupSupportListener> m_popupEventListeners;
- private Object m_popupEventListenerLock;
-
- private boolean m_ignoreLabel = false;
- private Composite m_timeContainer;
- private boolean m_dateTimeCompositeMember;
- private String m_displayTextToVerify;
- private TimeChooserDialog m_timeChooserDialog = null;
- private FocusAdapter m_textFieldFocusAdapter = null;
-
- public void setIgnoreLabel(boolean ignoreLabel) {
- m_ignoreLabel = ignoreLabel;
- if (ignoreLabel) {
- getUiLabel().setVisible(false);
- }
- else {
- getUiLabel().setVisible(getScoutObject().isLabelVisible());
- }
- }
-
- public boolean isIgnoreLabel() {
- return m_ignoreLabel;
- }
-
- public boolean isDateTimeCompositeMember() {
- return m_dateTimeCompositeMember;
- }
-
- public void setDateTimeCompositeMember(boolean dateTimeCompositeMember) {
- m_dateTimeCompositeMember = dateTimeCompositeMember;
- }
-
- @Override
- protected void initializeUi(Composite parent) {
- m_popupEventListeners = new HashSet<IPopupSupportListener>();
- m_popupEventListenerLock = new Object();
-
- Composite container = getUiEnvironment().getFormToolkit().createComposite(parent);
- StatusLabelEx label = getUiEnvironment().getFormToolkit().createStatusLabel(container, getScoutObject());
-
- m_timeContainer = getUiEnvironment().getFormToolkit().createComposite(container, SWT.BORDER);
- m_timeContainer.setData(WidgetUtil.CUSTOM_VARIANT, VARIANT_TIMEFIELD);
-
- StyledText textField = new StyledTextEx(m_timeContainer, SWT.SINGLE);
- getUiEnvironment().getFormToolkit().adapt(textField, false, false);
- textField.setData(WidgetUtil.CUSTOM_VARIANT, VARIANT_TIMEFIELD);
-
- ButtonEx timeChooserButton = getUiEnvironment().getFormToolkit().createButtonEx(m_timeContainer, SWT.PUSH | SWT.NO_FOCUS);
- timeChooserButton.setData(WidgetUtil.CUSTOM_VARIANT, VARIANT_TIMEFIELD);
-
- m_timeContainer.setTabList(new Control[]{textField});
- container.setTabList(new Control[]{m_timeContainer});
-
- // key strokes on container
- getUiEnvironment().addKeyStroke(container, new P_TimeChooserOpenKeyStroke(), false);
-
- // key strokes on field
- getUiEnvironment().addKeyStroke(textField, new P_ShiftNextQuarterHourKeyStroke(), false);
- getUiEnvironment().addKeyStroke(textField, new P_ShiftPreviousQuarterHourKeyStroke(), false);
- getUiEnvironment().addKeyStroke(textField, new P_ShiftNextHourKeyStroke(), false);
- getUiEnvironment().addKeyStroke(textField, new P_ShiftPreviousHourKeyStroke(), false);
-
- // listener
- timeChooserButton.addListener(ButtonEx.SELECTION_ACTION, new P_RwtBrowseButtonListener());
- textField.addMouseListener(new MouseAdapter() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void mouseUp(MouseEvent e) {
- handleUiTimeChooserAction();
- }
- });
- //
- setUiContainer(container);
- setUiLabel(label);
- setDropDownButton(timeChooserButton);
- setUiField(textField);
-
- // layout
- container.setLayout(new LogicalGridLayout(1, 0));
-
- m_timeContainer.setLayoutData(LogicalGridDataBuilder.createField(((IFormField) getScoutObject()).getGridData()));
- m_timeContainer.setLayout(RwtLayoutUtility.createGridLayoutNoSpacing(2, false));
-
- GridData textLayoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
- textField.setLayoutData(textLayoutData);
-
- GridData buttonLayoutData = new GridData(SWT.CENTER, SWT.CENTER, false, false);
- buttonLayoutData.heightHint = 20;
- buttonLayoutData.widthHint = 20;
- timeChooserButton.setLayoutData(buttonLayoutData);
- }
-
- @Override
- public Button getDropDownButton() {
- return m_dropDownButton;
- }
-
- public void setDropDownButton(ButtonEx b) {
- m_dropDownButton = b;
- }
-
- @Override
- public StyledTextEx getUiField() {
- return (StyledTextEx) super.getUiField();
- }
-
- public boolean isFocusInTimePicker() {
- Control focusControl = getUiEnvironment().getDisplay().getFocusControl();
- boolean isFocusInDatePicker = RwtUtility.isAncestorOf(m_timeChooserDialog.getShell(), focusControl);
- return isFocusInDatePicker;
- }
-
- private void installFocusListenerOnTextField() {
- if (getUiField().isDisposed()) {
- return;
- }
-
- getUiField().setFocus();
- if (m_textFieldFocusAdapter == null) {
- m_textFieldFocusAdapter = new FocusAdapter() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void focusLost(FocusEvent e) {
- handleUiFocusLostOnDatePickerPopup(e);
- }
-
- };
- }
- getUiField().addFocusListener(m_textFieldFocusAdapter);
- }
-
- /**
- * The event is fired only if the time picker popup is open.
- * <p>
- * The default sets the focus on the ui field if the new focus is inside the time picker. <br/>
- * If the new focus is outside the time picker it makes sure the time picker popup will be closed.
- * </p>
- */
- protected void handleUiFocusLostOnDatePickerPopup(FocusEvent event) {
- if (isFocusInTimePicker()) {
- getUiEnvironment().getDisplay().asyncExec(new Runnable() {
-
- @Override
- public void run() {
- getUiField().setFocus();
- }
-
- });
- }
- else {
- getUiEnvironment().getDisplay().asyncExec(new Runnable() {
-
- @Override
- public void run() {
- makeSureTimeChooserIsClosed();
- }
-
- });
- }
- }
-
- private void uninstallFocusListenerOnTextField() {
- if (!getUiField().isDisposed() && m_textFieldFocusAdapter != null) {
- getUiField().removeFocusListener(m_textFieldFocusAdapter);
- }
- }
-
- @Override
- protected void setEnabledFromScout(boolean b) {
- super.setEnabledFromScout(b);
- m_dropDownButton.setEnabled(b);
- getUiField().setEnabled(b);
- if (b) {
- m_timeContainer.setData(WidgetUtil.CUSTOM_VARIANT, VARIANT_TIMEFIELD);
- }
- else {
- m_timeContainer.setData(WidgetUtil.CUSTOM_VARIANT, VARIANT_TIMEFIELD_DISABLED);
- }
- }
-
- @Override
- protected void setLabelVisibleFromScout() {
- if (!isIgnoreLabel()) {
- super.setLabelVisibleFromScout();
- }
- }
-
- @Override
- protected void setFieldEnabled(Control rwtField, boolean enabled) {
- if (m_editableSupport == null) {
- m_editableSupport = new TextFieldEditableSupport(getUiField());
- }
- m_editableSupport.setEditable(enabled);
- }
-
- @Override
- protected void setDisplayTextFromScout(String s) {
- IDateField f = getScoutObject();
- if (f.getErrorStatus() != null) {
- return;
- }
- if (s == null) {
- s = "";
- }
- m_displayTextToVerify = s;
- Date value = f.getValue();
- if (value == null) {
- getUiField().setText(m_displayTextToVerify);
- super.handleUiFocusGained();
- getUiField().setCaretOffset(0);
- return;
- }
- DateFormat format = f.getIsolatedTimeFormat();
- if (format != null) {
- m_displayTextToVerify = format.format(value);
- getUiField().setText(m_displayTextToVerify);
- super.handleUiFocusGained();
- getUiField().setCaretOffset(0);
- }
- }
-
- @Override
- protected void setBackgroundFromScout(String scoutColor) {
- setBackgroundFromScout(scoutColor, m_timeContainer);
- }
-
- @Override
- protected void handleUiInputVerifier(boolean doit) {
- if (!doit) {
- return;
- }
- final String text = getUiField().getText();
- // only handle if text has changed
- if (CompareUtility.equals(text, m_displayTextToVerify) && (isDateTimeCompositeMember() || getScoutObject().getErrorStatus() == null)) {
- return;
- }
- m_displayTextToVerify = text;
- final Holder<Boolean> result = new Holder<Boolean>(Boolean.class, false);
- // notify Scout
- Runnable t = new Runnable() {
- @Override
- public void run() {
- boolean b = getScoutObject().getUIFacade().setTimeTextFromUI(text);
- result.setValue(b);
- }
- };
- JobEx job = getUiEnvironment().invokeScoutLater(t, 0);
- try {
- job.join(2345);
- }
- catch (InterruptedException e) {
- //nop
- }
- getUiEnvironment().dispatchImmediateUiJobs();
- // end notify
- return;
- }
-
- @Override
- protected void handleUiFocusGained() {
- if (isSelectAllOnFocusEnabled()) {
- getUiField().setSelection(0, getUiField().getText().length());
- }
- }
-
- protected void makeSureTimeChooserIsClosed() {
- if (m_timeChooserDialog != null
- && m_timeChooserDialog.getShell() != null
- && !m_timeChooserDialog.getShell().isDisposed()) {
- m_timeChooserDialog.getShell().close();
- }
-
- uninstallFocusListenerOnTextField();
- }
-
- private void handleUiTimeChooserAction() {
- if (!getDropDownButton().isVisible() || !getDropDownButton().isEnabled()) {
- return;
- }
-
- Date oldTime = getScoutObject().getValue();
- if (oldTime == null) {
- oldTime = new Date();
- }
- notifyPopupEventListeners(IPopupSupportListener.TYPE_OPENING);
-
- makeSureTimeChooserIsClosed();
- m_timeChooserDialog = createTimeChooserDialog(getUiField().getShell(), oldTime);
- if (m_timeChooserDialog != null) {
- m_timeChooserDialog.getShell().addDisposeListener(new DisposeListener() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void widgetDisposed(DisposeEvent event) {
- getTimeFromClosedDateChooserDialog();
- }
- });
-
- m_timeChooserDialog.openTimeChooser(getUiField());
- installFocusListenerOnTextField();
- }
- }
-
- protected TimeChooserDialog createTimeChooserDialog(Shell parentShell, Date currentTime) {
- return new TimeChooserDialog(parentShell, currentTime);
- }
-
- private void getTimeFromClosedDateChooserDialog() {
- removeListenersFromTimeChooserDialog();
- boolean setFocusToUiField = false;
- try {
- final Date newDate = m_timeChooserDialog.getReturnTime();
- if (newDate != null) {
- setFocusToUiField = true;
- // notify Scout
- Runnable t = new Runnable() {
- @Override
- public void run() {
- getScoutObject().getUIFacade().setTimeFromUI(newDate);
- }
- };
- getUiEnvironment().invokeScoutLater(t, 0);
- // end notify
- }
- }
- finally {
- notifyPopupEventListeners(IPopupSupportListener.TYPE_CLOSED);
- uninstallFocusListenerOnTextField();
- if (setFocusToUiField
- && !getUiField().isDisposed()) {
- getUiField().setFocus();
- }
- }
- }
-
- private void removeListenersFromTimeChooserDialog() {
- Object[] shellListeners = ShellEvent.getListeners(m_timeChooserDialog.getShell());
- for (Object object : shellListeners) {
- if (object.getClass().isInstance(this)
- || (object.getClass().getEnclosingClass() != null && object.getClass().getEnclosingClass().isInstance(this))) {
- m_timeChooserDialog.getShell().removeShellListener((ShellListener) object);
- }
- }
- Object[] disposeListeners = DisposeEvent.getListeners(m_timeChooserDialog.getShell());
- for (Object object : disposeListeners) {
- if (object.getClass().isInstance(this)
- || (object.getClass().getEnclosingClass() != null && object.getClass().getEnclosingClass().isInstance(this))) {
- m_timeChooserDialog.getShell().removeDisposeListener((DisposeListener) object);
- }
- }
- }
-
- private void notifyPopupEventListeners(int eventType) {
- IPopupSupportListener[] listeners;
- synchronized (m_popupEventListenerLock) {
- listeners = m_popupEventListeners.toArray(new IPopupSupportListener[m_popupEventListeners.size()]);
- }
- for (IPopupSupportListener listener : listeners) {
- listener.handleEvent(eventType);
- }
- }
-
- @Override
- public void addPopupEventListener(IPopupSupportListener listener) {
- synchronized (m_popupEventListenerLock) {
- m_popupEventListeners.add(listener);
- }
- }
-
- @Override
- public void removePopupEventListener(IPopupSupportListener listener) {
- synchronized (m_popupEventListenerLock) {
- m_popupEventListeners.remove(listener);
- }
- }
-
- private class P_RwtBrowseButtonListener implements Listener {
- private static final long serialVersionUID = 1L;
-
- public P_RwtBrowseButtonListener() {
- }
-
- @Override
- public void handleEvent(Event event) {
- switch (event.type) {
- case ButtonEx.SELECTION_ACTION:
- getUiField().forceFocus();
- handleUiTimeChooserAction();
- break;
- default:
- break;
- }
- }
- } // end class P_RwtBrowseButtonListener
-
- private void shiftTime(final int level, final int value) {
- if (getUiField().isDisposed()) {
- return;
- }
- if (getUiField().isEnabled()
- && getUiField().getEditable()
- && getUiField().isVisible()) {
- if (level >= 0) {
- // notify Scout
- Runnable t = new Runnable() {
- @Override
- public void run() {
- getScoutObject().getUIFacade().fireTimeShiftActionFromUI(level, value);
- }
- };
- getUiEnvironment().invokeScoutLater(t, 0);
- // end notify
- }
- }
- }
-
- private class P_ShiftNextQuarterHourKeyStroke extends RwtKeyStroke {
- public P_ShiftNextQuarterHourKeyStroke() {
- super(SWT.ARROW_UP);
- }
-
- @Override
- public void handleUiAction(Event e) {
- int level = 0;
- int value = 1;
- shiftTime(level, value);
- }
- }
-
- private class P_ShiftPreviousQuarterHourKeyStroke extends RwtKeyStroke {
- public P_ShiftPreviousQuarterHourKeyStroke() {
- super(SWT.ARROW_DOWN);
- }
-
- @Override
- public void handleUiAction(Event e) {
- int level = 0;
- int value = -1;
- shiftTime(level, value);
- }
- }
-
- private class P_ShiftNextHourKeyStroke extends RwtKeyStroke {
- public P_ShiftNextHourKeyStroke() {
- super(SWT.ARROW_UP, SWT.SHIFT);
- }
-
- @Override
- public void handleUiAction(Event e) {
- int level = 1;
- int value = 1;
- shiftTime(level, value);
- }
- }
-
- private class P_ShiftPreviousHourKeyStroke extends RwtKeyStroke {
- public P_ShiftPreviousHourKeyStroke() {
- super(SWT.ARROW_DOWN, SWT.SHIFT);
- }
-
- @Override
- public void handleUiAction(Event e) {
- int level = 1;
- int value = -1;
- shiftTime(level, value);
- }
- }
-
- private class P_TimeChooserOpenKeyStroke extends RwtKeyStroke {
- public P_TimeChooserOpenKeyStroke() {
- super(SWT.F2);
- }
-
- @Override
- public void handleUiAction(Event e) {
- handleUiTimeChooserAction();
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.form.fields.datefield;
+
+import java.text.DateFormat;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.rwt.lifecycle.WidgetUtil;
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.commons.holders.Holder;
+import org.eclipse.scout.commons.job.JobEx;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.datefield.IDateField;
+import org.eclipse.scout.rt.ui.rap.LogicalGridLayout;
+import org.eclipse.scout.rt.ui.rap.ext.ButtonEx;
+import org.eclipse.scout.rt.ui.rap.ext.StatusLabelEx;
+import org.eclipse.scout.rt.ui.rap.ext.StyledTextEx;
+import org.eclipse.scout.rt.ui.rap.ext.custom.StyledText;
+import org.eclipse.scout.rt.ui.rap.form.fields.IPopupSupport;
+import org.eclipse.scout.rt.ui.rap.form.fields.LogicalGridDataBuilder;
+import org.eclipse.scout.rt.ui.rap.form.fields.RwtScoutValueFieldComposite;
+import org.eclipse.scout.rt.ui.rap.form.fields.datefield.chooser.TimeChooserDialog;
+import org.eclipse.scout.rt.ui.rap.internal.TextFieldEditableSupport;
+import org.eclipse.scout.rt.ui.rap.keystroke.RwtKeyStroke;
+import org.eclipse.scout.rt.ui.rap.util.RwtLayoutUtility;
+import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.FocusAdapter;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.ShellEvent;
+import org.eclipse.swt.events.ShellListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+
+public class RwtScoutTimeField extends RwtScoutValueFieldComposite<IDateField> implements IRwtScoutTimeField, IPopupSupport {
+
+ private Button m_dropDownButton;
+ private TextFieldEditableSupport m_editableSupport;
+
+ private Set<IPopupSupportListener> m_popupEventListeners;
+ private Object m_popupEventListenerLock;
+
+ private boolean m_ignoreLabel = false;
+ private Composite m_timeContainer;
+ private boolean m_dateTimeCompositeMember;
+ private String m_displayTextToVerify;
+ private TimeChooserDialog m_timeChooserDialog = null;
+ private FocusAdapter m_textFieldFocusAdapter = null;
+
+ public void setIgnoreLabel(boolean ignoreLabel) {
+ m_ignoreLabel = ignoreLabel;
+ if (ignoreLabel) {
+ getUiLabel().setVisible(false);
+ }
+ else {
+ getUiLabel().setVisible(getScoutObject().isLabelVisible());
+ }
+ }
+
+ public boolean isIgnoreLabel() {
+ return m_ignoreLabel;
+ }
+
+ public boolean isDateTimeCompositeMember() {
+ return m_dateTimeCompositeMember;
+ }
+
+ public void setDateTimeCompositeMember(boolean dateTimeCompositeMember) {
+ m_dateTimeCompositeMember = dateTimeCompositeMember;
+ }
+
+ @Override
+ protected void initializeUi(Composite parent) {
+ m_popupEventListeners = new HashSet<IPopupSupportListener>();
+ m_popupEventListenerLock = new Object();
+
+ Composite container = getUiEnvironment().getFormToolkit().createComposite(parent);
+ StatusLabelEx label = getUiEnvironment().getFormToolkit().createStatusLabel(container, getScoutObject());
+
+ m_timeContainer = getUiEnvironment().getFormToolkit().createComposite(container, SWT.BORDER);
+ m_timeContainer.setData(WidgetUtil.CUSTOM_VARIANT, VARIANT_TIMEFIELD);
+
+ StyledText textField = new StyledTextEx(m_timeContainer, SWT.SINGLE);
+ getUiEnvironment().getFormToolkit().adapt(textField, false, false);
+ textField.setData(WidgetUtil.CUSTOM_VARIANT, VARIANT_TIMEFIELD);
+
+ ButtonEx timeChooserButton = getUiEnvironment().getFormToolkit().createButtonEx(m_timeContainer, SWT.PUSH | SWT.NO_FOCUS);
+ timeChooserButton.setData(WidgetUtil.CUSTOM_VARIANT, VARIANT_TIMEFIELD);
+
+ m_timeContainer.setTabList(new Control[]{textField});
+ container.setTabList(new Control[]{m_timeContainer});
+
+ // key strokes on container
+ getUiEnvironment().addKeyStroke(container, new P_TimeChooserOpenKeyStroke(), false);
+
+ // key strokes on field
+ getUiEnvironment().addKeyStroke(textField, new P_ShiftNextQuarterHourKeyStroke(), false);
+ getUiEnvironment().addKeyStroke(textField, new P_ShiftPreviousQuarterHourKeyStroke(), false);
+ getUiEnvironment().addKeyStroke(textField, new P_ShiftNextHourKeyStroke(), false);
+ getUiEnvironment().addKeyStroke(textField, new P_ShiftPreviousHourKeyStroke(), false);
+
+ // listener
+ timeChooserButton.addListener(ButtonEx.SELECTION_ACTION, new P_RwtBrowseButtonListener());
+ textField.addMouseListener(new MouseAdapter() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void mouseUp(MouseEvent e) {
+ handleUiTimeChooserAction();
+ }
+ });
+ //
+ setUiContainer(container);
+ setUiLabel(label);
+ setDropDownButton(timeChooserButton);
+ setUiField(textField);
+
+ // layout
+ container.setLayout(new LogicalGridLayout(1, 0));
+
+ m_timeContainer.setLayoutData(LogicalGridDataBuilder.createField(((IFormField) getScoutObject()).getGridData()));
+ m_timeContainer.setLayout(RwtLayoutUtility.createGridLayoutNoSpacing(2, false));
+
+ GridData textLayoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
+ textField.setLayoutData(textLayoutData);
+
+ GridData buttonLayoutData = new GridData(SWT.CENTER, SWT.CENTER, false, false);
+ buttonLayoutData.heightHint = 20;
+ buttonLayoutData.widthHint = 20;
+ timeChooserButton.setLayoutData(buttonLayoutData);
+ }
+
+ @Override
+ public Button getDropDownButton() {
+ return m_dropDownButton;
+ }
+
+ public void setDropDownButton(ButtonEx b) {
+ m_dropDownButton = b;
+ }
+
+ @Override
+ public StyledTextEx getUiField() {
+ return (StyledTextEx) super.getUiField();
+ }
+
+ public boolean isFocusInTimePicker() {
+ Control focusControl = getUiEnvironment().getDisplay().getFocusControl();
+ boolean isFocusInDatePicker = RwtUtility.isAncestorOf(m_timeChooserDialog.getShell(), focusControl);
+ return isFocusInDatePicker;
+ }
+
+ private void installFocusListenerOnTextField() {
+ if (getUiField().isDisposed()) {
+ return;
+ }
+
+ getUiField().setFocus();
+ if (m_textFieldFocusAdapter == null) {
+ m_textFieldFocusAdapter = new FocusAdapter() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void focusLost(FocusEvent e) {
+ handleUiFocusLostOnDatePickerPopup(e);
+ }
+
+ };
+ }
+ getUiField().addFocusListener(m_textFieldFocusAdapter);
+ }
+
+ /**
+ * The event is fired only if the time picker popup is open.
+ * <p>
+ * The default sets the focus on the ui field if the new focus is inside the time picker. <br/>
+ * If the new focus is outside the time picker it makes sure the time picker popup will be closed.
+ * </p>
+ */
+ protected void handleUiFocusLostOnDatePickerPopup(FocusEvent event) {
+ if (isFocusInTimePicker()) {
+ getUiEnvironment().getDisplay().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ getUiField().setFocus();
+ }
+
+ });
+ }
+ else {
+ getUiEnvironment().getDisplay().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ makeSureTimeChooserIsClosed();
+ }
+
+ });
+ }
+ }
+
+ private void uninstallFocusListenerOnTextField() {
+ if (!getUiField().isDisposed() && m_textFieldFocusAdapter != null) {
+ getUiField().removeFocusListener(m_textFieldFocusAdapter);
+ }
+ }
+
+ @Override
+ protected void setEnabledFromScout(boolean b) {
+ super.setEnabledFromScout(b);
+ m_dropDownButton.setEnabled(b);
+ getUiField().setEnabled(b);
+ if (b) {
+ m_timeContainer.setData(WidgetUtil.CUSTOM_VARIANT, VARIANT_TIMEFIELD);
+ }
+ else {
+ m_timeContainer.setData(WidgetUtil.CUSTOM_VARIANT, VARIANT_TIMEFIELD_DISABLED);
+ }
+ }
+
+ @Override
+ protected void setLabelVisibleFromScout() {
+ if (!isIgnoreLabel()) {
+ super.setLabelVisibleFromScout();
+ }
+ }
+
+ @Override
+ protected void setFieldEnabled(Control rwtField, boolean enabled) {
+ if (m_editableSupport == null) {
+ m_editableSupport = new TextFieldEditableSupport(getUiField());
+ }
+ m_editableSupport.setEditable(enabled);
+ }
+
+ @Override
+ protected void setDisplayTextFromScout(String s) {
+ IDateField f = getScoutObject();
+ if (f.getErrorStatus() != null) {
+ return;
+ }
+ if (s == null) {
+ s = "";
+ }
+ m_displayTextToVerify = s;
+ Date value = f.getValue();
+ if (value == null) {
+ getUiField().setText(m_displayTextToVerify);
+ super.handleUiFocusGained();
+ getUiField().setCaretOffset(0);
+ return;
+ }
+ DateFormat format = f.getIsolatedTimeFormat();
+ if (format != null) {
+ m_displayTextToVerify = format.format(value);
+ getUiField().setText(m_displayTextToVerify);
+ super.handleUiFocusGained();
+ getUiField().setCaretOffset(0);
+ }
+ }
+
+ @Override
+ protected void setBackgroundFromScout(String scoutColor) {
+ setBackgroundFromScout(scoutColor, m_timeContainer);
+ }
+
+ @Override
+ protected void handleUiInputVerifier(boolean doit) {
+ if (!doit) {
+ return;
+ }
+ final String text = getUiField().getText();
+ // only handle if text has changed
+ if (CompareUtility.equals(text, m_displayTextToVerify) && (isDateTimeCompositeMember() || getScoutObject().getErrorStatus() == null)) {
+ return;
+ }
+ m_displayTextToVerify = text;
+ final Holder<Boolean> result = new Holder<Boolean>(Boolean.class, false);
+ // notify Scout
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ boolean b = getScoutObject().getUIFacade().setTimeTextFromUI(text);
+ result.setValue(b);
+ }
+ };
+ JobEx job = getUiEnvironment().invokeScoutLater(t, 0);
+ try {
+ job.join(2345);
+ }
+ catch (InterruptedException e) {
+ //nop
+ }
+ getUiEnvironment().dispatchImmediateUiJobs();
+ // end notify
+ return;
+ }
+
+ @Override
+ protected void handleUiFocusGained() {
+ if (isSelectAllOnFocusEnabled()) {
+ getUiField().setSelection(0, getUiField().getText().length());
+ }
+ }
+
+ protected void makeSureTimeChooserIsClosed() {
+ if (m_timeChooserDialog != null
+ && m_timeChooserDialog.getShell() != null
+ && !m_timeChooserDialog.getShell().isDisposed()) {
+ m_timeChooserDialog.getShell().close();
+ }
+
+ uninstallFocusListenerOnTextField();
+ }
+
+ private void handleUiTimeChooserAction() {
+ if (!getDropDownButton().isVisible() || !getDropDownButton().isEnabled()) {
+ return;
+ }
+
+ Date oldTime = getScoutObject().getValue();
+ if (oldTime == null) {
+ oldTime = new Date();
+ }
+ notifyPopupEventListeners(IPopupSupportListener.TYPE_OPENING);
+
+ makeSureTimeChooserIsClosed();
+ m_timeChooserDialog = createTimeChooserDialog(getUiField().getShell(), oldTime);
+ if (m_timeChooserDialog != null) {
+ m_timeChooserDialog.getShell().addDisposeListener(new DisposeListener() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void widgetDisposed(DisposeEvent event) {
+ getTimeFromClosedDateChooserDialog();
+ }
+ });
+
+ m_timeChooserDialog.openTimeChooser(getUiField());
+ installFocusListenerOnTextField();
+ }
+ }
+
+ protected TimeChooserDialog createTimeChooserDialog(Shell parentShell, Date currentTime) {
+ return new TimeChooserDialog(parentShell, currentTime);
+ }
+
+ private void getTimeFromClosedDateChooserDialog() {
+ removeListenersFromTimeChooserDialog();
+ boolean setFocusToUiField = false;
+ try {
+ final Date newDate = m_timeChooserDialog.getReturnTime();
+ if (newDate != null) {
+ setFocusToUiField = true;
+ // notify Scout
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ getScoutObject().getUIFacade().setTimeFromUI(newDate);
+ }
+ };
+ getUiEnvironment().invokeScoutLater(t, 0);
+ // end notify
+ }
+ }
+ finally {
+ notifyPopupEventListeners(IPopupSupportListener.TYPE_CLOSED);
+ uninstallFocusListenerOnTextField();
+ if (setFocusToUiField
+ && !getUiField().isDisposed()) {
+ getUiField().setFocus();
+ }
+ }
+ }
+
+ private void removeListenersFromTimeChooserDialog() {
+ Object[] shellListeners = ShellEvent.getListeners(m_timeChooserDialog.getShell());
+ for (Object object : shellListeners) {
+ if (object.getClass().isInstance(this)
+ || (object.getClass().getEnclosingClass() != null && object.getClass().getEnclosingClass().isInstance(this))) {
+ m_timeChooserDialog.getShell().removeShellListener((ShellListener) object);
+ }
+ }
+ Object[] disposeListeners = DisposeEvent.getListeners(m_timeChooserDialog.getShell());
+ for (Object object : disposeListeners) {
+ if (object.getClass().isInstance(this)
+ || (object.getClass().getEnclosingClass() != null && object.getClass().getEnclosingClass().isInstance(this))) {
+ m_timeChooserDialog.getShell().removeDisposeListener((DisposeListener) object);
+ }
+ }
+ }
+
+ private void notifyPopupEventListeners(int eventType) {
+ IPopupSupportListener[] listeners;
+ synchronized (m_popupEventListenerLock) {
+ listeners = m_popupEventListeners.toArray(new IPopupSupportListener[m_popupEventListeners.size()]);
+ }
+ for (IPopupSupportListener listener : listeners) {
+ listener.handleEvent(eventType);
+ }
+ }
+
+ @Override
+ public void addPopupEventListener(IPopupSupportListener listener) {
+ synchronized (m_popupEventListenerLock) {
+ m_popupEventListeners.add(listener);
+ }
+ }
+
+ @Override
+ public void removePopupEventListener(IPopupSupportListener listener) {
+ synchronized (m_popupEventListenerLock) {
+ m_popupEventListeners.remove(listener);
+ }
+ }
+
+ private class P_RwtBrowseButtonListener implements Listener {
+ private static final long serialVersionUID = 1L;
+
+ public P_RwtBrowseButtonListener() {
+ }
+
+ @Override
+ public void handleEvent(Event event) {
+ switch (event.type) {
+ case ButtonEx.SELECTION_ACTION:
+ getUiField().forceFocus();
+ handleUiTimeChooserAction();
+ break;
+ default:
+ break;
+ }
+ }
+ } // end class P_RwtBrowseButtonListener
+
+ private void shiftTime(final int level, final int value) {
+ if (getUiField().isDisposed()) {
+ return;
+ }
+ if (getUiField().isEnabled()
+ && getUiField().getEditable()
+ && getUiField().isVisible()) {
+ if (level >= 0) {
+ // notify Scout
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ getScoutObject().getUIFacade().fireTimeShiftActionFromUI(level, value);
+ }
+ };
+ getUiEnvironment().invokeScoutLater(t, 0);
+ // end notify
+ }
+ }
+ }
+
+ private class P_ShiftNextQuarterHourKeyStroke extends RwtKeyStroke {
+ public P_ShiftNextQuarterHourKeyStroke() {
+ super(SWT.ARROW_UP);
+ }
+
+ @Override
+ public void handleUiAction(Event e) {
+ int level = 0;
+ int value = 1;
+ shiftTime(level, value);
+ }
+ }
+
+ private class P_ShiftPreviousQuarterHourKeyStroke extends RwtKeyStroke {
+ public P_ShiftPreviousQuarterHourKeyStroke() {
+ super(SWT.ARROW_DOWN);
+ }
+
+ @Override
+ public void handleUiAction(Event e) {
+ int level = 0;
+ int value = -1;
+ shiftTime(level, value);
+ }
+ }
+
+ private class P_ShiftNextHourKeyStroke extends RwtKeyStroke {
+ public P_ShiftNextHourKeyStroke() {
+ super(SWT.ARROW_UP, SWT.SHIFT);
+ }
+
+ @Override
+ public void handleUiAction(Event e) {
+ int level = 1;
+ int value = 1;
+ shiftTime(level, value);
+ }
+ }
+
+ private class P_ShiftPreviousHourKeyStroke extends RwtKeyStroke {
+ public P_ShiftPreviousHourKeyStroke() {
+ super(SWT.ARROW_DOWN, SWT.SHIFT);
+ }
+
+ @Override
+ public void handleUiAction(Event e) {
+ int level = 1;
+ int value = -1;
+ shiftTime(level, value);
+ }
+ }
+
+ private class P_TimeChooserOpenKeyStroke extends RwtKeyStroke {
+ public P_TimeChooserOpenKeyStroke() {
+ super(SWT.F2);
+ }
+
+ @Override
+ public void handleUiAction(Event e) {
+ handleUiTimeChooserAction();
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/datefield/chooser/DateChooserDialog.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/datefield/chooser/DateChooserDialog.java
index 72751a21ca..cbdcb39352 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/datefield/chooser/DateChooserDialog.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/datefield/chooser/DateChooserDialog.java
@@ -1,329 +1,329 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.form.fields.datefield.chooser;
-
-import java.text.DateFormatSymbols;
-import java.util.Calendar;
-import java.util.Date;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.rwt.RWT;
-import org.eclipse.rwt.lifecycle.WidgetUtil;
-import org.eclipse.scout.commons.DateUtility;
-import org.eclipse.scout.rt.ui.rap.ext.table.util.TableCellRolloverSupport;
-import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.TableItem;
-
-public class DateChooserDialog extends Dialog {
- private static final long serialVersionUID = 1L;
-
- private static final String NEXT_YEAR_CUSTOM_VARIANT = "datechooser-dialog-next-year";
- private static final String NEXT_MONTH_CUSTOM_VARIANT = "datechooser-dialog-next-month";
- private static final String LAST_MONTH_CUSTOM_VARIANT = "datechooser-dialog-last-month";
- private static final String LAST_YEAR_CUSTOM_VARIANT = "datechooser-dialog-last-year";
- private static final String DATECHOOSER_DIALOG_CUSTOM_VARIANT = "datechooser-dialog";
-
- public static final int TYPE_BACK_YEAR = 1 << 0;
- public static final int TYPE_BACK_MONTH = 1 << 1;
- public static final int TYPE_FOREWARD_MONTH = 1 << 2;
- public static final int TYPE_FOREWARD_YEAR = 1 << 3;
-
- private static final int DATE_CELL_WIDTH = 35;
- private static final int DATE_CELL_HEIGHT = SWT.DEFAULT;
- private static final int CONTROL_BUTTON_WIDTH = 15;
- private static final int CONTROL_BUTTON_HEIGHT = 15;
- private TableViewer m_viewer;
- private Label m_monthLabel;
- private DatefieldTableModel m_model;
- private Date m_returnDate = null;
-
- @Override
- protected int getShellStyle() {
- return SWT.NONE;
- }
-
- public DateChooserDialog(Shell parentShell, Date date) {
- super(parentShell);
- m_model = new DatefieldTableModel(RwtUtility.getClientSessionLocale(parentShell.getDisplay()));
- setDisplayDate(date);
- setBlockOnOpen(false);
-
- create();
- }
-
- private void setDisplayDate(Date date) {
- m_model.setHighLightDate(date);
- m_model.setNavigationDate(date);
- }
-
- public void openDateChooser(Control c) {
- showDialogFor(c);
- }
-
- public Date getReturnDate() {
- return m_returnDate;
- }
-
- public int showDialogFor(Control field) {
- Point location = getLocation(field);
- if (location != null) {
- getShell().setLocation(location);
- }
-
- m_viewer.refresh();
-
- return this.open();
- }
-
- /**
- * Override this method to set a custom location.
- * <p>
- * As default the popup is opened right under the field.
- * </p>
- */
- protected Point getLocation(Control field) {
- // make sure that the popup fit into the application window.
- Rectangle appBounds = field.getDisplay().getBounds();
- Point absPrefPos = field.toDisplay(0, field.getSize().y);
- Rectangle prefBounds = new Rectangle(absPrefPos.x, absPrefPos.y, getShell().getSize().x, getShell().getSize().y);
-
- // horizontal correction
- if (prefBounds.x + prefBounds.width > appBounds.width) {
- prefBounds.x = appBounds.width - prefBounds.width;
- }
- // vertical correction
- if (prefBounds.y + prefBounds.height > appBounds.height) {
- prefBounds.y = appBounds.height - prefBounds.height;
- }
-
- return new Point(prefBounds.x, prefBounds.y);
- }
-
- @Override
- protected Control createContents(Composite parent) {
- parent.setData(WidgetUtil.CUSTOM_VARIANT, getDialogVariant());
-
- Composite rootArea = new Composite(parent, SWT.NO_FOCUS);
- rootArea.setData(WidgetUtil.CUSTOM_VARIANT, getDialogVariant());
- GridData gridData = new GridData(SWT.CENTER, SWT.CENTER, true, true);
- rootArea.setLayoutData(gridData);
-
- Control navigationArea = createControlArea(rootArea);
- Control calendarArea = createPickDateArea(rootArea);
-
- // layout
- rootArea.setLayout(new FormLayout());
- FormData data = new FormData();
- data.top = new FormAttachment(0, 0);
- data.left = new FormAttachment(0, 0);
- data.right = new FormAttachment(100, 0);
- navigationArea.setLayoutData(data);
- data = new FormData();
- data.top = new FormAttachment(navigationArea, 2);
- data.left = new FormAttachment(0, 0);
- data.right = new FormAttachment(100, 0);
- data.bottom = new FormAttachment(100, -5);
- calendarArea.setLayoutData(data);
-
- return rootArea;
- }
-
- protected String getDialogVariant() {
- return DATECHOOSER_DIALOG_CUSTOM_VARIANT;
- }
-
- private Control createPickDateArea(Composite parent) {
- final Table table = new Table(parent, SWT.SINGLE | SWT.NO_SCROLL | SWT.HIDE_SELECTION);
- table.setData(WidgetUtil.CUSTOM_VARIANT, getDialogVariant());
- if (getDateCellHeight() != SWT.DEFAULT) {
- table.setData(RWT.CUSTOM_ITEM_HEIGHT, getDateCellHeight());
- }
- table.setLinesVisible(true);
- TableViewer viewer = new TableViewer(table);
- new TableCellRolloverSupport(viewer);
- table.setHeaderVisible(true);
-
- table.addListener(SWT.MouseDown, new Listener() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void handleEvent(Event event) {
- switch (event.type) {
- case SWT.MouseDown: {
- TableColumn columnAt = RwtUtility.getRwtColumnAt(table, new Point(event.x, event.y));
- TableItem item = table.getItem(new Point(event.x, event.y));
- if (item != null) {
- item.setData(WidgetUtil.CUSTOM_VARIANT, getDialogVariant());
- if (columnAt != null) {
- Date date = ((DateRow) item.getData()).getDate(table.indexOf(columnAt) - 1);
- m_returnDate = date;
- getShell().getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- close();
- }
- });
- }
- }
- break;
- }
- }
- }
- });
-
- TableColumn dummyColumn = new TableColumn(table, SWT.RIGHT);
- dummyColumn.setData(WidgetUtil.CUSTOM_VARIANT, getDialogVariant());
- dummyColumn.setWidth(0);
- dummyColumn.setResizable(false);
- dummyColumn.setMoveable(false);
-
- String[] wd = new DateFormatSymbols(RwtUtility.getClientSessionLocale(parent.getDisplay())).getShortWeekdays();
- // create the m_columns from monday to saturday
- for (int i = 2; i < 8; i++) {
- TableColumn col = new TableColumn(table, SWT.CENTER);
- col.setData(WidgetUtil.CUSTOM_VARIANT, getDialogVariant());
- col.setWidth(getDateCellWidth());
- col.setResizable(false);
- col.setMoveable(false);
- col.setText(wd[i]);
- }
- // sunday
- TableColumn col = new TableColumn(table, SWT.CENTER);
- col.setData(WidgetUtil.CUSTOM_VARIANT, getDialogVariant());
- col.setWidth(getDateCellWidth());
- col.setResizable(false);
- col.setMoveable(false);
- col.setText(wd[Calendar.SUNDAY]);
- // viewer
- m_viewer = viewer;
-
- m_viewer.setLabelProvider(m_model);
- m_viewer.setContentProvider(m_model);
- m_viewer.setInput(m_model);
-
- return table;
- }
-
- protected int getDateCellWidth() {
- return DATE_CELL_WIDTH;
- }
-
- protected int getDateCellHeight() {
- return DATE_CELL_HEIGHT;
- }
-
- private Control createControlArea(Composite parent) {
- Composite rootArea = RwtUtility.getUiEnvironment(parent.getDisplay()).getFormToolkit().createComposite(parent, SWT.NO_FOCUS);
- rootArea.setData(WidgetUtil.CUSTOM_VARIANT, getDialogVariant());
- createButton(rootArea, TYPE_BACK_YEAR);
- createButton(rootArea, TYPE_BACK_MONTH);
- m_monthLabel = new Label(rootArea, SWT.CENTER);
- m_monthLabel.setText(m_model.getMonthYearLabel());
- m_monthLabel.setData(WidgetUtil.CUSTOM_VARIANT, getDialogVariant());
- createButton(rootArea, TYPE_FOREWARD_MONTH);
- createButton(rootArea, TYPE_FOREWARD_YEAR);
- // layout
- rootArea.setLayout(new GridLayout(5, false));
- GridData data = new GridData();
- data.grabExcessHorizontalSpace = true;
- data.horizontalAlignment = GridData.FILL;
- m_monthLabel.setLayoutData(data);
- return rootArea;
- }
-
- private Button createButton(Composite parent, int type) {
- String variant = getControlButtonVariant(type);
-
- Button b = new Button(parent, SWT.PUSH);
- b.setData(WidgetUtil.CUSTOM_VARIANT, variant);
- b.addMouseListener(new P_NavigationMouseListener(type));
- GridData data = new GridData(getControlButtonWidth(), getControlButtonHeight());
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = false;
- b.setLayoutData(data);
- return b;
- }
-
- /**
- * Override this method to set a custom variant name for the control buttons
- */
- protected String getControlButtonVariant(int type) {
- switch (type) {
- case TYPE_BACK_YEAR:
- return LAST_YEAR_CUSTOM_VARIANT;
- case TYPE_BACK_MONTH:
- return LAST_MONTH_CUSTOM_VARIANT;
- case TYPE_FOREWARD_MONTH:
- return NEXT_MONTH_CUSTOM_VARIANT;
- case TYPE_FOREWARD_YEAR:
- return NEXT_YEAR_CUSTOM_VARIANT;
- default:
- return null;
- }
- }
-
- protected int getControlButtonWidth() {
- return CONTROL_BUTTON_WIDTH;
- }
-
- protected int getControlButtonHeight() {
- return CONTROL_BUTTON_HEIGHT;
- }
-
- private class P_NavigationMouseListener extends MouseAdapter {
- private static final long serialVersionUID = 1L;
- private int m_type;
-
- P_NavigationMouseListener(int type) {
- m_type = type;
- }
-
- @Override
- public void mouseDown(MouseEvent e) {
- switch (m_type) {
- case TYPE_BACK_YEAR:
- m_model.setNavigationDate(DateUtility.addYears(m_model.getNavigationDate(), -1));
- break;
- case TYPE_BACK_MONTH:
- m_model.setNavigationDate(DateUtility.addMonths(m_model.getNavigationDate(), -1));
- break;
- case TYPE_FOREWARD_MONTH:
- m_model.setNavigationDate(DateUtility.addMonths(m_model.getNavigationDate(), 1));
- break;
- case TYPE_FOREWARD_YEAR:
- m_model.setNavigationDate(DateUtility.addYears(m_model.getNavigationDate(), 1));
- break;
- }
- m_viewer.refresh();
- m_monthLabel.setText(m_model.getMonthYearLabel());
- }
- } // end class P_NavigationSelectionListener
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.form.fields.datefield.chooser;
+
+import java.text.DateFormatSymbols;
+import java.util.Calendar;
+import java.util.Date;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.rwt.RWT;
+import org.eclipse.rwt.lifecycle.WidgetUtil;
+import org.eclipse.scout.commons.DateUtility;
+import org.eclipse.scout.rt.ui.rap.ext.table.util.TableCellRolloverSupport;
+import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+
+public class DateChooserDialog extends Dialog {
+ private static final long serialVersionUID = 1L;
+
+ private static final String NEXT_YEAR_CUSTOM_VARIANT = "datechooser-dialog-next-year";
+ private static final String NEXT_MONTH_CUSTOM_VARIANT = "datechooser-dialog-next-month";
+ private static final String LAST_MONTH_CUSTOM_VARIANT = "datechooser-dialog-last-month";
+ private static final String LAST_YEAR_CUSTOM_VARIANT = "datechooser-dialog-last-year";
+ private static final String DATECHOOSER_DIALOG_CUSTOM_VARIANT = "datechooser-dialog";
+
+ public static final int TYPE_BACK_YEAR = 1 << 0;
+ public static final int TYPE_BACK_MONTH = 1 << 1;
+ public static final int TYPE_FOREWARD_MONTH = 1 << 2;
+ public static final int TYPE_FOREWARD_YEAR = 1 << 3;
+
+ private static final int DATE_CELL_WIDTH = 35;
+ private static final int DATE_CELL_HEIGHT = SWT.DEFAULT;
+ private static final int CONTROL_BUTTON_WIDTH = 15;
+ private static final int CONTROL_BUTTON_HEIGHT = 15;
+ private TableViewer m_viewer;
+ private Label m_monthLabel;
+ private DatefieldTableModel m_model;
+ private Date m_returnDate = null;
+
+ @Override
+ protected int getShellStyle() {
+ return SWT.NONE;
+ }
+
+ public DateChooserDialog(Shell parentShell, Date date) {
+ super(parentShell);
+ m_model = new DatefieldTableModel(RwtUtility.getClientSessionLocale(parentShell.getDisplay()));
+ setDisplayDate(date);
+ setBlockOnOpen(false);
+
+ create();
+ }
+
+ private void setDisplayDate(Date date) {
+ m_model.setHighLightDate(date);
+ m_model.setNavigationDate(date);
+ }
+
+ public void openDateChooser(Control c) {
+ showDialogFor(c);
+ }
+
+ public Date getReturnDate() {
+ return m_returnDate;
+ }
+
+ public int showDialogFor(Control field) {
+ Point location = getLocation(field);
+ if (location != null) {
+ getShell().setLocation(location);
+ }
+
+ m_viewer.refresh();
+
+ return this.open();
+ }
+
+ /**
+ * Override this method to set a custom location.
+ * <p>
+ * As default the popup is opened right under the field.
+ * </p>
+ */
+ protected Point getLocation(Control field) {
+ // make sure that the popup fit into the application window.
+ Rectangle appBounds = field.getDisplay().getBounds();
+ Point absPrefPos = field.toDisplay(0, field.getSize().y);
+ Rectangle prefBounds = new Rectangle(absPrefPos.x, absPrefPos.y, getShell().getSize().x, getShell().getSize().y);
+
+ // horizontal correction
+ if (prefBounds.x + prefBounds.width > appBounds.width) {
+ prefBounds.x = appBounds.width - prefBounds.width;
+ }
+ // vertical correction
+ if (prefBounds.y + prefBounds.height > appBounds.height) {
+ prefBounds.y = appBounds.height - prefBounds.height;
+ }
+
+ return new Point(prefBounds.x, prefBounds.y);
+ }
+
+ @Override
+ protected Control createContents(Composite parent) {
+ parent.setData(WidgetUtil.CUSTOM_VARIANT, getDialogVariant());
+
+ Composite rootArea = new Composite(parent, SWT.NO_FOCUS);
+ rootArea.setData(WidgetUtil.CUSTOM_VARIANT, getDialogVariant());
+ GridData gridData = new GridData(SWT.CENTER, SWT.CENTER, true, true);
+ rootArea.setLayoutData(gridData);
+
+ Control navigationArea = createControlArea(rootArea);
+ Control calendarArea = createPickDateArea(rootArea);
+
+ // layout
+ rootArea.setLayout(new FormLayout());
+ FormData data = new FormData();
+ data.top = new FormAttachment(0, 0);
+ data.left = new FormAttachment(0, 0);
+ data.right = new FormAttachment(100, 0);
+ navigationArea.setLayoutData(data);
+ data = new FormData();
+ data.top = new FormAttachment(navigationArea, 2);
+ data.left = new FormAttachment(0, 0);
+ data.right = new FormAttachment(100, 0);
+ data.bottom = new FormAttachment(100, -5);
+ calendarArea.setLayoutData(data);
+
+ return rootArea;
+ }
+
+ protected String getDialogVariant() {
+ return DATECHOOSER_DIALOG_CUSTOM_VARIANT;
+ }
+
+ private Control createPickDateArea(Composite parent) {
+ final Table table = new Table(parent, SWT.SINGLE | SWT.NO_SCROLL | SWT.HIDE_SELECTION);
+ table.setData(WidgetUtil.CUSTOM_VARIANT, getDialogVariant());
+ if (getDateCellHeight() != SWT.DEFAULT) {
+ table.setData(RWT.CUSTOM_ITEM_HEIGHT, getDateCellHeight());
+ }
+ table.setLinesVisible(true);
+ TableViewer viewer = new TableViewer(table);
+ new TableCellRolloverSupport(viewer);
+ table.setHeaderVisible(true);
+
+ table.addListener(SWT.MouseDown, new Listener() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void handleEvent(Event event) {
+ switch (event.type) {
+ case SWT.MouseDown: {
+ TableColumn columnAt = RwtUtility.getRwtColumnAt(table, new Point(event.x, event.y));
+ TableItem item = table.getItem(new Point(event.x, event.y));
+ if (item != null) {
+ item.setData(WidgetUtil.CUSTOM_VARIANT, getDialogVariant());
+ if (columnAt != null) {
+ Date date = ((DateRow) item.getData()).getDate(table.indexOf(columnAt) - 1);
+ m_returnDate = date;
+ getShell().getDisplay().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ close();
+ }
+ });
+ }
+ }
+ break;
+ }
+ }
+ }
+ });
+
+ TableColumn dummyColumn = new TableColumn(table, SWT.RIGHT);
+ dummyColumn.setData(WidgetUtil.CUSTOM_VARIANT, getDialogVariant());
+ dummyColumn.setWidth(0);
+ dummyColumn.setResizable(false);
+ dummyColumn.setMoveable(false);
+
+ String[] wd = new DateFormatSymbols(RwtUtility.getClientSessionLocale(parent.getDisplay())).getShortWeekdays();
+ // create the m_columns from monday to saturday
+ for (int i = 2; i < 8; i++) {
+ TableColumn col = new TableColumn(table, SWT.CENTER);
+ col.setData(WidgetUtil.CUSTOM_VARIANT, getDialogVariant());
+ col.setWidth(getDateCellWidth());
+ col.setResizable(false);
+ col.setMoveable(false);
+ col.setText(wd[i]);
+ }
+ // sunday
+ TableColumn col = new TableColumn(table, SWT.CENTER);
+ col.setData(WidgetUtil.CUSTOM_VARIANT, getDialogVariant());
+ col.setWidth(getDateCellWidth());
+ col.setResizable(false);
+ col.setMoveable(false);
+ col.setText(wd[Calendar.SUNDAY]);
+ // viewer
+ m_viewer = viewer;
+
+ m_viewer.setLabelProvider(m_model);
+ m_viewer.setContentProvider(m_model);
+ m_viewer.setInput(m_model);
+
+ return table;
+ }
+
+ protected int getDateCellWidth() {
+ return DATE_CELL_WIDTH;
+ }
+
+ protected int getDateCellHeight() {
+ return DATE_CELL_HEIGHT;
+ }
+
+ private Control createControlArea(Composite parent) {
+ Composite rootArea = RwtUtility.getUiEnvironment(parent.getDisplay()).getFormToolkit().createComposite(parent, SWT.NO_FOCUS);
+ rootArea.setData(WidgetUtil.CUSTOM_VARIANT, getDialogVariant());
+ createButton(rootArea, TYPE_BACK_YEAR);
+ createButton(rootArea, TYPE_BACK_MONTH);
+ m_monthLabel = new Label(rootArea, SWT.CENTER);
+ m_monthLabel.setText(m_model.getMonthYearLabel());
+ m_monthLabel.setData(WidgetUtil.CUSTOM_VARIANT, getDialogVariant());
+ createButton(rootArea, TYPE_FOREWARD_MONTH);
+ createButton(rootArea, TYPE_FOREWARD_YEAR);
+ // layout
+ rootArea.setLayout(new GridLayout(5, false));
+ GridData data = new GridData();
+ data.grabExcessHorizontalSpace = true;
+ data.horizontalAlignment = GridData.FILL;
+ m_monthLabel.setLayoutData(data);
+ return rootArea;
+ }
+
+ private Button createButton(Composite parent, int type) {
+ String variant = getControlButtonVariant(type);
+
+ Button b = new Button(parent, SWT.PUSH);
+ b.setData(WidgetUtil.CUSTOM_VARIANT, variant);
+ b.addMouseListener(new P_NavigationMouseListener(type));
+ GridData data = new GridData(getControlButtonWidth(), getControlButtonHeight());
+ data.horizontalAlignment = GridData.FILL;
+ data.grabExcessHorizontalSpace = false;
+ b.setLayoutData(data);
+ return b;
+ }
+
+ /**
+ * Override this method to set a custom variant name for the control buttons
+ */
+ protected String getControlButtonVariant(int type) {
+ switch (type) {
+ case TYPE_BACK_YEAR:
+ return LAST_YEAR_CUSTOM_VARIANT;
+ case TYPE_BACK_MONTH:
+ return LAST_MONTH_CUSTOM_VARIANT;
+ case TYPE_FOREWARD_MONTH:
+ return NEXT_MONTH_CUSTOM_VARIANT;
+ case TYPE_FOREWARD_YEAR:
+ return NEXT_YEAR_CUSTOM_VARIANT;
+ default:
+ return null;
+ }
+ }
+
+ protected int getControlButtonWidth() {
+ return CONTROL_BUTTON_WIDTH;
+ }
+
+ protected int getControlButtonHeight() {
+ return CONTROL_BUTTON_HEIGHT;
+ }
+
+ private class P_NavigationMouseListener extends MouseAdapter {
+ private static final long serialVersionUID = 1L;
+ private int m_type;
+
+ P_NavigationMouseListener(int type) {
+ m_type = type;
+ }
+
+ @Override
+ public void mouseDown(MouseEvent e) {
+ switch (m_type) {
+ case TYPE_BACK_YEAR:
+ m_model.setNavigationDate(DateUtility.addYears(m_model.getNavigationDate(), -1));
+ break;
+ case TYPE_BACK_MONTH:
+ m_model.setNavigationDate(DateUtility.addMonths(m_model.getNavigationDate(), -1));
+ break;
+ case TYPE_FOREWARD_MONTH:
+ m_model.setNavigationDate(DateUtility.addMonths(m_model.getNavigationDate(), 1));
+ break;
+ case TYPE_FOREWARD_YEAR:
+ m_model.setNavigationDate(DateUtility.addYears(m_model.getNavigationDate(), 1));
+ break;
+ }
+ m_viewer.refresh();
+ m_monthLabel.setText(m_model.getMonthYearLabel());
+ }
+ } // end class P_NavigationSelectionListener
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/datefield/chooser/DateRow.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/datefield/chooser/DateRow.java
index f15462fc09..7f838c9c0c 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/datefield/chooser/DateRow.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/datefield/chooser/DateRow.java
@@ -1,41 +1,41 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.form.fields.datefield.chooser;
-
-import java.util.Calendar;
-import java.util.Date;
-
-import org.eclipse.scout.commons.DateUtility;
-
-public class DateRow {
-
- private Date m_startDate;
-
- public DateRow(Date date) {
- m_startDate = date;
- }
-
- public int getIndex(Date date) {
- for (int i = 0; i < 8; i++) {
- if (DateUtility.isSameDay(date, DateUtility.addDays(m_startDate, i))) {
- return i;
- }
- }
- return -1;
- }
-
- public Date getDate(int offset) {
- Calendar c = Calendar.getInstance();
- c.setTime(m_startDate);
- c.add(Calendar.DATE, offset);
- return c.getTime();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.form.fields.datefield.chooser;
+
+import java.util.Calendar;
+import java.util.Date;
+
+import org.eclipse.scout.commons.DateUtility;
+
+public class DateRow {
+
+ private Date m_startDate;
+
+ public DateRow(Date date) {
+ m_startDate = date;
+ }
+
+ public int getIndex(Date date) {
+ for (int i = 0; i < 8; i++) {
+ if (DateUtility.isSameDay(date, DateUtility.addDays(m_startDate, i))) {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+ public Date getDate(int offset) {
+ Calendar c = Calendar.getInstance();
+ c.setTime(m_startDate);
+ c.add(Calendar.DATE, offset);
+ return c.getTime();
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/datefield/chooser/DatefieldTableModel.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/datefield/chooser/DatefieldTableModel.java
index 0d78c8fe62..9e07d985f0 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/datefield/chooser/DatefieldTableModel.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/datefield/chooser/DatefieldTableModel.java
@@ -1,185 +1,185 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.form.fields.datefield.chooser;
-
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.List;
-import java.util.Locale;
-
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.ITableColorProvider;
-import org.eclipse.jface.viewers.ITableFontProvider;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.scout.commons.DateUtility;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.Image;
-
-public class DatefieldTableModel implements IStructuredContentProvider, ITableLabelProvider, ITableColorProvider, ITableFontProvider {
- private static final long serialVersionUID = 1L;
-
- private List<DateRow> m_rows = new ArrayList<DateRow>();
- private Date m_navigationDate = null;
- private Date m_highLightDate = null;
- private final SimpleDateFormat m_monthYearFormat;
-
- // ui
- private Color m_weekendForeground;
- private Color m_outMonthForeground;
- private Color m_outMonthForegroundWeekend;
- private Color m_highlightBackground;
- private Color m_highlightForeground;
- private Font m_highlightFont;
-
- public DatefieldTableModel(Locale locale) {
- m_monthYearFormat = new SimpleDateFormat("MMMMM yyyy", locale);
-// m_weekendForeground = getUiEnvironment().getColor(new RGB(254, 154, 35));FIXME SLE set color via css
-// m_outMonthForeground = getUiEnvironment().getColor(new RGB(180, 180, 180));
-// m_outMonthForegroundWeekend = getUiEnvironment().getColor(new RGB(236, 190, 143));
-// m_highlightBackground = getUiEnvironment().getColor(new RGB(244, 248, 252));
-// m_highlightForeground = getUiEnvironment().getColor(new RGB(103, 168, 206));
-//
-// m_highlightFont = getUiEnvironment().getFont(new FontSpec(null, FontSpec.STYLE_BOLD, -1), JFaceResources.getDefaultFont());
- }
-
- @Override
- public void dispose() {
- }
-
- public DateRow getHighLightRow() {
- for (DateRow row : m_rows) {
- Date min = row.getDate(0);
- Date max = row.getDate(8);
- if (min.before(m_highLightDate) && max.after(m_highLightDate)) {
- return row;
- }
- }
- return null;
- }
-
- public int indexOf(DateRow row) {
- return m_rows.indexOf(row);
- }
-
- public void setRows(ArrayList<DateRow> rows) {
- m_rows.clear();
- m_rows.addAll(rows);
- }
-
- public void setHighLightDate(Date date) {
- if (date == null) {
- date = new Date();
- }
- m_highLightDate = date;
- }
-
- public void setNavigationDate(Date date) {
- if (date == null) {
- date = new Date();
- }
- m_navigationDate = date;
- m_rows.clear();
- Calendar c = Calendar.getInstance();
- c.setTime(date);
- // Calculate Startdate; go back to 1st of month, then go back to monday
- // (1=sunday)
- int monday = Calendar.MONDAY;
- c.add(Calendar.DAY_OF_MONTH, -(c.get(Calendar.DAY_OF_MONTH) - 1));
- c.add(Calendar.DAY_OF_WEEK, -((c.get(Calendar.DAY_OF_WEEK) - monday + 7) % 7));
- for (int iRows = 0; iRows < 6; iRows++) {
- DateRow row = new DateRow(c.getTime());
- m_rows.add(row);
- c.add(Calendar.DATE, 7);
- }
- }
-
- public Date getNavigationDate() {
- return m_navigationDate;
- }
-
- public String getMonthYearLabel() {
- return m_monthYearFormat.format(m_navigationDate);
- }
-
- @Override
- public Object[] getElements(Object inputElement) {
- return m_rows.toArray();
- }
-
- @Override
- public Image getColumnImage(Object element, int columnIndex) {
- return null;
- }
-
- @Override
- public String getColumnText(Object element, int columnIndex) {
- Calendar c = Calendar.getInstance();
- c.setTime(((DateRow) element).getDate(columnIndex - 1));
- int dayOfMonth = c.get(Calendar.DAY_OF_MONTH);
- return "" + dayOfMonth;
- }
-
- @Override
- public Color getBackground(Object element, int columnIndex) {
- return m_highlightBackground;
- }
-
- @Override
- public Color getForeground(Object element, int columnIndex) {
- Date date = ((DateRow) element).getDate(columnIndex - 1);
- // check hightlight
- if (DateUtility.isSameDay(date, m_highLightDate)) {
- return m_highlightForeground;
- }
- if (DateUtility.isWeekend(date) && DateUtility.isSameMonth(date, m_navigationDate)) {
- return m_weekendForeground;
- }
- if (!DateUtility.isSameMonth(date, m_navigationDate) && !DateUtility.isWeekend(date)) {
- return m_outMonthForeground;
- }
- if (!DateUtility.isSameMonth(date, m_navigationDate) && DateUtility.isWeekend(date)) {
- return m_outMonthForegroundWeekend;
- }
- return null;
- }
-
- @Override
- public Font getFont(Object element, int columnIndex) {
- Date date = ((DateRow) element).getDate(columnIndex - 1);
- // check hightlight
- if (DateUtility.isSameDay(date, m_highLightDate)) {
- return m_highlightFont;
- }
- return null;
- }
-
- @Override
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
-
- @Override
- public void addListener(ILabelProviderListener listener) {
- }
-
- @Override
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- @Override
- public void removeListener(ILabelProviderListener listener) {
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.form.fields.datefield.chooser;
+
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+import java.util.Locale;
+
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.ITableColorProvider;
+import org.eclipse.jface.viewers.ITableFontProvider;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.scout.commons.DateUtility;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.Image;
+
+public class DatefieldTableModel implements IStructuredContentProvider, ITableLabelProvider, ITableColorProvider, ITableFontProvider {
+ private static final long serialVersionUID = 1L;
+
+ private List<DateRow> m_rows = new ArrayList<DateRow>();
+ private Date m_navigationDate = null;
+ private Date m_highLightDate = null;
+ private final SimpleDateFormat m_monthYearFormat;
+
+ // ui
+ private Color m_weekendForeground;
+ private Color m_outMonthForeground;
+ private Color m_outMonthForegroundWeekend;
+ private Color m_highlightBackground;
+ private Color m_highlightForeground;
+ private Font m_highlightFont;
+
+ public DatefieldTableModel(Locale locale) {
+ m_monthYearFormat = new SimpleDateFormat("MMMMM yyyy", locale);
+// m_weekendForeground = getUiEnvironment().getColor(new RGB(254, 154, 35));FIXME SLE set color via css
+// m_outMonthForeground = getUiEnvironment().getColor(new RGB(180, 180, 180));
+// m_outMonthForegroundWeekend = getUiEnvironment().getColor(new RGB(236, 190, 143));
+// m_highlightBackground = getUiEnvironment().getColor(new RGB(244, 248, 252));
+// m_highlightForeground = getUiEnvironment().getColor(new RGB(103, 168, 206));
+//
+// m_highlightFont = getUiEnvironment().getFont(new FontSpec(null, FontSpec.STYLE_BOLD, -1), JFaceResources.getDefaultFont());
+ }
+
+ @Override
+ public void dispose() {
+ }
+
+ public DateRow getHighLightRow() {
+ for (DateRow row : m_rows) {
+ Date min = row.getDate(0);
+ Date max = row.getDate(8);
+ if (min.before(m_highLightDate) && max.after(m_highLightDate)) {
+ return row;
+ }
+ }
+ return null;
+ }
+
+ public int indexOf(DateRow row) {
+ return m_rows.indexOf(row);
+ }
+
+ public void setRows(ArrayList<DateRow> rows) {
+ m_rows.clear();
+ m_rows.addAll(rows);
+ }
+
+ public void setHighLightDate(Date date) {
+ if (date == null) {
+ date = new Date();
+ }
+ m_highLightDate = date;
+ }
+
+ public void setNavigationDate(Date date) {
+ if (date == null) {
+ date = new Date();
+ }
+ m_navigationDate = date;
+ m_rows.clear();
+ Calendar c = Calendar.getInstance();
+ c.setTime(date);
+ // Calculate Startdate; go back to 1st of month, then go back to monday
+ // (1=sunday)
+ int monday = Calendar.MONDAY;
+ c.add(Calendar.DAY_OF_MONTH, -(c.get(Calendar.DAY_OF_MONTH) - 1));
+ c.add(Calendar.DAY_OF_WEEK, -((c.get(Calendar.DAY_OF_WEEK) - monday + 7) % 7));
+ for (int iRows = 0; iRows < 6; iRows++) {
+ DateRow row = new DateRow(c.getTime());
+ m_rows.add(row);
+ c.add(Calendar.DATE, 7);
+ }
+ }
+
+ public Date getNavigationDate() {
+ return m_navigationDate;
+ }
+
+ public String getMonthYearLabel() {
+ return m_monthYearFormat.format(m_navigationDate);
+ }
+
+ @Override
+ public Object[] getElements(Object inputElement) {
+ return m_rows.toArray();
+ }
+
+ @Override
+ public Image getColumnImage(Object element, int columnIndex) {
+ return null;
+ }
+
+ @Override
+ public String getColumnText(Object element, int columnIndex) {
+ Calendar c = Calendar.getInstance();
+ c.setTime(((DateRow) element).getDate(columnIndex - 1));
+ int dayOfMonth = c.get(Calendar.DAY_OF_MONTH);
+ return "" + dayOfMonth;
+ }
+
+ @Override
+ public Color getBackground(Object element, int columnIndex) {
+ return m_highlightBackground;
+ }
+
+ @Override
+ public Color getForeground(Object element, int columnIndex) {
+ Date date = ((DateRow) element).getDate(columnIndex - 1);
+ // check hightlight
+ if (DateUtility.isSameDay(date, m_highLightDate)) {
+ return m_highlightForeground;
+ }
+ if (DateUtility.isWeekend(date) && DateUtility.isSameMonth(date, m_navigationDate)) {
+ return m_weekendForeground;
+ }
+ if (!DateUtility.isSameMonth(date, m_navigationDate) && !DateUtility.isWeekend(date)) {
+ return m_outMonthForeground;
+ }
+ if (!DateUtility.isSameMonth(date, m_navigationDate) && DateUtility.isWeekend(date)) {
+ return m_outMonthForegroundWeekend;
+ }
+ return null;
+ }
+
+ @Override
+ public Font getFont(Object element, int columnIndex) {
+ Date date = ((DateRow) element).getDate(columnIndex - 1);
+ // check hightlight
+ if (DateUtility.isSameDay(date, m_highLightDate)) {
+ return m_highlightFont;
+ }
+ return null;
+ }
+
+ @Override
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+
+ @Override
+ public void addListener(ILabelProviderListener listener) {
+ }
+
+ @Override
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+
+ @Override
+ public void removeListener(ILabelProviderListener listener) {
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/datefield/chooser/TimeChooser.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/datefield/chooser/TimeChooser.java
index ea545f1da9..39c4199d13 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/datefield/chooser/TimeChooser.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/datefield/chooser/TimeChooser.java
@@ -1,185 +1,185 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.form.fields.datefield.chooser;
-
-import java.text.DateFormat;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.EventListener;
-
-import javax.swing.event.ChangeEvent;
-import javax.swing.event.ChangeListener;
-
-import org.eclipse.rwt.RWT;
-import org.eclipse.scout.commons.EventListenerList;
-import org.eclipse.scout.commons.LocaleThreadLocal;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.TableItem;
-
-/**
- * Tabular listing of times of every half hour
- */
-public class TimeChooser {
- private static final int TABLE_HEIGHT = 200;
- private static final int TABLE_CELL_HEIGHT = SWT.DEFAULT;
-
- private final EventListenerList m_listenerList = new EventListenerList();
-
- private Composite m_container;
- private Table m_table;
- private DateFormat m_timeFormat;
-
- public TimeChooser(Composite parent) {
- m_container = parent;
- m_timeFormat = DateFormat.getTimeInstance(DateFormat.SHORT, LocaleThreadLocal.get());
-
- m_table = new Table(m_container, SWT.SINGLE | SWT.V_SCROLL | SWT.FULL_SELECTION);
- m_table.setLinesVisible(true);
- m_table.setHeaderVisible(false);
-
- if (getTableCellHeight() != SWT.DEFAULT) {
- m_table.setData(RWT.CUSTOM_ITEM_HEIGHT, getTableCellHeight());
- }
-
- GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
- if (getTableHeight() != SWT.DEFAULT) {
- data.heightHint = getTableHeight();
- }
- m_table.setLayoutData(data);
-
- TableColumn column = new TableColumn(m_table, SWT.NONE);
- column.setText("");
- for (Date value : createTableData()) {
- TableItem item = new TableItem(m_table, SWT.NONE);
- item.setData(value);
- if (value != null) {
- item.setText(0, m_timeFormat.format((Date) value));
- }
- else {
- item.setText(0, "n/a");
- }
- }
- m_table.getColumn(0).pack();
-
- //fire change when selection was chosen
- m_table.addSelectionListener(new SelectionAdapter() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- fireChangedEvent();
- }
- });
-
- //initial value
- setTime(new Date());
- }
-
- protected int getTableHeight() {
- return TABLE_HEIGHT;
- }
-
- protected int getTableCellHeight() {
- return TABLE_CELL_HEIGHT;
- }
-
- /**
- * fires whenever a date is picked, even if it is the current selection
- */
- public void addChangeListener(ChangeListener listener) {
- m_listenerList.add(ChangeListener.class, listener);
- }
-
- public void removeChangeListener(ChangeListener listener) {
- m_listenerList.remove(ChangeListener.class, listener);
- }
-
- /**
- * force changed event
- */
- public void doChanged() {
- fireChangedEvent();
- }
-
- private void fireChangedEvent() {
- EventListener[] a = m_listenerList.getListeners(ChangeListener.class);
- if (a != null && a.length > 0) {
- ChangeEvent e = new ChangeEvent(this);
- for (int i = 0; i < a.length; i++) {
- ((ChangeListener) a[i]).stateChanged(e);
- }
- }
- }
-
- public Date getTime() {
- int row = m_table.getSelectionIndex();
- Object selection = (row >= 0 ? m_table.getSelection()[0] : null);
- if (selection instanceof TableItem) {
- return (Date) ((TableItem) selection).getData();
- }
- return null;
- }
-
- public void setTime(Date value) {
- if (value == null) {
- value = new Date();
- }
- Calendar cal = Calendar.getInstance();
- cal.setTime(value);
- int row = (cal.get(Calendar.HOUR_OF_DAY) * 60 + cal.get(Calendar.MINUTE)) / 30;
- m_table.setSelection(row);
- m_table.getDisplay().asyncExec(new Runnable() {
-
- @Override
- public void run() {
- m_table.showSelection();
- }
- });
- }
-
- public Double getTimeAsDouble() {
- Date t = getTime();
- if (t == null) {
- return null;
- }
- Calendar cal = Calendar.getInstance();
- cal.setTime(getTime());
- return 1.0 * (cal.get(Calendar.HOUR_OF_DAY) * 60 + cal.get(Calendar.MINUTE)) / (60.0 * 24.0);
- }
-
- public void setTimeAsAsDouble(Double d) {
- if (d == null) {
- setTime(null);
- return;
- }
- Calendar cal = Calendar.getInstance();
- cal.clear();
- cal.add(Calendar.MINUTE, (int) (d.doubleValue() * 24.0 * 60.0 + 0.5));
- setTime(cal.getTime());
- }
-
- protected Date[] createTableData() {
- Calendar cal = Calendar.getInstance();
- cal.clear();
- Date[] data = new Date[48];
- for (int i = 0; i < data.length; i++) {
- data[i] = cal.getTime();
- cal.add(Calendar.MINUTE, 30);
- }
- return data;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.form.fields.datefield.chooser;
+
+import java.text.DateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.EventListener;
+
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+
+import org.eclipse.rwt.RWT;
+import org.eclipse.scout.commons.EventListenerList;
+import org.eclipse.scout.commons.LocaleThreadLocal;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+
+/**
+ * Tabular listing of times of every half hour
+ */
+public class TimeChooser {
+ private static final int TABLE_HEIGHT = 200;
+ private static final int TABLE_CELL_HEIGHT = SWT.DEFAULT;
+
+ private final EventListenerList m_listenerList = new EventListenerList();
+
+ private Composite m_container;
+ private Table m_table;
+ private DateFormat m_timeFormat;
+
+ public TimeChooser(Composite parent) {
+ m_container = parent;
+ m_timeFormat = DateFormat.getTimeInstance(DateFormat.SHORT, LocaleThreadLocal.get());
+
+ m_table = new Table(m_container, SWT.SINGLE | SWT.V_SCROLL | SWT.FULL_SELECTION);
+ m_table.setLinesVisible(true);
+ m_table.setHeaderVisible(false);
+
+ if (getTableCellHeight() != SWT.DEFAULT) {
+ m_table.setData(RWT.CUSTOM_ITEM_HEIGHT, getTableCellHeight());
+ }
+
+ GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
+ if (getTableHeight() != SWT.DEFAULT) {
+ data.heightHint = getTableHeight();
+ }
+ m_table.setLayoutData(data);
+
+ TableColumn column = new TableColumn(m_table, SWT.NONE);
+ column.setText("");
+ for (Date value : createTableData()) {
+ TableItem item = new TableItem(m_table, SWT.NONE);
+ item.setData(value);
+ if (value != null) {
+ item.setText(0, m_timeFormat.format((Date) value));
+ }
+ else {
+ item.setText(0, "n/a");
+ }
+ }
+ m_table.getColumn(0).pack();
+
+ //fire change when selection was chosen
+ m_table.addSelectionListener(new SelectionAdapter() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ fireChangedEvent();
+ }
+ });
+
+ //initial value
+ setTime(new Date());
+ }
+
+ protected int getTableHeight() {
+ return TABLE_HEIGHT;
+ }
+
+ protected int getTableCellHeight() {
+ return TABLE_CELL_HEIGHT;
+ }
+
+ /**
+ * fires whenever a date is picked, even if it is the current selection
+ */
+ public void addChangeListener(ChangeListener listener) {
+ m_listenerList.add(ChangeListener.class, listener);
+ }
+
+ public void removeChangeListener(ChangeListener listener) {
+ m_listenerList.remove(ChangeListener.class, listener);
+ }
+
+ /**
+ * force changed event
+ */
+ public void doChanged() {
+ fireChangedEvent();
+ }
+
+ private void fireChangedEvent() {
+ EventListener[] a = m_listenerList.getListeners(ChangeListener.class);
+ if (a != null && a.length > 0) {
+ ChangeEvent e = new ChangeEvent(this);
+ for (int i = 0; i < a.length; i++) {
+ ((ChangeListener) a[i]).stateChanged(e);
+ }
+ }
+ }
+
+ public Date getTime() {
+ int row = m_table.getSelectionIndex();
+ Object selection = (row >= 0 ? m_table.getSelection()[0] : null);
+ if (selection instanceof TableItem) {
+ return (Date) ((TableItem) selection).getData();
+ }
+ return null;
+ }
+
+ public void setTime(Date value) {
+ if (value == null) {
+ value = new Date();
+ }
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(value);
+ int row = (cal.get(Calendar.HOUR_OF_DAY) * 60 + cal.get(Calendar.MINUTE)) / 30;
+ m_table.setSelection(row);
+ m_table.getDisplay().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ m_table.showSelection();
+ }
+ });
+ }
+
+ public Double getTimeAsDouble() {
+ Date t = getTime();
+ if (t == null) {
+ return null;
+ }
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(getTime());
+ return 1.0 * (cal.get(Calendar.HOUR_OF_DAY) * 60 + cal.get(Calendar.MINUTE)) / (60.0 * 24.0);
+ }
+
+ public void setTimeAsAsDouble(Double d) {
+ if (d == null) {
+ setTime(null);
+ return;
+ }
+ Calendar cal = Calendar.getInstance();
+ cal.clear();
+ cal.add(Calendar.MINUTE, (int) (d.doubleValue() * 24.0 * 60.0 + 0.5));
+ setTime(cal.getTime());
+ }
+
+ protected Date[] createTableData() {
+ Calendar cal = Calendar.getInstance();
+ cal.clear();
+ Date[] data = new Date[48];
+ for (int i = 0; i < data.length; i++) {
+ data[i] = cal.getTime();
+ cal.add(Calendar.MINUTE, 30);
+ }
+ return data;
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/datefield/chooser/TimeChooserDialog.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/datefield/chooser/TimeChooserDialog.java
index dbd09f5479..c316ce6a92 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/datefield/chooser/TimeChooserDialog.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/datefield/chooser/TimeChooserDialog.java
@@ -1,165 +1,165 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.form.fields.datefield.chooser;
-
-import java.util.Calendar;
-import java.util.Date;
-
-import javax.swing.event.ChangeEvent;
-import javax.swing.event.ChangeListener;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.rwt.lifecycle.WidgetUtil;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-
-public class TimeChooserDialog extends Dialog {
- private static final long serialVersionUID = 1L;
-
- private static final String TIMECHOOSER_DIALOG_CUSTOM_VARIANT = "timechooser-dialog";
-
- public static final int TYPE_BACK_YEAR = 1 << 0;
- public static final int TYPE_BACK_MONTH = 1 << 1;
- public static final int TYPE_FOREWARD_MONTH = 1 << 2;
- public static final int TYPE_FOREWARD_YEAR = 1 << 3;
-
- private TimeChooser m_timeChooser;
- private Date m_returnTime = null;
- private Date m_displayDate;
-
- @Override
- protected int getShellStyle() {
- return SWT.NONE;
- }
-
- public TimeChooserDialog(Shell parentShell, Date date) {
- super(parentShell);
- setDisplayDate(date);
- setBlockOnOpen(false);
- create();
- }
-
- public TimeChooserDialog(Shell parentShell, Number number) {
- super(parentShell);
- setDisplayDate((Double) number);
- setBlockOnOpen(false);
- create();
- }
-
- private void setDisplayDate(Date date) {
- m_displayDate = date;
- }
-
- private void setDisplayDate(Double number) {
- if (number == null) {
- return;
- }
-
- // transform time of day in fractional representation (0.5 = noon)
- // into normal hour/minute representation
- Calendar c = Calendar.getInstance();
- int hours = (int) (number * 24);
- int mins = (int) Math.round((number * 24 - hours) * 60);
- c.set(0, 0, 0, hours, mins);
- // set time as date
- m_displayDate = c.getTime();
- }
-
- public void openTimeChooser(Control c) {
- showDialogFor(c);
- }
-
- /**
- * Returns the choosen time from the time table. The time value is represented in a Date object and
- * should be used.
- * The date value part is uninitialized. Therefore, it should NOT be used.
- *
- * @return Choosen time value.
- */
- public Date getReturnTime() {
- return m_returnTime;
- }
-
- public int showDialogFor(Control field) {
- Point location = getLocation(field);
- if (location != null) {
- getShell().setLocation(location);
- }
-
- return this.open();
- }
-
- /**
- * Override this method to set a custom location.
- * <p>
- * As default the popup is opened right under the field.
- * </p>
- */
- protected Point getLocation(Control field) {
- // make sure that the popup fit into the application window.
- Rectangle appBounds = field.getDisplay().getBounds();
- Point absPrefPos = field.toDisplay(field.getSize().x - getShell().getSize().x, field.getSize().y);
- Rectangle prefBounds = new Rectangle(absPrefPos.x, absPrefPos.y, getShell().getSize().x, getShell().getSize().y);
- // horizontal correction
- if (prefBounds.x + prefBounds.width > appBounds.width) {
- prefBounds.x = appBounds.width - prefBounds.width;
- }
- // vertical correciton
- if (prefBounds.y + prefBounds.height > appBounds.height) {
- prefBounds.y = appBounds.height - prefBounds.height;
- }
-
- return new Point(prefBounds.x, prefBounds.y);
- }
-
- @Override
- protected Control createContents(Composite parent) {
- parent.setData(WidgetUtil.CUSTOM_VARIANT, getDialogVariant());
-
- Composite rootArea = new Composite(parent, SWT.NONE);
- rootArea.setData(WidgetUtil.CUSTOM_VARIANT, getDialogVariant());
-
- m_timeChooser = createTimeChooser(rootArea);
- m_timeChooser.addChangeListener(new ChangeListener() {
- @Override
- public void stateChanged(ChangeEvent e) {
- m_returnTime = m_timeChooser.getTime();
- getShell().getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- close();
- }
- });
- }
- });
- m_timeChooser.setTime(m_displayDate);
-
- // layout
- rootArea.setLayout(new GridLayout());
- GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
- rootArea.setLayoutData(data);
- return rootArea;
- }
-
- protected TimeChooser createTimeChooser(Composite parent) {
- return new TimeChooser(parent);
- }
-
- protected String getDialogVariant() {
- return TIMECHOOSER_DIALOG_CUSTOM_VARIANT;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.form.fields.datefield.chooser;
+
+import java.util.Calendar;
+import java.util.Date;
+
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.rwt.lifecycle.WidgetUtil;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+
+public class TimeChooserDialog extends Dialog {
+ private static final long serialVersionUID = 1L;
+
+ private static final String TIMECHOOSER_DIALOG_CUSTOM_VARIANT = "timechooser-dialog";
+
+ public static final int TYPE_BACK_YEAR = 1 << 0;
+ public static final int TYPE_BACK_MONTH = 1 << 1;
+ public static final int TYPE_FOREWARD_MONTH = 1 << 2;
+ public static final int TYPE_FOREWARD_YEAR = 1 << 3;
+
+ private TimeChooser m_timeChooser;
+ private Date m_returnTime = null;
+ private Date m_displayDate;
+
+ @Override
+ protected int getShellStyle() {
+ return SWT.NONE;
+ }
+
+ public TimeChooserDialog(Shell parentShell, Date date) {
+ super(parentShell);
+ setDisplayDate(date);
+ setBlockOnOpen(false);
+ create();
+ }
+
+ public TimeChooserDialog(Shell parentShell, Number number) {
+ super(parentShell);
+ setDisplayDate((Double) number);
+ setBlockOnOpen(false);
+ create();
+ }
+
+ private void setDisplayDate(Date date) {
+ m_displayDate = date;
+ }
+
+ private void setDisplayDate(Double number) {
+ if (number == null) {
+ return;
+ }
+
+ // transform time of day in fractional representation (0.5 = noon)
+ // into normal hour/minute representation
+ Calendar c = Calendar.getInstance();
+ int hours = (int) (number * 24);
+ int mins = (int) Math.round((number * 24 - hours) * 60);
+ c.set(0, 0, 0, hours, mins);
+ // set time as date
+ m_displayDate = c.getTime();
+ }
+
+ public void openTimeChooser(Control c) {
+ showDialogFor(c);
+ }
+
+ /**
+ * Returns the choosen time from the time table. The time value is represented in a Date object and
+ * should be used.
+ * The date value part is uninitialized. Therefore, it should NOT be used.
+ *
+ * @return Choosen time value.
+ */
+ public Date getReturnTime() {
+ return m_returnTime;
+ }
+
+ public int showDialogFor(Control field) {
+ Point location = getLocation(field);
+ if (location != null) {
+ getShell().setLocation(location);
+ }
+
+ return this.open();
+ }
+
+ /**
+ * Override this method to set a custom location.
+ * <p>
+ * As default the popup is opened right under the field.
+ * </p>
+ */
+ protected Point getLocation(Control field) {
+ // make sure that the popup fit into the application window.
+ Rectangle appBounds = field.getDisplay().getBounds();
+ Point absPrefPos = field.toDisplay(field.getSize().x - getShell().getSize().x, field.getSize().y);
+ Rectangle prefBounds = new Rectangle(absPrefPos.x, absPrefPos.y, getShell().getSize().x, getShell().getSize().y);
+ // horizontal correction
+ if (prefBounds.x + prefBounds.width > appBounds.width) {
+ prefBounds.x = appBounds.width - prefBounds.width;
+ }
+ // vertical correciton
+ if (prefBounds.y + prefBounds.height > appBounds.height) {
+ prefBounds.y = appBounds.height - prefBounds.height;
+ }
+
+ return new Point(prefBounds.x, prefBounds.y);
+ }
+
+ @Override
+ protected Control createContents(Composite parent) {
+ parent.setData(WidgetUtil.CUSTOM_VARIANT, getDialogVariant());
+
+ Composite rootArea = new Composite(parent, SWT.NONE);
+ rootArea.setData(WidgetUtil.CUSTOM_VARIANT, getDialogVariant());
+
+ m_timeChooser = createTimeChooser(rootArea);
+ m_timeChooser.addChangeListener(new ChangeListener() {
+ @Override
+ public void stateChanged(ChangeEvent e) {
+ m_returnTime = m_timeChooser.getTime();
+ getShell().getDisplay().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ close();
+ }
+ });
+ }
+ });
+ m_timeChooser.setTime(m_displayDate);
+
+ // layout
+ rootArea.setLayout(new GridLayout());
+ GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
+ rootArea.setLayoutData(data);
+ return rootArea;
+ }
+
+ protected TimeChooser createTimeChooser(Composite parent) {
+ return new TimeChooser(parent);
+ }
+
+ protected String getDialogVariant() {
+ return TIMECHOOSER_DIALOG_CUSTOM_VARIANT;
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/decimalfield/IRwtScoutDecimalField.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/decimalfield/IRwtScoutDecimalField.java
index 3ee284c8ec..9c72d22061 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/decimalfield/IRwtScoutDecimalField.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/decimalfield/IRwtScoutDecimalField.java
@@ -1,26 +1,26 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.form.fields.decimalfield;
-
-import org.eclipse.scout.rt.client.ui.form.fields.decimalfield.IDecimalField;
-import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * <h3>IRwtScoutDecimalField</h3> ...
- *
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.form.fields.decimalfield;
+
+import org.eclipse.scout.rt.client.ui.form.fields.decimalfield.IDecimalField;
+import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * <h3>IRwtScoutDecimalField</h3> ...
+ *
* @since 3.7.0 June 2011
- */
-public interface IRwtScoutDecimalField extends IRwtScoutFormField<IDecimalField<?>> {
-
- @Override
- Text getUiField();
-}
+ */
+public interface IRwtScoutDecimalField extends IRwtScoutFormField<IDecimalField<?>> {
+
+ @Override
+ Text getUiField();
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/decimalfield/RwtScoutDecimalField.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/decimalfield/RwtScoutDecimalField.java
index 7c4907cb32..0b5944e9e1 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/decimalfield/RwtScoutDecimalField.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/decimalfield/RwtScoutDecimalField.java
@@ -1,124 +1,124 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.form.fields.decimalfield;
-
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.commons.holders.Holder;
-import org.eclipse.scout.commons.job.JobEx;
-import org.eclipse.scout.rt.client.ui.form.fields.decimalfield.IDecimalField;
-import org.eclipse.scout.rt.ui.rap.LogicalGridLayout;
-import org.eclipse.scout.rt.ui.rap.ext.StatusLabelEx;
-import org.eclipse.scout.rt.ui.rap.ext.StyledTextEx;
-import org.eclipse.scout.rt.ui.rap.ext.custom.StyledText;
-import org.eclipse.scout.rt.ui.rap.form.fields.RwtScoutValueFieldComposite;
-import org.eclipse.scout.rt.ui.rap.internal.TextFieldEditableSupport;
-import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * <h3>RwtScoutDoubleField</h3> ...
- *
- * @since 3.7.0 June 2011
- */
-public class RwtScoutDecimalField extends RwtScoutValueFieldComposite<IDecimalField<?>> implements IRwtScoutDecimalField {
- private TextFieldEditableSupport m_editableSupport;
-
- @Override
- protected void initializeUi(Composite parent) {
- int style = SWT.BORDER;
- style |= RwtUtility.getVerticalAlignment(getScoutObject().getGridData().verticalAlignment);
- style |= RwtUtility.getHorizontalAlignment(getScoutObject().getGridData().horizontalAlignment);
-
- Composite container = getUiEnvironment().getFormToolkit().createComposite(parent);
- StatusLabelEx label = getUiEnvironment().getFormToolkit().createStatusLabel(container, getScoutObject());
-
- StyledText text = new StyledTextEx(container, style);
- text.setTextLimit(32);
- //
- setUiContainer(container);
- setUiLabel(label);
- setUiField(text);
-
- // layout
- getUiContainer().setLayout(new LogicalGridLayout(1, 0));
- }
-
- @Override
- public Text getUiField() {
- return (Text) super.getUiField();
- }
-
- @Override
- protected void setFieldEnabled(Control field, boolean enabled) {
- if (m_editableSupport == null) {
- m_editableSupport = new TextFieldEditableSupport(getUiField());
- }
- m_editableSupport.setEditable(enabled);
- }
-
- @Override
- protected void setEnabledFromScout(boolean b) {
- super.setEnabledFromScout(b);
- getUiField().setEnabled(b);
- }
-
- @Override
- protected void setDisplayTextFromScout(String s) {
- if (s == null) {
- s = "";
- }
- getUiField().setText(s);
- }
-
- @Override
- protected void handleUiInputVerifier(boolean doit) {
- if (!doit) {
- return;
- }
- final String text = getUiField().getText();
- // only handle if text has changed
- if (CompareUtility.equals(text, getScoutObject().getDisplayText()) && getScoutObject().getErrorStatus() == null) {
- return;
- }
- final Holder<Boolean> result = new Holder<Boolean>(Boolean.class, false);
- // notify Scout
- Runnable t = new Runnable() {
- @Override
- public void run() {
- boolean b = getScoutObject().getUIFacade().setTextFromUI(text);
- result.setValue(b);
- }
- };
- JobEx job = getUiEnvironment().invokeScoutLater(t, 0);
- try {
- job.join(2345);
- }
- catch (InterruptedException e) {
- //nop
- }
- getUiEnvironment().dispatchImmediateUiJobs();
- // end notify
- return;
- }
-
- @Override
- protected void handleUiFocusGained() {
- super.handleUiFocusGained();
-
- if (isSelectAllOnFocusEnabled()) {
- getUiField().setSelection(0, getUiField().getText().length());
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.form.fields.decimalfield;
+
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.commons.holders.Holder;
+import org.eclipse.scout.commons.job.JobEx;
+import org.eclipse.scout.rt.client.ui.form.fields.decimalfield.IDecimalField;
+import org.eclipse.scout.rt.ui.rap.LogicalGridLayout;
+import org.eclipse.scout.rt.ui.rap.ext.StatusLabelEx;
+import org.eclipse.scout.rt.ui.rap.ext.StyledTextEx;
+import org.eclipse.scout.rt.ui.rap.ext.custom.StyledText;
+import org.eclipse.scout.rt.ui.rap.form.fields.RwtScoutValueFieldComposite;
+import org.eclipse.scout.rt.ui.rap.internal.TextFieldEditableSupport;
+import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * <h3>RwtScoutDoubleField</h3> ...
+ *
+ * @since 3.7.0 June 2011
+ */
+public class RwtScoutDecimalField extends RwtScoutValueFieldComposite<IDecimalField<?>> implements IRwtScoutDecimalField {
+ private TextFieldEditableSupport m_editableSupport;
+
+ @Override
+ protected void initializeUi(Composite parent) {
+ int style = SWT.BORDER;
+ style |= RwtUtility.getVerticalAlignment(getScoutObject().getGridData().verticalAlignment);
+ style |= RwtUtility.getHorizontalAlignment(getScoutObject().getGridData().horizontalAlignment);
+
+ Composite container = getUiEnvironment().getFormToolkit().createComposite(parent);
+ StatusLabelEx label = getUiEnvironment().getFormToolkit().createStatusLabel(container, getScoutObject());
+
+ StyledText text = new StyledTextEx(container, style);
+ text.setTextLimit(32);
+ //
+ setUiContainer(container);
+ setUiLabel(label);
+ setUiField(text);
+
+ // layout
+ getUiContainer().setLayout(new LogicalGridLayout(1, 0));
+ }
+
+ @Override
+ public Text getUiField() {
+ return (Text) super.getUiField();
+ }
+
+ @Override
+ protected void setFieldEnabled(Control field, boolean enabled) {
+ if (m_editableSupport == null) {
+ m_editableSupport = new TextFieldEditableSupport(getUiField());
+ }
+ m_editableSupport.setEditable(enabled);
+ }
+
+ @Override
+ protected void setEnabledFromScout(boolean b) {
+ super.setEnabledFromScout(b);
+ getUiField().setEnabled(b);
+ }
+
+ @Override
+ protected void setDisplayTextFromScout(String s) {
+ if (s == null) {
+ s = "";
+ }
+ getUiField().setText(s);
+ }
+
+ @Override
+ protected void handleUiInputVerifier(boolean doit) {
+ if (!doit) {
+ return;
+ }
+ final String text = getUiField().getText();
+ // only handle if text has changed
+ if (CompareUtility.equals(text, getScoutObject().getDisplayText()) && getScoutObject().getErrorStatus() == null) {
+ return;
+ }
+ final Holder<Boolean> result = new Holder<Boolean>(Boolean.class, false);
+ // notify Scout
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ boolean b = getScoutObject().getUIFacade().setTextFromUI(text);
+ result.setValue(b);
+ }
+ };
+ JobEx job = getUiEnvironment().invokeScoutLater(t, 0);
+ try {
+ job.join(2345);
+ }
+ catch (InterruptedException e) {
+ //nop
+ }
+ getUiEnvironment().dispatchImmediateUiJobs();
+ // end notify
+ return;
+ }
+
+ @Override
+ protected void handleUiFocusGained() {
+ super.handleUiFocusGained();
+
+ if (isSelectAllOnFocusEnabled()) {
+ getUiField().setSelection(0, getUiField().getText().length());
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/groupbox/IRwtScoutGroupBox.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/groupbox/IRwtScoutGroupBox.java
index e5379e4516..82497c196c 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/groupbox/IRwtScoutGroupBox.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/groupbox/IRwtScoutGroupBox.java
@@ -1,23 +1,23 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.form.fields.groupbox;
-
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox;
-import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
-
-/**
- * <h3>IRwtScoutGroupBox</h3> ...
- *
- * @since 3.7.0 June 2011
- */
-public interface IRwtScoutGroupBox extends IRwtScoutFormField<IGroupBox> {
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.form.fields.groupbox;
+
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox;
+import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
+
+/**
+ * <h3>IRwtScoutGroupBox</h3> ...
+ *
+ * @since 3.7.0 June 2011
+ */
+public interface IRwtScoutGroupBox extends IRwtScoutFormField<IGroupBox> {
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/groupbox/IRwtScoutGroupBoxButtonbar.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/groupbox/IRwtScoutGroupBoxButtonbar.java
index cc54cae18e..5e79d89192 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/groupbox/IRwtScoutGroupBoxButtonbar.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/groupbox/IRwtScoutGroupBoxButtonbar.java
@@ -1,18 +1,18 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.form.fields.groupbox;
-
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox;
-import org.eclipse.scout.rt.ui.rap.basic.IRwtScoutComposite;
-
-public interface IRwtScoutGroupBoxButtonbar extends IRwtScoutComposite<IGroupBox> {
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.form.fields.groupbox;
+
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox;
+import org.eclipse.scout.rt.ui.rap.basic.IRwtScoutComposite;
+
+public interface IRwtScoutGroupBoxButtonbar extends IRwtScoutComposite<IGroupBox> {
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/groupbox/RwtScoutGroupBox.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/groupbox/RwtScoutGroupBox.java
index 3de0458939..820a7d6e40 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/groupbox/RwtScoutGroupBox.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/groupbox/RwtScoutGroupBox.java
@@ -1,432 +1,432 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.form.fields.groupbox;
-
-import org.eclipse.rwt.lifecycle.WidgetUtil;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox;
-import org.eclipse.scout.rt.client.ui.form.fields.tabbox.ITabBox;
-import org.eclipse.scout.rt.ui.rap.DefaultValidateRoot;
-import org.eclipse.scout.rt.ui.rap.IValidateRoot;
-import org.eclipse.scout.rt.ui.rap.LogicalGridLayout;
-import org.eclipse.scout.rt.ui.rap.extension.IUiDecoration;
-import org.eclipse.scout.rt.ui.rap.extension.UiDecorationExtensionPoint;
-import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
-import org.eclipse.scout.rt.ui.rap.form.fields.RwtScoutFieldComposite;
-import org.eclipse.scout.rt.ui.rap.form.fields.RwtScoutFormFieldGridData;
-import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.ScrolledComposite;
-import org.eclipse.swt.events.ControlAdapter;
-import org.eclipse.swt.events.ControlEvent;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.forms.events.ExpansionAdapter;
-import org.eclipse.ui.forms.events.ExpansionEvent;
-import org.eclipse.ui.forms.widgets.Section;
-import org.eclipse.ui.forms.widgets.SizeCache;
-
-/**
- * <h3>RwtScoutGroupBox</h3>
- */
-public class RwtScoutGroupBox extends RwtScoutFieldComposite<IGroupBox> implements IRwtScoutGroupBox {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(RwtScoutGroupBox.class);
-
- static final String VARIANT_GROUP_BOX_WITH_LINE_FRAME_CONTAINER = "groupBoxWithLineFrameContainer";
- static final String VARIANT_GROUP_BOX_WITH_LINE_FRAME = "groupBoxWithLineFrame";
- static final String VARIANT_LABEL = "GroupBoxLabel";
- static final String VARIANT_LINE = "GroupBoxLine";
-
- public static class BorderDecoration {
- /**
- * whether there is a border at all (false: panel is simply for grouping of fields)
- */
- public boolean visible;
- /**
- * one of the IGroupBox.BORDER_DECORATION_* values
- */
- public String decoration;
- }
-
- /**
- * is null if the group box is not a scrolled group box
- */
- private ScrolledComposite m_scrolledComposite;
- private Section m_section;
- private Group m_group;
- private Label m_label;
- private Label m_line;
- private Composite m_bodyPart;
- private RwtScoutGroupBoxButtonbar m_buttonbar;
- // cache
- private BorderDecoration m_borderDecoration;
- private String m_containerLabel;
- private String m_containerImage;
- private SizeCache m_sizeCache;
-
- @Override
- protected void initializeUi(Composite parent) {
- m_borderDecoration = resolveBorderDecoration();
- Composite rootPane = createContainer(parent);
- if (getScoutObject().isScrollable()) {
- m_scrolledComposite = new ScrolledComposite(rootPane, SWT.V_SCROLL);
- m_bodyPart = getUiEnvironment().getFormToolkit().createComposite(m_scrolledComposite);
- m_scrolledComposite.setContent(m_bodyPart);
- m_scrolledComposite.setExpandHorizontal(true);
- m_scrolledComposite.setExpandVertical(true);
-
- //Mainly necessary to better support finger scrolling.
- //If the flag is not set rap tries to scroll to the top of the page. This makes scrolling of scrolled composites or listboxes impossible if they are located inside a form (not fullscreen).
- m_scrolledComposite.setShowFocusedControl(true);
-
- GridData bodyData = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL);
- bodyData.horizontalIndent = 0;
- bodyData.verticalIndent = 0;
- m_scrolledComposite.setLayoutData(bodyData);
- m_scrolledComposite.addControlListener(new ControlAdapter() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void controlResized(ControlEvent e) {
- if (m_scrolledComposite != null && !m_scrolledComposite.isDisposed()) {
- m_scrolledComposite.setMinSize(computeScrolledCompositeMinSize(false));
- }
- }
- });
- }
- else {
- m_bodyPart = getUiEnvironment().getFormToolkit().createComposite(rootPane);
- GridData bodyData = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL);
- bodyData.horizontalIndent = 0;
- bodyData.verticalIndent = 0;
- m_bodyPart.setLayoutData(bodyData);
- }
- m_bodyPart.setData(IValidateRoot.VALIDATE_ROOT_DATA, new DefaultValidateRoot(m_bodyPart) {
- @Override
- public void validate() {
- super.validate();
- if (m_scrolledComposite != null && !m_scrolledComposite.isDisposed()) {
- m_scrolledComposite.setMinSize(computeScrolledCompositeMinSize(true));
- }
- }
- });
- if (getScoutObject().getCustomProcessButtonCount() + getScoutObject().getSystemProcessButtonCount() > 0) {
- createButtonbar(rootPane);
- }
- IUiDecoration deco = UiDecorationExtensionPoint.getLookAndFeel();
- LogicalGridLayout bodyLayout = new LogicalGridLayout(deco.getLogicalGridLayoutHorizontalGap(), deco.getLogicalGridLayoutVerticalGap());
- m_bodyPart.setLayout(bodyLayout);
- installUiContainerBorder();
- // FIELDS:
- IFormField[] scoutFields = getScoutObject().getControlFields();
- for (IFormField field : scoutFields) {
- IRwtScoutFormField uiScoutComposite = getUiEnvironment().createFormField(m_bodyPart, field);
- RwtScoutFormFieldGridData layoutData = new RwtScoutFormFieldGridData(field);
- uiScoutComposite.getUiContainer().setLayoutData(layoutData);
- }
- }
-
- /**
- * Computes the preferred size of the {@link #m_bodyPart}, inspired by the class SharedScrolledComposite.
- */
- private Point computeScrolledCompositeMinSize(boolean flushCache) {
- if (m_sizeCache == null) {
- m_sizeCache = new SizeCache();
- }
-
- m_sizeCache.setControl(m_bodyPart);
- if (flushCache) {
- m_sizeCache.flush();
- }
-
- return m_sizeCache.computeSize(m_scrolledComposite.getClientArea().width, SWT.DEFAULT);
- }
-
- protected Composite createButtonbar(Composite parent) {
- m_buttonbar = new RwtScoutGroupBoxButtonbar();
- m_buttonbar.createUiField(parent, getScoutObject(), getUiEnvironment());
- GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- m_buttonbar.getUiContainer().setLayoutData(data);
- return m_buttonbar.getUiContainer();
- }
-
- protected BorderDecoration resolveBorderDecoration() {
- IGroupBox box = getScoutObject();
- BorderDecoration deco = new BorderDecoration();
- deco.visible = box.isBorderVisible();
- deco.decoration = IGroupBox.BORDER_DECORATION_EMPTY;
- if (IGroupBox.BORDER_DECORATION_SECTION.equals(box.getBorderDecoration())) {
- deco.decoration = IGroupBox.BORDER_DECORATION_SECTION;
- }
- else if (IGroupBox.BORDER_DECORATION_LINE.equals(box.getBorderDecoration())) {
- deco.decoration = IGroupBox.BORDER_DECORATION_LINE;
- }
- else if (IGroupBox.BORDER_DECORATION_EMPTY.equals(box.getBorderDecoration())) {
- deco.decoration = IGroupBox.BORDER_DECORATION_EMPTY;
- }
- else if (!IGroupBox.BORDER_DECORATION_AUTO.equals(box.getBorderDecoration())) {
- deco.decoration = IGroupBox.BORDER_DECORATION_EMPTY;
- }
- else {
- resolveBorderDecorationAuto(box, deco);
- }
- return deco;
- }
-
- protected void resolveBorderDecorationAuto(IGroupBox box, BorderDecoration deco) {
- if (box.isExpandable()) {
- deco.decoration = IGroupBox.BORDER_DECORATION_SECTION;
- }
- else if (box.isMainBox()) {
- if (UiDecorationExtensionPoint.getLookAndFeel().isFormMainBoxBorderVisible()) {
- deco.decoration = IGroupBox.BORDER_DECORATION_EMPTY;
- }
- deco.visible = false;
- }
- else if (box.getParentField() instanceof ITabBox) {
- deco.decoration = IGroupBox.BORDER_DECORATION_EMPTY;
- }
- else {
- deco.decoration = IGroupBox.BORDER_DECORATION_LINE;
- }
- }
-
- protected Composite createContainer(Composite parent) {
- Composite rootPane;
- GridLayout layout = new GridLayout(1, true);
- setUiLabel(null);
- //
- if (m_borderDecoration.visible) {
- if (IGroupBox.BORDER_DECORATION_SECTION.equals(m_borderDecoration.decoration)) {
- // section
- int style = (getScoutObject().isExpanded() ? Section.EXPANDED : 0) | Section.TITLE_BAR;
- if (getScoutObject().isExpandable()) {
- style |= Section.TWISTIE;
- }
- m_section = getUiEnvironment().getFormToolkit().createSection(parent, style);
- String label = getScoutObject().getLabel();
- if (label == null) {
- label = "";
- }
- m_section.setText(label);
- m_section.addExpansionListener(new P_ExpansionListener());
- setUiContainer(m_section);
- //
- rootPane = getUiEnvironment().getFormToolkit().createSectionClient(m_section);
- m_section.setClient(rootPane);
- layout.horizontalSpacing = 0;
- layout.verticalSpacing = 0;
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- layout.marginTop = 5;
- layout.marginRight = 7;
- layout.marginBottom = 5;
- layout.marginLeft = 5;
- //margins are NOT handled in CSS
- rootPane.setLayout(layout);
- }
- else if (IGroupBox.BORDER_DECORATION_LINE.equals(m_borderDecoration.decoration)) {
- Composite groupComp = getUiEnvironment().getFormToolkit().createComposite(parent, SWT.NONE);
- groupComp.setData(WidgetUtil.CUSTOM_VARIANT, VARIANT_GROUP_BOX_WITH_LINE_FRAME_CONTAINER);
- m_label = getUiEnvironment().getFormToolkit().createLabel(groupComp, "", SWT.NONE);
- m_label.setData(WidgetUtil.CUSTOM_VARIANT, VARIANT_LABEL);
- m_line = getUiEnvironment().getFormToolkit().createLabel(groupComp, "", SWT.NONE);
- m_line.setData(WidgetUtil.CUSTOM_VARIANT, VARIANT_LINE);
- rootPane = getUiEnvironment().getFormToolkit().createComposite(groupComp, SWT.NONE);
- rootPane.setData(WidgetUtil.CUSTOM_VARIANT, VARIANT_GROUP_BOX_WITH_LINE_FRAME);
- setUiContainer(groupComp);
- //
- GridLayout groupCompLayout = new GridLayout(1, false);
- groupCompLayout.horizontalSpacing = 0;
- groupCompLayout.marginHeight = 0;
- groupCompLayout.marginWidth = 0;
- groupCompLayout.verticalSpacing = 0;
- groupComp.setLayout(groupCompLayout);
-
- GridData labelLayoutData = new GridData();
- labelLayoutData.horizontalIndent = 14;
- m_label.setLayoutData(labelLayoutData);
-
- GridData lineLayoutData = new GridData(GridData.FILL_HORIZONTAL);
- lineLayoutData.heightHint = 1;
- m_line.setLayoutData(lineLayoutData);
-
- GridData groupLayoutData = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
- rootPane.setLayoutData(groupLayoutData);
-
- layout.horizontalSpacing = 0;
- layout.verticalSpacing = 0;
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- //margins are handled in CSS
- rootPane.setLayout(layout);
- }
- else {
- // empty
- Group emptyGroup = getUiEnvironment().getFormToolkit().createGroup(parent, 0/* SWT.SHADOW_ETCHED_IN*/);
- rootPane = emptyGroup;
- rootPane.setData(WidgetUtil.CUSTOM_VARIANT, RwtUtility.VARIANT_EMPTY);
- setUiContainer(rootPane);
- //
- layout.horizontalSpacing = 0;
- layout.verticalSpacing = 0;
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- //margins are handled in CSS
- rootPane.setLayout(layout);
- }
- }
- else {
- rootPane = getUiEnvironment().getFormToolkit().createComposite(parent);
- setUiContainer(rootPane);
- //
- layout.horizontalSpacing = 0;
- layout.verticalSpacing = 0;
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- rootPane.setLayout(layout);
- }
- return rootPane;
- }
-
- @Override
- protected void attachScout() {
- super.attachScout();
- updateBackgroundImageFromScout();
- updateBackgroundImageHorizontalAlignFromScout();
- updateBackgroundImageVerticalAlignFromScout();
- setExpandedFromScout();
- }
-
- protected void setExpandedFromScout() {
- if (getScoutObject().isExpandable()) {
- if (m_section != null) {
- //only if necessary
- if (m_section.isExpanded() != getScoutObject().isExpanded()) {
- m_section.setExpanded(getScoutObject().isExpanded());
- }
- }
- }
- }
-
- @Override
- protected void setEnabledFromScout(boolean b) {
- // deactivated
- }
-
- // override to set outer border to line border
- @Override
- protected void setLabelFromScout(String s) {
- if (s == null) {
- s = "";
- }
- if (m_section != null) {
- m_section.setText(s);
- m_section.layout(true, true);
- }
- if (m_group != null) {
- m_group.setText(s);
- }
- if (m_label != null && m_line != null) {
- m_label.setText(s);
- if (StringUtility.hasText(s)) {
- ((GridData) m_label.getLayoutData()).exclude = false;
- m_label.setVisible(true);
- ((GridData) m_line.getLayoutData()).exclude = false;
- m_line.setVisible(true);
- }
- else {
- ((GridData) m_label.getLayoutData()).exclude = true;
- m_label.setVisible(false);
-
- //Exclude the line too if border decoration is set to auto. If it's explicitly set to line it must not be excluded
- if (IGroupBox.BORDER_DECORATION_AUTO.equals(getScoutObject().getBorderDecoration())) {
- ((GridData) m_line.getLayoutData()).exclude = true;
- m_line.setVisible(false);
- }
- }
- }
- }
-
- protected void updateBackgroundImageFromScout() {
- String imageName = getScoutObject().getBackgroundImageName();
- if (imageName == m_containerImage || imageName != null && imageName.equals(m_containerImage)) {
- // nop
- }
- else {
- m_containerImage = imageName;
- installUiContainerBorder();
- }
- }
-
- protected void updateBackgroundImageHorizontalAlignFromScout() {
- // not implemented
- }
-
- protected void updateBackgroundImageVerticalAlignFromScout() {
- // not implemented
- }
-
- private void installUiContainerBorder() {
- }
-
- /**
- * scout property observer
- */
- @Override
- protected void handleScoutPropertyChange(String name, Object newValue) {
- super.handleScoutPropertyChange(name, newValue);
- if (name.equals(IGroupBox.PROP_EXPANDED)) {
- setExpandedFromScout();
- }
- else if (name.equals(IGroupBox.PROP_BACKGROUND_IMAGE_NAME)) {
- updateBackgroundImageFromScout();
- }
- else if (name.equals(IGroupBox.PROP_BACKGROUND_IMAGE_HORIZONTAL_ALIGNMENT)) {
- updateBackgroundImageHorizontalAlignFromScout();
- }
- else if (name.equals(IGroupBox.PROP_BACKGROUND_IMAGE_VERTICAL_ALIGNMENT)) {
- updateBackgroundImageVerticalAlignFromScout();
- }
- }
-
- protected void handleUiGroupBoxExpanded(final boolean expanded) {
- //notify Scout
- Runnable t = new Runnable() {
- @Override
- public void run() {
- getScoutObject().getUIFacade().setExpandedFromUI(expanded);
- }
- };
- getUiEnvironment().invokeScoutLater(t, 0);
- //end notify
- }
-
- @Override
- protected void setBackgroundFromScout(String scoutColor) {
- setBackgroundFromScout(scoutColor, getUiContainer());
- }
-
- private class P_ExpansionListener extends ExpansionAdapter {
- @Override
- public void expansionStateChanged(ExpansionEvent e) {
- handleUiGroupBoxExpanded(e.getState());
- }
- } // end class P_ExpansionListener
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.form.fields.groupbox;
+
+import org.eclipse.rwt.lifecycle.WidgetUtil;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox;
+import org.eclipse.scout.rt.client.ui.form.fields.tabbox.ITabBox;
+import org.eclipse.scout.rt.ui.rap.DefaultValidateRoot;
+import org.eclipse.scout.rt.ui.rap.IValidateRoot;
+import org.eclipse.scout.rt.ui.rap.LogicalGridLayout;
+import org.eclipse.scout.rt.ui.rap.extension.IUiDecoration;
+import org.eclipse.scout.rt.ui.rap.extension.UiDecorationExtensionPoint;
+import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
+import org.eclipse.scout.rt.ui.rap.form.fields.RwtScoutFieldComposite;
+import org.eclipse.scout.rt.ui.rap.form.fields.RwtScoutFormFieldGridData;
+import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.ScrolledComposite;
+import org.eclipse.swt.events.ControlAdapter;
+import org.eclipse.swt.events.ControlEvent;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.forms.events.ExpansionAdapter;
+import org.eclipse.ui.forms.events.ExpansionEvent;
+import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.ui.forms.widgets.SizeCache;
+
+/**
+ * <h3>RwtScoutGroupBox</h3>
+ */
+public class RwtScoutGroupBox extends RwtScoutFieldComposite<IGroupBox> implements IRwtScoutGroupBox {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(RwtScoutGroupBox.class);
+
+ static final String VARIANT_GROUP_BOX_WITH_LINE_FRAME_CONTAINER = "groupBoxWithLineFrameContainer";
+ static final String VARIANT_GROUP_BOX_WITH_LINE_FRAME = "groupBoxWithLineFrame";
+ static final String VARIANT_LABEL = "GroupBoxLabel";
+ static final String VARIANT_LINE = "GroupBoxLine";
+
+ public static class BorderDecoration {
+ /**
+ * whether there is a border at all (false: panel is simply for grouping of fields)
+ */
+ public boolean visible;
+ /**
+ * one of the IGroupBox.BORDER_DECORATION_* values
+ */
+ public String decoration;
+ }
+
+ /**
+ * is null if the group box is not a scrolled group box
+ */
+ private ScrolledComposite m_scrolledComposite;
+ private Section m_section;
+ private Group m_group;
+ private Label m_label;
+ private Label m_line;
+ private Composite m_bodyPart;
+ private RwtScoutGroupBoxButtonbar m_buttonbar;
+ // cache
+ private BorderDecoration m_borderDecoration;
+ private String m_containerLabel;
+ private String m_containerImage;
+ private SizeCache m_sizeCache;
+
+ @Override
+ protected void initializeUi(Composite parent) {
+ m_borderDecoration = resolveBorderDecoration();
+ Composite rootPane = createContainer(parent);
+ if (getScoutObject().isScrollable()) {
+ m_scrolledComposite = new ScrolledComposite(rootPane, SWT.V_SCROLL);
+ m_bodyPart = getUiEnvironment().getFormToolkit().createComposite(m_scrolledComposite);
+ m_scrolledComposite.setContent(m_bodyPart);
+ m_scrolledComposite.setExpandHorizontal(true);
+ m_scrolledComposite.setExpandVertical(true);
+
+ //Mainly necessary to better support finger scrolling.
+ //If the flag is not set rap tries to scroll to the top of the page. This makes scrolling of scrolled composites or listboxes impossible if they are located inside a form (not fullscreen).
+ m_scrolledComposite.setShowFocusedControl(true);
+
+ GridData bodyData = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL);
+ bodyData.horizontalIndent = 0;
+ bodyData.verticalIndent = 0;
+ m_scrolledComposite.setLayoutData(bodyData);
+ m_scrolledComposite.addControlListener(new ControlAdapter() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void controlResized(ControlEvent e) {
+ if (m_scrolledComposite != null && !m_scrolledComposite.isDisposed()) {
+ m_scrolledComposite.setMinSize(computeScrolledCompositeMinSize(false));
+ }
+ }
+ });
+ }
+ else {
+ m_bodyPart = getUiEnvironment().getFormToolkit().createComposite(rootPane);
+ GridData bodyData = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL);
+ bodyData.horizontalIndent = 0;
+ bodyData.verticalIndent = 0;
+ m_bodyPart.setLayoutData(bodyData);
+ }
+ m_bodyPart.setData(IValidateRoot.VALIDATE_ROOT_DATA, new DefaultValidateRoot(m_bodyPart) {
+ @Override
+ public void validate() {
+ super.validate();
+ if (m_scrolledComposite != null && !m_scrolledComposite.isDisposed()) {
+ m_scrolledComposite.setMinSize(computeScrolledCompositeMinSize(true));
+ }
+ }
+ });
+ if (getScoutObject().getCustomProcessButtonCount() + getScoutObject().getSystemProcessButtonCount() > 0) {
+ createButtonbar(rootPane);
+ }
+ IUiDecoration deco = UiDecorationExtensionPoint.getLookAndFeel();
+ LogicalGridLayout bodyLayout = new LogicalGridLayout(deco.getLogicalGridLayoutHorizontalGap(), deco.getLogicalGridLayoutVerticalGap());
+ m_bodyPart.setLayout(bodyLayout);
+ installUiContainerBorder();
+ // FIELDS:
+ IFormField[] scoutFields = getScoutObject().getControlFields();
+ for (IFormField field : scoutFields) {
+ IRwtScoutFormField uiScoutComposite = getUiEnvironment().createFormField(m_bodyPart, field);
+ RwtScoutFormFieldGridData layoutData = new RwtScoutFormFieldGridData(field);
+ uiScoutComposite.getUiContainer().setLayoutData(layoutData);
+ }
+ }
+
+ /**
+ * Computes the preferred size of the {@link #m_bodyPart}, inspired by the class SharedScrolledComposite.
+ */
+ private Point computeScrolledCompositeMinSize(boolean flushCache) {
+ if (m_sizeCache == null) {
+ m_sizeCache = new SizeCache();
+ }
+
+ m_sizeCache.setControl(m_bodyPart);
+ if (flushCache) {
+ m_sizeCache.flush();
+ }
+
+ return m_sizeCache.computeSize(m_scrolledComposite.getClientArea().width, SWT.DEFAULT);
+ }
+
+ protected Composite createButtonbar(Composite parent) {
+ m_buttonbar = new RwtScoutGroupBoxButtonbar();
+ m_buttonbar.createUiField(parent, getScoutObject(), getUiEnvironment());
+ GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
+ m_buttonbar.getUiContainer().setLayoutData(data);
+ return m_buttonbar.getUiContainer();
+ }
+
+ protected BorderDecoration resolveBorderDecoration() {
+ IGroupBox box = getScoutObject();
+ BorderDecoration deco = new BorderDecoration();
+ deco.visible = box.isBorderVisible();
+ deco.decoration = IGroupBox.BORDER_DECORATION_EMPTY;
+ if (IGroupBox.BORDER_DECORATION_SECTION.equals(box.getBorderDecoration())) {
+ deco.decoration = IGroupBox.BORDER_DECORATION_SECTION;
+ }
+ else if (IGroupBox.BORDER_DECORATION_LINE.equals(box.getBorderDecoration())) {
+ deco.decoration = IGroupBox.BORDER_DECORATION_LINE;
+ }
+ else if (IGroupBox.BORDER_DECORATION_EMPTY.equals(box.getBorderDecoration())) {
+ deco.decoration = IGroupBox.BORDER_DECORATION_EMPTY;
+ }
+ else if (!IGroupBox.BORDER_DECORATION_AUTO.equals(box.getBorderDecoration())) {
+ deco.decoration = IGroupBox.BORDER_DECORATION_EMPTY;
+ }
+ else {
+ resolveBorderDecorationAuto(box, deco);
+ }
+ return deco;
+ }
+
+ protected void resolveBorderDecorationAuto(IGroupBox box, BorderDecoration deco) {
+ if (box.isExpandable()) {
+ deco.decoration = IGroupBox.BORDER_DECORATION_SECTION;
+ }
+ else if (box.isMainBox()) {
+ if (UiDecorationExtensionPoint.getLookAndFeel().isFormMainBoxBorderVisible()) {
+ deco.decoration = IGroupBox.BORDER_DECORATION_EMPTY;
+ }
+ deco.visible = false;
+ }
+ else if (box.getParentField() instanceof ITabBox) {
+ deco.decoration = IGroupBox.BORDER_DECORATION_EMPTY;
+ }
+ else {
+ deco.decoration = IGroupBox.BORDER_DECORATION_LINE;
+ }
+ }
+
+ protected Composite createContainer(Composite parent) {
+ Composite rootPane;
+ GridLayout layout = new GridLayout(1, true);
+ setUiLabel(null);
+ //
+ if (m_borderDecoration.visible) {
+ if (IGroupBox.BORDER_DECORATION_SECTION.equals(m_borderDecoration.decoration)) {
+ // section
+ int style = (getScoutObject().isExpanded() ? Section.EXPANDED : 0) | Section.TITLE_BAR;
+ if (getScoutObject().isExpandable()) {
+ style |= Section.TWISTIE;
+ }
+ m_section = getUiEnvironment().getFormToolkit().createSection(parent, style);
+ String label = getScoutObject().getLabel();
+ if (label == null) {
+ label = "";
+ }
+ m_section.setText(label);
+ m_section.addExpansionListener(new P_ExpansionListener());
+ setUiContainer(m_section);
+ //
+ rootPane = getUiEnvironment().getFormToolkit().createSectionClient(m_section);
+ m_section.setClient(rootPane);
+ layout.horizontalSpacing = 0;
+ layout.verticalSpacing = 0;
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ layout.marginTop = 5;
+ layout.marginRight = 7;
+ layout.marginBottom = 5;
+ layout.marginLeft = 5;
+ //margins are NOT handled in CSS
+ rootPane.setLayout(layout);
+ }
+ else if (IGroupBox.BORDER_DECORATION_LINE.equals(m_borderDecoration.decoration)) {
+ Composite groupComp = getUiEnvironment().getFormToolkit().createComposite(parent, SWT.NONE);
+ groupComp.setData(WidgetUtil.CUSTOM_VARIANT, VARIANT_GROUP_BOX_WITH_LINE_FRAME_CONTAINER);
+ m_label = getUiEnvironment().getFormToolkit().createLabel(groupComp, "", SWT.NONE);
+ m_label.setData(WidgetUtil.CUSTOM_VARIANT, VARIANT_LABEL);
+ m_line = getUiEnvironment().getFormToolkit().createLabel(groupComp, "", SWT.NONE);
+ m_line.setData(WidgetUtil.CUSTOM_VARIANT, VARIANT_LINE);
+ rootPane = getUiEnvironment().getFormToolkit().createComposite(groupComp, SWT.NONE);
+ rootPane.setData(WidgetUtil.CUSTOM_VARIANT, VARIANT_GROUP_BOX_WITH_LINE_FRAME);
+ setUiContainer(groupComp);
+ //
+ GridLayout groupCompLayout = new GridLayout(1, false);
+ groupCompLayout.horizontalSpacing = 0;
+ groupCompLayout.marginHeight = 0;
+ groupCompLayout.marginWidth = 0;
+ groupCompLayout.verticalSpacing = 0;
+ groupComp.setLayout(groupCompLayout);
+
+ GridData labelLayoutData = new GridData();
+ labelLayoutData.horizontalIndent = 14;
+ m_label.setLayoutData(labelLayoutData);
+
+ GridData lineLayoutData = new GridData(GridData.FILL_HORIZONTAL);
+ lineLayoutData.heightHint = 1;
+ m_line.setLayoutData(lineLayoutData);
+
+ GridData groupLayoutData = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
+ rootPane.setLayoutData(groupLayoutData);
+
+ layout.horizontalSpacing = 0;
+ layout.verticalSpacing = 0;
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ //margins are handled in CSS
+ rootPane.setLayout(layout);
+ }
+ else {
+ // empty
+ Group emptyGroup = getUiEnvironment().getFormToolkit().createGroup(parent, 0/* SWT.SHADOW_ETCHED_IN*/);
+ rootPane = emptyGroup;
+ rootPane.setData(WidgetUtil.CUSTOM_VARIANT, RwtUtility.VARIANT_EMPTY);
+ setUiContainer(rootPane);
+ //
+ layout.horizontalSpacing = 0;
+ layout.verticalSpacing = 0;
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ //margins are handled in CSS
+ rootPane.setLayout(layout);
+ }
+ }
+ else {
+ rootPane = getUiEnvironment().getFormToolkit().createComposite(parent);
+ setUiContainer(rootPane);
+ //
+ layout.horizontalSpacing = 0;
+ layout.verticalSpacing = 0;
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ rootPane.setLayout(layout);
+ }
+ return rootPane;
+ }
+
+ @Override
+ protected void attachScout() {
+ super.attachScout();
+ updateBackgroundImageFromScout();
+ updateBackgroundImageHorizontalAlignFromScout();
+ updateBackgroundImageVerticalAlignFromScout();
+ setExpandedFromScout();
+ }
+
+ protected void setExpandedFromScout() {
+ if (getScoutObject().isExpandable()) {
+ if (m_section != null) {
+ //only if necessary
+ if (m_section.isExpanded() != getScoutObject().isExpanded()) {
+ m_section.setExpanded(getScoutObject().isExpanded());
+ }
+ }
+ }
+ }
+
+ @Override
+ protected void setEnabledFromScout(boolean b) {
+ // deactivated
+ }
+
+ // override to set outer border to line border
+ @Override
+ protected void setLabelFromScout(String s) {
+ if (s == null) {
+ s = "";
+ }
+ if (m_section != null) {
+ m_section.setText(s);
+ m_section.layout(true, true);
+ }
+ if (m_group != null) {
+ m_group.setText(s);
+ }
+ if (m_label != null && m_line != null) {
+ m_label.setText(s);
+ if (StringUtility.hasText(s)) {
+ ((GridData) m_label.getLayoutData()).exclude = false;
+ m_label.setVisible(true);
+ ((GridData) m_line.getLayoutData()).exclude = false;
+ m_line.setVisible(true);
+ }
+ else {
+ ((GridData) m_label.getLayoutData()).exclude = true;
+ m_label.setVisible(false);
+
+ //Exclude the line too if border decoration is set to auto. If it's explicitly set to line it must not be excluded
+ if (IGroupBox.BORDER_DECORATION_AUTO.equals(getScoutObject().getBorderDecoration())) {
+ ((GridData) m_line.getLayoutData()).exclude = true;
+ m_line.setVisible(false);
+ }
+ }
+ }
+ }
+
+ protected void updateBackgroundImageFromScout() {
+ String imageName = getScoutObject().getBackgroundImageName();
+ if (imageName == m_containerImage || imageName != null && imageName.equals(m_containerImage)) {
+ // nop
+ }
+ else {
+ m_containerImage = imageName;
+ installUiContainerBorder();
+ }
+ }
+
+ protected void updateBackgroundImageHorizontalAlignFromScout() {
+ // not implemented
+ }
+
+ protected void updateBackgroundImageVerticalAlignFromScout() {
+ // not implemented
+ }
+
+ private void installUiContainerBorder() {
+ }
+
+ /**
+ * scout property observer
+ */
+ @Override
+ protected void handleScoutPropertyChange(String name, Object newValue) {
+ super.handleScoutPropertyChange(name, newValue);
+ if (name.equals(IGroupBox.PROP_EXPANDED)) {
+ setExpandedFromScout();
+ }
+ else if (name.equals(IGroupBox.PROP_BACKGROUND_IMAGE_NAME)) {
+ updateBackgroundImageFromScout();
+ }
+ else if (name.equals(IGroupBox.PROP_BACKGROUND_IMAGE_HORIZONTAL_ALIGNMENT)) {
+ updateBackgroundImageHorizontalAlignFromScout();
+ }
+ else if (name.equals(IGroupBox.PROP_BACKGROUND_IMAGE_VERTICAL_ALIGNMENT)) {
+ updateBackgroundImageVerticalAlignFromScout();
+ }
+ }
+
+ protected void handleUiGroupBoxExpanded(final boolean expanded) {
+ //notify Scout
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ getScoutObject().getUIFacade().setExpandedFromUI(expanded);
+ }
+ };
+ getUiEnvironment().invokeScoutLater(t, 0);
+ //end notify
+ }
+
+ @Override
+ protected void setBackgroundFromScout(String scoutColor) {
+ setBackgroundFromScout(scoutColor, getUiContainer());
+ }
+
+ private class P_ExpansionListener extends ExpansionAdapter {
+ @Override
+ public void expansionStateChanged(ExpansionEvent e) {
+ handleUiGroupBoxExpanded(e.getState());
+ }
+ } // end class P_ExpansionListener
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/groupbox/RwtScoutGroupBoxButtonbar.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/groupbox/RwtScoutGroupBoxButtonbar.java
index f34b50fb52..0f5b79fe83 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/groupbox/RwtScoutGroupBoxButtonbar.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/groupbox/RwtScoutGroupBoxButtonbar.java
@@ -1,119 +1,119 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.form.fields.groupbox;
-
-import org.eclipse.rwt.lifecycle.WidgetUtil;
-import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
-import org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox;
-import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
-import org.eclipse.scout.rt.ui.rap.form.fields.groupbox.layout.ButtonBarLayout;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-public class RwtScoutGroupBoxButtonbar implements IRwtScoutGroupBoxButtonbar {
-
- static final String VARIANT_GROUP_BOX_BUTTON_BAR = "groupBoxButtonBar";
- private boolean m_created;
- private Composite m_container;
- private Composite m_leftPart;
- private Composite m_rightPart;
- private IRwtEnvironment m_uiEnvironment;
- private IGroupBox m_scoutGroupBox;
-
- public RwtScoutGroupBoxButtonbar() {
- }
-
- @Override
- public void createUiField(Composite parent, IGroupBox scoutGroupBox, IRwtEnvironment uiEnvironment) {
- m_scoutGroupBox = scoutGroupBox;
- m_uiEnvironment = (IRwtEnvironment) uiEnvironment;
- m_container = getUiEnvironment().getFormToolkit().createComposite(parent);
- m_container.setData(WidgetUtil.CUSTOM_VARIANT, VARIANT_GROUP_BOX_BUTTON_BAR);
- m_leftPart = getUiEnvironment().getFormToolkit().createComposite(m_container);
- m_rightPart = getUiEnvironment().getFormToolkit().createComposite(m_container);
-
- // layout
- GridLayout buttonBarLayout = new GridLayout(3, false);
- buttonBarLayout.horizontalSpacing = 0;
- buttonBarLayout.verticalSpacing = 0;
- buttonBarLayout.marginTop = 6;
- buttonBarLayout.marginHeight = 0;
- buttonBarLayout.marginWidth = 0;
- m_container.setLayout(buttonBarLayout);
-
- m_leftPart.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, true, true));
- m_rightPart.setLayoutData(new GridData(SWT.END, SWT.CENTER, true, true));
-
- m_leftPart.setLayout(new ButtonBarLayout(SWT.LEFT));
- m_rightPart.setLayout(new ButtonBarLayout(SWT.RIGHT));
-
- // init buttons
- //XXX [imo] add ui listener for invisible to make bar invisible when all buttons invisible
- for (IButton b : getScoutObject().getCustomProcessButtons()) {
- // alignment
- if (b.getGridData().horizontalAlignment <= 0) {
- getUiEnvironment().createFormField(m_leftPart, b);
- }
- else {
- getUiEnvironment().createFormField(m_rightPart, b);
- }
- }
- for (IButton b : getScoutObject().getSystemProcessButtons()) {
- // alignment
- if (b.getGridData().horizontalAlignment <= 0) {
- getUiEnvironment().createFormField(m_leftPart, b);
- }
- else {
- getUiEnvironment().createFormField(m_rightPart, b);
- }
- }
- m_created = true;
- }
-
- @Override
- public IGroupBox getScoutObject() {
- return m_scoutGroupBox;
- }
-
- @Override
- public Composite getUiContainer() {
- return m_container;
- }
-
- @Override
- public IRwtEnvironment getUiEnvironment() {
- return m_uiEnvironment;
- }
-
- @Override
- public Control getUiField() {
- return null;
- }
-
- @Override
- public boolean isUiDisposed() {
- return getUiContainer() == null || getUiContainer().isDisposed();
- }
-
- @Override
- public boolean isCreated() {
- return m_created;
- }
-
- @Override
- public void dispose() {
- m_created = false;
- getUiContainer().dispose();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.form.fields.groupbox;
+
+import org.eclipse.rwt.lifecycle.WidgetUtil;
+import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
+import org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox;
+import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
+import org.eclipse.scout.rt.ui.rap.form.fields.groupbox.layout.ButtonBarLayout;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+public class RwtScoutGroupBoxButtonbar implements IRwtScoutGroupBoxButtonbar {
+
+ static final String VARIANT_GROUP_BOX_BUTTON_BAR = "groupBoxButtonBar";
+ private boolean m_created;
+ private Composite m_container;
+ private Composite m_leftPart;
+ private Composite m_rightPart;
+ private IRwtEnvironment m_uiEnvironment;
+ private IGroupBox m_scoutGroupBox;
+
+ public RwtScoutGroupBoxButtonbar() {
+ }
+
+ @Override
+ public void createUiField(Composite parent, IGroupBox scoutGroupBox, IRwtEnvironment uiEnvironment) {
+ m_scoutGroupBox = scoutGroupBox;
+ m_uiEnvironment = (IRwtEnvironment) uiEnvironment;
+ m_container = getUiEnvironment().getFormToolkit().createComposite(parent);
+ m_container.setData(WidgetUtil.CUSTOM_VARIANT, VARIANT_GROUP_BOX_BUTTON_BAR);
+ m_leftPart = getUiEnvironment().getFormToolkit().createComposite(m_container);
+ m_rightPart = getUiEnvironment().getFormToolkit().createComposite(m_container);
+
+ // layout
+ GridLayout buttonBarLayout = new GridLayout(3, false);
+ buttonBarLayout.horizontalSpacing = 0;
+ buttonBarLayout.verticalSpacing = 0;
+ buttonBarLayout.marginTop = 6;
+ buttonBarLayout.marginHeight = 0;
+ buttonBarLayout.marginWidth = 0;
+ m_container.setLayout(buttonBarLayout);
+
+ m_leftPart.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, true, true));
+ m_rightPart.setLayoutData(new GridData(SWT.END, SWT.CENTER, true, true));
+
+ m_leftPart.setLayout(new ButtonBarLayout(SWT.LEFT));
+ m_rightPart.setLayout(new ButtonBarLayout(SWT.RIGHT));
+
+ // init buttons
+ //XXX [imo] add ui listener for invisible to make bar invisible when all buttons invisible
+ for (IButton b : getScoutObject().getCustomProcessButtons()) {
+ // alignment
+ if (b.getGridData().horizontalAlignment <= 0) {
+ getUiEnvironment().createFormField(m_leftPart, b);
+ }
+ else {
+ getUiEnvironment().createFormField(m_rightPart, b);
+ }
+ }
+ for (IButton b : getScoutObject().getSystemProcessButtons()) {
+ // alignment
+ if (b.getGridData().horizontalAlignment <= 0) {
+ getUiEnvironment().createFormField(m_leftPart, b);
+ }
+ else {
+ getUiEnvironment().createFormField(m_rightPart, b);
+ }
+ }
+ m_created = true;
+ }
+
+ @Override
+ public IGroupBox getScoutObject() {
+ return m_scoutGroupBox;
+ }
+
+ @Override
+ public Composite getUiContainer() {
+ return m_container;
+ }
+
+ @Override
+ public IRwtEnvironment getUiEnvironment() {
+ return m_uiEnvironment;
+ }
+
+ @Override
+ public Control getUiField() {
+ return null;
+ }
+
+ @Override
+ public boolean isUiDisposed() {
+ return getUiContainer() == null || getUiContainer().isDisposed();
+ }
+
+ @Override
+ public boolean isCreated() {
+ return m_created;
+ }
+
+ @Override
+ public void dispose() {
+ m_created = false;
+ getUiContainer().dispose();
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/groupbox/layout/ButtonBarLayout.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/groupbox/layout/ButtonBarLayout.java
index e87c17f08b..106455fbb2 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/groupbox/layout/ButtonBarLayout.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/groupbox/layout/ButtonBarLayout.java
@@ -1,180 +1,180 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.form.fields.groupbox.layout;
-
-import org.eclipse.scout.rt.ui.rap.extension.UiDecorationExtensionPoint;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Layout;
-
-/**
- * <h3>ButtonBarLayout</h3> ...
- *
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.form.fields.groupbox.layout;
+
+import org.eclipse.scout.rt.ui.rap.extension.UiDecorationExtensionPoint;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Layout;
+
+/**
+ * <h3>ButtonBarLayout</h3> ...
+ *
* @since 3.7.0 June 2011
- */
-public class ButtonBarLayout extends Layout {
- private static final long serialVersionUID = 1L;
-
- private final int m_style;
- public int verticalGap;
- public int horizontalGap;
-
- public ButtonBarLayout(int style) {
- m_style = style;
- verticalGap = 4;
- horizontalGap = 4;
- }
-
- @Override
- protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache) {
- Point size = new Point(0, 0);
- for (Control c : composite.getChildren()) {
- if (c.getVisible()) {
- Point cSize = c.computeSize(SWT.DEFAULT, SWT.DEFAULT, flushCache);
- cSize.x += 15;
- cSize.x = Math.max(cSize.x, UiDecorationExtensionPoint.getLookAndFeel().getProcessButtonMinWidth());
- cSize.y = Math.max(UiDecorationExtensionPoint.getLookAndFeel().getProcessButtonHeight(), cSize.y);
- cSize = addInsets(c, cSize);
- size.x += (cSize.x + horizontalGap);
- size.y = Math.max(cSize.y, size.y);
- }
- }
- //WORKAROUND for bug in swt composite setting size to 64x64 when 0,0
- if (size.x <= 0) {
- size.x = 1;
- }
- if (size.y <= 0) {
- size.y = 1;
- }
- //end
- return size;
- }
-
- private Point addInsets(Control c, Point size) {
- Object data = c.getLayoutData();
- if (data instanceof ButtonBarLayoutData) {
- ButtonBarLayoutData ld = (ButtonBarLayoutData) data;
- size.x += (ld.insetLeft + ld.insetRight);
- size.y += (ld.insetTop + ld.insetBottom);
- }
- return size;
- }
-
- private ButtonBarLayoutData getLayoutData(Control c) {
- Object data = c.getLayoutData();
- if (!(data instanceof ButtonBarLayoutData)) {
- data = new ButtonBarLayoutData();
- }
- return (ButtonBarLayoutData) data;
- }
-
- @Override
- protected void layout(Composite composite, boolean flushCache) {
- if ((m_style & SWT.RIGHT) != 0) {
- layoutRight(composite);
- }
- else {
- layoutLeft(composite);
- }
- }
-
- protected void layoutRight(Composite composite) {
- Control[] children = composite.getChildren();
- Rectangle clientArea = composite.getClientArea();
- int fillCount = 0;
- int excessWidth = clientArea.width;
- for (int i = 0; i < children.length; i++) {
- if (children[i].getVisible()) {
- ButtonBarLayoutData layoutData = getLayoutData(children[i]);
- if (layoutData.fillHorizontal) {
- fillCount++;
- }
- Point prefSize = children[i].computeSize(SWT.DEFAULT, SWT.DEFAULT, false);
- prefSize.x += 15;
- int width = Math.max(UiDecorationExtensionPoint.getLookAndFeel().getProcessButtonMinWidth(), prefSize.x);
- if (i > 0) {
- excessWidth -= horizontalGap;
- }
- excessWidth -= (width + layoutData.insetLeft + layoutData.insetRight);
- }
- }
- //
- int x = clientArea.x + clientArea.width;
- int y = clientArea.y;
- for (int i = children.length - 1; i >= 0; i--) {
- if (children[i].getVisible()) {
- ButtonBarLayoutData layoutData = getLayoutData(children[i]);
- Point prefSize = children[i].computeSize(SWT.DEFAULT, SWT.DEFAULT, false);
- prefSize.x += 15;
- int width = Math.max(UiDecorationExtensionPoint.getLookAndFeel().getProcessButtonMinWidth(), prefSize.x);
- int height = Math.max(UiDecorationExtensionPoint.getLookAndFeel().getProcessButtonHeight(), prefSize.y);
- if (layoutData.fillHorizontal) {
- if (fillCount > 0 && excessWidth > 0) {
- int delta = excessWidth / fillCount;
- width += delta;
- excessWidth -= delta;
- fillCount--;
- }
- }
- Rectangle bounds = new Rectangle(x - (width + layoutData.insetRight), y + layoutData.insetTop, width, height);
- children[i].setBounds(bounds);
- x -= (width + horizontalGap + layoutData.insetLeft + layoutData.insetRight);
- }
- }
- }
-
- protected void layoutLeft(Composite composite) {
- Control[] children = composite.getChildren();
- Rectangle clientArea = composite.getClientArea();
- int fillCount = 0;
- int excessWidth = clientArea.width;
- for (int i = 0; i < children.length; i++) {
- if (children[i].getVisible()) {
- ButtonBarLayoutData layoutData = getLayoutData(children[i]);
- if (layoutData.fillHorizontal) {
- fillCount++;
- }
- Point prefSize = children[i].computeSize(SWT.DEFAULT, SWT.DEFAULT, false);
- prefSize.x += 15;
- int width = Math.max(UiDecorationExtensionPoint.getLookAndFeel().getProcessButtonMinWidth(), prefSize.x);
- if (i > 0) {
- excessWidth -= horizontalGap;
- }
- excessWidth -= (width + layoutData.insetLeft + layoutData.insetRight);
- }
- }
- //
- int x = clientArea.x;
- int y = clientArea.y;
- for (Control element : children) {
- if (element.getVisible()) {
- ButtonBarLayoutData layoutData = getLayoutData(element);
- Point prefSize = element.computeSize(SWT.DEFAULT, SWT.DEFAULT, false);
- prefSize.x += 15;
- int width = Math.max(UiDecorationExtensionPoint.getLookAndFeel().getProcessButtonMinWidth(), prefSize.x);
- int height = Math.max(UiDecorationExtensionPoint.getLookAndFeel().getProcessButtonHeight(), prefSize.y);
- if (layoutData.fillHorizontal) {
- if (fillCount > 0 && excessWidth > 0) {
- int delta = excessWidth / fillCount;
- width += delta;
- excessWidth -= delta;
- fillCount--;
- }
- }
- element.setBounds(x + layoutData.insetLeft, y + layoutData.insetTop, width, height);
- x += (width + horizontalGap + layoutData.insetLeft + layoutData.insetRight);
- }
- }
- }
-}
+ */
+public class ButtonBarLayout extends Layout {
+ private static final long serialVersionUID = 1L;
+
+ private final int m_style;
+ public int verticalGap;
+ public int horizontalGap;
+
+ public ButtonBarLayout(int style) {
+ m_style = style;
+ verticalGap = 4;
+ horizontalGap = 4;
+ }
+
+ @Override
+ protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache) {
+ Point size = new Point(0, 0);
+ for (Control c : composite.getChildren()) {
+ if (c.getVisible()) {
+ Point cSize = c.computeSize(SWT.DEFAULT, SWT.DEFAULT, flushCache);
+ cSize.x += 15;
+ cSize.x = Math.max(cSize.x, UiDecorationExtensionPoint.getLookAndFeel().getProcessButtonMinWidth());
+ cSize.y = Math.max(UiDecorationExtensionPoint.getLookAndFeel().getProcessButtonHeight(), cSize.y);
+ cSize = addInsets(c, cSize);
+ size.x += (cSize.x + horizontalGap);
+ size.y = Math.max(cSize.y, size.y);
+ }
+ }
+ //WORKAROUND for bug in swt composite setting size to 64x64 when 0,0
+ if (size.x <= 0) {
+ size.x = 1;
+ }
+ if (size.y <= 0) {
+ size.y = 1;
+ }
+ //end
+ return size;
+ }
+
+ private Point addInsets(Control c, Point size) {
+ Object data = c.getLayoutData();
+ if (data instanceof ButtonBarLayoutData) {
+ ButtonBarLayoutData ld = (ButtonBarLayoutData) data;
+ size.x += (ld.insetLeft + ld.insetRight);
+ size.y += (ld.insetTop + ld.insetBottom);
+ }
+ return size;
+ }
+
+ private ButtonBarLayoutData getLayoutData(Control c) {
+ Object data = c.getLayoutData();
+ if (!(data instanceof ButtonBarLayoutData)) {
+ data = new ButtonBarLayoutData();
+ }
+ return (ButtonBarLayoutData) data;
+ }
+
+ @Override
+ protected void layout(Composite composite, boolean flushCache) {
+ if ((m_style & SWT.RIGHT) != 0) {
+ layoutRight(composite);
+ }
+ else {
+ layoutLeft(composite);
+ }
+ }
+
+ protected void layoutRight(Composite composite) {
+ Control[] children = composite.getChildren();
+ Rectangle clientArea = composite.getClientArea();
+ int fillCount = 0;
+ int excessWidth = clientArea.width;
+ for (int i = 0; i < children.length; i++) {
+ if (children[i].getVisible()) {
+ ButtonBarLayoutData layoutData = getLayoutData(children[i]);
+ if (layoutData.fillHorizontal) {
+ fillCount++;
+ }
+ Point prefSize = children[i].computeSize(SWT.DEFAULT, SWT.DEFAULT, false);
+ prefSize.x += 15;
+ int width = Math.max(UiDecorationExtensionPoint.getLookAndFeel().getProcessButtonMinWidth(), prefSize.x);
+ if (i > 0) {
+ excessWidth -= horizontalGap;
+ }
+ excessWidth -= (width + layoutData.insetLeft + layoutData.insetRight);
+ }
+ }
+ //
+ int x = clientArea.x + clientArea.width;
+ int y = clientArea.y;
+ for (int i = children.length - 1; i >= 0; i--) {
+ if (children[i].getVisible()) {
+ ButtonBarLayoutData layoutData = getLayoutData(children[i]);
+ Point prefSize = children[i].computeSize(SWT.DEFAULT, SWT.DEFAULT, false);
+ prefSize.x += 15;
+ int width = Math.max(UiDecorationExtensionPoint.getLookAndFeel().getProcessButtonMinWidth(), prefSize.x);
+ int height = Math.max(UiDecorationExtensionPoint.getLookAndFeel().getProcessButtonHeight(), prefSize.y);
+ if (layoutData.fillHorizontal) {
+ if (fillCount > 0 && excessWidth > 0) {
+ int delta = excessWidth / fillCount;
+ width += delta;
+ excessWidth -= delta;
+ fillCount--;
+ }
+ }
+ Rectangle bounds = new Rectangle(x - (width + layoutData.insetRight), y + layoutData.insetTop, width, height);
+ children[i].setBounds(bounds);
+ x -= (width + horizontalGap + layoutData.insetLeft + layoutData.insetRight);
+ }
+ }
+ }
+
+ protected void layoutLeft(Composite composite) {
+ Control[] children = composite.getChildren();
+ Rectangle clientArea = composite.getClientArea();
+ int fillCount = 0;
+ int excessWidth = clientArea.width;
+ for (int i = 0; i < children.length; i++) {
+ if (children[i].getVisible()) {
+ ButtonBarLayoutData layoutData = getLayoutData(children[i]);
+ if (layoutData.fillHorizontal) {
+ fillCount++;
+ }
+ Point prefSize = children[i].computeSize(SWT.DEFAULT, SWT.DEFAULT, false);
+ prefSize.x += 15;
+ int width = Math.max(UiDecorationExtensionPoint.getLookAndFeel().getProcessButtonMinWidth(), prefSize.x);
+ if (i > 0) {
+ excessWidth -= horizontalGap;
+ }
+ excessWidth -= (width + layoutData.insetLeft + layoutData.insetRight);
+ }
+ }
+ //
+ int x = clientArea.x;
+ int y = clientArea.y;
+ for (Control element : children) {
+ if (element.getVisible()) {
+ ButtonBarLayoutData layoutData = getLayoutData(element);
+ Point prefSize = element.computeSize(SWT.DEFAULT, SWT.DEFAULT, false);
+ prefSize.x += 15;
+ int width = Math.max(UiDecorationExtensionPoint.getLookAndFeel().getProcessButtonMinWidth(), prefSize.x);
+ int height = Math.max(UiDecorationExtensionPoint.getLookAndFeel().getProcessButtonHeight(), prefSize.y);
+ if (layoutData.fillHorizontal) {
+ if (fillCount > 0 && excessWidth > 0) {
+ int delta = excessWidth / fillCount;
+ width += delta;
+ excessWidth -= delta;
+ fillCount--;
+ }
+ }
+ element.setBounds(x + layoutData.insetLeft, y + layoutData.insetTop, width, height);
+ x += (width + horizontalGap + layoutData.insetLeft + layoutData.insetRight);
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/groupbox/layout/ButtonBarLayoutData.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/groupbox/layout/ButtonBarLayoutData.java
index 1acd9425b6..028416e93d 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/groupbox/layout/ButtonBarLayoutData.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/groupbox/layout/ButtonBarLayoutData.java
@@ -1,27 +1,27 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.form.fields.groupbox.layout;
-
-import org.eclipse.swt.SWT;
-
-public class ButtonBarLayoutData {
- public int insetTop = 0;
- public int insetBottom = 0;
- public int insetLeft = 0;
- public int insetRight = 0;
-
- public boolean fillHorizontal;
- public boolean fillVertical;
-
- public int horizontalAlignment = SWT.NONE;
- public int verticalAlignment = SWT.NONE;
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.form.fields.groupbox.layout;
+
+import org.eclipse.swt.SWT;
+
+public class ButtonBarLayoutData {
+ public int insetTop = 0;
+ public int insetBottom = 0;
+ public int insetLeft = 0;
+ public int insetRight = 0;
+
+ public boolean fillHorizontal;
+ public boolean fillVertical;
+
+ public int horizontalAlignment = SWT.NONE;
+ public int verticalAlignment = SWT.NONE;
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/htmlfield/IRwtScoutHtmlField.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/htmlfield/IRwtScoutHtmlField.java
index db82d6ed32..22fa8877c2 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/htmlfield/IRwtScoutHtmlField.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/htmlfield/IRwtScoutHtmlField.java
@@ -1,26 +1,26 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.form.fields.htmlfield;
-
-import org.eclipse.scout.rt.client.ui.form.fields.htmlfield.IHtmlField;
-import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * <h3>IRwtScoutHtmlField</h3> ...
- *
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.form.fields.htmlfield;
+
+import org.eclipse.scout.rt.client.ui.form.fields.htmlfield.IHtmlField;
+import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * <h3>IRwtScoutHtmlField</h3> ...
+ *
* @since 3.7.0 June 2011
- */
-public interface IRwtScoutHtmlField extends IRwtScoutFormField<IHtmlField> {
-
- @Override
- Composite getUiField();
-}
+ */
+public interface IRwtScoutHtmlField extends IRwtScoutFormField<IHtmlField> {
+
+ @Override
+ Composite getUiField();
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/htmlfield/RwtScoutHtmlField.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/htmlfield/RwtScoutHtmlField.java
index 2445351151..00014ab5d6 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/htmlfield/RwtScoutHtmlField.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/htmlfield/RwtScoutHtmlField.java
@@ -1,173 +1,173 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.form.fields.htmlfield;
-
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.eclipse.rwt.resources.IResourceManager.RegisterOptions;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.TypeCastUtility;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.eclipse.scout.rt.client.ui.form.fields.htmlfield.IHtmlField;
-import org.eclipse.scout.rt.shared.services.common.file.RemoteFile;
-import org.eclipse.scout.rt.ui.rap.LogicalGridLayout;
-import org.eclipse.scout.rt.ui.rap.ext.StatusLabelEx;
-import org.eclipse.scout.rt.ui.rap.ext.browser.BrowserExtension;
-import org.eclipse.scout.rt.ui.rap.form.fields.RwtScoutValueFieldComposite;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.browser.Browser;
-import org.eclipse.swt.browser.LocationAdapter;
-import org.eclipse.swt.browser.LocationEvent;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.widgets.Composite;
-
-public class RwtScoutHtmlField extends RwtScoutValueFieldComposite<IHtmlField> implements IRwtScoutHtmlField {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(RwtScoutHtmlField.class);
-
- private BrowserExtension m_browserExtension;
-
- public RwtScoutHtmlField() {
- }
-
- @Override
- protected void initializeUi(Composite parent) {
- Composite container = getUiEnvironment().getFormToolkit().createComposite(parent);
- StatusLabelEx label = getUiEnvironment().getFormToolkit().createStatusLabel(container, getScoutObject());
-
- Browser browser = getUiEnvironment().getFormToolkit().createBrowser(container, SWT.NONE);
- m_browserExtension = new BrowserExtension(browser);
- m_browserExtension.attach();
- browser.addDisposeListener(new DisposeListener() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void widgetDisposed(DisposeEvent e) {
- m_browserExtension.detach();
- }
- });
- browser.addLocationListener(new LocationAdapter() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void changing(LocationEvent event) {
- URL url = null;
- try {
- url = new URL(event.location);
- }
- catch (MalformedURLException e) {
- try {
- url = new File(event.location).toURI().toURL();
- }
- catch (MalformedURLException e1) {
- e1.printStackTrace();
- }
- }
- if (url != null) {
- event.doit = url.getProtocol().equals("file");
- if (!event.doit) {
- handleUiLinkAction(url);
- }
- }
- }
- });
- //
- setUiContainer(container);
- setUiLabel(label);
- setUiField(browser);
- // layout
- getUiContainer().setLayout(new LogicalGridLayout(1, 0));
-
- }
-
- @Override
- public Browser getUiField() {
- return (Browser) super.getUiField();
- }
-
- protected void handleUiLinkAction(final URL url) {
- Runnable job = new Runnable() {
- @Override
- public void run() {
- getScoutObject().getUIFacade().fireHyperlinkActionFromUI(url);
- }
- };
- getUiEnvironment().invokeScoutLater(job, 0);
- }
-
- @Override
- protected void setEnabledFromScout(boolean b) {
- }
-
- @Override
- protected void setDisplayTextFromScout(String rawHtml) {
- m_browserExtension.clearResourceCache();
- m_browserExtension.clearLocalHyperlinkCache();
- if (rawHtml == null) {
- rawHtml = "";
- }
- // create attachments
- RemoteFile[] a = getScoutObject().getAttachments();
- if (a != null) {
- for (RemoteFile f : a) {
- if (f != null && f.exists()) {
- try {
- m_browserExtension.addResource(f.getPath(), f.getDecompressedInputStream());
- }
- catch (IOException e1) {
- LOG.warn("could not read remote file '" + f.getName() + "'", e1);
- }
- }
- }
- }
- String cleanHtml = getUiEnvironment().styleHtmlText(this, rawHtml);
- cleanHtml = m_browserExtension.adaptLocalHyperlinks(cleanHtml, 1);
- //fast create of browser content if there are no attachments
- if (a == null || a.length == 0) {
- getUiField().setText(cleanHtml);
- }
- else {
- try {
- String indexFile = m_browserExtension.addResource("index.html", new ByteArrayInputStream(cleanHtml.getBytes("UTF-8")), "UTF-8", RegisterOptions.VERSION);
- getUiField().setUrl(indexFile);
- }
- catch (UnsupportedEncodingException e) {
- //can not happen
- }
- }
- }
-
- protected void setScrollToAnchorFromScout(String anchorName) {
- if (!StringUtility.isNullOrEmpty(anchorName)) {
- getUiField().setUrl(getUiField().getUrl() + "#" + anchorName);
- }
- }
-
- /**
- * scout property handler override
- */
- @Override
- protected void handleScoutPropertyChange(String name, Object newValue) {
- super.handleScoutPropertyChange(name, newValue);
- if (name.equals(IHtmlField.PROP_SCROLLBAR_SCROLL_TO_END)) {
- getUiField().execute("window.scrollTo(0, document.body.scrollHeight)");
- }
- else if (name.equals(IHtmlField.PROP_SCROLLBAR_SCROLL_TO_ANCHOR)) {
- setScrollToAnchorFromScout(TypeCastUtility.castValue(newValue, String.class));
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.form.fields.htmlfield;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.eclipse.rwt.resources.IResourceManager.RegisterOptions;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.TypeCastUtility;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.eclipse.scout.rt.client.ui.form.fields.htmlfield.IHtmlField;
+import org.eclipse.scout.rt.shared.services.common.file.RemoteFile;
+import org.eclipse.scout.rt.ui.rap.LogicalGridLayout;
+import org.eclipse.scout.rt.ui.rap.ext.StatusLabelEx;
+import org.eclipse.scout.rt.ui.rap.ext.browser.BrowserExtension;
+import org.eclipse.scout.rt.ui.rap.form.fields.RwtScoutValueFieldComposite;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.browser.Browser;
+import org.eclipse.swt.browser.LocationAdapter;
+import org.eclipse.swt.browser.LocationEvent;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.widgets.Composite;
+
+public class RwtScoutHtmlField extends RwtScoutValueFieldComposite<IHtmlField> implements IRwtScoutHtmlField {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(RwtScoutHtmlField.class);
+
+ private BrowserExtension m_browserExtension;
+
+ public RwtScoutHtmlField() {
+ }
+
+ @Override
+ protected void initializeUi(Composite parent) {
+ Composite container = getUiEnvironment().getFormToolkit().createComposite(parent);
+ StatusLabelEx label = getUiEnvironment().getFormToolkit().createStatusLabel(container, getScoutObject());
+
+ Browser browser = getUiEnvironment().getFormToolkit().createBrowser(container, SWT.NONE);
+ m_browserExtension = new BrowserExtension(browser);
+ m_browserExtension.attach();
+ browser.addDisposeListener(new DisposeListener() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void widgetDisposed(DisposeEvent e) {
+ m_browserExtension.detach();
+ }
+ });
+ browser.addLocationListener(new LocationAdapter() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void changing(LocationEvent event) {
+ URL url = null;
+ try {
+ url = new URL(event.location);
+ }
+ catch (MalformedURLException e) {
+ try {
+ url = new File(event.location).toURI().toURL();
+ }
+ catch (MalformedURLException e1) {
+ e1.printStackTrace();
+ }
+ }
+ if (url != null) {
+ event.doit = url.getProtocol().equals("file");
+ if (!event.doit) {
+ handleUiLinkAction(url);
+ }
+ }
+ }
+ });
+ //
+ setUiContainer(container);
+ setUiLabel(label);
+ setUiField(browser);
+ // layout
+ getUiContainer().setLayout(new LogicalGridLayout(1, 0));
+
+ }
+
+ @Override
+ public Browser getUiField() {
+ return (Browser) super.getUiField();
+ }
+
+ protected void handleUiLinkAction(final URL url) {
+ Runnable job = new Runnable() {
+ @Override
+ public void run() {
+ getScoutObject().getUIFacade().fireHyperlinkActionFromUI(url);
+ }
+ };
+ getUiEnvironment().invokeScoutLater(job, 0);
+ }
+
+ @Override
+ protected void setEnabledFromScout(boolean b) {
+ }
+
+ @Override
+ protected void setDisplayTextFromScout(String rawHtml) {
+ m_browserExtension.clearResourceCache();
+ m_browserExtension.clearLocalHyperlinkCache();
+ if (rawHtml == null) {
+ rawHtml = "";
+ }
+ // create attachments
+ RemoteFile[] a = getScoutObject().getAttachments();
+ if (a != null) {
+ for (RemoteFile f : a) {
+ if (f != null && f.exists()) {
+ try {
+ m_browserExtension.addResource(f.getPath(), f.getDecompressedInputStream());
+ }
+ catch (IOException e1) {
+ LOG.warn("could not read remote file '" + f.getName() + "'", e1);
+ }
+ }
+ }
+ }
+ String cleanHtml = getUiEnvironment().styleHtmlText(this, rawHtml);
+ cleanHtml = m_browserExtension.adaptLocalHyperlinks(cleanHtml, 1);
+ //fast create of browser content if there are no attachments
+ if (a == null || a.length == 0) {
+ getUiField().setText(cleanHtml);
+ }
+ else {
+ try {
+ String indexFile = m_browserExtension.addResource("index.html", new ByteArrayInputStream(cleanHtml.getBytes("UTF-8")), "UTF-8", RegisterOptions.VERSION);
+ getUiField().setUrl(indexFile);
+ }
+ catch (UnsupportedEncodingException e) {
+ //can not happen
+ }
+ }
+ }
+
+ protected void setScrollToAnchorFromScout(String anchorName) {
+ if (!StringUtility.isNullOrEmpty(anchorName)) {
+ getUiField().setUrl(getUiField().getUrl() + "#" + anchorName);
+ }
+ }
+
+ /**
+ * scout property handler override
+ */
+ @Override
+ protected void handleScoutPropertyChange(String name, Object newValue) {
+ super.handleScoutPropertyChange(name, newValue);
+ if (name.equals(IHtmlField.PROP_SCROLLBAR_SCROLL_TO_END)) {
+ getUiField().execute("window.scrollTo(0, document.body.scrollHeight)");
+ }
+ else if (name.equals(IHtmlField.PROP_SCROLLBAR_SCROLL_TO_ANCHOR)) {
+ setScrollToAnchorFromScout(TypeCastUtility.castValue(newValue, String.class));
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/imagebox/IRwtScoutImageBox.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/imagebox/IRwtScoutImageBox.java
index b99a4cab35..6a46f6e50d 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/imagebox/IRwtScoutImageBox.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/imagebox/IRwtScoutImageBox.java
@@ -1,17 +1,17 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.form.fields.imagebox;
-
-import org.eclipse.scout.rt.client.ui.form.fields.imagebox.IImageField;
-import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
-
-public interface IRwtScoutImageBox extends IRwtScoutFormField<IImageField> {
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.form.fields.imagebox;
+
+import org.eclipse.scout.rt.client.ui.form.fields.imagebox.IImageField;
+import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
+
+public interface IRwtScoutImageBox extends IRwtScoutFormField<IImageField> {
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/imagebox/RwtScoutImageField.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/imagebox/RwtScoutImageField.java
index 4132e35d53..0c91bdfc30 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/imagebox/RwtScoutImageField.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/imagebox/RwtScoutImageField.java
@@ -1,226 +1,226 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.form.fields.imagebox;
-
-import java.io.ByteArrayInputStream;
-import java.util.concurrent.atomic.AtomicReference;
-
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.beans.IPropertyObserver;
-import org.eclipse.scout.commons.dnd.TransferObject;
-import org.eclipse.scout.commons.holders.Holder;
-import org.eclipse.scout.commons.job.JobEx;
-import org.eclipse.scout.rt.client.ui.IDNDSupport;
-import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
-import org.eclipse.scout.rt.client.ui.form.fields.imagebox.IImageField;
-import org.eclipse.scout.rt.ui.rap.LogicalGridLayout;
-import org.eclipse.scout.rt.ui.rap.RwtMenuUtility;
-import org.eclipse.scout.rt.ui.rap.ext.ImageViewer;
-import org.eclipse.scout.rt.ui.rap.ext.MenuAdapterEx;
-import org.eclipse.scout.rt.ui.rap.ext.StatusLabelEx;
-import org.eclipse.scout.rt.ui.rap.extension.UiDecorationExtensionPoint;
-import org.eclipse.scout.rt.ui.rap.form.fields.AbstractRwtScoutDndSupport;
-import org.eclipse.scout.rt.ui.rap.form.fields.RwtScoutFieldComposite;
-import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.dnd.DropTargetEvent;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.MenuEvent;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.ImageData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Menu;
-
-/**
- * <h3>SwtScoutImageBox</h3> ...
- *
- * @since 3.7.0 June 2011
- */
-public class RwtScoutImageField extends RwtScoutFieldComposite<IImageField> implements IRwtScoutImageBox {
-
- private Image m_image;
- private Menu m_contextMenu;
-
- @Override
- protected void initializeUi(Composite parent) {
- Composite container = getUiEnvironment().getFormToolkit().createComposite(parent);
- StatusLabelEx label = getUiEnvironment().getFormToolkit().createStatusLabel(container, getScoutObject());
-
- ImageViewer imgViewer = getUiEnvironment().getFormToolkit().createImageViewer(container);
- setUiContainer(container);
- setUiLabel(label);
- setUiField(imgViewer);
-
- imgViewer.addDisposeListener(new DisposeListener() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void widgetDisposed(DisposeEvent e) {
- freeResources();
- }
- });
-
- m_contextMenu = new Menu(imgViewer.getShell(), SWT.POP_UP);
- m_contextMenu.addMenuListener(new P_ContextMenuListener(imgViewer, getUiField()));
- imgViewer.setMenu(m_contextMenu);
-
- // layout
- getUiContainer().setLayout(new LogicalGridLayout(1, 0));
- }
-
- private void freeResources() {
- if (m_image != null && !m_image.isDisposed() && m_image.getDevice() != null) {
- if (getUiField() != null && !getUiField().isDisposed()) {
- getUiField().setImage(null);
- }
- m_image.dispose();
- m_image = null;
- }
- }
-
- @Override
- public ImageViewer getUiField() {
- return (ImageViewer) super.getUiField();
- }
-
- @Override
- protected void attachScout() {
- super.attachScout();
- getUiField().setAlignmentX(RwtUtility.getHorizontalAlignment(getScoutObject().getGridData().horizontalAlignment));
- getUiField().setAlignmentY(RwtUtility.getHorizontalAlignment(getScoutObject().getGridData().verticalAlignment));
- updateAutoFitFromScout();
- updateImageFromScout();
- attachDndSupport();
- }
-
- protected void attachDndSupport() {
- if (UiDecorationExtensionPoint.getLookAndFeel().isDndSupportEnabled()) {
- new P_DndSupport(getScoutObject(), getScoutObject(), getUiField());
- }
- }
-
- protected void updateImageFromScout() {
- freeResources();
- if (getScoutObject().getImage() instanceof byte[]) {
- m_image = new Image(getUiField().getDisplay(), new ByteArrayInputStream((byte[]) getScoutObject().getImage()));
- getUiField().setImage(m_image);
- }
- else if (getScoutObject().getImage() instanceof ImageData) {
- m_image = new Image(getUiField().getDisplay(), (ImageData) getScoutObject().getImage());
- getUiField().setImage(m_image);
- }
- else if (!StringUtility.isNullOrEmpty(getScoutObject().getImageId())) {
- getUiField().setImage(getUiEnvironment().getIcon(getScoutObject().getImageId()));
- }
- getUiField().redraw();
- }
-
- protected void updateAutoFitFromScout() {
- getUiField().setAutoFit(getScoutObject().isAutoFit());
- }
-
- @Override
- protected void handleScoutPropertyChange(String name, Object newValue) {
- if (IImageField.PROP_IMAGE.equals(name)) {
- updateImageFromScout();
- }
- else if (IImageField.PROP_AUTO_FIT.equals(name)) {
- updateAutoFitFromScout();
-
- }
- super.handleScoutPropertyChange(name, newValue);
-
- }
-
- private class P_ContextMenuListener extends MenuAdapterEx {
- private static final long serialVersionUID = 1L;
-
- public P_ContextMenuListener(Control menuControl, Control keyStrokeWidget) {
- super(menuControl, keyStrokeWidget);
- }
-
- @Override
- protected Menu getContextMenu() {
- return m_contextMenu;
- }
-
- @Override
- protected void setContextMenu(Menu contextMenu) {
- m_contextMenu = contextMenu;
- }
-
- @Override
- public void menuShown(MenuEvent e) {
- super.menuShown(e);
-
- final AtomicReference<IMenu[]> scoutMenusRef = new AtomicReference<IMenu[]>();
- Runnable t = new Runnable() {
- @Override
- public void run() {
- IMenu[] scoutMenus = getScoutObject().getUIFacade().firePopupFromUI();
- scoutMenusRef.set(scoutMenus);
- }
- };
- JobEx job = RwtScoutImageField.this.getUiEnvironment().invokeScoutLater(t, 1200);
- try {
- job.join(1200);
- }
- catch (InterruptedException ex) {
- //nop
- }
- // grab the actions out of the job, when the actions are provided within
- // the scheduled time the popup will be handled.
- if (scoutMenusRef.get() != null) {
- RwtMenuUtility.fillContextMenu(scoutMenusRef.get(), RwtScoutImageField.this.getUiEnvironment(), m_contextMenu);
- }
- }
- } // end class P_ContextMenuListener
-
- private class P_DndSupport extends AbstractRwtScoutDndSupport {
- public P_DndSupport(IPropertyObserver scoutObject, IDNDSupport scoutDndSupportable, Control control) {
- super(scoutObject, scoutDndSupportable, control, RwtScoutImageField.this.getUiEnvironment());
- }
-
- @Override
- protected TransferObject handleUiDragRequest() {
- // will never be called here, since handleDragSetData never calls super.
- final Holder<TransferObject> result = new Holder<TransferObject>(TransferObject.class, null);
- Runnable t = new Runnable() {
- @Override
- public void run() {
- TransferObject scoutTransferable = getScoutObject().getUIFacade().fireDragRequestFromUI();
- result.setValue(scoutTransferable);
- }
- };
- JobEx job = getUiEnvironment().invokeScoutLater(t, 2345);
- try {
- job.join(2345);
- }
- catch (InterruptedException e) {
- //nop
- }
- return result.getValue();
- }
-
- @Override
- protected void handleUiDropAction(DropTargetEvent event, final TransferObject scoutTransferObject) {
- Runnable job = new Runnable() {
- @Override
- public void run() {
- getScoutObject().getUIFacade().fireDropActionFromUi(scoutTransferObject);
- }
- };
- getUiEnvironment().invokeScoutLater(job, 200);
- }
- } // end class P_DndSupport
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.form.fields.imagebox;
+
+import java.io.ByteArrayInputStream;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.beans.IPropertyObserver;
+import org.eclipse.scout.commons.dnd.TransferObject;
+import org.eclipse.scout.commons.holders.Holder;
+import org.eclipse.scout.commons.job.JobEx;
+import org.eclipse.scout.rt.client.ui.IDNDSupport;
+import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
+import org.eclipse.scout.rt.client.ui.form.fields.imagebox.IImageField;
+import org.eclipse.scout.rt.ui.rap.LogicalGridLayout;
+import org.eclipse.scout.rt.ui.rap.RwtMenuUtility;
+import org.eclipse.scout.rt.ui.rap.ext.ImageViewer;
+import org.eclipse.scout.rt.ui.rap.ext.MenuAdapterEx;
+import org.eclipse.scout.rt.ui.rap.ext.StatusLabelEx;
+import org.eclipse.scout.rt.ui.rap.extension.UiDecorationExtensionPoint;
+import org.eclipse.scout.rt.ui.rap.form.fields.AbstractRwtScoutDndSupport;
+import org.eclipse.scout.rt.ui.rap.form.fields.RwtScoutFieldComposite;
+import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.dnd.DropTargetEvent;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.MenuEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Menu;
+
+/**
+ * <h3>SwtScoutImageBox</h3> ...
+ *
+ * @since 3.7.0 June 2011
+ */
+public class RwtScoutImageField extends RwtScoutFieldComposite<IImageField> implements IRwtScoutImageBox {
+
+ private Image m_image;
+ private Menu m_contextMenu;
+
+ @Override
+ protected void initializeUi(Composite parent) {
+ Composite container = getUiEnvironment().getFormToolkit().createComposite(parent);
+ StatusLabelEx label = getUiEnvironment().getFormToolkit().createStatusLabel(container, getScoutObject());
+
+ ImageViewer imgViewer = getUiEnvironment().getFormToolkit().createImageViewer(container);
+ setUiContainer(container);
+ setUiLabel(label);
+ setUiField(imgViewer);
+
+ imgViewer.addDisposeListener(new DisposeListener() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void widgetDisposed(DisposeEvent e) {
+ freeResources();
+ }
+ });
+
+ m_contextMenu = new Menu(imgViewer.getShell(), SWT.POP_UP);
+ m_contextMenu.addMenuListener(new P_ContextMenuListener(imgViewer, getUiField()));
+ imgViewer.setMenu(m_contextMenu);
+
+ // layout
+ getUiContainer().setLayout(new LogicalGridLayout(1, 0));
+ }
+
+ private void freeResources() {
+ if (m_image != null && !m_image.isDisposed() && m_image.getDevice() != null) {
+ if (getUiField() != null && !getUiField().isDisposed()) {
+ getUiField().setImage(null);
+ }
+ m_image.dispose();
+ m_image = null;
+ }
+ }
+
+ @Override
+ public ImageViewer getUiField() {
+ return (ImageViewer) super.getUiField();
+ }
+
+ @Override
+ protected void attachScout() {
+ super.attachScout();
+ getUiField().setAlignmentX(RwtUtility.getHorizontalAlignment(getScoutObject().getGridData().horizontalAlignment));
+ getUiField().setAlignmentY(RwtUtility.getHorizontalAlignment(getScoutObject().getGridData().verticalAlignment));
+ updateAutoFitFromScout();
+ updateImageFromScout();
+ attachDndSupport();
+ }
+
+ protected void attachDndSupport() {
+ if (UiDecorationExtensionPoint.getLookAndFeel().isDndSupportEnabled()) {
+ new P_DndSupport(getScoutObject(), getScoutObject(), getUiField());
+ }
+ }
+
+ protected void updateImageFromScout() {
+ freeResources();
+ if (getScoutObject().getImage() instanceof byte[]) {
+ m_image = new Image(getUiField().getDisplay(), new ByteArrayInputStream((byte[]) getScoutObject().getImage()));
+ getUiField().setImage(m_image);
+ }
+ else if (getScoutObject().getImage() instanceof ImageData) {
+ m_image = new Image(getUiField().getDisplay(), (ImageData) getScoutObject().getImage());
+ getUiField().setImage(m_image);
+ }
+ else if (!StringUtility.isNullOrEmpty(getScoutObject().getImageId())) {
+ getUiField().setImage(getUiEnvironment().getIcon(getScoutObject().getImageId()));
+ }
+ getUiField().redraw();
+ }
+
+ protected void updateAutoFitFromScout() {
+ getUiField().setAutoFit(getScoutObject().isAutoFit());
+ }
+
+ @Override
+ protected void handleScoutPropertyChange(String name, Object newValue) {
+ if (IImageField.PROP_IMAGE.equals(name)) {
+ updateImageFromScout();
+ }
+ else if (IImageField.PROP_AUTO_FIT.equals(name)) {
+ updateAutoFitFromScout();
+
+ }
+ super.handleScoutPropertyChange(name, newValue);
+
+ }
+
+ private class P_ContextMenuListener extends MenuAdapterEx {
+ private static final long serialVersionUID = 1L;
+
+ public P_ContextMenuListener(Control menuControl, Control keyStrokeWidget) {
+ super(menuControl, keyStrokeWidget);
+ }
+
+ @Override
+ protected Menu getContextMenu() {
+ return m_contextMenu;
+ }
+
+ @Override
+ protected void setContextMenu(Menu contextMenu) {
+ m_contextMenu = contextMenu;
+ }
+
+ @Override
+ public void menuShown(MenuEvent e) {
+ super.menuShown(e);
+
+ final AtomicReference<IMenu[]> scoutMenusRef = new AtomicReference<IMenu[]>();
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ IMenu[] scoutMenus = getScoutObject().getUIFacade().firePopupFromUI();
+ scoutMenusRef.set(scoutMenus);
+ }
+ };
+ JobEx job = RwtScoutImageField.this.getUiEnvironment().invokeScoutLater(t, 1200);
+ try {
+ job.join(1200);
+ }
+ catch (InterruptedException ex) {
+ //nop
+ }
+ // grab the actions out of the job, when the actions are provided within
+ // the scheduled time the popup will be handled.
+ if (scoutMenusRef.get() != null) {
+ RwtMenuUtility.fillContextMenu(scoutMenusRef.get(), RwtScoutImageField.this.getUiEnvironment(), m_contextMenu);
+ }
+ }
+ } // end class P_ContextMenuListener
+
+ private class P_DndSupport extends AbstractRwtScoutDndSupport {
+ public P_DndSupport(IPropertyObserver scoutObject, IDNDSupport scoutDndSupportable, Control control) {
+ super(scoutObject, scoutDndSupportable, control, RwtScoutImageField.this.getUiEnvironment());
+ }
+
+ @Override
+ protected TransferObject handleUiDragRequest() {
+ // will never be called here, since handleDragSetData never calls super.
+ final Holder<TransferObject> result = new Holder<TransferObject>(TransferObject.class, null);
+ Runnable t = new Runnable() {
+ @Override
+ public void run() {
+ TransferObject scoutTransferable = getScoutObject().getUIFacade().fireDragRequestFromUI();
+ result.setValue(scoutTransferable);
+ }
+ };
+ JobEx job = getUiEnvironment().invokeScoutLater(t, 2345);
+ try {
+ job.join(2345);
+ }
+ catch (InterruptedException e) {
+ //nop
+ }
+ return result.getValue();
+ }
+
+ @Override
+ protected void handleUiDropAction(DropTargetEvent event, final TransferObject scoutTransferObject) {
+ Runnable job = new Runnable() {
+ @Override
+ public void run() {
+ getScoutObject().getUIFacade().fireDropActionFromUi(scoutTransferObject);
+ }
+ };
+ getUiEnvironment().invokeScoutLater(job, 200);
+ }
+ } // end class P_DndSupport
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/labelfield/IRwtScoutLabelField.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/labelfield/IRwtScoutLabelField.java
index 72ff85e472..103a065eb6 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/labelfield/IRwtScoutLabelField.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/labelfield/IRwtScoutLabelField.java
@@ -1,23 +1,23 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.form.fields.labelfield;
-
-import org.eclipse.scout.rt.client.ui.form.fields.labelfield.ILabelField;
-import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
-
-/**
- * <h3>IRwtScoutLabelField</h3> ...
- *
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.form.fields.labelfield;
+
+import org.eclipse.scout.rt.client.ui.form.fields.labelfield.ILabelField;
+import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
+
+/**
+ * <h3>IRwtScoutLabelField</h3> ...
+ *
* @since 3.7.0 June 2011
- */
-public interface IRwtScoutLabelField extends IRwtScoutFormField<ILabelField> {
-
-}
+ */
+public interface IRwtScoutLabelField extends IRwtScoutFormField<ILabelField> {
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/labelfield/RwtScoutLabelField.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/labelfield/RwtScoutLabelField.java
index caa88b390a..e01a180d2a 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/labelfield/RwtScoutLabelField.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/labelfield/RwtScoutLabelField.java
@@ -1,78 +1,78 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.form.fields.labelfield;
-
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.labelfield.ILabelField;
-import org.eclipse.scout.rt.ui.rap.LogicalGridData;
-import org.eclipse.scout.rt.ui.rap.LogicalGridLayout;
-import org.eclipse.scout.rt.ui.rap.ext.StatusLabelEx;
-import org.eclipse.scout.rt.ui.rap.form.fields.LogicalGridDataBuilder;
-import org.eclipse.scout.rt.ui.rap.form.fields.RwtScoutValueFieldComposite;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-
-/**
- * <h3>RwtScoutLabelField</h3> ...
- *
- * @since 3.7.0 June 2011
- */
-public class RwtScoutLabelField extends RwtScoutValueFieldComposite<ILabelField> implements IRwtScoutLabelField {
-
- @Override
- protected void initializeUi(Composite parent) {
- Composite container = getUiEnvironment().getFormToolkit().createComposite(parent);
- // label
- if (getScoutObject().isLabelVisible()) {
- StatusLabelEx label = getUiEnvironment().getFormToolkit().createStatusLabel(container, getScoutObject());
- setUiLabel(label);
- }
- //
- int style = SWT.NONE;
- if (getScoutObject().isWrapText()) {
- style |= SWT.WRAP;
- }
- Label text = getUiEnvironment().getFormToolkit().createLabel(container, "", style);
- LogicalGridData textData = LogicalGridDataBuilder.createField(((IFormField) getScoutObject()).getGridData());
- textData.topInset = 4;
- text.setLayoutData(textData);
- setUiField(text);
- //
- container.setTabList(new Control[]{});
- setUiContainer(container);
- // layout
- getUiContainer().setLayout(new LogicalGridLayout(1, 0));
- }
-
- @Override
- public Label getUiField() {
- return (Label) super.getUiField();
- }
-
- @Override
- protected void setDisplayTextFromScout(String s) {
- String oldText = getUiField().getText();
- if (s == null) {
- s = "";
- }
- if (oldText == null) {
- oldText = "";
- }
- if (oldText.equals(s)) {
- return;
- }
- getUiField().setText(s);
- getUiContainer().layout(true, true);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.form.fields.labelfield;
+
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.labelfield.ILabelField;
+import org.eclipse.scout.rt.ui.rap.LogicalGridData;
+import org.eclipse.scout.rt.ui.rap.LogicalGridLayout;
+import org.eclipse.scout.rt.ui.rap.ext.StatusLabelEx;
+import org.eclipse.scout.rt.ui.rap.form.fields.LogicalGridDataBuilder;
+import org.eclipse.scout.rt.ui.rap.form.fields.RwtScoutValueFieldComposite;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+
+/**
+ * <h3>RwtScoutLabelField</h3> ...
+ *
+ * @since 3.7.0 June 2011
+ */
+public class RwtScoutLabelField extends RwtScoutValueFieldComposite<ILabelField> implements IRwtScoutLabelField {
+
+ @Override
+ protected void initializeUi(Composite parent) {
+ Composite container = getUiEnvironment().getFormToolkit().createComposite(parent);
+ // label
+ if (getScoutObject().isLabelVisible()) {
+ StatusLabelEx label = getUiEnvironment().getFormToolkit().createStatusLabel(container, getScoutObject());
+ setUiLabel(label);
+ }
+ //
+ int style = SWT.NONE;
+ if (getScoutObject().isWrapText()) {
+ style |= SWT.WRAP;
+ }
+ Label text = getUiEnvironment().getFormToolkit().createLabel(container, "", style);
+ LogicalGridData textData = LogicalGridDataBuilder.createField(((IFormField) getScoutObject()).getGridData());
+ textData.topInset = 4;
+ text.setLayoutData(textData);
+ setUiField(text);
+ //
+ container.setTabList(new Control[]{});
+ setUiContainer(container);
+ // layout
+ getUiContainer().setLayout(new LogicalGridLayout(1, 0));
+ }
+
+ @Override
+ public Label getUiField() {
+ return (Label) super.getUiField();
+ }
+
+ @Override
+ protected void setDisplayTextFromScout(String s) {
+ String oldText = getUiField().getText();
+ if (s == null) {
+ s = "";
+ }
+ if (oldText == null) {
+ oldText = "";
+ }
+ if (oldText.equals(s)) {
+ return;
+ }
+ getUiField().setText(s);
+ getUiContainer().layout(true, true);
+ }
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/listbox/IRwtScoutListBox.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/listbox/IRwtScoutListBox.java
index 28a1e929a8..cdfb80d51c 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/listbox/IRwtScoutListBox.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/listbox/IRwtScoutListBox.java
@@ -1,18 +1,18 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.form.fields.listbox;
-
-import org.eclipse.scout.rt.client.ui.form.fields.listbox.IListBox;
-import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
-
-public interface IRwtScoutListBox extends IRwtScoutFormField<IListBox<?>> {
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.form.fields.listbox;
+
+import org.eclipse.scout.rt.client.ui.form.fields.listbox.IListBox;
+import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
+
+public interface IRwtScoutListBox extends IRwtScoutFormField<IListBox<?>> {
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/listbox/RwtScoutListBox.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/listbox/RwtScoutListBox.java
index edb04931d2..e5cc34ff9a 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/listbox/RwtScoutListBox.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/listbox/RwtScoutListBox.java
@@ -1,91 +1,91 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.form.fields.listbox;
-
-import org.eclipse.rwt.lifecycle.WidgetUtil;
-import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
-import org.eclipse.scout.rt.client.ui.form.fields.listbox.IListBox;
-import org.eclipse.scout.rt.ui.rap.LogicalGridData;
-import org.eclipse.scout.rt.ui.rap.LogicalGridLayout;
-import org.eclipse.scout.rt.ui.rap.basic.IRwtScoutComposite;
-import org.eclipse.scout.rt.ui.rap.basic.table.IRwtScoutTableForPatch;
-import org.eclipse.scout.rt.ui.rap.ext.StatusLabelEx;
-import org.eclipse.scout.rt.ui.rap.ext.table.TableEx;
-import org.eclipse.scout.rt.ui.rap.form.fields.LogicalGridDataBuilder;
-import org.eclipse.scout.rt.ui.rap.form.fields.RwtScoutValueFieldComposite;
-import org.eclipse.scout.rt.ui.rap.services.common.patchedclass.IPatchedClassService;
-import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
-import org.eclipse.scout.service.SERVICES;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-/**
- * <h3>RwtScoutListBox</h3> ...
- *
- * @since 3.7.0 June 2011
- */
-public class RwtScoutListBox extends RwtScoutValueFieldComposite<IListBox<?>> implements IRwtScoutListBox {
-
- private IRwtScoutTableForPatch m_tableComposite;
- private Composite m_tableContainer;
-
- @Override
- protected void initializeUi(Composite parent) {
- Composite container = getUiEnvironment().getFormToolkit().createComposite(parent);
- StatusLabelEx label = getUiEnvironment().getFormToolkit().createStatusLabel(container, getScoutObject());
-
- Composite tableContainer = new Composite(container, SWT.NONE);
- tableContainer.setLayout(new LogicalGridLayout(1, 0));
- tableContainer.setData(WidgetUtil.CUSTOM_VARIANT, RwtUtility.VARIANT_LISTBOX);
- m_tableContainer = tableContainer;
- m_tableComposite = SERVICES.getService(IPatchedClassService.class).createRwtScoutTable(RwtUtility.VARIANT_LISTBOX);
- m_tableComposite.createUiField(tableContainer, getScoutObject().getTable(), getUiEnvironment());
- LogicalGridData fieldData = LogicalGridDataBuilder.createField(getScoutObject().getGridData());
- // filter box
- IFormField[] childFields = getScoutObject().getFields();
- if (childFields.length > 0) {
- IRwtScoutComposite filterComposite = getUiEnvironment().createFormField(container, childFields[0]);
- LogicalGridData filterData = LogicalGridDataBuilder.createField(childFields[0].getGridData());
- filterData.gridx = fieldData.gridx;
- filterData.gridy = fieldData.gridy + fieldData.gridh;
- filterData.gridw = fieldData.gridw;
- filterData.weightx = fieldData.weightx;
- filterComposite.getUiContainer().setLayoutData(filterData);
- }
- //
- setUiContainer(container);
- setUiLabel(label);
- TableEx tableField = m_tableComposite.getUiField();
- tableContainer.setLayoutData(fieldData);
- setUiField(tableField);
-
- // layout
- getUiContainer().setLayout(new LogicalGridLayout(1, 0));
- }
-
- /**
- * complete override
- */
- @Override
- protected void setFieldEnabled(Control uiField, boolean b) {
- m_tableComposite.setEnabledFromScout(b);
- }
-
- @Override
- protected void setEnabledFromScout(boolean b) {
- super.setEnabledFromScout(b);
- // Workaround, because ":disabled" state seems to be ignored by RAP
- if (m_tableContainer != null) {
- m_tableContainer.setData(WidgetUtil.CUSTOM_VARIANT, (b ? RwtUtility.VARIANT_LISTBOX : RwtUtility.VARIANT_LISTBOX_DISABLED));
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.form.fields.listbox;
+
+import org.eclipse.rwt.lifecycle.WidgetUtil;
+import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
+import org.eclipse.scout.rt.client.ui.form.fields.listbox.IListBox;
+import org.eclipse.scout.rt.ui.rap.LogicalGridData;
+import org.eclipse.scout.rt.ui.rap.LogicalGridLayout;
+import org.eclipse.scout.rt.ui.rap.basic.IRwtScoutComposite;
+import org.eclipse.scout.rt.ui.rap.basic.table.IRwtScoutTableForPatch;
+import org.eclipse.scout.rt.ui.rap.ext.StatusLabelEx;
+import org.eclipse.scout.rt.ui.rap.ext.table.TableEx;
+import org.eclipse.scout.rt.ui.rap.form.fields.LogicalGridDataBuilder;
+import org.eclipse.scout.rt.ui.rap.form.fields.RwtScoutValueFieldComposite;
+import org.eclipse.scout.rt.ui.rap.services.common.patchedclass.IPatchedClassService;
+import org.eclipse.scout.rt.ui.rap.util.RwtUtility;
+import org.eclipse.scout.service.SERVICES;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+/**
+ * <h3>RwtScoutListBox</h3> ...
+ *
+ * @since 3.7.0 June 2011
+ */
+public class RwtScoutListBox extends RwtScoutValueFieldComposite<IListBox<?>> implements IRwtScoutListBox {
+
+ private IRwtScoutTableForPatch m_tableComposite;
+ private Composite m_tableContainer;
+
+ @Override
+ protected void initializeUi(Composite parent) {
+ Composite container = getUiEnvironment().getFormToolkit().createComposite(parent);
+ StatusLabelEx label = getUiEnvironment().getFormToolkit().createStatusLabel(container, getScoutObject());
+
+ Composite tableContainer = new Composite(container, SWT.NONE);
+ tableContainer.setLayout(new LogicalGridLayout(1, 0));
+ tableContainer.setData(WidgetUtil.CUSTOM_VARIANT, RwtUtility.VARIANT_LISTBOX);
+ m_tableContainer = tableContainer;
+ m_tableComposite = SERVICES.getService(IPatchedClassService.class).createRwtScoutTable(RwtUtility.VARIANT_LISTBOX);
+ m_tableComposite.createUiField(tableContainer, getScoutObject().getTable(), getUiEnvironment());
+ LogicalGridData fieldData = LogicalGridDataBuilder.createField(getScoutObject().getGridData());
+ // filter box
+ IFormField[] childFields = getScoutObject().getFields();
+ if (childFields.length > 0) {
+ IRwtScoutComposite filterComposite = getUiEnvironment().createFormField(container, childFields[0]);
+ LogicalGridData filterData = LogicalGridDataBuilder.createField(childFields[0].getGridData());
+ filterData.gridx = fieldData.gridx;
+ filterData.gridy = fieldData.gridy + fieldData.gridh;
+ filterData.gridw = fieldData.gridw;
+ filterData.weightx = fieldData.weightx;
+ filterComposite.getUiContainer().setLayoutData(filterData);
+ }
+ //
+ setUiContainer(container);
+ setUiLabel(label);
+ TableEx tableField = m_tableComposite.getUiField();
+ tableContainer.setLayoutData(fieldData);
+ setUiField(tableField);
+
+ // layout
+ getUiContainer().setLayout(new LogicalGridLayout(1, 0));
+ }
+
+ /**
+ * complete override
+ */
+ @Override
+ protected void setFieldEnabled(Control uiField, boolean b) {
+ m_tableComposite.setEnabledFromScout(b);
+ }
+
+ @Override
+ protected void setEnabledFromScout(boolean b) {
+ super.setEnabledFromScout(b);
+ // Workaround, because ":disabled" state seems to be ignored by RAP
+ if (m_tableContainer != null) {
+ m_tableContainer.setData(WidgetUtil.CUSTOM_VARIANT, (b ? RwtUtility.VARIANT_LISTBOX : RwtUtility.VARIANT_LISTBOX_DISABLED));
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/numberfield/IRwtScoutNumberField.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/numberfield/IRwtScoutNumberField.java
index 07b86a6859..d636a3881b 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/numberfield/IRwtScoutNumberField.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/form/fields/numberfield/IRwtScoutNumberField.java
@@ -1,23 +1,23 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.form.fields.numberfield;
-
-import org.eclipse.scout.rt.client.ui.form.fields.numberfield.INumberField;
-import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
-
-/**
- * <h3>IRwtScoutLongField</h3> ...
- *
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.form.fields.numberfield;
+
+import org.eclipse.scout.rt.client.ui.form.fields.numberfield.INumberField;
+import org.eclipse.scout.rt.ui.rap.form.fields.IRwtScoutFormField;
+
+/**
+ * <h3>IRwtScoutLongField</h3> ...
+ *
* @since 3.7.0 June 2011
- */
-public interface IRwtScoutNumberField extends IRwtScoutFormField<INumberField<?>> {
-
-}
+ */
+public interface IRwtScoutNumberField extends IRwtScoutFormField<INumberField<?>> {
+
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/internal/servletfilter/LogoutFilter.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/internal/servletfilter/LogoutFilter.java
index edae24870a..08b6a0ee3a 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/internal/servletfilter/LogoutFilter.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/internal/servletfilter/LogoutFilter.java
@@ -1,87 +1,87 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.internal.servletfilter;
-
-import java.io.IOException;
-
-import javax.servlet.Filter;
-import javax.servlet.FilterChain;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-
-import org.eclipse.scout.http.servletfilter.FilterConfigInjection;
-
-/**
- * Filter which checks for a query parameter called "doLogout" and invalidates the session if the parameter is set.
- * <p>
- * After invalidating the session a redirect to the originally requested site is sent and the filter chain gets
- * interrupted (no more filters will be executed).
- * <p>
- *
- * @since 3.8.2
- */
-public class LogoutFilter implements Filter {
- public static String LOGOUT_PARAM = "doLogout";
-
- private FilterConfigInjection m_injection;
-
- @Override
- public void init(FilterConfig config0) throws ServletException {
- m_injection = new FilterConfigInjection(config0, getClass());
- }
-
- @Override
- public void destroy() {
- m_injection = null;
- }
-
- @Override
- public void doFilter(ServletRequest request, ServletResponse response, final FilterChain chain) throws IOException, ServletException {
- FilterConfigInjection.FilterConfig config = m_injection.getConfig(request);
- if (!config.isActive()) {
- chain.doFilter(request, response);
- return;
- }
-
- String logoutParam = request.getParameter(LOGOUT_PARAM);
- if (logoutParam == null) {
- chain.doFilter(request, response);
- return;
- }
-
- HttpServletRequest httpRequest = (HttpServletRequest) request;
- HttpSession session = httpRequest.getSession(false);
- if (session == null) {
- chain.doFilter(request, response);
- return;
- }
-
- session.invalidate();
-
- HttpServletResponse httpResponse = (HttpServletResponse) response;
- String servletPath = getRedirectUrl(httpRequest);
- httpResponse.sendRedirect(httpResponse.encodeRedirectURL(servletPath));
- }
-
- protected String getRedirectUrl(HttpServletRequest httpRequest) {
- String servletPath = httpRequest.getServletPath();
- if (servletPath.length() > 0 && '/' == servletPath.charAt(0)) {
- servletPath = servletPath.substring(1);
- }
-
- return servletPath;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.internal.servletfilter;
+
+import java.io.IOException;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import org.eclipse.scout.http.servletfilter.FilterConfigInjection;
+
+/**
+ * Filter which checks for a query parameter called "doLogout" and invalidates the session if the parameter is set.
+ * <p>
+ * After invalidating the session a redirect to the originally requested site is sent and the filter chain gets
+ * interrupted (no more filters will be executed).
+ * <p>
+ *
+ * @since 3.8.2
+ */
+public class LogoutFilter implements Filter {
+ public static String LOGOUT_PARAM = "doLogout";
+
+ private FilterConfigInjection m_injection;
+
+ @Override
+ public void init(FilterConfig config0) throws ServletException {
+ m_injection = new FilterConfigInjection(config0, getClass());
+ }
+
+ @Override
+ public void destroy() {
+ m_injection = null;
+ }
+
+ @Override
+ public void doFilter(ServletRequest request, ServletResponse response, final FilterChain chain) throws IOException, ServletException {
+ FilterConfigInjection.FilterConfig config = m_injection.getConfig(request);
+ if (!config.isActive()) {
+ chain.doFilter(request, response);
+ return;
+ }
+
+ String logoutParam = request.getParameter(LOGOUT_PARAM);
+ if (logoutParam == null) {
+ chain.doFilter(request, response);
+ return;
+ }
+
+ HttpServletRequest httpRequest = (HttpServletRequest) request;
+ HttpSession session = httpRequest.getSession(false);
+ if (session == null) {
+ chain.doFilter(request, response);
+ return;
+ }
+
+ session.invalidate();
+
+ HttpServletResponse httpResponse = (HttpServletResponse) response;
+ String servletPath = getRedirectUrl(httpRequest);
+ httpResponse.sendRedirect(httpResponse.encodeRedirectURL(servletPath));
+ }
+
+ protected String getRedirectUrl(HttpServletRequest httpRequest) {
+ String servletPath = httpRequest.getServletPath();
+ if (servletPath.length() > 0 && '/' == servletPath.charAt(0)) {
+ servletPath = servletPath.substring(1);
+ }
+
+ return servletPath;
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/util/BrowserInfoBuilder.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/util/BrowserInfoBuilder.java
index a1258b230f..304cf78168 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/util/BrowserInfoBuilder.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/util/BrowserInfoBuilder.java
@@ -1,291 +1,291 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.rt.ui.rap.util;
-
-import java.util.Enumeration;
-import java.util.Locale;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import javax.servlet.http.HttpServletRequest;
-
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.logger.IScoutLogger;
-import org.eclipse.scout.commons.logger.ScoutLogManager;
-import org.osgi.framework.Version;
-
-/**
- * @since 3.8.2
- */
-public class BrowserInfoBuilder {
- private static final IScoutLogger LOG = ScoutLogManager.getLogger(BrowserInfoBuilder.class);
-
- public BrowserInfo createBrowserInfo(HttpServletRequest request) {
- BrowserInfo info;
- if (LOG.isInfoEnabled()) {
- Enumeration headerNames = request.getHeaderNames();
- while (headerNames.hasMoreElements()) {
- String headerName = (String) headerNames.nextElement();
- String header = request.getHeader(headerName);
- headerName = headerName + (headerName.length() <= 11 ? "\t\t" : "\t");
- LOG.info(headerName + header);
- }
- }
-
- String userAgent = request.getHeader("User-Agent");
- info = createBrowserInfo(userAgent, request.getLocale());
-
- if (LOG.isInfoEnabled()) {
- LOG.info(info.toString());
- }
- return info;
- }
-
- public BrowserInfo createBrowserInfo(String userAgent, Locale locale) {
- BrowserInfo info = createBrowserInfo(userAgent);
- info.setUserAgent(userAgent);
- info.setLocale(locale);
-
- if (userAgent.indexOf("Windows") != -1
- || userAgent.indexOf("Win32") != -1
- || userAgent.indexOf("Win64") != -1) {
- info.setSystem(BrowserInfo.System.WINDOWS);
- if (userAgent.indexOf("Windows Phone") != -1
- || userAgent.indexOf("IEMobile") != -1) {
- info.setSystemVersion(parseWindowsPhoneVersion(userAgent));
- info.setMobile(true);
- }
- else {
- info.setSystemVersion(parseWindowsVersion(userAgent));
- }
- }
- else if (userAgent.indexOf("Macintosh") != -1
- || userAgent.indexOf("MacPPC") != -1
- || userAgent.indexOf("MacIntel") != -1) {//FIXME
- info.setSystem(BrowserInfo.System.OSX);
- }
- else if (userAgent.indexOf("X11") != -1
- || userAgent.indexOf("Linux") != -1
- || userAgent.indexOf("BSD") != -1) {//FIXME
- if (userAgent.indexOf("Android") != -1) {
- info.setSystem(BrowserInfo.System.ANDROID);
- info.setSystemVersion(parseAndroidVersion(userAgent));
- initAndroidMobileFlags(info);
- }
- else {
- info.setSystem(BrowserInfo.System.UNIX);
- }
- }
- else if (userAgent.indexOf("iPad") != -1) {
- info.setSystem(BrowserInfo.System.IOS);
- info.setSystemVersion(parseIosVersion(userAgent));
- info.setTablet(true);
- }
- else if (userAgent.indexOf("iPhone") != -1
- || userAgent.indexOf("iPod") != -1) {
- info.setSystem(BrowserInfo.System.IOS);
- info.setSystemVersion(parseIosVersion(userAgent));
- info.setMobile(true);
- }
- else {
- info.setSystem(BrowserInfo.System.UNKNOWN);
- }
-
- return info;
- }
-
- private void initAndroidMobileFlags(BrowserInfo info) {
- if (info.getSystemVersion() == null) {
- info.setMobile(true);
- return;
- }
-
- if (info.getSystemVersion().getMajor() <= 2) {
- info.setMobile(true);
- }
- else if (info.getSystemVersion().getMajor() == 3) {
- info.setTablet(true);
- }
- else {
- //Android 4 is used on smartphones and tablets
- if (info.getUserAgent().indexOf("Mobile") != -1) {
- info.setMobile(true);
- }
- else {
- info.setTablet(true);
- }
- }
- }
-
- private BrowserInfo createBrowserInfo(String userAgent) {
- BrowserInfo info = null;
- Version v = null;
-
- //Opera
- String regex = "Opera[\\s\\/]([0-9\\.]*)";
- boolean isOpera = StringUtility.contains(userAgent, regex);
- if (isOpera) {
- v = parseBrowserVersion(userAgent, regex);
- info = new BrowserInfo(BrowserInfo.Type.OPERA, v);
- info.setOpera(isOpera);
- return info;
- }
-
- //Konqueror
- regex = "KHTML\\/([0-9-\\.]*)";
- boolean isKonqueror = StringUtility.contains(userAgent, regex);
- if (isKonqueror) {
- v = parseBrowserVersion(userAgent, regex);
- info = new BrowserInfo(BrowserInfo.Type.KONQUEROR, null);
- info.setWebkit(isKonqueror);
- return info;
- }
-
- //Webkit Browsers
- regex = "AppleWebKit\\/([^ ]+)";
- boolean isWebkit = userAgent.indexOf("AppleWebKit") != -1
- && StringUtility.contains(userAgent, regex);
- if (isWebkit) {
- v = parseBrowserVersion(userAgent, regex);
- if (userAgent.indexOf("Chrome") != -1) {
- info = new BrowserInfo(BrowserInfo.Type.GOOGLE_CHROME, v);
- }
- else if (userAgent.indexOf("Safari") != -1) {
- if (userAgent.indexOf("Android") != -1) {
- info = new BrowserInfo(BrowserInfo.Type.ANDROID, v);
- }
- else {
- info = new BrowserInfo(BrowserInfo.Type.APPLE_SAFARI, v);
- }
- }
- else if (userAgent.indexOf("OmniWeb") != -1) {
- info = new BrowserInfo(BrowserInfo.Type.OMNI_WEB, v);
- }
- else if (userAgent.indexOf("Shiira") != -1) {
- info = new BrowserInfo(BrowserInfo.Type.SHIRA, v);
- }
- else if (userAgent.indexOf("NetNewsWire") != -1) {
- info = new BrowserInfo(BrowserInfo.Type.BLACKPIXEL_NETNEWSWIRE, v);
- }
- else if (userAgent.indexOf("RealPlayer") != -1) {
- info = new BrowserInfo(BrowserInfo.Type.REALNETWORKS_REALPLAYER, v);
- }
- else if (userAgent.indexOf("Mobile") != -1) {
- // iPad reports this in fullscreen mode
- info = new BrowserInfo(BrowserInfo.Type.APPLE_SAFARI, v);
- }
- else {
- info = new BrowserInfo(BrowserInfo.Type.UNKNOWN, null);
- }
- info.setWebkit(isWebkit);
- return info;
- }
-
- //Gecko Browsers (Firefox)
- regex = "rv\\:([^\\);]+)(\\)|;)";
- boolean isGecko = userAgent.indexOf("Gecko") != -1
- && StringUtility.contains(userAgent, regex);
- if (isGecko) {
- v = parseBrowserVersion(userAgent, regex);
- if (userAgent.indexOf("Firefox") != -1) {
- info = new BrowserInfo(BrowserInfo.Type.MOZILLA_FIREFOX, v);
- }
- else if (userAgent.indexOf("Camino") != -1) {
- info = new BrowserInfo(BrowserInfo.Type.MOZILLA_CAMINO, v);
- }
- else if (userAgent.indexOf("Galeon") != -1) {
- info = new BrowserInfo(BrowserInfo.Type.GNOME_GALOEN, v);
- }
- else {
- info = new BrowserInfo(BrowserInfo.Type.UNKNOWN, null);
- }
- info.setGecko(isGecko);
- return info;
- }
-
- //Internet Explorer
- regex = "MSIE\\s+([^\\);]+)(\\)|;)";
- boolean isMshtml = StringUtility.contains(userAgent, regex);
- if (isMshtml) {
- v = parseBrowserVersion(userAgent, regex);
- if (userAgent.indexOf("MSIE") != -1) {
- info = new BrowserInfo(BrowserInfo.Type.IE, v);
- }
- else {
- info = new BrowserInfo(BrowserInfo.Type.UNKNOWN, null);
- }
- info.setMshtml(isMshtml);
- return info;
- }
-
- return new BrowserInfo(BrowserInfo.Type.UNKNOWN, null);
- }
-
- private Version parseBrowserVersion(String userAgent, String regex) {
- Matcher matcher = Pattern.compile(".*" + regex + ".*", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL).matcher(userAgent);
- if (matcher.matches()) {
- String s = matcher.group(1);
- return createVersion(s);
- }
-
- return null;
- }
-
- private Version parseSystemVersion(String userAgent, String regex) {
- Matcher matcher = Pattern.compile(regex, Pattern.CASE_INSENSITIVE).matcher(userAgent);
- if (matcher.find()) {
- String s = matcher.group(1);
- return createVersion(s);
- }
-
- return null;
- }
-
- private Version parseAndroidVersion(String userAgent) {
- return parseSystemVersion(userAgent, "Android\\s([^\\s;]+)");
- }
-
- private Version parseIosVersion(String userAgent) {
- userAgent = userAgent.replace("_", ".");
- return parseSystemVersion(userAgent, "\\sOS\\s([^\\s;]+)");
- }
-
- private Version parseWindowsPhoneVersion(String userAgent) {
- return parseSystemVersion(userAgent, "\\sOS\\s([^\\s;]+)");
- }
-
- private Version parseWindowsVersion(String userAgent) {
- return parseSystemVersion(userAgent, "Windows\\sNT\\s([^\\s;]+)");
- }
-
- private Version createVersion(String versionString) {
- versionString = versionString.replaceAll("^[/\\s]*", "");
-
- int[] vArr = new int[]{0, 0, 0};
- //Searches for 3 groups containing numbers separated with a dot.
- //Group 3 is optional (MSIE only has a major and a minor version, no micro)
- Matcher m = Pattern.compile("([0-9]+)\\.([0-9]+)[\\.]?([0-9]*)").matcher(versionString);
-
-// // Fix Opera version to match wikipedia style
-// version = version.substring( 0, 3 ) + "." + version.substring ( 3);FIXME sle
- if (m.find()) {
- for (int i = 1; i <= 3; i++) {
- String versionPart = m.group(i);
- if (StringUtility.hasText(versionPart)) {
- vArr[i - 1] = Integer.valueOf(versionPart);
- }
- }
- }
-
- return new Version(vArr[0], vArr[1], vArr[2]);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.util;
+
+import java.util.Enumeration;
+import java.util.Locale;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.logger.IScoutLogger;
+import org.eclipse.scout.commons.logger.ScoutLogManager;
+import org.osgi.framework.Version;
+
+/**
+ * @since 3.8.2
+ */
+public class BrowserInfoBuilder {
+ private static final IScoutLogger LOG = ScoutLogManager.getLogger(BrowserInfoBuilder.class);
+
+ public BrowserInfo createBrowserInfo(HttpServletRequest request) {
+ BrowserInfo info;
+ if (LOG.isInfoEnabled()) {
+ Enumeration headerNames = request.getHeaderNames();
+ while (headerNames.hasMoreElements()) {
+ String headerName = (String) headerNames.nextElement();
+ String header = request.getHeader(headerName);
+ headerName = headerName + (headerName.length() <= 11 ? "\t\t" : "\t");
+ LOG.info(headerName + header);
+ }
+ }
+
+ String userAgent = request.getHeader("User-Agent");
+ info = createBrowserInfo(userAgent, request.getLocale());
+
+ if (LOG.isInfoEnabled()) {
+ LOG.info(info.toString());
+ }
+ return info;
+ }
+
+ public BrowserInfo createBrowserInfo(String userAgent, Locale locale) {
+ BrowserInfo info = createBrowserInfo(userAgent);
+ info.setUserAgent(userAgent);
+ info.setLocale(locale);
+
+ if (userAgent.indexOf("Windows") != -1
+ || userAgent.indexOf("Win32") != -1
+ || userAgent.indexOf("Win64") != -1) {
+ info.setSystem(BrowserInfo.System.WINDOWS);
+ if (userAgent.indexOf("Windows Phone") != -1
+ || userAgent.indexOf("IEMobile") != -1) {
+ info.setSystemVersion(parseWindowsPhoneVersion(userAgent));
+ info.setMobile(true);
+ }
+ else {
+ info.setSystemVersion(parseWindowsVersion(userAgent));
+ }
+ }
+ else if (userAgent.indexOf("Macintosh") != -1
+ || userAgent.indexOf("MacPPC") != -1
+ || userAgent.indexOf("MacIntel") != -1) {//FIXME
+ info.setSystem(BrowserInfo.System.OSX);
+ }
+ else if (userAgent.indexOf("X11") != -1
+ || userAgent.indexOf("Linux") != -1
+ || userAgent.indexOf("BSD") != -1) {//FIXME
+ if (userAgent.indexOf("Android") != -1) {
+ info.setSystem(BrowserInfo.System.ANDROID);
+ info.setSystemVersion(parseAndroidVersion(userAgent));
+ initAndroidMobileFlags(info);
+ }
+ else {
+ info.setSystem(BrowserInfo.System.UNIX);
+ }
+ }
+ else if (userAgent.indexOf("iPad") != -1) {
+ info.setSystem(BrowserInfo.System.IOS);
+ info.setSystemVersion(parseIosVersion(userAgent));
+ info.setTablet(true);
+ }
+ else if (userAgent.indexOf("iPhone") != -1
+ || userAgent.indexOf("iPod") != -1) {
+ info.setSystem(BrowserInfo.System.IOS);
+ info.setSystemVersion(parseIosVersion(userAgent));
+ info.setMobile(true);
+ }
+ else {
+ info.setSystem(BrowserInfo.System.UNKNOWN);
+ }
+
+ return info;
+ }
+
+ private void initAndroidMobileFlags(BrowserInfo info) {
+ if (info.getSystemVersion() == null) {
+ info.setMobile(true);
+ return;
+ }
+
+ if (info.getSystemVersion().getMajor() <= 2) {
+ info.setMobile(true);
+ }
+ else if (info.getSystemVersion().getMajor() == 3) {
+ info.setTablet(true);
+ }
+ else {
+ //Android 4 is used on smartphones and tablets
+ if (info.getUserAgent().indexOf("Mobile") != -1) {
+ info.setMobile(true);
+ }
+ else {
+ info.setTablet(true);
+ }
+ }
+ }
+
+ private BrowserInfo createBrowserInfo(String userAgent) {
+ BrowserInfo info = null;
+ Version v = null;
+
+ //Opera
+ String regex = "Opera[\\s\\/]([0-9\\.]*)";
+ boolean isOpera = StringUtility.contains(userAgent, regex);
+ if (isOpera) {
+ v = parseBrowserVersion(userAgent, regex);
+ info = new BrowserInfo(BrowserInfo.Type.OPERA, v);
+ info.setOpera(isOpera);
+ return info;
+ }
+
+ //Konqueror
+ regex = "KHTML\\/([0-9-\\.]*)";
+ boolean isKonqueror = StringUtility.contains(userAgent, regex);
+ if (isKonqueror) {
+ v = parseBrowserVersion(userAgent, regex);
+ info = new BrowserInfo(BrowserInfo.Type.KONQUEROR, null);
+ info.setWebkit(isKonqueror);
+ return info;
+ }
+
+ //Webkit Browsers
+ regex = "AppleWebKit\\/([^ ]+)";
+ boolean isWebkit = userAgent.indexOf("AppleWebKit") != -1
+ && StringUtility.contains(userAgent, regex);
+ if (isWebkit) {
+ v = parseBrowserVersion(userAgent, regex);
+ if (userAgent.indexOf("Chrome") != -1) {
+ info = new BrowserInfo(BrowserInfo.Type.GOOGLE_CHROME, v);
+ }
+ else if (userAgent.indexOf("Safari") != -1) {
+ if (userAgent.indexOf("Android") != -1) {
+ info = new BrowserInfo(BrowserInfo.Type.ANDROID, v);
+ }
+ else {
+ info = new BrowserInfo(BrowserInfo.Type.APPLE_SAFARI, v);
+ }
+ }
+ else if (userAgent.indexOf("OmniWeb") != -1) {
+ info = new BrowserInfo(BrowserInfo.Type.OMNI_WEB, v);
+ }
+ else if (userAgent.indexOf("Shiira") != -1) {
+ info = new BrowserInfo(BrowserInfo.Type.SHIRA, v);
+ }
+ else if (userAgent.indexOf("NetNewsWire") != -1) {
+ info = new BrowserInfo(BrowserInfo.Type.BLACKPIXEL_NETNEWSWIRE, v);
+ }
+ else if (userAgent.indexOf("RealPlayer") != -1) {
+ info = new BrowserInfo(BrowserInfo.Type.REALNETWORKS_REALPLAYER, v);
+ }
+ else if (userAgent.indexOf("Mobile") != -1) {
+ // iPad reports this in fullscreen mode
+ info = new BrowserInfo(BrowserInfo.Type.APPLE_SAFARI, v);
+ }
+ else {
+ info = new BrowserInfo(BrowserInfo.Type.UNKNOWN, null);
+ }
+ info.setWebkit(isWebkit);
+ return info;
+ }
+
+ //Gecko Browsers (Firefox)
+ regex = "rv\\:([^\\);]+)(\\)|;)";
+ boolean isGecko = userAgent.indexOf("Gecko") != -1
+ && StringUtility.contains(userAgent, regex);
+ if (isGecko) {
+ v = parseBrowserVersion(userAgent, regex);
+ if (userAgent.indexOf("Firefox") != -1) {
+ info = new BrowserInfo(BrowserInfo.Type.MOZILLA_FIREFOX, v);
+ }
+ else if (userAgent.indexOf("Camino") != -1) {
+ info = new BrowserInfo(BrowserInfo.Type.MOZILLA_CAMINO, v);
+ }
+ else if (userAgent.indexOf("Galeon") != -1) {
+ info = new BrowserInfo(BrowserInfo.Type.GNOME_GALOEN, v);
+ }
+ else {
+ info = new BrowserInfo(BrowserInfo.Type.UNKNOWN, null);
+ }
+ info.setGecko(isGecko);
+ return info;
+ }
+
+ //Internet Explorer
+ regex = "MSIE\\s+([^\\);]+)(\\)|;)";
+ boolean isMshtml = StringUtility.contains(userAgent, regex);
+ if (isMshtml) {
+ v = parseBrowserVersion(userAgent, regex);
+ if (userAgent.indexOf("MSIE") != -1) {
+ info = new BrowserInfo(BrowserInfo.Type.IE, v);
+ }
+ else {
+ info = new BrowserInfo(BrowserInfo.Type.UNKNOWN, null);
+ }
+ info.setMshtml(isMshtml);
+ return info;
+ }
+
+ return new BrowserInfo(BrowserInfo.Type.UNKNOWN, null);
+ }
+
+ private Version parseBrowserVersion(String userAgent, String regex) {
+ Matcher matcher = Pattern.compile(".*" + regex + ".*", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL).matcher(userAgent);
+ if (matcher.matches()) {
+ String s = matcher.group(1);
+ return createVersion(s);
+ }
+
+ return null;
+ }
+
+ private Version parseSystemVersion(String userAgent, String regex) {
+ Matcher matcher = Pattern.compile(regex, Pattern.CASE_INSENSITIVE).matcher(userAgent);
+ if (matcher.find()) {
+ String s = matcher.group(1);
+ return createVersion(s);
+ }
+
+ return null;
+ }
+
+ private Version parseAndroidVersion(String userAgent) {
+ return parseSystemVersion(userAgent, "Android\\s([^\\s;]+)");
+ }
+
+ private Version parseIosVersion(String userAgent) {
+ userAgent = userAgent.replace("_", ".");
+ return parseSystemVersion(userAgent, "\\sOS\\s([^\\s;]+)");
+ }
+
+ private Version parseWindowsPhoneVersion(String userAgent) {
+ return parseSystemVersion(userAgent, "\\sOS\\s([^\\s;]+)");
+ }
+
+ private Version parseWindowsVersion(String userAgent) {
+ return parseSystemVersion(userAgent, "Windows\\sNT\\s([^\\s;]+)");
+ }
+
+ private Version createVersion(String versionString) {
+ versionString = versionString.replaceAll("^[/\\s]*", "");
+
+ int[] vArr = new int[]{0, 0, 0};
+ //Searches for 3 groups containing numbers separated with a dot.
+ //Group 3 is optional (MSIE only has a major and a minor version, no micro)
+ Matcher m = Pattern.compile("([0-9]+)\\.([0-9]+)[\\.]?([0-9]*)").matcher(versionString);
+
+// // Fix Opera version to match wikipedia style
+// version = version.substring( 0, 3 ) + "." + version.substring ( 3);FIXME sle
+ if (m.find()) {
+ for (int i = 1; i <= 3; i++) {
+ String versionPart = m.group(i);
+ if (StringUtility.hasText(versionPart)) {
+ vArr[i - 1] = Integer.valueOf(versionPart);
+ }
+ }
+ }
+
+ return new Version(vArr[0], vArr[1], vArr[2]);
+ }
+
+}

Back to the top